summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>2003-05-14 13:05:23 +0000
committerSVN Migration <svn@php.net>2003-05-14 13:05:23 +0000
commit09e0bfba498b74639be02732aaf0e527c898a58c (patch)
treed6784e1e79522aa3aae24414a1b89eb72f5f0497
parent1a521e5ab6a606061f9b1493369f26a7c847e99b (diff)
downloadphp-git-09e0bfba498b74639be02732aaf0e527c898a58c.tar.gz
This commit was manufactured by cvs2svn to create tag 'RELEASE_0_9b'.RELEASE_0_9b
-rw-r--r--.gdbinit348
-rw-r--r--CODING_STANDARDS240
-rw-r--r--CREDITS2
-rw-r--r--ChangeLog10342
-rw-r--r--ChangeLog.1999.gzbin78772 -> 0 bytes
-rw-r--r--ChangeLog.2000.gzbin159518 -> 0 bytes
-rw-r--r--ChangeLog.2001.gzbin198003 -> 0 bytes
-rw-r--r--ChangeLog.2002.gzbin262369 -> 0 bytes
-rw-r--r--EXTENSIONS492
-rw-r--r--INSTALL422
-rw-r--r--LICENSE68
-rw-r--r--Makefile.frag23
-rw-r--r--Makefile.global68
-rw-r--r--NEWS2544
-rw-r--r--README.CVS-RULES115
-rw-r--r--README.EXTENSIONS39
-rw-r--r--README.EXT_SKEL193
-rw-r--r--README.PARAMETER_PARSING_API127
-rw-r--r--README.QNX57
-rw-r--r--README.SELF-CONTAINED-EXTENSIONS155
-rw-r--r--README.STREAMS379
-rw-r--r--README.SUBMITTING_PATCH126
-rw-r--r--README.TESTING170
-rw-r--r--README.TESTING2137
-rw-r--r--README.UNIX-BUILD-SYSTEM123
-rw-r--r--README.Zeus112
-rw-r--r--README.input_filter188
-rw-r--r--TODO162
-rw-r--r--TODO-PHP5211
-rw-r--r--TODO.BUILDv53
-rw-r--r--TSRM/LICENSE26
-rw-r--r--TSRM/Makefile.am6
-rw-r--r--TSRM/TODO2
-rw-r--r--TSRM/TSRM.c666
-rw-r--r--TSRM/TSRM.dsp186
-rw-r--r--TSRM/TSRM.h176
-rw-r--r--TSRM/acconfig.h1
-rw-r--r--TSRM/acinclude.m45
-rw-r--r--TSRM/build.mk43
-rwxr-xr-xTSRM/buildconf33
-rw-r--r--TSRM/configure.in31
-rw-r--r--TSRM/readdir.h44
-rw-r--r--TSRM/threads.m4165
-rw-r--r--TSRM/tsrm.m4128
-rw-r--r--TSRM/tsrm_config.nw.h11
-rw-r--r--TSRM/tsrm_config.w32.h19
-rw-r--r--TSRM/tsrm_config_common.h60
-rw-r--r--TSRM/tsrm_nw.c240
-rw-r--r--TSRM/tsrm_nw.h29
-rw-r--r--TSRM/tsrm_strtok_r.c63
-rw-r--r--TSRM/tsrm_strtok_r.h6
-rw-r--r--TSRM/tsrm_virtual_cwd.c859
-rw-r--r--TSRM/tsrm_virtual_cwd.h266
-rw-r--r--TSRM/tsrm_win32.c377
-rw-r--r--TSRM/tsrm_win32.h105
-rw-r--r--Zend/ChangeLog12075
-rw-r--r--Zend/FlexLexer.h186
-rw-r--r--Zend/LICENSE56
-rw-r--r--Zend/Makefile.am51
-rw-r--r--Zend/OBJECTS2_HOWTO195
-rw-r--r--Zend/RFCs/001.txt136
-rw-r--r--Zend/RFCs/002.txt169
-rw-r--r--Zend/RFCs/003.txt72
-rw-r--r--Zend/RFCs/004.txt107
-rw-r--r--Zend/ZEND_CHANGES802
-rw-r--r--Zend/Zend.dsp586
-rw-r--r--Zend/Zend.m4236
-rw-r--r--Zend/ZendCore.dep258
-rw-r--r--Zend/ZendTS.dsp707
-rw-r--r--Zend/acconfig.h105
-rw-r--r--Zend/acinclude.m447
-rw-r--r--Zend/build.mk43
-rwxr-xr-xZend/buildconf33
-rw-r--r--Zend/configure.in47
-rw-r--r--Zend/flex.skl1643
-rw-r--r--Zend/tests/zend2.php339
-rw-r--r--Zend/zend.c1099
-rw-r--r--Zend/zend.h617
-rw-r--r--Zend/zend.icobin1382 -> 0 bytes
-rw-r--r--Zend/zend_API.c1673
-rw-r--r--Zend/zend_API.h447
-rw-r--r--Zend/zend_alloc.c787
-rw-r--r--Zend/zend_alloc.h146
-rw-r--r--Zend/zend_builtin_functions.c1803
-rw-r--r--Zend/zend_builtin_functions.h35
-rw-r--r--Zend/zend_compile.c3592
-rw-r--r--Zend/zend_compile.h814
-rw-r--r--Zend/zend_config.nw.h88
-rw-r--r--Zend/zend_config.w32.h107
-rw-r--r--Zend/zend_constants.c275
-rw-r--r--Zend/zend_constants.h73
-rw-r--r--Zend/zend_default_classes.c140
-rw-r--r--Zend/zend_default_classes.h39
-rw-r--r--Zend/zend_dynamic_array.c72
-rw-r--r--Zend/zend_dynamic_array.h47
-rw-r--r--Zend/zend_errors.h48
-rw-r--r--Zend/zend_exceptions.c140
-rw-r--r--Zend/zend_exceptions.h39
-rw-r--r--Zend/zend_execute.c4276
-rw-r--r--Zend/zend_execute.h185
-rw-r--r--Zend/zend_execute_API.c1094
-rw-r--r--Zend/zend_execute_locks.h61
-rw-r--r--Zend/zend_extensions.c295
-rw-r--r--Zend/zend_extensions.h125
-rw-r--r--Zend/zend_fast_cache.h142
-rw-r--r--Zend/zend_globals.h292
-rw-r--r--Zend/zend_globals_macros.h117
-rw-r--r--Zend/zend_hash.c1354
-rw-r--r--Zend/zend_hash.h290
-rw-r--r--Zend/zend_highlight.c250
-rw-r--r--Zend/zend_highlight.h61
-rw-r--r--Zend/zend_indent.c156
-rw-r--r--Zend/zend_indent.h35
-rw-r--r--Zend/zend_ini.c524
-rw-r--r--Zend/zend_ini.h210
-rw-r--r--Zend/zend_ini_parser.y238
-rw-r--r--Zend/zend_ini_scanner.h41
-rw-r--r--Zend/zend_ini_scanner.l226
-rw-r--r--Zend/zend_istdiostream.h44
-rw-r--r--Zend/zend_language_parser.y974
-rw-r--r--Zend/zend_language_scanner.h50
-rw-r--r--Zend/zend_language_scanner.l1588
-rw-r--r--Zend/zend_list.c368
-rw-r--r--Zend/zend_list.h120
-rw-r--r--Zend/zend_llist.c317
-rw-r--r--Zend/zend_llist.h86
-rw-r--r--Zend/zend_mm.c371
-rw-r--r--Zend/zend_mm.h74
-rw-r--r--Zend/zend_modules.h100
-rw-r--r--Zend/zend_multibyte.c0
-rw-r--r--Zend/zend_multiply.h43
-rw-r--r--Zend/zend_object_handlers.c843
-rw-r--r--Zend/zend_object_handlers.h112
-rw-r--r--Zend/zend_objects.c150
-rw-r--r--Zend/zend_objects.h40
-rw-r--r--Zend/zend_objects_API.c297
-rw-r--r--Zend/zend_objects_API.h80
-rw-r--r--Zend/zend_opcode.c508
-rw-r--r--Zend/zend_operators.c1801
-rw-r--r--Zend/zend_operators.h310
-rw-r--r--Zend/zend_ptr_stack.c119
-rw-r--r--Zend/zend_ptr_stack.h66
-rw-r--r--Zend/zend_qsort.c127
-rw-r--r--Zend/zend_qsort.h36
-rw-r--r--Zend/zend_sprintf.c49
-rw-r--r--Zend/zend_stack.c173
-rw-r--r--Zend/zend_stack.h56
-rw-r--r--Zend/zend_static_allocator.c84
-rw-r--r--Zend/zend_static_allocator.h55
-rw-r--r--Zend/zend_stream.c123
-rw-r--r--Zend/zend_stream.h59
-rw-r--r--Zend/zend_ts_hash.c364
-rw-r--r--Zend/zend_ts_hash.h128
-rw-r--r--Zend/zend_types.h39
-rw-r--r--Zend/zend_variables.c175
-rw-r--r--Zend/zend_variables.h66
-rw-r--r--acconfig.h.in1
-rw-r--r--acinclude.m41802
-rw-r--r--build/build.mk73
-rw-r--r--build/build2.mk59
-rwxr-xr-xbuild/buildcheck.sh113
-rwxr-xr-xbuild/config-stubs8
-rw-r--r--build/genif.sh41
-rw-r--r--build/mkdep.awk75
-rw-r--r--build/print_include.awk6
-rwxr-xr-xbuild/shtool1046
-rwxr-xr-xbuildconf24
-rw-r--r--bundle/expat/Changes99
-rw-r--r--bundle/expat/README72
-rw-r--r--bundle/expat/README.php11
-rw-r--r--bundle/expat/ascii.h85
-rw-r--r--bundle/expat/asciitab.h36
-rw-r--r--bundle/expat/config.m443
-rw-r--r--bundle/expat/expat.h910
-rw-r--r--bundle/expat/iasciitab.h37
-rw-r--r--bundle/expat/internal.h46
-rw-r--r--bundle/expat/latin1tab.h36
-rw-r--r--bundle/expat/nametab.h150
-rw-r--r--bundle/expat/utf8tab.h37
-rw-r--r--bundle/expat/winconfig.h30
-rw-r--r--bundle/expat/xmlparse.c5592
-rw-r--r--bundle/expat/xmlrole.c1330
-rw-r--r--bundle/expat/xmlrole.h114
-rw-r--r--bundle/expat/xmltok.c1641
-rw-r--r--bundle/expat/xmltok.h312
-rw-r--r--bundle/expat/xmltok_impl.c1778
-rw-r--r--bundle/expat/xmltok_impl.h46
-rw-r--r--bundle/expat/xmltok_ns.c106
-rw-r--r--bundle/libxml/DOCBparser.c6107
-rw-r--r--bundle/libxml/HTMLparser.c5013
-rw-r--r--bundle/libxml/HTMLtree.c1099
-rw-r--r--bundle/libxml/SAX.c2015
-rw-r--r--bundle/libxml/c14n.c1930
-rw-r--r--bundle/libxml/catalog.c3502
-rw-r--r--bundle/libxml/config.m480
-rw-r--r--bundle/libxml/debugXML.c2480
-rw-r--r--bundle/libxml/encoding.c2340
-rw-r--r--bundle/libxml/entities.c1006
-rw-r--r--bundle/libxml/error.c420
-rw-r--r--bundle/libxml/globals.c653
-rw-r--r--bundle/libxml/hash.c822
-rw-r--r--bundle/libxml/include/libxml/DOCBparser.h73
-rw-r--r--bundle/libxml/include/libxml/HTMLparser.h117
-rw-r--r--bundle/libxml/include/libxml/HTMLtree.h117
-rw-r--r--bundle/libxml/include/libxml/Makefile.am46
-rw-r--r--bundle/libxml/include/libxml/Makefile.in335
-rw-r--r--bundle/libxml/include/libxml/SAX.h128
-rw-r--r--bundle/libxml/include/libxml/c14n.h91
-rw-r--r--bundle/libxml/include/libxml/catalog.h138
-rw-r--r--bundle/libxml/include/libxml/debugXML.h163
-rw-r--r--bundle/libxml/include/libxml/encoding.h230
-rw-r--r--bundle/libxml/include/libxml/entities.h109
-rw-r--r--bundle/libxml/include/libxml/globals.h336
-rw-r--r--bundle/libxml/include/libxml/hash.h166
-rw-r--r--bundle/libxml/include/libxml/list.h116
-rw-r--r--bundle/libxml/include/libxml/nanoftp.h117
-rw-r--r--bundle/libxml/include/libxml/nanohttp.h56
-rw-r--r--bundle/libxml/include/libxml/parser.h869
-rw-r--r--bundle/libxml/include/libxml/parserInternals.h413
-rw-r--r--bundle/libxml/include/libxml/schemasInternals.h353
-rw-r--r--bundle/libxml/include/libxml/threads.h62
-rw-r--r--bundle/libxml/include/libxml/tree.h894
-rw-r--r--bundle/libxml/include/libxml/uri.h67
-rw-r--r--bundle/libxml/include/libxml/valid.h319
-rw-r--r--bundle/libxml/include/libxml/xinclude.h26
-rw-r--r--bundle/libxml/include/libxml/xlink.h180
-rw-r--r--bundle/libxml/include/libxml/xmlIO.h283
-rw-r--r--bundle/libxml/include/libxml/xmlautomata.h94
-rw-r--r--bundle/libxml/include/libxml/xmlerror.h184
-rw-r--r--bundle/libxml/include/libxml/xmlmemory.h169
-rw-r--r--bundle/libxml/include/libxml/xmlreader.h56
-rw-r--r--bundle/libxml/include/libxml/xmlregexp.h81
-rw-r--r--bundle/libxml/include/libxml/xmlschemas.h106
-rw-r--r--bundle/libxml/include/libxml/xmlschemastypes.h42
-rw-r--r--bundle/libxml/include/libxml/xmlunicode.h164
-rw-r--r--bundle/libxml/include/libxml/xmlversion.h272
-rw-r--r--bundle/libxml/include/libxml/xmlversion.h.in272
-rw-r--r--bundle/libxml/include/libxml/xpath.h410
-rw-r--r--bundle/libxml/include/libxml/xpathInternals.h580
-rw-r--r--bundle/libxml/include/libxml/xpointer.h83
-rw-r--r--bundle/libxml/include/win32config.h111
-rw-r--r--bundle/libxml/include/wsockcompat.h61
-rw-r--r--bundle/libxml/libxml.h28
-rw-r--r--bundle/libxml/list.c720
-rw-r--r--bundle/libxml/nanoftp.c1924
-rw-r--r--bundle/libxml/nanohttp.c1528
-rw-r--r--bundle/libxml/parser.c10912
-rw-r--r--bundle/libxml/parserInternals.c3481
-rw-r--r--bundle/libxml/stamp-h.in1
-rw-r--r--bundle/libxml/threads.c537
-rw-r--r--bundle/libxml/tree.c7566
-rw-r--r--bundle/libxml/trio.c6760
-rw-r--r--bundle/libxml/trio.h216
-rw-r--r--bundle/libxml/triodef.h182
-rw-r--r--bundle/libxml/trionan.c913
-rw-r--r--bundle/libxml/trionan.h81
-rw-r--r--bundle/libxml/triop.h150
-rw-r--r--bundle/libxml/triostr.c2024
-rw-r--r--bundle/libxml/triostr.h127
-rw-r--r--bundle/libxml/uri.c1962
-rw-r--r--bundle/libxml/valid.c5968
-rw-r--r--bundle/libxml/xinclude.c1729
-rw-r--r--bundle/libxml/xlink.c179
-rw-r--r--bundle/libxml/xmlIO.c2839
-rw-r--r--bundle/libxml/xmlmemory.c777
-rw-r--r--bundle/libxml/xmlreader.c882
-rw-r--r--bundle/libxml/xmlregexp.c4319
-rw-r--r--bundle/libxml/xmlschemas.c5468
-rw-r--r--bundle/libxml/xmlschemastypes.c1880
-rw-r--r--bundle/libxml/xmlunicode.c4290
-rw-r--r--bundle/libxml/xpath.c10990
-rw-r--r--bundle/libxml/xpointer.c2902
-rw-r--r--config.guess1363
-rw-r--r--config.sub1470
-rw-r--r--configure.in1365
-rwxr-xr-xcvsclean3
-rw-r--r--ext/bcmath/CREDITS2
-rw-r--r--ext/bcmath/bcmath.c557
-rw-r--r--ext/bcmath/config.m417
-rw-r--r--ext/bcmath/libbcmath/AUTHORS3
-rw-r--r--ext/bcmath/libbcmath/COPYING.LIB515
-rw-r--r--ext/bcmath/libbcmath/ChangeLog10
-rw-r--r--ext/bcmath/libbcmath/FAQ21
-rw-r--r--ext/bcmath/libbcmath/INSTALL9
-rw-r--r--ext/bcmath/libbcmath/Makefile.am12
-rw-r--r--ext/bcmath/libbcmath/NEWS3
-rw-r--r--ext/bcmath/libbcmath/README9
-rw-r--r--ext/bcmath/libbcmath/acconfig.h9
-rw-r--r--ext/bcmath/libbcmath/aclocal.m4127
-rw-r--r--ext/bcmath/libbcmath/config.h.in41
-rw-r--r--ext/bcmath/libbcmath/configure1859
-rw-r--r--ext/bcmath/libbcmath/configure.in18
-rw-r--r--ext/bcmath/libbcmath/install-sh238
-rw-r--r--ext/bcmath/libbcmath/missing134
-rw-r--r--ext/bcmath/libbcmath/mkinstalldirs36
-rw-r--r--ext/bcmath/libbcmath/src/Makefile.am22
-rw-r--r--ext/bcmath/libbcmath/src/add.c88
-rw-r--r--ext/bcmath/libbcmath/src/bcmath.h155
-rw-r--r--ext/bcmath/libbcmath/src/compare.c161
-rw-r--r--ext/bcmath/libbcmath/src/config.h12
-rw-r--r--ext/bcmath/libbcmath/src/debug.c69
-rw-r--r--ext/bcmath/libbcmath/src/div.c274
-rw-r--r--ext/bcmath/libbcmath/src/divmod.c87
-rw-r--r--ext/bcmath/libbcmath/src/doaddsub.c232
-rw-r--r--ext/bcmath/libbcmath/src/init.c130
-rw-r--r--ext/bcmath/libbcmath/src/int2num.c84
-rw-r--r--ext/bcmath/libbcmath/src/nearzero.c69
-rw-r--r--ext/bcmath/libbcmath/src/neg.c49
-rw-r--r--ext/bcmath/libbcmath/src/num2long.c70
-rw-r--r--ext/bcmath/libbcmath/src/num2str.c79
-rw-r--r--ext/bcmath/libbcmath/src/outofmem.c46
-rw-r--r--ext/bcmath/libbcmath/src/output.c208
-rw-r--r--ext/bcmath/libbcmath/src/private.h43
-rw-r--r--ext/bcmath/libbcmath/src/raise.c124
-rw-r--r--ext/bcmath/libbcmath/src/raisemod.c97
-rw-r--r--ext/bcmath/libbcmath/src/recmul.c306
-rw-r--r--ext/bcmath/libbcmath/src/rmzero.c55
-rw-r--r--ext/bcmath/libbcmath/src/rt.c65
-rw-r--r--ext/bcmath/libbcmath/src/sqrt.c129
-rw-r--r--ext/bcmath/libbcmath/src/str2num.c109
-rw-r--r--ext/bcmath/libbcmath/src/sub.c90
-rw-r--r--ext/bcmath/libbcmath/src/zero.c64
-rw-r--r--ext/bcmath/php_bcmath.h71
-rw-r--r--ext/bcmath/tests/bcadd.phpt16
-rw-r--r--ext/bcmath/tests/bccomp.phpt18
-rw-r--r--ext/bcmath/tests/bcdiv.phpt18
-rw-r--r--ext/bcmath/tests/bcmod.phpt16
-rw-r--r--ext/bcmath/tests/bcmul.phpt18
-rw-r--r--ext/bcmath/tests/bcpow.phpt16
-rw-r--r--ext/bcmath/tests/bcscale.phpt21
-rw-r--r--ext/bcmath/tests/bcsqrt.phpt14
-rw-r--r--ext/bcmath/tests/bcsub.phpt16
-rw-r--r--ext/calendar/CREDITS2
-rw-r--r--ext/calendar/cal_unix.c88
-rw-r--r--ext/calendar/calendar.c639
-rw-r--r--ext/calendar/config.m411
-rw-r--r--ext/calendar/dow.c76
-rw-r--r--ext/calendar/easter.c141
-rw-r--r--ext/calendar/french.c160
-rw-r--r--ext/calendar/gregor.c265
-rw-r--r--ext/calendar/jewish.c763
-rw-r--r--ext/calendar/julian.c249
-rw-r--r--ext/calendar/php_calendar.h50
-rw-r--r--ext/calendar/sdncal.h97
-rw-r--r--ext/calendar/tests/jdtojewish.phpt28
-rw-r--r--ext/cpdf/CREDITS2
-rw-r--r--ext/cpdf/config.m496
-rw-r--r--ext/cpdf/cpdf.c2230
-rw-r--r--ext/cpdf/cpdf.dsp111
-rw-r--r--ext/cpdf/php_cpdf.h119
-rw-r--r--ext/crack/CREDITS4
-rw-r--r--ext/crack/EXPERIMENTAL5
-rw-r--r--ext/crack/config.m433
-rw-r--r--ext/crack/crack.c277
-rw-r--r--ext/crack/crack.dsp114
-rw-r--r--ext/crack/php_crack.h72
-rw-r--r--ext/crack/tests/001.phpt23
-rw-r--r--ext/ctype/CREDITS2
-rw-r--r--ext/ctype/README5
-rw-r--r--ext/ctype/config.m411
-rw-r--r--ext/ctype/ctype.c216
-rw-r--r--ext/ctype/ctype.dsp107
-rw-r--r--ext/ctype/ctype.xml245
-rw-r--r--ext/ctype/php_ctype.h83
-rw-r--r--ext/ctype/tests/001.phpt41
-rw-r--r--ext/ctype/tests/002.phpt50
-rw-r--r--ext/curl/CREDITS2
-rw-r--r--ext/curl/config.m478
-rw-r--r--ext/curl/curl.dsp186
-rw-r--r--ext/curl/interface.c1284
-rw-r--r--ext/curl/multi.c266
-rw-r--r--ext/curl/php_curl.h166
-rw-r--r--ext/curl/streams.c381
-rw-r--r--ext/cyrus/CREDITS2
-rw-r--r--ext/cyrus/config.m483
-rw-r--r--ext/cyrus/cyrus.c516
-rw-r--r--ext/cyrus/php_cyrus.h78
-rw-r--r--ext/db/CREDITS2
-rw-r--r--ext/db/config.m458
-rw-r--r--ext/db/db.c1204
-rw-r--r--ext/db/db.dsp114
-rw-r--r--ext/db/php_db.h80
-rw-r--r--ext/db/tests/001.phpt16
-rw-r--r--ext/db/tests/002.phpt17
-rw-r--r--ext/db/tests/003.phpt20
-rw-r--r--ext/db/tests/004.phpt23
-rw-r--r--ext/db/tests/005.phpt27
-rw-r--r--ext/db/tests/006.phpt29
-rw-r--r--ext/db/tests/test.inc3
-rw-r--r--ext/dba/CREDITS2
-rw-r--r--ext/dba/config.m4443
-rw-r--r--ext/dba/dba.c1026
-rw-r--r--ext/dba/dba.dsp197
-rw-r--r--ext/dba/dba_cdb.c350
-rw-r--r--ext/dba/dba_db2.c205
-rw-r--r--ext/dba/dba_db3.c234
-rw-r--r--ext/dba/dba_db4.c239
-rw-r--r--ext/dba/dba_dbm.c213
-rw-r--r--ext/dba/dba_flatfile.c188
-rw-r--r--ext/dba/dba_gdbm.c200
-rw-r--r--ext/dba/dba_inifile.c186
-rw-r--r--ext/dba/dba_ndbm.c171
-rwxr-xr-xext/dba/install_cdb.sh53
-rw-r--r--ext/dba/libcdb/cdb.c193
-rw-r--r--ext/dba/libcdb/cdb.h57
-rw-r--r--ext/dba/libcdb/cdb_make.c244
-rw-r--r--ext/dba/libcdb/cdb_make.h64
-rw-r--r--ext/dba/libcdb/uint32.c49
-rw-r--r--ext/dba/libcdb/uint32.h39
-rw-r--r--ext/dba/libflatfile/flatfile.c321
-rw-r--r--ext/dba/libflatfile/flatfile.h48
-rw-r--r--ext/dba/libinifile/inifile.c598
-rw-r--r--ext/dba/libinifile/inifile.h67
-rw-r--r--ext/dba/php_cdb.h12
-rw-r--r--ext/dba/php_db2.h12
-rw-r--r--ext/dba/php_db3.h12
-rw-r--r--ext/dba/php_db4.h12
-rw-r--r--ext/dba/php_dba.h148
-rw-r--r--ext/dba/php_dbm.h12
-rw-r--r--ext/dba/php_flatfile.h12
-rw-r--r--ext/dba/php_gdbm.h12
-rw-r--r--ext/dba/php_inifile.h12
-rw-r--r--ext/dba/php_ndbm.h12
-rw-r--r--ext/dba/tests/dba001.phpt21
-rw-r--r--ext/dba/tests/dba002.phpt22
-rw-r--r--ext/dba/tests/dba003.phpt24
-rw-r--r--ext/dba/tests/dba004.phpt28
-rw-r--r--ext/dba/tests/dba005.phpt35
-rw-r--r--ext/dba/tests/dba006.phpt37
-rw-r--r--ext/dba/tests/dba007.phpt45
-rw-r--r--ext/dba/tests/dba008.phpt32
-rwxr-xr-xext/dba/tests/dba009.phpt33
-rw-r--r--ext/dba/tests/dba_cdb.phpt30
-rw-r--r--ext/dba/tests/dba_cdb_make.phpt38
-rw-r--r--ext/dba/tests/dba_cdb_read.phpt65
-rw-r--r--ext/dba/tests/dba_db2.phpt29
-rw-r--r--ext/dba/tests/dba_db3.phpt29
-rw-r--r--ext/dba/tests/dba_db4.phpt29
-rw-r--r--ext/dba/tests/dba_dbm.phpt29
-rw-r--r--ext/dba/tests/dba_flatfile.phpt29
-rw-r--r--ext/dba/tests/dba_gdbm.phpt32
-rw-r--r--ext/dba/tests/dba_handler.inc75
-rw-r--r--ext/dba/tests/dba_inifile.phpt29
-rw-r--r--ext/dba/tests/dba_ndbm.phpt29
-rw-r--r--ext/dba/tests/skipif.inc23
-rw-r--r--ext/dba/tests/test.cdbbin2230 -> 0 bytes
-rw-r--r--ext/dba/tests/test.inc7
-rw-r--r--ext/dbase/CREDITS2
-rw-r--r--ext/dbase/config.m413
-rw-r--r--ext/dbase/dbase.c775
-rw-r--r--ext/dbase/dbase.dsp151
-rw-r--r--ext/dbase/dbf.h94
-rw-r--r--ext/dbase/dbf_head.c291
-rw-r--r--ext/dbase/dbf_head.h11
-rw-r--r--ext/dbase/dbf_misc.c179
-rw-r--r--ext/dbase/dbf_misc.h13
-rw-r--r--ext/dbase/dbf_ndx.c191
-rw-r--r--ext/dbase/dbf_ndx.h98
-rw-r--r--ext/dbase/dbf_rec.c206
-rw-r--r--ext/dbase/dbf_rec.h10
-rw-r--r--ext/dbase/php_dbase.h44
-rw-r--r--ext/dbx/CREDITS2
-rw-r--r--ext/dbx/INSTALL25
-rw-r--r--ext/dbx/config.m410
-rw-r--r--ext/dbx/dbx.c882
-rw-r--r--ext/dbx/dbx.dsp173
-rw-r--r--ext/dbx/dbx.h62
-rw-r--r--ext/dbx/dbx_fbsql.c283
-rw-r--r--ext/dbx/dbx_fbsql.h63
-rw-r--r--ext/dbx/dbx_mssql.c282
-rw-r--r--ext/dbx/dbx_mssql.h62
-rw-r--r--ext/dbx/dbx_mysql.c304
-rw-r--r--ext/dbx/dbx_mysql.h62
-rw-r--r--ext/dbx/dbx_oci8.c301
-rw-r--r--ext/dbx/dbx_oci8.h62
-rw-r--r--ext/dbx/dbx_odbc.c301
-rw-r--r--ext/dbx/dbx_odbc.h62
-rw-r--r--ext/dbx/dbx_pgsql.c297
-rw-r--r--ext/dbx/dbx_pgsql.h58
-rw-r--r--ext/dbx/dbx_sybasect.c307
-rw-r--r--ext/dbx/dbx_sybasect.h62
-rw-r--r--ext/dbx/howto_extend_dbx.html316
-rw-r--r--ext/dbx/php_dbx.h88
-rw-r--r--ext/dbx/tests/001.phpt10
-rw-r--r--ext/dbx/tests/002.phpt29
-rw-r--r--ext/dbx/tests/003.phpt107
-rw-r--r--ext/dbx/tests/004.phpt35
-rw-r--r--ext/dbx/tests/005.phpt106
-rw-r--r--ext/dbx/tests/006.phpt56
-rw-r--r--ext/dbx/tests/007.phpt74
-rw-r--r--ext/dbx/tests/008.phpt146
-rw-r--r--ext/dbx/tests/009.phpt65
-rw-r--r--ext/dbx/tests/dbx_test.p65
-rw-r--r--ext/dbx/tests/dbx_test.pgsql.script37
-rw-r--r--ext/dbx/tests/dbx_test.script38
-rw-r--r--ext/dbx/tests/skipif.inc6
-rw-r--r--ext/dio/EXPERIMENTAL0
-rw-r--r--ext/dio/config.m410
-rw-r--r--ext/dio/dio.c591
-rw-r--r--ext/dio/php_dio.h62
-rw-r--r--ext/dio/tests/001.phpt23
-rw-r--r--ext/domxml/CREDITS2
-rw-r--r--ext/domxml/EXPERIMENTAL5
-rw-r--r--ext/domxml/TODO23
-rw-r--r--ext/domxml/config.m4127
-rw-r--r--ext/domxml/domxml.dsp114
-rw-r--r--ext/domxml/php_domxml.c5661
-rw-r--r--ext/domxml/php_domxml.h253
-rw-r--r--ext/domxml/tests/domxml001.phpt273
-rw-r--r--ext/domxml/tests/domxml002.phpt31
-rw-r--r--ext/domxml/tests/domxml_test.inc42
-rw-r--r--ext/domxml/tests/skipif.inc3
-rw-r--r--ext/domxml/tests/xmldoc.phpt35
-rw-r--r--ext/ereg/ereg.c637
-rw-r--r--ext/ereg/php_ereg.h50
-rw-r--r--ext/ereg/php_regex.h65
-rw-r--r--ext/ereg/regex/COPYRIGHT20
-rw-r--r--ext/ereg/regex/README32
-rw-r--r--ext/ereg/regex/WHATSNEW92
-rw-r--r--ext/ereg/regex/cclass.h30
-rw-r--r--ext/ereg/regex/cname.h102
-rw-r--r--ext/ereg/regex/debug.c242
-rw-r--r--ext/ereg/regex/debug.ih14
-rw-r--r--ext/ereg/regex/engine.c1019
-rw-r--r--ext/ereg/regex/engine.ih35
-rw-r--r--ext/ereg/regex/main.c510
-rw-r--r--ext/ereg/regex/main.ih19
-rw-r--r--ext/ereg/regex/mkh76
-rw-r--r--ext/ereg/regex/regcomp.c1608
-rw-r--r--ext/ereg/regex/regcomp.ih53
-rw-r--r--ext/ereg/regex/regerror.c126
-rw-r--r--ext/ereg/regex/regerror.ih12
-rw-r--r--ext/ereg/regex/regex.3502
-rw-r--r--ext/ereg/regex/regex.7233
-rw-r--r--ext/ereg/regex/regex.dsp106
-rw-r--r--ext/ereg/regex/regex.dsw29
-rw-r--r--ext/ereg/regex/regex.h83
-rw-r--r--ext/ereg/regex/regex.mak304
-rw-r--r--ext/ereg/regex/regex2.h140
-rw-r--r--ext/ereg/regex/regex_extra.h23
-rw-r--r--ext/ereg/regex/regexec.c138
-rw-r--r--ext/ereg/regex/regfree.c37
-rw-r--r--ext/ereg/regex/split.c316
-rw-r--r--ext/ereg/regex/tests475
-rw-r--r--ext/ereg/regex/utils.h25
-rw-r--r--ext/ereg/tests/001.phpt9
-rw-r--r--ext/ereg/tests/002.phpt9
-rw-r--r--ext/ereg/tests/003.phpt10
-rw-r--r--ext/ereg/tests/004.phpt16
-rw-r--r--ext/ereg/tests/005.phpt20
-rw-r--r--ext/ereg/tests/006.phpt10
-rw-r--r--ext/ereg/tests/007.phpt12
-rw-r--r--ext/ereg/tests/008.phpt10
-rw-r--r--ext/ereg/tests/009.phpt19
-rw-r--r--ext/ereg/tests/010.phpt9
-rw-r--r--ext/ereg/tests/011.phpt9
-rw-r--r--ext/ereg/tests/012.phpt9
-rw-r--r--ext/ereg/tests/013.phpt9
-rw-r--r--ext/ereg/tests/014.phpt9
-rw-r--r--ext/ereg/tests/015.phpt8
-rw-r--r--ext/ereg/tests/016.phpt8
-rw-r--r--ext/exif/CREDITS2
-rw-r--r--ext/exif/config.m411
-rw-r--r--ext/exif/example.php23
-rw-r--r--ext/exif/exif.c4021
-rw-r--r--ext/exif/exif.dsp113
-rw-r--r--ext/exif/php_exif.h30
-rw-r--r--ext/exif/test.php3
-rw-r--r--ext/exif/test.txt365
-rw-r--r--ext/exif/tests/exif000.phpt57
-rw-r--r--ext/exif/tests/exif001.phpt84
-rw-r--r--ext/exif/tests/exif002.phpt24
-rw-r--r--ext/exif/tests/exif003.phpt91
-rw-r--r--ext/exif/tests/exif004.phpt38
-rw-r--r--ext/exif/tests/exif005.phpt22
-rw-r--r--ext/exif/tests/exif006.phpt89
-rw-r--r--ext/exif/tests/test1.jpgbin523 -> 0 bytes
-rw-r--r--ext/exif/tests/test2.jpgbin1240 -> 0 bytes
-rw-r--r--ext/exif/tests/test3.jpgbin1240 -> 0 bytes
-rw-r--r--ext/exif/tests/test4.jpgbin713 -> 0 bytes
-rw-r--r--ext/exif/tests/test5.jpgbin603 -> 0 bytes
-rw-r--r--ext/exif/tests/test6.jpgbin1240 -> 0 bytes
-rwxr-xr-xext/ext_skel284
-rw-r--r--ext/ext_skel_win32.php52
-rw-r--r--ext/fam/CREDITS2
-rw-r--r--ext/fam/config.m456
-rw-r--r--ext/fam/fam.c442
-rw-r--r--ext/fam/php_fam.h89
-rw-r--r--ext/fbsql/CREDITS2
-rw-r--r--ext/fbsql/Readme_w32.txt22
-rw-r--r--ext/fbsql/config.m443
-rw-r--r--ext/fbsql/fbsql.dsp171
-rw-r--r--ext/fbsql/php_fbsql.c3536
-rw-r--r--ext/fbsql/php_fbsql.h145
-rw-r--r--ext/fdf/CREDITS2
-rw-r--r--ext/fdf/config.m473
-rw-r--r--ext/fdf/fdf.c1594
-rw-r--r--ext/fdf/fdf.dsp114
-rw-r--r--ext/fdf/php_fdf.h96
-rw-r--r--ext/filepro/CREDITS2
-rw-r--r--ext/filepro/config.m413
-rw-r--r--ext/filepro/filepro.c570
-rw-r--r--ext/filepro/filepro.dsp109
-rw-r--r--ext/filepro/php_filepro.h48
-rw-r--r--ext/fribidi/tests/001.phpt25
-rw-r--r--ext/fribidi/tests/002.phpt121
-rw-r--r--ext/ftp/CREDITS2
-rw-r--r--ext/ftp/config.m411
-rw-r--r--ext/ftp/ftp.c1914
-rw-r--r--ext/ftp/ftp.h206
-rw-r--r--ext/ftp/php_ftp.c1214
-rw-r--r--ext/ftp/php_ftp.h78
-rw-r--r--ext/gd/CREDITS2
-rw-r--r--ext/gd/config.m4414
-rw-r--r--ext/gd/gd.c4229
-rw-r--r--ext/gd/gd.dsp596
-rw-r--r--ext/gd/gd_ctx.c114
-rw-r--r--ext/gd/gdcache.c203
-rw-r--r--ext/gd/gdcache.h87
-rw-r--r--ext/gd/gdttf.c879
-rw-r--r--ext/gd/gdttf.h16
-rw-r--r--ext/gd/libgd/README72
-rw-r--r--ext/gd/libgd/gd.c3673
-rw-r--r--ext/gd/libgd/gd.h644
-rw-r--r--ext/gd/libgd/gd2copypal.c65
-rw-r--r--ext/gd/libgd/gd2time.c60
-rw-r--r--ext/gd/libgd/gd2topng.c49
-rw-r--r--ext/gd/libgd/gd_arc_f_buggy.c741
-rw-r--r--ext/gd/libgd/gd_gd.c264
-rw-r--r--ext/gd/libgd/gd_gd2.c790
-rw-r--r--ext/gd/libgd/gd_gif_in.c580
-rw-r--r--ext/gd/libgd/gd_io.c146
-rw-r--r--ext/gd/libgd/gd_io.h43
-rw-r--r--ext/gd/libgd/gd_io_dp.c341
-rw-r--r--ext/gd/libgd/gd_io_file.c130
-rw-r--r--ext/gd/libgd/gd_io_ss.c138
-rw-r--r--ext/gd/libgd/gd_jpeg.c690
-rw-r--r--ext/gd/libgd/gd_png.c687
-rw-r--r--ext/gd/libgd/gd_ss.c49
-rw-r--r--ext/gd/libgd/gd_topal.c1919
-rw-r--r--ext/gd/libgd/gd_wbmp.c201
-rw-r--r--ext/gd/libgd/gdcache.c214
-rw-r--r--ext/gd/libgd/gdcache.h86
-rw-r--r--ext/gd/libgd/gddemo.c118
-rw-r--r--ext/gd/libgd/gdfontg.c4384
-rw-r--r--ext/gd/libgd/gdfontg.h29
-rw-r--r--ext/gd/libgd/gdfontl.c4641
-rw-r--r--ext/gd/libgd/gdfontl.h30
-rw-r--r--ext/gd/libgd/gdfontmb.c3871
-rw-r--r--ext/gd/libgd/gdfontmb.h28
-rw-r--r--ext/gd/libgd/gdfonts.c3871
-rw-r--r--ext/gd/libgd/gdfonts.h28
-rw-r--r--ext/gd/libgd/gdfontt.c2592
-rw-r--r--ext/gd/libgd/gdfontt.h29
-rw-r--r--ext/gd/libgd/gdft.c1093
-rw-r--r--ext/gd/libgd/gdhelpers.c76
-rw-r--r--ext/gd/libgd/gdhelpers.h25
-rw-r--r--ext/gd/libgd/gdkanji.c627
-rw-r--r--ext/gd/libgd/gdparttopng.c59
-rw-r--r--ext/gd/libgd/gdtables.c728
-rw-r--r--ext/gd/libgd/gdtest.c409
-rw-r--r--ext/gd/libgd/gdtestft.c108
-rw-r--r--ext/gd/libgd/gdtopng.c44
-rw-r--r--ext/gd/libgd/gdxpm.c139
-rw-r--r--ext/gd/libgd/jisx0208.h1205
-rw-r--r--ext/gd/libgd/mathmake.c52
-rw-r--r--ext/gd/libgd/pngtogd.c45
-rw-r--r--ext/gd/libgd/pngtogd2.c52
-rw-r--r--ext/gd/libgd/testac.c129
-rw-r--r--ext/gd/libgd/wbmp.c369
-rw-r--r--ext/gd/libgd/wbmp.h47
-rw-r--r--ext/gd/libgd/webpng.c289
-rw-r--r--ext/gd/libgd/xbm.c153
-rw-r--r--ext/gd/php_gd.h188
-rw-r--r--ext/gd/tests/bug19366.phpt50
-rw-r--r--ext/gd/tests/bug22544.phpt26
-rw-r--r--ext/gd/tests/conv_test.gifbin4998 -> 0 bytes
-rw-r--r--ext/gd/tests/conv_test.jpegbin2317 -> 0 bytes
-rw-r--r--ext/gd/tests/conv_test.pngbin4053 -> 0 bytes
-rw-r--r--ext/gd/tests/conv_test.xbm4
-rw-r--r--ext/gd/tests/conv_test.xpm1588
-rw-r--r--ext/gd/tests/gif2gd.phpt32
-rw-r--r--ext/gd/tests/gif2jpg.phpt29
-rw-r--r--ext/gd/tests/gif2png.phpt29
-rw-r--r--ext/gd/tests/imagefilter.phpt89
-rw-r--r--ext/gd/tests/imagefttext.phpt52
-rw-r--r--ext/gd/tests/jpeg2png.phpt47
-rw-r--r--ext/gd/tests/jpg2gd.phpt44
-rw-r--r--ext/gd/tests/png2gd.phpt44
-rw-r--r--ext/gd/tests/test.pngbin2711 -> 0 bytes
-rw-r--r--ext/gd/tests/test8859.ttfbin10576 -> 0 bytes
-rw-r--r--ext/gd/tests/xbm2png.phpt26
-rw-r--r--ext/gd/tests/xpm2gd.phpt32
-rw-r--r--ext/gd/tests/xpm2jpg.phpt29
-rw-r--r--ext/gd/tests/xpm2png.phpt29
-rw-r--r--ext/gettext/CREDITS2
-rw-r--r--ext/gettext/config.m452
-rw-r--r--ext/gettext/gettext.c319
-rw-r--r--ext/gettext/gettext.dsp113
-rw-r--r--ext/gettext/php_gettext.h58
-rw-r--r--ext/gmp/CREDITS2
-rw-r--r--ext/gmp/README5
-rw-r--r--ext/gmp/TODO22
-rw-r--r--ext/gmp/config.m425
-rw-r--r--ext/gmp/gmp.c1253
-rw-r--r--ext/gmp/php_gmp.h115
-rw-r--r--ext/gmp/tests/001.phpt23
-rw-r--r--ext/gmp/tests/002.phpt19
-rw-r--r--ext/gmp/tests/003.phpt49
-rw-r--r--ext/hwapi/CREDITS2
-rw-r--r--ext/hwapi/config.m435
-rw-r--r--ext/hwapi/hwapi.cpp5031
-rw-r--r--ext/hwapi/php_hwapi.h159
-rw-r--r--ext/hyperwave/CREDITS2
-rw-r--r--ext/hyperwave/config.m420
-rw-r--r--ext/hyperwave/debug.h206
-rw-r--r--ext/hyperwave/hg_comm.c5841
-rw-r--r--ext/hyperwave/hg_comm.h238
-rw-r--r--ext/hyperwave/hw.c4081
-rw-r--r--ext/hyperwave/hw_error.h111
-rw-r--r--ext/hyperwave/hyperwave.dsp120
-rw-r--r--ext/hyperwave/php_hyperwave.h147
-rw-r--r--ext/iconv/CREDITS2
-rw-r--r--ext/iconv/config.m4118
-rw-r--r--ext/iconv/iconv.c1841
-rw-r--r--ext/iconv/iconv.dsp107
-rw-r--r--ext/iconv/php_iconv.h86
-rw-r--r--ext/iconv/tests/Quotes.UTF-84
-rw-r--r--ext/iconv/tests/bug16069.phpt22
-rw-r--r--ext/iconv/tests/eucjp2iso2022jp.phpt27
-rw-r--r--ext/iconv/tests/eucjp2sjis.phpt58
-rw-r--r--ext/iconv/tests/eucjp2utf8.phpt58
-rw-r--r--ext/iconv/tests/iconv001.phpt18
-rw-r--r--ext/iconv/tests/iconv002.phpt30
-rw-r--r--ext/iconv/tests/iconv003.phpt13
-rw-r--r--ext/iconv/tests/iconv_mime_decode.phpt17
-rw-r--r--ext/iconv/tests/iconv_mime_encode.phpt393
-rw-r--r--ext/iconv/tests/iconv_strlen.phpt19
-rw-r--r--ext/iconv/tests/iconv_strpos.phpt52
-rw-r--r--ext/iconv/tests/iconv_strrpos.phpt56
-rw-r--r--ext/iconv/tests/iconv_substr.phpt59
-rw-r--r--ext/iconv/tests/ob_iconv_handler.phpt17
-rw-r--r--ext/iconv/tests/skipif.inc12
-rw-r--r--ext/iconv/tests/test.inc7
-rw-r--r--ext/iconv/tests/translit-failure.phpt33
-rw-r--r--ext/iconv/tests/translit-utf8.phpt28
-rw-r--r--ext/imap/CREDITS2
-rw-r--r--ext/imap/IMAP_Win32_HOWTO.txt32
-rw-r--r--ext/imap/config.m4208
-rw-r--r--ext/imap/imap.dsp176
-rw-r--r--ext/imap/imap.h103
-rw-r--r--ext/imap/php_imap.c4196
-rw-r--r--ext/imap/php_imap.h221
-rw-r--r--ext/informix/CREDITS2
-rw-r--r--ext/informix/Makefile.frag10
-rw-r--r--ext/informix/config.m496
-rw-r--r--ext/informix/ifx.dsp134
-rw-r--r--ext/informix/ifx.ec4597
-rw-r--r--ext/informix/php_informix.h125
-rw-r--r--ext/informix/php_informix_includes.h90
-rw-r--r--ext/ingres_ii/CREDITS2
-rw-r--r--ext/ingres_ii/EXPERIMENTAL5
-rw-r--r--ext/ingres_ii/README13
-rw-r--r--ext/ingres_ii/config.m435
-rw-r--r--ext/ingres_ii/ii.c1544
-rw-r--r--ext/ingres_ii/ii.h65
-rw-r--r--ext/ingres_ii/ingres.dsp111
-rw-r--r--ext/ingres_ii/php_ii.h100
-rw-r--r--ext/interbase/CREDITS2
-rw-r--r--ext/interbase/config.m439
-rw-r--r--ext/interbase/interbase.c3130
-rw-r--r--ext/interbase/interbase.dsp113
-rw-r--r--ext/interbase/php_interbase.h193
-rw-r--r--ext/interbase/tests/002.phpt34
-rw-r--r--ext/interbase/tests/003.phpt87
-rw-r--r--ext/interbase/tests/004.phpt177
-rw-r--r--ext/interbase/tests/005.phpt271
-rw-r--r--ext/interbase/tests/006.phpt224
-rwxr-xr-xext/interbase/tests/interbase.inc105
-rwxr-xr-xext/interbase/tests/skipif.inc9
-rw-r--r--ext/ldap/CREDITS2
-rw-r--r--ext/ldap/LDAP_Win32_HOWTO.txt33
-rw-r--r--ext/ldap/config.m4125
-rw-r--r--ext/ldap/ldap.c2133
-rw-r--r--ext/ldap/ldap.dsp288
-rw-r--r--ext/ldap/ldap.mak173
-rw-r--r--ext/ldap/php_ldap.h119
-rw-r--r--ext/mbstring/CREDITS2
-rw-r--r--ext/mbstring/README17
-rw-r--r--ext/mbstring/README_PHP3-i18n-ja774
-rw-r--r--ext/mbstring/config.m442
-rw-r--r--ext/mbstring/cp932_table.h66
-rw-r--r--ext/mbstring/html_entities.c291
-rw-r--r--ext/mbstring/mb_gpc.c400
-rw-r--r--ext/mbstring/mb_gpc.h47
-rw-r--r--ext/mbstring/mbfilter.c9677
-rw-r--r--ext/mbstring/mbfilter.h597
-rw-r--r--ext/mbstring/mbfilter_cn.c417
-rw-r--r--ext/mbstring/mbfilter_cn.h33
-rw-r--r--ext/mbstring/mbfilter_ja.c1291
-rw-r--r--ext/mbstring/mbfilter_ja.h98
-rw-r--r--ext/mbstring/mbfilter_kr.c516
-rw-r--r--ext/mbstring/mbfilter_kr.h33
-rw-r--r--ext/mbstring/mbfilter_ru.c240
-rw-r--r--ext/mbstring/mbfilter_ru.h38
-rw-r--r--ext/mbstring/mbfilter_tw.c337
-rw-r--r--ext/mbstring/mbfilter_tw.h30
-rw-r--r--ext/mbstring/mbregex.c4708
-rw-r--r--ext/mbstring/mbregex.h213
-rw-r--r--ext/mbstring/mbstring.c3396
-rw-r--r--ext/mbstring/mbstring.dsp211
-rw-r--r--ext/mbstring/mbstring.h216
-rw-r--r--ext/mbstring/php_mbregex.c1176
-rw-r--r--ext/mbstring/php_mbregex.h119
-rw-r--r--ext/mbstring/php_unicode.c313
-rw-r--r--ext/mbstring/php_unicode.h201
-rw-r--r--ext/mbstring/tests/bug20087.phpt20
-rw-r--r--ext/mbstring/tests/casefold.phpt24
-rw-r--r--ext/mbstring/tests/common.inc53
-rw-r--r--ext/mbstring/tests/htmlent.phpt35
-rw-r--r--ext/mbstring/tests/ini_language.phpt15
-rw-r--r--ext/mbstring/tests/mb_convert_encoding.phpt137
-rw-r--r--ext/mbstring/tests/mb_convert_variables.phpt163
-rw-r--r--ext/mbstring/tests/mb_detect_encoding.phpt119
-rw-r--r--ext/mbstring/tests/mb_detect_order.phpt59
-rw-r--r--ext/mbstring/tests/mb_ereg-compat-01.phpt21
-rw-r--r--ext/mbstring/tests/mb_ereg-compat-02.phpt25
-rw-r--r--ext/mbstring/tests/mb_ereg.phpt47
-rw-r--r--ext/mbstring/tests/mb_ereg_replace-compat-01.phpt15
-rw-r--r--ext/mbstring/tests/mb_ereg_replace-compat-02.phpt15
-rw-r--r--ext/mbstring/tests/mb_ereg_replace-compat-03.phpt15
-rw-r--r--ext/mbstring/tests/mb_ereg_replace-compat-04.phpt15
-rw-r--r--ext/mbstring/tests/mb_ereg_replace-compat-05.phpt16
-rw-r--r--ext/mbstring/tests/mb_ereg_replace-compat-06.phpt14
-rw-r--r--ext/mbstring/tests/mb_ereg_replace-compat-07.phpt15
-rw-r--r--ext/mbstring/tests/mb_ereg_replace-compat-08.phpt15
-rw-r--r--ext/mbstring/tests/mb_ereg_replace-compat-09.phpt15
-rw-r--r--ext/mbstring/tests/mb_ereg_replace-compat-10.phpt15
-rw-r--r--ext/mbstring/tests/mb_ereg_replace-compat-11.phpt15
-rw-r--r--ext/mbstring/tests/mb_ereg_replace-compat-12.phpt14
-rw-r--r--ext/mbstring/tests/mb_ereg_replace-compat-13.phpt14
-rw-r--r--ext/mbstring/tests/mb_ereg_replace.phpt18
-rw-r--r--ext/mbstring/tests/mb_ereg_search_xxx.phpt82
-rw-r--r--ext/mbstring/tests/mb_http_input.phpt50
-rw-r--r--ext/mbstring/tests/mb_http_output.phpt84
-rw-r--r--ext/mbstring/tests/mb_internal_encoding.phpt68
-rw-r--r--ext/mbstring/tests/mb_output_handler_euc_jp.phpt21
-rw-r--r--ext/mbstring/tests/mb_output_handler_shift_jis.phpt16
-rw-r--r--ext/mbstring/tests/mb_parse_str.phpt80
-rw-r--r--ext/mbstring/tests/mb_parse_str02.phpt105
-rw-r--r--ext/mbstring/tests/mb_preferred_mime_name.phpt61
-rw-r--r--ext/mbstring/tests/mb_regex_set_options.phpt18
-rw-r--r--ext/mbstring/tests/mb_send_mail01.phpt38
-rw-r--r--ext/mbstring/tests/mb_send_mail02.phpt38
-rw-r--r--ext/mbstring/tests/mb_send_mail03.phpt38
-rw-r--r--ext/mbstring/tests/mb_send_mail04.phpt38
-rw-r--r--ext/mbstring/tests/mb_send_mail05.phpt42
-rw-r--r--ext/mbstring/tests/mb_send_mail06.phpt41
-rw-r--r--ext/mbstring/tests/mb_send_mail07.phpt41
-rw-r--r--ext/mbstring/tests/mb_split-compat-01.phpt23
-rw-r--r--ext/mbstring/tests/mb_split.phpt48
-rw-r--r--ext/mbstring/tests/mb_strcut.phpt34
-rw-r--r--ext/mbstring/tests/mb_strimwidth.phpt43
-rw-r--r--ext/mbstring/tests/mb_strlen.phpt104
-rw-r--r--ext/mbstring/tests/mb_strpos.phpt175
-rw-r--r--ext/mbstring/tests/mb_strwidth.phpt32
-rw-r--r--ext/mbstring/tests/mb_substitute_character.phpt49
-rw-r--r--ext/mbstring/tests/mb_substr.phpt34
-rw-r--r--ext/mbstring/tests/mb_substr_count.phpt44
-rw-r--r--ext/mbstring/tests/overload01.phpt25
-rw-r--r--ext/mbstring/tests/overload02.phpt36
-rw-r--r--ext/mbstring/tests/php_gr_jp_10830.phpt18
-rw-r--r--ext/mbstring/tests/simpletest.phpt34
-rw-r--r--ext/mbstring/tests/skipif.inc14
-rw-r--r--ext/mbstring/tests/zend-multibyte.phpt23
-rw-r--r--ext/mbstring/unicode_data.h2738
-rw-r--r--ext/mbstring/unicode_table.h347
-rw-r--r--ext/mbstring/unicode_table_cn.h6463
-rw-r--r--ext/mbstring/unicode_table_ja.h5961
-rw-r--r--ext/mbstring/unicode_table_kr.h7157
-rw-r--r--ext/mbstring/unicode_table_ru.h69
-rw-r--r--ext/mbstring/unicode_table_tw.h11215
-rw-r--r--ext/mcal/CREDITS2
-rw-r--r--ext/mcal/config.m445
-rw-r--r--ext/mcal/php_mcal.c1625
-rw-r--r--ext/mcal/php_mcal.h64
-rw-r--r--ext/mcrypt/CREDITS2
-rw-r--r--ext/mcrypt/TODO6
-rw-r--r--ext/mcrypt/config.m463
-rw-r--r--ext/mcrypt/mcrypt.c1273
-rw-r--r--ext/mcrypt/mcrypt.dsp117
-rw-r--r--ext/mcrypt/php_mcrypt.h95
-rw-r--r--ext/mcrypt/tests/blowfish.phpt77
-rw-r--r--ext/mcrypt/tests/bug8040.phpt26
-rw-r--r--ext/mcrypt/tests/vectors.txt33
-rw-r--r--ext/mcve/CREDITS2
-rw-r--r--ext/mcve/config.m425
-rw-r--r--ext/mcve/mcve.c2103
-rw-r--r--ext/mcve/mcve.php12
-rw-r--r--ext/mcve/mcve_simple_test.php19
-rw-r--r--ext/mcve/mcve_test1.php83
-rw-r--r--ext/mcve/mcve_test2.php68
-rw-r--r--ext/mcve/php_mcve.h119
-rw-r--r--ext/mcve/tests/001.phpt23
-rw-r--r--ext/mhash/CREDITS2
-rw-r--r--ext/mhash/config.m425
-rw-r--r--ext/mhash/mhash.c253
-rw-r--r--ext/mhash/mhash.dsp115
-rw-r--r--ext/mhash/php_mhash.h29
-rw-r--r--ext/mhash/tests/001.phpt74
-rw-r--r--ext/mhash/tests/002.phpt64
-rw-r--r--ext/mhash/tests/003.phpt73
-rw-r--r--ext/mhash/tests/skip.inc5
-rw-r--r--ext/mime_magic/CREDITS2
-rw-r--r--ext/mime_magic/EXPERIMENTAL0
-rw-r--r--ext/mime_magic/TODO3
-rw-r--r--ext/mime_magic/config.m437
-rw-r--r--ext/mime_magic/mime_magic.c1909
-rw-r--r--ext/mime_magic/mime_magic.dsp108
-rw-r--r--ext/mime_magic/php_mime_magic.h428
-rw-r--r--ext/ming/CREDITS2
-rw-r--r--ext/ming/EXPERIMENTAL5
-rw-r--r--ext/ming/config.m462
-rw-r--r--ext/ming/ming.c2853
-rw-r--r--ext/ming/ming.dsp107
-rw-r--r--ext/ming/php_ming.h160
-rw-r--r--ext/mnogosearch/CREDITS2
-rw-r--r--ext/mnogosearch/README11
-rw-r--r--ext/mnogosearch/config.m454
-rw-r--r--ext/mnogosearch/index.php1055
-rw-r--r--ext/mnogosearch/php_mnogo.c2521
-rw-r--r--ext/mnogosearch/php_mnogo.h114
-rw-r--r--ext/msession/CREDITS3
-rw-r--r--ext/msession/README33
-rw-r--r--ext/msession/config.m436
-rw-r--r--ext/msession/msession-test.php125
-rw-r--r--ext/msession/msession.c1384
-rw-r--r--ext/msession/msession.php10
-rw-r--r--ext/msession/php_msession.h109
-rw-r--r--ext/msession/reqclient.h171
-rw-r--r--ext/msql/CREDITS2
-rw-r--r--ext/msql/config.m442
-rw-r--r--ext/msql/msql.dsp107
-rw-r--r--ext/msql/php_msql.c1317
-rw-r--r--ext/msql/php_msql.h82
-rw-r--r--ext/mssql/CREDITS2
-rw-r--r--ext/mssql/config.m452
-rw-r--r--ext/mssql/mssql.dsp117
-rw-r--r--ext/mssql/mssql_win32_howto.txt35
-rw-r--r--ext/mssql/php_mssql.c2210
-rw-r--r--ext/mssql/php_mssql.h205
-rw-r--r--ext/mysql/CREDITS2
-rw-r--r--ext/mysql/config.m4160
-rw-r--r--ext/mysql/libmysql/acinclude.m4382
-rw-r--r--ext/mysql/libmysql/array.c163
-rw-r--r--ext/mysql/libmysql/bchange.c25
-rw-r--r--ext/mysql/libmysql/bmove.c63
-rw-r--r--ext/mysql/libmysql/bmove_upp.c37
-rw-r--r--ext/mysql/libmysql/charset.c550
-rw-r--r--ext/mysql/libmysql/config-win.h293
-rw-r--r--ext/mysql/libmysql/ctype.c54
-rw-r--r--ext/mysql/libmysql/ctype_autoconf.c44
-rw-r--r--ext/mysql/libmysql/ctype_extra_sources.c82
-rw-r--r--ext/mysql/libmysql/dbug.c2069
-rw-r--r--ext/mysql/libmysql/dbug.h80
-rw-r--r--ext/mysql/libmysql/default.c384
-rw-r--r--ext/mysql/libmysql/dll.c0
-rw-r--r--ext/mysql/libmysql/errmsg.c96
-rw-r--r--ext/mysql/libmysql/errmsg.h45
-rw-r--r--ext/mysql/libmysql/errors.c78
-rwxr-xr-xext/mysql/libmysql/fix_copyright35
-rw-r--r--ext/mysql/libmysql/get_password.c197
-rw-r--r--ext/mysql/libmysql/global.h952
-rw-r--r--ext/mysql/libmysql/int2str.c141
-rw-r--r--ext/mysql/libmysql/is_prefix.c20
-rw-r--r--ext/mysql/libmysql/libmysql.c2604
-rw-r--r--ext/mysql/libmysql/libmysql.dsp585
-rw-r--r--ext/mysql/libmysql/list.c102
-rw-r--r--ext/mysql/libmysql/longlong2str.c129
-rw-r--r--ext/mysql/libmysql/m_ctype.h144
-rw-r--r--ext/mysql/libmysql/m_string.h230
-rw-r--r--ext/mysql/libmysql/mf_casecnv.c247
-rw-r--r--ext/mysql/libmysql/mf_dirname.c92
-rw-r--r--ext/mysql/libmysql/mf_fn_ext.c32
-rw-r--r--ext/mysql/libmysql/mf_format.c142
-rw-r--r--ext/mysql/libmysql/mf_loadpath.c40
-rw-r--r--ext/mysql/libmysql/mf_pack.c518
-rw-r--r--ext/mysql/libmysql/mf_path.c106
-rw-r--r--ext/mysql/libmysql/mf_unixpath.c19
-rw-r--r--ext/mysql/libmysql/mf_wcomp.c54
-rw-r--r--ext/mysql/libmysql/mulalloc.c39
-rw-r--r--ext/mysql/libmysql/my_alarm.h46
-rw-r--r--ext/mysql/libmysql/my_alloc.c140
-rw-r--r--ext/mysql/libmysql/my_compress.c74
-rw-r--r--ext/mysql/libmysql/my_config.h15
-rw-r--r--ext/mysql/libmysql/my_create.c50
-rw-r--r--ext/mysql/libmysql/my_delete.c22
-rw-r--r--ext/mysql/libmysql/my_dir.h86
-rw-r--r--ext/mysql/libmysql/my_div.c17
-rw-r--r--ext/mysql/libmysql/my_error.c110
-rw-r--r--ext/mysql/libmysql/my_fopen.c160
-rw-r--r--ext/mysql/libmysql/my_getwd.c180
-rw-r--r--ext/mysql/libmysql/my_init.c312
-rw-r--r--ext/mysql/libmysql/my_lib.c600
-rw-r--r--ext/mysql/libmysql/my_list.h33
-rw-r--r--ext/mysql/libmysql/my_malloc.c70
-rw-r--r--ext/mysql/libmysql/my_messnc.c22
-rw-r--r--ext/mysql/libmysql/my_net.c35
-rw-r--r--ext/mysql/libmysql/my_net.h27
-rw-r--r--ext/mysql/libmysql/my_once.c74
-rw-r--r--ext/mysql/libmysql/my_open.c112
-rw-r--r--ext/mysql/libmysql/my_pthread.c462
-rw-r--r--ext/mysql/libmysql/my_pthread.h613
-rw-r--r--ext/mysql/libmysql/my_read.c52
-rw-r--r--ext/mysql/libmysql/my_realloc.c51
-rw-r--r--ext/mysql/libmysql/my_static.c87
-rw-r--r--ext/mysql/libmysql/my_static.h56
-rw-r--r--ext/mysql/libmysql/my_sys.h592
-rw-r--r--ext/mysql/libmysql/my_tempnam.c159
-rw-r--r--ext/mysql/libmysql/my_thr_init.c212
-rw-r--r--ext/mysql/libmysql/my_wincond.c128
-rw-r--r--ext/mysql/libmysql/my_winthread.c105
-rw-r--r--ext/mysql/libmysql/my_write.c76
-rw-r--r--ext/mysql/libmysql/mysql.h298
-rw-r--r--ext/mysql/libmysql/mysql.m416
-rw-r--r--ext/mysql/libmysql/mysql_com.h222
-rw-r--r--ext/mysql/libmysql/mysql_version.h24
-rw-r--r--ext/mysql/libmysql/mysqld_error.h221
-rw-r--r--ext/mysql/libmysql/mysys_err.h50
-rw-r--r--ext/mysql/libmysql/mysys_priv.h18
-rw-r--r--ext/mysql/libmysql/net.c671
-rw-r--r--ext/mysql/libmysql/password.c178
-rw-r--r--ext/mysql/libmysql/raid.h147
-rw-r--r--ext/mysql/libmysql/safemalloc.c510
-rw-r--r--ext/mysql/libmysql/stamp-h.in1
-rw-r--r--ext/mysql/libmysql/str2int.c188
-rw-r--r--ext/mysql/libmysql/strcend.c42
-rw-r--r--ext/mysql/libmysql/strcont.c32
-rw-r--r--ext/mysql/libmysql/strend.c33
-rw-r--r--ext/mysql/libmysql/strfill.c22
-rw-r--r--ext/mysql/libmysql/string.c113
-rw-r--r--ext/mysql/libmysql/strinstr.c36
-rw-r--r--ext/mysql/libmysql/strmake.c40
-rw-r--r--ext/mysql/libmysql/strmov.c45
-rw-r--r--ext/mysql/libmysql/strnmov.c22
-rw-r--r--ext/mysql/libmysql/strto.c194
-rw-r--r--ext/mysql/libmysql/strtoll.c11
-rw-r--r--ext/mysql/libmysql/strtoull.c12
-rw-r--r--ext/mysql/libmysql/strxmov.c33
-rw-r--r--ext/mysql/libmysql/thr_alarm.h98
-rw-r--r--ext/mysql/libmysql/thr_mutex.c217
-rw-r--r--ext/mysql/libmysql/typelib.c92
-rwxr-xr-xext/mysql/libmysql/update_sources103
-rw-r--r--ext/mysql/libmysql/violite.c429
-rw-r--r--ext/mysql/libmysql/violite.h103
-rw-r--r--ext/mysql/mysql.dsp171
-rw-r--r--ext/mysql/mysql.mak169
-rw-r--r--ext/mysql/php_mysql.c2382
-rw-r--r--ext/mysql/php_mysql.h125
-rw-r--r--ext/mysqli/CREDITS2
-rw-r--r--ext/mysqli/EXPERIMENTAL0
-rw-r--r--ext/mysqli/TODO13
-rw-r--r--ext/mysqli/config.m445
-rw-r--r--ext/mysqli/mysqli.c451
-rwxr-xr-xext/mysqli/mysqli.dsp120
-rw-r--r--ext/mysqli/mysqli_api.c1913
-rw-r--r--ext/mysqli/mysqli_fe.c235
-rw-r--r--ext/mysqli/mysqli_nonapi.c207
-rw-r--r--ext/mysqli/mysqli_profiler.c494
-rw-r--r--ext/mysqli/mysqli_profiler.h226
-rw-r--r--ext/mysqli/mysqli_profiler_com.c98
-rw-r--r--ext/mysqli/mysqli_profiler_com.h53
-rw-r--r--ext/mysqli/php_mysqli.h304
-rw-r--r--ext/mysqli/tests/001.phpt54
-rw-r--r--ext/mysqli/tests/002.phpt60
-rw-r--r--ext/mysqli/tests/003.phpt56
-rw-r--r--ext/mysqli/tests/004.phpt35
-rw-r--r--ext/mysqli/tests/005.phpt38
-rw-r--r--ext/mysqli/tests/006.phpt51
-rw-r--r--ext/mysqli/tests/007.phpt51
-rw-r--r--ext/mysqli/tests/008.phpt53
-rw-r--r--ext/mysqli/tests/009.phpt51
-rw-r--r--ext/mysqli/tests/010.phpt54
-rw-r--r--ext/mysqli/tests/011.phpt53
-rw-r--r--ext/mysqli/tests/012.phpt54
-rw-r--r--ext/mysqli/tests/013.phpt45
-rw-r--r--ext/mysqli/tests/014.phpt66
-rw-r--r--ext/mysqli/tests/015.phpt68
-rw-r--r--ext/mysqli/tests/016.phpt25
-rw-r--r--ext/mysqli/tests/017.phpt30
-rw-r--r--ext/mysqli/tests/018.phpt25
-rw-r--r--ext/mysqli/tests/019.phpt68
-rw-r--r--ext/mysqli/tests/020.phpt70
-rw-r--r--ext/mysqli/tests/021.phpt40
-rw-r--r--ext/mysqli/tests/022.phpt44
-rw-r--r--ext/mysqli/tests/023.phpt64
-rw-r--r--ext/mysqli/tests/024.phpt65
-rw-r--r--ext/mysqli/tests/025.phpt68
-rw-r--r--ext/mysqli/tests/026.phpt48
-rw-r--r--ext/mysqli/tests/027.phpt21
-rw-r--r--ext/mysqli/tests/028.phpt19
-rw-r--r--ext/mysqli/tests/029.phpt25
-rw-r--r--ext/mysqli/tests/030.phpt24
-rw-r--r--ext/mysqli/tests/031.phpt24
-rw-r--r--ext/mysqli/tests/032.phpt25
-rw-r--r--ext/mysqli/tests/033.phpt19
-rw-r--r--ext/mysqli/tests/034.phpt19
-rw-r--r--ext/mysqli/tests/035.phpt19
-rw-r--r--ext/mysqli/tests/036.phpt43
-rw-r--r--ext/mysqli/tests/037.phpt34
-rw-r--r--ext/mysqli/tests/038.phpt31
-rw-r--r--ext/mysqli/tests/039.phpt24
-rw-r--r--ext/mysqli/tests/040.phpt31
-rw-r--r--ext/mysqli/tests/041.phpt24
-rw-r--r--ext/mysqli/tests/042.phpt61
-rw-r--r--ext/mysqli/tests/043.phpt40
-rw-r--r--ext/mysqli/tests/044.phpt19
-rw-r--r--ext/mysqli/tests/045.phpt28
-rw-r--r--ext/mysqli/tests/046.phpt31
-rw-r--r--ext/mysqli/tests/047.phpt73
-rw-r--r--ext/mysqli/tests/048.phpt60
-rw-r--r--ext/mysqli/tests/049.phpt23
-rw-r--r--ext/mysqli/tests/050.phpt19
-rw-r--r--ext/mysqli/tests/051.phpt20
-rw-r--r--ext/mysqli/tests/052.phpt20
-rw-r--r--ext/mysqli/tests/053.phpt18
-rw-r--r--ext/mysqli/tests/054.phpt18
-rw-r--r--ext/mysqli/tests/055.phpt17
-rw-r--r--ext/mysqli/tests/056.phpt19
-rw-r--r--ext/mysqli/tests/057.phpt52
-rw-r--r--ext/mysqli/tests/connect.inc10
-rw-r--r--ext/ncurses/CREDITS2
-rw-r--r--ext/ncurses/EXPERIMENTAL0
-rw-r--r--ext/ncurses/c-prototypes263
-rw-r--r--ext/ncurses/config.m465
-rw-r--r--ext/ncurses/example1.php28
-rw-r--r--ext/ncurses/ncurses.c324
-rw-r--r--ext/ncurses/ncurses.php10
-rw-r--r--ext/ncurses/ncurses_fe.c223
-rw-r--r--ext/ncurses/ncurses_functions.c2460
-rw-r--r--ext/ncurses/php_ncurses.h80
-rw-r--r--ext/ncurses/php_ncurses_fe.h197
-rw-r--r--ext/ncurses/tests/001.phpt23
-rw-r--r--ext/notes/notes.dsp202
-rw-r--r--ext/notes/notes.dsw29
-rw-r--r--ext/notes/php_notes.c2722
-rw-r--r--ext/notes/php_notes.h47
-rw-r--r--ext/oci8/CREDITS2
-rw-r--r--ext/oci8/config.m4149
-rw-r--r--ext/oci8/oci8.c5521
-rw-r--r--ext/oci8/oci8.dsp113
-rw-r--r--ext/oci8/oci8.dsw29
-rw-r--r--ext/oci8/php_oci8.h217
-rw-r--r--ext/odbc/CREDITS2
-rw-r--r--ext/odbc/birdstep.c652
-rw-r--r--ext/odbc/config.m4555
-rw-r--r--ext/odbc/php_birdstep.h92
-rw-r--r--ext/odbc/php_odbc.c3630
-rw-r--r--ext/odbc/php_odbc.h117
-rw-r--r--ext/odbc/php_odbc_includes.h287
-rw-r--r--ext/openssl/CREDITS2
-rw-r--r--ext/openssl/README321
-rw-r--r--ext/openssl/config.m410
-rw-r--r--ext/openssl/openssl.c3056
-rw-r--r--ext/openssl/openssl.dsp107
-rw-r--r--ext/openssl/php_openssl.h83
-rw-r--r--ext/openssl/tests/001.phpt74
-rw-r--r--ext/openssl/tests/skipif.inc11
-rw-r--r--ext/openssl/xp_ssl.c557
-rw-r--r--ext/oracle/CREDITS2
-rw-r--r--ext/oracle/config.m4160
-rw-r--r--ext/oracle/oracle.c1769
-rw-r--r--ext/oracle/oracle.dsp113
-rw-r--r--ext/oracle/php_oracle.h137
-rw-r--r--ext/ovrimos/CREDITS2
-rw-r--r--ext/ovrimos/config.m428
-rw-r--r--ext/ovrimos/ovrimos.c1291
-rw-r--r--ext/ovrimos/php_ovrimos.h44
-rw-r--r--ext/pcntl/CREDITS2
-rw-r--r--ext/pcntl/EXPERIMENTAL5
-rw-r--r--ext/pcntl/README16
-rw-r--r--ext/pcntl/config.m419
-rwxr-xr-xext/pcntl/pcntl.c656
-rw-r--r--ext/pcntl/php_pcntl.h81
-rw-r--r--ext/pcntl/php_signal.c46
-rw-r--r--ext/pcntl/php_signal.h28
-rwxr-xr-xext/pcntl/test-pcntl.php39
-rw-r--r--ext/pcntl/tests/001.phpt84
-rw-r--r--ext/pcre/CREDITS2
-rw-r--r--ext/pcre/config.m456
-rw-r--r--ext/pcre/config0.m456
-rw-r--r--ext/pcre/pcrelib/AUTHORS6
-rw-r--r--ext/pcre/pcrelib/COPYING50
-rw-r--r--ext/pcre/pcrelib/ChangeLog958
-rw-r--r--ext/pcre/pcrelib/INSTALL185
-rw-r--r--ext/pcre/pcrelib/LICENCE50
-rw-r--r--ext/pcre/pcrelib/NEWS85
-rw-r--r--ext/pcre/pcrelib/NON-UNIX-USE89
-rw-r--r--ext/pcre/pcrelib/README312
-rw-r--r--ext/pcre/pcrelib/chartables.c183
-rw-r--r--ext/pcre/pcrelib/dftables.c148
-rw-r--r--ext/pcre/pcrelib/dll.mk60
-rw-r--r--ext/pcre/pcrelib/doc/Tech.Notes253
-rw-r--r--ext/pcre/pcrelib/doc/pcre.31993
-rw-r--r--ext/pcre/pcrelib/doc/pcre.html2672
-rw-r--r--ext/pcre/pcrelib/doc/pcre.txt2307
-rw-r--r--ext/pcre/pcrelib/doc/pcregrep.192
-rw-r--r--ext/pcre/pcrelib/doc/pcregrep.html125
-rw-r--r--ext/pcre/pcrelib/doc/pcregrep.txt109
-rw-r--r--ext/pcre/pcrelib/doc/pcreposix.3149
-rw-r--r--ext/pcre/pcrelib/doc/pcreposix.html191
-rw-r--r--ext/pcre/pcrelib/doc/pcreposix.txt159
-rw-r--r--ext/pcre/pcrelib/doc/pcretest.1288
-rw-r--r--ext/pcre/pcrelib/doc/pcretest.html377
-rw-r--r--ext/pcre/pcrelib/doc/pcretest.txt329
-rw-r--r--ext/pcre/pcrelib/doc/perltest.txt34
-rw-r--r--ext/pcre/pcrelib/get.c227
-rw-r--r--ext/pcre/pcrelib/internal.h632
-rw-r--r--ext/pcre/pcrelib/maketables.c136
-rw-r--r--ext/pcre/pcrelib/pcre.c5992
-rw-r--r--ext/pcre/pcrelib/pcre.def22
-rw-r--r--ext/pcre/pcrelib/pcre.h150
-rw-r--r--ext/pcre/pcrelib/pcregrep.c640
-rw-r--r--ext/pcre/pcrelib/pcreposix.c301
-rw-r--r--ext/pcre/pcrelib/pcreposix.h88
-rw-r--r--ext/pcre/pcrelib/pcretest.c1274
-rw-r--r--ext/pcre/pcrelib/study.c409
-rw-r--r--ext/pcre/pcrelib/testdata/testinput13808
-rw-r--r--ext/pcre/pcrelib/testdata/testinput21162
-rw-r--r--ext/pcre/pcrelib/testdata/testinput365
-rw-r--r--ext/pcre/pcrelib/testdata/testinput4155
-rw-r--r--ext/pcre/pcrelib/testdata/testinput591
-rw-r--r--ext/pcre/pcrelib/testdata/testinput678
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput16222
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput24088
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput3116
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput4304
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput5339
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput6319
-rw-r--r--ext/pcre/php_pcre.c1506
-rw-r--r--ext/pcre/php_pcre.h78
-rw-r--r--ext/pcre/tests/bug20528.phpt24
-rw-r--r--ext/pcre/tests/bug21732.phpt29
-rw-r--r--ext/pdf/CREDITS2
-rw-r--r--ext/pdf/config.m4129
-rw-r--r--ext/pdf/pdf.c3231
-rw-r--r--ext/pdf/pdf.dsp114
-rw-r--r--ext/pdf/php_pdf.h179
-rw-r--r--ext/pfpro/CREDITS2
-rw-r--r--ext/pfpro/TODO12
-rw-r--r--ext/pfpro/config.m468
-rw-r--r--ext/pfpro/pfpro.c549
-rw-r--r--ext/pfpro/php_pfpro.h85
-rw-r--r--ext/pgsql/CREDITS2
-rw-r--r--ext/pgsql/README235
-rw-r--r--ext/pgsql/config.m472
-rw-r--r--ext/pgsql/mysql_users.php82
-rw-r--r--ext/pgsql/pgsql.c4507
-rw-r--r--ext/pgsql/pgsql.dsp167
-rw-r--r--ext/pgsql/pgsql.mak170
-rw-r--r--ext/pgsql/php_pgsql.h269
-rw-r--r--ext/pgsql/tests/01createdb.phpt10
-rw-r--r--ext/pgsql/tests/02connection.phpt10
-rw-r--r--ext/pgsql/tests/03sync_query.phpt10
-rw-r--r--ext/pgsql/tests/04async_query.phpt10
-rw-r--r--ext/pgsql/tests/05large_object.phpt11
-rw-r--r--ext/pgsql/tests/06copy.phpt10
-rw-r--r--ext/pgsql/tests/07optional.phpt10
-rw-r--r--ext/pgsql/tests/08escape.phpt14
-rw-r--r--ext/pgsql/tests/09notice.phpt13
-rw-r--r--ext/pgsql/tests/10pg_convert.phpt17
-rw-r--r--ext/pgsql/tests/11pg_meta_data.phpt50
-rw-r--r--ext/pgsql/tests/12pg_insert.phpt11
-rw-r--r--ext/pgsql/tests/13pg_select.phpt22
-rw-r--r--ext/pgsql/tests/14pg_update.phpt11
-rw-r--r--ext/pgsql/tests/15pg_delete.phpt10
-rw-r--r--ext/pgsql/tests/16pg_result_status.phpt11
-rw-r--r--ext/pgsql/tests/17result.phpt49
-rw-r--r--ext/pgsql/tests/18pg_escape_bytea.phpt10
-rw-r--r--ext/pgsql/tests/19pg_ping.phpt10
-rw-r--r--ext/pgsql/tests/20pg_get_pid.phpt10
-rw-r--r--ext/pgsql/tests/21pg_get_notify.phpt10
-rw-r--r--ext/pgsql/tests/80_bug14383.phpt37
-rw-r--r--ext/pgsql/tests/98old_api.phpt10
-rw-r--r--ext/pgsql/tests/9999dropdb.phpt10
-rw-r--r--ext/pgsql/tests/README14
-rw-r--r--ext/pgsql/tests/async_query.inc59
-rw-r--r--ext/pgsql/tests/config.inc12
-rw-r--r--ext/pgsql/tests/connection.inc44
-rw-r--r--ext/pgsql/tests/copy.inc8
-rw-r--r--ext/pgsql/tests/createdb.inc22
-rw-r--r--ext/pgsql/tests/dropdb.inc11
-rw-r--r--ext/pgsql/tests/escape.inc59
-rw-r--r--ext/pgsql/tests/informational.inc47
-rw-r--r--ext/pgsql/tests/large_object.inc67
-rw-r--r--ext/pgsql/tests/notice.inc18
-rw-r--r--ext/pgsql/tests/old_api.inc26
-rw-r--r--ext/pgsql/tests/optional.inc13
-rw-r--r--ext/pgsql/tests/pg_convert.inc14
-rw-r--r--ext/pgsql/tests/pg_delete.inc17
-rw-r--r--ext/pgsql/tests/pg_escape_bytea.inc25
-rw-r--r--ext/pgsql/tests/pg_get_notify.inc16
-rw-r--r--ext/pgsql/tests/pg_get_pid.inc13
-rw-r--r--ext/pgsql/tests/pg_insert.inc13
-rw-r--r--ext/pgsql/tests/pg_meta_data.inc13
-rw-r--r--ext/pgsql/tests/pg_ping.inc10
-rw-r--r--ext/pgsql/tests/pg_result_status.inc13
-rw-r--r--ext/pgsql/tests/pg_select.inc15
-rw-r--r--ext/pgsql/tests/pg_update.inc15
-rw-r--r--ext/pgsql/tests/php.gifbin3872 -> 0 bytes
-rw-r--r--ext/pgsql/tests/result.inc24
-rw-r--r--ext/pgsql/tests/skipif.inc22
-rw-r--r--ext/pgsql/tests/sync_query.inc47
-rw-r--r--ext/posix/CREDITS2
-rw-r--r--ext/posix/config.m413
-rw-r--r--ext/posix/php_posix.h124
-rw-r--r--ext/posix/posix.c1016
-rw-r--r--ext/pspell/CREDITS2
-rw-r--r--ext/pspell/README51
-rw-r--r--ext/pspell/config.m436
-rw-r--r--ext/pspell/php_pspell.h52
-rw-r--r--ext/pspell/pspell.c819
-rw-r--r--ext/pspell/tests/01pspell_basic.phpt143
-rw-r--r--ext/qtdom/CREDITS2
-rw-r--r--ext/qtdom/EXPERIMENTAL5
-rw-r--r--ext/qtdom/config.m437
-rw-r--r--ext/qtdom/qtdom.c269
-rw-r--r--ext/qtdom/qtdom.h74
-rw-r--r--ext/qtdom/qtdom.php10
-rw-r--r--ext/qtdom/qtdom_qt.cpp371
-rw-r--r--ext/qtdom/qtdom_qt.h67
-rw-r--r--ext/readline/CREDITS2
-rw-r--r--ext/readline/README.libedit4
-rw-r--r--ext/readline/config.m494
-rw-r--r--ext/readline/php_readline.h39
-rw-r--r--ext/readline/readline.c439
-rw-r--r--ext/recode/CREDITS2
-rw-r--r--ext/recode/config.m463
-rw-r--r--ext/recode/php_recode.h39
-rw-r--r--ext/recode/recode.c242
-rw-r--r--ext/rpc/CREDITS2
-rw-r--r--ext/rpc/EXPERIMENTAL5
-rw-r--r--ext/rpc/RPC_HOWTO97
-rw-r--r--ext/rpc/com/CREDITS2
-rw-r--r--ext/rpc/com/TODO28
-rw-r--r--ext/rpc/com/com.c1362
-rw-r--r--ext/rpc/com/com.dsp167
-rw-r--r--ext/rpc/com/com.h45
-rw-r--r--ext/rpc/com/com_wrapper.c930
-rw-r--r--ext/rpc/com/com_wrapper.h107
-rw-r--r--ext/rpc/com/conversion.c855
-rw-r--r--ext/rpc/com/conversion.h42
-rw-r--r--ext/rpc/com/dispatch.c641
-rw-r--r--ext/rpc/com/php_com.h25
-rw-r--r--ext/rpc/com/variant.c324
-rw-r--r--ext/rpc/com/variant.h64
-rw-r--r--ext/rpc/dotnet/CREDITS2
-rw-r--r--ext/rpc/dotnet/EXPERIMENTAL5
-rw-r--r--ext/rpc/dotnet/README32
-rw-r--r--ext/rpc/dotnet/dotnet.cpp237
-rw-r--r--ext/rpc/dotnet/dotnet.dsp167
-rw-r--r--ext/rpc/dotnet/dotnet.php8
-rw-r--r--ext/rpc/dotnet/php_dotnet.h21
-rw-r--r--ext/rpc/handler.h144
-rw-r--r--ext/rpc/hash.h74
-rw-r--r--ext/rpc/java/CREDITS2
-rw-r--r--ext/rpc/java/EXPERIMENTAL5
-rw-r--r--ext/rpc/java/Makefile.frag13
-rw-r--r--ext/rpc/java/README247
-rw-r--r--ext/rpc/java/config.m4190
-rw-r--r--ext/rpc/java/except.php23
-rw-r--r--ext/rpc/java/java.c862
-rw-r--r--ext/rpc/java/java.dsp254
-rw-r--r--ext/rpc/java/jawt.php27
-rw-r--r--ext/rpc/java/jver.php17
-rw-r--r--ext/rpc/java/reflect.java419
-rw-r--r--ext/rpc/php_rpc.h40
-rw-r--r--ext/rpc/rpc.c936
-rw-r--r--ext/rpc/rpc.h173
-rw-r--r--ext/rpc/rpc_proxy.c154
-rw-r--r--ext/rpc/rpc_proxy.h22
-rw-r--r--ext/rpc/skeleton/php_skeleton.h33
-rw-r--r--ext/rpc/skeleton/skeleton.c269
-rw-r--r--ext/rpc/skeleton/skeleton.h43
-rw-r--r--ext/rpc/tests/test1.php14
-rw-r--r--ext/rpc/tests/test2.php20
-rw-r--r--ext/rpc/tests/test3.php19
-rw-r--r--ext/rpc/tests/test4.php18
-rw-r--r--ext/rpc/tests/tests.php6
-rw-r--r--ext/rpc/xmlrpc/CREDITS2
-rw-r--r--ext/rpc/xmlrpc/EXPERIMENTAL5
-rw-r--r--ext/rpc/xmlrpc/config.m493
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/README17
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/acinclude.m432
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/base64.c192
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/base64.h38
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/encodings.c119
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/encodings.h46
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/queue.c982
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/queue.h89
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/simplestring.c244
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/simplestring.h76
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/system_methods.c375
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/system_methods_private.h91
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xml_element.c734
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xml_element.h202
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.c319
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.h44
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.c673
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.h44
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.c409
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.h45
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xmlrpc.c2956
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xmlrpc.h454
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xmlrpc.m412
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.c598
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.h101
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h106
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xmlrpc_private.h178
-rw-r--r--ext/rpc/xmlrpc/libxmlrpc/xmlrpc_win32.h11
-rw-r--r--ext/rpc/xmlrpc/php_xmlrpc.h120
-rw-r--r--ext/rpc/xmlrpc/xmlrpc-epi-php.c1475
-rw-r--r--ext/rpc/xmlrpc/xmlrpc.dsp211
-rw-r--r--ext/session/CREDITS2
-rw-r--r--ext/session/config.m433
-rw-r--r--ext/session/mod_files.c406
-rw-r--r--ext/session/mod_files.h27
-rw-r--r--ext/session/mod_files.sh16
-rw-r--r--ext/session/mod_mm.c437
-rw-r--r--ext/session/mod_mm.h35
-rw-r--r--ext/session/mod_user.c184
-rw-r--r--ext/session/mod_user.h39
-rw-r--r--ext/session/php_session.h236
-rw-r--r--ext/session/session.c1778
-rw-r--r--ext/session/tests/001.phpt35
-rw-r--r--ext/session/tests/002.phpt13
-rw-r--r--ext/session/tests/003.phpt44
-rw-r--r--ext/session/tests/004.phpt111
-rw-r--r--ext/session/tests/005.phpt146
-rw-r--r--ext/session/tests/006.phpt70
-rw-r--r--ext/session/tests/007.phpt59
-rw-r--r--ext/session/tests/008-php4.2.3.phpt68
-rw-r--r--ext/session/tests/008.phpt61
-rw-r--r--ext/session/tests/009.phpt57
-rw-r--r--ext/session/tests/010.phpt19
-rw-r--r--ext/session/tests/011.phpt20
-rw-r--r--ext/session/tests/012.phpt34
-rw-r--r--ext/session/tests/013.phpt26
-rw-r--r--ext/session/tests/014.phpt37
-rw-r--r--ext/session/tests/015.phpt24
-rw-r--r--ext/session/tests/016.phpt20
-rw-r--r--ext/session/tests/017.phpt25
-rw-r--r--ext/session/tests/018.phpt24
-rw-r--r--ext/session/tests/019.phpt72
-rw-r--r--ext/session/tests/020.phpt25
-rw-r--r--ext/session/tests/021.phpt61
-rw-r--r--ext/session/tests/skipif.inc10
-rw-r--r--ext/shmop/CREDITS2
-rw-r--r--ext/shmop/README69
-rw-r--r--ext/shmop/config.m48
-rw-r--r--ext/shmop/php_shmop.h84
-rw-r--r--ext/shmop/shmop.c368
-rw-r--r--ext/shmop/shmop.dsp107
-rw-r--r--ext/shmop/tests/001.phpt91
-rw-r--r--ext/skeleton/CREDITS1
-rw-r--r--ext/skeleton/EXPERIMENTAL0
-rwxr-xr-xext/skeleton/create_stubs289
-rw-r--r--ext/skeleton/php_skeleton.h56
-rw-r--r--ext/skeleton/skeleton.c167
-rw-r--r--ext/skeleton/skeleton.dsp113
-rw-r--r--ext/skeleton/skeleton.php19
-rw-r--r--ext/skeleton/tests/001.phpt24
-rw-r--r--ext/snmp/CREDITS3
-rw-r--r--ext/snmp/config.m4123
-rw-r--r--ext/snmp/php_snmp.h61
-rw-r--r--ext/snmp/snmp.c893
-rw-r--r--ext/snmp/snmp.dsp109
-rw-r--r--ext/snmp/winsnmp.c249
-rw-r--r--ext/soap/EXPERIMENTAL0
-rw-r--r--ext/soap/Makefile.in8
-rw-r--r--ext/soap/TODO39
-rw-r--r--ext/soap/config.m433
-rw-r--r--ext/soap/interop/base.php25
-rw-r--r--ext/soap/interop/client_round2.php102
-rw-r--r--ext/soap/interop/client_round2_interop.php796
-rw-r--r--ext/soap/interop/client_round2_params.php636
-rw-r--r--ext/soap/interop/client_round2_results.php75
-rw-r--r--ext/soap/interop/client_round2_run.php54
-rw-r--r--ext/soap/interop/database_round2.sql45
-rw-r--r--ext/soap/interop/echoheadersvc.wsdl16
-rw-r--r--ext/soap/interop/endpointdata.sql85
-rw-r--r--ext/soap/interop/index.php70
-rw-r--r--ext/soap/interop/info.php1
-rw-r--r--ext/soap/interop/interop.wsdl18
-rw-r--r--ext/soap/interop/interopB.wsdl13
-rw-r--r--ext/soap/interop/server_round2.php35
-rw-r--r--ext/soap/interop/server_round2_base.php184
-rw-r--r--ext/soap/interop/server_round2_groupB.php87
-rw-r--r--ext/soap/interop/server_round2_groupC.php41
-rw-r--r--ext/soap/interop/server_round2_test.php258
-rw-r--r--ext/soap/interop/test.utility.php81
-rw-r--r--ext/soap/interop/testclient.php17
-rw-r--r--ext/soap/interop/testserver.php17
-rw-r--r--ext/soap/package.xml59
-rw-r--r--ext/soap/php_encoding.c1135
-rw-r--r--ext/soap/php_encoding.h256
-rw-r--r--ext/soap/php_http.c456
-rw-r--r--ext/soap/php_http.h11
-rw-r--r--ext/soap/php_packet_soap.c141
-rw-r--r--ext/soap/php_packet_soap.h6
-rw-r--r--ext/soap/php_schema.c1080
-rw-r--r--ext/soap/php_schema.h28
-rw-r--r--ext/soap/php_sdl.c1139
-rw-r--r--ext/soap/php_sdl.h167
-rw-r--r--ext/soap/php_soap.dsp148
-rw-r--r--ext/soap/php_soap.h416
-rw-r--r--ext/soap/php_xml.c242
-rw-r--r--ext/soap/php_xml.h28
-rw-r--r--ext/soap/soap.c2309
-rw-r--r--ext/sockets/CREDITS2
-rw-r--r--ext/sockets/config.m432
-rw-r--r--ext/sockets/php_sockets.h133
-rw-r--r--ext/sockets/php_sockets_win.c178
-rw-r--r--ext/sockets/php_sockets_win.h82
-rw-r--r--ext/sockets/sockets.c2304
-rw-r--r--ext/sockets/sockets.dsp117
-rw-r--r--ext/sockets/sockets.php10
-rw-r--r--ext/sockets/tests/ipv4loop.phpt49
-rw-r--r--ext/sockets/tests/ipv6loop.phpt52
-rw-r--r--ext/sockets/unix_socket_constants.h406
-rw-r--r--ext/sockets/win32_socket_constants.h54
-rwxr-xr-xext/spl/CREDITS2
-rwxr-xr-xext/spl/EXPERIMENTAL0
-rwxr-xr-xext/spl/README39
-rwxr-xr-xext/spl/TODO13
-rwxr-xr-xext/spl/config.m441
-rwxr-xr-xext/spl/examples/dba_dump.php72
-rwxr-xr-xext/spl/php_spl.c310
-rwxr-xr-xext/spl/php_spl.h114
-rwxr-xr-xext/spl/spl.php306
-rwxr-xr-xext/spl/spl_array.c349
-rwxr-xr-xext/spl/spl_array.h49
-rwxr-xr-xext/spl/spl_engine.c253
-rwxr-xr-xext/spl/spl_engine.h63
-rwxr-xr-xext/spl/spl_foreach.c129
-rwxr-xr-xext/spl/spl_foreach.h37
-rwxr-xr-xext/spl/spl_functions.c187
-rwxr-xr-xext/spl/spl_functions.h80
-rwxr-xr-xext/spl/tests/.htaccess3
-rwxr-xr-xext/spl/tests/array_access_001.phpt127
-rwxr-xr-xext/spl/tests/array_access_002.phpt137
-rwxr-xr-xext/spl/tests/array_access_ex.phpt154
-rwxr-xr-xext/spl/tests/array_read.phpt208
-rwxr-xr-xext/spl/tests/foreach.phpt184
-rwxr-xr-xext/spl/tests/forward.phpt115
-rwxr-xr-xext/spl/tests/sequence.phpt138
-rw-r--r--ext/sqlite/EXPERIMENTAL0
-rw-r--r--ext/sqlite/libsqlite/src/opcodes.c132
-rw-r--r--ext/sqlite/libsqlite/src/sqlite.w32.h692
-rw-r--r--ext/sqlite/libsqlite/src/sqlite_config.w32.h8
-rw-r--r--ext/sqlite/sqlite.dsp316
-rwxr-xr-xext/sqlite/tests/sqlite_007.phpt51
-rwxr-xr-xext/sqlite/tests/sqlite_008.phpt43
-rwxr-xr-xext/sqlite/tests/sqlite_009.phpt43
-rwxr-xr-xext/sqlite/tests/sqlite_010.phpt78
-rwxr-xr-xext/sqlite/tests/sqlite_011.phpt27
-rwxr-xr-xext/sqlite/tests/sqlite_012.phpt35
-rwxr-xr-xext/sqlite/tests/sqlite_013.phpt55
-rw-r--r--ext/standard/CREDITS3
-rw-r--r--ext/standard/Makefile.frag10
-rw-r--r--ext/standard/aggregation.c658
-rw-r--r--ext/standard/aggregation.h51
-rw-r--r--ext/standard/array.c3780
-rw-r--r--ext/standard/assert.c298
-rw-r--r--ext/standard/base64.c248
-rw-r--r--ext/standard/base64.h37
-rw-r--r--ext/standard/basic_functions.c3056
-rw-r--r--ext/standard/basic_functions.h224
-rw-r--r--ext/standard/browscap.c291
-rw-r--r--ext/standard/config.m4289
-rw-r--r--ext/standard/crc32.c52
-rw-r--r--ext/standard/crc32.h109
-rw-r--r--ext/standard/credits.c122
-rw-r--r--ext/standard/credits.h42
-rw-r--r--ext/standard/credits_ext.h95
-rw-r--r--ext/standard/credits_sapi.h31
-rw-r--r--ext/standard/crypt.c173
-rw-r--r--ext/standard/css.c59
-rw-r--r--ext/standard/css.h26
-rw-r--r--ext/standard/cyr_convert.c299
-rw-r--r--ext/standard/cyr_convert.h29
-rw-r--r--ext/standard/datetime.c1070
-rw-r--r--ext/standard/datetime.h47
-rw-r--r--ext/standard/dir.c505
-rw-r--r--ext/standard/dl.c292
-rw-r--r--ext/standard/dl.h34
-rw-r--r--ext/standard/dns.c797
-rw-r--r--ext/standard/dns.h58
-rw-r--r--ext/standard/exec.c445
-rw-r--r--ext/standard/exec.h41
-rw-r--r--ext/standard/file.c2027
-rw-r--r--ext/standard/file.h125
-rw-r--r--ext/standard/filestat.c932
-rw-r--r--ext/standard/filters.c1755
-rw-r--r--ext/standard/flock_compat.c238
-rw-r--r--ext/standard/flock_compat.h55
-rw-r--r--ext/standard/formatted_print.c847
-rw-r--r--ext/standard/fsock.c137
-rw-r--r--ext/standard/fsock.h50
-rw-r--r--ext/standard/ftok.c67
-rw-r--r--ext/standard/ftp_fopen_wrapper.c777
-rw-r--r--ext/standard/head.c206
-rw-r--r--ext/standard/head.h32
-rw-r--r--ext/standard/html.c1197
-rw-r--r--ext/standard/html.h41
-rw-r--r--ext/standard/http_fopen_wrapper.c548
-rw-r--r--ext/standard/image.c1285
-rw-r--r--ext/standard/incomplete_class.c152
-rw-r--r--ext/standard/info.c1048
-rw-r--r--ext/standard/info.h86
-rw-r--r--ext/standard/iptc.c387
-rw-r--r--ext/standard/lcg.c138
-rw-r--r--ext/standard/levenshtein.c155
-rw-r--r--ext/standard/link.c227
-rw-r--r--ext/standard/mail.c282
-rw-r--r--ext/standard/math.c1150
-rw-r--r--ext/standard/md5.c446
-rw-r--r--ext/standard/md5.h65
-rw-r--r--ext/standard/metaphone.c478
-rw-r--r--ext/standard/microtime.c162
-rw-r--r--ext/standard/microtime.h32
-rw-r--r--ext/standard/pack.c918
-rw-r--r--ext/standard/pack.h28
-rw-r--r--ext/standard/pageinfo.c196
-rw-r--r--ext/standard/pageinfo.h35
-rw-r--r--ext/standard/parsedate.y1019
-rw-r--r--ext/standard/php_array.h106
-rw-r--r--ext/standard/php_assert.h32
-rw-r--r--ext/standard/php_browscap.h29
-rw-r--r--ext/standard/php_crypt.h39
-rw-r--r--ext/standard/php_dir.h40
-rw-r--r--ext/standard/php_ext_syslog.h39
-rw-r--r--ext/standard/php_filestat.h78
-rw-r--r--ext/standard/php_fopen_wrapper.c253
-rw-r--r--ext/standard/php_fopen_wrappers.h32
-rw-r--r--ext/standard/php_ftok.h28
-rw-r--r--ext/standard/php_image.h62
-rw-r--r--ext/standard/php_incomplete_class.h63
-rw-r--r--ext/standard/php_iptc.h27
-rw-r--r--ext/standard/php_lcg.h44
-rw-r--r--ext/standard/php_link.h33
-rw-r--r--ext/standard/php_mail.h34
-rw-r--r--ext/standard/php_math.h158
-rw-r--r--ext/standard/php_metaphone.h26
-rw-r--r--ext/standard/php_parsedate.h26
-rw-r--r--ext/standard/php_rand.h53
-rw-r--r--ext/standard/php_smart_str.h179
-rw-r--r--ext/standard/php_smart_str_public.h30
-rw-r--r--ext/standard/php_standard.h75
-rw-r--r--ext/standard/php_string.h147
-rw-r--r--ext/standard/php_sunfuncs.h42
-rw-r--r--ext/standard/php_type.h41
-rw-r--r--ext/standard/php_var.h69
-rw-r--r--ext/standard/php_versioning.h30
-rw-r--r--ext/standard/proc_open.c813
-rw-r--r--ext/standard/proc_open.h49
-rw-r--r--ext/standard/quot_print.c216
-rw-r--r--ext/standard/quot_print.h28
-rw-r--r--ext/standard/rand.c409
-rw-r--r--ext/standard/reg.c637
-rw-r--r--ext/standard/reg.h50
-rw-r--r--ext/standard/scanf.c1259
-rw-r--r--ext/standard/scanf.h49
-rw-r--r--ext/standard/sha1.c427
-rw-r--r--ext/standard/sha1.h40
-rw-r--r--ext/standard/soundex.c115
-rw-r--r--ext/standard/streamsfuncs.c1025
-rw-r--r--ext/standard/streamsfuncs.h57
-rw-r--r--ext/standard/string.c4637
-rw-r--r--ext/standard/strnatcmp.c175
-rw-r--r--ext/standard/sunfuncs.c242
-rw-r--r--ext/standard/syslog.c281
-rw-r--r--ext/standard/tests/aggregation/aggregate.lib65
-rw-r--r--ext/standard/tests/aggregation/aggregate.phpt19
-rw-r--r--ext/standard/tests/aggregation/aggregate_methods.phpt25
-rw-r--r--ext/standard/tests/aggregation/aggregate_methods_by_list.phpt22
-rw-r--r--ext/standard/tests/aggregation/aggregate_methods_by_regexp.phpt20
-rw-r--r--ext/standard/tests/aggregation/aggregate_properties.phpt19
-rw-r--r--ext/standard/tests/aggregation/aggregate_properties_by_list.phpt20
-rw-r--r--ext/standard/tests/aggregation/aggregate_properties_by_regexp.phpt22
-rw-r--r--ext/standard/tests/aggregation/aggregation_info.phpt31
-rw-r--r--ext/standard/tests/aggregation/deaggregate.phpt72
-rw-r--r--ext/standard/tests/array/001.phpt159
-rw-r--r--ext/standard/tests/array/002.phpt644
-rw-r--r--ext/standard/tests/array/003.phpt104
-rw-r--r--ext/standard/tests/array/004.phpt59
-rw-r--r--ext/standard/tests/array/005.phpt46
-rw-r--r--ext/standard/tests/array/006.phpt49
-rw-r--r--ext/standard/tests/array/007.phpt175
-rw-r--r--ext/standard/tests/array/008.phpt310
-rw-r--r--ext/standard/tests/array/array_change_key_case.phpt769
-rw-r--r--ext/standard/tests/array/array_chunk.phpt5326
-rw-r--r--ext/standard/tests/array/array_count_values.phpt95
-rw-r--r--ext/standard/tests/array/array_search.phpt23
-rw-r--r--ext/standard/tests/array/bug12776.phpt25
-rw-r--r--ext/standard/tests/array/bug20381.phpt79
-rw-r--r--ext/standard/tests/array/bug20865.phpt11
-rw-r--r--ext/standard/tests/array/bug21182.phpt12
-rw-r--r--ext/standard/tests/array/bug21998.phpt24
-rw-r--r--ext/standard/tests/array/bug22088.phpt33
-rw-r--r--ext/standard/tests/array/bug22463.phpt29
-rw-r--r--ext/standard/tests/array/bug23581.phpt44
-rw-r--r--ext/standard/tests/array/count_recursive.phpt52
-rw-r--r--ext/standard/tests/array/data.inc13
-rw-r--r--ext/standard/tests/array/range.phpt1345
-rw-r--r--ext/standard/tests/array/var_export.phpt11
-rw-r--r--ext/standard/tests/assert/assert.phpt39
-rw-r--r--ext/standard/tests/file/001-win32.phpt127
-rw-r--r--ext/standard/tests/file/001.phpt148
-rw-r--r--ext/standard/tests/file/002.phpt54
-rw-r--r--ext/standard/tests/file/003.phpt43
-rw-r--r--ext/standard/tests/file/bug12556.phpt50
-rw-r--r--ext/standard/tests/file/bug20424.phpt12
-rw-r--r--ext/standard/tests/file/bug22382.phpt27
-rw-r--r--ext/standard/tests/file/bug22414.phpt38
-rw-r--r--ext/standard/tests/file/fopencookie.phpt86
-rw-r--r--ext/standard/tests/file/test.csv17
-rw-r--r--ext/standard/tests/file/test2.csv1
-rw-r--r--ext/standard/tests/file/userfilters.phpt37
-rw-r--r--ext/standard/tests/file/userstreams.phpt325
-rw-r--r--ext/standard/tests/filters/basic.phpt44
-rw-r--r--ext/standard/tests/filters/bug22538.phpt44
-rw-r--r--ext/standard/tests/general_functions/001.phpt69
-rw-r--r--ext/standard/tests/general_functions/002.phpt13
-rw-r--r--ext/standard/tests/general_functions/003.phpt60
-rw-r--r--ext/standard/tests/general_functions/004.data4
-rw-r--r--ext/standard/tests/general_functions/004.phpt18
-rw-r--r--ext/standard/tests/general_functions/005.phpt26
-rw-r--r--ext/standard/tests/general_functions/006.phpt13
-rw-r--r--ext/standard/tests/general_functions/007.phpt26
-rw-r--r--ext/standard/tests/general_functions/008.phpt40
-rw-r--r--ext/standard/tests/general_functions/009.phpt26
-rw-r--r--ext/standard/tests/general_functions/getopt.phpt30
-rw-r--r--ext/standard/tests/general_functions/proc_open.phpt30
-rw-r--r--ext/standard/tests/general_functions/sunfuncts.phpt44
-rw-r--r--ext/standard/tests/image/246x247.pngbin360 -> 0 bytes
-rw-r--r--ext/standard/tests/image/384x385.pngbin267 -> 0 bytes
-rw-r--r--ext/standard/tests/image/bug13213.jpgbin596 -> 0 bytes
-rw-r--r--ext/standard/tests/image/bug13213.phpt23
-rw-r--r--ext/standard/tests/image/getimagesize.phpt196
-rw-r--r--ext/standard/tests/image/getimagesize_246x247.phpt42
-rw-r--r--ext/standard/tests/image/getimagesize_384x385.phpt42
-rw-r--r--ext/standard/tests/image/getimagesize_swc.phpt25
-rw-r--r--ext/standard/tests/image/image_type_to_mime_type.phpt51
-rw-r--r--ext/standard/tests/image/skipif_imagetype.inc15
-rwxr-xr-xext/standard/tests/image/test13pix.swfbin589 -> 0 bytes
-rw-r--r--ext/standard/tests/image/test1pix.bmpbin58 -> 0 bytes
-rw-r--r--ext/standard/tests/image/test1pix.jp2bin243 -> 0 bytes
-rw-r--r--ext/standard/tests/image/test1pix.jpcbin127 -> 0 bytes
-rw-r--r--ext/standard/tests/image/test1pix.jpgbin523 -> 0 bytes
-rw-r--r--ext/standard/tests/image/test2pix.gifbin35 -> 0 bytes
-rw-r--r--ext/standard/tests/image/test4pix.gifbin42 -> 0 bytes
-rw-r--r--ext/standard/tests/image/test4pix.iffbin114 -> 0 bytes
-rw-r--r--ext/standard/tests/image/test4pix.pngbin148 -> 0 bytes
-rw-r--r--ext/standard/tests/image/test4pix.psdbin1247 -> 0 bytes
-rwxr-xr-xext/standard/tests/image/test4pix.swfbin609 -> 0 bytes
-rw-r--r--ext/standard/tests/image/test4pix.tifbin312 -> 0 bytes
-rw-r--r--ext/standard/tests/math/abs.phpt26
-rw-r--r--ext/standard/tests/math/bug21523.phpt11
-rw-r--r--ext/standard/tests/math/floorceil.phpt46
-rw-r--r--ext/standard/tests/math/hexdec.phpt22
-rw-r--r--ext/standard/tests/math/log.phpt44
-rw-r--r--ext/standard/tests/math/pow.phpt151
-rw-r--r--ext/standard/tests/math/round.phpt39
-rw-r--r--ext/standard/tests/network/bug20134.phpt24
-rw-r--r--ext/standard/tests/reg/001.phpt9
-rw-r--r--ext/standard/tests/reg/002.phpt9
-rw-r--r--ext/standard/tests/reg/003.phpt10
-rw-r--r--ext/standard/tests/reg/004.phpt16
-rw-r--r--ext/standard/tests/reg/005.phpt20
-rw-r--r--ext/standard/tests/reg/006.phpt10
-rw-r--r--ext/standard/tests/reg/007.phpt12
-rw-r--r--ext/standard/tests/reg/008.phpt10
-rw-r--r--ext/standard/tests/reg/009.phpt19
-rw-r--r--ext/standard/tests/reg/010.phpt9
-rw-r--r--ext/standard/tests/reg/011.phpt9
-rw-r--r--ext/standard/tests/reg/012.phpt9
-rw-r--r--ext/standard/tests/reg/013.phpt9
-rw-r--r--ext/standard/tests/reg/014.phpt9
-rw-r--r--ext/standard/tests/reg/015.phpt8
-rw-r--r--ext/standard/tests/reg/016.phpt8
-rw-r--r--ext/standard/tests/serialize/001.phpt117
-rw-r--r--ext/standard/tests/serialize/003.phpt24
-rw-r--r--ext/standard/tests/serialize/bug14293.phpt34
-rw-r--r--ext/standard/tests/serialize/bug23298.phpt13
-rw-r--r--ext/standard/tests/strings/004.phpt84
-rw-r--r--ext/standard/tests/strings/add-and-stripcslashes.phpt28
-rw-r--r--ext/standard/tests/strings/add-and-stripslashes.phpt32
-rw-r--r--ext/standard/tests/strings/basename.phptbin1165 -> 0 bytes
-rw-r--r--ext/standard/tests/strings/bin2hex.phpt16
-rw-r--r--ext/standard/tests/strings/bug20108.phpt12
-rw-r--r--ext/standard/tests/strings/bug20169.phpt14
-rw-r--r--ext/standard/tests/strings/bug20261.phpt26
-rw-r--r--ext/standard/tests/strings/bug20927.phpt18
-rw-r--r--ext/standard/tests/strings/bug20934.phpt17
-rw-r--r--ext/standard/tests/strings/bug21338.phpt10
-rw-r--r--ext/standard/tests/strings/bug21453.phpt18
-rw-r--r--ext/standard/tests/strings/bug21730.phpt35
-rw-r--r--ext/standard/tests/strings/bug21744.phpt15
-rw-r--r--ext/standard/tests/strings/bug22008.phpt24
-rw-r--r--ext/standard/tests/strings/bug22187.phpt10
-rw-r--r--ext/standard/tests/strings/bug22207.phpt11
-rw-r--r--ext/standard/tests/strings/bug22224.phpt26
-rw-r--r--ext/standard/tests/strings/bug22227.phpt9
-rw-r--r--ext/standard/tests/strings/bug22904.phpt30
-rw-r--r--ext/standard/tests/strings/chr_ord.phpt12
-rw-r--r--ext/standard/tests/strings/chunk_split.phpt19
-rw-r--r--ext/standard/tests/strings/count_chars.phpt20
-rw-r--r--ext/standard/tests/strings/crc32.phpt16
-rw-r--r--ext/standard/tests/strings/crypt.phpt26
-rw-r--r--ext/standard/tests/strings/explode.phpt116
-rw-r--r--ext/standard/tests/strings/htmlentities.phpt19
-rw-r--r--ext/standard/tests/strings/htmlentities01.phpt13
-rw-r--r--ext/standard/tests/strings/htmlentities02.phpt20
-rw-r--r--ext/standard/tests/strings/htmlentities03.phpt20
-rw-r--r--ext/standard/tests/strings/htmlentities04.phpt20
-rw-r--r--ext/standard/tests/strings/htmlentities05.phpt25
-rw-r--r--ext/standard/tests/strings/htmlentities06.phpt22
-rw-r--r--ext/standard/tests/strings/htmlentities07.phpt23
-rw-r--r--ext/standard/tests/strings/htmlentities08.phpt23
-rw-r--r--ext/standard/tests/strings/htmlentities09.phpt23
-rw-r--r--ext/standard/tests/strings/htmlentities10.phpt16
-rw-r--r--ext/standard/tests/strings/htmlentities11.phpt14
-rw-r--r--ext/standard/tests/strings/htmlentities12.phpt14
-rw-r--r--ext/standard/tests/strings/htmlentities13.phpt14
-rw-r--r--ext/standard/tests/strings/htmlentities14.phpt14
-rw-r--r--ext/standard/tests/strings/htmlentities15.phpt22
-rw-r--r--ext/standard/tests/strings/htmlentities16.phpt21
-rw-r--r--ext/standard/tests/strings/implode.phpt25
-rw-r--r--ext/standard/tests/strings/md5.phpt20
-rw-r--r--ext/standard/tests/strings/md5raw.phpt20
-rw-r--r--ext/standard/tests/strings/nl2br.phpt62
-rw-r--r--ext/standard/tests/strings/sha1.phpt14
-rw-r--r--ext/standard/tests/strings/sha1raw.phpt14
-rw-r--r--ext/standard/tests/strings/str_repeat.phpt29
-rw-r--r--ext/standard/tests/strings/str_shuffle.phpt12
-rw-r--r--ext/standard/tests/strings/strcspn.phpt18
-rw-r--r--ext/standard/tests/strings/strings001.phpt12
-rw-r--r--ext/standard/tests/strings/strip_tags.phpt29
-rw-r--r--ext/standard/tests/strings/strpos.phpt32
-rw-r--r--ext/standard/tests/strings/strrev.phpt21
-rw-r--r--ext/standard/tests/strings/strripos.phpt35
-rw-r--r--ext/standard/tests/strings/strrpos.phpt34
-rw-r--r--ext/standard/tests/strings/strspn.phpt18
-rw-r--r--ext/standard/tests/strings/strstr.phpt32
-rw-r--r--ext/standard/tests/strings/strtoupper.phpt20
-rw-r--r--ext/standard/tests/strings/strtr.phpt10
-rw-r--r--ext/standard/tests/strings/substr_count.phpt26
-rw-r--r--ext/standard/tests/strings/substr_replace.phpt812
-rw-r--r--ext/standard/tests/strings/trim.phpt29
-rw-r--r--ext/standard/tests/strings/url_t.phpt618
-rw-r--r--ext/standard/tests/strings/wordwrap.phpt37
-rw-r--r--ext/standard/tests/time/001.phpt31
-rw-r--r--ext/standard/tests/time/002-win32.phpt66
-rw-r--r--ext/standard/tests/time/002.phpt69
-rw-r--r--ext/standard/tests/time/003.phpt44
-rw-r--r--ext/standard/tests/time/idate.phpt32
-rw-r--r--ext/standard/tests/time/mktime.phpt49
-rw-r--r--ext/standard/tests/versioning/version_compare.phpt600
-rw-r--r--ext/standard/type.c378
-rw-r--r--ext/standard/uniqid.c97
-rw-r--r--ext/standard/uniqid.h28
-rw-r--r--ext/standard/url.c630
-rw-r--r--ext/standard/url.h55
-rw-r--r--ext/standard/url_scanner.c384
-rw-r--r--ext/standard/url_scanner.h54
-rw-r--r--ext/standard/url_scanner_ex.c1018
-rw-r--r--ext/standard/url_scanner_ex.h65
-rw-r--r--ext/standard/url_scanner_ex.re517
-rw-r--r--ext/standard/user_filters.c514
-rw-r--r--ext/standard/var.c720
-rw-r--r--ext/standard/var_unserializer.c807
-rw-r--r--ext/standard/var_unserializer.re435
-rw-r--r--ext/standard/versioning.c255
-rw-r--r--ext/swf/CREDITS2
-rw-r--r--ext/swf/config.m435
-rw-r--r--ext/swf/php_swf.h119
-rw-r--r--ext/swf/swf.c1263
-rw-r--r--ext/sybase/CREDITS2
-rw-r--r--ext/sybase/config.m430
-rw-r--r--ext/sybase/php_sybase_db.c1409
-rw-r--r--ext/sybase/php_sybase_db.h89
-rw-r--r--ext/sybase_ct/CREDITS2
-rw-r--r--ext/sybase_ct/config.m456
-rw-r--r--ext/sybase_ct/php_sybase_ct.c2083
-rw-r--r--ext/sybase_ct/php_sybase_ct.h129
-rw-r--r--ext/sybase_ct/sybase_ct.dsp114
-rw-r--r--ext/sysvmsg/CREDITS2
-rw-r--r--ext/sysvmsg/EXPERIMENTAL0
-rw-r--r--ext/sysvmsg/config.m49
-rw-r--r--ext/sysvmsg/php_sysvmsg.h76
-rw-r--r--ext/sysvmsg/sysvmsg.c403
-rw-r--r--ext/sysvmsg/tests/001.phpt24
-rw-r--r--ext/sysvsem/CREDITS2
-rw-r--r--ext/sysvsem/config.m429
-rw-r--r--ext/sysvsem/php_sysvsem.h57
-rw-r--r--ext/sysvsem/sysvsem.c407
-rw-r--r--ext/sysvsem/tests/sysv.phpt114
-rw-r--r--ext/sysvshm/CREDITS2
-rw-r--r--ext/sysvshm/config.m411
-rw-r--r--ext/sysvshm/php_sysvshm.h81
-rw-r--r--ext/sysvshm/sysvshm.c434
-rw-r--r--ext/tokenizer/CREDITS2
-rw-r--r--ext/tokenizer/Makefile.frag1
-rw-r--r--ext/tokenizer/config.m412
-rw-r--r--ext/tokenizer/php_tokenizer.h60
-rw-r--r--ext/tokenizer/tokenizer.c552
-rw-r--r--ext/tokenizer/tokenizer.dsp108
-rw-r--r--ext/tokenizer/tokenizer.php35
-rw-r--r--ext/w32api/CREDITS2
-rw-r--r--ext/w32api/EXPERIMENTAL0
-rw-r--r--ext/w32api/README5
-rw-r--r--ext/w32api/TODO3
-rw-r--r--ext/w32api/php_w32api.h345
-rw-r--r--ext/w32api/w32api.c2286
-rw-r--r--ext/w32api/w32api.dsp281
-rw-r--r--ext/w32api/w32api_function_definition_parser.y67
-rw-r--r--ext/w32api/w32api_function_definition_scanner.l63
-rw-r--r--ext/w32api/w32api_type_definition_parser.y67
-rw-r--r--ext/w32api/w32api_type_definition_scanner.l56
-rw-r--r--ext/wddx/CREDITS2
-rw-r--r--ext/wddx/config.m415
-rw-r--r--ext/wddx/php_wddx.h46
-rw-r--r--ext/wddx/php_wddx_api.h66
-rw-r--r--ext/wddx/wddx.c1290
-rw-r--r--ext/xml/CREDITS2
-rw-r--r--ext/xml/compat.c525
-rw-r--r--ext/xml/config.m416
-rw-r--r--ext/xml/expat_compat.h147
-rw-r--r--ext/xml/php_xml.h146
-rw-r--r--ext/xml/tests/inc.ent1
-rw-r--r--ext/xml/tests/skipif.inc10
-rw-r--r--ext/xml/tests/xml001.phpt96
-rw-r--r--ext/xml/tests/xml002.phpt97
-rw-r--r--ext/xml/tests/xml003.phpt95
-rw-r--r--ext/xml/tests/xml004.phpt64
-rw-r--r--ext/xml/tests/xml006.phpt12
-rw-r--r--ext/xml/tests/xml007.phpt53
-rw-r--r--ext/xml/tests/xmltest.xml20
-rw-r--r--ext/xml/xml.c1599
-rw-r--r--ext/xml/xml.mak172
-rw-r--r--ext/xmlrpc/CREDITS2
-rw-r--r--ext/xmlrpc/EXPERIMENTAL5
-rw-r--r--ext/xmlrpc/config.m493
-rw-r--r--ext/xmlrpc/libxmlrpc/README17
-rw-r--r--ext/xmlrpc/libxmlrpc/acinclude.m432
-rw-r--r--ext/xmlrpc/libxmlrpc/base64.c192
-rw-r--r--ext/xmlrpc/libxmlrpc/base64.h38
-rw-r--r--ext/xmlrpc/libxmlrpc/encodings.c119
-rw-r--r--ext/xmlrpc/libxmlrpc/encodings.h46
-rw-r--r--ext/xmlrpc/libxmlrpc/queue.c982
-rw-r--r--ext/xmlrpc/libxmlrpc/queue.h89
-rw-r--r--ext/xmlrpc/libxmlrpc/simplestring.c244
-rw-r--r--ext/xmlrpc/libxmlrpc/simplestring.h76
-rw-r--r--ext/xmlrpc/libxmlrpc/system_methods.c375
-rw-r--r--ext/xmlrpc/libxmlrpc/system_methods_private.h91
-rw-r--r--ext/xmlrpc/libxmlrpc/xml_element.c734
-rw-r--r--ext/xmlrpc/libxmlrpc/xml_element.h202
-rw-r--r--ext/xmlrpc/libxmlrpc/xml_to_dandarpc.c319
-rw-r--r--ext/xmlrpc/libxmlrpc/xml_to_dandarpc.h44
-rw-r--r--ext/xmlrpc/libxmlrpc/xml_to_soap.c673
-rw-r--r--ext/xmlrpc/libxmlrpc/xml_to_soap.h44
-rw-r--r--ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c409
-rw-r--r--ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.h45
-rw-r--r--ext/xmlrpc/libxmlrpc/xmlrpc.c2956
-rw-r--r--ext/xmlrpc/libxmlrpc/xmlrpc.h454
-rw-r--r--ext/xmlrpc/libxmlrpc/xmlrpc.m412
-rw-r--r--ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c598
-rw-r--r--ext/xmlrpc/libxmlrpc/xmlrpc_introspection.h101
-rw-r--r--ext/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h106
-rw-r--r--ext/xmlrpc/libxmlrpc/xmlrpc_private.h178
-rw-r--r--ext/xmlrpc/libxmlrpc/xmlrpc_win32.h11
-rw-r--r--ext/xmlrpc/php_xmlrpc.h120
-rw-r--r--ext/xmlrpc/xmlrpc-epi-php.c1485
-rw-r--r--ext/xmlrpc/xmlrpc.dsp211
-rw-r--r--ext/xslt/README.XSLT-BACKENDS285
-rw-r--r--ext/xslt/TODO31
-rw-r--r--ext/xslt/config.m4164
-rw-r--r--ext/xslt/php_sablot.h142
-rw-r--r--ext/xslt/php_xslt.h63
-rw-r--r--ext/xslt/sablot.c1821
-rwxr-xr-xext/xslt/tests/args.xsl10
-rw-r--r--ext/xslt/tests/bug17791.phpt15
-rw-r--r--ext/xslt/tests/bug17931.phpt32
-rw-r--r--ext/xslt/tests/bug20177.phpt34
-rw-r--r--ext/xslt/tests/bug20518.phpt33
-rw-r--r--ext/xslt/tests/param.xsl15
-rwxr-xr-xext/xslt/tests/public.xml5
-rwxr-xr-xext/xslt/tests/qa.dtd7
-rw-r--r--ext/xslt/tests/skipif.inc5
-rw-r--r--ext/xslt/tests/test.xml5
-rw-r--r--ext/xslt/tests/xslt-001.phpt21
-rw-r--r--ext/xslt/tests/xslt.phpt12
-rw-r--r--ext/xslt/tests/xslt_backend_info.phpt49
-rw-r--r--ext/xslt/tests/xslt_getopt.phpt37
-rw-r--r--ext/xslt/tests/xslt_process-001.phpt62
-rw-r--r--ext/xslt/tests/xslt_process-002.phpt74
-rw-r--r--ext/xslt/tests/xslt_set_object.phpt89
-rw-r--r--ext/xslt/tests/xslt_set_object.xsl3
-rw-r--r--ext/xslt/tests/xslt_set_scheme_handlers-001.phpt20
-rw-r--r--ext/xslt/tests/xslt_set_scheme_handlers-002.phpt57
-rw-r--r--ext/xslt/tests/xslt_set_scheme_handlers-003.phpt47
-rw-r--r--ext/xslt/tests/xslt_setopt.phpt60
-rw-r--r--ext/xslt/xslt.c276
-rw-r--r--ext/xslt/xslt.dsp115
-rw-r--r--ext/yaz/CREDITS2
-rw-r--r--ext/yaz/README5
-rw-r--r--ext/yaz/config.m453
-rw-r--r--ext/yaz/php_yaz.c1599
-rw-r--r--ext/yaz/php_yaz.h76
-rw-r--r--ext/yaz/yaz.dsp111
-rw-r--r--ext/yp/CREDITS2
-rw-r--r--ext/yp/config.m438
-rw-r--r--ext/yp/php_yp.h69
-rw-r--r--ext/yp/yp.c430
-rw-r--r--ext/zip/CREDITS2
-rw-r--r--ext/zip/config.m439
-rw-r--r--ext/zip/php_zip.h70
-rw-r--r--ext/zip/tests/001.phpt23
-rw-r--r--ext/zip/zip.c331
-rw-r--r--ext/zip/zip.dsp108
-rw-r--r--ext/zlib/CREDITS2
-rw-r--r--ext/zlib/config0.m453
-rw-r--r--ext/zlib/php_zlib.h83
-rw-r--r--ext/zlib/tests/001.phpt26
-rw-r--r--ext/zlib/tests/002.phpt17
-rw-r--r--ext/zlib/tests/003.phpt16
-rw-r--r--ext/zlib/tests/gzreadgzwrite.phpt33
-rw-r--r--ext/zlib/tests/gzreadgzwriteplain.phpt47
-rw-r--r--ext/zlib/zlib.c1087
-rw-r--r--ext/zlib/zlib.dsp117
-rw-r--r--ext/zlib/zlib_fopen_wrapper.c181
-rw-r--r--ext/zlib/zlib_win32_howto.txt16
-rw-r--r--footer9
-rwxr-xr-xgenfiles14
-rw-r--r--header19
-rw-r--r--ltmain.sh5062
-rw-r--r--main/SAPI.c909
-rw-r--r--main/SAPI.h291
-rw-r--r--main/alloca.c501
-rw-r--r--main/build-defs.h.in91
-rw-r--r--main/config.nw.h316
-rw-r--r--main/config.w32.h177
-rw-r--r--main/fopen_wrappers.c570
-rw-r--r--main/fopen_wrappers.h47
-rw-r--r--main/internal_functions.c.in56
-rw-r--r--main/internal_functions_nw.c102
-rw-r--r--main/internal_functions_registry.h37
-rw-r--r--main/internal_functions_win32.c166
-rw-r--r--main/logos.h1544
-rw-r--r--main/main.c1819
-rw-r--r--main/mergesort.c363
-rw-r--r--main/network.c949
-rw-r--r--main/output.c1059
-rw-r--r--main/php.h434
-rw-r--r--main/php3_compat.h122
-rw-r--r--main/php_compat.h129
-rw-r--r--main/php_content_types.c92
-rw-r--r--main/php_content_types.h30
-rw-r--r--main/php_globals.h160
-rw-r--r--main/php_ini.c585
-rw-r--r--main/php_ini.h76
-rw-r--r--main/php_logos.c100
-rw-r--r--main/php_logos.h31
-rw-r--r--main/php_main.h56
-rw-r--r--main/php_memory_streams.h64
-rw-r--r--main/php_network.h194
-rw-r--r--main/php_open_temporary_file.c264
-rw-r--r--main/php_open_temporary_file.h27
-rw-r--r--main/php_output.h109
-rw-r--r--main/php_realpath.c283
-rw-r--r--main/php_reentrancy.h129
-rw-r--r--main/php_regex.h65
-rw-r--r--main/php_scandir.c137
-rw-r--r--main/php_scandir.h50
-rw-r--r--main/php_sprintf.c55
-rwxr-xr-xmain/php_streams.h495
-rw-r--r--main/php_syslog.h57
-rw-r--r--main/php_ticks.c81
-rw-r--r--main/php_ticks.h37
-rw-r--r--main/php_variables.c737
-rw-r--r--main/php_variables.h46
-rw-r--r--main/php_version.h7
-rw-r--r--main/reentrancy.c504
-rw-r--r--main/rfc1867.c1073
-rw-r--r--main/rfc1867.h33
-rw-r--r--main/safe_mode.c229
-rw-r--r--main/safe_mode.h39
-rw-r--r--main/snprintf.c965
-rw-r--r--main/snprintf.h114
-rw-r--r--main/spprintf.c561
-rw-r--r--main/spprintf.h52
-rw-r--r--main/streams/cast.c354
-rw-r--r--main/streams/filter.c332
-rw-r--r--main/streams/memory.c473
-rw-r--r--main/streams/mmap.c52
-rw-r--r--main/streams/php_stream_context.h109
-rw-r--r--main/streams/php_stream_filter_api.h143
-rw-r--r--main/streams/php_stream_mmap.h82
-rw-r--r--main/streams/php_stream_plain_wrapper.h61
-rw-r--r--main/streams/php_stream_transport.h161
-rw-r--r--main/streams/php_stream_userspace.h35
-rw-r--r--main/streams/php_streams_int.h61
-rw-r--r--main/streams/plain_wrapper.c1126
-rwxr-xr-xmain/streams/streams.c1671
-rw-r--r--main/streams/transports.c373
-rw-r--r--main/streams/userspace.c863
-rw-r--r--main/streams/xp_socket.c667
-rw-r--r--main/strlcat.c106
-rw-r--r--main/strlcpy.c103
-rw-r--r--main/win95nt.h82
-rwxr-xr-xmakedist142
-rw-r--r--makerpm156
-rw-r--r--netware/ApacheCore.imp365
-rwxr-xr-xnetware/BisonExtStandard.bat3
-rwxr-xr-xnetware/BisonFlexZend.bat8
-rw-r--r--netware/ZendEngine2.mak160
-rwxr-xr-xnetware/build.bat21
-rwxr-xr-xnetware/buildext.bat18
-rwxr-xr-xnetware/buildlib.bat20
-rwxr-xr-xnetware/buildsapi.bat18
-rw-r--r--netware/common.mif90
-rw-r--r--netware/geterrnoptr.c9
-rw-r--r--netware/grp.h31
-rw-r--r--netware/libpq-fe.h378
-rw-r--r--netware/libpq.imp93
-rw-r--r--netware/libpq/libpq-fs.h24
-rw-r--r--netware/mktemp.c87
-rw-r--r--netware/mktemp.h1
-rw-r--r--netware/param.h20
-rwxr-xr-xnetware/php-nw.bat10
-rw-r--r--netware/php4apache.mak165
-rw-r--r--netware/php4apache2filter.mak166
-rw-r--r--netware/php4cli.mak163
-rw-r--r--netware/phplib.imp177
-rw-r--r--netware/phplib.mak404
-rw-r--r--netware/phptest.ncf1
-rw-r--r--netware/pipe.c329
-rw-r--r--netware/pipe.h11
-rw-r--r--netware/postgres_ext.h45
-rw-r--r--netware/pwd.c86
-rw-r--r--netware/pwd.h54
-rw-r--r--netware/sendmail_nw.h17
-rwxr-xr-xnetware/setbuild.bat19
-rw-r--r--netware/start.c119
-rw-r--r--netware/sys/stat.h147
-rw-r--r--netware/sysexits.h114
-rw-r--r--netware/time_nw.c246
-rw-r--r--netware/time_nw.h57
-rw-r--r--netware/tsrm.mak109
-rw-r--r--netware/wfile.c17
-rw-r--r--netware/wfile.h16
-rw-r--r--netware/zend.mak158
-rw-r--r--pear/Archive/Tar.php1301
-rw-r--r--pear/Archive/docs/Tar.txt424
-rwxr-xr-xpear/CMD.php285
-rw-r--r--pear/CODING_STANDARDS8
-rw-r--r--pear/Console/Getopt.php225
-rw-r--r--pear/Console/tests/001-getopt.phpt68
-rw-r--r--pear/Makefile.frag22
-rw-r--r--pear/OS/Guess.php265
-rw-r--r--pear/PEAR.php962
-rw-r--r--pear/PEAR/Autoloader.php186
-rw-r--r--pear/PEAR/Builder.php383
-rw-r--r--pear/PEAR/Command.php322
-rw-r--r--pear/PEAR/Command/Auth.php155
-rw-r--r--pear/PEAR/Command/Build.php89
-rw-r--r--pear/PEAR/Command/Common.php249
-rw-r--r--pear/PEAR/Command/Config.php225
-rw-r--r--pear/PEAR/Command/Install.php302
-rw-r--r--pear/PEAR/Command/Mirror.php99
-rw-r--r--pear/PEAR/Command/Package.php660
-rw-r--r--pear/PEAR/Command/Registry.php319
-rw-r--r--pear/PEAR/Command/Remote.php407
-rw-r--r--pear/PEAR/Common.php1674
-rw-r--r--pear/PEAR/Config.php1139
-rw-r--r--pear/PEAR/Dependency.php329
-rw-r--r--pear/PEAR/Frontend/CLI.php487
-rw-r--r--pear/PEAR/Installer.php874
-rw-r--r--pear/PEAR/Packager.php176
-rw-r--r--pear/PEAR/Registry.php690
-rw-r--r--pear/PEAR/Remote.php367
-rw-r--r--pear/README18
-rw-r--r--pear/System.php449
-rw-r--r--pear/catalog1
-rw-r--r--pear/docs/Archive_Tar.txt424
-rw-r--r--pear/install-pear.php109
-rw-r--r--pear/install-pear.txt11
-rw-r--r--pear/package-Archive_Tar.xml60
-rw-r--r--pear/package-Console_Getopt.xml63
-rw-r--r--pear/package-PEAR.xml342
-rw-r--r--pear/package.dtd109
-rw-r--r--pear/packages/DB-1.3.tarbin387072 -> 0 bytes
-rw-r--r--pear/packages/HTTP-1.2.tarbin12288 -> 0 bytes
-rw-r--r--pear/packages/Mail-1.0.1.tarbin59904 -> 0 bytes
-rw-r--r--pear/packages/Net_SMTP-1.0.tarbin17408 -> 0 bytes
-rw-r--r--pear/packages/Net_Socket-1.0.1.tarbin15872 -> 0 bytes
-rw-r--r--pear/packages/XML_Parser-1.0.1.tarbin26112 -> 0 bytes
-rw-r--r--pear/packages/XML_RPC-1.0.4.tarbin49664 -> 0 bytes
-rwxr-xr-xpear/scripts/pear.bat69
-rw-r--r--pear/scripts/pear.sh28
-rw-r--r--pear/scripts/pearcmd.php295
-rw-r--r--pear/scripts/pearwin.php233
-rw-r--r--pear/template.spec44
-rw-r--r--pear/tests/merge.input1
-rw-r--r--pear/tests/pear1.phpt88
-rw-r--r--pear/tests/pear_autoloader.phpt81
-rw-r--r--pear/tests/pear_config.phpt289
-rw-r--r--pear/tests/pear_error.phpt154
-rw-r--r--pear/tests/pear_error2.phpt25
-rw-r--r--pear/tests/pear_error3.phpt54
-rw-r--r--pear/tests/pear_error4.phpt104
-rw-r--r--pear/tests/pear_registry.phpt168
-rw-r--r--pear/tests/pear_system.phpt101
-rw-r--r--pear/tests/php.ini2
-rw-r--r--pear/tests/system.input1
-rw-r--r--pear/tests/toonew.conf2
-rw-r--r--pear/tests/user.input0
-rw-r--r--pear/tests/user2.input1
-rw-r--r--php.gifbin3872 -> 0 bytes
-rw-r--r--php.ini-dist1126
-rw-r--r--php.ini-recommended1135
-rw-r--r--php4.spec.in48
-rw-r--r--regex/COPYRIGHT20
-rw-r--r--regex/README32
-rw-r--r--regex/WHATSNEW92
-rw-r--r--regex/cclass.h30
-rw-r--r--regex/cname.h102
-rw-r--r--regex/debug.c242
-rw-r--r--regex/debug.ih14
-rw-r--r--regex/engine.c1019
-rw-r--r--regex/engine.ih35
-rw-r--r--regex/main.c510
-rw-r--r--regex/main.ih19
-rw-r--r--regex/mkh76
-rw-r--r--regex/regcomp.c1608
-rw-r--r--regex/regcomp.ih53
-rw-r--r--regex/regerror.c126
-rw-r--r--regex/regerror.ih12
-rw-r--r--regex/regex.3502
-rw-r--r--regex/regex.7233
-rw-r--r--regex/regex.dsp106
-rw-r--r--regex/regex.dsw29
-rw-r--r--regex/regex.h83
-rw-r--r--regex/regex.mak304
-rw-r--r--regex/regex2.h140
-rw-r--r--regex/regex_extra.h23
-rw-r--r--regex/regexec.c138
-rw-r--r--regex/regfree.c37
-rw-r--r--regex/split.c316
-rw-r--r--regex/tests475
-rw-r--r--regex/utils.h25
-rw-r--r--run-tests-config.php74
-rwxr-xr-xrun-tests.php925
-rw-r--r--run-tests2.php1573
-rw-r--r--sapi/activescript/CREDITS2
-rw-r--r--sapi/activescript/EXPERIMENTAL5
-rw-r--r--sapi/activescript/README56
-rw-r--r--sapi/activescript/classfactory.cpp362
-rw-r--r--sapi/activescript/php4activescript.c152
-rw-r--r--sapi/activescript/php4activescript.def5
-rw-r--r--sapi/activescript/php4activescript.dsp185
-rw-r--r--sapi/activescript/php4activescript.h25
-rw-r--r--sapi/activescript/php4as_classfactory.h52
-rw-r--r--sapi/activescript/php4as_scriptengine.h235
-rw-r--r--sapi/activescript/scriptengine.cpp1877
-rw-r--r--sapi/aolserver/CREDITS2
-rw-r--r--sapi/aolserver/README69
-rw-r--r--sapi/aolserver/aolserver.c616
-rw-r--r--sapi/aolserver/config.m433
-rw-r--r--sapi/aolserver/php.sym2
-rw-r--r--sapi/aolserver/php4aolserver.dsp135
-rw-r--r--sapi/apache/CREDITS3
-rw-r--r--sapi/apache/apMakefile.libdir4
-rw-r--r--sapi/apache/apMakefile.tmpl77
-rw-r--r--sapi/apache/config.m4272
-rw-r--r--sapi/apache/libphp5.module.in11
-rw-r--r--sapi/apache/libpre.c55
-rw-r--r--sapi/apache/mod_php5.c966
-rw-r--r--sapi/apache/mod_php5.exp1
-rw-r--r--sapi/apache/mod_php5.h54
-rw-r--r--sapi/apache/php.sym1
-rw-r--r--sapi/apache/php4apache.dsp151
-rw-r--r--sapi/apache/php_apache.c543
-rw-r--r--sapi/apache/php_apache_http.h66
-rw-r--r--sapi/apache/sapi_apache.c75
-rw-r--r--sapi/apache2filter/CREDITS2
-rw-r--r--sapi/apache2filter/EXPERIMENTAL5
-rw-r--r--sapi/apache2filter/README71
-rw-r--r--sapi/apache2filter/apache_config.c230
-rw-r--r--sapi/apache2filter/config.m4118
-rw-r--r--sapi/apache2filter/php.sym1
-rw-r--r--sapi/apache2filter/php_apache.h72
-rw-r--r--sapi/apache2filter/php_functions.c393
-rw-r--r--sapi/apache2filter/sapi_apache2.c698
-rw-r--r--sapi/apache2handler/CREDITS2
-rw-r--r--sapi/apache2handler/EXPERIMENTAL5
-rw-r--r--sapi/apache2handler/README76
-rw-r--r--sapi/apache2handler/apache_config.c212
-rw-r--r--sapi/apache2handler/config.m4118
-rw-r--r--sapi/apache2handler/php.sym1
-rw-r--r--sapi/apache2handler/php4apache2.dsp142
-rw-r--r--sapi/apache2handler/php_apache.h83
-rw-r--r--sapi/apache2handler/php_functions.c516
-rw-r--r--sapi/apache2handler/sapi_apache2.c585
-rw-r--r--sapi/apache_hooks/CREDITS2
-rw-r--r--sapi/apache_hooks/README206
-rw-r--r--sapi/apache_hooks/apMakefile.libdir4
-rw-r--r--sapi/apache_hooks/apMakefile.tmpl77
-rw-r--r--sapi/apache_hooks/config.m4242
-rw-r--r--sapi/apache_hooks/libphp4.module.in11
-rw-r--r--sapi/apache_hooks/mod_php4.c1474
-rw-r--r--sapi/apache_hooks/mod_php4.exp1
-rw-r--r--sapi/apache_hooks/mod_php4.h81
-rw-r--r--sapi/apache_hooks/php.sym1
-rwxr-xr-xsapi/apache_hooks/php4apache_hooks.dsp151
-rw-r--r--sapi/apache_hooks/php_apache.c1954
-rw-r--r--sapi/apache_hooks/php_apache_http.h44
-rw-r--r--sapi/apache_hooks/sapi_apache.c136
-rw-r--r--sapi/caudium/CREDITS2
-rw-r--r--sapi/caudium/README16
-rw-r--r--sapi/caudium/TODO30
-rw-r--r--sapi/caudium/caudium.c791
-rw-r--r--sapi/caudium/config.m499
-rw-r--r--sapi/cgi/CREDITS2
-rw-r--r--sapi/cgi/Makefile.frag2
-rw-r--r--sapi/cgi/README.FastCGI137
-rw-r--r--sapi/cgi/cgi_main.c1635
-rw-r--r--sapi/cgi/config9.m4171
-rw-r--r--sapi/cgi/getopt.c154
-rw-r--r--sapi/cgi/libfcgi/LICENSE.TERMS28
-rw-r--r--sapi/cgi/libfcgi/acinclude.m4389
-rw-r--r--sapi/cgi/libfcgi/fcgi_stdio.c801
-rw-r--r--sapi/cgi/libfcgi/fcgiapp.c2323
-rw-r--r--sapi/cgi/libfcgi/include/fastcgi.h136
-rw-r--r--sapi/cgi/libfcgi/include/fcgi_config.h7
-rw-r--r--sapi/cgi/libfcgi/include/fcgi_config_win32.h111
-rw-r--r--sapi/cgi/libfcgi/include/fcgi_config_x86.h103
-rw-r--r--sapi/cgi/libfcgi/include/fcgi_stdio.h249
-rw-r--r--sapi/cgi/libfcgi/include/fcgiapp.h640
-rw-r--r--sapi/cgi/libfcgi/include/fcgiappmisc.h50
-rw-r--r--sapi/cgi/libfcgi/include/fcgimisc.h38
-rw-r--r--sapi/cgi/libfcgi/include/fcgio.h147
-rw-r--r--sapi/cgi/libfcgi/include/fcgios.h140
-rw-r--r--sapi/cgi/libfcgi/libfcgi.m477
-rw-r--r--sapi/cgi/libfcgi/os_unix.c1268
-rw-r--r--sapi/cgi/libfcgi/os_win32.c2067
-rw-r--r--sapi/cgi/libfcgi/strerror.c91
-rw-r--r--sapi/cgi/php.sym0
-rw-r--r--sapi/cgi/php_getopt.h30
-rw-r--r--sapi/cli/CREDITS2
-rw-r--r--sapi/cli/Makefile.frag9
-rw-r--r--sapi/cli/README19
-rw-r--r--sapi/cli/TODO2
-rw-r--r--sapi/cli/config.m440
-rw-r--r--sapi/cli/getopt.c156
-rw-r--r--sapi/cli/php.1.in387
-rw-r--r--sapi/cli/php_cli.c1032
-rw-r--r--sapi/cli/php_getopt.h32
-rw-r--r--sapi/embed/CREDITS2
-rw-r--r--sapi/embed/EXPERIMENTAL5
-rw-r--r--sapi/embed/config.m432
-rw-r--r--sapi/embed/php4embed.dsp100
-rw-r--r--sapi/embed/php_embed.c225
-rw-r--r--sapi/embed/php_embed.h61
-rw-r--r--sapi/isapi/CREDITS2
-rw-r--r--sapi/isapi/config.m427
-rw-r--r--sapi/isapi/php.sym5
-rw-r--r--sapi/isapi/php4isapi.c949
-rw-r--r--sapi/isapi/php4isapi.def5
-rw-r--r--sapi/isapi/php4isapi.dsp165
-rw-r--r--sapi/isapi/stresstest/getopt.c175
-rw-r--r--sapi/isapi/stresstest/getopt.h12
-rw-r--r--sapi/isapi/stresstest/notes.txt56
-rw-r--r--sapi/isapi/stresstest/stresstest.cpp936
-rw-r--r--sapi/isapi/stresstest/stresstest.dsp108
-rw-r--r--sapi/milter/CREDITS2
-rw-r--r--sapi/milter/EXPERIMENTAL5
-rw-r--r--sapi/milter/Makefile.frag2
-rw-r--r--sapi/milter/TODO5
-rw-r--r--sapi/milter/config.m439
-rw-r--r--sapi/milter/getopt.c173
-rw-r--r--sapi/milter/milter.php132
-rw-r--r--sapi/milter/php_getopt.h7
-rw-r--r--sapi/milter/php_milter.c1139
-rw-r--r--sapi/milter/php_milter.h31
-rw-r--r--sapi/nsapi/CREDITS2
-rw-r--r--sapi/nsapi/config.m445
-rw-r--r--sapi/nsapi/nsapi-readme.txt79
-rw-r--r--sapi/nsapi/nsapi.c597
-rw-r--r--sapi/nsapi/php4nsapi.dsp135
-rw-r--r--sapi/phttpd/CREDITS2
-rw-r--r--sapi/phttpd/README5
-rw-r--r--sapi/phttpd/config.m425
-rw-r--r--sapi/phttpd/php.sym4
-rw-r--r--sapi/phttpd/php_phttpd.h24
-rw-r--r--sapi/phttpd/phttpd.c305
-rw-r--r--sapi/pi3web/CREDITS2
-rw-r--r--sapi/pi3web/README50
-rw-r--r--sapi/pi3web/config.m435
-rw-r--r--sapi/pi3web/php.sym0
-rw-r--r--sapi/pi3web/php4pi3web.dsp136
-rw-r--r--sapi/pi3web/pi3web_sapi.c480
-rw-r--r--sapi/pi3web/pi3web_sapi.h95
-rw-r--r--sapi/roxen/README18
-rw-r--r--sapi/roxen/TODO33
-rw-r--r--sapi/roxen/config.m460
-rw-r--r--sapi/roxen/roxen.c725
-rw-r--r--sapi/servlet/CREDITS2
-rw-r--r--sapi/servlet/EXPERIMENTAL5
-rw-r--r--sapi/servlet/Makefile.frag19
-rw-r--r--sapi/servlet/README113
-rw-r--r--sapi/servlet/config.m454
-rw-r--r--sapi/servlet/cookies.php41
-rw-r--r--sapi/servlet/date.php28
-rw-r--r--sapi/servlet/formatter.java31
-rw-r--r--sapi/servlet/jinfo.php5
-rw-r--r--sapi/servlet/jver.php17
-rw-r--r--sapi/servlet/reqheaders.php24
-rw-r--r--sapi/servlet/reqinfo.php29
-rw-r--r--sapi/servlet/reqparams.php35
-rw-r--r--sapi/servlet/servlet.c397
-rw-r--r--sapi/servlet/servlet.dsp286
-rw-r--r--sapi/servlet/servlet.java221
-rw-r--r--sapi/servlet/sessions.php60
-rw-r--r--sapi/servlet/web.xml40
-rw-r--r--sapi/tests/test001.phpt17
-rw-r--r--sapi/tests/test002.phpt23
-rw-r--r--sapi/tests/test003.phpt22
-rw-r--r--sapi/tests/test004.phpt27
-rw-r--r--sapi/tests/test005.phpt28
-rw-r--r--sapi/tests/test006.phpt75
-rw-r--r--sapi/tests/test007.phpt48
-rw-r--r--sapi/thttpd/CREDITS2
-rw-r--r--sapi/thttpd/README85
-rw-r--r--sapi/thttpd/config.m439
-rw-r--r--sapi/thttpd/php.sym3
-rw-r--r--sapi/thttpd/php_thttpd.h35
-rw-r--r--sapi/thttpd/stub.c0
-rw-r--r--sapi/thttpd/thttpd.c745
-rw-r--r--sapi/thttpd/thttpd_patch2332
-rw-r--r--sapi/tux/CREDITS2
-rw-r--r--sapi/tux/README86
-rw-r--r--sapi/tux/config.m418
-rw-r--r--sapi/tux/php.sym2
-rw-r--r--sapi/tux/php_tux.c453
-rw-r--r--sapi/webjames/CREDITS2
-rw-r--r--sapi/webjames/README28
-rw-r--r--sapi/webjames/config.m420
-rw-r--r--sapi/webjames/php_webjames.h28
-rw-r--r--sapi/webjames/webjames.c305
-rw-r--r--scan_makefile_in.awk32
-rw-r--r--scripts/Makefile.frag66
-rwxr-xr-xscripts/apache/apconf-conv.sh24
-rwxr-xr-xscripts/apache/aphtaccess-conv.sh24
-rw-r--r--scripts/apache/conffix.awk23
-rw-r--r--scripts/apache/htaccessfix.awk23
-rwxr-xr-xscripts/dev/conv_proto30
-rwxr-xr-xscripts/dev/conv_z_macros61
-rwxr-xr-xscripts/dev/credits26
-rw-r--r--scripts/ext_skel_ng/README36
-rw-r--r--scripts/ext_skel_ng/TODO19
-rw-r--r--scripts/ext_skel_ng/config_m4.php28
-rw-r--r--scripts/ext_skel_ng/dummy.gifbin377 -> 0 bytes
-rw-r--r--scripts/ext_skel_ng/ext_skel_ng.php60
-rw-r--r--scripts/ext_skel_ng/extension.dtd105
-rw-r--r--scripts/ext_skel_ng/extension.xml174
-rw-r--r--scripts/ext_skel_ng/extension_parser.php1160
-rw-r--r--scripts/ext_skel_ng/license.php42
-rw-r--r--scripts/ext_skel_ng/license_bsd.php70
-rw-r--r--scripts/ext_skel_ng/license_lgpl.php540
-rw-r--r--scripts/ext_skel_ng/license_php.php93
-rw-r--r--scripts/ext_skel_ng/php_constant.php83
-rw-r--r--scripts/ext_skel_ng/php_element.php77
-rw-r--r--scripts/ext_skel_ng/php_function.php346
-rw-r--r--scripts/ext_skel_ng/php_global.php80
-rw-r--r--scripts/ext_skel_ng/php_ini.php117
-rw-r--r--scripts/ext_skel_ng/php_logo.php52
-rw-r--r--scripts/ext_skel_ng/php_resource.php75
-rw-r--r--scripts/ext_skel_ng/xml_stream_callback_parser.php36
-rw-r--r--scripts/ext_skel_ng/xml_stream_parser.php54
-rw-r--r--scripts/php-config.in32
-rwxr-xr-xscripts/phpextdist27
-rw-r--r--scripts/phpize.in56
-rw-r--r--scripts/phpize.m4123
-rwxr-xr-xsnapshot7
-rw-r--r--stamp-h.in1
-rw-r--r--strtok_r.c113
-rw-r--r--stub.c1
-rw-r--r--tests/basic/001.phpt8
-rw-r--r--tests/basic/002.phpt12
-rw-r--r--tests/basic/003.phpt14
-rw-r--r--tests/basic/004.phpt13
-rw-r--r--tests/basic/005.phpt13
-rw-r--r--tests/basic/006.phpt8
-rw-r--r--tests/basic/007.phpt8
-rw-r--r--tests/basic/008.phpt8
-rw-r--r--tests/basic/009.phpt8
-rw-r--r--tests/basic/010.phpt8
-rw-r--r--tests/basic/011.phpt27
-rw-r--r--tests/basic/012.phpt27
-rw-r--r--tests/basic/bug20539.phpt10
-rw-r--r--tests/bin-info.inc21
-rw-r--r--tests/classes/__call_001.phpt42
-rw-r--r--tests/classes/__clone_001.phpt40
-rw-r--r--tests/classes/__set__get_001.phpt72
-rw-r--r--tests/classes/abstract.phpt30
-rw-r--r--tests/classes/abstract_class.phpt29
-rw-r--r--tests/classes/abstract_final.phpt16
-rw-r--r--tests/classes/abstract_inherit.phpt22
-rw-r--r--tests/classes/abstract_not_declared.phpt15
-rw-r--r--tests/classes/abstract_redeclare.phpt22
-rw-r--r--tests/classes/abstract_static.phpt26
-rw-r--r--tests/classes/bug20120.phpt26
-rw-r--r--tests/classes/class_example.phpt87
-rw-r--r--tests/classes/constants_scope_001.phpt25
-rw-r--r--tests/classes/ctor_dtor.phpt48
-rw-r--r--tests/classes/ctor_dtor_inheritance.phpt99
-rw-r--r--tests/classes/dereferencing_001.phpt35
-rw-r--r--tests/classes/factory_001.phpt35
-rw-r--r--tests/classes/final.phpt31
-rw-r--r--tests/classes/final_abstract.phpt16
-rw-r--r--tests/classes/final_redeclare.phpt28
-rw-r--r--tests/classes/inheritance.phpt58
-rwxr-xr-xtests/classes/inheritance_002.phpt87
-rw-r--r--tests/classes/interface_class.phpt14
-rw-r--r--tests/classes/interface_doubled.phpt199
-rw-r--r--tests/classes/interface_implemented.phpt103
-rw-r--r--tests/classes/interface_instantiate.phpt16
-rw-r--r--tests/classes/interface_member.phpt13
-rw-r--r--tests/classes/interface_method.phpt15
-rw-r--r--tests/classes/interface_method_final.phpt15
-rw-r--r--tests/classes/interface_method_private.phpt15
-rw-r--r--tests/classes/interface_must_be_implemented.phpt17
-rw-r--r--tests/classes/interfaces_001.phpt26
-rw-r--r--tests/classes/interfaces_002.phpt29
-rw-r--r--tests/classes/object_reference_001.phpt27
-rw-r--r--tests/classes/private_001.phpt26
-rw-r--r--tests/classes/private_002.phpt35
-rw-r--r--tests/classes/private_003.phpt36
-rw-r--r--tests/classes/private_003b.phpt37
-rw-r--r--tests/classes/private_004.phpt32
-rw-r--r--tests/classes/private_004b.phpt35
-rw-r--r--tests/classes/private_005.phpt32
-rw-r--r--tests/classes/private_005b.phpt35
-rw-r--r--tests/classes/private_006.phpt41
-rw-r--r--tests/classes/private_006b.phpt41
-rw-r--r--tests/classes/private_007.phpt30
-rw-r--r--tests/classes/private_007b.phpt31
-rw-r--r--tests/classes/protected_001.phpt26
-rw-r--r--tests/classes/protected_001b.phpt27
-rw-r--r--tests/classes/protected_002.phpt35
-rw-r--r--tests/classes/singleton_001.phpt37
-rw-r--r--tests/classes/static_mix_1.phpt26
-rw-r--r--tests/classes/static_mix_2.phpt27
-rw-r--r--tests/classes/type_hinting_001.phpt38
-rw-r--r--tests/classes/visibility_000a.phpt33
-rw-r--r--tests/classes/visibility_000b.phpt33
-rw-r--r--tests/classes/visibility_000c.phpt33
-rw-r--r--tests/classes/visibility_001a.phpt33
-rw-r--r--tests/classes/visibility_001b.phpt33
-rw-r--r--tests/classes/visibility_001c.phpt33
-rw-r--r--tests/classes/visibility_002a.phpt33
-rw-r--r--tests/classes/visibility_002b.phpt33
-rw-r--r--tests/classes/visibility_002c.phpt33
-rw-r--r--tests/classes/visibility_003a.phpt33
-rw-r--r--tests/classes/visibility_003b.phpt33
-rw-r--r--tests/classes/visibility_003c.phpt33
-rw-r--r--tests/classes/visibility_004a.phpt33
-rw-r--r--tests/classes/visibility_004b.phpt33
-rw-r--r--tests/classes/visibility_004c.phpt33
-rw-r--r--tests/foo5
-rw-r--r--tests/foo23
-rw-r--r--tests/foo343
-rw-r--r--tests/foo441
-rw-r--r--tests/func/001.phpt6
-rw-r--r--tests/func/002.phpt22
-rw-r--r--tests/func/003.phpt289
-rw-r--r--tests/func/004.phpt65
-rw-r--r--tests/func/005.phpt19
-rw-r--r--tests/func/005a.phpt28
-rw-r--r--tests/func/006.phpt26
-rw-r--r--tests/func/007.phpt22
-rw-r--r--tests/func/008.phpt16
-rw-r--r--tests/func/009.phpt16
-rw-r--r--tests/lang/001.phpt8
-rw-r--r--tests/lang/002.phpt14
-rw-r--r--tests/lang/003.phpt21
-rw-r--r--tests/lang/004.phpt15
-rw-r--r--tests/lang/005.phpt18
-rw-r--r--tests/lang/006.phpt25
-rw-r--r--tests/lang/007.phpt29
-rw-r--r--tests/lang/008.phpt20
-rw-r--r--tests/lang/009.phpt13
-rw-r--r--tests/lang/010.phpt15
-rw-r--r--tests/lang/011.phpt25
-rw-r--r--tests/lang/012.phpt20
-rw-r--r--tests/lang/013.phpt12
-rw-r--r--tests/lang/014.phpt15
-rwxr-xr-xtests/lang/015.inc3
-rw-r--r--tests/lang/015.phpt10
-rwxr-xr-xtests/lang/016.inc5
-rw-r--r--tests/lang/016.phpt11
-rw-r--r--tests/lang/017.phpt20
-rw-r--r--tests/lang/018.phpt36
-rw-r--r--tests/lang/019.phpt38
-rw-r--r--tests/lang/020.phpt78
-rw-r--r--tests/lang/021.phpt44
-rw-r--r--tests/lang/022.phpt65
-rwxr-xr-xtests/lang/023-1.inc356
-rwxr-xr-xtests/lang/023-2.inc6
-rw-r--r--tests/lang/023.phpt256
-rw-r--r--tests/lang/024.phpt11625
-rw-r--r--tests/lang/025.phpt533
-rw-r--r--tests/lang/026.phpt8
-rw-r--r--tests/lang/027.phpt14
-rw-r--r--tests/lang/028.phpt1060
-rw-r--r--tests/lang/030.phpt38
-rw-r--r--tests/lang/031.phpt72
-rw-r--r--tests/lang/032.phpt38
-rw-r--r--tests/lang/033.phpt53
-rw-r--r--tests/lang/034.phpt20
-rw-r--r--tests/lang/035.phpt38
-rw-r--r--tests/lang/bison1.phpt9
-rw-r--r--tests/lang/bug19566.phpt10
-rw-r--r--tests/lang/bug19943.phpt29
-rw-r--r--tests/lang/bug20175.phpt165
-rw-r--r--tests/lang/bug21094.phpt17
-rw-r--r--tests/lang/bug21600.phpt34
-rw-r--r--tests/lang/bug21800.phpt18
-rw-r--r--tests/lang/bug21820.phpt13
-rw-r--r--tests/lang/bug21849.phpt16
-rw-r--r--tests/lang/bug21961.phpt58
-rw-r--r--tests/lang/bug22231.phpt39
-rw-r--r--tests/lang/bug22367.phpt118
-rw-r--r--tests/lang/bug22510.phpt115
-rw-r--r--tests/lang/bug22592.phpt53
-rw-r--r--tests/lang/bug23489.phpt23
-rw-r--r--tests/lang/bug23584.phpt13
-rw-r--r--tests/lang/bug7515.phpt36
-rw-r--r--tests/lang/error_2_exception_001.phpt45
-rw-r--r--tests/lang/namespace_001.phpt31
-rw-r--r--tests/lang/type_hints_001.phpt26
-rw-r--r--tests/odbc-display.php19
-rw-r--r--tests/odbc-t1.php38
-rw-r--r--tests/odbc-t2.php82
-rw-r--r--tests/odbc-t3.php95
-rw-r--r--tests/odbc-t4.php91
-rw-r--r--tests/odbc-t5.php137
-rw-r--r--tests/quicktester.inc75
-rw-r--r--tests/recurse21
-rw-r--r--tests/run-test/test001.phpt6
-rw-r--r--tests/run-test/test002.phpt18
-rw-r--r--tests/run-test/test003.phpt6
-rw-r--r--tests/run-test/test004.phpt10
-rw-r--r--tests/run-test/test005.phpt32
-rw-r--r--tests/run-test/test006.phpt9
-rw-r--r--tests/run-test/test007.phptbin1191 -> 0 bytes
-rw-r--r--tests/run-test/test008.phpt33
-rw-r--r--tests/run-test/test008a.phpt32
-rw-r--r--tests/run.html11
-rw-r--r--tests/run.php17
-rw-r--r--tests/scan_cases28
-rw-r--r--tests/strings/001.phpt209
-rw-r--r--tests/strings/002.phpt85
-rw-r--r--tests/strings/004.phpt24
-rw-r--r--tests/test.php415
-rw-r--r--tests/test.pl34
-rw-r--r--tests/test_class_inheritance29
-rw-r--r--tests/testarray21
-rw-r--r--tests/testarray.pl5
-rw-r--r--tests/testarray25
-rw-r--r--tests/testarray2.pl3
-rw-r--r--tests/testclassfunc9
-rw-r--r--tests/testcom11
-rw-r--r--tests/testcpdf97
-rw-r--r--tests/testcpdfclock87
-rw-r--r--tests/testdom73
-rw-r--r--tests/testfe18
-rw-r--r--tests/testfunc33
-rw-r--r--tests/testfunc.pl20
-rw-r--r--tests/testfunc219
-rw-r--r--tests/testfunc2.pl22
-rw-r--r--tests/testfuncref10
-rw-r--r--tests/testhyperwave235
-rw-r--r--tests/testinclude5
-rw-r--r--tests/testobj29
-rw-r--r--tests/testpfpro.php39
-rw-r--r--tests/tests.dsp61
-rw-r--r--tests/tests.mak27
-rw-r--r--tests/testscanf.php113
-rw-r--r--tests/testswf120
-rw-r--r--win32/crypt_win32.c355
-rw-r--r--win32/crypt_win32.h60
-rw-r--r--win32/flock.c83
-rw-r--r--win32/flock.h11
-rw-r--r--win32/glob.c922
-rw-r--r--win32/glob.h101
-rw-r--r--win32/grp.h26
-rw-r--r--win32/install.txt792
-rw-r--r--win32/installer/README93
-rw-r--r--win32/installer/gen-nsis.php446
-rw-r--r--win32/installer/setini.php87
-rw-r--r--win32/md5crypt.c163
-rw-r--r--win32/md5crypt.h37
-rw-r--r--win32/param.h16
-rw-r--r--win32/php4.dsp134
-rw-r--r--win32/php4.dsw119
-rw-r--r--win32/php4dll.dsp1813
-rw-r--r--win32/php4dllts.dsp2299
-rw-r--r--win32/php4dllts.rc126
-rw-r--r--win32/php4dllts.rc261
-rw-r--r--win32/php4ts.dsp187
-rw-r--r--win32/php4ts.rc126
-rw-r--r--win32/php4ts.rc261
-rw-r--r--win32/php4ts_cli.dsp175
-rw-r--r--win32/php4ts_cli.rc126
-rw-r--r--win32/php4ts_cli.rc261
-rw-r--r--win32/php5ts.dsw239
-rw-r--r--win32/php_modules.dsw569
-rw-r--r--win32/php_registry.h7
-rw-r--r--win32/pwd.c64
-rw-r--r--win32/pwd.h38
-rw-r--r--win32/pws-php4cgi.reg6
-rw-r--r--win32/pws-php4isapi.reg5
-rw-r--r--win32/readdir.c143
-rw-r--r--win32/readdir.h43
-rw-r--r--win32/registry.c88
-rw-r--r--win32/resource.h15
-rw-r--r--win32/select.c181
-rw-r--r--win32/select.h22
-rw-r--r--win32/sendmail.c927
-rw-r--r--win32/sendmail.h61
-rw-r--r--win32/signal.h16
-rw-r--r--win32/syslog.h78
-rw-r--r--win32/testsuite.dsp150
-rw-r--r--win32/time.c242
-rw-r--r--win32/time.h43
-rw-r--r--win32/unistd.h4
-rw-r--r--win32/wfile.c17
-rw-r--r--win32/wfile.h16
-rw-r--r--win32/winutil.c31
-rw-r--r--win32/winutil.h21
-rw-r--r--win32/wsyslog.c122
2754 files changed, 0 insertions, 833021 deletions
diff --git a/.gdbinit b/.gdbinit
deleted file mode 100644
index 1174b900f1..0000000000
--- a/.gdbinit
+++ /dev/null
@@ -1,348 +0,0 @@
-set $zts = 0
-
-define ____executor_globals
- if $zts
- set $eg = ((zend_executor_globals) (*((void ***) tsrm_ls))[executor_globals_id-1])
- else
- set $eg = executor_globals
- end
-end
-
-document ____executor_globals
- portable way of accessing executor_globals
- type "set $zts = 1" if you use --enable-maintainer-zts on your configure line
-end
-
-define dump_bt
- set $t = $arg0
- while $t
- printf "[0x%08x] ", $t
- if $t->function_state.function->common.function_name
- printf "%s() ", $t->function_state.function->common.function_name
- else
- printf "??? "
- end
- if $t->op_array != 0
- printf "%s:%d ", $t->op_array->filename, $t->opline->lineno
- end
- set $t = $t->prev_execute_data
- printf "\n"
- end
-end
-
-document dump_bt
- dumps the current execution stack. usage: dump_bt executor_globals.current_execute_data
-end
-
-define printzv
- set $ind = 1
- ____printzv $arg0 0
-end
-
-document printzv
- prints content of zval
-end
-
-define ____printzv_contents
- ____executor_globals
- set $zvalue = $arg0
-
- if $zvalue.type == 0
- set $typename = "NULL"
- end
- if $zvalue.type == 1
- set $typename = "long"
- end
- if $zvalue.type == 2
- set $typename = "double"
- end
- if $zvalue.type == 3
- set $typename = "string"
- end
- if $zvalue.type == 4
- set $typename = "array"
- end
- if $zvalue.type == 5
- set $typename = "object"
- end
- if $zvalue.type == 6
- set $typename = "bool"
- end
- if $zvalue.type == 7
- set $typename = "resource"
- end
- if $zvalue.type == 8
- set $typename = "constant"
- end
- if $zvalue.type == 9
- set $typename = "const_array"
- end
-
- printf "(refcount=%d) %s: ", $zvalue.refcount, $typename
- if $zvalue.type == 1
- printf "%ld", $zvalue.value.lval
- end
- if $zvalue->type == 2
- printf "%lf", $zvalue.value.dval
- end
- if $zvalue.type == 3
- printf "\"%s\"(%d)", $zvalue.value.str.val, $zvalue.value.str.len
- end
- if $zvalue.type == 4
- if ! $arg1
- printf "{\n"
- set $ind = $ind + 1
- ____print_ht $zvalue.value.ht
- set $ind = $ind - 1
- set $i = $ind
- while $i > 0
- printf " "
- set $i = $i - 1
- end
- printf "}"
- end
- end
- if $zvalue.type == 5
- if ! $arg1
- printf "(prop examination disabled due to a gdb bug)"
- if $zvalue.value.obj.handlers->get_properties
-# set $ht = $zvalue->value.obj.handlers->get_properties($zvalue)
-# printf "{\n"
-# set $ind = $ind + 1
-# ____print_ht $ht
-# set $ind = $ind - 1
-# set $i = $ind
-# while $i > 0
-# printf " "
-# set $i = $i - 1
-# end
-# printf "}"
- end
- end
- end
- if $zvalue.type == 6
- if $zvalue.value.lval
- printf "true"
- else
- printf "false"
- end
- end
- if $zvalue.type == 7
- printf "#%d", $zvalue.value.lval
- end
- printf "\n"
-end
-
-define ____printzv
- ____executor_globals
- set $zvalue = $arg0
-
- printf "[0x%08x] ", $zvalue
-
- if $zvalue == $eg.uninitialized_zval_ptr
- printf "*uninitialized* "
- end
-
- set $zcontents = *(struct _zval_struct *) $zvalue
- if $arg1
- ____printzv_contents $zcontents $arg1
- else
- ____printzv_contents $zcontents 0
- end
-end
-
-define ____print_const_table
- set $ht = $arg0
- set $p = $ht->pListHead
-
- while $p != 0
- set $const = *(zend_constant *) $p->pData
-
- set $i = $ind
- while $i > 0
- printf " "
- set $i = $i - 1
- end
-
- if $p->nKeyLength > 0
- printf "\"%s\" => ", $p->arKey
- else
- printf "%d => ", $p->h
- end
-
- ____printzv_contents $const.value 0
- set $p = $p->pListNext
- end
-end
-
-define print_const_table
- set $ind = 1
- printf "[0x%08x] {\n", $arg0
- ____print_const_table $arg0
- printf "}\n"
-end
-
-define ____print_ht
- set $ht = $arg0
- set $p = $ht->pListHead
-
- while $p != 0
- set $zval = *(struct _zval_struct **)$p->pData
-
- set $i = $ind
- while $i > 0
- printf " "
- set $i = $i - 1
- end
-
- if $p->nKeyLength > 0
- printf "\"%s\" => ", $p->arKey
- else
- printf "%d => ", $p->h
- end
-
- ____printzv $zval 1
- set $p = $p->pListNext
- end
-end
-
-define print_ht
- set $ind = 1
- printf "[0x%08x] {\n", $arg0
- ____print_ht $arg0
- printf "}\n"
-end
-
-document print_ht
- dumps elements of HashTable made of zval
-end
-
-define printzn
- ____executor_globals
- set $ind = 0
- set $znode = $arg0
- if $znode->op_type == 1
- set $optype = "IS_CONST"
- end
- if $znode->op_type == 2
- set $optype = "IS_TMP_VAR"
- end
- if $znode->op_type == 4
- set $optype = "IS_VAR"
- end
- if $znode->op_type == 8
- set $optype = "IS_UNUSED"
- end
-
- printf "[0x%08x] %s", $znode, $optype
-
- if $znode->op_type == 1
- printf ": "
- ____printzv &$znode->u.constant 0
- end
- if $znode->op_type == 2
- printf ": "
- set $tvar = (union _temp_variable *)((char *)$eg.current_execute_data->Ts + $znode->u.var)
- ____printzv ((union _temp_variable *)$tvar)->tmp_var 0
- end
- if $znode->op_type == 4
- printf ": "
- set $tvar = (union _temp_variable *)((char *)$eg.current_execute_data->Ts + $znode->u.var)
- ____printzv *$tvar->var.ptr_ptr 0
- end
- if $znode->op_type == 8
- printf "\n"
- end
-end
-
-document printzn
- print type and content of znode.
- usage: printzn &opline->op1
-end
-
-define printzops
- printf "op1 => "
- printzn &execute_data->opline.op1
- printf "op2 => "
- printzn &execute_data->opline.op2
- printf "result => "
- printzn &execute_data->opline.result
-end
-
-document printzops
- dump operands of the current opline
-end
-
-define zmemcheck
- set $p = alloc_globals.head
- set $stat = "?"
- set $total_size = 0
- if $arg0 != 0
- set $not_found = 1
- else
- set $not_found = 0
- end
- printf " block size status file:line\n"
- printf "-------------------------------------------------------------------------------\n"
- while $p
- set $aptr = $p + sizeof(struct _zend_mem_header) + sizeof(align_test)
- if $arg0 == 0 || (void *)$aptr == (void *)$arg0
- if $p->magic == 0x7312f8dc
- set $stat = "OK"
- end
- if $p->magic == 0x99954317
- set $stat = "FREED"
- end
- if $p->magic == 0xfb8277dc
- set $stat = "CACHED"
- end
- set $filename = strrchr($p->filename, '/')
- if !$filename
- set $filename = $p->filename
- else
- set $filename = $filename + 1
- end
- printf " 0x%08x ", $aptr
- if $p->size == sizeof(struct _zval_struct) && ((struct _zval_struct *)$aptr)->type >= 0 && ((struct _zval_struct *)$aptr)->type < 10
- printf "ZVAL?(%-2d) ", $p->size
- else
- printf "%-9d ", $p->size
- end
- set $total_size = $total_size + $p->size
- printf "%-06s %s:%d", $stat, $filename, $p->lineno
- if $p->orig_filename
- set $orig_filename = strrchr($p->orig_filename, '/')
- if !$orig_filename
- set $orig_filename = $p->orig_filename
- else
- set $orig_filename = $orig_filename + 1
- end
- printf " <= %s:%d\n", $orig_filename, $p->orig_lineno
- else
- printf "\n"
- end
- if $arg0 != 0
- set $p = 0
- set $not_found = 0
- else
- set $p = $p->pNext
- end
- else
- set $p = $p->pNext
- end
- end
- if $not_found
- printf "no such block that begins at 0x%08x.\n", $aptr
- end
- if $arg0 == 0
- printf "-------------------------------------------------------------------------------\n"
- printf " total: %d bytes\n", $total_size
- end
-end
-
-document zmemcheck
- show status of a memory block.
- usage: zmemcheck [ptr].
- if ptr is 0, all blocks will be listed.
-end
-
diff --git a/CODING_STANDARDS b/CODING_STANDARDS
deleted file mode 100644
index 12fbd3a0f1..0000000000
--- a/CODING_STANDARDS
+++ /dev/null
@@ -1,240 +0,0 @@
-PHP Coding Standards
-====================
-
-
-This file lists several standards that any programmer, adding or changing
-code in PHP, should follow. Since this file was added at a very late
-stage of the development of PHP v3.0, the code base does not (yet) fully
-follow it, but it's going in that general direction. Since we are now
-well into the version 4 releases, many sections have been recoded to use
-these rules.
-
-
-Code Implementation
--------------------
-
-[0] Document your code in source files and the manual. [tm]
-
-[1] Functions that are given pointers to resources should not free them
-
-For instance, function int mail(char *to, char *from) should NOT free
-to and/or from.
-Exceptions:
-
- - The function's designated behavior is freeing that resource. E.g. efree()
- - The function is given a boolean argument, that controls whether or not
- the function may free its arguments (if true - the function must free its
- arguments, if false - it must not)
- - Low-level parser routines, that are tightly integrated with the token
- cache and the bison code for minimum memory copying overhead.
-
-[2] Functions that are tightly integrated with other functions within the
- same module, and rely on each other non-trivial behavior, should be
- documented as such and declared 'static'. They should be avoided if
- possible.
-
-[3] Use definitions and macros whenever possible, so that constants have
- meaningful names and can be easily manipulated. The only exceptions
- to this rule are 0 and 1, when used as false and true (respectively).
- Any other use of a numeric constant to specify different behavior
- or actions should be done through a #define.
-
-[4] When writing functions that deal with strings, be sure to remember
- that PHP holds the length property of each string, and that it
- shouldn't be calculated with strlen(). Write your functions in a such
- a way so that they'll take advantage of the length property, both
- for efficiency and in order for them to be binary-safe.
- Functions that change strings and obtain their new lengths while
- doing so, should return that new length, so it doesn't have to be
- recalculated with strlen() (e.g. php_addslashes())
-
-[5] NEVER USE strncat(). If you're absolutely sure you know what you're doing,
- check its man page again, and only then, consider using it, and even then,
- try avoiding it.
-
-[6] Use PHP_* macros in the PHP source, and ZEND_* macros in the Zend
- part of the source. Although the PHP_* macro's are mostly aliased to the
- ZEND_* macros it gives a better understanding on what kind of macro you're
- calling.
-
-[7] When commenting out code using a #if statement, do NOT use 0 only. Instead
- use "<cvs username here>_0". For example, #if FOO_0, where FOO is your
- cvs user foo. This allows easier tracking of why code was commented out,
- especially in bundled libraries.
-
-[8] Do not define functions that are not available. For instance, if a
- library is missing a function, do not define the PHP version of the
- function, and do not raise a run-time error about the function not
- existing. End users should use function_exists() to test for the
- existence of a function
-
-[9] Prefer emalloc(), efree(), estrdup(), etc. to their standard C library
- counterparts. These functions implement an internal "safety-net"
- mechanism that ensures the deallocation of any unfreed memory at the
- end of a request. They also provide useful allocation and overflow
- information while running in debug mode.
-
- In almost all cases, memory returned to the engine must be allocated
- using emalloc().
-
- The use of malloc() should be limited to cases where a third-party
- library may need to control or free the memory, or when the memory in
- question needs to survive between multiple requests.
-
-Naming Conventions
-------------------
-
-[1] Function names for user-level functions should be enclosed with in
- the PHP_FUNCTION() macro. They should be in lowercase, with words
- underscore delimited, with care taken to minimize the letter count.
- Abbreviations should not be used when they greatly decrease the
- readability of the function name itself.
-
- Good:
- 'mcrypt_enc_self_test'
- 'mysql_list_fields'
-
- Ok:
- 'mcrypt_module_get_algo_supported_key_sizes'
- (could be 'mcrypt_mod_get_algo_sup_key_sizes'?)
- 'get_html_translation_table'
- (could be 'html_get_trans_table'?)
-
- Bad:
- 'hw_GetObjectByQueryCollObj'
- 'pg_setclientencoding'
- 'jf_n_s_i'
-
-
-[2] If they are part of a "parent set" of functions, that parent should
- be included in the user function name, and should be clearly related
- to the parent program or function family. This should be in the form
- of parent_*.
-
- A family of 'foo' functions, for example:
- Good:
- 'foo_select_bar'
- 'foo_insert_baz'
- 'foo_delete_baz'
-
- Bad:
- 'fooselect_bar'
- 'fooinsertbaz'
- 'delete_foo_baz'
-
-[3] Function names used by user functions should be prefixed
- with "_php_", and followed by a word or an underscore-delimited list of
- words, in lowercase letters, that describes the function. If applicable,
- they should be declared 'static'.
-
-[4] Variable names must be meaningful. One letter variable names must be
- avoided, except for places where the variable has no real meaning or
- a trivial meaning (e.g. for (i=0; i<100; i++) ...).
-
-[5] Variable names should be in lowercase. Use underscores to separate
- between words.
-
-
-Syntax and indentation
-----------------------
-
-[1] Never use C++ style comments (i.e. // comment). Always use C-style
- comments instead. PHP is written in C, and is aimed at compiling
- under any ANSI-C compliant compiler. Even though many compilers
- accept C++-style comments in C code, you have to ensure that your
- code would compile with other compilers as well.
- The only exception to this rule is code that is Win32-specific,
- because the Win32 port is MS-Visual C++ specific, and this compiler
- is known to accept C++-style comments in C code.
-
-[2] Use K&R-style. Of course, we can't and don't want to
- force anybody to use a style he or she is not used to, but,
- at the very least, when you write code that goes into the core
- of PHP or one of its standard modules, please maintain the K&R
- style. This applies to just about everything, starting with
- indentation and comment styles and up to function declaration
- syntax.
-
- (see also http://www.tuxedo.org/~esr/jargon/html/entry/indent-style.html)
-
-[3] Be generous with whitespace and braces. Always prefer:
-
- if (foo) {
- bar;
- }
-
- to:
-
- if(foo)bar;
-
- Keep one empty line between the variable declaration section and
- the statements in a block, as well as between logical statement
- groups in a block. Maintain at least one empty line between
- two functions, preferably two.
-
-[4] When indenting, use the tab character. A tab is expected to represent
- four spaces. It is important to maintain consistency in indenture so
- that definitions, comments, and control structures line up correctly.
-
-Documentation and Folding Hooks
--------------------------------
-
-In order to make sure that the online documentation stays in line with
-the code, each user-level function should have its user-level function
-prototype before it along with a brief one-line description of what the
-function does. It would look like this:
-
-/* {{{ proto int abs(int number)
- Returns the absolute value of the number */
-PHP_FUNCTION(abs)
-{
- ...
-}
-/* }}} */
-
-The {{{ symbols are the default folding symbols for the folding mode in
-Emacs and vim (set fdm=marker). Folding is very useful when dealing with
-large files because you can scroll through the file quickly and just unfold
-the function you wish to work on. The }}} at the end of each function marks
-the end of the fold, and should be on a separate line.
-
-The "proto" keyword there is just a helper for the doc/genfuncsummary script
-which generates a full function summary. Having this keyword in front of the
-function prototypes allows us to put folds elsewhere in the code without
-messing up the function summary.
-
-Optional arguments are written like this:
-
-/* {{{ proto object imap_header(int stream_id, int msg_no [, int from_length [, int subject_length [, string default_host]]])
- Returns a header object with the defined parameters */
-
-And yes, please keep the prototype on a single line, even if that line
-is massive.
-
-New and Experimental Functions
------------------------------------
-To reduce the problems normally associated with the first public
-implementation of a new set of functions, it has been suggested
-that the first implementation include a file labeled 'EXPERIMENTAL'
-in the function directory, and that the functions follow the
-standard prefixing conventions during their initial implementation.
-
-The file labelled 'EXPERIMENTAL' should include the following
-information:
- Any authoring information (known bugs, future directions of the module).
- Ongoing status notes which may not be appropriate for CVS comments.
-
-Aliases & Legacy Documentation
------------------------------------
-You may also have some deprecated aliases with close to duplicate
-names, for example, somedb_select_result and somedb_selectresult. For
-documentation purposes, these will only be documented by the most
-current name, with the aliases listed in the documentation for
-the parent function. For ease of reference, user-functions with
-completely different names, that alias to the same function (such as
-highlight_file and show_source), will be separately documented. The
-proto should still be included, describing which function is aliased.
-
-Backwards compatible functions and names should be maintained as long
-as the code can be reasonably be kept as part of the codebase. See
-/phpdoc/README for more information on documentation.
diff --git a/CREDITS b/CREDITS
deleted file mode 100644
index 42549a2773..0000000000
--- a/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-For the list of people who've put work into PHP, please see
-http://www.php.net/credits.php
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index c2f0250c08..0000000000
--- a/ChangeLog
+++ /dev/null
@@ -1,10342 +0,0 @@
-2003-04-07 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- Removed entry that is in the PHP_4_3 branch..
-
- * NEWS:
- reorder
-
- * (PHP_4_3)
- NEWS:
- BFN
-
-2003-04-07 Sara Golemon <php@alphaweb.net>
-
- * NEWS
- ext/standard/http_fopen_wrapper.c:
- Introduce support for context options 'method', 'header', 'content'
-
-2003-04-06 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- BFN
-
- * (PHP_4_3)
- ext/standard/datetime.c:
- MFH: Fixed bug #23071 (when DST in effect, date("T") crashed PHP)
-
- * ext/standard/datetime.c:
- Fixed bug #23071 (when DST in effect, date("T") crashed PHP)
-
-2003-04-06 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * .gdbinit:
- Support for ZTS
-
-2003-04-06 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- .gdbinit:
- MFH(r-1.5): improved zmemcheck macro so it displays the size of each memory
- block too.
-
- * .gdbinit:
- Improved zmemcheck macro so it displays the size of each memory block too.
-
- * (PHP_4_3)
- .gdbinit:
- MFH(r-1.4): improved readability of zmemcheck output
-
- * .gdbinit:
- Improved readability of zmemcheck output
-
- * .gdbinit:
-
- Added zmemcheck macro, which may help you examine the memory blocks being
- handled by the memory manager.
-
-2003-04-06 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- reorder
-
-2003-04-05 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/gd/gd.c:
- Collate version handling and bump up version (noticed by Peter Neuman)
-
-2003-04-05 Christian Stocker <chregu@phant.ch>
-
- * ext/domxml/php_domxml.c
- ext/domxml/php_domxml.h:
- Useful for adding and parsing (well-balanced) document fragments.
- - Bumped up API version number
-
-2003-04-05 Jani Taskinen <sniper@iki.fi>
-
- * configure.in:
- --enable-all is not useful at all, removed from help
-
- * ext/sockets/php_sockets.h:
- Better ifdef it out here too
-
-2003-04-05 Sara Golemon <php@alphaweb.net>
-
- * ext/openssl/xp_ssl.c:
- Debug watches probably don't belong in CVS.
-
-2003-04-05 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- GD news.
-
- * ext/gd/libgd/gd.c
- ext/gd/libgd/gd.h
- ext/gd/libgd/gd_gd.c
- ext/gd/libgd/gd_gd2.c
- ext/gd/libgd/gd_io.h
- ext/gd/libgd/gd_jpeg.c
- ext/gd/libgd/gd_png.c
- ext/gd/libgd/gd_topal.c
- ext/gd/libgd/gdcache.c
- ext/gd/libgd/gdcache.h
- ext/gd/libgd/gdft.c
- ext/gd/libgd/gdkanji.c:
- Syncronized bunbled GD library with gd 2.0.12
-
-
-2003-04-05 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * run-tests.php:
- Include ldd output
-
-2003-04-05 Sascha Schumann <sascha@schumann.cx>
-
- * php.ini-dist
- php.ini-recommended:
- dividend -> divisor
-
- * ext/session/php_session.h
- ext/session/session.c:
- dividend -> divisor
-
- Submitted by: Jesus M. Castagnetto <jmcastagnetto@yahoo.com>
-
-2003-04-05 Brian France <list@firehawksystems.com>
-
- * ext/curl/multi.c:
-
- Added HAVE_CONFIG_H check so the phpize build method works
-
-2003-04-05 Sara Golemon <php@alphaweb.net>
-
- * main/streams/xp_socket.c:
- Add IPv6 support to stream_socket_client/server()
-
-2003-04-05 Pierre-Alain Joye <paj@pearfr.org>
-
- * pear/package-PEAR.xml:
- what? maintainer is not a valid role :)
-
-2003-04-04 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/streamsfuncs.c:
- Warning fix
-
-2003-04-04 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/streamsfuncs.c:
- User shouldn't have to initialize this pass-by-ref parameter
-
-2003-04-04 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- ext/sockets/config.m4
- ext/sockets/sockets.c:
- MFH: added check for struct cmsghdr. now sockets extension can be built
- under cygwin
-
-2003-04-04 Jani Taskinen <sniper@iki.fi>
-
- * ext/rpc/java/config.m4:
- - Fixed bug #22944 (--with-java "make install" fails)
-
-2003-04-04 Sterling Hughes <sterling@bumblebury.com>
-
- * CODING_STANDARDS:
- both these entries are bad, and were never agreed upon.
- assert() usage is a controversial concept at best.
- docref() is something quite a few of us strong disagree with. suspending
- this until further discussion.
-
-2003-04-04 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- ext/curl/curl.c:
- Fix bug #23048, CURLOPT_ENCODING is not always available
-
-2003-04-04 Sterling Hughes <sterling@bumblebury.com>
-
- * ext/curl/multi.c:
- forgot to commit this.
-
-2003-04-04 Jani Taskinen <sniper@iki.fi>
-
- * ext/gd/config.m4:
- Check that t1lib has T1_StrError
-
- * configure.in
- ext/sockets/config.m4:
- - Checks specific to some extension belong in the extension's config.m4
-
-2003-04-04 Andrei Zmievski <andrei@gravitonic.com>
-
- * main/php.h:
- Introduce ZEND_ME() and ZEND_METHOD() macros. Use these for declaring
- class methods to avoid name collisions.
-
-2003-04-04 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- ext/sockets/sockets.c:
- MFH(r-1.135): fixed memleak in socket_select()
-
- * ext/sockets/sockets.c:
- Fixed memleak in socket_select
-
- * configure.in
- ext/sockets/sockets.c:
- Added cmsghdr check. Now sockets extension can be built under cygwin.
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- Sorry, forgot these ones
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- renumbering
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- segfault busting news
- replacing one tab to 4 spaces
-
- * (PHP_4_3)
- ext/mbstring/mbfilter.c:
- MFH(r-1.55): added missing sanity check, which was causing segfault.
-
- * ext/mbstring/mbfilter.c:
- Added missing sanity check, which was causing segfault.
-
-2003-04-04 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/streamsfuncs.c:
- Simplify and enhance readability.
-
-2003-04-04 Sascha Schumann <sascha@schumann.cx>
-
- * main/output.c:
- Backout Jani's commit to resync branches
-
-2003-04-04 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/basic_functions.c
- ext/standard/streamsfuncs.c
- ext/standard/streamsfuncs.h:
- Added stream_get_transports()
-
- * main/streams/streams.c:
- Prevent php_stream_get_record from grabbing more than maxlen characters
-
-2003-04-04 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/gd/gd.c:
- Might as well disallow 0x0 images.
-
- Thanks Marcus.
-
-2003-04-04 Pierre-Alain Joye <paj@pearfr.org>
-
- * pear/package-PEAR.xml:
- - Add some releases notes
- - Add myself in the maintainer list (stig)
-
-2003-04-04 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- Notes about various possible integer overflows in bundled gd library.
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- More gd stuff.
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- Fixed segv as well as info about new segvs in gd.
-
-2003-04-04 Stig Bakken <ssb@fast.no>
-
- * pear/package-PEAR.xml:
- - whip script files where they belong
-
-2003-04-04 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/gd/gd.c:
- Fix segfault in imagecopyresized().
-
-2003-04-04 Stig Bakken <ssb@fast.no>
-
- * pear/scripts/pear.sh:
- - look for pearcmd.php in the right directory when run from a cvs checkout
-
- * pear/package-PEAR.xml
- pear/scripts/pear.sh
- pear/scripts/pear_unices:
- - rename pear_unices to pear.sh and make it a pure shell script
-
-2003-04-04 Jani Taskinen <sniper@iki.fi>
-
- * ext/gd/gd.c:
- - Better errors for T1lib.
- - Sanity check into imagepsextendfont().
-
-2003-04-03 Stig Bakken <ssb@fast.no>
-
- * pear/package-PEAR.xml:
- - pear.in is renamed to pearcmd.php
-
- * pear/package-PEAR.xml
- pear/scripts/.cvsignore
- pear/scripts/pear.in
- pear/scripts/pear_unices
- pear/scripts/pearcmd.php:
- - paj's last Windows install fixes
-
- * pear/scripts/pear.bat:
- - use PHP_PEAR_* environment variables (paj)
-
- * pear/PEAR/Frontend/CLI.php:
- - disable table borders in output to save width
-
- * pear/OS/Guess.php:
- - windows bugfix
-
- * pear/PEAR.php:
- - support both error codes and messages in the second parameter to
- PEAR::isError()
-
-2003-04-03 Jani Taskinen <sniper@iki.fi>
-
- * ext/gd/gd.c:
- Use php_error_docref.
-
-2003-04-03 Stig Bakken <ssb@fast.no>
-
- * pear/PEAR/Registry.php:
- - remove track_errors ini fiddling, was a PHP bug that should be fixed now
-
- * pear/PEAR/Common.php:
- - initialize pkginfo with an empty provides array
-
-2003-04-03 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * ext/exif/exif.c:
- MFB
-
-2003-04-03 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * configure.in:
- Check for flex version 2.5.4
-
-2003-04-03 Sascha Schumann <sascha@schumann.cx>
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- one in socket_select
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- augment summary with fixes which predate the list
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- add chunk_split
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- another one fixed, a new one found
-
- * ext/gd/gd.c:
- Fix segfaults in imagecreate/imagecreatetruecolor
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- fix
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- update regarding dbase extension
-
-2003-04-03 Jani Taskinen <sniper@iki.fi>
-
- * main/output.c:
- WS & CS fix
-
-2003-04-03 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/array.c:
- Kludgy fix for floating point drift causing problems like
- range(1.0,1.5,0.1) == array(1.0,1.1,1.2,1.3,1.4);
-
-2003-04-03 Sascha Schumann <sascha@schumann.cx>
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- Update - we purged the full list\!
-
- * main/output.c:
- Add some checks and avoid passing invalid data to call_user_function_ex.
-
- Fixes some heap corruption and allocation of negative amounts of memory.
-
- * ext/standard/basic_functions.c:
- Prevent entering of anything but arrays/strings in register_shutdown_func
-
- Noticed by: Jan Schneider
-
-2003-04-03 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * (PHP_4_3)
- ext/exif/exif.c:
- Clean up the parameter handling here
-
-2003-04-03 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- reorder
-
-2003-04-03 Christian Stocker <chregu@phant.ch>
-
- * NEWS:
- new domxml_elem_set_attribute_node() should have gone into NEWS, but I
- forgot..
-
- * ext/domxml/php_domxml.c
- ext/domxml/php_domxml.h:
- - Added domxml_elem_set_attribute_node() method. (Rob Richards)
-
-2003-04-03 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/mysqli_api.c:
- fixed mysqli_prepare_result
-
- * ext/mysqli/tests/047.phpt:
- fixed output
-
-2003-04-03 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/string.c
- ext/standard/string.c:
- - CS
-
-2003-04-03 Jani Taskinen <sniper@iki.fi>
-
- * ext/bcmath/bcmath.c:
- Another CS fix.
-
- * ext/standard/basic_functions.c:
- CS fix
-
-2003-04-03 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- Unable to reproduce..
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- segfault busting news
-
- * (PHP_4_3)
- ext/xml/xml.c:
- MFH(r-1.117): fixed segfault in xml_parser_create()
-
- * ext/xml/xml.c:
- Fixed segfault in xml_parser_create()
-
-2003-04-03 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * (PHP_4_3)
- ext/ftp/php_ftp.c:
- Fixed bug #23004 (When ftp_close() is called, sent QUIT to the ftp server)
-
-2003-04-03 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- main/output.c:
- MFH(r-1.152): fixed memleak in output buffering facility
-
- * main/output.c:
- Fixed memleak in output buffering facility
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- Removed i18n_convert() from the entries because that is an alias for
- mb_convert_encoding()
-
-2003-04-03 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- Update
-
-2003-04-03 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- ext/mbstring/php_mbregex.c:
- MFH(r-1.38): fixed segfault in mb_ereg_match()
-
- * ext/mbstring/php_mbregex.c:
- Fixed segfault in mb_ereg_match()
-
- * (PHP_4_3)
- ext/mbstring/php_mbregex.c:
- MFH(r-1.37): fixed lots of crashes in mbregex
-
- * ext/mbstring/php_mbregex.c:
- Fixed lots of crashes in mbregex.
-
-2003-04-02 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * ext/bcmath/bcmath.c:
- MFB: Check for negative precision
-
- * (PHP_4_3)
- TODO_SEGFAULTS
- ext/bcmath/bcmath.c:
- Negative precision makes no sense, so check for that, but let the memory
- manager error out on huge non-negative precision args
-
- * ext/standard/basic_functions.c:
- MFB: Fix unregister_tick_function crash
-
- * (PHP_4_3)
- TODO_SEGFAULTS
- ext/standard/basic_functions.c:
- Fix unregister_tick_function crash
-
-2003-04-02 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/tests/028.phpt
- ext/mysqli/tests/042.phpt:
- fixed expected output
-
-2003-04-02 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * ext/exif/exif.c:
- MFB: Get rid of bogus dtors
-
- * (PHP_4_3)
- ext/exif/exif.c:
- Get rid of bogus dtors
-
- * ext/standard/string.c:
- MFB: Fix the setlocale() segfault
-
- * (PHP_4_3)
- TODO_SEGFAULTS
- ext/standard/string.c:
- Fix the setlocale() segfault
-
-2003-04-02 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * configure.in:
- For now only bison 1.28, 1.35 and 1.75 are working properly
-
-2003-04-02 Derick Rethans <d.rethans@jdimedia.nl>
-
- * sapi/apache/.cvsignore:
- - Update for new name
-
-2003-04-02 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- BFN
-
-2003-04-02 Sterling Hughes <sterling@bumblebury.com>
-
- * ext/curl/multi.c:
- add the ability for curl_multi_info to introspect the handles.
-
-
-2003-04-02 Colin Viebrock <colin@easydns.com>
-
- * ext/standard/basic_functions.c
- ext/standard/info.c
- ext/standard/info.h:
- fixes for logo guid functions
-
- * main/logos.h:
- oops ... committed the wrong one
-
- * main/logos.h:
- fix logo (outline around letters)
-
-2003-04-02 Edin Kadribasic <edink@proventum.net>
-
- * (PHP_4_3)
- NEWS:
- BFN
-
- * ext/ldap/ldap.dsp:
- Fixed bug #23008
-
-2003-04-02 Christian Stocker <chregu@phant.ch>
-
- * ext/domxml/php_domxml.c
- ext/domxml/php_domxml.c:
- Patch for Bug #22774 by Rob Richards
-
-2003-04-02 Sara Golemon <php@alphaweb.net>
-
- * tests/strings/002.phpt:
- Avoid having output_buffering cause this test to improperly fail.
-
- * ext/standard/tests/file/userfilters.phpt:
- New test for userfilters rewrite
-
-2003-04-02 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/string.c:
- Fixed possible integer overflow in str_repeat().
-
-2003-04-02 Jay Smith <jsmith@tutorbuddy.com>
-
- * (PHP_4_3)
- ext/pgsql/pgsql.c
- ext/pgsql/php_pgsql.h:
- MFH
-
-2003-04-01 Jay Smith <jsmith@tutorbuddy.com>
-
- * ext/pgsql/pgsql.c
- ext/pgsql/php_pgsql.h:
- Fix 'timestamp without timezone', too.
-
-2003-04-01 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/pgsql/pgsql.c:
- Fix 'time with timezone', too
-
-2003-04-01 Jay Smith <jsmith@tutorbuddy.com>
-
- * ext/pgsql/pgsql.c:
- Fixed bug #23009 (pg_select with timestamp)
-
-2003-04-01 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * (PHP_4_3)
- TODO_SEGFAULTS
- ext/standard/array.c:
- Arbitrarily limit array_pad() to only do 1 million elements at a time.
- Probably still too high, but it solves the segfault for now.
-
-2003-04-01 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/tests/filters/bug22538.phpt:
- Fixed bogus test
-
-2003-04-01 Sascha Schumann <sascha@schumann.cx>
-
- * (PHP_4_3)
- main/output.c:
- s/0/FAILURE/
-
- * main/output.c:
- Fix an uninitialized read, default to FAILURE
-
- * (PHP_4_3)
- main/output.c:
- Fix an uninitialised read for ob_start(array())
-
-2003-04-01 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * ext/dbase/dbf_head.c
- ext/exif/exif.c
- ext/standard/array.c:
- MFB
-
- * (PHP_4_3)
- TODO_SEGFAULTS
- ext/dbase/dbf_head.c:
- Argh!!! I guess nobody has ever looked at this code.
-
-2003-04-01 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/tests/filters/bug22538.phpt:
- Added a test case for bug #22538
-
- * ext/mbstring/php_mbregex.c:
- oops
-
- * ext/mbstring/php_mbregex.c:
- Reverted the last patch; the problem is elsewhere..
-
-2003-04-01 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * (PHP_4_3)
- TODO_SEGFAULTS
- ext/exif/exif.c:
- Fix exif crashes
-
-2003-04-01 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/mbstring/php_mbregex.c:
- Fixed crash that occurs due to an abused persistent hashtable.
-
-2003-04-01 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- Update (not fixed in HEAD because the API for this function needs to
- change in PHP5. It is moronic the way it is now)
-
- * (PHP_4_3)
- ext/sockets/sockets.c:
- Ok, really fix socket_iovec_alloc() this time
-
-2003-04-01 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- crap removal
-
- * (PHP_4_3)
- NEWS:
- BFN
-
- * (PHP_4_3)
- configure.in:
- MFH: Fixed bug #22987 (missing perror() check in configure)
-
- * configure.in:
- Fixed bug #22987 (missing perror() check in configure)
-
-2003-04-01 Sascha Schumann <sascha@schumann.cx>
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- more insight re. ob_start bug
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- The ob_start issue is reproducible.
-
-2003-04-01 Moshe Doron <mosdoron@netvision.net.il>
-
- * ext/standard/tests/strings/bug22904.phpt:
- oops
-
- * ext/standard/tests/strings/bug22904.phpt:
- revert due the last string.c revert
-
- * ext/standard/string.c:
- revert last commit for now
-
-2003-04-01 Sascha Schumann <sascha@schumann.cx>
-
- * (PHP_4_3)
- TODO_SEGFAULTS:
- editing
-
- * TODO_SEGFAULTS
- TODO_SEGFAULTS:
-
- file TODO_SEGFAULTS was initially added on branch PHP_4_3.
-
-2003-04-01 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- ext/mbstring/mbstring.c:
- MFH(r-1.170): fixed crash in mb_convert_encoding() that occurs when a void
- array is passed as the third parameter.
-
- * ext/mbstring/mbstring.c:
- Fixed crash in mb_convert_encoding() that occurs when a void array is
- passed as the third parameter
-
-2003-04-01 Thies C. Arntzen <thies@thieso.net>
-
- * ext/standard/info.c
- ext/standard/info.c:
- -** empty log message ***
-
-2003-04-01 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c:
- Fix segfault, logic and lock issue in ircg_is_conn_alive
-
- * ext/dba/config.m4
- ext/dba/config.m4
- ext/dba/config.m4:
- fix VPATH builds
-
- * ext/standard/basic_functions.c:
- Fix segfault in register_shutdown_function
-
- * (PHP_4_3)
- acinclude.m4:
- No need for shtool
-
- * acinclude.m4:
- Don't need shtool
-
- * ext/ircg/ircg.c:
- Intermediate commit of relocation map integration
-
- * (PHP_4_3)
- ext/standard/file.c
- ext/standard/file.c:
- Fix segfault in flock()
-
-2003-04-01 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/mail.c:
- Bug #22962
-
-2003-04-01 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ext/standard/basic_functions.c
- ext/standard/basic_functions.h:
- Sorry Sterling, but this broke the ZTS build and I'd rather not 'ZTS fix'
- an April's Fool joke.
-
-2003-04-01 Sterling Hughes <sterling@bumblebury.com>
-
- * ext/standard/basic_functions.c
- ext/standard/basic_functions.h:
- Add the landonize() and landonize_url() functions which provide a secure
- alternative to the sha1() and sha1_file() functions.
-
-2003-03-31 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/tests/serialize/001.phpt:
- oops
-
-2003-03-31 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- BFN & houshold
-
- * NEWS:
- Householding..
-
-2003-03-31 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * main/streams/streams.c:
- Fixed bug #22538 (stream filter problem)
-
-2003-03-31 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- acinclude.m4:
- MFH: Fixed bug #22989 (sendmail not found by configure)
-
- * acinclude.m4:
- Fixed bug #22989 (sendmail not found by configure)
-
-2003-03-31 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/tests/serialize/001.phpt:
- Fixed test; in ZE2, all the properties used in any methods are populated
- at compile time.
-
-2003-03-31 Ilia Alshanetsky <ilia@prohost.org>
-
- * main/streams/streams.c:
- WS
-
-2003-03-31 Brian France <list@firehawksystems.com>
-
- * (PHP_4_3)
- main/main.c:
-
- Fixes the problem where argv and argc are not populated unless S
- is in the variables_order, even if register_argc_argv is on.
-
-2003-03-31 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- ext/imap/php_imap.c:
- MFH(r-1.161): fixed proto to sync with the documentation
-
- * ext/imap/php_imap.c:
- Fixed proto to sync with the documentation
-
- * (PHP_4_3)
- ext/mime_magic/config.m4:
- MFH(r-1.10): rearranged search order for the magic file to avoid further
- confusions
-
- * ext/mime_magic/config.m4:
- Rearranged search order for the magic file to avoid further confusions
-
-2003-03-31 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * main/main.c:
- use the correct macro - noticed by Andrei
-
-2003-03-31 Moshe Doron <mosdoron@netvision.net.il>
-
- * ext/standard/tests/strings/bug22904.phpt:
-
-
- * ext/standard/string.c:
- fix for 22904
-
-2003-03-31 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/openssl/openssl.c:
- Fix const warning
-
-2003-03-31 David Hill <David.Hill@hp.com>
-
- * (PHP_4_3)
- ext/standard/parsedate.y:
- Changing parsedate to be reentrant using pure_parse (Dave)
-
- * (PHP_4_3)
- configure.in:
- Correcting checking of flex version (Dave)
-
-2003-03-31 Moshe Doron <mosdoron@netvision.net.il>
-
- * ext/standard/string.c:
-
-
-2003-03-31 Jani Taskinen <sniper@iki.fi>
-
- * ext/gd/gd.c
- ext/gd/gd.c
- ext/gd/php_gd.h
- ext/gd/php_gd.h:
- cleanup
-
-2003-03-31 Sascha Schumann <sascha@schumann.cx>
-
- * (PHP_4_3)
- ext/standard/lcg.c
- ext/standard/lcg.c:
- MFH TS issue, noticed by Sebastian Bergmann
-
- * ext/standard/lcg.c:
- TS issue, noticed by Sebastian Bergmann
-
- * ext/standard/lcg.c:
- Ensure that the seed function has been called, even if we are used by
- another module's request init function.
-
- Noticed by: marcus.boerger@t-online.de
-
-2003-03-30 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/openssl/openssl.c:
- - Typo and some whitespace
-
- * ext/openssl/openssl.c:
- - Added optional parameter to openssl_sign() to specify the hashing
- algorithm to use. (Patch by Scott <scott@planetscott.ca>)
-
-2003-03-30 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * ext/gd/libgd/gd.c:
- Fixed bug #22965 (Crash in gd lib's ImageFillToBorder()).
-
-2003-03-30 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/apache/config.m4:
- Merge proper -I parameter for APXS builds
-
-2003-03-30 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * (PHP_4_3)
- ext/gd/gd.c:
- No point calling the RSHUTDOWN hook here unless we are actually going
- to do something in it.
-
-2003-03-30 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * .gdbinit:
- Added various gdb macros to examine zval, znode, and HashTable
-
-2003-03-30 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/mysqli_profiler.c:
- changed constant name
-
-2003-03-30 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * run-tests.php:
- if TEST_PHP_EXECUTABLE=auto then use ./sapi/cli/php
-
- * NEWS:
- update
-
- * sapi/cli/php_cli.c:
- more ini defaults for error message handling
-
- * main/main.c:
- cleanup
-
-2003-03-30 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/mysqli_profiler.h:
- changed macro
-
-2003-03-30 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * tests/classes/interface_doubled.phpt:
- bugfix #22961 by cynic@php.net
-
- * sapi/cli/php_cli.c:
- simplify and fix
-
- * sapi/cli/TODO:
- done
-
-2003-03-30 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ext/mysqli/config.m4:
- --+_
-
-2003-03-30 Shane Caraveo <shane@caraveo.com>
-
- * run-tests2.php:
- uncomment removal of temp file
- update changes from run-tests
-
- * sapi/isapi/php4isapi.c:
- clean up url handling with path_info
- handle sending a 404 if the requested file does not exist
-
- * main/php_variables.c:
- _SERVER also should not be quoted by magic_quotes_GPC
- also remove an empty if statement
-
-2003-03-29 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/var.c:
- Improved var_dump() and debug_zval_dump() so they also show the
- namespace of the given object.
-
-2003-03-29 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * main/php_ini.c:
- fix phpinfo() & php -i
-
- * sapi/cli/php_cli.c:
- use sizeof() as suggested by Andrei
-
-2003-03-29 Derick Rethans <d.rethans@jdimedia.nl>
-
- * sapi/cli/php_cli.c:
- - html errors should default to off (0) in CLI
-
-2003-03-29 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * sapi/cgi/cgi_main.c:
- Fixed too optimized part
-
- * sapi/cgi/cgi_main.c:
- CS & WS fixes
-
- * (PHP_4_3)
- configure.in:
- MFH(r-1.436): improved bison check; now configure accepts 1.28, 1.35 and
- 1.75
- only.
-
- * configure.in:
- Improved bison check; now configure accepts 1.28, 1.35, and 1.75 only.
-
- * (PHP_4_3)
- ext/mbstring/tests/mb_parse_str.phpt
- ext/mbstring/tests/mb_parse_str02.phpt:
- MFH: fixed test cases so it wouldn't be failed in case register_globals=on
-
- * ext/mbstring/tests/mb_parse_str.phpt
- ext/mbstring/tests/mb_parse_str02.phpt:
- Fixed test cases so they wouldn't be failed in case register_globals=on
-
-2003-03-29 Sterling Hughes <sterling@bumblebury.com>
-
- * Makefile.global
- acinclude.m4
- configure.in
- sapi/apache/apMakefile.tmpl
- sapi/apache/config.m4
- sapi/apache/libphp4.module.in
- sapi/apache/libphp5.module.in
- sapi/apache/mod_php4.c
- sapi/apache/mod_php4.exp
- sapi/apache/mod_php4.h
- sapi/apache/mod_php5.c
- sapi/apache/mod_php5.exp
- sapi/apache/mod_php5.h
- sapi/apache/php.sym
- sapi/apache/php_apache_http.h
- sapi/apache2filter/config.m4
- sapi/apache2filter/php.sym
- sapi/apache2filter/php_apache.h
- sapi/apache2filter/sapi_apache2.c
- sapi/apache2handler/config.m4
- sapi/apache2handler/php.sym
- sapi/apache2handler/php_apache.h
- sapi/apache2handler/sapi_apache2.c:
- update php module name to php5, not php4.
- apache, apache2* and cli/cgi work.
- sapi module maintainers should fix up their sapis, as I don't run
- any servers with php outside of apache.
-
-2003-03-28 Derick Rethans <d.rethans@jdimedia.nl>
-
- * run-tests.php:
- - Add the exponent to the float modifier
-
-2003-03-28 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * tests/classes/interfaces_001.phpt
- tests/classes/interfaces_002.phpt:
- fix these tests
-
-2003-03-28 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * sapi/cgi/cgi_main.c:
- Do the right fix..
-
- * sapi/cgi/cgi_main.c:
- Fixed bug #22773
-
- * main/php_variables.c:
- On 64bit platforms, pointers are 64bit long..
-
-2003-03-28 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/file.c:
- CS
-
-2003-03-28 David Hill <David.Hill@hp.com>
-
- * ext/standard/parsedate.y:
- Changing parsedate to be reentrant using pure_parser (Dave)
-
-2003-03-28 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/mbstring/mbstring.c:
- Removed redundant aliases & CS fix.
-
-2003-03-27 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * main/php_variables.c:
- Improved php_import_environment_variables: avoid emalloc()ing in most cases
-
-2003-03-27 Harald Radi <harald.radi+coding.php@nme.at>
-
- * ext/rpc/com/com_wrapper.c:
- MFB ext/com
- fix #22899
- invoke is called twice
-
-2003-03-27 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/array.c:
- CS
-
-2003-03-27 David Hill <David.Hill@hp.com>
-
- * configure.in:
- Correcting checking of flex version (dave)
-
-2003-03-27 Shane Caraveo <shane@caraveo.com>
-
- * sapi/cgi/cgi_main.c
- sapi/isapi/php4isapi.c:
- handle invalid paths passed to us from iis
-
-2003-03-27 David Hill <David.Hill@hp.com>
-
- * ext/standard/tests/time/002.phpt:
- Backing out part of TZ change
-
-2003-03-27 Edin Kadribasic <edink@proventum.net>
-
- * (PHP_4_3)
- NEWS:
- BFN
-
- * ext/mysql/libmysql/config-win.h:
- MFB
-
- * (PHP_4_3)
- ext/mysql/libmysql/config-win.h:
- Fixed bug #22083.
-
-2003-03-27 Jani Taskinen <sniper@iki.fi>
-
- * sapi/apache2handler/sapi_apache2.c:
- CS fix
-
-2003-03-27 Ian Holsman <Ian@holsman.net>
-
- * sapi/apache2handler/sapi_apache2.c:
- change to a pool-based bucket instead of a transient one.
-
- * sapi/apache2handler/sapi_apache2.c:
- remove flush from standard unbuffered write.
- people requiring a flush can turn implicit flush on.
- Thanks ilia for benchmarking this!
-
-2003-03-26 Sterling Hughes <sterling@bumblebury.com>
-
- * main/fopen_wrappers.c:
- really fix
-
- * main/fopen_wrappers.c:
- fix segfault
-
-2003-03-26 Martin Jansen <mail@martin-jansen.de>
-
- * pear/PEAR/Common.php:
- - Silence warning
-
-2003-03-26 David Croft <david@infotrek.co.uk>
-
- * NEWS:
- a missing piece of news
-
-2003-03-26 David Hill <David.Hill@hp.com>
-
- * ext/standard/tests/time/002.phpt
- ext/standard/tests/time/idate.phpt
- ext/standard/tests/time/mktime.phpt:
- Changing TZ to match Unix98 standard to make Tru64 happy
-
-2003-03-26 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ext/rpc/com/com.c
- ext/rpc/com/conversion.c
- ext/rpc/com/conversion.h
- ext/rpc/com/dispatch.c
- ext/rpc/com/variant.c
- main/main.c:
- Eliminate TSRMLS_FETCH() calls in destroy_op_array() and
- zend_get_class_entry().
-
- * win32/php_modules.dsw:
- Leftover.
-
- * ext/gd/gd.c:
- Eliminate TSRMLS_FETCH() call in php_find_gd_font().
-
-2003-03-25 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * (PHP_4_3)
- ext/sockets/sockets.c:
- Make sure we never pass a negative arg to emalloc
- (once again, this API needs to be fixed, so this is just for 4.3)
-
- * (PHP_4_3)
- ext/sockets/sockets.c:
- Restrict this function to a max of 65k io vectors to avoid weird
- overflows. Purely an arbitrary number. This API needs cleaning up,
- but it would break BC and I don't want to do that in 4.3.
-
-2003-03-25 Ilia Alshanetsky <ilia@prohost.org>
-
- * sapi/apache2handler/php_functions.c:
- Added missing initialization, which causes AP2 to crash on startup in ZTS.
-
-2003-03-25 Martin Jansen <mail@martin-jansen.de>
-
- * pear/scripts/pear.bat:
- - Changing to DOS line breaks.
-
-2003-03-25 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- acinclude.m4
- configure.in:
- MFH: Made "--with-pear" "--disable-all"-aware. Plus some cosmetics fixes.
-
- * acinclude.m4
- configure.in:
- Made "--with-pear" "--disable-all"-aware. Plus some cosmetics fixes.
-
- * php.ini-dist
- php.ini-recommended:
- MFB
-
-2003-03-25 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * win32/php5ts.dsw:
- Leftover.
-
-2003-03-25 Edin Kadribasic <edink@proventum.net>
-
- * sapi/apache2handler/apache_config.c
- sapi/apache2handler/php4apache2.dsp
- sapi/apache2handler/php_functions.c
- sapi/apache2handler/sapi_apache2.c:
- MFB and more. Fixed various win32 compilation issues. Also the sapi
- is now built as php4apach2.dll since the filter is being obsoleted.
-
- * sapi/apache2filter/php4apache2.dsp:
- MFB: Disable building of apache2filter (obsoleted by handler).
-
- * ext/gd/gd.dsp
- ext/gd/gd_bundled.dsp:
- MFB: php_gd.dll is no longer bult and the bundled library is always used.
-
- * php.ini-dist
- php.ini-recommended:
- MFB
-
- * (PHP_4_3)
- php.ini-dist
- php.ini-recommended:
- php_fbsql.dll hasn't been successfully built at least from 4.1.x.
- Related to #22859.
-
-2003-03-25 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ext/ftp/ftp.c
- ext/pcre/php_pcre.c
- ext/pcre/php_pcre.h
- ext/session/session.c
- ext/standard/aggregation.c
- ext/standard/basic_functions.c
- ext/standard/credits.c
- ext/standard/credits.h
- ext/standard/css.c
- ext/standard/css.h
- ext/standard/datetime.c
- ext/standard/datetime.h
- ext/standard/head.c
- ext/standard/head.h
- ext/standard/info.c
- ext/standard/info.h
- ext/standard/levenshtein.c
- main/output.c
- main/php_variables.c
- sapi/apache/php_apache.c
- sapi/apache2handler/php_functions.c
- sapi/apache_hooks/php_apache.c
- sapi/cgi/cgi_main.c
- sapi/cli/php_cli.c
- sapi/servlet/servlet.c:
- Eliminate some TSRMLS_FETCH() calls. Tested with Win32 build of SAPI/CGI
- and SAPI/CLI on Win32.
-
-2003-03-25 Shane Caraveo <shane@caraveo.com>
-
- * README.TESTING2
- run-tests-config.php
- run-tests2.php
- sapi/tests/test001.phpt
- sapi/tests/test002.phpt
- sapi/tests/test003.phpt
- sapi/tests/test004.phpt
- sapi/tests/test005.phpt
- sapi/tests/test006.phpt
- sapi/tests/test007.phpt:
- many new enhancements to run-tests that allow for testing cgi and other
- sapi modules via http. see README.TESTING2 for more details
- several sapi tests added
-
- * sapi/cgi/cgi_main.c:
- use the correct flush on deactivate
- add some code to make debugging iis 5 cgi easier
-
-2003-03-25 Jani Taskinen <sniper@iki.fi>
-
- * sapi/apache2filter/php_functions.c
- sapi/apache2handler/php_functions.c:
- - This is not supposed to be 'pretty' name. (ref. bug #22853)
-
-2003-03-25 Ilia Alshanetsky <ilia@prohost.org>
-
- * sapi/apache2handler/sapi_apache2.c:
- Fixed bug #22805 (Reading of user input could stop prematurely).
-
-2003-03-24 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- reorder
-
-2003-03-24 Edin Kadribasic <edink@proventum.net>
-
- * ext/gettext/gettext.dsp:
- MFB
-
- * (PHP_4_3)
- ext/gettext/gettext.dsp:
- Patch by Nathan Fredrickson <nathan@silverorange.com>:
-
- Remove unneeded library from the link stage and add a couple of missing
- defines which are part of libintl.
-
-2003-03-24 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- ext/mbstring/mbfilter.c
- ext/mbstring/mbstring.h
- ext/standard/html.c:
- MFH: fixed bug #22834 (compile failure due to ugly implicit casts)
-
- * ext/mbstring/mbfilter.c
- ext/mbstring/mbstring.h
- ext/standard/html.c:
- Fixed bug #22834 (compile failure due to ugly implicit casts)
-
- * (PHP_4_3)
- NEWS:
- NFN
-
-2003-03-24 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * (PHP_4_3)
- ext/sockets/sockets.c:
- Fix arg list segfault
-
-2003-03-24 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/tests/strings/htmlentities16.phpt:
- oops...
-
- * (PHP_4_3)
- ext/standard/tests/strings/htmlentities15.phpt
- ext/standard/tests/strings/htmlentities16.phpt:
- MFH(initial): added test cases for new functionality
-
- * ext/standard/tests/strings/htmlentities15.phpt
- ext/standard/tests/strings/htmlentities16.phpt:
-
- Added test cases for new functionality
-
- * (PHP_4_3)
- ext/standard/html.c:
- MFH(r-1.76): added koi8-r, cp866, and cp1251 support for htmlentities()
- Patch by Antony Dovgal <tony2001 at phpclub dot net>
-
- * ext/standard/html.c:
- Added koi8-r, cp866, and cp1251 support for htmlentities
-
-2003-03-24 James Cox <james@imajes.info>
-
- * NEWS:
- test + remove 4
-
-2003-03-24 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/mysql/libmysql/mysys_err.h:
- Added missing header that prevents successful compilation.
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
-2003-03-24 Jani Taskinen <sniper@iki.fi>
-
- * README.EXT_SKEL:
- fix bug #22841
-
- * sapi/isapi/php4isapi.c:
- This is AUTH_TYPE in every other SAPI.
-
- * (PHP_4_3)
- NEWS:
- blah..
-
-2003-03-24 Uwe Schindler <uwe@thetaphi.de>
-
- * sapi/nsapi/nsapi.c
- sapi/nsapi/nsapi.c:
- PHP_WIN32 included
-
-2003-03-24 Jani Taskinen <sniper@iki.fi>
-
- * ext/oci8/config.m4:
- Fixed bug #18640 properly
-
-2003-03-24 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/mysqli_fe.c:
- changed method name
-
-2003-03-23 Alex Waugh <alex@alexwaugh.com>
-
- * ext/standard/php_fopen_wrappers.h:
- Fix linkage of symbols.
-
-2003-03-23 Shane Caraveo <shane@caraveo.com>
-
- * sapi/cgi/cgi_main.c:
- For fastcgi env vars, don't magic quote them
-
- * ext/standard/proc_open.c
- main/php_variables.c:
- The environment should *never* be magic quoted.
-
-2003-03-23 Wez Furlong <wez.php@thebrainroom.net>
-
- * (PHP_4_3)
- ext/curl/config.m4:
- MFH curl detection when multiple installations exist
-
- * ext/curl/config.m4:
- Fix curl detection when multiple installations exist
-
-2003-03-23 Sterling Hughes <sterling@bumblebury.com>
-
- * configure.in:
- add a standard Exception class.
-
-2003-03-23 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/calendar/jewish.c:
- Added some compiler check
-
-2003-03-22 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- ext/calendar/jewish.c:
- MFH(r-1.5): fixed win32 build with non-SBCS locale settings.
-
- * ext/calendar/jewish.c:
- Fixed win32 build, which fails with non-SBCS-compatible locale settings.
-
-2003-03-22 Shane Caraveo <shane@caraveo.com>
-
- * main/php_ini.c:
- Fix PHPRC overriding other ini files. This is how PHPRC worked prior to
- 4.3.x, and is usefull for applications that execute PHP and want to
- emulate CGI and define alternate INI files (ie. cannot use -c).
-
-2003-03-22 David Croft <david@infotrek.co.uk>
-
- * ChangeLog:
-
-
-2003-03-21 Sterling Hughes <sterling@bumblebury.com>
-
- * ext/standard/file.c:
- fix segfault in file_set_contents() when the file could not successfully
- be opened.
-
-2003-03-21 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/mysqli/mysqli.c:
- Add missing initialization
-
-2003-03-21 James Cox <james@imajes.info>
-
- * run-tests.php:
- updating for new list
-
-2003-03-21 Stig Bakken <ssb@fast.no>
-
- * pear/PEAR/Builder.php:
- - abort install when an extension fails to build (patch by ja at
- morrdusk dot net)
-
-2003-03-21 Sterling Hughes <sterling@bumblebury.com>
-
- * ext/xml/xml.c:
- This broke the xml extension, and pres2, commented out for now
-
-2003-03-20 Hartmut Holzgraefe <hartmut@six.de>
-
- * scripts/ext_skel_ng/extension_parser.php:
- protect string from CVS keyword expansionCVS:
- ----------------------------------------------------------------------
-
-2003-03-20 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/mysqli/mysqli_profiler.c:
- missing TSRMLS_FETCH
-
- * ext/dba/dba.c:
- CS
-
-2003-03-20 Christian Stocker <chregu@phant.ch>
-
- * ext/domxml/php_domxml.c
- ext/domxml/php_domxml.c:
- fix for bug #22786 ("Crash when trying to call DomAttribute's set_namespace
- method")
-
-2003-03-20 Jani Taskinen <sniper@iki.fi>
-
- * ext/domxml/php_domxml.c:
- WS & CS fixes..
-
-2003-03-20 Wez Furlong <wez.php@thebrainroom.net>
-
- * main/streams/streams.c:
- Fix for persistent stream shutdown under debug builds
-
-2003-03-20 Jani Taskinen <sniper@iki.fi>
-
- * ext/gd/gd.c:
- CS fix
-
-2003-03-20 Wez Furlong <wez.php@thebrainroom.net>
-
- * (PHP_4_3)
- main/streams.c:
- Fix for persistent stream shutdown in debug builds.
-
-2003-03-20 Jani Taskinen <sniper@iki.fi>
-
- * ext/bcmath/bcmath.c
- ext/bz2/bz2.c
- ext/dio/dio.c
- ext/gd/gd.c:
- WS & CS fixes
-
-2003-03-19 Jani Taskinen <sniper@iki.fi>
-
- * ext/mysqli/config.m4:
- Better config.m4..
-
- * ext/tokenizer/tokenizer.c:
- And this too..
-
- * ext/tokenizer/tokenizer.c:
- Andrei forgot this..
-
-2003-03-19 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * sapi/cli/php_cli.c:
- - reenable $argc/$argv
- - add a comment where hardcoded defaults would go
-
-2003-03-19 Wez Furlong <wez.php@thebrainroom.net>
-
- * (PHP_4_3)
- main/streams.c:
- This little fragment didn't get merged from head...
-
-2003-03-19 David Hill <David.Hill@hp.com>
-
- * README.TESTING:
- Correcting example to use proper variable - NO_INTERACTION
-
-2003-03-19 Jani Taskinen <sniper@iki.fi>
-
- * php.ini-dist
- php.ini-recommended:
- Using of quotes around paths is a very good idea..
-
- * (PHP_4_3)
- NEWS:
- BFN
-
- * (PHP_4_3)
- main/main.c:
- MFH: Fixed bug #22775 (Fatal errors exit with status 0 with CGI/CLI)
-
- * main/main.c:
- Fixed bug #22775 (Fatal errors exit with status 0 with CGI/CLI)
-
-2003-03-19 Wez Furlong <wez.php@thebrainroom.net>
-
- * (PHP_4_3)
- main/streams.c:
- Fix my fix.
-
- * (PHP_4_3)
- main/streams.c:
- Manual merge of persistent stream sanity check from php5.
-
- * main/streams/streams.c:
- Sanity check for when a stream is requested to be persistent but the
- wrapper
- does not respect the flag.
-
-2003-03-18 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/streamsfuncs.c:
- Add the mode string that was used to open the stream to the meta data,
- as requested by Philip Olson.
-
- * (PHP_4_3)
- main/php_streams.h
- main/streams.c:
- Manual merge of the persistent plain file streams code.
- See http://news.php.net/article.php?group=php.cvs&article=19680 for
- more information.
-
- * ext/standard/php_fopen_wrapper.c
- main/php_streams.h
- main/streams/php_stream_plain_wrapper.h
- main/streams/plain_wrapper.c:
- Implement persistent plain file streams.
-
- Usage:
-
- php_stream *stream = php_stream_fopen("/path/to/file", "r+b", NULL,
- STREAM_OPEN_PERSISTENT | ENFORCE_SAFE_MODE | REPORT_ERRORS);
-
- the filename and mode are combined to form the hash key for the persistent
- list; they must be identical for this same stream to be returned again in
- the
- next request.
-
- Calling php_stream_close() on a persistent stream *will* close it, as is
- usual with all persistent resources in PHP/ZE.
-
- This is deliberately *not* exposed to user-space PHP at this time.
-
- * main/streams/streams.c:
- Q}
-
- * (PHP_4_3)
- main/streams.c:
- WS Fix: I forgot to apply Q} to my comment.
-
-2003-03-18 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * main/main.c:
- -turn html_errors on by default again
- -disbale clickable error messages by docref_root default to ''
-
-2003-03-18 Jay Smith <jsmith@tutorbuddy.com>
-
- * ext/standard/browscap.c:
- get_browser() needs to use zend_is_auto_global() on _SERVER.
-
-2003-03-18 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/standard/info.c
- main/SAPI.h
- sapi/cli/php_cli.c:
- make phpinfo() depend on executed sapi
-
-2003-03-18 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/gd/libgd/gdxpm.c:
- Cleanup.
-
-2003-03-18 Jani Taskinen <sniper@iki.fi>
-
- * ext/ftp/ftp.c:
- Fixed bug #22765
-
-2003-03-18 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/php_fopen_wrapper.c
- main/php_open_temporary_file.c
- main/php_open_temporary_file.h
- main/streams/plain_wrapper.c:
- Avoid using FILE* where possible.
- Tidy up handling of potential error situations for the php:// wrapper.
-
- * (PHP_4_3)
- main/php_open_temporary_file.c
- main/php_open_temporary_file.h
- main/php_streams.h
- main/streams.c:
- Avoid using FILE* unless we have to.
-
-2003-03-18 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * sapi/cli/php_cli.c:
- use new callback to overwrite ini settings
-
- * main/SAPI.h
- main/php_ini.c:
- give sapi modules the possibility to overwrite default ini settings
-
-2003-03-18 Wez Furlong <wez.php@thebrainroom.net>
-
- * (PHP_4_3)
- NEWS:
- BFN
-
- * ext/openssl/xp_ssl.c
- main/streams/xp_socket.c:
- avoid unsigned issues.
-
- * (PHP_4_3)
- main/streams.c:
- Fix my 64-bit casting fix.
- MFH Fix for #22721 - poor performance for file() on systems without mmap
- support.
-
- * ext/standard/file.c:
- CS fixes
-
- * main/streams/streams.c:
- Fix for #22721 (poor file() performance on systems without mmap)
-
-2003-03-18 Stig Bakken <ssb@fast.no>
-
- * run-tests.php
- run-tests2.php
- build/buildcheck.sh
- ext/gd/gd.c
- ext/gd/php_gd.h
- ext/iconv/iconv.c
- ext/iconv/php_iconv.h
- ext/oci8/oci8.c
- ext/oci8/php_oci8.h
- ext/odbc/php_odbc.c
- ext/odbc/php_odbc.h
- ext/odbc/php_odbc_includes.h
- ext/oracle/oracle.c
- ext/standard/file.c
- ext/standard/formatted_print.c
- ext/standard/math.c
- ext/standard/php_ext_syslog.h
- ext/standard/php_math.h
- ext/standard/php_string.h
- ext/standard/php_versioning.h
- ext/standard/string.c
- ext/standard/syslog.c
- ext/standard/uniqid.c
- ext/standard/uniqid.h
- ext/standard/versioning.c
- ext/xml/php_xml.h
- ext/xml/xml.c
- main/build-defs.h.in
- main/php_ticks.c
- main/php_ticks.h
- main/snprintf.h
- pear/PEAR.php
- pear/System.php
- pear/package.dtd
- pear/OS/Guess.php
- pear/PEAR/Autoloader.php
- pear/PEAR/Builder.php
- pear/PEAR/Command.php
- pear/PEAR/Common.php
- pear/PEAR/Config.php
- pear/PEAR/Dependency.php
- pear/PEAR/Installer.php
- pear/PEAR/Packager.php
- pear/PEAR/Registry.php
- pear/PEAR/Remote.php
- pear/PEAR/Command/Auth.php
- pear/PEAR/Command/Build.php
- pear/PEAR/Command/Common.php
- pear/PEAR/Command/Config.php
- pear/PEAR/Command/Install.php
- pear/PEAR/Command/Package.php
- pear/PEAR/Command/Registry.php
- pear/PEAR/Command/Remote.php
- pear/PEAR/Frontend/CLI.php
- pear/scripts/pear.in
- pear/scripts/pearwin.php
- sapi/apache/php_apache.c
- sapi/apache/php_apache_http.h
- sapi/apache/sapi_apache.c
- sapi/apache_hooks/php_apache.c
- sapi/apache_hooks/sapi_apache.c
- sapi/cgi/cgi_main.c:
- - email address change
-
-2003-03-18 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS
- NEWS:
- BFN
-
- * (PHP_4_3)
- ext/gd/config.m4
- ext/gd/gdcache.c:
- MFH: Fixed bug #22751 (Compile error in gdcache when external libgd is
- used)
-
- * ext/gd/config.m4
- ext/gd/gdcache.c:
- Fixed bug #22751 (Compile error in gdcache when external libgd is used)
-
- * sapi/apache2handler/sapi_apache2.c:
- whitespace..
-
-2003-03-17 Ilia Alshanetsky <ilia@prohost.org>
-
- * main/streams/streams.c:
- Win32 build fix.
-
-2003-03-17 Ian Holsman <Ian@holsman.net>
-
- * sapi/apache2handler/sapi_apache2.c:
- PR#22672 - User not logged under Apache2
- patch provided by Andrew Bradford.
-
-2003-03-17 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * main/streams/streams.c:
- Fixed bug #22538 (failed stat on stdio/stdin/stderr streams).
-
-2003-03-17 Jani Taskinen <sniper@iki.fi>
-
- * ext/sybase_ct/config.m4:
- Fix the bad logic..
-
- * (PHP_4_3)
- NEWS:
- BFN
-
- * ext/curl/interface.c
- ext/curl/multi.c
- ext/curl/streams.c
- ext/zlib/zlib.c
- ext/zlib/zlib_fopen_wrapper.c:
- WS & CS fixes
-
-2003-03-17 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/gd/gd.c:
- fixing my proto fix :|
-
-2003-03-17 Wez Furlong <wez.php@thebrainroom.net>
-
- * acinclude.m4
- configure.in
- main/main.c
- main/safe_mode.c:
- Fix for Bug #21310, based on a patch by jflemer@php.net.
-
-2003-03-17 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/curl/multi.c
- ext/fdf/fdf.c
- ext/ncurses/ncurses_functions.c
- ext/standard/aggregation.c
- ext/standard/dns.c:
- proto fixes
-
- * ext/db/db.c
- ext/dbx/dbx.c
- ext/gd/gd.c
- ext/ircg/ircg.c
- ext/zlib/zlib.c:
- proto fix
-
- * ext/mysqli/mysqli_api.c:
- more proto fixes
-
-2003-03-17 Jani Taskinen <sniper@iki.fi>
-
- * run-tests.php:
- Be sure we get the correct version..
-
- * run-tests.php:
- added the version info to be send as-is to buildtest-process
-
- * (PHP_4_3)
- NEWS:
- Note about apache2 change
-
-2003-03-16 Sascha Schumann <sascha@schumann.cx>
-
- * (PHP_4)
- ext/standard/php_smart_str.h:
- Preserve explicit casting semantics from functions, so that you can
- also pass void pointers to the macros.
-
- * ext/standard/php_smart_str.h:
- Merge macro changes
-
-2003-03-16 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * php.ini-dist
- php.ini-recommended
- main/main.c:
- - disable html_errors per default as suggested by php.ini-<xxx>
- - new error format that does not point to any documentation (if either
- not html_errors or no docref_root given e.g.: production boxes and
- default)
- - documentation update in php.ini-<xxx>
-
-2003-03-16 Jani Taskinen <sniper@iki.fi>
-
- * ext/interbase/interbase.c:
- WS & CS fixes + some TSRM_FETCH() removals + pval -> zval
-
- * (PHP_4_3)
- NEWS
- ext/interbase/interbase.c:
- MFH: - Fixed bug #22709 (crash within interbase when database unavailable)
-
- * ext/interbase/interbase.c:
- - Fixed bug #22709 (crash within interbase when database unavailable)
-
-2003-03-15 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * tests/lang/bug22592.phpt:
-
- Added test for bug22592
-
-2003-03-15 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/mysqli/mysqli_api.c
- ext/mysqli/mysqli_nonapi.c
- ext/mysqli/mysqli_profiler.c:
- lots of proto stuff
-
- * scripts/ext_skel_ng/extension_parser.php:
- docbook fixes
-
- * scripts/ext_skel_ng/php_constant.php:
- thinko fix to kill warnings
-
- * scripts/ext_skel_ng/php_resource.php:
- docbook typo fix
-
- * scripts/ext_skel_ng/php_function.php:
- make sure the function name in the proto matches the function
-
-2003-03-15 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * main/main.c:
- fix Bug #21751 - the parameter was wrong when this code was introduced
-
-2003-03-15 Wez Furlong <wez.php@thebrainroom.net>
-
- * main/streams/cast.c
- main/streams/plain_wrapper.c
- main/streams/xp_socket.c:
- 64bit fixes
-
- * ext/openssl/openssl.c:
- fix proto
-
- * (PHP_4_3)
- main/network.c
- main/streams.c:
- 64 bit fixes
-
-2003-03-15 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- And this never existed in any release either..
-
- * (PHP_4_3)
- php.ini-dist
- php.ini-recommended:
- MFH: "allow_webdav_methods" does not exist / is not needed anymore
-
- * php.ini-dist
- php.ini-recommended:
- "allow_webdav_methods" does not exist / is not needed anymore
-
-2003-03-14 Jay Smith <jsmith@tutorbuddy.com>
-
- * ext/standard/browscap.c:
-
-
-2003-03-14 Jani Taskinen <sniper@iki.fi>
-
- * ext/mssql/php_mssql.c:
- No c++ comments
-
- * sapi/tux/php_tux.c:
- no c++ comments
-
- * ext/interbase/interbase.c:
- No c++ comments!
-
-2003-03-14 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * tests/lang/bug19943.phpt:
- Fixed typo
-
-2003-03-14 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/gd/libgd/gd_gd.c
- ext/gd/libgd/gd_gd2.c
- ext/gd/libgd/gd_png.c
- ext/gd/libgd/gd_ss.c
- ext/gd/libgd/gd_wbmp.c:
- Whitespace fixes.
-
-2003-03-14 Derick Rethans <d.rethans@jdimedia.nl>
-
- * (PHP_4_3)
- NEWS:
- - Explain that it is interbase related (Thanks to Andrey)
-
- * (PHP_4_3)
- NEWS:
- - BFN
-
-2003-03-14 Daniela Mariaschi <mariaschi@libero.it>
-
- * (PHP_4_3)
- ext/interbase/config.m4:
- reverting to 1.8.4.1
-
- * ext/interbase/config.m4:
- reverting to version 1.9
-
-2003-03-13 Daniela Mariaschi <mariaschi@libero.it>
-
- * ext/interbase/config.m4:
- Test for libgds needs libcrypt with Firebird to succeed
-
-2003-03-13 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- BFN shortening
-
- * NEWS:
- this is in the PHP_4_3 branch...
-
-2003-03-13 Edin Kadribasic <edink@proventum.net>
-
- * (PHP_4_3)
- NEWS
- php.ini-dist
- php.ini-recommended:
- Document removal of gd1 support on windows.
-
- * (PHP_4_3)
- ext/gd/gd.dsp
- ext/gd/gd_bundled.dsp:
- Drop support for php_gd.dll (gd1).
- The default build (gd.dsp) is now bundled gd2.
-
- * (PHP_4_3)
- sapi/apache2filter/php4apache2.dsp:
- Disable building of apache2filter (obsoleted by handler).
-
-2003-03-13 Daniela Mariaschi <mariaschi@libero.it>
-
- * (PHP_4_3)
- ext/interbase/interbase.c:
- Numeric/decimal datatype overflow on Win32
- Fixed bug #20641
-
-2003-03-13 Edin Kadribasic <edink@proventum.net>
-
- * (PHP_4_3)
- sapi/apache2handler/php4apache2.dsp
- sapi/apache2handler/php_functions.c:
- Make apache2 handler produce php4apache2.dll which should work as a
- drop in replacement for the filter. Remove max_request_per_child from
- minfo() since that function is not exported by win32 version of apache2
- lib.
-
-2003-03-13 Daniela Mariaschi <mariaschi@libero.it>
-
- * ext/interbase/interbase.c:
- Numeric/decimal datatype overflow on Win32.
- Fixed bug #20641
-
-2003-03-13 Martin Jansen <mail@martin-jansen.de>
-
- * (PHP_4_3)
- pear/PEAR.php:
- - Also fix #21845 in the release branch.
-
-
-2003-03-13 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/mcrypt/mcrypt.c:
- - Whitespace
-
-2003-03-13 Martin Jansen <mail@martin-jansen.de>
-
- * pear/PEAR.php:
- - Fixing bug #21845.
-
-2003-03-13 Sara Golemon <php@alphaweb.net>
-
- * NEWS
- NEWS:
- BFN
-
-2003-03-13 J Smith <jsmith@tutorbuddy.com>
-
- * ext/standard/tests/time/002.phpt:
- Solaris knows nothing of "Europe/Amsterdam". Use "US/Eastern" instead.
-
-2003-03-13 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * ext/curl/interface.c:
- Fixed bug #22681 (Crash when reading from invalid file pointer).
-
-2003-03-13 Jani Taskinen <sniper@iki.fi>
-
- * ext/sybase_ct/config.m4:
- Prevent using both --with-sybase and --with-sybase-ct in same build
-
- * NEWS:
- hrm
-
-2003-03-13 Sara Golemon <php@alphaweb.net>
-
- * ext/gmp/gmp.c:
- Bug #21534. Silly typo.
-
-2003-03-13 Hartmut Holzgraefe <hartmut@six.de>
-
- * README.EXT_SKEL:
- advertising ext_skel_ng ;)
-
-2003-03-13 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/gd/libgd/gd_io.c
- ext/gd/libgd/gd_io.h
- ext/gd/libgd/gd_io_dp.c
- ext/gd/libgd/gd_io_file.c
- ext/gd/libgd/gd_io_ss.c:
- Cleanup.
-
-2003-03-12 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- We should get this out before April..
-
- * (PHP_4_3)
- configure.in
- main/php_version.h:
- - Backup to 4.3.2RC
-
- * (PHP_4_3)
- configure.in
- main/php_version.h:
- - Bump the version to RC1.
-
-2003-03-12 Stefan Esser <s.esser@e-matters.de>
-
- * main/main.c:
- reverting half the patch (it is not that simple)
-
-2003-03-12 Sterling Hughes <sterling@bumblebury.com>
-
- * ext/standard/basic_functions.c
- ext/standard/file.c
- ext/standard/file.h:
-
-
-2003-03-12 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/odbc/php_odbc.c:
- Fixed spprintf() usage.
- Fixed compiler warnings.
-
-2003-03-12 Jani Taskinen <sniper@iki.fi>
-
- * ext/gd/gd.c:
- Added the type constants for imagegd2()
-
- * ext/gd/gd.c
- ext/gd/gd_ctx.c:
- Fix bug #22646
-
- * acinclude.m4:
- prevent warning
-
- * NEWS:
- This was merged into PHP_4_3 branch..
-
-2003-03-12 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/gd/libgd/gd.c
- ext/gd/libgd/xbm.c:
- Style fixes.
-
-2003-03-12 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * tests/classes/interface_class.phpt
- tests/classes/interface_doubled.phpt
- tests/classes/interface_implemented.phpt
- tests/classes/interface_instantiate.phpt
- tests/classes/interface_member.phpt
- tests/classes/interface_method.phpt
- tests/classes/interface_method_final.phpt
- tests/classes/interface_method_private.phpt
- tests/classes/interface_must_be_implemented.phpt:
- Added some interface tests
-
-2003-03-11 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- sapi/apache2handler/php_functions.c:
- OnUpdateLong is only in php5/HEAD. (oops! :)
-
-2003-03-11 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- ext/xml/expat/expat.h:
- Fixed bug #22634 (broken cygwin build)
-
-2003-03-11 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- This went to 4_3 branch
-
- * (PHP_4_3)
- NEWS
- NEWS:
- BFN
-
- * (PHP_4_3)
- ext/odbc/config.m4:
- MFH: - Fixed bug #20715 (odbc could not be compiled as shared extension)
-
- * ext/odbc/config.m4:
- - Fixed bug #20715 (odbc could not be compiled as shared extension)
-
-2003-03-11 Sascha Schumann <sascha@schumann.cx>
-
- * ext/standard/url_scanner_ex.c
- ext/standard/url_scanner_ex.c
- ext/standard/url_scanner_ex.c
- ext/standard/url_scanner_ex.re
- ext/standard/url_scanner_ex.re
- ext/standard/url_scanner_ex.re:
- fix sizeof(size_t) > sizeof(uint) issue
-
-2003-03-11 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- ext/imap/config.m4:
- MFH: Fixed bug #22616 (Wrong order of -lssl and -lcrypto with IMAP)
-
- * ext/imap/config.m4:
- Fixed bug #22616 (Wrong order of -lssl and -lcrypto with IMAP)
-
-2003-03-11 Sascha Schumann <sascha@schumann.cx>
-
- * ext/standard/url_scanner_ex.c
- ext/standard/url_scanner_ex.c
- ext/standard/url_scanner_ex.re
- ext/standard/url_scanner_ex.re:
- reverting jani's non-sense commits
-
-2003-03-11 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/config.m4:
- added new profiler-files
-
- * ext/mysqli/mysqli.c
- ext/mysqli/mysqli_api.c
- ext/mysqli/mysqli_nonapi.c
- ext/mysqli/mysqli_profiler.c
- ext/mysqli/mysqli_profiler.h
- ext/mysqli/mysqli_profiler_com.c
- ext/mysqli/mysqli_profiler_com.h
- ext/mysqli/php_mysqli.h:
- profiler:
- moved profiler stuff from php_mysql.h to separate include file
- added port communication
- added xml support for file and port output
-
-2003-03-10 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/url_scanner_ex.c:
- touch
-
- * ext/standard/url_scanner_ex.re:
- 64bit issue fixed
-
-2003-03-10 J Smith <jsmith@tutorbuddy.com>
-
- * tests/classes/__set__get_001.phpt:
- modified test to reflect change in var_dump().
-
-2003-03-10 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/tests/strings/bug22224.phpt
- tests/lang/bug22231.phpt:
- Modified the test to reflect the recent change on var_dump()
-
-2003-03-10 David Hill <David.Hill@hp.com>
-
- * ext/pgsql/pgsql.c
- ext/standard/url_scanner.c
- ext/standard/url_scanner_ex.c:
- Correcting int/long mismatched - 64bit issues.
-
-2003-03-10 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * ext/gd/libgd/gdft.c:
- Fixed bug #22613 (imagettfbox() does not add the kerning distance to the
- running position).
- Fixed few possible memory leaks.
-
-2003-03-10 David Hill <David.Hill@hp.com>
-
- * ext/ftp/php_ftp.c
- ext/ftp/php_ftp.c
- ext/sockets/sockets.c
- ext/sockets/sockets.c:
- fixing missed int to long with zend_parse_parameters
-
-2003-03-10 Andrei Zmievski <andrei@gravitonic.com>
-
- * ext/standard/var.c:
- Print the object handle (it's useful).
-
-2003-03-10 David Hill <David.Hill@hp.com>
-
- * ext/pfpro/php_pfpro.h
- ext/skeleton/php_skeleton.h
- ext/yaz/php_yaz.h
- ext/zlib/php_zlib.h
- main/php_globals.h:
- 64 bit corrections to parameters to OnUpdateInt Bug #20994 (Dave)
-
-2003-03-10 Jani Taskinen <sniper@iki.fi>
-
- * acinclude.m4
- configure.in:
- - Always use the shtool mkdir.
-
- * NEWS:
- this is in the 4_3 branch
-
-2003-03-10 David Hill <David.Hill@hp.com>
-
- * (PHP_4_3)
- ext/pfpro/php_pfpro.h
- ext/skeleton/php_skeleton.h
- ext/yaz/php_yaz.h
- ext/zlib/php_zlib.h
- main/php_globals.h:
- 64-bit corrections to parameters to OnUpdateInt Bug #20994 (Dave)
-
-2003-03-10 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- sapi/apache2filter/config.m4
- sapi/apache2handler/.cvsignore
- sapi/apache2handler/CREDITS
- sapi/apache2handler/EXPERIMENTAL
- sapi/apache2handler/README
- sapi/apache2handler/apache_config.c
- sapi/apache2handler/config.m4
- sapi/apache2handler/php.sym
- sapi/apache2handler/php4apache2.dsp
- sapi/apache2handler/php_apache.h
- sapi/apache2handler/php_functions.c
- sapi/apache2handler/sapi_apache2.c:
- - MFH: apache2handler sapi module
- - Changed apache2filter to use --with-apxs2filter
-
- * sapi/apache2filter/config.m4
- sapi/apache2handler/config.m4:
- - Changed --with-apxs2 for apache2handler.
-
-
-2003-03-10 Shane Caraveo <shane@caraveo.com>
-
- * (PHP_4_3)
- ext/standard/tests/time/mktime.phpt:
- fix line endings in file
-
- * (PHP_4_3)
- sapi/cgi/cgi_main.c:
- fix using stdin. This was already fixed in php5.
-
-2003-03-10 Jani Taskinen <sniper@iki.fi>
-
- * ext/fdf/fdf.c:
- cs & ws fixes
-
- * (PHP_4_3)
- ext/fdf/fdf.c:
- no c++ comments..
-
-2003-03-10 Shane Caraveo <shane@caraveo.com>
-
- * (PHP_4_3)
- ext/standard/tests/strings/bug21453.phpt:
- line endings on win32 made the var_dump'ed string 4 bytes longer. this
- should work on all platforms.
-
- * (PHP_4_3)
- ext/standard/tests/reg/009.phpt:
- splitting on whitespace will be different depending on platform, so be
- specific with the line ending.
-
- * (PHP_4_3)
- ext/standard/tests/file/fopencookie.phpt:
- make test happy by adding missing functions to avoid warnings, taken from
- user_stream.c
-
-2003-03-09 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/basic_functions.c
- ext/standard/basic_functions.h
- ext/standard/user_filters.c:
- Adjustment to user filters reimplementation. Make a bucket an object
- containing a resource(the real bucket) and a data element for direct
- operations. Simplifies
- user interface and reduces number of function calls/reallocs needed.
-
-2003-03-09 Derick Rethans <d.rethans@jdimedia.nl>
-
- * (PHP_4_3)
- ext/pgsql/pgsql.c:
- - No C++ comments! (Patch by Magnus)
-
-2003-03-09 Uwe Schindler <uwe@thetaphi.de>
-
- * sapi/nsapi/nsapi-readme.txt
- sapi/nsapi/nsapi-readme.txt:
- Changes for iPlanet Webserver 6
-
-2003-03-09 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/string.c:
- - Fix proto
-
-2003-03-08 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/mysqli.c
- ext/mysqli/mysqli_api.c
- ext/mysqli/mysqli_fe.c
- ext/mysqli/mysqli_nonapi.c
- ext/mysqli/mysqli_profiler.c
- ext/mysqli/php_mysqli.h:
- various changes for profiler
-
-2003-03-08 Derick Rethans <d.rethans@jdimedia.nl>
-
- * (PHP_4_3)
- NEWS
- ext/gd/gdttf.c:
- - MFH: Fixed a bug in GD's truecolor TTF handling.
-
- * ext/gd/gdttf.c:
- - Fixed a bug in GD's truecolor TTF handling
-
-2003-03-08 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * main/network.c:
- fix warnings - one left
-
- * run-tests.php:
- summary for selective tests if more than one
-
-
-2003-03-08 Stefan Esser <s.esser@e-matters.de>
-
- * main/main.c:
- fix possible XSS in error messages
-
- * ext/standard/html.c:
- wrong place.
-
-2003-03-08 Sascha Schumann <sascha@schumann.cx>
-
- * (PHP_4)
- ext/standard/php_smart_str.h:
- macro-ize smart string implementation to improve optimization
- across single calls
-
-2003-03-08 Stefan Esser <s.esser@e-matters.de>
-
- * ext/standard/html.c:
- fixing memory leak
-
-2003-03-07 Jani Taskinen <sniper@iki.fi>
-
- * sapi/isapi/php4isapi.c:
- Fixed bug #22473 (ISAPI Secure Server Variables not available)
-
- * (PHP_4_3)
- NEWS:
- Added note about the 64bit fixes
-
- * NEWS:
- These will be already in 4.3.x
-
-2003-03-07 Uwe Schindler <uwe@thetaphi.de>
-
- * (PHP_4_3)
- sapi/nsapi/CREDITS:
- credits update
-
-2003-03-07 J Smith <jsmith@tutorbuddy.com>
-
- * tests/classes/interfaces_001.phpt
- tests/classes/interfaces_002.phpt
- tests/classes/type_hinting_001.phpt
- tests/lang/type_hints_001.phpt:
- Added tests for interfaces and class type hinting.
-
-2003-03-07 Ben Mansell <ben@zeus.com>
-
- * sapi/cgi/cgi_main.c:
- Fix bug whereby a webserver closing stdout from the CGI/FastCGI binary
- would cause PHP to get caught in an infinite loop of failing write()
- syscalls.
-
-2003-03-07 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * ext/ldap/ldap.c:
- Fixed bug #22585 (Do not terminate the script on minor errors).
-
- * sapi/apache2handler/php_functions.c:
- OnUpdateInt -> OnUpdateLong.
-
- * sapi/apache2handler/apache_config.c
- sapi/apache2handler/php_apache.h
- sapi/apache2handler/php_functions.c
- sapi/apache2handler/sapi_apache2.c:
- CS Fixes.
- Fixed a bug with 404 handling.
- Added more detailed Apache info for phpinfo().
- Added the support for last_modified.
-
-2003-03-07 David Hill <David.Hill@hp.com>
-
- * (PHP_4_3)
- ext/bz2/bz2.c
- ext/dio/dio.c
- ext/domxml/php_domxml.c
- ext/fdf/fdf.c
- ext/ftp/php_ftp.c
- ext/ldap/ldap.c
- ext/mcrypt/mcrypt.c
- ext/mhash/mhash.c
- ext/openssl/openssl.c
- ext/pgsql/pgsql.c
- ext/posix/posix.c
- ext/sockets/sockets.c
- ext/standard/exec.c
- ext/standard/file.c
- ext/standard/fsock.c
- ext/standard/head.c
- ext/standard/html.c
- ext/standard/metaphone.c
- ext/standard/string.c
- ext/sysvsem/sysvsem.c
- ext/zip/zip.c
- ext/zlib/zlib.c
- main/output.c:
- 64-bit correction to variables passed to zend_parse_parameters
-
-2003-03-07 Jani Taskinen <sniper@iki.fi>
-
- * configure.in:
- Create php_version.h in the correct directory
-
- * ext/fam/fam.c
- ext/fbsql/php_fbsql.c
- ext/hwapi/hwapi.cpp
- ext/hyperwave/hw.c
- ext/informix/ifx.ec
- ext/ingres_ii/ii.c
- ext/interbase/interbase.c
- ext/ircg/ircg.c
- ext/ldap/ldap.c
- ext/mbstring/mbstring.c
- ext/mssql/php_mssql.c
- ext/mysql/php_mysql.c
- ext/mysqli/mysqli.c
- ext/ncurses/ncurses.c
- ext/odbc/php_odbc.c
- ext/pfpro/pfpro.c
- ext/pgsql/pgsql.c
- ext/session/session.c
- ext/skeleton/skeleton.c
- ext/standard/assert.c
- ext/standard/file.c
- ext/sybase_ct/php_sybase_ct.c
- ext/sysvmsg/sysvmsg.c
- ext/tokenizer/tokenizer.c
- ext/yaz/php_yaz.c
- ext/zlib/zlib.c
- main/main.c
- netware/phplib.imp
- sapi/apache/php_apache.c
- sapi/apache_hooks/php_apache.c
- scripts/ext_skel_ng/extension_parser.php:
- Renamed OnUpdateInt -> OnUpdateLong to prevent further misunderstandings.
-
- * ext/odbc/config.m4:
- Fixed typo caught by Dave.
-
- * ext/sysvmsg/php_sysvmsg.h
- ext/sysvmsg/sysvmsg.c
- ext/sysvsem/sysvsem.c
- ext/sysvshm/php_sysvshm.h
- ext/sysvshm/sysvshm.c:
- WS & CS fixes
-
-2003-03-07 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * tests/classes/abstract.phpt
- tests/classes/abstract_class.phpt
- tests/classes/abstract_inherit.phpt
- tests/classes/abstract_not_declared.phpt
- tests/classes/abstract_static.phpt:
- abstract classes must now be declared abstract
-
-2003-03-06 David Hill <David.Hill@hp.com>
-
- * ext/bz2/bz2.c
- ext/dio/dio.c
- ext/domxml/php_domxml.c
- ext/fdf/fdf.c
- ext/ftp/php_ftp.c
- ext/iconv/iconv.c
- ext/ldap/ldap.c
- ext/mcrypt/mcrypt.c
- ext/mhash/mhash.c
- ext/openssl/openssl.c
- ext/pgsql/pgsql.c
- ext/posix/posix.c
- ext/sockets/sockets.c
- ext/standard/fsock.c
- ext/standard/head.c
- ext/standard/html.c
- ext/standard/metaphone.c
- ext/standard/string.c
- ext/sysvsem/sysvsem.c
- ext/zip/zip.c
- ext/zlib/zlib.c
- main/output.c:
- 64-bit correction to variables passed to zend_parse_parameters
-
-2003-03-06 Stefan Esser <s.esser@e-matters.de>
-
- * ext/cyrus/cyrus.c
- ext/db/db.c
- ext/domxml/php_domxml.c
- ext/fbsql/php_fbsql.c
- ext/gd/libgd/gdtestft.c
- ext/ming/ming.c
- ext/msession/msession.c
- ext/standard/basic_functions.c
- ext/standard/file.c
- ext/xslt/sablot.c
- ext/zlib/zlib.c
- main/main.c
- main/streams/streams.c
- sapi/servlet/servlet.c:
- Fixing functionicalls with variable number of parameters...
-
-2003-03-06 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * tests/lang/bug19943.phpt:
- Further testing on this feature should have been done...
-
- * tests/classes/abstract_class.phpt
- tests/classes/abstract_inherit.phpt:
- Fixed typo
-
-2003-03-06 Jani Taskinen <sniper@iki.fi>
-
- * tests/lang/bug19943.phpt:
-
- added test for the memleak part from bug #19943
-
-2003-03-05 Sascha Schumann <sascha@schumann.cx>
-
- * acinclude.m4:
- Allow shared modules to be built using $(CXX)
-
-2003-03-05 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- I was bored..
-
-2003-03-05 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- Fixed a small leak in the convert filter code
-
-2003-03-05 Sascha Schumann <sascha@schumann.cx>
-
- * (PHP_4)
- configure.in:
- test commit
-
-2003-03-05 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * main/rfc1867.c:
- Fixed bug #22550 (overflow protection for upload_max_filesize ini setting).
-
- * (PHP_4_3)
- NEWS:
- GD news.
-
- * ext/gd/tests/bug22544.phpt:
-
- Added test case for bug #22544.
-
-2003-03-05 Jani Taskinen <sniper@iki.fi>
-
- * sapi/apache2filter/sapi_apache2.c
- sapi/apache2handler/sapi_apache2.c:
- - Fix for some unixware compile problem. (comment by Sascha :)
-
-2003-03-05 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/gd/gd.c:
- Better identification of bundled GD library.
-
- * (PHP_4_3)
- ext/gd/gd.c
- ext/gd/gdcache.c
- ext/gd/gdcache.h
- ext/gd/gdttf.c
- ext/gd/php_gd.h
- ext/gd/libgd/gd.c
- ext/gd/libgd/gd.h
- ext/gd/libgd/gd_arc_f_buggy.c
- ext/gd/libgd/gd_gd2.c
- ext/gd/libgd/gd_gif_in.c
- ext/gd/libgd/gd_jpeg.c
- ext/gd/libgd/gd_png.c
- ext/gd/libgd/gd_ss.c
- ext/gd/libgd/gd_topal.c
- ext/gd/libgd/gd_wbmp.c
- ext/gd/libgd/gdcache.c
- ext/gd/libgd/gdft.c
- ext/gd/libgd/gdhelpers.c
- ext/gd/libgd/gdhelpers.h
- ext/gd/libgd/gdkanji.c
- ext/gd/libgd/gdxpm.c:
- Synchronized bundled gd with gd 2.0.11 (bug fixes).
- MFH
- 1) Use Zend allocation macros instead of native allocation functions.
- 2) Better error reporting mechanism.
- 3) Some style fixes, which allow easier code synchronization &
- maintenance.
-
- * ext/gd/libgd/gd_png.c:
- Fixed bug #22544 (missing fix from official gd).
-
-2003-03-05 Ben Mansell <ben@zeus.com>
-
- * sapi/cgi/libfcgi/fcgiapp.c:
- C++ -> C comments
-
-2003-03-05 Corne' Cornelius <cornec@reach.co.za>
-
- * ext/informix/ifx.ec:
- - Reverted emalloc(),efree() changed for persistant connection resources
-
-2003-03-05 Ben Mansell <ben@zeus.com>
-
- * README.Zeus:
- Update build instructions for Zeus web server
-
-2003-03-05 Corne' Cornelius <cornec@reach.co.za>
-
- * ext/informix/ifx.ec:
- - Changed malloc() and free() to emalloc() and efree()
-
-2003-03-05 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- ext/mbstring/mbstring.c:
- MFH: added missing phpinfo entry (Russian support)
-
- * ext/mbstring/mbstring.c:
- Added missing phpinfo entry (Russian support)
-
-2003-03-05 Wez Furlong <wez.php@thebrainroom.net>
-
- * (PHP_4_3)
- main/network.c
- main/streams.c:
- Fix some signed/unsigned issues with read() and SSL_read() return values.
- Allow SSL_connect() to retry for non-blocking sockets.
- Correctly declare the char as unsigned for php_stream_getc(), as per
- fgetc() semantics.
-
-2003-03-04 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/dba/dba.c
- ext/dba/php_dba.h:
- Use stream locking support
-
-2003-03-04 Ilia Alshanetsky <ilia@prohost.org>
-
- * README.STREAMS:
- Added notes about locking functions.
-
-2003-03-04 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/dba/tests/dba_cdb.phpt
- ext/dba/tests/dba_cdb_make.phpt
- ext/dba/tests/dba_cdb_read.phpt
- ext/dba/tests/dba_db2.phpt
- ext/dba/tests/dba_db3.phpt
- ext/dba/tests/dba_db4.phpt
- ext/dba/tests/dba_dbm.phpt
- ext/dba/tests/dba_flatfile.phpt
- ext/dba/tests/dba_gdbm.phpt
- ext/dba/tests/dba_inifile.phpt
- ext/dba/tests/dba_ndbm.phpt
- ext/dba/tests/skipif.inc
- ext/dba/tests/test.inc:
- Support all possible configurations and simplify includes
-
- * ext/dba/dba.c:
- fix dba by fixing key_len retrieval
-
-2003-03-04 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * tests/lang/bug22510.phpt:
-
- Added a test case for bug #22510
-
-2003-03-04 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * run-tests.php:
- do not use $GLOBAL[]
-
-2003-03-04 Jani Taskinen <sniper@iki.fi>
-
- * ext/hyperwave/hw.c:
- typofix
-
-2003-03-04 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * tests/classes/__call_001.phpt:
- If this doesn't show "3.4" there is another error
-
-2003-03-04 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/iconv/iconv.c:
- 64bit long fix
-
- * ext/mbstring/mbstring.c
- ext/mbstring/php_mbregex.c:
- 64bit long fix: patch by Dave Hill
-
-2003-03-04 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/odbc/php_odbc.c:
- Fixed bug #22437.
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * (PHP_4_3)
- main/streams.c:
- Compiler warning fix.
-
- * ext/standard/http_fopen_wrapper.c:
- Added support for http redirects to ftp.
- Fixed bug #22508 (Added protection against circular HTML redirects).
-
- * ext/standard/tests/file/bug22414.phpt:
- Skip test if running under safe-mode.
-
-2003-03-04 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- adding news entry for disable_classes addition
-
- * NEWS:
- These are in the branch.
-
- * main/main.c:
- ws & CS
-
- * NEWS:
- remove this from here as it belongs elsewhere
-
-2003-03-04 Christian Stocker <chregu@phant.ch>
-
- * ext/domxml/php_domxml.c:
- MFB (make it really W3C compatible (unlink node, when in tree...))
-
- * (PHP_4_3)
- ext/domxml/php_domxml.c:
- make it really W3C compatible (unlink node, when in tree...)
-
-2003-03-04 Edin Kadribasic <edink@proventum.net>
-
- * ext/standard/credits_ext.h
- ext/standard/credits_sapi.h
- sapi/apache2filter/CREDITS
- sapi/apache2handler/CREDITS:
- Credits update.
-
-2003-03-03 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/php_mysqli.h:
- fixed bug in macro-definition
-
- * ext/mysqli/tests/051.phpt
- ext/mysqli/tests/052.phpt:
- disabled output of errormessages
-
- * ext/mysqli/config.m4
- ext/mysqli/mysqli.c
- ext/mysqli/mysqli_fe.c
- ext/mysqli/mysqli_nonapi.c
- ext/mysqli/mysqli_profiler.c
- ext/mysqli/php_mysqli.h:
- added profiler support
-
-2003-03-03 Edin Kadribasic <edink@proventum.net>
-
- * (PHP_4_3)
- ext/standard/credits_ext.h
- ext/standard/credits_sapi.h:
- Update credits.
-
- * (PHP_4_3)
- NEWS:
- BFN
-
- * ext/mcrypt/mcrypt.dsp:
- MFB: Enabled mcrypt_generic_deinit() on windows (#22520)
-
- * (PHP_4_3)
- ext/mcrypt/mcrypt.dsp:
- Enabled mcrypt_generic_deinit() on windows (#22520)
-
-2003-03-03 Ilia Alshanetsky <ilia@prohost.org>
-
- * main/main.c:
- More compiler warnings fixed.
-
- * main/php_variables.h
- main/streams/xp_socket.c:
- Compiler warning fix.
-
- * main/php_variables.c:
- Fixed compiler warnings.
-
-2003-03-03 J Smith <jsmith@tutorbuddy.com>
-
- * tests/classes/__call_001.phpt
- tests/classes/__clone_001.phpt
- tests/classes/__set__get_001.phpt
- tests/classes/constants_scope_001.phpt
- tests/classes/dereferencing_001.phpt
- tests/classes/factory_001.phpt
- tests/classes/object_reference_001.phpt
- tests/classes/singleton_001.phpt
- tests/lang/error_2_exception_001.phpt
- tests/lang/namespace_001.phpt:
- Added some tests for ZE2 features and their functionality.
-
-2003-03-03 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * tests/classes/ctor_dtor.phpt
- tests/classes/ctor_dtor_inheritance.phpt:
- Adding tests for ctor/dtor handling
-
- * tests/classes/abstract_static.phpt:
- Adding tests for abstract static methods
-
- * tests/classes/abstract_final.phpt
- tests/classes/final.phpt
- tests/classes/final_abstract.phpt
- tests/classes/final_redeclare.phpt:
- Adding tests for final methods
-
-2003-03-03 Harald Radi <harald.radi+coding.php@nme.at>
-
- * (PHP_4_3)
- main/main.c:
- MFH: adding disable_classes ini directive
-
- * (PHP_4_3)
- php.ini-dist
- php.ini-recommended:
- MFH: adding placeholder for the new disable_classes directive
-
- * php.ini-dist
- php.ini-recommended:
- adding placeholder for the new disable_classes directive
-
- * main/main.c:
- adding disable_classes ini directive based on the
- newly introduced zend_disable_class function
-
-2003-03-03 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * tests/run-test/test008a.phpt:
- (re)check in non ZendOptimizer version of test
-
- * sapi/cli/TODO:
- remove entry done already
-
-2003-03-02 Jani Taskinen <sniper@iki.fi>
-
- * ext/ldap/config.m4:
- typofix
-
- * ext/ldap/config.m4:
- Special case for MacosX..
-
- * ext/ldap/config.m4:
- Fixed bug #22485 (hardcoded shared lib extensions)
-
-2003-03-02 Zeev Suraski <zeev@zend.com>
-
- * main/php_variables.c:
- Fix old variable names
-
-2003-03-02 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * run-tests.php:
- fix problem in current HEAD
-
-
-2003-03-02 Wez Furlong <wez.php@thebrainroom.net>
-
- * sapi/activescript/scriptengine.cpp:
- typo fix
-
-2003-03-02 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- New function news.
-
-2003-03-02 Uwe Schindler <uwe@thetaphi.de>
-
- * sapi/nsapi/CREDITS:
- -** empty log message ***
-
-2003-03-02 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/info.c
- main/php_variables.c:
- - Optimize $_REQUEST
- - Fix phpinfo()
-
-2003-03-02 Wez Furlong <wez.php@thebrainroom.net>
-
- * sapi/activescript/classfactory.cpp
- sapi/activescript/php4activescript.c:
- Build-performance tweaks
-
- * ext/rpc/com/com.h
- sapi/activescript/classfactory.cpp
- sapi/activescript/scriptengine.cpp:
- Fix build for activescript sapi
-
-2003-03-02 Derick Rethans <d.rethans@jdimedia.nl>
-
- * php.ini-dist
- php.ini-recommended:
- - It was called _VARS, not _GLOBALS :-)
-
-2003-03-02 Zeev Suraski <zeev@zend.com>
-
- * php.ini-dist
- php.ini-recommended
- ext/filepro/filepro.c
- ext/session/session.c
- main/main.c
- main/php_globals.h
- main/php_variables.c
- main/php_variables.h:
- Add JIT initialization for _SERVER and _ENV
- (it's less important for the others, even though it should be fairly
- easy now too)
-
-2003-03-02 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- Fixed my silly mistake in the filter code
-
-2003-03-01 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * main/network.c:
- Reverted my previous commit
-
-2003-03-01 Wez Furlong <wez.php@thebrainroom.net>
-
- * main/streams/plain_wrapper.c:
- Ensure that all fields are initialized to NULL.
-
-2003-03-01 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * main/network.c:
- Fixed build
-
-2003-03-01 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/xmlrpc/xmlrpc-epi-php.c:
- Fix two crash bugs when optional parameters are not specified.
- Fix folding markers.
-
- * main/streams/xp_socket.c:
- Don't shutdown() unix sockets.
- It causes the server end to close down/break.
-
- * main/streams/memory.c:
- Folding fixes
-
- * scripts/Makefile.frag:
- Add streams headers to those used for shared extensions.
-
- * NEWS:
- New!
-
-2003-03-01 Pierre-Alain Joye <paj@pearfr.org>
-
- * ext/gd/CREDITS:
- update credits (ilia,myself)
-
-2003-03-01 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/basic_functions.c
- ext/standard/streamsfuncs.c
- ext/standard/streamsfuncs.h:
- Expose php_stream_copy_to_stream as stream_copy_to_stream(); a high
- performance alternative to looping reads and writes.
-
-2003-03-01 Pierre-Alain Joye <paj@pearfr.org>
-
- * (PHP_4_3)
- ext/gd/CREDITS:
- Update credits
-
-2003-02-28 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/ftp/ftp.c
- ext/ftp/ftp.h
- ext/standard/streamsfuncs.c
- main/network.c
- main/php_network.h
- main/streams/xp_socket.c
- win32/select.c:
- Tidy up stupid signed/unsigned issues with win32 by introducing a
- php_socket_t typedef.
-
-2003-02-28 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * main/php_ini.c:
- MFB config-file-scan-dir crash fix
-
- * (PHP_4_3)
- main/php_ini.c:
- but there is no top php.ini file, we would get a segfault. (Rasmus)
-
-2003-02-28 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/streamsfuncs.h:
- Add this file...
-
- * NEWS
- configure.in
- ext/ftp/ftp.c
- ext/openssl/xp_ssl.c
- ext/standard/basic_functions.c
- ext/standard/file.c
- ext/standard/file.h
- ext/standard/fsock.c
- ext/standard/streamsfuncs.c
- main/network.c
- main/php_network.h
- main/streams/php_stream_transport.h
- main/streams/transports.c
- main/streams/xp_socket.c:
- New user-space functions:
- . stream_socket_client() - similar to fsockopen(), but more powerful.
- . stream_socket_server() - Creates a server socket.
- . stream_socket_accept() - Accept a client connection.
- . stream_socket_get_name() - Get local or remote name of socket.
-
- Tidy up some leaks and debug printfs.
- Move more streams functions into streamsfuncs.c and streamsfuncs.h.
-
-2003-02-28 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/openssl/openssl.c
- ext/standard/php_fopen_wrapper.c:
- Fixed compiler warnings.
-
-2003-02-28 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- NEWS:
- Was actually an ucwords() problem...
-
-2003-02-28 Hartmut Holzgraefe <hartmut@six.de>
-
- * scripts/ext_skel_ng/TODO:
- callbacks are now supported
- (although there's still room for improvements)
-
-2003-02-28 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS
- NEWS:
- BFN
-
-2003-02-28 Hartmut Holzgraefe <hartmut@six.de>
-
- * (PHP_4_3)
- ext/standard/file.c
- ext/standard/file.c
- ext/yp/yp.c
- ext/yp/yp.c:
- MFphp5
-
- * ext/standard/file.c:
- it is still to early in the morning for coding :(
-
- * ext/standard/file.c:
- make sure that GNU extensions exist for fnmatch()
-
-2003-02-28 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- ext/curl/curl.c:
- - MFH: Fixed bug #22312 (crash on failed connection when curl_getinfo() was
- called).
- (Phil Oleson <poleson@verio.net>)
-
- * ext/curl/interface.c:
- - Fixed bug #22312 (crash on failed connection when curl_getinfo() was
- called).
- (Phil Oleson <poleson@verio.net>)
-
- * ext/ftp/ftp.c
- ext/ftp/php_ftp.c
- ext/openssl/xp_ssl.c
- main/php_network.h:
- - No need to include the ssl headers elsewhere but in ext/openssl
-
- * ext/yaz/config.m4
- ext/yaz/php_yaz.c:
- YAZ 2.0 or later is required now.
-
-2003-02-28 Hartmut Holzgraefe <hartmut@six.de>
-
- * scripts/ext_skel_ng/extension_parser.php
- scripts/ext_skel_ng/php_function.php:
- - support for "callback" type
- - proto syntax errors are now passed back to the top level parser
-
- * scripts/ext_skel_ng/ext_skel_ng.php:
- support for passing description file name on command line
-
-2003-02-28 Jani Taskinen <sniper@iki.fi>
-
- * ext/yaz/php_yaz.c
- ext/yaz/php_yaz.h:
- ws & CS
-
-2003-02-28 Hartmut Holzgraefe <hartmut@six.de>
-
- * scripts/ext_skel_ng/xml_stream_parser.php:
- "on line #", not "in line #"
-
- * scripts/ext_skel_ng/php_element.php:
- added "callback" type (and fixed a stupid typo)
-
- * scripts/ext_skel_ng/extension.dtd:
- some DTD fixes and <code> as a toplevel element for .c and .h code snippets
-
-2003-02-28 Wez Furlong <wez.php@thebrainroom.net>
-
- * main/streams/plain_wrapper.c:
- Implement memory mapping for win32.
- Could do with some rigorous testing; simple readfile() tests here appear
- to work.
-
-2003-02-28 Ilia Alshanetsky <ilia@prohost.org>
-
- * main/network.c:
- compiler warning fixed.
-
-2003-02-27 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/dir.c:
- Fixed compiler warning.
-
- * ext/openssl/xp_ssl.c:
- fixed compiler warnings.
-
-2003-02-27 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/config.m4:
- streams.c -> streamsfuncs.c
-
- * ext/standard/streams.c
- ext/standard/streamsfuncs.c
- win32/php4dllts.dsp
- win32/select.c:
- Update win32 build.
- Since msvc sucks, I had to rename ext/standard/streams.c to
- ext/standed/streamsfuncs.c
-
- * ext/standard/config.m4
- ext/standard/file.c
- ext/standard/file.h
- ext/standard/streams.c
- win32/select.c
- win32/select.h
- win32/installer/README:
- Move streams specific stuff from ext/standard/file.c ->
- ext/standard/streams.c
- Move win32 select implementation into win32/.
- Will update win32 build in a moment.
-
-2003-02-27 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/filestat.c:
- Fixed a bug that would cause filetype() to return "unknown" for
- non-existent files on Win32.
-
-2003-02-27 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/file.c
- main/php_streams.h
- main/streams/xp_socket.c:
- Add a generic meta data api for streams.
-
-2003-02-27 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * TODO-PHP5:
- The basic input filtering framework is done and working nicely
-
-2003-02-27 Wez Furlong <wez.php@thebrainroom.net>
-
- * TODO:
- Update todo slightly
-
- * ext/openssl/openssl.c
- ext/standard/basic_functions.c
- ext/standard/file.c
- ext/standard/ftp_fopen_wrapper.c
- ext/standard/http_fopen_wrapper.c
- ext/standard/php_fopen_wrappers.h:
- - Move https:// and ftps:// wrapper registration into the openssl module.
- - Expose the http:// and ftp:// wrappers as PHPAPI
- - Remove unused variables
-
- * main/network.c
- main/streams/transports.c
- main/streams/xp_socket.c
- win32/php4dllts.dsp:
- Fixup build for win32
-
-2003-02-27 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * ext/standard/filestat.c:
- Fixed bug #21410 (fixed handling of NULL or "" files on Win32)
-
-2003-02-27 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- ..if only all lakes were kossu..
-
-2003-02-27 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/yp/yp.c:
- changed from strncpy to strlcpy on request
-
-2003-02-27 Sascha Schumann <sascha@schumann.cx>
-
- * main/php_streams.h:
- rename macro argument so that it does not partially match the string.
-
- fixes a warning on unixware
-
-2003-02-27 Corne' Cornelius <cornec@reach.co.za>
-
- * ext/informix/ifx.ec:
- - Changed maxmsglen in ifx_errormsg() back to normal 255 instead of 10
-
- * ext/informix/ifx.ec:
- - Fixed possible Segfault in ifx_errormsg() using malloc() instead of
- emalloc()
-
-2003-02-26 Pierre-Alain Joye <paj@pearfr.org>
-
- * ext/gd/gd.c:
- add imagesavealpha wrapper (Jukka Holappa <jukkaho@mail.student.oulu.fi>,
- 2 Pierre-Alain Joye)
-
- * ext/gd/php_gd.h:
- add imagesavealpha wrapper (Jukka Holappa <jukkaho@mail.student.oulu.fi>,
- Pierre-Alain Joye)
-
-2003-02-26 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * main/main.c:
- MFB: Get rid of a redundant syscall on non-Windows
-
- * (PHP_4_3)
- main/main.c:
- Get rid of an unnecessary syscall on non-Windows. We don't need two
- setitimer() calls here in order to reset the timer.
-
-2003-02-26 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/exec.c
- ext/standard/exec.h:
- 1) Make the output of system() binary safe
- 2) Solved a memory leak when the return_value variable passed by reference
- is
- not an integer in system()/exec()/passthru().
- 3) Solved a bug in exec(), which would make it append to the 2nd parameter
- (passed by reference) if the parameter is an array instead of
- overwriting it.
- 4) Changed the code to use the streams code, resulting in a smaller code
- base.
- 5) Various cleanups resulting in reduction of overall code base inside the
- file
- by ~ 1/3.
- 6) Speed improvements of ~2.5 times compared to previous performance
- (based on
- attached PHP script).
-
-2003-02-26 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/dba/dba.c:
- allow keys as array(group, name) for handler inifile
-
- * ext/dba/dba_flatfile.c:
- ws
-
- * ext/dba/libcdb/cdb.c:
- make it faster
-
- * ext/dba/libinifile/inifile.c:
- if skip param of dba_fetch is -1 stop do not restart search after last
- element
-
-2003-02-26 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/mail.c
- main/main.c:
- - Added an extra ini setting with which extra commands can be forced to
- the sendmail deamon on a per-vhost base. The value in this ini setting
- will override all extra commands passed as the 5th parameter to mail()
- and will work in Safe Mode.
-
- * ext/standard/file.c:
- - Fix proto
-
- * ext/standard/basic_functions.c:
- - Whitespace
-
-2003-02-26 Hartmut Holzgraefe <hartmut@six.de>
-
- * (PHP_4_3)
- ext/yp/yp.c
- ext/yp/yp.c:
- MFphp5
-
- * ext/yp/yp.c:
- changed to emalloc just to be safe
-
- * scripts/ext_skel_ng/php_logo.php
- scripts/ext_skel_ng/php_resource.php:
- forgot to add these two on my last commit :(
-
-2003-02-25 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/exec.c:
- Made shell_exec() use streams, this simplifies the code and in some cases
- makes it a little faster too.
-
- * ext/standard/url.c:
- MFH (forgot to put this fix into the 5.X tree).
-
-2003-02-25 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * NEWS:
- NEWS update
-
- * ext/standard/file.c:
- Set fgetss() free from the length parameter
-
- * (PHP_4_3)
- NEWS:
- BFN: the fix was actually done by Ilia.
-
- * (PHP_4_3)
- ext/standard/html.c:
- MFH(r1.72): int / long change
- Fixed bug #22301 (htmlspecialchars crashes on Tru64)
-
-2003-02-25 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/tests/file/bug22414.phpt:
- Fixed test.
-
- * ext/standard/exec.c
- ext/standard/tests/file/bug22414.phpt:
- Fixed bug #22414 and added a test case for it.
-
-2003-02-25 Jani Taskinen <sniper@iki.fi>
-
- * ext/odbc/config.m4:
- Cleanup
-
- * (PHP_4_3)
- NEWS
- NEWS
- NEWS:
- BFN
-
- * (PHP_4_3)
- configure.in:
- MFH: Fixed bug #21224 (apache configure fails when using
- --enable-versioning)
-
- * configure.in:
- - Fixed bug #21224 (apache configure fails when using --enable-versioning)
-
- * (PHP_4_3)
- main/php.h
- main/php_sprintf.c
- main/snprintf.c
- main/snprintf.h:
- MFH: Fixed bug #20256 (snprintf() not defined on some systems)
-
- * main/php.h
- main/php_sprintf.c
- main/snprintf.c
- main/snprintf.h:
- Fixed bug #20256 (snprintf() not defined)
-
-2003-02-25 Adam Dickmeiss <adam@indexdata.dk>
-
- * ext/yaz/php_yaz.c:
- Tabify
-
- * ext/yaz/php_yaz.c:
- yaz_search supports query type cql
-
-2003-02-25 Jani Taskinen <sniper@iki.fi>
-
- * configure.in:
- typofix
-
- * ext/curl/interface.c
- ext/curl/multi.c:
- (hope) fix some win32 build errors
-
-2003-02-25 Corne' Cornelius <cornec@reach.co.za>
-
- * ext/informix/CREDITS
- ext/informix/ifx.ec
- ext/informix/php_informix.h
- ext/informix/php_informix_includes.h:
- - Added Corne' Cornelius to CREDITS/Authors
-
-2003-02-25 Jani Taskinen <sniper@iki.fi>
-
- * sapi/pi3web/pi3web_sapi.c:
- Another win32 build fix.
-
- * sapi/activescript/php4activescript.c
- sapi/activescript/scriptengine.cpp:
- (hopefully) fix the build..
-
- * (PHP_4_3)
- configure.in:
- MFH: Fixed bug #14245 ('make install' fails on AIX when using --with-apxs).
-
- * configure.in:
- - Fixed bug #14245 ('make install' fails on AIX when using --with-apxs).
-
-2003-02-25 Corne' Cornelius <cornec@reach.co.za>
-
- * ext/informix/config.m4:
- - Changed IFX_VERSION to work with Major versions with more then one digit
-
-2003-02-25 Jani Taskinen <sniper@iki.fi>
-
- * ext/oci8/config.m4:
- fix bug #22324, libjdbcoci8.so is not necessarily needed..
-
-2003-02-25 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * ext/standard/ftp_fopen_wrapper.c:
- Fixed bug #22402 (opening of ftp for read/write could fail due to invalid
- return code handling).
- Solution suggested by jan@jancm.org
-
- * (PHP_4_3)
- ext/gd/libgd/gd.c:
- MFH (fix for crash in gdImageCopyMergeGray()).
-
- * ext/gd/libgd/gd.c:
- Fixed a crash in gdImageCopyMergeGray().
-
-2003-02-25 Stig Bakken <ssb@fast.no>
-
- * pear/package-PEAR.xml
- pear/PEAR/Common.php
- pear/PEAR/Packager.php
- pear/PEAR/Command/Package.php:
- - fixed <provides> generation, provides elements are now included for
- every non-private class, function and method
-
- * ext/tokenizer/tokenizer.c:
- - add new ZE2 tokens
-
-2003-02-25 Ilia Alshanetsky <ilia@prohost.org>
-
- * main/streams/plain_wrapper.c:
- Fixed various compiler warnings.
-
- * main/streams/plain_wrapper.c:
- Use native flock() whenever possible.
-
- * ext/standard/file.c
- main/php_streams.h
- main/streams/plain_wrapper.c:
- Added locking to streams.
- Allow PHP to automatically release locks on files when terminating the
- stream.
- Fixed bugs in the handling of the 3rd optional parameter to flock().
-
-2003-02-24 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * main/streams/memory.c:
- Removed unnecessary asserts
-
- * ext/standard/filters.c:
- Fixed string.strip_tags filter so it reflects the change on php_strip_tags
-
- * ext/standard/file.c:
- Made fgetss() binary safe too
-
- * ext/standard/string.c:
- Fixed possible buffer overflow of php_strip_tags
-
- * ext/standard/php_string.h
- ext/standard/string.c:
- Made strip_tags() binary safe
-
-2003-02-24 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/basic_functions.c
- ext/standard/basic_functions.h
- ext/standard/user_filters.c:
- Initial re-implementation of userfilters after filterchain redesign by wez.
- More userspace API to come.
-
-2003-02-24 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/file.c
- main/php_streams.h
- main/streams/cast.c
- main/streams/plain_wrapper.c
- main/streams/streams.c:
- MFB: Bunch of streams related fixes.
-
-2003-02-24 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS
- NEWS:
- Bug fixing news.
-
- * ext/standard/mail.c:
- Fixed bug #22355 (PHP would remove folding from Subject & To fields).
-
-2003-02-24 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * tests/lang/bug22367.phpt:
-
- Added test case for bug #22367
-
- * ext/standard/reg.c:
- Forgot to fix this part
-
- * tests/lang/bug21600.phpt:
- Fixed the test as the result is just considered to be expected
-
- * (PHP_4_3)
- ext/standard/reg.c:
- MFH(r1.74): fixed an signed / unsigned issue
-
- * ext/standard/reg.c:
- Fixed a signed / unsigned issue.
-
-
-2003-02-24 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- sapi/apache/config.m4:
- MFH: Possible fix for #22259 + part 1/2 for fixing AIX DSO bug
-
- * sapi/apache/config.m4:
- Possible fix for #22259 + part 1/2 for fixing one AIX bug..
-
-2003-02-24 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/reg.c:
- Style fix
-
-2003-02-24 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- tests/lang/bug21600.phpt
- tests/lang/bug22231.phpt:
- - Removing pointless tests. (both of these will be fixed in PHP 5)
-
- * NEWS
- NEWS:
- BFN
-
- * acinclude.m4:
- fix quotes
-
-2003-02-24 Zeev Suraski <zeev@zend.com>
-
- * sapi/apache2filter/apache_config.c
- sapi/apache2filter/php_functions.c
- sapi/apache2filter/sapi_apache2.c:
- (possibly) fix Win32 builds of the Apache 2 filter
-
-2003-02-24 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/yp/yp.c:
- "key" has to be zero-delimited
-
- * scripts/ext_skel_ng/TODO
- scripts/ext_skel_ng/dummy.gif
- scripts/ext_skel_ng/ext_skel_ng.php
- scripts/ext_skel_ng/extension.dtd
- scripts/ext_skel_ng/extension.xml
- scripts/ext_skel_ng/extension_parser.php
- scripts/ext_skel_ng/php_function.php:
- - code generation: resources and phpinfo logo
- - duplicate code elimination for prototype parsing
- - improved phpinfo block (incl. logo)
- - some input error checking
- - documentation generation for ini-directives, constants
- and resources
-
-2003-02-24 Jani Taskinen <sniper@iki.fi>
-
- * ext/informix/ifx.ec
- ext/informix/ifx.ec:
- no c++ comments
-
-2003-02-24 Corne' Cornelius <cornec@reach.co.za>
-
- * ext/informix/ifx.ec:
- (PHP ifx_errormsg) Fixed Informix bug where ifx_errormsg() would Segfault
- on an unopened connecection and with an errorcode
- supplied
-
-2003-02-24 Jani Taskinen <sniper@iki.fi>
-
- * acinclude.m4:
- Always use the libtool which is build in the top_builddir.
-
- * ext/mhash/mhash.c
- ext/mhash/php_mhash.h:
- fix compile warning
-
-2003-02-24 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/file.c
- ext/standard/tests/file/bug22382.phpt
- ext/standard/tests/file/test2.csv:
- Fixed bug #22382 (fgetcsv did not handle \" correctly).
-
-2003-02-24 George Schlossnagle <george@omniti.com>
-
- * sapi/apache/mod_php4.c:
- ws fix
-
- * sapi/apache/mod_php4.c:
- hopefully a fix for 19919
-
-2003-02-24 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/basic_functions.c
- ext/standard/dns.c
- ext/standard/dns.h:
- Extra paranoia checks if dn_skipname/dn_expand exist or not
-
-2003-02-23 Jani Taskinen <sniper@iki.fi>
-
- * main/fopen_wrappers.c:
- MFB: Fix for open_basedir error message
-
-2003-02-23 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * (PHP_4_3)
- main/fopen_wrappers.c
- main/streams.c:
- open_basedir fixes from David Saez
-
-2003-02-23 Stig Bakken <ssb@fast.no>
-
- * pear/packages/XML_Parser-1.0.1.tar
- pear/packages/XML_Parser-1.0.tar:
-
- - upgrading XML_Parser to 1.0.1
-
-2003-02-23 Jani Taskinen <sniper@iki.fi>
-
- * sapi/apache/libpre.c
- sapi/apache/php_apache_http.h:
- Added missing headers and Id tags.
-
- * sapi/cgi/config9.m4:
- MFB: Fixed bug #22356 (Do not add empty -I flags).
-
- * (PHP_4_3)
- sapi/cgi/config9.m4:
- Fixed bug #22356 (Do not add empty -I flags).
-
- * ext/imap/config.m4:
- Fix for bug #22353
-
- * (PHP_4_3)
- NEWS:
- BFN
-
- * (PHP_4_3)
- sapi/apache/config.m4
- sapi/apache2filter/config.m4:
- MFH: - Fixed bug #22376 (wrong httpd.conf modified when using INSTALL_ROOT)
-
- * sapi/apache/config.m4
- sapi/apache2filter/config.m4
- sapi/apache2handler/config.m4:
- - Fixed bug #22376 (wrong httpd.conf modified when using INSTALL_ROOT)
-
-2003-02-23 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * tests/classes/abstract_inherit.phpt:
- New test which currently fails
-
- * NEWS:
- Fix the name
-
-2003-02-23 Jani Taskinen <sniper@iki.fi>
-
- * sapi/apache2filter/EXPERIMENTAL
- sapi/apache2handler/EXPERIMENTAL:
-
- These both are experimental still. (there has been a note in config.m4
- all the time but these marker files were missing)
-
- * NEWS:
- Style
-
-2003-02-22 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/dba/libinifile/inifile.c:
- Dropped optimization
-
-2003-02-22 Wez Furlong <wez.php@thebrainroom.net>
-
- * (PHP_4_3)
- NEWS:
- Correct a bug number - thanks to Philip...
-
-2003-02-22 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/dba/libinifile/inifile.c:
- INI files are case insensitive
-
-2003-02-22 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/basic_functions.c
- ext/standard/file.c
- ext/standard/file.h:
- Revent previous patch, adding of file_write_content() was premature.
-
- * ext/standard/basic_functions.c
- ext/standard/file.c
- ext/standard/file.h
- ext/standard/html.c:
- int/long change.
-
-2003-02-22 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/dba/libinifile/inifile.c:
- Remove testcode
-
- * ext/dba/config.m4
- ext/dba/dba.c
- ext/dba/dba_inifile.c
- ext/dba/php_inifile.h
- ext/dba/libinifile/.cvsignore
- ext/dba/libinifile/inifile.c
- ext/dba/libinifile/inifile.h
- ext/dba/tests/dba_inifile.phpt:
-
-
-2003-02-22 Andrey Hristov <andrey@webgate.bg>
-
- * ext/standard/array.c:
- additional speedup for array_shift(). No need to rehash if the removed
- element's
- key is not scalar and elements with scalar keys are already well numbered
- (sequentially from 0) for some reason. This is the case if the leading
- elements have no scalar indexes.
-
-2003-02-22 Wez Furlong <wez.php@thebrainroom.net>
-
- * (PHP_4_3)
- NEWS:
- Squashed those ugly bugs!
-
-2003-02-22 Andrey Hristov <andrey@webgate.bg>
-
- * ext/standard/array.c:
- rehash only in case something is changed.
-
-2003-02-22 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/mysqli_api.c:
- removed some comments
-
- * ext/mysqli/mysqli.c
- ext/mysqli/mysqli_api.c
- ext/mysqli/php_mysqli.h:
- Fixed bug with stmt_close (libmysql bk version 1.1477 required)
- Fixed bug with mysql_execute and float values
-
-2003-02-22 Justin Erenkrantz <justin@erenkrantz.com>
-
- * sapi/apache2handler/sapi_apache2.c:
- Add xbithack support to apache2handler SAPI.
-
- (configuration doesn't work, but that's not something new apparently.)
-
-2003-02-22 Wez Furlong <wez.php@thebrainroom.net>
-
- * (PHP_4_3)
- ext/standard/file.c
- ext/standard/tests/file/bug21131.phpt
- ext/standard/tests/file/bug22362.phpt
- ext/standard/tests/file/bug22362.phpt
- main/php_streams.h
- main/streams.c:
- Miscellaneous streams fixes, including probable fixes for:
- Bug #21131 (fopen with 'a+' and rewind() doesn't work)
- Bug #21713 (include remote files leaks temporary files + descriptors on
- Solaris)
- Bug #21185 (move_uploaded_file() does not ignore open_basedir as it
- should)
- Bug #22362 (combinations of fwrite(), fread() and fseek() produce
- unexpected results)
-
-2003-02-21 Wez Furlong <wez.php@thebrainroom.net>
-
- * main/network.c
- win32/php4dllts.dsp:
- Add comment about thread-safety of gethostbyname on win32.
- Set the correct path to the win32 config.h file in the .dsp file.
-
-2003-02-21 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- ext/snmp/php_snmp.h
- ext/snmp/snmp.c:
- fixed headers and cleaned up a bit
-
- * ext/standard/basic_functions.c
- ext/standard/dns.c
- ext/standard/dns.h:
- - Fixed bug: #22339
-
- * ext/informix/ifx.ec
- ext/informix/php_informix_includes.h
- ext/snmp/php_snmp.h:
- MFB
-
- * (PHP_4_3)
- ext/informix/ifx.ec:
- ZTS build fixes, style and ws fixes
-
- * ext/ingres_ii/ii.c
- ext/ingres_ii/ii.h:
- ZTS fixes
-
- * (PHP_4_3)
- ext/informix/ifx.ec:
- Fix ZTS build
-
-2003-02-21 David Viner <dviner@yahoo-inc.com>
-
- * sapi/apache/php4apache.dsp:
- this tiny change adds the location of apache includes and libraries that
- are installed when you use the Apache Windows Installer
- (C:\Program Files\Apache Group\Apache\*). With this patch,
- a windows developer who has used the Apache Windows Installer should be
- able to compile the Apache sapi module without any modifications to
- his/her
- installed tree. It should have no effect whatsoever on anyone else.
-
- --dviner
-
-2003-02-20 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * README.input_filter
- ext/mbstring/mb_gpc.c
- main/SAPI.c
- main/SAPI.h
- main/php_variables.c
- main/rfc1867.c:
- An input filter might not simply strip stuff, it might also turn things
- into entities or use some other mechanism which causes the filtered data
- to be longer than the original data. Ergo, pass in the address of the
- buffer instead so the filter is free to reallocate it.
-
-2003-02-20 Justin Erenkrantz <justin@erenkrantz.com>
-
- * ext/pgsql/pgsql.c:
- Remove C++-style comment. (Breaks Sun Forte compiler.)
-
-2003-02-20 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/php_fopen_wrapper.c:
- Reduce unnecessary filter applications when stream is (read|write) only
-
-2003-02-20 Justin Erenkrantz <justin@erenkrantz.com>
-
- * sapi/apache2handler/php_apache.h
- sapi/apache2handler/php_functions.c
- sapi/apache2handler/sapi_apache2.c:
- Clean up apache2handler SAPI.
-
- Key improvements:
- - Be streamy
- - Re-enable virtual() support
- - Set content_type correctly
- - Remove unnecessary code and reintroduce some missing code
- - Change signature from PhP to PHP
-
-2003-02-20 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- NEWS:
- BFN
-
- * (PHP_4_3)
- ext/mbstring/mbstring.c:
- MFH(r1.165): Fixed bug #22330 (overloaded strrpos() weirdness)
-
- * ext/mbstring/mbstring.c:
- Fixed bug #22330 (overloaded strrpos() gives wrong results)
- Patch by david at santinoli dot com. Thanks!
-
-2003-02-20 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/tests/strings/sha1.phpt
- ext/standard/tests/strings/sha1raw.phpt:
- - Fixed testcase... you can never trust on RFCs it seems
-
-2003-02-20 Hartmut Holzgraefe <hartmut@six.de>
-
- * scripts/ext_skel_ng/extension_parser.php:
- put constants into C output
- do not limit int constants to numbers, C #defines are ok as strings
- foobar(void) needs special treatment in code generation
-
-2003-02-20 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- style
-
-2003-02-20 Corne' Cornelius <cornec@reach.co.za>
-
- * (PHP_4_3)
- ext/informix/php_informix_includes.h:
-
- from 16 to 32 to prevents possible overflow
-
-2003-02-20 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/md5.c:
- - Fixed copy and paste bug
-
- * NEWS
- ext/standard/md5.c
- ext/standard/sha1.c:
- - Also add the optional raw output parameter to md5_file and sha1_file.
-
-2003-02-20 Sascha Schumann <sascha@schumann.cx>
-
- * (PHP_4_3)
- ext/session/session.c:
- merge minor differences from head
-
-2003-02-20 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- style fix
-
- * NEWS:
- This is added in 4.3.2
-
- * (PHP_4_3)
- NEWS
- NEWS
- NEWS:
- BFN
-
- * (PHP_4_3)
- ext/pgsql/pgsql.c:
- MFH: Fixed bug: #22306 (pg_lo_seek($h, 0, PGSQL_SEEK_SET) succeeds but
- returns false)
-
- * ext/pgsql/pgsql.c:
- Fixed bug: #22306 (pg_lo_seek($h, 0, PGSQL_SEEK_SET) succeeds but returns
- false)
-
-2003-02-20 Sascha Schumann <sascha@schumann.cx>
-
- * NEWS
- NEWS
- NEWS:
- update
-
-2003-02-20 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/md5.c
- ext/standard/sha1.c:
- - No need to add the \0 ourselves, the estrndup in STRINGL takes care of
- that for us.
-
-2003-02-20 Sascha Schumann <sascha@schumann.cx>
-
- * (PHP_4_3)
- ext/session/php_session.h
- ext/session/session.c:
- MFH general urlencoding
- MFH session_regenerate_id, a change which is as important as the former
- one
-
- * ext/session/session.c:
- generally urlencode parameters
-
-2003-02-20 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- ext/standard/dns.c:
- MFH: - Fixed bug #22299 (gethostbyname() crash with non-existing domain on
- MacOSX)
-
- * ext/standard/dns.c:
- - Fixed bug #22299 (gethostbyname() crash with non-existing domain on
- MacOSX)
-
-2003-02-20 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * ext/standard/http_fopen_wrapper.c:
- Revert accidental commit.
-
- * ext/standard/exec.c
- ext/standard/http_fopen_wrapper.c:
- Fixed bug #22308 (optimized passthru, code is now ~40 times faster).
-
-2003-02-20 Jani Taskinen <sniper@iki.fi>
-
- * footer
- header:
- consistent with the used style
-
-2003-02-19 Jon Parise <jon@csh.rit.edu>
-
- * ext/rpc/skeleton/php_skeleton.h
- ext/rpc/skeleton/skeleton.c
- ext/rpc/skeleton/skeleton.h:
- Add folding markers and editor directive blocks.
-
-2003-02-19 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * ext/mbstring/mb_gpc.c
- ext/mbstring/mb_gpc.h:
- Fix mbstring input_filter
-
- * README.input_filter
- ext/mbstring/mb_gpc.c
- ext/mbstring/mbstring.c
- main/SAPI.c
- main/SAPI.h
- main/php_content_types.c
- main/php_variables.c
- main/rfc1867.c:
- Input Filter support. See README.input_filter for details.
-
-2003-02-19 Jani Taskinen <sniper@iki.fi>
-
- * main/php_scandir.c
- main/php_scandir.h:
- MFB
-
- * (PHP_4_3)
- main/php_scandir.c
- main/php_scandir.h:
- dirent.h needs to be included always.
-
-2003-02-19 Harald Radi <harald.radi+coding.php@nme.at>
-
- * main/main.c:
- prevent xdebug from crashing
-
-2003-02-19 Hartmut Holzgraefe <hartmut@six.de>
-
- * scripts/ext_skel_ng/extension.xml
- scripts/ext_skel_ng/extension_parser.php
- scripts/ext_skel_ng/php_function.php:
- code for the special functions MINIT, MSHUTDOWN, RINIT, RSHUTDOWN, MINFO
- and for private internal C helper functions may now be embedded into
- the XML specification
-
-2003-02-19 Wez Furlong <wez.php@thebrainroom.net>
-
- * NEWS:
- typo..
-
- * NEWS:
- News about the ZE stream thing
-
-2003-02-19 Hartmut Holzgraefe <hartmut@six.de>
-
- * scripts/ext_skel_ng/extension.xml:
- test specifications for MINIT and friends
-
- * scripts/ext_skel_ng/extension.dtd:
- <code> inside <function> was supported but missing from the DTD,
- added "role" attribute to support "internal" functions like
- MINIT and stuff, "private" C functions not to be published as
- PHP functions and "public" implemenations of PHP functions
-
-2003-02-19 Marc Boeren <M.Boeren@guidance.nl>
-
- * ext/dbx/dbx_pgsql.c:
- Fix for bug #22221: pgsql version for dbx_query suppressed a warning that
- was trappable by using a user-defined error-handler. A different use of
- pgsql_getrow removed the warning and thus the need for suppressing it.
-
-2003-02-19 Harald Radi <harald.radi+coding.php@nme.at>
-
- * (PHP_4_3)
- win32/php5ts.dsw:
- remove php5ts workspace from PHP_4_3 branch
-
-2003-02-19 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/thttpd/README
- sapi/thttpd/README
- sapi/thttpd/README:
- some improvements
-
-2003-02-19 Hartmut Holzgraefe <hartmut@six.de>
-
- * scripts/ext_skel_ng/ext_skel_ng.php
- scripts/ext_skel_ng/extension_parser.php
- scripts/ext_skel_ng/php_function.php:
- Microsoft Developer Studio project file (.dsp) generation added
-
- for now both config.m4 and .dsp files are generated for the simples
- case only (one .c file, one .h file, no external dependencies)
-
- * scripts/ext_skel_ng/README
- scripts/ext_skel_ng/ext_skel_ng.php
- scripts/ext_skel_ng/extension.dtd
- scripts/ext_skel_ng/extension.xml
- scripts/ext_skel_ng/extension_parser.php
- scripts/ext_skel_ng/php_constant.php
- scripts/ext_skel_ng/php_element.php
- scripts/ext_skel_ng/php_function.php
- scripts/ext_skel_ng/xml_stream_callback_parser.php
- scripts/ext_skel_ng/xml_stream_parser.php:
- next generation ext_skel script - initial checkin
-
-2003-02-19 Corne' Cornelius <cornec@reach.co.za>
-
- * ext/informix/ifx.ec:
- - Revert latest commit
-
-2003-02-19 Jani Taskinen <sniper@iki.fi>
-
- * main/php_ini.c:
- ws/style fixes
-
-2003-02-19 Corne' Cornelius <cornec@reach.co.za>
-
- * ext/informix/ifx.ec:
- - Added Input Descriptor Binding to be used by blobs. This fixed a bug
- where ESQL/C would cause a Segmentation fault if the first blob in a
- result is NULL or '' as soon as it gets a result with blob != NULL
- - Fixed leaks where blobs resources weren't always freed
-
-2003-02-19 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- main/php_ini.c
- main/php_scandir.c
- main/php_scandir.h:
- MFH: prevent conflicts with other libraries (e.g. libc-client)
-
- * ext/standard/dir.c:
- scandir -> php_scandir, alphasort -> php_alphasort
-
- * main/php_ini.c
- main/php_scandir.c
- main/php_scandir.h:
- Fix the possible conflicts with other libs (like libc-client)
-
- * main/SAPI.h
- main/alloca.c
- main/config.nw.h
- main/fopen_wrappers.c
- main/fopen_wrappers.h
- main/internal_functions.c.in
- main/internal_functions_nw.c
- main/internal_functions_registry.h
- main/internal_functions_win32.c
- main/logos.h
- main/mergesort.c
- main/network.c
- main/php3_compat.h
- main/php_compat.h
- main/php_content_types.h
- main/php_globals.h
- main/php_ini.h
- main/php_logos.c
- main/php_logos.h
- main/php_main.h
- main/php_memory_streams.h
- main/php_network.h
- main/php_open_temporary_file.h
- main/php_reentrancy.h
- main/php_regex.h
- main/php_syslog.h
- main/php_variables.c
- main/reentrancy.c
- main/rfc1867.c
- main/rfc1867.h
- main/safe_mode.c
- main/safe_mode.h
- main/snprintf.c
- main/snprintf.h
- main/spprintf.c
- main/spprintf.h
- main/strlcat.c
- main/strlcpy.c
- main/win95nt.h
- main/streams/cast.c
- main/streams/filter.c
- main/streams/memory.c
- main/streams/php_stream_context.h
- main/streams/php_stream_filter_api.h
- main/streams/php_stream_plain_wrapper.h
- main/streams/php_stream_userspace.h
- main/streams/php_streams_int.h
- main/streams/plain_wrapper.c
- main/streams/streams.c
- main/streams/userspace.c:
- ws fixes + missing Id tags, headers added
-
-2003-02-19 Corne' Cornelius <cornec@reach.co.za>
-
- * ext/informix/config.m4:
- Updated IFX_VERSION entry to work with new Version output of ESQL/C
-
-2003-02-19 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- cleanup, documentation belongs elsewhere
-
-2003-02-19 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * ext/standard/http_fopen_wrapper.c:
- Fixed bug #22283 (possible crash when opening relative URLs).
-
-2003-02-19 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- Added string.strip_tags filter.
-
-2003-02-18 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- Fixed memory leaks on conversion failure.
-
- * ext/standard/filters.c:
- Revived convert filter codes
-
-2003-02-18 Jon Parise <jon@csh.rit.edu>
-
- * ext/rpc/skeleton/skeleton.c:
- Remove a stray COM reference.
-
-2003-02-18 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/dba/libflatfile/flatfile.c:
- - wrong use of sizeof(char)
- - use define for block size
- - a bit faster
-
- * ext/dba/libflatfile/flatfile.c:
- coding style
-
- * ext/dba/libflatfile/flatfile.h:
- avoiding problems
-
-2003-02-18 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * NEWS
- NEWS
- NEWS:
- BFN
-
-2003-02-18 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/md5.c
- ext/standard/sha1.c
- ext/standard/tests/strings/md5.phpt
- ext/standard/tests/strings/md5raw.phpt
- ext/standard/tests/strings/sha1.phpt
- ext/standard/tests/strings/sha1raw.phpt:
- - Added new parameter to sha1() and md5() which return the digest as
- binary data. (Original patch by Michael Bretterklieber
- <mbretter@jawa.at>)
- - Added test cases for sha1() and md5() based on the testvectors in RFC
- 1321
- and RFC 3174.
-
-2003-02-18 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/mbstring/mbstring.c:
- Added description for the hand-made finite state machine.
-
-2003-02-18 Derick Rethans <d.rethans@jdimedia.nl>
-
- * run-tests.php:
- - Add check for proc_open() being available
-
-2003-02-18 Sascha Schumann <sascha@schumann.cx>
-
- * ext/session/php_session.h
- ext/session/session.c:
- Refactor new-session-id code
-
- * ext/session/php_session.h
- ext/session/session.c:
- Remember whether to send a cookie, so that we send out the correct
- session id. Also improve check for active session
-
-2003-02-18 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/rpc/com/com.c
- main/streams/streams.c:
- Fix incorrect TSRMLS_CC usage.
- Fix com_create_guid()
-
-2003-02-18 Sascha Schumann <sascha@schumann.cx>
-
- * ext/session/php_session.h
- ext/session/session.c:
- add session_regenerate_id()
-
-2003-02-18 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/mbstring/mbstring.c:
- Fixed mb_send_mail() so that Content-Type and Content-Transfer-Encoding
- headers are overridable by additional header parameters.
- This patch fixes bug #21985 and bug #22064.
-
- * ext/standard/string.c:
- Fixed bug #21708 (ucfirst() trouble again)
-
-
- * ext/standard/file.c:
- Fixed bug #21689 (fgetcsv suppresses some characters before a separator)
- The fix is suggested by Masahiro Nakayama <masa@sfc.wide.ad.jp>
-
-
-2003-02-18 Zeev Suraski <zeev@zend.com>
-
- * win32/pwd.c
- win32/time.h:
- Commit missing stuff
-
-2003-02-18 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/rpc/com/com.c
- ext/rpc/com/variant.h:
- Implement com_create_guid().
- Add a special case for RETVAL_VARIANT when a variant is of type
- VT_DISPATCH but has a NULL dispatch pointer.
- This kind of variant is returned by the WindowsInstaller automation
- interface.
-
- * configure.in
- ext/standard/basic_functions.c
- main/main.c
- main/php_ini.c:
- Implement simple stream support in the ZE scanners.
-
-2003-02-18 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/mysqli_api.c
- ext/mysqli/mysqli_fe.c
- ext/mysqli/php_mysqli.h:
- added new function mysqli_stmt_store_result
-
- * ext/mysqli/tests/057.phpt:
- test for mysqli_stmt_store_result
-
-2003-02-18 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/rpc/com/com.c:
- Implement com_indexed_prop_set() which allows setting of array-like indexed
- properties on COM objects.
- It is expected that this function will be transient, waiting for
- engine-level and then rpc-level support to be implemented so that this can
- be integrated more completely.
- I'm committing this now so that others can help develop the msi installer
- scripts that require this feature.
-
-2003-02-18 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/php_fopen_wrapper.c:
- Introduce //filter target to php: wrapper to allow inline application of
- filters during fopen() style opperations
-
-2003-02-18 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- style polizei
-
- * ext/pcntl/config.m4:
- getpriority() and setpriority() are in libc..
-
- * ext/standard/config.m4:
- nice() is part of libc, use AC_CHECK_FUNCS instead
-
-2003-02-18 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/mysqli/mysqli_api.c:
- Fixed compiler warning.
-
-2003-02-18 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/file.c
- main/streams/php_stream_filter_api.h:
- Fix stream_filter_(ap|pre)pend to allow attaching on the read and/or write
- chains. Automagically decide what to do if noone tells us.
-
-2003-02-18 Ilia Alshanetsky <ilia@prohost.org>
-
- * NEWS:
- New function news.
-
- * ext/pcntl/config.m4
- ext/pcntl/pcntl.c
- ext/pcntl/php_pcntl.h:
- Added pcntl_setpriority & pcntl_getpriority(). These functions can be used
- to fetch and alter the priority of a process.
-
-2003-02-18 Wez Furlong <wez.php@thebrainroom.net>
-
- * main/streams/filter.c
- main/streams/streams.c:
- TSRMLS!
-
- * ext/standard/tests/filters/basic.phpt:
- Add basic test of read filters and read filter chain.
-
-2003-02-18 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/basic_functions.c
- ext/standard/exec.c
- ext/standard/exec.h:
- By popular demand nice() is renamed to proc_nice().
- A better error message for proc_nice() failure.
-
-2003-02-18 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/file.c
- ext/standard/filters.c
- ext/standard/user_filters.c
- main/php_streams.h
- main/streams/cast.c
- main/streams/context.h
- main/streams/filter.c
- main/streams/filter_api.h
- main/streams/php_stream_context.h
- main/streams/php_stream_filter_api.h
- main/streams/php_stream_plain_wrapper.h
- main/streams/php_stream_userspace.h
- main/streams/plain_wrapper.h
- main/streams/streams.c
- main/streams/userspace.h:
- Implement new filter API, stage 1.
- This breaks user-space filters (for the time being), and those
- weird convert.* filters in ext/standard/filters.c
-
- The filters stack has been separated into one chain for read and one chain
- for write.
-
- The user-space stream_filter_append() type functions currently only
- operate
- on the read chain. They need extending to work with the write chain too.
-
-2003-02-18 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/basic_functions.c
- ext/standard/config.m4
- ext/standard/exec.c
- ext/standard/exec.h:
- Added nice() function, which allows changing of priority for the current
- process.
-
-2003-02-18 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/tests/056.phpt:
- new test (class which extends mysqli. currently this test fails :( )
-
- * ext/mysqli/mysqli.c:
- removed duplicate code
-
- * ext/mysqli/mysqli.c
- ext/mysqli/mysqli_api.c:
- fixed some leaks when mysql_close will be called before all stmts are
- freed.
-
-2003-02-17 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/tests/050.phpt
- ext/mysqli/tests/051.phpt
- ext/mysqli/tests/052.phpt
- ext/mysqli/tests/053.phpt
- ext/mysqli/tests/054.phpt
- ext/mysqli/tests/055.phpt:
- additional tests for non freed objects
-
-2003-02-17 Jani Taskinen <sniper@iki.fi>
-
- * ext/snmp/config.m4:
- MFB: Sanity check.
-
- * (PHP_4_3)
- ext/snmp/config.m4:
- Sanity check to prevent errors in other extensions tests.
-
- * NEWS:
- Update
-
-2003-02-17 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/tests/049.phpt:
- test for mysql_fetch_row (oo-style)
-
-2003-02-17 Zeev Suraski <zeev@zend.com>
-
- * ext/rpc/com/com.c
- ext/rpc/com/conversion.c
- ext/rpc/com/dispatch.c
- ext/rpc/com/variant.c
- ext/snmp/winsnmp.c
- ext/standard/file.c
- ext/standard/flock_compat.c
- ext/standard/ftp_fopen_wrapper.c
- ext/standard/http_fopen_wrapper.c
- ext/standard/pack.c
- ext/standard/rand.c
- ext/w32api/w32api.c
- ext/zlib/zlib.c
- main/fopen_wrappers.c
- main/main.c
- main/network.c
- main/php.h
- main/php_open_temporary_file.c
- sapi/apache/php_apache_http.h
- sapi/cgi/cgi_main.c
- sapi/isapi/php4isapi.c:
- Win32 build improvements
-
-2003-02-17 Wez Furlong <wez.php@thebrainroom.net>
-
- * sapi/isapi/php4isapi.c:
- Fix build under win32
-
-2003-02-17 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/mysqli_fe.c:
- added close method/alias for result object (for compatibility with
- statement and
- link objects)
-
- * ext/mysqli/tests/048.phpt:
- test for OO-Implementation (bind_result)
-
-2003-02-17 Shane Caraveo <shane@caraveo.com>
-
- * ext/standard/proc_open.c:
- you know it's time to get away from the keyboard when you do this.
-
- fix my last fix
-
-2003-02-17 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/proc_open.c:
- - Style polizei
-
-2003-02-17 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/basic_functions.c
- ext/standard/datetime.c
- ext/standard/datetime.h
- ext/standard/php_standard.h
- ext/standard/php_sunfuncs.h
- ext/standard/sunfuncs.c
- ext/standard/sunfuncs.h
- win32/php4dllts.dsp:
- - Cleaned this mess a bit:
- . Centralized the functions sunrise/sunset to php_sunrise_sunset
- to lessen duplicate code.
- . Made wrapper function php_do_date_sunrise_sunset() to lessen
- duplicate code.
- . Coding style fixes.
- . renamed sunfuncs.h -> php_sunfuncs.h
-
- * ext/standard/tests/time/idate.phpt:
- - These results were obviously got with TZ=GMT
-
- * ext/standard/tests/general_functions/sunfuncts.phpt:
- Assuming the results were created in system with Asia/Jerusalem as TZ
-
-2003-02-17 Shane Caraveo <shane@caraveo.com>
-
- * ext/standard/proc_open.c:
- fix it the right way
-
-2003-02-17 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/tests/general_functions/sunfuncts.phpt:
- override precision ini setting
-
-2003-02-17 Shane Caraveo <shane@caraveo.com>
-
- * sapi/cgi/cgi_main.c:
- prevent possible crash if used in combo with mod_gzip
- fix command line
-
- * ext/standard/proc_open.c:
- If you pass NULL, you do not get a NULL value, make sure it is.
-
-2003-02-17 Jani Taskinen <sniper@iki.fi>
-
- * ext/bcmath/libbcmath/src/bcmath.h
- ext/bcmath/libbcmath/src/config.h
- ext/ovrimos/ovrimos.c
- ext/standard/flock_compat.c
- win32/glob.c
- win32/time.h
- win32/winutil.c:
- - Let's be consistent with these..
-
-2003-02-17 Wez Furlong <wez.php@thebrainroom.net>
-
- * main/php_streams.h
- main/streams/context.h
- main/streams/filter_api.h
- main/streams/plain_wrapper.h
- main/streams/userspace.h:
- Move some of the streams header into supplementary files
-
-
-2003-02-17 Shane Caraveo <shane@caraveo.com>
-
- * run-tests2.php:
- bring up to date with change in run-tests
-
-2003-02-17 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- configure.in
- main/php_version.h:
- Bump up the version.
-
-2003-02-17 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/sunfuncs.c:
- Fix compile warning
-
-2003-02-16 Wez Furlong <wez.php@thebrainroom.net>
-
- * win32/installer/setini.php:
- Some additional sanity.
-
- * win32/php4dllts.dsp:
- Add the sunfuncs to the .dsp file for Moshe.
-
- * win32/php4dllts.dsp:
- Update win32 project for streams juggling.
-
- * ext/standard/file.c:
- Remove unused vars
-
-2003-02-16 Moshe Doron <mosdoron@netvision.net.il>
-
- * ext/standard/basic_functions.c
- ext/standard/config.m4
- ext/standard/datetime.c
- ext/standard/datetime.h
- ext/standard/php_standard.h
- ext/standard/sunfuncs.c
- ext/standard/sunfuncs.h
- ext/standard/tests/general_functions/sunfuncts.phpt
- ext/standard/tests/time/idate.phpt:
-
-
-2003-02-16 Wez Furlong <wez.php@thebrainroom.net>
-
- * configure.in
- main/memory_streams.c
- main/streams.c
- main/user_streams.c
- main/streams/.cvsignore
- main/streams/cast.c
- main/streams/filter.c
- main/streams/memory.c
- main/streams/php_streams_int.h
- main/streams/plain_wrapper.c
- main/streams/streams.c
- main/streams/userspace.c:
- Move streams files around a bit, to ease maintenance.
- I will update the win32 .dsp in a moment.
-
-2003-02-16 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/tests/042.phpt
- ext/mysqli/tests/047.phpt:
- fixed output
-
-2003-02-16 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/mysqli/mysqli_api.c:
- Reverted lld -> lld patch and added explanation as to why it should not be
- done.
-
- * ext/mysqli/mysqli_api.c
- ext/mysqli/php_mysqli.h:
- Moved longlong conversion to a macro.
-
- * ext/mysqli/tests/014.phpt:
- better skip condition.
-
-2003-02-16 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/tests/file/bug21131.phpt:
- Remove bogus test.
- Append mode always causes written data to go to the end of the file,
- regardless of the current seek position.
-
- * ext/standard/proc_open.c
- ext/standard/proc_open.h:
- Integrate Shanes patch that allows specifying the cwd and environment
- for the child process created by proc_open().
-
-2003-02-16 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3_1)
- NEWS:
- BFN
-
-2003-02-16 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/tests/047.phpt:
- test for mysqli_prepare_result
-
-2003-02-16 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/bcmath/libbcmath/src/config.h:
- Fix bcmath build under win32.
-
-2003-02-16 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/tests/046.phpt:
- test for mysqli_stmt_affected_rows (delete command)
-
- * ext/mysqli/mysqli_api.c
- ext/mysqli/mysqli_fe.c
- ext/mysqli/mysqli_nonapi.c
- ext/mysqli/php_mysqli.h:
- added new function mysqli_stmt_affected_rows
- added bigint support for mysqli_affected_rows
- fixed memleak in mysqli_prepare (stmt->is_null)
- fixed return type for mysqli_connect
-
-2003-02-16 Wez Furlong <wez.php@thebrainroom.net>
-
- * run-tests.php
- ext/curl/interface.c
- ext/curl/streams.c
- ext/fbsql/php_fbsql.c
- ext/ftp/ftp.c
- ext/hyperwave/hg_comm.c
- ext/hyperwave/hw.c
- ext/imap/php_imap.c
- ext/ldap/ldap.c
- ext/mcal/php_mcal.c
- ext/mysql/php_mysql.c
- ext/odbc/php_odbc.c
- ext/rpc/com/com_wrapper.c
- ext/snmp/snmp.c
- ext/standard/dns.c
- ext/standard/file.c
- ext/standard/fsock.c
- ext/standard/ftp_fopen_wrapper.c
- ext/standard/http_fopen_wrapper.c
- ext/standard/pack.c
- ext/zlib/zlib.c
- main/fopen_wrappers.c
- main/mergesort.c
- main/network.c
- main/php.h
- main/php_open_temporary_file.c
- main/streams.c
- win32/php4dllts.dsp
- win32/sendmail.c
- win32/time.h:
- A add much more useful select(2) implementation than is provided by
- windows sockets. The winsock implementation will only work with sockets;
- our implementation works with sockets and file descriptors.
- By association, stream_select() will now operate correctly with files,
- pipes and sockets.
-
- This change required linking against the winsock2 library. In terms of
- compatibility, only older versions of windows 95 do not have winsock2
- installed by default. It is available as a redistributable file, and is
- most likely installed by any OS patches (eg: Internet Explorer) applied by
- the user.
-
- Also, add a win32 compatible pipe test when opening a stream from a pipe.
- This test will only work on NT, win2k and XP platforms. Without this
- test, interleaved fread() and select() calls would cause the read buffer
- to be clobbered. I will be working on a fix for this issue for win9x.
-
-2003-02-16 Anil Madhavapeddy <anil@recoil.org>
-
- * pear/PEAR/Command/Package.php:
- fix error msg typo
-
-2003-02-16 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * sapi/cgi/cgi_main.c
- sapi/cgi/getopt.c
- sapi/cgi/php_getopt.h
- sapi/cli/getopt.c
- sapi/cli/php.1.in
- sapi/cli/php_cli.c
- sapi/cli/php_getopt.h:
- - Allow long option names
- - Update CLI's manpage
-
-
-
-2003-02-15 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3_1)
- sapi/cgi/cgi_main.c:
- revert this
-
- * (PHP_4_3_1)
- main/fopen_wrappers.c:
- Revert this.
-
- * (PHP_4_3)
- sapi/apache2handler/.cvsignore
- sapi/apache2handler/README:
- - Remove all of it.
-
-2003-02-15 Ian Holsman <Ian@holsman.net>
-
- * (PHP_4_3)
- sapi/apache2handler/CREDITS
- sapi/apache2handler/README
- sapi/apache2handler/apache_config.c
- sapi/apache2handler/config.m4
- sapi/apache2handler/php.sym
- sapi/apache2handler/php4apache2.dsp
- sapi/apache2handler/php_apache.h
- sapi/apache2handler/php_functions.c
- sapi/apache2handler/sapi_apache2.c:
-
- After short discussion, the #php.bugs mob decided that we don't want
- this in PHP_4_3 branch. At least as long as it doesn't work as well
- (or preferrably better :) than the apache2filter SAPI does.
-
- So please remove it from the branch for now..
-
- --Jani
-
-2003-02-15 Ilia Alshanetsky <ilia@prohost.org>
-
- * NEWS:
- New feature news.
-
-2003-02-15 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3_1)
- configure.in
- sapi/cgi/cgi_main.c:
- - correct version plus the fix.
-
-2003-02-15 Edin Kadribasic <edink@proventum.net>
-
- * (PHP_4_3_1)
- main/php_version.h:
- New version number.
-
-2003-02-15 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- BFN
-
-2003-02-15 Stig Bakken <ssb@fast.no>
-
- * (PHP_4_3)
- pear/PEAR.php
- pear/System.php
- pear/package-PEAR.xml
- pear/package.dtd
- pear/OS/Guess.php
- pear/PEAR/Autoloader.php
- pear/PEAR/Builder.php
- pear/PEAR/Command.php
- pear/PEAR/Common.php
- pear/PEAR/Config.php
- pear/PEAR/Dependency.php
- pear/PEAR/Installer.php
- pear/PEAR/Packager.php
- pear/PEAR/Registry.php
- pear/PEAR/Remote.php
- pear/PEAR/Command/Auth.php
- pear/PEAR/Command/Build.php
- pear/PEAR/Command/Common.php
- pear/PEAR/Command/Config.php
- pear/PEAR/Command/Install.php
- pear/PEAR/Command/Package.php
- pear/PEAR/Command/Registry.php
- pear/PEAR/Command/Remote.php
- pear/PEAR/Frontend/CLI.php
- pear/scripts/pear.bat
- pear/scripts/pear.in:
- - import PEAR 1.0.1
-
-2003-02-15 Jani Taskinen <sniper@iki.fi>
-
- * main/main.c:
- - Fix unsetting of open_basedir, safe_mode_exec_dir and user_dir with
- "php_admin_value <ini option> none"
- - Fixes bug #22220
-
-2003-02-15 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/mysqli/config.m4:
- Proper lib detection.
-
-2003-02-15 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- NEWS
- NEWS:
- B.F.N.
-
- * main/streams.c:
- Fixed bug #22234
-
-2003-02-15 Wez Furlong <wez.php@thebrainroom.net>
-
- * run-tests.php:
- If a test does not have any data after 60 seconds of waiting, assume that
- it died a horrible death and kill it.
- This is useful on windows when a message box is popped-up during an
- automated
- test-run.
-
- * ext/standard/proc_open.c:
- Add optional signal parameter to proc_terminate.
-
- * ext/standard/basic_functions.c
- ext/standard/exec.h
- ext/standard/proc_open.c:
- Add proc_terminate() function to forcibly kill off a process created
- with proc_open().
-
-2003-02-15 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/mysqli/tests/014.phpt:
- Fixed skip condition.
-
-2003-02-15 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/tests/014.phpt
- ext/mysqli/tests/015.phpt:
- added skipif section (innodb-support)
-
-2003-02-15 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- ext/standard/formatted_print.c
- ext/standard/tests/strings/bug22227.phpt:
- MFH(r1.65): Fixed bug #22227
- MFH: Added test case for bug #22227
-
- * ext/standard/formatted_print.c
- ext/standard/tests/strings/bug22227.phpt:
- Fixed bug #22227
- Added test case for bug #22227
-
-2003-02-15 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * sapi/cli/php_cli.c:
- fix parameter string (-R & -H)
-
-2003-02-15 Wez Furlong <wez.php@thebrainroom.net>
-
- * (PHP_4_3)
- NEWS:
- bug fixed.
-
-2003-02-15 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * tests/lang/bug22231.phpt:
-
- Added test case for bug #22231
-
-2003-02-15 Wez Furlong <wez.php@thebrainroom.net>
-
- * (PHP_4_3)
- main/network.c:
- MFH: Fix for Bug #21809 (select() never times out during socket shutdown)
-
-2003-02-15 Edin Kadribasic <edink@proventum.net>
-
- * (PHP_4_3)
- sapi/cgi/cgi_main.c:
- Option -b needs an argument. This fixes #22229.
-
-2003-02-15 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ext/mysqli/tests/.cvsignore:
- Add .cvsignore for tests.
-
-2003-02-15 Ian Holsman <Ian@holsman.net>
-
- * (PHP_4_3)
- sapi/apache2handler/.cvsignore
- sapi/apache2handler/CREDITS
- sapi/apache2handler/README
- sapi/apache2handler/apache_config.c
- sapi/apache2handler/config.m4
- sapi/apache2handler/php.sym
- sapi/apache2handler/php4apache2.dsp
- sapi/apache2handler/php_apache.h
- sapi/apache2handler/php_functions.c
- sapi/apache2handler/sapi_apache2.c:
- alternate apache2 SAPI.
-
-2003-02-14 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/mysqli/php_mysqli.h:
- Allow mysqli to be built when imap (c-client) is used.
-
- * ext/ftp/ftp.c
- ext/ftp/php_ftp.c
- ext/mysqli/mysqli_api.c:
- CS fixes.
-
- * ext/mysqli/mysqli.c
- ext/mysqli/mysqli_api.c:
- Fixed compile warnings.
-
-2003-02-14 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/tests/045.phpt:
- test for bind_result with show
-
-2003-02-14 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- NEWS:
- Slight fix for consistency
-
- * (PHP_4_3)
- NEWS:
- BFN
-
-2003-02-14 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/standard/image.c:
- a little bit slower but somewhat tricky and more flexible and it does not
- allocate static buffers anymore
-
-2003-02-14 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- ext/standard/string.c:
- Fixed wrong commit: s/&/*/
-
- * (PHP_4_3)
- ext/standard/string.c:
- MFH(r1.358): Fixed a str_replace() bug similar to bug #22224
-
- * ext/standard/string.c:
- Fixed a str_replace() bug similar to bug #22224
-
- * (PHP_4_3)
- ext/standard/string.c
- ext/standard/tests/strings/bug22224.phpt:
- MFH(r1.357): Fixed bug #22224
- MFH: Added test case for the bug
-
- * ext/standard/string.c
- ext/standard/tests/strings/bug22224.phpt:
- Fixed bug #22224 (implode changes object references in array)
- Added test case for the bug
-
-2003-02-14 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/mysqli/mysqli_nonapi.c:
- Fixed a typo.
-
-2003-02-14 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/mysqli_nonapi.c:
- fixed compiler warning
-
- * ext/mysqli/mysqli_api.c:
- fixed a bug in mysqli_fetch
- removed c++ comment (thx to Jani :)
- fixed compiler warning
-
-2003-02-14 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/mysqli/mysqli.c
- ext/mysqli/mysqli_api.c
- ext/mysqli/mysqli_nonapi.c
- ext/mysqli/php_mysqli.h:
- Missing portion of the previous patch.
-
- * ext/mysqli/php_mysqli.h:
- Buncha Fixes.
- * Fixed a number of memory leaks.
- * Fixed some php_error_docref() calls that tried to print non-existent
- arguments.
- * Fixed some signed/unsigned problems.
- * Fixed the MYSQLI_FETCH_RESOURCE macro so that compilers do not complain
- about un-initialized variables.
- * CS fixes.
-
-2003-02-14 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/mysqli_api.c:
- bind_result fix
-
- * ext/mysqli/mysqli.c:
- fixed a bug in prepare/bind
-
-2003-02-14 Jani Taskinen <sniper@iki.fi>
-
- * sapi/cgi/cgi_main.c:
- MFB
-
- * (PHP_4_3)
- sapi/cgi/cgi_main.c:
- Added missing Id tag
-
-2003-02-14 Thies C. Arntzen <thies@thieso.net>
-
- * .gdbinit:
- add really nice dump_bt function for debugging in gdb
-
-2003-02-14 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- configure.in
- ext/standard/config.m4:
- - MFH, do not add libcrypt if crypt() is provided by libc.
-
- * configure.in
- ext/standard/config.m4:
- - Don't add libcrypt if the crypt() function is provided already.
- (by libc, like in HP-UX)
-
-2003-02-13 Sara Golemon <php@alphaweb.net>
-
- * ext/ftp/ftp.c:
- MFB(r-1.68.2.5) Bug 22052
-
- * (PHP_4_3)
- ext/ftp/ftp.c:
- Buf #22052 More casual efree()ing causing segfaults
-
-2003-02-13 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/domxml/php_domxml.c:
- pass tsrmls instead of fetching it always
-
-2003-02-13 Wez Furlong <wez.php@thebrainroom.net>
-
- * main/streams.c:
- MFB: Fix for bug #22199
-
- * (PHP_4_3)
- main/streams.c:
- Fix for Bug #22199 (fputs() + fgets() destroys readbuffer for non-seekable
- streams).
-
-2003-02-13 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- typofix
-
-2003-02-13 Sara Golemon <php@alphaweb.net>
-
- * NEWS
- ext/ftp/ftp.c:
- Bug #22059. ftp_chdir() causes segfault. efree(ftp->pwd) was being called
- without knowing for certain that ftp->pwd
- actually pointed anywhere.
-
-2003-02-13 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * sapi/cgi/cgi_main.c:
- fix non FCGI build
-
-2003-02-13 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/tests/strings/bug22187.phpt:
-
- Added test case for bug #22187.
-
- * main/snprintf.c:
- Modified fix for bug #22187 so that it does not affect handling of numbers
- represented in scientific notation.
-
-2003-02-13 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/tests/strings/crypt.phpt:
-
- Added test for those different crypt() methods. Hopefully I got the
- results right.
-
-2003-02-13 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/tests/connect.inc:
- include file for test
-
-2003-02-13 Shane Caraveo <shane@caraveo.com>
-
- * sapi/cgi/cgi_main.c:
- There is *absolutely no* definitive way to know if argv0 is the
- actual php script, or if it is the beginning of a query string.
- Additionaly, passing parameters on the command line is
- not part of CGI spec, and is not required by either
- Apache or IIS. So I have removed that code altogether,
- and done some further cleanup. Also fix pre4.3 behaviour if
- fix_pathinfo=0.
- I've tested with IIS and Apache 1.3.27 on w2k and RH 7.3.
-
-2003-02-13 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/rpc/com/variant.c:
- Fixed warnings.
-
-2003-02-13 Wez Furlong <wez.php@thebrainroom.net>
-
- * main/php_open_temporary_file.c:
- Another IS_SLASH fix.
-
-2003-02-13 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * ext/standard/formatted_print.c
- ext/standard/tests/strings/bug22207.phpt:
- Fixed bug #22207 (e notation in *printf would be missing a 0 when there is
- no exponent).
- Added a test case for the bug.
-
-2003-02-13 Wez Furlong <wez.php@thebrainroom.net>
-
- * main/streams.c:
- A probable cure for many getcwd/relative include related problems for
- win32.
-
-2003-02-13 Ilia Alshanetsky <ilia@prohost.org>
-
- * main/spprintf.c:
- PAD() macro didn't increase the buffer size resulting in loss of the
- padding.
-
-2003-02-13 Edin Kadribasic <edink@proventum.net>
-
- * ext/mysqli/mysqli_api.c:
- Use my_ulonglong instead of unsigned long long to make msvc++ happy.
-
-2003-02-13 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- change history
-
- * (PHP_4_3)
- NEWS:
- altering history..
-
-2003-02-13 Harald Radi <harald.radi+coding.php@nme.at>
-
- * (PHP_4_3)
- ext/standard/info.c:
- add missing include
-
-2003-02-13 Edin Kadribasic <edink@proventum.net>
-
- * ext/mysqli/.cvsignore:
- Adding missing .cvsignore
-
-2003-02-13 Ilia Alshanetsky <ilia@prohost.org>
-
- * main/streams.c:
- Fixed a typo.
-
- * main/streams.c:
- Simplified the mode validation code & added support for read+write mode to
- 'x' mode.
-
- * ext/rpc/com/variant.c:
- Added missing header needed for rpc_error().
-
-2003-02-13 Wez Furlong <wez.php@thebrainroom.net>
-
- * main/streams.c:
- Clarify error message.
-
-2003-02-13 Edin Kadribasic <edink@proventum.net>
-
- * ext/mysqli/mysqli.dsp:
- Initial windows project file
-
-2003-02-13 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/ftp_fopen_wrapper.c
- ext/standard/http_fopen_wrapper.c
- main/streams.c:
- Added 'x' mode for fopen() used on local files. This mode will create a new
- file only if a file does not already exist (O_CREAT|O_EXCL).
-
-2003-02-13 Wez Furlong <wez.php@thebrainroom.net>
-
- * main/network.c:
- Potential fixes for #21809 and #22099.
-
- * ext/standard/php_fopen_wrapper.c:
- Use FILE*-less implementation for php://(stdin|stdout|stderr)
-
- * (PHP_4_3)
- ext/standard/http_fopen_wrapper.c:
- partial MFH: avoid problems with auto_detect_line_endings.
-
- * main/php_streams.h
- main/streams.c:
- Moving away from ANSI stdio for plain files.
-
- * ext/standard/http_fopen_wrapper.c:
- Avoid problems with chunk_size and auto_detect_line_endings.
-
- * (PHP_4_3)
- ext/standard/config.m4:
- MFH: cli should be allowed to use chroot() function.
-
- * ext/standard/config.m4:
- cli should be allowed to have the chroot() function.
-
- * main/streams.c:
- Whitespace-fix these goto labels.
-
-2003-02-13 Uwe Steinmann <uwe@steinmann.cx>
-
- * (PHP_4_3)
- NEWS
- ext/hwapi/hwapi.cpp:
- - Some functions with objects as its parameters didn't recognize them
- as such
-
-2003-02-13 Wez Furlong <wez.php@thebrainroom.net>
-
- * win32/installer/gen-nsis.php:
- Update installer so that no extensions are enabled by default.
-
-2003-02-13 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/tests/001.phpt:
- removed warnings (unused vars)
-
-2003-02-13 Uwe Steinmann <uwe@steinmann.cx>
-
- * ext/hwapi/hwapi.cpp:
- - added more missing strcmp()
-
-2003-02-13 Jani Taskinen <sniper@iki.fi>
-
- * sapi/apache/config.m4:
- Added HAVE_APACHE define.
-
- * (PHP_4_3)
- ext/standard/image.c
- ext/standard/php_image.h
- ext/standard/tests/image/bug13213.phpt
- ext/standard/tests/image/getimagesize.phpt
- ext/standard/tests/image/image_type_to_mime_type.phpt
- ext/standard/tests/image/test1pix.jp2:
- - MFH: improved jpeg 2000 and wbmp support for getimagesize()
-
- * NEWS:
- Merged these to 4.3.x branch
-
- * ext/standard/image.c:
- ws fix
-
- * (PHP_4_3)
- NEWS:
- clean..
-
-2003-02-13 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/thttpd/thttpd_patch:
- include limits.h for portability
-
- * sapi/thttpd/config.m4:
- portability work
-
-2003-02-13 Wez Furlong <wez.php@thebrainroom.net>
-
- * (PHP_4_3)
- NEWS:
- Fixed that one...
-
-2003-02-13 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/tests/042.phpt
- ext/mysqli/tests/043.phpt
- ext/mysqli/tests/044.phpt:
- new tests
-
-2003-02-13 Wez Furlong <wez.php@thebrainroom.net>
-
- * main/streams.c:
- Fix for Bug #21815 (fpassthru ignored buffered data but then complained
- anyway)
-
-2003-02-13 Sara Golemon <php@alphaweb.net>
-
- * (PHP_4_3)
- ext/standard/http_fopen_wrapper.c:
- Reverting earlier patch to reintroduce buggy behavior (yes, you heard that
- right) of filtered http streams in favor of
- performance. This has little consequence given limited filter support in
- 4.3 branch. Filters will be redesigned in
- 5.0 release. For more information see Wez, Ilia, or myself.
-
-2003-02-13 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/mysqli_api.c
- ext/mysqli/mysqli_fe.c
- ext/mysqli/php_mysqli.h:
- added new function int mysql_get_server_version
- this function is available since libmysql change set 1.1450 (2002-02-13)
-
-2003-02-12 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/mysqli_fe.c:
- changed function entries for statements
-
-2003-02-12 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS
- NEWS:
- Bug fixing news.
-
- * ext/fbsql/php_fbsql.c:
- Fixed bug #22191 (frontbase build was broken for people using older
- versions).
-
- * main/snprintf.c:
- Fixed bug #22187 (spprintf function did not handle floats correctly).
-
-2003-02-12 Sascha Schumann <sascha@schumann.cx>
-
- * main/spprintf.c:
- - trims +100 lines of code from spprintf.c
- - introduces an overflow detection in STR_TO_DEC
- - eliminates dead code (e.g. assert(foo); if (foo) {..})
- - removes unused macros from the original code
- - simplifies code (e.g. cc was completely dropped)
- - improves run-time performance
-
- The max_len feature is never used in our code base.
- Nevertheless, cpu cycles were spent on each string
- operation to check the current length against max_len which
- is quite inefficient. Thus, I've moved the check to
- vspprintf where it is applied only once per call.
-
-2003-02-12 Mark L. Woodward <mlwmohawk@mohawksoft.com>
-
- * ext/msession/config.m4:
- Fix for GCC 3
-
-2003-02-12 Jani Taskinen <sniper@iki.fi>
-
- * sapi/apache/config.m4:
- Fixed the "member fd in BUFF" test for --with-apxs builds
-
-2003-02-12 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/mysqli/config.m4:
- - Let's add the config.m4 file too :-)
-
-2003-02-12 Jani Taskinen <sniper@iki.fi>
-
- * sapi/cli/.cvsignore:
- added missing entry
-
- * (PHP_4_3)
- NEWS:
- add blame tag
-
-2003-02-12 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/url_scanner_ex.c
- ext/standard/url_scanner_ex.re:
- Fixed bug #22048 (incorrect insertion of session id when tabs are used to
- separate tag elements).
-
-2003-02-12 Uwe Steinmann <uwe@steinmann.cx>
-
- * ext/hwapi/hwapi.cpp:
- - Fixed compile errors and some oddities like missing strcmp
-
-2003-02-12 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/tests/036.phpt
- ext/mysqli/tests/037.phpt
- ext/mysqli/tests/038.phpt
- ext/mysqli/tests/039.phpt
- ext/mysqli/tests/040.phpt
- ext/mysqli/tests/041.phpt:
- added new tests
-
- * ext/mysqli/mysqli_api.c
- ext/mysqli/mysqli_fe.c
- ext/mysqli/php_mysqli.h:
- removed function mysql_num_warnings (libmysql change).
-
-2003-02-12 Jani Taskinen <sniper@iki.fi>
-
- * sapi/cli/Makefile.frag
- sapi/cli/config.m4
- sapi/cli/php.1
- sapi/cli/php.1.in:
- "Generate" the man page so that it gets correct version always.
-
- * NEWS:
- Man page is added in 4.3.1, moved this entry to branch
-
- * sapi/cli/Makefile.frag
- sapi/cli/config.m4:
- - Added the man page installation
-
- * (PHP_4_3)
- Makefile.global:
- MFH: Use $(INSTALL) for installing shared extensions.
-
- * ext/yaz/config.m4:
- Fix obvious errors..
-
- * NEWS:
- news news news..
-
-2003-02-12 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysqli/tests/001.phpt
- ext/mysqli/tests/002.phpt
- ext/mysqli/tests/003.phpt
- ext/mysqli/tests/004.phpt
- ext/mysqli/tests/005.phpt
- ext/mysqli/tests/006.phpt
- ext/mysqli/tests/007.phpt
- ext/mysqli/tests/008.phpt
- ext/mysqli/tests/009.phpt
- ext/mysqli/tests/010.phpt
- ext/mysqli/tests/011.phpt
- ext/mysqli/tests/012.phpt
- ext/mysqli/tests/013.phpt
- ext/mysqli/tests/014.phpt
- ext/mysqli/tests/015.phpt
- ext/mysqli/tests/016.phpt
- ext/mysqli/tests/017.phpt
- ext/mysqli/tests/018.phpt
- ext/mysqli/tests/019.phpt
- ext/mysqli/tests/020.phpt
- ext/mysqli/tests/021.phpt
- ext/mysqli/tests/022.phpt
- ext/mysqli/tests/023.phpt
- ext/mysqli/tests/024.phpt
- ext/mysqli/tests/025.phpt
- ext/mysqli/tests/026.phpt
- ext/mysqli/tests/027.phpt
- ext/mysqli/tests/028.phpt
- ext/mysqli/tests/029.phpt
- ext/mysqli/tests/030.phpt
- ext/mysqli/tests/031.phpt
- ext/mysqli/tests/032.phpt
- ext/mysqli/tests/033.phpt
- ext/mysqli/tests/034.phpt
- ext/mysqli/tests/035.phpt:
- adding a few tests
-
- * ext/mysqli/CREDITS
- ext/mysqli/EXPERIMENTAL
- ext/mysqli/TODO
- ext/mysqli/mysqli.c
- ext/mysqli/mysqli_api.c
- ext/mysqli/mysqli_fe.c
- ext/mysqli/mysqli_nonapi.c
- ext/mysqli/php_mysqli.h:
- initial upload
-
-2003-02-11 Sascha Schumann <sascha@schumann.cx>
-
- * configure.in:
- supply mandir to makefile
-
-2003-02-11 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- main/SAPI.c:
- MFH: reverted my patch & applying a new patch by Stefan Esser
-
-2003-02-11 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * ext/imap/php_imap.c:
- Fixed bug #22048 (crash in imap_headers when the e-mail contains an
- abnormally large number of special characters).
-
- * NEWS:
- New function news.
-
- * ext/standard/basic_functions.c
- ext/standard/php_string.h
- ext/standard/string.c:
- Added strpbrk(), which is essentially a wrapper around C's strpbrk function
- that allows searching through a string for a character list.
-
-2003-02-11 Stefan Esser <s.esser@e-matters.de>
-
- * main/SAPI.c:
- size matters not.
-
- * main/SAPI.c:
- 8 + 20 + 1 + 1 = 30
-
- There was no Bufferoverflow on 64bit systems.
-
- And the "fix" broke the header code on systems with old style snprintf.
-
-2003-02-11 Jani Taskinen <sniper@iki.fi>
-
- * configure.in
- build/buildcheck.sh:
- - Fixed some weird crashes causd by the new default behaviour
- of libtool 1.4.3
- - Require libtool 1.4.3 or newer from now on.
-
-2003-02-11 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * sapi/cli/php_cli.c:
- Make that clear
-
- * sapi/cli/php.1:
- Document -H added by Ilia
-
- * main/spprintf.c:
- speed up
-
-2003-02-11 Melvyn Sopacua <msopacua@idg.nl>
-
- * ext/xslt/TODO:
- Update time
-
-2003-02-11 Ian Holsman <Ian@holsman.net>
-
- * sapi/apache2handler/.cvsignore
- sapi/apache2handler/CREDITS
- sapi/apache2handler/README
- sapi/apache2handler/apache_config.c
- sapi/apache2handler/config.m4
- sapi/apache2handler/php.sym
- sapi/apache2handler/php4apache2.dsp
- sapi/apache2handler/php_apache.h
- sapi/apache2handler/php_functions.c
- sapi/apache2handler/sapi_apache2.c:
- initial checkin of the apache2 SAPI using a handler instead of filters.
- TBD: src highlighting
- better post handling
-
-2003-02-11 Ilia Alshanetsky <ilia@prohost.org>
-
- * sapi/cli/php_cli.c:
- Added -H option to CLI binary. This option can be used to hide any
- arguments
- including the script name passed to the CLI binary.
-
-2003-02-11 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS
- NEWS:
- fugbix news
-
-2003-02-11 Zeev Suraski <zeev@zend.com>
-
- * ext/rpc/rpc.c:
- Fix random crashes
-
-2003-02-11 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/mbstring/mbstring.c:
- Fixed ZTS build
-
-2003-02-11 Jani Taskinen <sniper@iki.fi>
-
- * ext/readline/config.m4:
- - There's no point in allowing using both --with-readline and
- --with-libedit
- the same time. Prefer --with-readline.
- - Use PHP_ADD_LIBRARY when there is no path available.
-
- * (PHP_4_3)
- NEWS:
- Moved one entry from HEAD here..
-
- * NEWS:
- moved entry to branch NEWS
-
- * (PHP_4_3)
- ext/ingres_ii/ii.c:
- MFH: - Fixed bug: #21549 (problem with Ingres II persistent connections)
-
- * ext/ingres_ii/ii.c:
- - Fixed bug: #21549 (problem with Ingres II persistent connections)
-
-2003-02-11 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/apache/config.m4:
- move check to proper place
-
- * sapi/apache/config.m4
- sapi/apache/mod_php4.c:
- Detect whether BUFFs contain a fd element. IBM is hiding the actual
- descriptor behind a void *, so we just disable this for IBM servers
-
-2003-02-11 Frank M. Kromann <frank@kromann.info>
-
- * ext/mssql/php_mssql.c
- ext/mssql/php_mssql.c:
- Bug #20426. Convert SMALLDATETIME correct
-
-2003-02-11 Stig Bakken <ssb@fast.no>
-
- * pear/Makefile.frag:
- - clean up so Jani is not so confused
-
-2003-02-11 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/thttpd/thttpd_patch:
- Add "log to stdout" feature
-
-2003-02-11 Harald Radi <harald.radi+coding.php@nme.at>
-
- * ext/rpc/handler.h
- ext/rpc/rpc.c
- ext/rpc/rpc.h:
- clean up source and improve hashing for implicitly
- created objects (aka return values)
-
- * ext/rpc/com/com.c
- ext/rpc/com/com.h:
- improved reverse lookup of ProgID based on an IDispatch pointer
-
-2003-02-11 Sascha Schumann <sascha@schumann.cx>
-
- * php.ini-dist
- php.ini-recommended:
- update regarding session.save_path
-
- * ext/session/mod_files.c:
- support setting the filemode using session.save_path
-
- * ext/session/php_session.h
- ext/session/session.c:
- use appropiate prefixes in the ps_module structure so we don't clash
- with syscalls
-
-2003-02-11 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- fix news entry per for file() parameter..
-
- * (PHP_4_3)
- NEWS:
- dots..I love ya..
-
- * NEWS:
- Blah
-
- * NEWS:
- krhm..
-
-2003-02-10 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/rpc/com/com_wrapper.c:
- fix rpc_error call
-
-2003-02-10 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/file.c
- ext/standard/file.h:
- Merged the flags for the file() function into a single flag.
-
-2003-02-10 Harald Radi <harald.radi+coding.php@nme.at>
-
- * ext/rpc/handler.h
- ext/rpc/php_rpc.h
- ext/rpc/rpc.c
- ext/rpc/rpc.h
- ext/rpc/rpc_proxy.c
- ext/rpc/com/com.c
- ext/rpc/com/com_wrapper.c
- ext/rpc/com/conversion.c
- ext/rpc/com/variant.c
- ext/rpc/com/variant.h:
- a bunch of fixes
-
- * ext/rpc/skeleton/skeleton.c:
- s/com/skeleton/ is not always a good idea
-
-2003-02-10 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/rpc/com/com.c:
- byref really means that we want the zval...
-
-2003-02-10 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * main/SAPI.c:
- Fixed possible snprintf problem
-
- * (PHP_4_3)
- main/SAPI.c:
- MFH: fixed possible buffer overflow in 64bit systems
-
- * main/SAPI.c:
- Fixed possible buffer overflow in 64bit systems
-
- * NEWS
- NEWS:
- dot dot dot..
-
- * NEWS:
- MFB: Fixed typo
-
- * (PHP_4_3)
- NEWS:
- Fixed typo
-
-2003-02-10 Sara Golemon <php@alphaweb.net>
-
- * (PHP_4_3)
- NEWS:
- Bug 22141
-
-2003-02-10 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * main/SAPI.c:
- Jani happification
-
- * NEWS:
- New function
-
-2003-02-10 Sara Golemon <php@alphaweb.net>
-
- * (PHP_4_3)
- ext/standard/string.c:
- Partial MFH. Deprecated BM algo for str_replace can hang execution. See
- Bug#22141
-
-2003-02-10 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * sapi/apache2filter/sapi_apache2.c:
- Removed unnecessary code
-
- * ext/zlib/php_zlib.h
- ext/zlib/zlib.c
- main/SAPI.c:
- Fixed zlib.output_compression so it can work even if zlib extension is
- built as shared
-
-2003-02-10 Melvyn Sopacua <msopacua@idg.nl>
-
- * Makefile.global:
- MFB: disable output buffering
-
- * (PHP_4_3)
- Makefile.global:
- Make sure we're not buffering stuff
-
-2003-02-10 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/rpc/com/com.c:
- Implement com_describe
-
-2003-02-10 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- acinclude.m4
- config.guess
- config.sub
- configure.in
- ltmain.sh:
- - MFH: libtool upgrade to 1.4.3
-
- * acinclude.m4
- configure.in
- ltmain.sh:
- - Updated libtool to 1.4.3 which has test for the sed problem..
-
-2003-02-10 Jon Parise <jon@csh.rit.edu>
-
- * ext/pgsql/pgsql.c:
- Correct the spelling of 'supported'.
-
-2003-02-10 Stig Bakken <ssb@fast.no>
-
- * pear/PEAR.php:
- - update PEAR::isError phpdoc
-
- * pear/PEAR.php:
- - PEAR::isError accepts second parameter that will be matched against
- the error code. PEAR::isError($obj, FOO) will return true if $obj
- is an error object, and $obj->getCode() returns FOO.
-
- * pear/install-pear.txt:
- - the "a" in "pear" is "application" now
-
-2003-02-10 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/rpc/com/com_wrapper.c:
- Error reporting clean up
-
- * ext/rpc/rpc.c:
- Newly created objects should use a separate function_table from the global
- class entry table.
- For objects instantiated via new, make sure that intern->function_table
- uses the newly created table when the class is registered.
- For generic per-object hashing, copy the ce->function_table into
- intern->function_table.
-
- * ext/rpc/com/com.c
- ext/rpc/com/com_wrapper.c:
- Error reporting leaks and cleanup
-
-2003-02-10 Zeev Suraski <zeev@zend.com>
-
- * tests/lang/bug21961.phpt:
- Fix the test
-
-2003-02-10 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/openssl/openssl.c:
- Add additional optional parameter to openssl_pkcs7_encrypt to specify the
- cipher. The cipher can be one of the constants listed below.
-
- Based on a patch from:
- stefan at cuba dot ionum dot ch
-
- OPENSSL_CIPHER_RC2_40, (the default)
- OPENSSL_CIPHER_RC2_128,
- OPENSSL_CIPHER_RC2_64,
- OPENSSL_CIPHER_DES,
- OPENSSL_CIPHER_3DES,
-
- proto bool openssl_pkcs7_encrypt(string infile, string outfile,
- mixed recipcerts, array headers [, long flags [, long cipher]])
-
-2003-02-10 Harald Radi <harald.radi+coding.php@nme.at>
-
- * (PHP_4_3)
- NEWS:
- 18 times the speed of light
-
-2003-02-10 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/fdf/fdf.c:
- proto fixes
-
-2003-02-10 Jani Taskinen <sniper@iki.fi>
-
- * ext/notes/php_notes.c:
- some win32 fixes by Kai
-
-2003-02-10 Wez Furlong <wez.php@thebrainroom.net>
-
- * win32/installer/gen-nsis.php
- win32/installer/setini.php:
- Fix php.ini customization.
- Apparently, it seems that running the php script with output captured to
- the log prevented it from working correctly.
-
- Also, deletes the php.ini when uninstalled.
-
- TODO: The defaults install and activate all extensions. This is a problem
- for those extension that require non-bundled .dlls (such as OCI).
-
-2003-02-09 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- sapi/nsapi/nsapi.c:
- MFH (ws fixes, but merged to ease any fix patch merging)
-
- * sapi/nsapi/nsapi.c:
- style, ws
-
- * sapi/nsapi/nsapi.c:
- Some compilers puke on these..
-
- * (PHP_4_3)
- sapi/nsapi/nsapi.c:
- MFH: Fixed _SERVER[] variables, memleaks
-
-2003-02-09 Harald Radi <harald.radi+coding.php@nme.at>
-
- * ext/rpc/rpc.c:
- fix a memleak
-
-2003-02-09 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/file.c:
- ZTS fix
-
-2003-02-09 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- We move, fix, change or add stuff
-
- * (PHP_4_3)
- NEWS:
- sex with punctuation mark..
-
-2003-02-09 Kai Schröder <mail@kaischroeder.net>
-
- * ext/standard/datetime.c
- ext/standard/datetime.c:
- fix for #17928
-
-2003-02-09 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/rpc/com/com.c
- ext/rpc/com/com_wrapper.c
- ext/rpc/com/variant.h:
- Fix various little leaks and segfaults.
- Fix scripts like this:
- $obj = new COM('Foo');
- $obj2 = $obj->get_object();
- $obj2->method(); // <-- would segfault here
-
- * ext/rpc/handler.h
- ext/rpc/rpc.c:
- Add get_class_name handler so that the current var_dump implementation does
- not segfault.
- Add a generic rpc_object_from_data() function for generating rpc objects
- from C code (as discussed with Harald).
-
- * ext/rpc/rpc_proxy.c:
- Fix some warnings
-
-2003-02-09 Sascha Schumann <sascha@schumann.cx>
-
- * main/SAPI.c
- sapi/apache/mod_php4.c
- sapi/thttpd/thttpd.c:
- use SUCCESS/FAILURE instead of 0/-1
-
-2003-02-09 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * NEWS:
- New features.
-
- * ext/standard/basic_functions.c
- ext/standard/file.c
- ext/standard/file.h
- main/php_streams.h
- main/streams.c:
- Added feature request #9173 (added stream_get_line(), this function will
- read either the specified number of bytes or until the ending string is
- found).
-
- * ext/standard/file.c:
- Added feature request #17983 (optional parameter to mkdir() that makes
- directory creation recursive).
- Fixed prototype for file() function.
-
-2003-02-09 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- order, style..
-
-2003-02-09 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/file.c:
- Added feature request #14097 (option allowing file() command not to include
- line endings in it's output. As well as another option, which allows blank
- lines to be excluded from the output).
-
-2003-02-09 Jani Taskinen <sniper@iki.fi>
-
- * ext/dba/config.m4:
- break: First one not needed, second missing.
-
-2003-02-09 Shane Caraveo <shane@caraveo.com>
-
- * NEWS:
- news entry for previous commit
-
-2003-02-09 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- ext/mime_magic/mime_magic.c
- ext/standard/aggregation.c
- ext/standard/basic_functions.c
- ext/standard/image.c
- main/SAPI.c
- main/output.c:
- MFH: fixed compile failures when ZLIB/PCRE are compiled as shared in same
- build.
-
- * ext/mime_magic/mime_magic.c
- ext/standard/aggregation.c
- ext/standard/basic_functions.c
- ext/standard/image.c
- main/SAPI.c
- main/output.c:
- Fixed compile failures when ZLIB / PCRE are compiled as shared
- extensions in same build.
-
- * ext/standard/aggregation.c:
- Let this compile even if PCRE is compiled as shared in same build.
-
- * ext/pcre/config.m4:
- Fixed bug #22131, enable use of shared lib with pcre.
-
-2003-02-09 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/gd/libgd/gd.c:
- Kill some warnings
-
- * ext/gd/gd_bundled.dsp:
- XBM for win
-
-2003-02-09 Kai Schröder <mail@kaischroeder.net>
-
- * ext/standard/tests/file/003-win32.phpt:
- shane added is_executable() for windows last night
-
- * ext/standard/tests/file/003.phpt:
- reverting to version 1.5; shane added is_executable() for windows last
- night
-
- * ext/standard/tests/general_functions/007.phpt
- ext/standard/tests/general_functions/007.phpt:
- newlines changed
-
- * ext/standard/tests/general_functions/getopt.phpt
- ext/standard/tests/general_functions/getopt.phpt:
- getopt() is currently not available on Windows
-
- * (PHP_4_3)
- ext/standard/tests/file/001-win32.phpt
- ext/standard/tests/file/001.phpt:
- there are no symlinks on Windows
-
- * ext/standard/tests/file/001-win32.phpt
- ext/standard/tests/file/001.phpt:
-
- there are no symlinks on Windows
-
- * ext/standard/tests/file/003-win32.phpt
- ext/standard/tests/file/003.phpt:
- is_executable() does not exist on Windows
-
- * ext/standard/tests/file/003-win32.phpt
- ext/standard/tests/file/003-win32.phpt
- ext/standard/tests/file/003.phpt:
-
- file 003-win32.phpt was initially added on branch PHP_4_3.
-
- * ext/standard/tests/time/002.phpt
- ext/standard/tests/time/002.phpt:
- die() to skip second message
-
- * ext/standard/datetime.c
- ext/standard/datetime.c:
- MSVC's mktime() does not examine the existence of a daylight-saving-time
- zone
-
- * ext/standard/tests/time/003.phpt
- ext/standard/tests/time/003.phpt:
- Windows doesn't know timezone CET
-
- * ext/standard/tests/time/002.phpt
- ext/standard/tests/time/002.phpt:
- skip for Windows (does not support dates prior to midnight, January 1,
- 1970)
-
- * ext/standard/tests/time/002-win32.phpt:
- Windows does not support dates prior to midnight, January 1, 1970
-
- * ext/standard/tests/time/mktime.phpt:
- test for mktime()
-
-2003-02-09 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/mssql/php_mssql.c
- ext/mssql/php_mssql.c:
- - Whitespace fixes
-
-2003-02-09 Kai Schröder <mail@kaischroeder.net>
-
- * ext/standard/tests/time/mktime.phpt
- ext/standard/tests/time/mktime.phpt:
-
- file mktime.phpt was initially added on branch PHP_4_3.
-
- * ext/standard/tests/time/002-win32.phpt
- ext/standard/tests/time/002-win32.phpt:
-
- file 002-win32.phpt was initially added on branch PHP_4_3.
-
-2003-02-09 Frank M. Kromann <frank@kromann.info>
-
- * ext/mssql/php_mssql.c
- ext/mssql/php_mssql.c:
- cleanup variable initializations
-
- * ext/mssql/php_mssql.c
- ext/mssql/php_mssql.c:
- Fixing coredump when no php.ini file is used
-
- * ext/mssql/config.m4
- ext/mssql/php_mssql.h:
- MFB
-
-2003-02-09 Yasuo Ohgaki <yohgaki@ohgaki.net>
-
- * ext/pgsql/pgsql.c:
- Fixed one more improper row offset handling.
-
-2003-02-09 Frank M. Kromann <frank@kromann.info>
-
- * (PHP_4_3)
- ext/mssql/php_mssql.h:
- DBFLT4 is not defined in FreeTDS. Needed for real data types
-
- * (PHP_4_3)
- ext/mssql/config.m4:
- Fixing autodetect of FreeTDS
-
-2003-02-09 Yasuo Ohgaki <yohgaki@ohgaki.net>
-
- * ext/pgsql/pgsql.c:
- Fixed improper result offset handling.
- Prevent error when connection is broken. (optional)
-
-2003-02-09 Frank M. Kromann <frank@kromann.info>
-
- * ext/mssql/php_mssql.c
- ext/mssql/php_mssql.c
- ext/mssql/php_mssql.h
- ext/mssql/php_mssql.h:
- Bug #21707 problem with real
-
- * ext/gd/gd.dsp
- ext/gd/gd_bundled.dsp:
- Syncronize with branch
-
- * (PHP_4_3)
- ext/gd/gd.dsp:
- Fixing build with GD 2.0.11
-
- * (PHP_4_3)
- ext/gd/gd_bundled.dsp:
- Adding missing HAVE_GD_STRINGFTEX define
-
- * (PHP_4_3)
- ext/gd/gd.dsp
- ext/gd/gd_bundled.dsp:
- Adding some missing defines to enable functions.
- Fixing bug #22130
-
-2003-02-09 Shane Caraveo <shane@caraveo.com>
-
- * ext/standard/basic_functions.c
- ext/standard/filestat.c
- ext/standard/php_filestat.h:
- is_executable() now available on win32
- stats can now get information provided by access()
-
- * run-tests2.php:
- whitespace changes
-
-2003-02-08 Sascha Schumann <sascha@schumann.cx>
-
- * ext/gettext/gettext.c:
- Fix segfault in bindtextdomain when first parameter was empty.
-
- The Linux man page states: domainname must be a non-empty string.
-
- Noticed by: Nils Meyer
-
-2003-02-08 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * sapi/cli/php.1:
- Style corrections
- See also: Stig's intro
- Version info
-
-2003-02-08 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/string.c:
- style & ws fixes
-
-2003-02-08 Pierre-Alain Joye <paj@pearfr.org>
-
- * (PHP_4_3)
- ext/gd/libgd/gd.c
- ext/gd/libgd/gd.h:
- MFH:
- Add gdImageEllipse
- Replace gdImageFilledEllipse by a new function (backported from
- the new phpgd)
- the new gdImageFilledEllipse fix bug bug #22103 (ellipse part)
-
- * ext/gd/libgd/gd.c
- ext/gd/libgd/gd.h:
- Add gdImageEllipse
- Replace gdImageFilledEllipse by a new function (backported from
- the new phpgd)
- the new gdImageFilledEllipse fix bug bug #22103 (ellipse part)
-
-2003-02-07 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/http_fopen_wrapper.c:
- chunk_size should always be reduced to 1 while scanning response headers to
- avoid buffering the actual stream prior to any read calls.
-
-2003-02-07 Ilia Alshanetsky <ilia@prohost.org>
-
- * main/php_streams.h:
- Added missing definitions.
-
-2003-02-07 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * sapi/cli/php.1:
- Adding some text and some backslashes which are needed sometimes
- somewhere...
-
- * sapi/cli/php_cli.c:
- Define STDIN/OUT/ERR for -B -R -F -E (works as expected).
- Enable exit in same switches.
-
-2003-02-07 Ilia Alshanetsky <ilia@prohost.org>
-
- * NEWS:
- New function news.
-
- * ext/standard/basic_functions.c
- ext/standard/php_string.h
- ext/standard/string.c:
- Added str_split() function. This function can be used to break down a
- string into an array.
-
- * ext/standard/basic_functions.c
- ext/standard/url.c
- ext/standard/url.h
- main/streams.c:
- Added get_browser() function. This function can be used to fetch the
- headers
- sent by the server when a request is made for a given URL.
-
-2003-02-07 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * sapi/cli/php_cli.c:
- No more maximum line size for -R and -F
-
-2003-02-07 Uwe Schindler <uwe@thetaphi.de>
-
- * sapi/nsapi/nsapi.c:
- (NSAPI SAPI) Fixed _SERVER[] variables (all headers included) to be now
- similar to apache SAPI; with this new file the memory leaks (webserver
- eats up memory during a few days running) are also disappeared (all by
- NSAPI allocated strings are freed).
-
-2003-02-07 Zeev Suraski <zeev@zend.com>
-
- * main/win95nt.h:
- Fixlet
-
-2003-02-07 Dan Kalowsky <dank@deadmime.org>
-
- * ext/odbc/php_odbc.c:
- MFB
-
- * (PHP_4_3)
- ext/odbc/php_odbc.c:
- Patch for Bug #21279 submitted by ernani@php.net
-
-2003-02-06 James Cox <james@imajes.info>
-
- * NEWS:
- adding news about moved ext
-
-2003-02-06 Tal Peer <tal@twisthost.com>
-
- * ext/fribidi/.cvsignore
- ext/fribidi/CREDITS
- ext/fribidi/EXPERIMENTAL
- ext/fribidi/README
- ext/fribidi/config.m4
- ext/fribidi/fribidi.c
- ext/fribidi/fribidi.dsp
- ext/fribidi/php_fribidi.h:
- Moving fribidi to PECL
-
-2003-02-06 Sara Golemon <php@alphaweb.net>
-
- * ext/bcmath/bcmath.c:
- bc_raise() can return a scale lower than that passed into it. While most
- other bcmath calls won't, it's safest to do a quick check that we're only
- reducing n_scale, not increasing it.
-
-2003-02-06 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * sapi/cli/php.1:
- Rewrite/add some stuff
-
-2003-02-06 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- fugbix news
-
- * (PHP_4_3)
- ext/standard/array.c:
- MFH: - Fixed bug #22088 (array_shift() leaves next index to be +1 too much)
-
- * ext/standard/array.c:
- - Fixed bug #22088 (array_shift() leaves next index to be +1 too much)
-
- * ext/standard/tests/array/bug22088.phpt:
- fix the test
-
- * ext/standard/tests/array/bug22088.phpt:
-
- Added testcase for bug #22088
-
-2003-02-06 Andrey Hristov <andrey@webgate.bg>
-
- * (PHP_4_3)
- NEWS:
- added entry for memory_get_usage().
-
- * (PHP_4_3)
- ext/standard/basic_functions.c
- ext/standard/php_var.h
- ext/standard/var.c:
- Backporting memory_get_usage() from HEAD.
- As far as the code is small there won't be any problems.
-
-2003-02-05 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * tests/classes/private_001.phpt
- tests/classes/private_002.phpt
- tests/classes/private_003.phpt
- tests/classes/private_003b.phpt
- tests/classes/private_004.phpt
- tests/classes/private_004b.phpt
- tests/classes/private_005.phpt
- tests/classes/private_005b.phpt
- tests/classes/private_006.phpt
- tests/classes/private_006b.phpt
- tests/classes/private_007.phpt
- tests/classes/private_007b.phpt
- tests/classes/protected_001.phpt
- tests/classes/protected_001b.phpt
- tests/classes/protected_002.phpt
- tests/classes/visibility_000a.phpt
- tests/classes/visibility_000b.phpt
- tests/classes/visibility_000c.phpt
- tests/classes/visibility_001a.phpt
- tests/classes/visibility_001b.phpt
- tests/classes/visibility_001c.phpt
- tests/classes/visibility_002a.phpt
- tests/classes/visibility_002b.phpt
- tests/classes/visibility_002c.phpt
- tests/classes/visibility_003a.phpt
- tests/classes/visibility_003b.phpt
- tests/classes/visibility_003c.phpt
- tests/classes/visibility_004a.phpt
- tests/classes/visibility_004b.phpt
- tests/classes/visibility_004c.phpt:
- Add PPP method tests
-
-2003-02-05 Ilia Alshanetsky <ilia@prohost.org>
-
- * NEWS:
- New function news.
-
- * ext/standard/array.c
- ext/standard/basic_functions.c
- ext/standard/php_array.h:
- Added array_walk_recursive() function that can apply array_walk recursively
- to an array.
-
-2003-02-05 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/iconv/CREDITS:
- Credits for iconv
-
- * sapi/activescript/EXPERIMENTAL:
- Mark activescript sapi as experimental, so that the installer can
- categorize it appropriately.
-
- * win32/installer/README
- win32/installer/gen-nsis.php
- win32/installer/setini.php:
- Check in the prototype PHP installer for win32.
-
-
-2003-02-05 Ilia Alshanetsky <ilia@prohost.org>
-
- * sapi/apache/mod_php4.c
- sapi/apache_hooks/mod_php4.c:
- Build Fix.
-
-2003-02-05 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * sapi/cli/php.1:
-
-
- * sapi/cli/php.1:
- First step - abrief version.
-
-2003-02-04 Stig Bakken <ssb@fast.no>
-
- * pear/package-PEAR.xml:
- - replace @bin_dir@ in pear.bat
-
-2003-02-04 Sara Golemon <php@alphaweb.net>
-
- * (PHP_4_3)
- ext/bcmath/bcmath.c:
- FMH(r-1.49/r-1.50)
-
-2003-02-04 Andi Gutmans <andi@zend.com>
-
- * ext/bcmath/bcmath.c:
- - Please follow coding standards (this isn't java :)
-
-2003-02-04 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/bcmath/bcmath.c:
- fix ZTS build
-
-2003-02-04 Ilia Alshanetsky <ilia@prohost.org>
-
- * sapi/apache/mod_php4.c
- sapi/apache_hooks/mod_php4.c:
- Fixed compilation of Apache & Apache Hooks SAPIs.
-
-2003-02-04 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * sapi/cli/php_cli.c:
- remove it then....this forces to put work in man page ...
-
-2003-02-04 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- reorder the bug fixes (reverse #). added missing bug fixing news
-
-2003-02-04 Sara Golemon <php@alphaweb.net>
-
- * ext/bcmath/bcmath.c:
- Bug#13551 bcmath functions should not apply scale to arguments, only to
- result
-
-2003-02-04 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * ext/pgsql/pgsql.c:
- Made the row parameter in pg_result_seek() non-optional, the current
- implementation would result in random behavior if the 2nd argument is not
- passed.
- Fixed bug #22042 (pg_result_seek() would never seek to the 1st row in the
- result due to always seeking to row next to the one requested).
- Removed dead code from pg_result_seek().
-
-2003-02-04 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/aggregation.c
- sapi/apache/mod_php4.c
- sapi/apache_hooks/mod_php4.c:
- Updates reflecting infrastructure changes
-
-2003-02-04 Uwe Steinmann <uwe@steinmann.cx>
-
- * ext/pdf/pdf.c:
- - fixed some prototypes and folding
-
- * ext/pdf/pdf.c:
- - fixed prototype of pdf_get_buffer()
-
-2003-02-04 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- Added missing bugfix news entry.
-
- * NEWS:
- NEWS ordering..
-
-2003-02-03 Hartmut Holzgraefe <hartmut@six.de>
-
- * main/output.c:
- proto-fix
-
-2003-02-03 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/datetime.c:
- Fixed bug #22017 (non descriptive error to appear when timestamp passed to
- date() has value < 0. Win32 does not support timestamps prior to midnight
- (00:00:00), January 1, 1970).
-
- * ext/standard/basic_functions.c:
- Make putenv() return a proper error rather then NULL when invalid argument
- is passed.
-
- * ext/imap/php_imap.c:
- Fixed bug #22022 (Crash in imap_mail_compose() if the body is an empty
- array).
-
- * ext/curl/interface.c:
- Fixed bug #22031 (Made curl_write() & curl_write_header() binary safe).
-
-2003-02-03 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/mbstring/tests/mb_http_output.phpt
- ext/mbstring/tests/mb_internal_encoding.phpt
- ext/mbstring/tests/mb_strpos.phpt:
- Trivial test adjustment
-
- * ext/mbstring/mbstring.c:
- zend_get_parameters_* => zend_parse_parameters
-
-2003-02-03 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- sapi/apache2filter/config.m4:
- MFH: Fix bug: #22035 (EXTRA_LDFLAGS for AIX not quite right)
-
- * sapi/apache2filter/config.m4:
- Fix bug: #22035 (EXTRA_LDFLAGS for AIX not correct)
-
- * (PHP_4_3)
- NEWS:
- fugbix news
-
- * (PHP_4_3)
- ext/standard/array.c:
- MFH: Fixed bug: #21998 (array_pop() did not reset the current array
- position)
-
- * ext/standard/array.c:
- - Fixed bug: #21998 (array_pop() did not reset the current array position)
-
- * ext/standard/tests/array/bug21998.phpt:
- Correct description of the problem
-
-2003-02-03 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/mbstring/mbstring.c:
- Really fixed proto.
-
-
- * ext/mbstring/mbstring.c:
- Oops! wrong commit. Reverting...
-
- * ext/mbstring/mbstring.c:
- Fixed proto
-
- * tests/lang/bug21961.phpt:
- Modified the test so it will be skipped under ZE1.
- Thanks Kai
-
- * tests/lang/bug20175.phpt:
- Added missing "?>"
-
- * ext/mbstring/tests/mb_strpos.phpt:
- Fixed test case for mb_strpos().
-
-2003-02-03 Jani Taskinen <sniper@iki.fi>
-
- * sapi/apache_hooks/config.m4:
- Make these configure messages differ from the regular apache configure
-
-2003-02-03 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * tests/lang/bug21961.phpt:
- Added test case for bug #21961
-
-2003-02-03 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/php_image.h:
- This cause some warning/error in AIX
-
- * (PHP_4_3)
- main/php_ini.c:
- MFH: Fixed bug: #22011 (-n must ignore all ini files)
-
- * main/php_ini.c:
- Fixed bug: #22011 (-n must ignore all ini files)
-
-2003-02-03 Derick Rethans <d.rethans@jdimedia.nl>
-
- * run-tests.php:
- - Make VIM highlighting happy
-
-2003-02-03 Jani Taskinen <sniper@iki.fi>
-
- * ext/interbase/config.m4:
- Test that libgds actually exists.
-
- * ext/calendar/calendar.c:
- ws
-
-2003-02-03 Giuseppe Tanzilli <g.tanzilli@gruppocsf.com>
-
- * (PHP_4_3)
- sapi/servlet/Makefile.frag
- sapi/servlet/config.m4
- sapi/servlet/servlet.c
- sapi/servlet/servlet.java:
- Fix sapi/servlet build on Unix
-
-2003-02-03 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * sapi/cli/php_cli.c:
- Fix ZTS build.
-
-2003-02-03 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/tests/array/bug21998.phpt:
-
- Added test for bug #21998
-
-2003-02-03 Stig Bakken <ssb@fast.no>
-
- * pear/package-PEAR.xml:
- - 1.1 release notes update
- * added some <provides> elements
-
- * pear/PEAR/Common.php:
- - start using the source tokenizer
-
- * pear/package-PEAR.xml:
- - substitute @php_dir@ in pear.in
-
-2003-02-03 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * sapi/cli/php_cli.c:
- - Added -B, -F, -R, -E for line by line std in processing.
- - Added some error messages.
- - Added more -h info.
-
-2003-02-02 Ilia Alshanetsky <ilia@prohost.org>
-
- * main/php_scandir.h:
- Fixed bug #22021.
-
- * ext/curl/interface.c:
- Gave the user the ability to specify encoding of the request.
- Patch by jens@mermaidconsulting.dk.
-
- * main/php_scandir.c:
- Fixed build on Solaris (patch by Melvyn Sopacua).
-
-2003-02-02 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ext/standard/info.c:
- Fix warning.
-
-2003-02-02 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/info.c
- ext/standard/info.c:
- Fix phpinfo() display of Zend extensions
-
-2003-02-02 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/gd/config.m4
- ext/gd/libgd/gd.c
- ext/gd/libgd/xbm.c
- ext/gd/tests/conv_test.xbm
- ext/gd/tests/xbm2png.phpt:
- - new xbm support
-
-
-2003-02-01 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/standard/image.c:
- avoid warnings
-
- * ext/gd/config.m4:
- Bundled version has XBM support as well as external.
-
- * ext/gd/gd.c:
- Show if XPM support is available & Set availability bit only when
- available.
-
- * ext/standard/image.c
- ext/standard/php_image.h:
-
-
- * ext/dba/config.m4:
- Change DBM detection order
-
- * (PHP_4_3)
- ext/dba/config.m4
- ext/dba/dba_cdb.c
- ext/dba/dba_dbm.c
- ext/dba/dba_gdbm.c
- ext/dba/dba_ndbm.c:
- MFH: include file handling and dbm fixes
-
- * ext/dba/config.m4
- ext/dba/dba_cdb.c
- ext/dba/dba_dbm.c
- ext/dba/dba_gdbm.c:
- - unify configure mechanisms (include file handling)
- - fix dbm
- - allow dbm to be based on gdbm
-
-2003-02-01 Melvyn Sopacua <msopacua@idg.nl>
-
- * run-tests.php:
- Make it easier to diff results of several runs in one day.
-
-2003-02-01 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- Correct required mcrypt version
-
-2003-02-01 Melvyn Sopacua <msopacua@idg.nl>
-
- * (PHP_4_3)
- INSTALL:
- MFH: Bug #21892 (links to apache2 install instructions missing)
-
- * INSTALL:
- Fix Bug #21892 (links to apache2 install instructions missing)
-
-
-2003-02-01 Martin Jansen <mail@martin-jansen.de>
-
- * pear/PEAR/Command/Registry.php:
- - displayLine() is deprecated, so better use displayError() here.
-
-2003-02-01 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/var.c:
- Don't assume that objects have class entries (in the ZE1 sense) when
- determining the class name.
- Additionally, don't assume that objects have a properties hash either.
-
-2003-01-31 Melvyn Sopacua <msopacua@idg.nl>
-
- * ext/mcrypt/config.m4:
- Require 2.5.6+
- MFB: Be -ltdl aware
-
-2003-01-31 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/openssl/openssl.c:
- Fixed bug #21986 (openssl test failure).
-
-2003-01-31 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * (PHP_4_3)
- ext/dba/config.m4:
- MFH: Shared dba requires at least db-3.3
-
- * ext/dba/config.m4:
- Shared dba requires at least db-3.3
-
- * ext/dba/dba.c:
- Fix proto
-
-2003-01-31 Frank M. Kromann <frank@kromann.info>
-
- * ext/ext_skel.php
- ext/ext_skel.php
- ext/ext_skel_win32.php:
- Rename script.
- Add check for CLI version
-
- * ext/ext_skel_win32.php
- ext/ext_skel_win32.php:
-
- file ext_skel_win32.php was initially added on branch PHP_4_3.
-
-2003-01-31 Sascha Schumann <sascha@schumann.cx>
-
- * ext/standard/var.c:
- Unbreak $Id tag
-
-2003-01-31 Melvyn Sopacua <msopacua@idg.nl>
-
- * (PHP_4_3)
- ext/mcrypt/config.m4:
- "The ugly patch"
- Make mcrypt compile, when we finally are free of -ltdl. Bug #20926.
-
-
-2003-01-31 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- ext/mbstring/mbfilter.c
- ext/mbstring/mbstring.c
- ext/mbstring/tests/mb_send_mail01.phpt
- ext/mbstring/tests/mb_send_mail02.phpt
- ext/mbstring/tests/mb_send_mail03.phpt
- ext/mbstring/tests/mb_send_mail04.phpt
- ext/mbstring/tests/mb_send_mail05.phpt
- ext/mbstring/tests/mb_send_mail06.phpt:
- MFH: fixed a mb_send_mail() bug.
-
-2003-01-31 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- Moved from HEAD.
-
- * NEWS:
- Moved these entries to PHP_4_3 branch NEWS (for 4.3.1)
-
- * ext/oci8/php_oci8.h:
- No c++ comments..
-
-2003-01-31 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/mbstring/mbfilter.c
- ext/mbstring/mbstring.c
- ext/mbstring/tests/mb_send_mail01.phpt
- ext/mbstring/tests/mb_send_mail02.phpt
- ext/mbstring/tests/mb_send_mail03.phpt
- ext/mbstring/tests/mb_send_mail04.phpt
- ext/mbstring/tests/mb_send_mail05.phpt
- ext/mbstring/tests/mb_send_mail06.phpt
- ext/mbstring/tests/mb_send_mail07.phpt:
- Fixed a mb_send_mail() bug that has been reported in php-i18n@lists.php.net
- See http://lists.php.net/article.php?group=php.i18n&article=427
-
-2003-01-31 Sascha Schumann <sascha@schumann.cx>
-
- * php.ini-dist:
- Remove obsolete warning
-
-2003-01-31 Sara Golemon <php@alphaweb.net>
-
- * ext/ftp/ftp.c
- ext/ftp/ftp.h
- ext/ftp/php_ftp.c
- ext/ftp/php_ftp.h:
- Add ftp_raw() to send raw command strings to an FTP server.
-
-2003-01-31 Frank M. Kromann <frank@kromann.info>
-
- * ext/skeleton/skeleton.php:
- Use platform specific extension.
-
- * ext/skeleton/skeleton.dsp:
- Dtandard visual studio project for ext_skel
-
- * ext/ext_skel.php:
- Wrapper script to use ext_skel on Win32
-
- * (PHP_4_3)
- ext/ext_skel.php:
- Wrapper script to execute ext_skel on WIn32
-
- * ext/ext_skel.php:
-
- file ext_skel.php was initially added on branch PHP_4_3.
-
- * (PHP_4_3)
- ext/skeleton/skeleton.php:
- Allow extensions to be loaded on win32
-
- * ext/skeleton/skeleton.dsp
- ext/skeleton/skeleton.dsp:
-
- file skeleton.dsp was initially added on branch PHP_4_3.
-
-2003-01-30 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/session/session.c:
- Fix compiler warning.
-
-2003-01-30 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/dba/config.m4:
- Revert this part, the new one adds more problems than it solves.
-
-2003-01-30 Sascha Schumann <sascha@schumann.cx>
-
- * (PHP_4_3)
- main/streams.c
- main/streams.c:
- Partial MFH: Fix sticky eof issue, and avoid calling system stat macro
-
- * main/streams.c:
- Fix sticky EOF problem
-
- Sometimes streams signal a temporary EOF, because all current data
- has been consumed. But that does not preclude the possibility that
- more data will become available later.
-
- Thus we must not treat eof in the read path as final.
-
- Now, "tail -f" like scripts work again.
-
-2003-01-30 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/string.c:
- Unify str_replace and str_ireplace using INTERNAL_FUNCTION_PARAM_PASSTHRU
- -- reduce codebase/maintenance complexity
-
-2003-01-30 Jani Taskinen <sniper@iki.fi>
-
- * ext/informix/ifx.ec:
- fix bug: #21945 (zts build failed)
-
-2003-01-30 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * (PHP_4_3)
- ext/dba/config.m4:
- MFH: Allow to link against chosen modules correctly
-
- * ext/dba/config.m4:
- Allow to link against chosen modules correctly
-
-2003-01-30 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/basic_functions.c
- ext/standard/php_string.h
- ext/standard/string.c:
- Feature Request # 5919 - Addition of str_ireplace()
- Also removed deprecated BM str replace menthod
- Also rewrote php_str_to_str to use more processor/memory efficient method
- (ilia)
-
-2003-01-30 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/dbx/dbx.c
- ext/fbsql/php_fbsql.c
- ext/imap/php_imap.c
- ext/mcal/php_mcal.c
- ext/msql/php_msql.c
- ext/mssql/php_mssql.c
- ext/mysql/php_mysql.c
- ext/sybase/php_sybase_db.c
- ext/sybase_ct/php_sybase_ct.c:
- Removed pointless checks.
-
-2003-01-29 Stig Bakken <ssb@fast.no>
-
- * pear/PEAR/Installer.php:
- - Windows fix (thanks to paj)
-
-2003-01-29 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/informix/ifx.ec:
- Added sanity checks.
-
-2003-01-29 Maxim Maletsky <maxim@maxim.cx>
-
- * ext/oci8/CREDITS
- ext/oci8/oci8.c:
- Added myself to the maintainers list.
-
-2003-01-29 Edin Kadribasic <edink@proventum.net>
-
- * sapi/embed/php_embed.c:
- Be more consistent with the sapi internal name.
-
- * ext/standard/dl.c:
- Enable embedded code using sapi/embed to use dl().
-
-2003-01-29 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- ordered all bug fixes by the number :)
-
- * NEWS:
- NEWS police is back.
-
- * (PHP_4_3)
- NEWS:
- news entries for new options in phpize and php-config
-
-2003-01-29 Harald Radi <harald.radi+coding.php@nme.at>
-
- * ext/standard/basic_functions.c
- main/main.c:
- MFPHP_4_3
-
- * (PHP_4_3)
- main/main.c:
- ilia pointet me to a thread on php-dev saying that
- Co(Un)Initialize should be called per thread
-
-2003-01-29 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/basic_functions.c
- ext/standard/php_string.h:
- Added part of strpos commit that never made it in for some reason.
-
-
-2003-01-28 Harald Radi <harald.radi+coding.php@nme.at>
-
- * (PHP_4_3)
- ext/standard/basic_functions.c:
- moved to php4/main
-
- * (PHP_4_3)
- main/main.c:
- somehow the module shutdown order got reversed since 4.3.0,
- thus the CoInitialize / CoUninitialize calles are more sane here
- than in the basic functions module.
-
-2003-01-28 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- NEWS:
- fugbix news
-
-2003-01-28 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- ext/hyperwave/hw.c:
- Fixed compile warning.
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * sapi/apache2filter/sapi_apache2.c:
- Fixed bug #17868 (more then the <!--include--> directive used to include
- a PHP file would result in a crash).
-
-2003-01-28 Derick Rethans <d.rethans@jdimedia.nl>
-
- * main/php_scandir.c
- main/php_scandir.c:
- - Fix includes
-
-2003-01-28 Ilia Alshanetsky <ilia@prohost.org>
-
- * main/php_scandir.c
- main/php_scandir.c:
- Fixed compiler warning.
-
-2003-01-28 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- Makefile.frag
- configure.in
- build/config-stubs
- pear/Makefile.frag
- pear/pear.m4
- pear/scripts/.cvsignore
- pear/scripts/php-config.in
- pear/scripts/phpextdist
- pear/scripts/phpize.in
- scripts/.cvsignore
- scripts/Makefile.frag
- scripts/config-stubs
- scripts/conv_proto
- scripts/conv_z_macros
- scripts/credits
- scripts/php-config.in
- scripts/phpextdist
- scripts/phpize.in
- scripts/phpize.m4
- scripts/dev/conv_proto
- scripts/dev/conv_z_macros
- scripts/dev/credits:
- - MFH: Fixed bug #13561 (--without-pear prevents install of php-config,
- phpize)
- - MFH: Added --ldflags option to php-config
- - MFH: Added --clean option to phpize
-
-2003-01-28 Edin Kadribasic <edink@proventum.net>
-
- * sapi/embed/php_embed.c:
- Call correct module startup function (not a hard coded one) allowing
- startup override.
-
-2003-01-28 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg_scanner.c:
- sync with .re
-
- * ext/ircg/ircg_scanner.re:
- update year
-
- * ext/ircg/Makefile.frag:
- Looks like we are hitting a bug due to '\xxx' for xxx >= 200 not being
- handled
- correctly.
-
-2003-01-28 Zeev Suraski <zeev@zend.com>
-
- * win32/php4ts.dsw:
- Get rid of php4ts.dsw - replaced by php5ts.dsw
-
-2003-01-28 Jani Taskinen <sniper@iki.fi>
-
- * build/config-stubs
- pear/Makefile.frag
- pear/pear.m4
- pear/scripts/.cvsignore
- scripts/.cvsignore
- scripts/Makefile.frag
- scripts/php-config.in
- scripts/phpextdist
- scripts/phpize.in
- scripts/phpize.m4
- scripts/dev/conv_proto
- scripts/dev/conv_z_macros
- scripts/dev/credits:
-
- - Fixed bug: #13561 (--without-pear prevents install of phpize,
- php-config)
-
- * Makefile.frag
- configure.in
- pear/scripts/php-config.in
- pear/scripts/phpextdist
- pear/scripts/phpize.in
- scripts/config-stubs
- scripts/conv_proto
- scripts/conv_z_macros
- scripts/credits:
- - Fixed bug: #13561 (--without-pear prevents install of phpize, php-config)
-
- * ext/dba/config.m4:
- Fix configure. (typo?)
-
-2003-01-28 Edin Kadribasic <edink@proventum.net>
-
- * sapi/embed/php_embed.c
- sapi/embed/php_embed.h:
- Expose php_embed_module struct (and make Wez happy).
-
-2003-01-28 Melvyn Sopacua <msopacua@idg.nl>
-
- * (PHP_5_0_dev_before_13561_fix)
- tests/lang/bug20175.phpt:
- Fix parse error and edink's fear of bison errors
-
-2003-01-28 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_5_0_dev_before_13561_fix)
- ext/imap/config.m4:
- fix some typos
-
- * (PHP_5_0_dev_before_13561_fix)
- ext/mime_magic/config.m4:
- fix typo
-
-2003-01-28 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * (PHP_5_0_dev_before_13561_fix)
- ext/dba/config.m4:
- - fix this: els is optional but may not be empty
-
-2003-01-28 Frank M. Kromann <frank@kromann.info>
-
- * (PHP_5_0_dev_before_13561_fix)
- ext/standard/info.c
- ext/standard/info.c:
- Fix the setting of computer name and processor type for php_uname() on
- Win32
-
-2003-01-28 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_5_0_dev_before_13561_fix)
- makedist
- makedist.ZendEngine2:
- - Removed unnecessary makedist.ZendEngine2
- - Modified makedist to use php5 CVS module (alias)
-
-2003-01-28 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_5_0_dev_before_13561_fix)
- ext/standard/basic_functions.c
- ext/standard/dir.c
- ext/standard/php_dir.h:
- Added scandir() function, which allows quick retrieval of all files &
- directories within the specified path and sort the output in alphabetical
- or reverse alphabetical order.
-
- * (PHP_5_0_dev_before_13561_fix)
- sapi/apache2filter/php_functions.c:
- Fixed win32 build (bug #21506).
- Fixed a bug that would cause garbage data to appear at the end of the
- loaded apache modules list in phpinfo().
-
-2003-01-28 Jani Taskinen <sniper@iki.fi>
-
- * ext/mime_magic/config.m4:
- - Cleaned up and made less error-prone
- - Changed --enable-mime-magic -> --with-mime-magic[=FILE] to allow
- specifying of the file during configure.
-
-2003-01-28 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_5_0_dev_before_13561_fix)
- main/php_scandir.c
- main/php_scandir.h:
-
- 2nd part of Sebastian's patch.
-
-2003-01-28 Edin Kadribasic <edink@proventum.net>
-
- * (PHP_5_0_dev_before_13561_fix)
- win32/php4dllts.dsp:
- Adding new files to the project.
-
-2003-01-28 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * (PHP_4_3)
- ext/dba/config.m4:
- MFH: --without-flatfile, Berkeley DB version check
-
- * ext/dba/config.m4:
- - fix "--without-flatfile"
- - simplify Berkley DB verison check
-
-2003-01-27 Ilia Alshanetsky <ilia@prohost.org>
-
- * configure.in
- main/php_ini.c
- main/php_scandir.c
- main/php_scandir.h
- win32/readdir.c
- win32/readdir.h:
- Moved the scandir code into it's own files so that it can be used by other
- OSes where libc does not have a native scandir() implementation.
-
-2003-01-27 Maxim Maletsky <maxim@maxim.cx>
-
- * ext/oci8/oci8.c:
- This fixes "warning C4101: 'charsetid' : unreferenced local variable" on
- VC6
-
- * ext/oci8/oci8.c:
- (Maxim)
-
-2003-01-27 Sara Golemon <php@alphaweb.net>
-
- * ext/ftp/ftp.c
- ext/ftp/ftp.h
- ext/ftp/php_ftp.c:
- Fix potential buffer overflow.
-
-2003-01-27 Ilia Alshanetsky <ilia@prohost.org>
-
- * main/output.c:
- Removed pointless checks.
-
-2003-01-27 Edin Kadribasic <edink@proventum.net>
-
- * (PHP_4_3)
- NEWS
- ext/standard/dir.c
- win32/glob.c:
- MFH: Fixed bug #21597 (made glob() understand Windows paths).
-
- * ext/standard/dir.c
- win32/glob.c:
- Fixed bug #21597 (made glob() understand windows paths)
-
-2003-01-27 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- configure.in:
- revert previous commit
-
- * (PHP_4_3)
- configure.in:
- MFH: use grep -E instead of egrep. the latter is not defined by POSIX
- anymore
-
-2003-01-27 Uwe Steinmann <uwe@steinmann.cx>
-
- * ext/hyperwave/hw.c:
- - fixed several bugs in hw_document_xx() functions. The macro to access
- the document was the same as for a link to the sever.
-
-2003-01-27 Sara Golemon <php@alphaweb.net>
-
- * ext/ftp/ftp.c
- ext/ftp/ftp.h
- ext/ftp/php_ftp.c
- ext/ftp/php_ftp.h:
- Feature Request #21748. Added function ftp_chmod().
-
-2003-01-27 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * tests/lang/bug21600.phpt:
- Updated test so it describes the problem more clearly.
-
-2003-01-26 Stig Bakken <ssb@fast.no>
-
- * pear/PEAR.php:
- - whoops, heritage shows through :)
-
-2003-01-26 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * run-tests.php:
- Simplify
-
-2003-01-26 Sander Roobol <phy@wanadoo.nl>
-
- * (PHP_4_3)
- ext/mime_magic/mime_magic.c:
- MFH (well... it's not really an MFH... but who cares :)
-
- * ext/mime_magic/mime_magic.c:
- Fix build
-
-2003-01-26 Shane Caraveo <shane@caraveo.com>
-
- * sapi/isapi/php4isapi.c:
- normalize CGI variables to the CGI spec
- PATH_INFO and PATH_TRANSLATED are correct now
- SCRIPT_FILENAME now contains the full path to the script
-
- * (PHP_4_3)
- main/php_ini.c
- win32/readdir.c
- win32/readdir.h:
- MFH
- fix broken build by adding scandir and alphasort
-
- * main/php_ini.c
- win32/readdir.c
- win32/readdir.h:
- Fix broken build by adding scandir and alphasort for win32
-
-2003-01-26 Sara Golemon <php@alphaweb.net>
-
- * ext/gd/gd.c
- ext/gd/php_gd.h:
- Feature Request #21784 Added: imagecolorallocatealpha
- (pollita@php.net,jasper@pointless.net)
-
-2003-01-25 Shane Caraveo <shane@caraveo.com>
-
- * (PHP_4_3)
- sapi/cgi/cgi_main.c:
- MFH
-
- fix bug 21261
- putenv on some platforms requires we provide the memory
- cleanup env parsing logic
- fix bug 21367
- missed optargs in a previous patch
-
- * sapi/cgi/cgi_main.c:
- fix bug 21261
- putenv on some platforms requires we provide the memory
- cleanup env parsing logic
- fix bug 21367
- missed optargs in a previous patch
-
-2003-01-25 Ilia Alshanetsky <ilia@prohost.org>
-
- * main/php_ini.c:
- Fixed bug #21625 (When scanning a directory for ini files, do so in
- alphabetical order. This gives a user a way to control the order in which
- the ini files are loaded).
- Fixed a bug that would make the code try to read files without an
- extension
- as ini files.
-
-2003-01-25 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * (PHP_4_3)
- ext/dba/config.m4:
- MFH: The builtin version was always used even if configured otherwise.
-
- * (PHP_4_3)
- run-tests.php:
- MFH: Bug #21751: Part one never let this happen again...
-
- * ext/dba/config.m4:
- The builtin version was always used even if configured otherwise.
-
- * run-tests.php:
- Bug #21751: Part one never let this happen again...
-
-2003-01-25 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/informix/ifx.ec:
- Removed unneeded code.
-
-2003-01-25 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/mime_magic/mime_magic.c:
- - mime file parser messages only with mime_magic.debug=On (default: off)
- - fix docref URL in startup error messages
- - show status in php info, either "enabled" or "..., disabled"
-
- * ext/mime_magic/php_mime_magic.h:
- preparations for making magic file parser silent
-
- * ext/mime_magic/config.m4:
- suggesting a plain magic file insteat of a mime one is a bad idea
-
-2003-01-25 Stig Bakken <ssb@fast.no>
-
- * pear/tests/osguess.php:
- - not a real test, just a script for displaying OS_Guess output
-
- * pear/OS/Guess.php:
- - add glibc version detection for Linux
-
- * pear/PEAR/Command/Remote.php:
- - typo
-
-2003-01-25 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/informix/ifx.ec:
- Fixed a typo.
-
- * ext/standard/image.c:
- Fixed compiler warning.
-
-2003-01-24 Sascha Schumann <sascha@schumann.cx>
-
- * ext/session/mod_files.c
- ext/session/session.c:
- Remove ugly netware hacks from the code
-
-2003-01-24 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/wddx/wddx.c:
- Removed unnecessary checks.
-
-2003-01-24 Dan Kalowsky <dank@deadmime.org>
-
- * (PHP_4_3)
- ext/odbc/php_odbc.c:
- busted by the style police...
-
- * ext/odbc/php_odbc.c
- ext/odbc/php_odbc.c:
- Patch for bug #21844
-
-2003-01-24 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/gd/gd.c:
- Fixed bug #21533 (a rare condition where error can remain undefined and
- result in undefined behavior when it is used without being initialized).
-
- * ext/informix/ifx.ec:
- Fixed bug #21865.
-
-2003-01-24 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- ext/oci8/config.m4:
- MFH: Fix bug #21795, Undeclared statement in oci8.c (OCI_ATTR_STATEMENT)
-
- * ext/oci8/config.m4:
- Fix bug #21795, Undeclared statement in oci8.c (OCI_ATTR_STATEMENT)
-
-2003-01-24 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/yp/yp.c:
- Fixed a memory leak.
- zend_error -> php_error_docref.
-
- * ext/crack/crack.c
- ext/gmp/gmp.c
- ext/standard/array.c
- ext/standard/assert.c
- ext/standard/browscap.c
- ext/standard/html.c
- ext/standard/var_unserializer.c
- ext/standard/var_unserializer.re
- ext/sysvmsg/sysvmsg.c:
- zend_error -> php_error_docref.
-
- * ext/gd/gd.c
- ext/hyperwave/hw.c
- ext/standard/proc_open.c:
- Fixed compile warning.
-
-2003-01-24 Andrey Hristov <andrey@webgate.bg>
-
- * ext/standard/string.c:
- Resolving problem on OSF1 and probably other
- 64 bit platforms. Thanks for the feedback of Magnus (novell kiruna se).
-
- * ext/standard/string.c:
- Adding cast.
-
-2003-01-24 Jani Taskinen <sniper@iki.fi>
-
- * ext/imap/php_imap.c:
- - Fixed stupid typo..
-
- * (PHP_4_3)
- ext/standard/file.c:
- MFH: Fix potential problem for 64-bit architectures.
-
- * (PHP_4_3)
- NEWS:
- figbug news
-
- * ext/snmp/snmp.c:
- Fixed bug: #20857, snmpset() fails
-
- * ext/snmp/snmp.c:
- ws fixes
-
- * tests/func/001.phpt
- tests/func/005.phpt
- tests/func/005a.phpt
- tests/func/007.phpt
- tests/func/008.phpt
- tests/func/009.phpt:
- MFB, removed unused GET/POST entries
-
- * (PHP_4_3)
- tests/func/001.phpt
- tests/func/005.phpt
- tests/func/005a.phpt
- tests/func/007.phpt
- tests/func/008.phpt
- tests/func/009.phpt:
- Remove unused GET/POST entries
-
-2003-01-24 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/dbx/dbx.c
- ext/dio/dio.c
- ext/pcre/php_pcre.c:
- zend_error() -> php_error_docref().
-
-2003-01-23 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * tests/lang/bug21849.phpt:
- Added test case for bug21849.phpt
-
-2003-01-23 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * TODO-PHP5:
- TODO for PHP 5.
-
-2003-01-23 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/mbstring/php_mbregex.c:
- Really fixed the mb issue of mb_ereg_replace()
-
- * ext/mbstring/php_mbregex.c:
- Fixed a mb_ereg_replace() bug; the function was not completely
- multibyte-safe.
-
- * tests/lang/bug7515.phpt:
- Fixed typo
-
- * tests/lang/029.phpt
- tests/lang/bug7515.phpt:
- Changed the test's file name as per the convention
-
- * ext/standard/tests/serialize/002.phpt
- ext/standard/tests/serialize/bug14293.phpt:
- Renamed the test name as per the convension
-
- * ext/standard/tests/image/bug13213.phpt
- ext/standard/tests/math/bug21523.phpt
- ext/standard/tests/network/bug20134.phpt
- ext/standard/tests/strings/bug20108.phpt
- ext/standard/tests/strings/bug20169.phpt
- ext/standard/tests/strings/bug20927.phpt:
- Test name formatting
-
- * ext/pcre/tests/bug20528.phpt:
- Made the test's name more descriptive
-
- * ext/pcre/tests/bug20528.phpt
- ext/pcre/tests/bug21732.phpt:
- Removed pointless checks
-
- * ext/pcre/tests/bug21732.phpt:
- Added test case for bug #21732
-
-2003-01-23 Jani Taskinen <sniper@iki.fi>
-
- * ext/imap/php_imap.c:
- Fix bug: #21817 (only enable this if --with-kerberos is used)
-
-2003-01-23 Zeev Suraski <zeev@zend.com>
-
- * win32/php4dllts.dsp:
- Fix .dsp
-
-2003-01-23 Jani Taskinen <sniper@iki.fi>
-
- * configure.in:
- remove this stupid highlight which causes trouble.
-
- * ext/gd/config.m4:
- MFB
-
- * (PHP_4_3)
- ext/gd/config.m4:
- Enable building with freetype 2.1.3
-
- * ext/ingres_ii/config.m4:
- Correct default path
-
- * (PHP_4_3)
- NEWS:
- fugbix news
-
- * tests/func/005a.phpt:
-
- Added test for bug: #21513
-
-2003-01-22 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/sybase_ct/php_sybase_ct.c:
- Removed non-needed code.
-
-2003-01-22 Anil Madhavapeddy <anil@recoil.org>
-
- * ext/standard/config.m4:
- typo
-
-2003-01-22 Frank M. Kromann <frank@kromann.info>
-
- * ext/ming/ming.dsp
- ext/ming/ming.dsp:
- adding missing zlib.lib and path to bindlib
-
-2003-01-22 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/gd/gd.c:
- Fixed a crash when invalid color is passed to imagepstext().
-
-2003-01-22 Sascha Schumann <sascha@schumann.cx>
-
- * (PHP_4_3)
- ext/ircg/ircg.c
- ext/ircg/ircg.c:
- Fix for treating a NAMES list as single join
-
-2003-01-21 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/mbstring/php_mbregex.c:
- Oops! wrong patch. Reverted.
-
- * ext/mbstring/php_mbregex.c:
- Fixed mb_ereg_replace() bug (the function has ignored the default option)
-
- * tests/lang/bug21800.phpt:
- Added test case for bug #21800
-
- * ext/mbstring/php_mbregex.c:
- Fixed mb_ereg_search() segfault that occurs when the function is called
- before a string to be searched is passed by mb_ereg_search_init()
-
-2003-01-21 Andrey Hristov <andrey@webgate.bg>
-
- * ext/sysvshm/sysvshm.c:
- increasing readability.
-
-2003-01-21 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/odbc/birdstep.c:
- getParameters -> zend_get_parameters_ex.
-
- * ext/fbsql/php_fbsql.c
- ext/mbstring/mbstring.c
- ext/standard/array.c
- ext/standard/basic_functions.c
- ext/standard/file.c
- ext/standard/string.c
- sapi/apache/php_apache.c
- sapi/apache_hooks/php_apache.c:
- ARG_COUNT(ht) -> ZEND_NUM_ARGS().
-
-2003-01-21 Stig Bakken <ssb@fast.no>
-
- * pear/PEAR.php
- pear/package-PEAR.xml:
- - PEAR_Error now supports exceptions when using Zend Engine 2. Set the
- error mode to PEAR_ERROR_EXCEPTION to make PEAR_Error throw itself
- as an exception (invoke PEAR errors with raiseError() or throwError()
- just like before).
-
-2003-01-21 Sascha Schumann <sascha@schumann.cx>
-
- * (PHP_4)
- main/SAPI.h:
- cvs server: warning: file `main/SAPI.h' seems to still contain conflict
- indicators
-
- ..but it checks it in nevertheless.
-
- * main/SAPI.c
- main/SAPI.h
- sapi/apache/mod_php4.c:
- add sapi_get_target_uid/_gid for obtaining information about the
- non-privileged user the web server is running as. this is useful
- for creating shared memory segments which need to be accessed by
- the child processes/threads.
-
-2003-01-21 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- sapi/apache2filter/config.m4:
- MFH: Fixed bug: #21698, httpd.conf not modified with "make install"
-
- * sapi/apache2filter/config.m4:
- Fixed bug: #21698, httpd.conf not modified with "make install"
-
- * ext/ircg/config.m4:
- fix typo
-
- * (PHP_4_3)
- ext/ircg/config.m4:
- MFH: Fix bug: #21249, configure fails when searching for ircg-config script
-
- * ext/ircg/config.m4:
- Fix bug: #21249, configure fails when searching for ircg-config script
-
-2003-01-21 Edin Kadribasic <edink@proventum.net>
-
- * sapi/embed/EXPERIMENTAL
- sapi/embed/config.m4:
-
- Added missing warning about experimental nature of sapi/embed.
-
-2003-01-21 Pierre-Alain Joye <paj@pearfr.org>
-
- * ext/gd/libgd/gd.c:
- Remove the (c), in the future, can we add PHP Licence terms for the new
- functions ?
-
- * ext/gd/libgd/gd.c:
- Add credits to my functions (thx for the advice Wez&Ilia :)
-
-2003-01-20 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/imap/php_imap.c
- ext/imap/php_imap.h:
- quota function fixes. Thanks Wez.
-
- * ext/imap/php_imap.c:
- Changed php_error to php_error_docref.
- Removed pointless memory allocation checks.
- Memory leak fix inside quota functions.
-
-2003-01-20 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/pcre/php_pcre.c:
- Fixed bug #21758
-
-2003-01-20 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/msession/msession.c:
- Restore php_error -> php_error_docref patch.
-
-2003-01-20 Sascha Schumann <sascha@schumann.cx>
-
- * README.TESTING:
- test commit
-
-2003-01-20 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/credits.c:
- - Add credits for Magnus
-
-2003-01-20 Jani Taskinen <sniper@iki.fi>
-
- * ext/gd/config.m4:
- Add test for png.h
-
-2003-01-20 Mark L. Woodward <mlwmohawk@mohawksoft.com>
-
- * ext/msession/README
- ext/msession/msession.c
- ext/msession/php_msession.h
- ext/msession/reqclient.h:
- Updated for Msession 1.2.
- Includes new APIs
-
-2003-01-19 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/oracle/oracle.c:
- ZTS fix.
-
-2003-01-19 Zeev Suraski <zeev@zend.com>
-
- * acinclude.m4
- configure.in:
- relabel
-
-2003-01-19 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/scanf.c:
- Improved the patched part to prevent further potential bugs
-
-2003-01-19 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/oracle/oracle.c:
- fixed typos
-
-2003-01-19 Derick Rethans <d.rethans@jdimedia.nl>
-
- * README.TESTING:
- - Moved to http://qa.php.net/write-test.php
-
-2003-01-19 Harald Radi <harald.radi+coding.php@nme.at>
-
- * ext/standard/basic_functions.c
- main/php_ini.c:
- ini patch to allow 'entry[] = value' entries
-
-2003-01-19 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/string.c
- ext/standard/tests/strings/bug21744.phpt:
- Fixed bug #21744(21741)
- Added test case for the bug
-
-2003-01-19 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/dbase/dbf_rec.c
- ext/oci8/oci8.c
- ext/oracle/oracle.c
- ext/rpc/com/com.c
- ext/rpc/com/conversion.c
- ext/rpc/java/java.c
- ext/w32api/w32api.c:
- ZTS fixes.
-
- * ext/mcal/php_mcal.c:
- Changed php_error to php_error_docref.
- Make mcal compile with ZE2.
-
- * ext/dbase/dbf_rec.c
- ext/dio/dio.c
- ext/hwapi/hwapi.cpp
- ext/ingres_ii/ii.c
- ext/mime_magic/mime_magic.c
- ext/oci8/oci8.c
- ext/oracle/oracle.c
- ext/ovrimos/ovrimos.c
- ext/pcre/php_pcre.c
- ext/pdf/pdf.c
- ext/pfpro/pfpro.c
- ext/posix/posix.c
- ext/pspell/pspell.c
- ext/recode/recode.c
- ext/rpc/com/com.c
- ext/rpc/com/com_wrapper.c
- ext/rpc/com/conversion.c
- ext/rpc/com/variant.c
- ext/rpc/dotnet/dotnet.cpp
- ext/rpc/java/java.c
- ext/session/session.c
- ext/snmp/winsnmp.c
- ext/standard/filters.c
- ext/sysvsem/sysvsem.c
- ext/sysvshm/sysvshm.c
- ext/w32api/w32api.c:
- Changed php_error to php_error_docref.
-
-2003-01-18 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/credits.c:
- s/4.4/5.0
-
-2003-01-18 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/bz2/bz2.c
- ext/curl/interface.c
- ext/cyrus/cyrus.c
- ext/ircg/ircg.c
- ext/ldap/ldap.c
- ext/mnogosearch/php_mnogo.c
- ext/msession/msession.c
- ext/msql/php_msql.c
- ext/mssql/php_mssql.c
- ext/odbc/birdstep.c
- ext/odbc/php_odbc.c
- ext/sysvmsg/sysvmsg.c
- ext/xslt/sablot.c:
- Changed php_error to php_error_docref.
-
- Thanks to Marcus Börger for writing a script that significantly simplifies
- this process.
-
- * ext/pcre/php_pcre.c:
- Fixed bug #21732 (Added a sanity check, that prevents parameter mismatch).
-
- * ext/swf/swf.c
- ext/xslt/sablot.c
- ext/yp/yp.c
- ext/zip/zip.c:
- Changed php_error to php_error_docref.
-
- * ext/wddx/wddx.c
- ext/yaz/php_yaz.c:
- Removed pointless memory allocation checks.
- Changed php_error to php_error_docref.
-
- * ext/bz2/bz2.c
- ext/db/db.c
- ext/dba/dba.c
- ext/dbx/dbx.c
- ext/dbx/dbx_odbc.c
- ext/domxml/php_domxml.c
- ext/fbsql/php_fbsql.c
- ext/fdf/fdf.c
- ext/hwapi/hwapi.cpp
- ext/hyperwave/hw.c
- ext/iconv/iconv.c
- ext/informix/ifx.ec
- ext/ingres_ii/ii.c
- ext/interbase/interbase.c
- ext/ldap/ldap.c
- ext/mbstring/mbstring.c
- ext/mbstring/php_mbregex.c
- ext/mcal/php_mcal.c
- ext/mcrypt/mcrypt.c
- ext/mnogosearch/php_mnogo.c
- ext/msql/php_msql.c
- ext/mssql/php_mssql.c
- ext/mysql/php_mysql.c
- ext/oci8/oci8.c
- ext/odbc/php_odbc.c
- ext/openssl/openssl.c
- ext/oracle/oracle.c
- ext/ovrimos/ovrimos.c
- ext/pdf/pdf.c
- ext/pgsql/pgsql.c
- ext/posix/posix.c
- ext/pspell/pspell.c
- ext/qtdom/qtdom.c
- ext/session/session.c
- ext/sockets/sockets.c
- ext/standard/exec.c
- ext/standard/file.c
- ext/standard/image.c
- ext/standard/info.c
- ext/standard/metaphone.c
- ext/standard/string.c
- ext/xml/php_xml.h
- ext/xml/xml.c
- ext/zlib/zlib.c
- sapi/aolserver/aolserver.c
- sapi/apache/php_apache.c
- sapi/apache2filter/php_functions.c
- sapi/apache_hooks/php_apache.c:
- Removed pointless memory allocation checks.
-
-2003-01-18 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * tests/lang/bug21094.phpt:
- Added test case for bug #21094
-
- * ext/standard/scanf.c:
- WS
-
-2003-01-18 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/exif/exif.c:
- correct my fault here and documnet the sense of the test
-
-2003-01-18 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/tests/strings/bug21730.phpt:
-
- Fixed typo
-
- * ext/standard/tests/strings/bug21730.phpt:
- Added test case for bug #21730
-
-2003-01-18 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/exif/exif.c:
- Additional memory allocation fixes by Marcus Börger.
-
-2003-01-18 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/scanf.c:
- Tons of WS fixes
-
-2003-01-18 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/exif/exif.c:
- Removed the no longer needed memory allocation checks.
-
-2003-01-18 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/scanf.c:
- Fixed bug #21726 and #21730
-
-2003-01-18 Andrey Hristov <andrey@webgate.bg>
-
- * ext/standard/basic_functions.c
- ext/standard/php_var.h
- ext/standard/var.c:
- Renamed get_memory_usage() to memory_get_usage() (per Andi's advice)
- This doesn't break any BC.
-
-2003-01-18 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/file.c:
- Fix potential problem for 64-bit architectures.
-
-2003-01-18 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/file.c:
- - Fixed memleak in fscanf().
-
- * ext/standard/tests/general_functions/proc_open.phpt:
- - Skip test if the function to test is not available
-
-2003-01-18 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- ext/imap/config.m4
- ext/imap/php_imap.c:
- MFH: Fix bug: #21687, imap extension does not include gss authentication
- mechanism
-
- * ext/imap/config.m4
- ext/imap/php_imap.c:
- Fix bug: #21687, imap extension does not include gss authentication
- mechanism
-
-2003-01-17 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/tests/image/getimagesize.phpt:
- Added missing test result.
-
-2003-01-17 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * header:
- Bump year.
-
- * win32/md5crypt.c:
- WS fix
-
-2003-01-17 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/gd/gd.c:
- Removed pointless checks of array_init() return value.
-
-2003-01-17 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- Fixed a quoted printable decoder so that it would conform to RFC2045.
-
-2003-01-17 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/thttpd/thttpd.c
- sapi/thttpd/thttpd_patch:
- Fix POST handling once and for all. The daemon now never blocks and
- handles
- uploads of up to 2GB on 32 bit platforms.
-
- Uploads >16KB are put into a file-backed mmap area.
-
- SG(request_info).content_type got corrupted somewhere. As a workaround,
- we provide SAPI with a duplicate of the original string.
-
-2003-01-17 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/standard/image.c
- ext/standard/tests/image/image_type_to_mime_type.phpt
- ext/standard/tests/image/test1pix.jp2:
- fix jp2 detection and add testfile
-
-2003-01-17 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/gd/gd.c
- ext/gd/libgd/gd.c
- ext/gd/libgd/gd.h
- ext/gd/libgd/gd_gd2.c
- ext/gd/libgd/gd_jpeg.c:
- Syncronize bundled GD library with latest GD (2.0.11).
-
-2003-01-17 Derick Rethans <d.rethans@jdimedia.nl>
-
- * (PHP_4_3)
- ext/standard/info.c:
- - MFH: Fixed a bug that made that no newline was displayed when there was
- no
- value for a row.
-
- * ext/standard/info.c:
- - Fixed a bug that made that no newline was displayed when there was no
- value
- for a row.
-
-2003-01-17 Andrey Hristov <andrey@webgate.bg>
-
- * ext/swf/swf.c:
- Removed pointless checks around array_init().
-
-2003-01-17 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/imap/php_imap.c:
- Fixed memory leaks in imap_get_quota & imap_get_quotaroot.
- Removed pointless checks around array_init().
-
-2003-01-17 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- Significant speed enhancements. I was underestimating the power of recent
- CPUs :)
-
-2003-01-17 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * main/internal_functions_win32.c:
- Move ZEND_ENGINE_2 check to where it is defined.
-
-2003-01-16 Harald Radi <harald.radi+coding.php@nme.at>
-
- * main/config.w32.h
- main/internal_functions_win32.c:
- move the ZE2 check into internal_functions_win32.c
-
- * ext/bcmath/libbcmath/src/config.h:
- revert previous commit
-
- * ext/bcmath/libbcmath/src/config.h:
- unbreak the build
-
-2003-01-16 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/pdf/pdf.c:
- Fixed bug #21651 (crash in pdf_open_memory_image() when inserting a
- non truecolor image).
-
-2003-01-16 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- Finally fixed a qp encoder bug that line break characters that appear
- exactly
- at the end of the chunk lost in the output.
-
-2003-01-16 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * ext/standard/tests/image/getimagesize.phpt
- ext/standard/tests/image/image_type_to_mime_type.phpt:
- - JPEG 2000 support
-
- * ext/standard/image.c
- ext/standard/php_image.h:
- - corrected error in file detection for very small files
- - JPEG 2000 support, mostly Adam Wright <adam@elysium.ltd.uk>
-
-2003-01-16 Harald Radi <harald.radi+coding.php@nme.at>
-
- * ext/rpc/java/java.dsp:
- change library name
-
- * ext/rpc/skeleton/php_skeleton.h
- ext/rpc/skeleton/skeleton.c
- ext/rpc/skeleton/skeleton.h:
- update skeleton
-
- * win32/php4dllts.dsp:
- fix path to config.w32.h
-
- * main/internal_functions_win32.c:
- add COM
-
- * main/config.w32.h:
- prevent HEAD + ZE1 builds and add COM
-
- * ext/rpc/com/com.dsp:
- for those who prefer to have com as a shared lib
-
-2003-01-16 Sascha Schumann <sascha@schumann.cx>
-
- * (PHP_4)
- configure.in
- main/php_version.h:
- Open up the PHP_4 branch which has been derived from the current PHP_4_3
- branch, so we don't introduce any ZE2-related changes.
-
- This branch has the purpose of housing experimental patches in the
- context of PHP 4/ZE1. Patches which don't qualify as bug fixes
- should not be committed to the PHP_4_3 branch.
-
- Note: The code on this branch is unlikely to be ever released in the form
- of a standard PHP release. Commit new features to the HEAD branch!
- Patches for this branch should be the exception.
-
- Note: The version is "4.5.0", because 4.4.0 has been used for some time
- in HEAD before being switched to 5.0.0. I would have used something
- like "4.X.X", but letters are not really supported by the current
- system.
-
-2003-01-16 Harald Radi <harald.radi+coding.php@nme.at>
-
- * ext/rpc/handler.h
- ext/rpc/layer.h
- ext/rpc/php_rpc.h
- ext/rpc/rpc.c
- ext/rpc/rpc.h
- ext/rpc/com/com.c
- ext/rpc/com/com.h
- ext/rpc/com/php_com.h
- ext/rpc/skeleton/skeleton.c
- ext/rpc/skeleton/skeleton.h:
- make layers loadable as self-sustaining php extension
- which registeres itself in the rpc framework.
-
-2003-01-16 Dan Kalowsky <dank@deadmime.org>
-
- * ext/odbc/php_odbc.h:
- typo corrected
-
- * ext/odbc/php_odbc.c
- ext/odbc/php_odbc.h:
- Adding in test ability for WIndows to fetch_objects
-
-2003-01-16 Edin Kadribasic <edink@proventum.net>
-
- * ext/standard/math.c:
- Fixed bug #21648
-
-2003-01-16 Sascha Schumann <sascha@schumann.cx>
-
- * php.ini-dist
- php.ini-recommended
- ext/session/mod_files.c
- ext/session/php_session.h
- ext/session/session.c:
- Add INI setting session.hash_bits_per_character which enables developers
- to choose how session ids are represented, regardless of the hash
- algorithm.
-
-2003-01-16 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/oracle/oracle.c:
- Fixed bug #20079 (made ora_logoff return TRUE on success).
-
-2003-01-15 Edin Kadribasic <edink@proventum.net>
-
- * win32/php_modules.dsw:
- Added some missing modules. Removed some that are built in or moved to
- ext/rpc.
-
-2003-01-15 Harald Radi <harald.radi+coding.php@nme.at>
-
- * (PHP_4_3)
- ext/rpc/.cvsignore
- ext/rpc/CREDITS
- ext/rpc/EXPERIMENTAL
- ext/rpc/RPC_HOWTO
- ext/rpc/handler.h
- ext/rpc/hash.h
- ext/rpc/layer.h
- ext/rpc/php_rpc.h
- ext/rpc/rpc.c
- ext/rpc/rpc.h
- ext/rpc/rpc_proxy.c
- ext/rpc/rpc_proxy.h
- ext/rpc/com/.cvsignore
- ext/rpc/com/CREDITS
- ext/rpc/com/TODO
- ext/rpc/com/com.c
- ext/rpc/com/com.h
- ext/rpc/com/com_wrapper.c
- ext/rpc/com/com_wrapper.h
- ext/rpc/com/conversion.c
- ext/rpc/com/conversion.h
- ext/rpc/com/dispatch.c
- ext/rpc/com/variant.c
- ext/rpc/com/variant.h
- ext/rpc/dotnet/.cvsignore
- ext/rpc/dotnet/CREDITS
- ext/rpc/dotnet/EXPERIMENTAL
- ext/rpc/dotnet/README
- ext/rpc/dotnet/dotnet.cpp
- ext/rpc/dotnet/dotnet.dsp
- ext/rpc/dotnet/dotnet.php
- ext/rpc/dotnet/php_dotnet.h
- ext/rpc/java/.cvsignore
- ext/rpc/java/CREDITS
- ext/rpc/java/EXPERIMENTAL
- ext/rpc/java/Makefile.frag
- ext/rpc/java/README
- ext/rpc/java/config.m4
- ext/rpc/java/except.php
- ext/rpc/java/java.c
- ext/rpc/java/java.dsp
- ext/rpc/java/jawt.php
- ext/rpc/java/jver.php
- ext/rpc/java/reflect.java
- ext/rpc/skeleton/skeleton.c
- ext/rpc/skeleton/skeleton.h
- ext/rpc/tests/test1.php
- ext/rpc/tests/test2.php
- ext/rpc/tests/test3.php
- ext/rpc/tests/test4.php
- ext/rpc/tests/tests.php
- ext/rpc/xmlrpc/.cvsignore
- ext/rpc/xmlrpc/CREDITS
- ext/rpc/xmlrpc/EXPERIMENTAL
- ext/rpc/xmlrpc/config.m4
- ext/rpc/xmlrpc/php_xmlrpc.h
- ext/rpc/xmlrpc/xmlrpc-epi-php.c
- ext/rpc/xmlrpc/xmlrpc.dsp
- ext/rpc/xmlrpc/libxmlrpc/.cvsignore
- ext/rpc/xmlrpc/libxmlrpc/README
- ext/rpc/xmlrpc/libxmlrpc/acinclude.m4
- ext/rpc/xmlrpc/libxmlrpc/base64.c
- ext/rpc/xmlrpc/libxmlrpc/base64.h
- ext/rpc/xmlrpc/libxmlrpc/encodings.c
- ext/rpc/xmlrpc/libxmlrpc/encodings.h
- ext/rpc/xmlrpc/libxmlrpc/queue.c
- ext/rpc/xmlrpc/libxmlrpc/queue.h
- ext/rpc/xmlrpc/libxmlrpc/simplestring.c
- ext/rpc/xmlrpc/libxmlrpc/simplestring.h
- ext/rpc/xmlrpc/libxmlrpc/system_methods.c
- ext/rpc/xmlrpc/libxmlrpc/system_methods_private.h
- ext/rpc/xmlrpc/libxmlrpc/xml_element.c
- ext/rpc/xmlrpc/libxmlrpc/xml_element.h
- ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.c
- ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.h
- ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.c
- ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.h
- ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.c
- ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.h
- ext/rpc/xmlrpc/libxmlrpc/xmlrpc.c
- ext/rpc/xmlrpc/libxmlrpc/xmlrpc.h
- ext/rpc/xmlrpc/libxmlrpc/xmlrpc.m4
- ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.c
- ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.h
- ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h
- ext/rpc/xmlrpc/libxmlrpc/xmlrpc_private.h
- ext/rpc/xmlrpc/libxmlrpc/xmlrpc_win32.h:
- removing this stuff from the php 4.3 branch
-
-2003-01-15 Sascha Schumann <sascha@schumann.cx>
-
- * main/SAPI.h:
- scrap STANDARD_SAPI_MODULE_PROPERTIES; it is causing more harm than good
-
-2003-01-15 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/interbase/interbase.c:
- More build fixes.
-
-2003-01-15 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/basic_functions.c
- ext/standard/exec.h
- ext/standard/proc_open.c
- ext/standard/proc_open.h
- ext/standard/tests/general_functions/proc_open.phpt:
- Relieve scripts of the burden of ensuring that all pipes are closed prior
- to calling proc_close().
- Implement proc_get_status(resource $process) which returns an array of
- information about a process created with proc_open().
- The information includes:
- array(
- "command" => string "name of the command",
- "pid" => long process identifier,
- "running" => bool true if the process is still running
- "exitcode" => long exitcode if the process exited
- "signaled" => bool true if the process was signaled
- "termsig" => long signal number if signaled
- "stopped" => bool true if the process is stopped
- "stopsig" => long signal number if stopped
- );
-
-2003-01-15 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/informix/ifx.ec:
- Fixed a typo.
-
-2003-01-15 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * main/config.w32.h:
- Define PHP_CAN_SUPPORT_PROC_OPEN.
-
- * win32/php4dll.dsp
- win32/php4dllts.dsp:
- Add proc_open.c to project.
-
-2003-01-15 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/basic_functions.c
- ext/standard/config.m4
- ext/standard/exec.c
- ext/standard/proc_open.c:
- - Move proc_open code to a source file of it's own.
- - Tidy up that netware mess by performing a configure check which will
- define the symbol PHP_CAN_SUPPORT_PROC_OPEN if PHP can support
- proc_open.
- - Protected the proc_open specific code with #ifdef
- PHP_CAN_SUPPORT_PROC_OPEN
- so that user-space scripts can use function_exists and react
- accordingly.
-
- ** Heads Up Win32: You need to add ext/standard/proc_open.c to the DSP and
- ** #define PHP_CAN_SUPPORT_PROC_OPEN in the w32 config header.
-
-2003-01-15 Jani Taskinen <sniper@iki.fi>
-
- * (PHP_4_3)
- ext/session/mod_files.c:
- MFH: handle ERANGE from strtol properly
-
-2003-01-15 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/interbase/interbase.c:
- Build fixes.
-
-2003-01-15 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- Fixed a qp encoder bug that the constructor sometimes fails if
- line-breaking mode is off.
-
-2003-01-15 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/rpc/java/java.c:
- Typo fixes.
-
- * ext/informix/ifx.ec:
- Fixed typo.
-
- * ext/sybase/php_sybase_db.c
- ext/sybase_ct/php_sybase_ct.c:
- Various corrections.
-
- * ext/interbase/interbase.c:
- Fixed typos.
-
- * ext/dbase/dbase.c:
- Typo corrections.
-
-2003-01-15 Sascha Schumann <sascha@schumann.cx>
-
- * main/SAPI.c
- main/SAPI.h:
- whitespace
-
-2003-01-15 Yasuo Ohgaki <yohgaki@ohgaki.net>
-
- * ext/pgsql/pgsql.c:
- Fixed proto
-
-2003-01-15 Adam Dickmeiss <adam@indexdata.dk>
-
- * ext/yaz/php_yaz.c
- ext/yaz/php_yaz.h:
- Fix functions comments (connection resource rather than connection id).
- New functions yaz_set_option and yaz_get_option.
- Cleanup in yaz_connect.
-
- * ext/yaz/config.m4:
- Fix lib config for the case where YAZ depends on multiple libraries
-
-2003-01-15 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/interbase/interbase.c:
- Kill compile warning.
-
- * ext/informix/ifx.ec
- ext/interbase/interbase.c
- ext/sybase/php_sybase_db.c
- ext/sybase_ct/php_sybase_ct.c:
- Newer parameter parsing API.
-
- * ext/hwapi/hwapi.cpp
- ext/hyperwave/hw.c
- ext/qtdom/qtdom.c
- ext/rpc/dotnet/dotnet.cpp
- ext/rpc/java/java.c
- ext/snmp/winsnmp.c:
- Getting rid of the old API parsing code.
-
- * ext/filepro/filepro.c:
- Changed php_error to php_error_docref.
- Made use of the more recent parameter parsing API, zend_get_parameters*.
-
- * ext/dbase/dbase.c:
- Removed pointless checks around array_init() & ZE memory allocation macros.
- Changed php_error to php_error_docref.
- Dropped getParam* parameter parsing API in favor of zend_get_parameters*.
-
- * ext/cpdf/cpdf.c
- ext/cpdf/php_cpdf.h:
- This patch allows cpdf to be compiled in conjunction with ncurses, which
- was
- not possible before due to conflicting defines.
-
-2003-01-14 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/rpc/xmlrpc/xmlrpc-epi-php.c:
- Porting of patch applied to ext/xmlrpc.
-
- * ext/xmlrpc/xmlrpc-epi-php.c:
- Made the code use php_error_docref().
- Removed pointless checks around array_init() and emalloc().
- Switched to zend_get_parameters_ex() argument parsing API.
-
- * ext/domxml/php_domxml.c:
- Changed getParameters() to zend_get_parameters_ex().
-
- * ext/hyperwave/hw.c:
- Fixed compile warnings.
-
- * ext/cpdf/cpdf.c:
- One more typo.
-
- * ext/cpdf/cpdf.c:
- Fixed typos.
-
-2003-01-14 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/iconv/iconv.c:
- Appended my name to the list of authors
-
- * ext/iconv/tests/iconv_mime_decode.phpt:
- Test update for new feature
-
-2003-01-14 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/cpdf/cpdf.c:
- Switched from old getParse* argument parsing API to a more recent
- zend_get_parameters*.
-
-2003-01-14 Andrey Hristov <andrey@webgate.bg>
-
- * ext/standard/basic_functions.c
- ext/standard/php_var.h
- ext/standard/var.c:
- added function get_memory_usage(). available only when PHP is compiled
- with --enable-memory-limit
-
-2003-01-14 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/hyperwave/hg_comm.c:
- Fixed compile warning & removed useless variable.
-
- * ext/hyperwave/hw.c:
- Changed php_error to php_error_docref.
- Got rid off the ancient getParameters* parameter parsing API.
-
-2003-01-14 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- Added a new option "force-encode-first" to the quoted-printable encoder
- as per Wez's request. If enabled, the encoder forcefully does qp
- tranformation on every first character of lines in incoming stream.
-
-2003-01-14 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/cpdf/cpdf.c:
- Changed php_error() to php_error_docref().
- Made pdfdoc retrieval a macro.
-
-2003-01-14 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/quot_print.c:
- Made php_quot_print_decode() RFC2045-compliant
-
-2003-01-14 Edin Kadribasic <edink@proventum.net>
-
- * (PHP_4_3)
- NEWS:
- Bugfixing news
-
- * ext/gettext/gettext.dsp:
- MFB: bind_textdomain_codeset() availability on windows
-
- * (PHP_4_3)
- ext/gettext/gettext.dsp:
- Made bind_textdomain_codeset() available on windows (fixes #21525).
-
-2003-01-14 Derick Rethans <d.rethans@jdimedia.nl>
-
- * win32/install.txt:
- s/gd/gd2
-
-2003-01-14 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/sockets/sockets.c:
- Changed php_error to php_error_docref().
- Removed pointless checks around array_init().
-
-2003-01-14 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- Fixed small memory leak that occurs when the invalid line length is passed
- to the qprint ctor.
-
- * ext/standard/filters.c:
- Fixed quoted-printable encoder so that it produces RFC2045 complicant
- output. As per this specification requirement, the constructor now accepts
- three options: binary (boolean), line-len (uint), line-break-chars
- (string).
-
-2003-01-13 Jani Taskinen <sniper@iki.fi>
-
- * ext/informix/config.m4
- ext/informix/config.m4:
- Fixed bug: #21543, Informix version detection fails
-
-2003-01-13 Frank M. Kromann <frank@kromann.info>
-
- * ext/rpc/com/conversion.c:
- false should be VT_FALSE
-
-2003-01-13 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * (PHP_4_3)
- tests/run-test/test008.phpt:
- MFH
-
- * tests/run-test/test008.phpt:
- Fixed typoFixed typoFixed typoFixed typoFixed typoFixed typoFixed typoFixed
- typo
-
-2003-01-13 Andrey Hristov <andrey@webgate.bg>
-
- * ext/standard/array.c
- ext/standard/basic_functions.c
- ext/standard/php_array.h:
- added array_combine().
- Creates an array by using the elements of the first parameter as keys and
- the elements of the second as correspoding keys. Error is thrown in case
- the arrays has different number of elements. Number of elements 0 is not
- valid for both parameters.
-
-2003-01-13 Edin Kadribasic <edink@proventum.net>
-
- * sapi/servlet/servlet.dsp:
- Adjust paths for the new location of ext/rpc/java
-
- * ext/rpc/java/java.dsp:
- Adjust paths to the new location java.dsp
-
- * ext/rpc/xmlrpc/xmlrpc-epi-php.c:
- Fix ZTS build here too.
-
- * ext/xmlrpc/xmlrpc-epi-php.c:
- Fixed ZTS build.
-
-2003-01-13 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- Fixed a silly segfault bug caused by lack of strict type checking
-
-2003-01-13 Sascha Schumann <sascha@schumann.cx>
-
- * build/buildcheck.sh:
- which is not portable. use our bundled shtool instead.
-
-2003-01-13 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- . Implemented a common filter parameter parsing function.
- . Added automatic line-breaking feature for base64 encode filter. This
- can be turned on by putting a option entry "base64-encode.line-length"
- to the filter parameters.
-
-2003-01-13 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/domxml/php_domxml.c:
- - Fix ZTS build
-
-2003-01-12 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * tests/lang/bug21600.phpt:
-
- Added test case for bug #21600
-
- * ext/standard/filters.c:
- Fixed a bug of the base64 decoder that a sequence of intervening
- characters that are supposed to be ignored by the decoder cause output
- corruption.
-
-2003-01-12 Stanislav Malyshev <stas@zend.com>
-
- * ext/standard/aggregation.c:
- ZE2 compatibility
-
-2003-01-12 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ext/standard/basic_functions.c
- ext/standard/info.c:
- ZTS fixes.
-
-2003-01-12 Stanislav Malyshev <stas@zend.com>
-
- * ext/standard/aggregation.c:
- Disable ZE2-incompatible parts
-
- * ext/standard/var.c:
- remove unneeded var
-
-2003-01-12 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- Fixed infinite loop bug when an invalid quoted-printable escape sequence
- appears in the streem.
-
- * ext/standard/filters.c:
- Fixed error msg format so it correctly reports the actual filter name
-
-2003-01-12 Sascha Schumann <sascha@schumann.cx>
-
- * php.ini-recommended:
- recommending SHA-1 as hash function
-
- * php.ini-dist:
- sync entries
-
- * php.ini-dist
- php.ini-recommended
- ext/session/php_session.h
- ext/session/session.c:
- add INI setting session.hash_function
- add support for creating session ids using SHA-1
- source more entropy for session ids
-
- * ext/session/mod_files.c:
- handle ERANGE from strtol properly
-
-2003-01-12 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- . Updated quoted-printable filter by a neater implementation.
- . Changed emalloc family functions to pemalloc ones for persistent
- filters.
- . Changed base64 and quoted-printable filter names to
- "convert.base64-encode",
- "convert.base64-decode", "convert.quoted-printable-encode", and
- "convert.quoted-printable-decode" respectively for the consistency that
- may be requested later.
-
-2003-01-12 Derick Rethans <d.rethans@jdimedia.nl>
-
- * NEWS:
- - Update NEWS to show 5.0.0
-
-2003-01-12 Jan Lehnardt <jan@dasmoped.net>
-
- * run-tests.php:
- - fix typo
-
-2003-01-12 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ext/rpc/java/config.m4
- sapi/servlet/Makefile.frag
- sapi/servlet/config.m4
- sapi/servlet/servlet.c
- sapi/servlet/servlet.c
- sapi/servlet/servlet.java:
- Patch by Giuseppe Tanzilli <g.tanzilli@gruppocsf.com>.
-
-2003-01-12 Frank M. Kromann <frank@kromann.info>
-
- * ext/mssql/php_mssql.c:
- Release skiped results. This will free memory on the server.
- Make mssql_execute work for stored procedures with and without returning
- result sets
-
-2003-01-11 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/sybase_ct/php_sybase_ct.c:
- Do not 'convert' double columns to integers after the 1st row in the result
- set.
-
- * ext/sybase_ct/php_sybase_ct.c:
- Fixed handling of NUMERIC type, when it contains numbers that could
- potentially exceed the interger limit.
-
-2003-01-11 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/browscap.c
- ext/standard/datetime.c
- ext/standard/file.c
- ext/standard/formatted_print.c
- ext/standard/pack.c
- ext/standard/reg.c
- ext/standard/string.c:
- Reverted because correct decision has not been made yet.
-
- * sapi/apache2filter/php_functions.c:
- This patch is likely to fix win32 build
-
- * ext/standard/browscap.c
- ext/standard/datetime.c
- ext/standard/pack.c
- ext/standard/reg.c
- ext/standard/string.c:
- Reduced warnings in ZE2 build
-
- * ext/standard/file.c
- ext/standard/formatted_print.c:
- Reduced compiler warnings in ZE2 build
-
-2003-01-11 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/string.c:
- Added stripos() & strripos() functions.
- Added 3rd parameter (offset) to strrpos().
-
-2003-01-11 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ext/rpc/rpc.c:
- Add missing ,.
-
-2003-01-11 Harald Radi <harald.radi+coding.php@nme.at>
-
- * ext/rpc/rpc.c
- ext/rpc/rpc_proxy.c
- ext/rpc/com/variant.c:
- fix build
-
-2003-01-11 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * win32/php4dllts.dsp:
- Leftover.
-
-2003-01-11 Ilia Alshanetsky <ilia@prohost.org>
-
- * sapi/cli/php_cli.c:
- Fix the line numbering when the 1st line in the script is #!.
-
-2003-01-10 Harald Radi <harald.radi+coding.php@nme.at>
-
- * main/config.w32.h
- main/internal_functions_win32.c
- win32/php4dllts.dsp:
- HEAD defaults to build with ZE2 now
-
-2003-01-10 Frank M. Kromann <frank@kromann.info>
-
- * ext/mssql/php_mssql.c:
- Fixing copy and paste errors
-
- * ext/mssql/php_mssql.c:
- Avoid warnings when running stored procedures returning multiple results
- before setting output and return values.
- Additional results can be skipped by the optional parameter to
- mssql_execute
-
-2003-01-10 Christian Stocker <chregu@phant.ch>
-
- * ext/domxml/php_domxml.c:
- Throw error if object is not a XML_DOCUMENT_NODE in domxml_dump_node()
-
- * (PHP_4_3)
- ext/domxml/php_domxml.c:
- Throw error if object is not a XML_DOCUMENT_NODE
-
-2003-01-10 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/math.c:
- Fix the number format fix when the number of decimal places is 0.
-
-2003-01-10 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/xmlrpc/xmlrpc-epi-php.c:
- - Fixed bug #20155: xmlrpc compile problem with zendengine2 (Path by Jan
- Schneider)
-
-2003-01-10 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/mime_magic/mime_magic.c
- ext/standard/reg.c:
- Reduced compiler warnings
-
- * ext/iconv/iconv.c:
- Added missing cast operators
-
-2003-01-10 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/gd/libgd/gd.c:
- Fixed ImageRotate when rotation angle is 90 degrees, patch by
- leon@leonatkinson.com.
-
-2003-01-10 Stig Bakken <ssb@fast.no>
-
- * (RELEASE_1_0_1)
- pear/package-PEAR.xml:
- - prepare 1.0.1 release
-
-2003-01-10 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
-2003-01-10 Stig Bakken <ssb@fast.no>
-
- * (RELEASE_1_0_1)
- pear/scripts/pear.in:
- - obey PHP_PEAR_INSTALL_DIR and PHP_PEAR_PHP_BIN environment variables
-
- * (RELEASE_1_0_1)
- pear/PEAR/Command/Package.php:
- - verbosity fix for cvstag and cvsdiff commands
-
- * (RELEASE_1_0_1)
- pear/OS/Guess.php:
- - TODO item
-
- * pear/PEAR/Command/Package.php:
- - add "cvsdiff" command
-
- * (RELEASE_1_0_1)
- pear/PEAR/Config.php:
- - use getenv() instead of $_ENV[]
-
-2003-01-09 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/file.c:
- CS fixes
-
- * ext/standard/file.c:
- Fixed a memory corruption that occurs when an unterminated " is encountered
- this bug maybe be related to #21556.
-
-2003-01-09 Frank M. Kromann <frank@kromann.info>
-
- * ext/mssql/config.m4:
- Adding extended checks for where FreeTDS is installed
-
-2003-01-09 Ilia Alshanetsky <ilia@prohost.org>
-
- * main/safe_mode.c:
- Fixed compiler warnings.
-
-2003-01-09 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/filestat.c
- main/safe_mode.c
- main/safe_mode.h:
- Bug #21531 file_exists() and other filestat functions throw errors when
- in safe mode and file/directory does not exist.
- Extended php_checkuid function to add "flags" field via rename to
- php_checkuid_ex with alias for BC in functions that do want safe mode
- errors thrown.
-
-2003-01-09 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/ctype/ctype.c:
- Fixed typo
-
-2003-01-09 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/basic_functions.c
- ext/standard/basic_functions.h
- ext/standard/formatted_print.c
- tests/strings/002.phpt:
- Implement fprintf() and vfprintf().
- Add a couple of tests.
-
-2003-01-09 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * (PHP_4_3)
- main/.cvsignore
- main/config.w32.h
- main/config.w32.h.in
- win32/php4dll.dsp
- win32/php4dllts.dsp:
- MFH: Revert config.w32.h.in -> config.w32.h build step.
-
-2003-01-09 Jani Taskinen <sniper@iki.fi>
-
- * configure.in:
- Fix bug: #21511, config.status warning
-
-2003-01-09 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/math.c
- ext/standard/tests/math/bug21523.phpt:
- Fix Bug #21523 - number_format could cause a memory allocation for a
- negative memory size in situations where the sprintf implementation of the
- host system generated less decimal places than were requested.
-
- Resolved this issue by making number_format examine the string returned
- by spprintf and have it pad to the correct number of decimal places.
-
- Added a test-case based on the bug report; the length of decimal places
- required to trigger this bug is sprintf implementation dependent; as the
- implementation is now using spprintf (provided by PHP), that number is
- 78 digits (NDIG - 2).
-
-
-
-2003-01-09 Stig Bakken <ssb@fast.no>
-
- * (RELEASE_1_0_1)
- pear/PEAR.php:
- - added debug_backtrace() support to PEAR errors
-
- * (RELEASE_1_0_1)
- pear/System.php:
- - System::which() now checks .exe .bat .cmd and .com on Windows
-
- * (RELEASE_1_0_1)
- pear/PEAR/Frontend/CLI.php:
- - cleanups
-
-2003-01-09 Zeev Suraski <zeev@zend.com>
-
- * configure.in
- main/php_version.h:
- Time for an update
-
-2003-01-09 Frank M. Kromann <frank@kromann.info>
-
- * ext/mssql/php_mssql.c:
- Use the correct link when checking for more results on stored procedures
-
- * ext/mssql/php_mssql.c
- ext/mssql/php_mssql.h:
- Restire BC for mssql_execute(). This will not break the new feature for
- handling
- multiple results from a single stired procedure.
- Adding mssql_free_statement()
-
-2003-01-09 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/fsock.c:
- Fixed bug #21529 (memory corruption by fsockopen()).
-
-2003-01-09 Frank M. Kromann <frank@kromann.info>
-
- * ext/mssql/php_mssql.c:
- changed from LVAL to RESVAL macro
-
-2003-01-09 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/image.c:
- Fix the ZTS build.
-
-2003-01-08 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- Reimplemented base64 filter to use iconv()-like facility for flexibility.
-
-2003-01-08 Frank M. Kromann <frank@kromann.info>
-
- * ext/fbsql/php_fbsql.h
- ext/mssql/php_mssql.c
- ext/mssql/php_mssql.h:
- Changed global data type to avoid problems with initialization
-
-2003-01-08 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/image.c
- ext/standard/php_image.h:
- Added support for WBMP images.
-
- * ext/gd/gd.c
- ext/gd/libgd/gd_io_dp.c:
- Fixed bug #21518.
- Fixed memory in leak ImageCreateFromString().
- Fixed a bug that prevented proper identification of WBMP images and thus
- prevented ImageCreateFromString() from working on those images.
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
-2003-01-08 Zeev Suraski <zeev@zend.com>
-
- * ext/session/session.c:
- Fix UMR
-
-2003-01-08 Georg Richter <georg.richter@phpev.de>
-
- * (PHP_4_3)
- ext/mysql/php_mysql.c:
- fixed bug 21498
-
- * ext/mysql/php_mysql.c:
- fixed bug #21498
-
-2003-01-08 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/mcrypt/mcrypt.c:
- Removed unused variable.
-
- * main/main.c:
- Fixed bug #21499 (more descriptive message in the event of require/include
- failure).
-
- * sapi/cgi/cgi_main.c
- sapi/cli/php_cli.c:
- Fixed bug #21297. The fix also fixes miscalculation of lines numbers by 1
- due the previously mentioned bug.
-
- * ext/odbc/php_odbc.c:
- Version is char ;).
-
-2003-01-07 Christian Dickmann <chrisdicki@gmx.de>
-
- * pear/PEAR/Config.php:
- fix default umask(); (thx to Mirco MEEBEY Bauer for bringing this behavior
- to my attention and testing the patch)
-
-2003-01-07 Dan Kalowsky <dank@deadmime.org>
-
- * ext/odbc/php_odbc.c:
- Version tag for future move to PECL
-
- * ext/odbc/config.m4
- ext/odbc/php_odbc.c:
- Reverting last change as it really doesn't fix longreadlen problems in all
- cases.
-
-2003-01-07 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- Instances should not be freed in dtor()...
-
- * ext/standard/filters.c:
- Made error msg format more consistent
-
-2003-01-07 Pierre-Alain Joye <paj@pearfr.org>
-
- * ext/gd/gd.c:
- Fix line drawed twice (L. Atkinson)
-
-2003-01-07 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/user_filters.c:
- Backout changes between 1.6 and 1.7
-
-2003-01-07 Zeev Suraski <zeev@zend.com>
-
- * sapi/cgi/cgi_main.c:
- Add missing call
-
-2003-01-07 Levi Dixon <ldixon@mail.communityconnect.com>
-
- * ext/oci8/config.m4
- ext/oci8/oci8.c:
- Added support for Shared Data Mode for OCI8_VERSION >= 8.1, which will
- provide memory savings by sharing common statement data
-
-2003-01-07 Edin Kadribasic <edink@proventum.net>
-
- * (PHP_4_3)
- NEWS:
- Bugfix #17098 in the branch
-
- * (PHP_4_3)
- sapi/apache2filter/sapi_apache2.c:
- MFH:
- Fixed bug #17098 (make Apache aware that PHP scripts represent dynamic
- data
- and should not be cached). Fix suggested by daniel.eckl@gmx.de.
-
-2003-01-07 Ilia Alshanetsky <ilia@prohost.org>
-
- * run-tests.php:
- Added a check for availability of PCRE extension needed by test-suite.
-
-2003-01-07 Vincent Blavet <vincent@blavet.net>
-
- * pear/Archive/Tar.php:
- - Synchronize with /pear/Archive_Tar/Tar.php 1.5 :
- - Add support for long filenames (greater than 99 characters)
- - Add private methods _readLongHeader() and _writeLongHeader()
-
-2003-01-07 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/domxml/php_domxml.c:
- Fixed ZTS build with ZE2.
-
- * ext/ftp/ftp.c
- ext/ftp/ftp.h
- ext/ftp/php_ftp.c:
- ZTS cleanup.
-
-2003-01-07 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/basic_functions.c:
- whitespace
-
-2003-01-07 Edin Kadribasic <edink@proventum.net>
-
- * (PHP_4_3)
- NEWS:
- Bugfixing news
-
- * win32/sendmail.c:
- MFB:
- Fixed bug #21442 (Crash of mail() on Windows when the first parameter
- is empty).
-
- * (PHP_4_3)
- win32/sendmail.c:
- Fixed bug #21442 (Crash of mail() on Windows when the first parameter
- is empty).
-
-2003-01-07 Sascha Schumann <sascha@schumann.cx>
-
- * ext/mysql/config.m4:
- tell user which header files could not be found
-
-2003-01-07 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/user_filters.c:
- Fixed small leak
-
-2003-01-07 Frank M. Kromann <frank@kromann.info>
-
- * ext/mssql/config.m4:
- Making the mssql extension work when build as a shared object
-
-2003-01-07 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/ftp/ftp.c
- ext/ftp/ftp.h
- ext/ftp/php_ftp.c:
- Fixed ZTS build.
-
- * ext/ftp/ftp.c
- ext/ftp/php_ftp.c:
- MFB + CS
-
- * (PHP_4_3)
- ext/ftp/ftp.c
- ext/ftp/php_ftp.c:
- Changed perror() to php_error_docref(), fixed bug #21309.
- Made extension use ZE memory allocation wrappers, fixed a memory leak in
- ftp_mkdir.
- Removed duplicate ftp_syst() call inside ftp_systype().
-
-
-2003-01-07 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * NEWS:
- Trivial grammer fix
-
- * ext/standard/filters.c:
- Implemented quoted-printable stream filter
-
-2003-01-07 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/user_filters.c:
- Add option to stream_get_filters() user-defined fiters vs. all filters,
- default to user only
-
-2003-01-07 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/standard/filters.c:
- Implemented string.base64 stream filter
-
-2003-01-06 Stefan Esser <s.esser@e-matters.de>
-
- * main/rfc1867.c:
- Adding support for anonymous fileuploads (#21450)
-
-2003-01-06 Wez Furlong <wez.php@thebrainroom.net>
-
- * main/streams.c:
- Fix for Bug #20827: where stat is a macro on Tru64.
- Patch from <julien.soula@free.fr>
-
-2003-01-06 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/string.c
- ext/standard/tests/strings/bug21453.phpt:
- Fixed bug #21453 (improper handling of non-terminated <).
-
- * ext/standard/browscap.c:
- Fixed Bug #21443 and related bug #21468.
-
-2003-01-06 Dan Kalowsky <dank@deadmime.org>
-
- * ext/odbc/php_odbc.c:
- Patch for bug #19349
-
- * ext/odbc/php_odbc.c:
- Correction for bug #21279
-
-2003-01-06 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/iconv/iconv.c
- ext/standard/quot_print.c
- ext/standard/quot_print.h:
- Moved php_quot_print_decode() to quot_print.c so that it can be used
- outside the iconv module
-
- * ext/iconv/iconv.c:
- Added more RFC2047-compliancy check in iconv_mime_decode()
-
- * ext/iconv/iconv.c:
- Fixed iconv_mime_decode() so that it comforms to RFC2231
-
-2003-01-06 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysql/php_mysql.c:
- fixed missing & (Thx to Sebastian Bergmann)
-
- * (PHP_4_3)
- ext/mysql/php_mysql.c:
- fixed a missing & (Thx to Sebastian Bergmann
-
-2003-01-06 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/tests/file/userfilters.phpt:
- Make it slightly more obvious that the return value is relative to the
- length
- of the input data.
-
- * main/php_streams.h:
- Fix for bug #21406; infinite loop during filter flushing.
-
-2003-01-06 Edin Kadribasic <edink@proventum.net>
-
- * (PHP_4_3)
- NEWS:
- Bugfixing news.
-
- * ext/gd/gd_bundled.dsp:
- MFB:
- Fixed bug #20503 (imagesetbrush() availability on windows).
-
- * (PHP_4_3)
- ext/gd/gd_bundled.dsp:
- Fixed bug #20503 (imagesetbrush() availability on windows).
-
-2003-01-06 Anantha Kesari H Y <hyanantha@novell.com>
-
- * ext/pgsql/php_pgsql.h:
- Removed #ifdef NetWare and made the necessary changes in the directory
- structure of NetWare.
-
- * netware/libpq/libpq-fs.h:
- Header file for PostgreSQL. Moved from netware directory to netware/libpq
- directory.
-
- * netware/libpq-fs.h:
- This file moved to netware/libpq directory.
-
-2003-01-06 Christian Stocker <chregu@phant.ch>
-
- * (PHP_4_3)
- ext/domxml/php_domxml.c:
- - fix crash in domxml_node_insert_before() (by Lukas Schröder)
-
- * ext/domxml/php_domxml.c
- ext/domxml/php_domxml.h:
- - get_path forgotten in .h file
- - fix crash in domxml_node_insert_before() (by Lukas Schröder)
-
-2003-01-06 Anantha Kesari H Y <hyanantha@novell.com>
-
- * netware/phplib.imp:
- Added symbols to build PostgreSQL extension for NetWare.
-
- * ext/mysql/mysql.mak:
- Changes for NetWare makefile.
-
- * ext/pgsql/pgsql.mak
- ext/pgsql/php_pgsql.h:
- Makefile added newly and modified the header file for NetWare.
-
-2003-01-06 Christian Stocker <chregu@phant.ch>
-
- * (PHP_4_3)
- ext/domxml/php_domxml.c:
- partly MFH from 1.288 (Fixed segfault, when trying to add a node to itself)
-
- * ext/domxml/php_domxml.c:
- - Fixed segfault, when trying to add a node to itself.
-
-2003-01-06 Anantha Kesari H Y <hyanantha@novell.com>
-
- * ext/standard/basic_functions.c:
- Added #ifdef HAVE_SYSLOG_H around syslog function in the whole file to
- avoid link failure.
-
- * netware/phplib.mak:
- Modified for Netware.
-
-2003-01-06 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/filters.c:
- Added string.toupper and string.tolower filters and generalized non-op
- filter methods
-
-2003-01-06 Frank M. Kromann <frank@kromann.info>
-
- * ext/gd/libgd/gdft.c:
- Nuke warning, on Win32 build
-
- * ext/gd/gd_bundled.dsp:
- enable imageftbbox() and imagefttext() on WIn32
-
-2003-01-06 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/user_filters.c
- main/php_streams.h
- main/streams.c:
- Expose stream_filters_hash so that it can be searched by
- stream_get_filters()
-
-2003-01-06 Edin Kadribasic <edink@proventum.net>
-
- * (PHP_4_3)
- NEWS:
- Mention gif read-only support on windows.
-
- * (PHP_4_3)
- ext/gd/gd_bundled.dsp:
- MFH: Added missing flags and .c files for gif read support on Windows.
-
- * ext/gd/gd_bundled.dsp:
- Complete gif readonly support addition by adding missing gd_gif_in.c
- file to the project.
-
- * ext/mcrypt/mcrypt.c:
- Comment out non ANSI C standard comliant code. Fixes win32 build.
-
- * ext/dba/dba.c:
- Fixed win32 build.
-
-2003-01-06 Ilia Alshanetsky <ilia@prohost.org>
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * ext/gd/libgd/gd.h
- ext/gd/libgd/gdft.c:
- Fixed bug #21445.
-
-2003-01-05 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/file.c
- ext/standard/user_filters.c:
- Fixes to stream_get_wrappers() and stream_get_filters() handle hash table
- layouts better, plus some picune whitespace fixes
-
-2003-01-05 Georg Richter <georg.richter@phpev.de>
-
- * ext/mysql/php_mysql.c:
- fixed bug #21435
-
-2003-01-05 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ext/gd/gd_bundled.dsp:
- Define HAVE_GD_GIF_READ.
-
-2003-01-05 Zeev Suraski <zeev@zend.com>
-
- * main/main.c:
- Remove unnnecessary initialization
-
- * sapi/cgi/cgi_main.c
- sapi/cli/php_cli.c:
- Initialize lineno using the new infrastructure
-
-2003-01-05 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * main/.cvsignore
- main/config.w32.h
- main/config.w32.h.in
- win32/php4dll.dsp
- win32/php4dllts.dsp:
- Revert config.w32.h.in -> config.w32.h build step per discussion with Zeev.
-
-2003-01-05 Zeev Suraski <zeev@zend.com>
-
- * sapi/apache/php4apache.dsp:
- Make the .dsp use the php4build build directories
-
-2003-01-05 Edin Kadribasic <edink@proventum.net>
-
- * ext/xslt/xslt.dsp:
- MFB:
- Made xslt_set_encoding() available on windows (bug #20640).
-
- * (PHP_4_3)
- ext/xslt/xslt.dsp:
- Made xslt_set_encoding() available on windows (bug #20640).
-
- * (PHP_4_3)
- ext/standard/php_incomplete_class.h:
- Fixed ZTS build.
-
-2003-01-05 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/string.c:
- Fixed a memory leak in setlocale() & localeconv().
-
-2003-01-05 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/basic_functions.c
- ext/standard/basic_functions.h
- ext/standard/user_filters.c:
- Added stream_get_filters(); to list registered filters
-
-2003-01-05 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/filestat.c:
- - Fix some of the netware crap
-
-2003-01-04 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/filestat.c:
- - Change Warnings to Notices
-
-2003-01-04 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/openssl/openssl.c:
- CS fixes.
-
-2003-01-04 Marcus Boerger <marcus.boerger@post.rwth-aachen.de>
-
- * (PHP_4_3)
- ext/standard/browscap.c
- ext/wddx/wddx.c:
- Fix ZTS-ZE2 (After Cygwin now for the rest)
-
- * ext/exif/tests/exif003.phpt
- ext/exif/tests/exif004.phpt:
- better to check for existance first
-
- * ext/dbx/dbx.c
- ext/imap/php_imap.c
- ext/standard/browscap.c
- ext/standard/incomplete_class.c
- ext/standard/php_incomplete_class.h
- ext/standard/var_unserializer.c
- ext/wddx/wddx.c:
- Fix ZTS-ZE2 build
-
-2003-01-04 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * NEWS:
- Forgot to include these functions in the list
-
-2003-01-04 Derick Rethans <d.rethans@jdimedia.nl>
-
- * NEWS:
- - Fix typo
-
-2003-01-04 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/iconv/iconv.c:
- Fixed cut'n'paste failure
-
- * NEWS:
- NEWS update for new iconv functions
-
- * ext/iconv/tests/iconv_mime_encode.phpt:
- Added test case for iconv_mime_encode()
-
-2003-01-04 Derick Rethans <d.rethans@jdimedia.nl>
-
- * (PHP_4_3)
- ext/pgsql/pgsql.c:
- - MFH: Fixed bug #21232 (Unresolved references to PQsetnonblocking). (Patch
- by
- Floyd <floyd@studiodust.com>)
-
- * ext/pgsql/pgsql.c:
- - Fixed bug #21232 (Unresolved references to PQsetnonblocking). (Patch by
- Floyd <floyd@studiodust.com>)
-
-2003-01-03 Alex Waugh <alex@alexwaugh.com>
-
- * acinclude.m4:
- Provide alternative for glibc brokenness test when cross compiling
-
-2003-01-03 Derick Rethans <d.rethans@jdimedia.nl>
-
- * sapi/apache/php_apache.c
- sapi/apache/php_apache.c:
- - Fix docrefs
-
- * sapi/apache/php_apache.c:
- - Fix typo (patch by Joseph Tate)
-
-2003-01-03 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/iconv/tests/iconv_mime_decode.phpt:
- Added test case for iconv_mime_decode()
-
- * ext/iconv/tests/iconv_strpos.phpt
- ext/iconv/tests/iconv_strrpos.phpt:
- Added test cases for iconv_strpos() and iconv_strrpos()
-
- * ext/iconv/iconv.c:
- Fixed an iconv_strrpos() bug that the function doesn't return accurate
- position of last occurrence
-
-2003-01-03 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/mcrypt/TODO:
- - Update todo
-
- * ext/mcrypt/config.m4
- ext/mcrypt/mcrypt.c
- ext/mcrypt/php_mcrypt.h:
- - Removed support for libmcrypt 2.2.x to allow cleaner code. Another reason
- to upgrade libmcrypt to a 2.5.x series as the older ones have too much
- bugs
- to be safely used with PHP.
- - Updated macro's, php_errors and parameter parsing.
-
-2003-01-03 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/standard/file.c:
- Fixed a bug that would cause flock() to never set the 3rd argument.
- CS fixes & switched to new parameter parsing API.
-
- * (PHP_4_3)
- ext/standard/http_fopen_wrapper.c:
- MFH (fix for bug #21267 & memory leak fix on reidrects).
-
- * ext/standard/http_fopen_wrapper.c:
- Fixed a memory leak that occurs if the location specified by redirect
- header
- cannot be opened.
-
- * ext/standard/http_fopen_wrapper.c:
- Further fixes related to bug #21267.
-
-2003-01-03 Anantha Kesari H Y <hyanantha@novell.com>
-
- * sapi/apache2filter/php_apache.h
- sapi/apache2filter/sapi_apache2.c:
- Modifications for NetWare.
-
- * netware/phplib.imp
- netware/phplib.mak
- netware/sendmail.c
- netware/sendmail.h:
- Some existing files modified and a couple of files removed for NetWare.
-
- * win32/sendmail.c
- win32/sendmail.h:
- NetWare related changes/modifications.
-
-2003-01-03 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/iconv/iconv.c:
- Added offset validity check for iconv_strpos()
-
-2003-01-03 Anantha Kesari H Y <hyanantha@novell.com>
-
- * ext/xml/xml.mak
- netware/geterrnoptr.c
- netware/sendmail_nw.h
- sapi/apache/libpre.c:
- New file added for NetWare.
-
- * ext/ftp/ftp.c
- ext/ldap/ldap.mak
- ext/ldap/ldap.mak
- ext/mysql/mysql.mak
- ext/mysql/mysql.mak
- ext/session/mod_files.c
- ext/session/session.c
- ext/standard/exec.c
- ext/standard/exec.c
- ext/standard/file.c
- ext/standard/filestat.c
- ext/standard/html.c
- ext/standard/syslog.c
- ext/xml/xml.mak
- netware/buildlib.bat
- netware/phplib.mak:
- Modified for NetWare.
-
- * main/config.nw.h
- main/internal_functions_nw.c
- main/php.h
- main/php_sprintf.c
- main/user_streams.c:
- A new file added and some old files modified for NetWare.
-
-2003-01-03 Edin Kadribasic <edink@proventum.net>
-
- * netware/ApacheCore.imp
- netware/BisonExtStandard.bat
- netware/BisonFlexZend.bat:
- Checking in files for Ananth Kesari <hyanantha@novell.com>
-
-2003-01-03 Anantha Kesari H Y <hyanantha@novell.com>
-
- * netware/ZendEngine2.mak
- netware/grp.h
- netware/libpq.imp
- netware/mktemp.c
- netware/param.h
- netware/php-nw.bat
- netware/php4apache.mak
- netware/php4apache2filter.mak
- netware/php4cli.mak
- netware/phplib.imp
- netware/phplib.mak
- netware/phptest.ncf
- netware/pipe.c
- netware/pipe.h
- netware/postgres_ext.h
- netware/pwd.c
- netware/pwd.h
- netware/start.c
- netware/sysexits.h
- netware/time_nw.c
- netware/time_nw.h
- netware/tsrm.mak
- netware/wfile.c
- netware/wfile.h
- netware/zend.mak:
- A few New files added and some old files modified for NetWare.
-
- * netware/libpq-fe.h
- netware/libpq-fs.h:
- New files added for NetWare.
-
- * netware/common.mif
- netware/sys/stat.h:
- File modified for NetWare.
-
-2003-01-03 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/credits_sapi.h:
- - Update this one as well
-
- * ext/standard/credits_ext.h
- scripts/credits:
- - Remove double "Win32 COM" functions line
-
- * README.PARAMETER_PARSING_API:
- - Whitespace
-
- * (PHP_4_3)
- NEWS:
- Bugfixing news
-
-2003-01-03 Sara Golemon <php@alphaweb.net>
-
- * ext/standard/basic_functions.c
- ext/standard/file.c
- ext/standard/file.h:
- Added stream_get_wrappers()
-
-2003-01-03 Moriyoshi Koizumi <moriyoshi@at.wakwak.com>
-
- * ext/iconv/tests/iconv_strlen.phpt
- ext/iconv/tests/iconv_substr.phpt:
- Added test cases for iconv_strlen() and iconv_substr()
-
- * ext/iconv/iconv.c:
- Fixed iconv_mime_decode() so it would give more awareness to stateful
- codesets
-
- * ext/iconv/iconv.c:
- Fixed infinite loop of iconv_mime_encode() in case the specified line
- length is too short to contain a proper mime-encoded string
-
- * ext/iconv/iconv.c:
- Give mo' shift-sequence awareness to iconv_mime_encode
-
- * ext/iconv/iconv.c:
- More shift-sequence awareness for iconv_substr()
-
- * ext/iconv/iconv.c:
- Added missing casting operators
-
- * ext/iconv/tests/eucjp2iso2022jp.phpt:
- MFB
-
- * (PHP_4_3)
- ext/iconv/tests/eucjp2iso2022jp.phpt:
- Updated the test so it reflects the recent change on iconv.c
-
- * ext/iconv/iconv.c:
- MFB: fixed shift-out sequence unawareness issue
-
- * (PHP_4_3)
- ext/iconv/iconv.c:
- Fixed shift-out sequence unawareness issue
-
- * ext/standard/array.c:
- Fixed small leaks in array_map() in case the first parameter is NULL like
- array_map(NULL, array(...));
-
-2003-01-03 Harald Radi <harald.radi+coding.php@nme.at>
-
- * pear/scripts/pear.bat:
- fixing typo
-
-2003-01-03 Jani Taskinen <sniper@iki.fi>
-
- * NEWS:
- - Removed entries that are going to 4.3.1
- - Grouped the entries a bit.
-
- * (PHP_4_3)
- NEWS:
- Group these entries a bit to make NEWS easier to read.
-
-2003-01-02 Stig Bakken <ssb@fast.no>
-
- * pear/PEAR/Config.php:
- - allways fall back to PHP_SYSCONFDIR
-
-2003-01-02 Ilia Alshanetsky <ilia@prohost.org>
-
- * ext/openssl/openssl.c:
- Fixed a small memory leak when a NULL variable is passed to
- openssl_csr_sign() as the first argument.
-
- * (PHP_4_3)
- NEWS:
- Bug fixing news.
-
- * ext/standard/html.c:
- Fixed bug #21338 (crash inside html_entity_decode() when "" is passed).
- Added test case for the bug.
-
- * ext/standard/tests/strings/bug21338.phpt:
-
- Fixed bug #21338 (crash inside html_entity_decode() when "" is passed).
- Added test case for the bug.
-
- * acinclude.m4
- configure.in:
- Raise required OpenSSL version to 0.9.6.
-
-2003-01-02 Derick Rethans <d.rethans@jdimedia.nl>
-
- * main/SAPI.h:
- - Fixed bug #21169: Compile Failure, and lots of warnings on UnixWare
-
- * (PHP_4_3)
- main/SAPI.h:
- -** empty log message ***
-
-2003-01-02 Zeev Suraski <zeev@zend.com>
-
- * sapi/apache/php4apache.dsp:
- Fix .dsp
-
-2003-01-02 Derick Rethans <d.rethans@jdimedia.nl>
-
- * main/php_streams.h:
- - Fix warnings on UnixWare
-
- * (PHP_4_3)
- Makefile.global:
- - MFH: Fix "make test" when CC was set to something with a parameter
-
- * Makefile.global:
- - Fix "make test" when CC was set to something with a parameter
-
-2003-01-01 Frank M. Kromann <frank@kromann.info>
-
- * ext/standard/base64.c
- ext/standard/base64.h:
- Allow base64 functions to be called from an extension buils as .so/.dll
- (iconv)
-
-2003-01-01 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/browscap.c
- ext/standard/incomplete_class.c:
- build fixes
-
-2003-01-01 Derick Rethans <d.rethans@jdimedia.nl>
-
- * (PHP_4_3)
- tests/run-test/test005.phpt
- tests/run-test/test008.phpt:
- - MFH: Fix tests if Zend Optimizer is loaded
-
- * tests/run-test/test005.phpt
- tests/run-test/test008.phpt:
- - Fix tests if Zend Optimizer is loaded
-
-2003-01-01 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * win32/php4dll.dsp
- win32/php4dllts.dsp:
- Add filter.c, user_filters.c. Group stream related sources.
-
- * ext/standard/filters.c
- ext/standard/user_filters.c:
- Fix warnings.
-
-2003-01-01 Wez Furlong <wez.php@thebrainroom.net>
-
- * ext/standard/filters.c:
- Tidy up
-
- * ext/standard/basic_functions.c
- ext/standard/config.m4
- ext/standard/filters.c
- ext/standard/php_standard.h
- ext/standard/php_string.h
- ext/standard/string.c
- ext/standard/user_filters.c
- ext/standard/tests/file/userfilters.phpt:
- Move rot13 filter into a new filters.c source file.
- Tidy up some other filter related code.
-
-
- * acinclude.m4
- configure.in
- main/streams.c:
- Workaround for glibc 2.2.9x and later "a+" bug that does not seek to EOF
- for
- files fopen()ed with that mode.
-
- * (PHP_4_3)
- acinclude.m4
- configure.in
- main/streams.c:
- Workaround a bug in glibc 2.2.9x and later that causes it not to seek to
- EOF
- for stdio streams opened with a mode of "a+".
-
diff --git a/ChangeLog.1999.gz b/ChangeLog.1999.gz
deleted file mode 100644
index 9d92dda73f..0000000000
--- a/ChangeLog.1999.gz
+++ /dev/null
Binary files differ
diff --git a/ChangeLog.2000.gz b/ChangeLog.2000.gz
deleted file mode 100644
index 91cd3b2425..0000000000
--- a/ChangeLog.2000.gz
+++ /dev/null
Binary files differ
diff --git a/ChangeLog.2001.gz b/ChangeLog.2001.gz
deleted file mode 100644
index 4f0a6f8241..0000000000
--- a/ChangeLog.2001.gz
+++ /dev/null
Binary files differ
diff --git a/ChangeLog.2002.gz b/ChangeLog.2002.gz
deleted file mode 100644
index 6a8c3bea44..0000000000
--- a/ChangeLog.2002.gz
+++ /dev/null
Binary files differ
diff --git a/EXTENSIONS b/EXTENSIONS
deleted file mode 100644
index 57a608c523..0000000000
--- a/EXTENSIONS
+++ /dev/null
@@ -1,492 +0,0 @@
- List of PHP maintainers
- =======================
-
-Maintenance legend
-------------------
- Supported: Someone is actually paid to look after this.
- Maintained: Someone actually looks after it.
- Odd Fixes: It has a maintainer but they don't have time to do
- much other than throw the odd patch in. See below.
- Orphan: No current maintainer [but maybe you could take the
- role as you write your new code].
- Obsolete: Old code. Something tagged obsolete generally means
- it has been replaced by a better system and you
- should be using that.
- Unknown: Not known at this time.
-
-Status legend
--------------
- Working: Working under both Windows and Unix.
- Windows: Working only under Windows.
- Unix: Working only under Unix.
- Experimental: Under development or initial release.
- Not Working: Not working.
- Unknown: Status unknown.
-
-
-== Server APIs ==
-
--------------------------------------------------------------------------------
-EXTENSION: aolserver
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: apache
-PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: apache2
-PRIMARY MAINTAINER: Aaron Bannert <aaron@php.net>
-MAINTENANCE: Maintained
-STATUS: Experimental
--------------------------------------------------------------------------------
-EXTENSION: cgi
-MAINTENANCE: Unknown
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: fhttpd
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: isapi
-MAINTENANCE: Unknown
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: nsapi
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: phttpd
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: pi3web
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: roxen
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: servlet
-PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: thttpd
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: webjames
-PRIMARY MAINTAINER: Alex Waugh <alex@alexwaugh.com>
-MAINTENANCE: Maintained
-STATUS: Experimental
--------------------------------------------------------------------------------
-
-
-== Database extensions ==
-
--------------------------------------------------------------------------------
-EXTENSION: dba
-PRIMARY MAINTAINER: Marcus Börger <helly@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: dbase
-PRIMARY MAINTAINER: Jim Winstead <jimw@php.net>
-MAINTENANCE: Odd Fixes
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: dbx
-PRIMARY MAINTAINER: Marc Boeren <M.Boeren@guidance.nl>
-MAINTENANCE: Maintained
-STATUS: Working
-SINCE: 4.0.6
-COMMENT: DB abstraction for odbc, mysql, pgsql, mssql, fbsql and more, see documentation
--------------------------------------------------------------------------------
-EXTENSION: filepro
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: hyperwave
-PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: informix
-PRIMARY MAINTAINER: Danny Heijl <Danny.Heijl@cevi.be>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: ingres_ii
-PRIMARY MAINTAINER: David Hénot <henot@php.net>
-MAINTENANCE: Maintained
-STATUS: Experimental
-SINCE: 4.0.2
--------------------------------------------------------------------------------
-EXTENSION: interbase
-PRIMARY MAINTAINER: Jouni Ahto <jouni.ahto@exdec.fi>
-MAINTENANCE: Odd Fixes
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: msql
-MAINTENANCE: Unknown
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: msession
-PRIMARY MAINTAINER Mark L. Woodward mlwmohawk@mohawksoft.com
-MAINTENANCE: Maintained
-STATUS: Working/Experimental
-COMMENT: Tested on Linux, should work on other UNIX platforms. Backend server code can compile under Windows.
--------------------------------------------------------------------------------
-EXTENSION: mssql
-PRIMARY MAINTAINER: Frank M. Kromann <fmk@swwwing.com>
-MAINTENANCE: Maintained
-STATUS: Working
-COMMENT: Tested on phpts and isapi versions
--------------------------------------------------------------------------------
-EXTENSION: mysql
-PRIMARY MAINTAINER: Zak Greant <zak@mysql.com>, Georg Richter <georg@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: pgsql
-PRIMARY MAINTAINER: Yasuo Ohgaki <yohgaki@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
-COMMENT: Use PostgreSQL 7.0.x or later. PostgreSQL 6.5.3 or less have fatal bug.
--------------------------------------------------------------------------------
-EXTENSION: sybase
-MAINTENANCE: Unknown
-STATUS: Not Working
--------------------------------------------------------------------------------
-EXTENSION: sybase_ct
-MAINTENANCE: Unknown
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: oci8
-PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: odbc
-PRIMARY MAINTAINER: Daniel R. Kalowsky <kalowsky@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
-COMMENT: Working
--------------------------------------------------------------------------------
-EXTENSION: oracle
-PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
-MAINTENANCE: Maintained
-STATUS: Working
-COMMENT: Using the new OCI8 driver is encouraged where possible.
--------------------------------------------------------------------------------
-
-
-== Other extensions ==
-
--------------------------------------------------------------------------------
-EXTENSION: aspell
-MAINTENANCE: Unknown
-STATUS: Working
-COMMENT: For aspell .27 and greater, check out the pspell extension
--------------------------------------------------------------------------------
-EXTENSION: bcmath
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: bz2
-PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
-MAINTENANCE: Odd Fixes
-STATUS: Working
-SINCE: 4.0.3
--------------------------------------------------------------------------------
-EXTENSION: dio
-PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
-MAINTENANCE: Orphaned
-STATUS: Working
-SINCE: 4.0.6
--------------------------------------------------------------------------------
-EXTENSION: cyrus
-PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
-MAINTENANCE: Orphaned
-STATUS: Working
-SINCE: 4.0.6
--------------------------------------------------------------------------------
-EXTENSION: calendar
-PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
-MAINTENANCE: Odd Fixes
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: com
-PRIMARY MAINTAINER: Harald Radi <h.radi@nme.at>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: cpdf
-PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: crack
-MAINTENANCE: Unknown
-STATUS: Experimental
-SINCE: 4.0.5
--------------------------------------------------------------------------------
-EXTENSION: ctype
-PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: curl
-PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
-SINCE: 4.0.2
--------------------------------------------------------------------------------
-EXTENSION: cybercash
-PRIMARY MAINTAINER: Evan Klinger <evan715@sirius.com>
-MAINTENANCE: Maintained
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: domxml
-PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
-MAINTENANCE: Maintained
-STATUS: Experimental
--------------------------------------------------------------------------------
-EXTENSION: dotnet
-PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
-MAINTENANCE: Maintained
-STATUS: Experimental
--------------------------------------------------------------------------------
-EXTENSION: exif
-PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
-SINCE: 4.2
--------------------------------------------------------------------------------
-EXTENSION: fdf
-PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
-MAINTENANCE: Maintained
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: ftp
-PRIMARY MAINTAINER: Stefan Esser (sesser@php.net)
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: gd
-PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: gettext
-MAINTENANCE: Unknown
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: gmp
-MAINTENANCE: Unknown
-STATUS: Unknown
-SINCE: 4.0.4
--------------------------------------------------------------------------------
-EXTENSION: icap
-MAINTENANCE: Unknown
-STATUS: Obsolete
--------------------------------------------------------------------------------
-EXTENSION: iconv
-PRIMARY MAINTAINER: Moriyoshi Koizumi <moriyoshi@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: imap
-PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
-MAINTENANCE: Odd Fixes
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: java
-PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: ldap
-PRIMARY MAINTAINER: Stig Venaas <venaas@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: mbstring
-PRIMARY MAINTAINER: Rui Hirokawa <hirokawa@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: mcal
-PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
-MAINTENANCE: Odd Fixes
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: mcrypt
-PRIMARY MAINTAINER: Derick Rethans <d.rethans@jdimedia.nl>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: mhash
-PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: muscat
-PRIMARY MAINTAINER: Sam Liddicott <sam@ananova.com>
-MAINTENANCE: Maintained
-STATUS: Working
-SINCE: 4.0.5
-COMMENT: Not tested against windows, only core API completed, rest under development
--------------------------------------------------------------------------------
-EXTENSION: openssl
-PRIMARY MAINTAINER: Wez Furlong <wez@php.net>
-MAINTENANCE: Maintained
-STATUS: Experimental
-SINCE: 4.0.4
--------------------------------------------------------------------------------
-EXTENSION: overload
-PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
-MAINTENANCE: Maintained
-STATUS: Experimental
--------------------------------------------------------------------------------
-EXTENSION: pcre
-PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: pdf
-PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: pfpro
-PRIMARY MAINTAINER: David Croft <david@infotrek.co.uk>
-MAINTENANCE: Maintained
-STATUS: Working
-SINCE: 4.0.2
--------------------------------------------------------------------------------
-EXTENSION: posix
-PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: printer
-PRIMARY MAINTAINER: Daniel Beulshausen <daniel@php4win.de>
-MAINTENANCE: Maintained
-STATUS: Working
-SINCE: 4.0.4
-COMMENT: Only for Win32
--------------------------------------------------------------------------------
-EXTENSION: pspell
-PRIMARY MAINTAINER: Vlad Krupin <phpdevel@echospace.com>
-MAINTENANCE: Unknown
-STATUS: Unknown
-SINCE: 4.0.2
--------------------------------------------------------------------------------
-EXTENSION: qtdom
-MAINTENANCE: Unknown
-STATUS: Experimental
-SINCE: 4.0.4
--------------------------------------------------------------------------------
-EXTENSION: readline
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: recode
-PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: sablot
-PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
-MAINTENANCE: Obsolete
-STATUS: Experimental
-SINCE: 4.0.3
--------------------------------------------------------------------------------
-EXTENSION: satellite
-PRIMARY MAINTAINER: David Eriksson <eriksson@php.net>
-MAINTENANCE: Odd Fixes
-STATUS: Experimental
-SINCE: 4.0.3
--------------------------------------------------------------------------------
-EXTENSION: session
-PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: shmop
-PRIMARY MAINTAINER: Ilia Alshanetsky <iliaa@php.net>
-MAINTENANCE: Maintained
-STATUS: Experimental
-SINCE: 4.0.3
--------------------------------------------------------------------------------
-EXTENSION: snmp
-PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
-MAINTENANCE: Odd Fixes
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: sockets
-PRIMARY MAINTAINER: Chris Vandomelen <chrisv@b0rked.dhs.org>
-MAINTENANCE: Maintained
-STATUS: Experimental
-SINCE: 4.0.2
--------------------------------------------------------------------------------
-EXTENSION: swf
-PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
-MAINTENANCE: Orphaned
-STATUS: Deprecated (Use the ming swf extension instead)
-COMMENT: Only for Unix (won't change)
--------------------------------------------------------------------------------
-EXTENSION: sysvsem
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: sysvshm
-MAINTENANCE: Unknown
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: vpopmail
-MAINTENANCE: Unknown
-STATUS: Experimental
-SINCE: 4.0.5
--------------------------------------------------------------------------------
-EXTENSION: wddx
-PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: xml
-PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: xslt
-PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
-MAINTENANCE: Odd Fixes
-STATUS: Working (mostly)
--------------------------------------------------------------------------------
-EXTENSION: yaz
-PRIMARY MAINTAINER: Adam Dickmeiss <adam@indexdata.dk>
-MAINTENANCE: Maintained
-STATUS: Unknown
-SINCE: 4.0.1
--------------------------------------------------------------------------------
-EXTENSION: yp
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: zlib
-PRIMARY MAINTAINER: Stefan Roehrich <sr@linux.de>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: zziplib
-PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
-MAINTENANCE: Odd Fixes
-STATUS: Working
-SINCE: 4.0.5
--------------------------------------------------------------------------------
-# iptc?
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 28ee3f0b06..0000000000
--- a/INSTALL
+++ /dev/null
@@ -1,422 +0,0 @@
-Installation Instructions for PHP 4
------------------------------------
-
-STOP!
-
-Before going any further, please remember you are going to find more
-up to date instructions in the online manual, located here:
-
-http://www.php.net/manual/en/install.apache.php
-
-For Apache 2, instructions and up-to-date information regarding it's
-support status, is available here:
-
-http://www.php.net/manual/en/install.apache2.php
-
-It is strongly recommended that you read the manual page before going
-further. However, for the impatient, here is a quick set of steps that
-will build PHP as (first) a dynamic Apache module (DSO) for Apache 1.3.x
-with MySQL support and then a static module. A more verbose explanation follows.
-
-For installing PHP on other web servers, refer to one of the following
-files:
-
- sapi/aolserver/README
- sapi/pi3web/README
- sapi/servlet/README
- sapi/thttpd/README
- README.Zeus
-
-Some notes:
-
-1: Only install either the static module or the dynamic one. Do not
- install both.
-
-2: If you are recompiling PHP to add new extensions or upgrading
- something like GD, remove the config.cache file before you re-run
- configure.
-
-3: If you are on Linux and have installed shared libraries, make
- sure the location of these shared libraries are listed in your
- /etc/ld.so.conf file. For example, if you have:
-
- /usr/local/lib/mysql/libmysqlclient.so
-
- Make sure /etc/ld.so.conf contains:
-
- /usr/local/lib/mysql
-
- Then run ldconfig.
-
-If you want both PHP 3 and 4 modules in the same Apache server, check the
-bottom of this file for instructions.
-
-INSTALLATION WITH THE ZEUS WEB SERVER:
---Please see the 'README.Zeus' file included in this distribution
-
-
-QUICK INSTALL (DSO)
-
-For this to work your Apache httpd must have mod_so enabled.
-Check using httpd -l. You should see something like:
-
-Compiled-in modules:
- http_core.c
- mod_so.c
-
-Chances are you will see a lot more modules than these two. That's ok,
-as long as mod_so.c shows up you can proceed with the following steps:
-
-$ gunzip -c php-4.x.y.tar.gz | tar xf -
-$ cd php-4.x.y
-$ ./configure --with-mysql --with-apxs
-$ make
-$ make install
-
-If you get an error telling you that the apxs script could not be found,
-look for it on your system and if you find it, provide the full path to it
-as: --with-apxs=/path/to/apxs
-
-Make sure you specify the version of apxs that is actually installed on
-your system and NOT the one that is in the apache source tarball.
-
-Next you must copy php.ini-dist to the appropriate place (normally
-/usr/local/lib/php.ini) and edit it as necessary to set PHP options.
-
-The only thing left to do is to edit your httpd.conf file and make sure the
-PHP 4 mime type is there and uncommented. You need a line that looks like
-this:
-
- AddType application/x-httpd-php .php
-
-Then restart your server (apachectl restart) and you should be able to
-serve up PHP files now. Make a test file called test.php and put some
-PHP tags in it. Like <?phpinfo()?>, for example.
-
-
-QUICK INSTALL (Static)
-
-$ gunzip -c apache_1.3.x.tar.gz | tar xf -
-$ cd apache_1.3.x
-$ ./configure
-$ cd ..
-
-$ gunzip -c php-4.x.y.tar.gz | tar xf -
-$ cd php-4.x.y
-$ ./configure --with-mysql --with-apache=../apache_1.3.x
-$ make
-$ make install
-
-$ cd ../apache_1.3.x
-$ ./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a
- (The above line is correct! Yes, we know libphp4.a does not exist at this
- stage. It isn't supposed to. It will be created.)
-$ make
- (you should now have an httpd binary which you can copy to your Apache bin dir if
- is is your first install then you need to "make install" as well)
-$ cd ../php-4.x.y
-$ cp php.ini-dist /usr/local/lib/php.ini
-You can edit /usr/local/lib/php.ini file to set PHP options.
-Edit your httpd.conf or srm.conf file and add:
- AddType application/x-httpd-php .php
-
-
-VERBOSE INSTALL
-
-Chances are you are reading this because the quick install steps above
-did not work for you. If this is the case, congratulations, you are
-among the elite few that actually reads documentation. It really is
-not a difficult install and once you have done it once you will fly
-through it.
-
-Installing PHP can be done in four simple steps:
-
-1. Unpack your distribution file.
-
- You will have downloaded a file named something like php-4.x.y.tar.gz.
- Unzip this file with a command like: gunzip php-4.x.y.tar.gz
-
- Next you have to untar it with: tar -xvf php-4.x.y.tar
-
- This will create a php-4.x.y directory. cd into this new directory.
-
-2a. Configure PHP (Dynamic Module) - Skip to 2b if you wish to build
- a static module
-
- You now have to choose the options you would like. There are quite
- a few of them. To see a list, type: ./configure --help
-
- The only options that you are likely to want to use are the ones in
- the last section entitled, "--enable and --with options recognized:"
-
- A popular choice is to build the Apache module version. In order to
- build PHP as a dynamic module for Apache-1.3.x you have to first have
- Apache installed. Assuming Apache is already installed, make sure
- the shared object module is enabled. To check this, type: httpd -l
- You should see something like:
-
- Compiled-in modules:
- http_core.c
- mod_so.c
-
- You will most likely have a lot more modules than what is shown here.
- As long as mod_so.c shows up in the list, PHP should be happy.
-
- Now, type: ./configure --with-mysql --with-apxs
-
- If you get an error telling you that the apxs script could not be found,
- look for it on your system and if you find it, provide the full path to it
- as: --with-apxs=/path/to/apxs
-
- Make sure you specify the version of apxs that is actually installed on
- your system and NOT the one that is in the apache source tarball.
-
- You might also want other flags on this configure line. --with-mysql
- is just an example.
-
- There are a few things that can go wrong during this configure step.
- The most common is that you have asked for an option and that the
- configure script can not find the files required to enable this
- option in PHP. Chances are you can provide the full path to the
- base directory under which the related files were installed. For
- example, if you have installed the GD library in /opt/gd which means
- that /opt/gd/include has your GD header files and /opt/gd/lib contains
- your GD library files, you would use --with-gd=/opt/gd
-
- Skip to step 3 for compilation and installation instructions.
-
-2b. Configure PHP (Static Module) - Skip if you performed 2a
-
- You now have to choose the options you would like. There are quite
- a few of them. To see a list, type: ./configure --help
-
- The only options that you are likely to want to use are the ones in
- the last section entitled, "--enable and --with options recognized:"
-
- A popular choice is to build the Apache module version. You need
- to know where the source code directory for your Apache server is
- located. Then use an option like: --with-apache=/usr/local/src/apache
- if that is your Apache source code directory. If you only specify
- --with-apache, then it will default to look for your Apache source
- in /usr/local/etc/httpd.
-
- NOTE: The directory you specify should be the top-level of the
- unpacked Apache (or Stronghold) distribution. The configure program
- will automatically look for httpd.h in different directories under that
- location depending on which version of Apache, including Stronghold,
- you are running.
-
- For MySQL support, since newer versions of MySQL installs its various
- components under /usr/local, this is the default. If you have
- changed the location you can specify it with: --with-mysql=/opt/local
- for example. Otherwise just use: --with-mysql
-
- *NOTE* If you are using Apache 1.3b6 or later, you should run the
- Apache Configure script at least once before compiling PHP. It
- doesn't matter how you have Apache configured at this point.
-
- Skip to step 3b at this point.
-
-3. Compile and install the files. Simply type: make install
-
-3a. Dynamic Module Installation
-
- Nothing else is needed here. Proceed to step 4a.
-
-3b. Static Module Installation
-
- For the Apache module version this will copy the appropriate files
- to the src/modules/php4 directory in your Apache distribution if
- you are using Apache 1.3.x. If you are still running Apache 1.2.x
- these files will be copied directly to the main src directory.
-
- For Apache 1.3b6 and later, you can use the new APACI configuration
- mechanism. To automatically build Apache with PHP support, use:
-
- cd apache_1.3.x
- ./configure --prefix=/<path>/apache \
- --activate-module=src/modules/php4/libphp4.a
- make
- make install
-
- If you do not wish to use this new configuration tool, the old
- install procedure (src/Configure) will work fine.
-
- If you are using the old Apache ./Configure script, you will have to
- edit the Apache src/Configuration file manually. If you do not have
- this file, copy Configuration.tmpl to Configuration.
-
- For Apache 1.3.x add:
-
- AddModule modules/php4/libphp4.a
-
- For Apache 1.3.x don't do anything else. Just add this line and then
- run "./Configure" followed by "make".
-
- For Apache 1.2.x add:
-
- Module php4_module mod_php4.o
-
- For Apache 1.2.x you will also have to look in the libphp4.module file,
- which was copied to the src directory. The EXTRA_LIBS line in the Apache
- Configuration file needs to be set to use the same libs as specified on
- the LIBS line in libphp4.module. You also need to make sure to add
- "-L." to the beginning of the EXTRA_LIBS line.
-
- So, as an example, your EXTRA_LIBS line might look like:
-
- EXTRA_LIBS=-L. -lphp4 -lgdbm -ldb -L/usr/local/mysql/lib -lmysqlclient
-
- NOTE: You should not enclose the EXTRA_LIBS line in double-quotes, as it
- is in the libphp4.module file.
-
- Also, look at the RULE_WANTHSREGEX setting in the libphp4.module file
- and set the WANTHSREGEX directive accordingly in your Configuration file.
- This last step applies to versions of Apache prior to 1.3b3.
-
- This is a bit of a hassle, but should serve as incentive to move to
- Apache 1.3.x where this step has been eliminated.
-
- Once you are satisfied with your Configuration settings, type: ./Configure
- If you get errors, chances are that you forgot a library or made a typo
- somewhere. Re-edit Configuration and try again. If it goes well,
- type: make
-
- Assuming it compiles without errors, proceed to step 4b.
-
-4a. Setting up the server. (Dynamic Module)
-
- The make install command in step 3 should have done most of your
- work for you. It actually edits your httpd.conf file and tries to
- enable the dynamic PHP module. To verify this, look for a line that
- looks like this:
-
- LoadModule php4_module libexec/libphp4.so
-
- The actual path before the libphp4.so part might differ slightly. This
- is likely fine. If you are paranoid you can examine the output from the
- make install step to see where the libphp4.so file was actually put and
- place the full path to this file on this LoadModule line.
-
- If somewhere in your httpd.conf file you have a ClearModuleList line
- then you also need this line:
-
- AddModule mod_php4.c
-
- And finally you need to tell Apache which file extension should trigger
- PHP. You do this by creating a special mime type and associating it
- with an extension. We suggest using:
-
- AddType application/x-httpd-php .php
-
- You are however free to use any extension you wish, including .html.
-
- Note! If a line has a # at the beginning, then it is commented out
- and you need to remove the # for that line to take effect.
-
- Finally you need to copy php.ini-dist to the appropriate place
- (normally /usr/local/lib/php.ini) and edit if necessary.
-
- Once you have made these changes you should be ready to restart your
- server and try it out. Type: apachectl restart
-
-4b. Setting up the server. (Static Module)
-
- You should now have a new httpd binary. Shut down your existing server,
- if you have one, and copy this new binary overtop of it. Perhaps make
- a backup of your previous one first. Then edit your conf/httpd.conf file
- and add the line:
-
- AddType application/x-httpd-php .php
-
- There is also an interesting feature which can be quite instructive and
- helpful while debugging. That is the option of having colour syntax
- highlighting. To enable this, add the following line:
-
- AddType application/x-httpd-php-source .phps
-
- Any file ending in .phps will now be displayed with full colour syntax
- highlighting instead of being executed.
-
- Note that on some older server setups, the AddType lines are in the
- conf/srm.conf file instead of conf/httpd.conf.
-
- Note! If a line has a # at the beginning, then it is commented out
- and you need to remove the # for that line to take effect.
-
- When you are finished making changes to your httpd.conf file, you need
- to copy php.ini-dist to the appropriate place (normally
- /usr/local/lib/php.ini) and edit if necessary. You can then
- start up your server.
-
-5. Testing it all worked
-
- Create a test file named test.php in your web tree somewhere and
- put some test PHP tags in it. <?phpinfo()?> is a good first test.
- This tag tells PHP to do a braindump and tells you all sorts of things
- about itself.
-
-
-WHY DISABLING -fPIC WORKS ON LINUX
-
- From: Martin v. Loewis <martin@loewis.home.cs.tu-berlin.de>
- To: glibc-linux@ricardo.ecn.wfu.edu
- Subject: Re: Shared library -shared vs. -fpic
-
- [In reply to Kaz Kylheku <kaz@ashi.footprints.net>]
-
- > PIC stands for Position-Independent Code.
-
- Correct.
-
- > Code isn't position-independent (or ``relocatable'') cannot be
- > loaded at an arbitrary address;
-
- Wrong.
-
- > it requires some references to be patched at load time.
-
- Correct.
-
- > Shared libraries need to be relocatable because it's not known
- > beforehand what address they will be loaded at
-
- Correct, depending on the meaning of "relocatable". PIC code typically
- does not contain relocations; that's why its position-independent.
-
- > Just because you don't specify -fPIC doesn't mean that the compiler
- > won't emit position-independent code; the option prevents it from
- > emitting position-dependent code in situations where it otherwise
- > would.
-
- Correct. However, a non-trivial shared library typically won't be
- position-independent unless explicitly compiled with
- -fPIC. Linux/glibc indeed does not require a shared library to be
- position-independent; instead, it will perform the relocations in the
- binary, even if they refer to code pages. As a result, those relocated
- pages won't be shared across processes, anymore.
-
- Regards,
- Martin
-
-USING PHP 3 AND PHP 4 AS CONCURRENT APACHE MODULES
-
- With some (newer) installations of Apache, it's possible to compile both
- PHP 3 and PHP 4, and run them concurrently.
-
- Note, it's only really wise to do this if you need to use the PHP 3 engine
- to maintain backwards compatibility.
-
- To enable it, configure PHP 3 and PHP 4 to use APXS (--with-apxs) and the
- necessary link extensions (--enable-versioning). Otherwise, all standard
- installations instructions apply. For example:
-
- $ ./configure \
- --with-apxs=/apache/bin/apxs \
- --enable-versioning \
- --with-mysql \
-
-
-
-
-
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index d4335c298c..0000000000
--- a/LICENSE
+++ /dev/null
@@ -1,68 +0,0 @@
---------------------------------------------------------------------
- The PHP License, Version 3.0
-Copyright (c) 1999 - 2003 The PHP Group. All rights reserved.
---------------------------------------------------------------------
-
-Redistribution and use in source and binary forms, with or without
-modification, is permitted provided that the following conditions
-are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- 3. The name "PHP" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact group@php.net.
-
- 4. Products derived from this software may not be called "PHP", nor
- may "PHP" appear in their name, without prior written permission
- from group@php.net. You may indicate that your software works in
- conjunction with PHP by saying "Foo for PHP" instead of calling
- it "PHP Foo" or "phpfoo"
-
- 5. The PHP Group may publish revised and/or new versions of the
- license from time to time. Each version will be given a
- distinguishing version number.
- Once covered code has been published under a particular version
- of the license, you may always continue to use it under the terms
- of that version. You may also choose to use such covered code
- under the terms of any subsequent version of the license
- published by the PHP Group. No one other than the PHP Group has
- the right to modify the terms applicable to covered code created
- under this License.
-
- 6. Redistributions of any form whatsoever must retain the following
- acknowledgment:
- "This product includes PHP, freely available from
- <http://www.php.net/>".
-
-THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
-ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
-DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------
-
-This software consists of voluntary contributions made by many
-individuals on behalf of the PHP Group.
-
-The PHP Group can be contacted via Email at group@php.net.
-
-For more information on the PHP Group and the PHP project,
-please see <http://www.php.net>.
-
-This product includes the Zend Engine, freely available at
-<http://www.zend.com>.
diff --git a/Makefile.frag b/Makefile.frag
deleted file mode 100644
index 2a4aa1c7f8..0000000000
--- a/Makefile.frag
+++ /dev/null
@@ -1,23 +0,0 @@
-
-#
-# Zend
-#
-
-$(builddir)/zend_language_scanner.lo: $(builddir)/zend_language_parser.h
-$(builddir)/zend_ini_scanner.lo: $(builddir)/zend_ini_parser.h
-
-$(builddir)/zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
- $(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
-
-$(builddir)/zend_language_parser.h: $(builddir)/zend_language_parser.c
-$(builddir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
- $(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o $@
-
-$(builddir)/zend_ini_parser.h: $(builddir)/zend_ini_parser.c
-$(builddir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
- $(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@
-
-$(builddir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
- $(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
-
-$(builddir)/zend_indent.lo $(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(builddir)/zend_language_parser.h
diff --git a/Makefile.global b/Makefile.global
deleted file mode 100644
index 607deaece8..0000000000
--- a/Makefile.global
+++ /dev/null
@@ -1,68 +0,0 @@
-mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
-INSTALL = $(top_srcdir)/build/shtool install -c
-INSTALL_DATA = $(INSTALL) -m 644
-
-DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir)
-COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH)
-
-
-all: $(all_targets)
-
-build-modules: $(PHP_MODULES)
-
-libphp5.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
- $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
-
-libs/libphp5.bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
- $(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp5.so
-
-install: $(install_targets)
-
-install-sapi: libphp5.la
- @echo "Installing PHP SAPI module"
- -@$(LIBTOOL) --silent --mode=install cp libphp5.la $(phptempdir)/libphp5.la >/dev/null 2>&1
- -@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
- -@if test ! -r $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME); then \
- for i in 0.0.0 0.0 0; do \
- if test -r $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME).$$i; then \
- $(LN_S) $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME).$$i $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME); \
- break; \
- fi; \
- done; \
- fi
- @$(INSTALL_IT)
-
-install-modules: build-modules
- @test -d modules && \
- $(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR) && \
- echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/" && \
- rm -f modules/*.la && \
- $(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR) >/dev/null 2>&1 || true
-
-install-tester:
- @echo "Installing regression tester: $(INSTALL_ROOT)$(PEAR_INSTALLDIR)/"
- @$(mkinstalldirs) $(INSTALL_ROOT)$(PEAR_INSTALLDIR)
- @$(INSTALL) -m 755 $(top_srcdir)/run-tests.php $(INSTALL_ROOT)$(PEAR_INSTALLDIR)
-
-install-su: install-pear install-tester
-
-test: $(SAPI_CLI_PATH)
- @TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
- TEST_PHP_SRCDIR=$(top_srcdir) \
- CC="$(CC)" \
- $(top_builddir)/$(SAPI_CLI_PATH) -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' $(top_srcdir)/run-tests.php $(TESTS)
-
-clean:
- find . -name \*.lo -o -name \*.o | xargs rm -f
- find . -name \*.la -o -name \*.a | xargs rm -f
- find . -name \*.so | xargs rm -f
- find . -name .libs -a -type d|xargs rm -rf
- rm -f libphp5.la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
-
-distclean: clean
- rm -f config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h php5.spec sapi/apache/libphp5.module buildmk.stamp
- egrep define'.*include/php' configure|sed 's/.*>//'|xargs rm -f
- find . -name Makefile | xargs rm -f
-
-.PHONY: all clean install distclean test
-.NOEXPORT:
diff --git a/NEWS b/NEWS
deleted file mode 100644
index 0bb3527dde..0000000000
--- a/NEWS
+++ /dev/null
@@ -1,2544 +0,0 @@
-PHP NEWS
-|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-? ? ??? 200?, Version 5.0.0
-- Moved extensions to PECL (http://pear.php.net/): (James, Tal)
- . ext/fribidi
-- Fixed dirname() and strip_tags() to be binary-safe. (Moriyoshi)
-- Fixed bug #22386 (Using browscap causes segfault). (Jay)
-- Fixed bug #22895 (PHP cli outputs errors in text AND html). (Marcus)
-- Fixed bug #22059 (ftp_chdir causes segfault). (Sara)
-- Fixed bug #21985 and #22064 (various mb_send_mail() issues). (Moriyoshi)
-- Fixed bug #21600 (Assign by reference function call changes variable contents).
- (Zeev)
-- Fixed bug #21007 (html_errors off text-only output in phpinfo). (Marcus)
-- Fixed bug #20442 (upgraded bundled expat to 1.95.5). (Ilia)
-- Fixed bug #20155 (xmlrpc compile problem with ZE2). (Derick, Jan Schneider)
-- Changed the length parameter in fgetss() to be optional. (Moriyoshi)
-- Changed ini parser to allow for handling of quoted multi-line values. (Ilia)
-- Changed get_extension_funcs() to return list of the built-in Zend Engine
- functions if "zend" is specified as the module name. (Ilia)
-- Changed is_executable() to be available also on Windows. (Shane)
-- Changed array_search() to accept also objects as a needle. (Moriyoshi)
-- Changed ext/mcrypt to require libmcrypt version 2.5.6 or greater. (Derick)
-- Changed uniqid() parameters to be optional and allow any prefix length. (Marcus)
-- Added encoding detection feature for expat XML parser. (Adam Dickmeiss, Moriyoshi)
-- Added missing multibyte(unicode) support and numeric entity support to
- html_entity_decode(). (Moriyoshi)
-- Added opendir() and stat() related support to ftp:// wrapper. (Sara)
-- Added IPv6 support to ext/sockets. (Sara)
-- Added context options to http_fopen_wrapper 'method', 'header', 'content'. (Sara)
-- Added domdocument->create_document_fragment() and documentfragment->open_mem()
- methods to domxml. (Rob Richards, Chregu)
-- Added domelement->set_attribute_node() method (bug #17638). (Rob Richards)
-- Added optional parameter to get_browser() to make it return an array. (Jay)
-- Added optional parameter to openssl_sign() to specify the hashing algorithm.
- (scott@planetscott.ca, Derick)
-- Added file_put_contents() function. (Sterling)
-- Added "mail_force_extra_paramaters" php.ini option which forces the addition
- of the specified parameters to be passed as extra parameters to the sendmail
- binary. These parameters will always replace the value of the 5th parameter
- to mail(), even in safe mode. (Derick)
-- Added new "transport" layer for sockets and associated functions. (Wez)
- . stream_socket_client() - similar to fsockopen(), but more powerful.
- . stream_socket_server() - Creates a server socket.
- . stream_socket_accept() - Accept a client connection.
- . stream_socket_get_name() - Get local or remote name of socket.
- . generic crypto interface for streams (supports dynamic loading of OpenSSL)
-- Added stream_copy_to_stream() function. (Wez)
-- Added memory mapping support under win32 to improve performance of
- readfile(), fpassthru() and some internal streams operations. (Wez)
-- Added DBA handler 'inifile' to support ini files. (Marcus)
-- Added input filter support. See README.input_filter. (Rasmus)
-- Added "session.hash_function" and "session.hash_bits_per_character". (Sascha)
-- Added lightweight streaming input abstraction to the Zend Engine scanners
- that provides uniform support for include()'ing data from PHP streams across
- all platforms (Wez, Zend Engine).
-- Added optional parameter to sha1(), sha1_file(), md5() and md5_file() which
- makes them return the digest as binary data. (Michael Bretterklieber, Derick)
-- Added proc_nice() function. Changes priority of the current process. (Ilia)
-- Added pcntl_getpriority() and pcntl_setpriority() functions. (Ilia)
-- Added idate(), date_sunrise() and date_sunset() functions. (Moshe Doron)
-- Added long options into CLI & CGI (e.g. --version). (Marcus)
-- Added strpbrk() function. Searches a string for a list of characters. (Ilia)
-- Added stream_get_line() function. Reads either the specified number of bytes
- or until the ending string is found. (Ilia)
-- Added optional parameter to mkdir() to make directory creation recursive. (Ilia)
-- Added optional parameter to file() which makes the result array not contain
- the line endings and to skip empty lines. (Ilia)
-- Added get_headers() function. Returns headers sent by the server of
- the specified URL. (Ilia)
-- Added str_split() function. Breaks down a string into an array of elements
- based on length. (Ilia)
-- Added array_walk_recursive() function. (Ilia)
-- Added new command line parameters -B, -F, -R and -E which allow to process stdin
- line by line (See 'php -h' or 'man php' for more). (Marcus)
-- Added string.base64 stream filter. (Moriyoshi)
-- Added domxml_node_get_path(). (Lukas Schröder)
-- Added iconv related functions. (Moriyoshi)
- . iconv_strlen()
- . iconv_substr()
- . iconv_strpos()
- . iconv_strrpos()
- . iconv_mime_decode()
- . iconv_mime_encode()
-- Added new range() functionality. (Ilia)
- . Support for float modifier.
- . Detection of numeric values inside strings passed as high & low.
- . Proper handle the situations where high == low.
-- Added imagefilter() function. Allows application of various filters.
- Only available with bundled GD. (Pierre-Alain Joye, Ilia)
-- Added antialiased drawing support to bundled GD. (Pierre-Alain Joye, Ilia)
- . imageantialias($im, $flag) to (de)active antialias
- . imageline antialias support
- . imagepolygon antialias support
-
-17 Feb 2003, Version 4.3.1
-- Fixed serious security vulnerability in CGI SAPI. (Shane)
-
-27 Dec 2002, Version 4.3.0
-- Added sha1() and sha1_file() for US Secure Hash Algorithm 1. (Stefan Esser)
-- Make PHP_AUTH_* variables not available in safe mode under Apache when an
- external basic auth mechanism is used. (Philip)
-- Aliased dba_popen() to dba_open() until 4.3.2 when persistent STDIO streams
- are introduced. (Andrei)
-- Fixed a security bug in the bundled MySQL library. (Georg, Stefan)
-- If you don't specify building any other SAPI "make install" will install the
- CGI SAPI binary in {PREFIX}/bin/php. If you want to install CLI SAPI in that
- location use "make install-cli" after "make install" or add --disable-cgi
- to your configure options. In the Windows distribution CLI SAPI is included
- in the "cli" folder. (Edin)
-- Removed extensions: (Jan, Jani, Sebastian)
- . ext/aspell
- . ext/ccvs
- . ext/icap
- . sapi/fastcgi
- . sapi/fhttpd
-- Moved extensions to PECL (http://pear.php.net/): (James, Derick, George)
- . ext/vpopmail
- . ext/cybermut
- . ext/cybercash
-- ZLIB extension is now built-in in the Windows distribution.
- External extension (php_zlib.dll) has been removed. (Edin)
-- Fixed a crash when using invalid color index with imagecolortransparent().
- (Pierre-Alain Joye)
-- Fixed bug #20987 (no handling for client certificates). (Ilia)
-- Fixed bug #21039 (crash when not supplying an IV to mcrypt_generic_init).
- (Derick)
-- Fixed bug #20936 (openssl_pkey_get was broken). (jeroen@derks.it, Wez)
-- Fixed bug #20927 (wordwrap crash). (Ilia)
-- Fixed bug #20796 (when register_globals is on & arrays with same names are
- passed via get/post/cookie the data inside $_GET/$_POST/$_COOKIE can would be
- corrupted). (Ilia)
-- Fixed bug #20725 (if the upload directory cannot be written to, the POST data
- after the uploaded file is lost). (Ilia)
-- Fixed bug #20865 (array_key_exists() fails to find NULL key). (Ilia)
-- Fixed bug #20812 (ftp_get returned NULL on success, instead of TRUE). (Ilia)
-- Fixed bug #20785 (crash when using pdf_open_memory_image() to load a
- true-color image). (Ilia)
-- Fixed a crash when converting between true-color images (png/jpeg) and
- gd1/gd2 image formats, png/jpeg -> gd1/gd2 -> png/jpeg conversion now
- works correctly. (Ilia, Pierre-Alain Joye)
-- Fixed a memory leak in the bundled GD library inside
- gdImageTrueColorToPalette(). (Ilia)
-- Fixed bug #12776 (array_walk crash). (Moriyoshi)
-- Fixed bug #20934 (htmlspecialchars returns latin1 from UTF-8). (Moriyoshi)
-- Fixed bugs #20270, #15702, #18600 (segfaults in ext/java). (Tony J. White)
-- Made bcmath extension thread safe. (Sander)
-- Fixed bug #19566 (get_declared_classes() segfaults). (Moriyoshi, Marcus, Andi)
-- Fixed bug #20381 (array_merge_recursive mangles input arrays). (Moriyoshi)
-- Added -n command switch to cli and cgi version which allows to skip php.ini
- parsing at startup. (Marcus, Wez)
-- Fixed bug #19689 (absolute paths like /test/dir/ not working correctly).
- (Ilia)
-- Added "neutral" language entry to mbstring spec. (Moriyoshi)
-- Changed bundled gd library to consider php.ini option memory_limit. (Marcus)
-- Modified log() to accept multiple bases. (Jason)
-- Fixed bugs #16190/18746 (ext/db: flatfile support with windows). (Marcus)
-- Added gd_info() which returns an array of gd support information. (Marcus)
-- Implemented features/changes requested in Bug #16960 (Timm):
- . Added a new function sybase_unbuffered_query()
- . Added a new function sybase_fetch_assoc()
- . Added sybase_set_message_handler() which enables users to handle
- server messages in a callback function
- . Added an ini entry for deadlock retries - retrying deadlocks can cause
- transaction state to break (sybct.deadlock_retry_count,
- defaults to -1 "forever").
- . Fixed sybase_fetch_object() not to return objects with numeric members
- . Fixed issues with identical fieldnames
- . Made sybase_fetch_*() functions return correct datatypes
- . Made phpinfo() section more verbose
- . Made sybase_query() error messages more verbose
-- Fixed bug #19935 (made OpenSSL file system operations abide by safe_mode
- & open_basedir restrictions). (Ilia)
-- Fixed bug #18868 (improved the check for availability of realpath()). (Ilia)
-- Fixed width/height detection of bmp images using getimagesize() function on
- big endian systems and added code to retrieve bmp bit depth. (Ilia)
-- Fixed bug #20035 (line counting error when script starts with #! in
- cgi/cli/fastcgi sapis). (Ilia)
-- Fixed bug #20235 (incorrect handling of symlinks on ZTS build). (Ilia)
-- Added sanity checks to headers_sent() & image_type_to_mime_type(). (Ilia)
-- Added an aditional parameter to the jdtojewish() function which makes
- the function return the symbolic hebrew name. (Moshe Doron, Derick)
-- Fixed bug #20169 (implode() clobbers first argument). (Moriyoshi)
-- Improved dba extension (Marcus)
- . Added dba_handlers() that returns an array of installed handlers and
- dba_list() that returns an associative array of open database files.
- . Added bundled cdb support wich can be activated by --with-cdb without a
- path. The bundled version supports cdb_make that allows writing cdb files.
- . Added optional skip parameter to dba_fetch() to support multiple key-value
- pairs with the same key for cdb handler.
- . Added locking for those handlers that do not have their own locking.
- . Added support for magic_quotes_runtime php.ini option.
- . Added flatfile support what finally makes ext/db deprecated.
-- Added imagerotate() which is available only when bundled libgd is used.
- (Pierre-Alain Joye, Ilia)
-- Fixed bug #17497 (mssql extension crashes if magic_quotes_runtime is on).
- (Sterling)
-- Remove $_FILES from $_REQUEST (import_request_variables is not modified),
- this didn't work properly in the first place, and added confusion. (Sterling)
-- Fix the socket_read() function on win32 to work in normal mode (reading to
- the end of a line), as well as binary mode. (Sterling)
-- Fixed bug #20110 (added sanity check to prevent include/require functions
- from trying to include directories). (Ilia)
-- Fixed bug #20108 (segmentation fault on printf("%1.1s", "string")). (Ilia)
-- Added dbx_escape_string() function to dbx module. (Marc)
-- Added Oracle (oci8) support to dbx module. (Marc)
-- Updated FDF extension to work with Adode fdftk 5.0. (Hartmut)
-- Added mb_strtolower() and mb_strtoupper(). (Moriyoshi)
-- Fixed an infinite loop in setlocale() when only invalid locale names
- were passed in the array. (patch by Pal Loberg, pallo@initio.no)
-- Fixed bugs #19156 and #19544 (COM extension leaks memory and keeps
- components referenced). (Harald)
-- Added fribidi_get_charsets() and fribidi_charset_info() functions. (Tal)
-- Added Oracle TIMESTAMP type to oci8 extension. (Thies)
-- Fixed fgets($fp) to read until EOL when length parameter is not set. (Wez)
-- Changed registry entries under "HKLM\SOFTWARE\PHP\Per Directory Values" to
- work also with administrative directives such as safe_mode, open_basedir,
- etc. (Claudio Felber)
-- Added str_word_count() function which counts words inside a string. (Ilia)
-- Added PGSQL_CONNECT_FORCE_NEW option to pg_connect() (Yasuo)
-- Added ICONV_IMPL and ICONV_VERSION constants to iconv extension to
- indicate which iconv implementation is used. (Moriyoshi)
-- Fixed bug #4232 (Added %e & %E support to printf/sprintf). (Ilia)
-- Fixed bug #17580 (Allow ini parser to parse files >16K). (Ilia)
-- Fixed bug #19649 (Sanity checks for browscap.ini parser). (Ilia)
-- Added experimental patch to address problem with floats on various locales.
- (Bug #17079). (Ilia)
-- Fixed bug #19280 (imap_header fails with many To: addresses). (Ilia)
-- Added mb_regex_set_options(). The Options parameters of various mbregex
- functions are now deprecated. (Moriyoshi)
-- Fixed bug #19482 (Segfault with PCRE and locale). (Andrei)
-- Made ImageTruecolorToPalette() in bundled GD2 library actually work. (Rasmus)
-- Fixed ImageCopy() in bundled GD2 library to handle copying from truecolor to
- palette-based. (Wez, Rasmus)
-- Added read-only GIF support for bundled GD2 library. (Rasmus)
-- Made several adjustments to xslt extension (David Viner, Lehnar, Melvyn)
- . Added xslt_set_object and xslt_setopt function
- . Changed backend interaction with Sablotron library
- . Fixed leak with error_print
- . Made xslt_make_array() always set NULL on last index to signal array end.
-- Changed the glue argument in implode() to be optional. If not specified,
- defaults to "". (Sterling)
-- Fixed fields argument to contain correct info for xslt_set_error_handler().
- (Patch by Lenar Lohmus)
-- Added --with-config-file-scan-dir compile-time switch which specifies a
- directory which will be scanned for *.ini files. (Rasmus)
-- Added ob_get_clean() and ob_get_flush(). (Yasuo)
-- Added ftp_ssl_connect() to ext/ftp for FTP over SSL support. (Stefan Esser)
-- Made a few additions and changes to Apache 2 sapi. (Ilia)
- . Added apache_response_headers(), apache_note(), apache_getenv() and
- apache_setenv() functions.
- . Added more detailed error reporting to apache_lookup_uri() and virtual().
- . Renamed getallheaders() to apache_request_headers() and made an alias for BC.
- . Added php_apache_sapi_getenv() and php_apache_sapi_get_stat().
- . Added syntax-highlighting handling (.phps)
-- Fixed strstr(), strchr() and strrchr() to be binary safe. (Andrey)
-- Added array_diff_assoc() and array_intersect_assoc(). (Andrey)
-- Fixed bug #17825 (ob_start() chunk size option didn't work well). (Yasuo)
-- Fixed output buffer infinite loop when buffer_size became 0. (Marcus, Wez)
-- Added getopt() for parsing command line options and arguments. (Jon)
-- Added pg_fetch_assoc(), pg_fetch_all(), pg_ping(), pg_meta_data(), pg_convert(),
- pg_insert(), pg_select(), pg_update(), pg_delete(), pg_result_seek(),
- pg_unescape_bytea(), pg_get_notify() and pg_get_pid(). (Yasuo)
-- Fixed bug #17281 (Sanity checks for encoding sessions). (Ilia)
-- Fixed bug #16995 and #19392 (Prevent crash if $HTTP_SESSION_VARS != ARRAY).
- (Ilia)
-- Fixed bug #19292 (open_basedir restriction problem). (Rasmus)
-- Fixed bug #19366 (gdImageFill crashes when x & y are outside of
- the image's boundries). (Ilia)
-- Fixed bug #13936 (__FILE__ constant didn't contain full path). (Ilia)
-- PHP now has a new stream system that allows it to do some clever stuff with
- fopen() and fsockopen(). As a result:
- . URL wrappers natively supports https:// URLs if you have compiled
- OpenSSL support into PHP (shared extension does not support this).
- . Added support for fopen("ftps://...", ...) which allows to connect to FTP
- servers via SSL. (Stefan Esser)
- . fsockopen() adds support for ssl:// and tls:// connections via TCP/IP
- . copy($srcfilename, $destfilename) can now be used with URL wrappers
- . zlib wrappers/streams can be used even on systems without fopencookie()
- . Changed 'zlib:' fopen wrapper to 'compress.zlib://' and deprecate
- 'zlib:' to avoid ambiguities when filenames have ':' characters. (Wez)
- . Added 'compress.bzip2://' stream and wrapper support.
- . Added user-space streams - it is now possible to define a class in PHP
- code and register it as a URL wrapper. (stream_register_wrapper)
- . Most extensions now support streams when passing files, which means
- that those extensions will now also support URL wrappers. (Wez)
- . Added URL-wrapper support to exif. (Marcus)
- . Added memory stream support. (Marcus)
- . Renamed:
- socket_set_timeout() -> stream_set_timeout()
- socket_set_blocking() -> stream_set_blocking()
- set_file_buffer() -> stream_set_write_buffer()
- socket_get_status() -> stream_get_meta_data()
- As these functions can (in theory) work on any type of stream. (Wez)
- . Raw POST data is now available as "php://input" stream. (Hartmut)
- . fopen("php://output", "wb") returns a stream that writes to the output
- buffer (like echo and print). (Wez)
- . Added stream_context_create(), stream_context_set_params() and
- stream_context_set_option and added an optional fourth parameter to
- fopen() which accepts a stream context. Contexts allow sharing of
- information between streams (a kind of "session") and setting
- notification callbacks. (Wez)
- . Made the "User-Agent" header sent by http:// and https:// wrappers
- configurable in php.ini or via a stream context. (Sterling)
- . Added stream_filter_prepend() and stream_filter_append() which apply
- a filter to either the top or the bottom of a stream filter stack.
- Implemented "string.rot13" filter as an example; more filters are
- expected to follow in later releases and other extensions. (Wez)
- . Added stream_select() which works like socket_select but works on
- streams returned by fopen(), fsockopen() and pfsockopen() instead. (Wez)
- . Added STDIN, STDOUT and STDERR constants for CLI sapi reflecting opened
- streams to their respective standard I/O counterparts. (Edin)
- . Added php.ini option "auto_detect_line_endings" which enables PHP to
- detect Macintosh, Unix and Dos end-of-line characters in fgets() and
- file(). Fixes bugs #16521 and #16708. (Wez)
- . Fixed include(), require() and GD functions to work with remote files
- under win32.
- Fixed bug #18609 (ImageCreateFromJPEG can't fetch from a URL). (Wez)
-- Fixed bug #18022 (fopen does not work with php://stdin anymore on Solaris).
- (Wez)
-- Added php.ini option "default_socket_timeout" to set the timeout limit for
- PHP network streams. (kalowsky, ilia@prohost.org, Wez)
-- Added file_get_contents() which returns the contents of a file as a string.
- This function also supports the URL wrappers. (Wez)
-- Fixed bug #19595 (Missing functions for GD2 format handling). (Edin)
-- Fixed bug #19633 (Wrong directories in ext/ldap/config.m4). (Derick)
-- Fixed bugs #17274 and #19627 (segfault in sem_remove). (Wez)
-- Added mb_convert_case() function to the mbstring extension which can convert
- strings between upper, lower and title case using Unicode mappings.
- Fixed bug #19257 (strtolower & strtoupper does not work for UTF-8 strings).
- (Wez)
-- Fixed bug #18521 (htmlentities didn't warn about unsupported charsets). (Wez)
-- Fixed bug #11643 (Session related, fix SID redefinition). (Ilia)
-- Fixed bug #18556 (Scripting Engine, problem with locales like tr_TR). (Ilia)
-- Changed y2k_compliance to default to 1 now. (Sascha)
-- Added platform independent socket error constants for better error handling. (Jason)
-- Update output of phpinfo() to use more CSS to reduce the file size, do
- proper HTML escaping, and make it XHTML compliant. (Colin)
-- Fixed compile errors in the FriBidi extension (Bug #16414). (Tal)
-- Fixed bugs #7472, #12120 and #12989 as well as other potential problems
- with strip_tags() function. (Ilia)
-- Fixed bugs #17570 and #17957 (Regexps related). (Andrei, Ilia)
-- Fixed bugs #18167 and #16859 (SEGV with session_decode). (Ilia)
-- Fixed bugs #19573 and #13472 (Session, XHTML compliance and trans_sid).
- (Sascha)
-- Fixed bug #19570 (last character was missing in get_html_translation_table).
- (Wez)
-- Upgraded PCRE to version 3.9. (Wez)
-- Fixed bug in OCIResult() which returned garbage when called on
- empty result-sets. (Thies)
-- Added ability to use Perl-style ${n} subpattern references in the
- replacement string for preg_replace() (bug #18442). (Andrei)
-- Fixed array_merge_recursive() to avoid problems with merging cyclical
- arrays (bug #16064). (Andrei)
-- Made function_exists() work properly with disabled functions. (Andrei)
-- Added ability to extract() variables as references via OR'able EXTR_REFS
- flag. (Andrei)
-- Fixed a build failure with the OCI8 extension on Tru64.
- (Patch by Michael Mauch, micahel.mauch@gmx.de)
-- Added --disable-all configure option. (Jani)
-- Backported debug_backtrace() from ZendEngine2. (Thies)
-- Added html-free phpinfo() output for CLI. (Jan)
-- Fixed socket_recvfrom() to be binary safe. (Jason)
-- Changed mail() to use escape_shell_cmd() to allow multiple extra parameters
- to the invocation of the mailer as used in the fifth parameter. (Derick)
-- Changed cURL extension to require cURL version 7.9.8 (Derick)
-- Added zend_execute_internal which is called like zend_execute but for
- internal functions. (Thies)
-- Changed pg_connection_status(), pg_connection_reset(), pg_connection_busy(),
- pg_result_status() and pg_result_error() to silently return FALSE when
- resource is not passed to them. (Yasuo)
-- Fixed some mysql compile failures on 64 bit-OS. (Georg)
-- Added warnings for deprecated mysql functions:
- . mysql_create_db()
- . mysql_drop_db()
- . mysql_escape_string()
-- Added XsltObject->result_dump_mem($result) for returning xslt-result directly
- into a string and XsltObject->result_dump_file($result,$file[,$compression])
- for dumping into a file. (morus.walter@web.de, chregu)
-- Made mime_magic and ZIP extensions available on Windows. (Edin)
-- Added xslt_backend_version() and xslt_backend_name() for getting
- information about the processor backend. (chregu)
-- Added ImageColorMatch() and ImageLayerEffect() functions which are only
- available when using the bundled GD library. (ttoohey)
-- Made major improvents to the pcntl extension. (Jason)
- . Greatly improved performance (signal callback mechanism uses ticks)
- . Implemented object signal callback ability by using array($obj, $method)
- . Added a restart parameter to pcntl_signal, which allows you to disable
- the default of system call restarting
-- Changed DomNode->next_sibling() and DomNode->previous_sibling() to return
- NULL instead of false (W3C specs). (chregu)
-- Changed DomNode->insert_before() and DomNode->append_child() to conform to
- W3C specs (moving not copying nodes, accepting NULL as 2nd param). (chregu)
-- Added DomNode->set_namespace(uri[,prefix]) (chregu)
-- Fixed shuffle() to properly generate all possibilities. (Patch provided by
- Adam <adam@trachtenberg.com>)
-- Fixed DomNode->insert_before() to behave according to W3C spec
- ie. new_child is moved, not copied. (chregu)
-- Added some namespace support with DomNode->add_namespace(uri, prefix)
- and DomDocument->create_element_ns(uri, nodename) (chregu)
-- Added optional parameter to DomElement->node_name() for retrieving fully
- qualified name (ie. namespace prefix). (chregu)
-- Changed DomNode->child_nodes() to return empty array instead of false if no
- child nodes are found. (chregu)
-- Fixed a bug with handling the Expect header. (Patch by ilia@prohost.org)
-- Fixed a bug in ODBC where closing the module caused a crash in the Windows
- executable. (kalowsky)
-- Fixed memory leaks in pack() and unpack(). (Patch by ilia@prohost.org)
-- Added URLs to error messages which direct to a page describing the error or
- function in question. (Derick, Wez, Marcus)
-- Added odbc_data_source() functionality to identify DB ServerName, and a
- description of it gathered from the DSN. (kalowsky)
-- Fixed copy() to return TRUE with 0 byte files. (Patch by ilia@prohost.org)
-- Added ob_list_handlers() which returns an array of all active output
- handlers. (Marcus)
-- Added mbstring encoding/decoding "HTML-ENTITIES". (Marcus)
-- Added parameter 'L' for mb_http_input() to retrieve input encoding as a
- comma separated string. (Marcus)
-- Added the ability for declare() compiler modifications to occur globally
- by using an empty statement. (Jason, Zend Engine)
- i.e.
- //Globally enables the ticks modifier for the whole program
- declare (ticks=1);
-
- //Enables the ticks modifier for just the lexical block containing
- //"statement".
- declare (ticks=1) {
- statement;
- }
-- Brought strtotime() "next" keyword handling in line with documentation and
- its glibc cousin. (Rasmus)
-- Fixed str_rot13() to not mangle source string. (Rasmus)
-- Fixed imap_get_quota() to work with multiple returned resources as per
- the RFC 2087 and bug #14673. (kalowsky, Sander Steffann)
-- Added MarkerNote decoding to exif_read_data() for several Cameras. (Marcus)
-- Disabled zlib.output_compression for "image/" content-type
- headers which can be changed during script execution. (Stefan)
-- Added new asynchronous FTP functions. (Stefan)
-- Added optional 5th parameter to FTP functions to support resuming. (Stefan)
-- Added optional 2nd parameter to print_r() to make it return the variable
- representation instead of echoing it. (Derick)
-- Added mysql_ping(), mysql_real_escape_string(), mysql_character_set_name(),
- mysql_thread_id(), mysql_stat() and mysql_list_processes(). (Zak, Georg)
-- Added safe_mode & open_basedir checks for pg_lo_export(). (Yasuo)
-- Added open_basedir check for pg_lo_import(). (Yasuo)
-- Fixed infinite recursion crash bug in ticks. (Jason)
-- Added php.ini option "mysql.connect_timeout" to set the timeout limit for
- mysql_connect() and mysql_pconnect(). (Georg)
-- Added optional parameter "flags" to mysql_connect() and mysql_pconnect()
- which can be used to set usage of idle timeout and different protocols,
- SSL and compressed. (Georg)
-- Added automatic rollback to ext/mysql for non committed transactions. (Georg)
-- Fixed cases where preg_split() incorrectly terminated final element if it
- contained null bytes. (Andrei)
-- Added persistent connections/pipelining to thttpd. (Sascha)
-- Fixed two potential blocking issues in thttpd. (Sascha)
-- Fixed broken header file detection on Solaris. (Sascha)
-- Improved nss/socket-related symbol/library detection. (Jani, Sascha)
-- Made iconv() work well with both libiconv and libgconv. (Moriyoshi, Yasuo)
-- Fixed socket_set_timeout() on win32. (Jason, Edin, Jani)
-- Added domxml_node_namespace_uri(). (Rui Lopes)
-- Fixed win32 memory leak in /ext/sockets that would occur on any error
- condition. Also fixed host resolution error messages on win32. (Jason)
-- Added optional 3rd parameter 'recursive' to ftp_rawlist() which will
- do 'LIST -R' instead of 'LIST'. (Jani)
-- Changed getimagesize() to always set unknown fields to 0 and added support
- for iff imagetype. (Marcus)
-- Added runtime Apache2 thread check to ensure we don't run a non-threaded
- PHP inside a threaded Apache2 MPM. (Rasmus)
-- Made getimagesize() and exif_read_data() to return also the mime-type and
- exif_thumbnail() to return also the image-type. (Marcus)
-- Added image_type_to_mime_type() which converts image-types to mime-types.
- (Marcus)
-- Made GD functions to only exist if they are available in libgd. Now the
- availability can be tested with function_exists(). (Derick)
-- Added an optional parameter to the header() function which overrides the HTTP
- response code. (Derick)
-- Changed the order of which modules are unloaded to the reverse order of
- which they were loaded. (Derick, Zend Engine)
-- Added preliminary SAX-Input support. It's now possible to build a DomDocument
- with SAX-Events. (chregu)
-- Bundled GD library 2.0.1 with php (ext/gd/libgd) (Rasmus, Jani, Markus, Edin)
-- Fixed bug with Apache which let PHP_AUTH_* variables to be set when
- external basic auth mechanism was used. (Jani)
-- Fixed bzopen() crash in thread-safe mode. (Andrei)
-- Added better error-messages (3rd parameter) and validating of DTDs (2nd
- parameter) to domxml_open_mem() and domxml_open_file(). (Christian)
-- Added domxml_doc_validate() for validating existing DomDocuments with a DTD.
- (Christian)
-- Added ability to capture string offsets in preg_match_*() results.
- (David Brown, Andrei)
-- Fixed set_error_handler() to accept methods as callbacks and also report
- invalid callbacks. (Andrei)
-- Fixed a memory corruption bug in overload extension. (Andrei)
-- Fixed error handling in fsockopen() on win32. (Jason)
-- Added win32 support for the timeout parameter of fsockopen(). (Jason)
-- Fixed shuffle() to provide equal distribution of values. (Andrei)
-- Added --with-mysql-sock configure option which can be used to override
- the unix socket location. (e.g. NFS compiles, etc.) (James Cox)
-- Fixed is_a() to properly work on extension registered classes. (Andrei)
-- Added new constants: PHP_PREFIX and PHP_SHLIB_SUFFIX. (Stig)
-- Added pctnl_alarm() function. (Edin)
-- If zlib.output_compression is enabled and a page is compressed
- a "Vary: Accept-Encoding" header is now added. (Stefan)
-- Renamed getallheaders() to apache_request_headers() and kept getallheaders()
- as an alias to it. Also added apache_response_headers() which returns the
- current response headers from Apache. (Rasmus)
-- Added missing AddRef() calls in the COM extension. This should fix weird
- behaviour (in particular with ADODB). (Harald)
-- Fixed segfault in version_compare(). (Stig)
-- Added compressed Flash MX files support to getimagesize(). (Derick)
-- Added ability to capture string offsets in preg_split() results.
- (David Brown, Andrei)
-- Fixed a crash bug in token_get_all(). (Andrei)
-- Implemented glob() for Unix/Win32. (Hartmut, Edin, Markus)
-- Added domxml_doc_set_root() to change the root node. (Lukas Schroeder)
-- Fixed a crash bug in stripslashes() when working in sybase mode. (Rasmus)
-- Added experimental support for Simplified Chinese, Traditional Chinese and
- Korean encodings into mbstring. (Rui)
-- Misc. Win32 mail() enhancements: support 'From:' header (msisolak@yahoo.com),
- support Bcc header, case-insensitive headers, enhanced error reporting,
- automatic proper line ending conversion, fixed crash with Cc, fixed buffer
- overflows with $header. (Markus)
-- Improved IMAP extension performance. (adam.kauffman@mindspring.com,
- rjs3@andrew.cmu.edu, Jon)
-- Added optional 5th parameter to domxml_xslt_process(). When set, profiling
- information is saved to the specified file. (chregu)
-- Added MD5 support for crypt() on Windows. (Edin)
-- Fixed resource bug in LDAP extension. (Stig Venaas)
-- Fixed crash in output buffering when buffer is overwritten in a callback.
- (Yasuo)
-- Added output_add_rewrite_var() and output_remove_rewrite_var() to inject
- and remove variables from the URL-Rewriter. (Thies)
-- The Windows build can now be configured more comfortably, for example
- when dealing with built-in extensions. (Sebastian)
-- Added large OID value (2^31 to 2^32) support for pg_lo_import(),
- pg_lo_unlink(), pg_lo_open() and pg_lo_export(). (Yasuo)
-- Fixed mixing OCIPlogon() and OCINLogon() to not leak Oracle-Sessions. (Thies)
-- Added php.ini options for EXIF extension to encode and decode Unicode/JIS
- user comments. (Marcus)
-- Changed the "-c" CLI/CGI option to allow both 'filename' and
- 'path to php.ini'. (Yasuo)
-- Added version information to the .dll and .exe files created under Windows.
- (jtate)
-- Added __FUNCTION__ and __CLASS__ constants. (Jani, Zend Engine)
-- Added optional 2nd parameter for pg_result_status() to specify return type.
- (Yasuo)
-- Added "log_errors_max_len" php.ini option which controls maximum length for
- error messages. (Marcus)
-- Added "ignore_repeated_errors" and "ignore_repeated_source" php.ini options
- which can be used to disable logging of repeated error messages. (Marcus)
-- Made pg_last_notice() work correctly. (Yasuo)
-- Added "pgsql.ignore_notice" and "pgsql.log_notice" php.ini options. (Yasuo)
-- Added "zlib.output_compression_level" php.ini option. (Stig)
-- Added support for --with-apxs build on Mac OS X / Darwin. (markonen)
-- Added support for dynamically loaded extensions on OS X / Darwin.
- NOTE: This requires Apache 1.3.25 or later. (kalowsky, markonen)
-- Fixed CR/LF processing in quoted_printable_decode() on Win32. (kir)
-- Made crack extension available on Win32. Cracklib libraries for Win32 are
- available at http://www.jtatesoftware.com/cracklib/. (jtate)
-- Added mysql_info() function. (Jan)
-- Added mysql_list_processes() and mysql_stat() functions. (Georg)
-- Fixed memory allocation problem on systems that have iconv() support in libc.
- (Yasuo)
-- Made var_dump() handle recursive structures better. (Yasuo, Derick)
-- Added exif_imagetype() function. (Marcus)
-- New improved build system. Among other improvements, replaces the slow
- recursive make with one global Makefile and eases the integration of proper
- dependencies. Automake is only needed for its aclocal tool. The build
- process is now more portable and less resource-consuming. (Sascha)
-
-06 Sep 2002, Version 4.2.3
-- Disabled the fifth parameter in mail() when safe-mode is turned on. (Derick)
-- Enable UTF8 modifier support for PCRE on win32. (Wez, Edin)
-- Enabled strcoll() on win32. (Markus)
-- Fixed possible ASCII control char injection in mail(). (Stefan Esser)
-- Fixed a potential crash bug in import_request_variables() (Zeev)
-- Fixed several problems with directory functions on Windows. (Steph)
-- Fixed xbithack bug in Apache module. (Rasmus)
-- Fixed a bug that prevented touch() from working on various platforms. (Steph)
-- Fixed ob_gzhandler()'s handling of requests that do have the Accept-Encoding
- header, but do not allow compression. (Zeev)
-- Fixed several bugs in the multithreaded version that could cause random parse
- errors, especially on machines with multiple CPUs. (Zeev, Zend Engine)
-- Fixed a build problem in bcmath. (Alan)
-- Fixed several bzip2 issues. (Andrei, kalowsky)
-- Fixed several COM issues. (Harald)
-- Various exif fixes. (Marcus)
-- Fixed domxml_xslt_process() and domxml_get_element_by_id() and several
- other issues in DOMXML. (Christian)
-- Fixed DOMXML crash on removing previously created attributes. (Christian)
-- Fixed crash when converting $GLOBALS to an object. (Zeev, Zend Engine)
-- Fixed ImageCreateFromGD2Part() (Jani)
-- Fixed a build issue in the IMAP extension under IRIX. (kalowsky)
-- Fixed a bug in imap_last_error() (Jani)
-- Various mbstring fixes. (Yasuo, Rui)
-- Fixed a build problem in the mcal extension. (Jani)
-- Made MySQL rollback open transactions when the request ends. (Georg)
-- Fixed a crash in the shutdown order of the ODBC module. (kalowsky)
-- Fixed PCRE build problems. (troels@arvin.dk)
-- Fixed a crash in pg_lo_write() (Yasuo)
-- Fixed posix_isatty() and posix_ttyname(). (Markus)
-- Fixed accidental pg_lo_import() API change. (Yasuo)
-- Fixed ereg_replace() crash when the backreference number was greater than the
- number of captured subpatterns. (oliver@billix.franken.de)
-- Fixed array_rand() on thread-safe platforms such as Windows. (Edin)
-- Report the right exit code after a call to exit(). (Edin)
-
-22 Jul 2002, Version 4.2.2
-- Fixed serious security vulnerability. (Stefan Esser)
-
-13 May 2002, Version 4.2.1
-- Added safe-mode checks to show_source(), parse_ini_file() and rmdir(). Also
- fixed security problems with safe_mode_include_dir directive. (Rasmus)
-- Changed HTTP upload code to accept 0 byte file uploads. (Zeev)
-- Major update of domxml. New functions, better DOM compliance and bug fixes:
- * Changed the old $node->append_child() to $node->append_sibling() since
- the new append_child() behaves correctly (= W3C standard).
- * Added domxml functions:
- . domxml_elem_get_elements_by_tagname()
- . domxml_doc_get_elements_by_tagname()
- . domxml_doc_get_element_by_id()
- . domxml_elem_remove_attribute()
- . domxml_elem_get_attribute_node()
- * Fixed a segfault in domxml_unlink().
- * Added formatting option to domxml_dump_mem().
- (Uwe, jtate, Chregu)
-- Fixed a bug in socket_select() that could cause unexpected behavior when
- using a statement like $w = $e = array($sock); This change unfortunately
- prevents the use of constant values (e.g. NULL) for the socket array
- paramaters. Instead, use a temporary variable or an expression with the
- leftmost member being a temporary variable. ex.:
- socket_select($w, $r, $e = NULL, 10); (Jason)
-- Fixed crashes in the session serializer. (Stas)
-- Fixed malformed atime/mtime with touch(). (Yasuo)
-- Fixed a couple of bugs in array_sum() and array_merge(). (Andrei)
-- Fixed SJIS directory name handling under Windows. (Rui)
-- Fixed empty mb_output_handler() output when Content-Type is specified.
- (Yasuo)
-- Fixed the false logic in ext/session which made SID constant not to be
- defined when cookies are disabled. (Sascha)
-- Fixed possible crash bug in HTTP uploads. (Patch: Lucas Schroeder)
-- Fixed possible NULL-pointer dereferencing in the COM extension which
- caused 'Error in php_OLECHAR_to_char()' warnings on various places.
- Also modified the API to consistently return NULL in case of an error.
- (Alan, Harald)
-- Fixed a bug in the COM extension that caused outproc servers to 'hang'
- because of a missing Release() call. (Alan, Harald)
-
-22 Apr 2002, Version 4.2.0
-- ATTENTION!! register_globals defaults to 'off' now !!!
-- Note: Apache2 support is EXPERIMENTAL.
-- PostgreSQL functions are renamed, but all old function names are available.
- Old function names will be available long enough. User can safely use old
- function names. (Yasuo)
-- Moved ext/mailparse to PECL. See http://thebrainroom.com/opensource/php/
- for more information and to download the extension. (Wez/Jim)
-- Fixed pg_last_notice() crash. (Yasuo)
-- Modified the mysql extension to disable 'LOAD LOCAL' when safe mode is
- enabled. (Jason)
-- Added CLI (command line interface) sapi which is more suitable for writing
- shell scripts. Some of the differences to CGI sapi are: no HTTP headers,
- plain text error messages, does not change working directory, have a new -r
- option which executes a piece of PHP code directly from the commmand line, etc.
- (Edin)
-- Fixed HTTP file upload support to handle big files better. (Jani)
-- Major modifications to the Sockets Extension and its API (Jason):
- . Fixed numerous bugs.
- . Added automatic host lookup capability to all functions that take addr's.
- example: socket_connect($sock, 'www.yahoo.com', 80);
- . Corrected and standardized host lookup errors
- . Modified socket_recv() behavior. [$r=socket_recv($sock, $buf, $len, $flags)]
- . Added socket_set_block() which changes a socket into blocking IO mode
- . Modified socket_last_error() to not clear the last error
- . Added socket_clear_error() which clears the last error on a socket
- . Removed all code pertaining to fd_sets (socket_fd_*)
- . Modified/Improved socket_select() to accept array of resources instead of
- fd_sets. example:
- <?php
- $wfds=$rfds=array($sock1, $sock2, $sock3, $sock7);
- $r=socket_select($rfds, $wfds, NULL, 1);
- print "Ready to read:\n"; var_dump($rfds);
- ?>
-- Fixed segfault in ibase_close() if user does not free the resultset.
- Bugs #15419, #15992. (daniela)
-- Added optional 3rd parameter "int encoding_mode" to gzencode() and fixed
- parameters to conform documentation. (Stefan)
-- Changed read_exif_data() to be an alias of exif_read_data(). (Marcus)
-- Added exif_tagname() function which returns the names of tags and
- exif_thumbnail() function to extract embedded thumbnails. (Marcus)
-- Fixed iconv support with FreeBSD. (kalowsky)
-- Cleaned up the posix extension: (Markus)
- . Removed unwanted warning messages
- . Added posix_errno() and posix_strerror() for fetching error messages
- . Changed the way posix_getgrnam() and posix_getgrgid() return their values
- (breaks BC but makes more sense)
- . Does not include functions in symbol table which aren't supported on host
- system.
-- Added TIFF support for getimagesize() and read_exif_data(). (Marcus)
-- Changed the Velocis extension namespace to Birdstep to reflect new product
- name. Added aliases for BC. (James)
-- Added safe_mode checks for opendir(). (jflemer)
-- Changed the 2nd parameter in pgsql_fetch_*() functions to support NULL if
- all 3 parameters are supplied, but you do not want to provide a row number.
- (Derick)
-- Improved iconv() when using libc's iconv. (Yasuo)
-- Added PHP_SAPI constant which contains the name of running SAPI. (Edin)
-- Added ob_get_status() which returns an array of buffers with their status.
- (Yasuo)
-- Fixed a crash bug in ob_end_*() functions. ob_end_*() will not delete
- buffers that may not be deleted. (Yasuo)
-- Added 3rd parameter "bool erase" to ob_start(). If FALSE, the buffer may not
- be deleted until script finishes. (Yasuo)
-- Changed ob_*() functions to return TRUE for success, FALSE for failure.
- (Yasuo)
-- Added sybase_ct support to dbx module. (Marc)
-- Fixed error message handling with PostgreSQL 7.2. (Rui)
-- Added object aggregation capability, see aggregation_*() functions. (Andrei)
-- Added debug_zval_dump() which works similarly to var_dump, but displays
- extra internal information such as refcounts and true type names. (Jason)
-- Added Andrei's tokenizer extension. (Stig)
-- Fixed a bug in the COM extension which caused php to crash in
- php_COM_get_ids_of_names(). (Paul, Harald)
-- Removed ext/satellite. It is now part of PEAR. (eriksson)
-- Changed php.ini directive 'safe_mode_include_dir' to accept a (semi)colon
- separated path (like 'include_path') rather than a single directory.
- (jflemer)
-- Added is_a() function that can be used to test whether object is of a certain
- class or is derived from it. (Andrei, Zend Engine)
-- Added optional parameter to highlight_string() and highlight_file() which
- makes these functions to return a highlighted string instead of dumping
- it to standard output. (Derick)
-- Added EXTR_IF_EXISTS and EXTR_PREFIX_IF_EXISTS flags to extract(). (Rasmus)
-- Fixed a segfault in pg_pconnect(). If PostgreSQL server is restarted, broken
- connection is detected and reconnected. (Yasuo)
-- Fixed --enable-safe-mode configure option. (Yasuo)
-- Added function domxml_dump_node($doc,$node). Dumps a node plus all children
- into a string. (chregu)
-- Added function domxml_node_get_content(). (chregu)
-- Added function domxml_dump_file($filename,[$compression]). Dumps XML to
- a file and uses compression, if specified. (chregu)
-- Added exslt integration to domxml extension (http://exslt.org for details).
- Configure with --with-dom-exslt[=DIR] (and --with-dom-xslt).
- (chregu,jaroslaw)
-- Fixed session_unset() to not touch any globals if register_globals is off.
- (Thies)
-- Added 3 new optional parameters to OCIFetchStatement(). They control
- the number of rows to skip at the beginning of the cursor, the
- maximun numer of rows that should be fetched and the format of the
- returned array. (Thies)
-- Updated the XSLT extension to support Sablotron 0.8. (Petr Cimprich)
-- Fixed a bug in preg_match() and preg_match_all() when matching strings
- contain null bytes. (Andrei)
-- Added xpath_register_ns() function. This makes it possible to issue XPath
- queries with namespaces like for example: "//namespace:sampletag".
- (Chris Jarecki)
-- Added multi-byte enabled regular expression functions. (Rui)
-- Added optional second parameter to count() which can be used to specify
- either normal or recursive counting. (patch by Vlad Bosinceanu <glipy@fx.ro>)
-- Added mb_get_info() to get internal settings of mbstring. (Rui)
-- Added async query functions to PostgreSQL module. (Yasuo)
-- Added pg_copy_to()/pg_copy_from() for PostgreSQL module. (Youichi, Yasuo)
-- Added IPv6 support for FTP extension. (Stig Venaas)
-- Improved the speed of wordwrap() significantly. (Jim)
-- Fixed pow()'s incorrect behaviour when dealing with powers of 0. (Jim)
-- Added is_finite(), is_infinite() and is_nan(). (Jim)
-- Fixed segfault in wordwrap() when wrapping to zero width and using
- multi-character break or trying to force cut (bug #12768). (Jim)
-- Fixed several bugs in dbase extension (dbase_pack() truncate file to right
- size, fix 6852 #1 and 6852 #2). (Vlad)
-- Fixed bug in krsort() where an extra character was being compared. (Andi)
-- Fixed bug that made pspell include pspell.h from a wrong location. (Vlad)
-- Added function overload in mbstring to add multibyte support for
- string and mail functions. (Rui)
-- Added flags parameter to preg_grep(). The only flag currently is
- PREG_GREP_INVERT that will make the function return entries that
- did not match. (Andrei)
-- Fixed several crash bugs in the xslt extension. (Markus, Derick)
-- Fixed problem with dbase not returning very large (larger than long)
- integers properly. (Vlad)
-- Added concepts to IRCG: bailout-on-trivial issue, write output to
- files, fetch a resource upon connection end. (Sascha)
-- Fixed POST-related bugs in thttpd, added QUERY_STRING, HTTP_HOST,
- HTTP_ACCEPT_LANGUAGE to the script environment, improved patch
- to send correct MIME types, and added support for /nocache/. (Sascha)
-- Fixed several bugs and memleaks in the domxml extension. (Markus)
-- Added var_export() which outputs a representation of a variable as reusable
- PHP code. (Derick)
-- Added -w option to the CGI-version to strip all comments and whitespace
- from the script. (Thies)
-- Added support for SO_RCVTIMEO and SO_SNDTIMEO to ext/sockets. (Jason)
-- Added ob_get_level() which returns the nesting level of the output buffering
- mechanism. (Yasuo, Derick)
-- Added ob_flush() and ob_clean() functions which flush and clean an output
- buffer without destroying the buffer. (Derick)
-- Added new optional parameter to mysql_connect() which forces a new database
- link to be created. (Markus, Derick)
-- Added ldap_sort() function. (Stig Venaas)
-- Added md5_file() function which calculates the MD5 sum of a file.
- Patch by Alessandro Astarita <aleast@capri.it> (Derick)
-- Added support for parsing recordsets contained in WDDX packets. (Andrei)
-- Renamed key_exists() to array_key_exists(). (Derick)
-- Fixed ImageColorsForIndex() and ImageColorAt() to work for TrueColor
- images. (Rasmus)
-- Added support for bind_textdomain_codeset(). (rudib@email.si)
-- Added generic Win 32 API extension. (jmoore)
-- Removed warning message about NONEXISTENT character set from mysql_connect()
- when the server's default character set != latin1. (Mysql Team)
-- Added Direct I/O extension for lowlevel access to the POSIX layer. (Sterling)
-- Added SAPI module for the WebJames server on RISC OS. (Alex Waugh)
-- Fixed ldap_add() and ldap_modify() functions to throw a warning with illegal
- value arrays. Previously segfaulted or added wrong value. (Stig Venaas)
-- Added udm_check_charset() function into mnoGoSearch extension. (gluke)
-- Fixed mnoGoSearch extension to support mnogosearch-3.2.x. (gluke)
-- Made fbsql_num_rows() to return the correct value on all select statements.
- (Frank)
-- Added array_chunk() function which splits an array into chunks of specified
- size. (Andrei)
-- Fixed $HTTP_RAW_POST_DATA to be populated on a missing content-type when
- always_populate_raw_post_data is on. (Rasmus)
-- Added session_cache_expire() function. (patch by anuradha@gnu.org) (Andrei)
-- Added array_fill() function. (Rasmus)
-- Made Authorization header to be hidden from phpinfo() output in safe_mode.
- (Rasmus)
-- Re-instated safe-mode realm mangling. (Rasmus)
-- Fixed a bug in preg_replace() that would change the type of the replacement
- array entries to string. (Andrei)
-- Added user-space object overloading extension. (Andrei)
-- Added ldap_start_tls() function. (Stig Venaas, patch by kuenne@rentec.com)
-- Changed rand() and mt_rand() to be seed automatically if srand() or
- mt_srand() has not been called. (Sterling)
-- Changed the seed options to srand() and mt_srand() to be optional. If the
- seed is not specified the most random seed possible is generated. (Sterling)
-- Added array_change_key_case() function which returns an array with all
- string keys lowercased or uppercased. (Edin)
-- Added parameter to ircg_pconnect to suppress treating non-fatal errors
- as fatal, and added conversion of Windows quotes to &quot;. (Sascha)
-- Added pcntl_exec() function which behaves similar to the system execve.
- (Jason)
-- Fixed segfault and check for truecolor image in ImageColorAt(). (Rasmus)
-- Fixed nl2br() to handle all styles of line-endings in one string.
- (Boian, Derick)
-- Added mcrypt_generic_deinit() to replace mcrypt_generic_end(). (Derick)
-- Added apache_setenv() function for injecting variables into Apache's
- subprocess_env table. (Rasmus)
-- Added support for 'int', 'bool', 'float' and 'null' in settype(). (Jeroen)
-- Added IPv6 support to gethostbyaddr().
- (Patch by Matthias Wimmer <matthias@charente.de> and venaas)
-- Fixed LONG_VARCHAR type crashing in ODBC extension. Patch by Walter Franzini.
- (kalowsky)
-- Changed in_array() and search_array() to allow the needle to be an array
- in itself. (Andrei)
-- Added ini_get_all() function which returns all registered ini entries
- or entries for the specified extension. (Jani)
-- Added mailparse_uudecode_all() which extracts all uuencoded attachments.
- (Wez)
-- Added support for chinese encodings in htmlentities() and htmlspecialchars().
- (Patch by Alan Knowles <alan_k@hklc.com> and Wez)
-- Improved support for autoconf-2.50+/libtool 1.4b+. (Jan Kneschke, Sascha)
-
-27 Feb 2002, Version 4.1.2
-- Fixed start up failure when mm save handler is used and there are multiple
- SAPIs working at the same time. (Yasuo)
-- Fixed the Roxen SAPI. (Yasuo)
-- Fixed a buffer overflow in the RFC-1867 file upload code. (Stefan)
-- Fixed a crash bug in the session module. (Yasuo)
-- Fixed a crash bug in the pspell module. (Yasuo)
-- Changed the default output encoding of mbstring 'pass' to fix
- initialization problem. (Rui)
-
-26 Dec 2001, Version 4.1.1
-- Fixed incompatibility with Windows .NET / IIS 6 - may improve stability
- under other versions of IIS. (Zeev)
-- Fixed bug that caused crashes or error notices on shutdown on threaded
- platforms. (Zeev)
-- Fixed several crash bugs in the xslt extension. (Markus, Derick)
-- Fixed problem with dbase not returning very large (larger than long)
- integers properly. (Vlad)
-- Fixed several bugs and memleaks in the domxml extension. (Markus)
-- Fixed bug in gmmktime() which was one hour off during standard time -
- bug #9878. Patch by bfoddy@mediaone.net. (jmoore)
-- Fixed bug in gmdate() timezone handling on Windows - bug #13885. (jmoore)
-- Fixed several crash bugs in the mcrypt extension. (Derick)
-- Made the mcrypt extension compile with the libmcrypt 2.2 series again.
- (Sterling)
-- Fixed a bug where the is_file() family of functions would in-correctly give
- an error when they were given filenames that didn't exist. (Sterling)
-- Fixed a bug in the strtotime() function where it was incorrectly recognizing
- GMT +0100 and GMT -0100. (Derick)
-
-10 Dec 2001, Version 4.1.0
-- Fixed return values for strtok (Bug #13866) (jmoore)
-- Worked around a bug in the MySQL client library that could cause PHP to hang
- when using unbuffered queries. (Zeev)
-- Fixed a bug which caused set_time_limit() to affect all subsequent requests
- to running Apache child process. (Zeev)
-- Removed the sablotron extension in favor of the new XSLT extension.
- (Sterling)
-- Fixed a bug in WDDX deserialization that would sometimes corrupt the root
- element if it was a scalar one. (Andrei)
-- Make ImageColorAt() and ImageColorsForIndex() work with TrueColor images.
- (Rasmus)
-- Fixed a bug in preg_match_all() that would return results under improper
- indices in certain cases. (Andrei)
-- Fixed a crash in str_replace() that would happen if search parameter was an
- array and one of the replacements resulted in subject string being empty.
- (Andrei)
-- Fixed MySQL extension to work with MySQL 4.0. (Jani)
-- Fixed a crash bug within Cobalt systems. Patch by tomc@tripac.com. (Jani)
-- Bundled Dan Libby's xmlrpc-epi extension.
-- Introduced extension version numbers. (Stig)
-- Added version_compare() function. (Stig)
-- Fixed pg_last_notice() (could cause random crashes in PostgreSQL
- applications, even if they didn't use pg_last_notice()). (Zeev)
-- Fixed DOM-XML's error reporting, so E_WARNING errors are given instead of
- E_ERROR error's, this allows you to trap errors thrown by DOMXML functions.
- (Sterling)
-- Fixed a bug in the mcrypt extension, where list destructors were not
- properly being allocated. (Sterling)
-- Better Interbase blob, null and error handling. (Patch by Jeremy Bettis)
-- Fixed a crash bug in array_map() if the input arrays had string or
- non-sequential keys. Also modified it so that if a single array is passed,
- its keys are preserved in the resulting array. (Andrei)
-- Fixed a crash in dbase_replace_record. (Patch by robin.marlow@dps-int.com)
-- Fixed a crash in msql_result(). (Zeev)
-- Added support for single dimensional SafeArrays and Enumerations.
- Added com_isenum() function to check if a component implements an
- enumeration. (Alan, Harald)
-- Fixed a bug in dbase_get_record() and dbase_get_record_with_names().
- boolean fields are now returned correctly.
- Patch by Lawrence E. Widman <widman@cardiothink.com> (Jani)
-- Added --version option to php-config. (Stig)
-- Improved support for thttpd-2.21b by incorporating patches for all known
- bugs. (Sascha)
-- Added ircg_get_username, a roomkey argument to ircg_join, error fetching
- infrastructure, a tokenizer to speed up message processing, and fixed
- a lot of bugs in the IRCG extension. (Sascha)
-- Improved speed of the serializer/deserializer. (Thies, Sascha)
-- Floating point numbers are better detected when converting from strings.
- (Zeev, Zend Engine)
-- Replaced php.ini-optimized with php.ini-recommended. As the name implies,
- it's warmly recommended to use this file as the basis for your PHP
- configuration, rather than php.ini-dist. (Zeev)
-- Restore xpath_eval() and php_xpathptr_eval() for 4.0.7. There
- are still some known leaks. (Joey)
-- Added import_request_variables(), to allow users to safely import form
- variables to the global scope (Zeev)
-- Introduced a new $_REQUEST array, which includes any GET, POST or COOKIE
- variables. Like the other new variables, this variable is also available
- regardless of the context. (Andi & Zeev)
-- Introduced $_GET, $_POST, $_COOKIE, $_SERVER and $_ENV variables, which
- deprecate the old $HTTP_*_VARS arrays. In addition to be much shorter to
- type - these variables are also available regardless of the scope, and
- there's no need to import them using the 'global' statement. (Andi & Zeev)
-- Added vprintf() and vsprintf() functions that allow passing all arguments
- after format as an array. (Andrei)
-- Added support for GD2 image type for ImageCreateFromString(). (Jani)
-- Added ImageCreateFromGD(), ImageCreateFromGD2(), ImageCreateFromGD2part(),
- ImageGD() and ImageGD2() functions. (Jani)
-- addcslashes now warns when charlist is invalid. The returned string
- remained the same (Jeroen)
-- Added optional extra argument to gmp_init(). The extra argument
- indicates which number base gmp should use when converting a
- string to the gmp-number. (Troels)
-- Added the Cyrus-IMAP extension, which allows a direct interface to Cyrus'
- more advanced capabilities. (Sterling)
-- Enhanced read_exif_data() to support multiple comment tags. (Rasmus)
-- Fixed a crash bug in array_map() when NULL callback was passed in. (Andrei)
-- Change from E_ERROR to E_WARNING in the exif extension (Rasmus)
-- New pow() implementation, which returns an integer when possible,
- and warnings on wrong input (jeroen)
-- Added optional second parameter to trim, chop and ltrim. You can
- now specify which characters to trim (jeroen)
-- Hugely improved the performance of the thread-safe version of PHP, especially
- under Windows (Andi & Zeev)
-- Improved request-shutdown performance significantly (Andi & Zeev, Zend
- Engine)
-- Added a few new math functions. (Jesus)
-- Bump bundled expat to 1.95.2 (Thies)
-- Improved the stability of OCIPlogon() after a database restart. (Thies)
-- Fixed __FILE__ in the CGI & Java servlet modes when used in the main script.
- It only worked correctly in included files before this fix (Andi)
-- Improved the Zend hash table implementation to be much faster (Andi, Zend
- Engine)
-- Updated PHP's file open function (used by include()) to check in the calling
- script's directory in case the file can't be found in the include_path (Andi)
-- Fixed a corruption bug that could cause constants to become corrupted, and
- possibly prevent resources from properly being cleaned up at the end of
- a request (Zeev)
-- Added optional use of Boyer-Moore algorithm to str_replace() (Sascha)
-- Fixed and improved shared-memory session storage module (Sascha)
-- Add config option (always_populate_raw_post_data) which when enabled
- will always populate $HTTP_RAW_POST_DATA regardless of the post mime
- type (Rasmus)
-- Added support for socket and popen file types to ftp_fput (Jason)
-- Fixed various memory leaks in the LDAP extension (Stig Venaas)
-- Improved interactive mode - it is now available in all builds of PHP, without
- any significant slowdown (Zeev, Zend Engine)
-- Fixed crash in iptcparse() if the supplied data was bogus. (Thies)
-- Fixed return value for a failed snmpset() - now returns false (Rasmus)
-- Added hostname:port support to snmp functions (nbougues@axialys.net, Rasmus)
-- Added fdf_set_encoding() function (Masaki YATSU, Rasmus)
-- Reversed the destruction-order of resources. This fixes the reported OCI8
- "failed to rollback outstanding transactions!" message (Thies, Zend Engine)
-- Added option for returning XMLRPC fault packets. (Matt Allen, Sascha
- Schumann)
-- Improved range() function to support range('a','z') and range(9,0) types of
- ranges. (Rasmus)
-- Added getmygid() and safe_mode_gid ini directive to allow safe mode to do
- a gid check instead of a uid check. (James E. Flemer, Rasmus)
-- Made assert() accept the array(&$obj, 'methodname') syntax. (Thies)
-- Made sure that OCI8 outbound variables are always zero-terminated. (Thies)
-- Fixed a bug that allowed users to spawn processes while using the 5th
- parameter to mail(). (Derick)
-- Added nl_langinfo() (when OS provides it) that returns locale.
-- Fixed a major memory corruption bug in the thread safe version. (Zeev)
-- Fixed a crash when using the CURLOPT_WRITEHEADER option. (Sterling)
-- Added optional suffix removal parameter to basename(). (Hartmut)
-- Added new parameter UDM_PARAM_VARDIR ha in Udm_Set_Agent_Param() function to
- support alternative search data directory. This requires mnogoSearch 3.1.13
- or later.
-- Fixed references in sessions. This doesn't work when using the WDDX
- session-serializer. Also improved speed of sessions. (Thies)
-- Added new experimental module pcntl (Process Control). (Jason)
-- Fixed a bug when com.allow_dcom is set to false. (phanto)
-- Added a further parameter to the constructor to load typelibs from file when
- instantiating components (e.g. DCOM Components without local registration).
- (phanto)
-- Added the possibility to specify typelibs by full name in the typelib file
- (Alan Brown)
-- Renamed the ZZiplib extension to the Zip extension, function names have also
- changed accordingly, functionality, has stayed constant. (Sterling)
-- Made the length argument (argument 2) to pg_loread() optional, if not
- specified data will be read in 1kb chunks. (Sterling)
-- Added a third argument to pg_lowrite() which is the length of the data to
- write. (Sterling)
-- Added the CONNECTION_ABORTED, CONNECTION_TIMEOUT and CONNECTION_NORMAL
- constants. (Zak)
-- Assigning to a string offset beyond the end of the string now automatically
- increases the string length by padding it with spaces, and performs the
- assignment. (Zeev, Zend Engine)
-- Added warnings in case an uninitialized string offset is read. (Zeev, Zend
- Engine)
-- Fixed a couple of overflow bugs in case of very large negative integer
- numbers. (Zeev, Zend Engine)
-- Fixed a crash bug in the string-offsets implementation (Zeev, Zend Engine)
-- Improved the implementation of parent::method_name() for classes which use
- run-time inheritance. (Zeev, Zend Engine)
-- Added 'W' flag to date() function to return week number of year using ISO
- 8601 standard. (Colin)
-- Made the PostgreSQL driver do internal row counting when iterating through
- result sets. (gvz@2scale.net)
-- Updated ext/mysql/libmysql to version 3.23.39; Portability fixes, minor
- bug fixes. (tim@mysql.com)
-- Added get_defined_constants() function to return an associative array of
- constants mapped to their values. (Sean)
-- New mailparse extension for parsing and manipulating MIME mail. (Wez)
-- Define HAVE_CONFIG_H when building standalone DSO extensions. (Stig)
-- Added the 'u' modifier to printf/sprintf which prints unsigned longs.
- (Derick)
-- Improved IRIX compatibility. (Sascha)
-- Fixed crash bug in bzopen() when specifying an invalid file. (Andi)
-- Fixed bugs in the mcrypt extension that caused crashes. (Derick)
-- Added the IMG_ARC_ROUNDED option for the ImageFilledArc() function, which
- specified that the drawn curve should be rounded. (Sterling)
-- Updated the sockets extension to use resources instead of longs for the
- socket descriptors. The socket functions have been renamed to conform with
- the PHP standard instead of their C counterparts. The sockets extension is
- now usable under Win32. (Daniel)
-- Added disk_total_space() to return the total size of a filesystem.
- (Patch from Steven Bower)
-- Renamed diskfreespace() to disk_free_space() to conform to established
- naming conventions. (Jon)
-- Fixed #2181. Now zero is returned instead of an unset value for
- 7-bit encoding and plain text body type. (Vlad)
-- Fixed a bug in call_user_*() functions that would not allow calling
- functions/methods that accepted parameters by reference. (Andrei)
-- Added com_release($obj) and com_addref($obj) functions and the related class
- members $obj->Release() and $obj->AddRef() to gain more control over the used
- COM components. (phanto)
-- Added an additional parameter to dotnet_load to specify the codepage (phanto)
-- Added peak memory logging. Use --enable-memory-limit to create a new Apache
- 1.x logging directive "{mod_php_memory_usage}n" which will log the peak
- amount of memory used by the script. (Thies)
-- Made fstat() and stat() provide identical output by returning a numerical and
- string indexed array. (Jason)
-- Fixed memory leak upon re-registering constants. (Sascha, Zend Engine)
-
-23 Jun 2001, Version 4.0.6
-- Fixed memory fragmention problem which could lead to web server processes
- growing much more than they should. (Andi, Zend Engine)
-- Made $HTTP_SESSION_VARS['foo'] and $foo be references to the same value
- when register_globals is on. (Andrei)
-- Fixed disk_free_space() and disk_total_space() under FreeBSD. (Jon)
-- Fixed readfile/passthru losing resources during connection abort (Sascha)
-- Fixed bug in the mcrypt extension that caused segfaults when using a key
- that is too large for the used algorithm, and a bug that caused
- mcrypt_generic() to segfault PHP (Derick)
-- Fixed getopt so that it accepts command line arguments in the form
- -<opt><arg> and -<opt> <arg>. (Jmoore)
-- Fixed race in writing session files (Sascha)
-- Fixed a possible crash in the PHP CGI when no input file is
- specified (Zeev)
-- Added is_callable() function that can be used to find out whether
- its argument is a valid callable construct. (Andrei)
-- Fixed a rare possible crash when generating extended information. (Dmitri
- Dmitrienko, Zend Engine)
-- Improved virtual() to support PHP-enabled URIs. (Zeev)
-- Fixed undefined behavior when using floating point keys in array()
- expressions. (Zeev, Zend Engine)
-- Fixed a possible crash in case of parse errors in include files or eval
- statements. (Zeev, Zend Engine)
-- Added --with-layout configure option. (Stig)
-- Improved interactive mode - supports function calls, and works in
- multithreaded builds. (Zeev, Zend Engine)
-- Fixed a crash bug in interactive mode. (Zeev, Zend Engine)
-- Added pg_last_notice() function. (Rasmus from suggestion by Dirk@rackspace.com)
-- Fixed a bug in preg_split() that would incorrectly limit the number of
- results when used along with PREG_SPLIT_NO_EMPTY flag. (Andrei)
-- Added connection error support to mysql_error() and mysql_errno(). (Jason)
-- Added support to getimagesize to return dimensions of BMP and PSD
- files. (Derick)
-- Added heuristic to kill stale IRC connections, message scanner caching, and
- nickname escaping to IRCG, suppress option to ircg_msg(), and statistics to
- IRCG phpinfo() output. (Sascha)
-- Added Japanese multibyte string functions support. (Rui)
-- Added Mac OS X "\r" line ending support. (Andi, Zend Engine)
-- Fixed a bug regarding the $PHP_SELF being incorrectly registered when
- force-cgi-redirect was not enabled. (Sterling)
-- pfpro extension now supports version 3 of the Verisign SDK. (John Donagher)
-- Udm_Cat_List and Udm_Cat_Path functions has been added.
-- Added key_exists() to check if a given key or index exists in an
- array or object. (David Croft)
-- Modify the cURL extension to compile only with the latest cURL release.
- Backwards compatibility with regards to the extension api has not been
- broken. (Sterling)
-- Added the ability to use user-defined callbacks with cURL. (Sterling)
-- Added the SSL_VERIFYPEER, CAINFO, MAXREDIRS, FILETIME, RANDOM_FILE, EGDSOCKET
- and CONNECTTIMEOUT options to curl_setopt(). (Sterling)
-- Added support for persistent connections with cURL. (Sterling)
-- Fixed a problem in cURL with file descriptors being allocated, but never
- closed. (Sterling)
-- Fixed interactive mode (-a). It works again with the same limitations it
- has always had. (Andi, Zend Engine)
-- Improved memory manager to use less memory and provide better memory overflow
- detection abilities in debug mode. (Andi, Zend Engine)
-- Fixed resource leaks when resources were being cast to numbers. (Zeev, Zend
- Engine)
-- Fixed foreach() to not crash when being sent an invalid argument. (Andi, Zend
- Engine)
-- Fixed a bug in opendir() under Windows when trying to open a non-exisiting
- directory. (Andi)
-- Fixed popen() and the exec family under Win32 (Unable to fork issue). (Daniel)
-- Make the printf family of functions binary clean. (Rasmus)
-- Fixed WDDX serialization to HTML-escape key/variable names so as not to
- break the XML packet. (Andrei)
-- Made WDDX extension enabled by default. (Andrei)
-- Added -C command-line option to avoid chdir to the script's directory. (Stig)
-- Fixed a bug with /e modifier in preg_replace(), that would not correctly
- replace two-digit references if single digit references were present
- before them. This fixed bug #10218. (Andrei)
-- Added temporary LOB support in OCI8. (Patch by David Benson)
-- Fixed crash in pathinfo()
-- OCI8 now supports binding of collections. (Patch by Andy Sautins
- <asautins@veripost.net>)
-- Added GD 2.0.1 support for truecolor and alpha channels, plus some other gd
- functions, both old and new - see docs for more info. (Wez)
-- Added S/MIME sign/verify encrypt/decrypt functions to openssl extension,
- along with some other certificate manipulation and interrogation functions.
- See docs for more info. (Wez)
-- printf argnum (parameter swapping) support. (Morten Poulsen, Rasmus)
-- Add DIRECTORY_SEPARATOR constant ('/' on UNIX, '\' on Windows). (Stig)
-- Added small change to php_odbc module, to check for failed SQLDisconnects
- and to close any outstanding transactions if the call fails, then disconnect
- again. (lurcher)
-- Modified get_parent_class() and get_class_methods() to accept a class name as
- well as a class instance. (Andrei, Zend Engine)
-- Added support for UNC style paths. (\\server\share\file,
- //server/share/file). (Daniel, TSRM)
-- Added dbx module (database abstraction) to the repository. (Marc)
-- Using ITypeInfo instead of IDispatch if possible. This makes DCOM calls
- and even COM calls much faster.
- All ini settings are now prefixed by 'com.'.
- Now you need not provide a path to the file containing the typelib, you can
- also provide the GUID of the TypeLib - entry or an IID for preloading
- type - information. (Harald)
-- Rewrite of domxml. It's now mostly DOM Level 2 conform. (Uwe)
-- Added array_map() function that applies a callback to the elements
- of given arrays and returns the result. It can also be used with a
- null callback to transpose arrays. (Andrei)
-- Added array_filter(), which allows filtering of array elements via
- the specified callback. (Andrei)
-- Fixed all relevant array functions to avoid moving the internal array
- pointer during operations. (Andrei)
-- Added mysql_unbuffered_query(), which is useful for very large result sets.
- (Zeev)
-
-30 Apr 2001, Version 4.0.5
-- Added new php.ini directive: arg_separator.input which is used to tell
- PHP which characters are considered as argument separators in URLs.
- Renamed php.ini directive: arg_separator -> arg_separator.output (Jani)
-- Added FastCGI SAPI module. (Ben Mansell)
-- Added array_reduce(), which allows iterative reduction of an array
- to a single value via a callback function. (Andrei)
-- The imageloadfont function of the gd extension should be not platform
- dependent after this fix. (alex@zend.com)
-- Fixed a compatibility problem in some file functions (fgets, fputs, fread,
- fwrite). The ANSI standard says that if a file is opened in read/write
- mode, fseek() should be called before switching from reading to writing
- and vice versa. (alex@zend.com)
-- Fixed argument checking for call_user_func* functions and allowed
- specifying array($obj, 'method') syntax for call_user_func_array. (Andrei)
-- Fixed parent::method() to also work with runtime bindings.
- (Zeev, Zend Engine)
-- Implemented high-performance zlib-based output compression - see
- zlib.output_compression INI directive. (Zeev)
-- Improved ob_gzhandler() to support chunked output buffering - it's
- recommended to use it with 4KB chunks. (Zeev)
-- Fixed chunked output buffering. (Zeev)
-- Forced call_user_method() and call_user_method_array() to take the
- object argument by reference. (Andrei)
-- Fixed binding of ROWIDs in OCI8. (Thies)
-- Added PEAR/Cache as a generic Caching System. (Sebastian, PEAR/Cache)
-- Added IMAP quota support (imap_set_quota, imap_get_quota), enabled/added via
- c-client2000. (kalowsky)
-- Upgraded PCRE to version 3.4. (Andrei)
-- Added array_search which works similar to in_array but returns
- the key instead of a boolean. (jason@php.net)
-- Fixed pgsql transaction support. (Stig, PEAR/DB)
-- Added new object VARIANT() to encapsulate values for use with
- the COM and DOTNET module. Therefore it is now possible to pass
- values by reference, convert php values to extended variant types (currency,
- date, idispatch, iunknown, ...) and define the codepage that should
- be used for unicode - conversion.
-- Improved overall speed of IRCG, added URL handling to message scanner.
- (Sascha)
-- Fixed some modules to allow using output-buffering. (Thies)
-- Added the chroot() function. (Derick)
-- PostgreSQL now does a rollback at the end of a request on every
- persistent connection. This is done by doing an "empty" transaction
- on the connection. This was advised by someone from the PostgreSQL
- core-team. (Thies)
-- Fixed PostgeSQL pg_connect() bug. We would sometimes close the default
- link by accident. (Patch by: aja@nlgroup.ca)
-- Improved OCI8 dead-session detection. (Patch by: George Schlossnagle)
-- Fixed get_meta_tags() multiline bug #4556. (Sean)
-- Prefer random() over *rand48(). (JimJag)
-- Sped up WDDX serialization 2x. (Andrei)
-- Added a new parameter to mail() which appends aditional command line
- parameters to the mail program. (Derick)
-- Added Udm_Clear_Search_Limits mnoGoSearch extension function. (gluke)
-- Fixed mnogosearch protos. Fixed mnogosearch functions return values.
- A bug with capital letters break search has been fixed. (gluke)
-- Static methods can now be called via call_user_method_* functions, e.g.
- call_user_method('method', 'class'), and also array('class', 'method')
- constructs (for array_walk(), for example). (Andrei, Zend Engine)
-- microtime() under Windows now returns accurate values. (James)
-- Added PREG_SPLIT_DELIM_CAPTURE flag to preg_split() that allows for Perl-like
- functionality of capturing parenthesized delimiter expression. (Andrei)
-- Fixed strip_tags() to not strip a lone > character. (Rasmus)
-- When using the ob_gzhandler() PHP now automagically also sets the
- Content-Lengh correctly which enables browsers to use the HTTP
- Keep-Alive feature. (Thies)
-- Improved handling of preg_replace() /F modifier so that it's possible to
- specify array($obj, 'method') construct as a replacement function. (Andrei)
-- Added mysql_get_client_info(), mysql_get_server_info(),
- mysql_get_proto_info(), and mysql_get_host_info() functions. (Sean)
-- Major change of the php pdf api. It could break some functions though
- backwards compatibility was tried to maintain. Adding some still
- missing functions as well. (Uwe)
-- Added mnoGoSearch extension - http://search.mnogo.ru. (Sergey K)
-- Allow URL encoding in DB usernames and passwords. (Stig, PEAR)
-- Added raiseError and setErrorHandling methods to PEAR class. (Stig, PEAR)
-- Added support for converting images from JPG/PNG on the fly with the GD
- extension, which is usefull for creating dynamic WAP-sites. (Derick)
-- Updated ext/mysql/libmysql to version 3.23.32; bug fixes. (tim@mysql.com)
-- Fixed possible crash in all (non-pcre) regex functions. (Thies)
-- Improved str_replace() to accept an array for any parameter - similar
- to preg_replace(). (Andrei)
-- Fixed extract() to properly prefix numeric keys when EXTR_PREFIX_ALL is
- used. (Andrei)
-- Added EXTR_PREFIX_INVALID flag to extract() to automatically prefix
- string keys that do not constitute valid variable names. (Andrei)
-- BeOS patch from svanegmond@bang.dhs.org, modified somewhat by Rasmus.
-- Fixed the Apache module to overwrite PATH_TRANSLATED with SCRIPT_FILENAME,
- only if PATH_TRANSLATED is not previously set. (Zeev)
-- Fixed crash bug in highlight_string(). (Rasmus)
-- Added URL support for getimagesize() function. (Jani)
-- Added xslt_set_scheme_handler() function. (carmelo@akooe.com)
-- Added the pg_lolseek and pg_lotell functions. (Derick)
-- Fixed wrong breaking with the wordwrap function. (Derick)
-- Fixed 'O' and 'r' flags of date() to have correct sign for timezone
- offset. (Andrei)
-- Changed 'Z' flag to date() to always return timezone offset with
- negative sign if it's west of UTC. (Andrei)
-- Added the HTML_Processor class which provides common functions for
- processing HTML. (Sterling)
-- Added localeconv() and strcoll() functions for localization. (Sean)
-- Added the xslt_set_base function. (Sterling)
-- Added support for Zeus 3.3.8.
-- Added odbc_error() and odbc_errormsg() functions. (Stig)
-- New extension for vpopmail - http://www.inter7.com/vpopmail,
- give it a try, but keep in mind that it is not ready for production
- environments. (David Croft, Boian Bonev)
-- Added sybase_get_last_message() to the Sybase CT module. (Jan Fedak)
-- Made ldap_list(), ldap_read() and ldap_search() do parallel search when
- first parameter is an array of link identifiers. (Stig Venaas)
-- Made fopen() of HTTP URL follow redirects, $http_response_header will
- contain all headers with empty string as delimiter. (Stig Venaas)
-- Added Console_Getopt class for parsing command-line args. (Andrei, PEAR)
-- Added an experimental version of the ZZipLib extension which provides the
- ability to read zip files. (Sterling)
-- Allow access to uploaded files in safe_mode. Beware that you can only
- read the file. If you copy it to new location the copy will not have the
- right UID and you script won't be able to access that copy. (Thies)
-- Changed extract() to check that prefixed name is a valid one. (Andrei)
-- Changed extract() to return the number of variables extracted. (Andrei)
-- Added ldap_rename() function. (Stig Venaas)
-- Made ldap_set_option() support controls. (Stig Venaas)
-- Changed ldap_search() and added functions ldap_parse_result(),
- ldap_first_reference(), ldap_next_reference() and ldap_parse_reference()
- to cope with LDAPv3 stuff like referrals and references. (Stig Venaas)
-- Fixed date('r') overflow.
-- Made the php.ini path reported in phpinfo() always point to the absolute
- path that was opened. (Zeev)
-- Made the INI mechanism thread safe. (Zeev, Zend Engine)
-- Changed setlocale() to use LC_* constants. (Jani)
-- ctype functions now follow the extension naming conventions. (Hartmut)
-- Added iconv() function (using libc or libiconv). (Stig)
-- Added ODBC_TYPE constant. (Stig)
-- Added the call_user_method_array function which allows you to call a method
- with an arbitrary number of parameters. (Sterling)
-- ext/odbc: IBM DB2 patch by Walter Franzini. <walter@sys-net.it>
-- Added extension for the cracklib library. (Alexander Feldman)
-
-19 Dec. 2000, Version 4.0.4
-- Allow assigning a newly created object by reference. This is needed only if
- your constructor makes other data structures reference the $this object (for
- example, $GLOBALS["foobar"] =& $this;)
- The new syntax is $obj =& new MyClass(); (Andi, Zend Engine)
-- Allow for three expression types to be sent to functions which are requesting
- the function argument to be passed by reference (only c. was previously
- supported):
- a. func(new myclass());
- b. func(func2()); where func2() returns a reference, i.e. is defined as
- function &func2(...)
- {
- ...
- }
- c. func($var); where func() is defined as function func(&$var) {...}
- You CAN'T count on any other expressions to be passable by reference.
- (Andi, Zend Engine)
-- Made ldap_get_entries() return an array even if there are no entries
- in search result. (Jani)
-- Fixed bad mod_perl interaction which caused segfaults when using LFS (Sascha)
-- const CONSTNAME now gets recognized. Before the patch only @const CONSTNAME
- description was recognized.
-- Added the is_null() function that will return true if a variable is of
- type null. (Sterling)
-- Fixed a bug which made readdir() unusable in some systems. (Jani)
-- Added the get_defined_functions() function which returns a list of all
- currently defined functions. (Sterling)
-- Added the get_defined_vars() function which returns an associative array
- of all variables defined in the current scope and their subsequent values.
- (Sterling)
-- Added the call_user_func_array() function which gives you the ability to
- call a user function by passing an array of parameters as the second
- argument. (Sterling)
-- Added the constant() function which returns the value of a constant given
- the constant's name. (Sterling)
-- Implemented support for Perl-style matching regexp delimiters in PCRE.
- You can use <{[( and )]}> to delimit your expressions now. (Andrei)
-- Introduced new 'F' modifier in PCRE that lets you specify a function
- name in the replacement argument to preg_replace() that will be called
- at run-time to provide the replacement string. It is passed an array of
- matched pattern and subpatterns. (Andrei)
-- Put an end to BUG#4615 (kalowsky & Eric Veldhuyzen)
-- Added the IRCG extension (Sascha)
-- Fixed realpath() in Virtual Directory mode (Daniel)
-- Integrated the Phil Nelson's bc math library routines into PHP, now that
- the license allows it (Phil Nelson <phil@cs.wwu.edu>)
-- Added the xslt_set_error_handler() function to the Sablotron extension.
- (Sterling)
-- Improved Sablotron's error handling system allowing you to catch all
- errors before they are outputted to the screen. (Sterling)
-- Added OpenSSL extension (Stig Venaas)
-- Fixed/created support for Solid 3.0 databases (kalowsky)
-- Fixed support for Solid 2.3 databases (kalowsky)
-- quoted_printable_decode() function is made RFC-2045 compliant. (Kir)
-- Modified preg_grep() to always return the results with keys from the original
- array. (Andrei)
-- Modified preg_replace() to accept Perl-style $n backreferences in addition
- to \\n ones. (Andrei)
-- Modified preg_replace() to ignore backreferences that refer to
- non-existing subpatterns. (Andrei)
-- Fixed column-title buffer-overflow in OCIFetchStatement(). (Thies)
-- Added 'output_handler' INI directive (Zeev)
-- Fixed some buglets in the output buffering mechanism (Zeev)
-- Added transparent gzip compression support (Jade Nicoletti, Zeev)
-- Major overhaul of domxml. Added basic XPath support as well (Uwe)
-- Added 'r' flag to date() which generates an RFC822 formatted date, e.g.
- "Thu, 9 Nov 2000 16:33:01 -0500" (Colin)
-- In CGI mode, $HTTP_SERVER_VARS now includes all of the environment variables
- as well (Zeev)
-- Allow user to use mysql_use_result in mysql queries (Stas)
-- Fixed a memory leak that would occur when restarting Apache often
- (mookid@sigent.ru)
-- Fixed a bug that prevented $argv and $argc from being defined in the command
- line version of PHP (Stas)
-- Fixed a bug that prevented a changed compile-time extension_dir from
- affecting modules that were loaded via php.ini (Zeev)
-- Fixed a bug in ftp_mkdir() when used on ftp server which doesn't return
- the full path (Jani)
-- Added ImageCreateFromString() which creates an image stream out of
- e.g. a MySQL blob. (Mathieu)
-- Fixed a crash bug in imagewbmp() (Jani)
-- Changed the sablot configuration file so that if you use any version of
- Sablotron below 0.44 you must use Sablotron's built-in Expat libraries.
- (Sterling)
-- Added basic authentication support to thttpd (Sascha)
-- Added support for the Caudium webserver (http://caudium.net/). It's based
- on the Roxen SAPI module. Many bugs have been identified and fixed. (David)
-- Fixed mysql_close(), pg_close(), msql_close() and sybase_close() - they
- weren't properly closing the SQL connections (Zeev)
-- Fixed crypt() to supply random seed if none is given (Andi)
-- Made print_r() support recursive data structures, e.g. $GLOBALS. (Zeev)
-- Fixed a bug that caused PHP not to properly flush its output buffer, if more
- than one output buffer was used. (Zeev)
-- Fixed a bug that could draw the shutdown sequence of the PHP Apache module
- into an endless loop, under certain circumstances. It could cause Apache
- processes under Solaris to get stuck, especially when using output
- buffering. (Zeev)
-- Added support for serializing references (Stas)
-- Fixed conflict with OpenLDAP and Oracle 8.1.x (Jani)
-- parse_ini_file() supports a new optional 2nd argument that instructs it
- to divide the directives to arrays according to the sections in which they
- reside (Zeev)
-- parse_ini_file() is now thread-safe, and supported under Windows (Zeev)
-- Unified aborted-connection semantics of all SAPI modules (Sascha)
-- URL-opened files now store the HTTP response header in $http_response_header
- (Zeev)
-- Fixed array_rand() to shuffle results when the number of requested
- elements is the same as the number of elements in the array. (Andrei)
-- Added replace parameter to header() (Sascha)
-- Fixed handling of single quotes in transparent session-id mode (Sascha)
-- Fixed "php://*" fopen handler (Sascha)
-- Made rename work in threadsafe enviroments (Daniel)
-- Made session_destroy() close files before unlinking (Daniel)
-- Added array_sum() function. (Andrei)
-- Fixed a bug in session.c. The php_session_save_current_state did not check
- if mod_data is NULL and such situation is possible if the user calls
- session_module_name with a parameter. (alex@zend.com)
-- Added IIS Admin extension. (Frank)
-- OCIBindByName() now does better parameter-checking. (Thies)
-- Made read() binary-safe in sockets.c (Chris Vandomelen)
-- Made array_intersect() and array_diff() not alter order (Stig Venaas)
-- Made ldap_connect() accept URL in host parameter when using OpenLDAP
- 2.x. To use SSL, use ldaps://host/ as URL. (Stig Venaas)
-- Made resource type names visible, e.g. var_dump() and
- get_resource_type() display "file" for file resources. (Andrei)
-- Added the curl_getinfo() function to find out information about a CURL
- transfer. This function requires cURL 7.4.0 or above. (Sterling)
-- Added the CURLOPT_KRB4, CURLOPT_INTERFACE, CURLOPT_QUOTE, CURLOPT_POSTQUOTE,
- CURLOPT_QUOTE and CURLOPT_HTTPPROXYTUNNELL options. (Sterling)
-- Renamed the shm_* functions to shmop_* (Derick)
-- Updated ext/mysql/libmysql to version 3.23 (tim@mysql.com)
-- Added ldap_get_option() and ldap_set_option() functions (Stig Venaas)
-- Fixed a crash in CGI mode, in case no file was provided
- (Daniel Beulshausen& Zeev)
-- Fixed possible crash bug in imap_fetchstructure() (Jani)
-- Fixed possible crash bug in imap_open() (Jani & Mark Musone)
-- Added url_rewriter.tags configuration directive (Sascha)
-- Added CORBA client extension, ready for use (eriksson@php.net)
-- Fixed memory leak in x-httpd-source mode (Jason Greene)
-- Changed ext/gd not to be enabled by default (Jani)
-- Make increment of empty string ("") behave like in PHP 3 and result in "1"
- (Andi, Zend Engine)
-- Added POST handler for Adobe FDF format (Hartmut)
-- Added transparent read and write .gz-files on glibc based systems
- using the 'zlib:' fopen wrapper (Hartmut)
-- Fixed a problem in the configuration parser (two null bytes were added
- to each ENCAPSULATED TC_STRING) (alex@zend.com)
-- Added HMAC support in the mhash module (nmav@altera.gr)
-- Added module for Ovrimos sql server (nmav@altera.gr)
-
-11 Oct 2000, Version 4.0.3
-- Fixed a possible crash in -a interactive mode (Zeev, Zend Engine)
-- Added mysql_escape_string() (Peter A. Savitch and & Brian Wang)
-- Fixed many possible crash bugs with improper use of the printf() family of
- functions (Andi)
-- Fixed a problem that allowed users to override admin_value's and admin_flag's
- (Zeev)
-- Fixed PostgreSQL module to work when the link handle is omitted (Zeev)
-- Fixed returning of empty LOB fields in OCI8. (Thies)
-- Added Calendar module to default Win32 build (Andi)
-- Added FTP module to default Win32 build (Andi)
-- Fixed crash in the POSIX getrlimit() function (alex@zend.com)
-- Fixed dirname() under certain conditions (Andi)
-- Added --with-imap-ssl to support SSL'ized imap library in RH7 and others
- (Rasmus)
-- Fixed possible crash bug in parse_url() (Andi)
-- Added support for trans sid under Win32 (Daniel)
-- Added IPv6 support in fopen (Stig Venaas)
-- Added the shmop extension. It allows more general ways of shared memory
- access. (thanks to Ilia Alshanestky <iliaa@home.com> and Slava Poliakov
- <slavapl@mailandnews.com> (Derick)
-- Added the ability for CURLOPT_POSTFIELDS to accept an associative array of
- HTTP POST variables and values. (Sterling)
-- Added the CURLOPT_HTTPHEADER option to curl_setopt(). (Sterling)
-- Added the curl_error() and curl_errno() functions. (Sterling)
-- Changed ext/db not to be enabled by default (Jani)
-- Fixed building Apache SAPI module on SCO UnixWare (Sascha)
-- Fixed writing empty session sets to shared memory (tcarroll@chc-chimes.com)
-- Added support for BSD/OS make (Sascha)
-- Added improved URL rewriter (Sascha)
-- Fixed readdir_r() use on Solaris (Sascha)
-- Improved HTTP headers for private-caching (jon@csh.rit.edu, Sascha)
-- Added new function session_cache_limiter (jon@csh.rit.edu, Sascha)
-- Added ftp_exec to the ftp functions (thanks to <jhennebicq@i-d.net>)
- (Derick)
-- PEAR: add last executed query as debug info in DB errors (Stig)
-- PEAR: allow multiple modes in PEAR_Error (Stig)
-- Made the Sybase CT module thread safe (Zeev)
-- Added second argument to array_reverse() that indicatese whether
- the original array keys should be preserved. (Andrei)
-- Clean up htmlspecialchars/htmlentities inconsistencies. (Rasmus)
-- PEAR: renamed DB_GETMODE_* to DB_FETCHMODE_*, added setFetchMode()
- in DB_common to set the default mode, added some MySQL tests (Stig)
-- Made eval() and several other runtime-evaluated code portions report the
- nature and location of errors more accurately (Stas)
-- Added an optional parameter to wordwrap that cuts a string if the length of a
- word is longer than the maximum allowed. (Derick)
-- Added functions pg_put_line and pg_end_copy (Dirk Elmendorf)
-- Added second parameter for parse_str to save result (John Bafford)
-- Fixed bug with curl places extra data in the output. (medvitz@medvitz.net)
-- Added the pathinfo() function. (Sterling)
-- Updated sybase_ct module and its sybase_query to use high performance API.
- (Joey)
-- Added a more configurable error reporting interface to DB. (Stig)
-- Added is_uploaded_file() and move_uploaded_file() (Zeev)
-- Added several directives to php.ini - post_max_size, file_uploads,
- display_startup_errors - see php.ini-dist for further information (Zeev)
-- Worked around a bug in the libc5 implementation of readdir() (Stas)
-- Fixed some potential OpenBSD and NetBSD crash bugs when opening files. (Andi)
-- Added EscapeShellArg() function (Rasmus)
-- Added a php.ini option session.use_trans_sid to enable/disable trans-sid.
- (Sterling)
-- Added the Sablotron extension for XSL parsing. (Sterling)
-- Fixed a bug in checkdate() which caused < 1 years to be valid (Jani)
-- Added support for an optional output handler function for output
- buffering. This enables transparent rendering of XML through XSL,
- transparent compression, etc. (Zeev)
-- Added support for user defined 'tick' callback functions. This helps
- emulate background processing. (Andrei)
-- Fixed problem with having $this as the XML parser object. (Andrei)
-- Internal opened_path variable now uses the Zend memory manager so that full
- paths of files won't leak on unclean shutdown (Andi)
-- Removed support of print $obj automatically calling the __string_value()
- method. Instead define yourself a method such as toString() and use
- print $obj->toString() (Andi, Zend Engine)
-
-29 Aug 2000, Version 4.0.2
-- Added PHP API for Zend's ticks. (Stig)
-- PHP 3 regression testing framework re-born (Stig)
-- Added php_uname() function (Stig)
-- Made a minor change to allow building with OpenLDAP 2.0 (Stig Venaas)
-- Fixed a bug in preg_replace() that would truncate subject string if the
- first argument was en empty array. (Andrei)
-- Added ob_get_length function (Stig)
-- Fixed a bug that did not respect limit parameter in preg_replace() when
- using /e modifier. (Andrei)
-- Added ability for each xml_set_*_handler() function to take the
- array($obj, 'method') syntax for the handler argument as well
- as the normal function name. (Andrei)
-- Updated array_walk() to be able to accept array($obj, 'method')
- syntax for the walk function. (Andrei)
-- Fixed segfault with fgets(), fgetcsv(), fgetss(), and fread() when
- called with negative length argument. (Torben)
-- Fixed by-reference parameters passing for xml_ functions and for scanf
- functions (Stas)
-- Added experimental Oracle LDAP SDK support. 8.1.6 or later needed. Configure
- with something like --with-ldap=/usr/local/oracle/product/8.1.6 (Stig Venaas)
-- Fixed memory leaks in eval(); A script that used eval() extensively, could
- end up consuming very large amounts of memory during execution (Zeev, Zend
- Engine)
-- Fixed memory_limit feature, which did not work properly in previous versions
- (Zeev, Zend Engine)
-- Fixed stdout support with the swf extension. (Sterling)
-- Fixed byte order for ip2long and long2ip (Stas)
-- Fixed dbase_add_record. (Sterling)
-- Added support for libmcrypt 2.4.4 (Derick)
-- Added strncasecmp function (Andi, Zend Engine)
-- Fixed FTP module to accept multiline server replies (Jani)
-- Fixed switch which only has a single default rule. (Andi, Zend Engine)
-- Fixed problem with nested foreach()'s. (Andi, Zend Engine)
-- The CCVS module is now stable and compiling. It compiles as a CGI and into
- Apache cleanly without warnings. (Brendan W. McAdams)
-- Fixed mSQL_close(). (nick@loman.net)
-- Made return() in a require()'d file work like return() in an include()'d
- file (Andi & Zeev, Zend Engine)
-- Changed require_once() to work using the same table as include_once()
- (Andi & Zeev, Zend Engine)
-- Fixed PostgreSQL module to work when the link handle is omitted (Zeev)
-- Fixed the Sybase modules to work properly with PHP 4.0 (Zeev)
-- Fixed CLOB handling in OCI8 driver when using variable-width
- character sets. (Thies)
-- Added 4th optional parameter to sybase_[p]connect to specify the charset
- for the connection (alf@alpha.ulatina.ac.cr)
-- Fixed support for current thttpd releases. (Sascha)
-- Added support for kerberized IMAP library using --with-kerberos
- (Rasmus, Sascha)
-- Virtualize realpath, chmod, chown and utime (Stas)
-- Support content-encoding headers in file upload MIME parts
- (Ragnar Kjørstad)
-- Fixed warning when shutting down OCINLogon() connections. (Thies)
-- Fixed \n in session variables bug on Win32 (Stas)
-- OCIError() would sometimes not report failed connections. (Thies)
-- Fixed HEAD request bug on an Apache ErrorDocument redirect and preserve
- the status code across the redirect as well. (Rasmus)
-- Added Olympus-specific tags to read_exif_data() (Rasmus)
-- Fixed bug in imap_fetchheader() where using FT_PREFETCHTEXT didn't return
- the body. Bug #4447. (Jani)
-- Fixed exec() returning "\0" when output is empty
-- Added XML_Parser class in PEAR (Stig)
-- Added "make test" target in pear/ and added some regression tests (Stig)
-- Fixed bug in strip_tags function as per bug #5857 (Rasmus)
-- Fixed reading of IPTC via GetImageInfo() for certain JPEG files. (Thies)
-- Improved the output-buffering functions to be re-entrant (Zeev)
-- Made ldap_add(), ldap_modify(), ldap_mod_add(), ldap_mod_replace()
- binary-safe. Original patch: Terrence Miao <terrence_miao@email.com> (Jani)
-- CGI aka. command line version has now an option '-l' for syntax check
- without execution (Hartmut)
-- Fixed bug in ldap_get_values_len() which makes it NULL-safe. (Jani)
-- Bug-report and fix submitted by Michel Alexeline <alexel@dr15.cnrs.fr>
-- Make ext_skel create a Makefile.in set up to handle shared extension
- support automatically (Rasmus)
-- Fixed php_realpath not to die on non-existing files (needed for touch())
- (Stas and china@thewrittenword.com)
-- Fixed get_browser() function (Stas)
-- Fixed symbol clash which caused a DSO problem on OpenBSD (Rob Black and
- anil@recoil.org)
-- Added new function: ldap_compare(). (Jani)
-- Fixed a bug in ldap_get_entries() and ldap_get_attributes(). (Jani)
-- Ported DB to new error reporting scheme in PEAR. (Stig)
-- Added sybase and ibase DB backends in PEAR. (Sterling)
-- New PEAR package Payment_Verisign for use with the Payflow Pro
- (pfpro) extension. (David Croft)
-- Added CURL support. (Sterling)
-- Catch users trying to set "compatibility" parameter in PDF, which is not
- supported from user-land. (Joey)
-- Fixed dbase_add_record. (Sterling)
-- Added new function wordwrap() to wordwrap long strings from Chris
- Russel <russel@yorku.ca> (David Croft)
-- Added four additional arguments: attrsonly, sizelimit, timelimit, deref which
- were missing in ldap_search(), ldap_list() and ldap_read() functions (Jani)
-- Fixed a bug in ldap_search/list/read() which prevented returning the partial
- results when 'Sizelimit exceeded' error occurred. (Jani Taskinen)
-- Fixed preg_replace() to automatically escape quotes in matched
- strings when using /e modifier. (Andrei)
-- Itanium patch (Steve Robb)
-- Set default include_path so PEAR files can be reached (Stig)
-- Added "pear" executable, requires CGI version installed (Stig)
-- Added extension ii for Ingres II native support. See README in ext/ingres_ii
- directory. (David H)
-- Added Win32 project for the Interbase module (Zeev)
-- Added ability to perform calls to the parent class without explicitly
- specifying its name, using parent::func_name(...) (Zeev, Zend Engine)
-- You can now call Ora_Error() without prameters to get the reason
- for a failed connection attempt. (Kirill Maximov)
-- New extension "pfpro" for interface with Verisign Payflow Pro (David Croft)
-- Added IMG_GIF, IMG_JPG, IMG_JPEG, IMG_PNG and IMG_WBMP constants for
- imagetypes() function (Rasmus)
-- Added ImageTypes() function which returns a bitfield with the supported
- image formats. 1=gif, 2=jpeg, 4=png and 8=wbmp (Rasmus)
-- Make it possible to specify an empty string as a thousands-seperator
- in number_format() (Rasmus)
-- Shared module support for LDAP extension (Troels Arvin)
-- Fixed a bug with imap_mail where apache would segfault if the rpath
- parameter was specified.
-- Use dashes and short day name in cookies since some browsers seem picky
- about this (Rasmus)
-- Added pspell module. (Vlad)
-- Added 3 additional arguments to the user-defined error handler - the file
- name and line number in which the error occured, and the context (local
- variables) of the code in which the error occured (Zeev, Zend Engine)
-- Improved the error handling code to handle an error in a user-defined error
- handling function (Zeev, Zend Engine)
-- Fixed leak when using string offsets in the array() construct.
- (Andi, Zend Engine)
-- Fixed corruption problem when changing deeply nested values in objects.
- (Andi & Zeev, Zend Engine)
-- Improved array_multisort() to be able to specify sort type as well sort
- order. Incidentally, it can be used to sort multi-dimensional arrays
- as well. (Andrei)
-- Fixed a possible data corruption in case of a huge amount of aborted requests
- (Zeev)
-- Apache module would sometimes close a wrong file-descriptor. (Sascha)
-- Fixed use of alternative storage handlers in the session module. (Sascha)
-- Updated str_pad() to be able to pad on left/right/both sides. (Andrei)
-- Fixed crash in gzopen(). (Thies)
-- Multiple character set support in gdttf.c (Rob Goodwin)
-- When using HTTP auth from PHP, fill in the %u custom log field so the
- authenticated used id will get logged in the Apache access_log (Rasmus)
-- Support for pdflib 3.01. (Uwe)
-- FDF Data is handled properly and can be accessed by reading
- HTTP_RAW_POST_DATA. (Uwe)
-- Added new 'O' format modifier that will output the GMT offset as "[+-]HHMM"
- (eg: Pacific time is -0700). This is useful for things such as Date: mail
- headers. (Mike W)
-- Fixed crash on OCI?Logon() failure. (Thies)
-- Make the special Header("http/...") response be case insensitive like 3.0
- (Rasmus)
-- Allow cybercash to compile as a DL module. (Sterling)
-- Fixed the dbase_create function. (Sterling)
-- Fixed a problem under some versions of Windows that could cause PHP to hang
- on startup if errors occured, e.g. in the php.ini file (Zeev)
-- Fixed opendir() again. It should actually work well continuously now (Zeev)
-- Added three additional arguments to be sent to a user-defined error handler -
- the filename and line number in which the error occured, and the context
- (the local variables) of the error (Zeev, Zend Engine)
-- Improved the error handling code to handle an error in a user-defined error
- handling function (Zeev, Zend Engine)
-- Added an optional parameter to preg_replace() that can be used to
- specify how many replacements to make. (Andrei)
-
-28 Jun 2000, Version 4.0.1
-- Fixed a possible crash in the LDAP modify code. (Eric Kilfoil)
-- Fixed a bug in opendir(), which prevented readdir() from working properly if
- the $dir argument wasn't explicitly specified (Zeev)
-- Made --enable-discard-path work again. (Andi)
-- Removed 8KB limit on line length of the file() function (Zeev)
-- Disabled dl() when PHP is being used as a module inside a multithreaded web
- server - it didn't work before, and caused weird results (Zeev)
-- Added the ImageColorClosestHWB(), ImageCopyMerge() and ImagePaletteCopy()
- functions. (Sterling)
-- Added ImageCreateFromWBMP() function. (Jouni)
-- Fixed problems with POST requests under the NSAPI module. (Roberto Biancardi)
-- Added spliti() function. (Thies)
-- Fixed serializer behaviour with regards to serializing objects whose class
- definition was not available in the deserializing context. (Sascha)
-- Improve memory cache performance and increase cache size. (Stas, Zend Engine)
-- Added a crc32 checksum function - used by the UdmSearch search engine
- and currently run through a system call. This will speed up the UdmSearch
- php frontend significantly. (Rasmus)
-- Modified in_array() to not touch array pointer. (Andrei)
-- Added restore_error_handler(). (Zeev, Zend Engine)
-- Fixed erroneous file names and line numbers in error situations under the
- multithreaded version of PHP - most noticeably Win32 (Zeev, Zend Engine)
-- Fixed problem with CGI crashing on certain servers especially Windows Apache
- & O'Reilly website (Andi)
-- Added Pi3Web SAPI module; run ./configure --with-pi3web to enable this.
- (Holger; zimpel@t-online.de)
-- Enhanced WDDX functions to call __sleep() and __wakeup() when working on
- objects. (Andrei)
-- Changed WDDX to serialize arrays as structs only if needed. (Thies)
-- Implemented max_execution_time under Win32 (Zeev)
-- Updated strtotime() to handle many more formats. It now has complete
- feature parity with GNU date command. (Andrei)
-- Added support for multiple arguments in unset(). (Faisal, Zend Engine)
-- Functions that expect a resource but are passed something else now return
- NULL instead of FALSE. (Thies, Zend Engine)
-- Fixed gmmktime(), on certain systems it incorrectly adjusted for the timezone
- offset and daylight savings time. (Andrei)
-- Moved VC++ Win32 project and workspace files to the win32 directory
- (Zeev)
-- Fixed checkdate() to not return true on non-numeric arguments (Rasmus)
-- Added --enable-c9x-inline option for compilers which support the new C9x
- standard. If you encounter undefined references to i_zend_is_true and
- other symbols, you should enable this. (Sascha, Zend Library)
-- Fixed a problem in ldap_add() and ldap_modify(), sometimes added trailing
- garbage to the values (Stig Venaas)
-- Fixed a problem with dbmopen() not handing 'c' correctly with dbm/db/ndbm
- databases. (JimJag)
-- Fixed a crash in number_format() when used with locales. (Andrei)
-- Fixed an initialization problem in the MS-SQL problem that could cause
- a crash in mssql_query() (Zeev)
-- Upgraded PCRE to version 3.2 and fixed a bug when anchored pattern
- matched an empty string. (Andrei)
-- Fixed a bug that prevented PHP from paying attention to the extension_dir
- directive with extensions that were loaded from the php.ini file (Zeev)
-- Changed set_error_handler() to return the name of the previously defined
- error handler, if any (Zeev, Zend Engine)
-- Declared <?php_track_vars?> officially dead. It didn't work in PHP 4.0.0
- either, but now it's gone for good (Zeev)
-- Make convert_cyr_string() binary safe and stop it from corrupting other
- PHP variables. (Andi)
-- Added functions array_unique, array_intersect and array_diff (Stig Venaas)
-- Fixed problem when using uninitialized values in comparisons with strings.
- They behave as empty strings again just like in PHP 3.
- (Andi & Zeev, Zend Engine)
-- Fixed 'Z' flag in date() to adjust for daylight savings time. (Andrei)
-- Fixed var_dump() not to modify the internal order of array elements (Zeev)
-- Fixed stripcslashes() to remove to strip \ in unknown escapes instead of
- leaving it. (Andrei)
-- Changed WDDX to always serialize arrays as structs. (Andrei)
-- Fixed include_once() to issue a warning in case the supplied file name is
- not found (Zeev, Zend Engine)
-- Fixed a bug in get_declared_classes() which could return the same class
- multiple times under certain circumstances (Zeev, Zend Engine)
-- Fixed a bug in rawurldecode() that would cause in rawurldecode() corrupting
- its argument (Zeev)
-- Parse errors (or other errors) in the php.ini files under Windows will no
- longer mess up the HTTP headers in CGI mode and are now displayed in a
- message box (Zeev)
-- Fixed a crash in OCIFetchStatement() when trying to read after all data
- has already been read. (Thies)
-- fopen_wrappers() are now extensible via modules (Hartmut Holzgraefe)
-- Make trim strip \0 to match php 3 (Rasmus)
-- Added function imagecreatefromxbm(). (Jouni)
-- Added function imagewbmp(). (Jouni, based on patch from Rune Nordbøe
- Skillingstad)
-- Added str_pad() for padding a string with an arbitrary string on left or
- right. (Andrei)
-- Made the short_tags, asp_tags and allow_call_time_pass_reference INI
- directives work on a per-directory basis as well, e.g. from .htaccess
- files. (Zeev)
-- Added fflush() function. (Eric Huss)
-- Fixed a problem with static variables, default function arguments and class
- member variables, that contained array values. (Andi & Zeev, Zend Engine)
-- Fixed virtual() when used with output buffering (Marc Pohl)
-- Clean up constants in flock() function and add optional 3rd arg which
- is set to true on EWOULDBLOCK (Rasmus)
-- Added functions pg_loimport(), pg_loexport(). (Jouni)
-- Added SWF support to getimagesize() function (Derick Rethans)
-- Added support for both indexed and non-indexed arrays of file uploads
- eg. name="file[]" type="file" (Rasmus)
-- Added create_function(), which gives the ability to create functions
- on-the-fly (Zeev, Zend Engine)
-- Added support for comparisons of arrays (with arrays) and objects (with
- objects); The equality operator (==) performs an unordered comparison,
- whereas the identity operator (===) performs an ordered comparison (Zeev,
- Zend Engine)
-- Allow all functions that receive user-defined function callbacks to accept
- an array that contains an object and a method name, in place of a function
- name, e.g. usort($array, array($obj, "ObjSort")) (Zeev, Zend Engine)
-- Added set_error_handler() to allow custom error handling functions,
- instead of the built-in error handling code (Zeev, Zend Engine)
-- Renamed user_error() to trigger_error(); user_error() remains
- defined for compatibility (Zeev, Zend Engine)
-- Fixed the global/static statements to require a trailing terminating
- semi-colon ';'. (Andi, Zend Engine)
-- Cleaned up PCRE extension and made it binary-safe. (Andrei)
-- Added third argument to in_array(). If it's true, then in_array()
- will use strict comparison instead of the default one. (Andrei)
-- Added pg_trace() and pg_untrace (Dominic J. Eidson & Zeev)
-- ignore_user_abort=Off is now default. (Thies)
-- Added array_merge_recursive() that will recursively merge values
- under the same keys. (Andrei)
-- fixed crash in OCIParse when parsing invalid SQL. (Thies)
-- Fixed a bug in mysql_connect() that made it ignore the socket argument, in
- case of non-persistent connects (Zeev)
-- Added disable_functions php.ini directive, to allow administrators to disable
- certain functions for security reasons (Zeev)
-- Fixed sessions on Win32. When setting the directory depth parameter in
- save_path you need to now delimit it with a ';' instead of ':', e.g
- "5;/tmp" instead of "5:/tmp" (Andi)
-- Changed the Apache handler's return status to 'Declined' when a requested
- PHP file could not be found. Returning 'Not Found' caused problems
- in the ErrorDocument handler stage in that $REDIRECT_REDIRECT_ERROR_NOTES
- was not getting set at all. Moving to 'Declined' should fix this and I
- can't see any other side effects. (Rasmus)
-- Fixed scanning decimal numbers in internationalized environments. They should
- always be in standard US format e.g. 23.3. (Andi, Zend Engine)
-- Added second argument to preg_quote() which allows quoting of
- one additional character, usually the regex delimiter. (Andrei)
-- Uncommitted outstanding OCI8 transactions are now rolled back
- before the connection is closed. (Thies)
-- ignore_user_abort() & friends should now work in CGI mode as well.
- (Patch by daniel.braun@ercom.fr)
-- Added extension YAZ (dickmeiss).
-- Fixed a crash bug triggered by certain cases of class redeclarations
- (Stas & Zeev, Zend Engine)
-- Fixed min()/max() segfault. (Andrei)
-- New module for reading EXIF header data from JPEG files. Most digital
- cameras will embed all sorts of information about a picture inside the
- jpeg images it generates. (Rasmus)
-- Fixed basename() bug where "file.ext///" would not return the same
- as "/path/file.ext///" (Rasmus)
-- Added the swf_ortho function. (Sterling)
-- Moved to virtual current working directory support. This highly improves the
- functionality and stability of multi-threaded versions of PHP (Andi, Sascha)
-
-22 May 2000, Version 4.0.0 Release
-- Allow the writing of flash files to stdout.
-- Fixed a crash bug in .phps syntax-highlighted files (Andi)
-- Improved round() to allow specification of rounding precision.
- (Andrei, Todd Kirby <kirbyt@yahoo.com>)
-- Added SORT_REGULAR, SORT_NUMERIC, SORT_STRING flags that can be used with
- non-user sort functions for precise sorting behavior. (Andrei)
-- Fixed two 64-bit issues (startup crash, gethostbyaddr). (Sascha)
-- NULL values are now preserved in the return value of mysql_fetch_array()
- and mysql_fetch_object(). (Andrei)
-- Ported InterBase module finally from PHP 3 to PHP 4. Full support for
- InterBase 6. (Jouni)
-- Added swf_definepoly for drawing polygons to the SWF functions. (Sterling)
-- Ported imagegammacorrect from PHP3 to PHP4. (Sterling)
-- Added array_rand() function. (Andrei)
-
-8 May 2000, Version 4.0 Release Candidate 2
-- NSAPI WIN32 Module compilable, untested (Shane)
-- Apache WIN32 Module compilable and lightly tested. (Shane)
-- Enabled assert() by default in php.ini-dist. (Andrei)
-- Put in safeguards in case dynamic code evaluation in assert() and
- preg_replace() with /e modifier fails. (Andrei)
-- Fixed infinite recursion when serializing $GLOBALS[] in WDDX. (Andrei)
-- Made WDDX serialization properly escape <, >, and &. Also speeded up
- the serialization in general. (Andrei)
-- Moved install-local to install-sapi for clarity. (Joey)
-- Improved extension build framework. Refer to README.SELF-CONTAINED-EXTENSIONS
- for an introduction. (Sascha)
-- ImagePolygon() is no longer limited by a maximum number of polygons.
- (Marc Pohl)
-- Added configure time checking for bcmath package. (Joey, Sascha)
-- Added get_declared_classes(). (Andrei, Zend Engine)
-- Added initial NSAPI module from Jayakumar Muthukumarasamy. (Rasmus)
-- Added the SWF module which allows you to create Macromedia Flash files via
- libswf. (Sterling)
-- Improved UNIX build system to support more vendor make tools (Sascha)
-- Updated natural comparison/sorting algorithm by Martin Pool
- <mbp@humbug.org.au>. (Andrei)
-- Fixed a crash in array_multisort() that happened when empty arrays
- were passed to it. (Andrei)
-- Added substr_count() from Peter Kovacs. (Andrei)
-- Added an optional third argument to fseek to indicate where to seek from.
- (Andrei)
-- OCIBindByName() will no longer complain about bindlength beeing zero. (Thies)
-- Converted the IMAP module to the high performance API (Zeev)
-- The fgetcsv() function now handles embedded end-of-line in a quoted field
- (Nick Talbott)
-- Added user_error(), to allow explicitly generate error messages from scripts
- (Zeev, Zend Engine)
-- Fixed a problem in long2ip() that occasionally returned incorrect IP address.
- (Evan, Andrei)
-- Fixed many memory leaks in the IMAP module (Stas, Andi, Zeev)
-- Fixed bug in number_format (Jon Forsberg)
-- Make error_prepend_string and error_append_string work (Rasmus)
-- array_walk() now automatically resets the array. (Andrei)
-- Added natural comparison/sorting routines strnatcmp(), strnatcasecmp(),
- natsort(), and natcasesort(). These are useful for comparing and sorting
- strings that contain numbers. Based on the code from Martin Pool
- <mbp@humbug.org.au>. See http://www.linuxcare.com.au/projects/natsort/
- for more info on natural sorting. (Andrei)
-- Zeus Webserver support (version 3.3.6+) for ISAPI (Ben Mansell)
-- Fixed several problems with the PATH_TRANSLATED and PHP_SELF under Apache
- (Paul Gregg & Zeev)
-- Ported ldap_get_values_len() function from PHP3 to PHP4. (Sterling)
-- Fixed a problem in include_once() with non constant arguments (Andi & Zeev,
- Zend Engine)
-- Added php.ini-optimized (Zeev)
-- Ported ldap_errno(), ldap_err2str() and ldap_error() from PHP3 to PHP4.
- (Sterling)
-- WDDX now defaults to ISO-8859-1. (Thies)
-- Fixed crash resulting from IMAP's error handling (Stas)
-- Added $HTTP_POST_FILES[filename][tmp_name] - it was previously impossible to
- retrieve the temporary name of an uploaded file using $HTTP_POST_FILES[]
- (Zeev)
-- Made the IMAP and LDAP modules compilable under Windows and thread-safe
- (Zeev)
-- Fixed a problem when dealing with large POST blocks in CGI mode (Zeev)
-- Added session_get_cookie_params() function. (Sterling)
-- Fixed return of stristr() to no longer always be lowercased. (Andrei)
-- Changed the Windows version of PHP so that a php.ini file is no
- longer mandatory (Zeev)
-- session_start() is now more verbose if headers cannot be send. (Thies)
-- Fixed a memory leak when using assign-op bitwise operators on strings (Zeev,
- Zend Engine)
-- Added support for reading properties that require arguments in the COM
- module - writing to them will only be supported in PHP 4.1 (Zeev)
-- Fixed a very old legacy memory leak in the COM module (Zeev)
-- Fixed problems with object-overloading support - noteably, COM and Java
- (Zeev, Zend Engine)
-- Fixed an overrun in WDDX. (Thies)
-- Fixed a crash bug with modules loaded through dl() not properly freeing their
- resources (Zeev, Zend Engine)
-- Added localtime() function. (Sterling)
-- Added the 'I' format option for the date function, this option will return
- true or false depending on whether or not daylight savings time is in effect.
-(Sterling)
-- Added gmstrftime() function. (Sterling)
-- snmp_walkoid is now an alias for snmp_realwalk. (Sterling)
-- Fixed a bug that could cause a crash when using 'global' inside large include
- files (Stas, Zend Engine)
-- Added --enable-libgcc switch to force linking against libgcc (Sascha)
-- Fixed dynamic loading where extension_dir had no trailing slash (Sascha)
-- Fixed dynamic loading on OpenBSD (Sascha)
-- Improved POSIX threads check. ZTS works now on at least Linux, Solaris,
- FreeBSD and OpenBSD (Sascha, TSRM)
-- Added !== operator support. (Torben, Zend Engine)
-
-27 March 2000, Version 4.0 Release Candidate 1
-- Added support for UCD-SNMP 4.1.x (Sascha)
-- Fixed a data corruption bug in mysql_result(), if used in table.fieldname
- mode (Zeev)
-- Fixed a crash problem in func_num_args(), func_get_arg() and func_get_args()
- when used as function arguments (Andi, Zend Engine)
-- Added get_class_methods(string classname) function. (Andrei)
-- Added 'I' switch to test whether or not DST is active. (Sterling)
-- Fixed a data corruption bug in mysql_result(), if used in table.fieldname
- mode (Zeev)
-- Modified the registry INI entry reader (Win32) to work with drive letters.
- For example, if you wish to wish to specify INI entries for C:\foo\bar, you
- should create HKLM\PHP\Per Directory Values\C\foo\bar in the registry, and add
- string values for each directive you want to override in this directory (Zeev)
-- Fixed extract() for EXTR_PREFIX_SAME and EXTR_SKIP cases. (Andrei)
-- stristr() no longer modifies it's arguments. (Thies)
-- Don't default to iso-8859-1 since this confuses some browsers. (Rasmus)
-- Make it possible to specify both a port and a socket
- in mysql_[p]connect. (Rasmus)
-- Added --disable-pic for disabling generating PIC for shared objects
- on platforms which support it (i.e. Linux) (Sascha)
-- serialize()/unserialize() now call __sleep() and __wakeup() when
- working on objects. (Thies)
-- renamed to_string() method to __string_value() for consistency.
- (Thies, Zend Engine)
-- Fixed a bug in the third argument to define()
-- Added is_numeric() that returns true if the argument is a number
- or a numeric string. (Andrei)
-- domxml now supports libxml 2.0 Beta and drops support for older versions,
- due to massive changes in libxml
-- fixed possible crash in unserialize() if serialized data was
- corrupted. (Thies)
-- Changed $HTTP_STATE_VARS to $HTTP_SESSION_VARS. Use only the latter
- version now! (Andrei)
-- Added GD-JPEG Support (Rasmus)
-- Prevent from loading dynamic PHP modules which were compiled with different
- debug and thread safety modes than PHP, which resulted in a crash (Andi)
-- connection_aborted() and friends work again (Thies)
-- Upgraded to libtool 1.3.4 (Sascha)
-- UNIX configure creates config.nice in the build directory now which allows
- easy reuse of configuration options (Sascha)
-- Added support for embedded MySQL client library. Unless you specify a path
- to --with-mysql, the bundled MySQL client library will be used (Sascha)
-- Added include_once() and require_once() functionality (Andi, Zend Engine)
-- Removed support for pdflib < 3.0 (Uwe)
-- Added auto-registration of everything in $HTTP_SESSION_VARS[] if
- register_globals is turned off. (Andrei)
-- Cleaned up extension namespace (Stig)
-- OCINLogon() sessions are now closed again. (Thies)
-- Added ip2long() and long2ip(),
- courtesy of Faisal Nasim <faisal@nasim.org> (Andrei)
-- Added ftruncate() and fstat(),
- courtesy of Faisal Nasim <faisal@nasim.org> (Andrei)
-- Added parse_ini_file(). Currently implemented in non thread safe version
- of PHP, and currently lacks section support (Zeev)
-- "none" is now equivalent with "" in Apache config directives (Stig)
-- OCINLogon no longer crashes. (Thies)
-- Fixed comparisons of (string) "nan" with (string) "nan". (Thies, Zend Engine)
-- Switched back to the old $HTTP_*_VARS[] behavior - $HTTP_GET_VARS["foo"]
- and $foo are no longer references to each other, but separate variables
- like they were prior to PHP 4.0 Beta 4 (Zeev)
-- Fixed Sybase-DB compilation (Zeev)
-- Fixed a (fairly common) situation where error_reporting values would not be
- properly restored after a call to error_reporting(), in between requests
- (Zeev)
-- The various $HTTP_*_VARS[] are now protected, and cannot be manipulated by
- user input (Zeev)
-- Added ini_set() as an alias to ini_alter() (Zeev)
-- The string None is now recognized as a keyword by the php.ini processor, and
- can be used to denote an empty string (Zeev)
-- Added get_class_vars(string class_name) and get_object_vars(object obj)
- functions. (Andrei, Zend Engine)
-- Added pdf_set_parameter(), pdf_skew(), pdf_show_boxed() (Uwe)
-- Fixed comparison of (string) "inf" with (string) "inf", which was erroneously
- returning false (Zeev)
-- Implemented default_charset and default_mimetype config directives (Stig)
-- Ported T1lib support from PHP3. (Jouni)
-- Fixed -DEAPI inheritance from APXS. (Sascha)
-- Fixed possible crash in module-shutdown. (Thies)
-- Fixed safe_mode_protected_env_vars INI directive (Zeev)
-- Fixed getrusage() (Sascha)
-- Fixed OCI8 crash when returning cursors from stored-procedures. (Thies)
-
-21 February 2000 Version 4.0 Beta 4 patch level 1
-- Fixed crash when magic_quotes were switched off. (Thies)
-- Support for pdflib 2.30 (Uwe)
-
-20 February 2000, Version 4.0 Beta 4
-- Introduced $HTTP_POST_FILES[], that contains information about files uploaded
- through HTTP upload (Zeev)
-- Made PHP work under Microsoft Personal Web Server, under both Windows NT
- workstation and Windows 95 (Zeev)
-- Made multipart/form-data content obey to the variables_order directive (Zeev)
-- Updated the browscap module to work with PHP 4.0 (Zeev)
-- Recover gracefully in ISAPI after the client prematurely presses STOP (Andi)
-- Fixed bug in unset() on array offsets which are referenced more than once
- (Andi, Zend Engine)
-- Improved ISAPI module - it should no longer be necessary to set PHP as
- an ISAPI filter, only as an ISAPI extension, unless you wish to perform
- authentication using PHP. This didn't yet get enough testing, but it
- should work (Zeev)
-- Fixed RFC1867 file upload under Windows (Zeev)
-- Initital support for pdflib 2.20 (Uwe)
-- Added PostgreSQL support for DB (Rui Hirokawa <louis@cityfujisawa.ne.jp>)
-- Re-introduced "none" for disabling auto_prepend/append_file (Stig)
-- Added DB/storage (Stig, PEAR)
-- Introduced DB warnings (Stig, PEAR)
-- Fixed overrun in strip_tags (Stas)
-- Fixed crash in strip_tags() and related functions. (Thies)
-- Workaround for bogus POST-Data from IE/Mac. (Thies)
- Patch by Alain Malek <alain@virtua.ch>
-- Finished the server abstraction layer; All of the PHP code is now shared
- across different servers (Apache, CGI, IIS, etc.), except for thin
- interface modules (Zeev)
-- Added NULL-support in gettype(). (Thies)
-- base64_decode() will decode POST data correct. (Thies)
- Patch submitted by: Turadg Aleahmad <turadg@wise.berkeley.edu>
-- Much more work on domxml. Build xml tree, create xml doc works (Uwe)
-- Made foreach() work on objects. (Thies, Zend Engine)
-- Added domxml extension based on libxml, still little functionality (Uwe)
-- Fixed memory corruption in fgetss(), strip_tags() and gzgetss() (Zeev)
-- Updated calendar dynamic library to work with PHP 4. (Evan)
-- Added strncmp() function, courtesy of Walter. (Andrei)
-- Made the output of var_dump() more informative. (Thies)
-- Fixed some OCIBindByName() problems. (Thies)
-- Protect the ISAPI module against exceptions. Stack overflows in scripts are
- now nicely detected and handled (Zeev)
-- Fixed possible buffer-overflow in base64_decode. (Thies)
-- Fixed possible buffer-overflow in setcookie(). (Thies)
-- Fixed signal() bug that could cause the Apache master process to
- die. (Thies)
-- Added session_set_cookie_params() function. (Andrei)
-- If header information is sent after output has already been sent, the warning
- message will now state the filename and line number at which the first output
- was made (Zeev)
-- Added the XML Expat library to the standard PHP source distribution thanks
- to its author James Clark (Andi & Zeev)
-- Added XML support to the default Win32 build (Andi & Zeev)
-- Added socket_get_status() function. Renamed:
- set_socket_timeout() -> socket_set_timeout()
- set_socket_blocking() -> socket_set_blocking(). (Andrei)
-- Added realpath() function. (Andrei)
-- mktime interprets years in the range 0-70 now as 2000-2070. You can
- continue to specify the complete year (i.e. 1920) (Sascha)
-- Added the ability to control the environment variables the user is allowed
- to change in Safe Mode, using INI directives (Zeev)
-- Fixed a crash bug in strtr() working on large input strings (Zeev)
-- Ora_GetColumn()/Ora_FetchInto() now return NULL for NULL-Columns. (Thies)
-- OCI8 now supports binding of NULL-values. Module cleanups. (Thies)
-- Added ability to set timeout on socket read operations through
- set_socket_timeout() function. (Andrei)
-- Added implicit_flush INI directive (Zeev)
-- Added implicit_flush() to control whether flush() should be called
- implicitly after any output (Zeev)
-- Fixed a crash in pfsockopen() (Zeev)
-- Fixed a possible crash in phpinfo() (Zeev)
-- Added register_argc_argv INI directive, to allow to selectively disable
- the declaration of the $argv and $argc variables for increased
- performance (Zeev)
-- Added $HTTP_ENV_VARS[] and $HTTP_SERVER_VARS[] support, which similarly
- to $HTTP_GET_VARS[], contain environment and server variables. Setting
- register_globals to Off will now also prevent registration of the
- environment and server variables into the global scope (Zeev)
-- Renamed gpc_globals INI directive to register_globals (Zeev)
-- Introduced variables_order that deprecates gpc_order, and allows control
- over the server and environment variables, in addition to GET/POST/Cookies
- (Zeev)
-- new function cpdf_set_document_limits() (Uwe)
-- Applied safe-mode patch to popen(). (Patch by Kristian Köhntopp)
-- str_repeat() now returns correct length. (Thies)
-- Don't assume libz and libpng are installed for the GD checks (Rasmus)
-- Implemented support for <boolean> and <null> types according
- to WDDX version 1.0 (Andrei)
-- Made var_dump()/serialize()/unserialize() NULL aware. (Thies)
-- Added new NULL constant (Zeev, Zend Engine)
-- Fixed -c support in the standalone CGI binary (Zeev)
-- Increased PHP's performance by 5-15% using a new memory cache (Andi & Zeev,
- Zend Engine)
-- Improved the php.ini reader to support constants and bitwise operators (Zeev)
-- Fixed strrev() to no longer modify arg1. (Thies)
-- Fixed buffer overruns in iptcembed(). (Thies)
-- Fixed a bug in ODBC error reporting (Zeev)
-- Added PHP_Logo_GUID() and Zend_Logo_GUID() functions, that return the GUIDs
- of the PHP and Zend logos used in phpinfo() (Zeev)
-- Added GNU Pth support (Sascha, TSRM library)
-- Removed select(), fd_set() and fd_isset() - will be reimplemented soon! (Thies)
-- Improved Win32 performance significantly by using different mutexes (Zeev,
- TSRM library)
-- Made quotemeta() and preg_quote() binary-safe. (Andrei)
-- Added UDP support in fsockopen(). (Evan)
-- Added --disable-pear option (Andrei)
-- Renamed libzend repository to Zend (Zeev)
-- Added support for thttpd (Sascha)
-- Added session.cache_limiter and cache_expire options (Sascha)
-- Restored the PHP_VERSION and PHP_OS constants (Zeev)
-- Added get_loaded_extensions(), extension_loaded(), and
- get_extension_funcs() functions. (Andrei)
-- Added date/time stamping to PHP error log file. (Andrei, Joey)
-- Added is_subclass_of() function (Andrei, Zend Engine)
-- Implemented count_chars(). (Thies)
-- Added class_exists() function (Andrei, Zend Engine)
-- Made strspn() and strcspn() binary-safe. (Andrei)
-- Added array_multisort() function. (Andrei)
-- Made pageinfo.c thread-safe (Sascha)
-- Made implode() binary-safe (Andrei)
-- Made strstr(), stristr(), and ucwords() binary-safe() (Andrei)
-- Made strtoupper(), strtolower(), substr_replace() binary-safe. (Andrei)
-- Fixed a crash in the Apache syntax highlighting mode (Zeev)
-- Report all ODBC error's not just the one on the top of the stack (lurcher)
-- OCI8 now returns NULL values in LONG columns correct. (Thies)
-- Added support for a C-like assert() function. (Thies)
-- Added CyberCash support. (Evan)
-- Made explode() binary-safe. (Thies)
-- Made strpos() binary-safe. (Thies)
-- Added XML_Set_Object() function, now you can use the XML-Parser from
- within an object. (Thies)
-- Session vars are now decoded into $HTTP_STATE_VARS[] array and the
- globals, depending on track_vars and gpc_globals settings (Andrei)
-- Added get_used_files() function - returns a hash mapping the use()'d files
- to their full path (Zeev)
-- PHP 4 scripts will now obey the max_execution_time setting and actually
- time out (Rasmus)
-- Added configure command to phpinfo() output (Stig)
-- Added optional socket path to the mysql_?connect() functions (Rasmus)
-- Made mysql and gd work as shared extensions again (Stig)
-- Make the global GET/POST/Cookie variables and their $HTTP_*_VARS[] counterparts
- be references to each other (Zeev)
-- Added support for the 'use' keyword - behaves like 'require', but will not
- use the same file more than once (Andi & Zeev, Zend Engine)
-- Added check to see if a persistent connection is still valid with the
- ODBC interface before reusing (nick@easysoft.com)
-- Added DBMaker support (patch by Pax Tsai <paxtsai@lion.syscom.com.tw>)
-- Renamed "PECL" to "PEAR" (PHP Extension and Add-on Repository) (Stig)
-- buildconf now uses build.mk (Stig)
-- Disable symlinks to urls (Rasmus)
-- Informix driver now reflects version of ESQL/C used (Danny)
-- Modified session_register() to take variable number of arguments (Andrei)
-- Fixed file descriptor leak in thread safe mode (Zeev, Zend Engine)
-- Added select(), fd_set() and fd_isset() (Evan)
-- cpdf support has been ported from php3, needs ClibPDF 2.x (Uwe)
-- Fixed a leak when using automatic output buffering (Zeev)
-- Introduced PECL - PHP Extension and Code Library
- (prounounced "pickle") (Stig)
-- Fixed inconsistencies in the implementation of here-docs (Andi & Zeev, Zend
- library)
-- Fixed a problem with constant class-member initializations (Andi & Zeev,
- Zend Engine)
-- Fixed float-compare in min(),max(),a[r]sort(),[r]sort() (Thies)
-- Implemented get_html_translation_table() function (Thies)
-- Implemented array_flip() function. Returns input-array with key, value
- flipped (Thies)
-- Added Berkeley DB3 support in DBA (Sascha)
-- Implemented 2-Arg version of strtr($str,$translation_array). This can be used
- to revert what htmlspecialchars() did (Thies)
-- Fixed mem-overwrite in XML_Parse_Into_Struct (Thies)
-- Added substr_replace() function (Andrei)
-
-November 16 1999, Version 4.0 Beta 3
-- ucfirst()/ucwords() no longer modify arg1 (Thies)
-- Fixed strtr() not to modify arg1 (Thies)
-- Added Win32 build files for Informix driver and make it
- compile with ZTS (danny)
-- Added tmpfile() function (Stig)
-- Upgraded regex library to alpha3.8 (Sascha)
-- Fixed selecting nested-tables in OCI8. (Thies)
-- RFC-854 fix for internal FTP-Code. Commands have to end in "\r\n" (Thies)
-- Fixed OpenLink ODBC support (Stig)
-- min(),max(),a[r]sort(),[r]sort(),k[r]sort() now work consistent with the
- language-core. (Thies)
-- tempnam() now uses mkstemp() if available (Stig)
-- serialize() and var_dump() now honor the precision as set in php.ini
- for doubles. (Thies)
-- Improved the Win32 COM module to support [out] parameters (Boris Wedl)
-- Fixed garbage returned at the end of certain Sybase-Columns (Thies)
- Patch submitted by: neal@wanlink.com
-- Added Microsoft SQL Server module for Win32 (Frank)
-- Added support for forcing a variable number of internal function arguments
- by reference. (Andi & Zeev, Zend Engine)
-- Implemented getprotoby{name,number} (Evan)
-- Added array_pad() function. (Andrei)
-- Added new getservby{name,port} functions. (Evan)
-- Added session.cookie_path and session.cookie_domain (Sascha)
-- Continue processing PHP_INI_SYSTEM knownDirectives after extension=
- (Sam Ruby)
-- Enable IBM DB2 support - Tested against DB2 6.1 UDB on Linux (Rasmus)
-- Added new str_repeat() function. (Andrei)
-- Output-Buffering system is now Thread-Safe. (Thies)
-- implemented OCI8 $lob->WriteToFile() function - very useful for streaming
- large amounts of LOB-Data without to need of a huge buffer. (Thies)
-- Added session.use_cookies option (Sascha)
-- Added getcwd() function. (Thies)
-- XML_Parse_Into_Struct no longer eats data. (Thies)
-- Fixed parse_url('-') crash. (Thies)
-- added === operator support. (Andi & Thies, Zend Engine)
-- unserialize() now gives a notice when passed invalid data. (Thies)
-- Fixed shuffle() so that it no longer breaks on Solaris. (Andrei)
-- Added is_resource(), is_bool() functions. (Thies)
-- Cleaned up File-Module (Thies)
-- Upgraded math-funtions to use new Zend function API (Thies)
-- Fixed zombie problem in shell_exec() and $a = `some_command`
- constructs. (Thies)
-- Thies introduced ZEND_FETCH_RESOURCE2 (Danny).
-- Added Informix driver to list of maintained extensions. (Danny).
-- Informix driver : Changed ifx.ec to use the new high-performance
- ZEND API. (Danny)
-- IXF_LIBDIR environment variable specifies alternate Informix library
- path for configure (Danny).
-- Fixed gmmktime() so that the following should always be true:
- gmmktime([args]) == mktime([args]) + date('Z', mktime([args])) (Jouni)
-- setlocale doesn't anymore screw up things if you forgot to change it back
- to the original settings. (Jouni)
-- Switched to new system where ChangeLog is automagically updated from commit
- messages. NEWS file is now the place for public announcements. (Andrei)
-- Fixed refcount problem in XML module. (Thies)
-- Fixed crash in HTTP_RAW_POST_DATA handling (Thies)
-- You can use resources as array-indices again (Thies, Zend Engine)
-- Fixed pg_fetch_array() with three arguments (Sascha)
- Patch submitted by: brian@soda.berkeley.edu
-- Upgraded a lot internal functions to use new Zend function API (Thies)
-- fdf support ported; not completely tested with latest version 4.0 for
- glibc (Uwe)
-- OCI8 connections are now kept open as long as they are referenced (Thies)
-- Cleaned up Directory-Module (Thies)
-- Small fix in Ora_Close (Thies)
-- Ported range() and shuffle() from PHP 3 to PHP 4 (Andrei)
-- Fixed header("HTTP/..."); behaviour (Sascha)
-- Improved UNIX build system. Now utilizes libtool (Sascha)
-- Upgrade some more internal functions to use new Zend function API. (Thies,
- Zend Engine)
-- Fixed backwards incompatibility with ereg() (Thies)
-- Updated Zend garbage collection with a much more thorough method.
- (Andi, Zend Engine)
-- Added the ability to use variable references in the array() construct.
- For example, array("foo" => &$foo). (Andi, Zend Engine)
-- Added array_reverse() function (Andrei)
-- Some more XML fixes/cleanups (Thies)
-- Updated preg_replace() so that if any argument passed in is an array
- it will make a copy of each entry before converting it to string so that
- the original is intact. If the subject is an array then it will preserve
- the keys in the output as well (Andrei)
-- Updated OCI8 to use the new high-performance Zend function API. (Thies)
-- Configure speedup (Stig)
-- Fixed LOB/Persistent-Connection related OCI8-Crash (Thies)
-- Generalized server-API build procedure on UNIX (Stig)
-- Added '--disable-rpath' option (Sascha)
-- Added AOLserver SAPI module (Sascha)
-- Fixed XML Callbacks. (Thies)
-- Updated ODBC to use the new high-performance Zend function API (kara)
-- Updated zlib to use the new high-performance Zend function API. (Stefan)
-- Updated preg_split() to allow returning only non-empty pieces (Andrei)
-- Updated PCRE to use the new high-performance Zend function API (Andrei)
-- Updated session, dba, mhash, mcrypt, sysvshm, sysvsem, gettext modules to use
- the new high-performance Zend function API (Sascha)
-- Extended var_dump to handle resource type somewhat (Andrei)
-- Updated WDDX to use the new high-performance Zend function API (Andrei)
-- Updated XML to use the new high-performance Zend function API. (Thies)
-- Updated Oracle to use the new high-performance Zend function API. (Thies)
-- Improved the performance of the MySQL module significantly by using the new
- high-performance Zend function API. (Zeev)
-- Added support for the Easysoft ODBC-ODCB Bridge (martin@easysoft.com)
-- Fixed bug in odbc_setoption, getParameter call incorrect (martin@easysoft.com)
-- Ora_Fetch_Into now resets the returned array in all cases (Thies)
-- Fixed NULL-Column problem in Oracle-Driver (Thies)
-- Added extra metadata functions to ODBC, SQLTables etc (nick@easysoft.com)
-- Fixed SEGV in mcal make_event_object() and
- typo in mcal_list_alarms() (Andrew Skalski)
-- Fixed Ora_PLogon (Thies)
-- Resourcified Oracle (Thies)
-- Implemented object serialization/deserialization in WDDX (Andrei)
-- Added krsort() function (Thies)
-- Added func_num_args(), func_get_arg() and func_get_args() for standard
- access to variable number of arguments functions (Zeev)
-- Added FTP support (Andrew Skalski)
-- Added optional allowable_tags arguments to strip_tags(), gzgetss() and
- fgetss() to allow you to specify a string of tags that are not to be
- stripped (Rasmus)
-- Upgraded var_dump() to take multiple arguments (Andrei)
-- Resourcified XML (Thies)
-- Fixed a memory leak in the Apache per-directory directives handler (Zeev)
-- Added array_count_values() function. (Thies)
-- snmp, pgsql, mysql and gd modules can be built as dynamically loaded
- modules (Greg)
-- OCI8 fix for fetching empty LOBs (Thies)
-- Added user-level callbacks for session module (Sascha)
-- Added support for unknown POST content types (Zeev)
-- Added "wddx" serialization handler for session module (Sascha)
- (automatically enabled, if you compile with --with-wddx)
-- Fixed unserializing objects (Thies)
-- PHP 4.0 now serializes Objects as 'O' (not understood by PHP 3.0), but
- unserializes PHP 3.0 serialized objects as expected. (Thies)
-- Made serialize/unserialize work on classes. If the class is known at
- unserialize() time, you'll get back a fully working object! (Thies)
-- Reworked preg_* functions according to the new PCRE API, which also made
- them behave much more like Perl ones (Andrei)
-- Made it possible to specify external location of PCRE library (Andrei)
-- Updated bundled PCRE library to version 2.08 (Andrei)
-- count()/is_array/is_object... speedups. (Thies)
-- OCI8 supports appending and positioning when saving LOBs (Thies)
-- Added metaphone support (Thies)
-- OCI8 doesn't use define callbacks any longer. (Thies)
-- OCI8 Driver now supports LOBs like PHP 3.0. (Thies)
-- var_dump now dumps the properties of an object (Thies)
-- Rewrote the GET/POST/Cookie data reader to support multi-dimensional
- arrays! (Zeev)
-- Renamed allow_builtin_links to expose_php (defaults to On). This directive
- tells PHP whether it may expose its existence to the outside world, e.g.
- by adding itself to the Web server header (Zeev)
-- Added support for transparent session id propagation (Sascha)
-- Made WDDX serialize object properties properly (Andrei)
-- Fixed WDDX mem leak when undefined variable is passed in
- for serialization (Andrei)
-- Added session_unset() function (Andrei)
-- Fixed double session globals shutdown crash (Andrei)
-- Fixed crash related to ignore_user_abort ini entry (Andrei)
-- Added support for external entropy sources for session id creation
- (on Unices /dev/random and /dev/urandom) (Sascha)
-- Added gpc_globals variable directive to php.ini. By default it is On, but
- if it is set to Off, GET, POST and Cookie variables will not be inserted
- to the global scope. Mostly makes sense when coupled with track_vars (Zeev)
-- Added versioning support for shared library (Sascha)
- This allows concurrent use of PHP 3.0 and PHP 4.0 as Apache modules. See
- the end of the INSTALL file for more information.
-- Added second parameter to array_keys which specifies search value
- for which the key should be returned (Andrei)
-- Resourcified Informix driver (Danny)
-- New resource handling for odbc, renamed to php_odbc.[ch]
-- Make set_time_limit() work on Unix (Rasmus)
-- Added connection handling support (Rasmus)
-- Improved the Sybase-CT module to make use of resources (Zeev)
-- Improved the mSQL module to make use of resources (Zeev)
-- Changed mysql_query() and mysql_db_query() to return false in case of saving
- the result set data fails (Zeev)
-- Improved the resource mechanism - resources were not getting freed as soon
- as they could (Zeev)
-- Added shared memory module for session data storage (Sascha)
-- Fixed session.auto_start (Sascha)
-- Fixed several problems with output buffering and HEAD requests (Zeev)
-- Fixed HTTP Status code issue with ISAPI module (Zeev)
-- Fixed a problem that prevented $GLOBALS from working properly (Zeev, Zend
- library)
-- Ported newest GetImageSize (Thies)
-- Added session compile support in Win32 (Andi)
-- Added -d switch to the CGI binary that allows overriding php.ini values
- from the command line (Zeev)
-- Fixed a crash that would occur if wddx_deserialize did not receive
- a valid packet (Andrei)
-- Fixed a bugglet when redefining a class at run-time (Andi, Zend Engine)
-- Fixed sem_get() on AIX (Sascha)
-- Fixed fopen() to work with URL's in Win32 (Andi & Zeev)
-- Fixed include_path for Win32 (Andi, Zend Engine)
-- Fixed bug in ISAPI header sending function (Charles)
-- Fixed memory leak when using undefined values (Andi & Zeev, Zend Engine)
-- Added output_buffering directive to php.ini, to enable output buffering
- for all PHP scripts - default is off (Zeev).
-- Fixed some more class inheritance issues (Zeev, Zend Engine)
-- Fixed Apache build wrt to shared modules on FreeBSD/Linux (Sascha)
-- Added session.extern_referer_chk which checks whether session ids were
- referred to by an external site and eliminates them (Sascha)
-- Improved session id generation (Sascha)
-- Improved speed of uniqid() by using the combined LCG and removing
- the extra usleep() (Sascha)
-- Introduced general combined linear congruential generator (Sascha)
-- Made ldap_close back into an alias for ldap_unbind (Andrei)
-- OciFetchInto now resets the returned array in all cases (Thies)
-- Fixed mysql_errno() to work with recent versions of MySQL (Zeev)
-- Fixed a problem with define() and boolean values (Zeev)
-- Fixed inclusion of gd/freetype functions (Sascha)
-- Fixed persistency of MHASH_* constants (Sascha)
-- Oracle is now ZTS-Safe (Thies)
-- Fixed flushing of cached information to disk in DBA's DB2 module (Sascha)
-- OCI8 is now ZTS-Safe (Thies)
-- Fixed is_writeable/is_writable problem; they are both defined now (Andrei)
-- Imported PHP 3.0 diskfreespace() function (Thies)
-- Fixed thread-safety issues in the MySQL module (Zeev)
-- Fixed thread-safe support for dynamic modules (Zeev)
-- Fixed Sybase CT build process (Zeev)
-
-August 9 1999, Version 4.0 Beta 2
-- Fixed a problem when sending HTTP/1.x header lines using header() (Zeev)
-- Win32 builds now include the ODBC module built-in (Zeev)
-- Fixed SYSV-SHM interface (Thies).
-- Updated hyperwave module, made it thread safe
-- Updated pdflib module, version 0.6 of pdflib no longer supported
-- Updated fdf module
-- Built-in phpinfo() links are now turned off by default. They can be turned
- on using the allow_builtin_links INI directive (Zeev)
-- Changed phpinfo() to list modules that have no info function (Zeev)
-- Modified array_walk() function so that the userland callback is passed
- a key and possible user data in addition to the value (Andrei)
-- Fixed ldap_search(), ldap_read() and ldap_list() (Zeev)
-- Fixed Apache information in phpinfo() (sam@breakfree.com)
-- Improved register_shutdown_function() - you may now supply arguments that
- will be passed to the shutdown function (Zeev)
-- Improved call_user_func() and call_user_method() - they now support passing
- arguments by reference (Zeev)
-- Fixed usort() and uksort() (Zeev)
-- Fixed md5() in the Apache module (Thies)
-- Introduced build process for dynamic modules (Stig)
-- Improved ISAPI module to supprt large server variables (Zeev)
-- Imported PHP 3.0 fixes for problem with PHP as a dynamic module and Redhat
- libc2.1 in zlib module (Stefan)
-- Fixed sybase_fetch_object() (Zeev)
-- Made the IMAP module work with PHP 4.0 (Zeev)
-- Fixed a problem with include()/require() of URLs (Sascha, Zeev)
-- Fixed a bug in implode() that caused it to corrupt its arguments (Zeev)
-- Added get_class($obj), get_parent_class($obj) and method_exists($obj,"name")
- (Andi & Zeev)
-- Fixed various inheritance problems (Andi & Zeev, Zend Engine)
-- Children now inherit their parent's constructor, if they do not supply a
- constructor of their own.
-- Fixed runtime inheritance of classes (parent methods/properties were
- overriding their children) (Zeev, Zend Engine)
-- Fixed backwards incompatibility with the "new" operator (Andi, Zend Engine)
-- Fixed bugs in uksort() and ksort() sort ordering (Andrei)
-- Fixed a memory leak when using assignment-op operators with lvalue of type
- string (Zeev, Zend Engine)
-- Fixed a problem in inheritance from classes that are defined in include()d
- files (Zeev, Zend Engine)
-- Fixed a problem with the PHP error handler that could result in a crash
- on certain operating systems (Zeev)
-- Apache php_flag values only recognized 'On' (case sensitive) - changed
- to case insensitive (Zeev)
-- Fixed a memory leak with switch statement containing return statements
- (Andi & Zeev, Zend Engine)
-- Fixed a crash problem in switch statements that had a string offset
- as a conditional (Andi & Zeev, Zend Engine)
-- Imported PHP 3.0 fixes for rand() and mt_rand() (Rasmus)
-- Added function entries for strip_tags() and similar_text() (Andrei)
-- Fixed a bug in WDDX that would cause a crash if a number was passed in
- instead of a variable name (Andrei)
-- Ported strtotime() function from PHP 3.0 (Andrei)
-- Merged in gdttf stuff from PHP 3.0 (Sascha)
-- buildconf now checks your installation (Stig)
-- XML module now built dynamically with --with-xml=shared (Stig)
-- Added a check for freetype.h - fixed build on RedHat 6.0 (Zeev)
-- Fixed array_walk() to work in PHP 4.0 (Andrei)
-- Ported all remaining date() format options from PHP 3.0 (Andrei)
-- $php_errormsg now works (Andrei)
-- Added locale support for Perl Compatible Regexp functions (Andrei)
-- Informix module ported (Danny)
-- Removed --with-shared-apache (Sascha)
-- Added patch for reverse lookup table in base64_decode (Sascha)
- Submitted by bfranklin@dct.com
-- Merged in PHP 3.0 version of str_replace (Sascha)
-- Added DBA module (Sascha)
-- Added session id detection within REQUEST_URI (Sascha)
-- Merged in HP-UX/ANSI compatibility switch from PHP 3.0 (Sascha)
-- Fixed rpath handling for utilitites built during Apache build (Sascha)
-- Added missing E_ error level constants (Zeev, Zend Engine)
-- Fixed a bug in sending multiple HTTP Cookies under Apache (Zeev)
-- Fixed implicit connect on the MySQL, mSQL, PostgreSQL and Sybase
- modules (Zeev)
-- Gave PHP 4.0's SNMP extension all the functionality of PHP 3.0.12 (SteveL)
-
-July 19 1999, Version 4.0 Beta 1
-- First public beta of PHP 4.0
diff --git a/README.CVS-RULES b/README.CVS-RULES
deleted file mode 100644
index d661edd4f4..0000000000
--- a/README.CVS-RULES
+++ /dev/null
@@ -1,115 +0,0 @@
-This is the first file you should be reading after you get your CVS account.
-We'll assume you're basically familiar with CVS, but feel free to post
-your questions on the mailing list. Please have a look at
-http://cvsbook.red-bean.com/ for more detailed information on CVS.
-
-PHP is developed through the efforts of a large number of people.
-Collaboration is a Good Thing(tm), and CVS lets us do this. Thus, following
-some basic rules with regards to CVS usage will:
-
- a. Make everybody happier, especially those responsible for maintaining
- the CVS itself.
- b. Keep the changes consistently well documented and easily trackable.
- c. Prevent some of those 'Oops' moments.
- d. Increase the general level of good will on planet Earth.
-
-
-Having said that, here are the organizational rules:
-
- 1. Respect other people working on the project.
-
- 2. Discuss any significant changes on the list before committing.
-
- 3. Look at EXTENSIONS file to see who is the primary maintainer of
- the code you want to contribute to.
-
- 4. If you "strongly disagree" about something another person did, don't
- start fighting publicly - take it up in private email.
-
- 5. If you don't know how to do something, ask first!
-
- 6. Test your changes before committing them. We mean it. Really.
-
-
-The next few rules are more of a technical nature.
-
- 1. DO NOT TOUCH ChangeLog! It is automagically updated from the commit
- messages every day. Woe be to those who attempt to mess with it.
-
- 2. All news updates intended for public viewing, such as new features,
- bug fixes, improvements, etc., should go into the NEWS file. Also see
- the note below about automatically updating NEWS in your commit message.
-
- 3. Do not commit multiple file and dump all messages in one commit. If you
- modified several unrelated files, commit each group separately and
- provide a nice commit message for each one. See example below.
-
- 4. Do write your commit message in such a way that it makes sense even
- without the corresponding diff. One should be able to look at it, and
- immediately know what was modified. Definitely include the function name
- in the message as shown below.
-
- 5. In your commit messages, keep each line shorter than 80 characters. And
- try to align your lines vertically, if they wrap. It looks bad otherwise.
-
- 6. If you modified a function that is callable from PHP, prepend PHP to
- the function name as shown below.
-
-
-The format of the commit messages is pretty simple.
-
-If a line begins with #, it is taken to be a comment and will not appear
-in the ChangeLog. If the line begins with @, it will be redirected to the
-NEWS file. Everything else goes into the ChangeLog.
-
-It is important to note that if your comment or news logline spans multiple
-lines, you have to put # or @ at the beginning of _every_ such line. Every
-entry in NEWS has to have a name after it, so if you did it with someone's
-help, put both your names there. Your name WILL NOT be automatically put
-at the end of the NEWS entry - so, please provide it yourself.
-
-Example. Say you modified two files, datetime.c and string.c. In datetime.c
-you added a new format option for date() function, and in string.c you fixed
-a memory leak in php_trim(). Don't commit both of these at once. Commit them
-separately and try to make sure your commit messages look something like the
-following.
-
-For datetime.c:
-
-(PHP date) Added new 'K' format modifier for printing out number of
- days until New Year's Eve.
-@- Added new 'K' format modifier that will output the number of days
-@ until New Year's Eve. (Bob)
-
-For string.c:
-(php_trim) Fixed a memory leak resulting from improper use of zval_dtor().
-# Man, that thing was leaking all over the place!
-@- Fixed memory leak in trim(). (Bob)
-
-The lines above marked with @ will go into NEWS file automagically, and the
-# lines will be omitted from the ChangeLog. Alternatively, you might want
-to modify NEWS file directly and not use the @ lines.
-
-If you fix some bugs, you should note the bug ID numbers in your
-commit message. Bug ID should be prefixed by "#" for easier access to
-bug report when developers are browsing CVS via. LXR or Bonsai.
-
-Example:
-
-Fixed pgsql notice handler double free crash bug. Bug #14016
-@ Fixed pgsql notice handler double free crash bug. Bug #14016
-
-If you don't see your messages in ChangeLog and NEWS right away, don't worry!
-These files are updated once a day, so your stuff will not show up until
-somewhat later. Don't go adding stuff to NEWS by hand if you already put @
-lines in the commit message.
-
-You can use LXR (http://lxr.php.net/) and Bonsai (http://bonsai.php.net/)
-to look at PHP CVS repository in various ways.
-
-To receive daily updates to ChangeLog and NEWS, send an empty message to
-php-cvs-daily-subscribe@lists.php.net.
-
-Happy hacking,
-
-PHP Team
diff --git a/README.EXTENSIONS b/README.EXTENSIONS
deleted file mode 100644
index 51e3b730e7..0000000000
--- a/README.EXTENSIONS
+++ /dev/null
@@ -1,39 +0,0 @@
-Between PHP 4.0.6 and 4.1.0, the Zend module struct changed in a way
-that broke both source and binary compatibility. If you are
-maintaining a third party extension, here's how to update it:
-
-If this was your old module entry:
-
-zend_module_entry foo_module_entry = {
- "foo", /* extension name */
- foo_functions, /* extension function list */
- NULL, /* extension-wide startup function */
- NULL, /* extension-wide shutdown function */
- PHP_RINIT(foo), /* per-request startup function */
- PHP_RSHUTDOWN(foo), /* per-request shutdown function */
- PHP_MINFO(foo), /* information function */
- STANDARD_MODULE_PROPERTIES
-};
-
-Here's how it should look if you want your code to build with PHP
-4.1.0 and up:
-
-zend_module_entry foo_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
- "foo", /* extension name */
- foo_functions, /* extension function list */
- NULL, /* extension-wide startup function */
- NULL, /* extension-wide shutdown function */
- PHP_RINIT(foo), /* per-request startup function */
- PHP_RSHUTDOWN(foo), /* per-request shutdown function */
- PHP_MINFO(foo), /* information function */
-#if ZEND_MODULE_API_NO >= 20010901
- FOO_VERSION, /* extension version number (string) */
-#endif
- STANDARD_MODULE_PROPERTIES
-};
-
-If you don't care about source compatibility with earlier PHP releases
-than 4.1.0, you can drop the #if/#endif lines.
diff --git a/README.EXT_SKEL b/README.EXT_SKEL
deleted file mode 100644
index afe03cb0df..0000000000
--- a/README.EXT_SKEL
+++ /dev/null
@@ -1,193 +0,0 @@
-(NOTE: you may also want to take a look at scripts/ext_skel_ng,
- a PHP-only alternative for this script thats supposed
- to replace it completely in the long run ...)
-
-WHAT IT IS
-
- It's a tool for automatically creating the basic framework for a PHP module
- and writing C code handling arguments passed to your functions from a simple
- configuration file. See an example at the end of this file.
-
-HOW TO USE IT
-
- Very simple. First, change to the ext/ directory of the PHP 4 sources. If
- you just need the basic framework and will be writing all the code in your
- functions yourself, you can now do
-
- ./ext_skel --extname=module_name
-
- and everything you need is placed in directory module_name.
-
- [ Note that GNU awk is likely required for this script to work. Debian
- systems seem to default to using mawk, so you may need to change the
- #! line in skeleton/create_stubs and the cat $proto | awk line in
- ext_skel to use gawk explicitly. ]
-
- If you don't need to test the existence of any external header files,
- libraries or functions in them, the module is already almost ready to be
- compiled in PHP. Just remove 3 comments in your_module_name/config.m4,
- change back up to PHP sources top directory, and do
-
- ./buildconf; ./configure --enable-module_name; make
-
- But if you already have planned the overall scheme of your module, what
- functions it will contain, their return types and the arguments they take
- (a very good idea) and don't want to bother yourself with creating function
- definitions and handling arguments passed yourself, it's time to create a
- function definitions file, which you will give as an argument to ext_skel
- with option
-
- --proto=filename.
-
-FORMAT OF FUNCTION DEFINITIONS FILE
-
- All the definitions must be on one line. In it's simplest form, it's just
- the function name, e.g.
-
- my_function
-
- but then you'll be left with an almost empty function body without any
- argument handling.
-
- Arguments are given in parenthesis after the function name, and are of
- the form 'argument_type argument_name'. Arguments are separated from each
- other with a comma and optional space. Argument_type can be one of int,
- bool, double, float, string, array, object or mixed.
-
- An optional argument is separated from the previous by an optional space,
- then '[' and of course comma and optional space, like all the other
- arguments. You should close a row of optional arguments with same amount of
- ']'s as there where '['s. Currently, it does not harm if you forget to do it
- or there is a wrong amount of ']'s, but this may change in the future.
-
- An additional short description may be added after the parameters.
- If present it will be filled into the 'proto' header comments in the stubs
- code and the <refpurpose> tag in the XML documentation.
-
- An example:
-
- my_function(int arg1, int arg2 [, int arg3 [, int arg4]]) this is my 1st
-
- Arguments arg3 and arg4 are optional.
-
- If possible, the function definition should also contain it's return type
- in front of the definition. It's not actually used for any C code generating
- purposes but PHP in-source documentation instead, and as such, very useful.
- It can be any of int, double, string, bool, array, object, resource, mixed
- or void.
-
- The file must contain nothing else but function definitions, no comments or
- empty lines.
-
-OTHER OPTIONS
-
- --no-help
-
- By default, ext_skel creates both comments in the source code and a test
- function to help first time module writers to get started and testing
- configuring and compiling their module. This option turns off all such things
- which may just annoy experienced PHP module coders. Especially useful with
-
- --stubs=file
-
- which will leave out also all module specific stuff and write just function
- stubs with function value declarations and passed argument handling, and
- function entries and definitions at the end of the file, for copying and
- pasting into an already existing module.
-
- --assign-params
- --string-lens
-
- By default, function proto 'void foo(string bar)' creates the following:
- ...
- zval **bar;
- ... (zend_get_parameters_ex() called in the middle...)
- convert_to_string_ex(bar);
-
- Specifying both of these options changes the generated code to:
- ...
- zval **bar_arg;
- int bar_len;
- char *bar = NULL;
- ... (zend_get_parameters_ex() called in the middle...)
- convert_to_string_ex(bar_arg);
- bar = Z_STRVAL_PP(bar_arg);
- bar_len = Z_STRLEN_PP(bar_arg);
-
- You shouldn't have to ask what happens if you leave --string-lens out. If you
- have to, it's questionable whether you should be reading this document.
-
- --with-xml[=file]
-
- Creates the basics for phpdoc .xml file.
-
- --full-xml
-
- Not implemented yet. When or if there will ever be created a framework for
- self-contained extensions to use phpdoc system for their documentation, this
- option enables it on the created xml file.
-
-CURRENT LIMITATIONS, BUGS AND OTHER ODDITIES
-
- Only arguments of types int, bool, double, float, string and array are
- handled. For other types you must write the code yourself. And for type
- mixed, it wouldn't even be possible to write anything, because only you
- know what to expect.
-
- It can't handle correctly, and probably never will, variable list of
- of arguments. (void foo(int bar [, ...])
-
- Don't trust the generated code too much. It tries to be useful in most of
- the situations you might encounter, but automatic code generation will never
- beat a programmer who knows the real situation at hand. ext_skel is generally
- best suited for quickly generating a wrapper for c-library functions you
- might want to have available in PHP too.
-
- This program doesn't have a --help option. It has --no-help instead.
-
-EXAMPLE
-
- The following _one_ line
-
- bool my_drawtext(resource image, string text, resource font, int x, int y [, int color])
-
- will create this function definition for you (note that there are a few
- question marks to be replaced by you, and you must of course add your own
- value definitions too):
-
-/* {{{ proto bool my_drawtext(resource image, string text, resource font, int x, int y[, int color])
- */
-PHP_FUNCTION(my_drawtext)
-{
- zval **image, **text, **font, **x, **y, **color;
- int argc;
- int image_id = -1;
- int font_id = -1;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 5 || argc > 6 || zend_get_parameters_ex(argc, &image, &text, &font, &x, &y, &color) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(???, ???, image, image_id, "???", ???_rsrc_id);
- ZEND_FETCH_RESOURCE(???, ???, font, font_id, "???", ???_rsrc_id);
-
- switch (argc) {
- case 6:
- convert_to_long_ex(color);
- /* Fall-through. */
- case 5:
- convert_to_long_ex(y);
- convert_to_long_ex(x);
- /* font: fetching resources already handled. */
- convert_to_string_ex(text);
- /* image: fetching resources already handled. */
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- php_error(E_WARNING, "my_drawtext: not yet implemented");
-}
-/* }}} */
-
diff --git a/README.PARAMETER_PARSING_API b/README.PARAMETER_PARSING_API
deleted file mode 100644
index a051723b5b..0000000000
--- a/README.PARAMETER_PARSING_API
+++ /dev/null
@@ -1,127 +0,0 @@
-New parameter parsing functions
-===============================
-
-It should be easier to parse input parameters to an extension function.
-Hence, borrowing from Python's example, there are now a set of functions
-that given the string of type specifiers, can parse the input parameters
-and store the results in the user specified variables. This avoids most
-of the IS_* checks and convert_to_* conversions. The functions also
-check for the appropriate number of parameters, and try to output
-meaningful error messages.
-
-
-Prototypes
-----------
-/* Implemented. */
-int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...);
-int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...);
-
-The zend_parse_parameters() function takes the number of parameters
-passed to the extension function, the type specifier string, and the
-list of pointers to variables to store the results in. The _ex() version
-also takes 'flags' argument -- current only ZEND_PARSE_PARAMS_QUIET can
-be used as 'flags' to specify that the function should operate quietly
-and not output any error messages.
-
-Both functions return SUCCESS or FAILURE depending on the result.
-
-The auto-conversions are performed as necessary. Arrays, objects, and
-resources cannot be auto-converted.
-
-
-Type specifiers
----------------
- l - long
- d - double
- s - string (with possible null bytes) and its length
- b - boolean, stored in zend_bool
- r - resource (stored in zval)
- a - array
- o - object (of any type)
- O - object (of specific type, specified by class entry)
- z - the actual zval
-
- The following characters also have a meaning in the specifier string:
- | - indicates that the remaining parameters are optional, they
- should be initialized to default values by the extension since they
- will not be touched by the parsing function if they are not
- passed to it.
- / - use SEPARATE_ZVAL_IF_NOT_REF() on the parameter it follows
- ! - the parameter it follows can be of specified type or NULL (only applies
- to 'a', 'o', 'O', 'r', and 'z'). If NULL is passed, the results
- pointer is set to NULL as well.
-
-Examples
---------
-/* Gets a long, a string and its length, and a zval */
-long l;
-char *s;
-int s_len;
-zval *param;
-if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsz",
- &l, &s, &s_len, &param) == FAILURE) {
- return;
-}
-
-
-/* Gets an object of class specified by my_ce, and an optional double. */
-zval *obj;
-double d = 0.5;
-zend_class_entry my_ce;
-if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|d",
- &obj, my_ce, &d) == FAILURE) {
- return;
-}
-
-
-/* Gets an object or null, and an array.
- If null is passed for object, obj will be set to NULL. */
-zval *obj;
-zval *arr;
-if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o!a",
- &obj, &arr) == FAILURE) {
- return;
-}
-
-
-/* Gets a separated array which can also be null. */
-zval *arr;
-if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!",
- &arr) == FAILURE) {
- return;
-}
-
-
-/* Get only the first three parameters (useful for varargs functions). */
-zval *z;
-zend_bool b;
-zval *r;
-if (zend_parse_parameters(3 TSRMLS_CC, "zbr!",
- &z, &b, &r) == FAILURE) {
- return;
-}
-
-
-/* Get either a set of 3 longs or a string. */
-long l1, l2, l3;
-char *s;
-/*
- * The function expects a pointer to a integer in this case, not a long
- * or any other type. If you specify a type which is larger
- * than a 'int', the upper bits might not be initialized
- * properly, leading to random crashes on platforms like
- * Tru64 or Linux/Alpha.
- */
-int length;
-
-if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
- "lll", &l1, &l2, &l3) == SUCCESS) {
- /* manipulate longs */
-} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
- "s", &s, &length) == SUCCESS) {
- /* manipulate string */
-} else {
- /* output error */
-
- return;
-}
diff --git a/README.QNX b/README.QNX
deleted file mode 100644
index d70d2e5d8b..0000000000
--- a/README.QNX
+++ /dev/null
@@ -1,57 +0,0 @@
-QNX4 Installation Notes
------------------------
-
-NOTE: General installation instructions are in the INSTALL file
-
-
-1. To compile and test PHP3 you have to grab, compile and install:
- - GNU dbm library or another db library;
- - GNU bison (1.25 or later; 1.25 tested);
- - GNU flex (any version supporting -o and -P options; 2.5.4 tested);
- - GNU diffutils (any version supporting -w option; 2.7 tested);
-
-2. To use CVS version you may need also:
- - GNU CVS (1.9 tested);
- - GNU autoconf (2.12 tested);
- - GNU m4 (1.3 or later preferable; 1.4 tested);
-
-3. To run configure define -lunix in command line:
- LDFLAGS=-lunix ./configure
-
-4. To use Sybase SQL Anywhere define ODBC_QNX and CUSTOM_ODBC_LIBS in
- command line and run configure with --with-custom-odbc:
- CFLAGS=-DODBC_QNX LDFLAGS=-lunix CUSTOM_ODBC_LIBS="-ldblib -lodbc" ./configure --with-custom-odbc=/usr/lib/sqlany50
- If you have SQL Anywhere version 5.5.00, then you have to add
- CFLAGS=-DSQLANY_BUG
- to workaround its SQLFreeEnv() bug. Other versions has not been tested,
- so try without this flag first.
-
-5. To build the Apache module, you may have to hardcode an include path for
- alloc.h in your Apache base directory:
- - APACHE_DIRECTORY/src/httpd.h:
- change #include "alloc.h"
- to #include "APACHE_DIRECTORY/src/alloc.h"
- Unless you want to use system regex library, you have to hardcode also
- a path to regex.h:
- - APACHE_DIRECTORY/src/conf.h:
- change #include <regex.h>
- to #include "APACHE_DIRECTORY/src/regex/regex.h"
- I don't know so far why this required for QNX, may be it is Watcom
- compiler problem.
-
- If you building Apache module with SQL Anywhere support, you'll get
- symbol conflict with BOOL. It is defined in Apache (httpd.h) and in
- SQL Anywhere (odbc.h). This has nothing to do with PHP, so you have to
- fix it yourself someway.
-
-6. With above precautions, it should compile as is and pass regression
- tests completely:
- make
- make check
- make install
-
- Don't bother me unless you really sure you made that all but it
- still doesn't work.
-
-June 28, 1998
-Igor Kovalenko -- owl@infomarket.ru
diff --git a/README.SELF-CONTAINED-EXTENSIONS b/README.SELF-CONTAINED-EXTENSIONS
deleted file mode 100644
index e6a375331b..0000000000
--- a/README.SELF-CONTAINED-EXTENSIONS
+++ /dev/null
@@ -1,155 +0,0 @@
-$Id$
-=============================================================================
-
-HOW TO CREATE A SELF-CONTAINED PHP EXTENSION
-
- A self-contained extension can be distributed independently of
- the PHP source. To create such an extension, two things are
- required:
-
- - Configuration file (config.m4)
- - Source code for your module
-
- We will describe now how to create these and how to put things
- together.
-
-PREPARING YOUR SYSTEM
-
- While the result will run on any system, a developer's setup needs these
- tools:
-
- GNU autoconf
- GNU automake
- GNU libtool
- GNU m4
-
- All of these are available from
-
- ftp://ftp.gnu.org/pub/gnu/
-
-CONVERTING AN EXISTING EXTENSION
-
- Just to show you how easy it is to create a self-contained
- extension, we will convert an embedded extension into a
- self-contained one. Install PHP and execute the following
- commands.
-
- $ mkdir /tmp/newext
- $ cd /tmp/newext
-
- You now have an empty directory. We will copy the files from
- the mysql extension:
-
- $ cp -rp php-4.0.X/ext/mysql/* .
-
- It is time to finish the module. Run:
-
- $ phpize
-
- You can now ship the contents of the directory - the extension
- can live completely on its own.
-
- The user instructions boil down to
-
- $ ./configure \
- [--with-php-config=/path/to/php-config] \
- [--with-mysql=MYSQL-DIR]
- $ make install
-
- The MySQL module will either use the embedded MySQL client
- library or the MySQL installation in MYSQL-DIR.
-
-
-DEFINING THE NEW EXTENSION
-
- Our demo extension is called "foobar".
-
- It consists of two source files "foo.c" and "bar.c"
- (and any arbitrary amount of header files, but that is not
- important here).
-
- The demo extension does not reference any external
- libraries (that is important, because the user does not
- need to specify anything).
-
-
- LTLIBRARY_SOURCES specifies the names of the sources files. You can
- name an arbitrary number of source files here.
-
-CREATING THE M4 CONFIGURATION FILE
-
- The m4 configuration can perform additional checks. For a
- self-contained extension, you do not need more than a few
- macro calls.
-
-------------------------------------------------------------------------------
-PHP_ARG_ENABLE(foobar,whether to enable foobar,
-[ --enable-foobar Enable foobar])
-
-if test "$PHP_FOOBAR" != "no"; then
- PHP_NEW_EXTENSION(foobar, foo.c bar.c, $ext_shared)
-fi
-------------------------------------------------------------------------------
-
- PHP_ARG_ENABLE will automatically set the correct variables, so
- that the extension will be enabled by PHP_NEW_EXTENSION in shared mode.
-
- The first argument of PHP_NEW_EXTENSION describes the name of the
- extension. The second names the source-code files. The third passes
- $ext_shared which is set by PHP_ARG_ENABLE/WITH to PHP_NEW_EXTENSION.
-
- Please use always PHP_ARG_ENABLE or PHP_ARG_WITH. Even if you do not
- plan to distribute your module with PHP, these facilities allow you
- to integrate your module easily into the main PHP module framework.
-
-CREATING SOURCE FILES
-
- ext_skel can be of great help when creating the common code for all modules
- in PHP for you and also writing basic function definitions and C code for
- handling arguments passed to your functions. See README.EXT_SKEL for further
- information.
-
- As for the rest, you are currently alone here. There are a lot of existing
- modules, use a simple module as a starting point and add your own code.
-
-
-CREATING THE SELF-CONTAINED EXTENSION
-
- Put config.m4 and the source files into one directory. Then, run phpize
- (this is installed during make install by PHP 4.0).
-
- For example, if you configured PHP with --prefix=/php, you would run
-
- $ /php/bin/phpize
-
- This will automatically copy the necessary build files and create
- configure from your config.m4.
-
- And that's it. You now have a self-contained extension.
-
-INSTALLING A SELF-CONTAINED EXTENSION
-
- An extension can be installed by running:
-
- $ ./configure \
- [--with-php-config=/path/to/php-config]
- $ make install
-
-ADDING SHARED MODULE SUPPORT TO A MODULE
-
- In order to be useful, a self-contained extension must be loadable
- as a shared module. I will explain now how you can add shared module
- support to an existing module called foo.
-
- 1. In config.m4, use PHP_ARG_WITH/PHP_ARG_ENABLE. Then you will
- automatically be able to use --with-foo=shared[,..] or
- --enable-foo=shared[,..].
-
- 2. In config.m4, use PHP_NEW_EXTENSION(foo,.., $ext_shared) to enable
- building the extension.
-
- 3. Add the following lines to your C source file:
-
- #ifdef COMPILE_DL_FOO
- ZEND_GET_MODULE(foo)
- #endif
diff --git a/README.STREAMS b/README.STREAMS
deleted file mode 100644
index f625406a3b..0000000000
--- a/README.STREAMS
+++ /dev/null
@@ -1,379 +0,0 @@
-An Overview of the PHP Streams abstraction
-==========================================
-$Id$
-
-WARNING: some prototypes in this file are out of date.
-The information contained here is being integrated into
-the PHP manual - stay tuned...
-
-Please send comments to: Wez Furlong <wez@thebrainroom.com>
-
-Why Streams?
-============
-You may have noticed a shed-load of issock parameters flying around the PHP
-code; we don't want them - they are ugly and cumbersome and force you to
-special case sockets and files every time you need to work with a "user-level"
-PHP file pointer.
-Streams take care of that and present the PHP extension coder with an ANSI
-stdio-alike API that looks much nicer and can be extended to support non file
-based data sources.
-
-Using Streams
-=============
-Streams use a php_stream* parameter just as ANSI stdio (fread etc.) use a
-FILE* parameter.
-
-The main functions are:
-
-PHPAPI size_t php_stream_read(php_stream * stream, char * buf, size_t count);
-PHPAPI size_t php_stream_write(php_stream * stream, const char * buf, size_t
- count);
-PHPAPI size_t php_stream_printf(php_stream * stream TSRMLS_DC,
- const char * fmt, ...);
-PHPAPI int php_stream_eof(php_stream * stream);
-PHPAPI int php_stream_getc(php_stream * stream);
-PHPAPI char *php_stream_gets(php_stream * stream, char *buf, size_t maxlen);
-PHPAPI int php_stream_close(php_stream * stream);
-PHPAPI int php_stream_flush(php_stream * stream);
-PHPAPI int php_stream_seek(php_stream * stream, off_t offset, int whence);
-PHPAPI off_t php_stream_tell(php_stream * stream);
-PHPAPI int php_stream_lock(php_stream * stream, int mode);
-
-These (should) behave in the same way as the ANSI stdio functions with similar
-names: fread, fwrite, fprintf, feof, fgetc, fgets, fclose, fflush, fseek, ftell, flock.
-
-Opening Streams
-===============
-In most cases, you should use this API:
-
-PHPAPI php_stream *php_stream_open_wrapper(char *path, char *mode,
- int options, char **opened_path TSRMLS_DC);
-
-Where:
- path is the file or resource to open.
- mode is the stdio compatible mode eg: "wb", "rb" etc.
- options is a combination of the following values:
- IGNORE_PATH (default) - don't use include path to search for the file
- USE_PATH - use include path to search for the file
- IGNORE_URL - do not use plugin wrappers
- REPORT_ERRORS - show errors in a standard format if something
- goes wrong.
- STREAM_MUST_SEEK - If you really need to be able to seek the stream
- and don't need to be able to write to the original
- file/URL, use this option to arrange for the stream
- to be copied (if needed) into a stream that can
- be seek()ed.
-
- opened_path is used to return the path of the actual file opened,
- but if you used STREAM_MUST_SEEK, may not be valid. You are
- responsible for efree()ing opened_path. opened_path may be (and usually
- is) NULL.
-
-If you need to open a specific stream, or convert standard resources into
-streams there are a range of functions to do this defined in php_streams.h.
-A brief list of the most commonly used functions:
-
-PHPAPI php_stream *php_stream_fopen_from_file(FILE *file, const char *mode);
- Convert a FILE * into a stream.
-
-PHPAPI php_stream *php_stream_fopen_tmpfile(void);
- Open a FILE * with tmpfile() and convert into a stream.
-
-PHPAPI php_stream *php_stream_fopen_temporary_file(const char *dir,
- const char *pfx, char **opened_path TSRMLS_DC);
- Generate a temporary file name and open it.
-
-There are some network enabled relatives in php_network.h:
-
-PHPAPI php_stream *php_stream_sock_open_from_socket(int socket, int persistent);
- Convert a socket into a stream.
-
-PHPAPI php_stream *php_stream_sock_open_host(const char *host, unsigned short port,
- int socktype, int timeout, int persistent);
- Open a connection to a host and return a stream.
-
-PHPAPI php_stream *php_stream_sock_open_unix(const char *path, int persistent,
- struct timeval *timeout);
- Open a UNIX domain socket.
-
-
-Stream Utilities
-================
-
-If you need to copy some data from one stream to another, you will be please
-to know that the streams API provides a standard way to do this:
-
-PHPAPI size_t php_stream_copy_to_stream(php_stream *src,
- php_stream *dest, size_t maxlen);
-
-If you want to copy all remaining data from the src stream, pass
-PHP_STREAM_COPY_ALL as the maxlen parameter, otherwise maxlen indicates the
-number of bytes to copy.
-This function will try to use mmap where available to make the copying more
-efficient.
-
-If you want to read the contents of a stream into an allocated memory buffer,
-you should use:
-
-PHPAPI size_t php_stream_copy_to_mem(php_stream *src, char **buf,
- size_t maxlen, int persistent);
-
-This function will set buf to the address of the buffer that it allocated,
-which will be maxlen bytes in length, or will be the entire length of the
-data remaining on the stream if you set maxlen to PHP_STREAM_COPY_ALL.
-The buffer is allocated using pemalloc(); you need to call pefree() to
-release the memory when you are done.
-As with copy_to_stream, this function will try use mmap where it can.
-
-If you have an existing stream and need to be able to seek() it, you
-can use this function to copy the contents into a new stream that can
-be seek()ed:
-
-PHPAPI int php_stream_make_seekable(php_stream *origstream, php_stream **newstream);
-
-It returns one of the following values:
-#define PHP_STREAM_UNCHANGED 0 /* orig stream was seekable anyway */
-#define PHP_STREAM_RELEASED 1 /* newstream should be used; origstream is no longer valid */
-#define PHP_STREAM_FAILED 2 /* an error occurred while attempting conversion */
-#define PHP_STREAM_CRITICAL 3 /* an error occurred; origstream is in an unknown state; you should close origstream */
-
-make_seekable will always set newstream to be the stream that is valid
-if the function succeeds.
-When you have finished, remember to close the stream.
-
-NOTE: If you only need to seek forward, there is no need to call this
-function, as the php_stream_seek can emulate forward seeking when the
-whence parameter is SEEK_CUR.
-
-NOTE: Writing to the stream may not affect the original source, so it
-only makes sense to use this for read-only use.
-
-NOTE: If the origstream is network based, this function will block
-until the whole contents have been downloaded.
-
-NOTE: Never call this function with an origstream that is referenced
-as a resource! It will close the origstream on success, and this
-can lead to a crash when the resource is later used/released.
-
-NOTE: If you are opening a stream and need it to be seekable, use the
-STREAM_MUST_SEEK option to php_stream_open_wrapper();
-
-PHPAPI int php_stream_supports_lock(php_stream * stream);
-
-This function will return either 1 (success) or 0 (failure) indicating whether or
-not a lock can be set on this stream. Typically you can only set locks on stdio streams.
-
-Casting Streams
-===============
-What if your extension needs to access the FILE* of a user level file pointer?
-You need to "cast" the stream into a FILE*, and this is how you do it:
-
-FILE * fp;
-php_stream * stream; /* already opened */
-
-if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void*)&fp, REPORT_ERRORS) == FAILURE) {
- RETURN_FALSE;
-}
-
-The prototype is:
-
-PHPAPI int php_stream_cast(php_stream * stream, int castas, void ** ret, int
- show_err);
-
-The show_err parameter, if non-zero, will cause the function to display an
-appropriate error message of type E_WARNING if the cast fails.
-
-castas can be one of the following values:
-PHP_STREAM_AS_STDIO - a stdio FILE*
-PHP_STREAM_AS_FD - a generic file descriptor
-PHP_STREAM_AS_SOCKETD - a socket descriptor
-
-If you ask a socket stream for a FILE*, the abstraction will use fdopen to
-create it for you. Be warned that doing so may cause buffered data to be lost
-if you mix ANSI stdio calls on the FILE* with php stream calls on the stream.
-
-If your system has the fopencookie function, php streams can synthesize a
-FILE* on top of any stream, which is useful for SSL sockets, memory based
-streams, data base streams etc. etc.
-
-In situations where this is not desirable, you should query the stream
-to see if it naturally supports FILE *. You can use this code snippet
-for this purpose:
-
- if (php_stream_is(stream, PHP_STREAM_IS_STDIO)) {
- /* can safely cast to FILE* with no adverse side effects */
- }
-
-You can use:
-
-PHPAPI int php_stream_can_cast(php_stream * stream, int castas)
-
-to find out if a stream can be cast, without actually performing the cast, so
-to check if a stream is a socket you might use:
-
-if (php_stream_can_cast(stream, PHP_STREAM_AS_SOCKETD) == SUCCESS) {
- /* it can be a socket */
-}
-
-Please note the difference between php_stream_is and php_stream_can_cast;
-stream_is tells you if the stream is a particular type of stream, whereas
-can_cast tells you if the stream can be forced into the form you request.
-The former doesn't change anything, while the later *might* change some
-state in the stream.
-
-Stream Internals
-================
-
-There are two main structures associated with a stream - the php_stream
-itself, which holds some state information (and possibly a buffer) and a
-php_stream_ops structure, which holds the "virtual method table" for the
-underlying implementation.
-
-The php_streams ops struct consists of pointers to methods that implement
-read, write, close, flush, seek, gets and cast operations. Of these, an
-implementation need only implement write, read, close and flush. The gets
-method is intended to be used for streams if there is an underlying method
-that can efficiently behave as fgets. The ops struct also contains a label
-for the implementation that will be used when printing error messages - the
-stdio implementation has a label of "STDIO" for example.
-
-The idea is that a stream implementation defines a php_stream_ops struct, and
-associates it with a php_stream using php_stream_alloc.
-
-As an example, the php_stream_fopen() function looks like this:
-
-PHPAPI php_stream * php_stream_fopen(const char * filename, const char * mode)
-{
- FILE * fp = fopen(filename, mode);
- php_stream * ret;
-
- if (fp) {
- ret = php_stream_alloc(&php_stream_stdio_ops, fp, 0, 0, mode);
- if (ret)
- return ret;
-
- fclose(fp);
- }
- return NULL;
-}
-
-php_stream_stdio_ops is a php_stream_ops structure that can be used to handle
-FILE* based streams.
-
-A socket based stream would use code similar to that above to create a stream
-to be passed back to fopen_wrapper (or it's yet to be implemented successor).
-
-The prototype for php_stream_alloc is this:
-
-PHPAPI php_stream * php_stream_alloc(php_stream_ops * ops, void * abstract,
- size_t bufsize, int persistent, const char * mode)
-
-ops is a pointer to the implementation,
-abstract holds implementation specific data that is relevant to this instance
-of the stream,
-bufsize is the size of the buffer to use - if 0, then buffering at the stream
-level will be disabled (recommended for underlying sources that implement
-their own buffering - such a FILE*),
-persistent controls how the memory is to be allocated - persistently so that
-it lasts across requests, or non-persistently so that it is freed at the end
-of a request (it uses pemalloc),
-mode is the stdio-like mode of operation - php streams places no real meaning
-in the mode parameter, except that it checks for a 'w' in the string when
-attempting to write (this may change).
-
-The mode parameter is passed on to fdopen/fopencookie when the stream is cast
-into a FILE*, so it should be compatible with the mode parameter of fopen().
-
-Writing your own stream implementation
-======================================
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-RULE #1: when writing your own streams: make sure you have configured PHP with
---enable-debug.
-I've taken some great pains to hook into the Zend memory manager to help track
-down allocation problems. It will also help you spot incorrect use of the
-STREAMS_DC, STREAMS_CC and the semi-private STREAMS_REL_CC macros for function
-definitions.
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-RULE #2: Please use the stdio stream as a reference; it will help you
-understand the semantics of the stream operations, and it will always
-be more up to date than these docs :-)
-
-First, you need to figure out what data you need to associate with the
-php_stream. For example, you might need a pointer to some memory for memory
-based streams, or if you were making a stream to read data from an RDBMS like
-MySQL, you might want to store the connection and rowset handles.
-
-The stream has a field called abstract that you can use to hold this data.
-If you need to store more than a single field of data, define a structure to
-hold it, allocate it (use pemalloc with the persistent flag set
-appropriately), and use the abstract pointer to refer to it.
-
-For structured state you might have this:
-
-struct my_state {
- MYSQL conn;
- MYSQL_RES * result;
-};
-
-struct my_state * state = pemalloc(sizeof(struct my_state), persistent);
-
-/* initialize the connection, and run a query, using the fields in state to
- * hold the results */
-
-state->result = mysql_use_result(&state->conn);
-
-/* now allocate the stream itself */
-stream = php_stream_alloc(&my_ops, state, 0, persistent, "r");
-
-/* now stream->abstract == state */
-
-Once you have that part figured out, you can write your implementation and
-define the your own php_stream_ops struct (we called it my_ops in the above
-example).
-
-For example, for reading from this weird MySQL stream:
-
-static size_t php_mysqlop_read(php_stream * stream, char * buf, size_t count)
-{
- struct my_state * state = (struct my_state*)stream->abstract;
-
- if (buf == NULL && count == 0) {
- /* in this special case, php_streams is asking if we have reached the
- * end of file */
- if (... at end of file ...)
- return EOF;
- else
- return 0;
- }
-
- /* pull out some data from the stream and put it in buf */
- ... mysql_fetch_row(state->result) ...
- /* we could do something strange, like format the data as XML here,
- and place that in the buf, but that brings in some complexities,
- such as coping with a buffer size too small to hold the data,
- so I won't even go in to how to do that here */
-}
-
-Implement the other operations - remember that write, read, close and flush
-are all mandatory. The rest are optional. Declare your stream ops struct:
-
-php_stream_ops my_ops = {
- php_mysqlop_write, php_mysqlop_read, php_mysqlop_close,
- php_mysqlop_flush, NULL, NULL, NULL,
- "Strange MySQL example"
-}
-
-Thats it!
-
-Take a look at the STDIO implementation in streams.c for more information
-about how these operations work.
-The main thing to remember is that in your close operation you need to release
-and free the resources you allocated for the abstract field. In the case of
-the example above, you need to use mysql_free_result on the rowset, close the
-connection and then use pefree to dispose of the struct you allocated.
-You may read the stream->persistent field to determine if your struct was
-allocated in persistent mode or not.
-
-vim:tw=78:et
diff --git a/README.SUBMITTING_PATCH b/README.SUBMITTING_PATCH
deleted file mode 100644
index 51dac14029..0000000000
--- a/README.SUBMITTING_PATCH
+++ /dev/null
@@ -1,126 +0,0 @@
-Submitting Patch for PHP
-========================
-
-This document describes how to submit a patch for PHP. Since you are
-reading this document, you are willing to submit a patch for PHP.
-Please keep reading! Submitting a patch for PHP is easy. The hard
-part is making it acceptable for inclusion into our repository. :-)
-
-How to create patch?
---------------------
-We are working with CVS. You need to get CVS source to create a patch
-that we accept. Visit http://www.php.net/anoncvs.php to get CVS
-source. You can check out older versions, but make sure you get
-the default branch (i.e. Do not use -r option when you check out the
-CVS source)
-
-Read CODING_STANDARDS file before you start working.
-
-Now you are ready to create a patch. Modify source to fix a bug in PHP or
-add a new feature to PHP. After you finished editing, please test your
-patch. Read README.TESTING for testing.
-
-After you finish testing your patch, take diff file using
-"cvs diff > your.patch" command.
-
-Read README.TESTING for submitting a test script for your patch. This is
-not strictly required, but it is preferred to submit a test script along
-with your patch. Making new test script is very easy. It also helps us
-to understand what you have been fixed or added to PHP.
-
-
-Tips for creating patch
------------------------
-If you would like to fix multiple bugs. It is easier for us if you
-could create 1 patch for 1 bug, but this is not strictly required.
-Note though that you might get little response, if your patch is
-too hard to review.
-
-If you would like change/add many lines, it is better to ask module
-maintainer and/or php-dev@lists.php.net, or pear-dev@lists.php.net if
-you are patching PEAR. Official module maintainers can be found in
-EXTENSIONS file in PHP source.
-
-If you are new to CVS (Concurrent Versions System), visit
-http://cvshome.org/ for details.
-
-
-Recommended CVS client settings for creating patch file
-------------------------------------------------------
-Recommended ~/.cvsrc file setting is:
-------
-cvs -z3
-update -d -P
-checkout -P
-diff -u
-
-------
-diff -u means:
- -u Use the unified output format.
-
-With this CVS setting, you don't have to worry about adding/deleting
-newlines and spaces.
-
-
-Check list for submitting patch
--------------------------------
- - Did you run "make test" to check if your patch didn't break
- other features?
- - Did you compile PHP with --enable-debug and check the PHP and
- web server error logs when you test your patch?
- - Did you build PHP for multi-threaded web servers. (Optional)
- - Did you create test script for "make test"? (Recommended)
- - Did you check your patch is unified format and it does not
- contain white space changes? (If you are not using recommended
- cvs setting)
- - Did you update CVS source before you take final patch?
- - Did you read the patch again?
-
-
-Where to send your patch?
--------------------------
-If you are patching C source, send the patch to php-dev@lists.php.net.
-If you are patching a module, you should also send the patch to the
-maintainer. Official module maintainers are listed in EXTENSION file
-in source.
-
-If you are patching PEAR, send the patch to pear-dev@lists.php.net.
-
-Please add the prefix "[PATCH]" to your email subject and make sure
-to include the patch as a MIME attachment even if it is short.
-
-NOTE: only MIME attachments of type 'text/*' are accepted. The
- easiest way to acclomplish this, is to make the extension
- '.txt'.
-
-Test scripts should be included in the same email.
-Explain what has been fixed/added/changed by your patch.
-
-Finally, add the bug Id(s) which can be closed by your patch, if any.
-
-
-What happens after you submit your patch
---------------------------------------
-If your patch is easy to review and has obviously no side-effects,
-it might take up to a few hours until someone commits it.
-
-Because this is a volunteer-driven effort, more complex patches will
-require more patience on your side.
-
-If you did not receive any feedback in a few days, please consider
-resubmitting the description of your patch, along-side with
-these questions:
-
-- Is my patch too hard to review? Because of which factors?
-- Should I split it up in multiple parts?
-- Are there any unwanted whitespace changes?
-
-
-What happens when your patch is applied?
-----------------------------------------
-Your name will be included together with your email address in the CVS
-commit log. If your patch affects end-users, a brief description
-and your name might be added to the NEWS file.
-
-
-Thank you for submitting patch for PHP!
diff --git a/README.TESTING b/README.TESTING
deleted file mode 100644
index eca267a636..0000000000
--- a/README.TESTING
+++ /dev/null
@@ -1,170 +0,0 @@
-[IMPORTANT NOTICE]
-------------------
- Please do not ask developers why some or all tests are failing in
-your environment! Let us know if you find why it fails. Thank you.
-
-
-[Testing Basics]
-----------------
- To execute test scripts, you must build PHP with some SAPI, then you
-type "make test" to execute all or some test scripts saved under
-"tests" directory under source root directory.
-
-Usage:
-make test
-
- "make test" basically executes "run-tests.php" script
-under the source root (parallel builds will not work). Therefore you
-can execute the script as follows:
-
-TEST_PHP_EXECUTABLE=sapi/cli/php \
-sapi/cli/php [-c /path/to/php.ini] run-tests.php [ext/foo/tests/GLOB]
-
-
-[Which "php" executable "make test" look for]
----------------------------------------------
- You must use TEST_PHP_EXECUTABLE environment variable to explicitly
-select the php executable to be used to run the tests. That can either
-be the CLI or CGI executable.
-
- "make test" executes "run-tests.php" script with "php" binary. Some
-test scripts such as session must be executed by CGI SAPI. Therefore,
-you must build PHP with CGI SAPI to perform all tests.
-
-NOTE: PHP binary executing "run-tests.php" and php binary used for
-executing test scripts may differ. If you use different PHP binary for
-executing "run-tests.php" script, you may get errors.
-
-
-[Which php.ini is used]
------------------------
- "make test" uses the same php.ini file as it would once installed.
-The tests have been written to be independent of that php.ini file,
-so if you find a test that is affected by a setting, please report
-this, so we can address the issue.
-
-
-[Which test scripts are executed]
----------------------------------
- "run-tests.php" ("make test"), without any arguments executes all
-test scripts by extracting all directories named "tests"
-from the source root and any subdirectories below. If there are files,
-which have a "phpt" extension, "run-tests.php" looks at the sections
-in these files, determines whether it should run it, by evaluating
-the 'SKIP' section. If the test is eligible for execution, the 'FILE'
-section is extracted into a ".php" file (with the same name besides
-the extension) and gets executed.
-When an argument is given or TESTS environment variable is set, the
-GLOB is expanded by the shell and any file with extension "*.phpt" is
-regarded as a test file.
-
- Tester can easily execute tests selectively with as follows.
-
-Examples:
-./sapi/cli/php run-tests.php ext/mbstring/*
-./sapi/cli/php run-tests.php ext/mbstring/020.phpt
-
-
-[Test results]
---------------
- Test results are printed to standard output. If there is a failed test,
-the "run-tests.php" script saves the result, the expected result and the
-code executed to the test script directory. For example, if
-ext/myext/tests/myext.phpt fails to pass, the following files are created:
-
-ext/myext/tests/myext.php - actual test file executed
-ext/myext/tests/myext.log - log of test execution (L)
-ext/myext/tests/myext.exp - expected output (E)
-ext/myext/tests/myext.out - output from test script (O)
-ext/myext/tests/myext.diff - diff of .out and .exp (D)
-
- Failed tests are always bugs. Either the test is bugged or not considering
-factors applying to the tester's environment, or there is a bug in PHP.
-If this is a known bug, we strive to provide bug numbers, in either the
-test name or the file name. You can check the status of such a bug, by
-going to: http://bugs.php.net/12345 where 12345 is the bug number.
-For clarity and automated processing, bug numbers are prefixed by a hash
-sign '#' in test names and/or test cases are named bug12345.phpt.
-
-NOTE: The files generated by tests can be selected by setting the
-environment variable TEST_PHP_LOG_FORMAT. For each file you want to be
-generated use the character in brackets as shown above (default is LEOD).
-The php file will be generated always.
-
-NOTE: You can set environment variable TEST_PHP_DETAILED to enable
-detailed test information.
-
-[Automated testing]
- If you like to keep up to speed, with latest developments and quality
-assurance, setting the environment variable NO_INTERACTION to 1, will not
-prompt the tester for any user input.
-
-Normally, the exit status of "make test" is zero, regardless of the results
-of independent tests. Set the environment variable REPORT_EXIT_STATUS to 1,
-and "make test" will set the exit status ("$?") to non-zero, when an
-individual test has failed.
-
-Example script to be run by cron(1):
-========== qa-test.sh =============
-#!/bin/sh
-
-CO_DIR=$HOME/cvs/php4
-MYMAIL=qa-test@domain.com
-TMPDIR=/var/tmp
-TODAY=`date +"%Y%m%d"`
-
-# Make sure compilation enviroment is correct
-CONFIGURE_OPTS='--disable-all --enable-cli --with-pcre'
-export MAKE=gmake
-export CC=gcc
-
-# Set test environment
-export NO_INTERACTION=1
-export REPORT_EXIT_STATUS=1
-
-cd $CO_DIR
-cvs update . >>$TMPDIR/phpqatest.$TODAY
-./cvsclean ; ./buildconf ; ./configure $CONFIGURE_OPTS ; $MAKE
-$MAKE test >>$TMPDIR/phpqatest.$TODAY 2>&1
-if test $? -gt 0
-then
- cat $TMPDIR/phpqatest.$TODAY | mail -s"PHP-QA Test Failed for $TODAY" $MYMAIL
-fi
-========== end of qa-test.sh =============
-
-NOTE: the exit status of run-tests.php will be 1 when
-REPORT_EXIT_STATUS is set. The result of "make test" may be higher
-than that. At present, gmake 3.79.1 returns 2, so it is
-advised to test for non-zero, rather then a specific value.
-
-
-[Creating new test files]
--------------------------
- Writing test file is very easy if you are used to PHP.
-See the HOWTO at http://qa.php.net/write-test.php
-
-
-[How to help us]
-----------------
- If you find bug in PHP, you can submit bug report AND test script
-for us. You don't have to write complete script, just give us test
-script with following format. Please test the script and make sure
-you write the correct ACTUAL OUTPUT and EXPECTED OUTPUT before you
-submit.
-
-<?php
-/*
-Bug #12345
-substr() bug. Do not return expected string.
-
-ACTUAL OUTPUT
-XYXA
-
-EXPECTED OUTPUT
-ABCD
-*/
-
-$str = "XYZABCD";
-echo substr($str,3,7);
-
-?>
diff --git a/README.TESTING2 b/README.TESTING2
deleted file mode 100644
index 30bd26c88e..0000000000
--- a/README.TESTING2
+++ /dev/null
@@ -1,137 +0,0 @@
-[IMPORTANT NOTICE]
-------------------
-This is an addendum to README.TESTING with additional information
-specific to run-tests2.php.
-
-run-tests2.php is backward compatible with tests developed for
-the original run-tests.php script. run-tests2 is *not* used by
-'make test'. run-tests2 was developed to provide support for
-testing PHP under it's primary environment, HTTP, and can run the
-PHP tests under any of the SAPI modules that are direct executables,
-or are accessable via HTTP.
-
-[New features]
-----------------
-* Command line interface:
- You can run 'php run-tests2.php -h' to get all the possible options.
-* Configuration file:
- the -c argument will allow you to use a configuration file. This is
- handy if you are testing multiple environments and need various options
- depending on the environment.
- see run-tests-config.php for details.
-* CGI Emulation:
- Will emulate a CGI environment when testing with the cgi sapi executable.
-* HTTP testing:
- can be configured to run test scripts through an HTTP server running
- on localhost. localhost is required since either the web server must
- alias a directory to the php source directory, or the test scripts
- must be copied to a directory under the web server
- (see config options TEST_WEB_BASE_URL, TEST_BASE_PATH, and TEST_WEB_EXT)
-* New sections supported for test files (see below)
-
-When running tests over http, tests that require ini settings different that what
-the web server runs under will be skipped. Since the test harness defines a number
-of ini settings by default, the web server may require special configuration to
-make testing work.
-
-[Example Usage]
-----------------
-Some (but not all!) examples of usage:
-
-1. run tests from the php source directory
- php run-tests2.php -p /path/to/php-cli
-
-2. run tests using cgi emulation
- php run-tests2.php -p /path/to/php-cgi
-
-3. run tests over http, copying test files into document root
- php run-tests2.php -w -u http://localhost/test -m /path/to/htdocs/test
-
-4. run tests over http, php sources have been aliased in web server
- php run-tests2.php -w -u http://localhost/test
-
-5. run tests using configuration file
- php run-tests2.php -c /path/to/run-tests-config.php
-
-6. run tests using configuration file, but overriding some settings:
- (config file must be first)
- php run-tests2.php -c /path/to/run-tests-config.php -w -t 3 -d /path/to/testdir
-
-NOTE: configuration as described in README.TESTING still works.
-
-[New Test Sections]
-----------------
-In addition to the traditional test sections
-(see http://qa.php.net/write-test.php), several new sections are available
-under run-tests2.
-
---POST--
-This is not a new section, but not multipart posts are supported for testing
-file uploads, or other types of POST data.
-
---CGI--
-This section takes no value. It merely provides a simple marker for tests
-that MUST be run as CGI, even if there is no --POST-- or --GET-- sections
-in the test file.
-
---DESCRIPTION--
-Not used for anything, just a section for documenting the test
-
---ENV--
-This section get's eval()'d to help build an environment for the
-execution of the test. This can be used to change environment
-vars that are used for CGI emulation, or simply to set env vars
-for cli testing. A full example looks like:
-
- --ENV--
- return <<<END
- PATH_TRANSLATED=$filename
- PATH_INFO=$scriptname
- SCRIPT_NAME=$scriptname
- END;
-
-Some variables are made easily available for use in this section, they
-include:
- $filename full native path to file, will become PATH_TRANSLATED
- $filepath =dirname($filename)
- $scriptname this is what will become SCRIPT_NAME unless you override it
- $docroot the equivelant of DOCUMENT_ROOT under Apache
- $cwd the directory that the test is being initiated from
- $this->conf all run-tests2 configuration vars
- $this->env all environment variables that will get passed to the test
-
-
---REQUEST--
-This section is also eval'd, and is similar in nature to --ENV--. However,
-this section is used to build the url used in an HTTP request. Valid values
-to set in this section would include:
- SCRIPT_NAME The inital part of the request url
- PATH_INFO The pathinfo part of a request url
- FRAGMENT The fragment section of a url (after #)
- QUERY_STRING The query part of a url (after ?)
-
- --REQUEST--
- return <<<END
- PATH_INFO=/path/info
- END;
-
---HEADERS--
-This section is also eval'd. It is used to provide additional headers sent
-in an HTTP request, such as content type for multipart posts, cookies, etc.
-
- --HEADERS--
- return <<<END
- Content-Type=multipart/form-data; boundary=---------------------------240723202011929
- Content-Length=100
- END;
-
---EXPECTHEADERS--
-This section can be used to define what headers are required to be
-received back from a request, and is checked in addition to the
-regular expect sections. For example:
-
- --EXPECTHEADERS--
- Status: 404
-
-
-
diff --git a/README.UNIX-BUILD-SYSTEM b/README.UNIX-BUILD-SYSTEM
deleted file mode 100644
index 6a4ce92f6e..0000000000
--- a/README.UNIX-BUILD-SYSTEM
+++ /dev/null
@@ -1,123 +0,0 @@
-PHP Build System V5 Overview
-
-- supports Makefile.ins during transition phase
-- not-really-portable Makefile includes have been eliminated
-- supports separate build directories without VPATH by using
- explicit rules only
-- does not waste disk-space/CPU-time for building temporary libraries
- => especially noticeable on slower systems
-- slow recursive make replaced with one global Makefile
-- eases integration of proper dependencies
-- adds PHP_DEFINE(what[, value]) which creates a single include-file
- per what. This will allow more fine-grained dependencies.
-- abandoning the "one library per directory" concept
-- improved integration of the CLI
-- several new targets
- build-modules: builds and copies dynamic modules into modules/
- install-cli: installs the CLI only, so that the install-sapi
- target does only what its name says
-- finally abandoned automake (still requires aclocal at this time)
-- changed some configure-time constructs to run at buildconf-time
-- upgraded shtool to 1.5.4
-- removed $(moduledir) (use EXTENSION_DIR)
-
-The Reason For a New System
-
-It became more and more apparent that there is a severe need
-for addressing the portability concerns and improving the chance
-that your build is correct (how often have you been told to
-"make clean"? When this is done, you won't need to anymore).
-
-
-If You Build PHP on a Unix System
-
-
-You, as a user of PHP, will notice no changes. Of course, the build
-system will be faster, look better and work smarter.
-
-
-
-If You Are Developing PHP
-
-
-
-
-Extension developers:
-
-Makefile.ins are abandoned. The files which are to be compiled
-are specified in the config.m4 now using the following macro:
-
-PHP_NEW_EXTENSION(foo, foo.c bar.c baz.cpp, $ext_shared)
-
-E.g. this enables the extension foo which consists of three source-code
-modules, two in C and one in C++. And, depending on the user's wishes,
-the extension will even be built as a dynamic module.
-
-The full syntax:
-
-PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags]]])
-
-Please have a look at acinclude.m4 for the gory details and meanings
-of the other parameters.
-
-And that's basically it for the extension side.
-
-If you previously built sub-libraries for this module, add
-the source-code files here as well. If you need to specify
-separate include directories, do it this way:
-
-PHP_NEW_EXTENSION(foo, foo.c mylib/bar.c mylib/gregor.c,,,-I@ext_srcdir@/lib)
-
-E.g. this builds the three files which are located relative to the
-extension source directory and compiles all three files with the
-special include directive (@ext_srcdir@ is automatically replaced).
-
-Now, you need to tell the build system that you want to build files
-in a directory called $ext_builddir/lib:
-
-PHP_ADD_BUILD_DIR($ext_builddir/lib)
-
-Make sure to call this after PHP_NEW_EXTENSION, because $ext_builddir
-is only set by the latter.
-
-If you have a complex extension, you might to need add special
-Make rules. You can do this by calling PHP_ADD_MAKEFILE_FRAGMENT
-in your config.m4 after PHP_NEW_EXTENSION.
-
-This will read a file in the source-dir of your extension called
-Makefile.frag. In this file, $(builddir) and $(srcdir) will be
-replaced by the values which are correct for your extension
-and which are again determined by the PHP_NEW_EXTENSION macro.
-
-Make sure to prefix *all* relative paths correctly with either
-$(builddir) or $(srcdir). Because the build system does not
-change the working directory anymore, we must use either
-absolute paths or relative ones to the top build-directory.
-Correct prefixing ensures that.
-
-
-SAPI developers:
-
-Instead of using PHP_SAPI=foo/PHP_BUILD_XYZ, you will need to type
-
-PHP_SELECT_SAPI(name, type, sources.c)
-
-I.e. specify the source-code files as above and also pass the
-information regarding how PHP is supposed to be built (shared
-module, program, etc).
-
-For example for APXS:
-
-PHP_SELECT_SAPI(apache, shared, sapi_apache.c mod_php4.c php_apache.c)
-
-
-
-General info
-
-The foundation for the new system is the flexible handling of
-sources and their contexts. With the help of macros you
-can define special flags for each source-file, where it is
-located, in which target context it can work, etc.
-
-Have a look at the well documented macros
-PHP_ADD_SOURCES(_X) in acinclude.m4.
diff --git a/README.Zeus b/README.Zeus
deleted file mode 100644
index 8dcbb787f2..0000000000
--- a/README.Zeus
+++ /dev/null
@@ -1,112 +0,0 @@
-Using PHP4 with the Zeus Web Server
------------------------------------
-
-Zeus fully supports running PHP in combination with our
-webserver. There are three different interfaces that can be used to
-enable PHP:
-
-* CGI
-* ISAPI
-* FastCGI
-
-Of the three, we recommend using FastCGI, which has been tested and
-benchmarked as providing the best performance and reliability.
-
-Full details of how to install PHP are available from our
-website, at:
-
-http://support.zeus.com/products/php.html
-
-If you have any problems, please check the support site for more
-up-to-date information and advice.
-
-
-Quick guide to installing CGI/FastCGI with Zeus
------------------------------------------------
-
-Step 1 - Compile PHP as FastCGI.
-
-Compile as follows:
- ./configure --enable-fastcgi
- make
-
-Note that PHP has many options to the configure script -
-e.g. --with-mysql. You will probably want to select your usual options
-before compiling; the above is just a bare minimum, for illustration.
-
-After compilation finishes, you will be left with an executable
-program called 'php'. Copy this into your document root, under a
-dedicated FastCGI directory (e.g. $DOCROOT/fcgi-bin/php)
-
-
-Step 2 - configure Zeus
-
-Four stages:
- - enable FastCGI
- - configure FastCGI
- - setup alias for FastCGI
- - setup alias for PHP
-
-1) Using the admin server, go to the 'module configuration' page for
-your virtual server, and ensure that 'fastcgi' is enabled (select the
-tickbox to the left).
-
-2) While we can run FastCGI's locally, there are known problems with
-some OS's (specifically, the communication between web server and
-FastCGI happens over a unix domain socket, and some OS's have trouble
-sustaining high connection rates over these sockets). So instead, we
-are going to set up the PHP FastCGI to run 'remotely' over localhost
-(this uses TCP sockets, which do not suffer this problem). Go to the
-'fastcgi configuration' page, and under 'add remote fastcgi':
- Add Remote FastCGI
- Docroot path /fcgi-bin/php
- Remote machine localhost:8002
-The first entry is where you saved PHP, above.
-The second entry is localhost:<any unused port>
-We will start the FastCGI listening on this port shortly.
-Click 'update' to commit these changes.
-
-3) Go to the path mapping module and add an alias for FastCGI:
- Add Alias
- Docroot path /fcgi-bin
- Filesystem directory /path/to/docroot/fcgi-bin
- Alias type fastcgi
-Click 'update' to commit these changes
-
-4) Also on the path mapping module, add a handler for PHP:
- Add handler
- File extension php
- Handler /fcgi-bin/php
-Click 'update' to commit these changes
-
-Finally restart your virtual server for these changes to take effect.
-
-
-Step 3 - start PHP as a FastCGI runner
-
-When you start PHP, it will pre-fork a given number of child processes
-to handle incoming PHP requests. Each process will handle a given
-number of requests before exiting (and being replaced by a newly
-forked process). You can control these two parameters by setting the
-following environment variables BEFORE starting the FastCGI runner:
-
-PHP_FCGI_CHILDREN - the number of child processes to pre-fork. This
-variable MUST be set, if not then the PHP will not run as a FastCGI.
-We recommend a value of 8 for a fairly busy site. If you have many,
-long-running PHP scripts, then you may need to increase this further.
-
-PHP_FCGI_MAX_REQUESTS - the number of requests each PHP child process
-handles before exiting. If not set, defaults to 500.
-
-To start the FastCGI runner, execute '$ZEUSHOME/web/bin/fcgirunner
-8002 $DOCROOT/fcgi-bin/php'. Substitute the appropriate values for
-$ZEUSHOME and $DOCROOT; also substitute for 8002 the port you chose,
-above.
-
-To stop the runner (e.g. to experiment with the above environment
-variables) you will need to manually stop and running PHP
-processes. (Use 'ps' and 'kill'). As it is PHP which is forking lots
-of children and not the runner, Zeus unfortunately cannot keep track
-of what processes are running, sorry. A typical command line may look
-like 'ps -efl | grep $DOCROOT/fcgi-bin/php | grep -v grep | awk
-'{print $4}' | xargs kill'
diff --git a/README.input_filter b/README.input_filter
deleted file mode 100644
index 60a88ed9c2..0000000000
--- a/README.input_filter
+++ /dev/null
@@ -1,188 +0,0 @@
-Input Filter Support in PHP5
-----------------------------
-
-XSS (Cross Site Scripting) hacks are becoming more and more prevalent,
-and can be quite difficult to prevent. Whenever you accept user data
-and somehow display this data back to users, you are likely vulnerable
-to XSS hacks.
-
-The Input Filter support in PHP5 is aimed at providing the framework
-through which a company-wide or site-wide security policy can be
-enforced. It is implemented as a SAPI hook and is called from the
-treat_data and post handler functions. To implement your own security
-policy you will need to write a standard PHP extension.
-
-A simple implementation might look like the following. This stores the
-original raw user data and adds a my_get_raw() function while the normal
-$_POST, $_GET and $_COOKIE arrays are only populated with stripped
-data. In this simple example all I am doing is calling strip_tags() on
-the data. If register_globals is turned on, the default globals that
-are created will be stripped ($foo) while a $RAW_foo is created with the
-original user input.
-
-ZEND_BEGIN_MODULE_GLOBALS(my_input_filter)
- zval *post_array;
- zval *get_array;
- zval *cookie_array;
-ZEND_END_MODULE_GLOBALS(my_input_filter)
-
-#ifdef ZTS
-#define IF_G(v) TSRMG(my_input_filter_globals_id, zend_my_input_filter_globals *, v)
-#else
-#define IF_G(v) (my_input_filter_globals.v)
-#endif
-
-ZEND_DECLARE_MODULE_GLOBALS(my_input_filter)
-
-function_entry my_input_filter_functions[] = {
- PHP_FE(my_get_raw, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry my_input_filter_module_entry = {
- STANDARD_MODULE_HEADER,
- "my_input_filter",
- my_input_filter_functions,
- PHP_MINIT(my_input_filter),
- PHP_MSHUTDOWN(my_input_filter),
- NULL,
- PHP_RSHUTDOWN(my_input_filter),
- PHP_MINFO(my_input_filter),
- "0.1",
- STANDARD_MODULE_PROPERTIES
-};
-
-PHP_MINIT_FUNCTION(my_input_filter)
-{
- ZEND_INIT_MODULE_GLOBALS(my_input_filter, php_my_input_filter_init_globals, NULL);
-
- REGISTER_LONG_CONSTANT("POST", PARSE_POST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("GET", PARSE_GET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT);
-
- sapi_register_input_filter(my_sapi_input_filter);
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(my_input_filter)
-{
- if(IF_G(get_array)) {
- zval_ptr_dtor(&IF_G(get_array));
- IF_G(get_array) = NULL;
- }
- if(IF_G(post_array)) {
- zval_ptr_dtor(&IF_G(post_array));
- IF_G(post_array) = NULL;
- }
- if(IF_G(cookie_array)) {
- zval_ptr_dtor(&IF_G(cookie_array));
- IF_G(cookie_array) = NULL;
- }
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(my_input_filter)
-{
- php_info_print_table_start();
- php_info_print_table_row( 2, "My Input Filter Support", "enabled" );
- php_info_print_table_row( 2, "Revision", "$Revision$");
- php_info_print_table_end();
-}
-
-unsigned int my_sapi_input_filter(int arg, char *var, char **val, unsigned int val_len)
-{
- zval new_var;
- zval *array_ptr = NULL;
- char *raw_var;
- int var_len;
-
- assert(*val != NULL);
-
- switch(arg) {
- case PARSE_GET:
- if(!IF_G(get_array)) {
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- }
- IF_G(get_array) = array_ptr;
- break;
- case PARSE_POST:
- if(!IF_G(post_array)) {
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- }
- IF_G(post_array) = array_ptr;
- break;
- case PARSE_COOKIE:
- if(!IF_G(cookie_array)) {
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- }
- IF_G(cookie_array) = array_ptr;
- break;
- }
- Z_STRLEN(new_var) = val_len;
- Z_STRVAL(new_var) = estrndup(*val, val_len);
- Z_TYPE(new_var) = IS_STRING;
-
- var_len = strlen(var);
- raw_var = emalloc(var_len+5); /* RAW_ and a \0 */
- strcpy(raw_var, "RAW_");
- strlcat(raw_var,var,var_len+5);
-
- php_register_variable_ex(raw_var, &new_var, array_ptr TSRMLS_DC);
-
- php_strip_tags(*val, val_len, NULL, NULL, 0);
-
- return strlen(*val);
-}
-
-PHP_FUNCTION(my_get_raw)
-{
- long arg;
- char *var;
- int var_len;
- zval **tmp;
- zval *array_ptr = NULL;
- HashTable *hash_ptr;
- char *raw_var;
-
- if(zend_parse_parameters(2 TSRMLS_CC, "ls|l", &arg, &var, &var_len) == FAILURE) {
- return;
- }
-
- switch(arg) {
- case PARSE_GET:
- array_ptr = IF_G(get_array);
- break;
- case PARSE_POST:
- array_ptr = IF_G(post_array);
- break;
- case PARSE_COOKIE:
- array_ptr = IF_G(post_array);
- break;
- }
-
- if(!array_ptr) RETURN_FALSE;
-
- /*
- * I'm changing the variable name here because when running with register_globals on,
- * the variable will end up in the global symbol table
- */
- raw_var = emalloc(var_len+5); /* RAW_ and a \0 */
- strcpy(raw_var, "RAW_");
- strlcat(raw_var,var,var_len+5);
- hash_ptr = HASH_OF(array_ptr);
-
- if(zend_hash_find(hash_ptr, raw_var, var_len+5, (void **)&tmp) == SUCCESS) {
- *return_value = **tmp;
- zval_copy_ctor(return_value);
- } else {
- RETVAL_FALSE;
- }
- efree(raw_var);
-}
-
diff --git a/TODO b/TODO
deleted file mode 100644
index 81750cce87..0000000000
--- a/TODO
+++ /dev/null
@@ -1,162 +0,0 @@
-Things to do or at least think about doing in the future. Name in
-parenthesis means that person has taken on this project.
-
-Zend
-----
- * Allow foreach ($array as $k => list($a, $b)) syntax for multi
- dimensional arrays.
- * Look at replacing c-lib call tolower().
- * Make hash API functions work with HASH_OF() to save time.
- * Allow to set a default value for call-by-reference-parameters.
- eg: function hello (&$pallo = NULL) {}
- * Add configure test to determine if dlsym() requires underscore and set
- DLSYM_NEEDS_UNDERSCORE accordingly. Perl and zsh have it in configure,
- for example. (DONE?)
- * Allow foreach ($array as $k => &$val) syntax. right now we cannot
- traverse an array without copying each element.
- * Native large number support (probably with GNU GMP)
- * Const'ify APIs. Right now, many functions leave parameters untouched,
- but don't declare those as const. This makes interaction with other
- interfaces difficult which pass const parameters to us.
-
-
-global
-------
- * Make sure that all ZTS globals get destructed. Most ts_allocate_id()
- calls should have a dtor entry.
- * on some platforms unimplemented function will just do nothing
- (e.g. symlink) they should print a warning or not even be defined!
- (DONE ?)
- * Use arg_separator.input to implode args in the CGI sapi extension
- and arg_separator.input to explode in php_build_argv(). (DONE?)
- * --enable-all in configure. (--enable-shared=max ...)
- * make configure print out a summary when it's done (like XEmacs)
- * replace standard functions which work on static data with
- reentrancy-safe functions (DONE?).
- * make SAPI conform to CGI/1.1. Currently, all SAPI modules
- define REMOTE_ADDR etc. themselves and reach only various level
- of compliance.
- * see what functions might need to be changed to use HashPosition, so
- that the internal array pointer is not affected.
- * Move most extensions and PEAR packages out of the PHP CVS tree,
- include them again during release packaging.
-
- Other
- * use thread-safe resolver functions (either require BIND 8 or adns).
- * implement javadoc based function docs template system.
- * provide optional IPv6 support (seems to be done?).
- * find a better way to implement script timeouts. SIGVTALRM is used
- by some POSIX threads implementations (i.e. OpenBSD) and is not
- available in ZTS mode.
- * Implement flush feature suitable for nested output buffers.
-
-Streams
--------
- * Route filestat.c through the wrapper layer; isolate the statcache code
- so that it is independent of php functions and can be applied to any
- stream/path.
- * Add unlink() operation to wrappers, route userland unlink() through it.
- Implement unlink() operation for the ftp wrapper.
- * Add a method to take ownership of the memory buffer in memory streams so
- that generating string values for zvals doesn't require an estrdup.
- * bundle and use curl lib for fopen wrapper.
-
-documentation
--------------
- * Add remarks in the documentation which functions are not implemented
- on win32.
- * Add remarks in the documentation which functions are not binary-safe.
- * Update curl documentation (DONE?)
- * Add developer documentation.
- * Add detailed documentation for Java extension.
-
-ext/bz2
--------
- * Add ini setting for decompression buffer size. The default 4k is to small
- for big files and takes ages to decompress. However, 40k which perform
- quite good with big files may be to much under certain environments as
- default setting. There should be consideren different default sizes for
- different SAPIS (e.g. apache and cli).
-
-ext/curl
---------
- * Have a warning scheme for when people use unsupported features.
-
-ext/oci8
---------
- * All OCIFetch*() functions should return 0 for no more data and false on
- error.
- * Have a flag that trims trailing spaces from CHAR fields on retrieval.
- * Make allow_call_time_pass_reference=Off working.
- * For additional todo information, see oci8.c, in ext/oci8
-
-ext/odbc
---------
- For PHP 4.3.0:
- * update all php_error calls to php_error_docref where valid
- * integrate EXPERIMENTAL ODBC update for use in PHP 5.0, use for
- testing purposes only.
-
- For PHP 5.0.0
- * Activate EXPERIMENTAL ODBC codebase update
-
-ext/pcre
---------
- * Allow user to set PCRE_NOTEMPTY, PCRE_ANCHORED at execution time, maybe
-
-ext/pcntl
----------
- * Change internal callback handler to use TICKS
- * Remove all zend_extension code
- * Add object callback support to pcntl_signal()
-
-ext/pgsql
----------
- For PHP 4.3.0:
- * Add pg_metadata() with metadata cache feature.
- * Add pg_convert() to check and convert array value for query.
- * Add pg_insert/pg_update/pg_delete/pg_select for simple query.
-
-ext/session
------------
- For PHP 4.3.0:
- * session_abort() to abort session. ie: Do not save session data.
- * Allow unset($_SESSION) or unset($HTTP_SESSION_VARS) to unset
- session vars regardless of register_globals setting.
-
- Other:
- * Maybe implement finer-grained session variables that could be
- locked individually.
- * Write a network-transparent storage back-end with fallover
- facilities
- * Provide a callback facility which is executed upon encountering
- an unknown class name during deserialization
-
-ext/sockets
------------
- * Review/Fix vectors
-
-ext/standard
-------------
- * Add a version number to data serialized via serialize().
- * Possibly modify parsing of GPC data to automatically create arrays if
- variable name is seen more than once.
- * Implement regex-cache for url-functions.
- * Move socket related functions to fsock.c.
-
-ext/wddx
---------
- * See if we can support the remaining data types:
- dateTime
- binary
-
- http://www.wddx.org/WDDX_SDK_10a/7__References/WDDX_DTD.htm
- (Andrei)
-
- * implement wddx_packet_as_javascript(). (Andrei)
-
-other cool stuff
-----------------
- * PVM extension
-
-vim:et:sw=4:ts=4
diff --git a/TODO-PHP5 b/TODO-PHP5
deleted file mode 100644
index 85b8481378..0000000000
--- a/TODO-PHP5
+++ /dev/null
@@ -1,211 +0,0 @@
-Component: Zend Engine 2
-
- Important stuff to finish: PPP members/PPP methods,
- support of overloaded extensions, possibly differentiate
- between class and namespace as discussed with Stig in
- Germany.
-Responsibility: Zeev, Andi, Stas
-Time frame: Couple of months for first part and extensions will be
- ongoing while PHP is being fixed.
- Things to leave for later versions: Native aggregation
- support, accessing static members via object and not class.
-
-
-Component: Aggregation
-Responsibility: Andi, Stig?
-Time frame: ?
-
-
-Component: Introspection
-
- get_function_definition(<is_callable> [field]) =>
- array(
- file => filename
- line_start =>
- line_end =>
- parameters => array( name, byref, default )
- static_variables => array( name, value/default )
- scope => 'namespace' | 'class' | null
- namespace => classname | namespacename | 'main'
- protection => protection_flags
- phpdoc => pre-scanned-phpdoc-string
- type => 'internal' | 'user'
- )
-
- get_class_definition(<class> [field]) =>
- array(
- type => 'internal' | 'user'
- file => filename
- line_start =>
- line_end =>
- name => pretty-name
- parent => classname | namespace | null
- flags => bitfield (ABSTRACT)
- methods => array( array( name, phpdoc ) )
- default_properties => array( array( name, value, phpdoc ) )
- private_properties => array( array( name, value, phpdoc ) )
- protected_properties => array( array( name, value, phpdoc ) )
- public_properties => array( array( name, value, phpdoc ) )
- static_members => array( array( name, value, phpdoc ) )
- constants => array( array( name, value, phpdoc ) )
- classes => array( array( name, phpdoc ) )
- phpdoc => pre-scanned-phpdoc-string
- )
-
- get_constant_definition(<constant> [field]) =>
- array(
- file => filename
- line_start =>
- line_end =>
- name =>
- value =>
- phpdoc =>
- )
-
- get_global_variable_defintion(<name> [field]) =>
- array(
- file =>
- line_start =>
- line_end =>
- name =>
- phpdoc =>
- )
-
- We tried to take into account the implementation of each piece of
- information, and there are some that are problematic, especially those
- regarding constants and global variables (where do we store the extra
- information?)
-
- With "pre-scanned-phpdoc-string" we mean converting:
-
- /**
- * Blah blah blah
- * @param foo ...
- */
-
- to:
-
- Blah blah blah
- @param foo
-
- The rest of the phpdoc handling should be left to an extension.
-Responsibility: Stig, Andrei, Harald
-Time frame: ?
-
-
-Component: Redesign of API Versioning
-Responsibility: ?
-Time frame: 1 month
-
-
-Component: Thread Safety
- Identify the extensions that are not thread safe by design
- or due to dependant libraries and identify them as such.
- If possible try to resolve thread safety issue via code
- improvements (if php code or patches will be accepted by
- library maintainers). For situations where thread safety
- cannot easily be acheived a flag in the extension API is
- set so PHP can identify non-thread safe extensions. These
- extensions will not be loaded in a ZTS compiled binary
- (unless it is cli/cgi).
-
-Responsibility: ?
-Time frame: ?
-
-
-Component: SAPI
- Environment variables defined in the CGI spec need to be
- verified in each SAPI module that they conform to the CGI
- spec correctly. If they do not, the SAPI module needs to
- fix the variable prior to script execution. Having this
- conformity will aid in having PHP scripts run correctly
- under different sapi modules.
-
-Responsibility: Shane Caraveo & each sapi module owner
-Timeframe: ? (but shouldn't be much effort, most modules are probably ok)
-
-
-Component: Input Filtering
- - Implement a SAPI input filter hook that will get called
- just before registering a variable in the
- treat_data/post_handler hooks. (done)
- - Make sure this is also done in mbstring (done)
- - Provide access functions, or perhaps a new
- $_RAW_GET/POST/Cookie set of superglobals to get at the
- unfiltered data
- - Provide a .ini directive which allows people to set their
- input filter to one of the built-in strip_tags,
- htmlspecialchars or whatever other internal function might
- be useful here.
- - (The main benefit of this is to make it easier for people
- to solve the XSS problem once and for all without having
- to go through every line of their code and adding input
- validation/filtering everywhere)
-Responsibility: Rasmus
-Timeframe: Yesterday
-
-
-Component: RPC Abstraction Layer
- Porting java, com, dotnet, xmlrpc, corba, soap and python, srm
- (are there more ?) to work with the new oo api and preferably
- by using ext/rpc.
-Responsibility: Harald
-Time frame: 2 months (but i have to wait for a few engine features first)
-
-
-Component: OO Extensions
- Each OO extension has to be revised and rewritten to fit into
- the new OO model. We should decide which extensions are a must
- to have for the release and which can be ported by the maintainer
- later as a separate pecl release.
- A list of extensions to be extended that have to be investigated:
- * browscap
- * aggregate
- * all *sql extensions (*_fetch_object)
- * domxml (seems like christian is rewriting it anyways)
- * ming
-Responsibility: Harald (, extension maintainers)
-
-
-Component: Abstract Data Types (ADT)
-Responsibility: Sterling, Harald
-Time frame: ?
-
-
-Component: MySQL Extension
- Complete rewrite, leveraging the new MySQL 4 / MySQL 5
- features.
-Responsibility: Georg Richter, Zak Greant
-Timeframe: ?
-
-
-Component: XML
- - Rewrite DOMXML and incorporate all (or most of) W3C-DOM2.
- - Use the new ZE2 features (Exceptions, setter/getter).
- - Add SAX(2), XML Schema.
- - XSLT, HTML, XPath, XPointer, DTD Validation will still be
- supported, have to find a meaningful API for it.
- - Break BC, warn users now.
- - Look at the libxml2 patch by lukas schröder and see if we can prevent
- memory leaks with it (anyway, getting rid of mem-leaks and intelligent
- memory management is on top prio...)
- - In the longer term, domxml (or another name, as with todays features
- domxml is a little bit misleading) shall be the main xml-class, which
- covers most of what's needed for decent XML support in PHP ;)
- But there is certainly place for others like Sablotron etc.
-Responsibility: Christian Stocker
-Timeframe: ?
-
-
-Component: Test Suite
- Extending the test suite with atleast a test for every
- function in an extension that doesn't require external
- resources. Also developing an automated test thing which
- cvs ups's, compiles and tests the build on a daily base on
- as much platforms/extensions as possible.
-
- The test suite will also be extended to support threaded
- testing and testing for differing sapi modules (via http
- calls or other methods).
-Reponsibility: Derick (, extension maintainers)
-Time frame: 3 months
diff --git a/TODO.BUILDv5 b/TODO.BUILDv5
deleted file mode 100644
index 28237ea4d1..0000000000
--- a/TODO.BUILDv5
+++ /dev/null
@@ -1,3 +0,0 @@
-- clean up .cvsignores
-- purge Makefile.ins and replace PHP_EXTENSION in config.m4s
- with appropiate calls to PHP_NEW_EXTENSION
diff --git a/TSRM/LICENSE b/TSRM/LICENSE
deleted file mode 100644
index 8d208476e4..0000000000
--- a/TSRM/LICENSE
+++ /dev/null
@@ -1,26 +0,0 @@
-Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-- Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-
-- Neither name of the copyright holders nor the names of their contributors
-may be used to endorse or promote products derived from this software
-without specific prior written permission.
-
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/TSRM/Makefile.am b/TSRM/Makefile.am
deleted file mode 100644
index 91e585b65c..0000000000
--- a/TSRM/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-## process this file with automake to produce Makefile.am
-AUTOMAKE_OPTIONS=foreign
-noinst_LTLIBRARIES=libtsrm.la
-libtsrm_la_SOURCES = TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c
-
-depend:
diff --git a/TSRM/TODO b/TSRM/TODO
deleted file mode 100644
index 82b4fedfde..0000000000
--- a/TSRM/TODO
+++ /dev/null
@@ -1,2 +0,0 @@
-- Improve the lock in ts_resource_ex() in order to cover less code.
- This can probably be done by more careful hash table access
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c
deleted file mode 100644
index f39114d770..0000000000
--- a/TSRM/TSRM.c
+++ /dev/null
@@ -1,666 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Thread Safe Resource Manager |
- +----------------------------------------------------------------------+
- | Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski|
- | This source file is subject to the TSRM license, that is bundled |
- | with this package in the file LICENSE |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include "TSRM.h"
-
-#ifdef ZTS
-
-#include <stdio.h>
-
-#if HAVE_STDARG_H
-#include <stdarg.h>
-#endif
-
-typedef struct _tsrm_tls_entry tsrm_tls_entry;
-
-struct _tsrm_tls_entry {
- void **storage;
- int count;
- THREAD_T thread_id;
- tsrm_tls_entry *next;
-};
-
-
-typedef struct {
- size_t size;
- ts_allocate_ctor ctor;
- ts_allocate_dtor dtor;
-} tsrm_resource_type;
-
-
-/* The memory manager table */
-static tsrm_tls_entry **tsrm_tls_table=NULL;
-static int tsrm_tls_table_size;
-static ts_rsrc_id id_count;
-
-/* The resource sizes table */
-static tsrm_resource_type *resource_types_table=NULL;
-static int resource_types_table_size;
-
-
-static MUTEX_T tsmm_mutex; /* thread-safe memory manager mutex */
-
-/* New thread handlers */
-static tsrm_thread_begin_func_t tsrm_new_thread_begin_handler;
-static tsrm_thread_end_func_t tsrm_new_thread_end_handler;
-
-/* Debug support */
-int tsrm_error(int level, const char *format, ...);
-
-/* Read a resource from a thread's resource storage */
-static int tsrm_error_level;
-static FILE *tsrm_error_file;
-
-#if TSRM_DEBUG
-#define TSRM_ERROR(args) tsrm_error args
-#define TSRM_SAFE_RETURN_RSRC(array, offset, range) \
- { \
- int unshuffled_offset = TSRM_UNSHUFFLE_RSRC_ID(offset); \
- \
- if (offset==0) { \
- return &array; \
- } else if ((unshuffled_offset)>=0 && (unshuffled_offset)<(range)) { \
- TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Successfully fetched resource id %d for thread id %ld - 0x%0.8X", \
- unshuffled_offset, (long) thread_resources->thread_id, array[unshuffled_offset])); \
- return array[unshuffled_offset]; \
- } else { \
- TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Resource id %d is out of range (%d..%d)", \
- unshuffled_offset, TSRM_SHUFFLE_RSRC_ID(0), TSRM_SHUFFLE_RSRC_ID(thread_resources->count-1))); \
- return NULL; \
- } \
- }
-#else
-#define TSRM_ERROR(args)
-#define TSRM_SAFE_RETURN_RSRC(array, offset, range) \
- if (offset==0) { \
- return &array; \
- } else { \
- return array[TSRM_UNSHUFFLE_RSRC_ID(offset)]; \
- }
-#endif
-
-#if defined(PTHREADS)
-/* Thread local storage */
-static pthread_key_t tls_key;
-#elif defined(TSRM_ST)
-static int tls_key;
-#elif defined(TSRM_WIN32)
-static DWORD tls_key;
-#elif defined(BETHREADS)
-static int32 tls_key;
-#endif
-
-/* Startup TSRM (call once for the entire process) */
-TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename)
-{
-#if defined(GNUPTH)
- pth_init();
-#elif defined(PTHREADS)
- pthread_key_create( &tls_key, 0 );
-#elif defined(TSRM_ST)
- st_init();
- st_key_create(&tls_key, 0);
-#elif defined(TSRM_WIN32)
- tls_key = TlsAlloc();
-#elif defined(BETHREADS)
- tls_key = tls_allocate();
-#endif
-
- tsrm_error_file = stderr;
- tsrm_error_set(debug_level, debug_filename);
- tsrm_tls_table_size = expected_threads;
-
- tsrm_tls_table = (tsrm_tls_entry **) calloc(tsrm_tls_table_size, sizeof(tsrm_tls_entry *));
- if (!tsrm_tls_table) {
- TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate TLS table"));
- return 0;
- }
- id_count=0;
-
- resource_types_table_size = expected_resources;
- resource_types_table = (tsrm_resource_type *) calloc(resource_types_table_size, sizeof(tsrm_resource_type));
- if (!resource_types_table) {
- TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate resource types table"));
- free(tsrm_tls_table);
- tsrm_tls_table = NULL;
- return 0;
- }
-
- tsmm_mutex = tsrm_mutex_alloc();
-
- tsrm_new_thread_begin_handler = tsrm_new_thread_end_handler = NULL;
-
- TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Started up TSRM, %d expected threads, %d expected resources", expected_threads, expected_resources));
- return 1;
-}
-
-
-/* Shutdown TSRM (call once for the entire process) */
-TSRM_API void tsrm_shutdown(void)
-{
- int i;
-
- if (tsrm_tls_table) {
- for (i=0; i<tsrm_tls_table_size; i++) {
- tsrm_tls_entry *p = tsrm_tls_table[i], *next_p;
-
- while (p) {
- int j;
-
- next_p = p->next;
- for (j=0; j<id_count; j++) {
- if (resource_types_table && resource_types_table[j].dtor) {
- resource_types_table[j].dtor(p->storage[j], &p->storage);
- }
- free(p->storage[j]);
- }
- free(p->storage);
- free(p);
- p = next_p;
- }
- }
- free(tsrm_tls_table);
- tsrm_tls_table = NULL;
- }
- if (resource_types_table) {
- free(resource_types_table);
- resource_types_table=NULL;
- }
- tsrm_mutex_free(tsmm_mutex);
- tsmm_mutex = NULL;
- TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Shutdown TSRM"));
- if (tsrm_error_file!=stderr) {
- fclose(tsrm_error_file);
- }
-#if defined(GNUPTH)
- pth_kill();
-#elif defined(PTHREADS)
- pthread_key_delete(tls_key);
-#elif defined(TSRM_WIN32)
- TlsFree(tls_key);
-#endif
-}
-
-
-/* allocates a new thread-safe-resource id */
-TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor)
-{
- int i;
-
- TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Obtaining a new resource id, %d bytes", size));
-
- tsrm_mutex_lock(tsmm_mutex);
-
- /* obtain a resource id */
- *rsrc_id = TSRM_SHUFFLE_RSRC_ID(id_count++);
- TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Obtained resource id %d", *rsrc_id));
-
- /* store the new resource type in the resource sizes table */
- if (resource_types_table_size < id_count) {
- resource_types_table = (tsrm_resource_type *) realloc(resource_types_table, sizeof(tsrm_resource_type)*id_count);
- if (!resource_types_table) {
- tsrm_mutex_unlock(tsmm_mutex);
- TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate storage for resource"));
- *rsrc_id = 0;
- return 0;
- }
- resource_types_table_size = id_count;
- }
- resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].size = size;
- resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].ctor = ctor;
- resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].dtor = dtor;
-
- /* enlarge the arrays for the already active threads */
- for (i=0; i<tsrm_tls_table_size; i++) {
- tsrm_tls_entry *p = tsrm_tls_table[i];
-
- while (p) {
- if (p->count < id_count) {
- int j;
-
- p->storage = (void *) realloc(p->storage, sizeof(void *)*id_count);
- for (j=p->count; j<id_count; j++) {
- p->storage[j] = (void *) malloc(resource_types_table[j].size);
- if (resource_types_table[j].ctor) {
- resource_types_table[j].ctor(p->storage[j], &p->storage);
- }
- }
- p->count = id_count;
- }
- p = p->next;
- }
- }
- tsrm_mutex_unlock(tsmm_mutex);
-
- TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Successfully allocated new resource id %d", *rsrc_id));
- return *rsrc_id;
-}
-
-
-static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_T thread_id)
-{
- int i;
-
- TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Creating data structures for thread %x", thread_id));
- (*thread_resources_ptr) = (tsrm_tls_entry *) malloc(sizeof(tsrm_tls_entry));
- (*thread_resources_ptr)->storage = (void **) malloc(sizeof(void *)*id_count);
- (*thread_resources_ptr)->count = id_count;
- (*thread_resources_ptr)->thread_id = thread_id;
- (*thread_resources_ptr)->next = NULL;
-
-#if defined(PTHREADS)
- /* Set thread local storage to this new thread resources structure */
- pthread_setspecific(tls_key, (void *) *thread_resources_ptr);
-#elif defined(TSRM_ST)
- st_thread_setspecific(tls_key, (void *) *thread_resources_ptr);
-#elif defined(TSRM_WIN32)
- TlsSetValue(tls_key, (void *) *thread_resources_ptr);
-#elif defined(BETHREADS)
- tls_set(tls_key, (void*) *thread_resources_ptr);
-#endif
-
- if (tsrm_new_thread_begin_handler) {
- tsrm_new_thread_begin_handler(thread_id, &((*thread_resources_ptr)->storage));
- }
- for (i=0; i<id_count; i++) {
- (*thread_resources_ptr)->storage[i] = (void *) malloc(resource_types_table[i].size);
- if (resource_types_table[i].ctor) {
- resource_types_table[i].ctor((*thread_resources_ptr)->storage[i], &(*thread_resources_ptr)->storage);
- }
- }
-
- tsrm_mutex_unlock(tsmm_mutex);
-
- if (tsrm_new_thread_end_handler) {
- tsrm_new_thread_end_handler(thread_id, &((*thread_resources_ptr)->storage));
- }
-}
-
-
-/* fetches the requested resource for the current thread */
-TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
-{
- THREAD_T thread_id;
- int hash_value;
- tsrm_tls_entry *thread_resources;
-
-#ifdef NETWARE
- /* The below if loop is added for NetWare to fix an abend while unloading PHP
- * when an Apache unload command is issued on the system console.
- * While exiting from PHP, at the end for some reason, this function is called
- * with tsrm_tls_table = NULL. When this happened, the server abends when
- * tsrm_tls_table is accessed since it is NULL.
- */
- if(tsrm_tls_table) {
-#endif
- if (!th_id) {
-#if defined(PTHREADS)
- /* Fast path for looking up the resources for the current
- * thread. Its used by just about every call to
- * ts_resource_ex(). This avoids the need for a mutex lock
- * and our hashtable lookup.
- */
- thread_resources = pthread_getspecific(tls_key);
-#elif defined(TSRM_ST)
- thread_resources = st_thread_getspecific(tls_key);
-#elif defined(TSRM_WIN32)
- thread_resources = TlsGetValue(tls_key);
-#elif defined(BETHREADS)
- thread_resources = (tsrm_tls_entry*)tls_get(tls_key);
-#else
- thread_resources = NULL;
-#endif
- if (thread_resources) {
- TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for current thread %d", id, (long) thread_resources->thread_id));
- /* Read a specific resource from the thread's resources.
- * This is called outside of a mutex, so have to be aware about external
- * changes to the structure as we read it.
- */
- TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
- }
- thread_id = tsrm_thread_id();
- } else {
- thread_id = *th_id;
- }
-
- TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for thread %ld", id, (long) thread_id));
- tsrm_mutex_lock(tsmm_mutex);
-
- hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size);
- thread_resources = tsrm_tls_table[hash_value];
-
- if (!thread_resources) {
- allocate_new_resource(&tsrm_tls_table[hash_value], thread_id);
- return ts_resource_ex(id, &thread_id);
- } else {
- do {
- if (thread_resources->thread_id == thread_id) {
- break;
- }
- if (thread_resources->next) {
- thread_resources = thread_resources->next;
- } else {
- allocate_new_resource(&thread_resources->next, thread_id);
- return ts_resource_ex(id, &thread_id);
- /*
- * thread_resources = thread_resources->next;
- * break;
- */
- }
- } while (thread_resources);
- }
- tsrm_mutex_unlock(tsmm_mutex);
- /* Read a specific resource from the thread's resources.
- * This is called outside of a mutex, so have to be aware about external
- * changes to the structure as we read it.
- */
- TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
-#ifdef NETWARE
- } /* if(tsrm_tls_table) */
-#endif
-}
-
-
-/* frees all resources allocated for the current thread */
-void ts_free_thread(void)
-{
- tsrm_tls_entry *thread_resources;
- int i;
- THREAD_T thread_id = tsrm_thread_id();
- int hash_value;
- tsrm_tls_entry *last=NULL;
-
- tsrm_mutex_lock(tsmm_mutex);
- hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size);
- thread_resources = tsrm_tls_table[hash_value];
-
- while (thread_resources) {
- if (thread_resources->thread_id == thread_id) {
- for (i=0; i<thread_resources->count; i++) {
- if (resource_types_table[i].dtor) {
- resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
- }
- }
- for (i=0; i<thread_resources->count; i++) {
- free(thread_resources->storage[i]);
- }
- free(thread_resources->storage);
- if (last) {
- last->next = thread_resources->next;
- } else {
- tsrm_tls_table[hash_value] = thread_resources->next;
- }
-#if defined(PTHREADS)
- pthread_setspecific(tls_key, 0);
-#elif defined(TSRM_WIN32)
- TlsSetValue(tls_key, 0);
-#endif
- free(thread_resources);
- break;
- }
- if (thread_resources->next) {
- last = thread_resources;
- }
- thread_resources = thread_resources->next;
- }
- tsrm_mutex_unlock(tsmm_mutex);
-}
-
-
-/* deallocates all occurrences of a given id */
-void ts_free_id(ts_rsrc_id id)
-{
-}
-
-
-
-
-/*
- * Utility Functions
- */
-
-/* Obtain the current thread id */
-TSRM_API THREAD_T tsrm_thread_id(void)
-{
-#ifdef TSRM_WIN32
- return GetCurrentThreadId();
-#elif defined(NETWARE)
- /* There seems to be some problem with the LibC call: NXThreadGetId().
- * Due to this, the PHPMyAdmin application is abending in PHP calls.
- * Used the call, kCurrentThread instead and it works fine.
- */
-/* return NXThreadGetId(); */
- return kCurrentThread();
-#elif defined(GNUPTH)
- return pth_self();
-#elif defined(PTHREADS)
- return pthread_self();
-#elif defined(NSAPI)
- return systhread_current();
-#elif defined(PI3WEB)
- return PIThread_getCurrent();
-#elif defined(TSRM_ST)
- return st_thread_self();
-#elif defined(BETHREADS)
- return find_thread(NULL);
-#endif
-}
-
-
-/* Allocate a mutex */
-TSRM_API MUTEX_T tsrm_mutex_alloc(void)
-{
- MUTEX_T mutexp;
-#ifdef NETWARE
-#ifndef USE_MPK
- /* To use the Recursive Mutex Locking of LibC */
- long flags = NX_MUTEX_RECURSIVE;
- NXHierarchy_t order = 0;
- NX_LOCK_INFO_ALLOC (lockInfo, "PHP-TSRM", 0);
-#endif
-#endif
-
-#ifdef TSRM_WIN32
- mutexp = malloc(sizeof(CRITICAL_SECTION));
- InitializeCriticalSection(mutexp);
-#elif defined(NETWARE)
-#ifdef USE_MPK
- mutexp = kMutexAlloc((BYTE*)"PHP-TSRM");
-#else
- mutexp = NXMutexAlloc(flags, order, &lockInfo);
-#endif
-#elif defined(GNUPTH)
- mutexp = (MUTEX_T) malloc(sizeof(*mutexp));
- pth_mutex_init(mutexp);
-#elif defined(PTHREADS)
- mutexp = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t));
- pthread_mutex_init(mutexp,NULL);
-#elif defined(NSAPI)
- mutexp = crit_init();
-#elif defined(PI3WEB)
- mutexp = PIPlatform_allocLocalMutex();
-#elif defined(TSRM_ST)
- mutexp = st_mutex_new();
-#elif defined(BETHREADS)
- mutexp = (beos_ben*)malloc(sizeof(beos_ben));
- mutexp->ben = 0;
- mutexp->sem = create_sem(1, "PHP sempahore");
-#endif
-#ifdef THR_DEBUG
- printf("Mutex created thread: %d\n",mythreadid());
-#endif
- return( mutexp );
-}
-
-
-/* Free a mutex */
-TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
-{
- if (mutexp) {
-#ifdef TSRM_WIN32
- DeleteCriticalSection(mutexp);
- free(mutexp);
-#elif defined(NETWARE)
-#ifdef USE_MPK
- kMutexFree(mutexp);
-#else
- NXMutexFree(mutexp);
-#endif
-#elif defined(GNUPTH)
- free(mutexp);
-#elif defined(PTHREADS)
- pthread_mutex_destroy(mutexp);
- free(mutexp);
-#elif defined(NSAPI)
- crit_terminate(mutexp);
-#elif defined(PI3WEB)
- PISync_delete(mutexp);
-#elif defined(TSRM_ST)
- st_mutex_destroy(mutexp);
-#elif defined(BETHREADS)
- delete_sem(mutexp->sem);
- free(mutexp);
-#endif
- }
-#ifdef THR_DEBUG
- printf("Mutex freed thread: %d\n",mythreadid());
-#endif
-}
-
-
-/* Lock a mutex */
-TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp)
-{
- TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex locked thread: %ld", tsrm_thread_id()));
-#ifdef TSRM_WIN32
- EnterCriticalSection(mutexp);
- return 1;
-#elif defined(NETWARE)
-#ifdef USE_MPK
- return kMutexLock(mutexp);
-#else
- return NXLock(mutexp);
-#endif
-#elif defined(GNUPTH)
- return pth_mutex_acquire(mutexp, 0, NULL);
-#elif defined(PTHREADS)
- return pthread_mutex_lock(mutexp);
-#elif defined(NSAPI)
- return crit_enter(mutexp);
-#elif defined(PI3WEB)
- return PISync_lock(mutexp);
-#elif defined(TSRM_ST)
- return st_mutex_lock(mutexp);
-#elif defined(BETHREADS)
- if (atomic_add(&mutexp->ben, 1) != 0)
- return acquire_sem(mutexp->sem);
- return 0;
-#endif
-}
-
-
-/* Unlock a mutex */
-TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
-{
- TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex unlocked thread: %ld", tsrm_thread_id()));
-#ifdef TSRM_WIN32
- LeaveCriticalSection(mutexp);
- return 1;
-#elif defined(NETWARE)
-#ifdef USE_MPK
- return kMutexUnlock(mutexp);
-#else
- return NXUnlock(mutexp);
-#endif
-#elif defined(GNUPTH)
- return pth_mutex_release(mutexp);
-#elif defined(PTHREADS)
- return pthread_mutex_unlock(mutexp);
-#elif defined(NSAPI)
- return crit_exit(mutexp);
-#elif defined(PI3WEB)
- return PISync_unlock(mutexp);
-#elif defined(TSRM_ST)
- return st_mutex_unlock(mutexp);
-#elif defined(BETHREADS)
- if (atomic_add(&mutexp->ben, -1) != 1)
- return release_sem(mutexp->sem);
- return 0;
-#endif
-}
-
-
-TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler)
-{
- void *retval = (void *) tsrm_new_thread_begin_handler;
-
- tsrm_new_thread_begin_handler = new_thread_begin_handler;
- return retval;
-}
-
-
-TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler)
-{
- void *retval = (void *) tsrm_new_thread_end_handler;
-
- tsrm_new_thread_end_handler = new_thread_end_handler;
- return retval;
-}
-
-
-
-/*
- * Debug support
- */
-
-#if TSRM_DEBUG
-int tsrm_error(int level, const char *format, ...)
-{
- if (level<=tsrm_error_level) {
- va_list args;
- int size;
-
- fprintf(tsrm_error_file, "TSRM: ");
- va_start(args, format);
- size = vfprintf(tsrm_error_file, format, args);
- va_end(args);
- fprintf(tsrm_error_file, "\n");
- fflush(tsrm_error_file);
- return size;
- } else {
- return 0;
- }
-}
-#endif
-
-
-void tsrm_error_set(int level, char *debug_filename)
-{
- tsrm_error_level = level;
-
-#if TSRM_DEBUG
- if (tsrm_error_file!=stderr) { /* close files opened earlier */
- fclose(tsrm_error_file);
- }
-
- if (debug_filename) {
- tsrm_error_file = fopen(debug_filename, "w");
- if (!tsrm_error_file) {
- tsrm_error_file = stderr;
- }
- } else {
- tsrm_error_file = stderr;
- }
-#endif
-}
-
-#endif /* ZTS */
diff --git a/TSRM/TSRM.dsp b/TSRM/TSRM.dsp
deleted file mode 100644
index 1a5693f5a2..0000000000
--- a/TSRM/TSRM.dsp
+++ /dev/null
@@ -1,186 +0,0 @@
-# Microsoft Developer Studio Project File - Name="TSRM" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=TSRM - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "TSRM.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "TSRM.mak" CFG="TSRM - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "TSRM - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "TSRM - Win32 Release_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "TSRM - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library")
-!MESSAGE "TSRM - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "TSRM - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "TSRM___Win32_Debug_TS"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "C:\Projects\TSRM" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=1 /YX /FD /GZ /c
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "TSRM___Win32_Release_TS"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "TSRM___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "TSRM_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "TSRM___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TSDbg"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "TSRM - Win32 Debug_TS"
-# Name "TSRM - Win32 Release_TS"
-# Name "TSRM - Win32 Release_TS_inline"
-# Name "TSRM - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\TSRM.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_strtok_r.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_virtual_cwd.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_win32.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\readdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\TSRM.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_config_common.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_strtok_r.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_virtual_cwd.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_win32.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h
deleted file mode 100644
index 09da7b49cb..0000000000
--- a/TSRM/TSRM.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Thread Safe Resource Manager |
- +----------------------------------------------------------------------+
- | Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski|
- | This source file is subject to the TSRM license, that is bundled |
- | with this package in the file LICENSE |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef TSRM_H
-#define TSRM_H
-
-/* #ifndef WIN32 */
-#if !defined(WIN32) && !defined(NETWARE)
-# include "tsrm_config.h"
-#endif
-
-#ifdef WIN32
-# define TSRM_WIN32
-# include "tsrm_config.w32.h"
-#endif
-
-#ifdef TSRM_WIN32
-# ifdef TSRM_EXPORTS
-# define TSRM_API __declspec(dllexport)
-# else
-# define TSRM_API __declspec(dllimport)
-# endif
-#else
-# define TSRM_API
-#endif
-
-/* Only compile multi-threading functions if we're in ZTS mode */
-#ifdef ZTS
-
-#ifdef TSRM_WIN32
-# ifndef TSRM_INCLUDE_FULL_WINDOWS_HEADERS
-# define WIN32_LEAN_AND_MEAN
-# endif
-# include <windows.h>
-#elif defined(NETWARE)
-# include <nks/thread.h>
-#ifdef USE_MPK
-# include <mpklib4php.h>
-#else
-# include <nks/synch.h>
-#endif
-#elif defined(GNUPTH)
-# include <pth.h>
-#elif defined(PTHREADS)
-# include <pthread.h>
-#elif defined(TSRM_ST)
-# include <st.h>
-#elif defined(BETHREADS)
-#include <kernel/OS.h>
-#include <TLS.h>
-#endif
-
-typedef int ts_rsrc_id;
-
-/* Define THREAD_T and MUTEX_T */
-#ifdef TSRM_WIN32
-# define THREAD_T DWORD
-# define MUTEX_T CRITICAL_SECTION *
-#elif defined(NETWARE)
-# define THREAD_T NXThreadId_t
-#ifdef USE_MPK
-# define MUTEX_T MUTEX
-#else
-# define MUTEX_T NXMutex_t *
-#endif
-#elif defined(GNUPTH)
-# define THREAD_T pth_t
-# define MUTEX_T pth_mutex_t *
-#elif defined(PTHREADS)
-# define THREAD_T pthread_t
-# define MUTEX_T pthread_mutex_t *
-#elif defined(NSAPI)
-# define THREAD_T SYS_THREAD
-# define MUTEX_T CRITICAL
-#elif defined(PI3WEB)
-# define THREAD_T PIThread *
-# define MUTEX_T PISync *
-#elif defined(TSRM_ST)
-# define THREAD_T st_thread_t
-# define MUTEX_T st_mutex_t
-#elif defined(BETHREADS)
-# define THREAD_T thread_id
-typedef struct {
- sem_id sem;
- int32 ben;
-} beos_ben;
-# define MUTEX_T beos_ben *
-#endif
-
-typedef void (*ts_allocate_ctor)(void *, void ***);
-typedef void (*ts_allocate_dtor)(void *, void ***);
-
-#define THREAD_HASH_OF(thr,ts) (unsigned long)thr%(unsigned long)ts
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* startup/shutdown */
-TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename);
-TSRM_API void tsrm_shutdown(void);
-
-/* allocates a new thread-safe-resource id */
-TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor);
-
-/* fetches the requested resource for the current thread */
-TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id);
-#define ts_resource(id) ts_resource_ex(id, NULL)
-
-/* frees all resources allocated for the current thread */
-TSRM_API void ts_free_thread(void);
-
-/* deallocates all occurrences of a given id */
-TSRM_API void ts_free_id(ts_rsrc_id id);
-
-
-/* Debug support */
-#define TSRM_ERROR_LEVEL_ERROR 1
-#define TSRM_ERROR_LEVEL_CORE 2
-#define TSRM_ERROR_LEVEL_INFO 3
-
-typedef void (*tsrm_thread_begin_func_t)(THREAD_T thread_id, void ***tsrm_ls);
-typedef void (*tsrm_thread_end_func_t)(THREAD_T thread_id, void ***tsrm_ls);
-
-
-TSRM_API int tsrm_error(int level, const char *format, ...);
-TSRM_API void tsrm_error_set(int level, char *debug_filename);
-
-/* utility functions */
-TSRM_API THREAD_T tsrm_thread_id(void);
-TSRM_API MUTEX_T tsrm_mutex_alloc(void);
-TSRM_API void tsrm_mutex_free(MUTEX_T mutexp);
-TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp);
-TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp);
-
-TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler);
-TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler);
-
-#define TSRM_SHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)+1)
-#define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1)
-
-#define TSRMLS_FETCH() void ***tsrm_ls = (void ***) ts_resource_ex(0, NULL)
-#define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx
-#define TSRMLS_SET_CTX(ctx) (void ***) ctx = tsrm_ls
-#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
-#define TSRMLS_D void ***tsrm_ls
-#define TSRMLS_DC , TSRMLS_D
-#define TSRMLS_C tsrm_ls
-#define TSRMLS_CC , TSRMLS_C
-
-#ifdef __cplusplus
-}
-#endif
-
-#else /* non ZTS */
-
-#define TSRMLS_FETCH()
-#define TSRMLS_FETCH_FROM_CTX(ctx)
-#define TSRMLS_SET_CTX(ctx)
-#define TSRMLS_D void
-#define TSRMLS_DC
-#define TSRMLS_C
-#define TSRMLS_CC
-
-#endif /* ZTS */
-
-#endif /* TSRM_H */
diff --git a/TSRM/acconfig.h b/TSRM/acconfig.h
deleted file mode 100644
index 2b94cf35e7..0000000000
--- a/TSRM/acconfig.h
+++ /dev/null
@@ -1 +0,0 @@
-#undef PTHREADS
diff --git a/TSRM/acinclude.m4 b/TSRM/acinclude.m4
deleted file mode 100644
index 1953172aef..0000000000
--- a/TSRM/acinclude.m4
+++ /dev/null
@@ -1,5 +0,0 @@
-
-AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
- LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
-])
-
diff --git a/TSRM/build.mk b/TSRM/build.mk
deleted file mode 100644
index aac1a8b982..0000000000
--- a/TSRM/build.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# Makefile to generate build tools
-#
-# Standard usage:
-# make -f build.mk
-#
-# Written by Sascha Schumann
-#
-# $Id$
-
-
-LT_TARGETS = ltmain.sh ltconfig
-
-config_h_in = tsrm_config.h.in
-
-makefile_am_files = Makefile.am
-makefile_in_files = $(makefile_am_files:.am=.in)
-makefile_files = $(makefile_am_files:e.am=e)
-
-targets = $(makefile_in_files) $(LT_TARGETS) configure $(config_h_in)
-
-all: $(targets)
-
-clean:
- rm -f $(targets)
-
-$(LT_TARGETS):
- rm -f $(LT_TARGETS)
- libtoolize --automake $(AMFLAGS) -f
-
-$(makefile_in_files): $(makefile_am_files)
- automake -a -i $(AMFLAGS) $(makefile_files)
-
-aclocal.m4: configure.in acinclude.m4
- aclocal
-
-$(config_h_in): configure.in acconfig.h
-# explicitly remove target since autoheader does not seem to work
-# correctly otherwise (timestamps are not updated)
- @rm -f $@
- autoheader
-
-configure: aclocal.m4 configure.in
- autoconf
diff --git a/TSRM/buildconf b/TSRM/buildconf
deleted file mode 100755
index fe8dee6f76..0000000000
--- a/TSRM/buildconf
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-
-case "$1" in
---copy)
- automake_flags=--copy
- shift
-;;
-esac
-
-libtoolize --force --automake $automake_flags
-
-mv aclocal.m4 aclocal.m4.old 2>/dev/null
-aclocal
-if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
- echo "buildconf: keeping ${1}aclocal.m4"
- mv aclocal.m4.old aclocal.m4
-else
- echo "buildconf: created or modified ${1}aclocal.m4"
-fi
-
-autoheader
-
-automake --add-missing --include-deps $automake_flags
-
-mv configure configure.old 2>/dev/null
-autoconf
-if cmp configure.old configure > /dev/null 2>&1; then
- echo "buildconf: keeping ${1}configure"
- mv configure.old configure
-else
- echo "buildconf: created or modified ${1}configure"
-fi
-
diff --git a/TSRM/configure.in b/TSRM/configure.in
deleted file mode 100644
index acfdd00b35..0000000000
--- a/TSRM/configure.in
+++ /dev/null
@@ -1,31 +0,0 @@
-dnl $Id$
-dnl
-dnl Minimalistic configure.in for TSRM.
-dnl
-
-AC_INIT(TSRM.c)
-AM_INIT_AUTOMAKE(TSRM, 1.0, nodefine)
-AM_CONFIG_HEADER(tsrm_config.h)
-
-sinclude(tsrm.m4)
-
-TSRM_BASIC_CHECKS
-TSRM_THREADS_CHECKS
-
-AM_PROG_LIBTOOL
-if test "$enable_debug" != "yes"; then
- AM_SET_LIBTOOL_VARIABLE([--silent])
-fi
-
-dnl TSRM_PTHREAD
-
-AC_CHECK_HEADERS(
-utime.h \
-dirent.h \
-stdarg.h \
-alloca.h \
-unistd.h \
-limits.h
-)
-
-AC_OUTPUT(Makefile)
diff --git a/TSRM/readdir.h b/TSRM/readdir.h
deleted file mode 100644
index b0f1ad9e6f..0000000000
--- a/TSRM/readdir.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef READDIR_H
-#define READDIR_H
-
-
-/*
- * Structures and types used to implement opendir/readdir/closedir
- * on Windows 95/NT.
- */
-
-#include <io.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-
-
-/* struct dirent - same as Unix */
-
-struct dirent {
- long d_ino; /* inode (always 1 in WIN32) */
- off_t d_off; /* offset to this dirent */
- unsigned short d_reclen; /* length of d_name */
- char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */
-};
-
-
-/* typedef DIR - not the same as Unix */
-typedef struct {
- long handle; /* _findfirst/_findnext handle */
- short offset; /* offset into directory */
- short finished; /* 1 if there are not more files */
- struct _finddata_t fileinfo; /* from _findfirst/_findnext */
- char *dir; /* the dir we are reading */
- struct dirent dent; /* the dirent to return */
-} DIR;
-
-/* Function prototypes */
-DIR *opendir(const char *);
-struct dirent *readdir(DIR *);
-int readdir_r(DIR *, struct dirent *, struct dirent **);
-int closedir(DIR *);
-void rewinddir(DIR *);
-
-
-#endif /* READDIR_H */
diff --git a/TSRM/threads.m4 b/TSRM/threads.m4
deleted file mode 100644
index 790579656e..0000000000
--- a/TSRM/threads.m4
+++ /dev/null
@@ -1,165 +0,0 @@
-dnl Copyright (c) 1999, 2000 Sascha Schumann. All rights reserved.
-dnl
-dnl Redistribution and use in source and binary forms, with or without
-dnl modification, are permitted provided that the following conditions
-dnl are met:
-dnl
-dnl 1. Redistributions of source code must retain the above copyright
-dnl notice, this list of conditions and the following disclaimer.
-dnl
-dnl 2. Redistributions in binary form must reproduce the above copyright
-dnl notice, this list of conditions and the following disclaimer in
-dnl the documentation and/or other materials provided with the
-dnl distribution.
-dnl
-dnl THIS SOFTWARE IS PROVIDED BY SASCHA SCHUMANN ``AS IS'' AND ANY
-dnl EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-dnl PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SASCHA SCHUMANN OR
-dnl HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-dnl NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-dnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-dnl STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-dnl OF THE POSSIBILITY OF SUCH DAMAGE.
-
-dnl
-dnl PTHREADS_FLAGS
-dnl
-dnl Set some magic defines to achieve POSIX threads conformance
-dnl
-AC_DEFUN(PTHREADS_FLAGS,[
- if test -z "$host_alias" && test -n "$host"; then
- host_alias=$host
- fi
- if test -z "$host_alias"; then
- AC_MSG_ERROR(host_alias is not set. Make sure to run config.guess)
- fi
- case $host_alias in
- *solaris*)
- PTHREAD_FLAGS="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT";;
- *freebsd*)
- PTHREAD_FLAGS="-D_REENTRANT -D_THREAD_SAFE";;
- *linux*)
- PTHREAD_FLAGS=-D_REENTRANT;;
- *aix*)
- PTHREAD_FLAGS=-D_THREAD_SAFE;;
- *irix*)
- PTHREAD_FLAGS=-D_POSIX_THREAD_SAFE_FUNCTIONS;;
- *hpux*)
- PTHREAD_FLAGS=-D_REENTRANT;;
- *sco*)
- PTHREAD_FLAGS=-D_REENTRANT;;
-dnl Solves sigwait() problem, creates problems with u_long etc.
-dnl PTHREAD_FLAGS="-D_REENTRANT -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506 -D_XOPEN_SOURCE_EXTENDED=1";;
- esac
-
- if test -n "$PTHREAD_FLAGS"; then
- CPPFLAGS="$CPPFLAGS $PTHREAD_FLAGS"
- fi
-])dnl
-dnl
-dnl PTHREADS_CHECK_COMPILE
-dnl
-dnl Check whether the current setup can use POSIX threads calls
-dnl
-AC_DEFUN(PTHREADS_CHECK_COMPILE, [
-AC_TRY_RUN( [
-#include <pthread.h>
-#include <stddef.h>
-
-void *thread_routine(void *data) {
- return data;
-}
-
-int main() {
- pthread_t thd;
- pthread_mutexattr_t mattr;
- int data = 1;
- pthread_mutexattr_init(&mattr);
- return pthread_create(&thd, NULL, thread_routine, &data);
-} ], [
- pthreads_working=yes
- ], [
- pthreads_working=no
- ], pthreads_working=no ) ] )dnl
-dnl
-dnl PTHREADS_CHECK()
-dnl
-dnl Try to find a way to enable POSIX threads
-dnl
-dnl Magic flags
-dnl -kthread gcc (FreeBSD)
-dnl -Kthread UDK cc (UnixWare)
-dnl -mt WorkShop cc (Solaris)
-dnl -mthreads gcc (AIX)
-dnl -pthread gcc (Linux, FreeBSD, NetBSD, OpenBSD)
-dnl -pthreads gcc (Solaris)
-dnl -qthreaded AIX cc V5
-dnl -threads gcc (HP-UX)
-dnl
-AC_DEFUN(PTHREADS_CHECK,[
-
-if test "$beos_threads" = "1"; then
- pthreads_working="yes"
- ac_cv_pthreads_cflags=""
-else
- save_CFLAGS=$CFLAGS
- save_LIBS=$LIBS
- PTHREADS_ASSIGN_VARS
- PTHREADS_CHECK_COMPILE
- LIBS=$save_LIBS
- CFLAGS=$save_CFLAGS
-
- AC_CACHE_CHECK(for pthreads_cflags,ac_cv_pthreads_cflags,[
- ac_cv_pthreads_cflags=
- if test "$pthreads_working" != "yes"; then
- for flag in -kthread -pthread -pthreads -mthreads -Kthread -threads -mt -qthreaded; do
- ac_save=$CFLAGS
- CFLAGS="$CFLAGS $flag"
- PTHREADS_CHECK_COMPILE
- CFLAGS=$ac_save
- if test "$pthreads_working" = "yes"; then
- ac_cv_pthreads_cflags=$flag
- break
- fi
- done
- fi
-fi
-])
-
-AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[
-ac_cv_pthreads_lib=
-if test "$pthreads_working" != "yes"; then
- for lib in pthread pthreads c_r; do
- ac_save=$LIBS
- LIBS="$LIBS -l$lib"
- PTHREADS_CHECK_COMPILE
- LIBS=$ac_save
- if test "$pthreads_working" = "yes"; then
- ac_cv_pthreads_lib=$lib
- break
- fi
- done
-fi
-])
-
-if test "$pthreads_working" = "yes"; then
- threads_result="POSIX-Threads found"
-else
- threads_result="POSIX-Threads not found"
-fi
-])dnl
-dnl
-dnl
-AC_DEFUN(PTHREADS_ASSIGN_VARS,[
-if test -n "$ac_cv_pthreads_lib"; then
- LIBS="$LIBS -l$ac_cv_pthreads_lib"
-fi
-
-if test -n "$ac_cv_pthreads_cflags"; then
- CFLAGS="$CFLAGS $ac_cv_pthreads_cflags"
-fi
-])dnl
diff --git a/TSRM/tsrm.m4 b/TSRM/tsrm.m4
deleted file mode 100644
index f9f9e4dcd2..0000000000
--- a/TSRM/tsrm.m4
+++ /dev/null
@@ -1,128 +0,0 @@
-
-dnl TSRM_CHECK_GCC_ARG(ARG, ACTION-IF-FOUND, ACTION-IF-NOT_FOUND)
-AC_DEFUN(TSRM_CHECK_GCC_ARG,[
- gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_)
- AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [
- echo 'void somefunc() { };' > conftest.c
- cmd='$CC $1 -c conftest.c'
- if eval $cmd 2>&1 | egrep -e $1 >/dev/null ; then
- ac_result=no
- else
- ac_result=yes
- fi
- eval $gcc_arg_name=$ac_result
- rm -f conftest.*
- ])
- if eval test "\$$gcc_arg_name" = "yes"; then
- $2
- else
- :
- $3
- fi
-])
-
-AC_DEFUN(TSRM_BASIC_CHECKS,[
-
-AC_REQUIRE([AC_PROG_CC])dnl
-dnl AC_REQUIRE([AM_PROG_CC_STDC])dnl
-AC_REQUIRE([AC_PROG_CC_C_O])dnl
-AC_REQUIRE([AC_PROG_RANLIB])dnl
-
-AC_CHECK_HEADERS(stdarg.h)
-
-])
-
-
-AC_DEFUN(TSRM_CHECK_PTH,[
-
-AC_MSG_CHECKING(for GNU Pth)
-PTH_PREFIX="`$1 --prefix`"
-if test -z "$PTH_PREFIX"; then
- AC_MSG_RESULT(Please check your Pth installation)
-fi
-
-CPPFLAGS="$CPPFLAGS `$1 --cflags`"
-LDFLAGS="$LDFLAGS `$1 --ldflags`"
-LIBS="$LIBS `$1 --libs`"
-
-AC_DEFINE(GNUPTH, 1, [Whether you use GNU Pth])
-AC_MSG_RESULT(yes - installed in $PTH_PREFIX)
-
-])
-
-AC_DEFUN(TSRM_CHECK_ST,[
- if test -r "$1/include/st.h"; then
- CPPFLAGS="$CPPFLAGS -I$1/include"
- LDFLAGS="$LDFLAGS -L$1/lib"
- elif test -r "$1/st.h"; then
- CPPFLAGS="$CPPFLAGS -I$1"
- LDFLAGS="$LDFLAGS -L$1"
- fi
- AC_CHECK_HEADERS(st.h,[],[
- AC_MSG_ERROR([Sorry[,] I was unable to locate the State Threads header file. Please specify the prefix using --with-tsrm-st=/prefix])
- ])
- LIBS="$LIBS -lst"
- AC_MSG_CHECKING(for SGI's State Threads)
- AC_MSG_RESULT(yes)
- AC_DEFINE(TSRM_ST, 1, [ ])
-])
-
-sinclude(threads.m4)
-sinclude(TSRM/threads.m4)
-
-AC_DEFUN(TSRM_CHECK_PTHREADS,[
-
-PTHREADS_CHECK
-
-if test "$beos_threads" = "1"; then
- AC_DEFINE(BETHREADS, 1, Whether to use native BeOS threads)
-else
- if test "$pthreads_working" != "yes"; then
- AC_MSG_ERROR(Your system seems to lack POSIX threads.)
- fi
-
- AC_DEFINE(PTHREADS, 1, Whether to use Pthreads)
-
- AC_MSG_CHECKING(for POSIX threads)
- AC_MSG_RESULT(yes)
-fi
-])
-
-
-AC_DEFUN(TSRM_THREADS_CHECKS,[
-
-dnl For the thread implementations, we always use --with-*
-dnl to maintain consistency
-
-AC_ARG_WITH(tsrm-pth,
-[ --with-tsrm-pth[=pth-config] Use GNU Pth.],[
- TSRM_PTH=$withval
-],[
- TSRM_PTH=no
-])
-
-AC_ARG_WITH(tsrm-st,
-[ --with-tsrm-st],[
- TSRM_ST=$withval
-],[
- TSRM_ST=no
-])
-
-AC_ARG_WITH(tsrm-pthreads,
-[ --with-tsrm-pthreads Use POSIX threads (default)],[
- TSRM_PTHREADS=$withval
-],[
- TSRM_PTHREADS=yes
-])
-
-test "$TSRM_PTH" = "yes" && TSRM_PTH=pth-config
-
-if test "$TSRM_PTH" != "no"; then
- TSRM_CHECK_PTH($TSRM_PTH)
-elif test "$TSRM_ST" != "no"; then
- TSRM_CHECK_ST($TSRM_ST)
-elif test "$TSRM_PTHREADS" != "no"; then
- TSRM_CHECK_PTHREADS
-fi
-
-])
diff --git a/TSRM/tsrm_config.nw.h b/TSRM/tsrm_config.nw.h
deleted file mode 100644
index 14fcc19ab2..0000000000
--- a/TSRM/tsrm_config.nw.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef TSRM_CONFIG_NW_H
-#define TSRM_CONFIG_NW_H
-
-#define HAVE_UTIME 1
-
-/* Though we have alloca(), this seems to be causing some problem
- * with the stack pointer. Hence not using it
- */
-/*#define HAVE_ALLOCA 1*/
-
-#endif
diff --git a/TSRM/tsrm_config.w32.h b/TSRM/tsrm_config.w32.h
deleted file mode 100644
index 2703f754f0..0000000000
--- a/TSRM/tsrm_config.w32.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef TSRM_CONFIG_W32_H
-#define TSRM_CONFIG_W32_H
-
-#define HAVE_UTIME 1
-#define HAVE_ALLOCA 1
-
-#include <malloc.h>
-#include <stdlib.h>
-#include <crtdbg.h>
-
-#undef inline
-#ifdef ZEND_WIN32_FORCE_INLINE
-# define inline __forceinline
-#else
-# define inline
-#endif
-
-
-#endif
diff --git a/TSRM/tsrm_config_common.h b/TSRM/tsrm_config_common.h
deleted file mode 100644
index 0cc0e6c5a1..0000000000
--- a/TSRM/tsrm_config_common.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef TSRM_CONFIG_COMMON_H
-#define TSRM_CONFIG_COMMON_H
-
-#if WINNT|WIN32
-# define TSRM_WIN32
-#endif
-
-#ifdef TSRM_WIN32
-# include "tsrm_config.w32.h"
-#elif defined(NETWARE)
-# include "tsrm_config.nw.h"
-#else
-# include "tsrm_config.h"
-# include <sys/param.h>
-#endif
-
-#if HAVE_ALLOCA_H && !defined(_ALLOCA_H)
-# include <alloca.h>
-#endif
-
-/* AIX requires this to be the first thing in the file. */
-#ifndef __GNUC__
-# ifndef HAVE_ALLOCA_H
-# ifdef _AIX
- #pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-# ifndef NETWARE
-char *alloca ();
-# endif
-# endif
-# endif
-# endif
-#endif
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#ifndef MAXPATHLEN
-# ifdef PATH_MAX
-# define MAXPATHLEN PATH_MAX
-# else
-# define MAXPATHLEN 256
-# endif
-#endif
-
-#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2))
-# define tsrm_do_alloca(p) alloca(p)
-# define tsrm_free_alloca(p)
-#else
-# define tsrm_do_alloca(p) malloc(p)
-# define tsrm_free_alloca(p) free(p)
-#endif
-
-#endif /* TSRM_CONFIG_COMMON_H */
diff --git a/TSRM/tsrm_nw.c b/TSRM/tsrm_nw.c
deleted file mode 100644
index 2467c0fcd8..0000000000
--- a/TSRM/tsrm_nw.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Venkat Raghavan S <rvenkat@novell.com> |
- | Anantha Kesari H Y <hyanantha@novell.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "TSRM.h"
-
-#ifdef NETWARE
-
-#ifdef USE_MKFIFO
-#include <sys/stat.h>
-#elif !defined(USE_PIPE_OPEN) /* NXFifoOpen */
-#include <nks/fsio.h>
-#endif
-
-#include <nks/vm.h>
-#include <nks/memory.h>
-
-#include <string.h>
-
-#include "mktemp.h"
-
-/* strtok() call in LibC is abending when used in a different address space
- * -- hence using PHP's version itself for now
- */
-#include "tsrm_strtok_r.h"
-#define tsrm_strtok_r(a,b,c) strtok((a),(b))
-
-#define WHITESPACE " \t"
-#define MAX_ARGS 10
-
-
-TSRM_API FILE* popen(const char *commandline, const char *type)
-{
- char *command = NULL, *argv[MAX_ARGS] = {'\0'}, **env = NULL;
- char *tempName = "sys:/php/temp/phpXXXXXX.tmp";
- char *filePath = NULL;
- char *ptr = NULL;
- int ptrLen = 0, argc = 0, i = 0, envCount = 0, err = 0;
- FILE *stream = NULL;
-#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
- int pipe_handle;
- int mode = O_RDONLY;
-#else
- NXHandle_t pipe_handle;
- NXMode_t mode = NX_O_RDONLY;
-#endif
- NXExecEnvSpec_t envSpec;
- NXNameSpec_t nameSpec;
- NXVmId_t newVM = 0;
-
- /* Check for validity of input parameters */
- if (!commandline || !type)
- return NULL;
-
- /* Get temporary file name */
- filePath = mktemp(tempName);
- if (!filePath)
- return NULL;
-
- /* Set pipe mode according to type -- for now allow only "r" or "w" */
- if (strcmp(type, "r") == 0)
-#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
- mode = O_RDONLY;
-#else
- mode = NX_O_RDONLY;
-#endif
- else if (strcmp(type, "w") == 0)
-#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
- mode = O_WRONLY;
-#else
- mode = NX_O_WRONLY;
-#endif
- else
- return NULL;
-
-#ifdef USE_PIPE_OPEN
- pipe_handle = pipe_open(filePath, mode);
- if (pipe_handle == -1)
- return NULL;
-#elif defined(USE_MKFIFO)
- pipe_handle = mkfifo(filePath, mode);
- if (pipe_handle == -1)
- return NULL;
-#else
- /* - NetWare doesn't require first parameter
- * - Allowing LibC to choose the buffer size for now
- */
- err = NXFifoOpen(0, filePath, mode, 0, &pipe_handle);
- if (err)
- return NULL;
-#endif
-
- /* Copy the environment variables in preparation for the spawn call */
- envCount = NXGetEnvCount() + 1; /* add one for NULL */
- env = (char **) NXMemAlloc(sizeof(char *) * envCount, 0);
- if (!env)
- return NULL;
-
- err = NXCopyEnv(env, envCount);
- if (err) {
- NXMemFree (env);
- return NULL;
- }
-
- /* Separate commandline string into words */
- ptr = tsrm_strtok_r((char*)commandline, WHITESPACE, NULL);
- ptrLen = strlen(ptr);
-
- command = (char*)malloc(ptrLen + 1);
- if (!command) {
- NXMemFree (env);
- return NULL;
- }
-
- strcpy (command, ptr);
-
- ptr = tsrm_strtok_r(NULL, WHITESPACE, NULL);
- while (ptr && (argc < MAX_ARGS)) {
- ptrLen = strlen(ptr);
-
- argv[argc] = (char*)malloc(ptrLen + 1);
- if (!argv[argc]) {
- NXMemFree (env);
- if (command)
- free (command);
-
- for (i = 0; i < argc; i++) {
- if (argv[i])
- free (argv[i]);
- }
-
- return NULL;
- }
-
- strcpy (argv[argc], ptr);
- argc++;
- ptr = tsrm_strtok_r(NULL, WHITESPACE, NULL);
- }
-
- /* Setup the execution environment and spawn new process */
- envSpec.esFlags = 0; /* Not used */
- envSpec.esArgc = argc;
- envSpec.esArgv = (void **) argv;
- envSpec.esEnv = (void **) env;
-
-/* envSpec.esStdin.ssType = */
- envSpec.esStdout.ssType = NX_OBJ_FIFO;
- envSpec.esStderr.ssType = NX_OBJ_FILE;
-
- /* 'ssHandle' is not a struct/union/class member */
-/*
- envSpec.esStdin.ssHandle =
- envSpec.esStdout.ssHandle =
- envSpec.esStderr.ssHandle = -1;
-*/
- envSpec.esStdin.ssPathCtx = NULL;
- envSpec.esStdout.ssPathCtx = NULL;
- envSpec.esStderr.ssPathCtx = NULL;
-
-#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
- if (mode == O_RDONLY) {
-#else
- if (mode == NX_O_RDONLY) {
-#endif
- envSpec.esStdin.ssPath = filePath;
- envSpec.esStdout.ssPath = stdout;
- } else { /* Write Only */
- envSpec.esStdin.ssPath = stdin;
- envSpec.esStdout.ssPath = filePath;
- }
-
- envSpec.esStderr.ssPath = stdout;
-
- nameSpec.ssType = NX_OBJ_FIFO;
-/* nameSpec.ssHandle = 0; */ /* 'ssHandle' is not a struct/union/class member */
- nameSpec.ssPathCtx = NULL; /* Not used */
- nameSpec.ssPath = argv[0];
- err = NXVmSpawn(&nameSpec, &envSpec, 0, &newVM);
- if (!err)
- /* Get file pointer corresponding to the pipe (file) opened */
- stream = fdopen(pipe_handle, type);
-
- /* Clean-up */
- if (env)
- NXMemFree (env);
-
- if (pipe_handle)
-#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
- close(pipe_handle);
-#else
- NXClose(pipe_handle);
-#endif
-
- if (command)
- free (command);
-
- for (i = 0; i < argc; i++) {
- if (argv[i])
- free (argv[i]);
- }
-
- return stream;
-}
-
-TSRM_API int pclose(FILE* stream)
-{
- int err = 0;
- NXHandle_t fd = 0;
-
- /* Get the process associated with this pipe (file) handle and terminate it */
- fd = fileno(stream);
- NXClose (fd);
-
- err = fclose(stream);
-
- return err;
-}
-
-#endif /* NETWARE */
diff --git a/TSRM/tsrm_nw.h b/TSRM/tsrm_nw.h
deleted file mode 100644
index 5c5357ef95..0000000000
--- a/TSRM/tsrm_nw.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Venkat Raghavan S <rvenkat@novell.com> |
- | Anantha Kesari H Y <hyanantha@novell.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef TSRM_NW_H
-#define TSRM_NW_H
-
-#include "TSRM.h"
-
-TSRM_API FILE* popen(const char *command, const char *type);
-TSRM_API int pclose(FILE* stream);
-
-#endif
diff --git a/TSRM/tsrm_strtok_r.c b/TSRM/tsrm_strtok_r.c
deleted file mode 100644
index e9ad26a7ac..0000000000
--- a/TSRM/tsrm_strtok_r.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <stdio.h>
-
-#include "tsrm_config_common.h"
-#include "tsrm_strtok_r.h"
-
-static inline int in_character_class(char ch, const char *delim)
-{
- while (*delim) {
- if (*delim == ch) {
- return 1;
- }
- delim++;
- }
- return 0;
-}
-
-char *tsrm_strtok_r(char *s, const char *delim, char **last)
-{
- char *token;
-
- if (s == NULL) {
- s = *last;
- }
-
- while (*s && in_character_class(*s, delim)) {
- s++;
- }
- if (!*s) {
- return NULL;
- }
-
- token = s;
-
- while (*s && !in_character_class(*s, delim)) {
- s++;
- }
- if (!*s) {
- *last = s;
- } else {
- *s = '\0';
- *last = s + 1;
- }
- return token;
-}
-
-#if 0
-
-main()
-{
- char foo[] = "/foo/bar//\\barbara";
- char *last;
- char *token;
-
- token = tsrm_strtok_r(foo, "/\\", &last);
- while (token) {
- printf ("Token = '%s'\n", token);
- token = tsrm_strtok_r(NULL, "/\\", &last);
- }
-
- return 0;
-}
-
-#endif
diff --git a/TSRM/tsrm_strtok_r.h b/TSRM/tsrm_strtok_r.h
deleted file mode 100644
index 8c9e8198e7..0000000000
--- a/TSRM/tsrm_strtok_r.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef TSRM_STRTOK_R
-#define TSRM_STRTOK_R
-
-char *tsrm_strtok_r(char *s, const char *delim, char **last);
-
-#endif
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c
deleted file mode 100644
index d62745ad32..0000000000
--- a/TSRM/tsrm_virtual_cwd.c
+++ /dev/null
@@ -1,859 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <stdio.h>
-#include <limits.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <fcntl.h>
-
-#include "tsrm_virtual_cwd.h"
-#include "tsrm_strtok_r.h"
-
-#ifdef TSRM_WIN32
-#include <io.h>
-#include "tsrm_win32.h"
-#endif
-
-#ifdef NETWARE
-/*#include "pipe.h"*/
-#include "tsrm_nw.h"
-#endif
-
-#ifndef HAVE_REALPATH
-#define realpath(x,y) strcpy(y,x)
-#endif
-
-#define VIRTUAL_CWD_DEBUG 0
-
-#include "TSRM.h"
-
-/* Only need mutex for popen() in Windows and NetWare because it doesn't chdir() on UNIX */
-#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS)
-MUTEX_T cwd_mutex;
-#endif
-
-#ifdef ZTS
-static ts_rsrc_id cwd_globals_id;
-#else
-static virtual_cwd_globals cwd_globals;
-#endif
-
-cwd_state main_cwd_state; /* True global */
-
-#ifndef TSRM_WIN32
-#include <unistd.h>
-#else
-#include <direct.h>
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR(mode) ((mode) & _S_IFDIR)
-#endif
-
-#ifndef S_ISREG
-#define S_ISREG(mode) ((mode) & _S_IFREG)
-#endif
-
-#ifdef TSRM_WIN32
-#include <tchar.h>
-#define tsrm_strtok_r(a,b,c) _tcstok((a),(b))
-#define TOKENIZER_STRING "/\\"
-
-static int php_check_dots(const char *element, int n)
-{
- while (n-- > 0) if (element[n] != '.') break;
-
- return (n != -1);
-}
-
-#define IS_DIRECTORY_UP(element, len) \
- (len >= 2 && !php_check_dots(element, len))
-
-#define IS_DIRECTORY_CURRENT(element, len) \
- (len == 1 && ptr[0] == '.')
-
-#elif defined(NETWARE)
-/* NetWare has strtok() (in LibC) and allows both slashes in paths, like Windows --
- but rest of the stuff is like Unix */
-/* strtok() call in LibC is abending when used in a different address space -- hence using
- PHP's version itself for now */
-/*#define tsrm_strtok_r(a,b,c) strtok((a),(b))*/
-#define TOKENIZER_STRING "/\\"
-
-#else
-#define TOKENIZER_STRING "/"
-#endif
-
-
-/* default macros */
-
-#ifndef IS_DIRECTORY_UP
-#define IS_DIRECTORY_UP(element, len) \
- (len == 2 && memcmp(element, "..", 2) == 0)
-#endif
-
-#ifndef IS_DIRECTORY_CURRENT
-#define IS_DIRECTORY_CURRENT(element, len) \
- (len == 1 && ptr[0] == '.')
-#endif
-
-/* define this to check semantics */
-#define IS_DIR_OK(s) (1)
-
-#ifndef IS_DIR_OK
-#define IS_DIR_OK(state) (php_is_dir_ok(state) == 0)
-#endif
-
-
-#define CWD_STATE_COPY(d, s) \
- (d)->cwd_length = (s)->cwd_length; \
- (d)->cwd = (char *) malloc((s)->cwd_length+1); \
- memcpy((d)->cwd, (s)->cwd, (s)->cwd_length+1);
-
-#define CWD_STATE_FREE(s) \
- free((s)->cwd);
-
-static int php_is_dir_ok(const cwd_state *state)
-{
-#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
- struct stat buf;
-
- if (stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode))
-#else
- struct stat_libc buf;
-
- if (stat(state->cwd, (struct stat*)(&buf)) == 0 && S_ISDIR(buf.st_mode))
-#endif
- return (0);
-
- return (1);
-}
-
-static int php_is_file_ok(const cwd_state *state)
-{
-#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
- struct stat buf;
-
- if (stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode))
-#else
- struct stat_libc buf;
-
- if (stat(state->cwd, (struct stat*)(&buf)) == 0 && S_ISREG(buf.st_mode))
-#endif
- return (0);
-
- return (1);
-}
-
-static void cwd_globals_ctor(virtual_cwd_globals *cwd_globals TSRMLS_DC)
-{
- CWD_STATE_COPY(&cwd_globals->cwd, &main_cwd_state);
-}
-
-static void cwd_globals_dtor(virtual_cwd_globals *cwd_globals TSRMLS_DC)
-{
- CWD_STATE_FREE(&cwd_globals->cwd);
-}
-
-static char *tsrm_strndup(const char *s, size_t length)
-{
- char *p;
-
- p = (char *) malloc(length+1);
- if (!p) {
- return (char *)NULL;
- }
- if (length) {
- memcpy(p,s,length);
- }
- p[length]=0;
- return p;
-}
-
-CWD_API void virtual_cwd_startup(void)
-{
- char cwd[MAXPATHLEN];
- char *result;
-
- result = getcwd(cwd, sizeof(cwd));
- if (!result) {
- cwd[0] = '\0';
- }
- main_cwd_state.cwd = strdup(cwd);
- main_cwd_state.cwd_length = strlen(cwd);
-
-#ifdef ZTS
- ts_allocate_id(&cwd_globals_id, sizeof(virtual_cwd_globals), (ts_allocate_ctor) cwd_globals_ctor, (ts_allocate_dtor) cwd_globals_dtor);
-#else
- cwd_globals_ctor(&cwd_globals TSRMLS_CC);
-#endif
-
-#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS)
- cwd_mutex = tsrm_mutex_alloc();
-#endif
-}
-
-CWD_API void virtual_cwd_shutdown(void)
-{
-#ifndef ZTS
- cwd_globals_dtor(&cwd_globals TSRMLS_CC);
-#endif
-#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS)
- tsrm_mutex_free(cwd_mutex);
-#endif
-
- free(main_cwd_state.cwd); /* Don't use CWD_STATE_FREE because the non global states will probably use emalloc()/efree() */
-}
-
-CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC)
-{
- cwd_state *state;
-
- state = &CWDG(cwd);
-
- if (state->cwd_length == 0) {
- char *retval;
-
- *length = 1;
- retval = (char *) malloc(2);
- retval[0] = DEFAULT_SLASH;
- retval[1] = '\0';
- return retval;
- }
-
-#ifdef TSRM_WIN32
- /* If we have something like C: */
- if (state->cwd_length == 2 && state->cwd[state->cwd_length-1] == ':') {
- char *retval;
-
- *length = state->cwd_length+1;
- retval = (char *) malloc(*length+1);
- memcpy(retval, state->cwd, *length);
- retval[*length-1] = DEFAULT_SLASH;
- retval[*length] = '\0';
- return retval;
- }
-#endif
- *length = state->cwd_length;
- return strdup(state->cwd);
-}
-
-
-/* Same semantics as UNIX getcwd() */
-CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC)
-{
- size_t length;
- char *cwd;
-
- cwd = virtual_getcwd_ex(&length TSRMLS_CC);
-
- if (buf == NULL) {
- return cwd;
- }
- if (length > size-1) {
- free(cwd);
- errno = ERANGE; /* Is this OK? */
- return NULL;
- }
- memcpy(buf, cwd, length+1);
- free(cwd);
- return buf;
-}
-
-/* Resolve path relatively to state and put the real path into state */
-/* returns 0 for ok, 1 for error */
-CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath)
-{
- int path_length = strlen(path);
- char *ptr, *path_copy;
- char *tok = NULL;
- int ptr_length;
- cwd_state *old_state;
- int ret = 0;
- int copy_amount = -1;
- char *free_path;
- unsigned char is_absolute = 0;
-#ifndef TSRM_WIN32
- char resolved_path[MAXPATHLEN];
-#endif
-
- if (path_length == 0)
- return (0);
-
-#if !defined(TSRM_WIN32) && !defined(NETWARE)
- /* cwd_length can be 0 when getcwd() fails.
- * This can happen under solaris when a dir does not have read permissions
- * but *does* have execute permissions */
- if (IS_ABSOLUTE_PATH(path, path_length) || (state->cwd_length < 1)) {
- if (use_realpath && realpath(path, resolved_path)) {
- path = resolved_path;
- path_length = strlen(path);
- }
- } else { /* Concat current directory with relative path and then run realpath() on it */
- char *tmp;
- char *ptr;
-
- ptr = tmp = (char *) malloc(state->cwd_length+path_length+sizeof("/"));
- if (!tmp) {
- return 1;
- }
- memcpy(ptr, state->cwd, state->cwd_length);
- ptr += state->cwd_length;
- *ptr++ = DEFAULT_SLASH;
- memcpy(ptr, path, path_length);
- ptr += path_length;
- *ptr = '\0';
- if (use_realpath && realpath(tmp, resolved_path)) {
- path = resolved_path;
- path_length = strlen(path);
- }
- free(tmp);
- }
-#endif
- free_path = path_copy = tsrm_strndup(path, path_length);
-
- old_state = (cwd_state *) malloc(sizeof(cwd_state));
- CWD_STATE_COPY(old_state, state);
-#if VIRTUAL_CWD_DEBUG
- fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path);
-#endif
- if (IS_ABSOLUTE_PATH(path_copy, path_length)) {
- copy_amount = COPY_WHEN_ABSOLUTE(path_copy);
- is_absolute = 1;
-#ifdef TSRM_WIN32
- } else if (IS_SLASH(path_copy[0])) {
- copy_amount = 2;
-#endif
- }
-
- if (copy_amount != -1) {
- state->cwd = (char *) realloc(state->cwd, copy_amount + 1);
- if (copy_amount) {
- if (is_absolute) {
- memcpy(state->cwd, path_copy, copy_amount);
- path_copy += copy_amount;
- } else {
- memcpy(state->cwd, old_state->cwd, copy_amount);
- }
- }
- state->cwd[copy_amount] = '\0';
- state->cwd_length = copy_amount;
- }
-
-
- if (state->cwd_length > 0 || IS_ABSOLUTE_PATH(path, path_length)) {
- ptr = tsrm_strtok_r(path_copy, TOKENIZER_STRING, &tok);
- while (ptr) {
- ptr_length = strlen(ptr);
-
- if (IS_DIRECTORY_UP(ptr, ptr_length)) {
- char save;
-
- save = DEFAULT_SLASH;
-
-#define PREVIOUS state->cwd[state->cwd_length - 1]
-
- while (IS_ABSOLUTE_PATH(state->cwd, state->cwd_length) &&
- !IS_SLASH(PREVIOUS)) {
- save = PREVIOUS;
- PREVIOUS = '\0';
- state->cwd_length--;
- }
-
- if (!IS_ABSOLUTE_PATH(state->cwd, state->cwd_length)) {
- state->cwd[state->cwd_length++] = save;
- state->cwd[state->cwd_length] = '\0';
- } else {
- PREVIOUS = '\0';
- state->cwd_length--;
- }
- } else if (!IS_DIRECTORY_CURRENT(ptr, ptr_length)) {
- state->cwd = (char *) realloc(state->cwd, state->cwd_length+ptr_length+1+1);
-#ifdef TSRM_WIN32
- /* Windows 9x will consider C:\\Foo as a network path. Avoid it. */
- if ((state->cwd[state->cwd_length-1]!='\\' && state->cwd[state->cwd_length-1]!='/') ||
- IsDBCSLeadByte(state->cwd[state->cwd_length-2])) {
- state->cwd[state->cwd_length++] = DEFAULT_SLASH;
- }
-#elif defined(NETWARE)
- /* If the token is a volume name, it will have colon at the end -- so, no slash before it */
- if (ptr[ptr_length-1] != ':') {
- state->cwd[state->cwd_length++] = DEFAULT_SLASH;
- }
-#else
- state->cwd[state->cwd_length++] = DEFAULT_SLASH;
-#endif
- memcpy(&state->cwd[state->cwd_length], ptr, ptr_length+1);
- state->cwd_length += ptr_length;
- }
- ptr = tsrm_strtok_r(NULL, TOKENIZER_STRING, &tok);
- }
-
- if (state->cwd_length == COPY_WHEN_ABSOLUTE(state->cwd)) {
- state->cwd = (char *) realloc(state->cwd, state->cwd_length+1+1);
- state->cwd[state->cwd_length] = DEFAULT_SLASH;
- state->cwd[state->cwd_length+1] = '\0';
- state->cwd_length++;
- }
- } else {
- state->cwd = (char *) realloc(state->cwd, path_length+1);
- memcpy(state->cwd, path, path_length+1);
- state->cwd_length = path_length;
- }
-
- if (verify_path && verify_path(state)) {
- CWD_STATE_FREE(state);
-
- *state = *old_state;
-
- ret = 1;
- } else {
- CWD_STATE_FREE(old_state);
- ret = 0;
- }
-
- free(old_state);
-
- free(free_path);
-#if VIRTUAL_CWD_DEBUG
- fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd);
-#endif
- return (ret);
-}
-
-CWD_API int virtual_chdir(const char *path TSRMLS_DC)
-{
- return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, 1)?-1:0;
-}
-
-CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_DC)
-{
- int length = strlen(path);
- char *temp;
- int retval;
-
- if (length == 0) {
- return 1; /* Can't cd to empty string */
- }
- while(--length >= 0 && !IS_SLASH(path[length])) {
- }
-
- if (length == -1) {
- /* No directory only file name */
- errno = ENOENT;
- return -1;
- }
-
- if (length == COPY_WHEN_ABSOLUTE(path) && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */
- length++;
- }
- temp = (char *) tsrm_do_alloca(length+1);
- memcpy(temp, path, length);
- temp[length] = 0;
-#if VIRTUAL_CWD_DEBUG
- fprintf (stderr, "Changing directory to %s\n", temp);
-#endif
- retval = p_chdir(temp TSRMLS_CC);
- tsrm_free_alloca(temp);
- return retval;
-}
-
-CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC)
-{
- cwd_state new_state;
- char *retval;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
-
- if (virtual_file_ex(&new_state, path, NULL, 1)==0) {
- int len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length;
-
- memcpy(real_path, new_state.cwd, len);
- real_path[len] = '\0';
- retval = real_path;
- } else {
- retval = NULL;
- }
-
- CWD_STATE_FREE(&new_state);
-
- return retval;
-}
-
-CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSRMLS_DC)
-{
- cwd_state new_state;
- int retval;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- retval = virtual_file_ex(&new_state, path, verify_path, 1);
-
- *filepath = new_state.cwd;
-
- return retval;
-
-}
-
-CWD_API int virtual_filepath(const char *path, char **filepath TSRMLS_DC)
-{
- return virtual_filepath_ex(path, filepath, php_is_file_ok TSRMLS_CC);
-}
-
-CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC)
-{
- cwd_state new_state;
- FILE *f;
-
- if (path[0] == '\0') { /* Fail to open empty path */
- return NULL;
- }
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL, 1);
-
- f = fopen(new_state.cwd, mode);
-
- CWD_STATE_FREE(&new_state);
- return f;
-}
-
-CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC)
-{
- cwd_state new_state;
- int ret;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, pathname, NULL, 1);
-
-#if defined(TSRM_WIN32)
- ret = tsrm_win32_access(new_state.cwd, mode);
-#else
- ret = access(new_state.cwd, mode);
-#endif
-
- CWD_STATE_FREE(&new_state);
-
- return ret;
-}
-
-
-#if HAVE_UTIME
-CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC)
-{
- cwd_state new_state;
- int ret;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, filename, NULL, 0);
-
- ret = utime(new_state.cwd, buf);
-
- CWD_STATE_FREE(&new_state);
- return ret;
-}
-#endif
-
-CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC)
-{
- cwd_state new_state;
- int ret;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, filename, NULL, 1);
-
- ret = chmod(new_state.cwd, mode);
-
- CWD_STATE_FREE(&new_state);
- return ret;
-}
-
-#if !defined(TSRM_WIN32) && !defined(NETWARE)
-CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC)
-{
- cwd_state new_state;
- int ret;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, filename, NULL, 0);
-
- ret = chown(new_state.cwd, owner, group);
-
- CWD_STATE_FREE(&new_state);
- return ret;
-}
-#endif
-
-CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...)
-{
- cwd_state new_state;
- int f;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL, 1);
-
- if (flags & O_CREAT) {
- mode_t mode;
- va_list arg;
-
- va_start(arg, flags);
- mode = (mode_t) va_arg(arg, int);
- va_end(arg);
-
- f = open(new_state.cwd, flags, mode);
- } else {
- f = open(new_state.cwd, flags);
- }
- CWD_STATE_FREE(&new_state);
- return f;
-}
-
-CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC)
-{
- cwd_state new_state;
- int f;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL, 1);
-
- f = creat(new_state.cwd, mode);
-
- CWD_STATE_FREE(&new_state);
- return f;
-}
-
-CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC)
-{
- cwd_state old_state;
- cwd_state new_state;
- int retval;
-
- CWD_STATE_COPY(&old_state, &CWDG(cwd));
- virtual_file_ex(&old_state, oldname, NULL, 0);
- oldname = old_state.cwd;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, newname, NULL, 0);
- newname = new_state.cwd;
-
- retval = rename(oldname, newname);
-
- CWD_STATE_FREE(&old_state);
- CWD_STATE_FREE(&new_state);
-
- return retval;
-}
-
-#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
-CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC)
-{
- cwd_state new_state;
- int retval;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL, 1);
-
- retval = stat(new_state.cwd, buf);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-#else
-CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC)
-{
- cwd_state new_state;
- int retval;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL, 1);
-
- retval = stat(new_state.cwd, (struct stat*)buf);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-#endif
-
-#if !defined(TSRM_WIN32) && !defined(NETWARE)
-CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC)
-{
- cwd_state new_state;
- int retval;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL, 0);
-
- retval = lstat(new_state.cwd, buf);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-#endif
-
-CWD_API int virtual_unlink(const char *path TSRMLS_DC)
-{
- cwd_state new_state;
- int retval;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL, 0);
-
- retval = unlink(new_state.cwd);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC)
-{
- cwd_state new_state;
- int retval;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, pathname, NULL, 1);
-
-#ifdef TSRM_WIN32
- retval = mkdir(new_state.cwd);
-#else
- retval = mkdir(new_state.cwd, mode);
-#endif
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC)
-{
- cwd_state new_state;
- int retval;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, pathname, NULL, 0);
-
- retval = rmdir(new_state.cwd);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-#ifdef TSRM_WIN32
-DIR *opendir(const char *name);
-#endif
-
-CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC)
-{
- cwd_state new_state;
- DIR *retval;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, pathname, NULL, 1);
-
- retval = opendir(new_state.cwd);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-#ifdef TSRM_WIN32
-
-CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
-{
- return popen_ex(command, type, CWDG(cwd).cwd, NULL);
-}
-
-#elif defined(NETWARE)
-
-/* On NetWare, the trick of prepending "cd cwd; " doesn't work so we need to perform
- a VCWD_CHDIR() and mutex it
- */
-CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
-{
- char prev_cwd[MAXPATHLEN];
- char *getcwd_result;
- FILE *retval;
-
- getcwd_result = VCWD_GETCWD(prev_cwd, MAXPATHLEN);
- if (!getcwd_result) {
- return NULL;
- }
-
-#ifdef ZTS
- tsrm_mutex_lock(cwd_mutex);
-#endif
-
- VCWD_CHDIR(CWDG(cwd).cwd);
- retval = popen(command, type);
- VCWD_CHDIR(prev_cwd);
-
-#ifdef ZTS
- tsrm_mutex_unlock(cwd_mutex);
-#endif
-
- return retval;
-}
-
-#else /* Unix */
-
-CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
-{
- int command_length;
- char *command_line;
- char *ptr;
- FILE *retval;
-
- command_length = strlen(command);
-
- ptr = command_line = (char *) malloc(command_length + sizeof("cd ; ") + CWDG(cwd).cwd_length+1);
- if (!command_line) {
- return NULL;
- }
- memcpy(ptr, "cd ", sizeof("cd ")-1);
- ptr += sizeof("cd ")-1;
-
- if (CWDG(cwd).cwd_length == 0) {
- *ptr++ = DEFAULT_SLASH;
- } else {
- memcpy(ptr, CWDG(cwd).cwd, CWDG(cwd).cwd_length);
- ptr += CWDG(cwd).cwd_length;
- }
-
- *ptr++ = ' ';
- *ptr++ = ';';
- *ptr++ = ' ';
-
- memcpy(ptr, command, command_length+1);
- retval = popen(command_line, type);
-
- free(command_line);
- return retval;
-}
-
-#endif
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/TSRM/tsrm_virtual_cwd.h b/TSRM/tsrm_virtual_cwd.h
deleted file mode 100644
index 0e983a621c..0000000000
--- a/TSRM/tsrm_virtual_cwd.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef VIRTUAL_CWD_H
-#define VIRTUAL_CWD_H
-
-#include "TSRM.h"
-#include "tsrm_config_common.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <ctype.h>
-
-#ifdef HAVE_UTIME_H
-#include <utime.h>
-#endif
-
-#ifdef HAVE_STDARG_H
-#include <stdarg.h>
-#endif
-
-#ifndef TSRM_WIN32
-#include <unistd.h>
-#endif
-
-#ifdef TSRM_WIN32
-#include "readdir.h"
-#include <sys/utime.h>
-/* mode_t isn't defined on Windows */
-typedef unsigned short mode_t;
-
-#define DEFAULT_SLASH '\\'
-#define DEFAULT_DIR_SEPARATOR ';'
-#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
-#define IS_SLASH_P(c) (*(c) == '/' || \
- (*(c) == '\\' && !IsDBCSLeadByte(*(c-1))))
-
-/* COPY_WHEN_ABSOLUTE is 2 under Win32 because by chance both regular absolute paths
- in the file system and UNC paths need copying of two characters */
-#define COPY_WHEN_ABSOLUTE(path) 2
-#define IS_UNC_PATH(path, len) \
- (len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1]))
-#define IS_ABSOLUTE_PATH(path, len) \
- (len >= 2 && ((isalpha(path[0]) && path[1] == ':') || IS_UNC_PATH(path, len)))
-
-#elif defined(NETWARE)
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#define DEFAULT_SLASH '/'
-#define DEFAULT_DIR_SEPARATOR ';'
-#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
-#define IS_SLASH_P(c) IS_SLASH(*(c))
-#define COPY_WHEN_ABSOLUTE(path) \
- (strchr(path, ':') - path + 1) /* Take the volume name which ends with a colon */
-#define IS_ABSOLUTE_PATH(path, len) \
- (strchr(path, ':') != NULL) /* Colon indicates volume name */
-
-#else
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#define DEFAULT_SLASH '/'
-
-#ifdef __riscos__
-#define DEFAULT_DIR_SEPARATOR ';'
-#else
-#define DEFAULT_DIR_SEPARATOR ':'
-#endif
-
-#define IS_SLASH(c) ((c) == '/')
-#define IS_SLASH_P(c) (*(c) == '/')
-
-#endif
-
-
-#ifndef COPY_WHEN_ABSOLUTE
-#define COPY_WHEN_ABSOLUTE(path) 0
-#endif
-
-#ifndef IS_ABSOLUTE_PATH
-#define IS_ABSOLUTE_PATH(path, len) \
- (IS_SLASH(path[0]))
-#endif
-
-#ifdef TSRM_EXPORTS
-#define CWD_EXPORTS
-#endif
-
-#ifdef TSRM_WIN32
-# ifdef CWD_EXPORTS
-# define CWD_API __declspec(dllexport)
-# else
-# define CWD_API __declspec(dllimport)
-# endif
-#else
-#define CWD_API
-#endif
-
-typedef struct _cwd_state {
- char *cwd;
- int cwd_length;
-} cwd_state;
-
-typedef int (*verify_path_func)(const cwd_state *);
-
-CWD_API void virtual_cwd_startup(void);
-CWD_API void virtual_cwd_shutdown(void);
-CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC);
-CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC);
-CWD_API int virtual_chdir(const char *path TSRMLS_DC);
-CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_DC);
-CWD_API int virtual_filepath(const char *path, char **filepath TSRMLS_DC);
-CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSRMLS_DC);
-CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC);
-CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC);
-CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...);
-CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC);
-CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC);
-#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
-CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC);
-#else
-CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC);
-#endif
-#if !defined(TSRM_WIN32) && !defined(NETWARE)
-CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC);
-#endif
-CWD_API int virtual_unlink(const char *path TSRMLS_DC);
-CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC);
-CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC);
-CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC);
-CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC);
-CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC);
-#if defined(TSRM_WIN32)
-/* these are not defined in win32 headers */
-#ifndef W_OK
-#define W_OK 0x02
-#endif
-#ifndef R_OK
-#define R_OK 0x04
-#endif
-#ifndef X_OK
-#define X_OK 0x01
-#endif
-#ifndef F_OK
-#define F_OK 0x00
-#endif
-#endif
-
-#if HAVE_UTIME
-CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC);
-#endif
-CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC);
-#if !defined(TSRM_WIN32) && !defined(NETWARE)
-CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC);
-#endif
-
-CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath);
-
-typedef struct _virtual_cwd_globals {
- cwd_state cwd;
-} virtual_cwd_globals;
-
-#ifdef ZTS
-# define CWDG(v) TSRMG(cwd_globals_id, virtual_cwd_globals *, v)
-#else
-# define CWDG(v) (cwd_globals.v)
-#endif
-
-/* The actual macros to be used in programs using TSRM
- * If the program defines VIRTUAL_DIR it will use the
- * virtual_* functions
- */
-
-#ifdef VIRTUAL_DIR
-
-#define VCWD_GETCWD(buff, size) virtual_getcwd(buff, size TSRMLS_CC)
-#define VCWD_FOPEN(path, mode) virtual_fopen(path, mode TSRMLS_CC)
-/* Because open() has two modes, we have to macros to replace it */
-#define VCWD_OPEN(path, flags) virtual_open(path TSRMLS_CC, flags)
-#define VCWD_OPEN_MODE(path, flags, mode) virtual_open(path TSRMLS_CC, flags, mode)
-#define VCWD_CREAT(path, mode) virtual_creat(path, mode TSRMLS_CC)
-#define VCWD_CHDIR(path) virtual_chdir(path TSRMLS_CC)
-#define VCWD_CHDIR_FILE(path) virtual_chdir_file(path, virtual_chdir TSRMLS_CC)
-#define VCWD_GETWD(buf)
-#define VCWD_REALPATH(path, real_path) virtual_realpath(path, real_path TSRMLS_CC)
-#define VCWD_RENAME(oldname, newname) virtual_rename(oldname, newname TSRMLS_CC)
-#define VCWD_STAT(path, buff) virtual_stat(path, buff TSRMLS_CC)
-#if !defined(TSRM_WIN32) && !defined(NETWARE)
-#define VCWD_LSTAT(path, buff) virtual_lstat(path, buff TSRMLS_CC)
-#endif
-#define VCWD_UNLINK(path) virtual_unlink(path TSRMLS_CC)
-#define VCWD_MKDIR(pathname, mode) virtual_mkdir(pathname, mode TSRMLS_CC)
-#define VCWD_RMDIR(pathname) virtual_rmdir(pathname TSRMLS_CC)
-#define VCWD_OPENDIR(pathname) virtual_opendir(pathname TSRMLS_CC)
-#define VCWD_POPEN(command, type) virtual_popen(command, type TSRMLS_CC)
-#define VCWD_ACCESS(pathname, mode) virtual_access(pathname, mode TSRMLS_CC)
-#if HAVE_UTIME
-#define VCWD_UTIME(path, time) virtual_utime(path, time TSRMLS_CC)
-#endif
-#define VCWD_CHMOD(path, mode) virtual_chmod(path, mode TSRMLS_CC)
-#if !defined(TSRM_WIN32) && !defined(NETWARE)
-#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group TSRMLS_CC)
-#endif
-
-#else
-
-#define VCWD_GETCWD(buff, size) getcwd(buff, size)
-#define VCWD_FOPEN(path, mode) fopen(path, mode)
-#define VCWD_OPEN(path, flags) open(path, flags)
-#define VCWD_OPEN_MODE(path, flags, mode) open(path, flags, mode)
-#define VCWD_CREAT(path, mode) creat(path, mode)
-#define VCWD_RENAME(oldname, newname) rename(oldname, newname)
-#define VCWD_CHDIR(path) chdir(path)
-#define VCWD_CHDIR_FILE(path) virtual_chdir_file(path, chdir)
-#define VCWD_GETWD(buf) getwd(buf)
-#define VCWD_STAT(path, buff) stat(path, buff)
-#define VCWD_LSTAT(path, buff) lstat(path, buff)
-#define VCWD_UNLINK(path) unlink(path)
-#define VCWD_MKDIR(pathname, mode) mkdir(pathname, mode)
-#define VCWD_RMDIR(pathname) rmdir(pathname)
-#define VCWD_OPENDIR(pathname) opendir(pathname)
-#define VCWD_POPEN(command, type) popen(command, type)
-#if defined(TSRM_WIN32)
-#define VCWD_ACCESS(pathname, mode) tsrm_win32_access(pathname, mode)
-#else
-#define VCWD_ACCESS(pathname, mode) access(pathname, mode)
-#endif
-
-#ifdef HAVE_REALPATH
-#define VCWD_REALPATH(path, real_path) realpath(path, real_path)
-#else
-#define VCWD_REALPATH(path, real_path) strcpy(real_path, path)
-#endif
-
-#if HAVE_UTIME
-#define VCWD_UTIME(path, time) utime(path, time)
-#endif
-#define VCWD_CHMOD(path, mode) chmod(path, mode)
-#if !defined(TSRM_WIN32) && !defined(NETWARE)
-#define VCWD_CHOWN(path, owner, group) chown(path, owner, group)
-#endif
-
-#endif
-
-#endif /* VIRTUAL_CWD_H */
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
deleted file mode 100644
index 0cffe4722a..0000000000
--- a/TSRM/tsrm_win32.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Daniel Beulshausen <daniel@php4win.de> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <io.h>
-#include <process.h>
-#include <time.h>
-
-#define TSRM_INCLUDE_FULL_WINDOWS_HEADERS
-
-#include "TSRM.h"
-
-#ifdef TSRM_WIN32
-#include "tsrm_win32.h"
-
-#ifdef ZTS
-static ts_rsrc_id win32_globals_id;
-#else
-static tsrm_win32_globals win32_globals;
-#endif
-
-static void tsrm_win32_ctor(tsrm_win32_globals *globals TSRMLS_DC)
-{
- globals->process = NULL;
- globals->shm = NULL;
- globals->process_size = 0;
- globals->shm_size = 0;
- globals->comspec = _strdup((GetVersion()<0x80000000)?"cmd.exe":"command.com");
-}
-
-static void tsrm_win32_dtor(tsrm_win32_globals *globals TSRMLS_DC)
-{
- shm_pair *ptr;
-
- if (globals->process) {
- free(globals->process);
- }
-
- if (globals->shm) {
- for (ptr = globals->shm; ptr < (globals->shm + globals->shm_size); ptr++) {
- UnmapViewOfFile(ptr->addr);
- CloseHandle(ptr->segment);
- UnmapViewOfFile(ptr->descriptor);
- CloseHandle(ptr->info);
- }
- free(globals->shm);
- }
-
- free(globals->comspec);
-}
-
-TSRM_API void tsrm_win32_startup(void)
-{
-#ifdef ZTS
- ts_allocate_id(&win32_globals_id, sizeof(tsrm_win32_globals), (ts_allocate_ctor)tsrm_win32_ctor, (ts_allocate_ctor)tsrm_win32_dtor);
-#else
- tsrm_win32_ctor(&win32_globals TSRMLS_CC);
-#endif
-}
-
-TSRM_API void tsrm_win32_shutdown(void)
-{
-#ifndef ZTS
- tsrm_win32_dtor(&win32_globals TSRMLS_CC);
-#endif
-}
-
-TSRM_API int tsrm_win32_access(const char *pathname, int mode)
-{
- SHFILEINFO sfi;
-
- if (mode == 1 /*X_OK*/) {
- return access(pathname, 0) == 0 &&
- SHGetFileInfo(pathname, 0, &sfi, sizeof(SHFILEINFO), SHGFI_EXETYPE) != 0 ? 0 : -1;
- } else {
- return access(pathname, mode);
- }
-}
-
-
-static process_pair *process_get(FILE *stream TSRMLS_DC)
-{
- process_pair *ptr;
- process_pair *newptr;
-
- for (ptr = TWG(process); ptr < (TWG(process) + TWG(process_size)); ptr++) {
- if (ptr->stream == stream) {
- break;
- }
- }
-
- if (ptr < (TWG(process) + TWG(process_size))) {
- return ptr;
- }
-
- newptr = (process_pair*)realloc((void*)TWG(process), (TWG(process_size)+1)*sizeof(process_pair));
- if (newptr == NULL) {
- return NULL;
- }
-
- TWG(process) = newptr;
- ptr = newptr + TWG(process_size);
- TWG(process_size)++;
- return ptr;
-}
-
-static shm_pair *shm_get(int key, void *addr)
-{
- shm_pair *ptr;
- shm_pair *newptr;
- TSRMLS_FETCH();
-
- for (ptr = TWG(shm); ptr < (TWG(shm) + TWG(shm_size)); ptr++) {
- if (!ptr->descriptor) {
- continue;
- }
- if (!addr && ptr->descriptor->shm_perm.key == key) {
- break;
- } else if (ptr->addr == addr) {
- break;
- }
- }
-
- if (ptr < (TWG(shm) + TWG(shm_size))) {
- return ptr;
- }
-
- newptr = (shm_pair*)realloc((void*)TWG(shm), (TWG(shm_size)+1)*sizeof(shm_pair));
- if (newptr == NULL) {
- return NULL;
- }
-
- TWG(shm) = newptr;
- ptr = newptr + TWG(shm_size);
- TWG(shm_size)++;
- return ptr;
-}
-
-static HANDLE dupHandle(HANDLE fh, BOOL inherit) {
- HANDLE copy, self = GetCurrentProcess();
- if (!DuplicateHandle(self, fh, self, &copy, 0, inherit, DUPLICATE_SAME_ACCESS|DUPLICATE_CLOSE_SOURCE)) {
- return NULL;
- }
- return copy;
-}
-
-TSRM_API FILE *popen(const char *command, const char *type)
-{
- return popen_ex(command, type, NULL, NULL);
-}
-
-TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env)
-{
- FILE *stream = NULL;
- int fno, str_len = strlen(type), read, mode;
- STARTUPINFO startup;
- PROCESS_INFORMATION process;
- SECURITY_ATTRIBUTES security;
- HANDLE in, out;
- char *cmd;
- process_pair *proc;
- TSRMLS_FETCH();
-
- security.nLength = sizeof(SECURITY_ATTRIBUTES);
- security.bInheritHandle = TRUE;
- security.lpSecurityDescriptor = NULL;
-
- if (!str_len || !CreatePipe(&in, &out, &security, 2048L)) {
- return NULL;
- }
-
- memset(&startup, 0, sizeof(STARTUPINFO));
- memset(&process, 0, sizeof(PROCESS_INFORMATION));
-
- startup.cb = sizeof(STARTUPINFO);
- startup.dwFlags = STARTF_USESTDHANDLES;
- startup.hStdError = GetStdHandle(STD_ERROR_HANDLE);
-
- read = (type[0] == 'r') ? TRUE : FALSE;
- mode = ((str_len == 2) && (type[1] == 'b')) ? O_BINARY : O_TEXT;
-
-
- if (read) {
- in = dupHandle(in, FALSE);
- startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
- startup.hStdOutput = out;
- } else {
- out = dupHandle(out, FALSE);
- startup.hStdInput = in;
- startup.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
- }
-
- cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c "));
- sprintf(cmd, "%s /c %s", TWG(comspec), command);
- if (!CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle, NORMAL_PRIORITY_CLASS, env, cwd, &startup, &process)) {
- return NULL;
- }
- free(cmd);
-
- CloseHandle(process.hThread);
- proc = process_get(NULL TSRMLS_CC);
-
- if (read) {
- fno = _open_osfhandle((long)in, _O_RDONLY | mode);
- CloseHandle(out);
- } else {
- fno = _open_osfhandle((long)out, _O_WRONLY | mode);
- CloseHandle(in);
- }
-
- stream = _fdopen(fno, type);
- proc->prochnd = process.hProcess;
- proc->stream = stream;
- return stream;
-}
-
-TSRM_API int pclose(FILE *stream)
-{
- DWORD termstat = 0;
- process_pair *process;
- TSRMLS_FETCH();
-
- if ((process = process_get(stream TSRMLS_CC)) == NULL) {
- return 0;
- }
-
- fflush(process->stream);
- fclose(process->stream);
-
- WaitForSingleObject(process->prochnd, INFINITE);
- GetExitCodeProcess(process->prochnd, &termstat);
- process->stream = NULL;
- CloseHandle(process->prochnd);
-
- return termstat;
-}
-
-TSRM_API int shmget(int key, int size, int flags)
-{
- shm_pair *shm;
- char shm_segment[26], shm_info[29];
- HANDLE shm_handle, info_handle;
- BOOL created = FALSE;
-
- if (size < 0) {
- return -1;
- }
-
- sprintf(shm_segment, "TSRM_SHM_SEGMENT:%d", key);
- sprintf(shm_info, "TSRM_SHM_DESCRIPTOR:%d", key);
-
- shm_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_segment);
- info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info);
-
- if ((!shm_handle && !info_handle)) {
- if (flags & IPC_EXCL) {
- return -1;
- }
- if (flags & IPC_CREAT) {
- shm_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, size, shm_segment);
- info_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(shm->descriptor), shm_info);
- created = TRUE;
- }
- if ((!shm_handle || !info_handle)) {
- return -1;
- }
- }
-
- shm = shm_get(key, NULL);
- shm->segment = shm_handle;
- shm->info = info_handle;
- shm->descriptor = MapViewOfFileEx(shm->info, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
-
- if (created) {
- shm->descriptor->shm_perm.key = key;
- shm->descriptor->shm_segsz = size;
- shm->descriptor->shm_ctime = time(NULL);
- shm->descriptor->shm_cpid = getpid();
- shm->descriptor->shm_perm.mode = flags;
-
- shm->descriptor->shm_perm.cuid = shm->descriptor->shm_perm.cgid= 0;
- shm->descriptor->shm_perm.gid = shm->descriptor->shm_perm.uid = 0;
- shm->descriptor->shm_atime = shm->descriptor->shm_dtime = 0;
- shm->descriptor->shm_lpid = shm->descriptor->shm_nattch = 0;
- shm->descriptor->shm_perm.mode = shm->descriptor->shm_perm.seq = 0;
- }
-
- if (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz ) {
- CloseHandle(shm->segment);
- UnmapViewOfFile(shm->descriptor);
- CloseHandle(shm->info);
- return -1;
- }
-
- return key;
-}
-
-TSRM_API void *shmat(int key, const void *shmaddr, int flags)
-{
- shm_pair *shm = shm_get(key, NULL);
-
- if (!shm->segment) {
- return (void*)-1;
- }
-
- shm->descriptor->shm_atime = time(NULL);
- shm->descriptor->shm_lpid = getpid();
- shm->descriptor->shm_nattch++;
-
- shm->addr = MapViewOfFileEx(shm->segment, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
-
- return shm->addr;
-}
-
-TSRM_API int shmdt(const void *shmaddr)
-{
- shm_pair *shm = shm_get(0, (void*)shmaddr);
-
- if (!shm->segment) {
- return -1;
- }
-
- shm->descriptor->shm_dtime = time(NULL);
- shm->descriptor->shm_lpid = getpid();
- shm->descriptor->shm_nattch--;
-
- return UnmapViewOfFile(shm->addr) ? 0 : -1;
-}
-
-TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf) {
- shm_pair *shm = shm_get(key, NULL);
-
- if (!shm->segment) {
- return -1;
- }
-
- switch (cmd) {
- case IPC_STAT:
- memcpy(buf, shm->descriptor, sizeof(struct shmid_ds));
- return 0;
-
- case IPC_SET:
- shm->descriptor->shm_ctime = time(NULL);
- shm->descriptor->shm_perm.uid = buf->shm_perm.uid;
- shm->descriptor->shm_perm.gid = buf->shm_perm.gid;
- shm->descriptor->shm_perm.mode = buf->shm_perm.mode;
- return 0;
-
- case IPC_RMID:
- if (shm->descriptor->shm_nattch < 1) {
- shm->descriptor->shm_perm.key = -1;
- }
- return 0;
-
- default:
- return -1;
- }
-}
-#endif
diff --git a/TSRM/tsrm_win32.h b/TSRM/tsrm_win32.h
deleted file mode 100644
index a027b8a4a9..0000000000
--- a/TSRM/tsrm_win32.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Daniel Beulshausen <daniel@php4win.de> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef TSRM_WIN32_H
-#define TSRM_WIN32_H
-
-#include "TSRM.h"
-#include <windows.h>
-
-struct ipc_perm {
- int key;
- unsigned short uid;
- unsigned short gid;
- unsigned short cuid;
- unsigned short cgid;
- unsigned short mode;
- unsigned short seq;
-};
-
-struct shmid_ds {
- struct ipc_perm shm_perm;
- int shm_segsz;
- time_t shm_atime;
- time_t shm_dtime;
- time_t shm_ctime;
- unsigned short shm_cpid;
- unsigned short shm_lpid;
- short shm_nattch;
-};
-
-typedef struct {
- FILE *stream;
- HANDLE prochnd;
-} process_pair;
-
-typedef struct {
- void *addr;
- HANDLE info;
- HANDLE segment;
- struct shmid_ds *descriptor;
-} shm_pair;
-
-typedef struct {
- process_pair *process;
- shm_pair *shm;
- int process_size;
- int shm_size;
- char *comspec;
-} tsrm_win32_globals;
-
-#ifdef ZTS
-# define TWG(v) TSRMG(win32_globals_id, tsrm_win32_globals *, v)
-#else
-# define TWG(v) (win32_globals.v)
-#endif
-
-#define IPC_PRIVATE 0
-#define IPC_CREAT 00001000
-#define IPC_EXCL 00002000
-#define IPC_NOWAIT 00004000
-
-#define IPC_RMID 0
-#define IPC_SET 1
-#define IPC_STAT 2
-#define IPC_INFO 3
-
-#define SHM_R PAGE_READONLY
-#define SHM_W PAGE_READWRITE
-
-#define SHM_RDONLY FILE_MAP_READ
-#define SHM_RND FILE_MAP_WRITE
-#define SHM_REMAP FILE_MAP_COPY
-
-
-TSRM_API void tsrm_win32_startup(void);
-TSRM_API void tsrm_win32_shutdown(void);
-
-TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env);
-TSRM_API FILE *popen(const char *command, const char *type);
-TSRM_API int pclose(FILE *stream);
-TSRM_API int tsrm_win32_access(const char *pathname, int mode);
-
-TSRM_API int shmget(int key, int size, int flags);
-TSRM_API void *shmat(int key, const void *shmaddr, int flags);
-TSRM_API int shmdt(const void *shmaddr);
-TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf);
-
-#endif \ No newline at end of file
diff --git a/Zend/ChangeLog b/Zend/ChangeLog
deleted file mode 100644
index 672e8f51e8..0000000000
--- a/Zend/ChangeLog
+++ /dev/null
@@ -1,12075 +0,0 @@
-2003-04-07 Jani Taskinen <sniper@iki.fi>
-
- * zend_language_scanner.l:
- Fixed bug #23093 (highlight_string() crashed with __FUNCTION__)
-
-2003-04-07 Sterling Hughes <sterling@bumblebury.com>
-
- * zend_compile.h:
- add markers that make this file easy to parse for external sources
-
-2003-04-04 Andrei Zmievski <andrei@gravitonic.com>
-
- * zend_API.h:
- Introduce ZEND_ME() and ZEND_METHOD() macros. Use these for declaring
- class methods to avoid name collisions.
-
-2003-04-04 Stanislav Malyshev <stas@zend.com>
-
- * zend_API.c
- zend_API.h:
- Fix namespace issues
-
-2003-04-03 Andrei Zmievski <andrei@gravitonic.com>
-
- * zend_API.c:
- Patch from Timm Friede for when EG(active_namespace) is NULL initially.
-
- * zend.c
- zend_API.c
- zend_compile.c:
- Initialize all relevant zend_class_entry fields to avoid accidental
- crashes.
-
-2003-04-03 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_list.c:
- Leftover.
-
-2003-04-03 Sterling Hughes <sterling@bumblebury.com>
-
- * zend_list.c
- zend_list.h:
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
- i will not commit before 12:00
-
-2003-04-02 Andrei Zmievski <andrei@gravitonic.com>
-
- * zend_API.c
- zend_API.h:
- - Add zend_register_internal_namespace() API function.
- - Add zend_register_internal_class_in_ns() API function.
-
- * zend_compile.h:
- Simplify.
-
-2003-04-02 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_list.c:
- - Fix whitespace
-
-2003-04-02 Sterling Hughes <sterling@bumblebury.com>
-
- * zend_list.c
- zend_list.h:
- add the ability for curl_multi_info to introspect the handles.
-
-
-2003-04-02 Andrei Zmievski <andrei@gravitonic.com>
-
- * zend_compile.c
- zend_compile.h
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l:
- Implement a different way to catch documentation comments.
-
- * zend_compile.c
- zend_compile.h
- zend_highlight.c
- zend_language_parser.y
- zend_language_scanner.l:
- Revert portions of the doc comment patch. There should be no parser
- errors now.
-
-2003-04-02 Stanislav Malyshev <stas@zend.com>
-
- * zend_builtin_functions.c
- zend_compile.h
- zend_execute.c:
- allow class_exists() to work with namespaces too.
- add CLASS_IS_NAMESPACE macro
-
- * zend_builtin_functions.c:
- fix typo
-
- * zend_builtin_functions.c:
- fix parameterless get_declared_classes call
-
-2003-04-01 Andrei Zmievski <andrei@gravitonic.com>
-
- * zend_execute.c:
- Stas's patch on zend_execute.c (1.448 -> 1.449) resulted in a bug where
- the namespaced member accesses didn't work. This should hopefully
- correct it.
-
- * zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_object_handlers.c
- zend_opcode.c:
- Split ZEND_NAMESPACE into user and internal namespaces. Hope this is
- okay with engine folks.
-
-2003-04-01 Stanislav Malyshev <stas@zend.com>
-
- * zend_builtin_functions.c:
- improve namespace name hanfling
-
- * zend_builtin_functions.c:
- fix get_declared_classes()
-
- * zend_language_parser.y
- zend_language_scanner.l:
- Add __NAMESPACE__ auto-constant.
-
- * zend_builtin_functions.c:
- make get_declared_classes() work with namespaces (based on Tal Peer's
- patch)
-
-2003-03-31 Andrei Zmievski <andrei@gravitonic.com>
-
- * zend.h
- zend_compile.c
- zend_compile.h
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l
- zend_opcode.c:
- Multi-purpose patch:
- - The fields of zend_namespace were not completely initialized which
- led to a variety of problems.
- - The occurrence of class/interface/namespace definition is now
- captured.
- - Functions/classes/interfaces/namespaces can be preceded by doc
- comments which are stored for use by extensions.
-
-2003-03-31 Stanislav Malyshev <stas@zend.com>
-
- * zend.c:
- Use strncpy instead of sprintf
-
-2003-03-30 Andrei Zmievski <andrei@gravitonic.com>
-
- * zend_language_parser.y:
- Since zend_do_begin_class_member_function_call assumes the previous
- opcode is FETCH_CONSTANT, swap the calls around.
-
-2003-03-30 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_execute.c:
- ZTS fix.
-
-2003-03-30 Stanislav Malyshev <stas@zend.com>
-
- * zend.c:
- Try to report class name of the exception
-
- * zend_execute.c:
- Fix namespace switch
-
-2003-03-29 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Add missing initialization
-
- * zend_compile.c:
- Fix crash
-
- * zend_API.c
- zend_compile.c
- zend_compile.h:
- Initial support for enforcing prototype of abstract/interface method
- implementations
-
-2003-03-29 Sterling Hughes <sterling@bumblebury.com>
-
- * zend.c:
- remove unused variable
-
-2003-03-27 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c:
- fix fetch_class buglet
-
-2003-03-26 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c
- zend_language_parser.y:
- Un-nest namespaces - now namespace X { namespace Y {} } is a parse error
- Also refine namespaced includes
-
-2003-03-26 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_compile.c:
- Fixed bug #22900 (declaration of namespaces with same name results in
- leaks).
-
-2003-03-26 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend.c
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c
- zend_operators.h:
- Eliminate TSRMLS_FETCH() calls in destroy_op_array() and
- zend_get_class_entry().
-
- * zend_API.c
- zend_object_handlers.c
- zend_objects.c
- zend_objects.h:
- Eliminate TSRMLS_FETCH() calls in zend_objects_new() and
- zend_objects_get_address().
-
-2003-03-25 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Temporarily fix problem with inheriting from an internal class. This
- might
- - need some rework in the future (thanks to Marcus)
-
-2003-03-24 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c:
- Fix {include|require}_once error message - if open
- fails, don't use tream, use original name.
-
-2003-03-23 Andi Gutmans <andi@zend.com>
-
- * zend.c:
- - Fix win32 build
-
-2003-03-23 Stanislav Malyshev <stas@zend.com>
-
- * zend.c:
- resore namespace on shutdown - since some functions use
- EG() and CG() pointers
-
-2003-03-23 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_default_classes.c:
- ZTS fix.
-
-2003-03-23 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Another fix for implicit public, perhaps it was not such a good idea :I
-
-2003-03-23 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * Zend.dsp
- ZendTS.dsp
- zend_default_classes.c:
- Add new files to ZendTS.dsp. Sync list of files in Zend.dsp with
- ZendTS.dsp. ZTS fixes.
-
-2003-03-23 Sterling Hughes <sterling@bumblebury.com>
-
- * zend_default_classes.h:
- DEFAULT_CLASSES_H not DEFAULT_INTERFACES_H
-
- * Makefile.am
- zend.c
- zend_default_classes.c
- zend_default_classes.h:
- add a standard Exception class.
-
-2003-03-22 Shane Caraveo <shane@caraveo.com>
-
- * zend_compile.h:
- export functions needed by cli
-
- * zend_language_scanner.l:
- fix crash in win32 debug build
-
-2003-03-20 Stanislav Malyshev <stas@zend.com>
-
- * Zend.m4:
- Add stdlib.h too - it is needed fot strto{ld}
-
-2003-03-19 Andrei Zmievski <andrei@gravitonic.com>
-
- * zend_compile.c
- zend_compile.h
- zend_globals.h
- zend_highlight.c
- zend_language_parser.y
- zend_language_scanner.l:
- - Keep track of starting/ending line numbers for user functions.
- - Store last parsed doc comment in a compiler global for future use.
-
- * zend_API.c:
- Lowercase the function name when used as key in the function name. The
- original case is still preserved in zend_function structure.
-
-2003-03-18 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_object_handlers.c:
- - Fix situation where a derived class declares a public (or implicit
- public)
- with the same name as a private in the parent
- - Optimize 'static binding' of private properties a bit
-
-2003-03-18 Stig Bakken <ssb@fast.no>
-
- * RFCs/002.txt:
- - email address change
-
-2003-03-17 Stanislav Malyshev <stas@zend.com>
-
- * zend_extensions.c:
- MFZE1
-
-2003-03-17 Jani Taskinen <sniper@iki.fi>
-
- * Makefile.am:
- Added missing zend_mm.c file and renamed zend_object_API.c ->
- zend_objects_API.c
-
-2003-03-13 Andrei Zmievski <andrei@gravitonic.com>
-
- * zend_API.c:
- Fix warning in va_start().
-
-2003-03-12 Andrei Zmievski <andrei@gravitonic.com>
-
- * zend_API.c:
- Initialize the namespace when registering functions.
-
-2003-03-12 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Fix a crash bug in the implicit public declaration
-
-2003-03-11 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c
- zend_object_handlers.c:
- Fix handling of ::func()
-
-2003-03-10 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Clean redundant code
-
-2003-03-10 Jani Taskinen <sniper@iki.fi>
-
- * zend_compile.c:
- Fixed some leaks. Patch by Moriyoshi
-
-2003-03-10 Shane Caraveo <shane@caraveo.com>
-
- * zend_config.w32.h:
- fix isinf for win32
-
-2003-03-09 Zeev Suraski <zeev@zend.com>
-
- * zend_language_parser.y:
- Optimize
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y:
- Fix handling of ::foo
-
- * zend_compile.c:
- Cleanup
-
-2003-03-09 Andi Gutmans <andi@zend.com>
-
- * zend_language_scanner.l:
- - Nuke junk
-
-2003-03-09 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y:
- Fix parsing rules of namespaces/classes
-
- * zend_language_parser.y:
- Add ability to use ::interface_name in implements
-
- * zend_compile.c:
- Fix :: handling
-
-2003-03-07 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES:
- Dedicated to Greg Beaver <greg@chiaraquartet.net>.
-
- * ZEND_CHANGES:
- Document 'final'.
-
- * ZEND_CHANGES:
- Fix class type hints example.
-
- * ZEND_CHANGES:
- Update 'abstract' section.
-
-2003-03-07 Jani Taskinen <sniper@iki.fi>
-
- * zend_ini.c
- zend_ini.h:
- Renamed OnUpdateInt -> OnUpdateLong to prevent further misunderstandings.
-
- * zend_execute.c:
- Better fix for the memleaks (bug 19943) by Moriyoshi
-
-2003-03-06 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_execute.c:
- Fix warnings
-
- * zend_execute.c:
- Fix error message
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y:
- Require abstract classes to be explicitly declared 'abstract', in order to
- avoid making developers traverse the entire class/interface hierarchy
- before they can figure out whether a class is instantiable
- (ok, so it makes sense :)
-
-2003-03-06 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES:
- -german+english+.
-
- * ZEND_CHANGES:
- D some TBDs
-
-2003-03-06 Jani Taskinen <sniper@iki.fi>
-
- * zend_execute.c:
- Fixed bug #19943 (the memleaks)
-
-2003-03-06 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_highlight.c:
- More cleanup of the zend_strip() function.
- No longer strip __LINE__, since while it may become useless it could break
- code where __LINE__ is passed as a function parameter.
-
- * zend_highlight.c:
- Fixed in zend_strip() that corrupted heredoc.
- Optimized the writing routine by moving from putchar() to fwrite().
- Changed hardcoded opcode # to it's defined name.
-
-2003-03-06 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c:
- Change opcode name
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y:
- Add class type hints
-
-2003-03-05 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Fix auto globals
-
- * zend_compile.c
- zend_execute.c
- zend_language_parser.y:
- Implement $obj::static_func()
-
- * zend.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l
- zend_opcode.c
- zend_operators.c
- zend_operators.h:
- Add support for interfaces
-
-2003-03-04 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_language_parser.y:
- Remove legacy code
-
- * zend_compile.c:
- Remove redundant code
-
-2003-03-03 Harald Radi <harald.radi+coding.php@nme.at>
-
- * zend_API.c:
- add missing strtolower
-
- * zend_API.c
- zend_API.h:
- commiting zend_disable_class patch for George:
- disabled classes will be replaced by dummy classes
- that print a warning upon instanciation
-
-2003-03-02 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c:
- Fix destructors some more
-
- * zend_compile.c
- zend_compile.h:
- Improve infrastructure
-
- * zend.c
- zend_compile.c
- zend_compile.h:
- Add infrastructure for JIT initialization of auto globals
-
-2003-03-01 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Fix mem leak
-
-2003-03-01 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Make __construct() have higher priority than class name functions
- - for constructors.
- - Fix problem with the engine allowing final/abstract for the same method.
- - Both patches are by Marcus Börger.
-
-2003-02-27 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * zend_ini_scanner.l:
- MFB: We know ini file scanning will never be interactive, so speed it up a
- bit. Need a dynamic check for the language scanner.
-
-2003-02-26 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES:
- Syntactic sugar is sweet.
-
-2003-02-25 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Get the bits right - final/private fix
-
-2003-02-25 Jani Taskinen <sniper@iki.fi>
-
- * acconfig.h:
- Do not redefine zend_isnan if it is already defined.
-
- * Zend.m4:
- - Fixed bug #14245 ('make install' fails on AIX when using --with-apxs).
-
-2003-02-24 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c:
- fix exception handling
-
-2003-02-24 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y
- zend_language_scanner.l:
- Add 'final'
-
-2003-02-24 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES:
- Remove obsolete not on redeclaring protected members.
-
- * ZEND_CHANGES:
- Leftover.
-
- * ZEND_CHANGES:
- Initial documentation of namespace {}.
-
-2003-02-23 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Move abstract inheritance logic to the right spot
-
- * zend_compile.c:
- Fixed abstract handling in inheritence
-
-2003-02-20 Wez Furlong <wez.php@thebrainroom.net>
-
- * zend_stream.c:
- -cough*
- Fix another stupid mistake.
-
-2003-02-20 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y
- zend_opcode.c:
- Allow namespaces to have a number of parts. I.e., now you can do:
- namespace foo {
- function abc() {}
- }
- ...
- namespace foo {
- functio def() {}
- }
-
-2003-02-19 Wez Furlong <wez.php@thebrainroom.net>
-
- * zend_stream.c:
- Fix stupid mistake that only affected interactive mode.
-
-2003-02-18 Rasmus Lerdorf <rasmus@lerdorf.com>
-
- * zend_stream.c:
- fileno() needs a FILE * here, and at least on FreeBSD with gcc-2.95.3
- it is unable to figure out that this is indeed a FILE * and hence it
- won't compile without this cast.
-
-2003-02-18 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_scanner.l
- zend_opcode.c:
- Avoid using a C++ reserved word
-
-2003-02-18 Wez Furlong <wez.php@thebrainroom.net>
-
- * ZendTS.dsp
- flex.skl:
- Fixup build for win32
-
- * Makefile.am
- flex.skl
- zend.c
- zend.h
- zend_compile.h
- zend_execute.c
- zend_globals.h
- zend_ini_scanner.l
- zend_language_scanner.h
- zend_language_scanner.l
- zend_stream.c
- zend_stream.h:
- Implement simple stream support in the ZE scanners.
-
-2003-02-17 Zeev Suraski <zeev@zend.com>
-
- * zend_language_parser.y:
- Whitespace & minor renames
-
- * zend_language_parser.y:
- whitespace
-
- * zend_execute.c
- zend_object_handlers.c
- zend_object_handlers.h:
- Improve handling of static member variables
-
- * zend_config.w32.h
- zend_ini_parser.y:
- Improve Win32 build performance
-
-2003-02-16 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- Fix complex cases of self-assignments (bugs #21600, #22231)
-
- * zend_execute.c:
- Make EG(This) and EG(scope) available to internal methods
-
- * zend_execute.c:
- Revert patches - they weren't ready yet!
-
- * zend.c:
- Fix initialization
-
-2003-02-16 Georg Richter <georg.richter@phpev.de>
-
- * zend_execute.c:
- fixed compiler warning
-
- * zend_execute.c:
- tested patch from Zeev (fixes oo-bug in ext/mysqli)
-
-2003-02-16 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c
- zend_language_parser.y:
- add support for ::foo syntax meaning "global one"
-
- * zend_compile.c:
- remove debug prints
-
-2003-02-16 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend.c
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c:
- ZTS fixes
-
-2003-02-16 Stanislav Malyshev <stas@zend.com>
-
- * zend_object_handlers.c:
- namespace patch - static variable access
-
- * zend.c
- zend.h
- zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l
- zend_opcode.c:
- Namespace patch. Big changes:
- 1. Nested classes are gone.
- 2. New syntax for namespaces:
- namespace foo {
- class X { ... }
- function bar { ... }
- var x = 1;
- const ZZ = 2;
- }
- 3. Namespaced symbol access: $x = new foo::X; - etc.
- For now, namespaces are case insensitive, just like classes.
- Also, there can be no global class and namespace with the same name
- (to avoid ambiguities in :: resolution).
-
-2003-02-15 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_ini_scanner.l:
- Added feature #19645 (ini parser can now handle quoted multi-line values).
-
-2003-02-14 Thies C. Arntzen <thies@thieso.net>
-
- * zend_execute_API.c:
- init current_execute_data befor we start executing
-
- * Makefile.am:
- ups
-
- * Makefile.am:
- add really nice dump_bt function for debugging in gdb
-
-2003-02-13 Zeev Suraski <zeev@zend.com>
-
- * zend_object_handlers.c:
- Fix error handling in illegal property access
-
-2003-02-13 Harald Radi <harald.radi+coding.php@nme.at>
-
- * zend_language_scanner.l:
- MFB PHP_4_3
-
-2003-02-12 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_API.c
- zend_API.h:
- Removed zend_get_module(), this function is not used by anything and more
- importantly. it does not work. It tries to find data based on numeric keys
- in hash table using string keys.
-
-2003-02-12 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Fix declaration of class members that don't have an explicit access
- modifier
-
-2003-02-11 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Fix require() handling - that's an old bug!
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y:
- Improve parser handling of 'abstract'
-
-2003-02-10 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Fix zend_initialize_class_data()
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_compile.h:
- Centralize class initialization
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y:
- - Treat $this->foo inside class X as an implicit 'public $foo' if X::$foo
- is not explicitly declared
- - Forbid multiple declaration of the same variable
-
- * zend_execute.c:
- whitespace
-
- * zend_API.c
- zend_compile.c:
- Add missing destructors
-
-2003-02-10 Stanislav Malyshev <stas@zend.com>
-
- * zend_object_handlers.c:
- update static constants too
-
-2003-02-10 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c:
- Fix get_parent_class()
-
- * zend_object_handlers.c:
- Restore missing check
-
- * zend_execute.c
- zend_execute_API.c:
- Add ability to reference self:: and parent:: in constant initializers
- (bug #21849)
-
- * zend_execute.c:
- Remove redundant code
-
-2003-02-09 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- Fix the array() problem (and probably some other problems too)
-
-2003-02-08 Georg Richter <georg.richter@phpev.de>
-
- * zend_API.c
- zend_API.h:
- fixed zend_parse_method_param
-
-2003-02-08 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_builtin_functions.c:
- zend_config.h (and its Win32 version) is already included by zend.h
-
-2003-02-08 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_builtin_functions.c:
- The string.h is already avaliable through zend.h, so the manual inclusion
- is not necessary.
-
-2003-02-07 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_builtin_functions.c:
- Added a check to ensure that string.h is avaliable before trying to use it.
-
- Thanks Andi.
-
- * zend_builtin_functions.c:
- Added missing header.
-
-2003-02-07 Zeev Suraski <zeev@zend.com>
-
- * zend_globals.h
- zend_object_handlers.c:
- Improve PPP handling of properties
-
- * zend_config.w32.h:
- Better fix
-
- * zend_config.w32.h:
- Fix Windows build
-
-2003-02-07 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_builtin_functions.c:
- Fixed bug #15734 (Added an optional parameter to get_defined_constants(),
- which if passed, will include information regarding who created the
- constant).
-
-2003-02-06 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_builtin_functions.c:
- Fixed bug #19506 (get_extension_funcs() can now retrieve a list of built-in
- Zend Engine functions, if "zend" is specified as the module name).
- Made get_extension_funcs() on failure.
-
-2003-02-06 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Fix the 2nd buglet in the error message :)
-
- * zend_object_handlers.c:
- Fix check
-
- * zend_hash.c
- zend_hash.h:
- Fix prototype (may have caused stack corruption)
-
-2003-02-05 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c
- zend_object_handlers.c
- zend_object_handlers.h
- zend_objects_API.c:
- - read_property cleanup
- - Implement unset/isset/empty for PPP
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_execute.c
- zend_object_handlers.c
- zend_object_handlers.h
- zend_opcode.c:
- Rework static class properties - now supports access restrictions
-
- * zend_hash.c
- zend_hash.h:
- Add quick_exists()
-
- * zend_object_handlers.c:
- Add PPP support for arrays
-
- * zend_compile.c:
- Fix buglet in error message
-
-2003-02-04 Zeev Suraski <zeev@zend.com>
-
- * zend_object_handlers.c:
- Missing update
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_globals.h
- zend_hash.c
- zend_hash.h
- zend_object_handlers.c
- zend_opcode.c
- zend_ts_hash.c
- zend_ts_hash.h:
- Reimplement PPP properties
-
-2003-02-03 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_API.h:
- Build fix.
-
-2003-02-02 Harald Radi <harald.radi+coding.php@nme.at>
-
- * zend_API.c
- zend_API.h:
- extend the parameter parsing API by two functions
- for parsing method parameters with automatic
- detection if the function was called as such or as
- a class method (with a valid this ptr).
- if called as a function the first parameter has to be
- the object it is operating on, if called as a method
- this is used.
-
-
-2003-02-02 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_operators.h:
- whitespace
-
- * zend_execute.c
- zend_object_handlers.c
- zend_object_handlers.h:
- Core rearrangements - move Zend Objects specific code to their
- specific implementation file
-
-2003-02-02 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Fix warning
-
-2003-02-01 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_ini_scanner.l
- zend_language_scanner.l:
- Fix build.
-
-2003-02-01 Jani Taskinen <sniper@iki.fi>
-
- * acconfig.h
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_builtin_functions.h
- zend_compile.c
- zend_compile.h
- zend_config.nw.h
- zend_config.w32.h
- zend_constants.c
- zend_constants.h
- zend_dynamic_array.c
- zend_dynamic_array.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_execute_locks.h
- zend_extensions.c
- zend_extensions.h
- zend_fast_cache.h
- zend_globals.h
- zend_globals_macros.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_ini.c
- zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.h
- zend_ini_scanner.l
- zend_istdiostream.h
- zend_language_parser.y
- zend_language_scanner.h
- zend_language_scanner.l
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_mm.c
- zend_mm.h
- zend_modules.h
- zend_object_handlers.c
- zend_object_handlers.h
- zend_objects.c
- zend_objects.h
- zend_objects_API.c
- zend_objects_API.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_qsort.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_static_allocator.c
- zend_static_allocator.h
- zend_ts_hash.c
- zend_ts_hash.h
- zend_types.h
- zend_variables.c
- zend_variables.h:
- - Added some missing CVS $Id$ tags, headers and footers.
-
-2003-01-30 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_operators.c:
- Fixed compiler warning regarding signed/unsigned int comparisons.
-
-2003-01-30 Harald Radi <harald.radi+coding.php@nme.at>
-
- * zend_ts_hash.c
- zend_ts_hash.h:
- fix non-zts build for wez
-
-2003-01-30 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_execute_API.c:
- Fix ZTS build.
-
-2003-01-29 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.h
- zend_execute_API.c
- zend_opcode.c:
- Add additional stage to post-session cleanup.
- We need separate cleanup stage because of the following problem:
- Suppose we destroy class X, which destroys function table,
- and in function table we have function foo() that has static $bar. Now if
- object of class X was assigned to $bar, its destructor will be called and
- will
- fail since X's function table is in mid-destruction.
- So we want first of all to clean up all data and then move to tables
- destruction.
- Note that only run-time accessed data need to be cleaned up, pre-defined
- data can not contain objects and thus are not probelmatic.
-
-2003-01-29 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c
- zend_object_handlers.c:
- Code rearrangements
-
-2003-01-29 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute_API.c:
- Fix object destructors:
- zend_objects_store_call_destructors is not used anymore, we rely on
- symbol tables cleaners to destroy all objects.
-
- * zend_objects_API.c:
- extra safety
-
- * zend_compile.c:
- fix memory leak
-
-2003-01-29 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c
- zend_object_handlers.c:
- Fix assignments to $this.
- Fixes the 'make install' problem reported on php-dev
-
-2003-01-28 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Fix a ticks related crash
-
- * (PHP_5_0_dev_before_13561_fix)
- zend_execute.c:
- Allow methods in parent classes to call protected methods in derived
- classes
-
-2003-01-27 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c:
- Replace MAKE_VAR opcode with special 'data' opcode
- This opcode is not executeable but only holds data for opcodes
- that need more than two arguments (presently only ASSIGN_OBJ and the ilk
- but
- in the future also ASSIGN_DIM)
-
-2003-01-26 Sascha Schumann <sascha@schumann.cx>
-
- * zend_API.c:
- Replace snprintf() call using zend_error's capabilities
-
-2003-01-23 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- Let the scope propagate to internal functions
-
-2003-01-23 Jani Taskinen <sniper@iki.fi>
-
- * zend_execute_API.c:
- Fixed bug: #14542, register_shutdown_function() timeout problem
-
-2003-01-22 Stanislav Malyshev <stas@zend.com>
-
- * OBJECTS2_HOWTO:
- some small refinements for get_class_*
-
-2003-01-22 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_execute.c:
- Fixed bug #21814 (Allow booleans to be used as array keys).
-
-2003-01-21 Sterling Hughes <sterling@bumblebury.com>
-
- * zend_objects_API.c:
- fix by phanto to the cloning
-
-2003-01-19 Zeev Suraski <zeev@zend.com>
-
- * Zend.m4:
- relabel
-
-2003-01-19 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c:
- Restore for now old statics behaviour (so that indirect $$var references
- would work again). Comprehensive fix will follow later.
-
-2003-01-19 Harald Radi <harald.radi+coding.php@nme.at>
-
- * zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.l:
- ini patch to allow 'entry[] = value' entries
-
-2003-01-17 Harald Radi <harald.radi+coding.php@nme.at>
-
- * zend_objects.c
- zend_objects.h:
- export zend_objects_destroy_object()
- static inline was meaningless anyways as the function
- was only used as a callback handler and was never
- called directly
-
- * zend_objects_API.c
- zend_objects_API.h:
- make std_object_handlers struct available for shared modules
-
-2003-01-16 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_execute.c:
- Fixed bug #20933 (isset/empty didn't work when used on string offsets).
-
-2003-01-15 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Revert int -> unsigned int change for str.len
-
-2003-01-15 Sascha Schumann <sascha@schumann.cx>
-
- * zend.h:
- Revert commit which turned the lengths of strings into zend_uint.
-
-2003-01-14 Andi Gutmans <andi@zend.com>
-
- * ZEND_CHANGES
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y
- zend_language_scanner.l
- zend_operators.c
- zend_operators.h:
- - Change "is" to "instanceof" as it explains better what the operator
- means.
- - "is_a" was also appropriate but ugly.
-
-2003-01-14 Stanislav Malyshev <stas@zend.com>
-
- * zend_API.c:
- fix memory leaks and key size
-
-2003-01-14 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_ini_parser.y:
- MFZE2
-
-2003-01-14 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c:
- fix warning
-
- * zend_API.c
- zend_API.h:
- Make add_property_ functions work via write_property handler
-
- * zend.c
- zend_object_handlers.c:
- ws
-
-2003-01-14 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_ini_parser.y:
- Reverting previous patch.
-
-2003-01-13 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_ini_parser.y:
- MFZE2
-
-2003-01-13 Andi Gutmans <andi@zend.com>
-
- * zend_objects_API.c:
- - Don't check if the handle is bogus. We should crash.
-
-2003-01-12 Harald Radi <harald.radi+coding.php@nme.at>
-
- * zend_modules.h:
- fix wrong dereferenciation
-
-2003-01-12 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c:
- fix inheritance
-
- * zend_API.h:
- Remove handle_property from here too
-
- * zend.c
- zend.h
- zend_compile.c:
- RIP handle_* functions. ZE2 will use __ handlers instead.
-
- * zend_object_handlers.c:
- Move Z_OBJ_P here.
-
- * zend_operators.h:
- Remove Z_OBJ - it's internal to Zend objects, no generic function except
- those in zend_object_handlers.c should use it.
- Add Z_OBJ_HANDLER macro for easy access to handlers
-
-2003-01-12 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend.c
- zend.h
- zend_builtin_functions.c:
- ZTS fixes.
-
-2003-01-12 Stanislav Malyshev <stas@zend.com>
-
- * zend_object_handlers.c:
- add get_class_name handler
-
- * zend.c:
- Use generic handlers instead of Z_OBJ
-
-2003-01-12 Harald Radi <harald.radi+coding.php@nme.at>
-
- * zend_modules.h:
-
-
- * zend_ini.h
- zend_ini_entry.h
- zend_modules.h:
- partially revert previous commit and
- change zend_modules.h to include
- a forward declaration to zend_ini_entry
-
- * zend_ini.h
- zend_ini_entry.h
- zend_modules.h:
- added zend_ini_entry to zend_modules_entry as
- discussed with zeev
-
- * zend_builtin_functions.c:
- fix 'use of uninitialized variable' warning
-
-2003-01-12 Stanislav Malyshev <stas@zend.com>
-
- * zend_objects_API.c:
- validate handle
-
-2003-01-12 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_ini.c
- zend_ini.h
- zend_variables.c:
- Implemented compatibility mode
- To enable - zend2.implicit_clone = on in php.ini or using ini_set()
-
-2003-01-11 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix typo and whitespace
-
-2003-01-11 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c:
- - Ported the zend_execute_internal hook to ZendEngine2.
-
-2003-01-11 Harald Radi <harald.radi+coding.php@nme.at>
-
- * zend_ts_hash.c:
- freed reader twice instead of writer and reader
-
-2003-01-10 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_alloc.c:
- MFZE2
-
-2003-01-10 Andrei Zmievski <andrei@gravitonic.com>
-
- * zend_API.c:
- Automatically register constructor, destructor, and clone function when
- class methods are registered.
-
-2003-01-09 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Found some more occurences of that elusive bug...
-
- * zend_compile.c:
- Fix one lousy, annoying lurking bug (memory corruption)
- Sebastian - try coWiki again please...
-
- * zend_API.h:
- Unify and make it easy to add code into the broken-string error handler
-
- * zend_language_parser.y:
- Fix writability checks
-
- * zend.c:
- Fix leak
-
-2003-01-08 James Cox <james@imajes.info>
-
- * zend.h:
- cvs is dev not alpha.
-
-2003-01-08 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_builtin_functions.c:
- MFZE2
-
-2003-01-05 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_globals.h
- zend_language_scanner.l:
- MFZE1 - lineno fix
-
-2003-01-02 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c:
- Fix incorrect linkage of access-levels, when using private methods
-
-2003-01-01 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c
- zend_operators.h:
- Win32 build fix
-
-2003-01-01 Stanislav Malyshev <stas@zend.com>
-
- * zend_operators.h:
- use handler for Z_OBJPROP
-
-2003-01-01 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c:
- Fix Wez's problem
-
-2002-12-31 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * LICENSE
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_builtin_functions.h
- zend_compile.c
- zend_compile.h
- zend_config.nw.h
- zend_config.w32.h
- zend_constants.c
- zend_constants.h
- zend_dynamic_array.c
- zend_dynamic_array.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_fast_cache.h
- zend_globals.h
- zend_globals_macros.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_ini.c
- zend_ini.h
- zend_language_scanner.h
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_mm.c
- zend_mm.h
- zend_modules.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_qsort.c
- zend_qsort.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_static_allocator.c
- zend_static_allocator.h
- zend_ts_hash.c
- zend_ts_hash.h
- zend_types.h
- zend_variables.c
- zend_variables.h:
- Bump year.
-
-2002-12-31 Stanislav Malyshev <stas@zend.com>
-
- * zend_object_handlers.h:
- fix level of indirection
-
-2002-12-30 Andrei Zmievski <andrei@gravitonic.com>
-
- * zend_execute_API.c:
- Adjust the error message.
-
-2002-12-30 Stanislav Malyshev <stas@zend.com>
-
- * zend_object_handlers.h:
- Oops, fix it indeed
-
- * zend_object_handlers.h:
- Better check
-
-2002-12-26 Andrei Zmievski <andrei@gravitonic.com>
-
- * zend_compile.c:
- do_inherit_method_check() is supposed to return 0 or 1, not SUCCESS or
- FAILURE.
-
-2002-12-14 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_language_scanner.l:
- MFZE2
-
-2002-12-10 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Fix check to allow for static+access level modifiers
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y:
- - Allow variables to have both 'static' modifier and an access level.
- NOTE: This only works at the syntax level right now (parser). It
- doesn't actually work as of yet - all statics are considered
- public for now
- - Prevent users from putting more restrictions on methods in derived
- classes
- (i.e., you cannot make a public method private in a derived class, etc.)
-
-2002-12-09 Andi Gutmans <andi@zend.com>
-
- * zend_mm.c:
- - Fix a bug which I just introduced.
-
- * zend_mm.c:
- - Fix typo
-
- * zend_mm.c:
- - Improvements
-
- * zend_mm.c
- zend_mm.h:
- - First attempt to improve memory manager during realloc()'s
-
-2002-12-08 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Remove comment
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y:
- Treat the absence of an access type just as if 'public' was supplied
-
- * zend_compile.c:
- Simplify/fix inheritance checks
-
- * zend_execute.c:
- Support private/protected constructors
-
-2002-12-07 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES:
- Update.
-
-2002-12-07 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- Fix error messages
-
- * zend_language_parser.y
- zend_language_scanner.l:
- Remove unintentional code
-
-2002-12-07 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Dissallow using parent, self and main as class names
-
-2002-12-06 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_globals.h
- zend_hash.h
- zend_language_parser.y
- zend_language_scanner.l:
- - Implement public/protected/private methods.
- - Prevent instantiation of classes with abstract methods.
- Based in part on Marcus's patch.
-
-2002-12-01 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c:
- - Allow enabling of memory cache with zend_mm
-
- * zend.c
- zend.c
- zend.h
- zend.h
- zend_builtin_functions.c
- zend_builtin_functions.c:
- - MFZE1
-
- * zend.c
- zend.h
- zend_builtin_functions.c:
- - Revert as the patch doesn't compile
-
- * zend.c
- zend_API.c
- zend_builtin_functions.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_indent.c
- zend_object_handlers.c
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_variables.c:
- h WHitespace
-
- * zend.c:
- - Initialize constants_updated (by Marcus)
-
- * zend_builtin_functions.c:
- - Nuke use of deprecated macro
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y:
- - FN_IS_STATIC -> FN_STATIC
-
- * zend.c:
- - Fix crash
-
- * zend_compile.c
- zend_compile.h:
- - My personal cleanups
-
- * zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_language_parser.y
- zend_object_handlers.c:
- - Commit Marcus' cleanup of abstract and static inheritance and improve
- - error messages
-
-2002-11-22 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_API.c:
- - Initialize all functions to non-static (patch by Marcus Börger
- <marcus.boerger@t-online.de>.
-
-2002-11-22 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_execute.c:
- Show class name as well. Patch by Marcus Börger.
-
- * zend_execute.c:
- Show the name of the abstract method in the error.
-
- * zend_compile.h:
- Fix prototype.
-
-2002-11-20 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_builtin_functions.c:
- - MFZE1: Disable leak() and crash() when not using debug mode
-
-2002-11-20 Andi Gutmans <andi@zend.com>
-
- * ZEND_CHANGES:
- - Add abstract methods
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y
- zend_language_scanner.l:
- - Fix build (thanks Marcus)
- - Implement abstract methods, syntax:
- - abstract function foo($vars);
- - I don't see any reason why modifiers such as static/public need to be
- - used with abstract. PHP is weakly typed and there would be no meaning to
- - this anyway. People who want a strictly typed compiled language are
- - looking in the wrong place.
-
-2002-11-19 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_builtin_functions.c
- zend_execute.c
- zend_execute_API.c:
- MFZE1 - error_reporting fix
-
-2002-11-18 Andi Gutmans <andi@zend.com>
-
- * zend_language_scanner.l:
- - MFZE1
-
-2002-11-17 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c:
- fix the leak
-
-2002-11-16 Andi Gutmans <andi@zend.com>
-
- * zend_language_scanner.l
- zend_language_scanner.l:
- - MFZE1
-
- * Zend.m4
- configure.in:
- - MFZE1
-
- * zend_hash.c:
- - Commit fix for bug #19566 (I think it's by Marcus :)
-
-2002-11-14 Andrei Zmievski <andrei@gravitonic.com>
-
- * zend_llist.h:
- MFZE1
-
-2002-11-13 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c:
- semi-fix string offsets crash - now it doesn't crash, but still leaks
-
- * zend_object_handlers.c:
- fix static
-
-2002-11-11 Andi Gutmans <andi@zend.com>
-
- * ZEND_CHANGES:
- - Update with statics
-
-2002-11-11 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_execute.c:
- Fugbix typo.
-
-2002-11-11 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend.h:
- MFZE1
-
-2002-11-10 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - MFZE1
-
-2002-11-10 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y:
- fix statics - make it behave like $this (fetch type "static")
- Side effect: indirect references to statics won't work.
-
-2002-11-06 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_execute.c:
- Fix ZTS build.
-
-2002-11-06 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c:
- fix zend_assign_to_object_op
-
-2002-11-05 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_language_scanner.l:
- MFZE1
-
-2002-11-05 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h:
- - Shift around zend_op members
-
- * ZEND_CHANGES:
- - A couple of updates
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y:
- - Add support for static methods. Basically methods which are defined as
- - static don't have $this. That's the whole difference.
-
- * tests/zend2.php:
- - $clone -> $that
-
- * zend_execute_API.c:
- - Fix bug introduced with type change of free_op1/2
-
- * zend_language_parser.y
- zend_language_scanner.l:
- - ATTENTION: Finally nuke old_function and cfunction. I think it is time
- - to get rid of these BC notations. This is from the days of the move from
- - PHP/FI 2 -> PHP 3
-
-2002-11-05 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_hash.c:
- Revert of previous patch.
-
-2002-11-05 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_objects.c:
- - Change the automatically created variable $clone in __clone() to
- - $that as discussed at the PHP Conference. If there are any objections
- - alternative names please let me know. The reason for changing it from
- - $clone is because $clone sounds as if it's the newly cloned object and
- - not the old one.
-
-2002-11-05 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c
- zend_compile.h:
- avoid using 'class' in exported functions - it annoys c++
-
-2002-11-05 Stig Bakken <ssb@fast.no>
-
- * zend.c:
- Fixed some special cases that were crashing for the exception default
- handler.
-
-2002-11-04 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_compile.c:
- Silence compiler warnings.
-
- * zend_hash.c:
- If ordered is not set a random compiler assigned value of *p2 would be
- used,
- this patch fixes the problem by initializing *p2 to NULL.
-
- * zend_operators.c:
- Silence compile warning, ctype.h is needed for tolower() function.
-
- * zend_language_scanner.l:
- MFZE1
-
-2002-11-02 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_language_scanner.l:
- - Fix segfault when __CLASS__ was used outside a class definition
-
- * zend.c:
- - MFZE1
-
-2002-11-02 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_language_scanner.l:
- MFZE1 (20214).
-
-2002-11-01 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fix unset($this->foo)
-
-2002-10-24 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_opcode.c: - Also tune jmpz_ex
-
- * zend_execute.c
- zend_opcode.c
- zend_compile.h:
- - Improve performance of part of the jmps. More to follow.
-
-2002-10-23 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_compile.c:
- - This might improve performance. Commiting it so that I can check it on
- - Linux
-
- * zend_execute.c:
- - Make Ts access a macro. I need this for my next patch which should
- - improve performance but not sure yet if it will.
-
-2002-10-22 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Nuke unused get_incdec_op()
- - Nuke old comment
-
- * zend_compile.h
- zend_execute.c
- zend_globals.h: - Improve overall engine performance
-
- * zend_execute.c: - Fix bug reported by Daniel T. Gorski
-
-2002-10-21 Thies C. Arntzen <thies@thieso.net>
-
- * zend_builtin_functions.c: MFZE1
-
-2002-10-20 Stanislav Malyshev <stas@zend.com>
-
- * zend_object_handlers.c: looks like this message should go
-
- * zend_compile.c: Fix private handling
-
-2002-10-20 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_highlight.c
- zend_highlight.h: Sync zend_html_puts parameter list with Zend Engine 1.
-
-2002-10-19 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h: - Fix compile warning.
-
- * zend_opcode.c
- zend_compile.h
- zend_execute.c: - Improve opcode dispatching
-
-2002-10-18 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend_compile.c
- zend_execute.c:
- - Change opcode dispatch mechanism to use a function per opcode and use
- - a lookup table using the opcode # to call the correct function.
- - Still have lots of tuning to do.
-
- * zend_execute.c: - Cleanup
-
-2002-10-16 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_execute.c: Fix ZTS build.
-
-2002-10-16 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c
- zend_execute.c: Fix class static members: now the following code works:
- <?php
-
- class Foo {
- static $c = "Parent";
- }
-
- class Child extends Foo {
- }
-
- Foo::$c = "Hello";
-
- var_dump(Child::$c);
- ?>
- and returns "Hello" (class statics are not copied anymore, but looked up in
- runtime)
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c: Fix and generalize $this handling.
- ZEND_FETCH_FROM_THIS is removed, IS_UNUSED type on class variables will be
- used instead as the sign that it's a fetch from $this
-
-2002-10-14 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_ini_parser.y
- zend_ini_scanner.l
- zend_globals.h: MFZE1
-
-2002-10-14 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_language_parser.y: - Support new classname::$class_name, e.g.:
- <?
-
- class foo::bar {
- public $hello = "Hello, World\n";
- }
-
- $name = "bar";
- $obj = new foo::$name;
- print $obj->hello;
- ?>
-
-2002-10-13 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_extensions.h: Increased the API number. (re: floats patch)
-
-2002-10-12 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_operators.c
- zend_operators.h
- zend.c
- zend_execute_API.c
- zend_globals.h: MFZE1 (floats & locale issue)
-
-2002-10-10 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Fugbix typo.
-
-2002-10-10 Stanislav Malyshev <stas@zend.com>
-
- * zend_object_handlers.c: add comment
-
- * zend_object_handlers.c: fix memory leaks
-
-2002-10-09 Stanislav Malyshev <stas@zend.com>
-
- * zend_object_handlers.c: Fix object write handler behaviour:
- * If this value is already set to given value, don't try to set it again.
- * If we have reference, we should not move it.
- * If we are assigning referenced variable, we should separate it.
-
-2002-10-09 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_API.c
- zend_builtin_functions.c
- zend_compile.c
- zend_constants.c
- zend_execute.c
- zend_execute_API.c
- zend_language_parser.y
- zend_object_handlers.c
- zend_operators.c
- zend_operators.h: MFZE1 zend_str_tolower issue.
-
-2002-10-07 Andi Gutmans <andi@zend.com>
-
- * tests/zend2.php: - Fix test
-
- * zend_execute.c:
- - Require $this-> when calling a methods. This whole automatic lookup
- - first in the class and then in the global scope is confusing, slow and
- - not quite BC compatible.
-
- * zend.c
- zend_compile.c
- zend_globals.h:
- - Allow access to private/protected variables of $clone inside the __clone()
- - method
-
-2002-10-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fix problem with unsetting object members.
-
-2002-10-01 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y:
- - Fix problem when crashing on illegal tokens in class name during class
- - definition.
-
-2002-09-30 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ZEND_CHANGES: - No tabs :)
-
-2002-09-28 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_builtin_functions.c: - Fix for defines...
-
- * zend_builtin_functions.c: - Fix build in non-ZTS mode
-
-2002-09-26 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_API.c
- zend_builtin_functions.c
- zend_compile.c
- zend_constants.c
- zend_execute.c
- zend_execute_API.c
- zend_language_parser.y
- zend_object_handlers.c
- zend_operators.c
- zend_operators.h: MFZE1
-
-2002-09-25 Stanislav Malyshev <stas@zend.com>
-
- * zend_extensions.h:
- Propmote API NO year, so that it will never be the same as ZE1 API NO
-
-2002-09-24 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Fix leak
-
- * zend_language_parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- - Megapatch to try and support inheritance from sub-classes. Things might
- - be *very* buggy now so don't get too upset if that happens.
- - I still need to improve some stuff but it's a good step (hopefully).
-
-2002-09-23 Andi Gutmans <andi@zend.com>
-
- * zend_globals.h
- zend_ini.c
- zend_language_parser.y: - MFZE1.
-
-2002-09-21 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.h: - Someone screwed this up.
-
-2002-09-19 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_ini.c: - Make Colin happy
-
-2002-09-19 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_execute_API.c: MFZE1 - connection_status() fix
-
- * zend.c: Fix non ZTS build
-
- * zend.c: Fix that obscure crash in Debug_TS mode
-
-2002-09-18 Zeev Suraski <zeev@zend.com>
-
- * zend.c:
- Fix the thread-safe initialization of the ZE2. This should solve some
- sporadic crashes, as well as the problem with the built-in constants.
-
- * zend_constants.c: Remove dead code
-
- * zend_builtin_functions.c: Add useful debugging function
-
-2002-09-17 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c
- zend_hash.h: Add tracking for hashtable allocation
-
- * zend.c: ZE2 fix
-
- * zend_compile.c: whitespace
-
- * zend.c
- zend.h: MFZE1 - threading fix
-
-2002-09-16 Andrei Zmievski <andrei@php.net>
-
- * zend_API.h
- zend_builtin_functions.c
- zend_API.c
- zend_execute_API.c: MFZE1
-
-2002-09-15 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_highlight.c: Make zend actually strip comments. Bug #18151
-
- * zend.c:
- Make zend return a proper exit error code when it encounters a parse error.
-
-2002-09-15 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Hopefully fix problem with __autoload not working well with inherited classes.
- - There might still be some weird situations I haven't thought of.
-
- * zend_list.c
- zend_execute.c: - WS fix - "while (" instead of "while("
-
- * zend_execute_API.c
- zend_ini.c
- zend_list.c
- zend_object_handlers.c
- zend_objects_API.c
- zend_operators.c
- zend_API.c
- zend_builtin_functions.c
- zend_compile.c
- zend_execute.c: - WS - Always use "if (" and not "if("
-
- * zend_execute_API.c: - WS
-
-2002-09-10 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute_API.c
- zend_variables.c: MFZE1
-
-2002-09-09 Stanislav Malyshev <stas@zend.com>
-
- * zend_object_handlers.c: remove comment
-
-2002-09-08 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Prepare for alpha 3
-
-2002-09-05 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c: quick-n-dirty inheritance support for __handlers
-
-2002-09-04 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Whitespace fixes.
-
-2002-09-04 Stanislav Malyshev <stas@zend.com>
-
- * zend_object_handlers.c: remove dead code
-
- * ZEND_CHANGES
- zend_object_handlers.c: Fix __call and add some docs
-
-2002-09-04 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_object_handlers.c: Fix ZTS build.
-
- * ZEND_CHANGES: TBD: __call(), __get(), __set().
-
-2002-09-04 Stanislav Malyshev <stas@zend.com>
-
- * zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_extensions.h
- zend_object_handlers.c
- zend_objects.c: Support for __get, __set and __call in classes.
- This should work as follows: if class hasn't member with given name,
- __get/__set is called. If class has no method with given name, __call is called.
- __get/__set are not recursive, __call can be.
-
-2002-09-04 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Workaround for superfluous comma in var_export() result.
-
- * ZEND_CHANGES:
- Let debug_backtrace() example print out the class name, if applicable, and the function/method arguments.
-
-2002-09-03 Thies C. Arntzen <thies@thieso.net>
-
- * zend_builtin_functions.c: nuke warning
-
- * zend_builtin_functions.c: nuke unneeded stuff
-
-2002-09-03 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_ini.c: MFZE1
-
-2002-09-03 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_ini.c: - Revert
-
- * zend_ini.c:
- - MFH for: Apply rest of html errors fix (Patch by Jan Lehnardt <jan@php.net>)
-
-2002-09-03 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend.h:
- Add html_errors to zend_utility_values. Patch by Jan Lehnardt <jan@php.net>.
-
-2002-09-03 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Fix typo
-
-2002-09-02 Thies C. Arntzen <thies@thieso.net>
-
- * zend_builtin_functions.c:
- refine last patch. if the argument-stack is not consistent don't try to show
- arguments. no call to zend_error is made as we might end up in an infinite
- recursion if called from an error_handler.
- so: if the arguments to functions aren't shown in debug_backtrace this is 'cause
- the arument stack was not consistent when debug_backtrace was called.
-
- * zend_builtin_functions.c:
- debug_backtrace() now checks the complete argument-stack for consistency.
-
-2002-09-02 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c: MFZE1
-
-2002-09-01 Andi Gutmans <andi@zend.com>
-
- * zend_llist.c: - Fix leak reported by "l0t3k" <cshmoove@hotmail.com>
-
-2002-09-01 Stanislav Malyshev <stas@zend.com>
-
- * zend_operators.c: MFZE1
-
-2002-08-28 Thies Arntzen <thies@pb1.pair.com>
-
- * zend_builtin_functions.c
- zend_execute_API.c: debug_backtrace()
- - make args passed to functions called vy call_user_function available again.
-
- * zend_builtin_functions.c: debug_backtrace():
- - make args work if called from the error_handler
- - fix refcount for args
-
- * zend.c:
- clear current_execute_data on bailout as it would point into some freed area
- on the stack.
-
-2002-08-28 derick <derick@pb1.pair.com>
-
- * zend.c: - MFZE1
-
-2002-08-26 Thies Arntzen <thies@pb1.pair.com>
-
- * zend_builtin_functions.c:
- debug_backtrace(): show name of included file for include and require calls
- plus some small fixes suggested by andi.
-
-2002-08-24 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_builtin_functions.c: - Whitespace
-
- * zend_builtin_functions.c: - Whitespace and better variable name
-
-2002-08-24 Thies Arntzen <thies@pb1.pair.com>
-
- * zend_builtin_functions.c: fix warning
-
-2002-08-23 Andi Gutmans <andi@pb1.pair.com>
-
- * Zend.m4: - Add \n to configure fprintf
-
- * zend_extensions.c: - dlerror -> DL_ERROR
-
-2002-08-23 Thies Arntzen <thies@pb1.pair.com>
-
- * zend_builtin_functions.c:
- debug_backtrace: show include/require/eval as normal functions on the stack
-
-2002-08-23 derick <derick@pb1.pair.com>
-
- * zend_builtin_functions.c: - No spaces :)
-
-2002-08-23 Thies Arntzen <thies@pb1.pair.com>
-
- * zend_builtin_functions.c:
- - debug_backtrace now also returns an array containing the arguments of the
- called function.
-
- zeev, andi - is knowing the structure of the stack considered a bad thing in
- zend_builtin_function? if yes i would have to create a new function in
- zend_ptr_stack.c (but i think we are save this way)
-
- * zend_builtin_functions.c
- zend_execute_API.c: - debug_backtrace:
- added "type" ('->' or '::') for object calls.
- made calls done thru call_user_func show-up correct in backtraces.
-
- andi,
- does this look correct to you?
-
- * zend_execute.c: those are set by RETURN_FROM_EXECUTE
-
-2002-08-21 Thies Arntzen <thies@pb1.pair.com>
-
- * zend_execute.c:
- zend_execute: make sure that current_execute_data points to the right thing
- after coming back from recursion.
-
-2002-08-19 Zeev Suraski <zeev@pb1.pair.com>
-
- * zend_operators.c: MFZE1
-
-2002-08-17 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_execute.c: MFZE1
-
-2002-08-17 Zeev Suraski <zeev@pb1.pair.com>
-
- * zend_execute.c
- zend_hash.c: MFZE1
-
-2002-08-16 Stig Bakken <ssb@pb1.pair.com>
-
- * zend.c: * append emacs footer
-
- * zend.c: * remove builtin exception class
-
-2002-08-16 Andi Gutmans <andi@pb1.pair.com>
-
- * zend.c: - Fix whitespace
-
-2002-08-16 Stig Bakken <ssb@pb1.pair.com>
-
- * zend_execute_API.c
- zend_globals.h
- zend.c
- zend_builtin_functions.c:
- - Added set_exception_handler() function for registering a global,
- catch-all exception handling function
- - Added set_exception_handler() function for registering a global,
- catch-all exception handling function (Stig)
-
-2002-08-15 Zeev Suraski <zeev@pb1.pair.com>
-
- * flex.skl
- zend.c
- zend_globals.h
- zend_language_scanner.l: MFZE1
-
-2002-08-14 jason <jason@pb1.pair.com>
-
- * zend_compile.c
- zend_compile.h
- zend_globals.h
- zend_language_parser.y:
- MFZE1 (use token instead of global for opcode counting)
-
-2002-08-13 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_execute_API.c:
- - Fix crash when exception is raised in __autoload function
-
-2002-08-13 Zeev Suraski <zeev@pb1.pair.com>
-
- * zend.h: MFZE1
-
-2002-08-08 sebastian <sebastian@pb1.pair.com>
-
- * zend_objects.c: Fix warning.
-
-2002-08-08 stas <stas@pb1.pair.com>
-
- * zend_objects.c
- zend_objects.h
- zend_objects_API.c
- zend_objects_API.h: Add ZEND_API to functions
-
-2002-08-08 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y
- zend_language_scanner.l
- zend_operators.c
- zend_operators.h:
- - Make new 'is' operator work with classes only and return false when
- - the object isn't of the said class or the value isn't an object.
-
- * zend_static_allocator.c: - Bad Harald! :)
-
-2002-08-08 Zeev Suraski <zeev@pb1.pair.com>
-
- * zend_alloc.c: MFZE1
-
-2002-08-07 phanto <phanto@pb1.pair.com>
-
- * zend_static_allocator.c
- zend_alloc.c
- zend_config.w32.h
- zend_hash.c
- zend_ini.c
- zend_llist.h
- zend_mm.c
- zend_operators.c: make win32 debug output more verbose
-
-2002-08-03 Andi Gutmans <andi@pb1.pair.com>
-
- * tests/zend2.php: - Small fix
-
-2002-08-03 Zeev Suraski <zeev@pb1.pair.com>
-
- * zend_execute.c: MFZE1
-
-2002-08-01 stas <stas@pb1.pair.com>
-
- * zend_execute.c
- zend_hash.c: MFZE1
-
-2002-07-30 jason <jason@pb1.pair.com>
-
- * zend_compile.c
- zend_execute.c
- zend_globals.h: MFZE1 global declare
-
- * zend_compile.c: Fix segfault
-
-2002-07-30 Andrei Zmievski <andrei@pb1.pair.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y
- zend_language_scanner.l
- zend_operators.c
- zend_operators.h:
- - Adding 'is' operator that can be used to check the type of a variable,
- or its class.
-
-2002-07-28 phanto <phanto@pb1.pair.com>
-
- * OBJECTS2_HOWTO: update the handlers struct
-
-2002-07-27 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_compile.c
- zend_execute_API.c:
- - Make sure classes are first looked for in the current scope.
- - Make sure that during inheritance the global scope is searched if the
- - current one doesn't work.
-
-2002-07-26 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_execute.c
- zend.c
- zend_builtin_functions.c
- zend_compile.h:
- - Fix problem with debug_backtrace() reported by Stig. We weren't reporting
- - global function information because it wasn't available. We have to do
- - an additional assignment per-function call so that it'll be available.
- - Also don't define the global scope as function name _main_ but leave it
- - empty so that frameworks like Pear can decide what they want to do.
-
-2002-07-25 sniper <sniper@pb1.pair.com>
-
- * Zend.m4: Fixed 3 major failures in this test:
-
- 1. Tests work better when they are actually run..
- 2. When file is opened, it should be closed sometime too.
- 3. AC_TRY_RUN cleans after itself (rm -f conftest.*), so it's
- good idea to read the values while the file still exists.
-
-
-2002-07-24 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_mm.c: - Fix some compile problems with the new configure checks.
-
-2002-07-24 James Cox <imajes@pb1.pair.com>
-
- * Zend.m4
- zend_mm.c: move testing for the alignment values into configure.
-
- * Zend.m4: ws fixes.
-
-2002-07-23 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_hash.c: - Fix WS.
-
-2002-07-21 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_compile.c:
- - Fix bug reported by Sebastian where old constructors didn't work in
- - nested classes.
-
-2002-07-18 derick <derick@pb1.pair.com>
-
- * zend.h
- zend_extensions.c: - MFZE1 - MacOSX fixes by Marko Karppinen
-
-2002-07-17 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_compile.c:
- - Remove code which wasn't supposed to go into the patch.
-
- * zend_compile.c
- zend_language_parser.y: - Rejuggle some code.
-
-2002-07-17 sniper <sniper@pb1.pair.com>
-
- * ZEND_CHANGES: This was mentioned already above (with an example too :)
-
-2002-07-16 Andi Gutmans <andi@pb1.pair.com>
-
- * ZEND_CHANGES: - Before I forget to list it, this was also added.
-
- * zend_language_scanner.l:
- - Syntactic sugar - Add "public" as a synonym for "var".
- - Now we have the three P's.
- You can do:
-
- <?
- class MyClass {
- public $a;
- private $b;
- protected $c;
- }
-
- ?>
-
-2002-07-15 derick <derick@pb1.pair.com>
-
- * zend_operators.c: - MFH of the crap removal
-
-2002-07-15 Andi Gutmans <andi@pb1.pair.com>
-
- * ZEND_CHANGES
- zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_language_parser.y
- zend_language_scanner.l
- zend_opcode.c:
- - Commit patch to support protected member variables (by Timm Friebe w/
- - some fixes by me).
- - You can't access protected variables from outside the object. If you want
- - to see a protected member from your ancestors you need to declare the
- - member as protected in the class you want to use it in. You can't
- - redeclare a protected variable as private nor the other way around.
-
- * zend_operators.c:
- - Really implement bool increment/decrement as flip-flop.
-
-2002-07-14 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y
- zend_language_scanner.l
- ZEND_CHANGES:
- - Nuke delete(). It was a big mistake to introduce it and I finally
- - understand why Java didn't do so.
- - If you still want to control destruction of your object then either make
- - sure you kill all references or create a destruction method which you
- - call yourself.
-
- * zend_execute.c: - Nuke some unused code
-
-2002-07-14 derick <derick@pb1.pair.com>
-
- * zend_operators.c: MFZE1
-
- * zend_operators.c: - MFZE1
-
-2002-07-07 Andi Gutmans <andi@zend.com>
-
- * zend_objects_API.c: - Path which should improve previous fix.
-
- * zend_objects_API.c:
- - First try at solving problem with different objects being allocated the
- - same id.
-
-2002-07-07 Stanislav Malyshev <stas@zend.com>
-
- * zend_object_handlers.c: name length should be strlen+1
-
-2002-07-07 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_language_parser.y:
- Allow for 'class Namespace::Bar extends Foo' syntax. Patch by Timm Friebe <thekid@thekid.de>.
-
-2002-07-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix problem where scope was lost in nested function calls.
- - Thanks to Timm Friebe for diving into this one.
-
-2002-07-06 Zeev Suraski <zeev@zend.com>
-
- * zend_language_parser.y: spelling fix
-
-2002-07-05 Stig Bakken <ssb@fast.no>
-
- * zend_builtin_functions.c: * folding fixes
-
-2002-07-01 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Fix bug when acccessing $this not in class scope.
-
- * zend_objects.h
- zend_objects.c: - Export zend_object_get_address()
-
-2002-06-30 Andi Gutmans <andi@zend.com>
-
- * ZEND_CHANGES: - Remember to document autoload when I have time.
-
-2002-06-30 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_modules.h: - MFZE1
-
-2002-06-29 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Get ready for alpha2
-
- * zend_execute_API.c: - Invalid -> Undefined
-
- * zend_language_parser.y: - Add missing semi-colon.
-
- * zend_execute_API.c
- zend_execute.c: - Improve some error messages.
-
- * zend_compile.c: - Revert previous fix.
-
- * zend_compile.c: - Change E_ERROR -> E_COMPILE_ERROR where needed.
-
- * zend_compile.c:
- - Fix for bug #17882. We complain if the same method is declared twice.
-
- * zend.h
- zend_operators.c: - Fix bug 15037
- - Bump version to alpha2-dev
-
-2002-06-28 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - WS fix
-
-2002-06-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c:
- - Autoloading support based on patch from Ivan Ristic.
- - Again I hope this feature ends up working well because if it doesn't we
- - might need to nuke it. This only works for global scoped classes and it
- - will never work for sub-classes so don't even ask!!!!!
- - Just define an __autoload() function in the global scope and it will be
- - called with the class name as the parameter if it doesn't manage to find
- - the class.
-
- * zend_API.c
- zend_builtin_functions.c
- zend_mm.h: - Centralize global class fetch
-
- * zend_alloc.c
- zend_execute.c:
- - Fix problem with scope's not changing correctly during method calls.
- - Reapply a tiny optimization to the allocator so that in non-debug mode
- - we clean memory without detecting leaks.
-
-2002-06-24 Andi Gutmans <andi@zend.com>
-
- * zend_fast_cache.h:
- - MFZE1 (Turn off fast cache until we make sure it performs well.)
-
- * zend_alloc.c: - More fixes (warnings, bug fixes etc.)
-
- * zend_execute.c:
- - Revert patch which checks at run-time if you're allowed to assign
- - certain values by reference.
- - We still need to find a solution for cases when this shouldn't be allowed
- - as it might cause leaks.
-
- * zend_alloc.c: - Fix crash bug and clean up a bit.
-
-2002-06-24 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * Zend.m4: IMHO, ZTS should no longer be labeled experimental.
-
-2002-06-24 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c: - MFZE1
-
- * zend_alloc.c: - Don't use cache if we're using ZEND_MM
-
- * zend_mm.c:
- - Hardcode alignment to 8. We might need a configure check for this.
-
- * zend_mm.c
- zend_mm.h: - Improve memory manager to allocate small blocks quickly.
-
- * zend_alloc.h
- zend_mm.h
- zend_alloc.c:
- - Don't keep allocated blocks in a linked list if we're in non-debug mode
- - as now the memory manager takes care to nuke all leaking blocks.
-
- * zend.h
- zend_types.h: - MFZE1
-
-2002-06-23 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c:
- - Fix problem with constructor not being inherited and called correctly.
-
- * zend_mm.c: - Fix small bug
-
- * zend_mm.c:
- - Almost completely implement realloc(). It now resizes in place when
- - possible.
-
-2002-06-22 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c
- zend_mm.c: - Fix crash when zend_mm_shutdown is called more than once.
-
- * zend_alloc.c
- zend_alloc.h
- zend_globals.h
- zend_language_parser.y: - MFZE1
-
- * zend_constants.h
- zend_objects.c
- zend_variables.c
- zend_variables.h
- zend_constants.c
- zend_alloc.c
- zend_alloc.h: - Nuke persist_alloc().
-
-2002-06-19 Andi Gutmans <andi@zend.com>
-
- * zend_globals.h:
- - This was also supposed to be part of the previous ZEND_MM commit :)
-
- * zend_alloc.c:
- - Oops, this was supposed to be part of the previous #ifdef ZEND_MM change
-
- * zend_mm.h: - Use #ifdef for ZEND_MM
-
- * zend_mm.c: - Make sure MAX is defined
-
- * zend_constants.c:
- - Fix problem where you couldn't define constants with different cases but
- - the same name.
-
-2002-06-18 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend.c: - MFZE1
-
-2002-06-17 Andi Gutmans <andi@zend.com>
-
- * zend_mm.c: - Improve speed of alignment calculation
-
- * zend_mm.c
- zend_mm.h
- zend_alloc.c:
- - Fix a bug and add code which frees actual allocated segments at the end
- - of execution (this still doesn't work because some blocks remain
- - referenced after the memory manager is killed.
-
- * zend_mm.c
- zend_mm.h: - Save space per-allocated block.
-
-2002-06-16 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_execute.h
- zend_execute_API.c: - Fix bug in class constants
- - Start centralizing main class lookups. This will help implement
- - __autload()
-
- * zend_mm.c
- zend_mm.h:
- - Remove debug code which doesn't work anymore and add headers.
-
- * zend_globals.h
- zend_mm.c
- zend_mm.h
- zend_alloc.c
- ZendTS.dsp: - Commit an initial version of a home made memory manager.
- - It's just for seeing if this would be an advantage to PHP in MT
- - environments. If this is to become production material there is still
- - a long way to go.
-
-2002-06-15 Andi Gutmans <andi@zend.com>
-
- * zend_objects.h
- zend_objects_API.c:
- - Fix copy&paste problem where we allocated according to an old structure
- - decleration and not the new one.
-
-2002-06-11 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c:
- - Don't show debug_backtrace() in the trace itself.
- - This patch is a bit ugly because the whole code itself is pretty complex
- - and hard to re-order.
-
- * zend_execute.c
- zend_language_parser.y:
- - Fix problem with assigning functions by reference.
-
-2002-06-11 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * RFCs/004.txt: Add __delegate().
-
-2002-06-10 Harald Radi <harald.radi@nme.at>
-
- * zend_ts_hash.h
- zend_ts_hash.c: added TS_HASH macro
-
-2002-06-10 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c: Fix leak
-
-2002-06-09 Harald Radi <harald.radi@nme.at>
-
- * zend_API.h
- zend_builtin_functions.c
- zend_object_handlers.h:
- only check for an available class entry instead of
- the std_object_handlers on some places
-
-
-2002-06-08 Andi Gutmans <andi@zend.com>
-
- * zend_hash.h
- zend.h: - This should improve performance on Windows
-
- * zend_hash.h:
- - Add a loop unrolled version of the hash function and a bit of an
- - explanation about our hash function (Ralf S. Engelschall)
-
-2002-06-06 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * RFCs/004.txt: Add RFC on delegation.
-
-2002-06-05 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_execute.c: Remove unused local variable.
-
-2002-06-05 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c
- zend_object_handlers.c:
- - Allow overloaded objects to receive the method name in its original
- - case.
-
-2002-06-05 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_llist.c: - Fix memleak (patch by Stefan Sesser)
-
-2002-06-04 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_ini_scanner.l: - Fix for bug #17462 (Patch by Edin Kadribasic)
-
-2002-05-31 Andi Gutmans <andi@zend.com>
-
- * ZendTS.dsp: - Add zend_objects_API.* to dsp
-
- * zend_objects_API.c: - Fix build (one more coming up)
-
- * zend_objects.c: - Fix build
-
-2002-05-31 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * Zend.dsp: Add zend_objects_API.c to project.
-
-2002-05-31 Stanislav Malyshev <stas@zend.com>
-
- * Makefile.am
- zend_execute_API.c
- zend_globals.h
- zend_object_handlers.c
- zend_objects.c
- zend_objects.h
- zend_objects_API.c
- zend_objects_API.h: Generalize object storage and reference bookkeeping
-
-2002-05-30 Venkat Raghavan S <rvenkat@novell.com>
-
- * zend.h
- zend_config.nw.h
- acconfig.h: NetWare changes
-
-2002-05-26 Andi Gutmans <andi@zend.com>
-
- * zend_multibyte.c:
- - Add empty zend_multibyte.c to allow build with 4.3.0-dev.
-
-2002-05-24 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Fugbix typo.
-
-2002-05-24 Andi Gutmans <andi@zend.com>
-
- * ZEND_CHANGES: - Add a bit of information.
-
-2002-05-20 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h
- zend_execute.h
- zend_list.h: MFZE1 (Expose more C++ APIs)
-
-2002-05-14 Andi Gutmans <andi@zend.com>
-
- * zend_objects.c
- zend_objects.h: - constructor_called is supposed to be destructor_called
-
-2002-05-13 Sterling Hughes <sterling@bumblebury.com>
-
- * zend_qsort.c: MFZE1
-
-2002-05-13 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_builtin_functions.c: - MFZE1
-
-2002-05-12 Zeev Suraski <zeev@zend.com>
-
- * zend_highlight.c: MFZE1
-
-2002-05-12 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Rephrase.
-
- * ZEND_CHANGES: Beautify.
-
- * ZEND_CHANGES: Start documenting the debug backtracing.
-
- * ZEND_CHANGES: Whitespace fixes.
-
-2002-05-11 Zeev Suraski <zeev@zend.com>
-
- * zend_highlight.c
- zend_highlight.h: MFZE1
-
-2002-05-10 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Nuke C++ comment
-
- * zend_builtin_functions.c:
- - Make debug_backtrace() return an array. Still not finished because I
- might want to differentiate between method calls and static methods.
-
- Example:
- $bt = debug_backtrace();
- foreach ($bt as $frame) {
- if (isset($frame['class'])) {
- print $frame['class'];
- print "::";
- }
- print $frame['function'];
- print " [";
- print $frame['file'];
- print ":";
- print $frame['line'];
- print "]\n";
- }
-
-2002-05-08 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_builtin_functions.c:
- - Hopefully fix problems with debug_backtrace()
-
-2002-05-08 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_builtin_functions.c: - MFZE1
-
-2002-05-07 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend_builtin_functions.c
- zend_compile.h
- zend_execute.c:
- - More debug backtrace work. It still doesn't work very well...
-
-2002-05-02 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_builtin_functions.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h: Initial support for built-in backtracing.
- There are still a few problems such as includes and calling other functions
- from internal functions which aren't seen (will have to think if and how to
- fix this).
- Also the main scripts filename isn't available. Need to think about that.
-
-2002-04-30 Stanislav Malyshev <stas@zend.com>
-
- * zend_API.h
- zend_builtin_functions.c
- zend_object_handlers.c
- zend_object_handlers.h
- zend_operators.h
- zend_API.c: Make OBJCE return zend_class_entry*, also some cleanups
-
-2002-04-28 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_alloc.c
- zend_alloc.h: Revert.
-
-2002-04-27 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_alloc.c
- zend_alloc.h:
- MFZE1: If the size-operands of memset are constants, the compiler can turn them into fast inline code. So, instead of using ecalloc, we use emalloc + memset in macro form now. emalloc will not return NULL, so the chosen macro form is safe. This is not true for malloc(3). An inline function accomodates our needs here. Suggested by: http://www.mail-archive.com/dev%40httpd.apache.org/msg02492.html (Sascha)
-
-2002-04-25 Harald Radi <h.radi@nme.at>
-
- * zend_config.w32.h: unbreak the win32 build
-
-2002-04-24 Harald Radi <h.radi@nme.at>
-
- * zend_API.c: MFZE1 saschas 'Avoid exceeding buffer limits' patch
-
-2002-04-23 Harald Radi <h.radi@nme.at>
-
- * zend_hash.c
- zend_hash.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ts_hash.c
- zend_ts_hash.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_API.c
- zend_API.h
- zend.h: some type cleanup work
-
-2002-04-22 Harald Radi <h.radi@nme.at>
-
- * zend_object_handlers.c
- zend_object_handlers.h
- zend_objects.h
- zend_operators.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c: added get_class_entry callback handler to the
- object handlers structure
-
-2002-04-22 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * Zend.m4: MFZE1: Change default value of inline-opt to yes (Sascha).
-
-2002-04-22 Harald Radi <h.radi@nme.at>
-
- * zend_config.w32.h
- acconfig.h
- flex.skl: fixed linkage warning under win32
-
-2002-04-20 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c: MFZE1
-
-2002-04-19 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_list.c
- zend_hash.c
- zend_hash.h:
- MFZE1: make sure the resource-list is always consistent during shutdown (Thies).
-
- * zend_hash.c: MFZE1: Fix imbalance bug (Zeev).
-
-2002-04-10 Jani Taskinen <sniper@iki.fi>
-
- * zend_language_scanner.l
- zend_language_parser.y: MFZE1
-
-2002-04-07 Stanislav Malyshev <stas@zend.com>
-
- * zend.h: make compatible with current PHP
-
- * zend_compile.c: sync
-
-2002-03-29 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_compile.c: - revert patch
-
-2002-03-25 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_compile.c: - MFZE1
-
-2002-03-23 Andi Gutmans <andi@zend.com>
-
- * zend_ts_hash.c
- zend_ts_hash.h:
- - Fix build without ZTS. If someone has a nicer fix let me know.
-
-2002-03-21 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y:
- - No idea how this slipped in. Fix delete $obj statement.
-
-2002-03-20 Harald Radi <h.radi@nme.at>
-
- * ZendTS.dsp
- zend.h
- zend_ts_hash.c
- zend_ts_hash.h: added thread safe hashtable which allows concurrent
- reads but only exclusive writes
-
-2002-03-19 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y
- zend.h:
- - Finish covering all parsed methods to check for validity in parser.
- - Change zval's refcount to zend_uint (If it doesn't slow down the Engine
- - too much it should probably stay this way). If anyone has time to test
- - the difference in speed between zend_ushort & zend_uint in zend.h of
- - the struct _zval_struct (one line change) I'd be glad to get some
- - figures.
-
-2002-03-18 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_language_parser.y:
- - More fixes to check for member/function call legality.
-
-2002-03-17 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y
- zend_compile.c:
- - Start putting error handling where method calls are being used in a
- - context where only writable variables should be used.
-
-2002-03-15 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_object_handlers.h
- zend_objects.c
- zend_objects.h
- zend_variables.c: - Pass TSRMLS to callbacks.
-
- * zend_execute.c:
- - Scope fix. When calling an imported function the scope will change
- - correctly to the scope of the functions class.
- <?php
-
- function Hello()
- {
- print "Wrong one\n";
- }
-
- class MyClass {
- static $hello = "Hello, World\n";
-
- function Hello()
- {
- print self::$hello;
- }
-
- function Trampoline()
- {
- Hello();
- }
- }
-
- import function Trampoline from MyClass;
-
- Trampoline();
- ?>
-
- * zend_opcode.c
- zend_execute.c
- zend_compile.h
- zend_compile.c:
- - Fix issues with $this when using it by itself without indirection such as
- - $this->foo.
-
-2002-03-14 Stanislav Malyshev <stas@zend.com>
-
- * OBJECTS2_HOWTO: more cleanup
-
- * OBJECTS2_HOWTO: Update howto
-
- * zend_execute.c: fix for delete $this and unset $this
-
- * zend_execute_API.c: Fix call_user_function
-
-2002-03-12 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Forgot to close comment.
-
- * zend.h: - Macro for duality between Engine 1 and 2
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_opcode.c
- zend_operators.c: - Another couple of indirection fixes.
- - Make class_entry->refcount be part of the structure and not allocated.
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_opcode.c: - Fix bug introduced with latest class hash table change.
-
-2002-03-12 Stanislav Malyshev <stas@zend.com>
-
- * zend_API.c: Fix standard object creation
-
- * zend_API.c
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c
- zend.c
- zend.h: - make class tables contain class_entry *, not class_entry
- - fix isset($this)
-
-2002-03-10 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fix build in ZTS mode.
-
-2002-03-10 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_object_handlers.c
- zend_object_handlers.h: New stuff for objects API:
- - Better assignment handling
- - More flexible operations with zval-containing objects
-
-2002-03-09 Andi Gutmans <andi@zend.com>
-
- * tests/zend2.php:
- - Add the original example script to the CVS so that it's always available.
-
-2002-03-08 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Add 'import const' example.
-
-2002-03-08 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Support importing constants. e.g.:
- <?php
-
- class MyOuterClass {
- const Hello = "Hello, World\n";
- }
-
- import const Hello from MyOuterClass;
- print Hello;
-
-2002-03-07 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES:
- Add another 'import' example and merge 'import' section into 'Namespaces' section.
-
-2002-03-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Add function * and class * functionality. Only constants are left.
- <?php
-
- class MyOuterClass {
- class MyInnerClass {
- function func1()
- {
- print "func1()\n";
- }
-
- function func2()
- {
- print "func2()\n";
- }
- }
- }
-
- import class * from MyOuterClass;
- import function func2 from MyOuterClass::MyInnerClass;
-
- MyInnerClass::func1();
- func2();
-
-2002-03-02 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Consistency.
-
- * ZEND_CHANGES: Add 'import statement' section.
-
-2002-03-02 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l:
- - Initial patch to support importing from class scopes (for Stig).
- - It isn't complete yet but I want to work on it from another machine. It
- - shouldn't break anything else so just don't try and use it.
- - The following is a teaser of something that already works:
- <?php
-
- class MyClass
- {
- function hello()
- {
- print "Hello, World\n";
- }
- class MyClass2
- {
- function hello()
- {
- print "Hello, World in MyClass2\n";
- }
- }
- }
-
- import function hello, class MyClass2 from MyClass;
-
- MyClass2::hello();
- hello();
- ?>
-
-2002-03-02 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_builtin_functions.c: - MFZE1
-
-2002-03-01 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c: MFZE1
-
-2002-03-01 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l:
- - Remove use of C++ reserved words namespace/this
-
- * zend_opcode.c
- zend_language_parser.y
- zend_compile.h
- zend_compile.c
- zend_API.c: - Fix bug in nested try/catch's
- - Infrastructure for implementing imports of methods.
-
- * zend_objects.c:
- - Fix crash reported by Sebastian when destructor function causes a fatal
- - error. I hope this does it and we don't find any other problems.
-
-2002-02-26 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.h
- zend_alloc.c
- zend.c: - MFZE1
-
-2002-02-21 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES:
- Maintain ZEND_CHANGES to account for the addition of private member variables.
-
-2002-02-21 Andi Gutmans <andi@zend.com>
-
- * zend_object_handlers.c
- zend_opcode.c
- zend_language_parser.y
- zend_language_scanner.l
- zend_compile.c
- zend.c
- zend.h
- zend_API.c: - Experimental support for private members.
- <?
- class MyClass {
- private $Hello = "Hello, World!\n";
-
- function printHello()
- {
- print $this->Hello;
- }
- }
-
- class MyClass2 extends MyClass {
- function printHello()
- {
- MyClass::printHello(); /* Should print */
- print $this->Hello; /* Shouldn't print out anything */
- }
- }
-
- $obj = new MyClass();
- print $obj->Hello; /* Shouldn't print out anything */
- $obj->printHello(); /* Should print */
-
- $obj = new MyClass2();
- print $obj->Hello; /* Shouldn't print out anything */
- $obj->printHello();
- ?>
-
-2002-02-14 Stanislav Malyshev <stas@zend.com>
-
- * zend.h
- zend_API.c: Pass TSRM to create_object
-
-2002-02-14 Andrei Zmievski <andrei@ispi.net>
-
- * zend_compile.c:
- Fix the bug where the declared properties without init values were not
- entered into the table.
-
-2002-02-13 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y: <?php
- class MyException1 {
-
- }
-
- class MyException2 {
-
- }
-
- try {
- throw new MyException2();
- } catch (MyException1 $m) {
- print "Caught MyException1";
- } catch (MyException2 $m) {
- print "Caught MyException2";
- }
-
-2002-02-10 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_compile.h:
- Export lex_scan(). Both the PHPDoc and tokenizer extension need this. I hope this is okay with Z&A.
-
-2002-02-08 Andi Gutmans <andi@zend.com>
-
- * zend_objects.c: - Remove object debug messages.
-
-2002-02-07 Stanislav Malyshev <stas@zend.com>
-
- * Makefile.am
- OBJECTS2_HOWTO
- ZendTS.dsp
- configure.in
- zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h
- zend_object_handlers.c
- zend_object_handlers.h
- zend_objects.c
- zend_objects.h
- zend_operators.c
- zend_operators.h
- zend_variables.c: Mega-commit: Enter the new object model
- Note: only standard Zend objects are working now. This is definitely going to
- break custom objects like COM, Java, etc. - this will be fixed later.
- Also, this may break other things that access objects' internals directly.
-
-2002-02-04 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - This small patch should also take care of allowing unseting of $this->foo
- - and static members. The unset() opcode was luckily already suitable for
- - object overloading.
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_objects.c:
- - Fix problem with the objects_destructor called during shutdown. It was
- - freeing objects from id 0 instead of id 1. id 0 is not used.
- - Change isset/empty opcodes to support static members and the new way of
- - doing $this->foobar. Also the opcodes operate now on the hash table
- - combined with the variable names so that they can be overloaded by the
- - soon to be added overloading patch.
-
-2002-02-03 Adam Dickmeiss <adam@indexdata.dk>
-
- * Makefile.am
- configure.in:
- Zend config sets ZEND_EXTRA_LIBS. Bugs 14452, 14602, 14616, 14824
-
-2002-02-02 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_builtin_functions.c: Revert per Andi's request. Sorry :-(
-
- * zend_builtin_functions.c: Fix warning. Again :-)
-
-2002-02-02 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c:
- - Please don't use strcmp() and friends in Zend but only the mem*
- - functions. I didn't check this patch so please check that it works.
-
-2002-02-02 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_builtin_functions.c: Fix a warning.
-
-2002-02-02 Andi Gutmans <andi@zend.com>
-
- * zend_modules.h: - Nice catch by Derick. GINIT is dead.
-
-2002-02-01 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_builtin_functions.c: MFZE1: is_a()
-
-2002-01-27 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_config.w32.h:
- MFZE1: define a couple of macros under win32. (Patch By: Jon Parise <jon@php.net>)
-
-2002-01-25 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute_API.c
- zend_objects.c
- zend_objects.h
- zend_opcode.c:
- - First destructor hell fix. There was a situation where an object's
- - destructor could be run after its class was already dead. Right now
- - object destructors is the first thing whic happens during shutdown in
- - order to prevent this problem. It's very likely that destructors will
- - cause more grief and we'll have to outline exactly when you should use
- - them and what kind of logic you're allowed to do inside of them.
- - This bug was reported by sebastian.
-
-2002-01-22 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix a bug reported by Sebastian with indirect class names not working.
-
-2002-01-20 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_language_parser.y
- zend_opcode.c: - Improve performance of functions that use $GLOBALS[]
- - Please check this and make sure it doesn't break anything.
-
-2002-01-19 Thies C. Arntzen <thies@thieso.net>
-
- * zend_language_parser.y: MFZE1
-
-2002-01-14 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c:
- - Fix crash bug in call_user_function_ex(). Thanks to Sebastian for the
- - very nice and short reproducing script.
- <?php
- $array = array('foo', 'bar');
-
- uasort($array, 'cmp');
-
- function cmp($a, $b)
- {
- return (strcmp($a[1], $b[1]));
- }
- ?>
-
-2002-01-14 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Update Exceptions example.
-
-2002-01-13 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_globals.h
- zend_language_parser.y:
- - Change exception handling to use the Java-like catch(MyException $exception)
- - semantics. Example:
- <?php
-
- class MyException {
- function __construct($exception)
- {
- $this->exception = $exception;
- }
-
- function Display()
- {
- print "MyException: $this->exception\n";
- }
-
- }
- class MyExceptionFoo extends MyException {
- function __construct($exception)
- {
- $this->exception = $exception;
- }
- function Display()
- {
- print "MyException: $this->exception\n";
- }
- }
-
- try {
- throw new MyExceptionFoo("Hello");
- } catch (MyException $exception) {
- $exception->Display();
- }
- ?>
-
- * zend_ini_scanner.l: - MFZE1
-
-2002-01-06 Andi Gutmans <andi@zend.com>
-
- * zend.c:
- - Output error when there's an uncaught exception (by Timm Friebe)
-
- * zend_execute.c: - Make sure $this is passed on to methods
-
-2002-01-06 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.l
- zend_language_parser.y
- zend_language_scanner.h
- zend_language_scanner.l
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_modules.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_qsort.c
- zend_qsort.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_static_allocator.c
- zend_static_allocator.h
- zend_variables.c
- zend_variables.h
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_builtin_functions.h
- zend_compile.c
- zend_compile.h
- zend_config.w32.h
- zend_constants.c
- zend_constants.h
- zend_dynamic_array.c
- zend_dynamic_array.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_fast_cache.h
- zend_globals.h
- zend_globals_macros.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_ini.c: Happy New Year.
-
-2002-01-05 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Small fix
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c: - Allow passing of $this as function arguments.
- - Fix a bug which I introduced a couple of months ago
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h:
- - Significantly improve the performance of method calls and $this->member
- - lookups.
-
-2002-01-04 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Improve performance of indirect-referenced function calls
-
- * zend_compile.c: - Nuke C++ comments
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c: - Separate other kinds of function calls too.
- - Significantly improve performance of function calls by moving lowercasing
- - the function name to compile-time when possible.
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c:
- - Start splitting up different kinds of function calls into different
- - opcodes.
-
-2002-01-03 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_API.c
- zend_API.h
- zend_execute.c
- zend_list.c:
- - MFZE1 for exit fix, exposing current function name in error messages and
- exposing zend_zval_type_name().
-
-2001-12-31 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Consistency.
-
-2001-12-31 Andi Gutmans <andi@zend.com>
-
- * ZEND_CHANGES:
- - Add example of default argument for argument passed by-ref
-
-2001-12-30 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Typo.
-
-2001-12-29 Andi Gutmans <andi@zend.com>
-
- * zend.h:
- - #define to help #ifdef stuff in PHP sources to make them work w/ ZE1 and
- - 2
-
- * ZEND_CHANGES: - A few clarifications
-
-2001-12-29 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Integrate Andi's examples and some notes by Stig.
-
- * ZEND_CHANGES: Update Exceptions example.
-
-2001-12-28 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y:
- - Fix some case insensitivity stuff in respect to classes
-
- * zend_execute.c
- zend_language_parser.y:
- - Support default arguments for reference parameters
- - Fix two compile warnings
-
- * zend_compile.c:
- - Wasn't adding the lower case version of the class name to the hash
-
-2001-12-27 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_objects.c:
- - Use two underscores for __construct(), __clone and friends...
-
- * zend_objects.c:
- - Only check refcount of object if the destructor was called.
-
- * zend.c
- zend.h
- zend_API.h
- zend_compile.c
- zend_objects.c
- zend_objects.h:
- - Experimental support for destructors. We need to see if destructors
- - will actually work well in the context of PHP so we should consider this
- - as experimental. Possible problems might be that when the constructor is
- - run PHP might not be in a stable state.
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c: - Support parent:: again
-
- * zend_compile.c: - Support unified constructor name _construct()
-
-2001-12-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_execute_API.c: - Fix scoping issue. The following works now:
- <?
- class MyClass {
- static $id = 0;
-
- function MyClass()
- {
- $this->id = self::$id++;
- }
-
- function _clone()
- {
- $this->name = $clone->name;
- $this->address = "New York";
- $this->id = self::$id++;
- }
- }
-
-
-
- $obj = new MyClass();
-
- $obj->name = "Hello";
- $obj->address = "Tel-Aviv";
-
- print $obj->id;
- print "\n";
-
- $obj = $obj->_clone();
-
- print $obj->id;
- print "\n";
- print $obj->name;
- print "\n";
- print $obj->address;
- print "\n";
-
- * zend.c: - Print out object id for easier debugging
-
- * zend.c
- zend.h
- zend_API.h
- zend_compile.c
- zend_objects.c: - Pretty much finish _clone() support
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y: - Initial support for _clone()
-
- * zend_compile.c
- zend_language_parser.y:
- - Start fixing the parsing rules so that function and method calls
- - can't be used in a write context.
-
- * zend.c: - Fix crash correctly.
-
-2001-12-25 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y: - Revert delete syntax patch
-
- * zend.c
- zend_execute.c: - Fix a crash (not a thorough fix).
- - Commented old code
-
-2001-12-24 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fixed bug where global functions weren't called if they didn't exist
- - in the class scope
-
-2001-12-23 Andi Gutmans <andi@zend.com>
-
- * zend.c:
- - Fix a bug where function's didn't work anymore in multi-threaded
- - servers after the latest startup changes.
-
-2001-12-22 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute_API.c
- zend_language_parser.y:
- - Add initial capability of defining nested classes as class foo::bar
-
-2001-12-18 Zeev Suraski <zeev@zend.com>
-
- * zend_language_scanner.h
- zend_language_scanner.l: MFZE1
-
-2001-12-16 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: I'm too trigger-happy.
-
- * ZEND_CHANGES: delete is now function
-
-2001-12-16 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y:
- - Seems like most people prefer delete($obj) over delete $obj.
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y: - Start adding parsed variable checks.
-
- * zend_compile.h
- zend_language_parser.y:
- - Framework for knowing what kind of variable we just parsed.
- - This will be used in compile-time error checking which couldn't be done
- - at the level of the grammar.
-
-2001-12-13 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y:
- - Rearrange grammar to allow dereferencing of objects returned from
- - functions. It still crashes though.
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_opcode.c: - Fix crash bug in startup code.
- - Start work on being able to reference global and local scope
-
-2001-12-12 Andi Gutmans <andi@zend.com>
-
- * Zend.dsp
- zend.c
- zend_constants.c
- zend_globals.h:
- - Infrastructure changes for allowing to access the global scope from
- - within a class scope.
- - Fix the Zend.dsp project a bit. It seems someone pretty much killed it
- - when commiting their own personal configuration. Please be careful in
- - future.
-
- * zend.h
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_globals.h
- zend_language_parser.y:
- - Make classes have scope and function/constant lookups default to the class
-
-2001-12-11 Andi Gutmans <andi@zend.com>
-
- * zend.c: - Merge from ZE1
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c:
- - Rename zend_class_entry.constants -> zend_class_entry.constants_table
-
- * zend_execute.c:
- - Start making scope change correctly when calling namespace functions.
- - When inside a namespace fallback to global namespace when function
- - or constant is not found.
-
-2001-12-11 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * LICENSE: Forgot to update the LICENSE.
-
- * LICENSE
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_builtin_functions.h
- zend_compile.c
- zend_compile.h
- zend_config.w32.h
- zend_constants.c
- zend_constants.h
- zend_dynamic_array.c
- zend_dynamic_array.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_fast_cache.h
- zend_globals.h
- zend_globals_macros.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_ini.c
- zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.l
- zend_language_parser.y
- zend_language_scanner.h
- zend_language_scanner.l
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_modules.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_qsort.c
- zend_qsort.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_static_allocator.c
- zend_static_allocator.h
- zend_variables.c
- zend_variables.h: Update headers.
-
- * Zend.m4
- zend.h: MFZE1 (AIX fixes)
-
- * zend_highlight.h
- zend_highlight.c: MFZE1 (added zend_strip mode in the highliter)
-
-2001-12-10 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y: - More namespaces work.
- - Nuke memory leak.
-
-2001-12-08 Andi Gutmans <andi@zend.com>
-
- * zend.c: - Fix crash with unhandled exceptions
-
-2001-12-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Support constants. The following works now:
- <?
- class foo {
- const GC = "foo constant\n";
- }
-
- define("GC", "Global constant\n");
-
- namespace;
- print GC;
- namespace foo;
- print GC;
- namespace;
- print foo::GC;
-
- ?>
-
- * zend_language_parser.y
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_globals.h:
- - Initial work on changing namespace scope. Only methods & variables
- - right now.
- <?
- $hey = "Global hey\n";
-
- class foo {
- static $hey = "Namespace hey\n";
- function bar()
- {
- print "in foo::bar()\n";
- }
- }
- function bar()
- {
- print "in bar()\n";
- }
-
- bar();
- namespace foo;
- bar();
- namespace;
- bar();
- namespace foo;
- $bar_indirect = "bar";
- $bar_indirect();
-
- namespace;
- print $hey;
- namespace foo;
- print $hey;
- $hey = "Namespace hey #2\n";
- namespace;
- print $hey;
- $hey = "Global hey #2\n";
- namespace foo;
- print $hey;
- ?>
-
- * zend.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_language_parser.y:
- - Nuke the namespace work I did. It'll be redone differently.
-
-2001-12-05 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Document recent changes.
-
-2001-12-04 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Damn Zeev :)
-
-2001-12-01 Andi Gutmans <andi@zend.com>
-
- * zend_API.c:
- - Revert one of the changes because it might be before the memory
- - manager has started.
-
- * zend_API.c
- zend_constants.c: - Use alloca() when possible.
-
-2001-11-30 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_language_parser.y
- zend_opcode.c:
- - Initial support for class constants. There are still a few semantic
- - issues which need to be looked into but basically it seems to work.
- - Example:
- <?php
- class foo
- {
- const hey = "hello";
- }
-
- print foo::hey;
- ?>
-
- * Zend.m4: - Fix typo
-
-2001-11-27 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y:
- - Support syntax for class constants (doesn't do anything yet but
- - required some reworking of the grammar).
-
-2001-11-26 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y:
- - Support static $var = 0; style initialization of static class
- - members. For example:
- - class foo {
- - static $my_static = 5;
- -
- - }
- -
- - print foo::$my_static;
-
-2001-11-25 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend_compile.c: - Fix crash and leak
-
- * zend_compile.c: - Whitespace
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y
- zend_opcode.c: - Support static members. The following script works:
- <?
- class foo
- {
- class bar
- {
- function init_values()
- {
- for ($i=1; $i<10; $i++) {
- foo::bar::$hello[$i] = $i*$i;
- }
- }
-
- function print_values()
- {
- for ($i=1; $i<10; $i++) {
- print foo::bar::$hello[$i] . "\n";
- }
- }
- }
- }
-
- foo::bar::init_values();
- foo::bar::print_values();
-
- for ($i=1; $i<10; $i++) {
- print $hello[$i]?"Shouldn't be printed\n":"";
- }
- ?>
-
-2001-11-24 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c: - MFZE1
-
-2001-11-15 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: MFZE1
-
-2001-11-05 stig <stig@pb1.pair.com>
-
- * zend_objects.h: add newline at end of file to avoid warnings
-
- * zend_language_parser.y: non-zts compile fix
-
-2001-11-04 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y:
- - Support instantiation of nested class. The following script now should
- - work:
- -<?php
- - class foo
- - {
- - function bar()
- - {
- - print "bar() in class bar\n";
- - }
- -
- - class barbara
- - {
- - function bar()
- - {
- - print "bar() in class foo::barbara\n";
- - }
- - }
- - }
- -
- - $obj = new foo();
- - $obj->bar();
- -
- - $obj = new foo::barbara();
- - $obj->bar();
- -
-
-2001-11-03 Andi Gutmans <andi@zend.com>
-
- * zend.h: - RISC OS patch by Alex Waugh
-
- * zend.c
- zend_API.h
- zend_compile.c: - Add some initializations
-
- * zend_compile.c
- zend_execute.c
- zend.h:
- - Add constructor to the zend_class_entry instead of looking it up each
- - time by name.
- - This will allow the next patch of being able to instantiate nested
- - classes such as new foo::bar::barbara();
-
-2001-10-29 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_opcode.c: - Fix internal classes
-
- * zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_globals.h
- zend_language_parser.y
- zend_opcode.c: - Initial support for nested class definitions
-
-2001-10-27 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: MFTGZE1
-
-2001-10-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c: - Fix Zeev's MFZE1
-
-2001-10-23 Zeev Suraski <zeev@zend.com>
-
- * zend_constants.c
- zend_execute_API.c
- zend_globals.h: MFZE1
-
-2001-10-20 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c: MFHZ1
-
-2001-10-12 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_API.c
- zend_API.h
- zend_modules.h: MFZE1: Introduced extension version numbers (Stig)
-
-2001-10-04 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_hash.c: MFZE1
-
-2001-09-30 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l:
- - Merge the NAMESPACES_BRANCH. It wasn't a good idea to have a branch when
- - the whole CVS tree is work in progress
-
- * zend_compile.h
- zend_execute.c:
- - At last I've had some time to move all execute() locals into one struct.
- - No immediate gain but it makes it more clear what variables are temps
- - and which ones are execute() locals.
-
-2001-09-27 Andi Gutmans <andi@zend.com>
-
- * zend_modules.h: - Bump it up in the right place
-
- * zend_modules.h: - Increase API number
-
-2001-09-26 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend.h
- zend_compile.c
- zend_execute.c: - Good catch by Sterling
-
-2001-09-24 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_execute_API.c
- zend_globals.h: - More namespaces work
-
-2001-09-22 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Keep ZEND_CHANGES up-to-date.
-
-2001-09-22 Zeev Suraski <zeev@zend.com>
-
- * zend_globals.h
- flex.skl
- zend.c
- zend_ini_scanner.l
- zend_language_scanner.l: MFZE1
-
-2001-09-20 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend_compile.c: - Fix build on Win32
-
- * zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l
- zend.c:
- - Create a branch for namespaces. This isn't even remotely close to
- - working.
-
- * zend_list.h: - Nuke unused enum
-
-2001-09-19 Zeev Suraski <zeev@zend.com>
-
- * flex.skl
- zend.c
- zend_globals.h
- zend_ini_scanner.l
- zend_language_scanner.l: MFZE1
-
-2001-09-19 Andi Gutmans <andi@zend.com>
-
- * Makefile.am: - MFZE1
-
-2001-09-19 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * Makefile.am
- zend_hash.c
- zend_hash.h
- zend_ini.c
- zend_llist.c
- zend_llist.h
- zend_qsort.c
- zend_qsort.h
- Zend.dsp
- ZendTS.dsp: MFZE1
-
-2001-09-17 Brian L. Moon <brianm@dealnews.com>
-
- * RFCs/003.txt: adding RFC for loose type requirements for functions
-
-2001-09-16 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: MFZE1
-
-2001-09-10 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h
- zend_globals.h
- zend_ini_scanner.h
- zend_ini_scanner.l
- zend_language_scanner.h
- zend_language_scanner.l: MFZE1 (nuke cplusplus code)
-
- * zend.c
- zend_execute_API.c
- zend_globals.h: MFZE1 (support return value in execute_scripts)
-
-2001-09-08 stig <stig@pb1.pair.com>
-
- * RFCs/002.txt: remove bogus comment :)
-
- * RFCs/002.txt: RFC document for namespaces
-
- * RFCs/001.txt: wrapped to 80 columns :)
-
-2001-09-07 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_language_parser.y:
- - Shift around the variable parsing code to make it simpler.
-
- * zend_llist.c:
- - Fix warning (was fixed in ZE1 and not merged at some point). Please make
- sure you merge patches!
-
-2001-09-05 Stanislav Malyshev <stas@zend.com>
-
- * zend_operators.c: MFZE1
-
-2001-09-03 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y: - CLS_CC -> TSRMLS_CC
-
-2001-08-31 Sterling Hughes <sterling@bumblebury.com>
-
- * zend_llist.h: spaces->tabs
-
- * zend_llist.c
- zend_llist.h
- zend_execute_locks.h: MFZE1
-
-2001-08-31 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_compile.h: MFZE1
-
-2001-08-30 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h
- zend_compile.c: - Make it compile in thread-safe mode.
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c: - Get rid of warning and C++ comments
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l: - Initial support for exceptions.
-
-2001-08-30 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: MFZE1
-
-2001-08-28 Zeev Suraski <zeev@zend.com>
-
- * zend_language_scanner.l: MFZE1
-
-2001-08-27 Andi Gutmans <andi@zend.com>
-
- * RFCs/001.txt: - Add sample RFC
-
-2001-08-26 Stanislav Malyshev <stas@zend.com>
-
- * Zend.m4
- zend.h: Add dlsym underscore detection, by Jani Taskinen
-
-2001-08-26 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - MFZE1
-
- * zend_API.c:
- - Merge Andrei's fix from Engine 1. Please commit patches to both trees!
-
-2001-08-21 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_execute_API.c: MFZE1
-
-2001-08-20 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c
- zend_hash.h: MFZE1
-
-2001-08-19 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Fix compile problem
-
-2001-08-19 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: MFZE1
-
-2001-08-18 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_llist.c
- zend_llist.h: - Merge Sterling's patches from ZE1
-
-2001-08-17 Andrei Zmievski <andrei@ispi.net>
-
- * zend_execute.c: MFZE1
-
-2001-08-17 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: MFZE1
-
-2001-08-16 Zeev Suraski <zeev@zend.com>
-
- * flex.skl
- zend_ini_scanner.l
- zend_language_scanner.l: MFZE1
-
-2001-08-16 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Try and nuke get_object_zval_ptr()
-
- * zend_objects.c: - Remove bogus notice
-
- * zend_variables.c: - Sync with ZE1
-
- * zend.h
- zend_execute.c
- zend_objects.c
- zend_objects.h
- zend_operators.c
- zend_operators.h
- zend_variables.c: - Fix a bug in method calls.
- - Try to get the old copying behavior of objects to work (doesn't work yet).
-
-2001-08-15 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c: MFZE1
-
-2001-08-14 Zeev Suraski <zeev@zend.com>
-
- * zend_constants.c
- zend_constants.h
- zend_variables.c
- zend_variables.h: MFZE1
-
-2001-08-13 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - MFZE1
-
- * zend_execute.c: - Merge from Engine 1
-
-2001-08-13 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c
- zend_operators.c
- zend_operators.h: MFZE1
-
-2001-08-12 Stanislav Malyshev <stas@zend.com>
-
- * zend_API.h: _FUNCTION is used in definition, so use _D
-
-2001-08-11 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_API.h
- zend_objects.c
- zend_operators.c: - More work on making objects work
-
- * zend_API.c
- zend_objects.c
- zend_objects.h
- zend_operators.c:
- - Fix some places which create objects. The fixes are ugly and will be
- revised when things start working well
-
-2001-08-11 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_compile.c
- zend_constants.c
- zend_constants.h
- zend_execute_API.c
- zend_hash.c
- zend_hash.h
- zend_ini.h
- zend_ini_scanner.l
- zend_language_parser.y
- zend_language_scanner.l
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_operators.c: Whitespace
-
-2001-08-11 Andi Gutmans <andi@zend.com>
-
- * Makefile.am
- zend_objects.c: - Fix UNIX build.
-
- * zend_compile.c:
- - Need to do some rewriting in the parser instead of this.
-
- * zend.h:
- - For Sebastian. Will allow to see you're using the Engine 2 CVS via
- phpinfo()
-
-2001-08-10 Andi Gutmans <andi@zend.com>
-
- * zend_API.h: - Merge from Engine 1
-
- * zend_compile.c: - A couple of fixes
-
- * zend_API.h: - Merge from Engine 1 CVS
-
-2001-08-09 Andi Gutmans <andi@zend.com>
-
- * zend.c: - Merge from Engine 1 tree
-
-2001-08-08 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend_compile.c
- zend_compile.h
- zend_globals.h: - Merge new $_GET, $_POST etc. patch from Engine 1 tree
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y: - Preliminary patch for method() dereferencing
-
- * zend.c
- zend.h: - Merge zend_try fix from Engine 1
-
-2001-08-07 Zeev Suraski <zeev@zend.com>
-
- * ZendTS.dsp: Migrate .dsp patches
-
-2001-08-07 Andi Gutmans <andi@zend.com>
-
- * ZendTS.dsp: - Forgot to commit the updated dsp
-
- * ZendTS.dsp: - More sync with latest CVS
-
- * zend_objects.c
- zend_objects.h
- zend_operators.h
- zend_variables.c
- ZendTS.dsp
- zend.h
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l: - Sync Engine2 CVS with latest Engine CVS
-
-2001-08-06 Zeev Suraski <zeev@zend.com>
-
- * zend_indent.c: Commit uncommitted build fix
-
- * zend_compile.c
- zend_globals.h
- zend_language_scanner.l:
- Fix an off by one lineno issue, in case of an implicit ;
-
- * flex.skl
- zend_highlight.c: Better shared code
-
- * Makefile.am
- Zend.dsp
- Zend.m4
- ZendTS.dsp
- flex.skl
- zend.c
- zend_globals.h
- zend_globals_macros.h
- zend_highlight.c
- zend_indent.c
- zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.h
- zend_ini_scanner.l
- zend_language_scanner.h
- zend_language_scanner.l:
- Merge from branch - move to standard C scanners in thread safe mode
-
- * Makefile.am
- Zend.m4
- flex.skl
- zend_ini_scanner.l
- zend_language_scanner.l: Make the C++less scanner compile under UNIX
-
-2001-08-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Move to using Z_ macros
-
- * zend_API.h: - Use Z_ macros
-
-2001-08-05 Zeev Suraski <zeev@zend.com>
-
- * zend_globals_macros.h: More nulled-out macros
-
- * zend.c
- zend_API.c
- zend_API.h: TSRMLS_FETCH work
-
-2001-08-04 stig <stig@pb1.pair.com>
-
- * .cvsignore: added some more stuff to .cvsignore
-
-2001-08-03 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Fix buglet
-
- * zend_alloc.c: Fix macro
-
- * zend.c
- zend_alloc.c
- zend_globals.h:
- Implement fast memory allocation and reduced fragmentation under Windows.
-
- * zend_globals_macros.h: Some compat macros
-
-2001-08-02 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- require_once()/include_once will return true in case a file was not included
- because it was already included earlier.
- Changed the default return value type of the include() family from long to
- boolean
-
- * zend_constants.c
- zend_execute_API.c
- zend_hash.c
- zend_hash.h:
- Avoid going over huge lists of functions, classes and constants.
- Special thanks to the guys from the MS lab for the profiling tools :)
-
- * zend.c
- zend_execute_API.c
- zend_hash.c
- zend_hash.h
- zend_list.c
- zend_list.h: Some cleanup
-
- * zend_builtin_functions.c
- zend_hash.c
- zend_hash.h: TSRMLS fixes
-
- * zend_ini_parser.y: non ZTS build fix
-
- * Zend.dsp
- ZendTS.dsp
- flex.skl
- zend.c
- zend_globals.h
- zend_globals_macros.h
- zend_highlight.c
- zend_indent.c
- zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.h
- zend_ini_scanner.l
- zend_language_scanner.h
- zend_language_scanner.l:
- Implement a standard C thread safe scanner within flex
-
-2001-08-01 Zeev Suraski <zeev@zend.com>
-
- * flex.skl
- zend_language_scanner.l:
- Implement fast scanning in the multithreaded environment
-
-2001-07-31 Zeev Suraski <zeev@zend.com>
-
- * zend_language_scanner.l: the make Sebastian happy part of the day :)
-
- * zend_ini.c
- zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.h
- zend_ini_scanner.l: More TSRMLS_FETCH work
-
- * zend_list.c
- zend_list.h: More TSRMLS_FETCH annihilation
-
- * zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_hash.c
- zend_hash.h
- zend_ini.c
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_modules.h
- zend_opcode.c: More TSRMLS_FETCH work
-
-2001-07-30 Zeev Suraski <zeev@zend.com>
-
- * zend_language_scanner.l: Compile fix
-
- * zend.c
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_constants.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_highlight.c
- zend_highlight.h
- zend_ini.c
- zend_ini.h
- zend_ini_parser.y
- zend_language_scanner.l
- zend_modules.h: More TSRMLS_FETCH work
-
- * zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_modules.h:
- More TSRMLS_FETCH work, and get rid of redundant ParametersPassedByRef
-
-2001-07-30 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c
- zend_API.h:
- Let's be consisten and keep TSRMLS_DC declaration after num_args.
-
-2001-07-30 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_hash.c
- zend_hash.h
- zend_highlight.h
- zend_ini_parser.y
- zend_ini_scanner.h
- zend_ini_scanner.l
- zend_language_parser.y
- zend_language_scanner.l
- zend_list.c
- zend_list.h
- zend_operators.c
- zend_operators.h
- zend_variables.c: More TSRMLS_FETCH annihilation
-
- * zend_API.c
- zend_API.h: Get rid of more TSRMLS_FETCH's
-
- * zend.c
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_builtin_functions.h
- zend_compile.h
- zend_constants.c
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c: Avoid TSRMLS_FETCH()'s (still lots of work left)
-
-2001-07-29 Andi Gutmans <andi@zend.com>
-
- * zend_execute.h: - More object junk
-
- * zend.c: - Object macros...
-
-2001-07-28 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - Fix build
-
- * zend_operators.c: - More object macros.
-
- * zend_builtin_functions.c: - Use the Z_OBJ* macros for accessing objects
-
- * zend.h
- zend_operators.h:
- - Small patch to allow fixing the PHP tree to be compatible w/ the initial
- - Zend 2 objects patch. Hopefully I can commit that this week.
-
-2001-07-28 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp
- ZendTS.dsp
- zend.c
- zend.h
- zend_API.c
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_fast_cache.h
- zend_globals_macros.h
- zend_highlight.c
- zend_indent.c
- zend_ini_parser.y
- zend_ini_scanner.l
- zend_language_parser.y
- zend_language_scanner.h
- zend_language_scanner.l
- zend_opcode.c: Redesigned thread safety mechanism - nua nua
-
-2001-07-28 sascha <sascha@pb1.pair.com>
-
- * zend.h: Fix build
-
-2001-07-27 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_constants.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_execute_locks.h
- zend_globals_macros.h
- zend_ini.c
- zend_ini.h
- zend_language_parser.y
- zend_language_scanner.l
- zend_list.c
- zend_list.h
- zend_modules.h
- zend_operators.c
- zend_variables.c
- zend.c: Get rid of ELS_*(), and use TSRMLS_*() instead.
- This patch is *bound* to break some files, as I must have had typos somewhere.
- If you use any uncommon extension, please try to build it...
-
-2001-07-23 sascha <sascha@pb1.pair.com>
-
- * zend_alloc.c: tsrm_error is only available, if TSRM_DEBUG is defined.
-
-2001-07-21 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h: Always track bailout file/lineno
-
- * zend.c: Fix Release builds
-
- * zend.c
- zend.h
- zend_execute_API.c
- zend_globals.h
- zend_list.c:
- Improve bailout mechanism, supports nesting of bailouts a-la try..catch
-
- * zend_hash.c: Fix compile warning
-
-2001-07-21 Andrei Zmievski <andrei@ispi.net>
-
- * zend_compile.c:
- Fix certain cases where inheritance of base class's overloaded handlers wasn't
- being done.
-
-2001-07-20 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_execute_API.c
- zend_list.c:
- Implement a more granular shutdown mechanism for the executor -
- prevent corruption of constants and missing destructions of resources
-
-2001-07-19 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Unfix, it has too strong effects
-
- * zend_compile.c: Catch all cases
-
- * zend_compile.c: Fix bug #11970, strike 2
-
- * zend_execute.c: Revert bogus patch
-
-2001-07-18 Stanislav Malyshev <stas@zend.com>
-
- * zend_operators.c: fix double->long conversion
-
-2001-07-17 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c: - Remove unused code
-
-2001-07-16 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h
- zend_compile.c
- zend_globals.h
- zend_variables.c:
- Fix bug #10287 - avoid crashing under a bogus usage of list()
-
- * zend.h
- zend_compile.c
- zend_execute_API.c: Fix bug #10467
-
-2001-07-15 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.h: Minor cleaning
-
- * zend_language_parser.y: Optimize the parser a bit
-
- * zend_language_scanner.h
- zend_language_scanner.l: Fix an inline
-
- * zend_variables.c
- zend_variables.h:
- Time to bid this old timer goodbye - get rid of var_uninit()
-
- * zend_hash.c: Fix bug #6239
-
- * zend_language_parser.y:
- Allow indirect reference to method names in class::method() construct
-
- * zend_execute_API.c: Fix bug #10257
-
- * zend_execute.c: Fix bug #11970
-
- * zend_compile.c: Fix bug #9884
-
- * zend.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h
- zend_language_scanner.l
- zend_opcode.c:
- Improved interactive mode - it is now available in all builds, without any significant slowdown
-
- * zend.c: Early initialization
-
-2001-07-13 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c: layout
-
-2001-07-13 Thies C. Arntzen <thies@thieso.net>
-
- * zend_hash.c
- zend_hash.h
- zend_list.c:
- the resource-lists are now destroyed backwards. this will make sure that
- resources get destroyed in the opposite order they were created and thereby
- db-cursors will always be released before their corresponding connection etc.
- this sould not break anything!
-
-2001-07-11 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c
- zend_ptr_stack.c
- zend_ptr_stack.h: Remove the last couple of bogus inlines
-
-2001-07-11 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c
- zend_hash.h: - Move inline_zend_hash_func() to header file
-
-2001-07-11 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h: fixed ZVAL_FALSE and ZVAL_TRUE
-
-2001-07-11 Stanislav Malyshev <stas@zend.com>
-
- * zend_hash.h: No hashpjw anymore, but we have zend_hash_func
-
-2001-07-11 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c
- zend_variables.h: Get rid of ZVAL_RESET...
-
- * zend_API.c
- zend_operators.c
- zend_variables.c
- zend_variables.h: Get rid of some inlines
-
-2001-07-10 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.h
- zend_hash.c
- zend_hash.h: - Merge faster hash implementation.
- - The hash function parameter in hash_init(...) is not used anymore.
- - It should be removed but it is "to be decided" if we want to do that now
- - or in a major version as it means changing MANY places and third party
- - modules might stop working.
-
-2001-07-10 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h
- zend_variables.c: cleaned up the RETVAL_ RETURN_ and ZVAL_ macros
-
- added check for \0 at end-of-string at some places. all strings in PHP
- have to be terminated with \0 because 3th party libraries might not be
- binary-safe.
-
-2001-07-10 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Commit Thies' patch. str.len was too long.
-
-2001-07-09 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c
- zend_API.h: Adding new parameter parsing API.
-
-2001-07-09 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c
- zend_hash.h:
- - Significantly improve hash table performance by using djb's hash function
- instead of hashpjw() and by using power of two sizes of hash tables (this
- saves the % and isn't necessary with a good hash function).
- Please try this patch.
-
-2001-07-03 Rasmus Lerdorf <rasmus@php.net>
-
- * zend_API.c: Trivial fix - but the period looks odd in error messages
-
-2001-06-30 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c: - Fix the memory limit fix.
-
-2001-06-29 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - Remove bogus comment.
-
-2001-06-29 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Fix memory_limit, kill warning
-
-2001-06-28 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_locks.h: Fix warnings
-
-2001-06-27 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- Fix leak in the patch, and revert a couple of lines I didn't mean to commit
-
- * zend_execute.c: - Warn about illegal offsets
- - Allow assignments to uninitialized string offsets (automatically pads the
- string with spaces)
-
-2001-06-26 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- Fixed autoconversion of negative values to double (Fix bug #11685)
-
-2001-06-26 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Fix crash bug (fix by Jani).
-
-2001-06-24 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Bump Zend version
-
-2001-06-21 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_execute_locks.h
- zend_globals.h:
- - Hopefully fix bug #11476 and improve garbage to be freed very quickly.
- Tree tagged as PRE_GRANULAR_GARBAGE_FIX before commiting.
-
- * zend_execute_locks.h:
- - Use inline instead of macro for PZVAL_LOCK()/PZVAL_UNLOCK() so that it
- can be debugged.
-
- * zend_execute.c
- zend_execute.h
- zend_execute_API.c:
- - Nuke dependency of all of PHP on zend_execute_locks.h.
-
-2001-06-21 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- Eliminate the leak that the original bogus code tried to solve
-
- * zend_compile.c
- zend_execute.c
- zend_globals.h:
- parent::methodname() now works better with runtime classes (fix bug #11589)
-
- * zend_execute.c:
- Fix bug #11590 (I want Andi to also review this patch before it goes into 4.0.6)
-
-2001-06-20 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - MFH
-
- * zend_execute.c: - Fix string offsets crash.
-
-2001-06-19 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c: - Real MFH of memory fragmentation patch
-
- * zend_alloc.c: - Bad merge. Revert the previous patch (damn CVS).
-
- * zend_alloc.c: - MFH
-
- * zend_alloc.c:
- - Fix memory fragmention problem which could lead to web server processes
- growing much more than they should. (bug #11344?)
-
- * zend_execute.c
- zend_execute.h: - MFH
-
-2001-06-19 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c
- zend_execute.h: Add missing exports
-
- * zend_execute.c: Fix warning
-
-2001-06-13 Zeev Suraski <zeev@zend.com>
-
- * zend.c: MFH
-
- * zend.c:
- Avoid crashing if the error reporting function is called after a bailout during shutdown
-
-2001-06-12 Zeev Suraski <zeev@zend.com>
-
- * zend_highlight.c:
- Improve XHTML compliance (suggested by Anil Madhavapeddy)
-
-2001-06-10 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Fix ZTS build problem
-
-2001-06-07 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h: - Avoid breaking op_array compatibility for 4.0.6
-
-2001-05-30 Zeev Suraski <zeev@zend.com>
-
- * Zend.m4
- zend_execute_API.c: Add missing check
-
-2001-05-25 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Change if() to while() to make sure we skip enough opcodes
-
- * zend_compile.c: - MFH
-
- * zend_compile.c: - Fix memory leak
-
-2001-05-23 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c:
- Fix segfault -- need to copy-construct constant value.
-
-2001-05-21 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: Moving some functions into Zend.
-
-2001-05-20 sascha <sascha@pb1.pair.com>
-
- * .cvsignore: ignore ylwrap
-
-2001-05-20 Andi Gutmans <andi@zend.com>
-
- * zend_list.h: - The previous name could be confused with resource #
-
- * zend_list.c
- zend_list.h:
- - Whitespace and change the name of the macro to something more verbose
- ZEND_GET_RESOURCE_ID(...)
-
-2001-05-20 James Moore <James@phpuk.org>
-
- * zend_list.c
- zend_list.h: - Add new ZEND_GET_LE macro for retrieving destructor
- id's from remote extensions. (Jmoore, Zend Engine)
-
-2001-05-20 Andi Gutmans <andi@zend.com>
-
- * zend_list.c: - Don't allow resource types of 0
-
-2001-05-19 sascha <sascha@pb1.pair.com>
-
- * zend_hash.c: Fix segfault when using zend_hash_add_empty_element
-
-2001-05-18 Thies C. Arntzen <thies@thieso.net>
-
- * zend_alloc.c: reset allocated_memory_peak after each request.
-
-2001-05-17 Zeev Suraski <zeev@zend.com>
-
- * zend_language_scanner.l: That's slightly clearer that way :)
-
- * zend_alloc.c: Fix build
-
- * zend.c: MFH
-
- * zend.c: Fix corruption issue
-
-2001-05-16 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c
- zend_hash.h:
- Implement zend_hash_add_empty_element() using the existing infrastructure
-
- * zend_globals.h: Commit missing fix
-
- * Zend.m4
- zend_alloc.c
- zend_globals.h: Merge memory usage into memory limit
-
-2001-05-14 sascha <sascha@pb1.pair.com>
-
- * zend_hash.c:
- Initialize empty pDataPtr to a pseudo value to prevent a pefree on
- pData.
-
-2001-05-12 Andi Gutmans <andi@zend.com>
-
- * zend_variables.c: - Remove check for ht == NULL in copy_ctor.
- If ht is NULL at this point then we are better off crashing and fixing
- the bug that caused it.
-
-2001-05-11 sascha <sascha@pb1.pair.com>
-
- * zend.h: add missing closing paranthesis
-
- * zend_hash.c: Some extensions don't associate any data with hash entries,
- except the key. Prior to this change, a separate chunk of memory
- was allocated in that case to store exactly zero bytes (plus
- memory manager overhead). We treat that case similar to the
- pointer case, but don't copy any data at all (because the pointer
- is usually the NULL pointer).
-
- * zend_constants.c:
- Fix a memory leak which occured upon registering an already existing
- constant.
-
-2001-05-11 Thies C. Arntzen <thies@thieso.net>
-
- * Zend.m4
- zend_alloc.c
- zend_globals.h: added --enable-memory-usage-info
-
-2001-05-11 Andi Gutmans <andi@zend.com>
-
- * zend_opcode.c: - MFH
-
- * zend_opcode.c:
- - Fix crash bug when opcodes array is erealloc()'ed to a different memory
- area before it reaches the loop.
- - Some whitespace stuff
-
-2001-05-10 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- Treat numeric strings as numbers in the increment operator
-
-2001-05-09 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c: Nuke unused variable.
-
- * zend_API.c: Fix a few bugs in zend_is_callable() and make it stricter.
-
-2001-05-08 Andi Gutmans <andi@zend.com>
-
- * zend_language_scanner.l: - Fix line numbers when some lines end with \r
-
- * zend_opcode.c: - Fix crash bug reported by DBG author Dmitri Dmitrienko.
-
-2001-05-07 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Make zend_execute_scripts() reentrant
-
-2001-05-06 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_compile.c
- zend_compile.h:
- Recover from a parse error in include files (before, it could result in a crash under certain circumstances). Fix bug #8663
-
-2001-05-06 Andi Gutmans <andi@zend.com>
-
- * .cvsignore: - .cc files were renamed. Update .cvsignore.
-
-2001-05-06 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.h: Yikes, that would have been a very bad bug :)
-
- * zend_execute.c:
- Floating point keys didn't work in array() (fix bug #6662)
-
- * zend_compile.c
- zend_execute_API.c:
- Hear hear, interactive mode is finally showing some progress:
- - Support function calls
- - Fix crash bug
-
- * zend_compile.h
- zend_language_parser.y
- zend_language_scanner.l: Support interactive mode in thread-safe builds
-
- * zend_operators.h: Fix autoconversion of hexadecimal strings
- It's time to close bug #5404 :)
-
- * zend_highlight.c: Retain single spaces as spaces to condense HTML
-
-2001-05-02 Andi Gutmans <andi@zend.com>
-
- * zend_ini_scanner.l: - Support \r as newline in the ini scanner
-
- * zend_language_scanner.l: - Handle MAC OS X \r line endings
-
- * zend_execute.c:
- - Patch by Andrei to prevent crash in error situation when not all
- object overloading handles are defined.
-
-2001-05-01 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Bump up Zend version
-
-2001-04-30 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Add mistakenly removen closing bracket
-
- * zend_builtin_functions.c: - Get rid of warning
-
- * zend_alloc.c:
- - Try to solve crash on OS400. There is actually no reason I can see for
- why his fix should solve a crash but it doesn't harm.
-
- * zend_execute_API.c: - Fix crash bug in interactive mode
-
-2001-04-29 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.h: - Whitespace
-
- * zend_alloc.c
- zend_alloc.h: - Improve overwrite detection in debug mode.
-
- * zend_operators.c:
- - Previous patch for too early freeing of resources seemed to have worked.
- - Clean it up a bit.
-
- * zend_operators.c:
- - Try and solve the too early resource destruction problem.
-
-2001-04-28 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_hash.c
- zend_language_scanner.l
- zend_operators.c: include limits.h if available
-
- * zend.h: Fix bug 5661
-
-2001-04-28 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - Move all cases into switch().
-
- * zend_alloc.c: - Just some little whitespace stuff.
-
- * zend_alloc.c:
- - Don't add/remove cached memory blocks from blocks list as this will slow
- - down performance a bit.
-
-2001-04-28 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- Resources weren't being properly destroyed by the convert_to_*() functions
-
-2001-04-27 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_builtin_functions.c
- zend_hash.c
- zend_language_scanner.l
- zend_operators.c
- zend_operators.h: - More whitespace fixes while I'm at it.
-
- * zend.h
- zend_alloc.c
- zend_builtin_functions.c
- zend_execute_API.c
- zend_extensions.c
- zend_language_scanner.l:
- - Whitespace changes to be standard like the rest of Zend
-
-2001-04-24 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Due to popular demand merge the foreach() crash fix.
-
-2001-04-24 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: MFH.
-
-2001-04-21 Andi Gutmans <andi@zend.com>
-
- * zend_llist.c
- zend_llist.h: - Add typedef for function pointer of llist dtor
-
-2001-04-20 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix for crash bug when using invalid arguments in the foreach() loop.
- - Reported by Yasuo Ohgaki
-
-2001-04-19 Andi Gutmans <andi@zend.com>
-
- * zend_API.h: - Patch from Jason Greene.
- - Make it easier to write PHP function definitions in more than just one .c
- file while accessing the same module globals.
-
-2001-04-17 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: small beautification
-
-2001-03-28 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c: Fix warning
-
- * zend_list.c: Make Windows happy
-
- * zend_list.c: Get rid of more redundant code
-
- * zend_list.c:
- Cleaner way of making sure resources start at 1 and not 0...
-
- * zend_list.c
- zend_list.h: Remove redundant code
-
-2001-03-27 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c
- zend_list.h: God knows what this code was doing...
-
-2001-03-26 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c:
- Updated get_class_methods() to take class instance as well as class name.
-
- * zend_builtin_functions.c:
- Making it possible to pass a class name to get_parent_class() as well
- as a class instance.
-
-2001-03-23 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: Fixing function name length.
-
-2001-03-19 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y:
- - Add support for isset($var1, $var2, $var3); - Will be true only if all
- - variables are set.
-
-2001-03-15 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y: - Nuke commented code
-
-2001-03-12 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c: Name length is already known.
-
-2001-03-12 Andi Gutmans <andi@zend.com>
-
- * zend_API.c: - Missed second place.
-
- * zend_API.c: - Nuke snprintf()
-
- * zend_language_scanner.l: - White space
-
- * zend_language_scanner.l:
- - Fix by Jani Taskinen <sniper@iki.fi> for whole path also to work
- with include_once()/require_once().
-
-2001-03-12 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c
- zend_API.h:
- Improve zend_is_callable() to the point where it's actually useful.
- Now it just needs to be invoked everywhere in PHP where a callback is
- expected.
-
-2001-03-11 Andi Gutmans <andi@zend.com>
-
- * Zend.m4
- acconfig.h: - Fix for Solaris.
-
-2001-03-10 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Whitespace
-
-2001-03-07 Zeev Suraski <zeev@zend.com>
-
- * zend_ini.h: Add missing #define's
-
- * zend_compile.c
- zend_execute.c: Make parent:: work in runtime bindings as well
-
-2001-03-06 sascha <sascha@pb1.pair.com>
-
- * Zend.m4: We actually only need AC_PROG_LEX here.
-
-2001-03-04 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix bug #8899 (thanks Jani)
-
-2001-03-03 sascha <sascha@pb1.pair.com>
-
- * Zend.m4: -Os is a valid GCC optimization level.
-
-2001-03-02 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Whitespace fix
-
-2001-02-28 Andrei Zmievski <andrei@ispi.net>
-
- * zend_execute_API.c: Do case-insensitive class name matching when parsing
- array('Class', 'method') structure.
- You guys can clean it up, if there is a better way.
-
-2001-02-27 Andi Gutmans <andi@zend.com>
-
- * zend_variables.c
- zend_variables.h: - Nuke zval_del_ref()
-
-2001-02-27 Andrei Zmievski <andrei@ispi.net>
-
- * zend_compile.c: Don't overwrite existing handlers with parent ones.
-
-2001-02-26 Andi Gutmans <andi@zend.com>
-
- * Zend.dsp
- ZendCore.dep
- ZendTS.dsp
- zend.c
- zend_API.c
- zend_API.h: - Rename modules.h to zend_modules.h
-
- * LICENSE: - One more copyright year update
-
- * zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.l
- zend_language_parser.y
- zend_language_scanner.h
- zend_language_scanner.l
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_static_allocator.c
- zend_static_allocator.h
- zend_variables.c
- zend_variables.h
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_builtin_functions.h
- zend_compile.c
- zend_compile.h
- zend_config.w32.h
- zend_constants.c
- zend_constants.h
- zend_dynamic_array.c
- zend_dynamic_array.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_fast_cache.h
- zend_globals.h
- zend_globals_macros.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_ini.c
- zend_modules.h: - Update copyright year
-
-2001-02-25 Andi Gutmans <andi@zend.com>
-
- * zend_modules.h: - Fix dll linkage warnings
-
-2001-02-24 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c
- zend_modules.h: - Add exports from Daniel Beulshausen
-
-2001-02-14 Stanislav Malyshev <stas@zend.com>
-
- * zend.h: allow more extensions with resources
-
-2001-02-13 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c: Move version registration to a more correct place
-
-2001-02-12 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c
- zend_operators.h: - Remove two unused functions
-
- * zend_execute_API.c: - Fix whitespace.
-
-2001-02-12 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c:
- Fix a bug that could cause corruption in case of an error during
- get_zval_ptr()
-
-2001-02-09 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Remove duplicate code and do a tiny optimization in DO_FCALL
-
-2001-02-05 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix string offset data corruption
-
-2001-02-04 Andrei Zmievski <andrei@ispi.net>
-
- * zend_execute_API.c:
- Allow passing class name as well as an object instance to call methods.
-
-2001-02-03 Andrei Zmievski <andrei@ispi.net>
-
- * zend_execute_API.c:
- Set the correct function state during execution. This is mainly to have
- get_active_function_name() to return proper value.
-
- * zend_compile.c: Inherit overloaded handlers.
-
-2001-02-01 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c
- zend_API.h:
- Added zend_is_callable() function that checks whether passed zval
- represents a valid and exiting callable construct.
-
-2001-01-31 Andi Gutmans <andi@zend.com>
-
- * zend_API.h
- zend_API.c: - Change unset() functions to null(). unset() is legacy
-
- * zend_API.h:
- - Quick fix. I'm for changing these to add_property_null() as we've nuked
- - unset.
-
-2001-01-27 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - That doesn't seem like a smart thing to do :)
- - I wonder if gcc optimized it out.
-
-2001-01-23 Thies C. Arntzen <thies@thieso.net>
-
- * zend_extensions.h
- zend_ini_scanner.h
- zend_list.c
- zend_list.h: fix a couple of warnings
-
- * zend_API.c: fixed crash in add_index_bool.
-
-2001-01-22 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.h: Make add_index_zval() available to the outside world.
-
-2001-01-21 Andi Gutmans <andi@zend.com>
-
- * zend.h:
- - Make people happy who like the Zend version number bumped up in parallel
- with PHP.
-
-2001-01-20 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_API.h:
- - Patch from Sterling. Add API calls to add zval's as array indeces/
- object properties. Add _ex functions which take the string length as an
- argument for better performance.
-
-2001-01-19 Andi Gutmans <andi@zend.com>
-
- * zend_API.h
- zend_API.c:
- - For Sterling. I wonder if not all of the API functions should take the
- - key_length as a parameter in order to save that strlen().
-
-2001-01-17 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix leak in fetch_dim_address() which was already fixed in
- - fetch_dim_object(). Take the oppertunity to make both use the same
- - function and not duplicate the code.
-
-2001-01-16 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c: Fix persistent resources, once and for all...
-
-2001-01-15 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_compile.c: Add free_estring()
-
-2001-01-12 Zeev Suraski <zeev@zend.com>
-
- * zend_istdiostream.h: Add newline
-
-2001-01-12 Rasmus Lerdorf <rasmus@php.net>
-
- * zend_highlight.c: Fix for bug number 8666
-
-2001-01-07 Zeev Suraski <zeev@zend.com>
-
- * zend_ini.c: Fix mismatch in return values
-
- * zend.c
- zend.h
- zend_alloc.c
- zend_ini.c
- zend_ini.h: - Remove backward dependency from PHP -> Zend
- - Rename get_ini_entry() as get_configuration_directive() for clarity
- (it doesn't use the INI subsystem, but the module-supplied function for
- retrieving configuration directives)
-
- * Zend.dsp
- ZendTS.dsp: Remove -S option on all bison calls
-
- * zend.c:
- Fix possibility of a crash during startup (very unlikely, but possible)
-
-2001-01-06 Zeev Suraski <zeev@zend.com>
-
- * ZendTS.dsp: Remove -S
-
-2001-01-06 Andi Gutmans <andi@zend.com>
-
- * zend_ini.c: - This slipped in by mistake.
-
-2001-01-05 Zeev Suraski <zeev@zend.com>
-
- * zend_ini.c
- zend_ini.h:
- Merge in some ZEND_API additions from Daniel Beulshausen (needed for the
- Win32 Apache module)
-
-2001-01-04 Andi Gutmans <andi@zend.com>
-
- * zend_list.c:
- - Make plist_destructor work like list_destructor to allow it to call
- extended destructors.
-
-2001-01-03 Zeev Suraski <zeev@zend.com>
-
- * zend.h: Fix Zend version while we're at it
-
- * zend_execute_API.c: Merge call_user_function_ex() fixes
-
- * zend_language_scanner.l: Merge line number corruption bug fix
-
- * zend_language_scanner.l:
- Fix another case of possible line number corruption
-
- * zend.h: Commit missing declaration
-
-2001-01-01 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Remove unreachable code
-
-2000-12-30 Zeev Suraski <zeev@zend.com>
-
- * zend_language_scanner.l
- zend_opcode.c: Fix possible corruption in line number information
-
-2000-12-27 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_globals.h
- zend_ini.c
- zend_ini.h
- ZendTS.dsp:
- Make the INI mechanism thread safe (or at least thread safer :)
-
-2000-12-26 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h:
- Use iostream.h instead of istream.h (IBM's compiler doesn't come with istream.h,
- and iostream.h should include it)
-
- * ZendTS.dsp
- zend_ini_scanner.l
- zend_istdiostream.h
- zend_language_scanner.l:
- - Use supplied istdiostream definition for the INI scanner too
- - Add Release_TSDbg configuration
-
-2000-12-24 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.h: This needs updating as well
-
- * zend_execute_API.c:
- More aggressive protection in call_user_function_ex()
-
-2000-12-23 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c:
- Fix a possible crash bug in call_user_function_ex(), if the function is
- in fact not a user function
-
-2000-12-22 sascha <sascha@pb1.pair.com>
-
- * zend.c
- zend_modules.h:
- Set the floating-point exception mask on FreeBSD to 0 (as do other
- FreeBSD system applications). Also bump up the module API number
- as the zend_hash_get_current_key change affects source and binary
- compatibility.
-
-2000-12-22 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_builtin_functions.c
- zend_execute.c
- zend_hash.c
- zend_hash.h:
- Allow get_current_key() not to return the key itself, instead of a duplicate
-
- * zend_hash.c: * Fixed a possible crash in get_class_methods()
-
-2000-12-19 Stanislav Malyshev <stas@zend.com>
-
- * zend_language_scanner.l: Add support for ASP tags in one-line comment
-
-2000-12-18 Andi Gutmans <andi@zend.com>
-
- * flex.skl: - Success! Yay!
-
- * flex.skl: - Yet another one.
-
- * flex.skl: - Testing
-
- * flex.skl: - No luck
-
- * flex.skl: - Make this damn commit stuff work.
-
- * flex.skl: - Testing
-
-2000-12-18 Stanislav Malyshev <stas@zend.com>
-
- * zend.c:
- Use HashPosition iterator instead of saving/restoring internal pointer
-
- * zend.c: Preserve internal pointer over print_r (fix #8289)
-
-2000-12-18 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Fix leak with useless statements such as "foo";
-
- * flex.skl:
- - Testing Sascha's CVS commit script which should work with branches.
-
- * flex.skl: - Testing
-
- * flex.skl: - Testin
-
-2000-12-18 Zeev Suraski <zeev@zend.com>
-
- * flex.skl: Test, ignore
-
-2000-12-18 Stanislav Malyshev <stas@zend.com>
-
- * zend_operators.c: Add notice when auto-converting array to string
-
-2000-12-17 Andi Gutmans <andi@zend.com>
-
- * zend_language_scanner.l:
- - Clean up the scanner a tiny bit while messing with it.
-
- * zend_language_scanner.l:
- - %> without asp_tags should not be treated as inline_html but as regular
- tokens. Of course the parser will die with a parse error which is the
- correct behavior.
-
- * zend_language_scanner.l:
- - Fix problem in one line comments with line endings such as ??>
-
-2000-12-17 Stanislav Malyshev <stas@zend.com>
-
- * zend_operators.c: Fix #8279 (-2147483647 > 2147483647).
-
-2000-12-14 Zeev Suraski <zeev@zend.com>
-
- * zend_modules.h: Update module_api_no
-
-2000-12-13 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h
- zend_execute_API.c:
- Fix call_user_function() with objects - it could leak under certain circumstances
-
-2000-12-12 Stanislav Malyshev <stas@zend.com>
-
- * zend_operators.c: Fix #8195: strncasecmp returns incorrect value
-
-2000-12-07 sascha <sascha@pb1.pair.com>
-
- * zend_builtin_functions.c:
- Hardcode strlen due to problems on SCO OpenServer 5.0.4 which defines
- strlen to __std_hdr_strlen.
-
-2000-12-07 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c: Whitespace fix
-
- * zend_compile.c: Allow var $foo = array(ABC => 1) constructs
-
- * zend_builtin_functions.c:
- Fix memory leak - get_current_key mallocs it's result, no need to
- copy it.
-
-2000-12-06 sascha <sascha@pb1.pair.com>
-
- * zend_hash.c:
- INIT_DATA/UPDATE_DATA assumed that pData elements of the size of a void
- pointer would actually be aligned like a void pointer. This lead
- to bus errors on architectures which don't allow unaligned 32-bit accesses.
-
-2000-12-05 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y:
- - Support for $var =& new foo() syntax. This allows you to use objects
- which create extra references to themselves in the constructor.
-
-2000-12-05 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.h: Expose all timeout functions
-
-2000-12-02 sascha <sascha@pb1.pair.com>
-
- * acconfig.h
- configure.in:
- Use the hardly-documented third parameter of AM_INIT_AUTOMAKE to suppress
- defining PACKAGE/VERSION.
-
-2000-11-27 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c:
- - Allow passing references which are returned from functions and new
- - statements to be passed by reference.
-
-2000-11-27 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c:
- Update class constants before trying to get default properties.
-
-2000-11-22 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Remove code which has been commented out for ages.
-
-2000-11-22 sascha <sascha@pb1.pair.com>
-
- * zend_execute.c
- zend_globals.h: Pass on the exit status
-
-2000-11-21 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c
- zend_operators.h: Fix build
-
-2000-11-21 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - The baby patch wasn't that innocent :)
-
-2000-11-21 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c:
- Sterling's patch to make get_defined_vars() simpler and better.
-
-2000-11-20 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - NEVER copy and paste :)
-
- * zend_compile.c
- zend_execute.c: - Baby patch towards making the damn pass-by-ref work.
-
-2000-11-20 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.h: Update API number
-
-2000-11-20 Stanislav Malyshev <stas@zend.com>
-
- * zend.h:
- Add macro to replace value of zval with another value while preserving
- referencing structure
-
-2000-11-20 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - This patch is broken and needs more thorough fixing.
-
-2000-11-19 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Try and fix the problem when sending references returned from a function by reference.
-
-2000-11-19 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.h: Fix Zend build for non ZTS
-
-2000-11-18 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Forgot to commit the non-debug build fix yesterday...
-
- * zend_alloc.c
- zend_alloc.h:
- Add thread-safety debugging information (idea - Dmitri Dmitrienko)
-
-2000-11-14 Stanislav Malyshev <stas@zend.com>
-
- * zend_language_scanner.l: Restore compatibility with old broken way
-
- * zend_language_scanner.l:
- Better 0x handling - not change non-0x number behaviour
-
- * zend_language_scanner.l:
- Attempt at better handling long 0x-numbers, like 0xffffffff
-
-2000-11-13 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.c
- zend_extensions.h: - Remove unused function
-
- * zend_extensions.h:
- - Use typedef's for function pointers so that we can easily define arrays
- - of these function pointers.
-
-2000-11-13 Stanislav Malyshev <stas@zend.com>
-
- * zend_llist.c:
- Fix zend_llist_apply_with_del - it should remove from list,
- not only call dtor
-
-2000-11-12 Zeev Suraski <zeev@zend.com>
-
- * ZEND_CHANGES: Test, ignore
-
-2000-11-11 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h: - Move SET_UNUSED() to header
-
- * zend_opcode.c: - Beautify by using the standard #define.
-
-2000-11-10 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h
- zend_compile.c: - Remove this damn thing once again.
-
- * .cvsignore: - Add files to .cvsignore thanks to Jon Parise
-
-2000-11-09 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h: - Maybe it's OK now? :)
-
- * zend_compile.c
- zend_compile.h: - Undo the previous commit for fixing $obj = new foo().
-
- * zend_compile.c
- zend_compile.h:
- - Commit experimental patch to fix the problem when doing $a = new foo()
- and the constructor assigns $this by reference to other symbol table
- elements. Thanks to Daniel J. Rodriguez on this one.
-
-2000-11-08 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c
- zend_extensions.h: Add ability to find extensions by name
-
-2000-11-06 sascha <sascha@pb1.pair.com>
-
- * zend_ini.c: Kill a misleading warning which is intended for old code
- which assumes sizeof(int) == sizeof(void *).
-
-2000-11-03 Andi Gutmans <andi@zend.com>
-
- * zend_ini_scanner.h: - Add trailing \n?
-
-2000-11-03 Zeev Suraski <zeev@zend.com>
-
- * zend_ini_scanner.l: Fix for bug #5571 (by mookid@sigent.ru)
-
-2000-11-03 Andi Gutmans <andi@zend.com>
-
- * Makefile.am: - Fix dependency.
-
-2000-11-03 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.h: Fix build
-
- * zend_operators.h: Add RESVAL macros
-
-2000-11-02 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Fix bug #7599
-
- * zend_language_parser.y
- zend_language_scanner.l: Missed those
-
- * zend_API.c
- zend_compile.c
- zend_compile.h: Maintain consistency
-
-2000-11-02 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y: - Replace do_exit() with zend_do_exit().
- - Problem reported by David Hedbor <david@hedbor.org>
-
-2000-11-02 Zeev Suraski <zeev@zend.com>
-
- * zend_ini_parser.y: Remove unnecessary variables
-
- * zend_ini.c:
- explicit declaration here too - sigh, way too early in the morning
-
- * zend_ini.h: oops
-
- * zend_ini.h: explicit declaration
-
-2000-10-31 Zeev Suraski <zeev@zend.com>
-
- * zend_highlight.h: Fix Apache build
-
- * zend_ini.c
- zend_ini.h: Remove unnecessary code, fix phpinfo()
-
- * Zend.m4: Require bison 1.28
-
-2000-10-30 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp: Fix non-thread-safe Windows build
-
- * zend_globals.h
- zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.h
- zend_ini_scanner.l: Final touches on the INI parser
-
-2000-10-30 Stanislav Malyshev <stas@zend.com>
-
- * Makefile.am: Another attempt to make it build
-
- * Makefile.am
- zend_ini_scanner.l: Fix build
-
-2000-10-29 Zeev Suraski <zeev@zend.com>
-
- * zend_ini_parser.y
- zend_ini_scanner.h
- zend_ini_scanner.l: Fix leaks
-
- * zend_alloc.h
- zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.h
- zend_ini_scanner.l: The new INI parser is showing some signs of life
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c:
- Fix a corruption bug, when erroneously allowing to send non-variables by reference (several
- bug-db reports seem to originate in this bug)
-
- * zend_extensions.c
- zend_ini_parser.y: Fix build
-
- * zend_ini_scanner.h: Forgot this one
-
- * Makefile.am
- ZendTS.dsp
- zend_globals.h
- zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.l: Generalization work
-
-2000-10-29 Stanislav Malyshev <stas@zend.com>
-
- * zend_extensions.c
- zend_extensions.h:
- Allow module to proclaim compatibility with any Zend version
-
-2000-10-29 Zeev Suraski <zeev@zend.com>
-
- * Makefile.am
- ZendTS.dsp
- zend_ini_parser.y
- zend_ini_scanner.l
- zend_language_scanner.l: Some more work on the INI parser/scanner
-
- * Makefile.am
- zend_ini_parser.y
- zend_ini_scanner.l: Initial step in rewriting the INI parsing mechanism
-
- * .cvsignore
- Makefile.am
- Zend.dsp
- ZendCore.dep
- ZendTS.dsp
- zend-parser.y
- zend-scanner.h
- zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_highlight.c
- zend_indent.c
- zend_language_parser.y
- zend_language_scanner.h
- zend_language_scanner.l: Unify the names of these last 3 files...
-
- * Zend.dsp
- ZendTS.dsp: Fix Windows build
-
- * Makefile.am
- zend_ini.c
- zend_ini.h
- zend_operators.c
- zend_operators.h:
- Initial steps to move the INI mechanism to the Zend engine
-
-2000-10-27 Andrei Zmievski <andrei@ispi.net>
-
- * zend_operators.h: Added macros for object properties and class entry.
-
-2000-10-26 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_modules.h: - Fix new -m on Windows
-
-2000-10-25 Andrei Zmievski <andrei@ispi.net>
-
- * zend_list.h: Remove the patch to register_list_destructors().
-
-2000-10-20 Andrei Zmievski <andrei@ispi.net>
-
- * zend_list.c
- zend_list.h: - Fixed a bug in zend_rsrc_list_get_rsrc_type()
- - Switched register_list_destructors() to use
- zend_register_list_destructors_ex() instead
-
-2000-10-19 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Constant expressions which are used multiple times need to be copy_ctored
-
-2000-10-18 Andi Gutmans <andi@zend.com>
-
- * zend_llist.c: - Fix whitespace
-
- * zend_extensions.c
- zend_llist.c
- zend_llist.h:
- - Try #2. Wasn't allowed to delete in the previous manner because we were
- in the middle of an llist_apply()
-
-2000-10-18 sascha <sascha@pb1.pair.com>
-
- * zend_fast_cache.h:
- Add explicit conversion from 'void *', otherwise ANSI C++ compilers
- will break out.
-
-2000-10-18 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.c: - Fix crash
-
-2000-10-17 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Fix copy&paste bug
-
-2000-10-15 Andi Gutmans <andi@zend.com>
-
- * zend_opcode.c:
- - Increase op_array size faster and make eralloc() it in the end to save
- memory.
-
-2000-10-14 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Add another patch from Sterling.
-
- * zend_builtin_functions.c:
- - Preliminary commit of Sterlings get_defined_functions()/get_defined_vars
- functions
-
- * zend_extensions.c:
- - Only run startup() if ZEND_EXTENSIONS is defined to 1.
- This fixes a link error on platforms which don't support libdl
-
-2000-10-13 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - Make increment of "" become "1"
-
-2000-10-11 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c
- zend_hash.h: Don't use 'new' symbol
-
-2000-10-11 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c
- zend_execute_API.c:
- Fix -a interactive mode (no idea how the previous commit got committed)
-
- * zend_execute.c: *** empty log message ***
-
- * zend.h: Update version
-
- * zend_hash.c
- zend_hash.h: Add zend_hash_merge_ex(), for selective merging
-
-2000-10-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.h: - Fix Bug #7061
-
-2000-10-05 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l:
- - Updated included_files() also for plain include()/require().
-
-2000-10-04 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c: - Fix fprintf
-
-2000-10-02 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.h: - Change zend_extension_api_no
-
-2000-09-30 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Cleanup error output
-
-2000-09-28 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c:
- - Another has optimization/fix like the hash_copy one from earlier on
-
-2000-09-28 Stanislav Malyshev <stas@zend.com>
-
- * zend_hash.c:
- Make hash_copy call copy constructor on a real copy, not on a temp
-
-2000-09-28 Andi Gutmans <andi@zend.com>
-
- * ZendTS.dsp: - Remove zend_gcc_inline.c
-
-2000-09-26 sascha <sascha@pb1.pair.com>
-
- * Makefile.am
- Zend.m4
- zend_execute.h
- zend_gcc_inline.c
- zend_operators.h:
- Remove --enable-c9x-inline option. We now use a syntax which is compatible
- with all compilers by providing the function with static linkage in every
- compilation unit.
-
-2000-09-25 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_extensions.c
- zend_extensions.h:
- Fix previous update - move extension startup further down the startup sequence
-
- * zend.c: Move extension startup further down the startup sequence
-
-2000-09-19 Andi Gutmans <andi@zend.com>
-
- * zend_operators.h: - Add Z_BVAL* macros
-
-2000-09-19 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute_locks.h:
- Fix crash on Solaris with function parameter destruction
-
-2000-09-18 Stanislav Malyshev <stas@zend.com>
-
- * zend_builtin_functions.c:
- Made get_included_files() work again, in somewhat different way
-
-2000-09-17 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c: Set filename even on recursive include
-
-2000-09-14 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix NULL handling in ARRAY opcode and resolve memory leak
-
-2000-09-12 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend.c
- zend_builtin_functions.c
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_highlight.h: Make compile_string() accept a description of the code
-
-2000-09-11 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Forgot to create extended info in include()/require() call
-
-2000-09-10 Stanislav Malyshev <stas@zend.com>
-
- * zend-parser.y: Allow require_once to take expressions, just like require
-
- * ZEND_CHANGES: Try once more to remove dups
-
- * ZEND_CHANGES: Test commit - weed out duplicate messages
-
-2000-09-09 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Don't use unsafe sprintf()
-
-2000-09-08 Stanislav Malyshev <stas@zend.com>
-
- * zend.c: Don't trust snprintf return
-
-2000-09-06 Andi Gutmans <andi@zend.com>
-
- * zend_config.w32.h: - Save two lines
-
- * zend_config.w32.h: - Fix header
-
-2000-09-06 sascha <sascha@pb1.pair.com>
-
- * Zend.m4: Unless overwritten, default to no optimization in debug mode.
-
-2000-09-05 Andi Gutmans <andi@zend.com>
-
- * zend_operators.h
- zend_operators.c: - Commiting Sterling's new multi_convert* functions
-
-2000-09-05 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: Fix memory overrun.
-
-2000-09-05 Stanislav Malyshev <stas@zend.com>
-
- * zend_builtin_functions.c:
- Fix crash with trigger_error having no args (#6549)
-
-2000-09-04 Andi Gutmans <andi@zend.com>
-
- * Makefile.am: - Remove two tabs
-
-2000-09-02 Andi Gutmans <andi@zend.com>
-
- * ZendTS.dsp:
- - Defining TSRM_WIN32 in each and every dsp sucked. Revert this change
-
- * ZendTS.dsp: - Fix windows build
-
-2000-08-31 Andi Gutmans <andi@zend.com>
-
- * ZendTS.dsp:
- - This should fix the performance problem with Release builds
-
- * zend-scanner.l
- zend.c
- zend_execute.c:
- - Use emalloc() for opened_path now. This was a potential leak before.
- - This patch has potential to break stuff but I tested it as much as I
- - could. Fixes should be easy.
-
- * zend.c: - Remove support for __string_value() in print $obj
-
-2000-08-31 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Safer shutdown process
-
-2000-08-29 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Update Zend version.
-
-2000-08-26 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Don't define this function in non-debug mode
-
-2000-08-24 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Revert patch from 9/7/2000 which seems to have broken unset().
- - I hope what made me do this patch doesn't appear again.
-
-2000-08-22 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c:
- - Fix bug report by Andrei when using a method as a sort user function
- - parameter in usort() like functions
-
-2000-08-20 Zeev Suraski <zeev@zend.com>
-
- * zend_config.w32.h: Fix Win32 build
-
-2000-08-20 sascha <sascha@pb1.pair.com>
-
- * zend_config.w32.h:
- _isnan seems to be supported on Win32, add an appropiate macro.
-
- * acconfig.h: If available, use fpclassify for substituting zend_finite.
-
- * acconfig.h:
- Including math.h before using macros defined there will work better :)
-
- * acconfig.h: Add zend_isinf and zend_isnan.
-
-2000-08-19 Andrei Zmievski <andrei@ispi.net>
-
- * zend-scanner.l: One more fix to C compile.
-
-2000-08-19 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: Fix C build
-
- * zend-scanner.l: Fix eval() leakage in ZTS mode
-
- * zend_compile.c
- zend_globals.h: Eliminate run-time leak with eval()'s
-
- * zend_alloc.c: Fix build with no memory_limit
-
- * zend_alloc.c: Fix memory_limit
-
-2000-08-19 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Beautify
-
-2000-08-17 Stanislav Malyshev <stas@zend.com>
-
- * zend_API.h: Fix EMPTY_STRING macros
-
-2000-08-15 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.h
- zend-scanner.l
- zend.c
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- Fix warning issue (compile errors inside require()'d files were incorrectly supressed)
-
-2000-08-14 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: - Fix leak and some logic
-
-2000-08-14 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c:
- - This patch should hopefully fix situations where a constructor uses
- - the $this pointer as a reference.
-
-2000-08-14 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c: Fix crash
-
-2000-08-14 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.h:
- - Unused results should be marked with EXT_TYPE_UNUSED and not IS_UNUSED
-
-2000-08-13 Stanislav Malyshev <stas@zend.com>
-
- * zend-scanner.l
- zend.c
- zend_compile.c
- zend_compile.h
- zend_execute.c: Fix zend_fiel_handle handling. Should fix URL include
- and various opened_path inconsistencies.
-
-2000-08-13 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y:
- - Revert foreach() change which only allowed variables and array(...)
-
-2000-08-11 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y: - Only support variables and array(...) in foreach loops
-
-2000-08-10 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- Fix problem with nested foreach()'s (Andi, Zend Engine)
-
- * zend_compile.c:
- Fix switch which only has a default rule (Andi, Zend Engine)
- Change require_once() to use the same file list as include_once().
- Patch includes making require() & include() to behave the same when it
- comes to scoping. require() is now an include() which isn't allowed to fail.
- require() caused too many memory reallocations which ended up being quite
- slow for sites that required lots of files. (Andi & Zeev, Zend Engine)
- - Fix switch() which only has default rule (bug #5879,
-
-2000-08-09 Zeev Suraski <zeev@zend.com>
-
- * zend_modules.h: that too
-
- * zend_extensions.h: Update API number
-
- * zend-parser.y
- zend-scanner.l
- zend.c
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_opcode.c:
- The patch we promised - redesigned the compilation/execution API:
- Advantages:
- - Smaller memory footprint for the op arrays
- - Slightly faster compilation times (due to saved erealloc() calls and faster zend_op
- initialization)
- - include_once() & require_once() share the same file list
- - Consistency between include() and require() - this mostly means that return()
- works inside require()'d files just as it does in include() files (it used to
- be meaningless in require()'d files, most of the time (see below))
- - Made require() consistent with itself. Before, if the argument was not a constant
- string, require() took the include() behavior (with return()).
- - Removed lots of duplicate code.
- Bottom line - require() and include() are very similar now; require() is simply an include()
- which isn't allowed to fail. Due to the erealloc() calls for large op arrays, require()
- didn't end up being any faster than include() in the Zend engine.
-
-2000-08-05 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Use some more SEPARATE_ZVAL macros instead of replicated code.
-
-2000-08-05 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c: Fix memory leak
-
-2000-08-04 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_execute.c:
- - Beautify code. Try and use more macros for splitting instead of
- - replicating the code everywhere.
-
-2000-08-02 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Remove commented code
-
-2000-07-29 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend_execute.c: Fix filename issues
-
-2000-07-28 Stanislav Malyshev <stas@zend.com>
-
- * zend_builtin_functions.c
- zend_constants.c
- zend_constants.h:
- Make define return false and issue E_NOTICE when trying to redefine constant
-
-2000-07-27 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l
- zend_execute.c: Always store full filename as compiled file name
-
-2000-07-26 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Fix a possible issue with runtime inheritence under fairly rare circumstance
- and optimize a tiny bit
-
-2000-07-26 Stanislav Malyshev <stas@zend.com>
-
- * zend_builtin_functions.c
- zend_operators.c
- zend_operators.h: Add strncasecmp function
-
-2000-07-18 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c: Forgot to link this function...
-
- * zend_hash.c: This is probably the oldest bug in PHP :)
- Luckily it's unlikely we're ever actually bitten by this bug.
-
-2000-07-16 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Beautify Zeev's patch a bit.
-
-2000-07-16 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Implement parent::foo()
-
-2000-07-15 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend_compile.c: Add more extended_info calls
-
-2000-07-14 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c
- zend_list.c
- zend_list.h: Improve register_resource_ex() infrastructure
-
-2000-07-12 Thies C. Arntzen <thies@thieso.net>
-
- * zend.c: fix ZTS startup without filename (thanx purify!)
-
- * zend.c: unset active_symbol_table on zend-shutdown.
-
-2000-07-11 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c: Another persistent hash - disable apply protection
-
- * zend.c
- zend_hash.c
- zend_hash.h:
- Disable the hash_apply() protection on hashes that persist across requests - it's unsafe
- because we may be aborted at any point
-
-2000-07-11 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c:
- Fix a bug in passing second parameter of RECV_INIT with is_ref set
-
-2000-07-11 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h: - Oops. Too early in the morning
-
- * zend_compile.h: - Include iostream.h in C++.
-
-2000-07-09 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fix memory leak.
-
- * zend_execute.c: - Need to seperate if the hash isn't a reference
-
-2000-07-08 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Add zend_ulong
-
-2000-07-07 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c: Remove C++ commennts.
-
-2000-07-06 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l:
- - Remove code which has never been used (neither in PHP 3)
-
- * zend_compile.c:
- - Make is_method_call() static and remove a couple of old lines
-
- * zend_execute.c
- zend_extensions.h: - Yet another fix...
-
- * zend_execute.c: - One more...
-
- * zend_compile.c: - One more fix for the latest patch
-
- * zend_compile.c: - One dumb bug in my latest patch
-
- * zend-parser.y
- zend_compile.c
- zend_execute.c:
- - Complex fix for solving a problem with objects & method calls.
- - Previous version is tagged PRE_METHOD_CALL_SEPERATE_FIX_PATCH.
- - I need to check this fix on a server so if it doesn't work I will revert
- - it.
-
- * zend-scanner.l:
- - Fix problem with newlines not being recognized under certain conditions
-
-2000-07-03 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Fix bug #4120
-
-2000-07-03 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute_API.c: Unblock SIGPROF signal when starting timer.
- On Linux, this signal is blocked by default after first signal is run
-
-2000-07-03 sascha <sascha@pb1.pair.com>
-
- * FlexLexer.h
- zend-scanner.h
- zend_alloc.h
- zend_compile.h
- zend_constants.h
- zend_dynamic_array.h
- zend_execute.h
- zend_globals.h
- zend_hash.h
- zend_highlight.h
- zend_list.h
- zend_operators.h
- zend_static_allocator.h
- zend_variables.h:
- Replace macros which begin with an underscore through an appropiately
- named macro.
-
-2000-07-02 sascha <sascha@pb1.pair.com>
-
- * zend.h
- zend_API.h
- zend_builtin_functions.h
- zend_config.w32.h
- zend_dynamic_array.h
- zend_errors.h
- zend_execute_locks.h
- zend_extensions.h
- zend_fast_cache.h
- zend_globals_macros.h
- zend_indent.h
- zend_llist.h
- zend_modules.h
- zend_ptr_stack.h
- zend_stack.h: Change header protection macros to conform to standard.
-
- Draft 3 of IEEE 1003.1 200x, "2.2 The Compilation Environment"
-
- All identifiers that begin with an underscore and either an uppercase
- letter or another underscore are always reserved for any use by the
- implementation.
-
-2000-07-02 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y: - Take #2 with tab size 4
-
- * zend-parser.y:
- - Beautify parser a bit. It still could do with some more at some point
-
- * zend_execute.h
- zend_execute_API.c: - Forgot ZEND_API
-
-2000-06-30 Zeev Suraski <zeev@zend.com>
-
- * zend_config.w32.h:
- Add a messagebox style that's safe to use from an ISAPI filter
-
- * zend_builtin_functions.c
- zend_execute_API.c
- zend_globals.h: error_reporting fix
-
-2000-06-29 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h: Add $context argument to error handler
-
-2000-06-28 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Improve error handling code
-
- * zend-scanner.l: Be HTML friendly
-
-2000-06-28 Andi Gutmans <andi@zend.com>
-
- * zend.h: version update
-
-2000-06-26 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_constants.c
- zend_extensions.h:
- Make it possible to detect whether we're thread safe or not from PHP scripts and the php.ini
- file
-
-2000-06-26 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.c: - Add another "\n" at the end of error messages.
-
-2000-06-26 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c:
- Make max_execution_time work properly when set to 0 under Win32 (disable)
-
-2000-06-25 Andi Gutmans <andi@zend.com>
-
- * zend.c: - I wrote a long msg but the commit didn't go through.
- - So here is the short version:
- - a) Start moving to binary opens in Windows
- - b) Give checkuid_mode() a small face lift including the fopen-wrappers.c
- - The mode to this function should at least be a #define but that is for
- - another day. Anyway this whole stuff should be given more face lifts in
- - the future.
-
-2000-06-24 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Nuke a warning
-
-2000-06-23 Andi Gutmans <andi@zend.com>
-
- * zend_static_allocator.c
- zend_static_allocator.h: - Not returning a value anymore
-
- * zend_static_allocator.h: - Don't need SUCCESS/FAILURE anymore
-
- * zend_static_allocator.c
- zend_static_allocator.h: - Add license
-
- * zend_static_allocator.c
- zend_static_allocator.h:
- - Commit static allocator structure which we might use in an upcoming Zend
- - change
-
-2000-06-22 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l: - Fix asp_tags.
-
- * zend_extensions.c: - Oops I miss-wrote that field
-
- * zend_extensions.c
- zend_extensions.h:
- - Change API version and make the error messages more meaningful.
-
- * zend_alloc.c
- zend_alloc.h: - Change cache size and only initialize part of it.
-
-2000-06-22 Stanislav Malyshev <stas@zend.com>
-
- * zend_alloc.c:
- Cached-freed memory blocks should not be in "occupied" list
-
- * zend_alloc.c
- zend_globals.h: Make cache counters to be unsigned int
- Start collecting statistics after cache pre-fill
-
-2000-06-18 sascha <sascha@pb1.pair.com>
-
- * Zend.m4
- acinclude.m4
- zend.c: fp_except check for FreeBSD 1.0-2.2.5
-
- * Zend.m4
- acconfig.h
- zend_config.w32.h
- zend_operators.h: Welcome zend_finite(n).
-
- This chooses the best combination of what is available:
-
- finite, isfinite, isinf, isnan
-
-2000-06-18 Stanislav Malyshev <stas@zend.com>
-
- * zend.h
- zend.c: Make error callback be publicly accessible
-
-2000-06-18 Andi Gutmans <andi@zend.com>
-
- * zend.c: - Better FreeBSD fix. Does fp_except_t exist on 3.4?
-
- * zend.c:
- - I don't know how this happened. I tested the bloody thing and I remember
- - copy&pasting from code which used ~.
-
-2000-06-17 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c
- zend_execute_API.c
- zend_globals.h
- zend_ptr_stack.c
- zend_ptr_stack.h: - Add restore_error_handler()
- error_handler's are now stored in a stack
-
- * zend-scanner.l
- zend.c
- zend_API.h
- zend_execute_API.c:
- Allow the symbol_table to be passed to call_user_function_ex()
-
- * zend-scanner.h
- zend-scanner.l: Fix filenames and line numbers in ZTS mode
-
- * zend_hash.c
- zend_hash.h:
- Avoid crashing with recursive applies - limit apply nest level to 3 (I'm not aware of a place
- in which applying recursively on the same hash makes sense with more than one nest level, but
- 3 should be enough)
-
-2000-06-16 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h:
- Ok, this time here's some real Win32 system programming :)
- Redesigned the timeout system using a single timeout thread and a single window,
- and used a much quicker check.
-
-2000-06-16 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c: Fix UNIX build
-
-2000-06-16 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Macro it up the right way
-
- * zend_execute.c: Macro this up, so it can be moved to other places
-
- * zend.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h: - Move timeout code to Zend
- - Implement timeouts in Win32
-
-2000-06-15 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp
- zend.c:
- Fix non thread-safe mode - asp_tags/short_tags etc weren't getting initialized properly
-
-2000-06-15 Andi Gutmans <andi@zend.com>
-
- * zend_list.c: *** empty log message ***
-
- * zend-parser.y: - Support multiple arguments to unset()
-
-2000-06-15 Thies C. Arntzen <thies@thieso.net>
-
- * zend_list.h: ups.
-
- * zend_list.h:
- changed return type of ZEND_VERIFY_RESOURCE from FALSE to NULL
-
-2000-06-14 sascha <sascha@pb1.pair.com>
-
- * zend_operators.h
- zend_operators.c:
- Move some stuff to zend_operators.h which is required by the
- moved inline functions.
-
-2000-06-14 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c
- zend_alloc.h: - More correct way of doing bit mask
-
-2000-06-14 sascha <sascha@pb1.pair.com>
-
- * Zend.m4: Only replaced C0X and C0x, but not c0x..
-
- * Zend.m4
- zend_execute.h
- zend_gcc_inline.c
- zend_operators.h:
- Rename C0x-inline to C9x-inline, and frame preprocessor directives in
- zend_gcc_inline.c with #ifndef C9X_INLINE_SEMANTICS..#endif.
-
-2000-06-14 Andi Gutmans <andi@zend.com>
-
- * ZendTS.dsp: - Make Win32 build
-
-2000-06-13 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h: Add to the API
-
-2000-06-13 sascha <sascha@pb1.pair.com>
-
- * Makefile.am
- Zend.m4
- zend_API.h
- zend_compile.h
- zend_execute.h
- zend_execute_API.c
- zend_gcc_inline.c
- zend_globals.h
- zend_operators.c
- zend_operators.h: Add optional support for C0x inline semantics.
-
- These are enabled by specifying `--enable-c0x-inline' on the command
- line. We might add an autoconf check for this particular feature
- later.
-
- * zend_llist.h:
- Add llist_apply_func_t and make prototypes use the typedefs.
-
-2000-06-12 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c: Make Egon happy :)
-
- * zend_builtin_functions.c:
- Return the previous error handler from set_error_handler()
-
- * zend_API.c
- zend_API.h
- zend_builtin_functions.c:
- Avoid using E_CORE_* errorlevels in any place which is not in the global startup sequence
-
- * zend-parser.y
- zend-scanner.l
- zend.h
- zend_compile.c: Get rid of <?php_track_vars?>
-
-2000-06-11 Andi Gutmans <andi@zend.com>
-
- * zend.c: - Solve floating point precision crash on FreeBSD.
-
- * zend.c:
- - Fixes crash problem on FreeBSD when losing precision. Need to still see
- - how to detect we're on FreeBSD
-
-2000-06-11 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c: Fix zend_get_parameters()
-
-2000-06-10 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c:
- - Fixed problem when using uninitialized values in comparisons with strings.
- - They behave as empty strings again just like in PHP 3.
-
-2000-06-10 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- I can't think of a reason of why it should just be a notice... Make it a warning, like it was in PHP 3.
-
- * zend_API.c
- zend_builtin_functions.c: Fix bug #4768
-
-2000-06-09 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c
- zend_hash.h: Made an alias for hash apply with arguments.
-
-2000-06-09 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c: - Forgot to remove the FIXME
-
- * zend_alloc.c: - Make the memory limit accurate
-
- * zend_alloc.c: - Fix cache initialization
-
- * zend_alloc.c
- zend_alloc.h:
- - Allocate and cache in 8 byte blocks. Most allocators anyway use 8 byte
- - blocks. This should help fragmentation and cache hits.
- - The old tree is tagged as PRE_EIGHT_BYTE_ALLOC_PATCH
-
-2000-06-09 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix bug #4933
-
- * zend_builtin_functions.c: Fixed bug #4819
-
-2000-06-09 Andi Gutmans <andi@zend.com>
-
- * zend_modules.h:
- - Time to change it. We changed register_internal_class() ->
- - zend_register_internal_class()
-
- * zend_API.c
- zend_API.h
- zend_compile.c
- zend_compile.h: - Andrei, this is for you!
- - Add zend_register_internal_class_ex() which allows you to specify a
- - parent to inherit from. You can either specify the parent directly or via
- - its name.
-
- * zend-parser.y
- zend-scanner.l: - Typo
-
- * zend_execute.c: - Remove old obsolete code.
-
- * zend_execute.c: - Make unset consistent with the way array offsets work
-
-2000-06-09 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c: Handle unset with empty key
-
-2000-06-09 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_API.h:
- - Change register_internal_class to zend_register_internal_class for
- - consistency.
- - Andrei: I'm still thinking about the _ex you want me to implement
-
-2000-06-08 sascha <sascha@pb1.pair.com>
-
- * Zend.m4
- acconfig.h: Clean up acconfig.h
-
- * zend_execute_API.c
- zend_operators.c: Add a couple of casts
-
-2000-06-06 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_compile.c:
- Enable asp_tags/short_tags/allow_call_time_pass_by_reference to work on a per-directory
- basis as well
-
-2000-06-06 sascha <sascha@pb1.pair.com>
-
- * zend_API.c:
- Add newline at the end of the file (breaks at least SCO and Tru64 C compiler).
-
-2000-06-05 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l: - Revert internazionalization fix.
-
- * zend_builtin_functions.c: - Complete change to create_function()
-
-2000-06-04 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_execute_API.c:
- Change shutdown order to sort out a crash when assigning a resource id to a static.
-
- * zend_hash.c
- zend_hash.h
- zend_operators.c: - Support unordered hash comparisons
- - Make == perform an unordered comparison with arrays/objects, and === perform an ordered comparison
-
- * zend_builtin_functions.c: Rename lambda()
-
-2000-06-03 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c
- zend_hash.h
- zend_operators.c
- zend_operators.h:
- Support comparisons of arrays (with arrays) and objects (with objects)
-
-2000-06-03 Andi Gutmans <andi@zend.com>
-
- * zend.c: - Change #if to #ifdef.
-
-2000-06-03 Zeev Suraski <zeev@zend.com>
-
- * ZendTS.dsp
- zend.c: Don't take chances with new include files
-
- * zend_execute_API.c:
- Improve call_user_function() to support array($obj, $method)
-
- * zend-parser.y
- zend.h
- zend_operators.c: - Export normalize_bool
- - This global/static syntax fix brought us back to the 4 documented conflicts
-
- * zend_builtin_functions.c: Fix a lambda() bug
-
- * zend_builtin_functions.c: Add missing {
-
- * zend_globals.h
- zend_hash.c
- ZendTS.dsp
- zend-scanner.l
- zend.c
- zend.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h: - Fix Win32 compilation (Use winsock2.h from now on)
- - Add lambda() support
-
-2000-06-02 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y: - global/static require a trailing ';'
-
-2000-06-02 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c: Update error code
-
- * zend.c
- zend.h
- zend_config.w32.h: Nuke the old error code, use the new one
-
-2000-05-31 Zeev Suraski <zeev@zend.com>
-
- * zend.h: IS_BC isn't really being used, but still...
-
- * zend-parser.y
- zend.h
- zend_API.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.h
- zend_variables.c:
- Fix a bug in static initializers/default values/class member variables that contained
- array values
-
-2000-05-29 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c
- zend_API.h: Allow disabling of functions for security reasons
-
-2000-05-28 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c:
- - Use pointer arithmetic to speed up the function a bit
-
- * Zend.m4: - This should have been done for 4.0.0.
- - Default build is without debug now. Use --enable-debug if you want a
- - debug build which includes leak/memory overwrite etc. detection
-
-2000-05-26 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l
- zend_operators.c
- zend_operators.h:
- - Fixed scanning decimal numbers in internationalized environments. They should
- - always be in standard US format e.g. 23.3
-
-2000-05-25 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Fix a crash bug in certain situations of class redeclarations
-
-2000-05-24 Thies C. Arntzen <thies@thieso.net>
-
- * zend_hash.h: rename hastable -> _hashtable to avoid clashes
-
- * zend-scanner.l:
- add rdbuf() to our own istdiostream implementation, allowing C++ compile
- using SUN and SGI native compilers. (by Jayakumar Muthukumarasamy <jk@kasenna.com>)
-
-2000-05-22 Zeev Suraski <zeev@zend.com>
-
- * zend.c: - Remove ugly Ltd.
-
-2000-05-21 Sam Ruby <rubys@us.ibm.com>
-
- * zend.c: Windows build failure
-
-2000-05-21 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend_compile.h:
- - Fix Apache php source highlighting mode. It was crashing due to the
- - module shutdown functions being called when the startup functions weren't
- - being called.
-
- * zend.h
- zend_extensions.h: - Get ready for release
-
-2000-05-19 Zeev Suraski <zeev@zend.com>
-
- * zend_highlight.c
- zend_highlight.h: Open these up for the API
-
-2000-05-18 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Do it in thread unsafe mode for now.
-
-2000-05-18 sascha <sascha@pb1.pair.com>
-
- * zend_alloc.c: Kill warnings
-
-2000-05-18 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c: - Do this someplace else.
-
- * zend_execute.c
- zend_operators.c:
- - Fix include() when used on resources (shouldn't work but shouldn't crash
- either).
-
-2000-05-18 Andrei Zmievski <andrei@ispi.net>
-
- * zend_operators.c:
- Update for sort functions - user can now specify sort type.
-
-2000-05-17 Andi Gutmans <andi@zend.com>
-
- * zend_operators.h
- zend_operators.c:
- - Add support for string_compare_function() and number_compare_function().
- UNTESTED!
-
-2000-05-17 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Normalize results of compare_function()
-
- * zend-scanner.l:
- Fix crash if %> is encountered in HTML while ASP-tags are disabled
-
-2000-05-17 Andi Gutmans <andi@zend.com>
-
- * zend_opcode.c: Fix order
-
-2000-05-17 sascha <sascha@pb1.pair.com>
-
- * zend_operators.h: Add missing prototype
-
-2000-05-16 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c:
- - Small optimization. Filling up the Cache helps performance.
-
-2000-05-12 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: Fix parallel makes on BSD
-
-2000-05-11 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend-scanner.l
- zend.h
- zend_operators.c:
- Get rid of chval - it's really not necessary and seems to be confusing people
-
- * zend_compile.c: Refined fix
-
- * zend_compile.c:
- Fix a memory corruption bug with by-ref function arguments
-
-2000-05-10 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.h: - Bump up Zend extension version number
-
-2000-05-10 Thies C. Arntzen <thies@thieso.net>
-
- * zend_compile.c: make waning readable
-
-2000-05-08 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_opcode.c: Thoroughly initialize IS_UNUSED for proper cleanup
-
- * zend.h: - Change Zend Engine version number
-
- * zend_alloc.c: - Return real size allocated
-
-2000-05-08 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Make zend_binary_strcasecmp compile again
-
-2000-05-08 sascha <sascha@pb1.pair.com>
-
- * zend_operators.c: Make strcasecmp() act correctly WRT SUS II.
-
- Patch by: hholzgra@php.net
- PR: #3556
-
-2000-05-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.h
- zend_execute_API.c: - Make zend_eval_string() return SUCCESS/FAILURE
-
- * zend_execute.c:
- - Make $obj->test = 5; work again (assigning to uninitialized objects)
-
-2000-05-05 sascha <sascha@pb1.pair.com>
-
- * Zend.m4:
- Linking directly against libc might result in unexpected behaviour.
- We check for dlopen in libdl first, and check then whether dlopen exists.
-
-2000-05-03 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h: - Change fetch_type to be zend_uint
-
- * zend_compile.c
- zend_execute.c: - Change the place CAST uses for the op_type
-
-2000-05-02 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c
- zend_hash.h:
- Change zend_hash_get_current_key_ex() to also return the string length
-
-2000-05-02 sascha <sascha@pb1.pair.com>
-
- * zend_API.c:
- Fix segfault occuring when a temporary module was unloaded and if this
- module did not have a request shutdown function.
-
- * zend_API.h:
- Add ZEND_GET_MODULE(name). This is a short-cut for the common
- get_module function.
-
-2000-05-01 sascha <sascha@pb1.pair.com>
-
- * zend.c:
- Source file does not end with a newline. Some old compilers don't like that.
-
-2000-05-01 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: Added a way to get all declared classes.
-
-2000-05-01 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: Fix dependency
-
-2000-04-29 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.h
- zend_opcode.c:
- Pass the op_array to the ctor/dtor, instead of just the resource
-
- * zend_extensions.c: crash fix
-
- * zend_extensions.c
- zend_extensions.h
- zend_llist.c
- zend_llist.h: - Add zend_llist_apply_with_arguments()
- - Add a message handler to the extensions
-
- * zend_compile.h
- zend_opcode.c:
- Fix possible bug with extension dtors being called without the ctors being called first
-
- * zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_opcode.c: Beautify
-
-2000-04-28 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_extensions.c
- zend_extensions.h: Fix a bug in the resource dispencer
-
- * zend_operators.c
- zend_operators.h: Make convert_to_string() allocations traceable
-
-2000-04-27 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.h
- zend-scanner.l
- zend.c
- zend_compile.c
- zend_compile.h
- zend_execute.c: *** empty log message ***
-
- * zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_execute.c: Change to using the #define's
-
- * zend.c
- zend.h: More error handling work (still completely disabled)
-
-2000-04-26 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c
- zend_variables.c: Fix - forgot to split away if refcount>1
-
-2000-04-25 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c: Fix bug
-
- * zend.h: We'll need two...
-
- * zend_hash.h: Add useful macros
-
-2000-04-25 Andi Gutmans <andi@zend.com>
-
- * zend_llist.c: - Fix persistence of llist
-
-2000-04-24 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: - Forgot to keep the ':' in the class_name
-
- * zend_API.c: Correct fix
-
-2000-04-24 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.c: MODULE_TEMPORARY should get a call to RSHUTDOWN as well!
-
- * zend.c:
- fixed shutdown crash if MSHUTDOWN tries to php_error() something.
-
-2000-04-21 Thies C. Arntzen <thies@thieso.net>
-
- * zend_variables.c
- zend_variables.h: export zval_add-ref and zvale_del_ref
-
-2000-04-20 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.h: - Change macro names from Z to Z_
-
- * zend_operators.h: Add some macros for nicer zval handling
-
-2000-04-20 Andrei Zmievski <andrei@ispi.net>
-
- * zend_operators.c: Do proper ieeefp.h check.
-
-2000-04-20 Thies C. Arntzen <thies@thieso.net>
-
- * zend_operators.c:
- compile before commit! compile before commit! compile before commit!
-
- * zend_operators.c:
- revert andrei's path (i can't compile anymore on linux)
- we're always using #ifndef HAVE_BLA instead of if !HAVE_BLA and if we need ieeefp.h for some weird platform (which one is that?) we need an autoconf check for it.
-
-2000-04-19 Andrei Zmievski <andrei@ispi.net>
-
- * zend_operators.c: Include proper files for finite.
-
-2000-04-19 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_builtin_functions.c
- zend_execute_API.c
- zend_globals.h:
- Initial support for trapping errors (not complete and disabled; will be enabled only
- post-PHP 4.0.0)
-
- * zend_builtin_functions.c
- zend_constants.c
- zend_errors.h:
- - Renamed get_used_files() to get_required_files() for consistency
- - Documented some functions
- - Added user-level warning messages
- - Added user_error()
-
-2000-04-19 Andi Gutmans <andi@zend.com>
-
- * zend_opcode.c
- zend_compile.h: - Export pass_include() for Windows
-
-2000-04-18 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.h:
- Add convert_to_writable_*_ex() macros (unused at this time)
-
-2000-04-17 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c: - Fix order of JMPZNZ arguments
-
-2000-04-17 Thies C. Arntzen <thies@thieso.net>
-
- * zend_operators.c: ups, finite is already a macro on Win32
-
- * Zend.m4
- zend_operators.c: HPUX11 only has isfinite()
-
-2000-04-15 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l: - Fix leak in require_once()
-
-2000-04-15 Thies C. Arntzen <thies@thieso.net>
-
- * zend_extensions.c: fixes compile on platforms without dl() support.
-
-2000-04-15 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Fix ZTS
-
-2000-04-15 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l:
- "use" is not yet supported; instead use include_once() or require_once()
- for the time being (Andi, Zend library)
-
-2000-04-15 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_API.c
- zend_compile.c
- zend_execute_API.c
- zend_list.c
- zend_list.h: - Clean up resource lists namespace
- - Prepare extended resource list destructor APIs (currently unused)
-
-2000-04-13 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- Fix a memory leak when using assign-op bitwise operators on strings
-
-2000-04-12 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: *** empty log message ***
-
-2000-04-11 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c: - Fix memory leak
-
-2000-04-11 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix warnings
-
- * zend_execute.c: Fix fd leak in include_once()
-
-2000-04-10 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l
- zend_execute.c: -
-
-2000-04-10 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h
- zend_operators.c: Fix object overloading support
-
-2000-04-10 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Add warnings
-
- * zend_compile.c: - Two more places needed changing
-
-2000-04-10 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.h: Clean up last/size definitions
-
-2000-04-09 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h: *** empty log message ***
-
-2000-04-07 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Thoroughly fix include_once()
-
- * zend_execute.c: Fix include_once()
-
-2000-04-06 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y: *** empty log message ***
-
- * zend_execute.c
- zend_execute.h: Initial preparation for OO overloading patch
-
-2000-04-05 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.h: - Bump up version number
-
- * zend_compile.c
- zend_execute.c: - FIx JMPZNZ
-
-2000-04-03 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c:
- Fix the problem with dl()'d modules not freeing their resources properly
-
-2000-04-01 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h
- zend_config.w32.h: *** empty log message ***
-
- * acconfig.h: Have a standard way of exporting symbols
-
- * zend_modules.h: Use int
-
- * zend_API.h: Generalize some common thread-safety stuff
-
- * zend_modules.h: Have a standard entry for the globals id
-
-2000-03-31 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- The previous fix ended up being broken, this one should do it
-
-2000-03-31 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Fix bug
-
-2000-03-30 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c: Fix zend_register_extension()
-
-2000-03-30 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.h: - Bump up API number after Lars' change
-
-2000-03-30 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: Give another hint to BSD makes
-
- * Makefile.am:
- Specifically mention $(srcdir), so that OpenBSD's make gets it
-
-2000-03-29 Zeev Suraski <zeev@zend.com>
-
- * zend_stack.c
- zend_stack.h
- zend_compile.c:
- - Make the argument order for the stack applies more consistent with other Zend
- data structures
- - Fix a possible corruption problem due to switch() C-level optimization
-
-2000-03-29 Torben Wilson <torben@pinc.com>
-
- * zend-parser.y
- zend-scanner.l
- zend_compile.h
- zend_execute.c
- zend_opcode.c
- zend_operators.c
- zend_operators.h:
-
- Added !== (is not identical) operator.
-
-2000-03-29 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c
- zend_extensions.h: *** empty log message ***
-
-2000-03-29 Andi Gutmans <andi@zend.com>
-
- * zend_API.h:
- - Make sure zend_API.h has Zend'ish versions of the ZEND macros so that
- Zend'ish modules don't need to mix PHP & Zend notation.
-
-2000-03-28 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c:
- The checks for func_num_args() and friends were broken - fixed
-
-2000-03-27 Sam Ruby <rubys@us.ibm.com>
-
- * Zend.dsp: Remove debug libraries from debug build
-
-2000-03-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_execute_API.c
- zend_API.c
- zend_builtin_functions.c: - Stop zend_func_args() and co. from crashing
-
- * zend.h:
- - Didn't see Thies' commit message although I can't really see how it would
- make a difference
-
- * zend.h
- zend_opcode.c: - Include Andrea's fix for alloca.h
-
-2000-03-26 Thies C. Arntzen <thies@thieso.net>
-
- * zend.h
- zend_execute.c:
- <alloca.h> needs to be included before we define macros calling alloca()
- atleast using SGI's cc - should not harm other platforms (i hope)
-
- * zend_opcode.c: fix cast
-
-2000-03-25 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c
- zend_alloc.h: *** empty log message ***
-
-2000-03-25 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c
- zend_variables.c: - Some header dependencies cleanup
- - Generalize zval_print() and zval_print_r()
-
-2000-03-25 Sam Ruby <rubys@us.ibm.com>
-
- * zend.h: RTLD_NOW => RTLD_LAZY|RTLD_GLOBAL
-
-2000-03-25 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp: Update dsp's
-
-2000-03-24 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- - Fixed a crash when sending a non-variable expression to a runtime-bound function
- that expected a reference.
-
-2000-03-24 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_builtin_functions.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_hash.c
- zend_hash.h: - Nuke hash_*_ptr functions
-
-2000-03-23 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: Use WRONG_PARAM_COUNT.
-
-2000-03-23 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c: - Make it compile
-
-2000-03-23 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: Added get_class_methods().
-
-2000-03-22 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Change Zend version as API has changed
-
-2000-03-22 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: - Wrong fix
-
- * zend_operators.c: - Only free when result != op1
-
-2000-03-21 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend.h:
- - Change zend_startup to accept a flag for starting builtin functions
-
- * zend.h
- zend_API.h: - Move #defines
-
-2000-03-19 Thies C. Arntzen <thies@thieso.net>
-
- * zend_compile.h: kill warning
-
-2000-03-18 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Fix compile problem on FreeBSD
-
- * zend.h:
- - No reason for refcount to be signed and move to zend_* typedefs
-
-2000-03-18 Thies C. Arntzen <thies@thieso.net>
-
- * zend.c: renamed _string_value_() to __string_value().
-
-2000-03-18 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c:
- The third argument to define() wasn't working right, fixed
-
- * zend_execute.c:
- false wouldn't automaticaly switch to an array type, which resulted in an
- incompatibility with PHP 3. Fixed.
-
-2000-03-16 Thies C. Arntzen <thies@thieso.net>
-
- * zend.c: renamed "to_string" -> "_string_value_"
-
-2000-03-15 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend.h
- zend_execute.c: - Fix newly introduced problem reported by Sam Ruby
-
-2000-03-15 Andrei Zmievski <andrei@ispi.net>
-
- * zend_hash.c
- zend_hash.h:
- Make zend_hash_move_forward()/zenv_hash_move_backwards() a little smarter.
-
-2000-03-15 Zeev Suraski <zeev@zend.com>
-
- * zend_opcode.c: - Fix warning (I thought I fixed this one before)
-
-2000-03-14 Andrei Zmievski <andrei@ispi.net>
-
- * zend_llist.c
- zend_llist.h: Implemented external list traversing.
-
-2000-03-14 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y:
- - Allow array(1,2,3,) i.e. with trailing comma. You can only have one
- trailing comma.
-
-2000-03-13 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: -
-
- * zend_compile.c: - Spare a byte :)
-
-2000-03-13 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h
- zend_modules.h: - Another zend_uchar
-
- * zend_compile.c: *** empty log message ***
-
- * zend.h
- zend_compile.h:
- - define zend_uint and zend_uchar and use them in a few places
-
-2000-03-13 Andrei Zmievski <andrei@ispi.net>
-
- * zend_hash.c
- zend_hash.h:
- Introduced a way to traverse hashes through external pointers.
-
-2000-03-13 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h: - Change type from int -> char
-
-2000-03-13 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: - Fix filename/lineno initialization for do_return
-
-2000-03-12 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c
- zend_modules.h: -
-
-2000-03-11 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Remove inline from functions which are pretty large and besides eating up
- memory in compile time probably doesn't boost performance.
-
-2000-03-10 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c:
- - Seems to be a problem here with the return value not being set
-
- * zend-parser.y
- zend_builtin_functions.c
- zend_execute.c
- zend_execute_API.c
- zend_globals.h: - Quick way of supporting include_once().
- Good enough for RC1.
-
- * zend-parser.y
- zend-scanner.l
- zend_compile.c
- zend_compile.h: - Support require_once().
-
- * zend_compile.h
- zend_execute.c: - Cleanup old IMPORT stuff
-
- * zend-parser.y
- zend-scanner.l:
- - Nuke import, add include_once and include_require scanner/parser rules.
- Hope to nuke use too :)
-
- * zend_modules.h: - That broke the Win32 build
-
- * zend_modules.h: - Fix a bug and define an API_NO for the ZEND_MODULE_API
-
- * zend_modules.h: - zend_config.h is enough
-
- * zend_modules.h: - Save ZEND_DEBUG, ZTS, ZEND_API information
-
-2000-03-09 Andi Gutmans <andi@zend.com>
-
- * zend_highlight.c: - Fix bug in syntax highlighter
-
-2000-03-06 stig <stig@pb1.pair.com>
-
- * zend_modules.h: added GINIT_FUNC_ARGS and GINIT_FUNC_ARGS_PASSTHRU
-
-2000-03-06 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.h: - Bump up Zend's API version
-
-2000-03-06 stig <stig@pb1.pair.com>
-
- * zend_modules.h: Added ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU.
-
-2000-03-06 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l: - Fix memory leak
-
- * zend.c: - Missed one
-
-2000-03-06 Sam Ruby <rubys@us.ibm.com>
-
- * zend.c
- zend.h: Unresolved externs
-
-2000-03-06 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c
- zend_extensions.h
- zend_fast_cache.h
- zend_globals.h
- zend_globals_macros.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_variables.c
- zend_variables.h
- LICENSE
- zend-parser.y
- zend-scanner.h
- zend-scanner.l
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_builtin_functions.h
- zend_compile.c
- zend_compile.h
- zend_config.w32.h
- zend_constants.c
- zend_constants.h
- zend_dynamic_array.c
- zend_dynamic_array.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_modules.h: It's official now...
-
-2000-03-05 Zeev Suraski <zeev@zend.com>
-
- * ZendTS.dsp
- zend.c
- zend.h: Wrap some commonly unused callbacks
-
-2000-03-04 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l:
- The default return value from include() and eval() changed from 1 to 0
- unintentionally after the old return-reference patches - fixed
-
-2000-03-02 Sam Ruby <rubys@us.ibm.com>
-
- * zend_config.w32.h: Fix Win32 build breakage
-
-2000-03-01 Andi Gutmans <andi@zend.com>
-
- * zend.c: - Upgrade to year 2000
-
- * ZEND_CHANGES
- zend_compile.c
- zend_execute.c: - Fix typos
-
-2000-03-01 Thies C. Arntzen <thies@thieso.net>
-
- * zend_operators.c: now
-
-2000-02-27 Egon Schmid <eschmid@s.netic.de>
-
- * zend_builtin_functions.c: Fixed some protos.
-
-2000-02-26 Sam Ruby <rubys@us.ibm.com>
-
- * zend_builtin_functions.c: compilation error - Win32
-
-2000-02-26 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c:
- Added get_class_vars() and get_object_vars() functions.
-
- * zend_execute.c: Fix typo.
-
-2000-02-26 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Fix comparisons of "inf"=="inf" and "-inf"=="-inf"
-
-2000-02-25 Zeev Suraski <zeev@zend.com>
-
- * zend_fast_cache.h
- zend_variables.c: Use the fast cache here too
-
-2000-02-19 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend-scanner.h
- zend-scanner.l
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_builtin_functions.h
- zend_compile.c
- zend_compile.h
- zend_config.w32.h
- zend_constants.c
- zend_constants.h
- zend_dynamic_array.c
- zend_dynamic_array.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_fast_cache.h
- zend_globals.h
- zend_globals_macros.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_modules.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_variables.c
- zend_variables.h: (c) patch
-
- * zend_API.c
- zend_API.h
- zend_fast_cache.h
- zend_hash.c:
- - Fix a nasty bug in the hash, introduced in the recent migration to macros
- - Make array_init() and friends trackable
-
- * zend_API.c
- zend_API.h
- zend_execute.c
- zend_operators.c
- zend_operators.h: Generalize macros
-
-2000-02-18 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: *** empty log message ***
-
-2000-02-18 sascha <sascha@pb1.pair.com>
-
- * zend_llist.c
- zend_llist.h:
- Get rid of second declaration of compare_func_t. Either put in a common
- header file or prefix it with i.e. zend_llist_
-
-2000-02-18 Andi Gutmans <andi@zend.com>
-
- * zend_llist.c
- zend_llist.h:
- - Quick and dirty hack for supporting sorts. Improve later on when I wake up.
-
- * ZendTS.dsp
- zend_dynamic_array.c: - Didn't compile on Win32
-
- * zend_dynamic_array.c:
- - Tiny change (I know I don't have to cast malloc() to void * but I like
- casting my malloc()'s)
-
- * Makefile.am
- zend_dynamic_array.c
- zend_dynamic_array.h:
- - Preliminary support for dynamic arrays. I need it on order to try out a
- new hash implementation. It isn't used anywhere.
-
-2000-02-17 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend.h: - Add ZEND_API
-
-2000-02-16 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: -Fix bug 3504 concerning leaks with unset()
-
- * zend_execute.c
- zend.h
- zend_compile.h: - Hopefully fix Thies' bug report.
-
-2000-02-16 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c:
- ZEND_TEST_EXCEPTIONS should be defined/undefined before it's checked
-
-2000-02-16 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fix bug #3309
-
-2000-02-14 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- - Put in the infrastructure for the unset() fix. Right now it has the old
- behavior but I just need time tomorrow to add the correct behavior.
-
- * zend_builtin_functions.c: - Fix bug in func_get_arg()
- - Get rid of compiler warnings for unused function crash()
-
-2000-02-13 Zeev Suraski <zeev@zend.com>
-
- * zend_constants.c: Fix a memory leak
-
-2000-02-13 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c: - Save a function call one very hash_add
-
- * zend_hash.c
- zend_hash.h:
- - Make startup a bit faster by changing some hash_update()'s and hash_add()'s
- to hash_update_ptr()/hash_add_ptr()
-
- * zend_hash.c:
- - Fix a couple of potential bugs where we were using emalloc/efree instead
- of pemalloc/pefree.
- - Fix a bug were we potentially would be freeing the key by mistake
-
-2000-02-13 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c: *** empty log message ***
-
- * zend_operators.c: Make (array) false == array() and not array(false)
-
-2000-02-11 Andrei Zmievski <andrei@ispi.net>
-
- * zend_hash.c
- zend_hash.h: Made a couple of typedefs for zend_hash_apply_*() calls.
-
-2000-02-11 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp
- ZendTS.dsp
- zend_config.w32.h: Update .dsp's
-
- * zend-scanner.l
- zend.h
- zend_API.h
- zend_alloc.c
- zend_config.w32.h
- zend_constants.c
- zend_execute.c
- zend_extensions.c: Fine tune Andi's patch
-
-2000-02-10 Andi Gutmans <andi@zend.com>
-
- * zend.h: - #define ZEND_WIN32 differently
-
- * zend-scanner.l
- zend.h
- zend_API.h
- zend_alloc.c
- zend_constants.c
- zend_execute.c
- zend_extensions.c: - Finally beautify those WIN32|WINNT checks
-
- * zend_execute.c: - Shouldn't be there
-
- * zend_execute.c: - Cleanup the code
-
-2000-02-09 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend_execute.c:
- Fix last known nasty bugs in Zend. It'll be cool if there are no new ones :)
-
-2000-02-09 Thies C. Arntzen <thies@thieso.net>
-
- * zend_execute.c: foreach() works now for objects as well.
-
-2000-02-08 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Fix declaration
-
- * zend_execute.c: Fix an elusive bug
-
-2000-02-08 Andrei Zmievski <andrei@ispi.net>
-
- * zend_operators.c: Fix up the patch.
-
- * zend_builtin_functions.c
- zend_operators.c
- zend_operators.h: Patches from Walter for strncmp() stuff.
-
-2000-02-07 Zeev Suraski <zeev@zend.com>
-
- * zend_highlight.c: Remove old unnecessary check
-
- * zend-parser.y
- zend-scanner.l
- zend_compile.c
- zend_highlight.c:
- Syntax highlighting was erronously emitting more than one semicolon and/or garbage with heredocs
-
-2000-02-06 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Support the string offset syntax $a{2} with the regular array opcodes.
- Will need to write new opcodes sometime but right now it's good enough
- to announce the change to this string offset syntax for beta 4.
-
-2000-02-05 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c:
- - This hopefully fixes the list($a, $a) = array(1,2) crash, i.e. when list
- by mistake contains the same variable twice.
- - BTW, there is no defined order of assignment. The value of $a after the
- previous example is undefined, and should not be assumed to be either 1
- nor 2.
-
-2000-02-05 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: More cleanup
-
- * zend.h
- zend_builtin_functions.c
- zend_execute.c
- zend_execute_API.c: Pass the executor globals to internal functions
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_constants.c
- zend_execute.c
- zend_execute_API.c
- zend_hash.c
- zend_hash.h
- zend_modules.h
- zend_variables.c: - Stop passing list/plist to internal functions
- - Add a typedef for the pCopyConstructor function pointer
- - Minor hacks
-
- * zend-scanner.l:
- That was the broken downcasting that prevented the interactive C++ mode from working properly under UNIX
-
-2000-02-04 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h
- zend_opcode.c:
- Maintain a state of whether we're compiling and/or executing
-
-2000-02-03 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c
- zend_API.h: *** empty log message ***
-
-2000-02-02 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c: - Fix built-in classes with more than 5 methods
-
- * zend_compile.c:
- - Fix the annoying problem with list(), that surfaced up after our recent cleaning
- patches
-
-2000-02-01 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c
- zend_API.h: Added add_property_unset() and add_property_bool().
-
-2000-02-01 Zeev Suraski <zeev@zend.com>
-
- * ZendTS.dsp
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_execute_locks.h: Improve dependencies
-
- * zend_execute.c: Sort out a gdb problem
-
- * zend_execute.c: Fix warning
-
-2000-02-01 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute_API.c
- zend_globals.h: - Get rid of remains of garbage.
- - This should fix Thies' UMR
-
-2000-02-01 Thies C. Arntzen <thies@thieso.net>
-
- * zend_execute_API.c:
- moved destroying of garbage before resource-list gets destroyed - (see my previous mail)
- zeev, andi - please comment!
-
- * zend.c: added missing break.
-
- * zend_hash.c
- zend_hash.h:
- took out zend_hash_pointer_update() & zend_hash_pointer_index_update_or_next_insert() - i really prefer link-errors instead of runtime-errors, don't you?
-
-2000-01-31 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h: - This has to always be done.
-
-2000-01-31 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend_compile.h
- zend_execute.c
- zend_execute_API.c: - Optimized garbage mechanism
- - Fixed another buglet in the parser
-
- * zend-parser.y
- zend_alloc.c
- zend_execute.c
- zend_fast_cache.h: - Fix foreach()
- - Fix indirect reference with object properties
-
-2000-01-30 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix the bug Thies found where I forgot to change a break; to NEXT_OPCODE();
- - If you find anymore let me know
-
- * zend_alloc.h: - Run it on align_test
-
-2000-01-29 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Fix ``'s
-
- * zend-parser.y
- zend-scanner.l
- zend_compile.h: Fix require()
-
-2000-01-29 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y: - Get rid of another rule which isn't needed.
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h:
- - Add parser support for string offsets. This added three shift/reduce
- conflicts but they all seem to be fine.
- - Cleaned up the parsing rules a bit and made them much more compact and
- elegant.
- - Please CVS update and see that I didn't break anything.
-
- * zend_alloc.h:
- - This will save some memory w/ GCC compilers on some platforms
-
- * zend_execute.c: - Yet another tiny optimization.
-
-2000-01-28 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_execute.c: - Make loop a bit faster.
-
- * zend.h: - Make sure its use is understood.
-
- * zend.h
- zend_execute.c: - Double the speed of some key switch() tests for Win32.
-
- * zend_execute.c:
- - This makes the switch() statement twice as quick. Moving to enum
- might make this a general speed up for other platforms too
-
-2000-01-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c: - Keep objects as references.
-
- * zend_execute_API.c
- zend_opcode.c:
- - Allow is_ref to become 0 in case the refcount is back to 1.
-
-2000-01-24 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c:
- - Make foreach() now copy the array but use the original array. It can
- still be optimized A LOT but it's only a performance issue and not
- a feature issue.
-
-2000-01-24 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend-scanner.l
- zend.c
- zend.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_operators.c
- zend_operators.h: - Implement declare() with declarables framework
- - Implement ticks - Germany&Norway - 5 points!
-
- * zend_execute.c
- zend_execute_API.c: Fixes
-
-2000-01-22 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c: Fix an elusive bug
-
-2000-01-20 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c: Add some order...
-
- * zend_hash.c: Indentation fixes
-
-2000-01-19 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c: - Optimize zend_hash_del a tiny bit.
-
- * zend_hash.c
- zend_hash.h: - Hopefully fix the hash problem.
-
- * zend_hash.c: - Hrm I'm not concentrating
-
- * zend_hash.c:
- - Actually the destructor should run after the data is already detached
- from the hash but before the bucket is freed.
-
- * zend_hash.c:
- - Rollback hash_apply and friends. They assume now that hash_del is reentrant
- as it first applies the destructor and only later nukes the bucket
-
- * zend_hash.c:
- - Run destructor before the hash structure is modified, thus, making
- hash_del, reentrant (BLOCK_INTERRUPTIONS needs to be made a counter now).
-
- * zend_hash.c: - Undo a bug we introduced. (Another one out there).
-
-2000-01-19 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h:
- RETURN_NULL -> RETURN_NULL() // we don't want macros without an argumnet
-
-2000-01-18 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Leak fix
-
-2000-01-18 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h: RETURN_NULL & RETVAL_NULL don't need ().
-
-2000-01-17 Thies C. Arntzen <thies@thieso.net>
-
- * zend_hash.c: use defines
-
-2000-01-17 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c
- zend_hash.h
- zend_variables.c: Get rid of the IsPointer functionality in the hash.
-
- * zend_hash.c: - Fixes a newly introduced bug in the hash
-
- * zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_constants.h
- zend_execute_API.c
- zend_hash.c
- zend_hash.h
- zend_list.c
- zend_list.h
- zend_modules.h
- zend_opcode.c
- zend_variables.c
- zend_variables.h:
- Destructors no longer return ints, the low level problem it was intended to solve is long gone now...
-
-2000-01-16 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_execute_API.c
- zend_hash.c
- zend_hash.h
- zend_list.c
- zend_list.h:
- - Make zend_hash_apply() (and friends) reentrant and much, much quicker
- - Introduce zend_hash_graceful_destroy(), which allows the destructor functions to
- use zend_hash_apply() and/or zend_hash_graceful_destroy()
- - Switch to zend_hash_graceful_destroy() in the resource list shutdowns
-
- * zend.c
- zend_compile.c
- zend_compile.h:
- Allow module startup to be separate from the compiler/executor startup
-
-2000-01-16 Thies C. Arntzen <thies@thieso.net>
-
- * zend_hash.c: make the ht->inconsistent stuff less ugly:)
-
-2000-01-15 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c
- zend_list.c: Fix a bug in call_user_function_ex()
-
- * zend-parser.y:
- Added support for $foo->{$bar}["foobar"] notation (was supported in PHP 3)
-
-2000-01-15 Thies C. Arntzen <thies@thieso.net>
-
- * zend_hash.c
- zend_hash.h:
- if ZEND_DEBUG mode is on we'll now see warnings when a HashTable is accessed
- while it's inconsistent.
-
- Zeev, Andi - you welcome to revert this patch if you don't like it - i find it
- useful! accesssing inconsistent hashtables is one of the hardest things to track!
-
-2000-01-14 Andrei Zmievski <andrei@ispi.net>
-
- * zend_highlight.c:
- Since we're highlighting code, put <code> and </code> around the code.
-
-2000-01-13 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_config.w32.h: Make Win32 compile again
-
-2000-01-12 sascha <sascha@pb1.pair.com>
-
- * acconfig.h
- zend.h:
- Move dl stuff from acconfig.h into zend.h. That allows us finer control
- when it comes to suppressing dlfcn.h.
-
-2000-01-09 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Functionality & crash fixes
-
-2000-01-04 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_operators.c:
- - Rename IS_BC to FLAG_IS_BC. We will probably nuke it.
-
-2000-01-04 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h: added ZVAL_*() macros.
-
-2000-01-04 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_execute.c:
- - Separate the overloaded objects' types from Zend's data types.
- There is no reason for them to be the same, and IS_METHOD just cluttered
- there data types.
-
- * zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_constants.c
- zend_execute.c
- zend_execute_API.c
- zend_operators.c
- zend_variables.c
- zend-parser.y
- zend.c: - Change IS_UNSET -> IS_NULL
-
-2000-01-03 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix a bug when using [] on a string
-
-2000-01-03 Joey Smith <joey@joeysmith.com>
-
- * zend_operators.c: number.h comes from ext/bcmath, not functions/
-
-2000-01-03 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix
-
-2000-01-03 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - Fix compare_function() for IS_UNSET
-
-2000-01-02 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix
-
-2000-01-02 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h: renamed RET???_UNSET -> RET???_NULL
-
-2000-01-01 sascha <sascha@pb1.pair.com>
-
- * Zend.m4
- acconfig.h
- acinclude.m4: Some cleanup
-
-2000-01-01 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c:
- - IS_NULL should be 0 when converted to a long although I don't think it
- really should be documented.
-
-2000-01-01 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Fix buglet
-
-1999-12-31 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp
- ZendTS.dsp: .dsp updates
-
- * Zend.dsp
- ZendTS.dsp
- zend_config.w32.h: - Add Release_inline builds
-
- * zend-parser.y
- zend-scanner.l
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_constants.c
- zend_execute.c
- zend_execute_API.c
- zend_operators.c
- zend_operators.h
- zend_variables.c: - Nuke undefined_variable_string
- - Introduce IS_UNSET
-
-1999-12-31 Andi Gutmans <andi@zend.com>
-
- * ZendTS.dsp
- zend-parser.y
- zend_compile.c
- zend_compile.h:
- - Fix bug #3073. continue in do..while() loops should work now
-
-1999-12-30 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_alloc.c
- zend_fast_cache.h
- zend_globals.h
- zend_globals_macros.h:
- This should enable people to use ALLOC_ZVAL() in code outside the php4.dll
-
-1999-12-30 sascha <sascha@pb1.pair.com>
-
- * Zend.m4:
- Solaris' sed does not like this expression. Since -O0 is the default,
- we can also omit it.
-
-1999-12-29 Zeev Suraski <zeev@zend.com>
-
- * zend_variables.c:
- - Change var_reset() to set bool(0) instead of string("")
-
- Authors should go over their code and change it to use var_reset() instead of manually
- setting it to string(""), in case they're interested in the false value.
-
- * zend_alloc.c: time_t is an int under Linux... this should always work.
-
-1999-12-28 sascha <sascha@pb1.pair.com>
-
- * zend_alloc.c: Fix warnings
-
-1999-12-28 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h
- zend_constants.c: new constant: SQL_NULL
- new macros: RETURN_SQLNULL,RETVAL_SQLNULL,IS_SQLNULL
-
-1999-12-27 Zeev Suraski <zeev@zend.com>
-
- * zend_fast_cache.h: Fix
-
-1999-12-27 Andi Gutmans <andi@zend.com>
-
- * zend_API.c: - Get rid of warning
-
-1999-12-27 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp
- ZendTS.dsp
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_fast_cache.h
- zend_globals.h
- zend_opcode.c
- zend_operators.c
- zend_variables.c
- zend_zval_alloc.h: - Generalize the fast cache mechanism
- - Add the HashTable struct to the fast cache mechanism
-
-1999-12-27 Andi Gutmans <andi@zend.com>
-
- * zend_API.c:
- - Make zend_internal_function allocate a full zend_function structure so
- that we don't get memory overruns and Thies doesn't get angry :)
-
-1999-12-27 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: *** empty log message ***
-
- * zend_globals.h
- zend_zval_alloc.h
- zend_alloc.c: Add cache statistics support
-
-1999-12-27 Thies C. Arntzen <thies@thieso.net>
-
- * zend.c: fix UMR in ZTS mode
-
-1999-12-26 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp
- ZendTS.dsp
- zend_alloc.c
- zend_globals.h
- zend_zval_alloc.h:
- - Enable the new zval cache on debug too. No real reason not to, and it keeps
- the code cleaner.
- - ZTS compile fixes
-
- * zend_alloc.c: Fix buglet
-
- * zend_zval_alloc.h: Add missing file
-
- * zend.h
- zend_API.h
- zend_alloc.c
- zend_compile.c
- zend_execute.c
- zend_globals.h
- zend_operators.c:
- Introduce a zval-specific cache - 5-15% speed improvement
-
-1999-12-26 sascha <sascha@pb1.pair.com>
-
- * Makefile.am
- acinclude.m4: Makefile.am: Add dummy target for dependencies
- acinclude.m4: Cache result of broken sprintf check
-
-1999-12-26 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_operators.c: Change ALLOC_ZVAL() semantics
-
- * zend_alloc.c
- zend_alloc.h
- zend_globals.h: namespace protection
-
-1999-12-25 Zeev Suraski <zeev@zend.com>
-
- * zend_ptr_stack.c
- zend_ptr_stack.h: inline functions cannot accept varargs
-
-1999-12-25 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y: - Prepare Zend for the new $a{2} string offset syntax.
-
-1999-12-24 Zeev Suraski <zeev@zend.com>
-
- * zend_config.w32.h:
- Use __forceinline under Win32 (inlining under Win32 gives roughly 30% performance
- increase)
-
- * zend-scanner.l: Shut gcc up
-
- * zend_compile.c: Optimize
-
-1999-12-24 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_operators.c
- zend_variables.c:
- - Create two new macro's. ALLOC_ZVAL() and FREE_ZVAL(z) and make Zend use
- them.
-
-1999-12-24 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: - Use function_add_ref() here too
-
-1999-12-23 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_opcode.c:
- Fix a class inheritence leak, when using static varibles in a parent class member function
-
- * zend_compile.c: This one slipped away
-
-1999-12-23 sascha <sascha@pb1.pair.com>
-
- * Zend.m4: Rename option to match description string
-
-1999-12-23 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- - require() of a dynamic expression now has the standard require() semantics
- - Fixed a memory leak in require() of a dynamic expression
-
-1999-12-23 sascha <sascha@pb1.pair.com>
-
- * Makefile.am
- Zend.m4:
- Compile zend_execute.c with special CFLAGS. For GCC, INLINE_CFLAGS
- contains -O0 to disable optimizations. This can be disabled by using
- the appropiate parameter.
-
-1999-12-22 sascha <sascha@pb1.pair.com>
-
- * zend_builtin_functions.c: Kill compiler warning
-
- * Zend.m4: Don't set DEBUG_CFLAGS to -g, if -g is already in CFLAGS
-
-1999-12-22 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h: export
-
- * zend_extensions.h: Those void's don't belong in there
-
- * zend_API.h
- zend_builtin_functions.c: - Fix function_exists()
-
- * zend_execute.c:
- - Fix a very old legacy memory leak in break(n) statements
-
- * zend_execute.c: Fix for the array() initialization bug Stas found
-
-1999-12-22 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Remove unused variable.
-
-1999-12-21 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend.h
- zend_compile.c
- zend_execute.c:
- Fix the highlighting problem. STR_REALLOC() should be used instead of plain erealloc()
- whenever you're dealing with strings that might be coming back from the engine - there seem
- to be a few other places like this in PHP.
-
-1999-12-21 Andrei Zmievski <andrei@ispi.net>
-
- * zend.c
- zend_API.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_operators.c
- zend_variables.c
- zend_variables.h: We're using ZVAL's now.
-
-1999-12-21 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: - Fix Sascha's leak. Good report!
-
- * zend_alloc.c: No need to block for interruptions so early
-
-1999-12-21 sascha <sascha@pb1.pair.com>
-
- * Zend.m4:
- Explicitly check for C++ preprocessor, otherwise autoconf forces it onto
- us at the wrong place (subsequent autoconf checks failed).
-
-1999-12-20 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: - Fix @expr
-
- * zend.h
- zend_compile.c
- zend_execute.c:
- - Fix the crash Thies was experiencing (returning a function call could cause a crash)
- - Fix the leak Thies was experiencing (@fcall() leaked)
-
-1999-12-19 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp: Some updates
-
- * Zend.dsp
- ZendTS.dsp: Make these work again
-
- * FlexLexer.h
- Makefile.am
- Zend.dsp
- Zend.m4
- ZendTS.dsp
- configure.in
- flex.skl
- libzend.dsp
- libzend.m4
- libzendts.dsp: libzend -> Zend
-
- * zend.h
- zend_API.h
- zend_compile.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h:
- - Made things work again (Thies, everybody - please check the latest CVS and see if you're
- still getting any problems)
- - Changed the interface of call_user_function_ex() to support returning of references
-
-1999-12-19 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend.h
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_globals.h: - More fixes related to the return references patch
- - eval_string() and call_user_function_ex() still don't work.
- - The libzend tree is untested and might not be stabl yet.
-
-1999-12-19 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: Add zend_sprintf.c
-
- * acconfig.h
- zend_sprintf.c: configure sets ZEND_BROKEN_SPRINTF
-
- * acinclude.m4: Variables are not interpolated unless we use _UNQUOTED
-
-1999-12-18 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_API.h: - The tree compiles again
-
-1999-12-18 sascha <sascha@pb1.pair.com>
-
- * libzend.m4: Let autoconf check for the proper inline keyword
-
- * Makefile.am
- libzend.m4:
- automake created illegal target names due to the ZEND_SCANNER definition.
- We now substitute @ZEND_SCANNER@ directly
-
-1999-12-18 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c:
- - Introduce ZEND_NUM_ARGS(), to replace ARG_COUNT(ht)
- - Rename getParameters() and friends for consistency and namespace cleanliness
-
-1999-12-17 Zeev Suraski <zeev@zend.com>
-
- * zend_constants.c: - Made PHP_VERSION and PHP_OS work again
- - More php3_ cleanup
- - Restored the PHP_VERSION and PHP_OS constants
-
-1999-12-17 sascha <sascha@pb1.pair.com>
-
- * libzend.m4: Define inline to inline explicitly
-
- * Makefile.am
- acinclude.m4
- configure.in
- libzend.m4: Move config code into separate file
-
-1999-12-17 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h:
- - By mistake commited this to the branch. It fixes a bug we introduced with
- the return reference patch.
-
-1999-12-15 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: Doh! I'm an idiot.
-
- * zend_builtin_functions.c
- zend_compile.c: - s/inheritence/inheritance/g
- - Added is_subclass_of() function
-
-1999-12-15 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_opcode.c: - Implement return by reference:
- - In function declaration instead of the return statement
- - In the assignment phase
- - Implement ability to turn off support for call-time pass by reference
-
-1999-12-15 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: val->len
-
- * zend_builtin_functions.c: Faster, must go faster.
-
-1999-12-15 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_opcode.c
- zend-parser.y
- zend_compile.c
- zend_compile.h:
- - Preliminary return ref patch. It breaks libzend so don't use this branch
- right now.
-
-1999-12-14 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: - Added class_exists()
- - Moved function_exists() here from from the basic_functions.c
- - Modified method_exists() to convert method name to lowercase
- when checking
-
-1999-12-13 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix problem when return_value's is_ref/refcount is overwritten by the
- internal function.
-
-1999-12-11 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Another small fix.
-
- * zend_execute.c: - Support returning references
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h:
- - This is supposed to be commited to the RETURN_REF_PATCH branch which is
- the beginning of work on allowing returning of references from functions.
-
-1999-12-07 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l:
- - opened_path should not be freed here as the zend_file_dtor() takes care
- of it. This doesn't fix the bug report for the crash of highlight_file()
- though.
-
-1999-12-07 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y: Support ZTS definition in zend_config.h
-
-1999-12-06 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_highlight.c
- zend_indent.c: Move the #include of zend-parser.h out of zend_compile.h
-
- * zend-parser.y
- zend_globals_macros.h: More localization
-
- * zend-parser.y
- zend_compile.h
- zend_globals_macros.h: Localize a couple of macros
-
-1999-12-05 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: *** empty log message ***
-
-1999-12-05 sascha <sascha@pb1.pair.com>
-
- * .cvsignore
- zend-parser.y
- zend.c
- zend_API.c
- zend_compile.c
- zend_execute_API.c: Fix some warnings
-
-1999-12-04 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c: *** empty log message ***
-
- * zend_API.c
- zend_API.h
- zend_hash.h: Added zend_set_hash_symbol() function.
-
-1999-12-04 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h:
- backed out last change after andi decided on a different approach.
-
-1999-12-04 Andi Gutmans <andi@zend.com>
-
- * zend_API.h:
- - Call ZEND_SET_SYMBOL_WITH_LENGTH() with refcount 1 from the standard
- ZEND_SET_SYMBOL()
-
-1999-12-04 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend_builtin_functions.c
- zend_compile.c: - Implement get_used_files() and get_imported_files()
-
- * zend-parser.y
- zend-scanner.l
- zend.c
- zend.h
- zend_compile.c
- zend_compile.h:
- - Break the zend->PHP dependency introduced by the .php extension for use(),
- by providing an API
- - Enable Stig's patch for use() extensions (it wasn't refered to by the parser)
- - Fix a memory leak in that code
-
-1999-12-04 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h: the new SET_VAR_* macros forgot to set the refcount!
-
-1999-12-04 Sam Ruby <rubys@us.ibm.com>
-
- * zend-scanner.l: build error - windows
-
-1999-12-04 stig <stig@pb1.pair.com>
-
- * zend-scanner.l
- zend_compile.h: Fix typo, add prototype for use_filename().
-
- * zend-scanner.l: "use" should use arg+".php" as parameter to require
-
-1999-12-04 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: This should fix the fd leak with include()/require()
-
-1999-12-03 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.h: *** empty log message ***
-
- * zend_API.h: Added ZEND_SET_GLOBAL_VAR_WITH_LENGTH_EX() macro.
-
-1999-12-03 Thies C. Arntzen <thies@thieso.net>
-
- * zend-scanner.l: revert my last patch - WARNING: we leak fd's again.
- add initialzation of opened_path highlight_file()
-
-1999-12-03 Andi Gutmans <andi@zend.com>
-
- * zend_API.h: - Remove _EX and make it the old _LENGTH
-
-1999-12-02 Andi Gutmans <andi@zend.com>
-
- * zend_API.h: - Add _EX macro for Andrei
-
-1999-12-02 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.h
- zend_compile.h: Solve a couple of compile issues
-
-1999-12-02 Thies C. Arntzen <thies@thieso.net>
-
- * zend-scanner.l:
- php_fopen_wrapper_for_zend() does *NOT* insert the opened files into any list - the caller needs to fclose() the file. (not sure if this is desired)
- fixed "Uninitialized memory read" when including URLs
-
-1999-12-01 stig <stig@pb1.pair.com>
-
- * zend-scanner.h
- zend.c
- zend.h
- zend_alloc.h
- zend_builtin_functions.h
- zend_compile.h
- zend_constants.h
- zend_execute.c
- zend_execute.h
- zend_extensions.h
- zend_globals_macros.h
- zend_hash.h
- zend_indent.h: Fix warnings surfacing in maintainer-mode.
-
-1999-12-01 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h:
- Make it possible to explicitly set refcount in ZEND_SET_SYMBOL_WITH_LENGTH(), part 2
-
- * libzendts.dsp
- zend_API.h:
- Allow to set the reference count explicitly for ZEND_SET_SYMBOL_WITH_LENGTH()
-
-1999-12-01 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Forgot to check for BP_VAR_IS in the fix made for Thies' string offset
- problem.
-
-1999-11-30 Andi Gutmans <andi@zend.com>
-
- * zend_API.c: - Applied Thies' bug fix. Great work!
-
- * zend-parser.y
- zend-scanner.l
- zend.c
- zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h:
- - Add use support (behaves like require, but will not use the same file twice)
- - Add import support (behaves like include, but requires parentheses; will not
- use the same file twice; Currently, it is not yet properly implemented, and
- only behaves like include)
-
- * zend_execute.c:
- - Fix problem Thies reported. We by mistake separated variables which were
- being fetched for read only.
-
-1999-11-27 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Add ability to disable the memory cache
-
-1999-11-26 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: - Fix fd leak in ZTS mode
-
- * zend-scanner.l
- zend_compile.c: UNIX/non ZTS compile fixes
-
- * zend-scanner.l
- zend_compile.c
- zend_compile.h: - Improve the file handle closing code
-
- * zend_llist.c
- zend_llist.h: - Modify zend_llist_del() to receive a comparison function
-
- * zend_API.c:
- This request_shutdown() is no longer needed (never was needed really)
-
- * zend-scanner.l: This should get the file to close properly
-
-1999-11-26 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: Rebuild libzend.la, if the scanner was rebuilt
-
-1999-11-26 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c
- zend_modules.h: Remove request_started, increase thread safety
-
-1999-11-25 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: That's a more thorough fix...
-
- * zend_execute.c:
- Fix bug #2817 - assignments to string offsets could erronously modify unrelated strings
-
-1999-11-22 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Fix compile problem with enable-memory-limit
-
- * zend-scanner.l: Fix inconsistencies with here-docs implementation
-
- * zend-scanner.l
- zend_globals.h: Fix #2744
-
-1999-11-21 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: That slipped away
-
-1999-11-21 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_API.c
- zend_compile.c
- zend_execute.h
- zend_execute_API.c: - Optimize class instanciation
- - Fix constant instanciation for array elements inside objects
-
-1999-11-19 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Moved var_uninit() for return_value to the beginning of DO_FCALL.
- We forgot to do it for overloaded methods
-
- * zend.h
- zend_execute.c:
- - Functions whose return values aren't used have them freed in DO_FCALL
- and don't need a special ZEND_FREE opcode following them anymore
-
-1999-11-17 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c:
- - If a function's return value is unused then don't create a ZEND_FREE
- opcode but free it after the function call in zend_execute.
-
- * zend_execute.c: - Forgot this
-
-1999-11-16 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c: - Weird that this compiled for me.
-
- * zend.h: - CHange used_return_value -> return_value_used
-
- * zend_compile.c:
- - In any case create the free opcode. Need to allow the functions to
- create a hint.
-
- * zend.h
- zend_compile.c
- zend_execute.c:
- - Add support for used_return_value passed to internal functions.
-
-1999-11-14 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h: - Fix comment as to Joey's findings
-
-1999-11-13 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fix crash with string offset assignments.
-
-1999-11-04 Andrei Zmievski <andrei@ispi.net>
-
- * zend_hash.c
- zend_hash.h: Made zend_hash_rehash() callable from outside.
-
-1999-11-03 Andi Gutmans <andi@zend.com>
-
- * zend_API.h
- zend_compile.c
- zend_compile.h
- zend_execute.c: - Add support for BYREF_FORCE_REST
-
-1999-10-28 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c: - Fix for Thies' leak and Andrei's crash
-
-1999-10-25 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h: *** empty log message ***
-
-1999-10-23 Sam Ruby <rubys@us.ibm.com>
-
- * libzend.dsp
- libzendts.dsp:
- Allow CYGWIN directory to be specified as via environment variable
-
-1999-10-22 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fix isset() with string offsets.
-
-1999-10-19 Thies C. Arntzen <thies@thieso.net>
-
- * zend_operators.c: fixed is_identicat_function()
-
-1999-10-19 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h: - Move IS_IDENTICAL next to IS_EQUAL
-
- * zend_operators.c: - Fix is_identical function
-
- * zend-parser.y
- zend-scanner.l
- zend_compile.h
- zend_execute.c
- zend_opcode.c
- zend_operators.c
- zend_operators.h:
- - Preliminary submit of Thie's patch. Will fix the rest on Windows
- as this was added on UNIX with patch. Changed IS_SAME -> IS_IDENTICAL
-
-1999-10-18 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.h: Be safe, use ().
-
-1999-10-15 Andrei Zmievski <andrei@ispi.net>
-
- * zend_operators.c
- zend_operators.h: unstatic'fy is_numeric_string()
-
- * zend_hash.c
- zend_hash.h
- zend_compile.c: *** empty log message ***
-
-1999-10-15 Andi Gutmans <andi@zend.com>
-
- * zend_operators.h: - Add convert_to_number_ex()
-
-1999-10-14 sascha <sascha@pb1.pair.com>
-
- * configure.in:
- Add "--disable-inline" for low-memory machines (be it limited
- RAM or virtual memory). It's also useful for Digital C where
- the C++ compiler thinks "inline" is an invalid specifier.
-
- * Makefile.am: Use sources from $(srcdir)
-
-1999-10-13 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: Do not use $< for anything but implicit rules.
-
-1999-10-13 Thies C. Arntzen <thies@thieso.net>
-
- * zend_list.c:
- (zend_fetch_resource) added warinig if resource is of wrong type
-
-1999-10-13 sascha <sascha@pb1.pair.com>
-
- * acconfig.h: Disable ZEND_EXTENSIONS_SUPPORT, if RTLD_NOW is not defined.
-
- Note that this part could be made platform independent by using
- libltdl (for Solaris, Linux, *BSD, HP-UX, Win16/32, BeOS).
-
-1999-10-12 Thies C. Arntzen <thies@thieso.net>
-
- * zend_list.c
- zend_list.h: new improved resource-API
-
-1999-10-12 sascha <sascha@pb1.pair.com>
-
- * acconfig.h:
- Use DL_LAZY for OpenBSD. This seems to be a compatibility flag which
- should be used for the 2nd parameter to dlopen.
-
- http://www.openbsd.org/cgi-bin/cvsweb/src/share/man/man3/dlfcn.3?rev=1.8
-
-1999-10-12 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - object.ptr was made NULL in DO_FCALL but wasn't restored. Right now I
- push it in DO_FCALL and at the end of do_fcall_common it always gets
- popped. We might be able to optimize it out.
-
-1999-10-11 Andrei Zmievski <andrei@ispi.net>
-
- * .cvsignore: *** empty log message ***
-
- * zend_hash.c
- zend_hash.h: Modified zend_hash() to accept a pointer to sort function.
-
-1999-10-11 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - No idea why this bug didn't exist before. But I'm too tired to think of it.
- During a regular do_fcall we need to set object.ptr to NULL and, thus,
- push it in the beginning and pop it in the end.
- I hope this fix more or less cuts it. I just want to sleep :)
-
-1999-10-10 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Didn't lower refcount when doing an internal function call linked to a regular object.
-
-1999-10-10 Thies C. Arntzen <thies@thieso.net>
-
- * .cvsignore: added some more autoconf/libtool stuff to be ignored
-
-1999-10-10 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Clean up a bit. Separate before the locking so that we can use SEPARATE_ZVAL
- macro.
-
-1999-10-10 sascha <sascha@pb1.pair.com>
-
- * build.mk: Add clean target which removes standard targets
-
- * build.mk: build.mk can be used to generate build tools. It is usually
- faster than buildconf, since it rebuilds only components, if
- it is necessary. To use it, run
-
- $ make -f build.mk
-
-1999-10-09 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Shouldn't be needed
-
- * zend_execute.c:
- - God damn this sucked. I hopefully fixed the problems with classes although
- we might need to clean stuff up a bit.
-
-1999-10-09 sascha <sascha@pb1.pair.com>
-
- * acconfig.h:
- Define RTLD_NOW to DL_NOW, if RTLD_NOW is not defined (for OpenBSD).
-
-1999-10-07 Thies C. Arntzen <thies@thieso.net>
-
- * zend_variables.c
- zend_variables.h: added zval_del_ref() function
-
-1999-10-07 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Reverse my patch
-
-1999-10-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fixed memory leak with this pointer. It was somtimes initialized with refcount
- of 2 instead of 1.
- - Also fixed a place where object.ptr_ptr is set to pointing to a zval* instead
- of zval**. I don't think this is ever used so we might be able to remove it
- altogether.
-
-1999-10-06 Thies C. Arntzen <thies@thieso.net>
-
- * zend_execute.c: fix for using resources as array indices
-
-1999-10-05 sascha <sascha@pb1.pair.com>
-
- * configure.in
- zend.h
- zend_globals.h: More portability stuff
-
- * configure.in: OSF/1 V4.0 wants -lcxx
-
- * zend_compile.h:
- This causes link problems with anything higher than -O0.
-
-1999-10-04 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: Add necessary rule.
-
- * Makefile.am
- acconfig.h
- acinclude.m4
- buildconf
- configure.in
- zend_config.in: Use libtool to build.
-
-1999-10-04 Thies C. Arntzen <thies@thieso.net>
-
- * zend_builtin_functions.c: use getParametersEx for all builtin functions
-
- * zend_API.c
- zend_API.h: added add_*_resource() and add_*_bool() functions
-
-1999-10-03 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h: - Hooray. This might actually work. (I hope)
-
-1999-10-03 sascha <sascha@pb1.pair.com>
-
- * configure.in: Make it executable.
-
-1999-10-02 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Another locking fix.
-
- * zend_execute.c: - Fixed locking problem when fetching string offsets
-
-1999-10-02 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- Fix the leak reported on the PHP 3 list (isset() on string offsets)
-
-1999-10-01 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_API.h
- zend_builtin_functions.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c
- zend_operators.h:
- - Move is_ref back to being an unsigned char and not a bit field.
-
- * zend.h
- zend_API.h
- zend_builtin_functions.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c: - Remove locking support completely
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- - For Andrei. Implement references in array() initializations
-
-1999-09-29 Zeev Suraski <zeev@zend.com>
-
- * zend_config.w32.h: *** empty log message ***
-
-1999-09-29 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: Fix leak in += with arrays
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- - Fix SEND_VAR problem after fetch'ing a variable and not knowing the fetch type
-
-1999-09-29 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.c
- zend_API.h: added add_property_resource
-
-1999-09-28 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h
- zend_execute.c
- zend_execute_API.c:
- - Stop using the locking mechanism and start using refcount.
- Now we know when we need to free but we still need to support it
-
- * zend_execute.c
- zend_execute.h
- zend_execute_API.c:
- - First part of the patch which makes reads use ptr and not ptr_ptr.
-
-1999-09-28 sascha <sascha@pb1.pair.com>
-
- * acconfig.h
- configure.in
- zend-scanner.l: Provide alternative istdiostream.
-
- This has been tested with Sun WorkShop 4.2 C++ which does not
- contain class istdiostream.
-
-1999-09-26 sascha <sascha@pb1.pair.com>
-
- * Makefile.am
- configure.in: Actually allow to set CXXFLAGS
-
- * configure.in
- zend_config.in:
- Build communication channel and add checks for C++ library
-
-1999-09-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_execute.h
- zend_execute_API.c: - Changed Ts{}.var to Ts{}.var.ptr_ptr.
-
-1999-09-24 sascha <sascha@pb1.pair.com>
-
- * zend_operators.h: Add _ex API implementation for booleans.
-
-1999-09-24 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c
- zend_list.h: Exify the standardized resource stuff
-
-1999-09-23 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - Fix bug #2364.
- I haven't checked all of the conversion macros yet but there's a change
- there are more such bugs there.
-
-1999-09-23 sascha <sascha@pb1.pair.com>
-
- * configure.in: Fix vpath build w/ thread-safe enabled on Unix.
-
-1999-09-22 Thies C. Arntzen <thies@thieso.net>
-
- * zend_builtin_functions.c:
- preliminary fix for each until andi & zeev clean up!
-
- * zend_list.c:
- if you pass NULL as the resource_type_name to zend_fetch_resource*&friends the functions will not print any warnings if the resource is not found!
-
-1999-09-21 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Fix problem where function parameter fetches were created too late.
-
-1999-09-21 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c: Add get_func_args()
-
- * zend_builtin_functions.c: *** empty log message ***
-
-1999-09-20 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c:
- - Move some more Zend internal functions from PHP
-
- * zend-parser.y: - Next part of locking fix.
- $var = expr; and $var += expr; first create code for expr and later on
- for the fetch_w of $var.
-
- * zend_builtin_functions.c: - Newline for Sun's compiler
-
- * zend_API.h
- zend_builtin_functions.c: - Add some internal functions to Zend
-
- * zend_compile.c
- zend_compile.h
- zend_opcode.c:
- - First step in fixing locking problem. Array fetches are now always done last.
- Later on we will want to delay the write fetches even longer until after their
- resulting expression is parsed. The way it is now, will make it very easy
- to delay as long as we need.
-
- * zend_compile.c
- zend_compile.h:
- - Indirect references had all of the fetches by mistakenly backpatched.
- Actually all of the fetches are supposed to be read, except for the last
- one.
-
-1999-09-20 Zeev Suraski <zeev@zend.com>
-
- * libzend.dsp
- libzendts.dsp
- zend_builtin_functions.c: Added zend_num_args() and zend_get_arg()
-
- * Makefile.am
- zend.c
- zend_builtin_functions.c
- zend_builtin_functions.h:
- Add a file in which we can put Zend builtin functions
-
-1999-09-18 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Try to fix the leak Rasmus reported. It's pretty sucky code so I'm really
- not sure this fix is OK.I can't remember all of what we did there.
-
-1999-09-18 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c: Safer behavior
-
-1999-09-17 Thies C. Arntzen <thies@thieso.net>
-
- * zend_execute.c: make SUNs c89 happy
-
- * zend_execute_API.c: no // in the sources please
-
- * zend_globals_macros.h: added newline at end of file
-
-1999-09-17 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: - Fix bug #2318
-
-1999-09-16 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.h: Introduce convert_to_*_ex()
-
-1999-09-16 sascha <sascha@pb1.pair.com>
-
- * configure.in: this helps compiling on non-ANSI C compliant platforms
-
-1999-09-13 stig <stig@pb1.pair.com>
-
- * acconfig.h
- configure.in: Make sure HAVE_LIBDL gets defined.
- Disable more C++ tests when not configured for thread safety.
-
-1999-09-12 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Make this class instanciatable
-
-1999-09-12 sascha <sascha@pb1.pair.com>
-
- * configure.in: check for c++ only, if thread safety is enabled
-
-1999-09-10 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Shut up a warning
-
-1999-09-09 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_globals.h
- zend_stack.c
- zend_stack.h: - Add foreach() freeing code.
- - Fix switch() freeing code to only free current function's switch expressions.
- - I have a feeling break expr; in a switch where expr > 1 leaks because it
- won't free all of the expressions. Fix is probably not trivial.
-
- * zend_operators.c:
- - Fix leak when decrementing strings which actually are longs.
-
-1999-09-08 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix for floating point array offsets. Same behaviour as in PHP 3.0. We
- casted to (long).
-
- * Makefile.am
- libzendts.dsp: - Add -b option to flex++
-
-1999-09-07 stig <stig@pb1.pair.com>
-
- * acconfig.h: define tests first, use after.
-
-1999-09-06 Andi Gutmans <andi@zend.com>
-
- * zend_config.w32.h: - Fix win32 compile
-
- * zend_config.w32.h: - Make zend compile again in Win32.
-
-1999-09-06 stig <stig@pb1.pair.com>
-
- * .cvsignore: ignore zend-scanner.cc
-
- * ZendCore.dep
- libzend.dsp
- libzendts.dsp: hand-patched some MSVC files
-
- * Makefile.am
- acconfig.h
- acinclude.m4
- config.unix.h
- config.w32.h
- configure.in
- zend-scanner.l
- zend.h
- zend_API.c
- zend_alloc.c
- zend_compile.h
- zend_config.w32.h
- zend_execute.c
- zend_hash.c
- zend_list.c
- zend_ptr_stack.c
- zend_sprintf.c: * header file cleanup
- * fixed --enable-thread-safety build for UNIX
-
- I don't have a Win32 environment available, could someone please try
- compiling on Win32 to see if I got all the header file stuff right there?
-
-1999-09-05 Andi Gutmans <andi@zend.com>
-
- * zend_globals_macros.h: - Oops
-
- * libzendts.dsp
- zend.c
- zend.h
- zend_alloc.c
- zend_alloc.h
- zend_globals.h: - Shift around header files.
-
-1999-09-04 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c: Fix a stupid bug (from stefan@roehri.ch)
-
-1999-09-03 Zeev Suraski <zeev@zend.com>
-
- * zend_list.h: Damn, forgot to commit that
-
- * zend_list.c
- zend_list.h
- zend_modules.h: Add new API for resources
-
-1999-09-03 sascha <sascha@pb1.pair.com>
-
- * zend_modules.h: Add global startup/shutdown functions
-
-1999-09-03 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- Revert the IS_RESOURCE patch. It had some unintended behavior.
-
- * zend_variables.c: Let $GLOBALS actually work...
-
- * zend_operators.c:
- Release resources when converting to other types (fix Thies's reported problem)
-
-1999-09-02 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Use \0NameFilenameLineno as key instead of numeric index for runtime defined functions
-
-1999-08-28 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c
- zend.h
- zend_alloc.c
- zend_extensions.h
- zend_variables.c
- zend_variables.h: *** empty log message ***
-
- * zend.h
- zend_alloc.c
- zend_alloc.h
- zend_variables.c: Beef up debug macros
-
-1999-08-27 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c: Fix a crash bug in case of aborted execution
-
- * zend.h
- zend_alloc.c
- zend_alloc.h
- zend_execute_API.c
- zend_variables.c
- zend_variables.h: Better debug macros
-
-1999-08-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c: - Damn. It wasn't a correct fix. This should do it.
- When the zval ** are equal we don't want to assign_ref, in any other case
- I can think of we do want to assign_ref.
-
- * zend_execute_API.c: - Fix leak when global is used in the global scope.
-
- * zend_compile.c: - Fix when redefining classes at run-time.
-
-1999-08-25 sascha <sascha@pb1.pair.com>
-
- * zend.h: make it compile with gcc again
-
-1999-08-25 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c
- zend_hash.h: - Add hash_apply_with_arguments()
-
- * zend-scanner.l: - More elegant fix for Win32 include_path
-
- * zend-scanner.l:
- - Temporary fix to allow Win32 MT safe version to use zend_fopen().
-
-1999-08-23 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fixed a specific memory leak linked to locking.
-
-1999-08-22 sascha <sascha@pb1.pair.com>
-
- * zend.h
- zend_globals.h: This changes makes it work on egcs 1.1.2/Alpha
-
- * configure.in
- zend.h: remove checks
-
-1999-08-20 Zeev Suraski <zeev@zend.com>
-
- * zend_constants.c
- zend_constants.h
- zend.c: Fix for Thies's UMR
-
-1999-08-19 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_opcode.c:
- - Make sure expr_list and echo_list are either empty or comma seperated
- expressions
-
-1999-08-18 Thies C. Arntzen <thies@thieso.net>
-
- * zend-scanner.l: on unix ZTS gets defined in zend_config.h
-
-1999-08-17 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c: Fix #2012
-
- * zend_execute.c: Fix #2070
-
-1999-08-17 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend.h: - Add some ZENDAPI's
-
-1999-08-15 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Oopsie
-
- * zend.h
- zend_compile.h
- zend_execute.c
- zend_globals.h: - Optimize the execute stack a bit.
-
-1999-08-14 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Fix several class issues
-
- * zend_compile.c
- zend_compile.h:
- Generate better warnings for class/function redefinitions
-
-1999-08-10 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_constants.c: - Got rid of the C++ comments.
-
-1999-08-09 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Thies's crash fix.
-
-1999-08-07 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h
- zend_execute.c
- zend_execute_API.c: Fix a few leaks
-
-1999-08-06 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c: Fix a bug in call_user_func_ex()
-
- * zend_API.h: Now that's an annoying bug.
-
- * zend_API.h
- zend_execute_API.c: Introduce call_user_func_ex()
-
- * zend_execute.c: *** empty log message ***
-
-1999-08-03 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_opcode.c:
- - Initialize extended value's and put the fetch_type in it's own variable
- name.
-
-1999-08-02 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h:
- Make set_compiled_filename() return a pointer to the allocated file name
-
-1999-07-31 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h: These aren't necessary
-
-1999-07-30 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h: Support symbols in any symbol table, not just the active one
-
-1999-07-30 Andi Gutmans <andi@zend.com>
-
- * zend_ptr_stack.c: - Damn that's more like it.
-
- * zend_ptr_stack.c: - Cut&paste crap
-
- * zend_execute.c
- zend_ptr_stack.c
- zend_ptr_stack.h:
- - Add ptr_stack_n_{push,pop} in order to speed up function calls a bit.
- There seems to be no reason for stack->top in the ptr_stack except for
- when realloc()'in the stack. I think I'll remove it.
-
-1999-07-30 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h:
- * Setting variables in the global scope wasn't handling is_ref's properly
-
-1999-07-29 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h:
- - Fixed a leak when doing inheritance. The parent class name wasn't being freed.
- - Fixed a stack leak. Functions that had late argument binding were set up as
- INIT_FCALL_BY_NAME but were using DO_FCALL and not the corresponding
- DO_FCALL_BY_NAME.
-
-1999-07-28 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_hash.c: - Fixed various inheritance problems & Andrey's leak
-
-1999-07-27 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Inherit parent's constructor
-
- * zend_compile.c:
- Fix runtime inheritence (child functions/members should have higher precedence)
-
-1999-07-27 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Add missing lock
-
- * zend_execute.c: - Fix up the new operator a bit more.
-
-1999-07-27 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Set reference count and is_ref values for new objects
-
-1999-07-26 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- - Fixed a memory leak when using assignment-op operators with lvalue of type
- string (or array/object)
-
- * zend_compile.c: *** empty log message ***
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c:
- Fix a bug in inheritence from classes defined in include files, that are
- inherited from require()'d files
-
-1999-07-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Oops I erased this by mistake
-
- * zend_execute.c:
- - Should be a complete fix now. This break away code should maybe be made
- somewhat generic
-
- * zend_execute.c: - Temporary fix for "this". Have to fix it tomorrow.
-
- * zend_execute.c:
- - Fix compile error. Weird that Visual didn't catch this one.
-
- * zend-parser.y
- zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c: - Fix the new operator incompatibility.
- - I commented PHP_FUNCTION(strtotime) in datetime.c because it stopped
- win32 from compiling. This needs to be fixed!!!
- - Check out libzend to compile the tree now.
-
- * zend.h
- zend_execute.c: - new operator fixes
-
-1999-07-25 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c: - Commiting to branch newoperator.
- - To check it out do cvs checkout -rnewoperator libzend
-
-1999-07-24 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Fix that memory leak... nested function issue remains
-
- * zend_compile.c
- zend_stack.c
- zend_stack.h: Fix RETURN & SWITCH memory leak issue
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- Thoroughly fix the SWITCH problem. No RETURN handling yet.
-
-1999-07-23 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute.h: Fix bug #1812
-
- * zend.h
- zend_operators.c:
- * Add an API macro users can use to ensure an array member can be modifed
- before they modify it.
- * Fix a bug and remove redundant code in convert_to_long() (booleans and
- resources weren't changing their types
-
-1999-07-22 Zeev Suraski <zeev@zend.com>
-
- * zend_constants.c: New constants
-
-1999-07-22 stig <stig@pb1.pair.com>
-
- * buildconf: identify ourselves
-
-1999-07-20 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Include alloca.h when need and available.
-
- * zend_compile.c
- zend_execute_API.c
- zend_list.c
- zend_operators.c: - Get rid of C++ comments
-
-1999-07-19 Zeev Suraski <zeev@zend.com>
-
- * config.unix.h
- config.w32.h
- zend-parser.y
- zend-scanner.h
- zend-scanner.l
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_constants.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_globals.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_modules.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_variables.c
- zend_variables.h: 0.91 update
-
-1999-07-19 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_execute.c
- zend_extensions.h: * Fix Zend version
- * Fix a method call bug
-
- * LICENSE
- libzendts.dsp: License update
-
- * zend_errors.h: Make error codes PHP 3.0 compatible
-
-1999-07-18 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c:
- - Should fix the memory leak when returning from the main scope.
-
-1999-07-17 Zeev Suraski <zeev@zend.com>
-
- * configure.in: Debug on by default
-
-1999-07-16 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Ignore T_PHP_TRACK_VARS in the parser (handled in the scanner)
-
- * config.unix.h
- config.w32.h
- zend-parser.y
- zend-scanner.h
- zend-scanner.l
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_constants.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_globals.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_modules.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_variables.c
- zend_variables.h: License update
-
-1999-07-15 Andi Gutmans <andi@zend.com>
-
- * zend.c: Change true/false back to 1/""
-
- * zend_execute.c: Fix a lock issue
-
-1999-07-15 sascha <sascha@pb1.pair.com>
-
- * zend_execute_API.c: disable zend_handle_sigsegv
-
-1999-07-14 Andi Gutmans <andi@zend.com>
-
- * libzendts.dsp
- zend.c: Fix thread unsafe constants startup
-
- * LICENSE
- zend.c
- zend_constants.c
- zend_constants.h: - License update
- - Fix multithreaded constants startup
-
- * zend_operators.c: - Fix for boolean convert to number
-
-1999-07-12 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fixed a purify warning
-
-1999-07-10 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Oh, that dumb bug.
-
-1999-07-10 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_hash.c: Ok, so we do have to lock in there
-
- * zend.c
- zend_execute.c: Fix assignments of reference variables
-
-1999-07-10 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c: Woops, fix.
-
- * zend_execute.c
- zend_execute_API.c
- zend_globals.h: Put the garbage in the garbage bin
-
- * zend_alloc.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_variables.c: Get rid of AiCount completely
-
- * zend_execute.c: Final tweaks
-
- * zend_execute.c
- zend_hash.c: More locking work
-
-1999-07-09 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: *** empty log message ***
-
- * zend_execute.c: More stuff
-
- * zend-parser.y
- zend.h
- zend_API.c
- zend_API.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c
- zend_operators.c
- zend_variables.c: Step 4:
- Move to a 7-bit counter (not fully implemented yet)
-
- * zend_API.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c
- zend_variables.c: Phase 3:
- Use a single bit to mark IS_REF variables
-
- * zend-parser.y
- zend.h
- zend_API.c
- zend_API.h
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c
- zend_operators.c: Step 2:
- Rename is_ref to EA
-
- * zend.c
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_constants.h
- zend_execute_API.c
- zend_hash.c
- zend_hash.h
- zend_list.c
- zend_list.h
- zend_modules.h
- zend_opcode.c
- zend_variables.c
- zend_variables.h: Step 1 in nuking the garbage collector:
- - Change the hash destructor to return int
- - Don't kill the bucket on hash_destroy if the destructor returns 0
-
- * config.w32.h
- configure.in
- zend_alloc.c: *** empty log message ***
-
- * zend_alloc.c: Send a SIGSEGV instead of exiting, to trigger a core dump
-
- * zend_alloc.c
- zend_alloc.h
- zend_hash.c: * Support recoverable failure from erealloc()
- * Fix the shutdown code on an unrecoverable erealloc() failure
-
- * zend_execute_API.c: Fix the mess in SIGSEGV handling, hopefully
-
-1999-07-08 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h
- zend_compile.c:
- Support definition of classes that are derived from classes that are defined in runtime
-
-1999-07-06 sascha <sascha@pb1.pair.com>
-
- * zend.h: enable it, until we find a better way
-
-1999-07-05 sascha <sascha@pb1.pair.com>
-
- * zend.h: make Solaris gcc happy
-
- * configure.in
- zend.h: use void * instead of long for 64-bit test
-
-1999-07-05 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h: added RETVAL_RESOURCE and RETURN_RESOURCE
-
-1999-07-04 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- Make convert_to_string() regard false as "" instead of "0"
-
-1999-07-03 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: don't wipe files for distributions
-
- * configure.in
- zend.h:
- checking for ints won't work, since they are 32 bit on both platforms
-
-1999-07-03 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Support isset()/empty() for string offsets
-
- * zend-scanner.l: Fix a crash
-
-1999-07-03 sascha <sascha@pb1.pair.com>
-
- * configure.in: add usual rhapsody hack
-
- * config.unix.h: missing DL_HANDLE broke build
-
- * zend_extensions.c: typo
-
-1999-07-02 sascha <sascha@pb1.pair.com>
-
- * acconfig.h
- configure.in
- zend.h: workaround for 64-bit platforms
-
-1999-07-02 Zeev Suraski <zeev@zend.com>
-
- * acconfig.h
- configure.in
- zend_globals.h: define zend_bool
-
-1999-06-30 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y: Make require accept any parameter
-
-1999-06-26 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.h
- zend_operators.c
- zend_alloc.c:
- * Make the memory leak reporting code much better with repeats
- * Remove useless variables
-
-1999-06-22 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Fix Thies's bug report
-
- * zend_alloc.c
- zend_compile.c
- zend_operators.c:
- * Fix concatenation of arrays (it was PHP 3.0 style, copying zval's instead
- of zval *, and it wasn't using reference counting)
- * Fix a memory leak in static array()'s with textual indices
-
-1999-06-19 Zeev Suraski <zeev@zend.com>
-
- * zend.c: *** empty log message ***
-
- * zend.h
- zend_extensions.h:
- Add a standard get_ini_entry() to interface between Zend and the outside world
-
- * configure.in: *** empty log message ***
-
-1999-06-16 stig <stig@pb1.pair.com>
-
- * zend_modules.h:
- added INIT_FUNC_ARGS_PASSTHRU and SHUTDOWN_FUNC_ARGS_PASSTHRU
-
-1999-06-15 stig <stig@pb1.pair.com>
-
- * zend_operators.c
- zend_operators.h: * added zend_binary_strcasecmp()
-
-1999-06-12 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y:
- We can't quite go with expr there (shift/reduce conflict), go with scalar.
-
- * zend-parser.y: require() improvement as per Andi's suggestion
-
-1999-06-11 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- Make the concatenation operator use make_printable as well
-
- * zend-scanner.l: Don't take failing on an include file so badly
-
- * zend-scanner.l: Support <?=
-
- * zend_compile.c: E_ERROR -> E_COMPILE_ERROR in the compiler
-
- * zend_compile.c: Two fixes:
- * The error generated by a failed class inheritence wasn't properly
- displaying the file in which he error occured.
- * Inheritence didn't work if the parent class had uppercase letters in it.
-
- * zend-parser.y
- zend-scanner.l
- zend_execute.c: * Use to_string() instead of __print()
- * Support boolean casts ((bool) and (boolean))
-
- * zend.c: Change __print into to_string()
-
- * zend.c
- zend.h
- zend_execute.c
- zend_execute_API.c:
- * Make the output handling of variables much, much cooler.
- Uses zend_make_printable_zval() instead of convert_to_string() now:
-
- $foo = true;
- print "\$foo is $foo";
- will now print
- $foo is true
- (instead of "$foo is 1", earlier).
-
- Also, with objects, it automatically tries to call __print() and use it as a printing
- function.
-
- For example:
-
- class foo {
- function __print() { return "Foo Object"; }
- };
-
- $foo = new foo;
- print $foo;
-
- will print "Foo Object".
-
-1999-06-10 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Now THAT's an annoying bug.
-
-1999-06-09 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c: Fix
-
- * zend_API.c
- zend_execute.c:
- * Fix cases where you assign an array element to the parent array (the array was
- being erased before the assignment, so the element was being smashed).
-
- * zend_execute.c
- zend_execute_API.c: * Fix foreach() that receives a non array argument
- * Clean up some C++ comments
-
-1999-06-09 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_operators.c: - Fix the static array() initializing
-
-1999-06-08 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c: Replace error messages
-
-1999-06-08 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c: * Fix a by-name call/method call bug
- * Clean and optimize the whole function call process
-
-1999-06-07 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c
- zend_hash.h: Add zend_hash_get_current_key_type()
-
-1999-06-06 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- Work around a compiler bug - mark variables that are sent to functions that aren't yet
- defined as FETCH_W (because they might end up being sent by reference)
-
-1999-06-05 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_compile.c
- zend_compile.h: * Centralized shutdown
- * Change shutdown order again
-
- * zend_compile.c:
- Call the request_shutdown on modules before destroying symbol tables, so that
- the session module can be implemented
-
- * zend-scanner.l
- zend_compile.c
- zend_execute.c:
- - Fixed Karl's bug report. It's not really a thorough fix, we really need to rethink the INIT_FCALL/DO_FCALL issue.
- - Fixed numerous AiCount problems
-
-1999-06-04 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_opcode.c: New $GLOBALS init
-
- * zend_execute_API.c:
- Fix that GLOBALS leak. We were explicitly adding GLOBALS to the main symbol table,
- but there's no reason to do it (INIT_GLOBALS takes care of it if necessary.)
-
- * zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_list.c
- zend_list.h
- zend_opcode.c
- zend_operators.c: Minor updates (mostly __declspec() stuff)
-
-1999-06-04 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h: added is_ref=0 and refcount=1 to SET_VAR_* macros
-
-1999-06-03 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y: T_BAD_CHARACTER is actually a string.
-
-1999-06-03 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l
- zend_execute.c:
- - We weren't counting newlines in heredocs. The only place which is still questionable
- is when there's a \ followed by a newline but it seems we have a parse error in this
- case anyways.
- - Fixed the alloca() macros so that the alloca() #define in win32 mode won't clash
- with the real win32 alloca().
-
-1999-06-01 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Make execute() use less stack in thread-safe win32 due to Microsoft's shitty 256kb stack.
-
-1999-05-31 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_alloc.c: *** empty log message ***
-
-1999-05-31 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l
- zend_compile.c
- zend_execute.c
- zend_execute_API.c: Fixes
-
-1999-05-30 sascha <sascha@pb1.pair.com>
-
- * zend_alloc.c
- zend_compile.h
- zend_execute_API.c
- zend_indent.c
- zend_opcode.c: * fix some casts
- * introduce unary_op_type - cleaner than casting data voids to function ptrs
-
-1999-05-29 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c:
- That got fucked up when we went back to using uninitialized_zval
-
-1999-05-29 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: another VPATH related change
-
-1999-05-29 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y: Fix a bug
-
- * zend_hash.c
- zend_hash.h
- zend_operators.c: Support overwrite mode in zend_hash_merge()
-
-1999-05-29 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: - clean is not called from automake. use CLEANFILES instead
- - allow VPATH compilation
-
-1999-05-29 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Correct fix
-
- * zend_execute_API.c: *** empty log message ***
-
- * zend_execute.c: Fix a leak
-
-1999-05-28 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c: * Support getThis() for internal functions.
- * Fix 'new object or die' and AiCount issue thoroughly (earlier fix didn't
- work with the optimizer).
- * Add new macros for standardized definition of classes.
- * Only report AiCount problems if shutdown was not silent.
-
-1999-05-27 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix the AiCount issue with objects
-
- * zend_API.h: Moved all #define's for SET_ and RETURN_ to zend_API.h
-
-1999-05-25 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c:
- Avoid crashing if an error occurs before we open the first file.
-
-1999-05-24 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: The last fix was wrong
-
- * zend_operators.c: Another operators fix
-
-1999-05-23 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- boolean comparison didn't work with smaller-than and greater-than, something that
- fucked up berber's site a bit. fixed.
-
-1999-05-22 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- Sigh, another leak bites the dust. FREE_OP missing in case of a SEND_VAR.
-
- * zend-parser.y: I'm on a roll. Fix a nasty yet stupid AiCount bug
-
- * zend_alloc.c: Warn about AiCount not zeroing out
-
- * zend-parser.y
- zend-scanner.h
- zend.h
- zend_alloc.c
- zend_alloc.h
- zend_compile.c
- zend_compile.h
- zend_constants.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.h
- zend_highlight.h
- zend_list.h
- zend_llist.h
- zend_ptr_stack.h
- zend_stack.h:
- * Add struct name to all typedef's so that they can be debugged with MSVC
- * Fix an AiCount bug - list(...) = $var was using $var multiple times, and thus
- causing AiCount to be decreased multiple times even though it was increased only
- once for $var. Mark all FETCH_DIM's so that they won't decrease AiCount, and only
- decrease AiCount on the last FETCH_DIM.
- * Fix a stupid bug - forgot to pass CLS_C to some compiler function. For some reason
- MSVC doesn't report these :I
-
- * zend.h
- zend_alloc.c
- zend_execute_API.c:
- Give more information and save log lines in memory leak reports
-
- * zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_globals.h
- zend_llist.c
- zend_llist.h: Avoid leaking fd's in case of failures
-
- * zend-scanner.l: more fixes
-
-1999-05-21 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: That wasn't supposed to slip in
-
- * zend-scanner.l: * Properly handle failed file opens in C++
- * Properly handle failed require()'s within libzend
-
- * zend-scanner.l: * Fix the comments issue. yymore() worked like a charm.
- * Change all flex states to be prefixed with ST_
-
-1999-05-20 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h
- zend_execute.c: Optimize allocations into uninitialized_zval assignments
-
-1999-05-20 Andi Gutmans <andi@zend.com>
-
- * config.w32.h
- libzend.dsp
- libzendts.dsp
- zend_compile.c
- zend_compile.h: - Updates we did today
-
- * zend_compile.c: - Fix a small problem with class decelerations.
-
- * zend-scanner.l: -Open curly braces fix?
-
-1999-05-15 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_hash.c
- zend-parser.y:
- * Fix all hash checks that checked Bucket.arKey for NULL, when it was changed
- to char[1], these checks should have been changed to Bucket.nKeyLength==0
- * Support runtime declaration of functions. I ended up changing the grammar
- to catch top level functions vs. nested functions. The reason is simple -
- if we don't have functions properly declared at compile-time, function calls
- cannot be resolved at compile time, and have to be resolved at runtime, which
- ends up being much much slower (without the optimizer, that is).
- It's no biggy though, the grammar change isn't that bad.
-
-1999-05-14 Zeev Suraski <zeev@zend.com>
-
- * configure.in
- zend-scanner.l:
- If a require() dies, we must bail out (since it corrupts an existing op_array
-
- * zend-scanner.l: Fix a bug
-
-1999-05-14 stig <stig@pb1.pair.com>
-
- * Makefile.am: don't install Zend on the system
-
-1999-05-14 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l:
- Add \012 and \xff missing support to constant quoted string
-
-1999-05-12 Zeev Suraski <zeev@zend.com>
-
- * zend.h: *** empty log message ***
-
-1999-05-12 stig <stig@pb1.pair.com>
-
- * Makefile.am: install libzend.a and header files on "make install"
-
- * acconfig.h
- configure.in: add --enable-thread-safety option
-
-1999-05-12 Zeev Suraski <zeev@zend.com>
-
- * zend_llist.c
- zend_llist.h: Added prepend to llist
-
-1999-05-11 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend.c: Fixes:
- * Avoid closing stdin (I could have sworn I've committed that already)
- * unclean_shutdown patches
-
- * zend_alloc.c: Easier Win32 debug code
-
- * zend-scanner.l
- zend_compile.c
- zend_globals.h
- zend_highlight.c:
- * Fix a bug that occured in case of parse errors. We need to restore the lexical state
- even if the compilation failed.
-
-1999-05-10 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.h
- zend-scanner.l
- zend.c
- zend_alloc.c
- zend_compile.h:
- Weed out all BoundsChecker-found bugs (including a serious file descriptor leak
- in the C++ scanner)
-
-1999-05-09 Zeev Suraski <zeev@zend.com>
-
- * zend_modules.h: Change argument name
-
- * zend.c
- zend_API.c
- zend_API.h
- zend_modules.h: Almost forgot to commit those
-
-1999-05-06 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: Ok, I tested it now. It works very nicely!
-
-1999-05-05 Andi Gutmans <andi@zend.com>
-
- * zend_llist.c
- zend_llist.h: llist improvements
-
-1999-05-02 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend_compile.h: - Don't support interactive mode when thread safe.
-
-1999-05-01 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Several operator fixes. Should fix the MySQL problem.
-
-1999-04-30 Andi Gutmans <andi@zend.com>
-
- * zend_opcode.c: - Free refcount when destroying the last class reference.
-
- * zend-parser.y: - Missed one place
-
- * zend-parser.y: - First try at fixing $a->foo[] syntax.
-
- * zend-scanner.l:
- - Move back to yyless(). I haven't tested it yet because it's taking too long
- to compile and I have to disconnect
-
-1999-04-30 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend-scanner.l:
- Fix Boris's problem (in my never ending struggle to show I never mean what I say
- when I say something's not gonna happen :)
-
- * zend-scanner.l
- zend_compile.c:
- * Fix a problem with constant quoted strings, that was causing Thies's problem
- * Remove a development-time printf
-
-1999-04-29 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l: - No reason to handle newlines here.
-
-1999-04-28 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: Make the C++ scanner support interactive input
-
-1999-04-27 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend_compile.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_opcode.c: * Fix debugger+interactive mode bug
- * Recognize whether an extension is with debug information or not
-
-1999-04-26 Zeev Suraski <zeev@zend.com>
-
- * libzendts.dsp: fix
-
- * config.w32.h
- libzend.dsp
- libzendts.dsp
- zend-scanner.l
- zend.c
- zend_alloc.c
- zend_compile.h
- zend_globals.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_opcode.c
- zend_sprintf.c: Various thread safety fixes and DLL updates
-
-1999-04-26 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l
- zend.c
- zend_alloc.c
- zend_globals.h: -More commits
-
-1999-04-24 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Another small fix
-
- * libzendts.dsp: dsp update
-
- * zend.c
- zend_globals.h: Thread safety fixes
-
- * zend_list.c: Remove redundant includes
-
-1999-04-24 zeevread <zeevread@pb1.pair.com>
-
- * zend-scanner.l: g++ compile fix
-
-1999-04-24 Zeev Suraski <zeev@zend.com>
-
- * Makefile.am
- zend-scanner.l: *** empty log message ***
-
- * zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_opcode.c
- zend-parser.y
- zend-scanner.l: Cleanups, remove old ts code
-
-1999-04-23 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Arithmetics bug fix
-
- * zend-scanner.h
- zend-scanner.l: Support eval() and highlight_string() in the C++ scanner
-
-1999-04-23 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l:
- - Use yyless() instead of unput() where possible. I'll erase the commented
- out code in a day or so.
-
-1999-04-23 Zeev Suraski <zeev@zend.com>
-
- * FlexLexer.h
- flex.skl
- zend-scanner.h
- zend-scanner.l
- zend.h
- zend_alloc.c
- zend_alloc.h
- zend_compile.h
- zend_globals.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_operators.h
- zend_variables.h: Ok, call me crazy, because I probably am.
- Thread safe version now uses a C++ scanner object. Works fully.
-
-1999-04-22 Zeev Suraski <zeev@zend.com>
-
- * acconfig.h
- zend-parser.y
- zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_globals.h
- zend_highlight.c
- zend_indent.c
- zend_opcode.c: Make token names uniform, they all begin with T_ now.
-
-1999-04-21 stig <stig@pb1.pair.com>
-
- * buildconf: state which aclocal.m4 and configure files are created
-
- * Makefile.am:
- zend-parser.o and zend-scanner.o were included twice in libzend.a
-
-1999-04-21 Zeev Suraski <zeev@zend.com>
-
- * FlexLexer.h
- flex.skl
- libzendts.dsp
- zend_API.c
- zend_API.h
- zend_globals.h:
- * Change the thread safe project to create a C++ scanner.
- * Add in a slightly modified skeleton file (only a couple of #if's for #include's
- that we dont have in Windows)
-
- It does NOT compile or work yet :)
-
- * zend_list.h: Fix
-
- * zend.c
- zend_compile.c
- zend_constants.c
- zend_constants.h
- zend_list.c
- zend_list.h:
- Thread safety patch. It works now with 'just in time' resource initialization!
-
- * libzend.dsp
- libzendts.dsp
- zend_globals.h: Thread-safe project
-
-1999-04-21 stig <stig@pb1.pair.com>
-
- * buildconf: move automake back to before autoconf
-
- * buildconf:
- autoheader must be called after autoconf, automake after autoheader
-
- * zend_config.h.in: think before one commits
-
- * zend_config.h.in: doh. cvs appears to ignore .in files by default
-
-1999-04-21 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend-scanner.l
- zend.c
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h
- zend_opcode.c:
- Thread safety patch. We're still not quite there but it compiles again, and
- more logic has been implemented.
-
-1999-04-20 stig <stig@pb1.pair.com>
-
- * .cvsignore
- Makefile.am
- Makefile.in
- aclocal.m4
- buildconf: Makefile.in and aclocal.m4 are generated
- added buildconf script
-
-1999-04-19 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c
- zend_extensions.h:
- Return a success value from the startup function, so we can unload immediately
- if it fails.
-
-1999-04-19 stig <stig@pb1.pair.com>
-
- * .cvsignore
- Makefile.am
- Makefile.in
- acconfig.h
- acinclude.m4
- aclocal.m4
- config.h.in
- configure.in
- zend.h: convert to automake
-
-1999-04-19 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_API.h: Add a couple of ZEND_API's
-
- * config.w32.h
- zend-parser.y
- zend_compile.c
- zend_execute.c: Support =unset as arguments
-
-1999-04-19 stig <stig@pb1.pair.com>
-
- * acconfig.h
- config.h.in
- configure.in: removed -lnsl and -lsocket checks from zend
-
-1999-04-18 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: AiCount needs to be decreased here
-
- * configure.in
- zend-scanner.l
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_compile.c
- zend_extensions.c
- zend_extensions.h
- zend_globals.h
- zend_llist.c
- zend_modules.h
- zend_opcode.c: Whatnot:
- * updated alloc_persist to use critical sections
- * changed extension shutdown to two-phase
- * updated dependencies
- * PR support (don't remember if there was any really)
-
-1999-04-15 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - one more place which seems to have needed fixing. I don't have time to look
- more into it. I hope we don't have anymore places which need fixing.
-
- * zend_compile.c:
- - Should fix the pass by reference problem. This happened because we moved
- start from arg 1 now and not arg 0. There might be more places which need fixing
- like in the executor but the bug seems OK now.
-
-1999-04-14 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h: Compile fix
-
-1999-04-14 Andi Gutmans <andi@zend.com>
-
- * config.w32.h
- libzend.dsp
- zend-scanner.l
- zend_API.c
- zend_API.h
- zend_compile.c
- zend_compile.h
- zend_opcode.c: -Tiny patches
-
-1999-04-13 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Better detection
-
- * zend_execute.c:
- Move Ai stuff before get_zval_*(), like Andi suggested. Fixes Sascha's huge
- memory leak
-
-1999-04-13 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_execute.c
- zend_execute_API.c: - Fix various memory leaks.
-
- * zend_execute.c: Refcount bugfix
-
- * libzend.dsp
- zend_API.c
- zend_execute_API.c
- zend_ptr_stack.c: * Optimize argument_stack top lookup
- * Fix a nasty bug in zend_ptr_stack_clean()
-
-1999-04-12 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c
- zend_globals.h: Remove unnecessary stack
-
- * zend_API.c: off by one
-
- * zend_execute.c: Minor optimization
-
- * zend_API.c: Make functions that don't take arguments somewhat happier:)
-
- * zend_execute.c:
- This should take care of "this" for user-defined functions. It wasn't yet working
- for built-in functions anyway, this one is coming soon.
-
- * zend_compile.c
- zend_execute_API.c:
- Destroy the resource list after destroying the symbol table, otherwise the
- auto-destructor for resources are run when the resource list is no longer valid
-
- * zend-parser.y
- zend.h
- zend_API.c
- zend_API.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h
- zend_ptr_stack.c:
- This patch is a go. Not fully optimized yet, but working properly.
- Prepatch tagged as BEFORE_STACK_PATCH.
-
- * zend_compile.c
- zend_execute.c: Minor fixes:
- missing zval_copy_ctor()
- messed up AiCount fix
-
-1999-04-10 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c
- zend_alloc.h: Allow runtime setting of the memory limit
-
- * zend_alloc.c
- zend_alloc.h
- zend_globals.h: Get rid of php3_ini in Zend
-
- * zend.c
- zend.h:
- We need to initialize the utility values after we initialize the INI file, which in
- turn, is after we initialize Zend. Set the utility values separately from Zend's
- initialization
-
-1999-04-09 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l: - Changed here-docs to <<< followed by whitespace.
-
-1999-04-09 stig <stig@pb1.pair.com>
-
- * .cvsignore: ignore file
-
-1999-04-09 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.h:
- - I guess print $GLOBALS and print "$GLOBALS" should yield the same result
- so I returned the one in encaps_var.
- - Made INITAL_OP_ARRAY_SIZE smaller (64? can't remeber). I don't think the
- erealloc()'s during compile time are such a biggy, we might make it even
- smaller. We can have a configure time option as to it's size.
-
- * zend-parser.y:
- - Support $GLOBALS in cvar's. Now list(..) = each($GLOBALS) will work.
- - Remove support of $GLOBALS in enacapsed strings. print "$GLOBALS" isn't
- supposed to work in any case.
-
-1999-04-09 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l:
- Honor a semicolon on the same line as an ending token of a heredoc
-
- * zend_compile.c: Prevent class redeclarations
-
-1999-04-08 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c
- zend_modules.h: * Add arguments to shutdown functions
- * Remove traces of php_ini stuff
-
- * zend-parser.y: "Our favourite mistake"
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_opcode.c: $GLOBALS support
-
-1999-04-08 Andi Gutmans <andi@zend.com>
-
- * ZEND_CHANGES: foreach() syntax has changed
-
-1999-04-08 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_execute.c: Fix static assignment
-
-1999-04-07 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c: Remove an unused variable
-
- * libzend.dsp: That's better.
-
- * libzend.dsp: We didn't save the .dsp back then...
-
- * ZendCore.dsp
- ZendCore.dsw
- ZendCore.mak
- diffs
- libzend.dsp: Cleanups: ZendCore->libzend
-
-1999-04-07 Rasmus Lerdorf <rasmus@php.net>
-
- * zend.c: *** empty log message ***
-
-1999-04-07 Andi Gutmans <andi@zend.com>
-
- * LICENSE
- Makefile.in
- ZEND_CHANGES
- configure.in
- zend-parser.y
- zend-scanner.h
- zend-scanner.l
- zend.h
- zend_API.c
- zend_API.h
- zend_compile.h
- zend_errors.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_hash.c
- zend_hash.h
- zend_list.c
- zend_list.h
- zend_llist.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_stack.c
- zend_stack.h
- zend_variables.c
- zend_variables.h: New file.
-
- * LICENSE
- Makefile.in
- ZEND_CHANGES
- configure.in
- zend-parser.y
- zend-scanner.h
- zend-scanner.l
- zend.h
- zend_API.c
- zend_API.h
- zend_compile.h
- zend_errors.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_hash.c
- zend_hash.h
- zend_list.c
- zend_list.h
- zend_llist.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_stack.c
- zend_stack.h
- zend_variables.c
- zend_variables.h: Zend Library
-
- * ZendCore.dep
- ZendCore.dsp
- ZendCore.dsw
- ZendCore.mak
- acconfig.h
- aclocal.m4
- config.h.in
- config.unix.h
- config.w32.h
- diffs
- zend.c
- zend.ico
- zend_alloc.c
- zend_alloc.h
- zend_compile.c
- zend_constants.c
- zend_constants.h
- zend_execute.h
- zend_extensions.c
- zend_extensions.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_llist.c
- zend_modules.h
- zend_sprintf.c: New file.
-
- * ZendCore.dep
- ZendCore.dsp
- ZendCore.dsw
- ZendCore.mak
- acconfig.h
- aclocal.m4
- config.h.in
- config.unix.h
- config.w32.h
- diffs
- zend.c
- zend.ico
- zend_alloc.c
- zend_alloc.h
- zend_compile.c
- zend_constants.c
- zend_constants.h
- zend_execute.h
- zend_extensions.c
- zend_extensions.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_llist.c
- zend_modules.h
- zend_sprintf.c: Zend Library
-
diff --git a/Zend/FlexLexer.h b/Zend/FlexLexer.h
deleted file mode 100644
index fd65258570..0000000000
--- a/Zend/FlexLexer.h
+++ /dev/null
@@ -1,186 +0,0 @@
-// $Header$
-
-// FlexLexer.h -- define interfaces for lexical analyzer classes generated
-// by flex
-
-// Copyright (c) 1993 The Regents of the University of California.
-// All rights reserved.
-//
-// This code is derived from software contributed to Berkeley by
-// Kent Williams and Tom Epperly.
-//
-// Redistribution and use in source and binary forms with or without
-// modification are permitted provided that: (1) source distributions retain
-// this entire copyright notice and comment, and (2) distributions including
-// binaries display the following acknowledgement: ``This product includes
-// software developed by the University of California, Berkeley and its
-// contributors'' in the documentation or other materials provided with the
-// distribution and in all advertising materials mentioning features or use
-// of this software. Neither the name of the University nor the names of
-// its contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-
-// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
-// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-// This file defines FlexLexer, an abstract class which specifies the
-// external interface provided to flex C++ lexer objects, and yyFlexLexer,
-// which defines a particular lexer class.
-//
-// If you want to create multiple lexer classes, you use the -P flag
-// to rename each yyFlexLexer to some other xxFlexLexer. You then
-// include <FlexLexer.h> in your other sources once per lexer class:
-//
-// #undef yyFlexLexer
-// #define yyFlexLexer xxFlexLexer
-// #include <FlexLexer.h>
-//
-// #undef yyFlexLexer
-// #define yyFlexLexer zzFlexLexer
-// #include <FlexLexer.h>
-// ...
-
-#ifndef FLEXLEXER_H
-// Never included before - need to define base class.
-#define FLEXLEXER_H
-#include <iostream.h>
-
-extern "C++" {
-
-struct yy_buffer_state;
-typedef int yy_state_type;
-
-class FlexLexer {
-public:
- virtual ~FlexLexer() { }
-
- const char* YYText() { return yytext; }
- int YYLeng() { return yyleng; }
-
- virtual void
- yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
- virtual struct yy_buffer_state*
- yy_create_buffer( istream* s, int size ) = 0;
- virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
- virtual void yyrestart( istream* s ) = 0;
-
- virtual int yylex() = 0;
-
- // Call yylex with new input/output sources.
- int yylex( istream* new_in, ostream* new_out = 0 )
- {
- switch_streams( new_in, new_out );
- return yylex();
- }
-
- // Switch to new input/output streams. A nil stream pointer
- // indicates "keep the current one".
- virtual void switch_streams( istream* new_in = 0,
- ostream* new_out = 0 ) = 0;
-
- int lineno() const { return yylineno; }
-
- int debug() const { return yy_flex_debug; }
- void set_debug( int flag ) { yy_flex_debug = flag; }
-
-protected:
- char* yytext;
- int yyleng;
- int yylineno; // only maintained if you use %option yylineno
- int yy_flex_debug; // only has effect with -d or "%option debug"
-};
-
-}
-#endif
-
-#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
-// Either this is the first time through (yyFlexLexerOnce not defined),
-// or this is a repeated include to define a different flavor of
-// yyFlexLexer, as discussed in the flex man page.
-#define yyFlexLexerOnce
-
-class yyFlexLexer : public FlexLexer {
-public:
- // arg_yyin and arg_yyout default to the cin and cout, but we
- // only make that assignment when initializing in yylex().
- yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 );
-
- virtual ~yyFlexLexer();
-
- void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
- struct yy_buffer_state* yy_create_buffer( istream* s, int size );
- void yy_delete_buffer( struct yy_buffer_state* b );
- void yyrestart( istream* s );
-
- virtual int yylex();
- virtual void switch_streams( istream* new_in, ostream* new_out );
-
-protected:
- virtual int LexerInput( char* buf, int max_size );
- virtual void LexerOutput( const char* buf, int size );
- virtual void LexerError( const char* msg );
-
- void yyunput( int c, char* buf_ptr );
- int yyinput();
-
- void yy_load_buffer_state();
- void yy_init_buffer( struct yy_buffer_state* b, istream* s );
- void yy_flush_buffer( struct yy_buffer_state* b );
-
- int yy_start_stack_ptr;
- int yy_start_stack_depth;
- int* yy_start_stack;
-
- void yy_push_state( int new_state );
- void yy_pop_state();
- int yy_top_state();
-
- yy_state_type yy_get_previous_state();
- yy_state_type yy_try_NUL_trans( yy_state_type current_state );
- int yy_get_next_buffer();
-
- istream* yyin; // input source for default LexerInput
- ostream* yyout; // output sink for default LexerOutput
-
- struct yy_buffer_state* yy_current_buffer;
-
- // yy_hold_char holds the character lost when yytext is formed.
- char yy_hold_char;
-
- // Number of characters read into yy_ch_buf.
- int yy_n_chars;
-
- // Points to current character in buffer.
- char* yy_c_buf_p;
-
- int yy_init; // whether we need to initialize
- int yy_start; // start state number
-
- // Flag which is used to allow yywrap()'s to do buffer switches
- // instead of setting up a fresh yyin. A bit of a hack ...
- int yy_did_buffer_switch_on_eof;
-
- // The following are not always needed, but may be depending
- // on use of certain flex features (like REJECT or yymore()).
-
- yy_state_type yy_last_accepting_state;
- char* yy_last_accepting_cpos;
-
- yy_state_type* yy_state_buf;
- yy_state_type* yy_state_ptr;
-
- char* yy_full_match;
- int* yy_full_state;
- int yy_full_lp;
-
- int yy_lp;
- int yy_looking_for_trail_begin;
-
- int yy_more_flag;
- int yy_more_len;
- int yy_more_offset;
- int yy_prev_more_offset;
-};
-
-#endif
diff --git a/Zend/LICENSE b/Zend/LICENSE
deleted file mode 100644
index ec736b0031..0000000000
--- a/Zend/LICENSE
+++ /dev/null
@@ -1,56 +0,0 @@
---------------------------------------------------------------------
- The Zend Engine License, Version 2.00
-Copyright (c) 1999-2003 Zend Technologies Ltd. All rights reserved.
---------------------------------------------------------------------
-
-Redistribution and use in source and binary forms, with or without
-modification, is permitted provided that the following conditions
-are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-
- 3. The names "Zend" and "Zend Engine" must not be used to endorse
- or promote products derived from this software without prior
- permission from Zend Technologies Ltd. For written permission,
- please contact license@zend.com.
-
- 4. Zend Technologies Ltd. may publish revised and/or new versions
- of the license from time to time. Each version will be given a
- distinguishing version number.
- Once covered code has been published under a particular version
- of the license, you may always continue to use it under the
- terms of that version. You may also choose to use such covered
- code under the terms of any subsequent version of the license
- published by Zend Technologies Ltd. No one other than Zend
- Technologies Ltd. has the right to modify the terms applicable
- to covered code created under this License.
-
- 5. Redistributions of any form whatsoever must retain the following
- acknowledgment:
- "This product includes the Zend Engine, freely available at
- http://www.zend.com"
-
- 6. All advertising materials mentioning features or use of this
- software must display the following acknowledgment:
- "The Zend Engine is freely available at http://www.zend.com"
-
-THIS SOFTWARE IS PROVIDED BY ZEND TECHNOLOGIES LTD. ``AS IS'' AND
-ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ZEND
-TECHNOLOGIES LTD. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
---------------------------------------------------------------------
diff --git a/Zend/Makefile.am b/Zend/Makefile.am
deleted file mode 100644
index 8f1948eefc..0000000000
--- a/Zend/Makefile.am
+++ /dev/null
@@ -1,51 +0,0 @@
-## Process this file with automake to produce Makefile.in -*- makefile -*-
-
-#CLEANFILES = zend_language_parser.c zend_language_parser.h zend_language_scanner.c zend_language_parser.output zend_ini_parser.c zend_ini_parser.h zend_ini_scanner.c zend_ini_parser.output
-
-AUTOMAKE_OPTIONS=foreign
-noinst_LTLIBRARIES=libZend.la
-
-libZend_la_SOURCES=\
- zend_language_parser.y zend_language_scanner.l \
- zend_ini_parser.y zend_ini_scanner.l \
- zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c \
- zend_execute.c zend_execute_API.c zend_highlight.c zend_llist.c \
- zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
- zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
- zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
- zend_ini.c zend_qsort.c zend_objects.c zend_object_handlers.c \
- zend_objects_API.c zend_ts_hash.c zend_stream.c zend_mm.c zend_default_classes.c
-
-libZend_la_LDFLAGS =
-libZend_la_LIBADD = @ZEND_EXTRA_LIBS@
-
-# automake isn't too clever about "non-standard" use of lex and yacc
-
-$(libZend_la_OBJECTS): zend_language_parser.h
-
-zend_ini_scanner.lo: zend_ini_parser.h
-
-# Language parser/scanner rules
-
-zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
- $(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
-
-zend_language_parser.h: zend_language_parser.c
-zend_language_parser.c: $(srcdir)/zend_language_parser.y
- $(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o zend_language_parser.c
-
-# INI parser/scanner rules
-
-zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
- $(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o zend_ini_parser.c
-
-zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
- $(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
-
-zend_ini_parser.h: zend_ini_parser.c
-
-depend:
-
-zend_execute.lo: $(srcdir)/zend_execute.c
- $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(INLINE_CFLAGS) -c $(srcdir)/zend_execute.c
-
diff --git a/Zend/OBJECTS2_HOWTO b/Zend/OBJECTS2_HOWTO
deleted file mode 100644
index aef370330d..0000000000
--- a/Zend/OBJECTS2_HOWTO
+++ /dev/null
@@ -1,195 +0,0 @@
-Creating an object
-------------------
-
-Object can be created in the following ways:
-
-1. As a result of a function call. E.g.:
-
-$foo = create_new_foo("parameter");
-$foo->run();
-
-The function should create a new zval, create new object and get the
-handle for it, set handle and handler table as needed. Note that the
-handle is the only ID of the object, so it should be enough to
-identify it.
-
-2. Overriding create_object handler for class. E.g.:
-
-$foo = new Java("some.Class.here", "parameter");
-$foo->run();
-
-The create_object handler function should create a new zval, create
-new object and get the handle for it, set handle and handler table as
-needed, and also provide constructor method that would handle
-constructor call. The get_constructor handler table entry should be
-used for that. Do not rely class entry's constructor, unless you refer
-to it from get_constructor handler.
-
-Object maintenance
-------------------
-
-The handlers add_ref and del_ref are called when a new zval referring
-to the object is created. This does not create a new object - both
-zvals still refer to the same object.
-
-clone_obj handler should create a new object, identical to an old one,
-but being a separate entity.
-
-delete_obj should destroy an object, all references to it become
-invalid.
-
-Object access - read
---------------------
-
-read_property is used to read object's property. This value is not
-meant to be changed. The handler returns zval * with the value.
-
-Object access - write
----------------------
-
-write_property is used to directly write object's property by
-name. This handler is used to assign property variables or to change them
-in operations like += or ++ (unless get_property_zval_ptr is also set).
-
-get_property_zval_ptr is used to obtain pointer to modifyable zval for
-operations like += or ++. This should be used only if your object model
-stores properties as real zval's that can be modified from outside.
-Otherwise this handler should be NULL and the engine will use
-read_property and write_property instead.
-
-get_property_ptr is used to obtain zval ** for future writing to
-it. If your object properties are stored as zval*, return real place
-where the property is stored. If the aren't, the best way is to create
-proxy object and handle it via get and set methods (see below).
-This method is meant to be used for send-by-reference and assign-by-reference
-use of object properties. If you don;t want to implement property
-referencing for your objects, you can set this handler to NULL.
-
-get and set handlers are used when engine needs to access the object
-as a value. E.g., in the following situation:
-
-$foo =& $obj->bar;
-$foo = 1;
-
-if $foo is an object (e.g., proxy object from get_property_ptr) it
-would be accessed using write handler.
-
-Object access - method call
----------------------------
-
-get_method handler is used to find method description by name. It
-should set right type, function name and parameter mask for the
-method. If the type is ZEND_OVERLOADED_FUNCTION, the method would be
-called via call_method handler, otherwise it would be called with
-standard Zend means.
-
-get_constructor performs the same function as get_method, but for the
-object constructor.
-
-call_method handler is used to perform method call. Parameters are
-passed like to any other Zend internal function.
-
-Object - comparison
--------------------
-
-Objects can be compared via compare_objects handler. This is used with
-== operation, === compares objects by handles, i.e., return true if
-and only if it's really the same object. Note that objects from
-different object types (i.e., having different handlers) can not be
-compared.
-
-Objects - reflection
---------------------
-
-get_class_name is used to retrieve class name of the object.
-get_class_entry returns class entry (zend_class_entry) for the object,
-in case there exists PHP class for it.
-No other reflection functions are currently implemented.
-
-Objects - data structures and handlers
----------------------------------------
-
-The object is represented by the following structure:
-
-struct _zend_object_value {
- zend_object_handle handle;
- zend_object_handlers *handlers;
-};
-
-handle is an ID of the object among the objects of the same type (not
-class!). The type of the object and how it behaves is determined by
-the handler table.
-
-typedef struct _zend_object_handlers {
- zend_object_add_ref_t add_ref;
- zend_object_del_ref_t del_ref;
- zend_object_delete_obj_t delete_obj;
- zend_object_clone_obj_t clone_obj;
- zend_object_read_property_t read_property;
- zend_object_write_property_t write_property;
- zend_object_get_property_ptr_t get_property_ptr;
- zend_object_get_property_zval_ptr_t get_property_zval_ptr;
- zend_object_get_t get;
- zend_object_set_t set;
- zend_object_has_property_t has_property;
- zend_object_unset_property_t unset_property;
- zend_object_get_properties_t get_properties;
- zend_object_get_method_t get_method;
- zend_object_call_method_t call_method;
- zend_object_get_constructor_t get_constructor;
- zend_object_get_class_entry_t get_class_entry;
- zend_object_get_class_name_t get_class_name;
- zend_object_compare_t compare_objects;
-} zend_object_handlers;
-
-See zend_object_handlers.h for prototypes. All objects are passed as zval's.
-
-Handlers explained:
-
-add_ref - called when a copy of the object handle is created.
-
-del_ref - called when a copy of the object handle is destroyed.
-
-delete_obj - called when an object needs to be destroyed.
-
-clone_obj - called when a new object identical to an old one should be
-created (unlike Zend Engine 1, this never happens unless explicitly
-asked for).
-
-read_property - returns zval *, containing the value of the
-property. Is used when value of the property should be retrieved for
-reading.
-
-write_property - assigns value to certain property of the object.
-
-get_property_zval_ptr - retrieves zval** for being directly modified by
-the engine. If your properties are not zval's, don't define it.
-
-get_property_ptr - retrieves zval** for the property of the value, to
-be used for read and write. If object properties are not zval's
-natively, this method should create and return proxy object for use
-with get and set methods.
-
-get - retrieves zval* for object contents. To be used mainly with
-proxy objects from get_property_ptr, but also may be used for
-convert_to_* functions.
-
-set - sets value for object contents. To be used mainly with
-proxy objects from get_property_ptr.
-
-has_property - checks if the object has certain property set.
-
-unset_property - removes value for the property of the object
-
-get_method - retrieves description of the method
-
-call_method - calls the method (parameters should be put on stack like
-for any other PHP internal function).
-
-get_constructor - get description for the object constructor method
-
-get_class_entry - should return the class entry for the object
-
-get_class_name - get the name of the class the object belongs to
-
-compare_objects - compares if two objects are equal
diff --git a/Zend/RFCs/001.txt b/Zend/RFCs/001.txt
deleted file mode 100644
index bf1d847b97..0000000000
--- a/Zend/RFCs/001.txt
+++ /dev/null
@@ -1,136 +0,0 @@
-Revamped object model using object handles
-===========================================
-
-Background
-----------
-
-In the Zend Engine 1.0 (and its predecessor the PHP 3 scripting
-engine) the object model's design is that instantiated objects are
-language values. This means that when programmers are performing
-operations, such variable assignment and passing parameters to
-functions, objects are handled very similarly to the way other
-primitive types are handled such as integers and strings.
-Semantically this means that the whole object is being copied. The
-approach Java takes is different where one refers to objects by handle
-and not by value (one can think of a handle as an objects' ID).
-
-Need
-----
-
-Unfortunately, the approach taken up to now has severely limited the
-Zend Engine's object oriented model, both feature and simplicity
-wise. One of the main problems with the former approach is that object
-instantiation and duplication is very hard to control, a problem which
-can not only lead to inefficient development but also often to strange
-run-time behavior. Changing the object model to a handle oriented
-model will allow the addressing of many needs such as destructors,
-de-referencing method return values, tight control of object
-duplication and more.
-
-Overview
---------
-
-The proposed object model is very much influenced by the Java
-model. In general, when you create a new object you will be getting a
-handle to the object instead of the object itself. When this handle is
-sent to functions, assigned and copied it is only the handle which is
-copied/sent/assigned. The object itself is never copied nor
-duplicated. This results in all handles of this object to always point
-at the same object making it a very consistent solution and saving
-unnecessary duplication and confusing behavior.
-
-Functionality
--------------
-
-After this change the basic use of objects will be almost identical to
-previous versions of the scripting engine. However, you won't bump
-into awkward and confusing copying & destructing of objects. In order
-to create and use a new object instance you will do the following:
-$object = new MyClass(); $object->method();
-
-The previous code will assign $object the handle of a new instance of
-the class MyClass and call one of its methods.
-
-
-Consider the following code:
-
-1 class MyClass
-2 {
-3 function setMember($value)
-4 {
-5 $this->member = $value;
-6 }
-7
-8 function getMember()
-9 {
-10 return $this->member;
-11 }
-12 }
-13
-14 function foo($obj)
-15 {
-16 $obj->setMember("foo");
-17 }
-18
-19 $object = new MyClass();
-20 $object->setMember("bar");
-21 foo($object);
-22 print $object->getMember();
-
-Without the new Java-like handles, at line 20 the objects' data member
-member is set to the string value of "bar". Because of the internal
-representation of objects in the Zend Engine 1.0, the object is marked
-as a reference, and when it is sent by value to the function foo, it
-is duplicated (!). Therefore, the call to foo() on line 21 will
-result in the $obj->setMember("foo") call being called on a duplicate
-of $object. Line 22 will then result in "bar" being printed.
-
-This is how the scripting engine has worked until today. Most
-developers are probably unaware of the fact that they aren't always
-talking to the same object but often duplicates; others may have
-realized this can usually be solved by always passing objects by
-reference (unless a replica is actually desired, which is uncommon).
-
-The new object model will allow for a much more intuitive
-implementation of the code. On line 21, the object's handle (ID) is
-passed to foo() by value. Inside foo(), the object is fetched
-according to this handle and, therefore, the setMember() method is
-called on the originally instantiated object and not a copy. Line 22
-will therefore result in "foo" being printed. This approach gives
-developers tighter control of when objects are created and duplicated.
-An additional not-as-important benefit is that the object handle will
-be passed to foo() by value, which most probably will also save
-unnecessary duplication of the value containing the ID itself and thus
-additionally improving run-time performance.
-
-This was just a simple description of why the new object model solves
-awkward behavior and makes object handling much easier, intuitive and
-efficient. The importance of this change goes far beyond what is
-mentioned in this section as you will see in further sections which
-describe new features with a majority of them being based on this
-change.
-
-Compatibility Notes
---------------------
-
-Many PHP programmers aren't even aware of the copying quirks of the
-current object model and, therefore, there is a relatively good chance
-that the amount of PHP applications that will work out of the box or
-after a very small amount of modifications would be high.
-
-To simplify migration, version 2.0 will support an optional
-'auto-clone' feature, which will perform a cloning of the object
-whenever it would have been copied in version 1.0. Optionally, it
-will also be possible to request that the engine will emit an E_NOTICE
-message whenever such an automatic clone occurs, in order to allow
-developers to gradually migrate to the version 2.0-style behavior
-(without automatic clones).
-
-Dependencies
-------------
-
-The new object model is not dependent on other features. Many of the
-other Zend Engine 2.0 features, such as the $foo->bar()->barbara()
-syntax, destructors and others completely rely on this new object
-model.
-
diff --git a/Zend/RFCs/002.txt b/Zend/RFCs/002.txt
deleted file mode 100644
index c7e00d6677..0000000000
--- a/Zend/RFCs/002.txt
+++ /dev/null
@@ -1,169 +0,0 @@
-Title: Zend 2.0 Namespaces
-Version: $Revision$
-Status: draft
-Maintainer: Stig S. Bakken <ssb@php.net>
-Created: 2001-09-08
-Modified: 2001-09-08
-
-
-1. Background/Need
-==================
-
-PHP and Zend 1.0 have come to a point where a lot of reusable code is
-being written; from simple functions and classes to entire application
-frameworks. It is becoming increasingly difficult to avoid symbol
-name collisions with the current scoping methods.
-
-The symbol scopes available in Zend 1.0 are the global scope, the
-class scope and the function scope. All scopes but classes may
-contain variables, only the class and global scopes may contain
-functions, while only the global scope may contain constants and
-classes. This means that all of Zend 1.0's scoping methods are
-inherently limited for solving symbol name collision problems.
-
-
-2. Overview
-===========
-
-Namespaces in Zend 2.0 provide a way to manage the symbol collision
-problem by making it possible to define multiple symbol tables able to
-contain all types of symbols. Zend will get the notion of a current
-namespace, defaulting to the current global one. The current name
-space may be changed on a file-by-file basis. Symbols in other name
-spaces than the current one may be referenced using a new namespace
-operator. It will be possible to "import" symbols from one namespace
-into another.
-
-
-3. Functionality
-================
-
-3.1. Namespace Syntax
-=====================
-
-The namespace operator ":" is used to refer to symbols in other
-namespaces than the current one:
-
-Class: Namespace:class
-Function: Namespace:function
-Static method: Namespace:class::method
-Variable: $Namespace:variable
-Constant: Namespace:CONSTANT
-Class variable: $Namespace:class::variable
-
-To refer to symbols in the global namespace, symbols are prefixed with
-only the namespace operator:
-
-Class: :class
-Function: :function
-Static method: :class::method
-Variable: $:variable
-Constant: :CONSTANT
-Class variable: $:class::variable
-
-Note: $:variable will effectively be just another syntax for
-$GLOBALS['variable'].
-
-A namespace may have a name containing a ":", it is always the last
-":" character in the symbol qualifier that is the actual namespace
-operator:
-
-Class: Name:Space:class
-Function: Name:Space:function
-Static method: Name:Space:class::method
-Variable: $Name:Space:variable
-Constant: Name:Space:CONSTANT
-Class variable: $Name:Space:class::variable
-
-(Here, the ":" between "Name" and "Space" is part of the name, it is
-the one after "Space" that is the namespace operator.)
-
-
-3.2. Defining Namespaces
-========================
-
-Individual files may define a namespace that will apply to the entire
-file. If no "namespace" operator occurs in the file, it will be in
-the global namespace:
-
- 1 namespace HTML;
- 2
- 3 class Form {
- 4 function Form() {
- 5 // constructor
- 6 }
- 7 // ...
- 8 }
-
-Or with the "nested" name syntax:
-
- 1 namespace HTML:Form;
- 2
- 3 class Image {
- 4 var $src;
- 5 function Image($src) {
- 6 $this->src = $src;
- 7 }
- 8 // ...
- 9 }
-
-Code executed within the "HTML" namespace may refer to the Form class
-as just "Form". Code executed from within other namespaces has to
-refer to it as "HTML:Form". The "namespace" statement must occur
-before any other statements in the file.
-
-# [ssb 2001-09-08]:
-# Should it be possible to "add" symbols to a namespace by including a
-# second file with the same namespace statement?
-
-
-3.3. Importing Symbols
-======================
-
-It is possible to import symbols from another namespace into the
-current one with the "import" statement:
-
- import * from HTML; // all symbols
-
- import Form from HTML; // single symbols
-
- import Form,Table from HTML; // multiple symbols
-
-There is a potential for name clashes between symols of different
-types that have the same qualifier syntax. These are resolved in this
-order: class, function, constant.
-
-Optionally, the symbol type may be explicitly given to import (as
-"class", "function", "variable" or "constant"):
-
- import class Form from HTML;
-
-And finally, you may import all symbols of a given type:
-
- import constant * from HTML:Table;
-
-The namespace with its symbols must already be defined before using
-"import".
-
-
-4. Compatibility Notes
-======================
-
-Old code that does not take advantage of namespaces will run without
-modifications.
-
-
-5. Dependencies
-===============
-
-The class variable syntax depends on this class variables being
-implemented in the new ZE2 object model.
-
-
-6. Acknowledgements
-===================
-
-Andi Gutmans <andi@zend.com> and Zeev Suraski <zeev@zend.com> for
-initial ZE2 namespaces proposal
-
-Dean Hall <php@apt7.com> for the initial symbol qualification syntax
diff --git a/Zend/RFCs/003.txt b/Zend/RFCs/003.txt
deleted file mode 100644
index aa90691b19..0000000000
--- a/Zend/RFCs/003.txt
+++ /dev/null
@@ -1,72 +0,0 @@
-Title: Loose type requirements for functions
-Version: $Revision$
-Status: draft
-Maintainer: Brian Moon <brianm@dealnews.com>
-Created: 2001-09-17
-Modified: 2001-09-17
-
-
-1. Background/Need
-==================
-
-Many internal function of PHP will reject parameters because of their
-type (the array and variable function come to mind). For userland
-this is not an easy task as there is no uniform way to do it. An
-addition to the engine for requiring loose types would allow
-delevopers to know that the data passed to their functions is of the
-correct type and reduce the need for duplicating the same code in
-every function to check for the type of data.
-
-
-2. Overview
-===========
-
-Loose typing mostly means evaluating the contents of the variable and
-not the type of the variable itself. The requirements for this would
-and should work much like several of the is_* functions do now.
-
-The typing of parameters would be optional and those not typed would
-simply continue to be treated as they are now.
-
-3. Functionality
-================
-
-3.1. Allowed Types
-==================
-
-Only loose types should be needed to ensure the data is usable by the
-function. Duplicating the functionallity of is_scalar, is_resource,
-is_array and is_object should give developers all the information they
-need to use a variable correctly.
-
-3.2. Syntax
-===========
-
-The current function syntax should be expanded to allow typing of
-variables inline in a C style.
-
-function foo ($var){
-}
-
-could be changed to require an array such as:
-
-function foo (array $var){
-}
-
-3.3. Errors
-===========
-
-Mis-matches in type should be reported as fatal errors and should halt
-the execution of a script as that function can not be run and code
-following could not reliably run.
-
-
-4. Compatibility Notes
-======================
-
-Old code that does not take advantage of this will run without
-modifications.
-
-
-
-
diff --git a/Zend/RFCs/004.txt b/Zend/RFCs/004.txt
deleted file mode 100644
index 1e120ce306..0000000000
--- a/Zend/RFCs/004.txt
+++ /dev/null
@@ -1,107 +0,0 @@
-Title: Delegation
- (a/k/a. Object-Based Inheritance)
-Version: $Revision$
-Status: draft
-Maintainer: Sebastian Bergmann <sb@sebastian-bergmann.de>
-
-
-Dynamic Delegation
-
- Syntax / Example
-
- <?php
- class aDelegatee {
- function doSomething() {
- echo 'hubu';
- }
- }
-
- class anotherDelegatee {
- function doSomething() {
- echo 'tubu';
- }
- }
-
- class Foo {
- delegatee $bar;
-
- function setDelegatee($delegatee) {
- $this->delegatee = $delegatee;
- }
- }
-
- $foo = new Foo;
-
- $foo->setDelegatee(new aDelegatee);
- $foo->doSomething(); /* prints "hubu" */
-
- $foo->setDelegatee(new anotherDelegatee);
- $foo->doSomething(); /* prints "tubu" */
- ?>
-
- Semantics / Synopsis
-
- The "Foo" class may use all methods available in "$bar" as if they
- where locally defined or inherited from a superclass. The essential
- difference is that by assigning another object to "$bar" it is
- possible to dynamically switch between different implementations for
- these methods.
-
-
-Fixed Delegation
-
- Syntax / Example
-
- <?php
- class aDelegatee {
- function doSomething() {
- echo 'hubu';
- }
- }
-
- class Foo {
- final delegatee $bar = new aDelegatee;
- }
-
- $foo = new Foo;
-
- $foo->doSomething(); /* prints "hubu" */
- ?>
-
- Semantics / Synopsis
-
- The "Foo" class may use all methods available in "$bar" as if they
- where locally defined or inherited from a superclass. The difference
- to the dynamic delegation is that once the delegatee object is set,
- it cannot be changed.
-
-
-Default Delegation
-
- Syntax / Example
-
- <?php
- class Foo {
- function __delegate($name, $parameters = array()) {
- echo $name;
- }
- }
-
- $foo = new Foo;
- $foo->bar(); /* prints "bar" */
- ?>
-
- Semantics / Synopsis
-
- If a class has a __delegate() method, it is called whenever a
- method on an object of this class is called that is
-
- * Not defined in the class.
-
- * Not provided by a delegatee object.
-
- The __delegate() method is called with the name and parameters
- of the method call.
-
- This supersedes / obsoletes similar functionality introduced in
- Zend Engine 1 by ext/overload.
diff --git a/Zend/ZEND_CHANGES b/Zend/ZEND_CHANGES
deleted file mode 100644
index 18ed6c6421..0000000000
--- a/Zend/ZEND_CHANGES
+++ /dev/null
@@ -1,802 +0,0 @@
-Changes in the Zend Engine 2.0
-
- * New Object Model.
-
- The Zend Engine's handling of objects has been completely
- changed in order to allow for new features, but also to increase
- its performance.
-
- Objects were handled in previous versions like primitive types
- (for instance integers and strings). The drawback of this method
- is, that semantically the whole object was copied when a
- variable was assigned or parameters were passed to a method. The
- new approach refers to objects by handle and not by value (one
- can think of a handle as an object's ID).
-
- Many PHP programmers aren't even aware of the copying quirks of
- the old object model and, therefore, there is a relatively good
- chance that the amount of PHP applications that will work out of
- the box or after a very small amount of modifications would be
- high.
-
- * Private and Protected Members.
-
- The Zend Engine 2.0 introduces private and protected member
- variables. Note that for performance reasons no error message is
- emitted in case of an illegal access to a private or protectecd
- member variable.
-
- Example:
-
- <?php
- class MyClass {
- private $Hello = "Hello, World!\n";
- protected $Bar = "Hello, Foo!\n";
- protected $Foo = "Hello, Bar!\n";
-
- function printHello() {
- print "MyClass::printHello() " . $this->Hello;
- print "MyClass::printHello() " . $this->Bar;
- print "MyClass::printHello() " . $this->Foo;
- }
- }
-
- class MyClass2 extends MyClass {
- protected $Foo;
-
- function printHello() {
- MyClass::printHello(); /* Should print */
- print "MyClass2::printHello() " . $this->Hello; /* Shouldn't print out anything */
- print "MyClass2::printHello() " . $this->Bar; /* Shouldn't print (not declared)*/
- print "MyClass2::printHello() " . $this->Foo; /* Should print */
- }
- }
-
- $obj = new MyClass();
- print $obj->Hello; /* Shouldn't print out anything */
- print $obj->Bar; /* Shouldn't print out anything */
- print $obj->Foo; /* Shouldn't print out anything */
- $obj->printHello(); /* Should print */
-
- $obj = new MyClass2();
- print $obj->Hello; /* Shouldn't print out anything */
- print $obj->Bar; /* Shouldn't print out anything */
- print $obj->Foo; /* Shouldn't print out anything */
- $obj->printHello();
- ?>
-
- Protected member variables can be accessed in classes extending the
- class they are declared in, whereas private member variables can
- only be accessed by the class they belong to.
-
- * Private and protected methods.
-
- The Zend Engine 2.0 introduces private and protected methods.
-
- Example:
-
- <?php
- class Foo {
- private function aPrivateMethod() {
- echo "Foo::aPrivateMethod() called.\n";
- }
-
- protected function aProtectedMethod() {
- echo "Foo::aProtectedMethod() called.\n";
- $this->aPrivateMethod();
- }
- }
-
- class Bar extends Foo {
- public function aPublicMethod() {
- echo "Bar::aPublicMethod() called.\n";
- $this->aProtectedMethod();
- }
- }
-
- $o = new Bar;
- $o->aPublicMethod();
- ?>
-
- Old code that has no user-defined classes or functions named
- 'public', 'protected' or 'private' should run without modifications.
-
- * Abstract Classes and Methods.
-
- The Zend Engine 2.0 introduces abstract classes and methods. An
- abstract method only declares the method's signature and does not
- provide an implementation. A class that contains abstract methods
- needs to be declared abstract.
-
- Example:
-
- <?php
- abstract class AbstractClass {
- abstract public function test();
- }
-
- class ImplementedClass extends AbstractClass {
- public function test() {
- echo "ImplementedClass::test() called.\n";
- }
- }
-
- $o = new ImplementedClass;
- $o->test();
- ?>
-
- Abstract classes cannot be instantiated.
-
- Old code that has no user-defined classes or functions named
- 'abstract' should run without modifications.
-
- * Interfaces.
-
- The Zend Engine 2.0 introduces interfaces. A class may implement
- an arbitrary list of interfaces.
-
- Example:
-
- <?php
- interface Throwable {
- public function getMessage();
- }
-
- class Exception implements Throwable {
- public function getMessage() {
- // ...
- }
- }
- ?>
-
- Old code that has no user-defined classes or functions named
- 'interface' or 'implements' should run without modifications.
-
- * Class Type Hints.
-
- While remaining loosely typed the Zend Engine 2.0 introduces the
- ability to use class type hints to declare the expected class of
- objects that are passed as parameters to a method.
-
- Example:
-
- <?php
- interface Foo {
- function a(Foo $foo);
- }
-
- interface Bar {
- function b(Bar $bar);
- }
-
- class FooBar implements Foo, Bar {
- function a(Foo $foo) {
- // ...
- }
-
- function b(Bar $bar) {
- // ...
- }
- }
-
- $a = new FooBar;
- $b = new FooBar;
-
- $a->a($b);
- $a->b($b);
- ?>
-
- These class type hints are not checked upon compilation, as would
- be the case in a typed language, but during runtime.
-
- This means that
-
- function foo(ClassName $object) {
- // ...
- }
-
- is equivalent to
-
- function foo($object) {
- if (!($object instanceof ClassName)) {
- die('Argument 1 must be an instance of ClassName');
- }
- }
-
- This syntax only applies to objects/classes, not built-in types.
-
- * final.
-
- The Zend Engine 2.0 introduces the "final" keyword to declare
- final members and methods. Those cannot be overridden by
- sub-classes.
-
- Example:
-
- <?php
- class Foo {
- final function bar() {
- // ...
- }
- }
- ?>
-
- Old code that has no user-defined classes or functions named
- 'final' should run without modifications.
-
- * Object Cloning.
-
- The Zend Engine 1.0 offered no way a user could decide what copy
- constructor to run when an object is duplicated. During
- duplication, the Zend Engine 1.0 did a bitwise copy making an
- identical replica of all the object's properties.
-
- Creating a copy of an object with fully replicated properties is
- not always the wanted behavior. A good example of the need for
- copy constructors, is if you have an object which represents a
- GTK window and the object holds the resource of this GTK window,
- when you create a duplicate you might want to create a new
- window with the same properties and have the new object hold the
- resource of the new window. Another example is if your object
- holds a reference to another object which it uses and when you
- replicate the parent object you want to create a new instance of
- this other object so that the replica has its own separate copy.
-
- An object copy is created by calling the object's __clone()
- method.
-
- Example:
-
- <?php
- $copy_of_object = $object->__clone();
- ?>
-
- When the developer asks to create a new copy of an object, the
- Zend Engine will check if a __clone() method has been defined or
- not. If not, it will call a default __clone() which will copy
- all of the object's properties. If a __clone() method is
- defined, then it will be responsible to set the necessary
- properties in the created object. For convenience, the engine
- will supply a function that imports all of the properties from
- the source object, so that they can start with a by-value
- replica of the source object, and only override properties that
- need to be changed. [The function hasn't been implemented yet]
-
- Example:
-
- <?php
- class MyCloneable {
- static $id = 0;
-
- function MyCloneable() {
- $this->id = self::$id++;
- }
-
- function __clone() {
- $this->name = $that->name;
- $this->address = 'New York';
- $this->id = self::$id++;
- }
- }
-
- $obj = new MyCloneable();
-
- $obj->name = 'Hello';
- $obj->address = 'Tel-Aviv';
-
- print $obj->id . "\n";
-
- $obj = $obj->__clone();
-
- print $obj->id . "\n";
- print $obj->name . "\n";
- print $obj->address . "\n";
- ?>
-
- * Namespaces.
-
- The Zend Engine 1.0 provided only three scopes: the global
- scope, the class scope and the function scope. All scopes but
- classes could contain variables, only the class and global
- scopes could contain functions, while only the global scope
- could contain constants and classes. This means that all of the
- Zend Engine 1.0's scoping methods were inherently limited for
- solving symbol name collision problems.
-
- The Zend Engine 2.0 introduces the concept of namespaces
- to solve the symbol collision problem by making it possible to
- define multiple symbol tables able to contain all types of
- symbols.
-
- A namespace may contain classes, constants, functions and variables.
- The member of a namespace is accessed by prefixing its name with the
- name of the namespace followed by '::'.
-
- Example:
-
- <?php
- namespace Foo {
- class Bar {}
- const aConstant = 'someValue';
- function aFunction() {}
- var $aVariable;
- }
-
- $o = new Foo::Bar;
- echo Foo::aConstant;
- Foo::aFunction();
- Foo::$aVariable = 'someValue';
- ?>
-
- A namespace's name may contain colons to denote "sub-namespaces".
- This is pure syntactic sugar, the Zend Engine will not see, for
- instance, the namespaces "Package", "Package:Subpackage" and
- "Package:Subpackage:Subsubpackage" as related.
-
- Namespaces can be neither nested nor instantiated.
-
- To avoid ambiguities in the '::' resolution there may be no
- global class and namespace with the same name.
-
- Old code that has no user-defined classes or functions named
- 'namespace' should run without modifications.
-
- * Unified Constructors.
-
- The Zend Engine allows developers to declare constructor methods
- for classes. Classes which have a constructor method call this
- method on each newly-created object, so it is suitable for any
- initialization that the object may need before it can be used.
-
- With the Zend Engine 1.0, constructor methods were class methods
- that had the same name as the class itself. Since it is very
- common to call parent constructors from derived classes, the way
- the Zend Engine 1.0 worked made it a bit cumbersome to move
- classes around in a large class hierarchy. If a class is moved
- to reside under a different parent, the constructor name of that
- parent changes as well, and the code in the derived class that
- calls the parent constructor has to be modified.
-
- The Zend Engine 2.0 introduces a standard way of declaring
- constructor methods by calling them by the name __construct().
-
- Example:
-
- <?php
- class BaseClass {
- function __construct() {
- print "In BaseClass constructor\n";
- }
- }
-
- class SubClass extends BaseClass {
- function __construct() {
- parent::__construct();
- print "In SubClass constructor\n";
- }
- }
-
- $obj = new BaseClass();
- $obj = new SubClass();
- ?>
-
- For backwards compatibility, if the Zend Engine 2.0 cannot find
- a __construct() function for a given class, it will search for
- the old-style constructor function, by the name of the class.
- Effectively, it means that the only case that would have
- compatibility issues is if the class had a method named
- __construct() which was used for different semantics.
-
- * Destructors.
-
- Having the ability to define destructors for objects can be very
- useful. Destructors can log messages for debugging, close
- database connections and do other clean-up work.
-
- No mechanism for object destructors existed in the Zend Engine
- 1.0, although PHP had already support for registering functions
- which should be run on request shutdown.
-
- The Zend Engine 2.0 introduces a destructor concept similar to
- that of other object-oriented languages, such as Java: When the
- last reference to an object is destroyed the object's
- destructor, which is a class method name __destruct() that
- recieves no parameters, is called before the object is freed
- from memory.
-
- Example:
-
- <?php
- class MyDestructableClass {
- function __construct() {
- print "In constructor\n";
- $this->name = 'MyDestructableClass';
- }
-
- function __destruct() {
- print 'Destroying ' . $this->name . "\n";
- }
- }
-
- $obj = new MyDestructableClass();
- ?>
-
- Like constructors, parent destructors will not be called
- implicitly by the engine. In order to run a parent destructor,
- one would have to explicitly call parent::__destruct() in the
- destructor body.
-
- * Constants.
-
- The Zend Engine 2.0 introduces per-class and per-namespace
- constants.
-
- Example:
-
- <?php
- class Foo {
- const constant = 'constant';
- }
-
- echo 'Foo::constant = ' . Foo::constant . "\n";
- ?>
-
- The Zend Engine 2.0 allows for expressions within constants:
-
- <?php
- class Bar {
- const a = 1<<0;
- const b = 1<<1;
- const c = a | b;
- }
- ?>
-
- Old code that has no user-defined classes or functions
- named 'const' will run without modifications.
-
- * Exceptions.
-
- The Zend Engine 1.0 had no exception handling. The Zend Engine 2.0
- introduces a exception model similar to that of other programming
- languages.
-
- Example:
-
- <?php
- class MyException {
- function __construct($exception) {
- $this->exception = $exception;
- }
-
- function Display() {
- print "MyException: $this->exception\n";
- }
- }
-
- class MyExceptionFoo extends MyException {
- function __construct($exception) {
- $this->exception = $exception;
- }
-
- function Display() {
- print "MyException: $this->exception\n";
- }
- }
-
- try {
- throw new MyExceptionFoo('Hello');
- }
-
- catch (MyException $exception) {
- $exception->Display();
- }
- ?>
-
- Old code that has no user-defined classes or functions 'catch',
- 'throw' and 'try' will run without modifications.
-
- * Dereferencing objects returned from functions.
-
- Example:
-
- <?php
- class Circle {
- function draw() {
- print "Circle\n";
- }
- }
-
- class Square {
- function draw() {
- print "Square\n";
- }
- }
-
- function ShapeFactoryMethod($shape) {
- switch ($shape) {
- case 'Circle': return new Circle();
- case 'Square': return new Square();
- }
- }
-
- ShapeFactoryMethod('Circle')->draw();
- ShapeFactoryMethod('Square')->draw();
- ?>
-
- * Static member variables of static classes can now be
- initialized.
-
- Example:
-
- <?php
- class foo {
- static $my_static = 5;
- }
-
- print foo::$my_static;
- ?>
-
- * Static Methods.
-
- The Zend Engine 2.0 introduces the 'static' keyword to declare
- a method static, thus callable from outside the object context.
-
- Example:
-
- <?php
- class Foo {
- public static function aStaticMethod() {
- // ...
- }
- }
-
- Foo::aStaticMethod();
- ?>
-
- The pseudo variable $this is not available inside a method that
- has been declared static.
-
- * instanceof (TBD)
-
- * Static function variables.
-
- Statics are now treated at compile-time which allows developers
- to assign variables to statics by reference. This change also
- greatly improves their performance but means that indirect
- references to statics will not work anymore.
-
- * Parameters that are passed by reference to a function
- may now have default values.
-
- Example:
-
- <?php
- function my_function(&$var = null) {
- if ($var === null) {
- die('$var needs to have a value');
- }
- }
- ?>
-
- * __autoload().
-
- The __autoload() interceptor function will be automatically called
- when an undeclared class is to be instantiated. The name of that
- class will be passed to the __autoload() interceptor function as its
- only argument.
-
- Example:
-
- <?php
- function __autoload($className) {
- include_once $className . '.php';
- }
-
- $object = new ClassName;
- ?>
-
- * Method calls and property accesses can be overloaded
- by class methods __call(), __get() and __set().
-
- __get() and __set() Example:
-
- <?php
- class Setter {
- public $n;
- public $x = array('a' => 1, 'b' => 2, 'c' => 3);
-
- function __get($nm) {
- print "Getting [$nm]\n";
-
- if(isset($this->x[$nm])) {
- $r = $this->x[$nm];
- print "Returning: $r\n";
- return $r;
- } else {
- print "Nothing!\n";
- }
- }
-
- function __set($nm, $val) {
- print "Setting [$nm] to $val\n";
-
- if(isset($this->x[$nm])) {
- $this->x[$nm] = $val;
- print "OK!\n";
- } else {
- print "Not OK!\n";
- }
- }
- }
-
- $foo = new Setter();
- $foo->n = 1;
- $foo->a = 100;
- $foo->a++;
- $foo->z++;
- var_dump($foo);
- ?>
-
- __call() Example:
-
- <?php
- class Caller {
- var $x = array(1, 2, 3);
-
- function __call($m, $a) {
- print "Method $m called:\n";
- var_dump($a);
- return $this->x;
- }
- }
-
- $foo = new Caller();
- $a = $foo->test(1, '2', 3.4, true);
- var_dump($a);
- ?>
-
-
-Changes in the Zend Engine 1.0
-
- The Zend Engine was designed from the ground up for increased speed,
- reduced memory consumption and more reliable execution. We dare say
- it meets all of these goals and does so pretty well. Beyond that,
- there are several improvements in the language engine features:
-
- * References support.
-
- $foo = &$a; would make $foo and $a be two names to the same
- variable. This works with arrays as well, on either side; e.g.,
- $foo = &$a[7]; would make $foo and $a[7] be two names to the
- same variable. Changing one would change the other and vice
- versa.
-
- * Object overloading support.
-
- This feature allows various OO libraries to use the OO notation
- of PHP to access their functionality. Right now, no use is made
- of that feature, but we'd have a COM module ready by the time
- PHP 4.0 is released. A CORBA module would probably follow.
-
- * include() and eval() are now functions, and not statements.
-
- That means they return a value. The default return value from
- include() and eval() is 1, so that you can do if (include())
- without further coding. The return value may be changed by
- returning a value from the global scope of the included file or
- the evaluated string. For example, if 'return 7;' is executed in
- the global scope of foo.inc, include('foo.inc') would evaluate
- to 7.
-
- * Automatic resource deallocation.
-
- Several people have been bitten by the fact that PHP 3.0 had no
- concept of reference counting. The Zend Engine adds full
- reference counting for every value in the system, including
- resources. As soon as a resource is no longer referenced from
- any variable, it is automatically destroyed to save memory and
- resources. The most obvious example for the advantage in this is
- a loop that has an SQL query inside it, something like '$result
- = sql_query(...);'. In PHP 3.0, every iteration resulted in
- another SQL result-set allocated in the memory, and all of the
- result sets weren't destroyed until the end of the script's
- execution. With the Zend Engine, as soon as we overwrite an old
- result set with a new one, the old result set which is no longer
- referenced, is destroyed.
-
- * Full support for nesting arrays and objects within each other,
- in as many levels as you want.
-
- * true and false are now constants of type boolean.
-
- Comparing any other value to them would convert that value to a
- boolean first, and conduct the comparison later. That means, for
- example, that 5==true would evaluate to true (in PHP 3.0, true
- was nothing but a constant for the integer value of 1, so
- 5==true was identical to 5==1, which was false).
-
- * Runtime binding of function names.
-
- This complex name has a simple explanation - you can now call
- functions before they're declared!
-
- * Added here-docs support.
-
- * Added foreach.
-
- Two syntaxes supported:
-
- foreach(array_expr as $val) statement
- foreach(array_expr as $key => $val) statement
-
- * A true unset() implementation.
-
- A variable or element that is unset(), is now sent to oblivion
- in its entirely, no trace remains from it.
-
- * Output buffering support.
-
- Use ob_start() to begin output buffering, ob_end_flush() to end
- buffering and send out the buffered contents, ob_end_clean() to
- end buffering without sending the buffered contents, and
- ob_get_contents() to retreive the current contents of the output
- buffer. Header information (header(), content type, cookies) are
- not buffered. By turning on output buffering, you can
- effectively send header information all throughout your file,
- regardless of whether you've emitted body output or not.
-
- * Full variable reference within quoted strings:
-
- ${expr} - full indirect reference support for scalar
- variables
- {variable} - full variable support
-
- For example:
-
- $foo[5]['bar'] = 'foobar';
- print "{$foo[5]["bar"]}"; // would print "foobar"
-
- * Ability to call member functions of other classes from within
- member functions or from the global scope.
-
- You can now, for example, override a parent function with a
- child function, and call the parent function from it.
-
- * Runtime information for classes (class name, parent, available
- functions, etc.).
-
- * Much more efficient syntax highlighter - runs much quicker,
- performs more reliably, and generates much tighter HTML.
-
- * A full-featured debugger has been integrated with the language
- (supports breakpoints, expression evaluation, step-in/over,
- function call backtrace, and more).
-
- The Zend Engine claims 100% compatability with the engine of PHP
- 3.0, and is shamelessly lying about it. Here's why:
-
- * Static variable initializers only accept scalar values
- (in PHP 3.0 they accepted any valid expression). The impact
- should be somewhere in between void and non existent, since
- initializing a static variable with anything but a simple
- static value makes no sense at all.
-
- * The scope of break and continue is local to that of an
- include()'d file or an eval()'d string. The impact should
- be somewhat smaller of the one above.
-
- * The return statement no longer works from a require()'d file. It
- hardly worked in PHP 3.0, so the impact should be fairly small. If
- you want this functionality - use include() instead.
-
- * unset() is no longer a function, but a statement.
-
- * The following letter combination is not supported within
- encapsulated strings: "{$". If you have a string that includes
- this letter combination, for example, print "{$somevar"; (which
- printed the letter { and the contents of the variable $somevar in
- PHP 3.0), it will result in a parse error with the Zend Engine.
- In this case, you would have to change the code to print
- "\{$somevar"; This incompatability is due to the full variable
- reference within quoted strings feature added in the Zend
- Engine.
diff --git a/Zend/Zend.dsp b/Zend/Zend.dsp
deleted file mode 100644
index 542fdf724d..0000000000
--- a/Zend/Zend.dsp
+++ /dev/null
@@ -1,586 +0,0 @@
-# Microsoft Developer Studio Project File - Name="Zend" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=Zend - Win32 Release_inline
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Zend.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Zend.mak" CFG="Zend - Win32 Release_inline"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Zend - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "Zend - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE "Zend - Win32 Release_inline" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "Zend - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDebug" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D ZEND_DEBUG=0 /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug"
-# ADD RSC /l 0x40d /d "NDebug"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug" /D "_LIB" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=1 /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE RSC /l 0x40d /d "_Debug"
-# ADD RSC /l 0x40d /d "_Debug"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Zend___Win32_Release_inline"
-# PROP BASE Intermediate_Dir "Zend___Win32_Release_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release_inline"
-# PROP Intermediate_Dir "Release_inline"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D ZEND_DEBUG=0 /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug"
-# ADD RSC /l 0x40d /d "NDebug"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "Zend - Win32 Release"
-# Name "Zend - Win32 Debug"
-# Name "Zend - Win32 Release_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\zend.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_builtin_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_compile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_constants.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_default_classes.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_dynamic_array.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_extensions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_hash.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_highlight.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_indent.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.c
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.c"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_list.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_llist.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_mm.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_object_handlers.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_opcode.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_operators.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ptr_stack.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_qsort.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_sprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stack.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stream.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ts_hash.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_variables.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\FlexLexer.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_builtin_functions.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_compile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_constants.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_default_classes.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_dynamic_array.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_errors.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute_locks.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_extensions.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_fast_cache.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_globals_macros.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_hash.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_highlight.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_indent.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_istdiostream.h
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.h"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_list.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_llist.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_mm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_modules.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_object_handlers.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects_API.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_operators.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ptr_stack.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_qsort.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stack.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stream.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ts_hash.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_variables.h
-# End Source File
-# End Group
-# Begin Group "Parsers"
-
-# PROP Default_Filter "y"
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.y
-
-!IF "$(CFG)" == "Zend - Win32 Release"
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\zend_ini_parser.y
-
-BuildCmds= \
- bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-
-"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.y"
-
-!IF "$(CFG)" == "Zend - Win32 Release"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Scanners"
-
-# PROP Default_Filter "l"
-# Begin Source File
-
-SOURCE=.\flex.skl
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.l
-
-!IF "$(CFG)" == "Zend - Win32 Release"
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
-
-# Begin Custom Build
-InputPath=.\zend_ini_scanner.l
-
-"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.l"
-
-!IF "$(CFG)" == "Zend - Win32 Release"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Text Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\ZEND_BUGS
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_CHANGES
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_TODO
-# End Source File
-# End Group
-# Begin Group "Resources"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\zend.ico
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/Zend/Zend.m4 b/Zend/Zend.m4
deleted file mode 100644
index dc083338ee..0000000000
--- a/Zend/Zend.m4
+++ /dev/null
@@ -1,236 +0,0 @@
-dnl
-dnl $Id$
-dnl
-dnl This file contains Zend specific autoconf functions.
-dnl
-
-AC_DEFUN(LIBZEND_BISON_CHECK,[
-
-if test "$YACC" != "bison -y"; then
- AC_MSG_WARN(You will need bison if you want to regenerate the Zend parser.)
-else
- AC_MSG_CHECKING(bison version)
- set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /'`
- if test "${1}" = "1" -a "${2}" -lt "28"; then
- AC_MSG_WARN(You will need bison 1.28 if you want to regenerate the Zend parser (found ${1}.${2}).)
- fi
- AC_MSG_RESULT(${1}.${2} (ok))
-fi
-
-])
-
-AC_DEFUN(LIBZEND_BASIC_CHECKS,[
-
-AC_REQUIRE([AC_PROG_YACC])
-AC_REQUIRE([AC_PROG_CC])
-AC_REQUIRE([AC_PROG_CC_C_O])
-AC_REQUIRE([AC_PROG_LEX])
-AC_REQUIRE([AC_HEADER_STDC])
-
-LIBZEND_BISON_CHECK
-
-dnl Ugly hack to get around a problem with gcc on AIX.
-if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \
- "`uname -sv`" = "AIX 4"; then
- CFLAGS=`echo $CFLAGS | sed -e 's/-g//'`
-fi
-
-dnl Hack to work around a Mac OS X cpp problem
-dnl Known versions needing this workaround are 5.3 and 5.4
-if test "$ac_cv_prog_gcc" = "yes" -a "`uname -s`" = "Rhapsody"; then
- CPPFLAGS="$CPPFLAGS -traditional-cpp"
-fi
-
-AC_CHECK_HEADERS(
-limits.h \
-malloc.h \
-string.h \
-unistd.h \
-stdarg.h \
-sys/types.h \
-sys/time.h \
-signal.h \
-unix.h \
-stdlib.h \
-dlfcn.h)
-
-AC_TYPE_SIZE_T
-AC_TYPE_SIGNAL
-
-AC_DEFUN(LIBZEND_LIBDL_CHECKS,[
-AC_CHECK_LIB(dl, dlopen, [LIBS="-ldl $LIBS"])
-AC_CHECK_FUNC(dlopen,[AC_DEFINE(HAVE_LIBDL, 1,[ ])])
-])
-
-AC_DEFUN(LIBZEND_DLSYM_CHECK,[
-dnl
-dnl Ugly hack to check if dlsym() requires a leading underscore in symbol name.
-dnl
-AC_MSG_CHECKING([whether dlsym() requires a leading underscore in symbol names])
-_LT_AC_TRY_DLOPEN_SELF([
- AC_MSG_RESULT(no)
-], [
- AC_MSG_RESULT(yes)
- AC_DEFINE(DLSYM_NEEDS_UNDERSCORE, 1, [Define if dlsym() requires a leading underscore in symbol names. ])
-], [
- AC_MSG_RESULT(no)
-], [])
-])
-
-dnl This is required for QNX and may be some BSD derived systems
-AC_CHECK_TYPE( uint, unsigned int )
-AC_CHECK_TYPE( ulong, unsigned long )
-
-dnl Checks for library functions.
-AC_FUNC_VPRINTF
-AC_FUNC_MEMCMP
-AC_FUNC_ALLOCA
-AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol finite fpclass)
-AC_ZEND_BROKEN_SPRINTF
-
-AC_CHECK_FUNCS(finite isfinite isinf isnan)
-
-ZEND_FP_EXCEPT
-
-])
-
-AC_DEFUN(LIBZEND_ENABLE_DEBUG,[
-
-AC_ARG_ENABLE(debug,
-[ --enable-debug Compile with debugging symbols],[
- ZEND_DEBUG=$enableval
-],[
- ZEND_DEBUG=no
-])
-
-])
-
-AC_DEFUN(LIBZEND_OTHER_CHECKS,[
-
-AC_ARG_ENABLE(maintainer-zts,
-[ --enable-maintainer-zts Enable thread safety - for code maintainers only],[
- ZEND_MAINTAINER_ZTS=$enableval
-],[
- ZEND_MAINTAINER_ZTS=no
-])
-
-AC_ARG_ENABLE(inline-optimization,
-[ --disable-inline-optimization If building zend_execute.lo fails, try
- this switch.],[
- ZEND_INLINE_OPTIMIZATION=$enableval
-],[
- ZEND_INLINE_OPTIMIZATION=yes
-])
-
-AC_ARG_ENABLE(memory-limit,
-[ --enable-memory-limit Compile with memory limit support. ], [
- ZEND_MEMORY_LIMIT=$enableval
-],[
- ZEND_MEMORY_LIMIT=no
-])
-
-AC_MSG_CHECKING(whether to enable thread-safety)
-AC_MSG_RESULT($ZEND_MAINTAINER_ZTS)
-
-AC_MSG_CHECKING(whether to enable inline optimization for GCC)
-AC_MSG_RESULT($ZEND_INLINE_OPTIMIZATION)
-
-AC_MSG_CHECKING(whether to enable a memory limit)
-AC_MSG_RESULT($ZEND_MEMORY_LIMIT)
-
-AC_MSG_CHECKING(whether to enable Zend debugging)
-AC_MSG_RESULT($ZEND_DEBUG)
-
-if test "$ZEND_DEBUG" = "yes"; then
- AC_DEFINE(ZEND_DEBUG,1,[ ])
- echo " $CFLAGS" | grep ' -g' >/dev/null || DEBUG_CFLAGS="-g"
- if test "$CFLAGS" = "-g -O2"; then
- CFLAGS=-g
- fi
- test -n "$GCC" && DEBUG_CFLAGS="$DEBUG_CFLAGS -Wall"
- test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \
- DEBUG_CFLAGS="$DEBUG_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
-else
- AC_DEFINE(ZEND_DEBUG,0,[ ])
-fi
-
-test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
-
-if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
- AC_DEFINE(ZTS,1,[ ])
- CFLAGS="$CFLAGS -DZTS"
- LIBZEND_CPLUSPLUS_CHECKS
-fi
-
-if test "$ZEND_MEMORY_LIMIT" = "yes"; then
- AC_DEFINE(MEMORY_LIMIT, 1, [Memory limit])
-else
- AC_DEFINE(MEMORY_LIMIT, 0, [Memory limit])
-fi
-
-
-changequote({,})
-if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
- INLINE_CFLAGS=`echo $ac_n "$CFLAGS $ac_c" | sed s/-O[0-9s]*//`
-else
- INLINE_CFLAGS="$CFLAGS"
-fi
-changequote([,])
-
-AC_C_INLINE
-
-AC_SUBST(INLINE_CFLAGS)
-
-
-dnl test and set the alignment define for ZEND_MM
-dnl this also does the logarithmic test for ZEND_MM.
-AC_MSG_CHECKING(for MM alignment and log values)
-
-AC_TRY_RUN([
-#include <stdio.h>
-
-typedef union _mm_align_test {
- void *ptr;
- double dbl;
- long lng;
-} mm_align_test;
-
-#if (defined (__GNUC__) && __GNUC__ >= 2)
-#define ZEND_MM_ALIGNMENT (__alignof__ (mm_align_test))
-#else
-#define ZEND_MM_ALIGNMENT (sizeof(mm_align_test))
-#endif
-
-int main()
-{
- int i = ZEND_MM_ALIGNMENT;
- int zeros = 0;
- FILE *fp;
-
- while (i & ~0x1) {
- zeros++;
- i = i >> 1;
- }
-
- fp = fopen("conftest.zend", "w");
- fprintf(fp, "%d %d\n", ZEND_MM_ALIGNMENT, zeros);
- fclose(fp);
-
- exit(0);
-}
-], [
- LIBZEND_MM_ALIGN=`cat conftest.zend | cut -d ' ' -f 1`
- LIBZEND_MM_ALIGN_LOG2=`cat conftest.zend | cut -d ' ' -f 2`
- AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT, $LIBZEND_MM_ALIGN, [ ])
- AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT_LOG2, $LIBZEND_MM_ALIGN_LOG2, [ ])
-])
-
-AC_MSG_RESULT(done)
-
-])
-
-
-AC_DEFUN(LIBZEND_CPLUSPLUS_CHECKS,[
-
-])
-
diff --git a/Zend/ZendCore.dep b/Zend/ZendCore.dep
deleted file mode 100644
index 39a5c0fb0b..0000000000
--- a/Zend/ZendCore.dep
+++ /dev/null
@@ -1,258 +0,0 @@
-# Microsoft Developer Studio Generated Dependency File, included by ZendCore.mak
-
-.\zend_alloc.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_execute.h"\
- ".\zend_llist.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
-
-
-.\alloca.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_config.w32.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
-
-
-.\zend_compile.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_execute.h"\
- ".\zend_llist.h"\
- ".\zend_modules.h"\
- ".\zend_operators.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_API.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
- ".\zend_ini.h"\
-
-
-.\zend_constants.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_config.w32.h"\
- ".\zend_constants.h"\
- ".\zend_operators.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
-
-
-.\zend_execute.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_constants.h"\
- ".\zend_execute.h"\
- ".\zend_llist.h"\
- ".\zend_modules.h"\
- ".\zend_operators.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_API.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
- ".\zend_ini.h"\
-
-
-.\zend_highlight.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_execute.h"\
- ".\zend_highlight.h"\
- ".\zend_llist.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend_language_parser.tab.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
-
-
-.\zend_llist.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_config.w32.h"\
- ".\zend_llist.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
-
-
-.\zend_opcode.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_execute.h"\
- ".\zend_llist.h"\
- ".\zend_modules.h"\
- ".\zend_operators.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_API.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
- ".\zend_ini.h"\
-
-
-.\zend_operators.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_execute.h"\
- ".\zend_llist.h"\
- ".\zend_operators.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
-
-
-.\zend_ptr_stack.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_config.w32.h"\
- ".\zend_ptr_stack.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
-
-
-.\zend_stack.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_config.w32.h"\
- ".\zend_stack.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
-
-
-.\zend_variables.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_constants.h"\
- ".\zend_execute.h"\
- ".\zend_llist.h"\
- ".\zend_modules.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_API.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
- ".\zend_ini.h"\
- ".\zend_list.h"\
-
-
-.\zend.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_config.w32.h"\
- ".\zend_operators.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
-
-
-.\zend_API.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_constants.h"\
- ".\zend_execute.h"\
- ".\zend_llist.h"\
- ".\zend_modules.h"\
- ".\zend_operators.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_API.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
- ".\zend_ini.h"\
- ".\zend_list.h"\
-
-
-.\zend_hash.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_config.w32.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
-
-
-.\zend_ini.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_config.w32.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
- ".\zend_ini.h"\
-
-
-!IF "$(CFG)" == "ZendCore - Win32 Release"
-
-!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
-
-!ENDIF
-
-!IF "$(CFG)" == "ZendCore - Win32 Release"
-
-!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
-
-!ENDIF
-
-!IF "$(CFG)" == "ZendCore - Win32 Release"
-
-!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
-
-!ENDIF
-
-!IF "$(CFG)" == "ZendCore - Win32 Release"
-
-!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
-
-!ENDIF
-
diff --git a/Zend/ZendTS.dsp b/Zend/ZendTS.dsp
deleted file mode 100644
index 8506facbbd..0000000000
--- a/Zend/ZendTS.dsp
+++ /dev/null
@@ -1,707 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ZendTS" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=ZendTS - Win32 Release_TSDbg
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ZendTS.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ZendTS.mak" CFG="ZendTS - Win32 Release_TSDbg"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ZendTS - Win32 Release_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "ZendTS - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "ZendTS - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library")
-!MESSAGE "ZendTS - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDebug_TS" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug_TS"
-# ADD RSC /l 0x40d /d "NDebug_TS"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug_TS" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug_TS" /D ZEND_DEBUG=1 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE RSC /l 0x40d /d "_Debug_TS"
-# ADD RSC /l 0x40d /d "_Debug_TS"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "ZendTS___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "ZendTS___Win32_Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug_TS"
-# ADD RSC /l 0x40d /d "NDebug_TS"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "ZendTS___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "ZendTS___Win32_Release_TSDbg"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug_TS"
-# ADD RSC /l 0x40d /d "NDebug_TS"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "ZendTS - Win32 Release_TS"
-# Name "ZendTS - Win32 Debug_TS"
-# Name "ZendTS - Win32 Release_TS_inline"
-# Name "ZendTS - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\zend.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_builtin_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_compile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_constants.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_default_classes.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_dynamic_array.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_extensions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_hash.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_highlight.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_indent.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.c
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.c"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_list.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_llist.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_mm.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_object_handlers.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_opcode.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_operators.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ptr_stack.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_qsort.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_sprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stack.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stream.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ts_hash.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_variables.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\FlexLexer.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_builtin_functions.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_compile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_constants.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_default_classes.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_dynamic_array.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_errors.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute_locks.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_extensions.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_fast_cache.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_globals_macros.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_hash.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_highlight.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_indent.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_istdiostream.h
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.h"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_list.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_llist.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_mm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_modules.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_object_handlers.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects_API.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_operators.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ptr_stack.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_qsort.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stack.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stream.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ts_hash.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_variables.h
-# End Source File
-# End Group
-# Begin Group "Parsers"
-
-# PROP Default_Filter "y"
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.y
-
-!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\zend_ini_parser.y
-
-BuildCmds= \
- bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-
-"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\zend_ini_parser.y
-
-BuildCmds= \
- bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-
-"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\zend_ini_parser.y
-
-BuildCmds= \
- bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-
-"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\zend_ini_parser.y
-
-BuildCmds= \
- bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-
-"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.y"
-
-!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Scanners"
-
-# PROP Default_Filter "l"
-# Begin Source File
-
-SOURCE=.\flex.skl
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.l
-
-!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
-
-# Begin Custom Build
-InputPath=.\zend_ini_scanner.l
-
-"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
-
-# Begin Custom Build
-InputPath=.\zend_ini_scanner.l
-
-"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
-
-# Begin Custom Build
-InputPath=.\zend_ini_scanner.l
-
-"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
-
-# Begin Custom Build
-InputPath=.\zend_ini_scanner.l
-
-"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.l"
-
-!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Text Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\LICENSE
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_BUGS
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_CHANGES
-# End Source File
-# End Group
-# Begin Group "Resources"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\zend.ico
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/Zend/acconfig.h b/Zend/acconfig.h
deleted file mode 100644
index 582d199f7a..0000000000
--- a/Zend/acconfig.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#define ZEND_API
-#define ZEND_DLEXPORT
-#define ZEND_DLIMPORT
-
-#ifndef NETWARE
-@TOP@
-#endif
-
-#undef uint
-#undef ulong
-
-/* Define if you want to enable memory limit support */
-#define MEMORY_LIMIT 0
-
-#ifndef NETWARE
-@BOTTOM@
-#endif
-
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_IEEEFP_H
-# include <ieeefp.h>
-#endif
-
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
-
-#if ZEND_BROKEN_SPRINTF
-int zend_sprintf(char *buffer, const char *format, ...);
-#else
-# define zend_sprintf sprintf
-#endif
-
-#include <math.h>
-
-#ifndef zend_isnan
-#ifdef HAVE_ISNAN
-#define zend_isnan(a) isnan(a)
-#elif defined(NAN)
-#define zend_isnan(a) (((a)==NAN)?1:0)
-#elif defined(HAVE_FPCLASS)
-#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
-#else
-#define zend_isnan(a) 0
-#endif
-#endif
-
-#ifdef HAVE_ISINF
-#define zend_isinf(a) isinf(a)
-#elif defined(INFINITY)
-/* Might not work, but is required by ISO C99 */
-#define zend_isinf(a) (((a)==INFINITY)?1:0)
-#elif defined(HAVE_FPCLASS)
-#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
-#else
-#define zend_isinf(a) 0
-#endif
-
-#ifdef HAVE_FINITE
-#define zend_finite(a) finite(a)
-#elif defined(HAVE_ISFINITE) || defined(isfinite)
-#define zend_finite(a) isfinite(a)
-#elif defined(fpclassify)
-#define zend_finite(a) ((fpclassify((a))!=FP_INFINITE&&fpclassify((a))!=FP_NAN)?1:0)
-#else
-#define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1)
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4
deleted file mode 100644
index 395f7220db..0000000000
--- a/Zend/acinclude.m4
+++ /dev/null
@@ -1,47 +0,0 @@
-dnl $Id$
-dnl
-dnl This file contains local autoconf functions.
-
-AC_DEFUN(ZEND_FP_EXCEPT,[
- AC_CACHE_CHECK(whether fp_except is defined, ac_cv_type_fp_except,[
- AC_TRY_COMPILE([
-#include <floatingpoint.h>
-],[
-fp_except x = (fp_except) 0;
-],[
- ac_cv_type_fp_except=yes
-],[
- ac_cv_type_fp_except=no
-],[
- ac_cv_type_fp_except=no
-])])
- if test "$ac_cv_type_fp_except" = "yes"; then
- AC_DEFINE(HAVE_FP_EXCEPT, 1, [whether floatingpoint.h defines fp_except])
- fi
-])
-
-dnl
-dnl Check for broken sprintf()
-dnl
-AC_DEFUN(AC_ZEND_BROKEN_SPRINTF,[
- AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[
- AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[
- ac_cv_broken_sprintf=no
- ],[
- ac_cv_broken_sprintf=yes
- ],[
- ac_cv_broken_sprintf=no
- ])
- ])
- if test "$ac_cv_broken_sprintf" = "yes"; then
- ac_result=1
- else
- ac_result=0
- fi
- AC_DEFINE_UNQUOTED(ZEND_BROKEN_SPRINTF, $ac_result, [Whether sprintf is broken])
-])
-
-AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
- LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
-])
-
diff --git a/Zend/build.mk b/Zend/build.mk
deleted file mode 100644
index 6105ff12c4..0000000000
--- a/Zend/build.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# Makefile to generate build tools
-#
-# Standard usage:
-# make -f build.mk
-#
-# Written by Sascha Schumann
-#
-# $Id$
-
-
-LT_TARGETS = ltmain.sh ltconfig
-
-config_h_in = zend_config.h.in
-
-makefile_am_files = Makefile.am
-makefile_in_files = $(makefile_am_files:.am=.in)
-makefile_files = $(makefile_am_files:e.am=e)
-
-targets = $(makefile_in_files) $(LT_TARGETS) configure $(config_h_in)
-
-all: $(targets)
-
-clean:
- rm -f $(targets)
-
-$(LT_TARGETS):
- rm -f $(LT_TARGETS)
- libtoolize --automake $(AMFLAGS) -f
-
-$(makefile_in_files): $(makefile_am_files)
- automake -a -i $(AMFLAGS) $(makefile_files)
-
-aclocal.m4: configure.in acinclude.m4
- aclocal
-
-$(config_h_in): configure.in acconfig.h
-# explicitly remove target since autoheader does not seem to work
-# correctly otherwise (timestamps are not updated)
- @rm -f $@
- autoheader
-
-configure: aclocal.m4 configure.in
- autoconf
diff --git a/Zend/buildconf b/Zend/buildconf
deleted file mode 100755
index fe8dee6f76..0000000000
--- a/Zend/buildconf
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-
-case "$1" in
---copy)
- automake_flags=--copy
- shift
-;;
-esac
-
-libtoolize --force --automake $automake_flags
-
-mv aclocal.m4 aclocal.m4.old 2>/dev/null
-aclocal
-if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
- echo "buildconf: keeping ${1}aclocal.m4"
- mv aclocal.m4.old aclocal.m4
-else
- echo "buildconf: created or modified ${1}aclocal.m4"
-fi
-
-autoheader
-
-automake --add-missing --include-deps $automake_flags
-
-mv configure configure.old 2>/dev/null
-autoconf
-if cmp configure.old configure > /dev/null 2>&1; then
- echo "buildconf: keeping ${1}configure"
- mv configure.old configure
-else
- echo "buildconf: created or modified ${1}configure"
-fi
-
diff --git a/Zend/configure.in b/Zend/configure.in
deleted file mode 100644
index fd13fd9800..0000000000
--- a/Zend/configure.in
+++ /dev/null
@@ -1,47 +0,0 @@
-dnl $Id$
-dnl Process this file with autoconf to produce a configure script.
-
-AC_INIT(zend.c)
-AM_INIT_AUTOMAKE(zend, 0.80A, nodefine)
-AM_CONFIG_HEADER(zend_config.h)
-AM_SANITY_CHECK
-AM_MAINTAINER_MODE
-AC_PROG_CC
-AM_PROG_LEX
-AM_PROG_CC_STDC
-ZEND_VERSION=$VERSION
-
-dnl We want this one before the checks, so the checks can modify CFLAGS.
-test -z "$CFLAGS" && auto_cflags=1
-
-sinclude(Zend.m4)
-
-LIBZEND_BASIC_CHECKS
-LIBZEND_LIBDL_CHECKS
-LIBZEND_DLSYM_CHECK
-
-AM_PROG_LIBTOOL
-if test "$enable_debug" != "yes"; then
- AM_SET_LIBTOOL_VARIABLE([--silent])
-fi
-
-dnl
-dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary
-dnl and source packages. This should be harmless on other OSs.
-dnl
-if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
- CFLAGS="$CFLAGS -I/usr/pkg/include"
- LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
-fi
-
-LIBZEND_ENABLE_DEBUG
-LIBZEND_OTHER_CHECKS
-
-ZEND_EXTRA_LIBS="$LIBS"
-LIBS=""
-AC_SUBST(ZEND_EXTRA_LIBS)
-AC_OUTPUT(Makefile)
-
-# Local Variables:
-# tab-width: 4
-# End:
diff --git a/Zend/flex.skl b/Zend/flex.skl
deleted file mode 100644
index 1fac72db1f..0000000000
--- a/Zend/flex.skl
+++ /dev/null
@@ -1,1643 +0,0 @@
-/* A Lexical scanner generated by flex */
-
-/* Scanner skeleton version:
- * $Header$
- * vim:ft=lex:
- */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-
-%-
-#include <stdio.h>
-%*
-
-
-/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
-#ifdef c_plusplus
-#ifndef __cplusplus
-#define __cplusplus
-#endif
-#endif
-
-
-#ifdef __cplusplus
-
-#include <stdlib.h>
-%+
-class istream;
-%*
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-/* Use prototypes in function declarations. */
-#define YY_USE_PROTOS
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-#if __STDC__
-
-#define YY_USE_PROTOS
-#define YY_USE_CONST
-
-#endif /* __STDC__ */
-#endif /* ! __cplusplus */
-
-#ifdef __TURBOC__
- #pragma warn -rch
- #pragma warn -use
-#include <io.h>
-#include <stdlib.h>
-#define YY_USE_CONST
-#define YY_USE_PROTOS
-#endif
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-#undef YY_USE_PROTOS
-#define YY_USE_PROTOS
-
-#ifdef YY_USE_PROTOS
-#define YY_PROTO(proto) proto
-#else
-#define YY_PROTO(proto) ()
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yy_start = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yy_start - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( SCNG(yy_in) TSRMLS_CC )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#define YY_BUF_SIZE 16384
-
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-
-extern int yyleng;
-%-
-%*
-
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-/* The funky do-while in the following #define is used to turn the definition
- * int a single C statement (which needs a semi-colon terminator). This
- * avoids problems with code like:
- *
- * if ( condition_holds )
- * yyless( 5 );
- * else
- * do_something_else();
- *
- * Prior to using the do-while the compiler would get upset at the
- * "else" because it interpreted the "if" statement as being all
- * done when it reached the ';' after the yyless() call.
- */
-
-/* Return all but the first 'n' matched characters back to the input stream. */
-
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- *yy_cp = yy_hold_char; \
- yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-
-#define unput(c) yyunput( c, yytext_ptr TSRMLS_CC )
-
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-typedef unsigned int yy_size_t;
-
-
-struct yy_buffer_state
- {
-%-
- struct _zend_file_handle *yy_input_file;
-%+
- istream* yy_input_file;
-%*
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
- };
-
-%- Standard (non-C++) definition
-#define yy_current_buffer SCNG(current_buffer)
-#define yy_hold_char SCNG(_yy_hold_char)
-%*
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- */
-#define YY_CURRENT_BUFFER yy_current_buffer
-
-
-%- Standard (non-C++) definition
-/* yy_hold_char holds the character lost when yytext is formed. */
-
-#if 0
-static char yy_hold_char;
-
-static int yy_n_chars; /* number of characters read into yy_ch_buf */
-#endif
-
-/* Points to current character in buffer. */
-#define yy_c_buf_p SCNG(c_buf_p)
-#define yy_init SCNG(init)
-#define yy_start SCNG(start)
-
-#ifdef ZTS
-#define TSRMLS_D void ***tsrm_ls
-#define TSRMLS_DC , TSRMLS_D
-#define TSRMLS_C tsrm_ls
-#define TSRMLS_CC , TSRMLS_C
-#else
-#define TSRMLS_D
-#define TSRMLS_DC
-#define TSRMLS_C
-#define TSRMLS_CC
-#endif
-
-/* Flag which is used to allow yywrap()'s to do buffer switches
- * instead of setting up a fresh yyin. A bit of a hack ...
- */
-/* static int yy_did_buffer_switch_on_eof; */
-#define yy_did_buffer_switch_on_eof SCNG(_yy_did_buffer_switch_on_eof)
-
-void yyrestart YY_PROTO(( struct _zend_file_handle *input_file TSRMLS_DC ));
-
-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer TSRMLS_DC ));
-void yy_load_buffer_state YY_PROTO(( TSRMLS_D ));
-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( struct _zend_file_handle *file, int size TSRMLS_DC ));
-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b TSRMLS_DC ));
-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, struct _zend_file_handle *file TSRMLS_DC ));
-void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b TSRMLS_DC ));
-#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer TSRMLS_CC )
-
-YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size TSRMLS_DC ));
-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str TSRMLS_DC ));
-YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len TSRMLS_DC ));
-
-%*
-
-static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
-static void yy_flex_free YY_PROTO(( void * ));
-
-#define yy_new_buffer yy_create_buffer
-
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \
- yy_current_buffer->yy_is_interactive = is_interactive; \
- }
-
-#define yy_set_bol(at_bol) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \
- yy_current_buffer->yy_at_bol = at_bol; \
- }
-
-#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
-
-%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
-#undef yyleng
-#define yyleng SCNG(yy_leng)
-#undef yytext
-#define yytext SCNG(yy_text)
-#undef yytext_ptr
-#define yytext_ptr SCNG(yy_text)
-#undef yyin
-#define yyin SCNG(yy_in)
-#undef yyout
-#define yyout SCNG(yy_out)
-#undef yy_last_accepting_state
-#define yy_last_accepting_state SCNG(_yy_last_accepting_state)
-#undef yy_last_accepting_cpos
-#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos)
-#undef yy_more_flag
-#define yy_more_flag SCNG(_yy_more_flag)
-#undef yy_more_len
-#define yy_more_len SCNG(_yy_more_len)
-
-
-%- Standard (non-C++) definition
-static yy_state_type yy_get_previous_state YY_PROTO(( TSRMLS_D ));
-static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state TSRMLS_DC ));
-static int yy_get_next_buffer YY_PROTO(( TSRMLS_D ));
-static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
-%*
-
-#undef TSRMLS_D
-#undef TSRMLS_DC
-#undef TSRMLS_C
-#undef TSRMLS_CC
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- yytext_ptr = yy_bp; \
-%% code to fiddle yytext and yyleng for yymore() goes here
- yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
-%% code to copy yytext_ptr to yytext[] goes here, if %array
- yy_c_buf_p = yy_cp;
-
-#undef yyleng
-#undef yytext
-#undef yytext_ptr
-#undef yyin
-#undef yyout
-#undef yy_last_accepting_state
-#undef yy_last_accepting_cpos
-#undef yy_more_flag
-#undef yy_more_len
-
-
-%% data tables for the DFA and the user's section 1 definitions go here
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int yywrap YY_PROTO(( void ));
-#else
-extern int yywrap YY_PROTO(( void ));
-#endif
-#endif
-
-%-
-#ifndef YY_NO_UNPUT
-static void yyunput YY_PROTO(( int c, char *buf_ptr TSRMLS_DC ));
-#endif
-%*
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen YY_PROTO(( yyconst char * ));
-#endif
-
-#ifndef YY_NO_INPUT
-%- Standard (non-C++) definition
-#ifdef __cplusplus
-static int 3 YY_PROTO(( TSRMLS_D ));
-#else
-static int input YY_PROTO(( TSRMLS_D ));
-#endif
-%*
-#endif
-
-#if YY_STACK_USED
-#define yy_start_stack_ptr SCNG(yy_start_stack_ptr)
-#define yy_start_stack_depth SCNG(yy_start_stack_depth)
-#define yy_start_stack SCNG(yy_start_stack)
-/*
-static int yy_start_stack_ptr = 0;
-static int yy_start_stack_depth = 0;
-static int *yy_start_stack = 0;
-*/
-#ifndef YY_NO_PUSH_STATE
-static void yy_push_state YY_PROTO(( int new_state TSRMLS_DC ));
-#endif
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state YY_PROTO(( TSRMLS_D ));
-#endif
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state YY_PROTO(( TSRMLS_D ));
-#endif
-
-#else
-#define YY_NO_PUSH_STATE 1
-#define YY_NO_POP_STATE 1
-#define YY_NO_TOP_STATE 1
-#endif
-
-#ifdef YY_MALLOC_DECL
-YY_MALLOC_DECL
-#else
-#if __STDC__
-#ifndef __cplusplus
-#include <stdlib.h>
-#endif
-#else
-/* Just try to get by without declaring the routines. This will fail
- * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
- * or sizeof(void*) != sizeof(int).
- */
-#endif
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-
-/* Zend file handle reading */
-#ifndef ECHO
-#define ECHO /* There is no output */
-#endif
-
-#define YY_INPUT(buf, result, max_size) \
- if ( ((result = zend_stream_read(yyin, buf, max_size TSRMLS_CC)) == 0) \
- && zend_stream_ferror( yyin TSRMLS_CC) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" );
-
-
-
-#ifndef ECHO
-%- Standard (non-C++) definition
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO (void) fwrite( yytext, yyleng, 1, SCNG(yy_out) )
-%+ C++ definition
-#define ECHO LexerOutput( yytext, yyleng )
-%*
-#endif
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
-%% fread()/read() definition of YY_INPUT goes here unless we're doing C++
-%+ C++ definition
- if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
- YY_FATAL_ERROR( "input in flex scanner failed" );
-%*
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-%-
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
-%+
-#define YY_FATAL_ERROR(msg) LexerError( msg )
-%*
-#endif
-
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-%- Standard (non-C++) definition
-#define YY_DECL int yylex YY_PROTO(( void ))
-%+ C++ definition
-#define YY_DECL int yyFlexLexer::yylex()
-%*
-#endif
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-%% YY_RULE_SETUP definition goes here
-
-YY_DECL
- {
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
-
-%% user's declarations go here
-
- if ( yy_init )
- {
- yy_init = 0;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
- if ( ! yy_start )
- yy_start = 1; /* first start state */
-
-#if 0
- if ( ! SCNG(yy_in) )
-%-
- SCNG(yy_in) = stdin;
-%+
- SCNG(yy_in) = &cin;
-%*
-
- if ( ! SCNG(yy_out) )
-%-
- SCNG(yy_out) = stdout;
-%+
- SCNG(yy_out) = &cout;
-%*
-#endif
-
- if ( ! yy_current_buffer )
- yy_current_buffer =
- yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC );
-
- yy_load_buffer_state(TSRMLS_C);
- }
-
- while ( 1 ) /* loops until end-of-file is reached */
- {
-%% yymore()-related code goes here
- yy_cp = yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
-%% code to set up and find next match goes here
-
-yy_find_action:
-%% code to find the action number goes here
-
- YY_DO_BEFORE_ACTION;
-
-%% code for yylineno update goes here
-
-do_action: /* This label is used only to access EOF actions. */
-
-%% debug code goes here
-
- switch ( yy_act )
- { /* beginning of action switch */
-%% actions go here
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yy_hold_char;
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * yylex(). If so, then we have to assure
- * consistency between yy_current_buffer and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars;
- yy_current_buffer->yy_input_file = SCNG(yy_in);
- yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state(TSRMLS_C);
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state TSRMLS_CC );
-
- yy_bp = yytext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
-%% code to do back-up for compressed tables and set up yy_cp goes here
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer(TSRMLS_C) )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yy_did_buffer_switch_on_eof = 0;
-
- if ( yywrap() )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p =
- yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state(TSRMLS_C);
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yy_c_buf_p =
- &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)];
-
- yy_current_state = yy_get_previous_state(TSRMLS_C);
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
- } /* end of yylex */
-
-%+
-yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
- {
- SCNG(yy_in) = arg_yyin;
- SCNG(yy_out) = arg_yyout;
- yy_c_buf_p = 0;
- yy_init = 1;
- yy_start = 0;
- yy_flex_debug = 0;
- yylineno = 1; // this will only get updated if %option yylineno
-
- yy_did_buffer_switch_on_eof = 0;
-
- yy_looking_for_trail_begin = 0;
- yy_more_flag = 0;
- yy_more_len = 0;
- yy_more_offset = yy_prev_more_offset = 0;
-
- yy_start_stack_ptr = yy_start_stack_depth = 0;
- yy_start_stack = 0;
-
- yy_current_buffer = 0;
-
-#ifdef YY_USES_REJECT
- yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
-#else
- yy_state_buf = 0;
-#endif
- }
-
-yyFlexLexer::~yyFlexLexer()
- {
- delete yy_state_buf;
- yy_delete_buffer( yy_current_buffer TSRMLS_CC );
- }
-
-void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
- {
- if ( new_in )
- {
- yy_delete_buffer( SCNG(yy_current_buffer TSRMLS_CC ) );
- yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE TSRMLS_CC ) TSRMLS_CC );
- }
-
- if ( new_out )
- SCNG(yy_out) = new_out;
- }
-
-int yyFlexLexer::LexerInput( char* buf, int max_size )
- {
- if ( SCNG(yy_in)->eof() || SCNG(yy_in)->fail() )
- return 0;
-
- if (yy_current_buffer->yy_is_interactive) {
- SCNG(yy_in)->get( buf[0] );
-
- if ( SCNG(yy_in)->eof() )
- return 0;
-
- if ( SCNG(yy_in)->bad() )
- return -1;
-
- return 1;
- } else {
- (void) SCNG(yy_in)->read( buf, max_size );
-
- if ( SCNG(yy_in)->bad() )
- return -1;
- else
- return SCNG(yy_in)->gcount();
- }
- }
-
-void yyFlexLexer::LexerOutput( const char* buf, int size )
- {
- (void) SCNG(yy_out)->write( buf, size );
- }
-%*
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-
-%-
-static int yy_get_next_buffer(TSRMLS_D)
-%+
-int yyFlexLexer::yy_get_next_buffer(TSRMLS_D)
-%*
- {
- register char *dest = yy_current_buffer->yy_ch_buf;
- register char *source = yytext_ptr;
- register int number_to_move, i;
- int ret_val;
-
- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( yy_current_buffer->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- yy_current_buffer->yy_n_chars = SCNG(yy_n_chars) = 0;
-
- else
- {
- int num_to_read =
- yy_current_buffer->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-#ifdef YY_USES_REJECT
- YY_FATAL_ERROR(
-"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
-#else
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = yy_current_buffer;
-
- int yy_c_buf_p_offset =
- (int) (yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- int new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- yy_flex_realloc( (void *) b->yy_ch_buf,
- b->yy_buf_size + 2 );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = yy_current_buffer->yy_buf_size -
- number_to_move - 1;
-#endif
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
- SCNG(yy_n_chars), num_to_read );
-
- yy_current_buffer->yy_n_chars = SCNG(yy_n_chars);
- }
-
- if ( SCNG(yy_n_chars) == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( SCNG(yy_in) TSRMLS_CC );
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- yy_current_buffer->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- SCNG(yy_n_chars) += number_to_move;
- yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
- yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
-
- yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
-
- return ret_val;
- }
-
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-%-
-static yy_state_type yy_get_previous_state(TSRMLS_D)
-%+
-yy_state_type yyFlexLexer::yy_get_previous_state(TSRMLS_D)
-%*
- {
- register yy_state_type yy_current_state;
- register char *yy_cp;
-
-%% code to get the start state into yy_current_state goes here
-
- for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
- {
-%% code to find the next state goes here
- }
-
- return yy_current_state;
- }
-
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
-
-%-
-#ifdef YY_USE_PROTOS
-static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state TSRMLS_DC )
-#else
-static yy_state_type yy_try_NUL_trans( yy_current_state TSRMLS_CC )
-yy_state_type yy_current_state;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state TSRMLS_DC )
-%*
- {
- register int yy_is_jam;
-%% code to find the next state, and perhaps do backing up, goes here
-
- return yy_is_jam ? 0 : yy_current_state;
- }
-
-
-%-
-#ifndef YY_NO_UNPUT
-#ifdef YY_USE_PROTOS
-static void yyunput( int c, register char *yy_bp TSRMLS_DC )
-#else
-static void yyunput( c, yy_bp TSRMLS_CC )
-int c;
-register char *yy_bp;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-void yyFlexLexer::yyunput( int c, register char* yy_bp TSRMLS_DC )
-%*
- {
- register char *yy_cp = yy_c_buf_p;
-
- /* undo effects of setting up yytext */
- *yy_cp = yy_hold_char;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- { /* need to shift things up to make room */
- /* +2 for EOB chars. */
- register int number_to_move = SCNG(yy_n_chars) + 2;
- register char *dest = &yy_current_buffer->yy_ch_buf[
- yy_current_buffer->yy_buf_size + 2];
- register char *source =
- &yy_current_buffer->yy_ch_buf[number_to_move];
-
- while ( source > yy_current_buffer->yy_ch_buf )
- *--dest = *--source;
-
- yy_cp += (int) (dest - source);
- yy_bp += (int) (dest - source);
- yy_current_buffer->yy_n_chars =
- SCNG(yy_n_chars) = yy_current_buffer->yy_buf_size;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
-
- *--yy_cp = (char) c;
-
-%% update yylineno here
-
- yytext_ptr = yy_bp;
- yy_hold_char = *yy_cp;
- yy_c_buf_p = yy_cp;
- }
-%-
-#endif /* ifndef YY_NO_UNPUT */
-%*
-
-
-%-
-#ifdef __cplusplus
-static int yyinput(TSRMLS_D)
-#else
-static int input(TSRMLS_C)
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-int yyFlexLexer::yyinput(TSRMLS_D)
-%*
- {
- int c;
-
- *yy_c_buf_p = yy_hold_char;
-
- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] )
- /* This was really a NUL. */
- *yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- int offset = yy_c_buf_p - yytext_ptr;
- ++yy_c_buf_p;
-
- switch ( yy_get_next_buffer(TSRMLS_C) )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- yyrestart( SCNG(yy_in) TSRMLS_CC );
-
- /* fall through */
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap() )
- return EOF;
-
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput(TSRMLS_C);
-#else
- return input(TSRMLS_C);
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p = yytext_ptr + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
- *yy_c_buf_p = '\0'; /* preserve yytext */
- yy_hold_char = *++yy_c_buf_p;
-
-%% update BOL and yylineno
-
- return c;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yyrestart( struct _zend_file_handle *input_file TSRMLS_DC )
-#else
-void yyrestart( input_file TSRMLS_CC )
-struct _zend_file_handle *input_file;
-#endif
-%+
-void yyFlexLexer::yyrestart( istream* input_file TSRMLS_DC )
-%*
- {
- if ( ! yy_current_buffer )
- yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC );
-
- yy_init_buffer( yy_current_buffer, input_file TSRMLS_CC );
- yy_load_buffer_state(TSRMLS_C);
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer TSRMLS_DC)
-#else
-void yy_switch_to_buffer( new_buffer TSRMLS_CC)
-YY_BUFFER_STATE new_buffer;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer TSRMLS_DC )
-%*
- {
- if ( yy_current_buffer == new_buffer )
- return;
-
- if ( yy_current_buffer )
- {
- /* Flush out information for old buffer. */
- *yy_c_buf_p = yy_hold_char;
- yy_current_buffer->yy_buf_pos = yy_c_buf_p;
- yy_current_buffer->yy_n_chars = SCNG(yy_n_chars);
- }
-
- yy_current_buffer = new_buffer;
- yy_load_buffer_state(TSRMLS_C);
-
- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yy_did_buffer_switch_on_eof = 1;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_load_buffer_state( TSRMLS_D )
-#else
-void yy_load_buffer_state(TSRMLS_C)
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-void yyFlexLexer::yy_load_buffer_state()
-%*
- {
- SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars;
- yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
- SCNG(yy_in) = yy_current_buffer->yy_input_file;
- yy_hold_char = *yy_c_buf_p;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_create_buffer( struct _zend_file_handle *file, int size TSRMLS_DC )
-#else
-YY_BUFFER_STATE yy_create_buffer( file, size TSRMLS_CC )
-struct _zend_file_handle *file;
-int size;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size TSRMLS_DC )
-%*
- {
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- yy_init_buffer( b, file TSRMLS_CC );
-
- return b;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_delete_buffer( YY_BUFFER_STATE b TSRMLS_DC )
-#else
-void yy_delete_buffer( b TSRMLS_CC )
-YY_BUFFER_STATE b;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b TSRMLS_DC )
-%*
- {
- if ( ! b )
- return;
-
- if ( b == yy_current_buffer )
- yy_current_buffer = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- yy_flex_free( (void *) b->yy_ch_buf );
-
- yy_flex_free( (void *) b );
- }
-
-
-%-
-
-#ifdef YY_USE_PROTOS
-void yy_init_buffer( YY_BUFFER_STATE b, struct _zend_file_handle *file TSRMLS_DC )
-#else
-void yy_init_buffer( b, file TSRMLS_CC )
-YY_BUFFER_STATE b;
-struct _zend_file_handle *file;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-
-%+
-extern "C" int isatty YY_PROTO(( int ));
-void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file TSRMLS_DC )
-%*
-
- {
- yy_flush_buffer( b TSRMLS_CC );
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
-%-
-#if YY_ALWAYS_INTERACTIVE
- b->yy_is_interactive = 1;
-#else
-#if YY_NEVER_INTERACTIVE
- b->yy_is_interactive = 0;
-#else
- b->yy_is_interactive = file->handle.stream.interactive;
-#endif
-#endif
-%+
- b->yy_is_interactive = (file == (istream *) &cin) ? 1 : 0;
-%*
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_flush_buffer( YY_BUFFER_STATE b TSRMLS_DC )
-#else
-void yy_flush_buffer( b TSRMLS_CC )
-YY_BUFFER_STATE b;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-
-%+
-void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b TSRMLS_DC )
-%*
- {
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == yy_current_buffer )
- yy_load_buffer_state(TSRMLS_C);
- }
-%*
-
-
-#ifndef YY_NO_SCAN_BUFFER
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size TSRMLS_DC )
-#else
-YY_BUFFER_STATE yy_scan_buffer( base, size TSRMLS_CC )
-char *base;
-yy_size_t size;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
- {
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- yy_switch_to_buffer( b TSRMLS_CC );
-
- return b;
- }
-%*
-#endif
-
-
-#ifndef YY_NO_SCAN_STRING
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str TSRMLS_DC )
-#else
-YY_BUFFER_STATE yy_scan_string( yy_str TSRMLS_CC )
-yyconst char *yy_str;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
- {
- int len;
- for ( len = 0; yy_str[len]; ++len )
- ;
-
- return yy_scan_bytes( yy_str, len TSRMLS_CC );
- }
-%*
-#endif
-
-
-#ifndef YY_NO_SCAN_BYTES
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len TSRMLS_DC )
-#else
-YY_BUFFER_STATE yy_scan_bytes( bytes, len TSRMLS_CC )
-yyconst char *bytes;
-int len;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
- {
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = len + 2;
- buf = (char *) yy_flex_alloc( n );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
- for ( i = 0; i < len; ++i )
- buf[i] = bytes[i];
-
- buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = yy_scan_buffer( buf, n TSRMLS_CC);
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
- }
-%*
-#endif
-
-
-#ifndef YY_NO_PUSH_STATE
-%-
-#ifdef YY_USE_PROTOS
-static void yy_push_state( int new_state TSRMLS_DC )
-#else
-static void yy_push_state( new_state TSRMLS_CC )
-int new_state;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-void yyFlexLexer::yy_push_state( int new_state TSRMLS_DC )
-%*
- {
- if ( yy_start_stack_ptr >= yy_start_stack_depth )
- {
- yy_size_t new_size;
-
- yy_start_stack_depth += YY_START_STACK_INCR;
- new_size = yy_start_stack_depth * sizeof( int );
-
- if ( ! yy_start_stack )
- yy_start_stack = (int *) yy_flex_alloc( new_size );
-
- else
- yy_start_stack = (int *) yy_flex_realloc(
- (void *) yy_start_stack, new_size );
-
- if ( ! yy_start_stack )
- YY_FATAL_ERROR(
- "out of memory expanding start-condition stack" );
- }
-
- yy_start_stack[yy_start_stack_ptr++] = YY_START;
-
- BEGIN(new_state);
- }
-#endif
-
-
-#ifndef YY_NO_POP_STATE
-%-
-static void yy_pop_state(TSRMLS_D)
-%+
-void yyFlexLexer::yy_pop_state(TSRMLS_D)
-%*
- {
- if ( --yy_start_stack_ptr < 0 )
- YY_FATAL_ERROR( "start-condition stack underflow" );
-
- BEGIN(yy_start_stack[yy_start_stack_ptr]);
- }
-#endif
-
-
-#ifndef YY_NO_TOP_STATE
-%-
-static int yy_top_state(TSRMLS_D)
-%+
-int yyFlexLexer::yy_top_state()
-%*
- {
- return yy_start_stack[yy_start_stack_ptr - 1];
- }
-#endif
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-%-
-#ifdef YY_USE_PROTOS
-static void yy_fatal_error( yyconst char msg[] )
-#else
-static void yy_fatal_error( msg )
-char msg[];
-#endif
- {
- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
- }
-
-%+
-
-void yyFlexLexer::LexerError( yyconst char msg[] )
- {
- cerr << msg << '\n';
- exit( YY_EXIT_FAILURE );
- }
-%*
-
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- yytext[yyleng] = yy_hold_char; \
- yy_c_buf_p = yytext + n; \
- yy_hold_char = *yy_c_buf_p; \
- *yy_c_buf_p = '\0'; \
- yyleng = n; \
- } \
- while ( 0 )
-
-
-/* Internal utility routines. */
-
-#ifndef yytext_ptr
-#ifdef YY_USE_PROTOS
-static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
-#else
-static void yy_flex_strncpy( s1, s2, n )
-char *s1;
-yyconst char *s2;
-int n;
-#endif
- {
- register int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
- }
-#endif
-
-#ifdef YY_NEED_STRLEN
-#ifdef YY_USE_PROTOS
-static int yy_flex_strlen( yyconst char *s )
-#else
-static int yy_flex_strlen( s )
-yyconst char *s;
-#endif
- {
- register int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
- }
-#endif
-
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_alloc( yy_size_t size )
-#else
-static void *yy_flex_alloc( size )
-yy_size_t size;
-#endif
- {
- return (void *) malloc( size );
- }
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_realloc( void *ptr, yy_size_t size )
-#else
-static void *yy_flex_realloc( ptr, size )
-void *ptr;
-yy_size_t size;
-#endif
- {
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return (void *) realloc( (char *) ptr, size );
- }
-
-#ifdef YY_USE_PROTOS
-static void yy_flex_free( void *ptr )
-#else
-static void yy_flex_free( ptr )
-void *ptr;
-#endif
- {
- free( ptr );
- }
-
-#if YY_MAIN
-int main()
- {
- yylex();
- return 0;
- }
-#endif
diff --git a/Zend/tests/zend2.php b/Zend/tests/zend2.php
deleted file mode 100644
index 100bdbec95..0000000000
--- a/Zend/tests/zend2.php
+++ /dev/null
@@ -1,339 +0,0 @@
-Example 1: A singleton (static members)
-=======================================
-
-<?php
-
- class Counter {
- var $counter = 0;
-
- function increment_and_print()
- {
- print ++$this->counter;
- print "\n";
- }
- }
-
-
- class SingletonCounter {
- static $m_instance = NULL;
-
- function Instance()
- {
- if (self::$m_instance == NULL) {
- self::$m_instance = new Counter();
- }
- return self::$m_instance;
- }
- }
-
- SingletonCounter::Instance()->increment_and_print();
- SingletonCounter::Instance()->increment_and_print();
- SingletonCounter::Instance()->increment_and_print();
-
-?>
-
-Example 2: Factory method (derefencing objects returned from functions)
-=======================================================================
-
-<?php
-
- class Circle {
- function draw()
- {
- print "Circle\n";
- }
- }
-
- class Square {
- function draw()
- {
- print "Square\n";
- }
- }
-
- function ShapeFactoryMethod($shape)
- {
- switch ($shape) {
- case "Circle":
- return new Circle();
- case "Square":
- return new Square();
- }
- }
-
- ShapeFactoryMethod("Circle")->draw();
- ShapeFactoryMethod("Square")->draw();
-
-
-?>
-
-Example 3: Nested class
-=======================
-
-<?php
-
- class Database {
- class MySQL {
- var $host = "";
-
- function db_connect($user) {
- print "Connecting to MySQL database '$this->host' as $user\n";
- }
- }
-
- class Oracle {
- var $host = "localhost";
-
- function db_connect($user) {
- print "Connecting to Oracle database '$this->host' as $user\n";
- }
-
- }
- }
-
- $MySQL_obj = new Database::MySQL();
- $MySQL_obj->db_connect("John");
-
- $Oracle_obj = new Database::Oracle();
- $Oracle_obj->db_connect("Mark");
-
- unset($MySQL_obj);
- unset($Oracle_obj);
-?>
-
-Example 3: Nested class suitable for a PEAR like hierarchy
-==========================================================
-
-<?php
-
- class DB::MySQL {
- var $host = "";
-
- function db_connect($user) {
- print "Connecting to MySQL database '$this->host' as $user\n";
- }
- }
-
- class DB::Oracle {
- var $host = "localhost";
-
- function db_connect($user) {
- print "Connecting to Oracle database '$this->host' as $user\n";
- }
-
- }
-
- $MySQL_obj = new DB::MySQL();
- $MySQL_obj->db_connect("Susan");
-
- $Oracle_obj = new DB::Oracle();
- $Oracle_obj->db_connect("Barbara");
-
-?>
-
-Example 4: Class constants and class scope
-==========================================
-
-<?php
-
- class ErrorCodes {
- const FATAL = "Fatal error\n";
- const WARNING = "Warning\n";
- const INFO = "Informational message\n";
-
- function print_fatal_error_codes()
- {
- print "FATAL = " . FATAL;
- print "self::FATAL = " . self::FATAL;
- }
- }
-
- /* Call the static function and move into the ErrorCodes scope */
- ErrorCodes::print_fatal_error_codes();
-
-?>
-
-Example 5: Regular object method using both local and global functions
-======================================================================
-
-<?php
-
- class HelloWorld {
- const HELLO_WORLD = "Hello, World!\n";
-
- function get_hello_world()
- {
- return HELLO_WORLD;
- }
-
- function length_of_hello_world()
- {
- $str = $this->get_hello_world();
- return strlen($str);
- }
- }
-
- $obj = new HelloWorld();
- print "length_of_hello_world() = " . $obj->length_of_hello_world();
- print "\n";
-?>
-
-Example 6: Multiple derefencing of objects returned from methods
-================================================================
-
-<?php
-
-
- class Name {
- function Name($_name)
- {
- $this->name = $_name;
- }
-
- function display()
- {
- print $this->name;
- print "\n";
- }
- }
-
- class Person {
- function Person($_name, $_address)
- {
- $this->name = new Name($_name);
- }
-
- function getName()
- {
- return $this->name;
- }
- }
-
- $person = new Person("John", "New York");
- $person->getName()->display();
-
-?>
-
-Example 7: Exception handling
-=============================
-
-<?
- class MyException {
- function MyException($_error) {
- $this->error = $_error;
- }
-
- function getException()
- {
- return $this->error;
- }
- }
-
- function ThrowException()
- {
- throw new MyException("'This is an exception!'");
- }
-
-
- try {
- } catch (MyException $exception) {
- print "There was an exception: " . $exception->getException();
- print "\n";
- }
-
- try {
- ThrowException();
- } catch (MyException $exception) {
- print "There was an exception: " . $exception->getException();
- print "\n";
- }
-
-?>
-
-Example 8: __clone()
-===================
-
-<?
- class MyCloneable {
- static $id = 0;
-
- function MyCloneable()
- {
- $this->id = self::$id++;
- }
-
- function __clone()
- {
- $this->name = $that->name;
- $this->address = "New York";
- $this->id = self::$id++;
- }
- }
-
-
-
- $obj = new MyCloneable();
-
- $obj->name = "Hello";
- $obj->address = "Tel-Aviv";
-
- print $obj->id;
- print "\n";
-
- $obj = $obj->__clone();
-
- print $obj->id;
- print "\n";
- print $obj->name;
- print "\n";
- print $obj->address;
- print "\n";
-?>
-
-Example 9: Unified constructors
-===============================
-
-<?
-
- class BaseClass {
- function __construct()
- {
- print "In BaseClass constructor\n";
- }
- }
-
- class SubClass extends BaseClass {
- function __construct()
- {
- parent::__construct();
- print "In SubClass constructor\n";
- }
- }
-
- $obj = new BaseClass();
-
- $obj = new SubClass();
-
-?>
-
-Example 10: Destructors
-=======================
-
-<?php
-
-class MyDestructableClass {
- function __construct()
- {
- print "In constructor\n";
- $this->name = "MyDestructableClass";
- }
-
- function __destruct()
- {
- print "Destroying " . $this->name . "\n";
- }
-}
-
-$obj = new MyDestructableClass();
-
-?>
diff --git a/Zend/zend.c b/Zend/zend.c
deleted file mode 100644
index 47416cd520..0000000000
--- a/Zend/zend.c
+++ /dev/null
@@ -1,1099 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_extensions.h"
-#include "zend_modules.h"
-#include "zend_constants.h"
-#include "zend_list.h"
-#include "zend_API.h"
-#include "zend_default_classes.h"
-#include "zend_builtin_functions.h"
-#include "zend_ini.h"
-
-#ifdef ZTS
-# define GLOBAL_FUNCTION_TABLE &global_namespace.function_table
-# define GLOBAL_CLASS_TABLE &global_namespace.class_table
-# define GLOBAL_CONSTANTS_TABLE &global_namespace.constants_table
-# define GLOBAL_AUTO_GLOBALS_TABLE global_auto_globals_table
-#else
-# define GLOBAL_FUNCTION_TABLE CG(function_table)
-# define GLOBAL_CLASS_TABLE CG(class_table)
-# define GLOBAL_AUTO_GLOBALS_TABLE CG(auto_globals)
-#endif
-
-#if defined(ZEND_WIN32) && ZEND_DEBUG
-BOOL WINAPI IsDebuggerPresent(VOID);
-#endif
-
-/* true multithread-shared globals */
-ZEND_API zend_class_entry *zend_standard_class_def = NULL;
-ZEND_API int (*zend_printf)(const char *format, ...);
-ZEND_API zend_write_func_t zend_write;
-ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path);
-ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
-ZEND_API void (*zend_block_interruptions)(void);
-ZEND_API void (*zend_unblock_interruptions)(void);
-ZEND_API void (*zend_ticks_function)(int ticks);
-ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
-
-void (*zend_on_timeout)(int seconds TSRMLS_DC);
-
-static void (*zend_message_dispatcher_p)(long message, void *data);
-static int (*zend_get_configuration_directive_p)(char *name, uint name_length, zval *contents);
-
-
-static ZEND_INI_MH(OnUpdateErrorReporting)
-{
- if (!new_value) {
- EG(error_reporting) = E_ALL & ~E_NOTICE;
- } else {
- EG(error_reporting) = atoi(new_value);
- }
- return SUCCESS;
-}
-
-
-static ZEND_INI_MH(OnUpdateImplicitClone)
-{
- if (!new_value) {
- EG(implicit_clone) = 0;
- } else {
- EG(implicit_clone) = atoi(new_value) ? 1 : 0;
- }
- return SUCCESS;
-}
-
-
-ZEND_INI_BEGIN()
- ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting)
- ZEND_INI_ENTRY("zend2.implicit_clone", NULL, ZEND_INI_ALL, OnUpdateImplicitClone)
-ZEND_INI_END()
-
-
-#ifdef ZTS
-ZEND_API int compiler_globals_id;
-ZEND_API int executor_globals_id;
-ZEND_API int alloc_globals_id;
-zend_class_entry global_main_class;
-zend_namespace global_namespace;
-HashTable *global_auto_globals_table;
-#endif
-
-ZEND_API zend_utility_values zend_uv;
-
-ZEND_API zval zval_used_for_init; /* True global variable */
-
-/* version information */
-static char *zend_version_info;
-static uint zend_version_info_length;
-#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2003 Zend Technologies\n"
-
-
-#define PRINT_ZVAL_INDENT 4
-
-static void print_hash(HashTable *ht, int indent TSRMLS_DC)
-{
- zval **tmp;
- char *string_key;
- HashPosition iterator;
- ulong num_key;
- uint str_len;
- int i;
-
- for (i=0; i<indent; i++) {
- ZEND_PUTS(" ");
- }
- ZEND_PUTS("(\n");
- indent += PRINT_ZVAL_INDENT;
- zend_hash_internal_pointer_reset_ex(ht, &iterator);
- while (zend_hash_get_current_data_ex(ht, (void **) &tmp, &iterator) == SUCCESS) {
- for (i=0; i<indent; i++) {
- ZEND_PUTS(" ");
- }
- ZEND_PUTS("[");
- switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) {
- case HASH_KEY_IS_STRING:
- ZEND_PUTS(string_key);
- break;
- case HASH_KEY_IS_LONG:
- zend_printf("%ld", num_key);
- break;
- }
- ZEND_PUTS("] => ");
- zend_print_zval_r(*tmp, indent+PRINT_ZVAL_INDENT TSRMLS_CC);
- ZEND_PUTS("\n");
- zend_hash_move_forward_ex(ht, &iterator);
- }
- indent -= PRINT_ZVAL_INDENT;
- for (i=0; i<indent; i++) {
- ZEND_PUTS(" ");
- }
- ZEND_PUTS(")\n");
-}
-
-static void print_flat_hash(HashTable *ht TSRMLS_DC)
-{
- zval **tmp;
- char *string_key;
- HashPosition iterator;
- ulong num_key;
- uint str_len;
- int i = 0;
-
- zend_hash_internal_pointer_reset_ex(ht, &iterator);
- while (zend_hash_get_current_data_ex(ht, (void **) &tmp, &iterator) == SUCCESS) {
- if (i++ > 0) {
- ZEND_PUTS(",");
- }
- ZEND_PUTS("[");
- switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) {
- case HASH_KEY_IS_STRING:
- ZEND_PUTS(string_key);
- break;
- case HASH_KEY_IS_LONG:
- zend_printf("%ld", num_key);
- break;
- }
- ZEND_PUTS("] => ");
- zend_print_flat_zval_r(*tmp TSRMLS_CC);
- zend_hash_move_forward_ex(ht, &iterator);
- }
-}
-
-ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy)
-{
- if (expr->type==IS_STRING) {
- *use_copy = 0;
- return;
- }
- switch (expr->type) {
- case IS_NULL:
- expr_copy->value.str.len = 0;
- expr_copy->value.str.val = empty_string;
- break;
- case IS_BOOL:
- if (expr->value.lval) {
- expr_copy->value.str.len = 1;
- expr_copy->value.str.val = estrndup("1", 1);
- } else {
- expr_copy->value.str.len = 0;
- expr_copy->value.str.val = empty_string;
- }
- break;
- case IS_RESOURCE:
- expr_copy->value.str.val = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG);
- expr_copy->value.str.len = sprintf(expr_copy->value.str.val, "Resource id #%ld", expr->value.lval);
- break;
- case IS_ARRAY:
- expr_copy->value.str.len = sizeof("Array")-1;
- expr_copy->value.str.val = estrndup("Array", expr_copy->value.str.len);
- break;
- case IS_OBJECT:
- expr_copy->value.str.val = (char *) emalloc(sizeof("Object id #")-1 + MAX_LENGTH_OF_LONG);
- expr_copy->value.str.len = sprintf(expr_copy->value.str.val, "Object id #%ld", (long)expr->value.obj.handle);
-#if 0
- /* FIXME: This might break BC for some people */
- expr_copy->value.str.len = sizeof("Object")-1;
- expr_copy->value.str.val = estrndup("Object", expr_copy->value.str.len);
-#endif
- break;
- case IS_DOUBLE:
- *expr_copy = *expr;
- zval_copy_ctor(expr_copy);
- zend_locale_sprintf_double(expr_copy ZEND_FILE_LINE_CC);
- break;
- default:
- *expr_copy = *expr;
- zval_copy_ctor(expr_copy);
- convert_to_string(expr_copy);
- break;
- }
- expr_copy->type = IS_STRING;
- *use_copy = 1;
-}
-
-
-ZEND_API int zend_print_zval(zval *expr, int indent)
-{
- return zend_print_zval_ex(zend_write, expr, indent);
-}
-
-
-ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent)
-{
- zval expr_copy;
- int use_copy;
-
- zend_make_printable_zval(expr, &expr_copy, &use_copy);
- if (use_copy) {
- expr = &expr_copy;
- }
- if (expr->value.str.len==0) { /* optimize away empty strings */
- if (use_copy) {
- zval_dtor(expr);
- }
- return 0;
- }
- write_func(expr->value.str.val, expr->value.str.len);
- if (use_copy) {
- zval_dtor(expr);
- }
- return expr->value.str.len;
-}
-
-ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC)
-{
- switch (expr->type) {
- case IS_ARRAY:
- ZEND_PUTS("Array (");
- if (++expr->value.ht->nApplyCount>1) {
- ZEND_PUTS(" *RECURSION*");
- expr->value.ht->nApplyCount--;
- return;
- }
- print_flat_hash(expr->value.ht TSRMLS_CC);
- ZEND_PUTS(")");
- expr->value.ht->nApplyCount--;
- break;
- case IS_OBJECT:
- {
- HashTable *properties = NULL;
- char *class_name = NULL;
- zend_uint clen;
-
- if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
- Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC);
- }
- zend_printf("%s Object (", class_name?class_name:"Unknown Class");
- if(class_name) {
- efree(class_name);
- }
- if (Z_OBJ_HANDLER_P(expr, get_properties)) {
- properties = Z_OBJPROP_P(expr);
- }
- if (properties) {
- if (++properties->nApplyCount>1) {
- ZEND_PUTS(" *RECURSION*");
- properties->nApplyCount--;
- return;
- }
- print_flat_hash(properties TSRMLS_CC);
- properties->nApplyCount--;
- }
- ZEND_PUTS(")");
- break;
- }
- default:
- zend_print_variable(expr);
- break;
- }
-}
-
-ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC)
-{
- zend_print_zval_r_ex(zend_write, expr, indent TSRMLS_CC);
-}
-
-
-ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC)
-{
- switch (expr->type) {
- case IS_ARRAY:
- ZEND_PUTS("Array\n");
- if (++expr->value.ht->nApplyCount>1) {
- ZEND_PUTS(" *RECURSION*");
- expr->value.ht->nApplyCount--;
- return;
- }
- print_hash(expr->value.ht, indent TSRMLS_CC);
- expr->value.ht->nApplyCount--;
- break;
- case IS_OBJECT:
- {
- HashTable *properties = NULL;
- char *class_name = NULL;
- zend_uint clen;
-
- if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
- Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC);
- }
- zend_printf("%s Object\n", class_name?class_name:"Unknown Class");
- if(class_name) {
- efree(class_name);
- }
- if (Z_OBJ_HANDLER_P(expr, get_properties)) {
- properties = Z_OBJPROP_P(expr);
- }
- if (properties) {
- if (++properties->nApplyCount>1) {
- ZEND_PUTS(" *RECURSION*");
- properties->nApplyCount--;
- return;
- }
- print_hash(properties, indent TSRMLS_CC);
- properties->nApplyCount--;
- }
- break;
- }
- default:
- zend_print_variable(expr);
- break;
- }
-}
-
-
-static FILE *zend_fopen_wrapper(const char *filename, char **opened_path)
-{
- if (opened_path) {
- *opened_path = estrdup(filename);
- }
- return fopen(filename, "rb");
-}
-
-
-static void register_standard_class(TSRMLS_D)
-{
- zend_standard_class_def = malloc(sizeof(zend_class_entry));
-
- zend_standard_class_def->type = ZEND_INTERNAL_CLASS;
- zend_standard_class_def->name_length = sizeof("stdClass") - 1;
- zend_standard_class_def->name = zend_strndup("stdClass", zend_standard_class_def->name_length);
- zend_initialize_class_data(zend_standard_class_def, 1 TSRMLS_CC);
-
- zend_hash_add(GLOBAL_CLASS_TABLE, "stdclass", sizeof("stdclass"), &zend_standard_class_def, sizeof(zend_class_entry *), NULL);
-}
-
-#ifdef ZTS
-static void unregister_standard_class()
-{
- destroy_zend_class(&zend_standard_class_def);
-}
-#endif
-
-static void zend_set_default_compile_time_values(TSRMLS_D)
-{
- /* default compile-time values */
- CG(asp_tags) = 0;
- CG(short_tags) = 1;
- CG(allow_call_time_pass_reference) = 1;
- CG(extended_info) = 0;
-}
-
-
-#ifdef ZTS
-static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS_DC)
-{
- zend_function tmp_func;
- zend_class_entry tmp_class;
-
- compiler_globals->compiled_filename = NULL;
-
- compiler_globals->function_table = &compiler_globals->global_namespace.function_table;
- zend_hash_init_ex(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
- zend_hash_copy(compiler_globals->function_table, GLOBAL_FUNCTION_TABLE, NULL, &tmp_func, sizeof(zend_function));
-
- compiler_globals->class_table = &compiler_globals->global_namespace.class_table;
- zend_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
- zend_hash_copy(compiler_globals->class_table, GLOBAL_CLASS_TABLE, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry *));
-
- zend_set_default_compile_time_values(TSRMLS_C);
-
- CG(interactive) = 0;
-
- compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init_ex(compiler_globals->auto_globals, 8, NULL, NULL, 1, 0);
- zend_hash_copy(compiler_globals->auto_globals, global_auto_globals_table, NULL, NULL, sizeof(zend_auto_global) /* empty element */);
-}
-
-
-static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS_DC)
-{
- if (compiler_globals->function_table != GLOBAL_FUNCTION_TABLE) {
- zend_hash_destroy(compiler_globals->function_table);
- }
- if (compiler_globals->class_table != GLOBAL_CLASS_TABLE) {
- zend_hash_destroy(compiler_globals->class_table);
- }
- if (compiler_globals->auto_globals != global_auto_globals_table) {
- zend_hash_destroy(compiler_globals->auto_globals);
- free(compiler_globals->auto_globals);
- }
-}
-
-
-static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS_DC)
-{
- zend_startup_constants(TSRMLS_C);
- zend_copy_constants(EG(zend_constants), GLOBAL_CONSTANTS_TABLE);
- zend_init_rsrc_plist(TSRMLS_C);
- EG(lambda_count)=0;
- EG(user_error_handler) = NULL;
- EG(user_exception_handler) = NULL;
- EG(in_execution) = 0;
- EG(current_execute_data) = NULL;
- EG(active_namespace) = NULL;
-}
-
-
-static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS_DC)
-{
- zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
- zend_ini_shutdown(TSRMLS_C);
-}
-
-
-static void zend_new_thread_end_handler(THREAD_T thread_id TSRMLS_DC)
-{
- zend_copy_ini_directives(TSRMLS_C);
- zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC);
-}
-
-#endif
-
-
-static void alloc_globals_ctor(zend_alloc_globals *alloc_globals_p TSRMLS_DC)
-{
- start_memory_manager(TSRMLS_C);
-}
-
-
-#ifdef ZTS
-static void alloc_globals_dtor(zend_alloc_globals *alloc_globals_p TSRMLS_DC)
-{
- shutdown_memory_manager(0, 1 TSRMLS_CC);
-}
-#endif
-
-
-#ifdef __FreeBSD__
-/* FreeBSD floating point precision fix */
-#include <floatingpoint.h>
-#endif
-
-
-static void scanner_globals_ctor(zend_scanner_globals *scanner_globals_p TSRMLS_DC)
-{
- scanner_globals_p->c_buf_p = (char *) 0;
- scanner_globals_p->init = 1;
- scanner_globals_p->start = 0;
- scanner_globals_p->current_buffer = NULL;
- scanner_globals_p->yy_in = NULL;
- scanner_globals_p->yy_out = NULL;
- scanner_globals_p->_yy_more_flag = 0;
- scanner_globals_p->_yy_more_len = 0;
- scanner_globals_p->yy_start_stack_ptr = 0;
- scanner_globals_p->yy_start_stack_depth = 0;
- scanner_globals_p->yy_start_stack = 0;
-}
-
-void zend_init_opcodes_handlers();
-
-int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions)
-{
-#ifdef ZTS
- zend_compiler_globals *compiler_globals;
- zend_executor_globals *executor_globals;
- void ***tsrm_ls;
-#ifdef ZTS
- extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
- extern ZEND_API ts_rsrc_id language_scanner_globals_id;
-#else
- extern zend_scanner_globals ini_scanner_globals;
- extern zend_scanner_globals language_scanner_globals;
-#endif
-
- ts_allocate_id(&alloc_globals_id, sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, (ts_allocate_dtor) alloc_globals_dtor);
-#else
- alloc_globals_ctor(&alloc_globals TSRMLS_CC);
-#endif
-
-#ifdef __FreeBSD__
- /* FreeBSD floating point precision fix */
- fpsetmask(0);
-#endif
-
- zend_startup_extensions_mechanism();
-
- /* Set up utility functions and values */
- zend_error_cb = utility_functions->error_function;
- zend_printf = utility_functions->printf_function;
- zend_write = (zend_write_func_t) utility_functions->write_function;
- zend_fopen = utility_functions->fopen_function;
- if (!zend_fopen) {
- zend_fopen = zend_fopen_wrapper;
- }
- zend_stream_open_function = utility_functions->stream_open_function;
- zend_message_dispatcher_p = utility_functions->message_handler;
- zend_block_interruptions = utility_functions->block_interruptions;
- zend_unblock_interruptions = utility_functions->unblock_interruptions;
- zend_get_configuration_directive_p = utility_functions->get_configuration_directive;
- zend_ticks_function = utility_functions->ticks_function;
- zend_on_timeout = utility_functions->on_timeout;
-
- zend_compile_file = compile_file;
- zend_execute = execute;
- zend_execute_internal = NULL;
-
- zend_init_opcodes_handlers();
-
- /* set up version */
- zend_version_info = strdup(ZEND_CORE_VERSION_INFO);
- zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO)-1;
-
-#ifndef ZTS
- GLOBAL_FUNCTION_TABLE = &compiler_globals.global_namespace.function_table;
- GLOBAL_CLASS_TABLE = &compiler_globals.global_namespace.class_table;
- compiler_globals.global_namespace.static_members = NULL;
-#endif
- GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
- zend_hash_init_ex(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
-
- zend_hash_init_ex(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1, 0);
- zend_init_rsrc_list_dtors();
-
-
- /* This zval can be used to initialize allocate zval's to an uninit'ed value */
- zval_used_for_init.is_ref = 0;
- zval_used_for_init.refcount = 1;
- zval_used_for_init.type = IS_NULL;
-
-#ifdef ZTS
- zend_hash_init_ex(GLOBAL_CONSTANTS_TABLE, 20, NULL, ZEND_CONSTANT_DTOR, 1, 0);
- zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, (dtor_func_t) zend_auto_global_dtor, 1, 0);
- ts_allocate_id(&compiler_globals_id, sizeof(zend_compiler_globals), (ts_allocate_ctor) compiler_globals_ctor, (ts_allocate_dtor) compiler_globals_dtor);
- ts_allocate_id(&executor_globals_id, sizeof(zend_executor_globals), (ts_allocate_ctor) executor_globals_ctor, (ts_allocate_dtor) executor_globals_dtor);
- ts_allocate_id(&language_scanner_globals_id, sizeof(zend_scanner_globals), (ts_allocate_ctor) scanner_globals_ctor, NULL);
- ts_allocate_id(&ini_scanner_globals_id, sizeof(zend_scanner_globals), (ts_allocate_ctor) scanner_globals_ctor, NULL);
- compiler_globals = ts_resource(compiler_globals_id);
- executor_globals = ts_resource(executor_globals_id);
- tsrm_ls = ts_resource_ex(0, NULL);
-
- compiler_globals_dtor(compiler_globals, tsrm_ls);
- *compiler_globals->function_table = *GLOBAL_FUNCTION_TABLE;
- *compiler_globals->class_table = *GLOBAL_CLASS_TABLE;
- compiler_globals->auto_globals = GLOBAL_AUTO_GLOBALS_TABLE;
-
- zend_hash_destroy(executor_globals->zend_constants);
- *executor_globals->zend_constants = *GLOBAL_CONSTANTS_TABLE;
-#else
- zend_hash_init_ex(CG(auto_globals), 8, NULL, (dtor_func_t) zend_auto_global_dtor, 1, 0);
- scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC);
- scanner_globals_ctor(&language_scanner_globals TSRMLS_CC);
- zend_startup_constants();
- zend_set_default_compile_time_values(TSRMLS_C);
- EG(user_error_handler) = NULL;
- EG(user_exception_handler) = NULL;
-#endif
- register_standard_class(TSRMLS_C);
- zend_register_standard_constants(TSRMLS_C);
- zend_register_auto_global("GLOBALS", sizeof("GLOBALS")-1, NULL TSRMLS_CC);
-
-#ifndef ZTS
- zend_init_rsrc_plist(TSRMLS_C);
-#endif
-
- if (start_builtin_functions) {
- zend_startup_builtin_functions(TSRMLS_C);
- }
- zend_register_default_classes(TSRMLS_C);
-
- zend_ini_startup(TSRMLS_C);
-
-#ifdef ZTS
- tsrm_set_new_thread_end_handler(zend_new_thread_end_handler);
-#endif
-
- return SUCCESS;
-}
-
-
-void zend_register_standard_ini_entries(TSRMLS_D)
-{
- int module_number = 0;
-
- REGISTER_INI_ENTRIES();
-}
-
-
-#ifdef ZTS
-/* Unlink the global (r/o) copies of the class, function and constant tables,
- * and use a fresh r/w copy for the startup thread
- */
-void zend_post_startup(TSRMLS_D)
-{
- zend_compiler_globals *compiler_globals = ts_resource(compiler_globals_id);
- zend_executor_globals *executor_globals = ts_resource(executor_globals_id);
-
- *GLOBAL_FUNCTION_TABLE = *compiler_globals->function_table;
- *GLOBAL_CLASS_TABLE = *compiler_globals->class_table;
- *GLOBAL_CONSTANTS_TABLE = *executor_globals->zend_constants;
- zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
- compiler_globals_ctor(compiler_globals, tsrm_ls);
- executor_globals_ctor(executor_globals, tsrm_ls);
-}
-#endif
-
-
-void zend_shutdown(TSRMLS_D)
-{
-#ifdef ZEND_WIN32
- zend_shutdown_timeout_thread();
-#endif
-#ifndef ZTS
- zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
-#endif
- zend_hash_graceful_reverse_destroy(&module_registry);
- zend_destroy_rsrc_list_dtors();
-
- zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
- zend_hash_destroy(GLOBAL_CLASS_TABLE);
-
- zend_hash_destroy(GLOBAL_AUTO_GLOBALS_TABLE);
- free(GLOBAL_AUTO_GLOBALS_TABLE);
- zend_shutdown_extensions(TSRMLS_C);
- free(zend_version_info);
-
- zend_shutdown_constants(TSRMLS_C);
-#ifdef ZTS
- zend_hash_destroy(GLOBAL_CONSTANTS_TABLE);
- unregister_standard_class();
-#endif
-}
-
-
-void zend_set_utility_values(zend_utility_values *utility_values)
-{
- zend_uv = *utility_values;
- zend_uv.import_use_extension_length = strlen(zend_uv.import_use_extension);
-}
-
-
-/* this should be compatible with the standard zenderror */
-void zenderror(char *error)
-{
- zend_error(E_PARSE, error);
-}
-
-
-BEGIN_EXTERN_C()
-ZEND_API void _zend_bailout(char *filename, uint lineno)
-{
- TSRMLS_FETCH();
-
- if (!EG(bailout_set)) {
- zend_output_debug_string(1, "%s(%d) : Bailed out without a bailout address!", filename, lineno);
- exit(-1);
- }
- CG(unclean_shutdown) = 1;
- CG(in_compilation) = EG(in_execution) = 0;
- EG(current_execute_data) = NULL;
- longjmp(EG(bailout), FAILURE);
-}
-END_EXTERN_C()
-
-
-void zend_append_version_info(zend_extension *extension)
-{
- char *new_info;
- uint new_info_length;
-
- new_info_length = sizeof(" with v, by \n")
- + strlen(extension->name)
- + strlen(extension->version)
- + strlen(extension->copyright)
- + strlen(extension->author);
-
- new_info = (char *) malloc(new_info_length+1);
-
- sprintf(new_info, " with %s v%s, %s, by %s\n", extension->name, extension->version, extension->copyright, extension->author);
-
- zend_version_info = (char *) realloc(zend_version_info, zend_version_info_length+new_info_length+1);
- strcat(zend_version_info, new_info);
- zend_version_info_length += new_info_length;
- free(new_info);
-}
-
-
-ZEND_API char *get_zend_version()
-{
- return zend_version_info;
-}
-
-
-void zend_activate(TSRMLS_D)
-{
- init_compiler(TSRMLS_C);
- init_executor(TSRMLS_C);
- startup_scanner(TSRMLS_C);
-}
-
-
-void zend_activate_modules(TSRMLS_D)
-{
- zend_hash_apply(&module_registry, (apply_func_t) module_registry_request_startup TSRMLS_CC);
-}
-
-void zend_deactivate_modules(TSRMLS_D)
-{
- EG(opline_ptr) = NULL; /* we're no longer executing anything */
-
- zend_try {
- zend_hash_apply(&module_registry, (apply_func_t) module_registry_cleanup TSRMLS_CC);
- } zend_end_try();
-}
-
-void zend_deactivate(TSRMLS_D)
-{
- /* we're no longer executing anything */
- EG(opline_ptr) = NULL;
- EG(active_symbol_table) = NULL;
-
- /* restore namespace to global */
- zend_switch_namespace(EG(global_namespace_ptr) TSRMLS_CC);
- CG(function_table) = EG(function_table);
- CG(class_table) = EG(class_table);
-
- zend_try {
- shutdown_scanner(TSRMLS_C);
- } zend_end_try();
-
- /* shutdown_executor() takes care of its own bailout handling */
- shutdown_executor(TSRMLS_C);
-
- zend_try {
- shutdown_compiler(TSRMLS_C);
- } zend_end_try();
-
- zend_try {
- zend_ini_deactivate(TSRMLS_C);
- } zend_end_try();
-}
-
-
-BEGIN_EXTERN_C()
-ZEND_API void zend_message_dispatcher(long message, void *data)
-{
- if (zend_message_dispatcher_p) {
- zend_message_dispatcher_p(message, data);
- }
-}
-END_EXTERN_C()
-
-
-ZEND_API int zend_get_configuration_directive(char *name, uint name_length, zval *contents)
-{
- if (zend_get_configuration_directive_p) {
- return zend_get_configuration_directive_p(name, name_length, contents);
- } else {
- return FAILURE;
- }
-}
-
-
-#define ZEND_ERROR_BUFFER_SIZE 1024
-
-ZEND_API void zend_error(int type, const char *format, ...)
-{
- va_list args;
- zval ***params;
- zval *retval;
- zval *z_error_type, *z_error_message, *z_error_filename, *z_error_lineno, *z_context;
- char *error_filename;
- uint error_lineno;
- zval *orig_user_error_handler;
- TSRMLS_FETCH();
-
- /* Obtain relevant filename and lineno */
- switch (type) {
- case E_CORE_ERROR:
- case E_CORE_WARNING:
- error_filename = NULL;
- error_lineno = 0;
- break;
- case E_PARSE:
- case E_COMPILE_ERROR:
- case E_COMPILE_WARNING:
- case E_ERROR:
- case E_NOTICE:
- case E_WARNING:
- case E_USER_ERROR:
- case E_USER_WARNING:
- case E_USER_NOTICE:
- if (zend_is_compiling(TSRMLS_C)) {
- error_filename = zend_get_compiled_filename(TSRMLS_C);
- error_lineno = zend_get_compiled_lineno(TSRMLS_C);
- } else if (zend_is_executing(TSRMLS_C)) {
- error_filename = zend_get_executed_filename(TSRMLS_C);
- error_lineno = zend_get_executed_lineno(TSRMLS_C);
- } else {
- error_filename = NULL;
- error_lineno = 0;
- }
- break;
- default:
- error_filename = NULL;
- error_lineno = 0;
- break;
- }
- if (!error_filename) {
- error_filename = "Unknown";
- }
-
-
- va_start(args, format);
-
- /* if we don't have a user defined error handler */
- if (!EG(user_error_handler)) {
- zend_error_cb(type, error_filename, error_lineno, format, args);
- } else switch (type) {
- case E_ERROR:
- case E_PARSE:
- case E_CORE_ERROR:
- case E_CORE_WARNING:
- case E_COMPILE_ERROR:
- case E_COMPILE_WARNING:
- /* The error may not be safe to handle in user-space */
- zend_error_cb(type, error_filename, error_lineno, format, args);
- break;
- default:
- /* Handle the error in user space */
- ALLOC_INIT_ZVAL(z_error_message);
- ALLOC_INIT_ZVAL(z_error_type);
- ALLOC_INIT_ZVAL(z_error_filename);
- ALLOC_INIT_ZVAL(z_error_lineno);
- ALLOC_INIT_ZVAL(z_context);
- z_error_message->value.str.val = (char *) emalloc(ZEND_ERROR_BUFFER_SIZE);
-
-#ifdef HAVE_VSNPRINTF
- vsnprintf(z_error_message->value.str.val, ZEND_ERROR_BUFFER_SIZE, format, args);
- /* this MUST be revisited, but for now handle ALL implementation
- * out there correct. Since this is inside an error handler the
- * performance loss by strlne is irrelevant. */
- z_error_message->value.str.val[ZEND_ERROR_BUFFER_SIZE - 1] = '\0';
- z_error_message->value.str.len = strlen(z_error_message->value.str.val);
-#else
- strncpy(z_error_message->value.str.val, va_arg(format, char *), ZEND_ERROR_BUFFER_SIZE);
- z_error_message->value.str.val[ZEND_ERROR_BUFFER_SIZE - 1] = '\0';
- z_error_message->value.str.len = strlen(z_error_message->value.str.val);
- /* This is risky... */
- /* z_error_message->value.str.len = vsprintf(z_error_message->value.str.val, format, args); */
-#endif
- z_error_message->type = IS_STRING;
-
- z_error_type->value.lval = type;
- z_error_type->type = IS_LONG;
-
- if (error_filename) {
- z_error_filename->value.str.len = strlen(error_filename);
- z_error_filename->value.str.val = estrndup(error_filename, z_error_filename->value.str.len);
- z_error_filename->type = IS_STRING;
- }
-
- z_error_lineno->value.lval = error_lineno;
- z_error_lineno->type = IS_LONG;
-
- z_context->value.ht = EG(active_symbol_table);
- z_context->type = IS_ARRAY;
- z_context->is_ref = 1;
- z_context->refcount = 2; /* we don't want this one to be freed */
-
- params = (zval ***) emalloc(sizeof(zval **)*5);
- params[0] = &z_error_type;
- params[1] = &z_error_message;
- params[2] = &z_error_filename;
- params[3] = &z_error_lineno;
- params[4] = &z_context;
-
- orig_user_error_handler = EG(user_error_handler);
- EG(user_error_handler) = NULL;
- if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC)==SUCCESS) {
- if (retval) {
- zval_ptr_dtor(&retval);
- }
- } else {
- /* The user error handler failed, use built-in error handler */
- zend_error_cb(type, error_filename, error_lineno, format, args);
- }
- EG(user_error_handler) = orig_user_error_handler;
-
- efree(params);
- zval_ptr_dtor(&z_error_message);
- zval_ptr_dtor(&z_error_type);
- zval_ptr_dtor(&z_error_filename);
- zval_ptr_dtor(&z_error_lineno);
- if (ZVAL_REFCOUNT(z_context) == 2) {
- FREE_ZVAL(z_context);
- }
- break;
- }
-
- va_end(args);
-
- if (type == E_PARSE) {
- EG(exit_status) = 255;
- zend_init_compiler_data_structures(TSRMLS_C);
- }
-}
-
-
-ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ...)
-{
-#if ZEND_DEBUG
- va_list args;
-
- va_start(args, format);
-# ifdef ZEND_WIN32
- {
- char output_buf[1024];
-
- vsnprintf(output_buf, 1024, format, args);
- OutputDebugString(output_buf);
- OutputDebugString("\n");
- if (trigger_break && IsDebuggerPresent()) {
- DebugBreak();
- }
- }
-# else
- vfprintf(stderr, format, args);
- fprintf(stderr, "\n");
-# endif
- va_end(args);
-#endif
-}
-
-
-ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...)
-{
- va_list files;
- int i;
- zend_file_handle *file_handle;
- zend_op_array *orig_op_array = EG(active_op_array);
- zval *local_retval=NULL;
-
- va_start(files, file_count);
- for (i=0; i<file_count; i++) {
- file_handle = va_arg(files, zend_file_handle *);
- if (!file_handle) {
- continue;
- }
- EG(active_op_array) = zend_compile_file(file_handle, ZEND_INCLUDE TSRMLS_CC);
- zend_destroy_file_handle(file_handle TSRMLS_CC);
- if (EG(active_op_array)) {
- EG(return_value_ptr_ptr) = retval ? retval : &local_retval;
- zend_execute(EG(active_op_array) TSRMLS_CC);
- if (EG(exception)) {
- char ex_class_name[128];
- if(Z_TYPE_P(EG(exception)) == IS_OBJECT) {
- strncpy(ex_class_name, Z_OBJ_CLASS_NAME_P(EG(exception)), 127);
- ex_class_name[127] = '\0';
- } else {
- strcpy(ex_class_name, "Unknown Exception");
- }
-#if 1 /* support set_exception_handler() */
- if (EG(user_exception_handler)) {
- zval *orig_user_exception_handler;
- zval ***params, *retval2;
- params = (zval ***)emalloc(sizeof(zval **));
- params[0] = &EG(exception);
- orig_user_exception_handler = EG(user_exception_handler);
- if (call_user_function_ex(CG(function_table), NULL, orig_user_exception_handler, &retval2, 1, params, 1, NULL TSRMLS_CC) == SUCCESS) {
- if (retval2 != NULL) {
- zval_ptr_dtor(&retval2);
- }
- } else {
- zval_ptr_dtor(&EG(exception));
- EG(exception) = NULL;
- zend_error(E_ERROR, "Uncaught exception '%s'!", ex_class_name);
- }
- efree(params);
- zval_ptr_dtor(&EG(exception));
- EG(exception) = NULL;
- } else {
- zval_ptr_dtor(&EG(exception));
- EG(exception) = NULL;
- zend_error(E_ERROR, "Uncaught exception '%s'!", ex_class_name);
- }
- if (retval == NULL && *EG(return_value_ptr_ptr) != NULL) {
- zval_ptr_dtor(EG(return_value_ptr_ptr));
- local_retval = NULL;
- }
-#else
- zval_ptr_dtor(&EG(exception));
- zend_error(E_ERROR, "Uncaught exception '%s'!", ex_class_name);
-#endif
- } else if (!retval) {
- zval_ptr_dtor(EG(return_value_ptr_ptr));
- local_retval = NULL;
- }
- destroy_op_array(EG(active_op_array) TSRMLS_CC);
- efree(EG(active_op_array));
- } else if (type==ZEND_REQUIRE) {
- va_end(files);
- EG(active_op_array) = orig_op_array;
- return FAILURE;
- }
- }
- va_end(files);
- EG(active_op_array) = orig_op_array;
-
- return SUCCESS;
-}
-
-#define COMPILED_STRING_DESCRIPTION_FORMAT "%s(%d) : %s"
-
-ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC)
-{
- char *cur_filename;
- int cur_lineno;
- char *compiled_string_description;
-
- if (zend_is_compiling(TSRMLS_C)) {
- cur_filename = zend_get_compiled_filename(TSRMLS_C);
- cur_lineno = zend_get_compiled_lineno(TSRMLS_C);
- } else if (zend_is_executing(TSRMLS_C)) {
- cur_filename = zend_get_executed_filename(TSRMLS_C);
- cur_lineno = zend_get_executed_lineno(TSRMLS_C);
- } else {
- cur_filename = "Unknown";
- cur_lineno = 0;
- }
-
- compiled_string_description = emalloc(sizeof(COMPILED_STRING_DESCRIPTION_FORMAT)+strlen(name)+strlen(cur_filename)+MAX_LENGTH_OF_LONG);
- sprintf(compiled_string_description, COMPILED_STRING_DESCRIPTION_FORMAT, cur_filename, cur_lineno, name);
- return compiled_string_description;
-}
-
-
-void free_estring(char **str_p)
-{
- efree(*str_p);
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend.h b/Zend/zend.h
deleted file mode 100644
index a2212446ff..0000000000
--- a/Zend/zend.h
+++ /dev/null
@@ -1,617 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_H
-#define ZEND_H
-
-#define ZEND_VERSION "2.0.0-dev"
-
-#define ZEND_ENGINE_2
-
-#ifdef __cplusplus
-#define BEGIN_EXTERN_C() extern "C" {
-#define END_EXTERN_C() }
-#else
-#define BEGIN_EXTERN_C()
-#define END_EXTERN_C()
-#endif
-
-#include <stdio.h>
-
-/*
- * general definitions
- */
-
-#ifdef ZEND_WIN32
-# include "zend_config.w32.h"
-# define ZEND_PATHS_SEPARATOR ';'
-#elif defined(NETWARE)
-# include "zend_config.nw.h"
-# include "acconfig.h"
-#elif defined(__riscos__)
-# include "zend_config.h"
-# define ZEND_PATHS_SEPARATOR ';'
-#else
-# include "zend_config.h"
-# define ZEND_PATHS_SEPARATOR ':'
-#endif
-
-
-#ifdef ZEND_WIN32
-/* Only use this macro if you know for sure that all of the switches values
- are covered by its case statements */
-#define EMPTY_SWITCH_DEFAULT_CASE() \
- default: \
- __assume(0); \
- break;
-#else
-#define EMPTY_SWITCH_DEFAULT_CASE()
-#endif
-
-/* all HAVE_XXX test have to be after the include of zend_config above */
-
-#ifdef HAVE_UNIX_H
-# include <unix.h>
-#endif
-
-#ifdef HAVE_STDARG_H
-# include <stdarg.h>
-#endif
-
-#ifdef HAVE_DLFCN_H
-# include <dlfcn.h>
-#endif
-
-#if HAVE_MACH_O_DYLD_H
-#include <mach-o/dyld.h>
-
-/* MH_BUNDLE loading functions for Mac OS X / Darwin */
-void *zend_mh_bundle_load (char* bundle_path);
-int zend_mh_bundle_unload (void *bundle_handle);
-void *zend_mh_bundle_symbol(void *bundle_handle, const char *symbol_name);
-const char *zend_mh_bundle_error(void);
-
-#endif /* HAVE_MACH_O_DYLD_H */
-
-#if defined(HAVE_LIBDL)
-
-# ifndef RTLD_LAZY
-# define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
-# endif
-
-# ifndef RTLD_GLOBAL
-# define RTLD_GLOBAL 0
-# endif
-
-# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)
-# define DL_UNLOAD dlclose
-# if defined(DLSYM_NEEDS_UNDERSCORE)
-# define DL_FETCH_SYMBOL(h,s) dlsym((h), "_" s)
-# else
-# define DL_FETCH_SYMBOL dlsym
-# endif
-# define DL_ERROR dlerror
-# define DL_HANDLE void *
-# define ZEND_EXTENSIONS_SUPPORT 1
-#elif defined(HAVE_MACH_O_DYLD_H)
-# define DL_LOAD(libname) zend_mh_bundle_load(libname)
-# define DL_UNLOAD(handle) zend_mh_bundle_unload(handle)
-# define DL_FETCH_SYMBOL(h,s) zend_mh_bundle_symbol(h,s)
-# define DL_ERROR zend_mh_bundle_error
-# define DL_HANDLE void *
-# define ZEND_EXTENSIONS_SUPPORT 1
-#elif defined(ZEND_WIN32)
-# define DL_LOAD(libname) LoadLibrary(libname)
-# define DL_FETCH_SYMBOL GetProcAddress
-# define DL_UNLOAD FreeLibrary
-# define DL_HANDLE HMODULE
-# define ZEND_EXTENSIONS_SUPPORT 1
-#else
-# define DL_HANDLE void *
-# define ZEND_EXTENSIONS_SUPPORT 0
-#endif
-
-#if HAVE_ALLOCA_H && !defined(_ALLOCA_H)
-# include <alloca.h>
-#endif
-
-/* AIX requires this to be the first thing in the file. */
-#ifndef __GNUC__
-# ifndef HAVE_ALLOCA_H
-# ifdef _AIX
- #pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-# endif
-# endif
-# endif
-#endif
-
-#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE))
-# define do_alloca(p) alloca(p)
-# define free_alloca(p)
-#else
-# define do_alloca(p) emalloc(p)
-# define free_alloca(p) efree(p)
-#endif
-
-#if ZEND_DEBUG
-#define ZEND_FILE_LINE_D char *__zend_filename, uint __zend_lineno
-#define ZEND_FILE_LINE_DC , ZEND_FILE_LINE_D
-#define ZEND_FILE_LINE_ORIG_D char *__zend_orig_filename, uint __zend_orig_lineno
-#define ZEND_FILE_LINE_ORIG_DC , ZEND_FILE_LINE_ORIG_D
-#define ZEND_FILE_LINE_RELAY_C __zend_filename, __zend_lineno
-#define ZEND_FILE_LINE_RELAY_CC , ZEND_FILE_LINE_RELAY_C
-#define ZEND_FILE_LINE_C __FILE__, __LINE__
-#define ZEND_FILE_LINE_CC , ZEND_FILE_LINE_C
-#define ZEND_FILE_LINE_EMPTY_C NULL, 0
-#define ZEND_FILE_LINE_EMPTY_CC , ZEND_FILE_LINE_EMPTY_C
-#define ZEND_FILE_LINE_ORIG_RELAY_C __zend_orig_filename, __zend_orig_lineno
-#define ZEND_FILE_LINE_ORIG_RELAY_CC , ZEND_FILE_LINE_ORIG_RELAY_C
-#else
-#define ZEND_FILE_LINE_D
-#define ZEND_FILE_LINE_DC
-#define ZEND_FILE_LINE_ORIG_D
-#define ZEND_FILE_LINE_ORIG_DC
-#define ZEND_FILE_LINE_RELAY_C
-#define ZEND_FILE_LINE_RELAY_CC
-#define ZEND_FILE_LINE_C
-#define ZEND_FILE_LINE_CC
-#define ZEND_FILE_LINE_EMPTY_C
-#define ZEND_FILE_LINE_EMPTY_CC
-#define ZEND_FILE_LINE_ORIG_RELAY_C
-#define ZEND_FILE_LINE_ORIG_RELAY_CC
-#endif /* ZEND_DEBUG */
-
-#ifdef ZTS
-#define ZTS_V 1
-#else
-#define ZTS_V 0
-#endif
-
-#include "zend_errors.h"
-#include "zend_alloc.h"
-
-#include "zend_types.h"
-
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
-
-#ifndef LONG_MAX
-#define LONG_MAX 2147483647L
-#endif
-
-#ifndef LONG_MIN
-#define LONG_MIN (- LONG_MAX - 1)
-#endif
-
-#undef SUCCESS
-#undef FAILURE
-#define SUCCESS 0
-#define FAILURE -1 /* this MUST stay a negative number, or it may affect functions! */
-
-
-#include "zend_hash.h"
-#include "zend_ts_hash.h"
-#include "zend_llist.h"
-
-#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval *this_ptr, int return_value_used TSRMLS_DC
-#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, this_ptr, return_value_used TSRMLS_CC
-
-
-/*
- * zval
- */
-typedef struct _zval_struct zval;
-typedef struct _zend_class_entry zend_class_entry;
-
-typedef struct _zend_object {
- zend_class_entry *ce;
- HashTable *properties;
- int in_get:1;
- int in_set:1;
-} zend_object;
-
-typedef unsigned int zend_object_handle;
-typedef struct _zend_object_value zend_object_value;
-
-#include "zend_object_handlers.h"
-
-struct _zend_object_value {
- zend_object_handle handle;
- zend_object_handlers *handlers;
-};
-
-typedef union _zvalue_value {
- long lval; /* long value */
- double dval; /* double value */
- struct {
- char *val;
- int len;
- } str;
- HashTable *ht; /* hash table value */
- zend_object_value obj;
-} zvalue_value;
-
-
-struct _zval_struct {
- /* Variable information */
- zvalue_value value; /* value */
- zend_uint refcount;
- zend_uchar type; /* active type */
- zend_uchar is_ref;
-};
-
-struct _zend_op_array;
-
-/* typedef struct _zend_namespace {
- char *name;
- zend_uint name_length;
- HashTable function_table;
- HashTable class_table;
- HashTable constants_table;
- HashTable *global_variables;
- struct _zend_op_array *op_array;
-} zend_namespace;
-*/
-
-typedef struct _zend_function_entry {
- char *fname;
- void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
- unsigned char *func_arg_types;
-} zend_function_entry;
-
-
-typedef struct _zend_property_reference {
- int type; /* read, write or r/w */
- zval *object;
- zend_llist *elements_list;
-} zend_property_reference;
-
-
-
-typedef struct _zend_overloaded_element {
- int type; /* array offset or object proprety */
- zval element;
-} zend_overloaded_element;
-
-/* excpt.h on Digital Unix 4.0 defines function_table */
-#undef function_table
-
-/* A lot of stuff needs shifiting around in order to include zend_compile.h here */
-union _zend_function;
-
-#define ZEND_CE_ABSTRACT ZEND_ACC_ABSTRACT /* same as ZEND_ACC_ABSTRACT */
-
-struct _zend_class_entry {
- char type;
- char *name;
- zend_uint name_length;
- struct _zend_class_entry *parent;
- int refcount;
- zend_bool constants_updated;
- zend_uint ce_flags;
-
- HashTable function_table;
- HashTable default_properties;
- HashTable properties_info;
- HashTable class_table;
- HashTable *static_members;
- HashTable constants_table;
- zend_function_entry *builtin_functions;
- struct _zend_class_entry *ns;
-
- union _zend_function *constructor;
- union _zend_function *destructor;
- union _zend_function *clone;
- union _zend_function *__get;
- union _zend_function *__set;
- union _zend_function *__call;
-
-
- /* handlers */
- zend_object_value (*create_object)(zend_class_entry *class_type TSRMLS_DC);
-
- zend_class_entry **interfaces;
- zend_uint num_interfaces;
-
- char *filename;
- zend_uint line_start;
- zend_uint line_end;
- char *doc_comment;
- zend_uint doc_comment_len;
-
- /* old handlers */
-#if 0
- void (*handle_function_call)(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
- zval (*handle_property_get)(zend_property_reference *property_reference);
- int (*handle_property_set)(zend_property_reference *property_reference, zval *value);
-#endif
-};
-
-typedef struct _zend_class_entry zend_namespace; /* namespace is the same as class */
-
-#include "zend_stream.h"
-typedef struct _zend_utility_functions {
- void (*error_function)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
- int (*printf_function)(const char *format, ...);
- int (*write_function)(const char *str, uint str_length);
- FILE *(*fopen_function)(const char *filename, char **opened_path);
- void (*message_handler)(long message, void *data);
- void (*block_interruptions)(void);
- void (*unblock_interruptions)(void);
- int (*get_configuration_directive)(char *name, uint name_length, zval *contents);
- void (*ticks_function)(int ticks);
- void (*on_timeout)(int seconds TSRMLS_DC);
- int (*stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
-} zend_utility_functions;
-
-
-typedef struct _zend_utility_values {
- char *import_use_extension;
- uint import_use_extension_length;
- zend_bool html_errors;
-} zend_utility_values;
-
-
-typedef int (*zend_write_func_t)(const char *str, uint str_length);
-
-
-#undef MIN
-#undef MAX
-#define MAX(a, b) (((a)>(b))?(a):(b))
-#define MIN(a, b) (((a)<(b))?(a):(b))
-#define ZEND_STRL(str) (str), (sizeof(str)-1)
-#define ZEND_STRS(str) (str), (sizeof(str))
-#define ZEND_NORMALIZE_BOOL(n) \
- ((n) ? (((n)>0) ? 1 : -1) : 0)
-
-
-/* data types */
-#define IS_NULL 0
-#define IS_LONG 1
-#define IS_DOUBLE 2
-#define IS_STRING 3
-#define IS_ARRAY 4
-#define IS_OBJECT 5
-#define IS_BOOL 6
-#define IS_RESOURCE 7
-#define IS_CONSTANT 8
-#define IS_CONSTANT_ARRAY 9
-
-/* Special data type to temporarily mark large numbers */
-#define FLAG_IS_BC 10 /* for parser internal use only */
-
-/* Ugly hack to support constants as static array indices */
-#define IS_CONSTANT_INDEX 0x80
-
-
-/* overloaded elements data types */
-#define OE_IS_ARRAY (1<<0)
-#define OE_IS_OBJECT (1<<1)
-#define OE_IS_METHOD (1<<2)
-
-
-/* Argument passing types */
-#define BYREF_NONE 0
-#define BYREF_FORCE 1
-#define BYREF_ALLOW 2
-#define BYREF_FORCE_REST 3
-
-int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions);
-void zend_shutdown(TSRMLS_D);
-void zend_register_standard_ini_entries(TSRMLS_D);
-
-#ifdef ZTS
-void zend_post_startup(TSRMLS_D);
-#endif
-
-void zend_set_utility_values(zend_utility_values *utility_values);
-
-BEGIN_EXTERN_C()
-ZEND_API void _zend_bailout(char *filename, uint lineno);
-END_EXTERN_C()
-
-#define zend_bailout() _zend_bailout(__FILE__, __LINE__)
-
-#define zend_try \
- { \
- jmp_buf orig_bailout; \
- zend_bool orig_bailout_set=EG(bailout_set); \
- \
- EG(bailout_set) = 1; \
- memcpy(&orig_bailout, &EG(bailout), sizeof(jmp_buf)); \
- if (setjmp(EG(bailout))==0)
-#define zend_catch \
- else
-#define zend_end_try() \
- memcpy(&EG(bailout), &orig_bailout, sizeof(jmp_buf)); \
- EG(bailout_set) = orig_bailout_set; \
- }
-#define zend_first_try EG(bailout_set)=0; zend_try
-
-ZEND_API char *get_zend_version(void);
-ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy);
-ZEND_API int zend_print_zval(zval *expr, int indent);
-ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent);
-ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC);
-ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC);
-ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC);
-ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ...);
-
-#if ZEND_DEBUG
-#define Z_DBG(expr) (expr)
-#else
-#define Z_DBG(expr)
-#endif
-
-ZEND_API extern char *empty_string;
-
-ZEND_API void free_estring(char **str_p);
-
-
-#define STR_FREE(ptr) if (ptr && ptr!=empty_string) { efree(ptr); }
-#define STR_FREE_REL(ptr) if (ptr && ptr!=empty_string) { efree_rel(ptr); }
-
-#define STR_REALLOC(ptr, size) \
- if (ptr!=empty_string) { \
- ptr = (char *) erealloc(ptr, size); \
- } else { \
- ptr = (char *) emalloc(size); \
- memset(ptr, 0, size); \
- }
-
-/* output support */
-#define ZEND_WRITE(str, str_len) zend_write((str), (str_len))
-#define ZEND_PUTS(str) zend_write((str), strlen((str)))
-#define ZEND_PUTC(c) zend_write(&(c), 1), (c)
-
-
-BEGIN_EXTERN_C()
-extern ZEND_API int (*zend_printf)(const char *format, ...);
-extern ZEND_API zend_write_func_t zend_write;
-extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path);
-extern ZEND_API void (*zend_block_interruptions)(void);
-extern ZEND_API void (*zend_unblock_interruptions)(void);
-extern ZEND_API void (*zend_ticks_function)(int ticks);
-extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
-extern void (*zend_on_timeout)(int seconds TSRMLS_DC);
-extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
-
-
-ZEND_API void zend_error(int type, const char *format, ...);
-
-void zenderror(char *error);
-
-/* The following #define is used for code duality in PHP for Engine 1 & 2 */
-#define ZEND_STANDARD_CLASS_DEF_PTR zend_standard_class_def
-extern ZEND_API zend_class_entry *zend_standard_class_def;
-extern ZEND_API zend_utility_values zend_uv;
-extern ZEND_API zval zval_used_for_init;
-
-END_EXTERN_C()
-
-#define ZEND_UV(name) (zend_uv.name)
-
-
-#define HANDLE_BLOCK_INTERRUPTIONS() if (zend_block_interruptions) { zend_block_interruptions(); }
-#define HANDLE_UNBLOCK_INTERRUPTIONS() if (zend_unblock_interruptions) { zend_unblock_interruptions(); }
-
-BEGIN_EXTERN_C()
-ZEND_API void zend_message_dispatcher(long message, void *data);
-END_EXTERN_C()
-
-ZEND_API int zend_get_configuration_directive(char *name, uint name_length, zval *contents);
-
-
-/* Messages for applications of Zend */
-#define ZMSG_FAILED_INCLUDE_FOPEN 1L
-#define ZMSG_FAILED_REQUIRE_FOPEN 2L
-#define ZMSG_FAILED_HIGHLIGHT_FOPEN 3L
-#define ZMSG_MEMORY_LEAK_DETECTED 4L
-#define ZMSG_MEMORY_LEAK_REPEATED 5L
-#define ZMSG_LOG_SCRIPT_NAME 6L
-
-
-#define ZVAL_ADDREF(pz) (++(pz)->refcount)
-#define ZVAL_DELREF(pz) (--(pz)->refcount)
-#define ZVAL_REFCOUNT(pz) ((pz)->refcount)
-
-#define INIT_PZVAL(z) \
- (z)->refcount = 1; \
- (z)->is_ref = 0;
-
-#define INIT_ZVAL(z) z = zval_used_for_init;
-
-#define ALLOC_INIT_ZVAL(zp) \
- ALLOC_ZVAL(zp); \
- INIT_ZVAL(*zp);
-
-#define MAKE_STD_ZVAL(zv) \
- ALLOC_ZVAL(zv); \
- INIT_PZVAL(zv);
-
-#define PZVAL_IS_REF(z) ((z)->is_ref)
-
-#define SEPARATE_ZVAL(ppzv) \
- { \
- zval *orig_ptr = *(ppzv); \
- \
- if (orig_ptr->refcount>1) { \
- orig_ptr->refcount--; \
- ALLOC_ZVAL(*(ppzv)); \
- **(ppzv) = *orig_ptr; \
- zval_copy_ctor(*(ppzv)); \
- (*(ppzv))->refcount=1; \
- (*(ppzv))->is_ref = 0; \
- } \
- }
-
-#define SEPARATE_ZVAL_IF_NOT_REF(ppzv) \
- if (!PZVAL_IS_REF(*ppzv)) { \
- SEPARATE_ZVAL(ppzv); \
- }
-
-#define SEPARATE_ZVAL_TO_MAKE_IS_REF(ppzv) \
- if (!PZVAL_IS_REF(*ppzv)) { \
- SEPARATE_ZVAL(ppzv); \
- (*(ppzv))->is_ref = 1; \
- }
-
-#define COPY_PZVAL_TO_ZVAL(zv, pzv) \
- (zv) = *(pzv); \
- if ((pzv)->refcount>1) { \
- zval_copy_ctor(&(zv)); \
- (pzv)->refcount--; \
- } else { \
- FREE_ZVAL(pzv); \
- } \
- INIT_PZVAL(&(zv));
-
-#define REPLACE_ZVAL_VALUE(ppzv_dest, pzv_src, copy) { \
- int is_ref, refcount; \
- \
- SEPARATE_ZVAL_IF_NOT_REF(ppzv_dest); \
- is_ref = (*ppzv_dest)->is_ref; \
- refcount = (*ppzv_dest)->refcount; \
- zval_dtor(*ppzv_dest); \
- **ppzv_dest = *pzv_src; \
- if (copy) { \
- zval_copy_ctor(*ppzv_dest); \
- } \
- (*ppzv_dest)->is_ref = is_ref; \
- (*ppzv_dest)->refcount = refcount; \
-}
-
-#define ZEND_MAX_RESERVED_RESOURCES 4
-
-
-#endif /* ZEND_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend.ico b/Zend/zend.ico
deleted file mode 100644
index 80978a6c7e..0000000000
--- a/Zend/zend.ico
+++ /dev/null
Binary files differ
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
deleted file mode 100644
index 238bcbb6fa..0000000000
--- a/Zend/zend_API.c
+++ /dev/null
@@ -1,1673 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Andrei Zmievski <andrei@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_execute.h"
-#include "zend_API.h"
-#include "zend_modules.h"
-#include "zend_constants.h"
-
-#ifdef HAVE_STDARG_H
-#include <stdarg.h>
-#endif
-
-/* these variables are true statics/globals, and have to be mutex'ed on every access */
-static int module_count=0;
-ZEND_API HashTable module_registry;
-
-/* this function doesn't check for too many parameters */
-ZEND_API int zend_get_parameters(int ht, int param_count, ...)
-{
- void **p;
- int arg_count;
- va_list ptr;
- zval **param, *param_ptr;
- TSRMLS_FETCH();
-
- p = EG(argument_stack).top_element-2;
- arg_count = (ulong) *p;
-
- if (param_count>arg_count) {
- return FAILURE;
- }
-
- va_start(ptr, param_count);
-
- while (param_count-->0) {
- param = va_arg(ptr, zval **);
- param_ptr = *(p-arg_count);
- if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) {
- zval *new_tmp;
-
- ALLOC_ZVAL(new_tmp);
- *new_tmp = *param_ptr;
- zval_copy_ctor(new_tmp);
- INIT_PZVAL(new_tmp);
- param_ptr = new_tmp;
- ((zval *) *(p-arg_count))->refcount--;
- *(p-arg_count) = param_ptr;
- }
- *param = param_ptr;
- arg_count--;
- }
- va_end(ptr);
-
- return SUCCESS;
-}
-
-
-ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument_array TSRMLS_DC)
-{
- void **p;
- int arg_count;
- zval *param_ptr;
-
- p = EG(argument_stack).top_element-2;
- arg_count = (ulong) *p;
-
- if (param_count>arg_count) {
- return FAILURE;
- }
-
- while (param_count-->0) {
- param_ptr = *(p-arg_count);
- if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) {
- zval *new_tmp;
-
- ALLOC_ZVAL(new_tmp);
- *new_tmp = *param_ptr;
- zval_copy_ctor(new_tmp);
- INIT_PZVAL(new_tmp);
- param_ptr = new_tmp;
- ((zval *) *(p-arg_count))->refcount--;
- *(p-arg_count) = param_ptr;
- }
- *(argument_array++) = param_ptr;
- arg_count--;
- }
-
- return SUCCESS;
-}
-
-
-
-
-/* Zend-optimized Extended functions */
-/* this function doesn't check for too many parameters */
-ZEND_API int zend_get_parameters_ex(int param_count, ...)
-{
- void **p;
- int arg_count;
- va_list ptr;
- zval ***param;
- TSRMLS_FETCH();
-
- p = EG(argument_stack).top_element-2;
- arg_count = (ulong) *p;
-
- if (param_count>arg_count) {
- return FAILURE;
- }
-
- va_start(ptr, param_count);
- while (param_count-->0) {
- param = va_arg(ptr, zval ***);
- *param = (zval **) p-(arg_count--);
- }
- va_end(ptr);
-
- return SUCCESS;
-}
-
-
-ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_array TSRMLS_DC)
-{
- void **p;
- int arg_count;
-
- p = EG(argument_stack).top_element-2;
- arg_count = (ulong) *p;
-
- if (param_count>arg_count) {
- return FAILURE;
- }
-
- while (param_count-->0) {
- *(argument_array++) = (zval **) p-(arg_count--);
- }
-
- return SUCCESS;
-}
-
-
-ZEND_API void zend_wrong_param_count(TSRMLS_D)
-{
- zend_error(E_WARNING, "Wrong parameter count for %s()", get_active_function_name(TSRMLS_C));
-}
-
-
-/* Argument parsing API -- andrei */
-
-ZEND_API char *zend_zval_type_name(zval *arg)
-{
- switch (Z_TYPE_P(arg)) {
- case IS_NULL:
- return "null";
-
- case IS_LONG:
- return "integer";
-
- case IS_DOUBLE:
- return "double";
-
- case IS_STRING:
- return "string";
-
- case IS_ARRAY:
- return "array";
-
- case IS_OBJECT:
- return "object";
-
- case IS_BOOL:
- return "boolean";
-
- case IS_RESOURCE:
- return "resource";
-
- default:
- return "unknown";
- }
-}
-
-ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC)
-{
- if (Z_OBJ_HT_P(zobject)->get_class_entry) {
- return Z_OBJ_HT_P(zobject)->get_class_entry(zobject TSRMLS_CC);
- } else {
- zend_error(E_ERROR, "Class entry requested for an object without PHP class");
- return NULL;
- }
-}
-
-static int zend_check_class(zval *obj, zend_class_entry *expected_ce TSRMLS_DC)
-{
- zend_class_entry *ce;
-
- if (Z_TYPE_P(obj) != IS_OBJECT) {
- return 0;
- }
-
- for (ce = Z_OBJCE_P(obj); ce != NULL; ce = ce->parent) {
- if (ce == expected_ce) {
- return 1;
- }
- }
-
- return 0;
-}
-
-static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC)
-{
- char *spec_walk = *spec;
- char c = *spec_walk++;
- int return_null = 0;
-
- while (*spec_walk == '/' || *spec_walk == '!') {
- if (*spec_walk == '/') {
- SEPARATE_ZVAL_IF_NOT_REF(arg);
- } else if (*spec_walk == '!' && Z_TYPE_PP(arg) == IS_NULL) {
- return_null = 1;
- }
- spec_walk++;
- }
-
- switch (c) {
- case 'l':
- {
- long *p = va_arg(*va, long *);
- switch (Z_TYPE_PP(arg)) {
- case IS_STRING:
- {
- double d;
- int type;
-
- if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), p, &d, 0)) == 0) {
- return "long";
- } else if (type == IS_DOUBLE) {
- *p = (long) d;
- }
- }
- break;
-
- case IS_NULL:
- case IS_LONG:
- case IS_DOUBLE:
- case IS_BOOL:
- convert_to_long_ex(arg);
- *p = Z_LVAL_PP(arg);
- break;
-
- case IS_ARRAY:
- case IS_OBJECT:
- case IS_RESOURCE:
- default:
- return "long";
- }
- }
- break;
-
- case 'd':
- {
- double *p = va_arg(*va, double *);
- switch (Z_TYPE_PP(arg)) {
- case IS_STRING:
- {
- long l;
- int type;
-
- if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &l, p, 0)) == 0) {
- return "double";
- } else if (type == IS_LONG) {
- *p = (double) l;
- }
- }
- break;
-
- case IS_NULL:
- case IS_LONG:
- case IS_DOUBLE:
- case IS_BOOL:
- convert_to_double_ex(arg);
- *p = Z_DVAL_PP(arg);
- break;
-
- case IS_ARRAY:
- case IS_OBJECT:
- case IS_RESOURCE:
- default:
- return "double";
- }
- }
- break;
-
- case 's':
- {
- char **p = va_arg(*va, char **);
- int *pl = va_arg(*va, int *);
- switch (Z_TYPE_PP(arg)) {
- case IS_NULL:
- if (return_null) {
- *p = NULL;
- *pl = 0;
- break;
- }
- /* break omitted intentionally */
-
- case IS_STRING:
- case IS_LONG:
- case IS_DOUBLE:
- case IS_BOOL:
- convert_to_string_ex(arg);
- *p = Z_STRVAL_PP(arg);
- *pl = Z_STRLEN_PP(arg);
- break;
-
- case IS_ARRAY:
- case IS_OBJECT:
- case IS_RESOURCE:
- default:
- return "string";
- }
- }
- break;
-
- case 'b':
- {
- zend_bool *p = va_arg(*va, zend_bool *);
- switch (Z_TYPE_PP(arg)) {
- case IS_NULL:
- case IS_STRING:
- case IS_LONG:
- case IS_DOUBLE:
- case IS_BOOL:
- convert_to_boolean_ex(arg);
- *p = Z_BVAL_PP(arg);
- break;
-
- case IS_ARRAY:
- case IS_OBJECT:
- case IS_RESOURCE:
- default:
- return "boolean";
- }
- }
- break;
-
- case 'r':
- {
- zval **p = va_arg(*va, zval **);
- if (Z_TYPE_PP(arg) != IS_RESOURCE) {
- if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
- *p = NULL;
- } else {
- return "resource";
- }
- } else
- *p = *arg;
- }
- break;
-
- case 'a':
- {
- zval **p = va_arg(*va, zval **);
- if (Z_TYPE_PP(arg) != IS_ARRAY) {
- if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
- *p = NULL;
- } else {
- return "array";
- }
- } else
- *p = *arg;
- }
- break;
-
- case 'o':
- {
- zval **p = va_arg(*va, zval **);
- if (Z_TYPE_PP(arg) != IS_OBJECT) {
- if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
- *p = NULL;
- } else {
- return "object";
- }
- } else
- *p = *arg;
- }
- break;
-
- case 'O':
- {
- zval **p = va_arg(*va, zval **);
- zend_class_entry *ce = va_arg(*va, zend_class_entry *);
- if (!zend_check_class(*arg, ce TSRMLS_CC)) {
- if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
- *p = NULL;
- } else {
- return ce->name;
- }
- } else
- *p = *arg;
- }
- break;
-
- case 'z':
- {
- zval **p = va_arg(*va, zval **);
- if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
- *p = NULL;
- } else {
- *p = *arg;
- }
- }
- break;
-
- default:
- return "unknown";
- }
-
- *spec = spec_walk;
-
- return NULL;
-}
-
-static int zend_parse_arg(int arg_num, zval **arg, va_list *va, char **spec, int quiet TSRMLS_DC)
-{
- char *expected_type = NULL;
-
- expected_type = zend_parse_arg_impl(arg, va, spec TSRMLS_CC);
- if (expected_type) {
- if (!quiet) {
- zend_error(E_WARNING, "%s() expects parameter %d to be %s, %s given",
- get_active_function_name(TSRMLS_C), arg_num, expected_type,
- zend_zval_type_name(*arg));
- }
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int flags TSRMLS_DC)
-{
- char *spec_walk;
- char buf[1024];
- int c, i;
- int min_num_args = -1;
- int max_num_args = 0;
- zval **arg;
- void **p;
- int arg_count;
- int quiet = flags & ZEND_PARSE_PARAMS_QUIET;
-
- for (spec_walk = type_spec; *spec_walk; spec_walk++) {
- c = *spec_walk;
- switch (c) {
- case 'l': case 'd':
- case 's': case 'b':
- case 'r': case 'a':
- case 'o': case 'O':
- case 'z':
- max_num_args++;
- break;
-
- case '|':
- min_num_args = max_num_args;
- break;
-
- case '/':
- case '!':
- /* Pass */
- break;
-
- default:
- if (!quiet) {
- zend_error(E_WARNING, "%s(): bad type specifier while parsing parameters", get_active_function_name(TSRMLS_C));
- }
- return FAILURE;
- }
- }
-
- if (min_num_args < 0) {
- min_num_args = max_num_args;
- }
-
- if (num_args < min_num_args || num_args > max_num_args) {
- if (!quiet) {
- sprintf(buf, "%s() expects %s %d parameter%s, %d given",
- get_active_function_name(TSRMLS_C),
- min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most",
- num_args < min_num_args ? min_num_args : max_num_args,
- (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s",
- num_args);
- zend_error(E_WARNING, buf);
- }
- return FAILURE;
- }
-
- p = EG(argument_stack).top_element-2;
- arg_count = (ulong) *p;
-
- if (num_args > arg_count) {
- zend_error(E_WARNING, "%s(): could not obtain parameters for parsing",
- get_active_function_name(TSRMLS_C));
- return FAILURE;
- }
-
- i = 0;
- while (num_args-- > 0) {
- arg = (zval **) p - (arg_count-i);
- if (*type_spec == '|') {
- type_spec++;
- }
- if (zend_parse_arg(i+1, arg, va, &type_spec, quiet TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
- i++;
- }
-
- return SUCCESS;
-}
-
-ZEND_API int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...)
-{
- va_list va;
- int retval;
-
- va_start(va, type_spec);
- retval = zend_parse_va_args(num_args, type_spec, &va, flags TSRMLS_CC);
- va_end(va);
-
- return retval;
-}
-
-ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...)
-{
- va_list va;
- int retval;
-
- va_start(va, type_spec);
- retval = zend_parse_va_args(num_args, type_spec, &va, 0 TSRMLS_CC);
- va_end(va);
-
- return retval;
-}
-
-ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, ...)
-{
- va_list va;
- int retval;
- char *p = type_spec;
- zval **object;
- zend_class_entry *ce;
-
- if (!this_ptr) {
- va_start(va, type_spec);
- retval = zend_parse_va_args(num_args, type_spec, &va, 0 TSRMLS_CC);
- va_end(va);
- }
- else {
- p++;
- va_start(va, type_spec);
-
- object = va_arg(va, zval **);
- ce = va_arg(va, zend_class_entry *);
- *object = this_ptr;
-
- retval = zend_parse_va_args(num_args, p, &va, 0 TSRMLS_CC);
- va_end(va);
- }
- return retval;
-}
-
-ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, zend_class_entry *ce, void **object, ...)
-{
- void **arg_stack = EG(argument_stack).top_element;
- va_list va;
- int retval;
- int quiet = flags & ZEND_PARSE_PARAMS_QUIET;
-
- *object = this_ptr;
-
- if (!*object) {
- zval **parameter;
-
- if (zend_get_parameters_ex(1, &parameter) != SUCCESS) {
- if (!quiet) {
- zend_error(E_WARNING, "%s() expects an object of class %s as first parameter, none was given",
- get_active_function_name(TSRMLS_C), ce->name);
- }
-
- return FAILURE;
- } else {
- if (!zend_check_class(*parameter, ce TSRMLS_CC)) {
- if (!quiet) {
- zend_error(E_WARNING, "%s() expects parameter 1 to be %s, %s given",
- get_active_function_name(TSRMLS_C), ce->name,
- zend_zval_type_name(*parameter));
- }
-
- return FAILURE;
- } else {
- *object = *parameter;
- }
-
- EG(argument_stack).top_element++;
- }
- }
-
- va_start(va, object);
- retval = zend_parse_va_args(num_args, type_spec, &va, flags TSRMLS_CC);
- va_end(va);
-
- EG(argument_stack).top_element = arg_stack;
-
- return retval;
-}
-
-/* Argument parsing API -- andrei */
-
-
-ZEND_API int _array_init(zval *arg ZEND_FILE_LINE_DC)
-{
- ALLOC_HASHTABLE_REL(arg->value.ht);
-
- zend_hash_init(arg->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0);
- arg->type = IS_ARRAY;
- return SUCCESS;
-}
-
-
-ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC)
-{
- zval *tmp;
- zend_object *object;
-
- if (!class_type->constants_updated) {
- zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
- zend_hash_apply_with_argument(class_type->static_members, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
- class_type->constants_updated = 1;
- }
-
- arg->type = IS_OBJECT;
- if (class_type->create_object == NULL) {
- arg->value.obj = zend_objects_new(&object, class_type TSRMLS_CC);
- if (properties) {
- object->properties = properties;
- } else {
- ALLOC_HASHTABLE_REL(object->properties);
- zend_hash_init(object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(object->properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
- }
- } else {
- arg->value.obj = class_type->create_object(class_type TSRMLS_CC);
- }
- return SUCCESS;
-}
-
-ZEND_API int _object_init_ex(zval *arg, zend_class_entry *class_type ZEND_FILE_LINE_DC TSRMLS_DC)
-{
- return _object_and_properties_init(arg, class_type, 0 ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
-}
-
-ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC)
-{
- return _object_init_ex(arg, zend_standard_class_def ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
-}
-
-
-ZEND_API int add_assoc_function(zval *arg, char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS))
-{
- zend_error(E_WARNING, "add_assoc_function() is no longer supported");
- return FAILURE;
-}
-
-
-ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, n);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_NULL(tmp);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_BOOL(tmp, b);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_RESOURCE(tmp, r);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_DOUBLE(tmp, d);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value)
-{
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &value, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_index_long(zval *arg, uint index, long n)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, n);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_index_null(zval *arg, uint index)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_NULL(tmp);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-ZEND_API int add_index_bool(zval *arg, uint index, int b)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_BOOL(tmp, b);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_index_resource(zval *arg, uint index, int r)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_RESOURCE(tmp, r);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_index_double(zval *arg, uint index, double d)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_DOUBLE(tmp, d);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_index_string(zval *arg, uint index, char *str, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_index_stringl(zval *arg, uint index, char *str, uint length, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_index_zval(zval *arg, uint index, zval *value)
-{
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &value, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_long(zval *arg, long n)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, n);
-
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_null(zval *arg)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_NULL(tmp);
-
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_bool(zval *arg, int b)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_BOOL(tmp, b);
-
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_resource(zval *arg, int r)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_RESOURCE(tmp, r);
-
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_double(zval *arg, double d)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_DOUBLE(tmp, d);
-
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
-
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
-
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_zval(zval *arg, zval *value)
-{
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &value, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, void **dest, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), dest);
-}
-
-
-ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, void **dest, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), dest);
-}
-
-
-ZEND_API int add_get_index_long(zval *arg, uint index, long l, void **dest)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, l);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest);
-}
-
-
-ZEND_API int add_get_index_double(zval *arg, uint index, double d, void **dest)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_DOUBLE(tmp, d);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest);
-}
-
-
-ZEND_API int add_get_index_string(zval *arg, uint index, char *str, void **dest, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest);
-}
-
-
-ZEND_API int add_get_index_stringl(zval *arg, uint index, char *str, uint length, void **dest, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest);
-}
-
-
-ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long n TSRMLS_DC)
-{
- zval *tmp;
- zval z_key;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, n);
- ZVAL_STRINGL(&z_key, key, key_len-1, 0);
-
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
- zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
- return SUCCESS;
-}
-
-ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b TSRMLS_DC)
-{
- zval *tmp;
- zval z_key;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_BOOL(tmp, b);
-
- ZVAL_STRINGL(&z_key, key, key_len-1, 0);
-
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
- zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
- return SUCCESS;
-}
-
-ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC)
-{
- zval *tmp;
- zval z_key;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_NULL(tmp);
-
- ZVAL_STRINGL(&z_key, key, key_len-1, 0);
-
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
- zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
- return SUCCESS;
-}
-
-ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long n TSRMLS_DC)
-{
- zval *tmp;
- zval z_key;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_RESOURCE(tmp, n);
- ZVAL_STRINGL(&z_key, key, key_len-1, 0);
-
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
- zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
- return SUCCESS;
-}
-
-
-ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d TSRMLS_DC)
-{
- zval *tmp;
- zval z_key;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_DOUBLE(tmp, d);
- ZVAL_STRINGL(&z_key, key, key_len-1, 0);
-
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
- zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
- return SUCCESS;
-}
-
-
-ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC)
-{
- zval *tmp;
- zval z_key;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
-
- ZVAL_STRINGL(&z_key, key, key_len-1, 0);
-
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
- zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
- return SUCCESS;
-}
-
-ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC)
-{
- zval *tmp;
- zval z_key;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
-
- ZVAL_STRINGL(&z_key, key, key_len-1, 0);
-
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
- zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
- return SUCCESS;
-}
-
-ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value TSRMLS_DC)
-{
- zval z_key;
-
- ZVAL_STRINGL(&z_key, key, key_len-1, 0);
-
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, value TSRMLS_CC);
- return SUCCESS;
-}
-
-ZEND_API int zend_startup_module(zend_module_entry *module)
-{
- if (module) {
- module->module_number = zend_next_free_module();
- if (module->module_startup_func) {
- TSRMLS_FETCH();
-
- if (module->module_startup_func(MODULE_PERSISTENT, module->module_number TSRMLS_CC)==FAILURE) {
- zend_error(E_CORE_ERROR,"Unable to start %s module", module->name);
- return FAILURE;
- }
- }
- module->type = MODULE_PERSISTENT;
- zend_register_module(module);
- }
- return SUCCESS;
-}
-
-
-/* registers all functions in *library_functions in the function hash */
-int zend_register_functions(zend_class_entry *scope, zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC)
-{
- zend_function_entry *ptr = functions;
- zend_function function, *reg_function;
- zend_internal_function *internal_function = (zend_internal_function *)&function;
- int count=0, unload=0;
- HashTable *target_function_table = function_table;
- int error_type;
- zend_function *ctor = NULL, *dtor = NULL, *clone = NULL;
- char *lowercase_name;
- int fname_len, is_namespace = 0;
- zend_namespace *scope_namespace;
-
- if (type==MODULE_PERSISTENT) {
- error_type = E_CORE_WARNING;
- } else {
- error_type = E_WARNING;
- }
-
- if (!target_function_table) {
- target_function_table = CG(function_table);
- }
- internal_function->type = ZEND_INTERNAL_FUNCTION;
-
- if(scope) {
- scope_namespace = scope->ns;
- is_namespace = (scope->type == ZEND_INTERNAL_NAMESPACE || scope->type == ZEND_USER_NAMESPACE) ? 1 : 0;
- } else {
- scope_namespace = EG(active_namespace);
- }
-
- while (ptr->fname) {
- internal_function->handler = ptr->handler;
- internal_function->arg_types = ptr->func_arg_types;
- internal_function->function_name = ptr->fname;
- internal_function->scope = scope;
- internal_function->fn_flags = ZEND_ACC_PUBLIC;
- internal_function->ns = scope_namespace;
- internal_function->prototype = NULL;
- if (!internal_function->handler) {
- zend_error(error_type, "Null function defined as active function");
- zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
- return FAILURE;
- }
- fname_len = strlen(ptr->fname);
- lowercase_name = do_alloca(fname_len+1);
- memcpy(lowercase_name, ptr->fname, fname_len+1);
- zend_str_tolower(lowercase_name, fname_len);
- if (zend_hash_add(target_function_table, lowercase_name, fname_len+1, &function, sizeof(zend_function), (void**)&reg_function) == FAILURE) {
- unload=1;
- free_alloca(lowercase_name);
- break;
- }
- if (scope) {
- if (is_namespace) {
- /* if namespace all methods must be "static final" */
- reg_function->common.fn_flags = ZEND_ACC_FINAL | ZEND_ACC_STATIC;
- } else {
- /* if class not namespace then look for ctor, dtor, clone
- * If it's an old-style constructor, store it only if we don't have
- * a constructor already.
- */
- if (!strcmp(ptr->fname, scope->name) && !ctor) {
- ctor = reg_function;
- } else if (!strcmp(ptr->fname, ZEND_CONSTRUCTOR_FUNC_NAME)) {
- ctor = reg_function;
- } else if (!strcmp(ptr->fname, ZEND_DESTRUCTOR_FUNC_NAME)) {
- dtor = reg_function;
- } else if (!strcmp(ptr->fname, ZEND_CLONE_FUNC_NAME)) {
- clone = reg_function;
- }
- }
- }
- ptr++;
- count++;
- free_alloca(lowercase_name);
- }
- if (unload) { /* before unloading, display all remaining bad function in the module */
- while (ptr->fname) {
- if (zend_hash_exists(target_function_table, ptr->fname, strlen(ptr->fname)+1)) {
- zend_error(error_type, "Function registration failed - duplicate name - %s", ptr->fname);
- }
- ptr++;
- }
- zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
- return FAILURE;
- }
- if (scope) {
- scope->constructor = ctor;
- scope->destructor = dtor;
- scope->clone = clone;
- }
- return SUCCESS;
-}
-
-/* count=-1 means erase all functions, otherwise,
- * erase the first count functions
- */
-void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC)
-{
- zend_function_entry *ptr = functions;
- int i=0;
- HashTable *target_function_table = function_table;
-
- if (!target_function_table) {
- target_function_table = CG(function_table);
- }
- while (ptr->fname) {
- if (count!=-1 && i>=count) {
- break;
- }
-#if 0
- zend_printf("Unregistering %s()\n", ptr->fname);
-#endif
- zend_hash_del(target_function_table, ptr->fname, strlen(ptr->fname)+1);
- ptr++;
- i++;
- }
-}
-
-
-ZEND_API int zend_register_module(zend_module_entry *module)
-{
- TSRMLS_FETCH();
-
-#if 0
- zend_printf("%s: Registering module %d\n", module->name, module->module_number);
-#endif
- if (module->functions && zend_register_functions(NULL, module->functions, NULL, module->type TSRMLS_CC)==FAILURE) {
- zend_error(E_CORE_WARNING,"%s: Unable to register functions, unable to load", module->name);
- return FAILURE;
- }
- module->module_started=1;
- return zend_hash_add(&module_registry, module->name, strlen(module->name)+1, (void *)module, sizeof(zend_module_entry), NULL);
-}
-
-
-void module_destructor(zend_module_entry *module)
-{
- TSRMLS_FETCH();
-
- if (module->type == MODULE_TEMPORARY) {
- zend_clean_module_rsrc_dtors(module->module_number TSRMLS_CC);
- clean_module_constants(module->module_number TSRMLS_CC);
- if (module->request_shutdown_func)
- module->request_shutdown_func(module->type, module->module_number TSRMLS_CC);
- }
-
- if (module->module_started && module->module_shutdown_func) {
-#if 0
- zend_printf("%s: Module shutdown\n", module->name);
-#endif
- module->module_shutdown_func(module->type, module->module_number TSRMLS_CC);
- }
- module->module_started=0;
- if (module->functions) {
- zend_unregister_functions(module->functions, -1, NULL TSRMLS_CC);
- }
-
-#if HAVE_LIBDL
- if (module->handle) {
- dlclose(module->handle);
- }
-#endif
-}
-
-
-/* call request startup for all modules */
-int module_registry_request_startup(zend_module_entry *module TSRMLS_DC)
-{
- if (module->request_startup_func) {
-#if 0
- zend_printf("%s: Request startup\n", module->name);
-#endif
- if (module->request_startup_func(module->type, module->module_number TSRMLS_CC)==FAILURE) {
- zend_error(E_WARNING, "request_startup() for %s module failed", module->name);
- exit(1);
- }
- }
- return 0;
-}
-
-
-/* for persistent modules - call request shutdown and flag NOT to erase
- * for temporary modules - do nothing, and flag to erase
- */
-int module_registry_cleanup(zend_module_entry *module TSRMLS_DC)
-{
- switch (module->type) {
- case MODULE_PERSISTENT:
- if (module->request_shutdown_func) {
-#if 0
- zend_printf("%s: Request shutdown\n", module->name);
-#endif
- module->request_shutdown_func(module->type, module->module_number TSRMLS_CC);
- }
- return 0;
- break;
- case MODULE_TEMPORARY:
- return 1;
- break;
- }
- return 0;
-}
-
-
-/* return the next free module number */
-int zend_next_free_module(void)
-{
- return ++module_count;
-}
-
-/* If parent_ce is not NULL then it inherits from parent_ce
- * If parent_ce is NULL and parent_name isn't then it looks for the parent and inherits from it
- * If both parent_ce and parent_name are NULL it does a regular class registration
- * If parent_name is specified but not found NULL is returned
- */
-ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC)
-{
- zend_class_entry *register_class;
-
- if (!parent_ce && parent_name) {
- zend_class_entry **pce;
- if (zend_hash_find(CG(class_table), parent_name, strlen(parent_name)+1, (void **) &pce)==FAILURE) {
- return NULL;
- } else {
- parent_ce = *pce;
- }
- }
-
- register_class = zend_register_internal_class(class_entry TSRMLS_CC);
-
- if (parent_ce) {
- zend_do_inheritance(register_class, parent_ce);
- }
- return register_class;
-}
-
-ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *orig_class_entry TSRMLS_DC)
-{
- zend_class_entry *class_entry = malloc(sizeof(zend_class_entry));
- char *lowercase_name = zend_strndup(orig_class_entry->name, orig_class_entry->name_length);
- *class_entry = *orig_class_entry;
-
- class_entry->type = ZEND_INTERNAL_CLASS;
- zend_initialize_class_data(class_entry, 0 TSRMLS_CC);
-
- if (class_entry->builtin_functions) {
- zend_register_functions(class_entry, class_entry->builtin_functions, &class_entry->function_table, MODULE_PERSISTENT TSRMLS_CC);
- }
-
- zend_str_tolower(lowercase_name, class_entry->name_length);
- zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, &class_entry, sizeof(zend_class_entry *), NULL);
- free(lowercase_name);
- return class_entry;
-}
-
-ZEND_API zend_class_entry *zend_register_internal_ns_class(zend_class_entry *class_entry, zend_class_entry *parent_ce, zend_namespace *ns, char *ns_name TSRMLS_DC)
-{
- zend_class_entry *register_class;
- zend_namespace *orig_namespace = NULL;
- HashTable *orig_class_table = NULL;
- int restore_orig = 0;
-
- if (!ns && ns_name) {
- zend_namespace **pns;
- size_t ns_name_length = strlen(ns_name);
- char *lowercase_name = zend_strndup(ns_name, ns_name_length);
- zend_str_tolower(lowercase_name, ns_name_length);
- if (zend_hash_find(&CG(global_namespace).class_table, lowercase_name, ns_name_length+1, (void **)&pns) == FAILURE) {
- free(lowercase_name);
- return NULL;
- } else {
- ns = *pns;
- }
- free(lowercase_name);
- }
-
- if (EG(active_namespace) != ns) {
- restore_orig = 1;
- orig_namespace = CG(active_namespace);
- CG(active_namespace) = ns;
- orig_class_table = CG(class_table);
- CG(class_table) = &ns->class_table;
- }
- class_entry->ns = ns;
- register_class = zend_register_internal_class_ex(class_entry, parent_ce, NULL TSRMLS_CC);
- if (restore_orig) {
- CG(active_namespace) = orig_namespace;
- CG(class_table) = orig_class_table;
- }
-
- return register_class;
-}
-
-ZEND_API zend_namespace *zend_register_internal_namespace(zend_namespace *orig_ns TSRMLS_DC)
-{
- zend_namespace *ns = malloc(sizeof(zend_namespace));
- char *lowercase_name = zend_strndup(orig_ns->name, orig_ns->name_length);
- *ns = *orig_ns;
-
- ns->type = ZEND_INTERNAL_NAMESPACE;
- zend_init_namespace(ns TSRMLS_CC);
-
- zend_str_tolower(lowercase_name, ns->name_length);
- zend_hash_update(&CG(global_namespace).class_table, lowercase_name, ns->name_length+1, &ns, sizeof(zend_namespace *), NULL);
- free(lowercase_name);
-
- if (ns->builtin_functions) {
- zend_register_functions(ns, ns->builtin_functions, &ns->function_table, MODULE_PERSISTENT TSRMLS_CC);
- }
-
- return ns;
-}
-
-ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
- zend_bool is_ref, int num_symbol_tables, ...)
-{
- HashTable *symbol_table;
- va_list symbol_table_list;
-
- if (num_symbol_tables <= 0) return FAILURE;
-
- symbol->is_ref = is_ref;
-
- va_start(symbol_table_list, num_symbol_tables);
- while (num_symbol_tables-- > 0) {
- symbol_table = va_arg(symbol_table_list, HashTable *);
- zend_hash_update(symbol_table, name, name_length + 1, &symbol, sizeof(zval *), NULL);
- zval_add_ref(&symbol);
- }
- va_end(symbol_table_list);
- return SUCCESS;
-}
-
-
-
-
-/* Disabled functions support */
-
-ZEND_API ZEND_FUNCTION(display_disabled_function)
-{
- zend_error(E_WARNING, "%s() has been disabled for security reasons", get_active_function_name(TSRMLS_C));
-}
-
-
-static zend_function_entry disabled_function[] = {
- ZEND_FE(display_disabled_function, NULL)
- { NULL, NULL, NULL }
-};
-
-
-ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC)
-{
- if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) {
- return FAILURE;
- }
- disabled_function[0].fname = function_name;
- return zend_register_functions(NULL, disabled_function, CG(function_table), MODULE_PERSISTENT TSRMLS_CC);
-}
-
-static zend_object_value display_disabled_class(zend_class_entry *class_type TSRMLS_DC)
-{
- zend_object_value retval;
- zend_object *intern;
- retval = zend_objects_new(&intern, class_type TSRMLS_CC);
- ALLOC_HASHTABLE(intern->properties);
- zend_hash_init(intern->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_error(E_WARNING, "%s() has been disabled for security reasons", class_type->name);
- return retval;
-}
-
-static zend_function_entry disabled_class_new[] = {
- { NULL, NULL, NULL }
-};
-
-ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC)
-{
- zend_class_entry *disabled_class;
- disabled_class = (zend_class_entry *) emalloc(sizeof(zend_class_entry));
-
- zend_str_tolower(class_name, class_name_length);
- if (zend_hash_del(CG(class_table), class_name, class_name_length+1)==FAILURE) {
- return FAILURE;
- }
- INIT_CLASS_ENTRY((*disabled_class), class_name, disabled_class_new);
- disabled_class->create_object = display_disabled_class;
- zend_register_internal_class(disabled_class TSRMLS_CC);
- return 1;
-}
-
-zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name)
-{
- char *lcname;
- zend_bool retval = 0;
- TSRMLS_FETCH();
-
- switch (Z_TYPE_P(callable)) {
- case IS_STRING:
- if (callable_name)
- *callable_name = estrndup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
-
- if (syntax_only)
- return 1;
-
- lcname = estrndup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
- zend_str_tolower(lcname, Z_STRLEN_P(callable));
- if (zend_hash_exists(EG(function_table), lcname, Z_STRLEN_P(callable)+1))
- retval = 1;
- efree(lcname);
- break;
-
- case IS_ARRAY:
- {
- zval **method;
- zval **obj;
- zend_class_entry *ce = NULL, **pce;
- zend_uint callable_name_len;
-
- if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2 &&
- zend_hash_index_find(Z_ARRVAL_P(callable), 0, (void **) &obj) == SUCCESS &&
- zend_hash_index_find(Z_ARRVAL_P(callable), 1, (void **) &method) == SUCCESS &&
- (Z_TYPE_PP(obj) == IS_OBJECT || Z_TYPE_PP(obj) == IS_STRING) &&
- Z_TYPE_PP(method) == IS_STRING) {
-
- if (Z_TYPE_PP(obj) == IS_STRING) {
- if (callable_name) {
- char *ptr;
-
- callable_name_len = Z_STRLEN_PP(obj) + Z_STRLEN_PP(method) + sizeof("::");
- ptr = *callable_name = emalloc(callable_name_len);
- memcpy(ptr, Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
- ptr += Z_STRLEN_PP(obj);
- memcpy(ptr, "::", sizeof("::") - 1);
- ptr += sizeof("::") - 1;
- memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
- }
-
- if (syntax_only)
- return 1;
-
- lcname = estrndup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
- zend_str_tolower(lcname, Z_STRLEN_PP(obj));
- if (zend_lookup_class(lcname, Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
- ce = *pce;
- }
-
- efree(lcname);
- } else {
- ce = Z_OBJCE_PP(obj); /* ??? */
-
- if (callable_name) {
- char *ptr;
-
- callable_name_len = ce->name_length + Z_STRLEN_PP(method) + sizeof("::");
- ptr = *callable_name = emalloc(callable_name_len);
- memcpy(ptr, ce->name, ce->name_length);
- ptr += ce->name_length;
- memcpy(ptr, "::", sizeof("::") - 1);
- ptr += sizeof("::") - 1;
- memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
- }
-
- if (syntax_only)
- return 1;
- }
-
- if (ce) {
- lcname = estrndup(Z_STRVAL_PP(method), Z_STRLEN_PP(method));
- zend_str_tolower(lcname, Z_STRLEN_PP(method));
- if (zend_hash_exists(&ce->function_table, lcname, Z_STRLEN_PP(method)+1))
- retval = 1;
- efree(lcname);
- }
- } else if (callable_name)
- *callable_name = estrndup("Array", sizeof("Array")-1);
- }
- break;
-
- default:
- if (callable_name) {
- zval expr_copy;
- int use_copy;
-
- zend_make_printable_zval(callable, &expr_copy, &use_copy);
- *callable_name = estrndup(Z_STRVAL(expr_copy), Z_STRLEN(expr_copy));
- zval_dtor(&expr_copy);
- }
- break;
- }
-
- return retval;
-}
-
-ZEND_API char *zend_get_module_version(char *module_name)
-{
- zend_module_entry *module;
-
- if (zend_hash_find(&module_registry, module_name, strlen(module_name) + 1,
- (void**)&module) == FAILURE) {
- return NULL;
- }
- return module->version;
-}
-
-ZEND_API void zend_make_full_classname(zend_class_entry *ce, char **name, zend_uint *name_len)
-{
- int len = ce->name_length;
- char *full_name;
-
- if(ce->ns && ce->ns->name) {
- len += ce->ns->name_length + 2;
- }
-
- *name = full_name = emalloc(len+1);
- *name_len = len;
-
- if(ce->ns && ce->ns->name) {
- memcpy(full_name, ce->ns->name, ce->ns->name_length);
- full_name += ce->ns->name_length;
- *(full_name++) = ':';
- *(full_name++) = ':';
- }
-
- memcpy(full_name, ce->name, ce->name_length);
- full_name[ce->name_length] = '\0';
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
deleted file mode 100644
index d8ebb20ac8..0000000000
--- a/Zend/zend_API.h
+++ /dev/null
@@ -1,447 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Andrei Zmievski <andrei@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_API_H
-#define ZEND_API_H
-
-#include "zend_modules.h"
-#include "zend_list.h"
-#include "zend_fast_cache.h"
-#include "zend_operators.h"
-#include "zend_variables.h"
-#include "zend_execute.h"
-
-
-BEGIN_EXTERN_C()
-#define ZEND_FN(name) zif_##name
-#define ZEND_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
-#define ZEND_FUNCTION(name) ZEND_NAMED_FUNCTION(ZEND_FN(name))
-#define ZEND_METHOD(class, name) ZEND_NAMED_FUNCTION(ZEND_FN(class##_##name))
-
-#define ZEND_NAMED_FE(zend_name, name, arg_types) { #zend_name, name, arg_types },
-#define ZEND_FE(name, arg_types) ZEND_NAMED_FE(name, ZEND_FN(name), arg_types)
-#define ZEND_FALIAS(name, alias, arg_types) ZEND_NAMED_FE(name, ZEND_FN(alias), arg_types)
-#define ZEND_STATIC_FE(name, impl_name, arg_types) { name, impl_name, arg_types },
-#define ZEND_ME(class, name, arg_types) ZEND_NAMED_FE(name, ZEND_FN(class##_##name), arg_types)
-
-/* Name macros */
-#define ZEND_MODULE_STARTUP_N(module) zm_startup_##module
-#define ZEND_MODULE_SHUTDOWN_N(module) zm_shutdown_##module
-#define ZEND_MODULE_ACTIVATE_N(module) zm_activate_##module
-#define ZEND_MODULE_DEACTIVATE_N(module) zm_deactivate_##module
-#define ZEND_MODULE_INFO_N(module) zm_info_##module
-
-/* Declaration macros */
-#define ZEND_MODULE_STARTUP_D(module) int ZEND_MODULE_STARTUP_N(module)(INIT_FUNC_ARGS)
-#define ZEND_MODULE_SHUTDOWN_D(module) int ZEND_MODULE_SHUTDOWN_N(module)(SHUTDOWN_FUNC_ARGS)
-#define ZEND_MODULE_ACTIVATE_D(module) int ZEND_MODULE_ACTIVATE_N(module)(INIT_FUNC_ARGS)
-#define ZEND_MODULE_DEACTIVATE_D(module) int ZEND_MODULE_DEACTIVATE_N(module)(SHUTDOWN_FUNC_ARGS)
-#define ZEND_MODULE_INFO_D(module) void ZEND_MODULE_INFO_N(module)(ZEND_MODULE_INFO_FUNC_ARGS)
-
-#define ZEND_GET_MODULE(name) \
- ZEND_DLEXPORT zend_module_entry *get_module(void) { return &name##_module_entry; }
-
-#define ZEND_BEGIN_MODULE_GLOBALS(module_name) \
- typedef struct _zend_##module_name##_globals {
-#define ZEND_END_MODULE_GLOBALS(module_name) \
- } zend_##module_name##_globals;
-
-#ifdef ZTS
-
-#define ZEND_DECLARE_MODULE_GLOBALS(module_name) \
- ts_rsrc_id module_name##_globals_id;
-#define ZEND_EXTERN_MODULE_GLOBALS(module_name) \
- extern ts_rsrc_id module_name##_globals_id;
-#define ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \
- ts_allocate_id(&module_name##_globals_id, sizeof(zend_##module_name##_globals), (ts_allocate_ctor) globals_ctor, (ts_allocate_dtor) globals_dtor);
-
-#else
-
-#define ZEND_DECLARE_MODULE_GLOBALS(module_name) \
- zend_##module_name##_globals module_name##_globals;
-#define ZEND_EXTERN_MODULE_GLOBALS(module_name) \
- extern zend_##module_name##_globals module_name##_globals;
-#define ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \
- globals_ctor(&module_name##_globals);
-
-#endif
-
-
-
-#define INIT_CLASS_ENTRY(class_container, class_name, functions) INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, NULL, NULL, NULL)
-
-#define INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset) \
- { \
- class_container.name = strdup(class_name); \
- class_container.name_length = strlen(class_name); \
- class_container.builtin_functions = functions; \
- class_container.constructor = NULL; \
- class_container.destructor = NULL; \
- class_container.clone = NULL; \
- class_container.create_object = NULL; \
- class_container.__call = handle_fcall; \
- class_container.__get = handle_propget; \
- class_container.__set = handle_propset; \
- class_container.num_interfaces = 0; \
- }
-
-#define INIT_NAMESPACE(ns_container, ns_name) INIT_CLASS_ENTRY(ns_container, ns_name, NULL)
-
-#define INIT_NAMESPACE_WITH_FUNCS(ns_container, ns_name, functions) INIT_CLASS_ENTRY(ns_container, ns_name, functions)
-
-
-int zend_next_free_module(void);
-
-ZEND_API int zend_get_parameters(int ht, int param_count, ...);
-ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument_array TSRMLS_DC);
-ZEND_API int zend_get_parameters_ex(int param_count, ...);
-ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_array TSRMLS_DC);
-
-#define zend_get_parameters_array(ht, param_count, argument_array) \
- _zend_get_parameters_array(ht, param_count, argument_array TSRMLS_CC)
-#define zend_get_parameters_array_ex(param_count, argument_array) \
- _zend_get_parameters_array_ex(param_count, argument_array TSRMLS_CC)
-
-
-/* Parameter parsing API -- andrei */
-
-#define ZEND_PARSE_PARAMS_QUIET 1<<1
-ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...);
-ZEND_API int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...);
-ZEND_API char *zend_zval_type_name(zval *arg);
-
-ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, ...);
-ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, zend_class_entry *ce, void **object, ...);
-
-/* End of parameter parsing API -- andrei */
-
-int zend_register_functions(zend_class_entry *scope, zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC);
-void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC);
-ZEND_API int zend_register_module(zend_module_entry *module_entry);
-
-ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry TSRMLS_DC);
-ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC);
-ZEND_API zend_class_entry *zend_register_internal_ns_class(zend_class_entry *class_entry, zend_class_entry *parent_ce, zend_namespace *ns, char *ns_name TSRMLS_DC);
-ZEND_API zend_namespace *zend_register_internal_namespace(zend_namespace *ns TSRMLS_DC);
-
-ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC);
-ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC);
-
-ZEND_API void zend_wrong_param_count(TSRMLS_D);
-ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name);
-ZEND_API char *zend_get_module_version(char *module_name);
-
-ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC);
-
-#define getThis() (this_ptr)
-
-#define WRONG_PARAM_COUNT ZEND_WRONG_PARAM_COUNT()
-#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret)
-#define ARG_COUNT(dummy) (ht)
-#define ZEND_NUM_ARGS() (ht)
-#define ZEND_WRONG_PARAM_COUNT() { zend_wrong_param_count(TSRMLS_C); return; }
-#define ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret) { zend_wrong_param_count(TSRMLS_C); return ret; }
-
-#ifndef ZEND_WIN32
-#define DLEXPORT
-#endif
-
-ZEND_API int zend_startup_module(zend_module_entry *module);
-
-#define array_init(arg) _array_init((arg) ZEND_FILE_LINE_CC)
-#define object_init(arg) _object_init((arg) ZEND_FILE_LINE_CC TSRMLS_CC)
-#define object_init_ex(arg, ce) _object_init_ex((arg), (ce) ZEND_FILE_LINE_CC TSRMLS_CC)
-#define object_and_properties_init(arg, ce, properties) _object_and_properties_init((arg), (ce), (properties) ZEND_FILE_LINE_CC TSRMLS_CC)
-ZEND_API int _array_init(zval *arg ZEND_FILE_LINE_DC);
-ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC);
-ZEND_API int _object_init_ex(zval *arg, zend_class_entry *ce ZEND_FILE_LINE_DC TSRMLS_DC);
-ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC);
-
-/* no longer supported */
-ZEND_API int add_assoc_function(zval *arg, char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS));
-
-ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n);
-ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len);
-ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b);
-ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r);
-ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d);
-ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate);
-ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate);
-ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value);
-
-#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n)
-#define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
-#define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key)+1, __b)
-#define add_assoc_resource(__arg, __key, __r) add_assoc_resource_ex(__arg, __key, strlen(__key)+1, __r)
-#define add_assoc_double(__arg, __key, __d) add_assoc_double_ex(__arg, __key, strlen(__key)+1, __d)
-#define add_assoc_string(__arg, __key, __str, __duplicate) add_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
-#define add_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
-#define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key)+1, __value)
-
-/* unset() functions are only suported for legacy modules and null() functions should be used */
-#define add_assoc_unset(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
-#define add_index_unset(__arg, __key) add_index_null(__arg, __key)
-#define add_next_index_unset(__arg) add_next_index_null(__arg)
-#define add_property_unset(__arg, __key) add_property_null(__arg, __key)
-
-ZEND_API int add_index_long(zval *arg, uint idx, long n);
-ZEND_API int add_index_null(zval *arg, uint idx);
-ZEND_API int add_index_bool(zval *arg, uint idx, int b);
-ZEND_API int add_index_resource(zval *arg, uint idx, int r);
-ZEND_API int add_index_double(zval *arg, uint idx, double d);
-ZEND_API int add_index_string(zval *arg, uint idx, char *str, int duplicate);
-ZEND_API int add_index_stringl(zval *arg, uint idx, char *str, uint length, int duplicate);
-ZEND_API int add_index_zval(zval *arg, uint index, zval *value);
-
-ZEND_API int add_next_index_long(zval *arg, long n);
-ZEND_API int add_next_index_null(zval *arg);
-ZEND_API int add_next_index_bool(zval *arg, int b);
-ZEND_API int add_next_index_resource(zval *arg, int r);
-ZEND_API int add_next_index_double(zval *arg, double d);
-ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate);
-ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate);
-ZEND_API int add_next_index_zval(zval *arg, zval *value);
-
-ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, void **dest, int duplicate);
-ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, void **dest, int duplicate);
-
-#define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate)
-#define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate)
-
-ZEND_API int add_get_index_long(zval *arg, uint idx, long l, void **dest);
-ZEND_API int add_get_index_double(zval *arg, uint idx, double d, void **dest);
-ZEND_API int add_get_index_string(zval *arg, uint idx, char *str, void **dest, int duplicate);
-ZEND_API int add_get_index_stringl(zval *arg, uint idx, char *str, uint length, void **dest, int duplicate);
-
-ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long l TSRMLS_DC);
-ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC);
-ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b TSRMLS_DC);
-ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long r TSRMLS_DC);
-ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d TSRMLS_DC);
-ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC);
-ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC);
-ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value TSRMLS_DC);
-
-#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n TSRMLS_CC)
-#define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1 TSRMLS_CC)
-#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key)+1, __b TSRMLS_CC)
-#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key)+1, __r TSRMLS_CC)
-#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key)+1, __d TSRMLS_CC)
-#define add_property_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC)
-#define add_property_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC)
-#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key)+1, __value TSRMLS_CC)
-
-ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[] TSRMLS_DC);
-ZEND_API int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, int param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC);
-
-ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
- zend_bool is_ref, int num_symbol_tables, ...);
-
-#define add_method(arg, key, method) add_assoc_function((arg), (key), (method))
-
-ZEND_API ZEND_FUNCTION(display_disabled_function);
-ZEND_API ZEND_FUNCTION(display_disabled_class);
-
-ZEND_API void zend_make_full_classname(zend_class_entry *ce, char **name, zend_uint *name_len);
-
-#if ZEND_DEBUG
-#define CHECK_ZVAL_STRING(z) \
- if ((z)->value.str.val[ (z)->value.str.len ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", (z)->value.str.val); }
-#define CHECK_ZVAL_STRING_REL(z) \
- if ((z)->value.str.val[ (z)->value.str.len ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", (z)->value.str.val ZEND_FILE_LINE_RELAY_CC); }
-#else
-#define CHECK_ZVAL_STRING(z)
-#define CHECK_ZVAL_STRING_REL(z)
-#endif
-
-#define ZVAL_RESOURCE(z, l) { \
- (z)->type = IS_RESOURCE; \
- (z)->value.lval = l; \
- }
-
-#define ZVAL_BOOL(z, b) { \
- (z)->type = IS_BOOL; \
- (z)->value.lval = b; \
- }
-
-#define ZVAL_NULL(z) { \
- (z)->type = IS_NULL; \
- }
-
-#define ZVAL_LONG(z, l) { \
- (z)->type = IS_LONG; \
- (z)->value.lval = l; \
- }
-
-#define ZVAL_DOUBLE(z, d) { \
- (z)->type = IS_DOUBLE; \
- (z)->value.dval = d; \
- }
-
-#define ZVAL_STRING(z, s, duplicate) { \
- char *__s=(s); \
- (z)->value.str.len = strlen(__s); \
- (z)->value.str.val = (duplicate?estrndup(__s, (z)->value.str.len):__s); \
- (z)->type = IS_STRING; \
- }
-
-#define ZVAL_STRINGL(z, s, l, duplicate) { \
- char *__s=(s); int __l=l; \
- (z)->value.str.len = __l; \
- (z)->value.str.val = (duplicate?estrndup(__s, __l):__s); \
- (z)->type = IS_STRING; \
- }
-
-#define ZVAL_EMPTY_STRING(z) { \
- (z)->value.str.len = 0; \
- (z)->value.str.val = empty_string; \
- (z)->type = IS_STRING; \
- }
-
-#define ZVAL_FALSE(z) ZVAL_BOOL(z, 0)
-#define ZVAL_TRUE(z) ZVAL_BOOL(z, 1)
-
-#define RETVAL_RESOURCE(l) ZVAL_RESOURCE(return_value, l)
-#define RETVAL_BOOL(b) ZVAL_BOOL(return_value, b)
-#define RETVAL_NULL() ZVAL_NULL(return_value)
-#define RETVAL_LONG(l) ZVAL_LONG(return_value, l)
-#define RETVAL_DOUBLE(d) ZVAL_DOUBLE(return_value, d)
-#define RETVAL_STRING(s, duplicate) ZVAL_STRING(return_value, s, duplicate)
-#define RETVAL_STRINGL(s, l, duplicate) ZVAL_STRINGL(return_value, s, l, duplicate)
-#define RETVAL_EMPTY_STRING() ZVAL_EMPTY_STRING(return_value)
-#define RETVAL_FALSE ZVAL_BOOL(return_value, 0)
-#define RETVAL_TRUE ZVAL_BOOL(return_value, 1)
-
-#define RETURN_RESOURCE(l) { RETVAL_RESOURCE(l); return; }
-#define RETURN_BOOL(b) { RETVAL_BOOL(b); return; }
-#define RETURN_NULL() { RETVAL_NULL(); return;}
-#define RETURN_LONG(l) { RETVAL_LONG(l); return; }
-#define RETURN_DOUBLE(d) { RETVAL_DOUBLE(d); return; }
-#define RETURN_STRING(s, duplicate) { RETVAL_STRING(s, duplicate); return; }
-#define RETURN_STRINGL(s, l, duplicate) { RETVAL_STRINGL(s, l, duplicate); return; }
-#define RETURN_EMPTY_STRING() { RETVAL_EMPTY_STRING(); return; }
-#define RETURN_FALSE { RETVAL_FALSE; return; }
-#define RETURN_TRUE { RETVAL_TRUE; return; }
-
-#define SET_VAR_STRING(n, v) { \
- { \
- zval *var; \
- ALLOC_ZVAL(var); \
- ZVAL_STRING(var, v, 0); \
- ZEND_SET_GLOBAL_VAR(n, var); \
- } \
- }
-
-#define SET_VAR_STRINGL(n, v, l) { \
- { \
- zval *var; \
- ALLOC_ZVAL(var); \
- ZVAL_STRINGL(var, v, l, 0); \
- ZEND_SET_GLOBAL_VAR(n, var); \
- } \
- }
-
-#define SET_VAR_LONG(n, v) { \
- { \
- zval *var; \
- ALLOC_ZVAL(var); \
- ZVAL_LONG(var, v); \
- ZEND_SET_GLOBAL_VAR(n, var); \
- } \
- }
-
-#define SET_VAR_DOUBLE(n, v) { \
- { \
- zval *var; \
- ALLOC_ZVAL(var); \
- ZVAL_DOUBLE(var, v); \
- ZEND_SET_GLOBAL_VAR(n, var); \
- } \
- }
-
-
-#define ZEND_SET_SYMBOL(symtable, name, var) \
- { \
- char *_name = (name); \
- \
- ZEND_SET_SYMBOL_WITH_LENGTH(symtable, _name, strlen(_name)+1, var, 1, 0); \
- }
-
-#define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, name_length, var, _refcount, _is_ref) \
- { \
- zval **orig_var; \
- \
- if (zend_hash_find(symtable, (name), (name_length), (void **) &orig_var)==SUCCESS \
- && PZVAL_IS_REF(*orig_var)) { \
- (var)->refcount = (*orig_var)->refcount; \
- (var)->is_ref = 1; \
- \
- if (_refcount) { \
- (var)->refcount += _refcount-1; \
- } \
- zval_dtor(*orig_var); \
- **orig_var = *(var); \
- FREE_ZVAL(var); \
- } else { \
- (var)->is_ref = _is_ref; \
- if (_refcount) { \
- (var)->refcount = _refcount; \
- } \
- zend_hash_update(symtable, (name), (name_length), &(var), sizeof(zval *), NULL); \
- } \
- }
-
-
-#define ZEND_SET_GLOBAL_VAR(name, var) \
- ZEND_SET_SYMBOL(&EG(symbol_table), name, var)
-
-#define ZEND_SET_GLOBAL_VAR_WITH_LENGTH(name, name_length, var, _refcount, _is_ref) \
- ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table), name, name_length, var, _refcount, _is_ref)
-
-#define HASH_OF(p) ((p)->type==IS_ARRAY ? (p)->value.ht : (((p)->type==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p) TSRMLS_CC) : NULL)))
-#define ZVAL_IS_NULL(z) ((z)->type==IS_NULL)
-
-/* For compatibility */
-#define ZEND_MINIT ZEND_MODULE_STARTUP_N
-#define ZEND_MSHUTDOWN ZEND_MODULE_SHUTDOWN_N
-#define ZEND_RINIT ZEND_MODULE_ACTIVATE_N
-#define ZEND_RSHUTDOWN ZEND_MODULE_DEACTIVATE_N
-#define ZEND_MINFO ZEND_MODULE_INFO_N
-
-#define ZEND_MINIT_FUNCTION ZEND_MODULE_STARTUP_D
-#define ZEND_MSHUTDOWN_FUNCTION ZEND_MODULE_SHUTDOWN_D
-#define ZEND_RINIT_FUNCTION ZEND_MODULE_ACTIVATE_D
-#define ZEND_RSHUTDOWN_FUNCTION ZEND_MODULE_DEACTIVATE_D
-#define ZEND_MINFO_FUNCTION ZEND_MODULE_INFO_D
-
-END_EXTERN_C()
-
-#endif /* ZEND_API_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
deleted file mode 100644
index 9df3fe7888..0000000000
--- a/Zend/zend_alloc.c
+++ /dev/null
@@ -1,787 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_alloc.h"
-#include "zend_globals.h"
-#include "zend_fast_cache.h"
-#ifdef HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#include "zend_mm.h"
-
-#ifndef ZTS
-ZEND_API zend_alloc_globals alloc_globals;
-#endif
-
-
-#ifdef ZEND_MM
-#define ZEND_DISABLE_MEMORY_CACHE 1
-#else
-#define ZEND_DISABLE_MEMORY_CACHE 0
-#endif
-
-#ifdef ZEND_MM
-#define ZEND_DO_MALLOC(size) zend_mm_alloc(&AG(mm_heap), size)
-#define ZEND_DO_FREE(ptr) zend_mm_free(&AG(mm_heap), ptr)
-#define ZEND_DO_REALLOC(ptr, size) zend_mm_realloc(&AG(mm_heap), ptr, size)
-#elif defined(ZEND_WIN32)
-#define ZEND_DO_MALLOC(size) (AG(memory_heap) ? HeapAlloc(AG(memory_heap), HEAP_NO_SERIALIZE, size) : malloc(size))
-#define ZEND_DO_FREE(ptr) (AG(memory_heap) ? HeapFree(AG(memory_heap), HEAP_NO_SERIALIZE, ptr) : free(ptr))
-#define ZEND_DO_REALLOC(ptr, size) (AG(memory_heap) ? HeapReAlloc(AG(memory_heap), HEAP_NO_SERIALIZE, ptr, size) : realloc(ptr, size))
-#else
-#define ZEND_DO_MALLOC(size) malloc(size)
-#define ZEND_DO_FREE(ptr) free(ptr)
-#define ZEND_DO_REALLOC(ptr, size) realloc(ptr, size)
-#endif
-
-#if ZEND_DEBUG
-# define END_MAGIC_SIZE sizeof(long)
-static long mem_block_end_magic = MEM_BLOCK_END_MAGIC;
-#else
-# define END_MAGIC_SIZE 0
-#endif
-
-
-# if MEMORY_LIMIT
-# if ZEND_DEBUG
-#define CHECK_MEMORY_LIMIT(s, rs) _CHECK_MEMORY_LIMIT(s, rs, __zend_filename, __zend_lineno)
-# else
-#define CHECK_MEMORY_LIMIT(s, rs) _CHECK_MEMORY_LIMIT(s, rs, NULL, 0)
-# endif
-
-#define _CHECK_MEMORY_LIMIT(s, rs, file, lineno) { AG(allocated_memory) += rs;\
- if (AG(memory_limit)<AG(allocated_memory)) {\
- int php_mem_limit = AG(memory_limit); \
- if (AG(memory_limit)+1048576 > AG(allocated_memory) - rs) { \
- AG(memory_limit) = AG(allocated_memory) + 1048576; \
- if (file) { \
- zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted (tried to allocate %d bytes)", php_mem_limit, s); \
- } else { \
- zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)", php_mem_limit, file, lineno, s); \
- } \
- } else { \
- if (file) { \
- fprintf(stderr, "Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)\n", php_mem_limit, file, lineno, s); \
- } else { \
- fprintf(stderr, "Allowed memory size of %d bytes exhausted (tried to allocate %d bytes)\n", php_mem_limit, s); \
- } \
- exit(1); \
- } \
- } \
- }
-# endif
-
-#ifndef CHECK_MEMORY_LIMIT
-#define CHECK_MEMORY_LIMIT(s, rs)
-#endif
-
-
-#define REMOVE_POINTER_FROM_LIST(p) \
- if (p==AG(head)) { \
- AG(head) = p->pNext; \
- } else { \
- p->pLast->pNext = p->pNext; \
- } \
- if (p->pNext) { \
- p->pNext->pLast = p->pLast; \
- }
-
-#define ADD_POINTER_TO_LIST(p) \
- p->pNext = AG(head); \
- if (AG(head)) { \
- AG(head)->pLast = p; \
- } \
- AG(head) = p; \
- p->pLast = (zend_mem_header *) NULL;
-
-#define DECLARE_CACHE_VARS() \
- unsigned int real_size; \
- unsigned int cache_index
-
-#define REAL_SIZE(size) ((size+7) & ~0x7)
-
-#define CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size) \
- real_size = REAL_SIZE(size); \
- cache_index = real_size >> 3;
-
-#define SIZE real_size
-
-#define CACHE_INDEX cache_index
-
-ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- zend_mem_header *p;
- DECLARE_CACHE_VARS();
- TSRMLS_FETCH();
-
- CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size);
-
- if (!ZEND_DISABLE_MEMORY_CACHE && (CACHE_INDEX < MAX_CACHED_MEMORY) && (AG(cache_count)[CACHE_INDEX] > 0)) {
- p = AG(cache)[CACHE_INDEX][--AG(cache_count)[CACHE_INDEX]];
-#if ZEND_DEBUG
- p->filename = __zend_filename;
- p->lineno = __zend_lineno;
- p->orig_filename = __zend_orig_filename;
- p->orig_lineno = __zend_orig_lineno;
- p->magic = MEM_BLOCK_START_MAGIC;
- p->reported = 0;
- /* Setting the thread id should not be necessary, because we fetched this block
- * from this thread's cache
- */
- AG(cache_stats)[CACHE_INDEX][1]++;
- memcpy((((char *) p) + sizeof(zend_mem_header) + MEM_HEADER_PADDING + size), &mem_block_end_magic, sizeof(long));
-#endif
- p->cached = 0;
- p->size = size;
- return (void *)((char *)p + sizeof(zend_mem_header) + MEM_HEADER_PADDING);
- } else {
-#if ZEND_DEBUG
- if (CACHE_INDEX<MAX_CACHED_MEMORY) {
- AG(cache_stats)[CACHE_INDEX][0]++;
- }
-#endif
- p = (zend_mem_header *) ZEND_DO_MALLOC(sizeof(zend_mem_header) + MEM_HEADER_PADDING + SIZE + END_MAGIC_SIZE);
- }
-
- HANDLE_BLOCK_INTERRUPTIONS();
-
- if (!p) {
- fprintf(stderr,"FATAL: emalloc(): Unable to allocate %ld bytes\n", (long) size);
-#if ZEND_DEBUG && defined(HAVE_KILL) && defined(HAVE_GETPID)
- kill(getpid(), SIGSEGV);
-#else
- exit(1);
-#endif
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *)p;
- }
- p->cached = 0;
-#if ZEND_DEBUG || !defined(ZEND_MM)
- ADD_POINTER_TO_LIST(p);
-#endif
- p->size = size; /* Save real size for correct cache output */
-#if ZEND_DEBUG
- p->filename = __zend_filename;
- p->lineno = __zend_lineno;
- p->orig_filename = __zend_orig_filename;
- p->orig_lineno = __zend_orig_lineno;
- p->magic = MEM_BLOCK_START_MAGIC;
- p->reported = 0;
-# ifdef ZTS
- p->thread_id = tsrm_thread_id();
-# endif
- memcpy((((char *) p) + sizeof(zend_mem_header) + MEM_HEADER_PADDING + size), &mem_block_end_magic, sizeof(long));
-#endif
-#if MEMORY_LIMIT
- CHECK_MEMORY_LIMIT(size, SIZE);
- if (AG(allocated_memory) > AG(allocated_memory_peak)) {
- AG(allocated_memory_peak) = AG(allocated_memory);
- }
-#endif
-
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *)((char *)p + sizeof(zend_mem_header) + MEM_HEADER_PADDING);
-}
-
-#include "zend_multiply.h"
-
-ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
-
- if (nmemb < LONG_MAX
- && size < LONG_MAX
- && offset < LONG_MAX
- && nmemb >= 0
- && size >= 0
- && offset >= 0) {
- long lval;
- double dval;
- int use_dval;
-
- ZEND_SIGNED_MULTIPLY_LONG(nmemb, size, lval, dval, use_dval);
-
- if (!use_dval
- && lval < LONG_MAX - offset) {
- return emalloc_rel(lval + offset);
- }
- }
-
- zend_error(E_ERROR, "Possible integer overflow in memory allocation (%ld * %ld + %ld)", nmemb, size, offset);
- return 0;
-}
-
-
-
-ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- zend_mem_header *p = (zend_mem_header *) ((char *)ptr - sizeof(zend_mem_header) - MEM_HEADER_PADDING);
- DECLARE_CACHE_VARS();
- TSRMLS_FETCH();
-
-#if defined(ZTS) && TSRM_DEBUG
- if (p->thread_id != tsrm_thread_id()) {
- tsrm_error(TSRM_ERROR_LEVEL_ERROR, "Memory block allocated at %s:(%d) on thread %x freed at %s:(%d) on thread %x, ignoring",
- p->filename, p->lineno, p->thread_id,
- __zend_filename, __zend_lineno, tsrm_thread_id());
- return;
- }
-#endif
-
- CALCULATE_REAL_SIZE_AND_CACHE_INDEX(p->size);
-#if ZEND_DEBUG
- if (!_mem_block_check(ptr, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC)) {
- return;
- }
- memset(ptr, 0x5a, p->size);
-#endif
-
- if (!ZEND_DISABLE_MEMORY_CACHE
- && (CACHE_INDEX < MAX_CACHED_MEMORY) && (AG(cache_count)[CACHE_INDEX] < MAX_CACHED_ENTRIES)) {
- AG(cache)[CACHE_INDEX][AG(cache_count)[CACHE_INDEX]++] = p;
- p->cached = 1;
-#if ZEND_DEBUG
- p->magic = MEM_BLOCK_CACHED_MAGIC;
-#endif
- return;
- }
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG || !defined(ZEND_MM)
- REMOVE_POINTER_FROM_LIST(p);
-#endif
-
-#if MEMORY_LIMIT
- AG(allocated_memory) -= SIZE;
-#endif
-
- ZEND_DO_FREE(p);
- HANDLE_UNBLOCK_INTERRUPTIONS();
-}
-
-
-ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- void *p;
- int final_size = size*nmemb;
-
- HANDLE_BLOCK_INTERRUPTIONS();
- p = _emalloc(final_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- if (!p) {
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *) p;
- }
- memset(p, 0, final_size);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return p;
-}
-
-
-ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- zend_mem_header *p;
- zend_mem_header *orig;
- DECLARE_CACHE_VARS();
- TSRMLS_FETCH();
-
- if (!ptr) {
- return _emalloc(size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
-
- p = orig = (zend_mem_header *) ((char *)ptr-sizeof(zend_mem_header)-MEM_HEADER_PADDING);
-
-#if defined(ZTS) && TSRM_DEBUG
- if (p->thread_id != tsrm_thread_id()) {
- void *new_p;
-
- tsrm_error(TSRM_ERROR_LEVEL_ERROR, "Memory block allocated at %s:(%d) on thread %x reallocated at %s:(%d) on thread %x, duplicating",
- p->filename, p->lineno, p->thread_id,
- __zend_filename, __zend_lineno, tsrm_thread_id());
- new_p = _emalloc(size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- memcpy(new_p, ptr, p->size);
- return new_p;
- }
-#endif
-
- CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size);
-
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG || !defined(ZEND_MM)
- REMOVE_POINTER_FROM_LIST(p);
-#endif
- p = (zend_mem_header *) ZEND_DO_REALLOC(p, sizeof(zend_mem_header)+MEM_HEADER_PADDING+SIZE+END_MAGIC_SIZE);
- if (!p) {
- if (!allow_failure) {
- fprintf(stderr,"FATAL: erealloc(): Unable to allocate %ld bytes\n", (long) size);
-#if ZEND_DEBUG && HAVE_KILL && HAVE_GETPID
- kill(getpid(), SIGSEGV);
-#else
- exit(1);
-#endif
- }
-#if ZEND_DEBUG || !defined(ZEND_MM)
- ADD_POINTER_TO_LIST(orig);
-#endif
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *)NULL;
- }
-#if ZEND_DEBUG || !defined(ZEND_MM)
- ADD_POINTER_TO_LIST(p);
-#endif
-#if ZEND_DEBUG
- p->filename = __zend_filename;
- p->lineno = __zend_lineno;
- p->magic = MEM_BLOCK_START_MAGIC;
- memcpy((((char *) p) + sizeof(zend_mem_header) + MEM_HEADER_PADDING + size), &mem_block_end_magic, sizeof(long));
-#endif
-#if MEMORY_LIMIT
- CHECK_MEMORY_LIMIT(size - p->size, SIZE - REAL_SIZE(p->size));
- if (AG(allocated_memory) > AG(allocated_memory_peak)) {
- AG(allocated_memory_peak) = AG(allocated_memory);
- }
-#endif
-
- p->size = size;
-
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *)((char *)p+sizeof(zend_mem_header)+MEM_HEADER_PADDING);
-}
-
-
-ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- int length;
- char *p;
-
- length = strlen(s)+1;
- HANDLE_BLOCK_INTERRUPTIONS();
- p = (char *) _emalloc(length ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- if (!p) {
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (char *)NULL;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- memcpy(p, s, length);
- return p;
-}
-
-
-ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- char *p;
-
- HANDLE_BLOCK_INTERRUPTIONS();
- p = (char *) _emalloc(length+1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- if (!p) {
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (char *)NULL;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- memcpy(p, s, length);
- p[length] = 0;
- return p;
-}
-
-
-ZEND_API char *zend_strndup(const char *s, uint length)
-{
- char *p;
-
- p = (char *) malloc(length+1);
- if (!p) {
- return (char *)NULL;
- }
- if (length) {
- memcpy(p, s, length);
- }
- p[length] = 0;
- return p;
-}
-
-
-ZEND_API int zend_set_memory_limit(unsigned int memory_limit)
-{
-#if MEMORY_LIMIT
- TSRMLS_FETCH();
-
- AG(memory_limit) = memory_limit;
- return SUCCESS;
-#else
- return FAILURE;
-#endif
-}
-
-
-ZEND_API void start_memory_manager(TSRMLS_D)
-{
- AG(head) = NULL;
-
-#if MEMORY_LIMIT
- AG(memory_limit) = 1<<30; /* ridiculous limit, effectively no limit */
- AG(allocated_memory) = 0;
- AG(memory_exhausted) = 0;
- AG(allocated_memory_peak) = 0;
-#endif
-
-#if ZEND_ENABLE_FAST_CACHE
- memset(AG(fast_cache_list_head), 0, sizeof(AG(fast_cache_list_head)));
-#endif
-#if !ZEND_DISABLE_MEMORY_CACHE
- memset(AG(cache_count), 0, sizeof(AG(cache_count)));
-#endif
-
-#ifdef ZEND_MM
- zend_mm_startup(&AG(mm_heap), 256*1024);
-#elif defined(ZEND_WIN32)
- AG(memory_heap) = HeapCreate(HEAP_NO_SERIALIZE, 256*1024, 0);
-#endif
-
-#if ZEND_DEBUG
- memset(AG(cache_stats), 0, sizeof(AG(cache_stats)));
- memset(AG(fast_cache_stats), 0, sizeof(AG(fast_cache_stats)));
-#endif
-}
-
-
-ZEND_API void shutdown_memory_manager(int silent, int clean_cache TSRMLS_DC)
-{
- zend_mem_header *p, *t;
-
-#if ZEND_DEBUG
- int had_leaks = 0;
-#endif
-
-#if defined(ZEND_MM) && !ZEND_DEBUG
- if (clean_cache) {
- zend_mm_shutdown(&AG(mm_heap));
- return;
- }
-#elif defined(ZEND_WIN32) && !ZEND_DEBUG
- if (clean_cache && AG(memory_heap)) {
- HeapDestroy(AG(memory_heap));
- return;
- }
-#endif
-
-#if ZEND_ENABLE_FAST_CACHE
- {
- zend_fast_cache_list_entry *fast_cache_list_entry, *next_fast_cache_list_entry;
- unsigned int fci;
-
- for (fci=0; fci<MAX_FAST_CACHE_TYPES; fci++) {
- fast_cache_list_entry = AG(fast_cache_list_head)[fci];
- while (fast_cache_list_entry) {
- next_fast_cache_list_entry = fast_cache_list_entry->next;
- efree(fast_cache_list_entry);
- fast_cache_list_entry = next_fast_cache_list_entry;
- }
- AG(fast_cache_list_head)[fci] = NULL;
- }
- }
-#endif /* ZEND_ENABLE_FAST_CACHE */
-
-#if !ZEND_DISABLE_MEMORY_CACHE && !defined(ZEND_MM)
- if (1 || clean_cache) {
- unsigned int i, j;
- zend_mem_header *ptr;
-
- for (i=1; i<MAX_CACHED_MEMORY; i++) {
- for (j=0; j<AG(cache_count)[i]; j++) {
- ptr = (zend_mem_header *) AG(cache)[i][j];
-#if MEMORY_LIMIT
- AG(allocated_memory) -= REAL_SIZE(ptr->size);
-#endif
- REMOVE_POINTER_FROM_LIST(ptr);
- ZEND_DO_FREE(ptr);
- }
- AG(cache_count)[i] = 0;
- }
- }
-#endif /* !ZEND_DISABLE_MEMORY_CACHE */
-
-#if ZEND_DEBUG || !defined(ZEND_MM)
- p = AG(head);
- t = AG(head);
- while (t) {
- if (!t->cached) {
-#if ZEND_DEBUG
- if (!t->cached && !t->reported) {
- zend_mem_header *iterator;
- int total_leak=0, total_leak_count=0;
-
- had_leaks = 1;
- if (!silent) {
- zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, t);
- }
- t->reported = 1;
- for (iterator=t->pNext; iterator; iterator=iterator->pNext) {
- if (!iterator->cached
- && iterator->filename==t->filename
- && iterator->lineno==t->lineno) {
- total_leak += iterator->size;
- total_leak_count++;
- iterator->reported = 1;
- }
- }
- if (!silent && total_leak_count>0) {
- zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) (long) (total_leak_count));
- }
- }
-#endif
-#if MEMORY_LIMIT
- AG(allocated_memory) -= REAL_SIZE(t->size);
-#endif
- p = t->pNext;
- REMOVE_POINTER_FROM_LIST(t);
- ZEND_DO_FREE(t);
- t = p;
- } else {
- t = t->pNext;
- }
- }
-
-#if MEMORY_LIMIT
- AG(memory_exhausted)=0;
- AG(allocated_memory_peak) = 0;
-#endif
-
-
-#if (ZEND_DEBUG)
- do {
- zval display_memory_cache_stats;
- int i, j;
-
- if (clean_cache) {
- /* we're shutting down completely, don't even touch the INI subsystem */
- break;
- }
- if (zend_get_configuration_directive("display_memory_cache_stats", sizeof("display_memory_cache_stats"), &display_memory_cache_stats)==FAILURE) {
- break;
- }
- if (!atoi(display_memory_cache_stats.value.str.val)) {
- break;
- }
- fprintf(stderr, "Memory cache statistics\n"
- "-----------------------\n\n"
- "[zval, %2ld]\t\t%d / %d (%.2f%%)\n"
- "[hash, %2ld]\t\t%d / %d (%.2f%%)\n",
- (long) sizeof(zval),
- AG(fast_cache_stats)[ZVAL_CACHE_LIST][1], AG(fast_cache_stats)[ZVAL_CACHE_LIST][0]+AG(fast_cache_stats)[ZVAL_CACHE_LIST][1],
- ((double) AG(fast_cache_stats)[ZVAL_CACHE_LIST][1] / (AG(fast_cache_stats)[ZVAL_CACHE_LIST][0]+AG(fast_cache_stats)[ZVAL_CACHE_LIST][1]))*100,
- (long) sizeof(HashTable),
- AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1], AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][0]+AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1],
- ((double) AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1] / (AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][0]+AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1]))*100);
-
-
- for (i=0; i<MAX_CACHED_MEMORY; i+=2) {
- fprintf(stderr, "[%2d, %2d]\t\t", i, i+1);
- for (j=0; j<2; j++) {
- fprintf(stderr, "%d / %d (%.2f%%)\t\t",
- AG(cache_stats)[i+j][1], AG(cache_stats)[i+j][0]+AG(cache_stats)[i+j][1],
- ((double) AG(cache_stats)[i+j][1] / (AG(cache_stats)[i+j][0]+AG(cache_stats)[i+j][1]))*100);
- }
- fprintf(stderr, "\n");
- }
-
- } while (0);
-#endif
-
-#endif
-
-#if defined(ZEND_MM) && ZEND_DEBUG
- if (clean_cache) {
- zend_mm_shutdown(&AG(mm_heap));
- return;
- }
-#elif defined(ZEND_WIN32) && ZEND_DEBUG
- if (clean_cache && AG(memory_heap)) {
- HeapDestroy(AG(memory_heap));
- return;
- }
-#endif
-}
-
-
-#if ZEND_DEBUG
-void zend_debug_alloc_output(char *format, ...)
-{
- char output_buf[256];
- va_list args;
-
- va_start(args, format);
- vsprintf(output_buf, format, args);
- va_end(args);
-
-#ifdef ZEND_WIN32
- OutputDebugString(output_buf);
-#else
- fprintf(stderr, "%s", output_buf);
-#endif
-}
-
-
-ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- zend_mem_header *p = (zend_mem_header *) ((char *)ptr - sizeof(zend_mem_header) - MEM_HEADER_PADDING);
- int no_cache_notice=0;
- int valid_beginning=1;
- int had_problems=0;
- long end_magic;
-
- if (silent==2) {
- silent = 1;
- no_cache_notice = 1;
- }
- if (silent==3) {
- silent = 0;
- no_cache_notice = 1;
- }
- if (!silent) {
- zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL);
- zend_debug_alloc_output("---------------------------------------\n");
- zend_debug_alloc_output("%s(%d) : Block 0x%0.8lX status:\n" ZEND_FILE_LINE_RELAY_CC, (long) p);
- if (__zend_orig_filename) {
- zend_debug_alloc_output("%s(%d) : Actual location (location was relayed)\n" ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- zend_debug_alloc_output("%10s\t","Beginning: ");
- }
-
- switch (p->magic) {
- case MEM_BLOCK_START_MAGIC:
- if (!silent) {
- zend_debug_alloc_output("OK (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size);
- }
- break; /* ok */
- case MEM_BLOCK_FREED_MAGIC:
- if (!silent) {
- zend_debug_alloc_output("Freed\n");
- had_problems = 1;
- } else {
- return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- break;
- case MEM_BLOCK_CACHED_MAGIC:
- if (!silent) {
- if (!no_cache_notice) {
- zend_debug_alloc_output("Cached (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size);
- had_problems = 1;
- }
- } else {
- if (!no_cache_notice) {
- return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- }
- break;
- default:
- if (!silent) {
- zend_debug_alloc_output("Overrun (magic=0x%0.8lX, expected=0x%0.8lX)\n", p->magic, MEM_BLOCK_START_MAGIC);
- } else {
- return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- had_problems = 1;
- valid_beginning = 0;
- break;
- }
-
-
- memcpy(&end_magic, (((char *) p)+sizeof(zend_mem_header)+MEM_HEADER_PADDING+p->size), sizeof(long));
-
- if (valid_beginning && (end_magic != MEM_BLOCK_END_MAGIC)) {
- char *overflow_ptr, *magic_ptr=(char *) &mem_block_end_magic;
- int overflows=0;
- int i;
-
- if (silent) {
- return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- had_problems = 1;
- overflow_ptr = (char *) &end_magic;
-
- for (i=0; i<sizeof(long); i++) {
- if (overflow_ptr[i]!=magic_ptr[i]) {
- overflows++;
- }
- }
-
- zend_debug_alloc_output("%10s\t", "End:");
- zend_debug_alloc_output("Overflown (magic=0x%0.8lX instead of 0x%0.8lX)\n", end_magic, MEM_BLOCK_END_MAGIC);
- zend_debug_alloc_output("%10s\t","");
- if (overflows>=sizeof(long)) {
- zend_debug_alloc_output("At least %d bytes overflown\n", sizeof(long));
- } else {
- zend_debug_alloc_output("%d byte(s) overflown\n", overflows);
- }
- } else if (!silent) {
- zend_debug_alloc_output("%10s\t", "End:");
- if (valid_beginning) {
- zend_debug_alloc_output("OK\n");
- } else {
- zend_debug_alloc_output("Unknown\n");
- }
- }
-
- if (had_problems) {
- int foo = 5;
-
- foo += 1;
- }
-
- if (!silent) {
- zend_debug_alloc_output("---------------------------------------\n");
- }
- return ((!had_problems) ? 1 : 0);
-}
-
-
-ZEND_API void _full_mem_check(int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- zend_mem_header *p;
- int errors=0;
- TSRMLS_FETCH();
-
- p = AG(head);
-
-
- zend_debug_alloc_output("------------------------------------------------\n");
- zend_debug_alloc_output("Full Memory Check at %s:%d\n" ZEND_FILE_LINE_RELAY_CC);
-
- while (p) {
- if (!_mem_block_check((void *)((char *)p + sizeof(zend_mem_header) + MEM_HEADER_PADDING), (silent?2:3) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC)) {
- errors++;
- }
- p = p->pNext;
- }
- zend_debug_alloc_output("End of full memory check %s:%d (%d errors)\n" ZEND_FILE_LINE_RELAY_CC, errors);
- zend_debug_alloc_output("------------------------------------------------\n");
-}
-#endif
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h
deleted file mode 100644
index dff79a8948..0000000000
--- a/Zend/zend_alloc.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_ALLOC_H
-#define ZEND_ALLOC_H
-
-#include <stdio.h>
-
-#include "../TSRM/TSRM.h"
-#include "zend_globals_macros.h"
-
-#include "zend_mm.h"
-
-#define MEM_BLOCK_START_MAGIC 0x7312F8DCL
-#define MEM_BLOCK_END_MAGIC 0x2A8FCC84L
-#define MEM_BLOCK_FREED_MAGIC 0x99954317L
-#define MEM_BLOCK_CACHED_MAGIC 0xFB8277DCL
-
-typedef struct _zend_mem_header {
-#if ZEND_DEBUG
- long magic;
- char *filename;
- uint lineno;
- int reported;
- char *orig_filename;
- uint orig_lineno;
-# ifdef ZTS
- THREAD_T thread_id;
-# endif
-#endif
-#if ZEND_DEBUG || !defined(ZEND_MM)
- struct _zend_mem_header *pNext;
- struct _zend_mem_header *pLast;
-#endif
- unsigned int size:31;
- unsigned int cached:1;
-} zend_mem_header;
-
-typedef union _align_test {
- void *ptr;
- double dbl;
- long lng;
-} align_test;
-
-#define MAX_CACHED_MEMORY 11
-#define MAX_CACHED_ENTRIES 256
-#define PRE_INIT_CACHE_ENTRIES 32
-
-#if (defined (__GNUC__) && __GNUC__ >= 2)
-#define PLATFORM_ALIGNMENT (__alignof__ (align_test))
-#else
-#define PLATFORM_ALIGNMENT (sizeof(align_test))
-#endif
-
-#define MEM_HEADER_PADDING (((PLATFORM_ALIGNMENT-sizeof(zend_mem_header))%PLATFORM_ALIGNMENT+PLATFORM_ALIGNMENT)%PLATFORM_ALIGNMENT)
-
-
-BEGIN_EXTERN_C()
-
-ZEND_API char *zend_strndup(const char *s, unsigned int length);
-
-ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-
-/* Standard wrapper macros */
-#define emalloc(size) _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define safe_emalloc(nmemb, size, offset) _safe_emalloc((nmemb), (size), (offset) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define efree(ptr) _efree((ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define ecalloc(nmemb, size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define erealloc(ptr, size) _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define erealloc_recoverable(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define estrdup(s) _estrdup((s) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define estrndup(s, length) _estrndup((s), (length) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-
-/* Relay wrapper macros */
-#define emalloc_rel(size) _emalloc((size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-#define safe_emalloc_rel(nmemb, size, offset) _safe_emalloc((nmemb), (size), (offset) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-#define efree_rel(ptr) _efree((ptr) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-#define ecalloc_rel(nmemb, size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-#define erealloc_rel(ptr, size) _erealloc((ptr), (size), 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-#define erealloc_recoverable_rel(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-#define estrdup_rel(s) _estrdup((s) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-#define estrndup_rel(s, length) _estrndup((s), (length) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-
-/* Selective persistent/non persistent allocation macros */
-#define pemalloc(size, persistent) ((persistent)?malloc(size):emalloc(size))
-#define pefree(ptr, persistent) ((persistent)?free(ptr):efree(ptr))
-#define pecalloc(nmemb, size, persistent) ((persistent)?calloc((nmemb), (size)):ecalloc((nmemb), (size)))
-#define perealloc(ptr, size, persistent) ((persistent)?realloc((ptr), (size)):erealloc((ptr), (size)))
-#define perealloc_recoverable(ptr, size, persistent) ((persistent)?realloc((ptr), (size)):erealloc_recoverable((ptr), (size)))
-#define pestrdup(s, persistent) ((persistent)?strdup(s):estrdup(s))
-
-#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):(empty_string))
-#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):(empty_string))
-
-ZEND_API int zend_set_memory_limit(unsigned int memory_limit);
-
-ZEND_API void start_memory_manager(TSRMLS_D);
-ZEND_API void shutdown_memory_manager(int silent, int clean_cache TSRMLS_DC);
-
-#if ZEND_DEBUG
-ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void _full_mem_check(int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-void zend_debug_alloc_output(char *format, ...);
-#define mem_block_check(ptr, silent) _mem_block_check(ptr, silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define full_mem_check(silent) _full_mem_check(silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#else
-#define mem_block_check(type, ptr, silent)
-#define full_mem_check(silent)
-#endif
-
-
-END_EXTERN_C()
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
deleted file mode 100644
index 69921a1d60..0000000000
--- a/Zend/zend_builtin_functions.c
+++ /dev/null
@@ -1,1803 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_API.h"
-#include "zend_builtin_functions.h"
-#include "zend_constants.h"
-#include "zend_ini.h"
-
-#undef ZEND_TEST_EXCEPTIONS
-
-static ZEND_FUNCTION(zend_version);
-static ZEND_FUNCTION(func_num_args);
-static ZEND_FUNCTION(func_get_arg);
-static ZEND_FUNCTION(func_get_args);
-static ZEND_NAMED_FUNCTION(zend_if_strlen);
-static ZEND_FUNCTION(strcmp);
-static ZEND_FUNCTION(strncmp);
-static ZEND_FUNCTION(strcasecmp);
-static ZEND_FUNCTION(strncasecmp);
-static ZEND_FUNCTION(each);
-static ZEND_FUNCTION(error_reporting);
-static ZEND_FUNCTION(define);
-static ZEND_FUNCTION(defined);
-static ZEND_FUNCTION(get_class);
-static ZEND_FUNCTION(get_parent_class);
-static ZEND_FUNCTION(method_exists);
-static ZEND_FUNCTION(class_exists);
-static ZEND_FUNCTION(function_exists);
-#if ZEND_DEBUG
-static ZEND_FUNCTION(leak);
-#ifdef ZEND_TEST_EXCEPTIONS
-static ZEND_FUNCTION(crash);
-#endif
-#endif
-static ZEND_FUNCTION(get_included_files);
-static ZEND_FUNCTION(is_subclass_of);
-static ZEND_FUNCTION(is_a);
-static ZEND_FUNCTION(get_class_vars);
-static ZEND_FUNCTION(get_object_vars);
-static ZEND_FUNCTION(get_class_methods);
-static ZEND_FUNCTION(trigger_error);
-static ZEND_FUNCTION(set_error_handler);
-static ZEND_FUNCTION(restore_error_handler);
-static ZEND_FUNCTION(set_exception_handler);
-static ZEND_FUNCTION(restore_exception_handler);
-static ZEND_FUNCTION(get_declared_classes);
-static ZEND_FUNCTION(get_defined_functions);
-static ZEND_FUNCTION(get_defined_vars);
-static ZEND_FUNCTION(create_function);
-static ZEND_FUNCTION(get_resource_type);
-static ZEND_FUNCTION(get_loaded_extensions);
-static ZEND_FUNCTION(extension_loaded);
-static ZEND_FUNCTION(get_extension_funcs);
-static ZEND_FUNCTION(get_defined_constants);
-static ZEND_FUNCTION(debug_backtrace);
-static ZEND_FUNCTION(debug_print_backtrace);
-#if ZEND_DEBUG
-static ZEND_FUNCTION(zend_test_func);
-#ifdef ZTS
-static ZEND_FUNCTION(zend_thread_id);
-#endif
-#endif
-
-ZEND_API unsigned char first_arg_force_ref[] = { 1, BYREF_FORCE };
-ZEND_API unsigned char second_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
-ZEND_API unsigned char third_arg_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-
-static zend_function_entry builtin_functions[] = {
- ZEND_FE(zend_version, NULL)
- ZEND_FE(func_num_args, NULL)
- ZEND_FE(func_get_arg, NULL)
- ZEND_FE(func_get_args, NULL)
- { "strlen", zend_if_strlen, NULL },
- ZEND_FE(strcmp, NULL)
- ZEND_FE(strncmp, NULL)
- ZEND_FE(strcasecmp, NULL)
- ZEND_FE(strncasecmp, NULL)
- ZEND_FE(each, first_arg_force_ref)
- ZEND_FE(error_reporting, NULL)
- ZEND_FE(define, NULL)
- ZEND_FE(defined, NULL)
- ZEND_FE(get_class, NULL)
- ZEND_FE(get_parent_class, NULL)
- ZEND_FE(method_exists, NULL)
- ZEND_FE(class_exists, NULL)
- ZEND_FE(function_exists, NULL)
-#if ZEND_DEBUG
- ZEND_FE(leak, NULL)
-#ifdef ZEND_TEST_EXCEPTIONS
- ZEND_FE(crash, NULL)
-#endif
-#endif
- ZEND_FE(get_included_files, NULL)
- ZEND_FALIAS(get_required_files, get_included_files, NULL)
- ZEND_FE(is_subclass_of, NULL)
- ZEND_FE(is_a, NULL)
- ZEND_FE(get_class_vars, NULL)
- ZEND_FE(get_object_vars, NULL)
- ZEND_FE(get_class_methods, NULL)
- ZEND_FE(trigger_error, NULL)
- ZEND_FALIAS(user_error, trigger_error, NULL)
- ZEND_FE(set_error_handler, NULL)
- ZEND_FE(restore_error_handler, NULL)
- ZEND_FE(set_exception_handler, NULL)
- ZEND_FE(restore_exception_handler, NULL)
- ZEND_FE(get_declared_classes, NULL)
- ZEND_FE(get_defined_functions, NULL)
- ZEND_FE(get_defined_vars, NULL)
- ZEND_FE(create_function, NULL)
- ZEND_FE(get_resource_type, NULL)
- ZEND_FE(get_loaded_extensions, NULL)
- ZEND_FE(extension_loaded, NULL)
- ZEND_FE(get_extension_funcs, NULL)
- ZEND_FE(get_defined_constants, NULL)
- ZEND_FE(debug_backtrace, NULL)
- ZEND_FE(debug_print_backtrace, NULL)
-#if ZEND_DEBUG
- ZEND_FE(zend_test_func, NULL)
-#ifdef ZTS
- ZEND_FE(zend_thread_id, NULL)
-#endif
-#endif
- { NULL, NULL, NULL }
-};
-
-
-int zend_startup_builtin_functions(TSRMLS_D)
-{
- return zend_register_functions(NULL, builtin_functions, NULL, MODULE_PERSISTENT TSRMLS_CC);
-}
-
-
-/* {{{ proto string zend_version(void)
- Get the version of the Zend Engine */
-ZEND_FUNCTION(zend_version)
-{
- RETURN_STRINGL(ZEND_VERSION, sizeof(ZEND_VERSION)-1, 1);
-}
-/* }}} */
-
-
-/* {{{ proto int func_num_args(void)
- Get the number of arguments that were passed to the function */
-ZEND_FUNCTION(func_num_args)
-{
- void **p;
- int arg_count;
-
- p = EG(argument_stack).top_element-1-1;
- arg_count = (ulong) *p; /* this is the amount of arguments passed to func_num_args(); */
- p -= 1+arg_count;
- if (*p) {
- zend_error(E_ERROR, "func_num_args(): Can't be used as a function parameter");
- }
- --p;
- if (p>=EG(argument_stack).elements) {
- RETURN_LONG((ulong) *p);
- } else {
- zend_error(E_WARNING, "func_num_args(): Called from the global scope - no function context");
- RETURN_LONG(-1);
- }
-}
-/* }}} */
-
-
-/* {{{ proto mixed func_get_arg(int arg_num)
- Get the $arg_num'th argument that was passed to the function */
-ZEND_FUNCTION(func_get_arg)
-{
- void **p;
- int arg_count;
- zval **z_requested_offset;
- zval *arg;
- long requested_offset;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &z_requested_offset)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(z_requested_offset);
- requested_offset = (*z_requested_offset)->value.lval;
-
- if (requested_offset < 0) {
- zend_error(E_WARNING, "func_get_arg(): The argument number should be >= 0");
- RETURN_FALSE;
- }
-
- p = EG(argument_stack).top_element-1-1;
- arg_count = (ulong) *p; /* this is the amount of arguments passed to func_get_arg(); */
- p -= 1+arg_count;
- if (*p) {
- zend_error(E_ERROR, "func_get_arg(): Can't be used as a function parameter");
- }
- --p;
- if (p<EG(argument_stack).elements) {
- zend_error(E_WARNING, "func_get_arg(): Called from the global scope - no function context");
- RETURN_FALSE;
- }
- arg_count = (ulong) *p;
-
- if (requested_offset>=arg_count) {
- zend_error(E_WARNING, "func_get_arg(): Argument %d not passed to function", requested_offset);
- RETURN_FALSE;
- }
-
- arg = *(p-(arg_count-requested_offset));
- *return_value = *arg;
- zval_copy_ctor(return_value);
-}
-/* }}} */
-
-
-/* {{{ proto array func_get_args()
- Get an array of the arguments that were passed to the function */
-ZEND_FUNCTION(func_get_args)
-{
- void **p;
- int arg_count;
- int i;
-
- p = EG(argument_stack).top_element-1-1;
- arg_count = (ulong) *p; /* this is the amount of arguments passed to func_get_args(); */
- p -= 1+arg_count;
- if (*p) {
- zend_error(E_ERROR, "func_get_args(): Can't be used as a function parameter");
- }
- --p;
-
- if (p<EG(argument_stack).elements) {
- zend_error(E_WARNING, "func_get_args(): Called from the global scope - no function context");
- RETURN_FALSE;
- }
- arg_count = (ulong) *p;
-
-
- array_init(return_value);
- for (i=0; i<arg_count; i++) {
- zval *element;
-
- ALLOC_ZVAL(element);
- *element = **((zval **) (p-(arg_count-i)));
- zval_copy_ctor(element);
- INIT_PZVAL(element);
- zend_hash_next_index_insert(return_value->value.ht, &element, sizeof(zval *), NULL);
- }
-}
-/* }}} */
-
-
-/* {{{ proto int strlen(string str)
- Get string length */
-ZEND_NAMED_FUNCTION(zend_if_strlen)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(str);
- RETVAL_LONG((*str)->value.str.len);
-}
-/* }}} */
-
-
-/* {{{ proto int strcmp(string str1, string str2)
- Binary safe string comparison */
-ZEND_FUNCTION(strcmp)
-{
- zval **s1, **s2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
- RETURN_LONG(zend_binary_zval_strcmp(*s1, *s2));
-}
-/* }}} */
-
-
-/* {{{ proto int strncmp(string str1, string str2, int len)
- Binary safe string comparison */
-ZEND_FUNCTION(strncmp)
-{
- zval **s1, **s2, **s3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &s1, &s2, &s3) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
- convert_to_long_ex(s3);
- RETURN_LONG(zend_binary_zval_strncmp(*s1, *s2, *s3));
-}
-/* }}} */
-
-
-/* {{{ proto int strcasecmp(string str1, string str2)
- Binary safe case-insensitive string comparison */
-ZEND_FUNCTION(strcasecmp)
-{
- zval **s1, **s2;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
- RETURN_LONG(zend_binary_zval_strcasecmp(*s1, *s2));
-}
-/* }}} */
-
-
-/* {{{ proto int strncasecmp(string str1, string str2, int len)
- Binary safe string comparison */
-ZEND_FUNCTION(strncasecmp)
-{
- zval **s1, **s2, **s3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &s1, &s2, &s3) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
- convert_to_long_ex(s3);
- RETURN_LONG(zend_binary_zval_strncasecmp(*s1, *s2, *s3));
-}
-/* }}} */
-
-
-/* {{{ proto array each(array arr)
- Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element */
-ZEND_FUNCTION(each)
-{
- zval **array, *entry, **entry_ptr, *tmp;
- char *string_key;
- ulong num_key;
- zval **inserted_pointer;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- zend_error(E_WARNING,"Variable passed to each() is not an array or object");
- return;
- }
- if (zend_hash_get_current_data(target_hash, (void **) &entry_ptr)==FAILURE) {
- RETURN_FALSE;
- }
- array_init(return_value);
- entry = *entry_ptr;
-
- /* add value elements */
- if (entry->is_ref) {
- ALLOC_ZVAL(tmp);
- *tmp = *entry;
- zval_copy_ctor(tmp);
- tmp->is_ref=0;
- tmp->refcount=0;
- entry=tmp;
- }
- zend_hash_index_update(return_value->value.ht, 1, &entry, sizeof(zval *), NULL);
- entry->refcount++;
- zend_hash_update(return_value->value.ht, "value", sizeof("value"), &entry, sizeof(zval *), NULL);
- entry->refcount++;
-
- /* add the key elements */
- switch (zend_hash_get_current_key(target_hash, &string_key, &num_key, 1)) {
- case HASH_KEY_IS_STRING:
- add_get_index_string(return_value, 0, string_key, (void **) &inserted_pointer, 0);
- break;
- case HASH_KEY_IS_LONG:
- add_get_index_long(return_value, 0, num_key, (void **) &inserted_pointer);
- break;
- }
- zend_hash_update(return_value->value.ht, "key", sizeof("key"), inserted_pointer, sizeof(zval *), NULL);
- (*inserted_pointer)->refcount++;
- zend_hash_move_forward(target_hash);
-}
-/* }}} */
-
-
-/* {{{ proto int error_reporting(int new_error_level=null)
- Return the current error_reporting level, and if an argument was passed - change to the new level */
-ZEND_FUNCTION(error_reporting)
-{
- zval **arg;
- int old_error_reporting;
-
- old_error_reporting = EG(error_reporting);
- switch (ZEND_NUM_ARGS()) {
- case 0:
- break;
- case 1:
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(arg);
- zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- break;
- }
-
- RETVAL_LONG(old_error_reporting);
-}
-/* }}} */
-
-
-/* {{{ proto bool define(string constant_name, mixed value, case_sensitive=true)
- Define a new constant */
-ZEND_FUNCTION(define)
-{
- zval **var, **val, **non_cs;
- int case_sensitive;
- zend_constant c;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &var, &val)==FAILURE) {
- RETURN_FALSE;
- }
- case_sensitive = CONST_CS;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &var, &val, &non_cs)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(non_cs);
- if ((*non_cs)->value.lval) {
- case_sensitive = 0;
- } else {
- case_sensitive = CONST_CS;
- }
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- break;
- }
-
- switch ((*val)->type) {
- case IS_LONG:
- case IS_DOUBLE:
- case IS_STRING:
- case IS_BOOL:
- case IS_RESOURCE:
- case IS_NULL:
- break;
- default:
- zend_error(E_WARNING,"Constants may only evaluate to scalar values");
- RETURN_FALSE;
- break;
- }
- convert_to_string_ex(var);
-
- c.value = **val;
- zval_copy_ctor(&c.value);
- c.flags = case_sensitive; /* non persistent */
- c.name = zend_strndup((*var)->value.str.val, (*var)->value.str.len);
- c.name_len = (*var)->value.str.len+1;
- if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool defined(string constant_name)
- Check whether a constant exists */
-ZEND_FUNCTION(defined)
-{
- zval **var;
- zval c;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &var)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(var);
- if (zend_get_constant((*var)->value.str.val, (*var)->value.str.len, &c TSRMLS_CC)) {
- zval_dtor(&c);
- RETURN_LONG(1);
- } else {
- RETURN_LONG(0);
- }
-}
-/* }}} */
-
-
-/* {{{ proto string get_class(object object)
- Retrieves the class name */
-ZEND_FUNCTION(get_class)
-{
- zval **arg;
- char *name = "";
- zend_uint name_len = 0;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &arg)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- if (Z_TYPE_PP(arg) != IS_OBJECT) {
- RETURN_FALSE;
- }
-
- if (Z_OBJ_HT_PP(arg)->get_class_name == NULL ||
- Z_OBJ_HT_PP(arg)->get_class_name(*arg, &name, &name_len, 0 TSRMLS_CC) != SUCCESS) {
- zend_class_entry *ce;
-
- ce = zend_get_class_entry(*arg TSRMLS_CC);
- if (!ce) {
- RETURN_FALSE;
- }
-
- if(ce->ns) {
- zend_make_full_classname(ce, &name, &name_len);
- RETURN_STRINGL(name, name_len, 0);
- } else {
- RETURN_STRINGL(ce->name, ce->name_length, 1);
- }
- }
-
- RETURN_STRINGL(name, name_len, 0);
-}
-/* }}} */
-
-
-/* {{{ proto string get_parent_class(mixed object)
- Retrieves the parent class name for object or class. */
-ZEND_FUNCTION(get_parent_class)
-{
- zval **arg;
- zend_class_entry *ce = NULL;
- char *name;
- zend_uint name_length;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &arg)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (Z_TYPE_PP(arg) == IS_OBJECT) {
-
- if (Z_OBJ_HT_PP(arg)->get_class_name
- && Z_OBJ_HT_PP(arg)->get_class_name(*arg, &name, &name_length, 1 TSRMLS_CC) == SUCCESS) {
- RETURN_STRINGL(name, name_length, 0);
- } else if (Z_OBJ_HT_PP(arg)->get_class_entry && (ce = zend_get_class_entry(*arg TSRMLS_CC))) {
- zend_make_full_classname(ce, &name, &name_length);
- RETURN_STRINGL(name, name_length, 0);
- } else {
- RETURN_FALSE;
- }
- } else if (Z_TYPE_PP(arg) == IS_STRING) {
- zend_class_entry **pce;
-
- SEPARATE_ZVAL(arg);
- zend_str_tolower(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg));
- if (zend_lookup_ns_class(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &pce TSRMLS_CC) == SUCCESS) {
- ce = *pce;
- }
- }
-
- if (ce && ce->parent) {
- zend_make_full_classname(ce->parent, &name, &name_length);
- RETURN_STRINGL(name, name_length, 0);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
-{
- zval **obj, **class_name;
- char *lcname;
- zend_class_entry *instance_ce;
- zend_class_entry **ce;
- zend_bool retval;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &obj, &class_name)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (Z_TYPE_PP(obj) != IS_OBJECT) {
- RETURN_FALSE;
- }
-
- /* TBI!! new object handlers */
- if (!HAS_CLASS_ENTRY(**obj)) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(class_name);
-
- lcname = estrndup(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name));
- zend_str_tolower(lcname, Z_STRLEN_PP(class_name));
-
- if (zend_lookup_ns_class(lcname, Z_STRLEN_PP(class_name), &ce TSRMLS_CC) == FAILURE) {
- efree(lcname);
- retval = 0;
- } else {
- if (only_subclass) {
- instance_ce = Z_OBJCE_PP(obj)->parent;
- } else {
- instance_ce = Z_OBJCE_PP(obj);
- }
-
- if (instanceof_function(instance_ce, *ce TSRMLS_CC)) {
- retval = 1;
- } else {
- retval = 0;
- }
- }
-
- efree(lcname);
-
- RETURN_BOOL(retval);
-}
-
-
-/* {{{ proto bool is_subclass_of(object object, string class_name)
- Returns true if the object has this class as one of its parents */
-ZEND_FUNCTION(is_subclass_of)
-{
- is_a_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-/* {{{ proto bool is_a(object object, string class_name)
- Returns true if the object is of this class or has this class as one of its parents */
-ZEND_FUNCTION(is_a)
-{
- is_a_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-
-/* {{{ proto array get_class_vars(string class_name)
- Returns an array of default properties of the class */
-ZEND_FUNCTION(get_class_vars)
-{
- zval **class_name;
- char *lcname;
- zend_class_entry *ce, **pce;
- zval *tmp;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class_name)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(class_name);
- lcname = estrndup((*class_name)->value.str.val, (*class_name)->value.str.len);
- zend_str_tolower(lcname, (*class_name)->value.str.len);
-
- if (zend_lookup_ns_class(lcname, Z_STRLEN_PP(class_name), &pce TSRMLS_CC) == FAILURE) {
- efree(lcname);
- RETURN_FALSE;
- } else {
- ce = *pce;
- efree(lcname);
- array_init(return_value);
- if (!ce->constants_updated) {
- zend_hash_apply_with_argument(&ce->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
- ce->constants_updated = 1;
- }
- zend_hash_copy(return_value->value.ht, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
- }
-}
-/* }}} */
-
-
-/* {{{ proto array get_object_vars(object obj)
- Returns an array of object properties */
-ZEND_FUNCTION(get_object_vars)
-{
- zval **obj;
- zval *tmp;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &obj) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if ((*obj)->type != IS_OBJECT) {
- RETURN_FALSE;
- }
- if (Z_OBJ_HT_PP(obj)->get_properties == NULL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- zend_hash_copy(return_value->value.ht, Z_OBJ_HT_PP(obj)->get_properties(*obj TSRMLS_CC),
- (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
-}
-/* }}} */
-
-
-/* {{{ proto array get_class_methods(mixed class)
- Returns an array of method names for class or class instance. */
-ZEND_FUNCTION(get_class_methods)
-{
- zval **class;
- zval *method_name;
- zend_class_entry *ce = NULL, **pce;
- char *string_key;
- ulong num_key;
- int key_type;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (Z_TYPE_PP(class) == IS_OBJECT) {
- /* TBI!! new object handlers */
- if (!HAS_CLASS_ENTRY(**class)) {
- RETURN_FALSE;
- }
- ce = Z_OBJCE_PP(class);
- } else if (Z_TYPE_PP(class) == IS_STRING) {
- SEPARATE_ZVAL(class);
- zend_str_tolower(Z_STRVAL_PP(class), Z_STRLEN_PP(class));
-
- if (zend_lookup_ns_class(Z_STRVAL_PP(class), Z_STRLEN_PP(class), &pce TSRMLS_CC) == SUCCESS) {
- ce = *pce;
- }
- }
-
- if (!ce) {
- RETURN_NULL();
- }
-
- array_init(return_value);
- zend_hash_internal_pointer_reset(&ce->function_table);
- while ((key_type = zend_hash_get_current_key(&ce->function_table, &string_key, &num_key, 1)) != HASH_KEY_NON_EXISTANT) {
- if (key_type == HASH_KEY_IS_STRING) {
- MAKE_STD_ZVAL(method_name);
- ZVAL_STRING(method_name, string_key, 0);
- zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);
- }
- zend_hash_move_forward(&ce->function_table);
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool method_exists(object object, string method)
- Checks if the class method exists */
-ZEND_FUNCTION(method_exists)
-{
- zval **klass, **method_name;
- char *lcname;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &klass, &method_name)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- if ((*klass)->type != IS_OBJECT) {
- RETURN_FALSE;
- }
-
- /* TBI!! new object handlers */
- if (!HAS_CLASS_ENTRY(**klass)) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(method_name);
- lcname = estrndup((*method_name)->value.str.val, (*method_name)->value.str.len);
- zend_str_tolower(lcname, (*method_name)->value.str.len);
- if (zend_hash_exists(&Z_OBJCE_PP(klass)->function_table, lcname, (*method_name)->value.str.len+1)) {
- efree(lcname);
- RETURN_TRUE;
- } else {
- efree(lcname);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-static inline zend_namespace *get_namespace_from_zval(zval **namespace_name TSRMLS_DC)
-{
- zend_namespace **pns;
- char *str_ns_name;
-
- convert_to_string_ex(namespace_name);
- if(!Z_STRVAL_PP(namespace_name) || !Z_STRLEN_PP(namespace_name)) {
- return EG(global_namespace_ptr);
- }
-
- str_ns_name = estrndup(Z_STRVAL_PP(namespace_name), Z_STRLEN_PP(namespace_name));
- zend_str_tolower(str_ns_name, Z_STRLEN_PP(namespace_name));
- if(zend_hash_find(&EG(global_namespace_ptr)->class_table, str_ns_name, Z_STRLEN_PP(namespace_name)+1, (void **)&pns) == FAILURE || !CLASS_IS_NAMESPACE((*pns))) {
- zend_error(E_WARNING, "Namespace '%s' is not defined!", Z_STRVAL_PP(namespace_name));
- efree(str_ns_name);
- return NULL;
- }
-
- efree(str_ns_name);
- return *pns;
-}
-
-/* {{{ proto bool class_exists(string classname)
- Checks if the class exists */
-ZEND_FUNCTION(class_exists)
-{
- zval **class_name;
- char *lcname;
- zend_class_entry **ce;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class_name)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(class_name);
- lcname = estrndup((*class_name)->value.str.val, (*class_name)->value.str.len);
- zend_str_tolower(lcname, (*class_name)->value.str.len);
- if (zend_lookup_ns_class(lcname, Z_STRLEN_PP(class_name), &ce TSRMLS_CC) == SUCCESS) {
- efree(lcname);
- RETURN_TRUE;
- } else {
- efree(lcname);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool function_exists(string function_name)
- Checks if the function exists */
-ZEND_FUNCTION(function_exists)
-{
- zval **function_name;
- zend_function *func;
- char *lcname, *func_name, *func_name_end;
- zend_bool retval;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &function_name)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(function_name);
- lcname = estrndup((*function_name)->value.str.val, (*function_name)->value.str.len);
- zend_str_tolower(lcname, (*function_name)->value.str.len);
-
- func_name_end = lcname + (*function_name)->value.str.len;
- if((func_name = zend_memnstr(lcname, "::", sizeof("::")-1, func_name_end)) == NULL) {
- retval = (zend_hash_find(EG(function_table), lcname, (*function_name)->value.str.len+1, (void **)&func) == SUCCESS);
- } else {
- /* handle ::f case */
- if (func_name == lcname) {
- retval = (zend_hash_find(EG(function_table), lcname+sizeof("::")-1, (*function_name)->value.str.len-(sizeof("::")-1)+1, (void **)&func) == SUCCESS);
- } else {
- /* handle ns::f case */
- int ns_name_length = func_name - lcname;
- char *ns_name;
- zend_namespace **ns;
-
- func_name += sizeof("::")-1;
-
- if(func_name >= func_name_end) {
- /* ns:: case */
- retval = 0;
- } else {
- ns_name = estrndup(lcname, ns_name_length);
-
- if (zend_hash_find(&EG(global_namespace_ptr)->class_table, ns_name, ns_name_length+1, (void **)&ns) == SUCCESS &&
- CLASS_IS_NAMESPACE(*ns) &&
- zend_hash_find(&(*ns)->function_table, func_name, func_name_end - func_name + 1, (void **)&func) == SUCCESS) {
- retval = 1;
- } else {
- retval = 0;
- }
- efree(ns_name);
- }
- }
- }
- efree(lcname);
-
- /*
- * A bit of a hack, but not a bad one: we see if the handler of the function
- * is actually one that displays "function is disabled" message.
- */
- if (retval && func->type == ZEND_INTERNAL_FUNCTION &&
- func->internal_function.handler == zif_display_disabled_function) {
- retval = 0;
- }
-
- RETURN_BOOL(retval);
-}
-/* }}} */
-
-#if ZEND_DEBUG
-/* {{{ proto void leak(int num_bytes=3)
- Cause an intentional memory leak, for testing/debugging purposes */
-ZEND_FUNCTION(leak)
-{
- int leakbytes=3;
- zval **leak;
-
- if (ZEND_NUM_ARGS()>=1) {
- if (zend_get_parameters_ex(1, &leak)==SUCCESS) {
- convert_to_long_ex(leak);
- leakbytes = (*leak)->value.lval;
- }
- }
-
- emalloc(leakbytes);
-}
-/* }}} */
-
-
-#ifdef ZEND_TEST_EXCEPTIONS
-ZEND_FUNCTION(crash)
-{
- char *nowhere=NULL;
-
- memcpy(nowhere, "something", sizeof("something"));
-}
-#endif
-
-#endif /* ZEND_DEBUG */
-
-/* {{{ proto array get_included_files(void)
- Returns an array with the file names that were include_once()'d */
-ZEND_FUNCTION(get_included_files)
-{
- char *entry;
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- array_init(return_value);
- zend_hash_internal_pointer_reset(&EG(included_files));
- while (zend_hash_get_current_key(&EG(included_files), &entry, NULL, 1) == HASH_KEY_IS_STRING) {
- add_next_index_string(return_value, entry, 0);
- zend_hash_move_forward(&EG(included_files));
- }
-}
-/* }}} */
-
-
-/* {{{ proto void trigger_error(string messsage [, int error_type])
- Generates a user-level error/warning/notice message */
-ZEND_FUNCTION(trigger_error)
-{
- int error_type = E_USER_NOTICE;
- zval **z_error_type, **z_error_message;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &z_error_message)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &z_error_message, &z_error_type)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_long_ex(z_error_type);
- error_type = (*z_error_type)->value.lval;
- switch (error_type) {
- case E_USER_ERROR:
- case E_USER_WARNING:
- case E_USER_NOTICE:
- break;
- default:
- zend_error(E_WARNING, "Invalid error type specified");
- RETURN_FALSE;
- break;
- }
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(z_error_message);
- zend_error(error_type, "%s", (*z_error_message)->value.str.val);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto string set_error_handler(string error_handler)
- Sets a user-defined error handler function. Returns the previously defined error handler, or false on error */
-ZEND_FUNCTION(set_error_handler)
-{
- zval **error_handler;
- zend_bool had_orig_error_handler=0;
- char *error_handler_name = NULL;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &error_handler)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (!zend_is_callable(*error_handler, 0, &error_handler_name)) {
- zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback",
- get_active_function_name(TSRMLS_C), error_handler_name?error_handler_name:"unknown");
- efree(error_handler_name);
- return;
- }
- efree(error_handler_name);
-
- if (EG(user_error_handler)) {
- had_orig_error_handler = 1;
- *return_value = *EG(user_error_handler);
- zval_copy_ctor(return_value);
- zend_ptr_stack_push(&EG(user_error_handlers), EG(user_error_handler));
- }
- ALLOC_ZVAL(EG(user_error_handler));
-
- if (Z_STRLEN_PP(error_handler)==0) { /* unset user-defined handler */
- FREE_ZVAL(EG(user_error_handler));
- EG(user_error_handler) = NULL;
- RETURN_TRUE;
- }
-
- *EG(user_error_handler) = **error_handler;
- zval_copy_ctor(EG(user_error_handler));
-
- if (!had_orig_error_handler) {
- RETURN_NULL();
- }
-}
-/* }}} */
-
-
-/* {{{ proto void restore_error_handler(void)
- Restores the previously defined error handler function */
-ZEND_FUNCTION(restore_error_handler)
-{
- if (EG(user_error_handler)) {
- zval_ptr_dtor(&EG(user_error_handler));
- }
- if (zend_ptr_stack_num_elements(&EG(user_error_handlers))==0) {
- EG(user_error_handler) = NULL;
- } else {
- EG(user_error_handler) = zend_ptr_stack_pop(&EG(user_error_handlers));
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto string set_exception_handler(string exception_handler)
- Sets a user-defined exception handler function. Returns the previously defined exception handler, or false on error */
-ZEND_FUNCTION(set_exception_handler)
-{
- zval **exception_handler;
- zend_bool had_orig_exception_handler=0;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &exception_handler)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(exception_handler);
- if (EG(user_exception_handler)) {
- had_orig_exception_handler = 1;
- *return_value = *EG(user_exception_handler);
- zval_copy_ctor(return_value);
- zend_ptr_stack_push(&EG(user_exception_handlers), EG(user_exception_handler));
- }
- ALLOC_ZVAL(EG(user_exception_handler));
-
- if (Z_STRLEN_PP(exception_handler)==0) { /* unset user-defined handler */
- FREE_ZVAL(EG(user_exception_handler));
- EG(user_exception_handler) = NULL;
- RETURN_TRUE;
- }
-
- *EG(user_exception_handler) = **exception_handler;
- zval_copy_ctor(EG(user_exception_handler));
-
- if (!had_orig_exception_handler) {
- RETURN_NULL();
- }
-}
-/* }}} */
-
-
-/* {{{ proto void restore_exception_handler(void)
- Restores the previously defined exception handler function */
-ZEND_FUNCTION(restore_exception_handler)
-{
- if (EG(user_exception_handler)) {
- zval_ptr_dtor(&EG(user_exception_handler));
- }
- if (zend_ptr_stack_num_elements(&EG(user_exception_handlers))==0) {
- EG(user_exception_handler) = NULL;
- } else {
- EG(user_exception_handler) = zend_ptr_stack_pop(&EG(user_exception_handlers));
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-
-static int copy_class_name(zend_class_entry **pce, int num_args, va_list args, zend_hash_key *hash_key)
-{
- zval *array = va_arg(args, zval *);
- zend_class_entry *ce = *pce;
-
- if (hash_key->nKeyLength==0 || hash_key->arKey[0]!=0) {
- if (ce->type == ZEND_USER_NAMESPACE || ce->type == ZEND_INTERNAL_NAMESPACE) {
- zval *subarray;
-
- MAKE_STD_ZVAL(subarray);
- array_init(subarray);
- zend_hash_apply_with_arguments(&ce->class_table, (apply_func_args_t) copy_class_name, 1, subarray);
- add_assoc_zval(array, ce->name, subarray);
- } else {
- add_next_index_stringl(array, ce->name, ce->name_length, 1);
- }
- }
- return 0;
-}
-
-
-/* {{{ proto array get_declared_classes([string namespace])
- Returns an array of all declared classes. */
-ZEND_FUNCTION(get_declared_classes)
-{
- zval **namespace_name;
- zend_namespace *ns;
-
- if (ZEND_NUM_ARGS() != 0) {
- if(ZEND_NUM_ARGS() > 1 || zend_get_parameters_ex(1, &namespace_name)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ns = get_namespace_from_zval(namespace_name TSRMLS_CC);
-
- if(!ns) {
- RETURN_FALSE;
- }
- } else {
- ns = EG(global_namespace_ptr);
- }
-
- array_init(return_value);
- zend_hash_apply_with_arguments(&ns->class_table, (apply_func_args_t) copy_class_name, 1, return_value);
-}
-/* }}} */
-
-
-static int copy_function_name(zend_function *func, int num_args, va_list args, zend_hash_key *hash_key)
-{
- zval *internal_ar = va_arg(args, zval *),
- *user_ar = va_arg(args, zval *);
-
- if (hash_key->nKeyLength == 0 || hash_key->arKey[0] == 0) {
- return 0;
- }
-
- if (func->type == ZEND_INTERNAL_FUNCTION) {
- add_next_index_stringl(internal_ar, hash_key->arKey, hash_key->nKeyLength-1, 1);
- } else if (func->type == ZEND_USER_FUNCTION) {
- add_next_index_stringl(user_ar, hash_key->arKey, hash_key->nKeyLength-1, 1);
- }
-
- return 0;
-}
-
-
-/* {{{ proto array get_defined_functions(void)
- Returns an array of all defined functions */
-ZEND_FUNCTION(get_defined_functions)
-{
- zval *internal;
- zval *user;
-
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- MAKE_STD_ZVAL(internal);
- MAKE_STD_ZVAL(user);
-
- array_init(internal);
- array_init(user);
- array_init(return_value);
-
- zend_hash_apply_with_arguments(EG(function_table), (apply_func_args_t) copy_function_name, 2, internal, user);
-
- if (zend_hash_add(return_value->value.ht, "internal", sizeof("internal"), (void **)&internal, sizeof(zval *), NULL) == FAILURE) {
- zend_error(E_WARNING, "Cannot add internal functions to return value from get_defined_functions()");
- RETURN_FALSE;
- }
-
- if (zend_hash_add(return_value->value.ht, "user", sizeof("user"), (void **)&user, sizeof(zval *), NULL) == FAILURE) {
- zend_error(E_WARNING, "Cannot add user functions to return value from get_defined_functions()");
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto array get_defined_vars(void)
- Returns an associative array of names and values of all currently defined variable names (variables in the current scope) */
-ZEND_FUNCTION(get_defined_vars)
-{
- zval *tmp;
-
- array_init(return_value);
-
- zend_hash_copy(return_value->value.ht, EG(active_symbol_table),
- (copy_ctor_func_t)zval_add_ref, &tmp, sizeof(zval *));
-}
-/* }}} */
-
-
-#define LAMBDA_TEMP_FUNCNAME "__lambda_func"
-/* {{{ proto string create_function(string args, string code)
- Creates an anonymous function, and returns its name (funny, eh?) */
-ZEND_FUNCTION(create_function)
-{
- char *eval_code, *function_name;
- int eval_code_length, function_name_length;
- zval **z_function_args, **z_function_code;
- int retval;
- char *eval_name;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &z_function_args, &z_function_code)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(z_function_args);
- convert_to_string_ex(z_function_code);
-
- eval_code_length = sizeof("function " LAMBDA_TEMP_FUNCNAME)
- +Z_STRLEN_PP(z_function_args)
- +2 /* for the args parentheses */
- +2 /* for the curly braces */
- +Z_STRLEN_PP(z_function_code);
-
- eval_code = (char *) emalloc(eval_code_length);
- sprintf(eval_code, "function " LAMBDA_TEMP_FUNCNAME "(%s){%s}", Z_STRVAL_PP(z_function_args), Z_STRVAL_PP(z_function_code));
-
- eval_name = zend_make_compiled_string_description("runtime-created function" TSRMLS_CC);
- retval = zend_eval_string(eval_code, NULL, eval_name TSRMLS_CC);
- efree(eval_code);
- efree(eval_name);
-
- if (retval==SUCCESS) {
- zend_function *func;
-
- if (zend_hash_find(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME), (void **) &func)==FAILURE) {
- zend_error(E_ERROR, "Unexpected inconsistency in create_function()");
- RETURN_FALSE;
- }
- function_add_ref(func);
-
- function_name = (char *) emalloc(sizeof("0lambda_")+MAX_LENGTH_OF_LONG);
-
- do {
- sprintf(function_name, "%clambda_%d", 0, ++EG(lambda_count));
- function_name_length = strlen(function_name+1)+1;
- } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, func, sizeof(zend_function), NULL)==FAILURE);
- zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME));
- RETURN_STRINGL(function_name, function_name_length, 0);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-#if ZEND_DEBUG
-ZEND_FUNCTION(zend_test_func)
-{
- zval *arg1, *arg2;
-
- zend_get_parameters(ht, 2, &arg1, &arg2);
-}
-
-
-#ifdef ZTS
-ZEND_FUNCTION(zend_thread_id)
-{
- RETURN_LONG(tsrm_thread_id());
-}
-#endif
-#endif
-
-/* {{{ proto string get_resource_type(resource res)
- Get the resource type name for a given resource */
-ZEND_FUNCTION(get_resource_type)
-{
- char *resource_type;
- zval **z_resource_type;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &z_resource_type)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (Z_TYPE_PP(z_resource_type) != IS_RESOURCE) {
- zend_error(E_WARNING, "Supplied argument is not a valid resource handle");
- RETURN_FALSE;
- }
-
- resource_type = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(z_resource_type) TSRMLS_CC);
- if (resource_type) {
- RETURN_STRING(resource_type, 1);
- } else {
- RETURN_STRING("Unknown", 1);
- }
-}
-/* }}} */
-
-
-static int add_extension_info(zend_module_entry *module, void *arg TSRMLS_DC)
-{
- zval *name_array = (zval *)arg;
- add_next_index_string(name_array, module->name, 1);
- return 0;
-}
-
-static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC)
-{
- zval *name_array = (zval *)arg;
- zval *const_val;
-
- MAKE_STD_ZVAL(const_val);
- *const_val = constant->value;
- zval_copy_ctor(const_val);
- INIT_PZVAL(const_val);
- add_assoc_zval_ex(name_array, constant->name, constant->name_len, const_val);
- return 0;
-}
-
-
-/* {{{ proto array get_loaded_extensions(void)
- Return an array containing names of loaded extensions */
-ZEND_FUNCTION(get_loaded_extensions)
-{
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- array_init(return_value);
- zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t) add_extension_info, return_value TSRMLS_CC);
-}
-/* }}} */
-
-
-/* {{{ proto array get_defined_constants(void)
- Return an array containing the names and values of all defined constants */
-ZEND_FUNCTION(get_defined_constants)
-{
- int argc = ZEND_NUM_ARGS();
-
- if (argc != 0 && argc != 1) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- array_init(return_value);
-
- if (argc) {
- HashPosition pos;
- zend_constant *val;
- int prev_module_number = -1;
- char **module_names;
- zval *module_constants = NULL;
- zend_module_entry *module;
- int i = 1;
-
- module_names = emalloc((zend_hash_num_elements(&module_registry) + 1) * sizeof(char *));
- zend_hash_internal_pointer_reset_ex(&module_registry, &pos);
- while (zend_hash_get_current_data_ex(EG(zend_constants), (void **) &module, &pos) != FAILURE) {
- module_names[i++] = module->name;
- zend_hash_move_forward_ex(&module_registry, &pos);
- }
-
- zend_hash_internal_pointer_reset_ex(EG(zend_constants), &pos);
-
- while (zend_hash_get_current_data_ex(EG(zend_constants), (void **) &val, &pos) != FAILURE) {
- zval *const_val;
-
- if (val->module_number != prev_module_number) {
- if (prev_module_number != -1) {
- if (prev_module_number == 0) {
- add_assoc_zval(return_value, "internal", module_constants);
- } else if (prev_module_number <= i) {
- add_assoc_zval(return_value, module_names[prev_module_number], module_constants);
- } else {
- add_assoc_zval(return_value, "user", module_constants);
- }
- }
-
- MAKE_STD_ZVAL(module_constants);
- array_init(module_constants);
-
- prev_module_number = val->module_number;
- }
-
- MAKE_STD_ZVAL(const_val);
- *const_val = val->value;
- zval_copy_ctor(const_val);
- INIT_PZVAL(const_val);
-
- add_assoc_zval_ex(module_constants, val->name, val->name_len, const_val);
-
- zend_hash_move_forward_ex(EG(zend_constants), &pos);
- }
- if (module_constants) {
- if (prev_module_number == 0) {
- add_assoc_zval(return_value, "internal", module_constants);
- } else if (prev_module_number <= i) {
- add_assoc_zval(return_value, module_names[prev_module_number], module_constants);
- } else {
- add_assoc_zval(return_value, "user", module_constants);
- }
- }
- efree(module_names);
- } else {
- zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) add_constant_info, return_value TSRMLS_CC);
- }
-}
-/* }}} */
-
-
-static zval *debug_backtrace_get_args(void ***curpos TSRMLS_DC) {
- void **p = *curpos - 2;
- zval *arg_array, **arg;
- int arg_count = (ulong) *p;
-
- *curpos -= (arg_count+2);
-
- MAKE_STD_ZVAL(arg_array);
- array_init(arg_array);
- p -= arg_count;
-
- while (--arg_count >= 0) {
- arg = (zval **) p++;
- SEPARATE_ZVAL_TO_MAKE_IS_REF(arg);
- (*arg)->refcount++;
- add_next_index_zval(arg_array, *arg);
- }
- return arg_array;
-}
-
-void debug_print_backtrace_args(zval *arg_array TSRMLS_DC)
-{
- zval **tmp;
- HashPosition iterator;
- int i = 0;
-
- zend_hash_internal_pointer_reset_ex(arg_array->value.ht, &iterator);
- while (zend_hash_get_current_data_ex(arg_array->value.ht, (void **) &tmp, &iterator) == SUCCESS) {
- if (i++) {
- ZEND_PUTS(", ");
- }
- zend_print_flat_zval_r(*tmp TSRMLS_CC);
- zend_hash_move_forward_ex(arg_array->value.ht, &iterator);
- }
-}
-
-/* {{{ proto void debug_print_backtrace(void) */
-ZEND_FUNCTION(debug_print_backtrace)
-{
- zend_execute_data *ptr;
- int lineno;
- char *function_name;
- char *filename;
- char *class_name = NULL;
- char *call_type;
- char *include_filename = NULL;
- zval *arg_array = NULL;
- void **cur_arg_pos = EG(argument_stack).top_element;
- void **args = cur_arg_pos;
- int arg_stack_consistent = 0;
- int frames_on_stack = 0;
- int indent = 0;
-
- if (ZEND_NUM_ARGS()) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- while (--args >= EG(argument_stack).elements) {
- if (*args--) {
- break;
- }
- args -= *(ulong*)args;
- frames_on_stack++;
-
- if (args == EG(argument_stack).elements) {
- arg_stack_consistent = 1;
- break;
- }
- }
-
- ptr = EG(current_execute_data);
-
- /* skip debug_backtrace() */
- ptr = ptr->prev_execute_data;
- cur_arg_pos -= 2;
- frames_on_stack--;
-
- array_init(return_value);
-
- while (ptr) {
- if (ptr->op_array) {
- filename = ptr->op_array->filename;
- lineno = ptr->opline->lineno;
- } else {
- filename = NULL;
- }
-
- function_name = ptr->function_state.function->common.function_name;
-
- if (function_name) {
- if (ptr->object) {
- class_name = Z_OBJCE(*ptr->object)->name;
- call_type = "->";
- } else if (ptr->function_state.function->common.scope) {
- class_name = ptr->function_state.function->common.scope->name;
- call_type = "::";
- } else {
- class_name = NULL;
- call_type = NULL;
- }
- if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) {
- if (arg_stack_consistent && (frames_on_stack > 0)) {
- arg_array = debug_backtrace_get_args(&cur_arg_pos TSRMLS_CC);
- frames_on_stack--;
- }
- }
- } else {
- /* i know this is kinda ugly, but i'm trying to avoid extra cycles in the main execution loop */
- zend_bool build_filename_arg = 1;
-
- switch (ptr->opline->op2.u.constant.value.lval) {
- case ZEND_EVAL:
- function_name = "eval";
- build_filename_arg = 0;
- break;
- case ZEND_INCLUDE:
- function_name = "include";
- break;
- case ZEND_REQUIRE:
- function_name = "require";
- break;
- case ZEND_INCLUDE_ONCE:
- function_name = "include_once";
- break;
- case ZEND_REQUIRE_ONCE:
- function_name = "require_once";
- break;
- default:
- /* this can actually happen if you use debug_backtrace() in your error_handler and
- * you're in the top-scope */
- function_name = "unknown";
- build_filename_arg = 0;
- break;
- }
-
- if (build_filename_arg && include_filename) {
- MAKE_STD_ZVAL(arg_array);
- array_init(arg_array);
- add_next_index_string(arg_array, include_filename, 1);
- }
- }
- zend_printf("#%-2d ", indent);
- if (class_name) {
- ZEND_PUTS(class_name);
- ZEND_PUTS(call_type);
- }
- zend_printf("%s(", function_name?function_name:"main");
- if (arg_array) {
- debug_print_backtrace_args(arg_array TSRMLS_CC);
- zval_ptr_dtor(&arg_array);
- }
- zend_printf(") called at [%s:%d]\n", filename, lineno);
- include_filename = filename;
- ptr = ptr->prev_execute_data;
- ++indent;
- }
-}
-
-/* }}} */
-/* {{{ proto void debug_backtrace(void)
- Prints out a backtrace */
-ZEND_FUNCTION(debug_backtrace)
-{
- zend_execute_data *ptr;
- int lineno;
- char *function_name;
- char *filename;
- char *class_name;
- char *call_type;
- char *include_filename = NULL;
- zval *stack_frame;
- void **cur_arg_pos = EG(argument_stack).top_element;
- void **args = cur_arg_pos;
- int arg_stack_consistent = 0;
- int frames_on_stack = 0;
-
- if (ZEND_NUM_ARGS()) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- while (--args >= EG(argument_stack).elements) {
- if (*args--) {
- break;
- }
- args -= *(ulong*)args;
- frames_on_stack++;
-
- if (args == EG(argument_stack).elements) {
- arg_stack_consistent = 1;
- break;
- }
- }
-
- ptr = EG(current_execute_data);
-
- /* skip debug_backtrace() */
- ptr = ptr->prev_execute_data;
- cur_arg_pos -= 2;
- frames_on_stack--;
-
- array_init(return_value);
-
- while (ptr) {
- MAKE_STD_ZVAL(stack_frame);
- array_init(stack_frame);
-
- if (ptr->op_array) {
- filename = ptr->op_array->filename;
- lineno = ptr->opline->lineno;
- add_assoc_string_ex(stack_frame, "file", sizeof("file"), filename, 1);
- add_assoc_long_ex(stack_frame, "line", sizeof("line"), lineno);
-
- /* try to fetch args only if an FCALL was just made - elsewise we're in the middle of a function
- * and debug_baktrace() might have been called by the error_handler. in this case we don't
- * want to pop anything of the argument-stack */
- } else {
- filename = NULL;
- }
-
- function_name = ptr->function_state.function->common.function_name;
-
- if (function_name) {
- add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
-
- if (ptr->object) {
- class_name = Z_OBJCE(*ptr->object)->name;
- call_type = "->";
- } else if (ptr->function_state.function->common.scope) {
- class_name = ptr->function_state.function->common.scope->name;
- call_type = "::";
- } else {
- class_name = NULL;
- call_type = NULL;
- }
-
- if (class_name) {
- add_assoc_string_ex(stack_frame, "class", sizeof("class"), class_name, 1);
- add_assoc_string_ex(stack_frame, "type", sizeof("type"), call_type, 1);
- }
-
- if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) {
- if (arg_stack_consistent && (frames_on_stack > 0)) {
- add_assoc_zval_ex(stack_frame, "args", sizeof("args"), debug_backtrace_get_args(&cur_arg_pos TSRMLS_CC));
- frames_on_stack--;
- }
- }
- } else {
- /* i know this is kinda ugly, but i'm trying to avoid extra cycles in the main execution loop */
- zend_bool build_filename_arg = 1;
-
- switch (ptr->opline->op2.u.constant.value.lval) {
- case ZEND_EVAL:
- function_name = "eval";
- build_filename_arg = 0;
- break;
- case ZEND_INCLUDE:
- function_name = "include";
- break;
- case ZEND_REQUIRE:
- function_name = "require";
- break;
- case ZEND_INCLUDE_ONCE:
- function_name = "include_once";
- break;
- case ZEND_REQUIRE_ONCE:
- function_name = "require_once";
- break;
- default:
- /* this can actually happen if you use debug_backtrace() in your error_handler and
- * you're in the top-scope */
- function_name = "unknown";
- build_filename_arg = 0;
- break;
- }
-
- if (build_filename_arg && include_filename) {
- zval *arg_array;
-
- MAKE_STD_ZVAL(arg_array);
- array_init(arg_array);
-
- /* include_filename always points to the last filename of the last last called-fuction.
- if we have called include in the frame above - this is the file we have included.
- */
-
- add_next_index_string(arg_array, include_filename, 1);
- add_assoc_zval_ex(stack_frame, "args", sizeof("args"), arg_array);
- }
-
- add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
- }
-
- add_next_index_zval(return_value, stack_frame);
-
- include_filename = filename;
-
- ptr = ptr->prev_execute_data;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool extension_loaded(string extension_name)
- Returns true if the named extension is loaded */
-ZEND_FUNCTION(extension_loaded)
-{
- zval **extension_name;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &extension_name)) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(extension_name);
- if (zend_hash_exists(&module_registry, Z_STRVAL_PP(extension_name), Z_STRLEN_PP(extension_name)+1)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto array get_extension_funcs(string extension_name)
- Returns an array with the names of functions belonging to the named extension */
-ZEND_FUNCTION(get_extension_funcs)
-{
- zval **extension_name;
- zend_module_entry *module;
- zend_function_entry *func;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &extension_name)) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(extension_name);
- if (strncasecmp(Z_STRVAL_PP(extension_name), "zend", sizeof("zend"))) {
- if (zend_hash_find(&module_registry, Z_STRVAL_PP(extension_name),
- Z_STRLEN_PP(extension_name)+1, (void**)&module) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (!(func = module->functions)) {
- RETURN_FALSE;
- }
- } else {
- func = builtin_functions;
- }
-
- array_init(return_value);
-
- while (func->fname) {
- add_next_index_string(return_value, func->fname, 1);
- func++;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_builtin_functions.h b/Zend/zend_builtin_functions.h
deleted file mode 100644
index 049e11e664..0000000000
--- a/Zend/zend_builtin_functions.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_BUILTIN_FUNCTIONS_H
-#define ZEND_BUILTIN_FUNCTIONS_H
-
-int zend_startup_builtin_functions(TSRMLS_D);
-
-#endif /* ZEND_BUILTIN_FUNCTIONS_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
deleted file mode 100644
index 5bdffcbacd..0000000000
--- a/Zend/zend_compile.c
+++ /dev/null
@@ -1,3592 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend_language_parser.h"
-#include "zend.h"
-#include "zend_compile.h"
-#include "zend_constants.h"
-#include "zend_llist.h"
-#include "zend_API.h"
-#include "zend_fast_cache.h"
-
-#define IN_NAMESPACE() (CG(active_namespace) != &CG(global_namespace))
-
-ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
-
-
-#ifndef ZTS
-ZEND_API zend_compiler_globals compiler_globals;
-ZEND_API zend_executor_globals executor_globals;
-#endif
-
-static void build_runtime_defined_function_key(zval *result, char *name, int name_length, zend_op *opline TSRMLS_DC)
-{
- char lineno_buf[32];
- uint lineno_len;
- char *filename;
-
- lineno_len = zend_sprintf(lineno_buf, "%d", opline->lineno);
- if (CG(active_op_array)->filename) {
- filename = CG(active_op_array)->filename;
- } else {
- filename = "-";
- }
-
- /* NULL, name length, filename length, line number length */
- result->value.str.len = 1+name_length+strlen(filename)+lineno_len;
- result->value.str.val = (char *) emalloc(result->value.str.len+1);
- sprintf(result->value.str.val, "%c%s%s%s", '\0', name, filename, lineno_buf);
- result->type = IS_STRING;
- result->refcount = 1;
-}
-
-
-int zend_auto_global_arm(zend_auto_global *auto_global TSRMLS_DC)
-{
- auto_global->armed = (auto_global->auto_global_callback ? 1 : 0);
- return 0;
-}
-
-
-static void init_compiler_declarables(TSRMLS_D)
-{
- CG(declarables).ticks.type = IS_LONG;
- CG(declarables).ticks.value.lval = 0;
-}
-
-
-
-void zend_init_compiler_data_structures(TSRMLS_D)
-{
- zend_stack_init(&CG(bp_stack));
- zend_stack_init(&CG(function_call_stack));
- zend_stack_init(&CG(switch_cond_stack));
- zend_stack_init(&CG(foreach_copy_stack));
- zend_stack_init(&CG(object_stack));
- zend_stack_init(&CG(declare_stack));
- CG(active_class_entry) = NULL;
- CG(active_namespace) = &CG(global_namespace);
- zend_llist_init(&CG(list_llist), sizeof(list_llist_element), NULL, 0);
- zend_llist_init(&CG(dimension_llist), sizeof(int), NULL, 0);
- zend_stack_init(&CG(list_stack));
- CG(handle_op_arrays) = 1;
- CG(in_compilation) = 0;
- CG(start_lineno) = 0;
- init_compiler_declarables(TSRMLS_C);
- CG(throw_list) = NULL;
- CG(in_clone_method) = 0;
- zend_hash_apply(CG(auto_globals), (apply_func_t) zend_auto_global_arm TSRMLS_CC);
-}
-
-
-void init_compiler(TSRMLS_D)
-{
- zend_init_compiler_data_structures(TSRMLS_C);
- zend_init_rsrc_list(TSRMLS_C);
- zend_hash_init(&CG(filenames_table), 5, NULL, (dtor_func_t) free_estring, 0);
- zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) zend_file_handle_dtor, 0);
- CG(unclean_shutdown) = 0;
-}
-
-
-void shutdown_compiler(TSRMLS_D)
-{
- zend_stack_destroy(&CG(bp_stack));
- zend_stack_destroy(&CG(function_call_stack));
- zend_stack_destroy(&CG(switch_cond_stack));
- zend_stack_destroy(&CG(foreach_copy_stack));
- zend_stack_destroy(&CG(object_stack));
- zend_stack_destroy(&CG(declare_stack));
- zend_stack_destroy(&CG(list_stack));
- zend_hash_destroy(&CG(filenames_table));
- zend_llist_destroy(&CG(open_files));
-}
-
-
-ZEND_API char *zend_set_compiled_filename(char *new_compiled_filename TSRMLS_DC)
-{
- char **pp, *p;
- int length = strlen(new_compiled_filename);
-
- if (zend_hash_find(&CG(filenames_table), new_compiled_filename, length+1, (void **) &pp)==SUCCESS) {
- CG(compiled_filename) = *pp;
- return *pp;
- }
- p = estrndup(new_compiled_filename, length);
- zend_hash_update(&CG(filenames_table), new_compiled_filename, length+1, &p, sizeof(char *), (void **) &pp);
- CG(compiled_filename) = p;
- return p;
-}
-
-
-ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC)
-{
- CG(compiled_filename) = original_compiled_filename;
-}
-
-
-ZEND_API char *zend_get_compiled_filename(TSRMLS_D)
-{
- return CG(compiled_filename);
-}
-
-
-ZEND_API int zend_get_compiled_lineno(TSRMLS_D)
-{
- return CG(zend_lineno);
-}
-
-
-ZEND_API zend_bool zend_is_compiling(TSRMLS_D)
-{
- return CG(in_compilation);
-}
-
-
-static zend_uint get_temporary_variable(zend_op_array *op_array)
-{
- return (op_array->T)++ * sizeof(temp_variable);
-}
-
-
-void zend_do_fold_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC)
-{
- int (*do_op)(zval *, zval *, zval * TSRMLS_DC);
-
-#define FOLD_CASE(val, func) \
- case val: \
- do_op = func; \
- break;
-
- switch (op) {
- FOLD_CASE(ZEND_SL, shift_left_function)
- FOLD_CASE(ZEND_SR, shift_right_function)
- FOLD_CASE(ZEND_BW_OR, bitwise_or_function)
- FOLD_CASE(ZEND_BW_AND, bitwise_and_function)
- FOLD_CASE(ZEND_BW_XOR, bitwise_xor_function)
- FOLD_CASE(ZEND_CONCAT, concat_function)
- FOLD_CASE(ZEND_ADD, add_function)
- FOLD_CASE(ZEND_SUB, sub_function)
- FOLD_CASE(ZEND_MUL, mul_function)
- FOLD_CASE(ZEND_DIV, div_function)
- FOLD_CASE(ZEND_MOD, mod_function)
- FOLD_CASE(ZEND_BOOL_XOR, boolean_xor_function)
- case ZEND_BW_NOT:
- bitwise_not_function(&result->u.constant, &op1->u.constant TSRMLS_CC);
- break;
- }
-
- do_op(&result->u.constant, &op1->u.constant, &op2->u.constant TSRMLS_CC);
-}
-
-void zend_do_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = op;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *op1;
- opline->op2 = *op2;
- *result = opline->result;
-}
-
-
-void zend_do_unary_op(zend_uchar op, znode *result, znode *op1 TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = op;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *op1;
- *result = opline->result;
- SET_UNUSED(opline->op2);
-}
-
-#define MAKE_NOP(opline) { opline->opcode = ZEND_NOP; memset(&opline->result,0,sizeof(znode)); memset(&opline->op1,0,sizeof(znode)); memset(&opline->op2,0,sizeof(znode)); opline->result.op_type=opline->op1.op_type=opline->op2.op_type=IS_UNUSED; }
-
-
-static void zend_do_op_data(zend_op *data_op, znode *value TSRMLS_DC)
-{
- data_op->opcode = ZEND_OP_DATA;
- data_op->op1 = *value;
- SET_UNUSED(data_op->op2);
-}
-
-void zend_do_binary_assign_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC)
-{
- int last_op_number = get_next_op_number(CG(active_op_array))-1;
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number];
-
- if (last_op->opcode == ZEND_FETCH_OBJ_RW) {
- switch (op) {
- case ZEND_ASSIGN_ADD:
- last_op->opcode = ZEND_ASSIGN_ADD_OBJ;
- break;
- case ZEND_ASSIGN_SUB:
- last_op->opcode = ZEND_ASSIGN_SUB_OBJ;
- break;
- case ZEND_ASSIGN_MUL:
- last_op->opcode = ZEND_ASSIGN_MUL_OBJ;
- break;
- case ZEND_ASSIGN_DIV:
- last_op->opcode = ZEND_ASSIGN_DIV_OBJ;
- break;
- case ZEND_ASSIGN_MOD:
- last_op->opcode = ZEND_ASSIGN_MOD_OBJ;
- break;
- case ZEND_ASSIGN_SL:
- last_op->opcode = ZEND_ASSIGN_SL_OBJ;
- break;
- case ZEND_ASSIGN_SR:
- last_op->opcode = ZEND_ASSIGN_SR_OBJ;
- break;
- case ZEND_ASSIGN_CONCAT:
- last_op->opcode = ZEND_ASSIGN_CONCAT_OBJ;
- break;
- case ZEND_ASSIGN_BW_OR:
- last_op->opcode = ZEND_ASSIGN_BW_OR_OBJ;
- break;
- case ZEND_ASSIGN_BW_AND:
- last_op->opcode = ZEND_ASSIGN_BW_AND_OBJ;
- break;
- case ZEND_ASSIGN_BW_XOR:
- last_op->opcode = ZEND_ASSIGN_BW_XOR_OBJ;
- break;
- default:
- zend_error(E_COMPILE_ERROR, "Unknown binary op opcode %d", op);
- }
-
- zend_do_op_data(opline, op2 TSRMLS_CC);
- SET_UNUSED(opline->result);
- *result = last_op->result;
- } else {
- opline->opcode = op;
- opline->op1 = *op1;
- opline->op2 = *op2;
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
- }
-}
-
-
-void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar op TSRMLS_DC)
-{
- zend_op opline;
- zend_op *opline_ptr;
- zend_llist *fetch_list_ptr;
-
- if (bp) {
- opline_ptr = &opline;
- init_op(opline_ptr TSRMLS_CC);
- } else {
- opline_ptr = get_next_op(CG(active_op_array) TSRMLS_CC);
- }
-
- opline_ptr->opcode = op;
- opline_ptr->result.op_type = IS_VAR;
- opline_ptr->result.u.EA.type = 0;
- opline_ptr->result.u.var = get_temporary_variable(CG(active_op_array));
- opline_ptr->op1 = *varname;
- *result = opline_ptr->result;
- SET_UNUSED(opline_ptr->op2);
-
- opline_ptr->op2.u.EA.type = ZEND_FETCH_LOCAL;
- if (varname->op_type == IS_CONST && varname->u.constant.type == IS_STRING) {
- if (zend_is_auto_global(varname->u.constant.value.str.val, varname->u.constant.value.str.len TSRMLS_CC)) {
- opline_ptr->op2.u.EA.type = ZEND_FETCH_GLOBAL;
- } else {
-/* if (CG(active_op_array)->static_variables && zend_hash_exists(CG(active_op_array)->static_variables, varname->u.constant.value.str.val, varname->u.constant.value.str.len+1)) {
- opline_ptr->op2.u.EA.type = ZEND_FETCH_STATIC;
- }
-*/ }
- }
-
- if (bp) {
- zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
- zend_llist_add_element(fetch_list_ptr, opline_ptr);
- }
-}
-
-void fetch_simple_variable(znode *result, znode *varname, int bp TSRMLS_DC)
-{
- /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */
- fetch_simple_variable_ex(result, varname, bp, ZEND_FETCH_W TSRMLS_CC);
-}
-
-void zend_do_fetch_static_member(znode *class_znode TSRMLS_DC)
-{
- zend_llist *fetch_list_ptr;
- zend_llist_element *le;
- zend_op *opline_ptr;
-
- zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
- le = fetch_list_ptr->head;
-
- opline_ptr = (zend_op *)le->data;
- opline_ptr->op2 = *class_znode;
- opline_ptr->op2.u.EA.type = ZEND_FETCH_STATIC_MEMBER;
-}
-
-void fetch_array_begin(znode *result, znode *varname, znode *first_dim TSRMLS_DC)
-{
- fetch_simple_variable(result, varname, 1 TSRMLS_CC);
-
- fetch_array_dim(result, result, first_dim TSRMLS_CC);
-}
-
-
-void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC)
-{
- zend_op opline;
- zend_llist *fetch_list_ptr;
-
- init_op(&opline TSRMLS_CC);
- opline.opcode = ZEND_FETCH_DIM_W; /* the backpatching routine assumes W */
- opline.result.op_type = IS_VAR;
- opline.result.u.EA.type = 0;
- opline.result.u.var = get_temporary_variable(CG(active_op_array));
- opline.op1 = *parent;
- opline.op2 = *dim;
- opline.extended_value = ZEND_FETCH_STANDARD;
- *result = opline.result;
-
- zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
- zend_llist_add_element(fetch_list_ptr, &opline);
-}
-
-
-void fetch_string_offset(znode *result, znode *parent, znode *offset TSRMLS_DC)
-{
- fetch_array_dim(result, parent, offset TSRMLS_CC);
-}
-
-
-void zend_do_print(znode *result, znode *arg TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->opcode = ZEND_PRINT;
- opline->op1 = *arg;
- SET_UNUSED(opline->op2);
- *result = opline->result;
-}
-
-
-void zend_do_echo(znode *arg TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_ECHO;
- opline->op1 = *arg;
- SET_UNUSED(opline->op2);
-}
-
-void zend_do_abstract_method(znode *function_name, znode *modifiers, znode *body TSRMLS_DC)
-{
- char *method_type;
-
- if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) {
- modifiers->u.constant.value.lval |= ZEND_ACC_ABSTRACT;
- method_type = "Interface";
- } else {
- method_type = "Abstract";
- }
-
- if (modifiers->u.constant.value.lval & ZEND_ACC_ABSTRACT) {
- if (body->u.constant.value.lval == ZEND_ACC_ABSTRACT) {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_RAISE_ABSTRACT_ERROR;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- } else {
- /* we had code in the function body */
- zend_error(E_COMPILE_ERROR, "%s function %s::%s() cannot contain body", method_type, CG(active_class_entry)->name, function_name->u.constant.value.str.val);
- }
- } else {
- if (body->u.constant.value.lval == ZEND_ACC_ABSTRACT) {
- zend_error(E_COMPILE_ERROR, "Non-abstract method %s::%s() must contain body", CG(active_class_entry)->name, function_name->u.constant.value.str.val);
- }
- }
-}
-
-
-void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC)
-{
- int last_op_number = get_next_op_number(CG(active_op_array))-1;
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number];
-
- if (last_op->opcode == ZEND_FETCH_OBJ_W) {
- last_op->opcode = ZEND_ASSIGN_OBJ;
-
- zend_do_op_data(opline, value TSRMLS_CC);
- SET_UNUSED(opline->result);
- *result = last_op->result;
- } else {
- opline->opcode = ZEND_ASSIGN;
- opline->op1 = *variable;
- opline->op2 = *value;
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
- }
-}
-
-
-void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_ASSIGN_REF;
- if (result) {
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
- } else {
- /* SET_UNUSED(opline->result); */
- opline->result.u.EA.type |= EXT_TYPE_UNUSED;
- }
- opline->op1 = *lvar;
- opline->op2 = *rvar;
-}
-
-
-static inline void do_begin_loop(TSRMLS_D)
-{
- zend_brk_cont_element *brk_cont_element;
- int parent;
-
- parent = CG(active_op_array)->current_brk_cont;
- CG(active_op_array)->current_brk_cont = CG(active_op_array)->last_brk_cont;
- brk_cont_element = get_next_brk_cont_element(CG(active_op_array));
- brk_cont_element->parent = parent;
-}
-
-
-static inline void do_end_loop(int cont_addr TSRMLS_DC)
-{
- CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].cont = cont_addr;
- CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].brk = get_next_op_number(CG(active_op_array));
- CG(active_op_array)->current_brk_cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].parent;
-}
-
-
-void zend_do_while_cond(znode *expr, znode *close_bracket_token TSRMLS_DC)
-{
- int while_cond_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMPZ;
- opline->op1 = *expr;
- close_bracket_token->u.opline_num = while_cond_op_number;
- SET_UNUSED(opline->op2);
-
- do_begin_loop(TSRMLS_C);
- INC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_while_end(znode *while_token, znode *close_bracket_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- /* add unconditional jump */
- opline->opcode = ZEND_JMP;
- opline->op1.u.opline_num = while_token->u.opline_num;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-
- /* update while's conditional jmp */
- CG(active_op_array)->opcodes[close_bracket_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
-
- do_end_loop(while_token->u.opline_num TSRMLS_CC);
-
- DEC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_for_cond(znode *expr, znode *second_semicolon_token TSRMLS_DC)
-{
- int for_cond_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMPZNZ;
- opline->op1 = *expr; /* the conditional expression */
- second_semicolon_token->u.opline_num = for_cond_op_number;
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_for_before_statement(znode *cond_start, znode *second_semicolon_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMP;
- opline->op1.u.opline_num = cond_start->u.opline_num;
- CG(active_op_array)->opcodes[second_semicolon_token->u.opline_num].extended_value = get_next_op_number(CG(active_op_array));
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-
- do_begin_loop(TSRMLS_C);
-
- INC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_for_end(znode *second_semicolon_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMP;
- opline->op1.u.opline_num = second_semicolon_token->u.opline_num+1;
- CG(active_op_array)->opcodes[second_semicolon_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-
- do_end_loop(second_semicolon_token->u.opline_num+1 TSRMLS_CC);
-
- DEC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_pre_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC)
-{
- int last_op_number = get_next_op_number(CG(active_op_array))-1;
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number];
-
- if (last_op->opcode == ZEND_FETCH_OBJ_RW) {
- opline->opcode = (op==ZEND_PRE_INC)?ZEND_PRE_INC_OBJ:ZEND_PRE_DEC_OBJ;
- opline->op1 = last_op->op1;
- opline->op2 = last_op->op2;
-
- MAKE_NOP(last_op);
- } else {
- opline->opcode = op;
- opline->op1 = *op1;
- SET_UNUSED(opline->op2);
- }
-
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
-}
-
-
-void zend_do_post_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC)
-{
- int last_op_number = get_next_op_number(CG(active_op_array))-1;
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number];
-
- if (last_op->opcode == ZEND_FETCH_OBJ_RW) {
- opline->opcode = (op==ZEND_POST_INC)?ZEND_POST_INC_OBJ:ZEND_POST_DEC_OBJ;
- opline->op1 = last_op->op1;
- opline->op2 = last_op->op2;
-
- MAKE_NOP(last_op);
- } else {
- opline->opcode = op;
- opline->op1 = *op1;
- SET_UNUSED(opline->op2);
- }
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
-}
-
-
-void zend_do_if_cond(znode *cond, znode *closing_bracket_token TSRMLS_DC)
-{
- int if_cond_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMPZ;
- opline->op1 = *cond;
- closing_bracket_token->u.opline_num = if_cond_op_number;
- SET_UNUSED(opline->op2);
- INC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_if_after_statement(znode *closing_bracket_token, unsigned char initialize TSRMLS_DC)
-{
- int if_end_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- zend_llist *jmp_list_ptr;
-
- opline->opcode = ZEND_JMP;
- /* save for backpatching */
- if (initialize) {
- zend_llist jmp_list;
-
- zend_llist_init(&jmp_list, sizeof(int), NULL, 0);
- zend_stack_push(&CG(bp_stack), (void *) &jmp_list, sizeof(zend_llist));
- }
- zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr);
- zend_llist_add_element(jmp_list_ptr, &if_end_op_number);
-
- CG(active_op_array)->opcodes[closing_bracket_token->u.opline_num].op2.u.opline_num = if_end_op_number+1;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_if_end(TSRMLS_D)
-{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_llist *jmp_list_ptr;
- zend_llist_element *le;
-
- zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr);
- for (le=jmp_list_ptr->head; le; le = le->next) {
- CG(active_op_array)->opcodes[*((int *) le->data)].op1.u.opline_num = next_op_number;
- }
- zend_llist_destroy(jmp_list_ptr);
- zend_stack_del_top(&CG(bp_stack));
- DEC_BPC(CG(active_op_array));
-}
-
-#if 0
-/* variable parsing type (compile-time) */
-#define ZEND_PARSED_MEMBER (1<<0)
-#define ZEND_PARSED_METHOD_CALL (1<<1)
-#define ZEND_PARSED_STATIC_MEMBER (1<<2)
-#define ZEND_PARSED_FUNCTION_CALL (1<<3)
-#define ZEND_PARSED_VARIABLE (1<<4)
-
-#endif
-
-void zend_check_writable_variable(znode *variable)
-{
- zend_uint type = variable->u.EA.type;
-
- if (type & ZEND_PARSED_METHOD_CALL) {
- zend_error(E_COMPILE_ERROR, "Can't use method return value in write context");
- }
- if (type == ZEND_PARSED_FUNCTION_CALL) {
- zend_error(E_COMPILE_ERROR, "Can't use function return value in write context");
- }
-}
-
-zend_bool zend_is_function_or_method_call(znode *variable)
-{
- zend_uint type = variable->u.EA.type;
-
- return ((type & ZEND_PARSED_METHOD_CALL) || (type == ZEND_PARSED_FUNCTION_CALL));
-}
-
-
-void zend_do_begin_import(TSRMLS_D)
-{
- zend_llist_init(&CG(import_commands), sizeof(zend_op), NULL, 0);
-}
-
-
-void zend_do_import(int type, znode *what TSRMLS_DC)
-{
- zend_op opline;
-
- init_op(&opline TSRMLS_CC);
-
- switch (type) {
- case T_FUNCTION:
- opline.opcode = ZEND_IMPORT_FUNCTION;
- break;
- case T_CLASS:
- opline.opcode = ZEND_IMPORT_CLASS;
- break;
- case T_CONST:
- opline.opcode = ZEND_IMPORT_CONST;
- break;
- }
-
- if (what) {
- if (type == T_FUNCTION || type == T_CLASS) {
- zend_str_tolower(what->u.constant.value.str.val, what->u.constant.value.str.len);
- }
- opline.op2 = *what;
- } else {
- SET_UNUSED(opline.op2);
- }
-
- zend_llist_add_element(&CG(import_commands), &opline);
-}
-
-
-void zend_do_end_import(znode *import_from TSRMLS_DC)
-{
- zend_llist_element *le;
- zend_op *opline, *opline_ptr;
-
- le = CG(import_commands).head;
-
- while (le) {
- opline_ptr = (zend_op *)le->data;
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- memcpy(opline, opline_ptr, sizeof(zend_op));
- opline->op1 = *import_from;
- le = le->next;
- }
- zend_llist_destroy(&CG(import_commands));
-}
-
-
-void zend_do_begin_variable_parse(TSRMLS_D)
-{
- zend_llist fetch_list;
-
- zend_llist_init(&fetch_list, sizeof(zend_op), NULL, 0);
- zend_stack_push(&CG(bp_stack), (void *) &fetch_list, sizeof(zend_llist));
-}
-
-
-void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC)
-{
- zend_llist *fetch_list_ptr;
- zend_llist_element *le;
- zend_op *opline, *opline_ptr=NULL;
- int num_of_created_opcodes = 0;
-
- zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
-
- le = fetch_list_ptr->head;
-
- while (le) {
- opline_ptr = (zend_op *)le->data;
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- memcpy(opline, opline_ptr, sizeof(zend_op));
- switch (type) {
- case BP_VAR_R:
- if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) {
- zend_error(E_COMPILE_ERROR, "Cannot use [] for reading");
- }
- opline->opcode -= 3;
- break;
- case BP_VAR_W:
- break;
- case BP_VAR_RW:
- opline->opcode += 3;
- break;
- case BP_VAR_IS:
- opline->opcode += 6; /* 3+3 */
- break;
- case BP_VAR_FUNC_ARG:
- opline->opcode += 9; /* 3+3+3 */
- opline->extended_value = arg_offset;
- break;
- case BP_VAR_UNSET:
- if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) {
- zend_error(E_COMPILE_ERROR, "Cannot use [] for unsetting");
- }
- opline->opcode += 12; /* 3+3+3+3 */
- break;
- }
- le = le->next;
- num_of_created_opcodes++;
- }
-
- if (num_of_created_opcodes == 1) {
- if ((opline_ptr->op1.op_type == IS_CONST) && (opline_ptr->op1.u.constant.type == IS_STRING) &&
- (opline_ptr->op1.u.constant.value.str.len == (sizeof("this")-1)) &&
- !memcmp(opline_ptr->op1.u.constant.value.str.val, "this", sizeof("this"))) {
- CG(active_op_array)->uses_this = 1;
- }
- }
-
- zend_llist_destroy(fetch_list_ptr);
- zend_stack_del_top(&CG(bp_stack));
-}
-
-
-void zend_do_init_string(znode *result TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_INIT_STRING;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_add_char(znode *result, znode *op1, znode *op2 TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_ADD_CHAR;
- opline->op1 = *op1;
- opline->op2 = *op2;
- opline->op2.op_type = IS_CONST;
- opline->result = opline->op1;
- *result = opline->result;
-}
-
-
-void zend_do_add_string(znode *result, znode *op1, znode *op2 TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_ADD_STRING;
- opline->op1 = *op1;
- opline->op2 = *op2;
- opline->op2.op_type = IS_CONST;
- opline->result = opline->op1;
- *result = opline->result;
-}
-
-
-void zend_do_add_variable(znode *result, znode *op1, znode *op2 TSRMLS_DC)
-{
- zend_op *opline;
-
- if (op1->op_type == IS_CONST) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_INIT_STRING;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-
- if (op1->u.constant.value.str.len>0) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_ADD_STRING;
- opline->result = *result;
- opline->op1 = *result;
- opline->op2 = *op1;
- opline->result = opline->op1;
- } else {
- zval_dtor(&op1->u.constant);
- }
- } else {
- *result = *op1;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_ADD_VAR;
- opline->result = *result;
- opline->op1 = *result;
- opline->op2 = *op2;
- *result = opline->result;
-}
-
-static void zend_lowercase_znode_if_const(znode *z)
-{
- if (z->op_type == IS_CONST) {
- zend_str_tolower(z->u.constant.value.str.val, z->u.constant.value.str.len);
- }
-}
-
-void zend_do_free(znode *op1 TSRMLS_DC)
-{
- if (op1->op_type==IS_TMP_VAR) {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_FREE;
- opline->op1 = *op1;
- SET_UNUSED(opline->op2);
- } else if (op1->op_type==IS_VAR) {
- zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
-
- while (opline->opcode == ZEND_END_SILENCE || opline->opcode == ZEND_EXT_FCALL_END || opline->opcode == ZEND_OP_DATA) {
- opline--;
- }
- if (opline->result.op_type == op1->op_type
- && opline->result.u.var == op1->u.var) {
- opline->result.u.EA.type |= EXT_TYPE_UNUSED;
- } else {
- while (opline>CG(active_op_array)->opcodes) {
- /* This should be an object instantiation
- * Find JMP_NO_CTOR, mark the preceding ASSIGN and the
- * proceeding INIT_FCALL_BY_NAME as unused
- */
- if (opline->opcode == ZEND_JMP_NO_CTOR) {
- (opline-1)->result.u.EA.type |= EXT_TYPE_UNUSED;
- (opline+1)->op1.u.EA.type |= EXT_TYPE_UNUSED;
- break;
- } else if (opline->opcode == ZEND_FETCH_DIM_R
- && opline->op1.op_type == IS_VAR
- && opline->op1.u.var == op1->u.var) {
- /* This should the end of a list() construct
- * Mark its result as unused
- */
- opline->extended_value = ZEND_FETCH_STANDARD;
- break;
- } else if (opline->result.op_type==IS_VAR
- && opline->result.u.var == op1->u.var) {
- break;
- }
- opline--;
- }
- }
- } else if (op1->op_type == IS_CONST) {
- zval_dtor(&op1->u.constant);
- }
-}
-
-
-int zend_do_verify_access_types(znode *current_access_type, znode *new_modifier)
-{
- if ((current_access_type->u.constant.value.lval & ZEND_ACC_PPP_MASK)
- && (new_modifier->u.constant.value.lval & ZEND_ACC_PPP_MASK)
- && ((current_access_type->u.constant.value.lval & ZEND_ACC_PPP_MASK) != (new_modifier->u.constant.value.lval & ZEND_ACC_PPP_MASK))) {
- zend_error(E_COMPILE_ERROR, "Multiple access type modifiers are not allowed");
- }
- if (((current_access_type->u.constant.value.lval | new_modifier->u.constant.value.lval) & (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) == (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) {
- zend_error(E_COMPILE_ERROR, "Cannot use the final modifier on an abstract class member");
- }
- if (((current_access_type->u.constant.value.lval | new_modifier->u.constant.value.lval) & (ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)) == (ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)) {
- zend_error(E_COMPILE_ERROR, "Cannot use the final modifier on a private class member");
- }
- return (current_access_type->u.constant.value.lval | new_modifier->u.constant.value.lval);
-}
-
-
-void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC)
-{
- zend_op_array op_array;
- char *name = function_name->u.constant.value.str.val;
- int name_len = function_name->u.constant.value.str.len;
- int function_begin_line = function_token->u.opline_num;
- zend_uint fn_flags;
-
- if (is_method) {
- if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) {
- if (!(fn_flags_znode->u.constant.value.lval & ZEND_ACC_PUBLIC)) {
- zend_error(E_COMPILE_ERROR, "Access type for interface method %s::%s() must be omitted or declared public", CG(active_class_entry)->name, function_name->u.constant.value.str.val);
- }
- fn_flags_znode->u.constant.value.lval |= ZEND_ACC_ABSTRACT; /* propagates to the rest of the parser */
- }
- fn_flags = fn_flags_znode->u.constant.value.lval; /* must be done *after* the above check */
- } else {
- fn_flags = 0;
- }
-
- function_token->u.op_array = CG(active_op_array);
- zend_str_tolower(name, name_len);
-
- init_op_array(&op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
-
- op_array.function_name = name;
- op_array.arg_types = NULL;
- op_array.return_reference = return_reference;
- op_array.fn_flags = fn_flags;
-
- op_array.scope = CG(active_class_entry);
- op_array.ns = CG(active_namespace);
- op_array.prototype = NULL;
-
- op_array.line_start = zend_get_compiled_lineno(TSRMLS_C);
-
- if (is_method) {
- char *short_class_name = CG(active_class_entry)->name;
- int short_class_name_length = CG(active_class_entry)->name_length;
- zend_uint i;
-
- for (i=0; i < CG(active_class_entry)->name_length; i++) {
- if (CG(active_class_entry)->name[i] == ':') {
- short_class_name = &CG(active_class_entry)->name[i+1];
- short_class_name_length = strlen(short_class_name);
- }
- }
- if (zend_hash_add(&CG(active_class_entry)->function_table, name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)) == FAILURE) {
- zend_op_array *child_op_array, *parent_op_array;
- if (CG(active_class_entry)->parent
- && (zend_hash_find(&CG(active_class_entry)->function_table, name, name_len+1, (void **) &child_op_array) == SUCCESS)
- && (zend_hash_find(&CG(active_class_entry)->parent->function_table, name, name_len+1, (void **) &parent_op_array) == SUCCESS)
- && (child_op_array == parent_op_array)) {
- zend_hash_update(&CG(active_class_entry)->function_table, name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array));
- } else {
- zend_error(E_COMPILE_ERROR, "Cannot redeclare %s::%s()", CG(active_class_entry)->name, name);
- }
- }
-
- if (fn_flags & ZEND_ACC_ABSTRACT) {
- CG(active_class_entry)->ce_flags |= ZEND_ACC_ABSTRACT;
- }
-
- if (!(fn_flags & ZEND_ACC_PPP_MASK)) {
- fn_flags |= ZEND_ACC_PUBLIC;
- }
-
- if ((short_class_name_length == name_len) && (!memcmp(short_class_name, name, name_len)) && !CG(active_class_entry)->constructor) {
- CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) {
- CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)))) {
- CG(active_class_entry)->destructor = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)))) {
- CG(active_class_entry)->clone = (zend_function *) CG(active_op_array);
- CG(in_clone_method) = 1;
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)))) {
- CG(active_class_entry)->__call = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)))) {
- CG(active_class_entry)->__get = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)))) {
- CG(active_class_entry)->__set = (zend_function *) CG(active_op_array);
- }
- } else if(IN_NAMESPACE()) {
- if (zend_hash_add(&CG(active_namespace)->function_table, name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)) == FAILURE) {
- zend_error(E_COMPILE_ERROR, "Cannot redeclare %s::%s()", CG(active_namespace)->name, name);
- }
- } else {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_DECLARE_FUNCTION;
- opline->op1.op_type = IS_CONST;
- build_runtime_defined_function_key(&opline->op1.u.constant, function_name->u.constant.value.str.val, function_name->u.constant.value.str.len, opline TSRMLS_CC);
- opline->op2.op_type = IS_CONST;
- opline->op2.u.constant.type = IS_STRING;
- opline->op2.u.constant.value.str.val = estrndup(name, name_len);
- opline->op2.u.constant.value.str.len = name_len;
- opline->op2.u.constant.refcount = 1;
- opline->extended_value = ZEND_DECLARE_FUNCTION;
- zend_hash_update(CG(function_table), opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array));
- }
-
- if (CG(extended_info)) {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_EXT_NOP;
- opline->lineno = function_begin_line;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- }
-
- {
- /* Push a seperator to the switch and foreach stacks */
- zend_switch_entry switch_entry;
-
- switch_entry.cond.op_type = IS_UNUSED;
- switch_entry.default_case = 0;
- switch_entry.control_var = 0;
-
- zend_stack_push(&CG(switch_cond_stack), (void *) &switch_entry, sizeof(switch_entry));
-
- zend_stack_push(&CG(foreach_copy_stack), (void *) &switch_entry.cond, sizeof(znode));
- }
- function_token->throw_list = CG(throw_list);
- CG(throw_list) = NULL;
-
- if (CG(doc_comment)) {
- CG(active_op_array)->doc_comment = estrndup(CG(doc_comment), CG(doc_comment_len));
- CG(active_op_array)->doc_comment_len = CG(doc_comment_len);
- RESET_DOC_COMMENT();
- }
-}
-
-
-void zend_do_end_function_declaration(znode *function_token TSRMLS_DC)
-{
- zend_do_extended_info(TSRMLS_C);
- zend_do_return(NULL, 0 TSRMLS_CC);
- pass_two(CG(active_op_array) TSRMLS_CC);
- CG(active_op_array)->line_end = zend_get_compiled_lineno(TSRMLS_C);
- CG(active_op_array) = function_token->u.op_array;
-
- /* Pop the switch and foreach seperators */
- zend_stack_del_top(&CG(switch_cond_stack));
- zend_stack_del_top(&CG(foreach_copy_stack));
-
- CG(throw_list) = function_token->throw_list;
-
- CG(in_clone_method) = 0;
-}
-
-
-void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initialization, znode *class_type, zend_uchar pass_type TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = op;
- opline->result = *var;
- opline->op1 = *offset;
- if ((op == ZEND_RECV_INIT)) {
- opline->op2 = *initialization;
- } else {
- SET_UNUSED(opline->op2);
- }
- if (!CG(active_op_array)->arg_types) {
- if (pass_type==BYREF_FORCE) {
- int i;
-
- CG(active_op_array)->arg_types = (unsigned char *) emalloc(sizeof(unsigned char)*(offset->u.constant.value.lval+1));
- for (i=1; i<offset->u.constant.value.lval; i++) {
- CG(active_op_array)->arg_types[i] = BYREF_NONE;
- }
- CG(active_op_array)->arg_types[0]=(unsigned char) offset->u.constant.value.lval;
- CG(active_op_array)->arg_types[offset->u.constant.value.lval] = pass_type;
- }
- } else {
- CG(active_op_array)->arg_types = (unsigned char *) erealloc(CG(active_op_array)->arg_types, sizeof(unsigned char)*(offset->u.constant.value.lval+1));
- CG(active_op_array)->arg_types[0]=(unsigned char) offset->u.constant.value.lval;
- CG(active_op_array)->arg_types[offset->u.constant.value.lval] = pass_type;
- }
-
- if (class_type->op_type != IS_UNUSED) {
- znode passed_var = opline->result;
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_VERIFY_INSTANCEOF;
- opline->op1 = *class_type;
- opline->op2 = passed_var;
- opline->extended_value = offset->u.constant.value.lval;
- } else {
- opline->result.u.EA.type |= EXT_TYPE_UNUSED;
- }
-}
-
-
-int zend_do_begin_function_call(znode *function_name TSRMLS_DC)
-{
- zend_function *function;
-
- zend_str_tolower(function_name->u.constant.value.str.val, function_name->u.constant.value.str.len);
- if (zend_hash_find(CG(function_table), function_name->u.constant.value.str.val, function_name->u.constant.value.str.len+1, (void **) &function)==FAILURE) {
- zend_do_begin_dynamic_function_call(function_name TSRMLS_CC);
- return 1; /* Dynamic */
- }
-
- switch (function->type) {
- case ZEND_USER_FUNCTION: {
- zend_op_array *op_array = (zend_op_array *) function;
-
- zend_stack_push(&CG(function_call_stack), (void *) &op_array, sizeof(zend_function *));
- }
- break;
- case ZEND_INTERNAL_FUNCTION: {
- zend_internal_function *internal_function = (zend_internal_function *) function;
-
- zend_stack_push(&CG(function_call_stack), (void *) &internal_function, sizeof(zend_function *));
- }
- break;
- }
- zend_do_extended_fcall_begin(TSRMLS_C);
- return 0;
-}
-
-
-
-void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC)
-{
- zend_op *last_op;
- int last_op_number;
- unsigned char *ptr = NULL;
-
- zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC);
- zend_do_begin_variable_parse(TSRMLS_C);
-
- last_op_number = get_next_op_number(CG(active_op_array))-1;
- last_op = &CG(active_op_array)->opcodes[last_op_number];
-
- if ((last_op->op2.op_type == IS_CONST) && (last_op->op2.u.constant.value.str.len == sizeof(ZEND_CLONE_FUNC_NAME)-1)
- && !memcmp(last_op->op2.u.constant.value.str.val, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME))) {
- last_op->opcode = ZEND_CLONE;
- left_bracket->u.constant.value.lval = ZEND_CLONE;
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
- zend_do_extended_fcall_begin(TSRMLS_C);
- return;
- }
-
- last_op->opcode = ZEND_INIT_METHOD_CALL;
-
- left_bracket->u.constant.value.lval = ZEND_INIT_FCALL_BY_NAME;
-
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
- zend_do_extended_fcall_begin(TSRMLS_C);
-}
-
-
-void zend_do_begin_dynamic_function_call(znode *function_name TSRMLS_DC)
-{
- unsigned char *ptr = NULL;
- zend_op *opline;
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_INIT_FCALL_BY_NAME;
- opline->op2 = *function_name;
- opline->extended_value = 0;
- SET_UNUSED(opline->op1);
-
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
- zend_do_extended_fcall_begin(TSRMLS_C);
-}
-
-
-void zend_do_fetch_class(znode *result, znode *namespace_name, znode *class_name, zend_bool global_namespace TSRMLS_DC)
-{
- long fetch_class_op_number;
- zend_op *opline;
-
- fetch_class_op_number = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_FETCH_CLASS;
- if (namespace_name) {
- zend_str_tolower(namespace_name->u.constant.value.str.val, namespace_name->u.constant.value.str.len);
- opline->op1 = *namespace_name;
- } else {
- SET_UNUSED(opline->op1);
- if (global_namespace) {
- opline->extended_value = ZEND_FETCH_CLASS_GLOBAL;
- }
- }
- CG(catch_begin) = fetch_class_op_number;
- if (class_name->op_type == IS_CONST) {
- zend_str_tolower(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len);
- if ((class_name->u.constant.value.str.len == (sizeof("self") - 1)) &&
- !memcmp(class_name->u.constant.value.str.val, "self", sizeof("self"))) {
- SET_UNUSED(opline->op2);
- opline->extended_value = ZEND_FETCH_CLASS_SELF;
- zval_dtor(&class_name->u.constant);
- } else if ((class_name->u.constant.value.str.len == (sizeof("parent") - 1)) &&
- !memcmp(class_name->u.constant.value.str.val, "parent", sizeof("parent"))) {
- SET_UNUSED(opline->op2);
- opline->extended_value = ZEND_FETCH_CLASS_PARENT;
- zval_dtor(&class_name->u.constant);
- } else {
- opline->op2 = *class_name;
- }
- } else {
- opline->op2 = *class_name;
- }
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_CONST; /* FIXME: Hack so that INIT_FCALL_BY_NAME still knows this is a class */
- *result = opline->result;
-}
-
-
-void zend_do_fetch_class_name(znode *result, znode *class_name_entry, znode *class_name, zend_bool case_sensitive TSRMLS_DC)
-{
- zend_uint length;
-
- if (!result) {
- result = class_name_entry;
- } else {
- *result = *class_name_entry;
- }
- if (!case_sensitive) {
- zend_str_tolower(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len);
- }
-
- length = sizeof("::")-1 + result->u.constant.value.str.len + class_name->u.constant.value.str.len;
- result->u.constant.value.str.val = erealloc(result->u.constant.value.str.val, length+1);
- memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len], "::", sizeof("::")-1);
- memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len + sizeof("::")-1], class_name->u.constant.value.str.val, class_name->u.constant.value.str.len+1);
- STR_FREE(class_name->u.constant.value.str.val);
- result->u.constant.value.str.len = length;
-}
-
-void zend_do_begin_class_member_function_call(TSRMLS_D)
-{
- unsigned char *ptr = NULL;
- long fetch_const_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = &CG(active_op_array)->opcodes[fetch_const_op_number-1];
-
- /* a tmp var is leaked here */
- opline->opcode = ZEND_INIT_STATIC_METHOD_CALL;
- zend_lowercase_znode_if_const(&opline->op2);
-
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
-}
-
-
-void zend_do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC)
-{
- zend_op *opline;
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- if (!is_method && !is_dynamic_fcall && function_name->op_type==IS_CONST) {
- opline->opcode = ZEND_DO_FCALL;
- opline->op1 = *function_name;
- } else {
- opline->opcode = ZEND_DO_FCALL_BY_NAME;
- SET_UNUSED(opline->op1);
- }
-
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_VAR;
- *result = opline->result;
- SET_UNUSED(opline->op2);
-
- /* Check how much this is really needed
- opline->op2.u.constant.value.lval = is_method;
- */
- if (CG(throw_list) != NULL) {
- long op_number = get_next_op_number(CG(active_op_array))-1;
- zend_llist_add_element(CG(throw_list), &op_number);
- } else {
- opline->op2.u.opline_num = -1;
- }
-
- zend_stack_del_top(&CG(function_call_stack));
- opline->extended_value = argument_list->u.constant.value.lval;
-}
-
-
-void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC)
-{
- zend_op *opline;
- unsigned char *arg_types;
- int original_op=op;
- zend_function **function_ptr_ptr, *function_ptr;
- int send_by_reference;
-
-
- zend_stack_top(&CG(function_call_stack), (void **) &function_ptr_ptr);
- function_ptr = *function_ptr_ptr;
-
- if (original_op==ZEND_SEND_REF
- && !CG(allow_call_time_pass_reference)) {
- zend_error(E_COMPILE_WARNING,
- "Call-time pass-by-reference has been deprecated - argument passed by value; "
- "If you would like to pass it by reference, modify the declaration of %s(). "
- "If you would like to enable call-time pass-by-reference, you can set "
- "allow_call_time_pass_reference to true in your INI file. "
- "However, future versions may not support this any longer. ",
- (function_ptr?function_ptr->common.function_name:"[runtime function name]"),
- offset+1);
- }
-
- if (function_ptr) {
- arg_types = function_ptr->common.arg_types;
- } else {
- arg_types = NULL;
- }
-
- send_by_reference = ARG_SHOULD_BE_SENT_BY_REF(offset, 1, arg_types)?ZEND_ARG_SEND_BY_REF:0;
-
-
- if (op == ZEND_SEND_VAR && zend_is_function_or_method_call(param)) {
- /* Method call */
- op = ZEND_SEND_VAR_NO_REF;
- } else if (op == ZEND_SEND_VAL && param->op_type == IS_VAR) {
- op = ZEND_SEND_VAR_NO_REF;
- }
-
- if (op!=ZEND_SEND_VAR_NO_REF && send_by_reference == ZEND_ARG_SEND_BY_REF) {
- /* change to passing by reference */
- switch (param->op_type) {
- case IS_VAR:
- op = ZEND_SEND_REF;
- break;
- default:
- zend_error(E_COMPILE_ERROR, "Only variables can be passed by reference");
- break;
- }
- }
-
- if (original_op == ZEND_SEND_VAR) {
- switch (op) {
- case ZEND_SEND_VAR_NO_REF:
- zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC);
- break;
- case ZEND_SEND_VAR:
- if (function_ptr) {
- zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC);
- } else {
- zend_do_end_variable_parse(BP_VAR_FUNC_ARG, offset TSRMLS_CC);
- }
- break;
- case ZEND_SEND_REF:
- zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
- break;
- }
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- if (op == ZEND_SEND_VAR_NO_REF) {
- if (function_ptr) {
- opline->extended_value = ZEND_ARG_COMPILE_TIME_BOUND | send_by_reference;
- } else {
- opline->extended_value = 0;
- }
- } else {
- if (function_ptr) {
- opline->extended_value = ZEND_DO_FCALL;
- } else {
- opline->extended_value = ZEND_DO_FCALL_BY_NAME;
- }
- }
- opline->opcode = op;
- opline->op1 = *param;
- opline->op2.u.opline_num = offset;
- SET_UNUSED(opline->op2);
-}
-
-
-static int generate_free_switch_expr(zend_switch_entry *switch_entry TSRMLS_DC)
-{
- zend_op *opline;
-
- if (switch_entry->cond.op_type!=IS_VAR && switch_entry->cond.op_type!=IS_TMP_VAR) {
- return 1;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_SWITCH_FREE;
- opline->op1 = switch_entry->cond;
- SET_UNUSED(opline->op2);
- opline->extended_value = 0;
- return 0;
-}
-
-static int generate_free_foreach_copy(znode *foreach_copy TSRMLS_DC)
-{
- zend_op *opline;
-
- if (foreach_copy->op_type!=IS_VAR && foreach_copy->op_type!=IS_TMP_VAR) {
- return 1;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_SWITCH_FREE;
- opline->op1 = *foreach_copy;
- SET_UNUSED(opline->op2);
- opline->extended_value = 1;
- return 0;
-}
-
-void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC)
-{
- zend_op *opline;
-
- if (do_end_vparse) {
- if (CG(active_op_array)->return_reference && !zend_is_function_or_method_call(expr)) {
- zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
- } else {
- zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC);
- }
-#if 0
- } else if (expr && CG(active_op_array)->return_reference) {
- zend_error(E_COMPILE_ERROR, "Only variables may be returned by reference");
-#endif
- }
-
-#ifdef ZTS
- zend_stack_apply_with_argument(&CG(switch_cond_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element, void *)) generate_free_switch_expr TSRMLS_CC);
- zend_stack_apply_with_argument(&CG(foreach_copy_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element, void *)) generate_free_foreach_copy TSRMLS_CC);
-#else
- zend_stack_apply(&CG(switch_cond_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element)) generate_free_switch_expr);
- zend_stack_apply(&CG(foreach_copy_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element)) generate_free_foreach_copy);
-#endif
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_RETURN;
-
- if (expr) {
- opline->op1 = *expr;
- } else {
- opline->op1.op_type = IS_CONST;
- INIT_ZVAL(opline->op1.u.constant);
- }
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_try(znode *try_token TSRMLS_DC)
-{
- try_token->throw_list = (void *) CG(throw_list);
- CG(throw_list) = (zend_llist *) emalloc(sizeof(zend_llist));
- zend_llist_init(CG(throw_list), sizeof(long), NULL, 0);
- /* Initialize try backpatch list used to backpatch throw, do_fcall */
-}
-
-static void throw_list_applier(long *opline_num, long *catch_opline)
-{
- zend_op *opline;
- TSRMLS_FETCH(); /* Pass this by argument */
-
- opline = &CG(active_op_array)->opcodes[*opline_num];
-
- /* Backpatch the opline of the catch statement */
- switch (opline->opcode) {
- case ZEND_DO_FCALL:
- case ZEND_DO_FCALL_BY_NAME:
- case ZEND_THROW:
- opline->op2.u.opline_num = *catch_opline;
- break;
- default:
- zend_error(E_COMPILE_ERROR, "Bad opcode in throw list");
- break;
- }
-}
-
-void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, zend_bool first_catch TSRMLS_DC)
-{
- long catch_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline;
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_CATCH;
- opline->op1 = *catch_class;
- SET_UNUSED(opline->op1); /* FIXME: Define IS_CLASS or something like that */
- opline->op2 = *catch_var;
-
- if (first_catch) {
- zend_llist_apply_with_argument(CG(throw_list), (llist_apply_with_arg_func_t) throw_list_applier, &CG(catch_begin) TSRMLS_CC);
- zend_llist_destroy(CG(throw_list));
- efree(CG(throw_list));
- CG(throw_list) = (void *) try_token->throw_list;
- }
- try_token->u.opline_num = catch_op_number;
-}
-
-void zend_do_end_catch(znode *try_token TSRMLS_DC)
-{
- CG(active_op_array)->opcodes[try_token->u.opline_num].extended_value = get_next_op_number(CG(active_op_array));
-}
-
-void zend_do_throw(znode *expr TSRMLS_DC)
-{
- zend_op *opline;
- long throw_op_number = get_next_op_number(CG(active_op_array));
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_THROW;
- opline->op1 = *expr;
- SET_UNUSED(opline->op2);
-
- if (CG(throw_list) != NULL) {
- zend_llist_add_element(CG(throw_list), &throw_op_number);
- } else {
- opline->op2.u.opline_num = -1;
- }
-}
-
-ZEND_API void function_add_ref(zend_function *function)
-{
- if (function->type == ZEND_USER_FUNCTION) {
- zend_op_array *op_array = &function->op_array;
-
- (*op_array->refcount)++;
- if (op_array->static_variables) {
- HashTable *static_variables = op_array->static_variables;
- zval *tmp_zval;
-
- ALLOC_HASHTABLE(op_array->static_variables);
- zend_hash_init(op_array->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(op_array->static_variables, static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_zval, sizeof(zval *));
- }
- }
-}
-
-static void do_inherit_parent_constructor(zend_class_entry *ce)
-{
- zend_function *function;
-
- if (!ce->parent) {
- return;
- }
- if (!ce->__get) {
- ce->__get = ce->parent->__get;
- }
- if (!ce->__set) {
- ce->__set = ce->parent->__set;
- }
- if (!ce->__call) {
- ce->__call = ce->parent->__call;
- }
- ce->create_object = ce->parent->create_object;
- if (ce->constructor) {
- return;
- }
-
- if (zend_hash_find(&ce->parent->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME), (void **) &function)==SUCCESS) {
- /* inherit parent's constructor */
- zend_hash_update(&ce->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME), function, sizeof(zend_function), NULL);
- function_add_ref(function);
- } else {
- /* don't inherit the old style constructor if we already have the new style cconstructor */
- if (!zend_hash_exists(&ce->function_table, ce->name, ce->name_length+1)) {
- if (zend_hash_find(&ce->parent->function_table, ce->parent->name, ce->parent->name_length+1, (void **) &function)==SUCCESS) {
- /* inherit parent's constructor */
- zend_hash_update(&ce->function_table, ce->name, ce->name_length+1, function, sizeof(zend_function), NULL);
- function_add_ref(function);
- }
- }
- }
- ce->constructor = ce->parent->constructor;
-}
-
-
-char *zend_visibility_string(zend_uint fn_flags)
-{
- if (fn_flags & ZEND_ACC_PRIVATE) {
- return "private";
- }
- if (fn_flags & ZEND_ACC_PROTECTED) {
- return "protected";
- }
- if (fn_flags & ZEND_ACC_PUBLIC) {
- return "public";
- }
- return "";
-}
-
-
-static void do_inherit_method(zend_function *function)
-{
- /* The class entry of the derived function intentionally remains the same
- * as that of the parent class. That allows us to know in which context
- * we're running, and handle private method calls properly.
- */
- function_add_ref(function);
-}
-
-
-static zend_bool zend_do_perform_implementation_check(zend_function *fe)
-{
- zend_op *op, *proto_op;
-
- if (!fe->common.prototype) {
- return 1;
- }
-
- if ((fe->common.arg_types && !fe->common.prototype->common.arg_types)
- || (!fe->common.arg_types && fe->common.prototype->common.arg_types)) {
- return 0;
- }
-
- if (fe->common.arg_types) {
- if (fe->common.arg_types[0] != fe->common.prototype->common.arg_types[0]) {
- return 0;
- }
- if (memcmp(fe->common.arg_types+1, fe->common.prototype->common.arg_types+1, fe->common.arg_types[0]*sizeof(zend_uchar)) != 0) {
- return 0;
- }
- }
-
- if (fe->common.prototype->type == ZEND_INTERNAL_FUNCTION) {
- return 1; /* nothing further we can do here */
- }
-
- op = fe->op_array.opcodes;
- proto_op = fe->common.prototype->op_array.opcodes;
-
- while (proto_op->opcode != ZEND_RAISE_ABSTRACT_ERROR) {
- if (proto_op->opcode != op->opcode) {
- return 0;
- }
- switch (proto_op->opcode) {
- case ZEND_FETCH_CLASS:
- if (zend_binary_zval_strcasecmp(&op->op2.u.constant, &proto_op->op2.u.constant)!=0) {
- return 0;
- }
- break;
- }
- proto_op++;
- op++;
- }
- return 1;
-}
-
-
-static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_function *parent, zend_hash_key *hash_key, zend_class_entry *child_ce)
-{
- zend_uint child_flags;
- zend_uint parent_flags = parent->common.fn_flags;
- zend_function *child;
-
- if (zend_hash_quick_find(child_function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child)==FAILURE) {
- if (parent_flags & ZEND_ACC_ABSTRACT) {
- child_ce->ce_flags |= ZEND_ACC_ABSTRACT;
- }
- return 1; /* method doesn't exist in child, copy from parent */
- }
-
- if (parent_flags & ZEND_ACC_FINAL) {
- zend_error(E_COMPILE_ERROR, "Cannot override final method %s::%s()", ZEND_FN_SCOPE_NAME(parent), child->common.function_name);
- }
-
- child_flags = child->common.fn_flags;
- /* You cannot change from static to non static and vice versa.
- */
- if ((child_flags & ZEND_ACC_STATIC) != (parent_flags & ZEND_ACC_STATIC)) {
- if (child->common.fn_flags & ZEND_ACC_STATIC) {
- zend_error(E_COMPILE_ERROR, "Cannot make non static method %s::%s() static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child));
- } else {
- zend_error(E_COMPILE_ERROR, "Cannot make static method %s::%s() non static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child));
- }
- }
-
- /* Disallow making an inherited method abstract. */
- if ((child_flags & ZEND_ACC_ABSTRACT) && !(parent_flags & ZEND_ACC_ABSTRACT)) {
- zend_error(E_COMPILE_ERROR, "Cannot make non abstract method %s::%s() abstract in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child));
- }
-
- if (parent_flags & ZEND_ACC_CHANGED) {
- child->common.fn_flags |= ZEND_ACC_CHANGED;
- } else {
- /* Prevent derived classes from restricting access that was available in parent classes
- */
- if ((child_flags & ZEND_ACC_PPP_MASK) > (parent_flags & ZEND_ACC_PPP_MASK)) {
- zend_error(E_COMPILE_ERROR, "Access level to %s::%s() must be %s (as in class %s)%s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent), (parent_flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
- } else if (((child_flags & ZEND_ACC_PPP_MASK) < (parent_flags & ZEND_ACC_PPP_MASK))
- && ((parent_flags & ZEND_ACC_PPP_MASK) & ZEND_ACC_PRIVATE)) {
- child->common.fn_flags |= ZEND_ACC_CHANGED;
- }
- }
-
- if (parent_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_ABSTRACT)) {
- child->common.prototype = parent;
- } else if (parent->common.prototype) {
- child->common.prototype = parent->common.prototype;
- }
-
- if (!zend_do_perform_implementation_check(child)) {
- zend_error(E_COMPILE_ERROR, "Declaration of %s::%s() must be the same as %s::%s()", ZEND_FN_SCOPE_NAME(child), child->common.function_name, ZEND_FN_SCOPE_NAME(child->common.prototype), child->common.prototype->common.function_name);
- }
-
- return 0;
-}
-
-
-static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_property_info *parent_info, zend_hash_key *hash_key, zend_class_entry *ce)
-{
- zend_property_info *child_info;
- zend_class_entry *parent_ce = ce->parent;
-
- if (parent_info->flags & ZEND_ACC_PRIVATE) {
- if (zend_hash_quick_find(&ce->properties_info, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) {
- child_info->flags |= ZEND_ACC_CHANGED;
- }
- return 0; /* don't copy access information to child */
- }
-
- if (zend_hash_quick_find(&ce->properties_info, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) {
- if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) {
- zend_error(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name, hash_key->arKey, zend_visibility_string(parent_info->flags), parent_ce->name, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
- } else if (child_info->flags & ZEND_ACC_IMPLICIT_PUBLIC) {
- /* Explicitly copy the value from the parent */
- zval **pvalue;
-
- if (zend_hash_quick_find(&parent_ce->default_properties, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &pvalue)==SUCCESS) {
- zend_hash_quick_update(&ce->default_properties, hash_key->arKey, hash_key->nKeyLength, hash_key->h, pvalue, sizeof(zval *), NULL);
- (*pvalue)->refcount++;
- }
- return 1; /* Inherit from the parent */
- }
- return 0; /* Don't copy from parent */
- } else {
- return 1; /* Copy from parent */
- }
-}
-
-
-void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce)
-{
- if ((ce->ce_flags & ZEND_ACC_INTERFACE)
- && !(parent_ce->ce_flags & ZEND_ACC_INTERFACE)) {
- zend_error(E_ERROR, "Interface %s may not inherit from class (%s)", ce->name, parent_ce->name);
- }
-
- ce->parent = parent_ce;
-
- /* Inherit properties */
- zend_hash_merge(&ce->default_properties, &parent_ce->default_properties, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0);
- zend_hash_merge_ex(&ce->properties_info, &parent_ce->properties_info, (copy_ctor_func_t) zend_duplicate_property_info, sizeof(zend_property_info), (merge_checker_func_t) do_inherit_property_access_check, ce);
-
- /* STATIC_MEMBERS_FIXME */
-/* zend_hash_merge(ce->static_members, parent_ce->static_members, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0); */
- zend_hash_merge(&ce->constants_table, &parent_ce->constants_table, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0);
- zend_hash_merge_ex(&ce->function_table, &parent_ce->function_table, (copy_ctor_func_t) do_inherit_method, sizeof(zend_function), (merge_checker_func_t) do_inherit_method_check, ce);
- do_inherit_parent_constructor(ce);
-}
-
-
-void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface)
-{
- zend_hash_merge(&ce->constants_table, &iface->constants_table, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0);
- zend_hash_merge_ex(&ce->function_table, &iface->function_table, (copy_ctor_func_t) do_inherit_method, sizeof(zend_function), (merge_checker_func_t) do_inherit_method_check, ce);
-}
-
-
-ZEND_API int do_bind_function(zend_op *opline, HashTable *function_table, HashTable *class_table, int compile_time)
-{
- zend_function *function;
-
- if (opline->opcode != ZEND_DECLARE_FUNCTION) {
- zend_error(E_COMPILE_ERROR, "Internal compiler error. Please report!");
- }
-
- zend_hash_find(function_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void *) &function);
- if (zend_hash_add(function_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, function, sizeof(zend_function), NULL)==FAILURE) {
- int error_level = compile_time ? E_COMPILE_ERROR : E_ERROR;
- zend_function *function;
-
- if (zend_hash_find(function_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void *) &function)==SUCCESS
- && function->type==ZEND_USER_FUNCTION
- && ((zend_op_array *) function)->last>0) {
- zend_error(error_level, "Cannot redeclare %s() (previously declared in %s:%d)",
- opline->op2.u.constant.value.str.val,
- ((zend_op_array *) function)->filename,
- ((zend_op_array *) function)->opcodes[0].lineno);
- } else {
- zend_error(error_level, "Cannot redeclare %s()", opline->op2.u.constant.value.str.val);
- }
- return FAILURE;
- } else {
- (*function->op_array.refcount)++;
- function->op_array.static_variables = NULL; /* NULL out the unbound function */
- return SUCCESS;
- }
-}
-
-
-ZEND_API zend_class_entry *do_bind_class(zend_op *opline, HashTable *function_table, HashTable *class_table TSRMLS_DC)
-{
- zend_class_entry *ce, **pce;
-
- if (zend_hash_find(class_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void **) &pce)==FAILURE) {
- zend_error(E_COMPILE_ERROR, "Internal Zend error - Missing class information for %s", opline->op1.u.constant.value.str.val);
- return NULL;
- } else {
- ce = *pce;
- }
- ce->refcount++;
- if (zend_hash_add(class_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, &ce, sizeof(zend_class_entry *), NULL)==FAILURE) {
- ce->refcount--;
- zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", opline->op2.u.constant.value.str.val);
- return NULL;
- } else {
- return ce;
- }
-}
-
-ZEND_API zend_class_entry *do_bind_inherited_class(zend_op *opline, HashTable *function_table, HashTable *class_table, zend_class_entry *parent_ce TSRMLS_DC)
-{
- zend_class_entry *ce, **pce;
- int found_ce;
-
- found_ce = zend_hash_find(class_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void **) &pce);
-
- if (found_ce == FAILURE) {
- zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", opline->op2.u.constant.value.str.val);
- return NULL;
- } else {
- ce = *pce;
- }
-
- zend_do_inheritance(ce, parent_ce);
-
- ce->refcount++;
-
- /* Register the derived class */
- if (zend_hash_add(class_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, pce, sizeof(zend_class_entry *), NULL)==FAILURE) {
- zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", opline->op2.u.constant.value.str.val);
- ce->refcount--;
- zend_hash_destroy(&ce->function_table);
- zend_hash_destroy(&ce->default_properties);
- zend_hash_destroy(&ce->properties_info);
- zend_hash_destroy(ce->static_members);
- zend_hash_destroy(&ce->constants_table);
- return NULL;
- }
- return ce;
-}
-
-
-void zend_do_early_binding(TSRMLS_D)
-{
- zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
-
- while (opline->opcode == ZEND_TICKS && opline > CG(active_op_array)->opcodes) {
- opline--;
- }
-
- if (do_bind_function(opline, CG(function_table), CG(class_table), 1) == FAILURE) {
- return;
- }
-
- zend_hash_del(CG(function_table), opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len);
- zval_dtor(&opline->op1.u.constant);
- zval_dtor(&opline->op2.u.constant);
- opline->opcode = ZEND_NOP;
- memset(&opline->op1, 0, sizeof(znode));
- memset(&opline->op2, 0, sizeof(znode));
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_boolean_or_begin(znode *expr1, znode *op_token TSRMLS_DC)
-{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMPNZ_EX;
- if (expr1->op_type == IS_TMP_VAR) {
- opline->result = *expr1;
- } else {
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_TMP_VAR;
- }
- opline->op1 = *expr1;
- SET_UNUSED(opline->op2);
-
- op_token->u.opline_num = next_op_number;
-
- *expr1 = opline->result;
-}
-
-
-void zend_do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- *result = *expr1; /* we saved the original result in expr1 */
- opline->opcode = ZEND_BOOL;
- opline->result = *result;
- opline->op1 = *expr2;
- SET_UNUSED(opline->op2);
-
- CG(active_op_array)->opcodes[op_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
-}
-
-
-void zend_do_boolean_and_begin(znode *expr1, znode *op_token TSRMLS_DC)
-{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMPZ_EX;
- if (expr1->op_type == IS_TMP_VAR) {
- opline->result = *expr1;
- } else {
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_TMP_VAR;
- }
- opline->op1 = *expr1;
- SET_UNUSED(opline->op2);
-
- op_token->u.opline_num = next_op_number;
-
- *expr1 = opline->result;
-}
-
-
-void zend_do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- *result = *expr1; /* we saved the original result in expr1 */
- opline->opcode = ZEND_BOOL;
- opline->result = *result;
- opline->op1 = *expr2;
- SET_UNUSED(opline->op2);
-
- CG(active_op_array)->opcodes[op_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
-}
-
-
-void zend_do_do_while_begin(TSRMLS_D)
-{
- do_begin_loop(TSRMLS_C);
- INC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_do_while_end(znode *do_token, znode *expr_open_bracket, znode *expr TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMPNZ;
- opline->op1 = *expr;
- opline->op2.u.opline_num = do_token->u.opline_num;
- SET_UNUSED(opline->op2);
-
- do_end_loop(expr_open_bracket->u.opline_num TSRMLS_CC);
-
- DEC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_brk_cont(zend_uchar op, znode *expr TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = op;
- opline->op1.u.opline_num = CG(active_op_array)->current_brk_cont;
- SET_UNUSED(opline->op1);
- if (expr) {
- opline->op2 = *expr;
- } else {
- opline->op2.u.constant.type = IS_LONG;
- opline->op2.u.constant.value.lval = 1;
- INIT_PZVAL(&opline->op2.u.constant);
- opline->op2.op_type = IS_CONST;
- }
-}
-
-
-void zend_do_switch_cond(znode *cond TSRMLS_DC)
-{
- zend_switch_entry switch_entry;
- zend_op *opline;
-
- /* Initialize the conditional value */
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_BOOL;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_TMP_VAR;
- opline->op1.op_type = IS_CONST;
- opline->op1.u.constant.type = IS_BOOL;
- opline->op1.u.constant.value.lval = 0;
- INIT_PZVAL(&opline->op1.u.constant);
- SET_UNUSED(opline->op2);
-
- switch_entry.cond = *cond;
- switch_entry.default_case = -1;
- switch_entry.control_var = opline->result.u.var;
- zend_stack_push(&CG(switch_cond_stack), (void *) &switch_entry, sizeof(switch_entry));
-
- do_begin_loop(TSRMLS_C);
-
- INC_BPC(CG(active_op_array));
-}
-
-
-
-void zend_do_switch_end(znode *case_list TSRMLS_DC)
-{
- zend_op *opline;
- zend_switch_entry *switch_entry_ptr;
-
- zend_stack_top(&CG(switch_cond_stack), (void **) &switch_entry_ptr);
-
- if (case_list->op_type != IS_UNUSED) { /* non-empty switch */
- int next_op_number = get_next_op_number(CG(active_op_array));
-
- CG(active_op_array)->opcodes[case_list->u.opline_num].op1.u.opline_num = next_op_number;
- }
-
- /* add code to jmp to default case */
- if (switch_entry_ptr->default_case != -1) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_JMPZ;
- opline->op1.op_type = IS_TMP_VAR;
- opline->op1.u.var = switch_entry_ptr->control_var;
- opline->op2.u.opline_num = switch_entry_ptr->default_case;
- SET_UNUSED(opline->op2);
- }
-
-
- /* remember break/continue loop information */
- CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].brk = get_next_op_number(CG(active_op_array));
- CG(active_op_array)->current_brk_cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].parent;
-
- if (switch_entry_ptr->cond.op_type==IS_VAR || switch_entry_ptr->cond.op_type==IS_TMP_VAR) {
- /* emit free for the switch condition*/
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_SWITCH_FREE;
- opline->op1 = switch_entry_ptr->cond;
- SET_UNUSED(opline->op2);
- }
- if (switch_entry_ptr->cond.op_type == IS_CONST) {
- zval_dtor(&switch_entry_ptr->cond.u.constant);
- }
-
- zend_stack_del_top(&CG(switch_cond_stack));
-
- DEC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_case_before_statement(znode *case_list, znode *case_token, znode *case_expr TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- int next_op_number;
- zend_switch_entry *switch_entry_ptr;
- znode result;
-
- zend_stack_top(&CG(switch_cond_stack), (void **) &switch_entry_ptr);
-
- opline->opcode = ZEND_CASE;
- opline->result.u.var = switch_entry_ptr->control_var;
- opline->result.op_type = IS_TMP_VAR;
- opline->op1 = switch_entry_ptr->cond;
- opline->op2 = *case_expr;
- if (opline->op1.op_type == IS_CONST) {
- zval_copy_ctor(&opline->op1.u.constant);
- }
- result = opline->result;
-
- next_op_number = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_JMPZ;
- opline->op1 = result;
- SET_UNUSED(opline->op2);
- case_token->u.opline_num = next_op_number;
-
- if (case_list->op_type==IS_UNUSED) {
- return;
- }
- next_op_number = get_next_op_number(CG(active_op_array));
- CG(active_op_array)->opcodes[case_list->u.opline_num].op1.u.opline_num = next_op_number;
-}
-
-
-void zend_do_case_after_statement(znode *result, znode *case_token TSRMLS_DC)
-{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMP;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- result->u.opline_num = next_op_number;
-
- switch (CG(active_op_array)->opcodes[case_token->u.opline_num].opcode) {
- case ZEND_JMP:
- CG(active_op_array)->opcodes[case_token->u.opline_num].op1.u.opline_num = get_next_op_number(CG(active_op_array));
- break;
- case ZEND_JMPZ:
- CG(active_op_array)->opcodes[case_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
- break;
- }
-}
-
-
-
-void zend_do_default_before_statement(znode *case_list, znode *default_token TSRMLS_DC)
-{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- zend_switch_entry *switch_entry_ptr;
-
- zend_stack_top(&CG(switch_cond_stack), (void **) &switch_entry_ptr);
-
- opline->opcode = ZEND_JMP;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- default_token->u.opline_num = next_op_number;
-
- next_op_number = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_BOOL;
- opline->result.u.var = switch_entry_ptr->control_var;
- opline->result.op_type = IS_TMP_VAR;
- opline->op1.op_type = IS_CONST;
- opline->op1.u.constant.type = IS_BOOL;
- opline->op1.u.constant.value.lval = 1;
- INIT_PZVAL(&opline->op1.u.constant);
- SET_UNUSED(opline->op2);
- switch_entry_ptr->default_case = next_op_number;
-
- if (case_list->op_type==IS_UNUSED) {
- return;
- }
- next_op_number = get_next_op_number(CG(active_op_array));
- CG(active_op_array)->opcodes[case_list->u.opline_num].op1.u.opline_num = next_op_number;
-}
-
-
-void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znode *parent_class_name TSRMLS_DC)
-{
- zend_op *opline;
- int doing_inheritance = 0;
- zend_class_entry *new_class_entry = emalloc(sizeof(zend_class_entry));
-
- zend_str_tolower(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len);
-
- if (!(strcmp(class_name->u.constant.value.str.val, "main") && strcmp(class_name->u.constant.value.str.val, "self") &&
- strcmp(class_name->u.constant.value.str.val, "parent"))) {
- zend_error(E_COMPILE_ERROR, "Cannot use '%s' as class name as it is reserved", class_name->u.constant.value.str.val);
- }
-
- new_class_entry->type = ZEND_USER_CLASS;
- new_class_entry->name = class_name->u.constant.value.str.val;
- new_class_entry->name_length = class_name->u.constant.value.str.len;
-
- zend_initialize_class_data(new_class_entry, 1 TSRMLS_CC);
- new_class_entry->filename = zend_get_compiled_filename(TSRMLS_C);
- new_class_entry->line_start = zend_get_compiled_lineno(TSRMLS_C);
- new_class_entry->ce_flags |= class_token->u.constant.value.lval;
-
- if (parent_class_name->op_type != IS_UNUSED) {
- doing_inheritance = 1;
- }
-
- zend_str_tolower(new_class_entry->name, new_class_entry->name_length);
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->op1.op_type = IS_CONST;
- build_runtime_defined_function_key(&opline->op1.u.constant, new_class_entry->name, new_class_entry->name_length, opline TSRMLS_CC);
-
- opline->op2.op_type = IS_CONST;
- opline->op2.u.constant.type = IS_STRING;
- opline->op2.u.constant.refcount = 1;
-
- if (doing_inheritance) {
- opline->extended_value = parent_class_name->u.var;
- opline->opcode = ZEND_DECLARE_INHERITED_CLASS;
- } else {
- opline->opcode = ZEND_DECLARE_CLASS;
- }
-
- opline->op2.u.constant.value.str.val = estrndup(new_class_entry->name, new_class_entry->name_length);
- opline->op2.u.constant.value.str.len = new_class_entry->name_length;
-
- zend_hash_update(CG(class_table), opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, &new_class_entry, sizeof(zend_class_entry *), NULL);
- CG(active_class_entry) = new_class_entry;
-
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_CONST;
- CG(implementing_class) = opline->result;
-
- if (CG(doc_comment)) {
- CG(active_class_entry)->doc_comment = estrndup(CG(doc_comment), CG(doc_comment_len));
- CG(active_class_entry)->doc_comment_len = CG(doc_comment_len);
- RESET_DOC_COMMENT();
- }
-}
-
-
-static void do_verify_abstract_class(TSRMLS_D)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_VERIFY_ABSTRACT_CLASS;
- opline->op1 = CG(implementing_class);
-}
-
-
-void zend_do_end_class_declaration(znode *class_token, znode *parent_token TSRMLS_DC)
-{
- do_inherit_parent_constructor(CG(active_class_entry));
-
- CG(active_class_entry)->line_end = zend_get_compiled_lineno(TSRMLS_C);
-
- if (CG(active_class_entry)->num_interfaces > 0) {
- CG(active_class_entry)->interfaces = (zend_class_entry **) emalloc(sizeof(zend_class_entry *)*CG(active_class_entry)->num_interfaces);
- }
- if (!(CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)
- && !(CG(active_class_entry)->ce_flags & ZEND_ACC_ABSTRACT_CLASS)
- && ((parent_token->op_type != IS_UNUSED) || (CG(active_class_entry)->num_interfaces > 0))) {
- do_verify_abstract_class(TSRMLS_C);
- }
- CG(active_class_entry) = NULL;
-}
-
-
-void zend_do_implements_interface(znode *interface_znode TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_ADD_INTERFACE;
- opline->op1 = CG(implementing_class);
- opline->op2 = *interface_znode;
- opline->extended_value = CG(active_class_entry)->num_interfaces++;
-}
-
-
-void mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length)
-{
- char *prop_name;
- int prop_name_length;
-
- prop_name_length = 1 + src1_length + 1 + src2_length;
- prop_name = emalloc(prop_name_length+1);
- prop_name[0] = '\0';
- memcpy(prop_name + 1, src1, src1_length+1);
- memcpy(prop_name + 1 + src1_length + 1, src2, src2_length+1);
-
- *dest = prop_name;
- *dest_length = prop_name_length;
-}
-
-
-void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_type TSRMLS_DC)
-{
- zval *property;
- zend_property_info property_info;
- zend_property_info *existing_property_info;
- HashTable *target_symbol_table;
- zend_bool free_var_name = 0;
-
- if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) {
- zend_error(E_COMPILE_ERROR, "Interfaces may not include member variables");
- }
-
- if (access_type & ZEND_ACC_ABSTRACT) {
- zend_error(E_COMPILE_ERROR, "Properties cannot be declared abstract");
- }
-
- if (access_type & ZEND_ACC_FINAL) {
- zend_error(E_COMPILE_ERROR, "Cannot declare property $%s::%s final, the final modifier is allowed only for methods",
- CG(active_class_entry)->name, var_name->u.constant.value.str.val);
- }
-
- if (!(access_type & ZEND_ACC_PPP_MASK)) {
- access_type |= ZEND_ACC_PUBLIC;
- }
-
- if (zend_hash_find(&CG(active_class_entry)->properties_info, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, (void **) &existing_property_info)==SUCCESS) {
- if (!(existing_property_info->flags & ZEND_ACC_IMPLICIT_PUBLIC)) {
- zend_error(E_COMPILE_ERROR, "Cannot redeclare %s::$%s", CG(active_class_entry)->name, var_name->u.constant.value.str.val);
- }
- }
- ALLOC_ZVAL(property);
-
- if (value) {
- *property = value->u.constant;
- } else {
- INIT_PZVAL(property);
- property->type = IS_NULL;
- }
-
- if (access_type & ZEND_ACC_STATIC) {
- target_symbol_table = CG(active_class_entry)->static_members;
- } else {
- target_symbol_table = &CG(active_class_entry)->default_properties;
- }
-
- switch (access_type & ZEND_ACC_PPP_MASK) {
- case ZEND_ACC_PRIVATE: {
- char *priv_name;
- int priv_name_length;
-
- mangle_property_name(&priv_name, &priv_name_length, CG(active_class_entry)->name, CG(active_class_entry)->name_length, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len);
- free_var_name = 1;
- zend_hash_update(target_symbol_table, priv_name, priv_name_length+1, &property, sizeof(zval *), NULL);
- property_info.name = priv_name;
- property_info.name_length = priv_name_length;
- }
- break;
- case ZEND_ACC_PROTECTED: {
- char *prot_name;
- int prot_name_length;
-
- mangle_property_name(&prot_name, &prot_name_length, "*", 1, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len);
- free_var_name = 1;
- zend_hash_update(target_symbol_table, prot_name, prot_name_length+1, &property, sizeof(zval *), NULL);
- property_info.name = prot_name;
- property_info.name_length = prot_name_length;
- }
- break;
- case ZEND_ACC_PUBLIC:
- zend_hash_update(target_symbol_table, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
- property_info.name = var_name->u.constant.value.str.val;
- property_info.name_length = var_name->u.constant.value.str.len;
- break;
- }
- property_info.flags = access_type;
- property_info.h = zend_get_hash_value(property_info.name, property_info.name_length+1);
-
- zend_hash_update(&CG(active_class_entry)->properties_info, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property_info, sizeof(zend_property_info), NULL);
- if (free_var_name) {
- efree(var_name->u.constant.value.str.val);
- }
-}
-
-
-void zend_do_declare_class_constant(znode *var_name, znode *value TSRMLS_DC)
-{
- zval *property;
-
- ALLOC_ZVAL(property);
-
- if (value) {
- *property = value->u.constant;
- } else {
- INIT_PZVAL(property);
- property->type = IS_NULL;
- }
-
- zend_hash_update(&CG(active_class_entry)->constants_table, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
-
- FREE_PNODE(var_name);
-}
-
-
-
-void zend_do_fetch_property(znode *result, znode *object, znode *property TSRMLS_DC)
-{
- zend_op opline;
- zend_llist *fetch_list_ptr;
- zend_op *opline_ptr=NULL;
-
- zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
-
- if (fetch_list_ptr->count == 1) {
- zend_llist_element *le;
-
- le = fetch_list_ptr->head;
- opline_ptr = (zend_op *) le->data;
-
- if ((opline_ptr->op1.op_type == IS_CONST) && (opline_ptr->op1.u.constant.type == IS_STRING) &&
- (opline_ptr->op1.u.constant.value.str.len == (sizeof("this")-1)) &&
- !memcmp(opline_ptr->op1.u.constant.value.str.val, "this", sizeof("this"))) {
- efree(opline_ptr->op1.u.constant.value.str.val);
- SET_UNUSED(opline_ptr->op1); /* this means $this for objects */
- opline_ptr->op2 = *property;
- /* if it was usual fetch, we change it to object fetch */
- switch (opline_ptr->opcode) {
- case ZEND_FETCH_W:
- opline_ptr->opcode = ZEND_FETCH_OBJ_W;
- break;
- case ZEND_FETCH_R:
- opline_ptr->opcode = ZEND_FETCH_OBJ_R;
- break;
- case ZEND_FETCH_RW:
- opline_ptr->opcode = ZEND_FETCH_OBJ_RW;
- break;
- case ZEND_FETCH_IS:
- opline_ptr->opcode = ZEND_FETCH_OBJ_IS;
- break;
- case ZEND_FETCH_UNSET:
- opline_ptr->opcode = ZEND_FETCH_OBJ_UNSET;
- break;
- case ZEND_FETCH_FUNC_ARG:
- opline_ptr->opcode = ZEND_FETCH_OBJ_FUNC_ARG;
- break;
- }
- *result = opline_ptr->result;
- if (CG(active_class_entry)
- && property->op_type == IS_CONST
- && !zend_hash_exists(&CG(active_class_entry)->properties_info, property->u.constant.value.str.val, property->u.constant.value.str.len+1)) {
- property->u.constant.value.str.val = estrndup(property->u.constant.value.str.val, property->u.constant.value.str.len);
- zend_do_declare_property(property, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_IMPLICIT_PUBLIC TSRMLS_CC);
- }
- return;
- }
- }
-
- init_op(&opline TSRMLS_CC);
- opline.opcode = ZEND_FETCH_OBJ_W; /* the backpatching routine assumes W */
- opline.result.op_type = IS_VAR;
- opline.result.u.EA.type = 0;
- opline.result.u.var = get_temporary_variable(CG(active_op_array));
- opline.op1 = *object;
- opline.op2 = *property;
- *result = opline.result;
-
- zend_llist_add_element(fetch_list_ptr, &opline);
-}
-
-
-void zend_do_push_object(znode *object TSRMLS_DC)
-{
- zend_stack_push(&CG(object_stack), object, sizeof(znode));
-}
-
-
-void zend_do_pop_object(znode *object TSRMLS_DC)
-{
- znode *tmp;
-
- zend_stack_top(&CG(object_stack), (void **) &tmp);
- *object = *tmp;
- zend_stack_del_top(&CG(object_stack));
-}
-
-
-void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- unsigned char *ptr = NULL;
-
- opline->opcode = ZEND_NEW;
- opline->result.op_type = IS_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *class_type;
- SET_UNUSED(opline->op2);
-
- new_token->u.opline_num = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_JMP_NO_CTOR;
- opline->op1 = (opline-1)->result;
- SET_UNUSED(opline->op2);
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_INIT_CTOR_CALL;
- opline->op1 = (opline-2)->result;
- SET_UNUSED(opline->op2);
-
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(unsigned char *));
-}
-
-
-void zend_do_end_new_object(znode *result, znode *new_token, znode *argument_list TSRMLS_DC)
-{
- znode ctor_result;
-
- zend_do_end_function_call(NULL, &ctor_result, argument_list, 1, 0 TSRMLS_CC);
- zend_do_free(&ctor_result TSRMLS_CC);
-
- CG(active_op_array)->opcodes[new_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
- *result = CG(active_op_array)->opcodes[new_token->u.opline_num].op1;
-}
-
-void zend_do_fold_constant(znode *result, znode *constant_name TSRMLS_DC)
-{
- zval **zresult;
-
- if (zend_hash_find(&CG(active_class_entry)->constants_table, constant_name->u.constant.value.str.val,
- constant_name->u.constant.value.str.len+1, (void **) &zresult) != SUCCESS) {
- if (zend_get_constant(constant_name->u.constant.value.str.val, constant_name->u.constant.value.str.len, &result->u.constant TSRMLS_CC)) {
- return;
- } else {
- zend_error(E_COMPILE_ERROR, "Cannot find %s constant in class %s\n",
- constant_name->u.constant.value.str.val, CG(active_class_entry)->name);
- }
- }
-
- result->u.constant = **zresult;
- zval_copy_ctor(&result->u.constant);
-}
-
-void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode TSRMLS_DC)
-{
- switch (mode) {
- case ZEND_CT:
- if (constant_container) {
- zend_do_fetch_class_name(NULL, constant_container, constant_name, 1 TSRMLS_CC);
- *result = *constant_container;
- } else {
- *result = *constant_name;
- }
- result->u.constant.type = IS_CONSTANT;
- break;
- case ZEND_RT:
- {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_FETCH_CONSTANT;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- if (constant_container) {
- opline->op1 = *constant_container;
- } else {
- SET_UNUSED(opline->op1);
- }
- opline->op2 = *constant_name;
- *result = opline->result;
- }
- break;
- }
-}
-
-
-void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- switch (cmd->op_type) {
- case IS_TMP_VAR:
- opline->opcode = ZEND_SEND_VAL;
- break;
- default:
- opline->opcode = ZEND_SEND_VAR;
- break;
- }
- opline->op1 = *cmd;
- opline->op2.u.opline_num = 0;
- opline->extended_value = ZEND_DO_FCALL;
- SET_UNUSED(opline->op2);
-
- /* FIXME: exception support not added to this op2 */
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_DO_FCALL;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_VAR;
- opline->op1.u.constant.value.str.val = estrndup("shell_exec", sizeof("shell_exec")-1);
- opline->op1.u.constant.value.str.len = sizeof("shell_exec")-1;
- INIT_PZVAL(&opline->op1.u.constant);
- opline->op1.u.constant.type = IS_STRING;
- opline->op1.op_type = IS_CONST;
- opline->extended_value = 1;
- SET_UNUSED(opline->op2);
- *result = opline->result;
-}
-
-
-
-void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_INIT_ARRAY;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_TMP_VAR;
- *result = opline->result;
- if (expr) {
- opline->op1 = *expr;
- if (offset) {
- opline->op2 = *offset;
- } else {
- SET_UNUSED(opline->op2);
- }
- } else {
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- }
- opline->extended_value = is_ref;
-}
-
-
-void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_ADD_ARRAY_ELEMENT;
- opline->result = *result;
- opline->op1 = *expr;
- if (offset) {
- opline->op2 = *offset;
- } else {
- SET_UNUSED(opline->op2);
- }
- opline->extended_value = is_ref;
-}
-
-
-
-void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr)
-{
- zval *element;
-
- ALLOC_ZVAL(element);
- *element = expr->u.constant;
- if (offset) {
- switch (offset->u.constant.type) {
- case IS_CONSTANT:
- /* Ugly hack to denote that this value has a constant index */
- element->type |= IS_CONSTANT_INDEX;
- /* break missing intentionally */
- case IS_STRING:
- zend_hash_update(result->u.constant.value.ht, offset->u.constant.value.str.val, offset->u.constant.value.str.len+1, &element, sizeof(zval *), NULL);
- zval_dtor(&offset->u.constant);
- break;
- case IS_LONG:
- zend_hash_index_update(result->u.constant.value.ht, offset->u.constant.value.lval, &element, sizeof(zval *), NULL);
- break;
- }
- } else {
- zend_hash_next_index_insert(result->u.constant.value.ht, &element, sizeof(zval *), NULL);
- }
-}
-
-
-void zend_do_add_list_element(znode *element TSRMLS_DC)
-{
- list_llist_element lle;
-
- if (element) {
- zend_check_writable_variable(element);
-
- lle.var = *element;
- zend_llist_copy(&lle.dimensions, &CG(dimension_llist));
- zend_llist_prepend_element(&CG(list_llist), &lle);
- }
- (*((int *)CG(dimension_llist).tail->data))++;
-}
-
-
-void zend_do_new_list_begin(TSRMLS_D)
-{
- int current_dimension = 0;
- zend_llist_add_element(&CG(dimension_llist), &current_dimension);
-}
-
-
-void zend_do_new_list_end(TSRMLS_D)
-{
- zend_llist_remove_tail(&CG(dimension_llist));
- (*((int *)CG(dimension_llist).tail->data))++;
-}
-
-
-void zend_do_list_init(TSRMLS_D)
-{
- zend_stack_push(&CG(list_stack), &CG(list_llist), sizeof(zend_llist));
- zend_stack_push(&CG(list_stack), &CG(dimension_llist), sizeof(zend_llist));
- zend_llist_init(&CG(list_llist), sizeof(list_llist_element), NULL, 0);
- zend_llist_init(&CG(dimension_llist), sizeof(int), NULL, 0);
- zend_do_new_list_begin(TSRMLS_C);
-}
-
-
-void zend_do_list_end(znode *result, znode *expr TSRMLS_DC)
-{
- zend_llist_element *le;
- zend_llist_element *dimension;
- zend_op *opline;
- znode last_container;
-
- le = CG(list_llist).head;
- while (le) {
- zend_llist *tmp_dimension_llist = &((list_llist_element *)le->data)->dimensions;
- dimension = tmp_dimension_llist->head;
- while (dimension) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- if (dimension == tmp_dimension_llist->head) { /* first */
- last_container = *expr;
- switch (expr->op_type) {
- case IS_VAR:
- opline->opcode = ZEND_FETCH_DIM_R;
- break;
- case IS_TMP_VAR:
- opline->opcode = ZEND_FETCH_DIM_TMP_VAR;
- break;
- case IS_CONST: /* fetch_dim_tmp_var will handle this bogus fetch */
- zval_copy_ctor(&expr->u.constant);
- opline->opcode = ZEND_FETCH_DIM_TMP_VAR;
- break;
- }
- } else {
- opline->opcode = ZEND_FETCH_DIM_R;
- }
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = last_container;
- opline->op2.op_type = IS_CONST;
- opline->op2.u.constant.type = IS_LONG;
- opline->op2.u.constant.value.lval = *((int *) dimension->data);
- INIT_PZVAL(&opline->op2.u.constant);
- opline->extended_value = ZEND_FETCH_ADD_LOCK;
- last_container = opline->result;
- dimension = dimension->next;
- }
- ((list_llist_element *) le->data)->value = last_container;
- zend_llist_destroy(&((list_llist_element *) le->data)->dimensions);
- zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
- zend_do_assign(result, &((list_llist_element *) le->data)->var, &((list_llist_element *) le->data)->value TSRMLS_CC);
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED;
- le = le->next;
- }
- zend_llist_destroy(&CG(dimension_llist));
- zend_llist_destroy(&CG(list_llist));
- *result = *expr;
- {
- zend_llist *p;
-
- /* restore previous lists */
- zend_stack_top(&CG(list_stack), (void **) &p);
- CG(dimension_llist) = *p;
- zend_stack_del_top(&CG(list_stack));
- zend_stack_top(&CG(list_stack), (void **) &p);
- CG(list_llist) = *p;
- zend_stack_del_top(&CG(list_stack));
- }
-}
-
-void zend_do_fetch_static_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC)
-{
- zval *tmp;
- zend_op *opline;
- znode lval;
- znode result;
-
- ALLOC_ZVAL(tmp);
- convert_to_string(&varname->u.constant);
- if (static_assignment) {
- *tmp = static_assignment->u.constant;
- } else {
- INIT_ZVAL(*tmp);
- }
- if (!CG(active_op_array)->static_variables) {
- ALLOC_HASHTABLE(CG(active_op_array)->static_variables);
- zend_hash_init(CG(active_op_array)->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0);
- }
- zend_hash_update(CG(active_op_array)->static_variables, varname->u.constant.value.str.val, varname->u.constant.value.str.len+1, &tmp, sizeof(zval *), NULL);
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_FETCH_W; /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *varname;
- SET_UNUSED(opline->op2);
- opline->op2.u.EA.type = fetch_type;
- result = opline->result;
-
- if (varname->op_type == IS_CONST) {
- zval_copy_ctor(&varname->u.constant);
- }
- fetch_simple_variable(&lval, varname, 0 TSRMLS_CC); /* Relies on the fact that the default fetch is BP_VAR_W */
-
- zend_do_assign_ref(NULL, &lval, &result TSRMLS_CC);
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED;
-
-/* zval_dtor(&varname->u.constant); */
-}
-
-void zend_do_fetch_global_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC)
-{
- zend_op *opline;
- znode lval;
- znode result;
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_FETCH_W; /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *varname;
- SET_UNUSED(opline->op2);
- opline->op2.u.EA.type = fetch_type;
- result = opline->result;
-
- if (varname->op_type == IS_CONST) {
- zval_copy_ctor(&varname->u.constant);
- }
- fetch_simple_variable(&lval, varname, 0 TSRMLS_CC); /* Relies on the fact that the default fetch is BP_VAR_W */
-
- zend_do_assign_ref(NULL, &lval, &result TSRMLS_CC);
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED;
-}
-
-
-void zend_do_cast(znode *result, znode *expr, int type TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_CAST;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *expr;
- SET_UNUSED(opline->op2);
- opline->extended_value = type;
- *result = opline->result;
-}
-
-
-void zend_do_include_or_eval(int type, znode *result, znode *op1 TSRMLS_DC)
-{
- zend_do_extended_fcall_begin(TSRMLS_C);
- {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_INCLUDE_OR_EVAL;
- opline->result.op_type = IS_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *op1;
- SET_UNUSED(opline->op2);
- opline->op2.u.constant.value.lval = type;
- *result = opline->result;
- }
- zend_do_extended_fcall_end(TSRMLS_C);
-}
-
-
-void zend_do_indirect_references(znode *result, znode *num_references, znode *variable TSRMLS_DC)
-{
- int i;
-
- zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC);
- for (i=1; i<num_references->u.constant.value.lval; i++) {
- fetch_simple_variable_ex(result, variable, 0, ZEND_FETCH_R TSRMLS_CC);
- *variable = *result;
- }
- zend_do_begin_variable_parse(TSRMLS_C);
- fetch_simple_variable(result, variable, 1 TSRMLS_CC);
-}
-
-
-void zend_do_unset(znode *variable TSRMLS_DC)
-{
- zend_op *last_op;
-
- zend_check_writable_variable(variable);
-
- last_op = &CG(active_op_array)->opcodes[get_next_op_number(CG(active_op_array))-1];
-
- switch (last_op->opcode) {
- case ZEND_FETCH_UNSET:
- last_op->opcode = ZEND_UNSET_VAR;
- break;
- case ZEND_FETCH_DIM_UNSET:
- case ZEND_FETCH_OBJ_UNSET:
- last_op->opcode = ZEND_UNSET_DIM_OBJ;
- break;
-
- }
-}
-
-
-void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC)
-{
- zend_op *last_op;
-
- zend_do_end_variable_parse(BP_VAR_IS, 0 TSRMLS_CC);
-
- zend_check_writable_variable(variable);
-
- last_op = &CG(active_op_array)->opcodes[get_next_op_number(CG(active_op_array))-1];
-
- switch (last_op->opcode) {
- case ZEND_FETCH_IS:
- last_op->opcode = ZEND_ISSET_ISEMPTY_VAR;
- break;
- case ZEND_FETCH_DIM_IS:
- case ZEND_FETCH_OBJ_IS:
- last_op->opcode = ZEND_ISSET_ISEMPTY_DIM_OBJ;
- break;
- }
- last_op->result.op_type = IS_TMP_VAR;
- last_op->extended_value = type;
-
- *result = last_op->result;
-}
-
-
-void zend_do_instanceof(znode *result, znode *expr, znode *class_znode, int type TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_INSTANCEOF;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *expr;
-
- opline->op2 = *class_znode;
-
- *result = opline->result;
-}
-
-
-void zend_do_foreach_begin(znode *foreach_token, znode *array, znode *open_brackets_token, znode *as_token, int variable TSRMLS_DC)
-{
- zend_op *opline;
- zend_bool is_variable;
-
- if (variable) {
- if (zend_is_function_or_method_call(array)) {
- is_variable = 0;
- } else {
- is_variable = 1;
- }
- zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
- } else {
- is_variable = 0;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- /* Preform array reset */
- opline->opcode = ZEND_FE_RESET;
- opline->result.op_type = IS_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *array;
- SET_UNUSED(opline->op2);
- opline->extended_value = is_variable;
- *open_brackets_token = opline->result;
-
- zend_stack_push(&CG(foreach_copy_stack), (void *) &opline->result, sizeof(znode));
-
- /* save the location of the beginning of the loop (array fetching) */
- foreach_token->u.opline_num = get_next_op_number(CG(active_op_array));
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_FE_FETCH;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *open_brackets_token;
- SET_UNUSED(opline->op2);
- *as_token = opline->result;
-}
-
-
-void zend_do_foreach_cont(znode *value, znode *key, znode *as_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- znode result_value, result_key, dummy;
-
- if (key->op_type != IS_UNUSED) {
- znode *tmp;
-
- /* switch between the key and value... */
- tmp = key;
- key = value;
- value = tmp;
- }
-
- opline->opcode = ZEND_FETCH_DIM_TMP_VAR;
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.opline_num = get_temporary_variable(CG(active_op_array));
- opline->op1 = *as_token;
- opline->op2.op_type = IS_CONST;
- opline->op2.u.constant.type = IS_LONG;
- opline->op2.u.constant.value.lval = 0;
- opline->extended_value = ZEND_FETCH_STANDARD; /* ignored in fetch_dim_tmp_var, but what the hell. */
- result_value = opline->result;
-
- if (key->op_type != IS_UNUSED) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_FETCH_DIM_TMP_VAR;
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.opline_num = get_temporary_variable(CG(active_op_array));
- opline->op1 = *as_token;
- opline->op2.op_type = IS_CONST;
- opline->op2.u.constant.type = IS_LONG;
- opline->op2.u.constant.value.lval = 1;
- opline->extended_value = ZEND_FETCH_STANDARD; /* ignored in fetch_dim_tmp_var, but what the hell. */
- result_key = opline->result;
- }
-
- zend_do_assign(&dummy, value, &result_value TSRMLS_CC);
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED;
- if (key->op_type != IS_UNUSED) {
- zend_do_assign(&dummy, key, &result_key TSRMLS_CC);
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED;
- }
- zend_do_free(as_token TSRMLS_CC);
-
- do_begin_loop(TSRMLS_C);
- INC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_foreach_end(znode *foreach_token, znode *open_brackets_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMP;
- opline->op1.u.opline_num = foreach_token->u.opline_num;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-
- CG(active_op_array)->opcodes[foreach_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
-
- do_end_loop(foreach_token->u.opline_num TSRMLS_CC);
-
- generate_free_foreach_copy(open_brackets_token TSRMLS_CC);
-
- zend_stack_del_top(&CG(foreach_copy_stack));
-
- DEC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_declare_begin(TSRMLS_D)
-{
- zend_stack_push(&CG(declare_stack), &CG(declarables), sizeof(zend_declarables));
-}
-
-
-void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC)
-{
- convert_to_string(&var->u.constant);
-
- if (!zend_binary_strcasecmp(var->u.constant.value.str.val, var->u.constant.value.str.len, "ticks", sizeof("ticks")-1)) {
- convert_to_long(&val->u.constant);
- CG(declarables).ticks = val->u.constant;
- }
- zval_dtor(&var->u.constant);
-}
-
-
-void zend_do_declare_end(znode *declare_token TSRMLS_DC)
-{
- zend_declarables *declarables;
-
- zend_stack_top(&CG(declare_stack), (void **) &declarables);
- /* We should restore if there was more than (current - start) - (ticks?1:0) opcodes */
- if ((get_next_op_number(CG(active_op_array)) - declare_token->u.opline_num) - ((CG(declarables).ticks.value.lval)?1:0)) {
- CG(declarables) = *declarables;
- }
-}
-
-
-void zend_do_end_heredoc(TSRMLS_D)
-{
- int opline_num = get_next_op_number(CG(active_op_array))-1;
- zend_op *opline = &CG(active_op_array)->opcodes[opline_num];
-
- if (opline->opcode != ZEND_ADD_STRING) {
- return;
- }
-
- opline->op2.u.constant.value.str.val[(opline->op2.u.constant.value.str.len--)-1] = 0;
- if (opline->op2.u.constant.value.str.len>0) {
- if (opline->op2.u.constant.value.str.val[opline->op2.u.constant.value.str.len-1]=='\r') {
- opline->op2.u.constant.value.str.val[(opline->op2.u.constant.value.str.len--)-1] = 0;
- }
- }
-}
-
-
-void zend_do_exit(znode *result, znode *message TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_EXIT;
- opline->op1 = *message;
- SET_UNUSED(opline->op2);
-
- result->op_type = IS_CONST;
- result->u.constant.type = IS_BOOL;
- result->u.constant.value.lval = 1;
-}
-
-
-void zend_do_begin_silence(znode *strudel_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_BEGIN_SILENCE;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- *strudel_token = opline->result;
-}
-
-
-void zend_do_end_silence(znode *strudel_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_END_SILENCE;
- opline->op1 = *strudel_token;
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_begin_qm_op(znode *cond, znode *qm_token TSRMLS_DC)
-{
- int jmpz_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline;
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMPZ;
- opline->op1 = *cond;
- SET_UNUSED(opline->op2);
- opline->op2.u.opline_num = jmpz_op_number;
- *qm_token = opline->op2;
-
- INC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_qm_true(znode *true_value, znode *qm_token, znode *colon_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- CG(active_op_array)->opcodes[qm_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array))+1; /* jmp over the ZEND_JMP */
-
- opline->opcode = ZEND_QM_ASSIGN;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *true_value;
- SET_UNUSED(opline->op2);
-
- *qm_token = opline->result;
- colon_token->u.opline_num = get_next_op_number(CG(active_op_array));
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_JMP;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_qm_false(znode *result, znode *false_value, znode *qm_token, znode *colon_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_QM_ASSIGN;
- opline->result = *qm_token;
- opline->op1 = *false_value;
- SET_UNUSED(opline->op2);
-
- CG(active_op_array)->opcodes[colon_token->u.opline_num].op1.u.opline_num = get_next_op_number(CG(active_op_array));
-
- *result = opline->result;
-
- DEC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_extended_info(TSRMLS_D)
-{
- zend_op *opline;
-
- if (!CG(extended_info)) {
- return;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_EXT_STMT;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_extended_fcall_begin(TSRMLS_D)
-{
- zend_op *opline;
-
- if (!CG(extended_info)) {
- return;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_EXT_FCALL_BEGIN;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_extended_fcall_end(TSRMLS_D)
-{
- zend_op *opline;
-
- if (!CG(extended_info)) {
- return;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_EXT_FCALL_END;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_ticks(TSRMLS_D)
-{
- if (CG(declarables).ticks.value.lval) {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_TICKS;
- opline->op1.u.constant = CG(declarables).ticks;
- opline->op1.op_type = IS_CONST;
- SET_UNUSED(opline->op2);
- }
-}
-
-void zend_auto_global_dtor(zend_auto_global *auto_global)
-{
- free(auto_global->name);
-}
-
-
-zend_bool zend_is_auto_global(char *name, uint name_len TSRMLS_DC)
-{
- zend_auto_global *auto_global;
-
- if (zend_hash_find(CG(auto_globals), name, name_len+1, (void **) &auto_global)==SUCCESS) {
- if (auto_global->armed) {
- auto_global->armed = auto_global->auto_global_callback(auto_global->name, auto_global->name_len TSRMLS_CC);
- }
- return 1;
- }
- return 0;
-}
-
-
-int zend_register_auto_global(char *name, uint name_len, zend_auto_global_callback auto_global_callback TSRMLS_DC)
-{
- zend_auto_global auto_global;
-
- auto_global.name = zend_strndup(name, name_len);
- auto_global.name_len = name_len;
- auto_global.auto_global_callback = auto_global_callback;
-
- return zend_hash_add(CG(auto_globals), name, name_len+1, &auto_global, sizeof(zend_auto_global), NULL);
-}
-
-
-int zendlex(znode *zendlval TSRMLS_DC)
-{
- int retval;
-
- if (CG(increment_lineno)) {
- CG(zend_lineno)++;
- CG(increment_lineno) = 0;
- }
-
- zendlval->u.constant.type = IS_LONG;
- retval = lex_scan(&zendlval->u.constant TSRMLS_CC);
- switch (retval) {
- case T_COMMENT:
- case T_DOC_COMMENT:
- case T_OPEN_TAG:
- case T_WHITESPACE:
- retval = zendlex(zendlval TSRMLS_CC);
- break;
- case T_CLOSE_TAG:
- if (LANG_SCNG(yy_text)[LANG_SCNG(yy_leng)-1]=='\n'
- || (LANG_SCNG(yy_text)[LANG_SCNG(yy_leng)-2]=='\r' && LANG_SCNG(yy_text)[LANG_SCNG(yy_leng)-1])) {
- CG(increment_lineno) = 1;
- }
- retval = ';'; /* implicit ; */
- break;
- case T_OPEN_TAG_WITH_ECHO:
- retval = T_ECHO;
- break;
- case T_END_HEREDOC:
- efree(zendlval->u.constant.value.str.val);
- break;
- }
-
- INIT_PZVAL(&zendlval->u.constant);
- zendlval->op_type = IS_CONST;
- return retval;
-}
-
-
-void zend_duplicate_property_info(zend_property_info *property_info)
-{
- property_info->name = estrndup(property_info->name, property_info->name_length);
-}
-
-
-void zend_destroy_property_info(zend_property_info *property_info)
-{
- efree(property_info->name);
-}
-
-void zend_init_namespace(zend_namespace *ns TSRMLS_DC)
-{
- zend_bool persistent_hashes = (ns->type == ZEND_INTERNAL_NAMESPACE) ? 1 : 0;
-
- ns->refcount = 1;
- ns->constants_updated = 0;
- ns->ce_flags = 0;
-
- ns->filename = NULL;
- ns->doc_comment = NULL;
- ns->doc_comment_len = 0;
-
- if (persistent_hashes) {
- ns->static_members = (HashTable *) malloc(sizeof(HashTable));
- } else {
- ALLOC_HASHTABLE(ns->static_members);
- }
- zend_hash_init_ex(ns->static_members, 0, NULL, ZVAL_PTR_DTOR, persistent_hashes, 0);
- zend_hash_init_ex(&ns->function_table, 10, NULL, ZEND_FUNCTION_DTOR, persistent_hashes, 0);
- zend_hash_init_ex(&ns->class_table, 10, NULL, ZEND_CLASS_DTOR, persistent_hashes, 0);
- zend_hash_init_ex(&ns->constants_table, 10, NULL, ZVAL_PTR_DTOR, persistent_hashes, 0);
-
- ns->parent = NULL;
- ns->num_interfaces = 0;
- ns->interfaces = NULL;
- ns->ns = NULL;
- ns->constructor = NULL;
- ns->destructor = NULL;
- ns->clone = NULL;
- ns->__get = NULL;
- ns->__set = NULL;
- ns->__call = NULL;
- ns->create_object = NULL;
-}
-
-void zend_do_begin_namespace(znode *ns_token, znode *ns_name TSRMLS_DC)
-{
- zend_namespace *ns, **pns;
- zend_op *opline;
-
- zend_str_tolower(ns_name->u.constant.value.str.val, ns_name->u.constant.value.str.len);
-
- if(zend_hash_find(&CG(global_namespace).class_table, ns_name->u.constant.value.str.val, ns_name->u.constant.value.str.len+1, (void **)&pns) == SUCCESS) {
- ns = *pns;
- if(ns->type != ZEND_USER_NAMESPACE || ns == CG(active_namespace)) {
- zend_error(E_COMPILE_ERROR, "Cannot redefine namespace '%s' - class or namespace with this name already defined", ns->name);
- }
- FREE_PNODE(ns_name);
- } else {
- ns = emalloc(sizeof(zend_namespace));
- ns->name = ns_name->u.constant.value.str.val;
- ns->name_length = ns_name->u.constant.value.str.len;
- ns->type = ZEND_USER_NAMESPACE;
- zend_hash_add(&CG(global_namespace).class_table, ns->name, ns->name_length+1, (void **)&ns, sizeof(zend_namespace *), NULL);
- zend_init_namespace(ns TSRMLS_CC);
- ns->line_start = zend_get_compiled_lineno(TSRMLS_C);
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_START_NAMESPACE;
- opline->op1.op_type = IS_CONST;
- opline->op1.u.constant.type = IS_STRING;
- opline->op1.u.constant.value.str.val = estrndup(ns->name, ns->name_length);
- opline->op1.u.constant.value.str.len = ns->name_length;
- opline->op1.u.constant.refcount = 1;
- SET_UNUSED(opline->op2);
-
-
- ns_token->u.previously_active_namespace = CG(active_namespace);
- CG(active_namespace) = ns;
-
- if (CG(doc_comment)) {
- /*
- * Do not overwrite previously declared doc comment in case the namespace is
- * split over several parts.
- */
- if (CG(active_namespace)->doc_comment == NULL) {
- CG(active_namespace)->doc_comment = estrndup(CG(doc_comment), CG(doc_comment_len));
- CG(active_namespace)->doc_comment_len = CG(doc_comment_len);
- }
- RESET_DOC_COMMENT();
- }
-
- /* new symbol tables */
- CG(class_table) = &ns->class_table;
- CG(function_table) = &ns->function_table;
-}
-
-void zend_do_end_namespace(znode *ns_token TSRMLS_DC)
-{
- zend_namespace *ns = ns_token->u.previously_active_namespace;
- zend_op *opline;
-
- /*
- * If the filename field has not been initialized yet, it means that we are
- * on the first definition of namespace and should capture the definition
- * information.
- */
- if (CG(active_namespace)->filename == NULL) {
- CG(active_namespace)->filename = zend_get_compiled_filename(TSRMLS_C);
- CG(active_namespace)->line_end = zend_get_compiled_lineno(TSRMLS_C);
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_START_NAMESPACE;
- if(ns != &CG(global_namespace)) {
- opline->op1.op_type = IS_CONST;
- opline->op1.u.constant.type = IS_STRING;
- opline->op1.u.constant.value.str.val = estrndup(ns->name, ns->name_length);
- opline->op1.u.constant.value.str.len = ns->name_length;
- opline->op1.u.constant.refcount = 1;
- } else {
- SET_UNUSED(opline->op1);
- }
- SET_UNUSED(opline->op2);
-
- CG(active_namespace) = ns;
- /* restore symbol tables */
- CG(class_table) = &CG(active_namespace)->class_table;
- CG(function_table) = &CG(active_namespace)->function_table;
-}
-
-void zend_do_declare_namespace_var(znode *var_name, znode *value TSRMLS_DC)
-{
- zval *var;
-
- ALLOC_ZVAL(var);
-
- if (value) {
- *var = value->u.constant;
- } else {
- INIT_PZVAL(var);
- var->type = IS_NULL;
- }
-
- zend_hash_update(CG(active_namespace)->static_members, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &var, sizeof(zval *), NULL);
-
- FREE_PNODE(var_name);
-}
-
-void zend_do_declare_namespace_constant(znode *var_name, znode *value TSRMLS_DC)
-{
- zval *var;
-
- ALLOC_ZVAL(var);
-
- if (value) {
- *var = value->u.constant;
- } else {
- INIT_PZVAL(var);
- var->type = IS_NULL;
- }
-
- zend_hash_update(&CG(active_namespace)->constants_table, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &var, sizeof(zval *), NULL);
-
- FREE_PNODE(var_name);
-}
-
-void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC)
-{
- zend_bool persistent_hashes = (ce->type == ZEND_INTERNAL_CLASS) ? 1 : 0;
-
- ce->refcount = 1;
- ce->constants_updated = 0;
- ce->ce_flags = 0;
-
- ce->doc_comment = NULL;
- ce->doc_comment_len = 0;
-
- zend_hash_init_ex(&ce->default_properties, 0, NULL, ZVAL_PTR_DTOR, persistent_hashes, 0);
- zend_hash_init_ex(&ce->properties_info, 0, NULL, (dtor_func_t) zend_destroy_property_info, persistent_hashes, 0);
-
- if (persistent_hashes) {
- ce->static_members = (HashTable *) malloc(sizeof(HashTable));
- } else {
- ALLOC_HASHTABLE(ce->static_members);
- }
- zend_hash_init_ex(ce->static_members, 0, NULL, ZVAL_PTR_DTOR, persistent_hashes, 0);
- zend_hash_init_ex(&ce->constants_table, 0, NULL, ZVAL_PTR_DTOR, persistent_hashes, 0);
- zend_hash_init_ex(&ce->function_table, 0, NULL, ZEND_FUNCTION_DTOR, persistent_hashes, 0);
- zend_hash_init_ex(&ce->class_table, 10, NULL, ZEND_CLASS_DTOR, persistent_hashes, 0);
-
- if (nullify_handlers) {
- ce->constructor = NULL;
- ce->destructor = NULL;
- ce->clone = NULL;
- ce->__get = NULL;
- ce->__set = NULL;
- ce->__call = NULL;
- ce->create_object = NULL;
- }
-
- ce->parent = NULL;
- ce->num_interfaces = 0;
- ce->interfaces = NULL;
- ce->ns = CG(active_namespace);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
deleted file mode 100644
index b0cec1e7df..0000000000
--- a/Zend/zend_compile.h
+++ /dev/null
@@ -1,814 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_COMPILE_H
-#define ZEND_COMPILE_H
-
-#include "zend.h"
-
-#ifdef HAVE_STDARG_H
-# include <stdarg.h>
-#endif
-
-#include "zend_llist.h"
-
-#define DEBUG_ZEND 0
-
-#define FREE_PNODE(znode) zval_dtor(&znode->u.constant);
-#define FREE_OP(Ts, op, should_free) if (should_free) zval_dtor(should_free);
-
-#define SET_UNUSED(op) (op).op_type = IS_UNUSED
-
-#define INC_BPC(op_array) if (CG(interactive)) { ((op_array)->backpatch_count++); }
-#define DEC_BPC(op_array) if (CG(interactive)) { ((op_array)->backpatch_count--); }
-#define HANDLE_INTERACTIVE() if (CG(interactive)) { execute_new_code(TSRMLS_C); }
-
-#define RESET_DOC_COMMENT() \
- { \
- CG(doc_comment) = NULL; \
- CG(doc_comment_len) = 0; \
- }
-
-typedef struct _zend_op_array zend_op_array;
-typedef struct _zend_op zend_op;
-
-typedef struct _znode {
- int op_type;
- zend_llist *throw_list; /* Try and save this space later on */
- union {
- zval constant;
-
- zend_uint var;
- zend_uint opline_num; /* Needs to be signed */
- zend_op_array *op_array;
- zend_op *jmp_addr;
- struct {
- zend_uint var; /* dummy */
- zend_uint type;
- } EA;
- zend_namespace *previously_active_namespace;
- } u;
-} znode;
-
-typedef struct _zend_execute_data zend_execute_data;
-
-#define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data, zend_op_array *op_array TSRMLS_DC
-#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data, op_array TSRMLS_CC
-
-typedef int (*opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);
-
-extern opcode_handler_t zend_opcode_handlers[512];
-
-struct _zend_op {
- opcode_handler_t handler;
- znode result;
- znode op1;
- znode op2;
- ulong extended_value;
- uint lineno;
- zend_uchar opcode;
-};
-
-
-typedef struct _zend_brk_cont_element {
- int cont;
- int brk;
- int parent;
-} zend_brk_cont_element;
-
-
-#define ZEND_ACC_STATIC 0x01
-#define ZEND_ACC_ABSTRACT 0x02
-#define ZEND_ACC_FINAL 0x04
-#define ZEND_ACC_INTERFACE 0x08
-#define ZEND_ACC_ABSTRACT_CLASS 0x10
-
-/* The order of those must be kept - public < protected < private */
-#define ZEND_ACC_PUBLIC 0x100
-#define ZEND_ACC_PROTECTED 0x200
-#define ZEND_ACC_PRIVATE 0x400
-#define ZEND_ACC_PPP_MASK (ZEND_ACC_PUBLIC | ZEND_ACC_PROTECTED | ZEND_ACC_PRIVATE)
-
-#define ZEND_ACC_CHANGED 0x800
-#define ZEND_ACC_IMPLICIT_PUBLIC 0x1000
-
-char *zend_visibility_string(zend_uint fn_flags);
-
-
-typedef struct _zend_property_info {
- zend_uint flags;
- char *name;
- int name_length;
- ulong h;
-} zend_property_info;
-
-
-struct _zend_op_array {
- /* Common elements */
- zend_uchar type;
- zend_uchar *arg_types;
- char *function_name;
- zend_class_entry *scope;
- zend_uint fn_flags;
- zend_namespace *ns;
- union _zend_function *prototype;
- /* END of common elements */
-
- zend_uint *refcount;
-
- zend_op *opcodes;
- zend_uint last, size;
-
- zend_uint T;
-
- zend_brk_cont_element *brk_cont_array;
- zend_uint last_brk_cont;
- zend_uint current_brk_cont;
-
- /* static variables support */
- HashTable *static_variables;
-
- zend_op *start_op;
- int backpatch_count;
-
- zend_bool return_reference;
- zend_bool done_pass_two;
- zend_bool uses_this;
-
- char *filename;
- zend_uint line_start;
- zend_uint line_end;
- char *doc_comment;
- zend_uint doc_comment_len;
-
- void *reserved[ZEND_MAX_RESERVED_RESOURCES];
-};
-
-
-typedef struct _zend_internal_function {
- /* Common elements */
- zend_uchar type;
- zend_uchar *arg_types;
- char *function_name;
- zend_class_entry *scope;
- zend_uint fn_flags;
- zend_namespace *ns;
- union _zend_function *prototype;
- /* END of common elements */
-
- void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
-} zend_internal_function;
-
-#define ZEND_FN_SCOPE_NAME(function) ((function) && (function)->common.scope ? (function)->common.scope->name : "")
-
-typedef union _zend_function {
- zend_uchar type; /* MUST be the first element of this struct! */
-
- struct {
- zend_uchar type; /* never used */
- zend_uchar *arg_types;
- char *function_name;
- zend_class_entry *scope;
- zend_uint fn_flags;
- zend_namespace *ns;
- union _zend_function *prototype;
- } common;
-
- zend_op_array op_array;
- zend_internal_function internal_function;
-} zend_function;
-
-
-typedef struct _zend_function_state {
- HashTable *function_symbol_table;
- zend_function *function;
- void *reserved[ZEND_MAX_RESERVED_RESOURCES];
-} zend_function_state;
-
-
-typedef struct _zend_switch_entry {
- znode cond;
- int default_case;
- int control_var;
-} zend_switch_entry;
-
-
-typedef struct _list_llist_element {
- znode var;
- zend_llist dimensions;
- znode value;
-} list_llist_element;
-
-union _temp_variable;
-
-struct _zend_execute_data {
- struct _zend_op *opline;
- zend_function_state function_state;
- zend_function *fbc; /* Function Being Called */
- zend_function *fbc_constructor;
- zend_op_array *op_array;
- zval *object;
- union _temp_variable *Ts;
- zend_bool original_in_execution;
- zend_class_entry *calling_scope;
- struct _zend_execute_data *prev_execute_data;
-};
-
-#define EX(element) execute_data.element
-
-
-#define IS_CONST (1<<0)
-#define IS_TMP_VAR (1<<1)
-#define IS_VAR (1<<2)
-#define IS_UNUSED (1<<3) /* Unused variable */
-
-#define EXT_TYPE_UNUSED (1<<0)
-
-#include "zend_globals.h"
-
-BEGIN_EXTERN_C()
-
-void init_compiler(TSRMLS_D);
-void shutdown_compiler(TSRMLS_D);
-void zend_init_compiler_data_structures(TSRMLS_D);
-
-extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
-
-void zend_activate(TSRMLS_D);
-void zend_deactivate(TSRMLS_D);
-void zend_activate_modules(TSRMLS_D);
-void zend_deactivate_modules(TSRMLS_D);
-
-
-ZEND_API int lex_scan(zval *zendlval TSRMLS_DC);
-void startup_scanner(TSRMLS_D);
-void shutdown_scanner(TSRMLS_D);
-
-ZEND_API char *zend_set_compiled_filename(char *new_compiled_filename TSRMLS_DC);
-ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC);
-ZEND_API char *zend_get_compiled_filename(TSRMLS_D);
-ZEND_API int zend_get_compiled_lineno(TSRMLS_D);
-
-#ifdef ZTS
-const char *zend_get_zendtext(TSRMLS_D);
-int zend_get_zendleng(TSRMLS_D);
-#endif
-
-
-/* parser-driven code generators */
-void zend_do_fold_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC);
-void zend_do_fold_constant(znode *result, znode *constant_name TSRMLS_DC);
-void zend_do_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC);
-void zend_do_unary_op(zend_uchar op, znode *result, znode *op1 TSRMLS_DC);
-void zend_do_binary_assign_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC);
-void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC);
-void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC);
-void fetch_simple_variable(znode *result, znode *varname, int bp TSRMLS_DC);
-void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar op TSRMLS_DC);
-void zend_do_indirect_references(znode *result, znode *num_references, znode *variable TSRMLS_DC);
-void zend_do_fetch_static_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC);
-void zend_do_fetch_global_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC);
-
-void fetch_array_begin(znode *result, znode *varname, znode *first_dim TSRMLS_DC);
-void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC);
-void fetch_string_offset(znode *result, znode *parent, znode *offset TSRMLS_DC);
-void zend_do_fetch_static_member(znode *class_znode TSRMLS_DC);
-void zend_do_print(znode *result, znode *arg TSRMLS_DC);
-void zend_do_echo(znode *arg TSRMLS_DC);
-typedef int (*unary_op_type)(zval *, zval *);
-ZEND_API unary_op_type get_unary_op(int opcode);
-ZEND_API void *get_binary_op(int opcode);
-
-void zend_do_while_cond(znode *expr, znode *close_bracket_token TSRMLS_DC);
-void zend_do_while_end(znode *while_token, znode *close_bracket_token TSRMLS_DC);
-void zend_do_do_while_begin(TSRMLS_D);
-void zend_do_do_while_end(znode *do_token, znode *expr_open_bracket, znode *expr TSRMLS_DC);
-
-
-void zend_do_if_cond(znode *cond, znode *closing_bracket_token TSRMLS_DC);
-void zend_do_if_after_statement(znode *closing_bracket_token, unsigned char initialize TSRMLS_DC);
-void zend_do_if_end(TSRMLS_D);
-
-void zend_do_for_cond(znode *expr, znode *second_semicolon_token TSRMLS_DC);
-void zend_do_for_before_statement(znode *cond_start, znode *second_semicolon_token TSRMLS_DC);
-void zend_do_for_end(znode *second_semicolon_token TSRMLS_DC);
-
-void zend_do_pre_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC);
-void zend_do_post_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC);
-
-void zend_do_begin_variable_parse(TSRMLS_D);
-void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC);
-
-void zend_check_writable_variable(znode *variable);
-
-void zend_do_free(znode *op1 TSRMLS_DC);
-
-void zend_do_init_string(znode *result TSRMLS_DC);
-void zend_do_add_char(znode *result, znode *op1, znode *op2 TSRMLS_DC);
-void zend_do_add_string(znode *result, znode *op1, znode *op2 TSRMLS_DC);
-void zend_do_add_variable(znode *result, znode *op1, znode *op2 TSRMLS_DC);
-
-int zend_do_verify_access_types(znode *current_access_type, znode *new_modifier);
-void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC);
-void zend_do_end_function_declaration(znode *function_token TSRMLS_DC);
-void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initialization, znode *class_type, zend_uchar pass_type TSRMLS_DC);
-int zend_do_begin_function_call(znode *function_name TSRMLS_DC);
-void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC);
-void zend_do_begin_dynamic_function_call(znode *function_name TSRMLS_DC);
-void zend_do_fetch_class(znode *result, znode *namespace_name, znode *class_name, zend_bool global_namespace TSRMLS_DC);
-void zend_do_fetch_class_name(znode *result, znode *class_entry, znode *class_name, zend_bool case_sensitive TSRMLS_DC);
-void zend_do_begin_class_member_function_call(TSRMLS_D);
-void zend_do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC);
-void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC);
-
-void zend_do_try(znode *try_token TSRMLS_DC);
-void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, zend_bool first_catch TSRMLS_DC);
-void zend_do_end_catch(znode *try_token TSRMLS_DC);
-void zend_do_throw(znode *expr TSRMLS_DC);
-
-ZEND_API int do_bind_function(zend_op *opline, HashTable *function_table, HashTable *class_table, int compile_time);
-ZEND_API zend_class_entry *do_bind_class(zend_op *opline, HashTable *function_table, HashTable *class_table TSRMLS_DC);
-ZEND_API zend_class_entry *do_bind_inherited_class(zend_op *opline, HashTable *function_table, HashTable *class_table, zend_class_entry *parent_ce TSRMLS_DC);
-void zend_do_implements_interface(znode *interface_znode TSRMLS_DC);
-
-void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce);
-void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface);
-void zend_do_early_binding(TSRMLS_D);
-
-void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC);
-
-
-void zend_do_boolean_or_begin(znode *expr1, znode *op_token TSRMLS_DC);
-void zend_do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC);
-void zend_do_boolean_and_begin(znode *expr1, znode *op_token TSRMLS_DC);
-void zend_do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC);
-
-void zend_do_brk_cont(zend_uchar op, znode *expr TSRMLS_DC);
-
-void zend_do_switch_cond(znode *cond TSRMLS_DC);
-void zend_do_switch_end(znode *case_list TSRMLS_DC);
-void zend_do_case_before_statement(znode *case_list, znode *case_token, znode *case_expr TSRMLS_DC);
-void zend_do_case_after_statement(znode *result, znode *case_token TSRMLS_DC);
-void zend_do_default_before_statement(znode *case_list, znode *default_token TSRMLS_DC);
-
-void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znode *parent_class_name TSRMLS_DC);
-void zend_do_end_class_declaration(znode *class_token, znode *parent_token TSRMLS_DC);
-void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_type TSRMLS_DC);
-void zend_do_declare_class_constant(znode *var_name, znode *value TSRMLS_DC);
-
-void zend_do_fetch_property(znode *result, znode *object, znode *property TSRMLS_DC);
-
-
-void zend_do_push_object(znode *object TSRMLS_DC);
-void zend_do_pop_object(znode *object TSRMLS_DC);
-
-
-void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC);
-void zend_do_end_new_object(znode *result, znode *new_token, znode *argument_list TSRMLS_DC);
-
-void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode TSRMLS_DC);
-
-void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC);
-
-void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC);
-void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC);
-void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr);
-void zend_do_list_init(TSRMLS_D);
-void zend_do_list_end(znode *result, znode *expr TSRMLS_DC);
-void zend_do_add_list_element(znode *element TSRMLS_DC);
-void zend_do_new_list_begin(TSRMLS_D);
-void zend_do_new_list_end(TSRMLS_D);
-
-void zend_do_cast(znode *result, znode *expr, int type TSRMLS_DC);
-void zend_do_include_or_eval(int type, znode *result, znode *op1 TSRMLS_DC);
-
-void zend_do_unset(znode *variable TSRMLS_DC);
-void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC);
-
-void zend_do_instanceof(znode *result, znode *expr, znode *class_znode, int type TSRMLS_DC);
-
-void zend_do_foreach_begin(znode *foreach_token, znode *array, znode *open_brackets_token, znode *as_token, int variable TSRMLS_DC);
-void zend_do_foreach_cont(znode *value, znode *key, znode *as_token TSRMLS_DC);
-void zend_do_foreach_end(znode *foreach_token, znode *open_brackets_token TSRMLS_DC);
-
-void zend_do_declare_begin(TSRMLS_D);
-void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC);
-void zend_do_declare_end(znode *declare_token TSRMLS_DC);
-
-void zend_do_end_heredoc(TSRMLS_D);
-
-void zend_do_exit(znode *result, znode *message TSRMLS_DC);
-
-void zend_do_begin_silence(znode *strudel_token TSRMLS_DC);
-void zend_do_end_silence(znode *strudel_token TSRMLS_DC);
-
-void zend_do_begin_qm_op(znode *cond, znode *qm_token TSRMLS_DC);
-void zend_do_qm_true(znode *true_value, znode *qm_token, znode *colon_token TSRMLS_DC);
-void zend_do_qm_false(znode *result, znode *false_value, znode *qm_token, znode *colon_token TSRMLS_DC);
-
-void zend_do_extended_info(TSRMLS_D);
-void zend_do_extended_fcall_begin(TSRMLS_D);
-void zend_do_extended_fcall_end(TSRMLS_D);
-
-void zend_do_ticks(TSRMLS_D);
-
-void zend_do_begin_import(TSRMLS_D);
-void zend_do_import(int type, znode *what TSRMLS_DC);
-void zend_do_end_import(znode *import_from TSRMLS_DC);
-
-void zend_do_abstract_method(znode *function_name, znode *modifiers, znode *body TSRMLS_DC);
-
-ZEND_API void function_add_ref(zend_function *function);
-
-#define INITIAL_OP_ARRAY_SIZE 64
-
-
-/* helper functions in zend_language_scanner.l */
-ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSRMLS_DC);
-ZEND_API zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC);
-ZEND_API zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC);
-ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...);
-ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC);
-ZEND_API void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC);
-ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC);
-ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC);
-ZEND_API void zend_file_handle_dtor(zend_file_handle *fh);
-ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC);
-ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC);
-
-ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
-ZEND_API void destroy_zend_class(zend_class_entry **pce);
-void zend_class_add_ref(zend_class_entry **ce);
-
-void zend_do_begin_namespace(znode *ns_token, znode *ns_name TSRMLS_DC);
-void zend_do_end_namespace(znode *ns_token TSRMLS_DC);
-void zend_init_namespace(zend_namespace *ns TSRMLS_DC);
-void zend_do_declare_namespace_var(znode *name, znode *value TSRMLS_DC);
-void zend_do_declare_namespace_constant(znode *name, znode *value TSRMLS_DC);
-ZEND_API void destroy_zend_namespace(zend_namespace **pns);
-
-void zend_duplicate_property_info(zend_property_info *property_info);
-void zend_destroy_property_info(zend_property_info *property_info);
-
-#define ZEND_FUNCTION_DTOR (void (*)(void *)) destroy_zend_function
-#define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class
-#define ZEND_NAMESPACE_DTOR (void (*)(void *)) destroy_zend_namespace
-
-zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC);
-void init_op(zend_op *op TSRMLS_DC);
-int get_next_op_number(zend_op_array *op_array);
-int print_class(zend_class_entry *class_entry TSRMLS_DC);
-void print_op_array(zend_op_array *op_array, int optimizations);
-int pass_two(zend_op_array *op_array TSRMLS_DC);
-zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array);
-ZEND_API zend_bool zend_is_compiling(TSRMLS_D);
-ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC);
-void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC);
-
-typedef zend_bool (*zend_auto_global_callback)(char *name, uint name_len TSRMLS_DC);
-typedef struct _zend_auto_global {
- char *name;
- uint name_len;
- zend_auto_global_callback auto_global_callback;
- zend_bool armed;
-} zend_auto_global;
-
-void zend_auto_global_dtor(zend_auto_global *auto_global);
-ZEND_API int zend_register_auto_global(char *name, uint name_len, zend_auto_global_callback auto_global_callback TSRMLS_DC);
-ZEND_API zend_bool zend_is_auto_global(char *name, uint name_len TSRMLS_DC);
-
-int zendlex(znode *zendlval TSRMLS_DC);
-
-/* BEGIN: OPCODES */
-#define ZEND_NOP 0
-
-#define ZEND_ADD 1
-#define ZEND_SUB 2
-#define ZEND_MUL 3
-#define ZEND_DIV 4
-#define ZEND_MOD 5
-#define ZEND_SL 6
-#define ZEND_SR 7
-#define ZEND_CONCAT 8
-#define ZEND_BW_OR 9
-#define ZEND_BW_AND 10
-#define ZEND_BW_XOR 11
-#define ZEND_BW_NOT 12
-#define ZEND_BOOL_NOT 13
-#define ZEND_BOOL_XOR 14
-#define ZEND_IS_IDENTICAL 15
-#define ZEND_IS_NOT_IDENTICAL 16
-#define ZEND_IS_EQUAL 17
-#define ZEND_IS_NOT_EQUAL 18
-#define ZEND_IS_SMALLER 19
-#define ZEND_IS_SMALLER_OR_EQUAL 20
-#define ZEND_CAST 21
-#define ZEND_QM_ASSIGN 22
-
-#define ZEND_ASSIGN_ADD 23
-#define ZEND_ASSIGN_SUB 24
-#define ZEND_ASSIGN_MUL 25
-#define ZEND_ASSIGN_DIV 26
-#define ZEND_ASSIGN_MOD 27
-#define ZEND_ASSIGN_SL 28
-#define ZEND_ASSIGN_SR 29
-#define ZEND_ASSIGN_CONCAT 30
-#define ZEND_ASSIGN_BW_OR 31
-#define ZEND_ASSIGN_BW_AND 32
-#define ZEND_ASSIGN_BW_XOR 33
-
-#define ZEND_PRE_INC 34
-#define ZEND_PRE_DEC 35
-#define ZEND_POST_INC 36
-#define ZEND_POST_DEC 37
-
-#define ZEND_ASSIGN 38
-#define ZEND_ASSIGN_REF 39
-
-#define ZEND_ECHO 40
-#define ZEND_PRINT 41
-
-#define ZEND_JMP 42
-#define ZEND_JMPZ 43
-#define ZEND_JMPNZ 44
-#define ZEND_JMPZNZ 45
-#define ZEND_JMPZ_EX 46
-#define ZEND_JMPNZ_EX 47
-#define ZEND_CASE 48
-#define ZEND_SWITCH_FREE 49
-#define ZEND_BRK 50
-#define ZEND_CONT 51
-#define ZEND_BOOL 52
-
-#define ZEND_INIT_STRING 53
-#define ZEND_ADD_CHAR 54
-#define ZEND_ADD_STRING 55
-#define ZEND_ADD_VAR 56
-
-#define ZEND_BEGIN_SILENCE 57
-#define ZEND_END_SILENCE 58
-
-#define ZEND_INIT_FCALL_BY_NAME 59
-#define ZEND_DO_FCALL 60
-#define ZEND_DO_FCALL_BY_NAME 61
-#define ZEND_RETURN 62
-
-#define ZEND_RECV 63
-#define ZEND_RECV_INIT 64
-
-#define ZEND_SEND_VAL 65
-#define ZEND_SEND_VAR 66
-#define ZEND_SEND_REF 67
-
-#define ZEND_NEW 68
-#define ZEND_JMP_NO_CTOR 69
-#define ZEND_FREE 70
-
-#define ZEND_INIT_ARRAY 71
-#define ZEND_ADD_ARRAY_ELEMENT 72
-
-#define ZEND_INCLUDE_OR_EVAL 73
-
-#define ZEND_UNSET_VAR 74
-#define ZEND_UNSET_DIM_OBJ 75
-
-#define ZEND_FE_RESET 77
-#define ZEND_FE_FETCH 78
-
-#define ZEND_EXIT 79
-
-
-/* the following 18 opcodes are 6 groups of 3 opcodes each, and must
- * remain in that order!
- */
-#define ZEND_FETCH_R 80
-#define ZEND_FETCH_DIM_R 81
-#define ZEND_FETCH_OBJ_R 82
-#define ZEND_FETCH_W 83
-#define ZEND_FETCH_DIM_W 84
-#define ZEND_FETCH_OBJ_W 85
-#define ZEND_FETCH_RW 86
-#define ZEND_FETCH_DIM_RW 87
-#define ZEND_FETCH_OBJ_RW 88
-#define ZEND_FETCH_IS 89
-#define ZEND_FETCH_DIM_IS 90
-#define ZEND_FETCH_OBJ_IS 91
-#define ZEND_FETCH_FUNC_ARG 92
-#define ZEND_FETCH_DIM_FUNC_ARG 93
-#define ZEND_FETCH_OBJ_FUNC_ARG 94
-#define ZEND_FETCH_UNSET 95
-#define ZEND_FETCH_DIM_UNSET 96
-#define ZEND_FETCH_OBJ_UNSET 97
-
-#define ZEND_FETCH_DIM_TMP_VAR 98
-#define ZEND_FETCH_CONSTANT 99
-
-/* Hole - 100 */
-
-#define ZEND_EXT_STMT 101
-#define ZEND_EXT_FCALL_BEGIN 102
-#define ZEND_EXT_FCALL_END 103
-#define ZEND_EXT_NOP 104
-
-#define ZEND_TICKS 105
-
-#define ZEND_SEND_VAR_NO_REF 106
-
-#define ZEND_CATCH 107
-#define ZEND_THROW 108
-
-#define ZEND_FETCH_CLASS 109
-
-#define ZEND_CLONE 110
-
-#define ZEND_INIT_CTOR_CALL 111
-#define ZEND_INIT_METHOD_CALL 112
-#define ZEND_INIT_STATIC_METHOD_CALL 113
-
-#define ZEND_ISSET_ISEMPTY_VAR 114
-#define ZEND_ISSET_ISEMPTY_DIM_OBJ 115
-
-#define ZEND_IMPORT_FUNCTION 116
-#define ZEND_IMPORT_CLASS 117
-#define ZEND_IMPORT_CONST 118
-
-#define ZEND_ASSIGN_ADD_OBJ 121
-#define ZEND_ASSIGN_SUB_OBJ 122
-#define ZEND_ASSIGN_MUL_OBJ 123
-#define ZEND_ASSIGN_DIV_OBJ 124
-#define ZEND_ASSIGN_MOD_OBJ 125
-#define ZEND_ASSIGN_SL_OBJ 126
-#define ZEND_ASSIGN_SR_OBJ 127
-#define ZEND_ASSIGN_CONCAT_OBJ 128
-#define ZEND_ASSIGN_BW_OR_OBJ 129
-#define ZEND_ASSIGN_BW_AND_OBJ 130
-#define ZEND_ASSIGN_BW_XOR_OBJ 131
-
-#define ZEND_PRE_INC_OBJ 132
-#define ZEND_PRE_DEC_OBJ 133
-#define ZEND_POST_INC_OBJ 134
-#define ZEND_POST_DEC_OBJ 135
-
-#define ZEND_ASSIGN_OBJ 136
-#define ZEND_OP_DATA 137
-
-#define ZEND_INSTANCEOF 138
-
-#define ZEND_DECLARE_CLASS 139
-#define ZEND_DECLARE_INHERITED_CLASS 140
-#define ZEND_DECLARE_FUNCTION 141
-
-#define ZEND_RAISE_ABSTRACT_ERROR 142
-
-#define ZEND_START_NAMESPACE 143
-
-#define ZEND_ADD_INTERFACE 144
-#define ZEND_VERIFY_INSTANCEOF 145
-#define ZEND_VERIFY_ABSTRACT_CLASS 146
-
-/* end of block */
-/* END: OPCODES */
-
-
-
-
-/* global/local fetches */
-#define ZEND_FETCH_GLOBAL 0
-#define ZEND_FETCH_LOCAL 1
-#define ZEND_FETCH_STATIC 2
-#define ZEND_FETCH_STATIC_MEMBER 3
-
-/* class fetches */
-#define ZEND_FETCH_CLASS_DEFAULT 0
-#define ZEND_FETCH_CLASS_SELF 1
-#define ZEND_FETCH_CLASS_PARENT 2
-#define ZEND_FETCH_CLASS_MAIN 3
-#define ZEND_FETCH_CLASS_GLOBAL 4
-
-
-/* variable parsing type (compile-time) */
-#define ZEND_PARSED_MEMBER (1<<0)
-#define ZEND_PARSED_METHOD_CALL (1<<1)
-#define ZEND_PARSED_STATIC_MEMBER (1<<2)
-#define ZEND_PARSED_FUNCTION_CALL (1<<3)
-#define ZEND_PARSED_VARIABLE (1<<4)
-
-
-/* unset types */
-#define ZEND_UNSET_REG 0
-
-/* var status for backpatching */
-#define BP_VAR_R 0
-#define BP_VAR_W 1
-#define BP_VAR_RW 2
-#define BP_VAR_IS 3
-#define BP_VAR_NA 4 /* if not applicable */
-#define BP_VAR_FUNC_ARG 5
-#define BP_VAR_UNSET 6
-
-
-#define ZEND_INTERNAL_FUNCTION 1
-#define ZEND_USER_FUNCTION 2
-#define ZEND_OVERLOADED_FUNCTION 3
-#define ZEND_EVAL_CODE 4
-
-#define ZEND_INTERNAL_CLASS 1
-#define ZEND_USER_CLASS 2
-#define ZEND_INTERNAL_NAMESPACE 3
-#define ZEND_USER_NAMESPACE 4
-
-#define ZEND_EVAL (1<<0)
-#define ZEND_INCLUDE (1<<1)
-#define ZEND_INCLUDE_ONCE (1<<2)
-#define ZEND_REQUIRE (1<<3)
-#define ZEND_REQUIRE_ONCE (1<<4)
-
-#define ZEND_ISSET (1<<0)
-#define ZEND_ISEMPTY (1<<1)
-
-#define ZEND_CT (1<<0)
-#define ZEND_RT (1<<1)
-
-
-#define ZEND_HANDLE_FILENAME 0
-#define ZEND_HANDLE_FD 1
-#define ZEND_HANDLE_FP 2
-#define ZEND_HANDLE_STDIOSTREAM 3
-#define ZEND_HANDLE_FSTREAM 4
-#define ZEND_HANDLE_STREAM 5
-
-#define ZEND_FETCH_STANDARD 0
-#define ZEND_FETCH_ADD_LOCK 1
-
-#define ZEND_MEMBER_FUNC_CALL 1<<0
-
-#define ZEND_ARG_SEND_BY_REF (1<<0)
-#define ZEND_ARG_COMPILE_TIME_BOUND (1<<1)
-
-#define CLASS_IS_NAMESPACE(c) ((c)->type == ZEND_INTERNAL_NAMESPACE || (c)->type == ZEND_USER_NAMESPACE)
-
-#define AI_USE_PTR(ai) \
- if ((ai).ptr_ptr) { \
- (ai).ptr = *((ai).ptr_ptr); \
- (ai).ptr_ptr = &((ai).ptr); \
- } else { \
- (ai).ptr = NULL; \
- }
-
-/* Lost In Stupid Parentheses */
-#define ARG_SHOULD_BE_SENT_BY_REF(offset, conduct_check, arg_types) \
- ( \
- conduct_check \
- && arg_types \
- && \
- ( \
- ( \
- offset<=arg_types[0] \
- && arg_types[offset]==BYREF_FORCE \
- ) \
- || ( \
- offset>=arg_types[0] \
- && arg_types[arg_types[0]]==BYREF_FORCE_REST \
- ) \
- ) \
- )
-
-#define ZEND_RETURN_VAL 0
-#define ZEND_RETURN_REF 1
-
-END_EXTERN_C()
-
-#define ZEND_CLONE_FUNC_NAME "__clone"
-#define ZEND_CONSTRUCTOR_FUNC_NAME "__construct"
-#define ZEND_DESTRUCTOR_FUNC_NAME "__destruct"
-#define ZEND_GET_FUNC_NAME "__get"
-#define ZEND_SET_FUNC_NAME "__set"
-#define ZEND_CALL_FUNC_NAME "__call"
-
-#endif /* ZEND_COMPILE_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_config.nw.h b/Zend/zend_config.nw.h
deleted file mode 100644
index c416b85161..0000000000
--- a/Zend/zend_config.nw.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_CONFIG_NW_H
-#define ZEND_CONFIG_NW_H
-
-
-#include <string.h>
-#include <float.h>
-
-typedef unsigned long ulong;
-typedef unsigned int uint;
-
-#define HAVE_ALLOCA 1
-#define HAVE_LIMITS_H 1
-/* #include <malloc.h> */
-
-#define HAVE_STRING_H 1
-
-#undef HAVE_KILL
-#define HAVE_GETPID 1
-/* #define HAVE_ALLOCA_H 1 */
-#define HAVE_MEMCPY 1
-#define HAVE_STRDUP 1
-#define HAVE_SYS_TYPES_H 1
-/* #define HAVE_STDIOSTR_H 1 */
-#define HAVE_CLASS_ISTDIOSTREAM
-#define istdiostream stdiostream
-#define HAVE_STDARG_H 1
-#define HAVE_DLFCN_H 1
-/* #define HAVE_LIBDL 1 */
-#define HAVE_SNPRINTF 1
-#define HAVE_VSNPRINTF 1
-
-/*
-#define snprintf _snprintf
-#define vsnprintf _vsnprintf
-#define zend_isinf(a) 0
-#define zend_finite(x) _finite(x)
-#define zend_isnan(x) _isnan(x)
-*/
-
-#define zend_sprintf sprintf
-
-/* This will cause the compilation process to be MUCH longer, but will generate
- * a much quicker PHP binary
- */
-/*
-#undef inline
-#ifdef ZEND_WIN32_FORCE_INLINE
-# define inline __forceinline
-#else
-# define inline
-#endif
-*/
-
-/*
-#define zend_finite(A) _finite(A)
-#define zend_isnan(A) _isnan(A)
-*/
-
-#endif /* ZEND_CONFIG_NW_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_config.w32.h b/Zend/zend_config.w32.h
deleted file mode 100644
index fe62faa8d6..0000000000
--- a/Zend/zend_config.w32.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_CONFIG_W32_H
-#define ZEND_CONFIG_W32_H
-
-#define HAVE_ALLOCA 1
-#define HAVE_LIMITS_H 1
-#define _CRTDBG_MAP_ALLOC
-
-#include <malloc.h>
-#include <stdlib.h>
-#include <crtdbg.h>
-
-#include <string.h>
-
-#ifndef ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include <winsock2.h>
-#include <windows.h>
-
-#include <float.h>
-
-typedef unsigned long ulong;
-typedef unsigned int uint;
-
-#undef HAVE_KILL
-#define HAVE_GETPID 1
-/* #define HAVE_ALLOCA_H 1 */
-#define HAVE_MEMCPY 1
-#define HAVE_STRDUP 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIOSTR_H 1
-#define HAVE_CLASS_ISTDIOSTREAM
-#define istdiostream stdiostream
-#define HAVE_STDARG_H 1
-#define HAVE_SNPRINTF 1
-#define HAVE_VSNPRINTF 1
-
-#define snprintf _snprintf
-#define vsnprintf _vsnprintf
-#define strcasecmp(s1, s2) stricmp(s1, s2)
-#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
-#define zend_isinf(a) ((_fpclass(a) == _FPCLASS_PINF) || (_fpclass(a) == _FPCLASS_NINF))
-#define zend_finite(x) _finite(x)
-#define zend_isnan(x) _isnan(x)
-
-#define zend_sprintf sprintf
-
-/* This will cause the compilation process to be MUCH longer, but will generate
- * a much quicker PHP binary
- */
-#undef inline
-#ifdef ZEND_WIN32_FORCE_INLINE
-# define inline __forceinline
-#else
-# define inline
-#endif
-
-#ifdef LIBZEND_EXPORTS
-# define ZEND_API __declspec(dllexport)
-#else
-# define ZEND_API __declspec(dllimport)
-#endif
-
-#define ZEND_DLEXPORT __declspec(dllexport)
-#define ZEND_DLIMPORT __declspec(dllimport)
-
-/* 0x00200000L is MB_SERVICE_NOTIFICATION, which is only supported under Windows NT
- * (and requires _WIN32_WINNT to be defined, which prevents the resulting executable
- * from running under Windows 9x
- * Windows 9x should silently ignore it, so it's being used here directly
- */
-#ifndef MB_SERVICE_NOTIFICATION
-#define MB_SERVICE_NOTIFICATION 0x00200000L
-#endif
-
-#define ZEND_SERVICE_MB_STYLE (MB_TOPMOST|MB_SERVICE_NOTIFICATION)
-
-#endif /* ZEND_CONFIG_W32_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
deleted file mode 100644
index 826e6071fa..0000000000
--- a/Zend/zend_constants.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_constants.h"
-#include "zend_variables.h"
-#include "zend_operators.h"
-#include "zend_globals.h"
-
-
-void free_zend_constant(zend_constant *c)
-{
- if (!(c->flags & CONST_PERSISTENT)) {
- zval_dtor(&c->value);
- }
- free(c->name);
-}
-
-
-void copy_zend_constant(zend_constant *c)
-{
- c->name = zend_strndup(c->name, c->name_len);
- if (!(c->flags & CONST_PERSISTENT)) {
- zval_copy_ctor(&c->value);
- }
-}
-
-
-void zend_copy_constants(HashTable *target, HashTable *source)
-{
- zend_constant tmp_constant;
-
- zend_hash_copy(target, source, (copy_ctor_func_t) copy_zend_constant, &tmp_constant, sizeof(zend_constant));
-}
-
-
-static int clean_non_persistent_constant(zend_constant *c TSRMLS_DC)
-{
- if (c->flags & CONST_PERSISTENT) {
- return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP;
- } else {
- return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE;
- }
-}
-
-
-static int clean_module_constant(zend_constant *c, int *module_number TSRMLS_DC)
-{
- if (c->module_number == *module_number) {
- return 1;
- } else {
- return 0;
- }
-}
-
-
-void clean_module_constants(int module_number TSRMLS_DC)
-{
- zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) clean_module_constant, (void *) &module_number TSRMLS_CC);
-}
-
-
-int zend_startup_constants(TSRMLS_D)
-{
- EG(zend_constants) = &CG(global_namespace).constants_table;
-
- if (zend_hash_init(EG(zend_constants), 20, NULL, ZEND_CONSTANT_DTOR, 1)==FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-
-void zend_register_standard_constants(TSRMLS_D)
-{
- REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_WARNING", E_COMPILE_WARNING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_USER_ERROR", E_USER_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_USER_WARNING", E_USER_WARNING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS);
-
- /* true/false constants */
- {
- zend_constant c;
-
- c.value.type = IS_BOOL;
- c.flags = CONST_PERSISTENT;
- c.module_number = 0;
-
- c.name = zend_strndup(ZEND_STRL("TRUE"));
- c.name_len = sizeof("TRUE");
- c.value.value.lval = 1;
- c.value.type = IS_BOOL;
- zend_register_constant(&c TSRMLS_CC);
-
- c.name = zend_strndup(ZEND_STRL("FALSE"));
- c.name_len = sizeof("FALSE");
- c.value.value.lval = 0;
- c.value.type = IS_BOOL;
- zend_register_constant(&c TSRMLS_CC);
-
- c.name = zend_strndup(ZEND_STRL("ZEND_THREAD_SAFE"));
- c.name_len = sizeof("ZEND_THREAD_SAFE");
- c.value.value.lval = ZTS_V;
- c.value.type = IS_BOOL;
- zend_register_constant(&c TSRMLS_CC);
-
- c.name = zend_strndup(ZEND_STRL("NULL"));
- c.name_len = sizeof("NULL");
- c.value.type = IS_NULL;
- zend_register_constant(&c TSRMLS_CC);
- }
-}
-
-
-int zend_shutdown_constants(TSRMLS_D)
-{
- zend_hash_destroy(EG(zend_constants));
- return SUCCESS;
-}
-
-
-void clean_non_persistent_constants(TSRMLS_D)
-{
- if (EG(full_tables_cleanup)) {
- zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC);
- } else {
- zend_hash_reverse_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC);
- }
-}
-
-
-ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC)
-{
- zend_constant c;
-
- c.value.type = IS_LONG;
- c.value.value.lval = lval;
- c.flags = flags;
- c.name = zend_strndup(name, name_len);
- c.name_len = name_len;
- c.module_number = module_number;
- zend_register_constant(&c TSRMLS_CC);
-}
-
-
-ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC)
-{
- zend_constant c;
-
- c.value.type = IS_DOUBLE;
- c.value.value.dval = dval;
- c.flags = flags;
- c.name = zend_strndup(name, name_len);
- c.name_len = name_len;
- c.module_number = module_number;
- zend_register_constant(&c TSRMLS_CC);
-}
-
-
-ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC)
-{
- zend_constant c;
-
- c.value.type = IS_STRING;
- c.value.value.str.val = strval;
- c.value.value.str.len = strlen;
- c.flags = flags;
- c.name = zend_strndup(name, name_len);
- c.name_len = name_len;
- c.module_number = module_number;
- zend_register_constant(&c TSRMLS_CC);
-}
-
-
-ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC)
-{
- zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number TSRMLS_CC);
-}
-
-
-ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC)
-{
- zend_constant *c;
- char *lookup_name;
- int retval = 1;
-
- if (zend_hash_find(EG(zend_constants), name, name_len+1, (void **) &c) == FAILURE) {
- lookup_name = do_alloca(name_len+1);
- memcpy(lookup_name, name, name_len+1);
- zend_str_tolower(lookup_name, name_len);
-
- if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) {
- if ((c->flags & CONST_CS) && memcmp(c->name, name, name_len)!=0) {
- retval=0;
- }
- } else {
- retval=0;
- }
- free_alloca(lookup_name);
- }
-
- if (retval) {
- *result = c->value;
- zval_copy_ctor(result);
- }
-
- return retval;
-}
-
-
-ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
-{
- char *lowercase_name;
- int ret = SUCCESS;
-
-#if 0
- printf("Registering constant for module %d\n", c->module_number);
-#endif
-
- lowercase_name = do_alloca(c->name_len);
-
- memcpy(lowercase_name, c->name, c->name_len);
-
- if (!(c->flags & CONST_CS)) {
- zend_str_tolower(lowercase_name, c->name_len);
- }
-
- if (zend_hash_add(EG(zend_constants), lowercase_name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {
- free(c->name);
- if (!(c->flags & CONST_PERSISTENT)) {
- zval_dtor(&c->value);
- }
- zend_error(E_NOTICE,"Constant %s already defined", lowercase_name);
- ret = FAILURE;
- }
- free_alloca(lowercase_name);
- return ret;
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h
deleted file mode 100644
index 06fd50c4a4..0000000000
--- a/Zend/zend_constants.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_CONSTANTS_H
-#define ZEND_CONSTANTS_H
-
-#include "zend_globals.h"
-
-#define CONST_CS (1<<0) /* Case Sensitive */
-#define CONST_PERSISTENT (1<<1) /* Persistent */
-
-typedef struct _zend_constant {
- zval value;
- int flags;
- char *name;
- uint name_len;
- int module_number;
-} zend_constant;
-
-#define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), module_number TSRMLS_CC)
-#define REGISTER_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), module_number TSRMLS_CC)
-#define REGISTER_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), module_number TSRMLS_CC)
-#define REGISTER_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), module_number TSRMLS_CC)
-
-#define REGISTER_MAIN_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), 0 TSRMLS_CC)
-#define REGISTER_MAIN_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), 0 TSRMLS_CC)
-#define REGISTER_MAIN_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), 0 TSRMLS_CC)
-#define REGISTER_MAIN_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), 0 TSRMLS_CC)
-
-void clean_module_constants(int module_number TSRMLS_DC);
-void free_zend_constant(zend_constant *c);
-int zend_startup_constants(TSRMLS_D);
-int zend_shutdown_constants(TSRMLS_D);
-void zend_register_standard_constants(TSRMLS_D);
-void clean_non_persistent_constants(TSRMLS_D);
-ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC);
-ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC);
-ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC);
-ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC);
-ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC);
-ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC);
-void zend_copy_constants(HashTable *target, HashTable *sourc);
-void copy_zend_constant(zend_constant *c);
-
-#define ZEND_CONSTANT_DTOR (void (*)(void *)) free_zend_constant
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_default_classes.c b/Zend/zend_default_classes.c
deleted file mode 100644
index 99da4bf663..0000000000
--- a/Zend/zend_default_classes.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_API.h"
-
-zend_class_entry *default_exception_ptr;
-
-ZEND_FUNCTION(exception)
-{
- zval **message;
- zval **code;
- zval *tmp;
- zval *object;
- int argc = ZEND_NUM_ARGS();
-
- if (zend_get_parameters_ex(argc, &message, &code) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- object = getThis();
-
- if (argc > 0) {
- convert_to_string_ex(message);
- zval_add_ref(message);
- zend_hash_update(Z_OBJPROP_P(object), "message", sizeof("message"), (void **) message, sizeof(zval *), NULL);
- }
-
- if (argc > 1) {
- convert_to_long_ex(code);
- zval_add_ref(code);
- zend_hash_update(Z_OBJPROP_P(object), "code", sizeof("code"), (void **) code, sizeof(zval *), NULL);
- }
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, zend_get_executed_filename(TSRMLS_C), 1);
- zend_hash_update(Z_OBJPROP_P(object), "file", sizeof("file"), (void **) &tmp, sizeof(zval *), NULL);
- tmp = NULL;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, zend_get_executed_lineno(TSRMLS_C));
- zend_hash_update(Z_OBJPROP_P(object), "line", sizeof("line"), (void **) &tmp, sizeof(zval *), NULL);
-}
-
-#define DEFAULT_0_PARAMS \
- if (ZEND_NUM_ARGS() > 0) { \
- ZEND_WRONG_PARAM_COUNT(); \
- }
-
-static void _default_exception_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC)
-{
- zval **value;
-
- if (zend_hash_find(Z_OBJPROP_P(object), name, name_len, (void **) &value) == FAILURE) {
- RETURN_FALSE;
- }
-
- *return_value = **value;
- zval_copy_ctor(return_value);
-}
-
-ZEND_FUNCTION(getfile)
-{
- DEFAULT_0_PARAMS;
-
- _default_exception_get_entry(getThis(), "file", sizeof("file"), return_value TSRMLS_CC);
-}
-
-ZEND_FUNCTION(getline)
-{
- DEFAULT_0_PARAMS;
-
- _default_exception_get_entry(getThis(), "line", sizeof("line"), return_value TSRMLS_CC);
-}
-
-ZEND_FUNCTION(getmessage)
-{
- DEFAULT_0_PARAMS;
-
- _default_exception_get_entry(getThis(), "message", sizeof("message"), return_value TSRMLS_CC);
-}
-
-ZEND_FUNCTION(getcode)
-{
- DEFAULT_0_PARAMS;
-
- _default_exception_get_entry(getThis(), "code", sizeof("code"), return_value TSRMLS_CC);
-}
-
-static zend_function_entry default_exception_functions[] = {
- ZEND_FE(exception, NULL)
- ZEND_FE(getmessage, NULL)
- ZEND_FE(getcode, NULL)
- ZEND_FE(getfile, NULL)
- ZEND_FE(getline, NULL)
- {NULL, NULL, NULL}
-};
-
-static void zend_register_default_exception(TSRMLS_D)
-{
- zend_class_entry default_exception;
-
- INIT_CLASS_ENTRY(default_exception, "exception", default_exception_functions);
- default_exception_ptr = zend_register_internal_class(&default_exception TSRMLS_CC);
-}
-
-ZEND_API zend_class_entry *zend_exception_get_default(void)
-{
- return default_exception_ptr;
-}
-
-ZEND_API void zend_register_default_classes(TSRMLS_D)
-{
- zend_register_default_exception(TSRMLS_C);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_default_classes.h b/Zend/zend_default_classes.h
deleted file mode 100644
index 60511409b1..0000000000
--- a/Zend/zend_default_classes.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_DEFAULT_CLASSES_H
-#define ZEND_DEFAULT_CLASSES_H
-
-BEGIN_EXTERN_C()
-
-ZEND_API zend_class_entry *zend_exception_get_default(void);
-ZEND_API void zend_register_default_classes(TSRMLS_D);
-
-END_EXTERN_C()
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_dynamic_array.c b/Zend/zend_dynamic_array.c
deleted file mode 100644
index 306343b7cc..0000000000
--- a/Zend/zend_dynamic_array.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-
-typedef struct _dynamic_array {
- char *array;
- unsigned int element_size;
- unsigned int current;
- unsigned int allocated;
-} dynamic_array;
-
-ZEND_API int zend_dynamic_array_init(dynamic_array *da, unsigned int element_size, unsigned int size)
-{
- da->element_size = element_size;
- da->allocated = size;
- da->current = 0;
- da->array = (char *) emalloc(size*element_size);
- if (da->array == NULL) {
- return 1;
- }
- return 0;
-}
-
-ZEND_API void *zend_dynamic_array_push(dynamic_array *da)
-{
- if (da->current == da->allocated) {
- da->allocated *= 2;
- da->array = (char *) erealloc(da->array, da->allocated*da->element_size);
- }
- return (void *)(da->array+(da->current++)*da->element_size);
-}
-
-ZEND_API void *zend_dynamic_array_pop(dynamic_array *da)
-{
- return (void *)(da->array+(--(da->current))*da->element_size);
-
-}
-
-ZEND_API void *zend_dynamic_array_get_element(dynamic_array *da, unsigned int index)
-{
- if (index >= da->current) {
- return NULL;
- }
- return (void *)(da->array+index*da->element_size);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_dynamic_array.h b/Zend/zend_dynamic_array.h
deleted file mode 100644
index c321634267..0000000000
--- a/Zend/zend_dynamic_array.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_DYNAMIC_ARRAY_H
-#define ZEND_DYNAMIC_ARRAY_H
-
-typedef struct _dynamic_array {
- char *array;
- unsigned int element_size;
- unsigned int last_used;
- unsigned int allocated;
-} dynamic_array;
-
-BEGIN_EXTERN_C()
-ZEND_API int zend_dynamic_array_init(dynamic_array *da);
-ZEND_API void *zend_dynamic_array_push(dynamic_array *da);
-ZEND_API void *zend_dynamic_array_pop(dynamic_array *da);
-ZEND_API void *zend_dynamic_array_get_element(dynamic_array *da, unsigned int index);
-END_EXTERN_C()
-
-#endif /* ZEND_DYNAMIC_ARRAY_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_errors.h b/Zend/zend_errors.h
deleted file mode 100644
index 29a2e065ba..0000000000
--- a/Zend/zend_errors.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_ERRORS_H
-#define ZEND_ERRORS_H
-
-#define E_ERROR (1<<0L)
-#define E_WARNING (1<<1L)
-#define E_PARSE (1<<2L)
-#define E_NOTICE (1<<3L)
-#define E_CORE_ERROR (1<<4L)
-#define E_CORE_WARNING (1<<5L)
-#define E_COMPILE_ERROR (1<<6L)
-#define E_COMPILE_WARNING (1<<7L)
-#define E_USER_ERROR (1<<8L)
-#define E_USER_WARNING (1<<9L)
-#define E_USER_NOTICE (1<<10L)
-
-#define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE)
-#define E_CORE (E_CORE_ERROR | E_CORE_WARNING)
-
-#endif /* ZEND_ERRORS_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
deleted file mode 100644
index 99da4bf663..0000000000
--- a/Zend/zend_exceptions.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_API.h"
-
-zend_class_entry *default_exception_ptr;
-
-ZEND_FUNCTION(exception)
-{
- zval **message;
- zval **code;
- zval *tmp;
- zval *object;
- int argc = ZEND_NUM_ARGS();
-
- if (zend_get_parameters_ex(argc, &message, &code) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- object = getThis();
-
- if (argc > 0) {
- convert_to_string_ex(message);
- zval_add_ref(message);
- zend_hash_update(Z_OBJPROP_P(object), "message", sizeof("message"), (void **) message, sizeof(zval *), NULL);
- }
-
- if (argc > 1) {
- convert_to_long_ex(code);
- zval_add_ref(code);
- zend_hash_update(Z_OBJPROP_P(object), "code", sizeof("code"), (void **) code, sizeof(zval *), NULL);
- }
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, zend_get_executed_filename(TSRMLS_C), 1);
- zend_hash_update(Z_OBJPROP_P(object), "file", sizeof("file"), (void **) &tmp, sizeof(zval *), NULL);
- tmp = NULL;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, zend_get_executed_lineno(TSRMLS_C));
- zend_hash_update(Z_OBJPROP_P(object), "line", sizeof("line"), (void **) &tmp, sizeof(zval *), NULL);
-}
-
-#define DEFAULT_0_PARAMS \
- if (ZEND_NUM_ARGS() > 0) { \
- ZEND_WRONG_PARAM_COUNT(); \
- }
-
-static void _default_exception_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC)
-{
- zval **value;
-
- if (zend_hash_find(Z_OBJPROP_P(object), name, name_len, (void **) &value) == FAILURE) {
- RETURN_FALSE;
- }
-
- *return_value = **value;
- zval_copy_ctor(return_value);
-}
-
-ZEND_FUNCTION(getfile)
-{
- DEFAULT_0_PARAMS;
-
- _default_exception_get_entry(getThis(), "file", sizeof("file"), return_value TSRMLS_CC);
-}
-
-ZEND_FUNCTION(getline)
-{
- DEFAULT_0_PARAMS;
-
- _default_exception_get_entry(getThis(), "line", sizeof("line"), return_value TSRMLS_CC);
-}
-
-ZEND_FUNCTION(getmessage)
-{
- DEFAULT_0_PARAMS;
-
- _default_exception_get_entry(getThis(), "message", sizeof("message"), return_value TSRMLS_CC);
-}
-
-ZEND_FUNCTION(getcode)
-{
- DEFAULT_0_PARAMS;
-
- _default_exception_get_entry(getThis(), "code", sizeof("code"), return_value TSRMLS_CC);
-}
-
-static zend_function_entry default_exception_functions[] = {
- ZEND_FE(exception, NULL)
- ZEND_FE(getmessage, NULL)
- ZEND_FE(getcode, NULL)
- ZEND_FE(getfile, NULL)
- ZEND_FE(getline, NULL)
- {NULL, NULL, NULL}
-};
-
-static void zend_register_default_exception(TSRMLS_D)
-{
- zend_class_entry default_exception;
-
- INIT_CLASS_ENTRY(default_exception, "exception", default_exception_functions);
- default_exception_ptr = zend_register_internal_class(&default_exception TSRMLS_CC);
-}
-
-ZEND_API zend_class_entry *zend_exception_get_default(void)
-{
- return default_exception_ptr;
-}
-
-ZEND_API void zend_register_default_classes(TSRMLS_D)
-{
- zend_register_default_exception(TSRMLS_C);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h
deleted file mode 100644
index 60511409b1..0000000000
--- a/Zend/zend_exceptions.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_DEFAULT_CLASSES_H
-#define ZEND_DEFAULT_CLASSES_H
-
-BEGIN_EXTERN_C()
-
-ZEND_API zend_class_entry *zend_exception_get_default(void);
-ZEND_API void zend_register_default_classes(TSRMLS_D);
-
-END_EXTERN_C()
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
deleted file mode 100644
index bed9bd8a97..0000000000
--- a/Zend/zend_execute.c
+++ /dev/null
@@ -1,4276 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#define ZEND_INTENSIVE_DEBUGGING 0
-
-#include <stdio.h>
-#include <signal.h>
-
-#include "zend.h"
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_API.h"
-#include "zend_ptr_stack.h"
-#include "zend_constants.h"
-#include "zend_extensions.h"
-#include "zend_fast_cache.h"
-#include "zend_execute_locks.h"
-#include "zend_ini.h"
-
-#define get_zval_ptr(node, Ts, should_free, type) _get_zval_ptr(node, Ts, should_free TSRMLS_CC)
-#define get_zval_ptr_ptr(node, Ts, type) _get_zval_ptr_ptr(node, Ts TSRMLS_CC)
-
-/* Prototypes */
-static void zend_fetch_var_address(zend_op *opline, temp_variable *Ts, int type TSRMLS_DC);
-static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC);
-static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC);
-static void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts TSRMLS_DC);
-static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC);
-static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC);
-static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC);
-
-#define RETURN_VALUE_USED(opline) (!((opline)->result.u.EA.type & EXT_TYPE_UNUSED))
-
-#define EX_T(offset) (*(temp_variable *)((char *) EX(Ts) + offset))
-#define T(offset) (*(temp_variable *)((char *) Ts + offset))
-
-static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, zval **should_free TSRMLS_DC)
-{
- switch (node->op_type) {
- case IS_CONST:
- *should_free = 0;
- return &node->u.constant;
- break;
- case IS_TMP_VAR:
- return *should_free = &T(node->u.var).tmp_var;
- break;
- case IS_VAR:
- if (T(node->u.var).var.ptr) {
- PZVAL_UNLOCK(T(node->u.var).var.ptr);
- *should_free = 0;
- return T(node->u.var).var.ptr;
- } else {
- *should_free = &T(node->u.var).tmp_var;
-
- switch (T(node->u.var).EA.type) {
- case IS_STRING_OFFSET: {
- temp_variable *T = &T(node->u.var);
- zval *str = T->EA.data.str_offset.str;
-
- if (T->EA.data.str_offset.str->type != IS_STRING
- || (T->EA.data.str_offset.offset<0)
- || (T->EA.data.str_offset.str->value.str.len <= T->EA.data.str_offset.offset)) {
- zend_error(E_NOTICE, "Uninitialized string offset: %d", T->EA.data.str_offset.offset);
- T->tmp_var.value.str.val = empty_string;
- T->tmp_var.value.str.len = 0;
- } else {
- char c = str->value.str.val[T->EA.data.str_offset.offset];
-
- T->tmp_var.value.str.val = estrndup(&c, 1);
- T->tmp_var.value.str.len = 1;
- }
- PZVAL_UNLOCK(str);
- T->tmp_var.refcount=1;
- T->tmp_var.is_ref=1;
- T->tmp_var.type = IS_STRING;
- return &T->tmp_var;
- }
- break;
- }
- }
- break;
- case IS_UNUSED:
- *should_free = 0;
- return NULL;
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- return NULL;
-}
-
-static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts TSRMLS_DC)
-{
- if (node->op_type==IS_VAR) {
- if (T(node->u.var).var.ptr_ptr) {
- PZVAL_UNLOCK(*T(node->u.var).var.ptr_ptr);
- } else if (T(node->u.var).EA.type==IS_STRING_OFFSET) {
- PZVAL_UNLOCK(T(node->u.var).EA.data.str_offset.str);
- }
- return T(node->u.var).var.ptr_ptr;
- } else {
- return NULL;
- }
-}
-
-static inline zval **zend_fetch_property_address_inner(zval *object, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
-{
- zval *prop_ptr = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- zval **retval = NULL;
- zval tmp;
-
-
- switch (op2->op_type) {
- case IS_CONST:
- /* already a constant string */
- break;
- case IS_VAR:
- tmp = *prop_ptr;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- prop_ptr = &tmp;
- break;
- case IS_TMP_VAR:
- convert_to_string(prop_ptr);
- break;
- }
-
- if (Z_OBJ_HT_P(object)->get_property_ptr != NULL) {
- retval = Z_OBJ_HT_P(object)->get_property_ptr(object, prop_ptr TSRMLS_CC);
- }
-
- if (retval == NULL) {
- zend_error(E_WARNING, "This object doesn't support property references");
- retval = &EG(error_zval_ptr);
- }
-
- if (prop_ptr == &tmp) {
- zval_dtor(prop_ptr);
- }
- FREE_OP(Ts, op2, EG(free_op2));
- return retval;
-}
-
-
-
-static inline void zend_switch_free(zend_op *opline, temp_variable *Ts TSRMLS_DC)
-{
- switch (opline->op1.op_type) {
- case IS_VAR:
- if (!T(opline->op1.u.var).var.ptr_ptr) {
- get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R);
- FREE_OP(Ts, &opline->op1, EG(free_op1));
- } else {
- zval_ptr_dtor(&T(opline->op1.u.var).var.ptr);
- if (opline->extended_value) { /* foreach() free */
- zval_ptr_dtor(&T(opline->op1.u.var).var.ptr);
- }
- }
- break;
- case IS_TMP_VAR:
- zendi_zval_dtor(T(opline->op1.u.var).tmp_var);
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
-}
-
-void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts TSRMLS_DC)
-{
- zval *variable_ptr;
- zval *value_ptr;
-
- if (!value_ptr_ptr || !variable_ptr_ptr) {
- zend_error(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
- return;
- }
-
- variable_ptr = *variable_ptr_ptr;
- value_ptr = *value_ptr_ptr;
-
- if (variable_ptr == EG(error_zval_ptr) || value_ptr==EG(error_zval_ptr)) {
- variable_ptr_ptr = &EG(uninitialized_zval_ptr);
- } else if (variable_ptr != value_ptr) {
- variable_ptr->refcount--;
- if (variable_ptr->refcount==0) {
- zendi_zval_dtor(*variable_ptr);
- FREE_ZVAL(variable_ptr);
- }
-
- if (!PZVAL_IS_REF(value_ptr)) {
- /* break it away */
- value_ptr->refcount--;
- if (value_ptr->refcount>0) {
- ALLOC_ZVAL(*value_ptr_ptr);
- **value_ptr_ptr = *value_ptr;
- value_ptr = *value_ptr_ptr;
- zendi_zval_copy_ctor(*value_ptr);
- }
- value_ptr->refcount = 1;
- value_ptr->is_ref = 1;
- }
-
- *variable_ptr_ptr = value_ptr;
- value_ptr->refcount++;
- } else if (!variable_ptr->is_ref) {
- if (variable_ptr_ptr == value_ptr_ptr) {
- SEPARATE_ZVAL(variable_ptr_ptr);
- } else if (variable_ptr==EG(uninitialized_zval_ptr)
- || variable_ptr->refcount>2) {
- /* we need to separate */
- variable_ptr->refcount -= 2;
- ALLOC_ZVAL(*variable_ptr_ptr);
- **variable_ptr_ptr = *variable_ptr;
- zval_copy_ctor(*variable_ptr_ptr);
- *value_ptr_ptr = *variable_ptr_ptr;
- (*variable_ptr_ptr)->refcount = 2;
- }
- (*variable_ptr_ptr)->is_ref = 1;
- }
-
- if (result && !(result->u.EA.type & EXT_TYPE_UNUSED)) {
- T(result->u.var).var.ptr_ptr = variable_ptr_ptr;
- SELECTIVE_PZVAL_LOCK(*variable_ptr_ptr, result);
- AI_USE_PTR(T(result->u.var).var);
- }
-}
-
-static inline void make_real_object(zval **object_ptr TSRMLS_DC)
-{
-/* this should modify object only if it's empty */
- if ((*object_ptr)->type == IS_NULL
- || ((*object_ptr)->type == IS_BOOL && (*object_ptr)->value.lval==0)
- || ((*object_ptr)->type == IS_STRING && (*object_ptr)->value.str.len == 0)) {
- if (!PZVAL_IS_REF(*object_ptr)) {
- SEPARATE_ZVAL(object_ptr);
- }
- zend_error(E_NOTICE, "Creating default object from empty value");
- object_init(*object_ptr);
- }
-}
-
-static inline zval **get_obj_zval_ptr_ptr(znode *op, temp_variable *Ts, int type TSRMLS_DC)
-{
- if (op->op_type == IS_UNUSED) {
- if (EG(This)) {
- /* this should actually never be modified, _ptr_ptr is modified only when
- the object is empty */
- return &EG(This);
- } else {
- zend_error(E_ERROR, "Using $this when not in object context");
- }
- }
- return get_zval_ptr_ptr(op, Ts, type);
-}
-
-static inline zval *get_obj_zval_ptr(znode *op, temp_variable *Ts, zval **freeop, int type TSRMLS_DC)
-{
- if (op->op_type == IS_UNUSED) {
- if (EG(This)) {
- return EG(This);
- } else {
- zend_error(E_ERROR, "Using $this when not in object context");
- }
- }
- return get_zval_ptr(op, Ts, freeop, type);
-}
-
-static inline void zend_assign_to_object(znode *result, znode *op1, znode *op2, znode *value_op, temp_variable *Ts TSRMLS_DC)
-{
- zval **object_ptr = get_obj_zval_ptr_ptr(op1, Ts, BP_VAR_W TSRMLS_CC);
- zval *object;
- zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- zval *free_value;
- zval *value = get_zval_ptr(value_op, Ts, &free_value, BP_VAR_R);
- zval tmp;
- zval **retval = &T(result->u.var).var.ptr;
-
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
-
- if (object->type != IS_OBJECT) {
- zend_error(E_WARNING, "Attempt to assign property of non-object");
- FREE_OP(Ts, op2, EG(free_op2));
- *retval = EG(uninitialized_zval_ptr);
-
- SELECTIVE_PZVAL_LOCK(*retval, result);
- PZVAL_UNLOCK(value);
- return;
- }
-
- /* here we are sure we are dealing with an object */
- switch (op2->op_type) {
- case IS_CONST:
- /* already a constant string */
- break;
- case IS_VAR:
- tmp = *property;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- property = &tmp;
- break;
- case IS_TMP_VAR:
- convert_to_string(property);
- break;
- }
-
- if (EG(implicit_clone)) {
- SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
- object = *object_ptr;
- }
- /* by now, property is a string */
-
-
- /* separate our value if necessary */
- if (value_op->op_type == IS_TMP_VAR) {
- zval *orig_value = value;
-
- ALLOC_ZVAL(value);
- *value = *orig_value;
- value->is_ref = 0;
- value->refcount = 0;
- }
- Z_OBJ_HT_P(object)->write_property(object, property, value TSRMLS_CC);
- if (property == &tmp) {
- zval_dtor(property);
- }
-
- FREE_OP(Ts, op2, EG(free_op2));
- if (result) {
- T(result->u.var).var.ptr = value;
- T(result->u.var).var.ptr_ptr = NULL; /* see if we can nuke this */
- SELECTIVE_PZVAL_LOCK(value, result);
- }
-}
-
-static inline void zend_assign_to_object_op(znode *result, znode *op1, znode *op2, znode *value_op, temp_variable *Ts, int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC) TSRMLS_DC)
-{
- zval **object_ptr = get_obj_zval_ptr_ptr(op1, Ts, BP_VAR_W TSRMLS_CC);
- zval *object;
- zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- zval *free_value;
- zval *value = get_zval_ptr(value_op, Ts, &free_value, BP_VAR_R);
- zval tmp;
- zval **retval = &T(result->u.var).var.ptr;
- int have_get_ptr = 0;
-
- T(result->u.var).var.ptr_ptr = NULL;
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
-
- if (object->type != IS_OBJECT) {
- zend_error(E_WARNING, "Attempt to assign property of non-object");
- FREE_OP(Ts, op2, EG(free_op2));
-
- *retval = EG(uninitialized_zval_ptr);
-
- SELECTIVE_PZVAL_LOCK(*retval, result);
- return;
- }
-
- /* here we are sure we are dealing with an object */
- switch (op2->op_type) {
- case IS_CONST:
- /* already a constant string */
- break;
- case IS_VAR:
- tmp = *property;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- property = &tmp;
- break;
- case IS_TMP_VAR:
- convert_to_string(property);
- break;
- }
-
- /* here property is a string */
- if (Z_OBJ_HT_P(object)->get_property_zval_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_zval_ptr(object, property TSRMLS_CC);
- if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
- *retval = *zptr;
- SELECTIVE_PZVAL_LOCK(*retval, result);
- }
- }
-
- if (!have_get_ptr) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property TSRMLS_CC);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
- binary_op(z, z, value TSRMLS_CC);
- Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC);
- *retval = z;
- SELECTIVE_PZVAL_LOCK(*retval, result);
- if (z->refcount <= 1) {
- zval_dtor(z);
- }
- }
-
- if (property == &tmp) {
- zval_dtor(property);
- }
-
- FREE_OP(Ts, op2, EG(free_op2));
-}
-
-static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2, zval *value, int type, temp_variable *Ts TSRMLS_DC)
-{
- zval **variable_ptr_ptr = get_zval_ptr_ptr(op1, Ts, BP_VAR_W);
- zval *variable_ptr;
-
- if (!variable_ptr_ptr) {
- switch (T(op1->u.var).EA.type) {
- case IS_STRING_OFFSET: {
- temp_variable *T = &T(op1->u.var);
-
- if (T->EA.data.str_offset.str->type == IS_STRING) do {
- zval tmp;
- zval *final_value = value;
-
- if (((int)T->EA.data.str_offset.offset < 0)) {
- zend_error(E_WARNING, "Illegal string offset: %d", T->EA.data.str_offset.offset);
- break;
- }
- if (T->EA.data.str_offset.offset >= T->EA.data.str_offset.str->value.str.len) {
- zend_uint i;
-
- if (T->EA.data.str_offset.str->value.str.len==0) {
- STR_FREE(T->EA.data.str_offset.str->value.str.val);
- T->EA.data.str_offset.str->value.str.val = (char *) emalloc(T->EA.data.str_offset.offset+1+1);
- } else {
- T->EA.data.str_offset.str->value.str.val = (char *) erealloc(T->EA.data.str_offset.str->value.str.val, T->EA.data.str_offset.offset+1+1);
- }
- for (i=T->EA.data.str_offset.str->value.str.len; i<T->EA.data.str_offset.offset; i++) {
- T->EA.data.str_offset.str->value.str.val[i] = ' ';
- }
- T->EA.data.str_offset.str->value.str.val[T->EA.data.str_offset.offset+1] = 0;
- T->EA.data.str_offset.str->value.str.len = T->EA.data.str_offset.offset+1;
- }
-
- if (value->type!=IS_STRING) {
- tmp = *value;
- if (op2 && op2->op_type == IS_VAR) {
- zval_copy_ctor(&tmp);
- }
- convert_to_string(&tmp);
- final_value = &tmp;
- }
-
- T->EA.data.str_offset.str->value.str.val[T->EA.data.str_offset.offset] = final_value->value.str.val[0];
-
- if (op2) {
- if (op2->op_type == IS_VAR) {
- if (value == &T(op2->u.var).tmp_var) {
- STR_FREE(value->value.str.val);
- }
- } else {
- if (final_value == &T(op2->u.var).tmp_var) {
- /* we can safely free final_value here
- * because separation is done only
- * in case op2->op_type == IS_VAR */
- STR_FREE(final_value->value.str.val);
- }
- }
- }
- if (final_value == &tmp) {
- zval_dtor(final_value);
- }
- /*
- * the value of an assignment to a string offset is undefined
- T(result->u.var).var = &T->EA.data.str_offset.str;
- */
- } while (0);
- /* zval_ptr_dtor(&T->EA.data.str_offset.str); Nuke this line if it doesn't cause a leak */
- T->tmp_var.type = IS_STRING;
- }
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- T(result->u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr);
- SELECTIVE_PZVAL_LOCK(*T(result->u.var).var.ptr_ptr, result);
- AI_USE_PTR(T(result->u.var).var);
- return;
- }
-
- variable_ptr = *variable_ptr_ptr;
-
- if (variable_ptr == EG(error_zval_ptr)) {
- if (result) {
- T(result->u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr);
- SELECTIVE_PZVAL_LOCK(*T(result->u.var).var.ptr_ptr, result);
- AI_USE_PTR(T(result->u.var).var);
- }
- if (type==IS_TMP_VAR) {
- zval_dtor(value);
- }
- return;
- }
-
- if (PZVAL_IS_REF(variable_ptr)) {
- if (variable_ptr!=value) {
- zend_uint refcount = variable_ptr->refcount;
- zval garbage;
-
- if (type!=IS_TMP_VAR) {
- value->refcount++;
- }
- garbage = *variable_ptr;
- *variable_ptr = *value;
- variable_ptr->refcount = refcount;
- variable_ptr->is_ref = 1;
- if (type!=IS_TMP_VAR) {
- zendi_zval_copy_ctor(*variable_ptr);
- value->refcount--;
- }
- zendi_zval_dtor(garbage);
- }
- } else {
- variable_ptr->refcount--;
- if (variable_ptr->refcount==0) {
- switch (type) {
- case IS_VAR:
- /* break missing intentionally */
- case IS_CONST:
- if (variable_ptr==value) {
- variable_ptr->refcount++;
- } else if (PZVAL_IS_REF(value)) {
- zval tmp;
-
- tmp = *value;
- zval_copy_ctor(&tmp);
- tmp.refcount=1;
- zendi_zval_dtor(*variable_ptr);
- *variable_ptr = tmp;
- } else {
- value->refcount++;
- zendi_zval_dtor(*variable_ptr);
- safe_free_zval_ptr(variable_ptr);
- *variable_ptr_ptr = value;
- }
- break;
- case IS_TMP_VAR:
- zendi_zval_dtor(*variable_ptr);
- value->refcount=1;
- *variable_ptr = *value;
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- } else { /* we need to split */
- switch (type) {
- case IS_VAR:
- /* break missing intentionally */
- case IS_CONST:
- if (PZVAL_IS_REF(value) && value->refcount > 0) {
- ALLOC_ZVAL(variable_ptr);
- *variable_ptr_ptr = variable_ptr;
- *variable_ptr = *value;
- zval_copy_ctor(variable_ptr);
- variable_ptr->refcount=1;
- break;
- }
- *variable_ptr_ptr = value;
- value->refcount++;
- break;
- case IS_TMP_VAR:
- ALLOC_ZVAL(*variable_ptr_ptr);
- value->refcount=1;
- **variable_ptr_ptr = *value;
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- }
- (*variable_ptr_ptr)->is_ref=0;
- }
- if (result) {
- T(result->u.var).var.ptr_ptr = variable_ptr_ptr;
- SELECTIVE_PZVAL_LOCK(*variable_ptr_ptr, result);
- AI_USE_PTR(T(result->u.var).var);
- }
-}
-
-
-/* Utility Functions for Extensions */
-static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
-{
- if (extension->statement_handler) {
- extension->statement_handler(op_array);
- }
-}
-
-
-static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
-{
- if (extension->fcall_begin_handler) {
- extension->fcall_begin_handler(op_array);
- }
-}
-
-
-static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
-{
- if (extension->fcall_end_handler) {
- extension->fcall_end_handler(op_array);
- }
-}
-
-
-static void print_refcount(zval *p, char *str)
-{
- print_refcount(NULL, NULL);
-}
-
-
-static inline HashTable *zend_get_target_symbol_table(zend_op *opline, temp_variable *Ts, int type, zval *variable TSRMLS_DC)
-{
- switch (opline->op2.u.EA.type) {
- case ZEND_FETCH_LOCAL:
- return EG(active_symbol_table);
- break;
- case ZEND_FETCH_GLOBAL:
- /* Don't think this is actually needed.
- if (opline->op1.op_type == IS_VAR) {
- PZVAL_LOCK(varname);
- }
-+ */
- return &EG(symbol_table);
- break;
- case ZEND_FETCH_STATIC:
- if (!EG(active_op_array)->static_variables) {
- ALLOC_HASHTABLE(EG(active_op_array)->static_variables);
- zend_hash_init(EG(active_op_array)->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0);
- }
- return EG(active_op_array)->static_variables;
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- return NULL;
-}
-
-
-static void zend_fetch_var_address(zend_op *opline, temp_variable *Ts, int type TSRMLS_DC)
-{
- zval *free_op1;
- zval *varname = get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R);
- zval **retval;
- zval tmp_varname;
- HashTable *target_symbol_table;
-
- if (varname->type != IS_STRING) {
- tmp_varname = *varname;
- zval_copy_ctor(&tmp_varname);
- convert_to_string(&tmp_varname);
- varname = &tmp_varname;
- }
-
- if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
- target_symbol_table = NULL;
- retval = zend_std_get_static_property(T(opline->op2.u.var).EA.class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0 TSRMLS_CC);
- } else {
- target_symbol_table = zend_get_target_symbol_table(opline, Ts, type, varname TSRMLS_CC);
- if (!target_symbol_table) {
- return;
- }
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &retval) == FAILURE) {
- switch (type) {
- case BP_VAR_R:
- zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val);
- /* break missing intentionally */
- case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
- break;
- case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val);
- /* break missing intentionally */
- case BP_VAR_W: {
- zval *new_zval = &EG(uninitialized_zval);
-
- new_zval->refcount++;
- zend_hash_update(target_symbol_table, varname->value.str.val, varname->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval);
- }
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- }
- switch (opline->op2.u.EA.type) {
- case ZEND_FETCH_LOCAL:
- FREE_OP(Ts, &opline->op1, free_op1);
- break;
- case ZEND_FETCH_STATIC:
- zval_update_constant(retval, (void *) 1 TSRMLS_CC);
- break;
- }
- }
-
-
- if (varname == &tmp_varname) {
- zval_dtor(varname);
- }
- T(opline->result.u.var).var.ptr_ptr = retval;
- SELECTIVE_PZVAL_LOCK(*retval, &opline->result);
-}
-
-
-static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
-{
- zval *dim = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- zval **retval;
- char *offset_key;
- int offset_key_length;
-
- switch (dim->type) {
- case IS_NULL:
- offset_key = "";
- offset_key_length = 0;
- goto fetch_string_dim;
- case IS_STRING:
- offset_key = dim->value.str.val;
- offset_key_length = dim->value.str.len;
-
-fetch_string_dim:
- if (zend_hash_find(ht, offset_key, offset_key_length+1, (void **) &retval) == FAILURE) {
- switch (type) {
- case BP_VAR_R:
- zend_error(E_NOTICE,"Undefined index: %s", offset_key);
- /* break missing intentionally */
- case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
- break;
- case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined index: %s", offset_key);
- /* break missing intentionally */
- case BP_VAR_W: {
- zval *new_zval = &EG(uninitialized_zval);
-
- new_zval->refcount++;
- zend_hash_update(ht, offset_key, offset_key_length+1, &new_zval, sizeof(zval *), (void **) &retval);
- }
- break;
- }
- }
- break;
- case IS_DOUBLE:
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG: {
- long index;
-
- if (dim->type == IS_DOUBLE) {
- index = (long)dim->value.dval;
- } else {
- index = dim->value.lval;
- }
- if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) {
- switch (type) {
- case BP_VAR_R:
- zend_error(E_NOTICE,"Undefined offset: %d", index);
- /* break missing intentionally */
- case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
- break;
- case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined offset: %d", index);
- /* break missing intentionally */
- case BP_VAR_W: {
- zval *new_zval = &EG(uninitialized_zval);
-
- new_zval->refcount++;
- zend_hash_index_update(ht, index, &new_zval, sizeof(zval *), (void **) &retval);
- }
- break;
- }
- }
- }
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type");
- if (type == BP_VAR_R || type == BP_VAR_IS) {
- retval = &EG(uninitialized_zval_ptr);
- } else {
- retval = &EG(error_zval_ptr);
- }
- break;
- }
- FREE_OP(Ts, op2, EG(free_op2));
- return retval;
-}
-
-static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
-{
- zval **container_ptr = get_zval_ptr_ptr(op1, Ts, type);
- zval *container;
- zval ***retval = &T(result->u.var).var.ptr_ptr;
-
- if (!container_ptr) {
- if (T(op1->u.var).EA.type == IS_STRING_OFFSET) {
- zval *offset;
- zend_error(E_WARNING, "Cannot use string offset as an array");
-
- offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- FREE_OP(Ts, op2, EG(free_op2));
- }
- *retval = &EG(error_zval_ptr);
- SELECTIVE_PZVAL_LOCK(**retval, result);
- return;
- }
-
- container = *container_ptr;
-
- if (container == EG(error_zval_ptr)) {
- *retval = &EG(error_zval_ptr);
- SELECTIVE_PZVAL_LOCK(**retval, result);
- return;
- }
-
- if (container->type==IS_NULL
- || (container->type==IS_BOOL && container->value.lval==0)
- || (container->type==IS_STRING && container->value.str.len==0)) {
- switch (type) {
- case BP_VAR_RW:
- case BP_VAR_W:
- if (!PZVAL_IS_REF(container)) {
- SEPARATE_ZVAL(container_ptr);
- container = *container_ptr;
- }
- array_init(container);
- break;
- }
- }
-
- switch (container->type) {
- case IS_ARRAY:
- if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) {
- SEPARATE_ZVAL(container_ptr);
- container = *container_ptr;
- }
- if (op2->op_type == IS_UNUSED) {
- zval *new_zval = &EG(uninitialized_zval);
-
- new_zval->refcount++;
- if (zend_hash_next_index_insert(container->value.ht, &new_zval, sizeof(zval *), (void **) retval) == FAILURE) {
- zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
- *retval = &EG(uninitialized_zval_ptr);
- new_zval->refcount--;
- }
- } else {
- *retval = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, type TSRMLS_CC);
- }
- SELECTIVE_PZVAL_LOCK(**retval, result);
- break;
- case IS_NULL:
- /* for read-mode only */
- get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- *retval = &EG(uninitialized_zval_ptr);
- SELECTIVE_PZVAL_LOCK(**retval, result);
- FREE_OP(Ts, op2, EG(free_op2));
- if (type==BP_VAR_W || type==BP_VAR_RW) {
- zend_error(E_WARNING, "Cannot use a NULL value as an array");
- }
- break;
- case IS_STRING: {
- zval *offset;
- zval tmp;
-
- if (op2->op_type==IS_UNUSED) {
- zend_error(E_ERROR, "[] operator not supported for strings");
- }
-
- offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
-
- if (offset->type != IS_LONG) {
- tmp = *offset;
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- offset = &tmp;
- }
- if (type!=BP_VAR_R && type!=BP_VAR_IS) {
- SEPARATE_ZVAL_IF_NOT_REF(container_ptr);
- }
- container = *container_ptr;
- T(result->u.var).EA.data.str_offset.str = container;
- PZVAL_LOCK(container);
- T(result->u.var).EA.data.str_offset.offset = offset->value.lval;
- T(result->u.var).EA.type = IS_STRING_OFFSET;
- FREE_OP(Ts, op2, EG(free_op2));
- *retval = NULL;
- return;
- }
- break;
- default: {
- zval *offset;
-
- offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- if (type==BP_VAR_R || type==BP_VAR_IS) {
- *retval = &EG(uninitialized_zval_ptr);
- } else {
- *retval = &EG(error_zval_ptr);
- }
- FREE_OP(Ts, op2, EG(free_op2));
- SELECTIVE_PZVAL_LOCK(**retval, result);
- if (type==BP_VAR_W || type==BP_VAR_RW) {
- zend_error(E_WARNING, "Cannot use a scalar value as an array");
- }
- }
- break;
- }
-}
-
-
-static void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts TSRMLS_DC)
-{
- zval *free_op1;
- zval *container = get_zval_ptr(op1, Ts, &free_op1, BP_VAR_R);
-
- if (container->type != IS_ARRAY) {
- T(result->u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr);
- SELECTIVE_PZVAL_LOCK(*T(result->u.var).var.ptr_ptr, result);
- return;
- }
-
- T(result->u.var).var.ptr_ptr = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, BP_VAR_R TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(*T(result->u.var).var.ptr_ptr, result);
-}
-
-static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
-{
- zval **container_ptr = get_obj_zval_ptr_ptr(op1, Ts, type TSRMLS_CC);
- zval *container;
- zval ***retval = &T(result->u.var).var.ptr_ptr;
-
- container = *container_ptr;
- if (container == EG(error_zval_ptr)) {
- *retval = &EG(error_zval_ptr);
- SELECTIVE_PZVAL_LOCK(**retval, result);
- return;
- }
- /* this should modify object only if it's empty */
- if (container->type == IS_NULL
- || (container->type == IS_BOOL && container->value.lval==0)
- || (container->type == IS_STRING && container->value.str.len == 0)) {
- switch (type) {
- case BP_VAR_RW:
- case BP_VAR_W:
- if (!PZVAL_IS_REF(container)) {
- SEPARATE_ZVAL(container_ptr);
- container = *container_ptr;
- }
- object_init(container);
- break;
- }
- }
-
- if (container->type != IS_OBJECT) {
- zval *offset;
-
- offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- FREE_OP(Ts, op2, EG(free_op2));
- if (type == BP_VAR_R || type == BP_VAR_IS) {
- *retval = &EG(uninitialized_zval_ptr);
- } else {
- *retval = &EG(error_zval_ptr);
- }
- SELECTIVE_PZVAL_LOCK(**retval, result);
- return;
- }
-
-
- if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) {
- SEPARATE_ZVAL(container_ptr);
- container = *container_ptr;
- }
- *retval = zend_fetch_property_address_inner(container, op2, Ts, type TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(**retval, result);
-}
-
-static void zend_fetch_property_address_read(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
-{
- zval *container;
- zval **retval;
-
- retval = &T(result->u.var).var.ptr;
- T(result->u.var).var.ptr_ptr = retval;
-
- container = get_obj_zval_ptr(op1, Ts, &EG(free_op1), type TSRMLS_CC);
-
- if (container == EG(error_zval_ptr)) {
- *retval = EG(error_zval_ptr);
- SELECTIVE_PZVAL_LOCK(*retval, result);
- return;
- }
-
-
- if (container->type != IS_OBJECT) {
- zend_error(E_NOTICE, "Trying to get property of non-object");
-
- if (type==BP_VAR_R || type==BP_VAR_IS) {
- *retval = EG(uninitialized_zval_ptr);
- } else {
- *retval = EG(error_zval_ptr);
- }
- } else {
- zval *offset;
- zval tmp;
-
- offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- switch (op2->op_type) {
- case IS_CONST:
- /* already a constant string */
- break;
- case IS_VAR:
- tmp = *offset;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- offset = &tmp;
- break;
- case IS_TMP_VAR:
- convert_to_string(offset);
- break;
- }
-
- /* here we are sure we are dealing with an object */
- *retval = Z_OBJ_HT_P(container)->read_property(container, offset TSRMLS_CC);
- if (offset == &tmp) {
- zval_dtor(offset);
- }
- FREE_OP(Ts, op2, EG(free_op2));
- }
-
- SELECTIVE_PZVAL_LOCK(*retval, result);
- return;
-}
-
-static void zend_pre_incdec_property(znode *result, znode *op1, znode *op2, temp_variable * Ts, int (*incdec_op)(zval *) TSRMLS_DC)
-{
- zval **object_ptr = get_obj_zval_ptr_ptr(op1, Ts, BP_VAR_W TSRMLS_CC);
- zval *object;
- zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- zval **retval = &T(result->u.var).var.ptr;
- int have_get_ptr = 0;
-
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
-
- if (object->type != IS_OBJECT) {
- zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- FREE_OP(Ts, op2, EG(free_op2));
- *retval = EG(uninitialized_zval_ptr);
-
- SELECTIVE_PZVAL_LOCK(*retval, result);
- return;
- }
-
- /* here we are sure we are dealing with an object */
-
- if (Z_OBJ_HT_P(object)->get_property_zval_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_zval_ptr(object, property TSRMLS_CC);
- if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- have_get_ptr = 1;
- incdec_op(*zptr);
- *retval = *zptr;
- SELECTIVE_PZVAL_LOCK(*retval, result);
- }
- }
-
- if (!have_get_ptr) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property TSRMLS_CC);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
- incdec_op(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC);
- if (z->refcount <= 1) {
- zval_dtor(z);
- }
- }
-
- FREE_OP(Ts, op2, EG(free_op2));
-}
-
-static void zend_post_incdec_property(znode *result, znode *op1, znode *op2, temp_variable * Ts, int (*incdec_op)(zval *) TSRMLS_DC)
-{
- zval **object_ptr = get_obj_zval_ptr_ptr(op1, Ts, BP_VAR_W TSRMLS_CC);
- zval *object;
- zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- zval *retval = &T(result->u.var).tmp_var;
- int have_get_ptr = 0;
-
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
-
- if (object->type != IS_OBJECT) {
- zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- FREE_OP(Ts, op2, EG(free_op2));
- *retval = *EG(uninitialized_zval_ptr);
- return;
- }
-
- /* here we are sure we are dealing with an object */
-
- if (Z_OBJ_HT_P(object)->get_property_zval_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_zval_ptr(object, property TSRMLS_CC);
- if (zptr != NULL) { /* NULL means no success in getting PTR */
- have_get_ptr = 1;
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- *retval = **zptr;
- zendi_zval_copy_ctor(*retval);
-
- incdec_op(*zptr);
-
- }
- }
-
- if (!have_get_ptr) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property TSRMLS_CC);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
- *retval = *z;
- zendi_zval_copy_ctor(*retval);
- incdec_op(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC);
- if (z->refcount <= 1) {
- zval_dtor(z);
- }
- }
-
- FREE_OP(Ts, op2, EG(free_op2));
-}
-
-
-#if ZEND_INTENSIVE_DEBUGGING
-
-#define CHECK_SYMBOL_TABLES() \
- zend_hash_apply(&EG(symbol_table), (apply_func_t) zend_check_symbol TSRMLS_CC); \
- if (&EG(symbol_table)!=EG(active_symbol_table)) { \
- zend_hash_apply(EG(active_symbol_table), (apply_func_t) zend_check_symbol TSRMLS_CC); \
- }
-
-static int zend_check_symbol(zval **pz TSRMLS_DC)
-{
- if (Z_TYPE_PP(pz) > 9) {
- fprintf(stderr, "Warning! %x has invalid type!\n", *pz);
- } else if (Z_TYPE_PP(pz) == IS_ARRAY) {
- zend_hash_apply(Z_ARRVAL_PP(pz), (apply_func_t) zend_check_symbol TSRMLS_CC);
- } else if (Z_TYPE_PP(pz) == IS_OBJECT) {
-
- /* OBJ-TBI - doesn't support new object model! */
- zend_hash_apply(Z_OBJPROP_PP(pz), (apply_func_t) zend_check_symbol TSRMLS_CC);
- }
-
- return 0;
-}
-
-
-#else
-#define CHECK_SYMBOL_TABLES()
-#endif
-
-#define NEXT_OPCODE() \
- CHECK_SYMBOL_TABLES() \
- EX(opline)++; \
- return 0; /* CHECK_ME */
-
-#define RETURN_FROM_EXECUTE_LOOP(execute_data) \
- free_alloca(EX(Ts)); \
- EG(in_execution) = EX(original_in_execution); \
- EG(current_execute_data) = EX(prev_execute_data); \
- return 1; /* CHECK_ME */
-
-opcode_handler_t zend_opcode_handlers[512];
-
-ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC)
-{
- ((zend_internal_function *) execute_data_ptr->function_state.function)->handler(execute_data_ptr->opline->extended_value, (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.u.var)).var.ptr, execute_data_ptr->object, return_value_used TSRMLS_CC);
-}
-
-ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
-{
- zend_execute_data execute_data;
-
- /* Initialize execute_data */
- EX(fbc) = NULL;
- EX(object) = NULL;
- EX(Ts) = (temp_variable *) do_alloca(sizeof(temp_variable)*op_array->T);
- EX(op_array) = op_array;
- EX(original_in_execution) = EG(in_execution);
- EX(prev_execute_data) = EG(current_execute_data);
- EG(current_execute_data) = &execute_data;
-
- EG(in_execution) = 1;
- if (op_array->start_op) {
- EX(opline) = op_array->start_op;
- } else {
- EX(opline) = op_array->opcodes;
- }
-
- if (op_array->uses_this && EG(This)) {
- EG(This)->refcount++; /* For $this pointer */
- if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), NULL)==FAILURE) {
- EG(This)->refcount--;
- }
- }
-
- EG(opline_ptr) = &EX(opline);
-
- EX(function_state).function = (zend_function *) op_array;
- EG(function_state_ptr) = &EX(function_state);
-#if ZEND_DEBUG
- /* function_state.function_symbol_table is saved as-is to a stack,
- * which is an intentional UMR. Shut it up if we're in DEBUG.
- */
- EX(function_state).function_symbol_table = NULL;
-#endif
- if(EG(active_namespace) != op_array->ns) {
- zend_switch_namespace(op_array->ns TSRMLS_CC);
- }
-
- while (1) {
-#ifdef ZEND_WIN32
- if (EG(timed_out)) {
- zend_timeout(0);
- }
-#endif
-
- zend_clean_garbage(TSRMLS_C);
- if (EX(opline)->handler(&execute_data, op_array TSRMLS_CC)) {
- return;
- }
- }
- zend_error(E_ERROR, "Arrived at end of main loop which shouldn't happen");
-}
-
-/* CHECK_ME */
-#undef EX
-#define EX(element) execute_data->element
-
-int zend_add_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- add_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_sub_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- sub_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_mul_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- mul_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_div_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- div_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_mod_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- mod_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_sl_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- shift_left_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_sr_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- shift_right_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_concat_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- concat_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_is_identical_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- is_identical_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_is_not_identical_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- is_not_identical_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_is_equal_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- is_equal_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_is_not_equal_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- is_not_equal_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_is_smaller_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- is_smaller_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_is_smaller_or_equal_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- is_smaller_or_equal_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_bw_or_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- bitwise_or_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_bw_and_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- bitwise_and_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_bw_xor_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- bitwise_xor_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_bool_xor_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- boolean_xor_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
-}
-
-
-int zend_bw_not_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- bitwise_not_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- NEXT_OPCODE();
-}
-
-
-int zend_bool_not_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- boolean_not_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- NEXT_OPCODE();
-}
-
-
-inline int zend_binary_assign_op_helper(void *binary_op_arg, ZEND_OPCODE_HANDLER_ARGS)
-{
- zval **var_ptr = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_RW);
- int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC) = binary_op_arg;
-
- if (!var_ptr) {
- zend_error(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
- }
-
- if (*var_ptr == EG(error_zval_ptr)) {
- EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr);
- SELECTIVE_PZVAL_LOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr, &EX(opline)->result);
- AI_USE_PTR(EX_T(EX(opline)->result.u.var).var);
- NEXT_OPCODE();
- }
-
- SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
-
- binary_op(*var_ptr, *var_ptr, get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- EX_T(EX(opline)->result.u.var).var.ptr_ptr = var_ptr;
- SELECTIVE_PZVAL_LOCK(*var_ptr, &EX(opline)->result);
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- AI_USE_PTR(EX_T(EX(opline)->result.u.var).var);
-
- NEXT_OPCODE();
-}
-
-
-int zend_assign_add_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_binary_assign_op_helper(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_assign_sub_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_binary_assign_op_helper(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_assign_mul_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_binary_assign_op_helper(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_assign_div_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_binary_assign_op_helper(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_assign_mod_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_binary_assign_op_helper(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_assign_sl_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_binary_assign_op_helper(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_assign_sr_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_binary_assign_op_helper(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_assign_concat_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_binary_assign_op_helper(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_assign_bw_or_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_binary_assign_op_helper(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_assign_bw_and_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_binary_assign_op_helper(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_assign_bw_xor_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_binary_assign_op_helper(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_assign_add_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_op *op_data = EX(opline)+1;
- zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), add_function TSRMLS_CC);
- /* assign_obj has two opcodes! */
- EX(opline)++;
- NEXT_OPCODE();
-}
-
-
-int zend_assign_sub_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_op *op_data = EX(opline)+1;
- zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), sub_function TSRMLS_CC);
- /* assign_obj has two opcodes! */
- EX(opline)++;
- NEXT_OPCODE();
-}
-
-
-int zend_assign_mul_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_op *op_data = EX(opline)+1;
- zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), mul_function TSRMLS_CC);
- /* assign_obj has two opcodes! */
- EX(opline)++;
- NEXT_OPCODE();
-}
-
-
-int zend_assign_div_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_op *op_data = EX(opline)+1;
- zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), div_function TSRMLS_CC);
- /* assign_obj has two opcodes! */
- EX(opline)++;
- NEXT_OPCODE();
-}
-
-
-int zend_assign_mod_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_op *op_data = EX(opline)+1;
- zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), mod_function TSRMLS_CC);
- /* assign_obj has two opcodes! */
- EX(opline)++;
- NEXT_OPCODE();
-}
-
-
-int zend_assign_sl_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_op *op_data = EX(opline)+1;
- zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), shift_left_function TSRMLS_CC);
- /* assign_obj has two opcodes! */
- EX(opline)++;
- NEXT_OPCODE();
-}
-
-
-int zend_assign_sr_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_op *op_data = EX(opline)+1;
- zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), shift_right_function TSRMLS_CC);
- /* assign_obj has two opcodes! */
- EX(opline)++;
- NEXT_OPCODE();
-}
-
-
-int zend_assign_concat_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_op *op_data = EX(opline)+1;
- zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), concat_function TSRMLS_CC);
- /* assign_obj has two opcodes! */
- EX(opline)++;
- NEXT_OPCODE();
-}
-
-
-int zend_assign_bw_or_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_op *op_data = EX(opline)+1;
- zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), bitwise_or_function TSRMLS_CC);
- /* assign_obj has two opcodes! */
- EX(opline)++;
- NEXT_OPCODE();
-}
-
-
-int zend_assign_bw_and_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_op *op_data = EX(opline)+1;
- zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), bitwise_and_function TSRMLS_CC);
- /* assign_obj has two opcodes! */
- EX(opline)++;
- NEXT_OPCODE();
-}
-
-
-int zend_assign_bw_xor_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_op *op_data = EX(opline)+1;
- zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), bitwise_xor_function TSRMLS_CC);
- /* assign_obj has two opcodes! */
- EX(opline)++;
- NEXT_OPCODE();
-}
-
-
-int zend_pre_inc_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_pre_incdec_property(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), increment_function TSRMLS_CC);
- NEXT_OPCODE();
-}
-
-
-int zend_pre_dec_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_pre_incdec_property(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), decrement_function TSRMLS_CC);
- NEXT_OPCODE();
-}
-
-
-int zend_post_inc_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_post_incdec_property(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), increment_function TSRMLS_CC);
- NEXT_OPCODE();
-}
-
-
-int zend_post_dec_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_post_incdec_property(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), decrement_function TSRMLS_CC);
- NEXT_OPCODE();
-}
-
-
-inline int zend_incdec_op_helper(void *incdec_op_arg, ZEND_OPCODE_HANDLER_ARGS)
-{
- zval **var_ptr = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_RW);
- int (*incdec_op)(zval *op1) = incdec_op_arg;
-
- if (!var_ptr) {
- zend_error(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
- }
- if (*var_ptr == EG(error_zval_ptr)) {
- EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr);
- SELECTIVE_PZVAL_LOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr, &EX(opline)->result);
- AI_USE_PTR(EX_T(EX(opline)->result.u.var).var);
- NEXT_OPCODE();
- }
-
- switch (EX(opline)->opcode) {
- case ZEND_POST_INC:
- case ZEND_POST_DEC:
- EX_T(EX(opline)->result.u.var).tmp_var = **var_ptr;
- zendi_zval_copy_ctor(EX_T(EX(opline)->result.u.var).tmp_var);
- break;
- }
-
- SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
-
- incdec_op(*var_ptr);
-
- switch (EX(opline)->opcode) {
- case ZEND_PRE_INC:
- case ZEND_PRE_DEC:
- EX_T(EX(opline)->result.u.var).var.ptr_ptr = var_ptr;
- SELECTIVE_PZVAL_LOCK(*var_ptr, &EX(opline)->result);
- AI_USE_PTR(EX_T(EX(opline)->result.u.var).var);
- break;
- }
- NEXT_OPCODE();
-}
-
-
-int zend_pre_inc_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_incdec_op_helper(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_pre_dec_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_incdec_op_helper(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_post_inc_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_incdec_op_helper(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_post_dec_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_incdec_op_helper(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_print_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_print_variable(get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R));
- EX_T(EX(opline)->result.u.var).tmp_var.value.lval = 1;
- EX_T(EX(opline)->result.u.var).tmp_var.type = IS_LONG;
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- NEXT_OPCODE();
-}
-
-
-int zend_echo_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_print_variable(get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R));
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_r_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_R TSRMLS_CC);
- AI_USE_PTR(EX_T(EX(opline)->result.u.var).var);
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_w_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_W TSRMLS_CC);
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_rw_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_RW TSRMLS_CC);
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_func_arg_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- if (ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->extended_value, EX(fbc), EX(fbc)->common.arg_types)) {
- /* Behave like FETCH_W */
- zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_W TSRMLS_CC);
- } else {
- /* Behave like FETCH_R */
- zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_R TSRMLS_CC);
- AI_USE_PTR(EX_T(EX(opline)->result.u.var).var);
- }
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_unset_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_R TSRMLS_CC);
- PZVAL_UNLOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr);
- if (EX_T(EX(opline)->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(EX(opline)->result.u.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr);
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_is_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_IS TSRMLS_CC);
- AI_USE_PTR(EX_T(EX(opline)->result.u.var).var);
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_dim_r_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- if (EX(opline)->extended_value == ZEND_FETCH_ADD_LOCK) {
- PZVAL_LOCK(*EX_T(EX(opline)->op1.u.var).var.ptr_ptr);
- }
- zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
- AI_USE_PTR(EX_T(EX(opline)->result.u.var).var);
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_dim_w_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_W TSRMLS_CC);
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_dim_rw_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_RW TSRMLS_CC);
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_dim_is_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_IS TSRMLS_CC);
- AI_USE_PTR(EX_T(EX(opline)->result.u.var).var);
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_dim_func_arg_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- if (ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->extended_value, EX(fbc), EX(fbc)->common.arg_types)) {
- /* Behave like FETCH_DIM_W */
- zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_W TSRMLS_CC);
- } else {
- /* Behave like FETCH_DIM_R, except for locking used for list() */
- zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
- AI_USE_PTR(EX_T(EX(opline)->result.u.var).var);
- }
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_dim_unset_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- /* Not needed in DIM_UNSET
- if (EX(opline)->extended_value == ZEND_FETCH_ADD_LOCK) {
- PZVAL_LOCK(*EX_T(EX(opline)->op1.u.var).var.ptr_ptr);
- }
- */
- zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
- PZVAL_UNLOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr);
- if (EX_T(EX(opline)->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(EX(opline)->result.u.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr);
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_obj_r_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_fetch_property_address_read(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
- AI_USE_PTR(EX_T(EX(opline)->result.u.var).var);
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_obj_w_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_fetch_property_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_W TSRMLS_CC);
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_obj_rw_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_fetch_property_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_RW TSRMLS_CC);
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_obj_is_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_fetch_property_address_read(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_IS TSRMLS_CC);
- AI_USE_PTR(EX_T(EX(opline)->result.u.var).var);
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_obj_func_arg_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- if (ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->extended_value, EX(fbc), EX(fbc)->common.arg_types)) {
- /* Behave like FETCH_OBJ_W */
- zend_fetch_property_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_W TSRMLS_CC);
- } else {
- zend_fetch_property_address_read(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
- AI_USE_PTR(EX_T(EX(opline)->result.u.var).var);
- }
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_obj_unset_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_fetch_property_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
-
- PZVAL_UNLOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr);
- if (EX_T(EX(opline)->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(EX(opline)->result.u.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr);
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_dim_tmp_var_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_fetch_dimension_address_from_tmp_var(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts) TSRMLS_CC);
- AI_USE_PTR(EX_T(EX(opline)->result.u.var).var);
- NEXT_OPCODE();
-}
-
-
-int zend_make_var_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *value, *value2;
-
- value = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- switch (EX(opline)->op1.op_type) {
- case IS_TMP_VAR:
- value2 = value;
- ALLOC_ZVAL(value);
- *value = *value2;
- value->is_ref = 0;
- value->refcount = 0; /* lock will increase this */
- break;
- case IS_CONST:
- value2 = value;
- ALLOC_ZVAL(value);
- *value = *value2;
- zval_copy_ctor(value);
- value->is_ref = 0;
- value->refcount = 0; /* lock will increase this */
- break;
- }
-
- EX_T(EX(opline)->result.u.var).var.ptr = value;
- PZVAL_LOCK(EX_T(EX(opline)->result.u.var).var.ptr);
-
- NEXT_OPCODE();
-}
-
-
-int zend_assign_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_op *op_data = EX(opline)+1;
- zend_assign_to_object(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts) TSRMLS_CC);
- /* assign_obj has two opcodes! */
- EX(opline)++;
- NEXT_OPCODE();
-}
-
-
-int zend_assign_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *value;
- value = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
-
- zend_assign_to_variable(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, value, (EG(free_op2)?IS_TMP_VAR:EX(opline)->op2.op_type), EX(Ts) TSRMLS_CC);
- /* zend_assign_to_variable() always takes care of op2, never free it! */
-
- NEXT_OPCODE();
-}
-
-
-int zend_assign_ref_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval **value_ptr_ptr = get_zval_ptr_ptr(&EX(opline)->op2, EX(Ts), BP_VAR_W);
-
- zend_assign_to_variable_reference(&EX(opline)->result, get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_W), value_ptr_ptr, EX(Ts) TSRMLS_CC);
-
- NEXT_OPCODE();
-}
-
-
-int zend_jmp_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
-#if DEBUG_ZEND>=2
- printf("Jumping to %d\n", EX(opline)->op1.u.opline_num);
-#endif
- EX(opline) = EX(opline)->op1.u.jmp_addr;
- return 0; /* CHECK_ME */
-}
-
-
-int zend_jmpz_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- znode *op1 = &EX(opline)->op1;
-
- if (!i_zend_is_true(get_zval_ptr(op1, EX(Ts), &EG(free_op1), BP_VAR_R))) {
-#if DEBUG_ZEND>=2
- printf("Conditional jmp to %d\n", EX(opline)->op2.u.opline_num);
-#endif
- EX(opline) = EX(opline)->op2.u.jmp_addr;
- FREE_OP(EX(Ts), op1, EG(free_op1));
- return 0; /* CHECK_ME */
- }
- FREE_OP(EX(Ts), op1, EG(free_op1));
-
- NEXT_OPCODE();
-}
-
-
-int zend_jmpnz_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- znode *op1 = &EX(opline)->op1;
-
- if (zend_is_true(get_zval_ptr(op1, EX(Ts), &EG(free_op1), BP_VAR_R))) {
-#if DEBUG_ZEND>=2
- printf("Conditional jmp to %d\n", EX(opline)->op2.u.opline_num);
-#endif
- EX(opline) = EX(opline)->op2.u.jmp_addr;
- FREE_OP(EX(Ts), op1, EG(free_op1));
- return 0; /* CHECK_ME */
- }
- FREE_OP(EX(Ts), op1, EG(free_op1));
-
- NEXT_OPCODE();
-}
-
-
-int zend_jmpznz_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- znode *res = &EX(opline)->op1;
-
- if (zend_is_true(get_zval_ptr(res, EX(Ts), &EG(free_op1), BP_VAR_R))) {
-#if DEBUG_ZEND>=2
- printf("Conditional jmp on true to %d\n", EX(opline)->extended_value);
-#endif
- EX(opline) = &op_array->opcodes[EX(opline)->extended_value];
- } else {
-#if DEBUG_ZEND>=2
- printf("Conditional jmp on false to %d\n", EX(opline)->op2.u.opline_num);
-#endif
- EX(opline) = &op_array->opcodes[EX(opline)->op2.u.opline_num];
- }
- FREE_OP(EX(Ts), res, EG(free_op1));
-
- return 0; /* CHECK_ME */
-}
-
-
-int zend_jmpz_ex_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_op *original_opline = EX(opline);
- int retval = zend_is_true(get_zval_ptr(&original_opline->op1, EX(Ts), &EG(free_op1), BP_VAR_R));
-
- FREE_OP(EX(Ts), &original_opline->op1, EG(free_op1));
- EX_T(original_opline->result.u.var).tmp_var.value.lval = retval;
- EX_T(original_opline->result.u.var).tmp_var.type = IS_BOOL;
- if (!retval) {
-#if DEBUG_ZEND>=2
- printf("Conditional jmp to %d\n", EX(opline)->op2.u.opline_num);
-#endif
- EX(opline) = EX(opline)->op2.u.jmp_addr;
- return 0; /* CHECK_ME */
- }
- NEXT_OPCODE();
-}
-
-
-int zend_jmpnz_ex_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_op *original_opline = EX(opline);
- int retval = zend_is_true(get_zval_ptr(&original_opline->op1, EX(Ts), &EG(free_op1), BP_VAR_R));
-
- FREE_OP(EX(Ts), &original_opline->op1, EG(free_op1));
- EX_T(original_opline->result.u.var).tmp_var.value.lval = retval;
- EX_T(original_opline->result.u.var).tmp_var.type = IS_BOOL;
- if (retval) {
-#if DEBUG_ZEND>=2
- printf("Conditional jmp to %d\n", EX(opline)->op2.u.opline_num);
-#endif
- EX(opline) = EX(opline)->op2.u.jmp_addr;
- return 0; /* CHECK_ME */
- }
- NEXT_OPCODE();
-}
-
-
-int zend_free_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zendi_zval_dtor(EX_T(EX(opline)->op1.u.var).tmp_var);
- NEXT_OPCODE();
-}
-
-
-int zend_init_string_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- EX_T(EX(opline)->result.u.var).tmp_var.value.str.val = emalloc(1);
- EX_T(EX(opline)->result.u.var).tmp_var.value.str.val[0] = 0;
- EX_T(EX(opline)->result.u.var).tmp_var.value.str.len = 0;
- EX_T(EX(opline)->result.u.var).tmp_var.refcount = 1;
- EX_T(EX(opline)->result.u.var).tmp_var.type = IS_STRING;
- EX_T(EX(opline)->result.u.var).tmp_var.is_ref = 0;
- NEXT_OPCODE();
-}
-
-
-int zend_add_char_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- add_char_to_string(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_NA),
- &EX(opline)->op2.u.constant);
- /* FREE_OP is missing intentionally here - we're always working on the same temporary variable */
- NEXT_OPCODE();
-}
-
-
-int zend_add_string_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- add_string_to_string(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_NA),
- &EX(opline)->op2.u.constant);
- /* FREE_OP is missing intentionally here - we're always working on the same temporary variable */
- NEXT_OPCODE();
-}
-
-
-int zend_add_var_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *var = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
- zval var_copy;
- int use_copy;
-
- zend_make_printable_zval(var, &var_copy, &use_copy);
- if (use_copy) {
- var = &var_copy;
- }
- add_string_to_string( &EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_NA),
- var);
- if (use_copy) {
- zval_dtor(var);
- }
- /* original comment, possibly problematic:
- * FREE_OP is missing intentionally here - we're always working on the same temporary variable
- * (Zeev): I don't think it's problematic, we only use variables
- * which aren't affected by FREE_OP(Ts, )'s anyway, unless they're
- * string offsets or overloaded objects
- */
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
-
- NEXT_OPCODE();
-}
-
-static int zend_import_check_function(HashTable *target_ht, zend_function *function, zend_hash_key *hash_key, void *param)
-{
- if(zend_hash_quick_exists(target_ht, hash_key->arKey, hash_key->nKeyLength, hash_key->h)) {
- zend_error(E_ERROR, "Import: function %s() already exists in current scope", function->common.function_name?function->common.function_name:"main");
- }
- return 1; /* OK */
-}
-
-int zend_import_function_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_class_entry *ce;
- zend_function *function;
-
- ce = EX_T(EX(opline)->op1.u.var).EA.class_entry;
-
- if (EX(opline)->op2.op_type != IS_UNUSED) {
- char *function_name_strval;
- int function_name_strlen;
-
- function_name_strval = EX(opline)->op2.u.constant.value.str.val;
- function_name_strlen = EX(opline)->op2.u.constant.value.str.len;
-
- if (zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen + 1, (void **) &function)==FAILURE) {
- zend_error(E_ERROR, "Import: function %s() not found", function_name_strval);
- }
- if (zend_hash_add(EG(function_table), function_name_strval, function_name_strlen + 1, function, sizeof(zend_function), NULL) == FAILURE) {
- zend_error(E_ERROR, "Import: function %s() already exists in current scope", function_name_strval);
- }
- function_add_ref(function);
- } else {
- zend_hash_merge_ex(EG(function_table), &ce->function_table, (copy_ctor_func_t) function_add_ref, sizeof(zend_function), (merge_checker_func_t)zend_import_check_function, NULL);
- }
- NEXT_OPCODE();
-}
-
-static int zend_import_check_class(HashTable *target_ht, zend_class_entry **ce, zend_hash_key *hash_key, void *param)
-{
- if(zend_hash_quick_exists(target_ht, hash_key->arKey, hash_key->nKeyLength, hash_key->h)) {
- zend_error(E_ERROR, "Import: class '%s' already exists in current scope", (*ce)->name);
- }
- return 1; /* OK */
-}
-
-int zend_import_class_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_class_entry *ce;
- zend_class_entry **import_ce;
-
- ce = EX_T(EX(opline)->op1.u.var).EA.class_entry;
-
- if (EX(opline)->op2.op_type != IS_UNUSED) {
- char *class_name_strval;
- int class_name_strlen;
-
- class_name_strval = EX(opline)->op2.u.constant.value.str.val;
- class_name_strlen = EX(opline)->op2.u.constant.value.str.len;
-
- if (zend_hash_find(&ce->class_table, class_name_strval, class_name_strlen + 1, (void **) &import_ce)==FAILURE) {
- zend_error(E_ERROR, "Import: class %s not found", class_name_strval);
- }
- if (zend_hash_add(EG(class_table), class_name_strval, class_name_strlen + 1, import_ce, sizeof(zend_class_entry *), NULL) == FAILURE) {
- zend_error(E_ERROR, "Import: class %s already exists in current scope", class_name_strval);
- }
- zend_class_add_ref(import_ce);
- } else {
- zend_hash_merge_ex(EG(class_table), &ce->class_table, (copy_ctor_func_t) zend_class_add_ref, sizeof(zend_class_entry *), (merge_checker_func_t)zend_import_check_class, NULL);
- }
-
- NEXT_OPCODE();
-}
-
-
-int zend_import_const_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_class_entry *ce;
- zval **import_constant;
- zend_constant c;
-
- ce = EX_T(EX(opline)->op1.u.var).EA.class_entry;
- if (EX(opline)->op2.op_type != IS_UNUSED) {
- char *const_name_strval;
- int const_name_strlen;
-
- const_name_strval = EX(opline)->op2.u.constant.value.str.val;
- const_name_strlen = EX(opline)->op2.u.constant.value.str.len;
-
- if (zend_hash_find(&ce->constants_table, const_name_strval, const_name_strlen + 1, (void **) &import_constant)==FAILURE) {
- zend_error(E_ERROR, "Import: constant %s not found", const_name_strval);
- }
- c.value = **import_constant;
- zval_copy_ctor(&c.value);
- c.flags = CONST_CS;
- c.name = zend_strndup(const_name_strval, const_name_strlen);
- c.name_len = const_name_strlen + 1;
-
- if (zend_register_constant(&c TSRMLS_CC) == FAILURE) {
- zend_error(E_ERROR, "Import: unable to register constant %s", const_name_strval);
- }
- } else {
- HashPosition pos;
- char *key;
- uint key_length;
- int key_type;
- ulong dummy;
-
- zend_hash_internal_pointer_reset_ex(&ce->constants_table, &pos);
- while (zend_hash_get_current_data_ex(&ce->constants_table, (void **)&import_constant, &pos) == SUCCESS) {
- key_type = zend_hash_get_current_key_ex(&ce->constants_table, &key, &key_length, &dummy, 0, &pos);
-
- c.value = **import_constant;
- zval_copy_ctor(&c.value);
- c.flags = CONST_CS;
- c.name = zend_strndup(key, key_length - 1);
- c.name_len = key_length;
-
- if (zend_register_constant(&c TSRMLS_CC) == FAILURE) {
- zend_error(E_ERROR, "Import: unable to register constant %s", key);
- }
- zend_hash_move_forward_ex(&ce->constants_table, &pos);
- }
- }
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_class_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_class_entry **pce;
- zend_class_entry *ce = NULL;
- zend_bool is_const;
- char *class_name_strval = NULL;
- zend_uint class_name_strlen = 0;
- zval *class_name;
- zval tmp;
-
- if (EX(opline)->op2.op_type == IS_UNUSED) {
- if (EX(opline)->extended_value == ZEND_FETCH_CLASS_SELF) {
- if (!EG(scope)) {
- zend_error(E_ERROR, "Cannot access self:: when no class scope is active");
- }
- EX_T(EX(opline)->result.u.var).EA.class_entry = EG(scope);
- NEXT_OPCODE();
- } else if (EX(opline)->extended_value == ZEND_FETCH_CLASS_MAIN) {
- EX_T(EX(opline)->result.u.var).EA.class_entry = EG(global_namespace_ptr);
- NEXT_OPCODE();
- } else if (EX(opline)->extended_value == ZEND_FETCH_CLASS_PARENT) {
- if (!EG(scope)) {
- zend_error(E_ERROR, "Cannot access parent:: when no class scope is active");
- }
- if (!EG(scope)->parent) {
- zend_error(E_ERROR, "Cannot access parent:: when current class scope has no parent");
- }
- EX_T(EX(opline)->result.u.var).EA.class_entry = EG(scope)->parent;
- NEXT_OPCODE();
- }
- }
-
- is_const = (EX(opline)->op2.op_type == IS_CONST);
-
- if (is_const) {
- class_name_strval = EX(opline)->op2.u.constant.value.str.val;
- class_name_strlen = EX(opline)->op2.u.constant.value.str.len;
- } else {
- class_name = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
-
- if (class_name->type == IS_OBJECT) {
- ce = Z_OBJCE_P(class_name);
- } else {
- tmp = *class_name;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- zend_str_tolower(tmp.value.str.val, tmp.value.str.len);
-
- class_name_strval = tmp.value.str.val;
- class_name_strlen = tmp.value.str.len;
- }
- }
-
- if (!ce) {
- int retval;
-
- if (EX(opline)->op1.op_type == IS_UNUSED && EX(opline)->extended_value != ZEND_FETCH_CLASS_GLOBAL) {
- retval = zend_lookup_class(class_name_strval, class_name_strlen, &pce TSRMLS_CC);
-
- if(retval == FAILURE) {
- /* try namespace */
- if(zend_hash_find(&EG(global_namespace_ptr)->class_table, class_name_strval, class_name_strlen+1, (void **)&pce) == SUCCESS && CLASS_IS_NAMESPACE((*pce))) {
- retval = SUCCESS;
- }
- }
- } else {
- zend_namespace *ns;
-
- /* Looking for namespace */
- if(EX(opline)->extended_value == ZEND_FETCH_CLASS_GLOBAL) {
- ns = EG(global_namespace_ptr);
- } else {
- if (zend_hash_find(&EG(global_namespace_ptr)->class_table, EX(opline)->op1.u.constant.value.str.val, EX(opline)->op1.u.constant.value.str.len+1, (void **)&pce) == FAILURE || !CLASS_IS_NAMESPACE((*pce))) {
- zend_error(E_ERROR, "Namespace '%s' not found", EX(opline)->op1.u.constant.value.str.val);
- }
- ns = *pce;
- }
- retval = zend_hash_find(&ns->class_table, class_name_strval, class_name_strlen+1, (void **)&pce);
- }
- if (retval==SUCCESS) {
- ce = *pce;
- }
- }
-
- if (!ce) {
- zend_error(E_ERROR, "Class '%s' not found", class_name_strval);
- } else {
- EX_T(EX(opline)->result.u.var).EA.class_entry = ce;
- }
- if (!is_const) {
- zval_dtor(&tmp);
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- }
- NEXT_OPCODE();
-}
-
-
-int zend_init_ctor_call_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_ptr_stack_n_push(&EG(arg_types_stack), 3, EX(fbc), EX(object), EX(calling_scope));
-
- if (EX(opline)->op1.op_type == IS_VAR) {
- SELECTIVE_PZVAL_LOCK(*EX_T(EX(opline)->op1.u.var).var.ptr_ptr, &EX(opline)->op1);
- }
-
- /* We are not handling overloaded classes right now */
- EX(object) = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- if (!PZVAL_IS_REF(EX(object))) {
- EX(object)->refcount++; /* For $this pointer */
- } else {
- zval *this_ptr;
-
- ALLOC_ZVAL(this_ptr);
- *this_ptr = *EX(object);
- INIT_PZVAL(this_ptr);
- zval_copy_ctor(this_ptr);
- EX(object) = this_ptr;
- }
-
- EX(fbc) = EX(fbc_constructor);
- if (EX(fbc)->type == ZEND_USER_FUNCTION) { /* HACK!! */
- EX(calling_scope) = EX(fbc)->common.scope;
- } else {
- EX(calling_scope) = NULL;
- }
-
- NEXT_OPCODE();
-}
-
-
-int zend_init_method_call_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
-
- zend_ptr_stack_n_push(&EG(arg_types_stack), 3, EX(fbc), EX(object), EX(calling_scope));
-
- function_name = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
- function_name_strval = function_name->value.str.val;
- function_name_strlen = function_name->value.str.len;
-
- EX(calling_scope) = EG(scope);
-
- EX(object) = get_obj_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R TSRMLS_CC);
-
- if (EX(object) && EX(object)->type == IS_OBJECT) {
- /* First, locate the function. */
- EX(fbc) = Z_OBJ_HT_P(EX(object))->get_method(EX(object), function_name_strval, function_name_strlen TSRMLS_CC);
- if (!EX(fbc)) {
- zend_error(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval);
- }
- } else {
- zend_error(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
- }
-
- if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
- EX(object) = NULL;
- } else {
- if (!PZVAL_IS_REF(EX(object))) {
- EX(object)->refcount++; /* For $this pointer */
- } else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- *this_ptr = *EX(object);
- INIT_PZVAL(this_ptr);
- zval_copy_ctor(this_ptr);
- EX(object) = this_ptr;
- }
- }
-
- if (EX(fbc)->type == ZEND_USER_FUNCTION) {
- EX(calling_scope) = EX(fbc)->common.scope;
- } else {
- EX(calling_scope) = NULL;
- }
-
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
-
- NEXT_OPCODE();
-}
-
-
-int zend_init_static_method_call_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *function_name;
- zval tmp;
- zend_class_entry *ce;
- zend_bool is_const;
- char *function_name_strval;
- int function_name_strlen;
-
- zend_ptr_stack_n_push(&EG(arg_types_stack), 3, EX(fbc), EX(object), EX(calling_scope));
-
- is_const = (EX(opline)->op2.op_type == IS_CONST);
-
- if (is_const) {
- function_name_strval = EX(opline)->op2.u.constant.value.str.val;
- function_name_strlen = EX(opline)->op2.u.constant.value.str.len;
- } else {
- function_name = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
-
- tmp = *function_name;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- zend_str_tolower(tmp.value.str.val, tmp.value.str.len);
-
- function_name_strval = tmp.value.str.val;
- function_name_strlen = tmp.value.str.len;
- }
-
- if (EX(opline)->op1.op_type == IS_UNUSED) {
- ce = EG(global_namespace_ptr);
- } else {
- ce = EX_T(EX(opline)->op1.u.var).EA.class_entry;
- }
-
- EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
- EX(calling_scope) = EX(fbc)->common.scope;
-
- if (!is_const) {
- zval_dtor(&tmp);
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- }
-
- if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
- EX(object) = NULL;
- } else {
- if ((EX(object) = EG(This))) {
- EX(object)->refcount++;
- }
- }
-
- NEXT_OPCODE();
-}
-
-
-int zend_init_fcall_by_name_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *function_name;
- zend_function *function;
- zval tmp;
- zend_bool is_const;
- char *function_name_strval;
- int function_name_strlen;
-
- zend_ptr_stack_n_push(&EG(arg_types_stack), 3, EX(fbc), EX(object), EX(calling_scope));
-
- is_const = (EX(opline)->op2.op_type == IS_CONST);
-
- if (is_const) {
- function_name_strval = EX(opline)->op2.u.constant.value.str.val;
- function_name_strlen = EX(opline)->op2.u.constant.value.str.len;
- } else {
- function_name = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
-
- tmp = *function_name;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- zend_str_tolower(tmp.value.str.val, tmp.value.str.len);
-
- function_name_strval = tmp.value.str.val;
- function_name_strlen = tmp.value.str.len;
- }
-
-
- do {
- /*
- if (EG(scope)) {
- if (zend_hash_find(&EG(scope)->function_table, function_name_strval, function_name_strlen+1, (void **) &function) == SUCCESS) {
- if ((EX(object) = EG(This))) {
- EX(object)->refcount++;
- }
- EX(calling_scope) = EG(scope);
- break;
- }
- }
- */
- if (zend_hash_find(EG(function_table), function_name_strval, function_name_strlen+1, (void **) &function)==FAILURE) {
- /* try global space also */
- if(zend_hash_find(&EG(global_namespace_ptr)->function_table, function_name_strval, function_name_strlen+1, (void **) &function)==FAILURE) {
- zend_error(E_ERROR, "Call to undefined function: %s()", function_name_strval);
- }
- }
- EX(calling_scope) = function->common.scope;
- EX(object) = NULL;
- } while (0);
-
- if (!is_const) {
- zval_dtor(&tmp);
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- }
- EX(fbc) = function;
-
- NEXT_OPCODE();
-}
-
-
-int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval **original_return_value;
- zend_class_entry *current_scope;
- zval *current_this;
- int return_value_used = RETURN_VALUE_USED(EX(opline));
- zend_namespace *active_namespace = EG(active_namespace);
-
- zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) EX(opline)->extended_value, NULL);
-
- EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr;
-
- current_this = EG(This);
- EG(This) = EX(object);
- current_scope = EG(scope);
- EG(scope) = EX(calling_scope);
-
- if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) {
- ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr);
- INIT_ZVAL(*(EX_T(EX(opline)->result.u.var).var.ptr));
-
- if (!zend_execute_internal) {
- /* saves one function call if zend_execute_internal is not used */
- ((zend_internal_function *) EX(function_state).function)->handler(EX(opline)->extended_value, EX_T(EX(opline)->result.u.var).var.ptr, EX(object), return_value_used TSRMLS_CC);
- } else {
- zend_execute_internal(execute_data, return_value_used TSRMLS_CC);
- }
-
- EG(current_execute_data) = execute_data;
- EX_T(EX(opline)->result.u.var).var.ptr->is_ref = 0;
- EX_T(EX(opline)->result.u.var).var.ptr->refcount = 1;
- if (!return_value_used) {
- zval_ptr_dtor(&EX_T(EX(opline)->result.u.var).var.ptr);
- }
- } else if (EX(function_state).function->type == ZEND_USER_FUNCTION) {
- HashTable *calling_symbol_table;
-
- EX_T(EX(opline)->result.u.var).var.ptr = NULL;
- if (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
- /*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/
- EX(function_state).function_symbol_table = *(EG(symtable_cache_ptr)--);
- } else {
- ALLOC_HASHTABLE(EX(function_state).function_symbol_table);
- zend_hash_init(EX(function_state).function_symbol_table, 0, NULL, ZVAL_PTR_DTOR, 0);
- /*printf("Cache miss! Initialized %x\n", function_state.function_symbol_table);*/
- }
- calling_symbol_table = EG(active_symbol_table);
- EG(active_symbol_table) = EX(function_state).function_symbol_table;
- original_return_value = EG(return_value_ptr_ptr);
- EG(return_value_ptr_ptr) = EX_T(EX(opline)->result.u.var).var.ptr_ptr;
- EG(active_op_array) = (zend_op_array *) EX(function_state).function;
-
- zend_execute(EG(active_op_array) TSRMLS_CC);
-
- if (return_value_used && !EX_T(EX(opline)->result.u.var).var.ptr) {
- if (!EG(exception)) {
- ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr);
- INIT_ZVAL(*EX_T(EX(opline)->result.u.var).var.ptr);
- }
- } else if (!return_value_used && EX_T(EX(opline)->result.u.var).var.ptr) {
- zval_ptr_dtor(&EX_T(EX(opline)->result.u.var).var.ptr);
- }
-
- EG(opline_ptr) = &EX(opline);
- EG(active_op_array) = op_array;
- EG(return_value_ptr_ptr)=original_return_value;
- if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) {
- zend_hash_destroy(EX(function_state).function_symbol_table);
- FREE_HASHTABLE(EX(function_state).function_symbol_table);
- } else {
- *(++EG(symtable_cache_ptr)) = EX(function_state).function_symbol_table;
- zend_hash_clean(*EG(symtable_cache_ptr));
- }
- EG(active_symbol_table) = calling_symbol_table;
- } else { /* ZEND_OVERLOADED_FUNCTION */
- ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr);
- INIT_ZVAL(*(EX_T(EX(opline)->result.u.var).var.ptr));
-
- /* Not sure what should be done here if it's a static method */
- if (EX(object)) {
- Z_OBJ_HT_P(EX(object))->call_method(EX(fbc)->common.function_name, EX(opline)->extended_value, EX_T(EX(opline)->result.u.var).var.ptr, EX(object), return_value_used TSRMLS_CC);
- } else {
- zend_error(E_ERROR, "Cannot call overloaded function for non-object");
- }
-
- efree(EX(fbc));
- if (!return_value_used) {
- zval_ptr_dtor(&EX_T(EX(opline)->result.u.var).var.ptr);
- }
- }
- if (EG(This)) {
- zval_ptr_dtor(&EG(This));
- }
- EG(This) = current_this;
- EG(scope) = current_scope;
- zend_ptr_stack_n_pop(&EG(arg_types_stack), 3, &EX(calling_scope), &EX(object), &EX(fbc));
-
- if(EG(active_namespace) != active_namespace) {
- zend_switch_namespace(active_namespace TSRMLS_CC);
- }
- EX(function_state).function = (zend_function *) op_array;
- EG(function_state_ptr) = &EX(function_state);
- zend_ptr_stack_clear_multiple(TSRMLS_C);
-
- if (EG(exception)) {
- if (EX(opline)->op2.u.opline_num == -1) {
- RETURN_FROM_EXECUTE_LOOP(execute_data);
- } else {
- EX(opline) = &op_array->opcodes[EX(opline)->op2.u.opline_num];
- return 0; /* CHECK_ME */
- }
- }
-
- NEXT_OPCODE();
-}
-
-
-int zend_do_fcall_by_name_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- EX(function_state).function = EX(fbc);
- return zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_do_fcall_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *fname = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- zend_ptr_stack_n_push(&EG(arg_types_stack), 3, EX(fbc), EX(object), EX(calling_scope));
-
- do {
- /*
- if (EG(scope)) {
- if (zend_hash_find(&EG(scope)->function_table, fname->value.str.val, fname->value.str.len+1, (void **) &EX(function_state).function) == SUCCESS) {
- if ((EX(object) = EG(This))) {
- EX(object)->refcount++;
- }
- EX(calling_scope) = EG(scope);
- break;
- }
- }
- */
- if (zend_hash_find(EG(function_table), fname->value.str.val, fname->value.str.len+1, (void **) &EX(function_state).function)==FAILURE) {
- zend_error(E_ERROR, "Unknown function: %s()\n", fname->value.str.val);
- }
- EX(object) = NULL;
- EX(calling_scope) = EX(function_state).function->common.scope;
- } while (0);
-
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
-
- return zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_return_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *retval_ptr;
- zval **retval_ptr_ptr;
-
- if ((EG(active_op_array)->return_reference == ZEND_RETURN_REF) &&
- (EX(opline)->op1.op_type != IS_CONST) &&
- (EX(opline)->op1.op_type != IS_TMP_VAR)) {
-
- retval_ptr_ptr = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_W);
-
- if (!retval_ptr_ptr) {
- zend_error(E_ERROR, "Cannot return overloaded elements or string offsets by reference");
- }
-
- SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr);
- (*retval_ptr_ptr)->refcount++;
-
- (*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr);
- } else {
- retval_ptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- if (!EG(free_op1)) { /* Not a temp var */
- if (PZVAL_IS_REF(retval_ptr) && retval_ptr->refcount > 0) {
- ALLOC_ZVAL(*(EG(return_value_ptr_ptr)));
- **EG(return_value_ptr_ptr) = *retval_ptr;
- (*EG(return_value_ptr_ptr))->is_ref = 0;
- (*EG(return_value_ptr_ptr))->refcount = 1;
- zval_copy_ctor(*EG(return_value_ptr_ptr));
- } else {
- *EG(return_value_ptr_ptr) = retval_ptr;
- retval_ptr->refcount++;
- }
- } else {
- ALLOC_ZVAL(*(EG(return_value_ptr_ptr)));
- **EG(return_value_ptr_ptr) = *retval_ptr;
- (*EG(return_value_ptr_ptr))->refcount = 1;
- (*EG(return_value_ptr_ptr))->is_ref = 0;
- }
- }
- RETURN_FROM_EXECUTE_LOOP(execute_data);
-}
-
-
-int zend_throw_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *value;
- zval *exception;
-
- value = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- if (value->type != IS_OBJECT) {
- zend_error(E_ERROR, "Can only throw objects");
- }
- /* Not sure if a complete copy is what we want here */
- MAKE_STD_ZVAL(exception);
- *exception = *value;
- if (!EG(free_op1)) {
- zval_copy_ctor(exception);
- }
- INIT_PZVAL(exception);
- EG(exception) = exception;
-
- if (EX(opline)->op2.u.opline_num == -1) {
- RETURN_FROM_EXECUTE_LOOP(execute_data);
- } else {
- EX(opline) = &op_array->opcodes[EX(opline)->op2.u.opline_num];
- return 0; /* CHECK_ME */
- }
- NEXT_OPCODE();
-}
-
-
-int zend_catch_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_class_entry *ce;
-
- /* Check if this is really an exception, if not, jump over code */
- if (EG(exception) == NULL) {
- EX(opline) = &op_array->opcodes[EX(opline)->extended_value];
- return 0; /* CHECK_ME */
- }
- ce = Z_OBJCE_P(EG(exception));
- if (ce != EX_T(EX(opline)->op1.u.var).EA.class_entry) {
- while (ce->parent) {
- if (ce->parent == EX_T(EX(opline)->op1.u.var).EA.class_entry) {
- goto exception_should_be_taken;
- }
- ce = ce->parent;
- }
- EX(opline) = &op_array->opcodes[EX(opline)->extended_value];
- return 0; /* CHECK_ME */
- }
-
-exception_should_be_taken:
- zend_hash_update(EG(active_symbol_table), EX(opline)->op2.u.constant.value.str.val,
- EX(opline)->op2.u.constant.value.str.len+1, &EG(exception), sizeof(zval *), (void **) NULL);
- EG(exception) = NULL;
- NEXT_OPCODE();
-}
-
-
-int zend_send_val_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- if (EX(opline)->extended_value==ZEND_DO_FCALL_BY_NAME
- && ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->op2.u.opline_num, EX(fbc), EX(fbc)->common.arg_types)) {
- zend_error(E_ERROR, "Cannot pass parameter %d by reference", EX(opline)->op2.u.opline_num);
- }
- {
- zval *valptr;
- zval *value;
-
- value = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- ALLOC_ZVAL(valptr);
- *valptr = *value;
- if (!EG(free_op1)) {
- zval_copy_ctor(valptr);
- }
- INIT_PZVAL(valptr);
- zend_ptr_stack_push(&EG(argument_stack), valptr);
- }
- NEXT_OPCODE();
-}
-
-
-inline int zend_send_by_var_helper(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *varptr;
- varptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- if (varptr == &EG(uninitialized_zval)) {
- ALLOC_ZVAL(varptr);
- INIT_ZVAL(*varptr);
- varptr->refcount = 0;
- } else if (PZVAL_IS_REF(varptr)) {
- zval *original_var = varptr;
-
- ALLOC_ZVAL(varptr);
- *varptr = *original_var;
- varptr->is_ref = 0;
- varptr->refcount = 0;
- zval_copy_ctor(varptr);
- }
- varptr->refcount++;
- zend_ptr_stack_push(&EG(argument_stack), varptr);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); /* for string offsets */
-
- NEXT_OPCODE();
-}
-
-
-int zend_send_var_no_ref_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- if (EX(opline)->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */
- if (!(EX(opline)->extended_value & ZEND_ARG_SEND_BY_REF)) {
- return zend_send_by_var_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- }
- } else if (!ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->op2.u.opline_num, EX(fbc), EX(fbc)->common.arg_types)) {
- return zend_send_by_var_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- }
- {
- zval *varptr;
- varptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- if (varptr != &EG(uninitialized_zval) && (PZVAL_IS_REF(varptr) || varptr->refcount == 1)) {
- varptr->is_ref = 1;
- varptr->refcount++;
- zend_ptr_stack_push(&EG(argument_stack), varptr);
- NEXT_OPCODE();
- }
- zend_error(E_ERROR, "Only variables can be passed by reference");
- }
- NEXT_OPCODE();
-}
-
-
-int zend_send_ref_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval **varptr_ptr;
- zval *varptr;
- varptr_ptr = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_W);
-
- if (!varptr_ptr) {
- zend_error(E_ERROR, "Only variables can be passed by reference");
- }
-
- SEPARATE_ZVAL_TO_MAKE_IS_REF(varptr_ptr);
- varptr = *varptr_ptr;
- varptr->refcount++;
- zend_ptr_stack_push(&EG(argument_stack), varptr);
-
- NEXT_OPCODE();
-}
-
-
-int zend_send_var_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- if ((EX(opline)->extended_value == ZEND_DO_FCALL_BY_NAME)
- && ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->op2.u.opline_num, EX(fbc), EX(fbc)->common.arg_types)) {
- return zend_send_ref_handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- }
- return zend_send_by_var_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_recv_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval **param;
-
- if (zend_ptr_stack_get_arg(EX(opline)->op1.u.constant.value.lval, (void **) &param TSRMLS_CC)==FAILURE) {
- zend_error(E_WARNING, "Missing argument %d for %s()\n", EX(opline)->op1.u.constant.value.lval, get_active_function_name(TSRMLS_C));
- if (EX(opline)->result.op_type == IS_VAR) {
- PZVAL_UNLOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr);
- }
- } else if (PZVAL_IS_REF(*param)) {
- zend_assign_to_variable_reference(&EX(opline)->result, get_zval_ptr_ptr(&EX(opline)->result, EX(Ts), BP_VAR_W), param, NULL TSRMLS_CC);
- } else {
- zend_assign_to_variable(&EX(opline)->result, &EX(opline)->result, NULL, *param, IS_VAR, EX(Ts) TSRMLS_CC);
- }
-
- NEXT_OPCODE();
-}
-
-
-int zend_recv_init_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval **param, *assignment_value;
-
- if (zend_ptr_stack_get_arg(EX(opline)->op1.u.constant.value.lval, (void **) &param TSRMLS_CC)==FAILURE) {
- if (EX(opline)->op2.u.constant.type == IS_CONSTANT || EX(opline)->op2.u.constant.type==IS_CONSTANT_ARRAY) {
- zval *default_value;
-
- ALLOC_ZVAL(default_value);
- *default_value = EX(opline)->op2.u.constant;
- if (EX(opline)->op2.u.constant.type==IS_CONSTANT_ARRAY) {
- zval_copy_ctor(default_value);
- }
- default_value->refcount=1;
- zval_update_constant(&default_value, 0 TSRMLS_CC);
- default_value->refcount=0;
- default_value->is_ref=0;
- param = &default_value;
- assignment_value = default_value;
- } else {
- param = NULL;
- assignment_value = &EX(opline)->op2.u.constant;
- }
- zend_assign_to_variable(&EX(opline)->result, &EX(opline)->result, NULL, assignment_value, IS_VAR, EX(Ts) TSRMLS_CC);
- } else {
- assignment_value = *param;
- if (PZVAL_IS_REF(assignment_value)) {
- zend_assign_to_variable_reference(&EX(opline)->result, get_zval_ptr_ptr(&EX(opline)->result, EX(Ts), BP_VAR_W), param, NULL TSRMLS_CC);
- } else {
- zend_assign_to_variable(&EX(opline)->result, &EX(opline)->result, NULL, assignment_value, IS_VAR, EX(Ts) TSRMLS_CC);
- }
- }
-
- NEXT_OPCODE();
-}
-
-
-int zend_bool_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */
- EX_T(EX(opline)->result.u.var).tmp_var.value.lval = zend_is_true(get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R));
- EX_T(EX(opline)->result.u.var).tmp_var.type = IS_BOOL;
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
-
- NEXT_OPCODE();
-}
-
-
-inline int zend_brk_cont_helper(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *nest_levels_zval = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
- zval tmp;
- int array_offset, nest_levels, original_nest_levels;
- zend_brk_cont_element *jmp_to;
-
- if (nest_levels_zval->type != IS_LONG) {
- tmp = *nest_levels_zval;
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- nest_levels = tmp.value.lval;
- } else {
- nest_levels = nest_levels_zval->value.lval;
- }
- original_nest_levels = nest_levels;
- array_offset = EX(opline)->op1.u.opline_num;
- do {
- if (array_offset==-1) {
- zend_error(E_ERROR, "Cannot break/continue %d level%s", original_nest_levels, (original_nest_levels == 1) ? "" : "s");
- }
- jmp_to = &op_array->brk_cont_array[array_offset];
- if (nest_levels>1) {
- zend_op *brk_opline = &op_array->opcodes[jmp_to->brk];
-
- switch (brk_opline->opcode) {
- case ZEND_SWITCH_FREE:
- zend_switch_free(brk_opline, EX(Ts) TSRMLS_CC);
- break;
- case ZEND_FREE:
- zendi_zval_dtor(EX_T(brk_opline->op1.u.var).tmp_var);
- break;
- }
- }
- array_offset = jmp_to->parent;
- } while (--nest_levels > 0);
-
- if (EX(opline)->opcode == ZEND_BRK) {
- EX(opline) = op_array->opcodes+jmp_to->brk;
- } else {
- EX(opline) = op_array->opcodes+jmp_to->cont;
- }
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- return 0; /* CHECK_ME */
-}
-
-
-int zend_brk_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_brk_cont_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_cont_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_brk_cont_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_case_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- int switch_expr_is_overloaded=0;
-
- if (EX(opline)->op1.op_type==IS_VAR) {
- if (EX_T(EX(opline)->op1.u.var).var.ptr_ptr) {
- PZVAL_LOCK(*EX_T(EX(opline)->op1.u.var).var.ptr_ptr);
- } else {
- switch_expr_is_overloaded = 1;
- if (EX_T(EX(opline)->op1.u.var).EA.type==IS_STRING_OFFSET) {
- EX_T(EX(opline)->op1.u.var).EA.data.str_offset.str->refcount++;
- }
- }
- }
- is_equal_function(&EX_T(EX(opline)->result.u.var).tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
-
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- EX_T(EX(opline)->op1.u.var).var.ptr_ptr = NULL;
- AI_USE_PTR(EX_T(EX(opline)->op1.u.var).var);
- }
- NEXT_OPCODE();
-}
-
-
-int zend_switch_free_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_switch_free(EX(opline), EX(Ts) TSRMLS_CC);
- NEXT_OPCODE();
-}
-
-
-int zend_new_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- if (EX_T(EX(opline)->op1.u.var).EA.class_entry->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_ABSTRACT_CLASS)) {
- char *class_type;
-
- if (EX_T(EX(opline)->op1.u.var).EA.class_entry->ce_flags & ZEND_ACC_INTERFACE) {
- class_type = "interface";
- } else {
- class_type = "abstract class";
- }
- zend_error(E_ERROR, "Cannot instantiate %s %s", class_type, EX_T(EX(opline)->op1.u.var).EA.class_entry->name);
- }
- EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr;
- ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr);
- object_init_ex(EX_T(EX(opline)->result.u.var).var.ptr, EX_T(EX(opline)->op1.u.var).EA.class_entry);
- EX_T(EX(opline)->result.u.var).var.ptr->refcount=1;
- EX_T(EX(opline)->result.u.var).var.ptr->is_ref=1;
-
- NEXT_OPCODE();
-}
-
-
-int zend_clone_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *obj = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr;
- ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr);
- EX_T(EX(opline)->result.u.var).var.ptr->value.obj = Z_OBJ_HT_P(obj)->clone_obj(obj TSRMLS_CC);
- EX_T(EX(opline)->result.u.var).var.ptr->type = IS_OBJECT;
- EX_T(EX(opline)->result.u.var).var.ptr->refcount=1;
- EX_T(EX(opline)->result.u.var).var.ptr->is_ref=1;
- NEXT_OPCODE();
-}
-
-
-int zend_fetch_constant_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_class_entry *ce = NULL;
- zval **value;
-
- if (EX(opline)->op1.op_type == IS_UNUSED) {
- if (EG(scope)) {
- ce = EG(scope);
- if (zend_hash_find(&ce->constants_table, EX(opline)->op2.u.constant.value.str.val, EX(opline)->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) {
- zval_update_constant(value, (void *) 1 TSRMLS_CC);
- EX_T(EX(opline)->result.u.var).tmp_var = **value;
- zval_copy_ctor(&EX_T(EX(opline)->result.u.var).tmp_var);
- NEXT_OPCODE();
- }
- }
- if(EG(active_namespace) != EG(global_namespace_ptr)) {
- /* if we are not global, go find in local constant table */
- if (zend_hash_find(&EG(active_namespace)->constants_table, EX(opline)->op2.u.constant.value.str.val, EX(opline)->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) {
- zval_update_constant(value, (void *) 1 TSRMLS_CC);
- EX_T(EX(opline)->result.u.var).tmp_var = **value;
- zval_copy_ctor(&EX_T(EX(opline)->result.u.var).tmp_var);
- NEXT_OPCODE();
- }
- }
-
- if (!zend_get_constant(EX(opline)->op2.u.constant.value.str.val, EX(opline)->op2.u.constant.value.str.len, &EX_T(EX(opline)->result.u.var).tmp_var TSRMLS_CC)) {
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
- EX(opline)->op2.u.constant.value.str.val,
- EX(opline)->op2.u.constant.value.str.val);
- EX_T(EX(opline)->result.u.var).tmp_var = EX(opline)->op2.u.constant;
- zval_copy_ctor(&EX_T(EX(opline)->result.u.var).tmp_var);
- }
- NEXT_OPCODE();
- }
-
- ce = EX_T(EX(opline)->op1.u.var).EA.class_entry;
-
- if (&ce->constants_table == &EG(global_namespace_ptr)->constants_table) {
- if (!zend_get_constant(EX(opline)->op2.u.constant.value.str.val, EX(opline)->op2.u.constant.value.str.len, &EX_T(EX(opline)->result.u.var).tmp_var TSRMLS_CC)) {
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
- EX(opline)->op2.u.constant.value.str.val,
- EX(opline)->op2.u.constant.value.str.val);
- EX_T(EX(opline)->result.u.var).tmp_var = EX(opline)->op2.u.constant;
- zval_copy_ctor(&EX_T(EX(opline)->result.u.var).tmp_var);
- }
- NEXT_OPCODE();
- }
- if (zend_hash_find(&ce->constants_table, EX(opline)->op2.u.constant.value.str.val, EX(opline)->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) {
- zval_update_constant(value, (void *) 1 TSRMLS_CC);
- EX_T(EX(opline)->result.u.var).tmp_var = **value;
- zval_copy_ctor(&EX_T(EX(opline)->result.u.var).tmp_var);
- } else {
- zend_error(E_ERROR, "Undefined class constant '%s'", EX(opline)->op2.u.constant.value.str.val);
- }
-
- NEXT_OPCODE();
-}
-
-
-inline int zend_init_add_array_helper(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *array_ptr = &EX_T(EX(opline)->result.u.var).tmp_var;
- zval *expr_ptr, **expr_ptr_ptr = NULL;
- zval *offset=get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
-
- if (EX(opline)->extended_value) {
- expr_ptr_ptr=get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_R);
- expr_ptr = *expr_ptr_ptr;
- } else {
- expr_ptr=get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- }
-
- if (EX(opline)->opcode == ZEND_INIT_ARRAY) {
- array_init(array_ptr);
- if (!expr_ptr) {
- NEXT_OPCODE();
- }
- }
- if (!EX(opline)->extended_value && EG(free_op1)) { /* temporary variable */
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- *new_expr = *expr_ptr;
- expr_ptr = new_expr;
- INIT_PZVAL(expr_ptr);
- } else {
- if (EX(opline)->extended_value) {
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
- expr_ptr->refcount++;
- } else if (PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- *new_expr = *expr_ptr;
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
- INIT_PZVAL(expr_ptr);
- } else {
- expr_ptr->refcount++;
- }
- }
- if (offset) {
- switch (offset->type) {
- case IS_DOUBLE:
- zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL);
- break;
- case IS_LONG:
- case IS_BOOL:
- zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL);
- break;
- case IS_STRING:
- zend_hash_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL);
- break;
- case IS_NULL:
- zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
- break;
- default:
- zval_ptr_dtor(&expr_ptr);
- /* do nothing */
- break;
- }
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- } else {
- zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL);
- }
- NEXT_OPCODE();
-}
-
-
-int zend_init_array_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_init_add_array_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_add_array_element_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_init_add_array_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
-
-int zend_cast_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *expr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- zval *result = &EX_T(EX(opline)->result.u.var).tmp_var;
-
- *result = *expr;
- if (!EG(free_op1)) {
- zendi_zval_copy_ctor(*result);
- }
- switch (EX(opline)->extended_value) {
- case IS_NULL:
- convert_to_null(result);
- break;
- case IS_BOOL:
- convert_to_boolean(result);
- break;
- case IS_LONG:
- convert_to_long(result);
- break;
- case IS_DOUBLE:
- convert_to_double(result);
- break;
- case IS_STRING:
- convert_to_string(result);
- break;
- case IS_ARRAY:
- convert_to_array(result);
- break;
- case IS_OBJECT:
- convert_to_object(result);
- break;
- }
- NEXT_OPCODE();
-}
-
-
-int zend_include_or_eval_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_op_array *new_op_array=NULL;
- zval **original_return_value = EG(return_value_ptr_ptr);
- int return_value_used;
- zval *inc_filename = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- zval tmp_inc_filename;
- zend_bool failure_retval=0;
-
- if (inc_filename->type!=IS_STRING) {
- tmp_inc_filename = *inc_filename;
- zval_copy_ctor(&tmp_inc_filename);
- convert_to_string(&tmp_inc_filename);
- inc_filename = &tmp_inc_filename;
- }
-
- return_value_used = RETURN_VALUE_USED(EX(opline));
-
- switch (EX(opline)->op2.u.constant.value.lval) {
- case ZEND_INCLUDE_ONCE:
- case ZEND_REQUIRE_ONCE: {
- int dummy = 1;
- zend_file_handle file_handle;
-
- if (SUCCESS == zend_stream_open(inc_filename->value.str.val, &file_handle TSRMLS_CC)) {
-
- if (!file_handle.opened_path) {
- file_handle.opened_path = estrndup(inc_filename->value.str.val, inc_filename->value.str.len);
- }
-
- if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) {
- CG(active_namespace) = EG(global_namespace_ptr);
- new_op_array = zend_compile_file(&file_handle, (EX(opline)->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
- zend_destroy_file_handle(&file_handle TSRMLS_CC);
- } else {
- zend_file_handle_dtor(&file_handle);
- failure_retval=1;
- }
- } else {
- if (EX(opline)->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE) {
- zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, inc_filename->value.str.val);
- } else {
- zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, inc_filename->value.str.val);
- }
- }
- break;
- }
- break;
- case ZEND_INCLUDE:
- case ZEND_REQUIRE:
- CG(active_namespace) = EG(global_namespace_ptr);
- new_op_array = compile_filename(EX(opline)->op2.u.constant.value.lval, inc_filename TSRMLS_CC);
- break;
- case ZEND_EVAL: {
- char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC);
-
- CG(active_namespace) = EG(global_namespace_ptr);
- new_op_array = compile_string(inc_filename, eval_desc TSRMLS_CC);
- efree(eval_desc);
- }
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- if (inc_filename==&tmp_inc_filename) {
- zval_dtor(&tmp_inc_filename);
- }
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr;
- if (new_op_array) {
- zval *saved_object;
- zend_function *saved_function;
- zend_namespace *active_namespace = EG(active_namespace);
-
- EG(return_value_ptr_ptr) = EX_T(EX(opline)->result.u.var).var.ptr_ptr;
- EG(active_op_array) = new_op_array;
- EX_T(EX(opline)->result.u.var).var.ptr = NULL;
-
- saved_object = EX(object);
- saved_function = EX(function_state).function;
-
- EX(function_state).function = (zend_function *) new_op_array;
- EX(object) = NULL;
- zend_switch_namespace(EG(global_namespace_ptr) TSRMLS_CC);
-
- zend_execute(new_op_array TSRMLS_CC);
-
- zend_switch_namespace(active_namespace TSRMLS_CC);
-
- EX(function_state).function = saved_function;
- EX(object) = saved_object;
-
- if (!return_value_used) {
- if (EX_T(EX(opline)->result.u.var).var.ptr) {
- zval_ptr_dtor(&EX_T(EX(opline)->result.u.var).var.ptr);
- }
- } else { /* return value is used */
- if (!EX_T(EX(opline)->result.u.var).var.ptr) { /* there was no return statement */
- ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr);
- INIT_PZVAL(EX_T(EX(opline)->result.u.var).var.ptr);
- EX_T(EX(opline)->result.u.var).var.ptr->value.lval = 1;
- EX_T(EX(opline)->result.u.var).var.ptr->type = IS_BOOL;
- }
- }
-
- EG(opline_ptr) = &EX(opline);
- EG(active_op_array) = op_array;
- EG(function_state_ptr) = &EX(function_state);
- destroy_op_array(new_op_array TSRMLS_CC);
- efree(new_op_array);
- } else {
- if (return_value_used) {
- ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr);
- INIT_ZVAL(*EX_T(EX(opline)->result.u.var).var.ptr);
- EX_T(EX(opline)->result.u.var).var.ptr->value.lval = failure_retval;
- EX_T(EX(opline)->result.u.var).var.ptr->type = IS_BOOL;
- }
- }
- EG(return_value_ptr_ptr) = original_return_value;
- NEXT_OPCODE();
-}
-
-
-int zend_unset_var_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval tmp, *varname;
- HashTable *target_symbol_table;
-
- varname = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- if (varname->type != IS_STRING) {
- tmp = *varname;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- varname = &tmp;
- }
-
- if (EX(opline)->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
- zend_std_unset_static_property(EX_T(EX(opline)->op2.u.var).EA.class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname) TSRMLS_CC);
- } else {
- target_symbol_table = zend_get_target_symbol_table(EX(opline), EX(Ts), BP_VAR_IS, varname TSRMLS_CC);
- zend_hash_del(target_symbol_table, varname->value.str.val, varname->value.str.len+1);
- }
-
- if (varname == &tmp) {
- zval_dtor(&tmp);
- }
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- NEXT_OPCODE();
-}
-
-
-int zend_unset_dim_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval **container = get_obj_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_R TSRMLS_CC);
- zval *offset = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
-
- if (container) {
- HashTable *ht;
-
- if ((*container)->type == IS_ARRAY) {
- ht = (*container)->value.ht;
- } else {
- ht = NULL;
- if ((*container)->type == IS_OBJECT) {
- Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC);
- }
- }
- if (ht) {
- switch (offset->type) {
- case IS_DOUBLE:
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- {
- long index;
-
- if (offset->type == IS_DOUBLE) {
- index = (long) offset->value.lval;
- } else {
- index = offset->value.lval;
- }
-
- zend_hash_index_del(ht, index);
- break;
- }
- case IS_STRING:
- zend_hash_del(ht, offset->value.str.val, offset->value.str.len+1);
- break;
- case IS_NULL:
- zend_hash_del(ht, "", sizeof(""));
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
- break;
- }
- }
- } else {
- /* overloaded element */
- }
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
-
- NEXT_OPCODE();
-}
-
-
-int zend_fe_reset_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *array_ptr, **array_ptr_ptr;
- HashTable *fe_ht;
-
- if (EX(opline)->extended_value) {
- array_ptr_ptr = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_R);
- if (array_ptr_ptr == NULL) {
- MAKE_STD_ZVAL(array_ptr);
- } else {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
- array_ptr = *array_ptr_ptr;
- array_ptr->refcount++;
- }
- } else {
- array_ptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- if (EG(free_op1)) { /* IS_TMP_VAR */
- zval *tmp;
-
- ALLOC_ZVAL(tmp);
- *tmp = *array_ptr;
- INIT_PZVAL(tmp);
- array_ptr = tmp;
- } else {
- array_ptr->refcount++;
- }
- }
- PZVAL_LOCK(array_ptr);
- EX_T(EX(opline)->result.u.var).var.ptr = array_ptr;
- EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr;
-
- if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
- /* probably redundant */
- zend_hash_internal_pointer_reset(fe_ht);
- } else {
- /* JMP to the end of foreach - TBD */
- }
- NEXT_OPCODE();
-}
-
-
-int zend_fe_fetch_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *array = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- zval *result = &EX_T(EX(opline)->result.u.var).tmp_var;
- zval **value, *key;
- char *str_key;
- ulong int_key;
- HashTable *fe_ht;
-
- PZVAL_LOCK(array);
-
- fe_ht = HASH_OF(array);
- if (!fe_ht) {
- zend_error(E_WARNING, "Invalid argument supplied for foreach()");
- EX(opline) = op_array->opcodes+EX(opline)->op2.u.opline_num;
- return 0; /* CHECK_ME */
- } else if (zend_hash_get_current_data(fe_ht, (void **) &value)==FAILURE) {
- EX(opline) = op_array->opcodes+EX(opline)->op2.u.opline_num;
- return 0; /* CHECK_ME */
- }
- array_init(result);
-
-
- (*value)->refcount++;
- zend_hash_index_update(result->value.ht, 0, value, sizeof(zval *), NULL);
-
- ALLOC_ZVAL(key);
- INIT_PZVAL(key);
- switch (zend_hash_get_current_key(fe_ht, &str_key, &int_key, 1)) {
- case HASH_KEY_IS_STRING:
- key->value.str.val = str_key;
- key->value.str.len = strlen(str_key);
- key->type = IS_STRING;
- break;
- case HASH_KEY_IS_LONG:
- key->value.lval = int_key;
- key->type = IS_LONG;
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- zend_hash_index_update(result->value.ht, 1, &key, sizeof(zval *), NULL);
- zend_hash_move_forward(fe_ht);
-
- NEXT_OPCODE();
-}
-
-
-int zend_jmp_no_ctor_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *object_zval;
- zend_function *constructor;
-
- if (EX(opline)->op1.op_type == IS_VAR) {
- PZVAL_LOCK(*EX_T(EX(opline)->op1.u.var).var.ptr_ptr);
- }
-
- object_zval = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- constructor = Z_OBJ_HT_P(object_zval)->get_constructor(object_zval TSRMLS_CC);
-
- EX(fbc_constructor) = NULL;
- if (constructor == NULL) {
- EX(opline) = op_array->opcodes + EX(opline)->op2.u.opline_num;
- return 0; /* CHECK_ME */
- } else {
- EX(fbc_constructor) = constructor;
- }
-
- NEXT_OPCODE();
-}
-
-
-int zend_isset_isempty_var_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval tmp, *varname = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- zval **value;
- zend_bool isset = 1;
- HashTable *target_symbol_table;
-
- if (varname->type != IS_STRING) {
- tmp = *varname;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- varname = &tmp;
- }
-
- if (EX(opline)->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
- value = zend_std_get_static_property(EX_T(EX(opline)->op2.u.var).EA.class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC);
- if (!value) {
- isset = 0;
- }
- } else {
- target_symbol_table = zend_get_target_symbol_table(EX(opline), EX(Ts), BP_VAR_IS, varname TSRMLS_CC);
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) {
- isset = 0;
- }
- }
-
- EX_T(EX(opline)->result.u.var).tmp_var.type = IS_BOOL;
-
- switch (EX(opline)->extended_value) {
- case ZEND_ISSET:
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- EX_T(EX(opline)->result.u.var).tmp_var.value.lval = 0;
- } else {
- EX_T(EX(opline)->result.u.var).tmp_var.value.lval = isset;
- }
- break;
- case ZEND_ISEMPTY:
- if (!isset || !zend_is_true(*value)) {
- EX_T(EX(opline)->result.u.var).tmp_var.value.lval = 1;
- } else {
- EX_T(EX(opline)->result.u.var).tmp_var.value.lval = 0;
- }
- break;
- }
-
- if (varname == &tmp) {
- zval_dtor(&tmp);
- }
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
-
- NEXT_OPCODE();
-}
-
-
-int zend_isset_isempty_dim_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval **container = get_obj_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_R TSRMLS_CC);
- zval *offset = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
- zval **value = NULL;
- int result = 0;
-
- if (container) {
- if ((*container)->type == IS_ARRAY) {
- HashTable *ht;
- int isset = 0;
-
- ht = (*container)->value.ht;
-
- switch (offset->type) {
- case IS_DOUBLE:
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- {
- long index;
-
- if (offset->type == IS_DOUBLE) {
- index = (long) offset->value.lval;
- } else {
- index = offset->value.lval;
- }
- if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- }
- case IS_STRING:
- if (zend_hash_find(ht, offset->value.str.val, offset->value.str.len+1, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
-
- break;
- }
-
- switch (EX(opline)->extended_value) {
- case ZEND_ISSET:
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- result = 0;
- } else {
- result = isset;
- }
- break;
- case ZEND_ISEMPTY:
- if (!isset || !zend_is_true(*value)) {
- result = 0;
- } else {
- result = 1;
- }
- break;
- }
- } else if ((*container)->type == IS_OBJECT) {
- result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (EX(opline)->extended_value == ZEND_ISEMPTY) TSRMLS_CC);
- } else if ((*container)->type == IS_STRING) { /* string offsets */
- switch (EX(opline)->extended_value) {
- case ZEND_ISSET:
- if (offset->value.lval <= Z_STRLEN_PP(container)) {
- result = 1;
- }
- break;
- case ZEND_ISEMPTY:
- if (offset->value.lval <= Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
- result = 1;
- }
- break;
- }
- }
- }
-
- EX_T(EX(opline)->result.u.var).tmp_var.type = IS_BOOL;
-
- switch (EX(opline)->extended_value) {
- case ZEND_ISSET:
- EX_T(EX(opline)->result.u.var).tmp_var.value.lval = result;
- break;
- case ZEND_ISEMPTY:
- EX_T(EX(opline)->result.u.var).tmp_var.value.lval = !result;
- break;
- }
-
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
-
- NEXT_OPCODE();
-}
-
-
-int zend_exit_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- if (EX(opline)->op1.op_type != IS_UNUSED) {
- zval *ptr;
-
- ptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- if (Z_TYPE_P(ptr) == IS_LONG) {
- EG(exit_status) = Z_LVAL_P(ptr);
- } else {
- zend_print_variable(ptr);
- }
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- }
- zend_bailout();
- NEXT_OPCODE();
-}
-
-
-int zend_begin_silence_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- EX_T(EX(opline)->result.u.var).tmp_var.value.lval = EG(error_reporting);
- EX_T(EX(opline)->result.u.var).tmp_var.type = IS_LONG; /* shouldn't be necessary */
- zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
- NEXT_OPCODE();
-}
-
-
-int zend_raise_abstract_error_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_error(E_ERROR, "Cannot call abstract method %s::%s()", EG(scope)->name, op_array->function_name);
- NEXT_OPCODE(); /* Never reached */
-}
-
-
-int zend_end_silence_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval restored_error_reporting;
-
- restored_error_reporting.type = IS_LONG;
- restored_error_reporting.value.lval = EX_T(EX(opline)->op1.u.var).tmp_var.value.lval;
- convert_to_string(&restored_error_reporting);
- zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
- zendi_zval_dtor(restored_error_reporting);
- NEXT_OPCODE();
-}
-
-
-int zend_qm_assign_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *value = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- EX_T(EX(opline)->result.u.var).tmp_var = *value;
- if (!EG(free_op1)) {
- zval_copy_ctor(&EX_T(EX(opline)->result.u.var).tmp_var);
- }
- NEXT_OPCODE();
-}
-
-
-int zend_ext_stmt_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- if (!EG(no_extensions)) {
- zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, op_array TSRMLS_CC);
- }
- NEXT_OPCODE();
-}
-
-
-int zend_ext_fcall_begin_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- if (!EG(no_extensions)) {
- zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_begin_handler, op_array TSRMLS_CC);
- }
- NEXT_OPCODE();
-}
-
-
-int zend_ext_fcall_end_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- if (!EG(no_extensions)) {
- zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_end_handler, op_array TSRMLS_CC);
- }
- NEXT_OPCODE();
-}
-
-
-int zend_declare_class_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- EX_T(EX(opline)->result.u.var).EA.class_entry = do_bind_class(EX(opline), EG(function_table), EG(class_table) TSRMLS_CC);
- NEXT_OPCODE();
-}
-
-
-int zend_declare_inherited_class_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- EX_T(EX(opline)->result.u.var).EA.class_entry = do_bind_inherited_class(EX(opline), EG(function_table), EG(class_table), EX_T(EX(opline)->extended_value).EA.class_entry TSRMLS_CC);
- NEXT_OPCODE();
-}
-
-
-int zend_declare_function_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- do_bind_function(EX(opline), EG(function_table), EG(class_table), 0);
- NEXT_OPCODE();
-}
-
-
-int zend_ticks_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- if (++EG(ticks_count)>=EX(opline)->op1.u.constant.value.lval) {
- EG(ticks_count)=0;
- if (zend_ticks_function) {
- zend_ticks_function(EX(opline)->op1.u.constant.value.lval);
- }
- }
- NEXT_OPCODE();
-}
-
-
-int zend_instanceof_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *expr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- zend_bool result;
-
- if (Z_TYPE_P(expr) == IS_OBJECT) {
- result = instanceof_function(Z_OBJCE_P(expr), EX_T(EX(opline)->op2.u.var).EA.class_entry TSRMLS_CC);
- } else {
- result = 0;
- }
- ZVAL_BOOL(&EX_T(EX(opline)->result.u.var).tmp_var, result);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- NEXT_OPCODE();
-}
-
-
-int zend_ext_nop_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- NEXT_OPCODE();
-}
-
-
-int zend_nop_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- NEXT_OPCODE();
-}
-
-int zend_start_namespace_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *namespace_name;
- zend_namespace **pns;
-
- if(EX(opline)->op1.op_type != IS_UNUSED) {
- namespace_name= get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- if (Z_TYPE_P(namespace_name) != IS_STRING) {
- zend_error(E_ERROR, "Internal error: Invalid type in namespace definition - %d", Z_TYPE_P(namespace_name));
- }
-
- if(zend_hash_find(&EG(global_namespace_ptr)->class_table, Z_STRVAL_P(namespace_name), Z_STRLEN_P(namespace_name)+1, (void **)&pns) != SUCCESS || (*pns)->type != ZEND_USER_NAMESPACE) {
- zend_error(E_ERROR, "Internal error: Cannot locate namespace '%s'", Z_STRVAL_P(namespace_name));
- }
- } else {
- pns = &EG(global_namespace_ptr);
- }
-
- if(EG(active_namespace) != *pns) {
- zend_switch_namespace(*pns TSRMLS_CC);
- }
- NEXT_OPCODE();
-}
-
-
-int zend_add_interface_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_class_entry *ce = EX_T(EX(opline)->op1.u.var).EA.class_entry;
- zend_class_entry *iface = EX_T(EX(opline)->op2.u.var).EA.class_entry;
-
- if (!(iface->ce_flags & ZEND_ACC_INTERFACE)) {
- zend_error(E_ERROR, "%s cannot implement %s - it is not an interface", ce->name, iface->name);
- }
-
- ce->interfaces[EX(opline)->extended_value] = iface;
-
- zend_do_implement_interface(ce, iface);
-
- NEXT_OPCODE();
-}
-
-
-int zend_verify_instanceof_handler(ZEND_OPCODE_HANDLER_ARGS)
-{
- zval *arg = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
- zend_class_entry *ce = EX_T(EX(opline)->op1.u.var).EA.class_entry;
-
- if ((Z_TYPE_P(arg) != IS_OBJECT)
- || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) {
- char *error_msg;
-
- if (ce->ce_flags & ZEND_ACC_INTERFACE) {
- error_msg = "implement interface";
- } else {
- error_msg = "be an instance of";
- }
- zend_error(E_ERROR, "Argument %d must %s %s", EX(opline)->extended_value, error_msg, ce->name);
- }
-
- NEXT_OPCODE();
-}
-
-
-#define MAX_ABSTRACT_INFO_CNT 3
-#define MAX_ABSTRACT_INFO_FMT "%s%s%s%s"
-
-#define DISPLAY_ABSTRACT_FN(idx) \
- ai.afn[idx] ? ZEND_FN_SCOPE_NAME(ai.afn[idx]) : "", \
- ai.afn[idx] ? "::" : "", \
- ai.afn[idx] ? ai.afn[idx]->common.function_name : "", \
- ai.afn[idx] && ai.afn[idx+1] ? ", " : (ai.afn[idx] && ai.cnt >= MAX_ABSTRACT_INFO_CNT ? ", ..." : "")
-
-typedef struct _zend_abstract_info {
- zend_function *afn[MAX_ABSTRACT_INFO_CNT+1];
- int cnt;
-} zend_abstract_info;
-
-int zend_verify_abstract_class_function(zend_function *fn, zend_abstract_info *ai TSRMLS_DC)
-{
- if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
- if (ai->cnt < MAX_ABSTRACT_INFO_CNT) {
- ai->afn[ai->cnt] = fn;
- }
- ai->cnt++;
- }
- return 0;
-}
-
-int zend_verify_abstract_class(ZEND_OPCODE_HANDLER_ARGS)
-{
- zend_class_entry *ce = EX_T(EX(opline)->op1.u.var).EA.class_entry;
- zend_abstract_info ai;
-
- if ((ce->ce_flags & ZEND_ACC_ABSTRACT) && !(ce->ce_flags & ZEND_ACC_ABSTRACT_CLASS)) {
- memset(&ai, 0, sizeof(ai));
-
- zend_hash_apply_with_argument(&ce->function_table, (apply_func_arg_t) zend_verify_abstract_class_function, &ai TSRMLS_CC);
-
- zend_error(E_ERROR, "Class %s contains %d abstract methods and must therefore be declared abstract (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")",
- ce->name, ai.cnt,
- DISPLAY_ABSTRACT_FN(0),
- DISPLAY_ABSTRACT_FN(1),
- DISPLAY_ABSTRACT_FN(2)
- );
- }
-
- NEXT_OPCODE();
-}
-
-
-void zend_init_opcodes_handlers()
-{
- zend_opcode_handlers[ZEND_NOP] = zend_nop_handler;
- zend_opcode_handlers[ZEND_ADD] = zend_add_handler;
- zend_opcode_handlers[ZEND_SUB] = zend_sub_handler;
- zend_opcode_handlers[ZEND_MUL] = zend_mul_handler;
- zend_opcode_handlers[ZEND_DIV] = zend_div_handler;
- zend_opcode_handlers[ZEND_MOD] = zend_mod_handler;
- zend_opcode_handlers[ZEND_SL] = zend_sl_handler;
- zend_opcode_handlers[ZEND_SR] = zend_sr_handler;
- zend_opcode_handlers[ZEND_CONCAT] = zend_concat_handler;
- zend_opcode_handlers[ZEND_BW_OR] = zend_bw_or_handler;
- zend_opcode_handlers[ZEND_BW_AND] = zend_bw_and_handler;
- zend_opcode_handlers[ZEND_BW_XOR] = zend_bw_xor_handler;
- zend_opcode_handlers[ZEND_BW_NOT] = zend_bw_not_handler;
- zend_opcode_handlers[ZEND_BOOL_NOT] = zend_bool_not_handler;
- zend_opcode_handlers[ZEND_BOOL_XOR] = zend_bool_xor_handler;
- zend_opcode_handlers[ZEND_IS_IDENTICAL] = zend_is_identical_handler;
- zend_opcode_handlers[ZEND_IS_NOT_IDENTICAL] = zend_is_not_identical_handler;
- zend_opcode_handlers[ZEND_IS_EQUAL] = zend_is_equal_handler;
- zend_opcode_handlers[ZEND_IS_NOT_EQUAL] = zend_is_not_equal_handler;
- zend_opcode_handlers[ZEND_IS_SMALLER] = zend_is_smaller_handler;
- zend_opcode_handlers[ZEND_IS_SMALLER_OR_EQUAL] = zend_is_smaller_or_equal_handler;
- zend_opcode_handlers[ZEND_CAST] = zend_cast_handler;
- zend_opcode_handlers[ZEND_QM_ASSIGN] = zend_qm_assign_handler;
-
- zend_opcode_handlers[ZEND_ASSIGN_ADD] = zend_assign_add_handler;
- zend_opcode_handlers[ZEND_ASSIGN_SUB] = zend_assign_sub_handler;
- zend_opcode_handlers[ZEND_ASSIGN_MUL] = zend_assign_mul_handler;
- zend_opcode_handlers[ZEND_ASSIGN_DIV] = zend_assign_div_handler;
- zend_opcode_handlers[ZEND_ASSIGN_MOD] = zend_assign_mod_handler;
- zend_opcode_handlers[ZEND_ASSIGN_SL] = zend_assign_sl_handler;
- zend_opcode_handlers[ZEND_ASSIGN_SR] = zend_assign_sr_handler;
- zend_opcode_handlers[ZEND_ASSIGN_CONCAT] = zend_assign_concat_handler;
- zend_opcode_handlers[ZEND_ASSIGN_BW_OR] = zend_assign_bw_or_handler;
- zend_opcode_handlers[ZEND_ASSIGN_BW_AND] = zend_assign_bw_and_handler;
- zend_opcode_handlers[ZEND_ASSIGN_BW_XOR] = zend_assign_bw_xor_handler;
-
- zend_opcode_handlers[ZEND_PRE_INC] = zend_pre_inc_handler;
- zend_opcode_handlers[ZEND_PRE_DEC] = zend_pre_dec_handler;
- zend_opcode_handlers[ZEND_POST_INC] = zend_post_inc_handler;
- zend_opcode_handlers[ZEND_POST_DEC] = zend_post_dec_handler;
-
- zend_opcode_handlers[ZEND_ASSIGN] = zend_assign_handler;
- zend_opcode_handlers[ZEND_ASSIGN_REF] = zend_assign_ref_handler;
-
- zend_opcode_handlers[ZEND_ECHO] = zend_echo_handler;
- zend_opcode_handlers[ZEND_PRINT] = zend_print_handler;
-
- zend_opcode_handlers[ZEND_JMP] = zend_jmp_handler;
- zend_opcode_handlers[ZEND_JMPZ] = zend_jmpz_handler;
- zend_opcode_handlers[ZEND_JMPNZ] = zend_jmpnz_handler;
- zend_opcode_handlers[ZEND_JMPZNZ] = zend_jmpznz_handler;
- zend_opcode_handlers[ZEND_JMPZ_EX] = zend_jmpz_ex_handler;
- zend_opcode_handlers[ZEND_JMPNZ_EX] = zend_jmpnz_ex_handler;
- zend_opcode_handlers[ZEND_CASE] = zend_case_handler;
- zend_opcode_handlers[ZEND_SWITCH_FREE] = zend_switch_free_handler;
- zend_opcode_handlers[ZEND_BRK] = zend_brk_handler;
- zend_opcode_handlers[ZEND_CONT] = zend_cont_handler;
- zend_opcode_handlers[ZEND_BOOL] = zend_bool_handler;
-
- zend_opcode_handlers[ZEND_INIT_STRING] = zend_init_string_handler;
- zend_opcode_handlers[ZEND_ADD_CHAR] = zend_add_char_handler;
- zend_opcode_handlers[ZEND_ADD_STRING] = zend_add_string_handler;
- zend_opcode_handlers[ZEND_ADD_VAR] = zend_add_var_handler;
-
- zend_opcode_handlers[ZEND_BEGIN_SILENCE] = zend_begin_silence_handler;
- zend_opcode_handlers[ZEND_END_SILENCE] = zend_end_silence_handler;
-
- zend_opcode_handlers[ZEND_INIT_FCALL_BY_NAME] = zend_init_fcall_by_name_handler;
- zend_opcode_handlers[ZEND_DO_FCALL] = zend_do_fcall_handler;
- zend_opcode_handlers[ZEND_DO_FCALL_BY_NAME] = zend_do_fcall_by_name_handler;
- zend_opcode_handlers[ZEND_RETURN] = zend_return_handler;
-
- zend_opcode_handlers[ZEND_RECV] = zend_recv_handler;
- zend_opcode_handlers[ZEND_RECV_INIT] = zend_recv_init_handler;
-
- zend_opcode_handlers[ZEND_SEND_VAL] = zend_send_val_handler;
- zend_opcode_handlers[ZEND_SEND_VAR] = zend_send_var_handler;
- zend_opcode_handlers[ZEND_SEND_REF] = zend_send_ref_handler;
-
- zend_opcode_handlers[ZEND_NEW] = zend_new_handler;
- zend_opcode_handlers[ZEND_JMP_NO_CTOR] = zend_jmp_no_ctor_handler;
- zend_opcode_handlers[ZEND_FREE] = zend_free_handler;
-
- zend_opcode_handlers[ZEND_INIT_ARRAY] = zend_init_array_handler;
- zend_opcode_handlers[ZEND_ADD_ARRAY_ELEMENT] = zend_add_array_element_handler;
-
- zend_opcode_handlers[ZEND_INCLUDE_OR_EVAL] = zend_include_or_eval_handler;
-
- zend_opcode_handlers[ZEND_UNSET_VAR] = zend_unset_var_handler;
- zend_opcode_handlers[ZEND_UNSET_DIM_OBJ] = zend_unset_dim_obj_handler;
-
- zend_opcode_handlers[ZEND_FE_RESET] = zend_fe_reset_handler;
- zend_opcode_handlers[ZEND_FE_FETCH] = zend_fe_fetch_handler;
-
- zend_opcode_handlers[ZEND_EXIT] = zend_exit_handler;
-
- zend_opcode_handlers[ZEND_FETCH_R] = zend_fetch_r_handler;
- zend_opcode_handlers[ZEND_FETCH_DIM_R] = zend_fetch_dim_r_handler;
- zend_opcode_handlers[ZEND_FETCH_OBJ_R] = zend_fetch_obj_r_handler;
- zend_opcode_handlers[ZEND_FETCH_W] = zend_fetch_w_handler;
- zend_opcode_handlers[ZEND_FETCH_DIM_W] = zend_fetch_dim_w_handler;
- zend_opcode_handlers[ZEND_FETCH_OBJ_W] = zend_fetch_obj_w_handler;
- zend_opcode_handlers[ZEND_FETCH_RW] = zend_fetch_rw_handler;
- zend_opcode_handlers[ZEND_FETCH_DIM_RW] = zend_fetch_dim_rw_handler;
- zend_opcode_handlers[ZEND_FETCH_OBJ_RW] = zend_fetch_obj_rw_handler;
- zend_opcode_handlers[ZEND_FETCH_IS] = zend_fetch_is_handler;
- zend_opcode_handlers[ZEND_FETCH_DIM_IS] = zend_fetch_dim_is_handler;
- zend_opcode_handlers[ZEND_FETCH_OBJ_IS] = zend_fetch_obj_is_handler;
- zend_opcode_handlers[ZEND_FETCH_FUNC_ARG] = zend_fetch_func_arg_handler;
- zend_opcode_handlers[ZEND_FETCH_DIM_FUNC_ARG] = zend_fetch_dim_func_arg_handler;
- zend_opcode_handlers[ZEND_FETCH_OBJ_FUNC_ARG] = zend_fetch_obj_func_arg_handler;
- zend_opcode_handlers[ZEND_FETCH_UNSET] = zend_fetch_unset_handler;
- zend_opcode_handlers[ZEND_FETCH_DIM_UNSET] = zend_fetch_dim_unset_handler;
- zend_opcode_handlers[ZEND_FETCH_OBJ_UNSET] = zend_fetch_obj_unset_handler;
-
- zend_opcode_handlers[ZEND_FETCH_DIM_TMP_VAR] = zend_fetch_dim_tmp_var_handler;
- zend_opcode_handlers[ZEND_FETCH_CONSTANT] = zend_fetch_constant_handler;
-
- zend_opcode_handlers[ZEND_EXT_STMT] = zend_ext_stmt_handler;
- zend_opcode_handlers[ZEND_EXT_FCALL_BEGIN] = zend_ext_fcall_begin_handler;
- zend_opcode_handlers[ZEND_EXT_FCALL_END] = zend_ext_fcall_end_handler;
- zend_opcode_handlers[ZEND_EXT_NOP] = zend_ext_nop_handler;
-
- zend_opcode_handlers[ZEND_TICKS] = zend_ticks_handler;
-
- zend_opcode_handlers[ZEND_SEND_VAR_NO_REF] = zend_send_var_no_ref_handler;
-
- zend_opcode_handlers[ZEND_CATCH] = zend_catch_handler;
- zend_opcode_handlers[ZEND_THROW] = zend_throw_handler;
-
- zend_opcode_handlers[ZEND_FETCH_CLASS] = zend_fetch_class_handler;
-
- zend_opcode_handlers[ZEND_CLONE] = zend_clone_handler;
-
- zend_opcode_handlers[ZEND_INIT_CTOR_CALL] = zend_init_ctor_call_handler;
- zend_opcode_handlers[ZEND_INIT_METHOD_CALL] = zend_init_method_call_handler;
- zend_opcode_handlers[ZEND_INIT_STATIC_METHOD_CALL] = zend_init_static_method_call_handler;
-
- zend_opcode_handlers[ZEND_ISSET_ISEMPTY_VAR] = zend_isset_isempty_var_handler;
- zend_opcode_handlers[ZEND_ISSET_ISEMPTY_DIM_OBJ] = zend_isset_isempty_dim_obj_handler;
-
- zend_opcode_handlers[ZEND_IMPORT_FUNCTION] = zend_import_function_handler;
- zend_opcode_handlers[ZEND_IMPORT_CLASS] = zend_import_class_handler;
- zend_opcode_handlers[ZEND_IMPORT_CONST] = zend_import_const_handler;
-
- zend_opcode_handlers[ZEND_ASSIGN_ADD_OBJ] = zend_assign_add_obj_handler;
- zend_opcode_handlers[ZEND_ASSIGN_SUB_OBJ] = zend_assign_sub_obj_handler;
- zend_opcode_handlers[ZEND_ASSIGN_MUL_OBJ] = zend_assign_mul_obj_handler;
- zend_opcode_handlers[ZEND_ASSIGN_DIV_OBJ] = zend_assign_div_obj_handler;
- zend_opcode_handlers[ZEND_ASSIGN_MOD_OBJ] = zend_assign_mod_obj_handler;
- zend_opcode_handlers[ZEND_ASSIGN_SL_OBJ] = zend_assign_sl_obj_handler;
- zend_opcode_handlers[ZEND_ASSIGN_SR_OBJ] = zend_assign_sr_obj_handler;
- zend_opcode_handlers[ZEND_ASSIGN_CONCAT_OBJ] = zend_assign_concat_obj_handler;
- zend_opcode_handlers[ZEND_ASSIGN_BW_OR_OBJ] = zend_assign_bw_or_obj_handler;
- zend_opcode_handlers[ZEND_ASSIGN_BW_AND_OBJ] = zend_assign_bw_and_obj_handler;
- zend_opcode_handlers[ZEND_ASSIGN_BW_XOR_OBJ] = zend_assign_bw_xor_obj_handler;
-
- zend_opcode_handlers[ZEND_PRE_INC_OBJ] = zend_pre_inc_obj_handler;
- zend_opcode_handlers[ZEND_PRE_DEC_OBJ] = zend_pre_dec_obj_handler;
- zend_opcode_handlers[ZEND_POST_INC_OBJ] = zend_post_inc_obj_handler;
- zend_opcode_handlers[ZEND_POST_DEC_OBJ] = zend_post_dec_obj_handler;
-
- zend_opcode_handlers[ZEND_ASSIGN_OBJ] = zend_assign_obj_handler;
- zend_opcode_handlers[ZEND_OP_DATA] = NULL;
-
- zend_opcode_handlers[ZEND_INSTANCEOF] = zend_instanceof_handler;
-
- zend_opcode_handlers[ZEND_DECLARE_CLASS] = zend_declare_class_handler;
- zend_opcode_handlers[ZEND_DECLARE_INHERITED_CLASS] = zend_declare_inherited_class_handler;
- zend_opcode_handlers[ZEND_DECLARE_FUNCTION] = zend_declare_function_handler;
-
- zend_opcode_handlers[ZEND_RAISE_ABSTRACT_ERROR] = zend_raise_abstract_error_handler;
- zend_opcode_handlers[ZEND_START_NAMESPACE] = zend_start_namespace_handler;
-
- zend_opcode_handlers[ZEND_ADD_INTERFACE] = zend_add_interface_handler;
- zend_opcode_handlers[ZEND_VERIFY_INSTANCEOF] = zend_verify_instanceof_handler;
- zend_opcode_handlers[ZEND_VERIFY_ABSTRACT_CLASS] = zend_verify_abstract_class;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
deleted file mode 100644
index 5420e30a0c..0000000000
--- a/Zend/zend_execute.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_EXECUTE_H
-#define ZEND_EXECUTE_H
-
-#include "zend_compile.h"
-#include "zend_hash.h"
-#include "zend_variables.h"
-#include "zend_operators.h"
-
-typedef union _temp_variable {
- zval tmp_var;
- struct {
- zval **ptr_ptr;
- zval *ptr;
- } var;
- struct {
- zval tmp_var; /* a dummy */
-
- union {
- struct {
- zval *str;
- zend_uint offset;
- } str_offset;
- zend_property_reference overloaded_element;
- } data;
-
- unsigned char type;
- zend_class_entry *class_entry;
- } EA;
-} temp_variable;
-
-
-BEGIN_EXTERN_C()
-ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
-ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
-
-void init_executor(TSRMLS_D);
-void shutdown_executor(TSRMLS_D);
-ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
-ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
-ZEND_API int zend_is_true(zval *op);
-static inline void safe_free_zval_ptr(zval *p)
-{
- TSRMLS_FETCH();
-
- if (p!=EG(uninitialized_zval_ptr)) {
- FREE_ZVAL(p);
- }
-}
-ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
-ZEND_API int zend_lookup_ns_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
-ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
-void zend_switch_namespace(zend_namespace *ns TSRMLS_DC);
-
-static inline int i_zend_is_true(zval *op)
-{
- int result;
-
- switch (op->type) {
- case IS_NULL:
- result = 0;
- break;
- case IS_LONG:
- case IS_BOOL:
- case IS_RESOURCE:
- result = (op->value.lval?1:0);
- break;
- case IS_DOUBLE:
- result = (op->value.dval ? 1 : 0);
- break;
- case IS_STRING:
- if (op->value.str.len == 0
- || (op->value.str.len==1 && op->value.str.val[0]=='0')) {
- result = 0;
- } else {
- result = 1;
- }
- break;
- case IS_ARRAY:
- result = (zend_hash_num_elements(op->value.ht)?1:0);
- break;
- case IS_OBJECT:
- /* OBJ-TBI */
- result = 1;
- break;
- default:
- result = 0;
- break;
- }
- return result;
-}
-
-ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC);
-
-/* dedicated Zend executor functions - do not use! */
-static inline void zend_ptr_stack_clear_multiple(TSRMLS_D)
-{
- void **p = EG(argument_stack).top_element-2;
- int delete_count = (ulong) *p;
-
- EG(argument_stack).top -= (delete_count+2);
- while (--delete_count>=0) {
- zval_ptr_dtor((zval **) --p);
- }
- EG(argument_stack).top_element = p;
-}
-
-static inline int zend_ptr_stack_get_arg(int requested_arg, void **data TSRMLS_DC)
-{
- void **p = EG(argument_stack).top_element-2;
- int arg_count = (ulong) *p;
-
- if (requested_arg>arg_count) {
- return FAILURE;
- }
- *data = (p-arg_count+requested_arg-1);
- return SUCCESS;
-}
-
-void execute_new_code(TSRMLS_D);
-
-
-/* services */
-ZEND_API char *get_active_function_name(TSRMLS_D);
-ZEND_API char *zend_get_executed_filename(TSRMLS_D);
-ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
-ZEND_API zend_bool zend_is_executing(TSRMLS_D);
-
-ZEND_API void zend_set_timeout(long seconds);
-ZEND_API void zend_unset_timeout(TSRMLS_D);
-ZEND_API void zend_timeout(int dummy);
-
-#ifdef ZEND_WIN32
-void zend_init_timeout_thread();
-void zend_shutdown_timeout_thread();
-#define WM_REGISTER_ZEND_TIMEOUT (WM_USER+1)
-#define WM_UNREGISTER_ZEND_TIMEOUT (WM_USER+2)
-#endif
-
-#define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p))
-#define zendi_zval_dtor(p) zval_dtor(&(p))
-
-#define active_opline (*EG(opline_ptr))
-
-void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts TSRMLS_DC);
-
-#define IS_OVERLOADED_OBJECT 1
-#define IS_STRING_OFFSET 2
-
-/* The following tries to resolve the classname of a zval of type object.
- * Since it is slow it should be only used in error messages.
- */
-#define Z_OBJ_CLASS_NAME_P(zval) ((zval) && (zval)->type == IS_OBJECT && Z_OBJ_HT_P(zval)->get_class_entry != NULL && Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC) ? Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC)->name : "")
-
-END_EXTERN_C()
-
-#endif /* ZEND_EXECUTE_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
deleted file mode 100644
index a5082282ff..0000000000
--- a/Zend/zend_execute_API.c
+++ /dev/null
@@ -1,1094 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <stdio.h>
-#include <signal.h>
-
-#include "zend.h"
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_API.h"
-#include "zend_ptr_stack.h"
-#include "zend_constants.h"
-#include "zend_extensions.h"
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-
-ZEND_API void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
-ZEND_API void (*zend_execute_internal)(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
-
-#ifdef ZEND_WIN32
-#include <process.h>
-/* true global */
-static WNDCLASS wc;
-static HWND timeout_window;
-static HANDLE timeout_thread_event;
-static DWORD timeout_thread_id;
-static int timeout_thread_initialized=0;
-#endif
-
-
-#if ZEND_DEBUG
-static void (*original_sigsegv_handler)(int);
-static void zend_handle_sigsegv(int dummy)
-{
- fflush(stdout);
- fflush(stderr);
- if (original_sigsegv_handler==zend_handle_sigsegv) {
- signal(SIGSEGV, original_sigsegv_handler);
- } else {
- signal(SIGSEGV, SIG_DFL);
- }
- {
- TSRMLS_FETCH();
-
- fprintf(stderr, "SIGSEGV caught on opcode %d on opline %d of %s() at %s:%d\n\n",
- active_opline->opcode,
- active_opline-EG(active_op_array)->opcodes,
- get_active_function_name(TSRMLS_C),
- zend_get_executed_filename(TSRMLS_C),
- zend_get_executed_lineno(TSRMLS_C));
- }
- if (original_sigsegv_handler!=zend_handle_sigsegv) {
- original_sigsegv_handler(dummy);
- }
-}
-#endif
-
-
-static void zend_extension_activator(zend_extension *extension TSRMLS_DC)
-{
- if (extension->activate) {
- extension->activate();
- }
-}
-
-
-static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC)
-{
- if (extension->deactivate) {
- extension->deactivate();
- }
-}
-
-
-static int is_not_internal_function(zend_function *function TSRMLS_DC)
-{
- if (function->type == ZEND_INTERNAL_FUNCTION) {
- return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP;
- } else {
- return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE;
- }
-}
-
-
-static int is_not_internal_class(zend_class_entry **ce TSRMLS_DC)
-{
- if ((*ce)->type == ZEND_INTERNAL_CLASS) {
- return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP;
- } else {
- return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE;
- }
-}
-
-
-void init_executor(TSRMLS_D)
-{
- INIT_ZVAL(EG(uninitialized_zval));
-/* trick to make uninitialized_zval never be modified, passed by ref, etc. */
- EG(uninitialized_zval).refcount++;
- INIT_ZVAL(EG(error_zval));
- EG(uninitialized_zval_ptr)=&EG(uninitialized_zval);
- EG(error_zval_ptr)=&EG(error_zval);
- zend_ptr_stack_init(&EG(arg_types_stack));
-/* destroys stack frame, therefore makes core dumps worthless */
-#if 0&&ZEND_DEBUG
- original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv);
-#endif
- EG(return_value_ptr_ptr) = NULL;
-
- EG(symtable_cache_ptr) = EG(symtable_cache)-1;
- EG(symtable_cache_limit)=EG(symtable_cache)+SYMTABLE_CACHE_SIZE-1;
- EG(no_extensions)=0;
- EG(implicit_clone)=0;
-
- EG(function_table) = CG(function_table);
- EG(class_table) = CG(class_table);
-
- EG(in_execution) = 0;
-
- zend_ptr_stack_init(&EG(argument_stack));
-
- zend_hash_init(&EG(symbol_table), 50, NULL, ZVAL_PTR_DTOR, 0);
- {
- zval *globals;
-
- ALLOC_ZVAL(globals);
- globals->refcount=1;
- globals->is_ref=1;
- globals->type = IS_ARRAY;
- globals->value.ht = &EG(symbol_table);
- zend_hash_update(&EG(symbol_table), "GLOBALS", sizeof("GLOBALS"), &globals, sizeof(zval *), NULL);
- }
- EG(active_symbol_table) = &EG(symbol_table);
-
- zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator TSRMLS_CC);
- EG(opline_ptr) = NULL;
- EG(garbage_ptr) = 0;
-
- zend_hash_init(&EG(included_files), 5, NULL, NULL, 0);
-
- EG(ticks_count) = 0;
-
- EG(user_error_handler) = NULL;
-
- EG(current_execute_data) = NULL;
-
- zend_ptr_stack_init(&EG(user_error_handlers));
- zend_ptr_stack_init(&EG(user_exception_handlers));
-
- zend_objects_store_init(&EG(objects_store), 1024);
-
- EG(full_tables_cleanup) = 0;
-#ifdef ZEND_WIN32
- EG(timed_out) = 0;
-#endif
-
- EG(exception) = NULL;
-
- EG(scope) = NULL;
- EG(active_namespace) = &CG(global_namespace);
-
- EG(global_namespace_ptr) = &CG(global_namespace);
- CG(global_namespace).static_members = &EG(symbol_table);
-
- EG(current_execute_data) = NULL;
-
- EG(This) = NULL;
-
- EG(float_separator)[0] = '.';
-}
-
-
-void shutdown_executor(TSRMLS_D)
-{
- /* return to global namespace here */
- if(EG(active_namespace) != EG(global_namespace_ptr)) {
- zend_switch_namespace(EG(global_namespace_ptr) TSRMLS_CC);
- }
-
- zend_try {
- zend_ptr_stack_destroy(&EG(arg_types_stack));
-
-/* Removed because this can not be safely done, e.g. in this situation:
- Object 1 creates object 2
- Object 3 holds reference to object 2.
- Now when 1 and 2 are destroyed, 3 can still access 2 in its destructor, with
- very problematic results */
-/* zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC); */
-
-/* Moved after symbol table cleaners, because some of the cleaners can call
- destructors, which would use EG(symtable_cache_ptr) and thus leave leaks */
-/* while (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
- zend_hash_destroy(*EG(symtable_cache_ptr));
- efree(*EG(symtable_cache_ptr));
- EG(symtable_cache_ptr)--;
- }
-*/
- zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_deactivator TSRMLS_CC);
-
- zend_hash_destroy(&EG(symbol_table));
-
- /* Cleanup static data for functions and arrays.
- We need separate cleanup stage because of the following problem:
- Suppose we destroy class X, which destroys function table,
- and in function table we have function foo() that has static $bar. Now if
- object of class X is assigned to $bar, its destructor will be called and will
- fail since X's function table is in mid-destruction.
- So we want first of all to clean up all data and then move to tables destruction.
- Note that only run-time accessed data need to be cleaned up, pre-defined data can
- not contain objects and thus are not probelmatic */
- zend_hash_apply(EG(function_table), (apply_func_t) zend_cleanup_function_data TSRMLS_CC);
- zend_hash_apply(EG(class_table), (apply_func_t) zend_cleanup_class_data TSRMLS_CC);
-
- while (EG(garbage_ptr)) {
- if (EG(garbage)[--EG(garbage_ptr)]->refcount==1) {
- zval_ptr_dtor(&EG(garbage)[EG(garbage_ptr)]);
- }
- }
-
- zend_ptr_stack_destroy(&EG(argument_stack));
-
- /* Destroy all op arrays */
- if (EG(full_tables_cleanup)) {
- zend_hash_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC);
- zend_hash_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC);
- } else {
- zend_hash_reverse_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC);
- zend_hash_reverse_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC);
- }
-
- while (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
- zend_hash_destroy(*EG(symtable_cache_ptr));
- efree(*EG(symtable_cache_ptr));
- EG(symtable_cache_ptr)--;
- }
- } zend_end_try();
-
- zend_try {
- clean_non_persistent_constants(TSRMLS_C);
- } zend_end_try();
-
- /* The regular list must be destroyed after the main symbol table,
- * op arrays, and constants are destroyed.
- */
- zend_destroy_rsrc_list(&EG(regular_list) TSRMLS_CC);
-
- zend_try {
-#if ZEND_DEBUG
- signal(SIGSEGV, original_sigsegv_handler);
-#endif
-
- zend_hash_destroy(&EG(included_files));
-
- if (EG(user_error_handler)) {
- zval_dtor(EG(user_error_handler));
- FREE_ZVAL(EG(user_error_handler));
- }
-
- if (EG(user_exception_handler)) {
- zval_dtor(EG(user_exception_handler));
- FREE_ZVAL(EG(user_exception_handler));
- }
-
- zend_ptr_stack_clean(&EG(user_error_handlers), ZVAL_DESTRUCTOR, 1);
- zend_ptr_stack_destroy(&EG(user_error_handlers));
-
- zend_ptr_stack_clean(&EG(user_exception_handlers), ZVAL_DESTRUCTOR, 1);
- zend_ptr_stack_destroy(&EG(user_exception_handlers));
-
- zend_objects_store_destroy(&EG(objects_store));
- } zend_end_try();
-}
-
-
-ZEND_API char *get_active_function_name(TSRMLS_D)
-{
- if (!zend_is_executing(TSRMLS_C)) {
- return NULL;
- }
- switch (EG(function_state_ptr)->function->type) {
- case ZEND_USER_FUNCTION: {
- char *function_name = ((zend_op_array *) EG(function_state_ptr)->function)->function_name;
-
- if (function_name) {
- return function_name;
- } else {
- return "main";
- }
- }
- break;
- case ZEND_INTERNAL_FUNCTION:
- return ((zend_internal_function *) EG(function_state_ptr)->function)->function_name;
- break;
- default:
- return NULL;
- }
-}
-
-
-ZEND_API char *zend_get_executed_filename(TSRMLS_D)
-{
- if (EG(active_op_array)) {
- return EG(active_op_array)->filename;
- } else {
- return "[no active file]";
- }
-}
-
-
-ZEND_API uint zend_get_executed_lineno(TSRMLS_D)
-{
- if (EG(opline_ptr)) {
- return active_opline->lineno;
- } else {
- return 0;
- }
-}
-
-
-ZEND_API zend_bool zend_is_executing(TSRMLS_D)
-{
- return EG(in_execution);
-}
-
-
-ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC)
-{
-#if DEBUG_ZEND>=2
- printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, (*zval_ptr)->refcount, (*zval_ptr)->refcount-1);
-#endif
- (*zval_ptr)->refcount--;
- if ((*zval_ptr)->refcount==0) {
- zval_dtor(*zval_ptr);
- safe_free_zval_ptr(*zval_ptr);
- } else if ((*zval_ptr)->refcount == 1) {
- (*zval_ptr)->is_ref = 0;
- }
-}
-
-
-ZEND_API int zend_is_true(zval *op)
-{
- return i_zend_is_true(op);
-}
-
-#include "../TSRM/tsrm_strtok_r.h"
-
-ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
-{
- zval *p = *pp;
- zend_bool inline_change = (zend_bool) (unsigned long) arg;
- zval const_value;
-
- if (p->type == IS_CONSTANT) {
- int refcount;
-
- SEPARATE_ZVAL(pp);
- p = *pp;
-
- refcount = p->refcount;
-
- if (strchr(p->value.str.val, ':')) {
- char *cur, *temp;
- char *last;
- zend_class_entry **ce;
- zval **value;
-
- last = tsrm_strtok_r(p->value.str.val, ":", &temp);
-
- if (strcasecmp(last, "self")==0) {
- if (EG(scope)) {
- last = EG(scope)->name;
- } else {
- zend_error(E_ERROR, "Cannot access self:: when no class scope is active");
- }
- } else if (strcasecmp(last, "parent")==0) {
- if (!EG(scope)) {
- zend_error(E_ERROR, "Cannot access parent:: when no class scope is active");
- } else if (!EG(scope)->parent) {
- zend_error(E_ERROR, "Cannot access parent:: when current class scope has no parent");
- } else {
- last = EG(scope)->parent->name;
- }
- }
-
-
- if (zend_lookup_class(last, strlen(last), &ce TSRMLS_CC) == FAILURE) {
- zend_error(E_ERROR, "Undefined class '%s'", last);
- }
-
- last = tsrm_strtok_r(NULL, ":", &temp);
-
- for(;;) {
- cur = tsrm_strtok_r(NULL, ":", &temp);
- if (!cur) {
- break;
- }
- if (zend_hash_find(&(*ce)->class_table, last, strlen(last)+1, (void **)&ce) == FAILURE) {
- zend_error(E_ERROR, "Undefined sub-class '%s'", last);
- }
- last = cur;
- }
- if (zend_hash_find(&(*ce)->constants_table, last, strlen(last)+1, (void **) &value) == FAILURE) {
- zend_error(E_ERROR, "Undefined class constant '%s'", last);
- }
- const_value = **value;
- zval_copy_ctor(&const_value);
- if (inline_change) {
- STR_FREE(p->value.str.val);
- }
- *p = const_value;
- } else {
- if (!zend_get_constant(p->value.str.val, p->value.str.len, &const_value TSRMLS_CC)) {
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
- p->value.str.val,
- p->value.str.val);
- p->type = IS_STRING;
- if (!inline_change) {
- zval_copy_ctor(p);
- }
- } else {
- if (inline_change) {
- STR_FREE(p->value.str.val);
- }
- *p = const_value;
- }
- }
- INIT_PZVAL(p);
- p->refcount = refcount;
- } else if (p->type == IS_CONSTANT_ARRAY) {
- zval **element;
- char *str_index;
- uint str_index_len;
- ulong num_index;
-
- SEPARATE_ZVAL(pp);
- p = *pp;
- p->type = IS_ARRAY;
-
- /* First go over the array and see if there are any constant indices */
- zend_hash_internal_pointer_reset(p->value.ht);
- while (zend_hash_get_current_data(p->value.ht, (void **) &element)==SUCCESS) {
- if (!(Z_TYPE_PP(element) & IS_CONSTANT_INDEX)) {
- zend_hash_move_forward(p->value.ht);
- continue;
- }
- Z_TYPE_PP(element) &= ~IS_CONSTANT_INDEX;
- if (zend_hash_get_current_key_ex(p->value.ht, &str_index, &str_index_len, &num_index, 0, NULL)!=HASH_KEY_IS_STRING) {
- zend_hash_move_forward(p->value.ht);
- continue;
- }
- if (!zend_get_constant(str_index, str_index_len-1, &const_value TSRMLS_CC)) {
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", str_index, str_index);
- zend_hash_move_forward(p->value.ht);
- continue;
- }
-
- if (const_value.type == IS_STRING && const_value.value.str.len == str_index_len-1 &&
- !strncmp(const_value.value.str.val, str_index, str_index_len)) {
- /* constant value is the same as its name */
- zval_dtor(&const_value);
- zend_hash_move_forward(p->value.ht);
- continue;
- }
-
- switch (const_value.type) {
- case IS_STRING:
- zend_hash_update(p->value.ht, const_value.value.str.val, const_value.value.str.len+1, element, sizeof(zval *), NULL);
- (*element)->refcount++;
- break;
- case IS_LONG:
- zend_hash_index_update(p->value.ht, const_value.value.lval, element, sizeof(zval *), NULL);
- (*element)->refcount++;
- break;
- }
- zend_hash_del(p->value.ht, str_index, str_index_len);
- zval_dtor(&const_value);
- }
- zend_hash_apply_with_argument(p->value.ht, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
- }
- return 0;
-}
-
-
-int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[] TSRMLS_DC)
-{
- zval ***params_array = (zval ***) emalloc(sizeof(zval **)*param_count);
- int i;
- int ex_retval;
- zval *local_retval_ptr;
-
- for (i=0; i<param_count; i++) {
- params_array[i] = &params[i];
- }
- ex_retval = call_user_function_ex(function_table, object_pp, function_name, &local_retval_ptr, param_count, params_array, 1, NULL TSRMLS_CC);
- if (local_retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*retval_ptr, local_retval_ptr);
- } else {
- INIT_ZVAL(*retval_ptr);
- }
- efree(params_array);
- return ex_retval;
-}
-
-
-int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, int param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC)
-{
- int i;
- zval **original_return_value;
- HashTable *calling_symbol_table;
- zend_function_state *original_function_state_ptr;
- zend_op_array *original_op_array;
- zend_op **original_opline_ptr;
- zval *orig_free_op1, *orig_free_op2;
- int (*orig_unary_op)(zval *result, zval *op1);
- int (*orig_binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
- zval function_name_copy;
- zend_class_entry *current_scope;
- zend_class_entry *calling_scope = NULL;
- zval *current_this;
- zend_namespace *current_namespace = EG(active_namespace);
- zend_execute_data execute_data;
-
- /* Initialize execute_data */
- EX(fbc) = NULL;
- EX(object) = NULL;
- EX(Ts) = NULL;
- EX(op_array) = NULL;
- EX(opline) = NULL;
- *retval_ptr_ptr = NULL;
-
- if (function_name->type==IS_ARRAY) { /* assume array($obj, $name) couple */
- zval **tmp_object_ptr, **tmp_real_function_name;
-
- if (zend_hash_index_find(function_name->value.ht, 0, (void **) &tmp_object_ptr)==FAILURE) {
- return FAILURE;
- }
- if (zend_hash_index_find(function_name->value.ht, 1, (void **) &tmp_real_function_name)==FAILURE) {
- return FAILURE;
- }
- function_name = *tmp_real_function_name;
- SEPARATE_ZVAL_IF_NOT_REF(tmp_object_ptr);
- object_pp = tmp_object_ptr;
- (*object_pp)->is_ref = 1;
- }
-
- if (object_pp && !*object_pp) {
- object_pp = NULL;
- }
-
- if (object_pp) {
- /* TBI!! new object handlers */
- if (Z_TYPE_PP(object_pp) == IS_OBJECT) {
- if (!IS_ZEND_STD_OBJECT(**object_pp)) {
- zend_error(E_WARNING, "Cannot use call_user_function on objects without a class entry");
- return FAILURE;
- }
-
- calling_scope = Z_OBJCE_PP(object_pp);
- function_table = &calling_scope->function_table;
- EX(object) = *object_pp;
- } else if (Z_TYPE_PP(object_pp) == IS_STRING) {
- zend_class_entry **ce;
- char *lc_class;
- int found;
-
- lc_class = estrndup(Z_STRVAL_PP(object_pp), Z_STRLEN_PP(object_pp));
- zend_str_tolower(lc_class, Z_STRLEN_PP(object_pp));
- found = zend_lookup_class(lc_class, Z_STRLEN_PP(object_pp), &ce TSRMLS_CC);
- efree(lc_class);
- if (found == FAILURE)
- return FAILURE;
-
- function_table = &(*ce)->function_table;
- calling_scope = *ce;
- object_pp = NULL;
- } else
- return FAILURE;
- }
-
- if (function_name->type!=IS_STRING) {
- return FAILURE;
- }
-
- function_name_copy = *function_name;
- zval_copy_ctor(&function_name_copy);
- zend_str_tolower(function_name_copy.value.str.val, function_name_copy.value.str.len);
-
- original_function_state_ptr = EG(function_state_ptr);
- if (zend_hash_find(function_table, function_name_copy.value.str.val, function_name_copy.value.str.len+1, (void **) &EX(function_state).function)==FAILURE) {
- zval_dtor(&function_name_copy);
- return FAILURE;
- }
- zval_dtor(&function_name_copy);
-
- for (i=0; i<param_count; i++) {
- zval *param;
-
- if (EX(function_state).function->common.arg_types
- && i<EX(function_state).function->common.arg_types[0]
- && EX(function_state).function->common.arg_types[i+1]==BYREF_FORCE
- && !PZVAL_IS_REF(*params[i])) {
- if ((*params[i])->refcount>1) {
- zval *new_zval;
-
- if (no_separation) {
- return FAILURE;
- }
- ALLOC_ZVAL(new_zval);
- *new_zval = **params[i];
- zval_copy_ctor(new_zval);
- new_zval->refcount = 1;
- (*params[i])->refcount--;
- *params[i] = new_zval;
- }
- (*params[i])->refcount++;
- (*params[i])->is_ref = 1;
- param = *params[i];
- } else if (*params[i] != &EG(uninitialized_zval)) {
- (*params[i])->refcount++;
- param = *params[i];
- } else {
- ALLOC_ZVAL(param);
- *param = **(params[i]);
- INIT_PZVAL(param);
- }
- zend_ptr_stack_push(&EG(argument_stack), param);
- }
-
- zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (long) param_count, NULL);
-
- EG(function_state_ptr) = &EX(function_state);
-
- current_scope = EG(scope);
- EG(scope) = calling_scope;
-
- current_this = EG(This);
-
- if (object_pp) {
- EG(This) = *object_pp;
-
- if (!PZVAL_IS_REF(EG(This))) {
- EG(This)->refcount++; /* For $this pointer */
- } else {
- zval *this_ptr;
-
- ALLOC_ZVAL(this_ptr);
- *this_ptr = *EG(This);
- INIT_PZVAL(this_ptr);
- zval_copy_ctor(this_ptr);
- EG(This) = this_ptr;
- }
- } else {
- EG(This) = NULL;
- }
-
- EX(prev_execute_data) = EG(current_execute_data);
- EG(current_execute_data) = &execute_data;
-
- if (EX(function_state).function->type == ZEND_USER_FUNCTION) {
- calling_symbol_table = EG(active_symbol_table);
- if (symbol_table) {
- EG(active_symbol_table) = symbol_table;
- } else {
- ALLOC_HASHTABLE(EG(active_symbol_table));
- zend_hash_init(EG(active_symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0);
- }
-
- original_return_value = EG(return_value_ptr_ptr);
- original_op_array = EG(active_op_array);
- EG(return_value_ptr_ptr) = retval_ptr_ptr;
- EG(active_op_array) = (zend_op_array *) EX(function_state).function;
- original_opline_ptr = EG(opline_ptr);
- orig_free_op1 = EG(free_op1);
- orig_free_op2 = EG(free_op2);
- orig_unary_op = EG(unary_op);
- orig_binary_op = EG(binary_op);
- zend_execute(EG(active_op_array) TSRMLS_CC);
- if (!symbol_table) {
- zend_hash_destroy(EG(active_symbol_table));
- FREE_HASHTABLE(EG(active_symbol_table));
- }
- EG(active_symbol_table) = calling_symbol_table;
- EG(active_op_array) = original_op_array;
- EG(return_value_ptr_ptr)=original_return_value;
- EG(opline_ptr) = original_opline_ptr;
- EG(free_op1) = orig_free_op1;
- EG(free_op2) = orig_free_op2;
- EG(unary_op) = orig_unary_op;
- EG(binary_op) = orig_binary_op;
- } else {
- ALLOC_INIT_ZVAL(*retval_ptr_ptr);
- ((zend_internal_function *) EX(function_state).function)->handler(param_count, *retval_ptr_ptr, (object_pp?*object_pp:NULL), 1 TSRMLS_CC);
- INIT_PZVAL(*retval_ptr_ptr);
- }
- zend_ptr_stack_clear_multiple(TSRMLS_C);
- EG(function_state_ptr) = original_function_state_ptr;
- EG(active_namespace) = current_namespace;
-
- if (EG(This)) {
- zval_ptr_dtor(&EG(This));
- }
- EG(scope) = current_scope;
- EG(This) = current_this;
- EG(current_execute_data) = EX(prev_execute_data); \
-
- return SUCCESS;
-}
-
-ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
-{
- zval **args[1];
- zval *autoload_function;
- zval *class_name;
- zval *retval_ptr;
- int retval;
-
- if (zend_hash_find(EG(class_table), name, name_length+1, (void **) ce) == SUCCESS) {
- return SUCCESS;
- }
-
- MAKE_STD_ZVAL(autoload_function);
- ZVAL_STRINGL(autoload_function, "__autoload", sizeof("__autoload")-1, 1);
-
- MAKE_STD_ZVAL(class_name);
- ZVAL_STRINGL(class_name, name, name_length, 1);
- args[0] = &class_name;
-
- retval = call_user_function_ex(EG(function_table), NULL, autoload_function, &retval_ptr, 1, args, 0, NULL TSRMLS_CC);
-
- zval_ptr_dtor(&autoload_function);
- zval_ptr_dtor(&class_name);
-
- if (retval == FAILURE) {
- return FAILURE;
- }
-
- if (EG(exception)) {
- zend_error(E_ERROR, "__autoload threw an exception");
- }
-
- /* If an exception is thrown retval_ptr will be NULL but we bailout before we reach this point */
- zval_ptr_dtor(&retval_ptr);
-
- return zend_hash_find(EG(class_table), name, name_length + 1, (void **) ce);
-}
-
-ZEND_API int zend_lookup_ns_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
-{
- char *ns_name;
- char *class_name;
- char *name_end = name + name_length;
- int ns_name_length;
- zend_namespace **ns;
-
- /* handle simple class name case */
- if ((class_name = zend_memnstr(name, "::", sizeof("::")-1, name_end)) == NULL) {
- return zend_lookup_class(name, name_length, ce TSRMLS_CC);
- }
- /* handle ::C case */
- if (class_name == name) {
- return zend_lookup_class(name + sizeof("::")-1, name_length - sizeof("::")+1, ce TSRMLS_CC);
- }
-
- ns_name_length = class_name - name;
- class_name += sizeof("::")-1;
- if (class_name == name_end) {
- return FAILURE;
- }
- ns_name = zend_strndup(name, ns_name_length);
-
- if (zend_hash_find(&EG(global_namespace_ptr)->class_table, ns_name, ns_name_length+1, (void **)&ns) == SUCCESS && CLASS_IS_NAMESPACE(*ns) &&
- zend_hash_find(&(*ns)->class_table, class_name, name_end - class_name + 1, (void **)ce) == SUCCESS) {
- free(ns_name);
- return SUCCESS;
- }
-
- free(ns_name);
- return FAILURE;
-}
-
-ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC)
-{
- zval pv;
- zend_op_array *new_op_array;
- zend_op_array *original_active_op_array = EG(active_op_array);
- zend_function_state *original_function_state_ptr = EG(function_state_ptr);
- zend_uchar original_handle_op_arrays;
- int retval;
-
- if (retval_ptr) {
- pv.value.str.len = strlen(str)+sizeof("return ;")-1;
- pv.value.str.val = emalloc(pv.value.str.len+1);
- strcpy(pv.value.str.val, "return ");
- strcat(pv.value.str.val, str);
- strcat(pv.value.str.val, " ;");
- } else {
- pv.value.str.len = strlen(str);
- pv.value.str.val = estrndup(str, pv.value.str.len);
- }
- pv.type = IS_STRING;
-
- /*printf("Evaluating '%s'\n", pv.value.str.val);*/
-
- original_handle_op_arrays = CG(handle_op_arrays);
- CG(handle_op_arrays) = 0;
- new_op_array = compile_string(&pv, string_name TSRMLS_CC);
- CG(handle_op_arrays) = original_handle_op_arrays;
-
- if (new_op_array) {
- zval *local_retval_ptr=NULL;
- zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr);
- zend_op **original_opline_ptr = EG(opline_ptr);
-
- EG(return_value_ptr_ptr) = &local_retval_ptr;
- EG(active_op_array) = new_op_array;
- EG(no_extensions)=1;
-
- zend_execute(new_op_array TSRMLS_CC);
-
- if (local_retval_ptr) {
- if (retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*retval_ptr, local_retval_ptr);
- } else {
- zval_ptr_dtor(&local_retval_ptr);
- }
- } else {
- if (retval_ptr) {
- INIT_ZVAL(*retval_ptr);
- }
- }
-
- EG(no_extensions)=0;
- EG(opline_ptr) = original_opline_ptr;
- EG(active_op_array) = original_active_op_array;
- EG(function_state_ptr) = original_function_state_ptr;
- destroy_op_array(new_op_array TSRMLS_CC);
- efree(new_op_array);
- EG(return_value_ptr_ptr) = original_return_value_ptr_ptr;
- retval = SUCCESS;
- } else {
- retval = FAILURE;
- }
- zval_dtor(&pv);
- return retval;
-}
-
-
-void execute_new_code(TSRMLS_D)
-{
- zend_op *opline, *end;
- zend_op *ret_opline;
- zval *local_retval=NULL;
-
- if (!CG(interactive)
- || CG(active_op_array)->backpatch_count>0
- || CG(active_op_array)->function_name
- || CG(active_op_array)->type!=ZEND_USER_FUNCTION) {
- return;
- }
-
- ret_opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- ret_opline->opcode = ZEND_RETURN;
- ret_opline->op1.op_type = IS_CONST;
- INIT_ZVAL(ret_opline->op1.u.constant);
- SET_UNUSED(ret_opline->op2);
-
- if (!CG(active_op_array)->start_op) {
- CG(active_op_array)->start_op = CG(active_op_array)->opcodes;
- }
-
- opline=CG(active_op_array)->start_op;
- end=CG(active_op_array)->opcodes+CG(active_op_array)->last;
-
- while (opline<end) {
- if (opline->op1.op_type==IS_CONST) {
- opline->op1.u.constant.is_ref = 1;
- opline->op1.u.constant.refcount = 2; /* Make sure is_ref won't be reset */
- }
- if (opline->op2.op_type==IS_CONST) {
- opline->op2.u.constant.is_ref = 1;
- opline->op2.u.constant.refcount = 2;
- }
- opline++;
- }
-
- EG(return_value_ptr_ptr) = &local_retval;
- EG(active_op_array) = CG(active_op_array);
- zend_execute(CG(active_op_array) TSRMLS_CC);
- if (local_retval) {
- zval_ptr_dtor(&local_retval);
- }
-
- CG(active_op_array)->last--; /* get rid of that ZEND_RETURN */
- CG(active_op_array)->start_op = CG(active_op_array)->opcodes+CG(active_op_array)->last;
-}
-
-
-ZEND_API void zend_timeout(int dummy)
-{
- TSRMLS_FETCH();
-
- if (zend_on_timeout) {
- zend_on_timeout(EG(timeout_seconds) TSRMLS_CC);
- }
-
- zend_error(E_ERROR, "Maximum execution time of %d second%s exceeded",
- EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s");
-}
-
-
-#ifdef ZEND_WIN32
-static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch (message) {
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
- case WM_REGISTER_ZEND_TIMEOUT:
- /* wParam is the thread id pointer, lParam is the timeout amount in seconds */
- if (lParam==0) {
- KillTimer(timeout_window, wParam);
- } else {
- SetTimer(timeout_window, wParam, lParam*1000, NULL);
- }
- break;
- case WM_UNREGISTER_ZEND_TIMEOUT:
- /* wParam is the thread id pointer */
- KillTimer(timeout_window, wParam);
- break;
- case WM_TIMER: {
-#ifdef ZTS
- void ***tsrm_ls;
-
- tsrm_ls = ts_resource_ex(0, &wParam);
- if (!tsrm_ls) {
- /* Thread died before receiving its timeout? */
- break;
- }
-#endif
- KillTimer(timeout_window, wParam);
- EG(timed_out) = 1;
- }
- break;
- default:
- return DefWindowProc(hWnd, message, wParam, lParam);
- }
- return 0;
-}
-
-
-
-static unsigned __stdcall timeout_thread_proc(void *pArgs)
-{
- MSG message;
-
- wc.style=0;
- wc.lpfnWndProc = zend_timeout_WndProc;
- wc.cbClsExtra=0;
- wc.cbWndExtra=0;
- wc.hInstance=NULL;
- wc.hIcon=NULL;
- wc.hCursor=NULL;
- wc.hbrBackground=(HBRUSH)(COLOR_BACKGROUND + 5);
- wc.lpszMenuName=NULL;
- wc.lpszClassName = "Zend Timeout Window";
- if (!RegisterClass(&wc)) {
- return -1;
- }
- timeout_window = CreateWindow(wc.lpszClassName, wc.lpszClassName, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL);
- SetEvent(timeout_thread_event);
- while (GetMessage(&message, NULL, 0, 0)) {
- SendMessage(timeout_window, message.message, message.wParam, message.lParam);
- if (message.message == WM_QUIT) {
- break;
- }
- }
- DestroyWindow(timeout_window);
- UnregisterClass(wc.lpszClassName, NULL);
- return 0;
-}
-
-
-void zend_init_timeout_thread()
-{
- timeout_thread_event = CreateEvent(NULL, FALSE, FALSE, NULL);
- _beginthreadex(NULL, 0, timeout_thread_proc, NULL, 0, &timeout_thread_id);
- WaitForSingleObject(timeout_thread_event, INFINITE);
-}
-
-
-void zend_shutdown_timeout_thread()
-{
- if (!timeout_thread_initialized) {
- return;
- }
- PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0);
-}
-
-#endif
-
-/* This one doesn't exists on QNX */
-#ifndef SIGPROF
-#define SIGPROF 27
-#endif
-
-void zend_set_timeout(long seconds)
-{
- TSRMLS_FETCH();
-
- EG(timeout_seconds) = seconds;
-#ifdef ZEND_WIN32
- if (timeout_thread_initialized==0 && InterlockedIncrement(&timeout_thread_initialized)==1) {
- /* We start up this process-wide thread here and not in zend_startup(), because if Zend
- * is initialized inside a DllMain(), you're not supposed to start threads from it.
- */
- zend_init_timeout_thread();
- }
- PostThreadMessage(timeout_thread_id, WM_REGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) seconds);
-#else
-# ifdef HAVE_SETITIMER
- {
- struct itimerval t_r; /* timeout requested */
- sigset_t sigset;
-
- t_r.it_value.tv_sec = seconds;
- t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0;
-
- setitimer(ITIMER_PROF, &t_r, NULL);
- signal(SIGPROF, zend_timeout);
- sigemptyset(&sigset);
- sigaddset(&sigset, SIGPROF);
- sigprocmask(SIG_UNBLOCK, &sigset, NULL);
- }
-# endif
-#endif
-}
-
-
-void zend_unset_timeout(TSRMLS_D)
-{
-#ifdef ZEND_WIN32
- PostThreadMessage(timeout_thread_id, WM_UNREGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) 0);
-#else
-# ifdef HAVE_SETITIMER
- {
- struct itimerval no_timeout;
-
- no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0;
-
- setitimer(ITIMER_PROF, &no_timeout, NULL);
- }
-# endif
-#endif
-}
-
-void zend_switch_namespace(zend_namespace *ns TSRMLS_DC)
-{
- if(NULL == ns) {
- return;
- }
- EG(active_namespace) = ns;
- EG(function_table) = &ns->function_table;
- EG(class_table) = &ns->class_table;
-/* EG(zend_constants) = &ns->constants_table; */
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_execute_locks.h b/Zend/zend_execute_locks.h
deleted file mode 100644
index b2fcbc83a4..0000000000
--- a/Zend/zend_execute_locks.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_EXECUTE_LOCKS_H
-#define ZEND_EXECUTE_LOCKS_H
-
-#define PZVAL_LOCK(z) zend_pzval_lock_func(z)
-
-static inline void zend_pzval_lock_func(zval *z)
-{
- z->refcount++;
-}
-
-#define PZVAL_UNLOCK(z) zend_pzval_unlock_func(z TSRMLS_CC)
-
-static inline void zend_pzval_unlock_func(zval *z TSRMLS_DC)
-{
- z->refcount--;
- if (!z->refcount) {
- z->refcount = 1;
- z->is_ref = 0;
- EG(garbage)[EG(garbage_ptr)++] = z;
- }
-}
-
-static inline void zend_clean_garbage(TSRMLS_D)
-{
- while (EG(garbage_ptr)) {
- zval_ptr_dtor(&EG(garbage)[--EG(garbage_ptr)]);
- }
-}
-
-#define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); }
-
-#endif /* ZEND_EXECUTE_LOCKS_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c
deleted file mode 100644
index a1372dff2c..0000000000
--- a/Zend/zend_extensions.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend_extensions.h"
-
-ZEND_API zend_llist zend_extensions;
-static int last_resource_number;
-
-int zend_load_extension(char *path)
-{
-#if ZEND_EXTENSIONS_SUPPORT
- DL_HANDLE handle;
- zend_extension *new_extension;
- zend_extension_version_info *extension_version_info;
-
- handle = DL_LOAD(path);
- if (!handle) {
-#ifndef ZEND_WIN32
- fprintf(stderr, "Failed loading %s: %s\n", path, DL_ERROR());
-#else
- fprintf(stderr, "Failed loading %s\n", path);
-#endif
- return FAILURE;
- }
-
- extension_version_info = (zend_extension_version_info *) DL_FETCH_SYMBOL(handle, "extension_version_info");
- if (!extension_version_info) {
- extension_version_info = (zend_extension_version_info *) DL_FETCH_SYMBOL(handle, "_extension_version_info");
- }
- new_extension = (zend_extension *) DL_FETCH_SYMBOL(handle, "zend_extension_entry");
- if (!new_extension) {
- new_extension = (zend_extension *) DL_FETCH_SYMBOL(handle, "_zend_extension_entry");
- }
- if (!extension_version_info || !new_extension) {
- fprintf(stderr, "%s doesn't appear to be a valid Zend extension\n", path);
- DL_UNLOAD(handle);
- return FAILURE;
- }
-
-
- /* allow extension to proclaim compatibility with any Zend version */
- if (extension_version_info->zend_extension_api_no != ZEND_EXTENSION_API_NO &&(!new_extension->api_no_check || new_extension->api_no_check(ZEND_EXTENSION_API_NO) != SUCCESS)) {
- if (extension_version_info->zend_extension_api_no > ZEND_EXTENSION_API_NO) {
- fprintf(stderr, "%s requires Zend Engine API version %d.\n"
- "The Zend Engine API version %d which is installed, is outdated.\n\n",
- new_extension->name,
- extension_version_info->zend_extension_api_no,
- ZEND_EXTENSION_API_NO);
- DL_UNLOAD(handle);
- return FAILURE;
- } else if (extension_version_info->zend_extension_api_no < ZEND_EXTENSION_API_NO) {
- fprintf(stderr, "%s requires Zend Engine API version %d.\n"
- "The Zend Engine API version %d which is installed, is newer.\n"
- "Contact %s at %s for a later version of %s.\n\n",
- new_extension->name,
- extension_version_info->zend_extension_api_no,
- ZEND_EXTENSION_API_NO,
- new_extension->author,
- new_extension->URL,
- new_extension->name);
- DL_UNLOAD(handle);
- return FAILURE;
- }
- } else if (ZTS_V!=extension_version_info->thread_safe) {
- fprintf(stderr, "Cannot load %s - it %s thread safe, whereas Zend %s\n",
- new_extension->name,
- (extension_version_info->thread_safe?"is":"isn't"),
- (ZTS_V?"is":"isn't"));
- DL_UNLOAD(handle);
- return FAILURE;
- } else if (ZEND_DEBUG!=extension_version_info->debug) {
- fprintf(stderr, "Cannot load %s - it %s debug information, whereas Zend %s\n",
- new_extension->name,
- (extension_version_info->debug?"contains":"does not contain"),
- (ZEND_DEBUG?"does":"does not"));
- DL_UNLOAD(handle);
- return FAILURE;
- }
-
- return zend_register_extension(new_extension, handle);
-#else
- fprintf(stderr, "Extensions are not supported on this platform.\n");
- return FAILURE;
-#endif
-}
-
-
-int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle)
-{
-#if ZEND_EXTENSIONS_SUPPORT
- zend_extension extension;
-
- extension = *new_extension;
- extension.handle = handle;
-
- zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension);
-
- zend_llist_add_element(&zend_extensions, &extension);
-
- /*fprintf(stderr, "Loaded %s, version %s\n", extension.name, extension.version);*/
-#endif
-
- return SUCCESS;
-}
-
-
-static void zend_extension_shutdown(zend_extension *extension TSRMLS_DC)
-{
-#if ZEND_EXTENSIONS_SUPPORT
- if (extension->shutdown) {
- extension->shutdown(extension);
- }
-#endif
-}
-
-static int zend_extension_startup(zend_extension *extension)
-{
-#if ZEND_EXTENSIONS_SUPPORT
- if (extension->startup) {
- if (extension->startup(extension)!=SUCCESS) {
- return 1;
- }
- zend_append_version_info(extension);
- }
-#endif
- return 0;
-}
-
-
-int zend_startup_extensions_mechanism()
-{
- /* Startup extensions mechanism */
- zend_llist_init(&zend_extensions, sizeof(zend_extension), (void (*)(void *)) zend_extension_dtor, 1);
- last_resource_number = 0;
- return SUCCESS;
-}
-
-
-int zend_startup_extensions()
-{
- zend_llist_apply_with_del(&zend_extensions, (int (*)(void *)) zend_extension_startup);
- return SUCCESS;
-}
-
-
-void zend_shutdown_extensions(TSRMLS_D)
-{
- zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_shutdown TSRMLS_CC);
- zend_llist_destroy(&zend_extensions);
-}
-
-
-void zend_extension_dtor(zend_extension *extension)
-{
-#if ZEND_EXTENSIONS_SUPPORT && !ZEND_DEBUG
- if (extension->handle) {
- DL_UNLOAD(extension->handle);
- }
-#endif
-}
-
-
-static void zend_extension_message_dispatcher(zend_extension *extension, int num_args, va_list args TSRMLS_DC)
-{
- int message;
- void *arg;
-
- if (!extension->message_handler || num_args!=2) {
- return;
- }
- message = va_arg(args, int);
- arg = va_arg(args, void *);
- extension->message_handler(message, arg);
-}
-
-
-ZEND_API void zend_extension_dispatch_message(int message, void *arg)
-{
- TSRMLS_FETCH();
-
- zend_llist_apply_with_arguments(&zend_extensions, (llist_apply_with_args_func_t) zend_extension_message_dispatcher TSRMLS_CC, 2, message, arg);
-}
-
-
-ZEND_API int zend_get_resource_handle(zend_extension *extension)
-{
- if (last_resource_number<ZEND_MAX_RESERVED_RESOURCES) {
- extension->resource_number = last_resource_number;
- return last_resource_number++;
- } else {
- return -1;
- }
-}
-
-
-ZEND_API zend_extension *zend_get_extension(char *extension_name)
-{
- zend_llist_element *element;
-
- for (element = zend_extensions.head; element; element = element->next) {
- zend_extension *extension = (zend_extension *) element->data;
-
- if (!strcmp(extension->name, extension_name)) {
- return extension;
- }
- }
- return NULL;
-}
-
-/*
- * Support for dynamic loading of MH_BUNDLEs on Darwin / Mac OS X
- *
- */
-
-#if HAVE_MACH_O_DYLD_H
-
-void *zend_mh_bundle_load(char* bundle_path)
-{
- NSObjectFileImage bundle_image;
- NSModule bundle_handle;
- NSSymbol bundle_init_nssymbol;
- void (*bundle_init)(void);
-
- if (NSCreateObjectFileImageFromFile(bundle_path, &bundle_image) != NSObjectFileImageSuccess) {
- return NULL;
- }
-
- bundle_handle = NSLinkModule(bundle_image, bundle_path, NSLINKMODULE_OPTION_PRIVATE);
- NSDestroyObjectFileImage(bundle_image);
-
- /* call the init function of the bundle */
- bundle_init_nssymbol = NSLookupSymbolInModule(bundle_handle, "__init");
- if (bundle_init_nssymbol != NULL) {
- bundle_init = NSAddressOfSymbol(bundle_init_nssymbol);
- bundle_init();
- }
-
- return bundle_handle;
-}
-
-int zend_mh_bundle_unload(void *bundle_handle)
-{
- NSSymbol bundle_fini_nssymbol;
- void (*bundle_fini)(void);
-
- /* call the fini function of the bundle */
- bundle_fini_nssymbol = NSLookupSymbolInModule(bundle_handle, "__fini");
- if (bundle_fini_nssymbol != NULL) {
- bundle_fini = NSAddressOfSymbol(bundle_fini_nssymbol);
- bundle_fini();
- }
-
- return (int) NSUnLinkModule(bundle_handle, NULL);
-}
-
-void *zend_mh_bundle_symbol(void *bundle_handle, const char *symbol_name)
-{
- NSSymbol symbol;
- symbol = NSLookupSymbolInModule(bundle_handle, symbol_name);
- return NSAddressOfSymbol(symbol);
-}
-
-const char *zend_mh_bundle_error(void)
-{
- /* Witness the state of the art error reporting */
- return NULL;
-}
-
-#endif /* HAVE_MACH_O_DYLD_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h
deleted file mode 100644
index dc9f3acf7b..0000000000
--- a/Zend/zend_extensions.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_EXTENSIONS_H
-#define ZEND_EXTENSIONS_H
-
-#include "zend_compile.h"
-
-#define ZEND_EXTENSION_API_NO 90021012
-
-typedef struct _zend_extension_version_info {
- int zend_extension_api_no;
- char *required_zend_version;
- unsigned char thread_safe;
- unsigned char debug;
-} zend_extension_version_info;
-
-
-typedef struct _zend_extension zend_extension;
-
-/* Typedef's for zend_extension function pointers */
-typedef int (*startup_func_t)(zend_extension *extension);
-typedef void (*shutdown_func_t)(zend_extension *extension);
-typedef void (*activate_func_t)(void);
-typedef void (*deactivate_func_t)(void);
-
-typedef void (*message_handler_func_t)(int message, void *arg);
-
-typedef void (*op_array_handler_func_t)(zend_op_array *op_array);
-
-typedef void (*statement_handler_func_t)(zend_op_array *op_array);
-typedef void (*fcall_begin_handler_func_t)(zend_op_array *op_array);
-typedef void (*fcall_end_handler_func_t)(zend_op_array *op_array);
-
-typedef void (*op_array_ctor_func_t)(zend_op_array *op_array);
-typedef void (*op_array_dtor_func_t)(zend_op_array *op_array);
-
-struct _zend_extension {
- char *name;
- char *version;
- char *author;
- char *URL;
- char *copyright;
-
- startup_func_t startup;
- shutdown_func_t shutdown;
- activate_func_t activate;
- deactivate_func_t deactivate;
-
- message_handler_func_t message_handler;
-
- op_array_handler_func_t op_array_handler;
-
- statement_handler_func_t statement_handler;
- fcall_begin_handler_func_t fcall_begin_handler;
- fcall_end_handler_func_t fcall_end_handler;
-
- op_array_ctor_func_t op_array_ctor;
- op_array_dtor_func_t op_array_dtor;
-
- int (*api_no_check)(int api_no);
- void *reserved2;
- void *reserved3;
- void *reserved4;
- void *reserved5;
- void *reserved6;
- void *reserved7;
- void *reserved8;
-
- DL_HANDLE handle;
- int resource_number;
-};
-
-
-ZEND_API int zend_get_resource_handle(zend_extension *extension);
-ZEND_API void zend_extension_dispatch_message(int message, void *arg);
-
-#define ZEND_EXTMSG_NEW_EXTENSION 1
-
-
-#define ZEND_EXTENSION() \
- ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, ZEND_VERSION, ZTS_V, ZEND_DEBUG }
-
-#define STANDARD_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
-#define COMPAT_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
-
-
-ZEND_API extern zend_llist zend_extensions;
-
-void zend_extension_dtor(zend_extension *extension);
-ZEND_API int zend_load_extension(char *path);
-ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle);
-void zend_append_version_info(zend_extension *extension);
-int zend_startup_extensions_mechanism(void);
-int zend_startup_extensions(void);
-void zend_shutdown_extensions(TSRMLS_D);
-ZEND_API zend_extension *zend_get_extension(char *extension_name);
-
-#endif /* ZEND_EXTENSIONS_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_fast_cache.h b/Zend/zend_fast_cache.h
deleted file mode 100644
index 16d3213ac2..0000000000
--- a/Zend/zend_fast_cache.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_FAST_CACHE_H
-#define ZEND_FAST_CACHE_H
-
-#ifndef ZEND_ENABLE_FAST_CACHE
-# if ZEND_DEBUG
-# define ZEND_ENABLE_FAST_CACHE 0
-# else
-# define ZEND_ENABLE_FAST_CACHE 0
-# endif
-#endif
-
-typedef struct _zend_fast_cache_list_entry {
- struct _zend_fast_cache_list_entry *next;
-} zend_fast_cache_list_entry;
-
-#define MAX_FAST_CACHE_TYPES 4
-
-
-#define ZVAL_CACHE_LIST 0
-#define HASHTABLE_CACHE_LIST 1
-
-#if ZEND_ENABLE_FAST_CACHE
-
-
-#include "zend_globals.h"
-#include "zend_globals_macros.h"
-#include "zend_alloc.h"
-
-
-#if ZEND_DEBUG
-# define RECORD_ZVAL_CACHE_HIT(fc_type) AG(fast_cache_stats)[fc_type][1]++;
-# define RECORD_ZVAL_CACHE_MISS(fc_type) AG(fast_cache_stats)[fc_type][0]++;
-#else
-# define RECORD_ZVAL_CACHE_HIT(fc_type)
-# define RECORD_ZVAL_CACHE_MISS(fc_type)
-#endif
-
-
-#define ZEND_FAST_ALLOC(p, type, fc_type) \
- { \
- TSRMLS_FETCH(); \
- \
- if (((p) = (type *) AG(fast_cache_list_head)[fc_type])) { \
- AG(fast_cache_list_head)[fc_type] = ((zend_fast_cache_list_entry *) AG(fast_cache_list_head)[fc_type])->next; \
- RECORD_ZVAL_CACHE_HIT(fc_type); \
- } else { \
- (p) = (type *) emalloc(sizeof(type)); \
- RECORD_ZVAL_CACHE_MISS(fc_type); \
- } \
- }
-
-
-#define ZEND_FAST_FREE(p, fc_type) \
- { \
- TSRMLS_FETCH(); \
- \
- ((zend_fast_cache_list_entry *) (p))->next = (zend_fast_cache_list_entry *) AG(fast_cache_list_head)[fc_type]; \
- AG(fast_cache_list_head)[fc_type] = (zend_fast_cache_list_entry *) (p); \
- }
-
-#define ZEND_FAST_ALLOC_REL(p, type, fc_type) \
- ZEND_FAST_ALLOC(p, type, fc_type)
-
-#define ZEND_FAST_FREE_REL(p, fc_type) \
- ZEND_FAST_FREE(p, fc_type)
-
-
-#else /* !ZEND_ENABLE_FAST_CACHE */
-
-#define ZEND_FAST_ALLOC(p, type, fc_type) \
- (p) = (type *) emalloc(sizeof(type))
-
-#define ZEND_FAST_FREE(p, fc_type) \
- efree(p)
-
-#define ZEND_FAST_ALLOC_REL(p, type, fc_type) \
- (p) = (type *) emalloc_rel(sizeof(type))
-
-#define ZEND_FAST_FREE_REL(p, fc_type) \
- efree_rel(p)
-
-#endif /* ZEND_ENABLE_FAST_CACHE */
-
-
-
-
-/* fast cache for zval's */
-#define ALLOC_ZVAL(z) \
- ZEND_FAST_ALLOC(z, zval, ZVAL_CACHE_LIST)
-
-#define FREE_ZVAL(z) \
- ZEND_FAST_FREE(z, ZVAL_CACHE_LIST)
-
-#define ALLOC_ZVAL_REL(z) \
- ZEND_FAST_ALLOC_REL(z, zval, ZVAL_CACHE_LIST)
-
-#define FREE_ZVAL_REL(z) \
- ZEND_FAST_FREE_REL(z, ZVAL_CACHE_LIST)
-
-/* fast cache for HashTables */
-#define ALLOC_HASHTABLE(ht) \
- ZEND_FAST_ALLOC(ht, HashTable, HASHTABLE_CACHE_LIST)
-
-#define FREE_HASHTABLE(ht) \
- ZEND_FAST_FREE(ht, HASHTABLE_CACHE_LIST)
-
-#define ALLOC_HASHTABLE_REL(ht) \
- ZEND_FAST_ALLOC_REL(ht, HashTable, HASHTABLE_CACHE_LIST)
-
-#define FREE_HASHTABLE_REL(ht) \
- ZEND_FAST_FREE_REL(ht, HASHTABLE_CACHE_LIST)
-
-#endif /* ZEND_FAST_CACHE_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
deleted file mode 100644
index 39bb83c8e9..0000000000
--- a/Zend/zend_globals.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_GLOBALS_H
-#define ZEND_GLOBALS_H
-
-
-#include <setjmp.h>
-
-#include "zend_globals_macros.h"
-
-#include "zend_stack.h"
-#include "zend_ptr_stack.h"
-#include "zend_hash.h"
-#include "zend_llist.h"
-#include "zend_fast_cache.h"
-#include "zend_objects.h"
-#include "zend_objects_API.h"
-
-/* Define ZTS if you want a thread-safe Zend */
-/*#undef ZTS*/
-
-#ifdef ZTS
-
-BEGIN_EXTERN_C()
-ZEND_API extern int compiler_globals_id;
-ZEND_API extern int executor_globals_id;
-ZEND_API extern int alloc_globals_id;
-END_EXTERN_C()
-
-#endif
-
-#define SYMTABLE_CACHE_SIZE 32
-
-
-#include "zend_compile.h"
-
-/* excpt.h on Digital Unix 4.0 defines function_table */
-#undef function_table
-
-
-typedef struct _zend_declarables {
- zval ticks;
-} zend_declarables;
-
-
-struct _zend_compiler_globals {
- zend_stack bp_stack;
- zend_stack switch_cond_stack;
- zend_stack foreach_copy_stack;
- zend_stack object_stack;
- zend_stack declare_stack;
-
- zend_class_entry *active_class_entry;
- zend_namespace *active_namespace;
-
- /* variables for list() compilation */
- zend_llist list_llist;
- zend_llist dimension_llist;
- zend_stack list_stack;
-
- zend_stack function_call_stack;
-
- char *compiled_filename;
-
- int zend_lineno;
- int comment_start_line;
- char *heredoc;
- int heredoc_len;
-
- zend_op_array *active_op_array;
-
- zend_namespace global_namespace;
-
- HashTable *function_table; /* function symbol table */
- HashTable *class_table; /* class table */
- HashTable namespace_table; /* namespaces */
-
- HashTable filenames_table;
-
- HashTable *auto_globals;
-
- zend_bool in_compilation;
- zend_bool short_tags;
- zend_bool asp_tags;
- zend_bool allow_call_time_pass_reference;
-
- zend_declarables declarables;
-
- /* For extensions support */
- zend_bool extended_info; /* generate extension information for debugger/profiler */
- zend_bool handle_op_arrays; /* run op_arrays through op_array handlers */
-
- zend_bool unclean_shutdown;
-
- zend_bool ini_parser_unbuffered_errors;
-
- zend_llist open_files;
-
- zend_llist *throw_list;
- long catch_begin;
-
- struct _zend_ini_parser_param *ini_parser_param;
-
- int interactive;
-
- zend_uint start_lineno;
- zend_bool in_clone_method;
- zend_bool increment_lineno;
-
- zend_llist import_commands;
- znode implementing_class;
-
- zend_uint access_type;
-
- char *doc_comment;
- zend_uint doc_comment_len;
-};
-
-
-struct _zend_executor_globals {
- zval **return_value_ptr_ptr;
-
- zval uninitialized_zval;
- zval *uninitialized_zval_ptr;
-
- zval error_zval;
- zval *error_zval_ptr;
-
- zend_function_state *function_state_ptr;
- zend_ptr_stack arg_types_stack;
-
- /* symbol table cache */
- HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
- HashTable **symtable_cache_limit;
- HashTable **symtable_cache_ptr;
-
- zend_op **opline_ptr;
-
- HashTable *active_symbol_table;
- HashTable symbol_table; /* main symbol table */
-
- HashTable included_files; /* files already included */
-
- jmp_buf bailout;
-
- int error_reporting;
- int orig_error_reporting;
- int exit_status;
-
- zend_op_array *active_op_array;
-
- HashTable *function_table; /* function symbol table */
- HashTable *class_table; /* class table */
- HashTable *zend_constants; /* constants table */
-
- zend_class_entry *scope;
- zend_namespace *global_namespace_ptr;
- zend_namespace *active_namespace;
-
- zval *This;
-
- long precision;
-
- int ticks_count;
-
- zend_bool in_execution;
- zend_bool bailout_set;
- zend_bool full_tables_cleanup;
- zend_bool implicit_clone;
-
- /* for extended information support */
- zend_bool no_extensions;
-
-#ifdef ZEND_WIN32
- zend_bool timed_out;
-#endif
-
- HashTable regular_list;
- HashTable persistent_list;
-
- zend_ptr_stack argument_stack;
- zval *free_op1, *free_op2;
- int (*unary_op)(zval *result, zval *op1);
- int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-
- zval *garbage[2];
- int garbage_ptr;
-
- zval *user_error_handler;
- zval *user_exception_handler;
- zend_ptr_stack user_error_handlers;
- zend_ptr_stack user_exception_handlers;
-
- /* timeout support */
- int timeout_seconds;
-
- int lambda_count;
-
- HashTable *ini_directives;
- zend_objects_store objects_store;
- zval *exception;
-
- struct _zend_execute_data *current_execute_data;
-
- zend_property_info std_property_info;
-
- /* locale stuff */
- char float_separator[1];
-
- void *reserved[ZEND_MAX_RESERVED_RESOURCES];
-};
-
-#include "zend_mm.h"
-
-struct _zend_alloc_globals {
- zend_mem_header *head; /* standard list */
- void *cache[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES];
- unsigned int cache_count[MAX_CACHED_MEMORY];
- void *fast_cache_list_head[MAX_FAST_CACHE_TYPES];
-
-#ifdef ZEND_WIN32
- HANDLE memory_heap;
-#endif
-
-#if ZEND_DEBUG
- /* for performance tuning */
- int cache_stats[MAX_CACHED_MEMORY][2];
- int fast_cache_stats[MAX_FAST_CACHE_TYPES][2];
-#endif
-#if MEMORY_LIMIT
- unsigned int memory_limit;
- unsigned int allocated_memory;
- unsigned int allocated_memory_peak;
- unsigned char memory_exhausted;
-#endif
-#ifdef ZEND_MM
- zend_mm_heap mm_heap;
-#endif
-};
-
-struct _zend_scanner_globals {
- zend_file_handle *yy_in;
- zend_file_handle *yy_out;
- int yy_leng;
- char *yy_text;
- struct yy_buffer_state *current_buffer;
- char *c_buf_p;
- int init;
- int start;
- int lineno;
- char _yy_hold_char;
- int yy_n_chars;
- int _yy_did_buffer_switch_on_eof;
- int _yy_last_accepting_state; /* Must be of the same type as yy_state_type,
- * if for whatever reason it's no longer int!
- */
- char *_yy_last_accepting_cpos;
- int _yy_more_flag;
- int _yy_more_len;
- int yy_start_stack_ptr;
- int yy_start_stack_depth;
- int *yy_start_stack;
-};
-
-#endif /* ZEND_GLOBALS_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_globals_macros.h b/Zend/zend_globals_macros.h
deleted file mode 100644
index c9d65274ec..0000000000
--- a/Zend/zend_globals_macros.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_GLOBALS_MACROS_H
-#define ZEND_GLOBALS_MACROS_H
-
-typedef struct _zend_compiler_globals zend_compiler_globals;
-typedef struct _zend_executor_globals zend_executor_globals;
-typedef struct _zend_alloc_globals zend_alloc_globals;
-typedef struct _zend_scanner_globals zend_scanner_globals;
-
-/* Compiler */
-#ifdef ZTS
-# define CG(v) TSRMG(compiler_globals_id, zend_compiler_globals *, v)
-BEGIN_EXTERN_C()
-int zendparse(void *compiler_globals);
-END_EXTERN_C()
-#else
-# define CG(v) (compiler_globals.v)
-extern ZEND_API struct _zend_compiler_globals compiler_globals;
-int zendparse(void);
-#endif
-
-
-/* Executor */
-#ifdef ZTS
-# define EG(v) TSRMG(executor_globals_id, zend_executor_globals *, v)
-#else
-# define EG(v) (executor_globals.v)
-extern ZEND_API zend_executor_globals executor_globals;
-#endif
-
-
-/* Memory Manager */
-#ifdef ZTS
-# define AG(v) TSRMG(alloc_globals_id, zend_alloc_globals *, v)
-#else
-# define AG(v) (alloc_globals.v)
-extern ZEND_API zend_alloc_globals alloc_globals;
-#endif
-
-
-/* Language Scanner */
-#ifdef ZTS
-# define LANG_SCNG(v) TSRMG(language_scanner_globals_id, zend_scanner_globals *, v)
-extern ZEND_API ts_rsrc_id language_scanner_globals_id;
-#else
-# define LANG_SCNG(v) (language_scanner_globals.v)
-extern ZEND_API zend_scanner_globals language_scanner_globals;
-#endif
-
-
-/* INI Scanner */
-#ifdef ZTS
-# define INI_SCNG(v) TSRMG(ini_scanner_globals_id, zend_scanner_globals *, v)
-extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
-#else
-# define INI_SCNG(v) (ini_scanner_globals.v)
-extern ZEND_API zend_scanner_globals ini_scanner_globals;
-#endif
-
-
-/* For limited downwards source compatibility */
-#define CLS_FETCH()
-#define ELS_FETCH()
-#define ALS_FETCH()
-#define PLS_FETCH()
-#define SLS_FETCH()
-#define CLS_D
-#define ELS_D
-#define ALS_D
-#define PLS_D
-#define SLS_D
-#define CLS_DC
-#define ELS_DC
-#define ALS_DC
-#define PLS_DC
-#define SLS_DC
-#define CLS_C
-#define ELS_C
-#define ALS_C
-#define PLS_C
-#define SLS_C
-#define CLS_CC
-#define ELS_CC
-#define ALS_CC
-#define PLS_CC
-#define SLS_CC
-
-
-#endif /* ZEND_GLOBALS_MACROS_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
deleted file mode 100644
index 6ec60239ad..0000000000
--- a/Zend/zend_hash.c
+++ /dev/null
@@ -1,1354 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-
-#define HANDLE_NUMERIC(key, length, func) { \
- register char *tmp=key; \
- \
- if ((*tmp>='0' && *tmp<='9')) do { /* possibly a numeric index */ \
- char *end=tmp+length-1; \
- ulong idx; \
- \
- if (*tmp++=='0' && length>2) { /* don't accept numbers with leading zeros */ \
- break; \
- } \
- while (tmp<end) { \
- if (!(*tmp>='0' && *tmp<='9')) { \
- break; \
- } \
- tmp++; \
- } \
- if (tmp==end && *tmp=='\0') { /* a numeric index */ \
- idx = strtol(key, NULL, 10); \
- if (idx!=LONG_MAX) { \
- return func; \
- } \
- } \
- } while (0); \
-}
-
-
-#define CONNECT_TO_BUCKET_DLLIST(element, list_head) \
- (element)->pNext = (list_head); \
- (element)->pLast = NULL; \
- if ((element)->pNext) { \
- (element)->pNext->pLast = (element); \
- }
-
-#define CONNECT_TO_GLOBAL_DLLIST(element, ht) \
- (element)->pListLast = (ht)->pListTail; \
- (ht)->pListTail = (element); \
- (element)->pListNext = NULL; \
- if ((element)->pListLast != NULL) { \
- (element)->pListLast->pListNext = (element); \
- } \
- if (!(ht)->pListHead) { \
- (ht)->pListHead = (element); \
- } \
- if ((ht)->pInternalPointer == NULL) { \
- (ht)->pInternalPointer = (element); \
- }
-
-#if ZEND_DEBUG
-#define HT_OK 0
-#define HT_IS_DESTROYING 1
-#define HT_DESTROYED 2
-#define HT_CLEANING 3
-
-static void _zend_is_inconsistent(HashTable *ht, char *file, int line)
-{
- if (ht->inconsistent==HT_OK) {
- return;
- }
- switch (ht->inconsistent) {
- case HT_IS_DESTROYING:
- zend_output_debug_string(1, "%s(%d) : ht=0x%08x is being destroyed", file, line, ht);
- break;
- case HT_DESTROYED:
- zend_output_debug_string(1, "%s(%d) : ht=0x%08x is already destroyed", file, line, ht);
- break;
- case HT_CLEANING:
- zend_output_debug_string(1, "%s(%d) : ht=0x%08x is being cleaned", file, line, ht);
- break;
- }
- zend_bailout();
-}
-#define IS_CONSISTENT(a) _zend_is_inconsistent(a, __FILE__, __LINE__);
-#define SET_INCONSISTENT(n) ht->inconsistent = n;
-#else
-#define IS_CONSISTENT(a)
-#define SET_INCONSISTENT(n)
-#endif
-
-#define HASH_PROTECT_RECURSION(ht) \
- if ((ht)->bApplyProtection) { \
- if ((ht)->nApplyCount++ >= 3) { \
- zend_error(E_ERROR, "Nesting level too deep - recursive dependency?"); \
- } \
- }
-
-
-#define HASH_UNPROTECT_RECURSION(ht) \
- if ((ht)->bApplyProtection) { \
- (ht)->nApplyCount--; \
- }
-
-
-#define ZEND_HASH_IF_FULL_DO_RESIZE(ht) \
- if ((ht)->nNumOfElements > (ht)->nTableSize) { \
- zend_hash_do_resize(ht); \
- }
-
-static int zend_hash_do_resize(HashTable *ht);
-
-ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength)
-{
- return zend_inline_hash_func(arKey, nKeyLength);
-}
-
-
-#define UPDATE_DATA(ht, p, pData, nDataSize) \
- if (nDataSize == sizeof(void*)) { \
- if (!(p)->pDataPtr) { \
- pefree((p)->pData, (ht)->persistent); \
- } \
- memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \
- (p)->pData = &(p)->pDataPtr; \
- } else { \
- if ((p)->pDataPtr) { \
- (p)->pData = (void *) pemalloc(nDataSize, (ht)->persistent); \
- (p)->pDataPtr=NULL; \
- } \
- memcpy((p)->pData, pData, nDataSize); \
- }
-
-#define INIT_DATA(ht, p, pData, nDataSize); \
- if (nDataSize == sizeof(void*)) { \
- memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \
- (p)->pData = &(p)->pDataPtr; \
- } else { \
- (p)->pData = (void *) pemalloc(nDataSize, (ht)->persistent); \
- if (!(p)->pData) { \
- pefree(p, (ht)->persistent); \
- return FAILURE; \
- } \
- memcpy((p)->pData, pData, nDataSize); \
- (p)->pDataPtr=NULL; \
- }
-
-
-ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
-{
- uint i = 3;
-
- SET_INCONSISTENT(HT_OK);
-
- while ((1U << i) < nSize) {
- i++;
- }
-
- ht->nTableSize = 1 << i;
- ht->nTableMask = ht->nTableSize - 1;
-
- /* Uses ecalloc() so that Bucket* == NULL */
- if (persistent) {
- ht->arBuckets = (Bucket **) calloc(ht->nTableSize, sizeof(Bucket *));
- } else {
- ht->arBuckets = (Bucket **) ecalloc_rel(ht->nTableSize, sizeof(Bucket *));
- }
-
- if (!ht->arBuckets) {
- return FAILURE;
- }
-
- ht->pDestructor = pDestructor;
- ht->pListHead = NULL;
- ht->pListTail = NULL;
- ht->nNumOfElements = 0;
- ht->nNextFreeElement = 0;
- ht->pInternalPointer = NULL;
- ht->persistent = persistent;
- ht->nApplyCount = 0;
- ht->bApplyProtection = 1;
- return SUCCESS;
-}
-
-
-ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC)
-{
- int retval = _zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent ZEND_FILE_LINE_CC);
-
- ht->bApplyProtection = bApplyProtection;
- return retval;
-}
-
-
-ZEND_API void zend_hash_set_apply_protection(HashTable *ht, zend_bool bApplyProtection)
-{
- ht->bApplyProtection = bApplyProtection;
-}
-
-
-
-ZEND_API int zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag)
-{
- ulong h;
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- if (nKeyLength <= 0) {
-#if ZEND_DEBUG
- ZEND_PUTS("zend_hash_update: Can't put in empty key\n");
-#endif
- return FAILURE;
- }
-
- HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_update_or_next_insert(ht, idx, pData, nDataSize, pDest, flag));
-
- h = zend_inline_hash_func(arKey, nKeyLength);
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- if (flag & HASH_ADD) {
- return FAILURE;
- }
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG
- if (p->pData == pData) {
- ZEND_PUTS("Fatal error in zend_hash_update: p->pData == pData\n");
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return FAILURE;
- }
-#endif
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- UPDATE_DATA(ht, p, pData, nDataSize);
- if (pDest) {
- *pDest = p->pData;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return SUCCESS;
- }
- }
- p = p->pNext;
- }
-
- p = (Bucket *) pemalloc(sizeof(Bucket)-1+nKeyLength, ht->persistent);
- if (!p) {
- return FAILURE;
- }
- memcpy(p->arKey, arKey, nKeyLength);
- p->nKeyLength = nKeyLength;
- INIT_DATA(ht, p, pData, nDataSize);
- p->h = h;
- CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]);
- if (pDest) {
- *pDest = p->pData;
- }
-
- HANDLE_BLOCK_INTERRUPTIONS();
- CONNECT_TO_GLOBAL_DLLIST(p, ht);
- ht->arBuckets[nIndex] = p;
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
- ht->nNumOfElements++;
- ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */
- return SUCCESS;
-}
-
-ZEND_API int zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag)
-{
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- if (nKeyLength == 0) {
- return zend_hash_index_update(ht, h, pData, nDataSize, pDest);
- }
-
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- if (flag & HASH_ADD) {
- return FAILURE;
- }
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG
- if (p->pData == pData) {
- ZEND_PUTS("Fatal error in zend_hash_update: p->pData == pData\n");
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return FAILURE;
- }
-#endif
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- UPDATE_DATA(ht, p, pData, nDataSize);
- if (pDest) {
- *pDest = p->pData;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return SUCCESS;
- }
- }
- p = p->pNext;
- }
-
- p = (Bucket *) pemalloc(sizeof(Bucket)-1+nKeyLength, ht->persistent);
- if (!p) {
- return FAILURE;
- }
-
- memcpy(p->arKey, arKey, nKeyLength);
- p->nKeyLength = nKeyLength;
- INIT_DATA(ht, p, pData, nDataSize);
- p->h = h;
-
- CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]);
-
- if (pDest) {
- *pDest = p->pData;
- }
-
- HANDLE_BLOCK_INTERRUPTIONS();
- ht->arBuckets[nIndex] = p;
- CONNECT_TO_GLOBAL_DLLIST(p, ht);
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
- ht->nNumOfElements++;
- ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */
- return SUCCESS;
-}
-
-
-ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLength)
-{
- void *dummy = (void *) 1;
-
- return zend_hash_add(ht, arKey, nKeyLength, &dummy, sizeof(void *), NULL);
-}
-
-
-ZEND_API int zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag)
-{
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- if (flag & HASH_NEXT_INSERT) {
- h = ht->nNextFreeElement;
- }
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->nKeyLength == 0) && (p->h == h)) {
- if (flag & HASH_NEXT_INSERT || flag & HASH_ADD) {
- return FAILURE;
- }
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG
- if (p->pData == pData) {
- ZEND_PUTS("Fatal error in zend_hash_index_update: p->pData == pData\n");
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return FAILURE;
- }
-#endif
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- UPDATE_DATA(ht, p, pData, nDataSize);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- if ((long)h >= (long)ht->nNextFreeElement) {
- ht->nNextFreeElement = h + 1;
- }
- if (pDest) {
- *pDest = p->pData;
- }
- return SUCCESS;
- }
- p = p->pNext;
- }
- p = (Bucket *) pemalloc(sizeof(Bucket)-1, ht->persistent);
- if (!p) {
- return FAILURE;
- }
- p->nKeyLength = 0; /* Numeric indices are marked by making the nKeyLength == 0 */
- p->h = h;
- INIT_DATA(ht, p, pData, nDataSize);
- if (pDest) {
- *pDest = p->pData;
- }
-
- CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]);
-
- HANDLE_BLOCK_INTERRUPTIONS();
- ht->arBuckets[nIndex] = p;
- CONNECT_TO_GLOBAL_DLLIST(p, ht);
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
- if ((long)h >= (long)ht->nNextFreeElement) {
- ht->nNextFreeElement = h + 1;
- }
- ht->nNumOfElements++;
- ZEND_HASH_IF_FULL_DO_RESIZE(ht);
- return SUCCESS;
-}
-
-
-static int zend_hash_do_resize(HashTable *ht)
-{
- Bucket **t;
-
- IS_CONSISTENT(ht);
-
- if ((ht->nTableSize << 1) > 0) { /* Let's double the table size */
- t = (Bucket **) perealloc_recoverable(ht->arBuckets, (ht->nTableSize << 1) * sizeof(Bucket *), ht->persistent);
- if (t) {
- HANDLE_BLOCK_INTERRUPTIONS();
- ht->arBuckets = t;
- ht->nTableSize = (ht->nTableSize << 1);
- ht->nTableMask = ht->nTableSize - 1;
- zend_hash_rehash(ht);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return SUCCESS;
- }
- return FAILURE;
- }
- return SUCCESS;
-}
-
-ZEND_API int zend_hash_rehash(HashTable *ht)
-{
- Bucket *p;
- uint nIndex;
-
- IS_CONSISTENT(ht);
-
- memset(ht->arBuckets, 0, ht->nTableSize * sizeof(Bucket *));
- p = ht->pListHead;
- while (p != NULL) {
- nIndex = p->h & ht->nTableMask;
- CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]);
- ht->arBuckets[nIndex] = p;
- p = p->pListNext;
- }
- return SUCCESS;
-}
-
-ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag)
-{
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- if (flag == HASH_DEL_KEY) {
- HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_del_key_or_index(ht, arKey, nKeyLength, idx, HASH_DEL_INDEX));
- h = zend_inline_hash_func(arKey, nKeyLength);
- }
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && ((p->nKeyLength == 0) || /* Numeric index */
- ((p->nKeyLength == nKeyLength) && (!memcmp(p->arKey, arKey, nKeyLength))))) {
- HANDLE_BLOCK_INTERRUPTIONS();
- if (p == ht->arBuckets[nIndex]) {
- ht->arBuckets[nIndex] = p->pNext;
- } else {
- p->pLast->pNext = p->pNext;
- }
- if (p->pNext) {
- p->pNext->pLast = p->pLast;
- }
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p->pListNext;
- } else {
- /* Deleting the head of the list */
- ht->pListHead = p->pListNext;
- }
- if (p->pListNext != NULL) {
- p->pListNext->pListLast = p->pListLast;
- } else {
- ht->pListTail = p->pListLast;
- }
- if (ht->pInternalPointer == p) {
- ht->pInternalPointer = p->pListNext;
- }
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- if (!p->pDataPtr) {
- pefree(p->pData, ht->persistent);
- }
- pefree(p, ht->persistent);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- ht->nNumOfElements--;
- return SUCCESS;
- }
- p = p->pNext;
- }
- return FAILURE;
-}
-
-
-ZEND_API void zend_hash_destroy(HashTable *ht)
-{
- Bucket *p, *q;
-
- IS_CONSISTENT(ht);
-
- SET_INCONSISTENT(HT_IS_DESTROYING);
-
- p = ht->pListHead;
- while (p != NULL) {
- q = p;
- p = p->pListNext;
- if (ht->pDestructor) {
- ht->pDestructor(q->pData);
- }
- if (!q->pDataPtr && q->pData) {
- pefree(q->pData, ht->persistent);
- }
- pefree(q, ht->persistent);
- }
- pefree(ht->arBuckets, ht->persistent);
-
- SET_INCONSISTENT(HT_DESTROYED);
-}
-
-
-ZEND_API void zend_hash_clean(HashTable *ht)
-{
- Bucket *p, *q;
-
- IS_CONSISTENT(ht);
-
- SET_INCONSISTENT(HT_CLEANING);
-
- p = ht->pListHead;
- while (p != NULL) {
- q = p;
- p = p->pListNext;
- if (ht->pDestructor) {
- ht->pDestructor(q->pData);
- }
- if (!q->pDataPtr && q->pData) {
- pefree(q->pData, ht->persistent);
- }
- pefree(q, ht->persistent);
- }
- memset(ht->arBuckets, 0, ht->nTableSize*sizeof(Bucket *));
- ht->pListHead = NULL;
- ht->pListTail = NULL;
- ht->nNumOfElements = 0;
- ht->nNextFreeElement = 0;
- ht->pInternalPointer = NULL;
-
- SET_INCONSISTENT(HT_OK);
-}
-
-/* This function is used by the various apply() functions.
- * It deletes the passed bucket, and returns the address of the
- * next bucket. The hash *may* be altered during that time, the
- * returned value will still be valid.
- */
-static Bucket *zend_hash_apply_deleter(HashTable *ht, Bucket *p)
-{
- Bucket *retval;
-
- HANDLE_BLOCK_INTERRUPTIONS();
-
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- if (!p->pDataPtr) {
- pefree(p->pData, ht->persistent);
- }
- retval = p->pListNext;
-
- if (p->pLast) {
- p->pLast->pNext = p->pNext;
- } else {
- uint nIndex;
-
- nIndex = p->h & ht->nTableMask;
- ht->arBuckets[nIndex] = p->pNext;
- }
- if (p->pNext) {
- p->pNext->pLast = p->pLast;
- } else {
- /* Nothing to do as this list doesn't have a tail */
- }
-
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p->pListNext;
- } else {
- /* Deleting the head of the list */
- ht->pListHead = p->pListNext;
- }
- if (p->pListNext != NULL) {
- p->pListNext->pListLast = p->pListLast;
- } else {
- ht->pListTail = p->pListLast;
- }
- if (ht->pInternalPointer == p) {
- ht->pInternalPointer = p->pListNext;
- }
- pefree(p, ht->persistent);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- ht->nNumOfElements--;
-
- return retval;
-}
-
-
-ZEND_API void zend_hash_graceful_destroy(HashTable *ht)
-{
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- p = ht->pListHead;
- while (p != NULL) {
- p = zend_hash_apply_deleter(ht, p);
- }
- pefree(ht->arBuckets, ht->persistent);
-
- SET_INCONSISTENT(HT_DESTROYED);
-}
-
-ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht)
-{
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- p = ht->pListTail;
- while (p != NULL) {
- zend_hash_apply_deleter(ht, p);
- p = ht->pListTail;
- }
-
- pefree(ht->arBuckets, ht->persistent);
-
- SET_INCONSISTENT(HT_DESTROYED);
-}
-
-/* This is used to selectively delete certain entries from a hashtable.
- * destruct() receives the data and decides if the entry should be deleted
- * or not
- */
-
-
-ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
-{
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- HASH_PROTECT_RECURSION(ht);
- p = ht->pListHead;
- while (p != NULL) {
- if (apply_func(p->pData TSRMLS_CC)) {
- p = zend_hash_apply_deleter(ht, p);
- } else {
- p = p->pListNext;
- }
- }
- HASH_UNPROTECT_RECURSION(ht);
-}
-
-
-ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC)
-{
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- HASH_PROTECT_RECURSION(ht);
- p = ht->pListHead;
- while (p != NULL) {
- if (apply_func(p->pData, argument TSRMLS_CC)) {
- p = zend_hash_apply_deleter(ht, p);
- } else {
- p = p->pListNext;
- }
- }
- HASH_UNPROTECT_RECURSION(ht);
-}
-
-
-ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t destruct, int num_args, ...)
-{
- Bucket *p;
- va_list args;
- zend_hash_key hash_key;
-
- IS_CONSISTENT(ht);
-
- HASH_PROTECT_RECURSION(ht);
-
- p = ht->pListHead;
- while (p != NULL) {
- va_start(args, num_args);
- hash_key.arKey = p->arKey;
- hash_key.nKeyLength = p->nKeyLength;
- hash_key.h = p->h;
- if (destruct(p->pData, num_args, args, &hash_key)) {
- p = zend_hash_apply_deleter(ht, p);
- } else {
- p = p->pListNext;
- }
- va_end(args);
- }
-
- HASH_UNPROTECT_RECURSION(ht);
-}
-
-
-ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
-{
- Bucket *p, *q;
-
- IS_CONSISTENT(ht);
-
- HASH_PROTECT_RECURSION(ht);
- p = ht->pListTail;
- while (p != NULL) {
- int result = apply_func(p->pData TSRMLS_CC);
-
- q = p;
- p = p->pListLast;
- if (result & ZEND_HASH_APPLY_REMOVE) {
- if (q->nKeyLength>0) {
- zend_hash_del(ht, q->arKey, q->nKeyLength);
- } else {
- zend_hash_index_del(ht, q->h);
- }
- }
- if (result & ZEND_HASH_APPLY_STOP) {
- break;
- }
- }
- HASH_UNPROTECT_RECURSION(ht);
-}
-
-
-ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size)
-{
- Bucket *p;
- void *new_entry;
-
- IS_CONSISTENT(source);
- IS_CONSISTENT(target);
-
- p = source->pListHead;
- while (p) {
- if (p->nKeyLength) {
- zend_hash_update(target, p->arKey, p->nKeyLength, p->pData, size, &new_entry);
- } else {
- zend_hash_index_update(target, p->h, p->pData, size, &new_entry);
- }
- if (pCopyConstructor) {
- pCopyConstructor(new_entry);
- }
- p = p->pListNext;
- }
- target->pInternalPointer = target->pListHead;
-}
-
-
-ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite)
-{
- Bucket *p;
- void *t;
- int mode = (overwrite?HASH_UPDATE:HASH_ADD);
-
- IS_CONSISTENT(source);
- IS_CONSISTENT(target);
-
- p = source->pListHead;
- while (p) {
- if (p->nKeyLength>0) {
- if (zend_hash_add_or_update(target, p->arKey, p->nKeyLength, p->pData, size, &t, mode)==SUCCESS && pCopyConstructor) {
- pCopyConstructor(t);
- }
- } else {
- if ((mode==HASH_UPDATE || !zend_hash_index_exists(target, p->h)) && zend_hash_index_update(target, p->h, p->pData, size, &t)==SUCCESS && pCopyConstructor) {
- pCopyConstructor(t);
- }
- }
- p = p->pListNext;
- }
- target->pInternalPointer = target->pListHead;
-}
-
-
-static zend_bool zend_hash_replace_checker_wrapper(HashTable *target, void *source_data, Bucket *p, void *pParam, merge_checker_func_t merge_checker_func)
-{
- zend_hash_key hash_key;
-
- hash_key.arKey = p->arKey;
- hash_key.nKeyLength = p->nKeyLength;
- hash_key.h = p->h;
- return merge_checker_func(target, source_data, &hash_key, pParam);
-}
-
-
-ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam)
-{
- Bucket *p;
- void *t;
-
- IS_CONSISTENT(source);
- IS_CONSISTENT(target);
-
- p = source->pListHead;
- while (p) {
- if (zend_hash_replace_checker_wrapper(target, p->pData, p, pParam, pMergeSource)) {
- if (zend_hash_quick_update(target, p->arKey, p->nKeyLength, p->h, p->pData, size, &t)==SUCCESS && pCopyConstructor) {
- pCopyConstructor(t);
- }
- }
- p = p->pListNext;
- }
- target->pInternalPointer = target->pListHead;
-}
-
-
-ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength)
-{
- return zend_inline_hash_func(arKey, nKeyLength);
-}
-
-
-/* Returns SUCCESS if found and FAILURE if not. The pointer to the
- * data is returned in pData. The reason is that there's no reason
- * someone using the hash table might not want to have NULL data
- */
-ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData)
-{
- ulong h;
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht, idx, pData));
-
- h = zend_inline_hash_func(arKey, nKeyLength);
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- *pData = p->pData;
- return SUCCESS;
- }
- }
- p = p->pNext;
- }
- return FAILURE;
-}
-
-
-ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData)
-{
- uint nIndex;
- Bucket *p;
-
- if (nKeyLength==0) {
- return zend_hash_index_find(ht, h, pData);
- }
-
- IS_CONSISTENT(ht);
-
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- *pData = p->pData;
- return SUCCESS;
- }
- }
- p = p->pNext;
- }
- return FAILURE;
-}
-
-
-ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength)
-{
- ulong h;
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx));
-
- h = zend_inline_hash_func(arKey, nKeyLength);
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- return 1;
- }
- }
- p = p->pNext;
- }
- return 0;
-}
-
-
-ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h)
-{
- uint nIndex;
- Bucket *p;
-
- if (nKeyLength==0) {
- return zend_hash_index_exists(ht, h);
- }
-
- IS_CONSISTENT(ht);
-
- HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx));
-
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- return 1;
- }
- }
- p = p->pNext;
- }
- return 0;
-
-}
-
-
-ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData)
-{
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == 0)) {
- *pData = p->pData;
- return SUCCESS;
- }
- p = p->pNext;
- }
- return FAILURE;
-}
-
-
-ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h)
-{
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == 0)) {
- return 1;
- }
- p = p->pNext;
- }
- return 0;
-}
-
-
-ZEND_API int zend_hash_num_elements(HashTable *ht)
-{
- IS_CONSISTENT(ht);
-
- return ht->nNumOfElements;
-}
-
-
-ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos)
-{
- IS_CONSISTENT(ht);
-
- if (pos)
- *pos = ht->pListHead;
- else
- ht->pInternalPointer = ht->pListHead;
-}
-
-
-/* This function will be extremely optimized by remembering
- * the end of the list
- */
-ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos)
-{
- IS_CONSISTENT(ht);
-
- if (pos)
- *pos = ht->pListTail;
- else
- ht->pInternalPointer = ht->pListTail;
-}
-
-
-ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos)
-{
- HashPosition *current = pos ? pos : &ht->pInternalPointer;
-
- IS_CONSISTENT(ht);
-
- if (*current) {
- *current = (*current)->pListNext;
- return SUCCESS;
- } else
- return FAILURE;
-}
-
-ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos)
-{
- HashPosition *current = pos ? pos : &ht->pInternalPointer;
-
- IS_CONSISTENT(ht);
-
- if (*current) {
- *current = (*current)->pListLast;
- return SUCCESS;
- } else
- return FAILURE;
-}
-
-
-/* This function should be made binary safe */
-ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos)
-{
- Bucket *p;
-
- p = pos ? (*pos) : ht->pInternalPointer;
-
- IS_CONSISTENT(ht);
-
- if (p) {
- if (p->nKeyLength) {
- if (duplicate) {
- *str_index = estrndup(p->arKey, p->nKeyLength);
- } else {
- *str_index = p->arKey;
- }
- if (str_length) {
- *str_length = p->nKeyLength;
- }
- return HASH_KEY_IS_STRING;
- } else {
- *num_index = p->h;
- return HASH_KEY_IS_LONG;
- }
- }
- return HASH_KEY_NON_EXISTANT;
-}
-
-
-ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos)
-{
- Bucket *p;
-
- p = pos ? (*pos) : ht->pInternalPointer;
-
- IS_CONSISTENT(ht);
-
- if (p) {
- if (p->nKeyLength) {
- return HASH_KEY_IS_STRING;
- } else {
- return HASH_KEY_IS_LONG;
- }
- }
- return HASH_KEY_NON_EXISTANT;
-}
-
-
-ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos)
-{
- Bucket *p;
-
- p = pos ? (*pos) : ht->pInternalPointer;
-
- IS_CONSISTENT(ht);
-
- if (p) {
- *pData = p->pData;
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-
-ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
- compare_func_t compar, int renumber TSRMLS_DC)
-{
- Bucket **arTmp;
- Bucket *p;
- int i, j;
-
- IS_CONSISTENT(ht);
-
- if (!(ht->nNumOfElements>1) && !(renumber && ht->nNumOfElements>0)) { /* Doesn't require sorting */
- return SUCCESS;
- }
- arTmp = (Bucket **) pemalloc(ht->nNumOfElements * sizeof(Bucket *), ht->persistent);
- if (!arTmp) {
- return FAILURE;
- }
- p = ht->pListHead;
- i = 0;
- while (p) {
- arTmp[i] = p;
- p = p->pListNext;
- i++;
- }
-
- (*sort_func)((void *) arTmp, i, sizeof(Bucket *), compar TSRMLS_CC);
-
- HANDLE_BLOCK_INTERRUPTIONS();
- ht->pListHead = arTmp[0];
- ht->pListTail = NULL;
- ht->pInternalPointer = ht->pListHead;
-
- for (j = 0; j < i; j++) {
- if (ht->pListTail) {
- ht->pListTail->pListNext = arTmp[j];
- }
- arTmp[j]->pListLast = ht->pListTail;
- arTmp[j]->pListNext = NULL;
- ht->pListTail = arTmp[j];
- }
- pefree(arTmp, ht->persistent);
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
- if (renumber) {
- p = ht->pListHead;
- i=0;
- while (p != NULL) {
- p->nKeyLength = 0;
- p->h = i++;
- p = p->pListNext;
- }
- ht->nNextFreeElement = i;
- zend_hash_rehash(ht);
- }
- return SUCCESS;
-}
-
-
-ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC)
-{
- Bucket *p1, *p2;
- int result;
- void *pData2;
-
- IS_CONSISTENT(ht1);
- IS_CONSISTENT(ht2);
-
- HASH_PROTECT_RECURSION(ht1);
- HASH_PROTECT_RECURSION(ht2);
-
- result = ht1->nNumOfElements - ht2->nNumOfElements;
- if (result!=0) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return result;
- }
-
- p1 = ht1->pListHead;
- if (ordered) {
- p2 = ht2->pListHead;
- }
-
- while (p1) {
- if (ordered && !p2) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return 1; /* That's not supposed to happen */
- }
- if (ordered) {
- if (p1->nKeyLength==0 && p2->nKeyLength==0) { /* numeric indices */
- result = p1->h - p2->h;
- if (result!=0) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return result;
- }
- } else { /* string indices */
- result = p1->nKeyLength - p2->nKeyLength;
- if (result!=0) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return result;
- }
- result = memcmp(p1->arKey, p2->arKey, p1->nKeyLength);
- if (result!=0) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return result;
- }
- }
- pData2 = p2->pData;
- } else {
- if (p1->nKeyLength==0) { /* numeric index */
- if (zend_hash_index_find(ht2, p1->h, &pData2)==FAILURE) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return 1;
- }
- } else { /* string index */
- if (zend_hash_find(ht2, p1->arKey, p1->nKeyLength, &pData2)==FAILURE) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return 1;
- }
- }
- }
- result = compar(p1->pData, pData2 TSRMLS_CC);
- if (result!=0) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return result;
- }
- p1 = p1->pListNext;
- if (ordered) {
- p2 = p2->pListNext;
- }
- }
-
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return 0;
-}
-
-
-ZEND_API int zend_hash_minmax(HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC)
-{
- Bucket *p, *res;
-
- IS_CONSISTENT(ht);
-
- if (ht->nNumOfElements == 0 ) {
- *pData=NULL;
- return FAILURE;
- }
-
- res = p = ht->pListHead;
- while ((p = p->pListNext)) {
- if (flag) {
- if (compar(&res, &p TSRMLS_CC) < 0) { /* max */
- res = p;
- }
- } else {
- if (compar(&res, &p TSRMLS_CC) > 0) { /* min */
- res = p;
- }
- }
- }
- *pData = res->pData;
- return SUCCESS;
-}
-
-ZEND_API ulong zend_hash_next_free_element(HashTable *ht)
-{
- IS_CONSISTENT(ht);
-
- return ht->nNextFreeElement;
-
-}
-
-
-#if ZEND_DEBUG
-void zend_hash_display_pListTail(HashTable *ht)
-{
- Bucket *p;
-
- p = ht->pListTail;
- while (p != NULL) {
- zend_output_debug_string(0, "pListTail has key %s\n", p->arKey);
- p = p->pListLast;
- }
-}
-
-void zend_hash_display(HashTable *ht)
-{
- Bucket *p;
- uint i;
-
- for (i = 0; i < ht->nTableSize; i++) {
- p = ht->arBuckets[i];
- while (p != NULL) {
- zend_output_debug_string(0, "%s <==> 0x%X\n", p->arKey, p->h);
- p = p->pNext;
- }
- }
-
- p = ht->pListTail;
- while (p != NULL) {
- zend_output_debug_string(0, "%s <==> 0x%X\n", p->arKey, p->h);
- p = p->pListLast;
- }
-}
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
deleted file mode 100644
index 37a84cb956..0000000000
--- a/Zend/zend_hash.h
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_HASH_H
-#define ZEND_HASH_H
-
-#include <sys/types.h>
-#include "zend.h"
-
-#define HASH_KEY_IS_STRING 1
-#define HASH_KEY_IS_LONG 2
-#define HASH_KEY_NON_EXISTANT 3
-
-#define HASH_UPDATE (1<<0)
-#define HASH_ADD (1<<1)
-#define HASH_NEXT_INSERT (1<<2)
-
-#define HASH_DEL_KEY 0
-#define HASH_DEL_INDEX 1
-
-typedef ulong (*hash_func_t)(char *arKey, uint nKeyLength);
-typedef int (*compare_func_t)(const void *, const void * TSRMLS_DC);
-typedef void (*sort_func_t)(void *, size_t, register size_t, compare_func_t TSRMLS_DC);
-typedef void (*dtor_func_t)(void *pDest);
-typedef void (*copy_ctor_func_t)(void *pElement);
-typedef void (*copy_ctor_param_func_t)(void *pElement, void *pParam);
-
-struct _hashtable;
-
-typedef struct bucket {
- ulong h; /* Used for numeric indexing */
- uint nKeyLength;
- void *pData;
- void *pDataPtr;
- struct bucket *pListNext;
- struct bucket *pListLast;
- struct bucket *pNext;
- struct bucket *pLast;
- char arKey[1]; /* Must be last element */
-} Bucket;
-
-typedef struct _hashtable {
- uint nTableSize;
- uint nTableMask;
- uint nNumOfElements;
- ulong nNextFreeElement;
- Bucket *pInternalPointer; /* Used for element traversal */
- Bucket *pListHead;
- Bucket *pListTail;
- Bucket **arBuckets;
- dtor_func_t pDestructor;
- zend_bool persistent;
- unsigned char nApplyCount;
- zend_bool bApplyProtection;
-#if ZEND_DEBUG
- int inconsistent;
-#endif
-} HashTable;
-
-
-typedef struct _zend_hash_key {
- char *arKey;
- uint nKeyLength;
- ulong h;
-} zend_hash_key;
-
-
-typedef zend_bool (*merge_checker_func_t)(HashTable *target_ht, void *source_data, zend_hash_key *hash_key, void *pParam);
-
-typedef Bucket* HashPosition;
-
-BEGIN_EXTERN_C()
-
-/* startup/shutdown */
-ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC);
-ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC);
-ZEND_API void zend_hash_destroy(HashTable *ht);
-ZEND_API void zend_hash_clean(HashTable *ht);
-#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent) _zend_hash_init((ht), (nSize), (pHashFunction), (pDestructor), (persistent) ZEND_FILE_LINE_CC)
-#define zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, bApplyProtection) _zend_hash_init_ex((ht), (nSize), (pHashFunction), (pDestructor), (persistent), (bApplyProtection) ZEND_FILE_LINE_CC)
-
-/* additions/updates/changes */
-ZEND_API int zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag);
-#define zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
- zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE)
-#define zend_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
- zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD)
-
-ZEND_API int zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag);
-#define zend_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
- zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE)
-#define zend_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
- zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_ADD)
-
-ZEND_API int zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag);
-#define zend_hash_index_update(ht, h, pData, nDataSize, pDest) \
- zend_hash_index_update_or_next_insert(ht, h, pData, nDataSize, pDest, HASH_UPDATE)
-#define zend_hash_next_index_insert(ht, pData, nDataSize, pDest) \
- zend_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT)
-
-ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLength);
-
-
-#define ZEND_HASH_APPLY_KEEP 0
-#define ZEND_HASH_APPLY_REMOVE 1<<0
-#define ZEND_HASH_APPLY_STOP 1<<1
-
-
-typedef int (*apply_func_t)(void *pDest TSRMLS_DC);
-typedef int (*apply_func_arg_t)(void *pDest, void *argument TSRMLS_DC);
-typedef int (*apply_func_args_t)(void *pDest, int num_args, va_list args, zend_hash_key *hash_key);
-
-ZEND_API void zend_hash_graceful_destroy(HashTable *ht);
-ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht);
-ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC);
-ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void * TSRMLS_DC);
-ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t apply_func, int, ...);
-
-/* This function should be used with special care (in other words,
- * it should usually not be used). When used with the ZEND_HASH_APPLY_STOP
- * return value, it assumes things about the order of the elements in the hash.
- * Also, it does not provide the same kind of reentrancy protection that
- * the standard apply functions do.
- */
-ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC);
-
-
-/* Deletes */
-ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag);
-#define zend_hash_del(ht, arKey, nKeyLength) \
- zend_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY)
-#define zend_hash_index_del(ht, h) \
- zend_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX)
-
-ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength);
-
-/* Data retreival */
-ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData);
-ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData);
-ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData);
-
-/* Misc */
-ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength);
-ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h);
-ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h);
-ZEND_API ulong zend_hash_next_free_element(HashTable *ht);
-
-/* traversing */
-ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos);
-ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos);
-ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos);
-ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos);
-ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos);
-ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos);
-ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos);
-
-#define zend_hash_move_forward(ht) \
- zend_hash_move_forward_ex(ht, NULL)
-#define zend_hash_move_backwards(ht) \
- zend_hash_move_backwards_ex(ht, NULL)
-#define zend_hash_get_current_key(ht, str_index, num_index, duplicate) \
- zend_hash_get_current_key_ex(ht, str_index, NULL, num_index, duplicate, NULL)
-#define zend_hash_get_current_key_type(ht) \
- zend_hash_get_current_key_type_ex(ht, NULL)
-#define zend_hash_get_current_data(ht, pData) \
- zend_hash_get_current_data_ex(ht, pData, NULL)
-#define zend_hash_internal_pointer_reset(ht) \
- zend_hash_internal_pointer_reset_ex(ht, NULL)
-#define zend_hash_internal_pointer_end(ht) \
- zend_hash_internal_pointer_end_ex(ht, NULL)
-
-/* Copying, merging and sorting */
-ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size);
-ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite);
-ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam);
-ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC);
-ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC);
-ZEND_API int zend_hash_minmax(HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC);
-
-ZEND_API int zend_hash_num_elements(HashTable *ht);
-
-ZEND_API int zend_hash_rehash(HashTable *ht);
-
-/*
- * DJBX33A (Daniel J. Bernstein, Times 33 with Addition)
- *
- * This is Daniel J. Bernstein's popular `times 33' hash function as
- * posted by him years ago on comp.lang.c. It basically uses a function
- * like ``hash(i) = hash(i-1) * 33 + str[i]''. This is one of the best
- * known hash functions for strings. Because it is both computed very
- * fast and distributes very well.
- *
- * The magic of number 33, i.e. why it works better than many other
- * constants, prime or not, has never been adequately explained by
- * anyone. So I try an explanation: if one experimentally tests all
- * multipliers between 1 and 256 (as RSE did now) one detects that even
- * numbers are not useable at all. The remaining 128 odd numbers
- * (except for the number 1) work more or less all equally well. They
- * all distribute in an acceptable way and this way fill a hash table
- * with an average percent of approx. 86%.
- *
- * If one compares the Chi^2 values of the variants, the number 33 not
- * even has the best value. But the number 33 and a few other equally
- * good numbers like 17, 31, 63, 127 and 129 have nevertheless a great
- * advantage to the remaining numbers in the large set of possible
- * multipliers: their multiply operation can be replaced by a faster
- * operation based on just one shift plus either a single addition
- * or subtraction operation. And because a hash function has to both
- * distribute good _and_ has to be very fast to compute, those few
- * numbers should be preferred and seems to be the reason why Daniel J.
- * Bernstein also preferred it.
- *
- *
- * -- Ralf S. Engelschall <rse@engelschall.com>
- */
-
-static inline ulong zend_inline_hash_func(char *arKey, uint nKeyLength)
-{
- register ulong hash = 5381;
-
- /* variant with the hash unrolled eight times */
- for (; nKeyLength >= 8; nKeyLength -= 8) {
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- }
- switch (nKeyLength) {
- case 7: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 6: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 5: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 4: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 3: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 2: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 1: hash = ((hash << 5) + hash) + *arKey++; break;
- case 0: break;
-EMPTY_SWITCH_DEFAULT_CASE()
- }
- return hash;
-}
-
-
-ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength);
-
-#if ZEND_DEBUG
-/* debug */
-void zend_hash_display_pListTail(HashTable *ht);
-void zend_hash_display(HashTable *ht);
-#endif
-
-END_EXTERN_C()
-
-#define ZEND_INIT_SYMTABLE(ht) \
- ZEND_INIT_SYMTABLE_EX(ht, 2, 0)
-
-#define ZEND_INIT_SYMTABLE_EX(ht, n, persistent) \
- zend_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, persistent)
-
-
-#endif /* ZEND_HASH_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c
deleted file mode 100644
index 586c1ab64d..0000000000
--- a/Zend/zend_highlight.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_language_parser.h"
-#include "zend_compile.h"
-#include "zend_highlight.h"
-#include "zend_ptr_stack.h"
-#include "zend_globals.h"
-
-ZEND_API void zend_html_putc(char c)
-{
- switch (c) {
- case '\n':
- ZEND_PUTS("<br />");
- break;
- case '<':
- ZEND_PUTS("&lt;");
- break;
- case '>':
- ZEND_PUTS("&gt;");
- break;
- case '&':
- ZEND_PUTS("&amp;");
- break;
- case ' ':
- ZEND_PUTS("&nbsp;");
- break;
- case '\t':
- ZEND_PUTS("&nbsp;&nbsp;&nbsp;&nbsp;");
- break;
- default:
- ZEND_PUTC(c);
- break;
- }
-}
-
-
-ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC)
-{
- const char *ptr=s, *end=s+len;
-
- while (ptr<end) {
- if (*ptr==' ') {
- /* Series of spaces should be displayed as &nbsp;'s
- * whereas single spaces should be displayed as a space
- */
- if ((ptr+1) < end && *(ptr+1)==' ') {
- do {
- zend_html_putc(*ptr);
- } while ((++ptr < end) && (*ptr==' '));
- } else {
- ZEND_PUTC(*ptr);
- ptr++;
- }
- } else {
- zend_html_putc(*ptr++);
- }
- }
-}
-
-
-
-ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC)
-{
- zval token;
- int token_type;
- char *last_color = syntax_highlighter_ini->highlight_html;
- char *next_color;
- int in_string=0;
-
- zend_printf("<code>");
- zend_printf("<font color=\"%s\">\n", last_color);
- /* highlight stuff coming back from zendlex() */
- token.type = 0;
- while ((token_type=lex_scan(&token TSRMLS_CC))) {
- switch (token_type) {
- case T_INLINE_HTML:
- next_color = syntax_highlighter_ini->highlight_html;
- break;
- case T_COMMENT:
- case T_DOC_COMMENT:
- next_color = syntax_highlighter_ini->highlight_comment;
- break;
- case T_OPEN_TAG:
- case T_OPEN_TAG_WITH_ECHO:
- next_color = syntax_highlighter_ini->highlight_default;
- break;
- case T_CLOSE_TAG:
- next_color = syntax_highlighter_ini->highlight_default;
- break;
- case T_CONSTANT_ENCAPSED_STRING:
- next_color = syntax_highlighter_ini->highlight_string;
- break;
- case '"':
- next_color = syntax_highlighter_ini->highlight_string;
- in_string = !in_string;
- break;
- case T_WHITESPACE:
- zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC); /* no color needed */
- token.type = 0;
- continue;
- break;
- default:
- if (token.type==0) {
- next_color = syntax_highlighter_ini->highlight_keyword;
- } else {
- if (in_string) {
- next_color = syntax_highlighter_ini->highlight_string;
- } else {
- next_color = syntax_highlighter_ini->highlight_default;
- }
- }
- break;
- }
-
- if (last_color != next_color) {
- if (last_color != syntax_highlighter_ini->highlight_html) {
- zend_printf("</font>");
- }
- last_color = next_color;
- if (last_color != syntax_highlighter_ini->highlight_html) {
- zend_printf("<font color=\"%s\">", last_color);
- }
- }
- switch (token_type) {
- case T_END_HEREDOC:
- zend_html_puts(token.value.str.val, token.value.str.len TSRMLS_CC);
- break;
- default:
- zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC);
- break;
- }
-
- if (token.type == IS_STRING) {
- switch (token_type) {
- case T_OPEN_TAG:
- case T_OPEN_TAG_WITH_ECHO:
- case T_CLOSE_TAG:
- case T_WHITESPACE:
- case T_COMMENT:
- case T_DOC_COMMENT:
- break;
- default:
- efree(token.value.str.val);
- break;
- }
- } else if (token_type == T_END_HEREDOC) {
- zend_bool has_semicolon=(strchr(token.value.str.val, ';')?1:0);
-
- efree(token.value.str.val);
- if (has_semicolon) {
- /* the following semicolon was unput(), ignore it */
- lex_scan(&token TSRMLS_CC);
- }
- }
- token.type = 0;
- }
- if (last_color != syntax_highlighter_ini->highlight_html) {
- zend_printf("</font>\n");
- }
- zend_printf("</font>\n");
- zend_printf("</code>");
-}
-
-
-
-ZEND_API void zend_strip(TSRMLS_D)
-{
- zval token;
- int token_type;
- int prev_space = 0;
-
- token.type = 0;
- while ((token_type=lex_scan(&token TSRMLS_CC))) {
- switch (token_type) {
- case T_WHITESPACE:
- if (!prev_space) {
- putchar(' ');
- prev_space = 1;
- }
- /* lack of break; is intentional */
- case T_COMMENT:
- case T_DOC_COMMENT:
- token.type = 0;
- continue;
-
- case T_END_HEREDOC: {
- char *ptr = LANG_SCNG(yy_text);
-
- fwrite(ptr, LANG_SCNG(yy_leng) - 1, 1, stdout);
- /* The ensure that we only write one ; and that it followed by the required newline */
- putchar('\n');
- if (ptr[LANG_SCNG(yy_leng) - 1] == ';') {
- lex_scan(&token TSRMLS_CC);
- }
- efree(token.value.str.val);
- }
- break;
-
- default:
- fwrite(LANG_SCNG(yy_text), LANG_SCNG(yy_leng), 1, stdout);
- break;
- }
-
- if (token.type == IS_STRING) {
- switch (token_type) {
- case T_OPEN_TAG:
- case T_OPEN_TAG_WITH_ECHO:
- case T_CLOSE_TAG:
- case T_WHITESPACE:
- case T_COMMENT:
- case T_DOC_COMMENT:
- break;
-
- default:
- efree(token.value.str.val);
- break;
- }
- }
- prev_space = token.type = 0;
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
-
diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h
deleted file mode 100644
index 807270049e..0000000000
--- a/Zend/zend_highlight.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_HIGHLIGHT_H
-#define ZEND_HIGHLIGHT_H
-
-#define HL_COMMENT_COLOR "#FF8000" /* orange */
-#define HL_DEFAULT_COLOR "#0000BB" /* blue */
-#define HL_HTML_COLOR "#000000" /* black */
-#define HL_STRING_COLOR "#DD0000" /* red */
-#define HL_BG_COLOR "#FFFFFF" /* white */
-#define HL_KEYWORD_COLOR "#007700" /* green */
-
-
-typedef struct _zend_syntax_highlighter_ini {
- char *highlight_html;
- char *highlight_comment;
- char *highlight_default;
- char *highlight_string;
- char *highlight_keyword;
-} zend_syntax_highlighter_ini;
-
-
-BEGIN_EXTERN_C()
-ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC);
-ZEND_API void zend_strip(TSRMLS_D);
-ZEND_API int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC);
-ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC);
-ZEND_API void zend_html_putc(char c);
-ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC);
-END_EXTERN_C()
-
-extern zend_syntax_highlighter_ini syntax_highlighter_ini;
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c
deleted file mode 100644
index d036bfdfeb..0000000000
--- a/Zend/zend_indent.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* This indenter doesn't really work, it's here for no particular reason. */
-
-
-#include "zend.h"
-#include "zend_language_parser.h"
-#include "zend_compile.h"
-#include "zend_indent.h"
-
-#define zendtext LANG_SCNG(yy_text)
-#define zendleng LANG_SCNG(yy_leng)
-
-
-static void handle_whitespace(int *emit_whitespace)
-{
- unsigned char c;
- int i;
-
- for (c=0; c<128; c++) {
- if (emit_whitespace[c]>0) {
- for (i=0; i<emit_whitespace[c]; i++) {
- zend_write((char *) &c, 1);
- }
- }
- }
- memset(emit_whitespace, 0, sizeof(int)*256);
-}
-
-
-ZEND_API void zend_indent()
-{
- zval token;
- int token_type;
- int in_string=0;
- int nest_level=0;
- int emit_whitespace[256];
- int i;
- TSRMLS_FETCH();
-
- memset(emit_whitespace, 0, sizeof(int)*256);
-
- /* highlight stuff coming back from zendlex() */
- token.type = 0;
- while ((token_type=lex_scan(&token TSRMLS_CC))) {
- switch (token_type) {
- case T_INLINE_HTML:
- zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
- break;
- case T_WHITESPACE: {
- token.type = 0;
- /* eat whitespace, emit newlines */
- for (i=0; i<LANG_SCNG(yy_leng); i++) {
- emit_whitespace[(unsigned char) LANG_SCNG(yy_text)[i]]++;
- }
- continue;
- }
- break;
- case '"':
- in_string = !in_string;
- /* break missing intentionally */
- default:
- if (token.type==0) {
- /* keyword */
- switch (token_type) {
- case ',':
- ZEND_PUTS(", ");
- goto dflt_printout;
- break;
- case '{':
- nest_level++;
- if (emit_whitespace['\n']>0) {
- ZEND_PUTS(" {\n");
- memset(emit_whitespace, 0, sizeof(int)*256);
- } else {
- ZEND_PUTS("{");
- }
- break;
- case '}':
- nest_level--;
- if (emit_whitespace['\n']==0) {
- ZEND_PUTS("\n");
- }
- for (i=0; i<nest_level; i++) {
- ZEND_PUTS(" ");
- }
- goto dflt_printout;
- break;
-dflt_printout:
- default:
- if (emit_whitespace['\n']>0) {
- for (i=0; i<emit_whitespace['\n']; i++) {
- ZEND_PUTS("\n");
- }
- memset(emit_whitespace, 0, sizeof(int)*256);
- for (i=0; i<nest_level; i++) {
- ZEND_PUTS(" ");
- }
- } else {
- handle_whitespace(emit_whitespace);
- }
- zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
- break;
- }
- } else {
- handle_whitespace(emit_whitespace);
- if (in_string) {
- zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
- /* a part of a string */
- } else {
- zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
- }
- }
- break;
- }
- if (token.type == IS_STRING) {
- switch (token_type) {
- case T_OPEN_TAG:
- case T_CLOSE_TAG:
- case T_WHITESPACE:
- break;
- default:
- efree(token.value.str.val);
- break;
- }
- }
- token.type = 0;
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_indent.h b/Zend/zend_indent.h
deleted file mode 100644
index 45d5c167c0..0000000000
--- a/Zend/zend_indent.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_INDENT_H
-#define ZEND_INDENT_H
-
-ZEND_API void zend_indent(void);
-
-#endif /* ZEND_INDENT_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c
deleted file mode 100644
index 3828adb863..0000000000
--- a/Zend/zend_ini.c
+++ /dev/null
@@ -1,524 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_qsort.h"
-#include "zend_API.h"
-#include "zend_ini.h"
-#include "zend_alloc.h"
-#include "zend_operators.h"
-
-static HashTable *registered_zend_ini_directives;
-
-#define NO_VALUE_PLAINTEXT "no value"
-#define NO_VALUE_HTML "<i>no value</i>"
-
-/*
- * hash_apply functions
- */
-static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number TSRMLS_DC)
-{
- if (ini_entry->module_number == *module_number) {
- return 1;
- } else {
- return 0;
- }
-}
-
-
-static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS_DC)
-{
- if (ini_entry->modified) {
- if (ini_entry->on_modify) {
- ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC);
- }
- efree(ini_entry->value);
- ini_entry->value = ini_entry->orig_value;
- ini_entry->value_length = ini_entry->orig_value_length;
- ini_entry->modified = 0;
- ini_entry->orig_value = NULL;
- ini_entry->orig_value_length = 0;
- }
- return 0;
-}
-
-/*
- * Startup / shutdown
- */
-ZEND_API int zend_ini_startup(TSRMLS_D)
-{
- registered_zend_ini_directives = (HashTable *) malloc(sizeof(HashTable));
-
- EG(ini_directives) = registered_zend_ini_directives;
- if (zend_hash_init_ex(registered_zend_ini_directives, 100, NULL, NULL, 1, 0)==FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-ZEND_API int zend_ini_shutdown(TSRMLS_D)
-{
- zend_hash_destroy(EG(ini_directives));
- free(EG(ini_directives));
- return SUCCESS;
-}
-
-
-ZEND_API int zend_ini_global_shutdown(TSRMLS_D)
-{
- zend_hash_destroy(registered_zend_ini_directives);
- free(registered_zend_ini_directives);
- return SUCCESS;
-}
-
-
-ZEND_API int zend_ini_deactivate(TSRMLS_D)
-{
- zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) zend_restore_ini_entry_cb, (void *) ZEND_INI_STAGE_DEACTIVATE TSRMLS_CC);
- return SUCCESS;
-}
-
-
-#ifdef ZTS
-ZEND_API int zend_copy_ini_directives(TSRMLS_D)
-{
- zend_ini_entry ini_entry;
-
- EG(ini_directives) = (HashTable *) malloc(sizeof(HashTable));
- if (zend_hash_init_ex(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, NULL, 1, 0)==FAILURE) {
- return FAILURE;
- }
- zend_hash_copy(EG(ini_directives), registered_zend_ini_directives, NULL, &ini_entry, sizeof(zend_ini_entry));
- zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC);
- return SUCCESS;
-}
-#endif
-
-
-static int ini_key_compare(const void *a, const void *b TSRMLS_DC)
-{
- Bucket *f;
- Bucket *s;
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- if (f->nKeyLength==0 && s->nKeyLength==0) { /* both numeric */
- return ZEND_NORMALIZE_BOOL(f->nKeyLength - s->nKeyLength);
- } else if (f->nKeyLength==0) { /* f is numeric, s is not */
- return -1;
- } else if (s->nKeyLength==0) { /* s is numeric, f is not */
- return 1;
- } else { /* both strings */
- return zend_binary_strcasecmp(f->arKey, f->nKeyLength, s->arKey, s->nKeyLength);
- }
-}
-
-
-ZEND_API void zend_ini_sort_entries(TSRMLS_D)
-{
- zend_hash_sort(EG(ini_directives), zend_qsort, ini_key_compare, 0 TSRMLS_CC);
-}
-
-/*
- * Registration / unregistration
- */
-
-ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number TSRMLS_DC)
-{
- zend_ini_entry *p = ini_entry;
- zend_ini_entry *hashed_ini_entry;
- zval default_value;
-
- while (p->name) {
- p->module_number = module_number;
- if (zend_hash_add(registered_zend_ini_directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
- zend_unregister_ini_entries(module_number TSRMLS_CC);
- return FAILURE;
- }
- if ((zend_get_configuration_directive(p->name, p->name_length, &default_value))==SUCCESS) {
- if (!hashed_ini_entry->on_modify
- || hashed_ini_entry->on_modify(hashed_ini_entry, default_value.value.str.val, default_value.value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC)==SUCCESS) {
- hashed_ini_entry->value = default_value.value.str.val;
- hashed_ini_entry->value_length = default_value.value.str.len;
- }
- } else {
- if (hashed_ini_entry->on_modify) {
- hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
- }
- }
- p++;
- }
- return SUCCESS;
-}
-
-
-ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC)
-{
- zend_hash_apply_with_argument(registered_zend_ini_directives, (apply_func_arg_t) zend_remove_ini_entries, (void *) &module_number TSRMLS_CC);
-}
-
-
-static int zend_ini_refresh_cache(zend_ini_entry *p, int stage TSRMLS_DC)
-{
- if (p->on_modify) {
- p->on_modify(p, p->value, p->value_length, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage TSRMLS_CC);
- }
- return 0;
-}
-
-
-ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC)
-{
- zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) zend_ini_refresh_cache, (void *)(long) stage TSRMLS_CC);
-}
-
-
-ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage)
-{
- zend_ini_entry *ini_entry;
- char *duplicate;
- TSRMLS_FETCH();
-
- if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) {
- return FAILURE;
- }
-
- if (!(ini_entry->modifyable & modify_type)) {
- return FAILURE;
- }
-
- duplicate = estrndup(new_value, new_value_length);
-
- if (!ini_entry->on_modify
- || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC)==SUCCESS) {
- if (!ini_entry->modified) {
- ini_entry->orig_value = ini_entry->value;
- ini_entry->orig_value_length = ini_entry->value_length;
- } else { /* we already changed the value, free the changed value */
- efree(ini_entry->value);
- }
- ini_entry->value = duplicate;
- ini_entry->value_length = new_value_length;
- ini_entry->modified = 1;
- } else {
- efree(duplicate);
- }
-
- return SUCCESS;
-}
-
-
-ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage)
-{
- zend_ini_entry *ini_entry;
- TSRMLS_FETCH();
-
- if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) {
- return FAILURE;
- }
-
- zend_restore_ini_entry_cb(ini_entry, stage TSRMLS_CC);
- return SUCCESS;
-}
-
-
-ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type))
-{
- zend_ini_entry *ini_entry;
-
- if (zend_hash_find(registered_zend_ini_directives, name, name_length, (void **) &ini_entry)==FAILURE) {
- return FAILURE;
- }
-
- ini_entry->displayer = displayer;
- return SUCCESS;
-}
-
-
-
-/*
- * Data retrieval
- */
-
-ZEND_API long zend_ini_long(char *name, uint name_length, int orig)
-{
- zend_ini_entry *ini_entry;
- TSRMLS_FETCH();
-
- if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
- if (orig && ini_entry->modified) {
- return (ini_entry->orig_value ? strtol(ini_entry->orig_value, NULL, 0) : 0);
- } else if (ini_entry->value) {
- return strtol(ini_entry->value, NULL, 0);
- }
- }
-
- return 0;
-}
-
-
-ZEND_API double zend_ini_double(char *name, uint name_length, int orig)
-{
- zend_ini_entry *ini_entry;
- TSRMLS_FETCH();
-
- if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
- if (orig && ini_entry->modified) {
- return (double) (ini_entry->orig_value ? strtod(ini_entry->orig_value, NULL) : 0.0);
- } else if (ini_entry->value) {
- return (double) strtod(ini_entry->value, NULL);
- }
- }
-
- return 0.0;
-}
-
-
-ZEND_API char *zend_ini_string(char *name, uint name_length, int orig)
-{
- zend_ini_entry *ini_entry;
- TSRMLS_FETCH();
-
- if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
- if (orig && ini_entry->modified) {
- return ini_entry->orig_value;
- } else {
- return ini_entry->value;
- }
- }
-
- return "";
-}
-
-
-static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type)
-{
- if (ini_entry->displayer) {
- ini_entry->displayer(ini_entry, type);
- } else {
- char *display_string;
- uint display_string_length;
-
- if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
- if (ini_entry->orig_value) {
- display_string = ini_entry->orig_value;
- display_string_length = ini_entry->orig_value_length;
- } else {
- if (zend_uv.html_errors) {
- display_string = NO_VALUE_HTML;
- display_string_length = sizeof(NO_VALUE_HTML)-1;
- } else {
- display_string = NO_VALUE_PLAINTEXT;
- display_string_length = sizeof(NO_VALUE_PLAINTEXT)-1;
- }
- }
- } else if (ini_entry->value && ini_entry->value[0]) {
- display_string = ini_entry->value;
- display_string_length = ini_entry->value_length;
- } else {
- if (zend_uv.html_errors) {
- display_string = NO_VALUE_HTML;
- display_string_length = sizeof(NO_VALUE_HTML)-1;
- } else {
- display_string = NO_VALUE_PLAINTEXT;
- display_string_length = sizeof(NO_VALUE_PLAINTEXT)-1;
- }
- }
- ZEND_WRITE(display_string, display_string_length);
- }
-}
-
-
-ZEND_INI_DISP(zend_ini_boolean_displayer_cb)
-{
- int value;
-
- if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = (ini_entry->orig_value ? atoi(ini_entry->orig_value) : 0);
- } else if (ini_entry->value) {
- value = atoi(ini_entry->value);
- } else {
- value = 0;
- }
- if (value) {
- ZEND_PUTS("On");
- } else {
- ZEND_PUTS("Off");
- }
-}
-
-
-ZEND_INI_DISP(zend_ini_color_displayer_cb)
-{
- char *value;
-
- if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
- if (value) {
- if (zend_uv.html_errors) {
- zend_printf("<font style=\"color: %s\">%s</font>", value, value);
- } else {
- ZEND_PUTS(value);
- }
- } else {
- if (zend_uv.html_errors) {
- ZEND_PUTS(NO_VALUE_HTML);
- } else {
- ZEND_PUTS(NO_VALUE_PLAINTEXT);
- }
- }
-}
-
-
-ZEND_INI_DISP(display_link_numbers)
-{
- char *value;
-
- if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
-
- if (value) {
- if (atoi(value)==-1) {
- ZEND_PUTS("Unlimited");
- } else {
- zend_printf("%s", value);
- }
- }
-}
-
-
-/* Standard message handlers */
-
-ZEND_API ZEND_INI_MH(OnUpdateBool)
-{
- zend_bool *p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (zend_bool *) (base+(size_t) mh_arg1);
-
- if (strncasecmp("on", new_value, sizeof("on"))) {
- *p = (zend_bool) atoi(new_value);
- } else {
- *p = (zend_bool) 1;
- }
- return SUCCESS;
-}
-
-
-ZEND_API ZEND_INI_MH(OnUpdateLong)
-{
- long *p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (long *) (base+(size_t) mh_arg1);
-
- *p = zend_atoi(new_value, new_value_length);
- return SUCCESS;
-}
-
-
-ZEND_API ZEND_INI_MH(OnUpdateReal)
-{
- double *p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (double *) (base+(size_t) mh_arg1);
-
- *p = strtod(new_value, NULL);
- return SUCCESS;
-}
-
-
-ZEND_API ZEND_INI_MH(OnUpdateString)
-{
- char **p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (char **) (base+(size_t) mh_arg1);
-
- *p = new_value;
- return SUCCESS;
-}
-
-
-ZEND_API ZEND_INI_MH(OnUpdateStringUnempty)
-{
- char **p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- if (new_value && !new_value[0]) {
- return FAILURE;
- }
-
- p = (char **) (base+(size_t) mh_arg1);
-
- *p = new_value;
- return SUCCESS;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h
deleted file mode 100644
index 5502bf9460..0000000000
--- a/Zend/zend_ini.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_INI_H
-#define ZEND_INI_H
-
-#define ZEND_INI_USER (1<<0)
-#define ZEND_INI_PERDIR (1<<1)
-#define ZEND_INI_SYSTEM (1<<2)
-
-#define ZEND_INI_ALL (ZEND_INI_USER|ZEND_INI_PERDIR|ZEND_INI_SYSTEM)
-
-#ifndef XtOffsetOf
-# if defined(CRAY) || (defined(__arm) && !defined(LINUX))
-# ifdef __STDC__
-# define XtOffset(p_type, field) _Offsetof(p_type, field)
-# else
-# ifdef CRAY2
-# define XtOffset(p_type, field) \
- (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
-
-# else /* !CRAY2 */
-
-# define XtOffset(p_type, field) ((unsigned int)&(((p_type)NULL)->field))
-
-# endif /* !CRAY2 */
-# endif /* __STDC__ */
-# else /* ! (CRAY || __arm) */
-
-# define XtOffset(p_type, field) \
- ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
-
-# endif /* !CRAY */
-
-# ifdef offsetof
-# define XtOffsetOf(s_type, field) offsetof(s_type, field)
-# else
-# define XtOffsetOf(s_type, field) XtOffset(s_type*, field)
-# endif
-
-#endif
-
-typedef struct _zend_ini_entry zend_ini_entry;
-
-#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC)
-#define ZEND_INI_DISP(name) void name(zend_ini_entry *ini_entry, int type)
-
-struct _zend_ini_entry {
- int module_number;
- int modifyable;
- char *name;
- uint name_length;
- ZEND_INI_MH((*on_modify));
- void *mh_arg1;
- void *mh_arg2;
- void *mh_arg3;
-
- char *value;
- uint value_length;
-
- char *orig_value;
- uint orig_value_length;
- int modified;
-
- void (*displayer)(zend_ini_entry *ini_entry, int type);
-};
-
-
-ZEND_API int zend_ini_startup(TSRMLS_D);
-ZEND_API int zend_ini_shutdown(TSRMLS_D);
-ZEND_API int zend_ini_global_shutdown(TSRMLS_D);
-ZEND_API int zend_ini_deactivate(TSRMLS_D);
-
-ZEND_API int zend_copy_ini_directives(TSRMLS_D);
-
-ZEND_API void zend_ini_sort_entries(TSRMLS_D);
-
-ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number TSRMLS_DC);
-ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC);
-ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC);
-ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage);
-ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage);
-ZEND_API void display_ini_entries(zend_module_entry *module);
-
-ZEND_API long zend_ini_long(char *name, uint name_length, int orig);
-ZEND_API double zend_ini_double(char *name, uint name_length, int orig);
-ZEND_API char *zend_ini_string(char *name, uint name_length, int orig);
-
-ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type));
-
-ZEND_API ZEND_INI_DISP(zend_ini_boolean_displayer_cb);
-ZEND_API ZEND_INI_DISP(zend_ini_color_displayer_cb);
-ZEND_API ZEND_INI_DISP(display_link_numbers);
-
-#define ZEND_INI_BEGIN() static zend_ini_entry ini_entries[] = {
-#define ZEND_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, NULL } };
-
-#define ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, displayer) \
- { 0, modifyable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, displayer },
-
-#define ZEND_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, arg3) \
- ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, NULL)
-
-#define ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, displayer) \
- ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL, displayer)
-
-#define ZEND_INI_ENTRY2(name, default_value, modifyable, on_modify, arg1, arg2) \
- ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL)
-
-#define ZEND_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, displayer) \
- ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, NULL, NULL, displayer)
-
-#define ZEND_INI_ENTRY1(name, default_value, modifyable, on_modify, arg1) \
- ZEND_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, NULL)
-
-#define ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, displayer) \
- ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, NULL, NULL, NULL, displayer)
-
-#define ZEND_INI_ENTRY(name, default_value, modifyable, on_modify) \
- ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, NULL)
-
-#ifdef ZTS
-#define STD_ZEND_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
- ZEND_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id)
-#define STD_ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \
- ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, displayer)
-#define STD_ZEND_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
- ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, NULL, zend_ini_boolean_displayer_cb)
-#else
-#define STD_ZEND_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
- ZEND_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr)
-#define STD_ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \
- ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, displayer)
-#define STD_ZEND_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
- ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, zend_ini_boolean_displayer_cb)
-#endif
-
-#define INI_INT(name) zend_ini_long((name), sizeof(name), 0)
-#define INI_FLT(name) zend_ini_double((name), sizeof(name), 0)
-#define INI_STR(name) zend_ini_string((name), sizeof(name), 0)
-#define INI_BOOL(name) ((zend_bool) INI_INT(name))
-
-#define INI_ORIG_INT(name) zend_ini_long((name), sizeof(name), 1)
-#define INI_ORIG_FLT(name) zend_ini_double((name), sizeof(name), 1)
-#define INI_ORIG_STR(name) zend_ini_string((name), sizeof(name), 1)
-#define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name))
-
-
-#define REGISTER_INI_ENTRIES() zend_register_ini_entries(ini_entries, module_number TSRMLS_CC)
-#define UNREGISTER_INI_ENTRIES() zend_unregister_ini_entries(module_number TSRMLS_CC)
-#define DISPLAY_INI_ENTRIES() display_ini_entries(zend_module)
-
-#define REGISTER_INI_DISPLAYER(name, displayer) zend_ini_register_displayer((name), sizeof(name), displayer)
-#define REGISTER_INI_BOOLEAN(name) REGISTER_INI_DISPLAYER(name, zend_ini_boolean_displayer_cb)
-
-/* Standard message handlers */
-ZEND_API ZEND_INI_MH(OnUpdateBool);
-ZEND_API ZEND_INI_MH(OnUpdateLong);
-ZEND_API ZEND_INI_MH(OnUpdateReal);
-ZEND_API ZEND_INI_MH(OnUpdateString);
-ZEND_API ZEND_INI_MH(OnUpdateStringUnempty);
-
-
-#define ZEND_INI_DISPLAY_ORIG 1
-#define ZEND_INI_DISPLAY_ACTIVE 2
-
-#define ZEND_INI_STAGE_STARTUP (1<<0)
-#define ZEND_INI_STAGE_SHUTDOWN (1<<1)
-#define ZEND_INI_STAGE_ACTIVATE (1<<2)
-#define ZEND_INI_STAGE_DEACTIVATE (1<<3)
-#define ZEND_INI_STAGE_RUNTIME (1<<4)
-
-/* INI parsing engine */
-typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, int callback_type, void *arg);
-int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg);
-#define ZEND_INI_PARSER_ENTRY 1
-#define ZEND_INI_PARSER_SECTION 2
-#define ZEND_INI_PARSER_POP_ENTRY 3
-
-typedef struct _zend_ini_parser_param {
- zend_ini_parser_cb_t ini_parser_cb;
- void *arg;
-} zend_ini_parser_param;
-
-#endif /* ZEND_INI_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y
deleted file mode 100644
index 0f9e4d7ba4..0000000000
--- a/Zend/zend_ini_parser.y
+++ /dev/null
@@ -1,238 +0,0 @@
-%{
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#define DEBUG_CFG_PARSER 0
-#include "zend.h"
-#include "zend_API.h"
-#include "zend_ini.h"
-#include "zend_constants.h"
-#include "zend_ini_scanner.h"
-#include "zend_extensions.h"
-
-#define YYSTYPE zval
-
-#ifdef ZTS
-#define YYPARSE_PARAM tsrm_ls
-#define YYLEX_PARAM tsrm_ls
-#endif
-
-#define ZEND_INI_PARSER_CB (CG(ini_parser_param))->ini_parser_cb
-#define ZEND_INI_PARSER_ARG (CG(ini_parser_param))->arg
-
-int ini_lex(zval *ini_lval TSRMLS_DC);
-#ifdef ZTS
-int ini_parse(void *arg);
-#else
-int ini_parse(void);
-#endif
-
-zval yylval;
-
-#ifndef ZTS
-extern int ini_lex(zval *ini_lval TSRMLS_DC);
-extern FILE *ini_in;
-extern void init_cfg_scanner(void);
-#endif
-
-void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
-{
- int i_result;
- int i_op1, i_op2;
- char str_result[MAX_LENGTH_OF_LONG];
-
- i_op1 = atoi(op1->value.str.val);
- free(op1->value.str.val);
- if (op2) {
- i_op2 = atoi(op2->value.str.val);
- free(op2->value.str.val);
- } else {
- i_op2 = 0;
- }
-
- switch (type) {
- case '|':
- i_result = i_op1 | i_op2;
- break;
- case '&':
- i_result = i_op1 & i_op2;
- break;
- case '~':
- i_result = ~i_op1;
- break;
- case '!':
- i_result = !i_op1;
- break;
- default:
- i_result = 0;
- break;
- }
-
- result->value.str.len = zend_sprintf(str_result, "%d", i_result);
- result->value.str.val = (char *) malloc(result->value.str.len+1);
- memcpy(result->value.str.val, str_result, result->value.str.len);
- result->value.str.val[result->value.str.len] = 0;
- result->type = IS_STRING;
-}
-
-
-void zend_ini_get_constant(zval *result, zval *name)
-{
- zval z_constant;
- TSRMLS_FETCH();
-
- if (zend_get_constant(name->value.str.val, name->value.str.len, &z_constant TSRMLS_CC)) {
- /* z_constant is emalloc()'d */
- convert_to_string(&z_constant);
- result->value.str.val = zend_strndup(z_constant.value.str.val, z_constant.value.str.len);
- result->value.str.len = z_constant.value.str.len;
- result->type = z_constant.type;
- zval_dtor(&z_constant);
- free(name->value.str.val);
- } else {
- *result = *name;
- }
-}
-
-
-static void ini_error(char *str)
-{
- char *error_buf;
- int error_buf_len;
- char *currently_parsed_filename;
- TSRMLS_FETCH();
-
- currently_parsed_filename = zend_ini_scanner_get_filename(TSRMLS_C);
- error_buf_len = 128+strlen(currently_parsed_filename); /* should be more than enough */
- error_buf = (char *) emalloc(error_buf_len);
-
- sprintf(error_buf, "Error parsing %s on line %d\n", currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C));
-
- if (CG(ini_parser_unbuffered_errors)) {
-#ifdef PHP_WIN32
- MessageBox(NULL, error_buf, "PHP Error", MB_OK|MB_TOPMOST|0x00200000L);
-#else
- fprintf(stderr, "PHP: %s", error_buf);
-#endif
- } else {
- zend_error(E_WARNING, error_buf);
- }
- efree(error_buf);
-}
-
-
-int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg)
-{
- int retval;
- zend_ini_parser_param ini_parser_param;
- TSRMLS_FETCH();
-
- ini_parser_param.ini_parser_cb = ini_parser_cb;
- ini_parser_param.arg = arg;
-
- CG(ini_parser_param) = &ini_parser_param;
- if (zend_ini_open_file_for_scanning(fh TSRMLS_CC)==FAILURE) {
- return FAILURE;
- }
-
- CG(ini_parser_unbuffered_errors) = unbuffered_errors;
- retval = ini_parse(TSRMLS_C);
-
- zend_ini_close_file(fh TSRMLS_CC);
-
- if (retval==0) {
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-
-%}
-
-%pure_parser
-%token TC_STRING
-%token TC_ENCAPSULATED_STRING
-%token BRACK
-%token SECTION
-%token CFG_TRUE
-%token CFG_FALSE
-%left '|' '&'
-%right '~' '!'
-
-%%
-
-statement_list:
- statement_list statement
- | /* empty */
-;
-
-statement:
- TC_STRING '=' string_or_value {
-#if DEBUG_CFG_PARSER
- printf("'%s' = '%s'\n", $1.value.str.val, $3.value.str.val);
-#endif
- ZEND_INI_PARSER_CB(&$1, &$3, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG);
- free($1.value.str.val);
- free($3.value.str.val);
- }
- | TC_STRING BRACK '=' string_or_value {
-#if DEBUG_CFG_PARSER
- printf("'%s'[ ] = '%s'\n", $1.value.str.val, $4.value.str.val);
-#endif
- ZEND_INI_PARSER_CB(&$1, &$4, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG);
- free($1.value.str.val);
- free($4.value.str.val);
- }
- | TC_STRING { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); free($1.value.str.val); }
- | SECTION { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG); free($1.value.str.val); }
- | '\n'
-;
-
-
-string_or_value:
- expr { $$ = $1; }
- | TC_ENCAPSULATED_STRING { $$ = $1; }
- | CFG_TRUE { $$ = $1; }
- | CFG_FALSE { $$ = $1; }
- | '\n' { $$.value.str.val = strdup(""); $$.value.str.len=0; $$.type = IS_STRING; }
- | '\0' { $$.value.str.val = strdup(""); $$.value.str.len=0; $$.type = IS_STRING; }
-;
-
-expr:
- constant_string { $$ = $1; }
- | expr '|' expr { zend_ini_do_op('|', &$$, &$1, &$3); }
- | expr '&' expr { zend_ini_do_op('&', &$$, &$1, &$3); }
- | '~' expr { zend_ini_do_op('~', &$$, &$2, NULL); }
- | '!' expr { zend_ini_do_op('!', &$$, &$2, NULL); }
- | '(' expr ')' { $$ = $2; }
-;
-
-constant_string:
- TC_STRING { zend_ini_get_constant(&$$, &$1); }
-;
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_ini_scanner.h b/Zend/zend_ini_scanner.h
deleted file mode 100644
index ab55393a7f..0000000000
--- a/Zend/zend_ini_scanner.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef _ZEND_INI_SCANNER_H
-#define _ZEND_INI_SCANNER_H
-
-BEGIN_EXTERN_C()
-int zend_ini_scanner_get_lineno(TSRMLS_D);
-char *zend_ini_scanner_get_filename(TSRMLS_D);
-int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC);
-void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC);
-int ini_lex(zval *ini_lval TSRMLS_DC);
-END_EXTERN_C()
-
-#endif /* _ZEND_INI_SCANNER_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l
deleted file mode 100644
index fb85c101ff..0000000000
--- a/Zend/zend_ini_scanner.l
+++ /dev/null
@@ -1,226 +0,0 @@
-%{
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#define yyleng SCNG(yy_leng)
-#define yytext SCNG(yy_text)
-#define yytext_ptr SCNG(yy_text)
-#define yyin SCNG(yy_in)
-#define yyout SCNG(yy_out)
-#define yy_last_accepting_state SCNG(_yy_last_accepting_state)
-#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos)
-#define yy_more_flag SCNG(_yy_more_flag)
-#define yy_more_len SCNG(_yy_more_len)
-
-#include <errno.h>
-#include "zend.h"
-#include "zend_globals.h"
-#include "zend_ini_parser.h"
-#include "zend_ini_scanner.h"
-
-#undef YYSTYPE
-#define YYSTYPE zval
-
-#define YY_DECL int ini_lex(zval *ini_lval TSRMLS_DC)
-
-/* Globals Macros */
-#define SCNG INI_SCNG
-#ifdef ZTS
-ZEND_API ts_rsrc_id ini_scanner_globals_id;
-#else
-ZEND_API zend_scanner_globals ini_scanner_globals;
-#endif
-
-
-static char *ini_filename;
-
-void init_ini_scanner(TSRMLS_D)
-{
- SCNG(lineno)=1;
-}
-
-
-int zend_ini_scanner_get_lineno(TSRMLS_D)
-{
- return SCNG(lineno);
-}
-
-
-char *zend_ini_scanner_get_filename(TSRMLS_D)
-{
- return ini_filename;
-}
-
-
-int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC)
-{
- if (FAILURE == zend_stream_fixup(fh TSRMLS_CC)) {
- return FAILURE;
- }
-
- init_ini_scanner(TSRMLS_C);
- yyin = fh;
- yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC);
- ini_filename = fh->filename;
- return SUCCESS;
-}
-
-
-void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC)
-{
- zend_stream_close(fh);
-}
-
-%}
-
-NEWLINE ("\r"|"\n"|"\r\n")
-
-%option noyywrap
-%option never-interactive
-
-%%
-
-<INITIAL>[ ]*[\[][ ]*[\]][ ]* {
- return BRACK;
-}
-
-<INITIAL>[ ]*("true"|"on"|"yes")[ ]* {
- ini_lval->value.str.val = zend_strndup("1", 1);
- ini_lval->value.str.len = 1;
- ini_lval->type = IS_STRING;
- return CFG_TRUE;
-}
-
-
-<INITIAL>[ ]*("false"|"off"|"no"|"none")[ ]* {
- ini_lval->value.str.val = zend_strndup("", 0);
- ini_lval->value.str.len = 0;
- ini_lval->type = IS_STRING;
- return CFG_FALSE;
-}
-
-<INITIAL>[[][^[]+[\]][ ]*{NEWLINE}? {
- /* SECTION */
-
- /* eat trailng and spaces ] */
- while (yyleng>0 && (yytext[yyleng-1]=='\n' || yytext[yyleng-1]=='\r' || yytext[yyleng-1]==']' || yytext[yyleng-1]==' ')) {
- yyleng--;
- yytext[yyleng]=0;
- }
-
- SCNG(lineno)++;
-
- /* eat leading [ */
- yytext++;
- yyleng--;
-
- ini_lval->value.str.val = zend_strndup(yytext, yyleng);
- ini_lval->value.str.len = yyleng;
- ini_lval->type = IS_STRING;
- return SECTION;
-}
-
-
-<INITIAL>["][^"]*["] {
- /* ENCAPSULATED TC_STRING */
-
- /* eat trailing " */
- yytext[yyleng-1]=0;
-
- /* eat leading " */
- yytext++;
-
- ini_lval->value.str.val = zend_strndup(yytext, yyleng - 2);
- ini_lval->value.str.len = yyleng - 2;
- ini_lval->type = IS_STRING;
- return TC_ENCAPSULATED_STRING;
-}
-
-<INITIAL>[&|~()!] {
- return yytext[0];
-}
-
-
-<INITIAL>[^=\n\r\t;|&~()!"\[]+ {
- /* STRING */
- register int i;
-
- /* eat trailing whitespace */
- for (i=yyleng-1; i>=0; i--) {
- if (yytext[i]==' ' || yytext[i]=='\t') {
- yytext[i]=0;
- yyleng--;
- } else {
- break;
- }
- }
- /* eat leading whitespace */
- while (yytext[0]) {
- if (yytext[0]==' ' || yytext[0]=='\t') {
- yytext++;
- yyleng--;
- } else {
- break;
- }
- }
- if (yyleng!=0) {
- ini_lval->value.str.val = zend_strndup(yytext, yyleng);
- ini_lval->value.str.len = yyleng;
- ini_lval->type = IS_STRING;
- return TC_STRING;
- } else {
- /* whitespace */
- }
-}
-
-
-
-<INITIAL>[=\n] {
- if (yytext[0] == '\n') {
- SCNG(lineno)++;
- }
- return yytext[0];
-}
-
-<INITIAL>{NEWLINE} {
- SCNG(lineno)++;
- return '\n';
-}
-
-<INITIAL>[;][^\r\n]*{NEWLINE}? {
- /* comment */
- SCNG(lineno)++;
- return '\n';
-}
-
-<INITIAL>[ \t] {
- /* eat whitespace */
-}
-
-<INITIAL>. {
-#if DEBUG
- php_error(E_NOTICE,"Unexpected character on line %d: '%s' (ASCII %d)\n", yylineno, yytext, yytext[0]);
-#endif
-}
-
-<<EOF>> {
- yy_delete_buffer(YY_CURRENT_BUFFER TSRMLS_CC);
- yyterminate();
-}
diff --git a/Zend/zend_istdiostream.h b/Zend/zend_istdiostream.h
deleted file mode 100644
index b4dc9a8db7..0000000000
--- a/Zend/zend_istdiostream.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef _ZEND_STDIOSTREAM
-#define _ZEND_STDIOSTREAM
-
-#if defined(ZTS) && !defined(HAVE_CLASS_ISTDIOSTREAM)
-class istdiostream : public istream
-{
-private:
- stdiobuf _file;
-public:
- istdiostream (FILE* __f) : istream(), _file(__f) { init(&_file); }
- stdiobuf* rdbuf()/* const */ { return &_file; }
-};
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
deleted file mode 100644
index 1b2d116cbb..0000000000
--- a/Zend/zend_language_parser.y
+++ /dev/null
@@ -1,974 +0,0 @@
-%{
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- * LALR shift/reduce conflicts and how they are resolved:
- *
- * - 2 shift/reduce conflicts due to the dangeling elseif/else ambiguity. Solved by shift.
- * - 1 shift/reduce conflict due to arrays within encapsulated strings. Solved by shift.
- * - 1 shift/reduce conflict due to objects within encapsulated strings. Solved by shift.
- *
- */
-
-
-#include "zend_compile.h"
-#include "zend.h"
-#include "zend_list.h"
-#include "zend_globals.h"
-#include "zend_API.h"
-
-#define YYERROR_VERBOSE
-#define YYSTYPE znode
-#ifdef ZTS
-# define YYPARSE_PARAM tsrm_ls
-# define YYLEX_PARAM tsrm_ls
-#endif
-
-
-%}
-
-%pure_parser
-%expect 4
-
-%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
-%left ','
-%left T_LOGICAL_OR
-%left T_LOGICAL_XOR
-%left T_LOGICAL_AND
-%right T_PRINT
-%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL
-%left '?' ':'
-%left T_BOOLEAN_OR
-%left T_BOOLEAN_AND
-%left '|'
-%left '^'
-%left '&'
-%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL
-%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
-%left T_SL T_SR
-%left '+' '-' '.'
-%left '*' '/' '%'
-%right '!' '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
-%right '['
-%nonassoc T_NEW T_INSTANCEOF
-%token T_EXIT
-%token T_IF
-%left T_ELSEIF
-%left T_ELSE
-%left T_ENDIF
-%token T_LNUMBER
-%token T_DNUMBER
-%token T_STRING
-%token T_STRING_VARNAME
-%token T_VARIABLE
-%token T_NUM_STRING
-%token T_INLINE_HTML
-%token T_CHARACTER
-%token T_BAD_CHARACTER
-%token T_ENCAPSED_AND_WHITESPACE
-%token T_CONSTANT_ENCAPSED_STRING
-%token T_ECHO
-%token T_DO
-%token T_WHILE
-%token T_ENDWHILE
-%token T_FOR
-%token T_ENDFOR
-%token T_FOREACH
-%token T_ENDFOREACH
-%token T_DECLARE
-%token T_ENDDECLARE
-%token T_INSTANCEOF
-%token T_AS
-%token T_SWITCH
-%token T_ENDSWITCH
-%token T_CASE
-%token T_DEFAULT
-%token T_BREAK
-%token T_CONTINUE
-%token T_FUNCTION
-%token T_CONST
-%token T_RETURN
-%token T_TRY
-%token T_CATCH
-%token T_THROW
-%token T_USE
-%token T_GLOBAL
-%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC
-%token T_VAR
-%token T_UNSET
-%token T_ISSET
-%token T_EMPTY
-%token T_CLASS
-%token T_INTERFACE
-%token T_EXTENDS
-%token T_IMPLEMENTS
-%token T_OBJECT_OPERATOR
-%token T_DOUBLE_ARROW
-%token T_LIST
-%token T_ARRAY
-%token T_CLASS_C
-%token T_FUNC_C
-%token T_LINE
-%token T_FILE
-%token T_NAMESPACE_C
-%token T_COMMENT
-%token T_DOC_COMMENT
-%token T_OPEN_TAG
-%token T_OPEN_TAG_WITH_ECHO
-%token T_CLOSE_TAG
-%token T_WHITESPACE
-%token T_START_HEREDOC
-%token T_END_HEREDOC
-%token T_DOLLAR_OPEN_CURLY_BRACES
-%token T_CURLY_OPEN
-%token T_PAAMAYIM_NEKUDOTAYIM
-%token T_IMPORT T_FROM
-%token T_NAMESPACE_NAME
-%token T_NAMESPACE
-
-%% /* Rules */
-
-start:
- top_statement_list
-;
-
-top_statement_list:
- top_statement_list { zend_do_extended_info(TSRMLS_C); } top_statement { HANDLE_INTERACTIVE(); }
- | /* empty */
-;
-
-
-top_statement:
- statement
- | function_declaration_statement { zend_do_early_binding(TSRMLS_C); }
- | class_declaration_statement
- | namespace_declaration_statement
-;
-
-
-inner_statement_list:
- inner_statement_list { zend_do_extended_info(TSRMLS_C); } inner_statement { HANDLE_INTERACTIVE(); }
- | /* empty */
-;
-
-
-inner_statement:
- statement
- | function_declaration_statement
- | class_declaration_statement
-;
-
-
-statement:
- unticked_statement { zend_do_ticks(TSRMLS_C); RESET_DOC_COMMENT(); }
-;
-
-unticked_statement:
- '{' inner_statement_list '}'
- | T_IF '(' expr ')' { zend_do_if_cond(&$3, &$4 TSRMLS_CC); } statement { zend_do_if_after_statement(&$4, 1 TSRMLS_CC); } elseif_list else_single { zend_do_if_end(TSRMLS_C); }
- | T_IF '(' expr ')' ':' { zend_do_if_cond(&$3, &$4 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$4, 1 TSRMLS_CC); } new_elseif_list new_else_single T_ENDIF ';' { zend_do_if_end(TSRMLS_C); }
- | T_WHILE '(' { $1.u.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' { zend_do_while_cond(&$4, &$5 TSRMLS_CC); } while_statement { zend_do_while_end(&$1, &$5 TSRMLS_CC); }
- | T_DO { $1.u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_do_while_begin(TSRMLS_C); } statement T_WHILE '(' { $5.u.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' ';' { zend_do_do_while_end(&$1, &$5, &$7 TSRMLS_CC); }
- | T_FOR
- '('
- for_expr
- ';' { zend_do_free(&$3 TSRMLS_CC); $4.u.opline_num = get_next_op_number(CG(active_op_array)); }
- for_expr
- ';' { zend_do_extended_info(TSRMLS_C); zend_do_for_cond(&$6, &$7 TSRMLS_CC); }
- for_expr
- ')' { zend_do_free(&$9 TSRMLS_CC); zend_do_for_before_statement(&$4, &$7 TSRMLS_CC); }
- for_statement { zend_do_for_end(&$7 TSRMLS_CC); }
- | T_SWITCH '(' expr ')' { zend_do_switch_cond(&$3 TSRMLS_CC); } switch_case_list { zend_do_switch_end(&$6 TSRMLS_CC); }
- | T_BREAK ';' { zend_do_brk_cont(ZEND_BRK, NULL TSRMLS_CC); }
- | T_BREAK expr ';' { zend_do_brk_cont(ZEND_BRK, &$2 TSRMLS_CC); }
- | T_CONTINUE ';' { zend_do_brk_cont(ZEND_CONT, NULL TSRMLS_CC); }
- | T_CONTINUE expr ';' { zend_do_brk_cont(ZEND_CONT, &$2 TSRMLS_CC); }
- | T_RETURN ';' { zend_do_return(NULL, 0 TSRMLS_CC); }
- | T_RETURN expr_without_variable ';' { zend_do_return(&$2, 0 TSRMLS_CC); }
- | T_RETURN variable ';' { zend_do_return(&$2, 1 TSRMLS_CC); }
- | T_GLOBAL global_var_list ';'
- | T_STATIC static_var_list ';'
- | T_ECHO echo_expr_list ';'
- | T_INLINE_HTML { zend_do_echo(&$1 TSRMLS_CC); }
- | expr ';' { zend_do_free(&$1 TSRMLS_CC); }
- | T_USE use_filename ';' { zend_error(E_COMPILE_ERROR,"use: Not yet supported. Please use include_once() or require_once()"); zval_dtor(&$2.u.constant); }
- | T_UNSET '(' unset_variables ')' ';'
- | T_FOREACH '(' variable T_AS { zend_do_foreach_begin(&$1, &$3, &$2, &$4, 1 TSRMLS_CC); } w_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$6, &$7, &$4 TSRMLS_CC); } foreach_statement { zend_do_foreach_end(&$1, &$2 TSRMLS_CC); }
- | T_FOREACH '(' expr_without_variable T_AS { zend_do_foreach_begin(&$1, &$3, &$2, &$4, 0 TSRMLS_CC); } w_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$6, &$7, &$4 TSRMLS_CC); } foreach_statement { zend_do_foreach_end(&$1, &$2 TSRMLS_CC); }
- | T_DECLARE { $1.u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); }
- | ';' /* empty statement */
- | T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}'
- T_CATCH '(' fully_qualified_class_name T_VARIABLE ')' { zend_do_begin_catch(&$1, &$8, &$9, 1 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
- additional_catches
- | T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); }
- | T_IMPORT { zend_do_begin_import(TSRMLS_C); } import_rule T_FROM import_namespace { zend_do_end_import(&$5 TSRMLS_CC); } ';'
-;
-
-
-import_rule:
- '*' { zend_do_import(T_FUNCTION, NULL TSRMLS_CC); zend_do_import(T_CLASS, NULL TSRMLS_CC); zend_do_import(T_CONST, NULL TSRMLS_CC); }
- | import_commands
-;
-
-import_commands:
- import_commands ',' import_command
- | import_command
-;
-
-import_command:
- T_FUNCTION T_STRING { zend_do_import(T_FUNCTION, &$2 TSRMLS_CC); }
- | T_CLASS T_STRING { zend_do_import(T_CLASS, &$2 TSRMLS_CC); }
- | T_CONST T_STRING { zend_do_import(T_CONST, &$2 TSRMLS_CC); }
- | T_FUNCTION '*' { zend_do_import(T_FUNCTION, NULL TSRMLS_CC); }
- | T_CLASS '*' { zend_do_import(T_CLASS, NULL TSRMLS_CC); }
- | T_CONST '*' { zend_do_import(T_CONST, NULL TSRMLS_CC); }
-;
-
-additional_catches:
- non_empty_additional_catches
- | /* empty */
-;
-
-non_empty_additional_catches:
- non_empty_additional_catches T_CATCH '(' fully_qualified_class_name T_VARIABLE ')' { zend_do_begin_catch(&$2, &$4, &$5, 0 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$2 TSRMLS_CC); }
- | T_CATCH '(' fully_qualified_class_name T_VARIABLE ')' { zend_do_begin_catch(&$1, &$3, &$4, 0 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
-;
-
-
-unset_variables:
- unset_variable
- | unset_variables ',' unset_variable
-;
-
-unset_variable:
- variable { zend_do_end_variable_parse(BP_VAR_UNSET, 0 TSRMLS_CC); zend_do_unset(&$1 TSRMLS_CC); }
-;
-
-use_filename:
- T_CONSTANT_ENCAPSED_STRING { $$ = $1; }
- | '(' T_CONSTANT_ENCAPSED_STRING ')' { $$ = $2; }
-;
-
-
-function_declaration_statement:
- unticked_function_declaration_statement { zend_do_ticks(TSRMLS_C); }
-;
-
-class_declaration_statement:
- unticked_class_declaration_statement { zend_do_ticks(TSRMLS_C); }
-;
-
-
-is_reference:
- /* empty */ { $$.op_type = ZEND_RETURN_VAL; }
- | '&' { $$.op_type = ZEND_RETURN_REF; }
-;
-
-
-unticked_function_declaration_statement:
- T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 0, $3.op_type, NULL TSRMLS_CC); }
- '(' parameter_list ')' '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
-;
-
-unticked_class_declaration_statement:
- class_entry_type T_STRING extends_from
- { zend_do_begin_class_declaration(&$1, &$2, &$3 TSRMLS_CC); }
- implements_list
- '{'
- class_statement_list
- '}' { zend_do_end_class_declaration(&$1, &$2 TSRMLS_CC); }
-;
-
-
-class_entry_type:
- T_CLASS { $$.u.constant.value.lval = 0; }
- | T_ABSTRACT T_CLASS { $$.u.constant.value.lval = ZEND_ACC_ABSTRACT_CLASS; }
- | T_INTERFACE { $$.u.constant.value.lval = ZEND_ACC_INTERFACE; }
-;
-
-namespace_declaration_statement:
- T_NAMESPACE namespace_name '{' { zend_do_begin_namespace(&$1, &$2 TSRMLS_CC); } namespace_statement_list '}' { zend_do_end_namespace(&$1 TSRMLS_CC); }
-;
-
-namespace_statement_list:
- namespace_statement_list namespace_statement
- | /* empty */
-;
-
-namespace_statement:
- T_VAR namespace_var_declaration_list ';'
- | namespace_const_declaration ';'
- | function_declaration_statement
- | class_declaration_statement
-;
-
-namespace_var_declaration_list:
- namespace_var_declaration_list ',' namespace_var_declaration
- | namespace_var_declaration
-;
-
-namespace_var_declaration:
- T_VARIABLE { zend_do_declare_namespace_var(&$1, NULL TSRMLS_CC); }
- | T_VARIABLE '=' static_scalar { zend_do_declare_namespace_var(&$1, &$3 TSRMLS_CC); }
-;
-
-namespace_const_declaration:
- namespace_const_declaration ',' T_STRING '=' const_scalar_expr { zend_do_declare_namespace_constant(&$3, &$5 TSRMLS_CC); }
- | T_CONST T_STRING '=' const_scalar_expr { zend_do_declare_namespace_constant(&$2, &$4 TSRMLS_CC); }
-;
-
-extends_from:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | T_EXTENDS fully_qualified_class_name { $$ = $2; }
-;
-
-implements_list:
- /* empty */
- | T_IMPLEMENTS interface_list
-;
-
-interface_list:
- fully_qualified_class_name { zend_do_implements_interface(&$1 TSRMLS_CC); }
- | interface_list ',' fully_qualified_class_name { zend_do_implements_interface(&$3 TSRMLS_CC); }
-;
-
-foreach_optional_arg:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | T_DOUBLE_ARROW w_variable { $$ = $2; }
-;
-
-for_statement:
- statement
- | ':' inner_statement_list T_ENDFOR ';'
-;
-
-
-foreach_statement:
- statement
- | ':' inner_statement_list T_ENDFOREACH ';'
-;
-
-
-declare_statement:
- statement
- | ':' inner_statement_list T_ENDDECLARE ';'
-;
-
-
-declare_list:
- T_STRING '=' static_scalar { zend_do_declare_stmt(&$1, &$3 TSRMLS_CC); }
- | declare_list ',' T_STRING '=' static_scalar { zend_do_declare_stmt(&$3, &$5 TSRMLS_CC); }
-;
-
-
-switch_case_list:
- '{' case_list '}' { $$ = $2; }
- | '{' ';' case_list '}' { $$ = $3; }
- | ':' case_list T_ENDSWITCH ';' { $$ = $2; }
- | ':' ';' case_list T_ENDSWITCH ';' { $$ = $3; }
-;
-
-
-case_list:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | case_list T_CASE expr case_separator { zend_do_extended_info(TSRMLS_C); zend_do_case_before_statement(&$1, &$2, &$3 TSRMLS_CC); } inner_statement_list { zend_do_case_after_statement(&$$, &$2 TSRMLS_CC); $$.op_type = IS_CONST; }
- | case_list T_DEFAULT case_separator { zend_do_extended_info(TSRMLS_C); zend_do_default_before_statement(&$1, &$2 TSRMLS_CC); } inner_statement_list { zend_do_case_after_statement(&$$, &$2 TSRMLS_CC); $$.op_type = IS_CONST; }
-;
-
-
-case_separator:
- ':'
- | ';'
-;
-
-
-while_statement:
- statement
- | ':' inner_statement_list T_ENDWHILE ';'
-;
-
-
-
-elseif_list:
- /* empty */
- | elseif_list T_ELSEIF '(' expr ')' { zend_do_if_cond(&$4, &$5 TSRMLS_CC); } statement { zend_do_if_after_statement(&$5, 0 TSRMLS_CC); }
-;
-
-
-new_elseif_list:
- /* empty */
- | new_elseif_list T_ELSEIF '(' expr ')' ':' { zend_do_if_cond(&$4, &$5 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$5, 0 TSRMLS_CC); }
-;
-
-
-else_single:
- /* empty */
- | T_ELSE statement
-;
-
-
-new_else_single:
- /* empty */
- | T_ELSE ':' inner_statement_list
-;
-
-
-parameter_list:
- non_empty_parameter_list
- | /* empty */
-;
-
-
-non_empty_parameter_list:
- optional_class_type T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$1, BYREF_NONE TSRMLS_CC); }
- | optional_class_type '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$1, BYREF_FORCE TSRMLS_CC); }
- | optional_class_type '&' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$5, &$1, BYREF_FORCE TSRMLS_CC); }
- | T_CONST optional_class_type T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$2, BYREF_NONE TSRMLS_CC); }
- | optional_class_type T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$2, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$4, &$1, BYREF_NONE TSRMLS_CC); }
- | non_empty_parameter_list ',' optional_class_type T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$3, BYREF_NONE TSRMLS_CC); }
- | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$5, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$3, BYREF_FORCE TSRMLS_CC); }
- | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$5, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$7, &$3, BYREF_FORCE TSRMLS_CC); }
- | non_empty_parameter_list ',' T_CONST optional_class_type T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$5, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$4, BYREF_NONE TSRMLS_CC); }
- | non_empty_parameter_list ',' optional_class_type T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$4, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$6, &$3, BYREF_NONE TSRMLS_CC); }
-;
-
-
-optional_class_type:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | fully_qualified_class_name { $$ = $1; }
-;
-
-function_call_parameter_list:
- non_empty_function_call_parameter_list { $$ = $1; }
- | /* empty */ { $$.u.constant.value.lval = 0; }
-;
-
-
-non_empty_function_call_parameter_list:
- expr_without_variable { $$.u.constant.value.lval = 1; zend_do_pass_param(&$1, ZEND_SEND_VAL, $$.u.constant.value.lval TSRMLS_CC); }
- | variable { $$.u.constant.value.lval = 1; zend_do_pass_param(&$1, ZEND_SEND_VAR, $$.u.constant.value.lval TSRMLS_CC); }
- | '&' w_variable { $$.u.constant.value.lval = 1; zend_do_pass_param(&$2, ZEND_SEND_REF, $$.u.constant.value.lval TSRMLS_CC); }
- | non_empty_function_call_parameter_list ',' expr_without_variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; zend_do_pass_param(&$3, ZEND_SEND_VAL, $$.u.constant.value.lval TSRMLS_CC); }
- | non_empty_function_call_parameter_list ',' variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; zend_do_pass_param(&$3, ZEND_SEND_VAR, $$.u.constant.value.lval TSRMLS_CC); }
- | non_empty_function_call_parameter_list ',' '&' w_variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; zend_do_pass_param(&$4, ZEND_SEND_REF, $$.u.constant.value.lval TSRMLS_CC); }
-;
-
-global_var_list:
- global_var_list ',' global_var { zend_do_fetch_global_variable(&$3, NULL, ZEND_FETCH_GLOBAL TSRMLS_CC); }
- | global_var { zend_do_fetch_global_variable(&$1, NULL, ZEND_FETCH_GLOBAL TSRMLS_CC); }
-;
-
-
-global_var:
- T_VARIABLE { $$ = $1; }
- | '$' r_variable { $$ = $2; }
- | '$' '{' expr '}' { $$ = $3; }
-;
-
-
-static_var_list:
- static_var_list ',' T_VARIABLE { zend_do_fetch_static_variable(&$3, NULL, ZEND_FETCH_STATIC TSRMLS_CC); }
- | static_var_list ',' T_VARIABLE '=' static_scalar { zend_do_fetch_static_variable(&$3, &$5, ZEND_FETCH_STATIC TSRMLS_CC); }
- | T_VARIABLE { zend_do_fetch_static_variable(&$1, NULL, ZEND_FETCH_STATIC TSRMLS_CC); }
- | T_VARIABLE '=' static_scalar { zend_do_fetch_static_variable(&$1, &$3, ZEND_FETCH_STATIC TSRMLS_CC); }
-
-;
-
-
-class_statement_list:
- class_statement_list class_statement
- | /* empty */
-;
-
-
-class_statement:
- variable_modifiers { CG(access_type) = $1.u.constant.value.lval; } class_variable_declaration ';'
- | class_constant_declaration ';'
- | method_modifiers T_FUNCTION { $2.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$5, 1, $4.op_type, &$1 TSRMLS_CC); } '('
- parameter_list ')' method_body { zend_do_abstract_method(&$5, &$1, &$10 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); }
-;
-
-
-method_body:
- ';' /* abstract method */ { $$.u.constant.value.lval = ZEND_ACC_ABSTRACT; }
- | '{' inner_statement_list '}' { $$.u.constant.value.lval = 0; }
-;
-
-variable_modifiers:
- non_empty_member_modifiers { $$ = $1; }
- | T_VAR { $$.u.constant.value.lval = ZEND_ACC_PUBLIC; }
-;
-
-method_modifiers:
- /* empty */ { $$.u.constant.value.lval = ZEND_ACC_PUBLIC; }
- | non_empty_member_modifiers { $$ = $1; if (!($$.u.constant.value.lval & ZEND_ACC_PPP_MASK)) { $$.u.constant.value.lval |= ZEND_ACC_PUBLIC; } }
-;
-
-non_empty_member_modifiers:
- member_modifier { $$ = $1; }
- | non_empty_member_modifiers member_modifier { $$.u.constant.value.lval = zend_do_verify_access_types(&$1, &$2); }
-;
-
-member_modifier:
- T_PUBLIC { $$.u.constant.value.lval = ZEND_ACC_PUBLIC; }
- | T_PROTECTED { $$.u.constant.value.lval = ZEND_ACC_PROTECTED; }
- | T_PRIVATE { $$.u.constant.value.lval = ZEND_ACC_PRIVATE; }
- | T_STATIC { $$.u.constant.value.lval = ZEND_ACC_STATIC; }
- | T_ABSTRACT { $$.u.constant.value.lval = ZEND_ACC_ABSTRACT; }
- | T_FINAL { $$.u.constant.value.lval = ZEND_ACC_FINAL; }
-;
-
-class_variable_declaration:
- class_variable_declaration ',' T_VARIABLE { zend_do_declare_property(&$3, NULL, CG(access_type) TSRMLS_CC); }
- | class_variable_declaration ',' T_VARIABLE '=' static_scalar { zend_do_declare_property(&$3, &$5, CG(access_type) TSRMLS_CC); }
- | T_VARIABLE { zend_do_declare_property(&$1, NULL, CG(access_type) TSRMLS_CC); }
- | T_VARIABLE '=' static_scalar { zend_do_declare_property(&$1, &$3, CG(access_type) TSRMLS_CC); }
-;
-
-class_constant_declaration:
- class_constant_declaration ',' T_STRING '=' const_scalar_expr { zend_do_declare_class_constant(&$3, &$5 TSRMLS_CC); }
- | T_CONST T_STRING '=' const_scalar_expr { zend_do_declare_class_constant(&$2, &$4 TSRMLS_CC); }
-;
-
-echo_expr_list:
- echo_expr_list ',' expr { zend_do_echo(&$3 TSRMLS_CC); }
- | expr { zend_do_echo(&$1 TSRMLS_CC); }
-;
-
-
-for_expr:
- /* empty */ { $$.op_type = IS_CONST; $$.u.constant.type = IS_BOOL; $$.u.constant.value.lval = 1; }
- | non_empty_for_expr { $$ = $1; }
-;
-
-non_empty_for_expr:
- non_empty_for_expr ',' { zend_do_free(&$1 TSRMLS_CC); } expr { $$ = $4; }
- | expr { $$ = $1; }
-;
-
-expr_without_variable:
- T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' '=' expr { zend_do_list_end(&$$, &$7 TSRMLS_CC); }
- | variable '=' expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign(&$$, &$1, &$3 TSRMLS_CC); }
- | variable '=' '&' variable { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); }
- | variable '=' '&' T_NEW dynamic_class_name { zend_check_writable_variable(&$1); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$4, &$7 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); }
- | T_NEW dynamic_class_name { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$1, &$2 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$1, &$4 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
- | variable T_PLUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_MINUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_MUL_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MUL, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_DIV_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_DIV, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_CONCAT_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_CONCAT, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_MOD_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MOD, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_AND_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_AND, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_OR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_OR, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_XOR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_SL_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SL, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_SR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SR, &$$, &$1, &$3 TSRMLS_CC); }
- | rw_variable T_INC { zend_do_post_incdec(&$$, &$1, ZEND_POST_INC TSRMLS_CC); }
- | T_INC rw_variable { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_INC TSRMLS_CC); }
- | rw_variable T_DEC { zend_do_post_incdec(&$$, &$1, ZEND_POST_DEC TSRMLS_CC); }
- | T_DEC rw_variable { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_DEC TSRMLS_CC); }
- | expr T_BOOLEAN_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
- | expr T_BOOLEAN_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
- | expr T_LOGICAL_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
- | expr T_LOGICAL_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
- | expr T_LOGICAL_XOR expr { zend_do_binary_op(ZEND_BOOL_XOR, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '|' expr { zend_do_binary_op(ZEND_BW_OR, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '&' expr { zend_do_binary_op(ZEND_BW_AND, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '^' expr { zend_do_binary_op(ZEND_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '.' expr { zend_do_binary_op(ZEND_CONCAT, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '+' expr { zend_do_binary_op(ZEND_ADD, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '-' expr { zend_do_binary_op(ZEND_SUB, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '*' expr { zend_do_binary_op(ZEND_MUL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '/' expr { zend_do_binary_op(ZEND_DIV, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '%' expr { zend_do_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_SL expr { zend_do_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_SR expr { zend_do_binary_op(ZEND_SR, &$$, &$1, &$3 TSRMLS_CC); }
- | '+' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); }
- | '-' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); }
- | '!' expr { zend_do_unary_op(ZEND_BOOL_NOT, &$$, &$2 TSRMLS_CC); }
- | '~' expr { zend_do_unary_op(ZEND_BW_NOT, &$$, &$2 TSRMLS_CC); }
- | expr T_IS_IDENTICAL expr { zend_do_binary_op(ZEND_IS_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_IS_NOT_IDENTICAL expr { zend_do_binary_op(ZEND_IS_NOT_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_IS_EQUAL expr { zend_do_binary_op(ZEND_IS_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_IS_NOT_EQUAL expr { zend_do_binary_op(ZEND_IS_NOT_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '<' expr { zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_IS_SMALLER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '>' expr { zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$3, &$1 TSRMLS_CC); }
- | expr T_IS_GREATER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$3, &$1 TSRMLS_CC); }
- | expr T_INSTANCEOF dynamic_class_name { zend_do_instanceof(&$$, &$1, &$3, 0 TSRMLS_CC); }
- | '(' expr ')' { $$ = $2; }
- | expr '?' { zend_do_begin_qm_op(&$1, &$2 TSRMLS_CC); }
- expr ':' { zend_do_qm_true(&$4, &$2, &$5 TSRMLS_CC); }
- expr { zend_do_qm_false(&$$, &$7, &$2, &$5 TSRMLS_CC); }
- | internal_functions_in_yacc { $$ = $1; }
- | T_INT_CAST expr { zend_do_cast(&$$, &$2, IS_LONG TSRMLS_CC); }
- | T_DOUBLE_CAST expr { zend_do_cast(&$$, &$2, IS_DOUBLE TSRMLS_CC); }
- | T_STRING_CAST expr { zend_do_cast(&$$, &$2, IS_STRING TSRMLS_CC); }
- | T_ARRAY_CAST expr { zend_do_cast(&$$, &$2, IS_ARRAY TSRMLS_CC); }
- | T_OBJECT_CAST expr { zend_do_cast(&$$, &$2, IS_OBJECT TSRMLS_CC); }
- | T_BOOL_CAST expr { zend_do_cast(&$$, &$2, IS_BOOL TSRMLS_CC); }
- | T_UNSET_CAST expr { zend_do_cast(&$$, &$2, IS_NULL TSRMLS_CC); }
- | T_EXIT exit_expr { zend_do_exit(&$$, &$2 TSRMLS_CC); }
- | '@' { zend_do_begin_silence(&$1 TSRMLS_CC); } expr { zend_do_end_silence(&$1 TSRMLS_CC); $$ = $3; }
- | scalar { $$ = $1; }
- | T_ARRAY '(' array_pair_list ')' { $$ = $3; }
- | '`' encaps_list '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); }
- | T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); }
-;
-
-function_call:
- T_STRING '(' { $2.u.opline_num = zend_do_begin_function_call(&$1 TSRMLS_CC); }
- function_call_parameter_list
- ')' { zend_do_end_function_call(&$1, &$$, &$4, 0, $2.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
- | class_or_namespace_constant '(' { zend_do_begin_class_member_function_call(TSRMLS_C); zend_do_extended_fcall_begin(TSRMLS_C); }
- function_call_parameter_list
- ')' { zend_do_end_function_call(NULL, &$$, &$4, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
- | variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1 TSRMLS_CC); }
- function_call_parameter_list ')'
- { zend_do_end_function_call(&$1, &$$, &$4, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
-;
-
-fully_qualified_class_name:
- namespace_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_class(&$$, &$1, &$3, 0 TSRMLS_CC); }
- | T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_class(&$$, NULL, &$2, 1 TSRMLS_CC); }
- | T_STRING { zend_do_fetch_class(&$$, NULL, &$1, 0 TSRMLS_CC); }
-;
-
-import_namespace:
- T_NAMESPACE_NAME { zend_do_fetch_class(&$$, NULL, &$1, 0 TSRMLS_CC); }
- | T_STRING { zend_do_fetch_class(&$$, NULL, &$1, 0 TSRMLS_CC); }
-;
-
-dynamic_class_name:
- namespace_name T_PAAMAYIM_NEKUDOTAYIM static_or_variable_string { zend_do_fetch_class(&$$, &$1, &$3, 0 TSRMLS_CC); }
- | T_PAAMAYIM_NEKUDOTAYIM static_or_variable_string { zend_do_fetch_class(&$$, NULL, &$2, 1 TSRMLS_CC); }
- | static_or_variable_string { zend_do_fetch_class(&$$, NULL, &$1, 0 TSRMLS_CC); }
-;
-
-namespace_name:
- T_NAMESPACE_NAME { $$ = $1; }
- | T_STRING { $$ = $1; }
-;
-
-static_or_variable_string:
- T_STRING { $$ = $1; }
- | r_variable_without_static_member { $$ = $1; }
-;
-
-
-exit_expr:
- /* empty */ { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
- | '(' ')' { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
- | '(' expr ')' { $$ = $2; }
-;
-
-
-ctor_arguments:
- /* empty */ { $$.u.constant.value.lval=0; }
- | '(' function_call_parameter_list ')' { $$ = $2; }
-;
-
-
-common_scalar:
- T_LNUMBER { $$ = $1; }
- | T_DNUMBER { $$ = $1; }
- | T_CONSTANT_ENCAPSED_STRING { $$ = $1; }
- | T_LINE { $$ = $1; }
- | T_FILE { $$ = $1; }
- | T_CLASS_C { $$ = $1; }
- | T_FUNC_C { $$ = $1; }
- | T_NAMESPACE_C { $$ = $1; }
-;
-
-
-const_scalar_expr: /* compile-time evaluated scalar expressions */
- const_scalar { $$ = $1; }
- | const_scalar_expr_list { $$ = $1; }
-;
-
-const_scalar_expr_list:
- const_scalar_expr T_SL const_scalar_expr { zend_do_fold_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); }
- | const_scalar_expr T_SR const_scalar_expr { zend_do_fold_binary_op(ZEND_SR, &$$, &$1, &$3 TSRMLS_CC); }
- | const_scalar_expr T_LOGICAL_XOR const_scalar_expr { zend_do_fold_binary_op(ZEND_BOOL_XOR, &$$, &$1, &$3 TSRMLS_CC); }
- | const_scalar_expr '|' const_scalar_expr { zend_do_fold_binary_op(ZEND_BW_OR, &$$, &$1, &$3 TSRMLS_CC); }
- | const_scalar_expr '&' const_scalar_expr { zend_do_fold_binary_op(ZEND_BW_AND, &$$, &$1, &$3 TSRMLS_CC); }
- | const_scalar_expr '^' const_scalar_expr { zend_do_fold_binary_op(ZEND_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); }
- | const_scalar_expr '.' const_scalar_expr { zend_do_fold_binary_op(ZEND_CONCAT, &$$, &$1, &$3 TSRMLS_CC); }
- | const_scalar_expr '+' const_scalar_expr { zend_do_fold_binary_op(ZEND_ADD, &$$, &$1, &$3 TSRMLS_CC); }
- | const_scalar_expr '-' const_scalar_expr { zend_do_fold_binary_op(ZEND_SUB, &$$, &$1, &$3 TSRMLS_CC); }
- | const_scalar_expr '*' const_scalar_expr { zend_do_fold_binary_op(ZEND_MUL, &$$, &$1, &$3 TSRMLS_CC); }
- | const_scalar_expr '/' const_scalar_expr { zend_do_fold_binary_op(ZEND_DIV, &$$, &$1, &$3 TSRMLS_CC); }
- | const_scalar_expr '%' const_scalar_expr { zend_do_fold_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); }
- | const_scalar_expr '~' const_scalar_expr { zend_do_fold_binary_op(ZEND_BW_NOT, &$$, &$1, &$3 TSRMLS_CC); }
- | '(' const_scalar_expr ')' { $$ = $2; }
-;
-
-const_scalar:
- common_scalar { $$ = $1; }
- | T_STRING { zend_do_fold_constant(&$$, &$1 TSRMLS_CC); }
- | '+' const_scalar { $$ = $2; }
- | '-' const_scalar { zval minus_one; minus_one.type = IS_LONG; minus_one.value.lval = -1; mul_function(&$2.u.constant, &$2.u.constant, &minus_one TSRMLS_CC); $$ = $2; }
- | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; $$.u.constant.type = IS_CONSTANT_ARRAY; }
- | class_or_namespace_constant { /* FIXME */ }
-;
-
-static_scalar: /* compile-time evaluated scalars */
- common_scalar { $$ = $1; }
- | T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT TSRMLS_CC); }
- | '+' static_scalar { $$ = $2; }
- | '-' static_scalar { zval minus_one; minus_one.type = IS_LONG; minus_one.value.lval = -1; mul_function(&$2.u.constant, &$2.u.constant, &minus_one TSRMLS_CC); $$ = $2; }
- | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; $$.u.constant.type = IS_CONSTANT_ARRAY; }
- | class_or_namespace_constant { /* FIXME */ }
-;
-
-scalar:
- T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT TSRMLS_CC); }
- | T_STRING_VARNAME { $$ = $1; }
- | class_or_namespace_constant { $$ = $1; }
- | common_scalar { $$ = $1; }
- | '"' encaps_list '"' { $$ = $2; }
- | '\'' encaps_list '\'' { $$ = $2; }
- | T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; zend_do_end_heredoc(TSRMLS_C); }
-;
-
-
-static_array_pair_list:
- /* empty */ { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); }
- | non_empty_static_array_pair_list possible_comma { $$ = $1; }
-;
-
-possible_comma:
- /* empty */
- | ','
-;
-
-non_empty_static_array_pair_list:
- non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW static_scalar { zend_do_add_static_array_element(&$$, &$3, &$5); }
- | non_empty_static_array_pair_list ',' static_scalar { zend_do_add_static_array_element(&$$, NULL, &$3); }
- | static_scalar T_DOUBLE_ARROW static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); zend_do_add_static_array_element(&$$, &$1, &$3); }
- | static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); zend_do_add_static_array_element(&$$, NULL, &$1); }
-;
-
-expr:
- r_variable { $$ = $1; }
- | expr_without_variable { $$ = $1; }
-;
-
-
-r_variable:
- variable { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); $$ = $1; }
-;
-
-
-w_variable:
- variable { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); $$ = $1; }
- { zend_check_writable_variable(&$1); }
-;
-
-rw_variable:
- variable { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); $$ = $1; }
- { zend_check_writable_variable(&$1); }
-;
-
-r_variable_without_static_member:
- variable_without_objects { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); $$ = $1; }
-;
-
-variable:
- base_variable_without_objects T_OBJECT_OPERATOR { zend_do_push_object(&$1 TSRMLS_CC); }
- object_property { zend_do_push_object(&$4 TSRMLS_CC); } method_or_not variable_properties
- { zend_do_pop_object(&$$ TSRMLS_CC); $$.u.EA.type = $1.u.EA.type | ($7.u.EA.type ? $7.u.EA.type : $6.u.EA.type); }
- | base_variable_without_objects { $$ = $1; }
-;
-
-
-variable_properties:
- variable_properties variable_property { $$.u.EA.type = $2.u.EA.type; }
- | /* empty */ { $$.u.EA.type = 0; }
-;
-
-
-variable_property:
- T_OBJECT_OPERATOR object_property { zend_do_push_object(&$2 TSRMLS_CC); } method_or_not { $$.u.EA.type = $4.u.EA.type; }
-;
-
-method_or_not:
- '(' { zend_do_pop_object(&$1 TSRMLS_CC); zend_do_begin_method_call(&$1 TSRMLS_CC); }
- function_call_parameter_list ')'
- { zend_do_end_function_call(&$1, &$$, &$3, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);
- zend_do_push_object(&$$ TSRMLS_CC); $$.u.EA.type = ZEND_PARSED_METHOD_CALL; }
- | /* empty */ { $$.u.EA.type = ZEND_PARSED_MEMBER; }
-;
-
-variable_without_objects:
- reference_variable { $$ = $1; }
- | simple_indirect_reference reference_variable { zend_do_indirect_references(&$$, &$1, &$2 TSRMLS_CC); }
-;
-
-static_member:
- T_PAAMAYIM_NEKUDOTAYIM T_STRING T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $4; zend_do_fetch_class(&$1, NULL, &$2, 1 TSRMLS_CC); zend_do_fetch_static_member(&$1 TSRMLS_CC); }
- | namespace_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $3; zend_do_fetch_class(&$2, NULL, &$1, 0 TSRMLS_CC); zend_do_fetch_static_member(&$2 TSRMLS_CC); }
- | namespace_name T_PAAMAYIM_NEKUDOTAYIM T_STRING T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $5; zend_do_fetch_class(&$4, &$1, &$3, 0 TSRMLS_CC); zend_do_fetch_static_member(&$4 TSRMLS_CC); }
-;
-
-
-base_variable_without_objects:
- reference_variable { $$ = $1; $$.u.EA.type = ZEND_PARSED_VARIABLE; }
- | simple_indirect_reference reference_variable { zend_do_indirect_references(&$$, &$1, &$2 TSRMLS_CC); $$.u.EA.type = ZEND_PARSED_VARIABLE; }
- | static_member { $$ = $1; $$.u.EA.type = ZEND_PARSED_STATIC_MEMBER; }
- | function_call { zend_do_begin_variable_parse(TSRMLS_C); $$ = $1; $$.u.EA.type = ZEND_PARSED_FUNCTION_CALL; }
-;
-
-reference_variable:
- reference_variable '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
- | reference_variable '{' expr '}' { fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); }
- | compound_variable { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
-;
-
-
-compound_variable:
- T_VARIABLE { $$ = $1; }
- | '$' '{' expr '}' { $$ = $3; }
-;
-
-dim_offset:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | expr { $$ = $1; }
-;
-
-
-object_property:
- object_dim_list { $$ = $1; }
- | variable_without_objects { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); } { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);}
-;
-
-object_dim_list:
- object_dim_list '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
- | object_dim_list '{' expr '}' { fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); }
- | variable_name { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);}
-;
-
-variable_name:
- T_STRING { $$ = $1; }
- | '{' expr '}' { $$ = $2; }
-;
-
-simple_indirect_reference:
- '$' { $$.u.constant.value.lval = 1; }
- | simple_indirect_reference '$' { $$.u.constant.value.lval++; }
-;
-
-assignment_list:
- assignment_list ',' assignment_list_element
- | assignment_list_element
-;
-
-
-assignment_list_element:
- variable { zend_do_add_list_element(&$1 TSRMLS_CC); }
- | T_LIST '(' { zend_do_new_list_begin(TSRMLS_C); } assignment_list ')' { zend_do_new_list_end(TSRMLS_C); }
- | /* empty */ { zend_do_add_list_element(NULL TSRMLS_CC); }
-;
-
-
-array_pair_list:
- /* empty */ { zend_do_init_array(&$$, NULL, NULL, 0 TSRMLS_CC); }
- | non_empty_array_pair_list possible_comma { $$ = $1; }
-;
-
-non_empty_array_pair_list:
- non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr { zend_do_add_array_element(&$$, &$5, &$3, 0 TSRMLS_CC); }
- | non_empty_array_pair_list ',' expr { zend_do_add_array_element(&$$, &$3, NULL, 0 TSRMLS_CC); }
- | expr T_DOUBLE_ARROW expr { zend_do_init_array(&$$, &$3, &$1, 0 TSRMLS_CC); }
- | expr { zend_do_init_array(&$$, &$1, NULL, 0 TSRMLS_CC); }
- | non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable { zend_do_add_array_element(&$$, &$6, &$3, 1 TSRMLS_CC); }
- | non_empty_array_pair_list ',' '&' w_variable { zend_do_add_array_element(&$$, &$4, NULL, 1 TSRMLS_CC); }
- | expr T_DOUBLE_ARROW '&' w_variable { zend_do_init_array(&$$, &$4, &$1, 1 TSRMLS_CC); }
- | '&' w_variable { zend_do_init_array(&$$, &$2, NULL, 1 TSRMLS_CC); }
-;
-
-encaps_list:
- encaps_list encaps_var { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list T_STRING { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list T_NUM_STRING { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list T_ENCAPSED_AND_WHITESPACE { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list T_CHARACTER { zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list T_BAD_CHARACTER { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list '[' { $2.u.constant.value.lval = (long) '['; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list ']' { $2.u.constant.value.lval = (long) ']'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list '{' { $2.u.constant.value.lval = (long) '{'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list '}' { $2.u.constant.value.lval = (long) '}'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list T_OBJECT_OPERATOR { znode tmp; $2.u.constant.value.lval = (long) '-'; zend_do_add_char(&tmp, &$1, &$2 TSRMLS_CC); $2.u.constant.value.lval = (long) '>'; zend_do_add_char(&$$, &tmp, &$2 TSRMLS_CC); }
- | /* empty */ { zend_do_init_string(&$$ TSRMLS_CC); }
-
-;
-
-
-
-encaps_var:
- T_VARIABLE { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
- | T_VARIABLE '[' { zend_do_begin_variable_parse(TSRMLS_C); } encaps_var_offset ']' { fetch_array_begin(&$$, &$1, &$4 TSRMLS_CC); }
- | T_VARIABLE T_OBJECT_OPERATOR T_STRING { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$2, &$1, 1 TSRMLS_CC); zend_do_fetch_property(&$$, &$2, &$3 TSRMLS_CC); }
- | T_DOLLAR_OPEN_CURLY_BRACES expr '}' { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$2, 1 TSRMLS_CC); }
- | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_begin(&$$, &$2, &$4 TSRMLS_CC); }
- | T_CURLY_OPEN variable '}' { $$ = $2; }
-;
-
-
-encaps_var_offset:
- T_STRING { $$ = $1; }
- | T_NUM_STRING { $$ = $1; }
- | T_VARIABLE { fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
-;
-
-
-internal_functions_in_yacc:
- T_ISSET '(' isset_variables ')' { $$ = $3; }
- | T_EMPTY '(' variable ')' { zend_do_isset_or_isempty(ZEND_ISEMPTY, &$$, &$3 TSRMLS_CC); }
- | T_INCLUDE expr { zend_do_include_or_eval(ZEND_INCLUDE, &$$, &$2 TSRMLS_CC); }
- | T_INCLUDE_ONCE expr { zend_do_include_or_eval(ZEND_INCLUDE_ONCE, &$$, &$2 TSRMLS_CC); }
- | T_EVAL '(' expr ')' { zend_do_include_or_eval(ZEND_EVAL, &$$, &$3 TSRMLS_CC); }
- | T_REQUIRE expr { zend_do_include_or_eval(ZEND_REQUIRE, &$$, &$2 TSRMLS_CC); }
- | T_REQUIRE_ONCE expr { zend_do_include_or_eval(ZEND_REQUIRE_ONCE, &$$, &$2 TSRMLS_CC); }
-;
-
-isset_variables:
- variable { zend_do_isset_or_isempty(ZEND_ISSET, &$$, &$1 TSRMLS_CC); }
- | isset_variables ',' { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } variable { znode tmp; zend_do_isset_or_isempty(ZEND_ISSET, &tmp, &$4 TSRMLS_CC); zend_do_boolean_and_end(&$$, &$1, &tmp, &$2 TSRMLS_CC); }
-;
-
-class_or_namespace_constant:
- T_PAAMAYIM_NEKUDOTAYIM namespace_name { zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT TSRMLS_CC); }
- | T_PAAMAYIM_NEKUDOTAYIM T_STRING T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_class(&$1, NULL, &$2, 1 TSRMLS_CC); zend_do_fetch_constant(&$$, &$1, &$4, ZEND_RT TSRMLS_CC); }
- | namespace_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_class(&$2, NULL, &$1, 0 TSRMLS_CC); zend_do_fetch_constant(&$$, &$2, &$3, ZEND_RT TSRMLS_CC); }
- | namespace_name T_PAAMAYIM_NEKUDOTAYIM T_STRING T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_class(&$4, &$1, &$3, 0 TSRMLS_CC); zend_do_fetch_constant(&$$, &$4, &$5, ZEND_RT TSRMLS_CC); }
-;
-
-%%
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h
deleted file mode 100644
index 50227ee9c7..0000000000
--- a/Zend/zend_language_scanner.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_SCANNER_H
-#define ZEND_SCANNER_H
-
-typedef struct _zend_lex_state {
- YY_BUFFER_STATE buffer_state;
- int state;
- zend_file_handle *in;
- uint lineno;
- char *filename;
-} zend_lex_state;
-
-
-void zend_fatal_scanner_error(char *);
-BEGIN_EXTERN_C()
-int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2);
-ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC);
-ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC);
-ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_DC);
-END_EXTERN_C()
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
deleted file mode 100644
index ee1060cb55..0000000000
--- a/Zend/zend_language_scanner.l
+++ /dev/null
@@ -1,1588 +0,0 @@
-%{
-
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#define yyleng SCNG(yy_leng)
-#define yytext SCNG(yy_text)
-#define yytext_ptr SCNG(yy_text)
-#define yyin SCNG(yy_in)
-#define yyout SCNG(yy_out)
-#define yy_last_accepting_state SCNG(_yy_last_accepting_state)
-#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos)
-#define yy_more_flag SCNG(_yy_more_flag)
-#define yy_more_len SCNG(_yy_more_len)
-
-%}
-
-%x ST_IN_SCRIPTING
-%x ST_DOUBLE_QUOTES
-%x ST_SINGLE_QUOTE
-%x ST_BACKQUOTE
-%x ST_HEREDOC
-%x ST_LOOKING_FOR_PROPERTY
-%x ST_LOOKING_FOR_VARNAME
-%x ST_COMMENT
-%x ST_DOC_COMMENT
-%x ST_ONE_LINE_COMMENT
-%option stack
-
-%{
-
-#include <errno.h>
-#include "zend.h"
-#include "zend_alloc.h"
-#include "zend_language_parser.h"
-#include "zend_compile.h"
-#include "zend_language_scanner.h"
-#include "zend_highlight.h"
-#include "zend_constants.h"
-#include "zend_variables.h"
-#include "zend_operators.h"
-
-#ifdef HAVE_STDARG_H
-# include <stdarg.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#define YY_DECL int lex_scan(zval *zendlval TSRMLS_DC)
-
-#define ECHO { ZEND_WRITE( yytext, yyleng ); }
-
-#ifdef ZTS
-# define MY_INPUT yyinput
-#else
-# define MY_INPUT input
-#endif
-
-
-/* Globals Macros */
-#define SCNG LANG_SCNG
-#ifdef ZTS
-ZEND_API ts_rsrc_id language_scanner_globals_id;
-#else
-ZEND_API zend_scanner_globals language_scanner_globals;
-#endif
-
-
-#define YY_FATAL_ERROR zend_fatal_scanner_error
-
-#define HANDLE_NEWLINES(s, l) \
-do { \
- char *p = (s), *boundary = p+(l); \
- \
- while (p<boundary) { \
- if (*p == '\n') { \
- CG(zend_lineno)++; \
- } else if ((*p == '\r') && (p+1 < boundary) && (*(p+1) != '\n')) { \
- CG(zend_lineno)++; \
- } \
- p++; \
- } \
-} while (0)
-
-#define HANDLE_NEWLINE(c) \
-{ \
- if (c == '\n' || c == '\r') { \
- CG(zend_lineno)++; \
- } \
-}
-
-
-#define ZEND_IS_OCT(c) ((c)>='0' && (c)<='7')
-#define ZEND_IS_HEX(c) (((c)>='0' && (c)<='9') || ((c)>='a' && (c)<='f') || ((c)>='A' && (c)<='F'))
-
-
-void zend_fatal_scanner_error(char *message)
-{
- zend_error(E_COMPILE_ERROR, message);
-}
-
-BEGIN_EXTERN_C()
-void startup_scanner(TSRMLS_D)
-{
- CG(heredoc) = NULL;
- CG(heredoc_len)=0;
- RESET_DOC_COMMENT();
- SCNG(yy_start_stack_ptr) = 0;
- SCNG(yy_start_stack_depth) = 0;
-}
-
-
-void shutdown_scanner(TSRMLS_D)
-{
- if (CG(heredoc)) {
- efree(CG(heredoc));
- CG(heredoc_len)=0;
- }
- RESET_DOC_COMMENT();
-}
-END_EXTERN_C()
-
-
-ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
-{
- memcpy(&lex_state->buffer_state, &YY_CURRENT_BUFFER, sizeof(YY_BUFFER_STATE));
- lex_state->in = SCNG(yy_in);
- lex_state->state = YYSTATE;
- lex_state->filename = zend_get_compiled_filename(TSRMLS_C);
- lex_state->lineno = CG(zend_lineno);
-}
-
-
-ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
-{
- YY_BUFFER_STATE original_buffer_state = YY_CURRENT_BUFFER;
-
- if (lex_state->buffer_state) {
- yy_switch_to_buffer(lex_state->buffer_state TSRMLS_CC);
- } else {
- YY_CURRENT_BUFFER = NULL;
- }
-
- yy_delete_buffer(original_buffer_state TSRMLS_CC);
- SCNG(yy_in) = lex_state->in;
- BEGIN(lex_state->state);
- CG(zend_lineno) = lex_state->lineno;
- zend_restore_compiled_filename(lex_state->filename TSRMLS_CC);
-}
-
-
-BEGIN_EXTERN_C()
-
-
-ZEND_API void zend_file_handle_dtor(zend_file_handle *fh)
-{
- TSRMLS_FETCH();
-
- switch (fh->type) {
- case ZEND_HANDLE_FP:
- fclose(fh->handle.fp);
- break;
- case ZEND_HANDLE_STREAM:
- fh->handle.stream.closer(fh->handle.stream.handle TSRMLS_CC);
- break;
- case ZEND_HANDLE_FILENAME:
- /* We're only supposed to get here when destructing the used_files hash,
- * which doesn't really contain open files, but references to their names/paths
- */
- break;
- }
- if (fh->opened_path) {
- efree(fh->opened_path);
- fh->opened_path = NULL;
- }
- if (fh->free_filename && fh->filename) {
- efree(fh->filename);
- fh->filename = NULL;
- }
-}
-
-
-int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2)
-{
- if (fh1->type != fh2->type) {
- return 0;
- }
- switch (fh1->type) {
- case ZEND_HANDLE_FP:
- return fh1->handle.fp==fh2->handle.fp;
- break;
- case ZEND_HANDLE_STREAM:
- return fh1->handle.stream.handle == fh2->handle.stream.handle;
- break;
- }
- return 0;
-}
-
-
-ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC)
-{
- zend_llist_del_element(&CG(open_files), file_handle, (int (*)(void *, void *)) zend_compare_file_handles);
-}
-
-
-ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
-{
- char *file_path=NULL;
-
- if (FAILURE == zend_stream_fixup(file_handle TSRMLS_CC)) {
- return FAILURE;
- }
-
- zend_llist_add_element(&CG(open_files), file_handle);
-
- /* Reset the scanner for scanning the new file */
- SCNG(yy_in) = file_handle;
- yy_switch_to_buffer(yy_create_buffer(SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC);
- BEGIN(INITIAL);
-
- if (file_handle->opened_path) {
- file_path = file_handle->opened_path;
- } else {
- file_path = file_handle->filename;
- }
-
- zend_set_compiled_filename(file_path TSRMLS_CC);
-
- if (CG(start_lineno)) {
- CG(zend_lineno) = CG(start_lineno);
- CG(start_lineno) = 0;
- } else {
- CG(zend_lineno) = 1;
- }
-
- CG(increment_lineno) = 0;
- return SUCCESS;
-}
-END_EXTERN_C()
-
-
-ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
-{
- zend_lex_state original_lex_state;
- zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array));
- zend_op_array *original_active_op_array = CG(active_op_array);
- zend_op_array *retval=NULL;
- int compiler_result;
- zend_bool compilation_successful=0;
- znode retval_znode;
- zend_bool original_in_compilation = CG(in_compilation);
-
- retval_znode.op_type = IS_CONST;
- retval_znode.u.constant.type = IS_LONG;
- retval_znode.u.constant.value.lval = 1;
- retval_znode.u.constant.is_ref = 0;
- retval_znode.u.constant.refcount = 1;
-
- zend_save_lexical_state(&original_lex_state TSRMLS_CC);
-
- retval = op_array; /* success oriented */
-
- if (open_file_for_scanning(file_handle TSRMLS_CC)==FAILURE) {
- if (type==ZEND_REQUIRE) {
- zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
- zend_bailout();
- } else {
- zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
- }
- compilation_successful=0;
- } else {
- init_op_array(op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
- CG(in_compilation) = 1;
- CG(active_op_array) = op_array;
- op_array->ns = CG(active_namespace);
- compiler_result = zendparse(TSRMLS_C);
- zend_do_return(&retval_znode, 0 TSRMLS_CC);
- CG(in_compilation) = original_in_compilation;
- if (compiler_result==1) { /* parser error */
- CG(unclean_shutdown) = 1;
- retval = NULL;
- }
- compilation_successful=1;
- }
-
- if (retval) {
- CG(active_op_array) = original_active_op_array;
- if (compilation_successful) {
- pass_two(op_array TSRMLS_CC);
- } else {
- efree(op_array);
- retval = NULL;
- }
- }
- if (compilation_successful) {
- zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
- }
- return retval;
-}
-
-
-zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC)
-{
- zend_file_handle file_handle;
- zval tmp;
- zend_op_array *retval;
- char *opened_path = NULL;
-
- if (filename->type != IS_STRING) {
- tmp = *filename;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- filename = &tmp;
- }
- file_handle.filename = filename->value.str.val;
- file_handle.free_filename = 0;
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.opened_path = NULL;
-
-
- retval = zend_compile_file(&file_handle, type TSRMLS_CC);
- if (retval && file_handle.handle.stream.handle) {
- int dummy = 1;
-
- if (!file_handle.opened_path) {
- file_handle.opened_path = opened_path = estrndup(filename->value.str.val, filename->value.str.len);
- }
-
- zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL);
-
- if (opened_path) {
- efree(opened_path);
- }
- }
- zend_destroy_file_handle(&file_handle TSRMLS_CC);
-
- if (filename==&tmp) {
- zval_dtor(&tmp);
- }
- return retval;
-}
-
-ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_DC)
-{
- /* enforce two trailing NULLs for flex... */
- STR_REALLOC(str->value.str.val, str->value.str.len+2);
-
- str->value.str.val[str->value.str.len+1]=0;
-
- SCNG(yy_in)=NULL;
- yy_scan_buffer(str->value.str.val, str->value.str.len+2 TSRMLS_CC);
-
- zend_set_compiled_filename(filename TSRMLS_CC);
- CG(zend_lineno) = 1;
- CG(increment_lineno) = 0;
- return SUCCESS;
-}
-
-
-zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
-{
- zend_lex_state original_lex_state;
- zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array));
- zend_op_array *original_active_op_array = CG(active_op_array);
- zend_op_array *retval;
- zval tmp;
- int compiler_result;
- zend_bool original_in_compilation = CG(in_compilation);
-
- if (source_string->value.str.len==0) {
- efree(op_array);
- return NULL;
- }
-
- CG(in_compilation) = 1;
-
- tmp = *source_string;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- source_string = &tmp;
-
- zend_save_lexical_state(&original_lex_state TSRMLS_CC);
- if (zend_prepare_string_for_scanning(source_string, filename TSRMLS_CC)==FAILURE) {
- efree(op_array);
- retval = NULL;
- } else {
- init_op_array(op_array, ZEND_EVAL_CODE, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
- CG(active_op_array) = op_array;
- op_array->ns = CG(active_namespace);
- BEGIN(ST_IN_SCRIPTING);
- compiler_result = zendparse(TSRMLS_C);
-
- if (compiler_result==1) {
- CG(active_op_array) = original_active_op_array;
- CG(unclean_shutdown)=1;
- retval = NULL;
- } else {
- zend_do_return(NULL, 0 TSRMLS_CC);
- CG(active_op_array) = original_active_op_array;
- pass_two(op_array TSRMLS_CC);
- retval = op_array;
- }
- zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
- }
- zval_dtor(&tmp);
- CG(in_compilation) = original_in_compilation;
- return retval;
-}
-
-
-BEGIN_EXTERN_C()
-int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC)
-{
- zend_lex_state original_lex_state;
- zend_file_handle file_handle;
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = filename;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
- zend_save_lexical_state(&original_lex_state TSRMLS_CC);
- if (open_file_for_scanning(&file_handle TSRMLS_CC)==FAILURE) {
- zend_message_dispatcher(ZMSG_FAILED_HIGHLIGHT_FOPEN, filename);
- return FAILURE;
- }
- zend_highlight(syntax_highlighter_ini TSRMLS_CC);
- zend_destroy_file_handle(&file_handle TSRMLS_CC);
- zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
- return SUCCESS;
-}
-
-int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC)
-{
- zend_lex_state original_lex_state;
- zval tmp = *str;
-
- str = &tmp;
- zval_copy_ctor(str);
- zend_save_lexical_state(&original_lex_state TSRMLS_CC);
- if (zend_prepare_string_for_scanning(str, str_name TSRMLS_CC)==FAILURE) {
- return FAILURE;
- }
- zend_highlight(syntax_highlighter_ini TSRMLS_CC);
- zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
- zval_dtor(str);
- return SUCCESS;
-}
-END_EXTERN_C()
-
-%}
-
-LNUM [0-9]+
-DNUM ([0-9]*[\.][0-9]+)|([0-9]+[\.][0-9]*)
-EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM})
-HNUM "0x"[0-9a-fA-F]+
-LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*
-WHITESPACE [ \n\r\t]+
-TABS_AND_SPACES [ \t]*
-TOKENS [;:,.\[\]()|^&+-/*=%!~$<>?@]
-ENCAPSED_TOKENS [\[\]{}$]
-ESCAPED_AND_WHITESPACE [\n\t\r #'.:;,()|^&+-/*=%!~<>?@]+
-ANY_CHAR (.|[\n])
-NEWLINE ("\r"|"\n"|"\r\n")
-NAMESPACE_NAME ({LABEL}":")+{LABEL}
-
-%option noyylineno
-%option noyywrap
-%%
-
-<ST_IN_SCRIPTING>"exit" {
- return T_EXIT;
-}
-
-<ST_IN_SCRIPTING>"die" {
- return T_EXIT;
-}
-
-<ST_IN_SCRIPTING>"function" {
- return T_FUNCTION;
-}
-
-<ST_IN_SCRIPTING>"const" {
- return T_CONST;
-}
-
-<ST_IN_SCRIPTING>"return" {
- return T_RETURN;
-}
-
-<ST_IN_SCRIPTING>"try" {
- return T_TRY;
-}
-
-<ST_IN_SCRIPTING>"catch" {
- return T_CATCH;
-}
-
-<ST_IN_SCRIPTING>"throw" {
- return T_THROW;
-}
-
-<ST_IN_SCRIPTING>"if" {
- return T_IF;
-}
-
-<ST_IN_SCRIPTING>"elseif" {
- return T_ELSEIF;
-}
-
-<ST_IN_SCRIPTING>"endif" {
- return T_ENDIF;
-}
-
-<ST_IN_SCRIPTING>"else" {
- return T_ELSE;
-}
-
-<ST_IN_SCRIPTING>"while" {
- return T_WHILE;
-}
-
-<ST_IN_SCRIPTING>"endwhile" {
- return T_ENDWHILE;
-}
-
-<ST_IN_SCRIPTING>"do" {
- return T_DO;
-}
-
-<ST_IN_SCRIPTING>"for" {
- return T_FOR;
-}
-
-<ST_IN_SCRIPTING>"endfor" {
- return T_ENDFOR;
-}
-
-<ST_IN_SCRIPTING>"foreach" {
- return T_FOREACH;
-}
-
-<ST_IN_SCRIPTING>"endforeach" {
- return T_ENDFOREACH;
-}
-
-<ST_IN_SCRIPTING>"declare" {
- return T_DECLARE;
-}
-
-<ST_IN_SCRIPTING>"enddeclare" {
- return T_ENDDECLARE;
-}
-
-<ST_IN_SCRIPTING>"instanceof" {
- return T_INSTANCEOF;
-}
-
-<ST_IN_SCRIPTING>"as" {
- return T_AS;
-}
-
-<ST_IN_SCRIPTING>"switch" {
- return T_SWITCH;
-}
-
-<ST_IN_SCRIPTING>"endswitch" {
- return T_ENDSWITCH;
-}
-
-<ST_IN_SCRIPTING>"case" {
- return T_CASE;
-}
-
-<ST_IN_SCRIPTING>"default" {
- return T_DEFAULT;
-}
-
-<ST_IN_SCRIPTING>"break" {
- return T_BREAK;
-}
-
-<ST_IN_SCRIPTING>"continue" {
- return T_CONTINUE;
-}
-
-<ST_IN_SCRIPTING>"echo" {
- return T_ECHO;
-}
-
-<ST_IN_SCRIPTING>"print" {
- return T_PRINT;
-}
-
-<ST_IN_SCRIPTING>"class" {
- return T_CLASS;
-}
-
-<ST_IN_SCRIPTING>"interface" {
- return T_INTERFACE;
-}
-
-<ST_IN_SCRIPTING>"extends" {
- return T_EXTENDS;
-}
-
-<ST_IN_SCRIPTING>"implements" {
- return T_IMPLEMENTS;
-}
-
-<ST_IN_SCRIPTING>"namespace" {
- return T_NAMESPACE;
-}
-
-<ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"->" {
- yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
- return T_OBJECT_OPERATOR;
-}
-
-<ST_LOOKING_FOR_PROPERTY>{LABEL} {
- yy_pop_state(TSRMLS_C);
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_STRING;
-}
-
-<ST_LOOKING_FOR_PROPERTY>{ANY_CHAR} {
- yyless(0);
- yy_pop_state(TSRMLS_C);
-}
-
-<ST_IN_SCRIPTING>"::" {
- return T_PAAMAYIM_NEKUDOTAYIM;
-}
-
-<ST_IN_SCRIPTING>"new" {
- return T_NEW;
-}
-
-<ST_IN_SCRIPTING>"var" {
- return T_VAR;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("int"|"integer"){TABS_AND_SPACES}")" {
- return T_INT_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("real"|"double"|"float"){TABS_AND_SPACES}")" {
- return T_DOUBLE_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"string"{TABS_AND_SPACES}")" {
- return T_STRING_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"array"{TABS_AND_SPACES}")" {
- return T_ARRAY_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"object"{TABS_AND_SPACES}")" {
- return T_OBJECT_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("bool"|"boolean"){TABS_AND_SPACES}")" {
- return T_BOOL_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("unset"){TABS_AND_SPACES}")" {
- return T_UNSET_CAST;
-}
-
-<ST_IN_SCRIPTING>"eval" {
- return T_EVAL;
-}
-
-<ST_IN_SCRIPTING>"include" {
- return T_INCLUDE;
-}
-
-<ST_IN_SCRIPTING>"import" {
- return T_IMPORT;
-}
-
-<ST_IN_SCRIPTING>"from" {
- return T_FROM;
-}
-
-<ST_IN_SCRIPTING>"include_once" {
- return T_INCLUDE_ONCE;
-}
-
-<ST_IN_SCRIPTING>"require" {
- return T_REQUIRE;
-}
-
-<ST_IN_SCRIPTING>"require_once" {
- return T_REQUIRE_ONCE;
-}
-
-<ST_IN_SCRIPTING>"use" {
- return T_USE;
-}
-
-<ST_IN_SCRIPTING>"global" {
- return T_GLOBAL;
-}
-
-<ST_IN_SCRIPTING>"isset" {
- return T_ISSET;
-}
-
-<ST_IN_SCRIPTING>"empty" {
- return T_EMPTY;
-}
-
-<ST_IN_SCRIPTING>"static" {
- return T_STATIC;
-}
-
-<ST_IN_SCRIPTING>"abstract" {
- return T_ABSTRACT;
-}
-
-<ST_IN_SCRIPTING>"final" {
- return T_FINAL;
-}
-
-<ST_IN_SCRIPTING>"private" {
- return T_PRIVATE;
-}
-
-<ST_IN_SCRIPTING>"protected" {
- return T_PROTECTED;
-}
-
-<ST_IN_SCRIPTING>"public" {
- return T_PUBLIC;
-}
-
-<ST_IN_SCRIPTING>"unset" {
- return T_UNSET;
-}
-
-<ST_IN_SCRIPTING>"=>" {
- return T_DOUBLE_ARROW;
-}
-
-<ST_IN_SCRIPTING>"list" {
- return T_LIST;
-}
-
-<ST_IN_SCRIPTING>"array" {
- return T_ARRAY;
-}
-
-<ST_IN_SCRIPTING>"++" {
- return T_INC;
-}
-
-<ST_IN_SCRIPTING>"--" {
- return T_DEC;
-}
-
-<ST_IN_SCRIPTING>"===" {
- return T_IS_IDENTICAL;
-}
-
-<ST_IN_SCRIPTING>"!==" {
- return T_IS_NOT_IDENTICAL;
-}
-
-<ST_IN_SCRIPTING>"==" {
- return T_IS_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"!="|"<>" {
- return T_IS_NOT_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"<=" {
- return T_IS_SMALLER_OR_EQUAL;
-}
-
-<ST_IN_SCRIPTING>">=" {
- return T_IS_GREATER_OR_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"+=" {
- return T_PLUS_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"-=" {
- return T_MINUS_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"*=" {
- return T_MUL_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"/=" {
- return T_DIV_EQUAL;
-}
-
-<ST_IN_SCRIPTING>".=" {
- return T_CONCAT_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"%=" {
- return T_MOD_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"<<=" {
- return T_SL_EQUAL;
-}
-
-<ST_IN_SCRIPTING>">>=" {
- return T_SR_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"&=" {
- return T_AND_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"|=" {
- return T_OR_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"^=" {
- return T_XOR_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"||" {
- return T_BOOLEAN_OR;
-}
-
-<ST_IN_SCRIPTING>"&&" {
- return T_BOOLEAN_AND;
-}
-
-<ST_IN_SCRIPTING>"OR" {
- return T_LOGICAL_OR;
-}
-
-<ST_IN_SCRIPTING>"AND" {
- return T_LOGICAL_AND;
-}
-
-<ST_IN_SCRIPTING>"XOR" {
- return T_LOGICAL_XOR;
-}
-
-<ST_IN_SCRIPTING>"<<" {
- return T_SL;
-}
-
-<ST_IN_SCRIPTING>">>" {
- return T_SR;
-}
-
-<ST_IN_SCRIPTING>{TOKENS} {
- return yytext[0];
-}
-
-
-<ST_IN_SCRIPTING>"{" {
- yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
- return '{';
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"${" {
- yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC);
- return T_DOLLAR_OPEN_CURLY_BRACES;
-}
-
-
-<ST_IN_SCRIPTING>"}" {
- /* This is a temporary fix which is dependant on flex and it's implementation */
- if (yy_start_stack_ptr) {
- yy_pop_state(TSRMLS_C);
- }
- return '}';
-}
-
-
-<ST_LOOKING_FOR_VARNAME>{LABEL} {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- yy_pop_state(TSRMLS_C);
- yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
- return T_STRING_VARNAME;
-}
-
-
-<ST_LOOKING_FOR_VARNAME>{ANY_CHAR} {
- yyless(0);
- yy_pop_state(TSRMLS_C);
- yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
-}
-
-
-<ST_IN_SCRIPTING>{LNUM} {
- errno = 0;
- zendlval->value.lval = strtol(yytext, NULL, 0);
- if (errno == ERANGE) { /* overflow */
- zendlval->value.dval = strtod(yytext, NULL);
- zendlval->type = IS_DOUBLE;
- return T_DNUMBER;
- } else {
- zendlval->type = IS_LONG;
- return T_LNUMBER;
- }
-}
-
-<ST_IN_SCRIPTING>{HNUM} {
- errno = 0;
- zendlval->value.lval = strtoul(yytext, NULL, 16);
- if (errno == ERANGE) { /* overflow */
- /* not trying strtod - it returns trash on 0x-es */
- zendlval->value.lval = LONG_MAX; /* maximal long */
- zend_error(E_NOTICE,"Hex number is too big: %s", yytext);
- } else {
- if (zendlval->value.lval < 0) {
- /* maintain consistency with the old way */
- zendlval->value.dval = (unsigned long) zendlval->value.lval;
- zendlval->type = IS_DOUBLE;
- return T_DNUMBER;
- }
- zendlval->type = IS_LONG;
- }
- zendlval->type = IS_LONG;
- return T_LNUMBER;
-}
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{LNUM}|{HNUM} { /* treat numbers (almost) as strings inside encapsulated strings */
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_NUM_STRING;
-}
-
-<ST_IN_SCRIPTING>{DNUM}|{EXPONENT_DNUM} {
- zendlval->value.dval = strtod(yytext, NULL);
- zendlval->type = IS_DOUBLE;
- return T_DNUMBER;
-}
-
-<ST_IN_SCRIPTING>"__CLASS__" {
- char *class_name = NULL;
-
- if (CG(active_class_entry)) {
- class_name = CG(active_class_entry)->name;
- }
-
- if (!class_name) {
- class_name = "";
- }
- zendlval->value.str.len = strlen(class_name);
- zendlval->value.str.val = estrndup(class_name, zendlval->value.str.len);
- zendlval->type = IS_STRING;
- return T_CLASS_C;
-}
-
-<ST_IN_SCRIPTING>"__FUNCTION__" {
- char *func_name = NULL;
-
- if (CG(active_op_array)) {
- func_name = CG(active_op_array)->function_name;
- }
-
- if (!func_name) {
- func_name = "";
- }
- zendlval->value.str.len = strlen(func_name);
- zendlval->value.str.val = estrndup(func_name, zendlval->value.str.len);
- zendlval->type = IS_STRING;
- return T_FUNC_C;
-}
-
-<ST_IN_SCRIPTING>"__LINE__" {
- zendlval->value.lval = CG(zend_lineno);
- zendlval->type = IS_LONG;
- return T_LINE;
-}
-
-<ST_IN_SCRIPTING>"__FILE__" {
- char *filename = zend_get_compiled_filename(TSRMLS_C);
-
- if (!filename) {
- filename = "";
- }
- zendlval->value.str.len = strlen(filename);
- zendlval->value.str.val = estrndup(filename, zendlval->value.str.len);
- zendlval->type = IS_STRING;
- return T_FILE;
-}
-
-<ST_IN_SCRIPTING>"__NAMESPACE__" {
- char *ns_name;
- if(CG(active_namespace) == &CG(global_namespace)) {
- ns_name = "";
- } else {
- ns_name = CG(active_namespace)->name;
- }
-
- zendlval->value.str.len = strlen(ns_name);
- zendlval->value.str.val = estrndup(ns_name, zendlval->value.str.len);
- zendlval->type = IS_STRING;
- return T_NAMESPACE_C;
-}
-
-<INITIAL>(([^<]|"<"[^?%s<]){1,400})|"<s"|"<" {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- HANDLE_NEWLINES(yytext, yyleng);
- return T_INLINE_HTML;
-}
-
-<INITIAL>"<?"|"<script"{WHITESPACE}+"language"{WHITESPACE}*"="{WHITESPACE}*("php"|"\"php\""|"\'php\'"){WHITESPACE}*">" {
- HANDLE_NEWLINES(yytext, yyleng);
- if (CG(short_tags) || yyleng>2) { /* yyleng>2 means it's not <? but <script> */
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG;
- } else {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_INLINE_HTML;
- }
-}
-
-
-<INITIAL>"<%="|"<?=" {
- if ((yytext[1]=='%' && CG(asp_tags)) || (yytext[1]=='?' && CG(short_tags))) {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG_WITH_ECHO;
- } else {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_INLINE_HTML;
- }
-}
-
-
-<INITIAL>"<%" {
- if (CG(asp_tags)) {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG;
- } else {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_INLINE_HTML;
- }
-}
-
-
-<INITIAL>"<?php"([ \t]|{NEWLINE}) {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- HANDLE_NEWLINE(yytext[yyleng-1]);
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG;
-}
-
-
-<INITIAL>"<?php_track_vars?>"{NEWLINE}? {
- zend_error(E_WARNING, "&lt;?php_track_vars?&gt; is no longer supported - please use the track_vars INI directive instead");
- HANDLE_NEWLINE(yytext[yyleng-1]);
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_INLINE_HTML;
-}
-
-<ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BACKQUOTE>"$"{LABEL} {
- zendlval->value.str.val = (char *)estrndup(yytext+1, yyleng-1);
- zendlval->value.str.len = yyleng-1;
- zendlval->type = IS_STRING;
- return T_VARIABLE;
-}
-
-<ST_IN_SCRIPTING>{LABEL} {
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_STRING;
-}
-
-<ST_IN_SCRIPTING>{NAMESPACE_NAME} {
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_NAMESPACE_NAME;
-}
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{LABEL} {
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_STRING;
-}
-
-
-<ST_IN_SCRIPTING>{WHITESPACE} {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- HANDLE_NEWLINES(yytext, yyleng);
- return T_WHITESPACE;
-}
-
-
-<ST_IN_SCRIPTING>"#"|"//" {
- BEGIN(ST_ONE_LINE_COMMENT);
- yymore();
-}
-
-<ST_ONE_LINE_COMMENT>"?"|"%"|">" {
- yymore();
-}
-
-<ST_ONE_LINE_COMMENT>[^\n\r?%>]+ {
- yymore();
-}
-
-<ST_ONE_LINE_COMMENT>{NEWLINE} {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- BEGIN(ST_IN_SCRIPTING);
- CG(zend_lineno)++;
- return T_COMMENT;
-}
-
-<ST_ONE_LINE_COMMENT>"?>"|"%>" {
- if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- yyless(yyleng-2);
- BEGIN(ST_IN_SCRIPTING);
- return T_COMMENT;
- } else {
- yymore();
- }
-}
-
-<ST_IN_SCRIPTING>"/**"{NEWLINE} {
- CG(comment_start_line) = CG(zend_lineno);
- BEGIN(ST_DOC_COMMENT);
- yymore();
-}
-
-<ST_IN_SCRIPTING>"/*" {
- CG(comment_start_line) = CG(zend_lineno);
- BEGIN(ST_COMMENT);
- yymore();
-}
-
-
-<ST_COMMENT,ST_DOC_COMMENT>[^*]+ {
- yymore();
-}
-
-<ST_DOC_COMMENT>"*/" {
- CG(doc_comment) = yytext; /* no copying - intentional */
- CG(doc_comment_len) = yyleng;
- HANDLE_NEWLINES(yytext, yyleng);
- BEGIN(ST_IN_SCRIPTING);
- return T_DOC_COMMENT;
-}
-
-<ST_COMMENT>"*/" {
- HANDLE_NEWLINES(yytext, yyleng);
- BEGIN(ST_IN_SCRIPTING);
- return T_COMMENT;
-}
-
-<ST_COMMENT,ST_DOC_COMMENT>"*" {
- yymore();
-}
-
-<ST_IN_SCRIPTING>("?>"|"</script"{WHITESPACE}*">"){NEWLINE}? {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- BEGIN(INITIAL);
- return T_CLOSE_TAG; /* implicit ';' at php-end tag */
-}
-
-
-<ST_IN_SCRIPTING>"%>"{NEWLINE}? {
- if (CG(asp_tags)) {
- BEGIN(INITIAL);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- zendlval->value.str.val = yytext; /* no copying - intentional */
- return T_CLOSE_TAG; /* implicit ';' at php-end tag */
- } else {
- yyless(1);
- return yytext[0];
- }
-}
-
-
-<ST_IN_SCRIPTING>(["]([^$"\\]|("\\".))*["]) {
- register char *s, *t;
- char *end;
-
- zendlval->value.str.val = estrndup(yytext+1, yyleng-2);
- zendlval->value.str.len = yyleng-2;
- zendlval->type = IS_STRING;
- HANDLE_NEWLINES(yytext, yyleng);
-
- /* convert escape sequences */
- s = t = zendlval->value.str.val;
- end = s+zendlval->value.str.len;
- while (s<end) {
- if (*s=='\\') {
- s++;
- if (s>=end) {
- continue;
- }
- switch(*s) {
- case 'n':
- *t++ = '\n';
- zendlval->value.str.len--;
- break;
- case 'r':
- *t++ = '\r';
- zendlval->value.str.len--;
- break;
- case 't':
- *t++ = '\t';
- zendlval->value.str.len--;
- break;
- case '\\':
- case '$':
- case '"':
- *t++ = *s;
- zendlval->value.str.len--;
- break;
- default:
- /* check for an octal */
- if (ZEND_IS_OCT(*s)) {
- char octal_buf[4] = { 0, 0, 0, 0 };
-
- octal_buf[0] = *s;
- zendlval->value.str.len--;
- if ((s+1)<end && ZEND_IS_OCT(*(s+1))) {
- octal_buf[1] = *(++s);
- zendlval->value.str.len--;
- if ((s+1)<end && ZEND_IS_OCT(*(s+1))) {
- octal_buf[2] = *(++s);
- zendlval->value.str.len--;
- }
- }
- *t++ = (char) strtol(octal_buf, NULL, 8);
- } else if (*s=='x' && (s+1)<end && ZEND_IS_HEX(*(s+1))) {
- char hex_buf[3] = { 0, 0, 0};
-
- zendlval->value.str.len--; /* for the 'x' */
-
- hex_buf[0] = *(++s);
- zendlval->value.str.len--;
- if ((s+1)<end && ZEND_IS_HEX(*(s+1))) {
- hex_buf[1] = *(++s);
- zendlval->value.str.len--;
- }
- *t++ = (char) strtol(hex_buf, NULL, 16);
- } else {
- *t++ = '\\';
- *t++ = *s;
- }
- break;
- }
- s++;
- } else {
- *t++ = *s++;
- }
- }
- *t = 0;
-
- return T_CONSTANT_ENCAPSED_STRING;
-}
-
-
-<ST_IN_SCRIPTING>([']([^'\\]|("\\".))*[']) {
- register char *s, *t;
- char *end;
-
- zendlval->value.str.val = estrndup(yytext+1, yyleng-2);
- zendlval->value.str.len = yyleng-2;
- zendlval->type = IS_STRING;
- HANDLE_NEWLINES(yytext, yyleng);
-
- /* convert escape sequences */
- s = t = zendlval->value.str.val;
- end = s+zendlval->value.str.len;
- while (s<end) {
- if (*s=='\\') {
- s++;
- if (s>=end) {
- continue;
- }
- switch(*s) {
- case '\\':
- case '\'':
- *t++ = *s;
- zendlval->value.str.len--;
- break;
- default:
- *t++ = '\\';
- *t++ = *s;
- break;
- }
- s++;
- } else {
- *t++ = *s++;
- }
- }
- *t = 0;
-
- return T_CONSTANT_ENCAPSED_STRING;
-}
-
-
-<ST_IN_SCRIPTING>["] {
- BEGIN(ST_DOUBLE_QUOTES);
- return '\"';
-}
-
-
-<ST_IN_SCRIPTING>"<<<"{TABS_AND_SPACES}{LABEL}{NEWLINE} {
- char *s;
- CG(zend_lineno)++;
- CG(heredoc_len) = yyleng-3-1-(yytext[yyleng-2]=='\r'?1:0);
- s = yytext+3;
- while ((*s == ' ') || (*s == '\t')) {
- s++;
- CG(heredoc_len)--;
- }
- CG(heredoc) = estrndup(s, CG(heredoc_len));
- BEGIN(ST_HEREDOC);
- return T_START_HEREDOC;
-}
-
-
-<ST_IN_SCRIPTING>[`] {
- BEGIN(ST_BACKQUOTE);
- return '`';
-}
-
-
-<ST_IN_SCRIPTING>['] {
- BEGIN(ST_SINGLE_QUOTE);
- return '\'';
-}
-
-
-<ST_HEREDOC>^{LABEL}(";")?{NEWLINE} {
- int label_len;
- unsigned char unput_semicolon;
-
- CG(zend_lineno)++;
- if (yytext[yyleng-2]=='\r') {
- label_len = yyleng-2;
- } else {
- label_len = yyleng-1;
- }
-
- if (yytext[label_len-1]==';') {
- label_len--;
- unput_semicolon=1;
- } else{
- unput_semicolon=0;
- }
-
- if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), label_len)) {
- zendlval->value.str.val = estrndup(yytext, yyleng); /* unput destroys yytext */
- zendlval->value.str.len = yyleng;
- if (unput_semicolon) {
- unput(';');
- }
- efree(CG(heredoc));
- CG(heredoc)=NULL;
- CG(heredoc_len)=0;
- BEGIN(ST_IN_SCRIPTING);
- return T_END_HEREDOC;
- } else {
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_STRING;
- }
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{ESCAPED_AND_WHITESPACE} {
- HANDLE_NEWLINES(yytext, yyleng);
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_ENCAPSED_AND_WHITESPACE;
-}
-
-<ST_SINGLE_QUOTE>([^'\\]|\\[^'\\])+ {
- HANDLE_NEWLINES(yytext, yyleng);
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_ENCAPSED_AND_WHITESPACE;
-}
-
-
-<ST_DOUBLE_QUOTES>[`]+ {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_ENCAPSED_AND_WHITESPACE;
-}
-
-
-<ST_BACKQUOTE>["]+ {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_ENCAPSED_AND_WHITESPACE;
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"$"[^a-zA-Z_\x7f-\xff{] {
- zendlval->value.lval = (long) yytext[0];
- if (yyleng == 2) {
- yyless(1);
- }
- return T_CHARACTER;
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{ENCAPSED_TOKENS} {
- zendlval->value.lval = (long) yytext[0];
- return yytext[0];
-}
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"{$" {
- zendlval->value.lval = (long) yytext[0];
- yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
- yyless(1);
- return T_CURLY_OPEN;
-}
-
-
-<ST_SINGLE_QUOTE>"\\'" {
- zendlval->value.lval = (long) '\'';
- return T_CHARACTER;
-}
-
-<ST_SINGLE_QUOTE>"\\\\" {
- zendlval->value.lval = (long)'\\';
- return T_CHARACTER;
-}
-
-<ST_DOUBLE_QUOTES>"\\\"" {
- zendlval->value.lval = (long) '"';
- return T_CHARACTER;
-}
-
-<ST_BACKQUOTE>"\\`" {
- zendlval->value.lval = (long) '`';
- return T_CHARACTER;
-}
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\"[0-7]{1,3} {
- zendlval->value.lval = strtol(yytext+1, NULL, 8);
- return T_CHARACTER;
-}
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\x"[0-9A-Fa-f]{1,2} {
- zendlval->value.lval = strtol (yytext+2, NULL, 16);
- return T_CHARACTER;
-}
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\"{ANY_CHAR} {
- switch (yytext[1]) {
- case 'n':
- zendlval->value.lval = (long) '\n';
- break;
- case 't':
- zendlval->value.lval = (long) '\t';
- break;
- case 'r':
- zendlval->value.lval = (long) '\r';
- break;
- case '\\':
- zendlval->value.lval = (long) '\\';
- break;
- case '$':
- zendlval->value.lval = (long) yytext[1];
- break;
- case '{':
- zendlval->value.lval = (long) yytext[1];
- break;
- default:
- zendlval->value.str.val = estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_BAD_CHARACTER;
- break;
- }
- return T_CHARACTER;
-}
-
-
-<ST_HEREDOC>["'`]+ {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_ENCAPSED_AND_WHITESPACE;
-}
-
-
-<ST_DOUBLE_QUOTES>["] {
- BEGIN(ST_IN_SCRIPTING);
- return '\"';
-}
-
-
-<ST_BACKQUOTE>[`] {
- BEGIN(ST_IN_SCRIPTING);
- return '`';
-}
-
-
-<ST_SINGLE_QUOTE>['] {
- BEGIN(ST_IN_SCRIPTING);
- return '\'';
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,INITIAL,ST_IN_SCRIPTING,ST_LOOKING_FOR_PROPERTY><<EOF>> {
- return 0;
-}
-
-<ST_COMMENT,ST_DOC_COMMENT><<EOF>> {
- zend_error(E_COMPILE_WARNING,"Unterminated comment starting line %d", CG(comment_start_line));
- return 0;
-}
-
-
-
-<ST_IN_SCRIPTING,INITIAL,ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_SINGLE_QUOTE,ST_HEREDOC>{ANY_CHAR} {
- zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
-}
diff --git a/Zend/zend_list.c b/Zend/zend_list.c
deleted file mode 100644
index d165190c05..0000000000
--- a/Zend/zend_list.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* resource lists */
-
-#include "zend.h"
-#include "zend_list.h"
-#include "zend_API.h"
-#include "zend_globals.h"
-
-ZEND_API int le_index_ptr;
-
-/* true global */
-static HashTable list_destructors;
-
-
-ZEND_API int zend_list_insert(void *ptr, int type)
-{
- int index;
- zend_rsrc_list_entry le;
- TSRMLS_FETCH();
-
- le.ptr=ptr;
- le.type=type;
- le.refcount=1;
-
- index = zend_hash_next_free_element(&EG(regular_list));
-
- zend_hash_index_update(&EG(regular_list), index, (void *) &le, sizeof(zend_rsrc_list_entry), NULL);
- return index;
-}
-
-ZEND_API int _zend_list_delete(int id TSRMLS_DC)
-{
- zend_rsrc_list_entry *le;
-
- if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
-/* printf("del(%d): %d->%d\n", id, le->refcount, le->refcount-1); */
- if (--le->refcount<=0) {
- return zend_hash_index_del(&EG(regular_list), id);
- } else {
- return SUCCESS;
- }
- } else {
- return FAILURE;
- }
-}
-
-
-ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC)
-{
- zend_rsrc_list_entry *le;
-
- if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
- *type = le->type;
- return le->ptr;
- } else {
- *type = -1;
- return NULL;
- }
-}
-
-ZEND_API int _zend_list_addref(int id TSRMLS_DC)
-{
- zend_rsrc_list_entry *le;
-
- if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
-/* printf("add(%d): %d->%d\n", id, le->refcount, le->refcount+1); */
- le->refcount++;
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-
-ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type)
-{
- int rsrc_id;
-
- rsrc_id = zend_list_insert(rsrc_pointer, rsrc_type);
-
- if (rsrc_result) {
- rsrc_result->value.lval = rsrc_id;
- rsrc_result->type = IS_RESOURCE;
- }
-
- return rsrc_id;
-}
-
-
-ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...)
-{
- int id;
- int actual_resource_type;
- void *resource;
- va_list resource_types;
- int i;
-
- if (default_id==-1) { /* use id */
- if (!passed_id) {
- if (resource_type_name) {
- zend_error(E_WARNING, "%s(): no %s resource supplied", get_active_function_name(TSRMLS_C), resource_type_name);
- }
- return NULL;
- } else if ((*passed_id)->type != IS_RESOURCE) {
- if (resource_type_name) {
- zend_error(E_WARNING, "%s(): supplied argument is not a valid %s resource", get_active_function_name(TSRMLS_C), resource_type_name);
- }
- return NULL;
- }
- id = (*passed_id)->value.lval;
- } else {
- id = default_id;
- }
-
- resource = zend_list_find(id, &actual_resource_type);
- if (!resource) {
- if (resource_type_name) {
- zend_error(E_WARNING, "%s(): %d is not a valid %s resource", get_active_function_name(TSRMLS_C), id, resource_type_name);
- }
- return NULL;
- }
-
- va_start(resource_types, num_resource_types);
- for (i=0; i<num_resource_types; i++) {
- if (actual_resource_type == va_arg(resource_types, int)) {
- va_end(resource_types);
- if (found_resource_type) {
- *found_resource_type = actual_resource_type;
- }
- return resource;
- }
- }
- va_end(resource_types);
-
- if (resource_type_name) {
- zend_error(E_WARNING, "%s(): supplied resource is not a valid %s resource", get_active_function_name(TSRMLS_C), resource_type_name);
- }
-
- return NULL;
-}
-
-
-void list_entry_destructor(void *ptr)
-{
- zend_rsrc_list_entry *le = (zend_rsrc_list_entry *) ptr;
- zend_rsrc_list_dtors_entry *ld;
- TSRMLS_FETCH();
-
- if (zend_hash_index_find(&list_destructors, le->type, (void **) &ld)==SUCCESS) {
- switch (ld->type) {
- case ZEND_RESOURCE_LIST_TYPE_STD:
- if (ld->list_dtor) {
- (ld->list_dtor)(le->ptr);
- }
- break;
- case ZEND_RESOURCE_LIST_TYPE_EX:
- if (ld->list_dtor_ex) {
- ld->list_dtor_ex(le TSRMLS_CC);
- }
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- } else {
- zend_error(E_WARNING,"Unknown list entry type in request shutdown (%d)", le->type);
- }
-}
-
-
-void plist_entry_destructor(void *ptr)
-{
- zend_rsrc_list_entry *le = (zend_rsrc_list_entry *) ptr;
- zend_rsrc_list_dtors_entry *ld;
- TSRMLS_FETCH();
-
- if (zend_hash_index_find(&list_destructors, le->type, (void **) &ld)==SUCCESS) {
- switch (ld->type) {
- case ZEND_RESOURCE_LIST_TYPE_STD:
- if (ld->plist_dtor) {
- (ld->plist_dtor)(le->ptr);
- }
- break;
- case ZEND_RESOURCE_LIST_TYPE_EX:
- if (ld->plist_dtor_ex) {
- ld->plist_dtor_ex(le TSRMLS_CC);
- }
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- } else {
- zend_error(E_WARNING,"Unknown persistent list entry type in module shutdown (%d)", le->type);
- }
-}
-
-
-int zend_init_rsrc_list(TSRMLS_D)
-{
- if (zend_hash_init(&EG(regular_list), 0, NULL, list_entry_destructor, 0)==SUCCESS) {
- EG(regular_list).nNextFreeElement=1; /* we don't want resource id 0 */
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-
-int zend_init_rsrc_plist(TSRMLS_D)
-{
- return zend_hash_init_ex(&EG(persistent_list), 0, NULL, plist_entry_destructor, 1, 0);
-}
-
-
-void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC)
-{
- zend_hash_graceful_reverse_destroy(ht);
-}
-
-static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id TSRMLS_DC)
-{
- if (le->type == *resource_id) {
- return 1;
- } else {
- return 0;
- }
-}
-
-
-static int zend_clean_module_rsrc_dtors_cb(zend_rsrc_list_dtors_entry *ld, int *module_number TSRMLS_DC)
-{
- if (ld->module_number == *module_number) {
- zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC);
- zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC);
- return 1;
- } else {
- return 0;
- }
-}
-
-
-void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC)
-{
- zend_hash_apply_with_argument(&list_destructors, (apply_func_arg_t) zend_clean_module_rsrc_dtors_cb, (void *) &module_number TSRMLS_CC);
-}
-
-
-ZEND_API int zend_register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number)
-{
- zend_rsrc_list_dtors_entry lde;
-
-#if 0
- printf("Registering destructors %d for module %d\n", list_destructors.nNextFreeElement, module_number);
-#endif
-
- lde.list_dtor=(void (*)(void *)) ld;
- lde.plist_dtor=(void (*)(void *)) pld;
- lde.list_dtor_ex = lde.plist_dtor_ex = NULL;
- lde.module_number = module_number;
- lde.resource_id = list_destructors.nNextFreeElement;
- lde.type = ZEND_RESOURCE_LIST_TYPE_STD;
- lde.type_name = NULL;
-
- if (zend_hash_next_index_insert(&list_destructors, (void *) &lde, sizeof(zend_rsrc_list_dtors_entry), NULL)==FAILURE) {
- return FAILURE;
- }
- return list_destructors.nNextFreeElement-1;
-}
-
-
-ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_func_t pld, char *type_name, int module_number)
-{
- zend_rsrc_list_dtors_entry lde;
-
-#if 0
- printf("Registering destructors %d for module %d\n", list_destructors.nNextFreeElement, module_number);
-#endif
-
- lde.list_dtor = NULL;
- lde.plist_dtor = NULL;
- lde.list_dtor_ex = ld;
- lde.plist_dtor_ex = pld;
- lde.module_number = module_number;
- lde.resource_id = list_destructors.nNextFreeElement;
- lde.type = ZEND_RESOURCE_LIST_TYPE_EX;
- lde.type_name = type_name;
-
- if (zend_hash_next_index_insert(&list_destructors, (void *) &lde, sizeof(zend_rsrc_list_dtors_entry), NULL)==FAILURE) {
- return FAILURE;
- }
- return list_destructors.nNextFreeElement-1;
-}
-
-ZEND_API int zend_fetch_list_dtor_id(char *type_name)
-{
- zend_rsrc_list_dtors_entry *lde;
- HashPosition pos;
-
- zend_hash_internal_pointer_reset_ex(&list_destructors, &pos);
- while (zend_hash_get_current_data_ex(&list_destructors, (void **)&lde, &pos) == SUCCESS) {
- if (strcmp(type_name, lde->type_name) == 0) {
-#if 0
- printf("Found resource id %d for resource type %s\n", (*lde).resource_id, type_name);
-#endif
- return lde->resource_id;
- }
- zend_hash_move_forward_ex(&list_destructors, &pos);
- }
-
- return 0;
-}
-
-int zend_init_rsrc_list_dtors(void)
-{
- int retval;
-
- retval = zend_hash_init(&list_destructors, 50, NULL, NULL, 1);
- list_destructors.nNextFreeElement=1; /* we don't want resource type 0 */
-
- return retval;
-}
-
-
-void zend_destroy_rsrc_list_dtors(void)
-{
- zend_hash_destroy(&list_destructors);
-}
-
-
-char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC)
-{
- zend_rsrc_list_dtors_entry *lde;
- int rsrc_type;
-
- if (!zend_list_find(resource, &rsrc_type))
- return NULL;
-
- if (zend_hash_index_find(&list_destructors, rsrc_type, (void **) &lde)==SUCCESS) {
- return lde->type_name;
- } else {
- return NULL;
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_list.h b/Zend/zend_list.h
deleted file mode 100644
index 05f5d50bf8..0000000000
--- a/Zend/zend_list.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_LIST_H
-#define ZEND_LIST_H
-
-#include "zend_hash.h"
-#include "zend_globals.h"
-
-BEGIN_EXTERN_C()
-
-#define ZEND_RESOURCE_LIST_TYPE_STD 1
-#define ZEND_RESOURCE_LIST_TYPE_EX 2
-
-typedef struct _zend_rsrc_list_entry {
- void *ptr;
- int type;
- int refcount;
-} zend_rsrc_list_entry;
-
-typedef void (*rsrc_dtor_func_t)(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-#define ZEND_RSRC_DTOR_FUNC(name) void name(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-
-typedef struct _zend_rsrc_list_dtors_entry {
- /* old style destructors */
- void (*list_dtor)(void *);
- void (*plist_dtor)(void *);
-
- /* new style destructors */
- rsrc_dtor_func_t list_dtor_ex;
- rsrc_dtor_func_t plist_dtor_ex;
-
- char *type_name;
-
- int module_number;
- int resource_id;
- unsigned char type;
-} zend_rsrc_list_dtors_entry;
-
-
-#define register_list_destructors(ld, pld) zend_register_list_destructors((void (*)(void *))ld, (void (*)(void *))pld, module_number);
-ZEND_API int zend_register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number);
-ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_func_t pld, char *type_name, int module_number);
-
-void list_entry_destructor(void *ptr);
-void plist_entry_destructor(void *ptr);
-
-void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC);
-int zend_init_rsrc_list(TSRMLS_D);
-int zend_init_rsrc_plist(TSRMLS_D);
-void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC);
-int zend_init_rsrc_list_dtors(void);
-void zend_destroy_rsrc_list_dtors(void);
-
-ZEND_API int zend_list_insert(void *ptr, int type);
-ZEND_API int _zend_list_addref(int id TSRMLS_DC);
-ZEND_API int _zend_list_delete(int id TSRMLS_DC);
-ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC);
-
-#define zend_list_addref(id) _zend_list_addref(id TSRMLS_CC)
-#define zend_list_delete(id) _zend_list_delete(id TSRMLS_CC)
-#define zend_list_find(id, type) _zend_list_find(id, type TSRMLS_CC)
-
-ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type);
-ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...);
-
-ZEND_API char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC);
-ZEND_API int zend_fetch_list_dtor_id(char *type_name);
-
-extern ZEND_API int le_index_ptr; /* list entry type for index pointers */
-
-#define ZEND_VERIFY_RESOURCE(rsrc) \
- if (!rsrc) { \
- RETURN_NULL(); \
- }
-
-#define ZEND_FETCH_RESOURCE(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type) \
- rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 1, resource_type); \
- ZEND_VERIFY_RESOURCE(rsrc);
-
-#define ZEND_FETCH_RESOURCE2(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type1, resource_type2) \
- rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 2, resource_type1, resource_type2); \
- ZEND_VERIFY_RESOURCE(rsrc);
-
-#define ZEND_REGISTER_RESOURCE(rsrc_result, rsrc_pointer, rsrc_type) \
- zend_register_resource(rsrc_result, rsrc_pointer, rsrc_type);
-
-#define ZEND_GET_RESOURCE_TYPE_ID(le_id, le_type_name) \
- if (le_id == 0) { \
- le_id = zend_fetch_list_dtor_id(le_type_name); \
- }
-END_EXTERN_C()
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c
deleted file mode 100644
index 13fab349af..0000000000
--- a/Zend/zend_llist.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_llist.h"
-#include "zend_qsort.h"
-
-ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor, unsigned char persistent)
-{
- l->head = NULL;
- l->tail = NULL;
- l->count = 0;
- l->size = size;
- l->dtor = dtor;
- l->persistent = persistent;
-}
-
-
-ZEND_API void zend_llist_add_element(zend_llist *l, void *element)
-{
- zend_llist_element *tmp = pemalloc(sizeof(zend_llist_element)+l->size-1, l->persistent);
-
- tmp->prev = l->tail;
- tmp->next = NULL;
- if (l->tail) {
- l->tail->next = tmp;
- } else {
- l->head = tmp;
- }
- l->tail = tmp;
- memcpy(tmp->data, element, l->size);
-
- ++l->count;
-}
-
-
-ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element)
-{
- zend_llist_element *tmp = pemalloc(sizeof(zend_llist_element)+l->size-1, l->persistent);
-
- tmp->next = l->head;
- tmp->prev = NULL;
- if (l->head) {
- l->head->prev = tmp;
- } else {
- l->tail = tmp;
- }
- l->head = tmp;
- memcpy(tmp->data, element, l->size);
-
- ++l->count;
-}
-
-
-#define DEL_LLIST_ELEMENT(current, l) \
- if ((current)->prev) {\
- (current)->prev->next = (current)->next;\
- } else {\
- (l)->head = (current)->next;\
- }\
- if ((current)->next) {\
- (current)->next->prev = (current)->prev;\
- } else {\
- (l)->tail = (current)->prev;\
- }\
- if ((l)->dtor) {\
- (l)->dtor((current)->data);\
- }\
- pefree((current), (l)->persistent);\
- --l->count;
-
-
-ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2))
-{
- zend_llist_element *current=l->head;
- zend_llist_element *next;
-
- while (current) {
- next = current->next;
- if (compare(current->data, element)) {
- DEL_LLIST_ELEMENT(current, l);
- break;
- }
- current = next;
- }
-}
-
-
-ZEND_API void zend_llist_destroy(zend_llist *l)
-{
- zend_llist_element *current=l->head, *next;
-
- while (current) {
- next = current->next;
- if (l->dtor) {
- l->dtor(current->data);
- }
- pefree(current, l->persistent);
- current = next;
- }
-
- l->count = 0;
-}
-
-
-ZEND_API void zend_llist_clean(zend_llist *l)
-{
- zend_llist_destroy(l);
- l->head = l->tail = NULL;
-}
-
-
-ZEND_API void *zend_llist_remove_tail(zend_llist *l)
-{
- zend_llist_element *old_tail;
- void *data;
-
- if ((old_tail = l->tail)) {
- if (l->tail->prev) {
- l->tail->prev->next = NULL;
- }
-
- data = old_tail->data;
-
- l->tail = l->tail->prev;
- if (l->dtor) {
- l->dtor(data);
- }
- pefree(old_tail, l->persistent);
-
- --l->count;
-
- return data;
- }
-
- return NULL;
-}
-
-
-ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src)
-{
- zend_llist_element *ptr;
-
- zend_llist_init(dst, src->size, src->dtor, src->persistent);
- ptr = src->head;
- while (ptr) {
- zend_llist_add_element(dst, ptr->data);
- ptr = ptr->next;
- }
-}
-
-
-ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data))
-{
- zend_llist_element *element, *next;
-
- element=l->head;
- while (element) {
- next = element->next;
- if (func(element->data)) {
- DEL_LLIST_ELEMENT(element, l);
- }
- element = next;
- }
-}
-
-
-ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC)
-{
- zend_llist_element *element;
-
- for (element=l->head; element; element=element->next) {
- func(element->data TSRMLS_CC);
- }
-}
-
-ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC)
-{
- size_t i;
-
- zend_llist_element **elements;
- zend_llist_element *element, **ptr;
-
- if (l->count <= 0) {
- return;
- }
-
- elements = (zend_llist_element **) emalloc(l->count * sizeof(zend_llist_element *));
-
- ptr = &elements[0];
-
- for (element=l->head; element; element=element->next) {
- *ptr++ = element;
- }
-
- zend_qsort(elements, l->count, sizeof(zend_llist_element *), (compare_func_t) comp_func TSRMLS_CC);
-
- l->head = elements[0];
- elements[0]->prev = NULL;
-
- for (i = 1; i < l->count; i++) {
- elements[i]->prev = elements[i-1];
- elements[i-1]->next = elements[i];
- }
- elements[i-1]->next = NULL;
- l->tail = elements[i-1];
- efree(elements);
-}
-
-
-ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC)
-{
- zend_llist_element *element;
-
- for (element=l->head; element; element=element->next) {
- func(element->data, arg TSRMLS_CC);
- }
-}
-
-
-ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...)
-{
- zend_llist_element *element;
- va_list args;
-
- va_start(args, num_args);
- for (element=l->head; element; element=element->next) {
- func(element->data, num_args, args TSRMLS_CC);
- }
- va_end(args);
-}
-
-
-ZEND_API int zend_llist_count(zend_llist *l)
-{
- return l->count;
-}
-
-
-ZEND_API void *zend_llist_get_first_ex(zend_llist *l, zend_llist_position *pos)
-{
- zend_llist_position *current = pos ? pos : &l->traverse_ptr;
-
- *current = l->head;
- if (*current) {
- return (*current)->data;
- } else {
- return NULL;
- }
-}
-
-
-ZEND_API void *zend_llist_get_last_ex(zend_llist *l, zend_llist_position *pos)
-{
- zend_llist_position *current = pos ? pos : &l->traverse_ptr;
-
- *current = l->tail;
- if (*current) {
- return (*current)->data;
- } else {
- return NULL;
- }
-}
-
-
-ZEND_API void *zend_llist_get_next_ex(zend_llist *l, zend_llist_position *pos)
-{
- zend_llist_position *current = pos ? pos : &l->traverse_ptr;
-
- if (*current) {
- *current = (*current)->next;
- if (*current) {
- return (*current)->data;
- }
- }
- return NULL;
-}
-
-
-ZEND_API void *zend_llist_get_prev_ex(zend_llist *l, zend_llist_position *pos)
-{
- zend_llist_position *current = pos ? pos : &l->traverse_ptr;
-
- if (*current) {
- *current = (*current)->prev;
- if (*current) {
- return (*current)->data;
- }
- }
- return NULL;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_llist.h b/Zend/zend_llist.h
deleted file mode 100644
index f6c25664ba..0000000000
--- a/Zend/zend_llist.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_LLIST_H
-#define ZEND_LLIST_H
-
-typedef struct _zend_llist_element {
- struct _zend_llist_element *next;
- struct _zend_llist_element *prev;
- char data[1]; /* Needs to always be last in the struct */
-} zend_llist_element;
-
-typedef void (*llist_dtor_func_t)(void *);
-typedef int (*llist_compare_func_t)(const zend_llist_element **, const zend_llist_element ** TSRMLS_DC);
-typedef void (*llist_apply_with_args_func_t)(void *data, int num_args, va_list args TSRMLS_DC);
-typedef void (*llist_apply_with_arg_func_t)(void *data, void *arg TSRMLS_DC);
-typedef void (*llist_apply_func_t)(void * TSRMLS_DC);
-
-typedef struct _zend_llist {
- zend_llist_element *head;
- zend_llist_element *tail;
- size_t count;
- size_t size;
- llist_dtor_func_t dtor;
- unsigned char persistent;
- zend_llist_element *traverse_ptr;
-} zend_llist;
-
-typedef zend_llist_element* zend_llist_position;
-
-BEGIN_EXTERN_C()
-ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor, unsigned char persistent);
-ZEND_API void zend_llist_add_element(zend_llist *l, void *element);
-ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element);
-ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2));
-ZEND_API void zend_llist_destroy(zend_llist *l);
-ZEND_API void zend_llist_clean(zend_llist *l);
-ZEND_API void *zend_llist_remove_tail(zend_llist *l);
-ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src);
-ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC);
-ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data));
-ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC);
-ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...);
-ZEND_API int zend_llist_count(zend_llist *l);
-ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC);
-
-/* traversal */
-ZEND_API void *zend_llist_get_first_ex(zend_llist *l, zend_llist_position *pos);
-ZEND_API void *zend_llist_get_last_ex(zend_llist *l, zend_llist_position *pos);
-ZEND_API void *zend_llist_get_next_ex(zend_llist *l, zend_llist_position *pos);
-ZEND_API void *zend_llist_get_prev_ex(zend_llist *l, zend_llist_position *pos);
-
-#define zend_llist_get_first(l) zend_llist_get_first_ex(l, NULL)
-#define zend_llist_get_last(l) zend_llist_get_last_ex(l, NULL)
-#define zend_llist_get_next(l) zend_llist_get_next_ex(l, NULL)
-#define zend_llist_get_prev(l) zend_llist_get_prev_ex(l, NULL)
-
-END_EXTERN_C()
-
-#endif /* ZEND_LLIST_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_mm.c b/Zend/zend_mm.c
deleted file mode 100644
index 16ea253556..0000000000
--- a/Zend/zend_mm.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_mm.h"
-
-#if WIN32|WINNT
-# ifndef inline
-# define inline __inline
-# endif
-#endif
-
-#define ZEND_MM_FREE_BLOCK 0
-#define ZEND_MM_USED_BLOCK 1
-
-#ifndef MAX
-#define MAX(a, b) (((a)>(b))?(a):(b))
-#endif
-
-#ifndef ZEND_MM_ALIGNMENT
-#define ZEND_MM_ALIGNMENT 8
-#define ZEND_MM_ALIGNMENT_LOG2 3
-#endif
-
-#define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT-1)
-
-#define ZEND_MM_BUCKET_INDEX(true_size) (true_size >> ZEND_MM_ALIGNMENT_LOG2)
-
-#define ZEND_MM_GET_FREE_LIST_BUCKET(index, free_list_bucket) \
- if (index < ZEND_MM_NUM_BUCKETS) { \
- free_list_bucket = &heap->free_buckets[index]; \
- } else { \
- /* This size doesn't exist */ \
- free_list_bucket = &heap->free_buckets[0]; \
- }
-
-
-/* Aligned header size */
-#define ZEND_MM_ALIGNED_SIZE(size) ((size + ZEND_MM_ALIGNMENT - 1) & ZEND_MM_ALIGNMENT_MASK)
-#define ZEND_MM_ALIGNED_HEADER_SIZE ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_block))
-#define ZEND_MM_ALIGNED_FREE_HEADER_SIZE ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_free_block))
-#define ZEND_MM_ALIGNED_SEGMENT_SIZE ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_segment))
-
-/* Memory calculations */
-#define ZEND_MM_BLOCK_AT(blk, offset) ((zend_mm_block *) (((char *) (blk))+(offset)))
-#define ZEND_MM_DATA_OF(p) ((void *) (((char *) (p))+ZEND_MM_ALIGNED_HEADER_SIZE))
-#define ZEND_MM_HEADER_OF(blk) ZEND_MM_BLOCK_AT(blk, -(int)ZEND_MM_ALIGNED_HEADER_SIZE)
-
-/* Debug output */
-#define ZEND_MM_DEBUG(stmt)
-
-
-static inline void zend_mm_add_to_free_list(zend_mm_heap *heap, zend_mm_free_block *mm_block)
-{
- zend_mm_free_block **free_list_bucket;
- size_t index = ZEND_MM_BUCKET_INDEX(mm_block->size);
-
- ZEND_MM_GET_FREE_LIST_BUCKET(index, free_list_bucket);
-
- mm_block->next_free_block = *free_list_bucket;
- mm_block->prev_free_block = NULL;
- *free_list_bucket = mm_block;
-
- if (mm_block->next_free_block) {
- mm_block->next_free_block->prev_free_block = mm_block;
- }
-}
-
-
-static inline void zend_mm_remove_from_free_list(zend_mm_heap *heap, zend_mm_free_block *mm_block)
-{
- if (mm_block->prev_free_block) {
- mm_block->prev_free_block->next_free_block = mm_block->next_free_block;
- } else {
- zend_mm_free_block **free_list_bucket;
- size_t index = ZEND_MM_BUCKET_INDEX(mm_block->size);
-
- ZEND_MM_GET_FREE_LIST_BUCKET(index, free_list_bucket);
-
- *free_list_bucket = mm_block->next_free_block;
- }
-
- if (mm_block->next_free_block) {
- mm_block->next_free_block->prev_free_block = mm_block->prev_free_block;
- }
-}
-
-static inline void zend_mm_create_new_free_block(zend_mm_heap *heap, zend_mm_block *mm_block, size_t true_size)
-{
- int remaining_size;
- zend_mm_free_block *new_free_block;
-
- /* calculate sizes */
- remaining_size = mm_block->size - true_size;
-
- if (remaining_size < ZEND_MM_ALIGNED_FREE_HEADER_SIZE) {
- /* keep best_fit->size as is, it'll include this extra space */
- return;
- }
-
- /* prepare new free block */
- mm_block->size = true_size;
- new_free_block = (zend_mm_free_block *) ZEND_MM_BLOCK_AT(mm_block, mm_block->size);
-
- new_free_block->type = ZEND_MM_FREE_BLOCK;
- new_free_block->size = remaining_size;
- new_free_block->prev_size = true_size;
-
- /* update the next block's prev_size */
- ZEND_MM_BLOCK_AT(new_free_block, new_free_block->size)->prev_size = new_free_block->size;
-
- /* add the new free block to the free list */
- zend_mm_add_to_free_list(heap, new_free_block);
- return;
-}
-
-zend_bool zend_mm_add_memory_block(zend_mm_heap *heap, size_t block_size)
-{
- /* We need to make sure that block_size is big enough for the minimum segment size */
- zend_mm_free_block *mm_block;
- zend_mm_block *guard_block;
- zend_mm_segment *segment;
-
- /* align block size downwards */
- block_size = block_size & ZEND_MM_ALIGNMENT_MASK;
-
- segment = (zend_mm_segment *) malloc(block_size);
- if (!segment) {
- return 1;
- }
-/* fprintf(stderr, "Allocating segment %X\n", segment); */
- segment->next_segment = heap->segments_list;
- heap->segments_list = segment;
-
- block_size -= ZEND_MM_ALIGNED_SEGMENT_SIZE;
- mm_block = (zend_mm_free_block *) ((char *) segment + ZEND_MM_ALIGNED_SEGMENT_SIZE);
-
- mm_block->size = block_size - ZEND_MM_ALIGNED_HEADER_SIZE; /* keep one guard block in the end */
- mm_block->type = ZEND_MM_FREE_BLOCK;
- mm_block->prev_size = 0; /* Size is always at least ZEND_MM_ALIGNED_HEADER_SIZE big (>0) so 0 is OK */
-
- /* setup guard block */
- guard_block = ZEND_MM_BLOCK_AT(mm_block, mm_block->size);
- guard_block->type = ZEND_MM_USED_BLOCK;
- guard_block->size = ZEND_MM_ALIGNED_HEADER_SIZE;
- guard_block->guard_block = 1;
- guard_block->prev_size = mm_block->size;
- ZEND_MM_DEBUG(("Setup guard block at 0x%0.8X\n", guard_block));
-
- zend_mm_add_to_free_list(heap, mm_block);
-
- return 0;
-}
-
-/* Notes:
- * - This function may alter the block_sizes values to match platform alignment
- * - This function does *not* perform sanity checks on the arguments
- */
-zend_bool zend_mm_startup(zend_mm_heap *heap, size_t block_size)
-{
- heap->block_size = block_size;
- heap->segments_list = NULL;
- memset(heap->free_buckets, 0, sizeof(heap->free_buckets));
- return zend_mm_add_memory_block(heap, block_size);
-}
-
-
-void zend_mm_shutdown(zend_mm_heap *heap)
-{
- zend_mm_segment *segment = heap->segments_list;
- zend_mm_segment *prev;
-
- while (segment) {
- prev = segment;
- segment = segment->next_segment;
-/* fprintf(stderr, "Freeing segment %X\n", prev);*/
- free(prev);
- }
- heap->segments_list = NULL;
-}
-
-void *zend_mm_alloc(zend_mm_heap *heap, size_t size)
-{
- size_t true_size;
- zend_mm_free_block *p, *best_fit=NULL;
- zend_mm_free_block **free_list_bucket;
- size_t index;
-
- /* The max() can probably be optimized with an if() which checks more specific cases */
- true_size = MAX(ZEND_MM_ALIGNED_SIZE(size)+ZEND_MM_ALIGNED_HEADER_SIZE, ZEND_MM_ALIGNED_FREE_HEADER_SIZE);
-
- index = ZEND_MM_BUCKET_INDEX(true_size);
-
- if (index < ZEND_MM_NUM_BUCKETS) {
- ZEND_MM_GET_FREE_LIST_BUCKET(index, free_list_bucket);
-
- while (free_list_bucket != &heap->free_buckets[ZEND_MM_NUM_BUCKETS]) {
- if (*free_list_bucket) {
- best_fit = *free_list_bucket;
- goto zend_mm_finished_searching_for_block;
- }
- free_list_bucket++;
- }
- }
-
- for (p = heap->free_buckets[0]; p; p = p->next_free_block) {
- if (p->size == true_size) {
- best_fit = p;
- break;
- }
- if ((p->size > true_size) && (!best_fit || (best_fit->size > p->size))) { /* better fit */
- best_fit = p;
- }
- }
-
-zend_mm_finished_searching_for_block:
- if (!best_fit) {
- if (true_size > (heap->block_size - ZEND_MM_ALIGNED_SEGMENT_SIZE - ZEND_MM_ALIGNED_HEADER_SIZE)) {
- /* Make sure we add a memory block which is big enough */
- zend_mm_add_memory_block(heap, true_size + ZEND_MM_ALIGNED_SEGMENT_SIZE + ZEND_MM_ALIGNED_HEADER_SIZE);
- } else {
- zend_mm_add_memory_block(heap, heap->block_size);
- }
- return zend_mm_alloc(heap, size);
- }
-
- /* mark as used */
- best_fit->type = ZEND_MM_USED_BLOCK;
- ((zend_mm_block *) best_fit)->guard_block = 0;
-
- /* remove from free list */
- zend_mm_remove_from_free_list(heap, best_fit);
-
- zend_mm_create_new_free_block(heap, (zend_mm_block *) best_fit, true_size);
-
- return ZEND_MM_DATA_OF(best_fit);
-}
-
-
-void zend_mm_free(zend_mm_heap *heap, void *p)
-{
- zend_mm_block *mm_block = ZEND_MM_HEADER_OF(p);
- zend_mm_block *prev_block, *next_block;
-
- if (mm_block->type != ZEND_MM_USED_BLOCK) {
- /* error */
- return;
- }
-
- next_block = ZEND_MM_BLOCK_AT(mm_block, mm_block->size);
-
- /* merge with previous block if empty */
- if (mm_block->prev_size != 0
- && (prev_block=ZEND_MM_BLOCK_AT(mm_block, -(int)mm_block->prev_size))->type == ZEND_MM_FREE_BLOCK) {
- zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) prev_block);
- prev_block->size += mm_block->size;
- mm_block = prev_block;
- next_block->prev_size = mm_block->size;
- }
-
- /* merge with the next block if empty */
- if (next_block->type == ZEND_MM_FREE_BLOCK) {
- mm_block->size += next_block->size;
- zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) next_block);
- next_block = ZEND_MM_BLOCK_AT(mm_block, mm_block->size); /* recalculate */
- next_block->prev_size = mm_block->size;
- }
-
- mm_block->type = ZEND_MM_FREE_BLOCK;
- zend_mm_add_to_free_list(heap, (zend_mm_free_block *) mm_block);
-}
-
-void *zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size)
-{
- zend_mm_block *mm_block = ZEND_MM_HEADER_OF(p);
- zend_mm_block *next_block;
- size_t true_size = MAX(ZEND_MM_ALIGNED_SIZE(size)+ZEND_MM_ALIGNED_HEADER_SIZE, ZEND_MM_ALIGNED_FREE_HEADER_SIZE);
-
- if (true_size <= mm_block->size) {
- zend_mm_create_new_free_block(heap, mm_block, true_size);
- /* We don't yet merge this free block with the following one */
-
- return p;
- }
-
- next_block = ZEND_MM_BLOCK_AT(mm_block, mm_block->size);
-
- if ((mm_block->prev_size == 0) && (next_block->type == ZEND_MM_USED_BLOCK) &&
- (next_block->guard_block)) {
- zend_mm_segment *segment = (zend_mm_segment *) ((char *)mm_block - ZEND_MM_ALIGNED_SEGMENT_SIZE);
- zend_mm_segment *segment_copy = segment;
- zend_mm_block *guard_block;
- size_t realloc_to_size;
-
- /* segment size, size of block and size of guard block */
- realloc_to_size = ZEND_MM_ALIGNED_SEGMENT_SIZE+true_size+ZEND_MM_ALIGNED_HEADER_SIZE;
- segment = realloc(segment, realloc_to_size);
-
- if (segment != segment_copy) {
- if (heap->segments_list == segment_copy) {
- heap->segments_list = segment;
- } else {
- zend_mm_segment *seg = heap->segments_list;
-
- while (seg) {
- if (seg->next_segment == segment_copy) {
- seg->next_segment = segment;
- break;
- }
- seg = seg->next_segment;
- }
- }
- mm_block = (zend_mm_block *) ((char *) segment + ZEND_MM_ALIGNED_SEGMENT_SIZE);
- }
-
- mm_block->size = true_size;
-
- /* setup guard block */
- guard_block = ZEND_MM_BLOCK_AT(mm_block, mm_block->size);
- guard_block->type = ZEND_MM_USED_BLOCK;
- guard_block->size = ZEND_MM_ALIGNED_HEADER_SIZE;
- guard_block->guard_block = 1;
- guard_block->prev_size = mm_block->size;
-
- return ZEND_MM_DATA_OF(mm_block);
- }
-
- if (next_block->type != ZEND_MM_FREE_BLOCK || (mm_block->size + next_block->size < true_size)) {
- void *ptr;
-
- ptr = zend_mm_alloc(heap, size);
- memcpy(ptr, p, mm_block->size - ZEND_MM_ALIGNED_HEADER_SIZE);
- zend_mm_free(heap, p);
- return ptr;
- }
-
- zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) next_block);
- mm_block->size += next_block->size;
- /* update the next block's prev_size */
- ZEND_MM_BLOCK_AT(mm_block, mm_block->size)->prev_size = mm_block->size;
-
- zend_mm_create_new_free_block(heap, mm_block, true_size);
-
- return p;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_mm.h b/Zend/zend_mm.h
deleted file mode 100644
index 2325d47512..0000000000
--- a/Zend/zend_mm.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef _ZEND_MM_H
-#define _ZEND_MM_H
-
-#include <sys/types.h>
-
-#include "zend_types.h"
-
-/* Define this to enable Zend MM */
-#define ZEND_MM
-
-/* mm block type */
-typedef struct _zend_mm_block {
- unsigned int size : 31;
- unsigned int type : 1;
- size_t prev_size;
- unsigned int guard_block : 1;
-} zend_mm_block;
-
-typedef struct _zend_mm_free_block {
- unsigned int size : 31;
- unsigned int type : 1;
- size_t prev_size;
- struct _zend_mm_free_block *prev_free_block;
- struct _zend_mm_free_block *next_free_block;
-} zend_mm_free_block;
-
-typedef struct _zend_mm_segment {
- struct _zend_mm_segment *next_segment;
-} zend_mm_segment;
-
-#define ZEND_MM_NUM_BUCKETS 64
-
-typedef struct _zend_mm_heap {
- zend_mm_segment *segments_list;
- size_t block_size;
- zend_mm_free_block *free_buckets[ZEND_MM_NUM_BUCKETS];
-} zend_mm_heap;
-
-zend_bool zend_mm_startup(zend_mm_heap *heap, size_t block_size);
-void zend_mm_shutdown(zend_mm_heap *heap);
-void *zend_mm_alloc(zend_mm_heap *heap, size_t size);
-void zend_mm_free(zend_mm_heap *heap, void *p);
-void *zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size);
-
-#endif /* _ZEND_MM_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h
deleted file mode 100644
index 3722d935ae..0000000000
--- a/Zend/zend_modules.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef MODULES_H
-#define MODULES_H
-
-#include "zend.h"
-
-#define INIT_FUNC_ARGS int type, int module_number TSRMLS_DC
-#define INIT_FUNC_ARGS_PASSTHRU type, module_number TSRMLS_CC
-#define SHUTDOWN_FUNC_ARGS int type, int module_number TSRMLS_DC
-#define SHUTDOWN_FUNC_ARGS_PASSTHRU type, module_number TSRMLS_CC
-#define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module TSRMLS_DC
-#define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module TSRMLS_CC
-
-ZEND_API extern unsigned char first_arg_force_ref[];
-ZEND_API extern unsigned char second_arg_force_ref[];
-ZEND_API extern unsigned char third_arg_force_ref[];
-
-#define ZEND_MODULE_API_NO 20020429
-#ifdef ZTS
-#define USING_ZTS 1
-#else
-#define USING_ZTS 0
-#endif
-
-#define STANDARD_MODULE_HEADER sizeof(zend_module_entry), ZEND_MODULE_API_NO, ZEND_DEBUG, USING_ZTS, NULL
-#define ZE2_STANDARD_MODULE_HEADER sizeof(zend_module_entry), ZEND_MODULE_API_NO, ZEND_DEBUG, USING_ZTS, ini_entries
-
-#define STANDARD_MODULE_PROPERTIES_EX 0, 0, 0, NULL, 0
-
-#define STANDARD_MODULE_PROPERTIES \
- NULL, NULL, STANDARD_MODULE_PROPERTIES_EX
-
-#define NO_VERSION_YET NULL
-
-#define MODULE_PERSISTENT 1
-#define MODULE_TEMPORARY 2
-
-struct _zend_ini_entry;
-typedef struct _zend_module_entry zend_module_entry;
-
-struct _zend_module_entry {
- unsigned short size;
- unsigned int zend_api;
- unsigned char zend_debug;
- unsigned char zts;
- struct _zend_ini_entry *ini_entry;
- char *name;
- zend_function_entry *functions;
- int (*module_startup_func)(INIT_FUNC_ARGS);
- int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS);
- int (*request_startup_func)(INIT_FUNC_ARGS);
- int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS);
- void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS);
- char *version;
- int (*global_startup_func)(void);
- int (*global_shutdown_func)(void);
- int globals_id;
- int module_started;
- unsigned char type;
- void *handle;
- int module_number;
-};
-
-
-extern ZEND_API HashTable module_registry;
-
-void module_destructor(zend_module_entry *module);
-int module_registry_cleanup(zend_module_entry *module TSRMLS_DC);
-int module_registry_request_startup(zend_module_entry *module TSRMLS_DC);
-
-#define ZEND_MODULE_DTOR (void (*)(void *)) module_destructor
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_multibyte.c b/Zend/zend_multibyte.c
deleted file mode 100644
index e69de29bb2..0000000000
--- a/Zend/zend_multibyte.c
+++ /dev/null
diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h
deleted file mode 100644
index be41e588c3..0000000000
--- a/Zend/zend_multiply.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 2003 Sascha Schumann |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-#if defined(__i386__) && defined(__GNUC__)
-
-#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
- __asm__ ("imul %3,%0\n" \
- "adc $0,%1" \
- : "=r"(lval),"=r"(usedval) \
- : "0"(a), "r"(b), "1"(0)); \
- if (usedval) (dval) = (double) (a) * (double) (b); \
-} while (0)
-
-#else
-
-#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
- double __tmpvar = (double) (a) * (double) (b); \
- \
- if (__tmpvar >= LONG_MAX || __tmpvar <= LONG_MIN) { \
- (dval) = __tmpvar; \
- (usedval) = 1; \
- } else { \
- (lval) = (a) * (b); \
- (usedval) = 0; \
- } \
-} while (0)
-
-#endif
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
deleted file mode 100644
index 759967bec5..0000000000
--- a/Zend/zend_object_handlers.c
+++ /dev/null
@@ -1,843 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_globals.h"
-#include "zend_variables.h"
-#include "zend_API.h"
-#include "zend_objects.h"
-#include "zend_objects_API.h"
-#include "zend_object_handlers.h"
-
-#define DEBUG_OBJECT_HANDLERS 0
-
-#define Z_OBJ_P(zval_p) zend_objects_get_address(zval_p TSRMLS_CC)
-
-/*
- __X accessors explanation:
-
- if we have __get and property that is not part of the properties array is
- requested, we call __get handler. If it fails, we return uninitialized.
-
- if we have __set and property that is not part of the properties array is
- set, we call __set handler. If it fails, we do not change the array.
-
- for both handlers above, when we are inside __get/__set, no further calls for
- __get/__set for these objects will be made, to prevent endless recursion and
- enable accessors to change properties array.
-
- if we have __call and method which is not part of the class function table is
- called, we cal __call handler.
-*/
-
-static HashTable *zend_std_get_properties(zval *object TSRMLS_DC)
-{
- zend_object *zobj;
- zobj = Z_OBJ_P(object);
- return zobj->properties;
-}
-
-static zval *zend_std_call_getter(zval *object, zval *member TSRMLS_DC)
-{
- zval **call_args[1];
- zval *retval = NULL;
- zval __get_name;
- int call_result;
-
- /* __get handler is called with two arguments:
- property name
- return value for the object (by reference)
-
- it should return whether the call was successfull or not
- */
- INIT_PZVAL(&__get_name);
- ZVAL_STRINGL(&__get_name, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1, 0);
-
- call_args[0] = &member;
-
- /* go call the __get handler */
- call_result = call_user_function_ex(NULL,
- &object,
- &__get_name,
- &retval,
- 1, call_args,
- 0, NULL TSRMLS_CC);
-
- /*
- call_result is if call_user_function gone OK.
- retval returns the value that is received
- */
-
-
- if (call_result == FAILURE) {
- zend_error(E_ERROR, "Could not call __get handler for class %s", Z_OBJCE_P(object)->name);
- return NULL;
- }
-
- retval->refcount--;
-
- return retval;
-}
-
-static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_DC)
-{
- zval **call_args[2];
- zval *retval = NULL;
- zval __set_name;
- int call_result;
- int ret;
-
- /* __set handler is called with two arguments:
- property name
- value to be set
-
- it should return whether the call was successfull or not
- */
- INIT_PZVAL(&__set_name);
- ZVAL_STRINGL(&__set_name, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1, 0);
-
- call_args[0] = &member;
- value->refcount++;
- call_args[1] = &value;
-
- /* go call the __set handler */
- call_result = call_user_function_ex(NULL,
- &object,
- &__set_name,
- &retval,
- 2, call_args,
- 0, NULL TSRMLS_CC);
-
- /*
- call_result is if call_user_function gone OK.
- retval shows if __get method went OK.
- */
-
-
- if (call_result == FAILURE) {
- zend_error(E_ERROR, "Could not call __set handler for class %s", Z_OBJCE_P(object)->name);
- return FAILURE;
- }
-
- zval_ptr_dtor(&value);
-
- if (retval && zval_is_true(retval)) {
- ret = SUCCESS;
- } else {
- ret = FAILURE;
- }
-
- if (retval) {
- zval_ptr_dtor(&retval);
- }
-
- return ret;
-}
-
-
-inline int zend_verify_property_access(zend_property_info *property_info, zend_class_entry *ce TSRMLS_DC)
-{
- switch (property_info->flags & ZEND_ACC_PPP_MASK) {
- case ZEND_ACC_PUBLIC:
- return 1;
- case ZEND_ACC_PROTECTED:
- while (ce) {
- if (ce==EG(scope)) {
- return 1;
- }
- ce = ce->parent;
- }
- return 0;
- case ZEND_ACC_PRIVATE:
- if (ce==EG(scope)) {
- return 1;
- } else {
- return 0;
- }
- break;
- }
- return 0;
-}
-
-static inline zend_property_info *zend_get_property_info(zend_object *zobj, zval *member TSRMLS_DC)
-{
- zend_property_info *property_info = NULL;
- zend_property_info *scope_property_info;
- zend_bool denied_access = 0;
-
-
- ulong h = zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member)+1);
- if (zend_hash_quick_find(&zobj->ce->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &property_info)==SUCCESS) {
- if (zend_verify_property_access(property_info, zobj->ce TSRMLS_CC)) {
- if (property_info->flags & ZEND_ACC_CHANGED
- && !(property_info->flags & ZEND_ACC_PRIVATE)) {
- /* We still need to make sure that we're not in a context
- * where the right property is a different 'statically linked' private
- * continue checking below...
- */
- } else {
- return property_info;
- }
- } else {
- /* Try to look in the scope instead */
- denied_access = 1;
- }
- }
- if (EG(scope) != zobj->ce
- && EG(scope)
- && zend_hash_quick_find(&EG(scope)->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &scope_property_info)==SUCCESS
- && scope_property_info->flags & ZEND_ACC_PRIVATE) {
- return scope_property_info;
- } else if (property_info) {
- if (denied_access) {
- /* Information was available, but we were denied access. Error out. */
- zend_error(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), zobj->ce->name, Z_STRVAL_P(member));
- } else {
- /* fall through, return property_info... */
- }
- } else {
- EG(std_property_info).flags = ZEND_ACC_PUBLIC;
- EG(std_property_info).name = Z_STRVAL_P(member);
- EG(std_property_info).name_length = Z_STRLEN_P(member);
- EG(std_property_info).h = zend_get_hash_value(EG(std_property_info).name, EG(std_property_info).name_length+1);
- property_info = &EG(std_property_info);
- }
- return property_info;
-}
-
-
-zval *zend_std_read_property(zval *object, zval *member TSRMLS_DC)
-{
- zend_object *zobj;
- zval tmp_member;
- zval **retval;
- zval *rv = NULL;
- zend_property_info *property_info;
-
- zobj = Z_OBJ_P(object);
-
- if (member->type != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
- member = &tmp_member;
- }
-
-#if DEBUG_OBJECT_HANDLERS
- fprintf(stderr, "Read object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member));
-#endif
-
- property_info = zend_get_property_info(zobj, member TSRMLS_CC);
-
- if (zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE) {
- if (zobj->ce->__get && !zobj->in_get) {
- /* have getter - try with it! */
- zobj->in_get = 1; /* prevent circular getting */
- rv = zend_std_call_getter(object, member TSRMLS_CC);
- zobj->in_get = 0;
-
- if (rv) {
- retval = &rv;
- } else {
- retval = &EG(uninitialized_zval_ptr);
- }
- } else {
- zend_error(E_NOTICE,"Undefined property: %s::$%s", zobj->ce->name, Z_STRVAL_P(member));
- retval = &EG(uninitialized_zval_ptr);
- }
- }
- if (member == &tmp_member) {
- zval_dtor(member);
- }
- return *retval;
-}
-
-
-static void zend_std_write_property(zval *object, zval *member, zval *value TSRMLS_DC)
-{
- zend_object *zobj;
- zval tmp_member;
- zval **variable_ptr;
- int setter_done = 0;
- zend_property_info *property_info;
-
- zobj = Z_OBJ_P(object);
-
- if (member->type != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
- member = &tmp_member;
- }
-
- property_info = zend_get_property_info(zobj, member TSRMLS_CC);
-
- if (zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &variable_ptr) == SUCCESS) {
- if (*variable_ptr == value) {
- /* if we already have this value there, we don't actually need to do anything */
- setter_done = 1;
- } else {
- /* if we are assigning reference, we shouldn't move it, but instead assign variable
- to the same pointer */
- if (PZVAL_IS_REF(*variable_ptr)) {
- zval_dtor(*variable_ptr); /* old value should be destroyed */
- /* To check: can't *variable_ptr be some system variable like error_zval here? */
- (*variable_ptr)->type = value->type;
- (*variable_ptr)->value = value->value;
- if (value->refcount>0) {
- zval_copy_ctor(*variable_ptr);
- }
- setter_done = 1;
- }
- }
- } else {
- if (zobj->ce->__set && !zobj->in_set) {
- zobj->in_set = 1; /* prevent circular setting */
- if (zend_std_call_setter(object, member, value TSRMLS_CC) != SUCCESS) {
- /* for now, just ignore it - __set should take care of warnings, etc. */
- }
- setter_done = 1;
- zobj->in_set = 0;
- }
- }
-
- if (!setter_done) {
- zval **foo;
-
- /* if we assign referenced variable, we should separate it */
- value->refcount++;
- if (PZVAL_IS_REF(value)) {
- SEPARATE_ZVAL(&value);
- }
- zend_hash_quick_update(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, &value, sizeof(zval *), (void **) &foo);
- }
- if (member == &tmp_member) {
- zval_dtor(member);
- }
-}
-
-static zval **zend_std_get_property_ptr(zval *object, zval *member TSRMLS_DC)
-{
- zend_object *zobj;
- zval tmp_member;
- zval **retval;
- zend_property_info *property_info;
-
- zobj = Z_OBJ_P(object);
-
- if (member->type != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
- member = &tmp_member;
- }
-
-#if DEBUG_OBJECT_HANDLERS
- fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member));
-#endif
-
- property_info = zend_get_property_info(zobj, member TSRMLS_CC);
-
- if (zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE) {
- zval *new_zval;
-
- if (!zobj->ce->__get) {
- /* we don't have getter - will just add it */
- new_zval = &EG(uninitialized_zval);
-
-/* zend_error(E_NOTICE, "Undefined property: %s", Z_STRVAL_P(member)); */
- new_zval->refcount++;
- zend_hash_quick_update(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, &new_zval, sizeof(zval *), (void **) &retval);
- } else {
- /* we do have getter - fail and let it try again with usual get/set */
- retval = NULL;
- }
- }
- if (member == &tmp_member) {
- zval_dtor(member);
- }
- return retval;
-}
-
-static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC)
-{
- zend_object *zobj;
- zval tmp_member;
- zend_property_info *property_info;
-
- zobj = Z_OBJ_P(object);
-
- if (member->type != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
- member = &tmp_member;
- }
-
- property_info = zend_get_property_info(zobj, member TSRMLS_CC);
-
- zend_hash_del(zobj->properties, property_info->name, property_info->name_length+1);
- if (member == &tmp_member) {
- zval_dtor(member);
- }
-}
-
-static void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval ***args;
- zend_internal_function *func = (zend_internal_function *)EG(function_state_ptr)->function;
- zval method_name, method_args, __call_name;
- zval *method_name_ptr, *method_args_ptr;
- zval **call_args[2];
- zval *method_result_ptr = NULL;
- int i, call_result;
-
- args = (zval ***)emalloc(ZEND_NUM_ARGS() * sizeof(zval **));
-
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- efree(args);
- zend_error(E_ERROR, "Cannot get arguments for __call");
- RETURN_FALSE;
- }
-
- method_name_ptr = &method_name;
- INIT_PZVAL(method_name_ptr);
- ZVAL_STRING(method_name_ptr, func->function_name, 0); /* no dup - it's a copy */
-
- method_args_ptr = &method_args;
- INIT_PZVAL(method_args_ptr);
- array_init(method_args_ptr);
-
- for(i=0; i<ZEND_NUM_ARGS(); i++) {
- zval_add_ref(args[i]);
- add_next_index_zval(method_args_ptr, *args[i]);
- }
-
- efree(args);
-
- INIT_PZVAL(&__call_name);
- ZVAL_STRINGL(&__call_name, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1, 0);
-
- /* __call handler is called with two arguments:
- method name
- array of method parameters
-
- */
- call_args[0] = &method_name_ptr;
- call_args[1] = &method_args_ptr;
-
- /* go call the __call handler */
- call_result = call_user_function_ex(NULL,
- &this_ptr,
- &__call_name,
- &method_result_ptr,
- 2, call_args,
- 0, NULL TSRMLS_CC);
-
- /* call_result is if call_user_function gone OK.
- method_result_ptr is the true result of the called method
- */
-
- if (method_result_ptr) {
- *return_value = *method_result_ptr;
- zval_copy_ctor(return_value);
- zval_ptr_dtor(&method_result_ptr);
- }
-
- if (call_result == FAILURE) {
- zend_error(E_ERROR, "Could not call __call handler for class %s", Z_OBJCE_P(this_ptr)->name);
- }
-
- /* now destruct all auxiliaries */
- zval_dtor(method_args_ptr);
- zval_dtor(method_name_ptr);
-
- /* destruct the function also, then - we have allocated it in get_method */
- efree(func);
-}
-
-/* Ensures that we're allowed to call a private method.
- * Returns the function address that should be called, or NULL
- * if no such function exists.
- */
-inline zend_function *zend_check_private(zend_function *fbc, zend_class_entry *ce, int fn_flags, char *function_name_strval, int function_name_strlen TSRMLS_DC)
-{
- if (!ce) {
- return 0;
- }
-
- /* We may call a private function if:
- * 1. The class of our object is the same as the scope, and the private
- * function (EX(fbc)) has the same scope.
- * 2. One of our parent classes are the same as the scope, and it contains
- * a private function with the same name that has the same scope.
- */
- if (fbc->common.scope == ce && EG(scope) == ce) {
- /* rule #1 checks out ok, allow the function call */
- return fbc;
- }
-
-
- /* Check rule #2 */
- ce = ce->parent;
- while (ce) {
- if (ce == EG(scope)) {
- if (zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen+1, (void **) &fbc)==SUCCESS
- && fbc->op_array.fn_flags & ZEND_ACC_PRIVATE
- && fbc->common.scope == EG(scope)) {
- return fbc;
- }
- break;
- }
- ce = ce->parent;
- }
- return NULL;
-}
-
-
-/* Ensures that we're allowed to call a protected method.
- */
-inline int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope)
-{
- zend_class_entry *fbc_scope = ce;
-
- /* Is the context that's calling the function, the same as one of
- * the function's parents?
- */
- while (fbc_scope) {
- if (fbc_scope==scope) {
- return 1;
- }
- fbc_scope = fbc_scope->parent;
- }
-
- /* Is the function's scope the same as our current object context,
- * or any of the parents of our context?
- */
- while (scope) {
- if (scope==ce) {
- return 1;
- }
- scope = scope->parent;
- }
- return 0;
-}
-
-
-static union _zend_function *zend_std_get_method(zval *object, char *method_name, int method_len TSRMLS_DC)
-{
- zend_object *zobj;
- zend_function *fbc;
- char *lc_method_name;
-
- lc_method_name = do_alloca(method_len+1);
- /* Create a zend_copy_str_tolower(dest, src, src_length); */
- memcpy(lc_method_name, method_name, method_len+1);
- zend_str_tolower(lc_method_name, method_len);
-
- zobj = Z_OBJ_P(object);
- if (zend_hash_find(&zobj->ce->function_table, lc_method_name, method_len+1, (void **)&fbc) == FAILURE) {
- if (zobj->ce->__call) {
- zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function));
- call_user_call->type = ZEND_INTERNAL_FUNCTION;
- call_user_call->handler = zend_std_call_user_call;
- call_user_call->arg_types = NULL;
- call_user_call->scope = zobj->ce;
- call_user_call->fn_flags = 0;
- call_user_call->function_name = estrndup(method_name, method_len);
-
- free_alloca(lc_method_name);
- return (union _zend_function *)call_user_call;
- } else {
- return NULL;
- }
- }
-
- /* Check access level */
- if (fbc->op_array.fn_flags & ZEND_ACC_PUBLIC) {
- /* Ensure that we haven't overridden a private function and end up calling
- * the overriding public function...
- */
- if (EG(scope) && fbc->op_array.fn_flags & ZEND_ACC_CHANGED) {
- zend_function *priv_fbc;
-
- if (zend_hash_find(&EG(scope)->function_table, method_name, method_len+1, (void **) &priv_fbc)==SUCCESS
- && priv_fbc->common.fn_flags & ZEND_ACC_PRIVATE) {
- fbc = priv_fbc;
- }
- }
- } else if (fbc->op_array.fn_flags & ZEND_ACC_PRIVATE) {
- zend_function *updated_fbc;
-
- /* Ensure that if we're calling a private function, we're allowed to do so.
- */
- updated_fbc = zend_check_private(fbc, object->value.obj.handlers->get_class_entry(object TSRMLS_CC), fbc->common.fn_flags, method_name, method_len TSRMLS_CC);
- if (!updated_fbc) {
- zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
- }
- fbc = updated_fbc;
- } else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) {
- /* Ensure that if we're calling a protected function, we're allowed to do so.
- */
- if (!zend_check_protected(fbc->common.scope, EG(scope))) {
- zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
- }
- }
-
- free_alloca(lc_method_name);
- return fbc;
-}
-
-
-/* This is not (yet?) in the API, but it belongs in the built-in objects callbacks */
-zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC)
-{
- zend_function *fbc;
-
- if (zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen+1, (void **) &fbc)==FAILURE) {
- char *class_name = ce->name;
-
- if (!class_name) {
- class_name = "";
- }
- zend_error(E_ERROR, "Call to undefined method %s::%s()", class_name, function_name_strval);
- }
- if (fbc->op_array.fn_flags & ZEND_ACC_PUBLIC) {
- /* No further checks necessary, most common case */
- } else if (fbc->op_array.fn_flags & ZEND_ACC_PRIVATE) {
- zend_function *updated_fbc;
-
- /* Ensure that if we're calling a private function, we're allowed to do so.
- */
- updated_fbc = zend_check_private(fbc, EG(scope), fbc->common.fn_flags, function_name_strval, function_name_strlen TSRMLS_CC);
- if (!updated_fbc) {
- zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), function_name_strval, EG(scope) ? EG(scope)->name : "");
- }
- fbc = updated_fbc;
- } else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) {
- /* Ensure that if we're calling a protected function, we're allowed to do so.
- */
- if (!zend_check_protected(EG(scope), fbc->common.scope)) {
- zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), function_name_strval, EG(scope) ? EG(scope)->name : "");
- }
- }
-
- return fbc;
-}
-
-
-zval **zend_std_get_static_property(zend_class_entry *ce, char *property_name, int property_name_len, zend_bool silent TSRMLS_DC)
-{
- HashTable *statics_table;
- zval **retval = NULL;
- zend_class_entry *tmp_ce = ce;
- zend_property_info *property_info;
- zend_property_info std_property_info;
-
- if (ce->type == ZEND_USER_NAMESPACE || ce->type == ZEND_INTERNAL_NAMESPACE) {
- zend_hash_find(ce->static_members, property_name, property_name_len+1, (void **) &retval);
- } else {
- if (zend_hash_find(&ce->properties_info, property_name, property_name_len+1, (void **) &property_info)==FAILURE) {
- std_property_info.flags = ZEND_ACC_PUBLIC;
- std_property_info.name = property_name;
- std_property_info.name_length = property_name_len;
- std_property_info.h = zend_get_hash_value(std_property_info.name, std_property_info.name_length+1);
- property_info = &std_property_info;
- }
-
-#if 1&&DEBUG_OBJECT_HANDLERS
- zend_printf("Access type for %s::%s is %s\n", ce->name, property_name, zend_visibility_string(property_info->flags));
-#endif
-
- if (!zend_verify_property_access(property_info, ce TSRMLS_CC)) {
- zend_error(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ce->name, property_name);
- }
-
- while (tmp_ce) {
- if (zend_hash_quick_find(tmp_ce->static_members, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval)==SUCCESS) {
- statics_table = tmp_ce->static_members;
- break;
- }
- tmp_ce = tmp_ce->parent;
- }
- }
-
- if (!retval) {
- if (silent) {
- return NULL;
- } else {
- zend_error(E_ERROR, "Access to undeclared static property: %s::$%s", ce->name, property_name);
- }
- }
-
- zval_update_constant(retval, (void *) 1 TSRMLS_CC);
- return retval;
-}
-
-
-zend_bool zend_std_unset_static_property(zend_class_entry *ce, char *property_name, int property_name_len TSRMLS_DC)
-{
- zend_error(E_ERROR, "Attempt to unset static property %s::$%s", ce->name, property_name);
- return 0;
-}
-
-
-static union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC)
-{
- zend_object *zobj = Z_OBJ_P(object);
- zend_function *constructor = zobj->ce->constructor;
-
- if (constructor) {
- if (constructor->op_array.fn_flags & ZEND_ACC_PUBLIC) {
- /* No further checks necessary */
- } else if (constructor->op_array.fn_flags & ZEND_ACC_PRIVATE) {
- /* Ensure that if we're calling a private function, we're allowed to do so.
- */
- if (object->value.obj.handlers->get_class_entry(object TSRMLS_CC) != EG(scope)) {
- zend_error(E_ERROR, "Call to private constructor from context '%s'", EG(scope) ? EG(scope)->name : "");
- }
- } else if ((constructor->common.fn_flags & ZEND_ACC_PROTECTED)) {
- /* Ensure that if we're calling a protected function, we're allowed to do so.
- */
- if (!zend_check_protected(constructor->common.scope, EG(scope))) {
- zend_error(E_ERROR, "Call to protected constructor from context '%s'", EG(scope) ? EG(scope)->name : "");
- }
- }
- }
-
- return constructor;
-}
-
-
-int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_DC);
-
-
-static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC)
-{
- zend_object *zobj1, *zobj2;
-
- zobj1 = Z_OBJ_P(o1);
- zobj2 = Z_OBJ_P(o2);
-
- if (zobj1->ce != zobj2->ce) {
- return 1; /* different classes */
- }
- return zend_compare_symbol_tables_i(zobj1->properties, zobj2->properties TSRMLS_CC);
-}
-
-
-static int zend_std_has_property(zval *object, zval *member, int check_empty TSRMLS_DC)
-{
- zend_object *zobj;
- int result;
- zval **value;
- zval tmp_member;
- zend_property_info *property_info;
-
- zobj = Z_OBJ_P(object);
-
- if (member->type != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
- member = &tmp_member;
- }
-
-#if DEBUG_OBJECT_HANDLERS
- fprintf(stderr, "Read object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member));
-#endif
-
- property_info = zend_get_property_info(zobj, member TSRMLS_CC);
-
- if (zend_hash_find(zobj->properties, property_info->name, property_info->name_length+1, (void **) &value) == SUCCESS) {
- if (check_empty) {
- result = zend_is_true(*value);
- } else {
- result = (Z_TYPE_PP(value) != IS_NULL);
- }
- } else {
- result = 0;
- }
-
- if (member == &tmp_member) {
- zval_dtor(member);
- }
- return result;
-}
-
-
-zend_class_entry *zend_std_object_get_class(zval *object TSRMLS_DC)
-{
- zend_object *zobj;
- zobj = Z_OBJ_P(object);
-
- return zobj->ce;
-}
-
-int zend_std_object_get_class_name(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
-{
- zend_object *zobj;
- zend_class_entry *ce;
- zobj = Z_OBJ_P(object);
-
- if (parent) {
- if (!zobj->ce->parent) {
- return FAILURE;
- }
- ce = zobj->ce->parent;
- } else {
- ce = zobj->ce;
- }
-
- zend_make_full_classname(ce, class_name, class_name_len);
- return SUCCESS;
-}
-
-zend_object_handlers std_object_handlers = {
- zend_objects_store_add_ref, /* add_ref */
- zend_objects_store_del_ref, /* del_ref */
- zend_objects_store_delete_obj, /* delete_obj */
- zend_objects_clone_obj, /* clone_obj */
-
- zend_std_read_property, /* read_property */
- zend_std_write_property, /* write_property */
- zend_std_get_property_ptr, /* get_property_ptr */
- zend_std_get_property_ptr, /* get_property_zval_ptr */
- NULL, /* get */
- NULL, /* set */
- zend_std_has_property, /* has_property */
- zend_std_unset_property, /* unset_property */
- zend_std_get_properties, /* get_properties */
- zend_std_get_method, /* get_method */
- NULL, /* call_method */
- zend_std_get_constructor, /* get_constructor */
- zend_std_object_get_class, /* get_class_entry */
- zend_std_object_get_class_name, /* get_class_name */
- zend_std_compare_objects /* compare_objects */
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h
deleted file mode 100644
index 78c9e4fee3..0000000000
--- a/Zend/zend_object_handlers.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_OBJECT_HANDLERS_H
-#define ZEND_OBJECT_HANDLERS_H
-
-union _zend_function;
-
-typedef zval *(*zend_object_read_property_t)(zval *object, zval *member TSRMLS_DC);
-/* Used to fetch property from the object, read-only */
-typedef void (*zend_object_write_property_t)(zval *object, zval *member, zval *value TSRMLS_DC);
-/* Used to set property of the object */
-
-typedef zval **(*zend_object_get_property_ptr_t)(zval *object, zval *member TSRMLS_DC);
-/* Used to create pointer to the property of the object, for future r/w access via get/set */
-typedef zval **(*zend_object_get_property_zval_ptr_t)(zval *object, zval *member TSRMLS_DC);
-/* Used to create pointer to the property of the object, for future direct r/w access */
-typedef void (*zend_object_set_t)(zval **property, zval *value TSRMLS_DC);
-/* Used to set object value (most probably used in combination with
-typedef the result of the get_property_ptr) */
-typedef zval* (*zend_object_get_t)(zval *property TSRMLS_DC);
-/* Used to get object value (most probably used in combination with
-the result of the get_property_ptr or when converting object value to
-one of the basic types) */
-
-typedef int (*zend_object_has_property_t)(zval *object, zval *member, int check_empty TSRMLS_DC);
-/* Used to check if a property of the object exists */
-typedef void (*zend_object_unset_property_t)(zval *object, zval *member TSRMLS_DC);
-/* Used to remove a property of the object */
-
-typedef HashTable *(*zend_object_get_properties_t)(zval *object TSRMLS_DC);
-/* Used to get hash of the properties of the object, as hash of zval's */
-
-typedef int (*zend_object_call_method_t)(char *method, INTERNAL_FUNCTION_PARAMETERS);
-/* Used to call methods */
-/* args on stack! */
-/* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback fror this.
-*/
-typedef union _zend_function *(*zend_object_get_method_t)(zval *object, char *method, int method_len TSRMLS_DC);
-typedef union _zend_function *(*zend_object_get_constructor_t)(zval *object TSRMLS_DC);
-/* Get method parameter mask - by value/by reference, etc. */
-
-/* Object maintenance/destruction */
-typedef void (*zend_object_add_ref_t)(zval *object TSRMLS_DC);
-typedef void (*zend_object_del_ref_t)(zval *object TSRMLS_DC);
-typedef void (*zend_object_delete_obj_t)(zval *object TSRMLS_DC);
-typedef zend_object_value (*zend_object_clone_obj_t)(zval *object TSRMLS_DC);
-
-typedef zend_class_entry *(*zend_object_get_class_entry_t)(zval *object TSRMLS_DC);
-typedef int (*zend_object_get_class_name_t)(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC);
-typedef int (*zend_object_compare_t)(zval *object1, zval *object2 TSRMLS_DC);
-
-typedef struct _zend_object_handlers {
- /* general object functions */
- zend_object_add_ref_t add_ref;
- zend_object_del_ref_t del_ref;
- zend_object_delete_obj_t delete_obj;
- zend_object_clone_obj_t clone_obj;
- /* individual object functions */
- zend_object_read_property_t read_property;
- zend_object_write_property_t write_property;
- zend_object_get_property_ptr_t get_property_ptr;
- zend_object_get_property_zval_ptr_t get_property_zval_ptr;
- zend_object_get_t get;
- zend_object_set_t set;
- zend_object_has_property_t has_property;
- zend_object_unset_property_t unset_property;
- zend_object_get_properties_t get_properties;
- zend_object_get_method_t get_method;
- zend_object_call_method_t call_method;
- zend_object_get_constructor_t get_constructor;
- zend_object_get_class_entry_t get_class_entry;
- zend_object_get_class_name_t get_class_name;
- zend_object_compare_t compare_objects;
-} zend_object_handlers;
-
-extern zend_object_handlers std_object_handlers;
-union _zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC);
-zval **zend_std_get_static_property(zend_class_entry *ce, char *property_name, int property_name_len, zend_bool silent TSRMLS_DC);
-zend_bool zend_std_unset_static_property(zend_class_entry *ce, char *property_name, int property_name_len TSRMLS_DC);
-
-
-#define IS_ZEND_STD_OBJECT(z) ((z).type == IS_OBJECT && (Z_OBJ_HT((z))->get_class_entry != NULL))
-#define HAS_CLASS_ENTRY(z) (Z_OBJ_HT(z)->get_class_entry != NULL)
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c
deleted file mode 100644
index 51d402c4e4..0000000000
--- a/Zend/zend_objects.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_globals.h"
-#include "zend_variables.h"
-#include "zend_API.h"
-
-static inline void zend_objects_call_destructor(zend_object *object, zend_object_handle handle TSRMLS_DC)
-{
- if (object->ce->destructor) {
- zval *obj;
- zval *destructor_func_name;
- zval *retval_ptr;
- HashTable symbol_table;
-
- MAKE_STD_ZVAL(obj);
- obj->type = IS_OBJECT;
- obj->value.obj.handle = handle;
- obj->value.obj.handlers = &std_object_handlers;
- zval_copy_ctor(obj);
-
-
- /* FIXME: Optimize this so that we use the old_object->ce->destructor function pointer instead of the name */
- MAKE_STD_ZVAL(destructor_func_name);
- destructor_func_name->type = IS_STRING;
- destructor_func_name->value.str.val = estrndup("__destruct", sizeof("__destruct")-1);
- destructor_func_name->value.str.len = sizeof("__destruct")-1;
-
- ZEND_INIT_SYMTABLE(&symbol_table);
-
- call_user_function_ex(NULL, &obj, destructor_func_name, &retval_ptr, 0, NULL, 0, &symbol_table TSRMLS_CC);
-
- zend_hash_destroy(&symbol_table);
- zval_ptr_dtor(&obj);
- zval_ptr_dtor(&destructor_func_name);
- if (retval_ptr) {
- zval_ptr_dtor(&retval_ptr);
- }
- }
-}
-
-
-ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC)
-{
- zend_objects_call_destructor(object, handle TSRMLS_CC);
- /* Nuke the object */
- zend_hash_destroy(object->properties);
- FREE_HASHTABLE(object->properties);
- efree(object);
-}
-
-ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_entry *class_type TSRMLS_DC)
-{
- zend_object_value retval;
-
- *object = emalloc(sizeof(zend_object));
- (*object)->ce = class_type;
- retval.handle = zend_objects_store_put(*object, (zend_objects_store_dtor_t) zend_objects_destroy_object, NULL TSRMLS_CC);
- retval.handlers = &std_object_handlers;
- (*object)->in_get = 0;
- (*object)->in_set = 0;
- return retval;
-}
-
-ZEND_API zend_object *zend_objects_get_address(zval *zobject TSRMLS_DC)
-{
- return (zend_object *)zend_object_store_get_object(zobject TSRMLS_CC);
-}
-
-ZEND_API zend_object_value zend_objects_clone_obj(zval *zobject TSRMLS_DC)
-{
- zend_object_value retval;
- zend_object *old_object;
- zend_object *new_object;
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
-
- old_object = zend_objects_get_address(zobject TSRMLS_CC);
- retval = zend_objects_new(&new_object, old_object->ce TSRMLS_CC);
-
- if (old_object->ce->clone) {
- zval *old_obj;
- zval *new_obj;
- zval *clone_func_name;
- zval *retval_ptr;
- HashTable symbol_table;
-
- MAKE_STD_ZVAL(new_obj);
- new_obj->type = IS_OBJECT;
- new_obj->value.obj = retval;
- zval_copy_ctor(new_obj);
-
- MAKE_STD_ZVAL(old_obj);
- old_obj->type = IS_OBJECT;
- old_obj->value.obj.handle = handle;
- old_obj->value.obj.handlers = &std_object_handlers; /* If we reached here than the handlers are standrd */
- zval_copy_ctor(old_obj);
-
- /* FIXME: Optimize this so that we use the old_object->ce->clone function pointer instead of the name */
- MAKE_STD_ZVAL(clone_func_name);
- clone_func_name->type = IS_STRING;
- clone_func_name->value.str.val = estrndup("__clone", sizeof("__clone")-1);
- clone_func_name->value.str.len = sizeof("__clone")-1;
-
- ALLOC_HASHTABLE(new_object->properties);
- zend_hash_init(new_object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- ZEND_INIT_SYMTABLE(&symbol_table);
- ZEND_SET_SYMBOL(&symbol_table, "that", old_obj);
-
- call_user_function_ex(NULL, &new_obj, clone_func_name, &retval_ptr, 0, NULL, 0, &symbol_table TSRMLS_CC);
-
- zend_hash_destroy(&symbol_table);
- zval_ptr_dtor(&new_obj);
- zval_ptr_dtor(&clone_func_name);
- zval_ptr_dtor(&retval_ptr);
- } else {
- ALLOC_HASHTABLE(new_object->properties);
- zend_hash_init(new_object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref, (void *) NULL /* Not used anymore */, sizeof(zval *));
- }
-
- return retval;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_objects.h b/Zend/zend_objects.h
deleted file mode 100644
index 5c4d080913..0000000000
--- a/Zend/zend_objects.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_OBJECTS_H
-#define ZEND_OBJECTS_H
-
-#include "zend.h"
-
-ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_entry *class_type TSRMLS_DC);
-ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC);
-ZEND_API zend_object *zend_objects_get_address(zval *object TSRMLS_DC);
-ZEND_API zend_object_value zend_objects_clone_obj(zval *object TSRMLS_DC);
-
-#endif /* ZEND_OBJECTS_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c
deleted file mode 100644
index 7bc297b391..0000000000
--- a/Zend/zend_objects_API.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_globals.h"
-#include "zend_variables.h"
-#include "zend_API.h"
-#include "zend_objects_API.h"
-
-#define ZEND_DEBUG_OBJECTS 0
-
-ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint init_size)
-{
- objects->object_buckets = (zend_object_store_bucket *) emalloc(init_size * sizeof(zend_object_store_bucket));
- objects->top = 1; /* Skip 0 so that handles are true */
- objects->size = init_size;
- objects->free_list_head = -1;
-}
-
-ZEND_API void zend_objects_store_destroy(zend_objects_store *objects)
-{
- efree(objects->object_buckets);
-}
-
-ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC)
-{
- zend_uint i = 1;
-
- for (i = 1; i < objects->top ; i++) {
- if (objects->object_buckets[i].valid) {
- struct _store_object *obj = &objects->object_buckets[i].bucket.obj;
- if (obj->dtor && !objects->object_buckets[i].destructor_called) {
- objects->object_buckets[i].destructor_called = 1;
- obj->dtor(obj->object, i TSRMLS_CC);
- }
- objects->object_buckets[i].valid = 0;
- }
- }
-}
-
-/* Store objects API */
-
-ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_store_dtor_t dtor, zend_objects_store_clone_t clone TSRMLS_DC)
-{
- zend_object_handle handle;
- struct _store_object *obj;
-
- if (EG(objects_store).free_list_head != -1) {
- handle = EG(objects_store).free_list_head;
- EG(objects_store).free_list_head = EG(objects_store).object_buckets[handle].bucket.free_list.next;
- } else {
- if (EG(objects_store).top == EG(objects_store).size) {
- EG(objects_store).size <<= 1;
- EG(objects_store).object_buckets = (zend_object_store_bucket *) erealloc(EG(objects_store).object_buckets, EG(objects_store).size * sizeof(zend_object_store_bucket));
- }
- handle = EG(objects_store).top++;
- }
- obj = &EG(objects_store).object_buckets[handle].bucket.obj;
- EG(objects_store).object_buckets[handle].valid = 1;
- EG(objects_store).object_buckets[handle].destructor_called = 0;
-
- obj->refcount = 1;
- obj->object = object;
- obj->dtor = dtor;
- obj->clone = clone;
-
-#if ZEND_DEBUG_OBJECTS
- fprintf(stderr, "Allocated object id #%d\n", handle);
-#endif
- return handle;
-}
-
-ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC)
-{
- zend_object_handle handle = Z_OBJ_HANDLE_P(object);
-
- if (!EG(objects_store).object_buckets[handle].valid) {
- zend_error(E_ERROR, "Trying to add reference to invalid object");
- }
-
- EG(objects_store).object_buckets[handle].bucket.obj.refcount++;
-#if ZEND_DEBUG_OBJECTS
- fprintf(stderr, "Increased refcount of object id #%d\n", handle);
-#endif
-}
-
-ZEND_API void zend_objects_store_delete_obj(zval *zobject TSRMLS_DC)
-{
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
- struct _store_object *obj = &EG(objects_store).object_buckets[handle].bucket.obj;
-
- if (!EG(objects_store).object_buckets[handle].valid) {
- zend_error(E_ERROR, "Trying to delete invalid object");
- }
-
-
- if (obj->dtor && !EG(objects_store).object_buckets[handle].destructor_called) {
- EG(objects_store).object_buckets[handle].destructor_called = 1;
- obj->dtor(obj->object, handle TSRMLS_CC);
- }
- EG(objects_store).object_buckets[handle].valid = 0;
-
-#if ZEND_DEBUG_OBJECTS
- fprintf(stderr, "Deleted object id #%d\n", handle);
-#endif
-
-}
-
-#define ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST() \
- EG(objects_store).object_buckets[handle].bucket.free_list.next = EG(objects_store).free_list_head; \
- EG(objects_store).free_list_head = handle; \
- EG(objects_store).object_buckets[handle].valid = 0;
-
-ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC)
-{
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
- struct _store_object *obj = &EG(objects_store).object_buckets[handle].bucket.obj;
-
- if (--obj->refcount == 0) {
- if (EG(objects_store).object_buckets[handle].valid) {
- if (!EG(objects_store).object_buckets[handle].destructor_called) {
- EG(objects_store).object_buckets[handle].destructor_called = 1;
- if (obj->dtor) {
- obj->dtor(obj->object, handle TSRMLS_CC);
- }
- EG(objects_store).object_buckets[handle].valid = 0;
- if (obj->refcount == 0) {
- ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST();
- }
- }
- }
-#if ZEND_DEBUG_OBJECTS
- fprintf(stderr, "Deallocated object id #%d\n", handle);
-#endif
- }
-#if ZEND_DEBUG_OBJECTS
- else {
- fprintf(stderr, "Decreased refcount of object id #%d\n", handle);
- }
-#endif
-}
-
-ZEND_API zend_object_value zend_objects_store_clone_obj(zval *zobject TSRMLS_DC)
-{
- zend_object_value retval;
- void *new_object;
- struct _store_object *obj;
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
-
- if (!EG(objects_store).object_buckets[handle].valid) {
- zend_error(E_ERROR, "Trying to clone invalid object");
- }
- obj = &EG(objects_store).object_buckets[handle].bucket.obj;
-
- if (obj->clone == NULL) {
- zend_error(E_ERROR, "Trying to clone uncloneable object");
- }
-
- obj->clone(obj->object, &new_object TSRMLS_CC);
-
- retval.handle = zend_objects_store_put(new_object, obj->dtor, obj->clone TSRMLS_CC);
- retval.handlers = Z_OBJ_HT_P(zobject);
-
- return retval;
-}
-
-ZEND_API void *zend_object_store_get_object(zval *zobject TSRMLS_DC)
-{
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
-
- if (!EG(objects_store).object_buckets[handle].valid) {
- zend_error(E_ERROR, "Trying to access invalid object");
- return NULL;
- }
-
- return EG(objects_store).object_buckets[handle].bucket.obj.object;
-}
-
-
-/* Proxy objects workings */
-typedef struct _zend_proxy_object {
- zval *object;
- zval *property;
-} zend_proxy_object;
-
-static zend_object_handlers zend_object_proxy_handlers;
-
-ZEND_API void zend_objects_proxy_dtor(zend_proxy_object *object, zend_object_handle handle TSRMLS_DC)
-{
- zval_ptr_dtor(&object->object);
- zval_ptr_dtor(&object->property);
- efree(object);
-}
-
-ZEND_API void zend_objects_proxy_clone(zend_proxy_object *object, zend_proxy_object **object_clone TSRMLS_DC)
-{
- *object_clone = emalloc(sizeof(zend_proxy_object));
- (*object_clone)->object = object->object;
- (*object_clone)->property = object->property;
- zval_add_ref(&(*object_clone)->property);
- zval_add_ref(&(*object_clone)->object);
-}
-
-ZEND_API zval **zend_object_create_proxy(zval *object, zval *member TSRMLS_DC)
-{
- zend_proxy_object *pobj = emalloc(sizeof(zend_proxy_object));
- zval *retval, **pretval;
-
- pobj->object = object;
- pobj->property = member;
- zval_add_ref(&pobj->property);
- zval_add_ref(&pobj->object);
-
- MAKE_STD_ZVAL(retval);
- retval->type = IS_OBJECT;
- Z_OBJ_HANDLE_P(retval) = zend_objects_store_put(pobj, (zend_objects_store_dtor_t)zend_objects_proxy_dtor, (zend_objects_store_clone_t)zend_objects_proxy_clone TSRMLS_CC);
- Z_OBJ_HT_P(retval) = &zend_object_proxy_handlers;
- pretval = emalloc(sizeof(zval *));
- *pretval = retval;
-
- return pretval;
-}
-
-ZEND_API void zend_object_proxy_set(zval **property, zval *value TSRMLS_DC)
-{
- zend_proxy_object *probj = zend_object_store_get_object(*property TSRMLS_CC);
-
- if (Z_OBJ_HT_P(probj->object) && Z_OBJ_HT_P(probj->object)->write_property) {
- Z_OBJ_HT_P(probj->object)->write_property(probj->object, probj->property, value TSRMLS_CC);
- } else {
- zend_error(E_WARNING, "Cannot write property of object - no write handler defined");
- }
-}
-
-ZEND_API zval* zend_object_proxy_get(zval *property TSRMLS_DC)
-{
- zend_proxy_object *probj = zend_object_store_get_object(property TSRMLS_CC);
-
- if (Z_OBJ_HT_P(probj->object) && Z_OBJ_HT_P(probj->object)->read_property) {
- return Z_OBJ_HT_P(probj->object)->read_property(probj->object, probj->property TSRMLS_CC);
- } else {
- zend_error(E_WARNING, "Cannot read property of object - no read handler defined");
- }
-
- return NULL;
-}
-
-ZEND_API zend_object_handlers *zend_get_std_object_handlers()
-{
- return &std_object_handlers;
-}
-
-static zend_object_handlers zend_object_proxy_handlers = {
- ZEND_OBJECTS_STORE_HANDLERS,
-
- NULL, /* read_property */
- NULL, /* write_property */
- NULL, /* get_property_ptr */
- NULL, /* get_property_zval_ptr */
- zend_object_proxy_get, /* get */
- zend_object_proxy_set, /* set */
- NULL, /* has_property */
- NULL, /* unset_property */
- NULL, /* get_properties */
- NULL, /* get_method */
- NULL, /* call_method */
- NULL, /* get_constructor */
- NULL, /* get_class_entry */
- NULL, /* get_class_name */
- NULL /* compare_objects */
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h
deleted file mode 100644
index 362dddd83e..0000000000
--- a/Zend/zend_objects_API.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_OBJECTS_API_H
-#define ZEND_OBJECTS_API_H
-
-#include "zend.h"
-
-typedef void (*zend_objects_store_dtor_t)(void *object, zend_object_handle handle TSRMLS_DC);
-typedef void (*zend_objects_store_clone_t)(void *object, void **object_clone TSRMLS_DC);
-
-typedef struct _zend_object_store_bucket {
- zend_bool destructor_called;
- zend_bool valid;
- union _store_bucket {
- struct _store_object {
- void *object;
- zend_objects_store_dtor_t dtor;
- zend_objects_store_clone_t clone;
- zend_uint refcount;
- } obj;
- struct {
- int next;
- } free_list;
- } bucket;
-} zend_object_store_bucket;
-
-typedef struct _zend_objects_store {
- zend_object_store_bucket *object_buckets;
- zend_uint top;
- zend_uint size;
- int free_list_head;
-} zend_objects_store;
-
-/* Global store handling functions */
-ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint init_size);
-ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC);
-ZEND_API void zend_objects_store_destroy(zend_objects_store *objects);
-
-/* Store API functions */
-ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_store_dtor_t dtor, zend_objects_store_clone_t clone TSRMLS_DC);
-
-ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC);
-ZEND_API void zend_objects_store_del_ref(zval *object TSRMLS_DC);
-ZEND_API void zend_objects_store_delete_obj(zval *object TSRMLS_DC);
-ZEND_API zend_object_value zend_objects_store_clone_obj(zval *object TSRMLS_DC);
-ZEND_API void *zend_object_store_get_object(zval *object TSRMLS_DC);
-
-#define ZEND_OBJECTS_STORE_HANDLERS zend_objects_store_add_ref, zend_objects_store_del_ref, zend_objects_store_delete_obj, zend_objects_store_clone_obj
-
-ZEND_API zval **zend_object_create_proxy(zval *object, zval *member TSRMLS_DC);
-
-ZEND_API zend_object_handlers *zend_get_std_object_handlers();
-#endif /* ZEND_OBJECTS_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
deleted file mode 100644
index af9ff1450e..0000000000
--- a/Zend/zend_opcode.c
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <stdio.h>
-
-#include "zend.h"
-#include "zend_alloc.h"
-#include "zend_compile.h"
-#include "zend_extensions.h"
-#include "zend_API.h"
-
-
-static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
-{
- if (extension->op_array_ctor) {
- extension->op_array_ctor(op_array);
- }
-}
-
-
-static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
-{
- if (extension->op_array_dtor) {
- extension->op_array_dtor(op_array);
- }
-}
-
-
-static void op_array_alloc_ops(zend_op_array *op_array)
-{
- op_array->opcodes = erealloc(op_array->opcodes, (op_array->size)*sizeof(zend_op));
-}
-
-
-
-void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC)
-{
- op_array->type = type;
-
- op_array->backpatch_count = 0;
- if (CG(interactive)) {
- /* We must avoid a realloc() on the op_array in interactive mode, since pointers to constants
- * will become invalid
- */
- initial_ops_size = 8192;
- }
-
- op_array->refcount = (zend_uint *) emalloc(sizeof(zend_uint));
- *op_array->refcount = 1;
- op_array->size = initial_ops_size;
- op_array->last = 0;
- op_array->opcodes = NULL;
- op_array_alloc_ops(op_array);
-
- op_array->T = 0;
-
- op_array->function_name = NULL;
- op_array->filename = zend_get_compiled_filename(TSRMLS_C);
- op_array->doc_comment = NULL;
- op_array->doc_comment_len = 0;
-
- op_array->arg_types = NULL;
-
- op_array->scope = NULL;
- op_array->ns = NULL;
-
- op_array->brk_cont_array = NULL;
- op_array->last_brk_cont = 0;
- op_array->current_brk_cont = -1;
-
- op_array->static_variables = NULL;
-
- op_array->return_reference = 0;
- op_array->done_pass_two = 0;
-
- op_array->uses_this = 0;
-
- op_array->start_op = NULL;
-
- zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_ctor_handler, op_array TSRMLS_CC);
-}
-
-
-ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC)
-{
- switch (function->type) {
- case ZEND_USER_FUNCTION:
- destroy_op_array((zend_op_array *) function TSRMLS_CC);
- break;
- case ZEND_INTERNAL_FUNCTION:
- /* do nothing */
- break;
- }
-}
-
-static void zend_cleanup_op_array_data(zend_op_array *op_array)
-{
- if (op_array->static_variables) {
- zend_hash_clean(op_array->static_variables);
- }
-}
-
-ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC)
-{
- if(function->type == ZEND_USER_FUNCTION) {
- zend_cleanup_op_array_data((zend_op_array *) function);
- }
- return 0;
-}
-
-ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC)
-{
- if((*pce)->type == ZEND_USER_CLASS) {
- /* Clean all parts that can contain run-time data */
- /* Note that only run-time accessed data need to be cleaned up, pre-defined data can
- not contain objects and thus are not probelmatic */
- zend_hash_clean((*pce)->static_members);
- zend_hash_apply(&(*pce)->class_table, (apply_func_t) zend_cleanup_class_data TSRMLS_CC);
- zend_hash_apply(&(*pce)->function_table, (apply_func_t) zend_cleanup_function_data TSRMLS_CC);
- }
- return 0;
-}
-
-ZEND_API void destroy_zend_class(zend_class_entry **pce)
-{
- zend_class_entry *ce = *pce;
-
- if (--ce->refcount > 0) {
- return;
- }
- switch (ce->type) {
- case ZEND_USER_CLASS:
- zend_hash_destroy(&ce->default_properties);
- zend_hash_destroy(&ce->properties_info);
- zend_hash_destroy(ce->static_members);
- efree(ce->name);
- zend_hash_destroy(&ce->function_table);
- FREE_HASHTABLE(ce->static_members);
- zend_hash_destroy(&ce->constants_table);
- zend_hash_destroy(&ce->class_table);
- if (ce->num_interfaces > 0) {
- efree(ce->interfaces);
- }
- if (ce->doc_comment) {
- efree(ce->doc_comment);
- }
- efree(ce);
- break;
- case ZEND_INTERNAL_CLASS:
- zend_hash_destroy(&ce->default_properties);
- zend_hash_destroy(&ce->properties_info);
- zend_hash_destroy(ce->static_members);
- free(ce->name);
- zend_hash_destroy(&ce->function_table);
- free(ce->static_members);
- zend_hash_destroy(&ce->constants_table);
- zend_hash_destroy(&ce->class_table);
- if (ce->num_interfaces > 0) {
- free(ce->interfaces);
- }
- if (ce->doc_comment) {
- free(ce->doc_comment);
- }
- free(ce);
- break;
- case ZEND_USER_NAMESPACE:
- case ZEND_INTERNAL_NAMESPACE:
- destroy_zend_namespace(pce);
- break;
- }
-}
-
-ZEND_API void destroy_zend_namespace(zend_namespace **pns)
-{
- zend_namespace *ns = *pns;
- switch (ns->type) {
- case ZEND_USER_NAMESPACE:
- zend_hash_destroy(&ns->function_table);
- zend_hash_destroy(&ns->class_table);
- zend_hash_destroy(&ns->constants_table);
- zend_hash_destroy(ns->static_members);
- FREE_HASHTABLE(ns->static_members);
- if (ns->doc_comment) {
- efree(ns->doc_comment);
- }
- efree(ns->name);
- efree(ns);
- break;
-
- case ZEND_INTERNAL_NAMESPACE:
- zend_hash_destroy(&ns->function_table);
- zend_hash_destroy(&ns->class_table);
- zend_hash_destroy(&ns->constants_table);
- zend_hash_destroy(ns->static_members);
- free(ns->static_members);
- free(ns->name);
- free(ns);
- break;
- }
-}
-
-void zend_class_add_ref(zend_class_entry **ce)
-{
- (*ce)->refcount++;
-}
-
-
-ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
-{
- zend_op *opline = op_array->opcodes;
- zend_op *end = op_array->opcodes+op_array->last;
-
- if (op_array->static_variables) {
- zend_hash_destroy(op_array->static_variables);
- FREE_HASHTABLE(op_array->static_variables);
- }
-
- if (--(*op_array->refcount)>0) {
- return;
- }
-
- efree(op_array->refcount);
-
- while (opline<end) {
- if (opline->op1.op_type==IS_CONST) {
-#if DEBUG_ZEND>2
- printf("Reducing refcount for %x 1=>0 (destroying)\n", &opline->op1.u.constant);
-#endif
- zval_dtor(&opline->op1.u.constant);
- }
- if (opline->op2.op_type==IS_CONST) {
-#if DEBUG_ZEND>2
- printf("Reducing refcount for %x 1=>0 (destroying)\n", &opline->op2.u.constant);
-#endif
- zval_dtor(&opline->op2.u.constant);
- }
- opline++;
- }
- efree(op_array->opcodes);
- if (op_array->function_name) {
- efree(op_array->function_name);
- }
- if (op_array->doc_comment) {
- efree(op_array->doc_comment);
- }
- if (op_array->arg_types) {
- efree(op_array->arg_types);
- }
- if (op_array->brk_cont_array) {
- efree(op_array->brk_cont_array);
- }
- if (op_array->done_pass_two) {
- zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_dtor_handler, op_array TSRMLS_CC);
- }
-}
-
-
-void init_op(zend_op *op TSRMLS_DC)
-{
- memset(&op->result, 0, sizeof(znode));
- op->lineno = CG(zend_lineno);
- SET_UNUSED(op->result);
- op->extended_value = 0;
- memset(&op->op1, 0, sizeof(znode));
- memset(&op->op2, 0, sizeof(znode));
-}
-
-zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC)
-{
- zend_uint next_op_num = op_array->last++;
- zend_op *next_op;
-
- if (next_op_num >= op_array->size) {
- if (CG(interactive)) {
- /* we messed up */
- zend_printf("Ran out of opcode space!\n"
- "You should probably consider writing this huge script into a file!\n");
- zend_bailout();
- }
- op_array->size *= 4;
- op_array_alloc_ops(op_array);
- }
-
- next_op = &(op_array->opcodes[next_op_num]);
-
- init_op(next_op TSRMLS_CC);
-
- return next_op;
-}
-
-
-int get_next_op_number(zend_op_array *op_array)
-{
- return op_array->last;
-}
-
-
-
-
-zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array)
-{
- op_array->last_brk_cont++;
- op_array->brk_cont_array = erealloc(op_array->brk_cont_array, sizeof(zend_brk_cont_element)*op_array->last_brk_cont);
- return &op_array->brk_cont_array[op_array->last_brk_cont-1];
-}
-
-
-static void zend_update_extended_info(zend_op_array *op_array TSRMLS_DC)
-{
- zend_op *opline = op_array->opcodes, *end=opline+op_array->last;
-
- while (opline<end) {
- if (opline->opcode == ZEND_EXT_STMT) {
- if (opline+1<end) {
- if ((opline+1)->opcode == ZEND_EXT_STMT) {
- opline->opcode = ZEND_NOP;
- opline++;
- continue;
- }
- if (opline+1<end) {
- opline->lineno = (opline+1)->lineno;
- }
- } else {
- opline->opcode = ZEND_NOP;
- }
- }
- opline++;
- }
-}
-
-
-
-static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
-{
- if (extension->op_array_handler) {
- extension->op_array_handler(op_array);
- }
-}
-
-
-int pass_two(zend_op_array *op_array TSRMLS_DC)
-{
- zend_op *opline, *end;
-
- if (op_array->type!=ZEND_USER_FUNCTION && op_array->type!=ZEND_EVAL_CODE) {
- return 0;
- }
- if (CG(extended_info)) {
- zend_update_extended_info(op_array TSRMLS_CC);
- }
- if (CG(handle_op_arrays)) {
- zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array TSRMLS_CC);
- }
-
- op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last);
- op_array->size = op_array->last;
-
- opline = op_array->opcodes;
- end = opline + op_array->last;
- while (opline < end) {
- if (opline->op1.op_type == IS_CONST) {
- opline->op1.u.constant.is_ref = 1;
- opline->op1.u.constant.refcount = 2; /* Make sure is_ref won't be reset */
- }
- if (opline->op2.op_type == IS_CONST) {
- opline->op2.u.constant.is_ref = 1;
- opline->op2.u.constant.refcount = 2;
- }
- switch (opline->opcode) {
- case ZEND_JMP:
- opline->op1.u.jmp_addr = &op_array->opcodes[opline->op1.u.opline_num];
- break;
- case ZEND_JMPZ:
- case ZEND_JMPNZ:
- case ZEND_JMPZ_EX:
- case ZEND_JMPNZ_EX:
- opline->op2.u.jmp_addr = &op_array->opcodes[opline->op2.u.opline_num];
- break;
- }
- opline->handler = zend_opcode_handlers[opline->opcode];
- opline++;
- }
-
- op_array->done_pass_two = 1;
- return 0;
-}
-
-
-int print_class(zend_class_entry *class_entry TSRMLS_DC)
-{
- printf("Class %s:\n", class_entry->name);
- zend_hash_apply(&class_entry->function_table, (apply_func_t) pass_two TSRMLS_CC);
- printf("End of class %s.\n\n", class_entry->name);
- return 0;
-}
-
-ZEND_API unary_op_type get_unary_op(int opcode)
-{
- switch (opcode) {
- case ZEND_BW_NOT:
- return (unary_op_type) bitwise_not_function;
- break;
- case ZEND_BOOL_NOT:
- return (unary_op_type) boolean_not_function;
- break;
- default:
- return (unary_op_type) NULL;
- break;
- }
-}
-
-
-ZEND_API void *get_binary_op(int opcode)
-{
- switch (opcode) {
- case ZEND_ADD:
- case ZEND_ASSIGN_ADD:
- return (void *) add_function;
- break;
- case ZEND_SUB:
- case ZEND_ASSIGN_SUB:
- return (void *) sub_function;
- break;
- case ZEND_MUL:
- case ZEND_ASSIGN_MUL:
- return (void *) mul_function;
- break;
- case ZEND_DIV:
- case ZEND_ASSIGN_DIV:
- return (void *) div_function;
- break;
- case ZEND_MOD:
- case ZEND_ASSIGN_MOD:
- return (void *) mod_function;
- break;
- case ZEND_SL:
- case ZEND_ASSIGN_SL:
- return (void *) shift_left_function;
- break;
- case ZEND_SR:
- case ZEND_ASSIGN_SR:
- return (void *) shift_right_function;
- break;
- case ZEND_CONCAT:
- case ZEND_ASSIGN_CONCAT:
- return (void *) concat_function;
- break;
- case ZEND_IS_IDENTICAL:
- return (void *) is_identical_function;
- break;
- case ZEND_IS_NOT_IDENTICAL:
- return (void *) is_not_identical_function;
- break;
- case ZEND_IS_EQUAL:
- return (void *) is_equal_function;
- break;
- case ZEND_IS_NOT_EQUAL:
- return (void *) is_not_equal_function;
- break;
- case ZEND_IS_SMALLER:
- return (void *) is_smaller_function;
- break;
- case ZEND_IS_SMALLER_OR_EQUAL:
- return (void *) is_smaller_or_equal_function;
- break;
- case ZEND_BW_OR:
- case ZEND_ASSIGN_BW_OR:
- return (void *) bitwise_or_function;
- break;
- case ZEND_BW_AND:
- case ZEND_ASSIGN_BW_AND:
- return (void *) bitwise_and_function;
- break;
- case ZEND_BW_XOR:
- case ZEND_ASSIGN_BW_XOR:
- return (void *) bitwise_xor_function;
- break;
- default:
- return (void *) NULL;
- break;
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
deleted file mode 100644
index 5a216afc93..0000000000
--- a/Zend/zend_operators.c
+++ /dev/null
@@ -1,1801 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <ctype.h>
-
-#include "zend.h"
-#include "zend_operators.h"
-#include "zend_variables.h"
-#include "zend_globals.h"
-#include "zend_list.h"
-#include "zend_fast_cache.h"
-#include "zend_API.h"
-
-#if 0&&WITH_BCMATH
-#include "ext/bcmath/number.h"
-#endif
-
-ZEND_API int zend_atoi(const char *str, int str_len)
-{
- int retval;
-
- if (!str_len) {
- str_len = strlen(str);
- }
- retval = strtol(str, NULL, 0);
- if (str_len>0) {
- switch (str[str_len-1]) {
- case 'k':
- case 'K':
- retval *= 1024;
- break;
- case 'm':
- case 'M':
- retval *= 1048576;
- break;
- }
- }
- return retval;
-}
-
-
-ZEND_API double zend_string_to_double(const char *number, zend_uint length)
-{
- double divisor = 10.0;
- double result = 0.0;
- double exponent;
- const char *end = number+length;
- const char *digit = number;
-
- if (!length) {
- return result;
- }
-
- while (digit < end) {
- if ((*digit <= '9' && *digit >= '0')) {
- result *= 10;
- result += *digit - '0';
- } else if (*digit == '.') {
- digit++;
- break;
- } else if (toupper(*digit) == 'E') {
- exponent = (double) atoi(digit+1);
- result *= pow(10.0, exponent);
- return result;
- } else {
- return result;
- }
- digit++;
- }
-
- while (digit < end) {
- if ((*digit <= '9' && *digit >= '0')) {
- result += (*digit - '0') / divisor;
- divisor *= 10;
- } else if (toupper(*digit) == 'E') {
- exponent = (double) atoi(digit+1);
- result *= pow(10.0, exponent);
- return result;
- } else {
- return result;
- }
- digit++;
- }
- return result;
-}
-
-
-ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC)
-{
- switch (op->type) {
- case IS_STRING:
- {
- char *strval;
-
- strval = op->value.str.val;
- switch ((op->type=is_numeric_string(strval, op->value.str.len, &op->value.lval, &op->value.dval, 1))) {
- case IS_DOUBLE:
- case IS_LONG:
- break;
-#if 0 && WITH_BCMATH
- case FLAG_IS_BC:
- op->type = IS_DOUBLE; /* may have lost significant digits */
- break;
-#endif
- default:
- op->value.lval = strtol(op->value.str.val, NULL, 10);
- op->type = IS_LONG;
- break;
- }
- STR_FREE(strval);
- break;
- }
- case IS_BOOL:
- op->type = IS_LONG;
- break;
- case IS_RESOURCE:
- zend_list_delete(op->value.lval);
- op->type = IS_LONG;
- break;
- case IS_NULL:
- op->type = IS_LONG;
- op->value.lval = 0;
- break;
- }
-}
-
-#define zendi_convert_scalar_to_number(op, holder, result) \
- if (op==result) { \
- convert_scalar_to_number(op TSRMLS_CC); \
- } else { \
- switch ((op)->type) { \
- case IS_STRING: \
- { \
- switch (((holder).type=is_numeric_string((op)->value.str.val, (op)->value.str.len, &(holder).value.lval, &(holder).value.dval, 1))) { \
- case IS_DOUBLE: \
- case IS_LONG: \
- break; \
- case FLAG_IS_BC: \
- (holder).type = IS_DOUBLE; /* may have lost significant digits */ \
- break; \
- default: \
- (holder).value.lval = strtol((op)->value.str.val, NULL, 10); \
- (holder).type = IS_LONG; \
- break; \
- } \
- (op) = &(holder); \
- break; \
- } \
- case IS_BOOL: \
- case IS_RESOURCE: \
- (holder).value.lval = (op)->value.lval; \
- (holder).type = IS_LONG; \
- (op) = &(holder); \
- break; \
- case IS_NULL: \
- (holder).value.lval = 0; \
- (holder).type = IS_LONG; \
- (op) = &(holder); \
- break; \
- } \
- }
-
-
-#define DVAL_TO_LVAL(d, l) (l) = (d) > LONG_MAX ? (unsigned long) (d) : (long) (d)
-
-#define zendi_convert_to_long(op, holder, result) \
- if (op==result) { \
- convert_to_long(op); \
- } else if ((op)->type != IS_LONG) { \
- switch ((op)->type) { \
- case IS_NULL: \
- (holder).value.lval = 0; \
- break; \
- case IS_DOUBLE: \
- DVAL_TO_LVAL((op)->value.dval, (holder).value.lval); \
- break; \
- case IS_STRING: \
- (holder).value.lval = strtol((op)->value.str.val, NULL, 10); \
- break; \
- case IS_ARRAY: \
- (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \
- break; \
- case IS_OBJECT: \
- (holder).value.lval = 1; /* TBI!! */ \
- break; \
- case IS_BOOL: \
- case IS_RESOURCE: \
- (holder).value.lval = (op)->value.lval; \
- break; \
- default: \
- zend_error(E_WARNING, "Cannot convert to ordinal value"); \
- (holder).value.lval = 0; \
- break; \
- } \
- (holder).type = IS_LONG; \
- (op) = &(holder); \
- }
-
-
-#define zendi_convert_to_boolean(op, holder, result) \
- if (op==result) { \
- convert_to_boolean(op); \
- } else if ((op)->type != IS_BOOL) { \
- switch ((op)->type) { \
- case IS_NULL: \
- (holder).value.lval = 0; \
- break; \
- case IS_RESOURCE: \
- case IS_LONG: \
- (holder).value.lval = ((op)->value.lval ? 1 : 0); \
- break; \
- case IS_DOUBLE: \
- (holder).value.lval = ((op)->value.dval ? 1 : 0); \
- break; \
- case IS_STRING: \
- if ((op)->value.str.len == 0 \
- || ((op)->value.str.len==1 && (op)->value.str.val[0]=='0')) { \
- (holder).value.lval = 0; \
- } else { \
- (holder).value.lval = 1; \
- } \
- break; \
- case IS_ARRAY: \
- (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \
- break; \
- case IS_OBJECT: \
- (holder).value.lval = 1; /* TBI!! */ \
- break; \
- default: \
- (holder).value.lval = 0; \
- break; \
- } \
- (holder).type = IS_BOOL; \
- (op) = &(holder); \
- }
-
-
-ZEND_API void convert_to_long(zval *op)
-{
- convert_to_long_base(op, 10);
-}
-
-
-ZEND_API void convert_to_long_base(zval *op, int base)
-{
- char *strval;
- long tmp;
-
- switch (op->type) {
- case IS_NULL:
- op->value.lval = 0;
- break;
- case IS_RESOURCE: {
- TSRMLS_FETCH();
-
- zend_list_delete(op->value.lval);
- }
- /* break missing intentionally */
- case IS_BOOL:
- case IS_LONG:
- break;
- case IS_DOUBLE:
- DVAL_TO_LVAL(op->value.dval, op->value.lval);
- break;
- case IS_STRING:
- strval = op->value.str.val;
- op->value.lval = strtol(strval, NULL, base);
- STR_FREE(strval);
- break;
- case IS_ARRAY:
- tmp = (zend_hash_num_elements(op->value.ht)?1:0);
- zval_dtor(op);
- op->value.lval = tmp;
- break;
- case IS_OBJECT:
- zval_dtor(op);
- op->value.lval = 1; /* TBI!! */
- break;
- default:
- zend_error(E_WARNING, "Cannot convert to ordinal value");
- zval_dtor(op);
- op->value.lval = 0;
- break;
- }
-
- op->type = IS_LONG;
-}
-
-
-ZEND_API void convert_to_double(zval *op)
-{
- char *strval;
- double tmp;
-
- switch (op->type) {
- case IS_NULL:
- op->value.dval = 0.0;
- break;
- case IS_RESOURCE: {
- TSRMLS_FETCH();
-
- zend_list_delete(op->value.lval);
- }
- /* break missing intentionally */
- case IS_BOOL:
- case IS_LONG:
- op->value.dval = (double) op->value.lval;
- break;
- case IS_DOUBLE:
- break;
- case IS_STRING:
- strval = op->value.str.val;
-
- op->value.dval = strtod(strval, NULL);
- STR_FREE(strval);
- break;
- case IS_ARRAY:
- tmp = (zend_hash_num_elements(op->value.ht)?1:0);
- zval_dtor(op);
- op->value.dval = tmp;
- break;
- case IS_OBJECT:
- zval_dtor(op);
- op->value.dval = 1; /* TBI!! */
- break;
- default:
- zend_error(E_WARNING, "Cannot convert to real value (type=%d)", op->type);
- zval_dtor(op);
- op->value.dval = 0;
- break;
- }
- op->type = IS_DOUBLE;
-}
-
-
-ZEND_API void convert_to_null(zval *op)
-{
- zval_dtor(op);
- op->type = IS_NULL;
-}
-
-
-ZEND_API void convert_to_boolean(zval *op)
-{
- char *strval;
- int tmp;
-
- switch (op->type) {
- case IS_BOOL:
- break;
- case IS_NULL:
- op->value.lval = 0;
- break;
- case IS_RESOURCE: {
- TSRMLS_FETCH();
-
- zend_list_delete(op->value.lval);
- }
- /* break missing intentionally */
- case IS_LONG:
- op->value.lval = (op->value.lval ? 1 : 0);
- break;
- case IS_DOUBLE:
- op->value.lval = (op->value.dval ? 1 : 0);
- break;
- case IS_STRING:
- strval = op->value.str.val;
-
- if (op->value.str.len == 0
- || (op->value.str.len==1 && op->value.str.val[0]=='0')) {
- op->value.lval = 0;
- } else {
- op->value.lval = 1;
- }
- STR_FREE(strval);
- break;
- case IS_ARRAY:
- tmp = (zend_hash_num_elements(op->value.ht)?1:0);
- zval_dtor(op);
- op->value.lval = tmp;
- break;
- case IS_OBJECT:
- zval_dtor(op);
- op->value.lval = 1; /* TBI!! */
- break;
- default:
- zval_dtor(op);
- op->value.lval = 0;
- break;
- }
- op->type = IS_BOOL;
-}
-
-
-ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC)
-{
- long lval;
- double dval;
- TSRMLS_FETCH();
-
- switch (op->type) {
- case IS_NULL:
- op->value.str.val = empty_string;
- op->value.str.len = 0;
- break;
- case IS_STRING:
- break;
- case IS_BOOL:
- if (op->value.lval) {
- op->value.str.val = estrndup_rel("1", 1);
- op->value.str.len = 1;
- } else {
- op->value.str.val = empty_string;
- op->value.str.len = 0;
- }
- break;
- case IS_RESOURCE: {
- long tmp = op->value.lval;
-
- zend_list_delete(op->value.lval);
- op->value.str.val = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG);
- op->value.str.len = sprintf(op->value.str.val, "Resource id #%ld", tmp);
- break;
- }
- case IS_LONG:
- lval = op->value.lval;
-
- op->value.str.val = (char *) emalloc_rel(MAX_LENGTH_OF_LONG + 1);
- op->value.str.len = zend_sprintf(op->value.str.val, "%ld", lval); /* SAFE */
- break;
- case IS_DOUBLE: {
- dval = op->value.dval;
- op->value.str.val = (char *) emalloc_rel(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
- op->value.str.len = zend_sprintf(op->value.str.val, "%.*G", (int) EG(precision), dval); /* SAFE */
- /* %G already handles removing trailing zeros from the fractional part, yay */
- break;
- }
- case IS_ARRAY:
- zval_dtor(op);
- op->value.str.val = estrndup_rel("Array", sizeof("Array")-1);
- op->value.str.len = sizeof("Array")-1;
- zend_error(E_NOTICE, "Array to string conversion");
- break;
- case IS_OBJECT:
- zval_dtor(op);
- op->value.str.val = estrndup_rel("Object", sizeof("Object")-1);
- op->value.str.len = sizeof("Object")-1;
- zend_error(E_NOTICE, "Object to string conversion");
- break;
- default:
- zval_dtor(op);
- ZVAL_BOOL(op, 0);
- break;
- }
- op->type = IS_STRING;
-}
-
-
-static void convert_scalar_to_array(zval *op, int type)
-{
- zval *entry;
-
- ALLOC_ZVAL(entry);
- *entry = *op;
- INIT_PZVAL(entry);
-
- switch (type) {
- case IS_ARRAY:
- ALLOC_HASHTABLE(op->value.ht);
- zend_hash_init(op->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_index_update(op->value.ht, 0, (void *) &entry, sizeof(zval *), NULL);
- op->type = IS_ARRAY;
- break;
- case IS_OBJECT:
- {
- /* OBJECTS_OPTIMIZE */
- TSRMLS_FETCH();
-
- object_init(op);
- zend_hash_update(Z_OBJPROP_P(op), "scalar", sizeof("scalar"), (void *) &entry, sizeof(zval *), NULL);
- }
- break;
- }
-}
-
-
-ZEND_API void convert_to_array(zval *op)
-{
- TSRMLS_FETCH();
-
- switch (op->type) {
- case IS_ARRAY:
- return;
- break;
-/* OBJECTS_OPTIMIZE */
- case IS_OBJECT:
- {
- zval *tmp;
- HashTable *ht;
-
- ALLOC_HASHTABLE(ht);
- zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0);
- if (Z_OBJ_HT_P(op)->get_properties) {
- zend_hash_copy(ht, Z_OBJ_HT_P(op)->get_properties(op TSRMLS_CC), (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
- }
- zval_dtor(op);
- op->type = IS_ARRAY;
- op->value.ht = ht;
- }
- return;
- case IS_NULL:
- ALLOC_HASHTABLE(op->value.ht);
- zend_hash_init(op->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0);
- op->type = IS_ARRAY;
- break;
- default:
- convert_scalar_to_array(op, IS_ARRAY);
- break;
- }
-}
-
-
-ZEND_API void convert_to_object(zval *op)
-{
- switch (op->type) {
- case IS_ARRAY:
- {
- /* OBJECTS_OPTIMIZE */
- TSRMLS_FETCH();
-
- object_and_properties_init(op, zend_standard_class_def, op->value.ht);
- return;
- break;
- }
- case IS_OBJECT:
- return;
- case IS_NULL:
- {
- /* OBJECTS_OPTIMIZE */
- TSRMLS_FETCH();
-
- object_init(op);
- break;
- }
- default:
- convert_scalar_to_array(op, IS_OBJECT);
- break;
- }
-}
-
-ZEND_API void multi_convert_to_long_ex(int argc, ...)
-{
- zval **arg;
- va_list ap;
-
- va_start(ap, argc);
-
- while (argc--) {
- arg = va_arg(ap, zval **);
- convert_to_long_ex(arg);
- }
-
- va_end(ap);
-}
-
-ZEND_API void multi_convert_to_double_ex(int argc, ...)
-{
- zval **arg;
- va_list ap;
-
- va_start(ap, argc);
-
- while (argc--) {
- arg = va_arg(ap, zval **);
- convert_to_double_ex(arg);
- }
-
- va_end(ap);
-}
-
-ZEND_API void multi_convert_to_string_ex(int argc, ...)
-{
- zval **arg;
- va_list ap;
-
- va_start(ap, argc);
-
- while (argc--) {
- arg = va_arg(ap, zval **);
- convert_to_string_ex(arg);
- }
-
- va_end(ap);
-}
-
-ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- if (op1->type == IS_ARRAY && op2->type == IS_ARRAY) {
- zval *tmp;
-
- if ((result == op1) && (result == op2)) {
- /* $a += $a */
- return SUCCESS;
- }
- if (result != op1) {
- *result = *op1;
- zval_copy_ctor(result);
- }
- zend_hash_merge(result->value.ht, op2->value.ht, (void (*)(void *pData)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0);
- return SUCCESS;
- }
- zendi_convert_scalar_to_number(op1, op1_copy, result);
- zendi_convert_scalar_to_number(op2, op2_copy, result);
-
-
- if (op1->type == IS_LONG && op2->type == IS_LONG) {
- double dval = (double) op1->value.lval + (double) op2->value.lval;
-
- if ((dval > (double) LONG_MAX) || (dval < (double) LONG_MIN)) {
- result->value.dval = dval;
- result->type = IS_DOUBLE;
- } else {
- result->value.lval = op1->value.lval + op2->value.lval;
- result->type = IS_LONG;
- }
- return SUCCESS;
- }
- if ((op1->type == IS_DOUBLE && op2->type == IS_LONG)
- || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) {
- result->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) + op2->value.dval) :
- (op1->value.dval + ((double) op2->value.lval)));
- result->type = IS_DOUBLE;
- return SUCCESS;
- }
- if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) {
- result->type = IS_DOUBLE;
- result->value.dval = op1->value.dval + op2->value.dval;
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE; /* unknown datatype */
-}
-
-
-ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_scalar_to_number(op1, op1_copy, result);
- zendi_convert_scalar_to_number(op2, op2_copy, result);
-
- if (op1->type == IS_LONG && op2->type == IS_LONG) {
- double dval = (double) op1->value.lval - (double) op2->value.lval;
-
- if ((dval < (double) LONG_MIN) || (dval > (double) LONG_MAX)) {
- result->value.dval = dval;
- result->type = IS_DOUBLE;
- } else {
- result->value.lval = op1->value.lval - op2->value.lval;
- result->type = IS_LONG;
- }
- return SUCCESS;
- }
- if ((op1->type == IS_DOUBLE && op2->type == IS_LONG)
- || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) {
- result->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) - op2->value.dval) :
- (op1->value.dval - ((double) op2->value.lval)));
- result->type = IS_DOUBLE;
- return SUCCESS;
- }
- if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) {
- result->type = IS_DOUBLE;
- result->value.dval = op1->value.dval - op2->value.dval;
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE; /* unknown datatype */
-}
-
-
-ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_scalar_to_number(op1, op1_copy, result);
- zendi_convert_scalar_to_number(op2, op2_copy, result);
-
- if (op1->type == IS_LONG && op2->type == IS_LONG) {
- double dval = (double) op1->value.lval * (double) op2->value.lval;
-
- if ((dval > (double) LONG_MAX) || (dval < (double) LONG_MIN)) {
- result->value.dval = dval;
- result->type = IS_DOUBLE;
- } else {
- result->value.lval = op1->value.lval * op2->value.lval;
- result->type = IS_LONG;
- }
- return SUCCESS;
- }
- if ((op1->type == IS_DOUBLE && op2->type == IS_LONG)
- || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) {
- result->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) * op2->value.dval) :
- (op1->value.dval * ((double) op2->value.lval)));
- result->type = IS_DOUBLE;
- return SUCCESS;
- }
- if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) {
- result->type = IS_DOUBLE;
- result->value.dval = op1->value.dval * op2->value.dval;
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE; /* unknown datatype */
-}
-
-ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_scalar_to_number(op1, op1_copy, result);
- zendi_convert_scalar_to_number(op2, op2_copy, result);
-
- if ((op2->type == IS_LONG && op2->value.lval == 0) || (op2->type == IS_DOUBLE && op2->value.dval == 0.0)) {
- zend_error(E_WARNING, "Division by zero");
- ZVAL_BOOL(result, 0);
- return FAILURE; /* division by zero */
- }
- if (op1->type == IS_LONG && op2->type == IS_LONG) {
- if (op1->value.lval % op2->value.lval == 0) { /* integer */
- result->type = IS_LONG;
- result->value.lval = op1->value.lval / op2->value.lval;
- } else {
- result->type = IS_DOUBLE;
- result->value.dval = ((double) op1->value.lval) / op2->value.lval;
- }
- return SUCCESS;
- }
- if ((op1->type == IS_DOUBLE && op2->type == IS_LONG)
- || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) {
- result->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) / op2->value.dval) :
- (op1->value.dval / ((double) op2->value.lval)));
- result->type = IS_DOUBLE;
- return SUCCESS;
- }
- if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) {
- result->type = IS_DOUBLE;
- result->value.dval = op1->value.dval / op2->value.dval;
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE; /* unknown datatype */
-}
-
-
-ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_to_long(op1, op1_copy, result);
- zendi_convert_to_long(op2, op2_copy, result);
-
- if (op2->value.lval == 0) {
- ZVAL_BOOL(result, 0);
- return FAILURE; /* modulus by zero */
- }
-
- result->type = IS_LONG;
- result->value.lval = op1->value.lval % op2->value.lval;
- return SUCCESS;
-}
-
-
-
-ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- result->type = IS_BOOL;
-
- zendi_convert_to_boolean(op1, op1_copy, result);
- zendi_convert_to_boolean(op2, op2_copy, result);
- result->value.lval = op1->value.lval ^ op2->value.lval;
- return SUCCESS;
-}
-
-
-ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC)
-{
- zval op1_copy;
-
- zendi_convert_to_boolean(op1, op1_copy, result);
-
- result->type = IS_BOOL;
- result->value.lval = !op1->value.lval;
- return SUCCESS;
-}
-
-
-ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC)
-{
- zval op1_copy = *op1;
-
- op1 = &op1_copy;
-
- if (op1->type == IS_DOUBLE) {
- op1->value.lval = (long) op1->value.dval;
- op1->type = IS_LONG;
- }
- if (op1->type == IS_LONG) {
- result->value.lval = ~op1->value.lval;
- result->type = IS_LONG;
- return SUCCESS;
- }
- if (op1->type == IS_STRING) {
- int i;
-
- result->type = IS_STRING;
- result->value.str.val = estrndup(op1->value.str.val, op1->value.str.len);
- result->value.str.len = op1->value.str.len;
- for (i = 0; i < op1->value.str.len; i++) {
- result->value.str.val[i] = ~op1->value.str.val[i];
- }
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE; /* unknown datatype */
-}
-
-
-ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- if (op1->type == IS_STRING && op2->type == IS_STRING) {
- zval *longer, *shorter;
- char *result_str;
- int i, result_len;
-
- if (op1->value.str.len >= op2->value.str.len) {
- longer = op1;
- shorter = op2;
- } else {
- longer = op2;
- shorter = op1;
- }
-
- result->type = IS_STRING;
- result_len = longer->value.str.len;
- result_str = estrndup(longer->value.str.val, longer->value.str.len);
- for (i = 0; i < shorter->value.str.len; i++) {
- result_str[i] |= shorter->value.str.val[i];
- }
- if (result==op1) {
- STR_FREE(result->value.str.val);
- }
- result->value.str.val = result_str;
- result->value.str.len = result_len;
- return SUCCESS;
- }
- zendi_convert_to_long(op1, op1_copy, result);
- zendi_convert_to_long(op2, op2_copy, result);
-
- result->type = IS_LONG;
- result->value.lval = op1->value.lval | op2->value.lval;
- return SUCCESS;
-}
-
-
-ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- if (op1->type == IS_STRING && op2->type == IS_STRING) {
- zval *longer, *shorter;
- char *result_str;
- int i, result_len;
-
- if (op1->value.str.len >= op2->value.str.len) {
- longer = op1;
- shorter = op2;
- } else {
- longer = op2;
- shorter = op1;
- }
-
- result->type = IS_STRING;
- result_len = shorter->value.str.len;
- result_str = estrndup(shorter->value.str.val, shorter->value.str.len);
- for (i = 0; i < shorter->value.str.len; i++) {
- result_str[i] &= longer->value.str.val[i];
- }
- if (result==op1) {
- STR_FREE(result->value.str.val);
- }
- result->value.str.val = result_str;
- result->value.str.len = result_len;
- return SUCCESS;
- }
-
-
- zendi_convert_to_long(op1, op1_copy, result);
- zendi_convert_to_long(op2, op2_copy, result);
-
- result->type = IS_LONG;
- result->value.lval = op1->value.lval & op2->value.lval;
- return SUCCESS;
-}
-
-
-ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- if (op1->type == IS_STRING && op2->type == IS_STRING) {
- zval *longer, *shorter;
- char *result_str;
- int i, result_len;
-
- if (op1->value.str.len >= op2->value.str.len) {
- longer = op1;
- shorter = op2;
- } else {
- longer = op2;
- shorter = op1;
- }
-
- result->type = IS_STRING;
- result_len = shorter->value.str.len;
- result_str = estrndup(shorter->value.str.val, shorter->value.str.len);
- for (i = 0; i < shorter->value.str.len; i++) {
- result_str[i] ^= longer->value.str.val[i];
- }
- if (result==op1) {
- STR_FREE(result->value.str.val);
- }
- result->value.str.val = result_str;
- result->value.str.len = result_len;
- return SUCCESS;
- }
-
- zendi_convert_to_long(op1, op1_copy, result);
- zendi_convert_to_long(op2, op2_copy, result);
-
- result->type = IS_LONG;
- result->value.lval = op1->value.lval ^ op2->value.lval;
- return SUCCESS;
-}
-
-
-ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_to_long(op1, op1_copy, result);
- zendi_convert_to_long(op2, op2_copy, result);
- result->value.lval = op1->value.lval << op2->value.lval;
- result->type = IS_LONG;
- return SUCCESS;
-}
-
-
-ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_to_long(op1, op1_copy, result);
- zendi_convert_to_long(op2, op2_copy, result);
- result->value.lval = op1->value.lval >> op2->value.lval;
- result->type = IS_LONG;
- return SUCCESS;
-}
-
-
-
-/* must support result==op1 */
-ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2)
-{
- result->value.str.len = op1->value.str.len + 1;
- result->value.str.val = (char *) erealloc(op1->value.str.val, result->value.str.len+1);
- result->value.str.val[result->value.str.len - 1] = (char) op2->value.lval;
- result->value.str.val[result->value.str.len] = 0;
- result->type = IS_STRING;
- return SUCCESS;
-}
-
-
-/* must support result==op1 */
-ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2)
-{
- int length = op1->value.str.len + op2->value.str.len;
- if (op1->value.str.val == empty_string) {
- result->value.str.val = (char *) emalloc(length+1);
- } else {
- result->value.str.val = (char *) erealloc(op1->value.str.val, length+1);
- }
- memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len);
- result->value.str.val[length] = 0;
- result->value.str.len = length;
- result->type = IS_STRING;
- return SUCCESS;
-}
-
-
-ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
- int use_copy1, use_copy2;
-
-
- zend_make_printable_zval(op1, &op1_copy, &use_copy1);
- zend_make_printable_zval(op2, &op2_copy, &use_copy2);
-
- if (use_copy1) {
- op1 = &op1_copy;
- }
- if (use_copy2) {
- op2 = &op2_copy;
- }
- if (result==op1) { /* special case, perform operations on result */
- uint res_len = op1->value.str.len + op2->value.str.len;
-
- if (result->value.str.len == 0) { /* handle empty_string */
- STR_FREE(result->value.str.val);
- result->value.str.val = emalloc(res_len+1);
- } else {
- result->value.str.val = erealloc(result->value.str.val, res_len+1);
- }
- memcpy(result->value.str.val+result->value.str.len, op2->value.str.val, op2->value.str.len);
- result->value.str.val[res_len]=0;
- result->value.str.len = res_len;
- } else {
- result->value.str.len = op1->value.str.len + op2->value.str.len;
- result->value.str.val = (char *) emalloc(result->value.str.len + 1);
- memcpy(result->value.str.val, op1->value.str.val, op1->value.str.len);
- memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len);
- result->value.str.val[result->value.str.len] = 0;
- result->type = IS_STRING;
- }
- if (use_copy1) {
- zval_dtor(op1);
- }
- if (use_copy2) {
- zval_dtor(op2);
- }
- return SUCCESS;
-}
-
-
-ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
- int use_copy1, use_copy2;
-
- zend_make_printable_zval(op1, &op1_copy, &use_copy1);
- zend_make_printable_zval(op2, &op2_copy, &use_copy2);
-
- if (use_copy1) {
- op1 = &op1_copy;
- }
- if (use_copy2) {
- op2 = &op2_copy;
- }
-
- result->value.lval = zend_binary_zval_strcmp(op1, op2);
- result->type = IS_LONG;
-
- if (use_copy1) {
- zval_dtor(op1);
- }
- if (use_copy2) {
- zval_dtor(op2);
- }
- return SUCCESS;
-}
-
-ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- op1_copy = *op1;
- zval_copy_ctor(&op1_copy);
-
- op2_copy = *op2;
- zval_copy_ctor(&op2_copy);
-
- convert_to_double(&op1_copy);
- convert_to_double(&op2_copy);
-
- result->value.lval = ZEND_NORMALIZE_BOOL(op1_copy.value.dval-op2_copy.value.dval);
- result->type = IS_LONG;
-
- return SUCCESS;
-}
-
-
-ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- if ((op1->type == IS_NULL && op2->type == IS_STRING)
- || (op2->type == IS_NULL && op1->type == IS_STRING)) {
- if (op1->type == IS_NULL) {
- result->type = IS_LONG;
- result->value.lval = zend_binary_strcmp("", 0, op2->value.str.val, op2->value.str.len);
- return SUCCESS;
- } else {
- result->type = IS_LONG;
- result->value.lval = zend_binary_strcmp(op1->value.str.val, op1->value.str.len, "", 0);
- return SUCCESS;
- }
- }
-
- if (op1->type == IS_STRING && op2->type == IS_STRING) {
- zendi_smart_strcmp(result, op1, op2);
- return SUCCESS;
- }
-
- if (op1->type == IS_BOOL || op2->type == IS_BOOL
- || op1->type == IS_NULL || op2->type == IS_NULL) {
- zendi_convert_to_boolean(op1, op1_copy, result);
- zendi_convert_to_boolean(op2, op2_copy, result);
- result->type = IS_LONG;
- result->value.lval = ZEND_NORMALIZE_BOOL(op1->value.lval-op2->value.lval);
- return SUCCESS;
- }
-
- zendi_convert_scalar_to_number(op1, op1_copy, result);
- zendi_convert_scalar_to_number(op2, op2_copy, result);
-
- if (op1->type == IS_LONG && op2->type == IS_LONG) {
- result->type = IS_LONG;
- result->value.lval = op1->value.lval>op2->value.lval?1:(op1->value.lval<op2->value.lval?-1:0);
- return SUCCESS;
- }
- if ((op1->type == IS_DOUBLE || op1->type == IS_LONG)
- && (op2->type == IS_DOUBLE || op2->type == IS_LONG)) {
- result->value.dval = (op1->type == IS_LONG ? (double) op1->value.lval : op1->value.dval) - (op2->type == IS_LONG ? (double) op2->value.lval : op2->value.dval);
- result->value.lval = ZEND_NORMALIZE_BOOL(result->value.dval);
- result->type = IS_LONG;
- return SUCCESS;
- }
- if (op1->type==IS_ARRAY && op2->type==IS_ARRAY) {
- zend_compare_arrays(result, op1, op2 TSRMLS_CC);
- return SUCCESS;
- }
-
- if (op1->type==IS_OBJECT && op2->type==IS_OBJECT) {
- zend_compare_objects(result, op1, op2 TSRMLS_CC);
- return SUCCESS;
- }
-
- if (op1->type==IS_ARRAY) {
- result->value.lval = 1;
- result->type = IS_LONG;
- return SUCCESS;
- }
- if (op2->type==IS_ARRAY) {
- result->value.lval = -1;
- result->type = IS_LONG;
- return SUCCESS;
- }
- if (op1->type==IS_OBJECT) {
- result->value.lval = 1;
- result->type = IS_LONG;
- return SUCCESS;
- }
- if (op2->type==IS_OBJECT) {
- result->value.lval = -1;
- result->type = IS_LONG;
- return SUCCESS;
- }
-
- ZVAL_BOOL(result, 0);
- return FAILURE;
-}
-
-
-static int hash_zval_identical_function(const zval **z1, const zval **z2)
-{
- zval result;
- TSRMLS_FETCH();
-
- /* is_identical_function() returns 1 in case of identity and 0 in case
- * of a difference;
- * whereas this comparison function is expected to return 0 on identity,
- * and non zero otherwise.
- */
- if (is_identical_function(&result, (zval *) *z1, (zval *) *z2 TSRMLS_CC)==FAILURE) {
- return 1;
- }
- return !result.value.lval;
-}
-
-
-ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- result->type = IS_BOOL;
- if (op1->type != op2->type) {
- result->value.lval = 0;
- return SUCCESS;
- }
- switch (op1->type) {
- case IS_NULL:
- result->value.lval = (op2->type==IS_NULL);
- break;
- case IS_BOOL:
- case IS_LONG:
- case IS_RESOURCE:
- result->value.lval = (op1->value.lval == op2->value.lval);
- break;
- case IS_DOUBLE:
- result->value.lval = (op1->value.dval == op2->value.dval);
- break;
- case IS_STRING:
- if ((op1->value.str.len == op2->value.str.len)
- && (!memcmp(op1->value.str.val, op2->value.str.val, op1->value.str.len))) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- break;
- case IS_ARRAY:
- if (zend_hash_compare(op1->value.ht, op2->value.ht, (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- break;
- case IS_OBJECT:
- if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2) && Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- break;
- default:
- ZVAL_BOOL(result, 0);
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- result->type = IS_BOOL;
- if (is_identical_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
- result->value.lval = !result->value.lval;
- return SUCCESS;
-}
-
-
-ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
- convert_to_boolean(result);
- if (result->value.lval == 0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
-}
-
-
-ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
- convert_to_boolean(result);
- if (result->value.lval) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
-}
-
-
-ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
- if (result->type == IS_LONG) {
- result->type = IS_BOOL;
- if (result->value.lval < 0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
- }
- if (result->type == IS_DOUBLE) {
- result->type = IS_BOOL;
- if (result->value.dval < 0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE;
-}
-
-
-ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
- if (result->type == IS_LONG) {
- result->type = IS_BOOL;
- if (result->value.lval <= 0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
- }
- if (result->type == IS_DOUBLE) {
- result->type = IS_BOOL;
- if (result->value.dval <= 0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE;
-}
-
-
-ZEND_API zend_bool instanceof_function(zend_class_entry *instance_ce, zend_class_entry *ce TSRMLS_DC)
-{
- zend_uint i;
-
- while (instance_ce) {
- if (instance_ce == ce) {
- return 1;
- }
- for (i=0; i<instance_ce->num_interfaces; i++) {
-
- if (instanceof_function(instance_ce->interfaces[i], ce TSRMLS_CC)) {
- return 1;
- }
- }
- instance_ce = instance_ce->parent;
- }
-
- return 0;
-}
-
-#define LOWER_CASE 1
-#define UPPER_CASE 2
-#define NUMERIC 3
-
-
-static void increment_string(zval *str)
-{
- int carry=0;
- int pos=str->value.str.len-1;
- char *s=str->value.str.val;
- char *t;
- int last=0; /* Shut up the compiler warning */
- int ch;
-
- if (str->value.str.len == 0) {
- STR_FREE(str->value.str.val);
- str->value.str.val = estrndup("1", sizeof("1")-1);
- str->value.str.len = 1;
- return;
- }
-
- while (pos >= 0) {
- ch = s[pos];
- if (ch >= 'a' && ch <= 'z') {
- if (ch == 'z') {
- s[pos] = 'a';
- carry=1;
- } else {
- s[pos]++;
- carry=0;
- }
- last=LOWER_CASE;
- } else if (ch >= 'A' && ch <= 'Z') {
- if (ch == 'Z') {
- s[pos] = 'A';
- carry=1;
- } else {
- s[pos]++;
- carry=0;
- }
- last=UPPER_CASE;
- } else if (ch >= '0' && ch <= '9') {
- if (ch == '9') {
- s[pos] = '0';
- carry=1;
- } else {
- s[pos]++;
- carry=0;
- }
- last = NUMERIC;
- } else {
- carry=0;
- break;
- }
- if (carry == 0) {
- break;
- }
- pos--;
- }
-
- if (carry) {
- t = (char *) emalloc(str->value.str.len+1+1);
- memcpy(t+1, str->value.str.val, str->value.str.len);
- str->value.str.len++;
- t[str->value.str.len] = '\0';
- switch (last) {
- case NUMERIC:
- t[0] = '1';
- break;
- case UPPER_CASE:
- t[0] = 'A';
- break;
- case LOWER_CASE:
- t[0] = 'a';
- break;
- }
- STR_FREE(str->value.str.val);
- str->value.str.val = t;
- }
-}
-
-
-ZEND_API int increment_function(zval *op1)
-{
- switch (op1->type) {
- case IS_LONG:
- if (op1->value.lval == LONG_MAX) {
- /* switch to double */
- double d = (double)op1->value.lval;
- ZVAL_DOUBLE(op1, d+1);
- } else {
- op1->value.lval++;
- }
- break;
- case IS_DOUBLE:
- op1->value.dval = op1->value.dval + 1;
- break;
- case IS_NULL:
- op1->value.lval = 1;
- op1->type = IS_LONG;
- break;
- case IS_STRING: {
- long lval;
- double dval;
- char *strval = op1->value.str.val;
-
- switch (is_numeric_string(strval, op1->value.str.len, &lval, &dval, 0)) {
- case IS_LONG:
- if (lval == LONG_MAX) {
- /* switch to double */
- double d = (double)lval;
- ZVAL_DOUBLE(op1, d+1);
- } else {
- op1->value.lval = lval+1;
- op1->type = IS_LONG;
- }
- efree(strval); /* should never be empty_string */
- break;
- case IS_DOUBLE:
- op1->value.dval = dval+1;
- op1->type = IS_DOUBLE;
- efree(strval); /* should never be empty_string */
- break;
-#if 0
- case FLAG_IS_BC:
- /* Not implemented */
-#endif
- default:
- /* Perl style string increment */
- increment_string(op1);
- break;
- }
- }
- break;
- default:
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-ZEND_API int decrement_function(zval *op1)
-{
- long lval;
- double dval;
-
- switch (op1->type) {
- case IS_LONG:
- if (op1->value.lval == LONG_MIN) {
- double d = (double)op1->value.lval;
- ZVAL_DOUBLE(op1, d-1);
- } else {
- op1->value.lval--;
- }
- break;
- case IS_DOUBLE:
- op1->value.dval = op1->value.dval - 1;
- break;
- case IS_STRING: /* Like perl we only support string increment */
- if (op1->value.str.len == 0) { /* consider as 0 */
- STR_FREE(op1->value.str.val);
- op1->value.lval = -1;
- op1->type = IS_LONG;
- break;
- }
- switch (is_numeric_string(op1->value.str.val, op1->value.str.len, &lval, &dval, 0)) {
- case IS_LONG:
- STR_FREE(op1->value.str.val);
- if (lval == LONG_MIN) {
- double d = (double)lval;
- ZVAL_DOUBLE(op1, d-1);
- } else {
- op1->value.lval = lval-1;
- op1->type = IS_LONG;
- }
- break;
- case IS_DOUBLE:
- STR_FREE(op1->value.str.val);
- op1->value.dval = dval - 1;
- op1->type = IS_DOUBLE;
- break;
- }
- break;
- default:
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-
-ZEND_API int zval_is_true(zval *op)
-{
- convert_to_boolean(op);
- return (op->value.lval ? 1 : 0);
-}
-
-ZEND_API void zend_str_tolower(char *str, unsigned int length)
-{
- register char *p=str, *end=p+length;
-
- while (p<end) {
- if (*p >= 'A' && *p <= 'Z') {
- *p = (*p)+32;
- }
- p++;
- }
-}
-
-ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2)
-{
- int retval;
-
- retval = memcmp(s1, s2, MIN(len1, len2));
- if (!retval) {
- return (len1 - len2);
- } else {
- return retval;
- }
-}
-
-ZEND_API int zend_binary_strncmp(char *s1, uint len1, char *s2, uint len2, uint length)
-{
- int retval;
-
- retval = memcmp(s1, s2, MIN(length, MIN(len1, len2)));
- if (!retval) {
- return (MIN(length, len1) - MIN(length, len2));
- } else {
- return retval;
- }
-}
-
-
-ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2)
-{
- int len;
- int c1, c2;
-
- len = MIN(len1, len2);
-
- while (len--) {
- c1 = tolower(*s1++);
- c2 = tolower(*s2++);
- if (c1 != c2) {
- return c1 - c2;
- }
- }
-
- return len1 - len2;
-}
-
-
-ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, uint length)
-{
- int len;
- int c1, c2;
-
- len = MIN(length, MIN(len1, len2));
-
- while (len--) {
- c1 = tolower(*s1++);
- c2 = tolower(*s2++);
- if (c1 != c2) {
- return c1 - c2;
- }
- }
-
- return MIN(length, len1) - MIN(length, len2);
-}
-
-
-ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2)
-{
- return zend_binary_strcmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len);
-}
-
-ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3)
-{
- return zend_binary_strncmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len, s3->value.lval);
-}
-
-
-ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2)
-{
- return zend_binary_strcasecmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len);
-}
-
-
-ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3)
-{
- return zend_binary_strncasecmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len, s3->value.lval);
-}
-
-
-ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2)
-{
- int ret1, ret2;
- long lval1, lval2;
- double dval1, dval2;
-
- if ((ret1=is_numeric_string(s1->value.str.val, s1->value.str.len, &lval1, &dval1, 0)) &&
- (ret2=is_numeric_string(s2->value.str.val, s2->value.str.len, &lval2, &dval2, 0))) {
-#if 0&&WITH_BCMATH
- if ((ret1==FLAG_IS_BC) || (ret2==FLAG_IS_BC)) {
- bc_num first, second;
-
- /* use the BC math library to compare the numbers */
- init_num(&first);
- init_num(&second);
- str2num(&first, s1->value.str.val, 100); /* this scale should do */
- str2num(&second, s2->value.str.val, 100); /* ditto */
- result->value.lval = bc_compare(first, second);
- result->value.lval = ZEND_NORMALIZE_BOOL(result->value.lval);
- result->type = IS_LONG;
- free_num(&first);
- free_num(&second);
- } else
-#endif
- if ((ret1==IS_DOUBLE) || (ret2==IS_DOUBLE)) {
- if (ret1!=IS_DOUBLE) {
- dval1 = strtod(s1->value.str.val, NULL);
- } else if (ret2!=IS_DOUBLE) {
- dval2 = strtod(s2->value.str.val, NULL);
- }
- result->value.dval = dval1 - dval2;
- result->value.lval = ZEND_NORMALIZE_BOOL(result->value.dval);
- result->type = IS_LONG;
- } else { /* they both have to be long's */
- result->value.lval = lval1 - lval2;
- result->value.lval = ZEND_NORMALIZE_BOOL(result->value.lval);
- result->type = IS_LONG;
- }
- } else {
- result->value.lval = zend_binary_zval_strcmp(s1, s2);
- result->value.lval = ZEND_NORMALIZE_BOOL(result->value.lval);
- result->type = IS_LONG;
- }
- return;
-}
-
-
-static int hash_zval_compare_function(const zval **z1, const zval **z2 TSRMLS_DC)
-{
- zval result;
-
- if (compare_function(&result, (zval *) *z1, (zval *) *z2 TSRMLS_CC)==FAILURE) {
- return 1;
- }
- return result.value.lval;
-}
-
-ZEND_API int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_DC)
-{
- return zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC);
-}
-
-
-
-ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC)
-{
- result->type = IS_LONG;
- result->value.lval = zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC);
-}
-
-
-ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC)
-{
- zend_compare_symbol_tables(result, a1->value.ht, a2->value.ht TSRMLS_CC);
-}
-
-
-ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC)
-{
- result->type = IS_LONG;
- if (Z_OBJ_HT_P(o1) != Z_OBJ_HT_P(o2)) {
- result->value.lval = 1; /* Comparing objects of different types is pretty much meaningless */
- return;
- }
-
- if (Z_OBJ_HT_P(o1)->compare_objects == NULL) {
- if (Z_OBJ_HANDLE_P(o1) == Z_OBJ_HANDLE_P(o2)) {
- result->value.lval = 0;
- } else {
- result->value.lval = 1;
- }
- return;
- } else {
- result->value.lval = Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC);
- }
-}
-
-ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC)
-{
- double dval = op->value.dval;
-
- TSRMLS_FETCH();
-
- op->value.str.val = (char *) emalloc_rel(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
- sprintf(op->value.str.val, "%.*G", (int) EG(precision), dval);
- op->value.str.len = strlen(op->value.str.val);
-
- if (EG(float_separator)[0] != '.') {
- char *p = op->value.str.val;
- if ((p = strchr(p, '.'))) {
- *p = EG(float_separator)[0];
- }
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
deleted file mode 100644
index 8d724480cf..0000000000
--- a/Zend/zend_operators.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_OPERATORS_H
-#define ZEND_OPERATORS_H
-
-#include <errno.h>
-#include <math.h>
-
-#ifdef HAVE_IEEEFP_H
-#include <ieeefp.h>
-#endif
-
-
-#if 0&&WITH_BCMATH
-#include "ext/bcmath/libbcmath/src/bcmath.h"
-#endif
-
-#define MAX_LENGTH_OF_LONG 18
-#define MAX_LENGTH_OF_DOUBLE 32
-
-ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC);
-ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC);
-ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-
-ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-
-ZEND_API zend_bool instanceof_function(zend_class_entry *instance_ce, zend_class_entry *ce TSRMLS_DC);
-
-static inline zend_bool is_numeric_string(char *str, int length, long *lval, double *dval, zend_bool allow_errors)
-{
- long local_lval;
- double local_dval;
- char *end_ptr_long, *end_ptr_double;
- int conv_base=10;
-
- if (!length) {
- return 0;
- }
-
- /* handle hex numbers */
- if (length>=2 && str[0]=='0' && (str[1]=='x' || str[1]=='X')) {
- conv_base=16;
- }
- errno=0;
- local_lval = strtol(str, &end_ptr_long, conv_base);
- if (errno!=ERANGE) {
- if (end_ptr_long == str+length) { /* integer string */
- if (lval) {
- *lval = local_lval;
- }
- return IS_LONG;
- }
- } else {
- end_ptr_long=NULL;
- }
-
- if (conv_base==16) { /* hex string, under UNIX strtod() messes it up */
- return 0;
- }
-
- errno=0;
- local_dval = strtod(str, &end_ptr_double);
- if (errno!=ERANGE) {
- if (end_ptr_double == str+length) { /* floating point string */
- if (! zend_finite(local_dval)) {
- /* "inf","nan" and maybe other weird ones */
- return 0;
- }
-
- if (dval) {
- *dval = local_dval;
- }
-#if 0&&WITH_BCMATH
- if (length>16) {
- register char *ptr=str, *end=str+length;
-
- while (ptr<end) {
- switch (*ptr++) {
- case 'e':
- case 'E':
- /* scientific notation, not handled by the BC library */
- return IS_DOUBLE;
- break;
- default:
- break;
- }
- }
- return FLAG_IS_BC;
- } else {
- return IS_DOUBLE;
- }
-#else
- return IS_DOUBLE;
-#endif
- }
- } else {
- end_ptr_double=NULL;
- }
- if (allow_errors) {
- if (end_ptr_double>end_ptr_long && dval) {
- *dval = local_dval;
- return IS_DOUBLE;
- } else if (end_ptr_long && lval) {
- *lval = local_lval;
- return IS_LONG;
- }
- }
- return 0;
-}
-
-static inline char *
-zend_memnstr(char *haystack, char *needle, int needle_len, char *end)
-{
- char *p = haystack;
- char ne = needle[needle_len-1];
-
- end -= needle_len;
-
- while (p <= end) {
- if ((p = memchr(p, *needle, (end-p+1))) && ne == p[needle_len-1]) {
- if (!memcmp(needle, p, needle_len-1)) {
- return p;
- }
- }
-
- if (p == NULL) {
- return NULL;
- }
-
- p++;
- }
-
- return NULL;
-}
-
-ZEND_API int increment_function(zval *op1);
-ZEND_API int decrement_function(zval *op2);
-
-BEGIN_EXTERN_C()
-ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC);
-ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC);
-ZEND_API void convert_to_long(zval *op);
-ZEND_API void convert_to_double(zval *op);
-ZEND_API void convert_to_long_base(zval *op, int base);
-ZEND_API void convert_to_null(zval *op);
-ZEND_API void convert_to_boolean(zval *op);
-ZEND_API void convert_to_array(zval *op);
-ZEND_API void convert_to_object(zval *op);
-ZEND_API void multi_convert_to_long_ex(int argc, ...);
-ZEND_API void multi_convert_to_double_ex(int argc, ...);
-ZEND_API void multi_convert_to_string_ex(int argc, ...);
-ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2);
-ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2);
-#define convert_to_string(op) _convert_to_string((op) ZEND_FILE_LINE_CC)
-
-ZEND_API double zend_string_to_double(const char *number, zend_uint length);
-END_EXTERN_C()
-
-ZEND_API int zval_is_true(zval *op);
-ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-
-ZEND_API void zend_str_tolower(char *str, unsigned int length);
-ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2);
-ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3);
-ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2);
-ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3);
-ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2);
-ZEND_API int zend_binary_strncmp(char *s1, uint len1, char *s2, uint len2, uint length);
-ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2);
-ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, uint length);
-
-ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
-ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC);
-ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC);
-ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC);
-
-ZEND_API int zend_atoi(const char *str, int str_len);
-
-ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC);
-
-#define convert_to_ex_master(ppzv, lower_type, upper_type) \
- if ((*ppzv)->type!=IS_##upper_type) { \
- if (!(*ppzv)->is_ref) { \
- SEPARATE_ZVAL(ppzv); \
- } \
- convert_to_##lower_type(*ppzv); \
- }
-
-#define convert_to_writable_ex_master(ppzv, lower_type, upper_type) \
- if ((*ppzv)->type!=IS_##upper_type) { \
- SEPARATE_ZVAL(ppzv); \
- convert_to_##lower_type(*ppzv); \
- }
-
-
-#define convert_to_boolean_ex(ppzv) convert_to_ex_master(ppzv, boolean, BOOL)
-#define convert_to_long_ex(ppzv) convert_to_ex_master(ppzv, long, LONG)
-#define convert_to_double_ex(ppzv) convert_to_ex_master(ppzv, double, DOUBLE)
-#define convert_to_string_ex(ppzv) convert_to_ex_master(ppzv, string, STRING)
-#define convert_to_array_ex(ppzv) convert_to_ex_master(ppzv, array, ARRAY)
-#define convert_to_object_ex(ppzv) convert_to_ex_master(ppzv, object, OBJECT)
-#define convert_to_null_ex(ppzv) convert_to_ex_master(ppzv, null, NULL)
-
-#define convert_to_writable_boolean_ex(ppzv) convert_to_writable_ex_master(ppzv, boolean, BOOL)
-#define convert_to_writable_long_ex(ppzv) convert_to_writable_ex_master(ppzv, long, LONG)
-#define convert_to_writable_double_ex(ppzv) convert_to_writable_ex_master(ppzv, double, DOUBLE)
-#define convert_to_writable_string_ex(ppzv) convert_to_writable_ex_master(ppzv, string, STRING)
-#define convert_to_writable_array_ex(ppzv) convert_to_writable_ex_master(ppzv, array, ARRAY)
-#define convert_to_writable_object_ex(ppzv) convert_to_writable_ex_master(ppzv, object, OBJECT)
-#define convert_to_writable_null_ex(ppzv) convert_to_writable_ex_master(ppzv, null, NULL)
-
-
-#define convert_scalar_to_number_ex(ppzv) \
- if ((*ppzv)->type!=IS_LONG && (*ppzv)->type!=IS_DOUBLE) { \
- if (!(*ppzv)->is_ref) { \
- SEPARATE_ZVAL(ppzv); \
- } \
- convert_scalar_to_number(*ppzv TSRMLS_CC); \
- }
-
-
-#define Z_LVAL(zval) (zval).value.lval
-#define Z_BVAL(zval) ((zend_bool)(zval).value.lval)
-#define Z_DVAL(zval) (zval).value.dval
-#define Z_STRVAL(zval) (zval).value.str.val
-#define Z_STRLEN(zval) (zval).value.str.len
-#define Z_ARRVAL(zval) (zval).value.ht
-#define Z_OBJ_HANDLE(zval) (zval).value.obj.handle
-#define Z_OBJ_HT(zval) (zval).value.obj.handlers
-#define Z_OBJCE(zval) zend_get_class_entry(&(zval) TSRMLS_CC)
-#define Z_OBJPROP(zval) Z_OBJ_HT((zval))->get_properties(&(zval) TSRMLS_CC)
-#define Z_OBJ_HANDLER(zval, hf) Z_OBJ_HT((zval))->hf
-#define Z_RESVAL(zval) (zval).value.lval
-
-#define Z_LVAL_P(zval_p) Z_LVAL(*zval_p)
-#define Z_BVAL_P(zval_p) Z_BVAL(*zval_p)
-#define Z_DVAL_P(zval_p) Z_DVAL(*zval_p)
-#define Z_STRVAL_P(zval_p) Z_STRVAL(*zval_p)
-#define Z_STRLEN_P(zval_p) Z_STRLEN(*zval_p)
-#define Z_ARRVAL_P(zval_p) Z_ARRVAL(*zval_p)
-#define Z_OBJPROP_P(zval_p) Z_OBJPROP(*zval_p)
-#define Z_OBJCE_P(zval_p) Z_OBJCE(*zval_p)
-#define Z_RESVAL_P(zval_p) Z_RESVAL(*zval_p)
-#define Z_OBJ_HANDLE_P(zval_p) Z_OBJ_HANDLE(*zval_p)
-#define Z_OBJ_HT_P(zval_p) Z_OBJ_HT(*zval_p)
-#define Z_OBJ_HANDLER_P(zval_p, h) Z_OBJ_HANDLER(*zval_p, h)
-
-#define Z_LVAL_PP(zval_pp) Z_LVAL(**zval_pp)
-#define Z_BVAL_PP(zval_pp) Z_BVAL(**zval_pp)
-#define Z_DVAL_PP(zval_pp) Z_DVAL(**zval_pp)
-#define Z_STRVAL_PP(zval_pp) Z_STRVAL(**zval_pp)
-#define Z_STRLEN_PP(zval_pp) Z_STRLEN(**zval_pp)
-#define Z_ARRVAL_PP(zval_pp) Z_ARRVAL(**zval_pp)
-#define Z_OBJPROP_PP(zval_pp) Z_OBJPROP(**zval_pp)
-#define Z_OBJCE_PP(zval_pp) Z_OBJCE(**zval_pp)
-#define Z_RESVAL_PP(zval_pp) Z_RESVAL(**zval_pp)
-#define Z_OBJ_HANDLE_PP(zval_p) Z_OBJ_HANDLE(**zval_p)
-#define Z_OBJ_HT_PP(zval_p) Z_OBJ_HT(**zval_p)
-#define Z_OBJ_HANDLER_PP(zval_p, h) Z_OBJ_HANDLER(**zval_p, h)
-
-#define Z_TYPE(zval) (zval).type
-#define Z_TYPE_P(zval_p) Z_TYPE(*zval_p)
-#define Z_TYPE_PP(zval_pp) Z_TYPE(**zval_pp)
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_ptr_stack.c b/Zend/zend_ptr_stack.c
deleted file mode 100644
index 756e4933c5..0000000000
--- a/Zend/zend_ptr_stack.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_ptr_stack.h"
-#ifdef HAVE_STDARG_H
-# include <stdarg.h>
-#endif
-
-ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack)
-{
- stack->top_element = stack->elements = (void **) emalloc(sizeof(void *)*PTR_STACK_BLOCK_SIZE);
- stack->max = PTR_STACK_BLOCK_SIZE;
- stack->top = 0;
-}
-
-
-ZEND_API void zend_ptr_stack_n_push(zend_ptr_stack *stack, int count, ...)
-{
- va_list ptr;
- void *elem;
-
- if (stack->top+count > stack->max) { /* we need to allocate more memory */
- stack->max *= 2;
- stack->max += count;
- stack->elements = (void **) erealloc(stack->elements, (sizeof(void *) * (stack->max)));
- stack->top_element = stack->elements+stack->top;
- }
- va_start(ptr, count);
- while (count>0) {
- elem = va_arg(ptr, void *);
- stack->top++;
- *(stack->top_element++) = elem;
- count--;
- }
- va_end(ptr);
-}
-
-
-ZEND_API void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count, ...)
-{
- va_list ptr;
- void **elem;
-
- va_start(ptr, count);
- while (count>0) {
- elem = va_arg(ptr, void **);
- *elem = *(--stack->top_element);
- stack->top--;
- count--;
- }
- va_end(ptr);
-}
-
-
-
-ZEND_API void zend_ptr_stack_destroy(zend_ptr_stack *stack)
-{
- if (stack->elements) {
- efree(stack->elements);
- }
-}
-
-
-ZEND_API void zend_ptr_stack_apply(zend_ptr_stack *stack, void (*func)(void *))
-{
- int i = stack->top;
-
- while (--i >= 0) {
- func(stack->elements[i]);
- }
-}
-
-
-ZEND_API void zend_ptr_stack_clean(zend_ptr_stack *stack, void (*func)(void *), zend_bool free_elements)
-{
- zend_ptr_stack_apply(stack, func);
- if (free_elements) {
- int i = stack->top;
-
- while (--i >= 0) {
- efree(stack->elements[i]);
- }
- }
- stack->top = 0;
- stack->top_element = stack->elements;
-}
-
-
-ZEND_API int zend_ptr_stack_num_elements(zend_ptr_stack *stack)
-{
- return stack->top;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_ptr_stack.h b/Zend/zend_ptr_stack.h
deleted file mode 100644
index ff6b715bbb..0000000000
--- a/Zend/zend_ptr_stack.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_PTR_STACK_H
-#define ZEND_PTR_STACK_H
-
-typedef struct _zend_ptr_stack {
- int top, max;
- void **elements;
- void **top_element;
-} zend_ptr_stack;
-
-
-#define PTR_STACK_BLOCK_SIZE 64
-
-ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack);
-ZEND_API void zend_ptr_stack_n_push(zend_ptr_stack *stack, int count, ...);
-ZEND_API void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count, ...);
-ZEND_API void zend_ptr_stack_destroy(zend_ptr_stack *stack);
-ZEND_API void zend_ptr_stack_apply(zend_ptr_stack *stack, void (*func)(void *));
-ZEND_API void zend_ptr_stack_clean(zend_ptr_stack *stack, void (*func)(void *), zend_bool free_elements);
-ZEND_API int zend_ptr_stack_num_elements(zend_ptr_stack *stack);
-
-static inline void zend_ptr_stack_push(zend_ptr_stack *stack, void *ptr)
-{
- if (stack->top >= stack->max) { /* we need to allocate more memory */
- stack->elements = (void **) erealloc(stack->elements, (sizeof(void *) * (stack->max *= 2 )));
- stack->top_element = stack->elements+stack->top;
- }
- stack->top++;
- *(stack->top_element++) = ptr;
-}
-
-static inline void *zend_ptr_stack_pop(zend_ptr_stack *stack)
-{
- stack->top--;
- return *(--stack->top_element);
-}
-
-#endif /* ZEND_PTR_STACK_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_qsort.c b/Zend/zend_qsort.c
deleted file mode 100644
index 1f7d223d6e..0000000000
--- a/Zend/zend_qsort.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-
-#include <limits.h>
-
-#define QSORT_STACK_SIZE (sizeof(size_t) * CHAR_BIT)
-
-static void _zend_qsort_swap(void *a, void *b, size_t siz)
-{
- register char *tmp_a_char;
- register char *tmp_b_char;
- register int *tmp_a_int;
- register int *tmp_b_int;
- register size_t i;
- int t_i;
- char t_c;
-
- tmp_a_int = (int *) a;
- tmp_b_int = (int *) b;
-
- for (i = sizeof(int); i <= siz; i += sizeof(int)) {
- t_i = *tmp_a_int;
- *tmp_a_int++ = *tmp_b_int;
- *tmp_b_int++ = t_i;
- }
-
- tmp_a_char = (char *) tmp_a_int;
- tmp_b_char = (char *) tmp_b_int;
-
- for (i = i - sizeof(int) + 1; i <= siz; ++i) {
- t_c = *tmp_a_char;
- *tmp_a_char++ = *tmp_b_char;
- *tmp_b_char++ = t_c;
- }
-}
-
-ZEND_API void zend_qsort(void *base, size_t nmemb, size_t siz, compare_func_t compare TSRMLS_DC)
-{
- void *begin_stack[QSORT_STACK_SIZE];
- void *end_stack[QSORT_STACK_SIZE];
- register char *begin;
- register char *end;
- register char *seg1;
- register char *seg2;
- register char *seg2p;
- register int loop;
- uint offset;
-
- begin_stack[0] = (char *) base;
- end_stack[0] = (char *) base + ((nmemb - 1) * siz);
-
- for (loop = 0; loop >= 0; --loop) {
- begin = begin_stack[loop];
- end = end_stack[loop];
-
- while (begin < end) {
- offset = (end - begin) >> 1;
- _zend_qsort_swap(begin, begin + (offset - (offset % siz)), siz);
-
- seg1 = begin + siz;
- seg2 = end;
-
- while (1) {
- for (; seg1 < seg2 && compare(begin, seg1 TSRMLS_CC) > 0;
- seg1 += siz);
-
- for (; seg2 >= seg1 && compare(seg2, begin TSRMLS_CC) > 0;
- seg2 -= siz);
-
- if (seg1 >= seg2)
- break;
-
- _zend_qsort_swap(seg1, seg2, siz);
-
- seg1 += siz;
- seg2 -= siz;
- }
-
- _zend_qsort_swap(begin, seg2, siz);
-
- seg2p = seg2;
-
- if ((seg2p - begin) <= (end - seg2p)) {
- if ((seg2p + siz) < end) {
- begin_stack[loop] = seg2p + siz;
- end_stack[loop++] = end;
- }
- end = seg2p - siz;
- }
- else {
- if ((seg2p - siz) > begin) {
- begin_stack[loop] = begin;
- end_stack[loop++] = seg2p - siz;
- }
- begin = seg2p + siz;
- }
- }
- }
-}
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/Zend/zend_qsort.h b/Zend/zend_qsort.h
deleted file mode 100644
index fec4cd2fb6..0000000000
--- a/Zend/zend_qsort.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_QSORT_H
-#define ZEND_QSORT_H
-
-BEGIN_EXTERN_C()
-ZEND_API void zend_qsort(void *base, size_t nmemb, size_t siz, compare_func_t compare TSRMLS_DC);
-END_EXTERN_C()
-
-#endif /* ZEND_QSORT_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_sprintf.c b/Zend/zend_sprintf.c
deleted file mode 100644
index 126685a499..0000000000
--- a/Zend/zend_sprintf.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <stdio.h>
-
-#include "zend.h"
-
-#ifdef HAVE_STDARG_H
-# include <stdarg.h>
-#endif
-
-#if ZEND_BROKEN_SPRINTF
-int zend_sprintf(char *buffer, const char *format, ...)
-{
- va_list args;
-
- va_start(args, format);
- vsprintf(buffer, format, args);
- va_end(args);
-
- return strlen(buffer);
-}
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_stack.c b/Zend/zend_stack.c
deleted file mode 100644
index ac11a54305..0000000000
--- a/Zend/zend_stack.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-#include "zend_stack.h"
-
-ZEND_API int zend_stack_init(zend_stack *stack)
-{
- stack->top = 0;
- stack->elements = (void **) emalloc(sizeof(void **) * STACK_BLOCK_SIZE);
- if (!stack->elements) {
- return FAILURE;
- } else {
- stack->max = STACK_BLOCK_SIZE;
- return SUCCESS;
- }
-}
-
-ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size)
-{
- if (stack->top >= stack->max) { /* we need to allocate more memory */
- stack->elements = (void **) erealloc(stack->elements,
- (sizeof(void **) * (stack->max += STACK_BLOCK_SIZE)));
- if (!stack->elements) {
- return FAILURE;
- }
- }
- stack->elements[stack->top] = (void *) emalloc(size);
- memcpy(stack->elements[stack->top], element, size);
- return stack->top++;
-}
-
-
-ZEND_API int zend_stack_top(zend_stack *stack, void **element)
-{
- if (stack->top > 0) {
- *element = stack->elements[stack->top - 1];
- return SUCCESS;
- } else {
- *element = NULL;
- return FAILURE;
- }
-}
-
-
-ZEND_API int zend_stack_del_top(zend_stack *stack)
-{
- if (stack->top > 0) {
- efree(stack->elements[--stack->top]);
- }
- return SUCCESS;
-}
-
-
-ZEND_API int zend_stack_int_top(zend_stack *stack)
-{
- int *e;
-
- if (zend_stack_top(stack, (void **) &e) == FAILURE) {
- return FAILURE; /* this must be a negative number, since negative numbers can't be address numbers */
- } else {
- return *e;
- }
-}
-
-
-ZEND_API int zend_stack_is_empty(zend_stack *stack)
-{
- if (stack->top == 0) {
- return 1;
- } else {
- return 0;
- }
-}
-
-
-ZEND_API int zend_stack_destroy(zend_stack *stack)
-{
- register int i;
-
- for (i = 0; i < stack->top; i++) {
- efree(stack->elements[i]);
- }
-
- if (stack->elements) {
- efree(stack->elements);
- }
- return SUCCESS;
-}
-
-
-ZEND_API void **zend_stack_base(zend_stack *stack)
-{
- return stack->elements;
-}
-
-
-ZEND_API int zend_stack_count(zend_stack *stack)
-{
- return stack->top;
-}
-
-
-ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element))
-{
- int i;
-
- switch (type) {
- case ZEND_STACK_APPLY_TOPDOWN:
- for (i=stack->top-1; i>=0; i--) {
- if (apply_function(stack->elements[i])) {
- break;
- }
- }
- break;
- case ZEND_STACK_APPLY_BOTTOMUP:
- for (i=0; i<stack->top; i++) {
- if (apply_function(stack->elements[i])) {
- break;
- }
- }
- break;
- }
-}
-
-
-ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg)
-{
- int i;
-
- switch (type) {
- case ZEND_STACK_APPLY_TOPDOWN:
- for (i=stack->top-1; i>=0; i--) {
- if (apply_function(stack->elements[i], arg)) {
- break;
- }
- }
- break;
- case ZEND_STACK_APPLY_BOTTOMUP:
- for (i=0; i<stack->top; i++) {
- if (apply_function(stack->elements[i], arg)) {
- break;
- }
- }
- break;
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_stack.h b/Zend/zend_stack.h
deleted file mode 100644
index d7ea084bc2..0000000000
--- a/Zend/zend_stack.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_STACK_H
-#define ZEND_STACK_H
-
-typedef struct _zend_stack {
- int top, max;
- void **elements;
-} zend_stack;
-
-
-#define STACK_BLOCK_SIZE 64
-
-ZEND_API int zend_stack_init(zend_stack *stack);
-ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size);
-ZEND_API int zend_stack_top(zend_stack *stack, void **element);
-ZEND_API int zend_stack_del_top(zend_stack *stack);
-ZEND_API int zend_stack_int_top(zend_stack *stack);
-ZEND_API int zend_stack_is_empty(zend_stack *stack);
-ZEND_API int zend_stack_destroy(zend_stack *stack);
-ZEND_API void **zend_stack_base(zend_stack *stack);
-ZEND_API int zend_stack_count(zend_stack *stack);
-ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element));
-ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg);
-
-#define ZEND_STACK_APPLY_TOPDOWN 1
-#define ZEND_STACK_APPLY_BOTTOMUP 2
-
-#endif /* ZEND_STACK_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_static_allocator.c b/Zend/zend_static_allocator.c
deleted file mode 100644
index f49de8624b..0000000000
--- a/Zend/zend_static_allocator.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend_static_allocator.h"
-
-/* Not checking emalloc() and erealloc() return values as they are supposed to bailout */
-
-inline static void block_init(Block *block, zend_uint block_size)
-{
- block->pos = block->bp = (char *) emalloc(block_size);
- block->end = block->bp + block_size;
-}
-
-inline static char *block_allocate(Block *block, zend_uint size)
-{
- char *retval = block->pos;
- if ((block->pos += size) >= block->end) {
- return (char *)NULL;
- }
- return retval;
-}
-
-inline static void block_destroy(Block *block)
-{
- efree(block->bp);
-}
-
-void static_allocator_init(StaticAllocator *sa)
-{
- sa->Blocks = (Block *) emalloc(sizeof(Block));
- block_init(sa->Blocks, ALLOCATOR_BLOCK_SIZE);
- sa->num_blocks = 1;
- sa->current_block = 0;
-}
-
-char *static_allocator_allocate(StaticAllocator *sa, zend_uint size)
-{
- char *retval;
-
- retval = block_allocate(&sa->Blocks[sa->current_block], size);
- if (retval) {
- return retval;
- }
- sa->Blocks = (Block *) erealloc(sa->Blocks, ++sa->num_blocks);
- sa->current_block++;
- block_init(&sa->Blocks[sa->current_block], (size > ALLOCATOR_BLOCK_SIZE) ? size : ALLOCATOR_BLOCK_SIZE);
- retval = block_allocate(&sa->Blocks[sa->current_block], size);
- return retval;
-}
-
-void static_allocator_destroy(StaticAllocator *sa)
-{
- zend_uint i;
-
- for (i=0; i<sa->num_blocks; i++) {
- block_free(&sa->Blocks[i]);
- }
- efree(sa->Blocks);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_static_allocator.h b/Zend/zend_static_allocator.h
deleted file mode 100644
index 8e98cdf587..0000000000
--- a/Zend/zend_static_allocator.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_STATIC_ALLOCATOR_H
-#define ZEND_STATIC_ALLOCATOR_H
-
-#define ALLOCATOR_BLOCK_SIZE 400000
-
-/* Temporary */
-typedef unsigned int zend_uint;
-#define emalloc(s) malloc(s)
-#define efree(p) free(p)
-
-typedef struct _Block {
- char *bp;
- char *pos;
- char *end;
-} Block;
-
-typedef struct _StaticAllocator {
- Block *Blocks;
- zend_uint num_blocks;
- zend_uint current_block;
-} StaticAllocator;
-
-void static_allocator_init(StaticAllocator *sa);
-char *static_allocator_allocate(StaticAllocator *sa, zend_uint size);
-void static_allocator_destroy(StaticAllocator *sa);
-
-#endif /* ZEND_STATIC_ALLOCATOR_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c
deleted file mode 100644
index f13b0359e6..0000000000
--- a/Zend/zend_stream.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-
-#include "zend.h"
-#include "zend_compile.h"
-
-ZEND_DLIMPORT int isatty(int fd);
-
-static size_t zend_stream_stdio_reader(void *handle, char *buf, size_t len TSRMLS_DC)
-{
- return fread(buf, 1, len, (FILE*)handle);
-}
-
-static void zend_stream_stdio_closer(void *handle TSRMLS_DC)
-{
- if ((FILE*)handle != stdin)
- fclose((FILE*)handle);
-}
-
-int zend_stream_open(const char *filename, zend_file_handle *handle TSRMLS_DC)
-{
- if (zend_stream_open_function) {
- return zend_stream_open_function(filename, handle TSRMLS_CC);
- }
- handle->type = ZEND_HANDLE_FP;
- handle->opened_path = NULL;
- handle->handle.fp = zend_fopen(filename, &handle->opened_path);
- handle->filename = (char *)filename;
- handle->free_filename = 0;
-
- return (handle->handle.fp) ? SUCCESS : FAILURE;
-}
-
-int zend_stream_fixup(zend_file_handle *file_handle TSRMLS_DC)
-{
- switch (file_handle->type) {
- case ZEND_HANDLE_FILENAME:
- if (FAILURE == zend_stream_open(file_handle->filename, file_handle TSRMLS_CC)) {
- return FAILURE;
- }
- break;
-
- case ZEND_HANDLE_FD:
- file_handle->handle.fp = fdopen(file_handle->handle.fd, "rb");
- file_handle->type = ZEND_HANDLE_FP;
- break;
-
- case ZEND_HANDLE_FP:
- file_handle->handle.fp = file_handle->handle.fp;
- break;
-
- case ZEND_HANDLE_STREAM:
- /* nothing to do */
- return SUCCESS;
-
- default:
- return FAILURE;
- }
- if (file_handle->type == ZEND_HANDLE_FP) {
- if (!file_handle->handle.fp) {
- return FAILURE;
- }
-
- /* promote to stream */
- file_handle->handle.stream.handle = file_handle->handle.fp;
- file_handle->handle.stream.reader = zend_stream_stdio_reader;
- file_handle->handle.stream.closer = zend_stream_stdio_closer;
- file_handle->type = ZEND_HANDLE_STREAM;
-
- file_handle->handle.stream.interactive = isatty(fileno((FILE *)file_handle->handle.stream.handle));
- }
- return SUCCESS;
-}
-
-size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC)
-{
- if (file_handle->handle.stream.interactive) {
- int c = '*', n;
-
- for ( n = 0; n < len && (c = zend_stream_getc( file_handle TSRMLS_CC)) != EOF && c != '\n'; ++n )
- buf[n] = (char) c;
- if ( c == '\n' )
- buf[n++] = (char) c;
-
- return n;
- }
- return file_handle->handle.stream.reader(file_handle->handle.stream.handle, buf, len TSRMLS_CC);
-}
-
-int zend_stream_getc(zend_file_handle *file_handle TSRMLS_DC)
-{
- char buf;
-
- if (file_handle->handle.stream.reader(file_handle->handle.stream.handle, &buf, sizeof(buf) TSRMLS_CC)) {
- return (int)buf;
- }
- return EOF;
-}
-
-int zend_stream_ferror(zend_file_handle *file_handle TSRMLS_DC)
-{
- return 0;
-}
-
-
diff --git a/Zend/zend_stream.h b/Zend/zend_stream.h
deleted file mode 100644
index 130793287c..0000000000
--- a/Zend/zend_stream.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_STREAM_H
-#define ZEND_STREAM_H
-
-/* Lightweight stream implementation for the ZE scanners.
- * These functions are private to the engine.
- * */
-
-typedef size_t (*zend_stream_reader_t)(void *handle, char *buf, size_t len TSRMLS_DC);
-typedef void (*zend_stream_closer_t)(void *handle TSRMLS_DC);
-
-typedef struct _zend_stream {
- void *handle;
- zend_stream_reader_t reader;
- zend_stream_closer_t closer;
- int interactive;
-} zend_stream;
-
-typedef struct _zend_file_handle {
- zend_uchar type;
- char *filename;
- char *opened_path;
- union {
- int fd;
- FILE *fp;
- zend_stream stream;
- } handle;
- zend_bool free_filename;
-} zend_file_handle;
-
-int zend_stream_open(const char *filename, zend_file_handle *handle TSRMLS_DC);
-int zend_stream_ferror(zend_file_handle *file_handle TSRMLS_DC);
-int zend_stream_getc(zend_file_handle *file_handle TSRMLS_DC);
-size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC);
-int zend_stream_fixup(zend_file_handle *file_handle TSRMLS_DC);
-
-#define zend_stream_close(handle) zend_file_handle_dtor((handle))
-
-#endif
-
diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c
deleted file mode 100644
index a47dcf4fc5..0000000000
--- a/Zend/zend_ts_hash.c
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Harald Radi <harald.radi@nme.at> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend_ts_hash.h"
-
-/* ts management functions */
-static void begin_read(TsHashTable *ht)
-{
-#ifdef ZTS
- tsrm_mutex_lock(ht->mx_reader);
- if ((++(ht->reader)) == 1) {
- tsrm_mutex_lock(ht->mx_writer);
- }
- tsrm_mutex_unlock(ht->mx_reader);
-#endif
-}
-
-static void end_read(TsHashTable *ht)
-{
-#ifdef ZTS
- tsrm_mutex_lock(ht->mx_reader);
- if ((--(ht->reader)) == 0) {
- tsrm_mutex_unlock(ht->mx_writer);
- }
- tsrm_mutex_unlock(ht->mx_reader);
-#endif
-}
-
-static void begin_write(TsHashTable *ht)
-{
-#ifdef ZTS
- tsrm_mutex_lock(ht->mx_writer);
-#endif
-}
-
-static void end_write(TsHashTable *ht)
-{
-#ifdef ZTS
- tsrm_mutex_unlock(ht->mx_writer);
-#endif
-}
-
-/* delegates */
-ZEND_API int zend_ts_hash_init(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent)
-{
-#ifdef ZTS
- ht->mx_reader = tsrm_mutex_alloc();
- ht->mx_writer = tsrm_mutex_alloc();
- ht->reader = 0;
-#endif
- return zend_hash_init(TS_HASH(ht), nSize, pHashFunction, pDestructor, persistent);
-}
-
-ZEND_API int zend_ts_hash_init_ex(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection)
-{
-#ifdef ZTS
- ht->mx_reader = tsrm_mutex_alloc();
- ht->mx_writer = tsrm_mutex_alloc();
- ht->reader = 0;
-#endif
- return zend_hash_init_ex(TS_HASH(ht), nSize, pHashFunction, pDestructor, persistent, bApplyProtection);
-}
-
-ZEND_API void zend_ts_hash_destroy(TsHashTable *ht)
-{
-#ifdef ZTS
- tsrm_mutex_free(ht->mx_reader);
- tsrm_mutex_free(ht->mx_writer);
-#endif
- zend_hash_destroy(TS_HASH(ht));
-}
-
-ZEND_API void zend_ts_hash_clean(TsHashTable *ht)
-{
- ht->reader = 0;
- zend_hash_clean(TS_HASH(ht));
-}
-
-ZEND_API int zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag)
-{
- int retval;
-
- begin_write(ht);
- retval = zend_hash_add_or_update(TS_HASH(ht), arKey, nKeyLength, pData, nDataSize, pDest, flag);
- end_write(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag)
-{
- int retval;
-
- begin_write(ht);
- retval = zend_hash_quick_add_or_update(TS_HASH(ht), arKey, nKeyLength, h, pData, nDataSize, pDest, flag);
- end_write(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag)
-{
- int retval;
-
- begin_write(ht);
- retval = zend_hash_index_update_or_next_insert(TS_HASH(ht), h, pData, nDataSize, pDest, flag);
- end_write(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint nKeyLength)
-{
- int retval;
-
- begin_write(ht);
- retval = zend_hash_add_empty_element(TS_HASH(ht), arKey, nKeyLength);
- end_write(ht);
-
- return retval;
-}
-
-ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht)
-{
-#ifdef ZTS
- tsrm_mutex_free(ht->mx_reader);
- tsrm_mutex_free(ht->mx_reader);
-#endif
- zend_hash_graceful_destroy(TS_HASH(ht));
-}
-
-ZEND_API void zend_ts_hash_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC)
-{
- begin_write(ht);
- zend_hash_apply(TS_HASH(ht), apply_func TSRMLS_CC);
- end_write(ht);
-}
-
-ZEND_API void zend_ts_hash_apply_with_argument(TsHashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC)
-{
- begin_write(ht);
- zend_hash_apply_with_argument(TS_HASH(ht), apply_func, argument TSRMLS_CC);
- end_write(ht);
-}
-
-ZEND_API void zend_ts_hash_apply_with_arguments(TsHashTable *ht, apply_func_args_t apply_func, int num_args, ...)
-{
- va_list args;
-
- va_start(args, num_args);
- begin_write(ht);
- zend_hash_apply_with_arguments(TS_HASH(ht), apply_func, num_args, args);
- end_write(ht);
- va_end(args);
-}
-
-ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC)
-{
- begin_write(ht);
- zend_hash_reverse_apply(TS_HASH(ht), apply_func TSRMLS_CC);
- end_write(ht);
-}
-
-ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag)
-{
- int retval;
-
- begin_write(ht);
- retval = zend_hash_del_key_or_index(TS_HASH(ht), arKey, nKeyLength, h, flag);
- end_write(ht);
-
- return retval;
-}
-
-ZEND_API ulong zend_ts_get_hash_value(TsHashTable *ht, char *arKey, uint nKeyLength)
-{
- ulong retval;
-
- begin_read(ht);
- retval = zend_get_hash_value(arKey, nKeyLength);
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData)
-{
- int retval;
-
- begin_read(ht);
- retval = zend_hash_find(TS_HASH(ht), arKey, nKeyLength, pData);
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData)
-{
- int retval;
-
- begin_read(ht);
- retval = zend_hash_quick_find(TS_HASH(ht), arKey, nKeyLength, h, pData);
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, ulong h, void **pData)
-{
- int retval;
-
- begin_read(ht);
- retval = zend_hash_index_find(TS_HASH(ht), h, pData);
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, uint nKeyLength)
-{
- int retval;
-
- begin_read(ht);
- retval = zend_hash_exists(TS_HASH(ht), arKey, nKeyLength);
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, ulong h)
-{
- int retval;
-
- begin_read(ht);
- retval = zend_hash_index_exists(TS_HASH(ht), h);
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size)
-{
- begin_read(source);
- begin_write(target);
- zend_hash_copy(TS_HASH(target), TS_HASH(source), pCopyConstructor, tmp, size);
- end_write(target);
- end_read(source);
-}
-
-ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite)
-{
- begin_read(source);
- begin_write(target);
- zend_hash_merge(TS_HASH(target), TS_HASH(source), pCopyConstructor, tmp, size, overwrite);
- end_write(target);
- end_read(source);
-}
-
-ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam)
-{
- begin_read(source);
- begin_write(target);
- zend_hash_merge_ex(TS_HASH(target), TS_HASH(source), pCopyConstructor, size, pMergeSource, pParam);
- end_write(target);
- end_read(source);
-}
-
-ZEND_API int zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC)
-{
- int retval;
-
- begin_write(ht);
- retval = zend_hash_sort(TS_HASH(ht), sort_func, compare_func, renumber TSRMLS_CC);
- end_write(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC)
-{
- int retval;
-
- begin_read(ht1);
- begin_read(ht2);
- retval = zend_hash_compare(TS_HASH(ht1), TS_HASH(ht2), compar, ordered TSRMLS_CC);
- end_read(ht2);
- end_read(ht1);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_minmax(TsHashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC)
-{
- int retval;
-
- begin_read(ht);
- retval = zend_hash_minmax(TS_HASH(ht), compar, flag, pData TSRMLS_CC);
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht)
-{
- int retval;
-
- begin_read(ht);
- retval = zend_hash_num_elements(TS_HASH(ht));
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_rehash(TsHashTable *ht)
-{
- int retval;
-
- begin_write(ht);
- retval = zend_hash_rehash(TS_HASH(ht));
- end_write(ht);
-
- return retval;
-}
-
-#if ZEND_DEBUG
-void zend_ts_hash_display_pListTail(TsHashTable *ht)
-{
- begin_read(ht);
- zend_hash_display_pListTail(TS_HASH(ht));
- end_read(ht);
-}
-
-void zend_ts_hash_display(TsHashTable *ht)
-{
- begin_read(ht);
- zend_hash_display(TS_HASH(ht));
- end_read(ht);
-}
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_ts_hash.h b/Zend/zend_ts_hash.h
deleted file mode 100644
index 736d214f88..0000000000
--- a/Zend/zend_ts_hash.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Harald Radi <harald.radi@nme.at> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_TS_HASH_H
-#define ZEND_TS_HASH_H
-
-#include "zend.h"
-
-typedef struct _zend_ts_hashtable {
- HashTable hash;
- zend_uint reader;
-#ifdef ZTS
- MUTEX_T mx_reader;
- MUTEX_T mx_writer;
-#endif
-} TsHashTable;
-
-BEGIN_EXTERN_C()
-
-#define TS_HASH(table) (&(table->hash))
-
-/* startup/shutdown */
-ZEND_API int zend_ts_hash_init(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent);
-ZEND_API int zend_ts_hash_init_ex(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection);
-ZEND_API void zend_ts_hash_destroy(TsHashTable *ht);
-ZEND_API void zend_ts_hash_clean(TsHashTable *ht);
-
-/* additions/updates/changes */
-ZEND_API int zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag);
-#define zend_ts_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
- zend_ts_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE)
-#define zend_ts_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
- zend_ts_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD)
-
-ZEND_API int zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag);
-#define zend_ts_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
- zend_ts_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE)
-#define zend_ts_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
- zend_ts_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_ADD)
-
-ZEND_API int zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag);
-#define zend_ts_hash_index_update(ht, h, pData, nDataSize, pDest) \
- zend_ts_hash_index_update_or_next_insert(ht, h, pData, nDataSize, pDest, HASH_UPDATE)
-#define zend_ts_hash_next_index_insert(ht, pData, nDataSize, pDest) \
- zend_ts_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT)
-
-ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint nKeyLength);
-
-ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht);
-ZEND_API void zend_ts_hash_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC);
-ZEND_API void zend_ts_hash_apply_with_argument(TsHashTable *ht, apply_func_arg_t apply_func, void * TSRMLS_DC);
-ZEND_API void zend_ts_hash_apply_with_arguments(TsHashTable *ht, apply_func_args_t apply_func, int, ...);
-
-ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC);
-
-
-/* Deletes */
-ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag);
-#define zend_ts_hash_del(ht, arKey, nKeyLength) \
- zend_ts_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY)
-#define zend_ts_hash_index_del(ht, h) \
- zend_ts_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX)
-
-ZEND_API ulong zend_ts_get_hash_value(TsHashTable *ht, char *arKey, uint nKeyLength);
-
-/* Data retreival */
-ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData);
-ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData);
-ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, ulong h, void **pData);
-
-/* Misc */
-ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, uint nKeyLength);
-ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, ulong h);
-
-/* Copying, merging and sorting */
-ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size);
-ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite);
-ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam);
-ZEND_API int zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC);
-ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC);
-ZEND_API int zend_ts_hash_minmax(TsHashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC);
-
-ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht);
-
-ZEND_API int zend_ts_hash_rehash(TsHashTable *ht);
-
-ZEND_API ulong zend_ts_hash_func(char *arKey, uint nKeyLength);
-
-#if ZEND_DEBUG
-/* debug */
-void zend_ts_hash_display_pListTail(TsHashTable *ht);
-void zend_ts_hash_display(TsHashTable *ht);
-#endif
-
-END_EXTERN_C()
-
-#define ZEND_TS_INIT_SYMTABLE(ht) \
- ZEND_TS_INIT_SYMTABLE_EX(ht, 2, 0)
-
-#define ZEND_TS_INIT_SYMTABLE_EX(ht, n, persistent) \
- zend_ts_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, persistent)
-
-#endif /* ZEND_HASH_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_types.h b/Zend/zend_types.h
deleted file mode 100644
index 4a895115a8..0000000000
--- a/Zend/zend_types.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_TYPES_H
-#define ZEND_TYPES_H
-
-typedef unsigned char zend_bool;
-typedef unsigned char zend_uchar;
-typedef unsigned int zend_uint;
-typedef unsigned long zend_ulong;
-typedef unsigned short zend_ushort;
-
-#endif /* ZEND_TYPES_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
deleted file mode 100644
index a3856953de..0000000000
--- a/Zend/zend_variables.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <stdio.h>
-#include "zend.h"
-#include "zend_API.h"
-#include "zend_globals.h"
-#include "zend_constants.h"
-#include "zend_list.h"
-
-ZEND_API char *empty_string = ""; /* in order to save emalloc() and efree() time for
- * empty strings (usually used to denote empty
- * return values in failed functions).
- * The macro STR_FREE() will not efree() it.
- */
-
-
-ZEND_API void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC)
-{
- if (zvalue->type==IS_LONG) {
- return;
- }
- switch (zvalue->type & ~IS_CONSTANT_INDEX) {
- case IS_STRING:
- case IS_CONSTANT:
- CHECK_ZVAL_STRING_REL(zvalue);
- STR_FREE_REL(zvalue->value.str.val);
- break;
- case IS_ARRAY:
- case IS_CONSTANT_ARRAY: {
- TSRMLS_FETCH();
-
- if (zvalue->value.ht && (zvalue->value.ht != &EG(symbol_table))) {
- zend_hash_destroy(zvalue->value.ht);
- FREE_HASHTABLE(zvalue->value.ht);
- }
- }
- break;
- case IS_OBJECT:
- {
- TSRMLS_FETCH();
-
- Z_OBJ_HT_P(zvalue)->del_ref(zvalue TSRMLS_CC);
- }
- break;
- case IS_RESOURCE:
- {
- TSRMLS_FETCH();
-
- /* destroy resource */
- zend_list_delete(zvalue->value.lval);
- }
- break;
- case IS_LONG:
- case IS_DOUBLE:
- case IS_BOOL:
- case IS_NULL:
- default:
- return;
- break;
- }
-}
-
-
-ZEND_API void zval_add_ref(zval **p)
-{
- (*p)->refcount++;
-}
-
-
-ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC)
-{
- switch (zvalue->type) {
- case IS_RESOURCE: {
- TSRMLS_FETCH();
-
- zend_list_addref(zvalue->value.lval);
- }
- break;
- case IS_BOOL:
- case IS_LONG:
- case IS_NULL:
- break;
- case IS_CONSTANT:
- case IS_STRING:
- if (zvalue->value.str.val) {
- if (zvalue->value.str.len==0) {
- zvalue->value.str.val = empty_string;
- return SUCCESS;
- }
- }
- CHECK_ZVAL_STRING_REL(zvalue);
- zvalue->value.str.val = (char *) estrndup_rel(zvalue->value.str.val, zvalue->value.str.len);
- break;
- case IS_ARRAY:
- case IS_CONSTANT_ARRAY: {
- zval *tmp;
- HashTable *original_ht = zvalue->value.ht;
- TSRMLS_FETCH();
-
- if (zvalue->value.ht == &EG(symbol_table)) {
- return SUCCESS; /* do nothing */
- }
- ALLOC_HASHTABLE_REL(zvalue->value.ht);
- zend_hash_init(zvalue->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(zvalue->value.ht, original_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
- }
- break;
- case IS_OBJECT:
- {
- TSRMLS_FETCH();
-
- if (EG(implicit_clone)) {
- zvalue->value.obj = zvalue->value.obj.handlers->clone_obj(zvalue TSRMLS_CC);
- } else {
- Z_OBJ_HT_P(zvalue)->add_ref(zvalue TSRMLS_CC);
- }
- }
- break;
- }
- return SUCCESS;
-}
-
-
-ZEND_API int zend_print_variable(zval *var)
-{
- return zend_print_zval(var, 0);
-}
-
-
-#if ZEND_DEBUG
-ZEND_API int _zval_copy_ctor_wrapper(zval *zvalue)
-{
- return zval_copy_ctor(zvalue);
-}
-
-
-ZEND_API void _zval_dtor_wrapper(zval *zvalue)
-{
- zval_dtor(zvalue);
-}
-
-
-
-ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr)
-{
- zval_ptr_dtor(zval_ptr);
-}
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h
deleted file mode 100644
index 37e6c2eaf0..0000000000
--- a/Zend/zend_variables.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_VARIABLES_H
-#define ZEND_VARIABLES_H
-
-
-ZEND_API int zend_print_variable(zval *var);
-
-BEGIN_EXTERN_C()
-ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC);
-ZEND_API void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC);
-ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC);
-#define zval_copy_ctor(zvalue) _zval_copy_ctor((zvalue) ZEND_FILE_LINE_CC)
-#define zval_dtor(zvalue) _zval_dtor((zvalue) ZEND_FILE_LINE_CC)
-#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
-
-#if ZEND_DEBUG
-ZEND_API int _zval_copy_ctor_wrapper(zval *zvalue);
-ZEND_API void _zval_dtor_wrapper(zval *zvalue);
-ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr);
-#define zval_copy_ctor_wrapper _zval_copy_ctor_wrapper
-#define zval_dtor_wrapper _zval_dtor_wrapper
-#define zval_ptr_dtor_wrapper _zval_ptr_dtor_wrapper
-#else
-#define zval_copy_ctor_wrapper _zval_copy_ctor
-#define zval_dtor_wrapper _zval_dtor
-#define zval_ptr_dtor_wrapper _zval_ptr_dtor
-#endif
-
-END_EXTERN_C()
-
-
-ZEND_API void zval_add_ref(zval **p);
-
-#define ZVAL_DESTRUCTOR (void (*)(void *)) zval_dtor_wrapper
-#define ZVAL_PTR_DTOR (void (*)(void *)) zval_ptr_dtor_wrapper
-#define ZVAL_COPY_CTOR (void (*)(void *)) zval_copy_ctor_wrapper
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/acconfig.h.in b/acconfig.h.in
deleted file mode 100644
index f87979c2fd..0000000000
--- a/acconfig.h.in
+++ /dev/null
@@ -1 +0,0 @@
-/* Leave this file alone */
diff --git a/acinclude.m4 b/acinclude.m4
deleted file mode 100644
index 11ce6d7ae1..0000000000
--- a/acinclude.m4
+++ /dev/null
@@ -1,1802 +0,0 @@
-dnl $Id$
-dnl
-dnl This file contains local autoconf functions.
-
-dnl PHP_ADD_MAKEFILE_FRAGMENT([srcfile[, ext_srcdir[, ext_builddir]]])
-dnl
-dnl Processes a file called Makefile.frag in the source directory
-dnl of the most recently added extension. $(srcdir) and $(builddir)
-dnl are substituted with the proper paths. Can be used to supply
-dnl custom rules and/or additional targets.
-dnl
-AC_DEFUN([PHP_ADD_MAKEFILE_FRAGMENT],[
- ifelse($1,,src=$ext_srcdir/Makefile.frag,src=$1)
- ifelse($2,,ac_srcdir=$ext_srcdir,ac_srcdir=$2)
- ifelse($3,,ac_builddir=$ext_builddir,ac_builddir=$3)
- sed -e "s#\$(srcdir)#$ac_srcdir#g" -e "s#\$(builddir)#$ac_builddir#g" $src >> Makefile.fragments
-])
-
-
-dnl PHP_DEFINE(WHAT[, value])
-dnl
-dnl Creates builddir/include/what.h and in there #define WHAT value
-dnl
-AC_DEFUN([PHP_DEFINE],[
- [echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" > include/php_]translit($1,A-Z,a-z)[.h]
-])
-
-dnl PHP_INIT_BUILD_SYSTEM
-dnl
-AC_DEFUN([PHP_INIT_BUILD_SYSTEM],[
-test -d include || mkdir include
-> Makefile.objects
-> Makefile.fragments
-dnl We need to play tricks here to avoid matching the grep line itself
-pattern=define
-grep -E $pattern'.*include/php' $srcdir/configure|sed 's/.*>//'|xargs touch 2>/dev/null
-])
-
-dnl PHP_GEN_GLOBAL_MAKEFILE
-dnl
-dnl Generates the global makefile.
-dnl
-AC_DEFUN([PHP_GEN_GLOBAL_MAKEFILE],[
- cat >Makefile <<EOF
-srcdir = $abs_srcdir
-builddir = $abs_builddir
-top_srcdir = $abs_srcdir
-top_builddir = $abs_builddir
-EOF
- for i in $PHP_VAR_SUBST; do
- eval echo "$i = \$$i" >> Makefile
- done
-
- cat $abs_srcdir/Makefile.global Makefile.fragments Makefile.objects >> Makefile
-])
-
-dnl PHP_ADD_SOURCES(source-path, sources[, special-flags[, type]])
-dnl
-dnl Adds sources which are located relative to source-path to the
-dnl array of type type. Sources are processed with optional
-dnl special-flags which are passed to the compiler. Sources
-dnl can be either written in C or C++ (filenames shall end in .c
-dnl or .cpp, respectively).
-dnl
-dnl Note: If source-path begins with a "/", the "/" is removed and
-dnl the path is interpreted relative to the top build-directory.
-dnl
-dnl which array to append to?
-AC_DEFUN([PHP_ADD_SOURCES],[
- PHP_ADD_SOURCES_X($1, $2, $3, ifelse($4,cli,PHP_CLI_OBJS,ifelse($4,sapi,PHP_SAPI_OBJS,PHP_GLOBAL_OBJS)))
-])
-dnl
-dnl _PHP_ASSIGN_BUILD_VARS(type)
-dnl internal, don't use
-AC_DEFUN([_PHP_ASSIGN_BUILD_VARS],[
-ifelse($1,shared,[
- b_c_pre=$shared_c_pre
- b_cxx_pre=$shared_cxx_pre
- b_c_meta=$shared_c_meta
- b_cxx_meta=$shared_cxx_meta
- b_c_post=$shared_c_post
- b_cxx_post=$shared_cxx_post
-],[
- b_c_pre=$php_c_pre
- b_cxx_pre=$php_cxx_pre
- b_c_meta=$php_c_meta
- b_cxx_meta=$php_cxx_meta
- b_c_post=$php_c_post
- b_cxx_post=$php_cxx_post
-])dnl
- b_lo=[$]$1_lo
-])
-
-dnl PHP_ADD_SOURCES_X(source-path, sources[, special-flags[, target-var[, shared[, special-post-flags]]]])
-dnl
-dnl Additional to PHP_ADD_SOURCES (see above), this lets you set the
-dnl name of the array target-var directly, as well as whether
-dnl shared objects will be built from the sources. Should not be
-dnl used directly.
-dnl
-AC_DEFUN([PHP_ADD_SOURCES_X],[
-dnl relative to source- or build-directory?
-dnl ac_srcdir/ac_bdir include trailing slash
- case $1 in
- ""[)] ac_srcdir="$abs_srcdir/"; unset ac_bdir; ac_inc="-I. -I$abs_srcdir" ;;
- /*[)] ac_srcdir=`echo "$1"|cut -c 2-`"/"; ac_bdir=$ac_srcdir; ac_inc="-I$ac_bdir -I$abs_srcdir/$ac_bdir" ;;
- *[)] ac_srcdir="$abs_srcdir/$1/"; ac_bdir="$1/"; ac_inc="-I$ac_bdir -I$ac_srcdir" ;;
- esac
-
-dnl how to build .. shared or static?
- ifelse($5,yes,_PHP_ASSIGN_BUILD_VARS(shared),_PHP_ASSIGN_BUILD_VARS(php))
-
-dnl iterate over the sources
- old_IFS=[$]IFS
- for ac_src in $2; do
-
-dnl remove the suffix
- IFS=.
- set $ac_src
- ac_obj=[$]1
- IFS=$old_IFS
-
-dnl append to the array which has been dynamically chosen at m4 time
- $4="[$]$4 [$]ac_bdir[$]ac_obj.lo"
-
-dnl choose the right compiler/flags/etc. for the source-file
- case $ac_src in
- *.c[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
- *.cpp[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;;
- esac
-
-dnl create a rule for the object/source combo
- cat >>Makefile.objects<<EOF
-$ac_bdir[$]ac_obj.lo: $ac_srcdir[$]ac_src
- $ac_comp
-EOF
- done
-])
-
-dnl
-dnl Separator into the configure --help display.
-dnl
-AC_DEFUN([PHP_HELP_SEPARATOR],[
-AC_ARG_ENABLE([],[
-$1
-],[])
-])
-
-dnl
-dnl PHP_TARGET_RDYNAMIC
-dnl
-dnl Checks whether -rdynamic is supported by the compiler. This
-dnl is necessary for some targets to populate the global symbol
-dnl table. Otherwise, dynamic modules would not be able to resolve
-dnl PHP-related symbols.
-dnl
-dnl If successful, adds -rdynamic to PHP_LDFLAGS.
-dnl
-AC_DEFUN([PHP_TARGET_RDYNAMIC],[
- if test -n "$GCC"; then
- dnl we should use a PHP-specific macro here
- TSRM_CHECK_GCC_ARG(-rdynamic, gcc_rdynamic=yes)
- if test "$gcc_rdynamic" = "yes"; then
- PHP_LDFLAGS="$PHP_LDFLAGS -rdynamic"
- fi
- fi
-])
-
-AC_DEFUN([PHP_REMOVE_USR_LIB],[
- unset ac_new_flags
- for i in [$]$1; do
- case [$]i in
- -L/usr/lib|-L/usr/lib/) ;;
- *) ac_new_flags="[$]ac_new_flags [$]i" ;;
- esac
- done
- $1=[$]ac_new_flags
-])
-
-AC_DEFUN([PHP_SETUP_OPENSSL],[
- if test "$PHP_OPENSSL" = "yes"; then
- PHP_OPENSSL="/usr/local/ssl /usr/local /usr /usr/local/openssl"
- fi
-
- for i in $PHP_OPENSSL; do
- if test -r $i/include/openssl/evp.h; then
- OPENSSL_INCDIR=$i/include
- fi
- if test -r $i/lib/libssl.a -o -r $i/lib/libssl.$SHLIB_SUFFIX_NAME; then
- OPENSSL_LIBDIR=$i/lib
- fi
- done
-
- if test -z "$OPENSSL_INCDIR"; then
- AC_MSG_ERROR([Cannot find OpenSSL's <evp.h>])
- fi
-
- if test -z "$OPENSSL_LIBDIR"; then
- AC_MSG_ERROR([Cannot find OpenSSL's libraries])
- fi
-
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS=-I$OPENSSL_INCDIR
- AC_MSG_CHECKING([for OpenSSL version])
- AC_EGREP_CPP(yes,[
-#include <openssl/opensslv.h>
-#if OPENSSL_VERSION_NUMBER >= 0x0090600fL
- yes
-#endif
- ],[
- AC_MSG_RESULT([>= 0.9.6])
- ],[
- AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.])
- ])
- CPPFLAGS=$old_CPPFLAGS
-
- PHP_ADD_INCLUDE($OPENSSL_INCDIR)
- PHP_ADD_LIBPATH($OPENSSL_LIBDIR)
-
- PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [
- PHP_ADD_LIBRARY(crypto)
- ],[
- AC_MSG_ERROR([libcrypto not found!])
- ],[
- -L$OPENSSL_LIBDIR
- ])
-
- PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [
- PHP_ADD_LIBRARY(ssl)
- ],[
- AC_MSG_ERROR([libssl not found!])
- ],[
- -L$OPENSSL_LIBDIR
- ])
-
- OPENSSL_INCDIR_OPT=-I$OPENSSL_INCDIR
- AC_SUBST(OPENSSL_INCDIR_OPT)
-])
-
-dnl PHP_EVAL_LIBLINE(LINE, SHARED-LIBADD)
-dnl
-dnl Use this macro, if you need to add libraries and or library search
-dnl paths to the PHP build system which are only given in compiler
-dnl notation.
-dnl
-AC_DEFUN([PHP_EVAL_LIBLINE],[
- for ac_i in $1; do
- case $ac_i in
- -l*)
- ac_ii=`echo $ac_i|cut -c 3-`
- PHP_ADD_LIBRARY($ac_ii,1,$2)
- ;;
- -L*)
- ac_ii=`echo $ac_i|cut -c 3-`
- PHP_ADD_LIBPATH($ac_ii,$2)
- ;;
- esac
- done
-])
-
-dnl PHP_EVAL_INCLINE(LINE)
-dnl
-dnl Use this macro, if you need to add header search paths to the PHP
-dnl build system which are only given in compiler notation.
-dnl
-AC_DEFUN([PHP_EVAL_INCLINE],[
- for ac_i in $1; do
- case $ac_i in
- -I*)
- ac_ii=`echo $ac_i|cut -c 3-`
- PHP_ADD_INCLUDE($ac_ii)
- ;;
- esac
- done
-])
-
-AC_DEFUN([PHP_READDIR_R_TYPE],[
- dnl HAVE_READDIR_R is also defined by libmysql
- AC_CHECK_FUNC(readdir_r,ac_cv_func_readdir_r=yes,ac_cv_func_readdir=no)
- if test "$ac_cv_func_readdir_r" = "yes"; then
- AC_CACHE_CHECK(for type of readdir_r, ac_cv_what_readdir_r,[
- AC_TRY_RUN([
-#define _REENTRANT
-#include <sys/types.h>
-#include <dirent.h>
-
-#ifndef PATH_MAX
-#define PATH_MAX 1024
-#endif
-
-main() {
- DIR *dir;
- char entry[sizeof(struct dirent)+PATH_MAX];
- struct dirent *pentry = (struct dirent *) &entry;
-
- dir = opendir("/");
- if (!dir)
- exit(1);
- if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0)
- exit(0);
- exit(1);
-}
- ],[
- ac_cv_what_readdir_r=POSIX
- ],[
- AC_TRY_CPP([
-#define _REENTRANT
-#include <sys/types.h>
-#include <dirent.h>
-int readdir_r(DIR *, struct dirent *);
- ],[
- ac_cv_what_readdir_r=old-style
- ],[
- ac_cv_what_readdir_r=none
- ])
- ],[
- ac_cv_what_readdir_r=none
- ])
- ])
- case $ac_cv_what_readdir_r in
- POSIX)
- AC_DEFINE(HAVE_POSIX_READDIR_R,1,[whether you have POSIX readdir_r]);;
- old-style)
- AC_DEFINE(HAVE_OLD_READDIR_R,1,[whether you have old-style readdir_r]);;
- esac
- fi
-])
-
-AC_DEFUN([PHP_SHLIB_SUFFIX_NAME],[
- PHP_SUBST(SHLIB_SUFFIX_NAME)
- SHLIB_SUFFIX_NAME=so
- case $host_alias in
- *hpux*)
- SHLIB_SUFFIX_NAME=sl
- ;;
- *darwin*)
- SHLIB_SUFFIX_NAME=dylib
- ;;
- esac
-])
-
-AC_DEFUN([PHP_DEBUG_MACRO],[
- DEBUG_LOG=$1
- cat >$1 <<X
-CONFIGURE: $CONFIGURE_COMMAND
-CC: $CC
-CFLAGS: $CFLAGS
-CPPFLAGS: $CPPFLAGS
-CXX: $CXX
-CXXFLAGS: $CXXFLAGS
-INCLUDES: $INCLUDES
-LDFLAGS: $LDFLAGS
-LIBS: $LIBS
-DLIBS: $DLIBS
-SAPI: $PHP_SAPI
-PHP_RPATHS: $PHP_RPATHS
-uname -a: `uname -a`
-
-X
- cat >conftest.$ac_ext <<X
-main()
-{
- exit(0);
-}
-X
- (eval echo \"$ac_link\"; eval $ac_link && ./conftest) >>$1 2>&1
- rm -fr conftest*
-])
-
-AC_DEFUN([PHP_DOES_PWRITE_WORK],[
- AC_TRY_RUN([
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-$1
- main() {
- int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600);
-
- if (fd < 0) exit(1);
- if (pwrite(fd, "text", 4, 0) != 4) exit(1);
- /* Linux glibc breakage until 2.2.5 */
- if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) exit(1);
- exit(0);
- }
-
- ],[
- ac_cv_pwrite=yes
- ],[
- ac_cv_pwrite=no
- ],[
- ac_cv_pwrite=no
- ])
-])
-
-AC_DEFUN([PHP_DOES_PREAD_WORK],[
- echo test > conftest_in
- AC_TRY_RUN([
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-$1
- main() {
- char buf[3];
- int fd = open("conftest_in", O_RDONLY);
- if (fd < 0) exit(1);
- if (pread(fd, buf, 2, 0) != 2) exit(1);
- /* Linux glibc breakage until 2.2.5 */
- if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) exit(1);
- exit(0);
- }
- ],[
- ac_cv_pread=yes
- ],[
- ac_cv_pread=no
- ],[
- ac_cv_pread=no
- ])
- rm -f conftest_in
-])
-
-AC_DEFUN([PHP_PWRITE_TEST],[
- AC_CACHE_CHECK(whether pwrite works,ac_cv_pwrite,[
- PHP_DOES_PWRITE_WORK
- if test "$ac_cv_pwrite" = "no"; then
- PHP_DOES_PWRITE_WORK([ssize_t pwrite(int, void *, size_t, off64_t);])
- if test "$ac_cv_pwrite" = "yes"; then
- ac_cv_pwrite=64
- fi
- fi
- ])
-
- if test "$ac_cv_pwrite" != "no"; then
- AC_DEFINE(HAVE_PWRITE, 1, [ ])
- if test "$ac_cv_pwrite" = "64"; then
- AC_DEFINE(PHP_PWRITE_64, 1, [whether pwrite64 is default])
- fi
- fi
-])
-
-AC_DEFUN([PHP_PREAD_TEST],[
- AC_CACHE_CHECK(whether pread works,ac_cv_pread,[
- PHP_DOES_PREAD_WORK
- if test "$ac_cv_pread" = "no"; then
- PHP_DOES_PREAD_WORK([ssize_t pread(int, void *, size_t, off64_t);])
- if test "$ac_cv_pread" = "yes"; then
- ac_cv_pread=64
- fi
- fi
- ])
-
- if test "$ac_cv_pread" != "no"; then
- AC_DEFINE(HAVE_PREAD, 1, [ ])
- if test "$ac_cv_pread" = "64"; then
- AC_DEFINE(PHP_PREAD_64, 1, [whether pread64 is default])
- fi
- fi
-])
-
-AC_DEFUN([PHP_MISSING_TIME_R_DECL],[
- AC_MSG_CHECKING([for missing declarations of reentrant functions])
- AC_TRY_COMPILE([#include <time.h>],[struct tm *(*func)() = localtime_r],[
- :
- ],[
- AC_DEFINE(MISSING_LOCALTIME_R_DECL,1,[Whether localtime_r is declared])
- ])
- AC_TRY_COMPILE([#include <time.h>],[struct tm *(*func)() = gmtime_r],[
- :
- ],[
- AC_DEFINE(MISSING_GMTIME_R_DECL,1,[Whether gmtime_r is declared])
- ])
- AC_TRY_COMPILE([#include <time.h>],[char *(*func)() = asctime_r],[
- :
- ],[
- AC_DEFINE(MISSING_ASCTIME_R_DECL,1,[Whether asctime_r is declared])
- ])
- AC_TRY_COMPILE([#include <time.h>],[char *(*func)() = ctime_r],[
- :
- ],[
- AC_DEFINE(MISSING_CTIME_R_DECL,1,[Whether ctime_r is declared])
- ])
- AC_TRY_COMPILE([#include <string.h>],[char *(*func)() = strtok_r],[
- :
- ],[
- AC_DEFINE(MISSING_STRTOK_R_DECL,1,[Whether strtok_r is declared])
- ])
- AC_MSG_RESULT([done])
-])
-
-dnl
-dnl PHP_LIBGCC_LIBPATH(gcc)
-dnl Stores the location of libgcc in libgcc_libpath
-dnl
-AC_DEFUN([PHP_LIBGCC_LIBPATH],[
- changequote({,})
- libgcc_libpath=`$1 --print-libgcc-file-name|sed 's%/*[^/][^/]*$%%'`
- changequote([,])
-])
-
-AC_DEFUN([PHP_ARG_ANALYZE_EX],[
-ext_output="yes, shared"
-ext_shared=yes
-case [$]$1 in
-shared,*)
- $1=`echo "[$]$1"|sed 's/^shared,//'`
- ;;
-shared)
- $1=yes
- ;;
-no)
- ext_output=no
- ext_shared=no
- ;;
-*)
- ext_output=yes
- ext_shared=no
- ;;
-esac
-
-PHP_ALWAYS_SHARED([$1])
-])
-
-AC_DEFUN([PHP_ARG_ANALYZE],[
-ifelse([$3],yes,[PHP_ARG_ANALYZE_EX([$1])],[ext_output=ifelse([$]$1,,no,[$]$1)])
-ifelse([$2],,,[AC_MSG_RESULT([$ext_output])])
-])
-
-dnl
-dnl PHP_ARG_WITH(arg-name, check message, help text[, default-val[, extension-or-not]])
-dnl Sets PHP_ARG_NAME either to the user value or to the default value.
-dnl default-val defaults to no. This will also set the variable ext_shared,
-dnl and will overwrite any previous variable of that name.
-dnl If extension-or-not is yes (default), then do the ENABLE_ALL check and run
-dnl the PHP_ARG_ANALYZE_EX.
-dnl
-AC_DEFUN([PHP_ARG_WITH],[
-PHP_REAL_ARG_WITH([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z0-9-,A-Z0-9_),[ifelse($5,,yes,$5)])
-])
-
-AC_DEFUN([PHP_REAL_ARG_WITH],[
-ifelse([$2],,,[AC_MSG_CHECKING([$2])])
-AC_ARG_WITH($1,[$3],$5=[$]withval,
-[
- $5=ifelse($4,,no,$4)
-
- if test "$PHP_ENABLE_ALL" && test "$6" = "yes"; then
- $5=$PHP_ENABLE_ALL
- fi
-])
-PHP_ARG_ANALYZE($5,[$2],$6)
-])
-
-dnl
-dnl PHP_ARG_ENABLE(arg-name, check message, help text[, default-val[, extension-or-not]])
-dnl Sets PHP_ARG_NAME either to the user value or to the default value.
-dnl default-val defaults to no. This will also set the variable ext_shared,
-dnl and will overwrite any previous variable of that name.
-dnl If extension-or-not is yes (default), then do the ENABLE_ALL check and run
-dnl the PHP_ARG_ANALYZE_EX.
-dnl
-AC_DEFUN([PHP_ARG_ENABLE],[
-PHP_REAL_ARG_ENABLE([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z-,A-Z_),[ifelse($5,,yes,$5)])
-])
-
-AC_DEFUN([PHP_REAL_ARG_ENABLE],[
-ifelse([$2],,,[AC_MSG_CHECKING([$2])])
-AC_ARG_ENABLE($1,[$3],$5=[$]enableval,
-[
- $5=ifelse($4,,no,$4)
-
- if test "$PHP_ENABLE_ALL" && test "$6" = "yes"; then
- $5=$PHP_ENABLE_ALL
- fi
-])
-PHP_ARG_ANALYZE($5,[$2],$6)
-])
-
-AC_DEFUN([PHP_ARG_BUNDLE],[
-PHP_REAL_ARG_BUNDLE([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z-,A-Z_),[ifelse($5,,yes,$5)])
-])
-
-AC_DEFUN([PHP_REAL_ARG_BUNDLE],[
-ifelse([$2],,,[AC_MSG_CHECKING([$2])])
-AC_ARG_WITH($1,[$3],$5=[$]withval,
-[
- $5=ifelse($4,,no,$4)
-
- if test "$PHP_BUNDLE_ALL" && test "$6" = "yes"; then
- $5=$PHP_BUNDLE_ALL
- fi
-])
-PHP_ARG_ANALYZE($5,[$2],$6)
-])
-
-AC_DEFUN([PHP_MODULE_PTR],[
- EXTRA_MODULE_PTRS="$EXTRA_MODULE_PTRS $1,"
-])
-
-AC_DEFUN([PHP_CONFIG_NICE],[
- test -f $1 && mv $1 $1.old
- rm -f $1.old
- cat >$1<<EOF
-#! /bin/sh
-#
-# Created by configure
-
-EOF
-
- for var in CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LIBS CC CXX; do
- eval val=\$$var
- if test -n "$val"; then
- echo "$var='$val' \\" >> $1
- fi
- done
-
- for arg in [$]0 "[$]@"; do
- echo "'[$]arg' \\" >> $1
- done
- echo '"[$]@"' >> $1
- chmod +x $1
-])
-
-AC_DEFUN([PHP_TIME_R_TYPE],[
-AC_CACHE_CHECK(for type of reentrant time-related functions, ac_cv_time_r_type,[
-AC_TRY_RUN([
-#include <time.h>
-
-main() {
-char buf[27];
-struct tm t;
-time_t old = 0;
-int r, s;
-
-s = gmtime_r(&old, &t);
-r = (int) asctime_r(&t, buf, 26);
-if (r == s && s == 0) return (0);
-return (1);
-}
-],[
- ac_cv_time_r_type=hpux
-],[
- AC_TRY_RUN([
-#include <time.h>
-main() {
- struct tm t, *s;
- time_t old = 0;
- char buf[27], *p;
-
- s = gmtime_r(&old, &t);
- p = asctime_r(&t, buf, 26);
- if (p == buf && s == &t) return (0);
- return (1);
-}
- ],[
- ac_cv_time_r_type=irix
- ],[
- ac_cv_time_r_type=POSIX
- ])
-],[
- ac_cv_time_r_type=POSIX
-])
-])
- case $ac_cv_time_r_type in
- hpux) AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-UX 10.x]) ;;
- irix) AC_DEFINE(PHP_IRIX_TIME_R,1,[Whether you have IRIX-style functions]) ;;
- esac
-])
-
-AC_DEFUN([PHP_SUBST],[
- PHP_VAR_SUBST="$PHP_VAR_SUBST $1"
-])
-
-AC_DEFUN([PHP_SUBST_OLD],[
- PHP_SUBST($1)
- AC_SUBST($1)
-])
-
-AC_DEFUN([PHP_TM_GMTOFF],[
-AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;],
- ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])
-
-if test "$ac_cv_struct_tm_gmtoff" = yes; then
- AC_DEFINE(HAVE_TM_GMTOFF,1,[whether you have tm_gmtoff in struct tm])
-fi
-])
-
-dnl PHP_CONFIGURE_PART(MESSAGE)
-dnl Idea borrowed from mm
-AC_DEFUN([PHP_CONFIGURE_PART],[
- AC_MSG_RESULT()
- AC_MSG_RESULT([${T_MD}$1${T_ME}])
-])
-
-AC_DEFUN([PHP_PROG_SENDMAIL],[
-PHP_ALT_PATH=/usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib
-AC_PATH_PROG(PROG_SENDMAIL, sendmail,[], $PATH:$PHP_ALT_PATH)
-if test -n "$PROG_SENDMAIL"; then
- AC_DEFINE(HAVE_SENDMAIL,1,[whether you have sendmail])
-fi
-])
-
-AC_DEFUN([PHP_RUNPATH_SWITCH],[
-dnl check for -R, etc. switch
-AC_MSG_CHECKING([if compiler supports -R])
-AC_CACHE_VAL(php_cv_cc_dashr,[
- SAVE_LIBS=$LIBS
- LIBS="-R /usr/lib $LIBS"
- AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
- LIBS=$SAVE_LIBS])
-AC_MSG_RESULT([$php_cv_cc_dashr])
-if test $php_cv_cc_dashr = "yes"; then
- ld_runpath_switch=-R
-else
- AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
- AC_CACHE_VAL(php_cv_cc_rpath,[
- SAVE_LIBS=$LIBS
- LIBS="-Wl,-rpath,/usr/lib $LIBS"
- AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
- LIBS=$SAVE_LIBS])
- AC_MSG_RESULT([$php_cv_cc_rpath])
- if test $php_cv_cc_rpath = "yes"; then
- ld_runpath_switch=-Wl,-rpath,
- else
- dnl something innocuous
- ld_runpath_switch=-L
- fi
-fi
-])
-
-AC_DEFUN([PHP_STRUCT_FLOCK],[
-AC_CACHE_CHECK(for struct flock,ac_cv_struct_flock,
- AC_TRY_COMPILE([
-#include <unistd.h>
-#include <fcntl.h>
- ],
- [struct flock x;],
- [
- ac_cv_struct_flock=yes
- ],[
- ac_cv_struct_flock=no
- ])
-)
-if test "$ac_cv_struct_flock" = "yes" ; then
- AC_DEFINE(HAVE_STRUCT_FLOCK, 1,[whether you have struct flock])
-fi
-])
-
-AC_DEFUN([PHP_SOCKLEN_T],[
-AC_CACHE_CHECK(for socklen_t,ac_cv_socklen_t,
- AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/socket.h>
-],[
-socklen_t x;
-],[
- ac_cv_socklen_t=yes
-],[
- ac_cv_socklen_t=no
-]))
-if test "$ac_cv_socklen_t" = "yes"; then
- AC_DEFINE(HAVE_SOCKLEN_T, 1, [Whether you have socklen_t])
-fi
-])
-
-dnl
-dnl PHP_SET_SYM_FILE(path)
-dnl
-dnl set the path of the file which contains the symbol export list
-dnl
-AC_DEFUN([PHP_SET_SYM_FILE],
-[
- PHP_SYM_FILE=$1
-])
-
-dnl
-dnl PHP_BUILD_THREAD_SAFE
-dnl
-AC_DEFUN([PHP_BUILD_THREAD_SAFE],[
- enable_maintainer_zts=yes
- if test "$pthreads_working" != "yes"; then
- AC_MSG_ERROR([ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads.])
- fi
-])
-
-AC_DEFUN([PHP_REQUIRE_CXX],[
- if test -z "$php_cxx_done"; then
- AC_PROG_CXX
- AC_PROG_CXXCPP
- php_cxx_done=yes
- fi
-])
-
-dnl
-dnl PHP_BUILD_SHARED
-dnl
-AC_DEFUN([PHP_BUILD_SHARED],[
- PHP_BUILD_PROGRAM
- OVERALL_TARGET=libphp5.la
- php_build_target=shared
-
- php_c_pre=$shared_c_pre
- php_c_meta=$shared_c_meta
- php_c_post=$shared_c_post
- php_cxx_pre=$shared_cxx_pre
- php_cxx_meta=$shared_cxx_meta
- php_cxx_post=$shared_cxx_post
- php_lo=$shared_lo
-])
-
-dnl
-dnl PHP_BUILD_STATIC
-dnl
-AC_DEFUN([PHP_BUILD_STATIC],[
- PHP_BUILD_PROGRAM
- OVERALL_TARGET=libphp5.la
- php_build_target=static
-])
-
-dnl
-dnl PHP_BUILD_BUNDLE
-dnl
-AC_DEFUN([PHP_BUILD_BUNDLE],[
- PHP_BUILD_PROGRAM
- OVERALL_TARGET=libs/libphp5.bundle
- php_build_target=static
-])
-
-dnl
-dnl PHP_BUILD_PROGRAM
-dnl
-AC_DEFUN([PHP_BUILD_PROGRAM],[
- OVERALL_TARGET=[]ifelse($1,,php,$1)
- php_c_pre='$(CC)'
- php_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS)'
- php_c_post=' && echo > $[@]'
- php_cxx_pre='$(CXX)'
- php_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS)'
- php_cxx_post=' && echo > $[@]'
- php_lo=o
-
- shared_c_pre='$(LIBTOOL) --mode=compile $(CC)'
- shared_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -prefer-pic'
- shared_c_post=
- shared_cxx_pre='$(LIBTOOL) --mode=compile $(CXX)'
- shared_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS) -prefer-pic'
- shared_cxx_post=
- shared_lo=lo
-
- php_build_target=program
-])
-
-dnl
-dnl PHP_RUN_ONCE(namespace, variable, code)
-dnl
-dnl execute code, if variable is not set in namespace
-dnl
-AC_DEFUN([PHP_RUN_ONCE],[
- changequote({,})
- unique=`echo $2|sed 's/[^a-zA-Z0-9]/_/g'`
- changequote([,])
- cmd="echo $ac_n \"\$$1$unique$ac_c\""
- if test -n "$unique" && test "`eval $cmd`" = "" ; then
- eval "$1$unique=set"
- $3
- fi
-])
-
-dnl
-dnl PHP_EXPAND_PATH(path, variable)
-dnl
-dnl expands path to an absolute path and assigns it to variable
-dnl
-AC_DEFUN([PHP_EXPAND_PATH],[
- if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then
- $2=$1
- else
- changequote({,})
- ep_dir="`echo $1|sed 's%/*[^/][^/]*/*$%%'`"
- changequote([,])
- ep_realdir="`(cd \"$ep_dir\" && pwd)`"
- $2="$ep_realdir/`basename \"$1\"`"
- fi
-])
-dnl
-dnl internal, don't use
-AC_DEFUN([_PHP_ADD_LIBPATH_GLOBAL],[
- PHP_RUN_ONCE(LIBPATH, $1, [
- test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$1"
- LDFLAGS="$LDFLAGS -L$1"
- PHP_RPATHS="$PHP_RPATHS $1"
- ])
-])dnl
-dnl
-dnl
-dnl
-dnl PHP_ADD_LIBPATH(path[, shared-libadd])
-dnl
-dnl add a library to linkpath/runpath
-dnl
-AC_DEFUN([PHP_ADD_LIBPATH],[
- if test "$1" != "/usr/lib"; then
- PHP_EXPAND_PATH($1, ai_p)
- ifelse([$2],,[
- _PHP_ADD_LIBPATH_GLOBAL([$ai_p])
- ],[
- if test "$ext_shared" = "yes"; then
- $2="$ld_runpath_switch$ai_p -L$ai_p [$]$2"
- else
- _PHP_ADD_LIBPATH_GLOBAL([$ai_p])
- fi
- ])
- fi
-])
-
-dnl
-dnl PHP_UTILIZE_RPATHS()
-dnl
-dnl builds RPATHS/LDFLAGS from PHP_RPATHS
-dnl
-AC_DEFUN([PHP_UTILIZE_RPATHS],[
- OLD_RPATHS=$PHP_RPATHS
- unset PHP_RPATHS
-
- for i in $OLD_RPATHS; do
-dnl Can be passed to native cc/libtool
- PHP_LDFLAGS="$PHP_LDFLAGS -L$i"
-dnl Libtool-specific
- PHP_RPATHS="$PHP_RPATHS -R $i"
-dnl cc-specific
- NATIVE_RPATHS="$NATIVE_RPATHS $ld_runpath_switch$i"
- done
-
- if test "$PHP_RPATH" = "no"; then
- unset PHP_RPATHS
- unset NATIVE_RPATHS
- fi
-])
-
-dnl
-dnl PHP_ADD_INCLUDE(path [,before])
-dnl
-dnl add an include path.
-dnl if before is 1, add in the beginning of INCLUDES.
-dnl
-AC_DEFUN([PHP_ADD_INCLUDE],[
- if test "$1" != "/usr/include"; then
- PHP_EXPAND_PATH($1, ai_p)
- PHP_RUN_ONCE(INCLUDEPATH, $ai_p, [
- if test "$2"; then
- INCLUDES="-I$ai_p $INCLUDES"
- else
- INCLUDES="$INCLUDES -I$ai_p"
- fi
- ])
- fi
-])
-dnl
-dnl internal, don't use
-AC_DEFUN([_PHP_X_ADD_LIBRARY],[dnl
- ifelse([$2],,$3="-l$1 [$]$3", $3="[$]$3 -l$1") dnl
-])dnl
-dnl
-dnl internal, don't use
-AC_DEFUN([_PHP_ADD_LIBRARY_SKELETON],[
- case $1 in
- c|c_r|pthread*[)] ;;
- *[)] ifelse($3,,[
- _PHP_X_ADD_LIBRARY($1,$2,$5)
- ],[
- if test "$ext_shared" = "yes"; then
- _PHP_X_ADD_LIBRARY($1,$2,$3)
- else
- $4($1,$2)
- fi
- ]) ;;
- esac
-])dnl
-dnl
-dnl
-dnl
-dnl PHP_ADD_LIBRARY(library[, append[, shared-libadd]])
-dnl
-dnl add a library to the link line
-dnl
-AC_DEFUN([PHP_ADD_LIBRARY],[
- _PHP_ADD_LIBRARY_SKELETON([$1],[$2],[$3],[PHP_ADD_LIBRARY],[LIBS])
-])
-
-dnl
-dnl PHP_ADD_LIBRARY_DEFER(library[, append[, shared-libadd]])
-dnl
-dnl add a library to the link line (deferred)
-dnl
-AC_DEFUN([PHP_ADD_LIBRARY_DEFER],[
- _PHP_ADD_LIBRARY_SKELETON([$1],[$2],[$3],[PHP_ADD_LIBRARY_DEFER],[DLIBS])
-])
-
-dnl
-dnl PHP_ADD_LIBRARY_WITH_PATH(library, path[, shared-libadd])
-dnl
-dnl add a library to the link line and path to linkpath/runpath.
-dnl if shared-libadd is not empty and $ext_shared is yes,
-dnl shared-libadd will be assigned the library information
-dnl
-AC_DEFUN([PHP_ADD_LIBRARY_WITH_PATH],[
-ifelse($3,,[
- if test -n "$2"; then
- PHP_ADD_LIBPATH($2)
- fi
- PHP_ADD_LIBRARY($1)
-],[
- if test "$ext_shared" = "yes"; then
- $3="-l$1 [$]$3"
- if test -n "$2"; then
- PHP_ADD_LIBPATH($2,$3)
- fi
- else
- PHP_ADD_LIBRARY_WITH_PATH($1,$2)
- fi
-])
-])
-
-dnl
-dnl PHP_ADD_LIBRARY_DEFER_WITH_PATH(library, path[, shared-libadd])
-dnl
-dnl add a library to the link line (deferred)
-dnl and path to linkpath/runpath (not deferred)
-dnl if shared-libadd is not empty and $ext_shared is yes,
-dnl shared-libadd will be assigned the library information
-dnl
-AC_DEFUN([PHP_ADD_LIBRARY_DEFER_WITH_PATH],[
-ifelse($3,,[
- if test -n "$2"; then
- PHP_ADD_LIBPATH($2)
- fi
- PHP_ADD_LIBRARY_DEFER($1)
-],[
- if test "$ext_shared" = "yes"; then
- $3="-l$1 [$]$3"
- if test -n "$2"; then
- PHP_ADD_LIBPATH($2,$3)
- fi
- else
- PHP_ADD_LIBRARY_DEFER_WITH_PATH($1,$2)
- fi
-])
-])
-
-dnl
-dnl PHP_ADD_FRAMEWORK(framework [,before])
-dnl
-dnl add a (Darwin / Mac OS X) framework to the link
-dnl line. if before is 1, the framework is added
-dnl to the beginning of the line.
-
-AC_DEFUN([PHP_ADD_FRAMEWORK], [
- PHP_RUN_ONCE(FRAMEWORKS, $1, [
- if test "$2"; then
- PHP_FRAMEWORKS="-framework $1 $PHP_FRAMEWORKS"
- else
- PHP_FRAMEWORKS="$PHP_FRAMEWORKS -framework $1"
- fi
- ])
-])
-
-dnl
-dnl PHP_ADD_FRAMEWORKPATH(path [,before])
-dnl
-dnl add a (Darwin / Mac OS X) framework path to the link
-dnl and include lines. default paths include (but are
-dnl not limited to) /Local/Library/Frameworks and
-dnl /System/Library/Frameworks, so these don't need
-dnl to be specifically added. if before is 1, the
-dnl framework path is added to the beginning of the
-dnl relevant lines.
-
-AC_DEFUN([PHP_ADD_FRAMEWORKPATH], [
- PHP_EXPAND_PATH($1, ai_p)
- PHP_RUN_ONCE(FRAMEWORKPATH, $ai_p, [
- if test "$2"; then
- PHP_FRAMEWORKPATH="-F$ai_p $PHP_FRAMEWORKPATH"
- else
- PHP_FRAMEWORKPATH="$PHP_FRAMEWORKPATH -F$ai_p"
- fi
- ])
-])
-
-dnl
-dnl PHP_ADD_FRAMEWORK_WITH_PATH(framework, path)
-dnl
-dnl add a (Darwin / Mac OS X) framework path and the
-dnl framework itself to the link and include lines.
-AC_DEFUN([PHP_ADD_FRAMEWORK_WITH_PATH], [
- PHP_ADD_FRAMEWORKPATH($2)
- PHP_ADD_FRAMEWORK($1)
-])
-
-dnl
-dnl Set libtool variable
-dnl
-AC_DEFUN([PHP_SET_LIBTOOL_VARIABLE],[
- if test -z "$LIBTOOL"; then
- LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
- else
- LIBTOOL="$LIBTOOL $1"
- fi
-])
-
-dnl
-dnl Check for cc option
-dnl
-AC_DEFUN([PHP_CHECK_CC_OPTION],[
- echo "main(){return 0;}" > conftest.$ac_ext
- opt=$1
- changequote({,})
- var=`echo $opt|sed 's/[^a-zA-Z0-9]/_/g'`
- changequote([,])
- AC_MSG_CHECKING([if compiler supports -$1 really])
- ac_php_compile="${CC-cc} -$opt -o conftest $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1"
- if eval $ac_php_compile 2>&1 | grep -E "$opt" > /dev/null 2>&1 ; then
- eval php_cc_$var=no
- AC_MSG_RESULT([no])
- else
- if eval ./conftest 2>/dev/null ; then
- eval php_cc_$var=yes
- AC_MSG_RESULT([yes])
- else
- eval php_cc_$var=no
- AC_MSG_RESULT([no])
- fi
- fi
-])
-
-AC_DEFUN([PHP_REGEX],[
-
-if test "$REGEX_TYPE" = "php"; then
- AC_DEFINE(HSREGEX,1,[ ])
- AC_DEFINE(REGEX,1,[ ])
- PHP_ADD_SOURCES(regex, regcomp.c regexec.c regerror.c regfree.c)
-elif test "$REGEX_TYPE" = "system"; then
- AC_DEFINE(REGEX,0,[ ])
-fi
-
-AC_MSG_CHECKING([which regex library to use])
-AC_MSG_RESULT([$REGEX_TYPE])
-])
-
-dnl
-dnl See if we have broken header files like SunOS has.
-dnl
-AC_DEFUN([PHP_MISSING_FCLOSE_DECL],[
- AC_MSG_CHECKING([for fclose declaration])
- AC_TRY_COMPILE([#include <stdio.h>],[int (*func)() = fclose],[
- AC_DEFINE(MISSING_FCLOSE_DECL,0,[ ])
- AC_MSG_RESULT([ok])
- ],[
- AC_DEFINE(MISSING_FCLOSE_DECL,1,[ ])
- AC_MSG_RESULT([missing])
- ])
-])
-
-dnl
-dnl Check for broken sprintf(), C99 conformance
-dnl
-AC_DEFUN([PHP_AC_BROKEN_SPRINTF],[
- AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[
- AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[
- ac_cv_broken_sprintf=no
- ],[
- ac_cv_broken_sprintf=yes
- ],[
- ac_cv_broken_sprintf=no
- ])
- ])
- if test "$ac_cv_broken_sprintf" = "yes"; then
- AC_DEFINE(PHP_BROKEN_SPRINTF, 1, [Whether sprintf is C99 conform])
- else
- AC_DEFINE(PHP_BROKEN_SPRINTF, 0, [Whether sprintf is C99 conform])
- fi
-])
-
-dnl
-dnl Check for broken snprintf(), C99 conformance
-dnl
-AC_DEFUN([PHP_AC_BROKEN_SNPRINTF],[
- AC_CACHE_CHECK(whether snprintf is broken, ac_cv_broken_snprintf,[
- AC_TRY_RUN([
-#define NULL (0L)
-main() {
- char buf[20];
- int res = 0;
- res = res || (snprintf(buf, 2, "marcus") != 6);
- res = res || (buf[1] != '\0');
- res = res || (snprintf(buf, 0, "boerger") != 7);
- res = res || (buf[0] != 'm');
- res = res || (snprintf(NULL, 0, "boerger") != 7);
- res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8);
- exit(res);
-}
- ],[
- ac_cv_broken_snprintf=no
- ],[
- ac_cv_broken_snprintf=yes
- ],[
- ac_cv_broken_snprintf=no
- ])
- ])
- if test "$ac_cv_broken_snprintf" = "yes"; then
- AC_DEFINE(PHP_BROKEN_SNPRINTF, 1, [Whether snprintf is C99 conform])
- else
- AC_DEFINE(PHP_BROKEN_SNPRINTF, 0, [Whether snprintf is C99 conform])
- fi
-])
-
-dnl PHP_SHARED_MODULE(module-name, object-var, build-dir, cxx)
-dnl
-dnl Basically sets up the link-stage for building module-name
-dnl from object_var in build-dir.
-dnl
-AC_DEFUN([PHP_SHARED_MODULE],[
- PHP_MODULES="$PHP_MODULES \$(phplibdir)/$1.la"
- PHP_SUBST($2)
- cat >>Makefile.objects<<EOF
-\$(phplibdir)/$1.la: $3/$1.la
- \$(LIBTOOL) --mode=install cp $3/$1.la \$(phplibdir)
-
-$3/$1.la: \$($2) \$(translit($1,a-z-,A-Z_)_SHARED_DEPENDENCIES)
- \$(LIBTOOL) --mode=link ifelse($4,,[\$(CC)],[\$(CXX)]) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) -o \[$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z-,A-Z_)_SHARED_LIBADD)
-
-EOF
-])
-
-dnl
-dnl PHP_SELECT_SAPI(name, type[, sources [, extra-cflags [, build-target]]])
-dnl
-dnl Selects the SAPI name and type (static, shared, programm)
-dnl and optionally also the source-files for the SAPI-specific
-dnl objects.
-dnl
-AC_DEFUN([PHP_SELECT_SAPI],[
- PHP_SAPI=$1
-
- case "$2" in
- static) PHP_BUILD_STATIC;;
- shared) PHP_BUILD_SHARED;;
- bundle) PHP_BUILD_BUNDLE;;
- program) PHP_BUILD_PROGRAM($5);;
- esac
-
- ifelse($3,,,[PHP_ADD_SOURCES([sapi/$1],[$3],[$4],[sapi])])
-])
-
-dnl deprecated
-AC_DEFUN([PHP_EXTENSION],[
- sources=`awk -f $abs_srcdir/scan_makefile_in.awk < []PHP_EXT_SRCDIR($1)[]/Makefile.in`
-
- PHP_NEW_EXTENSION($1, $sources, $2, $3)
-
- if test -r "$ext_srcdir/Makefile.frag"; then
- PHP_ADD_MAKEFILE_FRAGMENT
- fi
-])
-
-AC_DEFUN([PHP_ADD_BUILD_DIR],[
- BUILD_DIR="$BUILD_DIR $1"
-])
-
-AC_DEFUN([PHP_GEN_BUILD_DIRS],[
- $php_shtool mkdir -p $BUILD_DIR
-])
-
-dnl
-dnl PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags[, cxx]]]])
-dnl
-dnl Includes an extension in the build.
-dnl
-dnl "extname" is the name of the ext/ subdir where the extension resides.
-dnl "sources" is a list of files relative to the subdir which are used
-dnl to build the extension.
-dnl "shared" can be set to "shared" or "yes" to build the extension as
-dnl a dynamically loadable library. Optional parameter "sapi_class" can
-dnl be set to "cli" to mark extension build only with CLI or CGI sapi's.
-dnl extra-cflags are passed to the compiler, with @ext_srcdir@ being
-dnl substituted.
-AC_DEFUN([PHP_NEW_EXTENSION],[
- ext_builddir=[]PHP_EXT_BUILDDIR($1)
- ext_srcdir=[]PHP_EXT_SRCDIR($1)
-
- ifelse($5,,ac_extra=,[ac_extra=`echo "$5"|sed s#@ext_srcdir@#$ext_srcdir#g`])
-
- if test "$3" != "shared" && test "$3" != "yes" && test "$4" != "cli"; then
-dnl ---------------------------------------------- Static module
-
- PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,)
- EXT_STATIC="$EXT_STATIC $1"
- if test "$3" != "nocli"; then
- EXT_CLI_STATIC="$EXT_CLI_STATIC $1"
- fi
- else
- if test "$3" = "shared" || test "$3" = "yes"; then
-dnl ---------------------------------------------- Shared module
- PHP_ADD_SOURCES_X(PHP_EXT_DIR($1),$2,$ac_extra,shared_objects_$1,yes)
- PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir, $6)
- AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z_-,A-Z__), 1, Whether to build $1 as dynamic module)
- fi
- fi
-
- if test "$3" != "shared" && test "$3" != "yes" && test "$4" = "cli"; then
-dnl ---------------------------------------------- CLI static module
- if test "$PHP_SAPI" = "cgi"; then
- PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,)
- EXT_STATIC="$EXT_STATIC $1"
- else
- PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,cli)
- fi
- EXT_CLI_STATIC="$EXT_CLI_STATIC $1"
- fi
- PHP_ADD_BUILD_DIR($ext_builddir)
-])
-
-dnl
-dnl Solaris requires main code to be position independent in order
-dnl to let shared objects find symbols. Weird. Ugly.
-dnl
-dnl Must be run after all --with-NN options that let the user
-dnl choose dynamic extensions, and after the gcc test.
-dnl
-AC_DEFUN([PHP_SOLARIS_PIC_WEIRDNESS],[
- AC_MSG_CHECKING([whether -fPIC is required])
- if test -n "$EXT_SHARED"; then
- os=`uname -sr 2>/dev/null`
- case $os in
- "SunOS 5.6"|"SunOS 5.7")
- case $CC in
- gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";;
- *) CFLAGS="$CFLAGS -fpic";;
- esac
- AC_MSG_RESULT([yes]);;
- *)
- AC_MSG_RESULT([no]);;
- esac
- else
- AC_MSG_RESULT([no])
- fi
-])
-
-dnl
-dnl Checks whether $withval is "shared" or starts with "shared,XXX"
-dnl and sets $shared to "yes" or "no", and removes "shared,?" stuff
-dnl from $withval.
-dnl
-AC_DEFUN([PHP_WITH_SHARED],[
- PHP_ARG_ANALYZE_EX(withval)
- shared=$ext_shared
- unset ext_shared ext_output
-])
-
-dnl The problem is that the default compilation flags in Solaris 2.6 won't
-dnl let programs access large files; you need to tell the compiler that
-dnl you actually want your programs to work on large files. For more
-dnl details about this brain damage please see:
-dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
-
-dnl Written by Paul Eggert <eggert@twinsun.com>.
-
-AC_DEFUN([PHP_SYS_LFS],
-[dnl
- # If available, prefer support for large files unless the user specified
- # one of the CPPFLAGS, LDFLAGS, or LIBS variables.
- AC_MSG_CHECKING([whether large file support needs explicit enabling])
- ac_getconfs=''
- ac_result=yes
- ac_set=''
- ac_shellvars='CPPFLAGS LDFLAGS LIBS'
- for ac_shellvar in $ac_shellvars; do
- case $ac_shellvar in
- CPPFLAGS) ac_lfsvar=LFS_CFLAGS ;;
- *) ac_lfsvar=LFS_$ac_shellvar ;;
- esac
- eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar
- (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; }
- ac_getconf=`getconf $ac_lfsvar`
- ac_getconfs=$ac_getconfs$ac_getconf
- eval ac_test_$ac_shellvar=\$ac_getconf
- done
- case "$ac_result$ac_getconfs" in
- yes) ac_result=no ;;
- esac
- case "$ac_result$ac_set" in
- yes?*) ac_result="yes, but $ac_set is already set, so use its settings"
- esac
- AC_MSG_RESULT([$ac_result])
- case $ac_result in
- yes)
- for ac_shellvar in $ac_shellvars; do
- eval $ac_shellvar=\$ac_test_$ac_shellvar
- done ;;
- esac
-])
-
-AC_DEFUN([PHP_SOCKADDR_SA_LEN],[
- AC_CACHE_CHECK([for field sa_len in struct sockaddr],ac_cv_sockaddr_sa_len,[
- AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/socket.h>],
- [struct sockaddr s; s.sa_len;],
- [ac_cv_sockaddr_sa_len=yes
- AC_DEFINE(HAVE_SOCKADDR_SA_LEN,1,[ ])],
- [ac_cv_sockaddr_sa_len=no])
- ])
-])
-
-
-dnl ## PHP_OUTPUT(file)
-dnl ## adds "file" to the list of files generated by AC_OUTPUT
-dnl ## This macro can be used several times.
-AC_DEFUN([PHP_OUTPUT],[
- PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1"
-])
-
-AC_DEFUN([PHP_DECLARED_TIMEZONE],[
- AC_CACHE_CHECK(for declared timezone, ac_cv_declared_timezone,[
- AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <time.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-],[
- time_t foo = (time_t) timezone;
-],[
- ac_cv_declared_timezone=yes
-],[
- ac_cv_declared_timezone=no
-])])
- if test "$ac_cv_declared_timezone" = "yes"; then
- AC_DEFINE(HAVE_DECLARED_TIMEZONE, 1, [Whether system headers declare timezone])
- fi
-])
-
-AC_DEFUN([PHP_EBCDIC],[
- AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[
- AC_TRY_RUN( [
-int main(void) {
- return (unsigned char)'A' != (unsigned char)0xC1;
-}
-],[
- ac_cv_ebcdic=yes
-],[
- ac_cv_ebcdic=no
-],[
- ac_cv_ebcdic=no
-])])
- if test "$ac_cv_ebcdic" = "yes"; then
- AC_DEFINE(CHARSET_EBCDIC,1, [Define if system uses EBCDIC])
- fi
-])
-
-dnl Some systems, notably Solaris, cause getcwd() or realpath to fail if a
-dnl component of the path has execute but not read permissions
-AC_DEFUN([PHP_BROKEN_GETCWD],[
- AC_MSG_CHECKING([for broken getcwd])
- os=`uname -sr 2>/dev/null`
- case $os in
- SunOS*)
- AC_DEFINE(HAVE_BROKEN_GETCWD,1, [Define if system has broken getcwd])
- AC_MSG_RESULT([yes]);;
- *)
- AC_MSG_RESULT([no]);;
- esac
-])
-
-AC_DEFUN([PHP_BROKEN_GLIBC_FOPEN_APPEND],[
- AC_MSG_CHECKING([for broken libc stdio])
- AC_CACHE_VAL(have_broken_glibc_fopen_append,[
- AC_TRY_RUN([
-#include <stdio.h>
-int main(int argc, char *argv[])
-{
- FILE *fp;
- long position;
- char *filename = "/tmp/phpglibccheck";
-
- fp = fopen(filename, "w");
- if (fp == NULL) {
- perror("fopen");
- exit(2);
- }
- fputs("foobar", fp);
- fclose(fp);
-
- fp = fopen(filename, "a+");
- position = ftell(fp);
- fclose(fp);
- unlink(filename);
- if (position == 0)
- return 1;
- return 0;
-}
-],
-[have_broken_glibc_fopen_append=no],
-[have_broken_glibc_fopen_append=yes ],
-AC_TRY_COMPILE([
-#include <features.h>
-],[
-#if !__GLIBC_PREREQ(2,2)
-choke me
-#endif
-],
-[have_broken_glibc_fopen_append=yes],
-[have_broken_glibc_fopen_append=no ])
-)])
-
- if test "$have_broken_glibc_fopen_append" = "yes"; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on fopen with mode a+])
- else
- AC_MSG_RESULT(no)
- fi
-])
-
-
-AC_DEFUN([PHP_FOPENCOOKIE],[
- AC_CHECK_FUNC(fopencookie, [ have_glibc_fopencookie=yes ])
-
- if test "$have_glibc_fopencookie" = "yes" ; then
- dnl this comes in two flavors:
- dnl newer glibcs (since 2.1.2 ? )
- dnl have a type called cookie_io_functions_t
- AC_TRY_COMPILE([ #define _GNU_SOURCE
- #include <stdio.h>
- ],
- [ cookie_io_functions_t cookie; ],
- [ have_cookie_io_functions_t=yes ],
- [] )
-
- if test "$have_cookie_io_functions_t" = "yes" ; then
- cookie_io_functions_t=cookie_io_functions_t
- have_fopen_cookie=yes
-
- dnl even newer glibcs have a different seeker definition...
-
- AC_TRY_RUN([
-#define _GNU_SOURCE
-#include <stdio.h>
-
-struct cookiedata {
- __off64_t pos;
-};
-
-__ssize_t reader(void *cookie, char *buffer, size_t size)
-{ return size; }
-__ssize_t writer(void *cookie, const char *buffer, size_t size)
-{ return size; }
-int closer(void *cookie)
-{ return 0; }
-int seeker(void *cookie, __off64_t *position, int whence)
-{ ((struct cookiedata*)cookie)->pos = *position; return 0; }
-
-cookie_io_functions_t funcs = {reader, writer, seeker, closer};
-
-main() {
- struct cookiedata g = { 0 };
- FILE *fp = fopencookie(&g, "r", funcs);
-
- if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192)
- exit(0);
- exit(1);
-}
-
- ],
- [ cookie_io_functions_use_off64_t=yes ],
- [ ] )
-
- else
- dnl older glibc versions (up to 2.1.2 ?)
- dnl call it _IO_cookie_io_functions_t
- AC_TRY_COMPILE([ #define _GNU_SOURCE
- #include <stdio.h>
- ],
- [ _IO_cookie_io_functions_t cookie; ],
- [ have_IO_cookie_io_functions_t=yes ],
- [] )
- if test "$have_cookie_io_functions_t" = "yes" ; then
- cookie_io_functions_t=_IO_cookie_io_functions_t
- have_fopen_cookie=yes
- fi
- fi
-
- if test "$have_fopen_cookie" = "yes" ; then
- AC_DEFINE(HAVE_FOPENCOOKIE, 1, [ ])
- AC_DEFINE_UNQUOTED(COOKIE_IO_FUNCTIONS_T, $cookie_io_functions_t, [ ])
- if test "$cookie_io_functions_use_off64_t" = "yes" ; then
- AC_DEFINE(COOKIE_SEEKER_USES_OFF64_T, 1, [ ])
- fi
- fi
-
- fi
-])
-
-
-dnl
-dnl PHP_CHECK_LIBRARY(library, function [, action-found [, action-not-found [, extra-libs]]])
-dnl
-dnl Wrapper for AC_CHECK_LIB
-dnl
-AC_DEFUN([PHP_CHECK_LIBRARY], [
- save_old_LDFLAGS=$LDFLAGS
- LDFLAGS="$5 $LDFLAGS"
- AC_CHECK_LIB([$1],[$2],[
- LDFLAGS=$save_old_LDFLAGS
- $3
- ],[
- LDFLAGS=$save_old_LDFLAGS
- unset ac_cv_func_$1
- $4
- ])dnl
-])
-
-dnl
-dnl PHP_CHECK_FRAMEWORK(framework, function [, action-found [, action-not-found ]])
-dnl
-dnl El cheapo wrapper for AC_CHECK_LIB
-dnl
-AC_DEFUN([PHP_CHECK_FRAMEWORK], [
- save_old_LDFLAGS=$LDFLAGS
- LDFLAGS="-framework $1 $LDFLAGS"
- dnl supplying "c" to AC_CHECK_LIB is technically cheating, but
- dnl rewriting AC_CHECK_LIB is overkill and this only affects
- dnl the "checking.." output anyway.
- AC_CHECK_LIB(c,[$2],[
- LDFLAGS=$save_old_LDFLAGS
- $3
- ],[
- LDFLAGS=$save_old_LDFLAGS
- $4
- ])
-])
-
-dnl
-dnl PHP_SETUP_ICONV(shared-add [, action-found [, action-not-found]])
-dnl
-dnl Common setup macro for iconv
-dnl
-AC_DEFUN([PHP_SETUP_ICONV], [
- found_iconv=no
- unset ICONV_DIR
-
- dnl
- dnl Check libc first if no path is provided in --with-iconv
- dnl
- if test "$PHP_ICONV" = "yes"; then
- AC_CHECK_FUNC(iconv, [
- PHP_DEFINE(HAVE_ICONV)
- found_iconv=yes
- ],[
- AC_CHECK_FUNC(libiconv,[
- PHP_DEFINE(HAVE_LIBICONV)
- found_iconv=yes
- ])
- ])
- fi
-
- dnl
- dnl Check external libs for iconv funcs
- dnl
- if test "$found_iconv" = "no"; then
-
- for i in $PHP_ICONV /usr/local /usr; do
- if test -r $i/include/giconv.h; then
- AC_DEFINE(HAVE_GICONV_H, 1, [ ])
- ICONV_DIR=$i
- iconv_lib_name=giconv
- break
- elif test -r $i/include/iconv.h; then
- ICONV_DIR=$i
- iconv_lib_name=iconv
- break
- fi
- done
-
- if test -z "$ICONV_DIR"; then
- AC_MSG_ERROR([Please specify the install prefix of iconv with --with-iconv=<DIR>])
- fi
-
- if test -f $ICONV_DIR/lib/lib$iconv_lib_name.a ||
- test -f $ICONV_DIR/lib/lib$iconv_lib_name.$SHLIB_SUFFIX_NAME
- then
- PHP_CHECK_LIBRARY($iconv_lib_name, libiconv, [
- found_iconv=yes
- PHP_DEFINE(HAVE_LIBICONV)
- ], [
- PHP_CHECK_LIBRARY($iconv_lib_name, iconv, [
- found_iconv=yes
- PHP_DEFINE(HAVE_ICONV)
- ], [], [
- -L$ICONV_DIR/lib
- ])
- ], [
- -L$ICONV_DIR/lib
- ])
- fi
- fi
-
- if test "$found_iconv" = "yes"; then
- if test -n "$ICONV_DIR"; then
- AC_DEFINE(HAVE_ICONV, 1, [ ])
- PHP_ADD_LIBRARY_WITH_PATH($iconv_lib_name, $ICONV_DIR/lib, $1)
- PHP_ADD_INCLUDE($ICONV_DIR/include)
- fi
- $2
-ifelse([$3],[],,[else $3])
- fi
-])
-
-AC_DEFUN([PHP_DEF_HAVE],[AC_DEFINE([HAVE_]translit($1,a-z_-,A-Z__), 1, [ ])])
-
-dnl
-dnl PHP_CHECK_FUNC_LIB(func, libs)
-dnl This macro checks whether 'func' or '__func' exists
-dnl in the specified library.
-dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS.
-dnl This should be called in the ACTION-IF-NOT-FOUND part of PHP_CHECK_FUNC
-dnl
-
-dnl autoconf undefines the builtin "shift" :-(
-dnl If possible, we use the builtin shift anyway, otherwise we use
-dnl the ubercool definition I have tested so far with FreeBSD/GNU m4
-ifdef([builtin],[builtin(define, phpshift, [builtin(shift, $@)])],[
-define([phpshift],[ifelse(index([$@],[,]),-1,,[substr([$@],incr(index([$@],[,])))])])
-])
-
-AC_DEFUN([PHP_CHECK_FUNC_LIB],[
- ifelse($2,,:,[
- unset ac_cv_lib_$2[]_$1
- unset ac_cv_lib_$2[]___$1
- unset found
- AC_CHECK_LIB($2, $1, [found=yes], [
- AC_CHECK_LIB($2, __$1, [found=yes], [found=no])
- ])
-
- if test "$found" = "yes"; then
- ac_libs=$LIBS
- LIBS="$LIBS -l$2"
- AC_TRY_RUN([main() { return (0); }],[found=yes],[found=no],[found=no])
- LIBS=$ac_libs
- fi
-
- if test "$found" = "yes"; then
- PHP_ADD_LIBRARY($2)
- PHP_DEF_HAVE($1)
- PHP_DEF_HAVE(lib$2)
- ac_cv_func_$1=yes
- else
- PHP_CHECK_FUNC_LIB($1,phpshift(phpshift($@)))
- fi
- ])
-])
-
-dnl
-dnl PHP_CHECK_FUNC(func, ...)
-dnl This macro checks whether 'func' or '__func' exists
-dnl in the default libraries and as a fall back in the specified library.
-dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS.
-dnl
-AC_DEFUN([PHP_CHECK_FUNC],[
- unset ac_cv_func_$1
- unset ac_cv_func___$1
- unset found
-
- AC_CHECK_FUNC($1, [found=yes],[ AC_CHECK_FUNC(__$1,[found=yes],[found=no]) ])
-
- case $found in
- yes)
- PHP_DEF_HAVE($1)
- ac_cv_func_$1=yes
- ;;
- ifelse($#,1,,[
- *) PHP_CHECK_FUNC_LIB($@) ;;
- ])
- esac
-])
-
-dnl
-dnl PHP_AP_EXTRACT_VERSION(/path/httpd)
-dnl This macro is used to get a comparable
-dnl version for apache1/2.
-dnl
-AC_DEFUN([PHP_AP_EXTRACT_VERSION],[
- ac_output=`$1 -v 2>&1`
- ac_IFS=$IFS
-IFS="- /.
-"
- set $ac_output
- IFS=$ac_IFS
-
- APACHE_VERSION=`expr [$]4 \* 1000000 + [$]5 \* 1000 + [$]6`
-])
diff --git a/build/build.mk b/build/build.mk
deleted file mode 100644
index d9bb151857..0000000000
--- a/build/build.mk
+++ /dev/null
@@ -1,73 +0,0 @@
-# +----------------------------------------------------------------------+
-# | PHP Version 4 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997-2002 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Author: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-#
-# Makefile to generate build tools
-#
-
-ZENDDIR = Zend
-
-SUBDIRS = $(ZENDDIR) TSRM
-
-STAMP = buildmk.stamp
-
-ALWAYS = generated_lists
-
-
-all: $(STAMP) $(ALWAYS)
- @$(MAKE) AMFLAGS=$(AMFLAGS) -s -f build/build2.mk
-
-generated_lists:
- @echo makefile_am_files = $(ZENDDIR)/Makefile.am \
- TSRM/Makefile.am > $@
- @echo config_h_files = $(ZENDDIR)/acconfig.h TSRM/acconfig.h >> $@
- @echo config_m4_files = $(ZENDDIR)/Zend.m4 TSRM/tsrm.m4 TSRM/threads.m4 bundle/*/config*.m4 \
- $(ZENDDIR)/acinclude.m4 ext/*/config*.m4 sapi/*/config.m4 >> $@
-
-$(STAMP): build/buildcheck.sh
- @build/buildcheck.sh $(STAMP)
-
-snapshot:
- distname='$(DISTNAME)'; \
- if test -z "$$distname"; then \
- distname='php4-snapshot'; \
- fi; \
- myname=`basename \`pwd\`` ; \
- cd .. && cp -rp $$myname $$distname; \
- cd $$distname; \
- rm -f $(SUBDIRS) 2>/dev/null || true; \
- for i in $(SUBDIRS); do \
- test -d $$i || (test -d ../$$i && cp -rp ../$$i $$i); \
- done; \
- find . -type l -exec rm {} \; ; \
- $(MAKE) AMFLAGS=--copy -f build/build.mk; \
- cd ..; \
- tar cf $$distname.tar $$distname; \
- rm -rf $$distname $$distname.tar.*; \
- bzip2 -9 $$distname.tar; \
- md5sum $$distname.tar.bz2; \
- sync; sleep 2; \
- md5sum $$distname.tar.bz2; \
- bzip2 -t $$distname.tar.bz2
-
-cvsclean:
- @for i in `find . -name .cvsignore`; do \
- (cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore | grep -v config.nice` *.o *.a .libs || true); \
- done
-
-.PHONY: $(ALWAYS) snapshot cvsclean
diff --git a/build/build2.mk b/build/build2.mk
deleted file mode 100644
index 26bad9f9c5..0000000000
--- a/build/build2.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-# +----------------------------------------------------------------------+
-# | PHP Version 4 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997-2002 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Author: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-
-include generated_lists
-
-TOUCH_FILES = mkinstalldirs install-sh missing
-
-LT_TARGETS = ltmain.sh config.guess config.sub
-
-makefile_in_files = $(makefile_am_files:.am=.in)
-makefile_files = $(makefile_am_files:e.am=e)
-
-config_h_in = main/php_config.h.in
-
-acconfig_h_SOURCES = acconfig.h.in $(config_h_files)
-
-targets = $(TOUCH_FILES) configure $(config_h_in)
-
-
-all: $(targets)
-
-acconfig.h: $(acconfig_h_SOURCES)
- @echo rebuilding $@
- cat $(acconfig_h_SOURCES) > $@
-
-SUPPRESS_WARNINGS = (egrep -v '(AC_TRY_RUN called without default to allow cross compiling|AC_PROG_CXXCPP was called before AC_PROG_CXX|defined in acinclude.m4 but never used|AC_PROG_LEX invoked multiple times)'||true)
-
-$(config_h_in): configure acconfig.h
-# explicitly remove target since autoheader does not seem to work
-# correctly otherwise (timestamps are not updated)
- @echo rebuilding $@
- @rm -f $@
- @autoheader 2>&1 | $(SUPPRESS_WARNINGS)
-
-$(TOUCH_FILES):
- touch $(TOUCH_FILES)
-
-aclocal.m4: configure.in acinclude.m4
- aclocal 2>&1 | $(SUPPRESS_WARNINGS)
-
-configure: aclocal.m4 configure.in $(config_m4_files)
- @echo rebuilding $@
- @autoconf 2>&1 | $(SUPPRESS_WARNINGS)
diff --git a/build/buildcheck.sh b/build/buildcheck.sh
deleted file mode 100755
index 4776f1e177..0000000000
--- a/build/buildcheck.sh
+++ /dev/null
@@ -1,113 +0,0 @@
-#! /bin/sh
-# +----------------------------------------------------------------------+
-# | PHP Version 4 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997-2002 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Stig Bakken <ssb@php.net> |
-# | Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id: buildcheck.sh,v 1.25 2003-04-16 11:59:49 jan Exp $
-#
-
-echo "buildconf: checking installation..."
-
-stamp=$1
-
-# autoconf 2.13 or newer
-ac_version=`autoconf --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
-if test -z "$ac_version"; then
-echo "buildconf: autoconf not found."
-echo " You need autoconf version 2.13 or newer installed"
-echo " to build PHP from CVS."
-exit 1
-fi
-IFS=.; set $ac_version; IFS=' '
-if test "$1" = "2" -a "$2" -lt "13" || test "$1" -lt "2"; then
-echo "buildconf: autoconf version $ac_version found."
-echo " You need autoconf version 2.13 or newer installed"
-echo " to build PHP from CVS."
-exit 1
-else
-echo "buildconf: autoconf version $ac_version (ok)"
-fi
-
-
-if test "$1" = "2" && test "$2" -ge "50"; then
- echo "buildconf: Your version of autoconf likely contains buggy cache code."
- echo " Running cvsclean for you."
- echo " To avoid this, install autoconf-2.13 and automake-1.5."
- ./cvsclean
- stamp=
-fi
-
-
-# automake 1.4 or newer
-am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
-am_version_clean=`echo $am_version|sed -e 's/-p[0-9]*$//'`
-if test "$am_version" = ""; then
-echo "buildconf: automake not found."
-echo " You need automake version 1.4 or newer installed"
-echo " to build PHP from CVS."
-exit 1
-fi
-IFS=.; set $am_version_clean; IFS=' '
-if test "$1" = "1" -a "$2" -lt "4" || test "$1" -lt "1"; then
-echo "buildconf: automake version $am_version found."
-echo " You need automake version 1.4 or newer installed"
-echo " to build PHP from CVS."
-exit 1
-else
-echo "buildconf: automake version $am_version (ok)"
-fi
-
-# libtool 1.4.3 or newer
-# Prefer glibtool over libtool for Mac OS X compatibility
-libtool=`./build/shtool path glibtool 2> /dev/null`
-if test ! -r "$libtool"; then libtool=`./build/shtool path libtool`; fi
-lt_pversion=`$libtool --version 2>/dev/null|sed -n -e 's/^[^0-9]*//' -e 1's/[- ].*//p'`
-if test "$lt_pversion" = ""; then
-echo "buildconf: libtool not found."
-echo " You need libtool version 1.4.3 or newer installed"
-echo " to build PHP from CVS."
-exit 1
-fi
-lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
-IFS=.; set $lt_version; IFS=' '
-
-if test "$3" = ""; then
- third=0
-else
- third=$3
-fi
-
-if test "$1" -gt "1" || test "$2" -ge "5" || (test "$2" -ge "4" && test "$third" -ge "3")
-then
-echo "buildconf: libtool version $lt_pversion (ok)"
-else
-echo "buildconf: libtool version $lt_pversion found."
-echo " You need libtool version 1.4.3 or newer installed"
-echo " to build PHP from CVS."
-exit 1
-fi
-
-am_prefix=`./build/shtool path automake | sed -e 's#/[^/]*/[^/]*$##'`
-lt_prefix=`echo $libtool | sed -e 's#/[^/]*/[^/]*$##'`
-if test "$am_prefix" != "$lt_prefix"; then
- echo "WARNING: automake and libtool are installed in different"
- echo " directories. This may cause aclocal to fail."
- echo " continuing anyway"
-fi
-
-test -n "$stamp" && touch $stamp
-
-exit 0
diff --git a/build/config-stubs b/build/config-stubs
deleted file mode 100755
index 28208085a7..0000000000
--- a/build/config-stubs
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-#
-# $Id$
-
-dir=$1; shift
-for stubfile in $dir/*/config0.m4 $dir/*/config.m4 $dir/*/config9.m4; do
- echo "sinclude($stubfile)"
-done
diff --git a/build/genif.sh b/build/genif.sh
deleted file mode 100644
index cb5233b5ac..0000000000
--- a/build/genif.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#! /bin/sh
-
-# $Id: genif.sh,v 1.3 2002-03-22 10:22:41 sas Exp $
-# replacement for genif.pl
-
-infile=$1
-shift
-srcdir=$1
-shift
-extra_module_ptrs=$1
-shift
-awk=$1
-shift
-
-if test -z "$infile" || test -z "$srcdir"; then
- echo "please supply infile and srcdir"
- exit 1
-fi
-
-module_ptrs=$extra_module_ptrs
-header_list=
-olddir=`pwd`
-cd $srcdir
-
-for ext in ${1+"$@"} ; do
- module_ptrs=" phpext_${ext}_ptr,@NEWLINE@$module_ptrs"
- header_list="$header_list ext/$ext/*.h"
-done
-
-includes=`$awk -f ./build/print_include.awk $header_list`
-
-cd $olddir
-
-cat $infile | \
- sed \
- -e "s'@EXT_INCLUDE_CODE@'$includes'" \
- -e "s'@EXT_MODULE_PTRS@'$module_ptrs'" \
- -e 's/@NEWLINE@/\
-/g'
-
-
diff --git a/build/mkdep.awk b/build/mkdep.awk
deleted file mode 100644
index a83f5f6c90..0000000000
--- a/build/mkdep.awk
+++ /dev/null
@@ -1,75 +0,0 @@
-# +----------------------------------------------------------------------+
-# | PHP Version 4 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 2000 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Author: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-# Usage:
-#
-# echo top_srcdir top_builddir srcdir CPP [CPP-ARGS] filenames | \
-# awk -f mkdep.awk > dependencies
-
-
-{
- top_srcdir=$1
- top_builddir=$2
- srcdir=$3
- cmd=$4
-
- for (i = 5; i <= NF; i++) {
- if (match($i, "^-[A-Z]") == 0)
- break;
- cmd=cmd " " $i
- }
-
- dif=i-1
-
- for (; i <= NF; i++)
- filenames[i-dif]=$i
-
- no_files=NF-dif
-
- for(i = 1; i <= no_files; i++) {
- if (system("test -r " filenames[i]) != 0)
- continue
-
- target=filenames[i]
- sub(srcdir "/", "", target)
- target2=target
- sub("\.(c|cpp)$", ".lo", target);
- sub("\.(c|cpp)$", ".slo", target2);
-
- for (e in used)
- delete used[e]
-
- cmdx=cmd " " filenames[i]
- done=0
- while ((cmdx | getline) > 0) {
- if (match($0, "^# [0-9]* \".*\.h\"") != 0) {
- if (sub(top_srcdir, "$(top_srcdir)", $3) == 0)
- sub(top_builddir, "$(top_builddir)", $3)
- if (substr($3,2,1) != "/" && used[$3] != 1) {
- if (done == 0)
- printf(target " " target2 ":")
- done=1
- printf(" \\\n\t" substr($3,2,length($3)-2))
- used[$3] = 1;
- }
- }
- }
- if (done == 1)
- print "\n"
- }
-}
diff --git a/build/print_include.awk b/build/print_include.awk
deleted file mode 100644
index a4919fae87..0000000000
--- a/build/print_include.awk
+++ /dev/null
@@ -1,6 +0,0 @@
-/phpext_/ {
- if (old_filename != FILENAME) {
- printf "#include \"" FILENAME "\"@NEWLINE@"
- old_filename = FILENAME
- }
-}
diff --git a/build/shtool b/build/shtool
deleted file mode 100755
index f3250796ec..0000000000
--- a/build/shtool
+++ /dev/null
@@ -1,1046 +0,0 @@
-#!/bin/sh
-##
-## GNU shtool -- The GNU Portable Shell Tool
-## Copyright (c) 1994-2002 Ralf S. Engelschall <rse@engelschall.com>
-##
-## See http://www.gnu.org/software/shtool/ for more information.
-## See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
-##
-## Version: 1.6.2 (02-Nov-2002)
-## Contents: 4/19 available modules
-##
-
-##
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2 of the License, or
-## (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-## USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
-##
-## NOTICE: Given that you include this file verbatim into your own
-## source tree, you are justified in saying that it remains separate
-## from your package, and that this way you are simply just using GNU
-## shtool. So, in this situation, there is no requirement that your
-## package itself is licensed under the GNU General Public License in
-## order to take advantage of GNU shtool.
-##
-
-##
-## Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]
-##
-## Available commands:
-## echo Print string with optional construct expansion
-## install Install a program, script or datafile
-## mkdir Make one or more directories
-## path Deal with program paths
-##
-## Not available commands (because module was not built-in):
-## mdate Pretty-print modification time of a file or dir
-## table Pretty-print a field-separated list as a table
-## prop Display progress with a running propeller
-## move Move files with simultaneous substitution
-## mkln Make link with calculation of relative paths
-## mkshadow Make a shadow tree through symbolic links
-## fixperm Fix file permissions inside a source tree
-## rotate Logfile rotation
-## tarball Roll distribution tarballs
-## subst Apply sed(1) substitution operations
-## guessos Simple operating system guesser
-## arx Extended archive command
-## slo Separate linker options by library class
-## scpp Sharing C Pre-Processor
-## version Maintain a version information file
-##
-
-if [ $# -eq 0 ]; then
- echo "$0:Error: invalid command line" 1>&2
- echo "$0:Hint: run \`$0 -h' for usage" 1>&2
- exit 1
-fi
-if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
- echo "This is GNU shtool, version 1.6.2 (02-Nov-2002)"
- echo "Copyright (c) 1994-2002 Ralf S. Engelschall <rse@engelschall.com>"
- echo "Report bugs to <bug-shtool@gnu.org>"
- echo ''
- echo "Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]"
- echo ''
- echo 'Available global <options>:'
- echo ' -v, --version display shtool version information'
- echo ' -h, --help display shtool usage help page (this one)'
- echo ' -d, --debug display shell trace information'
- echo ' -r, --recreate recreate this shtool script via shtoolize'
- echo ''
- echo 'Available <cmd-name> [<cmd-options>] [<cmd-args>]:'
- echo ' echo [-n|--newline] [-e|--expand] [<str> ...]'
- echo ' install [-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy]'
- echo ' [-C|--compare-copy] [-s|--strip] [-m|--mode <mode>]'
- echo ' [-o|--owner <owner>] [-g|--group <group>] [-e|--exec'
- echo ' <sed-cmd>] <file> [<file> ...] <path>'
- echo ' mkdir [-t|--trace] [-f|--force] [-p|--parents] [-m|--mode'
- echo ' <mode>] [-o|--owner <owner>] [-g|--group <group>] <dir>'
- echo ' [<dir> ...]'
- echo ' path [-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename]'
- echo ' [-m|--magic] [-p|--path <path>] <str> [<str> ...]'
- echo ''
- echo 'Not available <cmd-name> (because module was not built-in):'
- echo ' mdate [-n|--newline] [-z|--zero] [-s|--shorten] [-d|--digits]'
- echo ' [-f|--field-sep <str>] [-o|--order <spec>] <path>'
- echo ' table [-F|--field-sep <sep>] [-w|--width <width>] [-c|--columns'
- echo ' <cols>] [-s|--strip <strip>] <str><sep><str>...'
- echo ' prop [-p|--prefix <str>]'
- echo ' move [-v|--verbose] [-t|--trace] [-e|--expand] [-p|--preserve]'
- echo ' <src-file> <dst-file>'
- echo ' mkln [-t|--trace] [-f|--force] [-s|--symbolic] <src-path>'
- echo ' [<src-path> ...] <dst-path>'
- echo ' mkshadow [-v|--verbose] [-t|--trace] [-a|--all] <src-dir> <dst-dir>'
- echo ' fixperm [-v|--verbose] [-t|--trace] <path> [<path> ...]'
- echo ' rotate [-v|--verbose] [-t|--trace] [-f|--force] [-n|--num-files'
- echo ' <count>] [-s|--size <size>] [-c|--copy] [-r|--remove]'
- echo ' [-a|--archive-dir <dir>] [-z|--compress [<tool>:]<level>]'
- echo ' [-b|--background] [-d|--delay] [-p|--pad <len>] [-o|--owner'
- echo ' <owner>] [-g|--group <group>] [-m|--mode <mode>] [-M|--migrate'
- echo ' <cmd>] [-P|--prolog <cmd>] [-E|--epilog <cmd>] <file> [...]'
- echo ' tarball [-t|--trace] [-v|--verbose] [-o|--output <tarball>]'
- echo ' [-c|--compress <prog>] [-d|--directory <dir>] [-u|--user'
- echo ' <user>] [-g|--group <group>] [-e|--exclude <pattern>]'
- echo ' <path> [<path> ...]'
- echo ' subst [-v|--verbose] [-t|--trace] [-n|--nop] [-s|--stealth]'
- echo ' [-i|--interactive] [-b|--backup <ext>] [-e|--exec <cmd>]'
- echo ' [-f|--file <cmd-file>] [<file>] [...]'
- echo ' guessos '
- echo ' arx [-t|--trace] [-C|--command <cmd>] <op> <archive> [<file>'
- echo ' ...]'
- echo ' slo [-p|--prefix <str>] -- -L<dir> -l<lib> [-L<dir> -l<lib>'
- echo ' ...]'
- echo ' scpp [-v|--verbose] [-p|--preserve] [-f|--filter <filter>]'
- echo ' [-o|--output <ofile>] [-t|--template <tfile>] [-M|--mark'
- echo ' <mark>] [-D|--define <dname>] [-C|--class <cname>]'
- echo ' <file> [<file> ...]'
- echo ' version [-l|--language <lang>] [-n|--name <name>] [-p|--prefix'
- echo ' <prefix>] [-s|--set <version>] [-e|--edit] [-i|--increase'
- echo ' <knob>] [-d|--display <type>] <file>'
- echo ''
- exit 0
-fi
-if [ ".$1" = ".-v" -o ".$1" = ."--version" ]; then
- echo "GNU shtool 1.6.2 (02-Nov-2002)"
- exit 0
-fi
-if [ ".$1" = ".-r" -o ".$1" = ."--recreate" ]; then
- shtoolize -oshtool echo install mkdir path
- exit 0
-fi
-if [ ".$1" = ".-d" -o ".$1" = ."--debug" ]; then
- shift
- set -x
-fi
-name=`echo "$0" | sed -e 's;.*/\([^/]*\)$;\1;' -e 's;-sh$;;' -e 's;\.sh$;;'`
-case "$name" in
- echo|install|mkdir|path )
- # implicit tool command selection
- tool="$name"
- ;;
- * )
- # explicit tool command selection
- tool="$1"
- shift
- ;;
-esac
-arg_spec=""
-opt_spec=""
-gen_tmpfile=no
-
-##
-## DISPATCH INTO SCRIPT PROLOG
-##
-
-case $tool in
- echo )
- str_tool="echo"
- str_usage="[-n|--newline] [-e|--expand] [<str> ...]"
- arg_spec="0+"
- opt_spec="n.e."
- opt_alias="n:newline,e:expand"
- opt_n=no
- opt_e=no
- ;;
- install )
- str_tool="install"
- str_usage="[-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy] [-C|--compare-copy] [-s|--strip] [-m|--mode <mode>] [-o|--owner <owner>] [-g|--group <group>] [-e|--exec <sed-cmd>] <file> [<file> ...] <path>"
- arg_spec="1+"
- opt_spec="v.t.d.c.C.s.m:o:g:e+"
- opt_alias="v:verbose,t:trace,d:mkdir,c:copy,C:compare-copy,s:strip,m:mode,o:owner,g:group,e:exec"
- opt_v=no
- opt_t=no
- opt_d=no
- opt_c=no
- opt_C=no
- opt_s=no
- opt_m="0755"
- opt_o=""
- opt_g=""
- opt_e=""
- ;;
- mkdir )
- str_tool="mkdir"
- str_usage="[-t|--trace] [-f|--force] [-p|--parents] [-m|--mode <mode>] [-o|--owner <owner>] [-g|--group <group>] <dir> [<dir> ...]"
- arg_spec="1+"
- opt_spec="t.f.p.m:o:g:"
- opt_alias="t:trace,f:force,p:parents,m:mode,o:owner,g:group"
- opt_t=no
- opt_f=no
- opt_p=no
- opt_m=""
- opt_o=""
- opt_g=""
- ;;
- path )
- str_tool="path"
- str_usage="[-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename] [-m|--magic] [-p|--path <path>] <str> [<str> ...]"
- gen_tmpfile=yes
- arg_spec="1+"
- opt_spec="s.r.d.b.m.p:"
- opt_alias="s:suppress,r:reverse,d:dirname,b:basename,m:magic,p:path"
- opt_s=no
- opt_r=no
- opt_d=no
- opt_b=no
- opt_m=no
- opt_p="$PATH"
- ;;
- -* )
- echo "$0:Error: unknown option \`$tool'" 2>&1
- echo "$0:Hint: run \`$0 -h' for usage" 2>&1
- exit 1
- ;;
- * )
- echo "$0:Error: unknown command \`$tool'" 2>&1
- echo "$0:Hint: run \`$0 -h' for usage" 2>&1
- exit 1
- ;;
-esac
-
-##
-## COMMON UTILITY CODE
-##
-
-# commonly used ASCII values
-ASC_TAB=" "
-ASC_NL="
-"
-
-# determine name of tool
-if [ ".$tool" != . ]; then
- # used inside shtool script
- toolcmd="$0 $tool"
- toolcmdhelp="shtool $tool"
- msgprefix="shtool:$tool"
-else
- # used as standalone script
- toolcmd="$0"
- toolcmdhelp="sh $0"
- msgprefix="$str_tool"
-fi
-
-# parse argument specification string
-eval `echo $arg_spec |\
- sed -e 's/^\([0-9]*\)\([+=]\)/arg_NUMS=\1; arg_MODE=\2/'`
-
-# parse option specification string
-eval `echo h.$opt_spec |\
- sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'`
-
-# parse option alias string
-eval `echo h:help,$opt_alias |\
- tr 'x-' 'x_' | sed -e 's/\([a-zA-Z0-9]\):\([^,]*\),*/opt_ALIAS_\2=\1;/g'`
-
-# interate over argument line
-opt_PREV=''
-while [ $# -gt 0 ]; do
- # special option stops processing
- if [ ".$1" = ".--" ]; then
- shift
- break
- fi
-
- # determine option and argument
- opt_ARG_OK=no
- if [ ".$opt_PREV" != . ]; then
- # merge previous seen option with argument
- opt_OPT="$opt_PREV"
- opt_ARG="$1"
- opt_ARG_OK=yes
- opt_PREV=''
- else
- # split argument into option and argument
- case "$1" in
- --[a-zA-Z0-9]*=*)
- eval `echo "x$1" |\
- sed -e 's/^x--\([a-zA-Z0-9-]*\)=\(.*\)$/opt_OPT="\1";opt_ARG="\2"/'`
- opt_STR=`echo $opt_OPT | tr 'x-' 'x_'`
- eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
- ;;
- --[a-zA-Z0-9]*)
- opt_OPT=`echo "x$1" | cut -c4-`
- opt_STR=`echo $opt_OPT | tr 'x-' 'x_'`
- eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
- opt_ARG=''
- ;;
- -[a-zA-Z0-9]*)
- eval `echo "x$1" |\
- sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \
- -e 's/";\(.*\)$/"; opt_ARG="\1"/'`
- ;;
- -[a-zA-Z0-9])
- opt_OPT=`echo "x$1" | cut -c3-`
- opt_ARG=''
- ;;
- *)
- break
- ;;
- esac
- fi
-
- # eat up option
- shift
-
- # determine whether option needs an argument
- eval "opt_MODE=\$opt_MODE_${opt_OPT}"
- if [ ".$opt_ARG" = . -a ".$opt_ARG_OK" != .yes ]; then
- if [ ".$opt_MODE" = ".:" -o ".$opt_MODE" = ".+" ]; then
- opt_PREV="$opt_OPT"
- continue
- fi
- fi
-
- # process option
- case $opt_MODE in
- '.' )
- # boolean option
- eval "opt_${opt_OPT}=yes"
- ;;
- ':' )
- # option with argument (multiple occurances override)
- eval "opt_${opt_OPT}=\"\$opt_ARG\""
- ;;
- '+' )
- # option with argument (multiple occurances append)
- eval "opt_${opt_OPT}=\"\$opt_${opt_OPT}\${ASC_NL}\$opt_ARG\""
- ;;
- * )
- echo "$msgprefix:Error: unknown option: \`$opt_OPT'" 1>&2
- echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
- exit 1
- ;;
- esac
-done
-if [ ".$opt_PREV" != . ]; then
- echo "$msgprefix:Error: missing argument to option \`$opt_PREV'" 1>&2
- echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
- exit 1
-fi
-
-# process help option
-if [ ".$opt_h" = .yes ]; then
- echo "Usage: $toolcmdhelp $str_usage"
- exit 0
-fi
-
-# complain about incorrect number of arguments
-case $arg_MODE in
- '=' )
- if [ $# -ne $arg_NUMS ]; then
- echo "$msgprefix:Error: invalid number of arguments (exactly $arg_NUMS expected)" 1>&2
- echo "$msgprefix:Hint: run \`$toolcmd -h' or \`man shtool' for details" 1>&2
- exit 1
- fi
- ;;
- '+' )
- if [ $# -lt $arg_NUMS ]; then
- echo "$msgprefix:Error: invalid number of arguments (at least $arg_NUMS expected)" 1>&2
- echo "$msgprefix:Hint: run \`$toolcmd -h' or \`man shtool' for details" 1>&2
- exit 1
- fi
- ;;
-esac
-
-# establish a temporary file on request
-if [ ".$gen_tmpfile" = .yes ]; then
- if [ ".$TMPDIR" != . ]; then
- tmpdir="$TMPDIR"
- elif [ ".$TEMPDIR" != . ]; then
- tmpdir="$TEMPDIR"
- else
- tmpdir="/tmp"
- fi
- tmpfile="$tmpdir/.shtool.$$"
- rm -f $tmpfile >/dev/null 2>&1
- touch $tmpfile
- chmod 600 $tmpfile
-fi
-
-##
-## DISPATCH INTO SCRIPT BODY
-##
-
-case $tool in
-
-echo )
- ##
- ## echo -- Print string with optional construct expansion
- ## Copyright (c) 1998-2002 Ralf S. Engelschall <rse@engelschall.com>
- ## Originally written for WML as buildinfo
- ##
-
- text="$*"
-
- # check for broken escape sequence expansion
- seo=''
- bytes=`echo '\1' | wc -c | awk '{ printf("%s", $1); }'`
- if [ ".$bytes" != .3 ]; then
- bytes=`echo -E '\1' | wc -c | awk '{ printf("%s", $1); }'`
- if [ ".$bytes" = .3 ]; then
- seo='-E'
- fi
- fi
-
- # check for existing -n option (to suppress newline)
- minusn=''
- bytes=`echo -n 123 2>/dev/null | wc -c | awk '{ printf("%s", $1); }'`
- if [ ".$bytes" = .3 ]; then
- minusn='-n'
- fi
-
- # determine terminal bold sequence
- term_bold=''
- term_norm=''
- if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[Bb]'`" != . ]; then
- case $TERM in
- # for the most important terminal types we directly know the sequences
- xterm|xterm*|vt220|vt220*)
- term_bold=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
- term_norm=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
- ;;
- vt100|vt100*|cygwin)
- term_bold=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
- term_norm=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
- ;;
- # for all others, we try to use a possibly existing `tput' or `tcout' utility
- * )
- paths=`echo $PATH | sed -e 's/:/ /g'`
- for tool in tput tcout; do
- for dir in $paths; do
- if [ -r "$dir/$tool" ]; then
- for seq in bold md smso; do # 'smso' is last
- bold="`$dir/$tool $seq 2>/dev/null`"
- if [ ".$bold" != . ]; then
- term_bold="$bold"
- break
- fi
- done
- if [ ".$term_bold" != . ]; then
- for seq in sgr0 me rmso init reset; do # 'reset' is last
- norm="`$dir/$tool $seq 2>/dev/null`"
- if [ ".$norm" != . ]; then
- term_norm="$norm"
- break
- fi
- done
- fi
- break
- fi
- done
- if [ ".$term_bold" != . -a ".$term_norm" != . ]; then
- break;
- fi
- done
- ;;
- esac
- if [ ".$term_bold" = . -o ".$term_norm" = . ]; then
- echo "$msgprefix:Warning: unable to determine terminal sequence for bold mode" 1>&2
- term_bold=''
- term_norm=''
- fi
- fi
-
- # determine user name
- username=''
- if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[uUgG]'`" != . ]; then
- username="$LOGNAME"
- if [ ".$username" = . ]; then
- username="$USER"
- if [ ".$username" = . ]; then
- username="`(whoami) 2>/dev/null |\
- awk '{ printf("%s", $1); }'`"
- if [ ".$username" = . ]; then
- username="`(who am i) 2>/dev/null |\
- awk '{ printf("%s", $1); }'`"
- if [ ".$username" = . ]; then
- username='unknown'
- fi
- fi
- fi
- fi
- fi
-
- # determine user id
- userid=''
- if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%U'`" != . ]; then
- userid="`(id -u) 2>/dev/null`"
- if [ ".$userid" = . ]; then
- str="`(id) 2>/dev/null`"
- if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then
- userid=`echo $str | sed -e 's/^uid[ ]*=[ ]*//' -e 's/(.*//'`
- fi
- if [ ".$userid" = . ]; then
- userid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
- sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
- if [ ".$userid" = . ]; then
- userid=`(ypcat passwd) 2>/dev/null |
- egrep "^${username}:" | \
- sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
- if [ ".$userid" = . ]; then
- userid='?'
- fi
- fi
- fi
- fi
- fi
-
- # determine (primary) group id
- groupid=''
- if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[gG]'`" != . ]; then
- groupid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
- sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
- if [ ".$groupid" = . ]; then
- groupid=`(ypcat passwd) 2>/dev/null | egrep "^${username}:" | \
- sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
- if [ ".$groupid" = . ]; then
- groupid='?'
- fi
- fi
- fi
-
- # determine (primary) group name
- groupname=''
- if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%g'`" != . ]; then
- groupname=`egrep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
- sed -e 's/:.*$//'`
- if [ ".$groupname" = . ]; then
- groupname=`(ypcat group) 2>/dev/null | \
- egrep "^[^:]*:[^:]*:${groupid}:" | \
- sed -e 's/:.*$//'`
- if [ ".$groupname" = . ]; then
- groupname='?'
- fi
- fi
- fi
-
- # determine host and domain name
- hostname=''
- domainname=''
- if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%h'`" != . ]; then
- hostname="`(uname -n) 2>/dev/null |\
- awk '{ printf("%s", $1); }'`"
- if [ ".$hostname" = . ]; then
- hostname="`(hostname) 2>/dev/null |\
- awk '{ printf("%s", $1); }'`"
- if [ ".$hostname" = . ]; then
- hostname='unknown'
- fi
- fi
- case $hostname in
- *.* )
- domainname=".`echo $hostname | cut -d. -f2-`"
- hostname="`echo $hostname | cut -d. -f1`"
- ;;
- esac
- fi
- if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%d'`" != . ]; then
- if [ ".$domainname" = . ]; then
- if [ -f /etc/resolv.conf ]; then
- domainname="`egrep '^[ ]*domain' /etc/resolv.conf | sed -e 'q' |\
- sed -e 's/.*domain//' \
- -e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \
- -e 's/^\.//' -e 's/^/./' |\
- awk '{ printf("%s", $1); }'`"
- if [ ".$domainname" = . ]; then
- domainname="`egrep '^[ ]*search' /etc/resolv.conf | sed -e 'q' |\
- sed -e 's/.*search//' \
- -e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \
- -e 's/ .*//' -e 's/ .*//' \
- -e 's/^\.//' -e 's/^/./' |\
- awk '{ printf("%s", $1); }'`"
- fi
- fi
- fi
- fi
-
- # determine current time
- time_day=''
- time_month=''
- time_year=''
- time_monthname=''
- if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[DMYm]'`" != . ]; then
- time_day=`date '+%d'`
- time_month=`date '+%m'`
- time_year=`date '+%Y' 2>/dev/null`
- if [ ".$time_year" = . ]; then
- time_year=`date '+%y'`
- case $time_year in
- [5-9][0-9]) time_year="19$time_year" ;;
- [0-4][0-9]) time_year="20$time_year" ;;
- esac
- fi
- case $time_month in
- 1|01) time_monthname='Jan' ;;
- 2|02) time_monthname='Feb' ;;
- 3|03) time_monthname='Mar' ;;
- 4|04) time_monthname='Apr' ;;
- 5|05) time_monthname='May' ;;
- 6|06) time_monthname='Jun' ;;
- 7|07) time_monthname='Jul' ;;
- 8|08) time_monthname='Aug' ;;
- 9|09) time_monthname='Sep' ;;
- 10) time_monthname='Oct' ;;
- 11) time_monthname='Nov' ;;
- 12) time_monthname='Dec' ;;
- esac
- fi
-
- # expand special ``%x'' constructs
- if [ ".$opt_e" = .yes ]; then
- text=`echo $seo "$text" |\
- sed -e "s/%B/${term_bold}/g" \
- -e "s/%b/${term_norm}/g" \
- -e "s/%u/${username}/g" \
- -e "s/%U/${userid}/g" \
- -e "s/%g/${groupname}/g" \
- -e "s/%G/${groupid}/g" \
- -e "s/%h/${hostname}/g" \
- -e "s/%d/${domainname}/g" \
- -e "s/%D/${time_day}/g" \
- -e "s/%M/${time_month}/g" \
- -e "s/%Y/${time_year}/g" \
- -e "s/%m/${time_monthname}/g" 2>/dev/null`
- fi
-
- # create output
- if [ .$opt_n = .no ]; then
- echo $seo "$text"
- else
- # the harder part: echo -n is best, because
- # awk may complain about some \xx sequences.
- if [ ".$minusn" != . ]; then
- echo $seo $minusn "$text"
- else
- echo dummy | awk '{ printf("%s", TEXT); }' TEXT="$text"
- fi
- fi
- ;;
-
-install )
- ##
- ## install -- Install a program, script or datafile
- ## Copyright (c) 1997-2002 Ralf S. Engelschall <rse@engelschall.com>
- ## Originally written for shtool
- ##
-
- # special case: "shtool install -d <dir> [...]" internally
- # maps to "shtool mkdir -f -p -m 755 <dir> [...]"
- if [ "$opt_d" = yes ]; then
- cmd="$0 mkdir -f -p -m 755"
- if [ ".$opt_o" != . ]; then
- cmd="$cmd -o '$opt_o'"
- fi
- if [ ".$opt_g" != . ]; then
- cmd="$cmd -g '$opt_g'"
- fi
- if [ ".$opt_v" = .yes ]; then
- cmd="$cmd -v"
- fi
- if [ ".$opt_t" = .yes ]; then
- cmd="$cmd -t"
- fi
- for dir in "$@"; do
- eval "$cmd $dir" || exit $?
- done
- exit 0
- fi
-
- # determine source(s) and destination
- argc=$#
- srcs=""
- while [ $# -gt 1 ]; do
- srcs="$srcs $1"
- shift
- done
- dstpath="$1"
-
- # type check for destination
- dstisdir=0
- if [ -d $dstpath ]; then
- dstpath=`echo "$dstpath" | sed -e 's:/$::'`
- dstisdir=1
- fi
-
- # consistency check for destination
- if [ $argc -gt 2 -a $dstisdir = 0 ]; then
- echo "$msgprefix:Error: multiple sources require destination to be directory" 1>&2
- exit 1
- fi
-
- # iterate over all source(s)
- for src in $srcs; do
- dst=$dstpath
-
- # if destination is a directory, append the input filename
- if [ $dstisdir = 1 ]; then
- dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'`
- dst="$dst/$dstfile"
- fi
-
- # check for correct arguments
- if [ ".$src" = ".$dst" ]; then
- echo "$msgprefix:Warning: source and destination are the same - skipped" 1>&2
- continue
- fi
- if [ -d "$src" ]; then
- echo "$msgprefix:Warning: source \`$src' is a directory - skipped" 1>&2
- continue
- fi
-
- # make a temp file name in the destination directory
- dsttmp=`echo $dst |\
- sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;' \
- -e "s;\$;/#INST@$$#;"`
-
- # verbosity
- if [ ".$opt_v" = .yes ]; then
- echo "$src -> $dst" 1>&2
- fi
-
- # copy or move the file name to the temp name
- # (because we might be not allowed to change the source)
- if [ ".$opt_C" = .yes ]; then
- opt_c=yes
- fi
- if [ ".$opt_c" = .yes ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "cp $src $dsttmp" 1>&2
- fi
- cp $src $dsttmp || exit $?
- else
- if [ ".$opt_t" = .yes ]; then
- echo "mv $src $dsttmp" 1>&2
- fi
- mv $src $dsttmp || exit $?
- fi
-
- # adjust the target file
- if [ ".$opt_e" != . ]; then
- sed='sed'
- OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_e; IFS="$OIFS"
- for e
- do
- sed="$sed -e '$e'"
- done
- cp $dsttmp $dsttmp.old
- eval "$sed <$dsttmp.old >$dsttmp" || exit $?
- rm -f $dsttmp.old
- fi
- if [ ".$opt_s" = .yes ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "strip $dsttmp" 1>&2
- fi
- strip $dsttmp || exit $?
- fi
- if [ ".$opt_o" != . ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "chown $opt_o $dsttmp" 1>&2
- fi
- chown $opt_o $dsttmp || exit $?
- fi
- if [ ".$opt_g" != . ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "chgrp $opt_g $dsttmp" 1>&2
- fi
- chgrp $opt_g $dsttmp || exit $?
- fi
- if [ ".$opt_m" != ".-" ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "chmod $opt_m $dsttmp" 1>&2
- fi
- chmod $opt_m $dsttmp || exit $?
- fi
-
- # determine whether to do a quick install
- # (has to be done _after_ the strip was already done)
- quick=no
- if [ ".$opt_C" = .yes ]; then
- if [ -r $dst ]; then
- if cmp -s $src $dst; then
- quick=yes
- fi
- fi
- fi
-
- # finally, install the file to the real destination
- if [ $quick = yes ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "rm -f $dsttmp" 1>&2
- fi
- rm -f $dsttmp
- else
- if [ ".$opt_t" = .yes ]; then
- echo "rm -f $dst && mv $dsttmp $dst" 1>&2
- fi
- rm -f $dst && mv $dsttmp $dst
- fi
- done
- ;;
-
-mkdir )
- ##
- ## mkdir -- Make one or more directories
- ## Copyright (c) 1996-2002 Ralf S. Engelschall <rse@engelschall.com>
- ## Originally written for public domain by Noah Friedman <friedman@prep.ai.mit.edu>
- ## Cleaned up and enhanced for shtool
- ##
-
- errstatus=0
- for p in ${1+"$@"}; do
- # if the directory already exists...
- if [ -d "$p" ]; then
- if [ ".$opt_f" = .no -a ".$opt_p" = .no ]; then
- echo "$msgprefix:Error: directory already exists: $p" 1>&2
- errstatus=1
- break
- else
- continue
- fi
- fi
- # if the directory has to be created...
- if [ ".$opt_p" = .no ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "mkdir $p" 1>&2
- fi
- mkdir $p || errstatus=$?
- if [ ".$opt_o" != . ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "chown $opt_o $p" 1>&2
- fi
- chown $opt_o $p || errstatus=$?
- fi
- if [ ".$opt_g" != . ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "chgrp $opt_g $p" 1>&2
- fi
- chgrp $opt_g $p || errstatus=$?
- fi
- if [ ".$opt_m" != . ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "chmod $opt_m $p" 1>&2
- fi
- chmod $opt_m $p || errstatus=$?
- fi
- else
- # the smart situation
- set fnord `echo ":$p" |\
- sed -e 's/^:\//%/' \
- -e 's/^://' \
- -e 's/\// /g' \
- -e 's/^%/\//'`
- shift
- pathcomp=''
- for d in ${1+"$@"}; do
- pathcomp="$pathcomp$d"
- case "$pathcomp" in
- -* ) pathcomp="./$pathcomp" ;;
- esac
- if [ ! -d "$pathcomp" ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "mkdir $pathcomp" 1>&2
- fi
- mkdir $pathcomp || errstatus=$?
- if [ ".$opt_o" != . ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "chown $opt_o $pathcomp" 1>&2
- fi
- chown $opt_o $pathcomp || errstatus=$?
- fi
- if [ ".$opt_g" != . ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "chgrp $opt_g $pathcomp" 1>&2
- fi
- chgrp $opt_g $pathcomp || errstatus=$?
- fi
- if [ ".$opt_m" != . ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "chmod $opt_m $pathcomp" 1>&2
- fi
- chmod $opt_m $pathcomp || errstatus=$?
- fi
- fi
- pathcomp="$pathcomp/"
- done
- fi
- done
- exit $errstatus
- ;;
-
-path )
- ##
- ## path -- Deal with program paths
- ## Copyright (c) 1998-2002 Ralf S. Engelschall <rse@engelschall.com>
- ## Originally written for Apache
- ##
-
- namelist="$*"
-
- # check whether the test command supports the -x option
- if [ -x /bin/sh ] 2>/dev/null; then
- minusx="-x"
- else
- minusx="-r"
- fi
-
- # split path string
- paths="`echo $opt_p |\
- sed -e 's/^:/.:/' \
- -e 's/::/:.:/g' \
- -e 's/:$/:./' \
- -e 's/:/ /g'`"
-
- # SPECIAL REQUEST
- # translate forward to reverse path
- if [ ".$opt_r" = .yes ]; then
- if [ "x$namelist" = "x." ]; then
- rp='.'
- else
- rp=''
- for pe in `IFS="$IFS/"; echo $namelist`; do
- rp="../$rp"
- done
- fi
- echo $rp | sed -e 's:/$::'
- exit 0
- fi
-
- # SPECIAL REQUEST
- # strip out directory or base name
- if [ ".$opt_d" = .yes ]; then
- echo "$namelist" |\
- sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;'
- exit 0
- fi
- if [ ".$opt_b" = .yes ]; then
- echo "$namelist" |\
- sed -e 's;.*/\([^/]*\)$;\1;'
- exit 0
- fi
-
- # MAGIC SITUATION
- # Perl Interpreter (perl)
- if [ ".$opt_m" = .yes -a ".$namelist" = .perl ]; then
- rm -f $tmpfile >/dev/null 2>&1
- touch $tmpfile
- found=0
- pc=99
- for dir in $paths; do
- dir=`echo $dir | sed -e 's;/*$;;'`
- nc=99
- for name in perl perl5 miniperl; do
- if [ $minusx "$dir/$name" -a ! -d "$dir/$name" ]; then
- perl="$dir/$name"
- pv=`$perl -e 'printf("%.3f", $]);'`
- echo "$pv:$pc:$nc:$perl" >>$tmpfile
- found=1
- fi
- nc=`expr $nc - 1`
- done
- pc=`expr $pc - 1`
- done
- if [ $found = 1 ]; then
- perl="`cat $tmpfile | sort -r -u | sed -e 'q' | cut -d: -f4`"
- rm -f $tmpfile >/dev/null 2>&1
- echo "$perl"
- exit 0
- fi
- rm -f $tmpfile >/dev/null 2>&1
- exit 1
- fi
-
- # MAGIC SITUATION
- # C pre-processor (cpp)
- if [ ".$opt_m" = .yes -a ".$namelist" = .cpp ]; then
- echo >$tmpfile.c "#include <assert.h>"
- echo >>$tmpfile.c "Syntax Error"
- # 1. try the standard cc -E approach
- cpp="${CC-cc} -E"
- (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out
- my_error=`grep -v '^ *+' $tmpfile.out`
- if [ ".$my_error" != . ]; then
- # 2. try the cc -E approach and GCC's -traditional-ccp option
- cpp="${CC-cc} -E -traditional-cpp"
- (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out
- my_error=`grep -v '^ *+' $tmpfile.out`
- if [ ".$my_error" != . ]; then
- # 3. try a standalone cpp command in path and lib dirs
- for path in $paths /lib /usr/lib /usr/local/lib; do
- path=`echo $path | sed -e 's;/*$;;'`
- if [ $minusx "$path/cpp" -a ! -d "$path/cpp" ]; then
- cpp="$path/cpp"
- break
- fi
- done
- if [ ".$cpp" != . ]; then
- (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out
- my_error=`grep -v '^ *+' $tmpfile.out`
- if [ ".$my_error" != . ]; then
- # ok, we gave up...
- cpp=''
- fi
- fi
- fi
- fi
- rm -f $tmpfile >/dev/null 2>&1
- rm -f $tmpfile.c $tmpfile.out >/dev/null 2>&1
- if [ ".$cpp" != . ]; then
- echo "$cpp"
- exit 0
- fi
- exit 1
- fi
-
- # STANDARD SITUATION
- # iterate over names
- for name in $namelist; do
- # iterate over paths
- for path in $paths; do
- path=`echo $path | sed -e 's;/*$;;'`
- if [ $minusx "$path/$name" -a ! -d "$path/$name" ]; then
- if [ ".$opt_s" != .yes ]; then
- echo "$path/$name"
- fi
- exit 0
- fi
- done
- done
- exit 1
- ;;
-
-esac
-
-exit 0
-
-##EOF##
diff --git a/buildconf b/buildconf
deleted file mode 100755
index 5cd9ade76e..0000000000
--- a/buildconf
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-# $Id$
-
-while test $# -gt 0; do
- if test "$1" = "--copy"; then
- automake_flags=--copy
- fi
-
- if test "$1" = "--ZendEngine2"; then
- ZENDDIR=ZendEngine2
- echo "Using Zend Engine 2 code"
- fi
-
- shift
-done
-
-if test -z "$ZENDDIR"; then
- ZENDDIR=Zend
- echo "using default Zend directory"
-fi
-
-rm -f generated_lists
-
-${MAKE:-make} -s -f build/build.mk AMFLAGS="$automake_flags" ZENDDIR="$ZENDDIR"
diff --git a/bundle/expat/Changes b/bundle/expat/Changes
deleted file mode 100644
index 1df159b652..0000000000
--- a/bundle/expat/Changes
+++ /dev/null
@@ -1,99 +0,0 @@
-Release 1.95.5 Fri Sep 6 2002
- - Added XML_UseForeignDTD() for improved SAX2 support.
- - Added XML_GetFeatureList().
- - Defined XML_Bool type and the values XML_TRUE and XML_FALSE.
- - Use an incomplete struct instead of a void* for the parser
- (may not retain).
- - Fixed UTF-8 decoding bug that caused legal UTF-8 to be rejected.
- - Finally fixed bug where default handler would report DTD
- events that were already handled by another handler.
- Initial patch contributed by Darryl Miller.
- - Removed unnecessary DllMain() function that caused static
- linking into a DLL to be difficult.
- - Added VC++ projects for building static libraries.
- - Reduced line-length for all source code and headers to be
- no longer than 80 characters, to help with AS/400 support.
- - Reduced memory copying during parsing (SF patch #600964).
- - Fixed a variety of bugs: see SF issues 580793, 434664,
- 483514, 580503, 581069, 584041, 584183, 584832, 585537,
- 596555, 596678, 598352, 598944, 599715, 600479, 600971.
-
-Release 1.95.4 Fri Jul 12 2002
- - Added support for VMS, contributed by Craig Berry. See
- vms/README.vms for more information.
- - Added Mac OS (classic) support, with a makefile for MPW,
- contributed by Thomas Wegner and Daryle Walker.
- - Added Borland C++ Builder 5 / BCC 5.5 support, contributed
- by Patrick McConnell (SF patch #538032).
- - Fixed a variety of bugs: see SF issues 441449, 563184,
- 564342, 566334, 566901, 569461, 570263, 575168, 579196.
- - Made skippedEntityHandler conform to SAX2 (see source comment)
- - Re-implemented WFC: Entity Declared from XML 1.0 spec and
- added a new error "entity declared in parameter entity":
- see SF bug report 569461 and SF patch 578161
- - Re-implemented section 5.1 from XML 1.0 spec:
- see SF bug report 570263 and SF patch 578161
-
-Release 1.95.3 Mon Jun 3 2002
- - Added a project to the MSVC workspace to create a wchar_t
- version of the library; the DLLs are named libexpatw.dll.
- - Changed the name of the Windows DLLs from expat.dll to
- libexpat.dll; this fixes SF bug #432456.
- - Added the XML_ParserReset() API function.
- - Fixed XML_SetReturnNSTriplet() to work for element names.
- - Made the XML_UNICODE builds usable (thanks, Karl!).
- - Allow xmlwf to read from standard input.
- - Install a man page for xmlwf on Unix systems.
- - Fixed many bugs; see SF bug reports 231864, 461380, 464837,
- 466885, 469226, 477667, 484419, 487840, 494749, 496505,
- 547350. Other bugs which we can't test as easily may also
- have been fixed, especially in the area of build support.
-
-Release 1.95.2 Fri Jul 27 2001
- - More changes to make MSVC happy with the build; add a single
- workspace to support both the library and xmlwf application.
- - Added a Windows installer for Windows users; includes
- xmlwf.exe.
- - Added compile-time constants that can be used to determine the
- Expat version
- - Removed a lot of GNU-specific dependencies to aide portability
- among the various Unix flavors.
- - Fix the UTF-8 BOM bug.
- - Cleaned up warning messages for several compilers.
- - Added the -Wall, -Wstrict-prototypes options for GCC.
-
-Release 1.95.1 Sun Oct 22 15:11:36 EDT 2000
- - Changes to get expat to build under Microsoft compiler
- - Removed all aborts and instead return an UNEXPECTED_STATE error.
- - Fixed a bug where a stray '%' in an entity value would cause an
- abort.
- - Defined XML_SetEndNamespaceDeclHandler. Thanks to Darryl Miles for
- finding this oversight.
- - Changed default patterns in lib/Makefile.in to fit non-GNU makes
- Thanks to robin@unrated.net for reporting and providing an
- account to test on.
- - The reference had the wrong label for XML_SetStartNamespaceDecl.
- Reported by an anonymous user.
-
-Release 1.95.0 Fri Sep 29 2000
- - XML_ParserCreate_MM
- Allows you to set a memory management suite to replace the
- standard malloc,realloc, and free.
- - XML_SetReturnNSTriplet
- If you turn this feature on when namespace processing is in
- effect, then qualified, prefixed element and attribute names
- are returned as "uri|name|prefix" where '|' is whatever
- separator character is used in namespace processing.
- - Merged in features from perl-expat
- o XML_SetElementDeclHandler
- o XML_SetAttlistDeclHandler
- o XML_SetXmlDeclHandler
- o XML_SetEntityDeclHandler
- o StartDoctypeDeclHandler takes 3 additional parameters:
- sysid, pubid, has_internal_subset
- o Many paired handler setters (like XML_SetElementHandler)
- now have corresponding individual handler setters
- o XML_GetInputContext for getting the input context of
- the current parse position.
- - Added reference material
- - Packaged into a distribution that builds a sharable library
diff --git a/bundle/expat/README b/bundle/expat/README
deleted file mode 100644
index 15bcdccb50..0000000000
--- a/bundle/expat/README
+++ /dev/null
@@ -1,72 +0,0 @@
-
- Expat, Release 1.95.2
-
-This is expat, a C library for parsing XML, written by James Clark.
-Expat is a stream-oriented XML parser. This means that you register
-handlers with the parser before starting the parse. These handlers
-are called when the parser discovers the associated structures in the
-document being parsed. A start tag is an example of the kind of
-structures for which you may register handlers.
-
-Windows users should use the expat_win32bin package, which includes
-both precompiled libraries and executalbes, and source code for
-developers.
-
-Expat is free software. You may copy, distribute, and modify it under
-the terms of the License contained in the file COPYING distributed
-with this package. This license is the same as the MIT/X Consortium
-license.
-
-Versions of expat that have an odd minor version (the middle number in
-the release above), are development releases and should be considered
-as beta software. Releases with even minor version numbers are
-intended to be production grade software.
-
-To build expat, you first run the configuration shell script in the
-top level distribution directory:
-
- ./configure
-
-There are many options which you may provide to configure (which you
-can discover by running configure with the --help option). But the
-one of most interest is the one that sets the installation directory.
-By default, the configure script will set things up to install
-libexpat into /usr/local/lib, expat.h into /usr/local/include, and
-xmlwf into /usr/local/bin. If, for example, you'd prefer to install
-into /home/me/mystuff/lib, /home/me/mystuff/include, and
-/home/me/mystuff/bin, you can tell configure about that with:
-
- ./configure --prefix=/home/me/mystuff
-
-After running the configure script, the "make" command will build
-things and "make install" will install things into their proper
-location. Note that you need to have write permission into the
-directories into which things will be installed.
-
-When building for use with C++, you may need to add additional
-compiler flags to support proper interaction with exceptions. This
-can be done by setting the CFLAGS environment variable. For example,
-when using GCC, you can use:
-
- CFLAGS=-fexceptions ./configure
-
-Note for Solaris users: The "ar" command is usually located in
-"/usr/ccs/bin", which is not in the default PATH. You will need to
-add this to your path for the "make" command, and probably also switch
-to GNU make (the "make" found in /usr/ccs/bin does not seem to work
-properly -- appearantly it does not understand .PHONY directives). If
-you're using ksh or bash, use this command to build:
-
- PATH=/usr/ccs/bin:$PATH make
-
-A reference manual is available in the file doc/reference.html in this
-distribution.
-
-The homepage for this project is http://expat.sourceforge.net/. There
-are links there to connect you to the bug reports page. If you need
-to report a bug when you don't have access to a browser, you may also
-send a bug report by email to expat-bugs@lists.sourceforge.net.
-
-Discussion related to the direction of future expat development takes
-place on expat-discuss@lists.sourceforge.net. Archives of this list
-may be found at http://www.geocrawler.com/redir-sf.php3?list=expat-discuss.
diff --git a/bundle/expat/README.php b/bundle/expat/README.php
deleted file mode 100644
index 187ef60be8..0000000000
--- a/bundle/expat/README.php
+++ /dev/null
@@ -1,11 +0,0 @@
-this is the PHP-bundled version of expat 1.95.1
-
-changes from the original version:
-- include <php_config.h> instead of <config.h>
-- include "php_compat.h" for namespace protection
-- hardcode version in xmlparse.c
-- stripped off all unneded files
-
-
-thies@thieso.net, 11th May, 2001
-
diff --git a/bundle/expat/ascii.h b/bundle/expat/ascii.h
deleted file mode 100644
index 073e8a5fb6..0000000000
--- a/bundle/expat/ascii.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
-*/
-
-#define ASCII_A 0x41
-#define ASCII_B 0x42
-#define ASCII_C 0x43
-#define ASCII_D 0x44
-#define ASCII_E 0x45
-#define ASCII_F 0x46
-#define ASCII_G 0x47
-#define ASCII_H 0x48
-#define ASCII_I 0x49
-#define ASCII_J 0x4A
-#define ASCII_K 0x4B
-#define ASCII_L 0x4C
-#define ASCII_M 0x4D
-#define ASCII_N 0x4E
-#define ASCII_O 0x4F
-#define ASCII_P 0x50
-#define ASCII_Q 0x51
-#define ASCII_R 0x52
-#define ASCII_S 0x53
-#define ASCII_T 0x54
-#define ASCII_U 0x55
-#define ASCII_V 0x56
-#define ASCII_W 0x57
-#define ASCII_X 0x58
-#define ASCII_Y 0x59
-#define ASCII_Z 0x5A
-
-#define ASCII_a 0x61
-#define ASCII_b 0x62
-#define ASCII_c 0x63
-#define ASCII_d 0x64
-#define ASCII_e 0x65
-#define ASCII_f 0x66
-#define ASCII_g 0x67
-#define ASCII_h 0x68
-#define ASCII_i 0x69
-#define ASCII_j 0x6A
-#define ASCII_k 0x6B
-#define ASCII_l 0x6C
-#define ASCII_m 0x6D
-#define ASCII_n 0x6E
-#define ASCII_o 0x6F
-#define ASCII_p 0x70
-#define ASCII_q 0x71
-#define ASCII_r 0x72
-#define ASCII_s 0x73
-#define ASCII_t 0x74
-#define ASCII_u 0x75
-#define ASCII_v 0x76
-#define ASCII_w 0x77
-#define ASCII_x 0x78
-#define ASCII_y 0x79
-#define ASCII_z 0x7A
-
-#define ASCII_0 0x30
-#define ASCII_1 0x31
-#define ASCII_2 0x32
-#define ASCII_3 0x33
-#define ASCII_4 0x34
-#define ASCII_5 0x35
-#define ASCII_6 0x36
-#define ASCII_7 0x37
-#define ASCII_8 0x38
-#define ASCII_9 0x39
-
-#define ASCII_TAB 0x09
-#define ASCII_SPACE 0x20
-#define ASCII_EXCL 0x21
-#define ASCII_QUOT 0x22
-#define ASCII_AMP 0x26
-#define ASCII_APOS 0x27
-#define ASCII_MINUS 0x2D
-#define ASCII_PERIOD 0x2E
-#define ASCII_COLON 0x3A
-#define ASCII_SEMI 0x3B
-#define ASCII_LT 0x3C
-#define ASCII_EQUALS 0x3D
-#define ASCII_GT 0x3E
-#define ASCII_LSQB 0x5B
-#define ASCII_RSQB 0x5D
-#define ASCII_UNDERSCORE 0x5F
diff --git a/bundle/expat/asciitab.h b/bundle/expat/asciitab.h
deleted file mode 100644
index 79a15c28ca..0000000000
--- a/bundle/expat/asciitab.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
-*/
-
-/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
-/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML,
-/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
-/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
-/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
-/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
-/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
-/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
-/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
-/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
-/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
-/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
-/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
-/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
-/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
-/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
-/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
-/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
diff --git a/bundle/expat/config.m4 b/bundle/expat/config.m4
deleted file mode 100644
index 89e12be2c6..0000000000
--- a/bundle/expat/config.m4
+++ /dev/null
@@ -1,43 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_BUNDLE(bundle-expat, Whether to bundle the expat library,
-[ --without-bundle-expat Disable the bundled expat library], yes)
-
-# BC ini option
-PHP_ARG_WITH(expat-dir, external libexpat install dir,
-[ --with-expat-dir=DIR XML: external libexpat install dir], no, no)
-
-if test "$PHP_BUNDLE_EXPAT" = "yes" && test "$PHP_EXPAT_DIR" = "no"; then
- AC_C_BIGENDIAN
- if test "$ac_cv_c_bigendian" = "yes"; then
- order=4321
- else
- order=1234
- fi
-
- AC_DEFINE(HAVE_LIBEXPAT_BUNDLED, 1, [ ])
- AC_DEFINE(HAVE_LIBEXPAT, 1, [ ])
- AC_DEFINE(BYTEORDER, $order, [ ])
- PHP_ADD_SOURCES(bundle/expat, xmlparse.c xmlrole.c xmltok.c)
- PHP_ADD_INCLUDE(bundle/expat)
- PHP_ADD_BUILD_DIR(bundle/expat)
-elif test "$PHP_BUNDLE_EXPAT" != "no" && test "$PHP_EXPAT_DIR" != "no"; then
- # Find external expat library
-
- for i in $PHP_BUNDLE_EXPAT $PHP_EXPAT_DIR; do
- if test -f $i/lib/libexpat.a -o -f $i/lib/libexpat.$SHLIB_SUFFIX_NAME; then
- EXPAT_DIR=$i
- fi
- done
-
- if test -z "$EXPAT_DIR"; then
- AC_MSG_ERROR(not found. Please reinstall the expat distribution.)
- fi
-
- AC_DEFINE(HAVE_LIBEXPAT, 1, [ ])
- PHP_ADD_INCLUDE($EXPAT_DIR/include)
- PHP_ADD_LIBRARY_WITH_PATH(expat, $EXPAT_DIR/lib, EXPAT_SHARED_LIBADD)
- PHP_SUBST(EXPAT_SHARED_LIBADD)
-fi
diff --git a/bundle/expat/expat.h b/bundle/expat/expat.h
deleted file mode 100644
index c137f61226..0000000000
--- a/bundle/expat/expat.h
+++ /dev/null
@@ -1,910 +0,0 @@
-/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
-*/
-
-#ifndef XmlParse_INCLUDED
-#define XmlParse_INCLUDED 1
-
-#ifdef __VMS
-/* 0 1 2 3 0 1 2 3
- 1234567890123456789012345678901 1234567890123456789012345678901 */
-#define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler
-#define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler
-#define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler
-#define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg
-#endif
-
-#include <stdlib.h>
-#include "php_compat.h"
-
-#ifndef XMLPARSEAPI
-#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
-#ifdef PHP_EXPORTS
-#define XMLPARSEAPI(type) type __cdecl
-#else
-#define XMLPARSEAPI(type) __declspec(dllimport) type __cdecl
-#endif
-#else
-#define XMLPARSEAPI(type) type
-#endif
-#endif /* not defined XMLPARSEAPI */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef XML_UNICODE_WCHAR_T
-#define XML_UNICODE
-#endif
-
-struct XML_ParserStruct;
-typedef struct XML_ParserStruct *XML_Parser;
-
-#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
-#ifdef XML_UNICODE_WCHAR_T
-typedef wchar_t XML_Char;
-typedef wchar_t XML_LChar;
-#else
-typedef unsigned short XML_Char;
-typedef char XML_LChar;
-#endif /* XML_UNICODE_WCHAR_T */
-#else /* Information is UTF-8 encoded. */
-typedef char XML_Char;
-typedef char XML_LChar;
-#endif /* XML_UNICODE */
-
-/* Should this be defined using stdbool.h when C99 is available? */
-typedef unsigned char XML_Bool;
-#define XML_TRUE ((XML_Bool) 1)
-#define XML_FALSE ((XML_Bool) 0)
-
-enum XML_Error {
- XML_ERROR_NONE,
- XML_ERROR_NO_MEMORY,
- XML_ERROR_SYNTAX,
- XML_ERROR_NO_ELEMENTS,
- XML_ERROR_INVALID_TOKEN,
- XML_ERROR_UNCLOSED_TOKEN,
- XML_ERROR_PARTIAL_CHAR,
- XML_ERROR_TAG_MISMATCH,
- XML_ERROR_DUPLICATE_ATTRIBUTE,
- XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
- XML_ERROR_PARAM_ENTITY_REF,
- XML_ERROR_UNDEFINED_ENTITY,
- XML_ERROR_RECURSIVE_ENTITY_REF,
- XML_ERROR_ASYNC_ENTITY,
- XML_ERROR_BAD_CHAR_REF,
- XML_ERROR_BINARY_ENTITY_REF,
- XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
- XML_ERROR_MISPLACED_XML_PI,
- XML_ERROR_UNKNOWN_ENCODING,
- XML_ERROR_INCORRECT_ENCODING,
- XML_ERROR_UNCLOSED_CDATA_SECTION,
- XML_ERROR_EXTERNAL_ENTITY_HANDLING,
- XML_ERROR_NOT_STANDALONE,
- XML_ERROR_UNEXPECTED_STATE,
- XML_ERROR_ENTITY_DECLARED_IN_PE,
- XML_ERROR_FEATURE_REQUIRES_XML_DTD,
- XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING
-};
-
-enum XML_Content_Type {
- XML_CTYPE_EMPTY = 1,
- XML_CTYPE_ANY,
- XML_CTYPE_MIXED,
- XML_CTYPE_NAME,
- XML_CTYPE_CHOICE,
- XML_CTYPE_SEQ
-};
-
-enum XML_Content_Quant {
- XML_CQUANT_NONE,
- XML_CQUANT_OPT,
- XML_CQUANT_REP,
- XML_CQUANT_PLUS
-};
-
-/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be
- XML_CQUANT_NONE, and the other fields will be zero or NULL.
- If type == XML_CTYPE_MIXED, then quant will be NONE or REP and
- numchildren will contain number of elements that may be mixed in
- and children point to an array of XML_Content cells that will be
- all of XML_CTYPE_NAME type with no quantification.
-
- If type == XML_CTYPE_NAME, then the name points to the name, and
- the numchildren field will be zero and children will be NULL. The
- quant fields indicates any quantifiers placed on the name.
-
- CHOICE and SEQ will have name NULL, the number of children in
- numchildren and children will point, recursively, to an array
- of XML_Content cells.
-
- The EMPTY, ANY, and MIXED types will only occur at top level.
-*/
-
-typedef struct XML_cp XML_Content;
-
-struct XML_cp {
- enum XML_Content_Type type;
- enum XML_Content_Quant quant;
- XML_Char * name;
- unsigned int numchildren;
- XML_Content * children;
-};
-
-
-/* This is called for an element declaration. See above for
- description of the model argument. It's the caller's responsibility
- to free model when finished with it.
-*/
-typedef void (*XML_ElementDeclHandler) (void *userData,
- const XML_Char *name,
- XML_Content *model);
-
-XMLPARSEAPI(void)
-XML_SetElementDeclHandler(XML_Parser parser,
- XML_ElementDeclHandler eldecl);
-
-/* The Attlist declaration handler is called for *each* attribute. So
- a single Attlist declaration with multiple attributes declared will
- generate multiple calls to this handler. The "default" parameter
- may be NULL in the case of the "#IMPLIED" or "#REQUIRED"
- keyword. The "isrequired" parameter will be true and the default
- value will be NULL in the case of "#REQUIRED". If "isrequired" is
- true and default is non-NULL, then this is a "#FIXED" default.
-*/
-typedef void (*XML_AttlistDeclHandler) (void *userData,
- const XML_Char *elname,
- const XML_Char *attname,
- const XML_Char *att_type,
- const XML_Char *dflt,
- int isrequired);
-
-XMLPARSEAPI(void)
-XML_SetAttlistDeclHandler(XML_Parser parser,
- XML_AttlistDeclHandler attdecl);
-
-/* The XML declaration handler is called for *both* XML declarations
- and text declarations. The way to distinguish is that the version
- parameter will be NULL for text declarations. The encoding
- parameter may be NULL for XML declarations. The standalone
- parameter will be -1, 0, or 1 indicating respectively that there
- was no standalone parameter in the declaration, that it was given
- as no, or that it was given as yes.
-*/
-typedef void (*XML_XmlDeclHandler) (void *userData,
- const XML_Char *version,
- const XML_Char *encoding,
- int standalone);
-
-XMLPARSEAPI(void)
-XML_SetXmlDeclHandler(XML_Parser parser,
- XML_XmlDeclHandler xmldecl);
-
-
-typedef struct {
- void *(*malloc_fcn)(size_t size);
- void *(*realloc_fcn)(void *ptr, size_t size);
- void (*free_fcn)(void *ptr);
-} XML_Memory_Handling_Suite;
-
-/* Constructs a new parser; encoding is the encoding specified by the
- external protocol or NULL if there is none specified.
-*/
-XMLPARSEAPI(XML_Parser)
-XML_ParserCreate(const XML_Char *encoding);
-
-/* Constructs a new parser and namespace processor. Element type
- names and attribute names that belong to a namespace will be
- expanded; unprefixed attribute names are never expanded; unprefixed
- element type names are expanded only if there is a default
- namespace. The expanded name is the concatenation of the namespace
- URI, the namespace separator character, and the local part of the
- name. If the namespace separator is '\0' then the namespace URI
- and the local part will be concatenated without any separator.
- When a namespace is not declared, the name and prefix will be
- passed through without expansion.
-*/
-XMLPARSEAPI(XML_Parser)
-XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
-
-
-/* Constructs a new parser using the memory management suit referred to
- by memsuite. If memsuite is NULL, then use the standard library memory
- suite. If namespaceSeparator is non-NULL it creates a parser with
- namespace processing as described above. The character pointed at
- will serve as the namespace separator.
-
- All further memory operations used for the created parser will come from
- the given suite.
-*/
-XMLPARSEAPI(XML_Parser)
-XML_ParserCreate_MM(const XML_Char *encoding,
- const XML_Memory_Handling_Suite *memsuite,
- const XML_Char *namespaceSeparator);
-
-/* Prepare a parser object to be re-used. This is particularly
- valuable when memory allocation overhead is disproportionatly high,
- such as when a large number of small documnents need to be parsed.
- All handlers are cleared from the parser, except for the
- unknownEncodingHandler. The parser's external state is re-initialized
- except for the values of ns and ns_triplets.
-
- Added in Expat 1.95.3.
-*/
-XMLPARSEAPI(XML_Bool)
-XML_ParserReset(XML_Parser parser, const XML_Char *encoding);
-
-/* atts is array of name/value pairs, terminated by 0;
- names and values are 0 terminated.
-*/
-typedef void (*XML_StartElementHandler)(void *userData,
- const XML_Char *name,
- const XML_Char **atts);
-
-typedef void (*XML_EndElementHandler)(void *userData,
- const XML_Char *name);
-
-
-/* s is not 0 terminated. */
-typedef void (*XML_CharacterDataHandler)(void *userData,
- const XML_Char *s,
- int len);
-
-/* target and data are 0 terminated */
-typedef void (*XML_ProcessingInstructionHandler)(void *userData,
- const XML_Char *target,
- const XML_Char *data);
-
-/* data is 0 terminated */
-typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data);
-
-typedef void (*XML_StartCdataSectionHandler)(void *userData);
-typedef void (*XML_EndCdataSectionHandler)(void *userData);
-
-/* This is called for any characters in the XML document for which
- there is no applicable handler. This includes both characters that
- are part of markup which is of a kind that is not reported
- (comments, markup declarations), or characters that are part of a
- construct which could be reported but for which no handler has been
- supplied. The characters are passed exactly as they were in the XML
- document except that they will be encoded in UTF-8 or UTF-16.
- Line boundaries are not normalized. Note that a byte order mark
- character is not passed to the default handler. There are no
- guarantees about how characters are divided between calls to the
- default handler: for example, a comment might be split between
- multiple calls.
-*/
-typedef void (*XML_DefaultHandler)(void *userData,
- const XML_Char *s,
- int len);
-
-/* This is called for the start of the DOCTYPE declaration, before
- any DTD or internal subset is parsed.
-*/
-typedef void (*XML_StartDoctypeDeclHandler)(void *userData,
- const XML_Char *doctypeName,
- const XML_Char *sysid,
- const XML_Char *pubid,
- int has_internal_subset);
-
-/* This is called for the start of the DOCTYPE declaration when the
- closing > is encountered, but after processing any external
- subset.
-*/
-typedef void (*XML_EndDoctypeDeclHandler)(void *userData);
-
-/* This is called for entity declarations. The is_parameter_entity
- argument will be non-zero if the entity is a parameter entity, zero
- otherwise.
-
- For internal entities (<!ENTITY foo "bar">), value will
- be non-NULL and systemId, publicID, and notationName will be NULL.
- The value string is NOT nul-terminated; the length is provided in
- the value_length argument. Since it is legal to have zero-length
- values, do not use this argument to test for internal entities.
-
- For external entities, value will be NULL and systemId will be
- non-NULL. The publicId argument will be NULL unless a public
- identifier was provided. The notationName argument will have a
- non-NULL value only for unparsed entity declarations.
-
- Note that is_parameter_entity can't be changed to XML_Bool, since
- that would break binary compatibility.
-*/
-typedef void (*XML_EntityDeclHandler) (void *userData,
- const XML_Char *entityName,
- int is_parameter_entity,
- const XML_Char *value,
- int value_length,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId,
- const XML_Char *notationName);
-
-XMLPARSEAPI(void)
-XML_SetEntityDeclHandler(XML_Parser parser,
- XML_EntityDeclHandler handler);
-
-/* OBSOLETE -- OBSOLETE -- OBSOLETE
- This handler has been superceded by the EntityDeclHandler above.
- It is provided here for backward compatibility.
-
- This is called for a declaration of an unparsed (NDATA) entity.
- The base argument is whatever was set by XML_SetBase. The
- entityName, systemId and notationName arguments will never be
- NULL. The other arguments may be.
-*/
-typedef void (*XML_UnparsedEntityDeclHandler)(void *userData,
- const XML_Char *entityName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId,
- const XML_Char *notationName);
-
-/* This is called for a declaration of notation. The base argument is
- whatever was set by XML_SetBase. The notationName will never be
- NULL. The other arguments can be.
-*/
-typedef void (*XML_NotationDeclHandler)(void *userData,
- const XML_Char *notationName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId);
-
-/* When namespace processing is enabled, these are called once for
- each namespace declaration. The call to the start and end element
- handlers occur between the calls to the start and end namespace
- declaration handlers. For an xmlns attribute, prefix will be
- NULL. For an xmlns="" attribute, uri will be NULL.
-*/
-typedef void (*XML_StartNamespaceDeclHandler)(void *userData,
- const XML_Char *prefix,
- const XML_Char *uri);
-
-typedef void (*XML_EndNamespaceDeclHandler)(void *userData,
- const XML_Char *prefix);
-
-/* This is called if the document is not standalone, that is, it has an
- external subset or a reference to a parameter entity, but does not
- have standalone="yes". If this handler returns 0, then processing
- will not continue, and the parser will return a
- XML_ERROR_NOT_STANDALONE error.
- If parameter entity parsing is enabled, then in addition to the
- conditions above this handler will only be called if the referenced
- entity was actually read.
-*/
-typedef int (*XML_NotStandaloneHandler)(void *userData);
-
-/* This is called for a reference to an external parsed general
- entity. The referenced entity is not automatically parsed. The
- application can parse it immediately or later using
- XML_ExternalEntityParserCreate.
-
- The parser argument is the parser parsing the entity containing the
- reference; it can be passed as the parser argument to
- XML_ExternalEntityParserCreate. The systemId argument is the
- system identifier as specified in the entity declaration; it will
- not be NULL.
-
- The base argument is the system identifier that should be used as
- the base for resolving systemId if systemId was relative; this is
- set by XML_SetBase; it may be NULL.
-
- The publicId argument is the public identifier as specified in the
- entity declaration, or NULL if none was specified; the whitespace
- in the public identifier will have been normalized as required by
- the XML spec.
-
- The context argument specifies the parsing context in the format
- expected by the context argument to XML_ExternalEntityParserCreate;
- context is valid only until the handler returns, so if the
- referenced entity is to be parsed later, it must be copied.
-
- The handler should return 0 if processing should not continue
- because of a fatal error in the handling of the external entity.
- In this case the calling parser will return an
- XML_ERROR_EXTERNAL_ENTITY_HANDLING error.
-
- Note that unlike other handlers the first argument is the parser,
- not userData.
-*/
-typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser,
- const XML_Char *context,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId);
-
-/* This is called in two situations:
- 1) An entity reference is encountered for which no declaration
- has been read *and* this is not an error.
- 2) An internal entity reference is read, but not expanded, because
- XML_SetDefaultHandler has been called.
- Note: skipped parameter entities in declarations and skipped general
- entities in attribute values cannot be reported, because
- the event would be out of sync with the reporting of the
- declarations or attribute values
-*/
-typedef void (*XML_SkippedEntityHandler)(void *userData,
- const XML_Char *entityName,
- int is_parameter_entity);
-
-/* This structure is filled in by the XML_UnknownEncodingHandler to
- provide information to the parser about encodings that are unknown
- to the parser.
-
- The map[b] member gives information about byte sequences whose
- first byte is b.
-
- If map[b] is c where c is >= 0, then b by itself encodes the
- Unicode scalar value c.
-
- If map[b] is -1, then the byte sequence is malformed.
-
- If map[b] is -n, where n >= 2, then b is the first byte of an
- n-byte sequence that encodes a single Unicode scalar value.
-
- The data member will be passed as the first argument to the convert
- function.
-
- The convert function is used to convert multibyte sequences; s will
- point to a n-byte sequence where map[(unsigned char)*s] == -n. The
- convert function must return the Unicode scalar value represented
- by this byte sequence or -1 if the byte sequence is malformed.
-
- The convert function may be NULL if the encoding is a single-byte
- encoding, that is if map[b] >= -1 for all bytes b.
-
- When the parser is finished with the encoding, then if release is
- not NULL, it will call release passing it the data member; once
- release has been called, the convert function will not be called
- again.
-
- Expat places certain restrictions on the encodings that are supported
- using this mechanism.
-
- 1. Every ASCII character that can appear in a well-formed XML document,
- other than the characters
-
- $@\^`{}~
-
- must be represented by a single byte, and that byte must be the
- same byte that represents that character in ASCII.
-
- 2. No character may require more than 4 bytes to encode.
-
- 3. All characters encoded must have Unicode scalar values <=
- 0xFFFF, (i.e., characters that would be encoded by surrogates in
- UTF-16 are not allowed). Note that this restriction doesn't
- apply to the built-in support for UTF-8 and UTF-16.
-
- 4. No Unicode character may be encoded by more than one distinct
- sequence of bytes.
-*/
-typedef struct {
- int map[256];
- void *data;
- int (*convert)(void *data, const char *s);
- void (*release)(void *data);
-} XML_Encoding;
-
-/* This is called for an encoding that is unknown to the parser.
-
- The encodingHandlerData argument is that which was passed as the
- second argument to XML_SetUnknownEncodingHandler.
-
- The name argument gives the name of the encoding as specified in
- the encoding declaration.
-
- If the callback can provide information about the encoding, it must
- fill in the XML_Encoding structure, and return 1. Otherwise it
- must return 0.
-
- If info does not describe a suitable encoding, then the parser will
- return an XML_UNKNOWN_ENCODING error.
-*/
-typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData,
- const XML_Char *name,
- XML_Encoding *info);
-
-XMLPARSEAPI(void)
-XML_SetElementHandler(XML_Parser parser,
- XML_StartElementHandler start,
- XML_EndElementHandler end);
-
-XMLPARSEAPI(void)
-XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler);
-
-XMLPARSEAPI(void)
-XML_SetEndElementHandler(XML_Parser, XML_EndElementHandler);
-
-XMLPARSEAPI(void)
-XML_SetCharacterDataHandler(XML_Parser parser,
- XML_CharacterDataHandler handler);
-
-XMLPARSEAPI(void)
-XML_SetProcessingInstructionHandler(XML_Parser parser,
- XML_ProcessingInstructionHandler handler);
-XMLPARSEAPI(void)
-XML_SetCommentHandler(XML_Parser parser,
- XML_CommentHandler handler);
-
-XMLPARSEAPI(void)
-XML_SetCdataSectionHandler(XML_Parser parser,
- XML_StartCdataSectionHandler start,
- XML_EndCdataSectionHandler end);
-
-XMLPARSEAPI(void)
-XML_SetStartCdataSectionHandler(XML_Parser parser,
- XML_StartCdataSectionHandler start);
-
-XMLPARSEAPI(void)
-XML_SetEndCdataSectionHandler(XML_Parser parser,
- XML_EndCdataSectionHandler end);
-
-/* This sets the default handler and also inhibits expansion of
- internal entities. These entity references will be passed to the
- default handler, or to the skipped entity handler, if one is set.
-*/
-XMLPARSEAPI(void)
-XML_SetDefaultHandler(XML_Parser parser,
- XML_DefaultHandler handler);
-
-/* This sets the default handler but does not inhibit expansion of
- internal entities. The entity reference will not be passed to the
- default handler.
-*/
-XMLPARSEAPI(void)
-XML_SetDefaultHandlerExpand(XML_Parser parser,
- XML_DefaultHandler handler);
-
-XMLPARSEAPI(void)
-XML_SetDoctypeDeclHandler(XML_Parser parser,
- XML_StartDoctypeDeclHandler start,
- XML_EndDoctypeDeclHandler end);
-
-XMLPARSEAPI(void)
-XML_SetStartDoctypeDeclHandler(XML_Parser parser,
- XML_StartDoctypeDeclHandler start);
-
-XMLPARSEAPI(void)
-XML_SetEndDoctypeDeclHandler(XML_Parser parser,
- XML_EndDoctypeDeclHandler end);
-
-XMLPARSEAPI(void)
-XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
- XML_UnparsedEntityDeclHandler handler);
-
-XMLPARSEAPI(void)
-XML_SetNotationDeclHandler(XML_Parser parser,
- XML_NotationDeclHandler handler);
-
-XMLPARSEAPI(void)
-XML_SetNamespaceDeclHandler(XML_Parser parser,
- XML_StartNamespaceDeclHandler start,
- XML_EndNamespaceDeclHandler end);
-
-XMLPARSEAPI(void)
-XML_SetStartNamespaceDeclHandler(XML_Parser parser,
- XML_StartNamespaceDeclHandler start);
-
-XMLPARSEAPI(void)
-XML_SetEndNamespaceDeclHandler(XML_Parser parser,
- XML_EndNamespaceDeclHandler end);
-
-XMLPARSEAPI(void)
-XML_SetNotStandaloneHandler(XML_Parser parser,
- XML_NotStandaloneHandler handler);
-
-XMLPARSEAPI(void)
-XML_SetExternalEntityRefHandler(XML_Parser parser,
- XML_ExternalEntityRefHandler handler);
-
-/* If a non-NULL value for arg is specified here, then it will be
- passed as the first argument to the external entity ref handler
- instead of the parser object.
-*/
-XMLPARSEAPI(void)
-XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
-
-XMLPARSEAPI(void)
-XML_SetSkippedEntityHandler(XML_Parser parser,
- XML_SkippedEntityHandler handler);
-
-XMLPARSEAPI(void)
-XML_SetUnknownEncodingHandler(XML_Parser parser,
- XML_UnknownEncodingHandler handler,
- void *encodingHandlerData);
-
-/* This can be called within a handler for a start element, end
- element, processing instruction or character data. It causes the
- corresponding markup to be passed to the default handler.
-*/
-XMLPARSEAPI(void)
-XML_DefaultCurrent(XML_Parser parser);
-
-/* If do_nst is non-zero, and namespace processing is in effect, and
- a name has a prefix (i.e. an explicit namespace qualifier) then
- that name is returned as a triplet in a single string separated by
- the separator character specified when the parser was created: URI
- + sep + local_name + sep + prefix.
-
- If do_nst is zero, then namespace information is returned in the
- default manner (URI + sep + local_name) whether or not the name
- has a prefix.
-
- Note: Calling XML_SetReturnNSTriplet after XML_Parse or
- XML_ParseBuffer has no effect.
-*/
-
-XMLPARSEAPI(void)
-XML_SetReturnNSTriplet(XML_Parser parser, int do_nst);
-
-/* This value is passed as the userData argument to callbacks. */
-XMLPARSEAPI(void)
-XML_SetUserData(XML_Parser parser, void *userData);
-
-/* Returns the last value set by XML_SetUserData or NULL. */
-#define XML_GetUserData(parser) (*(void **)(parser))
-
-/* This is equivalent to supplying an encoding argument to
- XML_ParserCreate. On success XML_SetEncoding returns non-zero,
- zero otherwise.
- Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer
- has no effect and returns zero.
-*/
-XMLPARSEAPI(int)
-XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
-
-/* If this function is called, then the parser will be passed as the
- first argument to callbacks instead of userData. The userData will
- still be accessible using XML_GetUserData.
-*/
-XMLPARSEAPI(void)
-XML_UseParserAsHandlerArg(XML_Parser parser);
-
-/* If useDTD == XML_TRUE is passed to this function, then the parser
- will assume that there is an external subset, even if none is
- specified in the document. In such a case the parser will call the
- externalEntityRefHandler with a value of NULL for the systemId
- argument (the publicId and context arguments will be NULL as well).
- Note: If this function is called, then this must be done before
- the first call to XML_Parse or XML_ParseBuffer, since it will
- have no effect after that. Returns
- XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING.
- Note: If the document does not have a DOCTYPE declaration at all,
- then startDoctypeDeclHandler and endDoctypeDeclHandler will not
- be called, despite an external subset being parsed.
- Note: If XML_DTD is not defined when Expat is compiled, returns
- XML_ERROR_FEATURE_REQUIRES_XML_DTD.
-*/
-XMLPARSEAPI(enum XML_Error)
-XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
-
-
-/* Sets the base to be used for resolving relative URIs in system
- identifiers in declarations. Resolving relative identifiers is
- left to the application: this value will be passed through as the
- base argument to the XML_ExternalEntityRefHandler,
- XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base
- argument will be copied. Returns zero if out of memory, non-zero
- otherwise.
-*/
-XMLPARSEAPI(int)
-XML_SetBase(XML_Parser parser, const XML_Char *base);
-
-XMLPARSEAPI(const XML_Char *)
-XML_GetBase(XML_Parser parser);
-
-/* Returns the number of the attribute/value pairs passed in last call
- to the XML_StartElementHandler that were specified in the start-tag
- rather than defaulted. Each attribute/value pair counts as 2; thus
- this correspondds to an index into the atts array passed to the
- XML_StartElementHandler.
-*/
-XMLPARSEAPI(int)
-XML_GetSpecifiedAttributeCount(XML_Parser parser);
-
-/* Returns the index of the ID attribute passed in the last call to
- XML_StartElementHandler, or -1 if there is no ID attribute. Each
- attribute/value pair counts as 2; thus this correspondds to an
- index into the atts array passed to the XML_StartElementHandler.
-*/
-XMLPARSEAPI(int)
-XML_GetIdAttributeIndex(XML_Parser parser);
-
-/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is
- detected. The last call to XML_Parse must have isFinal true; len
- may be zero for this call (or any other).
-
- The XML_Status enum gives the possible return values for the
- XML_Parse and XML_ParseBuffer functions. Though the return values
- for these functions has always been described as a Boolean value,
- the implementation, at least for the 1.95.x series, has always
- returned exactly one of these values. The preprocessor #defines
- are included so this stanza can be added to code that still needs
- to support older versions of Expat 1.95.x:
-
- #ifndef XML_STATUS_OK
- #define XML_STATUS_OK 1
- #define XML_STATUS_ERROR 0
- #endif
-
- Otherwise, the #define hackery is quite ugly and would have been dropped.
-*/
-enum XML_Status {
- XML_STATUS_ERROR = 0,
-#define XML_STATUS_ERROR XML_STATUS_ERROR
- XML_STATUS_OK = 1
-#define XML_STATUS_OK XML_STATUS_OK
-};
-
-XMLPARSEAPI(enum XML_Status)
-XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
-
-XMLPARSEAPI(void *)
-XML_GetBuffer(XML_Parser parser, int len);
-
-XMLPARSEAPI(enum XML_Status)
-XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
-
-/* Creates an XML_Parser object that can parse an external general
- entity; context is a '\0'-terminated string specifying the parse
- context; encoding is a '\0'-terminated string giving the name of
- the externally specified encoding, or NULL if there is no
- externally specified encoding. The context string consists of a
- sequence of tokens separated by formfeeds (\f); a token consisting
- of a name specifies that the general entity of the name is open; a
- token of the form prefix=uri specifies the namespace for a
- particular prefix; a token of the form =uri specifies the default
- namespace. This can be called at any point after the first call to
- an ExternalEntityRefHandler so longer as the parser has not yet
- been freed. The new parser is completely independent and may
- safely be used in a separate thread. The handlers and userData are
- initialized from the parser argument. Returns 0 if out of memory.
- Otherwise returns a new XML_Parser object.
-*/
-XMLPARSEAPI(XML_Parser)
-XML_ExternalEntityParserCreate(XML_Parser parser,
- const XML_Char *context,
- const XML_Char *encoding);
-
-enum XML_ParamEntityParsing {
- XML_PARAM_ENTITY_PARSING_NEVER,
- XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,
- XML_PARAM_ENTITY_PARSING_ALWAYS
-};
-
-/* Controls parsing of parameter entities (including the external DTD
- subset). If parsing of parameter entities is enabled, then
- references to external parameter entities (including the external
- DTD subset) will be passed to the handler set with
- XML_SetExternalEntityRefHandler. The context passed will be 0.
-
- Unlike external general entities, external parameter entities can
- only be parsed synchronously. If the external parameter entity is
- to be parsed, it must be parsed during the call to the external
- entity ref handler: the complete sequence of
- XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and
- XML_ParserFree calls must be made during this call. After
- XML_ExternalEntityParserCreate has been called to create the parser
- for the external parameter entity (context must be 0 for this
- call), it is illegal to make any calls on the old parser until
- XML_ParserFree has been called on the newly created parser.
- If the library has been compiled without support for parameter
- entity parsing (ie without XML_DTD being defined), then
- XML_SetParamEntityParsing will return 0 if parsing of parameter
- entities is requested; otherwise it will return non-zero.
- Note: If XML_SetParamEntityParsing is called after XML_Parse or
- XML_ParseBuffer, then it has no effect and will always return 0.
-*/
-XMLPARSEAPI(int)
-XML_SetParamEntityParsing(XML_Parser parser,
- enum XML_ParamEntityParsing parsing);
-
-/* If XML_Parse or XML_ParseBuffer have returned 0, then
- XML_GetErrorCode returns information about the error.
-*/
-XMLPARSEAPI(enum XML_Error)
-XML_GetErrorCode(XML_Parser parser);
-
-/* These functions return information about the current parse
- location. They may be called when XML_Parse or XML_ParseBuffer
- return 0; in this case the location is the location of the
- character at which the error was detected.
-
- They may also be called from any other callback called to report
- some parse event; in this the location is the location of the first
- of the sequence of characters that generated the event.
-*/
-XMLPARSEAPI(int) XML_GetCurrentLineNumber(XML_Parser parser);
-XMLPARSEAPI(int) XML_GetCurrentColumnNumber(XML_Parser parser);
-XMLPARSEAPI(long) XML_GetCurrentByteIndex(XML_Parser parser);
-
-/* Return the number of bytes in the current event.
- Returns 0 if the event is in an internal entity.
-*/
-XMLPARSEAPI(int)
-XML_GetCurrentByteCount(XML_Parser parser);
-
-/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets
- the integer pointed to by offset to the offset within this buffer
- of the current parse position, and sets the integer pointed to by size
- to the size of this buffer (the number of input bytes). Otherwise
- returns a NULL pointer. Also returns a NULL pointer if a parse isn't
- active.
-
- NOTE: The character pointer returned should not be used outside
- the handler that makes the call.
-*/
-XMLPARSEAPI(const char *)
-XML_GetInputContext(XML_Parser parser,
- int *offset,
- int *size);
-
-/* For backwards compatibility with previous versions. */
-#define XML_GetErrorLineNumber XML_GetCurrentLineNumber
-#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
-#define XML_GetErrorByteIndex XML_GetCurrentByteIndex
-
-/* Frees memory used by the parser. */
-XMLPARSEAPI(void)
-XML_ParserFree(XML_Parser parser);
-
-/* Returns a string describing the error. */
-XMLPARSEAPI(const XML_LChar *)
-XML_ErrorString(enum XML_Error code);
-
-/* Return a string containing the version number of this expat */
-XMLPARSEAPI(const XML_LChar *)
-XML_ExpatVersion(void);
-
-typedef struct {
- int major;
- int minor;
- int micro;
-} XML_Expat_Version;
-
-/* Return an XML_Expat_Version structure containing numeric version
- number information for this version of expat.
-*/
-XMLPARSEAPI(XML_Expat_Version)
-XML_ExpatVersionInfo(void);
-
-/* Added in Expat 1.95.5. */
-enum XML_FeatureEnum {
- XML_FEATURE_END = 0,
- XML_FEATURE_UNICODE,
- XML_FEATURE_UNICODE_WCHAR_T,
- XML_FEATURE_DTD,
- XML_FEATURE_CONTEXT_BYTES,
- XML_FEATURE_MIN_SIZE,
- XML_FEATURE_SIZEOF_XML_CHAR,
- XML_FEATURE_SIZEOF_XML_LCHAR
- /* Additional features must be added to the end of this enum. */
-};
-
-typedef struct {
- enum XML_FeatureEnum feature;
- XML_LChar *name;
- long int value;
-} XML_Feature;
-
-XMLPARSEAPI(const XML_Feature *)
-XML_GetFeatureList(void);
-
-
-/* Expat follows the GNU/Linux convention of odd number minor version for
- beta/development releases and even number minor version for stable
- releases. Micro is bumped with each release, and set to 0 with each
- change to major or minor version.
-*/
-#define XML_MAJOR_VERSION 1
-#define XML_MINOR_VERSION 95
-#define XML_MICRO_VERSION 5
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* not XmlParse_INCLUDED */
diff --git a/bundle/expat/iasciitab.h b/bundle/expat/iasciitab.h
deleted file mode 100644
index 24a1d5ccc9..0000000000
--- a/bundle/expat/iasciitab.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
-*/
-
-/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */
-/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
-/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML,
-/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
-/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
-/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
-/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
-/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
-/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
-/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
-/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
-/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
-/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
-/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
-/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
-/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
-/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
-/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
-/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
diff --git a/bundle/expat/internal.h b/bundle/expat/internal.h
deleted file mode 100644
index 6e2c5ed45f..0000000000
--- a/bundle/expat/internal.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* internal.h
-
- Internal definitions used by Expat. This is not needed to compile
- client code.
-
- The following definitions are made:
-
- FASTCALL -- Used for most internal functions to specify that the
- fastest possible calling convention be used.
-
- inline -- Used for selected internal functions for which inlining
- may improve performance on some platforms.
-*/
-
-#if defined(__GNUC__)
-/* Last minute instability reported with egcs on a RedHat Linux 7.3
- box; argh!
-*/
-/* #define FASTCALL __attribute__((stdcall, regparm(3))) */
-#elif defined(WIN32)
-/* XXX This seems to have an unexpected negative effect on Windows so
- we'll disable it for now on that platform. It may be reconsidered
- for a future release if it can be made more effective.
-*/
-/* #define FASTCALL __fastcall */
-#endif
-
-#ifndef FASTCALL
-#define FASTCALL
-#endif
-
-#ifndef XML_MIN_SIZE
-#if !defined(__cplusplus) && !defined(inline)
-#ifdef __GNUC__
-#define inline __inline
-#endif /* __GNUC__ */
-#endif
-#endif /* XML_MIN_SIZE */
-
-#ifdef __cplusplus
-#define inline inline
-#else
-#ifndef inline
-#define inline
-#endif
-#endif
diff --git a/bundle/expat/latin1tab.h b/bundle/expat/latin1tab.h
deleted file mode 100644
index 53c25d76b2..0000000000
--- a/bundle/expat/latin1tab.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
-*/
-
-/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
-/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME,
-/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
-/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
-/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
-/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
diff --git a/bundle/expat/nametab.h b/bundle/expat/nametab.h
deleted file mode 100644
index b05e62c77a..0000000000
--- a/bundle/expat/nametab.h
+++ /dev/null
@@ -1,150 +0,0 @@
-static const unsigned namingBitmap[] = {
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
-0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE,
-0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,
-0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF,
-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF,
-0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
-0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
-0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
-0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
-0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
-0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF,
-0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000,
-0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,
-0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003,
-0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003,
-0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,
-0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001,
-0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003,
-0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,
-0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003,
-0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003,
-0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000,
-0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,
-0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF,
-0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB,
-0x40000000, 0xF580C900, 0x00000007, 0x02010800,
-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
-0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF,
-0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
-0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF,
-0x00000000, 0x00004C40, 0x00000000, 0x00000000,
-0x00000007, 0x00000000, 0x00000000, 0x00000000,
-0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF,
-0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF,
-0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
-0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
-0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000,
-0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,
-0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF,
-0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
-0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,
-0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003,
-0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
-0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
-0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
-0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
-0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
-0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF,
-0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF,
-0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
-0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF,
-0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0,
-0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
-0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3,
-0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80,
-0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
-0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3,
-0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000,
-0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000,
-0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
-0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
-0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF,
-0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF,
-};
-static const unsigned char nmstrtPages[] = {
-0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00,
-0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
-0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
-0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-static const unsigned char namePages[] = {
-0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00,
-0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
-0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
-0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
diff --git a/bundle/expat/utf8tab.h b/bundle/expat/utf8tab.h
deleted file mode 100644
index 7bb3e77603..0000000000
--- a/bundle/expat/utf8tab.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
-*/
-
-
-/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
-/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
-/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
-/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
-/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4,
-/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM,
diff --git a/bundle/expat/winconfig.h b/bundle/expat/winconfig.h
deleted file mode 100644
index ce91577f20..0000000000
--- a/bundle/expat/winconfig.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*================================================================
-** Copyright 2000, Clark Cooper
-** All rights reserved.
-**
-** This is free software. You are permitted to copy, distribute, or modify
-** it under the terms of the MIT/X license (contained in the COPYING file
-** with this distribution.)
-*/
-
-#ifndef WINCONFIG_H
-#define WINCONFIG_H
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-
-#include <memory.h>
-#include <string.h>
-
-#define XML_NS 1
-#define XML_DTD 1
-#define XML_CONTEXT_BYTES 1024
-
-/* we will assume all Windows platforms are little endian */
-#define BYTEORDER 1234
-
-/* Windows has memmove() available. */
-/* #define HAVE_MEMMOVE */
-
-#endif /* ndef WINCONFIG_H */
diff --git a/bundle/expat/xmlparse.c b/bundle/expat/xmlparse.c
deleted file mode 100644
index 60e65d6907..0000000000
--- a/bundle/expat/xmlparse.c
+++ /dev/null
@@ -1,5592 +0,0 @@
-/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
-*/
-
-#include <stddef.h>
-#include <string.h> /* memset(), memcpy() */
-#if PHP_WIN32
-#include "config.w32.h"
-#else
-#include "php_config.h"
-#endif
-#include "php_compat.h"
-
-#ifdef COMPILED_FROM_DSP
-
-#include "winconfig.h"
-#ifdef _LIB
-#define XMLPARSEAPI(type) type __cdecl
-#else
-#define XMLPARSEAPI(type) __declspec(dllexport) type __cdecl
-#endif
-#include "expat.h"
-#undef XMLPARSEAPI
-
-#elif defined(MACOS_CLASSIC)
-
-#include "macconfig.h"
-#include "expat.h"
-
-#else
-
-#include <php_config.h>
-
-#ifdef __declspec
-#define XMLPARSEAPI(type) __declspec(dllexport) type __cdecl
-#endif
-
-#include "expat.h"
-
-#ifdef __declspec
-#undef XMLPARSEAPI
-#endif
-#endif /* ndef COMPILED_FROM_DSP */
-
-#ifdef XML_UNICODE
-#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX
-#define XmlConvert XmlUtf16Convert
-#define XmlGetInternalEncoding XmlGetUtf16InternalEncoding
-#define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS
-#define XmlEncode XmlUtf16Encode
-#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((unsigned long)s) & 1))
-typedef unsigned short ICHAR;
-#else
-#define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX
-#define XmlConvert XmlUtf8Convert
-#define XmlGetInternalEncoding XmlGetUtf8InternalEncoding
-#define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS
-#define XmlEncode XmlUtf8Encode
-#define MUST_CONVERT(enc, s) (!(enc)->isUtf8)
-typedef char ICHAR;
-#endif
-
-
-#ifndef XML_NS
-
-#define XmlInitEncodingNS XmlInitEncoding
-#define XmlInitUnknownEncodingNS XmlInitUnknownEncoding
-#undef XmlGetInternalEncodingNS
-#define XmlGetInternalEncodingNS XmlGetInternalEncoding
-#define XmlParseXmlDeclNS XmlParseXmlDecl
-
-#endif
-
-#ifdef XML_UNICODE
-
-#ifdef XML_UNICODE_WCHAR_T
-#define XML_T(x) (const wchar_t)x
-#define XML_L(x) L ## x
-#else
-#define XML_T(x) (const unsigned short)x
-#define XML_L(x) x
-#endif
-
-#else
-
-#define XML_T(x) x
-#define XML_L(x) x
-
-#endif
-
-/* Round up n to be a multiple of sz, where sz is a power of 2. */
-#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
-
-/* Handle the case where memmove() doesn't exist. */
-#ifndef HAVE_MEMMOVE
-#ifdef HAVE_BCOPY
-#define memmove(d,s,l) bcopy((s),(d),(l))
-#else
-#error memmove does not exist on this platform, nor is a substitute available
-#endif /* HAVE_BCOPY */
-#endif /* HAVE_MEMMOVE */
-
-#include "internal.h"
-#include "xmltok.h"
-#include "xmlrole.h"
-
-typedef const XML_Char *KEY;
-
-typedef struct {
- KEY name;
-} NAMED;
-
-typedef struct {
- NAMED **v;
- size_t size;
- size_t used;
- size_t usedLim;
- XML_Memory_Handling_Suite *mem;
-} HASH_TABLE;
-
-typedef struct {
- NAMED **p;
- NAMED **end;
-} HASH_TABLE_ITER;
-
-#define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */
-#define INIT_DATA_BUF_SIZE 1024
-#define INIT_ATTS_SIZE 16
-#define INIT_BLOCK_SIZE 1024
-#define INIT_BUFFER_SIZE 1024
-
-#define EXPAND_SPARE 24
-
-typedef struct binding {
- struct prefix *prefix;
- struct binding *nextTagBinding;
- struct binding *prevPrefixBinding;
- const struct attribute_id *attId;
- XML_Char *uri;
- int uriLen;
- int uriAlloc;
-} BINDING;
-
-typedef struct prefix {
- const XML_Char *name;
- BINDING *binding;
-} PREFIX;
-
-typedef struct {
- const XML_Char *str;
- const XML_Char *localPart;
- const XML_Char *prefix;
- int strLen;
- int uriLen;
- int prefixLen;
-} TAG_NAME;
-
-/* TAG represents an open element.
- The name of the element is stored in both the document and API
- encodings. The memory buffer 'buf' is a separately-allocated
- memory area which stores the name. During the XML_Parse()/
- XMLParseBuffer() when the element is open, the memory for the 'raw'
- version of the name (in the document encoding) is shared with the
- document buffer. If the element is open across calls to
- XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
- contain the 'raw' name as well.
-
- A parser re-uses these structures, maintaining a list of allocated
- TAG objects in a free list.
-*/
-typedef struct tag {
- struct tag *parent; /* parent of this element */
- const char *rawName; /* tagName in the original encoding */
- int rawNameLength;
- TAG_NAME name; /* tagName in the API encoding */
- char *buf; /* buffer for name components */
- char *bufEnd; /* end of the buffer */
- BINDING *bindings;
-} TAG;
-
-typedef struct {
- const XML_Char *name;
- const XML_Char *textPtr;
- int textLen;
- const XML_Char *systemId;
- const XML_Char *base;
- const XML_Char *publicId;
- const XML_Char *notation;
- XML_Bool open;
- XML_Bool is_param;
- XML_Bool is_internal; /* true if declared in internal subset outside PE */
-} ENTITY;
-
-typedef struct {
- enum XML_Content_Type type;
- enum XML_Content_Quant quant;
- const XML_Char * name;
- int firstchild;
- int lastchild;
- int childcnt;
- int nextsib;
-} CONTENT_SCAFFOLD;
-
-#define INIT_SCAFFOLD_ELEMENTS 32
-
-typedef struct block {
- struct block *next;
- int size;
- XML_Char s[1];
-} BLOCK;
-
-typedef struct {
- BLOCK *blocks;
- BLOCK *freeBlocks;
- const XML_Char *end;
- XML_Char *ptr;
- XML_Char *start;
- XML_Memory_Handling_Suite *mem;
-} STRING_POOL;
-
-/* The XML_Char before the name is used to determine whether
- an attribute has been specified. */
-typedef struct attribute_id {
- XML_Char *name;
- PREFIX *prefix;
- XML_Bool maybeTokenized;
- XML_Bool xmlns;
-} ATTRIBUTE_ID;
-
-typedef struct {
- const ATTRIBUTE_ID *id;
- XML_Bool isCdata;
- const XML_Char *value;
-} DEFAULT_ATTRIBUTE;
-
-typedef struct {
- const XML_Char *name;
- PREFIX *prefix;
- const ATTRIBUTE_ID *idAtt;
- int nDefaultAtts;
- int allocDefaultAtts;
- DEFAULT_ATTRIBUTE *defaultAtts;
-} ELEMENT_TYPE;
-
-typedef struct {
- HASH_TABLE generalEntities;
- HASH_TABLE elementTypes;
- HASH_TABLE attributeIds;
- HASH_TABLE prefixes;
- STRING_POOL pool;
- STRING_POOL entityValuePool;
- /* false once a parameter entity reference has been skipped */
- XML_Bool keepProcessing;
- /* true once an internal or external PE reference has been encountered;
- any external subset is considered an external PE reference */
- XML_Bool hasParamEntityRefs;
- XML_Bool standalone;
-#ifdef XML_DTD
- /* indicates if external PE has been read */
- XML_Bool paramEntityRead;
- HASH_TABLE paramEntities;
-#endif /* XML_DTD */
- PREFIX defaultPrefix;
- /* === scaffolding for building content model === */
- XML_Bool in_eldecl;
- CONTENT_SCAFFOLD *scaffold;
- unsigned contentStringLen;
- unsigned scaffSize;
- unsigned scaffCount;
- int scaffLevel;
- int *scaffIndex;
-} DTD;
-
-typedef struct open_internal_entity {
- const char *internalEventPtr;
- const char *internalEventEndPtr;
- struct open_internal_entity *next;
- ENTITY *entity;
-} OPEN_INTERNAL_ENTITY;
-
-typedef enum XML_Error FASTCALL Processor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr);
-
-static Processor prologProcessor;
-static Processor prologInitProcessor;
-static Processor contentProcessor;
-static Processor cdataSectionProcessor;
-#ifdef XML_DTD
-static Processor ignoreSectionProcessor;
-static Processor externalParEntProcessor;
-static Processor externalParEntInitProcessor;
-static Processor entityValueProcessor;
-static Processor entityValueInitProcessor;
-#endif /* XML_DTD */
-static Processor epilogProcessor;
-static Processor errorProcessor;
-static Processor externalEntityInitProcessor;
-static Processor externalEntityInitProcessor2;
-static Processor externalEntityInitProcessor3;
-static Processor externalEntityContentProcessor;
-
-static enum XML_Error FASTCALL
-handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName);
-static enum XML_Error FASTCALL
-processXmlDecl(XML_Parser parser, int isGeneralTextEntity,
- const char *, const char *);
-static enum XML_Error FASTCALL
-initializeEncoding(XML_Parser parser);
-static enum XML_Error FASTCALL
-doProlog(XML_Parser parser, const ENCODING *enc, const char *s,
- const char *end, int tok, const char *next, const char **nextPtr);
-static enum XML_Error FASTCALL
-processInternalParamEntity(XML_Parser parser, ENTITY *entity);
-static enum XML_Error FASTCALL
-doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,
- const char *start, const char *end, const char **endPtr);
-static enum XML_Error FASTCALL
-doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr,
- const char *end, const char **nextPtr);
-#ifdef XML_DTD
-static enum XML_Error FASTCALL
-doIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr,
- const char *end, const char **nextPtr);
-#endif /* XML_DTD */
-static enum XML_Error FASTCALL
-storeAtts(XML_Parser parser, const ENCODING *,
- const char *s, TAG_NAME *tagNamePtr, BINDING **bindingsPtr);
-static int FASTCALL
-addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,
- const XML_Char *uri, BINDING **bindingsPtr);
-
-static int FASTCALL
-defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *,
- XML_Bool isCdata, XML_Bool isId, const XML_Char *dfltValue,
- XML_Parser parser);
-
-static enum XML_Error FASTCALL
-storeAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata,
- const char *, const char *, STRING_POOL *);
-static enum XML_Error FASTCALL
-appendAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata,
- const char *, const char *, STRING_POOL *);
-static ATTRIBUTE_ID * FASTCALL
-getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start,
- const char *end);
-static int FASTCALL
-setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *);
-static enum XML_Error FASTCALL
-storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *start,
- const char *end);
-static int FASTCALL
-reportProcessingInstruction(XML_Parser parser, const ENCODING *enc,
- const char *start, const char *end);
-static int FASTCALL
-reportComment(XML_Parser parser, const ENCODING *enc, const char *start,
- const char *end);
-static void FASTCALL
-reportDefault(XML_Parser parser, const ENCODING *enc, const char *start,
- const char *end);
-
-static const XML_Char * FASTCALL getContext(XML_Parser parser);
-static XML_Bool FASTCALL
-setContext(XML_Parser parser, const XML_Char *context);
-static void FASTCALL normalizePublicId(XML_Char *s);
-static void FASTCALL dtdInit(DTD *, XML_Parser parser);
-
-/* do not call if parentParser != NULL */
-static void FASTCALL dtdReset(DTD *, XML_Parser parser);
-static void FASTCALL dtdDestroy(DTD *, XML_Parser parser);
-
-static int FASTCALL dtdCopy(DTD *newDtd, const DTD *oldDtd, XML_Parser parser);
-
-static int FASTCALL copyEntityTable(HASH_TABLE *, STRING_POOL *,
- const HASH_TABLE *, XML_Parser parser);
-
-#ifdef XML_DTD
-static void FASTCALL dtdSwap(DTD *, DTD *);
-#endif /* XML_DTD */
-
-static NAMED * FASTCALL
-lookup(HASH_TABLE *table, KEY name, size_t createSize);
-
-static void FASTCALL
-hashTableInit(HASH_TABLE *, XML_Memory_Handling_Suite *ms);
-
-static void FASTCALL hashTableClear(HASH_TABLE *);
-static void FASTCALL hashTableDestroy(HASH_TABLE *);
-static void FASTCALL hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *);
-static NAMED * FASTCALL hashTableIterNext(HASH_TABLE_ITER *);
-static void FASTCALL poolInit(STRING_POOL *, XML_Memory_Handling_Suite *ms);
-static void FASTCALL poolClear(STRING_POOL *);
-static void FASTCALL poolDestroy(STRING_POOL *);
-static XML_Char * FASTCALL
-poolAppend(STRING_POOL *pool, const ENCODING *enc,
- const char *ptr, const char *end);
-static XML_Char * FASTCALL
-poolStoreString(STRING_POOL *pool, const ENCODING *enc,
- const char *ptr, const char *end);
-
-static XML_Bool FASTCALL poolGrow(STRING_POOL *pool);
-
-static int FASTCALL nextScaffoldPart(XML_Parser parser);
-static XML_Content * FASTCALL build_model(XML_Parser parser);
-
-static const XML_Char * FASTCALL
-poolCopyString(STRING_POOL *pool, const XML_Char *s);
-static const XML_Char * FASTCALL
-poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n);
-static const XML_Char * FASTCALL
-poolAppendString(STRING_POOL *pool, const XML_Char *s);
-static ELEMENT_TYPE * FASTCALL
-getElementType(XML_Parser Paraser, const ENCODING *enc,
- const char *ptr, const char *end);
-
-static void FASTCALL
-parserInit(XML_Parser parser, const XML_Char *encodingName);
-
-#define poolStart(pool) ((pool)->start)
-#define poolEnd(pool) ((pool)->ptr)
-#define poolLength(pool) ((pool)->ptr - (pool)->start)
-#define poolChop(pool) ((void)--(pool->ptr))
-#define poolLastChar(pool) (((pool)->ptr)[-1])
-#define poolDiscard(pool) ((pool)->ptr = (pool)->start)
-#define poolFinish(pool) ((pool)->start = (pool)->ptr)
-#define poolAppendChar(pool, c) \
- (((pool)->ptr == (pool)->end && !poolGrow(pool)) \
- ? 0 \
- : ((*((pool)->ptr)++ = c), 1))
-
-struct XML_ParserStruct {
- /* The first member must be userData so that the XML_GetUserData
- macro works. */
- void *m_userData;
- void *m_handlerArg;
- char *m_buffer;
- XML_Memory_Handling_Suite m_mem;
- /* first character to be parsed */
- const char *m_bufferPtr;
- /* past last character to be parsed */
- char *m_bufferEnd;
- /* allocated end of buffer */
- const char *m_bufferLim;
- long m_parseEndByteIndex;
- const char *m_parseEndPtr;
- XML_Char *m_dataBuf;
- XML_Char *m_dataBufEnd;
- XML_StartElementHandler m_startElementHandler;
- XML_EndElementHandler m_endElementHandler;
- XML_CharacterDataHandler m_characterDataHandler;
- XML_ProcessingInstructionHandler m_processingInstructionHandler;
- XML_CommentHandler m_commentHandler;
- XML_StartCdataSectionHandler m_startCdataSectionHandler;
- XML_EndCdataSectionHandler m_endCdataSectionHandler;
- XML_DefaultHandler m_defaultHandler;
- XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler;
- XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler;
- XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler;
- XML_NotationDeclHandler m_notationDeclHandler;
- XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler;
- XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler;
- XML_NotStandaloneHandler m_notStandaloneHandler;
- XML_ExternalEntityRefHandler m_externalEntityRefHandler;
- void *m_externalEntityRefHandlerArg;
- XML_SkippedEntityHandler m_skippedEntityHandler;
- XML_UnknownEncodingHandler m_unknownEncodingHandler;
- XML_ElementDeclHandler m_elementDeclHandler;
- XML_AttlistDeclHandler m_attlistDeclHandler;
- XML_EntityDeclHandler m_entityDeclHandler;
- XML_XmlDeclHandler m_xmlDeclHandler;
- const ENCODING *m_encoding;
- INIT_ENCODING m_initEncoding;
- const ENCODING *m_internalEncoding;
- const XML_Char *m_protocolEncodingName;
- XML_Bool m_ns;
- XML_Bool m_ns_triplets;
- void *m_unknownEncodingMem;
- void *m_unknownEncodingData;
- void *m_unknownEncodingHandlerData;
- void (*m_unknownEncodingRelease)(void *);
- PROLOG_STATE m_prologState;
- Processor *m_processor;
- enum XML_Error m_errorCode;
- const char *m_eventPtr;
- const char *m_eventEndPtr;
- const char *m_positionPtr;
- OPEN_INTERNAL_ENTITY *m_openInternalEntities;
- XML_Bool m_defaultExpandInternalEntities;
- int m_tagLevel;
- ENTITY *m_declEntity;
- const XML_Char *m_doctypeName;
- const XML_Char *m_doctypeSysid;
- const XML_Char *m_doctypePubid;
- const XML_Char *m_declAttributeType;
- const XML_Char *m_declNotationName;
- const XML_Char *m_declNotationPublicId;
- ELEMENT_TYPE *m_declElementType;
- ATTRIBUTE_ID *m_declAttributeId;
- XML_Bool m_declAttributeIsCdata;
- XML_Bool m_declAttributeIsId;
- DTD m_dtd;
- const XML_Char *m_curBase;
- TAG *m_tagStack;
- TAG *m_freeTagList;
- BINDING *m_inheritedBindings;
- BINDING *m_freeBindingList;
- int m_attsSize;
- int m_nSpecifiedAtts;
- int m_idAttIndex;
- ATTRIBUTE *m_atts;
- POSITION m_position;
- STRING_POOL m_tempPool;
- STRING_POOL m_temp2Pool;
- char *m_groupConnector;
- unsigned m_groupSize;
- XML_Char m_namespaceSeparator;
- XML_Parser m_parentParser;
-#ifdef XML_DTD
- XML_Bool m_isParamEntity;
- XML_Bool m_useForeignDTD;
- enum XML_ParamEntityParsing m_paramEntityParsing;
-#endif
-};
-
-#define MALLOC(s) ((parser)->m_mem.malloc_fcn((s)))
-#define REALLOC(p,s) ((parser)->m_mem.realloc_fcn((p),(s)))
-#define FREE(p) ((parser)->m_mem.free_fcn((p)))
-
-#define userData (parser->m_userData)
-#define handlerArg (parser->m_handlerArg)
-#define startElementHandler (parser->m_startElementHandler)
-#define endElementHandler (parser->m_endElementHandler)
-#define characterDataHandler (parser->m_characterDataHandler)
-#define processingInstructionHandler \
- (parser->m_processingInstructionHandler)
-#define commentHandler (parser->m_commentHandler)
-#define startCdataSectionHandler \
- (parser->m_startCdataSectionHandler)
-#define endCdataSectionHandler (parser->m_endCdataSectionHandler)
-#define defaultHandler (parser->m_defaultHandler)
-#define startDoctypeDeclHandler (parser->m_startDoctypeDeclHandler)
-#define endDoctypeDeclHandler (parser->m_endDoctypeDeclHandler)
-#define unparsedEntityDeclHandler \
- (parser->m_unparsedEntityDeclHandler)
-#define notationDeclHandler (parser->m_notationDeclHandler)
-#define startNamespaceDeclHandler \
- (parser->m_startNamespaceDeclHandler)
-#define endNamespaceDeclHandler (parser->m_endNamespaceDeclHandler)
-#define notStandaloneHandler (parser->m_notStandaloneHandler)
-#define externalEntityRefHandler \
- (parser->m_externalEntityRefHandler)
-#define externalEntityRefHandlerArg \
- (parser->m_externalEntityRefHandlerArg)
-#define internalEntityRefHandler \
- (parser->m_internalEntityRefHandler)
-#define skippedEntityHandler (parser->m_skippedEntityHandler)
-#define unknownEncodingHandler (parser->m_unknownEncodingHandler)
-#define elementDeclHandler (parser->m_elementDeclHandler)
-#define attlistDeclHandler (parser->m_attlistDeclHandler)
-#define entityDeclHandler (parser->m_entityDeclHandler)
-#define xmlDeclHandler (parser->m_xmlDeclHandler)
-#define encoding (parser->m_encoding)
-#define initEncoding (parser->m_initEncoding)
-#define internalEncoding (parser->m_internalEncoding)
-#define unknownEncodingMem (parser->m_unknownEncodingMem)
-#define unknownEncodingData (parser->m_unknownEncodingData)
-#define unknownEncodingHandlerData \
- (parser->m_unknownEncodingHandlerData)
-#define unknownEncodingRelease (parser->m_unknownEncodingRelease)
-#define protocolEncodingName (parser->m_protocolEncodingName)
-#define ns (parser->m_ns)
-#define ns_triplets (parser->m_ns_triplets)
-#define prologState (parser->m_prologState)
-#define processor (parser->m_processor)
-#define errorCode (parser->m_errorCode)
-#define eventPtr (parser->m_eventPtr)
-#define eventEndPtr (parser->m_eventEndPtr)
-#define positionPtr (parser->m_positionPtr)
-#define position (parser->m_position)
-#define openInternalEntities (parser->m_openInternalEntities)
-#define defaultExpandInternalEntities \
- (parser->m_defaultExpandInternalEntities)
-#define tagLevel (parser->m_tagLevel)
-#define buffer (parser->m_buffer)
-#define bufferPtr (parser->m_bufferPtr)
-#define bufferEnd (parser->m_bufferEnd)
-#define parseEndByteIndex (parser->m_parseEndByteIndex)
-#define parseEndPtr (parser->m_parseEndPtr)
-#define bufferLim (parser->m_bufferLim)
-#define dataBuf (parser->m_dataBuf)
-#define dataBufEnd (parser->m_dataBufEnd)
-#define dtd (parser->m_dtd)
-#define curBase (parser->m_curBase)
-#define declEntity (parser->m_declEntity)
-#define doctypeName (parser->m_doctypeName)
-#define doctypeSysid (parser->m_doctypeSysid)
-#define doctypePubid (parser->m_doctypePubid)
-#define declAttributeType (parser->m_declAttributeType)
-#define declNotationName (parser->m_declNotationName)
-#define declNotationPublicId (parser->m_declNotationPublicId)
-#define declElementType (parser->m_declElementType)
-#define declAttributeId (parser->m_declAttributeId)
-#define declAttributeIsCdata (parser->m_declAttributeIsCdata)
-#define declAttributeIsId (parser->m_declAttributeIsId)
-#define freeTagList (parser->m_freeTagList)
-#define freeBindingList (parser->m_freeBindingList)
-#define inheritedBindings (parser->m_inheritedBindings)
-#define tagStack (parser->m_tagStack)
-#define atts (parser->m_atts)
-#define attsSize (parser->m_attsSize)
-#define nSpecifiedAtts (parser->m_nSpecifiedAtts)
-#define idAttIndex (parser->m_idAttIndex)
-#define tempPool (parser->m_tempPool)
-#define temp2Pool (parser->m_temp2Pool)
-#define groupConnector (parser->m_groupConnector)
-#define groupSize (parser->m_groupSize)
-#define namespaceSeparator (parser->m_namespaceSeparator)
-#define parentParser (parser->m_parentParser)
-#ifdef XML_DTD
-#define isParamEntity (parser->m_isParamEntity)
-#define useForeignDTD (parser->m_useForeignDTD)
-#define paramEntityParsing (parser->m_paramEntityParsing)
-#endif /* XML_DTD */
-
-#define parsing (processor != prologInitProcessor)
-
-
-XML_Parser
-XML_ParserCreate(const XML_Char *encodingName)
-{
- return XML_ParserCreate_MM(encodingName, NULL, NULL);
-}
-
-XML_Parser
-XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep)
-{
- XML_Char tmp[2];
- *tmp = nsSep;
- return XML_ParserCreate_MM(encodingName, NULL, tmp);
-}
-
-XML_Parser
-XML_ParserCreate_MM(const XML_Char *encodingName,
- const XML_Memory_Handling_Suite *memsuite,
- const XML_Char *nameSep) {
- XML_Parser parser;
- static const XML_Char implicitContext[] = {
- 'x', 'm', 'l', '=', 'h', 't', 't', 'p', ':', '/', '/',
- 'w', 'w', 'w', '.', 'w', '3', '.', 'o', 'r', 'g', '/',
- 'X', 'M', 'L', '/', '1', '9', '9', '8', '/',
- 'n', 'a', 'm', 'e', 's', 'p', 'a', 'c', 'e', '\0'
- };
-
-
- if (memsuite) {
- XML_Memory_Handling_Suite *mtemp;
- parser = memsuite->malloc_fcn(sizeof(struct XML_ParserStruct));
- if (parser != NULL) {
- mtemp = &(parser->m_mem);
- mtemp->malloc_fcn = memsuite->malloc_fcn;
- mtemp->realloc_fcn = memsuite->realloc_fcn;
- mtemp->free_fcn = memsuite->free_fcn;
- }
- }
- else {
- XML_Memory_Handling_Suite *mtemp;
- parser = malloc(sizeof(struct XML_ParserStruct));
- if (parser != NULL) {
- mtemp = &(parser->m_mem);
- mtemp->malloc_fcn = malloc;
- mtemp->realloc_fcn = realloc;
- mtemp->free_fcn = free;
- }
- }
-
- if (!parser)
- return parser;
-
- buffer = NULL;
- bufferLim = NULL;
-
- attsSize = INIT_ATTS_SIZE;
- atts = MALLOC(attsSize * sizeof(ATTRIBUTE));
- if (atts == NULL) {
- FREE(parser);
- return NULL;
- }
- dataBuf = MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char));
- if (dataBuf == NULL) {
- FREE(atts);
- FREE(parser);
- return NULL;
- }
- dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE;
-
- freeBindingList = NULL;
- freeTagList = NULL;
-
- groupSize = 0;
- groupConnector = NULL;
-
- unknownEncodingHandler = NULL;
- unknownEncodingHandlerData = NULL;
-
- namespaceSeparator = '!';
- ns = XML_FALSE;
- ns_triplets = XML_FALSE;
-
- poolInit(&tempPool, &(parser->m_mem));
- poolInit(&temp2Pool, &(parser->m_mem));
- parserInit(parser, encodingName);
- dtdInit(&dtd, parser);
-
- if (!atts || !dataBuf || (encodingName && !protocolEncodingName)) {
- XML_ParserFree(parser);
- return NULL;
- }
-
- if (nameSep) {
- ns = XML_TRUE;
- internalEncoding = XmlGetInternalEncodingNS();
- namespaceSeparator = *nameSep;
-
- if (!setContext(parser, implicitContext)) {
- XML_ParserFree(parser);
- return NULL;
- }
- }
- else {
- internalEncoding = XmlGetInternalEncoding();
- }
-
- return parser;
-}
-
-static void FASTCALL
-parserInit(XML_Parser parser, const XML_Char *encodingName)
-{
- processor = prologInitProcessor;
- XmlPrologStateInit(&prologState);
- protocolEncodingName = (encodingName != NULL
- ? poolCopyString(&tempPool, encodingName)
- : NULL);
- curBase = NULL;
- XmlInitEncoding(&initEncoding, &encoding, 0);
- userData = NULL;
- handlerArg = NULL;
- startElementHandler = NULL;
- endElementHandler = NULL;
- characterDataHandler = NULL;
- processingInstructionHandler = NULL;
- commentHandler = NULL;
- startCdataSectionHandler = NULL;
- endCdataSectionHandler = NULL;
- defaultHandler = NULL;
- startDoctypeDeclHandler = NULL;
- endDoctypeDeclHandler = NULL;
- unparsedEntityDeclHandler = NULL;
- notationDeclHandler = NULL;
- startNamespaceDeclHandler = NULL;
- endNamespaceDeclHandler = NULL;
- notStandaloneHandler = NULL;
- externalEntityRefHandler = NULL;
- externalEntityRefHandlerArg = parser;
- skippedEntityHandler = NULL;
- elementDeclHandler = NULL;
- attlistDeclHandler = NULL;
- entityDeclHandler = NULL;
- xmlDeclHandler = NULL;
- bufferPtr = buffer;
- bufferEnd = buffer;
- parseEndByteIndex = 0;
- parseEndPtr = NULL;
- declElementType = NULL;
- declAttributeId = NULL;
- declEntity = NULL;
- doctypeName = NULL;
- doctypeSysid = NULL;
- doctypePubid = NULL;
- declAttributeType = NULL;
- declNotationName = NULL;
- declNotationPublicId = NULL;
- declAttributeIsCdata = XML_FALSE;
- declAttributeIsId = XML_FALSE;
- memset(&position, 0, sizeof(POSITION));
- errorCode = XML_ERROR_NONE;
- eventPtr = NULL;
- eventEndPtr = NULL;
- positionPtr = NULL;
- openInternalEntities = 0;
- defaultExpandInternalEntities = XML_TRUE;
- tagLevel = 0;
- tagStack = NULL;
- inheritedBindings = NULL;
- nSpecifiedAtts = 0;
- unknownEncodingMem = NULL;
- unknownEncodingRelease = NULL;
- unknownEncodingData = NULL;
- parentParser = NULL;
-#ifdef XML_DTD
- isParamEntity = XML_FALSE;
- useForeignDTD = XML_FALSE;
- paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
-#endif
-}
-
-/* moves list of bindings to freeBindingList */
-static void FASTCALL
-moveToFreeBindingList(XML_Parser parser, BINDING *bindings)
-{
- while (bindings) {
- BINDING *b = bindings;
- bindings = bindings->nextTagBinding;
- b->nextTagBinding = freeBindingList;
- freeBindingList = b;
- }
-}
-
-XML_Bool
-XML_ParserReset(XML_Parser parser, const XML_Char *encodingName)
-{
- TAG *tStk;
- if (parentParser)
- return XML_FALSE;
- /* move tagStack to freeTagList */
- tStk = tagStack;
- while (tStk) {
- TAG *tag = tStk;
- tStk = tStk->parent;
- tag->parent = freeTagList;
- moveToFreeBindingList(parser, tag->bindings);
- tag->bindings = NULL;
- freeTagList = tag;
- }
- moveToFreeBindingList(parser, inheritedBindings);
- if (unknownEncodingMem)
- FREE(unknownEncodingMem);
- if (unknownEncodingRelease)
- unknownEncodingRelease(unknownEncodingData);
- poolClear(&tempPool);
- poolClear(&temp2Pool);
- parserInit(parser, encodingName);
- dtdReset(&dtd, parser);
- return XML_TRUE;
-}
-
-int
-XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName)
-{
- /* block after XML_Parse()/XML_ParseBuffer() has been called */
- if (parsing)
- return 0;
- if (encodingName == NULL)
- protocolEncodingName = NULL;
- else {
- protocolEncodingName = poolCopyString(&tempPool, encodingName);
- if (!protocolEncodingName)
- return 0;
- }
- return 1;
-}
-
-XML_Parser
-XML_ExternalEntityParserCreate(XML_Parser oldParser,
- const XML_Char *context,
- const XML_Char *encodingName)
-{
- XML_Parser parser = oldParser;
- DTD *oldDtd = &dtd;
- XML_StartElementHandler oldStartElementHandler = startElementHandler;
- XML_EndElementHandler oldEndElementHandler = endElementHandler;
- XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler;
- XML_ProcessingInstructionHandler oldProcessingInstructionHandler
- = processingInstructionHandler;
- XML_CommentHandler oldCommentHandler = commentHandler;
- XML_StartCdataSectionHandler oldStartCdataSectionHandler
- = startCdataSectionHandler;
- XML_EndCdataSectionHandler oldEndCdataSectionHandler
- = endCdataSectionHandler;
- XML_DefaultHandler oldDefaultHandler = defaultHandler;
- XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler
- = unparsedEntityDeclHandler;
- XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler;
- XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler
- = startNamespaceDeclHandler;
- XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler
- = endNamespaceDeclHandler;
- XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler;
- XML_ExternalEntityRefHandler oldExternalEntityRefHandler
- = externalEntityRefHandler;
- XML_SkippedEntityHandler oldSkippedEntityHandler = skippedEntityHandler;
- XML_UnknownEncodingHandler oldUnknownEncodingHandler
- = unknownEncodingHandler;
- XML_ElementDeclHandler oldElementDeclHandler = elementDeclHandler;
- XML_AttlistDeclHandler oldAttlistDeclHandler = attlistDeclHandler;
- XML_EntityDeclHandler oldEntityDeclHandler = entityDeclHandler;
- XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler;
- ELEMENT_TYPE * oldDeclElementType = declElementType;
-
- void *oldUserData = userData;
- void *oldHandlerArg = handlerArg;
- XML_Bool oldDefaultExpandInternalEntities = defaultExpandInternalEntities;
- void *oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg;
-#ifdef XML_DTD
- int oldParamEntityParsing = paramEntityParsing;
- int oldInEntityValue = prologState.inEntityValue;
-#endif
- XML_Bool oldns_triplets = ns_triplets;
-
- /* Note that the magical uses of the pre-processor to make field
- access look more like C++ require that `parser' be overwritten
- here. This makes this function more painful to follow than it
- would be otherwise.
- */
- if (ns) {
- XML_Char tmp[2];
-
- *tmp = namespaceSeparator;
- parser = XML_ParserCreate_MM(encodingName, &parser->m_mem,
- tmp);
- }
- else {
- parser = XML_ParserCreate_MM(encodingName, &parser->m_mem,
- NULL);
- }
-
- if (!parser)
- return NULL;
-
- startElementHandler = oldStartElementHandler;
- endElementHandler = oldEndElementHandler;
- characterDataHandler = oldCharacterDataHandler;
- processingInstructionHandler = oldProcessingInstructionHandler;
- commentHandler = oldCommentHandler;
- startCdataSectionHandler = oldStartCdataSectionHandler;
- endCdataSectionHandler = oldEndCdataSectionHandler;
- defaultHandler = oldDefaultHandler;
- unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler;
- notationDeclHandler = oldNotationDeclHandler;
- startNamespaceDeclHandler = oldStartNamespaceDeclHandler;
- endNamespaceDeclHandler = oldEndNamespaceDeclHandler;
- notStandaloneHandler = oldNotStandaloneHandler;
- externalEntityRefHandler = oldExternalEntityRefHandler;
- skippedEntityHandler = oldSkippedEntityHandler;
- unknownEncodingHandler = oldUnknownEncodingHandler;
- elementDeclHandler = oldElementDeclHandler;
- attlistDeclHandler = oldAttlistDeclHandler;
- entityDeclHandler = oldEntityDeclHandler;
- xmlDeclHandler = oldXmlDeclHandler;
- declElementType = oldDeclElementType;
- userData = oldUserData;
- if (oldUserData == oldHandlerArg)
- handlerArg = userData;
- else
- handlerArg = parser;
- if (oldExternalEntityRefHandlerArg != oldParser)
- externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg;
- defaultExpandInternalEntities = oldDefaultExpandInternalEntities;
- ns_triplets = oldns_triplets;
- parentParser = oldParser;
-#ifdef XML_DTD
- paramEntityParsing = oldParamEntityParsing;
- prologState.inEntityValue = oldInEntityValue;
- if (context) {
-#endif /* XML_DTD */
- if (!dtdCopy(&dtd, oldDtd, parser) || !setContext(parser, context)) {
- XML_ParserFree(parser);
- return NULL;
- }
- processor = externalEntityInitProcessor;
-#ifdef XML_DTD
- }
- else {
- dtdSwap(&dtd, oldDtd);
- isParamEntity = XML_TRUE;
- XmlPrologStateInitExternalEntity(&prologState);
- processor = externalParEntInitProcessor;
- }
-#endif /* XML_DTD */
- return parser;
-}
-
-static void FASTCALL
-destroyBindings(BINDING *bindings, XML_Parser parser)
-{
- for (;;) {
- BINDING *b = bindings;
- if (!b)
- break;
- bindings = b->nextTagBinding;
- FREE(b->uri);
- FREE(b);
- }
-}
-
-void
-XML_ParserFree(XML_Parser parser)
-{
- for (;;) {
- TAG *p;
- if (tagStack == 0) {
- if (freeTagList == NULL)
- break;
- tagStack = freeTagList;
- freeTagList = NULL;
- }
- p = tagStack;
- tagStack = tagStack->parent;
- FREE(p->buf);
- destroyBindings(p->bindings, parser);
- FREE(p);
- }
- destroyBindings(freeBindingList, parser);
- destroyBindings(inheritedBindings, parser);
- poolDestroy(&tempPool);
- poolDestroy(&temp2Pool);
-#ifdef XML_DTD
- if (isParamEntity)
- dtdSwap(&dtd, &parentParser->m_dtd);
-#endif /* XML_DTD */
- dtdDestroy(&dtd, parser);
- FREE((void *)atts);
- if (groupConnector)
- FREE(groupConnector);
- if (buffer)
- FREE(buffer);
- FREE(dataBuf);
- if (unknownEncodingMem)
- FREE(unknownEncodingMem);
- if (unknownEncodingRelease)
- unknownEncodingRelease(unknownEncodingData);
- FREE(parser);
-}
-
-void
-XML_UseParserAsHandlerArg(XML_Parser parser)
-{
- handlerArg = parser;
-}
-
-enum XML_Error
-XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD)
-{
-#ifdef XML_DTD
- /* block after XML_Parse()/XML_ParseBuffer() has been called */
- if (parsing)
- return XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING;
- useForeignDTD = useDTD;
- return XML_ERROR_NONE;
-#else
- return XML_ERROR_FEATURE_REQUIRES_XML_DTD;
-#endif
-}
-
-void
-XML_SetReturnNSTriplet(XML_Parser parser, int do_nst)
-{
- /* block after XML_Parse()/XML_ParseBuffer() has been called */
- if (parsing)
- return;
- ns_triplets = do_nst ? XML_TRUE : XML_FALSE;
-}
-
-void
-XML_SetUserData(XML_Parser parser, void *p)
-{
- if (handlerArg == userData)
- handlerArg = userData = p;
- else
- userData = p;
-}
-
-int
-XML_SetBase(XML_Parser parser, const XML_Char *p)
-{
- if (p) {
- p = poolCopyString(&dtd.pool, p);
- if (!p)
- return 0;
- curBase = p;
- }
- else
- curBase = NULL;
- return 1;
-}
-
-const XML_Char *
-XML_GetBase(XML_Parser parser)
-{
- return curBase;
-}
-
-int
-XML_GetSpecifiedAttributeCount(XML_Parser parser)
-{
- return nSpecifiedAtts;
-}
-
-int
-XML_GetIdAttributeIndex(XML_Parser parser)
-{
- return idAttIndex;
-}
-
-void
-XML_SetElementHandler(XML_Parser parser,
- XML_StartElementHandler start,
- XML_EndElementHandler end)
-{
- startElementHandler = start;
- endElementHandler = end;
-}
-
-void
-XML_SetStartElementHandler(XML_Parser parser,
- XML_StartElementHandler start) {
- startElementHandler = start;
-}
-
-void
-XML_SetEndElementHandler(XML_Parser parser,
- XML_EndElementHandler end) {
- endElementHandler = end;
-}
-
-void
-XML_SetCharacterDataHandler(XML_Parser parser,
- XML_CharacterDataHandler handler)
-{
- characterDataHandler = handler;
-}
-
-void
-XML_SetProcessingInstructionHandler(XML_Parser parser,
- XML_ProcessingInstructionHandler handler)
-{
- processingInstructionHandler = handler;
-}
-
-void
-XML_SetCommentHandler(XML_Parser parser,
- XML_CommentHandler handler)
-{
- commentHandler = handler;
-}
-
-void
-XML_SetCdataSectionHandler(XML_Parser parser,
- XML_StartCdataSectionHandler start,
- XML_EndCdataSectionHandler end)
-{
- startCdataSectionHandler = start;
- endCdataSectionHandler = end;
-}
-
-void
-XML_SetStartCdataSectionHandler(XML_Parser parser,
- XML_StartCdataSectionHandler start) {
- startCdataSectionHandler = start;
-}
-
-void
-XML_SetEndCdataSectionHandler(XML_Parser parser,
- XML_EndCdataSectionHandler end) {
- endCdataSectionHandler = end;
-}
-
-void
-XML_SetDefaultHandler(XML_Parser parser,
- XML_DefaultHandler handler)
-{
- defaultHandler = handler;
- defaultExpandInternalEntities = XML_FALSE;
-}
-
-void
-XML_SetDefaultHandlerExpand(XML_Parser parser,
- XML_DefaultHandler handler)
-{
- defaultHandler = handler;
- defaultExpandInternalEntities = XML_TRUE;
-}
-
-void
-XML_SetDoctypeDeclHandler(XML_Parser parser,
- XML_StartDoctypeDeclHandler start,
- XML_EndDoctypeDeclHandler end)
-{
- startDoctypeDeclHandler = start;
- endDoctypeDeclHandler = end;
-}
-
-void
-XML_SetStartDoctypeDeclHandler(XML_Parser parser,
- XML_StartDoctypeDeclHandler start) {
- startDoctypeDeclHandler = start;
-}
-
-void
-XML_SetEndDoctypeDeclHandler(XML_Parser parser,
- XML_EndDoctypeDeclHandler end) {
- endDoctypeDeclHandler = end;
-}
-
-void
-XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
- XML_UnparsedEntityDeclHandler handler)
-{
- unparsedEntityDeclHandler = handler;
-}
-
-void
-XML_SetNotationDeclHandler(XML_Parser parser,
- XML_NotationDeclHandler handler)
-{
- notationDeclHandler = handler;
-}
-
-void
-XML_SetNamespaceDeclHandler(XML_Parser parser,
- XML_StartNamespaceDeclHandler start,
- XML_EndNamespaceDeclHandler end)
-{
- startNamespaceDeclHandler = start;
- endNamespaceDeclHandler = end;
-}
-
-void
-XML_SetStartNamespaceDeclHandler(XML_Parser parser,
- XML_StartNamespaceDeclHandler start) {
- startNamespaceDeclHandler = start;
-}
-
-void
-XML_SetEndNamespaceDeclHandler(XML_Parser parser,
- XML_EndNamespaceDeclHandler end) {
- endNamespaceDeclHandler = end;
-}
-
-void
-XML_SetNotStandaloneHandler(XML_Parser parser,
- XML_NotStandaloneHandler handler)
-{
- notStandaloneHandler = handler;
-}
-
-void
-XML_SetExternalEntityRefHandler(XML_Parser parser,
- XML_ExternalEntityRefHandler handler)
-{
- externalEntityRefHandler = handler;
-}
-
-void
-XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg)
-{
- if (arg)
- externalEntityRefHandlerArg = arg;
- else
- externalEntityRefHandlerArg = parser;
-}
-
-void
-XML_SetSkippedEntityHandler(XML_Parser parser,
- XML_SkippedEntityHandler handler)
-{
- skippedEntityHandler = handler;
-}
-
-void
-XML_SetUnknownEncodingHandler(XML_Parser parser,
- XML_UnknownEncodingHandler handler,
- void *data)
-{
- unknownEncodingHandler = handler;
- unknownEncodingHandlerData = data;
-}
-
-void
-XML_SetElementDeclHandler(XML_Parser parser,
- XML_ElementDeclHandler eldecl)
-{
- elementDeclHandler = eldecl;
-}
-
-void
-XML_SetAttlistDeclHandler(XML_Parser parser,
- XML_AttlistDeclHandler attdecl)
-{
- attlistDeclHandler = attdecl;
-}
-
-void
-XML_SetEntityDeclHandler(XML_Parser parser,
- XML_EntityDeclHandler handler)
-{
- entityDeclHandler = handler;
-}
-
-void
-XML_SetXmlDeclHandler(XML_Parser parser,
- XML_XmlDeclHandler handler) {
- xmlDeclHandler = handler;
-}
-
-int
-XML_SetParamEntityParsing(XML_Parser parser,
- enum XML_ParamEntityParsing peParsing)
-{
- /* block after XML_Parse()/XML_ParseBuffer() has been called */
- if (parsing)
- return 0;
-#ifdef XML_DTD
- paramEntityParsing = peParsing;
- return 1;
-#else
- return peParsing == XML_PARAM_ENTITY_PARSING_NEVER;
-#endif
-}
-
-enum XML_Status
-XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
-{
- if (len == 0) {
- if (!isFinal)
- return XML_STATUS_OK;
- positionPtr = bufferPtr;
- errorCode = processor(parser, bufferPtr, parseEndPtr = bufferEnd, 0);
- if (errorCode == XML_ERROR_NONE)
- return XML_STATUS_OK;
- eventEndPtr = eventPtr;
- processor = errorProcessor;
- return XML_STATUS_ERROR;
- }
-#ifndef XML_CONTEXT_BYTES
- else if (bufferPtr == bufferEnd) {
- const char *end;
- int nLeftOver;
- parseEndByteIndex += len;
- positionPtr = s;
- if (isFinal) {
- errorCode = processor(parser, s, parseEndPtr = s + len, 0);
- if (errorCode == XML_ERROR_NONE)
- return XML_STATUS_OK;
- eventEndPtr = eventPtr;
- processor = errorProcessor;
- return XML_STATUS_ERROR;
- }
- errorCode = processor(parser, s, parseEndPtr = s + len, &end);
- if (errorCode != XML_ERROR_NONE) {
- eventEndPtr = eventPtr;
- processor = errorProcessor;
- return XML_STATUS_ERROR;
- }
- XmlUpdatePosition(encoding, positionPtr, end, &position);
- nLeftOver = s + len - end;
- if (nLeftOver) {
- if (buffer == NULL || nLeftOver > bufferLim - buffer) {
- /* FIXME avoid integer overflow */
- char *temp;
- temp = buffer == NULL ? MALLOC(len * 2) : REALLOC(buffer, len * 2);
- if (temp == NULL) {
- errorCode = XML_ERROR_NO_MEMORY;
- return XML_STATUS_ERROR;
- }
- buffer = temp;
- if (!buffer) {
- errorCode = XML_ERROR_NO_MEMORY;
- eventPtr = eventEndPtr = NULL;
- processor = errorProcessor;
- return XML_STATUS_ERROR;
- }
- bufferLim = buffer + len * 2;
- }
- memcpy(buffer, end, nLeftOver);
- bufferPtr = buffer;
- bufferEnd = buffer + nLeftOver;
- }
- return XML_STATUS_OK;
- }
-#endif /* not defined XML_CONTEXT_BYTES */
- else {
- void *buff = XML_GetBuffer(parser, len);
- if (buff == NULL)
- return XML_STATUS_ERROR;
- else {
- memcpy(buff, s, len);
- return XML_ParseBuffer(parser, len, isFinal);
- }
- }
-}
-
-enum XML_Status
-XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
-{
- const char *start = bufferPtr;
- positionPtr = start;
- bufferEnd += len;
- parseEndByteIndex += len;
- errorCode = processor(parser, start, parseEndPtr = bufferEnd,
- isFinal ? (const char **)NULL : &bufferPtr);
- if (errorCode == XML_ERROR_NONE) {
- if (!isFinal)
- XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position);
- return XML_STATUS_OK;
- }
- else {
- eventEndPtr = eventPtr;
- processor = errorProcessor;
- return XML_STATUS_ERROR;
- }
-}
-
-void *
-XML_GetBuffer(XML_Parser parser, int len)
-{
- if (len > bufferLim - bufferEnd) {
- /* FIXME avoid integer overflow */
- int neededSize = len + (bufferEnd - bufferPtr);
-#ifdef XML_CONTEXT_BYTES
- int keep = bufferPtr - buffer;
-
- if (keep > XML_CONTEXT_BYTES)
- keep = XML_CONTEXT_BYTES;
- neededSize += keep;
-#endif /* defined XML_CONTEXT_BYTES */
- if (neededSize <= bufferLim - buffer) {
-#ifdef XML_CONTEXT_BYTES
- if (keep < bufferPtr - buffer) {
- int offset = (bufferPtr - buffer) - keep;
- memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep);
- bufferEnd -= offset;
- bufferPtr -= offset;
- }
-#else
- memmove(buffer, bufferPtr, bufferEnd - bufferPtr);
- bufferEnd = buffer + (bufferEnd - bufferPtr);
- bufferPtr = buffer;
-#endif /* not defined XML_CONTEXT_BYTES */
- }
- else {
- char *newBuf;
- int bufferSize = bufferLim - bufferPtr;
- if (bufferSize == 0)
- bufferSize = INIT_BUFFER_SIZE;
- do {
- bufferSize *= 2;
- } while (bufferSize < neededSize);
- newBuf = MALLOC(bufferSize);
- if (newBuf == 0) {
- errorCode = XML_ERROR_NO_MEMORY;
- return NULL;
- }
- bufferLim = newBuf + bufferSize;
-#ifdef XML_CONTEXT_BYTES
- if (bufferPtr) {
- int keep = bufferPtr - buffer;
- if (keep > XML_CONTEXT_BYTES)
- keep = XML_CONTEXT_BYTES;
- memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep);
- FREE(buffer);
- buffer = newBuf;
- bufferEnd = buffer + (bufferEnd - bufferPtr) + keep;
- bufferPtr = buffer + keep;
- }
- else {
- bufferEnd = newBuf + (bufferEnd - bufferPtr);
- bufferPtr = buffer = newBuf;
- }
-#else
- if (bufferPtr) {
- memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr);
- FREE(buffer);
- }
- bufferEnd = newBuf + (bufferEnd - bufferPtr);
- bufferPtr = buffer = newBuf;
-#endif /* not defined XML_CONTEXT_BYTES */
- }
- }
- return bufferEnd;
-}
-
-enum XML_Error
-XML_GetErrorCode(XML_Parser parser)
-{
- return errorCode;
-}
-
-long
-XML_GetCurrentByteIndex(XML_Parser parser)
-{
- if (eventPtr)
- return parseEndByteIndex - (parseEndPtr - eventPtr);
- return -1;
-}
-
-int
-XML_GetCurrentByteCount(XML_Parser parser)
-{
- if (eventEndPtr && eventPtr)
- return eventEndPtr - eventPtr;
- return 0;
-}
-
-const char *
-XML_GetInputContext(XML_Parser parser, int *offset, int *size)
-{
-#ifdef XML_CONTEXT_BYTES
- if (eventPtr && buffer) {
- *offset = eventPtr - buffer;
- *size = bufferEnd - buffer;
- return buffer;
- }
-#endif /* defined XML_CONTEXT_BYTES */
- return (char *) 0;
-}
-
-int
-XML_GetCurrentLineNumber(XML_Parser parser)
-{
- if (eventPtr) {
- XmlUpdatePosition(encoding, positionPtr, eventPtr, &position);
- positionPtr = eventPtr;
- }
- return position.lineNumber + 1;
-}
-
-int
-XML_GetCurrentColumnNumber(XML_Parser parser)
-{
- if (eventPtr) {
- XmlUpdatePosition(encoding, positionPtr, eventPtr, &position);
- positionPtr = eventPtr;
- }
- return position.columnNumber;
-}
-
-void
-XML_DefaultCurrent(XML_Parser parser)
-{
- if (defaultHandler) {
- if (openInternalEntities)
- reportDefault(parser,
- internalEncoding,
- openInternalEntities->internalEventPtr,
- openInternalEntities->internalEventEndPtr);
- else
- reportDefault(parser, encoding, eventPtr, eventEndPtr);
- }
-}
-
-const XML_LChar *
-XML_ErrorString(enum XML_Error code)
-{
- static const XML_LChar *message[] = {
- 0,
- XML_L("out of memory"),
- XML_L("syntax error"),
- XML_L("no element found"),
- XML_L("not well-formed (invalid token)"),
- XML_L("unclosed token"),
- XML_L("partial character"),
- XML_L("mismatched tag"),
- XML_L("duplicate attribute"),
- XML_L("junk after document element"),
- XML_L("illegal parameter entity reference"),
- XML_L("undefined entity"),
- XML_L("recursive entity reference"),
- XML_L("asynchronous entity"),
- XML_L("reference to invalid character number"),
- XML_L("reference to binary entity"),
- XML_L("reference to external entity in attribute"),
- XML_L("xml declaration not at start of external entity"),
- XML_L("unknown encoding"),
- XML_L("encoding specified in XML declaration is incorrect"),
- XML_L("unclosed CDATA section"),
- XML_L("error in processing external entity reference"),
- XML_L("document is not standalone"),
- XML_L("unexpected parser state - please send a bug report"),
- XML_L("entity declared in parameter entity"),
- XML_L("requested feature requires XML_DTD support in Expat"),
- XML_L("cannot change setting once parsing has begun")
- };
- if (code > 0 && code < sizeof(message)/sizeof(message[0]))
- return message[code];
- return NULL;
-}
-
-const XML_LChar *
-XML_ExpatVersion(void) {
- return "1.95.5";
-}
-
-XML_Expat_Version
-XML_ExpatVersionInfo(void)
-{
- XML_Expat_Version version;
-
- version.major = XML_MAJOR_VERSION;
- version.minor = XML_MINOR_VERSION;
- version.micro = XML_MICRO_VERSION;
-
- return version;
-}
-
-const XML_Feature *
-XML_GetFeatureList(void)
-{
- static XML_Feature features[] = {
- {XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)")},
- {XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)")},
-#ifdef XML_UNICODE
- {XML_FEATURE_UNICODE, XML_L("XML_UNICODE")},
-#endif
-#ifdef XML_UNICODE_WCHAR_T
- {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T")},
-#endif
-#ifdef XML_DTD
- {XML_FEATURE_DTD, XML_L("XML_DTD")},
-#endif
-#ifdef XML_CONTEXT_BYTES
- {XML_FEATURE_CONTEXT_BYTES, XML_L("XML_CONTEXT_BYTES"),
- XML_CONTEXT_BYTES},
-#endif
-#ifdef XML_MIN_SIZE
- {XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE")},
-#endif
- {XML_FEATURE_END, NULL}
- };
-
- features[0].value = sizeof(XML_Char);
- features[1].value = sizeof(XML_LChar);
- return features;
-}
-
-/* Initially tag->rawName always points into the parse buffer;
- for those TAG instances opened while the current parse buffer was
- processed, and not yet closed, we need to store tag->rawName in a more
- permanent location, since the parse buffer is about to be discarded.
-*/
-static XML_Bool FASTCALL
-storeRawNames(XML_Parser parser)
-{
- TAG *tag = tagStack;
- while (tag) {
- int bufSize;
- int nameLen = sizeof(XML_Char) * (tag->name.strLen + 1);
- char *rawNameBuf = tag->buf + nameLen;
- /* Stop if already stored. Since tagStack is a stack, we can stop
- at the first entry that has already been copied; everything
- below it in the stack is already been accounted for in a
- previous call to this function.
- */
- if (tag->rawName == rawNameBuf)
- break;
- /* For re-use purposes we need to ensure that the
- size of tag->buf is a multiple of sizeof(XML_Char).
- */
- bufSize = nameLen + ROUND_UP(tag->rawNameLength, sizeof(XML_Char));
- if (bufSize > tag->bufEnd - tag->buf) {
- char *temp = REALLOC(tag->buf, bufSize);
- if (temp == NULL)
- return XML_FALSE;
- tag->buf = temp;
- tag->name.str = (XML_Char *)temp;
- tag->bufEnd = temp + bufSize;
- rawNameBuf = temp + nameLen;
- }
- memcpy(rawNameBuf, tag->rawName, tag->rawNameLength);
- tag->rawName = rawNameBuf;
- tag = tag->parent;
- }
- return XML_TRUE;
-}
-
-static enum XML_Error FASTCALL
-contentProcessor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- enum XML_Error result =
- doContent(parser, 0, encoding, start, end, endPtr);
- if (result != XML_ERROR_NONE)
- return result;
- if (!storeRawNames(parser))
- return XML_ERROR_NO_MEMORY;
- return result;
-}
-
-static enum XML_Error FASTCALL
-externalEntityInitProcessor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- enum XML_Error result = initializeEncoding(parser);
- if (result != XML_ERROR_NONE)
- return result;
- processor = externalEntityInitProcessor2;
- return externalEntityInitProcessor2(parser, start, end, endPtr);
-}
-
-static enum XML_Error FASTCALL
-externalEntityInitProcessor2(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- const char *next = start; /* XmlContentTok doesn't always set the last arg */
- int tok = XmlContentTok(encoding, start, end, &next);
- switch (tok) {
- case XML_TOK_BOM:
- /* If we are at the end of the buffer, this would cause the next stage,
- i.e. externalEntityInitProcessor3, to pass control directly to
- doContent (by detecting XML_TOK_NONE) without processing any xml text
- declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent.
- */
- if (next == end && endPtr) {
- *endPtr = next;
- return XML_ERROR_NONE;
- }
- start = next;
- break;
- case XML_TOK_PARTIAL:
- if (endPtr) {
- *endPtr = start;
- return XML_ERROR_NONE;
- }
- eventPtr = start;
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (endPtr) {
- *endPtr = start;
- return XML_ERROR_NONE;
- }
- eventPtr = start;
- return XML_ERROR_PARTIAL_CHAR;
- }
- processor = externalEntityInitProcessor3;
- return externalEntityInitProcessor3(parser, start, end, endPtr);
-}
-
-static enum XML_Error FASTCALL
-externalEntityInitProcessor3(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- const char *next = start; /* XmlContentTok doesn't always set the last arg */
- int tok = XmlContentTok(encoding, start, end, &next);
- switch (tok) {
- case XML_TOK_XML_DECL:
- {
- enum XML_Error result = processXmlDecl(parser, 1, start, next);
- if (result != XML_ERROR_NONE)
- return result;
- start = next;
- }
- break;
- case XML_TOK_PARTIAL:
- if (endPtr) {
- *endPtr = start;
- return XML_ERROR_NONE;
- }
- eventPtr = start;
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (endPtr) {
- *endPtr = start;
- return XML_ERROR_NONE;
- }
- eventPtr = start;
- return XML_ERROR_PARTIAL_CHAR;
- }
- processor = externalEntityContentProcessor;
- tagLevel = 1;
- return externalEntityContentProcessor(parser, start, end, endPtr);
-}
-
-static enum XML_Error FASTCALL
-externalEntityContentProcessor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- enum XML_Error result =
- doContent(parser, 1, encoding, start, end, endPtr);
- if (result != XML_ERROR_NONE)
- return result;
- if (!storeRawNames(parser))
- return XML_ERROR_NO_MEMORY;
- return result;
-}
-
-static enum XML_Error FASTCALL
-doContent(XML_Parser parser,
- int startTagLevel,
- const ENCODING *enc,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- const char **eventPP;
- const char **eventEndPP;
- if (enc == encoding) {
- eventPP = &eventPtr;
- eventEndPP = &eventEndPtr;
- }
- else {
- eventPP = &(openInternalEntities->internalEventPtr);
- eventEndPP = &(openInternalEntities->internalEventEndPtr);
- }
- *eventPP = s;
- for (;;) {
- const char *next = s; /* XmlContentTok doesn't always set the last arg */
- int tok = XmlContentTok(enc, s, end, &next);
- *eventEndPP = next;
- switch (tok) {
- case XML_TOK_TRAILING_CR:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- *eventEndPP = end;
- if (characterDataHandler) {
- XML_Char c = 0xA;
- characterDataHandler(handlerArg, &c, 1);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, end);
- if (startTagLevel == 0)
- return XML_ERROR_NO_ELEMENTS;
- if (tagLevel != startTagLevel)
- return XML_ERROR_ASYNC_ENTITY;
- return XML_ERROR_NONE;
- case XML_TOK_NONE:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- if (startTagLevel > 0) {
- if (tagLevel != startTagLevel)
- return XML_ERROR_ASYNC_ENTITY;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_NO_ELEMENTS;
- case XML_TOK_INVALID:
- *eventPP = next;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_PARTIAL_CHAR;
- case XML_TOK_ENTITY_REF:
- {
- const XML_Char *name;
- ENTITY *entity;
- XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (ch) {
- if (characterDataHandler)
- characterDataHandler(handlerArg, &ch, 1);
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- }
- name = poolStoreString(&dtd.pool, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0);
- poolDiscard(&dtd.pool);
- /* First, determine if a check for an existing declaration is needed;
- if yes, check that the entity exists, and that it is internal,
- otherwise call the skipped entity or default handler.
- */
- if (!dtd.hasParamEntityRefs || dtd.standalone) {
- if (!entity)
- return XML_ERROR_UNDEFINED_ENTITY;
- else if (!entity->is_internal)
- return XML_ERROR_ENTITY_DECLARED_IN_PE;
- }
- else if (!entity) {
- if (skippedEntityHandler)
- skippedEntityHandler(handlerArg, name, 0);
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- }
- if (entity->open)
- return XML_ERROR_RECURSIVE_ENTITY_REF;
- if (entity->notation)
- return XML_ERROR_BINARY_ENTITY_REF;
- if (entity->textPtr) {
- enum XML_Error result;
- OPEN_INTERNAL_ENTITY openEntity;
- if (!defaultExpandInternalEntities) {
- if (skippedEntityHandler)
- skippedEntityHandler(handlerArg, entity->name, 0);
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- }
- entity->open = XML_TRUE;
- openEntity.next = openInternalEntities;
- openInternalEntities = &openEntity;
- openEntity.entity = entity;
- openEntity.internalEventPtr = NULL;
- openEntity.internalEventEndPtr = NULL;
- result = doContent(parser,
- tagLevel,
- internalEncoding,
- (char *)entity->textPtr,
- (char *)(entity->textPtr + entity->textLen),
- 0);
- entity->open = XML_FALSE;
- openInternalEntities = openEntity.next;
- if (result)
- return result;
- }
- else if (externalEntityRefHandler) {
- const XML_Char *context;
- entity->open = XML_TRUE;
- context = getContext(parser);
- entity->open = XML_FALSE;
- if (!context)
- return XML_ERROR_NO_MEMORY;
- if (!externalEntityRefHandler(externalEntityRefHandlerArg,
- context,
- entity->base,
- entity->systemId,
- entity->publicId))
- return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
- poolDiscard(&tempPool);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- }
- case XML_TOK_START_TAG_WITH_ATTS:
- if (!startElementHandler) {
- enum XML_Error result = storeAtts(parser, enc, s, 0, 0);
- if (result)
- return result;
- }
- /* fall through */
- case XML_TOK_START_TAG_NO_ATTS:
- {
- TAG *tag;
- enum XML_Error result;
- XML_Char *toPtr;
- if (freeTagList) {
- tag = freeTagList;
- freeTagList = freeTagList->parent;
- }
- else {
- tag = MALLOC(sizeof(TAG));
- if (!tag)
- return XML_ERROR_NO_MEMORY;
- tag->buf = MALLOC(INIT_TAG_BUF_SIZE);
- if (!tag->buf) {
- FREE(tag);
- return XML_ERROR_NO_MEMORY;
- }
- tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE;
- }
- tag->bindings = NULL;
- tag->parent = tagStack;
- tagStack = tag;
- tag->name.localPart = NULL;
- tag->name.prefix = NULL;
- tag->rawName = s + enc->minBytesPerChar;
- tag->rawNameLength = XmlNameLength(enc, tag->rawName);
- ++tagLevel;
- {
- const char *rawNameEnd = tag->rawName + tag->rawNameLength;
- const char *fromPtr = tag->rawName;
- toPtr = (XML_Char *)tag->buf;
- for (;;) {
- int bufSize;
- int convLen;
- XmlConvert(enc,
- &fromPtr, rawNameEnd,
- (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1);
- convLen = toPtr - (XML_Char *)tag->buf;
- if (fromPtr == rawNameEnd) {
- tag->name.strLen = convLen;
- break;
- }
- bufSize = (tag->bufEnd - tag->buf) << 1;
- {
- char *temp = REALLOC(tag->buf, bufSize);
- if (temp == NULL)
- return XML_ERROR_NO_MEMORY;
- tag->buf = temp;
- tag->bufEnd = temp + bufSize;
- toPtr = (XML_Char *)temp + convLen;
- }
- }
- }
- tag->name.str = (XML_Char *)tag->buf;
- *toPtr = XML_T('\0');
- if (startElementHandler) {
- result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings));
- if (result)
- return result;
- startElementHandler(handlerArg, tag->name.str,
- (const XML_Char **)atts);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- poolClear(&tempPool);
- break;
- }
- case XML_TOK_EMPTY_ELEMENT_WITH_ATTS:
- if (!startElementHandler) {
- enum XML_Error result = storeAtts(parser, enc, s, 0, 0);
- if (result)
- return result;
- }
- /* fall through */
- case XML_TOK_EMPTY_ELEMENT_NO_ATTS:
- if (startElementHandler || endElementHandler) {
- const char *rawName = s + enc->minBytesPerChar;
- enum XML_Error result;
- BINDING *bindings = NULL;
- TAG_NAME name;
- name.str = poolStoreString(&tempPool, enc, rawName,
- rawName + XmlNameLength(enc, rawName));
- if (!name.str)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&tempPool);
- result = storeAtts(parser, enc, s, &name, &bindings);
- if (result)
- return result;
- poolFinish(&tempPool);
- if (startElementHandler)
- startElementHandler(handlerArg, name.str, (const XML_Char **)atts);
- if (endElementHandler) {
- if (startElementHandler)
- *eventPP = *eventEndPP;
- endElementHandler(handlerArg, name.str);
- }
- poolClear(&tempPool);
- while (bindings) {
- BINDING *b = bindings;
- if (endNamespaceDeclHandler)
- endNamespaceDeclHandler(handlerArg, b->prefix->name);
- bindings = bindings->nextTagBinding;
- b->nextTagBinding = freeBindingList;
- freeBindingList = b;
- b->prefix->binding = b->prevPrefixBinding;
- }
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- if (tagLevel == 0)
- return epilogProcessor(parser, next, end, nextPtr);
- break;
- case XML_TOK_END_TAG:
- if (tagLevel == startTagLevel)
- return XML_ERROR_ASYNC_ENTITY;
- else {
- int len;
- const char *rawName;
- TAG *tag = tagStack;
- tagStack = tag->parent;
- tag->parent = freeTagList;
- freeTagList = tag;
- rawName = s + enc->minBytesPerChar*2;
- len = XmlNameLength(enc, rawName);
- if (len != tag->rawNameLength
- || memcmp(tag->rawName, rawName, len) != 0) {
- *eventPP = rawName;
- return XML_ERROR_TAG_MISMATCH;
- }
- --tagLevel;
- if (endElementHandler) {
- const XML_Char *localPart;
- const XML_Char *prefix;
- XML_Char *uri;
- localPart = tag->name.localPart;
- if (ns && localPart) {
- /* localPart and prefix may have been overwritten in
- tag->name.str, since this points to the binding->uri
- buffer which gets re-used; so we have to add them again
- */
- uri = (XML_Char *)tag->name.str + tag->name.uriLen;
- /* don't need to check for space - already done in storeAtts() */
- while (*localPart) *uri++ = *localPart++;
- prefix = (XML_Char *)tag->name.prefix;
- if (ns_triplets && prefix) {
- *uri++ = namespaceSeparator;
- while (*prefix) *uri++ = *prefix++;
- }
- *uri = XML_T('\0');
- }
- endElementHandler(handlerArg, tag->name.str);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- while (tag->bindings) {
- BINDING *b = tag->bindings;
- if (endNamespaceDeclHandler)
- endNamespaceDeclHandler(handlerArg, b->prefix->name);
- tag->bindings = tag->bindings->nextTagBinding;
- b->nextTagBinding = freeBindingList;
- freeBindingList = b;
- b->prefix->binding = b->prevPrefixBinding;
- }
- if (tagLevel == 0)
- return epilogProcessor(parser, next, end, nextPtr);
- }
- break;
- case XML_TOK_CHAR_REF:
- {
- int n = XmlCharRefNumber(enc, s);
- if (n < 0)
- return XML_ERROR_BAD_CHAR_REF;
- if (characterDataHandler) {
- XML_Char buf[XML_ENCODE_MAX];
- characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf));
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- }
- break;
- case XML_TOK_XML_DECL:
- return XML_ERROR_MISPLACED_XML_PI;
- case XML_TOK_DATA_NEWLINE:
- if (characterDataHandler) {
- XML_Char c = 0xA;
- characterDataHandler(handlerArg, &c, 1);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- case XML_TOK_CDATA_SECT_OPEN:
- {
- enum XML_Error result;
- if (startCdataSectionHandler)
- startCdataSectionHandler(handlerArg);
-#if 0
- /* Suppose you doing a transformation on a document that involves
- changing only the character data. You set up a defaultHandler
- and a characterDataHandler. The defaultHandler simply copies
- characters through. The characterDataHandler does the
- transformation and writes the characters out escaping them as
- necessary. This case will fail to work if we leave out the
- following two lines (because & and < inside CDATA sections will
- be incorrectly escaped).
-
- However, now we have a start/endCdataSectionHandler, so it seems
- easier to let the user deal with this.
- */
- else if (characterDataHandler)
- characterDataHandler(handlerArg, dataBuf, 0);
-#endif
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- result = doCdataSection(parser, enc, &next, end, nextPtr);
- if (!next) {
- processor = cdataSectionProcessor;
- return result;
- }
- }
- break;
- case XML_TOK_TRAILING_RSQB:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- if (characterDataHandler) {
- if (MUST_CONVERT(enc, s)) {
- ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
- characterDataHandler(handlerArg, dataBuf,
- dataPtr - (ICHAR *)dataBuf);
- }
- else
- characterDataHandler(handlerArg,
- (XML_Char *)s,
- (XML_Char *)end - (XML_Char *)s);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, end);
- if (startTagLevel == 0) {
- *eventPP = end;
- return XML_ERROR_NO_ELEMENTS;
- }
- if (tagLevel != startTagLevel) {
- *eventPP = end;
- return XML_ERROR_ASYNC_ENTITY;
- }
- return XML_ERROR_NONE;
- case XML_TOK_DATA_CHARS:
- if (characterDataHandler) {
- if (MUST_CONVERT(enc, s)) {
- for (;;) {
- ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
- *eventEndPP = s;
- characterDataHandler(handlerArg, dataBuf,
- dataPtr - (ICHAR *)dataBuf);
- if (s == next)
- break;
- *eventPP = s;
- }
- }
- else
- characterDataHandler(handlerArg,
- (XML_Char *)s,
- (XML_Char *)next - (XML_Char *)s);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- case XML_TOK_PI:
- if (!reportProcessingInstruction(parser, enc, s, next))
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_TOK_COMMENT:
- if (!reportComment(parser, enc, s, next))
- return XML_ERROR_NO_MEMORY;
- break;
- default:
- if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- }
- *eventPP = s = next;
- }
- /* not reached */
-}
-
-/* If tagNamePtr is non-null, build a real list of attributes,
- otherwise just check the attributes for well-formedness.
-*/
-static enum XML_Error FASTCALL
-storeAtts(XML_Parser parser, const ENCODING *enc,
- const char *attStr, TAG_NAME *tagNamePtr,
- BINDING **bindingsPtr)
-{
- ELEMENT_TYPE *elementType = NULL;
- int nDefaultAtts = 0;
- const XML_Char **appAtts; /* the attribute list for the application */
- int attIndex = 0;
- int prefixLen;
- int i;
- int n;
- XML_Char *uri;
- int nPrefixes = 0;
- BINDING *binding;
- const XML_Char *localPart;
-
- /* lookup the element type name */
- if (tagNamePtr) {
- elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagNamePtr->str,0);
- if (!elementType) {
- tagNamePtr->str = poolCopyString(&dtd.pool, tagNamePtr->str);
- if (!tagNamePtr->str)
- return XML_ERROR_NO_MEMORY;
- elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagNamePtr->str,
- sizeof(ELEMENT_TYPE));
- if (!elementType)
- return XML_ERROR_NO_MEMORY;
- if (ns && !setElementTypePrefix(parser, elementType))
- return XML_ERROR_NO_MEMORY;
- }
- nDefaultAtts = elementType->nDefaultAtts;
- }
- /* get the attributes from the tokenizer */
- n = XmlGetAttributes(enc, attStr, attsSize, atts);
- if (n + nDefaultAtts > attsSize) {
- int oldAttsSize = attsSize;
- ATTRIBUTE *temp;
- attsSize = n + nDefaultAtts + INIT_ATTS_SIZE;
- temp = REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE));
- if (temp == NULL)
- return XML_ERROR_NO_MEMORY;
- atts = temp;
- if (n > oldAttsSize)
- XmlGetAttributes(enc, attStr, n, atts);
- }
- appAtts = (const XML_Char **)atts;
- for (i = 0; i < n; i++) {
- /* add the name and value to the attribute list */
- ATTRIBUTE_ID *attId = getAttributeId(parser, enc, atts[i].name,
- atts[i].name
- + XmlNameLength(enc, atts[i].name));
- if (!attId)
- return XML_ERROR_NO_MEMORY;
- /* detect duplicate attributes */
- if ((attId->name)[-1]) {
- if (enc == encoding)
- eventPtr = atts[i].name;
- return XML_ERROR_DUPLICATE_ATTRIBUTE;
- }
- (attId->name)[-1] = 1;
- appAtts[attIndex++] = attId->name;
- if (!atts[i].normalized) {
- enum XML_Error result;
- XML_Bool isCdata = XML_TRUE;
-
- /* figure out whether declared as other than CDATA */
- if (attId->maybeTokenized) {
- int j;
- for (j = 0; j < nDefaultAtts; j++) {
- if (attId == elementType->defaultAtts[j].id) {
- isCdata = elementType->defaultAtts[j].isCdata;
- break;
- }
- }
- }
-
- /* normalize the attribute value */
- result = storeAttributeValue(parser, enc, isCdata,
- atts[i].valuePtr, atts[i].valueEnd,
- &tempPool);
- if (result)
- return result;
- if (tagNamePtr) {
- appAtts[attIndex] = poolStart(&tempPool);
- poolFinish(&tempPool);
- }
- else
- poolDiscard(&tempPool);
- }
- else if (tagNamePtr) {
- /* the value did not need normalizing */
- appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr,
- atts[i].valueEnd);
- if (appAtts[attIndex] == 0)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&tempPool);
- }
- /* handle prefixed attribute names */
- if (attId->prefix && tagNamePtr) {
- if (attId->xmlns) {
- /* deal with namespace declarations here */
- if (!addBinding(parser, attId->prefix, attId, appAtts[attIndex],
- bindingsPtr))
- return XML_ERROR_NO_MEMORY;
- --attIndex;
- }
- else {
- /* deal with other prefixed names later */
- attIndex++;
- nPrefixes++;
- (attId->name)[-1] = 2;
- }
- }
- else
- attIndex++;
- }
- if (tagNamePtr) {
- int j;
- nSpecifiedAtts = attIndex;
- if (elementType->idAtt && (elementType->idAtt->name)[-1]) {
- for (i = 0; i < attIndex; i += 2)
- if (appAtts[i] == elementType->idAtt->name) {
- idAttIndex = i;
- break;
- }
- }
- else
- idAttIndex = -1;
- /* do attribute defaulting */
- for (j = 0; j < nDefaultAtts; j++) {
- const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + j;
- if (!(da->id->name)[-1] && da->value) {
- if (da->id->prefix) {
- if (da->id->xmlns) {
- if (!addBinding(parser, da->id->prefix, da->id, da->value,
- bindingsPtr))
- return XML_ERROR_NO_MEMORY;
- }
- else {
- (da->id->name)[-1] = 2;
- nPrefixes++;
- appAtts[attIndex++] = da->id->name;
- appAtts[attIndex++] = da->value;
- }
- }
- else {
- (da->id->name)[-1] = 1;
- appAtts[attIndex++] = da->id->name;
- appAtts[attIndex++] = da->value;
- }
- }
- }
- appAtts[attIndex] = 0;
- }
- i = 0;
- if (nPrefixes) {
- /* expand prefixed attribute names */
- for (; i < attIndex; i += 2) {
- if (appAtts[i][-1] == 2) {
- ATTRIBUTE_ID *id;
- ((XML_Char *)(appAtts[i]))[-1] = 0;
- id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, appAtts[i], 0);
- if (id->prefix->binding) {
- int j;
- const BINDING *b = id->prefix->binding;
- const XML_Char *s = appAtts[i];
- for (j = 0; j < b->uriLen; j++) {
- if (!poolAppendChar(&tempPool, b->uri[j]))
- return XML_ERROR_NO_MEMORY;
- }
- while (*s++ != XML_T(':'))
- ;
- do {
- if (!poolAppendChar(&tempPool, *s))
- return XML_ERROR_NO_MEMORY;
- } while (*s++);
- if (ns_triplets) {
- tempPool.ptr[-1] = namespaceSeparator;
- s = b->prefix->name;
- do {
- if (!poolAppendChar(&tempPool, *s))
- return XML_ERROR_NO_MEMORY;
- } while (*s++);
- }
-
- appAtts[i] = poolStart(&tempPool);
- poolFinish(&tempPool);
- }
- if (!--nPrefixes)
- break;
- }
- else
- ((XML_Char *)(appAtts[i]))[-1] = 0;
- }
- }
- /* clear the flags that say whether attributes were specified */
- for (; i < attIndex; i += 2)
- ((XML_Char *)(appAtts[i]))[-1] = 0;
- if (!tagNamePtr)
- return XML_ERROR_NONE;
- for (binding = *bindingsPtr; binding; binding = binding->nextTagBinding)
- binding->attId->name[-1] = 0;
- /* expand the element type name */
- if (elementType->prefix) {
- binding = elementType->prefix->binding;
- if (!binding)
- return XML_ERROR_NONE;
- localPart = tagNamePtr->str;
- while (*localPart++ != XML_T(':'))
- ;
- }
- else if (dtd.defaultPrefix.binding) {
- binding = dtd.defaultPrefix.binding;
- localPart = tagNamePtr->str;
- }
- else
- return XML_ERROR_NONE;
- prefixLen = 0;
- if (ns && ns_triplets && binding->prefix->name) {
- for (; binding->prefix->name[prefixLen++];)
- ;
- }
- tagNamePtr->localPart = localPart;
- tagNamePtr->uriLen = binding->uriLen;
- tagNamePtr->prefix = binding->prefix->name;
- tagNamePtr->prefixLen = prefixLen;
- for (i = 0; localPart[i++];)
- ;
- n = i + binding->uriLen + prefixLen;
- if (n > binding->uriAlloc) {
- TAG *p;
- uri = MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char));
- if (!uri)
- return XML_ERROR_NO_MEMORY;
- binding->uriAlloc = n + EXPAND_SPARE;
- memcpy(uri, binding->uri, binding->uriLen * sizeof(XML_Char));
- for (p = tagStack; p; p = p->parent)
- if (p->name.str == binding->uri)
- p->name.str = uri;
- FREE(binding->uri);
- binding->uri = uri;
- }
- uri = binding->uri + binding->uriLen;
- memcpy(uri, localPart, i * sizeof(XML_Char));
- if (prefixLen) {
- uri = uri + (i - 1);
- if (namespaceSeparator) { *(uri) = namespaceSeparator; }
- memcpy(uri + 1, binding->prefix->name, prefixLen * sizeof(XML_Char));
- }
- tagNamePtr->str = binding->uri;
- return XML_ERROR_NONE;
-}
-
-static int FASTCALL
-addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,
- const XML_Char *uri, BINDING **bindingsPtr)
-{
- BINDING *b;
- int len;
- for (len = 0; uri[len]; len++)
- ;
- if (namespaceSeparator)
- len++;
- if (freeBindingList) {
- b = freeBindingList;
- if (len > b->uriAlloc) {
- XML_Char *temp = REALLOC(b->uri,
- sizeof(XML_Char) * (len + EXPAND_SPARE));
- if (temp == NULL)
- return 0;
- b->uri = temp;
- b->uriAlloc = len + EXPAND_SPARE;
- }
- freeBindingList = b->nextTagBinding;
- }
- else {
- b = MALLOC(sizeof(BINDING));
- if (!b)
- return 0;
- b->uri = MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE));
- if (!b->uri) {
- FREE(b);
- return 0;
- }
- b->uriAlloc = len + EXPAND_SPARE;
- }
- b->uriLen = len;
- memcpy(b->uri, uri, len * sizeof(XML_Char));
- if (namespaceSeparator)
- b->uri[len - 1] = namespaceSeparator;
- b->prefix = prefix;
- b->attId = attId;
- b->prevPrefixBinding = prefix->binding;
- if (*uri == XML_T('\0') && prefix == &dtd.defaultPrefix)
- prefix->binding = NULL;
- else
- prefix->binding = b;
- b->nextTagBinding = *bindingsPtr;
- *bindingsPtr = b;
- if (startNamespaceDeclHandler)
- startNamespaceDeclHandler(handlerArg, prefix->name,
- prefix->binding ? uri : 0);
- return 1;
-}
-
-/* The idea here is to avoid using stack for each CDATA section when
- the whole file is parsed with one call.
-*/
-static enum XML_Error FASTCALL
-cdataSectionProcessor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- enum XML_Error result = doCdataSection(parser, encoding, &start,
- end, endPtr);
- if (start) {
- if (parentParser) { /* we are parsing an external entity */
- processor = externalEntityContentProcessor;
- return externalEntityContentProcessor(parser, start, end, endPtr);
- }
- else {
- processor = contentProcessor;
- return contentProcessor(parser, start, end, endPtr);
- }
- }
- return result;
-}
-
-/* startPtr gets set to non-null is the section is closed, and to null if
- the section is not yet closed.
-*/
-static enum XML_Error FASTCALL
-doCdataSection(XML_Parser parser,
- const ENCODING *enc,
- const char **startPtr,
- const char *end,
- const char **nextPtr)
-{
- const char *s = *startPtr;
- const char **eventPP;
- const char **eventEndPP;
- if (enc == encoding) {
- eventPP = &eventPtr;
- *eventPP = s;
- eventEndPP = &eventEndPtr;
- }
- else {
- eventPP = &(openInternalEntities->internalEventPtr);
- eventEndPP = &(openInternalEntities->internalEventEndPtr);
- }
- *eventPP = s;
- *startPtr = NULL;
- for (;;) {
- const char *next;
- int tok = XmlCdataSectionTok(enc, s, end, &next);
- *eventEndPP = next;
- switch (tok) {
- case XML_TOK_CDATA_SECT_CLOSE:
- if (endCdataSectionHandler)
- endCdataSectionHandler(handlerArg);
-#if 0
- /* see comment under XML_TOK_CDATA_SECT_OPEN */
- else if (characterDataHandler)
- characterDataHandler(handlerArg, dataBuf, 0);
-#endif
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- *startPtr = next;
- return XML_ERROR_NONE;
- case XML_TOK_DATA_NEWLINE:
- if (characterDataHandler) {
- XML_Char c = 0xA;
- characterDataHandler(handlerArg, &c, 1);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- case XML_TOK_DATA_CHARS:
- if (characterDataHandler) {
- if (MUST_CONVERT(enc, s)) {
- for (;;) {
- ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
- *eventEndPP = next;
- characterDataHandler(handlerArg, dataBuf,
- dataPtr - (ICHAR *)dataBuf);
- if (s == next)
- break;
- *eventPP = s;
- }
- }
- else
- characterDataHandler(handlerArg,
- (XML_Char *)s,
- (XML_Char *)next - (XML_Char *)s);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- case XML_TOK_INVALID:
- *eventPP = next;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_PARTIAL_CHAR;
- case XML_TOK_PARTIAL:
- case XML_TOK_NONE:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_UNCLOSED_CDATA_SECTION;
- default:
- *eventPP = next;
- return XML_ERROR_UNEXPECTED_STATE;
- }
- *eventPP = s = next;
- }
- /* not reached */
-}
-
-#ifdef XML_DTD
-
-/* The idea here is to avoid using stack for each IGNORE section when
- the whole file is parsed with one call.
-*/
-static enum XML_Error FASTCALL
-ignoreSectionProcessor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- enum XML_Error result = doIgnoreSection(parser, encoding, &start,
- end, endPtr);
- if (start) {
- processor = prologProcessor;
- return prologProcessor(parser, start, end, endPtr);
- }
- return result;
-}
-
-/* startPtr gets set to non-null is the section is closed, and to null
- if the section is not yet closed.
-*/
-static enum XML_Error FASTCALL
-doIgnoreSection(XML_Parser parser,
- const ENCODING *enc,
- const char **startPtr,
- const char *end,
- const char **nextPtr)
-{
- const char *next;
- int tok;
- const char *s = *startPtr;
- const char **eventPP;
- const char **eventEndPP;
- if (enc == encoding) {
- eventPP = &eventPtr;
- *eventPP = s;
- eventEndPP = &eventEndPtr;
- }
- else {
- eventPP = &(openInternalEntities->internalEventPtr);
- eventEndPP = &(openInternalEntities->internalEventEndPtr);
- }
- *eventPP = s;
- *startPtr = NULL;
- tok = XmlIgnoreSectionTok(enc, s, end, &next);
- *eventEndPP = next;
- switch (tok) {
- case XML_TOK_IGNORE_SECT:
- if (defaultHandler)
- reportDefault(parser, enc, s, next);
- *startPtr = next;
- return XML_ERROR_NONE;
- case XML_TOK_INVALID:
- *eventPP = next;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_PARTIAL_CHAR;
- case XML_TOK_PARTIAL:
- case XML_TOK_NONE:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */
- default:
- *eventPP = next;
- return XML_ERROR_UNEXPECTED_STATE;
- }
- /* not reached */
-}
-
-#endif /* XML_DTD */
-
-static enum XML_Error FASTCALL
-initializeEncoding(XML_Parser parser)
-{
- const char *s;
-#ifdef XML_UNICODE
- char encodingBuf[128];
- if (!protocolEncodingName)
- s = NULL;
- else {
- int i;
- for (i = 0; protocolEncodingName[i]; i++) {
- if (i == sizeof(encodingBuf) - 1
- || (protocolEncodingName[i] & ~0x7f) != 0) {
- encodingBuf[0] = '\0';
- break;
- }
- encodingBuf[i] = (char)protocolEncodingName[i];
- }
- encodingBuf[i] = '\0';
- s = encodingBuf;
- }
-#else
- s = protocolEncodingName;
-#endif
- if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s))
- return XML_ERROR_NONE;
- return handleUnknownEncoding(parser, protocolEncodingName);
-}
-
-static enum XML_Error FASTCALL
-processXmlDecl(XML_Parser parser, int isGeneralTextEntity,
- const char *s, const char *next)
-{
- const char *encodingName = NULL;
- const XML_Char *storedEncName = NULL;
- const ENCODING *newEncoding = NULL;
- const char *version = NULL;
- const char *versionend;
- const XML_Char *storedversion = NULL;
- int standalone = -1;
- if (!(ns
- ? XmlParseXmlDeclNS
- : XmlParseXmlDecl)(isGeneralTextEntity,
- encoding,
- s,
- next,
- &eventPtr,
- &version,
- &versionend,
- &encodingName,
- &newEncoding,
- &standalone))
- return XML_ERROR_SYNTAX;
- if (!isGeneralTextEntity && standalone == 1) {
- dtd.standalone = XML_TRUE;
-#ifdef XML_DTD
- if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE)
- paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
-#endif /* XML_DTD */
- }
- if (xmlDeclHandler) {
- if (encodingName != NULL) {
- storedEncName = poolStoreString(&temp2Pool,
- encoding,
- encodingName,
- encodingName
- + XmlNameLength(encoding, encodingName));
- if (!storedEncName)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&temp2Pool);
- }
- if (version) {
- storedversion = poolStoreString(&temp2Pool,
- encoding,
- version,
- versionend - encoding->minBytesPerChar);
- if (!storedversion)
- return XML_ERROR_NO_MEMORY;
- }
- xmlDeclHandler(handlerArg, storedversion, storedEncName, standalone);
- }
- else if (defaultHandler)
- reportDefault(parser, encoding, s, next);
- if (protocolEncodingName == NULL) {
- if (newEncoding) {
- if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) {
- eventPtr = encodingName;
- return XML_ERROR_INCORRECT_ENCODING;
- }
- encoding = newEncoding;
- }
- else if (encodingName) {
- enum XML_Error result;
- if (!storedEncName) {
- storedEncName = poolStoreString(
- &temp2Pool, encoding, encodingName,
- encodingName + XmlNameLength(encoding, encodingName));
- if (!storedEncName)
- return XML_ERROR_NO_MEMORY;
- }
- result = handleUnknownEncoding(parser, storedEncName);
- poolClear(&temp2Pool);
- if (result == XML_ERROR_UNKNOWN_ENCODING)
- eventPtr = encodingName;
- return result;
- }
- }
-
- if (storedEncName || storedversion)
- poolClear(&temp2Pool);
-
- return XML_ERROR_NONE;
-}
-
-static enum XML_Error FASTCALL
-handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName)
-{
- if (unknownEncodingHandler) {
- XML_Encoding info;
- int i;
- for (i = 0; i < 256; i++)
- info.map[i] = -1;
- info.convert = NULL;
- info.data = NULL;
- info.release = NULL;
- if (unknownEncodingHandler(unknownEncodingHandlerData, encodingName,
- &info)) {
- ENCODING *enc;
- unknownEncodingMem = MALLOC(XmlSizeOfUnknownEncoding());
- if (!unknownEncodingMem) {
- if (info.release)
- info.release(info.data);
- return XML_ERROR_NO_MEMORY;
- }
- enc = (ns
- ? XmlInitUnknownEncodingNS
- : XmlInitUnknownEncoding)(unknownEncodingMem,
- info.map,
- info.convert,
- info.data);
- if (enc) {
- unknownEncodingData = info.data;
- unknownEncodingRelease = info.release;
- encoding = enc;
- return XML_ERROR_NONE;
- }
- }
- if (info.release != NULL)
- info.release(info.data);
- }
- return XML_ERROR_UNKNOWN_ENCODING;
-}
-
-static enum XML_Error FASTCALL
-prologInitProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- enum XML_Error result = initializeEncoding(parser);
- if (result != XML_ERROR_NONE)
- return result;
- processor = prologProcessor;
- return prologProcessor(parser, s, end, nextPtr);
-}
-
-#ifdef XML_DTD
-
-static enum XML_Error FASTCALL
-externalParEntInitProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- enum XML_Error result = initializeEncoding(parser);
- if (result != XML_ERROR_NONE)
- return result;
-
- /* we know now that XML_Parse(Buffer) has been called,
- so we consider the external parameter entity read */
- dtd.paramEntityRead = XML_TRUE;
-
- if (prologState.inEntityValue) {
- processor = entityValueInitProcessor;
- return entityValueInitProcessor(parser, s, end, nextPtr);
- }
- else {
- processor = externalParEntProcessor;
- return externalParEntProcessor(parser, s, end, nextPtr);
- }
-}
-
-static enum XML_Error FASTCALL
-entityValueInitProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- const char *start = s;
- const char *next = s;
- int tok;
-
- for (;;) {
- tok = XmlPrologTok(encoding, start, end, &next);
- if (tok <= 0) {
- if (nextPtr != 0 && tok != XML_TOK_INVALID) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- switch (tok) {
- case XML_TOK_INVALID:
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL:
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- return XML_ERROR_PARTIAL_CHAR;
- case XML_TOK_NONE: /* start == end */
- default:
- break;
- }
- return storeEntityValue(parser, encoding, s, end);
- }
- else if (tok == XML_TOK_XML_DECL) {
- enum XML_Error result = processXmlDecl(parser, 0, start, next);
- if (result != XML_ERROR_NONE)
- return result;
- if (nextPtr) *nextPtr = next;
- /* stop scanning for text declaration - we found one */
- processor = entityValueProcessor;
- return entityValueProcessor(parser, next, end, nextPtr);
- }
- /* If we are at the end of the buffer, this would cause XmlPrologTok to
- return XML_TOK_NONE on the next call, which would then cause the
- function to exit with *nextPtr set to s - that is what we want for other
- tokens, but not for the BOM - we would rather like to skip it;
- then, when this routine is entered the next time, XmlPrologTok will
- return XML_TOK_INVALID, since the BOM is still in the buffer
- */
- else if (tok == XML_TOK_BOM && next == end && nextPtr) {
- *nextPtr = next;
- return XML_ERROR_NONE;
- }
- start = next;
- }
-}
-
-static enum XML_Error FASTCALL
-externalParEntProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- const char *start = s;
- const char *next = s;
- int tok;
-
- tok = XmlPrologTok(encoding, start, end, &next);
- if (tok <= 0) {
- if (nextPtr != 0 && tok != XML_TOK_INVALID) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- switch (tok) {
- case XML_TOK_INVALID:
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL:
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- return XML_ERROR_PARTIAL_CHAR;
- case XML_TOK_NONE: /* start == end */
- default:
- break;
- }
- }
- /* This would cause the next stage, i.e. doProlog to be passed XML_TOK_BOM.
- However, when parsing an external subset, doProlog will not accept a BOM
- as valid, and report a syntax error, so we have to skip the BOM
- */
- else if (tok == XML_TOK_BOM) {
- s = next;
- tok = XmlPrologTok(encoding, s, end, &next);
- }
-
- processor = prologProcessor;
- return doProlog(parser, encoding, s, end, tok, next, nextPtr);
-}
-
-static enum XML_Error FASTCALL
-entityValueProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- const char *start = s;
- const char *next = s;
- const ENCODING *enc = encoding;
- int tok;
-
- for (;;) {
- tok = XmlPrologTok(enc, start, end, &next);
- if (tok <= 0) {
- if (nextPtr != 0 && tok != XML_TOK_INVALID) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- switch (tok) {
- case XML_TOK_INVALID:
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL:
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- return XML_ERROR_PARTIAL_CHAR;
- case XML_TOK_NONE: /* start == end */
- default:
- break;
- }
- return storeEntityValue(parser, enc, s, end);
- }
- start = next;
- }
-}
-
-#endif /* XML_DTD */
-
-static enum XML_Error FASTCALL
-prologProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- const char *next = s;
- int tok = XmlPrologTok(encoding, s, end, &next);
- return doProlog(parser, encoding, s, end, tok, next, nextPtr);
-}
-
-static enum XML_Error FASTCALL
-doProlog(XML_Parser parser,
- const ENCODING *enc,
- const char *s,
- const char *end,
- int tok,
- const char *next,
- const char **nextPtr)
-{
-#ifdef XML_DTD
- static const XML_Char externalSubsetName[] = { '#' , '\0' };
-#endif /* XML_DTD */
- static const XML_Char atypeCDATA[] = { 'C', 'D', 'A', 'T', 'A', '\0' };
- static const XML_Char atypeID[] = { 'I', 'D', '\0' };
- static const XML_Char atypeIDREF[] = { 'I', 'D', 'R', 'E', 'F', '\0' };
- static const XML_Char atypeIDREFS[] = { 'I', 'D', 'R', 'E', 'F', 'S', '\0' };
- static const XML_Char atypeENTITY[] = { 'E', 'N', 'T', 'I', 'T', 'Y', '\0' };
- static const XML_Char atypeENTITIES[] =
- { 'E', 'N', 'T', 'I', 'T', 'I', 'E', 'S', '\0' };
- static const XML_Char atypeNMTOKEN[] = {
- 'N', 'M', 'T', 'O', 'K', 'E', 'N', '\0' };
- static const XML_Char atypeNMTOKENS[] = {
- 'N', 'M', 'T', 'O', 'K', 'E', 'N', 'S', '\0' };
- static const XML_Char notationPrefix[] = {
- 'N', 'O', 'T', 'A', 'T', 'I', 'O', 'N', '(', '\0' };
- static const XML_Char enumValueSep[] = { '|', '\0' };
- static const XML_Char enumValueStart[] = { '(', '\0' };
-
- const char **eventPP;
- const char **eventEndPP;
- enum XML_Content_Quant quant;
-
- if (enc == encoding) {
- eventPP = &eventPtr;
- eventEndPP = &eventEndPtr;
- }
- else {
- eventPP = &(openInternalEntities->internalEventPtr);
- eventEndPP = &(openInternalEntities->internalEventEndPtr);
- }
- for (;;) {
- int role;
- XML_Bool handleDefault = XML_TRUE;
- *eventPP = s;
- *eventEndPP = next;
- if (tok <= 0) {
- if (nextPtr != 0 && tok != XML_TOK_INVALID) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- switch (tok) {
- case XML_TOK_INVALID:
- *eventPP = next;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL:
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- return XML_ERROR_PARTIAL_CHAR;
- case XML_TOK_NONE:
-#ifdef XML_DTD
- if (enc != encoding)
- return XML_ERROR_NONE;
- if (isParamEntity) {
- if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc)
- == XML_ROLE_ERROR)
- return XML_ERROR_SYNTAX;
- return XML_ERROR_NONE;
- }
-#endif /* XML_DTD */
- return XML_ERROR_NO_ELEMENTS;
- default:
- tok = -tok;
- next = end;
- break;
- }
- }
- role = XmlTokenRole(&prologState, tok, s, next, enc);
- switch (role) {
- case XML_ROLE_XML_DECL:
- {
- enum XML_Error result = processXmlDecl(parser, 0, s, next);
- if (result != XML_ERROR_NONE)
- return result;
- enc = encoding;
- handleDefault = XML_FALSE;
- }
- break;
- case XML_ROLE_DOCTYPE_NAME:
- if (startDoctypeDeclHandler) {
- doctypeName = poolStoreString(&tempPool, enc, s, next);
- if (!doctypeName)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&tempPool);
- doctypePubid = NULL;
- handleDefault = XML_FALSE;
- }
- doctypeSysid = NULL; /* always initialize to NULL */
- break;
- case XML_ROLE_DOCTYPE_INTERNAL_SUBSET:
- if (startDoctypeDeclHandler) {
- startDoctypeDeclHandler(handlerArg, doctypeName, doctypeSysid,
- doctypePubid, 1);
- doctypeName = NULL;
- poolClear(&tempPool);
- handleDefault = XML_FALSE;
- }
- break;
-#ifdef XML_DTD
- case XML_ROLE_TEXT_DECL:
- {
- enum XML_Error result = processXmlDecl(parser, 1, s, next);
- if (result != XML_ERROR_NONE)
- return result;
- enc = encoding;
- handleDefault = XML_FALSE;
- }
- break;
-#endif /* XML_DTD */
- case XML_ROLE_DOCTYPE_PUBLIC_ID:
-#ifdef XML_DTD
- useForeignDTD = XML_FALSE;
-#endif /* XML_DTD */
- dtd.hasParamEntityRefs = XML_TRUE;
- if (startDoctypeDeclHandler) {
- doctypePubid = poolStoreString(&tempPool, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!doctypePubid)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&tempPool);
- handleDefault = XML_FALSE;
- }
-#ifdef XML_DTD
- declEntity = (ENTITY *)lookup(&dtd.paramEntities,
- externalSubsetName,
- sizeof(ENTITY));
- if (!declEntity)
- return XML_ERROR_NO_MEMORY;
-#endif /* XML_DTD */
- /* fall through */
- case XML_ROLE_ENTITY_PUBLIC_ID:
- if (!XmlIsPublicId(enc, s, next, eventPP))
- return XML_ERROR_SYNTAX;
- if (dtd.keepProcessing && declEntity) {
- XML_Char *tem = poolStoreString(&dtd.pool,
- enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!tem)
- return XML_ERROR_NO_MEMORY;
- normalizePublicId(tem);
- declEntity->publicId = tem;
- poolFinish(&dtd.pool);
- if (entityDeclHandler)
- handleDefault = XML_FALSE;
- }
- break;
- case XML_ROLE_DOCTYPE_CLOSE:
- if (doctypeName) {
- startDoctypeDeclHandler(handlerArg, doctypeName,
- doctypeSysid, doctypePubid, 0);
- poolClear(&tempPool);
- handleDefault = XML_FALSE;
- }
- /* doctypeSysid will be non-NULL in the case of a previous
- XML_ROLE_DOCTYPE_SYSTEM_ID, even if startDoctypeDeclHandler
- was not set, indicating an external subset
- */
-#ifdef XML_DTD
- if (doctypeSysid || useForeignDTD) {
- dtd.hasParamEntityRefs = XML_TRUE; /* when docTypeSysid == NULL */
- if (paramEntityParsing && externalEntityRefHandler) {
- ENTITY *entity = (ENTITY *)lookup(&dtd.paramEntities,
- externalSubsetName,
- sizeof(ENTITY));
- if (!entity)
- return XML_ERROR_NO_MEMORY;
- if (useForeignDTD)
- entity->base = curBase;
- dtd.paramEntityRead = XML_FALSE;
- if (!externalEntityRefHandler(externalEntityRefHandlerArg,
- 0,
- entity->base,
- entity->systemId,
- entity->publicId))
- return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
- if (dtd.paramEntityRead &&
- !dtd.standalone &&
- notStandaloneHandler &&
- !notStandaloneHandler(handlerArg))
- return XML_ERROR_NOT_STANDALONE;
- /* end of DTD - no need to update dtd.keepProcessing */
- }
- useForeignDTD = XML_FALSE;
- }
-#endif /* XML_DTD */
- if (endDoctypeDeclHandler) {
- endDoctypeDeclHandler(handlerArg);
- handleDefault = XML_FALSE;
- }
- break;
- case XML_ROLE_INSTANCE_START:
-#ifdef XML_DTD
- /* if there is no DOCTYPE declaration then now is the
- last chance to read the foreign DTD
- */
- if (useForeignDTD) {
- dtd.hasParamEntityRefs = XML_TRUE;
- if (paramEntityParsing && externalEntityRefHandler) {
- ENTITY *entity = (ENTITY *)lookup(&dtd.paramEntities,
- externalSubsetName,
- sizeof(ENTITY));
- if (!entity)
- return XML_ERROR_NO_MEMORY;
- entity->base = curBase;
- dtd.paramEntityRead = XML_FALSE;
- if (!externalEntityRefHandler(externalEntityRefHandlerArg,
- 0,
- entity->base,
- entity->systemId,
- entity->publicId))
- return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
- if (dtd.paramEntityRead &&
- !dtd.standalone &&
- notStandaloneHandler &&
- !notStandaloneHandler(handlerArg))
- return XML_ERROR_NOT_STANDALONE;
- /* end of DTD - no need to update dtd.keepProcessing */
- }
- }
-#endif /* XML_DTD */
- processor = contentProcessor;
- return contentProcessor(parser, s, end, nextPtr);
- case XML_ROLE_ATTLIST_ELEMENT_NAME:
- declElementType = getElementType(parser, enc, s, next);
- if (!declElementType)
- return XML_ERROR_NO_MEMORY;
- goto checkAttListDeclHandler;
- case XML_ROLE_ATTRIBUTE_NAME:
- declAttributeId = getAttributeId(parser, enc, s, next);
- if (!declAttributeId)
- return XML_ERROR_NO_MEMORY;
- declAttributeIsCdata = XML_FALSE;
- declAttributeType = NULL;
- declAttributeIsId = XML_FALSE;
- goto checkAttListDeclHandler;
- case XML_ROLE_ATTRIBUTE_TYPE_CDATA:
- declAttributeIsCdata = XML_TRUE;
- declAttributeType = atypeCDATA;
- goto checkAttListDeclHandler;
- case XML_ROLE_ATTRIBUTE_TYPE_ID:
- declAttributeIsId = XML_TRUE;
- declAttributeType = atypeID;
- goto checkAttListDeclHandler;
- case XML_ROLE_ATTRIBUTE_TYPE_IDREF:
- declAttributeType = atypeIDREF;
- goto checkAttListDeclHandler;
- case XML_ROLE_ATTRIBUTE_TYPE_IDREFS:
- declAttributeType = atypeIDREFS;
- goto checkAttListDeclHandler;
- case XML_ROLE_ATTRIBUTE_TYPE_ENTITY:
- declAttributeType = atypeENTITY;
- goto checkAttListDeclHandler;
- case XML_ROLE_ATTRIBUTE_TYPE_ENTITIES:
- declAttributeType = atypeENTITIES;
- goto checkAttListDeclHandler;
- case XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN:
- declAttributeType = atypeNMTOKEN;
- goto checkAttListDeclHandler;
- case XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS:
- declAttributeType = atypeNMTOKENS;
- checkAttListDeclHandler:
- if (dtd.keepProcessing && attlistDeclHandler)
- handleDefault = XML_FALSE;
- break;
- case XML_ROLE_ATTRIBUTE_ENUM_VALUE:
- case XML_ROLE_ATTRIBUTE_NOTATION_VALUE:
- if (dtd.keepProcessing && attlistDeclHandler) {
- const XML_Char *prefix;
- if (declAttributeType) {
- prefix = enumValueSep;
- }
- else {
- prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE
- ? notationPrefix
- : enumValueStart);
- }
- if (!poolAppendString(&tempPool, prefix))
- return XML_ERROR_NO_MEMORY;
- if (!poolAppend(&tempPool, enc, s, next))
- return XML_ERROR_NO_MEMORY;
- declAttributeType = tempPool.start;
- handleDefault = XML_FALSE;
- }
- break;
- case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE:
- case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE:
- if (dtd.keepProcessing) {
- if (!defineAttribute(declElementType, declAttributeId,
- declAttributeIsCdata, declAttributeIsId, 0,
- parser))
- return XML_ERROR_NO_MEMORY;
- if (attlistDeclHandler && declAttributeType) {
- if (*declAttributeType == XML_T('(')
- || (*declAttributeType == XML_T('N')
- && declAttributeType[1] == XML_T('O'))) {
- /* Enumerated or Notation type */
- if (!poolAppendChar(&tempPool, XML_T(')'))
- || !poolAppendChar(&tempPool, XML_T('\0')))
- return XML_ERROR_NO_MEMORY;
- declAttributeType = tempPool.start;
- poolFinish(&tempPool);
- }
- *eventEndPP = s;
- attlistDeclHandler(handlerArg, declElementType->name,
- declAttributeId->name, declAttributeType,
- 0, role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE);
- poolClear(&tempPool);
- handleDefault = XML_FALSE;
- }
- }
- break;
- case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE:
- case XML_ROLE_FIXED_ATTRIBUTE_VALUE:
- if (dtd.keepProcessing) {
- const XML_Char *attVal;
- enum XML_Error result
- = storeAttributeValue(parser, enc, declAttributeIsCdata,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar,
- &dtd.pool);
- if (result)
- return result;
- attVal = poolStart(&dtd.pool);
- poolFinish(&dtd.pool);
- /* ID attributes aren't allowed to have a default */
- if (!defineAttribute(declElementType, declAttributeId,
- declAttributeIsCdata, XML_FALSE, attVal, parser))
- return XML_ERROR_NO_MEMORY;
- if (attlistDeclHandler && declAttributeType) {
- if (*declAttributeType == XML_T('(')
- || (*declAttributeType == XML_T('N')
- && declAttributeType[1] == XML_T('O'))) {
- /* Enumerated or Notation type */
- if (!poolAppendChar(&tempPool, XML_T(')'))
- || !poolAppendChar(&tempPool, XML_T('\0')))
- return XML_ERROR_NO_MEMORY;
- declAttributeType = tempPool.start;
- poolFinish(&tempPool);
- }
- *eventEndPP = s;
- attlistDeclHandler(handlerArg, declElementType->name,
- declAttributeId->name, declAttributeType,
- attVal,
- role == XML_ROLE_FIXED_ATTRIBUTE_VALUE);
- poolClear(&tempPool);
- handleDefault = XML_FALSE;
- }
- }
- break;
- case XML_ROLE_ENTITY_VALUE:
- if (dtd.keepProcessing) {
- enum XML_Error result = storeEntityValue(parser, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (declEntity) {
- declEntity->textPtr = poolStart(&dtd.entityValuePool);
- declEntity->textLen = poolLength(&dtd.entityValuePool);
- poolFinish(&dtd.entityValuePool);
- if (entityDeclHandler) {
- *eventEndPP = s;
- entityDeclHandler(handlerArg,
- declEntity->name,
- declEntity->is_param,
- declEntity->textPtr,
- declEntity->textLen,
- curBase, 0, 0, 0);
- handleDefault = XML_FALSE;
- }
- }
- else
- poolDiscard(&dtd.entityValuePool);
- if (result != XML_ERROR_NONE)
- return result;
- }
- break;
- case XML_ROLE_DOCTYPE_SYSTEM_ID:
-#ifdef XML_DTD
- useForeignDTD = XML_FALSE;
-#endif /* XML_DTD */
- dtd.hasParamEntityRefs = XML_TRUE;
- if (startDoctypeDeclHandler) {
- doctypeSysid = poolStoreString(&tempPool, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (doctypeSysid == NULL)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&tempPool);
- handleDefault = XML_FALSE;
- }
-#ifdef XML_DTD
- else
- /* use externalSubsetName to make doctypeSysid non-NULL
- for the case where no startDoctypeDeclHandler is set */
- doctypeSysid = externalSubsetName;
-#endif /* XML_DTD */
- if (!dtd.standalone
-#ifdef XML_DTD
- && !paramEntityParsing
-#endif /* XML_DTD */
- && notStandaloneHandler
- && !notStandaloneHandler(handlerArg))
- return XML_ERROR_NOT_STANDALONE;
-#ifndef XML_DTD
- break;
-#else /* XML_DTD */
- if (!declEntity) {
- declEntity = (ENTITY *)lookup(&dtd.paramEntities,
- externalSubsetName,
- sizeof(ENTITY));
- if (!declEntity)
- return XML_ERROR_NO_MEMORY;
- declEntity->publicId = NULL;
- }
- /* fall through */
-#endif /* XML_DTD */
- case XML_ROLE_ENTITY_SYSTEM_ID:
- if (dtd.keepProcessing && declEntity) {
- declEntity->systemId = poolStoreString(&dtd.pool, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!declEntity->systemId)
- return XML_ERROR_NO_MEMORY;
- declEntity->base = curBase;
- poolFinish(&dtd.pool);
- if (entityDeclHandler)
- handleDefault = XML_FALSE;
- }
- break;
- case XML_ROLE_ENTITY_COMPLETE:
- if (dtd.keepProcessing && declEntity && entityDeclHandler) {
- *eventEndPP = s;
- entityDeclHandler(handlerArg,
- declEntity->name,
- declEntity->is_param,
- 0,0,
- declEntity->base,
- declEntity->systemId,
- declEntity->publicId,
- 0);
- handleDefault = XML_FALSE;
- }
- break;
- case XML_ROLE_ENTITY_NOTATION_NAME:
- if (dtd.keepProcessing && declEntity) {
- declEntity->notation = poolStoreString(&dtd.pool, enc, s, next);
- if (!declEntity->notation)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&dtd.pool);
- if (unparsedEntityDeclHandler) {
- *eventEndPP = s;
- unparsedEntityDeclHandler(handlerArg,
- declEntity->name,
- declEntity->base,
- declEntity->systemId,
- declEntity->publicId,
- declEntity->notation);
- handleDefault = XML_FALSE;
- }
- else if (entityDeclHandler) {
- *eventEndPP = s;
- entityDeclHandler(handlerArg,
- declEntity->name,
- 0,0,0,
- declEntity->base,
- declEntity->systemId,
- declEntity->publicId,
- declEntity->notation);
- handleDefault = XML_FALSE;
- }
- }
- break;
- case XML_ROLE_GENERAL_ENTITY_NAME:
- {
- if (XmlPredefinedEntityName(enc, s, next)) {
- declEntity = NULL;
- break;
- }
- if (dtd.keepProcessing) {
- const XML_Char *name = poolStoreString(&dtd.pool, enc, s, next);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- declEntity = (ENTITY *)lookup(&dtd.generalEntities, name,
- sizeof(ENTITY));
- if (!declEntity)
- return XML_ERROR_NO_MEMORY;
- if (declEntity->name != name) {
- poolDiscard(&dtd.pool);
- declEntity = NULL;
- }
- else {
- poolFinish(&dtd.pool);
- declEntity->publicId = NULL;
- declEntity->is_param = XML_FALSE;
- /* if we have a parent parser or are reading an internal parameter
- entity, then the entity declaration is not considered "internal"
- */
- declEntity->is_internal = !(parentParser || openInternalEntities);
- if (entityDeclHandler)
- handleDefault = XML_FALSE;
- }
- }
- else {
- poolDiscard(&dtd.pool);
- declEntity = NULL;
- }
- }
- break;
- case XML_ROLE_PARAM_ENTITY_NAME:
-#ifdef XML_DTD
- if (dtd.keepProcessing) {
- const XML_Char *name = poolStoreString(&dtd.pool, enc, s, next);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- declEntity = (ENTITY *)lookup(&dtd.paramEntities,
- name, sizeof(ENTITY));
- if (!declEntity)
- return XML_ERROR_NO_MEMORY;
- if (declEntity->name != name) {
- poolDiscard(&dtd.pool);
- declEntity = NULL;
- }
- else {
- poolFinish(&dtd.pool);
- declEntity->publicId = NULL;
- declEntity->is_param = XML_TRUE;
- /* if we have a parent parser or are reading an internal parameter
- entity, then the entity declaration is not considered "internal"
- */
- declEntity->is_internal = !(parentParser || openInternalEntities);
- if (entityDeclHandler)
- handleDefault = XML_FALSE;
- }
- }
- else {
- poolDiscard(&dtd.pool);
- declEntity = NULL;
- }
-#else /* not XML_DTD */
- declEntity = NULL;
-#endif /* XML_DTD */
- break;
- case XML_ROLE_NOTATION_NAME:
- declNotationPublicId = NULL;
- declNotationName = NULL;
- if (notationDeclHandler) {
- declNotationName = poolStoreString(&tempPool, enc, s, next);
- if (!declNotationName)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&tempPool);
- handleDefault = XML_FALSE;
- }
- break;
- case XML_ROLE_NOTATION_PUBLIC_ID:
- if (!XmlIsPublicId(enc, s, next, eventPP))
- return XML_ERROR_SYNTAX;
- if (declNotationName) { /* means notationDeclHandler != NULL */
- XML_Char *tem = poolStoreString(&tempPool,
- enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!tem)
- return XML_ERROR_NO_MEMORY;
- normalizePublicId(tem);
- declNotationPublicId = tem;
- poolFinish(&tempPool);
- handleDefault = XML_FALSE;
- }
- break;
- case XML_ROLE_NOTATION_SYSTEM_ID:
- if (declNotationName && notationDeclHandler) {
- const XML_Char *systemId
- = poolStoreString(&tempPool, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!systemId)
- return XML_ERROR_NO_MEMORY;
- *eventEndPP = s;
- notationDeclHandler(handlerArg,
- declNotationName,
- curBase,
- systemId,
- declNotationPublicId);
- handleDefault = XML_FALSE;
- }
- poolClear(&tempPool);
- break;
- case XML_ROLE_NOTATION_NO_SYSTEM_ID:
- if (declNotationPublicId && notationDeclHandler) {
- *eventEndPP = s;
- notationDeclHandler(handlerArg,
- declNotationName,
- curBase,
- 0,
- declNotationPublicId);
- handleDefault = XML_FALSE;
- }
- poolClear(&tempPool);
- break;
- case XML_ROLE_ERROR:
- switch (tok) {
- case XML_TOK_PARAM_ENTITY_REF:
- return XML_ERROR_PARAM_ENTITY_REF;
- case XML_TOK_XML_DECL:
- return XML_ERROR_MISPLACED_XML_PI;
- default:
- return XML_ERROR_SYNTAX;
- }
-#ifdef XML_DTD
- case XML_ROLE_IGNORE_SECT:
- {
- enum XML_Error result;
- if (defaultHandler)
- reportDefault(parser, enc, s, next);
- handleDefault = XML_FALSE;
- result = doIgnoreSection(parser, enc, &next, end, nextPtr);
- if (!next) {
- processor = ignoreSectionProcessor;
- return result;
- }
- }
- break;
-#endif /* XML_DTD */
- case XML_ROLE_GROUP_OPEN:
- if (prologState.level >= groupSize) {
- if (groupSize) {
- char *temp = REALLOC(groupConnector, groupSize *= 2);
- if (temp == NULL)
- return XML_ERROR_NO_MEMORY;
- groupConnector = temp;
- if (dtd.scaffIndex) {
- int *temp = REALLOC(dtd.scaffIndex, groupSize * sizeof(int));
- if (temp == NULL)
- return XML_ERROR_NO_MEMORY;
- dtd.scaffIndex = temp;
- }
- }
- else {
- groupConnector = MALLOC(groupSize = 32);
- if (!groupConnector)
- return XML_ERROR_NO_MEMORY;
- }
- }
- groupConnector[prologState.level] = 0;
- if (dtd.in_eldecl) {
- int myindex = nextScaffoldPart(parser);
- if (myindex < 0)
- return XML_ERROR_NO_MEMORY;
- dtd.scaffIndex[dtd.scaffLevel] = myindex;
- dtd.scaffLevel++;
- dtd.scaffold[myindex].type = XML_CTYPE_SEQ;
- if (elementDeclHandler)
- handleDefault = XML_FALSE;
- }
- break;
- case XML_ROLE_GROUP_SEQUENCE:
- if (groupConnector[prologState.level] == '|')
- return XML_ERROR_SYNTAX;
- groupConnector[prologState.level] = ',';
- if (dtd.in_eldecl && elementDeclHandler)
- handleDefault = XML_FALSE;
- break;
- case XML_ROLE_GROUP_CHOICE:
- if (groupConnector[prologState.level] == ',')
- return XML_ERROR_SYNTAX;
- if (dtd.in_eldecl
- && !groupConnector[prologState.level]
- && (dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]].type
- != XML_CTYPE_MIXED)
- ) {
- dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]].type
- = XML_CTYPE_CHOICE;
- if (elementDeclHandler)
- handleDefault = XML_FALSE;
- }
- groupConnector[prologState.level] = '|';
- break;
- case XML_ROLE_PARAM_ENTITY_REF:
-#ifdef XML_DTD
- case XML_ROLE_INNER_PARAM_ENTITY_REF:
- /* PE references in internal subset are
- not allowed within declarations */
- if (prologState.documentEntity &&
- role == XML_ROLE_INNER_PARAM_ENTITY_REF)
- return XML_ERROR_PARAM_ENTITY_REF;
- dtd.hasParamEntityRefs = XML_TRUE;
- if (!paramEntityParsing)
- dtd.keepProcessing = dtd.standalone;
- else {
- const XML_Char *name;
- ENTITY *entity;
- name = poolStoreString(&dtd.pool, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0);
- poolDiscard(&dtd.pool);
- /* first, determine if a check for an existing declaration is needed;
- if yes, check that the entity exists, and that it is internal,
- otherwise call the skipped entity handler
- */
- if (prologState.documentEntity &&
- (dtd.standalone
- ? !openInternalEntities
- : !dtd.hasParamEntityRefs)) {
- if (!entity)
- return XML_ERROR_UNDEFINED_ENTITY;
- else if (!entity->is_internal)
- return XML_ERROR_ENTITY_DECLARED_IN_PE;
- }
- else if (!entity) {
- dtd.keepProcessing = dtd.standalone;
- /* cannot report skipped entities in declarations */
- if ((role == XML_ROLE_PARAM_ENTITY_REF) && skippedEntityHandler) {
- skippedEntityHandler(handlerArg, name, 1);
- handleDefault = XML_FALSE;
- }
- break;
- }
- if (entity->open)
- return XML_ERROR_RECURSIVE_ENTITY_REF;
- if (entity->textPtr) {
- enum XML_Error result;
- result = processInternalParamEntity(parser, entity);
- if (result != XML_ERROR_NONE)
- return result;
- handleDefault = XML_FALSE;
- break;
- }
- if (externalEntityRefHandler) {
- dtd.paramEntityRead = XML_FALSE;
- entity->open = XML_TRUE;
- if (!externalEntityRefHandler(externalEntityRefHandlerArg,
- 0,
- entity->base,
- entity->systemId,
- entity->publicId)) {
- entity->open = XML_FALSE;
- return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
- }
- entity->open = XML_FALSE;
- handleDefault = XML_FALSE;
- if (!dtd.paramEntityRead) {
- dtd.keepProcessing = dtd.standalone;
- break;
- }
- }
- else {
- dtd.keepProcessing = dtd.standalone;
- break;
- }
- }
-#endif /* XML_DTD */
- if (!dtd.standalone &&
- notStandaloneHandler &&
- !notStandaloneHandler(handlerArg))
- return XML_ERROR_NOT_STANDALONE;
- break;
-
- /* Element declaration stuff */
-
- case XML_ROLE_ELEMENT_NAME:
- if (elementDeclHandler) {
- declElementType = getElementType(parser, enc, s, next);
- if (!declElementType)
- return XML_ERROR_NO_MEMORY;
- dtd.scaffLevel = 0;
- dtd.scaffCount = 0;
- dtd.in_eldecl = XML_TRUE;
- handleDefault = XML_FALSE;
- }
- break;
-
- case XML_ROLE_CONTENT_ANY:
- case XML_ROLE_CONTENT_EMPTY:
- if (dtd.in_eldecl) {
- if (elementDeclHandler) {
- XML_Content * content = (XML_Content *) MALLOC(sizeof(XML_Content));
- if (!content)
- return XML_ERROR_NO_MEMORY;
- content->quant = XML_CQUANT_NONE;
- content->name = NULL;
- content->numchildren = 0;
- content->children = NULL;
- content->type = ((role == XML_ROLE_CONTENT_ANY) ?
- XML_CTYPE_ANY :
- XML_CTYPE_EMPTY);
- *eventEndPP = s;
- elementDeclHandler(handlerArg, declElementType->name, content);
- handleDefault = XML_FALSE;
- }
- dtd.in_eldecl = XML_FALSE;
- }
- break;
-
- case XML_ROLE_CONTENT_PCDATA:
- if (dtd.in_eldecl) {
- dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]].type
- = XML_CTYPE_MIXED;
- if (elementDeclHandler)
- handleDefault = XML_FALSE;
- }
- break;
-
- case XML_ROLE_CONTENT_ELEMENT:
- quant = XML_CQUANT_NONE;
- goto elementContent;
- case XML_ROLE_CONTENT_ELEMENT_OPT:
- quant = XML_CQUANT_OPT;
- goto elementContent;
- case XML_ROLE_CONTENT_ELEMENT_REP:
- quant = XML_CQUANT_REP;
- goto elementContent;
- case XML_ROLE_CONTENT_ELEMENT_PLUS:
- quant = XML_CQUANT_PLUS;
- elementContent:
- if (dtd.in_eldecl) {
- ELEMENT_TYPE *el;
- const XML_Char *name;
- int nameLen;
- const char *nxt = (quant == XML_CQUANT_NONE
- ? next
- : next - enc->minBytesPerChar);
- int myindex = nextScaffoldPart(parser);
- if (myindex < 0)
- return XML_ERROR_NO_MEMORY;
- dtd.scaffold[myindex].type = XML_CTYPE_NAME;
- dtd.scaffold[myindex].quant = quant;
- el = getElementType(parser, enc, s, nxt);
- if (!el)
- return XML_ERROR_NO_MEMORY;
- name = el->name;
- dtd.scaffold[myindex].name = name;
- nameLen = 0;
- for (; name[nameLen++]; );
- dtd.contentStringLen += nameLen;
- if (elementDeclHandler)
- handleDefault = XML_FALSE;
- }
- break;
-
- case XML_ROLE_GROUP_CLOSE:
- quant = XML_CQUANT_NONE;
- goto closeGroup;
- case XML_ROLE_GROUP_CLOSE_OPT:
- quant = XML_CQUANT_OPT;
- goto closeGroup;
- case XML_ROLE_GROUP_CLOSE_REP:
- quant = XML_CQUANT_REP;
- goto closeGroup;
- case XML_ROLE_GROUP_CLOSE_PLUS:
- quant = XML_CQUANT_PLUS;
- closeGroup:
- if (dtd.in_eldecl) {
- if (elementDeclHandler)
- handleDefault = XML_FALSE;
- dtd.scaffLevel--;
- dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel]].quant = quant;
- if (dtd.scaffLevel == 0) {
- if (!handleDefault) {
- XML_Content *model = build_model(parser);
- if (!model)
- return XML_ERROR_NO_MEMORY;
- *eventEndPP = s;
- elementDeclHandler(handlerArg, declElementType->name, model);
- }
- dtd.in_eldecl = XML_FALSE;
- dtd.contentStringLen = 0;
- }
- }
- break;
- /* End element declaration stuff */
-
- case XML_ROLE_PI:
- if (!reportProcessingInstruction(parser, enc, s, next))
- return XML_ERROR_NO_MEMORY;
- handleDefault = XML_FALSE;
- break;
- case XML_ROLE_COMMENT:
- if (!reportComment(parser, enc, s, next))
- return XML_ERROR_NO_MEMORY;
- handleDefault = XML_FALSE;
- break;
- case XML_ROLE_NONE:
- switch (tok) {
- case XML_TOK_BOM:
- handleDefault = XML_FALSE;
- break;
- }
- break;
- case XML_ROLE_DOCTYPE_NONE:
- if (startDoctypeDeclHandler)
- handleDefault = XML_FALSE;
- break;
- case XML_ROLE_ENTITY_NONE:
- if (dtd.keepProcessing && entityDeclHandler)
- handleDefault = XML_FALSE;
- break;
- case XML_ROLE_NOTATION_NONE:
- if (notationDeclHandler)
- handleDefault = XML_FALSE;
- break;
- case XML_ROLE_ATTLIST_NONE:
- if (dtd.keepProcessing && attlistDeclHandler)
- handleDefault = XML_FALSE;
- break;
- case XML_ROLE_ELEMENT_NONE:
- if (elementDeclHandler)
- handleDefault = XML_FALSE;
- break;
- } /* end of big switch */
-
- if (handleDefault && defaultHandler)
- reportDefault(parser, enc, s, next);
-
- s = next;
- tok = XmlPrologTok(enc, s, end, &next);
- }
- /* not reached */
-}
-
-static enum XML_Error FASTCALL
-epilogProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- processor = epilogProcessor;
- eventPtr = s;
- for (;;) {
- const char *next = NULL;
- int tok = XmlPrologTok(encoding, s, end, &next);
- eventEndPtr = next;
- switch (tok) {
- /* report partial linebreak - it might be the last token */
- case -XML_TOK_PROLOG_S:
- if (defaultHandler) {
- eventEndPtr = next;
- reportDefault(parser, encoding, s, next);
- }
- if (nextPtr)
- *nextPtr = next;
- return XML_ERROR_NONE;
- case XML_TOK_NONE:
- if (nextPtr)
- *nextPtr = s;
- return XML_ERROR_NONE;
- case XML_TOK_PROLOG_S:
- if (defaultHandler)
- reportDefault(parser, encoding, s, next);
- break;
- case XML_TOK_PI:
- if (!reportProcessingInstruction(parser, encoding, s, next))
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_TOK_COMMENT:
- if (!reportComment(parser, encoding, s, next))
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_TOK_INVALID:
- eventPtr = next;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_PARTIAL_CHAR;
- default:
- return XML_ERROR_JUNK_AFTER_DOC_ELEMENT;
- }
- eventPtr = s = next;
- }
-}
-
-#ifdef XML_DTD
-
-static enum XML_Error FASTCALL
-processInternalParamEntity(XML_Parser parser, ENTITY *entity)
-{
- const char *s, *end, *next;
- int tok;
- enum XML_Error result;
- OPEN_INTERNAL_ENTITY openEntity;
- entity->open = XML_TRUE;
- openEntity.next = openInternalEntities;
- openInternalEntities = &openEntity;
- openEntity.entity = entity;
- openEntity.internalEventPtr = NULL;
- openEntity.internalEventEndPtr = NULL;
- s = (char *)entity->textPtr;
- end = (char *)(entity->textPtr + entity->textLen);
- tok = XmlPrologTok(internalEncoding, s, end, &next);
- result = doProlog(parser, internalEncoding, s, end, tok, next, 0);
- entity->open = XML_FALSE;
- openInternalEntities = openEntity.next;
- return result;
-}
-
-#endif /* XML_DTD */
-
-static enum XML_Error FASTCALL
-errorProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- return errorCode;
-}
-
-static enum XML_Error FASTCALL
-storeAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata,
- const char *ptr, const char *end,
- STRING_POOL *pool)
-{
- enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr,
- end, pool);
- if (result)
- return result;
- if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20)
- poolChop(pool);
- if (!poolAppendChar(pool, XML_T('\0')))
- return XML_ERROR_NO_MEMORY;
- return XML_ERROR_NONE;
-}
-
-static enum XML_Error FASTCALL
-appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata,
- const char *ptr, const char *end,
- STRING_POOL *pool)
-{
- for (;;) {
- const char *next;
- int tok = XmlAttributeValueTok(enc, ptr, end, &next);
- switch (tok) {
- case XML_TOK_NONE:
- return XML_ERROR_NONE;
- case XML_TOK_INVALID:
- if (enc == encoding)
- eventPtr = next;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL:
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_CHAR_REF:
- {
- XML_Char buf[XML_ENCODE_MAX];
- int i;
- int n = XmlCharRefNumber(enc, ptr);
- if (n < 0) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_BAD_CHAR_REF;
- }
- if (!isCdata
- && n == 0x20 /* space */
- && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
- break;
- n = XmlEncode(n, (ICHAR *)buf);
- if (!n) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_BAD_CHAR_REF;
- }
- for (i = 0; i < n; i++) {
- if (!poolAppendChar(pool, buf[i]))
- return XML_ERROR_NO_MEMORY;
- }
- }
- break;
- case XML_TOK_DATA_CHARS:
- if (!poolAppend(pool, enc, ptr, next))
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_TOK_TRAILING_CR:
- next = ptr + enc->minBytesPerChar;
- /* fall through */
- case XML_TOK_ATTRIBUTE_VALUE_S:
- case XML_TOK_DATA_NEWLINE:
- if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
- break;
- if (!poolAppendChar(pool, 0x20))
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_TOK_ENTITY_REF:
- {
- const XML_Char *name;
- ENTITY *entity;
- char checkEntityDecl;
- XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc,
- ptr + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (ch) {
- if (!poolAppendChar(pool, ch))
- return XML_ERROR_NO_MEMORY;
- break;
- }
- name = poolStoreString(&temp2Pool, enc,
- ptr + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0);
- poolDiscard(&temp2Pool);
- /* first, determine if a check for an existing declaration is needed;
- if yes, check that the entity exists, and that it is internal,
- otherwise call the default handler (if called from content)
- */
- if (pool == &dtd.pool) /* are we called from prolog? */
- checkEntityDecl =
-#ifdef XML_DTD
- prologState.documentEntity &&
-#endif /* XML_DTD */
- (dtd.standalone
- ? !openInternalEntities
- : !dtd.hasParamEntityRefs);
- else /* if (pool == &tempPool): we are called from content */
- checkEntityDecl = !dtd.hasParamEntityRefs || dtd.standalone;
- if (checkEntityDecl) {
- if (!entity)
- return XML_ERROR_UNDEFINED_ENTITY;
- else if (!entity->is_internal)
- return XML_ERROR_ENTITY_DECLARED_IN_PE;
- }
- else if (!entity) {
- /* cannot report skipped entity here - see comments on
- skippedEntityHandler
- if (skippedEntityHandler)
- skippedEntityHandler(handlerArg, name, 0);
- */
- if ((pool == &tempPool) && defaultHandler)
- reportDefault(parser, enc, ptr, next);
- break;
- }
- if (entity->open) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_RECURSIVE_ENTITY_REF;
- }
- if (entity->notation) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_BINARY_ENTITY_REF;
- }
- if (!entity->textPtr) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF;
- }
- else {
- enum XML_Error result;
- const XML_Char *textEnd = entity->textPtr + entity->textLen;
- entity->open = XML_TRUE;
- result = appendAttributeValue(parser, internalEncoding, isCdata,
- (char *)entity->textPtr,
- (char *)textEnd, pool);
- entity->open = XML_FALSE;
- if (result)
- return result;
- }
- }
- break;
- default:
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_UNEXPECTED_STATE;
- }
- ptr = next;
- }
- /* not reached */
-}
-
-static enum XML_Error FASTCALL
-storeEntityValue(XML_Parser parser,
- const ENCODING *enc,
- const char *entityTextPtr,
- const char *entityTextEnd)
-{
- STRING_POOL *pool = &(dtd.entityValuePool);
- enum XML_Error result = XML_ERROR_NONE;
-#ifdef XML_DTD
- int oldInEntityValue = prologState.inEntityValue;
- prologState.inEntityValue = 1;
-#endif /* XML_DTD */
- /* never return Null for the value argument in EntityDeclHandler,
- since this would indicate an external entity; therefore we
- have to make sure that entityValuePool.start is not null */
- if (!pool->blocks) {
- if (!poolGrow(pool))
- return XML_ERROR_NO_MEMORY;
- }
-
- for (;;) {
- const char *next;
- int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next);
- switch (tok) {
- case XML_TOK_PARAM_ENTITY_REF:
-#ifdef XML_DTD
- if (isParamEntity || enc != encoding) {
- const XML_Char *name;
- ENTITY *entity;
- name = poolStoreString(&tempPool, enc,
- entityTextPtr + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!name) {
- result = XML_ERROR_NO_MEMORY;
- goto endEntityValue;
- }
- entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0);
- poolDiscard(&tempPool);
- if (!entity) {
- /* not a well-formedness error - see XML 1.0: WFC Entity Declared */
- /* cannot report skipped entity here - see comments on
- skippedEntityHandler
- if (skippedEntityHandler)
- skippedEntityHandler(handlerArg, name, 0);
- */
- dtd.keepProcessing = dtd.standalone;
- goto endEntityValue;
- }
- if (entity->open) {
- if (enc == encoding)
- eventPtr = entityTextPtr;
- result = XML_ERROR_RECURSIVE_ENTITY_REF;
- goto endEntityValue;
- }
- if (entity->systemId) {
- if (externalEntityRefHandler) {
- dtd.paramEntityRead = XML_FALSE;
- entity->open = XML_TRUE;
- if (!externalEntityRefHandler(externalEntityRefHandlerArg,
- 0,
- entity->base,
- entity->systemId,
- entity->publicId)) {
- entity->open = XML_FALSE;
- result = XML_ERROR_EXTERNAL_ENTITY_HANDLING;
- goto endEntityValue;
- }
- entity->open = XML_FALSE;
- if (!dtd.paramEntityRead)
- dtd.keepProcessing = dtd.standalone;
- }
- else
- dtd.keepProcessing = dtd.standalone;
- }
- else {
- entity->open = XML_TRUE;
- result = storeEntityValue(parser,
- internalEncoding,
- (char *)entity->textPtr,
- (char *)(entity->textPtr
- + entity->textLen));
- entity->open = XML_FALSE;
- if (result)
- goto endEntityValue;
- }
- break;
- }
-#endif /* XML_DTD */
- /* in the internal subset, PE references are not legal
- within markup declarations, e.g entity values in this case */
- eventPtr = entityTextPtr;
- result = XML_ERROR_PARAM_ENTITY_REF;
- goto endEntityValue;
- case XML_TOK_NONE:
- result = XML_ERROR_NONE;
- goto endEntityValue;
- case XML_TOK_ENTITY_REF:
- case XML_TOK_DATA_CHARS:
- if (!poolAppend(pool, enc, entityTextPtr, next)) {
- result = XML_ERROR_NO_MEMORY;
- goto endEntityValue;
- }
- break;
- case XML_TOK_TRAILING_CR:
- next = entityTextPtr + enc->minBytesPerChar;
- /* fall through */
- case XML_TOK_DATA_NEWLINE:
- if (pool->end == pool->ptr && !poolGrow(pool)) {
- result = XML_ERROR_NO_MEMORY;
- goto endEntityValue;
- }
- *(pool->ptr)++ = 0xA;
- break;
- case XML_TOK_CHAR_REF:
- {
- XML_Char buf[XML_ENCODE_MAX];
- int i;
- int n = XmlCharRefNumber(enc, entityTextPtr);
- if (n < 0) {
- if (enc == encoding)
- eventPtr = entityTextPtr;
- result = XML_ERROR_BAD_CHAR_REF;
- goto endEntityValue;
- }
- n = XmlEncode(n, (ICHAR *)buf);
- if (!n) {
- if (enc == encoding)
- eventPtr = entityTextPtr;
- result = XML_ERROR_BAD_CHAR_REF;
- goto endEntityValue;
- }
- for (i = 0; i < n; i++) {
- if (pool->end == pool->ptr && !poolGrow(pool)) {
- result = XML_ERROR_NO_MEMORY;
- goto endEntityValue;
- }
- *(pool->ptr)++ = buf[i];
- }
- }
- break;
- case XML_TOK_PARTIAL:
- if (enc == encoding)
- eventPtr = entityTextPtr;
- result = XML_ERROR_INVALID_TOKEN;
- goto endEntityValue;
- case XML_TOK_INVALID:
- if (enc == encoding)
- eventPtr = next;
- result = XML_ERROR_INVALID_TOKEN;
- goto endEntityValue;
- default:
- if (enc == encoding)
- eventPtr = entityTextPtr;
- result = XML_ERROR_UNEXPECTED_STATE;
- goto endEntityValue;
- }
- entityTextPtr = next;
- }
-endEntityValue:
-#ifdef XML_DTD
- prologState.inEntityValue = oldInEntityValue;
-#endif /* XML_DTD */
- return result;
-}
-
-static void FASTCALL
-normalizeLines(XML_Char *s)
-{
- XML_Char *p;
- for (;; s++) {
- if (*s == XML_T('\0'))
- return;
- if (*s == 0xD)
- break;
- }
- p = s;
- do {
- if (*s == 0xD) {
- *p++ = 0xA;
- if (*++s == 0xA)
- s++;
- }
- else
- *p++ = *s++;
- } while (*s);
- *p = XML_T('\0');
-}
-
-static int FASTCALL
-reportProcessingInstruction(XML_Parser parser, const ENCODING *enc,
- const char *start, const char *end)
-{
- const XML_Char *target;
- XML_Char *data;
- const char *tem;
- if (!processingInstructionHandler) {
- if (defaultHandler)
- reportDefault(parser, enc, start, end);
- return 1;
- }
- start += enc->minBytesPerChar * 2;
- tem = start + XmlNameLength(enc, start);
- target = poolStoreString(&tempPool, enc, start, tem);
- if (!target)
- return 0;
- poolFinish(&tempPool);
- data = poolStoreString(&tempPool, enc,
- XmlSkipS(enc, tem),
- end - enc->minBytesPerChar*2);
- if (!data)
- return 0;
- normalizeLines(data);
- processingInstructionHandler(handlerArg, target, data);
- poolClear(&tempPool);
- return 1;
-}
-
-static int FASTCALL
-reportComment(XML_Parser parser, const ENCODING *enc,
- const char *start, const char *end)
-{
- XML_Char *data;
- if (!commentHandler) {
- if (defaultHandler)
- reportDefault(parser, enc, start, end);
- return 1;
- }
- data = poolStoreString(&tempPool,
- enc,
- start + enc->minBytesPerChar * 4,
- end - enc->minBytesPerChar * 3);
- if (!data)
- return 0;
- normalizeLines(data);
- commentHandler(handlerArg, data);
- poolClear(&tempPool);
- return 1;
-}
-
-static void FASTCALL
-reportDefault(XML_Parser parser, const ENCODING *enc,
- const char *s, const char *end)
-{
- if (MUST_CONVERT(enc, s)) {
- const char **eventPP;
- const char **eventEndPP;
- if (enc == encoding) {
- eventPP = &eventPtr;
- eventEndPP = &eventEndPtr;
- }
- else {
- eventPP = &(openInternalEntities->internalEventPtr);
- eventEndPP = &(openInternalEntities->internalEventEndPtr);
- }
- do {
- ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
- *eventEndPP = s;
- defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
- *eventPP = s;
- } while (s != end);
- }
- else
- defaultHandler(handlerArg, (XML_Char *)s, (XML_Char *)end - (XML_Char *)s);
-}
-
-
-static int FASTCALL
-defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, XML_Bool isCdata,
- XML_Bool isId, const XML_Char *value, XML_Parser parser)
-{
- DEFAULT_ATTRIBUTE *att;
- if (value || isId) {
- /* The handling of default attributes gets messed up if we have
- a default which duplicates a non-default. */
- int i;
- for (i = 0; i < type->nDefaultAtts; i++)
- if (attId == type->defaultAtts[i].id)
- return 1;
- if (isId && !type->idAtt && !attId->xmlns)
- type->idAtt = attId;
- }
- if (type->nDefaultAtts == type->allocDefaultAtts) {
- if (type->allocDefaultAtts == 0) {
- type->allocDefaultAtts = 8;
- type->defaultAtts = MALLOC(type->allocDefaultAtts
- * sizeof(DEFAULT_ATTRIBUTE));
- if (!type->defaultAtts)
- return 0;
- }
- else {
- DEFAULT_ATTRIBUTE *temp;
- int count = type->allocDefaultAtts * 2;
- temp = REALLOC(type->defaultAtts, (count * sizeof(DEFAULT_ATTRIBUTE)));
- if (temp == NULL)
- return 0;
- type->allocDefaultAtts = count;
- type->defaultAtts = temp;
- }
- }
- att = type->defaultAtts + type->nDefaultAtts;
- att->id = attId;
- att->value = value;
- att->isCdata = isCdata;
- if (!isCdata)
- attId->maybeTokenized = XML_TRUE;
- type->nDefaultAtts += 1;
- return 1;
-}
-
-static int FASTCALL
-setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType)
-{
- const XML_Char *name;
- for (name = elementType->name; *name; name++) {
- if (*name == XML_T(':')) {
- PREFIX *prefix;
- const XML_Char *s;
- for (s = elementType->name; s != name; s++) {
- if (!poolAppendChar(&dtd.pool, *s))
- return 0;
- }
- if (!poolAppendChar(&dtd.pool, XML_T('\0')))
- return 0;
- prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool),
- sizeof(PREFIX));
- if (!prefix)
- return 0;
- if (prefix->name == poolStart(&dtd.pool))
- poolFinish(&dtd.pool);
- else
- poolDiscard(&dtd.pool);
- elementType->prefix = prefix;
-
- }
- }
- return 1;
-}
-
-static ATTRIBUTE_ID * FASTCALL
-getAttributeId(XML_Parser parser, const ENCODING *enc,
- const char *start, const char *end)
-{
- ATTRIBUTE_ID *id;
- const XML_Char *name;
- if (!poolAppendChar(&dtd.pool, XML_T('\0')))
- return NULL;
- name = poolStoreString(&dtd.pool, enc, start, end);
- if (!name)
- return NULL;
- ++name;
- id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, name, sizeof(ATTRIBUTE_ID));
- if (!id)
- return NULL;
- if (id->name != name)
- poolDiscard(&dtd.pool);
- else {
- poolFinish(&dtd.pool);
- if (!ns)
- ;
- else if (name[0] == 'x'
- && name[1] == 'm'
- && name[2] == 'l'
- && name[3] == 'n'
- && name[4] == 's'
- && (name[5] == XML_T('\0') || name[5] == XML_T(':'))) {
- if (name[5] == '\0')
- id->prefix = &dtd.defaultPrefix;
- else
- id->prefix = (PREFIX *)lookup(&dtd.prefixes, name + 6, sizeof(PREFIX));
- id->xmlns = XML_TRUE;
- }
- else {
- int i;
- for (i = 0; name[i]; i++) {
- if (name[i] == XML_T(':')) {
- int j;
- for (j = 0; j < i; j++) {
- if (!poolAppendChar(&dtd.pool, name[j]))
- return NULL;
- }
- if (!poolAppendChar(&dtd.pool, XML_T('\0')))
- return NULL;
- id->prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool),
- sizeof(PREFIX));
- if (id->prefix->name == poolStart(&dtd.pool))
- poolFinish(&dtd.pool);
- else
- poolDiscard(&dtd.pool);
- break;
- }
- }
- }
- }
- return id;
-}
-
-#define CONTEXT_SEP XML_T('\f')
-
-static const XML_Char * FASTCALL
-getContext(XML_Parser parser)
-{
- HASH_TABLE_ITER iter;
- XML_Bool needSep = XML_FALSE;
-
- if (dtd.defaultPrefix.binding) {
- int i;
- int len;
- if (!poolAppendChar(&tempPool, XML_T('=')))
- return NULL;
- len = dtd.defaultPrefix.binding->uriLen;
- if (namespaceSeparator != XML_T('\0'))
- len--;
- for (i = 0; i < len; i++)
- if (!poolAppendChar(&tempPool, dtd.defaultPrefix.binding->uri[i]))
- return NULL;
- needSep = XML_TRUE;
- }
-
- hashTableIterInit(&iter, &(dtd.prefixes));
- for (;;) {
- int i;
- int len;
- const XML_Char *s;
- PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter);
- if (!prefix)
- break;
- if (!prefix->binding)
- continue;
- if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP))
- return NULL;
- for (s = prefix->name; *s; s++)
- if (!poolAppendChar(&tempPool, *s))
- return NULL;
- if (!poolAppendChar(&tempPool, XML_T('=')))
- return NULL;
- len = prefix->binding->uriLen;
- if (namespaceSeparator != XML_T('\0'))
- len--;
- for (i = 0; i < len; i++)
- if (!poolAppendChar(&tempPool, prefix->binding->uri[i]))
- return NULL;
- needSep = XML_TRUE;
- }
-
-
- hashTableIterInit(&iter, &(dtd.generalEntities));
- for (;;) {
- const XML_Char *s;
- ENTITY *e = (ENTITY *)hashTableIterNext(&iter);
- if (!e)
- break;
- if (!e->open)
- continue;
- if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP))
- return NULL;
- for (s = e->name; *s; s++)
- if (!poolAppendChar(&tempPool, *s))
- return 0;
- needSep = XML_TRUE;
- }
-
- if (!poolAppendChar(&tempPool, XML_T('\0')))
- return NULL;
- return tempPool.start;
-}
-
-static XML_Bool FASTCALL
-setContext(XML_Parser parser, const XML_Char *context)
-{
- const XML_Char *s = context;
-
- while (*context != XML_T('\0')) {
- if (*s == CONTEXT_SEP || *s == XML_T('\0')) {
- ENTITY *e;
- if (!poolAppendChar(&tempPool, XML_T('\0')))
- return XML_FALSE;
- e = (ENTITY *)lookup(&dtd.generalEntities, poolStart(&tempPool), 0);
- if (e)
- e->open = XML_TRUE;
- if (*s != XML_T('\0'))
- s++;
- context = s;
- poolDiscard(&tempPool);
- }
- else if (*s == XML_T('=')) {
- PREFIX *prefix;
- if (poolLength(&tempPool) == 0)
- prefix = &dtd.defaultPrefix;
- else {
- if (!poolAppendChar(&tempPool, XML_T('\0')))
- return XML_FALSE;
- prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&tempPool),
- sizeof(PREFIX));
- if (!prefix)
- return XML_FALSE;
- if (prefix->name == poolStart(&tempPool)) {
- prefix->name = poolCopyString(&dtd.pool, prefix->name);
- if (!prefix->name)
- return XML_FALSE;
- }
- poolDiscard(&tempPool);
- }
- for (context = s + 1;
- *context != CONTEXT_SEP && *context != XML_T('\0');
- context++)
- if (!poolAppendChar(&tempPool, *context))
- return XML_FALSE;
- if (!poolAppendChar(&tempPool, XML_T('\0')))
- return XML_FALSE;
- if (!addBinding(parser, prefix, 0, poolStart(&tempPool),
- &inheritedBindings))
- return XML_FALSE;
- poolDiscard(&tempPool);
- if (*context != XML_T('\0'))
- ++context;
- s = context;
- }
- else {
- if (!poolAppendChar(&tempPool, *s))
- return XML_FALSE;
- s++;
- }
- }
- return XML_TRUE;
-}
-
-static void FASTCALL
-normalizePublicId(XML_Char *publicId)
-{
- XML_Char *p = publicId;
- XML_Char *s;
- for (s = publicId; *s; s++) {
- switch (*s) {
- case 0x20:
- case 0xD:
- case 0xA:
- if (p != publicId && p[-1] != 0x20)
- *p++ = 0x20;
- break;
- default:
- *p++ = *s;
- }
- }
- if (p != publicId && p[-1] == 0x20)
- --p;
- *p = XML_T('\0');
-}
-
-static void FASTCALL
-dtdInit(DTD *p, XML_Parser parser)
-{
- XML_Memory_Handling_Suite *ms = &parser->m_mem;
- poolInit(&(p->pool), ms);
-#ifdef XML_DTD
- poolInit(&(p->entityValuePool), ms);
-#endif /* XML_DTD */
- hashTableInit(&(p->generalEntities), ms);
- hashTableInit(&(p->elementTypes), ms);
- hashTableInit(&(p->attributeIds), ms);
- hashTableInit(&(p->prefixes), ms);
-#ifdef XML_DTD
- p->paramEntityRead = XML_FALSE;
- hashTableInit(&(p->paramEntities), ms);
-#endif /* XML_DTD */
- p->defaultPrefix.name = NULL;
- p->defaultPrefix.binding = NULL;
-
- p->in_eldecl = XML_FALSE;
- p->scaffIndex = NULL;
- p->scaffold = NULL;
- p->scaffLevel = 0;
- p->scaffSize = 0;
- p->scaffCount = 0;
- p->contentStringLen = 0;
-
- p->keepProcessing = XML_TRUE;
- p->hasParamEntityRefs = XML_FALSE;
- p->standalone = XML_FALSE;
-}
-
-#ifdef XML_DTD
-
-static void FASTCALL
-dtdSwap(DTD *p1, DTD *p2)
-{
- DTD tem;
- memcpy(&tem, p1, sizeof(DTD));
- memcpy(p1, p2, sizeof(DTD));
- memcpy(p2, &tem, sizeof(DTD));
-}
-
-#endif /* XML_DTD */
-
-static void FASTCALL
-dtdReset(DTD *p, XML_Parser parser)
-{
- HASH_TABLE_ITER iter;
- hashTableIterInit(&iter, &(p->elementTypes));
- for (;;) {
- ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter);
- if (!e)
- break;
- if (e->allocDefaultAtts != 0)
- FREE(e->defaultAtts);
- }
- hashTableClear(&(p->generalEntities));
-#ifdef XML_DTD
- p->paramEntityRead = XML_FALSE;
- hashTableClear(&(p->paramEntities));
-#endif /* XML_DTD */
- hashTableClear(&(p->elementTypes));
- hashTableClear(&(p->attributeIds));
- hashTableClear(&(p->prefixes));
- poolClear(&(p->pool));
-#ifdef XML_DTD
- poolClear(&(p->entityValuePool));
-#endif /* XML_DTD */
- p->defaultPrefix.name = NULL;
- p->defaultPrefix.binding = NULL;
-
- p->in_eldecl = XML_FALSE;
- if (p->scaffIndex) {
- FREE(p->scaffIndex);
- p->scaffIndex = NULL;
- }
- if (p->scaffold) {
- FREE(p->scaffold);
- p->scaffold = NULL;
- }
- p->scaffLevel = 0;
- p->scaffSize = 0;
- p->scaffCount = 0;
- p->contentStringLen = 0;
-
- p->keepProcessing = XML_TRUE;
- p->hasParamEntityRefs = XML_FALSE;
- p->standalone = XML_FALSE;
-}
-
-static void FASTCALL
-dtdDestroy(DTD *p, XML_Parser parser)
-{
- HASH_TABLE_ITER iter;
- hashTableIterInit(&iter, &(p->elementTypes));
- for (;;) {
- ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter);
- if (!e)
- break;
- if (e->allocDefaultAtts != 0)
- FREE(e->defaultAtts);
- }
- hashTableDestroy(&(p->generalEntities));
-#ifdef XML_DTD
- hashTableDestroy(&(p->paramEntities));
-#endif /* XML_DTD */
- hashTableDestroy(&(p->elementTypes));
- hashTableDestroy(&(p->attributeIds));
- hashTableDestroy(&(p->prefixes));
- poolDestroy(&(p->pool));
-#ifdef XML_DTD
- poolDestroy(&(p->entityValuePool));
-#endif /* XML_DTD */
- if (!parentParser) {
- if (p->scaffIndex)
- FREE(p->scaffIndex);
- if (p->scaffold)
- FREE(p->scaffold);
- }
-}
-
-/* Do a deep copy of the DTD. Return 0 for out of memory; non-zero otherwise.
- The new DTD has already been initialized.
-*/
-static int FASTCALL
-dtdCopy(DTD *newDtd, const DTD *oldDtd, XML_Parser parser)
-{
- HASH_TABLE_ITER iter;
-
- /* Copy the prefix table. */
-
- hashTableIterInit(&iter, &(oldDtd->prefixes));
- for (;;) {
- const XML_Char *name;
- const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter);
- if (!oldP)
- break;
- name = poolCopyString(&(newDtd->pool), oldP->name);
- if (!name)
- return 0;
- if (!lookup(&(newDtd->prefixes), name, sizeof(PREFIX)))
- return 0;
- }
-
- hashTableIterInit(&iter, &(oldDtd->attributeIds));
-
- /* Copy the attribute id table. */
-
- for (;;) {
- ATTRIBUTE_ID *newA;
- const XML_Char *name;
- const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter);
-
- if (!oldA)
- break;
- /* Remember to allocate the scratch byte before the name. */
- if (!poolAppendChar(&(newDtd->pool), XML_T('\0')))
- return 0;
- name = poolCopyString(&(newDtd->pool), oldA->name);
- if (!name)
- return 0;
- ++name;
- newA = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), name,
- sizeof(ATTRIBUTE_ID));
- if (!newA)
- return 0;
- newA->maybeTokenized = oldA->maybeTokenized;
- if (oldA->prefix) {
- newA->xmlns = oldA->xmlns;
- if (oldA->prefix == &oldDtd->defaultPrefix)
- newA->prefix = &newDtd->defaultPrefix;
- else
- newA->prefix = (PREFIX *)lookup(&(newDtd->prefixes),
- oldA->prefix->name, 0);
- }
- }
-
- /* Copy the element type table. */
-
- hashTableIterInit(&iter, &(oldDtd->elementTypes));
-
- for (;;) {
- int i;
- ELEMENT_TYPE *newE;
- const XML_Char *name;
- const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter);
- if (!oldE)
- break;
- name = poolCopyString(&(newDtd->pool), oldE->name);
- if (!name)
- return 0;
- newE = (ELEMENT_TYPE *)lookup(&(newDtd->elementTypes), name,
- sizeof(ELEMENT_TYPE));
- if (!newE)
- return 0;
- if (oldE->nDefaultAtts) {
- newE->defaultAtts = (DEFAULT_ATTRIBUTE *)
- MALLOC(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));
- if (!newE->defaultAtts) {
- FREE(newE);
- return 0;
- }
- }
- if (oldE->idAtt)
- newE->idAtt = (ATTRIBUTE_ID *)
- lookup(&(newDtd->attributeIds), oldE->idAtt->name, 0);
- newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts;
- if (oldE->prefix)
- newE->prefix = (PREFIX *)lookup(&(newDtd->prefixes),
- oldE->prefix->name, 0);
- for (i = 0; i < newE->nDefaultAtts; i++) {
- newE->defaultAtts[i].id = (ATTRIBUTE_ID *)
- lookup(&(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0);
- newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata;
- if (oldE->defaultAtts[i].value) {
- newE->defaultAtts[i].value
- = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value);
- if (!newE->defaultAtts[i].value)
- return 0;
- }
- else
- newE->defaultAtts[i].value = NULL;
- }
- }
-
- /* Copy the entity tables. */
- if (!copyEntityTable(&(newDtd->generalEntities),
- &(newDtd->pool),
- &(oldDtd->generalEntities), parser))
- return 0;
-
-#ifdef XML_DTD
- if (!copyEntityTable(&(newDtd->paramEntities),
- &(newDtd->pool),
- &(oldDtd->paramEntities), parser))
- return 0;
- newDtd->paramEntityRead = oldDtd->paramEntityRead;
-#endif /* XML_DTD */
-
- newDtd->keepProcessing = oldDtd->keepProcessing;
- newDtd->hasParamEntityRefs = oldDtd->hasParamEntityRefs;
- newDtd->standalone = oldDtd->standalone;
-
- /* Don't want deep copying for scaffolding */
- newDtd->in_eldecl = oldDtd->in_eldecl;
- newDtd->scaffold = oldDtd->scaffold;
- newDtd->contentStringLen = oldDtd->contentStringLen;
- newDtd->scaffSize = oldDtd->scaffSize;
- newDtd->scaffLevel = oldDtd->scaffLevel;
- newDtd->scaffIndex = oldDtd->scaffIndex;
-
- return 1;
-} /* End dtdCopy */
-
-static int FASTCALL
-copyEntityTable(HASH_TABLE *newTable,
- STRING_POOL *newPool,
- const HASH_TABLE *oldTable,
- XML_Parser parser)
-{
- HASH_TABLE_ITER iter;
- const XML_Char *cachedOldBase = NULL;
- const XML_Char *cachedNewBase = NULL;
-
- hashTableIterInit(&iter, oldTable);
-
- for (;;) {
- ENTITY *newE;
- const XML_Char *name;
- const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter);
- if (!oldE)
- break;
- name = poolCopyString(newPool, oldE->name);
- if (!name)
- return 0;
- newE = (ENTITY *)lookup(newTable, name, sizeof(ENTITY));
- if (!newE)
- return 0;
- if (oldE->systemId) {
- const XML_Char *tem = poolCopyString(newPool, oldE->systemId);
- if (!tem)
- return 0;
- newE->systemId = tem;
- if (oldE->base) {
- if (oldE->base == cachedOldBase)
- newE->base = cachedNewBase;
- else {
- cachedOldBase = oldE->base;
- tem = poolCopyString(newPool, cachedOldBase);
- if (!tem)
- return 0;
- cachedNewBase = newE->base = tem;
- }
- }
- if (oldE->publicId) {
- tem = poolCopyString(newPool, oldE->publicId);
- if (!tem)
- return 0;
- newE->publicId = tem;
- }
- }
- else {
- const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr,
- oldE->textLen);
- if (!tem)
- return 0;
- newE->textPtr = tem;
- newE->textLen = oldE->textLen;
- }
- if (oldE->notation) {
- const XML_Char *tem = poolCopyString(newPool, oldE->notation);
- if (!tem)
- return 0;
- newE->notation = tem;
- }
- newE->is_param = oldE->is_param;
- newE->is_internal = oldE->is_internal;
- }
- return 1;
-}
-
-#define INIT_SIZE 64
-
-static int FASTCALL
-keyeq(KEY s1, KEY s2)
-{
- for (; *s1 == *s2; s1++, s2++)
- if (*s1 == 0)
- return 1;
- return 0;
-}
-
-static unsigned long FASTCALL
-hash(KEY s)
-{
- unsigned long h = 0;
- while (*s)
- h = (h << 5) + h + (unsigned char)*s++;
- return h;
-}
-
-static NAMED * FASTCALL
-lookup(HASH_TABLE *table, KEY name, size_t createSize)
-{
- size_t i;
- if (table->size == 0) {
- size_t tsize;
-
- if (!createSize)
- return NULL;
- tsize = INIT_SIZE * sizeof(NAMED *);
- table->v = table->mem->malloc_fcn(tsize);
- if (!table->v)
- return NULL;
- memset(table->v, 0, tsize);
- table->size = INIT_SIZE;
- table->usedLim = INIT_SIZE / 2;
- i = hash(name) & (table->size - 1);
- }
- else {
- unsigned long h = hash(name);
- for (i = h & (table->size - 1);
- table->v[i];
- i == 0 ? i = table->size - 1 : --i) {
- if (keyeq(name, table->v[i]->name))
- return table->v[i];
- }
- if (!createSize)
- return NULL;
- if (table->used == table->usedLim) {
- /* check for overflow */
- size_t newSize = table->size * 2;
- size_t tsize = newSize * sizeof(NAMED *);
- NAMED **newV = table->mem->malloc_fcn(tsize);
- if (!newV)
- return NULL;
- memset(newV, 0, tsize);
- for (i = 0; i < table->size; i++)
- if (table->v[i]) {
- size_t j;
- for (j = hash(table->v[i]->name) & (newSize - 1);
- newV[j];
- j == 0 ? j = newSize - 1 : --j)
- ;
- newV[j] = table->v[i];
- }
- table->mem->free_fcn(table->v);
- table->v = newV;
- table->size = newSize;
- table->usedLim = newSize/2;
- for (i = h & (table->size - 1);
- table->v[i];
- i == 0 ? i = table->size - 1 : --i)
- ;
- }
- }
- table->v[i] = table->mem->malloc_fcn(createSize);
- if (!table->v[i])
- return NULL;
- memset(table->v[i], 0, createSize);
- table->v[i]->name = name;
- (table->used)++;
- return table->v[i];
-}
-
-static void FASTCALL
-hashTableClear(HASH_TABLE *table)
-{
- size_t i;
- for (i = 0; i < table->size; i++) {
- NAMED *p = table->v[i];
- if (p) {
- table->mem->free_fcn(p);
- table->v[i] = NULL;
- }
- }
- table->usedLim = table->size / 2;
- table->used = 0;
-}
-
-static void FASTCALL
-hashTableDestroy(HASH_TABLE *table)
-{
- size_t i;
- for (i = 0; i < table->size; i++) {
- NAMED *p = table->v[i];
- if (p)
- table->mem->free_fcn(p);
- }
- if (table->v)
- table->mem->free_fcn(table->v);
-}
-
-static void FASTCALL
-hashTableInit(HASH_TABLE *p, XML_Memory_Handling_Suite *ms)
-{
- p->size = 0;
- p->usedLim = 0;
- p->used = 0;
- p->v = NULL;
- p->mem = ms;
-}
-
-static void FASTCALL
-hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table)
-{
- iter->p = table->v;
- iter->end = iter->p + table->size;
-}
-
-static NAMED * FASTCALL
-hashTableIterNext(HASH_TABLE_ITER *iter)
-{
- while (iter->p != iter->end) {
- NAMED *tem = *(iter->p)++;
- if (tem)
- return tem;
- }
- return NULL;
-}
-
-static void FASTCALL
-poolInit(STRING_POOL *pool, XML_Memory_Handling_Suite *ms)
-{
- pool->blocks = NULL;
- pool->freeBlocks = NULL;
- pool->start = NULL;
- pool->ptr = NULL;
- pool->end = NULL;
- pool->mem = ms;
-}
-
-static void FASTCALL
-poolClear(STRING_POOL *pool)
-{
- if (!pool->freeBlocks)
- pool->freeBlocks = pool->blocks;
- else {
- BLOCK *p = pool->blocks;
- while (p) {
- BLOCK *tem = p->next;
- p->next = pool->freeBlocks;
- pool->freeBlocks = p;
- p = tem;
- }
- }
- pool->blocks = NULL;
- pool->start = NULL;
- pool->ptr = NULL;
- pool->end = NULL;
-}
-
-static void FASTCALL
-poolDestroy(STRING_POOL *pool)
-{
- BLOCK *p = pool->blocks;
- while (p) {
- BLOCK *tem = p->next;
- pool->mem->free_fcn(p);
- p = tem;
- }
- p = pool->freeBlocks;
- while (p) {
- BLOCK *tem = p->next;
- pool->mem->free_fcn(p);
- p = tem;
- }
-}
-
-static XML_Char * FASTCALL
-poolAppend(STRING_POOL *pool, const ENCODING *enc,
- const char *ptr, const char *end)
-{
- if (!pool->ptr && !poolGrow(pool))
- return NULL;
- for (;;) {
- XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end);
- if (ptr == end)
- break;
- if (!poolGrow(pool))
- return NULL;
- }
- return pool->start;
-}
-
-static const XML_Char * FASTCALL
-poolCopyString(STRING_POOL *pool, const XML_Char *s)
-{
- do {
- if (!poolAppendChar(pool, *s))
- return NULL;
- } while (*s++);
- s = pool->start;
- poolFinish(pool);
- return s;
-}
-
-static const XML_Char * FASTCALL
-poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n)
-{
- if (!pool->ptr && !poolGrow(pool))
- return NULL;
- for (; n > 0; --n, s++) {
- if (!poolAppendChar(pool, *s))
- return NULL;
- }
- s = pool->start;
- poolFinish(pool);
- return s;
-}
-
-static const XML_Char * FASTCALL
-poolAppendString(STRING_POOL *pool, const XML_Char *s)
-{
- while (*s) {
- if (!poolAppendChar(pool, *s))
- return NULL;
- s++;
- }
- return pool->start;
-}
-
-static XML_Char * FASTCALL
-poolStoreString(STRING_POOL *pool, const ENCODING *enc,
- const char *ptr, const char *end)
-{
- if (!poolAppend(pool, enc, ptr, end))
- return NULL;
- if (pool->ptr == pool->end && !poolGrow(pool))
- return NULL;
- *(pool->ptr)++ = 0;
- return pool->start;
-}
-
-static XML_Bool FASTCALL
-poolGrow(STRING_POOL *pool)
-{
- if (pool->freeBlocks) {
- if (pool->start == 0) {
- pool->blocks = pool->freeBlocks;
- pool->freeBlocks = pool->freeBlocks->next;
- pool->blocks->next = NULL;
- pool->start = pool->blocks->s;
- pool->end = pool->start + pool->blocks->size;
- pool->ptr = pool->start;
- return XML_TRUE;
- }
- if (pool->end - pool->start < pool->freeBlocks->size) {
- BLOCK *tem = pool->freeBlocks->next;
- pool->freeBlocks->next = pool->blocks;
- pool->blocks = pool->freeBlocks;
- pool->freeBlocks = tem;
- memcpy(pool->blocks->s, pool->start,
- (pool->end - pool->start) * sizeof(XML_Char));
- pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
- pool->start = pool->blocks->s;
- pool->end = pool->start + pool->blocks->size;
- return XML_TRUE;
- }
- }
- if (pool->blocks && pool->start == pool->blocks->s) {
- int blockSize = (pool->end - pool->start)*2;
- pool->blocks = pool->mem->realloc_fcn(pool->blocks,
- offsetof(BLOCK, s)
- + blockSize * sizeof(XML_Char));
- if (pool->blocks == NULL)
- return XML_FALSE;
- pool->blocks->size = blockSize;
- pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
- pool->start = pool->blocks->s;
- pool->end = pool->start + blockSize;
- }
- else {
- BLOCK *tem;
- int blockSize = pool->end - pool->start;
- if (blockSize < INIT_BLOCK_SIZE)
- blockSize = INIT_BLOCK_SIZE;
- else
- blockSize *= 2;
- tem = pool->mem->malloc_fcn(offsetof(BLOCK, s)
- + blockSize * sizeof(XML_Char));
- if (!tem)
- return XML_FALSE;
- tem->size = blockSize;
- tem->next = pool->blocks;
- pool->blocks = tem;
- if (pool->ptr != pool->start)
- memcpy(tem->s, pool->start,
- (pool->ptr - pool->start) * sizeof(XML_Char));
- pool->ptr = tem->s + (pool->ptr - pool->start);
- pool->start = tem->s;
- pool->end = tem->s + blockSize;
- }
- return XML_TRUE;
-}
-
-static int FASTCALL
-nextScaffoldPart(XML_Parser parser)
-{
- CONTENT_SCAFFOLD * me;
- int next;
-
- if (!dtd.scaffIndex) {
- dtd.scaffIndex = MALLOC(groupSize * sizeof(int));
- if (!dtd.scaffIndex)
- return -1;
- dtd.scaffIndex[0] = 0;
- }
-
- if (dtd.scaffCount >= dtd.scaffSize) {
- CONTENT_SCAFFOLD *temp;
- if (dtd.scaffold) {
- temp = (CONTENT_SCAFFOLD *)
- REALLOC(dtd.scaffold, dtd.scaffSize * 2 * sizeof(CONTENT_SCAFFOLD));
- if (temp == NULL)
- return -1;
- dtd.scaffSize *= 2;
- }
- else {
- temp = MALLOC(INIT_SCAFFOLD_ELEMENTS * sizeof(CONTENT_SCAFFOLD));
- if (temp == NULL)
- return -1;
- dtd.scaffSize = INIT_SCAFFOLD_ELEMENTS;
- }
- dtd.scaffold = temp;
- }
- next = dtd.scaffCount++;
- me = &dtd.scaffold[next];
- if (dtd.scaffLevel) {
- CONTENT_SCAFFOLD *parent = &dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel-1]];
- if (parent->lastchild) {
- dtd.scaffold[parent->lastchild].nextsib = next;
- }
- if (!parent->childcnt)
- parent->firstchild = next;
- parent->lastchild = next;
- parent->childcnt++;
- }
- me->firstchild = me->lastchild = me->childcnt = me->nextsib = 0;
- return next;
-}
-
-static void FASTCALL
-build_node(XML_Parser parser,
- int src_node,
- XML_Content *dest,
- XML_Content **contpos,
- XML_Char **strpos)
-{
- dest->type = dtd.scaffold[src_node].type;
- dest->quant = dtd.scaffold[src_node].quant;
- if (dest->type == XML_CTYPE_NAME) {
- const XML_Char *src;
- dest->name = *strpos;
- src = dtd.scaffold[src_node].name;
- for (;;) {
- *(*strpos)++ = *src;
- if (!*src)
- break;
- src++;
- }
- dest->numchildren = 0;
- dest->children = NULL;
- }
- else {
- unsigned int i;
- int cn;
- dest->numchildren = dtd.scaffold[src_node].childcnt;
- dest->children = *contpos;
- *contpos += dest->numchildren;
- for (i = 0, cn = dtd.scaffold[src_node].firstchild;
- i < dest->numchildren;
- i++, cn = dtd.scaffold[cn].nextsib) {
- build_node(parser, cn, &(dest->children[i]), contpos, strpos);
- }
- dest->name = NULL;
- }
-}
-
-static XML_Content * FASTCALL
-build_model (XML_Parser parser)
-{
- XML_Content *ret;
- XML_Content *cpos;
- XML_Char * str;
- int allocsize = (dtd.scaffCount * sizeof(XML_Content)
- + (dtd.contentStringLen * sizeof(XML_Char)));
-
- ret = MALLOC(allocsize);
- if (!ret)
- return NULL;
-
- str = (XML_Char *) (&ret[dtd.scaffCount]);
- cpos = &ret[1];
-
- build_node(parser, 0, ret, &cpos, &str);
- return ret;
-}
-
-static ELEMENT_TYPE * FASTCALL
-getElementType(XML_Parser parser,
- const ENCODING *enc,
- const char *ptr,
- const char *end)
-{
- const XML_Char *name = poolStoreString(&dtd.pool, enc, ptr, end);
- ELEMENT_TYPE *ret;
-
- if (!name)
- return NULL;
- ret = (ELEMENT_TYPE *) lookup(&dtd.elementTypes, name, sizeof(ELEMENT_TYPE));
- if (!ret)
- return NULL;
- if (ret->name != name)
- poolDiscard(&dtd.pool);
- else {
- poolFinish(&dtd.pool);
- if (!setElementTypePrefix(parser, ret))
- return NULL;
- }
- return ret;
-}
diff --git a/bundle/expat/xmlrole.c b/bundle/expat/xmlrole.c
deleted file mode 100644
index d9a2367087..0000000000
--- a/bundle/expat/xmlrole.c
+++ /dev/null
@@ -1,1330 +0,0 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
-*/
-
-#if PHP_WIN32
-#include "config.w32.h"
-#else
-#include "php_config.h"
-#endif
-#include "php_compat.h"
-
-#ifdef COMPILED_FROM_DSP
-#include "winconfig.h"
-#elif defined(MACOS_CLASSIC)
-#include "macconfig.h"
-/*
-#else
-#include <php_config.h>
-*/
-#endif /* ndef COMPILED_FROM_DSP */
-
-#include "internal.h"
-#include "xmlrole.h"
-#include "ascii.h"
-
-/* Doesn't check:
-
- that ,| are not mixed in a model group
- content of literals
-
-*/
-
-static const char KW_ANY[] = {
- ASCII_A, ASCII_N, ASCII_Y, '\0' };
-static const char KW_ATTLIST[] = {
- ASCII_A, ASCII_T, ASCII_T, ASCII_L, ASCII_I, ASCII_S, ASCII_T, '\0' };
-static const char KW_CDATA[] = {
- ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' };
-static const char KW_DOCTYPE[] = {
- ASCII_D, ASCII_O, ASCII_C, ASCII_T, ASCII_Y, ASCII_P, ASCII_E, '\0' };
-static const char KW_ELEMENT[] = {
- ASCII_E, ASCII_L, ASCII_E, ASCII_M, ASCII_E, ASCII_N, ASCII_T, '\0' };
-static const char KW_EMPTY[] = {
- ASCII_E, ASCII_M, ASCII_P, ASCII_T, ASCII_Y, '\0' };
-static const char KW_ENTITIES[] = {
- ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S,
- '\0' };
-static const char KW_ENTITY[] = {
- ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' };
-static const char KW_FIXED[] = {
- ASCII_F, ASCII_I, ASCII_X, ASCII_E, ASCII_D, '\0' };
-static const char KW_ID[] = {
- ASCII_I, ASCII_D, '\0' };
-static const char KW_IDREF[] = {
- ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' };
-static const char KW_IDREFS[] = {
- ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' };
-static const char KW_IGNORE[] = {
- ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' };
-static const char KW_IMPLIED[] = {
- ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' };
-static const char KW_INCLUDE[] = {
- ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' };
-static const char KW_NDATA[] = {
- ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' };
-static const char KW_NMTOKEN[] = {
- ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' };
-static const char KW_NMTOKENS[] = {
- ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S,
- '\0' };
-static const char KW_NOTATION[] =
- { ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N,
- '\0' };
-static const char KW_PCDATA[] = {
- ASCII_P, ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' };
-static const char KW_PUBLIC[] = {
- ASCII_P, ASCII_U, ASCII_B, ASCII_L, ASCII_I, ASCII_C, '\0' };
-static const char KW_REQUIRED[] = {
- ASCII_R, ASCII_E, ASCII_Q, ASCII_U, ASCII_I, ASCII_R, ASCII_E, ASCII_D,
- '\0' };
-static const char KW_SYSTEM[] = {
- ASCII_S, ASCII_Y, ASCII_S, ASCII_T, ASCII_E, ASCII_M, '\0' };
-
-#ifndef MIN_BYTES_PER_CHAR
-#define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar)
-#endif
-
-#ifdef XML_DTD
-#define setTopLevel(state) \
- ((state)->handler = ((state)->documentEntity \
- ? internalSubset \
- : externalSubset1))
-#else /* not XML_DTD */
-#define setTopLevel(state) ((state)->handler = internalSubset)
-#endif /* not XML_DTD */
-
-typedef int FASTCALL PROLOG_HANDLER(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc);
-
-static PROLOG_HANDLER
- prolog0, prolog1, prolog2,
- doctype0, doctype1, doctype2, doctype3, doctype4, doctype5,
- internalSubset,
- entity0, entity1, entity2, entity3, entity4, entity5, entity6,
- entity7, entity8, entity9, entity10,
- notation0, notation1, notation2, notation3, notation4,
- attlist0, attlist1, attlist2, attlist3, attlist4, attlist5, attlist6,
- attlist7, attlist8, attlist9,
- element0, element1, element2, element3, element4, element5, element6,
- element7,
-#ifdef XML_DTD
- externalSubset0, externalSubset1,
- condSect0, condSect1, condSect2,
-#endif /* XML_DTD */
- declClose,
- error;
-
-static int FASTCALL common(PROLOG_STATE *state, int tok);
-
-static int FASTCALL
-prolog0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- state->handler = prolog1;
- return XML_ROLE_NONE;
- case XML_TOK_XML_DECL:
- state->handler = prolog1;
- return XML_ROLE_XML_DECL;
- case XML_TOK_PI:
- state->handler = prolog1;
- return XML_ROLE_PI;
- case XML_TOK_COMMENT:
- state->handler = prolog1;
- return XML_ROLE_COMMENT;
- case XML_TOK_BOM:
- return XML_ROLE_NONE;
- case XML_TOK_DECL_OPEN:
- if (!XmlNameMatchesAscii(enc,
- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
- end,
- KW_DOCTYPE))
- break;
- state->handler = doctype0;
- return XML_ROLE_DOCTYPE_NONE;
- case XML_TOK_INSTANCE_START:
- state->handler = error;
- return XML_ROLE_INSTANCE_START;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-prolog1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_PI:
- return XML_ROLE_PI;
- case XML_TOK_COMMENT:
- return XML_ROLE_COMMENT;
- case XML_TOK_BOM:
- return XML_ROLE_NONE;
- case XML_TOK_DECL_OPEN:
- if (!XmlNameMatchesAscii(enc,
- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
- end,
- KW_DOCTYPE))
- break;
- state->handler = doctype0;
- return XML_ROLE_DOCTYPE_NONE;
- case XML_TOK_INSTANCE_START:
- state->handler = error;
- return XML_ROLE_INSTANCE_START;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-prolog2(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_PI:
- return XML_ROLE_PI;
- case XML_TOK_COMMENT:
- return XML_ROLE_COMMENT;
- case XML_TOK_INSTANCE_START:
- state->handler = error;
- return XML_ROLE_INSTANCE_START;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-doctype0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_DOCTYPE_NONE;
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = doctype1;
- return XML_ROLE_DOCTYPE_NAME;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-doctype1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_DOCTYPE_NONE;
- case XML_TOK_OPEN_BRACKET:
- state->handler = internalSubset;
- return XML_ROLE_DOCTYPE_INTERNAL_SUBSET;
- case XML_TOK_DECL_CLOSE:
- state->handler = prolog2;
- return XML_ROLE_DOCTYPE_CLOSE;
- case XML_TOK_NAME:
- if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {
- state->handler = doctype3;
- return XML_ROLE_DOCTYPE_NONE;
- }
- if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {
- state->handler = doctype2;
- return XML_ROLE_DOCTYPE_NONE;
- }
- break;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-doctype2(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_DOCTYPE_NONE;
- case XML_TOK_LITERAL:
- state->handler = doctype3;
- return XML_ROLE_DOCTYPE_PUBLIC_ID;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-doctype3(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_DOCTYPE_NONE;
- case XML_TOK_LITERAL:
- state->handler = doctype4;
- return XML_ROLE_DOCTYPE_SYSTEM_ID;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-doctype4(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_DOCTYPE_NONE;
- case XML_TOK_OPEN_BRACKET:
- state->handler = internalSubset;
- return XML_ROLE_DOCTYPE_INTERNAL_SUBSET;
- case XML_TOK_DECL_CLOSE:
- state->handler = prolog2;
- return XML_ROLE_DOCTYPE_CLOSE;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-doctype5(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_DOCTYPE_NONE;
- case XML_TOK_DECL_CLOSE:
- state->handler = prolog2;
- return XML_ROLE_DOCTYPE_CLOSE;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-internalSubset(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_DECL_OPEN:
- if (XmlNameMatchesAscii(enc,
- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
- end,
- KW_ENTITY)) {
- state->handler = entity0;
- return XML_ROLE_ENTITY_NONE;
- }
- if (XmlNameMatchesAscii(enc,
- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
- end,
- KW_ATTLIST)) {
- state->handler = attlist0;
- return XML_ROLE_ATTLIST_NONE;
- }
- if (XmlNameMatchesAscii(enc,
- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
- end,
- KW_ELEMENT)) {
- state->handler = element0;
- return XML_ROLE_ELEMENT_NONE;
- }
- if (XmlNameMatchesAscii(enc,
- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
- end,
- KW_NOTATION)) {
- state->handler = notation0;
- return XML_ROLE_NOTATION_NONE;
- }
- break;
- case XML_TOK_PI:
- return XML_ROLE_PI;
- case XML_TOK_COMMENT:
- return XML_ROLE_COMMENT;
- case XML_TOK_PARAM_ENTITY_REF:
- return XML_ROLE_PARAM_ENTITY_REF;
- case XML_TOK_CLOSE_BRACKET:
- state->handler = doctype5;
- return XML_ROLE_DOCTYPE_NONE;
- }
- return common(state, tok);
-}
-
-#ifdef XML_DTD
-
-static int FASTCALL
-externalSubset0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- state->handler = externalSubset1;
- if (tok == XML_TOK_XML_DECL)
- return XML_ROLE_TEXT_DECL;
- return externalSubset1(state, tok, ptr, end, enc);
-}
-
-static int FASTCALL
-externalSubset1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_COND_SECT_OPEN:
- state->handler = condSect0;
- return XML_ROLE_NONE;
- case XML_TOK_COND_SECT_CLOSE:
- if (state->includeLevel == 0)
- break;
- state->includeLevel -= 1;
- return XML_ROLE_NONE;
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_CLOSE_BRACKET:
- break;
- case XML_TOK_NONE:
- if (state->includeLevel)
- break;
- return XML_ROLE_NONE;
- default:
- return internalSubset(state, tok, ptr, end, enc);
- }
- return common(state, tok);
-}
-
-#endif /* XML_DTD */
-
-static int FASTCALL
-entity0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ENTITY_NONE;
- case XML_TOK_PERCENT:
- state->handler = entity1;
- return XML_ROLE_ENTITY_NONE;
- case XML_TOK_NAME:
- state->handler = entity2;
- return XML_ROLE_GENERAL_ENTITY_NAME;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-entity1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ENTITY_NONE;
- case XML_TOK_NAME:
- state->handler = entity7;
- return XML_ROLE_PARAM_ENTITY_NAME;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-entity2(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ENTITY_NONE;
- case XML_TOK_NAME:
- if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {
- state->handler = entity4;
- return XML_ROLE_ENTITY_NONE;
- }
- if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {
- state->handler = entity3;
- return XML_ROLE_ENTITY_NONE;
- }
- break;
- case XML_TOK_LITERAL:
- state->handler = declClose;
- state->role_none = XML_ROLE_ENTITY_NONE;
- return XML_ROLE_ENTITY_VALUE;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-entity3(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ENTITY_NONE;
- case XML_TOK_LITERAL:
- state->handler = entity4;
- return XML_ROLE_ENTITY_PUBLIC_ID;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-entity4(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ENTITY_NONE;
- case XML_TOK_LITERAL:
- state->handler = entity5;
- return XML_ROLE_ENTITY_SYSTEM_ID;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-entity5(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ENTITY_NONE;
- case XML_TOK_DECL_CLOSE:
- setTopLevel(state);
- return XML_ROLE_ENTITY_COMPLETE;
- case XML_TOK_NAME:
- if (XmlNameMatchesAscii(enc, ptr, end, KW_NDATA)) {
- state->handler = entity6;
- return XML_ROLE_ENTITY_NONE;
- }
- break;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-entity6(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ENTITY_NONE;
- case XML_TOK_NAME:
- state->handler = declClose;
- state->role_none = XML_ROLE_ENTITY_NONE;
- return XML_ROLE_ENTITY_NOTATION_NAME;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-entity7(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ENTITY_NONE;
- case XML_TOK_NAME:
- if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {
- state->handler = entity9;
- return XML_ROLE_ENTITY_NONE;
- }
- if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {
- state->handler = entity8;
- return XML_ROLE_ENTITY_NONE;
- }
- break;
- case XML_TOK_LITERAL:
- state->handler = declClose;
- state->role_none = XML_ROLE_ENTITY_NONE;
- return XML_ROLE_ENTITY_VALUE;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-entity8(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ENTITY_NONE;
- case XML_TOK_LITERAL:
- state->handler = entity9;
- return XML_ROLE_ENTITY_PUBLIC_ID;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-entity9(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ENTITY_NONE;
- case XML_TOK_LITERAL:
- state->handler = entity10;
- return XML_ROLE_ENTITY_SYSTEM_ID;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-entity10(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ENTITY_NONE;
- case XML_TOK_DECL_CLOSE:
- setTopLevel(state);
- return XML_ROLE_ENTITY_COMPLETE;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-notation0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NOTATION_NONE;
- case XML_TOK_NAME:
- state->handler = notation1;
- return XML_ROLE_NOTATION_NAME;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-notation1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NOTATION_NONE;
- case XML_TOK_NAME:
- if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {
- state->handler = notation3;
- return XML_ROLE_NOTATION_NONE;
- }
- if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {
- state->handler = notation2;
- return XML_ROLE_NOTATION_NONE;
- }
- break;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-notation2(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NOTATION_NONE;
- case XML_TOK_LITERAL:
- state->handler = notation4;
- return XML_ROLE_NOTATION_PUBLIC_ID;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-notation3(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NOTATION_NONE;
- case XML_TOK_LITERAL:
- state->handler = declClose;
- state->role_none = XML_ROLE_NOTATION_NONE;
- return XML_ROLE_NOTATION_SYSTEM_ID;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-notation4(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NOTATION_NONE;
- case XML_TOK_LITERAL:
- state->handler = declClose;
- state->role_none = XML_ROLE_NOTATION_NONE;
- return XML_ROLE_NOTATION_SYSTEM_ID;
- case XML_TOK_DECL_CLOSE:
- setTopLevel(state);
- return XML_ROLE_NOTATION_NO_SYSTEM_ID;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-attlist0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ATTLIST_NONE;
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = attlist1;
- return XML_ROLE_ATTLIST_ELEMENT_NAME;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-attlist1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ATTLIST_NONE;
- case XML_TOK_DECL_CLOSE:
- setTopLevel(state);
- return XML_ROLE_ATTLIST_NONE;
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = attlist2;
- return XML_ROLE_ATTRIBUTE_NAME;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-attlist2(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ATTLIST_NONE;
- case XML_TOK_NAME:
- {
- static const char *types[] = {
- KW_CDATA,
- KW_ID,
- KW_IDREF,
- KW_IDREFS,
- KW_ENTITY,
- KW_ENTITIES,
- KW_NMTOKEN,
- KW_NMTOKENS,
- };
- int i;
- for (i = 0; i < (int)(sizeof(types)/sizeof(types[0])); i++)
- if (XmlNameMatchesAscii(enc, ptr, end, types[i])) {
- state->handler = attlist8;
- return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i;
- }
- }
- if (XmlNameMatchesAscii(enc, ptr, end, KW_NOTATION)) {
- state->handler = attlist5;
- return XML_ROLE_ATTLIST_NONE;
- }
- break;
- case XML_TOK_OPEN_PAREN:
- state->handler = attlist3;
- return XML_ROLE_ATTLIST_NONE;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-attlist3(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ATTLIST_NONE;
- case XML_TOK_NMTOKEN:
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = attlist4;
- return XML_ROLE_ATTRIBUTE_ENUM_VALUE;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-attlist4(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ATTLIST_NONE;
- case XML_TOK_CLOSE_PAREN:
- state->handler = attlist8;
- return XML_ROLE_ATTLIST_NONE;
- case XML_TOK_OR:
- state->handler = attlist3;
- return XML_ROLE_ATTLIST_NONE;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-attlist5(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ATTLIST_NONE;
- case XML_TOK_OPEN_PAREN:
- state->handler = attlist6;
- return XML_ROLE_ATTLIST_NONE;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-attlist6(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ATTLIST_NONE;
- case XML_TOK_NAME:
- state->handler = attlist7;
- return XML_ROLE_ATTRIBUTE_NOTATION_VALUE;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-attlist7(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ATTLIST_NONE;
- case XML_TOK_CLOSE_PAREN:
- state->handler = attlist8;
- return XML_ROLE_ATTLIST_NONE;
- case XML_TOK_OR:
- state->handler = attlist6;
- return XML_ROLE_ATTLIST_NONE;
- }
- return common(state, tok);
-}
-
-/* default value */
-static int FASTCALL
-attlist8(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ATTLIST_NONE;
- case XML_TOK_POUND_NAME:
- if (XmlNameMatchesAscii(enc,
- ptr + MIN_BYTES_PER_CHAR(enc),
- end,
- KW_IMPLIED)) {
- state->handler = attlist1;
- return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE;
- }
- if (XmlNameMatchesAscii(enc,
- ptr + MIN_BYTES_PER_CHAR(enc),
- end,
- KW_REQUIRED)) {
- state->handler = attlist1;
- return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE;
- }
- if (XmlNameMatchesAscii(enc,
- ptr + MIN_BYTES_PER_CHAR(enc),
- end,
- KW_FIXED)) {
- state->handler = attlist9;
- return XML_ROLE_ATTLIST_NONE;
- }
- break;
- case XML_TOK_LITERAL:
- state->handler = attlist1;
- return XML_ROLE_DEFAULT_ATTRIBUTE_VALUE;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-attlist9(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ATTLIST_NONE;
- case XML_TOK_LITERAL:
- state->handler = attlist1;
- return XML_ROLE_FIXED_ATTRIBUTE_VALUE;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-element0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ELEMENT_NONE;
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = element1;
- return XML_ROLE_ELEMENT_NAME;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-element1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ELEMENT_NONE;
- case XML_TOK_NAME:
- if (XmlNameMatchesAscii(enc, ptr, end, KW_EMPTY)) {
- state->handler = declClose;
- state->role_none = XML_ROLE_ELEMENT_NONE;
- return XML_ROLE_CONTENT_EMPTY;
- }
- if (XmlNameMatchesAscii(enc, ptr, end, KW_ANY)) {
- state->handler = declClose;
- state->role_none = XML_ROLE_ELEMENT_NONE;
- return XML_ROLE_CONTENT_ANY;
- }
- break;
- case XML_TOK_OPEN_PAREN:
- state->handler = element2;
- state->level = 1;
- return XML_ROLE_GROUP_OPEN;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-element2(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ELEMENT_NONE;
- case XML_TOK_POUND_NAME:
- if (XmlNameMatchesAscii(enc,
- ptr + MIN_BYTES_PER_CHAR(enc),
- end,
- KW_PCDATA)) {
- state->handler = element3;
- return XML_ROLE_CONTENT_PCDATA;
- }
- break;
- case XML_TOK_OPEN_PAREN:
- state->level = 2;
- state->handler = element6;
- return XML_ROLE_GROUP_OPEN;
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT;
- case XML_TOK_NAME_QUESTION:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT_OPT;
- case XML_TOK_NAME_ASTERISK:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT_REP;
- case XML_TOK_NAME_PLUS:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT_PLUS;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-element3(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ELEMENT_NONE;
- case XML_TOK_CLOSE_PAREN:
- state->handler = declClose;
- state->role_none = XML_ROLE_ELEMENT_NONE;
- return XML_ROLE_GROUP_CLOSE;
- case XML_TOK_CLOSE_PAREN_ASTERISK:
- state->handler = declClose;
- state->role_none = XML_ROLE_ELEMENT_NONE;
- return XML_ROLE_GROUP_CLOSE_REP;
- case XML_TOK_OR:
- state->handler = element4;
- return XML_ROLE_ELEMENT_NONE;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-element4(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ELEMENT_NONE;
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = element5;
- return XML_ROLE_CONTENT_ELEMENT;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-element5(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ELEMENT_NONE;
- case XML_TOK_CLOSE_PAREN_ASTERISK:
- state->handler = declClose;
- state->role_none = XML_ROLE_ELEMENT_NONE;
- return XML_ROLE_GROUP_CLOSE_REP;
- case XML_TOK_OR:
- state->handler = element4;
- return XML_ROLE_ELEMENT_NONE;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-element6(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ELEMENT_NONE;
- case XML_TOK_OPEN_PAREN:
- state->level += 1;
- return XML_ROLE_GROUP_OPEN;
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT;
- case XML_TOK_NAME_QUESTION:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT_OPT;
- case XML_TOK_NAME_ASTERISK:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT_REP;
- case XML_TOK_NAME_PLUS:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT_PLUS;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-element7(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_ELEMENT_NONE;
- case XML_TOK_CLOSE_PAREN:
- state->level -= 1;
- if (state->level == 0) {
- state->handler = declClose;
- state->role_none = XML_ROLE_ELEMENT_NONE;
- }
- return XML_ROLE_GROUP_CLOSE;
- case XML_TOK_CLOSE_PAREN_ASTERISK:
- state->level -= 1;
- if (state->level == 0) {
- state->handler = declClose;
- state->role_none = XML_ROLE_ELEMENT_NONE;
- }
- return XML_ROLE_GROUP_CLOSE_REP;
- case XML_TOK_CLOSE_PAREN_QUESTION:
- state->level -= 1;
- if (state->level == 0) {
- state->handler = declClose;
- state->role_none = XML_ROLE_ELEMENT_NONE;
- }
- return XML_ROLE_GROUP_CLOSE_OPT;
- case XML_TOK_CLOSE_PAREN_PLUS:
- state->level -= 1;
- if (state->level == 0) {
- state->handler = declClose;
- state->role_none = XML_ROLE_ELEMENT_NONE;
- }
- return XML_ROLE_GROUP_CLOSE_PLUS;
- case XML_TOK_COMMA:
- state->handler = element6;
- return XML_ROLE_GROUP_SEQUENCE;
- case XML_TOK_OR:
- state->handler = element6;
- return XML_ROLE_GROUP_CHOICE;
- }
- return common(state, tok);
-}
-
-#ifdef XML_DTD
-
-static int FASTCALL
-condSect0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- if (XmlNameMatchesAscii(enc, ptr, end, KW_INCLUDE)) {
- state->handler = condSect1;
- return XML_ROLE_NONE;
- }
- if (XmlNameMatchesAscii(enc, ptr, end, KW_IGNORE)) {
- state->handler = condSect2;
- return XML_ROLE_NONE;
- }
- break;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-condSect1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_OPEN_BRACKET:
- state->handler = externalSubset1;
- state->includeLevel += 1;
- return XML_ROLE_NONE;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-condSect2(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_OPEN_BRACKET:
- state->handler = externalSubset1;
- return XML_ROLE_IGNORE_SECT;
- }
- return common(state, tok);
-}
-
-#endif /* XML_DTD */
-
-static int FASTCALL
-declClose(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return state->role_none;
- case XML_TOK_DECL_CLOSE:
- setTopLevel(state);
- return state->role_none;
- }
- return common(state, tok);
-}
-
-static int FASTCALL
-error(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- return XML_ROLE_NONE;
-}
-
-static int FASTCALL
-common(PROLOG_STATE *state, int tok)
-{
-#ifdef XML_DTD
- if (!state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF)
- return XML_ROLE_INNER_PARAM_ENTITY_REF;
-#endif
- state->handler = error;
- return XML_ROLE_ERROR;
-}
-
-void
-XmlPrologStateInit(PROLOG_STATE *state)
-{
- state->handler = prolog0;
-#ifdef XML_DTD
- state->documentEntity = 1;
- state->includeLevel = 0;
- state->inEntityValue = 0;
-#endif /* XML_DTD */
-}
-
-#ifdef XML_DTD
-
-void
-XmlPrologStateInitExternalEntity(PROLOG_STATE *state)
-{
- state->handler = externalSubset0;
- state->documentEntity = 0;
- state->includeLevel = 0;
-}
-
-#endif /* XML_DTD */
diff --git a/bundle/expat/xmlrole.h b/bundle/expat/xmlrole.h
deleted file mode 100644
index 281aba0481..0000000000
--- a/bundle/expat/xmlrole.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
-*/
-
-#ifndef XmlRole_INCLUDED
-#define XmlRole_INCLUDED 1
-
-#ifdef __VMS
-/* 0 1 2 3 0 1 2 3
- 1234567890123456789012345678901 1234567890123456789012345678901 */
-#define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt
-#endif
-
-#include "xmltok.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum {
- XML_ROLE_ERROR = -1,
- XML_ROLE_NONE = 0,
- XML_ROLE_XML_DECL,
- XML_ROLE_INSTANCE_START,
- XML_ROLE_DOCTYPE_NONE,
- XML_ROLE_DOCTYPE_NAME,
- XML_ROLE_DOCTYPE_SYSTEM_ID,
- XML_ROLE_DOCTYPE_PUBLIC_ID,
- XML_ROLE_DOCTYPE_INTERNAL_SUBSET,
- XML_ROLE_DOCTYPE_CLOSE,
- XML_ROLE_GENERAL_ENTITY_NAME,
- XML_ROLE_PARAM_ENTITY_NAME,
- XML_ROLE_ENTITY_NONE,
- XML_ROLE_ENTITY_VALUE,
- XML_ROLE_ENTITY_SYSTEM_ID,
- XML_ROLE_ENTITY_PUBLIC_ID,
- XML_ROLE_ENTITY_COMPLETE,
- XML_ROLE_ENTITY_NOTATION_NAME,
- XML_ROLE_NOTATION_NONE,
- XML_ROLE_NOTATION_NAME,
- XML_ROLE_NOTATION_SYSTEM_ID,
- XML_ROLE_NOTATION_NO_SYSTEM_ID,
- XML_ROLE_NOTATION_PUBLIC_ID,
- XML_ROLE_ATTRIBUTE_NAME,
- XML_ROLE_ATTRIBUTE_TYPE_CDATA,
- XML_ROLE_ATTRIBUTE_TYPE_ID,
- XML_ROLE_ATTRIBUTE_TYPE_IDREF,
- XML_ROLE_ATTRIBUTE_TYPE_IDREFS,
- XML_ROLE_ATTRIBUTE_TYPE_ENTITY,
- XML_ROLE_ATTRIBUTE_TYPE_ENTITIES,
- XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN,
- XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS,
- XML_ROLE_ATTRIBUTE_ENUM_VALUE,
- XML_ROLE_ATTRIBUTE_NOTATION_VALUE,
- XML_ROLE_ATTLIST_NONE,
- XML_ROLE_ATTLIST_ELEMENT_NAME,
- XML_ROLE_IMPLIED_ATTRIBUTE_VALUE,
- XML_ROLE_REQUIRED_ATTRIBUTE_VALUE,
- XML_ROLE_DEFAULT_ATTRIBUTE_VALUE,
- XML_ROLE_FIXED_ATTRIBUTE_VALUE,
- XML_ROLE_ELEMENT_NONE,
- XML_ROLE_ELEMENT_NAME,
- XML_ROLE_CONTENT_ANY,
- XML_ROLE_CONTENT_EMPTY,
- XML_ROLE_CONTENT_PCDATA,
- XML_ROLE_GROUP_OPEN,
- XML_ROLE_GROUP_CLOSE,
- XML_ROLE_GROUP_CLOSE_REP,
- XML_ROLE_GROUP_CLOSE_OPT,
- XML_ROLE_GROUP_CLOSE_PLUS,
- XML_ROLE_GROUP_CHOICE,
- XML_ROLE_GROUP_SEQUENCE,
- XML_ROLE_CONTENT_ELEMENT,
- XML_ROLE_CONTENT_ELEMENT_REP,
- XML_ROLE_CONTENT_ELEMENT_OPT,
- XML_ROLE_CONTENT_ELEMENT_PLUS,
- XML_ROLE_PI,
- XML_ROLE_COMMENT,
-#ifdef XML_DTD
- XML_ROLE_TEXT_DECL,
- XML_ROLE_IGNORE_SECT,
- XML_ROLE_INNER_PARAM_ENTITY_REF,
-#endif /* XML_DTD */
- XML_ROLE_PARAM_ENTITY_REF
-};
-
-typedef struct prolog_state {
- int (FASTCALL *handler) (struct prolog_state *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc);
- unsigned level;
- int role_none;
-#ifdef XML_DTD
- unsigned includeLevel;
- int documentEntity;
- int inEntityValue;
-#endif /* XML_DTD */
-} PROLOG_STATE;
-
-void XmlPrologStateInit(PROLOG_STATE *);
-#ifdef XML_DTD
-void XmlPrologStateInitExternalEntity(PROLOG_STATE *);
-#endif /* XML_DTD */
-
-#define XmlTokenRole(state, tok, ptr, end, enc) \
- (((state)->handler)(state, tok, ptr, end, enc))
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* not XmlRole_INCLUDED */
diff --git a/bundle/expat/xmltok.c b/bundle/expat/xmltok.c
deleted file mode 100644
index 0a11e56748..0000000000
--- a/bundle/expat/xmltok.c
+++ /dev/null
@@ -1,1641 +0,0 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
-*/
-
-#if PHP_WIN32
-#include "config.w32.h"
-#else
-#include "php_config.h"
-#endif
-#include "php_compat.h"
-
-#ifdef COMPILED_FROM_DSP
-#include "winconfig.h"
-#elif defined(MACOS_CLASSIC)
-#include "macconfig.h"
-/*
-#else
-#include <php_config.h>
-*/
-#endif /* ndef COMPILED_FROM_DSP */
-
-#include "internal.h"
-#include "xmltok.h"
-#include "nametab.h"
-
-#ifdef XML_DTD
-#define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok)
-#else
-#define IGNORE_SECTION_TOK_VTABLE /* as nothing */
-#endif
-
-#define VTABLE1 \
- { PREFIX(prologTok), PREFIX(contentTok), \
- PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE }, \
- { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \
- PREFIX(sameName), \
- PREFIX(nameMatchesAscii), \
- PREFIX(nameLength), \
- PREFIX(skipS), \
- PREFIX(getAtts), \
- PREFIX(charRefNumber), \
- PREFIX(predefinedEntityName), \
- PREFIX(updatePosition), \
- PREFIX(isPublicId)
-
-#define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16)
-
-#define UCS2_GET_NAMING(pages, hi, lo) \
- (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F)))
-
-/* A 2 byte UTF-8 representation splits the characters 11 bits between
- the bottom 5 and 6 bits of the bytes. We need 8 bits to index into
- pages, 3 bits to add to that index and 5 bits to generate the mask.
-*/
-#define UTF8_GET_NAMING2(pages, byte) \
- (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \
- + ((((byte)[0]) & 3) << 1) \
- + ((((byte)[1]) >> 5) & 1)] \
- & (1 << (((byte)[1]) & 0x1F)))
-
-/* A 3 byte UTF-8 representation splits the characters 16 bits between
- the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index
- into pages, 3 bits to add to that index and 5 bits to generate the
- mask.
-*/
-#define UTF8_GET_NAMING3(pages, byte) \
- (namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \
- + ((((byte)[1]) >> 2) & 0xF)] \
- << 3) \
- + ((((byte)[1]) & 3) << 1) \
- + ((((byte)[2]) >> 5) & 1)] \
- & (1 << (((byte)[2]) & 0x1F)))
-
-#define UTF8_GET_NAMING(pages, p, n) \
- ((n) == 2 \
- ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \
- : ((n) == 3 \
- ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \
- : 0))
-
-/* Detection of invalid UTF-8 sequences is based on Table 3.1B
- of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/
- with the additional restriction of not allowing the Unicode
- code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE).
- Implementation details:
- (A & 0x80) == 0 means A < 0x80
- and
- (A & 0xC0) == 0xC0 means A > 0xBF
-*/
-
-#define UTF8_INVALID2(p) \
- ((*p) < 0xC2 || ((p)[1] & 0x80) == 0 || ((p)[1] & 0xC0) == 0xC0)
-
-#define UTF8_INVALID3(p) \
- (((p)[2] & 0x80) == 0 \
- || \
- ((*p) == 0xEF && (p)[1] == 0xBF \
- ? \
- (p)[2] > 0xBD \
- : \
- ((p)[2] & 0xC0) == 0xC0) \
- || \
- ((*p) == 0xE0 \
- ? \
- (p)[1] < 0xA0 || ((p)[1] & 0xC0) == 0xC0 \
- : \
- ((p)[1] & 0x80) == 0 \
- || \
- ((*p) == 0xED ? (p)[1] > 0x9F : ((p)[1] & 0xC0) == 0xC0)))
-
-#define UTF8_INVALID4(p) \
- (((p)[3] & 0x80) == 0 || ((p)[3] & 0xC0) == 0xC0 \
- || \
- ((p)[2] & 0x80) == 0 || ((p)[2] & 0xC0) == 0xC0 \
- || \
- ((*p) == 0xF0 \
- ? \
- (p)[1] < 0x90 || ((p)[1] & 0xC0) == 0xC0 \
- : \
- ((p)[1] & 0x80) == 0 \
- || \
- ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0)))
-
-static int FASTCALL
-isNever(const ENCODING *enc, const char *p)
-{
- return 0;
-}
-
-static int FASTCALL
-utf8_isName2(const ENCODING *enc, const char *p)
-{
- return UTF8_GET_NAMING2(namePages, (const unsigned char *)p);
-}
-
-static int FASTCALL
-utf8_isName3(const ENCODING *enc, const char *p)
-{
- return UTF8_GET_NAMING3(namePages, (const unsigned char *)p);
-}
-
-#define utf8_isName4 isNever
-
-static int FASTCALL
-utf8_isNmstrt2(const ENCODING *enc, const char *p)
-{
- return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p);
-}
-
-static int FASTCALL
-utf8_isNmstrt3(const ENCODING *enc, const char *p)
-{
- return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p);
-}
-
-#define utf8_isNmstrt4 isNever
-
-static int FASTCALL
-utf8_isInvalid2(const ENCODING *enc, const char *p)
-{
- return UTF8_INVALID2((const unsigned char *)p);
-}
-
-static int FASTCALL
-utf8_isInvalid3(const ENCODING *enc, const char *p)
-{
- return UTF8_INVALID3((const unsigned char *)p);
-}
-
-static int FASTCALL
-utf8_isInvalid4(const ENCODING *enc, const char *p)
-{
- return UTF8_INVALID4((const unsigned char *)p);
-}
-
-struct normal_encoding {
- ENCODING enc;
- unsigned char type[256];
-#ifdef XML_MIN_SIZE
- int (FASTCALL *byteType)(const ENCODING *, const char *);
- int (FASTCALL *isNameMin)(const ENCODING *, const char *);
- int (FASTCALL *isNmstrtMin)(const ENCODING *, const char *);
- int (FASTCALL *byteToAscii)(const ENCODING *, const char *);
- int (FASTCALL *charMatches)(const ENCODING *, const char *, int);
-#endif /* XML_MIN_SIZE */
- int (FASTCALL *isName2)(const ENCODING *, const char *);
- int (FASTCALL *isName3)(const ENCODING *, const char *);
- int (FASTCALL *isName4)(const ENCODING *, const char *);
- int (FASTCALL *isNmstrt2)(const ENCODING *, const char *);
- int (FASTCALL *isNmstrt3)(const ENCODING *, const char *);
- int (FASTCALL *isNmstrt4)(const ENCODING *, const char *);
- int (FASTCALL *isInvalid2)(const ENCODING *, const char *);
- int (FASTCALL *isInvalid3)(const ENCODING *, const char *);
- int (FASTCALL *isInvalid4)(const ENCODING *, const char *);
-};
-
-#define AS_NORMAL_ENCODING(enc) ((const struct normal_encoding *) (enc))
-
-#ifdef XML_MIN_SIZE
-
-#define STANDARD_VTABLE(E) \
- E ## byteType, \
- E ## isNameMin, \
- E ## isNmstrtMin, \
- E ## byteToAscii, \
- E ## charMatches,
-
-#else
-
-#define STANDARD_VTABLE(E) /* as nothing */
-
-#endif
-
-#define NORMAL_VTABLE(E) \
- E ## isName2, \
- E ## isName3, \
- E ## isName4, \
- E ## isNmstrt2, \
- E ## isNmstrt3, \
- E ## isNmstrt4, \
- E ## isInvalid2, \
- E ## isInvalid3, \
- E ## isInvalid4
-
-static int FASTCALL checkCharRefNumber(int);
-
-#include "xmltok_impl.h"
-#include "ascii.h"
-
-#ifdef XML_MIN_SIZE
-#define sb_isNameMin isNever
-#define sb_isNmstrtMin isNever
-#endif
-
-#ifdef XML_MIN_SIZE
-#define MINBPC(enc) ((enc)->minBytesPerChar)
-#else
-/* minimum bytes per character */
-#define MINBPC(enc) 1
-#endif
-
-#define SB_BYTE_TYPE(enc, p) \
- (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)])
-
-#ifdef XML_MIN_SIZE
-static int FASTCALL
-sb_byteType(const ENCODING *enc, const char *p)
-{
- return SB_BYTE_TYPE(enc, p);
-}
-#define BYTE_TYPE(enc, p) \
- (AS_NORMAL_ENCODING(enc)->byteType(enc, p))
-#else
-#define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p)
-#endif
-
-#ifdef XML_MIN_SIZE
-#define BYTE_TO_ASCII(enc, p) \
- (AS_NORMAL_ENCODING(enc)->byteToAscii(enc, p))
-static int FASTCALL
-sb_byteToAscii(const ENCODING *enc, const char *p)
-{
- return *p;
-}
-#else
-#define BYTE_TO_ASCII(enc, p) (*(p))
-#endif
-
-#define IS_NAME_CHAR(enc, p, n) \
- (AS_NORMAL_ENCODING(enc)->isName ## n(enc, p))
-#define IS_NMSTRT_CHAR(enc, p, n) \
- (AS_NORMAL_ENCODING(enc)->isNmstrt ## n(enc, p))
-#define IS_INVALID_CHAR(enc, p, n) \
- (AS_NORMAL_ENCODING(enc)->isInvalid ## n(enc, p))
-
-#ifdef XML_MIN_SIZE
-#define IS_NAME_CHAR_MINBPC(enc, p) \
- (AS_NORMAL_ENCODING(enc)->isNameMin(enc, p))
-#define IS_NMSTRT_CHAR_MINBPC(enc, p) \
- (AS_NORMAL_ENCODING(enc)->isNmstrtMin(enc, p))
-#else
-#define IS_NAME_CHAR_MINBPC(enc, p) (0)
-#define IS_NMSTRT_CHAR_MINBPC(enc, p) (0)
-#endif
-
-#ifdef XML_MIN_SIZE
-#define CHAR_MATCHES(enc, p, c) \
- (AS_NORMAL_ENCODING(enc)->charMatches(enc, p, c))
-static int FASTCALL
-sb_charMatches(const ENCODING *enc, const char *p, int c)
-{
- return *p == c;
-}
-#else
-/* c is an ASCII character */
-#define CHAR_MATCHES(enc, p, c) (*(p) == c)
-#endif
-
-#define PREFIX(ident) normal_ ## ident
-#include "xmltok_impl.c"
-
-#undef MINBPC
-#undef BYTE_TYPE
-#undef BYTE_TO_ASCII
-#undef CHAR_MATCHES
-#undef IS_NAME_CHAR
-#undef IS_NAME_CHAR_MINBPC
-#undef IS_NMSTRT_CHAR
-#undef IS_NMSTRT_CHAR_MINBPC
-#undef IS_INVALID_CHAR
-
-enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */
- UTF8_cval1 = 0x00,
- UTF8_cval2 = 0xc0,
- UTF8_cval3 = 0xe0,
- UTF8_cval4 = 0xf0
-};
-
-static void FASTCALL
-utf8_toUtf8(const ENCODING *enc,
- const char **fromP, const char *fromLim,
- char **toP, const char *toLim)
-{
- char *to;
- const char *from;
- if (fromLim - *fromP > toLim - *toP) {
- /* Avoid copying partial characters. */
- for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--)
- if (((unsigned char)fromLim[-1] & 0xc0) != 0x80)
- break;
- }
- for (to = *toP, from = *fromP; from != fromLim; from++, to++)
- *to = *from;
- *fromP = from;
- *toP = to;
-}
-
-static void FASTCALL
-utf8_toUtf16(const ENCODING *enc,
- const char **fromP, const char *fromLim,
- unsigned short **toP, const unsigned short *toLim)
-{
- unsigned short *to = *toP;
- const char *from = *fromP;
- while (from != fromLim && to != toLim) {
- switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) {
- case BT_LEAD2:
- *to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f));
- from += 2;
- break;
- case BT_LEAD3:
- *to++ = (unsigned short)(((from[0] & 0xf) << 12)
- | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f));
- from += 3;
- break;
- case BT_LEAD4:
- {
- unsigned long n;
- if (to + 1 == toLim)
- goto after;
- n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12)
- | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f);
- n -= 0x10000;
- to[0] = (unsigned short)((n >> 10) | 0xD800);
- to[1] = (unsigned short)((n & 0x3FF) | 0xDC00);
- to += 2;
- from += 4;
- }
- break;
- default:
- *to++ = *from++;
- break;
- }
- }
-after:
- *fromP = from;
- *toP = to;
-}
-
-#ifdef XML_NS
-static const struct normal_encoding utf8_encoding_ns = {
- { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
- {
-#include "asciitab.h"
-#include "utf8tab.h"
- },
- STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
-};
-#endif
-
-static const struct normal_encoding utf8_encoding = {
- { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
- {
-#define BT_COLON BT_NMSTRT
-#include "asciitab.h"
-#undef BT_COLON
-#include "utf8tab.h"
- },
- STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
-};
-
-#ifdef XML_NS
-
-static const struct normal_encoding internal_utf8_encoding_ns = {
- { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
- {
-#include "iasciitab.h"
-#include "utf8tab.h"
- },
- STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
-};
-
-#endif
-
-static const struct normal_encoding internal_utf8_encoding = {
- { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
- {
-#define BT_COLON BT_NMSTRT
-#include "iasciitab.h"
-#undef BT_COLON
-#include "utf8tab.h"
- },
- STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
-};
-
-static void FASTCALL
-latin1_toUtf8(const ENCODING *enc,
- const char **fromP, const char *fromLim,
- char **toP, const char *toLim)
-{
- for (;;) {
- unsigned char c;
- if (*fromP == fromLim)
- break;
- c = (unsigned char)**fromP;
- if (c & 0x80) {
- if (toLim - *toP < 2)
- break;
- *(*toP)++ = (char)((c >> 6) | UTF8_cval2);
- *(*toP)++ = (char)((c & 0x3f) | 0x80);
- (*fromP)++;
- }
- else {
- if (*toP == toLim)
- break;
- *(*toP)++ = *(*fromP)++;
- }
- }
-}
-
-static void FASTCALL
-latin1_toUtf16(const ENCODING *enc,
- const char **fromP, const char *fromLim,
- unsigned short **toP, const unsigned short *toLim)
-{
- while (*fromP != fromLim && *toP != toLim)
- *(*toP)++ = (unsigned char)*(*fromP)++;
-}
-
-#ifdef XML_NS
-
-static const struct normal_encoding latin1_encoding_ns = {
- { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 },
- {
-#include "asciitab.h"
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(sb_)
-};
-
-#endif
-
-static const struct normal_encoding latin1_encoding = {
- { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 },
- {
-#define BT_COLON BT_NMSTRT
-#include "asciitab.h"
-#undef BT_COLON
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(sb_)
-};
-
-static void FASTCALL
-ascii_toUtf8(const ENCODING *enc,
- const char **fromP, const char *fromLim,
- char **toP, const char *toLim)
-{
- while (*fromP != fromLim && *toP != toLim)
- *(*toP)++ = *(*fromP)++;
-}
-
-#ifdef XML_NS
-
-static const struct normal_encoding ascii_encoding_ns = {
- { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 },
- {
-#include "asciitab.h"
-/* BT_NONXML == 0 */
- },
- STANDARD_VTABLE(sb_)
-};
-
-#endif
-
-static const struct normal_encoding ascii_encoding = {
- { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 },
- {
-#define BT_COLON BT_NMSTRT
-#include "asciitab.h"
-#undef BT_COLON
-/* BT_NONXML == 0 */
- },
- STANDARD_VTABLE(sb_)
-};
-
-static int FASTCALL
-unicode_byte_type(char hi, char lo)
-{
- switch ((unsigned char)hi) {
- case 0xD8: case 0xD9: case 0xDA: case 0xDB:
- return BT_LEAD4;
- case 0xDC: case 0xDD: case 0xDE: case 0xDF:
- return BT_TRAIL;
- case 0xFF:
- switch ((unsigned char)lo) {
- case 0xFF:
- case 0xFE:
- return BT_NONXML;
- }
- break;
- }
- return BT_NONASCII;
-}
-
-#define DEFINE_UTF16_TO_UTF8(E) \
-static void FASTCALL \
-E ## toUtf8(const ENCODING *enc, \
- const char **fromP, const char *fromLim, \
- char **toP, const char *toLim) \
-{ \
- const char *from; \
- for (from = *fromP; from != fromLim; from += 2) { \
- int plane; \
- unsigned char lo2; \
- unsigned char lo = GET_LO(from); \
- unsigned char hi = GET_HI(from); \
- switch (hi) { \
- case 0: \
- if (lo < 0x80) { \
- if (*toP == toLim) { \
- *fromP = from; \
- return; \
- } \
- *(*toP)++ = lo; \
- break; \
- } \
- /* fall through */ \
- case 0x1: case 0x2: case 0x3: \
- case 0x4: case 0x5: case 0x6: case 0x7: \
- if (toLim - *toP < 2) { \
- *fromP = from; \
- return; \
- } \
- *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \
- *(*toP)++ = ((lo & 0x3f) | 0x80); \
- break; \
- default: \
- if (toLim - *toP < 3) { \
- *fromP = from; \
- return; \
- } \
- /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \
- *(*toP)++ = ((hi >> 4) | UTF8_cval3); \
- *(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \
- *(*toP)++ = ((lo & 0x3f) | 0x80); \
- break; \
- case 0xD8: case 0xD9: case 0xDA: case 0xDB: \
- if (toLim - *toP < 4) { \
- *fromP = from; \
- return; \
- } \
- plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \
- *(*toP)++ = ((plane >> 2) | UTF8_cval4); \
- *(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \
- from += 2; \
- lo2 = GET_LO(from); \
- *(*toP)++ = (((lo & 0x3) << 4) \
- | ((GET_HI(from) & 0x3) << 2) \
- | (lo2 >> 6) \
- | 0x80); \
- *(*toP)++ = ((lo2 & 0x3f) | 0x80); \
- break; \
- } \
- } \
- *fromP = from; \
-}
-
-#define DEFINE_UTF16_TO_UTF16(E) \
-static void FASTCALL \
-E ## toUtf16(const ENCODING *enc, \
- const char **fromP, const char *fromLim, \
- unsigned short **toP, const unsigned short *toLim) \
-{ \
- /* Avoid copying first half only of surrogate */ \
- if (fromLim - *fromP > ((toLim - *toP) << 1) \
- && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \
- fromLim -= 2; \
- for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \
- *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \
-}
-
-#define SET2(ptr, ch) \
- (((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8)))
-#define GET_LO(ptr) ((unsigned char)(ptr)[0])
-#define GET_HI(ptr) ((unsigned char)(ptr)[1])
-
-DEFINE_UTF16_TO_UTF8(little2_)
-DEFINE_UTF16_TO_UTF16(little2_)
-
-#undef SET2
-#undef GET_LO
-#undef GET_HI
-
-#define SET2(ptr, ch) \
- (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF)))
-#define GET_LO(ptr) ((unsigned char)(ptr)[1])
-#define GET_HI(ptr) ((unsigned char)(ptr)[0])
-
-DEFINE_UTF16_TO_UTF8(big2_)
-DEFINE_UTF16_TO_UTF16(big2_)
-
-#undef SET2
-#undef GET_LO
-#undef GET_HI
-
-#define LITTLE2_BYTE_TYPE(enc, p) \
- ((p)[1] == 0 \
- ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \
- : unicode_byte_type((p)[1], (p)[0]))
-#define LITTLE2_BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1)
-#define LITTLE2_CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c)
-#define LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) \
- UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0])
-#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) \
- UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0])
-
-#ifdef XML_MIN_SIZE
-
-static int FASTCALL
-little2_byteType(const ENCODING *enc, const char *p)
-{
- return LITTLE2_BYTE_TYPE(enc, p);
-}
-
-static int FASTCALL
-little2_byteToAscii(const ENCODING *enc, const char *p)
-{
- return LITTLE2_BYTE_TO_ASCII(enc, p);
-}
-
-static int FASTCALL
-little2_charMatches(const ENCODING *enc, const char *p, int c)
-{
- return LITTLE2_CHAR_MATCHES(enc, p, c);
-}
-
-static int FASTCALL
-little2_isNameMin(const ENCODING *enc, const char *p)
-{
- return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p);
-}
-
-static int FASTCALL
-little2_isNmstrtMin(const ENCODING *enc, const char *p)
-{
- return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p);
-}
-
-#undef VTABLE
-#define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16
-
-#else /* not XML_MIN_SIZE */
-
-#undef PREFIX
-#define PREFIX(ident) little2_ ## ident
-#define MINBPC(enc) 2
-/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
-#define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p)
-#define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(enc, p)
-#define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(enc, p, c)
-#define IS_NAME_CHAR(enc, p, n) 0
-#define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(enc, p)
-#define IS_NMSTRT_CHAR(enc, p, n) (0)
-#define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p)
-
-#include "xmltok_impl.c"
-
-#undef MINBPC
-#undef BYTE_TYPE
-#undef BYTE_TO_ASCII
-#undef CHAR_MATCHES
-#undef IS_NAME_CHAR
-#undef IS_NAME_CHAR_MINBPC
-#undef IS_NMSTRT_CHAR
-#undef IS_NMSTRT_CHAR_MINBPC
-#undef IS_INVALID_CHAR
-
-#endif /* not XML_MIN_SIZE */
-
-#ifdef XML_NS
-
-static const struct normal_encoding little2_encoding_ns = {
- { VTABLE, 2, 0,
-#if BYTEORDER == 1234
- 1
-#else
- 0
-#endif
- },
- {
-#include "asciitab.h"
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(little2_)
-};
-
-#endif
-
-static const struct normal_encoding little2_encoding = {
- { VTABLE, 2, 0,
-#if BYTEORDER == 1234
- 1
-#else
- 0
-#endif
- },
- {
-#define BT_COLON BT_NMSTRT
-#include "asciitab.h"
-#undef BT_COLON
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(little2_)
-};
-
-#if BYTEORDER != 4321
-
-#ifdef XML_NS
-
-static const struct normal_encoding internal_little2_encoding_ns = {
- { VTABLE, 2, 0, 1 },
- {
-#include "iasciitab.h"
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(little2_)
-};
-
-#endif
-
-static const struct normal_encoding internal_little2_encoding = {
- { VTABLE, 2, 0, 1 },
- {
-#define BT_COLON BT_NMSTRT
-#include "iasciitab.h"
-#undef BT_COLON
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(little2_)
-};
-
-#endif
-
-
-#define BIG2_BYTE_TYPE(enc, p) \
- ((p)[0] == 0 \
- ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \
- : unicode_byte_type((p)[0], (p)[1]))
-#define BIG2_BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1)
-#define BIG2_CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c)
-#define BIG2_IS_NAME_CHAR_MINBPC(enc, p) \
- UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1])
-#define BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) \
- UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1])
-
-#ifdef XML_MIN_SIZE
-
-static int FASTCALL
-big2_byteType(const ENCODING *enc, const char *p)
-{
- return BIG2_BYTE_TYPE(enc, p);
-}
-
-static int FASTCALL
-big2_byteToAscii(const ENCODING *enc, const char *p)
-{
- return BIG2_BYTE_TO_ASCII(enc, p);
-}
-
-static int FASTCALL
-big2_charMatches(const ENCODING *enc, const char *p, int c)
-{
- return BIG2_CHAR_MATCHES(enc, p, c);
-}
-
-static int FASTCALL
-big2_isNameMin(const ENCODING *enc, const char *p)
-{
- return BIG2_IS_NAME_CHAR_MINBPC(enc, p);
-}
-
-static int FASTCALL
-big2_isNmstrtMin(const ENCODING *enc, const char *p)
-{
- return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p);
-}
-
-#undef VTABLE
-#define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16
-
-#else /* not XML_MIN_SIZE */
-
-#undef PREFIX
-#define PREFIX(ident) big2_ ## ident
-#define MINBPC(enc) 2
-/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
-#define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p)
-#define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(enc, p)
-#define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(enc, p, c)
-#define IS_NAME_CHAR(enc, p, n) 0
-#define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(enc, p)
-#define IS_NMSTRT_CHAR(enc, p, n) (0)
-#define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p)
-
-#include "xmltok_impl.c"
-
-#undef MINBPC
-#undef BYTE_TYPE
-#undef BYTE_TO_ASCII
-#undef CHAR_MATCHES
-#undef IS_NAME_CHAR
-#undef IS_NAME_CHAR_MINBPC
-#undef IS_NMSTRT_CHAR
-#undef IS_NMSTRT_CHAR_MINBPC
-#undef IS_INVALID_CHAR
-
-#endif /* not XML_MIN_SIZE */
-
-#ifdef XML_NS
-
-static const struct normal_encoding big2_encoding_ns = {
- { VTABLE, 2, 0,
-#if BYTEORDER == 4321
- 1
-#else
- 0
-#endif
- },
- {
-#include "asciitab.h"
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(big2_)
-};
-
-#endif
-
-static const struct normal_encoding big2_encoding = {
- { VTABLE, 2, 0,
-#if BYTEORDER == 4321
- 1
-#else
- 0
-#endif
- },
- {
-#define BT_COLON BT_NMSTRT
-#include "asciitab.h"
-#undef BT_COLON
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(big2_)
-};
-
-#if BYTEORDER != 1234
-
-#ifdef XML_NS
-
-static const struct normal_encoding internal_big2_encoding_ns = {
- { VTABLE, 2, 0, 1 },
- {
-#include "iasciitab.h"
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(big2_)
-};
-
-#endif
-
-static const struct normal_encoding internal_big2_encoding = {
- { VTABLE, 2, 0, 1 },
- {
-#define BT_COLON BT_NMSTRT
-#include "iasciitab.h"
-#undef BT_COLON
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(big2_)
-};
-
-#endif
-
-#undef PREFIX
-
-static int FASTCALL
-streqci(const char *s1, const char *s2)
-{
- for (;;) {
- char c1 = *s1++;
- char c2 = *s2++;
- if (ASCII_a <= c1 && c1 <= ASCII_z)
- c1 += ASCII_A - ASCII_a;
- if (ASCII_a <= c2 && c2 <= ASCII_z)
- c2 += ASCII_A - ASCII_a;
- if (c1 != c2)
- return 0;
- if (!c1)
- break;
- }
- return 1;
-}
-
-static void FASTCALL
-initUpdatePosition(const ENCODING *enc, const char *ptr,
- const char *end, POSITION *pos)
-{
- normal_updatePosition(&utf8_encoding.enc, ptr, end, pos);
-}
-
-static int FASTCALL
-toAscii(const ENCODING *enc, const char *ptr, const char *end)
-{
- char buf[1];
- char *p = buf;
- XmlUtf8Convert(enc, &ptr, end, &p, p + 1);
- if (p == buf)
- return -1;
- else
- return buf[0];
-}
-
-static int FASTCALL
-isSpace(int c)
-{
- switch (c) {
- case 0x20:
- case 0xD:
- case 0xA:
- case 0x9:
- return 1;
- }
- return 0;
-}
-
-/* Return 1 if there's just optional white space or there's an S
- followed by name=val.
-*/
-static int FASTCALL
-parsePseudoAttribute(const ENCODING *enc,
- const char *ptr,
- const char *end,
- const char **namePtr,
- const char **nameEndPtr,
- const char **valPtr,
- const char **nextTokPtr)
-{
- int c;
- char open;
- if (ptr == end) {
- *namePtr = NULL;
- return 1;
- }
- if (!isSpace(toAscii(enc, ptr, end))) {
- *nextTokPtr = ptr;
- return 0;
- }
- do {
- ptr += enc->minBytesPerChar;
- } while (isSpace(toAscii(enc, ptr, end)));
- if (ptr == end) {
- *namePtr = NULL;
- return 1;
- }
- *namePtr = ptr;
- for (;;) {
- c = toAscii(enc, ptr, end);
- if (c == -1) {
- *nextTokPtr = ptr;
- return 0;
- }
- if (c == ASCII_EQUALS) {
- *nameEndPtr = ptr;
- break;
- }
- if (isSpace(c)) {
- *nameEndPtr = ptr;
- do {
- ptr += enc->minBytesPerChar;
- } while (isSpace(c = toAscii(enc, ptr, end)));
- if (c != ASCII_EQUALS) {
- *nextTokPtr = ptr;
- return 0;
- }
- break;
- }
- ptr += enc->minBytesPerChar;
- }
- if (ptr == *namePtr) {
- *nextTokPtr = ptr;
- return 0;
- }
- ptr += enc->minBytesPerChar;
- c = toAscii(enc, ptr, end);
- while (isSpace(c)) {
- ptr += enc->minBytesPerChar;
- c = toAscii(enc, ptr, end);
- }
- if (c != ASCII_QUOT && c != ASCII_APOS) {
- *nextTokPtr = ptr;
- return 0;
- }
- open = (char)c;
- ptr += enc->minBytesPerChar;
- *valPtr = ptr;
- for (;; ptr += enc->minBytesPerChar) {
- c = toAscii(enc, ptr, end);
- if (c == open)
- break;
- if (!(ASCII_a <= c && c <= ASCII_z)
- && !(ASCII_A <= c && c <= ASCII_Z)
- && !(ASCII_0 <= c && c <= ASCII_9)
- && c != ASCII_PERIOD
- && c != ASCII_MINUS
- && c != ASCII_UNDERSCORE) {
- *nextTokPtr = ptr;
- return 0;
- }
- }
- *nextTokPtr = ptr + enc->minBytesPerChar;
- return 1;
-}
-
-static const char KW_version[] = {
- ASCII_v, ASCII_e, ASCII_r, ASCII_s, ASCII_i, ASCII_o, ASCII_n, '\0'
-};
-
-static const char KW_encoding[] = {
- ASCII_e, ASCII_n, ASCII_c, ASCII_o, ASCII_d, ASCII_i, ASCII_n, ASCII_g, '\0'
-};
-
-static const char KW_standalone[] = {
- ASCII_s, ASCII_t, ASCII_a, ASCII_n, ASCII_d, ASCII_a, ASCII_l, ASCII_o,
- ASCII_n, ASCII_e, '\0'
-};
-
-static const char KW_yes[] = {
- ASCII_y, ASCII_e, ASCII_s, '\0'
-};
-
-static const char KW_no[] = {
- ASCII_n, ASCII_o, '\0'
-};
-
-static int
-doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *,
- const char *,
- const char *),
- int isGeneralTextEntity,
- const ENCODING *enc,
- const char *ptr,
- const char *end,
- const char **badPtr,
- const char **versionPtr,
- const char **versionEndPtr,
- const char **encodingName,
- const ENCODING **encoding,
- int *standalone)
-{
- const char *val = NULL;
- const char *name = NULL;
- const char *nameEnd = NULL;
- ptr += 5 * enc->minBytesPerChar;
- end -= 2 * enc->minBytesPerChar;
- if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)
- || !name) {
- *badPtr = ptr;
- return 0;
- }
- if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_version)) {
- if (!isGeneralTextEntity) {
- *badPtr = name;
- return 0;
- }
- }
- else {
- if (versionPtr)
- *versionPtr = val;
- if (versionEndPtr)
- *versionEndPtr = ptr;
- if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) {
- *badPtr = ptr;
- return 0;
- }
- if (!name) {
- if (isGeneralTextEntity) {
- /* a TextDecl must have an EncodingDecl */
- *badPtr = ptr;
- return 0;
- }
- return 1;
- }
- }
- if (XmlNameMatchesAscii(enc, name, nameEnd, KW_encoding)) {
- int c = toAscii(enc, val, end);
- if (!(ASCII_a <= c && c <= ASCII_z) && !(ASCII_A <= c && c <= ASCII_Z)) {
- *badPtr = val;
- return 0;
- }
- if (encodingName)
- *encodingName = val;
- if (encoding)
- *encoding = encodingFinder(enc, val, ptr - enc->minBytesPerChar);
- if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) {
- *badPtr = ptr;
- return 0;
- }
- if (!name)
- return 1;
- }
- if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_standalone)
- || isGeneralTextEntity) {
- *badPtr = name;
- return 0;
- }
- if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_yes)) {
- if (standalone)
- *standalone = 1;
- }
- else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_no)) {
- if (standalone)
- *standalone = 0;
- }
- else {
- *badPtr = val;
- return 0;
- }
- while (isSpace(toAscii(enc, ptr, end)))
- ptr += enc->minBytesPerChar;
- if (ptr != end) {
- *badPtr = ptr;
- return 0;
- }
- return 1;
-}
-
-static int FASTCALL
-checkCharRefNumber(int result)
-{
- switch (result >> 8) {
- case 0xD8: case 0xD9: case 0xDA: case 0xDB:
- case 0xDC: case 0xDD: case 0xDE: case 0xDF:
- return -1;
- case 0:
- if (latin1_encoding.type[result] == BT_NONXML)
- return -1;
- break;
- case 0xFF:
- if (result == 0xFFFE || result == 0xFFFF)
- return -1;
- break;
- }
- return result;
-}
-
-int
-XmlUtf8Encode(int c, char *buf)
-{
- enum {
- /* minN is minimum legal resulting value for N byte sequence */
- min2 = 0x80,
- min3 = 0x800,
- min4 = 0x10000
- };
-
- if (c < 0)
- return 0;
- if (c < min2) {
- buf[0] = (char)(c | UTF8_cval1);
- return 1;
- }
- if (c < min3) {
- buf[0] = (char)((c >> 6) | UTF8_cval2);
- buf[1] = (char)((c & 0x3f) | 0x80);
- return 2;
- }
- if (c < min4) {
- buf[0] = (char)((c >> 12) | UTF8_cval3);
- buf[1] = (char)(((c >> 6) & 0x3f) | 0x80);
- buf[2] = (char)((c & 0x3f) | 0x80);
- return 3;
- }
- if (c < 0x110000) {
- buf[0] = (char)((c >> 18) | UTF8_cval4);
- buf[1] = (char)(((c >> 12) & 0x3f) | 0x80);
- buf[2] = (char)(((c >> 6) & 0x3f) | 0x80);
- buf[3] = (char)((c & 0x3f) | 0x80);
- return 4;
- }
- return 0;
-}
-
-int
-XmlUtf16Encode(int charNum, unsigned short *buf)
-{
- if (charNum < 0)
- return 0;
- if (charNum < 0x10000) {
- buf[0] = (unsigned short)charNum;
- return 1;
- }
- if (charNum < 0x110000) {
- charNum -= 0x10000;
- buf[0] = (unsigned short)((charNum >> 10) + 0xD800);
- buf[1] = (unsigned short)((charNum & 0x3FF) + 0xDC00);
- return 2;
- }
- return 0;
-}
-
-struct unknown_encoding {
- struct normal_encoding normal;
- int (*convert)(void *userData, const char *p);
- void *userData;
- unsigned short utf16[256];
- char utf8[256][4];
-};
-
-#define AS_UNKNOWN_ENCODING(enc) ((const struct unknown_encoding *) (enc))
-
-int
-XmlSizeOfUnknownEncoding(void)
-{
- return sizeof(struct unknown_encoding);
-}
-
-static int FASTCALL
-unknown_isName(const ENCODING *enc, const char *p)
-{
- const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
- int c = uenc->convert(uenc->userData, p);
- if (c & ~0xFFFF)
- return 0;
- return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF);
-}
-
-static int FASTCALL
-unknown_isNmstrt(const ENCODING *enc, const char *p)
-{
- const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
- int c = uenc->convert(uenc->userData, p);
- if (c & ~0xFFFF)
- return 0;
- return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF);
-}
-
-static int FASTCALL
-unknown_isInvalid(const ENCODING *enc, const char *p)
-{
- const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
- int c = uenc->convert(uenc->userData, p);
- return (c & ~0xFFFF) || checkCharRefNumber(c) < 0;
-}
-
-static void FASTCALL
-unknown_toUtf8(const ENCODING *enc,
- const char **fromP, const char *fromLim,
- char **toP, const char *toLim)
-{
- const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
- char buf[XML_UTF8_ENCODE_MAX];
- for (;;) {
- const char *utf8;
- int n;
- if (*fromP == fromLim)
- break;
- utf8 = uenc->utf8[(unsigned char)**fromP];
- n = *utf8++;
- if (n == 0) {
- int c = uenc->convert(uenc->userData, *fromP);
- n = XmlUtf8Encode(c, buf);
- if (n > toLim - *toP)
- break;
- utf8 = buf;
- *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP]
- - (BT_LEAD2 - 2));
- }
- else {
- if (n > toLim - *toP)
- break;
- (*fromP)++;
- }
- do {
- *(*toP)++ = *utf8++;
- } while (--n != 0);
- }
-}
-
-static void FASTCALL
-unknown_toUtf16(const ENCODING *enc,
- const char **fromP, const char *fromLim,
- unsigned short **toP, const unsigned short *toLim)
-{
- const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
- while (*fromP != fromLim && *toP != toLim) {
- unsigned short c = uenc->utf16[(unsigned char)**fromP];
- if (c == 0) {
- c = (unsigned short)
- uenc->convert(uenc->userData, *fromP);
- *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP]
- - (BT_LEAD2 - 2));
- }
- else
- (*fromP)++;
- *(*toP)++ = c;
- }
-}
-
-ENCODING *
-XmlInitUnknownEncoding(void *mem,
- int *table,
- int (*convert)(void *userData, const char *p),
- void *userData)
-{
- int i;
- struct unknown_encoding *e = mem;
- for (i = 0; i < (int)sizeof(struct normal_encoding); i++)
- ((char *)mem)[i] = ((char *)&latin1_encoding)[i];
- for (i = 0; i < 128; i++)
- if (latin1_encoding.type[i] != BT_OTHER
- && latin1_encoding.type[i] != BT_NONXML
- && table[i] != i)
- return 0;
- for (i = 0; i < 256; i++) {
- int c = table[i];
- if (c == -1) {
- e->normal.type[i] = BT_MALFORM;
- /* This shouldn't really get used. */
- e->utf16[i] = 0xFFFF;
- e->utf8[i][0] = 1;
- e->utf8[i][1] = 0;
- }
- else if (c < 0) {
- if (c < -4)
- return 0;
- e->normal.type[i] = (unsigned char)(BT_LEAD2 - (c + 2));
- e->utf8[i][0] = 0;
- e->utf16[i] = 0;
- }
- else if (c < 0x80) {
- if (latin1_encoding.type[c] != BT_OTHER
- && latin1_encoding.type[c] != BT_NONXML
- && c != i)
- return 0;
- e->normal.type[i] = latin1_encoding.type[c];
- e->utf8[i][0] = 1;
- e->utf8[i][1] = (char)c;
- e->utf16[i] = (unsigned short)(c == 0 ? 0xFFFF : c);
- }
- else if (checkCharRefNumber(c) < 0) {
- e->normal.type[i] = BT_NONXML;
- /* This shouldn't really get used. */
- e->utf16[i] = 0xFFFF;
- e->utf8[i][0] = 1;
- e->utf8[i][1] = 0;
- }
- else {
- if (c > 0xFFFF)
- return 0;
- if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff))
- e->normal.type[i] = BT_NMSTRT;
- else if (UCS2_GET_NAMING(namePages, c >> 8, c & 0xff))
- e->normal.type[i] = BT_NAME;
- else
- e->normal.type[i] = BT_OTHER;
- e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1);
- e->utf16[i] = (unsigned short)c;
- }
- }
- e->userData = userData;
- e->convert = convert;
- if (convert) {
- e->normal.isName2 = unknown_isName;
- e->normal.isName3 = unknown_isName;
- e->normal.isName4 = unknown_isName;
- e->normal.isNmstrt2 = unknown_isNmstrt;
- e->normal.isNmstrt3 = unknown_isNmstrt;
- e->normal.isNmstrt4 = unknown_isNmstrt;
- e->normal.isInvalid2 = unknown_isInvalid;
- e->normal.isInvalid3 = unknown_isInvalid;
- e->normal.isInvalid4 = unknown_isInvalid;
- }
- e->normal.enc.utf8Convert = unknown_toUtf8;
- e->normal.enc.utf16Convert = unknown_toUtf16;
- return &(e->normal.enc);
-}
-
-/* If this enumeration is changed, getEncodingIndex and encodings
-must also be changed. */
-enum {
- UNKNOWN_ENC = -1,
- ISO_8859_1_ENC = 0,
- US_ASCII_ENC,
- UTF_8_ENC,
- UTF_16_ENC,
- UTF_16BE_ENC,
- UTF_16LE_ENC,
- /* must match encodingNames up to here */
- NO_ENC
-};
-
-static const char KW_ISO_8859_1[] = {
- ASCII_I, ASCII_S, ASCII_O, ASCII_MINUS, ASCII_8, ASCII_8, ASCII_5, ASCII_9,
- ASCII_MINUS, ASCII_1, '\0'
-};
-static const char KW_US_ASCII[] = {
- ASCII_U, ASCII_S, ASCII_MINUS, ASCII_A, ASCII_S, ASCII_C, ASCII_I, ASCII_I,
- '\0'
-};
-static const char KW_UTF_8[] = {
- ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_8, '\0'
-};
-static const char KW_UTF_16[] = {
- ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, '\0'
-};
-static const char KW_UTF_16BE[] = {
- ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_B, ASCII_E,
- '\0'
-};
-static const char KW_UTF_16LE[] = {
- ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_L, ASCII_E,
- '\0'
-};
-
-static int FASTCALL
-getEncodingIndex(const char *name)
-{
- static const char *encodingNames[] = {
- KW_ISO_8859_1,
- KW_US_ASCII,
- KW_UTF_8,
- KW_UTF_16,
- KW_UTF_16BE,
- KW_UTF_16LE,
- };
- int i;
- if (name == NULL)
- return NO_ENC;
- for (i = 0; i < (int)(sizeof(encodingNames)/sizeof(encodingNames[0])); i++)
- if (streqci(name, encodingNames[i]))
- return i;
- return UNKNOWN_ENC;
-}
-
-/* For binary compatibility, we store the index of the encoding
- specified at initialization in the isUtf16 member.
-*/
-
-#define INIT_ENC_INDEX(enc) ((int)(enc)->initEnc.isUtf16)
-#define SET_INIT_ENC_INDEX(enc, i) ((enc)->initEnc.isUtf16 = (char)i)
-
-/* This is what detects the encoding. encodingTable maps from
- encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of
- the external (protocol) specified encoding; state is
- XML_CONTENT_STATE if we're parsing an external text entity, and
- XML_PROLOG_STATE otherwise.
-*/
-
-
-static int FASTCALL
-initScan(const ENCODING **encodingTable,
- const INIT_ENCODING *enc,
- int state,
- const char *ptr,
- const char *end,
- const char **nextTokPtr)
-{
- const ENCODING **encPtr;
-
- if (ptr == end)
- return XML_TOK_NONE;
- encPtr = enc->encPtr;
- if (ptr + 1 == end) {
- /* only a single byte available for auto-detection */
-#ifndef XML_DTD /* FIXME */
- /* a well-formed document entity must have more than one byte */
- if (state != XML_CONTENT_STATE)
- return XML_TOK_PARTIAL;
-#endif
- /* so we're parsing an external text entity... */
- /* if UTF-16 was externally specified, then we need at least 2 bytes */
- switch (INIT_ENC_INDEX(enc)) {
- case UTF_16_ENC:
- case UTF_16LE_ENC:
- case UTF_16BE_ENC:
- return XML_TOK_PARTIAL;
- }
- switch ((unsigned char)*ptr) {
- case 0xFE:
- case 0xFF:
- case 0xEF: /* possibly first byte of UTF-8 BOM */
- if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC
- && state == XML_CONTENT_STATE)
- break;
- /* fall through */
- case 0x00:
- case 0x3C:
- return XML_TOK_PARTIAL;
- }
- }
- else {
- switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) {
- case 0xFEFF:
- if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC
- && state == XML_CONTENT_STATE)
- break;
- *nextTokPtr = ptr + 2;
- *encPtr = encodingTable[UTF_16BE_ENC];
- return XML_TOK_BOM;
- /* 00 3C is handled in the default case */
- case 0x3C00:
- if ((INIT_ENC_INDEX(enc) == UTF_16BE_ENC
- || INIT_ENC_INDEX(enc) == UTF_16_ENC)
- && state == XML_CONTENT_STATE)
- break;
- *encPtr = encodingTable[UTF_16LE_ENC];
- return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
- case 0xFFFE:
- if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC
- && state == XML_CONTENT_STATE)
- break;
- *nextTokPtr = ptr + 2;
- *encPtr = encodingTable[UTF_16LE_ENC];
- return XML_TOK_BOM;
- case 0xEFBB:
- /* Maybe a UTF-8 BOM (EF BB BF) */
- /* If there's an explicitly specified (external) encoding
- of ISO-8859-1 or some flavour of UTF-16
- and this is an external text entity,
- don't look for the BOM,
- because it might be a legal data.
- */
- if (state == XML_CONTENT_STATE) {
- int e = INIT_ENC_INDEX(enc);
- if (e == ISO_8859_1_ENC || e == UTF_16BE_ENC
- || e == UTF_16LE_ENC || e == UTF_16_ENC)
- break;
- }
- if (ptr + 2 == end)
- return XML_TOK_PARTIAL;
- if ((unsigned char)ptr[2] == 0xBF) {
- *nextTokPtr = ptr + 3;
- *encPtr = encodingTable[UTF_8_ENC];
- return XML_TOK_BOM;
- }
- break;
- default:
- if (ptr[0] == '\0') {
- /* 0 isn't a legal data character. Furthermore a document
- entity can only start with ASCII characters. So the only
- way this can fail to be big-endian UTF-16 if it it's an
- external parsed general entity that's labelled as
- UTF-16LE.
- */
- if (state == XML_CONTENT_STATE && INIT_ENC_INDEX(enc) == UTF_16LE_ENC)
- break;
- *encPtr = encodingTable[UTF_16BE_ENC];
- return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
- }
- else if (ptr[1] == '\0') {
- /* We could recover here in the case:
- - parsing an external entity
- - second byte is 0
- - no externally specified encoding
- - no encoding declaration
- by assuming UTF-16LE. But we don't, because this would mean when
- presented just with a single byte, we couldn't reliably determine
- whether we needed further bytes.
- */
- if (state == XML_CONTENT_STATE)
- break;
- *encPtr = encodingTable[UTF_16LE_ENC];
- return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
- }
- break;
- }
- }
- *encPtr = encodingTable[INIT_ENC_INDEX(enc)];
- return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
-}
-
-
-#define NS(x) x
-#define ns(x) x
-#include "xmltok_ns.c"
-#undef NS
-#undef ns
-
-#ifdef XML_NS
-
-#define NS(x) x ## NS
-#define ns(x) x ## _ns
-
-#include "xmltok_ns.c"
-
-#undef NS
-#undef ns
-
-ENCODING *
-XmlInitUnknownEncodingNS(void *mem,
- int *table,
- int (*convert)(void *userData, const char *p),
- void *userData)
-{
- ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData);
- if (enc)
- ((struct normal_encoding *)enc)->type[ASCII_COLON] = BT_COLON;
- return enc;
-}
-
-#endif /* XML_NS */
diff --git a/bundle/expat/xmltok.h b/bundle/expat/xmltok.h
deleted file mode 100644
index 55cc181e7b..0000000000
--- a/bundle/expat/xmltok.h
+++ /dev/null
@@ -1,312 +0,0 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
-*/
-
-#ifndef XmlTok_INCLUDED
-#define XmlTok_INCLUDED 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* The following token may be returned by XmlContentTok */
-#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be
- start of illegal ]]> sequence */
-/* The following tokens may be returned by both XmlPrologTok and
- XmlContentTok.
-*/
-#define XML_TOK_NONE -4 /* The string to be scanned is empty */
-#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan;
- might be part of CRLF sequence */
-#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */
-#define XML_TOK_PARTIAL -1 /* only part of a token */
-#define XML_TOK_INVALID 0
-
-/* The following tokens are returned by XmlContentTok; some are also
- returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok.
-*/
-#define XML_TOK_START_TAG_WITH_ATTS 1
-#define XML_TOK_START_TAG_NO_ATTS 2
-#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag <e/> */
-#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4
-#define XML_TOK_END_TAG 5
-#define XML_TOK_DATA_CHARS 6
-#define XML_TOK_DATA_NEWLINE 7
-#define XML_TOK_CDATA_SECT_OPEN 8
-#define XML_TOK_ENTITY_REF 9
-#define XML_TOK_CHAR_REF 10 /* numeric character reference */
-
-/* The following tokens may be returned by both XmlPrologTok and
- XmlContentTok.
-*/
-#define XML_TOK_PI 11 /* processing instruction */
-#define XML_TOK_XML_DECL 12 /* XML decl or text decl */
-#define XML_TOK_COMMENT 13
-#define XML_TOK_BOM 14 /* Byte order mark */
-
-/* The following tokens are returned only by XmlPrologTok */
-#define XML_TOK_PROLOG_S 15
-#define XML_TOK_DECL_OPEN 16 /* <!foo */
-#define XML_TOK_DECL_CLOSE 17 /* > */
-#define XML_TOK_NAME 18
-#define XML_TOK_NMTOKEN 19
-#define XML_TOK_POUND_NAME 20 /* #name */
-#define XML_TOK_OR 21 /* | */
-#define XML_TOK_PERCENT 22
-#define XML_TOK_OPEN_PAREN 23
-#define XML_TOK_CLOSE_PAREN 24
-#define XML_TOK_OPEN_BRACKET 25
-#define XML_TOK_CLOSE_BRACKET 26
-#define XML_TOK_LITERAL 27
-#define XML_TOK_PARAM_ENTITY_REF 28
-#define XML_TOK_INSTANCE_START 29
-
-/* The following occur only in element type declarations */
-#define XML_TOK_NAME_QUESTION 30 /* name? */
-#define XML_TOK_NAME_ASTERISK 31 /* name* */
-#define XML_TOK_NAME_PLUS 32 /* name+ */
-#define XML_TOK_COND_SECT_OPEN 33 /* <![ */
-#define XML_TOK_COND_SECT_CLOSE 34 /* ]]> */
-#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */
-#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */
-#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */
-#define XML_TOK_COMMA 38
-
-/* The following token is returned only by XmlAttributeValueTok */
-#define XML_TOK_ATTRIBUTE_VALUE_S 39
-
-/* The following token is returned only by XmlCdataSectionTok */
-#define XML_TOK_CDATA_SECT_CLOSE 40
-
-/* With namespace processing this is returned by XmlPrologTok for a
- name with a colon.
-*/
-#define XML_TOK_PREFIXED_NAME 41
-
-#ifdef XML_DTD
-#define XML_TOK_IGNORE_SECT 42
-#endif /* XML_DTD */
-
-#ifdef XML_DTD
-#define XML_N_STATES 4
-#else /* not XML_DTD */
-#define XML_N_STATES 3
-#endif /* not XML_DTD */
-
-#define XML_PROLOG_STATE 0
-#define XML_CONTENT_STATE 1
-#define XML_CDATA_SECTION_STATE 2
-#ifdef XML_DTD
-#define XML_IGNORE_SECTION_STATE 3
-#endif /* XML_DTD */
-
-#define XML_N_LITERAL_TYPES 2
-#define XML_ATTRIBUTE_VALUE_LITERAL 0
-#define XML_ENTITY_VALUE_LITERAL 1
-
-/* The size of the buffer passed to XmlUtf8Encode must be at least this. */
-#define XML_UTF8_ENCODE_MAX 4
-/* The size of the buffer passed to XmlUtf16Encode must be at least this. */
-#define XML_UTF16_ENCODE_MAX 2
-
-typedef struct position {
- /* first line and first column are 0 not 1 */
- unsigned long lineNumber;
- unsigned long columnNumber;
-} POSITION;
-
-typedef struct {
- const char *name;
- const char *valuePtr;
- const char *valueEnd;
- char normalized;
-} ATTRIBUTE;
-
-struct encoding;
-typedef struct encoding ENCODING;
-
-typedef int (FASTCALL *SCANNER)(const ENCODING *,
- const char *,
- const char *,
- const char **);
-
-struct encoding {
- SCANNER scanners[XML_N_STATES];
- SCANNER literalScanners[XML_N_LITERAL_TYPES];
- int (FASTCALL *sameName)(const ENCODING *,
- const char *,
- const char *);
- int (FASTCALL *nameMatchesAscii)(const ENCODING *,
- const char *,
- const char *,
- const char *);
- int (FASTCALL *nameLength)(const ENCODING *, const char *);
- const char *(FASTCALL *skipS)(const ENCODING *, const char *);
- int (FASTCALL *getAtts)(const ENCODING *enc,
- const char *ptr,
- int attsMax,
- ATTRIBUTE *atts);
- int (FASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr);
- int (FASTCALL *predefinedEntityName)(const ENCODING *,
- const char *,
- const char *);
- void (FASTCALL *updatePosition)(const ENCODING *,
- const char *ptr,
- const char *end,
- POSITION *);
- int (FASTCALL *isPublicId)(const ENCODING *enc,
- const char *ptr,
- const char *end,
- const char **badPtr);
- void (FASTCALL *utf8Convert)(const ENCODING *enc,
- const char **fromP,
- const char *fromLim,
- char **toP,
- const char *toLim);
- void (FASTCALL *utf16Convert)(const ENCODING *enc,
- const char **fromP,
- const char *fromLim,
- unsigned short **toP,
- const unsigned short *toLim);
- int minBytesPerChar;
- char isUtf8;
- char isUtf16;
-};
-
-/* Scan the string starting at ptr until the end of the next complete
- token, but do not scan past eptr. Return an integer giving the
- type of token.
-
- Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set.
-
- Return XML_TOK_PARTIAL when the string does not contain a complete
- token; nextTokPtr will not be set.
-
- Return XML_TOK_INVALID when the string does not start a valid
- token; nextTokPtr will be set to point to the character which made
- the token invalid.
-
- Otherwise the string starts with a valid token; nextTokPtr will be
- set to point to the character following the end of that token.
-
- Each data character counts as a single token, but adjacent data
- characters may be returned together. Similarly for characters in
- the prolog outside literals, comments and processing instructions.
-*/
-
-
-#define XmlTok(enc, state, ptr, end, nextTokPtr) \
- (((enc)->scanners[state])(enc, ptr, end, nextTokPtr))
-
-#define XmlPrologTok(enc, ptr, end, nextTokPtr) \
- XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr)
-
-#define XmlContentTok(enc, ptr, end, nextTokPtr) \
- XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr)
-
-#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \
- XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)
-
-#ifdef XML_DTD
-
-#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \
- XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr)
-
-#endif /* XML_DTD */
-
-/* This is used for performing a 2nd-level tokenization on the content
- of a literal that has already been returned by XmlTok.
-*/
-#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \
- (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr))
-
-#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \
- XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr)
-
-#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \
- XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr)
-
-#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2))
-
-#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \
- (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2))
-
-#define XmlNameLength(enc, ptr) \
- (((enc)->nameLength)(enc, ptr))
-
-#define XmlSkipS(enc, ptr) \
- (((enc)->skipS)(enc, ptr))
-
-#define XmlGetAttributes(enc, ptr, attsMax, atts) \
- (((enc)->getAtts)(enc, ptr, attsMax, atts))
-
-#define XmlCharRefNumber(enc, ptr) \
- (((enc)->charRefNumber)(enc, ptr))
-
-#define XmlPredefinedEntityName(enc, ptr, end) \
- (((enc)->predefinedEntityName)(enc, ptr, end))
-
-#define XmlUpdatePosition(enc, ptr, end, pos) \
- (((enc)->updatePosition)(enc, ptr, end, pos))
-
-#define XmlIsPublicId(enc, ptr, end, badPtr) \
- (((enc)->isPublicId)(enc, ptr, end, badPtr))
-
-#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \
- (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))
-
-#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \
- (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim))
-
-typedef struct {
- ENCODING initEnc;
- const ENCODING **encPtr;
-} INIT_ENCODING;
-
-int XmlParseXmlDecl(int isGeneralTextEntity,
- const ENCODING *enc,
- const char *ptr,
- const char *end,
- const char **badPtr,
- const char **versionPtr,
- const char **versionEndPtr,
- const char **encodingNamePtr,
- const ENCODING **namedEncodingPtr,
- int *standalonePtr);
-
-int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
-const ENCODING *XmlGetUtf8InternalEncoding(void);
-const ENCODING *XmlGetUtf16InternalEncoding(void);
-int XmlUtf8Encode(int charNumber, char *buf);
-int XmlUtf16Encode(int charNumber, unsigned short *buf);
-
-int XmlSizeOfUnknownEncoding(void);
-ENCODING *
-XmlInitUnknownEncoding(void *mem,
- int *table,
- int (*conv)(void *userData, const char *p),
- void *userData);
-
-int XmlParseXmlDeclNS(int isGeneralTextEntity,
- const ENCODING *enc,
- const char *ptr,
- const char *end,
- const char **badPtr,
- const char **versionPtr,
- const char **versionEndPtr,
- const char **encodingNamePtr,
- const ENCODING **namedEncodingPtr,
- int *standalonePtr);
-int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
-const ENCODING *XmlGetUtf8InternalEncodingNS(void);
-const ENCODING *XmlGetUtf16InternalEncodingNS(void);
-ENCODING *
-XmlInitUnknownEncodingNS(void *mem,
- int *table,
- int (*conv)(void *userData, const char *p),
- void *userData);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* not XmlTok_INCLUDED */
diff --git a/bundle/expat/xmltok_impl.c b/bundle/expat/xmltok_impl.c
deleted file mode 100644
index be3d1d31ca..0000000000
--- a/bundle/expat/xmltok_impl.c
+++ /dev/null
@@ -1,1778 +0,0 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
-*/
-
-#ifndef IS_INVALID_CHAR
-#define IS_INVALID_CHAR(enc, ptr, n) (0)
-#endif
-
-#define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \
- case BT_LEAD ## n: \
- if (end - ptr < n) \
- return XML_TOK_PARTIAL_CHAR; \
- if (IS_INVALID_CHAR(enc, ptr, n)) { \
- *(nextTokPtr) = (ptr); \
- return XML_TOK_INVALID; \
- } \
- ptr += n; \
- break;
-
-#define INVALID_CASES(ptr, nextTokPtr) \
- INVALID_LEAD_CASE(2, ptr, nextTokPtr) \
- INVALID_LEAD_CASE(3, ptr, nextTokPtr) \
- INVALID_LEAD_CASE(4, ptr, nextTokPtr) \
- case BT_NONXML: \
- case BT_MALFORM: \
- case BT_TRAIL: \
- *(nextTokPtr) = (ptr); \
- return XML_TOK_INVALID;
-
-#define CHECK_NAME_CASE(n, enc, ptr, end, nextTokPtr) \
- case BT_LEAD ## n: \
- if (end - ptr < n) \
- return XML_TOK_PARTIAL_CHAR; \
- if (!IS_NAME_CHAR(enc, ptr, n)) { \
- *nextTokPtr = ptr; \
- return XML_TOK_INVALID; \
- } \
- ptr += n; \
- break;
-
-#define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \
- case BT_NONASCII: \
- if (!IS_NAME_CHAR_MINBPC(enc, ptr)) { \
- *nextTokPtr = ptr; \
- return XML_TOK_INVALID; \
- } \
- case BT_NMSTRT: \
- case BT_HEX: \
- case BT_DIGIT: \
- case BT_NAME: \
- case BT_MINUS: \
- ptr += MINBPC(enc); \
- break; \
- CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \
- CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \
- CHECK_NAME_CASE(4, enc, ptr, end, nextTokPtr)
-
-#define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \
- case BT_LEAD ## n: \
- if (end - ptr < n) \
- return XML_TOK_PARTIAL_CHAR; \
- if (!IS_NMSTRT_CHAR(enc, ptr, n)) { \
- *nextTokPtr = ptr; \
- return XML_TOK_INVALID; \
- } \
- ptr += n; \
- break;
-
-#define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \
- case BT_NONASCII: \
- if (!IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { \
- *nextTokPtr = ptr; \
- return XML_TOK_INVALID; \
- } \
- case BT_NMSTRT: \
- case BT_HEX: \
- ptr += MINBPC(enc); \
- break; \
- CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \
- CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \
- CHECK_NMSTRT_CASE(4, enc, ptr, end, nextTokPtr)
-
-#ifndef PREFIX
-#define PREFIX(ident) ident
-#endif
-
-/* ptr points to character following "<!-" */
-
-static int FASTCALL
-PREFIX(scanComment)(const ENCODING *enc, const char *ptr,
- const char *end, const char **nextTokPtr)
-{
- if (ptr != end) {
- if (!CHAR_MATCHES(enc, ptr, ASCII_MINUS)) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- ptr += MINBPC(enc);
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- INVALID_CASES(ptr, nextTokPtr)
- case BT_MINUS:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr, ASCII_MINUS)) {
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
- if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_COMMENT;
- }
- break;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-/* ptr points to character following "<!" */
-
-static int FASTCALL
-PREFIX(scanDecl)(const ENCODING *enc, const char *ptr,
- const char *end, const char **nextTokPtr)
-{
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_MINUS:
- return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_LSQB:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_COND_SECT_OPEN;
- case BT_NMSTRT:
- case BT_HEX:
- ptr += MINBPC(enc);
- break;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_PERCNT:
- if (ptr + MINBPC(enc) == end)
- return XML_TOK_PARTIAL;
- /* don't allow <!ENTITY% foo "whatever"> */
- switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) {
- case BT_S: case BT_CR: case BT_LF: case BT_PERCNT:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- /* fall through */
- case BT_S: case BT_CR: case BT_LF:
- *nextTokPtr = ptr;
- return XML_TOK_DECL_OPEN;
- case BT_NMSTRT:
- case BT_HEX:
- ptr += MINBPC(enc);
- break;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-static int FASTCALL
-PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr,
- const char *end, int *tokPtr)
-{
- int upper = 0;
- *tokPtr = XML_TOK_PI;
- if (end - ptr != MINBPC(enc)*3)
- return 1;
- switch (BYTE_TO_ASCII(enc, ptr)) {
- case ASCII_x:
- break;
- case ASCII_X:
- upper = 1;
- break;
- default:
- return 1;
- }
- ptr += MINBPC(enc);
- switch (BYTE_TO_ASCII(enc, ptr)) {
- case ASCII_m:
- break;
- case ASCII_M:
- upper = 1;
- break;
- default:
- return 1;
- }
- ptr += MINBPC(enc);
- switch (BYTE_TO_ASCII(enc, ptr)) {
- case ASCII_l:
- break;
- case ASCII_L:
- upper = 1;
- break;
- default:
- return 1;
- }
- if (upper)
- return 0;
- *tokPtr = XML_TOK_XML_DECL;
- return 1;
-}
-
-/* ptr points to character following "<?" */
-
-static int FASTCALL
-PREFIX(scanPi)(const ENCODING *enc, const char *ptr,
- const char *end, const char **nextTokPtr)
-{
- int tok;
- const char *target = ptr;
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
- case BT_S: case BT_CR: case BT_LF:
- if (!PREFIX(checkPiTarget)(enc, target, ptr, &tok)) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- ptr += MINBPC(enc);
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- INVALID_CASES(ptr, nextTokPtr)
- case BT_QUEST:
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- *nextTokPtr = ptr + MINBPC(enc);
- return tok;
- }
- break;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- return XML_TOK_PARTIAL;
- case BT_QUEST:
- if (!PREFIX(checkPiTarget)(enc, target, ptr, &tok)) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- *nextTokPtr = ptr + MINBPC(enc);
- return tok;
- }
- /* fall through */
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-static int FASTCALL
-PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr,
- const char *end, const char **nextTokPtr)
-{
- static const char CDATA_LSQB[] = { ASCII_C, ASCII_D, ASCII_A,
- ASCII_T, ASCII_A, ASCII_LSQB };
- int i;
- /* CDATA[ */
- if (end - ptr < 6 * MINBPC(enc))
- return XML_TOK_PARTIAL;
- for (i = 0; i < 6; i++, ptr += MINBPC(enc)) {
- if (!CHAR_MATCHES(enc, ptr, CDATA_LSQB[i])) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- *nextTokPtr = ptr;
- return XML_TOK_CDATA_SECT_OPEN;
-}
-
-static int FASTCALL
-PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr,
- const char *end, const char **nextTokPtr)
-{
- if (ptr == end)
- return XML_TOK_NONE;
- if (MINBPC(enc) > 1) {
- size_t n = end - ptr;
- if (n & (MINBPC(enc) - 1)) {
- n &= ~(MINBPC(enc) - 1);
- if (n == 0)
- return XML_TOK_PARTIAL;
- end = ptr + n;
- }
- }
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_RSQB:
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB))
- break;
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- ptr -= MINBPC(enc);
- break;
- }
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_CDATA_SECT_CLOSE;
- case BT_CR:
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- if (BYTE_TYPE(enc, ptr) == BT_LF)
- ptr += MINBPC(enc);
- *nextTokPtr = ptr;
- return XML_TOK_DATA_NEWLINE;
- case BT_LF:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_DATA_NEWLINE;
- INVALID_CASES(ptr, nextTokPtr)
- default:
- ptr += MINBPC(enc);
- break;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: \
- if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \
- *nextTokPtr = ptr; \
- return XML_TOK_DATA_CHARS; \
- } \
- ptr += n; \
- break;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_NONXML:
- case BT_MALFORM:
- case BT_TRAIL:
- case BT_CR:
- case BT_LF:
- case BT_RSQB:
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
-}
-
-/* ptr points to character following "</" */
-
-static int FASTCALL
-PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr,
- const char *end, const char **nextTokPtr)
-{
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
- case BT_S: case BT_CR: case BT_LF:
- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_S: case BT_CR: case BT_LF:
- break;
- case BT_GT:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_END_TAG;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-#ifdef XML_NS
- case BT_COLON:
- /* no need to check qname syntax here,
- since end-tag must match exactly */
- ptr += MINBPC(enc);
- break;
-#endif
- case BT_GT:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_END_TAG;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-/* ptr points to character following "&#X" */
-
-static int FASTCALL
-PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr,
- const char *end, const char **nextTokPtr)
-{
- if (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_DIGIT:
- case BT_HEX:
- break;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_DIGIT:
- case BT_HEX:
- break;
- case BT_SEMI:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_CHAR_REF;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-/* ptr points to character following "&#" */
-
-static int FASTCALL
-PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr,
- const char *end, const char **nextTokPtr)
-{
- if (ptr != end) {
- if (CHAR_MATCHES(enc, ptr, ASCII_x))
- return PREFIX(scanHexCharRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_DIGIT:
- break;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_DIGIT:
- break;
- case BT_SEMI:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_CHAR_REF;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-/* ptr points to character following "&" */
-
-static int FASTCALL
-PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- case BT_NUM:
- return PREFIX(scanCharRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
- case BT_SEMI:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_ENTITY_REF;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-/* ptr points to character following first character of attribute name */
-
-static int FASTCALL
-PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
-#ifdef XML_NS
- int hadColon = 0;
-#endif
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
-#ifdef XML_NS
- case BT_COLON:
- if (hadColon) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- hadColon = 1;
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- break;
-#endif
- case BT_S: case BT_CR: case BT_LF:
- for (;;) {
- int t;
-
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- t = BYTE_TYPE(enc, ptr);
- if (t == BT_EQUALS)
- break;
- switch (t) {
- case BT_S:
- case BT_LF:
- case BT_CR:
- break;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- /* fall through */
- case BT_EQUALS:
- {
- int open;
-#ifdef XML_NS
- hadColon = 0;
-#endif
- for (;;) {
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- open = BYTE_TYPE(enc, ptr);
- if (open == BT_QUOT || open == BT_APOS)
- break;
- switch (open) {
- case BT_S:
- case BT_LF:
- case BT_CR:
- break;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- ptr += MINBPC(enc);
- /* in attribute value */
- for (;;) {
- int t;
- if (ptr == end)
- return XML_TOK_PARTIAL;
- t = BYTE_TYPE(enc, ptr);
- if (t == open)
- break;
- switch (t) {
- INVALID_CASES(ptr, nextTokPtr)
- case BT_AMP:
- {
- int tok = PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, &ptr);
- if (tok <= 0) {
- if (tok == XML_TOK_INVALID)
- *nextTokPtr = ptr;
- return tok;
- }
- break;
- }
- case BT_LT:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_S:
- case BT_CR:
- case BT_LF:
- break;
- case BT_SOL:
- goto sol;
- case BT_GT:
- goto gt;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- /* ptr points to closing quote */
- for (;;) {
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- case BT_S: case BT_CR: case BT_LF:
- continue;
- case BT_GT:
- gt:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_START_TAG_WITH_ATTS;
- case BT_SOL:
- sol:
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_EMPTY_ELEMENT_WITH_ATTS;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- break;
- }
- break;
- }
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-/* ptr points to character following "<" */
-
-static int FASTCALL
-PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
-#ifdef XML_NS
- int hadColon;
-#endif
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- case BT_EXCL:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_MINUS:
- return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_LSQB:
- return PREFIX(scanCdataSection)(enc, ptr + MINBPC(enc),
- end, nextTokPtr);
- }
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- case BT_QUEST:
- return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_SOL:
- return PREFIX(scanEndTag)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
-#ifdef XML_NS
- hadColon = 0;
-#endif
- /* we have a start-tag */
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
-#ifdef XML_NS
- case BT_COLON:
- if (hadColon) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- hadColon = 1;
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- break;
-#endif
- case BT_S: case BT_CR: case BT_LF:
- {
- ptr += MINBPC(enc);
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- case BT_GT:
- goto gt;
- case BT_SOL:
- goto sol;
- case BT_S: case BT_CR: case BT_LF:
- ptr += MINBPC(enc);
- continue;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- return PREFIX(scanAtts)(enc, ptr, end, nextTokPtr);
- }
- return XML_TOK_PARTIAL;
- }
- case BT_GT:
- gt:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_START_TAG_NO_ATTS;
- case BT_SOL:
- sol:
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_EMPTY_ELEMENT_NO_ATTS;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-static int FASTCALL
-PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- if (ptr == end)
- return XML_TOK_NONE;
- if (MINBPC(enc) > 1) {
- size_t n = end - ptr;
- if (n & (MINBPC(enc) - 1)) {
- n &= ~(MINBPC(enc) - 1);
- if (n == 0)
- return XML_TOK_PARTIAL;
- end = ptr + n;
- }
- }
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_LT:
- return PREFIX(scanLt)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_AMP:
- return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_CR:
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_TRAILING_CR;
- if (BYTE_TYPE(enc, ptr) == BT_LF)
- ptr += MINBPC(enc);
- *nextTokPtr = ptr;
- return XML_TOK_DATA_NEWLINE;
- case BT_LF:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_DATA_NEWLINE;
- case BT_RSQB:
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_TRAILING_RSQB;
- if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB))
- break;
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_TRAILING_RSQB;
- if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- ptr -= MINBPC(enc);
- break;
- }
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- INVALID_CASES(ptr, nextTokPtr)
- default:
- ptr += MINBPC(enc);
- break;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: \
- if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \
- *nextTokPtr = ptr; \
- return XML_TOK_DATA_CHARS; \
- } \
- ptr += n; \
- break;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_RSQB:
- if (ptr + MINBPC(enc) != end) {
- if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) {
- ptr += MINBPC(enc);
- break;
- }
- if (ptr + 2*MINBPC(enc) != end) {
- if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), ASCII_GT)) {
- ptr += MINBPC(enc);
- break;
- }
- *nextTokPtr = ptr + 2*MINBPC(enc);
- return XML_TOK_INVALID;
- }
- }
- /* fall through */
- case BT_AMP:
- case BT_LT:
- case BT_NONXML:
- case BT_MALFORM:
- case BT_TRAIL:
- case BT_CR:
- case BT_LF:
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
-}
-
-/* ptr points to character following "%" */
-
-static int FASTCALL
-PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- case BT_S: case BT_LF: case BT_CR: case BT_PERCNT:
- *nextTokPtr = ptr;
- return XML_TOK_PERCENT;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
- case BT_SEMI:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_PARAM_ENTITY_REF;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-static int FASTCALL
-PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
- case BT_CR: case BT_LF: case BT_S:
- case BT_RPAR: case BT_GT: case BT_PERCNT: case BT_VERBAR:
- *nextTokPtr = ptr;
- return XML_TOK_POUND_NAME;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return -XML_TOK_POUND_NAME;
-}
-
-static int FASTCALL
-PREFIX(scanLit)(int open, const ENCODING *enc,
- const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- while (ptr != end) {
- int t = BYTE_TYPE(enc, ptr);
- switch (t) {
- INVALID_CASES(ptr, nextTokPtr)
- case BT_QUOT:
- case BT_APOS:
- ptr += MINBPC(enc);
- if (t != open)
- break;
- if (ptr == end)
- return -XML_TOK_LITERAL;
- *nextTokPtr = ptr;
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_S: case BT_CR: case BT_LF:
- case BT_GT: case BT_PERCNT: case BT_LSQB:
- return XML_TOK_LITERAL;
- default:
- return XML_TOK_INVALID;
- }
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-static int FASTCALL
-PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- int tok;
- if (ptr == end)
- return XML_TOK_NONE;
- if (MINBPC(enc) > 1) {
- size_t n = end - ptr;
- if (n & (MINBPC(enc) - 1)) {
- n &= ~(MINBPC(enc) - 1);
- if (n == 0)
- return XML_TOK_PARTIAL;
- end = ptr + n;
- }
- }
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_QUOT:
- return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_APOS:
- return PREFIX(scanLit)(BT_APOS, enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_LT:
- {
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_EXCL:
- return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_QUEST:
- return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_NMSTRT:
- case BT_HEX:
- case BT_NONASCII:
- case BT_LEAD2:
- case BT_LEAD3:
- case BT_LEAD4:
- *nextTokPtr = ptr - MINBPC(enc);
- return XML_TOK_INSTANCE_START;
- }
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- case BT_CR:
- if (ptr + MINBPC(enc) == end) {
- *nextTokPtr = end;
- /* indicate that this might be part of a CR/LF pair */
- return -XML_TOK_PROLOG_S;
- }
- /* fall through */
- case BT_S: case BT_LF:
- for (;;) {
- ptr += MINBPC(enc);
- if (ptr == end)
- break;
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_S: case BT_LF:
- break;
- case BT_CR:
- /* don't split CR/LF pair */
- if (ptr + MINBPC(enc) != end)
- break;
- /* fall through */
- default:
- *nextTokPtr = ptr;
- return XML_TOK_PROLOG_S;
- }
- }
- *nextTokPtr = ptr;
- return XML_TOK_PROLOG_S;
- case BT_PERCNT:
- return PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_COMMA:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_COMMA;
- case BT_LSQB:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_OPEN_BRACKET;
- case BT_RSQB:
- ptr += MINBPC(enc);
- if (ptr == end)
- return -XML_TOK_CLOSE_BRACKET;
- if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) {
- if (ptr + MINBPC(enc) == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) {
- *nextTokPtr = ptr + 2*MINBPC(enc);
- return XML_TOK_COND_SECT_CLOSE;
- }
- }
- *nextTokPtr = ptr;
- return XML_TOK_CLOSE_BRACKET;
- case BT_LPAR:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_OPEN_PAREN;
- case BT_RPAR:
- ptr += MINBPC(enc);
- if (ptr == end)
- return -XML_TOK_CLOSE_PAREN;
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_AST:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_CLOSE_PAREN_ASTERISK;
- case BT_QUEST:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_CLOSE_PAREN_QUESTION;
- case BT_PLUS:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_CLOSE_PAREN_PLUS;
- case BT_CR: case BT_LF: case BT_S:
- case BT_GT: case BT_COMMA: case BT_VERBAR:
- case BT_RPAR:
- *nextTokPtr = ptr;
- return XML_TOK_CLOSE_PAREN;
- }
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- case BT_VERBAR:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_OR;
- case BT_GT:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_DECL_CLOSE;
- case BT_NUM:
- return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr);
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: \
- if (end - ptr < n) \
- return XML_TOK_PARTIAL_CHAR; \
- if (IS_NMSTRT_CHAR(enc, ptr, n)) { \
- ptr += n; \
- tok = XML_TOK_NAME; \
- break; \
- } \
- if (IS_NAME_CHAR(enc, ptr, n)) { \
- ptr += n; \
- tok = XML_TOK_NMTOKEN; \
- break; \
- } \
- *nextTokPtr = ptr; \
- return XML_TOK_INVALID;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_NMSTRT:
- case BT_HEX:
- tok = XML_TOK_NAME;
- ptr += MINBPC(enc);
- break;
- case BT_DIGIT:
- case BT_NAME:
- case BT_MINUS:
-#ifdef XML_NS
- case BT_COLON:
-#endif
- tok = XML_TOK_NMTOKEN;
- ptr += MINBPC(enc);
- break;
- case BT_NONASCII:
- if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) {
- ptr += MINBPC(enc);
- tok = XML_TOK_NAME;
- break;
- }
- if (IS_NAME_CHAR_MINBPC(enc, ptr)) {
- ptr += MINBPC(enc);
- tok = XML_TOK_NMTOKEN;
- break;
- }
- /* fall through */
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
- case BT_GT: case BT_RPAR: case BT_COMMA:
- case BT_VERBAR: case BT_LSQB: case BT_PERCNT:
- case BT_S: case BT_CR: case BT_LF:
- *nextTokPtr = ptr;
- return tok;
-#ifdef XML_NS
- case BT_COLON:
- ptr += MINBPC(enc);
- switch (tok) {
- case XML_TOK_NAME:
- if (ptr == end)
- return XML_TOK_PARTIAL;
- tok = XML_TOK_PREFIXED_NAME;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
- default:
- tok = XML_TOK_NMTOKEN;
- break;
- }
- break;
- case XML_TOK_PREFIXED_NAME:
- tok = XML_TOK_NMTOKEN;
- break;
- }
- break;
-#endif
- case BT_PLUS:
- if (tok == XML_TOK_NMTOKEN) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_NAME_PLUS;
- case BT_AST:
- if (tok == XML_TOK_NMTOKEN) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_NAME_ASTERISK;
- case BT_QUEST:
- if (tok == XML_TOK_NMTOKEN) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_NAME_QUESTION;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return -tok;
-}
-
-static int FASTCALL
-PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr,
- const char *end, const char **nextTokPtr)
-{
- const char *start;
- if (ptr == end)
- return XML_TOK_NONE;
- start = ptr;
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: ptr += n; break;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_AMP:
- if (ptr == start)
- return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- case BT_LT:
- /* this is for inside entity references */
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- case BT_LF:
- if (ptr == start) {
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_DATA_NEWLINE;
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- case BT_CR:
- if (ptr == start) {
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_TRAILING_CR;
- if (BYTE_TYPE(enc, ptr) == BT_LF)
- ptr += MINBPC(enc);
- *nextTokPtr = ptr;
- return XML_TOK_DATA_NEWLINE;
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- case BT_S:
- if (ptr == start) {
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_ATTRIBUTE_VALUE_S;
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
-}
-
-static int FASTCALL
-PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr,
- const char *end, const char **nextTokPtr)
-{
- const char *start;
- if (ptr == end)
- return XML_TOK_NONE;
- start = ptr;
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: ptr += n; break;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_AMP:
- if (ptr == start)
- return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- case BT_PERCNT:
- if (ptr == start) {
- int tok = PREFIX(scanPercent)(enc, ptr + MINBPC(enc),
- end, nextTokPtr);
- return (tok == XML_TOK_PERCENT) ? XML_TOK_INVALID : tok;
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- case BT_LF:
- if (ptr == start) {
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_DATA_NEWLINE;
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- case BT_CR:
- if (ptr == start) {
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_TRAILING_CR;
- if (BYTE_TYPE(enc, ptr) == BT_LF)
- ptr += MINBPC(enc);
- *nextTokPtr = ptr;
- return XML_TOK_DATA_NEWLINE;
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
-}
-
-#ifdef XML_DTD
-
-static int FASTCALL
-PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr,
- const char *end, const char **nextTokPtr)
-{
- int level = 0;
- if (MINBPC(enc) > 1) {
- size_t n = end - ptr;
- if (n & (MINBPC(enc) - 1)) {
- n &= ~(MINBPC(enc) - 1);
- end = ptr + n;
- }
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- INVALID_CASES(ptr, nextTokPtr)
- case BT_LT:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) {
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) {
- ++level;
- ptr += MINBPC(enc);
- }
- }
- break;
- case BT_RSQB:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) {
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- ptr += MINBPC(enc);
- if (level == 0) {
- *nextTokPtr = ptr;
- return XML_TOK_IGNORE_SECT;
- }
- --level;
- }
- }
- break;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-#endif /* XML_DTD */
-
-static int FASTCALL
-PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
- const char **badPtr)
-{
- ptr += MINBPC(enc);
- end -= MINBPC(enc);
- for (; ptr != end; ptr += MINBPC(enc)) {
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_DIGIT:
- case BT_HEX:
- case BT_MINUS:
- case BT_APOS:
- case BT_LPAR:
- case BT_RPAR:
- case BT_PLUS:
- case BT_COMMA:
- case BT_SOL:
- case BT_EQUALS:
- case BT_QUEST:
- case BT_CR:
- case BT_LF:
- case BT_SEMI:
- case BT_EXCL:
- case BT_AST:
- case BT_PERCNT:
- case BT_NUM:
-#ifdef XML_NS
- case BT_COLON:
-#endif
- break;
- case BT_S:
- if (CHAR_MATCHES(enc, ptr, ASCII_TAB)) {
- *badPtr = ptr;
- return 0;
- }
- break;
- case BT_NAME:
- case BT_NMSTRT:
- if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f))
- break;
- default:
- switch (BYTE_TO_ASCII(enc, ptr)) {
- case 0x24: /* $ */
- case 0x40: /* @ */
- break;
- default:
- *badPtr = ptr;
- return 0;
- }
- break;
- }
- }
- return 1;
-}
-
-/* This must only be called for a well-formed start-tag or empty
- element tag. Returns the number of attributes. Pointers to the
- first attsMax attributes are stored in atts.
-*/
-
-static int FASTCALL
-PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
- int attsMax, ATTRIBUTE *atts)
-{
- enum { other, inName, inValue } state = inName;
- int nAtts = 0;
- int open = 0; /* defined when state == inValue;
- initialization just to shut up compilers */
-
- for (ptr += MINBPC(enc);; ptr += MINBPC(enc)) {
- switch (BYTE_TYPE(enc, ptr)) {
-#define START_NAME \
- if (state == other) { \
- if (nAtts < attsMax) { \
- atts[nAtts].name = ptr; \
- atts[nAtts].normalized = 1; \
- } \
- state = inName; \
- }
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: START_NAME ptr += (n - MINBPC(enc)); break;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_NONASCII:
- case BT_NMSTRT:
- case BT_HEX:
- START_NAME
- break;
-#undef START_NAME
- case BT_QUOT:
- if (state != inValue) {
- if (nAtts < attsMax)
- atts[nAtts].valuePtr = ptr + MINBPC(enc);
- state = inValue;
- open = BT_QUOT;
- }
- else if (open == BT_QUOT) {
- state = other;
- if (nAtts < attsMax)
- atts[nAtts].valueEnd = ptr;
- nAtts++;
- }
- break;
- case BT_APOS:
- if (state != inValue) {
- if (nAtts < attsMax)
- atts[nAtts].valuePtr = ptr + MINBPC(enc);
- state = inValue;
- open = BT_APOS;
- }
- else if (open == BT_APOS) {
- state = other;
- if (nAtts < attsMax)
- atts[nAtts].valueEnd = ptr;
- nAtts++;
- }
- break;
- case BT_AMP:
- if (nAtts < attsMax)
- atts[nAtts].normalized = 0;
- break;
- case BT_S:
- if (state == inName)
- state = other;
- else if (state == inValue
- && nAtts < attsMax
- && atts[nAtts].normalized
- && (ptr == atts[nAtts].valuePtr
- || BYTE_TO_ASCII(enc, ptr) != ASCII_SPACE
- || BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ASCII_SPACE
- || BYTE_TYPE(enc, ptr + MINBPC(enc)) == open))
- atts[nAtts].normalized = 0;
- break;
- case BT_CR: case BT_LF:
- /* This case ensures that the first attribute name is counted
- Apart from that we could just change state on the quote. */
- if (state == inName)
- state = other;
- else if (state == inValue && nAtts < attsMax)
- atts[nAtts].normalized = 0;
- break;
- case BT_GT:
- case BT_SOL:
- if (state != inValue)
- return nAtts;
- break;
- default:
- break;
- }
- }
- /* not reached */
-}
-
-static int FASTCALL
-PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
-{
- int result = 0;
- /* skip &# */
- ptr += 2*MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_x)) {
- for (ptr += MINBPC(enc);
- !CHAR_MATCHES(enc, ptr, ASCII_SEMI);
- ptr += MINBPC(enc)) {
- int c = BYTE_TO_ASCII(enc, ptr);
- switch (c) {
- case ASCII_0: case ASCII_1: case ASCII_2: case ASCII_3: case ASCII_4:
- case ASCII_5: case ASCII_6: case ASCII_7: case ASCII_8: case ASCII_9:
- result <<= 4;
- result |= (c - ASCII_0);
- break;
- case ASCII_A: case ASCII_B: case ASCII_C:
- case ASCII_D: case ASCII_E: case ASCII_F:
- result <<= 4;
- result += 10 + (c - ASCII_A);
- break;
- case ASCII_a: case ASCII_b: case ASCII_c:
- case ASCII_d: case ASCII_e: case ASCII_f:
- result <<= 4;
- result += 10 + (c - ASCII_a);
- break;
- }
- if (result >= 0x110000)
- return -1;
- }
- }
- else {
- for (; !CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) {
- int c = BYTE_TO_ASCII(enc, ptr);
- result *= 10;
- result += (c - ASCII_0);
- if (result >= 0x110000)
- return -1;
- }
- }
- return checkCharRefNumber(result);
-}
-
-static int FASTCALL
-PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr,
- const char *end)
-{
- switch ((end - ptr)/MINBPC(enc)) {
- case 2:
- if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_t)) {
- switch (BYTE_TO_ASCII(enc, ptr)) {
- case ASCII_l:
- return ASCII_LT;
- case ASCII_g:
- return ASCII_GT;
- }
- }
- break;
- case 3:
- if (CHAR_MATCHES(enc, ptr, ASCII_a)) {
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_m)) {
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_p))
- return ASCII_AMP;
- }
- }
- break;
- case 4:
- switch (BYTE_TO_ASCII(enc, ptr)) {
- case ASCII_q:
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_u)) {
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_o)) {
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_t))
- return ASCII_QUOT;
- }
- }
- break;
- case ASCII_a:
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_p)) {
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_o)) {
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_s))
- return ASCII_APOS;
- }
- }
- break;
- }
- }
- return 0;
-}
-
-static int FASTCALL
-PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
-{
- for (;;) {
- switch (BYTE_TYPE(enc, ptr1)) {
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: \
- if (*ptr1++ != *ptr2++) \
- return 0;
- LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2)
-#undef LEAD_CASE
- /* fall through */
- if (*ptr1++ != *ptr2++)
- return 0;
- break;
- case BT_NONASCII:
- case BT_NMSTRT:
-#ifdef XML_NS
- case BT_COLON:
-#endif
- case BT_HEX:
- case BT_DIGIT:
- case BT_NAME:
- case BT_MINUS:
- if (*ptr2++ != *ptr1++)
- return 0;
- if (MINBPC(enc) > 1) {
- if (*ptr2++ != *ptr1++)
- return 0;
- if (MINBPC(enc) > 2) {
- if (*ptr2++ != *ptr1++)
- return 0;
- if (MINBPC(enc) > 3) {
- if (*ptr2++ != *ptr1++)
- return 0;
- }
- }
- }
- break;
- default:
- if (MINBPC(enc) == 1 && *ptr1 == *ptr2)
- return 1;
- switch (BYTE_TYPE(enc, ptr2)) {
- case BT_LEAD2:
- case BT_LEAD3:
- case BT_LEAD4:
- case BT_NONASCII:
- case BT_NMSTRT:
-#ifdef XML_NS
- case BT_COLON:
-#endif
- case BT_HEX:
- case BT_DIGIT:
- case BT_NAME:
- case BT_MINUS:
- return 0;
- default:
- return 1;
- }
- }
- }
- /* not reached */
-}
-
-static int FASTCALL
-PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1,
- const char *end1, const char *ptr2)
-{
- for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) {
- if (ptr1 == end1)
- return 0;
- if (!CHAR_MATCHES(enc, ptr1, *ptr2))
- return 0;
- }
- return ptr1 == end1;
-}
-
-static int FASTCALL
-PREFIX(nameLength)(const ENCODING *enc, const char *ptr)
-{
- const char *start = ptr;
- for (;;) {
- switch (BYTE_TYPE(enc, ptr)) {
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: ptr += n; break;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_NONASCII:
- case BT_NMSTRT:
-#ifdef XML_NS
- case BT_COLON:
-#endif
- case BT_HEX:
- case BT_DIGIT:
- case BT_NAME:
- case BT_MINUS:
- ptr += MINBPC(enc);
- break;
- default:
- return ptr - start;
- }
- }
-}
-
-static const char * FASTCALL
-PREFIX(skipS)(const ENCODING *enc, const char *ptr)
-{
- for (;;) {
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_LF:
- case BT_CR:
- case BT_S:
- ptr += MINBPC(enc);
- break;
- default:
- return ptr;
- }
- }
-}
-
-static void FASTCALL
-PREFIX(updatePosition)(const ENCODING *enc,
- const char *ptr,
- const char *end,
- POSITION *pos)
-{
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: \
- ptr += n; \
- break;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_LF:
- pos->columnNumber = (unsigned)-1;
- pos->lineNumber++;
- ptr += MINBPC(enc);
- break;
- case BT_CR:
- pos->lineNumber++;
- ptr += MINBPC(enc);
- if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF)
- ptr += MINBPC(enc);
- pos->columnNumber = (unsigned)-1;
- break;
- default:
- ptr += MINBPC(enc);
- break;
- }
- pos->columnNumber++;
- }
-}
-
-#undef DO_LEAD_CASE
-#undef MULTIBYTE_CASES
-#undef INVALID_CASES
-#undef CHECK_NAME_CASE
-#undef CHECK_NAME_CASES
-#undef CHECK_NMSTRT_CASE
-#undef CHECK_NMSTRT_CASES
diff --git a/bundle/expat/xmltok_impl.h b/bundle/expat/xmltok_impl.h
deleted file mode 100644
index da0ea60a65..0000000000
--- a/bundle/expat/xmltok_impl.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
-*/
-
-enum {
- BT_NONXML,
- BT_MALFORM,
- BT_LT,
- BT_AMP,
- BT_RSQB,
- BT_LEAD2,
- BT_LEAD3,
- BT_LEAD4,
- BT_TRAIL,
- BT_CR,
- BT_LF,
- BT_GT,
- BT_QUOT,
- BT_APOS,
- BT_EQUALS,
- BT_QUEST,
- BT_EXCL,
- BT_SOL,
- BT_SEMI,
- BT_NUM,
- BT_LSQB,
- BT_S,
- BT_NMSTRT,
- BT_COLON,
- BT_HEX,
- BT_DIGIT,
- BT_NAME,
- BT_MINUS,
- BT_OTHER, /* known not to be a name or name start character */
- BT_NONASCII, /* might be a name or name start character */
- BT_PERCNT,
- BT_LPAR,
- BT_RPAR,
- BT_AST,
- BT_PLUS,
- BT_COMMA,
- BT_VERBAR
-};
-
-#include <stddef.h>
diff --git a/bundle/expat/xmltok_ns.c b/bundle/expat/xmltok_ns.c
deleted file mode 100644
index 011cb8f0c5..0000000000
--- a/bundle/expat/xmltok_ns.c
+++ /dev/null
@@ -1,106 +0,0 @@
-const ENCODING *
-NS(XmlGetUtf8InternalEncoding)(void)
-{
- return &ns(internal_utf8_encoding).enc;
-}
-
-const ENCODING *
-NS(XmlGetUtf16InternalEncoding)(void)
-{
-#if BYTEORDER == 1234
- return &ns(internal_little2_encoding).enc;
-#elif BYTEORDER == 4321
- return &ns(internal_big2_encoding).enc;
-#else
- const short n = 1;
- return (*(const char *)&n
- ? &ns(internal_little2_encoding).enc
- : &ns(internal_big2_encoding).enc);
-#endif
-}
-
-static const ENCODING *NS(encodings)[] = {
- &ns(latin1_encoding).enc,
- &ns(ascii_encoding).enc,
- &ns(utf8_encoding).enc,
- &ns(big2_encoding).enc,
- &ns(big2_encoding).enc,
- &ns(little2_encoding).enc,
- &ns(utf8_encoding).enc /* NO_ENC */
-};
-
-static int FASTCALL
-NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- return initScan(NS(encodings), (const INIT_ENCODING *)enc,
- XML_PROLOG_STATE, ptr, end, nextTokPtr);
-}
-
-static int FASTCALL
-NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- return initScan(NS(encodings), (const INIT_ENCODING *)enc,
- XML_CONTENT_STATE, ptr, end, nextTokPtr);
-}
-
-int
-NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr,
- const char *name)
-{
- int i = getEncodingIndex(name);
- if (i == UNKNOWN_ENC)
- return 0;
- SET_INIT_ENC_INDEX(p, i);
- p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog);
- p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent);
- p->initEnc.updatePosition = initUpdatePosition;
- p->encPtr = encPtr;
- *encPtr = &(p->initEnc);
- return 1;
-}
-
-static const ENCODING *
-NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end)
-{
-#define ENCODING_MAX 128
- char buf[ENCODING_MAX];
- char *p = buf;
- int i;
- XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);
- if (ptr != end)
- return 0;
- *p = 0;
- if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2)
- return enc;
- i = getEncodingIndex(buf);
- if (i == UNKNOWN_ENC)
- return 0;
- return NS(encodings)[i];
-}
-
-int
-NS(XmlParseXmlDecl)(int isGeneralTextEntity,
- const ENCODING *enc,
- const char *ptr,
- const char *end,
- const char **badPtr,
- const char **versionPtr,
- const char **versionEndPtr,
- const char **encodingName,
- const ENCODING **encoding,
- int *standalone)
-{
- return doParseXmlDecl(NS(findEncoding),
- isGeneralTextEntity,
- enc,
- ptr,
- end,
- badPtr,
- versionPtr,
- versionEndPtr,
- encodingName,
- encoding,
- standalone);
-}
diff --git a/bundle/libxml/DOCBparser.c b/bundle/libxml/DOCBparser.c
deleted file mode 100644
index f84a0be450..0000000000
--- a/bundle/libxml/DOCBparser.c
+++ /dev/null
@@ -1,6107 +0,0 @@
-/*
- * DOCBparser.c : an attempt to parse SGML Docbook documents
- *
- * This is extremely hackish. It also adds one extension
- * <?sgml-declaration encoding="ISO-8859-1"?>
- * allowing to store the encoding of the document within the instance.
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-#ifdef LIBXML_DOCB_ENABLED
-
-#include <string.h>
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_ZLIB_H
-#include <zlib.h>
-#endif
-
-#include <libxml/xmlmemory.h>
-#include <libxml/tree.h>
-#include <libxml/SAX.h>
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-#include <libxml/xmlerror.h>
-#include <libxml/DOCBparser.h>
-#include <libxml/entities.h>
-#include <libxml/encoding.h>
-#include <libxml/valid.h>
-#include <libxml/xmlIO.h>
-#include <libxml/uri.h>
-#include <libxml/globals.h>
-
-/*
- * DocBook XML current versions
- */
-
-#define XML_DOCBOOK_XML_PUBLIC (const xmlChar *) \
- "-//OASIS//DTD DocBook XML V4.1.2//EN"
-#define XML_DOCBOOK_XML_SYSTEM (const xmlChar *) \
- "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
-
-/*
- * Internal description of an SGML entity
- */
-typedef struct _docbEntityDesc docbEntityDesc;
-typedef docbEntityDesc *docbEntityDescPtr;
-struct _docbEntityDesc {
- int value; /* the UNICODE value for the character */
- const char *name; /* The entity name */
- const char *desc; /* the description */
-};
-
-static int docbParseCharRef(docbParserCtxtPtr ctxt);
-static xmlEntityPtr docbParseEntityRef(docbParserCtxtPtr ctxt,
- xmlChar **str);
-static void docbParseElement(docbParserCtxtPtr ctxt);
-static void docbParseContent(docbParserCtxtPtr ctxt);
-
-/*
- * Internal description of an SGML element
- */
-typedef struct _docbElemDesc docbElemDesc;
-typedef docbElemDesc *docbElemDescPtr;
-struct _docbElemDesc {
- const char *name; /* The tag name */
- int startTag; /* Whether the start tag can be implied */
- int endTag; /* Whether the end tag can be implied */
- int empty; /* Is this an empty element ? */
- int depr; /* Is this a deprecated element ? */
- int dtd; /* 1: only in Loose DTD, 2: only Frameset one */
- const char *desc; /* the description */
-};
-
-
-#define DOCB_MAX_NAMELEN 1000
-#define DOCB_PARSER_BIG_BUFFER_SIZE 1000
-#define DOCB_PARSER_BUFFER_SIZE 100
-
-/* #define DEBUG */
-/* #define DEBUG_PUSH */
-
-/************************************************************************
- * *
- * Parser stacks related functions and macros *
- * *
- ************************************************************************/
-
-/**
- * docbnamePush:
- * @ctxt: a DocBook SGML parser context
- * @value: the element name
- *
- * Pushes a new element name on top of the name stack
- *
- * Returns 0 in case of error, the index in the stack otherwise
- */
-static int
-docbnamePush(docbParserCtxtPtr ctxt, xmlChar * value)
-{
- if (ctxt->nameNr >= ctxt->nameMax) {
- ctxt->nameMax *= 2;
- ctxt->nameTab =
- (xmlChar * *)xmlRealloc(ctxt->nameTab,
- ctxt->nameMax *
- sizeof(ctxt->nameTab[0]));
- if (ctxt->nameTab == NULL) {
- xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
- return (0);
- }
- }
- ctxt->nameTab[ctxt->nameNr] = value;
- ctxt->name = value;
- return (ctxt->nameNr++);
-}
-/**
- * docbnamePop:
- * @ctxt: a DocBook SGML parser context
- *
- * Pops the top element name from the name stack
- *
- * Returns the name just removed
- */
-static xmlChar *
-docbnamePop(docbParserCtxtPtr ctxt)
-{
- xmlChar *ret;
-
- if (ctxt->nameNr < 0)
- return (0);
- ctxt->nameNr--;
- if (ctxt->nameNr < 0)
- return (0);
- if (ctxt->nameNr > 0)
- ctxt->name = ctxt->nameTab[ctxt->nameNr - 1];
- else
- ctxt->name = NULL;
- ret = ctxt->nameTab[ctxt->nameNr];
- ctxt->nameTab[ctxt->nameNr] = 0;
- return (ret);
-}
-
-/*
- * Macros for accessing the content. Those should be used only by the parser,
- * and not exported.
- *
- * Dirty macros, i.e. one need to make assumption on the context to use them
- *
- * CUR_PTR return the current pointer to the xmlChar to be parsed.
- * CUR returns the current xmlChar value, i.e. a 8 bit value if compiled
- * in ISO-Latin or UTF-8, and the current 16 bit value if compiled
- * in UNICODE mode. This should be used internally by the parser
- * only to compare to ASCII values otherwise it would break when
- * running with UTF-8 encoding.
- * NXT(n) returns the n'th next xmlChar. Same as CUR is should be used only
- * to compare on ASCII based substring.
- * UPP(n) returns the n'th next xmlChar converted to uppercase. Same as CUR
- * it should be used only to compare on ASCII based substring.
- * SKIP(n) Skip n xmlChar, and must also be used only to skip ASCII defined
- * strings within the parser.
- *
- * Clean macros, not dependent of an ASCII context, expect UTF-8 encoding
- *
- * CURRENT Returns the current char value, with the full decoding of
- * UTF-8 if we are using this mode. It returns an int.
- * NEXT Skip to the next character, this does the proper decoding
- * in UTF-8 mode. It also pop-up unfinished entities on the fly.
- * COPY(to) copy one char to *to, increment CUR_PTR and to accordingly
- */
-
-#define UPPER (toupper(*ctxt->input->cur))
-
-#define SKIP(val) ctxt->nbChars += (val),ctxt->input->cur += (val)
-
-#define NXT(val) ctxt->input->cur[(val)]
-
-#define UPP(val) (toupper(ctxt->input->cur[(val)]))
-
-#define CUR_PTR ctxt->input->cur
-
-#define SHRINK xmlParserInputShrink(ctxt->input)
-
-#define GROW xmlParserInputGrow(ctxt->input, INPUT_CHUNK)
-
-#define CURRENT ((int) (*ctxt->input->cur))
-
-#define SKIP_BLANKS docbSkipBlankChars(ctxt)
-
-/* Imported from XML */
-
-/* #define CUR (ctxt->token ? ctxt->token : (int) (*ctxt->input->cur)) */
-#define CUR ((int) (*ctxt->input->cur))
-#define NEXT xmlNextChar(ctxt),ctxt->nbChars++
-
-#define RAW (ctxt->token ? -1 : (*ctxt->input->cur))
-#define NXT(val) ctxt->input->cur[(val)]
-#define CUR_PTR ctxt->input->cur
-
-
-#define NEXTL(l) do { \
- if (*(ctxt->input->cur) == '\n') { \
- ctxt->input->line++; ctxt->input->col = 1; \
- } else ctxt->input->col++; \
- ctxt->token = 0; ctxt->input->cur += l; ctxt->nbChars++; \
- } while (0)
-
-/************
- \
- if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \
- if (*ctxt->input->cur == '&') xmlParserHandleReference(ctxt);
- ************/
-
-#define CUR_CHAR(l) docbCurrentChar(ctxt, &l)
-#define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l)
-
-#define COPY_BUF(l,b,i,v) \
- if (l == 1) b[i++] = (xmlChar) v; \
- else i += xmlCopyChar(l,&b[i],v)
-
-/**
- * docbCurrentChar:
- * @ctxt: the DocBook SGML parser context
- * @len: pointer to the length of the char read
- *
- * The current char value, if using UTF-8 this may actually span multiple
- * bytes in the input buffer. Implement the end of line normalization:
- * 2.11 End-of-Line Handling
- * If the encoding is unspecified, in the case we find an ISO-Latin-1
- * char, then the encoding converter is plugged in automatically.
- *
- * Returns the current char value and its length
- */
-
-static int
-docbCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
- if (ctxt->instate == XML_PARSER_EOF)
- return(0);
-
- if (ctxt->token != 0) {
- *len = 0;
- return(ctxt->token);
- }
- if (ctxt->charset == XML_CHAR_ENCODING_UTF8) {
- /*
- * We are supposed to handle UTF8, check it's valid
- * From rfc2044: encoding of the Unicode values on UTF-8:
- *
- * UCS-4 range (hex.) UTF-8 octet sequence (binary)
- * 0000 0000-0000 007F 0xxxxxxx
- * 0000 0080-0000 07FF 110xxxxx 10xxxxxx
- * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx
- *
- * Check for the 0x110000 limit too
- */
- const unsigned char *cur = ctxt->input->cur;
- unsigned char c;
- unsigned int val;
-
- c = *cur;
- if (c & 0x80) {
- if (cur[1] == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- if ((cur[1] & 0xc0) != 0x80)
- goto encoding_error;
- if ((c & 0xe0) == 0xe0) {
-
- if (cur[2] == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- if ((cur[2] & 0xc0) != 0x80)
- goto encoding_error;
- if ((c & 0xf0) == 0xf0) {
- if (cur[3] == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- if (((c & 0xf8) != 0xf0) ||
- ((cur[3] & 0xc0) != 0x80))
- goto encoding_error;
- /* 4-byte code */
- *len = 4;
- val = (cur[0] & 0x7) << 18;
- val |= (cur[1] & 0x3f) << 12;
- val |= (cur[2] & 0x3f) << 6;
- val |= cur[3] & 0x3f;
- } else {
- /* 3-byte code */
- *len = 3;
- val = (cur[0] & 0xf) << 12;
- val |= (cur[1] & 0x3f) << 6;
- val |= cur[2] & 0x3f;
- }
- } else {
- /* 2-byte code */
- *len = 2;
- val = (cur[0] & 0x1f) << 6;
- val |= cur[1] & 0x3f;
- }
- if (!IS_CHAR(val)) {
- ctxt->errNo = XML_ERR_INVALID_ENCODING;
- if ((ctxt->sax != NULL) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Char 0x%X out of allowed range\n", val);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- return(val);
- } else {
- /* 1-byte code */
- *len = 1;
- return((int) *ctxt->input->cur);
- }
- }
- /*
- * Assume it's a fixed length encoding (1) with
- * a compatible encoding for the ASCII set, since
- * XML constructs only use < 128 chars
- */
- *len = 1;
- if ((int) *ctxt->input->cur < 0x80)
- return((int) *ctxt->input->cur);
-
- /*
- * Humm this is bad, do an automatic flow conversion
- */
- xmlSwitchEncoding(ctxt, XML_CHAR_ENCODING_8859_1);
- ctxt->charset = XML_CHAR_ENCODING_UTF8;
- return(xmlCurrentChar(ctxt, len));
-
-encoding_error:
- /*
- * If we detect an UTF8 error that probably mean that the
- * input encoding didn't get properly advertized in the
- * declaration header. Report the error and switch the encoding
- * to ISO-Latin-1 (if you don't like this policy, just declare the
- * encoding !)
- */
- ctxt->errNo = XML_ERR_INVALID_ENCODING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) {
- ctxt->sax->error(ctxt->userData,
- "Input is not proper UTF-8, indicate encoding !\n");
- ctxt->sax->error(ctxt->userData, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
- ctxt->input->cur[0], ctxt->input->cur[1],
- ctxt->input->cur[2], ctxt->input->cur[3]);
- }
-
- ctxt->charset = XML_CHAR_ENCODING_8859_1;
- *len = 1;
- return((int) *ctxt->input->cur);
-}
-
-#if 0
-/**
- * sgmlNextChar:
- * @ctxt: the DocBook SGML parser context
- *
- * Skip to the next char input char.
- */
-
-static void
-sgmlNextChar(docbParserCtxtPtr ctxt) {
- if (ctxt->instate == XML_PARSER_EOF)
- return;
- if ((*ctxt->input->cur == 0) &&
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) {
- xmlPopInput(ctxt);
- } else {
- if (*(ctxt->input->cur) == '\n') {
- ctxt->input->line++; ctxt->input->col = 1;
- } else ctxt->input->col++;
- ctxt->input->cur++;
- ctxt->nbChars++;
- if (*ctxt->input->cur == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- }
-}
-#endif
-
-/**
- * docbSkipBlankChars:
- * @ctxt: the DocBook SGML parser context
- *
- * skip all blanks character found at that point in the input streams.
- *
- * Returns the number of space chars skipped
- */
-
-static int
-docbSkipBlankChars(xmlParserCtxtPtr ctxt) {
- int res = 0;
-
- while (IS_BLANK(*(ctxt->input->cur))) {
- if ((*ctxt->input->cur == 0) &&
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) {
- xmlPopInput(ctxt);
- } else {
- if (*(ctxt->input->cur) == '\n') {
- ctxt->input->line++; ctxt->input->col = 1;
- } else ctxt->input->col++;
- ctxt->input->cur++;
- ctxt->nbChars++;
- if (*ctxt->input->cur == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- }
- res++;
- }
- return(res);
-}
-
-
-
-/************************************************************************
- * *
- * The list of SGML elements and their properties *
- * *
- ************************************************************************/
-
-/*
- * Start Tag: 1 means the start tag can be ommited
- * End Tag: 1 means the end tag can be ommited
- * 2 means it's forbidden (empty elements)
- * Depr: this element is deprecated
- * DTD: 1 means that this element is valid only in the Loose DTD
- * 2 means that this element is valid only in the Frameset DTD
- *
- * Name,Start Tag,End Tag, Empty, Depr., DTD, Description
- */
-static docbElemDesc
-docbookElementTable[] = {
-{ "abbrev", 0, 0, 0, 3, 0, "" }, /* word */
-{ "abstract", 0, 0, 0, 9, 0, "" }, /* title */
-{ "accel", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "ackno", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "acronym", 0, 0, 0, 3, 0, "" }, /* word */
-{ "action", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "address", 0, 0, 0, 1, 0, "" },
-{ "affiliation",0, 0, 0, 9, 0, "" }, /* shortaffil */
-{ "alt", 0, 0, 0, 1, 0, "" },
-{ "anchor", 0, 2, 1, 0, 0, "" },
-{ "answer", 0, 0, 0, 9, 0, "" }, /* label */
-{ "appendix", 0, 0, 0, 9, 0, "" }, /* appendixinfo */
-{ "appendixinfo",0, 0, 0, 9, 0, "" }, /* graphic */
-{ "application",0, 0, 0, 2, 0, "" }, /* para */
-{ "area", 0, 2, 1, 0, 0, "" },
-{ "areaset", 0, 0, 0, 9, 0, "" }, /* area */
-{ "areaspec", 0, 0, 0, 9, 0, "" }, /* area */
-{ "arg", 0, 0, 0, 1, 0, "" },
-{ "artheader", 0, 0, 0, 9, 0, "" },
-{ "article", 0, 0, 0, 9, 0, "" }, /* div.title.content */
-{ "articleinfo",0, 0, 0, 9, 0, "" }, /* graphic */
-{ "artpagenums",0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "attribution",0, 0, 0, 2, 0, "" }, /* para */
-{ "audiodata", 0, 2, 1, 0, 0, "" },
-{ "audioobject",0, 0, 0, 9, 0, "" }, /* objectinfo */
-{ "authorblurb",0, 0, 0, 9, 0, "" }, /* title */
-{ "authorgroup",0, 0, 0, 9, 0, "" }, /* author */
-{ "authorinitials",0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "author", 0, 0, 0, 9, 0, "" }, /* person.ident.mix */
-{ "beginpage", 0, 2, 1, 0, 0, "" },
-{ "bibliodiv", 0, 0, 0, 9, 0, "" }, /* sect.title.content */
-{ "biblioentry",0, 0, 0, 9, 0, "" }, /* articleinfo */
-{ "bibliography",0, 0, 0, 9, 0, "" }, /* bibliographyinfo */
-{ "bibliographyinfo",0, 0, 0, 9, 0, "" }, /* graphic */
-{ "bibliomisc", 0, 0, 0, 2, 0, "" }, /* para */
-{ "bibliomixed",0, 0, 0, 1, 0, "" }, /* %bibliocomponent.mix, bibliomset) */
-{ "bibliomset", 0, 0, 0, 1, 0, "" }, /* %bibliocomponent.mix; | bibliomset) */
-{ "biblioset", 0, 0, 0, 9, 0, "" }, /* bibliocomponent.mix */
-{ "blockquote", 0, 0, 0, 9, 0, "" }, /* title */
-{ "book", 0, 0, 0, 9, 0, "" }, /* div.title.content */
-{ "bookinfo", 0, 0, 0, 9, 0, "" }, /* graphic */
-{ "bridgehead", 0, 0, 0, 8, 0, "" }, /* title */
-{ "callout", 0, 0, 0, 9, 0, "" }, /* component.mix */
-{ "calloutlist",0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
-{ "caption", 0, 0, 0, 9, 0, "" }, /* textobject.mix */
-{ "caution", 0, 0, 0, 9, 0, "" }, /* title */
-{ "chapter", 0, 0, 0, 9, 0, "" }, /* chapterinfo */
-{ "chapterinfo",0, 0, 0, 9, 0, "" }, /* graphic */
-{ "citation", 0, 0, 0, 2, 0, "" }, /* para */
-{ "citerefentry",0, 0, 0, 9, 0, "" }, /* refentrytitle */
-{ "citetitle", 0, 0, 0, 2, 0, "" }, /* para */
-{ "city", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "classname", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "classsynopsisinfo",0,0, 0, 9, 0, "" }, /* cptr */
-{ "classsynopsis",0, 0, 0, 9, 0, "" }, /* ooclass */
-{ "cmdsynopsis",0, 0, 0, 9, 0, "" }, /* command */
-{ "co", 0, 2, 1, 0, 0, "" },
-{ "collab", 0, 0, 0, 9, 0, "" }, /* collabname */
-{ "collabname", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "colophon", 0, 0, 0, 9, 0, "" }, /* sect.title.content */
-{ "colspec", 0, 2, 1, 0, 0, "" },
-{ "colspec", 0, 2, 1, 0, 0, "" },
-{ "command", 0, 0, 0, 9, 0, "" }, /* cptr */
-{ "computeroutput",0, 0, 0, 9, 0, "" }, /* cptr */
-{ "confdates", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "confgroup", 0, 0, 0, 9, 0, "" }, /* confdates */
-{ "confnum", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "confsponsor",0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "conftitle", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "constant", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "constructorsynopsis",0,0, 0, 9, 0, "" }, /* modifier */
-{ "contractnum",0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "contractsponsor",0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "contrib", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "copyright", 0, 0, 0, 9, 0, "" }, /* year */
-{ "corpauthor", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "corpname", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "country", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "database", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "date", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "dedication", 0, 0, 0, 9, 0, "" }, /* sect.title.content */
-{ "destructorsynopsis",0,0, 0, 9, 0, "" }, /* modifier */
-{ "docinfo", 0, 0, 0, 9, 0, "" },
-{ "edition", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "editor", 0, 0, 0, 9, 0, "" }, /* person.ident.mix */
-{ "email", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "emphasis", 0, 0, 0, 2, 0, "" }, /* para */
-{ "entry", 0, 0, 0, 9, 0, "" }, /* tbl.entry.mdl */
-{ "entrytbl", 0, 0, 0, 9, 0, "" }, /* tbl.entrytbl.mdl */
-{ "envar", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "epigraph", 0, 0, 0, 9, 0, "" }, /* attribution */
-{ "equation", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
-{ "errorcode", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "errorname", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "errortype", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "example", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
-{ "exceptionname",0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "fax", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "fieldsynopsis", 0, 0, 0, 9, 0, "" }, /* modifier */
-{ "figure", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
-{ "filename", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "firstname", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "firstterm", 0, 0, 0, 3, 0, "" }, /* word */
-{ "footnote", 0, 0, 0, 9, 0, "" }, /* footnote.mix */
-{ "footnoteref",0, 2, 1, 0, 0, "" },
-{ "foreignphrase",0, 0, 0, 2, 0, "" }, /* para */
-{ "formalpara", 0, 0, 0, 9, 0, "" }, /* title */
-{ "funcdef", 0, 0, 0, 1, 0, "" },
-{ "funcparams", 0, 0, 0, 9, 0, "" }, /* cptr */
-{ "funcprototype",0, 0, 0, 9, 0, "" }, /* funcdef */
-{ "funcsynopsis",0, 0, 0, 9, 0, "" }, /* funcsynopsisinfo */
-{ "funcsynopsisinfo", 0, 0, 0, 9, 0, "" }, /* cptr */
-{ "function", 0, 0, 0, 9, 0, "" }, /* cptr */
-{ "glossary", 0, 0, 0, 9, 0, "" }, /* glossaryinfo */
-{ "glossaryinfo",0, 0, 0, 9, 0, "" }, /* graphic */
-{ "glossdef", 0, 0, 0, 9, 0, "" }, /* glossdef.mix */
-{ "glossdiv", 0, 0, 0, 9, 0, "" }, /* sect.title.content */
-{ "glossentry", 0, 0, 0, 9, 0, "" }, /* glossterm */
-{ "glosslist", 0, 0, 0, 9, 0, "" }, /* glossentry */
-{ "glossseealso",0, 0, 1, 2, 0, "" }, /* para */
-{ "glosssee", 0, 0, 1, 2, 0, "" }, /* para */
-{ "glossterm", 0, 0, 0, 2, 0, "" }, /* para */
-{ "graphic", 0, 0, 0, 9, 0, "" },
-{ "graphicco", 0, 0, 0, 9, 0, "" }, /* areaspec */
-{ "group", 0, 0, 0, 9, 0, "" }, /* arg */
-{ "guibutton", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "guiicon", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "guilabel", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "guimenuitem",0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "guimenu", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "guisubmenu", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "hardware", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "highlights", 0, 0, 0, 9, 0, "" }, /* highlights.mix */
-{ "holder", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "honorific", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "imagedata", 0, 2, 1, 0, 0, "" },
-{ "imageobjectco",0, 0, 0, 9, 0, "" }, /* areaspec */
-{ "imageobject",0, 0, 0, 9, 0, "" }, /* objectinfo */
-{ "important", 0, 0, 0, 9, 0, "" }, /* title */
-{ "indexdiv", 0, 0, 0, 9, 0, "" }, /* sect.title.content */
-{ "indexentry", 0, 0, 0, 9, 0, "" }, /* primaryie */
-{ "index", 0, 0, 0, 9, 0, "" }, /* indexinfo */
-{ "indexinfo", 0, 0, 0, 9, 0, "" }, /* graphic */
-{ "indexterm", 0, 0, 0, 9, 0, "" }, /* primary */
-{ "informalequation",0, 0, 0, 9, 0, "" }, /* equation.content */
-{ "informalexample",0, 0, 0, 9, 0, "" }, /* example.mix */
-{ "informalfigure",0, 0, 0, 9, 0, "" }, /* figure.mix */
-{ "informaltable",0, 0, 0, 9, 0, "" }, /* graphic */
-{ "initializer",0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "inlineequation",0, 0, 0, 9, 0, "" }, /* inlineequation.content */
-{ "inlinegraphic",0, 0, 0, 9, 0, "" },
-{ "inlinemediaobject",0,0, 0, 9, 0, "" }, /* objectinfo */
-{ "interfacename",0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "interface", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "invpartnumber",0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "isbn", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "issn", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "issuenum", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "itemizedlist",0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
-{ "itermset", 0, 0, 0, 9, 0, "" }, /* indexterm */
-{ "jobtitle", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "keycap", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "keycode", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "keycombo", 0, 0, 0, 9, 0, "" }, /* keycap */
-{ "keysym", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "keyword", 0, 0, 0, 1, 0, "" },
-{ "keywordset", 0, 0, 0, 9, 0, "" }, /* keyword */
-{ "label", 0, 0, 0, 3, 0, "" }, /* word */
-{ "legalnotice",0, 0, 0, 9, 0, "" }, /* title */
-{ "lineage", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "lineannotation",0, 0, 0, 2, 0, "" }, /* para */
-{ "link", 0, 0, 0, 2, 0, "" }, /* para */
-{ "listitem", 0, 0, 0, 9, 0, "" }, /* component.mix */
-{ "literal", 0, 0, 0, 9, 0, "" }, /* cptr */
-{ "literallayout",0, 0, 0, 2, 0, "" }, /* para */
-{ "lot", 0, 0, 0, 9, 0, "" }, /* bookcomponent.title.content */
-{ "lotentry", 0, 0, 0, 2, 0, "" }, /* para */
-{ "manvolnum", 0, 0, 0, 3, 0, "" }, /* word */
-{ "markup", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "medialabel", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "mediaobjectco",0, 0, 0, 9, 0, "" }, /* objectinfo */
-{ "mediaobject",0, 0, 0, 9, 0, "" }, /* objectinfo */
-{ "member", 0, 0, 0, 2, 0, "" }, /* para */
-{ "menuchoice", 0, 0, 0, 9, 0, "" }, /* shortcut */
-{ "methodname", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "methodparam",0, 0, 0, 9, 0, "" }, /* modifier */
-{ "methodsynopsis",0, 0, 0, 9, 0, "" }, /* modifier */
-{ "modespec", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "modifier", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "mousebutton",0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "msgaud", 0, 0, 0, 2, 0, "" }, /* para */
-{ "msgentry", 0, 0, 0, 9, 0, "" }, /* msg */
-{ "msgexplan", 0, 0, 0, 9, 0, "" }, /* title */
-{ "msginfo", 0, 0, 0, 9, 0, "" }, /* msglevel */
-{ "msglevel", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "msgmain", 0, 0, 0, 9, 0, "" }, /* title */
-{ "msgorig", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "msgrel", 0, 0, 0, 9, 0, "" }, /* title */
-{ "msgset", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
-{ "msgsub", 0, 0, 0, 9, 0, "" }, /* title */
-{ "msgtext", 0, 0, 0, 9, 0, "" }, /* component.mix */
-{ "msg", 0, 0, 0, 9, 0, "" }, /* title */
-{ "note", 0, 0, 0, 9, 0, "" }, /* title */
-{ "objectinfo", 0, 0, 0, 9, 0, "" }, /* graphic */
-{ "olink", 0, 0, 0, 2, 0, "" }, /* para */
-{ "ooclass", 0, 0, 0, 9, 0, "" }, /* modifier */
-{ "ooexception",0, 0, 0, 9, 0, "" }, /* modifier */
-{ "oointerface",0, 0, 0, 9, 0, "" }, /* modifier */
-{ "optional", 0, 0, 0, 9, 0, "" }, /* cptr */
-{ "option", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "orderedlist",0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
-{ "orgdiv", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "orgname", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "otheraddr", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "othercredit",0, 0, 0, 9, 0, "" }, /* person.ident.mix */
-{ "othername", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "pagenums", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "paramdef", 0, 0, 0, 1, 0, "" },
-{ "parameter", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "para", 0, 0, 0, 2, 0, "" }, /* para */
-{ "partinfo", 0, 0, 0, 9, 0, "" }, /* graphic */
-{ "partintro", 0, 0, 0, 9, 0, "" }, /* div.title.content */
-{ "part", 0, 0, 0, 9, 0, "" }, /* partinfo */
-{ "phone", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "phrase", 0, 0, 0, 2, 0, "" }, /* para */
-{ "pob", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "postcode", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "prefaceinfo",0, 0, 0, 9, 0, "" }, /* graphic */
-{ "preface", 0, 0, 0, 9, 0, "" }, /* prefaceinfo */
-{ "primaryie", 0, 0, 0, 4, 0, "" }, /* ndxterm */
-{ "primary", 0, 0, 0, 9, 0, "" }, /* ndxterm */
-{ "printhistory",0, 0, 0, 9, 0, "" }, /* para.class */
-{ "procedure", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
-{ "productname",0, 0, 0, 2, 0, "" }, /* para */
-{ "productnumber",0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "programlistingco",0, 0, 0, 9, 0, "" }, /* areaspec */
-{ "programlisting",0, 0, 0, 2, 0, "" }, /* para */
-{ "prompt", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "property", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "pubdate", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "publishername",0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "publisher", 0, 0, 0, 9, 0, "" }, /* publishername */
-{ "pubsnumber", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "qandadiv", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
-{ "qandaentry", 0, 0, 0, 9, 0, "" }, /* revhistory */
-{ "qandaset", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
-{ "question", 0, 0, 0, 9, 0, "" }, /* label */
-{ "quote", 0, 0, 0, 2, 0, "" }, /* para */
-{ "refclass", 0, 0, 0, 9, 0, "" }, /* refclass.char.mix */
-{ "refdescriptor",0, 0, 0, 9, 0, "" }, /* refname.char.mix */
-{ "refentryinfo",0, 0, 0, 9, 0, "" }, /* graphic */
-{ "refentry", 0, 0, 0, 9, 0, "" }, /* ndxterm.class */
-{ "refentrytitle",0, 0, 0, 2, 0, "" }, /* para */
-{ "referenceinfo",0, 0, 0, 9, 0, "" }, /* graphic */
-{ "reference", 0, 0, 0, 9, 0, "" }, /* referenceinfo */
-{ "refmeta", 0, 0, 0, 9, 0, "" }, /* ndxterm.class */
-{ "refmiscinfo",0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "refnamediv", 0, 0, 0, 9, 0, "" }, /* refdescriptor */
-{ "refname", 0, 0, 0, 9, 0, "" }, /* refname.char.mix */
-{ "refpurpose", 0, 0, 0, 9, 0, "" }, /* refinline.char.mix */
-{ "refsect1info",0, 0, 0, 9, 0, "" }, /* graphic */
-{ "refsect1", 0, 0, 0, 9, 0, "" }, /* refsect */
-{ "refsect2info",0, 0, 0, 9, 0, "" }, /* graphic */
-{ "refsect2", 0, 0, 0, 9, 0, "" }, /* refsect */
-{ "refsect3info",0, 0, 0, 9, 0, "" }, /* graphic */
-{ "refsect3", 0, 0, 0, 9, 0, "" }, /* refsect */
-{ "refsynopsisdivinfo",0,0, 0, 9, 0, "" }, /* graphic */
-{ "refsynopsisdiv",0, 0, 0, 9, 0, "" }, /* refsynopsisdivinfo */
-{ "releaseinfo",0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "remark", 0, 0, 0, 2, 0, "" }, /* para */
-{ "replaceable",0, 0, 0, 1, 0, "" },
-{ "returnvalue",0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "revdescription",0, 0, 0, 9, 0, "" }, /* revdescription.mix */
-{ "revhistory", 0, 0, 0, 9, 0, "" }, /* revision */
-{ "revision", 0, 0, 0, 9, 0, "" }, /* revnumber */
-{ "revnumber", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "revremark", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "row", 0, 0, 0, 9, 0, "" }, /* tbl.row.mdl */
-{ "row", 0, 0, 0, 9, 0, "" }, /* tbl.row.mdl */
-{ "sbr", 0, 2, 1, 0, 0, "" },
-{ "screenco", 0, 0, 0, 9, 0, "" }, /* areaspec */
-{ "screeninfo", 0, 0, 0, 2, 0, "" }, /* para */
-{ "screen", 0, 0, 0, 2, 0, "" }, /* para */
-{ "screenshot", 0, 0, 0, 9, 0, "" }, /* screeninfo */
-{ "secondaryie",0, 0, 0, 4, 0, "" }, /* ndxterm */
-{ "secondary", 0, 0, 0, 4, 0, "" }, /* ndxterm */
-{ "sect1info", 0, 0, 0, 9, 0, "" }, /* graphic */
-{ "sect1", 0, 0, 0, 9, 0, "" }, /* sect */
-{ "sect2info", 0, 0, 0, 9, 0, "" }, /* graphic */
-{ "sect2", 0, 0, 0, 9, 0, "" }, /* sect */
-{ "sect3info", 0, 0, 0, 9, 0, "" }, /* graphic */
-{ "sect3", 0, 0, 0, 9, 0, "" }, /* sect */
-{ "sect4info", 0, 0, 0, 9, 0, "" }, /* graphic */
-{ "sect4", 0, 0, 0, 9, 0, "" }, /* sect */
-{ "sect5info", 0, 0, 0, 9, 0, "" }, /* graphic */
-{ "sect5", 0, 0, 0, 9, 0, "" }, /* sect */
-{ "sectioninfo",0, 0, 0, 9, 0, "" }, /* graphic */
-{ "section", 0, 0, 0, 9, 0, "" }, /* sectioninfo */
-{ "seealsoie", 0, 0, 0, 4, 0, "" }, /* ndxterm */
-{ "seealso", 0, 0, 0, 4, 0, "" }, /* ndxterm */
-{ "seeie", 0, 0, 0, 4, 0, "" }, /* ndxterm */
-{ "see", 0, 0, 0, 4, 0, "" }, /* ndxterm */
-{ "seglistitem",0, 0, 0, 9, 0, "" }, /* seg */
-{ "segmentedlist",0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
-{ "seg", 0, 0, 0, 2, 0, "" }, /* para */
-{ "segtitle", 0, 0, 0, 8, 0, "" }, /* title */
-{ "seriesvolnums", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "set", 0, 0, 0, 9, 0, "" }, /* div.title.content */
-{ "setindexinfo",0, 0, 0, 9, 0, "" }, /* graphic */
-{ "setindex", 0, 0, 0, 9, 0, "" }, /* setindexinfo */
-{ "setinfo", 0, 0, 0, 9, 0, "" }, /* graphic */
-{ "sgmltag", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "shortaffil", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "shortcut", 0, 0, 0, 9, 0, "" }, /* keycap */
-{ "sidebarinfo",0, 0, 0, 9, 0, "" }, /* graphic */
-{ "sidebar", 0, 0, 0, 9, 0, "" }, /* sidebarinfo */
-{ "simpara", 0, 0, 0, 2, 0, "" }, /* para */
-{ "simplelist", 0, 0, 0, 9, 0, "" }, /* member */
-{ "simplemsgentry", 0, 0, 0, 9, 0, "" }, /* msgtext */
-{ "simplesect", 0, 0, 0, 9, 0, "" }, /* sect.title.content */
-{ "spanspec", 0, 2, 1, 0, 0, "" },
-{ "state", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "step", 0, 0, 0, 9, 0, "" }, /* title */
-{ "street", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "structfield",0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "structname", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "subjectset", 0, 0, 0, 9, 0, "" }, /* subject */
-{ "subject", 0, 0, 0, 9, 0, "" }, /* subjectterm */
-{ "subjectterm",0, 0, 0, 1, 0, "" },
-{ "subscript", 0, 0, 0, 1, 0, "" },
-{ "substeps", 0, 0, 0, 9, 0, "" }, /* step */
-{ "subtitle", 0, 0, 0, 8, 0, "" }, /* title */
-{ "superscript", 0, 0, 0, 1, 0, "" },
-{ "surname", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "symbol", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "synopfragment", 0, 0, 0, 9, 0, "" }, /* arg */
-{ "synopfragmentref", 0, 0, 0, 1, 0, "" },
-{ "synopsis", 0, 0, 0, 2, 0, "" }, /* para */
-{ "systemitem", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "table", 0, 0, 0, 9, 0, "" }, /* tbl.table.mdl */
-/* { "%tbl.table.name;", 0, 0, 0, 9, 0, "" },*/ /* tbl.table.mdl */
-{ "tbody", 0, 0, 0, 9, 0, "" }, /* row */
-{ "tbody", 0, 0, 0, 9, 0, "" }, /* row */
-{ "term", 0, 0, 0, 2, 0, "" }, /* para */
-{ "tertiaryie", 0, 0, 0, 4, 0, "" }, /* ndxterm */
-{ "tertiary ", 0, 0, 0, 4, 0, "" }, /* ndxterm */
-{ "textobject", 0, 0, 0, 9, 0, "" }, /* objectinfo */
-{ "tfoot", 0, 0, 0, 9, 0, "" }, /* tbl.hdft.mdl */
-{ "tgroup", 0, 0, 0, 9, 0, "" }, /* tbl.tgroup.mdl */
-{ "tgroup", 0, 0, 0, 9, 0, "" }, /* tbl.tgroup.mdl */
-{ "thead", 0, 0, 0, 9, 0, "" }, /* row */
-{ "thead", 0, 0, 0, 9, 0, "" }, /* tbl.hdft.mdl */
-{ "tip", 0, 0, 0, 9, 0, "" }, /* title */
-{ "titleabbrev",0, 0, 0, 8, 0, "" }, /* title */
-{ "title", 0, 0, 0, 8, 0, "" }, /* title */
-{ "tocback", 0, 0, 0, 2, 0, "" }, /* para */
-{ "toc", 0, 0, 0, 9, 0, "" }, /* bookcomponent.title.content */
-{ "tocchap", 0, 0, 0, 9, 0, "" }, /* tocentry */
-{ "tocentry", 0, 0, 0, 2, 0, "" }, /* para */
-{ "tocfront", 0, 0, 0, 2, 0, "" }, /* para */
-{ "toclevel1", 0, 0, 0, 9, 0, "" }, /* tocentry */
-{ "toclevel2", 0, 0, 0, 9, 0, "" }, /* tocentry */
-{ "toclevel3", 0, 0, 0, 9, 0, "" }, /* tocentry */
-{ "toclevel4", 0, 0, 0, 9, 0, "" }, /* tocentry */
-{ "toclevel5", 0, 0, 0, 9, 0, "" }, /* tocentry */
-{ "tocpart", 0, 0, 0, 9, 0, "" }, /* tocentry */
-{ "token", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "trademark", 0, 0, 0, 1, 0, "" },
-{ "type", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "ulink", 0, 0, 0, 2, 0, "" }, /* para */
-{ "userinput", 0, 0, 0, 9, 0, "" }, /* cptr */
-{ "varargs", 0, 2, 1, 0, 0, "" },
-{ "variablelist",0, 0, 0, 9, 0, "" }, /* formalobject.title.content */
-{ "varlistentry",0, 0, 0, 9, 0, "" }, /* term */
-{ "varname", 0, 0, 0, 7, 0, "" }, /* smallcptr */
-{ "videodata", 0, 2, 1, 0, 0, "" },
-{ "videoobject",0, 0, 0, 9, 0, "" }, /* objectinfo */
-{ "void", 0, 2, 1, 0, 0, "" },
-{ "volumenum", 0, 0, 0, 4, 0, "" }, /* docinfo */
-{ "warning", 0, 0, 0, 9, 0, "" }, /* title */
-{ "wordasword", 0, 0, 0, 3, 0, "" }, /* word */
-{ "xref", 0, 2, 1, 0, 0, "" },
-{ "year", 0, 0, 0, 4, 0, "" }, /* docinfo */
-};
-
-#if 0
-/*
- * start tags that imply the end of a current element
- * any tag of each line implies the end of the current element if the type of
- * that element is in the same line
- */
-static const char *docbEquEnd[] = {
-"dt", "dd", "li", "option", NULL,
-"h1", "h2", "h3", "h4", "h5", "h6", NULL,
-"ol", "menu", "dir", "address", "pre", "listing", "xmp", NULL,
-NULL
-};
-#endif
-
-/*
- * according the SGML DTD, HR should be added to the 2nd line above, as it
- * is not allowed within a H1, H2, H3, etc. But we should tolerate that case
- * because many documents contain rules in headings...
- */
-
-/*
- * start tags that imply the end of current element
- */
-static const char *docbStartClose[] = {
-NULL
-};
-
-static const char** docbStartCloseIndex[100];
-static int docbStartCloseIndexinitialized = 0;
-
-/************************************************************************
- * *
- * functions to handle SGML specific data *
- * *
- ************************************************************************/
-
-/**
- * docbInitAutoClose:
- *
- * Initialize the docbStartCloseIndex for fast lookup of closing tags names.
- *
- */
-static void
-docbInitAutoClose(void) {
- int indx, i = 0;
-
- if (docbStartCloseIndexinitialized) return;
-
- for (indx = 0;indx < 100;indx ++) docbStartCloseIndex[indx] = NULL;
- indx = 0;
- while ((docbStartClose[i] != NULL) && (indx < 100 - 1)) {
- docbStartCloseIndex[indx++] = &docbStartClose[i];
- while (docbStartClose[i] != NULL) i++;
- i++;
- }
-}
-
-/**
- * docbTagLookup:
- * @tag: The tag name
- *
- * Lookup the SGML tag in the ElementTable
- *
- * Returns the related docbElemDescPtr or NULL if not found.
- */
-static docbElemDescPtr
-docbTagLookup(const xmlChar *tag) {
- unsigned int i;
-
- for (i = 0; i < (sizeof(docbookElementTable) /
- sizeof(docbookElementTable[0]));i++) {
- if (xmlStrEqual(tag, BAD_CAST docbookElementTable[i].name))
- return(&docbookElementTable[i]);
- }
- return(NULL);
-}
-
-/**
- * docbCheckAutoClose:
- * @newtag: The new tag name
- * @oldtag: The old tag name
- *
- * Checks whether the new tag is one of the registered valid tags for
- * closing old.
- * Initialize the docbStartCloseIndex for fast lookup of closing tags names.
- *
- * Returns 0 if no, 1 if yes.
- */
-static int
-docbCheckAutoClose(const xmlChar *newtag, const xmlChar *oldtag) {
- int i, indx;
- const char **closed = NULL;
-
- if (docbStartCloseIndexinitialized == 0) docbInitAutoClose();
-
- /* inefficient, but not a big deal */
- for (indx = 0; indx < 100;indx++) {
- closed = docbStartCloseIndex[indx];
- if (closed == NULL) return(0);
- if (xmlStrEqual(BAD_CAST *closed, newtag)) break;
- }
-
- i = closed - docbStartClose;
- i++;
- while (docbStartClose[i] != NULL) {
- if (xmlStrEqual(BAD_CAST docbStartClose[i], oldtag)) {
- return(1);
- }
- i++;
- }
- return(0);
-}
-
-/**
- * docbAutoCloseOnClose:
- * @ctxt: an SGML parser context
- * @newtag: The new tag name
- *
- * The DocBook DTD allows an ending tag to implicitly close other tags.
- */
-static void
-docbAutoCloseOnClose(docbParserCtxtPtr ctxt, const xmlChar *newtag) {
- docbElemDescPtr info;
- xmlChar *oldname;
- int i;
-
- if ((newtag[0] == '/') && (newtag[1] == 0))
- return;
-
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"Close of %s stack: %d elements\n", newtag, ctxt->nameNr);
- for (i = 0;i < ctxt->nameNr;i++)
- xmlGenericError(xmlGenericErrorContext,"%d : %s\n", i, ctxt->nameTab[i]);
-#endif
-
- for (i = (ctxt->nameNr - 1);i >= 0;i--) {
- if (xmlStrEqual(newtag, ctxt->nameTab[i])) break;
- }
- if (i < 0) return;
-
- while (!xmlStrEqual(newtag, ctxt->name)) {
- info = docbTagLookup(ctxt->name);
- if ((info == NULL) || (info->endTag == 1)) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"docbAutoCloseOnClose: %s closes %s\n", newtag, ctxt->name);
-#endif
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Opening and ending tag mismatch: %s and %s\n",
- newtag, ctxt->name);
- ctxt->wellFormed = 0;
- }
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, ctxt->name);
- oldname = docbnamePop(ctxt);
- if (oldname != NULL) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"docbAutoCloseOnClose: popped %s\n", oldname);
-#endif
- xmlFree(oldname);
- }
- }
-}
-
-/**
- * docbAutoClose:
- * @ctxt: an SGML parser context
- * @newtag: The new tag name or NULL
- *
- * The DocBook DTD allows a tag to implicitly close other tags.
- * The list is kept in docbStartClose array. This function is
- * called when a new tag has been detected and generates the
- * appropriates closes if possible/needed.
- * If newtag is NULL this mean we are at the end of the resource
- * and we should check
- */
-static void
-docbAutoClose(docbParserCtxtPtr ctxt, const xmlChar *newtag) {
- xmlChar *oldname;
- while ((newtag != NULL) && (ctxt->name != NULL) &&
- (docbCheckAutoClose(newtag, ctxt->name))) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"docbAutoClose: %s closes %s\n", newtag, ctxt->name);
-#endif
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, ctxt->name);
- oldname = docbnamePop(ctxt);
- if (oldname != NULL) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"docbAutoClose: popped %s\n", oldname);
-#endif
- xmlFree(oldname);
- }
- }
-}
-
-/**
- * docbAutoCloseTag:
- * @doc: the SGML document
- * @name: The tag name
- * @elem: the SGML element
- *
- * The DocBook DTD allows a tag to implicitly close other tags.
- * The list is kept in docbStartClose array. This function checks
- * if the element or one of it's children would autoclose the
- * given tag.
- *
- * Returns 1 if autoclose, 0 otherwise
- */
-static int
-docbAutoCloseTag(docbDocPtr doc, const xmlChar *name, docbNodePtr elem) {
- docbNodePtr child;
-
- if (elem == NULL) return(1);
- if (xmlStrEqual(name, elem->name)) return(0);
- if (docbCheckAutoClose(elem->name, name)) return(1);
- child = elem->children;
- while (child != NULL) {
- if (docbAutoCloseTag(doc, name, child)) return(1);
- child = child->next;
- }
- return(0);
-}
-
-/************************************************************************
- * *
- * The list of SGML predefined entities *
- * *
- ************************************************************************/
-
-
-static docbEntityDesc
-docbookEntitiesTable[] = {
-/*
- * the 4 absolute ones, plus apostrophe.
- */
-{ 0x0026, "amp", "AMPERSAND" },
-{ 0x003C, "lt", "LESS-THAN SIGN" },
-
-/*
- * Converted with VI macros from docbook ent files
- */
-{ 0x0021, "excl", "EXCLAMATION MARK" },
-{ 0x0022, "quot", "QUOTATION MARK" },
-{ 0x0023, "num", "NUMBER SIGN" },
-{ 0x0024, "dollar", "DOLLAR SIGN" },
-{ 0x0025, "percnt", "PERCENT SIGN" },
-{ 0x0027, "apos", "APOSTROPHE" },
-{ 0x0028, "lpar", "LEFT PARENTHESIS" },
-{ 0x0029, "rpar", "RIGHT PARENTHESIS" },
-{ 0x002A, "ast", "ASTERISK OPERATOR" },
-{ 0x002B, "plus", "PLUS SIGN" },
-{ 0x002C, "comma", "COMMA" },
-{ 0x002D, "hyphen", "HYPHEN-MINUS" },
-{ 0x002E, "period", "FULL STOP" },
-{ 0x002F, "sol", "SOLIDUS" },
-{ 0x003A, "colon", "COLON" },
-{ 0x003B, "semi", "SEMICOLON" },
-{ 0x003D, "equals", "EQUALS SIGN" },
-{ 0x003E, "gt", "GREATER-THAN SIGN" },
-{ 0x003F, "quest", "QUESTION MARK" },
-{ 0x0040, "commat", "COMMERCIAL AT" },
-{ 0x005B, "lsqb", "LEFT SQUARE BRACKET" },
-{ 0x005C, "bsol", "REVERSE SOLIDUS" },
-{ 0x005D, "rsqb", "RIGHT SQUARE BRACKET" },
-{ 0x005E, "circ", "RING OPERATOR" },
-{ 0x005F, "lowbar", "LOW LINE" },
-{ 0x0060, "grave", "GRAVE ACCENT" },
-{ 0x007B, "lcub", "LEFT CURLY BRACKET" },
-{ 0x007C, "verbar", "VERTICAL LINE" },
-{ 0x007D, "rcub", "RIGHT CURLY BRACKET" },
-{ 0x00A0, "nbsp", "NO-BREAK SPACE" },
-{ 0x00A1, "iexcl", "INVERTED EXCLAMATION MARK" },
-{ 0x00A2, "cent", "CENT SIGN" },
-{ 0x00A3, "pound", "POUND SIGN" },
-{ 0x00A4, "curren", "CURRENCY SIGN" },
-{ 0x00A5, "yen", "YEN SIGN" },
-{ 0x00A6, "brvbar", "BROKEN BAR" },
-{ 0x00A7, "sect", "SECTION SIGN" },
-{ 0x00A8, "die", "" },
-{ 0x00A8, "Dot", "" },
-{ 0x00A8, "uml", "" },
-{ 0x00A9, "copy", "COPYRIGHT SIGN" },
-{ 0x00AA, "ordf", "FEMININE ORDINAL INDICATOR" },
-{ 0x00AB, "laquo", "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK" },
-{ 0x00AC, "not", "NOT SIGN" },
-{ 0x00AD, "shy", "SOFT HYPHEN" },
-{ 0x00AE, "reg", "REG TRADE MARK SIGN" },
-{ 0x00AF, "macr", "MACRON" },
-{ 0x00B0, "deg", "DEGREE SIGN" },
-{ 0x00B1, "plusmn", "PLUS-MINUS SIGN" },
-{ 0x00B2, "sup2", "SUPERSCRIPT TWO" },
-{ 0x00B3, "sup3", "SUPERSCRIPT THREE" },
-{ 0x00B4, "acute", "ACUTE ACCENT" },
-{ 0x00B5, "micro", "MICRO SIGN" },
-{ 0x00B6, "para", "PILCROW SIGN" },
-{ 0x00B7, "middot", "MIDDLE DOT" },
-{ 0x00B8, "cedil", "CEDILLA" },
-{ 0x00B9, "sup1", "SUPERSCRIPT ONE" },
-{ 0x00BA, "ordm", "MASCULINE ORDINAL INDICATOR" },
-{ 0x00BB, "raquo", "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK" },
-{ 0x00BC, "frac14", "VULGAR FRACTION ONE QUARTER" },
-{ 0x00BD, "frac12", "VULGAR FRACTION ONE HALF" },
-{ 0x00BD, "half", "VULGAR FRACTION ONE HALF" },
-{ 0x00BE, "frac34", "VULGAR FRACTION THREE QUARTERS" },
-{ 0x00BF, "iquest", "INVERTED QUESTION MARK" },
-{ 0x00C0, "Agrave", "LATIN CAPITAL LETTER A WITH GRAVE" },
-{ 0x00C1, "Aacute", "LATIN CAPITAL LETTER A WITH ACUTE" },
-{ 0x00C2, "Acirc", "LATIN CAPITAL LETTER A WITH CIRCUMFLEX" },
-{ 0x00C3, "Atilde", "LATIN CAPITAL LETTER A WITH TILDE" },
-{ 0x00C4, "Auml", "LATIN CAPITAL LETTER A WITH DIAERESIS" },
-{ 0x00C5, "Aring", "LATIN CAPITAL LETTER A WITH RING ABOVE" },
-{ 0x00C6, "AElig", "LATIN CAPITAL LETTER AE" },
-{ 0x00C7, "Ccedil", "LATIN CAPITAL LETTER C WITH CEDILLA" },
-{ 0x00C8, "Egrave", "LATIN CAPITAL LETTER E WITH GRAVE" },
-{ 0x00C9, "Eacute", "LATIN CAPITAL LETTER E WITH ACUTE" },
-{ 0x00CA, "Ecirc", "LATIN CAPITAL LETTER E WITH CIRCUMFLEX" },
-{ 0x00CB, "Euml", "LATIN CAPITAL LETTER E WITH DIAERESIS" },
-{ 0x00CC, "Igrave", "LATIN CAPITAL LETTER I WITH GRAVE" },
-{ 0x00CD, "Iacute", "LATIN CAPITAL LETTER I WITH ACUTE" },
-{ 0x00CE, "Icirc", "LATIN CAPITAL LETTER I WITH CIRCUMFLEX" },
-{ 0x00CF, "Iuml", "LATIN CAPITAL LETTER I WITH DIAERESIS" },
-{ 0x00D0, "ETH", "LATIN CAPITAL LETTER ETH" },
-{ 0x00D1, "Ntilde", "LATIN CAPITAL LETTER N WITH TILDE" },
-{ 0x00D2, "Ograve", "LATIN CAPITAL LETTER O WITH GRAVE" },
-{ 0x00D3, "Oacute", "LATIN CAPITAL LETTER O WITH ACUTE" },
-{ 0x00D4, "Ocirc", "LATIN CAPITAL LETTER O WITH CIRCUMFLEX" },
-{ 0x00D5, "Otilde", "LATIN CAPITAL LETTER O WITH TILDE" },
-{ 0x00D6, "Ouml", "LATIN CAPITAL LETTER O WITH DIAERESIS" },
-{ 0x00D7, "times", "MULTIPLICATION SIGN" },
-{ 0x00D8, "Oslash", "LATIN CAPITAL LETTER O WITH STROKE" },
-{ 0x00D9, "Ugrave", "LATIN CAPITAL LETTER U WITH GRAVE" },
-{ 0x00DA, "Uacute", "LATIN CAPITAL LETTER U WITH ACUTE" },
-{ 0x00DB, "Ucirc", "LATIN CAPITAL LETTER U WITH CIRCUMFLEX" },
-{ 0x00DC, "Uuml", "LATIN CAPITAL LETTER U WITH DIAERESIS" },
-{ 0x00DD, "Yacute", "LATIN CAPITAL LETTER Y WITH ACUTE" },
-{ 0x00DE, "THORN", "LATIN CAPITAL LETTER THORN" },
-{ 0x00DF, "szlig", "LATIN SMALL LETTER SHARP S" },
-{ 0x00E0, "agrave", "LATIN SMALL LETTER A WITH GRAVE" },
-{ 0x00E1, "aacute", "LATIN SMALL LETTER A WITH ACUTE" },
-{ 0x00E2, "acirc", "LATIN SMALL LETTER A WITH CIRCUMFLEX" },
-{ 0x00E3, "atilde", "LATIN SMALL LETTER A WITH TILDE" },
-{ 0x00E4, "auml", "LATIN SMALL LETTER A WITH DIAERESIS" },
-{ 0x00E5, "aring", "LATIN SMALL LETTER A WITH RING ABOVE" },
-{ 0x00E6, "aelig", "LATIN SMALL LETTER AE" },
-{ 0x00E7, "ccedil", "LATIN SMALL LETTER C WITH CEDILLA" },
-{ 0x00E8, "egrave", "LATIN SMALL LETTER E WITH GRAVE" },
-{ 0x00E9, "eacute", "LATIN SMALL LETTER E WITH ACUTE" },
-{ 0x00EA, "ecirc", "LATIN SMALL LETTER E WITH CIRCUMFLEX" },
-{ 0x00EB, "euml", "LATIN SMALL LETTER E WITH DIAERESIS" },
-{ 0x00EC, "igrave", "LATIN SMALL LETTER I WITH GRAVE" },
-{ 0x00ED, "iacute", "LATIN SMALL LETTER I WITH ACUTE" },
-{ 0x00EE, "icirc", "LATIN SMALL LETTER I WITH CIRCUMFLEX" },
-{ 0x00EF, "iuml", "LATIN SMALL LETTER I WITH DIAERESIS" },
-{ 0x00F0, "eth", "LATIN SMALL LETTER ETH" },
-{ 0x00F1, "ntilde", "LATIN SMALL LETTER N WITH TILDE" },
-{ 0x00F2, "ograve", "LATIN SMALL LETTER O WITH GRAVE" },
-{ 0x00F3, "oacute", "LATIN SMALL LETTER O WITH ACUTE" },
-{ 0x00F4, "ocirc", "LATIN SMALL LETTER O WITH CIRCUMFLEX" },
-{ 0x00F5, "otilde", "LATIN SMALL LETTER O WITH TILDE" },
-{ 0x00F6, "ouml", "LATIN SMALL LETTER O WITH DIAERESIS" },
-{ 0x00F7, "divide", "DIVISION SIGN" },
-{ 0x00F8, "oslash", "CIRCLED DIVISION SLASH" },
-{ 0x00F9, "ugrave", "LATIN SMALL LETTER U WITH GRAVE" },
-{ 0x00FA, "uacute", "LATIN SMALL LETTER U WITH ACUTE" },
-{ 0x00FB, "ucirc", "LATIN SMALL LETTER U WITH CIRCUMFLEX" },
-{ 0x00FC, "uuml", "LATIN SMALL LETTER U WITH DIAERESIS" },
-{ 0x00FD, "yacute", "LATIN SMALL LETTER Y WITH ACUTE" },
-{ 0x00FE, "thorn", "LATIN SMALL LETTER THORN" },
-{ 0x00FF, "yuml", "LATIN SMALL LETTER Y WITH DIAERESIS" },
-{ 0x0100, "Amacr", "LATIN CAPITAL LETTER A WITH MACRON" },
-{ 0x0101, "amacr", "LATIN SMALL LETTER A WITH MACRON" },
-{ 0x0102, "Abreve", "LATIN CAPITAL LETTER A WITH BREVE" },
-{ 0x0103, "abreve", "LATIN SMALL LETTER A WITH BREVE" },
-{ 0x0104, "Aogon", "LATIN CAPITAL LETTER A WITH OGONEK" },
-{ 0x0105, "aogon", "LATIN SMALL LETTER A WITH OGONEK" },
-{ 0x0106, "Cacute", "LATIN CAPITAL LETTER C WITH ACUTE" },
-{ 0x0107, "cacute", "LATIN SMALL LETTER C WITH ACUTE" },
-{ 0x0108, "Ccirc", "LATIN CAPITAL LETTER C WITH CIRCUMFLEX" },
-{ 0x0109, "ccirc", "LATIN SMALL LETTER C WITH CIRCUMFLEX" },
-{ 0x010A, "Cdot", "LATIN CAPITAL LETTER C WITH DOT ABOVE" },
-{ 0x010B, "cdot", "DOT OPERATOR" },
-{ 0x010C, "Ccaron", "LATIN CAPITAL LETTER C WITH CARON" },
-{ 0x010D, "ccaron", "LATIN SMALL LETTER C WITH CARON" },
-{ 0x010E, "Dcaron", "LATIN CAPITAL LETTER D WITH CARON" },
-{ 0x010F, "dcaron", "LATIN SMALL LETTER D WITH CARON" },
-{ 0x0110, "Dstrok", "LATIN CAPITAL LETTER D WITH STROKE" },
-{ 0x0111, "dstrok", "LATIN SMALL LETTER D WITH STROKE" },
-{ 0x0112, "Emacr", "LATIN CAPITAL LETTER E WITH MACRON" },
-{ 0x0113, "emacr", "LATIN SMALL LETTER E WITH MACRON" },
-{ 0x0116, "Edot", "LATIN CAPITAL LETTER E WITH DOT ABOVE" },
-{ 0x0117, "edot", "LATIN SMALL LETTER E WITH DOT ABOVE" },
-{ 0x0118, "Eogon", "LATIN CAPITAL LETTER E WITH OGONEK" },
-{ 0x0119, "eogon", "LATIN SMALL LETTER E WITH OGONEK" },
-{ 0x011A, "Ecaron", "LATIN CAPITAL LETTER E WITH CARON" },
-{ 0x011B, "ecaron", "LATIN SMALL LETTER E WITH CARON" },
-{ 0x011C, "Gcirc", "LATIN CAPITAL LETTER G WITH CIRCUMFLEX" },
-{ 0x011D, "gcirc", "LATIN SMALL LETTER G WITH CIRCUMFLEX" },
-{ 0x011E, "Gbreve", "LATIN CAPITAL LETTER G WITH BREVE" },
-{ 0x011F, "gbreve", "LATIN SMALL LETTER G WITH BREVE" },
-{ 0x0120, "Gdot", "LATIN CAPITAL LETTER G WITH DOT ABOVE" },
-{ 0x0121, "gdot", "LATIN SMALL LETTER G WITH DOT ABOVE" },
-{ 0x0122, "Gcedil", "LATIN CAPITAL LETTER G WITH CEDILLA" },
-{ 0x0124, "Hcirc", "LATIN CAPITAL LETTER H WITH CIRCUMFLEX" },
-{ 0x0125, "hcirc", "LATIN SMALL LETTER H WITH CIRCUMFLEX" },
-{ 0x0126, "Hstrok", "LATIN CAPITAL LETTER H WITH STROKE" },
-{ 0x0127, "hstrok", "LATIN SMALL LETTER H WITH STROKE" },
-{ 0x0128, "Itilde", "LATIN CAPITAL LETTER I WITH TILDE" },
-{ 0x0129, "itilde", "LATIN SMALL LETTER I WITH TILDE" },
-{ 0x012A, "Imacr", "LATIN CAPITAL LETTER I WITH MACRON" },
-{ 0x012B, "imacr", "LATIN SMALL LETTER I WITH MACRON" },
-{ 0x012E, "Iogon", "LATIN CAPITAL LETTER I WITH OGONEK" },
-{ 0x012F, "iogon", "LATIN SMALL LETTER I WITH OGONEK" },
-{ 0x0130, "Idot", "LATIN CAPITAL LETTER I WITH DOT ABOVE" },
-{ 0x0131, "inodot", "LATIN SMALL LETTER DOTLESS I" },
-{ 0x0131, "inodot", "LATIN SMALL LETTER DOTLESS I" },
-{ 0x0132, "IJlig", "LATIN CAPITAL LIGATURE IJ" },
-{ 0x0133, "ijlig", "LATIN SMALL LIGATURE IJ" },
-{ 0x0134, "Jcirc", "LATIN CAPITAL LETTER J WITH CIRCUMFLEX" },
-{ 0x0135, "jcirc", "LATIN SMALL LETTER J WITH CIRCUMFLEX" },
-{ 0x0136, "Kcedil", "LATIN CAPITAL LETTER K WITH CEDILLA" },
-{ 0x0137, "kcedil", "LATIN SMALL LETTER K WITH CEDILLA" },
-{ 0x0138, "kgreen", "LATIN SMALL LETTER KRA" },
-{ 0x0139, "Lacute", "LATIN CAPITAL LETTER L WITH ACUTE" },
-{ 0x013A, "lacute", "LATIN SMALL LETTER L WITH ACUTE" },
-{ 0x013B, "Lcedil", "LATIN CAPITAL LETTER L WITH CEDILLA" },
-{ 0x013C, "lcedil", "LATIN SMALL LETTER L WITH CEDILLA" },
-{ 0x013D, "Lcaron", "LATIN CAPITAL LETTER L WITH CARON" },
-{ 0x013E, "lcaron", "LATIN SMALL LETTER L WITH CARON" },
-{ 0x013F, "Lmidot", "LATIN CAPITAL LETTER L WITH MIDDLE DOT" },
-{ 0x0140, "lmidot", "LATIN SMALL LETTER L WITH MIDDLE DOT" },
-{ 0x0141, "Lstrok", "LATIN CAPITAL LETTER L WITH STROKE" },
-{ 0x0142, "lstrok", "LATIN SMALL LETTER L WITH STROKE" },
-{ 0x0143, "Nacute", "LATIN CAPITAL LETTER N WITH ACUTE" },
-{ 0x0144, "nacute", "LATIN SMALL LETTER N WITH ACUTE" },
-{ 0x0145, "Ncedil", "LATIN CAPITAL LETTER N WITH CEDILLA" },
-{ 0x0146, "ncedil", "LATIN SMALL LETTER N WITH CEDILLA" },
-{ 0x0147, "Ncaron", "LATIN CAPITAL LETTER N WITH CARON" },
-{ 0x0148, "ncaron", "LATIN SMALL LETTER N WITH CARON" },
-{ 0x0149, "napos", "LATIN SMALL LETTER N PRECEDED BY APOSTROPHE" },
-{ 0x014A, "ENG", "LATIN CAPITAL LETTER ENG" },
-{ 0x014B, "eng", "LATIN SMALL LETTER ENG" },
-{ 0x014C, "Omacr", "LATIN CAPITAL LETTER O WITH MACRON" },
-{ 0x014D, "omacr", "LATIN SMALL LETTER O WITH MACRON" },
-{ 0x0150, "Odblac", "LATIN CAPITAL LETTER O WITH DOUBLE ACUTE" },
-{ 0x0151, "odblac", "LATIN SMALL LETTER O WITH DOUBLE ACUTE" },
-{ 0x0152, "OElig", "LATIN CAPITAL LIGATURE OE" },
-{ 0x0153, "oelig", "LATIN SMALL LIGATURE OE" },
-{ 0x0154, "Racute", "LATIN CAPITAL LETTER R WITH ACUTE" },
-{ 0x0155, "racute", "LATIN SMALL LETTER R WITH ACUTE" },
-{ 0x0156, "Rcedil", "LATIN CAPITAL LETTER R WITH CEDILLA" },
-{ 0x0157, "rcedil", "LATIN SMALL LETTER R WITH CEDILLA" },
-{ 0x0158, "Rcaron", "LATIN CAPITAL LETTER R WITH CARON" },
-{ 0x0159, "rcaron", "LATIN SMALL LETTER R WITH CARON" },
-{ 0x015A, "Sacute", "LATIN CAPITAL LETTER S WITH ACUTE" },
-{ 0x015B, "sacute", "LATIN SMALL LETTER S WITH ACUTE" },
-{ 0x015C, "Scirc", "LATIN CAPITAL LETTER S WITH CIRCUMFLEX" },
-{ 0x015D, "scirc", "LATIN SMALL LETTER S WITH CIRCUMFLEX" },
-{ 0x015E, "Scedil", "LATIN CAPITAL LETTER S WITH CEDILLA" },
-{ 0x015F, "scedil", "LATIN SMALL LETTER S WITH CEDILLA" },
-{ 0x0160, "Scaron", "LATIN CAPITAL LETTER S WITH CARON" },
-{ 0x0161, "scaron", "LATIN SMALL LETTER S WITH CARON" },
-{ 0x0162, "Tcedil", "LATIN CAPITAL LETTER T WITH CEDILLA" },
-{ 0x0163, "tcedil", "LATIN SMALL LETTER T WITH CEDILLA" },
-{ 0x0164, "Tcaron", "LATIN CAPITAL LETTER T WITH CARON" },
-{ 0x0165, "tcaron", "LATIN SMALL LETTER T WITH CARON" },
-{ 0x0166, "Tstrok", "LATIN CAPITAL LETTER T WITH STROKE" },
-{ 0x0167, "tstrok", "LATIN SMALL LETTER T WITH STROKE" },
-{ 0x0168, "Utilde", "LATIN CAPITAL LETTER U WITH TILDE" },
-{ 0x0169, "utilde", "LATIN SMALL LETTER U WITH TILDE" },
-{ 0x016A, "Umacr", "LATIN CAPITAL LETTER U WITH MACRON" },
-{ 0x016B, "umacr", "LATIN SMALL LETTER U WITH MACRON" },
-{ 0x016C, "Ubreve", "LATIN CAPITAL LETTER U WITH BREVE" },
-{ 0x016D, "ubreve", "LATIN SMALL LETTER U WITH BREVE" },
-{ 0x016E, "Uring", "LATIN CAPITAL LETTER U WITH RING ABOVE" },
-{ 0x016F, "uring", "LATIN SMALL LETTER U WITH RING ABOVE" },
-{ 0x0170, "Udblac", "LATIN CAPITAL LETTER U WITH DOUBLE ACUTE" },
-{ 0x0171, "udblac", "LATIN SMALL LETTER U WITH DOUBLE ACUTE" },
-{ 0x0172, "Uogon", "LATIN CAPITAL LETTER U WITH OGONEK" },
-{ 0x0173, "uogon", "LATIN SMALL LETTER U WITH OGONEK" },
-{ 0x0174, "Wcirc", "LATIN CAPITAL LETTER W WITH CIRCUMFLEX" },
-{ 0x0175, "wcirc", "LATIN SMALL LETTER W WITH CIRCUMFLEX" },
-{ 0x0176, "Ycirc", "LATIN CAPITAL LETTER Y WITH CIRCUMFLEX" },
-{ 0x0177, "ycirc", "LATIN SMALL LETTER Y WITH CIRCUMFLEX" },
-{ 0x0178, "Yuml", "LATIN CAPITAL LETTER Y WITH DIAERESIS" },
-{ 0x0179, "Zacute", "LATIN CAPITAL LETTER Z WITH ACUTE" },
-{ 0x017A, "zacute", "LATIN SMALL LETTER Z WITH ACUTE" },
-{ 0x017B, "Zdot", "LATIN CAPITAL LETTER Z WITH DOT ABOVE" },
-{ 0x017C, "zdot", "LATIN SMALL LETTER Z WITH DOT ABOVE" },
-{ 0x017D, "Zcaron", "LATIN CAPITAL LETTER Z WITH CARON" },
-{ 0x017E, "zcaron", "LATIN SMALL LETTER Z WITH CARON" },
-{ 0x0192, "fnof", "LATIN SMALL LETTER F WITH HOOK" },
-{ 0x01F5, "gacute", "LATIN SMALL LETTER G WITH ACUTE" },
-{ 0x02C7, "caron", "CARON" },
-{ 0x02D8, "breve", "BREVE" },
-{ 0x02D9, "dot", "DOT ABOVE" },
-{ 0x02DA, "ring", "RING ABOVE" },
-{ 0x02DB, "ogon", "OGONEK" },
-{ 0x02DC, "tilde", "TILDE" },
-{ 0x02DD, "dblac", "DOUBLE ACUTE ACCENT" },
-{ 0x0386, "Aacgr", "GREEK CAPITAL LETTER ALPHA WITH TONOS" },
-{ 0x0388, "Eacgr", "GREEK CAPITAL LETTER EPSILON WITH TONOS" },
-{ 0x0389, "EEacgr", "GREEK CAPITAL LETTER ETA WITH TONOS" },
-{ 0x038A, "Iacgr", "GREEK CAPITAL LETTER IOTA WITH TONOS" },
-{ 0x038C, "Oacgr", "GREEK CAPITAL LETTER OMICRON WITH TONOS" },
-{ 0x038E, "Uacgr", "GREEK CAPITAL LETTER UPSILON WITH TONOS" },
-{ 0x038F, "OHacgr", "GREEK CAPITAL LETTER OMEGA WITH TONOS" },
-{ 0x0390, "idiagr", "GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS" },
-{ 0x0391, "Agr", "GREEK CAPITAL LETTER ALPHA" },
-{ 0x0392, "Bgr", "GREEK CAPITAL LETTER BETA" },
-{ 0x0393, "b.Gamma", "GREEK CAPITAL LETTER GAMMA" },
-{ 0x0393, "Gamma", "GREEK CAPITAL LETTER GAMMA" },
-{ 0x0393, "Ggr", "GREEK CAPITAL LETTER GAMMA" },
-{ 0x0394, "b.Delta", "GREEK CAPITAL LETTER DELTA" },
-{ 0x0394, "Delta", "GREEK CAPITAL LETTER DELTA" },
-{ 0x0394, "Dgr", "GREEK CAPITAL LETTER DELTA" },
-{ 0x0395, "Egr", "GREEK CAPITAL LETTER EPSILON" },
-{ 0x0396, "Zgr", "GREEK CAPITAL LETTER ZETA" },
-{ 0x0397, "EEgr", "GREEK CAPITAL LETTER ETA" },
-{ 0x0398, "b.Theta", "GREEK CAPITAL LETTER THETA" },
-{ 0x0398, "Theta", "GREEK CAPITAL LETTER THETA" },
-{ 0x0398, "THgr", "GREEK CAPITAL LETTER THETA" },
-{ 0x0399, "Igr", "GREEK CAPITAL LETTER IOTA" },
-{ 0x039A, "Kgr", "GREEK CAPITAL LETTER KAPPA" },
-{ 0x039B, "b.Lambda", "GREEK CAPITAL LETTER LAMDA" },
-{ 0x039B, "Lambda", "GREEK CAPITAL LETTER LAMDA" },
-{ 0x039B, "Lgr", "GREEK CAPITAL LETTER LAMDA" },
-{ 0x039C, "Mgr", "GREEK CAPITAL LETTER MU" },
-{ 0x039D, "Ngr", "GREEK CAPITAL LETTER NU" },
-{ 0x039E, "b.Xi", "GREEK CAPITAL LETTER XI" },
-{ 0x039E, "Xgr", "GREEK CAPITAL LETTER XI" },
-{ 0x039E, "Xi", "GREEK CAPITAL LETTER XI" },
-{ 0x039F, "Ogr", "GREEK CAPITAL LETTER OMICRON" },
-{ 0x03A0, "b.Pi", "GREEK CAPITAL LETTER PI" },
-{ 0x03A0, "Pgr", "GREEK CAPITAL LETTER PI" },
-{ 0x03A0, "Pi", "GREEK CAPITAL LETTER PI" },
-{ 0x03A1, "Rgr", "GREEK CAPITAL LETTER RHO" },
-{ 0x03A3, "b.Sigma", "GREEK CAPITAL LETTER SIGMA" },
-{ 0x03A3, "Sgr", "GREEK CAPITAL LETTER SIGMA" },
-{ 0x03A3, "Sigma", "GREEK CAPITAL LETTER SIGMA" },
-{ 0x03A4, "Tgr", "GREEK CAPITAL LETTER TAU" },
-{ 0x03A5, "Ugr", "" },
-{ 0x03A6, "b.Phi", "GREEK CAPITAL LETTER PHI" },
-{ 0x03A6, "PHgr", "GREEK CAPITAL LETTER PHI" },
-{ 0x03A6, "Phi", "GREEK CAPITAL LETTER PHI" },
-{ 0x03A7, "KHgr", "GREEK CAPITAL LETTER CHI" },
-{ 0x03A8, "b.Psi", "GREEK CAPITAL LETTER PSI" },
-{ 0x03A8, "PSgr", "GREEK CAPITAL LETTER PSI" },
-{ 0x03A8, "Psi", "GREEK CAPITAL LETTER PSI" },
-{ 0x03A9, "b.Omega", "GREEK CAPITAL LETTER OMEGA" },
-{ 0x03A9, "OHgr", "GREEK CAPITAL LETTER OMEGA" },
-{ 0x03A9, "Omega", "GREEK CAPITAL LETTER OMEGA" },
-{ 0x03AA, "Idigr", "GREEK CAPITAL LETTER IOTA WITH DIALYTIKA" },
-{ 0x03AB, "Udigr", "GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA" },
-{ 0x03AC, "aacgr", "GREEK SMALL LETTER ALPHA WITH TONOS" },
-{ 0x03AD, "eacgr", "GREEK SMALL LETTER EPSILON WITH TONOS" },
-{ 0x03AE, "eeacgr", "GREEK SMALL LETTER ETA WITH TONOS" },
-{ 0x03AF, "iacgr", "GREEK SMALL LETTER IOTA WITH TONOS" },
-{ 0x03B0, "udiagr", "GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS" },
-{ 0x03B1, "agr", "" },
-{ 0x03B1, "alpha", "" },
-{ 0x03B1, "b.alpha", "" },
-{ 0x03B2, "b.beta", "GREEK SMALL LETTER BETA" },
-{ 0x03B2, "beta", "GREEK SMALL LETTER BETA" },
-{ 0x03B2, "bgr", "GREEK SMALL LETTER BETA" },
-{ 0x03B3, "b.gamma", "GREEK SMALL LETTER GAMMA" },
-{ 0x03B3, "gamma", "GREEK SMALL LETTER GAMMA" },
-{ 0x03B3, "ggr", "GREEK SMALL LETTER GAMMA" },
-{ 0x03B4, "b.delta", "GREEK SMALL LETTER DELTA" },
-{ 0x03B4, "delta", "GREEK SMALL LETTER DELTA" },
-{ 0x03B4, "dgr", "GREEK SMALL LETTER DELTA" },
-{ 0x03B5, "b.epsi", "" },
-{ 0x03B5, "b.epsis", "" },
-{ 0x03B5, "b.epsiv", "" },
-{ 0x03B5, "egr", "" },
-{ 0x03B5, "epsiv", "" },
-{ 0x03B6, "b.zeta", "GREEK SMALL LETTER ZETA" },
-{ 0x03B6, "zeta", "GREEK SMALL LETTER ZETA" },
-{ 0x03B6, "zgr", "GREEK SMALL LETTER ZETA" },
-{ 0x03B7, "b.eta", "GREEK SMALL LETTER ETA" },
-{ 0x03B7, "eegr", "GREEK SMALL LETTER ETA" },
-{ 0x03B7, "eta", "GREEK SMALL LETTER ETA" },
-{ 0x03B8, "b.thetas", "" },
-{ 0x03B8, "thetas", "" },
-{ 0x03B8, "thgr", "" },
-{ 0x03B9, "b.iota", "GREEK SMALL LETTER IOTA" },
-{ 0x03B9, "igr", "GREEK SMALL LETTER IOTA" },
-{ 0x03B9, "iota", "GREEK SMALL LETTER IOTA" },
-{ 0x03BA, "b.kappa", "GREEK SMALL LETTER KAPPA" },
-{ 0x03BA, "kappa", "GREEK SMALL LETTER KAPPA" },
-{ 0x03BA, "kgr", "GREEK SMALL LETTER KAPPA" },
-{ 0x03BB, "b.lambda", "GREEK SMALL LETTER LAMDA" },
-{ 0x03BB, "lambda", "GREEK SMALL LETTER LAMDA" },
-{ 0x03BB, "lgr", "GREEK SMALL LETTER LAMDA" },
-{ 0x03BC, "b.mu", "GREEK SMALL LETTER MU" },
-{ 0x03BC, "mgr", "GREEK SMALL LETTER MU" },
-{ 0x03BC, "mu", "GREEK SMALL LETTER MU" },
-{ 0x03BD, "b.nu", "GREEK SMALL LETTER NU" },
-{ 0x03BD, "ngr", "GREEK SMALL LETTER NU" },
-{ 0x03BD, "nu", "GREEK SMALL LETTER NU" },
-{ 0x03BE, "b.xi", "GREEK SMALL LETTER XI" },
-{ 0x03BE, "xgr", "GREEK SMALL LETTER XI" },
-{ 0x03BE, "xi", "GREEK SMALL LETTER XI" },
-{ 0x03BF, "ogr", "GREEK SMALL LETTER OMICRON" },
-{ 0x03C0, "b.pi", "GREEK SMALL LETTER PI" },
-{ 0x03C0, "pgr", "GREEK SMALL LETTER PI" },
-{ 0x03C0, "pi", "GREEK SMALL LETTER PI" },
-{ 0x03C1, "b.rho", "GREEK SMALL LETTER RHO" },
-{ 0x03C1, "rgr", "GREEK SMALL LETTER RHO" },
-{ 0x03C1, "rho", "GREEK SMALL LETTER RHO" },
-{ 0x03C2, "b.sigmav", "" },
-{ 0x03C2, "sfgr", "" },
-{ 0x03C2, "sigmav", "" },
-{ 0x03C3, "b.sigma", "GREEK SMALL LETTER SIGMA" },
-{ 0x03C3, "sgr", "GREEK SMALL LETTER SIGMA" },
-{ 0x03C3, "sigma", "GREEK SMALL LETTER SIGMA" },
-{ 0x03C4, "b.tau", "GREEK SMALL LETTER TAU" },
-{ 0x03C4, "tau", "GREEK SMALL LETTER TAU" },
-{ 0x03C4, "tgr", "GREEK SMALL LETTER TAU" },
-{ 0x03C5, "b.upsi", "GREEK SMALL LETTER UPSILON" },
-{ 0x03C5, "ugr", "GREEK SMALL LETTER UPSILON" },
-{ 0x03C5, "upsi", "GREEK SMALL LETTER UPSILON" },
-{ 0x03C6, "b.phis", "GREEK SMALL LETTER PHI" },
-{ 0x03C6, "phgr", "GREEK SMALL LETTER PHI" },
-{ 0x03C6, "phis", "GREEK SMALL LETTER PHI" },
-{ 0x03C7, "b.chi", "GREEK SMALL LETTER CHI" },
-{ 0x03C7, "chi", "GREEK SMALL LETTER CHI" },
-{ 0x03C7, "khgr", "GREEK SMALL LETTER CHI" },
-{ 0x03C8, "b.psi", "GREEK SMALL LETTER PSI" },
-{ 0x03C8, "psgr", "GREEK SMALL LETTER PSI" },
-{ 0x03C8, "psi", "GREEK SMALL LETTER PSI" },
-{ 0x03C9, "b.omega", "GREEK SMALL LETTER OMEGA" },
-{ 0x03C9, "ohgr", "GREEK SMALL LETTER OMEGA" },
-{ 0x03C9, "omega", "GREEK SMALL LETTER OMEGA" },
-{ 0x03CA, "idigr", "GREEK SMALL LETTER IOTA WITH DIALYTIKA" },
-{ 0x03CB, "udigr", "GREEK SMALL LETTER UPSILON WITH DIALYTIKA" },
-{ 0x03CC, "oacgr", "GREEK SMALL LETTER OMICRON WITH TONOS" },
-{ 0x03CD, "uacgr", "GREEK SMALL LETTER UPSILON WITH TONOS" },
-{ 0x03CE, "ohacgr", "GREEK SMALL LETTER OMEGA WITH TONOS" },
-{ 0x03D1, "b.thetav", "" },
-{ 0x03D1, "thetav", "" },
-{ 0x03D2, "b.Upsi", "" },
-{ 0x03D2, "Upsi", "" },
-{ 0x03D5, "b.phiv", "GREEK PHI SYMBOL" },
-{ 0x03D5, "phiv", "GREEK PHI SYMBOL" },
-{ 0x03D6, "b.piv", "GREEK PI SYMBOL" },
-{ 0x03D6, "piv", "GREEK PI SYMBOL" },
-{ 0x03DC, "b.gammad", "GREEK LETTER DIGAMMA" },
-{ 0x03DC, "gammad", "GREEK LETTER DIGAMMA" },
-{ 0x03F0, "b.kappav", "GREEK KAPPA SYMBOL" },
-{ 0x03F0, "kappav", "GREEK KAPPA SYMBOL" },
-{ 0x03F1, "b.rhov", "GREEK RHO SYMBOL" },
-{ 0x03F1, "rhov", "GREEK RHO SYMBOL" },
-{ 0x0401, "IOcy", "CYRILLIC CAPITAL LETTER IO" },
-{ 0x0402, "DJcy", "CYRILLIC CAPITAL LETTER DJE" },
-{ 0x0403, "GJcy", "CYRILLIC CAPITAL LETTER GJE" },
-{ 0x0404, "Jukcy", "CYRILLIC CAPITAL LETTER UKRAINIAN IE" },
-{ 0x0405, "DScy", "CYRILLIC CAPITAL LETTER DZE" },
-{ 0x0406, "Iukcy", "CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I" },
-{ 0x0407, "YIcy", "CYRILLIC CAPITAL LETTER YI" },
-{ 0x0408, "Jsercy", "CYRILLIC CAPITAL LETTER JE" },
-{ 0x0409, "LJcy", "CYRILLIC CAPITAL LETTER LJE" },
-{ 0x040A, "NJcy", "CYRILLIC CAPITAL LETTER NJE" },
-{ 0x040B, "TSHcy", "CYRILLIC CAPITAL LETTER TSHE" },
-{ 0x040C, "KJcy", "CYRILLIC CAPITAL LETTER KJE" },
-{ 0x040E, "Ubrcy", "CYRILLIC CAPITAL LETTER SHORT U" },
-{ 0x040F, "DZcy", "CYRILLIC CAPITAL LETTER DZHE" },
-{ 0x0410, "Acy", "CYRILLIC CAPITAL LETTER A" },
-{ 0x0411, "Bcy", "CYRILLIC CAPITAL LETTER BE" },
-{ 0x0412, "Vcy", "CYRILLIC CAPITAL LETTER VE" },
-{ 0x0413, "Gcy", "CYRILLIC CAPITAL LETTER GHE" },
-{ 0x0414, "Dcy", "CYRILLIC CAPITAL LETTER DE" },
-{ 0x0415, "IEcy", "CYRILLIC CAPITAL LETTER IE" },
-{ 0x0416, "ZHcy", "CYRILLIC CAPITAL LETTER ZHE" },
-{ 0x0417, "Zcy", "CYRILLIC CAPITAL LETTER ZE" },
-{ 0x0418, "Icy", "CYRILLIC CAPITAL LETTER I" },
-{ 0x0419, "Jcy", "CYRILLIC CAPITAL LETTER SHORT I" },
-{ 0x041A, "Kcy", "CYRILLIC CAPITAL LETTER KA" },
-{ 0x041B, "Lcy", "CYRILLIC CAPITAL LETTER EL" },
-{ 0x041C, "Mcy", "CYRILLIC CAPITAL LETTER EM" },
-{ 0x041D, "Ncy", "CYRILLIC CAPITAL LETTER EN" },
-{ 0x041E, "Ocy", "CYRILLIC CAPITAL LETTER O" },
-{ 0x041F, "Pcy", "CYRILLIC CAPITAL LETTER PE" },
-{ 0x0420, "Rcy", "CYRILLIC CAPITAL LETTER ER" },
-{ 0x0421, "Scy", "CYRILLIC CAPITAL LETTER ES" },
-{ 0x0422, "Tcy", "CYRILLIC CAPITAL LETTER TE" },
-{ 0x0423, "Ucy", "CYRILLIC CAPITAL LETTER U" },
-{ 0x0424, "Fcy", "CYRILLIC CAPITAL LETTER EF" },
-{ 0x0425, "KHcy", "CYRILLIC CAPITAL LETTER HA" },
-{ 0x0426, "TScy", "CYRILLIC CAPITAL LETTER TSE" },
-{ 0x0427, "CHcy", "CYRILLIC CAPITAL LETTER CHE" },
-{ 0x0428, "SHcy", "CYRILLIC CAPITAL LETTER SHA" },
-{ 0x0429, "SHCHcy", "CYRILLIC CAPITAL LETTER SHCHA" },
-{ 0x042A, "HARDcy", "CYRILLIC CAPITAL LETTER HARD SIGN" },
-{ 0x042B, "Ycy", "CYRILLIC CAPITAL LETTER YERU" },
-{ 0x042C, "SOFTcy", "CYRILLIC CAPITAL LETTER SOFT SIGN" },
-{ 0x042D, "Ecy", "CYRILLIC CAPITAL LETTER E" },
-{ 0x042E, "YUcy", "CYRILLIC CAPITAL LETTER YU" },
-{ 0x042F, "YAcy", "CYRILLIC CAPITAL LETTER YA" },
-{ 0x0430, "acy", "CYRILLIC SMALL LETTER A" },
-{ 0x0431, "bcy", "CYRILLIC SMALL LETTER BE" },
-{ 0x0432, "vcy", "CYRILLIC SMALL LETTER VE" },
-{ 0x0433, "gcy", "CYRILLIC SMALL LETTER GHE" },
-{ 0x0434, "dcy", "CYRILLIC SMALL LETTER DE" },
-{ 0x0435, "iecy", "CYRILLIC SMALL LETTER IE" },
-{ 0x0436, "zhcy", "CYRILLIC SMALL LETTER ZHE" },
-{ 0x0437, "zcy", "CYRILLIC SMALL LETTER ZE" },
-{ 0x0438, "icy", "CYRILLIC SMALL LETTER I" },
-{ 0x0439, "jcy", "CYRILLIC SMALL LETTER SHORT I" },
-{ 0x043A, "kcy", "CYRILLIC SMALL LETTER KA" },
-{ 0x043B, "lcy", "CYRILLIC SMALL LETTER EL" },
-{ 0x043C, "mcy", "CYRILLIC SMALL LETTER EM" },
-{ 0x043D, "ncy", "CYRILLIC SMALL LETTER EN" },
-{ 0x043E, "ocy", "CYRILLIC SMALL LETTER O" },
-{ 0x043F, "pcy", "CYRILLIC SMALL LETTER PE" },
-{ 0x0440, "rcy", "CYRILLIC SMALL LETTER ER" },
-{ 0x0441, "scy", "CYRILLIC SMALL LETTER ES" },
-{ 0x0442, "tcy", "CYRILLIC SMALL LETTER TE" },
-{ 0x0443, "ucy", "CYRILLIC SMALL LETTER U" },
-{ 0x0444, "fcy", "CYRILLIC SMALL LETTER EF" },
-{ 0x0445, "khcy", "CYRILLIC SMALL LETTER HA" },
-{ 0x0446, "tscy", "CYRILLIC SMALL LETTER TSE" },
-{ 0x0447, "chcy", "CYRILLIC SMALL LETTER CHE" },
-{ 0x0448, "shcy", "CYRILLIC SMALL LETTER SHA" },
-{ 0x0449, "shchcy", "CYRILLIC SMALL LETTER SHCHA" },
-{ 0x044A, "hardcy", "CYRILLIC SMALL LETTER HARD SIGN" },
-{ 0x044B, "ycy", "CYRILLIC SMALL LETTER YERU" },
-{ 0x044C, "softcy", "CYRILLIC SMALL LETTER SOFT SIGN" },
-{ 0x044D, "ecy", "CYRILLIC SMALL LETTER E" },
-{ 0x044E, "yucy", "CYRILLIC SMALL LETTER YU" },
-{ 0x044F, "yacy", "CYRILLIC SMALL LETTER YA" },
-{ 0x0451, "iocy", "CYRILLIC SMALL LETTER IO" },
-{ 0x0452, "djcy", "CYRILLIC SMALL LETTER DJE" },
-{ 0x0453, "gjcy", "CYRILLIC SMALL LETTER GJE" },
-{ 0x0454, "jukcy", "CYRILLIC SMALL LETTER UKRAINIAN IE" },
-{ 0x0455, "dscy", "CYRILLIC SMALL LETTER DZE" },
-{ 0x0456, "iukcy", "CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I" },
-{ 0x0457, "yicy", "CYRILLIC SMALL LETTER YI" },
-{ 0x0458, "jsercy", "CYRILLIC SMALL LETTER JE" },
-{ 0x0459, "ljcy", "CYRILLIC SMALL LETTER LJE" },
-{ 0x045A, "njcy", "CYRILLIC SMALL LETTER NJE" },
-{ 0x045B, "tshcy", "CYRILLIC SMALL LETTER TSHE" },
-{ 0x045C, "kjcy", "CYRILLIC SMALL LETTER KJE" },
-{ 0x045E, "ubrcy", "CYRILLIC SMALL LETTER SHORT U" },
-{ 0x045F, "dzcy", "CYRILLIC SMALL LETTER DZHE" },
-{ 0x2002, "ensp", "EN SPACE" },
-{ 0x2003, "emsp", "EM SPACE" },
-{ 0x2004, "emsp13", "THREE-PER-EM SPACE" },
-{ 0x2005, "emsp14", "FOUR-PER-EM SPACE" },
-{ 0x2007, "numsp", "FIGURE SPACE" },
-{ 0x2008, "puncsp", "PUNCTUATION SPACE" },
-{ 0x2009, "thinsp", "THIN SPACE" },
-{ 0x200A, "hairsp", "HAIR SPACE" },
-{ 0x2010, "dash", "HYPHEN" },
-{ 0x2013, "ndash", "EN DASH" },
-{ 0x2014, "mdash", "EM DASH" },
-{ 0x2015, "horbar", "HORIZONTAL BAR" },
-{ 0x2016, "Verbar", "DOUBLE VERTICAL LINE" },
-{ 0x2018, "lsquo", "" },
-{ 0x2018, "rsquor", "" },
-{ 0x2019, "rsquo", "RIGHT SINGLE QUOTATION MARK" },
-{ 0x201A, "lsquor", "SINGLE LOW-9 QUOTATION MARK" },
-{ 0x201C, "ldquo", "" },
-{ 0x201C, "rdquor", "" },
-{ 0x201D, "rdquo", "RIGHT DOUBLE QUOTATION MARK" },
-{ 0x201E, "ldquor", "DOUBLE LOW-9 QUOTATION MARK" },
-{ 0x2020, "dagger", "DAGGER" },
-{ 0x2021, "Dagger", "DOUBLE DAGGER" },
-{ 0x2022, "bull", "BULLET" },
-{ 0x2025, "nldr", "TWO DOT LEADER" },
-{ 0x2026, "hellip", "HORIZONTAL ELLIPSIS" },
-{ 0x2026, "mldr", "HORIZONTAL ELLIPSIS" },
-{ 0x2030, "permil", "PER MILLE SIGN" },
-{ 0x2032, "prime", "PRIME" },
-{ 0x2032, "vprime", "PRIME" },
-{ 0x2033, "Prime", "DOUBLE PRIME" },
-{ 0x2034, "tprime", "TRIPLE PRIME" },
-{ 0x2035, "bprime", "REVERSED PRIME" },
-{ 0x2041, "caret", "CARET" },
-{ 0x2043, "hybull", "HYPHEN BULLET" },
-{ 0x20DB, "tdot", "COMBINING THREE DOTS ABOVE" },
-{ 0x20DC, "DotDot", "COMBINING FOUR DOTS ABOVE" },
-{ 0x2105, "incare", "CARE OF" },
-{ 0x210B, "hamilt", "SCRIPT CAPITAL H" },
-{ 0x210F, "planck", "PLANCK CONSTANT OVER TWO PI" },
-{ 0x2111, "image", "BLACK-LETTER CAPITAL I" },
-{ 0x2112, "lagran", "SCRIPT CAPITAL L" },
-{ 0x2113, "ell", "SCRIPT SMALL L" },
-{ 0x2116, "numero", "NUMERO SIGN" },
-{ 0x2117, "copysr", "SOUND RECORDING COPYRIGHT" },
-{ 0x2118, "weierp", "SCRIPT CAPITAL P" },
-{ 0x211C, "real", "BLACK-LETTER CAPITAL R" },
-{ 0x211E, "rx", "PRESCRIPTION TAKE" },
-{ 0x2122, "trade", "TRADE MARK SIGN" },
-{ 0x2126, "ohm", "OHM SIGN" },
-{ 0x212B, "angst", "ANGSTROM SIGN" },
-{ 0x212C, "bernou", "SCRIPT CAPITAL B" },
-{ 0x2133, "phmmat", "SCRIPT CAPITAL M" },
-{ 0x2134, "order", "SCRIPT SMALL O" },
-{ 0x2135, "aleph", "ALEF SYMBOL" },
-{ 0x2136, "beth", "BET SYMBOL" },
-{ 0x2137, "gimel", "GIMEL SYMBOL" },
-{ 0x2138, "daleth", "DALET SYMBOL" },
-{ 0x2153, "frac13", "VULGAR FRACTION ONE THIRD" },
-{ 0x2154, "frac23", "VULGAR FRACTION TWO THIRDS" },
-{ 0x2155, "frac15", "VULGAR FRACTION ONE FIFTH" },
-{ 0x2156, "frac25", "VULGAR FRACTION TWO FIFTHS" },
-{ 0x2157, "frac35", "VULGAR FRACTION THREE FIFTHS" },
-{ 0x2158, "frac45", "VULGAR FRACTION FOUR FIFTHS" },
-{ 0x2159, "frac16", "VULGAR FRACTION ONE SIXTH" },
-{ 0x215A, "frac56", "VULGAR FRACTION FIVE SIXTHS" },
-{ 0x215B, "frac18", "" },
-{ 0x215C, "frac38", "" },
-{ 0x215D, "frac58", "" },
-{ 0x215E, "frac78", "" },
-{ 0x2190, "larr", "LEFTWARDS DOUBLE ARROW" },
-{ 0x2191, "uarr", "UPWARDS ARROW" },
-{ 0x2192, "rarr", "RIGHTWARDS DOUBLE ARROW" },
-{ 0x2193, "darr", "DOWNWARDS ARROW" },
-{ 0x2194, "harr", "LEFT RIGHT ARROW" },
-{ 0x2194, "xhArr", "LEFT RIGHT ARROW" },
-{ 0x2194, "xharr", "LEFT RIGHT ARROW" },
-{ 0x2195, "varr", "UP DOWN ARROW" },
-{ 0x2196, "nwarr", "NORTH WEST ARROW" },
-{ 0x2197, "nearr", "NORTH EAST ARROW" },
-{ 0x2198, "drarr", "SOUTH EAST ARROW" },
-{ 0x2199, "dlarr", "SOUTH WEST ARROW" },
-{ 0x219A, "nlarr", "LEFTWARDS ARROW WITH STROKE" },
-{ 0x219B, "nrarr", "RIGHTWARDS ARROW WITH STROKE" },
-{ 0x219D, "rarrw", "RIGHTWARDS SQUIGGLE ARROW" },
-{ 0x219E, "Larr", "LEFTWARDS TWO HEADED ARROW" },
-{ 0x21A0, "Rarr", "RIGHTWARDS TWO HEADED ARROW" },
-{ 0x21A2, "larrtl", "LEFTWARDS ARROW WITH TAIL" },
-{ 0x21A3, "rarrtl", "RIGHTWARDS ARROW WITH TAIL" },
-{ 0x21A6, "map", "RIGHTWARDS ARROW FROM BAR" },
-{ 0x21A9, "larrhk", "LEFTWARDS ARROW WITH HOOK" },
-{ 0x21AA, "rarrhk", "RIGHTWARDS ARROW WITH HOOK" },
-{ 0x21AB, "larrlp", "LEFTWARDS ARROW WITH LOOP" },
-{ 0x21AC, "rarrlp", "RIGHTWARDS ARROW WITH LOOP" },
-{ 0x21AD, "harrw", "LEFT RIGHT WAVE ARROW" },
-{ 0x21AE, "nharr", "LEFT RIGHT ARROW WITH STROKE" },
-{ 0x21B0, "lsh", "UPWARDS ARROW WITH TIP LEFTWARDS" },
-{ 0x21B1, "rsh", "UPWARDS ARROW WITH TIP RIGHTWARDS" },
-{ 0x21B6, "cularr", "ANTICLOCKWISE TOP SEMICIRCLE ARROW" },
-{ 0x21B7, "curarr", "CLOCKWISE TOP SEMICIRCLE ARROW" },
-{ 0x21BA, "olarr", "ANTICLOCKWISE OPEN CIRCLE ARROW" },
-{ 0x21BB, "orarr", "CLOCKWISE OPEN CIRCLE ARROW" },
-{ 0x21BC, "lharu", "LEFTWARDS HARPOON WITH BARB UPWARDS" },
-{ 0x21BD, "lhard", "LEFTWARDS HARPOON WITH BARB DOWNWARDS" },
-{ 0x21BE, "uharr", "UPWARDS HARPOON WITH BARB RIGHTWARDS" },
-{ 0x21BF, "uharl", "UPWARDS HARPOON WITH BARB LEFTWARDS" },
-{ 0x21C0, "rharu", "RIGHTWARDS HARPOON WITH BARB UPWARDS" },
-{ 0x21C1, "rhard", "RIGHTWARDS HARPOON WITH BARB DOWNWARDS" },
-{ 0x21C2, "dharr", "DOWNWARDS HARPOON WITH BARB RIGHTWARDS" },
-{ 0x21C3, "dharl", "DOWNWARDS HARPOON WITH BARB LEFTWARDS" },
-{ 0x21C4, "rlarr2", "RIGHTWARDS ARROW OVER LEFTWARDS ARROW" },
-{ 0x21C6, "lrarr2", "LEFTWARDS ARROW OVER RIGHTWARDS ARROW" },
-{ 0x21C7, "larr2", "LEFTWARDS PAIRED ARROWS" },
-{ 0x21C8, "uarr2", "UPWARDS PAIRED ARROWS" },
-{ 0x21C9, "rarr2", "RIGHTWARDS PAIRED ARROWS" },
-{ 0x21CA, "darr2", "DOWNWARDS PAIRED ARROWS" },
-{ 0x21CB, "lrhar2", "LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON" },
-{ 0x21CC, "rlhar2", "RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON" },
-{ 0x21CD, "nlArr", "LEFTWARDS DOUBLE ARROW WITH STROKE" },
-{ 0x21CE, "nhArr", "LEFT RIGHT DOUBLE ARROW WITH STROKE" },
-{ 0x21CF, "nrArr", "RIGHTWARDS DOUBLE ARROW WITH STROKE" },
-{ 0x21D0, "lArr", "LEFTWARDS ARROW" },
-{ 0x21D0, "xlArr", "LEFTWARDS DOUBLE ARROW" },
-{ 0x21D1, "uArr", "UPWARDS DOUBLE ARROW" },
-{ 0x21D2, "rArr", "RIGHTWARDS ARROW" },
-{ 0x21D2, "xrArr", "RIGHTWARDS DOUBLE ARROW" },
-{ 0x21D3, "dArr", "DOWNWARDS DOUBLE ARROW" },
-{ 0x21D4, "hArr", "" },
-{ 0x21D4, "iff", "LEFT RIGHT DOUBLE ARROW" },
-{ 0x21D5, "vArr", "UP DOWN DOUBLE ARROW" },
-{ 0x21DA, "lAarr", "LEFTWARDS TRIPLE ARROW" },
-{ 0x21DB, "rAarr", "RIGHTWARDS TRIPLE ARROW" },
-{ 0x2200, "forall", "" },
-{ 0x2201, "comp", "COMPLEMENT" },
-{ 0x2202, "part", "" },
-{ 0x2203, "exist", "" },
-{ 0x2204, "nexist", "THERE DOES NOT EXIST" },
-{ 0x2205, "empty", "" },
-{ 0x2207, "nabla", "NABLA" },
-{ 0x2209, "notin", "" },
-{ 0x220A, "epsi", "" },
-{ 0x220A, "epsis", "" },
-{ 0x220A, "isin", "" },
-{ 0x220D, "bepsi", "SMALL CONTAINS AS MEMBER" },
-{ 0x220D, "ni", "" },
-{ 0x220F, "prod", "N-ARY PRODUCT" },
-{ 0x2210, "amalg", "N-ARY COPRODUCT" },
-{ 0x2210, "coprod", "N-ARY COPRODUCT" },
-{ 0x2210, "samalg", "" },
-{ 0x2211, "sum", "N-ARY SUMMATION" },
-{ 0x2212, "minus", "MINUS SIGN" },
-{ 0x2213, "mnplus", "" },
-{ 0x2214, "plusdo", "DOT PLUS" },
-{ 0x2216, "setmn", "SET MINUS" },
-{ 0x2216, "ssetmn", "SET MINUS" },
-{ 0x2217, "lowast", "ASTERISK OPERATOR" },
-{ 0x2218, "compfn", "RING OPERATOR" },
-{ 0x221A, "radic", "" },
-{ 0x221D, "prop", "" },
-{ 0x221D, "vprop", "" },
-{ 0x221E, "infin", "" },
-{ 0x221F, "ang90", "RIGHT ANGLE" },
-{ 0x2220, "ang", "ANGLE" },
-{ 0x2221, "angmsd", "MEASURED ANGLE" },
-{ 0x2222, "angsph", "" },
-{ 0x2223, "mid", "" },
-{ 0x2224, "nmid", "DOES NOT DIVIDE" },
-{ 0x2225, "par", "PARALLEL TO" },
-{ 0x2225, "spar", "PARALLEL TO" },
-{ 0x2226, "npar", "NOT PARALLEL TO" },
-{ 0x2226, "nspar", "NOT PARALLEL TO" },
-{ 0x2227, "and", "" },
-{ 0x2228, "or", "" },
-{ 0x2229, "cap", "" },
-{ 0x222A, "cup", "" },
-{ 0x222B, "int", "" },
-{ 0x222E, "conint", "" },
-{ 0x2234, "there4", "" },
-{ 0x2235, "becaus", "BECAUSE" },
-{ 0x223C, "sim", "" },
-{ 0x223C, "thksim", "TILDE OPERATOR" },
-{ 0x223D, "bsim", "" },
-{ 0x2240, "wreath", "WREATH PRODUCT" },
-{ 0x2241, "nsim", "" },
-{ 0x2243, "sime", "" },
-{ 0x2244, "nsime", "" },
-{ 0x2245, "cong", "" },
-{ 0x2247, "ncong", "NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO" },
-{ 0x2248, "ap", "" },
-{ 0x2248, "thkap", "ALMOST EQUAL TO" },
-{ 0x2249, "nap", "NOT ALMOST EQUAL TO" },
-{ 0x224A, "ape", "" },
-{ 0x224C, "bcong", "ALL EQUAL TO" },
-{ 0x224D, "asymp", "EQUIVALENT TO" },
-{ 0x224E, "bump", "" },
-{ 0x224F, "bumpe", "" },
-{ 0x2250, "esdot", "" },
-{ 0x2251, "eDot", "" },
-{ 0x2252, "efDot", "" },
-{ 0x2253, "erDot", "" },
-{ 0x2254, "colone", "" },
-{ 0x2255, "ecolon", "" },
-{ 0x2256, "ecir", "" },
-{ 0x2257, "cire", "" },
-{ 0x2259, "wedgeq", "ESTIMATES" },
-{ 0x225C, "trie", "" },
-{ 0x2260, "ne", "" },
-{ 0x2261, "equiv", "" },
-{ 0x2262, "nequiv", "NOT IDENTICAL TO" },
-{ 0x2264, "le", "" },
-{ 0x2264, "les", "LESS-THAN OR EQUAL TO" },
-{ 0x2265, "ge", "GREATER-THAN OR EQUAL TO" },
-{ 0x2265, "ges", "GREATER-THAN OR EQUAL TO" },
-{ 0x2266, "lE", "" },
-{ 0x2267, "gE", "" },
-{ 0x2268, "lnE", "" },
-{ 0x2268, "lne", "" },
-{ 0x2268, "lvnE", "LESS-THAN BUT NOT EQUAL TO" },
-{ 0x2269, "gnE", "" },
-{ 0x2269, "gne", "" },
-{ 0x2269, "gvnE", "GREATER-THAN BUT NOT EQUAL TO" },
-{ 0x226A, "Lt", "MUCH LESS-THAN" },
-{ 0x226B, "Gt", "MUCH GREATER-THAN" },
-{ 0x226C, "twixt", "BETWEEN" },
-{ 0x226E, "nlt", "NOT LESS-THAN" },
-{ 0x226F, "ngt", "NOT GREATER-THAN" },
-{ 0x2270, "nlE", "" },
-{ 0x2270, "nle", "NEITHER LESS-THAN NOR EQUAL TO" },
-{ 0x2270, "nles", "" },
-{ 0x2271, "ngE", "" },
-{ 0x2271, "nge", "NEITHER GREATER-THAN NOR EQUAL TO" },
-{ 0x2271, "nges", "" },
-{ 0x2272, "lap", "LESS-THAN OR EQUIVALENT TO" },
-{ 0x2272, "lsim", "LESS-THAN OR EQUIVALENT TO" },
-{ 0x2273, "gap", "GREATER-THAN OR EQUIVALENT TO" },
-{ 0x2273, "gsim", "GREATER-THAN OR EQUIVALENT TO" },
-{ 0x2276, "lg", "LESS-THAN OR GREATER-THAN" },
-{ 0x2277, "gl", "" },
-{ 0x227A, "pr", "" },
-{ 0x227B, "sc", "" },
-{ 0x227C, "cupre", "" },
-{ 0x227C, "pre", "" },
-{ 0x227D, "sccue", "" },
-{ 0x227D, "sce", "" },
-{ 0x227E, "prap", "" },
-{ 0x227E, "prsim", "" },
-{ 0x227F, "scap", "" },
-{ 0x227F, "scsim", "" },
-{ 0x2280, "npr", "DOES NOT PRECEDE" },
-{ 0x2281, "nsc", "DOES NOT SUCCEED" },
-{ 0x2282, "sub", "" },
-{ 0x2283, "sup", "" },
-{ 0x2284, "nsub", "NOT A SUBSET OF" },
-{ 0x2285, "nsup", "NOT A SUPERSET OF" },
-{ 0x2286, "subE", "" },
-{ 0x2286, "sube", "" },
-{ 0x2287, "supE", "" },
-{ 0x2287, "supe", "" },
-{ 0x2288, "nsubE", "" },
-{ 0x2288, "nsube", "" },
-{ 0x2289, "nsupE", "" },
-{ 0x2289, "nsupe", "" },
-{ 0x228A, "subne", "" },
-{ 0x228A, "subnE", "SUBSET OF WITH NOT EQUAL TO" },
-{ 0x228A, "vsubne", "SUBSET OF WITH NOT EQUAL TO" },
-{ 0x228B, "supnE", "" },
-{ 0x228B, "supne", "" },
-{ 0x228B, "vsupnE", "SUPERSET OF WITH NOT EQUAL TO" },
-{ 0x228B, "vsupne", "SUPERSET OF WITH NOT EQUAL TO" },
-{ 0x228E, "uplus", "MULTISET UNION" },
-{ 0x228F, "sqsub", "" },
-{ 0x2290, "sqsup", "" },
-{ 0x2291, "sqsube", "" },
-{ 0x2292, "sqsupe", "" },
-{ 0x2293, "sqcap", "SQUARE CAP" },
-{ 0x2294, "sqcup", "SQUARE CUP" },
-{ 0x2295, "oplus", "CIRCLED PLUS" },
-{ 0x2296, "ominus", "CIRCLED MINUS" },
-{ 0x2297, "otimes", "CIRCLED TIMES" },
-{ 0x2298, "osol", "CIRCLED DIVISION SLASH" },
-{ 0x2299, "odot", "CIRCLED DOT OPERATOR" },
-{ 0x229A, "ocir", "CIRCLED RING OPERATOR" },
-{ 0x229B, "oast", "CIRCLED ASTERISK OPERATOR" },
-{ 0x229D, "odash", "CIRCLED DASH" },
-{ 0x229E, "plusb", "SQUARED PLUS" },
-{ 0x229F, "minusb", "SQUARED MINUS" },
-{ 0x22A0, "timesb", "SQUARED TIMES" },
-{ 0x22A1, "sdotb", "SQUARED DOT OPERATOR" },
-{ 0x22A2, "vdash", "" },
-{ 0x22A3, "dashv", "" },
-{ 0x22A4, "top", "DOWN TACK" },
-{ 0x22A5, "bottom", "" },
-{ 0x22A5, "perp", "" },
-{ 0x22A7, "models", "MODELS" },
-{ 0x22A8, "vDash", "" },
-{ 0x22A9, "Vdash", "" },
-{ 0x22AA, "Vvdash", "" },
-{ 0x22AC, "nvdash", "DOES NOT PROVE" },
-{ 0x22AD, "nvDash", "NOT TRUE" },
-{ 0x22AE, "nVdash", "DOES NOT FORCE" },
-{ 0x22AF, "nVDash", "NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE" },
-{ 0x22B2, "vltri", "" },
-{ 0x22B3, "vrtri", "" },
-{ 0x22B4, "ltrie", "" },
-{ 0x22B5, "rtrie", "" },
-{ 0x22B8, "mumap", "MULTIMAP" },
-{ 0x22BA, "intcal", "INTERCALATE" },
-{ 0x22BB, "veebar", "" },
-{ 0x22BC, "barwed", "NAND" },
-{ 0x22C4, "diam", "DIAMOND OPERATOR" },
-{ 0x22C5, "sdot", "DOT OPERATOR" },
-{ 0x22C6, "sstarf", "STAR OPERATOR" },
-{ 0x22C6, "star", "STAR OPERATOR" },
-{ 0x22C7, "divonx", "DIVISION TIMES" },
-{ 0x22C8, "bowtie", "" },
-{ 0x22C9, "ltimes", "LEFT NORMAL FACTOR SEMIDIRECT PRODUCT" },
-{ 0x22CA, "rtimes", "RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT" },
-{ 0x22CB, "lthree", "LEFT SEMIDIRECT PRODUCT" },
-{ 0x22CC, "rthree", "RIGHT SEMIDIRECT PRODUCT" },
-{ 0x22CD, "bsime", "" },
-{ 0x22CE, "cuvee", "CURLY LOGICAL OR" },
-{ 0x22CF, "cuwed", "CURLY LOGICAL AND" },
-{ 0x22D0, "Sub", "" },
-{ 0x22D1, "Sup", "" },
-{ 0x22D2, "Cap", "DOUBLE INTERSECTION" },
-{ 0x22D3, "Cup", "DOUBLE UNION" },
-{ 0x22D4, "fork", "" },
-{ 0x22D6, "ldot", "" },
-{ 0x22D7, "gsdot", "" },
-{ 0x22D8, "Ll", "" },
-{ 0x22D9, "Gg", "VERY MUCH GREATER-THAN" },
-{ 0x22DA, "lEg", "" },
-{ 0x22DA, "leg", "" },
-{ 0x22DB, "gEl", "" },
-{ 0x22DB, "gel", "" },
-{ 0x22DC, "els", "" },
-{ 0x22DD, "egs", "" },
-{ 0x22DE, "cuepr", "" },
-{ 0x22DF, "cuesc", "" },
-{ 0x22E0, "npre", "DOES NOT PRECEDE OR EQUAL" },
-{ 0x22E1, "nsce", "DOES NOT SUCCEED OR EQUAL" },
-{ 0x22E6, "lnsim", "" },
-{ 0x22E7, "gnsim", "GREATER-THAN BUT NOT EQUIVALENT TO" },
-{ 0x22E8, "prnap", "" },
-{ 0x22E8, "prnsim", "" },
-{ 0x22E9, "scnap", "" },
-{ 0x22E9, "scnsim", "" },
-{ 0x22EA, "nltri", "NOT NORMAL SUBGROUP OF" },
-{ 0x22EB, "nrtri", "DOES NOT CONTAIN AS NORMAL SUBGROUP" },
-{ 0x22EC, "nltrie", "NOT NORMAL SUBGROUP OF OR EQUAL TO" },
-{ 0x22ED, "nrtrie", "DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL" },
-{ 0x22EE, "vellip", "" },
-{ 0x2306, "Barwed", "PERSPECTIVE" },
-{ 0x2308, "lceil", "LEFT CEILING" },
-{ 0x2309, "rceil", "RIGHT CEILING" },
-{ 0x230A, "lfloor", "LEFT FLOOR" },
-{ 0x230B, "rfloor", "RIGHT FLOOR" },
-{ 0x230C, "drcrop", "BOTTOM RIGHT CROP" },
-{ 0x230D, "dlcrop", "BOTTOM LEFT CROP" },
-{ 0x230E, "urcrop", "TOP RIGHT CROP" },
-{ 0x230F, "ulcrop", "TOP LEFT CROP" },
-{ 0x2315, "telrec", "TELEPHONE RECORDER" },
-{ 0x2316, "target", "POSITION INDICATOR" },
-{ 0x231C, "ulcorn", "TOP LEFT CORNER" },
-{ 0x231D, "urcorn", "TOP RIGHT CORNER" },
-{ 0x231E, "dlcorn", "BOTTOM LEFT CORNER" },
-{ 0x231F, "drcorn", "BOTTOM RIGHT CORNER" },
-{ 0x2322, "frown", "" },
-{ 0x2322, "sfrown", "FROWN" },
-{ 0x2323, "smile", "" },
-{ 0x2323, "ssmile", "SMILE" },
-{ 0x2423, "blank", "OPEN BOX" },
-{ 0x24C8, "oS", "CIRCLED LATIN CAPITAL LETTER S" },
-{ 0x2500, "boxh", "BOX DRAWINGS LIGHT HORIZONTAL" },
-{ 0x2502, "boxv", "BOX DRAWINGS LIGHT VERTICAL" },
-{ 0x250C, "boxdr", "BOX DRAWINGS LIGHT DOWN AND RIGHT" },
-{ 0x2510, "boxdl", "BOX DRAWINGS LIGHT DOWN AND LEFT" },
-{ 0x2514, "boxur", "BOX DRAWINGS LIGHT UP AND RIGHT" },
-{ 0x2518, "boxul", "BOX DRAWINGS LIGHT UP AND LEFT" },
-{ 0x251C, "boxvr", "BOX DRAWINGS LIGHT VERTICAL AND RIGHT" },
-{ 0x2524, "boxvl", "BOX DRAWINGS LIGHT VERTICAL AND LEFT" },
-{ 0x252C, "boxhd", "BOX DRAWINGS LIGHT DOWN AND HORIZONTAL" },
-{ 0x2534, "boxhu", "BOX DRAWINGS LIGHT UP AND HORIZONTAL" },
-{ 0x253C, "boxvh", "BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL" },
-{ 0x2550, "boxH", "BOX DRAWINGS DOUBLE HORIZONTAL" },
-{ 0x2551, "boxV", "BOX DRAWINGS DOUBLE VERTICAL" },
-{ 0x2552, "boxDR", "BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE" },
-{ 0x2553, "boxDr", "BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE" },
-{ 0x2554, "boxdR", "BOX DRAWINGS DOUBLE DOWN AND RIGHT" },
-{ 0x2555, "boxDL", "BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE" },
-{ 0x2556, "boxdL", "BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE" },
-{ 0x2557, "boxDl", "BOX DRAWINGS DOUBLE DOWN AND LEFT" },
-{ 0x2558, "boxUR", "BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE" },
-{ 0x2559, "boxuR", "BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE" },
-{ 0x255A, "boxUr", "BOX DRAWINGS DOUBLE UP AND RIGHT" },
-{ 0x255B, "boxUL", "BOX DRAWINGS UP SINGLE AND LEFT DOUBLE" },
-{ 0x255C, "boxUl", "BOX DRAWINGS UP DOUBLE AND LEFT SINGLE" },
-{ 0x255D, "boxuL", "BOX DRAWINGS DOUBLE UP AND LEFT" },
-{ 0x255E, "boxvR", "BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE" },
-{ 0x255F, "boxVR", "BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE" },
-{ 0x2560, "boxVr", "BOX DRAWINGS DOUBLE VERTICAL AND RIGHT" },
-{ 0x2561, "boxvL", "BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE" },
-{ 0x2562, "boxVL", "BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE" },
-{ 0x2563, "boxVl", "BOX DRAWINGS DOUBLE VERTICAL AND LEFT" },
-{ 0x2564, "boxhD", "BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE" },
-{ 0x2565, "boxHD", "BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE" },
-{ 0x2566, "boxHd", "BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL" },
-{ 0x2567, "boxhU", "BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE" },
-{ 0x2568, "boxHU", "BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE" },
-{ 0x2569, "boxHu", "BOX DRAWINGS DOUBLE UP AND HORIZONTAL" },
-{ 0x256A, "boxvH", "BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE" },
-{ 0x256B, "boxVH", "BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE" },
-{ 0x256C, "boxVh", "BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL" },
-{ 0x2580, "uhblk", "UPPER HALF BLOCK" },
-{ 0x2584, "lhblk", "LOWER HALF BLOCK" },
-{ 0x2588, "block", "FULL BLOCK" },
-{ 0x2591, "blk14", "LIGHT SHADE" },
-{ 0x2592, "blk12", "MEDIUM SHADE" },
-{ 0x2593, "blk34", "DARK SHADE" },
-{ 0x25A1, "square", "WHITE SQUARE" },
-{ 0x25A1, "squ", "WHITE SQUARE" },
-{ 0x25AA, "squf", "" },
-{ 0x25AD, "rect", "WHITE RECTANGLE" },
-{ 0x25AE, "marker", "BLACK VERTICAL RECTANGLE" },
-{ 0x25B3, "xutri", "WHITE UP-POINTING TRIANGLE" },
-{ 0x25B4, "utrif", "BLACK UP-POINTING TRIANGLE" },
-{ 0x25B5, "utri", "WHITE UP-POINTING TRIANGLE" },
-{ 0x25B8, "rtrif", "BLACK RIGHT-POINTING TRIANGLE" },
-{ 0x25B9, "rtri", "WHITE RIGHT-POINTING TRIANGLE" },
-{ 0x25BD, "xdtri", "WHITE DOWN-POINTING TRIANGLE" },
-{ 0x25BE, "dtrif", "BLACK DOWN-POINTING TRIANGLE" },
-{ 0x25BF, "dtri", "WHITE DOWN-POINTING TRIANGLE" },
-{ 0x25C2, "ltrif", "BLACK LEFT-POINTING TRIANGLE" },
-{ 0x25C3, "ltri", "WHITE LEFT-POINTING TRIANGLE" },
-{ 0x25CA, "loz", "LOZENGE" },
-{ 0x25CB, "cir", "WHITE CIRCLE" },
-{ 0x25CB, "xcirc", "WHITE CIRCLE" },
-{ 0x2605, "starf", "BLACK STAR" },
-{ 0x260E, "phone", "TELEPHONE SIGN" },
-{ 0x2640, "female", "" },
-{ 0x2642, "male", "MALE SIGN" },
-{ 0x2660, "spades", "BLACK SPADE SUIT" },
-{ 0x2663, "clubs", "BLACK CLUB SUIT" },
-{ 0x2665, "hearts", "BLACK HEART SUIT" },
-{ 0x2666, "diams", "BLACK DIAMOND SUIT" },
-{ 0x2669, "sung", "" },
-{ 0x266D, "flat", "MUSIC FLAT SIGN" },
-{ 0x266E, "natur", "MUSIC NATURAL SIGN" },
-{ 0x266F, "sharp", "MUSIC SHARP SIGN" },
-{ 0x2713, "check", "CHECK MARK" },
-{ 0x2717, "cross", "BALLOT X" },
-{ 0x2720, "malt", "MALTESE CROSS" },
-{ 0x2726, "lozf", "" },
-{ 0x2736, "sext", "SIX POINTED BLACK STAR" },
-{ 0x3008, "lang", "" },
-{ 0x3009, "rang", "" },
-{ 0xE291, "rpargt", "" },
-{ 0xE2A2, "lnap", "" },
-{ 0xE2AA, "nsmid", "" },
-{ 0xE2B3, "prnE", "" },
-{ 0xE2B5, "scnE", "" },
-{ 0xE2B8, "vsubnE", "" },
-{ 0xE301, "smid", "" },
-{ 0xE411, "gnap", "" },
-{ 0xFB00, "fflig", "" },
-{ 0xFB01, "filig", "" },
-{ 0xFB02, "fllig", "" },
-{ 0xFB03, "ffilig", "" },
-{ 0xFB04, "ffllig", "" },
-{ 0xFE68, "sbsol", "SMALL REVERSE SOLIDUS" },
-};
-
-/************************************************************************
- * *
- * Commodity functions to handle entities *
- * *
- ************************************************************************/
-
-/*
- * Macro used to grow the current buffer.
- */
-#define growBuffer(buffer) { \
- buffer##_size *= 2; \
- buffer = (xmlChar *) xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \
- if (buffer == NULL) { \
- xmlGenericError(xmlGenericErrorContext, "realloc failed"); \
- return(NULL); \
- } \
-}
-
-/**
- * docbEntityLookup:
- * @name: the entity name
- *
- * Lookup the given entity in EntitiesTable
- *
- * TODO: the linear scan is really ugly, an hash table is really needed.
- *
- * Returns the associated docbEntityDescPtr if found, NULL otherwise.
- */
-static docbEntityDescPtr
-docbEntityLookup(const xmlChar *name) {
- unsigned int i;
-
- for (i = 0;i < (sizeof(docbookEntitiesTable)/
- sizeof(docbookEntitiesTable[0]));i++) {
- if (xmlStrEqual(name, BAD_CAST docbookEntitiesTable[i].name)) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"Found entity %s\n", name);
-#endif
- return(&docbookEntitiesTable[i]);
- }
- }
- return(NULL);
-}
-
-/**
- * docbEntityValueLookup:
- * @value: the entity's unicode value
- *
- * Lookup the given entity in EntitiesTable
- *
- * TODO: the linear scan is really ugly, an hash table is really needed.
- *
- * Returns the associated docbEntityDescPtr if found, NULL otherwise.
- */
-static docbEntityDescPtr
-docbEntityValueLookup(int value) {
- unsigned int i;
-#ifdef DEBUG
- int lv = 0;
-#endif
-
- for (i = 0;i < (sizeof(docbookEntitiesTable)/
- sizeof(docbookEntitiesTable[0]));i++) {
- if (docbookEntitiesTable[i].value >= value) {
- if (docbookEntitiesTable[i].value > value)
- break;
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"Found entity %s\n", docbookEntitiesTable[i].name);
-#endif
- return(&docbookEntitiesTable[i]);
- }
-#ifdef DEBUG
- if (lv > docbookEntitiesTable[i].value) {
- xmlGenericError(xmlGenericErrorContext,
- "docbookEntitiesTable[] is not sorted (%d > %d)!\n",
- lv, docbookEntitiesTable[i].value);
- }
- lv = docbookEntitiesTable[i].value;
-#endif
- }
- return(NULL);
-}
-
-#if 0
-/**
- * UTF8ToSgml:
- * @out: a pointer to an array of bytes to store the result
- * @outlen: the length of @out
- * @in: a pointer to an array of UTF-8 chars
- * @inlen: the length of @in
- *
- * Take a block of UTF-8 chars in and try to convert it to an ASCII
- * plus SGML entities block of chars out.
- *
- * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise
- * The value of @inlen after return is the number of octets consumed
- * as the return value is positive, else unpredictable.
- * The value of @outlen after return is the number of octets consumed.
- */
-int
-UTF8ToSgml(unsigned char* out, int *outlen,
- const unsigned char* in, int *inlen) {
- const unsigned char* processed = in;
- const unsigned char* outend;
- const unsigned char* outstart = out;
- const unsigned char* instart = in;
- const unsigned char* inend;
- unsigned int c, d;
- int trailing;
-
- if (in == NULL) {
- /*
- * initialization nothing to do
- */
- *outlen = 0;
- *inlen = 0;
- return(0);
- }
- inend = in + (*inlen);
- outend = out + (*outlen);
- while (in < inend) {
- d = *in++;
- if (d < 0x80) { c= d; trailing= 0; }
- else if (d < 0xC0) {
- /* trailing byte in leading position */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; }
- else if (d < 0xF0) { c= d & 0x0F; trailing= 2; }
- else if (d < 0xF8) { c= d & 0x07; trailing= 3; }
- else {
- /* no chance for this in Ascii */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- }
-
- if (inend - in < trailing) {
- break;
- }
-
- for ( ; trailing; trailing--) {
- if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80))
- break;
- c <<= 6;
- c |= d & 0x3F;
- }
-
- /* assertion: c is a single UTF-4 value */
- if (c < 0x80) {
- if (out + 1 >= outend)
- break;
- *out++ = c;
- } else {
- int len;
- docbEntityDescPtr ent;
-
- /*
- * Try to lookup a predefined SGML entity for it
- */
-
- ent = docbEntityValueLookup(c);
- if (ent == NULL) {
- /* no chance for this in Ascii */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- }
- len = strlen(ent->name);
- if (out + 2 + len >= outend)
- break;
- *out++ = '&';
- memcpy(out, ent->name, len);
- out += len;
- *out++ = ';';
- }
- processed = in;
- }
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(0);
-}
-#endif
-
-/**
- * docbEncodeEntities:
- * @out: a pointer to an array of bytes to store the result
- * @outlen: the length of @out
- * @in: a pointer to an array of UTF-8 chars
- * @inlen: the length of @in
- * @quoteChar: the quote character to escape (' or ") or zero.
- *
- * Take a block of UTF-8 chars in and try to convert it to an ASCII
- * plus SGML entities block of chars out.
- *
- * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise
- * The value of @inlen after return is the number of octets consumed
- * as the return value is positive, else unpredictable.
- * The value of @outlen after return is the number of octets consumed.
- */
-int
-docbEncodeEntities(unsigned char* out, int *outlen,
- const unsigned char* in, int *inlen, int quoteChar) {
- const unsigned char* processed = in;
- const unsigned char* outend = out + (*outlen);
- const unsigned char* outstart = out;
- const unsigned char* instart = in;
- const unsigned char* inend = in + (*inlen);
- unsigned int c, d;
- int trailing;
-
- while (in < inend) {
- d = *in++;
- if (d < 0x80) { c= d; trailing= 0; }
- else if (d < 0xC0) {
- /* trailing byte in leading position */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; }
- else if (d < 0xF0) { c= d & 0x0F; trailing= 2; }
- else if (d < 0xF8) { c= d & 0x07; trailing= 3; }
- else {
- /* no chance for this in Ascii */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- }
-
- if (inend - in < trailing)
- break;
-
- while (trailing--) {
- if (((d= *in++) & 0xC0) != 0x80) {
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- }
- c <<= 6;
- c |= d & 0x3F;
- }
-
- /* assertion: c is a single UTF-4 value */
- if (c < 0x80 && c != (unsigned int) quoteChar && c != '&' && c != '<' && c != '>') {
- if (out >= outend)
- break;
- *out++ = c;
- } else {
- docbEntityDescPtr ent;
- const char *cp;
- char nbuf[16];
- int len;
-
- /*
- * Try to lookup a predefined SGML entity for it
- */
- ent = docbEntityValueLookup(c);
- if (ent == NULL) {
- snprintf(nbuf, sizeof(nbuf), "#%u", c);
- cp = nbuf;
- }
- else
- cp = ent->name;
- len = strlen(cp);
- if (out + 2 + len > outend)
- break;
- *out++ = '&';
- memcpy(out, cp, len);
- out += len;
- *out++ = ';';
- }
- processed = in;
- }
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(0);
-}
-
-
-/************************************************************************
- * *
- * Commodity functions to handle streams *
- * *
- ************************************************************************/
-
-/**
- * docbNewInputStream:
- * @ctxt: an SGML parser context
- *
- * Create a new input stream structure
- * Returns the new input stream or NULL
- */
-static docbParserInputPtr
-docbNewInputStream(docbParserCtxtPtr ctxt) {
- docbParserInputPtr input;
-
- input = (xmlParserInputPtr) xmlMalloc(sizeof(docbParserInput));
- if (input == NULL) {
- ctxt->errNo = XML_ERR_NO_MEMORY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "malloc: couldn't allocate a new input stream\n");
- return(NULL);
- }
- memset(input, 0, sizeof(docbParserInput));
- input->filename = NULL;
- input->directory = NULL;
- input->base = NULL;
- input->cur = NULL;
- input->buf = NULL;
- input->line = 1;
- input->col = 1;
- input->buf = NULL;
- input->free = NULL;
- input->version = NULL;
- input->consumed = 0;
- input->length = 0;
- return(input);
-}
-
-
-/************************************************************************
- * *
- * Commodity functions, cleanup needed ? *
- * *
- ************************************************************************/
-
-/**
- * areBlanks:
- * @ctxt: an SGML parser context
- * @str: a xmlChar *
- * @len: the size of @str
- *
- * Is this a sequence of blank chars that one can ignore ?
- *
- * Returns 1 if ignorable 0 otherwise.
- */
-
-static int areBlanks(docbParserCtxtPtr ctxt, const xmlChar *str, int len) {
- int i;
- xmlNodePtr lastChild;
-
- for (i = 0;i < len;i++)
- if (!(IS_BLANK(str[i]))) return(0);
-
- if (CUR == 0) return(1);
- if (CUR != '<') return(0);
- if (ctxt->name == NULL)
- return(1);
- if (ctxt->node == NULL) return(0);
- lastChild = xmlGetLastChild(ctxt->node);
- if (lastChild == NULL) {
- if ((ctxt->node->type != XML_ELEMENT_NODE) &&
- (ctxt->node->content != NULL)) return(0);
- } else if (xmlNodeIsText(lastChild))
- return(0);
- return(1);
-}
-
-/************************************************************************
- * *
- * External entities support *
- * *
- ************************************************************************/
-
-/**
- * docbParseCtxtExternalEntity:
- * @ctx: the existing parsing context
- * @URL: the URL for the entity to load
- * @ID: the System ID for the entity to load
- * @list: the return value for the set of parsed nodes
- *
- * Parse an external general entity within an existing parsing context
- *
- * Returns 0 if the entity is well formed, -1 in case of args problem and
- * the parser error code otherwise
- */
-
-static int
-docbParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL,
- const xmlChar *ID, xmlNodePtr *list) {
- xmlParserCtxtPtr ctxt;
- xmlDocPtr newDoc;
- xmlSAXHandlerPtr oldsax = NULL;
- int ret = 0;
-
- if (ctx->depth > 40) {
- return(XML_ERR_ENTITY_LOOP);
- }
-
- if (list != NULL)
- *list = NULL;
- if ((URL == NULL) && (ID == NULL))
- return(-1);
- if (ctx->myDoc == NULL) /* @@ relax but check for dereferences */
- return(-1);
-
-
- ctxt = xmlCreateEntityParserCtxt(URL, ID, ctx->myDoc->URL);
- if (ctxt == NULL) return(-1);
- ctxt->userData = ctxt;
- oldsax = ctxt->sax;
- ctxt->sax = ctx->sax;
- newDoc = xmlNewDoc(BAD_CAST "1.0");
- if (newDoc == NULL) {
- xmlFreeParserCtxt(ctxt);
- return(-1);
- }
- if (ctx->myDoc != NULL) {
- newDoc->intSubset = ctx->myDoc->intSubset;
- newDoc->extSubset = ctx->myDoc->extSubset;
- }
- if (ctx->myDoc->URL != NULL) {
- newDoc->URL = xmlStrdup(ctx->myDoc->URL);
- }
- newDoc->children = xmlNewDocNode(newDoc, NULL, BAD_CAST "pseudoroot", NULL);
- if (newDoc->children == NULL) {
- ctxt->sax = oldsax;
- xmlFreeParserCtxt(ctxt);
- newDoc->intSubset = NULL;
- newDoc->extSubset = NULL;
- xmlFreeDoc(newDoc);
- return(-1);
- }
- nodePush(ctxt, newDoc->children);
- if (ctx->myDoc == NULL) {
- ctxt->myDoc = newDoc;
- } else {
- ctxt->myDoc = ctx->myDoc;
- newDoc->children->doc = ctx->myDoc;
- }
-
- /*
- * Parse a possible text declaration first
- */
- GROW;
- if ((RAW == '<') && (NXT(1) == '?') &&
- (NXT(2) == 'x') && (NXT(3) == 'm') &&
- (NXT(4) == 'l') && (IS_BLANK(NXT(5)))) {
- xmlParseTextDecl(ctxt);
- }
-
- /*
- * Doing validity checking on chunk doesn't make sense
- */
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->validate = ctx->validate;
- ctxt->loadsubset = ctx->loadsubset;
- ctxt->depth = ctx->depth + 1;
- ctxt->replaceEntities = ctx->replaceEntities;
- if (ctxt->validate) {
- ctxt->vctxt.error = ctx->vctxt.error;
- ctxt->vctxt.warning = ctx->vctxt.warning;
- /* Allocate the Node stack */
- ctxt->vctxt.nodeTab = (xmlNodePtr *) xmlMalloc(4 * sizeof(xmlNodePtr));
- if (ctxt->vctxt.nodeTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "docbParseCtxtExternalEntity: out of memory\n");
- ctxt->validate = 0;
- ctxt->vctxt.error = NULL;
- ctxt->vctxt.warning = NULL;
- } else {
- ctxt->vctxt.nodeNr = 0;
- ctxt->vctxt.nodeMax = 4;
- ctxt->vctxt.node = NULL;
- }
- } else {
- ctxt->vctxt.error = NULL;
- ctxt->vctxt.warning = NULL;
- }
-
- docbParseContent(ctxt);
-
- if ((RAW == '<') && (NXT(1) == '/')) {
- ctxt->errNo = XML_ERR_NOT_WELL_BALANCED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "chunk is not well balanced\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else if (RAW != 0) {
- ctxt->errNo = XML_ERR_EXTRA_CONTENT;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "extra content at the end of well balanced chunk\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if (ctxt->node != newDoc->children) {
- ctxt->errNo = XML_ERR_NOT_WELL_BALANCED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "chunk is not well balanced\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- if (!ctxt->wellFormed) {
- if (ctxt->errNo == 0)
- ret = 1;
- else
- ret = ctxt->errNo;
- } else {
- if (list != NULL) {
- xmlNodePtr cur;
-
- /*
- * Return the newly created nodeset after unlinking it from
- * they pseudo parent.
- */
- cur = newDoc->children->children;
- *list = cur;
- while (cur != NULL) {
- cur->parent = NULL;
- cur = cur->next;
- }
- newDoc->children->children = NULL;
- }
- ret = 0;
- }
- ctxt->sax = oldsax;
- xmlFreeParserCtxt(ctxt);
- newDoc->intSubset = NULL;
- newDoc->extSubset = NULL;
- xmlFreeDoc(newDoc);
-
- return(ret);
-}
-
-/************************************************************************
- * *
- * The parser itself *
- * *
- ************************************************************************/
-
-/**
- * docbParseSGMLName:
- * @ctxt: an SGML parser context
- *
- * parse an SGML tag or attribute name, note that we convert it to lowercase
- * since SGML names are not case-sensitive.
- *
- * Returns the Tag Name parsed or NULL
- */
-
-static xmlChar *
-docbParseSGMLName(docbParserCtxtPtr ctxt) {
- xmlChar *ret = NULL;
- int i = 0;
- xmlChar loc[DOCB_PARSER_BUFFER_SIZE];
-
- if (!IS_LETTER(CUR) && (CUR != '_') &&
- (CUR != ':')) return(NULL);
-
- while ((i < DOCB_PARSER_BUFFER_SIZE) &&
- ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) ||
- (CUR == ':') || (CUR == '_'))) {
- if ((CUR >= 'A') && (CUR <= 'Z')) loc[i] = CUR + 0x20;
- else loc[i] = CUR;
- i++;
-
- NEXT;
- }
-
- ret = xmlStrndup(loc, i);
-
- return(ret);
-}
-
-/**
- * docbParseName:
- * @ctxt: an SGML parser context
- *
- * parse an SGML name, this routine is case sensitive.
- *
- * Returns the Name parsed or NULL
- */
-
-static xmlChar *
-docbParseName(docbParserCtxtPtr ctxt) {
- xmlChar buf[DOCB_MAX_NAMELEN];
- int len = 0;
-
- GROW;
- if (!IS_LETTER(CUR) && (CUR != '_')) {
- return(NULL);
- }
-
- while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) ||
- (CUR == '.') || (CUR == '-') ||
- (CUR == '_') || (CUR == ':') ||
- (IS_COMBINING(CUR)) ||
- (IS_EXTENDER(CUR))) {
- buf[len++] = CUR;
- NEXT;
- if (len >= DOCB_MAX_NAMELEN) {
- xmlGenericError(xmlGenericErrorContext,
- "docbParseName: reached DOCB_MAX_NAMELEN limit\n");
- while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) ||
- (CUR == '.') || (CUR == '-') ||
- (CUR == '_') || (CUR == ':') ||
- (IS_COMBINING(CUR)) ||
- (IS_EXTENDER(CUR)))
- NEXT;
- break;
- }
- }
- return(xmlStrndup(buf, len));
-}
-
-/**
- * docbParseSGMLAttribute:
- * @ctxt: an SGML parser context
- * @stop: a char stop value
- *
- * parse an SGML attribute value till the stop (quote), if
- * stop is 0 then it stops at the first space
- *
- * Returns the attribute parsed or NULL
- */
-
-static xmlChar *
-docbParseSGMLAttribute(docbParserCtxtPtr ctxt, const xmlChar stop) {
- xmlChar *buffer = NULL;
- int buffer_size = 0;
- xmlChar *out = NULL;
- xmlChar *name = NULL;
-
- xmlChar *cur = NULL;
- xmlEntityPtr xent;
- docbEntityDescPtr ent;
-
- /*
- * allocate a translation buffer.
- */
- buffer_size = DOCB_PARSER_BIG_BUFFER_SIZE;
- buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
- if (buffer == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "docbParseSGMLAttribute: malloc failed");
- return(NULL);
- }
- out = buffer;
-
- /*
- * Ok loop until we reach one of the ending chars
- */
- while ((CUR != 0) && (CUR != stop) && (CUR != '>')) {
- if ((stop == 0) && (IS_BLANK(CUR))) break;
- if (CUR == '&') {
- if (NXT(1) == '#') {
- unsigned int c;
- int bits;
-
- c = docbParseCharRef(ctxt);
- if (c < 0x80)
- { *out++ = c; bits= -6; }
- else if (c < 0x800)
- { *out++ =((c >> 6) & 0x1F) | 0xC0; bits= 0; }
- else if (c < 0x10000)
- { *out++ =((c >> 12) & 0x0F) | 0xE0; bits= 6; }
- else
- { *out++ =((c >> 18) & 0x07) | 0xF0; bits= 12; }
-
- for ( ; bits >= 0; bits-= 6) {
- *out++ = ((c >> bits) & 0x3F) | 0x80;
- }
- } else {
- xent = docbParseEntityRef(ctxt, &name);
- if (name == NULL) {
- *out++ = '&';
- if (out - buffer > buffer_size - 100) {
- int indx = out - buffer;
-
- growBuffer(buffer);
- out = &buffer[indx];
- }
- *out++ = '&';
- } else {
- ent = docbEntityLookup(name);
- if (ent == NULL) {
- *out++ = '&';
- cur = name;
- while (*cur != 0) {
- if (out - buffer > buffer_size - 100) {
- int indx = out - buffer;
-
- growBuffer(buffer);
- out = &buffer[indx];
- }
- *out++ = *cur++;
- }
- xmlFree(name);
- } else {
- unsigned int c;
- int bits;
-
- if (out - buffer > buffer_size - 100) {
- int indx = out - buffer;
-
- growBuffer(buffer);
- out = &buffer[indx];
- }
- c = (xmlChar)ent->value;
- if (c < 0x80)
- { *out++ = c; bits= -6; }
- else if (c < 0x800)
- { *out++ =((c >> 6) & 0x1F) | 0xC0; bits= 0; }
- else if (c < 0x10000)
- { *out++ =((c >> 12) & 0x0F) | 0xE0; bits= 6; }
- else
- { *out++ =((c >> 18) & 0x07) | 0xF0; bits= 12; }
-
- for ( ; bits >= 0; bits-= 6) {
- *out++ = ((c >> bits) & 0x3F) | 0x80;
- }
- xmlFree(name);
- }
- }
- }
- } else {
- unsigned int c;
- int bits;
-
- if (out - buffer > buffer_size - 100) {
- int indx = out - buffer;
-
- growBuffer(buffer);
- out = &buffer[indx];
- }
- c = CUR;
- if (c < 0x80)
- { *out++ = c; bits= -6; }
- else if (c < 0x800)
- { *out++ =((c >> 6) & 0x1F) | 0xC0; bits= 0; }
- else if (c < 0x10000)
- { *out++ =((c >> 12) & 0x0F) | 0xE0; bits= 6; }
- else
- { *out++ =((c >> 18) & 0x07) | 0xF0; bits= 12; }
-
- for ( ; bits >= 0; bits-= 6) {
- *out++ = ((c >> bits) & 0x3F) | 0x80;
- }
- NEXT;
- }
- }
- *out++ = 0;
- return(buffer);
-}
-
-
-/**
- * docbParseEntityRef:
- * @ctxt: an SGML parser context
- * @str: location to store the entity name
- *
- * parse an SGML ENTITY references
- *
- * [68] EntityRef ::= '&' Name ';'
- *
- * Returns the associated xmlEntityPtr if found, or NULL otherwise,
- * if non-NULL *str will have to be freed by the caller.
- */
-static xmlEntityPtr
-docbParseEntityRef(docbParserCtxtPtr ctxt, xmlChar **str) {
- xmlChar *name;
- xmlEntityPtr ent = NULL;
- *str = NULL;
-
- if (CUR == '&') {
- NEXT;
- name = docbParseName(ctxt);
- if (name == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "docbParseEntityRef: no name\n");
- ctxt->wellFormed = 0;
- } else {
- GROW;
- if (CUR == ';') {
- *str = name;
-
- /*
- * Ask first SAX for entity resolution, otherwise try the
- * predefined set.
- */
- if (ctxt->sax != NULL) {
- if (ctxt->sax->getEntity != NULL)
- ent = ctxt->sax->getEntity(ctxt->userData, name);
- if (ent == NULL)
- ent = xmlGetPredefinedEntity(name);
- }
- NEXT;
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "docbParseEntityRef: expecting ';'\n");
- *str = name;
- }
- }
- }
- return(ent);
-}
-
-/**
- * docbParseAttValue:
- * @ctxt: an SGML parser context
- *
- * parse a value for an attribute
- * Note: the parser won't do substitution of entities here, this
- * will be handled later in xmlStringGetNodeList, unless it was
- * asked for ctxt->replaceEntities != 0
- *
- * Returns the AttValue parsed or NULL.
- */
-
-static xmlChar *
-docbParseAttValue(docbParserCtxtPtr ctxt) {
- xmlChar *ret = NULL;
-
- if (CUR == '"') {
- NEXT;
- ret = docbParseSGMLAttribute(ctxt, '"');
- if (CUR != '"') {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "AttValue: ' expected\n");
- ctxt->wellFormed = 0;
- } else
- NEXT;
- } else if (CUR == '\'') {
- NEXT;
- ret = docbParseSGMLAttribute(ctxt, '\'');
- if (CUR != '\'') {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "AttValue: ' expected\n");
- ctxt->wellFormed = 0;
- } else
- NEXT;
- } else {
- /*
- * That's an SGMLism, the attribute value may not be quoted
- */
- ret = docbParseSGMLAttribute(ctxt, 0);
- if (ret == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "AttValue: no value found\n");
- ctxt->wellFormed = 0;
- }
- }
- return(ret);
-}
-
-/**
- * docbParseSystemLiteral:
- * @ctxt: an SGML parser context
- *
- * parse an SGML Literal
- *
- * [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")
- *
- * Returns the SystemLiteral parsed or NULL
- */
-
-static xmlChar *
-docbParseSystemLiteral(docbParserCtxtPtr ctxt) {
- const xmlChar *q;
- xmlChar *ret = NULL;
-
- if (CUR == '"') {
- NEXT;
- q = CUR_PTR;
- while ((IS_CHAR(CUR)) && (CUR != '"'))
- NEXT;
- if (!IS_CHAR(CUR)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Unfinished SystemLiteral\n");
- ctxt->wellFormed = 0;
- } else {
- ret = xmlStrndup(q, CUR_PTR - q);
- NEXT;
- }
- } else if (CUR == '\'') {
- NEXT;
- q = CUR_PTR;
- while ((IS_CHAR(CUR)) && (CUR != '\''))
- NEXT;
- if (!IS_CHAR(CUR)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Unfinished SystemLiteral\n");
- ctxt->wellFormed = 0;
- } else {
- ret = xmlStrndup(q, CUR_PTR - q);
- NEXT;
- }
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "SystemLiteral \" or ' expected\n");
- ctxt->wellFormed = 0;
- }
-
- return(ret);
-}
-
-/**
- * docbParsePubidLiteral:
- * @ctxt: an SGML parser context
- *
- * parse an SGML public literal
- *
- * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
- *
- * Returns the PubidLiteral parsed or NULL.
- */
-
-static xmlChar *
-docbParsePubidLiteral(docbParserCtxtPtr ctxt) {
- const xmlChar *q;
- xmlChar *ret = NULL;
- /*
- * Name ::= (Letter | '_') (NameChar)*
- */
- if (CUR == '"') {
- NEXT;
- q = CUR_PTR;
- while (IS_PUBIDCHAR(CUR)) NEXT;
- if (CUR != '"') {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Unfinished PubidLiteral\n");
- ctxt->wellFormed = 0;
- } else {
- ret = xmlStrndup(q, CUR_PTR - q);
- NEXT;
- }
- } else if (CUR == '\'') {
- NEXT;
- q = CUR_PTR;
- while ((IS_LETTER(CUR)) && (CUR != '\''))
- NEXT;
- if (!IS_LETTER(CUR)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Unfinished PubidLiteral\n");
- ctxt->wellFormed = 0;
- } else {
- ret = xmlStrndup(q, CUR_PTR - q);
- NEXT;
- }
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "SystemLiteral \" or ' expected\n");
- ctxt->wellFormed = 0;
- }
-
- return(ret);
-}
-
-/**
- * docbParseCharData:
- * @ctxt: an SGML parser context
- * @cdata: int indicating whether we are within a CDATA section
- *
- * parse a CharData section.
- * if we are within a CDATA section ']]>' marks an end of section.
- *
- * [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)
- */
-
-static void
-docbParseCharData(docbParserCtxtPtr ctxt) {
- xmlChar buf[DOCB_PARSER_BIG_BUFFER_SIZE + 5];
- int nbchar = 0;
- int cur, l;
-
- SHRINK;
- cur = CUR_CHAR(l);
- while (((cur != '<') || (ctxt->token == '<')) &&
- ((cur != '&') || (ctxt->token == '&')) &&
- (IS_CHAR(cur))) {
- COPY_BUF(l,buf,nbchar,cur);
- if (nbchar >= DOCB_PARSER_BIG_BUFFER_SIZE) {
- /*
- * Ok the segment is to be consumed as chars.
- */
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) {
- if (areBlanks(ctxt, buf, nbchar)) {
- if (ctxt->sax->ignorableWhitespace != NULL)
- ctxt->sax->ignorableWhitespace(ctxt->userData,
- buf, nbchar);
- } else {
- if (ctxt->sax->characters != NULL)
- ctxt->sax->characters(ctxt->userData, buf, nbchar);
- }
- }
- nbchar = 0;
- }
- NEXTL(l);
- cur = CUR_CHAR(l);
- }
- if (nbchar != 0) {
- /*
- * Ok the segment is to be consumed as chars.
- */
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) {
- if (areBlanks(ctxt, buf, nbchar)) {
- if (ctxt->sax->ignorableWhitespace != NULL)
- ctxt->sax->ignorableWhitespace(ctxt->userData, buf, nbchar);
- } else {
- if (ctxt->sax->characters != NULL)
- ctxt->sax->characters(ctxt->userData, buf, nbchar);
- }
- }
- }
-}
-
-/**
- * docbParseExternalID:
- * @ctxt: an SGML parser context
- * @publicID: a xmlChar** receiving PubidLiteral
- *
- * Parse an External ID or a Public ID
- *
- * Returns the function returns SystemLiteral and in the second
- * case publicID receives PubidLiteral,
- * it is possible to return NULL and have publicID set.
- */
-
-static xmlChar *
-docbParseExternalID(docbParserCtxtPtr ctxt, xmlChar **publicID) {
- xmlChar *URI = NULL;
-
- if ((UPPER == 'S') && (UPP(1) == 'Y') &&
- (UPP(2) == 'S') && (UPP(3) == 'T') &&
- (UPP(4) == 'E') && (UPP(5) == 'M')) {
- SKIP(6);
- if (!IS_BLANK(CUR)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after 'SYSTEM'\n");
- ctxt->wellFormed = 0;
- }
- SKIP_BLANKS;
- URI = docbParseSystemLiteral(ctxt);
- if (URI == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "docbParseExternalID: SYSTEM, no URI\n");
- ctxt->wellFormed = 0;
- }
- } else if ((UPPER == 'P') && (UPP(1) == 'U') &&
- (UPP(2) == 'B') && (UPP(3) == 'L') &&
- (UPP(4) == 'I') && (UPP(5) == 'C')) {
- SKIP(6);
- if (!IS_BLANK(CUR)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after 'PUBLIC'\n");
- ctxt->wellFormed = 0;
- }
- SKIP_BLANKS;
- *publicID = docbParsePubidLiteral(ctxt);
- if (*publicID == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "docbParseExternalID: PUBLIC, no Public Identifier\n");
- ctxt->wellFormed = 0;
- }
- SKIP_BLANKS;
- if ((CUR == '"') || (CUR == '\'')) {
- URI = docbParseSystemLiteral(ctxt);
- }
- }
- return(URI);
-}
-
-/**
- * docbParsePI:
- * @ctxt: an XML parser context
- *
- * parse an XML Processing Instruction.
- *
- * [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
- *
- * The processing is transfered to SAX once parsed.
- */
-
-static void
-docbParsePI(xmlParserCtxtPtr ctxt) {
- xmlChar *buf = NULL;
- int len = 0;
- int size = DOCB_PARSER_BUFFER_SIZE;
- int cur, l;
- xmlChar *target;
- xmlParserInputState state;
- int count = 0;
-
- if ((RAW == '<') && (NXT(1) == '?')) {
- xmlParserInputPtr input = ctxt->input;
- state = ctxt->instate;
- ctxt->instate = XML_PARSER_PI;
- /*
- * this is a Processing Instruction.
- */
- SKIP(2);
- SHRINK;
-
- /*
- * Parse the target name and check for special support like
- * namespace.
- */
- target = xmlParseName(ctxt);
- if (target != NULL) {
- xmlChar *encoding = NULL;
-
- if ((RAW == '?') && (NXT(1) == '>')) {
- if (input != ctxt->input) {
- ctxt->errNo = XML_ERR_ENTITY_BOUNDARY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "PI declaration doesn't start and stop in the same entity\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP(2);
-
- /*
- * SAX: PI detected.
- */
- if ((ctxt->sax) && (!ctxt->disableSAX) &&
- (ctxt->sax->processingInstruction != NULL))
- ctxt->sax->processingInstruction(ctxt->userData,
- target, NULL);
- ctxt->instate = state;
- xmlFree(target);
- return;
- }
- if (xmlStrEqual(target, BAD_CAST "sgml-declaration")) {
-
- encoding = xmlParseEncodingDecl(ctxt);
- if (encoding == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "sgml-declaration: failed to find/handle encoding\n");
-#ifdef DEBUG
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "switched to encoding %s\n", encoding);
-#endif
- }
-
- }
- buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", size);
- ctxt->instate = state;
- return;
- }
- cur = CUR;
- if (encoding != NULL) {
- len = snprintf((char *) buf, size - 1,
- " encoding = \"%s\"", encoding);
- if (len < 0)
- len = size;
- } else {
- if (!IS_BLANK(cur)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "docbParsePI: PI %s space expected\n", target);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
- }
- cur = CUR_CHAR(l);
- while (IS_CHAR(cur) && /* checked */
- ((cur != '?') || (NXT(1) != '>'))) {
- if (len + 5 >= size) {
- size *= 2;
- buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %d byte failed\n", size);
- ctxt->instate = state;
- return;
- }
- }
- count++;
- if (count > 50) {
- GROW;
- count = 0;
- }
- COPY_BUF(l,buf,len,cur);
- NEXTL(l);
- cur = CUR_CHAR(l);
- if (cur == 0) {
- SHRINK;
- GROW;
- cur = CUR_CHAR(l);
- }
- }
- buf[len] = 0;
- if (cur != '?') {
- ctxt->errNo = XML_ERR_PI_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "docbParsePI: PI %s never end ...\n", target);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- if (input != ctxt->input) {
- ctxt->errNo = XML_ERR_ENTITY_BOUNDARY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "PI declaration doesn't start and stop in the same entity\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP(2);
-
- /*
- * SAX: PI detected.
- */
- if ((ctxt->sax) && (!ctxt->disableSAX) &&
- (ctxt->sax->processingInstruction != NULL))
- ctxt->sax->processingInstruction(ctxt->userData,
- target, buf);
- }
- xmlFree(buf);
- xmlFree(target);
- } else {
- ctxt->errNo = XML_ERR_PI_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "docbParsePI : no target name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- ctxt->instate = state;
- }
-}
-
-/**
- * docbParseComment:
- * @ctxt: an SGML parser context
- *
- * Parse an XML (SGML) comment <!-- .... -->
- *
- * [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
- */
-static void
-docbParseComment(docbParserCtxtPtr ctxt) {
- xmlChar *buf = NULL;
- int len;
- int size = DOCB_PARSER_BUFFER_SIZE;
- int q, ql;
- int r, rl;
- int cur, l;
- xmlParserInputState state;
-
- /*
- * Check that there is a comment right here.
- */
- if ((RAW != '<') || (NXT(1) != '!') ||
- (NXT(2) != '-') || (NXT(3) != '-')) return;
-
- state = ctxt->instate;
- ctxt->instate = XML_PARSER_COMMENT;
- SHRINK;
- SKIP(4);
- buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", size);
- ctxt->instate = state;
- return;
- }
- q = CUR_CHAR(ql);
- NEXTL(ql);
- r = CUR_CHAR(rl);
- NEXTL(rl);
- cur = CUR_CHAR(l);
- len = 0;
- while (IS_CHAR(cur) &&
- ((cur != '>') ||
- (r != '-') || (q != '-'))) {
- if (len + 5 >= size) {
- size *= 2;
- buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %d byte failed\n", size);
- ctxt->instate = state;
- return;
- }
- }
- COPY_BUF(ql,buf,len,q);
- q = r;
- ql = rl;
- r = cur;
- rl = l;
- NEXTL(l);
- cur = CUR_CHAR(l);
- if (cur == 0) {
- SHRINK;
- GROW;
- cur = CUR_CHAR(l);
- }
- }
- buf[len] = 0;
- if (!IS_CHAR(cur)) {
- ctxt->errNo = XML_ERR_COMMENT_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Comment not terminated \n<!--%.50s\n", buf);
- ctxt->wellFormed = 0;
- xmlFree(buf);
- } else {
- NEXT;
- if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) &&
- (!ctxt->disableSAX))
- ctxt->sax->comment(ctxt->userData, buf);
- xmlFree(buf);
- }
- ctxt->instate = state;
-}
-
-/**
- * docbParseCharRef:
- * @ctxt: an SGML parser context
- *
- * parse Reference declarations
- *
- * [66] CharRef ::= '&#' [0-9]+ ';' |
- * '&#x' [0-9a-fA-F]+ ';'
- *
- * Returns the value parsed (as an int)
- */
-static int
-docbParseCharRef(docbParserCtxtPtr ctxt) {
- int val = 0;
-
- if ((CUR == '&') && (NXT(1) == '#') &&
- (NXT(2) == 'x')) {
- SKIP(3);
- while (CUR != ';') {
- if ((CUR >= '0') && (CUR <= '9'))
- val = val * 16 + (CUR - '0');
- else if ((CUR >= 'a') && (CUR <= 'f'))
- val = val * 16 + (CUR - 'a') + 10;
- else if ((CUR >= 'A') && (CUR <= 'F'))
- val = val * 16 + (CUR - 'A') + 10;
- else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "docbParseCharRef: invalid hexadecimal value\n");
- ctxt->wellFormed = 0;
- val = 0;
- break;
- }
- NEXT;
- }
- if (CUR == ';')
- NEXT;
- } else if ((CUR == '&') && (NXT(1) == '#')) {
- SKIP(2);
- while (CUR != ';') {
- if ((CUR >= '0') && (CUR <= '9'))
- val = val * 10 + (CUR - '0');
- else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "docbParseCharRef: invalid decimal value\n");
- ctxt->wellFormed = 0;
- val = 0;
- break;
- }
- NEXT;
- }
- if (CUR == ';')
- NEXT;
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "docbParseCharRef: invalid value\n");
- ctxt->wellFormed = 0;
- }
- /*
- * Check the value IS_CHAR ...
- */
- if (IS_CHAR(val)) {
- return(val);
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "docbParseCharRef: invalid xmlChar value %d\n",
- val);
- ctxt->wellFormed = 0;
- }
- return(0);
-}
-
-
-/**
- * docbParseDocTypeDecl:
- * @ctxt: an SGML parser context
- *
- * parse a DOCTYPE declaration
- *
- * [28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S?
- * ('[' (markupdecl | PEReference | S)* ']' S?)? '>'
- */
-
-static void
-docbParseDocTypeDecl(docbParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlChar *ExternalID = NULL;
- xmlChar *URI = NULL;
-
- /*
- * We know that '<!DOCTYPE' has been detected.
- */
- SKIP(9);
-
- SKIP_BLANKS;
-
- /*
- * Parse the DOCTYPE name.
- */
- name = docbParseName(ctxt);
- if (name == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "docbParseDocTypeDecl : no DOCTYPE name !\n");
- ctxt->wellFormed = 0;
- }
- /*
- * Check that upper(name) == "SGML" !!!!!!!!!!!!!
- */
-
- SKIP_BLANKS;
-
- /*
- * Check for SystemID and ExternalID
- */
- URI = docbParseExternalID(ctxt, &ExternalID);
- SKIP_BLANKS;
-
- /*
- * Create or update the document accordingly to the DOCTYPE
- * But use the predefined PUBLIC and SYSTEM ID of DocBook XML
- */
- if ((ctxt->sax != NULL) && (ctxt->sax->internalSubset != NULL) &&
- (!ctxt->disableSAX))
- ctxt->sax->internalSubset(ctxt->userData, name,
- XML_DOCBOOK_XML_PUBLIC,
- XML_DOCBOOK_XML_SYSTEM);
-
- if (RAW != '>') {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "docbParseDocTypeDecl : internal subset not handled\n");
- } else {
- NEXT;
- }
-
- /*
- * Cleanup, since we don't use all those identifiers
- */
- if (URI != NULL) xmlFree(URI);
- if (ExternalID != NULL) xmlFree(ExternalID);
- if (name != NULL) xmlFree(name);
-}
-
-/**
- * docbParseAttribute:
- * @ctxt: an SGML parser context
- * @value: a xmlChar ** used to store the value of the attribute
- *
- * parse an attribute
- *
- * [41] Attribute ::= Name Eq AttValue
- *
- * [25] Eq ::= S? '=' S?
- *
- * With namespace:
- *
- * [NS 11] Attribute ::= QName Eq AttValue
- *
- * Also the case QName == xmlns:??? is handled independently as a namespace
- * definition.
- *
- * Returns the attribute name, and the value in *value.
- */
-
-static xmlChar *
-docbParseAttribute(docbParserCtxtPtr ctxt, xmlChar **value) {
- xmlChar *name, *val = NULL;
-
- *value = NULL;
- name = docbParseName(ctxt);
- if (name == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "error parsing attribute name\n");
- ctxt->wellFormed = 0;
- return(NULL);
- }
-
- /*
- * read the value
- */
- SKIP_BLANKS;
- if (CUR == '=') {
- NEXT;
- SKIP_BLANKS;
- val = docbParseAttValue(ctxt);
- /******
- } else {
- * TODO : some attribute must have values, some may not
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->warning(ctxt->userData,
- "No value for attribute %s\n", name); */
- }
-
- *value = val;
- return(name);
-}
-
-/**
- * docbCheckEncoding:
- * @ctxt: an SGML parser context
- * @attvalue: the attribute value
- *
- * Checks an http-equiv attribute from a Meta tag to detect
- * the encoding
- * If a new encoding is detected the parser is switched to decode
- * it and pass UTF8
- */
-static void
-docbCheckEncoding(docbParserCtxtPtr ctxt, const xmlChar *attvalue) {
- const xmlChar *encoding;
-
- if ((ctxt == NULL) || (attvalue == NULL))
- return;
-
- encoding = xmlStrstr(attvalue, BAD_CAST"charset=");
- if (encoding == NULL)
- encoding = xmlStrstr(attvalue, BAD_CAST"Charset=");
- if (encoding == NULL)
- encoding = xmlStrstr(attvalue, BAD_CAST"CHARSET=");
- if (encoding != NULL) {
- encoding += 8;
- } else {
- encoding = xmlStrstr(attvalue, BAD_CAST"charset =");
- if (encoding == NULL)
- encoding = xmlStrstr(attvalue, BAD_CAST"Charset =");
- if (encoding == NULL)
- encoding = xmlStrstr(attvalue, BAD_CAST"CHARSET =");
- if (encoding != NULL)
- encoding += 9;
- }
- /*
- * Restricted from 2.3.5 */
- if (encoding != NULL) {
- xmlCharEncoding enc;
-
- if (ctxt->input->encoding != NULL)
- xmlFree((xmlChar *) ctxt->input->encoding);
- ctxt->input->encoding = encoding;
-
- enc = xmlParseCharEncoding((const char *) encoding);
- if (enc == XML_CHAR_ENCODING_8859_1) {
- ctxt->charset = XML_CHAR_ENCODING_8859_1;
- } else if (enc != XML_CHAR_ENCODING_UTF8) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Unsupported encoding %s\n", encoding);
- /* xmlFree(encoding); */
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
- }
- }
-}
-
-/**
- * docbCheckMeta:
- * @ctxt: an SGML parser context
- * @atts: the attributes values
- *
- * Checks an attributes from a Meta tag
- */
-static void
-docbCheckMeta(docbParserCtxtPtr ctxt, const xmlChar **atts) {
- int i;
- const xmlChar *att, *value;
- int http = 0;
- const xmlChar *content = NULL;
-
- if ((ctxt == NULL) || (atts == NULL))
- return;
-
- i = 0;
- att = atts[i++];
- while (att != NULL) {
- value = atts[i++];
- if ((value != NULL) &&
- ((xmlStrEqual(att, BAD_CAST"http-equiv")) ||
- (xmlStrEqual(att, BAD_CAST"Http-Equiv")) ||
- (xmlStrEqual(att, BAD_CAST"HTTP-EQUIV"))) &&
- ((xmlStrEqual(value, BAD_CAST"Content-Type")) ||
- (xmlStrEqual(value, BAD_CAST"content-type")) ||
- (xmlStrEqual(value, BAD_CAST"CONTENT-TYPE"))))
- http = 1;
- else if ((value != NULL) &&
- ((xmlStrEqual(att, BAD_CAST"content")) ||
- (xmlStrEqual(att, BAD_CAST"Content")) ||
- (xmlStrEqual(att, BAD_CAST"CONTENT"))))
- content = value;
- att = atts[i++];
- }
- if ((http) && (content != NULL))
- docbCheckEncoding(ctxt, content);
-
-}
-
-/**
- * docbParseStartTag:
- * @ctxt: an SGML parser context
- *
- * parse a start of tag either for rule element or
- * EmptyElement. In both case we don't parse the tag closing chars.
- *
- * [40] STag ::= '<' Name (S Attribute)* S? '>'
- *
- * [44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>'
- *
- * With namespace:
- *
- * [NS 8] STag ::= '<' QName (S Attribute)* S? '>'
- *
- * [NS 10] EmptyElement ::= '<' QName (S Attribute)* S? '/>'
- *
- */
-
-static void
-docbParseStartTag(docbParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlChar *attname;
- xmlChar *attvalue;
- const xmlChar **atts = NULL;
- int nbatts = 0;
- int maxatts = 0;
- int meta = 0;
- int i;
-
- if (CUR != '<') return;
- NEXT;
-
- GROW;
- name = docbParseSGMLName(ctxt);
- if (name == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "docbParseStartTag: invalid element name\n");
- ctxt->wellFormed = 0;
- return;
- }
- if (xmlStrEqual(name, BAD_CAST"meta"))
- meta = 1;
-
- /*
- * Check for auto-closure of SGML elements.
- */
- docbAutoClose(ctxt, name);
-
- /*
- * Now parse the attributes, it ends up with the ending
- *
- * (S Attribute)* S?
- */
- SKIP_BLANKS;
- while ((IS_CHAR(CUR)) &&
- (CUR != '>') &&
- ((CUR != '/') || (NXT(1) != '>'))) {
- long cons = ctxt->nbChars;
-
- GROW;
- attname = docbParseAttribute(ctxt, &attvalue);
- if (attname != NULL) {
-
- /*
- * Well formedness requires at most one declaration of an attribute
- */
- for (i = 0; i < nbatts;i += 2) {
- if (xmlStrEqual(atts[i], attname)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Attribute %s redefined\n",
- attname);
- ctxt->wellFormed = 0;
- xmlFree(attname);
- if (attvalue != NULL)
- xmlFree(attvalue);
- goto failed;
- }
- }
-
- /*
- * Add the pair to atts
- */
- if (atts == NULL) {
- maxatts = 10;
- atts = (const xmlChar **) xmlMalloc(maxatts * sizeof(xmlChar *));
- if (atts == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %ld byte failed\n",
- maxatts * (long)sizeof(xmlChar *));
- if (name != NULL) xmlFree(name);
- return;
- }
- } else if (nbatts + 4 > maxatts) {
- maxatts *= 2;
- atts = (const xmlChar **) xmlRealloc((void *)atts, maxatts * sizeof(xmlChar *));
- if (atts == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %ld byte failed\n",
- maxatts * (long)sizeof(xmlChar *));
- if (name != NULL) xmlFree(name);
- return;
- }
- }
- atts[nbatts++] = attname;
- atts[nbatts++] = attvalue;
- atts[nbatts] = NULL;
- atts[nbatts + 1] = NULL;
- }
-
-failed:
- SKIP_BLANKS;
- if (cons == ctxt->nbChars) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "docbParseStartTag: problem parsing attributes\n");
- ctxt->wellFormed = 0;
- break;
- }
- }
-
- /*
- * Handle specific association to the META tag
- */
- if (meta)
- docbCheckMeta(ctxt, atts);
-
- /*
- * SAX: Start of Element !
- */
- docbnamePush(ctxt, xmlStrdup(name));
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"Start of element %s: pushed %s\n", name, ctxt->name);
-#endif
- if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL))
- ctxt->sax->startElement(ctxt->userData, name, atts);
-
- if (atts != NULL) {
- for (i = 0;i < nbatts;i++) {
- if (atts[i] != NULL)
- xmlFree((xmlChar *) atts[i]);
- }
- xmlFree((void *) atts);
- }
- if (name != NULL) xmlFree(name);
-}
-
-/**
- * docbParseEndTag:
- * @ctxt: an SGML parser context
- *
- * parse an end of tag
- *
- * [42] ETag ::= '</' Name S? '>'
- *
- * With namespace
- *
- * [NS 9] ETag ::= '</' QName S? '>'
- */
-
-static void
-docbParseEndTag(docbParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlChar *oldname;
- int i;
-
- if ((CUR != '<') || (NXT(1) != '/')) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "docbParseEndTag: '</' not found\n");
- ctxt->wellFormed = 0;
- return;
- }
- SKIP(2);
-
- name = docbParseSGMLName(ctxt);
- if (name == NULL) {
- if (CUR == '>') {
- NEXT;
- oldname = docbnamePop(ctxt);
- if (oldname != NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, name);
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of tag </>: popping out %s\n", oldname);
-#endif
- xmlFree(oldname);
-#ifdef DEBUG
- } else {
- xmlGenericError(xmlGenericErrorContext,"End of tag </>: stack empty !!!\n");
-#endif
- }
- return;
- } else
- return;
- }
-
- /*
- * We should definitely be at the ending "S? '>'" part
- */
- SKIP_BLANKS;
- if ((!IS_CHAR(CUR)) || (CUR != '>')) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "End tag : expected '>'\n");
- ctxt->wellFormed = 0;
- } else
- NEXT;
-
- /*
- * If the name read is not one of the element in the parsing stack
- * then return, it's just an error.
- */
- for (i = (ctxt->nameNr - 1);i >= 0;i--) {
- if (xmlStrEqual(name, ctxt->nameTab[i])) break;
- }
- if (i < 0) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Unexpected end tag : %s\n", name);
- xmlFree(name);
- ctxt->wellFormed = 0;
- return;
- }
-
-
- /*
- * Check for auto-closure of SGML elements.
- */
-
- docbAutoCloseOnClose(ctxt, name);
-
- /*
- * Well formedness constraints, opening and closing must match.
- * With the exception that the autoclose may have popped stuff out
- * of the stack.
- */
- if (((name[0] != '/') || (name[1] != 0)) &&
- (!xmlStrEqual(name, ctxt->name))) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of tag %s: expecting %s\n", name, ctxt->name);
-#endif
- if ((ctxt->name != NULL) &&
- (!xmlStrEqual(ctxt->name, name))) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Opening and ending tag mismatch: %s and %s\n",
- name, ctxt->name);
- ctxt->wellFormed = 0;
- }
- }
-
- /*
- * SAX: End of Tag
- */
- oldname = ctxt->name;
- if (((name[0] == '/') && (name[1] == 0)) ||
- ((oldname != NULL) && (xmlStrEqual(oldname, name)))) {
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, name);
- oldname = docbnamePop(ctxt);
- if (oldname != NULL) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of tag %s: popping out %s\n", name, oldname);
-#endif
- xmlFree(oldname);
-#ifdef DEBUG
- } else {
- xmlGenericError(xmlGenericErrorContext,"End of tag %s: stack empty !!!\n", name);
-#endif
- }
- }
-
- if (name != NULL)
- xmlFree(name);
-
- return;
-}
-
-
-/**
- * docbParseReference:
- * @ctxt: an SGML parser context
- *
- * parse and handle entity references in content,
- * this will end-up in a call to character() since this is either a
- * CharRef, or a predefined entity.
- */
-static void
-docbParseReference(docbParserCtxtPtr ctxt) {
- docbEntityDescPtr ent;
- xmlEntityPtr xent;
- xmlChar out[6];
- xmlChar *name;
- if (CUR != '&') return;
-
- if (NXT(1) == '#') {
- unsigned int c;
- int bits, i = 0;
-
- c = docbParseCharRef(ctxt);
- if (c < 0x80) { out[i++]= c; bits= -6; }
- else if (c < 0x800) { out[i++]=((c >> 6) & 0x1F) | 0xC0; bits= 0; }
- else if (c < 0x10000) { out[i++]=((c >> 12) & 0x0F) | 0xE0; bits= 6; }
- else { out[i++]=((c >> 18) & 0x07) | 0xF0; bits= 12; }
-
- for ( ; bits >= 0; bits-= 6) {
- out[i++]= ((c >> bits) & 0x3F) | 0x80;
- }
- out[i] = 0;
-
- if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
- ctxt->sax->characters(ctxt->userData, out, i);
- } else {
- /*
- * Lookup the entity in the table.
- */
- xent = docbParseEntityRef(ctxt, &name);
- if (xent != NULL) {
- if (((ctxt->replaceEntities) || (ctxt->loadsubset)) &&
- ((xent->children == NULL) &&
- (xent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY))) {
- /*
- * we really need to fetch and parse the external entity
- */
- int parse;
- xmlNodePtr children = NULL;
-
- parse = docbParseCtxtExternalEntity(ctxt,
- xent->SystemID, xent->ExternalID, &children);
- xmlAddChildList((xmlNodePtr) xent, children);
- }
- if (ctxt->replaceEntities) {
- if ((ctxt->node != NULL) && (xent->children != NULL)) {
- /*
- * Seems we are generating the DOM content, do
- * a simple tree copy
- */
- xmlNodePtr new;
- new = xmlCopyNodeList(xent->children);
-
- xmlAddChildList(ctxt->node, new);
- /*
- * This is to avoid a nasty side effect, see
- * characters() in SAX.c
- */
- ctxt->nodemem = 0;
- ctxt->nodelen = 0;
- }
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) &&
- (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) {
- /*
- * Create a node.
- */
- ctxt->sax->reference(ctxt->userData, xent->name);
- }
- }
- } else if (name != NULL) {
- ent = docbEntityLookup(name);
- if ((ent == NULL) || (ent->value <= 0)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) {
- ctxt->sax->characters(ctxt->userData, BAD_CAST "&", 1);
- ctxt->sax->characters(ctxt->userData, name, xmlStrlen(name));
- /* ctxt->sax->characters(ctxt->userData, BAD_CAST ";", 1); */
- }
- } else {
- unsigned int c;
- int bits, i = 0;
-
- c = ent->value;
- if (c < 0x80)
- { out[i++]= c; bits= -6; }
- else if (c < 0x800)
- { out[i++]=((c >> 6) & 0x1F) | 0xC0; bits= 0; }
- else if (c < 0x10000)
- { out[i++]=((c >> 12) & 0x0F) | 0xE0; bits= 6; }
- else
- { out[i++]=((c >> 18) & 0x07) | 0xF0; bits= 12; }
-
- for ( ; bits >= 0; bits-= 6) {
- out[i++]= ((c >> bits) & 0x3F) | 0x80;
- }
- out[i] = 0;
-
- if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
- ctxt->sax->characters(ctxt->userData, out, i);
- }
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
- ctxt->sax->characters(ctxt->userData, BAD_CAST "&", 1);
- return;
- }
- if (name != NULL)
- xmlFree(name);
- }
-}
-
-/**
- * docbParseContent:
- * @ctxt: an SGML parser context
- * @name: the node name
- *
- * Parse a content: comment, sub-element, reference or text.
- *
- */
-static void
-docbParseContent(docbParserCtxtPtr ctxt)
-{
- xmlChar *currentNode;
- int depth;
-
- currentNode = xmlStrdup(ctxt->name);
- depth = ctxt->nameNr;
- while (1) {
- long cons = ctxt->nbChars;
-
- GROW;
- /*
- * Our tag or one of it's parent or children is ending.
- */
- if ((CUR == '<') && (NXT(1) == '/')) {
- docbParseEndTag(ctxt);
- if (currentNode != NULL)
- xmlFree(currentNode);
- return;
- }
-
- /*
- * Has this node been popped out during parsing of
- * the next element
- */
- if ((!xmlStrEqual(currentNode, ctxt->name)) &&
- (depth >= ctxt->nameNr)) {
- if (currentNode != NULL)
- xmlFree(currentNode);
- return;
- }
-
- /*
- * Sometimes DOCTYPE arrives in the middle of the document
- */
- if ((CUR == '<') && (NXT(1) == '!') &&
- (UPP(2) == 'D') && (UPP(3) == 'O') &&
- (UPP(4) == 'C') && (UPP(5) == 'T') &&
- (UPP(6) == 'Y') && (UPP(7) == 'P') && (UPP(8) == 'E')) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Misplaced DOCTYPE declaration\n");
- ctxt->wellFormed = 0;
- docbParseDocTypeDecl(ctxt);
- }
-
- /*
- * First case : a comment
- */
- if ((CUR == '<') && (NXT(1) == '!') &&
- (NXT(2) == '-') && (NXT(3) == '-')) {
- docbParseComment(ctxt);
- }
-
- /*
- * Second case : a PI
- */
- else if ((RAW == '<') && (NXT(1) == '?')) {
- docbParsePI(ctxt);
- }
-
- /*
- * Third case : a sub-element.
- */
- else if (CUR == '<') {
- docbParseElement(ctxt);
- }
-
- /*
- * Fourth case : a reference. If if has not been resolved,
- * parsing returns it's Name, create the node
- */
- else if (CUR == '&') {
- docbParseReference(ctxt);
- }
-
- /*
- * Fifth : end of the resource
- */
- else if (CUR == 0) {
- docbAutoClose(ctxt, NULL);
- if (ctxt->nameNr == 0)
- break;
- }
-
- /*
- * Last case, text. Note that References are handled directly.
- */
- else {
- docbParseCharData(ctxt);
- }
-
- if (cons == ctxt->nbChars) {
- if (ctxt->node != NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "detected an error in element content\n");
- ctxt->wellFormed = 0;
- }
- break;
- }
-
- GROW;
- }
- if (currentNode != NULL)
- xmlFree(currentNode);
-}
-
-/**
- * docbParseElement:
- * @ctxt: an SGML parser context
- *
- * parse an SGML element, this is highly recursive
- *
- * [39] element ::= EmptyElemTag | STag content ETag
- *
- * [41] Attribute ::= Name Eq AttValue
- */
-
-static void
-docbParseElement(docbParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlChar *currentNode = NULL;
- docbElemDescPtr info;
- docbParserNodeInfo node_info;
- xmlChar *oldname;
- int depth = ctxt->nameNr;
-
- /* Capture start position */
- if (ctxt->record_info) {
- node_info.begin_pos = ctxt->input->consumed +
- (CUR_PTR - ctxt->input->base);
- node_info.begin_line = ctxt->input->line;
- }
-
- oldname = xmlStrdup(ctxt->name);
- docbParseStartTag(ctxt);
- name = ctxt->name;
-#ifdef DEBUG
- if (oldname == NULL)
- xmlGenericError(xmlGenericErrorContext,
- "Start of element %s\n", name);
- else if (name == NULL)
- xmlGenericError(xmlGenericErrorContext,
- "Start of element failed, was %s\n", oldname);
- else
- xmlGenericError(xmlGenericErrorContext,
- "Start of element %s, was %s\n", name, oldname);
-#endif
- if (((depth == ctxt->nameNr) && (xmlStrEqual(oldname, ctxt->name))) ||
- (name == NULL)) {
- if (CUR == '>')
- NEXT;
- if (oldname != NULL)
- xmlFree(oldname);
- return;
- }
- if (oldname != NULL)
- xmlFree(oldname);
-
- /*
- * Lookup the info for that element.
- */
- info = docbTagLookup(name);
- if (info == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Tag %s unknown\n",
- name);
- ctxt->wellFormed = 0;
- } else if (info->depr) {
-/***************************
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData, "Tag %s is deprecated\n",
- name);
- ***************************/
- }
-
- /*
- * Check for an Empty Element labeled the XML/SGML way
- */
- if ((CUR == '/') && (NXT(1) == '>')) {
- SKIP(2);
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, name);
- oldname = docbnamePop(ctxt);
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of tag the XML way: popping out %s\n", oldname);
-#endif
- if (oldname != NULL)
- xmlFree(oldname);
- return;
- }
-
- if (CUR == '>') {
- NEXT;
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Couldn't find end of Start Tag %s\n",
- name);
- ctxt->wellFormed = 0;
-
- /*
- * end of parsing of this node.
- */
- if (xmlStrEqual(name, ctxt->name)) {
- nodePop(ctxt);
- oldname = docbnamePop(ctxt);
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of start tag problem: popping out %s\n", oldname);
-#endif
- if (oldname != NULL)
- xmlFree(oldname);
- }
-
- /*
- * Capture end position and add node
- */
- if ( currentNode != NULL && ctxt->record_info ) {
- node_info.end_pos = ctxt->input->consumed +
- (CUR_PTR - ctxt->input->base);
- node_info.end_line = ctxt->input->line;
- node_info.node = ctxt->node;
- xmlParserAddNodeInfo(ctxt, &node_info);
- }
- return;
- }
-
- /*
- * Check for an Empty Element from DTD definition
- */
- if ((info != NULL) && (info->empty)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, name);
- oldname = docbnamePop(ctxt);
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of empty tag %s : popping out %s\n", name, oldname);
-#endif
- if (oldname != NULL)
- xmlFree(oldname);
- return;
- }
-
- /*
- * Parse the content of the element:
- */
- currentNode = xmlStrdup(ctxt->name);
- depth = ctxt->nameNr;
- while (IS_CHAR(CUR)) {
- docbParseContent(ctxt);
- if (ctxt->nameNr < depth) break;
- }
-
- if (!IS_CHAR(CUR)) {
- /************
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Premature end of data in tag %s\n", currentNode);
- ctxt->wellFormed = 0;
- *************/
-
- /*
- * end of parsing of this node.
- */
- nodePop(ctxt);
- oldname = docbnamePop(ctxt);
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"Premature end of tag %s : popping out %s\n", name, oldname);
-#endif
- if (oldname != NULL)
- xmlFree(oldname);
- if (currentNode != NULL)
- xmlFree(currentNode);
- return;
- }
-
- /*
- * Capture end position and add node
- */
- if ( currentNode != NULL && ctxt->record_info ) {
- node_info.end_pos = ctxt->input->consumed +
- (CUR_PTR - ctxt->input->base);
- node_info.end_line = ctxt->input->line;
- node_info.node = ctxt->node;
- xmlParserAddNodeInfo(ctxt, &node_info);
- }
- if (currentNode != NULL)
- xmlFree(currentNode);
-}
-
-/**
- * docbParseEntityDecl:
- * @ctxt: an SGML parser context
- *
- * parse <!ENTITY declarations
- *
- */
-
-static void
-docbParseEntityDecl(xmlParserCtxtPtr ctxt) {
- xmlChar *name = NULL;
- xmlChar *value = NULL;
- xmlChar *URI = NULL, *literal = NULL;
- xmlChar *ndata = NULL;
- int isParameter = 0;
- xmlChar *orig = NULL;
-
- GROW;
- if ((RAW == '<') && (NXT(1) == '!') &&
- (UPP(2) == 'E') && (UPP(3) == 'N') &&
- (UPP(4) == 'T') && (UPP(5) == 'I') &&
- (UPP(6) == 'T') && (UPP(7) == 'Y')) {
- xmlParserInputPtr input = ctxt->input;
- ctxt->instate = XML_PARSER_ENTITY_DECL;
- SHRINK;
- SKIP(8);
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after '<!ENTITY'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
-
- if (RAW == '%') {
- NEXT;
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after '%'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
- isParameter = 1;
- }
-
- name = xmlParseName(ctxt);
- if (name == NULL) {
- ctxt->errNo = XML_ERR_NAME_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "sgmlarseEntityDecl: no name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return;
- }
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after the entity name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
-
- /*
- * handle the various case of definitions...
- */
- if (isParameter) {
- if ((RAW == '"') || (RAW == '\'')) {
- value = xmlParseEntityValue(ctxt, &orig);
- if (value) {
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL))
- ctxt->sax->entityDecl(ctxt->userData, name,
- XML_INTERNAL_PARAMETER_ENTITY,
- NULL, NULL, value);
- }
- } else {
- URI = xmlParseExternalID(ctxt, &literal, 1);
- if ((URI == NULL) && (literal == NULL)) {
- ctxt->errNo = XML_ERR_VALUE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Entity value required\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if (URI) {
- xmlURIPtr uri;
-
- uri = xmlParseURI((const char *) URI);
- if (uri == NULL) {
- ctxt->errNo = XML_ERR_INVALID_URI;
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Invalid URI: %s\n", URI);
- ctxt->wellFormed = 0;
- } else {
- if (uri->fragment != NULL) {
- ctxt->errNo = XML_ERR_URI_FRAGMENT;
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Fragment not allowed: %s\n", URI);
- ctxt->wellFormed = 0;
- } else {
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) &&
- (ctxt->sax->entityDecl != NULL))
- ctxt->sax->entityDecl(ctxt->userData, name,
- XML_EXTERNAL_PARAMETER_ENTITY,
- literal, URI, NULL);
- }
- xmlFreeURI(uri);
- }
- }
- }
- } else {
- if ((RAW == '"') || (RAW == '\'')) {
- value = xmlParseEntityValue(ctxt, &orig);
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL))
- ctxt->sax->entityDecl(ctxt->userData, name,
- XML_INTERNAL_GENERAL_ENTITY,
- NULL, NULL, value);
- } else {
- URI = xmlParseExternalID(ctxt, &literal, 1);
- if ((URI == NULL) && (literal == NULL)) {
- ctxt->errNo = XML_ERR_VALUE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Entity value required\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if (URI) {
- xmlURIPtr uri;
-
- uri = xmlParseURI((const char *)URI);
- if (uri == NULL) {
- ctxt->errNo = XML_ERR_INVALID_URI;
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Invalid URI: %s\n", URI);
- ctxt->wellFormed = 0;
- } else {
- if (uri->fragment != NULL) {
- ctxt->errNo = XML_ERR_URI_FRAGMENT;
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Fragment not allowed: %s\n", URI);
- ctxt->wellFormed = 0;
- }
- xmlFreeURI(uri);
- }
- }
- if ((RAW != '>') && (!IS_BLANK(CUR))) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required before content model\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
-
- /*
- * SGML specific: here we can get the content model
- */
- if (RAW != '>') {
- xmlChar *contmod;
-
- contmod = xmlParseName(ctxt);
-
- if (contmod == NULL) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Could not parse entity content model\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- if (xmlStrEqual(contmod, BAD_CAST"NDATA")) {
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after 'NDATA'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
- ndata = xmlParseName(ctxt);
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
- (ctxt->sax->unparsedEntityDecl != NULL)) {
- ctxt->sax->unparsedEntityDecl(ctxt->userData,
- name, literal, URI, ndata);
- }
- } else if (xmlStrEqual(contmod, BAD_CAST"SUBDOC")) {
- if ((ctxt->sax != NULL) &&
- (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData,
- "SUBDOC entities are not supported\n");
- SKIP_BLANKS;
- ndata = xmlParseName(ctxt);
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
- (ctxt->sax->unparsedEntityDecl != NULL)) {
- ctxt->sax->unparsedEntityDecl(ctxt->userData,
- name, literal, URI, ndata);
- }
- } else if (xmlStrEqual(contmod, BAD_CAST"CDATA")) {
- if ((ctxt->sax != NULL) &&
- (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData,
- "CDATA entities are not supported\n");
- SKIP_BLANKS;
- ndata = xmlParseName(ctxt);
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
- (ctxt->sax->unparsedEntityDecl != NULL)) {
- ctxt->sax->unparsedEntityDecl(ctxt->userData,
- name, literal, URI, ndata);
- }
- }
- xmlFree(contmod);
- }
- } else {
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL))
- ctxt->sax->entityDecl(ctxt->userData, name,
- XML_EXTERNAL_GENERAL_PARSED_ENTITY,
- literal, URI, NULL);
- }
- }
- }
- SKIP_BLANKS;
- if (RAW != '>') {
- ctxt->errNo = XML_ERR_ENTITY_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "docbParseEntityDecl: entity %s not terminated\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- if (input != ctxt->input) {
- ctxt->errNo = XML_ERR_ENTITY_BOUNDARY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
-"Entity declaration doesn't start and stop in the same entity\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- NEXT;
- }
- if (orig != NULL) {
- /*
- * Ugly mechanism to save the raw entity value.
- */
- xmlEntityPtr cur = NULL;
-
- if (isParameter) {
- if ((ctxt->sax != NULL) &&
- (ctxt->sax->getParameterEntity != NULL))
- cur = ctxt->sax->getParameterEntity(ctxt->userData, name);
- } else {
- if ((ctxt->sax != NULL) &&
- (ctxt->sax->getEntity != NULL))
- cur = ctxt->sax->getEntity(ctxt->userData, name);
- }
- if (cur != NULL) {
- if (cur->orig != NULL)
- xmlFree(orig);
- else
- cur->orig = orig;
- } else
- xmlFree(orig);
- }
- if (name != NULL) xmlFree(name);
- if (value != NULL) xmlFree(value);
- if (URI != NULL) xmlFree(URI);
- if (literal != NULL) xmlFree(literal);
- if (ndata != NULL) xmlFree(ndata);
- }
-}
-
-/**
- * docbParseMarkupDecl:
- * @ctxt: an SGML parser context
- *
- * parse Markup declarations
- *
- * [29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl |
- * NotationDecl | PI | Comment
- */
-static void
-docbParseMarkupDecl(xmlParserCtxtPtr ctxt) {
- GROW;
- xmlParseElementDecl(ctxt);
- xmlParseAttributeListDecl(ctxt);
- docbParseEntityDecl(ctxt);
- xmlParseNotationDecl(ctxt);
- docbParsePI(ctxt);
- xmlParseComment(ctxt);
- /*
- * This is only for internal subset. On external entities,
- * the replacement is done before parsing stage
- */
- if ((ctxt->external == 0) && (ctxt->inputNr == 1))
- xmlParsePEReference(ctxt);
- ctxt->instate = XML_PARSER_DTD;
-}
-
-/**
- * docbParseInternalSubset:
- * @ctxt: an SGML parser context
- *
- * parse the internal subset declaration
- *
- * [28 end] ('[' (markupdecl | PEReference | S)* ']' S?)? '>'
- */
-
-static void
-docbParseInternalSubset(xmlParserCtxtPtr ctxt) {
- /*
- * Is there any DTD definition ?
- */
- if (RAW == '[') {
- ctxt->instate = XML_PARSER_DTD;
- NEXT;
- /*
- * Parse the succession of Markup declarations and
- * PEReferences.
- * Subsequence (markupdecl | PEReference | S)*
- */
- while (RAW != ']') {
- const xmlChar *check = CUR_PTR;
- int cons = ctxt->input->consumed;
-
- SKIP_BLANKS;
- docbParseMarkupDecl(ctxt);
- xmlParsePEReference(ctxt);
-
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
-
- if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {
- ctxt->errNo = XML_ERR_INTERNAL_ERROR;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "docbParseInternalSubset: error detected in Markup declaration\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- break;
- }
- }
- if (RAW == ']') {
- NEXT;
- SKIP_BLANKS;
- }
- }
-
- /*
- * We should be at the end of the DOCTYPE declaration.
- */
- if (RAW != '>') {
- ctxt->errNo = XML_ERR_DOCTYPE_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "DOCTYPE improperly terminated\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- NEXT;
-}
-
-/**
- * docbParseMisc:
- * @ctxt: an XML parser context
- *
- * parse an XML Misc* optional field.
- *
- * [27] Misc ::= Comment | PI | S
- */
-
-static void
-docbParseMisc(xmlParserCtxtPtr ctxt) {
- while (((RAW == '<') && (NXT(1) == '?')) ||
- ((RAW == '<') && (NXT(1) == '!') &&
- (NXT(2) == '-') && (NXT(3) == '-')) ||
- IS_BLANK(CUR)) {
- if ((RAW == '<') && (NXT(1) == '?')) {
- docbParsePI(ctxt);
- } else if (IS_BLANK(CUR)) {
- NEXT;
- } else
- xmlParseComment(ctxt);
- }
-}
-
-/**
- * docbParseDocument:
- * @ctxt: an SGML parser context
- *
- * parse an SGML document (and build a tree if using the standard SAX
- * interface).
- *
- * Returns 0, -1 in case of error. the parser context is augmented
- * as a result of the parsing.
- */
-
-int
-docbParseDocument(docbParserCtxtPtr ctxt) {
- xmlChar start[4];
- xmlCharEncoding enc;
- xmlDtdPtr dtd;
-
- docbDefaultSAXHandlerInit();
- ctxt->html = 2;
-
- GROW;
- /*
- * SAX: beginning of the document processing.
- */
- if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
- ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator);
-
- /*
- * Get the 4 first bytes and decode the charset
- * if enc != XML_CHAR_ENCODING_NONE
- * plug some encoding conversion routines.
- */
- start[0] = RAW;
- start[1] = NXT(1);
- start[2] = NXT(2);
- start[3] = NXT(3);
- enc = xmlDetectCharEncoding(start, 4);
- if (enc != XML_CHAR_ENCODING_NONE) {
- xmlSwitchEncoding(ctxt, enc);
- }
-
- /*
- * Wipe out everything which is before the first '<'
- */
- SKIP_BLANKS;
- if (CUR == 0) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Document is empty\n");
- ctxt->wellFormed = 0;
- }
-
- if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX))
- ctxt->sax->startDocument(ctxt->userData);
-
-
- /*
- * The Misc part of the Prolog
- */
- GROW;
- docbParseMisc(ctxt);
-
- /*
- * Then possibly doc type declaration(s) and more Misc
- * (doctypedecl Misc*)?
- */
- GROW;
- if ((RAW == '<') && (NXT(1) == '!') &&
- (UPP(2) == 'D') && (UPP(3) == 'O') &&
- (UPP(4) == 'C') && (UPP(5) == 'T') &&
- (UPP(6) == 'Y') && (UPP(7) == 'P') &&
- (UPP(8) == 'E')) {
-
- ctxt->inSubset = 1;
- docbParseDocTypeDecl(ctxt);
- if (RAW == '[') {
- ctxt->instate = XML_PARSER_DTD;
- docbParseInternalSubset(ctxt);
- }
-
- /*
- * Create and update the external subset.
- */
- ctxt->inSubset = 2;
- if ((ctxt->sax != NULL) && (ctxt->sax->internalSubset != NULL) &&
- (!ctxt->disableSAX))
- ctxt->sax->internalSubset(ctxt->userData, ctxt->intSubName,
- ctxt->extSubSystem, ctxt->extSubURI);
- ctxt->inSubset = 0;
-
-
- ctxt->instate = XML_PARSER_PROLOG;
- docbParseMisc(ctxt);
- }
-
- /*
- * Time to start parsing the tree itself
- */
- docbParseContent(ctxt);
-
- /*
- * autoclose
- */
- if (CUR == 0)
- docbAutoClose(ctxt, NULL);
-
-
- /*
- * SAX: end of the document processing.
- */
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
-
- if (ctxt->myDoc != NULL) {
- dtd = ctxt->myDoc->intSubset;
- ctxt->myDoc->standalone = -1;
- if (dtd == NULL)
- ctxt->myDoc->intSubset =
- xmlCreateIntSubset(ctxt->myDoc, BAD_CAST "SGML",
- BAD_CAST "-//W3C//DTD SGML 4.0 Transitional//EN",
- BAD_CAST "http://www.w3.org/TR/REC-docbook/loose.dtd");
- }
- if (! ctxt->wellFormed) return(-1);
- return(0);
-}
-
-
-/************************************************************************
- * *
- * Parser contexts handling *
- * *
- ************************************************************************/
-
-/**
- * docbInitParserCtxt:
- * @ctxt: an SGML parser context
- *
- * Initialize a parser context
- */
-
-static void
-docbInitParserCtxt(docbParserCtxtPtr ctxt)
-{
- docbSAXHandler *sax;
-
- if (ctxt == NULL) return;
- memset(ctxt, 0, sizeof(docbParserCtxt));
-
- sax = (docbSAXHandler *) xmlMalloc(sizeof(docbSAXHandler));
- if (sax == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "docbInitParserCtxt: out of memory\n");
- }
- memset(sax, 0, sizeof(docbSAXHandler));
-
- /* Allocate the Input stack */
- ctxt->inputTab = (docbParserInputPtr *)
- xmlMalloc(5 * sizeof(docbParserInputPtr));
- if (ctxt->inputTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "docbInitParserCtxt: out of memory\n");
- }
- ctxt->inputNr = 0;
- ctxt->inputMax = 5;
- ctxt->input = NULL;
- ctxt->version = NULL;
- ctxt->encoding = NULL;
- ctxt->standalone = -1;
- ctxt->instate = XML_PARSER_START;
-
- /* Allocate the Node stack */
- ctxt->nodeTab = (docbNodePtr *) xmlMalloc(10 * sizeof(docbNodePtr));
- ctxt->nodeNr = 0;
- ctxt->nodeMax = 10;
- ctxt->node = NULL;
-
- /* Allocate the Name stack */
- ctxt->nameTab = (xmlChar **) xmlMalloc(10 * sizeof(xmlChar *));
- ctxt->nameNr = 0;
- ctxt->nameMax = 10;
- ctxt->name = NULL;
-
- if (sax == NULL) ctxt->sax = &docbDefaultSAXHandler;
- else {
- ctxt->sax = sax;
- memcpy(sax, &docbDefaultSAXHandler, sizeof(docbSAXHandler));
- }
- ctxt->userData = ctxt;
- ctxt->myDoc = NULL;
- ctxt->wellFormed = 1;
- ctxt->linenumbers = xmlLineNumbersDefaultValue;
- ctxt->replaceEntities = xmlSubstituteEntitiesDefaultValue;
- ctxt->html = 2;
- ctxt->record_info = 0;
- ctxt->validate = 0;
- ctxt->nbChars = 0;
- ctxt->checkIndex = 0;
- xmlInitNodeInfoSeq(&ctxt->node_seq);
-}
-
-/**
- * docbFreeParserCtxt:
- * @ctxt: an SGML parser context
- *
- * Free all the memory used by a parser context. However the parsed
- * document in ctxt->myDoc is not freed.
- */
-
-void
-docbFreeParserCtxt(docbParserCtxtPtr ctxt)
-{
- xmlFreeParserCtxt(ctxt);
-}
-
-/**
- * docbCreateDocParserCtxt:
- * @cur: a pointer to an array of xmlChar
- * @encoding: the SGML document encoding, or NULL
- *
- * Create a parser context for an SGML document.
- *
- * Returns the new parser context or NULL
- */
-static docbParserCtxtPtr
-docbCreateDocParserCtxt(xmlChar *cur, const char *encoding ATTRIBUTE_UNUSED) {
- docbParserCtxtPtr ctxt;
- docbParserInputPtr input;
- /* sgmlCharEncoding enc; */
-
- ctxt = (docbParserCtxtPtr) xmlMalloc(sizeof(docbParserCtxt));
- if (ctxt == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc failed");
- return(NULL);
- }
- docbInitParserCtxt(ctxt);
- input = (docbParserInputPtr) xmlMalloc(sizeof(docbParserInput));
- if (input == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc failed");
- xmlFree(ctxt);
- return(NULL);
- }
- memset(input, 0, sizeof(docbParserInput));
-
- input->line = 1;
- input->col = 1;
- input->base = cur;
- input->cur = cur;
-
- inputPush(ctxt, input);
- return(ctxt);
-}
-
-/************************************************************************
- * *
- * Progressive parsing interfaces *
- * *
- ************************************************************************/
-
-/**
- * docbParseLookupSequence:
- * @ctxt: an SGML parser context
- * @first: the first char to lookup
- * @next: the next char to lookup or zero
- * @third: the next char to lookup or zero
- *
- * Try to find if a sequence (first, next, third) or just (first next) or
- * (first) is available in the input stream.
- * This function has a side effect of (possibly) incrementing ctxt->checkIndex
- * to avoid rescanning sequences of bytes, it DOES change the state of the
- * parser, do not use liberally.
- * This is basically similar to xmlParseLookupSequence()
- *
- * Returns the index to the current parsing point if the full sequence
- * is available, -1 otherwise.
- */
-static int
-docbParseLookupSequence(docbParserCtxtPtr ctxt, xmlChar first,
- xmlChar next, xmlChar third) {
- int base, len;
- docbParserInputPtr in;
- const xmlChar *buf;
-
- in = ctxt->input;
- if (in == NULL) return(-1);
- base = in->cur - in->base;
- if (base < 0) return(-1);
- if (ctxt->checkIndex > base)
- base = ctxt->checkIndex;
- if (in->buf == NULL) {
- buf = in->base;
- len = in->length;
- } else {
- buf = in->buf->buffer->content;
- len = in->buf->buffer->use;
- }
- /* take into account the sequence length */
- if (third) len -= 2;
- else if (next) len --;
- for (;base < len;base++) {
- if (buf[base] == first) {
- if (third != 0) {
- if ((buf[base + 1] != next) ||
- (buf[base + 2] != third)) continue;
- } else if (next != 0) {
- if (buf[base + 1] != next) continue;
- }
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- if (next == 0)
- xmlGenericError(xmlGenericErrorContext,
- "HPP: lookup '%c' found at %d\n",
- first, base);
- else if (third == 0)
- xmlGenericError(xmlGenericErrorContext,
- "HPP: lookup '%c%c' found at %d\n",
- first, next, base);
- else
- xmlGenericError(xmlGenericErrorContext,
- "HPP: lookup '%c%c%c' found at %d\n",
- first, next, third, base);
-#endif
- return(base - (in->cur - in->base));
- }
- }
- ctxt->checkIndex = base;
-#ifdef DEBUG_PUSH
- if (next == 0)
- xmlGenericError(xmlGenericErrorContext,
- "HPP: lookup '%c' failed\n", first);
- else if (third == 0)
- xmlGenericError(xmlGenericErrorContext,
- "HPP: lookup '%c%c' failed\n", first, next);
- else
- xmlGenericError(xmlGenericErrorContext,
- "HPP: lookup '%c%c%c' failed\n", first, next, third);
-#endif
- return(-1);
-}
-
-/**
- * docbParseTryOrFinish:
- * @ctxt: an SGML parser context
- * @terminate: last chunk indicator
- *
- * Try to progress on parsing
- *
- * Returns zero if no parsing was possible
- */
-static int
-docbParseTryOrFinish(docbParserCtxtPtr ctxt, int terminate) {
- int ret = 0;
- docbParserInputPtr in;
- int avail = 0;
- xmlChar cur, next;
-
-#ifdef DEBUG_PUSH
- switch (ctxt->instate) {
- case XML_PARSER_EOF:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try EOF\n"); break;
- case XML_PARSER_START:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try START\n"); break;
- case XML_PARSER_MISC:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try MISC\n");break;
- case XML_PARSER_COMMENT:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try COMMENT\n");break;
- case XML_PARSER_PROLOG:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try PROLOG\n");break;
- case XML_PARSER_START_TAG:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try START_TAG\n");break;
- case XML_PARSER_CONTENT:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try CONTENT\n");break;
- case XML_PARSER_CDATA_SECTION:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try CDATA_SECTION\n");break;
- case XML_PARSER_END_TAG:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try END_TAG\n");break;
- case XML_PARSER_ENTITY_DECL:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try ENTITY_DECL\n");break;
- case XML_PARSER_ENTITY_VALUE:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try ENTITY_VALUE\n");break;
- case XML_PARSER_ATTRIBUTE_VALUE:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try ATTRIBUTE_VALUE\n");break;
- case XML_PARSER_DTD:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try DTD\n");break;
- case XML_PARSER_EPILOG:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try EPILOG\n");break;
- case XML_PARSER_PI:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try PI\n");break;
- }
-#endif
-
- while (1) {
-
- in = ctxt->input;
- if (in == NULL) break;
- if (in->buf == NULL)
- avail = in->length - (in->cur - in->base);
- else
- avail = in->buf->buffer->use - (in->cur - in->base);
- if ((avail == 0) && (terminate)) {
- docbAutoClose(ctxt, NULL);
- if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) {
- /*
- * SAX: end of the document processing.
- */
- ctxt->instate = XML_PARSER_EOF;
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
- }
- }
- if (avail < 1)
- goto done;
- switch (ctxt->instate) {
- case XML_PARSER_EOF:
- /*
- * Document parsing is done !
- */
- goto done;
- case XML_PARSER_START:
- /*
- * Very first chars read from the document flow.
- */
- cur = in->cur[0];
- if (IS_BLANK(cur)) {
- SKIP_BLANKS;
- if (in->buf == NULL)
- avail = in->length - (in->cur - in->base);
- else
- avail = in->buf->buffer->use - (in->cur - in->base);
- }
- if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
- ctxt->sax->setDocumentLocator(ctxt->userData,
- &xmlDefaultSAXLocator);
- if ((ctxt->sax) && (ctxt->sax->startDocument) &&
- (!ctxt->disableSAX))
- ctxt->sax->startDocument(ctxt->userData);
-
- cur = in->cur[0];
- next = in->cur[1];
- if ((cur == '<') && (next == '!') &&
- (UPP(2) == 'D') && (UPP(3) == 'O') &&
- (UPP(4) == 'C') && (UPP(5) == 'T') &&
- (UPP(6) == 'Y') && (UPP(7) == 'P') &&
- (UPP(8) == 'E')) {
- if ((!terminate) &&
- (docbParseLookupSequence(ctxt, '>', 0, 0) < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing internal subset\n");
-#endif
- docbParseDocTypeDecl(ctxt);
- ctxt->instate = XML_PARSER_PROLOG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering PROLOG\n");
-#endif
- } else {
- ctxt->instate = XML_PARSER_MISC;
- }
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering MISC\n");
-#endif
- break;
- case XML_PARSER_MISC:
- SKIP_BLANKS;
- if (in->buf == NULL)
- avail = in->length - (in->cur - in->base);
- else
- avail = in->buf->buffer->use - (in->cur - in->base);
- if (avail < 2)
- goto done;
- cur = in->cur[0];
- next = in->cur[1];
- if ((cur == '<') && (next == '!') &&
- (in->cur[2] == '-') && (in->cur[3] == '-')) {
- if ((!terminate) &&
- (docbParseLookupSequence(ctxt, '-', '-', '>') < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing Comment\n");
-#endif
- docbParseComment(ctxt);
- ctxt->instate = XML_PARSER_MISC;
- } else if ((cur == '<') && (next == '!') &&
- (UPP(2) == 'D') && (UPP(3) == 'O') &&
- (UPP(4) == 'C') && (UPP(5) == 'T') &&
- (UPP(6) == 'Y') && (UPP(7) == 'P') &&
- (UPP(8) == 'E')) {
- if ((!terminate) &&
- (docbParseLookupSequence(ctxt, '>', 0, 0) < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing internal subset\n");
-#endif
- docbParseDocTypeDecl(ctxt);
- ctxt->instate = XML_PARSER_PROLOG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering PROLOG\n");
-#endif
- } else if ((cur == '<') && (next == '!') &&
- (avail < 9)) {
- goto done;
- } else {
- ctxt->instate = XML_PARSER_START_TAG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering START_TAG\n");
-#endif
- }
- break;
- case XML_PARSER_PROLOG:
- SKIP_BLANKS;
- if (in->buf == NULL)
- avail = in->length - (in->cur - in->base);
- else
- avail = in->buf->buffer->use - (in->cur - in->base);
- if (avail < 2)
- goto done;
- cur = in->cur[0];
- next = in->cur[1];
- if ((cur == '<') && (next == '!') &&
- (in->cur[2] == '-') && (in->cur[3] == '-')) {
- if ((!terminate) &&
- (docbParseLookupSequence(ctxt, '-', '-', '>') < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing Comment\n");
-#endif
- docbParseComment(ctxt);
- ctxt->instate = XML_PARSER_PROLOG;
- } else if ((cur == '<') && (next == '!') &&
- (avail < 4)) {
- goto done;
- } else {
- ctxt->instate = XML_PARSER_START_TAG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering START_TAG\n");
-#endif
- }
- break;
- case XML_PARSER_EPILOG:
- if (in->buf == NULL)
- avail = in->length - (in->cur - in->base);
- else
- avail = in->buf->buffer->use - (in->cur - in->base);
- if (avail < 1)
- goto done;
- cur = in->cur[0];
- if (IS_BLANK(cur)) {
- docbParseCharData(ctxt);
- goto done;
- }
- if (avail < 2)
- goto done;
- next = in->cur[1];
- if ((cur == '<') && (next == '!') &&
- (in->cur[2] == '-') && (in->cur[3] == '-')) {
- if ((!terminate) &&
- (docbParseLookupSequence(ctxt, '-', '-', '>') < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing Comment\n");
-#endif
- docbParseComment(ctxt);
- ctxt->instate = XML_PARSER_EPILOG;
- } else if ((cur == '<') && (next == '!') &&
- (avail < 4)) {
- goto done;
- } else {
- ctxt->errNo = XML_ERR_DOCUMENT_END;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Extra content at the end of the document\n");
- ctxt->wellFormed = 0;
- ctxt->instate = XML_PARSER_EOF;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering EOF\n");
-#endif
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
- goto done;
- }
- break;
- case XML_PARSER_START_TAG: {
- xmlChar *name, *oldname;
- int depth = ctxt->nameNr;
- docbElemDescPtr info;
-
- if (avail < 2)
- goto done;
- cur = in->cur[0];
- if (cur != '<') {
- ctxt->instate = XML_PARSER_CONTENT;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- }
- if ((!terminate) &&
- (docbParseLookupSequence(ctxt, '>', 0, 0) < 0))
- goto done;
-
- oldname = xmlStrdup(ctxt->name);
- docbParseStartTag(ctxt);
- name = ctxt->name;
-#ifdef DEBUG
- if (oldname == NULL)
- xmlGenericError(xmlGenericErrorContext,
- "Start of element %s\n", name);
- else if (name == NULL)
- xmlGenericError(xmlGenericErrorContext,
- "Start of element failed, was %s\n",
- oldname);
- else
- xmlGenericError(xmlGenericErrorContext,
- "Start of element %s, was %s\n",
- name, oldname);
-#endif
- if (((depth == ctxt->nameNr) &&
- (xmlStrEqual(oldname, ctxt->name))) ||
- (name == NULL)) {
- if (CUR == '>')
- NEXT;
- if (oldname != NULL)
- xmlFree(oldname);
- break;
- }
- if (oldname != NULL)
- xmlFree(oldname);
-
- /*
- * Lookup the info for that element.
- */
- info = docbTagLookup(name);
- if (info == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Tag %s unknown\n",
- name);
- ctxt->wellFormed = 0;
- } else if (info->depr) {
- /***************************
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData,
- "Tag %s is deprecated\n",
- name);
- ***************************/
- }
-
- /*
- * Check for an Empty Element labeled the XML/SGML way
- */
- if ((CUR == '/') && (NXT(1) == '>')) {
- SKIP(2);
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, name);
- oldname = docbnamePop(ctxt);
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of tag the XML way: popping out %s\n",
- oldname);
-#endif
- if (oldname != NULL)
- xmlFree(oldname);
- ctxt->instate = XML_PARSER_CONTENT;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- }
-
- if (CUR == '>') {
- NEXT;
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Couldn't find end of Start Tag %s\n",
- name);
- ctxt->wellFormed = 0;
-
- /*
- * end of parsing of this node.
- */
- if (xmlStrEqual(name, ctxt->name)) {
- nodePop(ctxt);
- oldname = docbnamePop(ctxt);
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,
- "End of start tag problem: popping out %s\n", oldname);
-#endif
- if (oldname != NULL)
- xmlFree(oldname);
- }
-
- ctxt->instate = XML_PARSER_CONTENT;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- }
-
- /*
- * Check for an Empty Element from DTD definition
- */
- if ((info != NULL) && (info->empty)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, name);
- oldname = docbnamePop(ctxt);
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of empty tag %s : popping out %s\n", name, oldname);
-#endif
- if (oldname != NULL)
- xmlFree(oldname);
- }
- ctxt->instate = XML_PARSER_CONTENT;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- }
- case XML_PARSER_CONTENT: {
- long cons;
- /*
- * Handle preparsed entities and charRef
- */
- if (ctxt->token != 0) {
- xmlChar chr[2] = { 0 , 0 } ;
-
- chr[0] = (xmlChar) ctxt->token;
- if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
- ctxt->sax->characters(ctxt->userData, chr, 1);
- ctxt->token = 0;
- ctxt->checkIndex = 0;
- }
- if ((avail == 1) && (terminate)) {
- cur = in->cur[0];
- if ((cur != '<') && (cur != '&')) {
- if (ctxt->sax != NULL) {
- if (IS_BLANK(cur)) {
- if (ctxt->sax->ignorableWhitespace != NULL)
- ctxt->sax->ignorableWhitespace(
- ctxt->userData, &cur, 1);
- } else {
- if (ctxt->sax->characters != NULL)
- ctxt->sax->characters(
- ctxt->userData, &cur, 1);
- }
- }
- ctxt->token = 0;
- ctxt->checkIndex = 0;
- NEXT;
- }
- break;
- }
- if (avail < 2)
- goto done;
- cur = in->cur[0];
- next = in->cur[1];
- cons = ctxt->nbChars;
- /*
- * Sometimes DOCTYPE arrives in the middle of the document
- */
- if ((cur == '<') && (next == '!') &&
- (UPP(2) == 'D') && (UPP(3) == 'O') &&
- (UPP(4) == 'C') && (UPP(5) == 'T') &&
- (UPP(6) == 'Y') && (UPP(7) == 'P') &&
- (UPP(8) == 'E')) {
- if ((!terminate) &&
- (docbParseLookupSequence(ctxt, '>', 0, 0) < 0))
- goto done;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Misplaced DOCTYPE declaration\n");
- ctxt->wellFormed = 0;
- docbParseDocTypeDecl(ctxt);
- } else if ((cur == '<') && (next == '!') &&
- (in->cur[2] == '-') && (in->cur[3] == '-')) {
- if ((!terminate) &&
- (docbParseLookupSequence(ctxt, '-', '-', '>') < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing Comment\n");
-#endif
- docbParseComment(ctxt);
- ctxt->instate = XML_PARSER_CONTENT;
- } else if ((cur == '<') && (next == '!') && (avail < 4)) {
- goto done;
- } else if ((cur == '<') && (next == '/')) {
- ctxt->instate = XML_PARSER_END_TAG;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering END_TAG\n");
-#endif
- break;
- } else if (cur == '<') {
- ctxt->instate = XML_PARSER_START_TAG;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering START_TAG\n");
-#endif
- break;
- } else if (cur == '&') {
- if ((!terminate) &&
- (docbParseLookupSequence(ctxt, ';', 0, 0) < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing Reference\n");
-#endif
- /* TODO: check generation of subtrees if noent !!! */
- docbParseReference(ctxt);
- } else {
- /* TODO Avoid the extra copy, handle directly !!!!!! */
- /*
- * Goal of the following test is:
- * - minimize calls to the SAX 'character' callback
- * when they are mergeable
- */
- if ((ctxt->inputNr == 1) &&
- (avail < DOCB_PARSER_BIG_BUFFER_SIZE)) {
- if ((!terminate) &&
- (docbParseLookupSequence(ctxt, '<', 0, 0) < 0))
- goto done;
- }
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing char data\n");
-#endif
- docbParseCharData(ctxt);
- }
- if (cons == ctxt->nbChars) {
- if (ctxt->node != NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "detected an error in element content\n");
- ctxt->wellFormed = 0;
- NEXT;
- }
- break;
- }
-
- break;
- }
- case XML_PARSER_END_TAG:
- if (avail < 2)
- goto done;
- if ((!terminate) &&
- (docbParseLookupSequence(ctxt, '>', 0, 0) < 0))
- goto done;
- docbParseEndTag(ctxt);
- if (ctxt->nameNr == 0) {
- ctxt->instate = XML_PARSER_EPILOG;
- } else {
- ctxt->instate = XML_PARSER_CONTENT;
- }
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_CDATA_SECTION:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == CDATA\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_DTD:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == DTD\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_COMMENT:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == COMMENT\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_PI:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == PI\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_ENTITY_DECL:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == ENTITY_DECL\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_ENTITY_VALUE:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == ENTITY_VALUE\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering DTD\n");
-#endif
- break;
- case XML_PARSER_ATTRIBUTE_VALUE:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == ATTRIBUTE_VALUE\n");
- ctxt->instate = XML_PARSER_START_TAG;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering START_TAG\n");
-#endif
- break;
- case XML_PARSER_SYSTEM_LITERAL:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == XML_PARSER_SYSTEM_LITERAL\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
-
- case XML_PARSER_IGNORE:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == XML_PARSER_IGNORE\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_PUBLIC_LITERAL:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == XML_PARSER_LITERAL\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- }
- }
-done:
- if ((avail == 0) && (terminate)) {
- docbAutoClose(ctxt, NULL);
- if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) {
- /*
- * SAX: end of the document processing.
- */
- ctxt->instate = XML_PARSER_EOF;
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
- }
- }
- if ((ctxt->myDoc != NULL) &&
- ((terminate) || (ctxt->instate == XML_PARSER_EOF) ||
- (ctxt->instate == XML_PARSER_EPILOG))) {
- xmlDtdPtr dtd;
- dtd = ctxt->myDoc->intSubset;
- if (dtd == NULL)
- ctxt->myDoc->intSubset =
- xmlCreateIntSubset(ctxt->myDoc, BAD_CAST "SGML",
- BAD_CAST "-//W3C//DTD SGML 4.0 Transitional//EN",
- BAD_CAST "http://www.w3.org/TR/REC-docbook/loose.dtd");
- }
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext, "HPP: done %d\n", ret);
-#endif
- return(ret);
-}
-
-/**
- * docbParseChunk:
- * @ctxt: an XML parser context
- * @chunk: an char array
- * @size: the size in byte of the chunk
- * @terminate: last chunk indicator
- *
- * Parse a Chunk of memory
- *
- * Returns zero if no error, the xmlParserErrors otherwise.
- */
-int
-docbParseChunk(docbParserCtxtPtr ctxt, const char *chunk, int size,
- int terminate) {
- if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) &&
- (ctxt->input->buf != NULL) && (ctxt->instate != XML_PARSER_EOF)) {
- int base = ctxt->input->base - ctxt->input->buf->buffer->content;
- int cur = ctxt->input->cur - ctxt->input->base;
-
- xmlParserInputBufferPush(ctxt->input->buf, size, chunk);
- ctxt->input->base = ctxt->input->buf->buffer->content + base;
- ctxt->input->cur = ctxt->input->base + cur;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size);
-#endif
-
- if ((terminate) || (ctxt->input->buf->buffer->use > 80))
- docbParseTryOrFinish(ctxt, terminate);
- } else if (ctxt->instate != XML_PARSER_EOF) {
- xmlParserInputBufferPush(ctxt->input->buf, 0, "");
- docbParseTryOrFinish(ctxt, terminate);
- }
- if (terminate) {
- if ((ctxt->instate != XML_PARSER_EOF) &&
- (ctxt->instate != XML_PARSER_EPILOG) &&
- (ctxt->instate != XML_PARSER_MISC)) {
- ctxt->errNo = XML_ERR_DOCUMENT_END;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Extra content at the end of the document\n");
- ctxt->wellFormed = 0;
- }
- if (ctxt->instate != XML_PARSER_EOF) {
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
- }
- ctxt->instate = XML_PARSER_EOF;
- }
- return((xmlParserErrors) ctxt->errNo);
-}
-
-/************************************************************************
- * *
- * User entry points *
- * *
- ************************************************************************/
-
-/**
- * docbCreatePushParserCtxt:
- * @sax: a SAX handler
- * @user_data: The user data returned on SAX callbacks
- * @chunk: a pointer to an array of chars
- * @size: number of chars in the array
- * @filename: an optional file name or URI
- * @enc: an optional encoding
- *
- * Create a parser context for using the DocBook SGML parser in push mode
- * To allow content encoding detection, @size should be >= 4
- * The value of @filename is used for fetching external entities
- * and error/warning reports.
- *
- * Returns the new parser context or NULL
- */
-docbParserCtxtPtr
-docbCreatePushParserCtxt(docbSAXHandlerPtr sax, void *user_data,
- const char *chunk, int size, const char *filename,
- xmlCharEncoding enc) {
- docbParserCtxtPtr ctxt;
- docbParserInputPtr inputStream;
- xmlParserInputBufferPtr buf;
-
- buf = xmlAllocParserInputBuffer(enc);
- if (buf == NULL) return(NULL);
-
- ctxt = (docbParserCtxtPtr) xmlMalloc(sizeof(docbParserCtxt));
- if (ctxt == NULL) {
- xmlFree(buf);
- return(NULL);
- }
- memset(ctxt, 0, sizeof(docbParserCtxt));
- docbInitParserCtxt(ctxt);
- if (sax != NULL) {
- if (ctxt->sax != &docbDefaultSAXHandler)
- xmlFree(ctxt->sax);
- ctxt->sax = (docbSAXHandlerPtr) xmlMalloc(sizeof(docbSAXHandler));
- if (ctxt->sax == NULL) {
- xmlFree(buf);
- xmlFree(ctxt);
- return(NULL);
- }
- memcpy(ctxt->sax, sax, sizeof(docbSAXHandler));
- if (user_data != NULL)
- ctxt->userData = user_data;
- }
- if (filename == NULL) {
- ctxt->directory = NULL;
- } else {
- ctxt->directory = xmlParserGetDirectory(filename);
- }
-
- inputStream = docbNewInputStream(ctxt);
- if (inputStream == NULL) {
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
-
- if (filename == NULL)
- inputStream->filename = NULL;
- else
- inputStream->filename = xmlMemStrdup(filename);
- inputStream->buf = buf;
- inputStream->base = inputStream->buf->buffer->content;
- inputStream->cur = inputStream->buf->buffer->content;
-
- inputPush(ctxt, inputStream);
-
- if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) &&
- (ctxt->input->buf != NULL)) {
- xmlParserInputBufferPush(ctxt->input->buf, size, chunk);
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size);
-#endif
- }
-
- return(ctxt);
-}
-
-/**
- * docbSAXParseDoc:
- * @cur: a pointer to an array of xmlChar
- * @encoding: a free form C string describing the SGML document encoding, or NULL
- * @sax: the SAX handler block
- * @userData: if using SAX, this pointer will be provided on callbacks.
- *
- * parse an SGML in-memory document and build a tree.
- * It use the given SAX function block to handle the parsing callback.
- * If sax is NULL, fallback to the default DOM tree building routines.
- *
- * Returns the resulting document tree
- */
-
-docbDocPtr
-docbSAXParseDoc(xmlChar *cur, const char *encoding, docbSAXHandlerPtr sax, void *userData) {
- docbDocPtr ret;
- docbParserCtxtPtr ctxt;
-
- if (cur == NULL) return(NULL);
-
-
- ctxt = docbCreateDocParserCtxt(cur, encoding);
- if (ctxt == NULL) return(NULL);
- if (sax != NULL) {
- ctxt->sax = sax;
- ctxt->userData = userData;
- }
-
- docbParseDocument(ctxt);
- ret = ctxt->myDoc;
- if (sax != NULL) {
- ctxt->sax = NULL;
- ctxt->userData = NULL;
- }
- docbFreeParserCtxt(ctxt);
-
- return(ret);
-}
-
-/**
- * docbParseDoc:
- * @cur: a pointer to an array of xmlChar
- * @encoding: a free form C string describing the SGML document encoding, or NULL
- *
- * parse an SGML in-memory document and build a tree.
- *
- * Returns the resulting document tree
- */
-
-docbDocPtr
-docbParseDoc(xmlChar *cur, const char *encoding) {
- return(docbSAXParseDoc(cur, encoding, NULL, NULL));
-}
-
-
-/**
- * docbCreateFileParserCtxt:
- * @filename: the filename
- * @encoding: the SGML document encoding, or NULL
- *
- * Create a parser context for a file content.
- * Automatic support for ZLIB/Compress compressed document is provided
- * by default if found at compile-time.
- *
- * Returns the new parser context or NULL
- */
-docbParserCtxtPtr
-docbCreateFileParserCtxt(const char *filename,
- const char *encoding ATTRIBUTE_UNUSED)
-{
- docbParserCtxtPtr ctxt;
- docbParserInputPtr inputStream;
- xmlParserInputBufferPtr buf;
- /* sgmlCharEncoding enc; */
-
- buf = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE);
- if (buf == NULL) return(NULL);
-
- ctxt = (docbParserCtxtPtr) xmlMalloc(sizeof(docbParserCtxt));
- if (ctxt == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc failed");
- return(NULL);
- }
- memset(ctxt, 0, sizeof(docbParserCtxt));
- docbInitParserCtxt(ctxt);
- inputStream = (docbParserInputPtr) xmlMalloc(sizeof(docbParserInput));
- if (inputStream == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc failed");
- xmlFree(ctxt);
- return(NULL);
- }
- memset(inputStream, 0, sizeof(docbParserInput));
-
- inputStream->filename = (char *)
- xmlNormalizeWindowsPath((const xmlChar *)filename);
- inputStream->line = 1;
- inputStream->col = 1;
- inputStream->buf = buf;
- inputStream->directory = NULL;
-
- inputStream->base = inputStream->buf->buffer->content;
- inputStream->cur = inputStream->buf->buffer->content;
- inputStream->free = NULL;
-
- inputPush(ctxt, inputStream);
- return(ctxt);
-}
-
-/**
- * docbSAXParseFile:
- * @filename: the filename
- * @encoding: a free form C string describing the SGML document encoding, or NULL
- * @sax: the SAX handler block
- * @userData: if using SAX, this pointer will be provided on callbacks.
- *
- * parse an SGML file and build a tree. Automatic support for ZLIB/Compress
- * compressed document is provided by default if found at compile-time.
- * It use the given SAX function block to handle the parsing callback.
- * If sax is NULL, fallback to the default DOM tree building routines.
- *
- * Returns the resulting document tree
- */
-
-docbDocPtr
-docbSAXParseFile(const char *filename, const char *encoding, docbSAXHandlerPtr sax,
- void *userData) {
- docbDocPtr ret;
- docbParserCtxtPtr ctxt;
- docbSAXHandlerPtr oldsax = NULL;
-
- ctxt = docbCreateFileParserCtxt(filename, encoding);
- if (ctxt == NULL) return(NULL);
- if (sax != NULL) {
- oldsax = ctxt->sax;
- ctxt->sax = sax;
- ctxt->userData = userData;
- }
-
- docbParseDocument(ctxt);
-
- ret = ctxt->myDoc;
- if (sax != NULL) {
- ctxt->sax = oldsax;
- ctxt->userData = NULL;
- }
- docbFreeParserCtxt(ctxt);
-
- return(ret);
-}
-
-/**
- * docbParseFile:
- * @filename: the filename
- * @encoding: a free form C string describing document encoding, or NULL
- *
- * parse a Docbook SGML file and build a tree. Automatic support for
- * ZLIB/Compress compressed document is provided by default if found
- * at compile-time.
- *
- * Returns the resulting document tree
- */
-
-docbDocPtr
-docbParseFile(const char *filename, const char *encoding) {
- return(docbSAXParseFile(filename, encoding, NULL, NULL));
-}
-
-#endif /* LIBXML_DOCB_ENABLED */
diff --git a/bundle/libxml/HTMLparser.c b/bundle/libxml/HTMLparser.c
deleted file mode 100644
index 7db3e9e3a8..0000000000
--- a/bundle/libxml/HTMLparser.c
+++ /dev/null
@@ -1,5013 +0,0 @@
-/*
- * HTMLparser.c : an HTML 4.0 non-verifying parser
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-#ifdef LIBXML_HTML_ENABLED
-
-#include <string.h>
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_ZLIB_H
-#include <zlib.h>
-#endif
-
-#include <libxml/xmlmemory.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-#include <libxml/xmlerror.h>
-#include <libxml/HTMLparser.h>
-#include <libxml/HTMLtree.h>
-#include <libxml/entities.h>
-#include <libxml/encoding.h>
-#include <libxml/valid.h>
-#include <libxml/xmlIO.h>
-#include <libxml/globals.h>
-
-#define HTML_MAX_NAMELEN 1000
-#define HTML_PARSER_BIG_BUFFER_SIZE 1000
-#define HTML_PARSER_BUFFER_SIZE 100
-
-/* #define DEBUG */
-/* #define DEBUG_PUSH */
-
-static int htmlOmittedDefaultValue = 1;
-
-xmlChar * htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len,
- xmlChar end, xmlChar end2, xmlChar end3);
-static void htmlParseComment(htmlParserCtxtPtr ctxt);
-
-/************************************************************************
- * *
- * Parser stacks related functions and macros *
- * *
- ************************************************************************/
-
-/**
- * htmlnamePush:
- * @ctxt: an HTML parser context
- * @value: the element name
- *
- * Pushes a new element name on top of the name stack
- *
- * Returns 0 in case of error, the index in the stack otherwise
- */
-static int
-htmlnamePush(htmlParserCtxtPtr ctxt, xmlChar * value)
-{
- if (ctxt->nameNr >= ctxt->nameMax) {
- ctxt->nameMax *= 2;
- ctxt->nameTab =
- (xmlChar * *)xmlRealloc(ctxt->nameTab,
- ctxt->nameMax *
- sizeof(ctxt->nameTab[0]));
- if (ctxt->nameTab == NULL) {
- xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
- return (0);
- }
- }
- ctxt->nameTab[ctxt->nameNr] = value;
- ctxt->name = value;
- return (ctxt->nameNr++);
-}
-/**
- * htmlnamePop:
- * @ctxt: an HTML parser context
- *
- * Pops the top element name from the name stack
- *
- * Returns the name just removed
- */
-static xmlChar *
-htmlnamePop(htmlParserCtxtPtr ctxt)
-{
- xmlChar *ret;
-
- if (ctxt->nameNr <= 0)
- return (0);
- ctxt->nameNr--;
- if (ctxt->nameNr < 0)
- return (0);
- if (ctxt->nameNr > 0)
- ctxt->name = ctxt->nameTab[ctxt->nameNr - 1];
- else
- ctxt->name = NULL;
- ret = ctxt->nameTab[ctxt->nameNr];
- ctxt->nameTab[ctxt->nameNr] = 0;
- return (ret);
-}
-
-/*
- * Macros for accessing the content. Those should be used only by the parser,
- * and not exported.
- *
- * Dirty macros, i.e. one need to make assumption on the context to use them
- *
- * CUR_PTR return the current pointer to the xmlChar to be parsed.
- * CUR returns the current xmlChar value, i.e. a 8 bit value if compiled
- * in ISO-Latin or UTF-8, and the current 16 bit value if compiled
- * in UNICODE mode. This should be used internally by the parser
- * only to compare to ASCII values otherwise it would break when
- * running with UTF-8 encoding.
- * NXT(n) returns the n'th next xmlChar. Same as CUR is should be used only
- * to compare on ASCII based substring.
- * UPP(n) returns the n'th next xmlChar converted to uppercase. Same as CUR
- * it should be used only to compare on ASCII based substring.
- * SKIP(n) Skip n xmlChar, and must also be used only to skip ASCII defined
- * strings within the parser.
- *
- * Clean macros, not dependent of an ASCII context, expect UTF-8 encoding
- *
- * CURRENT Returns the current char value, with the full decoding of
- * UTF-8 if we are using this mode. It returns an int.
- * NEXT Skip to the next character, this does the proper decoding
- * in UTF-8 mode. It also pop-up unfinished entities on the fly.
- * COPY(to) copy one char to *to, increment CUR_PTR and to accordingly
- */
-
-#define UPPER (toupper(*ctxt->input->cur))
-
-#define SKIP(val) ctxt->nbChars += (val),ctxt->input->cur += (val)
-
-#define NXT(val) ctxt->input->cur[(val)]
-
-#define UPP(val) (toupper(ctxt->input->cur[(val)]))
-
-#define CUR_PTR ctxt->input->cur
-
-#define SHRINK xmlParserInputShrink(ctxt->input)
-
-#define GROW xmlParserInputGrow(ctxt->input, INPUT_CHUNK)
-
-#define CURRENT ((int) (*ctxt->input->cur))
-
-#define SKIP_BLANKS htmlSkipBlankChars(ctxt)
-
-/* Inported from XML */
-
-/* #define CUR (ctxt->token ? ctxt->token : (int) (*ctxt->input->cur)) */
-#define CUR ((int) (*ctxt->input->cur))
-#define NEXT xmlNextChar(ctxt),ctxt->nbChars++
-
-#define RAW (ctxt->token ? -1 : (*ctxt->input->cur))
-#define NXT(val) ctxt->input->cur[(val)]
-#define CUR_PTR ctxt->input->cur
-
-
-#define NEXTL(l) do { \
- if (*(ctxt->input->cur) == '\n') { \
- ctxt->input->line++; ctxt->input->col = 1; \
- } else ctxt->input->col++; \
- ctxt->token = 0; ctxt->input->cur += l; ctxt->nbChars++; \
- } while (0)
-
-/************
- \
- if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \
- if (*ctxt->input->cur == '&') xmlParserHandleReference(ctxt);
- ************/
-
-#define CUR_CHAR(l) htmlCurrentChar(ctxt, &l)
-#define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l)
-
-#define COPY_BUF(l,b,i,v) \
- if (l == 1) b[i++] = (xmlChar) v; \
- else i += xmlCopyChar(l,&b[i],v)
-
-/**
- * htmlCurrentChar:
- * @ctxt: the HTML parser context
- * @len: pointer to the length of the char read
- *
- * The current char value, if using UTF-8 this may actually span multiple
- * bytes in the input buffer. Implement the end of line normalization:
- * 2.11 End-of-Line Handling
- * If the encoding is unspecified, in the case we find an ISO-Latin-1
- * char, then the encoding converter is plugged in automatically.
- *
- * Returns the current char value and its length
- */
-
-static int
-htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
- if (ctxt->instate == XML_PARSER_EOF)
- return(0);
-
- if (ctxt->token != 0) {
- *len = 0;
- return(ctxt->token);
- }
- if (ctxt->charset == XML_CHAR_ENCODING_UTF8) {
- /*
- * We are supposed to handle UTF8, check it's valid
- * From rfc2044: encoding of the Unicode values on UTF-8:
- *
- * UCS-4 range (hex.) UTF-8 octet sequence (binary)
- * 0000 0000-0000 007F 0xxxxxxx
- * 0000 0080-0000 07FF 110xxxxx 10xxxxxx
- * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx
- *
- * Check for the 0x110000 limit too
- */
- const unsigned char *cur = ctxt->input->cur;
- unsigned char c;
- unsigned int val;
-
- c = *cur;
- if (c & 0x80) {
- if (cur[1] == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- if ((cur[1] & 0xc0) != 0x80)
- goto encoding_error;
- if ((c & 0xe0) == 0xe0) {
-
- if (cur[2] == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- if ((cur[2] & 0xc0) != 0x80)
- goto encoding_error;
- if ((c & 0xf0) == 0xf0) {
- if (cur[3] == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- if (((c & 0xf8) != 0xf0) ||
- ((cur[3] & 0xc0) != 0x80))
- goto encoding_error;
- /* 4-byte code */
- *len = 4;
- val = (cur[0] & 0x7) << 18;
- val |= (cur[1] & 0x3f) << 12;
- val |= (cur[2] & 0x3f) << 6;
- val |= cur[3] & 0x3f;
- } else {
- /* 3-byte code */
- *len = 3;
- val = (cur[0] & 0xf) << 12;
- val |= (cur[1] & 0x3f) << 6;
- val |= cur[2] & 0x3f;
- }
- } else {
- /* 2-byte code */
- *len = 2;
- val = (cur[0] & 0x1f) << 6;
- val |= cur[1] & 0x3f;
- }
- if (!IS_CHAR(val)) {
- ctxt->errNo = XML_ERR_INVALID_ENCODING;
- if ((ctxt->sax != NULL) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Char 0x%X out of allowed range\n", val);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- return(val);
- } else {
- /* 1-byte code */
- *len = 1;
- return((int) *ctxt->input->cur);
- }
- }
- /*
- * Assume it's a fixed length encoding (1) with
- * a compatible encoding for the ASCII set, since
- * XML constructs only use < 128 chars
- */
- *len = 1;
- if ((int) *ctxt->input->cur < 0x80)
- return((int) *ctxt->input->cur);
-
- /*
- * Humm this is bad, do an automatic flow conversion
- */
- xmlSwitchEncoding(ctxt, XML_CHAR_ENCODING_8859_1);
- ctxt->charset = XML_CHAR_ENCODING_UTF8;
- return(xmlCurrentChar(ctxt, len));
-
-encoding_error:
- /*
- * If we detect an UTF8 error that probably mean that the
- * input encoding didn't get properly advertized in the
- * declaration header. Report the error and switch the encoding
- * to ISO-Latin-1 (if you don't like this policy, just declare the
- * encoding !)
- */
- ctxt->errNo = XML_ERR_INVALID_ENCODING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) {
- ctxt->sax->error(ctxt->userData,
- "Input is not proper UTF-8, indicate encoding !\n");
- ctxt->sax->error(ctxt->userData, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
- ctxt->input->cur[0], ctxt->input->cur[1],
- ctxt->input->cur[2], ctxt->input->cur[3]);
- }
-
- ctxt->charset = XML_CHAR_ENCODING_8859_1;
- *len = 1;
- return((int) *ctxt->input->cur);
-}
-
-/**
- * htmlSkipBlankChars:
- * @ctxt: the HTML parser context
- *
- * skip all blanks character found at that point in the input streams.
- *
- * Returns the number of space chars skipped
- */
-
-static int
-htmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
- int res = 0;
-
- while (IS_BLANK(*(ctxt->input->cur))) {
- if ((*ctxt->input->cur == 0) &&
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) {
- xmlPopInput(ctxt);
- } else {
- if (*(ctxt->input->cur) == '\n') {
- ctxt->input->line++; ctxt->input->col = 1;
- } else ctxt->input->col++;
- ctxt->input->cur++;
- ctxt->nbChars++;
- if (*ctxt->input->cur == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- }
- res++;
- }
- return(res);
-}
-
-
-
-/************************************************************************
- * *
- * The list of HTML elements and their properties *
- * *
- ************************************************************************/
-
-/*
- * Start Tag: 1 means the start tag can be ommited
- * End Tag: 1 means the end tag can be ommited
- * 2 means it's forbidden (empty elements)
- * 3 means the tag is stylistic and should be closed easily
- * Depr: this element is deprecated
- * DTD: 1 means that this element is valid only in the Loose DTD
- * 2 means that this element is valid only in the Frameset DTD
- *
- * Name,Start Tag,End Tag,Save End,Empty,Deprecated,DTD,inline,Description
- */
-static const htmlElemDesc
-html40ElementTable[] = {
-{ "a", 0, 0, 0, 0, 0, 0, 1, "anchor " },
-{ "abbr", 0, 0, 0, 0, 0, 0, 1, "abbreviated form" },
-{ "acronym", 0, 0, 0, 0, 0, 0, 1, "" },
-{ "address", 0, 0, 0, 0, 0, 0, 0, "information on author " },
-{ "applet", 0, 0, 0, 0, 1, 1, 2, "java applet " },
-{ "area", 0, 2, 2, 1, 0, 0, 0, "client-side image map area " },
-{ "b", 0, 3, 0, 0, 0, 0, 1, "bold text style" },
-{ "base", 0, 2, 2, 1, 0, 0, 0, "document base uri " },
-{ "basefont", 0, 2, 2, 1, 1, 1, 1, "base font size " },
-{ "bdo", 0, 0, 0, 0, 0, 0, 1, "i18n bidi over-ride " },
-{ "big", 0, 3, 0, 0, 0, 0, 1, "large text style" },
-{ "blockquote", 0, 0, 0, 0, 0, 0, 0, "long quotation " },
-{ "body", 1, 1, 0, 0, 0, 0, 0, "document body " },
-{ "br", 0, 2, 2, 1, 0, 0, 1, "forced line break " },
-{ "button", 0, 0, 0, 0, 0, 0, 2, "push button " },
-{ "caption", 0, 0, 0, 0, 0, 0, 0, "table caption " },
-{ "center", 0, 3, 0, 0, 1, 1, 0, "shorthand for div align=center " },
-{ "cite", 0, 0, 0, 0, 0, 0, 1, "citation" },
-{ "code", 0, 0, 0, 0, 0, 0, 1, "computer code fragment" },
-{ "col", 0, 2, 2, 1, 0, 0, 0, "table column " },
-{ "colgroup", 0, 1, 0, 0, 0, 0, 0, "table column group " },
-{ "dd", 0, 1, 0, 0, 0, 0, 0, "definition description " },
-{ "del", 0, 0, 0, 0, 0, 0, 2, "deleted text " },
-{ "dfn", 0, 0, 0, 0, 0, 0, 1, "instance definition" },
-{ "dir", 0, 0, 0, 0, 1, 1, 0, "directory list" },
-{ "div", 0, 0, 0, 0, 0, 0, 0, "generic language/style container"},
-{ "dl", 0, 0, 0, 0, 0, 0, 0, "definition list " },
-{ "dt", 0, 1, 0, 0, 0, 0, 0, "definition term " },
-{ "em", 0, 3, 0, 0, 0, 0, 1, "emphasis" },
-{ "fieldset", 0, 0, 0, 0, 0, 0, 0, "form control group " },
-{ "font", 0, 3, 0, 0, 1, 1, 1, "local change to font " },
-{ "form", 0, 0, 0, 0, 0, 0, 0, "interactive form " },
-{ "frame", 0, 2, 2, 1, 0, 2, 0, "subwindow " },
-{ "frameset", 0, 0, 0, 0, 0, 2, 0, "window subdivision" },
-{ "h1", 0, 0, 0, 0, 0, 0, 0, "heading " },
-{ "h2", 0, 0, 0, 0, 0, 0, 0, "heading " },
-{ "h3", 0, 0, 0, 0, 0, 0, 0, "heading " },
-{ "h4", 0, 0, 0, 0, 0, 0, 0, "heading " },
-{ "h5", 0, 0, 0, 0, 0, 0, 0, "heading " },
-{ "h6", 0, 0, 0, 0, 0, 0, 0, "heading " },
-{ "head", 1, 1, 0, 0, 0, 0, 0, "document head " },
-{ "hr", 0, 2, 2, 1, 0, 0, 0, "horizontal rule " },
-{ "html", 1, 1, 0, 0, 0, 0, 0, "document root element " },
-{ "i", 0, 3, 0, 0, 0, 0, 1, "italic text style" },
-{ "iframe", 0, 0, 0, 0, 0, 1, 2, "inline subwindow " },
-{ "img", 0, 2, 2, 1, 0, 0, 1, "embedded image " },
-{ "input", 0, 2, 2, 1, 0, 0, 1, "form control " },
-{ "ins", 0, 0, 0, 0, 0, 0, 2, "inserted text" },
-{ "isindex", 0, 2, 2, 1, 1, 1, 0, "single line prompt " },
-{ "kbd", 0, 0, 0, 0, 0, 0, 1, "text to be entered by the user" },
-{ "label", 0, 0, 0, 0, 0, 0, 1, "form field label text " },
-{ "legend", 0, 0, 0, 0, 0, 0, 0, "fieldset legend " },
-{ "li", 0, 1, 1, 0, 0, 0, 0, "list item " },
-{ "link", 0, 2, 2, 1, 0, 0, 0, "a media-independent link " },
-{ "map", 0, 0, 0, 0, 0, 0, 2, "client-side image map " },
-{ "menu", 0, 0, 0, 0, 1, 1, 0, "menu list " },
-{ "meta", 0, 2, 2, 1, 0, 0, 0, "generic metainformation " },
-{ "noframes", 0, 0, 0, 0, 0, 2, 0, "alternate content container for non frame-based rendering " },
-{ "noscript", 0, 0, 0, 0, 0, 0, 0, "alternate content container for non script-based rendering " },
-{ "object", 0, 0, 0, 0, 0, 0, 2, "generic embedded object " },
-{ "ol", 0, 0, 0, 0, 0, 0, 0, "ordered list " },
-{ "optgroup", 0, 0, 0, 0, 0, 0, 0, "option group " },
-{ "option", 0, 1, 0, 0, 0, 0, 0, "selectable choice " },
-{ "p", 0, 1, 0, 0, 0, 0, 0, "paragraph " },
-{ "param", 0, 2, 2, 1, 0, 0, 0, "named property value " },
-{ "pre", 0, 0, 0, 0, 0, 0, 0, "preformatted text " },
-{ "q", 0, 0, 0, 0, 0, 0, 1, "short inline quotation " },
-{ "s", 0, 3, 0, 0, 1, 1, 1, "strike-through text style" },
-{ "samp", 0, 0, 0, 0, 0, 0, 1, "sample program output, scripts, etc." },
-{ "script", 0, 0, 0, 0, 0, 0, 2, "script statements " },
-{ "select", 0, 0, 0, 0, 0, 0, 1, "option selector " },
-{ "small", 0, 3, 0, 0, 0, 0, 1, "small text style" },
-{ "span", 0, 0, 0, 0, 0, 0, 1, "generic language/style container " },
-{ "strike", 0, 3, 0, 0, 1, 1, 1, "strike-through text" },
-{ "strong", 0, 3, 0, 0, 0, 0, 1, "strong emphasis" },
-{ "style", 0, 0, 0, 0, 0, 0, 0, "style info " },
-{ "sub", 0, 3, 0, 0, 0, 0, 1, "subscript" },
-{ "sup", 0, 3, 0, 0, 0, 0, 1, "superscript " },
-{ "table", 0, 0, 0, 0, 0, 0, 0, "&#160;" },
-{ "tbody", 1, 0, 0, 0, 0, 0, 0, "table body " },
-{ "td", 0, 0, 0, 0, 0, 0, 0, "table data cell" },
-{ "textarea", 0, 0, 0, 0, 0, 0, 1, "multi-line text field " },
-{ "tfoot", 0, 1, 0, 0, 0, 0, 0, "table footer " },
-{ "th", 0, 1, 0, 0, 0, 0, 0, "table header cell" },
-{ "thead", 0, 1, 0, 0, 0, 0, 0, "table header " },
-{ "title", 0, 0, 0, 0, 0, 0, 0, "document title " },
-{ "tr", 0, 0, 0, 0, 0, 0, 0, "table row " },
-{ "tt", 0, 3, 0, 0, 0, 0, 1, "teletype or monospaced text style" },
-{ "u", 0, 3, 0, 0, 1, 1, 1, "underlined text style" },
-{ "ul", 0, 0, 0, 0, 0, 0, 0, "unordered list " },
-{ "var", 0, 0, 0, 0, 0, 0, 1, "instance of a variable or program argument" },
-};
-
-/*
- * start tags that imply the end of current element
- */
-static const char *htmlStartClose[] = {
-"form", "form", "p", "hr", "h1", "h2", "h3", "h4", "h5", "h6",
- "dl", "ul", "ol", "menu", "dir", "address", "pre",
- "listing", "xmp", "head", NULL,
-"head", "p", NULL,
-"title", "p", NULL,
-"body", "head", "style", "link", "title", "p", NULL,
-"li", "p", "h1", "h2", "h3", "h4", "h5", "h6", "dl", "address",
- "pre", "listing", "xmp", "head", "li", NULL,
-"hr", "p", "head", NULL,
-"h1", "p", "head", NULL,
-"h2", "p", "head", NULL,
-"h3", "p", "head", NULL,
-"h4", "p", "head", NULL,
-"h5", "p", "head", NULL,
-"h6", "p", "head", NULL,
-"dir", "p", "head", NULL,
-"address", "p", "head", "ul", NULL,
-"pre", "p", "head", "ul", NULL,
-"listing", "p", "head", NULL,
-"xmp", "p", "head", NULL,
-"blockquote", "p", "head", NULL,
-"dl", "p", "dt", "menu", "dir", "address", "pre", "listing",
- "xmp", "head", NULL,
-"dt", "p", "menu", "dir", "address", "pre", "listing", "xmp",
- "head", "dd", NULL,
-"dd", "p", "menu", "dir", "address", "pre", "listing", "xmp",
- "head", "dt", NULL,
-"ul", "p", "head", "ol", "menu", "dir", "address", "pre",
- "listing", "xmp", NULL,
-"ol", "p", "head", "ul", NULL,
-"menu", "p", "head", "ul", NULL,
-"p", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", NULL,
-"div", "p", "head", NULL,
-"noscript", "p", "head", NULL,
-"center", "font", "b", "i", "p", "head", NULL,
-"a", "a", NULL,
-"caption", "p", NULL,
-"colgroup", "caption", "colgroup", "col", "p", NULL,
-"col", "caption", "col", "p", NULL,
-"table", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", "pre",
- "listing", "xmp", "a", NULL,
-"th", "th", "td", "p", "span", "font", "a", "b", "i", "u", NULL,
-"td", "th", "td", "p", "span", "font", "a", "b", "i", "u", NULL,
-"tr", "th", "td", "tr", "caption", "col", "colgroup", "p", NULL,
-"thead", "caption", "col", "colgroup", NULL,
-"tfoot", "th", "td", "tr", "caption", "col", "colgroup", "thead",
- "tbody", "p", NULL,
-"tbody", "th", "td", "tr", "caption", "col", "colgroup", "thead",
- "tfoot", "tbody", "p", NULL,
-"optgroup", "option", NULL,
-"option", "option", NULL,
-"fieldset", "legend", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6",
- "pre", "listing", "xmp", "a", NULL,
-NULL
-};
-
-/*
- * The list of HTML elements which are supposed not to have
- * CDATA content and where a p element will be implied
- *
- * TODO: extend that list by reading the HTML SGML DTD on
- * implied paragraph
- */
-static const char *htmlNoContentElements[] = {
- "html",
- "head",
- "body",
- NULL
-};
-
-/*
- * The list of HTML attributes which are of content %Script;
- * NOTE: when adding ones, check htmlIsScriptAttribute() since
- * it assumes the name starts with 'on'
- */
-static const char *htmlScriptAttributes[] = {
- "onclick",
- "ondblclick",
- "onmousedown",
- "onmouseup",
- "onmouseover",
- "onmousemove",
- "onmouseout",
- "onkeypress",
- "onkeydown",
- "onkeyup",
- "onload",
- "onunload",
- "onfocus",
- "onblur",
- "onsubmit",
- "onrest",
- "onchange",
- "onselect"
-};
-
-/*
- * This table is used by the htmlparser to know what to do with
- * broken html pages. By assigning different priorities to different
- * elements the parser can decide how to handle extra endtags.
- * Endtags are only allowed to close elements with lower or equal
- * priority.
- */
-
-typedef struct {
- const char *name;
- int priority;
-} elementPriority;
-
-static const elementPriority htmlEndPriority[] = {
- {"div", 150},
- {"td", 160},
- {"th", 160},
- {"tr", 170},
- {"thead", 180},
- {"tbody", 180},
- {"tfoot", 180},
- {"table", 190},
- {"head", 200},
- {"body", 200},
- {"html", 220},
- {NULL, 100} /* Default priority */
-};
-
-static const char** htmlStartCloseIndex[100];
-static int htmlStartCloseIndexinitialized = 0;
-
-/************************************************************************
- * *
- * functions to handle HTML specific data *
- * *
- ************************************************************************/
-
-/**
- * htmlInitAutoClose:
- *
- * Initialize the htmlStartCloseIndex for fast lookup of closing tags names.
- * This is not reentrant. Call xmlInitParser() once before processing in
- * case of use in multithreaded programs.
- */
-void
-htmlInitAutoClose(void) {
- int indx, i = 0;
-
- if (htmlStartCloseIndexinitialized) return;
-
- for (indx = 0;indx < 100;indx ++) htmlStartCloseIndex[indx] = NULL;
- indx = 0;
- while ((htmlStartClose[i] != NULL) && (indx < 100 - 1)) {
- htmlStartCloseIndex[indx++] = &htmlStartClose[i];
- while (htmlStartClose[i] != NULL) i++;
- i++;
- }
- htmlStartCloseIndexinitialized = 1;
-}
-
-/**
- * htmlTagLookup:
- * @tag: The tag name in lowercase
- *
- * Lookup the HTML tag in the ElementTable
- *
- * Returns the related htmlElemDescPtr or NULL if not found.
- */
-const htmlElemDesc *
-htmlTagLookup(const xmlChar *tag) {
- unsigned int i;
-
- for (i = 0; i < (sizeof(html40ElementTable) /
- sizeof(html40ElementTable[0]));i++) {
- if (!xmlStrcasecmp(tag, BAD_CAST html40ElementTable[i].name))
- return((const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) &html40ElementTable[i]);
- }
- return(NULL);
-}
-
-/**
- * htmlGetEndPriority:
- * @name: The name of the element to look up the priority for.
- *
- * Return value: The "endtag" priority.
- **/
-static int
-htmlGetEndPriority (const xmlChar *name) {
- int i = 0;
-
- while ((htmlEndPriority[i].name != NULL) &&
- (!xmlStrEqual((const xmlChar *)htmlEndPriority[i].name, name)))
- i++;
-
- return(htmlEndPriority[i].priority);
-}
-
-/**
- * htmlCheckAutoClose:
- * @newtag: The new tag name
- * @oldtag: The old tag name
- *
- * Checks whether the new tag is one of the registered valid tags for
- * closing old.
- * Initialize the htmlStartCloseIndex for fast lookup of closing tags names.
- *
- * Returns 0 if no, 1 if yes.
- */
-static int
-htmlCheckAutoClose(const xmlChar *newtag, const xmlChar *oldtag) {
- int i, indx;
- const char **closed = NULL;
-
- if (htmlStartCloseIndexinitialized == 0) htmlInitAutoClose();
-
- /* inefficient, but not a big deal */
- for (indx = 0; indx < 100;indx++) {
- closed = htmlStartCloseIndex[indx];
- if (closed == NULL) return(0);
- if (xmlStrEqual(BAD_CAST *closed, newtag)) break;
- }
-
- i = closed - htmlStartClose;
- i++;
- while (htmlStartClose[i] != NULL) {
- if (xmlStrEqual(BAD_CAST htmlStartClose[i], oldtag)) {
- return(1);
- }
- i++;
- }
- return(0);
-}
-
-/**
- * htmlAutoCloseOnClose:
- * @ctxt: an HTML parser context
- * @newtag: The new tag name
- * @force: force the tag closure
- *
- * The HTML DTD allows an ending tag to implicitly close other tags.
- */
-static void
-htmlAutoCloseOnClose(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
- const htmlElemDesc * info;
- xmlChar *oldname;
- int i, priority;
-
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"Close of %s stack: %d elements\n", newtag, ctxt->nameNr);
- for (i = 0;i < ctxt->nameNr;i++)
- xmlGenericError(xmlGenericErrorContext,"%d : %s\n", i, ctxt->nameTab[i]);
-#endif
-
- priority = htmlGetEndPriority (newtag);
-
- for (i = (ctxt->nameNr - 1);i >= 0;i--) {
-
- if (xmlStrEqual(newtag, ctxt->nameTab[i])) break;
- /*
- * A missplaced endtag can only close elements with lower
- * or equal priority, so if we find an element with higher
- * priority before we find an element with
- * matching name, we just ignore this endtag
- */
- if (htmlGetEndPriority (ctxt->nameTab[i]) > priority) return;
- }
- if (i < 0) return;
-
- while (!xmlStrEqual(newtag, ctxt->name)) {
- info = htmlTagLookup(ctxt->name);
- if ((info == NULL) || (info->endTag == 1)) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"htmlAutoCloseOnClose: %s closes %s\n", newtag, ctxt->name);
-#endif
- } else if (info->endTag == 3) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of tag %s: expecting %s\n", newtag, ctxt->name);
-
-#endif
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Opening and ending tag mismatch: %s and %s\n",
- newtag, ctxt->name);
- ctxt->wellFormed = 0;
- }
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, ctxt->name);
- oldname = htmlnamePop(ctxt);
- if (oldname != NULL) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"htmlAutoCloseOnClose: popped %s\n", oldname);
-#endif
- xmlFree(oldname);
- }
- }
-}
-
-/**
- * htmlAutoCloseOnEnd:
- * @ctxt: an HTML parser context
- *
- * Close all remaining tags at the end of the stream
- */
-static void
-htmlAutoCloseOnEnd(htmlParserCtxtPtr ctxt) {
- xmlChar *oldname;
- int i;
-
- if (ctxt->nameNr == 0)
- return;
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"Close of stack: %d elements\n", ctxt->nameNr);
-#endif
-
- for (i = (ctxt->nameNr - 1);i >= 0;i--) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"%d : %s\n", i, ctxt->nameTab[i]);
-#endif
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, ctxt->name);
- oldname = htmlnamePop(ctxt);
- if (oldname != NULL) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"htmlAutoCloseOnEnd: popped %s\n", oldname);
-#endif
- xmlFree(oldname);
- }
- }
-}
-
-/**
- * htmlAutoClose:
- * @ctxt: an HTML parser context
- * @newtag: The new tag name or NULL
- *
- * The HTML DTD allows a tag to implicitly close other tags.
- * The list is kept in htmlStartClose array. This function is
- * called when a new tag has been detected and generates the
- * appropriates closes if possible/needed.
- * If newtag is NULL this mean we are at the end of the resource
- * and we should check
- */
-static void
-htmlAutoClose(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
- xmlChar *oldname;
- while ((newtag != NULL) && (ctxt->name != NULL) &&
- (htmlCheckAutoClose(newtag, ctxt->name))) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"htmlAutoClose: %s closes %s\n", newtag, ctxt->name);
-#endif
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, ctxt->name);
- oldname = htmlnamePop(ctxt);
- if (oldname != NULL) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"htmlAutoClose: popped %s\n", oldname);
-#endif
- xmlFree(oldname);
- }
- }
- if (newtag == NULL) {
- htmlAutoCloseOnEnd(ctxt);
- return;
- }
- while ((newtag == NULL) && (ctxt->name != NULL) &&
- ((xmlStrEqual(ctxt->name, BAD_CAST"head")) ||
- (xmlStrEqual(ctxt->name, BAD_CAST"body")) ||
- (xmlStrEqual(ctxt->name, BAD_CAST"html")))) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"htmlAutoClose: EOF closes %s\n", ctxt->name);
-#endif
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, ctxt->name);
- oldname = htmlnamePop(ctxt);
- if (oldname != NULL) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"htmlAutoClose: popped %s\n", oldname);
-#endif
- xmlFree(oldname);
- }
- }
-
-}
-
-/**
- * htmlAutoCloseTag:
- * @doc: the HTML document
- * @name: The tag name
- * @elem: the HTML element
- *
- * The HTML DTD allows a tag to implicitly close other tags.
- * The list is kept in htmlStartClose array. This function checks
- * if the element or one of it's children would autoclose the
- * given tag.
- *
- * Returns 1 if autoclose, 0 otherwise
- */
-int
-htmlAutoCloseTag(htmlDocPtr doc, const xmlChar *name, htmlNodePtr elem) {
- htmlNodePtr child;
-
- if (elem == NULL) return(1);
- if (xmlStrEqual(name, elem->name)) return(0);
- if (htmlCheckAutoClose(elem->name, name)) return(1);
- child = elem->children;
- while (child != NULL) {
- if (htmlAutoCloseTag(doc, name, child)) return(1);
- child = child->next;
- }
- return(0);
-}
-
-/**
- * htmlIsAutoClosed:
- * @doc: the HTML document
- * @elem: the HTML element
- *
- * The HTML DTD allows a tag to implicitly close other tags.
- * The list is kept in htmlStartClose array. This function checks
- * if a tag is autoclosed by one of it's child
- *
- * Returns 1 if autoclosed, 0 otherwise
- */
-int
-htmlIsAutoClosed(htmlDocPtr doc, htmlNodePtr elem) {
- htmlNodePtr child;
-
- if (elem == NULL) return(1);
- child = elem->children;
- while (child != NULL) {
- if (htmlAutoCloseTag(doc, elem->name, child)) return(1);
- child = child->next;
- }
- return(0);
-}
-
-/**
- * htmlCheckImplied:
- * @ctxt: an HTML parser context
- * @newtag: The new tag name
- *
- * The HTML DTD allows a tag to exists only implicitly
- * called when a new tag has been detected and generates the
- * appropriates implicit tags if missing
- */
-static void
-htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
- if (!htmlOmittedDefaultValue)
- return;
- if (xmlStrEqual(newtag, BAD_CAST"html"))
- return;
- if (ctxt->nameNr <= 0) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"Implied element html: pushed html\n");
-#endif
- htmlnamePush(ctxt, xmlStrdup(BAD_CAST"html"));
- if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL))
- ctxt->sax->startElement(ctxt->userData, BAD_CAST"html", NULL);
- }
- if ((xmlStrEqual(newtag, BAD_CAST"body")) || (xmlStrEqual(newtag, BAD_CAST"head")))
- return;
- if ((ctxt->nameNr <= 1) &&
- ((xmlStrEqual(newtag, BAD_CAST"script")) ||
- (xmlStrEqual(newtag, BAD_CAST"style")) ||
- (xmlStrEqual(newtag, BAD_CAST"meta")) ||
- (xmlStrEqual(newtag, BAD_CAST"link")) ||
- (xmlStrEqual(newtag, BAD_CAST"title")) ||
- (xmlStrEqual(newtag, BAD_CAST"base")))) {
- /*
- * dropped OBJECT ... i you put it first BODY will be
- * assumed !
- */
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"Implied element head: pushed head\n");
-#endif
- htmlnamePush(ctxt, xmlStrdup(BAD_CAST"head"));
- if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL))
- ctxt->sax->startElement(ctxt->userData, BAD_CAST"head", NULL);
- } else if ((!xmlStrEqual(newtag, BAD_CAST"noframes")) &&
- (!xmlStrEqual(newtag, BAD_CAST"frame")) &&
- (!xmlStrEqual(newtag, BAD_CAST"frameset"))) {
- int i;
- for (i = 0;i < ctxt->nameNr;i++) {
- if (xmlStrEqual(ctxt->nameTab[i], BAD_CAST"body")) {
- return;
- }
- if (xmlStrEqual(ctxt->nameTab[i], BAD_CAST"head")) {
- return;
- }
- }
-
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"Implied element body: pushed body\n");
-#endif
- htmlnamePush(ctxt, xmlStrdup(BAD_CAST"body"));
- if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL))
- ctxt->sax->startElement(ctxt->userData, BAD_CAST"body", NULL);
- }
-}
-
-/**
- * htmlCheckParagraph
- * @ctxt: an HTML parser context
- *
- * Check whether a p element need to be implied before inserting
- * characters in the current element.
- *
- * Returns 1 if a paragraph has been inserted, 0 if not and -1
- * in case of error.
- */
-
-static int
-htmlCheckParagraph(htmlParserCtxtPtr ctxt) {
- const xmlChar *tag;
- int i;
-
- if (ctxt == NULL)
- return(-1);
- tag = ctxt->name;
- if (tag == NULL) {
- htmlAutoClose(ctxt, BAD_CAST"p");
- htmlCheckImplied(ctxt, BAD_CAST"p");
- htmlnamePush(ctxt, xmlStrdup(BAD_CAST"p"));
- if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL))
- ctxt->sax->startElement(ctxt->userData, BAD_CAST"p", NULL);
- return(1);
- }
- if (!htmlOmittedDefaultValue)
- return(0);
- for (i = 0; htmlNoContentElements[i] != NULL; i++) {
- if (xmlStrEqual(tag, BAD_CAST htmlNoContentElements[i])) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"Implied element paragraph\n");
-#endif
- htmlAutoClose(ctxt, BAD_CAST"p");
- htmlCheckImplied(ctxt, BAD_CAST"p");
- htmlnamePush(ctxt, xmlStrdup(BAD_CAST"p"));
- if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL))
- ctxt->sax->startElement(ctxt->userData, BAD_CAST"p", NULL);
- return(1);
- }
- }
- return(0);
-}
-
-/**
- * htmlIsScriptAttribute:
- * @name: an attribute name
- *
- * Check if an attribute is of content type Script
- *
- * Returns 1 is the attribute is a script 0 otherwise
- */
-int
-htmlIsScriptAttribute(const xmlChar *name) {
- unsigned int i;
-
- if (name == NULL)
- return(0);
- /*
- * all script attributes start with 'on'
- */
- if ((name[0] != 'o') || (name[1] != 'n'))
- return(0);
- for (i = 0;
- i < sizeof(htmlScriptAttributes)/sizeof(htmlScriptAttributes[0]);
- i++) {
- if (xmlStrEqual(name, (const xmlChar *) htmlScriptAttributes[i]))
- return(1);
- }
- return(0);
-}
-
-/************************************************************************
- * *
- * The list of HTML predefined entities *
- * *
- ************************************************************************/
-
-
-static const htmlEntityDesc html40EntitiesTable[] = {
-/*
- * the 4 absolute ones, plus apostrophe.
- */
-{ 34, "quot", "quotation mark = APL quote, U+0022 ISOnum" },
-{ 38, "amp", "ampersand, U+0026 ISOnum" },
-{ 39, "apos", "single quote" },
-{ 60, "lt", "less-than sign, U+003C ISOnum" },
-{ 62, "gt", "greater-than sign, U+003E ISOnum" },
-
-/*
- * A bunch still in the 128-255 range
- * Replacing them depend really on the charset used.
- */
-{ 160, "nbsp", "no-break space = non-breaking space, U+00A0 ISOnum" },
-{ 161, "iexcl","inverted exclamation mark, U+00A1 ISOnum" },
-{ 162, "cent", "cent sign, U+00A2 ISOnum" },
-{ 163, "pound","pound sign, U+00A3 ISOnum" },
-{ 164, "curren","currency sign, U+00A4 ISOnum" },
-{ 165, "yen", "yen sign = yuan sign, U+00A5 ISOnum" },
-{ 166, "brvbar","broken bar = broken vertical bar, U+00A6 ISOnum" },
-{ 167, "sect", "section sign, U+00A7 ISOnum" },
-{ 168, "uml", "diaeresis = spacing diaeresis, U+00A8 ISOdia" },
-{ 169, "copy", "copyright sign, U+00A9 ISOnum" },
-{ 170, "ordf", "feminine ordinal indicator, U+00AA ISOnum" },
-{ 171, "laquo","left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum" },
-{ 172, "not", "not sign, U+00AC ISOnum" },
-{ 173, "shy", "soft hyphen = discretionary hyphen, U+00AD ISOnum" },
-{ 174, "reg", "registered sign = registered trade mark sign, U+00AE ISOnum" },
-{ 175, "macr", "macron = spacing macron = overline = APL overbar, U+00AF ISOdia" },
-{ 176, "deg", "degree sign, U+00B0 ISOnum" },
-{ 177, "plusmn","plus-minus sign = plus-or-minus sign, U+00B1 ISOnum" },
-{ 178, "sup2", "superscript two = superscript digit two = squared, U+00B2 ISOnum" },
-{ 179, "sup3", "superscript three = superscript digit three = cubed, U+00B3 ISOnum" },
-{ 180, "acute","acute accent = spacing acute, U+00B4 ISOdia" },
-{ 181, "micro","micro sign, U+00B5 ISOnum" },
-{ 182, "para", "pilcrow sign = paragraph sign, U+00B6 ISOnum" },
-{ 183, "middot","middle dot = Georgian comma Greek middle dot, U+00B7 ISOnum" },
-{ 184, "cedil","cedilla = spacing cedilla, U+00B8 ISOdia" },
-{ 185, "sup1", "superscript one = superscript digit one, U+00B9 ISOnum" },
-{ 186, "ordm", "masculine ordinal indicator, U+00BA ISOnum" },
-{ 187, "raquo","right-pointing double angle quotation mark right pointing guillemet, U+00BB ISOnum" },
-{ 188, "frac14","vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum" },
-{ 189, "frac12","vulgar fraction one half = fraction one half, U+00BD ISOnum" },
-{ 190, "frac34","vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum" },
-{ 191, "iquest","inverted question mark = turned question mark, U+00BF ISOnum" },
-{ 192, "Agrave","latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1" },
-{ 193, "Aacute","latin capital letter A with acute, U+00C1 ISOlat1" },
-{ 194, "Acirc","latin capital letter A with circumflex, U+00C2 ISOlat1" },
-{ 195, "Atilde","latin capital letter A with tilde, U+00C3 ISOlat1" },
-{ 196, "Auml", "latin capital letter A with diaeresis, U+00C4 ISOlat1" },
-{ 197, "Aring","latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1" },
-{ 198, "AElig","latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1" },
-{ 199, "Ccedil","latin capital letter C with cedilla, U+00C7 ISOlat1" },
-{ 200, "Egrave","latin capital letter E with grave, U+00C8 ISOlat1" },
-{ 201, "Eacute","latin capital letter E with acute, U+00C9 ISOlat1" },
-{ 202, "Ecirc","latin capital letter E with circumflex, U+00CA ISOlat1" },
-{ 203, "Euml", "latin capital letter E with diaeresis, U+00CB ISOlat1" },
-{ 204, "Igrave","latin capital letter I with grave, U+00CC ISOlat1" },
-{ 205, "Iacute","latin capital letter I with acute, U+00CD ISOlat1" },
-{ 206, "Icirc","latin capital letter I with circumflex, U+00CE ISOlat1" },
-{ 207, "Iuml", "latin capital letter I with diaeresis, U+00CF ISOlat1" },
-{ 208, "ETH", "latin capital letter ETH, U+00D0 ISOlat1" },
-{ 209, "Ntilde","latin capital letter N with tilde, U+00D1 ISOlat1" },
-{ 210, "Ograve","latin capital letter O with grave, U+00D2 ISOlat1" },
-{ 211, "Oacute","latin capital letter O with acute, U+00D3 ISOlat1" },
-{ 212, "Ocirc","latin capital letter O with circumflex, U+00D4 ISOlat1" },
-{ 213, "Otilde","latin capital letter O with tilde, U+00D5 ISOlat1" },
-{ 214, "Ouml", "latin capital letter O with diaeresis, U+00D6 ISOlat1" },
-{ 215, "times","multiplication sign, U+00D7 ISOnum" },
-{ 216, "Oslash","latin capital letter O with stroke latin capital letter O slash, U+00D8 ISOlat1" },
-{ 217, "Ugrave","latin capital letter U with grave, U+00D9 ISOlat1" },
-{ 218, "Uacute","latin capital letter U with acute, U+00DA ISOlat1" },
-{ 219, "Ucirc","latin capital letter U with circumflex, U+00DB ISOlat1" },
-{ 220, "Uuml", "latin capital letter U with diaeresis, U+00DC ISOlat1" },
-{ 221, "Yacute","latin capital letter Y with acute, U+00DD ISOlat1" },
-{ 222, "THORN","latin capital letter THORN, U+00DE ISOlat1" },
-{ 223, "szlig","latin small letter sharp s = ess-zed, U+00DF ISOlat1" },
-{ 224, "agrave","latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1" },
-{ 225, "aacute","latin small letter a with acute, U+00E1 ISOlat1" },
-{ 226, "acirc","latin small letter a with circumflex, U+00E2 ISOlat1" },
-{ 227, "atilde","latin small letter a with tilde, U+00E3 ISOlat1" },
-{ 228, "auml", "latin small letter a with diaeresis, U+00E4 ISOlat1" },
-{ 229, "aring","latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1" },
-{ 230, "aelig","latin small letter ae = latin small ligature ae, U+00E6 ISOlat1" },
-{ 231, "ccedil","latin small letter c with cedilla, U+00E7 ISOlat1" },
-{ 232, "egrave","latin small letter e with grave, U+00E8 ISOlat1" },
-{ 233, "eacute","latin small letter e with acute, U+00E9 ISOlat1" },
-{ 234, "ecirc","latin small letter e with circumflex, U+00EA ISOlat1" },
-{ 235, "euml", "latin small letter e with diaeresis, U+00EB ISOlat1" },
-{ 236, "igrave","latin small letter i with grave, U+00EC ISOlat1" },
-{ 237, "iacute","latin small letter i with acute, U+00ED ISOlat1" },
-{ 238, "icirc","latin small letter i with circumflex, U+00EE ISOlat1" },
-{ 239, "iuml", "latin small letter i with diaeresis, U+00EF ISOlat1" },
-{ 240, "eth", "latin small letter eth, U+00F0 ISOlat1" },
-{ 241, "ntilde","latin small letter n with tilde, U+00F1 ISOlat1" },
-{ 242, "ograve","latin small letter o with grave, U+00F2 ISOlat1" },
-{ 243, "oacute","latin small letter o with acute, U+00F3 ISOlat1" },
-{ 244, "ocirc","latin small letter o with circumflex, U+00F4 ISOlat1" },
-{ 245, "otilde","latin small letter o with tilde, U+00F5 ISOlat1" },
-{ 246, "ouml", "latin small letter o with diaeresis, U+00F6 ISOlat1" },
-{ 247, "divide","division sign, U+00F7 ISOnum" },
-{ 248, "oslash","latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1" },
-{ 249, "ugrave","latin small letter u with grave, U+00F9 ISOlat1" },
-{ 250, "uacute","latin small letter u with acute, U+00FA ISOlat1" },
-{ 251, "ucirc","latin small letter u with circumflex, U+00FB ISOlat1" },
-{ 252, "uuml", "latin small letter u with diaeresis, U+00FC ISOlat1" },
-{ 253, "yacute","latin small letter y with acute, U+00FD ISOlat1" },
-{ 254, "thorn","latin small letter thorn with, U+00FE ISOlat1" },
-{ 255, "yuml", "latin small letter y with diaeresis, U+00FF ISOlat1" },
-
-{ 338, "OElig","latin capital ligature OE, U+0152 ISOlat2" },
-{ 339, "oelig","latin small ligature oe, U+0153 ISOlat2" },
-{ 352, "Scaron","latin capital letter S with caron, U+0160 ISOlat2" },
-{ 353, "scaron","latin small letter s with caron, U+0161 ISOlat2" },
-{ 376, "Yuml", "latin capital letter Y with diaeresis, U+0178 ISOlat2" },
-
-/*
- * Anything below should really be kept as entities references
- */
-{ 402, "fnof", "latin small f with hook = function = florin, U+0192 ISOtech" },
-
-{ 710, "circ", "modifier letter circumflex accent, U+02C6 ISOpub" },
-{ 732, "tilde","small tilde, U+02DC ISOdia" },
-
-{ 913, "Alpha","greek capital letter alpha, U+0391" },
-{ 914, "Beta", "greek capital letter beta, U+0392" },
-{ 915, "Gamma","greek capital letter gamma, U+0393 ISOgrk3" },
-{ 916, "Delta","greek capital letter delta, U+0394 ISOgrk3" },
-{ 917, "Epsilon","greek capital letter epsilon, U+0395" },
-{ 918, "Zeta", "greek capital letter zeta, U+0396" },
-{ 919, "Eta", "greek capital letter eta, U+0397" },
-{ 920, "Theta","greek capital letter theta, U+0398 ISOgrk3" },
-{ 921, "Iota", "greek capital letter iota, U+0399" },
-{ 922, "Kappa","greek capital letter kappa, U+039A" },
-{ 923, "Lambda", "greek capital letter lambda, U+039B ISOgrk3" },
-{ 924, "Mu", "greek capital letter mu, U+039C" },
-{ 925, "Nu", "greek capital letter nu, U+039D" },
-{ 926, "Xi", "greek capital letter xi, U+039E ISOgrk3" },
-{ 927, "Omicron","greek capital letter omicron, U+039F" },
-{ 928, "Pi", "greek capital letter pi, U+03A0 ISOgrk3" },
-{ 929, "Rho", "greek capital letter rho, U+03A1" },
-{ 931, "Sigma","greek capital letter sigma, U+03A3 ISOgrk3" },
-{ 932, "Tau", "greek capital letter tau, U+03A4" },
-{ 933, "Upsilon","greek capital letter upsilon, U+03A5 ISOgrk3" },
-{ 934, "Phi", "greek capital letter phi, U+03A6 ISOgrk3" },
-{ 935, "Chi", "greek capital letter chi, U+03A7" },
-{ 936, "Psi", "greek capital letter psi, U+03A8 ISOgrk3" },
-{ 937, "Omega","greek capital letter omega, U+03A9 ISOgrk3" },
-
-{ 945, "alpha","greek small letter alpha, U+03B1 ISOgrk3" },
-{ 946, "beta", "greek small letter beta, U+03B2 ISOgrk3" },
-{ 947, "gamma","greek small letter gamma, U+03B3 ISOgrk3" },
-{ 948, "delta","greek small letter delta, U+03B4 ISOgrk3" },
-{ 949, "epsilon","greek small letter epsilon, U+03B5 ISOgrk3" },
-{ 950, "zeta", "greek small letter zeta, U+03B6 ISOgrk3" },
-{ 951, "eta", "greek small letter eta, U+03B7 ISOgrk3" },
-{ 952, "theta","greek small letter theta, U+03B8 ISOgrk3" },
-{ 953, "iota", "greek small letter iota, U+03B9 ISOgrk3" },
-{ 954, "kappa","greek small letter kappa, U+03BA ISOgrk3" },
-{ 955, "lambda","greek small letter lambda, U+03BB ISOgrk3" },
-{ 956, "mu", "greek small letter mu, U+03BC ISOgrk3" },
-{ 957, "nu", "greek small letter nu, U+03BD ISOgrk3" },
-{ 958, "xi", "greek small letter xi, U+03BE ISOgrk3" },
-{ 959, "omicron","greek small letter omicron, U+03BF NEW" },
-{ 960, "pi", "greek small letter pi, U+03C0 ISOgrk3" },
-{ 961, "rho", "greek small letter rho, U+03C1 ISOgrk3" },
-{ 962, "sigmaf","greek small letter final sigma, U+03C2 ISOgrk3" },
-{ 963, "sigma","greek small letter sigma, U+03C3 ISOgrk3" },
-{ 964, "tau", "greek small letter tau, U+03C4 ISOgrk3" },
-{ 965, "upsilon","greek small letter upsilon, U+03C5 ISOgrk3" },
-{ 966, "phi", "greek small letter phi, U+03C6 ISOgrk3" },
-{ 967, "chi", "greek small letter chi, U+03C7 ISOgrk3" },
-{ 968, "psi", "greek small letter psi, U+03C8 ISOgrk3" },
-{ 969, "omega","greek small letter omega, U+03C9 ISOgrk3" },
-{ 977, "thetasym","greek small letter theta symbol, U+03D1 NEW" },
-{ 978, "upsih","greek upsilon with hook symbol, U+03D2 NEW" },
-{ 982, "piv", "greek pi symbol, U+03D6 ISOgrk3" },
-
-{ 8194, "ensp", "en space, U+2002 ISOpub" },
-{ 8195, "emsp", "em space, U+2003 ISOpub" },
-{ 8201, "thinsp","thin space, U+2009 ISOpub" },
-{ 8204, "zwnj", "zero width non-joiner, U+200C NEW RFC 2070" },
-{ 8205, "zwj", "zero width joiner, U+200D NEW RFC 2070" },
-{ 8206, "lrm", "left-to-right mark, U+200E NEW RFC 2070" },
-{ 8207, "rlm", "right-to-left mark, U+200F NEW RFC 2070" },
-{ 8211, "ndash","en dash, U+2013 ISOpub" },
-{ 8212, "mdash","em dash, U+2014 ISOpub" },
-{ 8216, "lsquo","left single quotation mark, U+2018 ISOnum" },
-{ 8217, "rsquo","right single quotation mark, U+2019 ISOnum" },
-{ 8218, "sbquo","single low-9 quotation mark, U+201A NEW" },
-{ 8220, "ldquo","left double quotation mark, U+201C ISOnum" },
-{ 8221, "rdquo","right double quotation mark, U+201D ISOnum" },
-{ 8222, "bdquo","double low-9 quotation mark, U+201E NEW" },
-{ 8224, "dagger","dagger, U+2020 ISOpub" },
-{ 8225, "Dagger","double dagger, U+2021 ISOpub" },
-
-{ 8226, "bull", "bullet = black small circle, U+2022 ISOpub" },
-{ 8230, "hellip","horizontal ellipsis = three dot leader, U+2026 ISOpub" },
-
-{ 8240, "permil","per mille sign, U+2030 ISOtech" },
-
-{ 8242, "prime","prime = minutes = feet, U+2032 ISOtech" },
-{ 8243, "Prime","double prime = seconds = inches, U+2033 ISOtech" },
-
-{ 8249, "lsaquo","single left-pointing angle quotation mark, U+2039 ISO proposed" },
-{ 8250, "rsaquo","single right-pointing angle quotation mark, U+203A ISO proposed" },
-
-{ 8254, "oline","overline = spacing overscore, U+203E NEW" },
-{ 8260, "frasl","fraction slash, U+2044 NEW" },
-
-{ 8364, "euro", "euro sign, U+20AC NEW" },
-
-{ 8465, "image","blackletter capital I = imaginary part, U+2111 ISOamso" },
-{ 8472, "weierp","script capital P = power set = Weierstrass p, U+2118 ISOamso" },
-{ 8476, "real", "blackletter capital R = real part symbol, U+211C ISOamso" },
-{ 8482, "trade","trade mark sign, U+2122 ISOnum" },
-{ 8501, "alefsym","alef symbol = first transfinite cardinal, U+2135 NEW" },
-{ 8592, "larr", "leftwards arrow, U+2190 ISOnum" },
-{ 8593, "uarr", "upwards arrow, U+2191 ISOnum" },
-{ 8594, "rarr", "rightwards arrow, U+2192 ISOnum" },
-{ 8595, "darr", "downwards arrow, U+2193 ISOnum" },
-{ 8596, "harr", "left right arrow, U+2194 ISOamsa" },
-{ 8629, "crarr","downwards arrow with corner leftwards = carriage return, U+21B5 NEW" },
-{ 8656, "lArr", "leftwards double arrow, U+21D0 ISOtech" },
-{ 8657, "uArr", "upwards double arrow, U+21D1 ISOamsa" },
-{ 8658, "rArr", "rightwards double arrow, U+21D2 ISOtech" },
-{ 8659, "dArr", "downwards double arrow, U+21D3 ISOamsa" },
-{ 8660, "hArr", "left right double arrow, U+21D4 ISOamsa" },
-
-{ 8704, "forall","for all, U+2200 ISOtech" },
-{ 8706, "part", "partial differential, U+2202 ISOtech" },
-{ 8707, "exist","there exists, U+2203 ISOtech" },
-{ 8709, "empty","empty set = null set = diameter, U+2205 ISOamso" },
-{ 8711, "nabla","nabla = backward difference, U+2207 ISOtech" },
-{ 8712, "isin", "element of, U+2208 ISOtech" },
-{ 8713, "notin","not an element of, U+2209 ISOtech" },
-{ 8715, "ni", "contains as member, U+220B ISOtech" },
-{ 8719, "prod", "n-ary product = product sign, U+220F ISOamsb" },
-{ 8721, "sum", "n-ary summation, U+2211 ISOamsb" },
-{ 8722, "minus","minus sign, U+2212 ISOtech" },
-{ 8727, "lowast","asterisk operator, U+2217 ISOtech" },
-{ 8730, "radic","square root = radical sign, U+221A ISOtech" },
-{ 8733, "prop", "proportional to, U+221D ISOtech" },
-{ 8734, "infin","infinity, U+221E ISOtech" },
-{ 8736, "ang", "angle, U+2220 ISOamso" },
-{ 8743, "and", "logical and = wedge, U+2227 ISOtech" },
-{ 8744, "or", "logical or = vee, U+2228 ISOtech" },
-{ 8745, "cap", "intersection = cap, U+2229 ISOtech" },
-{ 8746, "cup", "union = cup, U+222A ISOtech" },
-{ 8747, "int", "integral, U+222B ISOtech" },
-{ 8756, "there4","therefore, U+2234 ISOtech" },
-{ 8764, "sim", "tilde operator = varies with = similar to, U+223C ISOtech" },
-{ 8773, "cong", "approximately equal to, U+2245 ISOtech" },
-{ 8776, "asymp","almost equal to = asymptotic to, U+2248 ISOamsr" },
-{ 8800, "ne", "not equal to, U+2260 ISOtech" },
-{ 8801, "equiv","identical to, U+2261 ISOtech" },
-{ 8804, "le", "less-than or equal to, U+2264 ISOtech" },
-{ 8805, "ge", "greater-than or equal to, U+2265 ISOtech" },
-{ 8834, "sub", "subset of, U+2282 ISOtech" },
-{ 8835, "sup", "superset of, U+2283 ISOtech" },
-{ 8836, "nsub", "not a subset of, U+2284 ISOamsn" },
-{ 8838, "sube", "subset of or equal to, U+2286 ISOtech" },
-{ 8839, "supe", "superset of or equal to, U+2287 ISOtech" },
-{ 8853, "oplus","circled plus = direct sum, U+2295 ISOamsb" },
-{ 8855, "otimes","circled times = vector product, U+2297 ISOamsb" },
-{ 8869, "perp", "up tack = orthogonal to = perpendicular, U+22A5 ISOtech" },
-{ 8901, "sdot", "dot operator, U+22C5 ISOamsb" },
-{ 8968, "lceil","left ceiling = apl upstile, U+2308 ISOamsc" },
-{ 8969, "rceil","right ceiling, U+2309 ISOamsc" },
-{ 8970, "lfloor","left floor = apl downstile, U+230A ISOamsc" },
-{ 8971, "rfloor","right floor, U+230B ISOamsc" },
-{ 9001, "lang", "left-pointing angle bracket = bra, U+2329 ISOtech" },
-{ 9002, "rang", "right-pointing angle bracket = ket, U+232A ISOtech" },
-{ 9674, "loz", "lozenge, U+25CA ISOpub" },
-
-{ 9824, "spades","black spade suit, U+2660 ISOpub" },
-{ 9827, "clubs","black club suit = shamrock, U+2663 ISOpub" },
-{ 9829, "hearts","black heart suit = valentine, U+2665 ISOpub" },
-{ 9830, "diams","black diamond suit, U+2666 ISOpub" },
-
-};
-
-/************************************************************************
- * *
- * Commodity functions to handle entities *
- * *
- ************************************************************************/
-
-/*
- * Macro used to grow the current buffer.
- */
-#define growBuffer(buffer) { \
- buffer##_size *= 2; \
- buffer = (xmlChar *) xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \
- if (buffer == NULL) { \
- xmlGenericError(xmlGenericErrorContext, "realloc failed\n"); \
- return(NULL); \
- } \
-}
-
-/**
- * htmlEntityLookup:
- * @name: the entity name
- *
- * Lookup the given entity in EntitiesTable
- *
- * TODO: the linear scan is really ugly, an hash table is really needed.
- *
- * Returns the associated htmlEntityDescPtr if found, NULL otherwise.
- */
-const htmlEntityDesc *
-htmlEntityLookup(const xmlChar *name) {
- unsigned int i;
-
- for (i = 0;i < (sizeof(html40EntitiesTable)/
- sizeof(html40EntitiesTable[0]));i++) {
- if (xmlStrEqual(name, BAD_CAST html40EntitiesTable[i].name)) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"Found entity %s\n", name);
-#endif
- return((const htmlEntityDescPtr) &html40EntitiesTable[i]);
- }
- }
- return(NULL);
-}
-
-/**
- * htmlEntityValueLookup:
- * @value: the entity's unicode value
- *
- * Lookup the given entity in EntitiesTable
- *
- * TODO: the linear scan is really ugly, an hash table is really needed.
- *
- * Returns the associated htmlEntityDescPtr if found, NULL otherwise.
- */
-const htmlEntityDesc *
-htmlEntityValueLookup(unsigned int value) {
- unsigned int i;
-#ifdef DEBUG
- unsigned int lv = 0;
-#endif
-
- for (i = 0;i < (sizeof(html40EntitiesTable)/
- sizeof(html40EntitiesTable[0]));i++) {
- if (html40EntitiesTable[i].value >= value) {
- if (html40EntitiesTable[i].value > value)
- break;
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"Found entity %s\n", html40EntitiesTable[i].name);
-#endif
- return((const htmlEntityDescPtr) &html40EntitiesTable[i]);
- }
-#ifdef DEBUG
- if (lv > html40EntitiesTable[i].value) {
- xmlGenericError(xmlGenericErrorContext,
- "html40EntitiesTable[] is not sorted (%d > %d)!\n",
- lv, html40EntitiesTable[i].value);
- }
- lv = html40EntitiesTable[i].value;
-#endif
- }
- return(NULL);
-}
-
-/**
- * UTF8ToHtml:
- * @out: a pointer to an array of bytes to store the result
- * @outlen: the length of @out
- * @in: a pointer to an array of UTF-8 chars
- * @inlen: the length of @in
- *
- * Take a block of UTF-8 chars in and try to convert it to an ASCII
- * plus HTML entities block of chars out.
- *
- * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise
- * The value of @inlen after return is the number of octets consumed
- * as the return value is positive, else unpredictable.
- * The value of @outlen after return is the number of octets consumed.
- */
-int
-UTF8ToHtml(unsigned char* out, int *outlen,
- const unsigned char* in, int *inlen) {
- const unsigned char* processed = in;
- const unsigned char* outend;
- const unsigned char* outstart = out;
- const unsigned char* instart = in;
- const unsigned char* inend;
- unsigned int c, d;
- int trailing;
-
- if (in == NULL) {
- /*
- * initialization nothing to do
- */
- *outlen = 0;
- *inlen = 0;
- return(0);
- }
- inend = in + (*inlen);
- outend = out + (*outlen);
- while (in < inend) {
- d = *in++;
- if (d < 0x80) { c= d; trailing= 0; }
- else if (d < 0xC0) {
- /* trailing byte in leading position */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; }
- else if (d < 0xF0) { c= d & 0x0F; trailing= 2; }
- else if (d < 0xF8) { c= d & 0x07; trailing= 3; }
- else {
- /* no chance for this in Ascii */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- }
-
- if (inend - in < trailing) {
- break;
- }
-
- for ( ; trailing; trailing--) {
- if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80))
- break;
- c <<= 6;
- c |= d & 0x3F;
- }
-
- /* assertion: c is a single UTF-4 value */
- if (c < 0x80) {
- if (out + 1 >= outend)
- break;
- *out++ = c;
- } else {
- int len;
- const htmlEntityDesc * ent;
-
- /*
- * Try to lookup a predefined HTML entity for it
- */
-
- ent = htmlEntityValueLookup(c);
- if (ent == NULL) {
- /* no chance for this in Ascii */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- }
- len = strlen(ent->name);
- if (out + 2 + len >= outend)
- break;
- *out++ = '&';
- memcpy(out, ent->name, len);
- out += len;
- *out++ = ';';
- }
- processed = in;
- }
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(0);
-}
-
-/**
- * htmlEncodeEntities:
- * @out: a pointer to an array of bytes to store the result
- * @outlen: the length of @out
- * @in: a pointer to an array of UTF-8 chars
- * @inlen: the length of @in
- * @quoteChar: the quote character to escape (' or ") or zero.
- *
- * Take a block of UTF-8 chars in and try to convert it to an ASCII
- * plus HTML entities block of chars out.
- *
- * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise
- * The value of @inlen after return is the number of octets consumed
- * as the return value is positive, else unpredictable.
- * The value of @outlen after return is the number of octets consumed.
- */
-int
-htmlEncodeEntities(unsigned char* out, int *outlen,
- const unsigned char* in, int *inlen, int quoteChar) {
- const unsigned char* processed = in;
- const unsigned char* outend = out + (*outlen);
- const unsigned char* outstart = out;
- const unsigned char* instart = in;
- const unsigned char* inend = in + (*inlen);
- unsigned int c, d;
- int trailing;
-
- while (in < inend) {
- d = *in++;
- if (d < 0x80) { c= d; trailing= 0; }
- else if (d < 0xC0) {
- /* trailing byte in leading position */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; }
- else if (d < 0xF0) { c= d & 0x0F; trailing= 2; }
- else if (d < 0xF8) { c= d & 0x07; trailing= 3; }
- else {
- /* no chance for this in Ascii */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- }
-
- if (inend - in < trailing)
- break;
-
- while (trailing--) {
- if (((d= *in++) & 0xC0) != 0x80) {
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- }
- c <<= 6;
- c |= d & 0x3F;
- }
-
- /* assertion: c is a single UTF-4 value */
- if ((c < 0x80) && (c != (unsigned int) quoteChar) &&
- (c != '&') && (c != '<') && (c != '>')) {
- if (out >= outend)
- break;
- *out++ = c;
- } else {
- const htmlEntityDesc * ent;
- const char *cp;
- char nbuf[16];
- int len;
-
- /*
- * Try to lookup a predefined HTML entity for it
- */
- ent = htmlEntityValueLookup(c);
- if (ent == NULL) {
- snprintf(nbuf, sizeof(nbuf), "#%u", c);
- cp = nbuf;
- }
- else
- cp = ent->name;
- len = strlen(cp);
- if (out + 2 + len > outend)
- break;
- *out++ = '&';
- memcpy(out, cp, len);
- out += len;
- *out++ = ';';
- }
- processed = in;
- }
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(0);
-}
-
-/**
- * htmlDecodeEntities:
- * @ctxt: the parser context
- * @len: the len to decode (in bytes !), -1 for no size limit
- * @end: an end marker xmlChar, 0 if none
- * @end2: an end marker xmlChar, 0 if none
- * @end3: an end marker xmlChar, 0 if none
- *
- * Substitute the HTML entities by their value
- *
- * DEPRECATED !!!!
- *
- * Returns A newly allocated string with the substitution done. The caller
- * must deallocate it !
- */
-xmlChar *
-htmlDecodeEntities(htmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUSED,
- xmlChar end ATTRIBUTE_UNUSED, xmlChar end2 ATTRIBUTE_UNUSED, xmlChar end3 ATTRIBUTE_UNUSED) {
- static int deprecated = 0;
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "htmlDecodeEntities() deprecated function reached\n");
- deprecated = 1;
- }
- return(NULL);
-}
-
-/************************************************************************
- * *
- * Commodity functions to handle streams *
- * *
- ************************************************************************/
-
-/**
- * htmlNewInputStream:
- * @ctxt: an HTML parser context
- *
- * Create a new input stream structure
- * Returns the new input stream or NULL
- */
-static htmlParserInputPtr
-htmlNewInputStream(htmlParserCtxtPtr ctxt) {
- htmlParserInputPtr input;
-
- input = (xmlParserInputPtr) xmlMalloc(sizeof(htmlParserInput));
- if (input == NULL) {
- ctxt->errNo = XML_ERR_NO_MEMORY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "malloc: couldn't allocate a new input stream\n");
- return(NULL);
- }
- memset(input, 0, sizeof(htmlParserInput));
- input->filename = NULL;
- input->directory = NULL;
- input->base = NULL;
- input->cur = NULL;
- input->buf = NULL;
- input->line = 1;
- input->col = 1;
- input->buf = NULL;
- input->free = NULL;
- input->version = NULL;
- input->consumed = 0;
- input->length = 0;
- return(input);
-}
-
-
-/************************************************************************
- * *
- * Commodity functions, cleanup needed ? *
- * *
- ************************************************************************/
-/*
- * all tags allowing pc data from the html 4.01 loose dtd
- * NOTE: it might be more apropriate to integrate this information
- * into the html40ElementTable array but I don't want to risk any
- * binary incomptibility
- */
-static const char *allowPCData[] = {
- "a", "abbr", "acronym", "address", "applet", "b", "bdo", "big",
- "blockquote", "body", "button", "caption", "center", "cite", "code",
- "dd", "del", "dfn", "div", "dt", "em", "font", "form", "h1", "h2",
- "h3", "h4", "h5", "h6", "i", "iframe", "ins", "kbd", "label", "legend",
- "li", "noframes", "noscript", "object", "p", "pre", "q", "s", "samp",
- "small", "span", "strike", "strong", "td", "th", "tt", "u", "var"
-};
-
-/**
- * areBlanks:
- * @ctxt: an HTML parser context
- * @str: a xmlChar *
- * @len: the size of @str
- *
- * Is this a sequence of blank chars that one can ignore ?
- *
- * Returns 1 if ignorable 0 otherwise.
- */
-
-static int areBlanks(htmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
- unsigned int i;
- int j;
- xmlNodePtr lastChild;
-
- for (j = 0;j < len;j++)
- if (!(IS_BLANK(str[j]))) return(0);
-
- if (CUR == 0) return(1);
- if (CUR != '<') return(0);
- if (ctxt->name == NULL)
- return(1);
- if (xmlStrEqual(ctxt->name, BAD_CAST"html"))
- return(1);
- if (xmlStrEqual(ctxt->name, BAD_CAST"head"))
- return(1);
- if (xmlStrEqual(ctxt->name, BAD_CAST"body"))
- return(1);
- if (ctxt->node == NULL) return(0);
- lastChild = xmlGetLastChild(ctxt->node);
- if (lastChild == NULL) {
- if ((ctxt->node->type != XML_ELEMENT_NODE) &&
- (ctxt->node->content != NULL)) return(0);
- /* keep ws in constructs like ...<b> </b>...
- for all tags "b" allowing PCDATA */
- for ( i = 0; i < sizeof(allowPCData)/sizeof(allowPCData[0]); i++ ) {
- if ( xmlStrEqual(ctxt->name, BAD_CAST allowPCData[i]) ) {
- return(0);
- }
- }
- } else if (xmlNodeIsText(lastChild)) {
- return(0);
- } else {
- /* keep ws in constructs like <p><b>xy</b> <i>z</i><p>
- for all tags "p" allowing PCDATA */
- for ( i = 0; i < sizeof(allowPCData)/sizeof(allowPCData[0]); i++ ) {
- if ( xmlStrEqual(lastChild->name, BAD_CAST allowPCData[i]) ) {
- return(0);
- }
- }
- }
- return(1);
-}
-
-/**
- * htmlNewDocNoDtD:
- * @URI: URI for the dtd, or NULL
- * @ExternalID: the external ID of the DTD, or NULL
- *
- * Creates a new HTML document without a DTD node if @URI and @ExternalID
- * are NULL
- *
- * Returns a new document, do not initialize the DTD if not provided
- */
-htmlDocPtr
-htmlNewDocNoDtD(const xmlChar *URI, const xmlChar *ExternalID) {
- xmlDocPtr cur;
-
- /*
- * Allocate a new document and fill the fields.
- */
- cur = (xmlDocPtr) xmlMalloc(sizeof(xmlDoc));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "htmlNewDocNoDtD : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlDoc));
-
- cur->type = XML_HTML_DOCUMENT_NODE;
- cur->version = NULL;
- cur->intSubset = NULL;
- cur->doc = cur;
- cur->name = NULL;
- cur->children = NULL;
- cur->extSubset = NULL;
- cur->oldNs = NULL;
- cur->encoding = NULL;
- cur->standalone = 1;
- cur->compression = 0;
- cur->ids = NULL;
- cur->refs = NULL;
- cur->_private = NULL;
- if ((ExternalID != NULL) ||
- (URI != NULL))
- xmlCreateIntSubset(cur, BAD_CAST "HTML", ExternalID, URI);
- return(cur);
-}
-
-/**
- * htmlNewDoc:
- * @URI: URI for the dtd, or NULL
- * @ExternalID: the external ID of the DTD, or NULL
- *
- * Creates a new HTML document
- *
- * Returns a new document
- */
-htmlDocPtr
-htmlNewDoc(const xmlChar *URI, const xmlChar *ExternalID) {
- if ((URI == NULL) && (ExternalID == NULL))
- return(htmlNewDocNoDtD(
- BAD_CAST "http://www.w3.org/TR/REC-html40/loose.dtd",
- BAD_CAST "-//W3C//DTD HTML 4.0 Transitional//EN"));
-
- return(htmlNewDocNoDtD(URI, ExternalID));
-}
-
-
-/************************************************************************
- * *
- * The parser itself *
- * Relates to http://www.w3.org/TR/html40 *
- * *
- ************************************************************************/
-
-/************************************************************************
- * *
- * The parser itself *
- * *
- ************************************************************************/
-
-/**
- * htmlParseHTMLName:
- * @ctxt: an HTML parser context
- *
- * parse an HTML tag or attribute name, note that we convert it to lowercase
- * since HTML names are not case-sensitive.
- *
- * Returns the Tag Name parsed or NULL
- */
-
-static xmlChar *
-htmlParseHTMLName(htmlParserCtxtPtr ctxt) {
- xmlChar *ret = NULL;
- int i = 0;
- xmlChar loc[HTML_PARSER_BUFFER_SIZE];
-
- if (!IS_LETTER(CUR) && (CUR != '_') &&
- (CUR != ':')) return(NULL);
-
- while ((i < HTML_PARSER_BUFFER_SIZE) &&
- ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) ||
- (CUR == ':') || (CUR == '-') || (CUR == '_'))) {
- if ((CUR >= 'A') && (CUR <= 'Z')) loc[i] = CUR + 0x20;
- else loc[i] = CUR;
- i++;
-
- NEXT;
- }
-
- ret = xmlStrndup(loc, i);
-
- return(ret);
-}
-
-/**
- * htmlParseName:
- * @ctxt: an HTML parser context
- *
- * parse an HTML name, this routine is case sensitive.
- *
- * Returns the Name parsed or NULL
- */
-
-static xmlChar *
-htmlParseName(htmlParserCtxtPtr ctxt) {
- xmlChar buf[HTML_MAX_NAMELEN];
- int len = 0;
-
- GROW;
- if (!IS_LETTER(CUR) && (CUR != '_')) {
- return(NULL);
- }
-
- while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) ||
- (CUR == '.') || (CUR == '-') ||
- (CUR == '_') || (CUR == ':') ||
- (IS_COMBINING(CUR)) ||
- (IS_EXTENDER(CUR))) {
- buf[len++] = CUR;
- NEXT;
- if (len >= HTML_MAX_NAMELEN) {
- xmlGenericError(xmlGenericErrorContext,
- "htmlParseName: reached HTML_MAX_NAMELEN limit\n");
- while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) ||
- (CUR == '.') || (CUR == '-') ||
- (CUR == '_') || (CUR == ':') ||
- (IS_COMBINING(CUR)) ||
- (IS_EXTENDER(CUR)))
- NEXT;
- break;
- }
- }
- return(xmlStrndup(buf, len));
-}
-
-/**
- * htmlParseHTMLAttribute:
- * @ctxt: an HTML parser context
- * @stop: a char stop value
- *
- * parse an HTML attribute value till the stop (quote), if
- * stop is 0 then it stops at the first space
- *
- * Returns the attribute parsed or NULL
- */
-
-static xmlChar *
-htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
- xmlChar *buffer = NULL;
- int buffer_size = 0;
- xmlChar *out = NULL;
- xmlChar *name = NULL;
-
- xmlChar *cur = NULL;
- const htmlEntityDesc * ent;
-
- /*
- * allocate a translation buffer.
- */
- buffer_size = HTML_PARSER_BUFFER_SIZE;
- buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
- if (buffer == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "htmlParseHTMLAttribute: malloc failed\n");
- return(NULL);
- }
- out = buffer;
-
- /*
- * Ok loop until we reach one of the ending chars
- */
- while ((CUR != 0) && (CUR != stop)) {
- if ((stop == 0) && (CUR == '>')) break;
- if ((stop == 0) && (IS_BLANK(CUR))) break;
- if (CUR == '&') {
- if (NXT(1) == '#') {
- unsigned int c;
- int bits;
-
- c = htmlParseCharRef(ctxt);
- if (c < 0x80)
- { *out++ = c; bits= -6; }
- else if (c < 0x800)
- { *out++ =((c >> 6) & 0x1F) | 0xC0; bits= 0; }
- else if (c < 0x10000)
- { *out++ =((c >> 12) & 0x0F) | 0xE0; bits= 6; }
- else
- { *out++ =((c >> 18) & 0x07) | 0xF0; bits= 12; }
-
- for ( ; bits >= 0; bits-= 6) {
- *out++ = ((c >> bits) & 0x3F) | 0x80;
- }
-
- if (out - buffer > buffer_size - 100) {
- int indx = out - buffer;
-
- growBuffer(buffer);
- out = &buffer[indx];
- }
- } else {
- ent = htmlParseEntityRef(ctxt, &name);
- if (name == NULL) {
- *out++ = '&';
- if (out - buffer > buffer_size - 100) {
- int indx = out - buffer;
-
- growBuffer(buffer);
- out = &buffer[indx];
- }
- } else if (ent == NULL) {
- *out++ = '&';
- cur = name;
- while (*cur != 0) {
- if (out - buffer > buffer_size - 100) {
- int indx = out - buffer;
-
- growBuffer(buffer);
- out = &buffer[indx];
- }
- *out++ = *cur++;
- }
- xmlFree(name);
- } else {
- unsigned int c;
- int bits;
-
- if (out - buffer > buffer_size - 100) {
- int indx = out - buffer;
-
- growBuffer(buffer);
- out = &buffer[indx];
- }
- c = (xmlChar)ent->value;
- if (c < 0x80)
- { *out++ = c; bits= -6; }
- else if (c < 0x800)
- { *out++ =((c >> 6) & 0x1F) | 0xC0; bits= 0; }
- else if (c < 0x10000)
- { *out++ =((c >> 12) & 0x0F) | 0xE0; bits= 6; }
- else
- { *out++ =((c >> 18) & 0x07) | 0xF0; bits= 12; }
-
- for ( ; bits >= 0; bits-= 6) {
- *out++ = ((c >> bits) & 0x3F) | 0x80;
- }
- xmlFree(name);
- }
- }
- } else {
- unsigned int c;
- int bits, l;
-
- if (out - buffer > buffer_size - 100) {
- int indx = out - buffer;
-
- growBuffer(buffer);
- out = &buffer[indx];
- }
- c = CUR_CHAR(l);
- if (c < 0x80)
- { *out++ = c; bits= -6; }
- else if (c < 0x800)
- { *out++ =((c >> 6) & 0x1F) | 0xC0; bits= 0; }
- else if (c < 0x10000)
- { *out++ =((c >> 12) & 0x0F) | 0xE0; bits= 6; }
- else
- { *out++ =((c >> 18) & 0x07) | 0xF0; bits= 12; }
-
- for ( ; bits >= 0; bits-= 6) {
- *out++ = ((c >> bits) & 0x3F) | 0x80;
- }
- NEXT;
- }
- }
- *out++ = 0;
- return(buffer);
-}
-
-/**
- * htmlParseEntityRef:
- * @ctxt: an HTML parser context
- * @str: location to store the entity name
- *
- * parse an HTML ENTITY references
- *
- * [68] EntityRef ::= '&' Name ';'
- *
- * Returns the associated htmlEntityDescPtr if found, or NULL otherwise,
- * if non-NULL *str will have to be freed by the caller.
- */
-const htmlEntityDesc *
-htmlParseEntityRef(htmlParserCtxtPtr ctxt, xmlChar **str) {
- xmlChar *name;
- const htmlEntityDesc * ent = NULL;
- *str = NULL;
-
- if (CUR == '&') {
- NEXT;
- name = htmlParseName(ctxt);
- if (name == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "htmlParseEntityRef: no name\n");
- ctxt->wellFormed = 0;
- } else {
- GROW;
- if (CUR == ';') {
- *str = name;
-
- /*
- * Lookup the entity in the table.
- */
- ent = htmlEntityLookup(name);
- if (ent != NULL) /* OK that's ugly !!! */
- NEXT;
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "htmlParseEntityRef: expecting ';'\n");
- *str = name;
- }
- }
- }
- return(ent);
-}
-
-/**
- * htmlParseAttValue:
- * @ctxt: an HTML parser context
- *
- * parse a value for an attribute
- * Note: the parser won't do substitution of entities here, this
- * will be handled later in xmlStringGetNodeList, unless it was
- * asked for ctxt->replaceEntities != 0
- *
- * Returns the AttValue parsed or NULL.
- */
-
-static xmlChar *
-htmlParseAttValue(htmlParserCtxtPtr ctxt) {
- xmlChar *ret = NULL;
-
- if (CUR == '"') {
- NEXT;
- ret = htmlParseHTMLAttribute(ctxt, '"');
- if (CUR != '"') {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "AttValue: ' expected\n");
- ctxt->wellFormed = 0;
- } else
- NEXT;
- } else if (CUR == '\'') {
- NEXT;
- ret = htmlParseHTMLAttribute(ctxt, '\'');
- if (CUR != '\'') {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "AttValue: ' expected\n");
- ctxt->wellFormed = 0;
- } else
- NEXT;
- } else {
- /*
- * That's an HTMLism, the attribute value may not be quoted
- */
- ret = htmlParseHTMLAttribute(ctxt, 0);
- if (ret == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "AttValue: no value found\n");
- ctxt->wellFormed = 0;
- }
- }
- return(ret);
-}
-
-/**
- * htmlParseSystemLiteral:
- * @ctxt: an HTML parser context
- *
- * parse an HTML Literal
- *
- * [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")
- *
- * Returns the SystemLiteral parsed or NULL
- */
-
-static xmlChar *
-htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) {
- const xmlChar *q;
- xmlChar *ret = NULL;
-
- if (CUR == '"') {
- NEXT;
- q = CUR_PTR;
- while ((IS_CHAR(CUR)) && (CUR != '"'))
- NEXT;
- if (!IS_CHAR(CUR)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Unfinished SystemLiteral\n");
- ctxt->wellFormed = 0;
- } else {
- ret = xmlStrndup(q, CUR_PTR - q);
- NEXT;
- }
- } else if (CUR == '\'') {
- NEXT;
- q = CUR_PTR;
- while ((IS_CHAR(CUR)) && (CUR != '\''))
- NEXT;
- if (!IS_CHAR(CUR)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Unfinished SystemLiteral\n");
- ctxt->wellFormed = 0;
- } else {
- ret = xmlStrndup(q, CUR_PTR - q);
- NEXT;
- }
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "SystemLiteral \" or ' expected\n");
- ctxt->wellFormed = 0;
- }
-
- return(ret);
-}
-
-/**
- * htmlParsePubidLiteral:
- * @ctxt: an HTML parser context
- *
- * parse an HTML public literal
- *
- * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
- *
- * Returns the PubidLiteral parsed or NULL.
- */
-
-static xmlChar *
-htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) {
- const xmlChar *q;
- xmlChar *ret = NULL;
- /*
- * Name ::= (Letter | '_') (NameChar)*
- */
- if (CUR == '"') {
- NEXT;
- q = CUR_PTR;
- while (IS_PUBIDCHAR(CUR)) NEXT;
- if (CUR != '"') {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Unfinished PubidLiteral\n");
- ctxt->wellFormed = 0;
- } else {
- ret = xmlStrndup(q, CUR_PTR - q);
- NEXT;
- }
- } else if (CUR == '\'') {
- NEXT;
- q = CUR_PTR;
- while ((IS_LETTER(CUR)) && (CUR != '\''))
- NEXT;
- if (!IS_LETTER(CUR)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Unfinished PubidLiteral\n");
- ctxt->wellFormed = 0;
- } else {
- ret = xmlStrndup(q, CUR_PTR - q);
- NEXT;
- }
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "SystemLiteral \" or ' expected\n");
- ctxt->wellFormed = 0;
- }
-
- return(ret);
-}
-
-/**
- * htmlParseScript:
- * @ctxt: an HTML parser context
- *
- * parse the content of an HTML SCRIPT or STYLE element
- * http://www.w3.org/TR/html4/sgml/dtd.html#Script
- * http://www.w3.org/TR/html4/sgml/dtd.html#StyleSheet
- * http://www.w3.org/TR/html4/types.html#type-script
- * http://www.w3.org/TR/html4/types.html#h-6.15
- * http://www.w3.org/TR/html4/appendix/notes.html#h-B.3.2.1
- *
- * Script data ( %Script; in the DTD) can be the content of the SCRIPT
- * element and the value of intrinsic event attributes. User agents must
- * not evaluate script data as HTML markup but instead must pass it on as
- * data to a script engine.
- * NOTES:
- * - The content is passed like CDATA
- * - the attributes for style and scripting "onXXX" are also described
- * as CDATA but SGML allows entities references in attributes so their
- * processing is identical as other attributes
- */
-static void
-htmlParseScript(htmlParserCtxtPtr ctxt) {
- xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 1];
- int nbchar = 0;
- xmlChar cur;
-
- SHRINK;
- cur = CUR;
- while (IS_CHAR(cur)) {
- if ((cur == '<') && (NXT(1) == '!') && (NXT(2) == '-') &&
- (NXT(3) == '-')) {
- if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) {
- if (ctxt->sax->cdataBlock!= NULL) {
- /*
- * Insert as CDATA, which is the same as HTML_PRESERVE_NODE
- */
- ctxt->sax->cdataBlock(ctxt->userData, buf, nbchar);
- }
- }
- nbchar = 0;
- htmlParseComment(ctxt);
- cur = CUR;
- continue;
- } else if ((cur == '<') && (NXT(1) == '/')) {
- /*
- * One should break here, the specification is clear:
- * Authors should therefore escape "</" within the content.
- * Escape mechanisms are specific to each scripting or
- * style sheet language.
- */
- if (((NXT(2) >= 'A') && (NXT(2) <= 'Z')) ||
- ((NXT(2) >= 'a') && (NXT(2) <= 'z')))
- break; /* while */
- }
- buf[nbchar++] = cur;
- if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) {
- if (ctxt->sax->cdataBlock!= NULL) {
- /*
- * Insert as CDATA, which is the same as HTML_PRESERVE_NODE
- */
- ctxt->sax->cdataBlock(ctxt->userData, buf, nbchar);
- }
- nbchar = 0;
- }
- NEXT;
- cur = CUR;
- }
- if (!(IS_CHAR(cur))) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Invalid char in CDATA 0x%X\n", cur);
- ctxt->wellFormed = 0;
- NEXT;
- }
-
- if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) {
- if (ctxt->sax->cdataBlock!= NULL) {
- /*
- * Insert as CDATA, which is the same as HTML_PRESERVE_NODE
- */
- ctxt->sax->cdataBlock(ctxt->userData, buf, nbchar);
- }
- }
-}
-
-
-/**
- * htmlParseCharData:
- * @ctxt: an HTML parser context
- *
- * parse a CharData section.
- * if we are within a CDATA section ']]>' marks an end of section.
- *
- * [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)
- */
-
-static void
-htmlParseCharData(htmlParserCtxtPtr ctxt) {
- xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 5];
- int nbchar = 0;
- int cur, l;
-
- SHRINK;
- cur = CUR_CHAR(l);
- while (((cur != '<') || (ctxt->token == '<')) &&
- ((cur != '&') || (ctxt->token == '&')) &&
- (IS_CHAR(cur))) {
- COPY_BUF(l,buf,nbchar,cur);
- if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) {
- /*
- * Ok the segment is to be consumed as chars.
- */
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) {
- if (areBlanks(ctxt, buf, nbchar)) {
- if (ctxt->sax->ignorableWhitespace != NULL)
- ctxt->sax->ignorableWhitespace(ctxt->userData,
- buf, nbchar);
- } else {
- htmlCheckParagraph(ctxt);
- if (ctxt->sax->characters != NULL)
- ctxt->sax->characters(ctxt->userData, buf, nbchar);
- }
- }
- nbchar = 0;
- }
- NEXTL(l);
- cur = CUR_CHAR(l);
- }
- if (nbchar != 0) {
- /*
- * Ok the segment is to be consumed as chars.
- */
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) {
- if (areBlanks(ctxt, buf, nbchar)) {
- if (ctxt->sax->ignorableWhitespace != NULL)
- ctxt->sax->ignorableWhitespace(ctxt->userData, buf, nbchar);
- } else {
- htmlCheckParagraph(ctxt);
- if (ctxt->sax->characters != NULL)
- ctxt->sax->characters(ctxt->userData, buf, nbchar);
- }
- }
- } else {
- /*
- * Loop detection
- */
- if (cur == 0)
- ctxt->instate = XML_PARSER_EOF;
- }
-}
-
-/**
- * htmlParseExternalID:
- * @ctxt: an HTML parser context
- * @publicID: a xmlChar** receiving PubidLiteral
- *
- * Parse an External ID or a Public ID
- *
- * [75] ExternalID ::= 'SYSTEM' S SystemLiteral
- * | 'PUBLIC' S PubidLiteral S SystemLiteral
- *
- * [83] PublicID ::= 'PUBLIC' S PubidLiteral
- *
- * Returns the function returns SystemLiteral and in the second
- * case publicID receives PubidLiteral, is strict is off
- * it is possible to return NULL and have publicID set.
- */
-
-static xmlChar *
-htmlParseExternalID(htmlParserCtxtPtr ctxt, xmlChar **publicID) {
- xmlChar *URI = NULL;
-
- if ((UPPER == 'S') && (UPP(1) == 'Y') &&
- (UPP(2) == 'S') && (UPP(3) == 'T') &&
- (UPP(4) == 'E') && (UPP(5) == 'M')) {
- SKIP(6);
- if (!IS_BLANK(CUR)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after 'SYSTEM'\n");
- ctxt->wellFormed = 0;
- }
- SKIP_BLANKS;
- URI = htmlParseSystemLiteral(ctxt);
- if (URI == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "htmlParseExternalID: SYSTEM, no URI\n");
- ctxt->wellFormed = 0;
- }
- } else if ((UPPER == 'P') && (UPP(1) == 'U') &&
- (UPP(2) == 'B') && (UPP(3) == 'L') &&
- (UPP(4) == 'I') && (UPP(5) == 'C')) {
- SKIP(6);
- if (!IS_BLANK(CUR)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after 'PUBLIC'\n");
- ctxt->wellFormed = 0;
- }
- SKIP_BLANKS;
- *publicID = htmlParsePubidLiteral(ctxt);
- if (*publicID == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "htmlParseExternalID: PUBLIC, no Public Identifier\n");
- ctxt->wellFormed = 0;
- }
- SKIP_BLANKS;
- if ((CUR == '"') || (CUR == '\'')) {
- URI = htmlParseSystemLiteral(ctxt);
- }
- }
- return(URI);
-}
-
-/**
- * htmlParseComment:
- * @ctxt: an HTML parser context
- *
- * Parse an XML (SGML) comment <!-- .... -->
- *
- * [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
- */
-static void
-htmlParseComment(htmlParserCtxtPtr ctxt) {
- xmlChar *buf = NULL;
- int len;
- int size = HTML_PARSER_BUFFER_SIZE;
- int q, ql;
- int r, rl;
- int cur, l;
- xmlParserInputState state;
-
- /*
- * Check that there is a comment right here.
- */
- if ((RAW != '<') || (NXT(1) != '!') ||
- (NXT(2) != '-') || (NXT(3) != '-')) return;
-
- state = ctxt->instate;
- ctxt->instate = XML_PARSER_COMMENT;
- SHRINK;
- SKIP(4);
- buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", size);
- ctxt->instate = state;
- return;
- }
- q = CUR_CHAR(ql);
- NEXTL(ql);
- r = CUR_CHAR(rl);
- NEXTL(rl);
- cur = CUR_CHAR(l);
- len = 0;
- while (IS_CHAR(cur) &&
- ((cur != '>') ||
- (r != '-') || (q != '-'))) {
- if (len + 5 >= size) {
- size *= 2;
- buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %d byte failed\n", size);
- ctxt->instate = state;
- return;
- }
- }
- COPY_BUF(ql,buf,len,q);
- q = r;
- ql = rl;
- r = cur;
- rl = l;
- NEXTL(l);
- cur = CUR_CHAR(l);
- if (cur == 0) {
- SHRINK;
- GROW;
- cur = CUR_CHAR(l);
- }
- }
- buf[len] = 0;
- if (!IS_CHAR(cur)) {
- ctxt->errNo = XML_ERR_COMMENT_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Comment not terminated \n<!--%.50s\n", buf);
- ctxt->wellFormed = 0;
- xmlFree(buf);
- } else {
- NEXT;
- if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) &&
- (!ctxt->disableSAX))
- ctxt->sax->comment(ctxt->userData, buf);
- xmlFree(buf);
- }
- ctxt->instate = state;
-}
-
-/**
- * htmlParseCharRef:
- * @ctxt: an HTML parser context
- *
- * parse Reference declarations
- *
- * [66] CharRef ::= '&#' [0-9]+ ';' |
- * '&#x' [0-9a-fA-F]+ ';'
- *
- * Returns the value parsed (as an int)
- */
-int
-htmlParseCharRef(htmlParserCtxtPtr ctxt) {
- int val = 0;
-
- if ((CUR == '&') && (NXT(1) == '#') &&
- (NXT(2) == 'x')) {
- SKIP(3);
- while (CUR != ';') {
- if ((CUR >= '0') && (CUR <= '9'))
- val = val * 16 + (CUR - '0');
- else if ((CUR >= 'a') && (CUR <= 'f'))
- val = val * 16 + (CUR - 'a') + 10;
- else if ((CUR >= 'A') && (CUR <= 'F'))
- val = val * 16 + (CUR - 'A') + 10;
- else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "htmlParseCharRef: invalid hexadecimal value\n");
- ctxt->wellFormed = 0;
- return(0);
- }
- NEXT;
- }
- if (CUR == ';')
- NEXT;
- } else if ((CUR == '&') && (NXT(1) == '#')) {
- SKIP(2);
- while (CUR != ';') {
- if ((CUR >= '0') && (CUR <= '9'))
- val = val * 10 + (CUR - '0');
- else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "htmlParseCharRef: invalid decimal value\n");
- ctxt->wellFormed = 0;
- return(0);
- }
- NEXT;
- }
- if (CUR == ';')
- NEXT;
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "htmlParseCharRef: invalid value\n");
- ctxt->wellFormed = 0;
- }
- /*
- * Check the value IS_CHAR ...
- */
- if (IS_CHAR(val)) {
- return(val);
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "htmlParseCharRef: invalid xmlChar value %d\n",
- val);
- ctxt->wellFormed = 0;
- }
- return(0);
-}
-
-
-/**
- * htmlParseDocTypeDecl:
- * @ctxt: an HTML parser context
- *
- * parse a DOCTYPE declaration
- *
- * [28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S?
- * ('[' (markupdecl | PEReference | S)* ']' S?)? '>'
- */
-
-static void
-htmlParseDocTypeDecl(htmlParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlChar *ExternalID = NULL;
- xmlChar *URI = NULL;
-
- /*
- * We know that '<!DOCTYPE' has been detected.
- */
- SKIP(9);
-
- SKIP_BLANKS;
-
- /*
- * Parse the DOCTYPE name.
- */
- name = htmlParseName(ctxt);
- if (name == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "htmlParseDocTypeDecl : no DOCTYPE name !\n");
- ctxt->wellFormed = 0;
- }
- /*
- * Check that upper(name) == "HTML" !!!!!!!!!!!!!
- */
-
- SKIP_BLANKS;
-
- /*
- * Check for SystemID and ExternalID
- */
- URI = htmlParseExternalID(ctxt, &ExternalID);
- SKIP_BLANKS;
-
- /*
- * We should be at the end of the DOCTYPE declaration.
- */
- if (CUR != '>') {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "DOCTYPE improperly terminated\n");
- ctxt->wellFormed = 0;
- /* We shouldn't try to resynchronize ... */
- }
- NEXT;
-
- /*
- * Create or update the document accordingly to the DOCTYPE
- */
- if ((ctxt->sax != NULL) && (ctxt->sax->internalSubset != NULL) &&
- (!ctxt->disableSAX))
- ctxt->sax->internalSubset(ctxt->userData, name, ExternalID, URI);
-
- /*
- * Cleanup, since we don't use all those identifiers
- */
- if (URI != NULL) xmlFree(URI);
- if (ExternalID != NULL) xmlFree(ExternalID);
- if (name != NULL) xmlFree(name);
-}
-
-/**
- * htmlParseAttribute:
- * @ctxt: an HTML parser context
- * @value: a xmlChar ** used to store the value of the attribute
- *
- * parse an attribute
- *
- * [41] Attribute ::= Name Eq AttValue
- *
- * [25] Eq ::= S? '=' S?
- *
- * With namespace:
- *
- * [NS 11] Attribute ::= QName Eq AttValue
- *
- * Also the case QName == xmlns:??? is handled independently as a namespace
- * definition.
- *
- * Returns the attribute name, and the value in *value.
- */
-
-static xmlChar *
-htmlParseAttribute(htmlParserCtxtPtr ctxt, xmlChar **value) {
- xmlChar *name, *val = NULL;
-
- *value = NULL;
- name = htmlParseHTMLName(ctxt);
- if (name == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "error parsing attribute name\n");
- ctxt->wellFormed = 0;
- return(NULL);
- }
-
- /*
- * read the value
- */
- SKIP_BLANKS;
- if (CUR == '=') {
- NEXT;
- SKIP_BLANKS;
- val = htmlParseAttValue(ctxt);
- /******
- } else {
- * TODO : some attribute must have values, some may not
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->warning(ctxt->userData,
- "No value for attribute %s\n", name); */
- }
-
- *value = val;
- return(name);
-}
-
-/**
- * htmlCheckEncoding:
- * @ctxt: an HTML parser context
- * @attvalue: the attribute value
- *
- * Checks an http-equiv attribute from a Meta tag to detect
- * the encoding
- * If a new encoding is detected the parser is switched to decode
- * it and pass UTF8
- */
-static void
-htmlCheckEncoding(htmlParserCtxtPtr ctxt, const xmlChar *attvalue) {
- const xmlChar *encoding;
-
- if ((ctxt == NULL) || (attvalue == NULL))
- return;
-
- /* do not change encoding */
- if (ctxt->input->encoding != NULL)
- return;
-
- encoding = xmlStrcasestr(attvalue, BAD_CAST"charset=");
- if (encoding != NULL) {
- encoding += 8;
- } else {
- encoding = xmlStrcasestr(attvalue, BAD_CAST"charset =");
- if (encoding != NULL)
- encoding += 9;
- }
- if (encoding != NULL) {
- xmlCharEncoding enc;
- xmlCharEncodingHandlerPtr handler;
-
- while ((*encoding == ' ') || (*encoding == '\t')) encoding++;
-
- if (ctxt->input->encoding != NULL)
- xmlFree((xmlChar *) ctxt->input->encoding);
- ctxt->input->encoding = xmlStrdup(encoding);
-
- enc = xmlParseCharEncoding((const char *) encoding);
- /*
- * registered set of known encodings
- */
- if (enc != XML_CHAR_ENCODING_ERROR) {
- xmlSwitchEncoding(ctxt, enc);
- ctxt->charset = XML_CHAR_ENCODING_UTF8;
- } else {
- /*
- * fallback for unknown encodings
- */
- handler = xmlFindCharEncodingHandler((const char *) encoding);
- if (handler != NULL) {
- xmlSwitchToEncoding(ctxt, handler);
- ctxt->charset = XML_CHAR_ENCODING_UTF8;
- } else {
- ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
- }
- }
-
- if ((ctxt->input->buf != NULL) &&
- (ctxt->input->buf->encoder != NULL) &&
- (ctxt->input->buf->raw != NULL) &&
- (ctxt->input->buf->buffer != NULL)) {
- int nbchars;
- int processed;
-
- /*
- * convert as much as possible to the parser reading buffer.
- */
- processed = ctxt->input->cur - ctxt->input->base;
- xmlBufferShrink(ctxt->input->buf->buffer, processed);
- nbchars = xmlCharEncInFunc(ctxt->input->buf->encoder,
- ctxt->input->buf->buffer,
- ctxt->input->buf->raw);
- if (nbchars < 0) {
- ctxt->errNo = XML_ERR_INVALID_ENCODING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "htmlCheckEncoding: encoder error\n");
- }
- ctxt->input->base =
- ctxt->input->cur = ctxt->input->buf->buffer->content;
- }
- }
-}
-
-/**
- * htmlCheckMeta:
- * @ctxt: an HTML parser context
- * @atts: the attributes values
- *
- * Checks an attributes from a Meta tag
- */
-static void
-htmlCheckMeta(htmlParserCtxtPtr ctxt, const xmlChar **atts) {
- int i;
- const xmlChar *att, *value;
- int http = 0;
- const xmlChar *content = NULL;
-
- if ((ctxt == NULL) || (atts == NULL))
- return;
-
- i = 0;
- att = atts[i++];
- while (att != NULL) {
- value = atts[i++];
- if ((value != NULL) && (!xmlStrcasecmp(att, BAD_CAST"http-equiv"))
- && (!xmlStrcasecmp(value, BAD_CAST"Content-Type")))
- http = 1;
- else if ((value != NULL) && (!xmlStrcasecmp(att, BAD_CAST"content")))
- content = value;
- att = atts[i++];
- }
- if ((http) && (content != NULL))
- htmlCheckEncoding(ctxt, content);
-
-}
-
-/**
- * htmlParseStartTag:
- * @ctxt: an HTML parser context
- *
- * parse a start of tag either for rule element or
- * EmptyElement. In both case we don't parse the tag closing chars.
- *
- * [40] STag ::= '<' Name (S Attribute)* S? '>'
- *
- * [44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>'
- *
- * With namespace:
- *
- * [NS 8] STag ::= '<' QName (S Attribute)* S? '>'
- *
- * [NS 10] EmptyElement ::= '<' QName (S Attribute)* S? '/>'
- *
- */
-
-static void
-htmlParseStartTag(htmlParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlChar *attname;
- xmlChar *attvalue;
- const xmlChar **atts = NULL;
- int nbatts = 0;
- int maxatts = 0;
- int meta = 0;
- int i;
-
- if (CUR != '<') return;
- NEXT;
-
- GROW;
- name = htmlParseHTMLName(ctxt);
- if (name == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "htmlParseStartTag: invalid element name\n");
- ctxt->wellFormed = 0;
- /* Dump the bogus tag like browsers do */
- while ((IS_CHAR(CUR)) && (CUR != '>'))
- NEXT;
- return;
- }
- if (xmlStrEqual(name, BAD_CAST"meta"))
- meta = 1;
-
- /*
- * Check for auto-closure of HTML elements.
- */
- htmlAutoClose(ctxt, name);
-
- /*
- * Check for implied HTML elements.
- */
- htmlCheckImplied(ctxt, name);
-
- /*
- * Avoid html at any level > 0, head at any level != 1
- * or any attempt to recurse body
- */
- if ((ctxt->nameNr > 0) && (xmlStrEqual(name, BAD_CAST"html"))) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "htmlParseStartTag: misplaced <html> tag\n");
- ctxt->wellFormed = 0;
- xmlFree(name);
- return;
- }
- if ((ctxt->nameNr != 1) &&
- (xmlStrEqual(name, BAD_CAST"head"))) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "htmlParseStartTag: misplaced <head> tag\n");
- ctxt->wellFormed = 0;
- xmlFree(name);
- return;
- }
- if (xmlStrEqual(name, BAD_CAST"body")) {
- int indx;
- for (indx = 0;indx < ctxt->nameNr;indx++) {
- if (xmlStrEqual(ctxt->nameTab[indx], BAD_CAST"body")) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "htmlParseStartTag: misplaced <body> tag\n");
- ctxt->wellFormed = 0;
- xmlFree(name);
- return;
- }
- }
- }
-
- /*
- * Now parse the attributes, it ends up with the ending
- *
- * (S Attribute)* S?
- */
- SKIP_BLANKS;
- while ((IS_CHAR(CUR)) &&
- (CUR != '>') &&
- ((CUR != '/') || (NXT(1) != '>'))) {
- long cons = ctxt->nbChars;
-
- GROW;
- attname = htmlParseAttribute(ctxt, &attvalue);
- if (attname != NULL) {
-
- /*
- * Well formedness requires at most one declaration of an attribute
- */
- for (i = 0; i < nbatts;i += 2) {
- if (xmlStrEqual(atts[i], attname)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Attribute %s redefined\n",
- attname);
- ctxt->wellFormed = 0;
- xmlFree(attname);
- if (attvalue != NULL)
- xmlFree(attvalue);
- goto failed;
- }
- }
-
- /*
- * Add the pair to atts
- */
- if (atts == NULL) {
- maxatts = 10;
- atts = (const xmlChar **) xmlMalloc(maxatts * sizeof(xmlChar *));
- if (atts == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %ld byte failed\n",
- maxatts * (long)sizeof(xmlChar *));
- if (name != NULL) xmlFree(name);
- return;
- }
- } else if (nbatts + 4 > maxatts) {
- maxatts *= 2;
- atts = (const xmlChar **) xmlRealloc((void *) atts,
- maxatts * sizeof(xmlChar *));
- if (atts == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %ld byte failed\n",
- maxatts * (long)sizeof(xmlChar *));
- if (name != NULL) xmlFree(name);
- return;
- }
- }
- atts[nbatts++] = attname;
- atts[nbatts++] = attvalue;
- atts[nbatts] = NULL;
- atts[nbatts + 1] = NULL;
- }
- else {
- /* Dump the bogus attribute string up to the next blank or
- * the end of the tag. */
- while ((IS_CHAR(CUR)) && !(IS_BLANK(CUR)) && (CUR != '>')
- && ((CUR != '/') || (NXT(1) != '>')))
- NEXT;
- }
-
-failed:
- SKIP_BLANKS;
- if (cons == ctxt->nbChars) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "htmlParseStartTag: problem parsing attributes\n");
- ctxt->wellFormed = 0;
- break;
- }
- }
-
- /*
- * Handle specific association to the META tag
- */
- if (meta)
- htmlCheckMeta(ctxt, atts);
-
- /*
- * SAX: Start of Element !
- */
- htmlnamePush(ctxt, xmlStrdup(name));
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"Start of element %s: pushed %s\n", name, ctxt->name);
-#endif
- if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL))
- ctxt->sax->startElement(ctxt->userData, name, atts);
-
- if (atts != NULL) {
- for (i = 0;i < nbatts;i++) {
- if (atts[i] != NULL)
- xmlFree((xmlChar *) atts[i]);
- }
- xmlFree((void *) atts);
- }
- if (name != NULL) xmlFree(name);
-}
-
-/**
- * htmlParseEndTag:
- * @ctxt: an HTML parser context
- *
- * parse an end of tag
- *
- * [42] ETag ::= '</' Name S? '>'
- *
- * With namespace
- *
- * [NS 9] ETag ::= '</' QName S? '>'
- *
- * Returns 1 if the current level should be closed.
- */
-
-static int
-htmlParseEndTag(htmlParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlChar *oldname;
- int i, ret;
-
- if ((CUR != '<') || (NXT(1) != '/')) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "htmlParseEndTag: '</' not found\n");
- ctxt->wellFormed = 0;
- return(0);
- }
- SKIP(2);
-
- name = htmlParseHTMLName(ctxt);
- if (name == NULL) return(0);
-
- /*
- * We should definitely be at the ending "S? '>'" part
- */
- SKIP_BLANKS;
- if ((!IS_CHAR(CUR)) || (CUR != '>')) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "End tag : expected '>'\n");
- ctxt->wellFormed = 0;
- } else
- NEXT;
-
- /*
- * If the name read is not one of the element in the parsing stack
- * then return, it's just an error.
- */
- for (i = (ctxt->nameNr - 1);i >= 0;i--) {
- if (xmlStrEqual(name, ctxt->nameTab[i])) break;
- }
- if (i < 0) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Unexpected end tag : %s\n", name);
- xmlFree(name);
- ctxt->wellFormed = 0;
- return(0);
- }
-
-
- /*
- * Check for auto-closure of HTML elements.
- */
-
- htmlAutoCloseOnClose(ctxt, name);
-
- /*
- * Well formedness constraints, opening and closing must match.
- * With the exception that the autoclose may have popped stuff out
- * of the stack.
- */
- if (!xmlStrEqual(name, ctxt->name)) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of tag %s: expecting %s\n", name, ctxt->name);
-#endif
- if ((ctxt->name != NULL) &&
- (!xmlStrEqual(ctxt->name, name))) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Opening and ending tag mismatch: %s and %s\n",
- name, ctxt->name);
- ctxt->wellFormed = 0;
- }
- }
-
- /*
- * SAX: End of Tag
- */
- oldname = ctxt->name;
- if ((oldname != NULL) && (xmlStrEqual(oldname, name))) {
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, name);
- oldname = htmlnamePop(ctxt);
- if (oldname != NULL) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of tag %s: popping out %s\n", name, oldname);
-#endif
- xmlFree(oldname);
-#ifdef DEBUG
- } else {
- xmlGenericError(xmlGenericErrorContext,"End of tag %s: stack empty !!!\n", name);
-#endif
- }
- ret = 1;
- } else {
- ret = 0;
- }
-
- if (name != NULL)
- xmlFree(name);
-
- return(ret);
-}
-
-
-/**
- * htmlParseReference:
- * @ctxt: an HTML parser context
- *
- * parse and handle entity references in content,
- * this will end-up in a call to character() since this is either a
- * CharRef, or a predefined entity.
- */
-static void
-htmlParseReference(htmlParserCtxtPtr ctxt) {
- const htmlEntityDesc * ent;
- xmlChar out[6];
- xmlChar *name;
- if (CUR != '&') return;
-
- if (NXT(1) == '#') {
- unsigned int c;
- int bits, i = 0;
-
- c = htmlParseCharRef(ctxt);
- if (c == 0)
- return;
-
- if (c < 0x80) { out[i++]= c; bits= -6; }
- else if (c < 0x800) { out[i++]=((c >> 6) & 0x1F) | 0xC0; bits= 0; }
- else if (c < 0x10000) { out[i++]=((c >> 12) & 0x0F) | 0xE0; bits= 6; }
- else { out[i++]=((c >> 18) & 0x07) | 0xF0; bits= 12; }
-
- for ( ; bits >= 0; bits-= 6) {
- out[i++]= ((c >> bits) & 0x3F) | 0x80;
- }
- out[i] = 0;
-
- htmlCheckParagraph(ctxt);
- if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
- ctxt->sax->characters(ctxt->userData, out, i);
- } else {
- ent = htmlParseEntityRef(ctxt, &name);
- if (name == NULL) {
- htmlCheckParagraph(ctxt);
- if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
- ctxt->sax->characters(ctxt->userData, BAD_CAST "&", 1);
- return;
- }
- if ((ent == NULL) || !(ent->value > 0)) {
- htmlCheckParagraph(ctxt);
- if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) {
- ctxt->sax->characters(ctxt->userData, BAD_CAST "&", 1);
- ctxt->sax->characters(ctxt->userData, name, xmlStrlen(name));
- /* ctxt->sax->characters(ctxt->userData, BAD_CAST ";", 1); */
- }
- } else {
- unsigned int c;
- int bits, i = 0;
-
- c = ent->value;
- if (c < 0x80)
- { out[i++]= c; bits= -6; }
- else if (c < 0x800)
- { out[i++]=((c >> 6) & 0x1F) | 0xC0; bits= 0; }
- else if (c < 0x10000)
- { out[i++]=((c >> 12) & 0x0F) | 0xE0; bits= 6; }
- else
- { out[i++]=((c >> 18) & 0x07) | 0xF0; bits= 12; }
-
- for ( ; bits >= 0; bits-= 6) {
- out[i++]= ((c >> bits) & 0x3F) | 0x80;
- }
- out[i] = 0;
-
- htmlCheckParagraph(ctxt);
- if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
- ctxt->sax->characters(ctxt->userData, out, i);
- }
- xmlFree(name);
- }
-}
-
-/**
- * htmlParseContent:
- * @ctxt: an HTML parser context
- * @name: the node name
- *
- * Parse a content: comment, sub-element, reference or text.
- *
- */
-
-static void
-htmlParseContent(htmlParserCtxtPtr ctxt) {
- xmlChar *currentNode;
- int depth;
-
- currentNode = xmlStrdup(ctxt->name);
- depth = ctxt->nameNr;
- while (1) {
- long cons = ctxt->nbChars;
-
- GROW;
- /*
- * Our tag or one of it's parent or children is ending.
- */
- if ((CUR == '<') && (NXT(1) == '/')) {
- if (htmlParseEndTag(ctxt) &&
- ((currentNode != NULL) || (ctxt->nameNr == 0))) {
- if (currentNode != NULL)
- xmlFree(currentNode);
- return;
- }
- continue; /* while */
- }
-
- /*
- * Has this node been popped out during parsing of
- * the next element
- */
- if ((ctxt->nameNr > 0) && (depth >= ctxt->nameNr) &&
- (!xmlStrEqual(currentNode, ctxt->name)))
- {
- if (currentNode != NULL) xmlFree(currentNode);
- return;
- }
-
- if ((CUR != 0) && ((xmlStrEqual(currentNode, BAD_CAST"script")) ||
- (xmlStrEqual(currentNode, BAD_CAST"style")))) {
- /*
- * Handle SCRIPT/STYLE separately
- */
- htmlParseScript(ctxt);
- } else {
- /*
- * Sometimes DOCTYPE arrives in the middle of the document
- */
- if ((CUR == '<') && (NXT(1) == '!') &&
- (UPP(2) == 'D') && (UPP(3) == 'O') &&
- (UPP(4) == 'C') && (UPP(5) == 'T') &&
- (UPP(6) == 'Y') && (UPP(7) == 'P') &&
- (UPP(8) == 'E')) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Misplaced DOCTYPE declaration\n");
- ctxt->wellFormed = 0;
- htmlParseDocTypeDecl(ctxt);
- }
-
- /*
- * First case : a comment
- */
- if ((CUR == '<') && (NXT(1) == '!') &&
- (NXT(2) == '-') && (NXT(3) == '-')) {
- htmlParseComment(ctxt);
- }
-
- /*
- * Second case : a sub-element.
- */
- else if (CUR == '<') {
- htmlParseElement(ctxt);
- }
-
- /*
- * Third case : a reference. If if has not been resolved,
- * parsing returns it's Name, create the node
- */
- else if (CUR == '&') {
- htmlParseReference(ctxt);
- }
-
- /*
- * Fourth : end of the resource
- */
- else if (CUR == 0) {
- htmlAutoCloseOnEnd(ctxt);
- break;
- }
-
- /*
- * Last case, text. Note that References are handled directly.
- */
- else {
- htmlParseCharData(ctxt);
- }
-
- if (cons == ctxt->nbChars) {
- if (ctxt->node != NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "detected an error in element content\n");
- ctxt->wellFormed = 0;
- }
- break;
- }
- }
- GROW;
- }
- if (currentNode != NULL) xmlFree(currentNode);
-}
-
-/**
- * htmlParseElement:
- * @ctxt: an HTML parser context
- *
- * parse an HTML element, this is highly recursive
- *
- * [39] element ::= EmptyElemTag | STag content ETag
- *
- * [41] Attribute ::= Name Eq AttValue
- */
-
-void
-htmlParseElement(htmlParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlChar *currentNode = NULL;
- const htmlElemDesc * info;
- htmlParserNodeInfo node_info;
- xmlChar *oldname;
- int depth = ctxt->nameNr;
- const xmlChar *oldptr;
-
- /* Capture start position */
- if (ctxt->record_info) {
- node_info.begin_pos = ctxt->input->consumed +
- (CUR_PTR - ctxt->input->base);
- node_info.begin_line = ctxt->input->line;
- }
-
- oldname = xmlStrdup(ctxt->name);
- htmlParseStartTag(ctxt);
- name = ctxt->name;
-#ifdef DEBUG
- if (oldname == NULL)
- xmlGenericError(xmlGenericErrorContext,
- "Start of element %s\n", name);
- else if (name == NULL)
- xmlGenericError(xmlGenericErrorContext,
- "Start of element failed, was %s\n", oldname);
- else
- xmlGenericError(xmlGenericErrorContext,
- "Start of element %s, was %s\n", name, oldname);
-#endif
- if (((depth == ctxt->nameNr) && (xmlStrEqual(oldname, ctxt->name))) ||
- (name == NULL)) {
- if (CUR == '>')
- NEXT;
- if (oldname != NULL)
- xmlFree(oldname);
- return;
- }
- if (oldname != NULL)
- xmlFree(oldname);
-
- /*
- * Lookup the info for that element.
- */
- info = htmlTagLookup(name);
- if (info == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Tag %s invalid\n",
- name);
- ctxt->wellFormed = 0;
- } else if (info->depr) {
-/***************************
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData, "Tag %s is deprecated\n",
- name);
- ***************************/
- }
-
- /*
- * Check for an Empty Element labeled the XML/SGML way
- */
- if ((CUR == '/') && (NXT(1) == '>')) {
- SKIP(2);
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, name);
- oldname = htmlnamePop(ctxt);
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of tag the XML way: popping out %s\n", oldname);
-#endif
- if (oldname != NULL)
- xmlFree(oldname);
- return;
- }
-
- if (CUR == '>') {
- NEXT;
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Couldn't find end of Start Tag %s\n",
- name);
- ctxt->wellFormed = 0;
-
- /*
- * end of parsing of this node.
- */
- if (xmlStrEqual(name, ctxt->name)) {
- nodePop(ctxt);
- oldname = htmlnamePop(ctxt);
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of start tag problem: popping out %s\n", oldname);
-#endif
- if (oldname != NULL)
- xmlFree(oldname);
- }
-
- /*
- * Capture end position and add node
- */
- if ( currentNode != NULL && ctxt->record_info ) {
- node_info.end_pos = ctxt->input->consumed +
- (CUR_PTR - ctxt->input->base);
- node_info.end_line = ctxt->input->line;
- node_info.node = ctxt->node;
- xmlParserAddNodeInfo(ctxt, &node_info);
- }
- return;
- }
-
- /*
- * Check for an Empty Element from DTD definition
- */
- if ((info != NULL) && (info->empty)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, name);
- oldname = htmlnamePop(ctxt);
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of empty tag %s : popping out %s\n", name, oldname);
-#endif
- if (oldname != NULL)
- xmlFree(oldname);
- return;
- }
-
- /*
- * Parse the content of the element:
- */
- currentNode = xmlStrdup(ctxt->name);
- depth = ctxt->nameNr;
- while (IS_CHAR(CUR)) {
- oldptr = ctxt->input->cur;
- htmlParseContent(ctxt);
- if (oldptr==ctxt->input->cur) break;
- if (ctxt->nameNr < depth) break;
- }
-
- /*
- * Capture end position and add node
- */
- if ( currentNode != NULL && ctxt->record_info ) {
- node_info.end_pos = ctxt->input->consumed +
- (CUR_PTR - ctxt->input->base);
- node_info.end_line = ctxt->input->line;
- node_info.node = ctxt->node;
- xmlParserAddNodeInfo(ctxt, &node_info);
- }
- if (!IS_CHAR(CUR)) {
- htmlAutoCloseOnEnd(ctxt);
- }
-
- if (currentNode != NULL)
- xmlFree(currentNode);
-}
-
-/**
- * htmlParseDocument:
- * @ctxt: an HTML parser context
- *
- * parse an HTML document (and build a tree if using the standard SAX
- * interface).
- *
- * Returns 0, -1 in case of error. the parser context is augmented
- * as a result of the parsing.
- */
-
-int
-htmlParseDocument(htmlParserCtxtPtr ctxt) {
- xmlDtdPtr dtd;
-
- xmlInitParser();
-
- htmlDefaultSAXHandlerInit();
- ctxt->html = 1;
-
- GROW;
- /*
- * SAX: beginning of the document processing.
- */
- if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
- ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator);
-
- /*
- * Wipe out everything which is before the first '<'
- */
- SKIP_BLANKS;
- if (CUR == 0) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Document is empty\n");
- ctxt->wellFormed = 0;
- }
-
- if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX))
- ctxt->sax->startDocument(ctxt->userData);
-
-
- /*
- * Parse possible comments before any content
- */
- while ((CUR == '<') && (NXT(1) == '!') &&
- (NXT(2) == '-') && (NXT(3) == '-')) {
- htmlParseComment(ctxt);
- SKIP_BLANKS;
- }
-
-
- /*
- * Then possibly doc type declaration(s) and more Misc
- * (doctypedecl Misc*)?
- */
- if ((CUR == '<') && (NXT(1) == '!') &&
- (UPP(2) == 'D') && (UPP(3) == 'O') &&
- (UPP(4) == 'C') && (UPP(5) == 'T') &&
- (UPP(6) == 'Y') && (UPP(7) == 'P') &&
- (UPP(8) == 'E')) {
- htmlParseDocTypeDecl(ctxt);
- }
- SKIP_BLANKS;
-
- /*
- * Parse possible comments before any content
- */
- while ((CUR == '<') && (NXT(1) == '!') &&
- (NXT(2) == '-') && (NXT(3) == '-')) {
- htmlParseComment(ctxt);
- SKIP_BLANKS;
- }
-
- /*
- * Time to start parsing the tree itself
- */
- htmlParseContent(ctxt);
-
- /*
- * autoclose
- */
- if (CUR == 0)
- htmlAutoCloseOnEnd(ctxt);
-
-
- /*
- * SAX: end of the document processing.
- */
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
-
- if (ctxt->myDoc != NULL) {
- dtd = xmlGetIntSubset(ctxt->myDoc);
- if (dtd == NULL)
- ctxt->myDoc->intSubset =
- xmlCreateIntSubset(ctxt->myDoc, BAD_CAST "HTML",
- BAD_CAST "-//W3C//DTD HTML 4.0 Transitional//EN",
- BAD_CAST "http://www.w3.org/TR/REC-html40/loose.dtd");
- }
- if (! ctxt->wellFormed) return(-1);
- return(0);
-}
-
-
-/************************************************************************
- * *
- * Parser contexts handling *
- * *
- ************************************************************************/
-
-/**
- * xmlInitParserCtxt:
- * @ctxt: an HTML parser context
- *
- * Initialize a parser context
- */
-
-static void
-htmlInitParserCtxt(htmlParserCtxtPtr ctxt)
-{
- htmlSAXHandler *sax;
-
- if (ctxt == NULL) return;
- memset(ctxt, 0, sizeof(htmlParserCtxt));
-
- sax = (htmlSAXHandler *) xmlMalloc(sizeof(htmlSAXHandler));
- if (sax == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "htmlInitParserCtxt: out of memory\n");
- }
- else
- memset(sax, 0, sizeof(htmlSAXHandler));
-
- /* Allocate the Input stack */
- ctxt->inputTab = (htmlParserInputPtr *)
- xmlMalloc(5 * sizeof(htmlParserInputPtr));
- if (ctxt->inputTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "htmlInitParserCtxt: out of memory\n");
- ctxt->inputNr = 0;
- ctxt->inputMax = 0;
- ctxt->input = NULL;
- return;
- }
- ctxt->inputNr = 0;
- ctxt->inputMax = 5;
- ctxt->input = NULL;
- ctxt->version = NULL;
- ctxt->encoding = NULL;
- ctxt->standalone = -1;
- ctxt->instate = XML_PARSER_START;
-
- /* Allocate the Node stack */
- ctxt->nodeTab = (htmlNodePtr *) xmlMalloc(10 * sizeof(htmlNodePtr));
- if (ctxt->nodeTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "htmlInitParserCtxt: out of memory\n");
- ctxt->nodeNr = 0;
- ctxt->nodeMax = 0;
- ctxt->node = NULL;
- ctxt->inputNr = 0;
- ctxt->inputMax = 0;
- ctxt->input = NULL;
- return;
- }
- ctxt->nodeNr = 0;
- ctxt->nodeMax = 10;
- ctxt->node = NULL;
-
- /* Allocate the Name stack */
- ctxt->nameTab = (xmlChar **) xmlMalloc(10 * sizeof(xmlChar *));
- if (ctxt->nameTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "htmlInitParserCtxt: out of memory\n");
- ctxt->nameNr = 0;
- ctxt->nameMax = 10;
- ctxt->name = NULL;
- ctxt->nodeNr = 0;
- ctxt->nodeMax = 0;
- ctxt->node = NULL;
- ctxt->inputNr = 0;
- ctxt->inputMax = 0;
- ctxt->input = NULL;
- return;
- }
- ctxt->nameNr = 0;
- ctxt->nameMax = 10;
- ctxt->name = NULL;
-
- if (sax == NULL) ctxt->sax = &htmlDefaultSAXHandler;
- else {
- ctxt->sax = sax;
- memcpy(sax, &htmlDefaultSAXHandler, sizeof(htmlSAXHandler));
- }
- ctxt->userData = ctxt;
- ctxt->myDoc = NULL;
- ctxt->wellFormed = 1;
- ctxt->replaceEntities = 0;
- ctxt->linenumbers = xmlLineNumbersDefaultValue;
- ctxt->html = 1;
- ctxt->record_info = 0;
- ctxt->validate = 0;
- ctxt->nbChars = 0;
- ctxt->checkIndex = 0;
- ctxt->catalogs = NULL;
- xmlInitNodeInfoSeq(&ctxt->node_seq);
-}
-
-/**
- * htmlFreeParserCtxt:
- * @ctxt: an HTML parser context
- *
- * Free all the memory used by a parser context. However the parsed
- * document in ctxt->myDoc is not freed.
- */
-
-void
-htmlFreeParserCtxt(htmlParserCtxtPtr ctxt)
-{
- xmlFreeParserCtxt(ctxt);
-}
-
-/**
- * htmlNewParserCtxt:
- *
- * Allocate and initialize a new parser context.
- *
- * Returns the xmlParserCtxtPtr or NULL
- */
-
-static htmlParserCtxtPtr
-htmlNewParserCtxt(void)
-{
- xmlParserCtxtPtr ctxt;
-
- ctxt = (xmlParserCtxtPtr) xmlMalloc(sizeof(xmlParserCtxt));
- if (ctxt == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewParserCtxt : cannot allocate context\n");
- return(NULL);
- }
- memset(ctxt, 0, sizeof(xmlParserCtxt));
- htmlInitParserCtxt(ctxt);
- return(ctxt);
-}
-
-/**
- * htmlCreateMemoryParserCtxt:
- * @buffer: a pointer to a char array
- * @size: the size of the array
- *
- * Create a parser context for an HTML in-memory document.
- *
- * Returns the new parser context or NULL
- */
-static htmlParserCtxtPtr
-htmlCreateMemoryParserCtxt(const char *buffer, int size) {
- xmlParserCtxtPtr ctxt;
- xmlParserInputPtr input;
- xmlParserInputBufferPtr buf;
-
- if (buffer == NULL)
- return(NULL);
- if (size <= 0)
- return(NULL);
-
- ctxt = htmlNewParserCtxt();
- if (ctxt == NULL)
- return(NULL);
-
- buf = xmlParserInputBufferCreateMem(buffer, size, XML_CHAR_ENCODING_NONE);
- if (buf == NULL) return(NULL);
-
- input = xmlNewInputStream(ctxt);
- if (input == NULL) {
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
-
- input->filename = NULL;
- input->buf = buf;
- input->base = input->buf->buffer->content;
- input->cur = input->buf->buffer->content;
- input->end = &input->buf->buffer->content[input->buf->buffer->use];
-
- inputPush(ctxt, input);
- return(ctxt);
-}
-
-/**
- * htmlCreateDocParserCtxt:
- * @cur: a pointer to an array of xmlChar
- * @encoding: a free form C string describing the HTML document encoding, or NULL
- *
- * Create a parser context for an HTML document.
- *
- * TODO: check the need to add encoding handling there
- *
- * Returns the new parser context or NULL
- */
-static htmlParserCtxtPtr
-htmlCreateDocParserCtxt(xmlChar *cur, const char *encoding ATTRIBUTE_UNUSED) {
- int len;
-
- if (cur == NULL)
- return(NULL);
- len = xmlStrlen(cur);
- return(htmlCreateMemoryParserCtxt((char *)cur, len));
-}
-
-/************************************************************************
- * *
- * Progressive parsing interfaces *
- * *
- ************************************************************************/
-
-/**
- * htmlParseLookupSequence:
- * @ctxt: an HTML parser context
- * @first: the first char to lookup
- * @next: the next char to lookup or zero
- * @third: the next char to lookup or zero
- *
- * Try to find if a sequence (first, next, third) or just (first next) or
- * (first) is available in the input stream.
- * This function has a side effect of (possibly) incrementing ctxt->checkIndex
- * to avoid rescanning sequences of bytes, it DOES change the state of the
- * parser, do not use liberally.
- * This is basically similar to xmlParseLookupSequence()
- *
- * Returns the index to the current parsing point if the full sequence
- * is available, -1 otherwise.
- */
-static int
-htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
- xmlChar next, xmlChar third) {
- int base, len;
- htmlParserInputPtr in;
- const xmlChar *buf;
- int incomment = 0;
-
- in = ctxt->input;
- if (in == NULL) return(-1);
- base = in->cur - in->base;
- if (base < 0) return(-1);
- if (ctxt->checkIndex > base)
- base = ctxt->checkIndex;
- if (in->buf == NULL) {
- buf = in->base;
- len = in->length;
- } else {
- buf = in->buf->buffer->content;
- len = in->buf->buffer->use;
- }
- /* take into account the sequence length */
- if (third) len -= 2;
- else if (next) len --;
- for (;base < len;base++) {
- if (!incomment && (base + 4 < len)) {
- if ((buf[base] == '<') && (buf[base + 1] == '!') &&
- (buf[base + 2] == '-') && (buf[base + 3] == '-')) {
- incomment = 1;
- }
- /* do not increment base, some people use <!--> */
- }
- if (incomment) {
- if (base + 3 < len)
- return(-1);
- if ((buf[base] == '-') && (buf[base + 1] == '-') &&
- (buf[base + 2] == '>')) {
- incomment = 0;
- base += 2;
- }
- continue;
- }
- if (buf[base] == first) {
- if (third != 0) {
- if ((buf[base + 1] != next) ||
- (buf[base + 2] != third)) continue;
- } else if (next != 0) {
- if (buf[base + 1] != next) continue;
- }
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- if (next == 0)
- xmlGenericError(xmlGenericErrorContext,
- "HPP: lookup '%c' found at %d\n",
- first, base);
- else if (third == 0)
- xmlGenericError(xmlGenericErrorContext,
- "HPP: lookup '%c%c' found at %d\n",
- first, next, base);
- else
- xmlGenericError(xmlGenericErrorContext,
- "HPP: lookup '%c%c%c' found at %d\n",
- first, next, third, base);
-#endif
- return(base - (in->cur - in->base));
- }
- }
- ctxt->checkIndex = base;
-#ifdef DEBUG_PUSH
- if (next == 0)
- xmlGenericError(xmlGenericErrorContext,
- "HPP: lookup '%c' failed\n", first);
- else if (third == 0)
- xmlGenericError(xmlGenericErrorContext,
- "HPP: lookup '%c%c' failed\n", first, next);
- else
- xmlGenericError(xmlGenericErrorContext,
- "HPP: lookup '%c%c%c' failed\n", first, next, third);
-#endif
- return(-1);
-}
-
-/**
- * htmlParseTryOrFinish:
- * @ctxt: an HTML parser context
- * @terminate: last chunk indicator
- *
- * Try to progress on parsing
- *
- * Returns zero if no parsing was possible
- */
-static int
-htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
- int ret = 0;
- htmlParserInputPtr in;
- int avail = 0;
- xmlChar cur, next;
-
-#ifdef DEBUG_PUSH
- switch (ctxt->instate) {
- case XML_PARSER_EOF:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try EOF\n"); break;
- case XML_PARSER_START:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try START\n"); break;
- case XML_PARSER_MISC:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try MISC\n");break;
- case XML_PARSER_COMMENT:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try COMMENT\n");break;
- case XML_PARSER_PROLOG:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try PROLOG\n");break;
- case XML_PARSER_START_TAG:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try START_TAG\n");break;
- case XML_PARSER_CONTENT:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try CONTENT\n");break;
- case XML_PARSER_CDATA_SECTION:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try CDATA_SECTION\n");break;
- case XML_PARSER_END_TAG:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try END_TAG\n");break;
- case XML_PARSER_ENTITY_DECL:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try ENTITY_DECL\n");break;
- case XML_PARSER_ENTITY_VALUE:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try ENTITY_VALUE\n");break;
- case XML_PARSER_ATTRIBUTE_VALUE:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try ATTRIBUTE_VALUE\n");break;
- case XML_PARSER_DTD:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try DTD\n");break;
- case XML_PARSER_EPILOG:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try EPILOG\n");break;
- case XML_PARSER_PI:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try PI\n");break;
- case XML_PARSER_SYSTEM_LITERAL:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: try SYSTEM_LITERAL\n");break;
- }
-#endif
-
- while (1) {
-
- in = ctxt->input;
- if (in == NULL) break;
- if (in->buf == NULL)
- avail = in->length - (in->cur - in->base);
- else
- avail = in->buf->buffer->use - (in->cur - in->base);
- if ((avail == 0) && (terminate)) {
- htmlAutoCloseOnEnd(ctxt);
- if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) {
- /*
- * SAX: end of the document processing.
- */
- ctxt->instate = XML_PARSER_EOF;
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
- }
- }
- if (avail < 1)
- goto done;
- switch (ctxt->instate) {
- case XML_PARSER_EOF:
- /*
- * Document parsing is done !
- */
- goto done;
- case XML_PARSER_START:
- /*
- * Very first chars read from the document flow.
- */
- cur = in->cur[0];
- if (IS_BLANK(cur)) {
- SKIP_BLANKS;
- if (in->buf == NULL)
- avail = in->length - (in->cur - in->base);
- else
- avail = in->buf->buffer->use - (in->cur - in->base);
- }
- if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
- ctxt->sax->setDocumentLocator(ctxt->userData,
- &xmlDefaultSAXLocator);
- if ((ctxt->sax) && (ctxt->sax->startDocument) &&
- (!ctxt->disableSAX))
- ctxt->sax->startDocument(ctxt->userData);
-
- cur = in->cur[0];
- next = in->cur[1];
- if ((cur == '<') && (next == '!') &&
- (UPP(2) == 'D') && (UPP(3) == 'O') &&
- (UPP(4) == 'C') && (UPP(5) == 'T') &&
- (UPP(6) == 'Y') && (UPP(7) == 'P') &&
- (UPP(8) == 'E')) {
- if ((!terminate) &&
- (htmlParseLookupSequence(ctxt, '>', 0, 0) < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing internal subset\n");
-#endif
- htmlParseDocTypeDecl(ctxt);
- ctxt->instate = XML_PARSER_PROLOG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering PROLOG\n");
-#endif
- } else {
- ctxt->instate = XML_PARSER_MISC;
- }
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering MISC\n");
-#endif
- break;
- case XML_PARSER_MISC:
- SKIP_BLANKS;
- if (in->buf == NULL)
- avail = in->length - (in->cur - in->base);
- else
- avail = in->buf->buffer->use - (in->cur - in->base);
- if (avail < 2)
- goto done;
- cur = in->cur[0];
- next = in->cur[1];
- if ((cur == '<') && (next == '!') &&
- (in->cur[2] == '-') && (in->cur[3] == '-')) {
- if ((!terminate) &&
- (htmlParseLookupSequence(ctxt, '-', '-', '>') < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing Comment\n");
-#endif
- htmlParseComment(ctxt);
- ctxt->instate = XML_PARSER_MISC;
- } else if ((cur == '<') && (next == '!') &&
- (UPP(2) == 'D') && (UPP(3) == 'O') &&
- (UPP(4) == 'C') && (UPP(5) == 'T') &&
- (UPP(6) == 'Y') && (UPP(7) == 'P') &&
- (UPP(8) == 'E')) {
- if ((!terminate) &&
- (htmlParseLookupSequence(ctxt, '>', 0, 0) < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing internal subset\n");
-#endif
- htmlParseDocTypeDecl(ctxt);
- ctxt->instate = XML_PARSER_PROLOG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering PROLOG\n");
-#endif
- } else if ((cur == '<') && (next == '!') &&
- (avail < 9)) {
- goto done;
- } else {
- ctxt->instate = XML_PARSER_START_TAG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering START_TAG\n");
-#endif
- }
- break;
- case XML_PARSER_PROLOG:
- SKIP_BLANKS;
- if (in->buf == NULL)
- avail = in->length - (in->cur - in->base);
- else
- avail = in->buf->buffer->use - (in->cur - in->base);
- if (avail < 2)
- goto done;
- cur = in->cur[0];
- next = in->cur[1];
- if ((cur == '<') && (next == '!') &&
- (in->cur[2] == '-') && (in->cur[3] == '-')) {
- if ((!terminate) &&
- (htmlParseLookupSequence(ctxt, '-', '-', '>') < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing Comment\n");
-#endif
- htmlParseComment(ctxt);
- ctxt->instate = XML_PARSER_PROLOG;
- } else if ((cur == '<') && (next == '!') &&
- (avail < 4)) {
- goto done;
- } else {
- ctxt->instate = XML_PARSER_START_TAG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering START_TAG\n");
-#endif
- }
- break;
- case XML_PARSER_EPILOG:
- if (in->buf == NULL)
- avail = in->length - (in->cur - in->base);
- else
- avail = in->buf->buffer->use - (in->cur - in->base);
- if (avail < 1)
- goto done;
- cur = in->cur[0];
- if (IS_BLANK(cur)) {
- htmlParseCharData(ctxt);
- goto done;
- }
- if (avail < 2)
- goto done;
- next = in->cur[1];
- if ((cur == '<') && (next == '!') &&
- (in->cur[2] == '-') && (in->cur[3] == '-')) {
- if ((!terminate) &&
- (htmlParseLookupSequence(ctxt, '-', '-', '>') < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing Comment\n");
-#endif
- htmlParseComment(ctxt);
- ctxt->instate = XML_PARSER_EPILOG;
- } else if ((cur == '<') && (next == '!') &&
- (avail < 4)) {
- goto done;
- } else {
- ctxt->errNo = XML_ERR_DOCUMENT_END;
- ctxt->wellFormed = 0;
- ctxt->instate = XML_PARSER_EOF;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering EOF\n");
-#endif
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
- goto done;
- }
- break;
- case XML_PARSER_START_TAG: {
- xmlChar *name, *oldname;
- int depth = ctxt->nameNr;
- const htmlElemDesc * info;
-
- if (avail < 2)
- goto done;
- cur = in->cur[0];
- if (cur != '<') {
- ctxt->instate = XML_PARSER_CONTENT;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- }
- if (in->cur[1] == '/') {
- ctxt->instate = XML_PARSER_END_TAG;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering END_TAG\n");
-#endif
- break;
- }
- if ((!terminate) &&
- (htmlParseLookupSequence(ctxt, '>', 0, 0) < 0))
- goto done;
-
- oldname = xmlStrdup(ctxt->name);
- htmlParseStartTag(ctxt);
- name = ctxt->name;
-#ifdef DEBUG
- if (oldname == NULL)
- xmlGenericError(xmlGenericErrorContext,
- "Start of element %s\n", name);
- else if (name == NULL)
- xmlGenericError(xmlGenericErrorContext,
- "Start of element failed, was %s\n",
- oldname);
- else
- xmlGenericError(xmlGenericErrorContext,
- "Start of element %s, was %s\n",
- name, oldname);
-#endif
- if (((depth == ctxt->nameNr) &&
- (xmlStrEqual(oldname, ctxt->name))) ||
- (name == NULL)) {
- if (CUR == '>')
- NEXT;
- if (oldname != NULL)
- xmlFree(oldname);
- break;
- }
- if (oldname != NULL)
- xmlFree(oldname);
-
- /*
- * Lookup the info for that element.
- */
- info = htmlTagLookup(name);
- if (info == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Tag %s invalid\n",
- name);
- ctxt->wellFormed = 0;
- } else if (info->depr) {
- /***************************
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData,
- "Tag %s is deprecated\n",
- name);
- ***************************/
- }
-
- /*
- * Check for an Empty Element labeled the XML/SGML way
- */
- if ((CUR == '/') && (NXT(1) == '>')) {
- SKIP(2);
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, name);
- oldname = htmlnamePop(ctxt);
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of tag the XML way: popping out %s\n",
- oldname);
-#endif
- if (oldname != NULL)
- xmlFree(oldname);
- ctxt->instate = XML_PARSER_CONTENT;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- }
-
- if (CUR == '>') {
- NEXT;
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Couldn't find end of Start Tag %s\n",
- name);
- ctxt->wellFormed = 0;
-
- /*
- * end of parsing of this node.
- */
- if (xmlStrEqual(name, ctxt->name)) {
- nodePop(ctxt);
- oldname = htmlnamePop(ctxt);
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,
- "End of start tag problem: popping out %s\n", oldname);
-#endif
- if (oldname != NULL)
- xmlFree(oldname);
- }
-
- ctxt->instate = XML_PARSER_CONTENT;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- }
-
- /*
- * Check for an Empty Element from DTD definition
- */
- if ((info != NULL) && (info->empty)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, name);
- oldname = htmlnamePop(ctxt);
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,"End of empty tag %s : popping out %s\n", name, oldname);
-#endif
- if (oldname != NULL)
- xmlFree(oldname);
- }
- ctxt->instate = XML_PARSER_CONTENT;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- }
- case XML_PARSER_CONTENT: {
- long cons;
- /*
- * Handle preparsed entities and charRef
- */
- if (ctxt->token != 0) {
- xmlChar chr[2] = { 0 , 0 } ;
-
- chr[0] = (xmlChar) ctxt->token;
- htmlCheckParagraph(ctxt);
- if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
- ctxt->sax->characters(ctxt->userData, chr, 1);
- ctxt->token = 0;
- ctxt->checkIndex = 0;
- }
- if ((avail == 1) && (terminate)) {
- cur = in->cur[0];
- if ((cur != '<') && (cur != '&')) {
- if (ctxt->sax != NULL) {
- if (IS_BLANK(cur)) {
- if (ctxt->sax->ignorableWhitespace != NULL)
- ctxt->sax->ignorableWhitespace(
- ctxt->userData, &cur, 1);
- } else {
- htmlCheckParagraph(ctxt);
- if (ctxt->sax->characters != NULL)
- ctxt->sax->characters(
- ctxt->userData, &cur, 1);
- }
- }
- ctxt->token = 0;
- ctxt->checkIndex = 0;
- in->cur++;
- break;
- }
- }
- if (avail < 2)
- goto done;
- cur = in->cur[0];
- next = in->cur[1];
- cons = ctxt->nbChars;
- if ((xmlStrEqual(ctxt->name, BAD_CAST"script")) ||
- (xmlStrEqual(ctxt->name, BAD_CAST"style"))) {
- /*
- * Handle SCRIPT/STYLE separately
- */
- if ((!terminate) &&
- (htmlParseLookupSequence(ctxt, '<', '/', 0) < 0))
- goto done;
- htmlParseScript(ctxt);
- if ((cur == '<') && (next == '/')) {
- ctxt->instate = XML_PARSER_END_TAG;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering END_TAG\n");
-#endif
- break;
- }
- } else {
- /*
- * Sometimes DOCTYPE arrives in the middle of the document
- */
- if ((cur == '<') && (next == '!') &&
- (UPP(2) == 'D') && (UPP(3) == 'O') &&
- (UPP(4) == 'C') && (UPP(5) == 'T') &&
- (UPP(6) == 'Y') && (UPP(7) == 'P') &&
- (UPP(8) == 'E')) {
- if ((!terminate) &&
- (htmlParseLookupSequence(ctxt, '>', 0, 0) < 0))
- goto done;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Misplaced DOCTYPE declaration\n");
- ctxt->wellFormed = 0;
- htmlParseDocTypeDecl(ctxt);
- } else if ((cur == '<') && (next == '!') &&
- (in->cur[2] == '-') && (in->cur[3] == '-')) {
- if ((!terminate) &&
- (htmlParseLookupSequence(ctxt, '-', '-', '>') < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing Comment\n");
-#endif
- htmlParseComment(ctxt);
- ctxt->instate = XML_PARSER_CONTENT;
- } else if ((cur == '<') && (next == '!') && (avail < 4)) {
- goto done;
- } else if ((cur == '<') && (next == '/')) {
- ctxt->instate = XML_PARSER_END_TAG;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering END_TAG\n");
-#endif
- break;
- } else if (cur == '<') {
- ctxt->instate = XML_PARSER_START_TAG;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering START_TAG\n");
-#endif
- break;
- } else if (cur == '&') {
- if ((!terminate) &&
- (htmlParseLookupSequence(ctxt, ';', 0, 0) < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing Reference\n");
-#endif
- /* TODO: check generation of subtrees if noent !!! */
- htmlParseReference(ctxt);
- } else {
- /* TODO Avoid the extra copy, handle directly !!!!!! */
- /*
- * Goal of the following test is:
- * - minimize calls to the SAX 'character' callback
- * when they are mergeable
- */
- if ((ctxt->inputNr == 1) &&
- (avail < HTML_PARSER_BIG_BUFFER_SIZE)) {
- if ((!terminate) &&
- (htmlParseLookupSequence(ctxt, '<', 0, 0) < 0))
- goto done;
- }
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing char data\n");
-#endif
- htmlParseCharData(ctxt);
- }
- }
- if (cons == ctxt->nbChars) {
- if (ctxt->node != NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "detected an error in element content\n");
- ctxt->wellFormed = 0;
- }
- NEXT;
- break;
- }
-
- break;
- }
- case XML_PARSER_END_TAG:
- if (avail < 2)
- goto done;
- if ((!terminate) &&
- (htmlParseLookupSequence(ctxt, '>', 0, 0) < 0))
- goto done;
- htmlParseEndTag(ctxt);
- if (ctxt->nameNr == 0) {
- ctxt->instate = XML_PARSER_EPILOG;
- } else {
- ctxt->instate = XML_PARSER_CONTENT;
- }
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_CDATA_SECTION:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == CDATA\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_DTD:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == DTD\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_COMMENT:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == COMMENT\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_PI:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == PI\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_ENTITY_DECL:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == ENTITY_DECL\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_ENTITY_VALUE:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == ENTITY_VALUE\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering DTD\n");
-#endif
- break;
- case XML_PARSER_ATTRIBUTE_VALUE:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == ATTRIBUTE_VALUE\n");
- ctxt->instate = XML_PARSER_START_TAG;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering START_TAG\n");
-#endif
- break;
- case XML_PARSER_SYSTEM_LITERAL:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == XML_PARSER_SYSTEM_LITERAL\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_IGNORE:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == XML_PARSER_IGNORE\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_PUBLIC_LITERAL:
- xmlGenericError(xmlGenericErrorContext,
- "HPP: internal error, state == XML_PARSER_LITERAL\n");
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering CONTENT\n");
-#endif
- break;
-
- }
- }
-done:
- if ((avail == 0) && (terminate)) {
- htmlAutoCloseOnEnd(ctxt);
- if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) {
- /*
- * SAX: end of the document processing.
- */
- ctxt->instate = XML_PARSER_EOF;
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
- }
- }
- if ((ctxt->myDoc != NULL) &&
- ((terminate) || (ctxt->instate == XML_PARSER_EOF) ||
- (ctxt->instate == XML_PARSER_EPILOG))) {
- xmlDtdPtr dtd;
- dtd = xmlGetIntSubset(ctxt->myDoc);
- if (dtd == NULL)
- ctxt->myDoc->intSubset =
- xmlCreateIntSubset(ctxt->myDoc, BAD_CAST "HTML",
- BAD_CAST "-//W3C//DTD HTML 4.0 Transitional//EN",
- BAD_CAST "http://www.w3.org/TR/REC-html40/loose.dtd");
- }
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext, "HPP: done %d\n", ret);
-#endif
- return(ret);
-}
-
-/**
- * htmlParseChunk:
- * @ctxt: an XML parser context
- * @chunk: an char array
- * @size: the size in byte of the chunk
- * @terminate: last chunk indicator
- *
- * Parse a Chunk of memory
- *
- * Returns zero if no error, the xmlParserErrors otherwise.
- */
-int
-htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size,
- int terminate) {
- if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) &&
- (ctxt->input->buf != NULL) && (ctxt->instate != XML_PARSER_EOF)) {
- int base = ctxt->input->base - ctxt->input->buf->buffer->content;
- int cur = ctxt->input->cur - ctxt->input->base;
-
- xmlParserInputBufferPush(ctxt->input->buf, size, chunk);
- ctxt->input->base = ctxt->input->buf->buffer->content + base;
- ctxt->input->cur = ctxt->input->base + cur;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size);
-#endif
-
- if ((terminate) || (ctxt->input->buf->buffer->use > 80))
- htmlParseTryOrFinish(ctxt, terminate);
- } else if (ctxt->instate != XML_PARSER_EOF) {
- xmlParserInputBufferPush(ctxt->input->buf, 0, "");
- htmlParseTryOrFinish(ctxt, terminate);
- }
- if (terminate) {
- if ((ctxt->instate != XML_PARSER_EOF) &&
- (ctxt->instate != XML_PARSER_EPILOG) &&
- (ctxt->instate != XML_PARSER_MISC)) {
- ctxt->errNo = XML_ERR_DOCUMENT_END;
- ctxt->wellFormed = 0;
- }
- if (ctxt->instate != XML_PARSER_EOF) {
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
- }
- ctxt->instate = XML_PARSER_EOF;
- }
- return((xmlParserErrors) ctxt->errNo);
-}
-
-/************************************************************************
- * *
- * User entry points *
- * *
- ************************************************************************/
-
-/**
- * htmlCreatePushParserCtxt:
- * @sax: a SAX handler
- * @user_data: The user data returned on SAX callbacks
- * @chunk: a pointer to an array of chars
- * @size: number of chars in the array
- * @filename: an optional file name or URI
- * @enc: an optional encoding
- *
- * Create a parser context for using the HTML parser in push mode
- * To allow content encoding detection, @size should be >= 4
- * The value of @filename is used for fetching external entities
- * and error/warning reports.
- *
- * Returns the new parser context or NULL
- */
-htmlParserCtxtPtr
-htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data,
- const char *chunk, int size, const char *filename,
- xmlCharEncoding enc) {
- htmlParserCtxtPtr ctxt;
- htmlParserInputPtr inputStream;
- xmlParserInputBufferPtr buf;
-
- xmlInitParser();
-
- buf = xmlAllocParserInputBuffer(enc);
- if (buf == NULL) return(NULL);
-
- ctxt = (htmlParserCtxtPtr) xmlMalloc(sizeof(htmlParserCtxt));
- if (ctxt == NULL) {
- xmlFree(buf);
- return(NULL);
- }
- memset(ctxt, 0, sizeof(htmlParserCtxt));
- htmlInitParserCtxt(ctxt);
- if (sax != NULL) {
- if (ctxt->sax != &htmlDefaultSAXHandler)
- xmlFree(ctxt->sax);
- ctxt->sax = (htmlSAXHandlerPtr) xmlMalloc(sizeof(htmlSAXHandler));
- if (ctxt->sax == NULL) {
- xmlFree(buf);
- xmlFree(ctxt);
- return(NULL);
- }
- memcpy(ctxt->sax, sax, sizeof(htmlSAXHandler));
- if (user_data != NULL)
- ctxt->userData = user_data;
- }
- if (filename == NULL) {
- ctxt->directory = NULL;
- } else {
- ctxt->directory = xmlParserGetDirectory(filename);
- }
-
- inputStream = htmlNewInputStream(ctxt);
- if (inputStream == NULL) {
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
-
- if (filename == NULL)
- inputStream->filename = NULL;
- else
- inputStream->filename = xmlMemStrdup(filename);
- inputStream->buf = buf;
- inputStream->base = inputStream->buf->buffer->content;
- inputStream->cur = inputStream->buf->buffer->content;
-
- inputPush(ctxt, inputStream);
-
- if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) &&
- (ctxt->input->buf != NULL)) {
- xmlParserInputBufferPush(ctxt->input->buf, size, chunk);
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size);
-#endif
- }
-
- return(ctxt);
-}
-
-/**
- * htmlSAXParseDoc:
- * @cur: a pointer to an array of xmlChar
- * @encoding: a free form C string describing the HTML document encoding, or NULL
- * @sax: the SAX handler block
- * @userData: if using SAX, this pointer will be provided on callbacks.
- *
- * Parse an HTML in-memory document. If sax is not NULL, use the SAX callbacks
- * to handle parse events. If sax is NULL, fallback to the default DOM
- * behavior and return a tree.
- *
- * Returns the resulting document tree unless SAX is NULL or the document is
- * not well formed.
- */
-
-htmlDocPtr
-htmlSAXParseDoc(xmlChar *cur, const char *encoding, htmlSAXHandlerPtr sax, void *userData) {
- htmlDocPtr ret;
- htmlParserCtxtPtr ctxt;
-
- xmlInitParser();
-
- if (cur == NULL) return(NULL);
-
-
- ctxt = htmlCreateDocParserCtxt(cur, encoding);
- if (ctxt == NULL) return(NULL);
- if (sax != NULL) {
- ctxt->sax = sax;
- ctxt->userData = userData;
- }
-
- htmlParseDocument(ctxt);
- ret = ctxt->myDoc;
- if (sax != NULL) {
- ctxt->sax = NULL;
- ctxt->userData = NULL;
- }
- htmlFreeParserCtxt(ctxt);
-
- return(ret);
-}
-
-/**
- * htmlParseDoc:
- * @cur: a pointer to an array of xmlChar
- * @encoding: a free form C string describing the HTML document encoding, or NULL
- *
- * parse an HTML in-memory document and build a tree.
- *
- * Returns the resulting document tree
- */
-
-htmlDocPtr
-htmlParseDoc(xmlChar *cur, const char *encoding) {
- return(htmlSAXParseDoc(cur, encoding, NULL, NULL));
-}
-
-
-/**
- * htmlCreateFileParserCtxt:
- * @filename: the filename
- * @encoding: a free form C string describing the HTML document encoding, or NULL
- *
- * Create a parser context for a file content.
- * Automatic support for ZLIB/Compress compressed document is provided
- * by default if found at compile-time.
- *
- * Returns the new parser context or NULL
- */
-htmlParserCtxtPtr
-htmlCreateFileParserCtxt(const char *filename, const char *encoding)
-{
- htmlParserCtxtPtr ctxt;
- htmlParserInputPtr inputStream;
- xmlParserInputBufferPtr buf;
- /* htmlCharEncoding enc; */
- xmlChar *content, *content_line = (xmlChar *) "charset=";
-
- buf = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE);
- if (buf == NULL) return(NULL);
-
- ctxt = (htmlParserCtxtPtr) xmlMalloc(sizeof(htmlParserCtxt));
- if (ctxt == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc failed\n");
- return(NULL);
- }
- memset(ctxt, 0, sizeof(htmlParserCtxt));
- htmlInitParserCtxt(ctxt);
- inputStream = (htmlParserInputPtr) xmlMalloc(sizeof(htmlParserInput));
- if (inputStream == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc failed\n");
- xmlFree(ctxt);
- return(NULL);
- }
- memset(inputStream, 0, sizeof(htmlParserInput));
-
- inputStream->filename = (char *)
- xmlNormalizeWindowsPath((xmlChar *)filename);
- inputStream->line = 1;
- inputStream->col = 1;
- inputStream->buf = buf;
- inputStream->directory = NULL;
-
- inputStream->base = inputStream->buf->buffer->content;
- inputStream->cur = inputStream->buf->buffer->content;
- inputStream->free = NULL;
-
- inputPush(ctxt, inputStream);
-
- /* set encoding */
- if (encoding) {
- content = xmlMalloc (xmlStrlen(content_line) + strlen(encoding) + 1);
- if (content) {
- strcpy ((char *)content, (char *)content_line);
- strcat ((char *)content, (char *)encoding);
- htmlCheckEncoding (ctxt, content);
- xmlFree (content);
- }
- }
-
- return(ctxt);
-}
-
-/**
- * htmlSAXParseFile:
- * @filename: the filename
- * @encoding: a free form C string describing the HTML document encoding, or NULL
- * @sax: the SAX handler block
- * @userData: if using SAX, this pointer will be provided on callbacks.
- *
- * parse an HTML file and build a tree. Automatic support for ZLIB/Compress
- * compressed document is provided by default if found at compile-time.
- * It use the given SAX function block to handle the parsing callback.
- * If sax is NULL, fallback to the default DOM tree building routines.
- *
- * Returns the resulting document tree unless SAX is NULL or the document is
- * not well formed.
- */
-
-htmlDocPtr
-htmlSAXParseFile(const char *filename, const char *encoding, htmlSAXHandlerPtr sax,
- void *userData) {
- htmlDocPtr ret;
- htmlParserCtxtPtr ctxt;
- htmlSAXHandlerPtr oldsax = NULL;
-
- xmlInitParser();
-
- ctxt = htmlCreateFileParserCtxt(filename, encoding);
- if (ctxt == NULL) return(NULL);
- if (sax != NULL) {
- oldsax = ctxt->sax;
- ctxt->sax = sax;
- ctxt->userData = userData;
- }
-
- htmlParseDocument(ctxt);
-
- ret = ctxt->myDoc;
- if (sax != NULL) {
- ctxt->sax = oldsax;
- ctxt->userData = NULL;
- }
- htmlFreeParserCtxt(ctxt);
-
- return(ret);
-}
-
-/**
- * htmlParseFile:
- * @filename: the filename
- * @encoding: a free form C string describing the HTML document encoding, or NULL
- *
- * parse an HTML file and build a tree. Automatic support for ZLIB/Compress
- * compressed document is provided by default if found at compile-time.
- *
- * Returns the resulting document tree
- */
-
-htmlDocPtr
-htmlParseFile(const char *filename, const char *encoding) {
- return(htmlSAXParseFile(filename, encoding, NULL, NULL));
-}
-
-/**
- * htmlHandleOmittedElem:
- * @val: int 0 or 1
- *
- * Set and return the previous value for handling HTML omitted tags.
- *
- * Returns the last value for 0 for no handling, 1 for auto insertion.
- */
-
-int
-htmlHandleOmittedElem(int val) {
- int old = htmlOmittedDefaultValue;
-
- htmlOmittedDefaultValue = val;
- return(old);
-}
-
-#endif /* LIBXML_HTML_ENABLED */
diff --git a/bundle/libxml/HTMLtree.c b/bundle/libxml/HTMLtree.c
deleted file mode 100644
index fe69b3dee9..0000000000
--- a/bundle/libxml/HTMLtree.c
+++ /dev/null
@@ -1,1099 +0,0 @@
-/*
- * HTMLtree.c : implementation of access function for an HTML tree.
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-
-#define IN_LIBXML
-#include "libxml.h"
-#ifdef LIBXML_HTML_ENABLED
-
-#include <string.h> /* for memset() only ! */
-
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#include <libxml/xmlmemory.h>
-#include <libxml/HTMLparser.h>
-#include <libxml/HTMLtree.h>
-#include <libxml/entities.h>
-#include <libxml/valid.h>
-#include <libxml/xmlerror.h>
-#include <libxml/parserInternals.h>
-#include <libxml/globals.h>
-#include <libxml/uri.h>
-
-/************************************************************************
- * *
- * Getting/Setting encoding meta tags *
- * *
- ************************************************************************/
-
-/**
- * htmlGetMetaEncoding:
- * @doc: the document
- *
- * Encoding definition lookup in the Meta tags
- *
- * Returns the current encoding as flagged in the HTML source
- */
-const xmlChar *
-htmlGetMetaEncoding(htmlDocPtr doc) {
- htmlNodePtr cur;
- const xmlChar *content;
- const xmlChar *encoding;
-
- if (doc == NULL)
- return(NULL);
- cur = doc->children;
-
- /*
- * Search the html
- */
- while (cur != NULL) {
- if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) {
- if (xmlStrEqual(cur->name, BAD_CAST"html"))
- break;
- if (xmlStrEqual(cur->name, BAD_CAST"head"))
- goto found_head;
- if (xmlStrEqual(cur->name, BAD_CAST"meta"))
- goto found_meta;
- }
- cur = cur->next;
- }
- if (cur == NULL)
- return(NULL);
- cur = cur->children;
-
- /*
- * Search the head
- */
- while (cur != NULL) {
- if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) {
- if (xmlStrEqual(cur->name, BAD_CAST"head"))
- break;
- if (xmlStrEqual(cur->name, BAD_CAST"meta"))
- goto found_meta;
- }
- cur = cur->next;
- }
- if (cur == NULL)
- return(NULL);
-found_head:
- cur = cur->children;
-
- /*
- * Search the meta elements
- */
-found_meta:
- while (cur != NULL) {
- if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) {
- if (xmlStrEqual(cur->name, BAD_CAST"meta")) {
- xmlAttrPtr attr = cur->properties;
- int http;
- const xmlChar *value;
-
- content = NULL;
- http = 0;
- while (attr != NULL) {
- if ((attr->children != NULL) &&
- (attr->children->type == XML_TEXT_NODE) &&
- (attr->children->next == NULL)) {
- value = attr->children->content;
- if ((!xmlStrcasecmp(attr->name, BAD_CAST"http-equiv"))
- && (!xmlStrcasecmp(value, BAD_CAST"Content-Type")))
- http = 1;
- else if ((value != NULL)
- && (!xmlStrcasecmp(attr->name, BAD_CAST"content")))
- content = value;
- if ((http != 0) && (content != NULL))
- goto found_content;
- }
- attr = attr->next;
- }
- }
- }
- cur = cur->next;
- }
- return(NULL);
-
-found_content:
- encoding = xmlStrstr(content, BAD_CAST"charset=");
- if (encoding == NULL)
- encoding = xmlStrstr(content, BAD_CAST"Charset=");
- if (encoding == NULL)
- encoding = xmlStrstr(content, BAD_CAST"CHARSET=");
- if (encoding != NULL) {
- encoding += 8;
- } else {
- encoding = xmlStrstr(content, BAD_CAST"charset =");
- if (encoding == NULL)
- encoding = xmlStrstr(content, BAD_CAST"Charset =");
- if (encoding == NULL)
- encoding = xmlStrstr(content, BAD_CAST"CHARSET =");
- if (encoding != NULL)
- encoding += 9;
- }
- if (encoding != NULL) {
- while ((*encoding == ' ') || (*encoding == '\t')) encoding++;
- }
- return(encoding);
-}
-
-/**
- * htmlSetMetaEncoding:
- * @doc: the document
- * @encoding: the encoding string
- *
- * Sets the current encoding in the Meta tags
- * NOTE: this will not change the document content encoding, just
- * the META flag associated.
- *
- * Returns 0 in case of success and -1 in case of error
- */
-int
-htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) {
- htmlNodePtr cur, meta;
- const xmlChar *content;
- char newcontent[100];
-
-
- if (doc == NULL)
- return(-1);
-
- if (encoding != NULL) {
- snprintf(newcontent, sizeof(newcontent), "text/html; charset=%s",
- encoding);
- newcontent[sizeof(newcontent) - 1] = 0;
- }
-
- cur = doc->children;
-
- /*
- * Search the html
- */
- while (cur != NULL) {
- if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) {
- if (xmlStrcasecmp(cur->name, BAD_CAST"html") == 0)
- break;
- if (xmlStrcasecmp(cur->name, BAD_CAST"head") == 0)
- goto found_head;
- if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0)
- goto found_meta;
- }
- cur = cur->next;
- }
- if (cur == NULL)
- return(-1);
- cur = cur->children;
-
- /*
- * Search the head
- */
- while (cur != NULL) {
- if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) {
- if (xmlStrcasecmp(cur->name, BAD_CAST"head") == 0)
- break;
- if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0)
- goto found_meta;
- }
- cur = cur->next;
- }
- if (cur == NULL)
- return(-1);
-found_head:
- if (cur->children == NULL) {
- if (encoding == NULL)
- return(0);
- meta = xmlNewDocNode(doc, NULL, BAD_CAST"meta", NULL);
- xmlAddChild(cur, meta);
- xmlNewProp(meta, BAD_CAST"http-equiv", BAD_CAST"Content-Type");
- xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent);
- return(0);
- }
- cur = cur->children;
-
-found_meta:
- if (encoding != NULL) {
- /*
- * Create a new Meta element with the right attributes
- */
-
- meta = xmlNewDocNode(doc, NULL, BAD_CAST"meta", NULL);
- xmlAddPrevSibling(cur, meta);
- xmlNewProp(meta, BAD_CAST"http-equiv", BAD_CAST"Content-Type");
- xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent);
- }
-
- /*
- * Search and destroy all the remaining the meta elements carrying
- * encoding informations
- */
- while (cur != NULL) {
- if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) {
- if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0) {
- xmlAttrPtr attr = cur->properties;
- int http;
- const xmlChar *value;
-
- content = NULL;
- http = 0;
- while (attr != NULL) {
- if ((attr->children != NULL) &&
- (attr->children->type == XML_TEXT_NODE) &&
- (attr->children->next == NULL)) {
- value = attr->children->content;
- if ((!xmlStrcasecmp(attr->name, BAD_CAST"http-equiv"))
- && (!xmlStrcasecmp(value, BAD_CAST"Content-Type")))
- http = 1;
- else
- {
- if ((value != NULL) &&
- (!xmlStrcasecmp(attr->name, BAD_CAST"content")))
- content = value;
- }
- if ((http != 0) && (content != NULL))
- break;
- }
- attr = attr->next;
- }
- if ((http != 0) && (content != NULL)) {
- meta = cur;
- cur = cur->next;
- xmlUnlinkNode(meta);
- xmlFreeNode(meta);
- continue;
- }
-
- }
- }
- cur = cur->next;
- }
- return(0);
-}
-
-/**
- * booleanHTMLAttrs:
- *
- * These are the HTML attributes which will be output
- * in minimized form, i.e. <option selected="selected"> will be
- * output as <option selected>, as per XSLT 1.0 16.2 "HTML Output Method"
- *
- */
-static const char* htmlBooleanAttrs[] = {
- "checked", "compact", "declare", "defer", "disabled", "ismap",
- "multiple", "nohref", "noresize", "noshade", "nowrap", "readonly",
- "selected", NULL
-};
-
-
-/**
- * htmlIsBooleanAttr:
- * @name: the name of the attribute to check
- *
- * Determine if a given attribute is a boolean attribute.
- *
- * returns: false if the attribute is not boolean, true otherwise.
- */
-int
-htmlIsBooleanAttr(const xmlChar *name)
-{
- int i = 0;
-
- while (htmlBooleanAttrs[i] != NULL) {
- if (xmlStrcasecmp((const xmlChar *)htmlBooleanAttrs[i], name) == 0)
- return 1;
- i++;
- }
- return 0;
-}
-
-/************************************************************************
- * *
- * Dumping HTML tree content to a simple buffer *
- * *
- ************************************************************************/
-
-static int
-htmlNodeDumpFormat(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
- int format);
-
-/**
- * htmlNodeDumpFormat:
- * @buf: the HTML buffer output
- * @doc: the document
- * @cur: the current node
- * @format: should formatting spaces been added
- *
- * Dump an HTML node, recursive behaviour,children are printed too.
- *
- * Returns the number of byte written or -1 in case of error
- */
-static int
-htmlNodeDumpFormat(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
- int format) {
- unsigned int use;
- int ret;
- xmlOutputBufferPtr outbuf;
-
- if (cur == NULL) {
- return (-1);
- }
- if (buf == NULL) {
- return (-1);
- }
- outbuf = (xmlOutputBufferPtr) xmlMalloc(sizeof(xmlOutputBuffer));
- if (outbuf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "htmlNodeDumpFormat: out of memory!\n");
- return (-1);
- }
- memset(outbuf, 0, (size_t) sizeof(xmlOutputBuffer));
- outbuf->buffer = buf;
- outbuf->encoder = NULL;
- outbuf->writecallback = NULL;
- outbuf->closecallback = NULL;
- outbuf->context = NULL;
- outbuf->written = 0;
-
- use = buf->use;
- htmlNodeDumpFormatOutput(outbuf, doc, cur, NULL, format);
- xmlFree(outbuf);
- ret = buf->use - use;
- return (ret);
-}
-
-/**
- * htmlNodeDump:
- * @buf: the HTML buffer output
- * @doc: the document
- * @cur: the current node
- *
- * Dump an HTML node, recursive behaviour,children are printed too,
- * and formatting returns are added.
- *
- * Returns the number of byte written or -1 in case of error
- */
-int
-htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) {
- return(htmlNodeDumpFormat(buf, doc, cur, 1));
-}
-
-/**
- * htmlNodeDumpFileFormat:
- * @out: the FILE pointer
- * @doc: the document
- * @cur: the current node
- * @encoding: the document encoding
- * @format: should formatting spaces been added
- *
- * Dump an HTML node, recursive behaviour,children are printed too.
- *
- * TODO: if encoding == NULL try to save in the doc encoding
- *
- * returns: the number of byte written or -1 in case of failure.
- */
-int
-htmlNodeDumpFileFormat(FILE *out, xmlDocPtr doc,
- xmlNodePtr cur, const char *encoding, int format) {
- xmlOutputBufferPtr buf;
- xmlCharEncodingHandlerPtr handler = NULL;
- int ret;
-
- if (encoding != NULL) {
- xmlCharEncoding enc;
-
- enc = xmlParseCharEncoding(encoding);
- if (enc != XML_CHAR_ENCODING_UTF8) {
- handler = xmlFindCharEncodingHandler(encoding);
- if (handler == NULL)
- return(-1);
- }
- }
-
- /*
- * Fallback to HTML or ASCII when the encoding is unspecified
- */
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("HTML");
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("ascii");
-
- /*
- * save the content to a temp buffer.
- */
- buf = xmlOutputBufferCreateFile(out, handler);
- if (buf == NULL) return(0);
-
- htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format);
-
- ret = xmlOutputBufferClose(buf);
- return(ret);
-}
-
-/**
- * htmlNodeDumpFile:
- * @out: the FILE pointer
- * @doc: the document
- * @cur: the current node
- *
- * Dump an HTML node, recursive behaviour,children are printed too,
- * and formatting returns are added.
- */
-void
-htmlNodeDumpFile(FILE *out, xmlDocPtr doc, xmlNodePtr cur) {
- htmlNodeDumpFileFormat(out, doc, cur, NULL, 1);
-}
-
-/**
- * htmlDocDumpMemory:
- * @cur: the document
- * @mem: OUT: the memory pointer
- * @size: OUT: the memory length
- *
- * Dump an HTML document in memory and return the xmlChar * and it's size.
- * It's up to the caller to free the memory.
- */
-void
-htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) {
- xmlOutputBufferPtr buf;
- xmlCharEncodingHandlerPtr handler = NULL;
- const char *encoding;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "htmlDocDumpMemory : document == NULL\n");
-#endif
- *mem = NULL;
- *size = 0;
- return;
- }
-
- encoding = (const char *) htmlGetMetaEncoding(cur);
-
- if (encoding != NULL) {
- xmlCharEncoding enc;
-
- enc = xmlParseCharEncoding(encoding);
- if (enc != cur->charset) {
- if (cur->charset != XML_CHAR_ENCODING_UTF8) {
- /*
- * Not supported yet
- */
- *mem = NULL;
- *size = 0;
- return;
- }
-
- handler = xmlFindCharEncodingHandler(encoding);
- if (handler == NULL) {
- *mem = NULL;
- *size = 0;
- return;
- }
- }
- }
-
- /*
- * Fallback to HTML or ASCII when the encoding is unspecified
- */
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("HTML");
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("ascii");
-
- buf = xmlAllocOutputBuffer(handler);
- if (buf == NULL) {
- *mem = NULL;
- *size = 0;
- return;
- }
-
- htmlDocContentDumpOutput(buf, cur, NULL);
- xmlOutputBufferFlush(buf);
- if (buf->conv != NULL) {
- *size = buf->conv->use;
- *mem = xmlStrndup(buf->conv->content, *size);
- } else {
- *size = buf->buffer->use;
- *mem = xmlStrndup(buf->buffer->content, *size);
- }
- (void)xmlOutputBufferClose(buf);
-}
-
-
-/************************************************************************
- * *
- * Dumping HTML tree content to an I/O output buffer *
- * *
- ************************************************************************/
-
-
-/**
- * htmlDtdDumpOutput:
- * @buf: the HTML buffer output
- * @doc: the document
- * @encoding: the encoding string
- *
- * TODO: check whether encoding is needed
- *
- * Dump the HTML document DTD, if any.
- */
-static void
-htmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
- const char *encoding ATTRIBUTE_UNUSED) {
- xmlDtdPtr cur = doc->intSubset;
-
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "htmlDtdDumpOutput : no internal subset\n");
- return;
- }
- xmlOutputBufferWriteString(buf, "<!DOCTYPE ");
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- if (cur->ExternalID != NULL) {
- xmlOutputBufferWriteString(buf, " PUBLIC ");
- xmlBufferWriteQuotedString(buf->buffer, cur->ExternalID);
- if (cur->SystemID != NULL) {
- xmlOutputBufferWriteString(buf, " ");
- xmlBufferWriteQuotedString(buf->buffer, cur->SystemID);
- }
- } else if (cur->SystemID != NULL) {
- xmlOutputBufferWriteString(buf, " SYSTEM ");
- xmlBufferWriteQuotedString(buf->buffer, cur->SystemID);
- }
- xmlOutputBufferWriteString(buf, ">\n");
-}
-
-/**
- * htmlAttrDumpOutput:
- * @buf: the HTML buffer output
- * @doc: the document
- * @cur: the attribute pointer
- * @encoding: the encoding string
- *
- * Dump an HTML attribute
- */
-static void
-htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur,
- const char *encoding ATTRIBUTE_UNUSED) {
- xmlChar *value;
-
- /*
- * TODO: The html output method should not escape a & character
- * occurring in an attribute value immediately followed by
- * a { character (see Section B.7.1 of the HTML 4.0 Recommendation).
- */
-
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "htmlAttrDumpOutput : property == NULL\n");
- return;
- }
- xmlOutputBufferWriteString(buf, " ");
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- if ((cur->children != NULL) && (!htmlIsBooleanAttr(cur->name))) {
- value = xmlNodeListGetString(doc, cur->children, 0);
- if (value) {
- xmlOutputBufferWriteString(buf, "=");
- if ((!xmlStrcasecmp(cur->name, BAD_CAST "href")) ||
- (!xmlStrcasecmp(cur->name, BAD_CAST "src"))) {
- xmlChar *escaped;
- xmlChar *tmp = value;
-
- while (IS_BLANK(*tmp)) tmp++;
-
- escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&");
- if (escaped != NULL) {
- xmlBufferWriteQuotedString(buf->buffer, escaped);
- xmlFree(escaped);
- } else {
- xmlBufferWriteQuotedString(buf->buffer, value);
- }
- } else {
- xmlBufferWriteQuotedString(buf->buffer, value);
- }
- xmlFree(value);
- } else {
- xmlOutputBufferWriteString(buf, "=\"\"");
- }
- }
-}
-
-/**
- * htmlAttrListDumpOutput:
- * @buf: the HTML buffer output
- * @doc: the document
- * @cur: the first attribute pointer
- * @encoding: the encoding string
- *
- * Dump a list of HTML attributes
- */
-static void
-htmlAttrListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur, const char *encoding) {
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "htmlAttrListDumpOutput : property == NULL\n");
- return;
- }
- while (cur != NULL) {
- htmlAttrDumpOutput(buf, doc, cur, encoding);
- cur = cur->next;
- }
-}
-
-
-
-/**
- * htmlNodeListDumpOutput:
- * @buf: the HTML buffer output
- * @doc: the document
- * @cur: the first node
- * @encoding: the encoding string
- * @format: should formatting spaces been added
- *
- * Dump an HTML node list, recursive behaviour,children are printed too.
- */
-static void
-htmlNodeListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
- xmlNodePtr cur, const char *encoding, int format) {
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "htmlNodeListDumpOutput : node == NULL\n");
- return;
- }
- while (cur != NULL) {
- htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format);
- cur = cur->next;
- }
-}
-
-/**
- * htmlNodeDumpFormatOutput:
- * @buf: the HTML buffer output
- * @doc: the document
- * @cur: the current node
- * @encoding: the encoding string
- * @format: should formatting spaces been added
- *
- * Dump an HTML node, recursive behaviour,children are printed too.
- */
-void
-htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
- xmlNodePtr cur, const char *encoding, int format) {
- const htmlElemDesc * info;
-
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "htmlNodeDumpFormatOutput : node == NULL\n");
- return;
- }
- /*
- * Special cases.
- */
- if (cur->type == XML_DTD_NODE)
- return;
- if (cur->type == XML_HTML_DOCUMENT_NODE) {
- htmlDocContentDumpOutput(buf, (xmlDocPtr) cur, encoding);
- return;
- }
- if (cur->type == HTML_TEXT_NODE) {
- if (cur->content != NULL) {
- if (((cur->name == (const xmlChar *)xmlStringText) ||
- (cur->name != (const xmlChar *)xmlStringTextNoenc)) &&
- ((cur->parent == NULL) ||
- ((xmlStrcasecmp(cur->parent->name, BAD_CAST "script")) &&
- (xmlStrcasecmp(cur->parent->name, BAD_CAST "style"))))) {
- xmlChar *buffer;
-
- buffer = xmlEncodeEntitiesReentrant(doc, cur->content);
- if (buffer != NULL) {
- xmlOutputBufferWriteString(buf, (const char *)buffer);
- xmlFree(buffer);
- }
- } else {
- xmlOutputBufferWriteString(buf, (const char *)cur->content);
- }
- }
- return;
- }
- if (cur->type == HTML_COMMENT_NODE) {
- if (cur->content != NULL) {
- xmlOutputBufferWriteString(buf, "<!--");
- xmlOutputBufferWriteString(buf, (const char *)cur->content);
- xmlOutputBufferWriteString(buf, "-->");
- }
- return;
- }
- if (cur->type == HTML_PI_NODE) {
- if (cur->name == NULL)
- return;
- xmlOutputBufferWriteString(buf, "<?");
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- if (cur->content != NULL) {
- xmlOutputBufferWriteString(buf, " ");
- xmlOutputBufferWriteString(buf, (const char *)cur->content);
- }
- xmlOutputBufferWriteString(buf, ">");
- return;
- }
- if (cur->type == HTML_ENTITY_REF_NODE) {
- xmlOutputBufferWriteString(buf, "&");
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- xmlOutputBufferWriteString(buf, ";");
- return;
- }
- if (cur->type == HTML_PRESERVE_NODE) {
- if (cur->content != NULL) {
- xmlOutputBufferWriteString(buf, (const char *)cur->content);
- }
- return;
- }
-
- /*
- * Get specific HTML info for that node.
- */
- info = htmlTagLookup(cur->name);
-
- xmlOutputBufferWriteString(buf, "<");
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- if (cur->properties != NULL)
- htmlAttrListDumpOutput(buf, doc, cur->properties, encoding);
-
- if ((info != NULL) && (info->empty)) {
- xmlOutputBufferWriteString(buf, ">");
- if ((format) && (!info->isinline) && (cur->next != NULL)) {
- if ((cur->next->type != HTML_TEXT_NODE) &&
- (cur->next->type != HTML_ENTITY_REF_NODE) &&
- (cur->parent != NULL) &&
- (!xmlStrEqual(cur->parent->name, BAD_CAST "pre")))
- xmlOutputBufferWriteString(buf, "\n");
- }
- return;
- }
- if (((cur->type == XML_ELEMENT_NODE) || (cur->content == NULL)) &&
- (cur->children == NULL)) {
- if ((info != NULL) && (info->saveEndTag != 0) &&
- (xmlStrcmp(BAD_CAST info->name, BAD_CAST "html")) &&
- (xmlStrcmp(BAD_CAST info->name, BAD_CAST "body"))) {
- xmlOutputBufferWriteString(buf, ">");
- } else {
- xmlOutputBufferWriteString(buf, "></");
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- xmlOutputBufferWriteString(buf, ">");
- }
- if ((format) && (cur->next != NULL) &&
- (info != NULL) && (!info->isinline)) {
- if ((cur->next->type != HTML_TEXT_NODE) &&
- (cur->next->type != HTML_ENTITY_REF_NODE) &&
- (cur->parent != NULL) &&
- (!xmlStrEqual(cur->parent->name, BAD_CAST "pre")))
- xmlOutputBufferWriteString(buf, "\n");
- }
- return;
- }
- xmlOutputBufferWriteString(buf, ">");
- if ((cur->type != XML_ELEMENT_NODE) &&
- (cur->content != NULL)) {
- /*
- * Uses the OutputBuffer property to automatically convert
- * invalids to charrefs
- */
-
- xmlOutputBufferWriteString(buf, (const char *) cur->content);
- }
- if (cur->children != NULL) {
- if ((format) && (info != NULL) && (!info->isinline) &&
- (cur->children->type != HTML_TEXT_NODE) &&
- (cur->children->type != HTML_ENTITY_REF_NODE) &&
- (cur->children != cur->last) &&
- (!xmlStrEqual(cur->name, BAD_CAST "pre")))
- xmlOutputBufferWriteString(buf, "\n");
- htmlNodeListDumpOutput(buf, doc, cur->children, encoding, format);
- if ((format) && (info != NULL) && (!info->isinline) &&
- (cur->last->type != HTML_TEXT_NODE) &&
- (cur->last->type != HTML_ENTITY_REF_NODE) &&
- (cur->children != cur->last) &&
- (!xmlStrEqual(cur->name, BAD_CAST "pre")))
- xmlOutputBufferWriteString(buf, "\n");
- }
- xmlOutputBufferWriteString(buf, "</");
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- xmlOutputBufferWriteString(buf, ">");
- if ((format) && (info != NULL) && (!info->isinline) &&
- (cur->next != NULL)) {
- if ((cur->next->type != HTML_TEXT_NODE) &&
- (cur->next->type != HTML_ENTITY_REF_NODE) &&
- (cur->parent != NULL) &&
- (!xmlStrEqual(cur->parent->name, BAD_CAST "pre")))
- xmlOutputBufferWriteString(buf, "\n");
- }
-}
-
-/**
- * htmlNodeDumpOutput:
- * @buf: the HTML buffer output
- * @doc: the document
- * @cur: the current node
- * @encoding: the encoding string
- *
- * Dump an HTML node, recursive behaviour,children are printed too,
- * and formatting returns/spaces are added.
- */
-void
-htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
- xmlNodePtr cur, const char *encoding) {
- htmlNodeDumpFormatOutput(buf, doc, cur, encoding, 1);
-}
-
-/**
- * htmlDocContentDumpFormatOutput:
- * @buf: the HTML buffer output
- * @cur: the document
- * @encoding: the encoding string
- * @format: should formatting spaces been added
- *
- * Dump an HTML document.
- */
-void
-htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr cur,
- const char *encoding, int format) {
- int type;
-
- /*
- * force to output the stuff as HTML, especially for entities
- */
- type = cur->type;
- cur->type = XML_HTML_DOCUMENT_NODE;
- if (cur->intSubset != NULL) {
- htmlDtdDumpOutput(buf, cur, NULL);
- }
- if (cur->children != NULL) {
- htmlNodeListDumpOutput(buf, cur, cur->children, encoding, format);
- }
- xmlOutputBufferWriteString(buf, "\n");
- cur->type = (xmlElementType) type;
-}
-
-/**
- * htmlDocContentDumpOutput:
- * @buf: the HTML buffer output
- * @cur: the document
- * @encoding: the encoding string
- *
- * Dump an HTML document. Formating return/spaces are added.
- */
-void
-htmlDocContentDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr cur,
- const char *encoding) {
- htmlDocContentDumpFormatOutput(buf, cur, encoding, 1);
-}
-
-/************************************************************************
- * *
- * Saving functions front-ends *
- * *
- ************************************************************************/
-
-/**
- * htmlDocDump:
- * @f: the FILE*
- * @cur: the document
- *
- * Dump an HTML document to an open FILE.
- *
- * returns: the number of byte written or -1 in case of failure.
- */
-int
-htmlDocDump(FILE *f, xmlDocPtr cur) {
- xmlOutputBufferPtr buf;
- xmlCharEncodingHandlerPtr handler = NULL;
- const char *encoding;
- int ret;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "htmlDocDump : document == NULL\n");
-#endif
- return(-1);
- }
-
- encoding = (const char *) htmlGetMetaEncoding(cur);
-
- if (encoding != NULL) {
- xmlCharEncoding enc;
-
- enc = xmlParseCharEncoding(encoding);
- if (enc != cur->charset) {
- if (cur->charset != XML_CHAR_ENCODING_UTF8) {
- /*
- * Not supported yet
- */
- return(-1);
- }
-
- handler = xmlFindCharEncodingHandler(encoding);
- if (handler == NULL)
- return(-1);
- }
- }
-
- /*
- * Fallback to HTML or ASCII when the encoding is unspecified
- */
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("HTML");
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("ascii");
-
- buf = xmlOutputBufferCreateFile(f, handler);
- if (buf == NULL) return(-1);
- htmlDocContentDumpOutput(buf, cur, NULL);
-
- ret = xmlOutputBufferClose(buf);
- return(ret);
-}
-
-/**
- * htmlSaveFile:
- * @filename: the filename (or URL)
- * @cur: the document
- *
- * Dump an HTML document to a file. If @filename is "-" the stdout file is
- * used.
- * returns: the number of byte written or -1 in case of failure.
- */
-int
-htmlSaveFile(const char *filename, xmlDocPtr cur) {
- xmlOutputBufferPtr buf;
- xmlCharEncodingHandlerPtr handler = NULL;
- const char *encoding;
- int ret;
-
- encoding = (const char *) htmlGetMetaEncoding(cur);
-
- if (encoding != NULL) {
- xmlCharEncoding enc;
-
- enc = xmlParseCharEncoding(encoding);
- if (enc != cur->charset) {
- if (cur->charset != XML_CHAR_ENCODING_UTF8) {
- /*
- * Not supported yet
- */
- return(-1);
- }
-
- handler = xmlFindCharEncodingHandler(encoding);
- if (handler == NULL)
- return(-1);
- }
- }
-
- /*
- * Fallback to HTML or ASCII when the encoding is unspecified
- */
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("HTML");
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("ascii");
-
- /*
- * save the content to a temp buffer.
- */
- buf = xmlOutputBufferCreateFilename(filename, handler, cur->compression);
- if (buf == NULL) return(0);
-
- htmlDocContentDumpOutput(buf, cur, NULL);
-
- ret = xmlOutputBufferClose(buf);
- return(ret);
-}
-
-/**
- * htmlSaveFileFormat:
- * @filename: the filename
- * @cur: the document
- * @format: should formatting spaces been added
- * @encoding: the document encoding
- *
- * Dump an HTML document to a file using a given encoding.
- *
- * returns: the number of byte written or -1 in case of failure.
- */
-int
-htmlSaveFileFormat(const char *filename, xmlDocPtr cur,
- const char *encoding, int format) {
- xmlOutputBufferPtr buf;
- xmlCharEncodingHandlerPtr handler = NULL;
- int ret;
-
- if (encoding != NULL) {
- xmlCharEncoding enc;
-
- enc = xmlParseCharEncoding(encoding);
- if (enc != cur->charset) {
- if (cur->charset != XML_CHAR_ENCODING_UTF8) {
- /*
- * Not supported yet
- */
- return(-1);
- }
-
- handler = xmlFindCharEncodingHandler(encoding);
- if (handler == NULL)
- return(-1);
- htmlSetMetaEncoding(cur, (const xmlChar *) encoding);
- }
- } else {
- htmlSetMetaEncoding(cur, (const xmlChar *) "UTF-8");
- }
-
- /*
- * Fallback to HTML or ASCII when the encoding is unspecified
- */
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("HTML");
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("ascii");
-
- /*
- * save the content to a temp buffer.
- */
- buf = xmlOutputBufferCreateFilename(filename, handler, 0);
- if (buf == NULL) return(0);
-
- htmlDocContentDumpFormatOutput(buf, cur, encoding, format);
-
- ret = xmlOutputBufferClose(buf);
- return(ret);
-}
-
-/**
- * htmlSaveFileEnc:
- * @filename: the filename
- * @cur: the document
- * @encoding: the document encoding
- *
- * Dump an HTML document to a file using a given encoding
- * and formatting returns/spaces are added.
- *
- * returns: the number of byte written or -1 in case of failure.
- */
-int
-htmlSaveFileEnc(const char *filename, xmlDocPtr cur, const char *encoding) {
- return(htmlSaveFileFormat(filename, cur, encoding, 1));
-}
-
-
-
-#endif /* LIBXML_HTML_ENABLED */
diff --git a/bundle/libxml/SAX.c b/bundle/libxml/SAX.c
deleted file mode 100644
index 785ea0ba8c..0000000000
--- a/bundle/libxml/SAX.c
+++ /dev/null
@@ -1,2015 +0,0 @@
-/*
- * SAX.c : Default SAX handler to build a tree.
- *
- * See Copyright for the status of this software.
- *
- * Daniel Veillard <daniel@veillard.com>
- */
-
-
-#define IN_LIBXML
-#include "libxml.h"
-#include <stdlib.h>
-#include <string.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-#include <libxml/valid.h>
-#include <libxml/entities.h>
-#include <libxml/xmlerror.h>
-#include <libxml/debugXML.h>
-#include <libxml/xmlIO.h>
-#include <libxml/SAX.h>
-#include <libxml/uri.h>
-#include <libxml/valid.h>
-#include <libxml/HTMLtree.h>
-#include <libxml/globals.h>
-
-/* #define DEBUG_SAX */
-/* #define DEBUG_SAX_TREE */
-
-/**
- * getPublicId:
- * @ctx: the user data (XML parser context)
- *
- * Provides the public ID e.g. "-//SGMLSOURCE//DTD DEMO//EN"
- *
- * Returns a xmlChar *
- */
-const xmlChar *
-getPublicId(void *ctx ATTRIBUTE_UNUSED)
-{
- /* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
- return(NULL);
-}
-
-/**
- * getSystemId:
- * @ctx: the user data (XML parser context)
- *
- * Provides the system ID, basically URL or filename e.g.
- * http://www.sgmlsource.com/dtds/memo.dtd
- *
- * Returns a xmlChar *
- */
-const xmlChar *
-getSystemId(void *ctx)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- return((const xmlChar *) ctxt->input->filename);
-}
-
-/**
- * getLineNumber:
- * @ctx: the user data (XML parser context)
- *
- * Provide the line number of the current parsing point.
- *
- * Returns an int
- */
-int
-getLineNumber(void *ctx)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- return(ctxt->input->line);
-}
-
-/**
- * getColumnNumber:
- * @ctx: the user data (XML parser context)
- *
- * Provide the column number of the current parsing point.
- *
- * Returns an int
- */
-int
-getColumnNumber(void *ctx)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- return(ctxt->input->col);
-}
-
-/**
- * isStandalone:
- * @ctx: the user data (XML parser context)
- *
- * Is this document tagged standalone ?
- *
- * Returns 1 if true
- */
-int
-isStandalone(void *ctx)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- return(ctxt->myDoc->standalone == 1);
-}
-
-/**
- * hasInternalSubset:
- * @ctx: the user data (XML parser context)
- *
- * Does this document has an internal subset
- *
- * Returns 1 if true
- */
-int
-hasInternalSubset(void *ctx)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- return(ctxt->myDoc->intSubset != NULL);
-}
-
-/**
- * hasExternalSubset:
- * @ctx: the user data (XML parser context)
- *
- * Does this document has an external subset
- *
- * Returns 1 if true
- */
-int
-hasExternalSubset(void *ctx)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- return(ctxt->myDoc->extSubset != NULL);
-}
-
-/**
- * internalSubset:
- * @ctx: the user data (XML parser context)
- * @name: the root element name
- * @ExternalID: the external ID
- * @SystemID: the SYSTEM ID (e.g. filename or URL)
- *
- * Callback on internal subset declaration.
- */
-void
-internalSubset(void *ctx, const xmlChar *name,
- const xmlChar *ExternalID, const xmlChar *SystemID)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlDtdPtr dtd;
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.internalSubset(%s, %s, %s)\n",
- name, ExternalID, SystemID);
-#endif
-
- if (ctxt->myDoc == NULL)
- return;
- dtd = xmlGetIntSubset(ctxt->myDoc);
- if (dtd != NULL) {
- if (ctxt->html)
- return;
- xmlUnlinkNode((xmlNodePtr) dtd);
- xmlFreeDtd(dtd);
- ctxt->myDoc->intSubset = NULL;
- }
- ctxt->myDoc->intSubset =
- xmlCreateIntSubset(ctxt->myDoc, name, ExternalID, SystemID);
-}
-
-/**
- * externalSubset:
- * @ctx: the user data (XML parser context)
- * @name: the root element name
- * @ExternalID: the external ID
- * @SystemID: the SYSTEM ID (e.g. filename or URL)
- *
- * Callback on external subset declaration.
- */
-void
-externalSubset(void *ctx, const xmlChar *name,
- const xmlChar *ExternalID, const xmlChar *SystemID)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.externalSubset(%s, %s, %s)\n",
- name, ExternalID, SystemID);
-#endif
- if (((ExternalID != NULL) || (SystemID != NULL)) &&
- (((ctxt->validate) || (ctxt->loadsubset != 0)) &&
- (ctxt->wellFormed && ctxt->myDoc))) {
- /*
- * Try to fetch and parse the external subset.
- */
- xmlParserInputPtr oldinput;
- int oldinputNr;
- int oldinputMax;
- xmlParserInputPtr *oldinputTab;
- xmlParserInputPtr input = NULL;
- xmlCharEncoding enc;
- int oldcharset;
-
- /*
- * Ask the Entity resolver to load the damn thing
- */
- if ((ctxt->sax != NULL) && (ctxt->sax->resolveEntity != NULL))
- input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID,
- SystemID);
- if (input == NULL) {
- return;
- }
-
- xmlNewDtd(ctxt->myDoc, name, ExternalID, SystemID);
-
- /*
- * make sure we won't destroy the main document context
- */
- oldinput = ctxt->input;
- oldinputNr = ctxt->inputNr;
- oldinputMax = ctxt->inputMax;
- oldinputTab = ctxt->inputTab;
- oldcharset = ctxt->charset;
-
- ctxt->inputTab = (xmlParserInputPtr *)
- xmlMalloc(5 * sizeof(xmlParserInputPtr));
- if (ctxt->inputTab == NULL) {
- ctxt->errNo = XML_ERR_NO_MEMORY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "externalSubset: out of memory\n");
- ctxt->errNo = XML_ERR_NO_MEMORY;
- ctxt->input = oldinput;
- ctxt->inputNr = oldinputNr;
- ctxt->inputMax = oldinputMax;
- ctxt->inputTab = oldinputTab;
- ctxt->charset = oldcharset;
- return;
- }
- ctxt->inputNr = 0;
- ctxt->inputMax = 5;
- ctxt->input = NULL;
- xmlPushInput(ctxt, input);
-
- /*
- * On the fly encoding conversion if needed
- */
- enc = xmlDetectCharEncoding(ctxt->input->cur, 4);
- xmlSwitchEncoding(ctxt, enc);
-
- if (input->filename == NULL)
- input->filename = (char *) xmlStrdup(SystemID);
- input->line = 1;
- input->col = 1;
- input->base = ctxt->input->cur;
- input->cur = ctxt->input->cur;
- input->free = NULL;
-
- /*
- * let's parse that entity knowing it's an external subset.
- */
- xmlParseExternalSubset(ctxt, ExternalID, SystemID);
-
- /*
- * Free up the external entities
- */
-
- while (ctxt->inputNr > 1)
- xmlPopInput(ctxt);
- xmlFreeInputStream(ctxt->input);
- xmlFree(ctxt->inputTab);
-
- /*
- * Restore the parsing context of the main entity
- */
- ctxt->input = oldinput;
- ctxt->inputNr = oldinputNr;
- ctxt->inputMax = oldinputMax;
- ctxt->inputTab = oldinputTab;
- ctxt->charset = oldcharset;
- /* ctxt->wellFormed = oldwellFormed; */
- }
-}
-
-/**
- * resolveEntity:
- * @ctx: the user data (XML parser context)
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- *
- * The entity loader, to control the loading of external entities,
- * the application can either:
- * - override this resolveEntity() callback in the SAX block
- * - or better use the xmlSetExternalEntityLoader() function to
- * set up it's own entity resolution routine
- *
- * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
- */
-xmlParserInputPtr
-resolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlParserInputPtr ret;
- xmlChar *URI;
- const char *base = NULL;
-
- if (ctxt->input != NULL)
- base = ctxt->input->filename;
- if (base == NULL)
- base = ctxt->directory;
-
- URI = xmlBuildURI(systemId, (const xmlChar *) base);
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.resolveEntity(%s, %s)\n", publicId, systemId);
-#endif
-
- ret = xmlLoadExternalEntity((const char *) URI,
- (const char *) publicId, ctxt);
- if (URI != NULL)
- xmlFree(URI);
- return(ret);
-}
-
-/**
- * getEntity:
- * @ctx: the user data (XML parser context)
- * @name: The entity name
- *
- * Get an entity by name
- *
- * Returns the xmlEntityPtr if found.
- */
-xmlEntityPtr
-getEntity(void *ctx, const xmlChar *name)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlEntityPtr ret;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.getEntity(%s)\n", name);
-#endif
-
- if ((ctxt->myDoc != NULL) && (ctxt->myDoc->standalone == 1)) {
- if (ctxt->inSubset == 2) {
- ctxt->myDoc->standalone = 0;
- ret = xmlGetDocEntity(ctxt->myDoc, name);
- ctxt->myDoc->standalone = 1;
- } else {
- ret = xmlGetDocEntity(ctxt->myDoc, name);
- if (ret == NULL) {
- ctxt->myDoc->standalone = 0;
- ret = xmlGetDocEntity(ctxt->myDoc, name);
- if (ret != NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
- "Entity(%s) document marked standalone but require external subset\n",
- name);
- ctxt->valid = 0;
- ctxt->wellFormed = 0;
- }
- ctxt->myDoc->standalone = 1;
- }
- }
- } else {
- ret = xmlGetDocEntity(ctxt->myDoc, name);
- }
- if ((ret != NULL) && (ctxt->validate) && (ret->children == NULL) &&
- (ret->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) {
- /*
- * for validation purposes we really need to fetch and
- * parse the external entity
- */
- xmlNodePtr children;
-
- xmlParseCtxtExternalEntity(ctxt, ret->URI, ret->ExternalID, &children);
- xmlAddChildList((xmlNodePtr) ret, children);
- }
- return(ret);
-}
-
-/**
- * getParameterEntity:
- * @ctx: the user data (XML parser context)
- * @name: The entity name
- *
- * Get a parameter entity by name
- *
- * Returns the xmlEntityPtr if found.
- */
-xmlEntityPtr
-getParameterEntity(void *ctx, const xmlChar *name)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlEntityPtr ret;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.getParameterEntity(%s)\n", name);
-#endif
-
- ret = xmlGetParameterEntity(ctxt->myDoc, name);
- return(ret);
-}
-
-
-/**
- * entityDecl:
- * @ctx: the user data (XML parser context)
- * @name: the entity name
- * @type: the entity type
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- * @content: the entity value (without processing).
- *
- * An entity definition has been parsed
- */
-void
-entityDecl(void *ctx, const xmlChar *name, int type,
- const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
-{
- xmlEntityPtr ent;
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.entityDecl(%s, %d, %s, %s, %s)\n",
- name, type, publicId, systemId, content);
-#endif
- if (ctxt->inSubset == 1) {
- ent = xmlAddDocEntity(ctxt->myDoc, name, type, publicId,
- systemId, content);
- if ((ent == NULL) && (ctxt->pedantic) &&
- (ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt,
- "Entity(%s) already defined in the internal subset\n", name);
- if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
- xmlChar *URI;
- const char *base = NULL;
-
- if (ctxt->input != NULL)
- base = ctxt->input->filename;
- if (base == NULL)
- base = ctxt->directory;
-
- URI = xmlBuildURI(systemId, (const xmlChar *) base);
- ent->URI = URI;
- }
- } else if (ctxt->inSubset == 2) {
- ent = xmlAddDtdEntity(ctxt->myDoc, name, type, publicId,
- systemId, content);
- if ((ent == NULL) && (ctxt->pedantic) &&
- (ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt,
- "Entity(%s) already defined in the external subset\n", name);
- if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
- xmlChar *URI;
- const char *base = NULL;
-
- if (ctxt->input != NULL)
- base = ctxt->input->filename;
- if (base == NULL)
- base = ctxt->directory;
-
- URI = xmlBuildURI(systemId, (const xmlChar *) base);
- ent->URI = URI;
- }
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
- "SAX.entityDecl(%s) called while not in subset\n", name);
- }
-}
-
-/**
- * attributeDecl:
- * @ctx: the user data (XML parser context)
- * @elem: the name of the element
- * @fullname: the attribute name
- * @type: the attribute type
- * @def: the type of default value
- * @defaultValue: the attribute default value
- * @tree: the tree of enumerated value set
- *
- * An attribute definition has been parsed
- */
-void
-attributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
- int type, int def, const xmlChar *defaultValue,
- xmlEnumerationPtr tree)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlAttributePtr attr;
- xmlChar *name = NULL, *prefix = NULL;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n",
- elem, fullname, type, def, defaultValue);
-#endif
- name = xmlSplitQName(ctxt, fullname, &prefix);
- ctxt->vctxt.valid = 1;
- if (ctxt->inSubset == 1)
- attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, elem,
- name, prefix, (xmlAttributeType) type,
- (xmlAttributeDefault) def, defaultValue, tree);
- else if (ctxt->inSubset == 2)
- attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, elem,
- name, prefix, (xmlAttributeType) type,
- (xmlAttributeDefault) def, defaultValue, tree);
- else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
- "SAX.attributeDecl(%s) called while not in subset\n", name);
- return;
- }
- if (ctxt->vctxt.valid == 0)
- ctxt->valid = 0;
- if ((attr != NULL) && (ctxt->validate) && (ctxt->wellFormed) &&
- (ctxt->myDoc != NULL) && (ctxt->myDoc->intSubset != NULL))
- ctxt->valid &= xmlValidateAttributeDecl(&ctxt->vctxt, ctxt->myDoc,
- attr);
- if (prefix != NULL)
- xmlFree(prefix);
- if (name != NULL)
- xmlFree(name);
-}
-
-/**
- * elementDecl:
- * @ctx: the user data (XML parser context)
- * @name: the element name
- * @type: the element type
- * @content: the element value tree
- *
- * An element definition has been parsed
- */
-void
-elementDecl(void *ctx, const xmlChar * name, int type,
- xmlElementContentPtr content)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlElementPtr elem = NULL;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.elementDecl(%s, %d, ...)\n", name, type);
-#endif
-
- if (ctxt->inSubset == 1)
- elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->intSubset,
- name, (xmlElementTypeVal) type, content);
- else if (ctxt->inSubset == 2)
- elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->extSubset,
- name, (xmlElementTypeVal) type, content);
- else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
- "SAX.elementDecl(%s) called while not in subset\n",
- name);
- return;
- }
- if (elem == NULL)
- ctxt->valid = 0;
- if (ctxt->validate && ctxt->wellFormed &&
- ctxt->myDoc && ctxt->myDoc->intSubset)
- ctxt->valid &=
- xmlValidateElementDecl(&ctxt->vctxt, ctxt->myDoc, elem);
-}
-
-/**
- * notationDecl:
- * @ctx: the user data (XML parser context)
- * @name: The name of the notation
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- *
- * What to do when a notation declaration has been parsed.
- */
-void
-notationDecl(void *ctx, const xmlChar *name,
- const xmlChar *publicId, const xmlChar *systemId)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlNotationPtr nota = NULL;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.notationDecl(%s, %s, %s)\n", name, publicId, systemId);
-#endif
-
- if ((publicId == NULL) && (systemId == NULL)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
- "SAX.notationDecl(%s) externalID or PublicID missing\n", name);
- ctxt->valid = 0;
- ctxt->wellFormed = 0;
- return;
- } else if (ctxt->inSubset == 1)
- nota = xmlAddNotationDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, name,
- publicId, systemId);
- else if (ctxt->inSubset == 2)
- nota = xmlAddNotationDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, name,
- publicId, systemId);
- else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
- "SAX.notationDecl(%s) called while not in subset\n", name);
- return;
- }
- if (nota == NULL) ctxt->valid = 0;
- if (ctxt->validate && ctxt->wellFormed &&
- ctxt->myDoc && ctxt->myDoc->intSubset)
- ctxt->valid &= xmlValidateNotationDecl(&ctxt->vctxt, ctxt->myDoc,
- nota);
-}
-
-/**
- * unparsedEntityDecl:
- * @ctx: the user data (XML parser context)
- * @name: The name of the entity
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- * @notationName: the name of the notation
- *
- * What to do when an unparsed entity declaration is parsed
- */
-void
-unparsedEntityDecl(void *ctx, const xmlChar *name,
- const xmlChar *publicId, const xmlChar *systemId,
- const xmlChar *notationName)
-{
- xmlEntityPtr ent;
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.unparsedEntityDecl(%s, %s, %s, %s)\n",
- name, publicId, systemId, notationName);
-#endif
-#if 0
- Done in xmlValidateDtdFinal now.
- if (ctxt->validate && ctxt->wellFormed && ctxt->myDoc) {
- int ret;
- ret = xmlValidateNotationUse(&ctxt->vctxt, ctxt->myDoc,
- notationName);
- if (ret == 0) {
- ctxt->wellFormed = 0;
- ctxt->valid = 0;
- }
- }
-#endif
- if (ctxt->inSubset == 1) {
- ent = xmlAddDocEntity(ctxt->myDoc, name,
- XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
- publicId, systemId, notationName);
- if ((ent == NULL) && (ctxt->pedantic) &&
- (ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt,
- "Entity(%s) already defined in the internal subset\n", name);
- if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
- xmlChar *URI;
- const char *base = NULL;
-
- if (ctxt->input != NULL)
- base = ctxt->input->filename;
- if (base == NULL)
- base = ctxt->directory;
-
- URI = xmlBuildURI(systemId, (const xmlChar *) base);
- ent->URI = URI;
- }
- } else if (ctxt->inSubset == 2) {
- ent = xmlAddDtdEntity(ctxt->myDoc, name,
- XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
- publicId, systemId, notationName);
- if ((ent == NULL) && (ctxt->pedantic) &&
- (ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt,
- "Entity(%s) already defined in the external subset\n", name);
- if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
- xmlChar *URI;
- const char *base = NULL;
-
- if (ctxt->input != NULL)
- base = ctxt->input->filename;
- if (base == NULL)
- base = ctxt->directory;
-
- URI = xmlBuildURI(systemId, (const xmlChar *) base);
- ent->URI = URI;
- }
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
- "SAX.unparsedEntityDecl(%s) called while not in subset\n", name);
- }
-}
-
-/**
- * setDocumentLocator:
- * @ctx: the user data (XML parser context)
- * @loc: A SAX Locator
- *
- * Receive the document locator at startup, actually xmlDefaultSAXLocator
- * Everything is available on the context, so this is useless in our case.
- */
-void
-setDocumentLocator(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED)
-{
- /* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.setDocumentLocator()\n");
-#endif
-}
-
-/**
- * startDocument:
- * @ctx: the user data (XML parser context)
- *
- * called when the document start being processed.
- */
-void
-startDocument(void *ctx)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlDocPtr doc;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.startDocument()\n");
-#endif
- if (ctxt->html) {
- if (ctxt->myDoc == NULL)
-#ifdef LIBXML_HTML_ENABLED
- ctxt->myDoc = htmlNewDocNoDtD(NULL, NULL);
-#else
- xmlGenericError(xmlGenericErrorContext,
- "libxml2 built without HTML support\n");
-#endif
- } else {
- doc = ctxt->myDoc = xmlNewDoc(ctxt->version);
- if (doc != NULL) {
- if (ctxt->encoding != NULL)
- doc->encoding = xmlStrdup(ctxt->encoding);
- else
- doc->encoding = NULL;
- doc->standalone = ctxt->standalone;
- }
- }
- if ((ctxt->myDoc != NULL) && (ctxt->myDoc->URL == NULL) &&
- (ctxt->input != NULL) && (ctxt->input->filename != NULL)) {
- ctxt->myDoc->URL = xmlStrdup((const xmlChar *) ctxt->input->filename);
- }
-}
-
-/**
- * endDocument:
- * @ctx: the user data (XML parser context)
- *
- * called when the document end has been detected.
- */
-void
-endDocument(void *ctx)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.endDocument()\n");
-#endif
- if (ctxt->validate && ctxt->wellFormed &&
- ctxt->myDoc && ctxt->myDoc->intSubset)
- ctxt->valid &= xmlValidateDocumentFinal(&ctxt->vctxt, ctxt->myDoc);
-
- /*
- * Grab the encoding if it was added on-the-fly
- */
- if ((ctxt->encoding != NULL) && (ctxt->myDoc != NULL) &&
- (ctxt->myDoc->encoding == NULL)) {
- ctxt->myDoc->encoding = ctxt->encoding;
- ctxt->encoding = NULL;
- }
- if ((ctxt->inputTab[0]->encoding != NULL) && (ctxt->myDoc != NULL) &&
- (ctxt->myDoc->encoding == NULL)) {
- ctxt->myDoc->encoding = xmlStrdup(ctxt->inputTab[0]->encoding);
- }
- if ((ctxt->charset != XML_CHAR_ENCODING_NONE) && (ctxt->myDoc != NULL) &&
- (ctxt->myDoc->charset == XML_CHAR_ENCODING_NONE)) {
- ctxt->myDoc->charset = ctxt->charset;
- }
-}
-
-/**
- * my_attribute:
- * @ctx: the user data (XML parser context)
- * @fullname: The attribute name, including namespace prefix
- * @value: The attribute value
- * @prefix: the prefix on the element node
- *
- * Handle an attribute that has been read by the parser.
- * The default handling is to convert the attribute into an
- * DOM subtree and past it in a new xmlAttr element added to
- * the element.
- */
-static void
-my_attribute(void *ctx, const xmlChar *fullname, const xmlChar *value,
- const xmlChar *prefix)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlAttrPtr ret;
- xmlChar *name;
- xmlChar *ns;
- xmlChar *nval;
- xmlNsPtr namespace;
-
-/****************
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.attribute(%s, %s)\n", fullname, value);
-#endif
- ****************/
- /*
- * Split the full name into a namespace prefix and the tag name
- */
- name = xmlSplitQName(ctxt, fullname, &ns);
-
- /*
- * Do the last stage of the attribute normalization
- * Needed for HTML too:
- * http://www.w3.org/TR/html4/types.html#h-6.2
- */
- ctxt->vctxt.valid = 1;
- nval = xmlValidCtxtNormalizeAttributeValue(&ctxt->vctxt,
- ctxt->myDoc, ctxt->node,
- fullname, value);
- if (ctxt->vctxt.valid != 1) {
- ctxt->valid = 0;
- }
- if (nval != NULL)
- value = nval;
-
- /*
- * Check whether it's a namespace definition
- */
- if ((!ctxt->html) && (ns == NULL) &&
- (name[0] == 'x') && (name[1] == 'm') && (name[2] == 'l') &&
- (name[3] == 'n') && (name[4] == 's') && (name[5] == 0)) {
- xmlNsPtr nsret;
-
- if (value[0] != 0) {
- xmlURIPtr uri;
-
- uri = xmlParseURI((const char *)value);
- if (uri == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData,
- "nmlns: %s not a valid URI\n", value);
- } else {
- if (uri->scheme == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData,
- "nmlns: URI %s is not absolute\n", value);
- }
- xmlFreeURI(uri);
- }
- }
-
- /* a default namespace definition */
- nsret = xmlNewNs(ctxt->node, value, NULL);
-
- /*
- * Validate also for namespace decls, they are attributes from
- * an XML-1.0 perspective
- */
- if (nsret != NULL && ctxt->validate && ctxt->wellFormed &&
- ctxt->myDoc && ctxt->myDoc->intSubset)
- ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
- ctxt->node, prefix, nsret, value);
- if (name != NULL)
- xmlFree(name);
- if (nval != NULL)
- xmlFree(nval);
- return;
- }
- if ((!ctxt->html) &&
- (ns != NULL) && (ns[0] == 'x') && (ns[1] == 'm') && (ns[2] == 'l') &&
- (ns[3] == 'n') && (ns[4] == 's') && (ns[5] == 0)) {
- xmlNsPtr nsret;
-
- if (value[0] == 0) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Empty namespace name for prefix %s\n", name);
- }
- /* a standard namespace definition */
- nsret = xmlNewNs(ctxt->node, value, name);
- xmlFree(ns);
- /*
- * Validate also for namespace decls, they are attributes from
- * an XML-1.0 perspective
- */
- if (nsret != NULL && ctxt->validate && ctxt->wellFormed &&
- ctxt->myDoc && ctxt->myDoc->intSubset)
- ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
- ctxt->node, prefix, nsret, value);
- if (name != NULL)
- xmlFree(name);
- if (nval != NULL)
- xmlFree(nval);
- return;
- }
-
- if (ns != NULL)
- namespace = xmlSearchNs(ctxt->myDoc, ctxt->node, ns);
- else {
- namespace = NULL;
- }
-
- /* !!!!!! <a toto:arg="" xmlns:toto="http://toto.com"> */
- ret = xmlNewNsPropEatName(ctxt->node, namespace, name, NULL);
-
- if (ret != NULL) {
- if ((ctxt->replaceEntities == 0) && (!ctxt->html)) {
- xmlNodePtr tmp;
-
- ret->children = xmlStringGetNodeList(ctxt->myDoc, value);
- tmp = ret->children;
- while (tmp != NULL) {
- tmp->parent = (xmlNodePtr) ret;
- if (tmp->next == NULL)
- ret->last = tmp;
- tmp = tmp->next;
- }
- } else if (value != NULL) {
- ret->children = xmlNewDocText(ctxt->myDoc, value);
- ret->last = ret->children;
- if (ret->children != NULL)
- ret->children->parent = (xmlNodePtr) ret;
- }
- }
-
- if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed &&
- ctxt->myDoc && ctxt->myDoc->intSubset) {
-
- /*
- * If we don't substitute entities, the validation should be
- * done on a value with replaced entities anyway.
- */
- if (!ctxt->replaceEntities) {
- xmlChar *val;
-
- ctxt->depth++;
- val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF,
- 0,0,0);
- ctxt->depth--;
-
- if (val == NULL)
- ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
- ctxt->myDoc, ctxt->node, ret, value);
- else {
- xmlChar *nvalnorm;
-
- /*
- * Do the last stage of the attribute normalization
- * It need to be done twice ... it's an extra burden related
- * to the ability to keep references in attributes
- */
- nvalnorm = xmlValidNormalizeAttributeValue(ctxt->myDoc,
- ctxt->node, fullname, val);
- if (nvalnorm != NULL) {
- xmlFree(val);
- val = nvalnorm;
- }
-
- ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
- ctxt->myDoc, ctxt->node, ret, val);
- xmlFree(val);
- }
- } else {
- ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, ctxt->myDoc,
- ctxt->node, ret, value);
- }
- } else if (((ctxt->replaceEntities == 0) && (ctxt->external != 2)) ||
- ((ctxt->replaceEntities != 0) && (ctxt->inSubset == 0))) {
- /*
- * when validating, the ID registration is done at the attribute
- * validation level. Otherwise we have to do specific handling here.
- */
- if (xmlIsID(ctxt->myDoc, ctxt->node, ret))
- xmlAddID(&ctxt->vctxt, ctxt->myDoc, value, ret);
- else if (xmlIsRef(ctxt->myDoc, ctxt->node, ret))
- xmlAddRef(&ctxt->vctxt, ctxt->myDoc, value, ret);
- }
-
- if (nval != NULL)
- xmlFree(nval);
- if (ns != NULL)
- xmlFree(ns);
-}
-
-/**
- * attribute:
- * @ctx: the user data (XML parser context)
- * @fullname: The attribute name, including namespace prefix
- * @value: The attribute value
- *
- * Handle an attribute that has been read by the parser.
- * The default handling is to convert the attribute into an
- * DOM subtree and past it in a new xmlAttr element added to
- * the element.
- */
-void
-attribute(void *ctx, const xmlChar *fullname, const xmlChar *value)
-{
- my_attribute(ctx, fullname, value, NULL);
-}
-
-/*
- * xmlCheckDefaultedAttributes:
- *
- * Check defaulted attributes from the DTD
- */
-static void
-xmlCheckDefaultedAttributes(xmlParserCtxtPtr ctxt, const xmlChar *name,
- const xmlChar *prefix, const xmlChar **atts) {
- xmlElementPtr elemDecl;
- const xmlChar *att;
- int internal = 1;
- int i;
-
- elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->intSubset, name, prefix);
- if (elemDecl == NULL) {
- elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->extSubset, name, prefix);
- internal = 0;
- }
-
-process_external_subset:
-
- if (elemDecl != NULL) {
- xmlAttributePtr attr = elemDecl->attributes;
- /*
- * Check against defaulted attributes from the external subset
- * if the document is stamped as standalone
- */
- if ((ctxt->myDoc->standalone == 1) &&
- (ctxt->myDoc->extSubset != NULL) &&
- (ctxt->validate)) {
- while (attr != NULL) {
- if ((attr->defaultValue != NULL) &&
- (xmlGetDtdQAttrDesc(ctxt->myDoc->extSubset,
- attr->elem, attr->name,
- attr->prefix) == attr) &&
- (xmlGetDtdQAttrDesc(ctxt->myDoc->intSubset,
- attr->elem, attr->name,
- attr->prefix) == NULL)) {
- xmlChar *fulln;
-
- if (attr->prefix != NULL) {
- fulln = xmlStrdup(attr->prefix);
- fulln = xmlStrcat(fulln, BAD_CAST ":");
- fulln = xmlStrcat(fulln, attr->name);
- } else {
- fulln = xmlStrdup(attr->name);
- }
-
- /*
- * Check that the attribute is not declared in the
- * serialization
- */
- att = NULL;
- if (atts != NULL) {
- i = 0;
- att = atts[i];
- while (att != NULL) {
- if (xmlStrEqual(att, fulln))
- break;
- i += 2;
- att = atts[i];
- }
- }
- if (att == NULL) {
- if (ctxt->vctxt.error != NULL)
- ctxt->vctxt.error(ctxt->vctxt.userData,
- "standalone: attribute %s on %s defaulted from external subset\n",
- fulln, attr->elem);
- ctxt->valid = 0;
- }
- }
- attr = attr->nexth;
- }
- }
-
- /*
- * Actually insert defaulted values when needed
- */
- attr = elemDecl->attributes;
- while (attr != NULL) {
- /*
- * Make sure that attributes redefinition occuring in the
- * internal subset are not overriden by definitions in the
- * external subset.
- */
- if (attr->defaultValue != NULL) {
- /*
- * the element should be instantiated in the tree if:
- * - this is a namespace prefix
- * - the user required for completion in the tree
- * like XSLT
- * - there isn't already an attribute definition
- * in the internal subset overriding it.
- */
- if (((attr->prefix != NULL) &&
- (xmlStrEqual(attr->prefix, BAD_CAST "xmlns"))) ||
- ((attr->prefix == NULL) &&
- (xmlStrEqual(attr->name, BAD_CAST "xmlns"))) ||
- (ctxt->loadsubset & XML_COMPLETE_ATTRS)) {
- xmlAttributePtr tst;
-
- tst = xmlGetDtdQAttrDesc(ctxt->myDoc->intSubset,
- attr->elem, attr->name,
- attr->prefix);
- if ((tst == attr) || (tst == NULL)) {
- xmlChar *fulln;
-
- if (attr->prefix != NULL) {
- fulln = xmlStrdup(attr->prefix);
- fulln = xmlStrcat(fulln, BAD_CAST ":");
- fulln = xmlStrcat(fulln, attr->name);
- } else {
- fulln = xmlStrdup(attr->name);
- }
-
- /*
- * Check that the attribute is not declared in the
- * serialization
- */
- att = NULL;
- if (atts != NULL) {
- i = 0;
- att = atts[i];
- while (att != NULL) {
- if (xmlStrEqual(att, fulln))
- break;
- i += 2;
- att = atts[i];
- }
- }
- if (att == NULL) {
- attribute(ctxt, fulln, attr->defaultValue);
- }
- xmlFree(fulln);
- }
- }
- }
- attr = attr->nexth;
- }
- if (internal == 1) {
- elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->extSubset,
- name, prefix);
- internal = 0;
- goto process_external_subset;
- }
- }
-}
-
-/**
- * startElement:
- * @ctx: the user data (XML parser context)
- * @fullname: The element name, including namespace prefix
- * @atts: An array of name/value attributes pairs, NULL terminated
- *
- * called when an opening tag has been processed.
- */
-void
-startElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlNodePtr ret;
- xmlNodePtr parent = ctxt->node;
- xmlNsPtr ns;
- xmlChar *name;
- xmlChar *prefix;
- const xmlChar *att;
- const xmlChar *value;
- int i;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.startElement(%s)\n", fullname);
-#endif
-
- /*
- * First check on validity:
- */
- if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) &&
- ((ctxt->myDoc->intSubset == NULL) ||
- ((ctxt->myDoc->intSubset->notations == NULL) &&
- (ctxt->myDoc->intSubset->elements == NULL) &&
- (ctxt->myDoc->intSubset->attributes == NULL) &&
- (ctxt->myDoc->intSubset->entities == NULL)))) {
- if (ctxt->vctxt.error != NULL) {
- ctxt->vctxt.error(ctxt->vctxt.userData,
- "Validation failed: no DTD found !\n");
- }
- ctxt->validate = 0;
- ctxt->valid = 0;
- ctxt->errNo = XML_ERR_NO_DTD;
- }
-
-
- /*
- * Split the full name into a namespace prefix and the tag name
- */
- name = xmlSplitQName(ctxt, fullname, &prefix);
-
-
- /*
- * Note : the namespace resolution is deferred until the end of the
- * attributes parsing, since local namespace can be defined as
- * an attribute at this level.
- */
- ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, name, NULL);
- if (ret == NULL) return;
- if (ctxt->myDoc->children == NULL) {
-#ifdef DEBUG_SAX_TREE
- xmlGenericError(xmlGenericErrorContext, "Setting %s as root\n", name);
-#endif
- xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret);
- } else if (parent == NULL) {
- parent = ctxt->myDoc->children;
- }
- ctxt->nodemem = -1;
- if (ctxt->linenumbers) {
- if (ctxt->input != NULL)
- ret->content = (void *) (long) ctxt->input->line;
- }
-
- /*
- * We are parsing a new node.
- */
-#ifdef DEBUG_SAX_TREE
- xmlGenericError(xmlGenericErrorContext, "pushing(%s)\n", name);
-#endif
- nodePush(ctxt, ret);
-
- /*
- * Link the child element
- */
- if (parent != NULL) {
- if (parent->type == XML_ELEMENT_NODE) {
-#ifdef DEBUG_SAX_TREE
- xmlGenericError(xmlGenericErrorContext,
- "adding child %s to %s\n", name, parent->name);
-#endif
- xmlAddChild(parent, ret);
- } else {
-#ifdef DEBUG_SAX_TREE
- xmlGenericError(xmlGenericErrorContext,
- "adding sibling %s to ", name);
- xmlDebugDumpOneNode(stderr, parent, 0);
-#endif
- xmlAddSibling(parent, ret);
- }
- }
-
- /*
- * Insert all the defaulted attributes from the DTD especially namespaces
- */
- if ((!ctxt->html) &&
- ((ctxt->myDoc->intSubset != NULL) ||
- (ctxt->myDoc->extSubset != NULL))) {
- xmlCheckDefaultedAttributes(ctxt, name, prefix, atts);
- }
-
- /*
- * process all the attributes whose name start with "xmlns"
- */
- if (atts != NULL) {
- i = 0;
- att = atts[i++];
- value = atts[i++];
- if (!ctxt->html) {
- while ((att != NULL) && (value != NULL)) {
- if ((att[0] == 'x') && (att[1] == 'm') && (att[2] == 'l') &&
- (att[3] == 'n') && (att[4] == 's'))
- my_attribute(ctxt, att, value, prefix);
-
- att = atts[i++];
- value = atts[i++];
- }
- }
- }
-
- /*
- * Search the namespace, note that since the attributes have been
- * processed, the local namespaces are available.
- */
- ns = xmlSearchNs(ctxt->myDoc, ret, prefix);
- if ((ns == NULL) && (parent != NULL))
- ns = xmlSearchNs(ctxt->myDoc, parent, prefix);
- if ((prefix != NULL) && (ns == NULL)) {
- ns = xmlNewNs(ret, NULL, prefix);
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData,
- "Namespace prefix %s is not defined\n", prefix);
- }
-
- /*
- * set the namespace node, making sure that if the default namspace
- * is unbound on a parent we simply kee it NULL
- */
- if ((ns != NULL) && (ns->href != NULL) &&
- ((ns->href[0] != 0) || (ns->prefix != NULL)))
- xmlSetNs(ret, ns);
-
- /*
- * process all the other attributes
- */
- if (atts != NULL) {
- i = 0;
- att = atts[i++];
- value = atts[i++];
- if (ctxt->html) {
- while (att != NULL) {
- attribute(ctxt, att, value);
- att = atts[i++];
- value = atts[i++];
- }
- } else {
- while ((att != NULL) && (value != NULL)) {
- if ((att[0] != 'x') || (att[1] != 'm') || (att[2] != 'l') ||
- (att[3] != 'n') || (att[4] != 's'))
- attribute(ctxt, att, value);
-
- /*
- * Next ones
- */
- att = atts[i++];
- value = atts[i++];
- }
- }
- }
-
- /*
- * If it's the Document root, finish the DTD validation and
- * check the document root element for validity
- */
- if ((ctxt->validate) && (ctxt->vctxt.finishDtd == 0)) {
- int chk;
-
- chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc);
- if (chk <= 0)
- ctxt->valid = 0;
- if (chk < 0)
- ctxt->wellFormed = 0;
- ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
- ctxt->vctxt.finishDtd = 1;
- }
-
- if (prefix != NULL)
- xmlFree(prefix);
-
-}
-
-/**
- * endElement:
- * @ctx: the user data (XML parser context)
- * @name: The element name
- *
- * called when the end of an element has been detected.
- */
-void
-endElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlParserNodeInfo node_info;
- xmlNodePtr cur = ctxt->node;
-
-#ifdef DEBUG_SAX
- if (name == NULL)
- xmlGenericError(xmlGenericErrorContext, "SAX.endElement(NULL)\n");
- else
- xmlGenericError(xmlGenericErrorContext, "SAX.endElement(%s)\n", name);
-#endif
-
- /* Capture end position and add node */
- if (cur != NULL && ctxt->record_info) {
- node_info.end_pos = ctxt->input->cur - ctxt->input->base;
- node_info.end_line = ctxt->input->line;
- node_info.node = cur;
- xmlParserAddNodeInfo(ctxt, &node_info);
- }
- ctxt->nodemem = -1;
-
- if (ctxt->validate && ctxt->wellFormed &&
- ctxt->myDoc && ctxt->myDoc->intSubset)
- ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc,
- cur);
-
-
- /*
- * end of parsing of this node.
- */
-#ifdef DEBUG_SAX_TREE
- xmlGenericError(xmlGenericErrorContext, "popping(%s)\n", cur->name);
-#endif
- nodePop(ctxt);
-}
-
-/**
- * reference:
- * @ctx: the user data (XML parser context)
- * @name: The entity name
- *
- * called when an entity reference is detected.
- */
-void
-reference(void *ctx, const xmlChar *name)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlNodePtr ret;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.reference(%s)\n", name);
-#endif
- if (name[0] == '#')
- ret = xmlNewCharRef(ctxt->myDoc, name);
- else
- ret = xmlNewReference(ctxt->myDoc, name);
-#ifdef DEBUG_SAX_TREE
- xmlGenericError(xmlGenericErrorContext,
- "add reference %s to %s \n", name, ctxt->node->name);
-#endif
- xmlAddChild(ctxt->node, ret);
-}
-
-/**
- * characters:
- * @ctx: the user data (XML parser context)
- * @ch: a xmlChar string
- * @len: the number of xmlChar
- *
- * receiving some chars from the parser.
- */
-void
-characters(void *ctx, const xmlChar *ch, int len)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlNodePtr lastChild;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.characters(%.30s, %d)\n", ch, len);
-#endif
- /*
- * Handle the data if any. If there is no child
- * add it as content, otherwise if the last child is text,
- * concatenate it, else create a new node of type text.
- */
-
- if (ctxt->node == NULL) {
-#ifdef DEBUG_SAX_TREE
- xmlGenericError(xmlGenericErrorContext,
- "add chars: ctxt->node == NULL !\n");
-#endif
- return;
- }
- lastChild = xmlGetLastChild(ctxt->node);
-#ifdef DEBUG_SAX_TREE
- xmlGenericError(xmlGenericErrorContext,
- "add chars to %s \n", ctxt->node->name);
-#endif
-
- /*
- * Here we needed an accelerator mechanism in case of very large
- * elements. Use an attribute in the structure !!!
- */
- if (lastChild == NULL) {
- /* first node, first time */
- xmlNodeAddContentLen(ctxt->node, ch, len);
- if (ctxt->node->children != NULL) {
- ctxt->nodelen = len;
- ctxt->nodemem = len + 1;
- }
- } else {
- int coalesceText = (lastChild != NULL) &&
- (lastChild->type == XML_TEXT_NODE) &&
- (lastChild->name == xmlStringText);
- if ((coalesceText) && (ctxt->nodemem != 0)) {
- /*
- * The whole point of maintaining nodelen and nodemem,
- * xmlTextConcat is too costly, i.e. compute length,
- * reallocate a new buffer, move data, append ch. Here
- * We try to minimaze realloc() uses and avoid copying
- * and recomputing length over and over.
- */
- if (ctxt->nodelen + len >= ctxt->nodemem) {
- xmlChar *newbuf;
- int size;
-
- size = ctxt->nodemem + len;
- size *= 2;
- newbuf = (xmlChar *) xmlRealloc(lastChild->content,size);
- if (newbuf == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "SAX.characters(): out of memory\n");
- return;
- }
- ctxt->nodemem = size;
- lastChild->content = newbuf;
- }
- memcpy(&lastChild->content[ctxt->nodelen], ch, len);
- ctxt->nodelen += len;
- lastChild->content[ctxt->nodelen] = 0;
- } else if (coalesceText) {
- xmlTextConcat(lastChild, ch, len);
- if (ctxt->node->children != NULL) {
- ctxt->nodelen = xmlStrlen(lastChild->content);
- ctxt->nodemem = ctxt->nodelen + 1;
- }
- } else {
- /* Mixed content, first time */
- lastChild = xmlNewTextLen(ch, len);
- xmlAddChild(ctxt->node, lastChild);
- if (ctxt->node->children != NULL) {
- ctxt->nodelen = len;
- ctxt->nodemem = len + 1;
- }
- }
- }
-}
-
-/**
- * ignorableWhitespace:
- * @ctx: the user data (XML parser context)
- * @ch: a xmlChar string
- * @len: the number of xmlChar
- *
- * receiving some ignorable whitespaces from the parser.
- * UNUSED: by default the DOM building will use characters
- */
-void
-ignorableWhitespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUSED)
-{
- /* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.ignorableWhitespace(%.30s, %d)\n", ch, len);
-#endif
-}
-
-/**
- * processingInstruction:
- * @ctx: the user data (XML parser context)
- * @target: the target name
- * @data: the PI data's
- *
- * A processing instruction has been parsed.
- */
-void
-processingInstruction(void *ctx, const xmlChar *target,
- const xmlChar *data)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlNodePtr ret;
- xmlNodePtr parent = ctxt->node;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.processingInstruction(%s, %s)\n", target, data);
-#endif
-
- ret = xmlNewPI(target, data);
- if (ret == NULL) return;
- parent = ctxt->node;
-
- if (ctxt->inSubset == 1) {
- xmlAddChild((xmlNodePtr) ctxt->myDoc->intSubset, ret);
- return;
- } else if (ctxt->inSubset == 2) {
- xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret);
- return;
- }
- if ((ctxt->myDoc->children == NULL) || (parent == NULL)) {
-#ifdef DEBUG_SAX_TREE
- xmlGenericError(xmlGenericErrorContext,
- "Setting PI %s as root\n", target);
-#endif
- xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret);
- return;
- }
- if (parent->type == XML_ELEMENT_NODE) {
-#ifdef DEBUG_SAX_TREE
- xmlGenericError(xmlGenericErrorContext,
- "adding PI %s child to %s\n", target, parent->name);
-#endif
- xmlAddChild(parent, ret);
- } else {
-#ifdef DEBUG_SAX_TREE
- xmlGenericError(xmlGenericErrorContext,
- "adding PI %s sibling to ", target);
- xmlDebugDumpOneNode(stderr, parent, 0);
-#endif
- xmlAddSibling(parent, ret);
- }
-}
-
-/**
- * globalNamespace:
- * @ctx: the user data (XML parser context)
- * @href: the namespace associated URN
- * @prefix: the namespace prefix
- *
- * An old global namespace has been parsed.
- */
-void
-globalNamespace(void *ctx, const xmlChar *href, const xmlChar *prefix)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.globalNamespace(%s, %s)\n", href, prefix);
-#endif
- xmlNewGlobalNs(ctxt->myDoc, href, prefix);
-}
-
-/**
- * setNamespace:
- * @ctx: the user data (XML parser context)
- * @name: the namespace prefix
- *
- * Set the current element namespace.
- */
-
-void
-setNamespace(void *ctx, const xmlChar *name)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlNsPtr ns;
- xmlNodePtr parent;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext, "SAX.setNamespace(%s)\n", name);
-#endif
- ns = xmlSearchNs(ctxt->myDoc, ctxt->node, name);
- if (ns == NULL) { /* ctxt->node may not have a parent yet ! */
- if (ctxt->nodeNr >= 2) {
- parent = ctxt->nodeTab[ctxt->nodeNr - 2];
- if (parent != NULL)
- ns = xmlSearchNs(ctxt->myDoc, parent, name);
- }
- }
- xmlSetNs(ctxt->node, ns);
-}
-
-/**
- * getNamespace:
- * @ctx: the user data (XML parser context)
- *
- * Get the current element namespace.
- *
- * Returns the xmlNsPtr or NULL if none
- */
-
-xmlNsPtr
-getNamespace(void *ctx)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlNsPtr ret;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext, "SAX.getNamespace()\n");
-#endif
- ret = ctxt->node->ns;
- return(ret);
-}
-
-/**
- * checkNamespace:
- * @ctx: the user data (XML parser context)
- * @namespace: the namespace to check against
- *
- * Check that the current element namespace is the same as the
- * one read upon parsing.
- *
- * Returns 1 if true 0 otherwise
- */
-
-int
-checkNamespace(void *ctx, xmlChar *namespace)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlNodePtr cur = ctxt->node;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.checkNamespace(%s)\n", namespace);
-#endif
-
- /*
- * Check that the Name in the ETag is the same as in the STag.
- */
- if (namespace == NULL) {
- if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
- "End tags for %s don't hold the namespace %s\n",
- cur->name, cur->ns->prefix);
- ctxt->wellFormed = 0;
- }
- } else {
- if ((cur->ns == NULL) || (cur->ns->prefix == NULL)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
- "End tags %s holds a prefix %s not used by the open tag\n",
- cur->name, namespace);
- ctxt->wellFormed = 0;
- } else if (!xmlStrEqual(namespace, cur->ns->prefix)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
- "Start and End tags for %s don't use the same namespaces: %s and %s\n",
- cur->name, cur->ns->prefix, namespace);
- ctxt->wellFormed = 0;
- } else
- return(1);
- }
- return(0);
-}
-
-/**
- * namespaceDecl:
- * @ctx: the user data (XML parser context)
- * @href: the namespace associated URN
- * @prefix: the namespace prefix
- *
- * A namespace has been parsed.
- */
-void
-namespaceDecl(void *ctx, const xmlChar *href, const xmlChar *prefix)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
-#ifdef DEBUG_SAX
- if (prefix == NULL)
- xmlGenericError(xmlGenericErrorContext,
- "SAX.namespaceDecl(%s, NULL)\n", href);
- else
- xmlGenericError(xmlGenericErrorContext,
- "SAX.namespaceDecl(%s, %s)\n", href, prefix);
-#endif
- xmlNewNs(ctxt->node, href, prefix);
-}
-
-/**
- * comment:
- * @ctx: the user data (XML parser context)
- * @value: the comment content
- *
- * A comment has been parsed.
- */
-void
-comment(void *ctx, const xmlChar *value)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlNodePtr ret;
- xmlNodePtr parent = ctxt->node;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext, "SAX.comment(%s)\n", value);
-#endif
- ret = xmlNewDocComment(ctxt->myDoc, value);
- if (ret == NULL) return;
-
- if (ctxt->inSubset == 1) {
- xmlAddChild((xmlNodePtr) ctxt->myDoc->intSubset, ret);
- return;
- } else if (ctxt->inSubset == 2) {
- xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret);
- return;
- }
- if ((ctxt->myDoc->children == NULL) || (parent == NULL)) {
-#ifdef DEBUG_SAX_TREE
- xmlGenericError(xmlGenericErrorContext,
- "Setting comment as root\n");
-#endif
- xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret);
- return;
- }
- if (parent->type == XML_ELEMENT_NODE) {
-#ifdef DEBUG_SAX_TREE
- xmlGenericError(xmlGenericErrorContext,
- "adding comment child to %s\n", parent->name);
-#endif
- xmlAddChild(parent, ret);
- } else {
-#ifdef DEBUG_SAX_TREE
- xmlGenericError(xmlGenericErrorContext,
- "adding comment sibling to ");
- xmlDebugDumpOneNode(stderr, parent, 0);
-#endif
- xmlAddSibling(parent, ret);
- }
-}
-
-/**
- * cdataBlock:
- * @ctx: the user data (XML parser context)
- * @value: The pcdata content
- * @len: the block length
- *
- * called when a pcdata block has been parsed
- */
-void
-cdataBlock(void *ctx, const xmlChar *value, int len)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlNodePtr ret, lastChild;
-
-#ifdef DEBUG_SAX
- xmlGenericError(xmlGenericErrorContext,
- "SAX.pcdata(%.10s, %d)\n", value, len);
-#endif
- lastChild = xmlGetLastChild(ctxt->node);
-#ifdef DEBUG_SAX_TREE
- xmlGenericError(xmlGenericErrorContext,
- "add chars to %s \n", ctxt->node->name);
-#endif
- if ((lastChild != NULL) &&
- (lastChild->type == XML_CDATA_SECTION_NODE)) {
- xmlTextConcat(lastChild, value, len);
- } else {
- ret = xmlNewCDataBlock(ctxt->myDoc, value, len);
- xmlAddChild(ctxt->node, ret);
- }
-}
-
-/**
- * initxmlDefaultSAXHandler:
- * @hdlr: the SAX handler
- * @warning: flag if non-zero sets the handler warning procedure
- *
- * Initialize the default XML SAX handler
- */
-void
-initxmlDefaultSAXHandler(xmlSAXHandler *hdlr, int warning)
-{
- if(hdlr->initialized == 1)
- return;
-
- hdlr->internalSubset = internalSubset;
- hdlr->externalSubset = externalSubset;
- hdlr->isStandalone = isStandalone;
- hdlr->hasInternalSubset = hasInternalSubset;
- hdlr->hasExternalSubset = hasExternalSubset;
- hdlr->resolveEntity = resolveEntity;
- hdlr->getEntity = getEntity;
- hdlr->getParameterEntity = getParameterEntity;
- hdlr->entityDecl = entityDecl;
- hdlr->attributeDecl = attributeDecl;
- hdlr->elementDecl = elementDecl;
- hdlr->notationDecl = notationDecl;
- hdlr->unparsedEntityDecl = unparsedEntityDecl;
- hdlr->setDocumentLocator = setDocumentLocator;
- hdlr->startDocument = startDocument;
- hdlr->endDocument = endDocument;
- hdlr->startElement = startElement;
- hdlr->endElement = endElement;
- hdlr->reference = reference;
- hdlr->characters = characters;
- hdlr->cdataBlock = cdataBlock;
- hdlr->ignorableWhitespace = characters;
- hdlr->processingInstruction = processingInstruction;
- hdlr->comment = comment;
- /* if (xmlGetWarningsDefaultValue == 0) */
- if (warning == 0)
- hdlr->warning = NULL;
- else
- hdlr->warning = xmlParserWarning;
- hdlr->error = xmlParserError;
- hdlr->fatalError = xmlParserError;
-
- hdlr->initialized = 1;
-}
-
-/**
- * xmlDefaultSAXHandlerInit:
- *
- * Initialize the default SAX handler
- */
-void
-xmlDefaultSAXHandlerInit(void)
-{
- initxmlDefaultSAXHandler(&xmlDefaultSAXHandler, xmlGetWarningsDefaultValue);
-}
-
-#ifdef LIBXML_HTML_ENABLED
-
-/**
- * inithtmlDefaultSAXHandler:
- * @hdlr: the SAX handler
- *
- * Initialize the default HTML SAX handler
- */
-void
-inithtmlDefaultSAXHandler(xmlSAXHandler *hdlr)
-{
- if(hdlr->initialized == 1)
- return;
-
- hdlr->internalSubset = internalSubset;
- hdlr->externalSubset = NULL;
- hdlr->isStandalone = NULL;
- hdlr->hasInternalSubset = NULL;
- hdlr->hasExternalSubset = NULL;
- hdlr->resolveEntity = NULL;
- hdlr->getEntity = getEntity;
- hdlr->getParameterEntity = NULL;
- hdlr->entityDecl = NULL;
- hdlr->attributeDecl = NULL;
- hdlr->elementDecl = NULL;
- hdlr->notationDecl = NULL;
- hdlr->unparsedEntityDecl = NULL;
- hdlr->setDocumentLocator = setDocumentLocator;
- hdlr->startDocument = startDocument;
- hdlr->endDocument = endDocument;
- hdlr->startElement = startElement;
- hdlr->endElement = endElement;
- hdlr->reference = NULL;
- hdlr->characters = characters;
- hdlr->cdataBlock = cdataBlock;
- hdlr->ignorableWhitespace = ignorableWhitespace;
- hdlr->processingInstruction = NULL;
- hdlr->comment = comment;
- hdlr->warning = xmlParserWarning;
- hdlr->error = xmlParserError;
- hdlr->fatalError = xmlParserError;
-
- hdlr->initialized = 1;
-}
-
-/**
- * htmlDefaultSAXHandlerInit:
- *
- * Initialize the default SAX handler
- */
-void
-htmlDefaultSAXHandlerInit(void)
-{
- inithtmlDefaultSAXHandler(&htmlDefaultSAXHandler);
-}
-
-#endif /* LIBXML_HTML_ENABLED */
-
-#ifdef LIBXML_DOCB_ENABLED
-
-/**
- * initdocbDefaultSAXHandler:
- * @hdlr: the SAX handler
- *
- * Initialize the default DocBook SAX handler
- */
-void
-initdocbDefaultSAXHandler(xmlSAXHandler *hdlr)
-{
- if(hdlr->initialized == 1)
- return;
-
- hdlr->internalSubset = internalSubset;
- hdlr->externalSubset = NULL;
- hdlr->isStandalone = isStandalone;
- hdlr->hasInternalSubset = hasInternalSubset;
- hdlr->hasExternalSubset = hasExternalSubset;
- hdlr->resolveEntity = resolveEntity;
- hdlr->getEntity = getEntity;
- hdlr->getParameterEntity = NULL;
- hdlr->entityDecl = entityDecl;
- hdlr->attributeDecl = NULL;
- hdlr->elementDecl = NULL;
- hdlr->notationDecl = NULL;
- hdlr->unparsedEntityDecl = NULL;
- hdlr->setDocumentLocator = setDocumentLocator;
- hdlr->startDocument = startDocument;
- hdlr->endDocument = endDocument;
- hdlr->startElement = startElement;
- hdlr->endElement = endElement;
- hdlr->reference = reference;
- hdlr->characters = characters;
- hdlr->cdataBlock = NULL;
- hdlr->ignorableWhitespace = ignorableWhitespace;
- hdlr->processingInstruction = NULL;
- hdlr->comment = comment;
- hdlr->warning = xmlParserWarning;
- hdlr->error = xmlParserError;
- hdlr->fatalError = xmlParserError;
-
- hdlr->initialized = 1;
-}
-
-/**
- * docbDefaultSAXHandlerInit:
- *
- * Initialize the default SAX handler
- */
-void
-docbDefaultSAXHandlerInit(void)
-{
- initdocbDefaultSAXHandler(&docbDefaultSAXHandler);
-}
-
-#endif /* LIBXML_DOCB_ENABLED */
diff --git a/bundle/libxml/c14n.c b/bundle/libxml/c14n.c
deleted file mode 100644
index cd410ccf1f..0000000000
--- a/bundle/libxml/c14n.c
+++ /dev/null
@@ -1,1930 +0,0 @@
-/*
- * "Canonical XML" implementation
- * http://www.w3.org/TR/xml-c14n
- *
- * "Exclusive XML Canonicalization" implementation
- * http://www.w3.org/TR/xml-exc-c14n
- *
- * See Copyright for the status of this software.
- *
- * Author: Aleksey Sanin <aleksey@aleksey.com>
- */
-#define IN_LIBXML
-#include "libxml.h"
-#ifdef LIBXML_C14N_ENABLED
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include <string.h>
-
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/uri.h>
-#include <libxml/xmlerror.h>
-#include <libxml/globals.h>
-#include <libxml/xpathInternals.h>
-#include <libxml/c14n.h>
-
-/************************************************************************
- * *
- * Some declaration better left private ATM *
- * *
- ************************************************************************/
-
-typedef enum {
- XMLC14N_BEFORE_DOCUMENT_ELEMENT = 0,
- XMLC14N_INSIDE_DOCUMENT_ELEMENT = 1,
- XMLC14N_AFTER_DOCUMENT_ELEMENT = 2
-} xmlC14NPosition;
-
-typedef struct _xmlC14NVisibleNsStack {
- int nsCurEnd; /* number of nodes in the set */
- int nsPrevStart; /* the begginning of the stack for previous visible node */
- int nsPrevEnd; /* the end of the stack for previous visible node */
- int nsMax; /* size of the array as allocated */
- xmlNsPtr *nsTab; /* array of ns in no particular order */
- xmlNodePtr *nodeTab;/* array of nodes in no particular order */
-} xmlC14NVisibleNsStack, *xmlC14NVisibleNsStackPtr;
-
-typedef struct _xmlC14NCtx {
- /* input parameters */
- xmlDocPtr doc;
- xmlC14NIsVisibleCallback is_visible_callback;
- void* user_data;
- int with_comments;
- xmlOutputBufferPtr buf;
-
- /* position in the XML document */
- xmlC14NPosition pos;
- int parent_is_doc;
- xmlC14NVisibleNsStackPtr ns_rendered;
-
- /* exclusive canonicalization */
- int exclusive;
- xmlChar **inclusive_ns_prefixes;
-} xmlC14NCtx, *xmlC14NCtxPtr;
-
-static xmlC14NVisibleNsStackPtr xmlC14NVisibleNsStackCreate (void);
-static void xmlC14NVisibleNsStackDestroy (xmlC14NVisibleNsStackPtr cur);
-static void xmlC14NVisibleNsStackAdd (xmlC14NVisibleNsStackPtr cur,
- xmlNsPtr ns,
- xmlNodePtr node);
-static void xmlC14NVisibleNsStackSave (xmlC14NVisibleNsStackPtr cur,
- xmlC14NVisibleNsStackPtr state);
-static void xmlC14NVisibleNsStackRestore (xmlC14NVisibleNsStackPtr cur,
- xmlC14NVisibleNsStackPtr state);
-static void xmlC14NVisibleNsStackShift (xmlC14NVisibleNsStackPtr cur);
-static int xmlC14NVisibleNsStackFind (xmlC14NVisibleNsStackPtr cur,
- xmlNsPtr ns);
-static int xmlExcC14NVisibleNsStackFind (xmlC14NVisibleNsStackPtr cur,
- xmlNsPtr ns,
- xmlC14NCtxPtr ctx);
-
-static int xmlC14NIsNodeInNodeset (xmlNodeSetPtr nodes,
- xmlNodePtr node,
- xmlNodePtr parent);
-
-
-
-static int xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur);
-static int xmlC14NProcessNodeList(xmlC14NCtxPtr ctx, xmlNodePtr cur);
-typedef enum {
- XMLC14N_NORMALIZE_ATTR = 0,
- XMLC14N_NORMALIZE_COMMENT = 1,
- XMLC14N_NORMALIZE_PI = 2,
- XMLC14N_NORMALIZE_TEXT = 3
-} xmlC14NNormalizationMode;
-
-static xmlChar *xmlC11NNormalizeString(const xmlChar * input,
- xmlC14NNormalizationMode mode);
-
-#define xmlC11NNormalizeAttr( a ) \
- xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_ATTR)
-#define xmlC11NNormalizeComment( a ) \
- xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_COMMENT)
-#define xmlC11NNormalizePI( a ) \
- xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_PI)
-#define xmlC11NNormalizeText( a ) \
- xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_TEXT)
-
-#define xmlC14NIsVisible( ctx, node, parent ) \
- (((ctx)->is_visible_callback != NULL) ? \
- (ctx)->is_visible_callback((ctx)->user_data, \
- (xmlNodePtr)(node), (xmlNodePtr)(parent)) : 1)
-/************************************************************************
- * *
- * The implementation internals *
- * *
- ************************************************************************/
-#define XML_NAMESPACES_DEFAULT 16
-
-static int
-xmlC14NIsNodeInNodeset(xmlNodeSetPtr nodes, xmlNodePtr node, xmlNodePtr parent) {
- if((nodes != NULL) && (node != NULL)) {
- if(node->type != XML_NAMESPACE_DECL) {
- return(xmlXPathNodeSetContains(nodes, node));
- } else {
- xmlNs ns;
-
- memcpy(&ns, node, sizeof(ns));
- ns.next = (xmlNsPtr)parent; /* this is a libxml hack! check xpath.c for details */
-
- /*
- * If the input is an XPath node-set, then the node-set must explicitly
- * contain every node to be rendered to the canonical form.
- */
- return(xmlXPathNodeSetContains(nodes, (xmlNodePtr)&ns));
- }
- }
- return(1);
-}
-
-static xmlC14NVisibleNsStackPtr
-xmlC14NVisibleNsStackCreate(void) {
- xmlC14NVisibleNsStackPtr ret;
-
- ret = (xmlC14NVisibleNsStackPtr) xmlMalloc(sizeof(xmlC14NVisibleNsStack));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NVisibleNsStackCreate: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlC14NVisibleNsStack));
- return(ret);
-}
-
-static void
-xmlC14NVisibleNsStackDestroy(xmlC14NVisibleNsStackPtr cur) {
- if(cur == NULL) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NVisibleNsStackDestroy: cur is null.\n");
-#endif
- return;
- }
- if(cur->nsTab != NULL) {
- memset(cur->nsTab, 0, cur->nsMax * sizeof(xmlNsPtr));
- xmlFree(cur->nsTab);
- }
- if(cur->nodeTab != NULL) {
- memset(cur->nodeTab, 0, cur->nsMax * sizeof(xmlNodePtr));
- xmlFree(cur->nodeTab);
- }
- memset(cur, 0, sizeof(xmlC14NVisibleNsStack));
- xmlFree(cur);
-
-}
-
-static void
-xmlC14NVisibleNsStackAdd(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlNodePtr node) {
- if((cur == NULL) ||
- ((cur->nsTab == NULL) && (cur->nodeTab != NULL)) ||
- ((cur->nsTab != NULL) && (cur->nodeTab == NULL))) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NVisibleNsStackAdd: cur is null.\n");
-#endif
- return;
- }
-
- if ((cur->nsTab == NULL) && (cur->nodeTab == NULL)) {
- cur->nsTab = (xmlNsPtr*) xmlMalloc(XML_NAMESPACES_DEFAULT * sizeof(xmlNsPtr));
- cur->nodeTab = (xmlNodePtr*) xmlMalloc(XML_NAMESPACES_DEFAULT * sizeof(xmlNodePtr));
- if ((cur->nsTab == NULL) || (cur->nodeTab == NULL)) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NVisibleNsStackAdd: out of memory\n");
- return;
- }
- memset(cur->nsTab, 0 , XML_NAMESPACES_DEFAULT * sizeof(xmlNsPtr));
- memset(cur->nodeTab, 0 , XML_NAMESPACES_DEFAULT * sizeof(xmlNodePtr));
- cur->nsMax = XML_NAMESPACES_DEFAULT;
- } else if(cur->nsMax == cur->nsCurEnd) {
- void *tmp;
- int tmpSize;
-
- tmpSize = 2 * cur->nsMax;
- tmp = xmlRealloc(cur->nsTab, tmpSize * sizeof(xmlNsPtr));
- if (tmp == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NVisibleNsStackAdd: out of memory\n");
- return;
- }
- cur->nsTab = (xmlNsPtr*)tmp;
-
- tmp = xmlRealloc(cur->nodeTab, tmpSize * sizeof(xmlNodePtr));
- if (tmp == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NVisibleNsStackAdd: out of memory\n");
- return;
- }
- cur->nodeTab = (xmlNodePtr*)tmp;
-
- cur->nsMax = tmpSize;
- }
- cur->nsTab[cur->nsCurEnd] = ns;
- cur->nodeTab[cur->nsCurEnd] = node;
-
- ++cur->nsCurEnd;
-}
-
-static void
-xmlC14NVisibleNsStackSave(xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStackPtr state) {
- if((cur == NULL) || (state == NULL)) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NVisibleNsStackSave: cur or state is null.\n");
-#endif
- return;
- }
-
- state->nsCurEnd = cur->nsCurEnd;
- state->nsPrevStart = cur->nsPrevStart;
- state->nsPrevEnd = cur->nsPrevEnd;
-}
-
-static void
-xmlC14NVisibleNsStackRestore(xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStackPtr state) {
- if((cur == NULL) || (state == NULL)) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NVisibleNsStackRestore: cur or state is null.\n");
-#endif
- return;
- }
- cur->nsCurEnd = state->nsCurEnd;
- cur->nsPrevStart = state->nsPrevStart;
- cur->nsPrevEnd = state->nsPrevEnd;
-}
-
-static void
-xmlC14NVisibleNsStackShift(xmlC14NVisibleNsStackPtr cur) {
- if(cur == NULL) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NVisibleNsStackRestore: cur is null.\n");
-#endif
- return;
- }
- cur->nsPrevStart = cur->nsPrevEnd;
- cur->nsPrevEnd = cur->nsCurEnd;
-}
-
-static int
-xmlC14NStrEqual(const xmlChar *str1, const xmlChar *str2) {
- if (str1 == str2) return(1);
- if (str1 == NULL) return((*str2) == '\0');
- if (str2 == NULL) return((*str1) == '\0');
- do {
- if (*str1++ != *str2) return(0);
- } while (*str2++);
- return(1);
-}
-
-/**
- * xmlC14NVisibleNsStackFind:
- * @ctx: the C14N context
- * @ns: the namespace to check
- *
- * Checks whether the given namespace was already rendered or not
- *
- * Returns 1 if we already wrote this namespace or 0 otherwise
- */
-static int
-xmlC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns)
-{
- int i;
- const xmlChar *prefix;
- const xmlChar *href;
- int has_empty_ns;
-
- if(cur == NULL) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NVisibleNsStackFind: cur is null.\n");
-#endif
- return (0);
- }
-
- /*
- * if the default namespace xmlns="" is not defined yet then
- * we do not want to print it out
- */
- prefix = ((ns == NULL) || (ns->prefix == NULL)) ? BAD_CAST "" : ns->prefix;
- href = ((ns == NULL) || (ns->href == NULL)) ? BAD_CAST "" : ns->href;
- has_empty_ns = (xmlC14NStrEqual(prefix, NULL) && xmlC14NStrEqual(href, NULL));
-
- if (cur->nsTab != NULL) {
- int start = (has_empty_ns) ? 0 : cur->nsPrevStart;
- for (i = cur->nsCurEnd - 1; i >= start; --i) {
- xmlNsPtr ns1 = cur->nsTab[i];
-
- if(xmlC14NStrEqual(prefix, (ns1 != NULL) ? ns1->prefix : NULL)) {
- return(xmlC14NStrEqual(href, (ns1 != NULL) ? ns1->href : NULL));
- }
- }
- }
- return(has_empty_ns);
-}
-
-static int
-xmlExcC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlC14NCtxPtr ctx) {
- int i;
- const xmlChar *prefix;
- const xmlChar *href;
- int has_empty_ns;
-
- if(cur == NULL) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlExcC14NVisibleNsStackFind: cur is null.\n");
-#endif
- return (0);
- }
-
- /*
- * if the default namespace xmlns="" is not defined yet then
- * we do not want to print it out
- */
- prefix = ((ns == NULL) || (ns->prefix == NULL)) ? BAD_CAST "" : ns->prefix;
- href = ((ns == NULL) || (ns->href == NULL)) ? BAD_CAST "" : ns->href;
- has_empty_ns = (xmlC14NStrEqual(prefix, NULL) && xmlC14NStrEqual(href, NULL));
-
- if (cur->nsTab != NULL) {
- int start = 0;
- for (i = cur->nsCurEnd - 1; i >= start; --i) {
- xmlNsPtr ns1 = cur->nsTab[i];
-
- if(xmlC14NStrEqual(prefix, (ns1 != NULL) ? ns1->prefix : NULL)) {
- if(xmlC14NStrEqual(href, (ns1 != NULL) ? ns1->href : NULL)) {
- return(xmlC14NIsVisible(ctx, ns1, cur->nodeTab[i]));
- } else {
- return(0);
- }
- }
- }
- }
- return(has_empty_ns);
-}
-
-
-
-
-/**
- * xmlC14NIsXmlNs:
- * @ns: the namespace to check
- *
- * Checks whether the given namespace is a default "xml:" namespace
- * with href="http://www.w3.org/XML/1998/namespace"
- *
- * Returns 1 if the node is default or 0 otherwise
- */
-
-/* todo: make it a define? */
-static int
-xmlC14NIsXmlNs(xmlNsPtr ns)
-{
- return ((ns != NULL) &&
- (xmlStrEqual(ns->prefix, BAD_CAST "xml")) &&
- (xmlStrEqual(ns->href,
- BAD_CAST
- "http://www.w3.org/XML/1998/namespace")));
-}
-
-
-/**
- * xmlC14NNsCompare:
- * @ns1: the pointer to first namespace
- * @ns2: the pointer to second namespace
- *
- * Compares the namespaces by names (prefixes).
- *
- * Returns -1 if ns1 < ns2, 0 if ns1 == ns2 or 1 if ns1 > ns2.
- */
-static int
-xmlC14NNsCompare(xmlNsPtr ns1, xmlNsPtr ns2)
-{
- if (ns1 == ns2)
- return (0);
- if (ns1 == NULL)
- return (-1);
- if (ns2 == NULL)
- return (1);
-
- return (xmlStrcmp(ns1->prefix, ns2->prefix));
-}
-
-
-/**
- * xmlC14NPrintNamespaces:
- * @ns: the pointer to namespace
- * @ctx: the C14N context
- *
- * Prints the given namespace to the output buffer from C14N context.
- *
- * Returns 1 on success or 0 on fail.
- */
-static int
-xmlC14NPrintNamespaces(const xmlNsPtr ns, xmlC14NCtxPtr ctx)
-{
-
- if ((ns == NULL) || (ctx == NULL)) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NPrintNamespace: namespace or context pointer is null\n");
-#endif
- return 0;
- }
-
- if (ns->prefix != NULL) {
- xmlOutputBufferWriteString(ctx->buf, " xmlns:");
- xmlOutputBufferWriteString(ctx->buf, (const char *) ns->prefix);
- xmlOutputBufferWriteString(ctx->buf, "=\"");
- } else {
- xmlOutputBufferWriteString(ctx->buf, " xmlns=\"");
- }
- if(ns->href != NULL) {
- xmlOutputBufferWriteString(ctx->buf, (const char *) ns->href);
- }
- xmlOutputBufferWriteString(ctx->buf, "\"");
- return (1);
-}
-
-/**
- * xmlC14NProcessNamespacesAxis:
- * @ctx: the C14N context
- * @node: the current node
- *
- * Prints out canonical namespace axis of the current node to the
- * buffer from C14N context as follows
- *
- * Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n)
- *
- * Namespace Axis
- * Consider a list L containing only namespace nodes in the
- * axis and in the node-set in lexicographic order (ascending). To begin
- * processing L, if the first node is not the default namespace node (a node
- * with no namespace URI and no local name), then generate a space followed
- * by xmlns="" if and only if the following conditions are met:
- * - the element E that owns the axis is in the node-set
- * - The nearest ancestor element of E in the node-set has a default
- * namespace node in the node-set (default namespace nodes always
- * have non-empty values in XPath)
- * The latter condition eliminates unnecessary occurrences of xmlns="" in
- * the canonical form since an element only receives an xmlns="" if its
- * default namespace is empty and if it has an immediate parent in the
- * canonical form that has a non-empty default namespace. To finish
- * processing L, simply process every namespace node in L, except omit
- * namespace node with local name xml, which defines the xml prefix,
- * if its string value is http://www.w3.org/XML/1998/namespace.
- *
- * Exclusive XML Canonicalization v 1.0 (http://www.w3.org/TR/xml-exc-c14n)
- * Canonical XML applied to a document subset requires the search of the
- * ancestor nodes of each orphan element node for attributes in the xml
- * namespace, such as xml:lang and xml:space. These are copied into the
- * element node except if a declaration of the same attribute is already
- * in the attribute axis of the element (whether or not it is included in
- * the document subset). This search and copying are omitted from the
- * Exclusive XML Canonicalization method.
- *
- * Returns 0 on success or -1 on fail.
- */
-static int
-xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
-{
- xmlNodePtr n;
- xmlNsPtr ns, tmp;
- xmlListPtr list;
- int already_rendered;
- int has_empty_ns = 0;
-
- if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessNamespacesAxis: Null context or node pointer or type != XML_ELEMENT_NODE.\n");
-#endif
- return (-1);
- }
-
- /*
- * Create a sorted list to store element namespaces
- */
- list = xmlListCreate(NULL, (xmlListDataCompare) xmlC14NNsCompare);
- if (list == NULL) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessNamespacesAxis: list creation failed\n");
-#endif
- return (-1);
- }
-
- /* check all namespaces */
- for(n = cur; n != NULL; n = n->parent) {
- for(ns = n->nsDef; ns != NULL; ns = ns->next) {
- tmp = xmlSearchNs(cur->doc, cur, ns->prefix);
-
- if((tmp == ns) && !xmlC14NIsXmlNs(ns) && xmlC14NIsVisible(ctx, ns, cur)) {
- already_rendered = xmlC14NVisibleNsStackFind(ctx->ns_rendered, ns);
- if(visible) {
- xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur);
- }
- if(!already_rendered) {
- xmlListInsert(list, ns);
- }
- if(xmlStrlen(ns->prefix) == 0) {
- has_empty_ns = 1;
- }
- }
- }
- }
-
- /**
- * if the first node is not the default namespace node (a node with no
- * namespace URI and no local name), then generate a space followed by
- * xmlns="" if and only if the following conditions are met:
- * - the element E that owns the axis is in the node-set
- * - the nearest ancestor element of E in the node-set has a default
- * namespace node in the node-set (default namespace nodes always
- * have non-empty values in XPath)
- */
- if(visible && !has_empty_ns) {
- static xmlNs ns_default;
-
- memset(&ns_default, 0, sizeof(ns_default));
- if(!xmlC14NVisibleNsStackFind(ctx->ns_rendered, &ns_default)) {
- xmlC14NPrintNamespaces(&ns_default, ctx);
- }
- }
-
-
- /*
- * print out all elements from list
- */
- xmlListWalk(list, (xmlListWalker) xmlC14NPrintNamespaces, (const void *) ctx);
-
- /*
- * Cleanup
- */
- xmlListDelete(list);
- return (0);
-}
-
-
-/**
- * xmlExcC14NProcessNamespacesAxis:
- * @ctx: the C14N context
- * @node: the current node
- *
- * Prints out exclusive canonical namespace axis of the current node to the
- * buffer from C14N context as follows
- *
- * Exclusive XML Canonicalization
- * http://www.w3.org/TR/xml-exc-c14n
- *
- * If the element node is in the XPath subset then output the node in
- * accordance with Canonical XML except for namespace nodes which are
- * rendered as follows:
- *
- * 1. Render each namespace node iff:
- * * it is visibly utilized by the immediate parent element or one of
- * its attributes, or is present in InclusiveNamespaces PrefixList, and
- * * its prefix and value do not appear in ns_rendered. ns_rendered is
- * obtained by popping the state stack in order to obtain a list of
- * prefixes and their values which have already been rendered by
- * an output ancestor of the namespace node's parent element.
- * 2. Append the rendered namespace node to the list ns_rendered of namespace
- * nodes rendered by output ancestors. Push ns_rendered on state stack and
- * recurse.
- * 3. After the recursion returns, pop thestate stack.
- *
- *
- * Returns 0 on success or -1 on fail.
- */
-static int
-xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
-{
- xmlNsPtr ns;
- xmlListPtr list;
- xmlAttrPtr attr;
- int already_rendered;
- int has_empty_ns = 0;
- int has_visibly_utilized_empty_ns = 0;
- int has_empty_ns_in_inclusive_list = 0;
-
- if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlExcC14NProcessNamespacesAxis: Null context or node pointer or type != XML_ELEMENT_NODE.\n");
-#endif
- return (-1);
- }
-
- if(!ctx->exclusive) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlExcC14NProcessNamespacesAxis: called for non-exclusive canonization or rendered stack is NULL.\n");
-#endif
- return (-1);
-
- }
-
- /*
- * Create a sorted list to store element namespaces
- */
- list = xmlListCreate(NULL, (xmlListDataCompare) xmlC14NNsCompare);
- if (list == NULL) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlExcC14NProcessNamespacesAxis: list creation failed\n");
-#endif
- return (-1);
- }
-
- /*
- * process inclusive namespaces:
- * All namespace nodes appearing on inclusive ns list are
- * handled as provided in Canonical XML
- */
- if(ctx->inclusive_ns_prefixes != NULL) {
- xmlChar *prefix;
- int i;
-
- for (i = 0; ctx->inclusive_ns_prefixes[i] != NULL; ++i) {
- prefix = ctx->inclusive_ns_prefixes[i];
- /*
- * Special values for namespace with empty prefix
- */
- if (xmlStrEqual(prefix, BAD_CAST "#default")
- || xmlStrEqual(prefix, BAD_CAST "")) {
- prefix = NULL;
- has_empty_ns_in_inclusive_list = 1;
- }
-
- ns = xmlSearchNs(cur->doc, cur, prefix);
- if((ns != NULL) && !xmlC14NIsXmlNs(ns) && xmlC14NIsVisible(ctx, ns, cur)) {
- already_rendered = xmlC14NVisibleNsStackFind(ctx->ns_rendered, ns);
- if(visible) {
- xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur);
- }
- if(!already_rendered) {
- xmlListInsert(list, ns);
- }
- if(xmlStrlen(ns->prefix) == 0) {
- has_empty_ns = 1;
- }
- }
- }
- }
-
- /* add node namespace */
- if(cur->ns != NULL) {
- ns = cur->ns;
- } else {
- ns = xmlSearchNs(cur->doc, cur, NULL);
- has_visibly_utilized_empty_ns = 1;
- }
- if((ns != NULL) && !xmlC14NIsXmlNs(ns)) {
- if(visible && xmlC14NIsVisible(ctx, ns, cur)) {
- if(!xmlExcC14NVisibleNsStackFind(ctx->ns_rendered, ns, ctx)) {
- xmlListInsert(list, ns);
- }
- }
- if(visible) {
- xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur);
- }
- if(xmlStrlen(ns->prefix) == 0) {
- has_empty_ns = 1;
- }
- }
-
-
- /* add attributes */
- for(attr = cur->properties; attr != NULL; attr = attr->next) {
- /*
- * we need to check that attribute is visible and has non
- * default namespace (XML Namespaces: "default namespaces
- * do not apply directly to attributes")
- */
- if((attr->ns != NULL) && xmlC14NIsVisible(ctx, attr, cur)) {
- already_rendered = xmlExcC14NVisibleNsStackFind(ctx->ns_rendered, attr->ns, ctx);
- xmlC14NVisibleNsStackAdd(ctx->ns_rendered, attr->ns, (xmlNodePtr)attr);
- if(!already_rendered && visible) {
- xmlListInsert(list, attr->ns);
- }
- if(xmlStrlen(attr->ns->prefix) == 0) {
- has_empty_ns = 1;
- }
- } else if(attr->ns == NULL) {
- has_visibly_utilized_empty_ns = 1;
- }
- }
-
- /*
- * Process xmlns=""
- */
- if(visible && has_visibly_utilized_empty_ns &&
- !has_empty_ns && !has_empty_ns_in_inclusive_list) {
- static xmlNs ns_default;
-
- memset(&ns_default, 0, sizeof(ns_default));
-
- already_rendered = xmlExcC14NVisibleNsStackFind(ctx->ns_rendered, &ns_default, ctx);
- if(!already_rendered) {
- xmlC14NPrintNamespaces(&ns_default, ctx);
- }
- } else if(visible && !has_empty_ns && has_empty_ns_in_inclusive_list) {
- static xmlNs ns_default;
-
- memset(&ns_default, 0, sizeof(ns_default));
- if(!xmlC14NVisibleNsStackFind(ctx->ns_rendered, &ns_default)) {
- xmlC14NPrintNamespaces(&ns_default, ctx);
- }
- }
-
-
-
- /*
- * print out all elements from list
- */
- xmlListWalk(list, (xmlListWalker) xmlC14NPrintNamespaces, (const void *) ctx);
-
- /*
- * Cleanup
- */
- xmlListDelete(list);
- return (0);
-}
-
-
-/**
- * xmlC14NAttrsCompare:
- * @attr1: the pointer tls o first attr
- * @attr2: the pointer to second attr
- *
- * Prints the given attribute to the output buffer from C14N context.
- *
- * Returns -1 if attr1 < attr2, 0 if attr1 == attr2 or 1 if attr1 > attr2.
- */
-static int
-xmlC14NAttrsCompare(xmlAttrPtr attr1, xmlAttrPtr attr2)
-{
- int ret = 0;
-
- /*
- * Simple cases
- */
- if (attr1 == attr2)
- return (0);
- if (attr1 == NULL)
- return (-1);
- if (attr2 == NULL)
- return (1);
- if (attr1->ns == attr2->ns) {
- return (xmlStrcmp(attr1->name, attr2->name));
- }
-
- /*
- * Attributes in the default namespace are first
- * because the default namespace is not applied to
- * unqualified attributes
- */
- if (attr1->ns == NULL)
- return (-1);
- if (attr2->ns == NULL)
- return (1);
- if (attr1->ns->prefix == NULL)
- return (-1);
- if (attr2->ns->prefix == NULL)
- return (1);
-
- ret = xmlStrcmp(attr1->ns->href, attr2->ns->href);
- if (ret == 0) {
- ret = xmlStrcmp(attr1->name, attr2->name);
- }
- return (ret);
-}
-
-
-/**
- * xmlC14NPrintAttrs:
- * @attr: the pointer to attr
- * @ctx: the C14N context
- *
- * Prints out canonical attribute urrent node to the
- * buffer from C14N context as follows
- *
- * Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n)
- *
- * Returns 1 on success or 0 on fail.
- */
-static int
-xmlC14NPrintAttrs(const xmlAttrPtr attr, xmlC14NCtxPtr ctx)
-{
- xmlChar *value;
- xmlChar *buffer;
-
- if ((attr == NULL) || (ctx == NULL)) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NPrintAttrs: attr == NULL or ctx == NULL\n");
-#endif
- return (0);
- }
-
- xmlOutputBufferWriteString(ctx->buf, " ");
- if (attr->ns != NULL && xmlStrlen(attr->ns->prefix) > 0) {
- xmlOutputBufferWriteString(ctx->buf,
- (const char *) attr->ns->prefix);
- xmlOutputBufferWriteString(ctx->buf, ":");
- }
- xmlOutputBufferWriteString(ctx->buf, (const char *) attr->name);
- xmlOutputBufferWriteString(ctx->buf, "=\"");
-
- value = xmlNodeListGetString(attr->doc, attr->children, 1);
- /* todo: should we log an error if value==NULL ? */
- if (value != NULL) {
- buffer = xmlC11NNormalizeAttr(value);
- xmlFree(value);
- if (buffer != NULL) {
- xmlOutputBufferWriteString(ctx->buf, (const char *) buffer);
- xmlFree(buffer);
- } else {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NPrintAttrs: xmlC11NNormalizeAttr failed\n");
-#endif
- return (0);
- }
- }
- xmlOutputBufferWriteString(ctx->buf, "\"");
- return (1);
-}
-
-/**
- * xmlC14NProcessAttrsAxis:
- * @ctx: the C14N context
- * @cur: the current node
- *
- * Prints out canonical attribute axis of the current node to the
- * buffer from C14N context as follows
- *
- * Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n)
- *
- * Attribute Axis
- * In lexicographic order (ascending), process each node that
- * is in the element's attribute axis and in the node-set.
- *
- * The processing of an element node E MUST be modified slightly
- * when an XPath node-set is given as input and the element's
- * parent is omitted from the node-set.
- *
- *
- * Exclusive XML Canonicalization v 1.0 (http://www.w3.org/TR/xml-exc-c14n)
- *
- * Canonical XML applied to a document subset requires the search of the
- * ancestor nodes of each orphan element node for attributes in the xml
- * namespace, such as xml:lang and xml:space. These are copied into the
- * element node except if a declaration of the same attribute is already
- * in the attribute axis of the element (whether or not it is included in
- * the document subset). This search and copying are omitted from the
- * Exclusive XML Canonicalization method.
- *
- * Returns 0 on success or -1 on fail.
- */
-static int
-xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur)
-{
- xmlAttrPtr attr;
- xmlListPtr list;
-
- if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessAttrsAxis: Null context or node pointer or type != XML_ELEMENT_NODE.\n");
-#endif
- return (-1);
- }
-
- /*
- * Create a sorted list to store element attributes
- */
- list = xmlListCreate(NULL, (xmlListDataCompare) xmlC14NAttrsCompare);
- if (list == NULL) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessAttrsAxis: list creation failed\n");
-#endif
- return (-1);
- }
-
- /*
- * Add all visible attributes from current node.
- */
- attr = cur->properties;
- while (attr != NULL) {
- /* check that attribute is visible */
- if (xmlC14NIsVisible(ctx, attr, cur)) {
- xmlListInsert(list, attr);
- }
- attr = attr->next;
- }
-
- /*
- * include attributes in "xml" namespace defined in ancestors
- * (only for non-exclusive XML Canonicalization)
- */
- if ((!ctx->exclusive) && (cur->parent != NULL)
- && (!xmlC14NIsVisible(ctx, cur->parent, cur->parent->parent))) {
- /*
- * If XPath node-set is not specified then the parent is always
- * visible!
- */
- cur = cur->parent;
- while (cur != NULL) {
- attr = cur->properties;
- while (attr != NULL) {
- if ((attr->ns != NULL)
- && (xmlStrEqual(attr->ns->prefix, BAD_CAST "xml"))) {
- if (xmlListSearch(list, attr) == NULL) {
- xmlListInsert(list, attr);
- }
- }
- attr = attr->next;
- }
- cur = cur->parent;
- }
- }
-
- /*
- * print out all elements from list
- */
- xmlListWalk(list, (xmlListWalker) xmlC14NPrintAttrs, (const void *) ctx);
-
- /*
- * Cleanup
- */
- xmlListDelete(list);
- return (0);
-}
-
-/**
- * xmlC14NCheckForRelativeNamespaces:
- * @ctx: the C14N context
- * @cur: the current element node
- *
- * Checks that current element node has no relative namespaces defined
- *
- * Returns 0 if the node has no relative namespaces or -1 otherwise.
- */
-static int
-xmlC14NCheckForRelativeNamespaces(xmlC14NCtxPtr ctx, xmlNodePtr cur)
-{
- xmlNsPtr ns;
-
- if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NCheckForRelativeNamespaces: Null context or node pointer or type != XML_ELEMENT_NODE.\n");
-#endif
- return (-1);
- }
-
- ns = cur->nsDef;
- while (ns != NULL) {
- if (xmlStrlen(ns->href) > 0) {
- xmlURIPtr uri;
-
- uri = xmlParseURI((const char *) ns->href);
- if (uri == NULL) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NCheckForRelativeNamespaces: unable to parse uri=\"%s\".\n",
- ns->href);
-#endif
- return (-1);
- }
- if (xmlStrlen((const xmlChar *) uri->scheme) == 0) {
- xmlFreeURI(uri);
- return (-1);
- }
- if ((!xmlStrEqual
- ((const xmlChar *) uri->scheme, BAD_CAST "urn"))
- && (xmlStrlen((const xmlChar *) uri->server) == 0)) {
- xmlFreeURI(uri);
- return (-1);
- }
- xmlFreeURI(uri);
- }
- ns = ns->next;
- }
- return (0);
-}
-
-/**
- * xmlC14NProcessElementNode:
- * @ctx: the pointer to C14N context object
- * @cur: the node to process
- *
- * Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n)
- *
- * Element Nodes
- * If the element is not in the node-set, then the result is obtained
- * by processing the namespace axis, then the attribute axis, then
- * processing the child nodes of the element that are in the node-set
- * (in document order). If the element is in the node-set, then the result
- * is an open angle bracket (<), the element QName, the result of
- * processing the namespace axis, the result of processing the attribute
- * axis, a close angle bracket (>), the result of processing the child
- * nodes of the element that are in the node-set (in document order), an
- * open angle bracket, a forward slash (/), the element QName, and a close
- * angle bracket.
- *
- * Returns non-negative value on success or negative value on fail
- */
-static int
-xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
-{
- int ret;
- xmlC14NVisibleNsStack state;
- int parent_is_doc = 0;
-
- if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessElementNode: Null context or node pointer or type != XML_ELEMENT_NODE.\n");
-#endif
- return (-1);
- }
-
- /*
- * Check relative relative namespaces:
- * implementations of XML canonicalization MUST report an operation
- * failure on documents containing relative namespace URIs.
- */
- if (xmlC14NCheckForRelativeNamespaces(ctx, cur) < 0) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessElementNode: xmlC14NCheckForRelativeNamespaces failed.\n");
-#endif
- return (-1);
- }
-
-
- /*
- * Save ns_rendered stack position
- */
- xmlC14NVisibleNsStackSave(ctx->ns_rendered, &state);
-
- if (visible) {
- if (ctx->parent_is_doc) {
- /* save this flag into the stack */
- parent_is_doc = ctx->parent_is_doc;
- ctx->parent_is_doc = 0;
- ctx->pos = XMLC14N_INSIDE_DOCUMENT_ELEMENT;
- }
- xmlOutputBufferWriteString(ctx->buf, "<");
-
- if ((cur->ns != NULL) && (xmlStrlen(cur->ns->prefix) > 0)) {
- xmlOutputBufferWriteString(ctx->buf,
- (const char *) cur->ns->prefix);
- xmlOutputBufferWriteString(ctx->buf, ":");
- }
- xmlOutputBufferWriteString(ctx->buf, (const char *) cur->name);
- }
-
- if (!ctx->exclusive) {
- ret = xmlC14NProcessNamespacesAxis(ctx, cur, visible);
- } else {
- ret = xmlExcC14NProcessNamespacesAxis(ctx, cur, visible);
- }
- if (ret < 0) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessElementNode: xmlC14NProcessNamespacesAxis failed.\n");
-#endif
- return (-1);
- }
- /* todo: shouldn't this go to "visible only"? */
- if(visible) {
- xmlC14NVisibleNsStackShift(ctx->ns_rendered);
- }
-
- if(visible) {
- ret = xmlC14NProcessAttrsAxis(ctx, cur);
- if (ret < 0) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessElementNode: xmlC14NProcessAttrsAxis failed.\n");
-#endif
- return (-1);
- }
- }
-
- if (visible) {
- xmlOutputBufferWriteString(ctx->buf, ">");
- }
- if (cur->children != NULL) {
- ret = xmlC14NProcessNodeList(ctx, cur->children);
- if (ret < 0) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessElementNode: xmlC14NProcessNodeList failed.\n");
-#endif
- return (-1);
- }
- }
- if (visible) {
- xmlOutputBufferWriteString(ctx->buf, "</");
- if ((cur->ns != NULL) && (xmlStrlen(cur->ns->prefix) > 0)) {
- xmlOutputBufferWriteString(ctx->buf,
- (const char *) cur->ns->prefix);
- xmlOutputBufferWriteString(ctx->buf, ":");
- }
- xmlOutputBufferWriteString(ctx->buf, (const char *) cur->name);
- xmlOutputBufferWriteString(ctx->buf, ">");
- if (parent_is_doc) {
- /* restore this flag from the stack for next node */
- ctx->parent_is_doc = parent_is_doc;
- ctx->pos = XMLC14N_AFTER_DOCUMENT_ELEMENT;
- }
- }
-
- /*
- * Restore ns_rendered stack position
- */
- xmlC14NVisibleNsStackRestore(ctx->ns_rendered, &state);
- return (0);
-}
-
-/**
- * xmlC14NProcessNode:
- * @ctx: the pointer to C14N context object
- * @cur: the node to process
- *
- * Processes the given node
- *
- * Returns non-negative value on success or negative value on fail
- */
-static int
-xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur)
-{
- int ret = 0;
- int visible;
-
- if ((ctx == NULL) || (cur == NULL)) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessNode: Null context or node pointer.\n");
-#endif
- return (-1);
- }
-
- visible = xmlC14NIsVisible(ctx, cur, cur->parent);
- switch (cur->type) {
- case XML_ELEMENT_NODE:
- ret = xmlC14NProcessElementNode(ctx, cur, visible);
- break;
- case XML_CDATA_SECTION_NODE:
- case XML_TEXT_NODE:
- /*
- * Text Nodes
- * the string value, except all ampersands are replaced
- * by &amp;, all open angle brackets (<) are replaced by &lt;, all closing
- * angle brackets (>) are replaced by &gt;, and all #xD characters are
- * replaced by &#xD;.
- */
- /* cdata sections are processed as text nodes */
- /* todo: verify that cdata sections are included in XPath nodes set */
- if ((visible) && (cur->content != NULL)) {
- xmlChar *buffer;
-
- buffer = xmlC11NNormalizeText(cur->content);
- if (buffer != NULL) {
- xmlOutputBufferWriteString(ctx->buf,
- (const char *) buffer);
- xmlFree(buffer);
- } else {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessNode: xmlC11NNormalizeText() failed\n");
-#endif
- return (-1);
- }
- }
- break;
- case XML_PI_NODE:
- /*
- * Processing Instruction (PI) Nodes-
- * The opening PI symbol (<?), the PI target name of the node,
- * a leading space and the string value if it is not empty, and
- * the closing PI symbol (?>). If the string value is empty,
- * then the leading space is not added. Also, a trailing #xA is
- * rendered after the closing PI symbol for PI children of the
- * root node with a lesser document order than the document
- * element, and a leading #xA is rendered before the opening PI
- * symbol of PI children of the root node with a greater document
- * order than the document element.
- */
- if (visible) {
- if (ctx->pos == XMLC14N_AFTER_DOCUMENT_ELEMENT) {
- xmlOutputBufferWriteString(ctx->buf, "\x0A<?");
- } else {
- xmlOutputBufferWriteString(ctx->buf, "<?");
- }
-
- xmlOutputBufferWriteString(ctx->buf,
- (const char *) cur->name);
- if ((cur->content != NULL) && (*(cur->content) != '\0')) {
- xmlChar *buffer;
-
- xmlOutputBufferWriteString(ctx->buf, " ");
-
- /* todo: do we need to normalize pi? */
- buffer = xmlC11NNormalizePI(cur->content);
- if (buffer != NULL) {
- xmlOutputBufferWriteString(ctx->buf,
- (const char *) buffer);
- xmlFree(buffer);
- } else {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessNode: xmlC11NNormalizePI() failed\n");
-#endif
- return (-1);
- }
- }
-
- if (ctx->pos == XMLC14N_BEFORE_DOCUMENT_ELEMENT) {
- xmlOutputBufferWriteString(ctx->buf, "?>\x0A");
- } else {
- xmlOutputBufferWriteString(ctx->buf, "?>");
- }
- }
- break;
- case XML_COMMENT_NODE:
- /*
- * Comment Nodes
- * Nothing if generating canonical XML without comments. For
- * canonical XML with comments, generate the opening comment
- * symbol (<!--), the string value of the node, and the
- * closing comment symbol (-->). Also, a trailing #xA is rendered
- * after the closing comment symbol for comment children of the
- * root node with a lesser document order than the document
- * element, and a leading #xA is rendered before the opening
- * comment symbol of comment children of the root node with a
- * greater document order than the document element. (Comment
- * children of the root node represent comments outside of the
- * top-level document element and outside of the document type
- * declaration).
- */
- if (visible && ctx->with_comments) {
- if (ctx->pos == XMLC14N_AFTER_DOCUMENT_ELEMENT) {
- xmlOutputBufferWriteString(ctx->buf, "\x0A<!--");
- } else {
- xmlOutputBufferWriteString(ctx->buf, "<!--");
- }
-
- if (cur->content != NULL) {
- xmlChar *buffer;
-
- /* todo: do we need to normalize comment? */
- buffer = xmlC11NNormalizeComment(cur->content);
- if (buffer != NULL) {
- xmlOutputBufferWriteString(ctx->buf,
- (const char *) buffer);
- xmlFree(buffer);
- } else {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessNode: xmlC11NNormalizeComment() failed\n");
-#endif
- return (-1);
- }
- }
-
- if (ctx->pos == XMLC14N_BEFORE_DOCUMENT_ELEMENT) {
- xmlOutputBufferWriteString(ctx->buf, "-->\x0A");
- } else {
- xmlOutputBufferWriteString(ctx->buf, "-->");
- }
- }
- break;
- case XML_DOCUMENT_NODE:
- case XML_DOCUMENT_FRAG_NODE: /* should be processed as document? */
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE: /* should be processed as document? */
-#endif
-#ifdef LIBXML_HTML_ENABLED
- case XML_HTML_DOCUMENT_NODE: /* should be processed as document? */
-#endif
- if (cur->children != NULL) {
- ctx->pos = XMLC14N_BEFORE_DOCUMENT_ELEMENT;
- ctx->parent_is_doc = 1;
- ret = xmlC14NProcessNodeList(ctx, cur->children);
- }
- break;
-
- case XML_ATTRIBUTE_NODE:
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessNode: XML_ATTRIBUTE_NODE is illegal here\n");
- return (-1);
- case XML_NAMESPACE_DECL:
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessNode: XML_NAMESPACE_DECL is illegal here\n");
- return (-1);
- case XML_ENTITY_REF_NODE:
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessNode: XML_ENTITY_REF_NODE is illegal here\n");
- return (-1);
- case XML_ENTITY_NODE:
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessNode: XML_ENTITY_NODE is illegal here\n");
- return (-1);
-
- case XML_DOCUMENT_TYPE_NODE:
- case XML_NOTATION_NODE:
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
-#ifdef LIBXML_XINCLUDE_ENABLED
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
-#endif
- /*
- * should be ignored according to "W3C Canonical XML"
- */
- break;
- default:
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessNode: unknown node type = %d\n",
- cur->type);
-#endif
- return (-1);
- }
-
- return (ret);
-}
-
-/**
- * xmlC14NProcessNodeList:
- * @ctx: the pointer to C14N context object
- * @cur: the node to start from
- *
- * Processes all nodes in the row starting from cur.
- *
- * Returns non-negative value on success or negative value on fail
- */
-static int
-xmlC14NProcessNodeList(xmlC14NCtxPtr ctx, xmlNodePtr cur)
-{
- int ret;
-
- if (ctx == NULL) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NProcessNodeList: Null context pointer.\n");
-#endif
- return (-1);
- }
-
- for (ret = 0; cur != NULL && ret >= 0; cur = cur->next) {
- ret = xmlC14NProcessNode(ctx, cur);
- }
- return (ret);
-}
-
-
-/**
- * xmlC14NFreeCtx:
- * @ctx: the pointer to C14N context object
- *
- * Cleanups the C14N context object.
- */
-
-static void
-xmlC14NFreeCtx(xmlC14NCtxPtr ctx)
-{
- if (ctx == NULL) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NFreeCtx: ctx == NULL\n");
-#endif
- return;
- }
-
- if (ctx->ns_rendered != NULL) {
- xmlC14NVisibleNsStackDestroy(ctx->ns_rendered);
- }
- xmlFree(ctx);
-}
-
-/**
- * xmlC14NNewCtx:
- * @doc: the XML document for canonization
- * @is_visible_callback:the function to use to determine is node visible
- * or not
- * @user_data: the first parameter for @is_visible_callback function
- * (in most cases, it is nodes set)
- * @inclusive_ns_prefixe the list of inclusive namespace prefixes
- * ended with a NULL or NULL if there is no
- * inclusive namespaces (only for exclusive
- * canonicalization)
- * @with_comments: include comments in the result (!=0) or not (==0)
- * @buf: the output buffer to store canonical XML; this
- * buffer MUST have encoder==NULL because C14N requires
- * UTF-8 output
- *
- * Creates new C14N context object to store C14N parameters.
- *
- * Returns pointer to newly created object (success) or NULL (fail)
- */
-static xmlC14NCtxPtr
-xmlC14NNewCtx(xmlDocPtr doc,
- xmlC14NIsVisibleCallback is_visible_callback, void* user_data,
- int exclusive, xmlChar ** inclusive_ns_prefixes,
- int with_comments, xmlOutputBufferPtr buf)
-{
- xmlC14NCtxPtr ctx;
-
- if ((doc == NULL) || (buf == NULL)) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NNewCtx: pointer to document or output buffer is NULL\n");
-#endif
- return (NULL);
- }
-
- /*
- * Validate the encoding output buffer encoding
- */
- if (buf->encoder != NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NNewCtx: output buffer encoder != NULL but C14N requires UTF8 output\n");
- return (NULL);
- }
-
- /*
- * Validate the XML document encoding value, if provided.
- */
- if (doc->charset != XML_CHAR_ENCODING_UTF8) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NNewCtx: source document not in UTF8\n");
- return (NULL);
- }
-
- /*
- * Allocate a new xmlC14NCtxPtr and fill the fields.
- */
- ctx = (xmlC14NCtxPtr) xmlMalloc(sizeof(xmlC14NCtx));
- if (ctx == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NNewCtx: malloc failed\n");
- return (NULL);
- }
- memset(ctx, 0, sizeof(xmlC14NCtx));
-
- /*
- * initialize C14N context
- */
- ctx->doc = doc;
- ctx->with_comments = with_comments;
- ctx->is_visible_callback = is_visible_callback;
- ctx->user_data = user_data;
- ctx->buf = buf;
- ctx->parent_is_doc = 1;
- ctx->pos = XMLC14N_BEFORE_DOCUMENT_ELEMENT;
- ctx->ns_rendered = xmlC14NVisibleNsStackCreate();
-
- if(ctx->ns_rendered == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NNewCtx: xmlC14NVisibleNsStackCreate failed\n");
- xmlC14NFreeCtx(ctx);
- return (NULL);
- }
-
- /*
- * Set "exclusive" flag, create a nodes set for namespaces
- * stack and remember list of incluseve prefixes
- */
- if (exclusive) {
- ctx->exclusive = 1;
- ctx->inclusive_ns_prefixes = inclusive_ns_prefixes;
- }
- return (ctx);
-}
-
-/**
- * xmlC14NExecute:
- * @doc: the XML document for canonization
- * @is_visible_callback:the function to use to determine is node visible
- * or not
- * @user_data: the first parameter for @is_visible_callback function
- * (in most cases, it is nodes set)
- * @exclusive: the exclusive flag (0 - non-exclusive canonicalization;
- * otherwise - exclusive canonicalization)
- * @inclusive_ns_prefixes: the list of inclusive namespace prefixes
- * ended with a NULL or NULL if there is no
- * inclusive namespaces (only for exclusive
- * canonicalization, ignored otherwise)
- * @with_comments: include comments in the result (!=0) or not (==0)
- * @buf: the output buffer to store canonical XML; this
- * buffer MUST have encoder==NULL because C14N requires
- * UTF-8 output
- *
- * Dumps the canonized image of given XML document into the provided buffer.
- * For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or
- * "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)
- *
- * Returns non-negative value on success or a negative value on fail
- */
-int
-xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback,
- void* user_data, int exclusive, xmlChar **inclusive_ns_prefixes,
- int with_comments, xmlOutputBufferPtr buf) {
-
- xmlC14NCtxPtr ctx;
- int ret;
-
- if ((buf == NULL) || (doc == NULL)) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NExecute: null return buffer or doc pointer\n");
-#endif
- return (-1);
- }
-
- /*
- * Validate the encoding output buffer encoding
- */
- if (buf->encoder != NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NExecute: output buffer encoder != NULL but C14N requires UTF8 output\n");
- return (-1);
- }
-
- ctx = xmlC14NNewCtx(doc, is_visible_callback, user_data,
- exclusive, inclusive_ns_prefixes,
- with_comments, buf);
- if (ctx == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NExecute: unable to create C14N context\n");
- return (-1);
- }
-
-
-
- /*
- * Root Node
- * The root node is the parent of the top-level document element. The
- * result of processing each of its child nodes that is in the node-set
- * in document order. The root node does not generate a byte order mark,
- * XML declaration, nor anything from within the document type
- * declaration.
- */
- if (doc->children != NULL) {
- ret = xmlC14NProcessNodeList(ctx, doc->children);
- if (ret < 0) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NExecute: process childrens' list failed.\n");
-#endif
- xmlC14NFreeCtx(ctx);
- return (-1);
- }
- }
-
- /*
- * Flush buffer to get number of bytes written
- */
- ret = xmlOutputBufferFlush(buf);
- if (ret < 0) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NExecute: buffer flush failed.\n");
-#endif
- xmlC14NFreeCtx(ctx);
- return (-1);
- }
-
- /*
- * Cleanup
- */
- xmlC14NFreeCtx(ctx);
- return (ret);
-}
-
-/**
- * xmlC14NDocSaveTo:
- * @doc: the XML document for canonization
- * @nodes: the nodes set to be included in the canonized image
- * or NULL if all document nodes should be included
- * @exclusive: the exclusive flag (0 - non-exclusive canonicalization;
- * otherwise - exclusive canonicalization)
- * @inclusive_ns_prefixes: the list of inclusive namespace prefixes
- * ended with a NULL or NULL if there is no
- * inclusive namespaces (only for exclusive
- * canonicalization, ignored otherwise)
- * @with_comments: include comments in the result (!=0) or not (==0)
- * @buf: the output buffer to store canonical XML; this
- * buffer MUST have encoder==NULL because C14N requires
- * UTF-8 output
- *
- * Dumps the canonized image of given XML document into the provided buffer.
- * For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or
- * "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)
- *
- * Returns non-negative value on success or a negative value on fail
- */
-int
-xmlC14NDocSaveTo(xmlDocPtr doc, xmlNodeSetPtr nodes,
- int exclusive, xmlChar ** inclusive_ns_prefixes,
- int with_comments, xmlOutputBufferPtr buf) {
- return(xmlC14NExecute(doc,
- (xmlC14NIsVisibleCallback)xmlC14NIsNodeInNodeset,
- nodes,
- exclusive,
- inclusive_ns_prefixes,
- with_comments,
- buf));
-}
-
-
-/**
- * xmlC14NDocDumpMemory:
- * @doc: the XML document for canonization
- * @nodes: the nodes set to be included in the canonized image
- * or NULL if all document nodes should be included
- * @exclusive: the exclusive flag (0 - non-exclusive canonicalization;
- * otherwise - exclusive canonicalization)
- * @inclusive_ns_prefixes: the list of inclusive namespace prefixes
- * ended with a NULL or NULL if there is no
- * inclusive namespaces (only for exclusive
- * canonicalization, ignored otherwise)
- * @with_comments: include comments in the result (!=0) or not (==0)
- * @doc_txt_ptr: the memory pointer for allocated canonical XML text;
- * the caller of this functions is responsible for calling
- * xmlFree() to free allocated memory
- *
- * Dumps the canonized image of given XML document into memory.
- * For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or
- * "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)
- *
- * Returns the number of bytes written on success or a negative value on fail
- */
-int
-xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes,
- int exclusive, xmlChar ** inclusive_ns_prefixes,
- int with_comments, xmlChar ** doc_txt_ptr)
-{
- int ret;
- xmlOutputBufferPtr buf;
-
- if (doc_txt_ptr == NULL) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NDocDumpMemory: null return buffer pointer\n");
-#endif
- return (-1);
- }
-
- *doc_txt_ptr = NULL;
-
- /*
- * create memory buffer with UTF8 (default) encoding
- */
- buf = xmlAllocOutputBuffer(NULL);
- if (buf == NULL) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NDocDumpMemory: failed to allocate output buffer.\n");
-#endif
- return (-1);
- }
-
- /*
- * canonize document and write to buffer
- */
- ret = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes,
- with_comments, buf);
- if (ret < 0) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NDocDumpMemory: xmlC14NDocSaveTo failed.\n");
-#endif
- (void) xmlOutputBufferClose(buf);
- return (-1);
- }
-
- ret = buf->buffer->use;
- if (ret > 0) {
- *doc_txt_ptr = xmlStrndup(buf->buffer->content, ret);
- }
- (void) xmlOutputBufferClose(buf);
-
- if ((*doc_txt_ptr == NULL) && (ret > 0)) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NDocDumpMemory: failed to allocate memory for document text representation\n");
-#endif
- return (-1);
- }
- return (ret);
-}
-
-/**
- * xmlC14NDocSave:
- * @doc: the XML document for canonization
- * @nodes: the nodes set to be included in the canonized image
- * or NULL if all document nodes should be included
- * @exclusive: the exclusive flag (0 - non-exclusive canonicalization;
- * otherwise - exclusive canonicalization)
- * @inclusive_ns_prefixes: the list of inclusive namespace prefixes
- * ended with a NULL or NULL if there is no
- * inclusive namespaces (only for exclusive
- * canonicalization, ignored otherwise)
- * @with_comments: include comments in the result (!=0) or not (==0)
- * @filename: the filename to store canonical XML image
- * @compression: the compression level (zlib requred):
- * -1 - libxml default,
- * 0 - uncompressed,
- * >0 - compression level
- *
- * Dumps the canonized image of given XML document into the file.
- * For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or
- * "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)
- *
- * Returns the number of bytes written success or a negative value on fail
- */
-int
-xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes,
- int exclusive, xmlChar ** inclusive_ns_prefixes,
- int with_comments, const char *filename, int compression)
-{
- xmlOutputBufferPtr buf;
- int ret;
-
- if (filename == NULL) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NDocSave: filename is NULL\n");
-#endif
- return (-1);
- }
-#ifdef HAVE_ZLIB_H
- if (compression < 0)
- compression = xmlGetCompressMode();
-#endif
-
- /*
- * save the content to a temp buffer, use default UTF8 encoding.
- */
- buf = xmlOutputBufferCreateFilename(filename, NULL, compression);
- if (buf == NULL) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NDocSave: unable to create buffer for file=\"%s\" with compressin=%d\n",
- filename, compression);
-#endif
- return (-1);
- }
-
- /*
- * canonize document and write to buffer
- */
- ret = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes,
- with_comments, buf);
- if (ret < 0) {
-#ifdef DEBUG_C14N
- xmlGenericError(xmlGenericErrorContext,
- "xmlC14NDocSave: xmlC14NDocSaveTo failed.\n");
-#endif
- (void) xmlOutputBufferClose(buf);
- return (-1);
- }
-
- /*
- * get the numbers of bytes written
- */
- ret = xmlOutputBufferClose(buf);
- return (ret);
-}
-
-
-
-/*
- * Macro used to grow the current buffer.
- */
-#define growBufferReentrant() { \
- buffer_size *= 2; \
- buffer = (xmlChar *) \
- xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \
- if (buffer == NULL) { \
- xmlGenericError(xmlGenericErrorContext, "realloc failed"); \
- return(NULL); \
- } \
-}
-
-/**
- * xmlC11NNormalizeString:
- * @input: the input string
- * @mode: the normalization mode (attribute, comment, PI or text)
- *
- * Converts a string to a canonical (normalized) format. The code is stolen
- * from xmlEncodeEntitiesReentrant(). Added normalization of \x09, \x0a, \x0A
- * and the @mode parameter
- *
- * Returns a normalized string (caller is responsible for calling xmlFree())
- * or NULL if an error occurs
- */
-static xmlChar *
-xmlC11NNormalizeString(const xmlChar * input,
- xmlC14NNormalizationMode mode)
-{
- const xmlChar *cur = input;
- xmlChar *buffer = NULL;
- xmlChar *out = NULL;
- int buffer_size = 0;
-
- if (input == NULL)
- return (NULL);
-
- /*
- * allocate an translation buffer.
- */
- buffer_size = 1000;
- buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
- if (buffer == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc failed");
- return (NULL);
- }
- out = buffer;
-
- while (*cur != '\0') {
- if ((out - buffer) > (buffer_size - 10)) {
- int indx = out - buffer;
-
- growBufferReentrant();
- out = &buffer[indx];
- }
-
- if ((*cur == '<') && ((mode == XMLC14N_NORMALIZE_ATTR) ||
- (mode == XMLC14N_NORMALIZE_TEXT))) {
- *out++ = '&';
- *out++ = 'l';
- *out++ = 't';
- *out++ = ';';
- } else if ((*cur == '>') && (mode == XMLC14N_NORMALIZE_TEXT)) {
- *out++ = '&';
- *out++ = 'g';
- *out++ = 't';
- *out++ = ';';
- } else if ((*cur == '&') && ((mode == XMLC14N_NORMALIZE_ATTR) ||
- (mode == XMLC14N_NORMALIZE_TEXT))) {
- *out++ = '&';
- *out++ = 'a';
- *out++ = 'm';
- *out++ = 'p';
- *out++ = ';';
- } else if ((*cur == '"') && (mode == XMLC14N_NORMALIZE_ATTR)) {
- *out++ = '&';
- *out++ = 'q';
- *out++ = 'u';
- *out++ = 'o';
- *out++ = 't';
- *out++ = ';';
- } else if ((*cur == '\x09') && (mode == XMLC14N_NORMALIZE_ATTR)) {
- *out++ = '&';
- *out++ = '#';
- *out++ = 'x';
- *out++ = '9';
- *out++ = ';';
- } else if ((*cur == '\x0A') && (mode == XMLC14N_NORMALIZE_ATTR)) {
- *out++ = '&';
- *out++ = '#';
- *out++ = 'x';
- *out++ = 'A';
- *out++ = ';';
- } else if ((*cur == '\x0D') && ((mode == XMLC14N_NORMALIZE_ATTR) ||
- (mode == XMLC14N_NORMALIZE_TEXT) ||
- (mode == XMLC14N_NORMALIZE_COMMENT) ||
- (mode == XMLC14N_NORMALIZE_PI))) {
- *out++ = '&';
- *out++ = '#';
- *out++ = 'x';
- *out++ = 'D';
- *out++ = ';';
- } else {
- /*
- * Works because on UTF-8, all extended sequences cannot
- * result in bytes in the ASCII range.
- */
- *out++ = *cur;
- }
- cur++;
- }
- *out++ = 0;
- return (buffer);
-}
-#endif /* LIBXML_C14N_ENABLED */
diff --git a/bundle/libxml/catalog.c b/bundle/libxml/catalog.c
deleted file mode 100644
index e0159e2b9f..0000000000
--- a/bundle/libxml/catalog.c
+++ /dev/null
@@ -1,3502 +0,0 @@
-/**
- * catalog.c: set of generic Catalog related routines
- *
- * Reference: SGML Open Technical Resolution TR9401:1997.
- * http://www.jclark.com/sp/catalog.htm
- *
- * XML Catalogs Working Draft 06 August 2001
- * http://www.oasis-open.org/committees/entity/spec-2001-08-06.html
- *
- * See Copyright for the status of this software.
- *
- * Daniel.Veillard@imag.fr
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#ifdef LIBXML_CATALOG_ENABLED
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include <string.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/hash.h>
-#include <libxml/uri.h>
-#include <libxml/parserInternals.h>
-#include <libxml/catalog.h>
-#include <libxml/xmlerror.h>
-#include <libxml/threads.h>
-#include <libxml/globals.h>
-
-#define MAX_DELEGATE 50
-
-/**
- * TODO:
- *
- * macro to flag unimplemented blocks
- */
-#define TODO \
- xmlGenericError(xmlGenericErrorContext, \
- "Unimplemented block at %s:%d\n", \
- __FILE__, __LINE__);
-
-#define XML_URN_PUBID "urn:publicid:"
-#define XML_CATAL_BREAK ((xmlChar *) -1)
-#ifndef XML_XML_DEFAULT_CATALOG
-#define XML_XML_DEFAULT_CATALOG "file:///etc/xml/catalog"
-#endif
-#ifndef XML_SGML_DEFAULT_CATALOG
-#define XML_SGML_DEFAULT_CATALOG "file:///etc/sgml/catalog"
-#endif
-
-static int xmlExpandCatalog(xmlCatalogPtr catal, const char *filename);
-
-/************************************************************************
- * *
- * Types, all private *
- * *
- ************************************************************************/
-
-typedef enum {
- XML_CATA_REMOVED = -1,
- XML_CATA_NONE = 0,
- XML_CATA_CATALOG,
- XML_CATA_BROKEN_CATALOG,
- XML_CATA_NEXT_CATALOG,
- XML_CATA_PUBLIC,
- XML_CATA_SYSTEM,
- XML_CATA_REWRITE_SYSTEM,
- XML_CATA_DELEGATE_PUBLIC,
- XML_CATA_DELEGATE_SYSTEM,
- XML_CATA_URI,
- XML_CATA_REWRITE_URI,
- XML_CATA_DELEGATE_URI,
- SGML_CATA_SYSTEM,
- SGML_CATA_PUBLIC,
- SGML_CATA_ENTITY,
- SGML_CATA_PENTITY,
- SGML_CATA_DOCTYPE,
- SGML_CATA_LINKTYPE,
- SGML_CATA_NOTATION,
- SGML_CATA_DELEGATE,
- SGML_CATA_BASE,
- SGML_CATA_CATALOG,
- SGML_CATA_DOCUMENT,
- SGML_CATA_SGMLDECL
-} xmlCatalogEntryType;
-
-typedef struct _xmlCatalogEntry xmlCatalogEntry;
-typedef xmlCatalogEntry *xmlCatalogEntryPtr;
-struct _xmlCatalogEntry {
- struct _xmlCatalogEntry *next;
- struct _xmlCatalogEntry *parent;
- struct _xmlCatalogEntry *children;
- xmlCatalogEntryType type;
- xmlChar *name;
- xmlChar *value;
- xmlChar *URL; /* The expanded URL using the base */
- xmlCatalogPrefer prefer;
- int dealloc;
-};
-
-typedef enum {
- XML_XML_CATALOG_TYPE = 1,
- XML_SGML_CATALOG_TYPE
-} xmlCatalogType;
-
-#define XML_MAX_SGML_CATA_DEPTH 10
-struct _xmlCatalog {
- xmlCatalogType type; /* either XML or SGML */
-
- /*
- * SGML Catalogs are stored as a simple hash table of catalog entries
- * Catalog stack to check against overflows when building the
- * SGML catalog
- */
- char *catalTab[XML_MAX_SGML_CATA_DEPTH]; /* stack of catals */
- int catalNr; /* Number of current catal streams */
- int catalMax; /* Max number of catal streams */
- xmlHashTablePtr sgml;
-
- /*
- * XML Catalogs are stored as a tree of Catalog entries
- */
- xmlCatalogPrefer prefer;
- xmlCatalogEntryPtr xml;
-};
-
-/************************************************************************
- * *
- * Global variables *
- * *
- ************************************************************************/
-
-/*
- * Those are preferences
- */
-static int xmlDebugCatalogs = 0; /* used for debugging */
-static xmlCatalogAllow xmlCatalogDefaultAllow = XML_CATA_ALLOW_ALL;
-static xmlCatalogPrefer xmlCatalogDefaultPrefer = XML_CATA_PREFER_PUBLIC;
-
-/*
- * Hash table containing all the trees of XML catalogs parsed by
- * the application.
- */
-static xmlHashTablePtr xmlCatalogXMLFiles = NULL;
-
-/*
- * The default catalog in use by the application
- */
-static xmlCatalogPtr xmlDefaultCatalog = NULL;
-
-/*
- * A mutex for modifying the shared global catalog(s)
- * xmlDefaultCatalog tree.
- * It also protects xmlCatalogXMLFiles
- * The core of this readers/writer scheme is in xmlFetchXMLCatalogFile()
- */
-static xmlRMutexPtr xmlCatalogMutex = NULL;
-
-/*
- * Whether the catalog support was initialized.
- */
-static int xmlCatalogInitialized = 0;
-
-
-/************************************************************************
- * *
- * Allocation and Freeing *
- * *
- ************************************************************************/
-
-/**
- * xmlNewCatalogEntry:
- * @type: type of entry
- * @name: name of the entry
- * @value: value of the entry
- * @prefer: the PUBLIC vs. SYSTEM current preference value
- *
- * create a new Catalog entry, this type is shared both by XML and
- * SGML catalogs, but the acceptable types values differs.
- *
- * Returns the xmlCatalogEntryPtr or NULL in case of error
- */
-static xmlCatalogEntryPtr
-xmlNewCatalogEntry(xmlCatalogEntryType type, const xmlChar *name,
- const xmlChar *value, const xmlChar *URL, xmlCatalogPrefer prefer) {
- xmlCatalogEntryPtr ret;
-
- ret = (xmlCatalogEntryPtr) xmlMalloc(sizeof(xmlCatalogEntry));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", sizeof(xmlCatalogEntry));
- return(NULL);
- }
- ret->next = NULL;
- ret->parent = NULL;
- ret->children = NULL;
- ret->type = type;
- if (name != NULL)
- ret->name = xmlStrdup(name);
- else
- ret->name = NULL;
- if (value != NULL)
- ret->value = xmlStrdup(value);
- else
- ret->value = NULL;
- if (URL == NULL)
- URL = value;
- if (URL != NULL)
- ret->URL = xmlStrdup(URL);
- else
- ret->URL = NULL;
- ret->prefer = prefer;
- ret->dealloc = 0;
- return(ret);
-}
-
-static void
-xmlFreeCatalogEntryList(xmlCatalogEntryPtr ret);
-
-/**
- * xmlFreeCatalogEntry:
- * @ret: a Catalog entry
- *
- * Free the memory allocated to a Catalog entry
- */
-static void
-xmlFreeCatalogEntry(xmlCatalogEntryPtr ret) {
- if (ret == NULL)
- return;
- /*
- * Entries stored in the file hash must be deallocated
- * only by the file hash cleaner !
- */
- if (ret->dealloc == 1)
- return;
-
- if (xmlDebugCatalogs) {
- if (ret->name != NULL)
- xmlGenericError(xmlGenericErrorContext,
- "Free catalog entry %s\n", ret->name);
- else if (ret->value != NULL)
- xmlGenericError(xmlGenericErrorContext,
- "Free catalog entry %s\n", ret->value);
- else
- xmlGenericError(xmlGenericErrorContext,
- "Free catalog entry\n");
- }
-
- if (ret->name != NULL)
- xmlFree(ret->name);
- if (ret->value != NULL)
- xmlFree(ret->value);
- if (ret->URL != NULL)
- xmlFree(ret->URL);
- xmlFree(ret);
-}
-
-/**
- * xmlFreeCatalogEntryList:
- * @ret: a Catalog entry list
- *
- * Free the memory allocated to a full chained list of Catalog entries
- */
-static void
-xmlFreeCatalogEntryList(xmlCatalogEntryPtr ret) {
- xmlCatalogEntryPtr next;
-
- while (ret != NULL) {
- next = ret->next;
- xmlFreeCatalogEntry(ret);
- ret = next;
- }
-}
-
-/**
- * xmlFreeCatalogHashEntryList:
- * @ret: a Catalog entry list
- *
- * Free the memory allocated to list of Catalog entries from the
- * catalog file hash.
- */
-static void
-xmlFreeCatalogHashEntryList(xmlCatalogEntryPtr catal) {
- xmlCatalogEntryPtr children, next;
-
- if (catal == NULL)
- return;
-
- children = catal->children;
- while (children != NULL) {
- next = children->next;
- children->dealloc = 0;
- children->children = NULL;
- xmlFreeCatalogEntry(children);
- children = next;
- }
- catal->dealloc = 0;
- xmlFreeCatalogEntry(catal);
-}
-
-/**
- * xmlCreateNewCatalog:
- * @type: type of catalog
- * @prefer: the PUBLIC vs. SYSTEM current preference value
- *
- * create a new Catalog, this type is shared both by XML and
- * SGML catalogs, but the acceptable types values differs.
- *
- * Returns the xmlCatalogPtr or NULL in case of error
- */
-static xmlCatalogPtr
-xmlCreateNewCatalog(xmlCatalogType type, xmlCatalogPrefer prefer) {
- xmlCatalogPtr ret;
-
- ret = (xmlCatalogPtr) xmlMalloc(sizeof(xmlCatalog));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", sizeof(xmlCatalog));
- return(NULL);
- }
- memset(ret, 0, sizeof(xmlCatalog));
- ret->type = type;
- ret->catalNr = 0;
- ret->catalMax = XML_MAX_SGML_CATA_DEPTH;
- ret->prefer = prefer;
- if (ret->type == XML_SGML_CATALOG_TYPE)
- ret->sgml = xmlHashCreate(10);
- return(ret);
-}
-
-/**
- * xmlFreeCatalog:
- * @catal: a Catalog entry
- *
- * Free the memory allocated to a Catalog
- */
-void
-xmlFreeCatalog(xmlCatalogPtr catal) {
- if (catal == NULL)
- return;
- if (catal->xml != NULL)
- xmlFreeCatalogEntryList(catal->xml);
- if (catal->sgml != NULL)
- xmlHashFree(catal->sgml,
- (xmlHashDeallocator) xmlFreeCatalogEntry);
- xmlFree(catal);
-}
-
-/************************************************************************
- * *
- * Serializing Catalogs *
- * *
- ************************************************************************/
-
-/**
- * xmlCatalogDumpEntry:
- * @entry: the
- * @out: the file.
- *
- * Serialize an SGML Catalog entry
- */
-static void
-xmlCatalogDumpEntry(xmlCatalogEntryPtr entry, FILE *out) {
- if ((entry == NULL) || (out == NULL))
- return;
- switch (entry->type) {
- case SGML_CATA_ENTITY:
- fprintf(out, "ENTITY "); break;
- case SGML_CATA_PENTITY:
- fprintf(out, "ENTITY %%"); break;
- case SGML_CATA_DOCTYPE:
- fprintf(out, "DOCTYPE "); break;
- case SGML_CATA_LINKTYPE:
- fprintf(out, "LINKTYPE "); break;
- case SGML_CATA_NOTATION:
- fprintf(out, "NOTATION "); break;
- case SGML_CATA_PUBLIC:
- fprintf(out, "PUBLIC "); break;
- case SGML_CATA_SYSTEM:
- fprintf(out, "SYSTEM "); break;
- case SGML_CATA_DELEGATE:
- fprintf(out, "DELEGATE "); break;
- case SGML_CATA_BASE:
- fprintf(out, "BASE "); break;
- case SGML_CATA_CATALOG:
- fprintf(out, "CATALOG "); break;
- case SGML_CATA_DOCUMENT:
- fprintf(out, "DOCUMENT "); break;
- case SGML_CATA_SGMLDECL:
- fprintf(out, "SGMLDECL "); break;
- default:
- return;
- }
- switch (entry->type) {
- case SGML_CATA_ENTITY:
- case SGML_CATA_PENTITY:
- case SGML_CATA_DOCTYPE:
- case SGML_CATA_LINKTYPE:
- case SGML_CATA_NOTATION:
- fprintf(out, "%s", entry->name); break;
- case SGML_CATA_PUBLIC:
- case SGML_CATA_SYSTEM:
- case SGML_CATA_SGMLDECL:
- case SGML_CATA_DOCUMENT:
- case SGML_CATA_CATALOG:
- case SGML_CATA_BASE:
- case SGML_CATA_DELEGATE:
- fprintf(out, "\"%s\"", entry->name); break;
- default:
- break;
- }
- switch (entry->type) {
- case SGML_CATA_ENTITY:
- case SGML_CATA_PENTITY:
- case SGML_CATA_DOCTYPE:
- case SGML_CATA_LINKTYPE:
- case SGML_CATA_NOTATION:
- case SGML_CATA_PUBLIC:
- case SGML_CATA_SYSTEM:
- case SGML_CATA_DELEGATE:
- fprintf(out, " \"%s\"", entry->value); break;
- default:
- break;
- }
- fprintf(out, "\n");
-}
-
-static int
-xmlDumpXMLCatalog(FILE *out, xmlCatalogEntryPtr catal) {
- int ret;
- xmlDocPtr doc;
- xmlNsPtr ns;
- xmlDtdPtr dtd;
- xmlNodePtr node, catalog;
- xmlOutputBufferPtr buf;
- xmlCatalogEntryPtr cur;
-
- /*
- * Rebuild a catalog
- */
- doc = xmlNewDoc(NULL);
- if (doc == NULL)
- return(-1);
- dtd = xmlNewDtd(doc, BAD_CAST "catalog",
- BAD_CAST "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN",
-BAD_CAST "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd");
-
- xmlAddChild((xmlNodePtr) doc, (xmlNodePtr) dtd);
-
- ns = xmlNewNs(NULL, XML_CATALOGS_NAMESPACE, NULL);
- if (ns == NULL) {
- xmlFreeDoc(doc);
- return(-1);
- }
- catalog = xmlNewDocNode(doc, ns, BAD_CAST "catalog", NULL);
- if (catalog == NULL) {
- xmlFreeNs(ns);
- xmlFreeDoc(doc);
- return(-1);
- }
- catalog->nsDef = ns;
- xmlAddChild((xmlNodePtr) doc, catalog);
-
- /*
- * add all the catalog entries
- */
- cur = catal;
- while (cur != NULL) {
- switch (cur->type) {
- case XML_CATA_REMOVED:
- break;
- case XML_CATA_BROKEN_CATALOG:
- case XML_CATA_CATALOG:
- if (cur == catal) {
- cur = cur->children;
- continue;
- }
- break;
- case XML_CATA_NEXT_CATALOG:
- node = xmlNewDocNode(doc, ns, BAD_CAST "nextCatalog", NULL);
- xmlSetProp(node, BAD_CAST "catalog", cur->value);
- xmlAddChild(catalog, node);
- break;
- case XML_CATA_NONE:
- break;
- case XML_CATA_PUBLIC:
- node = xmlNewDocNode(doc, ns, BAD_CAST "public", NULL);
- xmlSetProp(node, BAD_CAST "publicId", cur->name);
- xmlSetProp(node, BAD_CAST "uri", cur->value);
- xmlAddChild(catalog, node);
- break;
- case XML_CATA_SYSTEM:
- node = xmlNewDocNode(doc, ns, BAD_CAST "system", NULL);
- xmlSetProp(node, BAD_CAST "systemId", cur->name);
- xmlSetProp(node, BAD_CAST "uri", cur->value);
- xmlAddChild(catalog, node);
- break;
- case XML_CATA_REWRITE_SYSTEM:
- node = xmlNewDocNode(doc, ns, BAD_CAST "rewriteSystem", NULL);
- xmlSetProp(node, BAD_CAST "systemIdStartString", cur->name);
- xmlSetProp(node, BAD_CAST "rewritePrefix", cur->value);
- xmlAddChild(catalog, node);
- break;
- case XML_CATA_DELEGATE_PUBLIC:
- node = xmlNewDocNode(doc, ns, BAD_CAST "delegatePublic", NULL);
- xmlSetProp(node, BAD_CAST "publicIdStartString", cur->name);
- xmlSetProp(node, BAD_CAST "catalog", cur->value);
- xmlAddChild(catalog, node);
- break;
- case XML_CATA_DELEGATE_SYSTEM:
- node = xmlNewDocNode(doc, ns, BAD_CAST "delegateSystem", NULL);
- xmlSetProp(node, BAD_CAST "systemIdStartString", cur->name);
- xmlSetProp(node, BAD_CAST "catalog", cur->value);
- xmlAddChild(catalog, node);
- break;
- case XML_CATA_URI:
- node = xmlNewDocNode(doc, ns, BAD_CAST "uri", NULL);
- xmlSetProp(node, BAD_CAST "name", cur->name);
- xmlSetProp(node, BAD_CAST "uri", cur->value);
- xmlAddChild(catalog, node);
- break;
- case XML_CATA_REWRITE_URI:
- node = xmlNewDocNode(doc, ns, BAD_CAST "rewriteURI", NULL);
- xmlSetProp(node, BAD_CAST "uriStartString", cur->name);
- xmlSetProp(node, BAD_CAST "rewritePrefix", cur->value);
- xmlAddChild(catalog, node);
- break;
- case XML_CATA_DELEGATE_URI:
- node = xmlNewDocNode(doc, ns, BAD_CAST "delegateURI", NULL);
- xmlSetProp(node, BAD_CAST "uriStartString", cur->name);
- xmlSetProp(node, BAD_CAST "catalog", cur->value);
- xmlAddChild(catalog, node);
- break;
- case SGML_CATA_SYSTEM:
- case SGML_CATA_PUBLIC:
- case SGML_CATA_ENTITY:
- case SGML_CATA_PENTITY:
- case SGML_CATA_DOCTYPE:
- case SGML_CATA_LINKTYPE:
- case SGML_CATA_NOTATION:
- case SGML_CATA_DELEGATE:
- case SGML_CATA_BASE:
- case SGML_CATA_CATALOG:
- case SGML_CATA_DOCUMENT:
- case SGML_CATA_SGMLDECL:
- break;
- }
- cur = cur->next;
- }
-
- /*
- * reserialize it
- */
- buf = xmlOutputBufferCreateFile(out, NULL);
- if (buf == NULL) {
- xmlFreeDoc(doc);
- return(-1);
- }
- ret = xmlSaveFormatFileTo(buf, doc, NULL, 1);
-
- /*
- * Free it
- */
- xmlFreeDoc(doc);
-
- return(ret);
-}
-
-/************************************************************************
- * *
- * Converting SGML Catalogs to XML *
- * *
- ************************************************************************/
-
-/**
- * xmlCatalogConvertEntry:
- * @entry: the entry
- * @catal: pointer to the catalog being converted
- *
- * Convert one entry from the catalog
- */
-static void
-xmlCatalogConvertEntry(xmlCatalogEntryPtr entry, xmlCatalogPtr catal) {
- if ((entry == NULL) || (catal == NULL) || (catal->sgml == NULL) ||
- (catal->xml == NULL))
- return;
- switch (entry->type) {
- case SGML_CATA_ENTITY:
- entry->type = XML_CATA_PUBLIC;
- break;
- case SGML_CATA_PENTITY:
- entry->type = XML_CATA_PUBLIC;
- break;
- case SGML_CATA_DOCTYPE:
- entry->type = XML_CATA_PUBLIC;
- break;
- case SGML_CATA_LINKTYPE:
- entry->type = XML_CATA_PUBLIC;
- break;
- case SGML_CATA_NOTATION:
- entry->type = XML_CATA_PUBLIC;
- break;
- case SGML_CATA_PUBLIC:
- entry->type = XML_CATA_PUBLIC;
- break;
- case SGML_CATA_SYSTEM:
- entry->type = XML_CATA_SYSTEM;
- break;
- case SGML_CATA_DELEGATE:
- entry->type = XML_CATA_DELEGATE_PUBLIC;
- break;
- case SGML_CATA_CATALOG:
- entry->type = XML_CATA_CATALOG;
- break;
- default:
- xmlHashRemoveEntry(catal->sgml, entry->name,
- (xmlHashDeallocator) xmlFreeCatalogEntry);
- return;
- }
- /*
- * Conversion successful, remove from the SGML catalog
- * and add it to the default XML one
- */
- xmlHashRemoveEntry(catal->sgml, entry->name, NULL);
- entry->parent = catal->xml;
- entry->next = NULL;
- if (catal->xml->children == NULL)
- catal->xml->children = entry;
- else {
- xmlCatalogEntryPtr prev;
-
- prev = catal->xml->children;
- while (prev->next != NULL)
- prev = prev->next;
- prev->next = entry;
- }
-}
-
-/**
- * xmlConvertSGMLCatalog:
- * @catal: the catalog
- *
- * Convert all the SGML catalog entries as XML ones
- *
- * Returns the number of entries converted if successful, -1 otherwise
- */
-int
-xmlConvertSGMLCatalog(xmlCatalogPtr catal) {
-
- if ((catal == NULL) || (catal->type != XML_SGML_CATALOG_TYPE))
- return(-1);
-
- if (xmlDebugCatalogs) {
- xmlGenericError(xmlGenericErrorContext,
- "Converting SGML catalog to XML\n");
- }
- xmlHashScan(catal->sgml,
- (xmlHashScanner) xmlCatalogConvertEntry,
- &catal);
- return(0);
-}
-
-/************************************************************************
- * *
- * Helper function *
- * *
- ************************************************************************/
-
-/**
- * xmlCatalogUnWrapURN:
- * @urn: an "urn:publicid:" to unwrap
- *
- * Expand the URN into the equivalent Public Identifier
- *
- * Returns the new identifier or NULL, the string must be deallocated
- * by the caller.
- */
-static xmlChar *
-xmlCatalogUnWrapURN(const xmlChar *urn) {
- xmlChar result[2000];
- unsigned int i = 0;
-
- if (xmlStrncmp(urn, BAD_CAST XML_URN_PUBID, sizeof(XML_URN_PUBID) - 1))
- return(NULL);
- urn += sizeof(XML_URN_PUBID) - 1;
-
- while (*urn != 0) {
- if (i > sizeof(result) - 3)
- break;
- if (*urn == '+') {
- result[i++] = ' ';
- urn++;
- } else if (*urn == ':') {
- result[i++] = '/';
- result[i++] = '/';
- urn++;
- } else if (*urn == ';') {
- result[i++] = ':';
- result[i++] = ':';
- urn++;
- } else if (*urn == '%') {
- if ((urn[1] == '2') && (urn[1] == 'B'))
- result[i++] = '+';
- else if ((urn[1] == '3') && (urn[1] == 'A'))
- result[i++] = ':';
- else if ((urn[1] == '2') && (urn[1] == 'F'))
- result[i++] = '/';
- else if ((urn[1] == '3') && (urn[1] == 'B'))
- result[i++] = ';';
- else if ((urn[1] == '2') && (urn[1] == '7'))
- result[i++] = '\'';
- else if ((urn[1] == '3') && (urn[1] == 'F'))
- result[i++] = '?';
- else if ((urn[1] == '2') && (urn[1] == '3'))
- result[i++] = '#';
- else if ((urn[1] == '2') && (urn[1] == '5'))
- result[i++] = '%';
- else {
- result[i++] = *urn;
- urn++;
- continue;
- }
- urn += 3;
- } else {
- result[i++] = *urn;
- urn++;
- }
- }
- result[i] = 0;
-
- return(xmlStrdup(result));
-}
-
-/**
- * xmlParseCatalogFile:
- * @filename: the filename
- *
- * parse an XML file and build a tree. It's like xmlParseFile()
- * except it bypass all catalog lookups.
- *
- * Returns the resulting document tree or NULL in case of error
- */
-
-xmlDocPtr
-xmlParseCatalogFile(const char *filename) {
- xmlDocPtr ret;
- xmlParserCtxtPtr ctxt;
- char *directory = NULL;
- xmlParserInputPtr inputStream;
- xmlParserInputBufferPtr buf;
-
- ctxt = xmlNewParserCtxt();
- if (ctxt == NULL) {
- if (xmlDefaultSAXHandler.error != NULL) {
- xmlDefaultSAXHandler.error(NULL, "out of memory\n");
- }
- return(NULL);
- }
-
- buf = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE);
- if (buf == NULL) {
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
-
- inputStream = xmlNewInputStream(ctxt);
- if (inputStream == NULL) {
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
-
- inputStream->filename = xmlMemStrdup(filename);
- inputStream->buf = buf;
- inputStream->base = inputStream->buf->buffer->content;
- inputStream->cur = inputStream->buf->buffer->content;
- inputStream->end =
- &inputStream->buf->buffer->content[inputStream->buf->buffer->use];
-
- inputPush(ctxt, inputStream);
- if ((ctxt->directory == NULL) && (directory == NULL))
- directory = xmlParserGetDirectory(filename);
- if ((ctxt->directory == NULL) && (directory != NULL))
- ctxt->directory = directory;
- ctxt->valid = 0;
- ctxt->validate = 0;
- ctxt->loadsubset = 0;
- ctxt->pedantic = 0;
-
- xmlParseDocument(ctxt);
-
- if (ctxt->wellFormed)
- ret = ctxt->myDoc;
- else {
- ret = NULL;
- xmlFreeDoc(ctxt->myDoc);
- ctxt->myDoc = NULL;
- }
- xmlFreeParserCtxt(ctxt);
-
- return(ret);
-}
-
-/**
- * xmlLoadFileContent:
- * @filename: a file path
- *
- * Load a file content into memory.
- *
- * Returns a pointer to the 0 terminated string or NULL in case of error
- */
-static xmlChar *
-xmlLoadFileContent(const char *filename)
-{
-#ifdef HAVE_STAT
- int fd;
-#else
- FILE *fd;
-#endif
- int len;
- long size;
-
-#ifdef HAVE_STAT
- struct stat info;
-#endif
- xmlChar *content;
-
- if (filename == NULL)
- return (NULL);
-
-#ifdef HAVE_STAT
- if (stat(filename, &info) < 0)
- return (NULL);
-#endif
-
-#ifdef HAVE_STAT
- if ((fd = open(filename, O_RDONLY)) < 0)
-#else
- if ((fd = fopen(filename, "rb")) == NULL)
-#endif
- {
- return (NULL);
- }
-#ifdef HAVE_STAT
- size = info.st_size;
-#else
- if (fseek(fd, 0, SEEK_END) || (size = ftell(fd)) == EOF || fseek(fd, 0, SEEK_SET)) { /* File operations denied? ok, just close and return failure */
- fclose(fd);
- return (NULL);
- }
-#endif
- content = xmlMalloc(size + 10);
- if (content == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", size + 10);
- return (NULL);
- }
-#ifdef HAVE_STAT
- len = read(fd, content, size);
-#else
- len = fread(content, 1, size, fd);
-#endif
- if (len < 0) {
- xmlFree(content);
- return (NULL);
- }
-#ifdef HAVE_STAT
- close(fd);
-#else
- fclose(fd);
-#endif
- content[len] = 0;
-
- return(content);
-}
-
-/************************************************************************
- * *
- * The XML Catalog parser *
- * *
- ************************************************************************/
-
-static xmlCatalogEntryPtr
-xmlParseXMLCatalogFile(xmlCatalogPrefer prefer, const xmlChar *filename);
-static void
-xmlParseXMLCatalogNodeList(xmlNodePtr cur, xmlCatalogPrefer prefer,
- xmlCatalogEntryPtr parent);
-static xmlChar *
-xmlCatalogListXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID,
- const xmlChar *sysID);
-static xmlChar *
-xmlCatalogListXMLResolveURI(xmlCatalogEntryPtr catal, const xmlChar *URI);
-
-
-/**
- * xmlGetXMLCatalogEntryType:
- * @name: the name
- *
- * lookup the internal type associated to an XML catalog entry name
- *
- * Returns the type associate with that name
- */
-static xmlCatalogEntryType
-xmlGetXMLCatalogEntryType(const xmlChar *name) {
- xmlCatalogEntryType type = XML_CATA_NONE;
- if (xmlStrEqual(name, (const xmlChar *) "system"))
- type = XML_CATA_SYSTEM;
- else if (xmlStrEqual(name, (const xmlChar *) "public"))
- type = XML_CATA_PUBLIC;
- else if (xmlStrEqual(name, (const xmlChar *) "rewriteSystem"))
- type = XML_CATA_REWRITE_SYSTEM;
- else if (xmlStrEqual(name, (const xmlChar *) "delegatePublic"))
- type = XML_CATA_DELEGATE_PUBLIC;
- else if (xmlStrEqual(name, (const xmlChar *) "delegateSystem"))
- type = XML_CATA_DELEGATE_SYSTEM;
- else if (xmlStrEqual(name, (const xmlChar *) "uri"))
- type = XML_CATA_URI;
- else if (xmlStrEqual(name, (const xmlChar *) "rewriteURI"))
- type = XML_CATA_REWRITE_URI;
- else if (xmlStrEqual(name, (const xmlChar *) "delegateURI"))
- type = XML_CATA_DELEGATE_URI;
- else if (xmlStrEqual(name, (const xmlChar *) "nextCatalog"))
- type = XML_CATA_NEXT_CATALOG;
- else if (xmlStrEqual(name, (const xmlChar *) "catalog"))
- type = XML_CATA_CATALOG;
- return(type);
-}
-
-/**
- * xmlParseXMLCatalogOneNode:
- * @cur: the XML node
- * @type: the type of Catalog entry
- * @name: the name of the node
- * @attrName: the attribute holding the value
- * @uriAttrName: the attribute holding the URI-Reference
- * @prefer: the PUBLIC vs. SYSTEM current preference value
- *
- * Finishes the examination of an XML tree node of a catalog and build
- * a Catalog entry from it.
- *
- * Returns the new Catalog entry node or NULL in case of error.
- */
-static xmlCatalogEntryPtr
-xmlParseXMLCatalogOneNode(xmlNodePtr cur, xmlCatalogEntryType type,
- const xmlChar *name, const xmlChar *attrName,
- const xmlChar *uriAttrName, xmlCatalogPrefer prefer) {
- int ok = 1;
- xmlChar *uriValue;
- xmlChar *nameValue = NULL;
- xmlChar *base = NULL;
- xmlChar *URL = NULL;
- xmlCatalogEntryPtr ret = NULL;
-
- if (attrName != NULL) {
- nameValue = xmlGetProp(cur, attrName);
- if (nameValue == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "%s entry lacks '%s'\n", name, attrName);
- ok = 0;
- }
- }
- uriValue = xmlGetProp(cur, uriAttrName);
- if (uriValue == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "%s entry lacks '%s'\n", name, uriAttrName);
- ok = 0;
- }
- if (!ok) {
- if (nameValue != NULL)
- xmlFree(nameValue);
- if (uriValue != NULL)
- xmlFree(uriValue);
- return(NULL);
- }
-
- base = xmlNodeGetBase(cur->doc, cur);
- URL = xmlBuildURI(uriValue, base);
- if (URL != NULL) {
- if (xmlDebugCatalogs > 1) {
- if (nameValue != NULL)
- xmlGenericError(xmlGenericErrorContext,
- "Found %s: '%s' '%s'\n", name, nameValue, URL);
- else
- xmlGenericError(xmlGenericErrorContext,
- "Found %s: '%s'\n", name, URL);
- }
- ret = xmlNewCatalogEntry(type, nameValue, uriValue, URL, prefer);
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "%s entry '%s' broken ?: %s\n", name, uriAttrName, uriValue);
- }
- if (nameValue != NULL)
- xmlFree(nameValue);
- if (uriValue != NULL)
- xmlFree(uriValue);
- if (base != NULL)
- xmlFree(base);
- if (URL != NULL)
- xmlFree(URL);
- return(ret);
-}
-
-/**
- * xmlParseXMLCatalogNode:
- * @cur: the XML node
- * @prefer: the PUBLIC vs. SYSTEM current preference value
- * @parent: the parent Catalog entry
- *
- * Examines an XML tree node of a catalog and build
- * a Catalog entry from it adding it to its parent. The examination can
- * be recursive.
- */
-static void
-xmlParseXMLCatalogNode(xmlNodePtr cur, xmlCatalogPrefer prefer,
- xmlCatalogEntryPtr parent)
-{
- xmlChar *uri = NULL;
- xmlChar *URL = NULL;
- xmlChar *base = NULL;
- xmlCatalogEntryPtr entry = NULL;
-
- if (cur == NULL)
- return;
- if (xmlStrEqual(cur->name, BAD_CAST "group")) {
- xmlChar *prop;
-
- prop = xmlGetProp(cur, BAD_CAST "prefer");
- if (prop != NULL) {
- if (xmlStrEqual(prop, BAD_CAST "system")) {
- prefer = XML_CATA_PREFER_SYSTEM;
- } else if (xmlStrEqual(prop, BAD_CAST "public")) {
- prefer = XML_CATA_PREFER_PUBLIC;
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "Invalid value for prefer: '%s'\n", prop);
- }
- xmlFree(prop);
- }
- /*
- * Recurse to propagate prefer to the subtree
- * (xml:base handling is automated)
- */
- xmlParseXMLCatalogNodeList(cur->children, prefer, parent);
- } else if (xmlStrEqual(cur->name, BAD_CAST "public")) {
- entry = xmlParseXMLCatalogOneNode(cur, XML_CATA_PUBLIC,
- BAD_CAST "public", BAD_CAST "publicId", BAD_CAST "uri", prefer);
- } else if (xmlStrEqual(cur->name, BAD_CAST "system")) {
- entry = xmlParseXMLCatalogOneNode(cur, XML_CATA_SYSTEM,
- BAD_CAST "system", BAD_CAST "systemId", BAD_CAST "uri", prefer);
- } else if (xmlStrEqual(cur->name, BAD_CAST "rewriteSystem")) {
- entry = xmlParseXMLCatalogOneNode(cur, XML_CATA_REWRITE_SYSTEM,
- BAD_CAST "rewriteSystem", BAD_CAST "systemIdStartString",
- BAD_CAST "rewritePrefix", prefer);
- } else if (xmlStrEqual(cur->name, BAD_CAST "delegatePublic")) {
- entry = xmlParseXMLCatalogOneNode(cur, XML_CATA_DELEGATE_PUBLIC,
- BAD_CAST "delegatePublic", BAD_CAST "publicIdStartString",
- BAD_CAST "catalog", prefer);
- } else if (xmlStrEqual(cur->name, BAD_CAST "delegateSystem")) {
- entry = xmlParseXMLCatalogOneNode(cur, XML_CATA_DELEGATE_SYSTEM,
- BAD_CAST "delegateSystem", BAD_CAST "systemIdStartString",
- BAD_CAST "catalog", prefer);
- } else if (xmlStrEqual(cur->name, BAD_CAST "uri")) {
- entry = xmlParseXMLCatalogOneNode(cur, XML_CATA_URI,
- BAD_CAST "uri", BAD_CAST "name",
- BAD_CAST "uri", prefer);
- } else if (xmlStrEqual(cur->name, BAD_CAST "rewriteURI")) {
- entry = xmlParseXMLCatalogOneNode(cur, XML_CATA_REWRITE_URI,
- BAD_CAST "rewriteURI", BAD_CAST "uriStartString",
- BAD_CAST "rewritePrefix", prefer);
- } else if (xmlStrEqual(cur->name, BAD_CAST "delegateURI")) {
- entry = xmlParseXMLCatalogOneNode(cur, XML_CATA_DELEGATE_URI,
- BAD_CAST "delegateURI", BAD_CAST "uriStartString",
- BAD_CAST "catalog", prefer);
- } else if (xmlStrEqual(cur->name, BAD_CAST "nextCatalog")) {
- entry = xmlParseXMLCatalogOneNode(cur, XML_CATA_NEXT_CATALOG,
- BAD_CAST "nextCatalog", NULL,
- BAD_CAST "catalog", prefer);
- }
- if ((entry != NULL) && (parent != NULL)) {
- entry->parent = parent;
- if (parent->children == NULL)
- parent->children = entry;
- else {
- xmlCatalogEntryPtr prev;
-
- prev = parent->children;
- while (prev->next != NULL)
- prev = prev->next;
- prev->next = entry;
- }
- }
- if (base != NULL)
- xmlFree(base);
- if (uri != NULL)
- xmlFree(uri);
- if (URL != NULL)
- xmlFree(URL);
-}
-
-/**
- * xmlParseXMLCatalogNodeList:
- * @cur: the XML node list of siblings
- * @prefer: the PUBLIC vs. SYSTEM current preference value
- * @parent: the parent Catalog entry
- *
- * Examines a list of XML sibling nodes of a catalog and build
- * a list of Catalog entry from it adding it to the parent.
- * The examination will recurse to examine node subtrees.
- */
-static void
-xmlParseXMLCatalogNodeList(xmlNodePtr cur, xmlCatalogPrefer prefer,
- xmlCatalogEntryPtr parent) {
- while (cur != NULL) {
- if ((cur->ns != NULL) && (cur->ns->href != NULL) &&
- (xmlStrEqual(cur->ns->href, XML_CATALOGS_NAMESPACE))) {
- xmlParseXMLCatalogNode(cur, prefer, parent);
- }
- cur = cur->next;
- }
- /* TODO: sort the list according to REWRITE lengths and prefer value */
-}
-
-/**
- * xmlParseXMLCatalogFile:
- * @prefer: the PUBLIC vs. SYSTEM current preference value
- * @filename: the filename for the catalog
- *
- * Parses the catalog file to extract the XML tree and then analyze the
- * tree to build a list of Catalog entries corresponding to this catalog
- *
- * Returns the resulting Catalog entries list
- */
-static xmlCatalogEntryPtr
-xmlParseXMLCatalogFile(xmlCatalogPrefer prefer, const xmlChar *filename) {
- xmlDocPtr doc;
- xmlNodePtr cur;
- xmlChar *prop;
- xmlCatalogEntryPtr parent = NULL;
-
- if (filename == NULL)
- return(NULL);
-
- doc = xmlParseCatalogFile((const char *) filename);
- if (doc == NULL) {
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Failed to parse catalog %s\n", filename);
- return(NULL);
- }
-
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "%d Parsing catalog %s\n", xmlGetThreadId(), filename);
-
- cur = xmlDocGetRootElement(doc);
- if ((cur != NULL) && (xmlStrEqual(cur->name, BAD_CAST "catalog")) &&
- (cur->ns != NULL) && (cur->ns->href != NULL) &&
- (xmlStrEqual(cur->ns->href, XML_CATALOGS_NAMESPACE))) {
-
- parent = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL,
- (const xmlChar *)filename, NULL, prefer);
- if (parent == NULL) {
- xmlFreeDoc(doc);
- return(NULL);
- }
-
- prop = xmlGetProp(cur, BAD_CAST "prefer");
- if (prop != NULL) {
- if (xmlStrEqual(prop, BAD_CAST "system")) {
- prefer = XML_CATA_PREFER_SYSTEM;
- } else if (xmlStrEqual(prop, BAD_CAST "public")) {
- prefer = XML_CATA_PREFER_PUBLIC;
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "Invalid value for prefer: '%s'\n",
- prop);
- }
- xmlFree(prop);
- }
- cur = cur->children;
- xmlParseXMLCatalogNodeList(cur, prefer, parent);
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "File %s is not an XML Catalog\n", filename);
- xmlFreeDoc(doc);
- return(NULL);
- }
- xmlFreeDoc(doc);
- return(parent);
-}
-
-/**
- * xmlFetchXMLCatalogFile:
- * @catal: an existing but incomplete catalog entry
- *
- * Fetch and parse the subcatalog referenced by an entry
- *
- * Returns 0 in case of success, -1 otherwise
- */
-static int
-xmlFetchXMLCatalogFile(xmlCatalogEntryPtr catal) {
- xmlCatalogEntryPtr doc;
-
- if (catal == NULL)
- return(-1);
- if (catal->URL == NULL)
- return(-1);
- if (catal->children != NULL)
- return(-1);
-
- /*
- * lock the whole catalog for modification
- */
- xmlRMutexLock(xmlCatalogMutex);
- if (catal->children != NULL) {
- /* Okay someone else did it in the meantime */
- xmlRMutexUnlock(xmlCatalogMutex);
- return(0);
- }
-
- if (xmlCatalogXMLFiles != NULL) {
- doc = (xmlCatalogEntryPtr)
- xmlHashLookup(xmlCatalogXMLFiles, catal->URL);
- if (doc != NULL) {
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Found %s in file hash\n", catal->URL);
-
- if (catal->type == XML_CATA_CATALOG)
- catal->children = doc->children;
- else
- catal->children = doc;
- catal->dealloc = 0;
- xmlRMutexUnlock(xmlCatalogMutex);
- return(0);
- }
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "%s not found in file hash\n", catal->URL);
- }
-
- /*
- * Fetch and parse. Note that xmlParseXMLCatalogFile does not
- * use the existing catalog, there is no recursion allowed at
- * that level.
- */
- doc = xmlParseXMLCatalogFile(catal->prefer, catal->URL);
- if (doc == NULL) {
- catal->type = XML_CATA_BROKEN_CATALOG;
- xmlRMutexUnlock(xmlCatalogMutex);
- return(-1);
- }
-
- if (catal->type == XML_CATA_CATALOG)
- catal->children = doc->children;
- else
- catal->children = doc;
-
- doc->dealloc = 1;
-
- if (xmlCatalogXMLFiles == NULL)
- xmlCatalogXMLFiles = xmlHashCreate(10);
- if (xmlCatalogXMLFiles != NULL) {
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "%s added to file hash\n", catal->URL);
- xmlHashAddEntry(xmlCatalogXMLFiles, catal->URL, doc);
- }
- xmlRMutexUnlock(xmlCatalogMutex);
- return(0);
-}
-
-/************************************************************************
- * *
- * XML Catalog handling *
- * *
- ************************************************************************/
-
-/**
- * xmlAddXMLCatalog:
- * @catal: top of an XML catalog
- * @type: the type of record to add to the catalog
- * @orig: the system, public or prefix to match (or NULL)
- * @replace: the replacement value for the match
- *
- * Add an entry in the XML catalog, it may overwrite existing but
- * different entries.
- *
- * Returns 0 if successful, -1 otherwise
- */
-static int
-xmlAddXMLCatalog(xmlCatalogEntryPtr catal, const xmlChar *type,
- const xmlChar *orig, const xmlChar *replace) {
- xmlCatalogEntryPtr cur;
- xmlCatalogEntryType typ;
- int doregister = 0;
-
- if ((catal == NULL) ||
- ((catal->type != XML_CATA_CATALOG) &&
- (catal->type != XML_CATA_BROKEN_CATALOG)))
- return(-1);
- if (catal->children == NULL) {
- xmlFetchXMLCatalogFile(catal);
- }
- if (catal->children == NULL)
- doregister = 1;
-
- typ = xmlGetXMLCatalogEntryType(type);
- if (typ == XML_CATA_NONE) {
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Failed to add unknown element %s to catalog\n", type);
- return(-1);
- }
-
- cur = catal->children;
- /*
- * Might be a simple "update in place"
- */
- if (cur != NULL) {
- while (cur != NULL) {
- if ((orig != NULL) && (cur->type == typ) &&
- (xmlStrEqual(orig, cur->name))) {
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Updating element %s to catalog\n", type);
- if (cur->value != NULL)
- xmlFree(cur->value);
- if (cur->URL != NULL)
- xmlFree(cur->URL);
- cur->value = xmlStrdup(replace);
- cur->URL = xmlStrdup(replace);
- return(0);
- }
- if (cur->next == NULL)
- break;
- cur = cur->next;
- }
- }
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Adding element %s to catalog\n", type);
- if (cur == NULL)
- catal->children = xmlNewCatalogEntry(typ, orig, replace,
- NULL, catal->prefer);
- else
- cur->next = xmlNewCatalogEntry(typ, orig, replace,
- NULL, catal->prefer);
- if (doregister) {
- cur = xmlHashLookup(xmlCatalogXMLFiles, catal->URL);
- if (cur != NULL)
- cur->children = catal->children;
- }
-
- return(0);
-}
-
-/**
- * xmlDelXMLCatalog:
- * @catal: top of an XML catalog
- * @value: the value to remove from the catalog
- *
- * Remove entries in the XML catalog where the value or the URI
- * is equal to @value
- *
- * Returns the number of entries removed if successful, -1 otherwise
- */
-static int
-xmlDelXMLCatalog(xmlCatalogEntryPtr catal, const xmlChar *value) {
- xmlCatalogEntryPtr cur;
- int ret = 0;
-
- if ((catal == NULL) ||
- ((catal->type != XML_CATA_CATALOG) &&
- (catal->type != XML_CATA_BROKEN_CATALOG)))
- return(-1);
- if (value == NULL)
- return(-1);
- if (catal->children == NULL) {
- xmlFetchXMLCatalogFile(catal);
- }
-
- /*
- * Scan the children
- */
- cur = catal->children;
- while (cur != NULL) {
- if (((cur->name != NULL) && (xmlStrEqual(value, cur->name))) ||
- (xmlStrEqual(value, cur->value))) {
- if (xmlDebugCatalogs) {
- if (cur->name != NULL)
- xmlGenericError(xmlGenericErrorContext,
- "Removing element %s from catalog\n", cur->name);
- else
- xmlGenericError(xmlGenericErrorContext,
- "Removing element %s from catalog\n", cur->value);
- }
- cur->type = XML_CATA_REMOVED;
- }
- cur = cur->next;
- }
- return(ret);
-}
-
-/**
- * xmlCatalogXMLResolve:
- * @catal: a catalog list
- * @pubId: the public ID string
- * @sysId: the system ID string
- *
- * Do a complete resolution lookup of an External Identifier for a
- * list of catalog entries.
- *
- * Implements (or tries to) 7.1. External Identifier Resolution
- * from http://www.oasis-open.org/committees/entity/spec-2001-08-06.html
- *
- * Returns the URI of the resource or NULL if not found
- */
-static xmlChar *
-xmlCatalogXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID,
- const xmlChar *sysID) {
- xmlChar *ret = NULL;
- xmlCatalogEntryPtr cur;
- int haveDelegate = 0;
- int haveNext = 0;
-
- /*
- * First tries steps 2/ 3/ 4/ if a system ID is provided.
- */
- if (sysID != NULL) {
- xmlCatalogEntryPtr rewrite = NULL;
- int lenrewrite = 0, len;
- cur = catal;
- haveDelegate = 0;
- while (cur != NULL) {
- switch (cur->type) {
- case XML_CATA_SYSTEM:
- if (xmlStrEqual(sysID, cur->name)) {
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Found system match %s\n", cur->name);
- return(xmlStrdup(cur->URL));
- }
- break;
- case XML_CATA_REWRITE_SYSTEM:
- len = xmlStrlen(cur->name);
- if ((len > lenrewrite) &&
- (!xmlStrncmp(sysID, cur->name, len))) {
- lenrewrite = len;
- rewrite = cur;
- }
- break;
- case XML_CATA_DELEGATE_SYSTEM:
- if (!xmlStrncmp(sysID, cur->name, xmlStrlen(cur->name)))
- haveDelegate++;
- break;
- case XML_CATA_NEXT_CATALOG:
- haveNext++;
- break;
- default:
- break;
- }
- cur = cur->next;
- }
- if (rewrite != NULL) {
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Using rewriting rule %s\n", rewrite->name);
- ret = xmlStrdup(rewrite->URL);
- if (ret != NULL)
- ret = xmlStrcat(ret, &sysID[lenrewrite]);
- return(ret);
- }
- if (haveDelegate) {
- const xmlChar *delegates[MAX_DELEGATE];
- int nbList = 0, i;
-
- /*
- * Assume the entries have been sorted by decreasing substring
- * matches when the list was produced.
- */
- cur = catal;
- while (cur != NULL) {
- if ((cur->type == XML_CATA_DELEGATE_SYSTEM) &&
- (!xmlStrncmp(sysID, cur->name, xmlStrlen(cur->name)))) {
- for (i = 0;i < nbList;i++)
- if (xmlStrEqual(cur->URL, delegates[i]))
- break;
- if (i < nbList) {
- cur = cur->next;
- continue;
- }
- if (nbList < MAX_DELEGATE)
- delegates[nbList++] = cur->URL;
-
- if (cur->children == NULL) {
- xmlFetchXMLCatalogFile(cur);
- }
- if (cur->children != NULL) {
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Trying system delegate %s\n", cur->URL);
- ret = xmlCatalogListXMLResolve(
- cur->children, NULL, sysID);
- if (ret != NULL)
- return(ret);
- }
- }
- cur = cur->next;
- }
- /*
- * Apply the cut algorithm explained in 4/
- */
- return(XML_CATAL_BREAK);
- }
- }
- /*
- * Then tries 5/ 6/ if a public ID is provided
- */
- if (pubID != NULL) {
- cur = catal;
- haveDelegate = 0;
- while (cur != NULL) {
- switch (cur->type) {
- case XML_CATA_PUBLIC:
- if (xmlStrEqual(pubID, cur->name)) {
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Found public match %s\n", cur->name);
- return(xmlStrdup(cur->URL));
- }
- break;
- case XML_CATA_DELEGATE_PUBLIC:
- if (!xmlStrncmp(pubID, cur->name, xmlStrlen(cur->name)) &&
- (cur->prefer == XML_CATA_PREFER_PUBLIC))
- haveDelegate++;
- break;
- case XML_CATA_NEXT_CATALOG:
- if (sysID == NULL)
- haveNext++;
- break;
- default:
- break;
- }
- cur = cur->next;
- }
- if (haveDelegate) {
- const xmlChar *delegates[MAX_DELEGATE];
- int nbList = 0, i;
-
- /*
- * Assume the entries have been sorted by decreasing substring
- * matches when the list was produced.
- */
- cur = catal;
- while (cur != NULL) {
- if ((cur->type == XML_CATA_DELEGATE_PUBLIC) &&
- (cur->prefer == XML_CATA_PREFER_PUBLIC) &&
- (!xmlStrncmp(pubID, cur->name, xmlStrlen(cur->name)))) {
-
- for (i = 0;i < nbList;i++)
- if (xmlStrEqual(cur->URL, delegates[i]))
- break;
- if (i < nbList) {
- cur = cur->next;
- continue;
- }
- if (nbList < MAX_DELEGATE)
- delegates[nbList++] = cur->URL;
-
- if (cur->children == NULL) {
- xmlFetchXMLCatalogFile(cur);
- }
- if (cur->children != NULL) {
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Trying public delegate %s\n", cur->URL);
- ret = xmlCatalogListXMLResolve(
- cur->children, pubID, NULL);
- if (ret != NULL)
- return(ret);
- }
- }
- cur = cur->next;
- }
- /*
- * Apply the cut algorithm explained in 4/
- */
- return(XML_CATAL_BREAK);
- }
- }
- if (haveNext) {
- cur = catal;
- while (cur != NULL) {
- if (cur->type == XML_CATA_NEXT_CATALOG) {
- if (cur->children == NULL) {
- xmlFetchXMLCatalogFile(cur);
- }
- if (cur->children != NULL) {
- ret = xmlCatalogListXMLResolve(cur->children, pubID, sysID);
- if (ret != NULL)
- return(ret);
- }
- }
- cur = cur->next;
- }
- }
-
- return(NULL);
-}
-
-/**
- * xmlCatalogXMLResolveURI:
- * @catal: a catalog list
- * @URI: the URI
- * @sysId: the system ID string
- *
- * Do a complete resolution lookup of an External Identifier for a
- * list of catalog entries.
- *
- * Implements (or tries to) 7.2.2. URI Resolution
- * from http://www.oasis-open.org/committees/entity/spec-2001-08-06.html
- *
- * Returns the URI of the resource or NULL if not found
- */
-static xmlChar *
-xmlCatalogXMLResolveURI(xmlCatalogEntryPtr catal, const xmlChar *URI) {
- xmlChar *ret = NULL;
- xmlCatalogEntryPtr cur;
- int haveDelegate = 0;
- int haveNext = 0;
- xmlCatalogEntryPtr rewrite = NULL;
- int lenrewrite = 0, len;
-
- if (catal == NULL)
- return(NULL);
-
- if (URI == NULL)
- return(NULL);
-
- /*
- * First tries steps 2/ 3/ 4/ if a system ID is provided.
- */
- cur = catal;
- haveDelegate = 0;
- while (cur != NULL) {
- switch (cur->type) {
- case XML_CATA_URI:
- if (xmlStrEqual(URI, cur->name)) {
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Found URI match %s\n", cur->name);
- return(xmlStrdup(cur->URL));
- }
- break;
- case XML_CATA_REWRITE_URI:
- len = xmlStrlen(cur->name);
- if ((len > lenrewrite) &&
- (!xmlStrncmp(URI, cur->name, len))) {
- lenrewrite = len;
- rewrite = cur;
- }
- break;
- case XML_CATA_DELEGATE_URI:
- if (!xmlStrncmp(URI, cur->name, xmlStrlen(cur->name)))
- haveDelegate++;
- break;
- case XML_CATA_NEXT_CATALOG:
- haveNext++;
- break;
- default:
- break;
- }
- cur = cur->next;
- }
- if (rewrite != NULL) {
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Using rewriting rule %s\n", rewrite->name);
- ret = xmlStrdup(rewrite->URL);
- if (ret != NULL)
- ret = xmlStrcat(ret, &URI[lenrewrite]);
- return(ret);
- }
- if (haveDelegate) {
- const xmlChar *delegates[MAX_DELEGATE];
- int nbList = 0, i;
-
- /*
- * Assume the entries have been sorted by decreasing substring
- * matches when the list was produced.
- */
- cur = catal;
- while (cur != NULL) {
- if ((cur->type == XML_CATA_DELEGATE_SYSTEM) &&
- (!xmlStrncmp(URI, cur->name, xmlStrlen(cur->name)))) {
- for (i = 0;i < nbList;i++)
- if (xmlStrEqual(cur->URL, delegates[i]))
- break;
- if (i < nbList) {
- cur = cur->next;
- continue;
- }
- if (nbList < MAX_DELEGATE)
- delegates[nbList++] = cur->URL;
-
- if (cur->children == NULL) {
- xmlFetchXMLCatalogFile(cur);
- }
- if (cur->children != NULL) {
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Trying URI delegate %s\n", cur->URL);
- ret = xmlCatalogListXMLResolveURI(
- cur->children, URI);
- if (ret != NULL)
- return(ret);
- }
- }
- cur = cur->next;
- }
- /*
- * Apply the cut algorithm explained in 4/
- */
- return(XML_CATAL_BREAK);
- }
- if (haveNext) {
- cur = catal;
- while (cur != NULL) {
- if (cur->type == XML_CATA_NEXT_CATALOG) {
- if (cur->children == NULL) {
- xmlFetchXMLCatalogFile(cur);
- }
- if (cur->children != NULL) {
- ret = xmlCatalogListXMLResolveURI(cur->children, URI);
- if (ret != NULL)
- return(ret);
- }
- }
- cur = cur->next;
- }
- }
-
- return(NULL);
-}
-
-/**
- * xmlCatalogListXMLResolve:
- * @catal: a catalog list
- * @pubId: the public ID string
- * @sysId: the system ID string
- *
- * Do a complete resolution lookup of an External Identifier for a
- * list of catalogs
- *
- * Implements (or tries to) 7.1. External Identifier Resolution
- * from http://www.oasis-open.org/committees/entity/spec-2001-08-06.html
- *
- * Returns the URI of the resource or NULL if not found
- */
-static xmlChar *
-xmlCatalogListXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID,
- const xmlChar *sysID) {
- xmlChar *ret = NULL;
- xmlChar *urnID = NULL;
-
- if (catal == NULL)
- return(NULL);
- if ((pubID == NULL) && (sysID == NULL))
- return(NULL);
-
- if (!xmlStrncmp(pubID, BAD_CAST XML_URN_PUBID, sizeof(XML_URN_PUBID) - 1)) {
- urnID = xmlCatalogUnWrapURN(pubID);
- if (xmlDebugCatalogs) {
- if (urnID == NULL)
- xmlGenericError(xmlGenericErrorContext,
- "Public URN ID %s expanded to NULL\n", pubID);
- else
- xmlGenericError(xmlGenericErrorContext,
- "Public URN ID expanded to %s\n", urnID);
- }
- ret = xmlCatalogListXMLResolve(catal, urnID, sysID);
- if (urnID != NULL)
- xmlFree(urnID);
- return(ret);
- }
- if (!xmlStrncmp(sysID, BAD_CAST XML_URN_PUBID, sizeof(XML_URN_PUBID) - 1)) {
- urnID = xmlCatalogUnWrapURN(sysID);
- if (xmlDebugCatalogs) {
- if (urnID == NULL)
- xmlGenericError(xmlGenericErrorContext,
- "System URN ID %s expanded to NULL\n", sysID);
- else
- xmlGenericError(xmlGenericErrorContext,
- "System URN ID expanded to %s\n", urnID);
- }
- if (pubID == NULL)
- ret = xmlCatalogListXMLResolve(catal, urnID, NULL);
- else if (xmlStrEqual(pubID, urnID))
- ret = xmlCatalogListXMLResolve(catal, pubID, NULL);
- else {
- ret = xmlCatalogListXMLResolve(catal, pubID, NULL);
- }
- if (urnID != NULL)
- xmlFree(urnID);
- return(ret);
- }
- while (catal != NULL) {
- if (catal->type == XML_CATA_CATALOG) {
- if (catal->children == NULL) {
- xmlFetchXMLCatalogFile(catal);
- }
- if (catal->children != NULL) {
- ret = xmlCatalogXMLResolve(catal->children, pubID, sysID);
- if (ret != NULL)
- return(ret);
- }
- }
- catal = catal->next;
- }
- return(ret);
-}
-
-/**
- * xmlCatalogListXMLResolveURI:
- * @catal: a catalog list
- * @URI: the URI
- *
- * Do a complete resolution lookup of an URI for a list of catalogs
- *
- * Implements (or tries to) 7.2. URI Resolution
- * from http://www.oasis-open.org/committees/entity/spec-2001-08-06.html
- *
- * Returns the URI of the resource or NULL if not found
- */
-static xmlChar *
-xmlCatalogListXMLResolveURI(xmlCatalogEntryPtr catal, const xmlChar *URI) {
- xmlChar *ret = NULL;
- xmlChar *urnID = NULL;
-
- if (catal == NULL)
- return(NULL);
- if (URI == NULL)
- return(NULL);
-
- if (!xmlStrncmp(URI, BAD_CAST XML_URN_PUBID, sizeof(XML_URN_PUBID) - 1)) {
- urnID = xmlCatalogUnWrapURN(URI);
- if (xmlDebugCatalogs) {
- if (urnID == NULL)
- xmlGenericError(xmlGenericErrorContext,
- "URN ID %s expanded to NULL\n", URI);
- else
- xmlGenericError(xmlGenericErrorContext,
- "URN ID expanded to %s\n", urnID);
- }
- ret = xmlCatalogListXMLResolve(catal, urnID, NULL);
- if (urnID != NULL)
- xmlFree(urnID);
- return(ret);
- }
- while (catal != NULL) {
- if (catal->type == XML_CATA_CATALOG) {
- if (catal->children == NULL) {
- xmlFetchXMLCatalogFile(catal);
- }
- if (catal->children != NULL) {
- ret = xmlCatalogXMLResolveURI(catal->children, URI);
- if (ret != NULL)
- return(ret);
- }
- }
- catal = catal->next;
- }
- return(ret);
-}
-
-/************************************************************************
- * *
- * The SGML Catalog parser *
- * *
- ************************************************************************/
-
-
-#define RAW *cur
-#define NEXT cur++;
-#define SKIP(x) cur += x;
-
-#define SKIP_BLANKS while (IS_BLANK(*cur)) NEXT;
-
-/**
- * xmlParseSGMLCatalogComment:
- * @cur: the current character
- *
- * Skip a comment in an SGML catalog
- *
- * Returns new current character
- */
-static const xmlChar *
-xmlParseSGMLCatalogComment(const xmlChar *cur) {
- if ((cur[0] != '-') || (cur[1] != '-'))
- return(cur);
- SKIP(2);
- while ((cur[0] != 0) && ((cur[0] != '-') || ((cur[1] != '-'))))
- NEXT;
- if (cur[0] == 0) {
- return(NULL);
- }
- return(cur + 2);
-}
-
-/**
- * xmlParseSGMLCatalogPubid:
- * @cur: the current character
- * @id: the return location
- *
- * Parse an SGML catalog ID
- *
- * Returns new current character and store the value in @id
- */
-static const xmlChar *
-xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) {
- xmlChar *buf = NULL;
- int len = 0;
- int size = 50;
- xmlChar stop;
- int count = 0;
-
- *id = NULL;
-
- if (RAW == '"') {
- NEXT;
- stop = '"';
- } else if (RAW == '\'') {
- NEXT;
- stop = '\'';
- } else {
- stop = ' ';
- }
- buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", size);
- return(NULL);
- }
- while (xmlIsPubidChar(*cur) || (*cur == '?')) {
- if ((*cur == stop) && (stop != ' '))
- break;
- if ((stop == ' ') && (IS_BLANK(*cur)))
- break;
- if (len + 1 >= size) {
- size *= 2;
- buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %d byte failed\n", size);
- return(NULL);
- }
- }
- buf[len++] = *cur;
- count++;
- NEXT;
- }
- buf[len] = 0;
- if (stop == ' ') {
- if (!IS_BLANK(*cur)) {
- xmlFree(buf);
- return(NULL);
- }
- } else {
- if (*cur != stop) {
- xmlFree(buf);
- return(NULL);
- }
- NEXT;
- }
- *id = buf;
- return(cur);
-}
-
-/**
- * xmlParseSGMLCatalogName:
- * @cur: the current character
- * @name: the return location
- *
- * Parse an SGML catalog name
- *
- * Returns new current character and store the value in @name
- */
-static const xmlChar *
-xmlParseSGMLCatalogName(const xmlChar *cur, xmlChar **name) {
- xmlChar buf[XML_MAX_NAMELEN + 5];
- int len = 0;
- int c;
-
- *name = NULL;
-
- /*
- * Handler for more complex cases
- */
- c = *cur;
- if ((!IS_LETTER(c) && (c != '_') && (c != ':'))) {
- return(NULL);
- }
-
- while (((IS_LETTER(c)) || (IS_DIGIT(c)) ||
- (c == '.') || (c == '-') ||
- (c == '_') || (c == ':'))) {
- buf[len++] = c;
- cur++;
- c = *cur;
- if (len >= XML_MAX_NAMELEN)
- return(NULL);
- }
- *name = xmlStrndup(buf, len);
- return(cur);
-}
-
-/**
- * xmlGetSGMLCatalogEntryType:
- * @name: the entry name
- *
- * Get the Catalog entry type for a given SGML Catalog name
- *
- * Returns Catalog entry type
- */
-static xmlCatalogEntryType
-xmlGetSGMLCatalogEntryType(const xmlChar *name) {
- xmlCatalogEntryType type = XML_CATA_NONE;
- if (xmlStrEqual(name, (const xmlChar *) "SYSTEM"))
- type = SGML_CATA_SYSTEM;
- else if (xmlStrEqual(name, (const xmlChar *) "PUBLIC"))
- type = SGML_CATA_PUBLIC;
- else if (xmlStrEqual(name, (const xmlChar *) "DELEGATE"))
- type = SGML_CATA_DELEGATE;
- else if (xmlStrEqual(name, (const xmlChar *) "ENTITY"))
- type = SGML_CATA_ENTITY;
- else if (xmlStrEqual(name, (const xmlChar *) "DOCTYPE"))
- type = SGML_CATA_DOCTYPE;
- else if (xmlStrEqual(name, (const xmlChar *) "LINKTYPE"))
- type = SGML_CATA_LINKTYPE;
- else if (xmlStrEqual(name, (const xmlChar *) "NOTATION"))
- type = SGML_CATA_NOTATION;
- else if (xmlStrEqual(name, (const xmlChar *) "SGMLDECL"))
- type = SGML_CATA_SGMLDECL;
- else if (xmlStrEqual(name, (const xmlChar *) "DOCUMENT"))
- type = SGML_CATA_DOCUMENT;
- else if (xmlStrEqual(name, (const xmlChar *) "CATALOG"))
- type = SGML_CATA_CATALOG;
- else if (xmlStrEqual(name, (const xmlChar *) "BASE"))
- type = SGML_CATA_BASE;
- else if (xmlStrEqual(name, (const xmlChar *) "DELEGATE"))
- type = SGML_CATA_DELEGATE;
- return(type);
-}
-
-/**
- * xmlParseSGMLCatalog:
- * @catal: the SGML Catalog
- * @value: the content of the SGML Catalog serialization
- * @file: the filepath for the catalog
- * @super: should this be handled as a Super Catalog in which case
- * parsing is not recursive
- *
- * Parse an SGML catalog content and fill up the @catal hash table with
- * the new entries found.
- *
- * Returns 0 in case of success, -1 in case of error.
- */
-static int
-xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value,
- const char *file, int super) {
- const xmlChar *cur = value;
- xmlChar *base = NULL;
- int res;
-
- if ((cur == NULL) || (file == NULL))
- return(-1);
- base = xmlStrdup((const xmlChar *) file);
-
- while ((cur != NULL) && (cur[0] != 0)) {
- SKIP_BLANKS;
- if (cur[0] == 0)
- break;
- if ((cur[0] == '-') && (cur[1] == '-')) {
- cur = xmlParseSGMLCatalogComment(cur);
- if (cur == NULL) {
- /* error */
- break;
- }
- } else {
- xmlChar *sysid = NULL;
- xmlChar *name = NULL;
- xmlCatalogEntryType type = XML_CATA_NONE;
-
- cur = xmlParseSGMLCatalogName(cur, &name);
- if (name == NULL) {
- /* error */
- break;
- }
- if (!IS_BLANK(*cur)) {
- /* error */
- break;
- }
- SKIP_BLANKS;
- if (xmlStrEqual(name, (const xmlChar *) "SYSTEM"))
- type = SGML_CATA_SYSTEM;
- else if (xmlStrEqual(name, (const xmlChar *) "PUBLIC"))
- type = SGML_CATA_PUBLIC;
- else if (xmlStrEqual(name, (const xmlChar *) "DELEGATE"))
- type = SGML_CATA_DELEGATE;
- else if (xmlStrEqual(name, (const xmlChar *) "ENTITY"))
- type = SGML_CATA_ENTITY;
- else if (xmlStrEqual(name, (const xmlChar *) "DOCTYPE"))
- type = SGML_CATA_DOCTYPE;
- else if (xmlStrEqual(name, (const xmlChar *) "LINKTYPE"))
- type = SGML_CATA_LINKTYPE;
- else if (xmlStrEqual(name, (const xmlChar *) "NOTATION"))
- type = SGML_CATA_NOTATION;
- else if (xmlStrEqual(name, (const xmlChar *) "SGMLDECL"))
- type = SGML_CATA_SGMLDECL;
- else if (xmlStrEqual(name, (const xmlChar *) "DOCUMENT"))
- type = SGML_CATA_DOCUMENT;
- else if (xmlStrEqual(name, (const xmlChar *) "CATALOG"))
- type = SGML_CATA_CATALOG;
- else if (xmlStrEqual(name, (const xmlChar *) "BASE"))
- type = SGML_CATA_BASE;
- else if (xmlStrEqual(name, (const xmlChar *) "DELEGATE"))
- type = SGML_CATA_DELEGATE;
- else if (xmlStrEqual(name, (const xmlChar *) "OVERRIDE")) {
- xmlFree(name);
- cur = xmlParseSGMLCatalogName(cur, &name);
- if (name == NULL) {
- /* error */
- break;
- }
- xmlFree(name);
- continue;
- }
- xmlFree(name);
- name = NULL;
-
- switch(type) {
- case SGML_CATA_ENTITY:
- if (*cur == '%')
- type = SGML_CATA_PENTITY;
- case SGML_CATA_PENTITY:
- case SGML_CATA_DOCTYPE:
- case SGML_CATA_LINKTYPE:
- case SGML_CATA_NOTATION:
- cur = xmlParseSGMLCatalogName(cur, &name);
- if (cur == NULL) {
- /* error */
- break;
- }
- if (!IS_BLANK(*cur)) {
- /* error */
- break;
- }
- SKIP_BLANKS;
- cur = xmlParseSGMLCatalogPubid(cur, &sysid);
- if (cur == NULL) {
- /* error */
- break;
- }
- break;
- case SGML_CATA_PUBLIC:
- case SGML_CATA_SYSTEM:
- case SGML_CATA_DELEGATE:
- cur = xmlParseSGMLCatalogPubid(cur, &name);
- if (cur == NULL) {
- /* error */
- break;
- }
- if (!IS_BLANK(*cur)) {
- /* error */
- break;
- }
- SKIP_BLANKS;
- cur = xmlParseSGMLCatalogPubid(cur, &sysid);
- if (cur == NULL) {
- /* error */
- break;
- }
- break;
- case SGML_CATA_BASE:
- case SGML_CATA_CATALOG:
- case SGML_CATA_DOCUMENT:
- case SGML_CATA_SGMLDECL:
- cur = xmlParseSGMLCatalogPubid(cur, &sysid);
- if (cur == NULL) {
- /* error */
- break;
- }
- break;
- default:
- break;
- }
- if (cur == NULL) {
- if (name != NULL)
- xmlFree(name);
- if (sysid != NULL)
- xmlFree(sysid);
- break;
- } else if (type == SGML_CATA_BASE) {
- if (base != NULL)
- xmlFree(base);
- base = xmlStrdup(sysid);
- } else if ((type == SGML_CATA_PUBLIC) ||
- (type == SGML_CATA_SYSTEM)) {
- xmlChar *filename;
-
- filename = xmlBuildURI(sysid, base);
- if (filename != NULL) {
- xmlCatalogEntryPtr entry;
-
- entry = xmlNewCatalogEntry(type, name, filename,
- NULL, XML_CATA_PREFER_NONE);
- res = xmlHashAddEntry(catal->sgml, name, entry);
- if (res < 0) {
- xmlFreeCatalogEntry(entry);
- }
- xmlFree(filename);
- }
-
- } else if (type == SGML_CATA_CATALOG) {
- if (super) {
- xmlCatalogEntryPtr entry;
-
- entry = xmlNewCatalogEntry(type, sysid, NULL, NULL,
- XML_CATA_PREFER_NONE);
- res = xmlHashAddEntry(catal->sgml, sysid, entry);
- if (res < 0) {
- xmlFreeCatalogEntry(entry);
- }
- } else {
- xmlChar *filename;
-
- filename = xmlBuildURI(sysid, base);
- if (filename != NULL) {
- xmlExpandCatalog(catal, (const char *)filename);
- xmlFree(filename);
- }
- }
- }
- /*
- * drop anything else we won't handle it
- */
- if (name != NULL)
- xmlFree(name);
- if (sysid != NULL)
- xmlFree(sysid);
- }
- }
- if (base != NULL)
- xmlFree(base);
- if (cur == NULL)
- return(-1);
- return(0);
-}
-
-/************************************************************************
- * *
- * SGML Catalog handling *
- * *
- ************************************************************************/
-
-/**
- * xmlCatalogGetSGMLPublic:
- * @catal: an SGML catalog hash
- * @pubId: the public ID string
- *
- * Try to lookup the system ID associated to a public ID
- *
- * Returns the system ID if found or NULL otherwise.
- */
-static const xmlChar *
-xmlCatalogGetSGMLPublic(xmlHashTablePtr catal, const xmlChar *pubID) {
- xmlCatalogEntryPtr entry;
-
- if (catal == NULL)
- return(NULL);
-
- entry = (xmlCatalogEntryPtr) xmlHashLookup(catal, pubID);
- if (entry == NULL)
- return(NULL);
- if (entry->type == SGML_CATA_PUBLIC)
- return(entry->URL);
- return(NULL);
-}
-
-/**
- * xmlCatalogGetSGMLSystem:
- * @catal: an SGML catalog hash
- * @sysId: the public ID string
- *
- * Try to lookup the catalog local reference for a system ID
- *
- * Returns the system ID if found or NULL otherwise.
- */
-static const xmlChar *
-xmlCatalogGetSGMLSystem(xmlHashTablePtr catal, const xmlChar *sysID) {
- xmlCatalogEntryPtr entry;
-
- if (catal == NULL)
- return(NULL);
-
- entry = (xmlCatalogEntryPtr) xmlHashLookup(catal, sysID);
- if (entry == NULL)
- return(NULL);
- if (entry->type == SGML_CATA_SYSTEM)
- return(entry->URL);
- return(NULL);
-}
-
-/**
- * xmlCatalogSGMLResolve:
- * @catal: the SGML catalog
- * @pubId: the public ID string
- * @sysId: the system ID string
- *
- * Do a complete resolution lookup of an External Identifier
- *
- * Returns the URI of the resource or NULL if not found
- */
-static const xmlChar *
-xmlCatalogSGMLResolve(xmlCatalogPtr catal, const xmlChar *pubID,
- const xmlChar *sysID) {
- const xmlChar *ret = NULL;
-
- if (catal->sgml == NULL)
- return(NULL);
-
- if (pubID != NULL)
- ret = xmlCatalogGetSGMLPublic(catal->sgml, pubID);
- if (ret != NULL)
- return(ret);
- if (sysID != NULL)
- ret = xmlCatalogGetSGMLSystem(catal->sgml, sysID);
- return(NULL);
-}
-
-/************************************************************************
- * *
- * Specific Public interfaces *
- * *
- ************************************************************************/
-
-/**
- * xmlLoadSGMLSuperCatalog:
- * @filename: a file path
- *
- * Load an SGML super catalog. It won't expand CATALOG or DELEGATE
- * references. This is only needed for manipulating SGML Super Catalogs
- * like adding and removing CATALOG or DELEGATE entries.
- *
- * Returns the catalog parsed or NULL in case of error
- */
-xmlCatalogPtr
-xmlLoadSGMLSuperCatalog(const char *filename)
-{
- xmlChar *content;
- xmlCatalogPtr catal;
- int ret;
-
- content = xmlLoadFileContent(filename);
- if (content == NULL)
- return(NULL);
-
- catal = xmlCreateNewCatalog(XML_SGML_CATALOG_TYPE, xmlCatalogDefaultPrefer);
- if (catal == NULL) {
- xmlFree(content);
- return(NULL);
- }
-
- ret = xmlParseSGMLCatalog(catal, content, filename, 1);
- xmlFree(content);
- if (ret < 0) {
- xmlFreeCatalog(catal);
- return(NULL);
- }
- return (catal);
-}
-
-/**
- * xmlLoadACatalog:
- * @filename: a file path
- *
- * Load the catalog and build the associated data structures.
- * This can be either an XML Catalog or an SGML Catalog
- * It will recurse in SGML CATALOG entries. On the other hand XML
- * Catalogs are not handled recursively.
- *
- * Returns the catalog parsed or NULL in case of error
- */
-xmlCatalogPtr
-xmlLoadACatalog(const char *filename)
-{
- xmlChar *content;
- xmlChar *first;
- xmlCatalogPtr catal;
- int ret;
-
- content = xmlLoadFileContent(filename);
- if (content == NULL)
- return(NULL);
-
-
- first = content;
-
- while ((*first != 0) && (*first != '-') && (*first != '<') &&
- (!(((*first >= 'A') && (*first <= 'Z')) ||
- ((*first >= 'a') && (*first <= 'z')))))
- first++;
-
- if (*first != '<') {
- catal = xmlCreateNewCatalog(XML_SGML_CATALOG_TYPE, xmlCatalogDefaultPrefer);
- if (catal == NULL) {
- xmlFree(content);
- return(NULL);
- }
- ret = xmlParseSGMLCatalog(catal, content, filename, 0);
- if (ret < 0) {
- xmlFreeCatalog(catal);
- xmlFree(content);
- return(NULL);
- }
- } else {
- catal = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE, xmlCatalogDefaultPrefer);
- if (catal == NULL) {
- xmlFree(content);
- return(NULL);
- }
- catal->xml = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL,
- NULL, BAD_CAST filename, xmlCatalogDefaultPrefer);
- }
- xmlFree(content);
- return (catal);
-}
-
-/**
- * xmlExpandCatalog:
- * @catal: a catalog
- * @filename: a file path
- *
- * Load the catalog and expand the existing catal structure.
- * This can be either an XML Catalog or an SGML Catalog
- *
- * Returns 0 in case of success, -1 in case of error
- */
-static int
-xmlExpandCatalog(xmlCatalogPtr catal, const char *filename)
-{
- int ret;
-
- if ((catal == NULL) || (filename == NULL))
- return(-1);
-
-
- if (catal->type == XML_SGML_CATALOG_TYPE) {
- xmlChar *content;
-
- content = xmlLoadFileContent(filename);
- if (content == NULL)
- return(-1);
-
- ret = xmlParseSGMLCatalog(catal, content, filename, 0);
- if (ret < 0) {
- xmlFree(content);
- return(-1);
- }
- xmlFree(content);
- } else {
- xmlCatalogEntryPtr tmp, cur;
- tmp = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL,
- NULL, BAD_CAST filename, xmlCatalogDefaultPrefer);
-
- cur = catal->xml;
- if (cur == NULL) {
- catal->xml = tmp;
- } else {
- while (cur->next != NULL) cur = cur->next;
- cur->next = tmp;
- }
- }
- return (0);
-}
-
-/**
- * xmlACatalogResolveSystem:
- * @catal: a Catalog
- * @sysID: the public ID string
- *
- * Try to lookup the catalog resource for a system ID
- *
- * Returns the system ID if found or NULL otherwise, the value returned
- * must be freed by the caller.
- */
-xmlChar *
-xmlACatalogResolveSystem(xmlCatalogPtr catal, const xmlChar *sysID) {
- xmlChar *ret = NULL;
-
- if ((sysID == NULL) || (catal == NULL))
- return(NULL);
-
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Resolve sysID %s\n", sysID);
-
- if (catal->type == XML_XML_CATALOG_TYPE) {
- ret = xmlCatalogListXMLResolve(catal->xml, NULL, sysID);
- if (ret == XML_CATAL_BREAK)
- ret = NULL;
- } else {
- const xmlChar *sgml;
-
- sgml = xmlCatalogGetSGMLSystem(catal->sgml, sysID);
- if (sgml != NULL)
- ret = xmlStrdup(sgml);
- }
- return(ret);
-}
-
-/**
- * xmlACatalogResolvePublic:
- * @catal: a Catalog
- * @pubID: the public ID string
- *
- * Try to lookup the system ID associated to a public ID in that catalog
- *
- * Returns the system ID if found or NULL otherwise, the value returned
- * must be freed by the caller.
- */
-xmlChar *
-xmlACatalogResolvePublic(xmlCatalogPtr catal, const xmlChar *pubID) {
- xmlChar *ret = NULL;
-
- if ((pubID == NULL) || (catal == NULL))
- return(NULL);
-
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Resolve pubID %s\n", pubID);
-
- if (catal->type == XML_XML_CATALOG_TYPE) {
- ret = xmlCatalogListXMLResolve(catal->xml, pubID, NULL);
- if (ret == XML_CATAL_BREAK)
- ret = NULL;
- } else {
- const xmlChar *sgml;
-
- sgml = xmlCatalogGetSGMLPublic(catal->sgml, pubID);
- if (sgml != NULL)
- ret = xmlStrdup(sgml);
- }
- return(ret);
-}
-
-/**
- * xmlACatalogResolve:
- * @catal: a Catalog
- * @pubID: the public ID string
- * @sysID: the system ID string
- *
- * Do a complete resolution lookup of an External Identifier
- *
- * Returns the URI of the resource or NULL if not found, it must be freed
- * by the caller.
- */
-xmlChar *
-xmlACatalogResolve(xmlCatalogPtr catal, const xmlChar * pubID,
- const xmlChar * sysID)
-{
- xmlChar *ret = NULL;
-
- if (((pubID == NULL) && (sysID == NULL)) || (catal == NULL))
- return (NULL);
-
- if (xmlDebugCatalogs) {
- if (pubID != NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Resolve: pubID %s\n", pubID);
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "Resolve: sysID %s\n", sysID);
- }
- }
-
- if (catal->type == XML_XML_CATALOG_TYPE) {
- ret = xmlCatalogListXMLResolve(catal->xml, pubID, sysID);
- if (ret == XML_CATAL_BREAK)
- ret = NULL;
- } else {
- const xmlChar *sgml;
-
- sgml = xmlCatalogSGMLResolve(catal, pubID, sysID);
- if (sgml != NULL)
- ret = xmlStrdup(sgml);
- }
- return (ret);
-}
-
-/**
- * xmlACatalogResolveURI:
- * @catal: a Catalog
- * @URI: the URI
- *
- * Do a complete resolution lookup of an URI
- *
- * Returns the URI of the resource or NULL if not found, it must be freed
- * by the caller.
- */
-xmlChar *
-xmlACatalogResolveURI(xmlCatalogPtr catal, const xmlChar *URI) {
- xmlChar *ret = NULL;
-
- if ((URI == NULL) || (catal == NULL))
- return(NULL);
-
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Resolve URI %s\n", URI);
-
- if (catal->type == XML_XML_CATALOG_TYPE) {
- ret = xmlCatalogListXMLResolveURI(catal->xml, URI);
- if (ret == XML_CATAL_BREAK)
- ret = NULL;
- } else {
- const xmlChar *sgml;
-
- sgml = xmlCatalogSGMLResolve(catal, NULL, URI);
- if (sgml != NULL)
- sgml = xmlStrdup(sgml);
- }
- return(ret);
-}
-
-/**
- * xmlACatalogDump:
- * @catal: a Catalog
- * @out: the file.
- *
- * Free up all the memory associated with catalogs
- */
-void
-xmlACatalogDump(xmlCatalogPtr catal, FILE *out) {
- if ((out == NULL) || (catal == NULL))
- return;
-
- if (catal->type == XML_XML_CATALOG_TYPE) {
- xmlDumpXMLCatalog(out, catal->xml);
- } else {
- xmlHashScan(catal->sgml,
- (xmlHashScanner) xmlCatalogDumpEntry, out);
- }
-}
-
-/**
- * xmlACatalogAdd:
- * @catal: a Catalog
- * @type: the type of record to add to the catalog
- * @orig: the system, public or prefix to match
- * @replace: the replacement value for the match
- *
- * Add an entry in the catalog, it may overwrite existing but
- * different entries.
- *
- * Returns 0 if successful, -1 otherwise
- */
-int
-xmlACatalogAdd(xmlCatalogPtr catal, const xmlChar * type,
- const xmlChar * orig, const xmlChar * replace)
-{
- int res = -1;
-
- if (catal == NULL)
- return(-1);
-
- if (catal->type == XML_XML_CATALOG_TYPE) {
- res = xmlAddXMLCatalog(catal->xml, type, orig, replace);
- } else {
- xmlCatalogEntryType cattype;
-
- cattype = xmlGetSGMLCatalogEntryType(type);
- if (cattype != XML_CATA_NONE) {
- xmlCatalogEntryPtr entry;
-
- entry = xmlNewCatalogEntry(cattype, orig, replace, NULL,
- XML_CATA_PREFER_NONE);
- if (catal->sgml == NULL)
- catal->sgml = xmlHashCreate(10);
- res = xmlHashAddEntry(catal->sgml, orig, entry);
- }
- }
- return (res);
-}
-
-/**
- * xmlACatalogRemove:
- * @catal: a Catalog
- * @value: the value to remove
- *
- * Remove an entry from the catalog
- *
- * Returns the number of entries removed if successful, -1 otherwise
- */
-int
-xmlACatalogRemove(xmlCatalogPtr catal, const xmlChar *value) {
- int res = -1;
-
- if ((catal == NULL) || (value == NULL))
- return(-1);
-
- if (catal->type == XML_XML_CATALOG_TYPE) {
- res = xmlDelXMLCatalog(catal->xml, value);
- } else {
- res = xmlHashRemoveEntry(catal->sgml, value,
- (xmlHashDeallocator) xmlFreeCatalogEntry);
- if (res == 0)
- res = 1;
- }
- return(res);
-}
-
-/**
- * xmlNewCatalog:
- * @sgml: should this create an SGML catalog
- *
- * create a new Catalog.
- *
- * Returns the xmlCatalogPtr or NULL in case of error
- */
-xmlCatalogPtr
-xmlNewCatalog(int sgml) {
- xmlCatalogPtr catal = NULL;
-
- if (sgml) {
- catal = xmlCreateNewCatalog(XML_SGML_CATALOG_TYPE,
- xmlCatalogDefaultPrefer);
- if ((catal != NULL) && (catal->sgml == NULL))
- catal->sgml = xmlHashCreate(10);
- } else
- catal = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE,
- xmlCatalogDefaultPrefer);
- return(catal);
-}
-
-/**
- * xmlCatalogIsEmpty:
- * @catal: should this create an SGML catalog
- *
- * Check is a catalog is empty
- *
- * Returns 1 if the catalog is empty, 0 if not, amd -1 in case of error.
- */
-int
-xmlCatalogIsEmpty(xmlCatalogPtr catal) {
- if (catal == NULL)
- return(-1);
-
- if (catal->type == XML_XML_CATALOG_TYPE) {
- if (catal->xml == NULL)
- return(1);
- if ((catal->xml->type != XML_CATA_CATALOG) &&
- (catal->xml->type != XML_CATA_BROKEN_CATALOG))
- return(-1);
- if (catal->xml->children == NULL)
- return(1);
- return(0);
- } else {
- int res;
-
- if (catal->sgml == NULL)
- return(1);
- res = xmlHashSize(catal->sgml);
- if (res == 0)
- return(1);
- if (res < 0)
- return(-1);
- }
- return(0);
-}
-
-/************************************************************************
- * *
- * Public interfaces manipulating the global shared default catalog *
- * *
- ************************************************************************/
-
-/**
- * xmlInitializeCatalogData:
- *
- * Do the catalog initialization only of global data, doesn't try to load
- * any catalog actually.
- * this function is not thread safe, catalog initialization should
- * preferably be done once at startup
- */
-static void
-xmlInitializeCatalogData(void) {
- if (xmlCatalogInitialized != 0)
- return;
-
- if (getenv("XML_DEBUG_CATALOG"))
- xmlDebugCatalogs = 1;
- xmlCatalogMutex = xmlNewRMutex();
-
- xmlCatalogInitialized = 1;
-}
-/**
- * xmlInitializeCatalog:
- *
- * Do the catalog initialization.
- * this function is not thread safe, catalog initialization should
- * preferably be done once at startup
- */
-void
-xmlInitializeCatalog(void) {
- if (xmlCatalogInitialized != 0)
- return;
-
- xmlInitializeCatalogData();
- xmlRMutexLock(xmlCatalogMutex);
-
- if (getenv("XML_DEBUG_CATALOG"))
- xmlDebugCatalogs = 1;
-
- if (xmlDefaultCatalog == NULL) {
- const char *catalogs;
- char *path;
- const char *cur, *paths;
- xmlCatalogPtr catal;
- xmlCatalogEntryPtr *nextent;
-
- catalogs = (const char *) getenv("XML_CATALOG_FILES");
- if (catalogs == NULL)
- catalogs = XML_XML_DEFAULT_CATALOG;
-
- catal = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE,
- xmlCatalogDefaultPrefer);
- if (catal != NULL) {
- /* the XML_CATALOG_FILES envvar is allowed to contain a
- space-separated list of entries. */
- cur = catalogs;
- nextent = &catal->xml;
- while (*cur != '\0') {
- while (IS_BLANK(*cur))
- cur++;
- if (*cur != 0) {
- paths = cur;
- while ((*cur != 0) && (!IS_BLANK(*cur)))
- cur++;
- path = (char *) xmlStrndup((const xmlChar *)paths, cur - paths);
- if (path != NULL) {
- *nextent = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL,
- NULL, BAD_CAST path, xmlCatalogDefaultPrefer);
- if (*nextent != NULL)
- nextent = &((*nextent)->next);
- xmlFree(path);
- }
- }
- }
- xmlDefaultCatalog = catal;
- }
- }
-
- xmlRMutexUnlock(xmlCatalogMutex);
-}
-
-
-/**
- * xmlLoadCatalog:
- * @filename: a file path
- *
- * Load the catalog and makes its definitions effective for the default
- * external entity loader. It will recurse in SGML CATALOG entries.
- * this function is not thread safe, catalog initialization should
- * preferably be done once at startup
- *
- * Returns 0 in case of success -1 in case of error
- */
-int
-xmlLoadCatalog(const char *filename)
-{
- int ret;
- xmlCatalogPtr catal;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalogData();
-
- xmlRMutexLock(xmlCatalogMutex);
-
- if (xmlDefaultCatalog == NULL) {
- catal = xmlLoadACatalog(filename);
- if (catal == NULL)
- return(-1);
-
- xmlDefaultCatalog = catal;
- xmlRMutexUnlock(xmlCatalogMutex);
- return(0);
- }
-
- ret = xmlExpandCatalog(xmlDefaultCatalog, filename);
- xmlRMutexUnlock(xmlCatalogMutex);
- return(ret);
-}
-
-/**
- * xmlLoadCatalogs:
- * @pathss: a list of directories separated by a colon or a space.
- *
- * Load the catalogs and makes their definitions effective for the default
- * external entity loader.
- * this function is not thread safe, catalog initialization should
- * preferably be done once at startup
- */
-void
-xmlLoadCatalogs(const char *pathss) {
- const char *cur;
- const char *paths;
- xmlChar *path;
-
- if (pathss == NULL)
- return;
-
- cur = pathss;
- while ((cur != NULL) && (*cur != 0)) {
- while (IS_BLANK(*cur)) cur++;
- if (*cur != 0) {
- paths = cur;
- while ((*cur != 0) && (*cur != ':') && (!IS_BLANK(*cur)))
- cur++;
- path = xmlStrndup((const xmlChar *)paths, cur - paths);
- if (path != NULL) {
- xmlLoadCatalog((const char *) path);
- xmlFree(path);
- }
- }
- while (*cur == ':')
- cur++;
- }
-}
-
-/**
- * xmlCatalogCleanup:
- *
- * Free up all the memory associated with catalogs
- */
-void
-xmlCatalogCleanup(void) {
- if (xmlCatalogInitialized == 0)
- return;
-
- xmlRMutexLock(xmlCatalogMutex);
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Catalogs cleanup\n");
- if (xmlCatalogXMLFiles != NULL)
- xmlHashFree(xmlCatalogXMLFiles,
- (xmlHashDeallocator)xmlFreeCatalogHashEntryList);
- xmlCatalogXMLFiles = NULL;
- if (xmlDefaultCatalog != NULL)
- xmlFreeCatalog(xmlDefaultCatalog);
- xmlDefaultCatalog = NULL;
- xmlDebugCatalogs = 0;
- xmlCatalogInitialized = 0;
- xmlRMutexUnlock(xmlCatalogMutex);
- xmlFreeRMutex(xmlCatalogMutex);
-}
-
-/**
- * xmlCatalogResolveSystem:
- * @sysID: the public ID string
- *
- * Try to lookup the catalog resource for a system ID
- *
- * Returns the system ID if found or NULL otherwise, the value returned
- * must be freed by the caller.
- */
-xmlChar *
-xmlCatalogResolveSystem(const xmlChar *sysID) {
- xmlChar *ret;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalog();
-
- ret = xmlACatalogResolveSystem(xmlDefaultCatalog, sysID);
- return(ret);
-}
-
-/**
- * xmlCatalogResolvePublic:
- * @pubID: the public ID string
- *
- * Try to lookup the system ID associated to a public ID
- *
- * Returns the system ID if found or NULL otherwise, the value returned
- * must be freed by the caller.
- */
-xmlChar *
-xmlCatalogResolvePublic(const xmlChar *pubID) {
- xmlChar *ret;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalog();
-
- ret = xmlACatalogResolvePublic(xmlDefaultCatalog, pubID);
- return(ret);
-}
-
-/**
- * xmlCatalogResolve:
- * @pubID: the public ID string
- * @sysID: the system ID string
- *
- * Do a complete resolution lookup of an External Identifier
- *
- * Returns the URI of the resource or NULL if not found, it must be freed
- * by the caller.
- */
-xmlChar *
-xmlCatalogResolve(const xmlChar *pubID, const xmlChar *sysID) {
- xmlChar *ret;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalog();
-
- ret = xmlACatalogResolve(xmlDefaultCatalog, pubID, sysID);
- return(ret);
-}
-
-/**
- * xmlCatalogResolveURI:
- * @URI: the URI
- *
- * Do a complete resolution lookup of an URI
- *
- * Returns the URI of the resource or NULL if not found, it must be freed
- * by the caller.
- */
-xmlChar *
-xmlCatalogResolveURI(const xmlChar *URI) {
- xmlChar *ret;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalog();
-
- ret = xmlACatalogResolveURI(xmlDefaultCatalog, URI);
- return(ret);
-}
-
-/**
- * xmlCatalogDump:
- * @out: the file.
- *
- * Free up all the memory associated with catalogs
- */
-void
-xmlCatalogDump(FILE *out) {
- if (out == NULL)
- return;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalog();
-
- xmlACatalogDump(xmlDefaultCatalog, out);
-}
-
-/**
- * xmlCatalogAdd:
- * @type: the type of record to add to the catalog
- * @orig: the system, public or prefix to match
- * @replace: the replacement value for the match
- *
- * Add an entry in the catalog, it may overwrite existing but
- * different entries.
- * If called before any other catalog routine, allows to override the
- * default shared catalog put in place by xmlInitializeCatalog();
- *
- * Returns 0 if successful, -1 otherwise
- */
-int
-xmlCatalogAdd(const xmlChar *type, const xmlChar *orig, const xmlChar *replace) {
- int res = -1;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalogData();
-
- xmlRMutexLock(xmlCatalogMutex);
- /*
- * Specific case where one want to override the default catalog
- * put in place by xmlInitializeCatalog();
- */
- if ((xmlDefaultCatalog == NULL) &&
- (xmlStrEqual(type, BAD_CAST "catalog"))) {
- xmlDefaultCatalog = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE,
- xmlCatalogDefaultPrefer);
- xmlDefaultCatalog->xml = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL,
- orig, NULL, xmlCatalogDefaultPrefer);
-
- xmlRMutexUnlock(xmlCatalogMutex);
- return(0);
- }
-
- res = xmlACatalogAdd(xmlDefaultCatalog, type, orig, replace);
- xmlRMutexUnlock(xmlCatalogMutex);
- return(res);
-}
-
-/**
- * xmlCatalogRemove:
- * @value: the value to remove
- *
- * Remove an entry from the catalog
- *
- * Returns the number of entries removed if successful, -1 otherwise
- */
-int
-xmlCatalogRemove(const xmlChar *value) {
- int res;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalog();
-
- xmlRMutexLock(xmlCatalogMutex);
- res = xmlACatalogRemove(xmlDefaultCatalog, value);
- xmlRMutexUnlock(xmlCatalogMutex);
- return(res);
-}
-
-/**
- * xmlCatalogConvert:
- *
- * Convert all the SGML catalog entries as XML ones
- *
- * Returns the number of entries converted if successful, -1 otherwise
- */
-int
-xmlCatalogConvert(void) {
- int res = -1;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalog();
-
- xmlRMutexLock(xmlCatalogMutex);
- res = xmlConvertSGMLCatalog(xmlDefaultCatalog);
- xmlRMutexUnlock(xmlCatalogMutex);
- return(res);
-}
-
-/************************************************************************
- * *
- * Public interface manipulating the common preferences *
- * *
- ************************************************************************/
-
-/**
- * xmlCatalogGetDefaults:
- *
- * Used to get the user preference w.r.t. to what catalogs should
- * be accepted
- *
- * Returns the current xmlCatalogAllow value
- */
-xmlCatalogAllow
-xmlCatalogGetDefaults(void) {
- return(xmlCatalogDefaultAllow);
-}
-
-/**
- * xmlCatalogSetDefaults:
- * @allow: what catalogs should be accepted
- *
- * Used to set the user preference w.r.t. to what catalogs should
- * be accepted
- */
-void
-xmlCatalogSetDefaults(xmlCatalogAllow allow) {
- if (xmlDebugCatalogs) {
- switch (allow) {
- case XML_CATA_ALLOW_NONE:
- xmlGenericError(xmlGenericErrorContext,
- "Disabling catalog usage\n");
- break;
- case XML_CATA_ALLOW_GLOBAL:
- xmlGenericError(xmlGenericErrorContext,
- "Allowing only global catalogs\n");
- break;
- case XML_CATA_ALLOW_DOCUMENT:
- xmlGenericError(xmlGenericErrorContext,
- "Allowing only catalogs from the document\n");
- break;
- case XML_CATA_ALLOW_ALL:
- xmlGenericError(xmlGenericErrorContext,
- "Allowing all catalogs\n");
- break;
- }
- }
- xmlCatalogDefaultAllow = allow;
-}
-
-/**
- * xmlCatalogSetDefaultPrefer:
- * @prefer: the default preference for delegation
- *
- * Allows to set the preference between public and system for deletion
- * in XML Catalog resolution. C.f. section 4.1.1 of the spec
- * Values accepted are XML_CATA_PREFER_PUBLIC or XML_CATA_PREFER_SYSTEM
- *
- * Returns the previous value of the default preference for delegation
- */
-xmlCatalogPrefer
-xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer) {
- xmlCatalogPrefer ret = xmlCatalogDefaultPrefer;
-
- if (prefer == XML_CATA_PREFER_NONE)
- return(ret);
-
- if (xmlDebugCatalogs) {
- switch (prefer) {
- case XML_CATA_PREFER_PUBLIC:
- xmlGenericError(xmlGenericErrorContext,
- "Setting catalog preference to PUBLIC\n");
- break;
- case XML_CATA_PREFER_SYSTEM:
- xmlGenericError(xmlGenericErrorContext,
- "Setting catalog preference to SYSTEM\n");
- break;
- case XML_CATA_PREFER_NONE:
- break;
- }
- }
- xmlCatalogDefaultPrefer = prefer;
- return(ret);
-}
-
-/**
- * xmlCatalogSetDebug:
- * @level: the debug level of catalogs required
- *
- * Used to set the debug level for catalog operation, 0 disable
- * debugging, 1 enable it
- *
- * Returns the previous value of the catalog debugging level
- */
-int
-xmlCatalogSetDebug(int level) {
- int ret = xmlDebugCatalogs;
-
- if (level <= 0)
- xmlDebugCatalogs = 0;
- else
- xmlDebugCatalogs = level;
- return(ret);
-}
-
-/************************************************************************
- * *
- * Minimal interfaces used for per-document catalogs by the parser *
- * *
- ************************************************************************/
-
-/**
- * xmlCatalogFreeLocal:
- * @catalogs: a document's list of catalogs
- *
- * Free up the memory associated to the catalog list
- */
-void
-xmlCatalogFreeLocal(void *catalogs) {
- xmlCatalogEntryPtr catal;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalog();
-
- catal = (xmlCatalogEntryPtr) catalogs;
- if (catal != NULL)
- xmlFreeCatalogEntryList(catal);
-}
-
-
-/**
- * xmlCatalogAddLocal:
- * @catalogs: a document's list of catalogs
- * @URL: the URL to a new local catalog
- *
- * Add the new entry to the catalog list
- *
- * Returns the updated list
- */
-void *
-xmlCatalogAddLocal(void *catalogs, const xmlChar *URL) {
- xmlCatalogEntryPtr catal, add;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalog();
-
- if (URL == NULL)
- return(catalogs);
-
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Adding document catalog %s\n", URL);
-
- add = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL, URL, NULL,
- xmlCatalogDefaultPrefer);
- if (add == NULL)
- return(catalogs);
-
- catal = (xmlCatalogEntryPtr) catalogs;
- if (catal == NULL)
- return((void *) add);
-
- while (catal->next != NULL)
- catal = catal->next;
- catal->next = add;
- return(catalogs);
-}
-
-/**
- * xmlCatalogLocalResolve:
- * @catalogs: a document's list of catalogs
- * @pubID: the public ID string
- * @sysID: the system ID string
- *
- * Do a complete resolution lookup of an External Identifier using a
- * document's private catalog list
- *
- * Returns the URI of the resource or NULL if not found, it must be freed
- * by the caller.
- */
-xmlChar *
-xmlCatalogLocalResolve(void *catalogs, const xmlChar *pubID,
- const xmlChar *sysID) {
- xmlCatalogEntryPtr catal;
- xmlChar *ret;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalog();
-
- if ((pubID == NULL) && (sysID == NULL))
- return(NULL);
-
- if (xmlDebugCatalogs) {
- if (pubID != NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Local resolve: pubID %s\n", pubID);
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "Local resolve: sysID %s\n", sysID);
- }
- }
-
- catal = (xmlCatalogEntryPtr) catalogs;
- if (catal == NULL)
- return(NULL);
- ret = xmlCatalogListXMLResolve(catal, pubID, sysID);
- if ((ret != NULL) && (ret != XML_CATAL_BREAK))
- return(ret);
- return(NULL);
-}
-
-/**
- * xmlCatalogLocalResolveURI:
- * @catalogs: a document's list of catalogs
- * @URI: the URI
- *
- * Do a complete resolution lookup of an URI using a
- * document's private catalog list
- *
- * Returns the URI of the resource or NULL if not found, it must be freed
- * by the caller.
- */
-xmlChar *
-xmlCatalogLocalResolveURI(void *catalogs, const xmlChar *URI) {
- xmlCatalogEntryPtr catal;
- xmlChar *ret;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalog();
-
- if (URI == NULL)
- return(NULL);
-
- if (xmlDebugCatalogs)
- xmlGenericError(xmlGenericErrorContext,
- "Resolve URI %s\n", URI);
-
- catal = (xmlCatalogEntryPtr) catalogs;
- if (catal == NULL)
- return(NULL);
- ret = xmlCatalogListXMLResolveURI(catal, URI);
- if ((ret != NULL) && (ret != XML_CATAL_BREAK))
- return(ret);
- return(NULL);
-}
-
-/************************************************************************
- * *
- * Deprecated interfaces *
- * *
- ************************************************************************/
-/**
- * xmlCatalogGetSystem:
- * @sysID: the system ID string
- *
- * Try to lookup the system ID associated to a public ID
- * DEPRECATED, use xmlCatalogResolveSystem()
- *
- * Returns the system ID if found or NULL otherwise.
- */
-const xmlChar *
-xmlCatalogGetSystem(const xmlChar *sysID) {
- xmlChar *ret;
- static xmlChar result[1000];
- static int msg = 0;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalog();
-
- if (msg == 0) {
- xmlGenericError(xmlGenericErrorContext,
- "Use of deprecated xmlCatalogGetSystem() call\n");
- msg++;
- }
-
- if (sysID == NULL)
- return(NULL);
-
- /*
- * Check first the XML catalogs
- */
- if (xmlDefaultCatalog != NULL) {
- ret = xmlCatalogListXMLResolve(xmlDefaultCatalog->xml, NULL, sysID);
- if ((ret != NULL) && (ret != XML_CATAL_BREAK)) {
- snprintf((char *) result, sizeof(result) - 1, "%s", (char *) ret);
- result[sizeof(result) - 1] = 0;
- return(result);
- }
- }
-
- if (xmlDefaultCatalog != NULL)
- return(xmlCatalogGetSGMLSystem(xmlDefaultCatalog->sgml, sysID));
- return(NULL);
-}
-
-/**
- * xmlCatalogGetPublic:
- * @pubID: the public ID string
- *
- * Try to lookup the system ID associated to a public ID
- * DEPRECATED, use xmlCatalogResolvePublic()
- *
- * Returns the system ID if found or NULL otherwise.
- */
-const xmlChar *
-xmlCatalogGetPublic(const xmlChar *pubID) {
- xmlChar *ret;
- static xmlChar result[1000];
- static int msg = 0;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalog();
-
- if (msg == 0) {
- xmlGenericError(xmlGenericErrorContext,
- "Use of deprecated xmlCatalogGetPublic() call\n");
- msg++;
- }
-
- if (pubID == NULL)
- return(NULL);
-
- /*
- * Check first the XML catalogs
- */
- if (xmlDefaultCatalog != NULL) {
- ret = xmlCatalogListXMLResolve(xmlDefaultCatalog->xml, pubID, NULL);
- if ((ret != NULL) && (ret != XML_CATAL_BREAK)) {
- snprintf((char *) result, sizeof(result) - 1, "%s", (char *) ret);
- result[sizeof(result) - 1] = 0;
- return(result);
- }
- }
-
- if (xmlDefaultCatalog != NULL)
- return(xmlCatalogGetSGMLPublic(xmlDefaultCatalog->sgml, pubID));
- return(NULL);
-}
-
-#endif /* LIBXML_CATALOG_ENABLED */
diff --git a/bundle/libxml/config.m4 b/bundle/libxml/config.m4
deleted file mode 100644
index 4faadda0ac..0000000000
--- a/bundle/libxml/config.m4
+++ /dev/null
@@ -1,80 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_BUNDLE(bundle-libxml, Whether to bundle the libxml2 library,
-[ --without-bundle-libxml Disable the bundled libxml2 library], yes)
-
-AC_DEFUN(PHP_LIBXML_CHECK_VERSION,[
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS=-I$LIBXML_DIR/include$LIBXML_ADD
- AC_MSG_CHECKING(for libxml version)
- AC_EGREP_CPP(yes,[
-#include <libxml/xmlversion.h>
-#if LIBXML_VERSION >= 20414
- yes
-#endif
- ],[
- AC_MSG_RESULT(>= 2.4.14)
- ],[
- AC_MSG_ERROR(libxml version 2.4.14 or greater required.)
- ])
- CPPFLAGS=$old_CPPFLAGS
-])
-
-if test "$PHP_BUNDLE_LIBXML" = "yes"; then
- AC_DEFINE(HAVE_LIBXML, 1, [ ])
- AC_DEFINE(HAVE_LIBXML_BUNDLED, 1, [ ])
- PHP_ADD_SOURCES(bundle/libxml, DOCBparser.c encoding.c nanohttp.c valid.c xmlreader.c \
- HTMLparser.c entities.c parser.c threads.c xinclude.c xmlregexp.c \
- HTMLtree.c error.c parserInternals.c tree.c xlink.c xmlschemas.c \
- SAX.c globals.c trio.c xmlIO.c xmlschemastypes.c \
- c14n.c hash.c trionan.c xmlunicode.c debugXML.c \
- catalog.c list.c triostr.c xpath.c \
- nanoftp.c uri.c xmlmemory.c xpointer.c)
- PHP_ADD_INCLUDE(bundle/libxml/include/)
- PHP_ADD_INCLUDE(bundle/libxml/)
-elif test "$PHP_BUNDLE_LIBXML" != "no"; then
- for i in $PHP_BUNDLE_LIBXML; do
- if test -r $i/include/libxml/tree.h; then
- LIBXML_DIR=$i
- elif test -r $i/include/libxml2/libxml/tree.h; then
- LIBXML_DIR=$i
- LIBXML_ADD="/libxml2"
- fi
- done
-
- if test -z "$LIBXML_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the libxml >= 2.4.14 distribution)
- fi
-
- PHP_LIBXML_CHECK_VERSION
-
- if test -r $LIBXML_DIR/lib/libxml2.a -o -f $LIBXML_DIR/lib/libxml2.$SHLIB_SUFFIX_NAMEE; then
- LIBXML_LIBNAME=xml2
- else
- LIBXML_LIBNAME=xml
- fi
-
- XML2_CONFIG=$LIBXML_DIR/bin/xml2-config
-
- if test -x $XML2_CONFIG; then
- LIBXML_LIBS=`$XML2_CONFIG --libs`
- PHP_EVAL_LIBLINE($LIBXML_LIBS, LIBXML_SHARED_LIBADD)
- else
- PHP_ADD_LIBRARY_WITH_PATH($LIBXML_LIBNAME, $LIBXML_DIR/lib, LIBXML_SHARED_LIBADD)
- fi
-
- PHP_ADD_INCLUDE($LIBXML_DIR/include$LIBXML_ADD)
-
- if test "$PHP_ZLIB_DIR" = "no"; then
- AC_MSG_ERROR(libxml requires zlib. Use --with-zlib-dir=<DIR>)
- else
- PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/lib, LIBXML_SHARED_LIBADD)
- fi
-
- AC_DEFINE(HAVE_LIBXML, 1, [ ])
- PHP_SUBST(LIBXML_SHARED_LIBADD)
-fi
-
diff --git a/bundle/libxml/debugXML.c b/bundle/libxml/debugXML.c
deleted file mode 100644
index 07a016861a..0000000000
--- a/bundle/libxml/debugXML.c
+++ /dev/null
@@ -1,2480 +0,0 @@
-/*
- * debugXML.c : This is a set of routines used for debugging the tree
- * produced by the XML parser.
- *
- * See Copyright for the status of this software.
- *
- * Daniel Veillard <daniel@veillard.com>
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-#ifdef LIBXML_DEBUG_ENABLED
-
-#include <string.h>
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#include <libxml/xmlmemory.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-#include <libxml/valid.h>
-#include <libxml/debugXML.h>
-#include <libxml/HTMLtree.h>
-#include <libxml/HTMLparser.h>
-#include <libxml/xmlerror.h>
-#include <libxml/globals.h>
-#include <libxml/xpathInternals.h>
-
-/**
- * xmlDebugDumpString:
- * @output: the FILE * for the output
- * @str: the string
- *
- * Dumps informations about the string, shorten it if necessary
- */
-void
-xmlDebugDumpString(FILE * output, const xmlChar * str)
-{
- int i;
-
- if (output == NULL)
- output = stdout;
- if (str == NULL) {
- fprintf(output, "(NULL)");
- return;
- }
- for (i = 0; i < 40; i++)
- if (str[i] == 0)
- return;
- else if (IS_BLANK(str[i]))
- fputc(' ', output);
- else if (str[i] >= 0x80)
- fprintf(output, "#%X", str[i]);
- else
- fputc(str[i], output);
- fprintf(output, "...");
-}
-
-static void
-xmlDebugDumpDtdNode(FILE *output, xmlDtdPtr dtd, int depth) {
- int i;
- char shift[100];
-
- for (i = 0;((i < depth) && (i < 25));i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
-
- fprintf(output, shift);
-
- if (dtd == NULL) {
- fprintf(output, "DTD node is NULL\n");
- return;
- }
-
- if (dtd->type != XML_DTD_NODE) {
- fprintf(output, "PBM: not a DTD\n");
- return;
- }
- if (dtd->name != NULL)
- fprintf(output, "DTD(%s)", dtd->name);
- else
- fprintf(output, "DTD");
- if (dtd->ExternalID != NULL)
- fprintf(output, ", PUBLIC %s", dtd->ExternalID);
- if (dtd->SystemID != NULL)
- fprintf(output, ", SYSTEM %s", dtd->SystemID);
- fprintf(output, "\n");
- /*
- * Do a bit of checking
- */
- if (dtd->parent == NULL)
- fprintf(output, "PBM: DTD has no parent\n");
- if (dtd->doc == NULL)
- fprintf(output, "PBM: DTD has no doc\n");
- if ((dtd->parent != NULL) && (dtd->doc != dtd->parent->doc))
- fprintf(output, "PBM: DTD doc differs from parent's one\n");
- if (dtd->prev == NULL) {
- if ((dtd->parent != NULL) && (dtd->parent->children != (xmlNodePtr)dtd))
- fprintf(output, "PBM: DTD has no prev and not first of list\n");
- } else {
- if (dtd->prev->next != (xmlNodePtr) dtd)
- fprintf(output, "PBM: DTD prev->next : back link wrong\n");
- }
- if (dtd->next == NULL) {
- if ((dtd->parent != NULL) && (dtd->parent->last != (xmlNodePtr) dtd))
- fprintf(output, "PBM: DTD has no next and not last of list\n");
- } else {
- if (dtd->next->prev != (xmlNodePtr) dtd)
- fprintf(output, "PBM: DTD next->prev : forward link wrong\n");
- }
-}
-
-static void
-xmlDebugDumpAttrDecl(FILE *output, xmlAttributePtr attr, int depth) {
- int i;
- char shift[100];
-
- for (i = 0;((i < depth) && (i < 25));i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
-
- fprintf(output, shift);
-
- if (attr == NULL) {
- fprintf(output, "Attribute declaration is NULL\n");
- return;
- }
- if (attr->type != XML_ATTRIBUTE_DECL) {
- fprintf(output, "PBM: not a Attr\n");
- return;
- }
- if (attr->name != NULL)
- fprintf(output, "ATTRDECL(%s)", attr->name);
- else
- fprintf(output, "PBM ATTRDECL noname!!!");
- if (attr->elem != NULL)
- fprintf(output, " for %s", attr->elem);
- else
- fprintf(output, " PBM noelem!!!");
- switch (attr->atype) {
- case XML_ATTRIBUTE_CDATA:
- fprintf(output, " CDATA");
- break;
- case XML_ATTRIBUTE_ID:
- fprintf(output, " ID");
- break;
- case XML_ATTRIBUTE_IDREF:
- fprintf(output, " IDREF");
- break;
- case XML_ATTRIBUTE_IDREFS:
- fprintf(output, " IDREFS");
- break;
- case XML_ATTRIBUTE_ENTITY:
- fprintf(output, " ENTITY");
- break;
- case XML_ATTRIBUTE_ENTITIES:
- fprintf(output, " ENTITIES");
- break;
- case XML_ATTRIBUTE_NMTOKEN:
- fprintf(output, " NMTOKEN");
- break;
- case XML_ATTRIBUTE_NMTOKENS:
- fprintf(output, " NMTOKENS");
- break;
- case XML_ATTRIBUTE_ENUMERATION:
- fprintf(output, " ENUMERATION");
- break;
- case XML_ATTRIBUTE_NOTATION:
- fprintf(output, " NOTATION ");
- break;
- }
- if (attr->tree != NULL) {
- int indx;
- xmlEnumerationPtr cur = attr->tree;
-
- for (indx = 0;indx < 5; indx++) {
- if (indx != 0)
- fprintf(output, "|%s", cur->name);
- else
- fprintf(output, " (%s", cur->name);
- cur = cur->next;
- if (cur == NULL) break;
- }
- if (cur == NULL)
- fprintf(output, ")");
- else
- fprintf(output, "...)");
- }
- switch (attr->def) {
- case XML_ATTRIBUTE_NONE:
- break;
- case XML_ATTRIBUTE_REQUIRED:
- fprintf(output, " REQUIRED");
- break;
- case XML_ATTRIBUTE_IMPLIED:
- fprintf(output, " IMPLIED");
- break;
- case XML_ATTRIBUTE_FIXED:
- fprintf(output, " FIXED");
- break;
- }
- if (attr->defaultValue != NULL) {
- fprintf(output, "\"");
- xmlDebugDumpString(output, attr->defaultValue);
- fprintf(output, "\"");
- }
- fprintf(output, "\n");
-
- /*
- * Do a bit of checking
- */
- if (attr->parent == NULL)
- fprintf(output, "PBM: Attr has no parent\n");
- if (attr->doc == NULL)
- fprintf(output, "PBM: Attr has no doc\n");
- if ((attr->parent != NULL) && (attr->doc != attr->parent->doc))
- fprintf(output, "PBM: Attr doc differs from parent's one\n");
- if (attr->prev == NULL) {
- if ((attr->parent != NULL) && (attr->parent->children != (xmlNodePtr)attr))
- fprintf(output, "PBM: Attr has no prev and not first of list\n");
- } else {
- if (attr->prev->next != (xmlNodePtr) attr)
- fprintf(output, "PBM: Attr prev->next : back link wrong\n");
- }
- if (attr->next == NULL) {
- if ((attr->parent != NULL) && (attr->parent->last != (xmlNodePtr) attr))
- fprintf(output, "PBM: Attr has no next and not last of list\n");
- } else {
- if (attr->next->prev != (xmlNodePtr) attr)
- fprintf(output, "PBM: Attr next->prev : forward link wrong\n");
- }
-}
-
-static void
-xmlDebugDumpElemDecl(FILE *output, xmlElementPtr elem, int depth) {
- int i;
- char shift[100];
-
- for (i = 0;((i < depth) && (i < 25));i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
-
- fprintf(output, shift);
-
- if (elem == NULL) {
- fprintf(output, "Element declaration is NULL\n");
- return;
- }
- if (elem->type != XML_ELEMENT_DECL) {
- fprintf(output, "PBM: not a Elem\n");
- return;
- }
- if (elem->name != NULL) {
- fprintf(output, "ELEMDECL(");
- xmlDebugDumpString(output, elem->name);
- fprintf(output, ")");
- } else
- fprintf(output, "PBM ELEMDECL noname!!!");
- switch (elem->etype) {
- case XML_ELEMENT_TYPE_UNDEFINED:
- fprintf(output, ", UNDEFINED");
- break;
- case XML_ELEMENT_TYPE_EMPTY:
- fprintf(output, ", EMPTY");
- break;
- case XML_ELEMENT_TYPE_ANY:
- fprintf(output, ", ANY");
- break;
- case XML_ELEMENT_TYPE_MIXED:
- fprintf(output, ", MIXED ");
- break;
- case XML_ELEMENT_TYPE_ELEMENT:
- fprintf(output, ", MIXED ");
- break;
- }
- if ((elem->type != XML_ELEMENT_NODE) &&
- (elem->content != NULL)) {
- char buf[5001];
-
- buf[0] = 0;
- xmlSnprintfElementContent(buf, 5000, elem->content, 1);
- buf[5000] = 0;
- fprintf(output, "%s", buf);
- }
- fprintf(output, "\n");
-
- /*
- * Do a bit of checking
- */
- if (elem->parent == NULL)
- fprintf(output, "PBM: Elem has no parent\n");
- if (elem->doc == NULL)
- fprintf(output, "PBM: Elem has no doc\n");
- if ((elem->parent != NULL) && (elem->doc != elem->parent->doc))
- fprintf(output, "PBM: Elem doc differs from parent's one\n");
- if (elem->prev == NULL) {
- if ((elem->parent != NULL) && (elem->parent->children != (xmlNodePtr)elem))
- fprintf(output, "PBM: Elem has no prev and not first of list\n");
- } else {
- if (elem->prev->next != (xmlNodePtr) elem)
- fprintf(output, "PBM: Elem prev->next : back link wrong\n");
- }
- if (elem->next == NULL) {
- if ((elem->parent != NULL) && (elem->parent->last != (xmlNodePtr) elem))
- fprintf(output, "PBM: Elem has no next and not last of list\n");
- } else {
- if (elem->next->prev != (xmlNodePtr) elem)
- fprintf(output, "PBM: Elem next->prev : forward link wrong\n");
- }
-}
-
-static void
-xmlDebugDumpEntityDecl(FILE *output, xmlEntityPtr ent, int depth) {
- int i;
- char shift[100];
-
- for (i = 0;((i < depth) && (i < 25));i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
-
- fprintf(output, shift);
-
- if (ent == NULL) {
- fprintf(output, "Entity declaration is NULL\n");
- return;
- }
- if (ent->type != XML_ENTITY_DECL) {
- fprintf(output, "PBM: not a Entity decl\n");
- return;
- }
- if (ent->name != NULL) {
- fprintf(output, "ENTITYDECL(");
- xmlDebugDumpString(output, ent->name);
- fprintf(output, ")");
- } else
- fprintf(output, "PBM ENTITYDECL noname!!!");
- switch (ent->etype) {
- case XML_INTERNAL_GENERAL_ENTITY:
- fprintf(output, ", internal\n");
- break;
- case XML_EXTERNAL_GENERAL_PARSED_ENTITY:
- fprintf(output, ", external parsed\n");
- break;
- case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY:
- fprintf(output, ", unparsed\n");
- break;
- case XML_INTERNAL_PARAMETER_ENTITY:
- fprintf(output, ", parameter\n");
- break;
- case XML_EXTERNAL_PARAMETER_ENTITY:
- fprintf(output, ", external parameter\n");
- break;
- case XML_INTERNAL_PREDEFINED_ENTITY:
- fprintf(output, ", predefined\n");
- break;
- }
- if (ent->ExternalID) {
- fprintf(output, shift);
- fprintf(output, " ExternalID=%s\n", ent->ExternalID);
- }
- if (ent->SystemID) {
- fprintf(output, shift);
- fprintf(output, " SystemID=%s\n", ent->SystemID);
- }
- if (ent->URI != NULL) {
- fprintf(output, shift);
- fprintf(output, " URI=%s\n", ent->URI);
- }
- if (ent->content) {
- fprintf(output, shift);
- fprintf(output, " content=");
- xmlDebugDumpString(output, ent->content);
- fprintf(output, "\n");
- }
-
- /*
- * Do a bit of checking
- */
- if (ent->parent == NULL)
- fprintf(output, "PBM: Ent has no parent\n");
- if (ent->doc == NULL)
- fprintf(output, "PBM: Ent has no doc\n");
- if ((ent->parent != NULL) && (ent->doc != ent->parent->doc))
- fprintf(output, "PBM: Ent doc differs from parent's one\n");
- if (ent->prev == NULL) {
- if ((ent->parent != NULL) && (ent->parent->children != (xmlNodePtr)ent))
- fprintf(output, "PBM: Ent has no prev and not first of list\n");
- } else {
- if (ent->prev->next != (xmlNodePtr) ent)
- fprintf(output, "PBM: Ent prev->next : back link wrong\n");
- }
- if (ent->next == NULL) {
- if ((ent->parent != NULL) && (ent->parent->last != (xmlNodePtr) ent))
- fprintf(output, "PBM: Ent has no next and not last of list\n");
- } else {
- if (ent->next->prev != (xmlNodePtr) ent)
- fprintf(output, "PBM: Ent next->prev : forward link wrong\n");
- }
-}
-
-static void
-xmlDebugDumpNamespace(FILE *output, xmlNsPtr ns, int depth) {
- int i;
- char shift[100];
-
- for (i = 0;((i < depth) && (i < 25));i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
-
- fprintf(output, shift);
-
- if (ns == NULL) {
- fprintf(output, "namespace node is NULL\n");
- return;
- }
- if (ns->type != XML_NAMESPACE_DECL) {
- fprintf(output, "invalid namespace node %d\n", ns->type);
- return;
- }
- if (ns->href == NULL) {
- if (ns->prefix != NULL)
- fprintf(output, "incomplete namespace %s href=NULL\n", ns->prefix);
- else
- fprintf(output, "incomplete default namespace href=NULL\n");
- } else {
- if (ns->prefix != NULL)
- fprintf(output, "namespace %s href=", ns->prefix);
- else
- fprintf(output, "default namespace href=");
-
- xmlDebugDumpString(output, ns->href);
- fprintf(output, "\n");
- }
-}
-
-static void
-xmlDebugDumpNamespaceList(FILE *output, xmlNsPtr ns, int depth) {
- while (ns != NULL) {
- xmlDebugDumpNamespace(output, ns, depth);
- ns = ns->next;
- }
-}
-
-static void
-xmlDebugDumpEntity(FILE *output, xmlEntityPtr ent, int depth) {
- int i;
- char shift[100];
-
- for (i = 0;((i < depth) && (i < 25));i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
-
- fprintf(output, shift);
-
- if (ent == NULL) {
- fprintf(output, "Entity is NULL\n");
- return;
- }
- switch (ent->etype) {
- case XML_INTERNAL_GENERAL_ENTITY:
- fprintf(output, "INTERNAL_GENERAL_ENTITY ");
- break;
- case XML_EXTERNAL_GENERAL_PARSED_ENTITY:
- fprintf(output, "EXTERNAL_GENERAL_PARSED_ENTITY ");
- break;
- case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY:
- fprintf(output, "EXTERNAL_GENERAL_UNPARSED_ENTITY ");
- break;
- case XML_INTERNAL_PARAMETER_ENTITY:
- fprintf(output, "INTERNAL_PARAMETER_ENTITY ");
- break;
- case XML_EXTERNAL_PARAMETER_ENTITY:
- fprintf(output, "EXTERNAL_PARAMETER_ENTITY ");
- break;
- default:
- fprintf(output, "ENTITY_%d ! ", ent->etype);
- }
- fprintf(output, "%s\n", ent->name);
- if (ent->ExternalID) {
- fprintf(output, shift);
- fprintf(output, "ExternalID=%s\n", ent->ExternalID);
- }
- if (ent->SystemID) {
- fprintf(output, shift);
- fprintf(output, "SystemID=%s\n", ent->SystemID);
- }
- if (ent->URI) {
- fprintf(output, shift);
- fprintf(output, "URI=%s\n", ent->URI);
- }
- if (ent->content) {
- fprintf(output, shift);
- fprintf(output, "content=");
- xmlDebugDumpString(output, ent->content);
- fprintf(output, "\n");
- }
-}
-
-/**
- * xmlDebugDumpAttr:
- * @output: the FILE * for the output
- * @attr: the attribute
- * @depth: the indentation level.
- *
- * Dumps debug information for the attribute
- */
-void
-xmlDebugDumpAttr(FILE *output, xmlAttrPtr attr, int depth) {
- int i;
- char shift[100];
-
- for (i = 0;((i < depth) && (i < 25));i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
-
- fprintf(output, shift);
-
- if (attr == NULL) {
- fprintf(output, "Attr is NULL");
- return;
- }
- fprintf(output, "ATTRIBUTE ");
- xmlDebugDumpString(output, attr->name);
- fprintf(output, "\n");
- if (attr->children != NULL)
- xmlDebugDumpNodeList(output, attr->children, depth + 1);
-
- /*
- * Do a bit of checking
- */
- if (attr->parent == NULL)
- fprintf(output, "PBM: Attr has no parent\n");
- if (attr->doc == NULL)
- fprintf(output, "PBM: Attr has no doc\n");
- if ((attr->parent != NULL) && (attr->doc != attr->parent->doc))
- fprintf(output, "PBM: Attr doc differs from parent's one\n");
- if (attr->prev == NULL) {
- if ((attr->parent != NULL) && (attr->parent->properties != attr))
- fprintf(output, "PBM: Attr has no prev and not first of list\n");
- } else {
- if (attr->prev->next != attr)
- fprintf(output, "PBM: Attr prev->next : back link wrong\n");
- }
- if (attr->next != NULL) {
- if (attr->next->prev != attr)
- fprintf(output, "PBM: Attr next->prev : forward link wrong\n");
- }
-}
-
-/**
- * xmlDebugDumpAttrList:
- * @output: the FILE * for the output
- * @attr: the attribute list
- * @depth: the indentation level.
- *
- * Dumps debug information for the attribute list
- */
-void
-xmlDebugDumpAttrList(FILE * output, xmlAttrPtr attr, int depth)
-{
- if (output == NULL)
- output = stdout;
- while (attr != NULL) {
- xmlDebugDumpAttr(output, attr, depth);
- attr = attr->next;
- }
-}
-
-/**
- * xmlDebugDumpOneNode:
- * @output: the FILE * for the output
- * @node: the node
- * @depth: the indentation level.
- *
- * Dumps debug information for the element node, it is not recursive
- */
-void
-xmlDebugDumpOneNode(FILE * output, xmlNodePtr node, int depth)
-{
- int i;
- char shift[100];
-
- if (output == NULL)
- output = stdout;
- for (i = 0; ((i < depth) && (i < 25)); i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
-
- if (node == NULL) {
- fprintf(output, shift);
- fprintf(output, "node is NULL\n");
- return;
- }
- switch (node->type) {
- case XML_ELEMENT_NODE:
- fprintf(output, shift);
- fprintf(output, "ELEMENT ");
- if ((node->ns != NULL) && (node->ns->prefix != NULL)) {
- xmlDebugDumpString(output, node->ns->prefix);
- fprintf(output, ":");
- }
- xmlDebugDumpString(output, node->name);
- fprintf(output, "\n");
- break;
- case XML_ATTRIBUTE_NODE:
- fprintf(output, shift);
- fprintf(output, "Error, ATTRIBUTE found here\n");
- break;
- case XML_TEXT_NODE:
- fprintf(output, shift);
- if (node->name == (const xmlChar *) xmlStringTextNoenc)
- fprintf(output, "TEXT no enc\n");
- else
- fprintf(output, "TEXT\n");
- break;
- case XML_CDATA_SECTION_NODE:
- fprintf(output, shift);
- fprintf(output, "CDATA_SECTION\n");
- break;
- case XML_ENTITY_REF_NODE:
- fprintf(output, shift);
- fprintf(output, "ENTITY_REF(%s)\n", node->name);
- break;
- case XML_ENTITY_NODE:
- fprintf(output, shift);
- fprintf(output, "ENTITY\n");
- break;
- case XML_PI_NODE:
- fprintf(output, shift);
- fprintf(output, "PI %s\n", node->name);
- break;
- case XML_COMMENT_NODE:
- fprintf(output, shift);
- fprintf(output, "COMMENT\n");
- break;
- case XML_DOCUMENT_NODE:
- case XML_HTML_DOCUMENT_NODE:
- fprintf(output, shift);
- fprintf(output, "Error, DOCUMENT found here\n");
- break;
- case XML_DOCUMENT_TYPE_NODE:
- fprintf(output, shift);
- fprintf(output, "DOCUMENT_TYPE\n");
- break;
- case XML_DOCUMENT_FRAG_NODE:
- fprintf(output, shift);
- fprintf(output, "DOCUMENT_FRAG\n");
- break;
- case XML_NOTATION_NODE:
- fprintf(output, shift);
- fprintf(output, "NOTATION\n");
- break;
- case XML_DTD_NODE:
- xmlDebugDumpDtdNode(output, (xmlDtdPtr) node, depth);
- return;
- case XML_ELEMENT_DECL:
- xmlDebugDumpElemDecl(output, (xmlElementPtr) node, depth);
- return;
- case XML_ATTRIBUTE_DECL:
- xmlDebugDumpAttrDecl(output, (xmlAttributePtr) node, depth);
- return;
- case XML_ENTITY_DECL:
- xmlDebugDumpEntityDecl(output, (xmlEntityPtr) node, depth);
- return;
- case XML_NAMESPACE_DECL:
- xmlDebugDumpNamespace(output, (xmlNsPtr) node, depth);
- return;
- case XML_XINCLUDE_START:
- fprintf(output, shift);
- fprintf(output, "INCLUDE START\n");
- return;
- case XML_XINCLUDE_END:
- fprintf(output, shift);
- fprintf(output, "INCLUDE END\n");
- return;
- default:
- fprintf(output, shift);
- fprintf(output, "NODE_%d !!!\n", node->type);
- return;
- }
- if (node->doc == NULL) {
- fprintf(output, shift);
- fprintf(output, "doc == NULL !!!\n");
- }
- if (node->nsDef != NULL)
- xmlDebugDumpNamespaceList(output, node->nsDef, depth + 1);
- if (node->properties != NULL)
- xmlDebugDumpAttrList(output, node->properties, depth + 1);
- if (node->type != XML_ENTITY_REF_NODE) {
- if ((node->type != XML_ELEMENT_NODE) && (node->content != NULL)) {
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i + 2] = shift[2 * i + 3] = 0;
- fprintf(output, shift);
- fprintf(output, "content=");
- xmlDebugDumpString(output, node->content);
- fprintf(output, "\n");
- }
- } else {
- xmlEntityPtr ent;
-
- ent = xmlGetDocEntity(node->doc, node->name);
- if (ent != NULL)
- xmlDebugDumpEntity(output, ent, depth + 1);
- }
- /*
- * Do a bit of checking
- */
- if (node->parent == NULL)
- fprintf(output, "PBM: Node has no parent\n");
- if (node->doc == NULL)
- fprintf(output, "PBM: Node has no doc\n");
- if ((node->parent != NULL) && (node->doc != node->parent->doc))
- fprintf(output, "PBM: Node doc differs from parent's one\n");
- if (node->prev == NULL) {
- if ((node->parent != NULL) && (node->parent->children != node))
- fprintf(output,
- "PBM: Node has no prev and not first of list\n");
- } else {
- if (node->prev->next != node)
- fprintf(output, "PBM: Node prev->next : back link wrong\n");
- }
- if (node->next == NULL) {
- if ((node->parent != NULL) && (node->parent->last != node))
- fprintf(output,
- "PBM: Node has no next and not last of list\n");
- } else {
- if (node->next->prev != node)
- fprintf(output, "PBM: Node next->prev : forward link wrong\n");
- }
-}
-
-/**
- * xmlDebugDumpNode:
- * @output: the FILE * for the output
- * @node: the node
- * @depth: the indentation level.
- *
- * Dumps debug information for the element node, it is recursive
- */
-void
-xmlDebugDumpNode(FILE * output, xmlNodePtr node, int depth)
-{
- if (output == NULL)
- output = stdout;
- if (node == NULL) {
- int i;
- char shift[100];
-
- for (i = 0; ((i < depth) && (i < 25)); i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
-
- fprintf(output, shift);
- fprintf(output, "node is NULL\n");
- return;
- }
- xmlDebugDumpOneNode(output, node, depth);
- if ((node->children != NULL) && (node->type != XML_ENTITY_REF_NODE))
- xmlDebugDumpNodeList(output, node->children, depth + 1);
-}
-
-/**
- * xmlDebugDumpNodeList:
- * @output: the FILE * for the output
- * @node: the node list
- * @depth: the indentation level.
- *
- * Dumps debug information for the list of element node, it is recursive
- */
-void
-xmlDebugDumpNodeList(FILE * output, xmlNodePtr node, int depth)
-{
- if (output == NULL)
- output = stdout;
- while (node != NULL) {
- xmlDebugDumpNode(output, node, depth);
- node = node->next;
- }
-}
-
-
-/**
- * xmlDebugDumpDocumentHead:
- * @output: the FILE * for the output
- * @doc: the document
- *
- * Dumps debug information cncerning the document, not recursive
- */
-void
-xmlDebugDumpDocumentHead(FILE * output, xmlDocPtr doc)
-{
- if (output == NULL)
- output = stdout;
- if (doc == NULL) {
- fprintf(output, "DOCUMENT == NULL !\n");
- return;
- }
-
- switch (doc->type) {
- case XML_ELEMENT_NODE:
- fprintf(output, "Error, ELEMENT found here ");
- break;
- case XML_ATTRIBUTE_NODE:
- fprintf(output, "Error, ATTRIBUTE found here\n");
- break;
- case XML_TEXT_NODE:
- fprintf(output, "Error, TEXT\n");
- break;
- case XML_CDATA_SECTION_NODE:
- fprintf(output, "Error, CDATA_SECTION\n");
- break;
- case XML_ENTITY_REF_NODE:
- fprintf(output, "Error, ENTITY_REF\n");
- break;
- case XML_ENTITY_NODE:
- fprintf(output, "Error, ENTITY\n");
- break;
- case XML_PI_NODE:
- fprintf(output, "Error, PI\n");
- break;
- case XML_COMMENT_NODE:
- fprintf(output, "Error, COMMENT\n");
- break;
- case XML_DOCUMENT_NODE:
- fprintf(output, "DOCUMENT\n");
- break;
- case XML_HTML_DOCUMENT_NODE:
- fprintf(output, "HTML DOCUMENT\n");
- break;
- case XML_DOCUMENT_TYPE_NODE:
- fprintf(output, "Error, DOCUMENT_TYPE\n");
- break;
- case XML_DOCUMENT_FRAG_NODE:
- fprintf(output, "Error, DOCUMENT_FRAG\n");
- break;
- case XML_NOTATION_NODE:
- fprintf(output, "Error, NOTATION\n");
- break;
- default:
- fprintf(output, "NODE_%d\n", doc->type);
- }
- if (doc->name != NULL) {
- fprintf(output, "name=");
- xmlDebugDumpString(output, BAD_CAST doc->name);
- fprintf(output, "\n");
- }
- if (doc->version != NULL) {
- fprintf(output, "version=");
- xmlDebugDumpString(output, doc->version);
- fprintf(output, "\n");
- }
- if (doc->encoding != NULL) {
- fprintf(output, "encoding=");
- xmlDebugDumpString(output, doc->encoding);
- fprintf(output, "\n");
- }
- if (doc->URL != NULL) {
- fprintf(output, "URL=");
- xmlDebugDumpString(output, doc->URL);
- fprintf(output, "\n");
- }
- if (doc->standalone)
- fprintf(output, "standalone=true\n");
- if (doc->oldNs != NULL)
- xmlDebugDumpNamespaceList(output, doc->oldNs, 0);
-}
-
-/**
- * xmlDebugDumpDocument:
- * @output: the FILE * for the output
- * @doc: the document
- *
- * Dumps debug information for the document, it's recursive
- */
-void
-xmlDebugDumpDocument(FILE * output, xmlDocPtr doc)
-{
- if (output == NULL)
- output = stdout;
- if (doc == NULL) {
- fprintf(output, "DOCUMENT == NULL !\n");
- return;
- }
- xmlDebugDumpDocumentHead(output, doc);
- if (((doc->type == XML_DOCUMENT_NODE) ||
- (doc->type == XML_HTML_DOCUMENT_NODE)) && (doc->children != NULL))
- xmlDebugDumpNodeList(output, doc->children, 1);
-}
-
-/**
- * xmlDebugDumpDTD:
- * @output: the FILE * for the output
- * @dtd: the DTD
- *
- * Dumps debug information for the DTD
- */
-void
-xmlDebugDumpDTD(FILE * output, xmlDtdPtr dtd)
-{
- if (output == NULL)
- output = stdout;
- if (dtd == NULL) {
- fprintf(output, "DTD is NULL\n");
- return;
- }
- if (dtd->type != XML_DTD_NODE) {
- fprintf(output, "PBM: not a DTD\n");
- return;
- }
- if (dtd->name != NULL)
- fprintf(output, "DTD(%s)", dtd->name);
- else
- fprintf(output, "DTD");
- if (dtd->ExternalID != NULL)
- fprintf(output, ", PUBLIC %s", dtd->ExternalID);
- if (dtd->SystemID != NULL)
- fprintf(output, ", SYSTEM %s", dtd->SystemID);
- fprintf(output, "\n");
- /*
- * Do a bit of checking
- */
- if ((dtd->parent != NULL) && (dtd->doc != dtd->parent->doc))
- fprintf(output, "PBM: DTD doc differs from parent's one\n");
- if (dtd->prev == NULL) {
- if ((dtd->parent != NULL)
- && (dtd->parent->children != (xmlNodePtr) dtd))
- fprintf(output,
- "PBM: DTD has no prev and not first of list\n");
- } else {
- if (dtd->prev->next != (xmlNodePtr) dtd)
- fprintf(output, "PBM: DTD prev->next : back link wrong\n");
- }
- if (dtd->next == NULL) {
- if ((dtd->parent != NULL)
- && (dtd->parent->last != (xmlNodePtr) dtd))
- fprintf(output, "PBM: DTD has no next and not last of list\n");
- } else {
- if (dtd->next->prev != (xmlNodePtr) dtd)
- fprintf(output, "PBM: DTD next->prev : forward link wrong\n");
- }
- if (dtd->children == NULL)
- fprintf(output, " DTD is empty\n");
- else
- xmlDebugDumpNodeList(output, dtd->children, 1);
-}
-
-static void
-xmlDebugDumpEntityCallback(xmlEntityPtr cur, FILE *output) {
- if (cur == NULL) {
- fprintf(output, "Entity is NULL");
- return;
- }
- fprintf(output, "%s : ", cur->name);
- switch (cur->etype) {
- case XML_INTERNAL_GENERAL_ENTITY:
- fprintf(output, "INTERNAL GENERAL, ");
- break;
- case XML_EXTERNAL_GENERAL_PARSED_ENTITY:
- fprintf(output, "EXTERNAL PARSED, ");
- break;
- case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY:
- fprintf(output, "EXTERNAL UNPARSED, ");
- break;
- case XML_INTERNAL_PARAMETER_ENTITY:
- fprintf(output, "INTERNAL PARAMETER, ");
- break;
- case XML_EXTERNAL_PARAMETER_ENTITY:
- fprintf(output, "EXTERNAL PARAMETER, ");
- break;
- default:
- fprintf(output, "UNKNOWN TYPE %d",
- cur->etype);
- }
- if (cur->ExternalID != NULL)
- fprintf(output, "ID \"%s\"", cur->ExternalID);
- if (cur->SystemID != NULL)
- fprintf(output, "SYSTEM \"%s\"", cur->SystemID);
- if (cur->orig != NULL)
- fprintf(output, "\n orig \"%s\"", cur->orig);
- if ((cur->type != XML_ELEMENT_NODE) &&
- (cur->content != NULL))
- fprintf(output, "\n content \"%s\"", cur->content);
- fprintf(output, "\n");
-}
-
-/**
- * xmlDebugDumpEntities:
- * @output: the FILE * for the output
- * @doc: the document
- *
- * Dumps debug information for all the entities in use by the document
- */
-void
-xmlDebugDumpEntities(FILE * output, xmlDocPtr doc)
-{
- if (output == NULL)
- output = stdout;
- if (doc == NULL) {
- fprintf(output, "DOCUMENT == NULL !\n");
- return;
- }
-
- switch (doc->type) {
- case XML_ELEMENT_NODE:
- fprintf(output, "Error, ELEMENT found here ");
- break;
- case XML_ATTRIBUTE_NODE:
- fprintf(output, "Error, ATTRIBUTE found here\n");
- break;
- case XML_TEXT_NODE:
- fprintf(output, "Error, TEXT\n");
- break;
- case XML_CDATA_SECTION_NODE:
- fprintf(output, "Error, CDATA_SECTION\n");
- break;
- case XML_ENTITY_REF_NODE:
- fprintf(output, "Error, ENTITY_REF\n");
- break;
- case XML_ENTITY_NODE:
- fprintf(output, "Error, ENTITY\n");
- break;
- case XML_PI_NODE:
- fprintf(output, "Error, PI\n");
- break;
- case XML_COMMENT_NODE:
- fprintf(output, "Error, COMMENT\n");
- break;
- case XML_DOCUMENT_NODE:
- fprintf(output, "DOCUMENT\n");
- break;
- case XML_HTML_DOCUMENT_NODE:
- fprintf(output, "HTML DOCUMENT\n");
- break;
- case XML_DOCUMENT_TYPE_NODE:
- fprintf(output, "Error, DOCUMENT_TYPE\n");
- break;
- case XML_DOCUMENT_FRAG_NODE:
- fprintf(output, "Error, DOCUMENT_FRAG\n");
- break;
- case XML_NOTATION_NODE:
- fprintf(output, "Error, NOTATION\n");
- break;
- default:
- fprintf(output, "NODE_%d\n", doc->type);
- }
- if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) {
- xmlEntitiesTablePtr table = (xmlEntitiesTablePtr)
- doc->intSubset->entities;
-
- fprintf(output, "Entities in internal subset\n");
- xmlHashScan(table, (xmlHashScanner) xmlDebugDumpEntityCallback,
- output);
- } else
- fprintf(output, "No entities in internal subset\n");
- if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) {
- xmlEntitiesTablePtr table = (xmlEntitiesTablePtr)
- doc->extSubset->entities;
-
- fprintf(output, "Entities in external subset\n");
- xmlHashScan(table, (xmlHashScanner) xmlDebugDumpEntityCallback,
- output);
- } else
- fprintf(output, "No entities in external subset\n");
-}
-
-/**
- * xmlLsCountNode:
- * @node: the node to count
- *
- * Count the children of @node.
- *
- * Returns the number of children of @node.
- */
-int
-xmlLsCountNode(xmlNodePtr node) {
- int ret = 0;
- xmlNodePtr list = NULL;
-
- if (node == NULL)
- return(0);
-
- switch (node->type) {
- case XML_ELEMENT_NODE:
- list = node->children;
- break;
- case XML_DOCUMENT_NODE:
- case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- list = ((xmlDocPtr) node)->children;
- break;
- case XML_ATTRIBUTE_NODE:
- list = ((xmlAttrPtr) node)->children;
- break;
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- if (node->content != NULL) {
- ret = xmlStrlen(node->content);
- }
- break;
- case XML_ENTITY_REF_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_ENTITY_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_NOTATION_NODE:
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- case XML_NAMESPACE_DECL:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- ret = 1;
- break;
- }
- for (;list != NULL;ret++)
- list = list->next;
- return(ret);
-}
-
-/**
- * xmlLsOneNode:
- * @output: the FILE * for the output
- * @node: the node to dump
- *
- * Dump to @output the type and name of @node.
- */
-void
-xmlLsOneNode(FILE *output, xmlNodePtr node) {
- if (node == NULL) {
- fprintf(output, "NULL\n");
- return;
- }
- switch (node->type) {
- case XML_ELEMENT_NODE:
- fprintf(output, "-");
- break;
- case XML_ATTRIBUTE_NODE:
- fprintf(output, "a");
- break;
- case XML_TEXT_NODE:
- fprintf(output, "t");
- break;
- case XML_CDATA_SECTION_NODE:
- fprintf(output, "C");
- break;
- case XML_ENTITY_REF_NODE:
- fprintf(output, "e");
- break;
- case XML_ENTITY_NODE:
- fprintf(output, "E");
- break;
- case XML_PI_NODE:
- fprintf(output, "p");
- break;
- case XML_COMMENT_NODE:
- fprintf(output, "c");
- break;
- case XML_DOCUMENT_NODE:
- fprintf(output, "d");
- break;
- case XML_HTML_DOCUMENT_NODE:
- fprintf(output, "h");
- break;
- case XML_DOCUMENT_TYPE_NODE:
- fprintf(output, "T");
- break;
- case XML_DOCUMENT_FRAG_NODE:
- fprintf(output, "F");
- break;
- case XML_NOTATION_NODE:
- fprintf(output, "N");
- break;
- case XML_NAMESPACE_DECL:
- fprintf(output, "n");
- break;
- default:
- fprintf(output, "?");
- }
- if (node->type != XML_NAMESPACE_DECL) {
- if (node->properties != NULL)
- fprintf(output, "a");
- else
- fprintf(output, "-");
- if (node->nsDef != NULL)
- fprintf(output, "n");
- else
- fprintf(output, "-");
- }
-
- fprintf(output, " %8d ", xmlLsCountNode(node));
-
- switch (node->type) {
- case XML_ELEMENT_NODE:
- if (node->name != NULL)
- fprintf(output, "%s", node->name);
- break;
- case XML_ATTRIBUTE_NODE:
- if (node->name != NULL)
- fprintf(output, "%s", node->name);
- break;
- case XML_TEXT_NODE:
- if (node->content != NULL) {
- xmlDebugDumpString(output, node->content);
- }
- break;
- case XML_CDATA_SECTION_NODE:
- break;
- case XML_ENTITY_REF_NODE:
- if (node->name != NULL)
- fprintf(output, "%s", node->name);
- break;
- case XML_ENTITY_NODE:
- if (node->name != NULL)
- fprintf(output, "%s", node->name);
- break;
- case XML_PI_NODE:
- if (node->name != NULL)
- fprintf(output, "%s", node->name);
- break;
- case XML_COMMENT_NODE:
- break;
- case XML_DOCUMENT_NODE:
- break;
- case XML_HTML_DOCUMENT_NODE:
- break;
- case XML_DOCUMENT_TYPE_NODE:
- break;
- case XML_DOCUMENT_FRAG_NODE:
- break;
- case XML_NOTATION_NODE:
- break;
- case XML_NAMESPACE_DECL: {
- xmlNsPtr ns = (xmlNsPtr) node;
-
- if (ns->prefix == NULL)
- fprintf(output, "default -> %s", ns->href);
- else
- fprintf(output, "%s -> %s", ns->prefix, ns->href);
- break;
- }
- default:
- if (node->name != NULL)
- fprintf(output, "%s", node->name);
- }
- fprintf(output, "\n");
-}
-
-/**
- * xmlBoolToText:
- * @boolval: a bool to turn into text
- *
- * Convenient way to turn bool into text
- *
- * Returns a pointer to either "True" or "False"
- */
-const char *
-xmlBoolToText(int boolval)
-{
- if (boolval)
- return("True");
- else
- return("False");
-}
-
-/****************************************************************
- * *
- * The XML shell related functions *
- * *
- ****************************************************************/
-
-
-
-/*
- * TODO: Improvement/cleanups for the XML shell
- * - allow to shell out an editor on a subpart
- * - cleanup function registrations (with help) and calling
- * - provide registration routines
- */
-
-/**
- * xmlShellPrintXPathError:
- * @errorType: valid xpath error id
- * @arg: the argument that cause xpath to fail
- *
- * Print the xpath error to libxml default error channel
- */
-void
-xmlShellPrintXPathError(int errorType, const char *arg)
-{
- const char *default_arg = "Result";
-
- if (!arg)
- arg = default_arg;
-
- switch (errorType) {
- case XPATH_UNDEFINED:
- xmlGenericError(xmlGenericErrorContext,
- "%s: no such node\n", arg);
- break;
-
- case XPATH_BOOLEAN:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a Boolean\n", arg);
- break;
- case XPATH_NUMBER:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a number\n", arg);
- break;
- case XPATH_STRING:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a string\n", arg);
- break;
- case XPATH_POINT:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a point\n", arg);
- break;
- case XPATH_RANGE:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a range\n", arg);
- break;
- case XPATH_LOCATIONSET:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a range\n", arg);
- break;
- case XPATH_USERS:
- xmlGenericError(xmlGenericErrorContext,
- "%s is user-defined\n", arg);
- break;
- case XPATH_XSLT_TREE:
- xmlGenericError(xmlGenericErrorContext,
- "%s is an XSLT value tree\n", arg);
- break;
- }
- xmlGenericError(xmlGenericErrorContext,
- "Try casting the result string function (xpath builtin)\n",
- arg);
-}
-
-
-/**
- * xmlShellPrintNodeCtxt:
- * @ctxt : a non-null shell context
- * @node : a non-null node to print to the output FILE
- *
- * Print node to the output FILE
- */
-static void
-xmlShellPrintNodeCtxt(xmlShellCtxtPtr ctxt,xmlNodePtr node)
-{
- FILE *fp;
-
- if (!node)
- return;
- if (ctxt == NULL)
- fp = stdout;
- else
- fp = ctxt->output;
-
- if (node->type == XML_DOCUMENT_NODE)
- xmlDocDump(fp, (xmlDocPtr) node);
- else if (node->type == XML_ATTRIBUTE_NODE)
- xmlDebugDumpAttrList(fp, (xmlAttrPtr) node, 0);
- else
- xmlElemDump(fp, node->doc, node);
-
- fprintf(fp, "\n");
-}
-
-/**
- * xmlShellPrintNode:
- * @node : a non-null node to print to the output FILE
- *
- * Print node to the output FILE
- */
-void
-xmlShellPrintNode(xmlNodePtr node)
-{
- xmlShellPrintNodeCtxt(NULL, node);
-}
-
-/**
- * xmlShellPrintXPathResultCtxt:
- * @ctxt: a valid shell context
- * @list: a valid result generated by an xpath evaluation
- *
- * Prints result to the output FILE
- */
-static void
-xmlShellPrintXPathResultCtxt(xmlShellCtxtPtr ctxt,xmlXPathObjectPtr list)
-{
- int i = 0;
- if (!ctxt)
- return;
-
- if (list != NULL) {
- switch (list->type) {
- case XPATH_NODESET:{
- int indx;
-
- if (list->nodesetval) {
- for (indx = 0; indx < list->nodesetval->nodeNr;
- indx++) {
- if (i > 0)
- fprintf(stderr, " -------\n");
- xmlShellPrintNodeCtxt(ctxt,
- list->nodesetval->nodeTab[indx]);
- }
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "Empty node set\n");
- }
- break;
- }
- case XPATH_BOOLEAN:
- xmlGenericError(xmlGenericErrorContext,
- "Is a Boolean:%s\n",
- xmlBoolToText(list->boolval));
- break;
- case XPATH_NUMBER:
- xmlGenericError(xmlGenericErrorContext,
- "Is a number:%0g\n", list->floatval);
- break;
- case XPATH_STRING:
- xmlGenericError(xmlGenericErrorContext,
- "Is a string:%s\n", list->stringval);
- break;
-
- default:
- xmlShellPrintXPathError(list->type, NULL);
- }
- }
-}
-
-/**
- * xmlShellPrintXPathResult:
- * @list: a valid result generated by an xpath evaluation
- *
- * Prints result to the output FILE
- */
-void
-xmlShellPrintXPathResult(xmlXPathObjectPtr list)
-{
- xmlShellPrintXPathResultCtxt(NULL, list);
-}
-
-/**
- * xmlShellList:
- * @ctxt: the shell context
- * @arg: unused
- * @node: a node
- * @node2: unused
- *
- * Implements the XML shell function "ls"
- * Does an Unix like listing of the given node (like a directory)
- *
- * Returns 0
- */
-int
-xmlShellList(xmlShellCtxtPtr ctxt,
- char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
- xmlNodePtr node2 ATTRIBUTE_UNUSED)
-{
- xmlNodePtr cur;
- if (!ctxt)
- return (0);
- if (node == NULL) {
- fprintf(ctxt->output, "NULL\n");
- return (0);
- }
- if ((node->type == XML_DOCUMENT_NODE) ||
- (node->type == XML_HTML_DOCUMENT_NODE)) {
- cur = ((xmlDocPtr) node)->children;
- } else if (node->type == XML_NAMESPACE_DECL) {
- xmlLsOneNode(ctxt->output, node);
- return (0);
- } else if (node->children != NULL) {
- cur = node->children;
- } else {
- xmlLsOneNode(ctxt->output, node);
- return (0);
- }
- while (cur != NULL) {
- xmlLsOneNode(ctxt->output, cur);
- cur = cur->next;
- }
- return (0);
-}
-
-/**
- * xmlShellBase:
- * @ctxt: the shell context
- * @arg: unused
- * @node: a node
- * @node2: unused
- *
- * Implements the XML shell function "base"
- * dumps the current XML base of the node
- *
- * Returns 0
- */
-int
-xmlShellBase(xmlShellCtxtPtr ctxt,
- char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
- xmlNodePtr node2 ATTRIBUTE_UNUSED)
-{
- xmlChar *base;
- if (!ctxt)
- return 0;
- if (node == NULL) {
- fprintf(ctxt->output, "NULL\n");
- return (0);
- }
-
- base = xmlNodeGetBase(node->doc, node);
-
- if (base == NULL) {
- fprintf(ctxt->output, " No base found !!!\n");
- } else {
- fprintf(ctxt->output, "%s\n", base);
- xmlFree(base);
- }
- return (0);
-}
-
-/**
- * xmlShellSetBase:
- * @ctxt: the shell context
- * @arg: the new base
- * @node: a node
- * @node2: unused
- *
- * Implements the XML shell function "setbase"
- * change the current XML base of the node
- *
- * Returns 0
- */
-static int
-xmlShellSetBase(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED,
- char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
- xmlNodePtr node2 ATTRIBUTE_UNUSED)
-{
- xmlNodeSetBase(node, (xmlChar*) arg);
- return (0);
-}
-
-/**
- * xmlShellGrep:
- * @ctxt: the shell context
- * @arg: the string or regular expression to find
- * @node: a node
- * @node2: unused
- *
- * Implements the XML shell function "grep"
- * dumps informations about the node (namespace, attributes, content).
- *
- * Returns 0
- */
-static int
-xmlShellGrep(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED,
- char *arg, xmlNodePtr node, xmlNodePtr node2 ATTRIBUTE_UNUSED)
-{
- if (!ctxt)
- return (0);
- if (node == NULL)
- return (0);
- if (arg == NULL)
- return (0);
-#ifdef LIBXML_REGEXP_ENABLED
- if ((xmlStrchr((xmlChar *) arg, '?')) ||
- (xmlStrchr((xmlChar *) arg, '*')) ||
- (xmlStrchr((xmlChar *) arg, '.')) ||
- (xmlStrchr((xmlChar *) arg, '['))) {
- }
-#endif
- while (node != NULL) {
- if (node->type == XML_COMMENT_NODE) {
- if (xmlStrstr(node->content, (xmlChar *) arg)) {
-
- fprintf(ctxt->output, "%s : ", xmlGetNodePath(node));
- xmlShellList(ctxt, NULL, node, NULL);
- }
- } else if (node->type == XML_TEXT_NODE) {
- if (xmlStrstr(node->content, (xmlChar *) arg)) {
-
- fprintf(ctxt->output, "%s : ", xmlGetNodePath(node->parent));
- xmlShellList(ctxt, NULL, node->parent, NULL);
- }
- }
-
- /*
- * Browse the full subtree, deep first
- */
-
- if ((node->type == XML_DOCUMENT_NODE) ||
- (node->type == XML_HTML_DOCUMENT_NODE)) {
- node = ((xmlDocPtr) node)->children;
- } else if ((node->children != NULL)
- && (node->type != XML_ENTITY_REF_NODE)) {
- /* deep first */
- node = node->children;
- } else if (node->next != NULL) {
- /* then siblings */
- node = node->next;
- } else {
- /* go up to parents->next if needed */
- while (node != NULL) {
- if (node->parent != NULL) {
- node = node->parent;
- }
- if (node->next != NULL) {
- node = node->next;
- break;
- }
- if (node->parent == NULL) {
- node = NULL;
- break;
- }
- }
- }
- }
- return (0);
-}
-
-/**
- * xmlShellDir:
- * @ctxt: the shell context
- * @arg: unused
- * @node: a node
- * @node2: unused
- *
- * Implements the XML shell function "dir"
- * dumps informations about the node (namespace, attributes, content).
- *
- * Returns 0
- */
-int
-xmlShellDir(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED,
- char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
- xmlNodePtr node2 ATTRIBUTE_UNUSED)
-{
- if (!ctxt)
- return (0);
- if (node == NULL) {
- fprintf(ctxt->output, "NULL\n");
- return (0);
- }
- if ((node->type == XML_DOCUMENT_NODE) ||
- (node->type == XML_HTML_DOCUMENT_NODE)) {
- xmlDebugDumpDocumentHead(ctxt->output, (xmlDocPtr) node);
- } else if (node->type == XML_ATTRIBUTE_NODE) {
- xmlDebugDumpAttr(ctxt->output, (xmlAttrPtr) node, 0);
- } else {
- xmlDebugDumpOneNode(ctxt->output, node, 0);
- }
- return (0);
-}
-
-/**
- * xmlShellCat:
- * @ctxt: the shell context
- * @arg: unused
- * @node: a node
- * @node2: unused
- *
- * Implements the XML shell function "cat"
- * dumps the serialization node content (XML or HTML).
- *
- * Returns 0
- */
-int
-xmlShellCat(xmlShellCtxtPtr ctxt, char *arg ATTRIBUTE_UNUSED,
- xmlNodePtr node, xmlNodePtr node2 ATTRIBUTE_UNUSED)
-{
- if (!ctxt)
- return (0);
- if (node == NULL) {
- fprintf(ctxt->output, "NULL\n");
- return (0);
- }
- if (ctxt->doc->type == XML_HTML_DOCUMENT_NODE) {
-#ifdef LIBXML_HTML_ENABLED
- if (node->type == XML_HTML_DOCUMENT_NODE)
- htmlDocDump(ctxt->output, (htmlDocPtr) node);
- else
- htmlNodeDumpFile(ctxt->output, ctxt->doc, node);
-#else
- if (node->type == XML_DOCUMENT_NODE)
- xmlDocDump(ctxt->output, (xmlDocPtr) node);
- else
- xmlElemDump(ctxt->output, ctxt->doc, node);
-#endif /* LIBXML_HTML_ENABLED */
- } else {
- if (node->type == XML_DOCUMENT_NODE)
- xmlDocDump(ctxt->output, (xmlDocPtr) node);
- else
- xmlElemDump(ctxt->output, ctxt->doc, node);
- }
- fprintf(ctxt->output, "\n");
- return (0);
-}
-
-/**
- * xmlShellLoad:
- * @ctxt: the shell context
- * @filename: the file name
- * @node: unused
- * @node2: unused
- *
- * Implements the XML shell function "load"
- * loads a new document specified by the filename
- *
- * Returns 0 or -1 if loading failed
- */
-int
-xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename,
- xmlNodePtr node ATTRIBUTE_UNUSED,
- xmlNodePtr node2 ATTRIBUTE_UNUSED)
-{
- xmlDocPtr doc;
- int html = 0;
-
- if (ctxt->doc != NULL)
- html = (ctxt->doc->type == XML_HTML_DOCUMENT_NODE);
-
- if (html) {
-#ifdef LIBXML_HTML_ENABLED
- doc = htmlParseFile(filename, NULL);
-#else
- fprintf(ctxt->output, "HTML support not compiled in\n");
- doc = NULL;
-#endif /* LIBXML_HTML_ENABLED */
- } else {
- doc = xmlParseFile(filename);
- }
- if (doc != NULL) {
- if (ctxt->loaded == 1) {
- xmlFreeDoc(ctxt->doc);
- }
- ctxt->loaded = 1;
-#ifdef LIBXML_XPATH_ENABLED
- xmlXPathFreeContext(ctxt->pctxt);
-#endif /* LIBXML_XPATH_ENABLED */
- xmlFree(ctxt->filename);
- ctxt->doc = doc;
- ctxt->node = (xmlNodePtr) doc;
-#ifdef LIBXML_XPATH_ENABLED
- ctxt->pctxt = xmlXPathNewContext(doc);
-#endif /* LIBXML_XPATH_ENABLED */
- ctxt->filename = (char *) xmlStrdup((xmlChar *) filename);
- } else
- return (-1);
- return (0);
-}
-
-/**
- * xmlShellWrite:
- * @ctxt: the shell context
- * @filename: the file name
- * @node: a node in the tree
- * @node2: unused
- *
- * Implements the XML shell function "write"
- * Write the current node to the filename, it saves the serialization
- * of the subtree under the @node specified
- *
- * Returns 0 or -1 in case of error
- */
-int
-xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
- xmlNodePtr node2 ATTRIBUTE_UNUSED)
-{
- if (node == NULL)
- return (-1);
- if ((filename == NULL) || (filename[0] == 0)) {
- xmlGenericError(xmlGenericErrorContext,
- "Write command requires a filename argument\n");
- return (-1);
- }
-#ifdef W_OK
- if (access((char *) filename, W_OK)) {
- xmlGenericError(xmlGenericErrorContext,
- "Cannot write to %s\n", filename);
- return (-1);
- }
-#endif
- switch (node->type) {
- case XML_DOCUMENT_NODE:
- if (xmlSaveFile((char *) filename, ctxt->doc) < -1) {
- xmlGenericError(xmlGenericErrorContext,
- "Failed to write to %s\n", filename);
- return (-1);
- }
- break;
- case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_HTML_ENABLED
- if (htmlSaveFile((char *) filename, ctxt->doc) < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "Failed to write to %s\n", filename);
- return (-1);
- }
-#else
- if (xmlSaveFile((char *) filename, ctxt->doc) < -1) {
- xmlGenericError(xmlGenericErrorContext,
- "Failed to write to %s\n", filename);
- return (-1);
- }
-#endif /* LIBXML_HTML_ENABLED */
- break;
- default:{
- FILE *f;
-
- f = fopen((char *) filename, "w");
- if (f == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Failed to write to %s\n", filename);
- return (-1);
- }
- xmlElemDump(f, ctxt->doc, node);
- fclose(f);
- }
- }
- return (0);
-}
-
-/**
- * xmlShellSave:
- * @ctxt: the shell context
- * @filename: the file name (optional)
- * @node: unused
- * @node2: unused
- *
- * Implements the XML shell function "save"
- * Write the current document to the filename, or it's original name
- *
- * Returns 0 or -1 in case of error
- */
-int
-xmlShellSave(xmlShellCtxtPtr ctxt, char *filename,
- xmlNodePtr node ATTRIBUTE_UNUSED,
- xmlNodePtr node2 ATTRIBUTE_UNUSED)
-{
- if (ctxt->doc == NULL)
- return (-1);
- if ((filename == NULL) || (filename[0] == 0))
- filename = ctxt->filename;
-#ifdef W_OK
- if (access((char *) filename, W_OK)) {
- xmlGenericError(xmlGenericErrorContext,
- "Cannot save to %s\n", filename);
- return (-1);
- }
-#endif
- switch (ctxt->doc->type) {
- case XML_DOCUMENT_NODE:
- if (xmlSaveFile((char *) filename, ctxt->doc) < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "Failed to save to %s\n", filename);
- }
- break;
- case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_HTML_ENABLED
- if (htmlSaveFile((char *) filename, ctxt->doc) < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "Failed to save to %s\n", filename);
- }
-#else
- if (xmlSaveFile((char *) filename, ctxt->doc) < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "Failed to save to %s\n", filename);
- }
-#endif /* LIBXML_HTML_ENABLED */
- break;
- default:
- xmlGenericError(xmlGenericErrorContext,
- "To save to subparts of a document use the 'write' command\n");
- return (-1);
-
- }
- return (0);
-}
-
-/**
- * xmlShellValidate:
- * @ctxt: the shell context
- * @dtd: the DTD URI (optional)
- * @node: unused
- * @node2: unused
- *
- * Implements the XML shell function "validate"
- * Validate the document, if a DTD path is provided, then the validation
- * is done against the given DTD.
- *
- * Returns 0 or -1 in case of error
- */
-int
-xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd,
- xmlNodePtr node ATTRIBUTE_UNUSED,
- xmlNodePtr node2 ATTRIBUTE_UNUSED)
-{
- xmlValidCtxt vctxt;
- int res = -1;
-
- vctxt.userData = stderr;
- vctxt.error = (xmlValidityErrorFunc) fprintf;
- vctxt.warning = (xmlValidityWarningFunc) fprintf;
-
- if ((dtd == NULL) || (dtd[0] == 0)) {
- res = xmlValidateDocument(&vctxt, ctxt->doc);
- } else {
- xmlDtdPtr subset;
-
- subset = xmlParseDTD(NULL, (xmlChar *) dtd);
- if (subset != NULL) {
- res = xmlValidateDtd(&vctxt, ctxt->doc, subset);
-
- xmlFreeDtd(subset);
- }
- }
- return (res);
-}
-
-/**
- * xmlShellDu:
- * @ctxt: the shell context
- * @arg: unused
- * @tree: a node defining a subtree
- * @node2: unused
- *
- * Implements the XML shell function "du"
- * show the structure of the subtree under node @tree
- * If @tree is null, the command works on the current node.
- *
- * Returns 0 or -1 in case of error
- */
-int
-xmlShellDu(xmlShellCtxtPtr ctxt,
- char *arg ATTRIBUTE_UNUSED, xmlNodePtr tree,
- xmlNodePtr node2 ATTRIBUTE_UNUSED)
-{
- xmlNodePtr node;
- int indent = 0, i;
-
- if (!ctxt)
- return (-1);
-
- if (tree == NULL)
- return (-1);
- node = tree;
- while (node != NULL) {
- if ((node->type == XML_DOCUMENT_NODE) ||
- (node->type == XML_HTML_DOCUMENT_NODE)) {
- fprintf(ctxt->output, "/\n");
- } else if (node->type == XML_ELEMENT_NODE) {
- for (i = 0; i < indent; i++)
- fprintf(ctxt->output, " ");
- fprintf(ctxt->output, "%s\n", node->name);
- } else {
- }
-
- /*
- * Browse the full subtree, deep first
- */
-
- if ((node->type == XML_DOCUMENT_NODE) ||
- (node->type == XML_HTML_DOCUMENT_NODE)) {
- node = ((xmlDocPtr) node)->children;
- } else if ((node->children != NULL)
- && (node->type != XML_ENTITY_REF_NODE)) {
- /* deep first */
- node = node->children;
- indent++;
- } else if ((node != tree) && (node->next != NULL)) {
- /* then siblings */
- node = node->next;
- } else if (node != tree) {
- /* go up to parents->next if needed */
- while (node != tree) {
- if (node->parent != NULL) {
- node = node->parent;
- indent--;
- }
- if ((node != tree) && (node->next != NULL)) {
- node = node->next;
- break;
- }
- if (node->parent == NULL) {
- node = NULL;
- break;
- }
- if (node == tree) {
- node = NULL;
- break;
- }
- }
- /* exit condition */
- if (node == tree)
- node = NULL;
- } else
- node = NULL;
- }
- return (0);
-}
-
-/**
- * xmlShellPwd:
- * @ctxt: the shell context
- * @buffer: the output buffer
- * @node: a node
- * @node2: unused
- *
- * Implements the XML shell function "pwd"
- * Show the full path from the root to the node, if needed building
- * thumblers when similar elements exists at a given ancestor level.
- * The output is compatible with XPath commands.
- *
- * Returns 0 or -1 in case of error
- */
-int
-xmlShellPwd(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *buffer,
- xmlNodePtr node, xmlNodePtr node2 ATTRIBUTE_UNUSED)
-{
- xmlChar *path;
-
- if (node == NULL)
- return (-1);
-
- path = xmlGetNodePath(node);
- if (path == NULL)
- return (-1);
-
- /*
- * This test prevents buffer overflow, because this routine
- * is only called by xmlShell, in which the second argument is
- * 500 chars long.
- * It is a dirty hack before a cleaner solution is found.
- * Documentation should mention that the second argument must
- * be at least 500 chars long, and could be stripped if too long.
- */
- snprintf(buffer, 499, "%s", path);
- buffer[499] = '0';
- xmlFree(path);
-
- return (0);
-}
-
-/**
- * xmlShell:
- * @doc: the initial document
- * @filename: the output buffer
- * @input: the line reading function
- * @output: the output FILE*, defaults to stdout if NULL
- *
- * Implements the XML shell
- * This allow to load, validate, view, modify and save a document
- * using a environment similar to a UNIX commandline.
- */
-void
-xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
- FILE * output)
-{
- char prompt[500] = "/ > ";
- char *cmdline = NULL, *cur;
- int nbargs;
- char command[100];
- char arg[400];
- int i;
- xmlShellCtxtPtr ctxt;
- xmlXPathObjectPtr list;
-
- if (doc == NULL)
- return;
- if (filename == NULL)
- return;
- if (input == NULL)
- return;
- if (output == NULL)
- output = stdout;
- ctxt = (xmlShellCtxtPtr) xmlMalloc(sizeof(xmlShellCtxt));
- if (ctxt == NULL)
- return;
- ctxt->loaded = 0;
- ctxt->doc = doc;
- ctxt->input = input;
- ctxt->output = output;
- ctxt->filename = (char *) xmlStrdup((xmlChar *) filename);
- ctxt->node = (xmlNodePtr) ctxt->doc;
-
-#ifdef LIBXML_XPATH_ENABLED
- ctxt->pctxt = xmlXPathNewContext(ctxt->doc);
- if (ctxt->pctxt == NULL) {
- xmlFree(ctxt);
- return;
- }
-#endif /* LIBXML_XPATH_ENABLED */
- while (1) {
- if (ctxt->node == (xmlNodePtr) ctxt->doc)
- snprintf(prompt, sizeof(prompt), "%s > ", "/");
- else if (ctxt->node->name)
- snprintf(prompt, sizeof(prompt), "%s > ", ctxt->node->name);
- else
- snprintf(prompt, sizeof(prompt), "? > ");
- prompt[sizeof(prompt) - 1] = 0;
-
- /*
- * Get a new command line
- */
- cmdline = ctxt->input(prompt);
- if (cmdline == NULL)
- break;
-
- /*
- * Parse the command itself
- */
- cur = cmdline;
- nbargs = 0;
- while ((*cur == ' ') || (*cur == '\t'))
- cur++;
- i = 0;
- while ((*cur != ' ') && (*cur != '\t') &&
- (*cur != '\n') && (*cur != '\r')) {
- if (*cur == 0)
- break;
- command[i++] = *cur++;
- }
- command[i] = 0;
- if (i == 0)
- continue;
- nbargs++;
-
- /*
- * Parse the argument
- */
- while ((*cur == ' ') || (*cur == '\t'))
- cur++;
- i = 0;
- while ((*cur != '\n') && (*cur != '\r') && (*cur != 0)) {
- if (*cur == 0)
- break;
- arg[i++] = *cur++;
- }
- arg[i] = 0;
- if (i != 0)
- nbargs++;
-
- /*
- * start interpreting the command
- */
- if (!strcmp(command, "exit"))
- break;
- if (!strcmp(command, "quit"))
- break;
- if (!strcmp(command, "bye"))
- break;
- if (!strcmp(command, "help")) {
- fprintf(ctxt->output, "\tbase display XML base of the node\n");
- fprintf(ctxt->output, "\tsetbase URI change the XML base of the node\n");
- fprintf(ctxt->output, "\tbye leave shell\n");
- fprintf(ctxt->output, "\tcat [node] display node or current node\n");
- fprintf(ctxt->output, "\tcd [path] change directory to path or to root\n");
- fprintf(ctxt->output, "\tdir [path] dumps informations about the node (namespace, attributes, content)\n");
- fprintf(ctxt->output, "\tdu [path] show the structure of the subtree under path or the current node\n");
- fprintf(ctxt->output, "\texit leave shell\n");
- fprintf(ctxt->output, "\thelp display this help\n");
- fprintf(ctxt->output, "\tfree display memory usage\n");
- fprintf(ctxt->output, "\tload [name] load a new document with name\n");
- fprintf(ctxt->output, "\tls [path] list contents of path or the current directory\n");
-#ifdef LIBXML_XPATH_ENABLED
- fprintf(ctxt->output, "\txpath expr evaluate the XPath expression in that context and print the result\n");
-#endif /* LIBXML_XPATH_ENABLED */
- fprintf(ctxt->output, "\tpwd display current working directory\n");
- fprintf(ctxt->output, "\tquit leave shell\n");
- fprintf(ctxt->output, "\tsave [name] save this document to name or the original name\n");
- fprintf(ctxt->output, "\tvalidate check the document for errors\n");
- fprintf(ctxt->output, "\twrite [name] write the current node to the filename\n");
- fprintf(ctxt->output, "\tgrep string search for a string in the subtree\n");
- } else if (!strcmp(command, "validate")) {
- xmlShellValidate(ctxt, arg, NULL, NULL);
- } else if (!strcmp(command, "load")) {
- xmlShellLoad(ctxt, arg, NULL, NULL);
- } else if (!strcmp(command, "save")) {
- xmlShellSave(ctxt, arg, NULL, NULL);
- } else if (!strcmp(command, "write")) {
- xmlShellWrite(ctxt, arg, NULL, NULL);
- } else if (!strcmp(command, "grep")) {
- xmlShellGrep(ctxt, arg, ctxt->node, NULL);
- } else if (!strcmp(command, "free")) {
- if (arg[0] == 0) {
- xmlMemShow(ctxt->output, 0);
- } else {
- int len = 0;
-
- sscanf(arg, "%d", &len);
- xmlMemShow(ctxt->output, len);
- }
- } else if (!strcmp(command, "pwd")) {
- char dir[500];
-
- if (!xmlShellPwd(ctxt, dir, ctxt->node, NULL))
- fprintf(ctxt->output, "%s\n", dir);
- } else if (!strcmp(command, "du")) {
- xmlShellDu(ctxt, NULL, ctxt->node, NULL);
- } else if (!strcmp(command, "base")) {
- xmlShellBase(ctxt, NULL, ctxt->node, NULL);
-#ifdef LIBXML_XPATH_ENABLED
- } else if (!strcmp(command, "xpath")) {
- if (arg[0] == 0) {
- xmlGenericError(xmlGenericErrorContext,
- "xpath: expression required\n");
- } else {
- ctxt->pctxt->node = ctxt->node;
- list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt);
- xmlXPathDebugDumpObject(ctxt->output, list, 0);
- xmlXPathFreeObject(list);
- }
-#endif /* LIBXML_XPATH_ENABLED */
- } else if (!strcmp(command, "setbase")) {
- xmlShellSetBase(ctxt, arg, ctxt->node, NULL);
- } else if ((!strcmp(command, "ls")) || (!strcmp(command, "dir"))) {
- int dir = (!strcmp(command, "dir"));
-
- if (arg[0] == 0) {
- if (dir)
- xmlShellDir(ctxt, NULL, ctxt->node, NULL);
- else
- xmlShellList(ctxt, NULL, ctxt->node, NULL);
- } else {
- ctxt->pctxt->node = ctxt->node;
-#ifdef LIBXML_XPATH_ENABLED
- ctxt->pctxt->node = ctxt->node;
- list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt);
-#else
- list = NULL;
-#endif /* LIBXML_XPATH_ENABLED */
- if (list != NULL) {
- switch (list->type) {
- case XPATH_UNDEFINED:
- xmlGenericError(xmlGenericErrorContext,
- "%s: no such node\n", arg);
- break;
- case XPATH_NODESET:{
- int indx;
-
- if (list->nodesetval == NULL)
- break;
-
- for (indx = 0;
- indx < list->nodesetval->nodeNr;
- indx++) {
- if (dir)
- xmlShellDir(ctxt, NULL,
- list->nodesetval->
- nodeTab[indx], NULL);
- else
- xmlShellList(ctxt, NULL,
- list->nodesetval->
- nodeTab[indx], NULL);
- }
- break;
- }
- case XPATH_BOOLEAN:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a Boolean\n", arg);
- break;
- case XPATH_NUMBER:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a number\n", arg);
- break;
- case XPATH_STRING:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a string\n", arg);
- break;
- case XPATH_POINT:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a point\n", arg);
- break;
- case XPATH_RANGE:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a range\n", arg);
- break;
- case XPATH_LOCATIONSET:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a range\n", arg);
- break;
- case XPATH_USERS:
- xmlGenericError(xmlGenericErrorContext,
- "%s is user-defined\n", arg);
- break;
- case XPATH_XSLT_TREE:
- xmlGenericError(xmlGenericErrorContext,
- "%s is an XSLT value tree\n",
- arg);
- break;
- }
-#ifdef LIBXML_XPATH_ENABLED
- xmlXPathFreeObject(list);
-#endif
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "%s: no such node\n", arg);
- }
- ctxt->pctxt->node = NULL;
- }
- } else if (!strcmp(command, "cd")) {
- if (arg[0] == 0) {
- ctxt->node = (xmlNodePtr) ctxt->doc;
- } else {
-#ifdef LIBXML_XPATH_ENABLED
- ctxt->pctxt->node = ctxt->node;
- list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt);
-#else
- list = NULL;
-#endif /* LIBXML_XPATH_ENABLED */
- if (list != NULL) {
- switch (list->type) {
- case XPATH_UNDEFINED:
- xmlGenericError(xmlGenericErrorContext,
- "%s: no such node\n", arg);
- break;
- case XPATH_NODESET:
- if (list->nodesetval != NULL) {
- if (list->nodesetval->nodeNr == 1) {
- ctxt->node = list->nodesetval->nodeTab[0];
- } else
- xmlGenericError(xmlGenericErrorContext,
- "%s is a %d Node Set\n",
- arg,
- list->nodesetval->nodeNr);
- } else
- xmlGenericError(xmlGenericErrorContext,
- "%s is an empty Node Set\n",
- arg);
- break;
- case XPATH_BOOLEAN:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a Boolean\n", arg);
- break;
- case XPATH_NUMBER:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a number\n", arg);
- break;
- case XPATH_STRING:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a string\n", arg);
- break;
- case XPATH_POINT:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a point\n", arg);
- break;
- case XPATH_RANGE:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a range\n", arg);
- break;
- case XPATH_LOCATIONSET:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a range\n", arg);
- break;
- case XPATH_USERS:
- xmlGenericError(xmlGenericErrorContext,
- "%s is user-defined\n", arg);
- break;
- case XPATH_XSLT_TREE:
- xmlGenericError(xmlGenericErrorContext,
- "%s is an XSLT value tree\n",
- arg);
- break;
- }
-#ifdef LIBXML_XPATH_ENABLED
- xmlXPathFreeObject(list);
-#endif
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "%s: no such node\n", arg);
- }
- ctxt->pctxt->node = NULL;
- }
- } else if (!strcmp(command, "cat")) {
- if (arg[0] == 0) {
- xmlShellCat(ctxt, NULL, ctxt->node, NULL);
- } else {
- ctxt->pctxt->node = ctxt->node;
-#ifdef LIBXML_XPATH_ENABLED
- ctxt->pctxt->node = ctxt->node;
- list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt);
-#else
- list = NULL;
-#endif /* LIBXML_XPATH_ENABLED */
- if (list != NULL) {
- switch (list->type) {
- case XPATH_UNDEFINED:
- xmlGenericError(xmlGenericErrorContext,
- "%s: no such node\n", arg);
- break;
- case XPATH_NODESET:{
- int indx;
-
- if (list->nodesetval == NULL)
- break;
-
- for (indx = 0;
- indx < list->nodesetval->nodeNr;
- indx++) {
- if (i > 0)
- fprintf(ctxt->output, " -------\n");
- xmlShellCat(ctxt, NULL,
- list->nodesetval->
- nodeTab[indx], NULL);
- }
- break;
- }
- case XPATH_BOOLEAN:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a Boolean\n", arg);
- break;
- case XPATH_NUMBER:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a number\n", arg);
- break;
- case XPATH_STRING:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a string\n", arg);
- break;
- case XPATH_POINT:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a point\n", arg);
- break;
- case XPATH_RANGE:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a range\n", arg);
- break;
- case XPATH_LOCATIONSET:
- xmlGenericError(xmlGenericErrorContext,
- "%s is a range\n", arg);
- break;
- case XPATH_USERS:
- xmlGenericError(xmlGenericErrorContext,
- "%s is user-defined\n", arg);
- break;
- case XPATH_XSLT_TREE:
- xmlGenericError(xmlGenericErrorContext,
- "%s is an XSLT value tree\n",
- arg);
- break;
- }
-#ifdef LIBXML_XPATH_ENABLED
- xmlXPathFreeObject(list);
-#endif
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "%s: no such node\n", arg);
- }
- ctxt->pctxt->node = NULL;
- }
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "Unknown command %s\n", command);
- }
- free(cmdline); /* not xmlFree here ! */
- }
-#ifdef LIBXML_XPATH_ENABLED
- xmlXPathFreeContext(ctxt->pctxt);
-#endif /* LIBXML_XPATH_ENABLED */
- if (ctxt->loaded) {
- xmlFreeDoc(ctxt->doc);
- }
- if (ctxt->filename != NULL)
- xmlFree(ctxt->filename);
- xmlFree(ctxt);
- if (cmdline != NULL)
- free(cmdline); /* not xmlFree here ! */
-}
-
-#endif /* LIBXML_DEBUG_ENABLED */
diff --git a/bundle/libxml/encoding.c b/bundle/libxml/encoding.c
deleted file mode 100644
index 69d67cd6b9..0000000000
--- a/bundle/libxml/encoding.c
+++ /dev/null
@@ -1,2340 +0,0 @@
-/*
- * encoding.c : implements the encoding conversion functions needed for XML
- *
- * Related specs:
- * rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies
- * rfc2781 UTF-16, an encoding of ISO 10646, P. Hoffman, F. Yergeau
- * [ISO-10646] UTF-8 and UTF-16 in Annexes
- * [ISO-8859-1] ISO Latin-1 characters codes.
- * [UNICODE] The Unicode Consortium, "The Unicode Standard --
- * Worldwide Character Encoding -- Version 1.0", Addison-
- * Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is
- * described in Unicode Technical Report #4.
- * [US-ASCII] Coded Character Set--7-bit American Standard Code for
- * Information Interchange, ANSI X3.4-1986.
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- *
- * UTF8 string routines from:
- * "William M. Brack" <wbrack@mmm.com.hk>
- *
- * Original code for IsoLatin1 and UTF-16 by "Martin J. Duerst" <duerst@w3.org>
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#include <string.h>
-
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef LIBXML_ICONV_ENABLED
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-#endif
-#include <libxml/encoding.h>
-#include <libxml/xmlmemory.h>
-#ifdef LIBXML_HTML_ENABLED
-#include <libxml/HTMLparser.h>
-#endif
-#include <libxml/globals.h>
-#include <libxml/xmlerror.h>
-
-static xmlCharEncodingHandlerPtr xmlUTF16LEHandler = NULL;
-static xmlCharEncodingHandlerPtr xmlUTF16BEHandler = NULL;
-
-typedef struct _xmlCharEncodingAlias xmlCharEncodingAlias;
-typedef xmlCharEncodingAlias *xmlCharEncodingAliasPtr;
-struct _xmlCharEncodingAlias {
- const char *name;
- const char *alias;
-};
-
-static xmlCharEncodingAliasPtr xmlCharEncodingAliases = NULL;
-static int xmlCharEncodingAliasesNb = 0;
-static int xmlCharEncodingAliasesMax = 0;
-
-#ifdef LIBXML_ICONV_ENABLED
-#if 0
-#define DEBUG_ENCODING /* Define this to get encoding traces */
-#endif
-#endif
-
-static int xmlLittleEndian = 1;
-
-/************************************************************************
- * *
- * Generic UTF8 handling routines *
- * *
- * From rfc2044: encoding of the Unicode values on UTF-8: *
- * *
- * UCS-4 range (hex.) UTF-8 octet sequence (binary) *
- * 0000 0000-0000 007F 0xxxxxxx *
- * 0000 0080-0000 07FF 110xxxxx 10xxxxxx *
- * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx *
- * *
- * I hope we won't use values > 0xFFFF anytime soon ! *
- * *
- ************************************************************************/
-
-/**
- * xmlUTF8Strlen:
- * @utf: a sequence of UTF-8 encoded bytes
- *
- * compute the length of an UTF8 string, it doesn't do a full UTF8
- * checking of the content of the string.
- *
- * Returns the number of characters in the string or -1 in case of error
- */
-int
-xmlUTF8Strlen(const xmlChar *utf) {
- int ret = 0;
-
- if (utf == NULL)
- return(-1);
-
- while (*utf != 0) {
- if (utf[0] & 0x80) {
- if ((utf[1] & 0xc0) != 0x80)
- return(-1);
- if ((utf[0] & 0xe0) == 0xe0) {
- if ((utf[2] & 0xc0) != 0x80)
- return(-1);
- if ((utf[0] & 0xf0) == 0xf0) {
- if ((utf[0] & 0xf8) != 0xf0 || (utf[3] & 0xc0) != 0x80)
- return(-1);
- utf += 4;
- } else {
- utf += 3;
- }
- } else {
- utf += 2;
- }
- } else {
- utf++;
- }
- ret++;
- }
- return(ret);
-}
-
-/**
- * xmlGetUTF8Char:
- * @utf: a sequence of UTF-8 encoded bytes
- * @len: a pointer to @bytes len
- *
- * Read one UTF8 Char from @utf
- *
- * Returns the char value or -1 in case of error and update @len with the
- * number of bytes used
- */
-int
-xmlGetUTF8Char(const unsigned char *utf, int *len) {
- unsigned int c;
-
- if (utf == NULL)
- goto error;
- if (len == NULL)
- goto error;
- if (*len < 1)
- goto error;
-
- c = utf[0];
- if (c & 0x80) {
- if (*len < 2)
- goto error;
- if ((utf[1] & 0xc0) != 0x80)
- goto error;
- if ((c & 0xe0) == 0xe0) {
- if (*len < 3)
- goto error;
- if ((utf[2] & 0xc0) != 0x80)
- goto error;
- if ((c & 0xf0) == 0xf0) {
- if (*len < 4)
- goto error;
- if ((c & 0xf8) != 0xf0 || (utf[3] & 0xc0) != 0x80)
- goto error;
- *len = 4;
- /* 4-byte code */
- c = (utf[0] & 0x7) << 18;
- c |= (utf[1] & 0x3f) << 12;
- c |= (utf[2] & 0x3f) << 6;
- c |= utf[3] & 0x3f;
- } else {
- /* 3-byte code */
- *len = 3;
- c = (utf[0] & 0xf) << 12;
- c |= (utf[1] & 0x3f) << 6;
- c |= utf[2] & 0x3f;
- }
- } else {
- /* 2-byte code */
- *len = 2;
- c = (utf[0] & 0x1f) << 6;
- c |= utf[1] & 0x3f;
- }
- } else {
- /* 1-byte code */
- *len = 1;
- }
- return(c);
-
-error:
- *len = 0;
- return(-1);
-}
-
-/**
- * xmlCheckUTF8:
- * @utf: Pointer to putative utf-8 encoded string.
- *
- * Checks @utf for being valid utf-8. @utf is assumed to be
- * null-terminated. This function is not super-strict, as it will
- * allow longer utf-8 sequences than necessary. Note that Java is
- * capable of producing these sequences if provoked. Also note, this
- * routine checks for the 4-byte maximum size, but does not check for
- * 0x10ffff maximum value.
- *
- * Return value: true if @utf is valid.
- **/
-int
-xmlCheckUTF8(const unsigned char *utf)
-{
- int ix;
- unsigned char c;
-
- for (ix = 0; (c = utf[ix]);) {
- if (c & 0x80) {
- if ((utf[ix + 1] & 0xc0) != 0x80)
- return(0);
- if ((c & 0xe0) == 0xe0) {
- if ((utf[ix + 2] & 0xc0) != 0x80)
- return(0);
- if ((c & 0xf0) == 0xf0) {
- if ((c & 0xf8) != 0xf0 || (utf[ix + 3] & 0xc0) != 0x80)
- return(0);
- ix += 4;
- /* 4-byte code */
- } else
- /* 3-byte code */
- ix += 3;
- } else
- /* 2-byte code */
- ix += 2;
- } else
- /* 1-byte code */
- ix++;
- }
- return(1);
-}
-
-/**
- * xmlUTF8Strsize:
- * @utf: a sequence of UTF-8 encoded bytes
- * @len: the number of characters in the array
- *
- * storage size of an UTF8 string
- *
- * Returns the storage size of
- * the first 'len' characters of ARRAY
- *
- */
-
-int
-xmlUTF8Strsize(const xmlChar *utf, int len) {
- const xmlChar *ptr=utf;
- xmlChar ch;
-
- if (len <= 0)
- return(0);
-
- while ( len-- > 0) {
- if ( !*ptr )
- break;
- if ( (ch = *ptr++) & 0x80)
- while ( (ch<<=1) & 0x80 )
- ptr++;
- }
- return (ptr - utf);
-}
-
-
-/**
- * xmlUTF8Strndup:
- * @utf: the input UTF8 *
- * @len: the len of @utf (in chars)
- *
- * a strndup for array of UTF8's
- *
- * Returns a new UTF8 * or NULL
- */
-xmlChar *
-xmlUTF8Strndup(const xmlChar *utf, int len) {
- xmlChar *ret;
- int i;
-
- if ((utf == NULL) || (len < 0)) return(NULL);
- i = xmlUTF8Strsize(utf, len);
- ret = (xmlChar *) xmlMalloc((i + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %ld byte failed\n",
- (len + 1) * (long)sizeof(xmlChar));
- return(NULL);
- }
- memcpy(ret, utf, i * sizeof(xmlChar));
- ret[i] = 0;
- return(ret);
-}
-
-/**
- * xmlUTF8Strpos:
- * @utf: the input UTF8 *
- * @pos: the position of the desired UTF8 char (in chars)
- *
- * a function to provide the equivalent of fetching a
- * character from a string array
- *
- * Returns a pointer to the UTF8 character or NULL
- */
-xmlChar *
-xmlUTF8Strpos(const xmlChar *utf, int pos) {
- xmlChar ch;
-
- if (utf == NULL) return(NULL);
- if ( (pos < 0) || (pos >= xmlUTF8Strlen(utf)) )
- return(NULL);
- while (pos--) {
- if ((ch=*utf++) == 0) return(NULL);
- if ( ch & 0x80 ) {
- /* if not simple ascii, verify proper format */
- if ( (ch & 0xc0) != 0xc0 )
- return(NULL);
- /* then skip over remaining bytes for this char */
- while ( (ch <<= 1) & 0x80 )
- if ( (*utf++ & 0xc0) != 0x80 )
- return(NULL);
- }
- }
- return((xmlChar *)utf);
-}
-
-/**
- * xmlUTF8Strloc:
- * @utf: the input UTF8 *
- * @utfchar: the UTF8 character to be found
- *
- * a function to provide relative location of a UTF8 char
- *
- * Returns the relative character position of the desired char
- * or -1 if not found
- */
-int
-xmlUTF8Strloc(const xmlChar *utf, const xmlChar *utfchar) {
- int i, size;
- xmlChar ch;
-
- if (utf==NULL || utfchar==NULL) return -1;
- size = xmlUTF8Strsize(utfchar, 1);
- for(i=0; (ch=*utf) != 0; i++) {
- if (xmlStrncmp(utf, utfchar, size)==0)
- return(i);
- utf++;
- if ( ch & 0x80 ) {
- /* if not simple ascii, verify proper format */
- if ( (ch & 0xc0) != 0xc0 )
- return(-1);
- /* then skip over remaining bytes for this char */
- while ( (ch <<= 1) & 0x80 )
- if ( (*utf++ & 0xc0) != 0x80 )
- return(-1);
- }
- }
-
- return(-1);
-}
-/**
- * xmlUTF8Strsub:
- * @utf: a sequence of UTF-8 encoded bytes
- * @start: relative pos of first char
- * @len: total number to copy
- *
- * Note: positions are given in units of UTF-8 chars
- *
- * Returns a pointer to a newly created string
- * or NULL if any problem
- */
-
-xmlChar *
-xmlUTF8Strsub(const xmlChar *utf, int start, int len) {
- int i;
- xmlChar ch;
-
- if (utf == NULL) return(NULL);
- if (start < 0) return(NULL);
- if (len < 0) return(NULL);
-
- /*
- * Skip over any leading chars
- */
- for (i = 0;i < start;i++) {
- if ((ch=*utf++) == 0) return(NULL);
- if ( ch & 0x80 ) {
- /* if not simple ascii, verify proper format */
- if ( (ch & 0xc0) != 0xc0 )
- return(NULL);
- /* then skip over remaining bytes for this char */
- while ( (ch <<= 1) & 0x80 )
- if ( (*utf++ & 0xc0) != 0x80 )
- return(NULL);
- }
- }
-
- return(xmlUTF8Strndup(utf, len));
-}
-
-/************************************************************************
- * *
- * Conversions To/From UTF8 encoding *
- * *
- ************************************************************************/
-
-/**
- * asciiToUTF8:
- * @out: a pointer to an array of bytes to store the result
- * @outlen: the length of @out
- * @in: a pointer to an array of ASCII chars
- * @inlen: the length of @in
- *
- * Take a block of ASCII chars in and try to convert it to an UTF-8
- * block of chars out.
- * Returns 0 if success, or -1 otherwise
- * The value of @inlen after return is the number of octets consumed
- * as the return value is positive, else unpredictable.
- * The value of @outlen after return is the number of ocetes consumed.
- */
-static int
-asciiToUTF8(unsigned char* out, int *outlen,
- const unsigned char* in, int *inlen) {
- unsigned char* outstart = out;
- const unsigned char* base = in;
- const unsigned char* processed = in;
- unsigned char* outend = out + *outlen;
- const unsigned char* inend;
- unsigned int c;
- int bits;
-
- inend = in + (*inlen);
- while ((in < inend) && (out - outstart + 5 < *outlen)) {
- c= *in++;
-
- /* assertion: c is a single UTF-4 value */
- if (out >= outend)
- break;
- if (c < 0x80) { *out++= c; bits= -6; }
- else {
- *outlen = out - outstart;
- *inlen = processed - base;
- return(-1);
- }
-
- for ( ; bits >= 0; bits-= 6) {
- if (out >= outend)
- break;
- *out++= ((c >> bits) & 0x3F) | 0x80;
- }
- processed = (const unsigned char*) in;
- }
- *outlen = out - outstart;
- *inlen = processed - base;
- return(0);
-}
-
-/**
- * UTF8Toascii:
- * @out: a pointer to an array of bytes to store the result
- * @outlen: the length of @out
- * @in: a pointer to an array of UTF-8 chars
- * @inlen: the length of @in
- *
- * Take a block of UTF-8 chars in and try to convert it to an ASCII
- * block of chars out.
- *
- * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise
- * The value of @inlen after return is the number of octets consumed
- * as the return value is positive, else unpredictable.
- * The value of @outlen after return is the number of ocetes consumed.
- */
-static int
-UTF8Toascii(unsigned char* out, int *outlen,
- const unsigned char* in, int *inlen) {
- const unsigned char* processed = in;
- const unsigned char* outend;
- const unsigned char* outstart = out;
- const unsigned char* instart = in;
- const unsigned char* inend;
- unsigned int c, d;
- int trailing;
-
- if (in == NULL) {
- /*
- * initialization nothing to do
- */
- *outlen = 0;
- *inlen = 0;
- return(0);
- }
- inend = in + (*inlen);
- outend = out + (*outlen);
- while (in < inend) {
- d = *in++;
- if (d < 0x80) { c= d; trailing= 0; }
- else if (d < 0xC0) {
- /* trailing byte in leading position */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; }
- else if (d < 0xF0) { c= d & 0x0F; trailing= 2; }
- else if (d < 0xF8) { c= d & 0x07; trailing= 3; }
- else {
- /* no chance for this in Ascii */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- }
-
- if (inend - in < trailing) {
- break;
- }
-
- for ( ; trailing; trailing--) {
- if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80))
- break;
- c <<= 6;
- c |= d & 0x3F;
- }
-
- /* assertion: c is a single UTF-4 value */
- if (c < 0x80) {
- if (out >= outend)
- break;
- *out++ = c;
- } else {
- /* no chance for this in Ascii */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- }
- processed = in;
- }
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(0);
-}
-
-/**
- * isolat1ToUTF8:
- * @out: a pointer to an array of bytes to store the result
- * @outlen: the length of @out
- * @in: a pointer to an array of ISO Latin 1 chars
- * @inlen: the length of @in
- *
- * Take a block of ISO Latin 1 chars in and try to convert it to an UTF-8
- * block of chars out.
- * Returns 0 if success, or -1 otherwise
- * The value of @inlen after return is the number of octets consumed
- * as the return value is positive, else unpredictable.
- * The value of @outlen after return is the number of ocetes consumed.
- */
-int
-isolat1ToUTF8(unsigned char* out, int *outlen,
- const unsigned char* in, int *inlen) {
- unsigned char* outstart = out;
- const unsigned char* base = in;
- unsigned char* outend = out + *outlen;
- const unsigned char* inend;
- const unsigned char* instop;
- xmlChar c = *in;
-
- inend = in + (*inlen);
- instop = inend;
-
- while (in < inend && out < outend - 1) {
- if (c >= 0x80) {
- *out++= ((c >> 6) & 0x1F) | 0xC0;
- *out++= (c & 0x3F) | 0x80;
- ++in;
- c = *in;
- }
- if (instop - in > outend - out) instop = in + (outend - out);
- while (c < 0x80 && in < instop) {
- *out++ = c;
- ++in;
- c = *in;
- }
- }
- if (in < inend && out < outend && c < 0x80) {
- *out++ = c;
- ++in;
- }
- *outlen = out - outstart;
- *inlen = in - base;
- return(0);
-}
-
-
-/**
- * UTF8Toisolat1:
- * @out: a pointer to an array of bytes to store the result
- * @outlen: the length of @out
- * @in: a pointer to an array of UTF-8 chars
- * @inlen: the length of @in
- *
- * Take a block of UTF-8 chars in and try to convert it to an ISO Latin 1
- * block of chars out.
- *
- * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise
- * The value of @inlen after return is the number of octets consumed
- * as the return value is positive, else unpredictable.
- * The value of @outlen after return is the number of ocetes consumed.
- */
-int
-UTF8Toisolat1(unsigned char* out, int *outlen,
- const unsigned char* in, int *inlen) {
- const unsigned char* processed = in;
- const unsigned char* outend;
- const unsigned char* outstart = out;
- const unsigned char* instart = in;
- const unsigned char* inend;
- unsigned int c, d;
- int trailing;
-
- if (in == NULL) {
- /*
- * initialization nothing to do
- */
- *outlen = 0;
- *inlen = 0;
- return(0);
- }
- inend = in + (*inlen);
- outend = out + (*outlen);
- while (in < inend) {
- d = *in++;
- if (d < 0x80) { c= d; trailing= 0; }
- else if (d < 0xC0) {
- /* trailing byte in leading position */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; }
- else if (d < 0xF0) { c= d & 0x0F; trailing= 2; }
- else if (d < 0xF8) { c= d & 0x07; trailing= 3; }
- else {
- /* no chance for this in IsoLat1 */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- }
-
- if (inend - in < trailing) {
- break;
- }
-
- for ( ; trailing; trailing--) {
- if (in >= inend)
- break;
- if (((d= *in++) & 0xC0) != 0x80) {
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- }
- c <<= 6;
- c |= d & 0x3F;
- }
-
- /* assertion: c is a single UTF-4 value */
- if (c <= 0xFF) {
- if (out >= outend)
- break;
- *out++ = c;
- } else {
- /* no chance for this in IsoLat1 */
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(-2);
- }
- processed = in;
- }
- *outlen = out - outstart;
- *inlen = processed - instart;
- return(0);
-}
-
-/**
- * UTF16LEToUTF8:
- * @out: a pointer to an array of bytes to store the result
- * @outlen: the length of @out
- * @inb: a pointer to an array of UTF-16LE passwd as a byte array
- * @inlenb: the length of @in in UTF-16LE chars
- *
- * Take a block of UTF-16LE ushorts in and try to convert it to an UTF-8
- * block of chars out. This function assume the endian property
- * is the same between the native type of this machine and the
- * inputed one.
- *
- * Returns the number of byte written, or -1 by lack of space, or -2
- * if the transcoding fails (for *in is not valid utf16 string)
- * The value of *inlen after return is the number of octets consumed
- * as the return value is positive, else unpredictable.
- */
-static int
-UTF16LEToUTF8(unsigned char* out, int *outlen,
- const unsigned char* inb, int *inlenb)
-{
- unsigned char* outstart = out;
- const unsigned char* processed = inb;
- unsigned char* outend = out + *outlen;
- unsigned short* in = (unsigned short*) inb;
- unsigned short* inend;
- unsigned int c, d, inlen;
- unsigned char *tmp;
- int bits;
-
- if ((*inlenb % 2) == 1)
- (*inlenb)--;
- inlen = *inlenb / 2;
- inend = in + inlen;
- while ((in < inend) && (out - outstart + 5 < *outlen)) {
- if (xmlLittleEndian) {
- c= *in++;
- } else {
- tmp = (unsigned char *) in;
- c = *tmp++;
- c = c | (((unsigned int)*tmp) << 8);
- in++;
- }
- if ((c & 0xFC00) == 0xD800) { /* surrogates */
- if (in >= inend) { /* (in > inend) shouldn't happens */
- break;
- }
- if (xmlLittleEndian) {
- d = *in++;
- } else {
- tmp = (unsigned char *) in;
- d = *tmp++;
- d = d | (((unsigned int)*tmp) << 8);
- in++;
- }
- if ((d & 0xFC00) == 0xDC00) {
- c &= 0x03FF;
- c <<= 10;
- c |= d & 0x03FF;
- c += 0x10000;
- }
- else {
- *outlen = out - outstart;
- *inlenb = processed - inb;
- return(-2);
- }
- }
-
- /* assertion: c is a single UTF-4 value */
- if (out >= outend)
- break;
- if (c < 0x80) { *out++= c; bits= -6; }
- else if (c < 0x800) { *out++= ((c >> 6) & 0x1F) | 0xC0; bits= 0; }
- else if (c < 0x10000) { *out++= ((c >> 12) & 0x0F) | 0xE0; bits= 6; }
- else { *out++= ((c >> 18) & 0x07) | 0xF0; bits= 12; }
-
- for ( ; bits >= 0; bits-= 6) {
- if (out >= outend)
- break;
- *out++= ((c >> bits) & 0x3F) | 0x80;
- }
- processed = (const unsigned char*) in;
- }
- *outlen = out - outstart;
- *inlenb = processed - inb;
- return(0);
-}
-
-/**
- * UTF8ToUTF16LE:
- * @outb: a pointer to an array of bytes to store the result
- * @outlen: the length of @outb
- * @in: a pointer to an array of UTF-8 chars
- * @inlen: the length of @in
- *
- * Take a block of UTF-8 chars in and try to convert it to an UTF-16LE
- * block of chars out.
- *
- * Returns the number of byte written, or -1 by lack of space, or -2
- * if the transcoding failed.
- */
-static int
-UTF8ToUTF16LE(unsigned char* outb, int *outlen,
- const unsigned char* in, int *inlen)
-{
- unsigned short* out = (unsigned short*) outb;
- const unsigned char* processed = in;
- unsigned short* outstart= out;
- unsigned short* outend;
- const unsigned char* inend= in+*inlen;
- unsigned int c, d;
- int trailing;
- unsigned char *tmp;
- unsigned short tmp1, tmp2;
-
- if (in == NULL) {
- /*
- * initialization, add the Byte Order Mark
- */
- if (*outlen >= 2) {
- outb[0] = 0xFF;
- outb[1] = 0xFE;
- *outlen = 2;
- *inlen = 0;
-#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "Added FFFE Byte Order Mark\n");
-#endif
- return(2);
- }
- *outlen = 0;
- *inlen = 0;
- return(0);
- }
- outend = out + (*outlen / 2);
- while (in < inend) {
- d= *in++;
- if (d < 0x80) { c= d; trailing= 0; }
- else if (d < 0xC0) {
- /* trailing byte in leading position */
- *outlen = (out - outstart) * 2;
- *inlen = processed - in;
- return(-2);
- } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; }
- else if (d < 0xF0) { c= d & 0x0F; trailing= 2; }
- else if (d < 0xF8) { c= d & 0x07; trailing= 3; }
- else {
- /* no chance for this in UTF-16 */
- *outlen = (out - outstart) * 2;
- *inlen = processed - in;
- return(-2);
- }
-
- if (inend - in < trailing) {
- break;
- }
-
- for ( ; trailing; trailing--) {
- if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80))
- break;
- c <<= 6;
- c |= d & 0x3F;
- }
-
- /* assertion: c is a single UTF-4 value */
- if (c < 0x10000) {
- if (out >= outend)
- break;
- if (xmlLittleEndian) {
- *out++ = c;
- } else {
- tmp = (unsigned char *) out;
- *tmp = c ;
- *(tmp + 1) = c >> 8 ;
- out++;
- }
- }
- else if (c < 0x110000) {
- if (out+1 >= outend)
- break;
- c -= 0x10000;
- if (xmlLittleEndian) {
- *out++ = 0xD800 | (c >> 10);
- *out++ = 0xDC00 | (c & 0x03FF);
- } else {
- tmp1 = 0xD800 | (c >> 10);
- tmp = (unsigned char *) out;
- *tmp = (unsigned char) tmp1;
- *(tmp + 1) = tmp1 >> 8;
- out++;
-
- tmp2 = 0xDC00 | (c & 0x03FF);
- tmp = (unsigned char *) out;
- *tmp = (unsigned char) tmp2;
- *(tmp + 1) = tmp2 >> 8;
- out++;
- }
- }
- else
- break;
- processed = in;
- }
- *outlen = (out - outstart) * 2;
- *inlen = processed - in;
- return(0);
-}
-
-/**
- * UTF16BEToUTF8:
- * @out: a pointer to an array of bytes to store the result
- * @outlen: the length of @out
- * @inb: a pointer to an array of UTF-16 passwd as a byte array
- * @inlenb: the length of @in in UTF-16 chars
- *
- * Take a block of UTF-16 ushorts in and try to convert it to an UTF-8
- * block of chars out. This function assume the endian property
- * is the same between the native type of this machine and the
- * inputed one.
- *
- * Returns the number of byte written, or -1 by lack of space, or -2
- * if the transcoding fails (for *in is not valid utf16 string)
- * The value of *inlen after return is the number of octets consumed
- * as the return value is positive, else unpredictable.
- */
-static int
-UTF16BEToUTF8(unsigned char* out, int *outlen,
- const unsigned char* inb, int *inlenb)
-{
- unsigned char* outstart = out;
- const unsigned char* processed = inb;
- unsigned char* outend = out + *outlen;
- unsigned short* in = (unsigned short*) inb;
- unsigned short* inend;
- unsigned int c, d, inlen;
- unsigned char *tmp;
- int bits;
-
- if ((*inlenb % 2) == 1)
- (*inlenb)--;
- inlen = *inlenb / 2;
- inend= in + inlen;
- while (in < inend) {
- if (xmlLittleEndian) {
- tmp = (unsigned char *) in;
- c = *tmp++;
- c = c << 8;
- c = c | (unsigned int) *tmp;
- in++;
- } else {
- c= *in++;
- }
- if ((c & 0xFC00) == 0xD800) { /* surrogates */
- if (in >= inend) { /* (in > inend) shouldn't happens */
- *outlen = out - outstart;
- *inlenb = processed - inb;
- return(-2);
- }
- if (xmlLittleEndian) {
- tmp = (unsigned char *) in;
- d = *tmp++;
- d = d << 8;
- d = d | (unsigned int) *tmp;
- in++;
- } else {
- d= *in++;
- }
- if ((d & 0xFC00) == 0xDC00) {
- c &= 0x03FF;
- c <<= 10;
- c |= d & 0x03FF;
- c += 0x10000;
- }
- else {
- *outlen = out - outstart;
- *inlenb = processed - inb;
- return(-2);
- }
- }
-
- /* assertion: c is a single UTF-4 value */
- if (out >= outend)
- break;
- if (c < 0x80) { *out++= c; bits= -6; }
- else if (c < 0x800) { *out++= ((c >> 6) & 0x1F) | 0xC0; bits= 0; }
- else if (c < 0x10000) { *out++= ((c >> 12) & 0x0F) | 0xE0; bits= 6; }
- else { *out++= ((c >> 18) & 0x07) | 0xF0; bits= 12; }
-
- for ( ; bits >= 0; bits-= 6) {
- if (out >= outend)
- break;
- *out++= ((c >> bits) & 0x3F) | 0x80;
- }
- processed = (const unsigned char*) in;
- }
- *outlen = out - outstart;
- *inlenb = processed - inb;
- return(0);
-}
-
-/**
- * UTF8ToUTF16BE:
- * @outb: a pointer to an array of bytes to store the result
- * @outlen: the length of @outb
- * @in: a pointer to an array of UTF-8 chars
- * @inlen: the length of @in
- *
- * Take a block of UTF-8 chars in and try to convert it to an UTF-16BE
- * block of chars out.
- *
- * Returns the number of byte written, or -1 by lack of space, or -2
- * if the transcoding failed.
- */
-static int
-UTF8ToUTF16BE(unsigned char* outb, int *outlen,
- const unsigned char* in, int *inlen)
-{
- unsigned short* out = (unsigned short*) outb;
- const unsigned char* processed = in;
- unsigned short* outstart= out;
- unsigned short* outend;
- const unsigned char* inend= in+*inlen;
- unsigned int c, d;
- int trailing;
- unsigned char *tmp;
- unsigned short tmp1, tmp2;
-
- if (in == NULL) {
- /*
- * initialization, add the Byte Order Mark
- */
- if (*outlen >= 2) {
- outb[0] = 0xFE;
- outb[1] = 0xFF;
- *outlen = 2;
- *inlen = 0;
-#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "Added FEFF Byte Order Mark\n");
-#endif
- return(2);
- }
- *outlen = 0;
- *inlen = 0;
- return(0);
- }
- outend = out + (*outlen / 2);
- while (in < inend) {
- d= *in++;
- if (d < 0x80) { c= d; trailing= 0; }
- else if (d < 0xC0) {
- /* trailing byte in leading position */
- *outlen = out - outstart;
- *inlen = processed - in;
- return(-2);
- } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; }
- else if (d < 0xF0) { c= d & 0x0F; trailing= 2; }
- else if (d < 0xF8) { c= d & 0x07; trailing= 3; }
- else {
- /* no chance for this in UTF-16 */
- *outlen = out - outstart;
- *inlen = processed - in;
- return(-2);
- }
-
- if (inend - in < trailing) {
- break;
- }
-
- for ( ; trailing; trailing--) {
- if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80)) break;
- c <<= 6;
- c |= d & 0x3F;
- }
-
- /* assertion: c is a single UTF-4 value */
- if (c < 0x10000) {
- if (out >= outend) break;
- if (xmlLittleEndian) {
- tmp = (unsigned char *) out;
- *tmp = c >> 8;
- *(tmp + 1) = c;
- out++;
- } else {
- *out++ = c;
- }
- }
- else if (c < 0x110000) {
- if (out+1 >= outend) break;
- c -= 0x10000;
- if (xmlLittleEndian) {
- tmp1 = 0xD800 | (c >> 10);
- tmp = (unsigned char *) out;
- *tmp = tmp1 >> 8;
- *(tmp + 1) = (unsigned char) tmp1;
- out++;
-
- tmp2 = 0xDC00 | (c & 0x03FF);
- tmp = (unsigned char *) out;
- *tmp = tmp2 >> 8;
- *(tmp + 1) = (unsigned char) tmp2;
- out++;
- } else {
- *out++ = 0xD800 | (c >> 10);
- *out++ = 0xDC00 | (c & 0x03FF);
- }
- }
- else
- break;
- processed = in;
- }
- *outlen = (out - outstart) * 2;
- *inlen = processed - in;
- return(0);
-}
-
-/************************************************************************
- * *
- * Generic encoding handling routines *
- * *
- ************************************************************************/
-
-/**
- * xmlDetectCharEncoding:
- * @in: a pointer to the first bytes of the XML entity, must be at least
- * 4 bytes long.
- * @len: pointer to the length of the buffer
- *
- * Guess the encoding of the entity using the first bytes of the entity content
- * accordingly of the non-normative appendix F of the XML-1.0 recommendation.
- *
- * Returns one of the XML_CHAR_ENCODING_... values.
- */
-xmlCharEncoding
-xmlDetectCharEncoding(const unsigned char* in, int len)
-{
- if (len >= 4) {
- if ((in[0] == 0x00) && (in[1] == 0x00) &&
- (in[2] == 0x00) && (in[3] == 0x3C))
- return(XML_CHAR_ENCODING_UCS4BE);
- if ((in[0] == 0x3C) && (in[1] == 0x00) &&
- (in[2] == 0x00) && (in[3] == 0x00))
- return(XML_CHAR_ENCODING_UCS4LE);
- if ((in[0] == 0x00) && (in[1] == 0x00) &&
- (in[2] == 0x3C) && (in[3] == 0x00))
- return(XML_CHAR_ENCODING_UCS4_2143);
- if ((in[0] == 0x00) && (in[1] == 0x3C) &&
- (in[2] == 0x00) && (in[3] == 0x00))
- return(XML_CHAR_ENCODING_UCS4_3412);
- if ((in[0] == 0x4C) && (in[1] == 0x6F) &&
- (in[2] == 0xA7) && (in[3] == 0x94))
- return(XML_CHAR_ENCODING_EBCDIC);
- if ((in[0] == 0x3C) && (in[1] == 0x3F) &&
- (in[2] == 0x78) && (in[3] == 0x6D))
- return(XML_CHAR_ENCODING_UTF8);
- }
- if (len >= 3) {
- /*
- * Errata on XML-1.0 June 20 2001
- * We now allow an UTF8 encoded BOM
- */
- if ((in[0] == 0xEF) && (in[1] == 0xBB) &&
- (in[2] == 0xBF))
- return(XML_CHAR_ENCODING_UTF8);
- }
- if (len >= 2) {
- if ((in[0] == 0xFE) && (in[1] == 0xFF))
- return(XML_CHAR_ENCODING_UTF16BE);
- if ((in[0] == 0xFF) && (in[1] == 0xFE))
- return(XML_CHAR_ENCODING_UTF16LE);
- }
- return(XML_CHAR_ENCODING_NONE);
-}
-
-/**
- * xmlCleanupEncodingAliases:
- *
- * Unregisters all aliases
- */
-void
-xmlCleanupEncodingAliases(void) {
- int i;
-
- if (xmlCharEncodingAliases == NULL)
- return;
-
- for (i = 0;i < xmlCharEncodingAliasesNb;i++) {
- if (xmlCharEncodingAliases[i].name != NULL)
- xmlFree((char *) xmlCharEncodingAliases[i].name);
- if (xmlCharEncodingAliases[i].alias != NULL)
- xmlFree((char *) xmlCharEncodingAliases[i].alias);
- }
- xmlCharEncodingAliasesNb = 0;
- xmlCharEncodingAliasesMax = 0;
- xmlFree(xmlCharEncodingAliases);
- xmlCharEncodingAliases = NULL;
-}
-
-/**
- * xmlGetEncodingAlias:
- * @alias: the alias name as parsed, in UTF-8 format (ASCII actually)
- *
- * Lookup an encoding name for the given alias.
- *
- * Returns NULL if not found the original name otherwise
- */
-const char *
-xmlGetEncodingAlias(const char *alias) {
- int i;
- char upper[100];
-
- if (alias == NULL)
- return(NULL);
-
- if (xmlCharEncodingAliases == NULL)
- return(NULL);
-
- for (i = 0;i < 99;i++) {
- upper[i] = toupper(alias[i]);
- if (upper[i] == 0) break;
- }
- upper[i] = 0;
-
- /*
- * Walk down the list looking for a definition of the alias
- */
- for (i = 0;i < xmlCharEncodingAliasesNb;i++) {
- if (!strcmp(xmlCharEncodingAliases[i].alias, upper)) {
- return(xmlCharEncodingAliases[i].name);
- }
- }
- return(NULL);
-}
-
-/**
- * xmlAddEncodingAlias:
- * @name: the encoding name as parsed, in UTF-8 format (ASCII actually)
- * @alias: the alias name as parsed, in UTF-8 format (ASCII actually)
- *
- * Registers and alias @alias for an encoding named @name. Existing alias
- * will be overwritten.
- *
- * Returns 0 in case of success, -1 in case of error
- */
-int
-xmlAddEncodingAlias(const char *name, const char *alias) {
- int i;
- char upper[100];
-
- if ((name == NULL) || (alias == NULL))
- return(-1);
-
- for (i = 0;i < 99;i++) {
- upper[i] = toupper(alias[i]);
- if (upper[i] == 0) break;
- }
- upper[i] = 0;
-
- if (xmlCharEncodingAliases == NULL) {
- xmlCharEncodingAliasesNb = 0;
- xmlCharEncodingAliasesMax = 20;
- xmlCharEncodingAliases = (xmlCharEncodingAliasPtr)
- xmlMalloc(xmlCharEncodingAliasesMax * sizeof(xmlCharEncodingAlias));
- if (xmlCharEncodingAliases == NULL)
- return(-1);
- } else if (xmlCharEncodingAliasesNb >= xmlCharEncodingAliasesMax) {
- xmlCharEncodingAliasesMax *= 2;
- xmlCharEncodingAliases = (xmlCharEncodingAliasPtr)
- xmlRealloc(xmlCharEncodingAliases,
- xmlCharEncodingAliasesMax * sizeof(xmlCharEncodingAlias));
- }
- /*
- * Walk down the list looking for a definition of the alias
- */
- for (i = 0;i < xmlCharEncodingAliasesNb;i++) {
- if (!strcmp(xmlCharEncodingAliases[i].alias, upper)) {
- /*
- * Replace the definition.
- */
- xmlFree((char *) xmlCharEncodingAliases[i].name);
- xmlCharEncodingAliases[i].name = xmlMemStrdup(name);
- return(0);
- }
- }
- /*
- * Add the definition
- */
- xmlCharEncodingAliases[xmlCharEncodingAliasesNb].name = xmlMemStrdup(name);
- xmlCharEncodingAliases[xmlCharEncodingAliasesNb].alias = xmlMemStrdup(upper);
- xmlCharEncodingAliasesNb++;
- return(0);
-}
-
-/**
- * xmlDelEncodingAlias:
- * @alias: the alias name as parsed, in UTF-8 format (ASCII actually)
- *
- * Unregisters an encoding alias @alias
- *
- * Returns 0 in case of success, -1 in case of error
- */
-int
-xmlDelEncodingAlias(const char *alias) {
- int i;
-
- if (alias == NULL)
- return(-1);
-
- if (xmlCharEncodingAliases == NULL)
- return(-1);
- /*
- * Walk down the list looking for a definition of the alias
- */
- for (i = 0;i < xmlCharEncodingAliasesNb;i++) {
- if (!strcmp(xmlCharEncodingAliases[i].alias, alias)) {
- xmlFree((char *) xmlCharEncodingAliases[i].name);
- xmlFree((char *) xmlCharEncodingAliases[i].alias);
- xmlCharEncodingAliasesNb--;
- memmove(&xmlCharEncodingAliases[i], &xmlCharEncodingAliases[i + 1],
- sizeof(xmlCharEncodingAlias) * (xmlCharEncodingAliasesNb - i));
- return(0);
- }
- }
- return(-1);
-}
-
-/**
- * xmlParseCharEncoding:
- * @name: the encoding name as parsed, in UTF-8 format (ASCII actually)
- *
- * Compare the string to the known encoding schemes already known. Note
- * that the comparison is case insensitive accordingly to the section
- * [XML] 4.3.3 Character Encoding in Entities.
- *
- * Returns one of the XML_CHAR_ENCODING_... values or XML_CHAR_ENCODING_NONE
- * if not recognized.
- */
-xmlCharEncoding
-xmlParseCharEncoding(const char* name)
-{
- const char *alias;
- char upper[500];
- int i;
-
- if (name == NULL)
- return(XML_CHAR_ENCODING_NONE);
-
- /*
- * Do the alias resolution
- */
- alias = xmlGetEncodingAlias(name);
- if (alias != NULL)
- name = alias;
-
- for (i = 0;i < 499;i++) {
- upper[i] = toupper(name[i]);
- if (upper[i] == 0) break;
- }
- upper[i] = 0;
-
- if (!strcmp(upper, "")) return(XML_CHAR_ENCODING_NONE);
- if (!strcmp(upper, "UTF-8")) return(XML_CHAR_ENCODING_UTF8);
- if (!strcmp(upper, "UTF8")) return(XML_CHAR_ENCODING_UTF8);
-
- /*
- * NOTE: if we were able to parse this, the endianness of UTF16 is
- * already found and in use
- */
- if (!strcmp(upper, "UTF-16")) return(XML_CHAR_ENCODING_UTF16LE);
- if (!strcmp(upper, "UTF16")) return(XML_CHAR_ENCODING_UTF16LE);
-
- if (!strcmp(upper, "ISO-10646-UCS-2")) return(XML_CHAR_ENCODING_UCS2);
- if (!strcmp(upper, "UCS-2")) return(XML_CHAR_ENCODING_UCS2);
- if (!strcmp(upper, "UCS2")) return(XML_CHAR_ENCODING_UCS2);
-
- /*
- * NOTE: if we were able to parse this, the endianness of UCS4 is
- * already found and in use
- */
- if (!strcmp(upper, "ISO-10646-UCS-4")) return(XML_CHAR_ENCODING_UCS4LE);
- if (!strcmp(upper, "UCS-4")) return(XML_CHAR_ENCODING_UCS4LE);
- if (!strcmp(upper, "UCS4")) return(XML_CHAR_ENCODING_UCS4LE);
-
-
- if (!strcmp(upper, "ISO-8859-1")) return(XML_CHAR_ENCODING_8859_1);
- if (!strcmp(upper, "ISO-LATIN-1")) return(XML_CHAR_ENCODING_8859_1);
- if (!strcmp(upper, "ISO LATIN 1")) return(XML_CHAR_ENCODING_8859_1);
-
- if (!strcmp(upper, "ISO-8859-2")) return(XML_CHAR_ENCODING_8859_2);
- if (!strcmp(upper, "ISO-LATIN-2")) return(XML_CHAR_ENCODING_8859_2);
- if (!strcmp(upper, "ISO LATIN 2")) return(XML_CHAR_ENCODING_8859_2);
-
- if (!strcmp(upper, "ISO-8859-3")) return(XML_CHAR_ENCODING_8859_3);
- if (!strcmp(upper, "ISO-8859-4")) return(XML_CHAR_ENCODING_8859_4);
- if (!strcmp(upper, "ISO-8859-5")) return(XML_CHAR_ENCODING_8859_5);
- if (!strcmp(upper, "ISO-8859-6")) return(XML_CHAR_ENCODING_8859_6);
- if (!strcmp(upper, "ISO-8859-7")) return(XML_CHAR_ENCODING_8859_7);
- if (!strcmp(upper, "ISO-8859-8")) return(XML_CHAR_ENCODING_8859_8);
- if (!strcmp(upper, "ISO-8859-9")) return(XML_CHAR_ENCODING_8859_9);
-
- if (!strcmp(upper, "ISO-2022-JP")) return(XML_CHAR_ENCODING_2022_JP);
- if (!strcmp(upper, "SHIFT_JIS")) return(XML_CHAR_ENCODING_SHIFT_JIS);
- if (!strcmp(upper, "EUC-JP")) return(XML_CHAR_ENCODING_EUC_JP);
-
-#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext, "Unknown encoding %s\n", name);
-#endif
- return(XML_CHAR_ENCODING_ERROR);
-}
-
-/**
- * xmlGetCharEncodingName:
- * @enc: the encoding
- *
- * The "canonical" name for XML encoding.
- * C.f. http://www.w3.org/TR/REC-xml#charencoding
- * Section 4.3.3 Character Encoding in Entities
- *
- * Returns the canonical name for the given encoding
- */
-
-const char*
-xmlGetCharEncodingName(xmlCharEncoding enc) {
- switch (enc) {
- case XML_CHAR_ENCODING_ERROR:
- return(NULL);
- case XML_CHAR_ENCODING_NONE:
- return(NULL);
- case XML_CHAR_ENCODING_UTF8:
- return("UTF-8");
- case XML_CHAR_ENCODING_UTF16LE:
- return("UTF-16");
- case XML_CHAR_ENCODING_UTF16BE:
- return("UTF-16");
- case XML_CHAR_ENCODING_EBCDIC:
- return("EBCDIC");
- case XML_CHAR_ENCODING_UCS4LE:
- return("ISO-10646-UCS-4");
- case XML_CHAR_ENCODING_UCS4BE:
- return("ISO-10646-UCS-4");
- case XML_CHAR_ENCODING_UCS4_2143:
- return("ISO-10646-UCS-4");
- case XML_CHAR_ENCODING_UCS4_3412:
- return("ISO-10646-UCS-4");
- case XML_CHAR_ENCODING_UCS2:
- return("ISO-10646-UCS-2");
- case XML_CHAR_ENCODING_8859_1:
- return("ISO-8859-1");
- case XML_CHAR_ENCODING_8859_2:
- return("ISO-8859-2");
- case XML_CHAR_ENCODING_8859_3:
- return("ISO-8859-3");
- case XML_CHAR_ENCODING_8859_4:
- return("ISO-8859-4");
- case XML_CHAR_ENCODING_8859_5:
- return("ISO-8859-5");
- case XML_CHAR_ENCODING_8859_6:
- return("ISO-8859-6");
- case XML_CHAR_ENCODING_8859_7:
- return("ISO-8859-7");
- case XML_CHAR_ENCODING_8859_8:
- return("ISO-8859-8");
- case XML_CHAR_ENCODING_8859_9:
- return("ISO-8859-9");
- case XML_CHAR_ENCODING_2022_JP:
- return("ISO-2022-JP");
- case XML_CHAR_ENCODING_SHIFT_JIS:
- return("Shift-JIS");
- case XML_CHAR_ENCODING_EUC_JP:
- return("EUC-JP");
- case XML_CHAR_ENCODING_ASCII:
- return(NULL);
- }
- return(NULL);
-}
-
-/************************************************************************
- * *
- * Char encoding handlers *
- * *
- ************************************************************************/
-
-
-/* the size should be growable, but it's not a big deal ... */
-#define MAX_ENCODING_HANDLERS 50
-static xmlCharEncodingHandlerPtr *handlers = NULL;
-static int nbCharEncodingHandler = 0;
-
-/*
- * The default is UTF-8 for XML, that's also the default used for the
- * parser internals, so the default encoding handler is NULL
- */
-
-static xmlCharEncodingHandlerPtr xmlDefaultCharEncodingHandler = NULL;
-
-/**
- * xmlNewCharEncodingHandler:
- * @name: the encoding name, in UTF-8 format (ASCII actually)
- * @input: the xmlCharEncodingInputFunc to read that encoding
- * @output: the xmlCharEncodingOutputFunc to write that encoding
- *
- * Create and registers an xmlCharEncodingHandler.
- *
- * Returns the xmlCharEncodingHandlerPtr created (or NULL in case of error).
- */
-xmlCharEncodingHandlerPtr
-xmlNewCharEncodingHandler(const char *name,
- xmlCharEncodingInputFunc input,
- xmlCharEncodingOutputFunc output) {
- xmlCharEncodingHandlerPtr handler;
- const char *alias;
- char upper[500];
- int i;
- char *up = 0;
-
- /*
- * Do the alias resolution
- */
- alias = xmlGetEncodingAlias(name);
- if (alias != NULL)
- name = alias;
-
- /*
- * Keep only the uppercase version of the encoding.
- */
- if (name == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewCharEncodingHandler : no name !\n");
- return(NULL);
- }
- for (i = 0;i < 499;i++) {
- upper[i] = toupper(name[i]);
- if (upper[i] == 0) break;
- }
- upper[i] = 0;
- up = xmlMemStrdup(upper);
- if (up == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewCharEncodingHandler : out of memory !\n");
- return(NULL);
- }
-
- /*
- * allocate and fill-up an handler block.
- */
- handler = (xmlCharEncodingHandlerPtr)
- xmlMalloc(sizeof(xmlCharEncodingHandler));
- if (handler == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewCharEncodingHandler : out of memory !\n");
- return(NULL);
- }
- handler->input = input;
- handler->output = output;
- handler->name = up;
-
-#ifdef LIBXML_ICONV_ENABLED
- handler->iconv_in = NULL;
- handler->iconv_out = NULL;
-#endif /* LIBXML_ICONV_ENABLED */
-
- /*
- * registers and returns the handler.
- */
- xmlRegisterCharEncodingHandler(handler);
-#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "Registered encoding handler for %s\n", name);
-#endif
- return(handler);
-}
-
-/**
- * xmlInitCharEncodingHandlers:
- *
- * Initialize the char encoding support, it registers the default
- * encoding supported.
- * NOTE: while public, this function usually doesn't need to be called
- * in normal processing.
- */
-void
-xmlInitCharEncodingHandlers(void) {
- unsigned short int tst = 0x1234;
- unsigned char *ptr = (unsigned char *) &tst;
-
- if (handlers != NULL) return;
-
- handlers = (xmlCharEncodingHandlerPtr *)
- xmlMalloc(MAX_ENCODING_HANDLERS * sizeof(xmlCharEncodingHandlerPtr));
-
- if (*ptr == 0x12) xmlLittleEndian = 0;
- else if (*ptr == 0x34) xmlLittleEndian = 1;
- else xmlGenericError(xmlGenericErrorContext,
- "Odd problem at endianness detection\n");
-
- if (handlers == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlInitCharEncodingHandlers : out of memory !\n");
- return;
- }
- xmlNewCharEncodingHandler("UTF-8", NULL, NULL);
- xmlUTF16LEHandler =
- xmlNewCharEncodingHandler("UTF-16LE", UTF16LEToUTF8, UTF8ToUTF16LE);
- xmlUTF16BEHandler =
- xmlNewCharEncodingHandler("UTF-16BE", UTF16BEToUTF8, UTF8ToUTF16BE);
- xmlNewCharEncodingHandler("ISO-8859-1", isolat1ToUTF8, UTF8Toisolat1);
- xmlNewCharEncodingHandler("ASCII", asciiToUTF8, UTF8Toascii);
- xmlNewCharEncodingHandler("US-ASCII", asciiToUTF8, UTF8Toascii);
-#ifdef LIBXML_HTML_ENABLED
- xmlNewCharEncodingHandler("HTML", NULL, UTF8ToHtml);
-#endif
-}
-
-/**
- * xmlCleanupCharEncodingHandlers:
- *
- * Cleanup the memory allocated for the char encoding support, it
- * unregisters all the encoding handlers and the aliases.
- */
-void
-xmlCleanupCharEncodingHandlers(void) {
- xmlCleanupEncodingAliases();
-
- if (handlers == NULL) return;
-
- for (;nbCharEncodingHandler > 0;) {
- nbCharEncodingHandler--;
- if (handlers[nbCharEncodingHandler] != NULL) {
- if (handlers[nbCharEncodingHandler]->name != NULL)
- xmlFree(handlers[nbCharEncodingHandler]->name);
- xmlFree(handlers[nbCharEncodingHandler]);
- }
- }
- xmlFree(handlers);
- handlers = NULL;
- nbCharEncodingHandler = 0;
- xmlDefaultCharEncodingHandler = NULL;
-}
-
-/**
- * xmlRegisterCharEncodingHandler:
- * @handler: the xmlCharEncodingHandlerPtr handler block
- *
- * Register the char encoding handler, surprising, isn't it ?
- */
-void
-xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) {
- if (handlers == NULL) xmlInitCharEncodingHandlers();
- if (handler == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlRegisterCharEncodingHandler: NULL handler !\n");
- return;
- }
-
- if (nbCharEncodingHandler >= MAX_ENCODING_HANDLERS) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlRegisterCharEncodingHandler: Too many handler registered\n");
- xmlGenericError(xmlGenericErrorContext,
- "\tincrease MAX_ENCODING_HANDLERS : %s\n", __FILE__);
- return;
- }
- handlers[nbCharEncodingHandler++] = handler;
-}
-
-/**
- * xmlGetCharEncodingHandler:
- * @enc: an xmlCharEncoding value.
- *
- * Search in the registered set the handler able to read/write that encoding.
- *
- * Returns the handler or NULL if not found
- */
-xmlCharEncodingHandlerPtr
-xmlGetCharEncodingHandler(xmlCharEncoding enc) {
- xmlCharEncodingHandlerPtr handler;
-
- if (handlers == NULL) xmlInitCharEncodingHandlers();
- switch (enc) {
- case XML_CHAR_ENCODING_ERROR:
- return(NULL);
- case XML_CHAR_ENCODING_NONE:
- return(NULL);
- case XML_CHAR_ENCODING_UTF8:
- return(NULL);
- case XML_CHAR_ENCODING_UTF16LE:
- return(xmlUTF16LEHandler);
- case XML_CHAR_ENCODING_UTF16BE:
- return(xmlUTF16BEHandler);
- case XML_CHAR_ENCODING_EBCDIC:
- handler = xmlFindCharEncodingHandler("EBCDIC");
- if (handler != NULL) return(handler);
- handler = xmlFindCharEncodingHandler("ebcdic");
- if (handler != NULL) return(handler);
- break;
- case XML_CHAR_ENCODING_UCS4BE:
- handler = xmlFindCharEncodingHandler("ISO-10646-UCS-4");
- if (handler != NULL) return(handler);
- handler = xmlFindCharEncodingHandler("UCS-4");
- if (handler != NULL) return(handler);
- handler = xmlFindCharEncodingHandler("UCS4");
- if (handler != NULL) return(handler);
- break;
- case XML_CHAR_ENCODING_UCS4LE:
- handler = xmlFindCharEncodingHandler("ISO-10646-UCS-4");
- if (handler != NULL) return(handler);
- handler = xmlFindCharEncodingHandler("UCS-4");
- if (handler != NULL) return(handler);
- handler = xmlFindCharEncodingHandler("UCS4");
- if (handler != NULL) return(handler);
- break;
- case XML_CHAR_ENCODING_UCS4_2143:
- break;
- case XML_CHAR_ENCODING_UCS4_3412:
- break;
- case XML_CHAR_ENCODING_UCS2:
- handler = xmlFindCharEncodingHandler("ISO-10646-UCS-2");
- if (handler != NULL) return(handler);
- handler = xmlFindCharEncodingHandler("UCS-2");
- if (handler != NULL) return(handler);
- handler = xmlFindCharEncodingHandler("UCS2");
- if (handler != NULL) return(handler);
- break;
-
- /*
- * We used to keep ISO Latin encodings native in the
- * generated data. This led to so many problems that
- * this has been removed. One can still change this
- * back by registering no-ops encoders for those
- */
- case XML_CHAR_ENCODING_8859_1:
- handler = xmlFindCharEncodingHandler("ISO-8859-1");
- if (handler != NULL) return(handler);
- break;
- case XML_CHAR_ENCODING_8859_2:
- handler = xmlFindCharEncodingHandler("ISO-8859-2");
- if (handler != NULL) return(handler);
- break;
- case XML_CHAR_ENCODING_8859_3:
- handler = xmlFindCharEncodingHandler("ISO-8859-3");
- if (handler != NULL) return(handler);
- break;
- case XML_CHAR_ENCODING_8859_4:
- handler = xmlFindCharEncodingHandler("ISO-8859-4");
- if (handler != NULL) return(handler);
- break;
- case XML_CHAR_ENCODING_8859_5:
- handler = xmlFindCharEncodingHandler("ISO-8859-5");
- if (handler != NULL) return(handler);
- break;
- case XML_CHAR_ENCODING_8859_6:
- handler = xmlFindCharEncodingHandler("ISO-8859-6");
- if (handler != NULL) return(handler);
- break;
- case XML_CHAR_ENCODING_8859_7:
- handler = xmlFindCharEncodingHandler("ISO-8859-7");
- if (handler != NULL) return(handler);
- break;
- case XML_CHAR_ENCODING_8859_8:
- handler = xmlFindCharEncodingHandler("ISO-8859-8");
- if (handler != NULL) return(handler);
- break;
- case XML_CHAR_ENCODING_8859_9:
- handler = xmlFindCharEncodingHandler("ISO-8859-9");
- if (handler != NULL) return(handler);
- break;
-
-
- case XML_CHAR_ENCODING_2022_JP:
- handler = xmlFindCharEncodingHandler("ISO-2022-JP");
- if (handler != NULL) return(handler);
- break;
- case XML_CHAR_ENCODING_SHIFT_JIS:
- handler = xmlFindCharEncodingHandler("SHIFT-JIS");
- if (handler != NULL) return(handler);
- handler = xmlFindCharEncodingHandler("SHIFT_JIS");
- if (handler != NULL) return(handler);
- handler = xmlFindCharEncodingHandler("Shift_JIS");
- if (handler != NULL) return(handler);
- break;
- case XML_CHAR_ENCODING_EUC_JP:
- handler = xmlFindCharEncodingHandler("EUC-JP");
- if (handler != NULL) return(handler);
- break;
- default:
- break;
- }
-
-#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "No handler found for encoding %d\n", enc);
-#endif
- return(NULL);
-}
-
-/**
- * xmlFindCharEncodingHandler:
- * @name: a string describing the char encoding.
- *
- * Search in the registered set the handler able to read/write that encoding.
- *
- * Returns the handler or NULL if not found
- */
-xmlCharEncodingHandlerPtr
-xmlFindCharEncodingHandler(const char *name) {
- const char *nalias;
- const char *norig;
- xmlCharEncoding alias;
-#ifdef LIBXML_ICONV_ENABLED
- xmlCharEncodingHandlerPtr enc;
- iconv_t icv_in, icv_out;
-#endif /* LIBXML_ICONV_ENABLED */
- char upper[100];
- int i;
-
- if (handlers == NULL) xmlInitCharEncodingHandlers();
- if (name == NULL) return(xmlDefaultCharEncodingHandler);
- if (name[0] == 0) return(xmlDefaultCharEncodingHandler);
-
- /*
- * Do the alias resolution
- */
- norig = name;
- nalias = xmlGetEncodingAlias(name);
- if (nalias != NULL)
- name = nalias;
-
- /*
- * Check first for directly registered encoding names
- */
- for (i = 0;i < 99;i++) {
- upper[i] = toupper(name[i]);
- if (upper[i] == 0) break;
- }
- upper[i] = 0;
-
- for (i = 0;i < nbCharEncodingHandler; i++)
- if (!strcmp(upper, handlers[i]->name)) {
-#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "Found registered handler for encoding %s\n", name);
-#endif
- return(handlers[i]);
- }
-
-#ifdef LIBXML_ICONV_ENABLED
- /* check whether iconv can handle this */
- icv_in = iconv_open("UTF-8", name);
- icv_out = iconv_open(name, "UTF-8");
- if ((icv_in != (iconv_t) -1) && (icv_out != (iconv_t) -1)) {
- enc = (xmlCharEncodingHandlerPtr)
- xmlMalloc(sizeof(xmlCharEncodingHandler));
- if (enc == NULL) {
- iconv_close(icv_in);
- iconv_close(icv_out);
- return(NULL);
- }
- enc->name = xmlMemStrdup(name);
- enc->input = NULL;
- enc->output = NULL;
- enc->iconv_in = icv_in;
- enc->iconv_out = icv_out;
-#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "Found iconv handler for encoding %s\n", name);
-#endif
- return enc;
- } else if ((icv_in != (iconv_t) -1) || icv_out != (iconv_t) -1) {
- xmlGenericError(xmlGenericErrorContext,
- "iconv : problems with filters for '%s'\n", name);
- }
-#endif /* LIBXML_ICONV_ENABLED */
-
-#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "No handler found for encoding %s\n", name);
-#endif
-
- /*
- * Fallback using the canonical names
- */
- alias = xmlParseCharEncoding(norig);
- if (alias != XML_CHAR_ENCODING_ERROR) {
- const char* canon;
- canon = xmlGetCharEncodingName(alias);
- if ((canon != NULL) && (strcmp(name, canon))) {
- return(xmlFindCharEncodingHandler(canon));
- }
- }
-
- return(NULL);
-}
-
-/************************************************************************
- * *
- * ICONV based generic conversion functions *
- * *
- ************************************************************************/
-
-#ifdef LIBXML_ICONV_ENABLED
-/**
- * xmlIconvWrapper:
- * @cd: iconv converter data structure
- * @out: a pointer to an array of bytes to store the result
- * @outlen: the length of @out
- * @in: a pointer to an array of ISO Latin 1 chars
- * @inlen: the length of @in
- *
- * Returns 0 if success, or
- * -1 by lack of space, or
- * -2 if the transcoding fails (for *in is not valid utf8 string or
- * the result of transformation can't fit into the encoding we want), or
- * -3 if there the last byte can't form a single output char.
- *
- * The value of @inlen after return is the number of octets consumed
- * as the return value is positive, else unpredictable.
- * The value of @outlen after return is the number of ocetes consumed.
- */
-static int
-xmlIconvWrapper(iconv_t cd,
- unsigned char *out, int *outlen,
- const unsigned char *in, int *inlen) {
-
- size_t icv_inlen = *inlen, icv_outlen = *outlen;
- const char *icv_in = (const char *) in;
- char *icv_out = (char *) out;
- int ret;
-
- ret = iconv(cd, (char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen);
- if (in != NULL) {
- *inlen -= icv_inlen;
- *outlen -= icv_outlen;
- } else {
- *inlen = 0;
- *outlen = 0;
- }
- if ((icv_inlen != 0) || (ret == -1)) {
-#ifdef EILSEQ
- if (errno == EILSEQ) {
- return -2;
- } else
-#endif
-#ifdef E2BIG
- if (errno == E2BIG) {
- return -1;
- } else
-#endif
-#ifdef EINVAL
- if (errno == EINVAL) {
- return -3;
- } else
-#endif
- {
- return -3;
- }
- }
- return 0;
-}
-#endif /* LIBXML_ICONV_ENABLED */
-
-/************************************************************************
- * *
- * The real API used by libxml for on-the-fly conversion *
- * *
- ************************************************************************/
-
-/**
- * xmlCharEncFirstLine:
- * @handler: char enconding transformation data structure
- * @out: an xmlBuffer for the output.
- * @in: an xmlBuffer for the input
- *
- * Front-end for the encoding handler input function, but handle only
- * the very first line, i.e. limit itself to 45 chars.
- *
- * Returns the number of byte written if success, or
- * -1 general error
- * -2 if the transcoding fails (for *in is not valid utf8 string or
- * the result of transformation can't fit into the encoding we want), or
- */
-int
-xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
- xmlBufferPtr in) {
- int ret = -2;
- int written;
- int toconv;
-
- if (handler == NULL) return(-1);
- if (out == NULL) return(-1);
- if (in == NULL) return(-1);
-
- written = out->size - out->use;
- toconv = in->use;
- if (toconv * 2 >= written) {
- xmlBufferGrow(out, toconv);
- written = out->size - out->use - 1;
- }
-
- /*
- * echo '<?xml version="1.0" encoding="UCS4"?>' | wc -c => 38
- * 45 chars should be sufficient to reach the end of the encoding
- * declaration without going too far inside the document content.
- */
- written = 45;
-
- if (handler->input != NULL) {
- ret = handler->input(&out->content[out->use], &written,
- in->content, &toconv);
- xmlBufferShrink(in, toconv);
- out->use += written;
- out->content[out->use] = 0;
- }
-#ifdef LIBXML_ICONV_ENABLED
- else if (handler->iconv_in != NULL) {
- ret = xmlIconvWrapper(handler->iconv_in, &out->content[out->use],
- &written, in->content, &toconv);
- xmlBufferShrink(in, toconv);
- out->use += written;
- out->content[out->use] = 0;
- if (ret == -1) ret = -3;
- }
-#endif /* LIBXML_ICONV_ENABLED */
-#ifdef DEBUG_ENCODING
- switch (ret) {
- case 0:
- xmlGenericError(xmlGenericErrorContext,
- "converted %d bytes to %d bytes of input\n",
- toconv, written);
- break;
- case -1:
- xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of input, %d left\n",
- toconv, written, in->use);
- break;
- case -2:
- xmlGenericError(xmlGenericErrorContext,
- "input conversion failed due to input error\n");
- break;
- case -3:
- xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of input, %d left\n",
- toconv, written, in->use);
- break;
- default:
- xmlGenericError(xmlGenericErrorContext,"Unknown input conversion failed %d\n", ret);
- }
-#endif /* DEBUG_ENCODING */
- /*
- * Ignore when input buffer is not on a boundary
- */
- if (ret == -3) ret = 0;
- if (ret == -1) ret = 0;
- return(ret);
-}
-
-/**
- * xmlCharEncInFunc:
- * @handler: char encoding transformation data structure
- * @out: an xmlBuffer for the output.
- * @in: an xmlBuffer for the input
- *
- * Generic front-end for the encoding handler input function
- *
- * Returns the number of byte written if success, or
- * -1 general error
- * -2 if the transcoding fails (for *in is not valid utf8 string or
- * the result of transformation can't fit into the encoding we want), or
- */
-int
-xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out,
- xmlBufferPtr in)
-{
- int ret = -2;
- int written;
- int toconv;
-
- if (handler == NULL)
- return (-1);
- if (out == NULL)
- return (-1);
- if (in == NULL)
- return (-1);
-
- toconv = in->use;
- if (toconv == 0)
- return (0);
- written = out->size - out->use;
- if (toconv * 2 >= written) {
- xmlBufferGrow(out, out->size + toconv * 2);
- written = out->size - out->use - 1;
- }
- if (handler->input != NULL) {
- ret = handler->input(&out->content[out->use], &written,
- in->content, &toconv);
- xmlBufferShrink(in, toconv);
- out->use += written;
- out->content[out->use] = 0;
- }
-#ifdef LIBXML_ICONV_ENABLED
- else if (handler->iconv_in != NULL) {
- ret = xmlIconvWrapper(handler->iconv_in, &out->content[out->use],
- &written, in->content, &toconv);
- xmlBufferShrink(in, toconv);
- out->use += written;
- out->content[out->use] = 0;
- if (ret == -1)
- ret = -3;
- }
-#endif /* LIBXML_ICONV_ENABLED */
- switch (ret) {
- case 0:
-#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "converted %d bytes to %d bytes of input\n",
- toconv, written);
-#endif
- break;
- case -1:
-#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "converted %d bytes to %d bytes of input, %d left\n",
- toconv, written, in->use);
-#endif
- break;
- case -3:
-#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "converted %d bytes to %d bytes of input, %d left\n",
- toconv, written, in->use);
-#endif
- break;
- case -2:
- xmlGenericError(xmlGenericErrorContext,
- "input conversion failed due to input error\n");
- xmlGenericError(xmlGenericErrorContext,
- "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
- in->content[0], in->content[1],
- in->content[2], in->content[3]);
- }
- /*
- * Ignore when input buffer is not on a boundary
- */
- if (ret == -3)
- ret = 0;
- return (written);
-}
-
-/**
- * xmlCharEncOutFunc:
- * @handler: char enconding transformation data structure
- * @out: an xmlBuffer for the output.
- * @in: an xmlBuffer for the input
- *
- * Generic front-end for the encoding handler output function
- * a first call with @in == NULL has to be made firs to initiate the
- * output in case of non-stateless encoding needing to initiate their
- * state or the output (like the BOM in UTF16).
- * In case of UTF8 sequence conversion errors for the given encoder,
- * the content will be automatically remapped to a CharRef sequence.
- *
- * Returns the number of byte written if success, or
- * -1 general error
- * -2 if the transcoding fails (for *in is not valid utf8 string or
- * the result of transformation can't fit into the encoding we want), or
- */
-int
-xmlCharEncOutFunc(xmlCharEncodingHandler *handler, xmlBufferPtr out,
- xmlBufferPtr in) {
- int ret = -2;
- int written;
- int writtentot = 0;
- int toconv;
- int output = 0;
-
- if (handler == NULL) return(-1);
- if (out == NULL) return(-1);
-
-retry:
-
- written = out->size - out->use;
-
- /*
- * First specific handling of in = NULL, i.e. the initialization call
- */
- if (in == NULL) {
- toconv = 0;
- if (handler->output != NULL) {
- ret = handler->output(&out->content[out->use], &written,
- NULL, &toconv);
- out->use += written;
- out->content[out->use] = 0;
- }
-#ifdef LIBXML_ICONV_ENABLED
- else if (handler->iconv_out != NULL) {
- ret = xmlIconvWrapper(handler->iconv_out, &out->content[out->use],
- &written, NULL, &toconv);
- out->use += written;
- out->content[out->use] = 0;
- }
-#endif /* LIBXML_ICONV_ENABLED */
-#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "initialized encoder\n");
-#endif
- return(0);
- }
-
- /*
- * Conversion itself.
- */
- toconv = in->use;
- if (toconv == 0)
- return(0);
- if (toconv * 2 >= written) {
- xmlBufferGrow(out, toconv * 2);
- written = out->size - out->use - 1;
- }
- if (handler->output != NULL) {
- ret = handler->output(&out->content[out->use], &written,
- in->content, &toconv);
- xmlBufferShrink(in, toconv);
- out->use += written;
- writtentot += written;
- out->content[out->use] = 0;
- }
-#ifdef LIBXML_ICONV_ENABLED
- else if (handler->iconv_out != NULL) {
- ret = xmlIconvWrapper(handler->iconv_out, &out->content[out->use],
- &written, in->content, &toconv);
- xmlBufferShrink(in, toconv);
- out->use += written;
- writtentot += written;
- out->content[out->use] = 0;
- if (ret == -1) {
- if (written > 0) {
- /*
- * Can be a limitation of iconv
- */
- goto retry;
- }
- ret = -3;
- }
- }
-#endif /* LIBXML_ICONV_ENABLED */
- else {
- xmlGenericError(xmlGenericErrorContext,
- "xmlCharEncOutFunc: no output function !\n");
- return(-1);
- }
-
- if (ret >= 0) output += ret;
-
- /*
- * Attempt to handle error cases
- */
- switch (ret) {
- case 0:
-#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "converted %d bytes to %d bytes of output\n",
- toconv, written);
-#endif
- break;
- case -1:
-#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "output conversion failed by lack of space\n");
-#endif
- break;
- case -3:
- xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of output %d left\n",
- toconv, written, in->use);
- break;
- case -2: {
- int len = in->use;
- const xmlChar *utf = (const xmlChar *) in->content;
- int cur;
-
- cur = xmlGetUTF8Char(utf, &len);
- if (cur > 0) {
- xmlChar charref[20];
-
-#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "handling output conversion error\n");
- xmlGenericError(xmlGenericErrorContext,
- "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
- in->content[0], in->content[1],
- in->content[2], in->content[3]);
-#endif
- /*
- * Removes the UTF8 sequence, and replace it by a charref
- * and continue the transcoding phase, hoping the error
- * did not mangle the encoder state.
- */
- snprintf((char *) charref, sizeof(charref), "&#%d;", cur);
- xmlBufferShrink(in, len);
- xmlBufferAddHead(in, charref, -1);
-
- goto retry;
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "output conversion failed due to conv error\n");
- xmlGenericError(xmlGenericErrorContext,
- "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
- in->content[0], in->content[1],
- in->content[2], in->content[3]);
- in->content[0] = ' ';
- }
- break;
- }
- }
- return(ret);
-}
-
-/**
- * xmlCharEncCloseFunc:
- * @handler: char enconding transformation data structure
- *
- * Generic front-end for encoding handler close function
- *
- * Returns 0 if success, or -1 in case of error
- */
-int
-xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
- int ret = 0;
- if (handler == NULL) return(-1);
- if (handler->name == NULL) return(-1);
-#ifdef LIBXML_ICONV_ENABLED
- /*
- * Iconv handlers can be used only once, free the whole block.
- * and the associated icon resources.
- */
- if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) {
- if (handler->name != NULL)
- xmlFree(handler->name);
- handler->name = NULL;
- if (handler->iconv_out != NULL) {
- if (iconv_close(handler->iconv_out))
- ret = -1;
- handler->iconv_out = NULL;
- }
- if (handler->iconv_in != NULL) {
- if (iconv_close(handler->iconv_in))
- ret = -1;
- handler->iconv_in = NULL;
- }
- xmlFree(handler);
- }
-#endif /* LIBXML_ICONV_ENABLED */
-#ifdef DEBUG_ENCODING
- if (ret)
- xmlGenericError(xmlGenericErrorContext,
- "failed to close the encoding handler\n");
- else
- xmlGenericError(xmlGenericErrorContext,
- "closed the encoding handler\n");
-#endif
-
- return(ret);
-}
-
diff --git a/bundle/libxml/entities.c b/bundle/libxml/entities.c
deleted file mode 100644
index dbdf9ebf32..0000000000
--- a/bundle/libxml/entities.c
+++ /dev/null
@@ -1,1006 +0,0 @@
-/*
- * entities.c : implementation for the XML entities handling
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#include <string.h>
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include <libxml/xmlmemory.h>
-#include <libxml/hash.h>
-#include <libxml/entities.h>
-#include <libxml/parser.h>
-#include <libxml/xmlerror.h>
-#include <libxml/globals.h>
-
-/*
- * The XML predefined entities.
- */
-
-struct xmlPredefinedEntityValue {
- const char *name;
- const char *value;
-};
-static struct xmlPredefinedEntityValue xmlPredefinedEntityValues[] = {
- { "lt", "<" },
- { "gt", ">" },
- { "apos", "'" },
- { "quot", "\"" },
- { "amp", "&" }
-};
-
-/*
- * TODO: This is GROSS, allocation of a 256 entry hash for
- * a fixed number of 4 elements !
- */
-static xmlHashTablePtr xmlPredefinedEntities = NULL;
-
-/*
- * xmlFreeEntity : clean-up an entity record.
- */
-static void xmlFreeEntity(xmlEntityPtr entity) {
- if (entity == NULL) return;
-
- if ((entity->children) &&
- (entity == (xmlEntityPtr) entity->children->parent))
- xmlFreeNodeList(entity->children);
- if (entity->name != NULL)
- xmlFree((char *) entity->name);
- if (entity->ExternalID != NULL)
- xmlFree((char *) entity->ExternalID);
- if (entity->SystemID != NULL)
- xmlFree((char *) entity->SystemID);
- if (entity->URI != NULL)
- xmlFree((char *) entity->URI);
- if (entity->content != NULL)
- xmlFree((char *) entity->content);
- if (entity->orig != NULL)
- xmlFree((char *) entity->orig);
- xmlFree(entity);
-}
-
-/*
- * xmlAddEntity : register a new entity for an entities table.
- */
-static xmlEntityPtr
-xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type,
- const xmlChar *ExternalID, const xmlChar *SystemID,
- const xmlChar *content) {
- xmlEntitiesTablePtr table = NULL;
- xmlEntityPtr ret;
-
- if (name == NULL)
- return(NULL);
- switch (type) {
- case XML_INTERNAL_GENERAL_ENTITY:
- case XML_EXTERNAL_GENERAL_PARSED_ENTITY:
- case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY:
- if (dtd->entities == NULL)
- dtd->entities = xmlHashCreate(0);
- table = dtd->entities;
- break;
- case XML_INTERNAL_PARAMETER_ENTITY:
- case XML_EXTERNAL_PARAMETER_ENTITY:
- if (dtd->pentities == NULL)
- dtd->pentities = xmlHashCreate(0);
- table = dtd->pentities;
- break;
- case XML_INTERNAL_PREDEFINED_ENTITY:
- if (xmlPredefinedEntities == NULL)
- xmlPredefinedEntities = xmlHashCreate(8);
- table = xmlPredefinedEntities;
- }
- if (table == NULL)
- return(NULL);
- ret = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddEntity: out of memory\n");
- return(NULL);
- }
- memset(ret, 0, sizeof(xmlEntity));
- ret->type = XML_ENTITY_DECL;
-
- /*
- * fill the structure.
- */
- ret->name = xmlStrdup(name);
- ret->etype = (xmlEntityType) type;
- if (ExternalID != NULL)
- ret->ExternalID = xmlStrdup(ExternalID);
- if (SystemID != NULL)
- ret->SystemID = xmlStrdup(SystemID);
- if (content != NULL) {
- ret->length = xmlStrlen(content);
- ret->content = xmlStrndup(content, ret->length);
- } else {
- ret->length = 0;
- ret->content = NULL;
- }
- ret->URI = NULL; /* to be computed by the layer knowing
- the defining entity */
- ret->orig = NULL;
-
- if (xmlHashAddEntry(table, name, ret)) {
- /*
- * entity was already defined at another level.
- */
- xmlFreeEntity(ret);
- return(NULL);
- }
- return(ret);
-}
-
-/**
- * xmlInitializePredefinedEntities:
- *
- * Set up the predefined entities.
- */
-void xmlInitializePredefinedEntities(void) {
- unsigned int i;
- xmlChar name[50];
- xmlChar value[50];
- const char *in;
- xmlChar *out;
-
- if (xmlPredefinedEntities != NULL) return;
-
- xmlPredefinedEntities = xmlCreateEntitiesTable();
- for (i = 0;i < sizeof(xmlPredefinedEntityValues) /
- sizeof(xmlPredefinedEntityValues[0]);i++) {
- in = xmlPredefinedEntityValues[i].name;
- out = &name[0];
- for (;(*out++ = (xmlChar) *in);)in++;
- in = xmlPredefinedEntityValues[i].value;
- out = &value[0];
- for (;(*out++ = (xmlChar) *in);)in++;
-
- xmlAddEntity(NULL, (const xmlChar *) &name[0],
- XML_INTERNAL_PREDEFINED_ENTITY, NULL, NULL,
- &value[0]);
- }
-}
-
-/**
- * xmlCleanupPredefinedEntities:
- *
- * Cleanup up the predefined entities table.
- */
-void xmlCleanupPredefinedEntities(void) {
- if (xmlPredefinedEntities == NULL) return;
-
- xmlFreeEntitiesTable(xmlPredefinedEntities);
- xmlPredefinedEntities = NULL;
-}
-
-/**
- * xmlGetPredefinedEntity:
- * @name: the entity name
- *
- * Check whether this name is an predefined entity.
- *
- * Returns NULL if not, otherwise the entity
- */
-xmlEntityPtr
-xmlGetPredefinedEntity(const xmlChar *name) {
- if (xmlPredefinedEntities == NULL)
- xmlInitializePredefinedEntities();
- return((xmlEntityPtr) xmlHashLookup(xmlPredefinedEntities, name));
-}
-
-/**
- * xmlAddDtdEntity:
- * @doc: the document
- * @name: the entity name
- * @type: the entity type XML_xxx_yyy_ENTITY
- * @ExternalID: the entity external ID if available
- * @SystemID: the entity system ID if available
- * @content: the entity content
- *
- * Register a new entity for this document DTD external subset.
- *
- * Returns a pointer to the entity or NULL in case of error
- */
-xmlEntityPtr
-xmlAddDtdEntity(xmlDocPtr doc, const xmlChar *name, int type,
- const xmlChar *ExternalID, const xmlChar *SystemID,
- const xmlChar *content) {
- xmlEntityPtr ret;
- xmlDtdPtr dtd;
-
- if (doc == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddDtdEntity: doc == NULL !\n");
- return(NULL);
- }
- if (doc->extSubset == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddDtdEntity: document without external subset !\n");
- return(NULL);
- }
- dtd = doc->extSubset;
- ret = xmlAddEntity(dtd, name, type, ExternalID, SystemID, content);
- if (ret == NULL) return(NULL);
-
- /*
- * Link it to the DTD
- */
- ret->parent = dtd;
- ret->doc = dtd->doc;
- if (dtd->last == NULL) {
- dtd->children = dtd->last = (xmlNodePtr) ret;
- } else {
- dtd->last->next = (xmlNodePtr) ret;
- ret->prev = dtd->last;
- dtd->last = (xmlNodePtr) ret;
- }
- return(ret);
-}
-
-/**
- * xmlAddDocEntity:
- * @doc: the document
- * @name: the entity name
- * @type: the entity type XML_xxx_yyy_ENTITY
- * @ExternalID: the entity external ID if available
- * @SystemID: the entity system ID if available
- * @content: the entity content
- *
- * Register a new entity for this document.
- *
- * Returns a pointer to the entity or NULL in case of error
- */
-xmlEntityPtr
-xmlAddDocEntity(xmlDocPtr doc, const xmlChar *name, int type,
- const xmlChar *ExternalID, const xmlChar *SystemID,
- const xmlChar *content) {
- xmlEntityPtr ret;
- xmlDtdPtr dtd;
-
- if (doc == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddDocEntity: document is NULL !\n");
- return(NULL);
- }
- if (doc->intSubset == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddDocEntity: document without internal subset !\n");
- return(NULL);
- }
- dtd = doc->intSubset;
- ret = xmlAddEntity(dtd, name, type, ExternalID, SystemID, content);
- if (ret == NULL) return(NULL);
-
- /*
- * Link it to the DTD
- */
- ret->parent = dtd;
- ret->doc = dtd->doc;
- if (dtd->last == NULL) {
- dtd->children = dtd->last = (xmlNodePtr) ret;
- } else {
- dtd->last->next = (xmlNodePtr) ret;
- ret->prev = dtd->last;
- dtd->last = (xmlNodePtr) ret;
- }
- return(ret);
-}
-
-/**
- * xmlGetEntityFromTable:
- * @table: an entity table
- * @name: the entity name
- * @parameter: look for parameter entities
- *
- * Do an entity lookup in the table.
- * returns the corresponding parameter entity, if found.
- *
- * Returns A pointer to the entity structure or NULL if not found.
- */
-static xmlEntityPtr
-xmlGetEntityFromTable(xmlEntitiesTablePtr table, const xmlChar *name) {
- return((xmlEntityPtr) xmlHashLookup(table, name));
-}
-
-/**
- * xmlGetParameterEntity:
- * @doc: the document referencing the entity
- * @name: the entity name
- *
- * Do an entity lookup in the internal and external subsets and
- * returns the corresponding parameter entity, if found.
- *
- * Returns A pointer to the entity structure or NULL if not found.
- */
-xmlEntityPtr
-xmlGetParameterEntity(xmlDocPtr doc, const xmlChar *name) {
- xmlEntitiesTablePtr table;
- xmlEntityPtr ret;
-
- if (doc == NULL)
- return(NULL);
- if ((doc->intSubset != NULL) && (doc->intSubset->pentities != NULL)) {
- table = (xmlEntitiesTablePtr) doc->intSubset->pentities;
- ret = xmlGetEntityFromTable(table, name);
- if (ret != NULL)
- return(ret);
- }
- if ((doc->extSubset != NULL) && (doc->extSubset->pentities != NULL)) {
- table = (xmlEntitiesTablePtr) doc->extSubset->pentities;
- return(xmlGetEntityFromTable(table, name));
- }
- return(NULL);
-}
-
-/**
- * xmlGetDtdEntity:
- * @doc: the document referencing the entity
- * @name: the entity name
- *
- * Do an entity lookup in the DTD entity hash table and
- * returns the corresponding entity, if found.
- * Note: the first argument is the document node, not the DTD node.
- *
- * Returns A pointer to the entity structure or NULL if not found.
- */
-xmlEntityPtr
-xmlGetDtdEntity(xmlDocPtr doc, const xmlChar *name) {
- xmlEntitiesTablePtr table;
-
- if (doc == NULL)
- return(NULL);
- if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) {
- table = (xmlEntitiesTablePtr) doc->extSubset->entities;
- return(xmlGetEntityFromTable(table, name));
- }
- return(NULL);
-}
-
-/**
- * xmlGetDocEntity:
- * @doc: the document referencing the entity
- * @name: the entity name
- *
- * Do an entity lookup in the document entity hash table and
- * returns the corresponding entity, otherwise a lookup is done
- * in the predefined entities too.
- *
- * Returns A pointer to the entity structure or NULL if not found.
- */
-xmlEntityPtr
-xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) {
- xmlEntityPtr cur;
- xmlEntitiesTablePtr table;
-
- if (doc != NULL) {
- if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) {
- table = (xmlEntitiesTablePtr) doc->intSubset->entities;
- cur = xmlGetEntityFromTable(table, name);
- if (cur != NULL)
- return(cur);
- }
- if (doc->standalone != 1) {
- if ((doc->extSubset != NULL) &&
- (doc->extSubset->entities != NULL)) {
- table = (xmlEntitiesTablePtr) doc->extSubset->entities;
- cur = xmlGetEntityFromTable(table, name);
- if (cur != NULL)
- return(cur);
- }
- }
- }
- if (xmlPredefinedEntities == NULL)
- xmlInitializePredefinedEntities();
- table = xmlPredefinedEntities;
- return(xmlGetEntityFromTable(table, name));
-}
-
-/*
- * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
- * | [#x10000-#x10FFFF]
- * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
- */
-#define IS_CHAR(c) \
- (((c) == 0x09) || ((c) == 0x0a) || ((c) == 0x0d) || \
- (((c) >= 0x20) && ((c) != 0xFFFE) && ((c) != 0xFFFF)))
-
-/*
- * A buffer used for converting entities to their equivalent and back.
- */
-static int static_buffer_size = 0;
-static xmlChar *static_buffer = NULL;
-
-static int growBuffer(void) {
- static_buffer_size *= 2;
- static_buffer = (xmlChar *) xmlRealloc(static_buffer,
- static_buffer_size * sizeof(xmlChar));
- if (static_buffer == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc failed\n");
- return(-1);
- }
- return(0);
-}
-
-
-/**
- * xmlEncodeEntities:
- * @doc: the document containing the string
- * @input: A string to convert to XML.
- *
- * Do a global encoding of a string, replacing the predefined entities
- * and non ASCII values with their entities and CharRef counterparts.
- *
- * TODO: remove xmlEncodeEntities, once we are not afraid of breaking binary
- * compatibility
- *
- * People must migrate their code to xmlEncodeEntitiesReentrant !
- * This routine will issue a warning when encountered.
- *
- * Returns A newly allocated string with the substitution done.
- */
-const xmlChar *
-xmlEncodeEntities(xmlDocPtr doc, const xmlChar *input) {
- const xmlChar *cur = input;
- xmlChar *out = static_buffer;
- static int warning = 1;
- int html = 0;
-
-
- if (warning) {
- xmlGenericError(xmlGenericErrorContext,
- "Deprecated API xmlEncodeEntities() used\n");
- xmlGenericError(xmlGenericErrorContext,
- " change code to use xmlEncodeEntitiesReentrant()\n");
- warning = 0;
- }
-
- if (input == NULL) return(NULL);
- if (doc != NULL)
- html = (doc->type == XML_HTML_DOCUMENT_NODE);
-
- if (static_buffer == NULL) {
- static_buffer_size = 1000;
- static_buffer = (xmlChar *)
- xmlMalloc(static_buffer_size * sizeof(xmlChar));
- if (static_buffer == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc failed\n");
- return(NULL);
- }
- out = static_buffer;
- }
- while (*cur != '\0') {
- if (out - static_buffer > static_buffer_size - 100) {
- int indx = out - static_buffer;
-
- growBuffer();
- out = &static_buffer[indx];
- }
-
- /*
- * By default one have to encode at least '<', '>', '"' and '&' !
- */
- if (*cur == '<') {
- *out++ = '&';
- *out++ = 'l';
- *out++ = 't';
- *out++ = ';';
- } else if (*cur == '>') {
- *out++ = '&';
- *out++ = 'g';
- *out++ = 't';
- *out++ = ';';
- } else if (*cur == '&') {
- *out++ = '&';
- *out++ = 'a';
- *out++ = 'm';
- *out++ = 'p';
- *out++ = ';';
- } else if (*cur == '"') {
- *out++ = '&';
- *out++ = 'q';
- *out++ = 'u';
- *out++ = 'o';
- *out++ = 't';
- *out++ = ';';
- } else if ((*cur == '\'') && (!html)) {
- *out++ = '&';
- *out++ = 'a';
- *out++ = 'p';
- *out++ = 'o';
- *out++ = 's';
- *out++ = ';';
- } else if (((*cur >= 0x20) && (*cur < 0x80)) ||
- (*cur == '\n') || (*cur == '\r') || (*cur == '\t')) {
- /*
- * default case, just copy !
- */
- *out++ = *cur;
-#ifndef USE_UTF_8
- } else if ((sizeof(xmlChar) == 1) && (*cur >= 0x80)) {
- char buf[10], *ptr;
-
- snprintf(buf, sizeof(buf), "&#%d;", *cur);
- buf[sizeof(buf) - 1] = 0;
- ptr = buf;
- while (*ptr != 0) *out++ = *ptr++;
-#endif
- } else if (IS_CHAR(*cur)) {
- char buf[10], *ptr;
-
- snprintf(buf, sizeof(buf), "&#%d;", *cur);
- buf[sizeof(buf) - 1] = 0;
- ptr = buf;
- while (*ptr != 0) *out++ = *ptr++;
- }
-#if 0
- else {
- /*
- * default case, this is not a valid char !
- * Skip it...
- */
- xmlGenericError(xmlGenericErrorContext,
- "xmlEncodeEntities: invalid char %d\n", (int) *cur);
- }
-#endif
- cur++;
- }
- *out++ = 0;
- return(static_buffer);
-}
-
-/*
- * Macro used to grow the current buffer.
- */
-#define growBufferReentrant() { \
- buffer_size *= 2; \
- buffer = (xmlChar *) \
- xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \
- if (buffer == NULL) { \
- xmlGenericError(xmlGenericErrorContext, "realloc failed\n"); \
- return(NULL); \
- } \
-}
-
-
-/**
- * xmlEncodeEntitiesReentrant:
- * @doc: the document containing the string
- * @input: A string to convert to XML.
- *
- * Do a global encoding of a string, replacing the predefined entities
- * and non ASCII values with their entities and CharRef counterparts.
- * Contrary to xmlEncodeEntities, this routine is reentrant, and result
- * must be deallocated.
- *
- * Returns A newly allocated string with the substitution done.
- */
-xmlChar *
-xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
- const xmlChar *cur = input;
- xmlChar *buffer = NULL;
- xmlChar *out = NULL;
- int buffer_size = 0;
- int html = 0;
-
- if (input == NULL) return(NULL);
- if (doc != NULL)
- html = (doc->type == XML_HTML_DOCUMENT_NODE);
-
- /*
- * allocate an translation buffer.
- */
- buffer_size = 1000;
- buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
- if (buffer == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc failed\n");
- return(NULL);
- }
- out = buffer;
-
- while (*cur != '\0') {
- if (out - buffer > buffer_size - 100) {
- int indx = out - buffer;
-
- growBufferReentrant();
- out = &buffer[indx];
- }
-
- /*
- * By default one have to encode at least '<', '>', '"' and '&' !
- */
- if (*cur == '<') {
- *out++ = '&';
- *out++ = 'l';
- *out++ = 't';
- *out++ = ';';
- } else if (*cur == '>') {
- *out++ = '&';
- *out++ = 'g';
- *out++ = 't';
- *out++ = ';';
- } else if (*cur == '&') {
- *out++ = '&';
- *out++ = 'a';
- *out++ = 'm';
- *out++ = 'p';
- *out++ = ';';
- } else if (*cur == '"') {
- *out++ = '&';
- *out++ = 'q';
- *out++ = 'u';
- *out++ = 'o';
- *out++ = 't';
- *out++ = ';';
-#if 0
- } else if ((*cur == '\'') && (!html)) {
- *out++ = '&';
- *out++ = 'a';
- *out++ = 'p';
- *out++ = 'o';
- *out++ = 's';
- *out++ = ';';
-#endif
- } else if (((*cur >= 0x20) && (*cur < 0x80)) ||
- (*cur == '\n') || (*cur == '\r') || (*cur == '\t')) {
- /*
- * default case, just copy !
- */
- *out++ = *cur;
- } else if (*cur >= 0x80) {
- if (((doc != NULL) && (doc->encoding != NULL)) || (html)) {
- /*
- * Bjørn Reese <br@sseusa.com> provided the patch
- xmlChar xc;
- xc = (*cur & 0x3F) << 6;
- if (cur[1] != 0) {
- xc += *(++cur) & 0x3F;
- *out++ = xc;
- } else
- */
- *out++ = *cur;
- } else {
- /*
- * We assume we have UTF-8 input.
- */
- char buf[10], *ptr;
- int val = 0, l = 1;
-
- if (*cur < 0xC0) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlEncodeEntitiesReentrant : input not UTF-8\n");
- if (doc != NULL)
- doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1");
- snprintf(buf, sizeof(buf), "&#%d;", *cur);
- buf[sizeof(buf) - 1] = 0;
- ptr = buf;
- while (*ptr != 0) *out++ = *ptr++;
- cur++;
- continue;
- } else if (*cur < 0xE0) {
- val = (cur[0]) & 0x1F;
- val <<= 6;
- val |= (cur[1]) & 0x3F;
- l = 2;
- } else if (*cur < 0xF0) {
- val = (cur[0]) & 0x0F;
- val <<= 6;
- val |= (cur[1]) & 0x3F;
- val <<= 6;
- val |= (cur[2]) & 0x3F;
- l = 3;
- } else if (*cur < 0xF8) {
- val = (cur[0]) & 0x07;
- val <<= 6;
- val |= (cur[1]) & 0x3F;
- val <<= 6;
- val |= (cur[2]) & 0x3F;
- val <<= 6;
- val |= (cur[3]) & 0x3F;
- l = 4;
- }
- if ((l == 1) || (!IS_CHAR(val))) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlEncodeEntitiesReentrant : char out of range\n");
- if (doc != NULL)
- doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1");
- snprintf(buf, sizeof(buf), "&#%d;", *cur);
- buf[sizeof(buf) - 1] = 0;
- ptr = buf;
- while (*ptr != 0) *out++ = *ptr++;
- cur++;
- continue;
- }
- /*
- * We could do multiple things here. Just save as a char ref
- */
- if (html)
- snprintf(buf, sizeof(buf), "&#%d;", val);
- else
- snprintf(buf, sizeof(buf), "&#x%X;", val);
- buf[sizeof(buf) - 1] = 0;
- ptr = buf;
- while (*ptr != 0) *out++ = *ptr++;
- cur += l;
- continue;
- }
- } else if (IS_CHAR(*cur)) {
- char buf[10], *ptr;
-
- snprintf(buf, sizeof(buf), "&#%d;", *cur);
- buf[sizeof(buf) - 1] = 0;
- ptr = buf;
- while (*ptr != 0) *out++ = *ptr++;
- }
-#if 0
- else {
- /*
- * default case, this is not a valid char !
- * Skip it...
- */
- xmlGenericError(xmlGenericErrorContext,
- "xmlEncodeEntities: invalid char %d\n", (int) *cur);
- }
-#endif
- cur++;
- }
- *out++ = 0;
- return(buffer);
-}
-
-/**
- * xmlEncodeSpecialChars:
- * @doc: the document containing the string
- * @input: A string to convert to XML.
- *
- * Do a global encoding of a string, replacing the predefined entities
- * this routine is reentrant, and result must be deallocated.
- *
- * Returns A newly allocated string with the substitution done.
- */
-xmlChar *
-xmlEncodeSpecialChars(xmlDocPtr doc, const xmlChar *input) {
- const xmlChar *cur = input;
- xmlChar *buffer = NULL;
- xmlChar *out = NULL;
- int buffer_size = 0;
- int html = 0;
-
- if (input == NULL) return(NULL);
- if (doc != NULL)
- html = (doc->type == XML_HTML_DOCUMENT_NODE);
-
- /*
- * allocate an translation buffer.
- */
- buffer_size = 1000;
- buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
- if (buffer == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc failed\n");
- return(NULL);
- }
- out = buffer;
-
- while (*cur != '\0') {
- if (out - buffer > buffer_size - 10) {
- int indx = out - buffer;
-
- growBufferReentrant();
- out = &buffer[indx];
- }
-
- /*
- * By default one have to encode at least '<', '>', '"' and '&' !
- */
- if (*cur == '<') {
- *out++ = '&';
- *out++ = 'l';
- *out++ = 't';
- *out++ = ';';
- } else if (*cur == '>') {
- *out++ = '&';
- *out++ = 'g';
- *out++ = 't';
- *out++ = ';';
- } else if (*cur == '&') {
- *out++ = '&';
- *out++ = 'a';
- *out++ = 'm';
- *out++ = 'p';
- *out++ = ';';
- } else if (*cur == '"') {
- *out++ = '&';
- *out++ = 'q';
- *out++ = 'u';
- *out++ = 'o';
- *out++ = 't';
- *out++ = ';';
- } else {
- /*
- * Works because on UTF-8, all extended sequences cannot
- * result in bytes in the ASCII range.
- */
- *out++ = *cur;
- }
- cur++;
- }
- *out++ = 0;
- return(buffer);
-}
-
-/**
- * xmlCreateEntitiesTable:
- *
- * create and initialize an empty entities hash table.
- *
- * Returns the xmlEntitiesTablePtr just created or NULL in case of error.
- */
-xmlEntitiesTablePtr
-xmlCreateEntitiesTable(void) {
- return((xmlEntitiesTablePtr) xmlHashCreate(0));
-}
-
-/**
- * xmlFreeEntitiesTable:
- * @table: An entity table
- *
- * Deallocate the memory used by an entities hash table.
- */
-void
-xmlFreeEntitiesTable(xmlEntitiesTablePtr table) {
- xmlHashFree(table, (xmlHashDeallocator) xmlFreeEntity);
-}
-
-/**
- * xmlCopyEntity:
- * @ent: An entity
- *
- * Build a copy of an entity
- *
- * Returns the new xmlEntitiesPtr or NULL in case of error.
- */
-static xmlEntityPtr
-xmlCopyEntity(xmlEntityPtr ent) {
- xmlEntityPtr cur;
-
- cur = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlCopyEntity: out of memory !\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlEntity));
- cur->type = XML_ENTITY_DECL;
-
- cur->etype = ent->etype;
- if (ent->name != NULL)
- cur->name = xmlStrdup(ent->name);
- if (ent->ExternalID != NULL)
- cur->ExternalID = xmlStrdup(ent->ExternalID);
- if (ent->SystemID != NULL)
- cur->SystemID = xmlStrdup(ent->SystemID);
- if (ent->content != NULL)
- cur->content = xmlStrdup(ent->content);
- if (ent->orig != NULL)
- cur->orig = xmlStrdup(ent->orig);
- if (ent->URI != NULL)
- cur->URI = xmlStrdup(ent->URI);
- return(cur);
-}
-
-/**
- * xmlCopyEntitiesTable:
- * @table: An entity table
- *
- * Build a copy of an entity table.
- *
- * Returns the new xmlEntitiesTablePtr or NULL in case of error.
- */
-xmlEntitiesTablePtr
-xmlCopyEntitiesTable(xmlEntitiesTablePtr table) {
- return(xmlHashCopy(table, (xmlHashCopier) xmlCopyEntity));
-}
-
-/**
- * xmlDumpEntityDecl:
- * @buf: An XML buffer.
- * @ent: An entity table
- *
- * This will dump the content of the entity table as an XML DTD definition
- */
-void
-xmlDumpEntityDecl(xmlBufferPtr buf, xmlEntityPtr ent) {
- switch (ent->etype) {
- case XML_INTERNAL_GENERAL_ENTITY:
- xmlBufferWriteChar(buf, "<!ENTITY ");
- xmlBufferWriteCHAR(buf, ent->name);
- xmlBufferWriteChar(buf, " ");
- if (ent->orig != NULL)
- xmlBufferWriteQuotedString(buf, ent->orig);
- else
- xmlBufferWriteQuotedString(buf, ent->content);
- xmlBufferWriteChar(buf, ">\n");
- break;
- case XML_EXTERNAL_GENERAL_PARSED_ENTITY:
- xmlBufferWriteChar(buf, "<!ENTITY ");
- xmlBufferWriteCHAR(buf, ent->name);
- if (ent->ExternalID != NULL) {
- xmlBufferWriteChar(buf, " PUBLIC ");
- xmlBufferWriteQuotedString(buf, ent->ExternalID);
- xmlBufferWriteChar(buf, " ");
- xmlBufferWriteQuotedString(buf, ent->SystemID);
- } else {
- xmlBufferWriteChar(buf, " SYSTEM ");
- xmlBufferWriteQuotedString(buf, ent->SystemID);
- }
- xmlBufferWriteChar(buf, ">\n");
- break;
- case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY:
- xmlBufferWriteChar(buf, "<!ENTITY ");
- xmlBufferWriteCHAR(buf, ent->name);
- if (ent->ExternalID != NULL) {
- xmlBufferWriteChar(buf, " PUBLIC ");
- xmlBufferWriteQuotedString(buf, ent->ExternalID);
- xmlBufferWriteChar(buf, " ");
- xmlBufferWriteQuotedString(buf, ent->SystemID);
- } else {
- xmlBufferWriteChar(buf, " SYSTEM ");
- xmlBufferWriteQuotedString(buf, ent->SystemID);
- }
- if (ent->content != NULL) { /* Should be true ! */
- xmlBufferWriteChar(buf, " NDATA ");
- if (ent->orig != NULL)
- xmlBufferWriteCHAR(buf, ent->orig);
- else
- xmlBufferWriteCHAR(buf, ent->content);
- }
- xmlBufferWriteChar(buf, ">\n");
- break;
- case XML_INTERNAL_PARAMETER_ENTITY:
- xmlBufferWriteChar(buf, "<!ENTITY % ");
- xmlBufferWriteCHAR(buf, ent->name);
- xmlBufferWriteChar(buf, " ");
- if (ent->orig == NULL)
- xmlBufferWriteQuotedString(buf, ent->content);
- else
- xmlBufferWriteQuotedString(buf, ent->orig);
- xmlBufferWriteChar(buf, ">\n");
- break;
- case XML_EXTERNAL_PARAMETER_ENTITY:
- xmlBufferWriteChar(buf, "<!ENTITY % ");
- xmlBufferWriteCHAR(buf, ent->name);
- if (ent->ExternalID != NULL) {
- xmlBufferWriteChar(buf, " PUBLIC ");
- xmlBufferWriteQuotedString(buf, ent->ExternalID);
- xmlBufferWriteChar(buf, " ");
- xmlBufferWriteQuotedString(buf, ent->SystemID);
- } else {
- xmlBufferWriteChar(buf, " SYSTEM ");
- xmlBufferWriteQuotedString(buf, ent->SystemID);
- }
- xmlBufferWriteChar(buf, ">\n");
- break;
- default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlDumpEntitiesDecl: internal: unknown type %d\n",
- ent->etype);
- }
-}
-
-/**
- * xmlDumpEntitiesTable:
- * @buf: An XML buffer.
- * @table: An entity table
- *
- * This will dump the content of the entity table as an XML DTD definition
- */
-void
-xmlDumpEntitiesTable(xmlBufferPtr buf, xmlEntitiesTablePtr table) {
- xmlHashScan(table, (xmlHashScanner)xmlDumpEntityDecl, buf);
-}
diff --git a/bundle/libxml/error.c b/bundle/libxml/error.c
deleted file mode 100644
index d6266af051..0000000000
--- a/bundle/libxml/error.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * error.c: module displaying/handling XML parser errors
- *
- * See Copyright for the status of this software.
- *
- * Daniel Veillard <daniel@veillard.com>
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#include <stdarg.h>
-#include <libxml/parser.h>
-#include <libxml/xmlerror.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/globals.h>
-
-void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
- const char *msg,
- ...);
-
-#define XML_GET_VAR_STR(msg, str) { \
- int size; \
- int chars; \
- char *larger; \
- va_list ap; \
- \
- str = (char *) xmlMalloc(150); \
- if (str == NULL) \
- return; \
- \
- size = 150; \
- \
- while (1) { \
- va_start(ap, msg); \
- chars = vsnprintf(str, size, msg, ap); \
- va_end(ap); \
- if ((chars > -1) && (chars < size)) \
- break; \
- if (chars > -1) \
- size += chars + 1; \
- else \
- size += 100; \
- if ((larger = (char *) xmlRealloc(str, size)) == NULL) {\
- xmlFree(str); \
- return; \
- } \
- str = larger; \
- } \
-}
-
-/************************************************************************
- * *
- * Handling of out of context errors *
- * *
- ************************************************************************/
-
-/**
- * xmlGenericErrorDefaultFunc:
- * @ctx: an error context
- * @msg: the message to display/transmit
- * @...: extra parameters for the message display
- *
- * Default handler for out of context error messages.
- */
-void
-xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
- va_list args;
-
- if (xmlGenericErrorContext == NULL)
- xmlGenericErrorContext = (void *) stderr;
-
- va_start(args, msg);
- vfprintf((FILE *)xmlGenericErrorContext, msg, args);
- va_end(args);
-}
-
-/**
- * initGenericErrorDefaultFunc:
- * @handler: the handler
- *
- * Set or reset (if NULL) the default handler for generic errors
- */
-void
-initGenericErrorDefaultFunc(xmlGenericErrorFunc * handler)
-{
- if (handler == NULL)
- xmlGenericError = xmlGenericErrorDefaultFunc;
- else
- (*handler) = xmlGenericErrorDefaultFunc;
-}
-
-/**
- * xmlSetGenericErrorFunc:
- * @ctx: the new error handling context
- * @handler: the new handler function
- *
- * Function to reset the handler and the error context for out of
- * context error messages.
- * This simply means that @handler will be called for subsequent
- * error messages while not parsing nor validating. And @ctx will
- * be passed as first argument to @handler
- * One can simply force messages to be emitted to another FILE * than
- * stderr by setting @ctx to this file handle and @handler to NULL.
- */
-void
-xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
- xmlGenericErrorContext = ctx;
- if (handler != NULL)
- xmlGenericError = handler;
- else
- xmlGenericError = xmlGenericErrorDefaultFunc;
-}
-
-/************************************************************************
- * *
- * Handling of parsing errors *
- * *
- ************************************************************************/
-
-/**
- * xmlParserPrintFileInfo:
- * @input: an xmlParserInputPtr input
- *
- * Displays the associated file and line informations for the current input
- */
-
-void
-xmlParserPrintFileInfo(xmlParserInputPtr input) {
- if (input != NULL) {
- if (input->filename)
- xmlGenericError(xmlGenericErrorContext,
- "%s:%d: ", input->filename,
- input->line);
- else
- xmlGenericError(xmlGenericErrorContext,
- "Entity: line %d: ", input->line);
- }
-}
-
-/**
- * xmlParserPrintFileContext:
- * @input: an xmlParserInputPtr input
- *
- * Displays current context within the input content for error tracking
- */
-
-void
-xmlParserPrintFileContext(xmlParserInputPtr input) {
- const xmlChar *cur, *base;
- int n;
- xmlChar content[81];
- xmlChar *ctnt;
-
- if (input == NULL) return;
- cur = input->cur;
- base = input->base;
- /* skip backwards over any end-of-lines */
- while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) {
- cur--;
- }
- n = 0;
- /* search backwards for beginning-of-line maximum 80 characters */
- while ((n++ < 80) && (cur > base) && (*cur != '\n') && (*cur != '\r'))
- cur--;
- if ((*cur == '\n') || (*cur == '\r')) cur++;
- /* search forward for end-of-line maximum 80 characters */
- n = 0;
- ctnt = content;
- while ((*cur != 0) && (*cur != '\n') && (*cur != '\r') && (n < 79)) {
- *ctnt++ = *cur++;
- n++;
- }
- *ctnt = 0;
- xmlGenericError(xmlGenericErrorContext,"%s\n", content);
- /* create blank line with problem pointer */
- cur = input->cur;
- while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) {
- cur--;
- }
- n = 0;
- ctnt = content;
- while ((n++ < 79) && (cur > base) && (*cur != '\n') && (*cur != '\r')) {
- *ctnt++ = ' ';
- cur--;
- }
- if (ctnt > content) {
- *(--ctnt) = '^';
- *(++ctnt) = 0;
- } else {
- *ctnt = '^';
- *(++ctnt) = 0;
- }
- xmlGenericError(xmlGenericErrorContext,"%s\n", content);
-}
-
-#if 0
-/**
- * xmlGetVarStr:
- * @msg: the message format
- * @args: a va_list argument list
- *
- * SGS contribution
- * Get an arbitrary-sized string for an error argument
- * The caller must free() the returned string
- */
-static char *
-xmlGetVarStr(const char * msg, va_list args) {
- int size;
- int length;
- int chars, left;
- char *str, *larger;
- va_list ap;
-
- str = (char *) xmlMalloc(150);
- if (str == NULL)
- return(NULL);
-
- size = 150;
- length = 0;
-
- while (1) {
- left = size - length;
- /* Try to print in the allocated space. */
- va_start(msg, ap);
- chars = vsnprintf(str + length, left, msg, ap);
- va_end(ap);
- /* If that worked, we're done. */
- if ((chars > -1) && (chars < left ))
- break;
- /* Else try again with more space. */
- if (chars > -1) /* glibc 2.1 */
- size += chars + 1; /* precisely what is needed */
- else /* glibc 2.0 */
- size += 100;
- if ((larger = (char *) xmlRealloc(str, size)) == NULL) {
- xmlFree(str);
- return(NULL);
- }
- str = larger;
- }
- return(str);
-}
-#endif
-
-/**
- * xmlParserError:
- * @ctx: an XML parser context
- * @msg: the message to display/transmit
- * @...: extra parameters for the message display
- *
- * Display and format an error messages, gives file, line, position and
- * extra parameters.
- */
-void
-xmlParserError(void *ctx, const char *msg, ...)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlParserInputPtr input = NULL;
- xmlParserInputPtr cur = NULL;
- char * str;
-
- if (ctxt != NULL) {
- input = ctxt->input;
- if ((input != NULL) && (input->filename == NULL) &&
- (ctxt->inputNr > 1)) {
- cur = input;
- input = ctxt->inputTab[ctxt->inputNr - 2];
- }
- xmlParserPrintFileInfo(input);
- }
-
- xmlGenericError(xmlGenericErrorContext, "error: ");
- XML_GET_VAR_STR(msg, str);
- xmlGenericError(xmlGenericErrorContext, "%s", str);
- if (str != NULL)
- xmlFree(str);
-
- if (ctxt != NULL) {
- xmlParserPrintFileContext(input);
- if (cur != NULL) {
- xmlParserPrintFileInfo(cur);
- xmlGenericError(xmlGenericErrorContext, "\n");
- xmlParserPrintFileContext(cur);
- }
- }
-}
-
-/**
- * xmlParserWarning:
- * @ctx: an XML parser context
- * @msg: the message to display/transmit
- * @...: extra parameters for the message display
- *
- * Display and format a warning messages, gives file, line, position and
- * extra parameters.
- */
-void
-xmlParserWarning(void *ctx, const char *msg, ...)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlParserInputPtr input = NULL;
- xmlParserInputPtr cur = NULL;
- char * str;
-
- if (ctxt != NULL) {
- input = ctxt->input;
- if ((input != NULL) && (input->filename == NULL) &&
- (ctxt->inputNr > 1)) {
- cur = input;
- input = ctxt->inputTab[ctxt->inputNr - 2];
- }
- xmlParserPrintFileInfo(input);
- }
-
- xmlGenericError(xmlGenericErrorContext, "warning: ");
- XML_GET_VAR_STR(msg, str);
- xmlGenericError(xmlGenericErrorContext, "%s", str);
- if (str != NULL)
- xmlFree(str);
-
- if (ctxt != NULL) {
- xmlParserPrintFileContext(input);
- if (cur != NULL) {
- xmlParserPrintFileInfo(cur);
- xmlGenericError(xmlGenericErrorContext, "\n");
- xmlParserPrintFileContext(cur);
- }
- }
-}
-
-/************************************************************************
- * *
- * Handling of validation errors *
- * *
- ************************************************************************/
-
-/**
- * xmlParserValidityError:
- * @ctx: an XML parser context
- * @msg: the message to display/transmit
- * @...: extra parameters for the message display
- *
- * Display and format an validity error messages, gives file,
- * line, position and extra parameters.
- */
-void
-xmlParserValidityError(void *ctx, const char *msg, ...)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlParserInputPtr input = NULL;
- char * str;
- int len = xmlStrlen((const xmlChar *) msg);
- static int had_info = 0;
- int need_context = 0;
-
- if ((len > 1) && (msg[len - 2] != ':')) {
- if (ctxt != NULL) {
- input = ctxt->input;
- if ((input->filename == NULL) && (ctxt->inputNr > 1))
- input = ctxt->inputTab[ctxt->inputNr - 2];
-
- if (had_info == 0) {
- xmlParserPrintFileInfo(input);
- }
- }
- xmlGenericError(xmlGenericErrorContext, "validity error: ");
- need_context = 1;
- had_info = 0;
- } else {
- had_info = 1;
- }
-
- XML_GET_VAR_STR(msg, str);
- xmlGenericError(xmlGenericErrorContext, "%s", str);
- if (str != NULL)
- xmlFree(str);
-
- if ((ctxt != NULL) && (input != NULL)) {
- xmlParserPrintFileContext(input);
- }
-}
-
-/**
- * xmlParserValidityWarning:
- * @ctx: an XML parser context
- * @msg: the message to display/transmit
- * @...: extra parameters for the message display
- *
- * Display and format a validity warning messages, gives file, line,
- * position and extra parameters.
- */
-void
-xmlParserValidityWarning(void *ctx, const char *msg, ...)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlParserInputPtr input = NULL;
- char * str;
- int len = xmlStrlen((const xmlChar *) msg);
-
- if ((ctxt != NULL) && (len != 0) && (msg[len - 1] != ':')) {
- input = ctxt->input;
- if ((input->filename == NULL) && (ctxt->inputNr > 1))
- input = ctxt->inputTab[ctxt->inputNr - 2];
-
- xmlParserPrintFileInfo(input);
- }
-
- xmlGenericError(xmlGenericErrorContext, "validity warning: ");
- XML_GET_VAR_STR(msg, str);
- xmlGenericError(xmlGenericErrorContext, "%s", str);
- if (str != NULL)
- xmlFree(str);
-
- if (ctxt != NULL) {
- xmlParserPrintFileContext(input);
- }
-}
-
-
diff --git a/bundle/libxml/globals.c b/bundle/libxml/globals.c
deleted file mode 100644
index 72865c323a..0000000000
--- a/bundle/libxml/globals.c
+++ /dev/null
@@ -1,653 +0,0 @@
-/*
- * globals.c: definition and handling of the set of global variables
- * of the library
- *
- * The bottom of this file is automatically generated by build_glob.py
- * based on the description file global.data
- *
- * See Copyright for the status of this software.
- *
- * Gary Pennington <Gary.Pennington@uk.sun.com>
- * daniel@veillard.com
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include <string.h>
-
-#include <libxml/globals.h>
-#include <libxml/xmlmemory.h>
-
-/* #define DEBUG_GLOBALS */
-
-/*
- * Helpful Macro
- */
-#ifdef LIBXML_THREAD_ENABLED
-#define IS_MAIN_THREAD (xmlIsMainThread())
-#else
-#define IS_MAIN_THREAD 1
-#endif
-
-/************************************************************************
- * *
- * All the user accessible global variables of the library *
- * *
- ************************************************************************/
-
-/*
- * Memory allocation routines
- */
-#if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
-extern void xmlMemFree(void *ptr);
-extern void * xmlMemMalloc(size_t size);
-extern void * xmlMemRealloc(void *ptr,size_t size);
-extern char * xmlMemoryStrdup(const char *str);
-
-xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
-xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
-xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
-xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
-#else
-/**
- * xmlFree:
- * @mem: an already allocated block of memory
- *
- * The variable holding the libxml free() implementation
- */
-xmlFreeFunc xmlFree = (xmlFreeFunc) free;
-/**
- * xmlMalloc:
- * @size: the size requested in bytes
- *
- * The variable holding the libxml malloc() implementation
- *
- * Returns a pointer to the newly allocated block or NULL in case of error
- */
-xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
-/**
- * xmlRealloc:
- * @mem: an already allocated block of memory
- * @size: the new size requested in bytes
- *
- * The variable holding the libxml realloc() implementation
- *
- * Returns a pointer to the newly reallocated block or NULL in case of error
- */
-xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
-/**
- * xmlMemStrdup:
- * @str: a zero terminated string
- *
- * The variable holding the libxml strdup() implementation
- *
- * Returns the copy of the string or NULL in case of error
- */
-xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
-#endif
-
-#include <libxml/threads.h>
-#include <libxml/globals.h>
-#include <libxml/SAX.h>
-
-#undef docbDefaultSAXHandler
-#undef htmlDefaultSAXHandler
-#undef oldXMLWDcompatibility
-#undef xmlBufferAllocScheme
-#undef xmlDefaultBufferSize
-#undef xmlDefaultSAXHandler
-#undef xmlDefaultSAXLocator
-#undef xmlDoValidityCheckingDefaultValue
-#undef xmlGenericError
-#undef xmlGenericErrorContext
-#undef xmlGetWarningsDefaultValue
-#undef xmlIndentTreeOutput
-#undef xmlTreeIndentString
-#undef xmlKeepBlanksDefaultValue
-#undef xmlLineNumbersDefaultValue
-#undef xmlLoadExtDtdDefaultValue
-#undef xmlParserDebugEntities
-#undef xmlParserVersion
-#undef xmlPedanticParserDefaultValue
-#undef xmlSaveNoEmptyTags
-#undef xmlSubstituteEntitiesDefaultValue
-
-#undef xmlFree
-#undef xmlMalloc
-#undef xmlMemStrdup
-#undef xmlRealloc
-
-/**
- * xmlParserVersion:
- *
- * Constant string describing the internal version of the library
- */
-const char *xmlParserVersion = LIBXML_VERSION_STRING;
-
-/**
- * xmlBufferAllocScheme:
- *
- * Global setting, default allocation policy for buffers, default is
- * XML_BUFFER_ALLOC_EXACT
- */
-xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
-/**
- * xmlDefaultBufferSize:
- *
- * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
- */
-int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
-
-/*
- * Parser defaults
- */
-
-/**
- * oldXMLWDcompatibility:
- *
- * Global setting, DEPRECATED.
- */
-int oldXMLWDcompatibility = 0; /* DEPRECATED */
-/**
- * xmlParserDebugEntities:
- *
- * Global setting, asking the parser to print out debugging informations.
- * while handling entities.
- * Disabled by default
- */
-int xmlParserDebugEntities = 0;
-/**
- * xmlDoValidityCheckingDefaultValue:
- *
- * Global setting, indicate that the parser should work in validating mode.
- * Disabled by default.
- */
-int xmlDoValidityCheckingDefaultValue = 0;
-/**
- * xmlGetWarningsDefaultValue:
- *
- * Global setting, indicate that the parser should provide warnings.
- * Activated by default.
- */
-int xmlGetWarningsDefaultValue = 1;
-/**
- * xmlLoadExtDtdDefaultValue:
- *
- * Global setting, indicate that the parser should load DTD while not
- * validating.
- * Disabled by default.
- */
-int xmlLoadExtDtdDefaultValue = 0;
-/**
- * xmlPedanticParserDefaultValue:
- *
- * Global setting, indicate that the parser be pedantic
- * Disabled by default.
- */
-int xmlPedanticParserDefaultValue = 0;
-/**
- * xmlLineNumbersDefaultValue:
- *
- * Global setting, indicate that the parser should store the line number
- * in the content field of elements in the DOM tree.
- * Disabled by default since this may not be safe for old classes of
- * applicaton.
- */
-int xmlLineNumbersDefaultValue = 0;
-/**
- * xmlKeepBlanksDefaultValue:
- *
- * Global setting, indicate that the parser should keep all blanks
- * nodes found in the content
- * Activated by default, this is actually needed to have the parser
- * conformant to the XML Recommendation, however the option is kept
- * for some applications since this was libxml1 default behaviour.
- */
-int xmlKeepBlanksDefaultValue = 1;
-/**
- * xmlSubstituteEntitiesDefaultValue:
- *
- * Global setting, indicate that the parser should not generate entity
- * references but replace them with the actual content of the entity
- * Disabled by default, this should be activated when using XPath since
- * the XPath data model requires entities replacement and the XPath
- * engine does not handle entities references transparently.
- */
-int xmlSubstituteEntitiesDefaultValue = 0;
-
-/*
- * Error handling
- */
-
-/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
-/* Must initialize xmlGenericError in xmlInitParser */
-void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
- const char *msg,
- ...);
-/**
- * xmlGenericError:
- *
- * Global setting: function used for generic error callbacks
- */
-xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
-/**
- * xmlGenericErrorContext:
- *
- * Global setting passed to generic error callbacks
- */
-void *xmlGenericErrorContext = NULL;
-
-/*
- * output defaults
- */
-/**
- * xmlIndentTreeOutput:
- *
- * Global setting, asking the serializer to indent the output tree by default
- * Enabled by default
- */
-int xmlIndentTreeOutput = 1;
-
-/**
- * xmlTreeIndentString:
- *
- * The string used to do one-level indent. By default is equal to " " (two spaces)
- */
-const char *xmlTreeIndentString = " ";
-
-/**
- * xmlSaveNoEmptyTags:
- *
- * Global setting, asking the serializer to not output empty tags
- * as <empty/> but <empty></empty>. those two forms are undistinguishable
- * once parsed.
- * Disabled by default
- */
-int xmlSaveNoEmptyTags = 0;
-
-/**
- * xmlDefaultSAXHandler:
- *
- * Default handler for XML, builds the DOM tree
- */
-xmlSAXHandler xmlDefaultSAXHandler = {
- internalSubset,
- isStandalone,
- hasInternalSubset,
- hasExternalSubset,
- resolveEntity,
- getEntity,
- entityDecl,
- notationDecl,
- attributeDecl,
- elementDecl,
- unparsedEntityDecl,
- setDocumentLocator,
- startDocument,
- endDocument,
- startElement,
- endElement,
- reference,
- characters,
- characters,
- processingInstruction,
- comment,
- xmlParserWarning,
- xmlParserError,
- xmlParserError,
- getParameterEntity,
- cdataBlock,
- externalSubset,
- 0
-};
-
-/**
- * xmlDefaultSAXLocator:
- *
- * The default SAX Locator
- * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
- */
-xmlSAXLocator xmlDefaultSAXLocator = {
- getPublicId, getSystemId, getLineNumber, getColumnNumber
-};
-
-#ifdef LIBXML_HTML_ENABLED
-/**
- * htmlDefaultSAXHandler:
- *
- * Default handler for HTML, builds the DOM tree
- */
-xmlSAXHandler htmlDefaultSAXHandler = {
- internalSubset,
- NULL,
- NULL,
- NULL,
- NULL,
- getEntity,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- setDocumentLocator,
- startDocument,
- endDocument,
- startElement,
- endElement,
- NULL,
- characters,
- ignorableWhitespace,
- NULL,
- comment,
- xmlParserWarning,
- xmlParserError,
- xmlParserError,
- getParameterEntity,
- cdataBlock,
- NULL,
- 0
-};
-#endif /* LIBXML_HTML_ENABLED */
-
-#ifdef LIBXML_DOCB_ENABLED
-/**
- * docbDefaultSAXHandler:
- *
- * Default handler for SGML DocBook, builds the DOM tree
- */
-xmlSAXHandler docbDefaultSAXHandler = {
- internalSubset,
- isStandalone,
- hasInternalSubset,
- hasExternalSubset,
- resolveEntity,
- getEntity,
- entityDecl,
- NULL,
- NULL,
- NULL,
- NULL,
- setDocumentLocator,
- startDocument,
- endDocument,
- startElement,
- endElement,
- reference,
- characters,
- ignorableWhitespace,
- NULL,
- comment,
- xmlParserWarning,
- xmlParserError,
- xmlParserError,
- getParameterEntity,
- NULL,
- NULL,
- 0
-};
-#endif /* LIBXML_DOCB_ENABLED */
-
-/**
- * xmlInitializeGlobalState:
- * @gs: a pointer to a newly allocated global state
- *
- * xmlInitializeGlobalState() initialize a global state with all the
- * default values of the library.
- */
-void
-xmlInitializeGlobalState(xmlGlobalStatePtr gs)
-{
-#ifdef DEBUG_GLOBALS
- fprintf(stderr, "Initializing globals at %lu for thread %d\n",
- (unsigned long) gs, xmlGetThreadId());
-#endif
-
- /*
- * Perform initialization as required by libxml
- */
-
-#ifdef LIBXML_DOCB_ENABLED
- initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
-#endif
-#ifdef LIBXML_HTML_ENABLED
- inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
-#endif
- initGenericErrorDefaultFunc(&gs->xmlGenericError);
-
- gs->oldXMLWDcompatibility = 0;
- gs->xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
- gs->xmlDefaultBufferSize = BASE_BUFFER_SIZE;
- initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
- gs->xmlDefaultSAXLocator.getPublicId = getPublicId;
- gs->xmlDefaultSAXLocator.getSystemId = getSystemId;
- gs->xmlDefaultSAXLocator.getLineNumber = getLineNumber;
- gs->xmlDefaultSAXLocator.getColumnNumber = getColumnNumber;
- gs->xmlDoValidityCheckingDefaultValue = 0;
-#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
- gs->xmlFree = (xmlFreeFunc) xmlMemFree;
- gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
- gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
- gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
-#else
- gs->xmlFree = (xmlFreeFunc) free;
- gs->xmlMalloc = (xmlMallocFunc) malloc;
- gs->xmlRealloc = (xmlReallocFunc) realloc;
- gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
-#endif
- gs->xmlGenericErrorContext = NULL;
- gs->xmlGetWarningsDefaultValue = 1;
- gs->xmlIndentTreeOutput = 1;
- gs->xmlTreeIndentString = " ";
- gs->xmlKeepBlanksDefaultValue = 1;
- gs->xmlLineNumbersDefaultValue = 0;
- gs->xmlLoadExtDtdDefaultValue = 0;
- gs->xmlParserDebugEntities = 0;
- gs->xmlParserVersion = LIBXML_VERSION_STRING;
- gs->xmlPedanticParserDefaultValue = 0;
- gs->xmlSaveNoEmptyTags = 0;
- gs->xmlSubstituteEntitiesDefaultValue = 0;
-}
-
-#ifdef LIBXML_DOCB_ENABLED
-#undef docbDefaultSAXHandler
-xmlSAXHandler *
-__docbDefaultSAXHandler(void) {
- if (IS_MAIN_THREAD)
- return (&docbDefaultSAXHandler);
- else
- return (&xmlGetGlobalState()->docbDefaultSAXHandler);
-}
-#endif
-
-#ifdef LIBXML_HTML_ENABLED
-#undef htmlDefaultSAXHandler
-xmlSAXHandler *
-__htmlDefaultSAXHandler(void) {
- if (IS_MAIN_THREAD)
- return (&htmlDefaultSAXHandler);
- else
- return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
-}
-#endif
-
-/*
- * Everything starting from the line below is
- * Automatically generated by build_glob.py.
- * Do not modify the previous line.
- */
-
-
-#undef oldXMLWDcompatibility
-int *
-__oldXMLWDcompatibility(void) {
- if (IS_MAIN_THREAD)
- return (&oldXMLWDcompatibility);
- else
- return (&xmlGetGlobalState()->oldXMLWDcompatibility);
-}
-
-#undef xmlBufferAllocScheme
-xmlBufferAllocationScheme *
-__xmlBufferAllocScheme(void) {
- if (IS_MAIN_THREAD)
- return (&xmlBufferAllocScheme);
- else
- return (&xmlGetGlobalState()->xmlBufferAllocScheme);
-}
-
-#undef xmlDefaultBufferSize
-int *
-__xmlDefaultBufferSize(void) {
- if (IS_MAIN_THREAD)
- return (&xmlDefaultBufferSize);
- else
- return (&xmlGetGlobalState()->xmlDefaultBufferSize);
-}
-
-#undef xmlDefaultSAXHandler
-xmlSAXHandler *
-__xmlDefaultSAXHandler(void) {
- if (IS_MAIN_THREAD)
- return (&xmlDefaultSAXHandler);
- else
- return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
-}
-
-#undef xmlDefaultSAXLocator
-xmlSAXLocator *
-__xmlDefaultSAXLocator(void) {
- if (IS_MAIN_THREAD)
- return (&xmlDefaultSAXLocator);
- else
- return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
-}
-
-#undef xmlDoValidityCheckingDefaultValue
-int *
-__xmlDoValidityCheckingDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlDoValidityCheckingDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
-}
-
-#undef xmlGenericError
-xmlGenericErrorFunc *
-__xmlGenericError(void) {
- if (IS_MAIN_THREAD)
- return (&xmlGenericError);
- else
- return (&xmlGetGlobalState()->xmlGenericError);
-}
-
-#undef xmlGenericErrorContext
-void * *
-__xmlGenericErrorContext(void) {
- if (IS_MAIN_THREAD)
- return (&xmlGenericErrorContext);
- else
- return (&xmlGetGlobalState()->xmlGenericErrorContext);
-}
-
-#undef xmlGetWarningsDefaultValue
-int *
-__xmlGetWarningsDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlGetWarningsDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
-}
-
-#undef xmlIndentTreeOutput
-int *
-__xmlIndentTreeOutput(void) {
- if (IS_MAIN_THREAD)
- return (&xmlIndentTreeOutput);
- else
- return (&xmlGetGlobalState()->xmlIndentTreeOutput);
-}
-
-#undef xmlTreeIndentString
-const char * *
-__xmlTreeIndentString(void) {
- if (IS_MAIN_THREAD)
- return (&xmlTreeIndentString);
- else
- return (&xmlGetGlobalState()->xmlTreeIndentString);
-}
-
-#undef xmlKeepBlanksDefaultValue
-int *
-__xmlKeepBlanksDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlKeepBlanksDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
-}
-
-#undef xmlLineNumbersDefaultValue
-int *
-__xmlLineNumbersDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlLineNumbersDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
-}
-
-#undef xmlLoadExtDtdDefaultValue
-int *
-__xmlLoadExtDtdDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlLoadExtDtdDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
-}
-
-#undef xmlParserDebugEntities
-int *
-__xmlParserDebugEntities(void) {
- if (IS_MAIN_THREAD)
- return (&xmlParserDebugEntities);
- else
- return (&xmlGetGlobalState()->xmlParserDebugEntities);
-}
-
-#undef xmlParserVersion
-const char * *
-__xmlParserVersion(void) {
- if (IS_MAIN_THREAD)
- return (&xmlParserVersion);
- else
- return (&xmlGetGlobalState()->xmlParserVersion);
-}
-
-#undef xmlPedanticParserDefaultValue
-int *
-__xmlPedanticParserDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlPedanticParserDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
-}
-
-#undef xmlSaveNoEmptyTags
-int *
-__xmlSaveNoEmptyTags(void) {
- if (IS_MAIN_THREAD)
- return (&xmlSaveNoEmptyTags);
- else
- return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
-}
-
-#undef xmlSubstituteEntitiesDefaultValue
-int *
-__xmlSubstituteEntitiesDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlSubstituteEntitiesDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
-}
diff --git a/bundle/libxml/hash.c b/bundle/libxml/hash.c
deleted file mode 100644
index 2a4d000872..0000000000
--- a/bundle/libxml/hash.c
+++ /dev/null
@@ -1,822 +0,0 @@
-/*
- * hash.c: chained hash tables
- *
- * Reference: Your favorite introductory book on algorithms
- *
- * Copyright (C) 2000 Bjorn Reese and Daniel Veillard.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- * Author: breese@users.sourceforge.net
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#include <string.h>
-#include <libxml/hash.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-#include <libxml/xmlerror.h>
-#include <libxml/globals.h>
-
-#define MAX_HASH_LEN 8
-
-/* #define DEBUG_GROW */
-
-/*
- * A single entry in the hash table
- */
-typedef struct _xmlHashEntry xmlHashEntry;
-typedef xmlHashEntry *xmlHashEntryPtr;
-struct _xmlHashEntry {
- struct _xmlHashEntry *next;
- xmlChar *name;
- xmlChar *name2;
- xmlChar *name3;
- void *payload;
- int valid;
-};
-
-/*
- * The entire hash table
- */
-struct _xmlHashTable {
- struct _xmlHashEntry *table;
- int size;
- int nbElems;
-};
-
-/*
- * xmlHashComputeKey:
- * Calculate the hash key
- */
-static unsigned long
-xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name,
- const xmlChar *name2, const xmlChar *name3) {
- unsigned long value = 0L;
- char ch;
-
- if (name != NULL) {
- value += 30 * (*name);
- while ((ch = *name++) != 0) {
- value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
- }
- }
- if (name2 != NULL) {
- while ((ch = *name2++) != 0) {
- value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
- }
- }
- if (name3 != NULL) {
- while ((ch = *name3++) != 0) {
- value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
- }
- }
- return (value % table->size);
-}
-
-/**
- * xmlHashCreate:
- * @size: the size of the hash table
- *
- * Create a new xmlHashTablePtr.
- *
- * Returns the newly created object, or NULL if an error occured.
- */
-xmlHashTablePtr
-xmlHashCreate(int size) {
- xmlHashTablePtr table;
-
- if (size <= 0)
- size = 256;
-
- table = xmlMalloc(sizeof(xmlHashTable));
- if (table) {
- table->size = size;
- table->nbElems = 0;
- table->table = xmlMalloc(size * sizeof(xmlHashEntry));
- if (table->table) {
- memset(table->table, 0, size * sizeof(xmlHashEntry));
- return(table);
- }
- xmlFree(table);
- }
- return(NULL);
-}
-
-/**
- * xmlHashGrow:
- * @table: the hash table
- * @size: the new size of the hash table
- *
- * resize the hash table
- *
- * Returns 0 in case of success, -1 in case of failure
- */
-static int
-xmlHashGrow(xmlHashTablePtr table, int size) {
- unsigned long key;
- int oldsize, i;
- xmlHashEntryPtr iter, next;
- struct _xmlHashEntry *oldtable;
-#ifdef DEBUG_GROW
- unsigned long nbElem = 0;
-#endif
-
- if (table == NULL)
- return(-1);
- if (size < 8)
- return(-1);
- if (size > 8 * 2048)
- return(-1);
-
- oldsize = table->size;
- oldtable = table->table;
- if (oldtable == NULL)
- return(-1);
-
- table->table = xmlMalloc(size * sizeof(xmlHashEntry));
- if (table->table == NULL) {
- table->table = oldtable;
- return(-1);
- }
- memset(table->table, 0, size * sizeof(xmlHashEntry));
- table->size = size;
-
- /* If the two loops are merged, there would be situations where
- a new entry needs to allocated and data copied into it from
- the main table. So instead, we run through the array twice, first
- copying all the elements in the main array (where we can't get
- conflicts) and then the rest, so we only free (and don't allocate)
- */
- for (i = 0; i < oldsize; i++) {
- if (oldtable[i].valid == 0)
- continue;
- key = xmlHashComputeKey(table, oldtable[i].name, oldtable[i].name2,
- oldtable[i].name3);
- memcpy(&(table->table[key]), &(oldtable[i]), sizeof(xmlHashEntry));
- table->table[key].next = NULL;
- }
-
- for (i = 0; i < oldsize; i++) {
- iter = oldtable[i].next;
- while (iter) {
- next = iter->next;
-
- /*
- * put back the entry in the new table
- */
-
- key = xmlHashComputeKey(table, iter->name, iter->name2,
- iter->name3);
- if (table->table[key].valid == 0) {
- memcpy(&(table->table[key]), iter, sizeof(xmlHashEntry));
- table->table[key].next = NULL;
- xmlFree(iter);
- } else {
- iter->next = table->table[key].next;
- table->table[key].next = iter;
- }
-
-#ifdef DEBUG_GROW
- nbElem++;
-#endif
-
- iter = next;
- }
- }
-
- xmlFree(oldtable);
-
-#ifdef DEBUG_GROW
- xmlGenericError(xmlGenericErrorContext,
- "xmlHashGrow : from %d to %d, %d elems\n", oldsize, size, nbElem);
-#endif
-
- return(0);
-}
-
-/**
- * xmlHashFree:
- * @table: the hash table
- * @f: the deallocator function for items in the hash
- *
- * Free the hash @table and its contents. The userdata is
- * deallocated with @f if provided.
- */
-void
-xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) {
- int i;
- xmlHashEntryPtr iter;
- xmlHashEntryPtr next;
- int inside_table = 0;
-
- if (table == NULL)
- return;
- if (table->table) {
- for(i = 0; i < table->size; i++) {
- iter = &(table->table[i]);
- if (iter->valid == 0)
- continue;
- inside_table = 1;
- while (iter) {
- next = iter->next;
- if (f)
- f(iter->payload, iter->name);
- if (iter->name)
- xmlFree(iter->name);
- if (iter->name2)
- xmlFree(iter->name2);
- if (iter->name3)
- xmlFree(iter->name3);
- iter->payload = NULL;
- if (!inside_table)
- xmlFree(iter);
- inside_table = 0;
- iter = next;
- }
- inside_table = 0;
- }
- xmlFree(table->table);
- }
- xmlFree(table);
-}
-
-/**
- * xmlHashAddEntry:
- * @table: the hash table
- * @name: the name of the userdata
- * @userdata: a pointer to the userdata
- *
- * Add the @userdata to the hash @table. This can later be retrieved
- * by using the @name. Duplicate names generate errors.
- *
- * Returns 0 the addition succeeded and -1 in case of error.
- */
-int
-xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata) {
- return(xmlHashAddEntry3(table, name, NULL, NULL, userdata));
-}
-
-/**
- * xmlHashAddEntry2:
- * @table: the hash table
- * @name: the name of the userdata
- * @name2: a second name of the userdata
- * @userdata: a pointer to the userdata
- *
- * Add the @userdata to the hash @table. This can later be retrieved
- * by using the (@name, @name2) tuple. Duplicate tuples generate errors.
- *
- * Returns 0 the addition succeeded and -1 in case of error.
- */
-int
-xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name,
- const xmlChar *name2, void *userdata) {
- return(xmlHashAddEntry3(table, name, name2, NULL, userdata));
-}
-
-/**
- * xmlHashUpdateEntry:
- * @table: the hash table
- * @name: the name of the userdata
- * @userdata: a pointer to the userdata
- * @f: the deallocator function for replaced item (if any)
- *
- * Add the @userdata to the hash @table. This can later be retrieved
- * by using the @name. Existing entry for this @name will be removed
- * and freed with @f if found.
- *
- * Returns 0 the addition succeeded and -1 in case of error.
- */
-int
-xmlHashUpdateEntry(xmlHashTablePtr table, const xmlChar *name,
- void *userdata, xmlHashDeallocator f) {
- return(xmlHashUpdateEntry3(table, name, NULL, NULL, userdata, f));
-}
-
-/**
- * xmlHashUpdateEntry2:
- * @table: the hash table
- * @name: the name of the userdata
- * @name2: a second name of the userdata
- * @userdata: a pointer to the userdata
- * @f: the deallocator function for replaced item (if any)
- *
- * Add the @userdata to the hash @table. This can later be retrieved
- * by using the (@name, @name2) tuple. Existing entry for this tuple will
- * be removed and freed with @f if found.
- *
- * Returns 0 the addition succeeded and -1 in case of error.
- */
-int
-xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name,
- const xmlChar *name2, void *userdata,
- xmlHashDeallocator f) {
- return(xmlHashUpdateEntry3(table, name, name2, NULL, userdata, f));
-}
-
-/**
- * xmlHashLookup:
- * @table: the hash table
- * @name: the name of the userdata
- *
- * Find the userdata specified by the @name.
- *
- * Returns the pointer to the userdata
- */
-void *
-xmlHashLookup(xmlHashTablePtr table, const xmlChar *name) {
- return(xmlHashLookup3(table, name, NULL, NULL));
-}
-
-/**
- * xmlHashLookup2:
- * @table: the hash table
- * @name: the name of the userdata
- * @name2: a second name of the userdata
- *
- * Find the userdata specified by the (@name, @name2) tuple.
- *
- * Returns the pointer to the userdata
- */
-void *
-xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name,
- const xmlChar *name2) {
- return(xmlHashLookup3(table, name, name2, NULL));
-}
-
-/**
- * xmlHashAddEntry3:
- * @table: the hash table
- * @name: the name of the userdata
- * @name2: a second name of the userdata
- * @name3: a third name of the userdata
- * @userdata: a pointer to the userdata
- *
- * Add the @userdata to the hash @table. This can later be retrieved
- * by using the tuple (@name, @name2, @name3). Duplicate entries generate
- * errors.
- *
- * Returns 0 the addition succeeded and -1 in case of error.
- */
-int
-xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name,
- const xmlChar *name2, const xmlChar *name3,
- void *userdata) {
- unsigned long key, len = 0;
- xmlHashEntryPtr entry;
- xmlHashEntryPtr insert;
-
- if ((table == NULL) || name == NULL)
- return(-1);
-
- /*
- * Check for duplicate and insertion location.
- */
- key = xmlHashComputeKey(table, name, name2, name3);
- if (table->table[key].valid == 0) {
- insert = NULL;
- } else {
- for (insert = &(table->table[key]); insert->next != NULL;
- insert = insert->next) {
- if ((xmlStrEqual(insert->name, name)) &&
- (xmlStrEqual(insert->name2, name2)) &&
- (xmlStrEqual(insert->name3, name3)))
- return(-1);
- len++;
- }
- if ((xmlStrEqual(insert->name, name)) &&
- (xmlStrEqual(insert->name2, name2)) &&
- (xmlStrEqual(insert->name3, name3)))
- return(-1);
- }
-
- if (insert == NULL) {
- entry = &(table->table[key]);
- } else {
- entry = xmlMalloc(sizeof(xmlHashEntry));
- if (entry == NULL)
- return(-1);
- }
-
- entry->name = xmlStrdup(name);
- entry->name2 = xmlStrdup(name2);
- entry->name3 = xmlStrdup(name3);
- entry->payload = userdata;
- entry->next = NULL;
- entry->valid = 1;
-
-
- if (insert != NULL)
- insert->next = entry;
-
- table->nbElems++;
-
- if (len > MAX_HASH_LEN)
- xmlHashGrow(table, MAX_HASH_LEN * table->size);
-
- return(0);
-}
-
-/**
- * xmlHashUpdateEntry3:
- * @table: the hash table
- * @name: the name of the userdata
- * @name2: a second name of the userdata
- * @name3: a third name of the userdata
- * @userdata: a pointer to the userdata
- * @f: the deallocator function for replaced item (if any)
- *
- * Add the @userdata to the hash @table. This can later be retrieved
- * by using the tuple (@name, @name2, @name3). Existing entry for this tuple
- * will be removed and freed with @f if found.
- *
- * Returns 0 the addition succeeded and -1 in case of error.
- */
-int
-xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name,
- const xmlChar *name2, const xmlChar *name3,
- void *userdata, xmlHashDeallocator f) {
- unsigned long key;
- xmlHashEntryPtr entry;
- xmlHashEntryPtr insert;
-
- if ((table == NULL) || name == NULL)
- return(-1);
-
- /*
- * Check for duplicate and insertion location.
- */
- key = xmlHashComputeKey(table, name, name2, name3);
- if (table->table[key].valid == 0) {
- insert = NULL;
- } else {
- for (insert = &(table->table[key]); insert->next != NULL;
- insert = insert->next) {
- if ((xmlStrEqual(insert->name, name)) &&
- (xmlStrEqual(insert->name2, name2)) &&
- (xmlStrEqual(insert->name3, name3))) {
- if (f)
- f(insert->payload, insert->name);
- insert->payload = userdata;
- return(0);
- }
- }
- if ((xmlStrEqual(insert->name, name)) &&
- (xmlStrEqual(insert->name2, name2)) &&
- (xmlStrEqual(insert->name3, name3))) {
- if (f)
- f(insert->payload, insert->name);
- insert->payload = userdata;
- return(0);
- }
- }
-
- if (insert == NULL) {
- entry = &(table->table[key]);
- } else {
- entry = xmlMalloc(sizeof(xmlHashEntry));
- if (entry == NULL)
- return(-1);
- }
-
- entry->name = xmlStrdup(name);
- entry->name2 = xmlStrdup(name2);
- entry->name3 = xmlStrdup(name3);
- entry->payload = userdata;
- entry->next = NULL;
- entry->valid = 1;
- table->nbElems++;
-
-
- if (insert != NULL) {
- insert->next = entry;
- }
- return(0);
-}
-
-/**
- * xmlHashLookup3:
- * @table: the hash table
- * @name: the name of the userdata
- * @name2: a second name of the userdata
- * @name3: a third name of the userdata
- *
- * Find the userdata specified by the (@name, @name2, @name3) tuple.
- *
- * Returns the a pointer to the userdata
- */
-void *
-xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name,
- const xmlChar *name2, const xmlChar *name3) {
- unsigned long key;
- xmlHashEntryPtr entry;
-
- if (table == NULL)
- return(NULL);
- if (name == NULL)
- return(NULL);
- key = xmlHashComputeKey(table, name, name2, name3);
- if (table->table[key].valid == 0)
- return(NULL);
- for (entry = &(table->table[key]); entry != NULL; entry = entry->next) {
- if ((xmlStrEqual(entry->name, name)) &&
- (xmlStrEqual(entry->name2, name2)) &&
- (xmlStrEqual(entry->name3, name3)))
- return(entry->payload);
- }
- return(NULL);
-}
-
-typedef struct {
- xmlHashScanner hashscanner;
- void *data;
-} stubData;
-
-static void
-stubHashScannerFull (void *payload, void *data, const xmlChar *name,
- const xmlChar *name2 ATTRIBUTE_UNUSED,
- const xmlChar *name3 ATTRIBUTE_UNUSED) {
- stubData *stubdata = (stubData *) data;
- stubdata->hashscanner (payload, stubdata->data, (xmlChar *) name);
-}
-
-/**
- * xmlHashScan:
- * @table: the hash table
- * @f: the scanner function for items in the hash
- * @data: extra data passed to f
- *
- * Scan the hash @table and applied @f to each value.
- */
-void
-xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) {
- stubData stubdata;
- stubdata.data = data;
- stubdata.hashscanner = f;
- xmlHashScanFull (table, stubHashScannerFull, &stubdata);
-}
-
-/**
- * xmlHashScanFull:
- * @table: the hash table
- * @f: the scanner function for items in the hash
- * @data: extra data passed to f
- *
- * Scan the hash @table and applied @f to each value.
- */
-void
-xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) {
- int i;
- xmlHashEntryPtr iter;
- xmlHashEntryPtr next;
-
- if (table == NULL)
- return;
- if (f == NULL)
- return;
-
- if (table->table) {
- for(i = 0; i < table->size; i++) {
- if (table->table[i].valid == 0)
- continue;
- iter = &(table->table[i]);
- while (iter) {
- next = iter->next;
- if (f)
- f(iter->payload, data, iter->name,
- iter->name2, iter->name3);
- iter = next;
- }
- }
- }
-}
-
-/**
- * xmlHashScan3:
- * @table: the hash table
- * @name: the name of the userdata or NULL
- * @name2: a second name of the userdata or NULL
- * @name3: a third name of the userdata or NULL
- * @f: the scanner function for items in the hash
- * @data: extra data passed to f
- *
- * Scan the hash @table and applied @f to each value matching
- * (@name, @name2, @name3) tuple. If one of the names is null,
- * the comparison is considered to match.
- */
-void
-xmlHashScan3(xmlHashTablePtr table, const xmlChar *name,
- const xmlChar *name2, const xmlChar *name3,
- xmlHashScanner f, void *data) {
- xmlHashScanFull3 (table, name, name2, name3,
- (xmlHashScannerFull) f, data);
-}
-
-/**
- * xmlHashScanFull3:
- * @table: the hash table
- * @name: the name of the userdata or NULL
- * @name2: a second name of the userdata or NULL
- * @name3: a third name of the userdata or NULL
- * @f: the scanner function for items in the hash
- * @data: extra data passed to f
- *
- * Scan the hash @table and applied @f to each value matching
- * (@name, @name2, @name3) tuple. If one of the names is null,
- * the comparison is considered to match.
- */
-void
-xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name,
- const xmlChar *name2, const xmlChar *name3,
- xmlHashScannerFull f, void *data) {
- int i;
- xmlHashEntryPtr iter;
- xmlHashEntryPtr next;
-
- if (table == NULL)
- return;
- if (f == NULL)
- return;
-
- if (table->table) {
- for(i = 0; i < table->size; i++) {
- if (table->table[i].valid == 0)
- continue;
- iter = &(table->table[i]);
- while (iter) {
- next = iter->next;
- if (((name == NULL) || (xmlStrEqual(name, iter->name))) &&
- ((name2 == NULL) || (xmlStrEqual(name2, iter->name2))) &&
- ((name3 == NULL) || (xmlStrEqual(name3, iter->name3)))) {
- f(iter->payload, data, iter->name,
- iter->name2, iter->name3);
- }
- iter = next;
- }
- }
- }
-}
-
-/**
- * xmlHashCopy:
- * @table: the hash table
- * @f: the copier function for items in the hash
- *
- * Scan the hash @table and applied @f to each value.
- *
- * Returns the new table or NULL in case of error.
- */
-xmlHashTablePtr
-xmlHashCopy(xmlHashTablePtr table, xmlHashCopier f) {
- int i;
- xmlHashEntryPtr iter;
- xmlHashEntryPtr next;
- xmlHashTablePtr ret;
-
- if (table == NULL)
- return(NULL);
- if (f == NULL)
- return(NULL);
-
- ret = xmlHashCreate(table->size);
- if (table->table) {
- for(i = 0; i < table->size; i++) {
- if (table->table[i].valid == 0)
- continue;
- iter = &(table->table[i]);
- while (iter) {
- next = iter->next;
- xmlHashAddEntry3(ret, iter->name, iter->name2,
- iter->name3, f(iter->payload, iter->name));
- iter = next;
- }
- }
- }
- ret->nbElems = table->nbElems;
- return(ret);
-}
-
-/**
- * xmlHashSize:
- * @table: the hash table
- *
- * Query the number of elements installed in the hash @table.
- *
- * Returns the number of elements in the hash table or
- * -1 in case of error
- */
-int
-xmlHashSize(xmlHashTablePtr table) {
- if (table == NULL)
- return(-1);
- return(table->nbElems);
-}
-
-/**
- * xmlHashRemoveEntry:
- * @table: the hash table
- * @name: the name of the userdata
- * @f: the deallocator function for removed item (if any)
- *
- * Find the userdata specified by the @name and remove
- * it from the hash @table. Existing userdata for this tuple will be removed
- * and freed with @f.
- *
- * Returns 0 if the removal succeeded and -1 in case of error or not found.
- */
-int xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
- xmlHashDeallocator f) {
- return(xmlHashRemoveEntry3(table, name, NULL, NULL, f));
-}
-
-/**
- * xmlHashRemoveEntry2:
- * @table: the hash table
- * @name: the name of the userdata
- * @name2: a second name of the userdata
- * @f: the deallocator function for removed item (if any)
- *
- * Find the userdata specified by the (@name, @name2) tuple and remove
- * it from the hash @table. Existing userdata for this tuple will be removed
- * and freed with @f.
- *
- * Returns 0 if the removal succeeded and -1 in case of error or not found.
- */
-int
-xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
- const xmlChar *name2, xmlHashDeallocator f) {
- return(xmlHashRemoveEntry3(table, name, name2, NULL, f));
-}
-
-/**
- * xmlHashRemoveEntry3:
- * @table: the hash table
- * @name: the name of the userdata
- * @name2: a second name of the userdata
- * @name3: a third name of the userdata
- * @f: the deallocator function for removed item (if any)
- *
- * Find the userdata specified by the (@name, @name2, @name3) tuple and remove
- * it from the hash @table. Existing userdata for this tuple will be removed
- * and freed with @f.
- *
- * Returns 0 if the removal succeeded and -1 in case of error or not found.
- */
-int
-xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
- const xmlChar *name2, const xmlChar *name3, xmlHashDeallocator f) {
- unsigned long key;
- xmlHashEntryPtr entry;
- xmlHashEntryPtr prev = NULL;
-
- if (table == NULL || name == NULL)
- return(-1);
-
- key = xmlHashComputeKey(table, name, name2, name3);
- if (table->table[key].valid == 0) {
- return(-1);
- } else {
- for (entry = &(table->table[key]); entry != NULL; entry = entry->next) {
- if (xmlStrEqual(entry->name, name) &&
- xmlStrEqual(entry->name2, name2) &&
- xmlStrEqual(entry->name3, name3)) {
- if(f)
- f(entry->payload, entry->name);
- entry->payload = NULL;
- if(entry->name)
- xmlFree(entry->name);
- if(entry->name2)
- xmlFree(entry->name2);
- if(entry->name3)
- xmlFree(entry->name3);
- if(prev) {
- prev->next = entry->next;
- xmlFree(entry);
- } else {
- if (entry->next == NULL) {
- entry->valid = 0;
- } else {
- entry = entry->next;
- memcpy(&(table->table[key]), entry, sizeof(xmlHashEntry));
- xmlFree(entry);
- }
- }
- table->nbElems--;
- return(0);
- }
- prev = entry;
- }
- return(-1);
- }
-}
-
diff --git a/bundle/libxml/include/libxml/DOCBparser.h b/bundle/libxml/include/libxml/DOCBparser.h
deleted file mode 100644
index 4b7230f17d..0000000000
--- a/bundle/libxml/include/libxml/DOCBparser.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * DOCBparser.h : interface for a DocBook SGML non-verifying parser
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __DOCB_PARSER_H__
-#define __DOCB_PARSER_H__
-#include <libxml/parser.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Most of the back-end structures from XML and SGML are shared.
- */
-typedef xmlParserCtxt docbParserCtxt;
-typedef xmlParserCtxtPtr docbParserCtxtPtr;
-typedef xmlParserNodeInfo docbParserNodeInfo;
-typedef xmlSAXHandler docbSAXHandler;
-typedef xmlSAXHandlerPtr docbSAXHandlerPtr;
-typedef xmlParserInput docbParserInput;
-typedef xmlParserInputPtr docbParserInputPtr;
-typedef xmlDocPtr docbDocPtr;
-typedef xmlNodePtr docbNodePtr;
-
-/*
- * There is only few public functions.
- */
-int docbEncodeEntities(unsigned char *out,
- int *outlen,
- const unsigned char *in,
- int *inlen, int quoteChar);
-
-docbDocPtr docbSAXParseDoc (xmlChar *cur,
- const char *encoding,
- docbSAXHandlerPtr sax,
- void *userData);
-docbDocPtr docbParseDoc (xmlChar *cur,
- const char *encoding);
-docbDocPtr docbSAXParseFile(const char *filename,
- const char *encoding,
- docbSAXHandlerPtr sax,
- void *userData);
-docbDocPtr docbParseFile (const char *filename,
- const char *encoding);
-
-/**
- * Interfaces for the Push mode.
- */
-void docbFreeParserCtxt (docbParserCtxtPtr ctxt);
-docbParserCtxtPtr docbCreatePushParserCtxt(docbSAXHandlerPtr sax,
- void *user_data,
- const char *chunk,
- int size,
- const char *filename,
- xmlCharEncoding enc);
-int docbParseChunk (docbParserCtxtPtr ctxt,
- const char *chunk,
- int size,
- int terminate);
-docbParserCtxtPtr docbCreateFileParserCtxt(const char *filename,
- const char *encoding);
-int docbParseDocument (docbParserCtxtPtr ctxt);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __DOCB_PARSER_H__ */
diff --git a/bundle/libxml/include/libxml/HTMLparser.h b/bundle/libxml/include/libxml/HTMLparser.h
deleted file mode 100644
index f09213711e..0000000000
--- a/bundle/libxml/include/libxml/HTMLparser.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * HTMLparser.h : interface for an HTML 4.0 non-verifying parser
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __HTML_PARSER_H__
-#define __HTML_PARSER_H__
-#include <libxml/parser.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Most of the back-end structures from XML and HTML are shared.
- */
-typedef xmlParserCtxt htmlParserCtxt;
-typedef xmlParserCtxtPtr htmlParserCtxtPtr;
-typedef xmlParserNodeInfo htmlParserNodeInfo;
-typedef xmlSAXHandler htmlSAXHandler;
-typedef xmlSAXHandlerPtr htmlSAXHandlerPtr;
-typedef xmlParserInput htmlParserInput;
-typedef xmlParserInputPtr htmlParserInputPtr;
-typedef xmlDocPtr htmlDocPtr;
-typedef xmlNodePtr htmlNodePtr;
-
-/*
- * Internal description of an HTML element.
- */
-typedef struct _htmlElemDesc htmlElemDesc;
-typedef htmlElemDesc *htmlElemDescPtr;
-struct _htmlElemDesc {
- const char *name; /* The tag name */
- char startTag; /* Whether the start tag can be implied */
- char endTag; /* Whether the end tag can be implied */
- char saveEndTag; /* Whether the end tag should be saved */
- char empty; /* Is this an empty element ? */
- char depr; /* Is this a deprecated element ? */
- char dtd; /* 1: only in Loose DTD, 2: only Frameset one */
- char isinline; /* is this a block 0 or inline 1 element */
- const char *desc; /* the description */
-};
-
-/*
- * Internal description of an HTML entity.
- */
-typedef struct _htmlEntityDesc htmlEntityDesc;
-typedef htmlEntityDesc *htmlEntityDescPtr;
-struct _htmlEntityDesc {
- unsigned int value; /* the UNICODE value for the character */
- const char *name; /* The entity name */
- const char *desc; /* the description */
-};
-
-/*
- * There is only few public functions.
- */
-const htmlElemDesc * htmlTagLookup (const xmlChar *tag);
-const htmlEntityDesc * htmlEntityLookup(const xmlChar *name);
-const htmlEntityDesc * htmlEntityValueLookup(unsigned int value);
-
-int htmlIsAutoClosed(htmlDocPtr doc,
- htmlNodePtr elem);
-int htmlAutoCloseTag(htmlDocPtr doc,
- const xmlChar *name,
- htmlNodePtr elem);
-const htmlEntityDesc * htmlParseEntityRef(htmlParserCtxtPtr ctxt,
- xmlChar **str);
-int htmlParseCharRef(htmlParserCtxtPtr ctxt);
-void htmlParseElement(htmlParserCtxtPtr ctxt);
-
-int htmlParseDocument(htmlParserCtxtPtr ctxt);
-htmlDocPtr htmlSAXParseDoc (xmlChar *cur,
- const char *encoding,
- htmlSAXHandlerPtr sax,
- void *userData);
-htmlDocPtr htmlParseDoc (xmlChar *cur,
- const char *encoding);
-htmlDocPtr htmlSAXParseFile(const char *filename,
- const char *encoding,
- htmlSAXHandlerPtr sax,
- void *userData);
-htmlDocPtr htmlParseFile (const char *filename,
- const char *encoding);
-int UTF8ToHtml (unsigned char *out,
- int *outlen,
- const unsigned char *in,
- int *inlen);
-int htmlEncodeEntities(unsigned char *out,
- int *outlen,
- const unsigned char *in,
- int *inlen, int quoteChar);
-int htmlIsScriptAttribute(const xmlChar *name);
-int htmlHandleOmittedElem(int val);
-
-/**
- * Interfaces for the Push mode.
- */
-void htmlFreeParserCtxt (htmlParserCtxtPtr ctxt);
-htmlParserCtxtPtr htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax,
- void *user_data,
- const char *chunk,
- int size,
- const char *filename,
- xmlCharEncoding enc);
-int htmlParseChunk (htmlParserCtxtPtr ctxt,
- const char *chunk,
- int size,
- int terminate);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __HTML_PARSER_H__ */
diff --git a/bundle/libxml/include/libxml/HTMLtree.h b/bundle/libxml/include/libxml/HTMLtree.h
deleted file mode 100644
index 3a441c4b5c..0000000000
--- a/bundle/libxml/include/libxml/HTMLtree.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * HTMLtree.h : describes the structures found in an tree resulting
- * from an XML parsing.
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __HTML_TREE_H__
-#define __HTML_TREE_H__
-
-#include <stdio.h>
-#include <libxml/tree.h>
-#include <libxml/HTMLparser.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * HTML_TEXT_NODE:
- *
- * Macro. A text node in a HTML document is really implemented
- * the same way as a text node in an XML document.
- */
-#define HTML_TEXT_NODE XML_TEXT_NODE
-/**
- * HTML_ENTITY_REF_NODE:
- *
- * Macro. An entity reference in a HTML document is really implemented
- * the same way as an entity reference in an XML document.
- */
-#define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE
-/**
- * HTML_COMMENT_NODE:
- *
- * Macro. A comment in a HTML document is really implemented
- * the same way as a comment in an XML document.
- */
-#define HTML_COMMENT_NODE XML_COMMENT_NODE
-/**
- * HTML_PRESERVE_NODE:
- *
- * Macro. A preserved node in a HTML document is really implemented
- * the same way as a CDATA section in an XML document.
- */
-#define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE
-/**
- * HTML_PI_NODE:
- *
- * Macro. A processing instruction in a HTML document is really implemented
- * the same way as a processing instruction in an XML document.
- */
-#define HTML_PI_NODE XML_PI_NODE
-
-htmlDocPtr htmlNewDoc (const xmlChar *URI,
- const xmlChar *ExternalID);
-htmlDocPtr htmlNewDocNoDtD (const xmlChar *URI,
- const xmlChar *ExternalID);
-const xmlChar * htmlGetMetaEncoding (htmlDocPtr doc);
-int htmlSetMetaEncoding (htmlDocPtr doc,
- const xmlChar *encoding);
-void htmlDocDumpMemory (xmlDocPtr cur,
- xmlChar **mem,
- int *size);
-int htmlDocDump (FILE *f,
- xmlDocPtr cur);
-int htmlSaveFile (const char *filename,
- xmlDocPtr cur);
-int htmlNodeDump (xmlBufferPtr buf,
- xmlDocPtr doc,
- xmlNodePtr cur);
-void htmlNodeDumpFile (FILE *out,
- xmlDocPtr doc,
- xmlNodePtr cur);
-int htmlNodeDumpFileFormat (FILE *out,
- xmlDocPtr doc,
- xmlNodePtr cur,
- const char *encoding,
- int format);
-int htmlSaveFileEnc (const char *filename,
- xmlDocPtr cur,
- const char *encoding);
-int htmlSaveFileFormat (const char *filename,
- xmlDocPtr cur,
- const char *encoding,
- int format);
-
-void htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf,
- xmlDocPtr doc,
- xmlNodePtr cur,
- const char *encoding,
- int format);
-void htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
- xmlDocPtr cur,
- const char *encoding);
-void htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf,
- xmlDocPtr cur,
- const char *encoding,
- int format);
-
-int htmlIsBooleanAttr (const xmlChar *name);
-void htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
- xmlNodePtr cur, const char *encoding);
-
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __HTML_TREE_H__ */
-
diff --git a/bundle/libxml/include/libxml/Makefile.am b/bundle/libxml/include/libxml/Makefile.am
deleted file mode 100644
index 3a50bc1fcb..0000000000
--- a/bundle/libxml/include/libxml/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-xmlincdir = $(includedir)/libxml2/libxml
-
-xmlinc_HEADERS = \
- SAX.h \
- entities.h \
- encoding.h \
- parser.h \
- parserInternals.h \
- xmlerror.h \
- HTMLparser.h \
- HTMLtree.h \
- debugXML.h \
- tree.h \
- list.h \
- hash.h \
- xpath.h \
- xpathInternals.h \
- xpointer.h \
- xinclude.h \
- xmlIO.h \
- xmlmemory.h \
- nanohttp.h \
- nanoftp.h \
- uri.h \
- valid.h \
- xlink.h \
- xmlversion.h \
- DOCBparser.h \
- catalog.h \
- threads.h \
- globals.h \
- c14n.h \
- xmlautomata.h \
- xmlregexp.h \
- xmlschemas.h \
- schemasInternals.h \
- xmlschemastypes.h \
- xmlunicode.h \
- xmlreader.h
-
-install-exec-hook:
- $(mkinstalldirs) $(DESTDIR)$(xmlincdir)
-
-EXTRA_DIST = xmlversion.h.in
diff --git a/bundle/libxml/include/libxml/Makefile.in b/bundle/libxml/include/libxml/Makefile.in
deleted file mode 100644
index af1022c53a..0000000000
--- a/bundle/libxml/include/libxml/Makefile.in
+++ /dev/null
@@ -1,335 +0,0 @@
-# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
-
-# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-SHELL = @SHELL@
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-DESTDIR =
-
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-
-top_builddir = ../..
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-host_alias = @host_alias@
-host_triplet = @host@
-AS = @AS@
-C14N_OBJ = @C14N_OBJ@
-CATALOG_OBJ = @CATALOG_OBJ@
-CC = @CC@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-DEBUG_OBJ = @DEBUG_OBJ@
-DLLTOOL = @DLLTOOL@
-DOCB_OBJ = @DOCB_OBJ@
-ECHO = @ECHO@
-EXEEXT = @EXEEXT@
-FTP_OBJ = @FTP_OBJ@
-HAVE_ISINF = @HAVE_ISINF@
-HAVE_ISNAN = @HAVE_ISNAN@
-HTML_DIR = @HTML_DIR@
-HTML_OBJ = @HTML_OBJ@
-HTTP_OBJ = @HTTP_OBJ@
-ICONV_LIBS = @ICONV_LIBS@
-LIBTOOL = @LIBTOOL@
-LIBXML_MAJOR_VERSION = @LIBXML_MAJOR_VERSION@
-LIBXML_MICRO_VERSION = @LIBXML_MICRO_VERSION@
-LIBXML_MINOR_VERSION = @LIBXML_MINOR_VERSION@
-LIBXML_VERSION = @LIBXML_VERSION@
-LIBXML_VERSION_INFO = @LIBXML_VERSION_INFO@
-LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@
-LN_S = @LN_S@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MV = @MV@
-M_LIBS = @M_LIBS@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-PYTHON = @PYTHON@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@
-PYTHON_SUBDIR = @PYTHON_SUBDIR@
-PYTHON_VERSION = @PYTHON_VERSION@
-RANLIB = @RANLIB@
-RDL_LIBS = @RDL_LIBS@
-RELDATE = @RELDATE@
-RM = @RM@
-STRIP = @STRIP@
-TAR = @TAR@
-TEST_REGEXPS = @TEST_REGEXPS@
-TEST_SCHEMAS = @TEST_SCHEMAS@
-TEST_THREADS = @TEST_THREADS@
-THREAD_CFLAGS = @THREAD_CFLAGS@
-THREAD_LIBS = @THREAD_LIBS@
-U = @U@
-VERSION = @VERSION@
-WITH_C14N = @WITH_C14N@
-WITH_CATALOG = @WITH_CATALOG@
-WITH_DEBUG = @WITH_DEBUG@
-WITH_DOCB = @WITH_DOCB@
-WITH_FTP = @WITH_FTP@
-WITH_HTML = @WITH_HTML@
-WITH_HTTP = @WITH_HTTP@
-WITH_ICONV = @WITH_ICONV@
-WITH_MEM_DEBUG = @WITH_MEM_DEBUG@
-WITH_REGEXPS = @WITH_REGEXPS@
-WITH_SCHEMAS = @WITH_SCHEMAS@
-WITH_THREADS = @WITH_THREADS@
-WITH_TRIO = @WITH_TRIO@
-WITH_XINCLUDE = @WITH_XINCLUDE@
-WITH_XPATH = @WITH_XPATH@
-WITH_XPTR = @WITH_XPTR@
-XINCLUDE_OBJ = @XINCLUDE_OBJ@
-XML_CFLAGS = @XML_CFLAGS@
-XML_INCLUDEDIR = @XML_INCLUDEDIR@
-XML_LIBDIR = @XML_LIBDIR@
-XML_LIBS = @XML_LIBS@
-XPATH_OBJ = @XPATH_OBJ@
-XPTR_OBJ = @XPTR_OBJ@
-Z_CFLAGS = @Z_CFLAGS@
-Z_LIBS = @Z_LIBS@
-
-xmlincdir = $(includedir)/libxml2/libxml
-
-xmlinc_HEADERS = \
- SAX.h \
- entities.h \
- encoding.h \
- parser.h \
- parserInternals.h \
- xmlerror.h \
- HTMLparser.h \
- HTMLtree.h \
- debugXML.h \
- tree.h \
- list.h \
- hash.h \
- xpath.h \
- xpathInternals.h \
- xpointer.h \
- xinclude.h \
- xmlIO.h \
- xmlmemory.h \
- nanohttp.h \
- nanoftp.h \
- uri.h \
- valid.h \
- xlink.h \
- xmlversion.h \
- DOCBparser.h \
- catalog.h \
- threads.h \
- globals.h \
- c14n.h \
- xmlautomata.h \
- xmlregexp.h \
- xmlschemas.h \
- schemasInternals.h \
- xmlschemastypes.h \
- xmlunicode.h \
- xmlreader.h
-
-
-EXTRA_DIST = xmlversion.h.in
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = ../../config.h
-CONFIG_CLEAN_FILES = xmlversion.h
-HEADERS = $(xmlinc_HEADERS)
-
-DIST_COMMON = Makefile.am Makefile.in xmlversion.h.in
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-GZIP_ENV = --best
-all: all-redirect
-.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps include/libxml/Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-xmlversion.h: $(top_builddir)/config.status xmlversion.h.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-install-xmlincHEADERS: $(xmlinc_HEADERS)
- @$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(xmlincdir)
- @list='$(xmlinc_HEADERS)'; for p in $$list; do \
- if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
- echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(xmlincdir)/$$p"; \
- $(INSTALL_DATA) $$d$$p $(DESTDIR)$(xmlincdir)/$$p; \
- done
-
-uninstall-xmlincHEADERS:
- @$(NORMAL_UNINSTALL)
- list='$(xmlinc_HEADERS)'; for p in $$list; do \
- rm -f $(DESTDIR)$(xmlincdir)/$$p; \
- done
-
-tags: TAGS
-
-ID: $(HEADERS) $(SOURCES) $(LISP)
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- here=`pwd` && cd $(srcdir) \
- && mkid -f$$here/ID $$unique $(LISP)
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
-
-mostlyclean-tags:
-
-clean-tags:
-
-distclean-tags:
- -rm -f TAGS ID
-
-maintainer-clean-tags:
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-
-subdir = include/libxml
-
-distdir: $(DISTFILES)
- @for file in $(DISTFILES); do \
- d=$(srcdir); \
- if test -d $$d/$$file; then \
- cp -pr $$d/$$file $(distdir)/$$file; \
- else \
- test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file || :; \
- fi; \
- done
-info-am:
-info: info-am
-dvi-am:
-dvi: dvi-am
-check-am: all-am
-check: check-am
-installcheck-am:
-installcheck: installcheck-am
-install-exec-am:
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
-install-exec: install-exec-am
-
-install-data-am: install-xmlincHEADERS
-install-data: install-data-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-am
-uninstall-am: uninstall-xmlincHEADERS
-uninstall: uninstall-am
-all-am: Makefile $(HEADERS)
-all-redirect: all-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs:
- $(mkinstalldirs) $(DESTDIR)$(xmlincdir)
-
-
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-
-maintainer-clean-generic:
-mostlyclean-am: mostlyclean-tags mostlyclean-generic
-
-mostlyclean: mostlyclean-am
-
-clean-am: clean-tags clean-generic mostlyclean-am
-
-clean: clean-am
-
-distclean-am: distclean-tags distclean-generic clean-am
- -rm -f libtool
-
-distclean: distclean-am
-
-maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
- distclean-am
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
-
-maintainer-clean: maintainer-clean-am
-
-.PHONY: uninstall-xmlincHEADERS install-xmlincHEADERS tags \
-mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
-distdir info-am info dvi-am dvi check check-am installcheck-am \
-installcheck install-exec-am install-exec install-data-am install-data \
-install-am install uninstall-am uninstall all-redirect all-am all \
-installdirs mostlyclean-generic distclean-generic clean-generic \
-maintainer-clean-generic clean mostlyclean distclean maintainer-clean
-
-
-install-exec-hook:
- $(mkinstalldirs) $(DESTDIR)$(xmlincdir)
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/bundle/libxml/include/libxml/SAX.h b/bundle/libxml/include/libxml/SAX.h
deleted file mode 100644
index d96d9e9596..0000000000
--- a/bundle/libxml/include/libxml/SAX.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * SAX.h : Default SAX handler interfaces.
- *
- * See Copyright for the status of this software.
- *
- * Daniel Veillard <daniel@veillard.com>
- */
-
-
-#ifndef __XML_SAX_H__
-#define __XML_SAX_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <libxml/parser.h>
-#include <libxml/xlink.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-const xmlChar * getPublicId (void *ctx);
-const xmlChar * getSystemId (void *ctx);
-void setDocumentLocator (void *ctx,
- xmlSAXLocatorPtr loc);
-
-int getLineNumber (void *ctx);
-int getColumnNumber (void *ctx);
-
-int isStandalone (void *ctx);
-int hasInternalSubset (void *ctx);
-int hasExternalSubset (void *ctx);
-
-void internalSubset (void *ctx,
- const xmlChar *name,
- const xmlChar *ExternalID,
- const xmlChar *SystemID);
-void externalSubset (void *ctx,
- const xmlChar *name,
- const xmlChar *ExternalID,
- const xmlChar *SystemID);
-xmlEntityPtr getEntity (void *ctx,
- const xmlChar *name);
-xmlEntityPtr getParameterEntity (void *ctx,
- const xmlChar *name);
-xmlParserInputPtr resolveEntity (void *ctx,
- const xmlChar *publicId,
- const xmlChar *systemId);
-
-void entityDecl (void *ctx,
- const xmlChar *name,
- int type,
- const xmlChar *publicId,
- const xmlChar *systemId,
- xmlChar *content);
-void attributeDecl (void *ctx,
- const xmlChar *elem,
- const xmlChar *fullname,
- int type,
- int def,
- const xmlChar *defaultValue,
- xmlEnumerationPtr tree);
-void elementDecl (void *ctx,
- const xmlChar *name,
- int type,
- xmlElementContentPtr content);
-void notationDecl (void *ctx,
- const xmlChar *name,
- const xmlChar *publicId,
- const xmlChar *systemId);
-void unparsedEntityDecl (void *ctx,
- const xmlChar *name,
- const xmlChar *publicId,
- const xmlChar *systemId,
- const xmlChar *notationName);
-
-void startDocument (void *ctx);
-void endDocument (void *ctx);
-void attribute (void *ctx,
- const xmlChar *fullname,
- const xmlChar *value);
-void startElement (void *ctx,
- const xmlChar *fullname,
- const xmlChar **atts);
-void endElement (void *ctx,
- const xmlChar *name);
-void reference (void *ctx,
- const xmlChar *name);
-void characters (void *ctx,
- const xmlChar *ch,
- int len);
-void ignorableWhitespace (void *ctx,
- const xmlChar *ch,
- int len);
-void processingInstruction (void *ctx,
- const xmlChar *target,
- const xmlChar *data);
-void globalNamespace (void *ctx,
- const xmlChar *href,
- const xmlChar *prefix);
-void setNamespace (void *ctx,
- const xmlChar *name);
-xmlNsPtr getNamespace (void *ctx);
-int checkNamespace (void *ctx,
- xmlChar *nameSpace);
-void namespaceDecl (void *ctx,
- const xmlChar *href,
- const xmlChar *prefix);
-void comment (void *ctx,
- const xmlChar *value);
-void cdataBlock (void *ctx,
- const xmlChar *value,
- int len);
-
-void initxmlDefaultSAXHandler (xmlSAXHandler *hdlr,
- int warning);
-#ifdef LIBXML_HTML_ENABLED
-void inithtmlDefaultSAXHandler (xmlSAXHandler *hdlr);
-#endif
-#ifdef LIBXML_DOCB_ENABLED
-void initdocbDefaultSAXHandler (xmlSAXHandler *hdlr);
-#endif
-void xmlDefaultSAXHandlerInit (void);
-void htmlDefaultSAXHandlerInit (void);
-void docbDefaultSAXHandlerInit (void);
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_SAX_H__ */
diff --git a/bundle/libxml/include/libxml/c14n.h b/bundle/libxml/include/libxml/c14n.h
deleted file mode 100644
index 75ace8a4a4..0000000000
--- a/bundle/libxml/include/libxml/c14n.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * "Canonical XML" implementation
- * http://www.w3.org/TR/xml-c14n
- *
- * "Exclusive XML Canonicalization" implementation
- * http://www.w3.org/TR/xml-exc-c14n
-
- * See Copyright for the status of this software.
- *
- * Author: Aleksey Sanin <aleksey@aleksey.com>
- */
-#ifndef __XML_C14N_H__
-#define __XML_C14N_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include <libxml/tree.h>
-#include <libxml/xpath.h>
-
-/*
- * XML Canonicazation
- * http://www.w3.org/TR/xml-c14n
- *
- * Exclusive XML Canonicazation
- * http://www.w3.org/TR/xml-exc-c14n
- *
- * Canonical form of an XML document could be created if and only if
- * a) default attributes (if any) are added to all nodes
- * b) all character and parsed entity references are resolved
- * In order to achive this in libxml2 the document MUST be loaded with
- * following global setings:
- *
- * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
- * xmlSubstituteEntitiesDefault(1);
- *
- * or corresponding parser context setting:
- * xmlParserCtxtPtr ctxt;
- *
- * ...
- * ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
- * ctxt->replaceEntities = 1;
- * ...
- */
-
-
-int xmlC14NDocSaveTo (xmlDocPtr doc,
- xmlNodeSetPtr nodes,
- int exclusive,
- xmlChar **inclusive_ns_prefixes,
- int with_comments,
- xmlOutputBufferPtr buf);
-
-int xmlC14NDocDumpMemory (xmlDocPtr doc,
- xmlNodeSetPtr nodes,
- int exclusive,
- xmlChar **inclusive_ns_prefixes,
- int with_comments,
- xmlChar **doc_txt_ptr);
-
-int xmlC14NDocSave (xmlDocPtr doc,
- xmlNodeSetPtr nodes,
- int exclusive,
- xmlChar **inclusive_ns_prefixes,
- int with_comments,
- const char* filename,
- int compression);
-
-
-/**
- * This is the core C14N function
- */
-typedef int (*xmlC14NIsVisibleCallback) (void* user_data,
- xmlNodePtr node,
- xmlNodePtr parent);
-
-int xmlC14NExecute (xmlDocPtr doc,
- xmlC14NIsVisibleCallback is_visible_callback,
- void* user_data,
- int exclusive,
- xmlChar **inclusive_ns_prefixes,
- int with_comments,
- xmlOutputBufferPtr buf);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __XML_C14N_H__ */
-
diff --git a/bundle/libxml/include/libxml/catalog.h b/bundle/libxml/include/libxml/catalog.h
deleted file mode 100644
index 037e7e80e0..0000000000
--- a/bundle/libxml/include/libxml/catalog.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/**
- * catalog.h: interfaces of the Catalog handling system
- *
- * Reference: SGML Open Technical Resolution TR9401:1997.
- * http://www.jclark.com/sp/catalog.htm
- *
- * XML Catalogs Working Draft 12 Jun 2001
- * http://www.oasis-open.org/committees/entity/spec-2001-06-12.html
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __XML_CATALOG_H__
-#define __XML_CATALOG_H__
-
-#include <stdio.h>
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_CATALOG_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * XML_CATALOGS_NAMESPACE:
- *
- * The namespace for the XML Catalogs elements.
- */
-#define XML_CATALOGS_NAMESPACE \
- (const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog"
-/**
- * XML_CATALOG_PI:
- *
- * The specific XML Catalog Processing Instuction name.
- */
-#define XML_CATALOG_PI \
- (const xmlChar *) "oasis-xml-catalog"
-
-/*
- * The API is voluntarily limited to general cataloging.
- */
-typedef enum {
- XML_CATA_PREFER_NONE = 0,
- XML_CATA_PREFER_PUBLIC = 1,
- XML_CATA_PREFER_SYSTEM
-} xmlCatalogPrefer;
-
-typedef enum {
- XML_CATA_ALLOW_NONE = 0,
- XML_CATA_ALLOW_GLOBAL = 1,
- XML_CATA_ALLOW_DOCUMENT = 2,
- XML_CATA_ALLOW_ALL = 3
-} xmlCatalogAllow;
-
-typedef struct _xmlCatalog xmlCatalog;
-typedef xmlCatalog *xmlCatalogPtr;
-
-/*
- * Operations on a given catalog.
- */
-xmlCatalogPtr xmlNewCatalog (int sgml);
-xmlCatalogPtr xmlLoadACatalog (const char *filename);
-xmlCatalogPtr xmlLoadSGMLSuperCatalog (const char *filename);
-int xmlConvertSGMLCatalog (xmlCatalogPtr catal);
-int xmlACatalogAdd (xmlCatalogPtr catal,
- const xmlChar *type,
- const xmlChar *orig,
- const xmlChar *replace);
-int xmlACatalogRemove (xmlCatalogPtr catal,
- const xmlChar *value);
-xmlChar * xmlACatalogResolve (xmlCatalogPtr catal,
- const xmlChar *pubID,
- const xmlChar *sysID);
-xmlChar * xmlACatalogResolveSystem(xmlCatalogPtr catal,
- const xmlChar *sysID);
-xmlChar * xmlACatalogResolvePublic(xmlCatalogPtr catal,
- const xmlChar *pubID);
-xmlChar * xmlACatalogResolveURI (xmlCatalogPtr catal,
- const xmlChar *URI);
-void xmlACatalogDump (xmlCatalogPtr catal,
- FILE *out);
-void xmlFreeCatalog (xmlCatalogPtr catal);
-int xmlCatalogIsEmpty (xmlCatalogPtr catal);
-
-/*
- * Global operations.
- */
-void xmlInitializeCatalog (void);
-int xmlLoadCatalog (const char *filename);
-void xmlLoadCatalogs (const char *paths);
-void xmlCatalogCleanup (void);
-void xmlCatalogDump (FILE *out);
-xmlChar * xmlCatalogResolve (const xmlChar *pubID,
- const xmlChar *sysID);
-xmlChar * xmlCatalogResolveSystem (const xmlChar *sysID);
-xmlChar * xmlCatalogResolvePublic (const xmlChar *pubID);
-xmlChar * xmlCatalogResolveURI (const xmlChar *URI);
-int xmlCatalogAdd (const xmlChar *type,
- const xmlChar *orig,
- const xmlChar *replace);
-int xmlCatalogRemove (const xmlChar *value);
-xmlDocPtr xmlParseCatalogFile (const char *filename);
-int xmlCatalogConvert (void);
-
-/*
- * Strictly minimal interfaces for per-document catalogs used
- * by the parser.
- */
-void xmlCatalogFreeLocal (void *catalogs);
-void * xmlCatalogAddLocal (void *catalogs,
- const xmlChar *URL);
-xmlChar * xmlCatalogLocalResolve (void *catalogs,
- const xmlChar *pubID,
- const xmlChar *sysID);
-xmlChar * xmlCatalogLocalResolveURI(void *catalogs,
- const xmlChar *URI);
-/*
- * Preference settings.
- */
-int xmlCatalogSetDebug (int level);
-xmlCatalogPrefer xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer);
-void xmlCatalogSetDefaults (xmlCatalogAllow allow);
-xmlCatalogAllow xmlCatalogGetDefaults (void);
-
-
-/* DEPRECATED interfaces */
-const xmlChar * xmlCatalogGetSystem (const xmlChar *sysID);
-const xmlChar * xmlCatalogGetPublic (const xmlChar *pubID);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* LIBXML_CATALOG_ENABLED */
-#endif /* __XML_CATALOG_H__ */
diff --git a/bundle/libxml/include/libxml/debugXML.h b/bundle/libxml/include/libxml/debugXML.h
deleted file mode 100644
index cf017a4a73..0000000000
--- a/bundle/libxml/include/libxml/debugXML.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * debugXML.h : Interfaces to a set of routines used for debugging the tree
- * produced by the XML parser.
- *
- * Daniel Veillard <daniel@veillard.com>
- */
-
-#ifndef __DEBUG_XML__
-#define __DEBUG_XML__
-#include <stdio.h>
-#include <libxml/tree.h>
-
-#ifdef LIBXML_DEBUG_ENABLED
-
-#include <libxml/xpath.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * The standard Dump routines.
- */
-void xmlDebugDumpString (FILE *output,
- const xmlChar *str);
-void xmlDebugDumpAttr (FILE *output,
- xmlAttrPtr attr,
- int depth);
-void xmlDebugDumpAttrList (FILE *output,
- xmlAttrPtr attr,
- int depth);
-void xmlDebugDumpOneNode (FILE *output,
- xmlNodePtr node,
- int depth);
-void xmlDebugDumpNode (FILE *output,
- xmlNodePtr node,
- int depth);
-void xmlDebugDumpNodeList (FILE *output,
- xmlNodePtr node,
- int depth);
-void xmlDebugDumpDocumentHead(FILE *output,
- xmlDocPtr doc);
-void xmlDebugDumpDocument (FILE *output,
- xmlDocPtr doc);
-void xmlDebugDumpDTD (FILE *output,
- xmlDtdPtr dtd);
-void xmlDebugDumpEntities (FILE *output,
- xmlDocPtr doc);
-
-void xmlLsOneNode (FILE *output, xmlNodePtr node);
-int xmlLsCountNode (xmlNodePtr node);
-
-LIBXML_DLL_IMPORT const char *xmlBoolToText (int boolval);
-
-/****************************************************************
- * *
- * The XML shell related structures and functions *
- * *
- ****************************************************************/
-
-/**
- * xmlShellReadlineFunc:
- * @prompt: a string prompt
- *
- * This is a generic signature for the XML shell input function.
- *
- * Returns a string which will be freed by the Shell.
- */
-typedef char * (* xmlShellReadlineFunc)(char *prompt);
-
-/**
- * xmlShellCtxt:
- *
- * A debugging shell context.
- * TODO: add the defined function tables.
- */
-typedef struct _xmlShellCtxt xmlShellCtxt;
-typedef xmlShellCtxt *xmlShellCtxtPtr;
-struct _xmlShellCtxt {
- char *filename;
- xmlDocPtr doc;
- xmlNodePtr node;
- xmlXPathContextPtr pctxt;
- int loaded;
- FILE *output;
- xmlShellReadlineFunc input;
-};
-
-/**
- * xmlShellCmd:
- * @ctxt: a shell context
- * @arg: a string argument
- * @node: a first node
- * @node2: a second node
- *
- * This is a generic signature for the XML shell functions.
- *
- * Returns an int, negative returns indicating errors.
- */
-typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
- char *arg,
- xmlNodePtr node,
- xmlNodePtr node2);
-
-void xmlShellPrintXPathError (int errorType,
- const char *arg);
-void xmlShellPrintNode (xmlNodePtr node);
-void xmlShellPrintXPathResult(xmlXPathObjectPtr list);
-int xmlShellList (xmlShellCtxtPtr ctxt,
- char *arg,
- xmlNodePtr node,
- xmlNodePtr node2);
-int xmlShellBase (xmlShellCtxtPtr ctxt,
- char *arg,
- xmlNodePtr node,
- xmlNodePtr node2);
-int xmlShellDir (xmlShellCtxtPtr ctxt,
- char *arg,
- xmlNodePtr node,
- xmlNodePtr node2);
-int xmlShellCat (xmlShellCtxtPtr ctxt,
- char *arg,
- xmlNodePtr node,
- xmlNodePtr node2);
-int xmlShellLoad (xmlShellCtxtPtr ctxt,
- char *filename,
- xmlNodePtr node,
- xmlNodePtr node2);
-int xmlShellWrite (xmlShellCtxtPtr ctxt,
- char *filename,
- xmlNodePtr node,
- xmlNodePtr node2);
-int xmlShellSave (xmlShellCtxtPtr ctxt,
- char *filename,
- xmlNodePtr node,
- xmlNodePtr node2);
-int xmlShellValidate (xmlShellCtxtPtr ctxt,
- char *dtd,
- xmlNodePtr node,
- xmlNodePtr node2);
-int xmlShellDu (xmlShellCtxtPtr ctxt,
- char *arg,
- xmlNodePtr tree,
- xmlNodePtr node2);
-int xmlShellPwd (xmlShellCtxtPtr ctxt,
- char *buffer,
- xmlNodePtr node,
- xmlNodePtr node2);
-
-/*
- * The Shell interface.
- */
-void xmlShell (xmlDocPtr doc,
- char *filename,
- xmlShellReadlineFunc input,
- FILE *output);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_DEBUG_ENABLED */
-#endif /* __DEBUG_XML__ */
diff --git a/bundle/libxml/include/libxml/encoding.h b/bundle/libxml/include/libxml/encoding.h
deleted file mode 100644
index 3c0fbb91ff..0000000000
--- a/bundle/libxml/include/libxml/encoding.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * encoding.h : interface for the encoding conversion functions needed for
- * XML
- *
- * Related specs:
- * rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies
- * [ISO-10646] UTF-8 and UTF-16 in Annexes
- * [ISO-8859-1] ISO Latin-1 characters codes.
- * [UNICODE] The Unicode Consortium, "The Unicode Standard --
- * Worldwide Character Encoding -- Version 1.0", Addison-
- * Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is
- * described in Unicode Technical Report #4.
- * [US-ASCII] Coded Character Set--7-bit American Standard Code for
- * Information Interchange, ANSI X3.4-1986.
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __XML_CHAR_ENCODING_H__
-#define __XML_CHAR_ENCODING_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_ICONV_ENABLED
-#include <iconv.h>
-#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlCharEncoding:
- *
- * Predefined values for some standard encodings.
- * Libxml don't do beforehand translation on UTF8, ISOLatinX.
- * It also support UTF16 (LE and BE) by default.
- *
- * Anything else would have to be translated to UTF8 before being
- * given to the parser itself. The BOM for UTF16 and the encoding
- * declaration are looked at and a converter is looked for at that
- * point. If not found the parser stops here as asked by the XML REC
- * Converter can be registered by the user using xmlRegisterCharEncodingHandler
- * but the current form doesn't allow stateful transcoding (a serious
- * problem agreed !). If iconv has been found it will be used
- * automatically and allow stateful transcoding, the simplest is then
- * to be sure to enable icon and to provide iconv libs for the encoding
- * support needed.
- */
-typedef enum {
- XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */
- XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */
- XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */
- XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */
- XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */
- XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */
- XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */
- XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */
- XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */
- XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */
- XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */
- XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */
- XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */
- XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */
- XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */
- XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */
- XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */
- XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */
- XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */
- XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */
- XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */
- XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
- XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */
- XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */
-} xmlCharEncoding;
-
-/**
- * xmlCharEncodingInputFunc:
- * @out: a pointer to an array of bytes to store the UTF-8 result
- * @outlen: the length of @out
- * @in: a pointer to an array of chars in the original encoding
- * @inlen: the length of @in
- *
- * Take a block of chars in the original encoding and try to convert
- * it to an UTF-8 block of chars out.
- *
- * Returns the number of byte written, or -1 by lack of space, or -2
- * if the transcoding failed.
- * The value of @inlen after return is the number of octets consumed
- * as the return value is positive, else unpredictiable.
- * The value of @outlen after return is the number of octets consumed.
- */
-typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen,
- const unsigned char *in, int *inlen);
-
-
-/**
- * xmlCharEncodingOutputFunc:
- * @out: a pointer to an array of bytes to store the result
- * @outlen: the length of @out
- * @in: a pointer to an array of UTF-8 chars
- * @inlen: the length of @in
- *
- * Take a block of UTF-8 chars in and try to convert it to an other
- * encoding.
- * Note: a first call designed to produce heading info is called with
- * in = NULL. If stateful this should also initialize the encoder state.
- *
- * Returns the number of byte written, or -1 by lack of space, or -2
- * if the transcoding failed.
- * The value of @inlen after return is the number of octets consumed
- * as the return value is positive, else unpredictiable.
- * The value of @outlen after return is the number of ocetes consumed.
- */
-typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
- const unsigned char *in, int *inlen);
-
-
-/*
- * Block defining the handlers for non UTF-8 encodings.
- * If iconv is supported, there is two extra fields.
- */
-
-typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler;
-typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
-struct _xmlCharEncodingHandler {
- char *name;
- xmlCharEncodingInputFunc input;
- xmlCharEncodingOutputFunc output;
-#ifdef LIBXML_ICONV_ENABLED
- iconv_t iconv_in;
- iconv_t iconv_out;
-#endif /* LIBXML_ICONV_ENABLED */
-};
-
-#ifdef __cplusplus
-}
-#endif
-#include <libxml/tree.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Interfaces for encoding handlers.
- */
-void xmlInitCharEncodingHandlers (void);
-void xmlCleanupCharEncodingHandlers (void);
-void xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler);
-xmlCharEncodingHandlerPtr
- xmlGetCharEncodingHandler (xmlCharEncoding enc);
-xmlCharEncodingHandlerPtr
- xmlFindCharEncodingHandler (const char *name);
-xmlCharEncodingHandlerPtr
- xmlNewCharEncodingHandler (const char *name,
- xmlCharEncodingInputFunc input,
- xmlCharEncodingOutputFunc output);
-
-/*
- * Interfaces for encoding names and aliases.
- */
-int xmlAddEncodingAlias (const char *name,
- const char *alias);
-int xmlDelEncodingAlias (const char *alias);
-const char *
- xmlGetEncodingAlias (const char *alias);
-void xmlCleanupEncodingAliases (void);
-xmlCharEncoding
- xmlParseCharEncoding (const char *name);
-const char *
- xmlGetCharEncodingName (xmlCharEncoding enc);
-
-/*
- * Interfaces directly used by the parsers.
- */
-xmlCharEncoding
- xmlDetectCharEncoding (const unsigned char *in,
- int len);
-
-int xmlCharEncOutFunc (xmlCharEncodingHandler *handler,
- xmlBufferPtr out,
- xmlBufferPtr in);
-
-int xmlCharEncInFunc (xmlCharEncodingHandler *handler,
- xmlBufferPtr out,
- xmlBufferPtr in);
-int xmlCharEncFirstLine (xmlCharEncodingHandler *handler,
- xmlBufferPtr out,
- xmlBufferPtr in);
-int xmlCharEncCloseFunc (xmlCharEncodingHandler *handler);
-
-/*
- * Export a few useful functions
- */
-int UTF8Toisolat1 (unsigned char *out,
- int *outlen,
- const unsigned char *in,
- int *inlen);
-int isolat1ToUTF8 (unsigned char *out,
- int *outlen,
- const unsigned char *in,
- int *inlen);
-int xmlGetUTF8Char (const unsigned char *utf,
- int *len);
-/*
- * exports additional "UTF-8 aware" string routines which are.
- */
-
-int xmlCheckUTF8 (const unsigned char *utf);
-
-int xmlUTF8Strsize (const xmlChar *utf,
- int len);
-xmlChar * xmlUTF8Strndup (const xmlChar *utf,
- int len);
-xmlChar * xmlUTF8Strpos (const xmlChar *utf,
- int pos);
-int xmlUTF8Strloc (const xmlChar *utf,
- const xmlChar *utfchar);
-xmlChar * xmlUTF8Strsub (const xmlChar *utf,
- int start,
- int len);
-
-int xmlUTF8Strlen (const xmlChar *utf);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __XML_CHAR_ENCODING_H__ */
diff --git a/bundle/libxml/include/libxml/entities.h b/bundle/libxml/include/libxml/entities.h
deleted file mode 100644
index 480009c0e3..0000000000
--- a/bundle/libxml/include/libxml/entities.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * entities.h : interface for the XML entities handling
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __XML_ENTITIES_H__
-#define __XML_ENTITIES_H__
-
-#include <libxml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * The different valid entity types.
- */
-typedef enum {
- XML_INTERNAL_GENERAL_ENTITY = 1,
- XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2,
- XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3,
- XML_INTERNAL_PARAMETER_ENTITY = 4,
- XML_EXTERNAL_PARAMETER_ENTITY = 5,
- XML_INTERNAL_PREDEFINED_ENTITY = 6
-} xmlEntityType;
-
-/*
- * An unit of storage for an entity, contains the string, the value
- * and the linkind data needed for the linking in the hash table.
- */
-
-struct _xmlEntity {
- void *_private; /* application data */
- xmlElementType type; /* XML_ENTITY_DECL, must be second ! */
- const xmlChar *name; /* Entity name */
- struct _xmlNode *children; /* First child link */
- struct _xmlNode *last; /* Last child link */
- struct _xmlDtd *parent; /* -> DTD */
- struct _xmlNode *next; /* next sibling link */
- struct _xmlNode *prev; /* previous sibling link */
- struct _xmlDoc *doc; /* the containing document */
-
- xmlChar *orig; /* content without ref substitution */
- xmlChar *content; /* content or ndata if unparsed */
- int length; /* the content length */
- xmlEntityType etype; /* The entity type */
- const xmlChar *ExternalID; /* External identifier for PUBLIC */
- const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */
-
- struct _xmlEntity *nexte; /* unused */
- const xmlChar *URI; /* the full URI as computed */
-};
-
-/*
- * All entities are stored in an hash table.
- * There is 2 separate hash tables for global and parameter entities.
- */
-
-typedef struct _xmlHashTable xmlEntitiesTable;
-typedef xmlEntitiesTable *xmlEntitiesTablePtr;
-
-/*
- * External functions:
- */
-
-void xmlInitializePredefinedEntities (void);
-xmlEntityPtr xmlAddDocEntity (xmlDocPtr doc,
- const xmlChar *name,
- int type,
- const xmlChar *ExternalID,
- const xmlChar *SystemID,
- const xmlChar *content);
-xmlEntityPtr xmlAddDtdEntity (xmlDocPtr doc,
- const xmlChar *name,
- int type,
- const xmlChar *ExternalID,
- const xmlChar *SystemID,
- const xmlChar *content);
-xmlEntityPtr xmlGetPredefinedEntity (const xmlChar *name);
-xmlEntityPtr xmlGetDocEntity (xmlDocPtr doc,
- const xmlChar *name);
-xmlEntityPtr xmlGetDtdEntity (xmlDocPtr doc,
- const xmlChar *name);
-xmlEntityPtr xmlGetParameterEntity (xmlDocPtr doc,
- const xmlChar *name);
-const xmlChar * xmlEncodeEntities (xmlDocPtr doc,
- const xmlChar *input);
-xmlChar * xmlEncodeEntitiesReentrant(xmlDocPtr doc,
- const xmlChar *input);
-xmlChar * xmlEncodeSpecialChars (xmlDocPtr doc,
- const xmlChar *input);
-xmlEntitiesTablePtr xmlCreateEntitiesTable (void);
-xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
-void xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
-void xmlDumpEntitiesTable (xmlBufferPtr buf,
- xmlEntitiesTablePtr table);
-void xmlDumpEntityDecl (xmlBufferPtr buf,
- xmlEntityPtr ent);
-void xmlCleanupPredefinedEntities(void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-# endif /* __XML_ENTITIES_H__ */
diff --git a/bundle/libxml/include/libxml/globals.h b/bundle/libxml/include/libxml/globals.h
deleted file mode 100644
index fc6c01e53c..0000000000
--- a/bundle/libxml/include/libxml/globals.h
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * globals.h: interface for all global variables of the library
- *
- * The bottom of this file is automatically generated by build_glob.py
- * based on the description file global.data
- *
- * See Copyright for the status of this software.
- *
- * Gary Pennington <Gary.Pennington@uk.sun.com>
- * daniel@veillard.com
- */
-
-#ifndef __XML_GLOBALS_H
-#define __XML_GLOBALS_H
-
-#include <libxml/parser.h>
-#include <libxml/xmlerror.h>
-#include <libxml/SAX.h>
-#include <libxml/xmlmemory.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Externally global symbols which need to be protected for backwards
- * compatibility support.
- */
-
-#undef docbDefaultSAXHandler
-#undef htmlDefaultSAXHandler
-#undef oldXMLWDcompatibility
-#undef xmlBufferAllocScheme
-#undef xmlDefaultBufferSize
-#undef xmlDefaultSAXHandler
-#undef xmlDefaultSAXLocator
-#undef xmlDoValidityCheckingDefaultValue
-#undef xmlFree
-#undef xmlGenericError
-#undef xmlGenericErrorContext
-#undef xmlGetWarningsDefaultValue
-#undef xmlIndentTreeOutput
-#undef xmlTreeIndentString
-#undef xmlKeepBlanksDefaultValue
-#undef xmlLineNumbersDefaultValue
-#undef xmlLoadExtDtdDefaultValue
-#undef xmlMalloc
-#undef xmlMemStrdup
-#undef xmlParserDebugEntities
-#undef xmlParserVersion
-#undef xmlPedanticParserDefaultValue
-#undef xmlRealloc
-#undef xmlSaveNoEmptyTags
-#undef xmlSubstituteEntitiesDefaultValue
-
-typedef struct _xmlGlobalState xmlGlobalState;
-typedef xmlGlobalState *xmlGlobalStatePtr;
-struct _xmlGlobalState
-{
- const char *xmlParserVersion;
-
- xmlSAXLocator xmlDefaultSAXLocator;
- xmlSAXHandler xmlDefaultSAXHandler;
- xmlSAXHandler docbDefaultSAXHandler;
- xmlSAXHandler htmlDefaultSAXHandler;
-
- xmlFreeFunc xmlFree;
- xmlMallocFunc xmlMalloc;
- xmlStrdupFunc xmlMemStrdup;
- xmlReallocFunc xmlRealloc;
-
- xmlGenericErrorFunc xmlGenericError;
- void *xmlGenericErrorContext;
-
- int oldXMLWDcompatibility;
-
- xmlBufferAllocationScheme xmlBufferAllocScheme;
- int xmlDefaultBufferSize;
-
- int xmlSubstituteEntitiesDefaultValue;
- int xmlDoValidityCheckingDefaultValue;
- int xmlGetWarningsDefaultValue;
- int xmlKeepBlanksDefaultValue;
- int xmlLineNumbersDefaultValue;
- int xmlLoadExtDtdDefaultValue;
- int xmlParserDebugEntities;
- int xmlPedanticParserDefaultValue;
-
- int xmlSaveNoEmptyTags;
- int xmlIndentTreeOutput;
- const char *xmlTreeIndentString;
-};
-
-#ifdef __cplusplus
-}
-#endif
-#include <libxml/threads.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void xmlInitializeGlobalState(xmlGlobalStatePtr gs);
-
-/*
- * In general the memory allocation entry points are not kept
- * thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED
- * - xmlMalloc
- * - xmlRealloc
- * - xmlMemStrdup
- * - xmlFree
- */
-
-#ifdef LIBXML_THREAD_ALLOC_ENABLED
-#ifdef LIBXML_THREAD_ENABLED
-extern xmlMallocFunc *__xmlMalloc(void);
-#define xmlMalloc \
-(*(__xmlMalloc()))
-#else
-LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc;
-#endif
-
-#ifdef LIBXML_THREAD_ENABLED
-extern xmlReallocFunc *__xmlRealloc(void);
-#define xmlRealloc \
-(*(__xmlRealloc()))
-#else
-LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc;
-#endif
-
-#ifdef LIBXML_THREAD_ENABLED
-extern xmlFreeFunc *__xmlFree(void);
-#define xmlFree \
-(*(__xmlFree()))
-#else
-LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree;
-#endif
-
-#ifdef LIBXML_THREAD_ENABLED
-extern xmlStrdupFunc *__xmlMemStrdup(void);
-#define xmlMemStrdup \
-(*(__xmlMemStrdup()))
-#else
-LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup;
-#endif
-#else /* !LIBXML_THREAD_ALLOC_ENABLED */
-LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc;
-LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc;
-LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree;
-LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup;
-#endif /* LIBXML_THREAD_ALLOC_ENABLED */
-
-#ifdef LIBXML_DOCB_ENABLED
-extern xmlSAXHandler *__docbDefaultSAXHandler(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define docbDefaultSAXHandler \
-(*(__docbDefaultSAXHandler()))
-#else
-LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler;
-#endif
-#endif
-
-#ifdef LIBXML_HTML_ENABLED
-extern xmlSAXHandler *__htmlDefaultSAXHandler(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define htmlDefaultSAXHandler \
-(*(__htmlDefaultSAXHandler()))
-#else
-LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler;
-#endif
-#endif
-
-
-/*
- * Everything starting from the line below is
- * Automatically generated by build_glob.py.
- * Do not modify the previous line.
- */
-
-
-extern int *__oldXMLWDcompatibility(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define oldXMLWDcompatibility \
-(*(__oldXMLWDcompatibility()))
-#else
-LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;
-#endif
-
-extern xmlBufferAllocationScheme *__xmlBufferAllocScheme(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlBufferAllocScheme \
-(*(__xmlBufferAllocScheme()))
-#else
-LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme;
-#endif
-
-extern int *__xmlDefaultBufferSize(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlDefaultBufferSize \
-(*(__xmlDefaultBufferSize()))
-#else
-LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize;
-#endif
-
-extern xmlSAXHandler *__xmlDefaultSAXHandler(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlDefaultSAXHandler \
-(*(__xmlDefaultSAXHandler()))
-#else
-LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler;
-#endif
-
-extern xmlSAXLocator *__xmlDefaultSAXLocator(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlDefaultSAXLocator \
-(*(__xmlDefaultSAXLocator()))
-#else
-LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
-#endif
-
-extern int *__xmlDoValidityCheckingDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlDoValidityCheckingDefaultValue \
-(*(__xmlDoValidityCheckingDefaultValue()))
-#else
-LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
-#endif
-
-extern xmlGenericErrorFunc *__xmlGenericError(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlGenericError \
-(*(__xmlGenericError()))
-#else
-LIBXML_DLL_IMPORT extern xmlGenericErrorFunc xmlGenericError;
-#endif
-
-extern void * *__xmlGenericErrorContext(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlGenericErrorContext \
-(*(__xmlGenericErrorContext()))
-#else
-LIBXML_DLL_IMPORT extern void * xmlGenericErrorContext;
-#endif
-
-extern int *__xmlGetWarningsDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlGetWarningsDefaultValue \
-(*(__xmlGetWarningsDefaultValue()))
-#else
-LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
-#endif
-
-extern int *__xmlIndentTreeOutput(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlIndentTreeOutput \
-(*(__xmlIndentTreeOutput()))
-#else
-LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput;
-#endif
-
-extern const char * *__xmlTreeIndentString(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlTreeIndentString \
-(*(__xmlTreeIndentString()))
-#else
-LIBXML_DLL_IMPORT extern const char * xmlTreeIndentString;
-#endif
-
-extern int *__xmlKeepBlanksDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlKeepBlanksDefaultValue \
-(*(__xmlKeepBlanksDefaultValue()))
-#else
-LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue;
-#endif
-
-extern int *__xmlLineNumbersDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlLineNumbersDefaultValue \
-(*(__xmlLineNumbersDefaultValue()))
-#else
-LIBXML_DLL_IMPORT extern int xmlLineNumbersDefaultValue;
-#endif
-
-extern int *__xmlLoadExtDtdDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlLoadExtDtdDefaultValue \
-(*(__xmlLoadExtDtdDefaultValue()))
-#else
-LIBXML_DLL_IMPORT extern int xmlLoadExtDtdDefaultValue;
-#endif
-
-extern int *__xmlParserDebugEntities(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlParserDebugEntities \
-(*(__xmlParserDebugEntities()))
-#else
-LIBXML_DLL_IMPORT extern int xmlParserDebugEntities;
-#endif
-
-extern const char * *__xmlParserVersion(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlParserVersion \
-(*(__xmlParserVersion()))
-#else
-LIBXML_DLL_IMPORT extern const char * xmlParserVersion;
-#endif
-
-extern int *__xmlPedanticParserDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlPedanticParserDefaultValue \
-(*(__xmlPedanticParserDefaultValue()))
-#else
-LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
-#endif
-
-extern int *__xmlSaveNoEmptyTags(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlSaveNoEmptyTags \
-(*(__xmlSaveNoEmptyTags()))
-#else
-LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags;
-#endif
-
-extern int *__xmlSubstituteEntitiesDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlSubstituteEntitiesDefaultValue \
-(*(__xmlSubstituteEntitiesDefaultValue()))
-#else
-LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __XML_GLOBALS_H */
diff --git a/bundle/libxml/include/libxml/hash.h b/bundle/libxml/include/libxml/hash.h
deleted file mode 100644
index ec590c91fe..0000000000
--- a/bundle/libxml/include/libxml/hash.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * hash.h: chained hash tables
- *
- * Copyright (C) 2000 Bjorn Reese and Daniel Veillard.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- * Author: bjorn.reese@systematic.dk
- */
-
-#ifndef __XML_HASH_H__
-#define __XML_HASH_H__
-
-#include <libxml/parser.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * The hash table.
- */
-typedef struct _xmlHashTable xmlHashTable;
-typedef xmlHashTable *xmlHashTablePtr;
-
-/*
- * function types:
- */
-/**
- * xmlHashDeallocator:
- * @payload: the data in the hash
- * @name: the name associated
- *
- * Callback to free data from a hash.
- */
-typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
-/**
- * xmlHashCopier:
- * @payload: the data in the hash
- * @name: the name associated
- *
- * Callback to copy data from a hash.
- *
- * Returns a copy of the data or NULL in case of error.
- */
-typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);
-/**
- * xmlHashScanner:
- * @payload: the data in the hash
- * @data: extra scannner data
- * @name: the name associated
- *
- * Callback when scanning data in a hash with the simple scanner.
- */
-typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name);
-/**
- * xmlHashScannerFull:
- * @payload: the data in the hash
- * @data: extra scannner data
- * @name: the name associated
- * @name2: the second name associated
- * @name3: the third name associated
- *
- * Callback when scanning data in a hash with the full scanner.
- */
-typedef void (*xmlHashScannerFull)(void *payload, void *data,
- const xmlChar *name, const xmlChar *name2,
- const xmlChar *name3);
-
-/*
- * Constructor and destructor.
- */
-xmlHashTablePtr xmlHashCreate (int size);
-void xmlHashFree (xmlHashTablePtr table,
- xmlHashDeallocator f);
-
-/*
- * Add a new entry to the hash table.
- */
-int xmlHashAddEntry (xmlHashTablePtr table,
- const xmlChar *name,
- void *userdata);
-int xmlHashUpdateEntry(xmlHashTablePtr table,
- const xmlChar *name,
- void *userdata,
- xmlHashDeallocator f);
-int xmlHashAddEntry2(xmlHashTablePtr table,
- const xmlChar *name,
- const xmlChar *name2,
- void *userdata);
-int xmlHashUpdateEntry2(xmlHashTablePtr table,
- const xmlChar *name,
- const xmlChar *name2,
- void *userdata,
- xmlHashDeallocator f);
-int xmlHashAddEntry3(xmlHashTablePtr table,
- const xmlChar *name,
- const xmlChar *name2,
- const xmlChar *name3,
- void *userdata);
-int xmlHashUpdateEntry3(xmlHashTablePtr table,
- const xmlChar *name,
- const xmlChar *name2,
- const xmlChar *name3,
- void *userdata,
- xmlHashDeallocator f);
-
-/*
- * Remove an entry from the hash table.
- */
-int xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
- xmlHashDeallocator f);
-int xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
- const xmlChar *name2, xmlHashDeallocator f);
-int xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
- const xmlChar *name2, const xmlChar *name3,
- xmlHashDeallocator f);
-
-/*
- * Retrieve the userdata.
- */
-void * xmlHashLookup (xmlHashTablePtr table,
- const xmlChar *name);
-void * xmlHashLookup2 (xmlHashTablePtr table,
- const xmlChar *name,
- const xmlChar *name2);
-void * xmlHashLookup3 (xmlHashTablePtr table,
- const xmlChar *name,
- const xmlChar *name2,
- const xmlChar *name3);
-
-/*
- * Helpers.
- */
-xmlHashTablePtr xmlHashCopy (xmlHashTablePtr table,
- xmlHashCopier f);
-int xmlHashSize (xmlHashTablePtr table);
-void xmlHashScan (xmlHashTablePtr table,
- xmlHashScanner f,
- void *data);
-void xmlHashScan3 (xmlHashTablePtr table,
- const xmlChar *name,
- const xmlChar *name2,
- const xmlChar *name3,
- xmlHashScanner f,
- void *data);
-void xmlHashScanFull (xmlHashTablePtr table,
- xmlHashScannerFull f,
- void *data);
-void xmlHashScanFull3(xmlHashTablePtr table,
- const xmlChar *name,
- const xmlChar *name2,
- const xmlChar *name3,
- xmlHashScannerFull f,
- void *data);
-#ifdef __cplusplus
-}
-#endif
-#endif /* ! __XML_HASH_H__ */
diff --git a/bundle/libxml/include/libxml/list.h b/bundle/libxml/include/libxml/list.h
deleted file mode 100644
index 8c9515fe1d..0000000000
--- a/bundle/libxml/include/libxml/list.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * list.h: lists interfaces
- *
- * Copyright (C) 2000 Gary Pennington and Daniel Veillard.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- * Author: Gary.Pennington@uk.sun.com
- */
-
-#ifndef __XML_LINK_INCLUDE__
-#define __XML_LINK_INCLUDE__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _xmlLink xmlLink;
-typedef xmlLink *xmlLinkPtr;
-
-typedef struct _xmlList xmlList;
-typedef xmlList *xmlListPtr;
-
-/**
- * xmlListDeallocator:
- * @lk: the data to deallocate
- *
- * Callback function used to free data from a list.
- */
-typedef void (*xmlListDeallocator) (xmlLinkPtr lk);
-/**
- * xmlListDataCompare:
- * @data0: the first data
- * @data1: the second data
- *
- * Callback function used to compare 2 data.
- *
- * Returns 0 is equality, -1 or 1 otherwise depending on the ordering.
- */
-typedef int (*xmlListDataCompare) (const void *data0, const void *data1);
-/**
- * xmlListWalker:
- * @data: the data found in the list
- * @user: extra user provided data to the walker
- *
- * Callback function used when walking a list with xmlListWalk().
- *
- * Returns 0 to stop walking the list, 1 otherwise.
- */
-typedef int (*xmlListWalker) (const void *data, const void *user);
-
-/* Creation/Deletion */
-xmlListPtr xmlListCreate (xmlListDeallocator deallocator,
- xmlListDataCompare compare);
-void xmlListDelete (xmlListPtr l);
-
-/* Basic Operators */
-void * xmlListSearch (xmlListPtr l,
- void *data);
-void * xmlListReverseSearch (xmlListPtr l,
- void *data);
-int xmlListInsert (xmlListPtr l,
- void *data) ;
-int xmlListAppend (xmlListPtr l,
- void *data) ;
-int xmlListRemoveFirst (xmlListPtr l,
- void *data);
-int xmlListRemoveLast (xmlListPtr l,
- void *data);
-int xmlListRemoveAll (xmlListPtr l,
- void *data);
-void xmlListClear (xmlListPtr l);
-int xmlListEmpty (xmlListPtr l);
-xmlLinkPtr xmlListFront (xmlListPtr l);
-xmlLinkPtr xmlListEnd (xmlListPtr l);
-int xmlListSize (xmlListPtr l);
-
-void xmlListPopFront (xmlListPtr l);
-void xmlListPopBack (xmlListPtr l);
-int xmlListPushFront (xmlListPtr l,
- void *data);
-int xmlListPushBack (xmlListPtr l,
- void *data);
-
-/* Advanced Operators */
-void xmlListReverse (xmlListPtr l);
-void xmlListSort (xmlListPtr l);
-void xmlListWalk (xmlListPtr l,
- xmlListWalker walker,
- const void *user);
-void xmlListReverseWalk (xmlListPtr l,
- xmlListWalker walker,
- const void *user);
-void xmlListMerge (xmlListPtr l1,
- xmlListPtr l2);
-xmlListPtr xmlListDup (const xmlListPtr old);
-int xmlListCopy (xmlListPtr cur,
- const xmlListPtr old);
-/* Link operators */
-void * xmlLinkGetData (xmlLinkPtr lk);
-
-/* xmlListUnique() */
-/* xmlListSwap */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __XML_LINK_INCLUDE__ */
diff --git a/bundle/libxml/include/libxml/nanoftp.h b/bundle/libxml/include/libxml/nanoftp.h
deleted file mode 100644
index a0ba2ceeb3..0000000000
--- a/bundle/libxml/include/libxml/nanoftp.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * nanohttp.c: minimalist FTP implementation to fetch external subsets.
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __NANO_FTP_H__
-#define __NANO_FTP_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_FTP_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * ftpListCallback:
- * @userData: user provided data for the callback
- * @filename: the file name (including "->" when links are shown)
- * @attrib: the attribute string
- * @owner: the owner string
- * @group: the group string
- * @size: the file size
- * @links: the link count
- * @year: the year
- * @month: the month
- * @day: the day
- * @hour: the hour
- * @minute: the minute
- *
- * A callback for the xmlNanoFTPList command.
- * Note that only one of year and day:minute are specified.
- */
-typedef void (*ftpListCallback) (void *userData,
- const char *filename, const char *attrib,
- const char *owner, const char *group,
- unsigned long size, int links, int year,
- const char *month, int day, int hour,
- int minute);
-/**
- * ftpDataCallback:
- * @userData: the user provided context
- * @data: the data received
- * @len: its size in bytes
- *
- * A callback for the xmlNanoFTPGet command.
- */
-typedef void (*ftpDataCallback) (void *userData,
- const char *data,
- int len);
-
-/*
- * Init
- */
-void xmlNanoFTPInit (void);
-void xmlNanoFTPCleanup (void);
-
-/*
- * Creating/freeing contexts.
- */
-void * xmlNanoFTPNewCtxt (const char *URL);
-void xmlNanoFTPFreeCtxt (void * ctx);
-void * xmlNanoFTPConnectTo (const char *server,
- int port);
-/*
- * Opening/closing session connections.
- */
-void * xmlNanoFTPOpen (const char *URL);
-int xmlNanoFTPConnect (void *ctx);
-int xmlNanoFTPClose (void *ctx);
-int xmlNanoFTPQuit (void *ctx);
-void xmlNanoFTPScanProxy (const char *URL);
-void xmlNanoFTPProxy (const char *host,
- int port,
- const char *user,
- const char *passwd,
- int type);
-int xmlNanoFTPUpdateURL (void *ctx,
- const char *URL);
-
-/*
- * Rather internal commands.
- */
-int xmlNanoFTPGetResponse (void *ctx);
-int xmlNanoFTPCheckResponse (void *ctx);
-
-/*
- * CD/DIR/GET handlers.
- */
-int xmlNanoFTPCwd (void *ctx,
- char *directory);
-
-int xmlNanoFTPGetConnection (void *ctx);
-int xmlNanoFTPCloseConnection(void *ctx);
-int xmlNanoFTPList (void *ctx,
- ftpListCallback callback,
- void *userData,
- char *filename);
-int xmlNanoFTPGetSocket (void *ctx,
- const char *filename);
-int xmlNanoFTPGet (void *ctx,
- ftpDataCallback callback,
- void *userData,
- const char *filename);
-int xmlNanoFTPRead (void *ctx,
- void *dest,
- int len);
-
-#ifdef __cplusplus
-}
-#endif /* LIBXML_FTP_ENABLED */
-#endif
-#endif /* __NANO_FTP_H__ */
diff --git a/bundle/libxml/include/libxml/nanohttp.h b/bundle/libxml/include/libxml/nanohttp.h
deleted file mode 100644
index 4fb4e1d256..0000000000
--- a/bundle/libxml/include/libxml/nanohttp.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * nanohttp.c: minimalist HTTP implementation to fetch external subsets.
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __NANO_HTTP_H__
-#define __NANO_HTTP_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_HTTP_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-void xmlNanoHTTPInit (void);
-void xmlNanoHTTPCleanup (void);
-void xmlNanoHTTPScanProxy (const char *URL);
-int xmlNanoHTTPFetch (const char *URL,
- const char *filename,
- char **contentType);
-void * xmlNanoHTTPMethod (const char *URL,
- const char *method,
- const char *input,
- char **contentType,
- const char *headers,
- int ilen);
-void * xmlNanoHTTPMethodRedir (const char *URL,
- const char *method,
- const char *input,
- char **contentType,
- char **redir,
- const char *headers,
- int ilen);
-void * xmlNanoHTTPOpen (const char *URL,
- char **contentType);
-void * xmlNanoHTTPOpenRedir (const char *URL,
- char **contentType,
- char **redir);
-int xmlNanoHTTPReturnCode (void *ctx);
-const char * xmlNanoHTTPAuthHeader(void *ctx);
-int xmlNanoHTTPRead (void *ctx,
- void *dest,
- int len);
-int xmlNanoHTTPSave (void *ctxt,
- const char *filename);
-void xmlNanoHTTPClose (void *ctx);
-#ifdef __cplusplus
-}
-
-#endif /* LIBXML_HTTP_ENABLED */
-#endif
-#endif /* __NANO_HTTP_H__ */
diff --git a/bundle/libxml/include/libxml/parser.h b/bundle/libxml/include/libxml/parser.h
deleted file mode 100644
index e6725a364d..0000000000
--- a/bundle/libxml/include/libxml/parser.h
+++ /dev/null
@@ -1,869 +0,0 @@
-/*
- * parser.h : Interfaces, constants and types related to the XML parser.
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __XML_PARSER_H__
-#define __XML_PARSER_H__
-
-#include <libxml/tree.h>
-#include <libxml/valid.h>
-#include <libxml/entities.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * XML_DEFAULT_VERSION:
- *
- * The default version of XML used: 1.0
- */
-#define XML_DEFAULT_VERSION "1.0"
-
-/**
- * xmlParserInput:
- *
- * An xmlParserInput is an input flow for the XML processor.
- * Each entity parsed is associated an xmlParserInput (except the
- * few predefined ones). This is the case both for internal entities
- * - in which case the flow is already completely in memory - or
- * external entities - in which case we use the buf structure for
- * progressive reading and I18N conversions to the internal UTF-8 format.
- */
-
-/**
- * xmlParserInputDeallocate:
- * @str: the string to deallocate
- *
- * Callback for freeing some parser input allocations.
- */
-typedef void (* xmlParserInputDeallocate)(xmlChar *str);
-
-struct _xmlParserInput {
- /* Input buffer */
- xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */
-
- const char *filename; /* The file analyzed, if any */
- const char *directory; /* the directory/base of the file */
- const xmlChar *base; /* Base of the array to parse */
- const xmlChar *cur; /* Current char being parsed */
- const xmlChar *end; /* end of the array to parse */
- int length; /* length if known */
- int line; /* Current line */
- int col; /* Current column */
- int consumed; /* How many xmlChars already consumed */
- xmlParserInputDeallocate free; /* function to deallocate the base */
- const xmlChar *encoding; /* the encoding string for entity */
- const xmlChar *version; /* the version string for entity */
- int standalone; /* Was that entity marked standalone */
-};
-
-/**
- * xmlParserNodeInfo:
- *
- * The parser can be asked to collect Node informations, i.e. at what
- * place in the file they were detected.
- * NOTE: This is off by default and not very well tested.
- */
-typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
-typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
-
-struct _xmlParserNodeInfo {
- const struct _xmlNode* node;
- /* Position & line # that text that created the node begins & ends on */
- unsigned long begin_pos;
- unsigned long begin_line;
- unsigned long end_pos;
- unsigned long end_line;
-};
-
-typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
-typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
-struct _xmlParserNodeInfoSeq {
- unsigned long maximum;
- unsigned long length;
- xmlParserNodeInfo* buffer;
-};
-
-/**
- * xmlParserInputState:
- *
- * The parser is now working also as a state based parser.
- * The recursive one use the state info for entities processing.
- */
-typedef enum {
- XML_PARSER_EOF = -1, /* nothing is to be parsed */
- XML_PARSER_START = 0, /* nothing has been parsed */
- XML_PARSER_MISC, /* Misc* before int subset */
- XML_PARSER_PI, /* Within a processing instruction */
- XML_PARSER_DTD, /* within some DTD content */
- XML_PARSER_PROLOG, /* Misc* after internal subset */
- XML_PARSER_COMMENT, /* within a comment */
- XML_PARSER_START_TAG, /* within a start tag */
- XML_PARSER_CONTENT, /* within the content */
- XML_PARSER_CDATA_SECTION, /* within a CDATA section */
- XML_PARSER_END_TAG, /* within a closing tag */
- XML_PARSER_ENTITY_DECL, /* within an entity declaration */
- XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
- XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
- XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
- XML_PARSER_EPILOG, /* the Misc* after the last end tag */
- XML_PARSER_IGNORE, /* within an IGNORED section */
- XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */
-} xmlParserInputState;
-
-/**
- * XML_DETECT_IDS:
- *
- * Bit in the loadsubset context field to tell to do ID/REFs lookups.
- * Use it to initialize xmlLoadExtDtdDefaultValue.
- */
-#define XML_DETECT_IDS 2
-
-/**
- * XML_COMPLETE_ATTRS:
- *
- * Bit in the loadsubset context field to tell to do complete the
- * elements attributes lists with the ones defaulted from the DTDs.
- * Use it to initialize xmlLoadExtDtdDefaultValue.
- */
-#define XML_COMPLETE_ATTRS 4
-
-/**
- * xmlParserCtxt:
- *
- * The parser context.
- * NOTE This doesn't completely define the parser state, the (current ?)
- * design of the parser uses recursive function calls since this allow
- * and easy mapping from the production rules of the specification
- * to the actual code. The drawback is that the actual function call
- * also reflect the parser state. However most of the parsing routines
- * takes as the only argument the parser context pointer, so migrating
- * to a state based parser for progressive parsing shouldn't be too hard.
- */
-struct _xmlParserCtxt {
- struct _xmlSAXHandler *sax; /* The SAX handler */
- void *userData; /* For SAX interface only, used by DOM build */
- xmlDocPtr myDoc; /* the document being built */
- int wellFormed; /* is the document well formed */
- int replaceEntities; /* shall we replace entities ? */
- const xmlChar *version; /* the XML version string */
- const xmlChar *encoding; /* the declared encoding, if any */
- int standalone; /* standalone document */
- int html; /* an HTML(1)/Docbook(2) document */
-
- /* Input stream stack */
- xmlParserInputPtr input; /* Current input stream */
- int inputNr; /* Number of current input streams */
- int inputMax; /* Max number of input streams */
- xmlParserInputPtr *inputTab; /* stack of inputs */
-
- /* Node analysis stack only used for DOM building */
- xmlNodePtr node; /* Current parsed Node */
- int nodeNr; /* Depth of the parsing stack */
- int nodeMax; /* Max depth of the parsing stack */
- xmlNodePtr *nodeTab; /* array of nodes */
-
- int record_info; /* Whether node info should be kept */
- xmlParserNodeInfoSeq node_seq; /* info about each node parsed */
-
- int errNo; /* error code */
-
- int hasExternalSubset; /* reference and external subset */
- int hasPErefs; /* the internal subset has PE refs */
- int external; /* are we parsing an external entity */
-
- int valid; /* is the document valid */
- int validate; /* shall we try to validate ? */
- xmlValidCtxt vctxt; /* The validity context */
-
- xmlParserInputState instate; /* current type of input */
- int token; /* next char look-ahead */
-
- char *directory; /* the data directory */
-
- /* Node name stack */
- xmlChar *name; /* Current parsed Node */
- int nameNr; /* Depth of the parsing stack */
- int nameMax; /* Max depth of the parsing stack */
- xmlChar * *nameTab; /* array of nodes */
-
- long nbChars; /* number of xmlChar processed */
- long checkIndex; /* used by progressive parsing lookup */
- int keepBlanks; /* ugly but ... */
- int disableSAX; /* SAX callbacks are disabled */
- int inSubset; /* Parsing is in int 1/ext 2 subset */
- xmlChar * intSubName; /* name of subset */
- xmlChar * extSubURI; /* URI of external subset */
- xmlChar * extSubSystem; /* SYSTEM ID of external subset */
-
- /* xml:space values */
- int * space; /* Should the parser preserve spaces */
- int spaceNr; /* Depth of the parsing stack */
- int spaceMax; /* Max depth of the parsing stack */
- int * spaceTab; /* array of space infos */
-
- int depth; /* to prevent entity substitution loops */
- xmlParserInputPtr entity; /* used to check entities boundaries */
- int charset; /* encoding of the in-memory content
- actually an xmlCharEncoding */
- int nodelen; /* Those two fields are there to */
- int nodemem; /* Speed up large node parsing */
- int pedantic; /* signal pedantic warnings */
- void *_private; /* For user data, libxml won't touch it */
-
- int loadsubset; /* should the external subset be loaded */
- int linenumbers; /* set line number in element content */
- void *catalogs; /* document's own catalog */
- int recovery; /* run in recovery mode */
-};
-
-/**
- * xmlSAXLocator:
- *
- * A SAX Locator.
- */
-struct _xmlSAXLocator {
- const xmlChar *(*getPublicId)(void *ctx);
- const xmlChar *(*getSystemId)(void *ctx);
- int (*getLineNumber)(void *ctx);
- int (*getColumnNumber)(void *ctx);
-};
-
-/**
- * xmlSAXHandler:
- *
- * A SAX handler is bunch of callbacks called by the parser when processing
- * of the input generate data or structure informations.
- */
-
-/**
- * resolveEntitySAXFunc:
- * @ctx: the user data (XML parser context)
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- *
- * Callback:
- * The entity loader, to control the loading of external entities,
- * the application can either:
- * - override this resolveEntity() callback in the SAX block
- * - or better use the xmlSetExternalEntityLoader() function to
- * set up it's own entity resolution routine
- *
- * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
- */
-typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
- const xmlChar *publicId,
- const xmlChar *systemId);
-/**
- * internalSubsetSAXFunc:
- * @ctx: the user data (XML parser context)
- * @name: the root element name
- * @ExternalID: the external ID
- * @SystemID: the SYSTEM ID (e.g. filename or URL)
- *
- * Callback on internal subset declaration.
- */
-typedef void (*internalSubsetSAXFunc) (void *ctx,
- const xmlChar *name,
- const xmlChar *ExternalID,
- const xmlChar *SystemID);
-/**
- * externalSubsetSAXFunc:
- * @ctx: the user data (XML parser context)
- * @name: the root element name
- * @ExternalID: the external ID
- * @SystemID: the SYSTEM ID (e.g. filename or URL)
- *
- * Callback on external subset declaration.
- */
-typedef void (*externalSubsetSAXFunc) (void *ctx,
- const xmlChar *name,
- const xmlChar *ExternalID,
- const xmlChar *SystemID);
-/**
- * getEntitySAXFunc:
- * @ctx: the user data (XML parser context)
- * @name: The entity name
- *
- * Get an entity by name.
- *
- * Returns the xmlEntityPtr if found.
- */
-typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
- const xmlChar *name);
-/**
- * getParameterEntitySAXFunc:
- * @ctx: the user data (XML parser context)
- * @name: The entity name
- *
- * Get a parameter entity by name.
- *
- * Returns the xmlEntityPtr if found.
- */
-typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
- const xmlChar *name);
-/**
- * entityDeclSAXFunc:
- * @ctx: the user data (XML parser context)
- * @name: the entity name
- * @type: the entity type
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- * @content: the entity value (without processing).
- *
- * An entity definition has been parsed.
- */
-typedef void (*entityDeclSAXFunc) (void *ctx,
- const xmlChar *name,
- int type,
- const xmlChar *publicId,
- const xmlChar *systemId,
- xmlChar *content);
-/**
- * notationDeclSAXFunc:
- * @ctx: the user data (XML parser context)
- * @name: The name of the notation
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- *
- * What to do when a notation declaration has been parsed.
- */
-typedef void (*notationDeclSAXFunc)(void *ctx,
- const xmlChar *name,
- const xmlChar *publicId,
- const xmlChar *systemId);
-/**
- * attributeDeclSAXFunc:
- * @ctx: the user data (XML parser context)
- * @elem: the name of the element
- * @fullname: the attribute name
- * @type: the attribute type
- * @def: the type of default value
- * @defaultValue: the attribute default value
- * @tree: the tree of enumerated value set
- *
- * An attribute definition has been parsed.
- */
-typedef void (*attributeDeclSAXFunc)(void *ctx,
- const xmlChar *elem,
- const xmlChar *fullname,
- int type,
- int def,
- const xmlChar *defaultValue,
- xmlEnumerationPtr tree);
-/**
- * elementDeclSAXFunc:
- * @ctx: the user data (XML parser context)
- * @name: the element name
- * @type: the element type
- * @content: the element value tree
- *
- * An element definition has been parsed.
- */
-typedef void (*elementDeclSAXFunc)(void *ctx,
- const xmlChar *name,
- int type,
- xmlElementContentPtr content);
-/**
- * unparsedEntityDeclSAXFunc:
- * @ctx: the user data (XML parser context)
- * @name: The name of the entity
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- * @notationName: the name of the notation
- *
- * What to do when an unparsed entity declaration is parsed.
- */
-typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
- const xmlChar *name,
- const xmlChar *publicId,
- const xmlChar *systemId,
- const xmlChar *notationName);
-/**
- * setDocumentLocatorSAXFunc:
- * @ctx: the user data (XML parser context)
- * @loc: A SAX Locator
- *
- * Receive the document locator at startup, actually xmlDefaultSAXLocator.
- * Everything is available on the context, so this is useless in our case.
- */
-typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
- xmlSAXLocatorPtr loc);
-/**
- * startDocumentSAXFunc:
- * @ctx: the user data (XML parser context)
- *
- * Called when the document start being processed.
- */
-typedef void (*startDocumentSAXFunc) (void *ctx);
-/**
- * endDocumentSAXFunc:
- * @ctx: the user data (XML parser context)
- *
- * Called when the document end has been detected.
- */
-typedef void (*endDocumentSAXFunc) (void *ctx);
-/**
- * startElementSAXFunc:
- * @ctx: the user data (XML parser context)
- * @name: The element name, including namespace prefix
- * @atts: An array of name/value attributes pairs, NULL terminated
- *
- * Called when an opening tag has been processed.
- */
-typedef void (*startElementSAXFunc) (void *ctx,
- const xmlChar *name,
- const xmlChar **atts);
-/**
- * endElementSAXFunc:
- * @ctx: the user data (XML parser context)
- * @name: The element name
- *
- * Called when the end of an element has been detected.
- */
-typedef void (*endElementSAXFunc) (void *ctx,
- const xmlChar *name);
-/**
- * attributeSAXFunc:
- * @ctx: the user data (XML parser context)
- * @name: The attribute name, including namespace prefix
- * @value: The attribute value
- *
- * Handle an attribute that has been read by the parser.
- * The default handling is to convert the attribute into an
- * DOM subtree and past it in a new xmlAttr element added to
- * the element.
- */
-typedef void (*attributeSAXFunc) (void *ctx,
- const xmlChar *name,
- const xmlChar *value);
-/**
- * referenceSAXFunc:
- * @ctx: the user data (XML parser context)
- * @name: The entity name
- *
- * Called when an entity reference is detected.
- */
-typedef void (*referenceSAXFunc) (void *ctx,
- const xmlChar *name);
-/**
- * charactersSAXFunc:
- * @ctx: the user data (XML parser context)
- * @ch: a xmlChar string
- * @len: the number of xmlChar
- *
- * Receiving some chars from the parser.
- */
-typedef void (*charactersSAXFunc) (void *ctx,
- const xmlChar *ch,
- int len);
-/**
- * ignorableWhitespaceSAXFunc:
- * @ctx: the user data (XML parser context)
- * @ch: a xmlChar string
- * @len: the number of xmlChar
- *
- * Receiving some ignorable whitespaces from the parser.
- * UNUSED: by default the DOM building will use characters.
- */
-typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
- const xmlChar *ch,
- int len);
-/**
- * processingInstructionSAXFunc:
- * @ctx: the user data (XML parser context)
- * @target: the target name
- * @data: the PI data's
- *
- * A processing instruction has been parsed.
- */
-typedef void (*processingInstructionSAXFunc) (void *ctx,
- const xmlChar *target,
- const xmlChar *data);
-/**
- * commentSAXFunc:
- * @ctx: the user data (XML parser context)
- * @value: the comment content
- *
- * A comment has been parsed.
- */
-typedef void (*commentSAXFunc) (void *ctx,
- const xmlChar *value);
-/**
- * cdataBlockSAXFunc:
- * @ctx: the user data (XML parser context)
- * @value: The pcdata content
- * @len: the block length
- *
- * Called when a pcdata block has been parsed.
- */
-typedef void (*cdataBlockSAXFunc) (
- void *ctx,
- const xmlChar *value,
- int len);
-/**
- * warningSAXFunc:
- * @ctx: an XML parser context
- * @msg: the message to display/transmit
- * @...: extra parameters for the message display
- *
- * Display and format a warning messages, callback.
- */
-typedef void (*warningSAXFunc) (void *ctx,
- const char *msg, ...);
-/**
- * errorSAXFunc:
- * @ctx: an XML parser context
- * @msg: the message to display/transmit
- * @...: extra parameters for the message display
- *
- * Display and format an error messages, callback.
- */
-typedef void (*errorSAXFunc) (void *ctx,
- const char *msg, ...);
-/**
- * fatalErrorSAXFunc:
- * @ctx: an XML parser context
- * @msg: the message to display/transmit
- * @...: extra parameters for the message display
- *
- * Display and format fatal error messages, callback.
- * Note: so far fatalError() SAX callbacks are not used, error()
- * get all the callbacks for errors.
- */
-typedef void (*fatalErrorSAXFunc) (void *ctx,
- const char *msg, ...);
-/**
- * isStandaloneSAXFunc:
- * @ctx: the user data (XML parser context)
- *
- * Is this document tagged standalone?
- *
- * Returns 1 if true
- */
-typedef int (*isStandaloneSAXFunc) (void *ctx);
-/**
- * hasInternalSubsetSAXFunc:
- * @ctx: the user data (XML parser context)
- *
- * Does this document has an internal subset.
- *
- * Returns 1 if true
- */
-typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
-/**
- * hasExternalSubsetSAXFunc:
- * @ctx: the user data (XML parser context)
- *
- * Does this document has an external subset?
- *
- * Returns 1 if true
- */
-typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
-
-struct _xmlSAXHandler {
- internalSubsetSAXFunc internalSubset;
- isStandaloneSAXFunc isStandalone;
- hasInternalSubsetSAXFunc hasInternalSubset;
- hasExternalSubsetSAXFunc hasExternalSubset;
- resolveEntitySAXFunc resolveEntity;
- getEntitySAXFunc getEntity;
- entityDeclSAXFunc entityDecl;
- notationDeclSAXFunc notationDecl;
- attributeDeclSAXFunc attributeDecl;
- elementDeclSAXFunc elementDecl;
- unparsedEntityDeclSAXFunc unparsedEntityDecl;
- setDocumentLocatorSAXFunc setDocumentLocator;
- startDocumentSAXFunc startDocument;
- endDocumentSAXFunc endDocument;
- startElementSAXFunc startElement;
- endElementSAXFunc endElement;
- referenceSAXFunc reference;
- charactersSAXFunc characters;
- ignorableWhitespaceSAXFunc ignorableWhitespace;
- processingInstructionSAXFunc processingInstruction;
- commentSAXFunc comment;
- warningSAXFunc warning;
- errorSAXFunc error;
- fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
- getParameterEntitySAXFunc getParameterEntity;
- cdataBlockSAXFunc cdataBlock;
- externalSubsetSAXFunc externalSubset;
- int initialized;
-};
-
-/**
- * xmlExternalEntityLoader:
- * @URL: The System ID of the resource requested
- * @ID: The Public ID of the resource requested
- * @context: the XML parser context
- *
- * External entity loaders types.
- *
- * Returns the entity input parser.
- */
-typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
- const char *ID,
- xmlParserCtxtPtr context);
-
-/*
- * Global variables: just the default SAX interface tables and XML
- * version infos.
- */
-#if 0
-LIBXML_DLL_IMPORT extern const char *xmlParserVersion;
-#endif
-
-/*
-LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
-LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler;
-LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler;
-LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler;
- */
-
-/*
- * Entity substitution default behavior.
- */
-
-#if 0
-LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
-LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#include <libxml/encoding.h>
-#include <libxml/xmlIO.h>
-#include <libxml/globals.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
- * Init/Cleanup
- */
-void xmlInitParser (void);
-void xmlCleanupParser (void);
-
-/*
- * Input functions
- */
-int xmlParserInputRead (xmlParserInputPtr in,
- int len);
-int xmlParserInputGrow (xmlParserInputPtr in,
- int len);
-
-/*
- * xmlChar handling
- */
-xmlChar * xmlStrdup (const xmlChar *cur);
-xmlChar * xmlStrndup (const xmlChar *cur,
- int len);
-xmlChar * xmlCharStrndup (const char *cur,
- int len);
-xmlChar * xmlCharStrdup (const char *cur);
-xmlChar * xmlStrsub (const xmlChar *str,
- int start,
- int len);
-const xmlChar * xmlStrchr (const xmlChar *str,
- xmlChar val);
-const xmlChar * xmlStrstr (const xmlChar *str,
- const xmlChar *val);
-const xmlChar * xmlStrcasestr (const xmlChar *str,
- xmlChar *val);
-int xmlStrcmp (const xmlChar *str1,
- const xmlChar *str2);
-int xmlStrncmp (const xmlChar *str1,
- const xmlChar *str2,
- int len);
-int xmlStrcasecmp (const xmlChar *str1,
- const xmlChar *str2);
-int xmlStrncasecmp (const xmlChar *str1,
- const xmlChar *str2,
- int len);
-int xmlStrEqual (const xmlChar *str1,
- const xmlChar *str2);
-int xmlStrlen (const xmlChar *str);
-xmlChar * xmlStrcat (xmlChar *cur,
- const xmlChar *add);
-xmlChar * xmlStrncat (xmlChar *cur,
- const xmlChar *add,
- int len);
-
-/*
- * Basic parsing Interfaces
- */
-xmlDocPtr xmlParseDoc (xmlChar *cur);
-xmlDocPtr xmlParseMemory (const char *buffer,
- int size);
-xmlDocPtr xmlParseFile (const char *filename);
-int xmlSubstituteEntitiesDefault(int val);
-int xmlKeepBlanksDefault (int val);
-void xmlStopParser (xmlParserCtxtPtr ctxt);
-int xmlPedanticParserDefault(int val);
-int xmlLineNumbersDefault (int val);
-
-/*
- * Recovery mode
- */
-xmlDocPtr xmlRecoverDoc (xmlChar *cur);
-xmlDocPtr xmlRecoverMemory (const char *buffer,
- int size);
-xmlDocPtr xmlRecoverFile (const char *filename);
-
-/*
- * Less common routines and SAX interfaces
- */
-int xmlParseDocument (xmlParserCtxtPtr ctxt);
-int xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
-xmlDocPtr xmlSAXParseDoc (xmlSAXHandlerPtr sax,
- xmlChar *cur,
- int recovery);
-int xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
- void *user_data,
- const char *filename);
-int xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
- void *user_data,
- const char *buffer,
- int size);
-xmlDocPtr xmlSAXParseMemory (xmlSAXHandlerPtr sax,
- const char *buffer,
- int size,
- int recovery);
-xmlDocPtr xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
- const char *buffer,
- int size,
- int recovery,
- void *data);
-xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax,
- const char *filename,
- int recovery);
-xmlDocPtr xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
- const char *filename,
- int recovery,
- void *data);
-xmlDocPtr xmlSAXParseEntity (xmlSAXHandlerPtr sax,
- const char *filename);
-xmlDocPtr xmlParseEntity (const char *filename);
-xmlDtdPtr xmlParseDTD (const xmlChar *ExternalID,
- const xmlChar *SystemID);
-xmlDtdPtr xmlSAXParseDTD (xmlSAXHandlerPtr sax,
- const xmlChar *ExternalID,
- const xmlChar *SystemID);
-xmlDtdPtr xmlIOParseDTD (xmlSAXHandlerPtr sax,
- xmlParserInputBufferPtr input,
- xmlCharEncoding enc);
-int xmlParseBalancedChunkMemory(xmlDocPtr doc,
- xmlSAXHandlerPtr sax,
- void *user_data,
- int depth,
- const xmlChar *string,
- xmlNodePtr *lst);
-int xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
- xmlSAXHandlerPtr sax,
- void *user_data,
- int depth,
- const xmlChar *string,
- xmlNodePtr *lst,
- int recover);
-int xmlParseExternalEntity (xmlDocPtr doc,
- xmlSAXHandlerPtr sax,
- void *user_data,
- int depth,
- const xmlChar *URL,
- const xmlChar *ID,
- xmlNodePtr *lst);
-int xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
- const xmlChar *URL,
- const xmlChar *ID,
- xmlNodePtr *lst);
-
-/*
- * Parser contexts handling.
- */
-void xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
-void xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
-void xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
-void xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
- const xmlChar* buffer,
- const char *filename);
-xmlParserCtxtPtr xmlCreateDocParserCtxt (xmlChar *cur);
-
-/*
- * Reading/setting optional parsing features.
- */
-
-int xmlGetFeaturesList (int *len,
- const char **result);
-int xmlGetFeature (xmlParserCtxtPtr ctxt,
- const char *name,
- void *result);
-int xmlSetFeature (xmlParserCtxtPtr ctxt,
- const char *name,
- void *value);
-
-/*
- * Interfaces for the Push mode.
- */
-xmlParserCtxtPtr xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
- void *user_data,
- const char *chunk,
- int size,
- const char *filename);
-int xmlParseChunk (xmlParserCtxtPtr ctxt,
- const char *chunk,
- int size,
- int terminate);
-
-/*
- * Special I/O mode.
- */
-
-xmlParserCtxtPtr xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
- void *user_data,
- xmlInputReadCallback ioread,
- xmlInputCloseCallback ioclose,
- void *ioctx,
- xmlCharEncoding enc);
-
-xmlParserInputPtr xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
- xmlParserInputBufferPtr input,
- xmlCharEncoding enc);
-
-/*
- * Node infos.
- */
-const xmlParserNodeInfo*
- xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt,
- const xmlNodePtr node);
-void xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
-void xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
-unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
- const xmlNodePtr node);
-void xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
- const xmlParserNodeInfoPtr info);
-
-/*
- * External entities handling actually implemented in xmlIO.
- */
-
-void xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
-xmlExternalEntityLoader
- xmlGetExternalEntityLoader(void);
-xmlParserInputPtr
- xmlLoadExternalEntity (const char *URL,
- const char *ID,
- xmlParserCtxtPtr ctxt);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_PARSER_H__ */
-
diff --git a/bundle/libxml/include/libxml/parserInternals.h b/bundle/libxml/include/libxml/parserInternals.h
deleted file mode 100644
index 8507442be8..0000000000
--- a/bundle/libxml/include/libxml/parserInternals.h
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * parserInternals.h : internals routines exported by the parser.
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- *
- */
-
-#ifndef __XML_PARSER_INTERNALS_H__
-#define __XML_PARSER_INTERNALS_H__
-
-#include <libxml/parser.h>
-#include <libxml/HTMLparser.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /**
- * XML_MAX_NAMELEN:
- *
- * Identifiers can be longer, but this will be more costly
- * at runtime.
- */
-#define XML_MAX_NAMELEN 100
-
-/**
- * INPUT_CHUNK:
- *
- * The parser tries to always have that amount of input ready.
- * One of the point is providing context when reporting errors.
- */
-#define INPUT_CHUNK 250
-
-/************************************************************************
- * *
- * UNICODE version of the macros. *
- * *
- ************************************************************************/
-/**
- * IS_CHAR:
- * @c: an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
- * | [#x10000-#x10FFFF]
- * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
- */
-#define IS_CHAR(c) \
- ((((c) >= 0x20) && ((c) <= 0xD7FF)) || \
- ((c) == 0x09) || ((c) == 0x0A) || ((c) == 0x0D) || \
- (((c) >= 0xE000) && ((c) <= 0xFFFD)) || \
- (((c) >= 0x10000) && ((c) <= 0x10FFFF)))
-
-/**
- * IS_BLANK:
- * @c: an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- * [3] S ::= (#x20 | #x9 | #xD | #xA)+
- */
-#define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) || \
- ((c) == 0x0D))
-
-/**
- * IS_BASECHAR:
- * @c: an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- * [85] BaseChar ::= ... long list see REC ...
- */
-#define IS_BASECHAR(c) xmlIsBaseChar(c)
-
-/**
- * IS_DIGIT:
- * @c: an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- * [88] Digit ::= ... long list see REC ...
- */
-#define IS_DIGIT(c) xmlIsDigit(c)
-
-/**
- * IS_COMBINING:
- * @c: an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- * [87] CombiningChar ::= ... long list see REC ...
- */
-#define IS_COMBINING(c) xmlIsCombining(c)
-
-/**
- * IS_EXTENDER:
- * @c: an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- *
- * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
- * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
- * [#x309D-#x309E] | [#x30FC-#x30FE]
- */
-#define IS_EXTENDER(c) xmlIsExtender(c)
-
-/**
- * IS_IDEOGRAPHIC:
- * @c: an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- *
- * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
- */
-#define IS_IDEOGRAPHIC(c) xmlIsIdeographic(c)
-
-/**
- * IS_LETTER:
- * @c: an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- *
- * [84] Letter ::= BaseChar | Ideographic
- */
-#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
-
-
-/**
- * IS_PUBIDCHAR:
- * @c: an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- *
- * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
- */
-#define IS_PUBIDCHAR(c) xmlIsPubidChar(c)
-
-/**
- * SKIP_EOL:
- * @p: and UTF8 string pointer
- *
- * Skips the end of line chars.
- */
-#define SKIP_EOL(p) \
- if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \
- if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
-
-/**
- * MOVETO_ENDTAG:
- * @p: and UTF8 string pointer
- *
- * Skips to the next '>' char.
- */
-#define MOVETO_ENDTAG(p) \
- while ((*p) && (*(p) != '>')) (p)++
-
-/**
- * MOVETO_STARTTAG:
- * @p: and UTF8 string pointer
- *
- * Skips to the next '<' char.
- */
-#define MOVETO_STARTTAG(p) \
- while ((*p) && (*(p) != '<')) (p)++
-
-/**
- * Global variables used for predefined strings.
- */
-LIBXML_DLL_IMPORT extern const xmlChar xmlStringText[];
-LIBXML_DLL_IMPORT extern const xmlChar xmlStringTextNoenc[];
-LIBXML_DLL_IMPORT extern const xmlChar xmlStringComment[];
-
-/*
- * Function to finish the work of the macros where needed.
- */
-int xmlIsBaseChar (int c);
-int xmlIsBlank (int c);
-int xmlIsPubidChar (int c);
-int xmlIsLetter (int c);
-int xmlIsDigit (int c);
-int xmlIsIdeographic(int c);
-int xmlIsExtender (int c);
-int xmlIsCombining (int c);
-int xmlIsChar (int c);
-
-/**
- * Parser context.
- */
-xmlParserCtxtPtr xmlCreateFileParserCtxt (const char *filename);
-xmlParserCtxtPtr xmlCreateMemoryParserCtxt(const char *buffer,
- int size);
-xmlParserCtxtPtr xmlNewParserCtxt (void);
-xmlParserCtxtPtr xmlCreateEntityParserCtxt(const xmlChar *URL,
- const xmlChar *ID,
- const xmlChar *base);
-int xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
- xmlCharEncoding enc);
-int xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
- xmlCharEncodingHandlerPtr handler);
-
-/**
- * Entities
- */
-void xmlHandleEntity (xmlParserCtxtPtr ctxt,
- xmlEntityPtr entity);
-
-/**
- * Input Streams.
- */
-xmlParserInputPtr xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
- const xmlChar *buffer);
-xmlParserInputPtr xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
- xmlEntityPtr entity);
-void xmlPushInput (xmlParserCtxtPtr ctxt,
- xmlParserInputPtr input);
-xmlChar xmlPopInput (xmlParserCtxtPtr ctxt);
-void xmlFreeInputStream (xmlParserInputPtr input);
-xmlParserInputPtr xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
- const char *filename);
-xmlParserInputPtr xmlNewInputStream (xmlParserCtxtPtr ctxt);
-
-/**
- * Namespaces.
- */
-xmlChar * xmlSplitQName (xmlParserCtxtPtr ctxt,
- const xmlChar *name,
- xmlChar **prefix);
-xmlChar * xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt);
-xmlChar * xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
- xmlChar **prefix);
-xmlChar * xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt);
-xmlChar * xmlParseQuotedString (xmlParserCtxtPtr ctxt);
-void xmlParseNamespace (xmlParserCtxtPtr ctxt);
-
-/**
- * Generic production rules.
- */
-xmlChar * xmlScanName (xmlParserCtxtPtr ctxt);
-xmlChar * xmlParseName (xmlParserCtxtPtr ctxt);
-xmlChar * xmlParseNmtoken (xmlParserCtxtPtr ctxt);
-xmlChar * xmlParseEntityValue (xmlParserCtxtPtr ctxt,
- xmlChar **orig);
-xmlChar * xmlParseAttValue (xmlParserCtxtPtr ctxt);
-xmlChar * xmlParseSystemLiteral (xmlParserCtxtPtr ctxt);
-xmlChar * xmlParsePubidLiteral (xmlParserCtxtPtr ctxt);
-void xmlParseCharData (xmlParserCtxtPtr ctxt,
- int cdata);
-xmlChar * xmlParseExternalID (xmlParserCtxtPtr ctxt,
- xmlChar **publicID,
- int strict);
-void xmlParseComment (xmlParserCtxtPtr ctxt);
-xmlChar * xmlParsePITarget (xmlParserCtxtPtr ctxt);
-void xmlParsePI (xmlParserCtxtPtr ctxt);
-void xmlParseNotationDecl (xmlParserCtxtPtr ctxt);
-void xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
-int xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
- xmlChar **value);
-xmlEnumerationPtr xmlParseNotationType (xmlParserCtxtPtr ctxt);
-xmlEnumerationPtr xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
-int xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
- xmlEnumerationPtr *tree);
-int xmlParseAttributeType (xmlParserCtxtPtr ctxt,
- xmlEnumerationPtr *tree);
-void xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
-xmlElementContentPtr xmlParseElementMixedContentDecl
- (xmlParserCtxtPtr ctxt,
- xmlParserInputPtr inputchk);
-xmlElementContentPtr xmlParseElementChildrenContentDecl
- (xmlParserCtxtPtr ctxt,
- xmlParserInputPtr inputchk);
-int xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
- xmlChar *name,
- xmlElementContentPtr *result);
-int xmlParseElementDecl (xmlParserCtxtPtr ctxt);
-void xmlParseMarkupDecl (xmlParserCtxtPtr ctxt);
-int xmlParseCharRef (xmlParserCtxtPtr ctxt);
-xmlEntityPtr xmlParseEntityRef (xmlParserCtxtPtr ctxt);
-void xmlParseReference (xmlParserCtxtPtr ctxt);
-void xmlParsePEReference (xmlParserCtxtPtr ctxt);
-void xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt);
-xmlChar * xmlParseAttribute (xmlParserCtxtPtr ctxt,
- xmlChar **value);
-xmlChar * xmlParseStartTag (xmlParserCtxtPtr ctxt);
-void xmlParseEndTag (xmlParserCtxtPtr ctxt);
-void xmlParseCDSect (xmlParserCtxtPtr ctxt);
-void xmlParseContent (xmlParserCtxtPtr ctxt);
-void xmlParseElement (xmlParserCtxtPtr ctxt);
-xmlChar * xmlParseVersionNum (xmlParserCtxtPtr ctxt);
-xmlChar * xmlParseVersionInfo (xmlParserCtxtPtr ctxt);
-xmlChar * xmlParseEncName (xmlParserCtxtPtr ctxt);
-xmlChar * xmlParseEncodingDecl (xmlParserCtxtPtr ctxt);
-int xmlParseSDDecl (xmlParserCtxtPtr ctxt);
-void xmlParseXMLDecl (xmlParserCtxtPtr ctxt);
-void xmlParseTextDecl (xmlParserCtxtPtr ctxt);
-void xmlParseMisc (xmlParserCtxtPtr ctxt);
-void xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
- const xmlChar *ExternalID,
- const xmlChar *SystemID);
-/**
- * XML_SUBSTITUTE_NONE:
- *
- * If no entities need to be substituted.
- */
-#define XML_SUBSTITUTE_NONE 0
-/**
- * XML_SUBSTITUTE_REF:
- *
- * Whether general entities need to be substituted.
- */
-#define XML_SUBSTITUTE_REF 1
-/**
- * XML_SUBSTITUTE_PEREF:
- *
- * Whether parameter entities need to be substituted.
- */
-#define XML_SUBSTITUTE_PEREF 2
-/**
- * XML_SUBSTITUTE_BOTH:
- *
- * Both general and parameter entities need to be substituted.
- */
-#define XML_SUBSTITUTE_BOTH 3
-
-xmlChar * xmlDecodeEntities (xmlParserCtxtPtr ctxt,
- int len,
- int what,
- xmlChar end,
- xmlChar end2,
- xmlChar end3);
-xmlChar * xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
- const xmlChar *str,
- int what,
- xmlChar end,
- xmlChar end2,
- xmlChar end3);
-
-/*
- * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
- */
-int nodePush (xmlParserCtxtPtr ctxt,
- xmlNodePtr value);
-xmlNodePtr nodePop (xmlParserCtxtPtr ctxt);
-int inputPush (xmlParserCtxtPtr ctxt,
- xmlParserInputPtr value);
-xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt);
-xmlChar *namePop (xmlParserCtxtPtr ctxt);
-int namePush (xmlParserCtxtPtr ctxt,
- xmlChar *value);
-
-/*
- * other commodities shared between parser.c and parserInternals.
- */
-int xmlSkipBlankChars (xmlParserCtxtPtr ctxt);
-int xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
- const xmlChar *cur,
- int *len);
-void xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
-void xmlParserHandleReference(xmlParserCtxtPtr ctxt);
-int xmlCheckLanguageID (const xmlChar *lang);
-
-/*
- * Really core function shared with HTML parser.
- */
-int xmlCurrentChar (xmlParserCtxtPtr ctxt,
- int *len);
-int xmlCopyCharMultiByte (xmlChar *out,
- int val);
-int xmlCopyChar (int len,
- xmlChar *out,
- int val);
-void xmlNextChar (xmlParserCtxtPtr ctxt);
-void xmlParserInputShrink (xmlParserInputPtr in);
-
-#ifdef LIBXML_HTML_ENABLED
-/*
- * Actually comes from the HTML parser but launched from the init stuff.
- */
-void htmlInitAutoClose (void);
-htmlParserCtxtPtr htmlCreateFileParserCtxt(const char *filename,
- const char *encoding);
-#endif
-
-/*
- * Specific function to keep track of entities references
- * and used by the XSLT debugger.
- */
-/**
- * xmlEntityReferenceFunc:
- * @ent: the entity
- * @firstNode: the fist node in the chunk
- * @lastNode: the last nod in the chunk
- *
- * Callback function used when one needs to be able to track back the
- * provenance of a chunk of nodes inherited from an entity replacement.
- */
-typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent,
- xmlNodePtr firstNode,
- xmlNodePtr lastNode);
-
-void xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func);
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_PARSER_INTERNALS_H__ */
diff --git a/bundle/libxml/include/libxml/schemasInternals.h b/bundle/libxml/include/libxml/schemasInternals.h
deleted file mode 100644
index 29ad862145..0000000000
--- a/bundle/libxml/include/libxml/schemasInternals.h
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * schemasInternals.h : internal interfaces for the XML Schemas handling
- * and schema validity checking
- *
- * See Copyright for the status of this software.
- *
- * Daniel.Veillard@w3.org
- */
-
-
-#ifndef __XML_SCHEMA_INTERNALS_H__
-#define __XML_SCHEMA_INTERNALS_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_SCHEMAS_ENABLED
-
-#include <libxml/xmlregexp.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
- * XML Schemas defines multiple type of types.
- */
-typedef enum {
- XML_SCHEMA_TYPE_BASIC = 1,
- XML_SCHEMA_TYPE_ANY,
- XML_SCHEMA_TYPE_FACET,
- XML_SCHEMA_TYPE_SIMPLE,
- XML_SCHEMA_TYPE_COMPLEX,
- XML_SCHEMA_TYPE_SEQUENCE,
- XML_SCHEMA_TYPE_CHOICE,
- XML_SCHEMA_TYPE_ALL,
- XML_SCHEMA_TYPE_SIMPLE_CONTENT,
- XML_SCHEMA_TYPE_COMPLEX_CONTENT,
- XML_SCHEMA_TYPE_UR,
- XML_SCHEMA_TYPE_RESTRICTION,
- XML_SCHEMA_TYPE_EXTENSION,
- XML_SCHEMA_TYPE_ELEMENT,
- XML_SCHEMA_TYPE_ATTRIBUTE,
- XML_SCHEMA_TYPE_ATTRIBUTEGROUP,
- XML_SCHEMA_TYPE_GROUP,
- XML_SCHEMA_TYPE_NOTATION,
- XML_SCHEMA_TYPE_LIST,
- XML_SCHEMA_TYPE_UNION,
- XML_SCHEMA_FACET_MININCLUSIVE = 1000,
- XML_SCHEMA_FACET_MINEXCLUSIVE,
- XML_SCHEMA_FACET_MAXINCLUSIVE,
- XML_SCHEMA_FACET_MAXEXCLUSIVE,
- XML_SCHEMA_FACET_TOTALDIGITS,
- XML_SCHEMA_FACET_FRACTIONDIGITS,
- XML_SCHEMA_FACET_PATTERN,
- XML_SCHEMA_FACET_ENUMERATION,
- XML_SCHEMA_FACET_WHITESPACE,
- XML_SCHEMA_FACET_LENGTH,
- XML_SCHEMA_FACET_MAXLENGTH,
- XML_SCHEMA_FACET_MINLENGTH
-} xmlSchemaTypeType;
-
-typedef enum {
- XML_SCHEMA_CONTENT_UNKNOWN = 0,
- XML_SCHEMA_CONTENT_EMPTY = 1,
- XML_SCHEMA_CONTENT_ELEMENTS,
- XML_SCHEMA_CONTENT_MIXED,
- XML_SCHEMA_CONTENT_SIMPLE,
- XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS,
- XML_SCHEMA_CONTENT_BASIC,
- XML_SCHEMA_CONTENT_ANY
-} xmlSchemaContentType;
-
-typedef struct _xmlSchemaVal xmlSchemaVal;
-typedef xmlSchemaVal *xmlSchemaValPtr;
-
-typedef struct _xmlSchemaType xmlSchemaType;
-typedef xmlSchemaType *xmlSchemaTypePtr;
-
-typedef struct _xmlSchemaFacet xmlSchemaFacet;
-typedef xmlSchemaFacet *xmlSchemaFacetPtr;
-
-/**
- * Annotation
- */
-typedef struct _xmlSchemaAnnot xmlSchemaAnnot;
-typedef xmlSchemaAnnot *xmlSchemaAnnotPtr;
-struct _xmlSchemaAnnot {
- struct _xmlSchemaAnnot *next;
- xmlNodePtr content; /* the annotation */
-};
-
-/**
- * An attribute definition.
- */
-
-#define XML_SCHEMAS_ANYATTR_SKIP 1
-#define XML_SCHEMAS_ANYATTR_LAX 2
-#define XML_SCHEMAS_ANYATTR_STRICT 3
-
-typedef struct _xmlSchemaAttribute xmlSchemaAttribute;
-typedef xmlSchemaAttribute *xmlSchemaAttributePtr;
-struct _xmlSchemaAttribute {
- xmlSchemaTypeType type; /* The kind of type */
- struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
- xmlChar *name;
- xmlChar *id;
- xmlChar *ref;
- xmlChar *refNs;
- xmlChar *typeName;
- xmlChar *typeNs;
- xmlSchemaAnnotPtr annot;
-
- xmlSchemaTypePtr base;
- int occurs;
- xmlChar *defValue;
- xmlSchemaTypePtr subtypes;
-};
-
-/**
- * An attribute group definition.
- *
- * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures
- * must be kept similar
- */
-typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup;
-typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr;
-struct _xmlSchemaAttributeGroup {
- xmlSchemaTypeType type; /* The kind of type */
- struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
- xmlChar *name;
- xmlChar *id;
- xmlChar *ref;
- xmlChar *refNs;
- xmlSchemaAnnotPtr annot;
-
- xmlSchemaAttributePtr attributes;
-};
-
-
-/**
- * XML_SCHEMAS_TYPE_MIXED:
- *
- * the element content type is mixed
- */
-#define XML_SCHEMAS_TYPE_MIXED 1 << 0
-
-/**
- * _xmlSchemaType:
- *
- * Schemas type definition.
- */
-struct _xmlSchemaType {
- xmlSchemaTypeType type; /* The kind of type */
- struct _xmlSchemaType *next;/* the next type if in a sequence ... */
- xmlChar *name;
- xmlChar *id;
- xmlChar *ref;
- xmlChar *refNs;
- xmlSchemaAnnotPtr annot;
- xmlSchemaTypePtr subtypes;
- xmlSchemaAttributePtr attributes;
- xmlNodePtr node;
- int minOccurs;
- int maxOccurs;
-
- int flags;
- xmlSchemaContentType contentType;
- xmlChar *base;
- xmlChar *baseNs;
- xmlSchemaTypePtr baseType;
- xmlSchemaFacetPtr facets;
-};
-
-/**
- * xmlSchemaElement:
- * An element definition.
- *
- * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of
- * structures must be kept similar
- */
-/**
- * XML_SCHEMAS_ELEM_NILLABLE:
- *
- * the element is nillable
- */
-#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0
-/**
- * XML_SCHEMAS_ELEM_GLOBAL:
- *
- * the element is global
- */
-#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1
-/**
- * XML_SCHEMAS_ELEM_DEFAULT:
- *
- * the element has a default value
- */
-#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2
-/**
- * XML_SCHEMAS_ELEM_FIXED:
- *
- * the element has a fixed value
- */
-#define XML_SCHEMAS_ELEM_FIXED 1 << 3
-/**
- * XML_SCHEMAS_ELEM_ABSTRACT:
- *
- * the element is abstract
- */
-#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4
-/**
- * XML_SCHEMAS_ELEM_TOPLEVEL:
- *
- * the element is top level
- */
-#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5
-/**
- * XML_SCHEMAS_ELEM_REF:
- *
- * the element is a reference to a type
- */
-#define XML_SCHEMAS_ELEM_REF 1 << 6
-
-typedef struct _xmlSchemaElement xmlSchemaElement;
-typedef xmlSchemaElement *xmlSchemaElementPtr;
-struct _xmlSchemaElement {
- xmlSchemaTypeType type; /* The kind of type */
- struct _xmlSchemaType *next;/* the next type if in a sequence ... */
- xmlChar *name;
- xmlChar *id;
- xmlChar *ref;
- xmlChar *refNs;
- xmlSchemaAnnotPtr annot;
- xmlSchemaTypePtr subtypes;
- xmlSchemaAttributePtr attributes;
- xmlNodePtr node;
- int minOccurs;
- int maxOccurs;
-
- int flags;
- xmlChar *targetNamespace;
- xmlChar *namedType;
- xmlChar *namedTypeNs;
- xmlChar *substGroup;
- xmlChar *substGroupNs;
- xmlChar *scope;
- xmlChar *value;
- struct _xmlSchemaElement *refDecl;
- xmlRegexpPtr contModel;
- xmlSchemaContentType contentType;
-};
-
-/*
- * XML_SCHEMAS_FACET_UNKNOWN:
- *
- * unknown facet handling
- */
-#define XML_SCHEMAS_FACET_UNKNOWN 0
-/*
- * XML_SCHEMAS_FACET_PRESERVE:
- *
- * preserve the type of the facet
- */
-#define XML_SCHEMAS_FACET_PRESERVE 1
-/*
- * XML_SCHEMAS_FACET_REPLACE:
- *
- * replace the type of the facet
- */
-#define XML_SCHEMAS_FACET_REPLACE 2
-/*
- * XML_SCHEMAS_FACET_COLLAPSE:
- *
- * collapse the types of the facet
- */
-#define XML_SCHEMAS_FACET_COLLAPSE 3
-
-/**
- * A facet definition.
- */
-struct _xmlSchemaFacet {
- xmlSchemaTypeType type; /* The kind of type */
- struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */
- xmlChar *value;
- xmlChar *id;
- xmlSchemaAnnotPtr annot;
- xmlNodePtr node;
- int fixed;
- int whitespace;
- xmlSchemaValPtr val;
- xmlRegexpPtr regexp;
-};
-
-/**
- * A notation definition.
- */
-typedef struct _xmlSchemaNotation xmlSchemaNotation;
-typedef xmlSchemaNotation *xmlSchemaNotationPtr;
-struct _xmlSchemaNotation {
- xmlSchemaTypeType type; /* The kind of type */
- xmlChar *name;
- xmlSchemaAnnotPtr annot;
- xmlChar *identifier;
-};
-
-/**
- * XML_SCHEMAS_QUALIF_ELEM:
- *
- * the shemas requires qualified elements
- */
-#define XML_SCHEMAS_QUALIF_ELEM 1 << 0
-/**
- * XML_SCHEMAS_QUALIF_ATTR:
- *
- * the shemas requires qualified attributes
- */
-#define XML_SCHEMAS_QUALIF_ATTR 1 << 1
-/**
- * _xmlSchema:
- *
- * A Schemas definition
- */
-struct _xmlSchema {
- xmlChar *name; /* schema name */
- xmlChar *targetNamespace; /* the target namespace */
- xmlChar *version;
- xmlChar *id;
- xmlDocPtr doc;
- xmlSchemaAnnotPtr annot;
- int flags;
-
- xmlHashTablePtr typeDecl;
- xmlHashTablePtr attrDecl;
- xmlHashTablePtr attrgrpDecl;
- xmlHashTablePtr elemDecl;
- xmlHashTablePtr notaDecl;
-
- xmlHashTablePtr schemasImports;
-
- void *_private; /* unused by the library for users or bindings */
-};
-
-void xmlSchemaFreeType (xmlSchemaTypePtr type);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_SCHEMAS_ENABLED */
-#endif /* __XML_SCHEMA_INTERNALS_H__ */
-
-
diff --git a/bundle/libxml/include/libxml/threads.h b/bundle/libxml/include/libxml/threads.h
deleted file mode 100644
index afca78ffe5..0000000000
--- a/bundle/libxml/include/libxml/threads.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * threads.c: set of generic threading related routines
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __XML_THREADS_H__
-#define __XML_THREADS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * xmlMutex are a simple mutual exception locks.
- */
-typedef struct _xmlMutex xmlMutex;
-typedef xmlMutex *xmlMutexPtr;
-
-/*
- * xmlRMutex are reentrant mutual exception locks.
- */
-typedef struct _xmlRMutex xmlRMutex;
-typedef xmlRMutex *xmlRMutexPtr;
-
-#ifdef __cplusplus
-}
-#endif
-#include <libxml/globals.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-xmlMutexPtr xmlNewMutex (void);
-void xmlMutexLock (xmlMutexPtr tok);
-void xmlMutexUnlock (xmlMutexPtr tok);
-void xmlFreeMutex (xmlMutexPtr tok);
-
-xmlRMutexPtr xmlNewRMutex (void);
-void xmlRMutexLock (xmlRMutexPtr tok);
-void xmlRMutexUnlock (xmlRMutexPtr tok);
-void xmlFreeRMutex (xmlRMutexPtr tok);
-
-/*
- * Library wide APIs.
- */
-void xmlInitThreads (void);
-void xmlLockLibrary (void);
-void xmlUnlockLibrary(void);
-int xmlGetThreadId (void);
-int xmlIsMainThread (void);
-void xmlCleanupThreads(void);
-xmlGlobalStatePtr xmlGetGlobalState(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* __XML_THREADS_H__ */
diff --git a/bundle/libxml/include/libxml/tree.h b/bundle/libxml/include/libxml/tree.h
deleted file mode 100644
index 93d57e3126..0000000000
--- a/bundle/libxml/include/libxml/tree.h
+++ /dev/null
@@ -1,894 +0,0 @@
-/*
- * tree.h : describes the structures found in an tree resulting
- * from an XML parsing.
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- *
- */
-
-#ifndef __XML_TREE_H__
-#define __XML_TREE_H__
-
-#include <stdio.h>
-#include <libxml/xmlversion.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Some of the basic types pointer to structures:
- */
-/* xmlIO.h */
-typedef struct _xmlParserInputBuffer xmlParserInputBuffer;
-typedef xmlParserInputBuffer *xmlParserInputBufferPtr;
-
-typedef struct _xmlOutputBuffer xmlOutputBuffer;
-typedef xmlOutputBuffer *xmlOutputBufferPtr;
-
-/* parser.h */
-typedef struct _xmlParserInput xmlParserInput;
-typedef xmlParserInput *xmlParserInputPtr;
-
-typedef struct _xmlParserCtxt xmlParserCtxt;
-typedef xmlParserCtxt *xmlParserCtxtPtr;
-
-typedef struct _xmlSAXLocator xmlSAXLocator;
-typedef xmlSAXLocator *xmlSAXLocatorPtr;
-
-typedef struct _xmlSAXHandler xmlSAXHandler;
-typedef xmlSAXHandler *xmlSAXHandlerPtr;
-
-/* entities.h */
-typedef struct _xmlEntity xmlEntity;
-typedef xmlEntity *xmlEntityPtr;
-
-/**
- * BASE_BUFFER_SIZE:
- *
- * default buffer size 4000.
- */
-#define BASE_BUFFER_SIZE 4000
-
-/**
- * XML_XML_NAMESPACE:
- *
- * This is the namespace for the special xml: prefix predefined in the
- * XML Namespace specification.
- */
-#define XML_XML_NAMESPACE \
- (const xmlChar *) "http://www.w3.org/XML/1998/namespace"
-
-/*
- * The different element types carried by an XML tree.
- *
- * NOTE: This is synchronized with DOM Level1 values
- * See http://www.w3.org/TR/REC-DOM-Level-1/
- *
- * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should
- * be deprecated to use an XML_DTD_NODE.
- */
-typedef enum {
- XML_ELEMENT_NODE= 1,
- XML_ATTRIBUTE_NODE= 2,
- XML_TEXT_NODE= 3,
- XML_CDATA_SECTION_NODE= 4,
- XML_ENTITY_REF_NODE= 5,
- XML_ENTITY_NODE= 6,
- XML_PI_NODE= 7,
- XML_COMMENT_NODE= 8,
- XML_DOCUMENT_NODE= 9,
- XML_DOCUMENT_TYPE_NODE= 10,
- XML_DOCUMENT_FRAG_NODE= 11,
- XML_NOTATION_NODE= 12,
- XML_HTML_DOCUMENT_NODE= 13,
- XML_DTD_NODE= 14,
- XML_ELEMENT_DECL= 15,
- XML_ATTRIBUTE_DECL= 16,
- XML_ENTITY_DECL= 17,
- XML_NAMESPACE_DECL= 18,
- XML_XINCLUDE_START= 19,
- XML_XINCLUDE_END= 20
-#ifdef LIBXML_DOCB_ENABLED
- ,XML_DOCB_DOCUMENT_NODE= 21
-#endif
-} xmlElementType;
-
-/**
- * xmlChar:
- *
- * This is a basic byte in an UTF-8 encoded string.
- * It's unsigned allowing to pinpoint case where char * are assigned
- * to xmlChar * (possibly making serialization back impossible).
- */
-
-typedef unsigned char xmlChar;
-
-/**
- * BAD_CAST:
- *
- * Macro to cast a string to an xmlChar * when one know its safe.
- */
-#define BAD_CAST (xmlChar *)
-
-/**
- * xmlNotation:
- *
- * A DTD Notation definition.
- */
-
-typedef struct _xmlNotation xmlNotation;
-typedef xmlNotation *xmlNotationPtr;
-struct _xmlNotation {
- const xmlChar *name; /* Notation name */
- const xmlChar *PublicID; /* Public identifier, if any */
- const xmlChar *SystemID; /* System identifier, if any */
-};
-
-/**
- * xmlAttributeType:
- *
- * A DTD Attribute type definition.
- */
-
-typedef enum {
- XML_ATTRIBUTE_CDATA = 1,
- XML_ATTRIBUTE_ID,
- XML_ATTRIBUTE_IDREF ,
- XML_ATTRIBUTE_IDREFS,
- XML_ATTRIBUTE_ENTITY,
- XML_ATTRIBUTE_ENTITIES,
- XML_ATTRIBUTE_NMTOKEN,
- XML_ATTRIBUTE_NMTOKENS,
- XML_ATTRIBUTE_ENUMERATION,
- XML_ATTRIBUTE_NOTATION
-} xmlAttributeType;
-
-/**
- * xmlAttributeDefault:
- *
- * A DTD Attribute default definition.
- */
-
-typedef enum {
- XML_ATTRIBUTE_NONE = 1,
- XML_ATTRIBUTE_REQUIRED,
- XML_ATTRIBUTE_IMPLIED,
- XML_ATTRIBUTE_FIXED
-} xmlAttributeDefault;
-
-/**
- * xmlEnumeration:
- *
- * List structure used when there is an enumeration in DTDs.
- */
-
-typedef struct _xmlEnumeration xmlEnumeration;
-typedef xmlEnumeration *xmlEnumerationPtr;
-struct _xmlEnumeration {
- struct _xmlEnumeration *next; /* next one */
- const xmlChar *name; /* Enumeration name */
-};
-
-/**
- * xmlAttribute:
- *
- * An Attribute declaration in a DTD.
- */
-
-typedef struct _xmlAttribute xmlAttribute;
-typedef xmlAttribute *xmlAttributePtr;
-struct _xmlAttribute {
- void *_private; /* application data */
- xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */
- const xmlChar *name; /* Attribute name */
- struct _xmlNode *children; /* NULL */
- struct _xmlNode *last; /* NULL */
- struct _xmlDtd *parent; /* -> DTD */
- struct _xmlNode *next; /* next sibling link */
- struct _xmlNode *prev; /* previous sibling link */
- struct _xmlDoc *doc; /* the containing document */
-
- struct _xmlAttribute *nexth; /* next in hash table */
- xmlAttributeType atype; /* The attribute type */
- xmlAttributeDefault def; /* the default */
- const xmlChar *defaultValue; /* or the default value */
- xmlEnumerationPtr tree; /* or the enumeration tree if any */
- const xmlChar *prefix; /* the namespace prefix if any */
- const xmlChar *elem; /* Element holding the attribute */
-};
-
-/**
- * xmlElementContentType:
- *
- * Possible definitions of element content types.
- */
-typedef enum {
- XML_ELEMENT_CONTENT_PCDATA = 1,
- XML_ELEMENT_CONTENT_ELEMENT,
- XML_ELEMENT_CONTENT_SEQ,
- XML_ELEMENT_CONTENT_OR
-} xmlElementContentType;
-
-/**
- * xmlElementContentOccur:
- *
- * Possible definitions of element content occurrences.
- */
-typedef enum {
- XML_ELEMENT_CONTENT_ONCE = 1,
- XML_ELEMENT_CONTENT_OPT,
- XML_ELEMENT_CONTENT_MULT,
- XML_ELEMENT_CONTENT_PLUS
-} xmlElementContentOccur;
-
-/**
- * xmlElementContent:
- *
- * An XML Element content as stored after parsing an element definition
- * in a DTD.
- */
-
-typedef struct _xmlElementContent xmlElementContent;
-typedef xmlElementContent *xmlElementContentPtr;
-struct _xmlElementContent {
- xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */
- xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */
- const xmlChar *name; /* Element name */
- struct _xmlElementContent *c1; /* first child */
- struct _xmlElementContent *c2; /* second child */
- struct _xmlElementContent *parent; /* parent */
- const xmlChar *prefix; /* Namespace prefix */
-};
-
-/**
- * xmlElementTypeVal:
- *
- * The different possibilities for an element content type.
- */
-
-typedef enum {
- XML_ELEMENT_TYPE_UNDEFINED = 0,
- XML_ELEMENT_TYPE_EMPTY = 1,
- XML_ELEMENT_TYPE_ANY,
- XML_ELEMENT_TYPE_MIXED,
- XML_ELEMENT_TYPE_ELEMENT
-} xmlElementTypeVal;
-
-
-#ifdef __cplusplus
-}
-#endif
-#include <libxml/xmlregexp.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlElement:
- *
- * An XML Element declaration from a DTD.
- */
-
-typedef struct _xmlElement xmlElement;
-typedef xmlElement *xmlElementPtr;
-struct _xmlElement {
- void *_private; /* application data */
- xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */
- const xmlChar *name; /* Element name */
- struct _xmlNode *children; /* NULL */
- struct _xmlNode *last; /* NULL */
- struct _xmlDtd *parent; /* -> DTD */
- struct _xmlNode *next; /* next sibling link */
- struct _xmlNode *prev; /* previous sibling link */
- struct _xmlDoc *doc; /* the containing document */
-
- xmlElementTypeVal etype; /* The type */
- xmlElementContentPtr content; /* the allowed element content */
- xmlAttributePtr attributes; /* List of the declared attributes */
- const xmlChar *prefix; /* the namespace prefix if any */
-#ifdef LIBXML_REGEXP_ENABLED
- xmlRegexpPtr contModel; /* the validating regexp */
-#else
- void *contModel;
-#endif
-};
-
-
-/**
- * XML_LOCAL_NAMESPACE:
- *
- * A namespace declaration node.
- */
-#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL
-typedef xmlElementType xmlNsType;
-
-/**
- * xmlNs:
- *
- * An XML namespace.
- * Note that prefix == NULL is valid, it defines the default namespace
- * within the subtree (until overridden).
- *
- * xmlNsType is unified with xmlElementType.
- */
-
-typedef struct _xmlNs xmlNs;
-typedef xmlNs *xmlNsPtr;
-struct _xmlNs {
- struct _xmlNs *next; /* next Ns link for this node */
- xmlNsType type; /* global or local */
- const xmlChar *href; /* URL for the namespace */
- const xmlChar *prefix; /* prefix for the namespace */
- void *_private; /* application data */
-};
-
-/**
- * xmlDtd:
- *
- * An XML DTD, as defined by <!DOCTYPE ... There is actually one for
- * the internal subset and for the external subset.
- */
-typedef struct _xmlDtd xmlDtd;
-typedef xmlDtd *xmlDtdPtr;
-struct _xmlDtd {
- void *_private; /* application data */
- xmlElementType type; /* XML_DTD_NODE, must be second ! */
- const xmlChar *name; /* Name of the DTD */
- struct _xmlNode *children; /* the value of the property link */
- struct _xmlNode *last; /* last child link */
- struct _xmlDoc *parent; /* child->parent link */
- struct _xmlNode *next; /* next sibling link */
- struct _xmlNode *prev; /* previous sibling link */
- struct _xmlDoc *doc; /* the containing document */
-
- /* End of common part */
- void *notations; /* Hash table for notations if any */
- void *elements; /* Hash table for elements if any */
- void *attributes; /* Hash table for attributes if any */
- void *entities; /* Hash table for entities if any */
- const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */
- const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */
- void *pentities; /* Hash table for param entities if any */
-};
-
-/**
- * xmlAttr:
- *
- * An attribute on an XML node.
- */
-typedef struct _xmlAttr xmlAttr;
-typedef xmlAttr *xmlAttrPtr;
-struct _xmlAttr {
- void *_private; /* application data */
- xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */
- const xmlChar *name; /* the name of the property */
- struct _xmlNode *children; /* the value of the property */
- struct _xmlNode *last; /* NULL */
- struct _xmlNode *parent; /* child->parent link */
- struct _xmlAttr *next; /* next sibling link */
- struct _xmlAttr *prev; /* previous sibling link */
- struct _xmlDoc *doc; /* the containing document */
- xmlNs *ns; /* pointer to the associated namespace */
- xmlAttributeType atype; /* the attribute type if validating */
-};
-
-/**
- * xmlID:
- *
- * An XML ID instance.
- */
-
-typedef struct _xmlID xmlID;
-typedef xmlID *xmlIDPtr;
-struct _xmlID {
- struct _xmlID *next; /* next ID */
- const xmlChar *value; /* The ID name */
- xmlAttrPtr attr; /* The attribute holding it */
-};
-
-/**
- * xmlRef:
- *
- * An XML IDREF instance.
- */
-
-typedef struct _xmlRef xmlRef;
-typedef xmlRef *xmlRefPtr;
-struct _xmlRef {
- struct _xmlRef *next; /* next Ref */
- const xmlChar *value; /* The Ref name */
- xmlAttrPtr attr; /* The attribute holding it */
-};
-
-/**
- * xmlBufferAllocationScheme:
- *
- * A buffer allocation scheme can be defined to either match exactly the
- * need or double it's allocated size each time it is found too small.
- */
-
-typedef enum {
- XML_BUFFER_ALLOC_DOUBLEIT,
- XML_BUFFER_ALLOC_EXACT
-} xmlBufferAllocationScheme;
-
-/**
- * xmlBuffer:
- *
- * A buffer structure.
- */
-typedef struct _xmlBuffer xmlBuffer;
-typedef xmlBuffer *xmlBufferPtr;
-struct _xmlBuffer {
- xmlChar *content; /* The buffer content UTF8 */
- unsigned int use; /* The buffer size used */
- unsigned int size; /* The buffer size */
- xmlBufferAllocationScheme alloc; /* The realloc method */
-};
-
-/**
- * xmlNode:
- *
- * A node in an XML tree.
- */
-typedef struct _xmlNode xmlNode;
-typedef xmlNode *xmlNodePtr;
-struct _xmlNode {
- void *_private; /* application data */
- xmlElementType type; /* type number, must be second ! */
- const xmlChar *name; /* the name of the node, or the entity */
- struct _xmlNode *children; /* parent->childs link */
- struct _xmlNode *last; /* last child link */
- struct _xmlNode *parent; /* child->parent link */
- struct _xmlNode *next; /* next sibling link */
- struct _xmlNode *prev; /* previous sibling link */
- struct _xmlDoc *doc; /* the containing document */
-
- /* End of common part */
- xmlNs *ns; /* pointer to the associated namespace */
- xmlChar *content; /* the content */
- struct _xmlAttr *properties;/* properties list */
- xmlNs *nsDef; /* namespace definitions on this node */
-};
-
-/**
- * XML_GET_CONTENT:
- *
- * Macro to extract the content pointer of a node.
- */
-#define XML_GET_CONTENT(n) \
- ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content)
-
-/**
- * XML_GET_LINE:
- *
- * Macro to extract the line number of an element node.
- * This will work only if line numbering is activated by
- * calling xmlLineNumbersDefault(1) before parsing.
- */
-#define XML_GET_LINE(n) \
- ((n)->type == XML_ELEMENT_NODE ? (int) (n)->content : 0)
-
-/**
- * xmlDoc:
- *
- * An XML document.
- */
-typedef struct _xmlDoc xmlDoc;
-typedef xmlDoc *xmlDocPtr;
-struct _xmlDoc {
- void *_private; /* application data */
- xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
- char *name; /* name/filename/URI of the document */
- struct _xmlNode *children; /* the document tree */
- struct _xmlNode *last; /* last child link */
- struct _xmlNode *parent; /* child->parent link */
- struct _xmlNode *next; /* next sibling link */
- struct _xmlNode *prev; /* previous sibling link */
- struct _xmlDoc *doc; /* autoreference to itself */
-
- /* End of common part */
- int compression;/* level of zlib compression */
- int standalone; /* standalone document (no external refs) */
- struct _xmlDtd *intSubset; /* the document internal subset */
- struct _xmlDtd *extSubset; /* the document external subset */
- struct _xmlNs *oldNs; /* Global namespace, the old way */
- const xmlChar *version; /* the XML version string */
- const xmlChar *encoding; /* external initial encoding, if any */
- void *ids; /* Hash table for ID attributes if any */
- void *refs; /* Hash table for IDREFs attributes if any */
- const xmlChar *URL; /* The URI for that document */
- int charset; /* encoding of the in-memory content
- actually an xmlCharEncoding */
-};
-
-/**
- * xmlChildrenNode:
- *
- * Macro for compatibility naming layer with libxml1.
- */
-#ifndef xmlChildrenNode
-#define xmlChildrenNode children
-#endif
-
-/**
- * xmlRootNode:
- *
- * Macro for compatibility naming layer with libxml1.
- */
-#ifndef xmlRootNode
-#define xmlRootNode children
-#endif
-
-/*
- * Variables.
- */
-#if 0
-LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
-LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput; /* try to indent the tree dumps */
-LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */
-LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as <empty></empty> */
-LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize; /* default buffer size */
-#endif
-
-/*
- * Handling Buffers.
- */
-
-void xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
-xmlBufferAllocationScheme xmlGetBufferAllocationScheme(void);
-
-xmlBufferPtr xmlBufferCreate (void);
-xmlBufferPtr xmlBufferCreateSize (size_t size);
-int xmlBufferResize (xmlBufferPtr buf,
- unsigned int size);
-void xmlBufferFree (xmlBufferPtr buf);
-int xmlBufferDump (FILE *file,
- xmlBufferPtr buf);
-void xmlBufferAdd (xmlBufferPtr buf,
- const xmlChar *str,
- int len);
-void xmlBufferAddHead (xmlBufferPtr buf,
- const xmlChar *str,
- int len);
-void xmlBufferCat (xmlBufferPtr buf,
- const xmlChar *str);
-void xmlBufferCCat (xmlBufferPtr buf,
- const char *str);
-int xmlBufferShrink (xmlBufferPtr buf,
- unsigned int len);
-int xmlBufferGrow (xmlBufferPtr buf,
- unsigned int len);
-void xmlBufferEmpty (xmlBufferPtr buf);
-const xmlChar* xmlBufferContent (const xmlBufferPtr buf);
-void xmlBufferSetAllocationScheme(xmlBufferPtr buf,
- xmlBufferAllocationScheme scheme);
-int xmlBufferLength (const xmlBufferPtr buf);
-
-/*
- * Creating/freeing new structures.
- */
-xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc,
- const xmlChar *name,
- const xmlChar *ExternalID,
- const xmlChar *SystemID);
-xmlDtdPtr xmlNewDtd (xmlDocPtr doc,
- const xmlChar *name,
- const xmlChar *ExternalID,
- const xmlChar *SystemID);
-xmlDtdPtr xmlGetIntSubset (xmlDocPtr doc);
-void xmlFreeDtd (xmlDtdPtr cur);
-xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc,
- const xmlChar *href,
- const xmlChar *prefix);
-xmlNsPtr xmlNewNs (xmlNodePtr node,
- const xmlChar *href,
- const xmlChar *prefix);
-void xmlFreeNs (xmlNsPtr cur);
-void xmlFreeNsList (xmlNsPtr cur);
-xmlDocPtr xmlNewDoc (const xmlChar *version);
-void xmlFreeDoc (xmlDocPtr cur);
-xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
- const xmlChar *name,
- const xmlChar *value);
-xmlAttrPtr xmlNewProp (xmlNodePtr node,
- const xmlChar *name,
- const xmlChar *value);
-xmlAttrPtr xmlNewNsProp (xmlNodePtr node,
- xmlNsPtr ns,
- const xmlChar *name,
- const xmlChar *value);
-xmlAttrPtr xmlNewNsPropEatName (xmlNodePtr node,
- xmlNsPtr ns,
- xmlChar *name,
- const xmlChar *value);
-void xmlFreePropList (xmlAttrPtr cur);
-void xmlFreeProp (xmlAttrPtr cur);
-xmlAttrPtr xmlCopyProp (xmlNodePtr target,
- xmlAttrPtr cur);
-xmlAttrPtr xmlCopyPropList (xmlNodePtr target,
- xmlAttrPtr cur);
-xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd);
-xmlDocPtr xmlCopyDoc (xmlDocPtr doc,
- int recursive);
-
-/*
- * Creating new nodes.
- */
-xmlNodePtr xmlNewDocNode (xmlDocPtr doc,
- xmlNsPtr ns,
- const xmlChar *name,
- const xmlChar *content);
-xmlNodePtr xmlNewDocNodeEatName (xmlDocPtr doc,
- xmlNsPtr ns,
- xmlChar *name,
- const xmlChar *content);
-xmlNodePtr xmlNewDocRawNode (xmlDocPtr doc,
- xmlNsPtr ns,
- const xmlChar *name,
- const xmlChar *content);
-xmlNodePtr xmlNewNode (xmlNsPtr ns,
- const xmlChar *name);
-xmlNodePtr xmlNewNodeEatName (xmlNsPtr ns,
- xmlChar *name);
-xmlNodePtr xmlNewChild (xmlNodePtr parent,
- xmlNsPtr ns,
- const xmlChar *name,
- const xmlChar *content);
-xmlNodePtr xmlNewTextChild (xmlNodePtr parent,
- xmlNsPtr ns,
- const xmlChar *name,
- const xmlChar *content);
-xmlNodePtr xmlNewDocText (xmlDocPtr doc,
- const xmlChar *content);
-xmlNodePtr xmlNewText (const xmlChar *content);
-xmlNodePtr xmlNewPI (const xmlChar *name,
- const xmlChar *content);
-xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc,
- const xmlChar *content,
- int len);
-xmlNodePtr xmlNewTextLen (const xmlChar *content,
- int len);
-xmlNodePtr xmlNewDocComment (xmlDocPtr doc,
- const xmlChar *content);
-xmlNodePtr xmlNewComment (const xmlChar *content);
-xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc,
- const xmlChar *content,
- int len);
-xmlNodePtr xmlNewCharRef (xmlDocPtr doc,
- const xmlChar *name);
-xmlNodePtr xmlNewReference (xmlDocPtr doc,
- const xmlChar *name);
-xmlNodePtr xmlCopyNode (const xmlNodePtr node,
- int recursive);
-xmlNodePtr xmlDocCopyNode (const xmlNodePtr node,
- xmlDocPtr doc,
- int recursive);
-xmlNodePtr xmlCopyNodeList (const xmlNodePtr node);
-xmlNodePtr xmlNewDocFragment (xmlDocPtr doc);
-
-/*
- * Navigating.
- */
-long xmlGetLineNo (xmlNodePtr node);
-xmlChar * xmlGetNodePath (xmlNodePtr node);
-xmlNodePtr xmlDocGetRootElement (xmlDocPtr doc);
-xmlNodePtr xmlGetLastChild (xmlNodePtr parent);
-int xmlNodeIsText (xmlNodePtr node);
-int xmlIsBlankNode (xmlNodePtr node);
-
-/*
- * Changing the structure.
- */
-xmlNodePtr xmlDocSetRootElement (xmlDocPtr doc,
- xmlNodePtr root);
-void xmlNodeSetName (xmlNodePtr cur,
- const xmlChar *name);
-xmlNodePtr xmlAddChild (xmlNodePtr parent,
- xmlNodePtr cur);
-xmlNodePtr xmlAddChildList (xmlNodePtr parent,
- xmlNodePtr cur);
-xmlNodePtr xmlReplaceNode (xmlNodePtr old,
- xmlNodePtr cur);
-xmlNodePtr xmlAddSibling (xmlNodePtr cur,
- xmlNodePtr elem);
-xmlNodePtr xmlAddPrevSibling (xmlNodePtr cur,
- xmlNodePtr elem);
-xmlNodePtr xmlAddNextSibling (xmlNodePtr cur,
- xmlNodePtr elem);
-void xmlUnlinkNode (xmlNodePtr cur);
-xmlNodePtr xmlTextMerge (xmlNodePtr first,
- xmlNodePtr second);
-void xmlTextConcat (xmlNodePtr node,
- const xmlChar *content,
- int len);
-void xmlFreeNodeList (xmlNodePtr cur);
-void xmlFreeNode (xmlNodePtr cur);
-void xmlSetTreeDoc (xmlNodePtr tree,
- xmlDocPtr doc);
-void xmlSetListDoc (xmlNodePtr list,
- xmlDocPtr doc);
-
-/*
- * Namespaces.
- */
-xmlNsPtr xmlSearchNs (xmlDocPtr doc,
- xmlNodePtr node,
- const xmlChar *nameSpace);
-xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc,
- xmlNodePtr node,
- const xmlChar *href);
-xmlNsPtr * xmlGetNsList (xmlDocPtr doc,
- xmlNodePtr node);
-void xmlSetNs (xmlNodePtr node,
- xmlNsPtr ns);
-xmlNsPtr xmlCopyNamespace (xmlNsPtr cur);
-xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur);
-
-/*
- * Changing the content.
- */
-xmlAttrPtr xmlSetProp (xmlNodePtr node,
- const xmlChar *name,
- const xmlChar *value);
-xmlChar * xmlGetProp (xmlNodePtr node,
- const xmlChar *name);
-xmlAttrPtr xmlHasProp (xmlNodePtr node,
- const xmlChar *name);
-xmlAttrPtr xmlHasNsProp (xmlNodePtr node,
- const xmlChar *name,
- const xmlChar *nameSpace);
-xmlAttrPtr xmlSetNsProp (xmlNodePtr node,
- xmlNsPtr ns,
- const xmlChar *name,
- const xmlChar *value);
-xmlChar * xmlGetNsProp (xmlNodePtr node,
- const xmlChar *name,
- const xmlChar *nameSpace);
-xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc,
- const xmlChar *value);
-xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc,
- const xmlChar *value,
- int len);
-xmlChar * xmlNodeListGetString (xmlDocPtr doc,
- xmlNodePtr list,
- int inLine);
-xmlChar * xmlNodeListGetRawString (xmlDocPtr doc,
- xmlNodePtr list,
- int inLine);
-void xmlNodeSetContent (xmlNodePtr cur,
- const xmlChar *content);
-void xmlNodeSetContentLen (xmlNodePtr cur,
- const xmlChar *content,
- int len);
-void xmlNodeAddContent (xmlNodePtr cur,
- const xmlChar *content);
-void xmlNodeAddContentLen (xmlNodePtr cur,
- const xmlChar *content,
- int len);
-xmlChar * xmlNodeGetContent (xmlNodePtr cur);
-xmlChar * xmlNodeGetLang (xmlNodePtr cur);
-void xmlNodeSetLang (xmlNodePtr cur,
- const xmlChar *lang);
-int xmlNodeGetSpacePreserve (xmlNodePtr cur);
-void xmlNodeSetSpacePreserve (xmlNodePtr cur,
- int val);
-xmlChar * xmlNodeGetBase (xmlDocPtr doc,
- xmlNodePtr cur);
-void xmlNodeSetBase (xmlNodePtr cur,
- xmlChar *uri);
-
-/*
- * Removing content.
- */
-int xmlRemoveProp (xmlAttrPtr cur);
-int xmlUnsetProp (xmlNodePtr node,
- const xmlChar *name);
-int xmlUnsetNsProp (xmlNodePtr node,
- xmlNsPtr ns,
- const xmlChar *name);
-
-/*
- * Internal, don't use.
- */
-void xmlBufferWriteCHAR (xmlBufferPtr buf,
- const xmlChar *string);
-void xmlBufferWriteChar (xmlBufferPtr buf,
- const char *string);
-void xmlBufferWriteQuotedString(xmlBufferPtr buf,
- const xmlChar *string);
-
-/*
- * Namespace handling.
- */
-int xmlReconciliateNs (xmlDocPtr doc,
- xmlNodePtr tree);
-
-/*
- * Saving.
- */
-void xmlDocDumpFormatMemory (xmlDocPtr cur,
- xmlChar **mem,
- int *size,
- int format);
-void xmlDocDumpMemory (xmlDocPtr cur,
- xmlChar **mem,
- int *size);
-void xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
- xmlChar **doc_txt_ptr,
- int * doc_txt_len,
- const char *txt_encoding);
-void xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
- xmlChar **doc_txt_ptr,
- int * doc_txt_len,
- const char *txt_encoding,
- int format);
-int xmlDocFormatDump(FILE *f,
- xmlDocPtr cur,
- int format);
-int xmlDocDump (FILE *f,
- xmlDocPtr cur);
-void xmlElemDump (FILE *f,
- xmlDocPtr doc,
- xmlNodePtr cur);
-int xmlSaveFile (const char *filename,
- xmlDocPtr cur);
-int xmlSaveFormatFile (const char *filename,
- xmlDocPtr cur,
- int format);
-int xmlNodeDump (xmlBufferPtr buf,
- xmlDocPtr doc,
- xmlNodePtr cur,
- int level,
- int format);
-
-int xmlSaveFileTo (xmlOutputBufferPtr buf,
- xmlDocPtr cur,
- const char *encoding);
-int xmlSaveFormatFileTo (xmlOutputBufferPtr buf,
- xmlDocPtr cur,
- const char *encoding,
- int format);
-void xmlNodeDumpOutput (xmlOutputBufferPtr buf,
- xmlDocPtr doc,
- xmlNodePtr cur,
- int level,
- int format,
- const char *encoding);
-
-int xmlSaveFormatFileEnc (const char *filename,
- xmlDocPtr cur,
- const char *encoding,
- int format);
-
-int xmlSaveFileEnc (const char *filename,
- xmlDocPtr cur,
- const char *encoding);
-
-/*
- * XHTML
- */
-int xmlIsXHTML (const xmlChar *systemID,
- const xmlChar *publicID);
-
-/*
- * Compression.
- */
-int xmlGetDocCompressMode (xmlDocPtr doc);
-void xmlSetDocCompressMode (xmlDocPtr doc,
- int mode);
-int xmlGetCompressMode (void);
-void xmlSetCompressMode (int mode);
-
-#ifdef __cplusplus
-}
-#endif
-#ifndef __XML_PARSER_H__
-#include <libxml/xmlmemory.h>
-#endif
-
-#endif /* __XML_TREE_H__ */
-
diff --git a/bundle/libxml/include/libxml/uri.h b/bundle/libxml/include/libxml/uri.h
deleted file mode 100644
index 8ca7dad981..0000000000
--- a/bundle/libxml/include/libxml/uri.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * uri.c: library of generic URI related routines
- *
- * Reference: RFC 2396
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __XML_URI_H__
-#define __XML_URI_H__
-
-#include <libxml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlURI:
- *
- * A parsed URI reference. This is a struct containing the various fields
- * as described in RFC 2396 but separated for further processing.
- */
-typedef struct _xmlURI xmlURI;
-typedef xmlURI *xmlURIPtr;
-struct _xmlURI {
- char *scheme; /* the URI scheme */
- char *opaque; /* opaque part */
- char *authority; /* the authority part */
- char *server; /* the server part */
- char *user; /* the user part */
- int port; /* the port number */
- char *path; /* the path string */
- char *query; /* the query string */
- char *fragment; /* the fragment identifier */
- int cleanup; /* parsing potentially unclean URI */
-};
-
-/*
- * This function is in tree.h:
- * xmlChar * xmlNodeGetBase (xmlDocPtr doc,
- * xmlNodePtr cur);
- */
-xmlURIPtr xmlCreateURI (void);
-xmlChar * xmlBuildURI (const xmlChar *URI,
- const xmlChar *base);
-xmlURIPtr xmlParseURI (const char *str);
-int xmlParseURIReference (xmlURIPtr uri,
- const char *str);
-xmlChar * xmlSaveUri (xmlURIPtr uri);
-void xmlPrintURI (FILE *stream,
- xmlURIPtr uri);
-xmlChar * xmlURIEscapeStr (const xmlChar *str,
- const xmlChar *list);
-char * xmlURIUnescapeString (const char *str,
- int len,
- char *target);
-int xmlNormalizeURIPath (char *path);
-xmlChar * xmlURIEscape (const xmlChar *str);
-void xmlFreeURI (xmlURIPtr uri);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_URI_H__ */
diff --git a/bundle/libxml/include/libxml/valid.h b/bundle/libxml/include/libxml/valid.h
deleted file mode 100644
index 4cc5f9788d..0000000000
--- a/bundle/libxml/include/libxml/valid.h
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * valid.h : interface to the DTD handling and the validity checking
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-
-#ifndef __XML_VALID_H__
-#define __XML_VALID_H__
-
-#include <libxml/tree.h>
-#include <libxml/list.h>
-#include <libxml/xmlautomata.h>
-#include <libxml/xmlregexp.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Validation state added for non-determinist content model.
- */
-typedef struct _xmlValidState xmlValidState;
-typedef xmlValidState *xmlValidStatePtr;
-
-/**
- * xmlValidityErrorFunc:
- * @ctx: an xmlValidCtxtPtr validity error context
- * @msg: the string to format *printf like vararg
- * @...: remaining arguments to the format
- *
- * Callback called when a validity error is found. This is a message
- * oriented function similar to an *printf function.
- */
-typedef void (*xmlValidityErrorFunc) (void *ctx,
- const char *msg,
- ...);
-
-/**
- * xmlValidityWarningFunc:
- * @ctx: an xmlValidCtxtPtr validity error context
- * @msg: the string to format *printf like vararg
- * @...: remaining arguments to the format
- *
- * Callback called when a validity warning is found. This is a message
- * oriented function similar to an *printf function.
- */
-typedef void (*xmlValidityWarningFunc) (void *ctx,
- const char *msg,
- ...);
-
-/**
- * xmlValidCtxt:
- * An xmlValidCtxt is used for error reporting when validating.
- */
-typedef struct _xmlValidCtxt xmlValidCtxt;
-typedef xmlValidCtxt *xmlValidCtxtPtr;
-struct _xmlValidCtxt {
- void *userData; /* user specific data block */
- xmlValidityErrorFunc error; /* the callback in case of errors */
- xmlValidityWarningFunc warning; /* the callback in case of warning */
-
- /* Node analysis stack used when validating within entities */
- xmlNodePtr node; /* Current parsed Node */
- int nodeNr; /* Depth of the parsing stack */
- int nodeMax; /* Max depth of the parsing stack */
- xmlNodePtr *nodeTab; /* array of nodes */
-
- int finishDtd; /* finished validating the Dtd ? */
- xmlDocPtr doc; /* the document */
- int valid; /* temporary validity check result */
-
- /* state state used for non-determinist content validation */
- xmlValidState *vstate; /* current state */
- int vstateNr; /* Depth of the validation stack */
- int vstateMax; /* Max depth of the validation stack */
- xmlValidState *vstateTab; /* array of validation states */
-
-#ifdef LIBXML_REGEXP_ENABLED
- xmlAutomataPtr am; /* the automata */
- xmlAutomataStatePtr state; /* used to build the automata */
-#else
- void *am;
- void *state;
-#endif
-};
-
-/*
- * ALL notation declarations are stored in a table.
- * There is one table per DTD.
- */
-
-typedef struct _xmlHashTable xmlNotationTable;
-typedef xmlNotationTable *xmlNotationTablePtr;
-
-/*
- * ALL element declarations are stored in a table.
- * There is one table per DTD.
- */
-
-typedef struct _xmlHashTable xmlElementTable;
-typedef xmlElementTable *xmlElementTablePtr;
-
-/*
- * ALL attribute declarations are stored in a table.
- * There is one table per DTD.
- */
-
-typedef struct _xmlHashTable xmlAttributeTable;
-typedef xmlAttributeTable *xmlAttributeTablePtr;
-
-/*
- * ALL IDs attributes are stored in a table.
- * There is one table per document.
- */
-
-typedef struct _xmlHashTable xmlIDTable;
-typedef xmlIDTable *xmlIDTablePtr;
-
-/*
- * ALL Refs attributes are stored in a table.
- * There is one table per document.
- */
-
-typedef struct _xmlHashTable xmlRefTable;
-typedef xmlRefTable *xmlRefTablePtr;
-
-/* helper */
-xmlChar * xmlSplitQName2 (const xmlChar *name,
- xmlChar **prefix);
-
-/* Notation */
-xmlNotationPtr xmlAddNotationDecl (xmlValidCtxtPtr ctxt,
- xmlDtdPtr dtd,
- const xmlChar *name,
- const xmlChar *PublicID,
- const xmlChar *SystemID);
-xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table);
-void xmlFreeNotationTable(xmlNotationTablePtr table);
-void xmlDumpNotationDecl (xmlBufferPtr buf,
- xmlNotationPtr nota);
-void xmlDumpNotationTable(xmlBufferPtr buf,
- xmlNotationTablePtr table);
-
-/* Element Content */
-xmlElementContentPtr xmlNewElementContent (xmlChar *name,
- xmlElementContentType type);
-xmlElementContentPtr xmlCopyElementContent(xmlElementContentPtr content);
-void xmlFreeElementContent(xmlElementContentPtr cur);
-void xmlSnprintfElementContent(char *buf,
- int size,
- xmlElementContentPtr content,
- int glob);
-/* DEPRECATED */
-void xmlSprintfElementContent(char *buf,
- xmlElementContentPtr content,
- int glob);
-/* DEPRECATED */
-
-/* Element */
-xmlElementPtr xmlAddElementDecl (xmlValidCtxtPtr ctxt,
- xmlDtdPtr dtd,
- const xmlChar *name,
- xmlElementTypeVal type,
- xmlElementContentPtr content);
-xmlElementTablePtr xmlCopyElementTable (xmlElementTablePtr table);
-void xmlFreeElementTable (xmlElementTablePtr table);
-void xmlDumpElementTable (xmlBufferPtr buf,
- xmlElementTablePtr table);
-void xmlDumpElementDecl (xmlBufferPtr buf,
- xmlElementPtr elem);
-
-/* Enumeration */
-xmlEnumerationPtr xmlCreateEnumeration (xmlChar *name);
-void xmlFreeEnumeration (xmlEnumerationPtr cur);
-xmlEnumerationPtr xmlCopyEnumeration (xmlEnumerationPtr cur);
-
-/* Attribute */
-xmlAttributePtr xmlAddAttributeDecl (xmlValidCtxtPtr ctxt,
- xmlDtdPtr dtd,
- const xmlChar *elem,
- const xmlChar *name,
- const xmlChar *ns,
- xmlAttributeType type,
- xmlAttributeDefault def,
- const xmlChar *defaultValue,
- xmlEnumerationPtr tree);
-xmlAttributeTablePtr xmlCopyAttributeTable (xmlAttributeTablePtr table);
-void xmlFreeAttributeTable (xmlAttributeTablePtr table);
-void xmlDumpAttributeTable (xmlBufferPtr buf,
- xmlAttributeTablePtr table);
-void xmlDumpAttributeDecl (xmlBufferPtr buf,
- xmlAttributePtr attr);
-
-/* IDs */
-xmlIDPtr xmlAddID (xmlValidCtxtPtr ctxt,
- xmlDocPtr doc,
- const xmlChar *value,
- xmlAttrPtr attr);
-void xmlFreeIDTable (xmlIDTablePtr table);
-xmlAttrPtr xmlGetID (xmlDocPtr doc,
- const xmlChar *ID);
-int xmlIsID (xmlDocPtr doc,
- xmlNodePtr elem,
- xmlAttrPtr attr);
-int xmlRemoveID (xmlDocPtr doc, xmlAttrPtr attr);
-
-/* IDREFs */
-xmlRefPtr xmlAddRef (xmlValidCtxtPtr ctxt,
- xmlDocPtr doc,
- const xmlChar *value,
- xmlAttrPtr attr);
-void xmlFreeRefTable (xmlRefTablePtr table);
-int xmlIsRef (xmlDocPtr doc,
- xmlNodePtr elem,
- xmlAttrPtr attr);
-int xmlRemoveRef (xmlDocPtr doc, xmlAttrPtr attr);
-xmlListPtr xmlGetRefs (xmlDocPtr doc,
- const xmlChar *ID);
-
-/**
- * The public function calls related to validity checking.
- */
-
-int xmlValidateRoot (xmlValidCtxtPtr ctxt,
- xmlDocPtr doc);
-int xmlValidateElementDecl (xmlValidCtxtPtr ctxt,
- xmlDocPtr doc,
- xmlElementPtr elem);
-xmlChar * xmlValidNormalizeAttributeValue(xmlDocPtr doc,
- xmlNodePtr elem,
- const xmlChar *name,
- const xmlChar *value);
-xmlChar * xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt,
- xmlDocPtr doc,
- xmlNodePtr elem,
- const xmlChar *name,
- const xmlChar *value);
-int xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
- xmlDocPtr doc,
- xmlAttributePtr attr);
-int xmlValidateAttributeValue(xmlAttributeType type,
- const xmlChar *value);
-int xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
- xmlDocPtr doc,
- xmlNotationPtr nota);
-int xmlValidateDtd (xmlValidCtxtPtr ctxt,
- xmlDocPtr doc,
- xmlDtdPtr dtd);
-int xmlValidateDtdFinal (xmlValidCtxtPtr ctxt,
- xmlDocPtr doc);
-int xmlValidateDocument (xmlValidCtxtPtr ctxt,
- xmlDocPtr doc);
-int xmlValidateElement (xmlValidCtxtPtr ctxt,
- xmlDocPtr doc,
- xmlNodePtr elem);
-int xmlValidateOneElement (xmlValidCtxtPtr ctxt,
- xmlDocPtr doc,
- xmlNodePtr elem);
-int xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
- xmlDocPtr doc,
- xmlNodePtr elem,
- xmlAttrPtr attr,
- const xmlChar *value);
-int xmlValidateOneNamespace (xmlValidCtxtPtr ctxt,
- xmlDocPtr doc,
- xmlNodePtr elem,
- const xmlChar *prefix,
- xmlNsPtr ns,
- const xmlChar *value);
-int xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
- xmlDocPtr doc);
-int xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
- xmlDocPtr doc,
- const xmlChar *notationName);
-int xmlIsMixedElement (xmlDocPtr doc,
- const xmlChar *name);
-xmlAttributePtr xmlGetDtdAttrDesc (xmlDtdPtr dtd,
- const xmlChar *elem,
- const xmlChar *name);
-xmlAttributePtr xmlGetDtdQAttrDesc (xmlDtdPtr dtd,
- const xmlChar *elem,
- const xmlChar *name,
- const xmlChar *prefix);
-xmlNotationPtr xmlGetDtdNotationDesc (xmlDtdPtr dtd,
- const xmlChar *name);
-xmlElementPtr xmlGetDtdQElementDesc (xmlDtdPtr dtd,
- const xmlChar *name,
- const xmlChar *prefix);
-xmlElementPtr xmlGetDtdElementDesc (xmlDtdPtr dtd,
- const xmlChar *name);
-
-int xmlValidGetValidElements(xmlNode *prev,
- xmlNode *next,
- const xmlChar **list,
- int max);
-int xmlValidGetPotentialChildren(xmlElementContent *ctree,
- const xmlChar **list,
- int *len,
- int max);
-int xmlValidateNameValue (const xmlChar *value);
-int xmlValidateNamesValue (const xmlChar *value);
-int xmlValidateNmtokenValue (const xmlChar *value);
-int xmlValidateNmtokensValue(const xmlChar *value);
-
-#ifdef LIBXML_REGEXP_ENABLED
-/*
- * Validation based on the regexp support
- */
-int xmlValidBuildContentModel(xmlValidCtxtPtr ctxt,
- xmlElementPtr elem);
-
-#endif /* LIBXML_REGEXP_ENABLED */
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_VALID_H__ */
diff --git a/bundle/libxml/include/libxml/xinclude.h b/bundle/libxml/include/libxml/xinclude.h
deleted file mode 100644
index 9c83ba0e5c..0000000000
--- a/bundle/libxml/include/libxml/xinclude.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * xinclude.c : API to handle XInclude processing
- *
- * World Wide Web Consortium Working Draft 26 October 2000
- * http://www.w3.org/TR/2000/WD-xinclude-20001026
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __XML_XINCLUDE_H__
-#define __XML_XINCLUDE_H__
-
-#include <libxml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int xmlXIncludeProcess (xmlDocPtr doc);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_XINCLUDE_H__ */
diff --git a/bundle/libxml/include/libxml/xlink.h b/bundle/libxml/include/libxml/xlink.h
deleted file mode 100644
index c7f48c8539..0000000000
--- a/bundle/libxml/include/libxml/xlink.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * xlink.h : interfaces to the hyperlinks detection module
- *
- * See Copyright for the status of this software.
- *
- * Related specification: http://www.w3.org/TR/xlink
- * http://www.w3.org/HTML/
- * and XBase
- *
- * daniel@veillard.com
- */
-
-#ifndef __XML_XLINK_H__
-#define __XML_XLINK_H__
-
-#include <libxml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-/**
- * Various defines for the various Link properties.
- *
- * NOTE: the link detection layer will try to resolve QName expansion
- * of namespaces. If "foo" is the prefix for "http://foo.com/"
- * then the link detection layer will expand role="foo:myrole"
- * to "http://foo.com/:myrole".
- * NOTE: the link detection layer will expand URI-Refences found on
- * href attributes by using the base mechanism if found.
- */
-typedef xmlChar *xlinkHRef;
-typedef xmlChar *xlinkRole;
-typedef xmlChar *xlinkTitle;
-
-typedef enum {
- XLINK_TYPE_NONE = 0,
- XLINK_TYPE_SIMPLE,
- XLINK_TYPE_EXTENDED,
- XLINK_TYPE_EXTENDED_SET
-} xlinkType;
-
-typedef enum {
- XLINK_SHOW_NONE = 0,
- XLINK_SHOW_NEW,
- XLINK_SHOW_EMBED,
- XLINK_SHOW_REPLACE
-} xlinkShow;
-
-typedef enum {
- XLINK_ACTUATE_NONE = 0,
- XLINK_ACTUATE_AUTO,
- XLINK_ACTUATE_ONREQUEST
-} xlinkActuate;
-
-/**
- * xlinkNodeDetectFunc:
- * @ctx: user data pointer
- * @node: the node to check
- *
- * This is the prototype for the link detection routine.
- * It calls the default link detection callbacks upon link detection.
- */
-typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node);
-
-/**
- * The link detection module interact with the upper layers using
- * a set of callback registered at parsing time.
- */
-
-/**
- * xlinkSimpleLinkFunk:
- * @ctx: user data pointer
- * @node: the node carrying the link
- * @href: the target of the link
- * @role: the role string
- * @title: the link title
- *
- * This is the prototype for a simple link detection callback.
- */
-typedef void
-(*xlinkSimpleLinkFunk) (void *ctx,
- xmlNodePtr node,
- const xlinkHRef href,
- const xlinkRole role,
- const xlinkTitle title);
-
-/**
- * xlinkExtendedLinkFunk:
- * @ctx: user data pointer
- * @node: the node carrying the link
- * @nbLocators: the number of locators detected on the link
- * @hrefs: pointer to the array of locator hrefs
- * @roles: pointer to the array of locator roles
- * @nbArcs: the number of arcs detected on the link
- * @from: pointer to the array of source roles found on the arcs
- * @to: pointer to the array of target roles found on the arcs
- * @show: array of values for the show attributes found on the arcs
- * @actuate: array of values for the actuate attributes found on the arcs
- * @nbTitles: the number of titles detected on the link
- * @title: array of titles detected on the link
- * @langs: array of xml:lang values for the titles
- *
- * This is the prototype for a extended link detection callback.
- */
-typedef void
-(*xlinkExtendedLinkFunk)(void *ctx,
- xmlNodePtr node,
- int nbLocators,
- const xlinkHRef *hrefs,
- const xlinkRole *roles,
- int nbArcs,
- const xlinkRole *from,
- const xlinkRole *to,
- xlinkShow *show,
- xlinkActuate *actuate,
- int nbTitles,
- const xlinkTitle *titles,
- const xmlChar **langs);
-
-/**
- * xlinkExtendedLinkSetFunk:
- * @ctx: user data pointer
- * @node: the node carrying the link
- * @nbLocators: the number of locators detected on the link
- * @hrefs: pointer to the array of locator hrefs
- * @roles: pointer to the array of locator roles
- * @nbTitles: the number of titles detected on the link
- * @title: array of titles detected on the link
- * @langs: array of xml:lang values for the titles
- *
- * This is the prototype for a extended link set detection callback.
- */
-typedef void
-(*xlinkExtendedLinkSetFunk) (void *ctx,
- xmlNodePtr node,
- int nbLocators,
- const xlinkHRef *hrefs,
- const xlinkRole *roles,
- int nbTitles,
- const xlinkTitle *titles,
- const xmlChar **langs);
-
-/**
- * This is the structure containing a set of Links detection callbacks.
- *
- * There is no default xlink callbacks, if one want to get link
- * recognition activated, those call backs must be provided before parsing.
- */
-typedef struct _xlinkHandler xlinkHandler;
-typedef xlinkHandler *xlinkHandlerPtr;
-struct _xlinkHandler {
- xlinkSimpleLinkFunk simple;
- xlinkExtendedLinkFunk extended;
- xlinkExtendedLinkSetFunk set;
-};
-
-/*
- * The default detection routine, can be overridden, they call the default
- * detection callbacks.
- */
-
-xlinkNodeDetectFunc xlinkGetDefaultDetect (void);
-void xlinkSetDefaultDetect (xlinkNodeDetectFunc func);
-
-/*
- * Routines to set/get the default handlers.
- */
-xlinkHandlerPtr xlinkGetDefaultHandler (void);
-void xlinkSetDefaultHandler (xlinkHandlerPtr handler);
-
-/*
- * Link detection module itself.
- */
-xlinkType xlinkIsLink (xmlDocPtr doc,
- xmlNodePtr node);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_XLINK_H__ */
diff --git a/bundle/libxml/include/libxml/xmlIO.h b/bundle/libxml/include/libxml/xmlIO.h
deleted file mode 100644
index cd4058c88c..0000000000
--- a/bundle/libxml/include/libxml/xmlIO.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * xmlIO.h : interface for the I/O interfaces used by the parser
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- *
- */
-
-#ifndef __XML_IO_H__
-#define __XML_IO_H__
-
-#include <stdio.h>
-#include <libxml/xmlversion.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Those are the functions and datatypes for the parser input
- * I/O structures.
- */
-
-/**
- * xmlInputMatchCallback:
- * @filename: the filename or URI
- *
- * Callback used in the I/O Input API to detect if the current handler
- * can provide input fonctionnalities for this resource.
- *
- * Returns 1 if yes and 0 if another Input module should be used
- */
-typedef int (*xmlInputMatchCallback) (char const *filename);
-/**
- * xmlInputOpenCallback:
- * @filename: the filename or URI
- *
- * Callback used in the I/O Input API to open the resource
- *
- * Returns an Input context or NULL in case or error
- */
-typedef void * (*xmlInputOpenCallback) (char const *filename);
-/**
- * xmlInputReadCallback:
- * @context: an Input context
- * @buffer: the buffer to store data read
- * @len: the length of the buffer in bytes
- *
- * Callback used in the I/O Input API to read the resource
- *
- * Returns the number of bytes read or -1 in case of error
- */
-typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len);
-/**
- * xmlInputCloseCallback:
- * @context: an Input context
- *
- * Callback used in the I/O Input API to close the resource
- *
- * Returns 0 or -1 in case of error
- */
-typedef int (*xmlInputCloseCallback) (void * context);
-
-/*
- * Those are the functions and datatypes for the library output
- * I/O structures.
- */
-
-/**
- * xmlOutputMatchCallback:
- * @filename: the filename or URI
- *
- * Callback used in the I/O Output API to detect if the current handler
- * can provide output fonctionnalities for this resource.
- *
- * Returns 1 if yes and 0 if another Output module should be used
- */
-typedef int (*xmlOutputMatchCallback) (char const *filename);
-/**
- * xmlOutputOpenCallback:
- * @filename: the filename or URI
- *
- * Callback used in the I/O Output API to open the resource
- *
- * Returns an Output context or NULL in case or error
- */
-typedef void * (*xmlOutputOpenCallback) (char const *filename);
-/**
- * xmlOutputWriteCallback:
- * @context: an Output context
- * @buffer: the buffer of data to write
- * @len: the length of the buffer in bytes
- *
- * Callback used in the I/O Output API to write to the resource
- *
- * Returns the number of bytes written or -1 in case of error
- */
-typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer,
- int len);
-/**
- * xmlOutputCloseCallback:
- * @context: an Output context
- *
- * Callback used in the I/O Output API to close the resource
- *
- * Returns 0 or -1 in case of error
- */
-typedef int (*xmlOutputCloseCallback) (void * context);
-
-#ifdef __cplusplus
-}
-#endif
-
-#include <libxml/globals.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/encoding.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-struct _xmlParserInputBuffer {
- void* context;
- xmlInputReadCallback readcallback;
- xmlInputCloseCallback closecallback;
-
- xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
-
- xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 */
- xmlBufferPtr raw; /* if encoder != NULL buffer for raw input */
-};
-
-
-struct _xmlOutputBuffer {
- void* context;
- xmlOutputWriteCallback writecallback;
- xmlOutputCloseCallback closecallback;
-
- xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
-
- xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */
- xmlBufferPtr conv; /* if encoder != NULL buffer for output */
- int written; /* total number of byte written */
-};
-
-/*
- * Interfaces for input
- */
-void xmlCleanupInputCallbacks (void);
-void xmlCleanupOutputCallbacks (void);
-
-void xmlRegisterDefaultInputCallbacks (void);
-xmlParserInputBufferPtr
- xmlAllocParserInputBuffer (xmlCharEncoding enc);
-
-xmlParserInputBufferPtr
- xmlParserInputBufferCreateFilename (const char *URI,
- xmlCharEncoding enc);
-xmlParserInputBufferPtr
- xmlParserInputBufferCreateFile (FILE *file,
- xmlCharEncoding enc);
-xmlParserInputBufferPtr
- xmlParserInputBufferCreateFd (int fd,
- xmlCharEncoding enc);
-xmlParserInputBufferPtr
- xmlParserInputBufferCreateMem (const char *mem, int size,
- xmlCharEncoding enc);
-xmlParserInputBufferPtr
- xmlParserInputBufferCreateIO (xmlInputReadCallback ioread,
- xmlInputCloseCallback ioclose,
- void *ioctx,
- xmlCharEncoding enc);
-int xmlParserInputBufferRead (xmlParserInputBufferPtr in,
- int len);
-int xmlParserInputBufferGrow (xmlParserInputBufferPtr in,
- int len);
-int xmlParserInputBufferPush (xmlParserInputBufferPtr in,
- int len,
- const char *buf);
-void xmlFreeParserInputBuffer (xmlParserInputBufferPtr in);
-char * xmlParserGetDirectory (const char *filename);
-
-int xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
- xmlInputOpenCallback openFunc,
- xmlInputReadCallback readFunc,
- xmlInputCloseCallback closeFunc);
-/*
- * Interfaces for output
- */
-void xmlRegisterDefaultOutputCallbacks(void);
-xmlOutputBufferPtr
- xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder);
-
-xmlOutputBufferPtr
- xmlOutputBufferCreateFilename (const char *URI,
- xmlCharEncodingHandlerPtr encoder,
- int compression);
-
-xmlOutputBufferPtr
- xmlOutputBufferCreateFile (FILE *file,
- xmlCharEncodingHandlerPtr encoder);
-
-xmlOutputBufferPtr
- xmlOutputBufferCreateFd (int fd,
- xmlCharEncodingHandlerPtr encoder);
-
-xmlOutputBufferPtr
- xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite,
- xmlOutputCloseCallback ioclose,
- void *ioctx,
- xmlCharEncodingHandlerPtr encoder);
-
-int xmlOutputBufferWrite (xmlOutputBufferPtr out,
- int len,
- const char *buf);
-int xmlOutputBufferWriteString (xmlOutputBufferPtr out,
- const char *str);
-
-int xmlOutputBufferFlush (xmlOutputBufferPtr out);
-int xmlOutputBufferClose (xmlOutputBufferPtr out);
-
-int xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc,
- xmlOutputOpenCallback openFunc,
- xmlOutputWriteCallback writeFunc,
- xmlOutputCloseCallback closeFunc);
-
-/* This function only exists if HTTP support built into the library */
-#ifdef LIBXML_HTTP_ENABLED
-void * xmlIOHTTPOpenW (const char * post_uri,
- int compression );
-void xmlRegisterHTTPPostCallbacks (void );
-#endif
-
-/*
- * A predefined entity loader disabling network accesses
- */
-xmlParserInputPtr xmlNoNetExternalEntityLoader(const char *URL,
- const char *ID,
- xmlParserCtxtPtr ctxt);
-
-xmlChar *xmlNormalizeWindowsPath (const xmlChar *path);
-
-int xmlCheckFilename (const char *path);
-/**
- * Default 'file://' protocol callbacks
- */
-int xmlFileMatch (const char *filename);
-void * xmlFileOpen (const char *filename);
-int xmlFileRead (void * context,
- char * buffer,
- int len);
-int xmlFileClose (void * context);
-
-/**
- * Default 'http://' protocol callbacks
- */
-#ifdef LIBXML_HTTP_ENABLED
-int xmlIOHTTPMatch (const char *filename);
-void * xmlIOHTTPOpen (const char *filename);
-int xmlIOHTTPRead (void * context,
- char * buffer,
- int len);
-int xmlIOHTTPClose (void * context);
-#endif /* LIBXML_HTTP_ENABLED */
-
-/**
- * Default 'ftp://' protocol callbacks
- */
-#ifdef LIBXML_FTP_ENABLED
-int xmlIOFTPMatch (const char *filename);
-void * xmlIOFTPOpen (const char *filename);
-int xmlIOFTPRead (void * context,
- char * buffer,
- int len);
-int xmlIOFTPClose (void * context);
-#endif /* LIBXML_FTP_ENABLED */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __XML_IO_H__ */
diff --git a/bundle/libxml/include/libxml/xmlautomata.h b/bundle/libxml/include/libxml/xmlautomata.h
deleted file mode 100644
index 96ba2245b3..0000000000
--- a/bundle/libxml/include/libxml/xmlautomata.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * automata.h : description of the API to build regexp automats
- *
- * See Copyright for the status of this software.
- *
- * Daniel Veillard <veillard@redhat.com>
- */
-
-#ifndef __XML_AUTOMATA_H__
-#define __XML_AUTOMATA_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-
-#ifdef LIBXML_AUTOMATA_ENABLED
-#include <libxml/xmlregexp.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlAutomataPtr:
- *
- * A libxml automata description, It can be compiled into a regexp
- */
-typedef struct _xmlAutomata xmlAutomata;
-typedef xmlAutomata *xmlAutomataPtr;
-
-/**
- * xmlAutomataStatePtr:
- *
- * A state int the automata description,
- */
-typedef struct _xmlAutomataState xmlAutomataState;
-typedef xmlAutomataState *xmlAutomataStatePtr;
-
-/*
- * Building API
- */
-xmlAutomataPtr xmlNewAutomata (void);
-void xmlFreeAutomata (xmlAutomataPtr am);
-
-xmlAutomataStatePtr xmlAutomataGetInitState (xmlAutomataPtr am);
-int xmlAutomataSetFinalState(xmlAutomataPtr am,
- xmlAutomataStatePtr state);
-xmlAutomataStatePtr xmlAutomataNewState (xmlAutomataPtr am);
-xmlAutomataStatePtr xmlAutomataNewTransition(xmlAutomataPtr am,
- xmlAutomataStatePtr from,
- xmlAutomataStatePtr to,
- const xmlChar *token,
- void *data);
-xmlAutomataStatePtr xmlAutomataNewCountTrans(xmlAutomataPtr am,
- xmlAutomataStatePtr from,
- xmlAutomataStatePtr to,
- const xmlChar *token,
- int min,
- int max,
- void *data);
-xmlAutomataStatePtr xmlAutomataNewOnceTrans (xmlAutomataPtr am,
- xmlAutomataStatePtr from,
- xmlAutomataStatePtr to,
- const xmlChar *token,
- int min,
- int max,
- void *data);
-xmlAutomataStatePtr xmlAutomataNewAllTrans (xmlAutomataPtr am,
- xmlAutomataStatePtr from,
- xmlAutomataStatePtr to,
- int lax);
-xmlAutomataStatePtr xmlAutomataNewEpsilon (xmlAutomataPtr am,
- xmlAutomataStatePtr from,
- xmlAutomataStatePtr to);
-xmlAutomataStatePtr xmlAutomataNewCountedTrans(xmlAutomataPtr am,
- xmlAutomataStatePtr from,
- xmlAutomataStatePtr to,
- int counter);
-xmlAutomataStatePtr xmlAutomataNewCounterTrans(xmlAutomataPtr am,
- xmlAutomataStatePtr from,
- xmlAutomataStatePtr to,
- int counter);
-int xmlAutomataNewCounter (xmlAutomataPtr am,
- int min,
- int max);
-
-xmlRegexpPtr xmlAutomataCompile (xmlAutomataPtr am);
-int xmlAutomataIsDeterminist(xmlAutomataPtr am);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_AUTOMATA_ENABLED */
-#endif /* __XML_AUTOMATA_H__ */
diff --git a/bundle/libxml/include/libxml/xmlerror.h b/bundle/libxml/include/libxml/xmlerror.h
deleted file mode 100644
index 33e2275910..0000000000
--- a/bundle/libxml/include/libxml/xmlerror.h
+++ /dev/null
@@ -1,184 +0,0 @@
-#include <libxml/parser.h>
-
-#ifndef __XML_ERROR_H__
-#define __XML_ERROR_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- XML_ERR_OK = 0,
- XML_ERR_INTERNAL_ERROR,
- XML_ERR_NO_MEMORY,
-
- XML_ERR_DOCUMENT_START, /* 3 */
- XML_ERR_DOCUMENT_EMPTY,
- XML_ERR_DOCUMENT_END,
-
- XML_ERR_INVALID_HEX_CHARREF, /* 6 */
- XML_ERR_INVALID_DEC_CHARREF,
- XML_ERR_INVALID_CHARREF,
- XML_ERR_INVALID_CHAR,
-
- XML_ERR_CHARREF_AT_EOF, /* 10 */
- XML_ERR_CHARREF_IN_PROLOG,
- XML_ERR_CHARREF_IN_EPILOG,
- XML_ERR_CHARREF_IN_DTD,
- XML_ERR_ENTITYREF_AT_EOF,
- XML_ERR_ENTITYREF_IN_PROLOG,
- XML_ERR_ENTITYREF_IN_EPILOG,
- XML_ERR_ENTITYREF_IN_DTD,
- XML_ERR_PEREF_AT_EOF,
- XML_ERR_PEREF_IN_PROLOG,
- XML_ERR_PEREF_IN_EPILOG,
- XML_ERR_PEREF_IN_INT_SUBSET,
-
- XML_ERR_ENTITYREF_NO_NAME, /* 22 */
- XML_ERR_ENTITYREF_SEMICOL_MISSING,
-
- XML_ERR_PEREF_NO_NAME, /* 24 */
- XML_ERR_PEREF_SEMICOL_MISSING,
-
- XML_ERR_UNDECLARED_ENTITY, /* 26 */
- XML_WAR_UNDECLARED_ENTITY,
- XML_ERR_UNPARSED_ENTITY,
- XML_ERR_ENTITY_IS_EXTERNAL,
- XML_ERR_ENTITY_IS_PARAMETER,
-
- XML_ERR_UNKNOWN_ENCODING, /* 31 */
- XML_ERR_UNSUPPORTED_ENCODING,
-
- XML_ERR_STRING_NOT_STARTED, /* 33 */
- XML_ERR_STRING_NOT_CLOSED,
- XML_ERR_NS_DECL_ERROR,
-
- XML_ERR_ENTITY_NOT_STARTED, /* 36 */
- XML_ERR_ENTITY_NOT_FINISHED,
-
- XML_ERR_LT_IN_ATTRIBUTE, /* 38 */
- XML_ERR_ATTRIBUTE_NOT_STARTED,
- XML_ERR_ATTRIBUTE_NOT_FINISHED,
- XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
- XML_ERR_ATTRIBUTE_REDEFINED,
-
- XML_ERR_LITERAL_NOT_STARTED, /* 43 */
- XML_ERR_LITERAL_NOT_FINISHED,
-
- XML_ERR_COMMENT_NOT_FINISHED, /* 45 */
-
- XML_ERR_PI_NOT_STARTED, /* 47 */
- XML_ERR_PI_NOT_FINISHED,
-
- XML_ERR_NOTATION_NOT_STARTED, /* 49 */
- XML_ERR_NOTATION_NOT_FINISHED,
-
- XML_ERR_ATTLIST_NOT_STARTED, /* 51 */
- XML_ERR_ATTLIST_NOT_FINISHED,
-
- XML_ERR_MIXED_NOT_STARTED, /* 53 */
- XML_ERR_MIXED_NOT_FINISHED,
-
- XML_ERR_ELEMCONTENT_NOT_STARTED, /* 55 */
- XML_ERR_ELEMCONTENT_NOT_FINISHED,
-
- XML_ERR_XMLDECL_NOT_STARTED, /* 57 */
- XML_ERR_XMLDECL_NOT_FINISHED,
-
- XML_ERR_CONDSEC_NOT_STARTED, /* 59 */
- XML_ERR_CONDSEC_NOT_FINISHED,
-
- XML_ERR_EXT_SUBSET_NOT_FINISHED, /* 61 */
-
- XML_ERR_DOCTYPE_NOT_FINISHED, /* 62 */
-
- XML_ERR_MISPLACED_CDATA_END, /* 63 */
- XML_ERR_CDATA_NOT_FINISHED,
-
- XML_ERR_RESERVED_XML_NAME, /* 65 */
-
- XML_ERR_SPACE_REQUIRED, /* 66 */
- XML_ERR_SEPARATOR_REQUIRED,
- XML_ERR_NMTOKEN_REQUIRED,
- XML_ERR_NAME_REQUIRED,
- XML_ERR_PCDATA_REQUIRED,
- XML_ERR_URI_REQUIRED,
- XML_ERR_PUBID_REQUIRED,
- XML_ERR_LT_REQUIRED,
- XML_ERR_GT_REQUIRED,
- XML_ERR_LTSLASH_REQUIRED,
- XML_ERR_EQUAL_REQUIRED,
-
- XML_ERR_TAG_NAME_MISMATCH, /* 77 */
- XML_ERR_TAG_NOT_FINISHED,
-
- XML_ERR_STANDALONE_VALUE, /* 79 */
-
- XML_ERR_ENCODING_NAME, /* 80 */
-
- XML_ERR_HYPHEN_IN_COMMENT, /* 81 */
-
- XML_ERR_INVALID_ENCODING, /* 82 */
-
- XML_ERR_EXT_ENTITY_STANDALONE, /* 83 */
-
- XML_ERR_CONDSEC_INVALID, /* 84 */
-
- XML_ERR_VALUE_REQUIRED, /* 85 */
-
- XML_ERR_NOT_WELL_BALANCED, /* 86 */
- XML_ERR_EXTRA_CONTENT, /* 87 */
- XML_ERR_ENTITY_CHAR_ERROR, /* 88 */
- XML_ERR_ENTITY_PE_INTERNAL, /* 88 */
- XML_ERR_ENTITY_LOOP, /* 89 */
- XML_ERR_ENTITY_BOUNDARY, /* 90 */
- XML_ERR_INVALID_URI, /* 91 */
- XML_ERR_URI_FRAGMENT, /* 92 */
- XML_WAR_CATALOG_PI, /* 93 */
- XML_ERR_NO_DTD /* 94 */
-}xmlParserErrors;
-
-/**
- * xmlGenericErrorFunc:
- * @ctx: a parsing context
- * @msg: the message
- * @...: the extra arguments of the varags to format the message
- *
- * Signature of the function to use when there is an error and
- * no parsing or validity context available .
- */
-typedef void (*xmlGenericErrorFunc) (void *ctx,
- const char *msg,
- ...);
-
-/*
- * Use the following function to reset the two global variables
- * xmlGenericError and xmlGenericErrorContext.
- */
-void xmlSetGenericErrorFunc (void *ctx,
- xmlGenericErrorFunc handler);
-void initGenericErrorDefaultFunc(xmlGenericErrorFunc *handler);
-
-/*
- * Default message routines used by SAX and Valid context for error
- * and warning reporting.
- */
-void xmlParserError (void *ctx,
- const char *msg,
- ...);
-void xmlParserWarning (void *ctx,
- const char *msg,
- ...);
-void xmlParserValidityError (void *ctx,
- const char *msg,
- ...);
-void xmlParserValidityWarning(void *ctx,
- const char *msg,
- ...);
-void xmlParserPrintFileInfo (xmlParserInputPtr input);
-void xmlParserPrintFileContext(xmlParserInputPtr input);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_ERROR_H__ */
diff --git a/bundle/libxml/include/libxml/xmlmemory.h b/bundle/libxml/include/libxml/xmlmemory.h
deleted file mode 100644
index 8e8df944c1..0000000000
--- a/bundle/libxml/include/libxml/xmlmemory.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * xmlmemory.h: interface for the memory allocation debug.
- *
- * daniel@veillard.com
- */
-
-
-#ifndef _DEBUG_MEMORY_ALLOC_
-#define _DEBUG_MEMORY_ALLOC_
-
-#include <stdio.h>
-#include <libxml/xmlversion.h>
-
-/**
- * DEBUG_MEMORY:
- *
- * DEBUG_MEMORY replaces the allocator with a collect and debug
- * shell to the libc allocator.
- * DEBUG_MEMORY should only be activated when debugging
- * libxml i.e. if libxml has been configured with --with-debug-mem too.
- */
-/* #define DEBUG_MEMORY_FREED */
-/* #define DEBUG_MEMORY_LOCATION */
-
-#ifdef DEBUG
-#ifndef DEBUG_MEMORY
-#define DEBUG_MEMORY
-#endif
-#endif
-
-/**
- * DEBUG_MEMORY_LOCATION:
- *
- * DEBUG_MEMORY_LOCATION should be activated only when debugging
- * libxml i.e. if libxml has been configured with --with-debug-mem too.
- */
-#ifdef DEBUG_MEMORY_LOCATION
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * The XML memory wrapper support 4 basic overloadable functions.
- */
-/**
- * xmlFreeFunc:
- * @mem: an already allocated block of memory
- *
- * Signature for a free() implementation.
- */
-typedef void (*xmlFreeFunc)(void *mem);
-/**
- * xmlMallocFunc:
- * @size: the size requested in bytes
- *
- * Signature for a malloc() implementation.
- *
- * Returns a pointer to the newly allocated block or NULL in case of error.
- */
-typedef void *(*xmlMallocFunc)(size_t size);
-
-/**
- * xmlReallocFunc:
- * @mem: an already allocated block of memory
- * @size: the new size requested in bytes
- *
- * Signature for a realloc() implementation.
- *
- * Returns a pointer to the newly reallocated block or NULL in case of error.
- */
-typedef void *(*xmlReallocFunc)(void *mem, size_t size);
-
-/**
- * xmlStrdupFunc:
- * @str: a zero terminated string
- *
- * Signature for an strdup() implementation.
- *
- * Returns the copy of the string or NULL in case of error.
- */
-typedef char *(*xmlStrdupFunc)(const char *str);
-
-/*
- * The 4 interfaces used for all memory handling within libxml.
-LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree;
-LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc;
-LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc;
-LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup;
- */
-
-/*
- * The way to overload the existing functions.
- */
-int xmlMemSetup (xmlFreeFunc freeFunc,
- xmlMallocFunc mallocFunc,
- xmlReallocFunc reallocFunc,
- xmlStrdupFunc strdupFunc);
-int xmlMemGet (xmlFreeFunc *freeFunc,
- xmlMallocFunc *mallocFunc,
- xmlReallocFunc *reallocFunc,
- xmlStrdupFunc *strdupFunc);
-
-/*
- * Initialization of the memory layer.
- */
-int xmlInitMemory (void);
-
-/*
- * Those are specific to the XML debug memory wrapper.
- */
-int xmlMemUsed (void);
-void xmlMemDisplay (FILE *fp);
-void xmlMemShow (FILE *fp, int nr);
-void xmlMemoryDump (void);
-void * xmlMemMalloc (size_t size);
-void * xmlMemRealloc (void *ptr,size_t size);
-void xmlMemFree (void *ptr);
-char * xmlMemoryStrdup (const char *str);
-
-#ifdef DEBUG_MEMORY_LOCATION
-/**
- * xmlMalloc:
- * @size: number of bytes to allocate
- *
- * Wrapper for the malloc() function used in the XML library.
- *
- * Returns the pointer to the allocated area or NULL in case of error.
- */
-#define xmlMalloc(size) xmlMallocLoc((size), __FILE__, __LINE__)
-/**
- * xmlRealloc:
- * @ptr: pointer to the existing allocated area
- * @size: number of bytes to allocate
- *
- * Wrapper for the realloc() function used in the XML library.
- *
- * Returns the pointer to the allocated area or NULL in case of error.
- */
-#define xmlRealloc(ptr, size) xmlReallocLoc((ptr), (size), __FILE__, __LINE__)
-/**
- * xmlMemStrdup:
- * @str: pointer to the existing string
- *
- * Wrapper for the strdup() function, xmlStrdup() is usually preferred.
- *
- * Returns the pointer to the allocated area or NULL in case of error.
- */
-#define xmlMemStrdup(str) xmlMemStrdupLoc((str), __FILE__, __LINE__)
-
-void * xmlMallocLoc(size_t size, const char *file, int line);
-void * xmlReallocLoc(void *ptr,size_t size, const char *file, int line);
-char * xmlMemStrdupLoc(const char *str, const char *file, int line);
-#endif /* DEBUG_MEMORY_LOCATION */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#ifndef __XML_GLOBALS_H
-#ifndef __XML_THREADS_H__
-#include <libxml/threads.h>
-#include <libxml/globals.h>
-#endif
-#endif
-
-#endif /* _DEBUG_MEMORY_ALLOC_ */
-
diff --git a/bundle/libxml/include/libxml/xmlreader.h b/bundle/libxml/include/libxml/xmlreader.h
deleted file mode 100644
index 8e4b05783b..0000000000
--- a/bundle/libxml/include/libxml/xmlreader.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * xmlreader.h : Interfaces, constants and types of the XML streaming API.
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __XML_XMLREADER_H__
-#define __XML_XMLREADER_H__
-
-#include <libxml/tree.h>
-#include <libxml/xmlIO.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _xmlTextReader xmlTextReader;
-typedef xmlTextReader *xmlTextReaderPtr;
-
-/*
- * Constructors & Destructor
- */
-xmlTextReaderPtr xmlNewTextReader (xmlParserInputBufferPtr input);
-xmlTextReaderPtr xmlNewTextReaderFilename(const char *URI);
-void xmlFreeTextReader (xmlTextReaderPtr reader);
-
-/*
- * Iterators
- */
-int xmlTextReaderRead (xmlTextReaderPtr reader);
-
-/*
- * Attributes of the node
- */
-int xmlTextReaderAttributeCount(xmlTextReaderPtr reader);
-xmlChar * xmlTextReaderBaseUri (xmlTextReaderPtr reader);
-int xmlTextReaderDepth (xmlTextReaderPtr reader);
-int xmlTextReaderHasAttributes(xmlTextReaderPtr reader);
-int xmlTextReaderHasValue(xmlTextReaderPtr reader);
-int xmlTextReaderIsDefault (xmlTextReaderPtr reader);
-int xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader);
-xmlChar * xmlTextReaderLocalName (xmlTextReaderPtr reader);
-xmlChar * xmlTextReaderName (xmlTextReaderPtr reader);
-xmlChar * xmlTextReaderNamespaceUri(xmlTextReaderPtr reader);
-int xmlTextReaderNodeType (xmlTextReaderPtr reader);
-xmlChar * xmlTextReaderPrefix (xmlTextReaderPtr reader);
-int xmlTextReaderQuoteChar (xmlTextReaderPtr reader);
-xmlChar * xmlTextReaderValue (xmlTextReaderPtr reader);
-xmlChar * xmlTextReaderXmlLang (xmlTextReaderPtr reader);
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_XMLREADER_H__ */
-
diff --git a/bundle/libxml/include/libxml/xmlregexp.h b/bundle/libxml/include/libxml/xmlregexp.h
deleted file mode 100644
index 434b7a2bd9..0000000000
--- a/bundle/libxml/include/libxml/xmlregexp.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * regexp.h : describes the basic API for libxml regular expressions handling
- *
- * See Copyright for the status of this software.
- *
- * Daniel Veillard <veillard@redhat.com>
- */
-
-#ifndef __XML_REGEXP_H__
-#define __XML_REGEXP_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_REGEXP_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlRegexpPtr:
- *
- * A libxml regular expression, they can actually be far more complex
- * thank the POSIX regex expressions.
- */
-typedef struct _xmlRegexp xmlRegexp;
-typedef xmlRegexp *xmlRegexpPtr;
-
-/**
- * xmlRegExecCtxtPtr:
- *
- * A libxml progressive regular expression evaluation context
- */
-typedef struct _xmlRegExecCtxt xmlRegExecCtxt;
-typedef xmlRegExecCtxt *xmlRegExecCtxtPtr;
-
-#ifdef __cplusplus
-}
-#endif
-#include <libxml/tree.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * The POSIX like API
- */
-xmlRegexpPtr xmlRegexpCompile(const xmlChar *regexp);
-void xmlRegFreeRegexp(xmlRegexpPtr regexp);
-int xmlRegexpExec (xmlRegexpPtr comp,
- const xmlChar *value);
-void xmlRegexpPrint (FILE *output,
- xmlRegexpPtr regexp);
-int xmlRegexpIsDeterminist(xmlRegexpPtr comp);
-
-/*
- * Callback function when doing a transition in the automata
- */
-typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec,
- const xmlChar *token,
- void *transdata,
- void *inputdata);
-
-/*
- * The progressive API
- */
-xmlRegExecCtxtPtr xmlRegNewExecCtxt (xmlRegexpPtr comp,
- xmlRegExecCallbacks callback,
- void *data);
-void xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec);
-int xmlRegExecPushString (xmlRegExecCtxtPtr exec,
- const xmlChar *value,
- void *data);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_REGEXP_ENABLED */
-
-#endif /*__XML_REGEXP_H__ */
diff --git a/bundle/libxml/include/libxml/xmlschemas.h b/bundle/libxml/include/libxml/xmlschemas.h
deleted file mode 100644
index 14b9230832..0000000000
--- a/bundle/libxml/include/libxml/xmlschemas.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * schemas.h : interface to the XML Schemas handling and schema validity
- * checking
- *
- * See Copyright for the status of this software.
- *
- * Daniel.Veillard@w3.org
- */
-
-
-#ifndef __XML_SCHEMA_H__
-#define __XML_SCHEMA_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_SCHEMAS_ENABLED
-
-#include <libxml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- XML_SCHEMAS_ERR_OK = 0,
- XML_SCHEMAS_ERR_NOROOT = 1,
- XML_SCHEMAS_ERR_UNDECLAREDELEM,
- XML_SCHEMAS_ERR_NOTTOPLEVEL,
- XML_SCHEMAS_ERR_MISSING,
- XML_SCHEMAS_ERR_WRONGELEM,
- XML_SCHEMAS_ERR_NOTYPE,
- XML_SCHEMAS_ERR_NOROLLBACK,
- XML_SCHEMAS_ERR_ISABSTRACT,
- XML_SCHEMAS_ERR_NOTEMPTY,
- XML_SCHEMAS_ERR_ELEMCONT,
- XML_SCHEMAS_ERR_HAVEDEFAULT,
- XML_SCHEMAS_ERR_NOTNILLABLE,
- XML_SCHEMAS_ERR_EXTRACONTENT,
- XML_SCHEMAS_ERR_INVALIDATTR,
- XML_SCHEMAS_ERR_INVALIDELEM,
- XML_SCHEMAS_ERR_NOTDETERMINIST,
- XML_SCHEMAS_ERR_CONSTRUCT,
- XML_SCHEMAS_ERR_INTERNAL,
- XML_SCHEMAS_ERR_NOTSIMPLE,
- XML_SCHEMAS_ERR_ATTRUNKNOWN,
- XML_SCHEMAS_ERR_ATTRINVALID,
- XML_SCHEMAS_ERR_,
- XML_SCHEMAS_ERR_XXX
-} xmlSchemaValidError;
-
-
-/**
- * The schemas related types are kept internal
- */
-typedef struct _xmlSchema xmlSchema;
-typedef xmlSchema *xmlSchemaPtr;
-
-/**
- * A schemas validation context
- */
-typedef void (*xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...);
-typedef void (*xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...);
-
-typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
-typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
-
-typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
-typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
-
-/*
- * Interfaces for parsing.
- */
-xmlSchemaParserCtxtPtr xmlSchemaNewParserCtxt (const char *URL);
-xmlSchemaParserCtxtPtr xmlSchemaNewMemParserCtxt(const char *buffer,
- int size);
-void xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt);
-void xmlSchemaSetParserErrors(xmlSchemaParserCtxtPtr ctxt,
- xmlSchemaValidityErrorFunc err,
- xmlSchemaValidityWarningFunc warn,
- void *ctx);
-xmlSchemaPtr xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt);
-void xmlSchemaFree (xmlSchemaPtr schema);
-void xmlSchemaDump (FILE *output,
- xmlSchemaPtr schema);
-/*
- * Interfaces for validating
- */
-void xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
- xmlSchemaValidityErrorFunc err,
- xmlSchemaValidityWarningFunc warn,
- void *ctx);
-xmlSchemaValidCtxtPtr xmlSchemaNewValidCtxt (xmlSchemaPtr schema);
-void xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt);
-int xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
- xmlDocPtr instance);
-int xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
- xmlParserInputBufferPtr input,
- xmlCharEncoding enc,
- xmlSAXHandlerPtr sax,
- void *user_data);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_SCHEMAS_ENABLED */
-#endif /* __XML_SCHEMA_H__ */
diff --git a/bundle/libxml/include/libxml/xmlschemastypes.h b/bundle/libxml/include/libxml/xmlschemastypes.h
deleted file mode 100644
index a758c128e5..0000000000
--- a/bundle/libxml/include/libxml/xmlschemastypes.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * schemastypes.c : interface of the XML Schema Datatypes
- * definition and validity checking
- *
- * See Copyright for the status of this software.
- *
- * Daniel Veillard <veillard@redhat.com>
- */
-
-
-#ifndef __XML_SCHEMA_TYPES_H__
-#define __XML_SCHEMA_TYPES_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_SCHEMAS_ENABLED
-
-#include <libxml/schemasInternals.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void xmlSchemaInitTypes (void);
-void xmlSchemaCleanupTypes (void);
-xmlSchemaTypePtr xmlSchemaGetPredefinedType (const xmlChar *name,
- const xmlChar *ns);
-int xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type,
- const xmlChar *value,
- xmlSchemaValPtr *val);
-int xmlSchemaValidateFacet (xmlSchemaTypePtr base,
- xmlSchemaFacetPtr facet,
- const xmlChar *value,
- xmlSchemaValPtr val);
-void xmlSchemaFreeValue (xmlSchemaValPtr val);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_SCHEMAS_ENABLED */
-#endif /* __XML_SCHEMA_TYPES_H__ */
diff --git a/bundle/libxml/include/libxml/xmlunicode.h b/bundle/libxml/include/libxml/xmlunicode.h
deleted file mode 100644
index f0f1fe9ce9..0000000000
--- a/bundle/libxml/include/libxml/xmlunicode.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * xmlunicode.h: this header exports interfaces for the Unicode character APIs
- *
- * This file is automatically generated from the
- * UCS description files of the Unicode Character Database
- * http://www.unicode.org/Public/3.1-Update/UnicodeCharacterDatabase-3.1.0.html
- * using the genUnicode.py Python script.
- *
- * Generation date: Tue Apr 16 17:28:05 2002
- * Sources: Blocks-4.txt UnicodeData-3.1.0.txt
- * Daniel Veillard <veillard@redhat.com>
- */
-
-#ifndef __XML_UNICODE_H__
-#define __XML_UNICODE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int xmlUCSIsAlphabeticPresentationForms (int code);
-int xmlUCSIsArabic (int code);
-int xmlUCSIsArabicPresentationFormsA (int code);
-int xmlUCSIsArabicPresentationFormsB (int code);
-int xmlUCSIsArmenian (int code);
-int xmlUCSIsArrows (int code);
-int xmlUCSIsBasicLatin (int code);
-int xmlUCSIsBengali (int code);
-int xmlUCSIsBlockElements (int code);
-int xmlUCSIsBopomofo (int code);
-int xmlUCSIsBopomofoExtended (int code);
-int xmlUCSIsBoxDrawing (int code);
-int xmlUCSIsBraillePatterns (int code);
-int xmlUCSIsByzantineMusicalSymbols (int code);
-int xmlUCSIsCJKCompatibility (int code);
-int xmlUCSIsCJKCompatibilityForms (int code);
-int xmlUCSIsCJKCompatibilityIdeographs (int code);
-int xmlUCSIsCJKCompatibilityIdeographsSupplement (int code);
-int xmlUCSIsCJKRadicalsSupplement (int code);
-int xmlUCSIsCJKSymbolsandPunctuation (int code);
-int xmlUCSIsCJKUnifiedIdeographs (int code);
-int xmlUCSIsCJKUnifiedIdeographsExtensionA (int code);
-int xmlUCSIsCJKUnifiedIdeographsExtensionB (int code);
-int xmlUCSIsCherokee (int code);
-int xmlUCSIsCombiningDiacriticalMarks (int code);
-int xmlUCSIsCombiningHalfMarks (int code);
-int xmlUCSIsCombiningMarksforSymbols (int code);
-int xmlUCSIsControlPictures (int code);
-int xmlUCSIsCurrencySymbols (int code);
-int xmlUCSIsCyrillic (int code);
-int xmlUCSIsDeseret (int code);
-int xmlUCSIsDevanagari (int code);
-int xmlUCSIsDingbats (int code);
-int xmlUCSIsEnclosedAlphanumerics (int code);
-int xmlUCSIsEnclosedCJKLettersandMonths (int code);
-int xmlUCSIsEthiopic (int code);
-int xmlUCSIsGeneralPunctuation (int code);
-int xmlUCSIsGeometricShapes (int code);
-int xmlUCSIsGeorgian (int code);
-int xmlUCSIsGothic (int code);
-int xmlUCSIsGreek (int code);
-int xmlUCSIsGreekExtended (int code);
-int xmlUCSIsGujarati (int code);
-int xmlUCSIsGurmukhi (int code);
-int xmlUCSIsHalfwidthandFullwidthForms (int code);
-int xmlUCSIsHangulCompatibilityJamo (int code);
-int xmlUCSIsHangulJamo (int code);
-int xmlUCSIsHangulSyllables (int code);
-int xmlUCSIsHebrew (int code);
-int xmlUCSIsHighPrivateUseSurrogates (int code);
-int xmlUCSIsHighSurrogates (int code);
-int xmlUCSIsHiragana (int code);
-int xmlUCSIsIPAExtensions (int code);
-int xmlUCSIsIdeographicDescriptionCharacters (int code);
-int xmlUCSIsKanbun (int code);
-int xmlUCSIsKangxiRadicals (int code);
-int xmlUCSIsKannada (int code);
-int xmlUCSIsKatakana (int code);
-int xmlUCSIsKhmer (int code);
-int xmlUCSIsLao (int code);
-int xmlUCSIsLatin1Supplement (int code);
-int xmlUCSIsLatinExtendedA (int code);
-int xmlUCSIsLatinExtendedB (int code);
-int xmlUCSIsLatinExtendedAdditional (int code);
-int xmlUCSIsLetterlikeSymbols (int code);
-int xmlUCSIsLowSurrogates (int code);
-int xmlUCSIsMalayalam (int code);
-int xmlUCSIsMathematicalAlphanumericSymbols (int code);
-int xmlUCSIsMathematicalOperators (int code);
-int xmlUCSIsMiscellaneousSymbols (int code);
-int xmlUCSIsMiscellaneousTechnical (int code);
-int xmlUCSIsMongolian (int code);
-int xmlUCSIsMusicalSymbols (int code);
-int xmlUCSIsMyanmar (int code);
-int xmlUCSIsNumberForms (int code);
-int xmlUCSIsOgham (int code);
-int xmlUCSIsOldItalic (int code);
-int xmlUCSIsOpticalCharacterRecognition (int code);
-int xmlUCSIsOriya (int code);
-int xmlUCSIsPrivateUse (int code);
-int xmlUCSIsRunic (int code);
-int xmlUCSIsSinhala (int code);
-int xmlUCSIsSmallFormVariants (int code);
-int xmlUCSIsSpacingModifierLetters (int code);
-int xmlUCSIsSpecials (int code);
-int xmlUCSIsSuperscriptsandSubscripts (int code);
-int xmlUCSIsSyriac (int code);
-int xmlUCSIsTags (int code);
-int xmlUCSIsTamil (int code);
-int xmlUCSIsTelugu (int code);
-int xmlUCSIsThaana (int code);
-int xmlUCSIsThai (int code);
-int xmlUCSIsTibetan (int code);
-int xmlUCSIsUnifiedCanadianAboriginalSyllabics (int code);
-int xmlUCSIsYiRadicals (int code);
-int xmlUCSIsYiSyllables (int code);
-
-int xmlUCSIsBlock (int code,
- const char *block);
-
-int xmlUCSIsCatC (int code);
-int xmlUCSIsCatCc (int code);
-int xmlUCSIsCatCf (int code);
-int xmlUCSIsCatCo (int code);
-int xmlUCSIsCatCs (int code);
-int xmlUCSIsCatL (int code);
-int xmlUCSIsCatLl (int code);
-int xmlUCSIsCatLm (int code);
-int xmlUCSIsCatLo (int code);
-int xmlUCSIsCatLt (int code);
-int xmlUCSIsCatLu (int code);
-int xmlUCSIsCatM (int code);
-int xmlUCSIsCatMc (int code);
-int xmlUCSIsCatMe (int code);
-int xmlUCSIsCatMn (int code);
-int xmlUCSIsCatN (int code);
-int xmlUCSIsCatNd (int code);
-int xmlUCSIsCatNl (int code);
-int xmlUCSIsCatNo (int code);
-int xmlUCSIsCatP (int code);
-int xmlUCSIsCatPc (int code);
-int xmlUCSIsCatPd (int code);
-int xmlUCSIsCatPe (int code);
-int xmlUCSIsCatPf (int code);
-int xmlUCSIsCatPi (int code);
-int xmlUCSIsCatPo (int code);
-int xmlUCSIsCatPs (int code);
-int xmlUCSIsCatS (int code);
-int xmlUCSIsCatSc (int code);
-int xmlUCSIsCatSk (int code);
-int xmlUCSIsCatSm (int code);
-int xmlUCSIsCatSo (int code);
-int xmlUCSIsCatZ (int code);
-int xmlUCSIsCatZl (int code);
-int xmlUCSIsCatZp (int code);
-int xmlUCSIsCatZs (int code);
-
-int xmlUCSIsCat (int code,
- const char *cat);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_UNICODE_H__ */
diff --git a/bundle/libxml/include/libxml/xmlversion.h b/bundle/libxml/include/libxml/xmlversion.h
deleted file mode 100644
index 6cb01d5db3..0000000000
--- a/bundle/libxml/include/libxml/xmlversion.h
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * xmlversion.h : compile-time version informations for the XML parser.
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __XML_VERSION_H__
-#define __XML_VERSION_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * use those to be sure nothing nasty will happen if
- * your library and includes mismatch
- */
-#ifndef LIBXML2_COMPILING_MSCCDEF
-extern void xmlCheckVersion(int version);
-#endif /* LIBXML2_COMPILING_MSCCDEF */
-
-/**
- * LIBXML_DOTTED_VERSION:
- *
- * the version string like "1.2.3"
- */
-#define LIBXML_DOTTED_VERSION "2.4.30"
-
-/**
- * LIBXML_VERSION:
- *
- * the version number: 1.2.3 value is 1002003
- */
-#define LIBXML_VERSION 20430
-
-/**
- * LIBXML_VERSION_STRING:
- *
- * the version number string, 1.2.3 value is "1002003"
- */
-#define LIBXML_VERSION_STRING "20430"
-
-/**
- * LIBXML_TEST_VERSION:
- *
- * Macro to check that the libxml version in use is compatible with
- * the version the software has been compiled against
- */
-#define LIBXML_TEST_VERSION xmlCheckVersion(20430);
-
-#ifndef VMS
-#if 0
-/**
- * WITH_TRIO:
- *
- * defined if the trio support need to be configured in
- */
-#define WITH_TRIO
-#else
-/**
- * WITHOUT_TRIO:
- *
- * defined if the trio support should not be configured in
- */
-#define WITHOUT_TRIO
-#endif
-#else /* VMS */
-#define WITH_TRIO 1
-#endif /* VMS */
-
-/**
- * LIBXML_THREAD_ENABLED:
- *
- * Whether the thread support is configured in
- */
-#if 0
-#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
-#define LIBXML_THREAD_ENABLED
-#endif
-#endif
-
-/**
- * LIBXML_FTP_ENABLED:
- *
- * Whether the FTP support is configured in
- */
-#if 1
-#define LIBXML_FTP_ENABLED
-#endif
-
-/**
- * LIBXML_HTTP_ENABLED:
- *
- * Whether the HTTP support is configured in
- */
-#if 1
-#define LIBXML_HTTP_ENABLED
-#endif
-
-/**
- * LIBXML_HTML_ENABLED:
- *
- * Whether the HTML support is configured in
- */
-#if 1
-#define LIBXML_HTML_ENABLED
-#endif
-
-/**
- * LIBXML_C14N_ENABLED:
- *
- * Whether the Canonicalization support is configured in
- */
-#if 1
-#define LIBXML_C14N_ENABLED
-#endif
-
-/**
- * LIBXML_CATALOG_ENABLED:
- *
- * Whether the Catalog support is configured in
- */
-#if 1
-#define LIBXML_CATALOG_ENABLED
-#endif
-
-/**
- * LIBXML_DOCB_ENABLED:
- *
- * Whether the SGML Docbook support is configured in
- */
-#if 1
-#define LIBXML_DOCB_ENABLED
-#endif
-
-/**
- * LIBXML_XPATH_ENABLED:
- *
- * Whether XPath is configured in
- */
-#if 1
-#define LIBXML_XPATH_ENABLED
-#endif
-
-/**
- * LIBXML_XPTR_ENABLED:
- *
- * Whether XPointer is configured in
- */
-#if 1
-#define LIBXML_XPTR_ENABLED
-#endif
-
-/**
- * LIBXML_XINCLUDE_ENABLED:
- *
- * Whether XInclude is configured in
- */
-#if 1
-#define LIBXML_XINCLUDE_ENABLED
-#endif
-
-/**
- * LIBXML_ICONV_ENABLED:
- *
- * Whether iconv support is available
- */
-#if 0
-#define LIBXML_ICONV_ENABLED
-#endif
-
-/**
- * LIBXML_DEBUG_ENABLED:
- *
- * Whether Debugging module is configured in
- */
-#if 1
-#define LIBXML_DEBUG_ENABLED
-#endif
-
-/**
- * DEBUG_MEMORY_LOCATION:
- *
- * Whether the memory debugging is configured in
- */
-#if 1
-#define DEBUG_MEMORY_LOCATION
-#endif
-
-/**
- * LIBXML_UNICODE_ENABLED
- *
- * Whether the Unicode related interfaces are compiled in
- */
-#if 1
-#define LIBXML_UNICODE_ENABLED
-#endif
-
-/**
- * LIBXML_REGEXP_ENABLED
- *
- * Whether the regular expressions interfaces are compiled in
- */
-#if 1
-#define LIBXML_REGEXP_ENABLED
-#endif
-
-/**
- * LIBXML_AUTOMATA_ENABLED
- *
- * Whether the automata interfaces are compiled in
- */
-#if 1
-#define LIBXML_AUTOMATA_ENABLED
-#endif
-
-/**
- * LIBXML_SCHEMAS_ENABLED
- *
- * Whether the Schemas validation interfaces are compiled in
- */
-#if 1
-#define LIBXML_SCHEMAS_ENABLED
-#endif
-
-/**
- * LIBXML_DLL_IMPORT:
- *
- * Used on Windows (MS C compiler only) to declare a variable as
- * imported from the library. This macro should be empty when compiling
- * libxml itself. It should expand to __declspec(dllimport)
- * when the client code includes this header, and that only if the client
- * links dynamically against libxml.
- * For this to work, we need three macros. One tells us which compiler is
- * being used and luckily the compiler defines such a thing: _MSC_VER. The
- * second macro tells us if we are compiling libxml or the client code and
- * we define the macro IN_LIBXML on the compiler's command line for this
- * purpose. The third macro, LIBXML_STATIC, must be defined by any client
- * code which links against libxml statically.
- */
-#ifndef LIBXML_DLL_IMPORT
-#if (defined(_MSC_VER) || defined(__CYGWIN__)) && !defined(IN_LIBXML) && !defined(LIBXML_STATIC)
-#define LIBXML_DLL_IMPORT __declspec(dllimport)
-#else
-#define LIBXML_DLL_IMPORT
-#endif
-#endif
-
-/**
- * ATTRIBUTE_UNUSED:
- *
- * Macro used to signal to GCC unused function parameters
- */
-#ifdef __GNUC__
-#ifdef HAVE_ANSIDECL_H
-#include <ansidecl.h>
-#endif
-#ifndef ATTRIBUTE_UNUSED
-#define ATTRIBUTE_UNUSED
-#endif
-#else
-#define ATTRIBUTE_UNUSED
-#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif
-
-
diff --git a/bundle/libxml/include/libxml/xmlversion.h.in b/bundle/libxml/include/libxml/xmlversion.h.in
deleted file mode 100644
index 94def1804b..0000000000
--- a/bundle/libxml/include/libxml/xmlversion.h.in
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * xmlversion.h : compile-time version informations for the XML parser.
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __XML_VERSION_H__
-#define __XML_VERSION_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * use those to be sure nothing nasty will happen if
- * your library and includes mismatch
- */
-#ifndef LIBXML2_COMPILING_MSCCDEF
-extern void xmlCheckVersion(int version);
-#endif /* LIBXML2_COMPILING_MSCCDEF */
-
-/**
- * LIBXML_DOTTED_VERSION:
- *
- * the version string like "1.2.3"
- */
-#define LIBXML_DOTTED_VERSION "@VERSION@"
-
-/**
- * LIBXML_VERSION:
- *
- * the version number: 1.2.3 value is 1002003
- */
-#define LIBXML_VERSION @LIBXML_VERSION_NUMBER@
-
-/**
- * LIBXML_VERSION_STRING:
- *
- * the version number string, 1.2.3 value is "1002003"
- */
-#define LIBXML_VERSION_STRING "@LIBXML_VERSION_NUMBER@"
-
-/**
- * LIBXML_TEST_VERSION:
- *
- * Macro to check that the libxml version in use is compatible with
- * the version the software has been compiled against
- */
-#define LIBXML_TEST_VERSION xmlCheckVersion(@LIBXML_VERSION_NUMBER@);
-
-#ifndef VMS
-#if @WITH_TRIO@
-/**
- * WITH_TRIO:
- *
- * defined if the trio support need to be configured in
- */
-#define WITH_TRIO
-#else
-/**
- * WITHOUT_TRIO:
- *
- * defined if the trio support should not be configured in
- */
-#define WITHOUT_TRIO
-#endif
-#else /* VMS */
-#define WITH_TRIO 1
-#endif /* VMS */
-
-/**
- * LIBXML_THREAD_ENABLED:
- *
- * Whether the thread support is configured in
- */
-#if @WITH_THREADS@
-#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
-#define LIBXML_THREAD_ENABLED
-#endif
-#endif
-
-/**
- * LIBXML_FTP_ENABLED:
- *
- * Whether the FTP support is configured in
- */
-#if @WITH_FTP@
-#define LIBXML_FTP_ENABLED
-#endif
-
-/**
- * LIBXML_HTTP_ENABLED:
- *
- * Whether the HTTP support is configured in
- */
-#if @WITH_HTTP@
-#define LIBXML_HTTP_ENABLED
-#endif
-
-/**
- * LIBXML_HTML_ENABLED:
- *
- * Whether the HTML support is configured in
- */
-#if @WITH_HTML@
-#define LIBXML_HTML_ENABLED
-#endif
-
-/**
- * LIBXML_C14N_ENABLED:
- *
- * Whether the Canonicalization support is configured in
- */
-#if @WITH_C14N@
-#define LIBXML_C14N_ENABLED
-#endif
-
-/**
- * LIBXML_CATALOG_ENABLED:
- *
- * Whether the Catalog support is configured in
- */
-#if @WITH_CATALOG@
-#define LIBXML_CATALOG_ENABLED
-#endif
-
-/**
- * LIBXML_DOCB_ENABLED:
- *
- * Whether the SGML Docbook support is configured in
- */
-#if @WITH_DOCB@
-#define LIBXML_DOCB_ENABLED
-#endif
-
-/**
- * LIBXML_XPATH_ENABLED:
- *
- * Whether XPath is configured in
- */
-#if @WITH_XPATH@
-#define LIBXML_XPATH_ENABLED
-#endif
-
-/**
- * LIBXML_XPTR_ENABLED:
- *
- * Whether XPointer is configured in
- */
-#if @WITH_XPTR@
-#define LIBXML_XPTR_ENABLED
-#endif
-
-/**
- * LIBXML_XINCLUDE_ENABLED:
- *
- * Whether XInclude is configured in
- */
-#if @WITH_XINCLUDE@
-#define LIBXML_XINCLUDE_ENABLED
-#endif
-
-/**
- * LIBXML_ICONV_ENABLED:
- *
- * Whether iconv support is available
- */
-#if @WITH_ICONV@
-#define LIBXML_ICONV_ENABLED
-#endif
-
-/**
- * LIBXML_DEBUG_ENABLED:
- *
- * Whether Debugging module is configured in
- */
-#if @WITH_DEBUG@
-#define LIBXML_DEBUG_ENABLED
-#endif
-
-/**
- * DEBUG_MEMORY_LOCATION:
- *
- * Whether the memory debugging is configured in
- */
-#if @WITH_MEM_DEBUG@
-#define DEBUG_MEMORY_LOCATION
-#endif
-
-/**
- * LIBXML_UNICODE_ENABLED
- *
- * Whether the Unicode related interfaces are compiled in
- */
-#if @WITH_REGEXPS@
-#define LIBXML_UNICODE_ENABLED
-#endif
-
-/**
- * LIBXML_REGEXP_ENABLED
- *
- * Whether the regular expressions interfaces are compiled in
- */
-#if @WITH_REGEXPS@
-#define LIBXML_REGEXP_ENABLED
-#endif
-
-/**
- * LIBXML_AUTOMATA_ENABLED
- *
- * Whether the automata interfaces are compiled in
- */
-#if @WITH_REGEXPS@
-#define LIBXML_AUTOMATA_ENABLED
-#endif
-
-/**
- * LIBXML_SCHEMAS_ENABLED
- *
- * Whether the Schemas validation interfaces are compiled in
- */
-#if @WITH_SCHEMAS@
-#define LIBXML_SCHEMAS_ENABLED
-#endif
-
-/**
- * LIBXML_DLL_IMPORT:
- *
- * Used on Windows (MS C compiler only) to declare a variable as
- * imported from the library. This macro should be empty when compiling
- * libxml itself. It should expand to __declspec(dllimport)
- * when the client code includes this header, and that only if the client
- * links dynamically against libxml.
- * For this to work, we need three macros. One tells us which compiler is
- * being used and luckily the compiler defines such a thing: _MSC_VER. The
- * second macro tells us if we are compiling libxml or the client code and
- * we define the macro IN_LIBXML on the compiler's command line for this
- * purpose. The third macro, LIBXML_STATIC, must be defined by any client
- * code which links against libxml statically.
- */
-#ifndef LIBXML_DLL_IMPORT
-#if (defined(_MSC_VER) || defined(__CYGWIN__)) && !defined(IN_LIBXML) && !defined(LIBXML_STATIC)
-#define LIBXML_DLL_IMPORT __declspec(dllimport)
-#else
-#define LIBXML_DLL_IMPORT
-#endif
-#endif
-
-/**
- * ATTRIBUTE_UNUSED:
- *
- * Macro used to signal to GCC unused function parameters
- */
-#ifdef __GNUC__
-#ifdef HAVE_ANSIDECL_H
-#include <ansidecl.h>
-#endif
-#ifndef ATTRIBUTE_UNUSED
-#define ATTRIBUTE_UNUSED
-#endif
-#else
-#define ATTRIBUTE_UNUSED
-#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif
-
-
diff --git a/bundle/libxml/include/libxml/xpath.h b/bundle/libxml/include/libxml/xpath.h
deleted file mode 100644
index f36b16f938..0000000000
--- a/bundle/libxml/include/libxml/xpath.h
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * xpath.c: interface for XML Path Language implementation
- *
- * Reference: W3C Working Draft 5 July 1999
- * http://www.w3.org/Style/XSL/Group/1999/07/xpath-19990705.html
- *
- * See COPYRIGHT for the status of this software
- *
- * Author: daniel@veillard.com
- */
-
-#ifndef __XML_XPATH_H__
-#define __XML_XPATH_H__
-
-#include <libxml/tree.h>
-#include <libxml/hash.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _xmlXPathContext xmlXPathContext;
-typedef xmlXPathContext *xmlXPathContextPtr;
-typedef struct _xmlXPathParserContext xmlXPathParserContext;
-typedef xmlXPathParserContext *xmlXPathParserContextPtr;
-
-/**
- * The set of XPath error codes.
- */
-
-typedef enum {
- XPATH_EXPRESSION_OK = 0,
- XPATH_NUMBER_ERROR,
- XPATH_UNFINISHED_LITERAL_ERROR,
- XPATH_START_LITERAL_ERROR,
- XPATH_VARIABLE_REF_ERROR,
- XPATH_UNDEF_VARIABLE_ERROR,
- XPATH_INVALID_PREDICATE_ERROR,
- XPATH_EXPR_ERROR,
- XPATH_UNCLOSED_ERROR,
- XPATH_UNKNOWN_FUNC_ERROR,
- XPATH_INVALID_OPERAND,
- XPATH_INVALID_TYPE,
- XPATH_INVALID_ARITY,
- XPATH_INVALID_CTXT_SIZE,
- XPATH_INVALID_CTXT_POSITION,
- XPATH_MEMORY_ERROR,
- XPTR_SYNTAX_ERROR,
- XPTR_RESOURCE_ERROR,
- XPTR_SUB_RESOURCE_ERROR,
- XPATH_UNDEF_PREFIX_ERROR,
- XPATH_ENCODING_ERROR,
- XPATH_INVALID_CHAR_ERROR
-} xmlXPathError;
-
-/*
- * A node-set (an unordered collection of nodes without duplicates).
- */
-typedef struct _xmlNodeSet xmlNodeSet;
-typedef xmlNodeSet *xmlNodeSetPtr;
-struct _xmlNodeSet {
- int nodeNr; /* number of nodes in the set */
- int nodeMax; /* size of the array as allocated */
- xmlNodePtr *nodeTab; /* array of nodes in no particular order */
- /* @@ with_ns to check wether namespace nodes should be looked at @@ */
-};
-
-/*
- * An expression is evaluated to yield an object, which
- * has one of the following four basic types:
- * - node-set
- * - boolean
- * - number
- * - string
- *
- * @@ XPointer will add more types !
- */
-
-typedef enum {
- XPATH_UNDEFINED = 0,
- XPATH_NODESET = 1,
- XPATH_BOOLEAN = 2,
- XPATH_NUMBER = 3,
- XPATH_STRING = 4,
- XPATH_POINT = 5,
- XPATH_RANGE = 6,
- XPATH_LOCATIONSET = 7,
- XPATH_USERS = 8,
- XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */
-} xmlXPathObjectType;
-
-typedef struct _xmlXPathObject xmlXPathObject;
-typedef xmlXPathObject *xmlXPathObjectPtr;
-struct _xmlXPathObject {
- xmlXPathObjectType type;
- xmlNodeSetPtr nodesetval;
- int boolval;
- double floatval;
- xmlChar *stringval;
- void *user;
- int index;
- void *user2;
- int index2;
-};
-
-/**
- * xmlXPathConvertFunc:
- * @obj: an XPath object
- * @type: the number of the target type
- *
- * A conversion function is associated to a type and used to cast
- * the new type to primitive values.
- *
- * Returns -1 in case of error, 0 otherwise
- */
-typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type);
-
-/*
- * Extra type: a name and a conversion function.
- */
-
-typedef struct _xmlXPathType xmlXPathType;
-typedef xmlXPathType *xmlXPathTypePtr;
-struct _xmlXPathType {
- const xmlChar *name; /* the type name */
- xmlXPathConvertFunc func; /* the conversion function */
-};
-
-/*
- * Extra variable: a name and a value.
- */
-
-typedef struct _xmlXPathVariable xmlXPathVariable;
-typedef xmlXPathVariable *xmlXPathVariablePtr;
-struct _xmlXPathVariable {
- const xmlChar *name; /* the variable name */
- xmlXPathObjectPtr value; /* the value */
-};
-
-/**
- * xmlXPathEvalFunc:
- * @ctxt: an XPath parser context
- * @nargs: the number of arguments passed to the function
- *
- * An XPath evaluation function, the parameters are on the XPath context stack.
- */
-
-typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt,
- int nargs);
-
-/*
- * Extra function: a name and a evaluation function.
- */
-
-typedef struct _xmlXPathFunct xmlXPathFunct;
-typedef xmlXPathFunct *xmlXPathFuncPtr;
-struct _xmlXPathFunct {
- const xmlChar *name; /* the function name */
- xmlXPathEvalFunc func; /* the evaluation function */
-};
-
-/**
- * xmlXPathAxisFunc:
- * @ctxt: the XPath interpreter context
- * @cur: the previous node being explored on that axis
- *
- * An axis traversal function. To traverse an axis, the engine calls
- * the first time with cur == NULL and repeat until the function returns
- * NULL indicating the end of the axis traversal.
- *
- * Returns the next node in that axis or NULL if at the end of the axis.
- */
-
-typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt,
- xmlXPathObjectPtr cur);
-
-/*
- * Extra axis: a name and an axis function.
- */
-
-typedef struct _xmlXPathAxis xmlXPathAxis;
-typedef xmlXPathAxis *xmlXPathAxisPtr;
-struct _xmlXPathAxis {
- const xmlChar *name; /* the axis name */
- xmlXPathAxisFunc func; /* the search function */
-};
-
-/**
- * xmlXPathContext:
- *
- * Expression evaluation occurs with respect to a context.
- * he context consists of:
- * - a node (the context node)
- * - a node list (the context node list)
- * - a set of variable bindings
- * - a function library
- * - the set of namespace declarations in scope for the expression
- * Following the switch to hash tables, this need to be trimmed up at
- * the next binary incompatible release.
- */
-
-struct _xmlXPathContext {
- xmlDocPtr doc; /* The current document */
- xmlNodePtr node; /* The current node */
-
- int nb_variables_unused; /* unused (hash table) */
- int max_variables_unused; /* unused (hash table) */
- xmlHashTablePtr varHash; /* Hash table of defined variables */
-
- int nb_types; /* number of defined types */
- int max_types; /* max number of types */
- xmlXPathTypePtr types; /* Array of defined types */
-
- int nb_funcs_unused; /* unused (hash table) */
- int max_funcs_unused; /* unused (hash table) */
- xmlHashTablePtr funcHash; /* Hash table of defined funcs */
-
- int nb_axis; /* number of defined axis */
- int max_axis; /* max number of axis */
- xmlXPathAxisPtr axis; /* Array of defined axis */
-
- /* the namespace nodes of the context node */
- xmlNsPtr *namespaces; /* Array of namespaces */
- int nsNr; /* number of namespace in scope */
- void *user; /* function to free */
-
- /* extra variables */
- int contextSize; /* the context size */
- int proximityPosition; /* the proximity position */
-
- /* extra stuff for XPointer */
- int xptr; /* it this an XPointer context */
- xmlNodePtr here; /* for here() */
- xmlNodePtr origin; /* for origin() */
-
- /* the set of namespace declarations in scope for the expression */
- xmlHashTablePtr nsHash; /* The namespaces hash table */
- void *varLookupFunc; /* variable lookup func */
- void *varLookupData; /* variable lookup data */
-
- /* Possibility to link in an extra item */
- void *extra; /* needed for XSLT */
-
- /* The function name and URI when calling a function */
- const xmlChar *function;
- const xmlChar *functionURI;
-
- /* function lookup function and data */
- void *funcLookupFunc; /* function lookup func */
- void *funcLookupData; /* function lookup data */
-
- /* temporary namespace lists kept for walking the namespace axis */
- xmlNsPtr *tmpNsList; /* Array of namespaces */
- int tmpNsNr; /* number of namespace in scope */
-};
-
-/*
- * The structure of a compiled expression form is not public.
- */
-
-typedef struct _xmlXPathCompExpr xmlXPathCompExpr;
-typedef xmlXPathCompExpr *xmlXPathCompExprPtr;
-
-/**
- * xmlXPathParserContext:
- *
- * An XPath parser context. It contains pure parsing informations,
- * an xmlXPathContext, and the stack of objects.
- */
-struct _xmlXPathParserContext {
- const xmlChar *cur; /* the current char being parsed */
- const xmlChar *base; /* the full expression */
-
- int error; /* error code */
-
- xmlXPathContextPtr context; /* the evaluation context */
- xmlXPathObjectPtr value; /* the current value */
- int valueNr; /* number of values stacked */
- int valueMax; /* max number of values stacked */
- xmlXPathObjectPtr *valueTab; /* stack of values */
-
- xmlXPathCompExprPtr comp; /* the precompiled expression */
- int xptr; /* it this an XPointer expression */
- xmlNodePtr ancestor; /* used for walking preceding axis */
-};
-
-/**
- * xmlXPathFunction:
- * @ctxt: the XPath interprestation context
- * @nargs: the number of arguments
- *
- * An XPath function.
- * The arguments (if any) are popped out from the context stack
- * and the result is pushed on the stack.
- */
-
-typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs);
-
-/************************************************************************
- * *
- * Public API *
- * *
- ************************************************************************/
-
-/**
- * Objects and Nodesets handling
- */
-
-LIBXML_DLL_IMPORT extern double xmlXPathNAN;
-LIBXML_DLL_IMPORT extern double xmlXPathPINF;
-LIBXML_DLL_IMPORT extern double xmlXPathNINF;
-
-int xmlXPathIsNaN (double val);
-int xmlXPathIsInf (double val);
-
-/* These macros may later turn into functions */
-/**
- * xmlXPathNodeSetGetLength:
- * @ns: a node-set
- *
- * Implement a functionality similar to the DOM NodeList.length.
- *
- * Returns the number of nodes in the node-set.
- */
-#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0)
-/**
- * xmlXPathNodeSetItem:
- * @ns: a node-set
- * @index: index of a node in the set
- *
- * Implements a functionality similar to the DOM NodeList.item().
- *
- * Returns the xmlNodePtr at the given @index in @ns or NULL if
- * @index is out of range (0 to length-1)
- */
-#define xmlXPathNodeSetItem(ns, index) \
- ((((ns) != NULL) && \
- ((index) >= 0) && ((index) < (ns)->nodeNr)) ? \
- (ns)->nodeTab[(index)] \
- : NULL)
-/**
- * xmlXPathNodeSetIsEmpty:
- * @ns: a node-set
- *
- * Checks whether @ns is empty or not.
- *
- * Returns %TRUE if @ns is an empty node-set.
- */
-#define xmlXPathNodeSetIsEmpty(ns) \
- (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL))
-
-
-void xmlXPathFreeObject (xmlXPathObjectPtr obj);
-xmlNodeSetPtr xmlXPathNodeSetCreate (xmlNodePtr val);
-void xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj);
-void xmlXPathFreeNodeSet (xmlNodeSetPtr obj);
-xmlXPathObjectPtr xmlXPathObjectCopy (xmlXPathObjectPtr val);
-int xmlXPathCmpNodes (xmlNodePtr node1,
- xmlNodePtr node2);
-/**
- * Conversion functions to basic types.
- */
-int xmlXPathCastNumberToBoolean (double val);
-int xmlXPathCastStringToBoolean (const xmlChar * val);
-int xmlXPathCastNodeSetToBoolean (xmlNodeSetPtr ns);
-int xmlXPathCastToBoolean (xmlXPathObjectPtr val);
-
-double xmlXPathCastBooleanToNumber (int val);
-double xmlXPathCastStringToNumber (const xmlChar * val);
-double xmlXPathCastNodeToNumber (xmlNodePtr node);
-double xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns);
-double xmlXPathCastToNumber (xmlXPathObjectPtr val);
-
-xmlChar * xmlXPathCastBooleanToString (int val);
-xmlChar * xmlXPathCastNumberToString (double val);
-xmlChar * xmlXPathCastNodeToString (xmlNodePtr node);
-xmlChar * xmlXPathCastNodeSetToString (xmlNodeSetPtr ns);
-xmlChar * xmlXPathCastToString (xmlXPathObjectPtr val);
-
-xmlXPathObjectPtr xmlXPathConvertBoolean (xmlXPathObjectPtr val);
-xmlXPathObjectPtr xmlXPathConvertNumber (xmlXPathObjectPtr val);
-xmlXPathObjectPtr xmlXPathConvertString (xmlXPathObjectPtr val);
-
-/**
- * Context handling.
- */
-void xmlXPathInit (void);
-xmlXPathContextPtr xmlXPathNewContext (xmlDocPtr doc);
-void xmlXPathFreeContext (xmlXPathContextPtr ctxt);
-
-/**
- * Evaluation functions.
- */
-xmlXPathObjectPtr xmlXPathEval (const xmlChar *str,
- xmlXPathContextPtr ctx);
-xmlXPathObjectPtr xmlXPathEvalExpression (const xmlChar *str,
- xmlXPathContextPtr ctxt);
-int xmlXPathEvalPredicate (xmlXPathContextPtr ctxt,
- xmlXPathObjectPtr res);
-/**
- * Separate compilation/evaluation entry points.
- */
-xmlXPathCompExprPtr xmlXPathCompile (const xmlChar *str);
-xmlXPathObjectPtr xmlXPathCompiledEval (xmlXPathCompExprPtr comp,
- xmlXPathContextPtr ctx);
-void xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp);
-#ifdef __cplusplus
-}
-#endif
-#endif /* ! __XML_XPATH_H__ */
diff --git a/bundle/libxml/include/libxml/xpathInternals.h b/bundle/libxml/include/libxml/xpathInternals.h
deleted file mode 100644
index 59a4e35d53..0000000000
--- a/bundle/libxml/include/libxml/xpathInternals.h
+++ /dev/null
@@ -1,580 +0,0 @@
-/*
- * xpathInternals.c: internal interfaces for XML Path Language implementation
- * used to build new modules on top of XPath
- *
- * See COPYRIGHT for the status of this software
- *
- * Author: daniel@veillard.com
- */
-
-#ifndef __XML_XPATH_INTERNALS_H__
-#define __XML_XPATH_INTERNALS_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/xpath.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/************************************************************************
- * *
- * Helpers *
- * *
- ************************************************************************/
-
-/**
- * Many of these macros may later turn into functions. They
- * shouldn't be used in #ifdef's preprocessor instructions.
- */
-/**
- * xmlXPathSetError:
- * @ctxt: an XPath parser context
- * @err: an xmlXPathError code
- *
- * Raises an error.
- */
-#define xmlXPathSetError(ctxt, err) \
- { xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \
- (ctxt)->error = (err); }
-
-/**
- * xmlXPathSetArityError:
- * @ctxt: an XPath parser context
- *
- * Raises an XPATH_INVALID_ARITY error.
- */
-#define xmlXPathSetArityError(ctxt) \
- xmlXPathSetError((ctxt), XPATH_INVALID_ARITY)
-
-/**
- * xmlXPathSetTypeError:
- * @ctxt: an XPath parser context
- *
- * Raises an XPATH_INVALID_TYPE error.
- */
-#define xmlXPathSetTypeError(ctxt) \
- xmlXPathSetError((ctxt), XPATH_INVALID_TYPE)
-
-/**
- * xmlXPathGetError:
- * @ctxt: an XPath parser context
- *
- * Get the error code of an XPath context.
- *
- * Returns the context error.
- */
-#define xmlXPathGetError(ctxt) ((ctxt)->error)
-
-/**
- * xmlXPathCheckError:
- * @ctxt: an XPath parser context
- *
- * Check if an XPath error was raised.
- *
- * Returns true if an error has been raised, false otherwise.
- */
-#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK)
-
-/**
- * xmlXPathGetDocument:
- * @ctxt: an XPath parser context
- *
- * Get the document of an XPath context.
- *
- * Returns the context document.
- */
-#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc)
-
-/**
- * xmlXPathGetContextNode:
- * @ctxt: an XPath parser context
- *
- * Get the context node of an XPath context.
- *
- * Returns the context node.
- */
-#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node)
-
-int xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt);
-double xmlXPathPopNumber (xmlXPathParserContextPtr ctxt);
-xmlChar * xmlXPathPopString (xmlXPathParserContextPtr ctxt);
-xmlNodeSetPtr xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt);
-void * xmlXPathPopExternal (xmlXPathParserContextPtr ctxt);
-
-/**
- * xmlXPathReturnBoolean:
- * @ctxt: an XPath parser context
- * @val: a boolean
- *
- * Pushes the boolean @val on the context stack.
- */
-#define xmlXPathReturnBoolean(ctxt, val) \
- valuePush((ctxt), xmlXPathNewBoolean(val))
-
-/**
- * xmlXPathReturnTrue:
- * @ctxt: an XPath parser context
- *
- * Pushes true on the context stack.
- */
-#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1)
-
-/**
- * xmlXPathReturnFalse:
- * @ctxt: an XPath parser context
- *
- * Pushes false on the context stack.
- */
-#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0)
-
-/**
- * xmlXPathReturnNumber:
- * @ctxt: an XPath parser context
- * @val: a double
- *
- * Pushes the double @val on the context stack.
- */
-#define xmlXPathReturnNumber(ctxt, val) \
- valuePush((ctxt), xmlXPathNewFloat(val))
-
-/**
- * xmlXPathReturnString:
- * @ctxt: an XPath parser context
- * @str: a string
- *
- * Pushes the string @str on the context stack.
- */
-#define xmlXPathReturnString(ctxt, str) \
- valuePush((ctxt), xmlXPathWrapString(str))
-
-/**
- * xmlXPathReturnEmptyString:
- * @ctxt: an XPath parser context
- *
- * Pushes an empty string on the stack.
- */
-#define xmlXPathReturnEmptyString(ctxt) \
- valuePush((ctxt), xmlXPathNewCString(""))
-
-/**
- * xmlXPathReturnNodeSet:
- * @ctxt: an XPath parser context
- * @ns: a node-set
- *
- * Pushes the node-set @ns on the context stack.
- */
-#define xmlXPathReturnNodeSet(ctxt, ns) \
- valuePush((ctxt), xmlXPathWrapNodeSet(ns))
-
-/**
- * xmlXPathReturnEmptyNodeSet:
- * @ctxt: an XPath parser context
- *
- * Pushes an empty node-set on the context stack.
- */
-#define xmlXPathReturnEmptyNodeSet(ctxt) \
- valuePush((ctxt), xmlXPathNewNodeSet(NULL))
-
-/**
- * xmlXPathReturnExternal:
- * @ctxt: an XPath parser context
- * @val: user data
- *
- * Pushes user data on the context stack.
- */
-#define xmlXPathReturnExternal(ctxt, val) \
- valuePush((ctxt), xmlXPathWrapExternal(val))
-
-/**
- * xmlXPathStackIsNodeSet:
- * @ctxt: an XPath parser context
- *
- * Check if the current value on the XPath stack is a node set or
- * an XSLT value tree.
- *
- * Returns true if the current object on the stack is a node-set.
- */
-#define xmlXPathStackIsNodeSet(ctxt) \
- (((ctxt)->value != NULL) \
- && (((ctxt)->value->type == XPATH_NODESET) \
- || ((ctxt)->value->type == XPATH_XSLT_TREE)))
-
-/**
- * xmlXPathStackIsExternal:
- * @ctxt: an XPath parser context
- *
- * Checks if the current value on the XPath stack is an external
- * object.
- *
- * Returns true if the current object on the stack is an external
- * object.
- */
-#define xmlXPathStackIsExternal(ctxt) \
- ((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS))
-
-/**
- * xmlXPathEmptyNodeSet:
- * @ns: a node-set
- *
- * Empties a node-set.
- */
-#define xmlXPathEmptyNodeSet(ns) \
- { while ((ns)->nodeNr > 0) (ns)->nodeTab[(ns)->nodeNr--] = NULL; }
-
-/**
- * CHECK_ERROR:
- *
- * Macro to return from the function if an XPath error was detected.
- */
-#define CHECK_ERROR \
- if (ctxt->error != XPATH_EXPRESSION_OK) return
-
-/**
- * CHECK_ERROR0:
- *
- * Macro to return 0 from the function if an XPath error was detected.
- */
-#define CHECK_ERROR0 \
- if (ctxt->error != XPATH_EXPRESSION_OK) return(0)
-
-/**
- * XP_ERROR:
- * @X: the error code
- *
- * Macro to raise an XPath error and return.
- */
-#define XP_ERROR(X) \
- { xmlXPatherror(ctxt, __FILE__, __LINE__, X); \
- ctxt->error = (X); return; }
-
-/**
- * XP_ERROR0:
- * @X: the error code
- *
- * Macro to raise an XPath error and return 0.
- */
-#define XP_ERROR0(X) \
- { xmlXPatherror(ctxt, __FILE__, __LINE__, X); \
- ctxt->error = (X); return(0); }
-
-/**
- * CHECK_TYPE:
- * @typeval: the XPath type
- *
- * Macro to check that the value on top of the XPath stack is of a given
- * type.
- */
-#define CHECK_TYPE(typeval) \
- if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
- XP_ERROR(XPATH_INVALID_TYPE)
-
-/**
- * CHECK_TYPE0:
- * @typeval: the XPath type
- *
- * Macro to check that the value on top of the XPath stack is of a given
- * type. Return(0) in case of failure
- */
-#define CHECK_TYPE0(typeval) \
- if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
- XP_ERROR0(XPATH_INVALID_TYPE)
-
-/**
- * CHECK_ARITY:
- * @x: the number of expected args
- *
- * Macro to check that the number of args passed to an XPath function matches.
- */
-#define CHECK_ARITY(x) \
- if (nargs != (x)) \
- XP_ERROR(XPATH_INVALID_ARITY);
-
-/**
- * CAST_TO_STRING:
- *
- * Macro to try to cast the value on the top of the XPath stack to a string.
- */
-#define CAST_TO_STRING \
- if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \
- xmlXPathStringFunction(ctxt, 1);
-
-/**
- * CAST_TO_NUMBER:
- *
- * Macro to try to cast the value on the top of the XPath stack to a number.
- */
-#define CAST_TO_NUMBER \
- if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \
- xmlXPathNumberFunction(ctxt, 1);
-
-/**
- * CAST_TO_BOOLEAN:
- *
- * Macro to try to cast the value on the top of the XPath stack to a boolean.
- */
-#define CAST_TO_BOOLEAN \
- if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \
- xmlXPathBooleanFunction(ctxt, 1);
-
-/*
- * Variable Lookup forwarding.
- */
-/**
- * xmlXPathVariableLookupFunc:
- * @ctxt: an XPath context
- * @name: name of the variable
- * @ns_uri: the namespace name hosting this variable
- *
- * Prototype for callbacks used to plug variable lookup in the XPath
- * engine.
- *
- * Returns the XPath object value or NULL if not found.
- */
-typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt,
- const xmlChar *name,
- const xmlChar *ns_uri);
-
-void xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt,
- xmlXPathVariableLookupFunc f,
- void *data);
-
-/*
- * Function Lookup forwarding.
- */
-/**
- * xmlXPathFuncLookupFunc:
- * @ctxt: an XPath context
- * @name: name of the function
- * @ns_uri: the namespace name hosting this function
- *
- * Prototype for callbacks used to plug function lookup in the XPath
- * engine.
- *
- * Returns the XPath function or NULL if not found.
- */
-typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
- const xmlChar *name,
- const xmlChar *ns_uri);
-
-void xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt,
- xmlXPathFuncLookupFunc f,
- void *funcCtxt);
-
-/*
- * Error reporting.
- */
-void xmlXPatherror (xmlXPathParserContextPtr ctxt,
- const char *file,
- int line,
- int no);
-
-void xmlXPathDebugDumpObject (FILE *output,
- xmlXPathObjectPtr cur,
- int depth);
-void xmlXPathDebugDumpCompExpr(FILE *output,
- xmlXPathCompExprPtr comp,
- int depth);
-
-/**
- * NodeSet handling.
- */
-int xmlXPathNodeSetContains (xmlNodeSetPtr cur,
- xmlNodePtr val);
-xmlNodeSetPtr xmlXPathDifference (xmlNodeSetPtr nodes1,
- xmlNodeSetPtr nodes2);
-xmlNodeSetPtr xmlXPathIntersection (xmlNodeSetPtr nodes1,
- xmlNodeSetPtr nodes2);
-
-xmlNodeSetPtr xmlXPathDistinctSorted (xmlNodeSetPtr nodes);
-xmlNodeSetPtr xmlXPathDistinct (xmlNodeSetPtr nodes);
-
-int xmlXPathHasSameNodes (xmlNodeSetPtr nodes1,
- xmlNodeSetPtr nodes2);
-
-xmlNodeSetPtr xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes,
- xmlNodePtr node);
-xmlNodeSetPtr xmlXPathLeadingSorted (xmlNodeSetPtr nodes1,
- xmlNodeSetPtr nodes2);
-xmlNodeSetPtr xmlXPathNodeLeading (xmlNodeSetPtr nodes,
- xmlNodePtr node);
-xmlNodeSetPtr xmlXPathLeading (xmlNodeSetPtr nodes1,
- xmlNodeSetPtr nodes2);
-
-xmlNodeSetPtr xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes,
- xmlNodePtr node);
-xmlNodeSetPtr xmlXPathTrailingSorted (xmlNodeSetPtr nodes1,
- xmlNodeSetPtr nodes2);
-xmlNodeSetPtr xmlXPathNodeTrailing (xmlNodeSetPtr nodes,
- xmlNodePtr node);
-xmlNodeSetPtr xmlXPathTrailing (xmlNodeSetPtr nodes1,
- xmlNodeSetPtr nodes2);
-
-
-/**
- * Extending a context.
- */
-
-int xmlXPathRegisterNs (xmlXPathContextPtr ctxt,
- const xmlChar *prefix,
- const xmlChar *ns_uri);
-const xmlChar * xmlXPathNsLookup (xmlXPathContextPtr ctxt,
- const xmlChar *prefix);
-void xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt);
-
-int xmlXPathRegisterFunc (xmlXPathContextPtr ctxt,
- const xmlChar *name,
- xmlXPathFunction f);
-int xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt,
- const xmlChar *name,
- const xmlChar *ns_uri,
- xmlXPathFunction f);
-int xmlXPathRegisterVariable (xmlXPathContextPtr ctxt,
- const xmlChar *name,
- xmlXPathObjectPtr value);
-int xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt,
- const xmlChar *name,
- const xmlChar *ns_uri,
- xmlXPathObjectPtr value);
-xmlXPathFunction xmlXPathFunctionLookup (xmlXPathContextPtr ctxt,
- const xmlChar *name);
-xmlXPathFunction xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt,
- const xmlChar *name,
- const xmlChar *ns_uri);
-void xmlXPathRegisteredFuncsCleanup(xmlXPathContextPtr ctxt);
-xmlXPathObjectPtr xmlXPathVariableLookup (xmlXPathContextPtr ctxt,
- const xmlChar *name);
-xmlXPathObjectPtr xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt,
- const xmlChar *name,
- const xmlChar *ns_uri);
-void xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt);
-
-/**
- * Utilities to extend XPath.
- */
-xmlXPathParserContextPtr
- xmlXPathNewParserContext (const xmlChar *str,
- xmlXPathContextPtr ctxt);
-void xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt);
-
-/* TODO: remap to xmlXPathValuePop and Push. */
-xmlXPathObjectPtr valuePop (xmlXPathParserContextPtr ctxt);
-int valuePush (xmlXPathParserContextPtr ctxt,
- xmlXPathObjectPtr value);
-
-xmlXPathObjectPtr xmlXPathNewString (const xmlChar *val);
-xmlXPathObjectPtr xmlXPathNewCString (const char *val);
-xmlXPathObjectPtr xmlXPathWrapString (xmlChar *val);
-xmlXPathObjectPtr xmlXPathWrapCString (char * val);
-xmlXPathObjectPtr xmlXPathNewFloat (double val);
-xmlXPathObjectPtr xmlXPathNewBoolean (int val);
-xmlXPathObjectPtr xmlXPathNewNodeSet (xmlNodePtr val);
-xmlXPathObjectPtr xmlXPathNewValueTree (xmlNodePtr val);
-void xmlXPathNodeSetAdd (xmlNodeSetPtr cur,
- xmlNodePtr val);
-void xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur,
- xmlNodePtr val);
-void xmlXPathNodeSetAddNs (xmlNodeSetPtr cur,
- xmlNodePtr node,
- xmlNsPtr ns);
-void xmlXPathNodeSetSort (xmlNodeSetPtr set);
-
-void xmlXPathRoot (xmlXPathParserContextPtr ctxt);
-void xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt);
-xmlChar * xmlXPathParseName (xmlXPathParserContextPtr ctxt);
-xmlChar * xmlXPathParseNCName (xmlXPathParserContextPtr ctxt);
-
-/*
- * Existing functions.
- */
-double xmlXPathStringEvalNumber(const xmlChar *str);
-int xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt,
- xmlXPathObjectPtr res);
-void xmlXPathRegisterAllFunctions(xmlXPathContextPtr ctxt);
-xmlNodeSetPtr xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2);
-void xmlXPathNodeSetDel(xmlNodeSetPtr cur, xmlNodePtr val);
-void xmlXPathNodeSetRemove(xmlNodeSetPtr cur, int val);
-xmlXPathObjectPtr xmlXPathNewNodeSetList(xmlNodeSetPtr val);
-xmlXPathObjectPtr xmlXPathWrapNodeSet(xmlNodeSetPtr val);
-xmlXPathObjectPtr xmlXPathWrapExternal(void *val);
-
-int xmlXPathEqualValues(xmlXPathParserContextPtr ctxt);
-int xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt);
-int xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict);
-void xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt);
-void xmlXPathAddValues(xmlXPathParserContextPtr ctxt);
-void xmlXPathSubValues(xmlXPathParserContextPtr ctxt);
-void xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
-void xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
-void xmlXPathModValues(xmlXPathParserContextPtr ctxt);
-
-int xmlXPathIsNodeType(const xmlChar *name);
-
-/*
- * Some of the axis navigation routines.
- */
-xmlNodePtr xmlXPathNextSelf(xmlXPathParserContextPtr ctxt,
- xmlNodePtr cur);
-xmlNodePtr xmlXPathNextChild(xmlXPathParserContextPtr ctxt,
- xmlNodePtr cur);
-xmlNodePtr xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt,
- xmlNodePtr cur);
-xmlNodePtr xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt,
- xmlNodePtr cur);
-xmlNodePtr xmlXPathNextParent(xmlXPathParserContextPtr ctxt,
- xmlNodePtr cur);
-xmlNodePtr xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt,
- xmlNodePtr cur);
-xmlNodePtr xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt,
- xmlNodePtr cur);
-xmlNodePtr xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt,
- xmlNodePtr cur);
-xmlNodePtr xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt,
- xmlNodePtr cur);
-xmlNodePtr xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt,
- xmlNodePtr cur);
-xmlNodePtr xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt,
- xmlNodePtr cur);
-xmlNodePtr xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt,
- xmlNodePtr cur);
-xmlNodePtr xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt,
- xmlNodePtr cur);
-/*
- * The official core of XPath functions.
- */
-void xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs);
-
-/**
- * Really internal functions
- */
-void xmlXPathNodeSetFreeNs(xmlNsPtr ns);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* ! __XML_XPATH_INTERNALS_H__ */
diff --git a/bundle/libxml/include/libxml/xpointer.h b/bundle/libxml/include/libxml/xpointer.h
deleted file mode 100644
index 80c465c70f..0000000000
--- a/bundle/libxml/include/libxml/xpointer.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * xpointer.h : API to handle XML Pointers
- *
- * World Wide Web Consortium Working Draft 03-March-1998
- * http://www.w3.org/TR/1998/WD-xptr-19980303
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#ifndef __XML_XPTR_H__
-#define __XML_XPTR_H__
-
-#include <libxml/tree.h>
-#include <libxml/xpath.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * A Location Set
- */
-typedef struct _xmlLocationSet xmlLocationSet;
-typedef xmlLocationSet *xmlLocationSetPtr;
-struct _xmlLocationSet {
- int locNr; /* number of locations in the set */
- int locMax; /* size of the array as allocated */
- xmlXPathObjectPtr *locTab;/* array of locations */
-};
-
-/*
- * Handling of location sets.
- */
-
-xmlLocationSetPtr xmlXPtrLocationSetCreate(xmlXPathObjectPtr val);
-void xmlXPtrFreeLocationSet (xmlLocationSetPtr obj);
-xmlLocationSetPtr xmlXPtrLocationSetMerge (xmlLocationSetPtr val1,
- xmlLocationSetPtr val2);
-xmlXPathObjectPtr xmlXPtrNewRange (xmlNodePtr start,
- int startindex,
- xmlNodePtr end,
- int endindex);
-xmlXPathObjectPtr xmlXPtrNewRangePoints (xmlXPathObjectPtr start,
- xmlXPathObjectPtr end);
-xmlXPathObjectPtr xmlXPtrNewRangeNodePoint(xmlNodePtr start,
- xmlXPathObjectPtr end);
-xmlXPathObjectPtr xmlXPtrNewRangePointNode(xmlXPathObjectPtr start,
- xmlNodePtr end);
-xmlXPathObjectPtr xmlXPtrNewRangeNodes (xmlNodePtr start,
- xmlNodePtr end);
-xmlXPathObjectPtr xmlXPtrNewLocationSetNodes(xmlNodePtr start,
- xmlNodePtr end);
-xmlXPathObjectPtr xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set);
-xmlXPathObjectPtr xmlXPtrNewRangeNodeObject(xmlNodePtr start,
- xmlXPathObjectPtr end);
-xmlXPathObjectPtr xmlXPtrNewCollapsedRange(xmlNodePtr start);
-void xmlXPtrLocationSetAdd (xmlLocationSetPtr cur,
- xmlXPathObjectPtr val);
-xmlXPathObjectPtr xmlXPtrWrapLocationSet (xmlLocationSetPtr val);
-void xmlXPtrLocationSetDel (xmlLocationSetPtr cur,
- xmlXPathObjectPtr val);
-void xmlXPtrLocationSetRemove(xmlLocationSetPtr cur,
- int val);
-
-/*
- * Functions.
- */
-xmlXPathContextPtr xmlXPtrNewContext (xmlDocPtr doc,
- xmlNodePtr here,
- xmlNodePtr origin);
-xmlXPathObjectPtr xmlXPtrEval (const xmlChar *str,
- xmlXPathContextPtr ctx);
-void xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt,
- int nargs);
-xmlNodePtr xmlXPtrBuildNodeList (xmlXPathObjectPtr obj);
-void xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_XPTR_H__ */
diff --git a/bundle/libxml/include/win32config.h b/bundle/libxml/include/win32config.h
deleted file mode 100644
index 5b004798cc..0000000000
--- a/bundle/libxml/include/win32config.h
+++ /dev/null
@@ -1,111 +0,0 @@
-#ifndef __LIBXML_WIN32_CONFIG__
-#define __LIBXML_WIN32_CONFIG__
-
-#define HAVE_CTYPE_H
-#define HAVE_STDARG_H
-#define HAVE_MALLOC_H
-#define HAVE_ERRNO_H
-
-#ifdef _WIN32_WCE
-#undef HAVE_ERRNO_H
-#include <windows.h>
-#include "wincecompat.h"
-#else
-#define HAVE_SYS_STAT_H
-#define HAVE__STAT
-#define HAVE_STAT
-#define HAVE_STDLIB_H
-#define HAVE_TIME_H
-#define HAVE_FCNTL_H
-#include <io.h>
-#include <direct.h>
-#endif
-
-#include <libxml/xmlversion.h>
-
-#ifdef NEED_SOCKETS
-#include <wsockcompat.h>
-#endif
-
-#define HAVE_ISINF
-#define HAVE_ISNAN
-#include <math.h>
-#ifdef _MSC_VER
-/* MS C-runtime has functions which can be used in order to determine if
- a given floating-point variable contains NaN, (+-)INF. These are
- preferred, because floating-point technology is considered propriatary
- by MS and we can assume that their functions know more about their
- oddities than we do. */
-#include <float.h>
-/* Bjorn Reese figured a quite nice construct for isinf() using the _fpclass
- function. */
-#ifndef isinf
-#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
- : ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
-#endif
-/* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */
-#ifndef isnan
-#define isnan(d) (_isnan(d))
-#endif
-#else /* _MSC_VER */
-#ifndef isinf
-static int isinf (double d) {
- int expon = 0;
- double val = frexp (d, &expon);
- if (expon == 1025) {
- if (val == 0.5) {
- return 1;
- } else if (val == -0.5) {
- return -1;
- } else {
- return 0;
- }
- } else {
- return 0;
- }
-}
-#endif
-#ifndef isnan
-static int isnan (double d) {
- int expon = 0;
- double val = frexp (d, &expon);
- if (expon == 1025) {
- if (val == 0.5) {
- return 0;
- } else if (val == -0.5) {
- return 0;
- } else {
- return 1;
- }
- } else {
- return 0;
- }
-}
-#endif
-#endif /* _MSC_VER */
-
-#if defined(_MSC_VER) || defined(__MINGW32__)
-#define mkdir(p,m) _mkdir(p)
-#define snprintf _snprintf
-#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
-#endif
-
-/* Threading API to use should be specified here for compatibility reasons.
- This is however best specified on the compiler's command-line. */
-#if defined(LIBXML_THREAD_ENABLED)
-#if !defined(HAVE_PTHREAD_H) && !defined(HAVE_WIN32_THREADS)
-#define HAVE_WIN32_THREADS
-#endif
-#endif
-
-/* Some third-party libraries far from our control assume the following
- is defined, which it is not if we don't include windows.h. */
-#if !defined(FALSE)
-#define FALSE 0
-#endif
-#if !defined(TRUE)
-#define TRUE (!(FALSE))
-#endif
-
-#endif /* __LIBXML_WIN32_CONFIG__ */
-
diff --git a/bundle/libxml/include/wsockcompat.h b/bundle/libxml/include/wsockcompat.h
deleted file mode 100644
index 690048cede..0000000000
--- a/bundle/libxml/include/wsockcompat.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* include/wsockcompat.h
- * Windows -> Berkeley Sockets compatibility things.
- */
-
-#if !defined __XML_WSOCKCOMPAT_H__
-#define __XML_WSOCKCOMPAT_H__
-
-#ifdef _WIN32_WCE
-#include <winsock.h>
-#else
-#undef HAVE_ERRNO_H
-#include <winsock2.h>
-#endif
-
-#if !defined SOCKLEN_T
-#define SOCKLEN_T int
-#endif
-
-#define EWOULDBLOCK WSAEWOULDBLOCK
-#define EINPROGRESS WSAEINPROGRESS
-#define EALREADY WSAEALREADY
-#define ENOTSOCK WSAENOTSOCK
-#define EDESTADDRREQ WSAEDESTADDRREQ
-#define EMSGSIZE WSAEMSGSIZE
-#define EPROTOTYPE WSAEPROTOTYPE
-#define ENOPROTOOPT WSAENOPROTOOPT
-#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
-#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
-#define EOPNOTSUPP WSAEOPNOTSUPP
-#define EPFNOSUPPORT WSAEPFNOSUPPORT
-#define EAFNOSUPPORT WSAEAFNOSUPPORT
-#define EADDRINUSE WSAEADDRINUSE
-#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
-#define ENETDOWN WSAENETDOWN
-#define ENETUNREACH WSAENETUNREACH
-#define ENETRESET WSAENETRESET
-#define ECONNABORTED WSAECONNABORTED
-#define ECONNRESET WSAECONNRESET
-#define ENOBUFS WSAENOBUFS
-#define EISCONN WSAEISCONN
-#define ENOTCONN WSAENOTCONN
-#define ESHUTDOWN WSAESHUTDOWN
-#define ETOOMANYREFS WSAETOOMANYREFS
-#define ETIMEDOUT WSAETIMEDOUT
-#define ECONNREFUSED WSAECONNREFUSED
-#define ELOOP WSAELOOP
-#define EHOSTDOWN WSAEHOSTDOWN
-#define EHOSTUNREACH WSAEHOSTUNREACH
-#define EPROCLIM WSAEPROCLIM
-#define EUSERS WSAEUSERS
-#define EDQUOT WSAEDQUOT
-#define ESTALE WSAESTALE
-#define EREMOTE WSAEREMOTE
-/* These cause conflicts with the codes from errno.h. Since they are
- not used in the relevant code (nanoftp, nanohttp), we can leave
- them disabled.
-#define ENAMETOOLONG WSAENAMETOOLONG
-#define ENOTEMPTY WSAENOTEMPTY
-*/
-
-#endif /* __XML_WSOCKCOMPAT_H__ */
diff --git a/bundle/libxml/libxml.h b/bundle/libxml/libxml.h
deleted file mode 100644
index d34dd10444..0000000000
--- a/bundle/libxml/libxml.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * libxml.h: internal header only used during the compilation of libxml
- *
- * See COPYRIGHT for the status of this software
- *
- * Author: breese@users.sourceforge.net
- */
-
-#ifndef __XML_LIBXML_H__
-#define __XML_LIBXML_H__
-
-#include "php_config.h"
-#include <libxml/xmlversion.h>
-
-#ifndef WITH_TRIO
-#include <stdio.h>
-#else
-/**
- * TRIO_REPLACE_STDIO:
- *
- * This macro is defined if teh trio string formatting functions are to
- * be used instead of the default stdio ones.
- */
-#define TRIO_REPLACE_STDIO
-#include "trio.h"
-#endif
-
-#endif /* ! __XML_LIBXML_H__ */
diff --git a/bundle/libxml/list.c b/bundle/libxml/list.c
deleted file mode 100644
index 18a82973e5..0000000000
--- a/bundle/libxml/list.c
+++ /dev/null
@@ -1,720 +0,0 @@
-/*
- * list.c: lists handling implementation
- *
- * Copyright (C) 2000 Gary Pennington and Daniel Veillard.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- * Author: Gary.Pennington@uk.sun.com
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/list.h>
-#include <libxml/globals.h>
-
-/*
- * Type definition are kept internal
- */
-
-struct _xmlLink
-{
- struct _xmlLink *next;
- struct _xmlLink *prev;
- void *data;
-};
-
-struct _xmlList
-{
- xmlLinkPtr sentinel;
- void (*linkDeallocator)(xmlLinkPtr );
- int (*linkCompare)(const void *, const void*);
-};
-
-/************************************************************************
- * *
- * Interfaces *
- * *
- ************************************************************************/
-
-/**
- * xmlLinkDeallocator:
- * @l: a list
- * @lk: a link
- *
- * Unlink and deallocate @lk from list @l
- */
-static void
-xmlLinkDeallocator(xmlListPtr l, xmlLinkPtr lk)
-{
- (lk->prev)->next = lk->next;
- (lk->next)->prev = lk->prev;
- if(l->linkDeallocator)
- l->linkDeallocator(lk);
- xmlFree(lk);
-}
-
-/**
- * xmlLinkCompare:
- * @data0: first data
- * @data1: second data
- *
- * Compares two arbitrary data
- *
- * Returns -1, 0 or 1 depending on whether data1 is greater equal or smaller
- * than data0
- */
-static int
-xmlLinkCompare(const void *data0, const void *data1)
-{
- if (data0 < data1)
- return (-1);
- else if (data0 == data1)
- return (0);
- return (1);
-}
-
-/**
- * xmlListLowerSearch:
- * @l: a list
- * @data: a data
- *
- * Search data in the ordered list walking from the beginning
- *
- * Returns the link containing the data or NULL
- */
-static xmlLinkPtr
-xmlListLowerSearch(xmlListPtr l, void *data)
-{
- xmlLinkPtr lk;
-
- for(lk = l->sentinel->next;lk != l->sentinel && l->linkCompare(lk->data, data) <0 ;lk = lk->next);
- return lk;
-}
-
-/**
- * xmlListHigherSearch:
- * @l: a list
- * @data: a data
- *
- * Search data in the ordered list walking backward from the end
- *
- * Returns the link containing the data or NULL
- */
-static xmlLinkPtr
-xmlListHigherSearch(xmlListPtr l, void *data)
-{
- xmlLinkPtr lk;
-
- for(lk = l->sentinel->prev;lk != l->sentinel && l->linkCompare(lk->data, data) >0 ;lk = lk->prev);
- return lk;
-}
-
-/**
- * xmlListSearch:
- * @l: a list
- * @data: a data
- *
- * Search data in the list
- *
- * Returns the link containing the data or NULL
- */
-static xmlLinkPtr
-xmlListLinkSearch(xmlListPtr l, void *data)
-{
- xmlLinkPtr lk;
- lk = xmlListLowerSearch(l, data);
- if (lk == l->sentinel)
- return NULL;
- else {
- if (l->linkCompare(lk->data, data) ==0)
- return lk;
- return NULL;
- }
-}
-
-/**
- * xmlListLinkReverseSearch:
- * @l: a list
- * @data: a data
- *
- * Search data in the list processing backward
- *
- * Returns the link containing the data or NULL
- */
-static xmlLinkPtr
-xmlListLinkReverseSearch(xmlListPtr l, void *data)
-{
- xmlLinkPtr lk;
- lk = xmlListHigherSearch(l, data);
- if (lk == l->sentinel)
- return NULL;
- else {
- if (l->linkCompare(lk->data, data) ==0)
- return lk;
- return NULL;
- }
-}
-
-/**
- * xmlListCreate:
- * @deallocator: an optional deallocator function
- * @compare: an optional comparison function
- *
- * Create a new list
- *
- * Returns the new list or NULL in case of error
- */
-xmlListPtr
-xmlListCreate(xmlListDeallocator deallocator, xmlListDataCompare compare)
-{
- xmlListPtr l;
- if (NULL == (l = (xmlListPtr )xmlMalloc( sizeof(xmlList)))) {
- xmlGenericError(xmlGenericErrorContext,
- "Cannot initialize memory for list");
- return (NULL);
- }
- /* Initialize the list to NULL */
- memset(l, 0, sizeof(xmlList));
-
- /* Add the sentinel */
- if (NULL ==(l->sentinel = (xmlLinkPtr )xmlMalloc(sizeof(xmlLink)))) {
- xmlGenericError(xmlGenericErrorContext,
- "Cannot initialize memory for sentinel");
- xmlFree(l);
- return (NULL);
- }
- l->sentinel->next = l->sentinel;
- l->sentinel->prev = l->sentinel;
- l->sentinel->data = NULL;
-
- /* If there is a link deallocator, use it */
- if (deallocator != NULL)
- l->linkDeallocator = deallocator;
- /* If there is a link comparator, use it */
- if (compare != NULL)
- l->linkCompare = compare;
- else /* Use our own */
- l->linkCompare = xmlLinkCompare;
- return l;
-}
-
-/**
- * xmlListSearch:
- * @l: a list
- * @data: a search value
- *
- * Search the list for an existing value of @data
- *
- * Returns the value associated to @data or NULL in case of error
- */
-void *
-xmlListSearch(xmlListPtr l, void *data)
-{
- xmlLinkPtr lk;
- lk = xmlListLinkSearch(l, data);
- if (lk)
- return (lk->data);
- return NULL;
-}
-
-/**
- * xmlListReverseSearch:
- * @l: a list
- * @data: a search value
- *
- * Search the list in reverse order for an existing value of @data
- *
- * Returns the value associated to @data or NULL in case of error
- */
-void *
-xmlListReverseSearch(xmlListPtr l, void *data)
-{
- xmlLinkPtr lk;
- lk = xmlListLinkReverseSearch(l, data);
- if (lk)
- return (lk->data);
- return NULL;
-}
-
-/**
- * xmlListInsert:
- * @l: a list
- * @data: the data
- *
- * Insert data in the ordered list at the beginning for this value
- *
- * Returns 0 in case of success, 1 in case of failure
- */
-int
-xmlListInsert(xmlListPtr l, void *data)
-{
- xmlLinkPtr lkPlace, lkNew;
-
- lkPlace = xmlListLowerSearch(l, data);
- /* Add the new link */
- lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink));
- if (lkNew == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Cannot initialize memory for new link");
- return (1);
- }
- lkNew->data = data;
- lkPlace = lkPlace->prev;
- lkNew->next = lkPlace->next;
- (lkPlace->next)->prev = lkNew;
- lkPlace->next = lkNew;
- lkNew->prev = lkPlace;
- return 0;
-}
-
-/**
- * xmlListAppend:
- * @l: a list
- * @data: the data
- *
- * Insert data in the ordered list at the end for this value
- *
- * Returns 0 in case of success, 1 in case of failure
- */
-int xmlListAppend(xmlListPtr l, void *data)
-{
- xmlLinkPtr lkPlace, lkNew;
-
- lkPlace = xmlListHigherSearch(l, data);
- /* Add the new link */
- lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink));
- if (lkNew == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Cannot initialize memory for new link");
- return (0);
- }
- lkNew->data = data;
- lkNew->next = lkPlace->next;
- (lkPlace->next)->prev = lkNew;
- lkPlace->next = lkNew;
- lkNew->prev = lkPlace;
- return 1;
-}
-
-/**
- * xmlListDelete:
- * @l: a list
- *
- * Deletes the list and its associated data
- */
-void xmlListDelete(xmlListPtr l)
-{
- xmlListClear(l);
- xmlFree(l->sentinel);
- xmlFree(l);
-}
-
-/**
- * xmlListRemoveFirst:
- * @l: a list
- * @data: list data
- *
- * Remove the first instance associated to data in the list
- *
- * Returns 1 if a deallocation occured, or 0 if not found
- */
-int
-xmlListRemoveFirst(xmlListPtr l, void *data)
-{
- xmlLinkPtr lk;
-
- /*Find the first instance of this data */
- lk = xmlListLinkSearch(l, data);
- if (lk != NULL) {
- xmlLinkDeallocator(l, lk);
- return 1;
- }
- return 0;
-}
-
-/**
- * xmlListRemoveLast:
- * @l: a list
- * @data: list data
- *
- * Remove the last instance associated to data in the list
- *
- * Returns 1 if a deallocation occured, or 0 if not found
- */
-int
-xmlListRemoveLast(xmlListPtr l, void *data)
-{
- xmlLinkPtr lk;
-
- /*Find the last instance of this data */
- lk = xmlListLinkReverseSearch(l, data);
- if (lk != NULL) {
- xmlLinkDeallocator(l, lk);
- return 1;
- }
- return 0;
-}
-
-/**
- * xmlListRemoveAll:
- * @l: a list
- * @data: list data
- *
- * Remove the all instance associated to data in the list
- *
- * Returns the number of deallocation, or 0 if not found
- */
-int
-xmlListRemoveAll(xmlListPtr l, void *data)
-{
- int count=0;
-
-
- while(xmlListRemoveFirst(l, data))
- count++;
- return count;
-}
-
-/**
- * xmlListClear:
- * @l: a list
- *
- * Remove the all data in the list
- */
-void
-xmlListClear(xmlListPtr l)
-{
- xmlLinkPtr lk = l->sentinel->next;
-
- while(lk != l->sentinel) {
- xmlLinkPtr next = lk->next;
-
- xmlLinkDeallocator(l, lk);
- lk = next;
- }
-}
-
-/**
- * xmlListEmpty:
- * @l: a list
- *
- * Is the list empty ?
- *
- * Returns 1 if the list is empty, 0 otherwise
- */
-int
-xmlListEmpty(xmlListPtr l)
-{
- return (l->sentinel->next == l->sentinel);
-}
-
-/**
- * xmlListFront:
- * @l: a list
- *
- * Get the first element in the list
- *
- * Returns the first element in the list, or NULL
- */
-xmlLinkPtr
-xmlListFront(xmlListPtr l)
-{
- return (l->sentinel->next);
-}
-
-/**
- * xmlListEnd:
- * @l: a list
- *
- * Get the last element in the list
- *
- * Returns the last element in the list, or NULL
- */
-xmlLinkPtr
-xmlListEnd(xmlListPtr l)
-{
- return (l->sentinel->prev);
-}
-
-/**
- * xmlListSize:
- * @l: a list
- *
- * Get the number of elements in the list
- *
- * Returns the number of elements in the list
- */
-int
-xmlListSize(xmlListPtr l)
-{
- xmlLinkPtr lk;
- int count=0;
-
- /* TODO: keep a counter in xmlList instead */
- for(lk = l->sentinel->next; lk != l->sentinel; lk = lk->next, count++);
- return count;
-}
-
-/**
- * xmlListPopFront:
- * @l: a list
- *
- * Removes the first element in the list
- */
-void
-xmlListPopFront(xmlListPtr l)
-{
- if(!xmlListEmpty(l))
- xmlLinkDeallocator(l, l->sentinel->next);
-}
-
-/**
- * xmlListPopBack:
- * @l: a list
- *
- * Removes the last element in the list
- */
-void
-xmlListPopBack(xmlListPtr l)
-{
- if(!xmlListEmpty(l))
- xmlLinkDeallocator(l, l->sentinel->prev);
-}
-
-/**
- * xmlListPushFront:
- * @l: a list
- * @data: new data
- *
- * add the new data at the beginning of the list
- *
- * Returns 1 if successful, 0 otherwise
- */
-int
-xmlListPushFront(xmlListPtr l, void *data)
-{
- xmlLinkPtr lkPlace, lkNew;
-
- lkPlace = l->sentinel;
- /* Add the new link */
- lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink));
- if (lkNew == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Cannot initialize memory for new link");
- return (0);
- }
- lkNew->data = data;
- lkNew->next = lkPlace->next;
- (lkPlace->next)->prev = lkNew;
- lkPlace->next = lkNew;
- lkNew->prev = lkPlace;
- return 1;
-}
-
-/**
- * xmlListPushBack:
- * @l: a list
- * @data: new data
- *
- * add the new data at the end of the list
- *
- * Returns 1 if successful, 0 otherwise
- */
-int
-xmlListPushBack(xmlListPtr l, void *data)
-{
- xmlLinkPtr lkPlace, lkNew;
-
- lkPlace = l->sentinel->prev;
- /* Add the new link */
- if (NULL ==(lkNew = (xmlLinkPtr )xmlMalloc(sizeof(xmlLink)))) {
- xmlGenericError(xmlGenericErrorContext,
- "Cannot initialize memory for new link");
- return (0);
- }
- lkNew->data = data;
- lkNew->next = lkPlace->next;
- (lkPlace->next)->prev = lkNew;
- lkPlace->next = lkNew;
- lkNew->prev = lkPlace;
- return 1;
-}
-
-/**
- * xmlLinkGetData:
- * @lk: a link
- *
- * See Returns.
- *
- * Returns a pointer to the data referenced from this link
- */
-void *
-xmlLinkGetData(xmlLinkPtr lk)
-{
- return lk->data;
-}
-
-/**
- * xmlListReverse:
- * @l: a list
- *
- * Reverse the order of the elements in the list
- */
-void
-xmlListReverse(xmlListPtr l) {
- xmlLinkPtr lk;
- xmlLinkPtr lkPrev = l->sentinel;
-
- for(lk = l->sentinel->next; lk != l->sentinel; lk = lk->next) {
- lkPrev->next = lkPrev->prev;
- lkPrev->prev = lk;
- lkPrev = lk;
- }
- /* Fix up the last node */
- lkPrev->next = lkPrev->prev;
- lkPrev->prev = lk;
-}
-
-/**
- * xmlListSort:
- * @l: a list
- *
- * Sort all the elements in the list
- */
-void
-xmlListSort(xmlListPtr l)
-{
- xmlListPtr lTemp;
-
- if(xmlListEmpty(l))
- return;
-
- /* I think that the real answer is to implement quicksort, the
- * alternative is to implement some list copying procedure which
- * would be based on a list copy followed by a clear followed by
- * an insert. This is slow...
- */
-
- if (NULL ==(lTemp = xmlListDup(l)))
- return;
- xmlListClear(l);
- xmlListMerge(l, lTemp);
- xmlListDelete(lTemp);
- return;
-}
-
-/**
- * xmlListWalk:
- * @l: a list
- * @walker: a processing function
- * @user: a user parameter passed to the walker function
- *
- * Walk all the element of the first from first to last and
- * apply the walker function to it
- */
-void
-xmlListWalk(xmlListPtr l, xmlListWalker walker, const void *user) {
- xmlLinkPtr lk;
-
- for(lk = l->sentinel->next; lk != l->sentinel; lk = lk->next) {
- if((walker(lk->data, user)) == 0)
- break;
- }
-}
-
-/**
- * xmlListReverseWalk:
- * @l: a list
- * @walker: a processing function
- * @user: a user parameter passed to the walker function
- *
- * Walk all the element of the list in reverse order and
- * apply the walker function to it
- */
-void
-xmlListReverseWalk(xmlListPtr l, xmlListWalker walker, const void *user) {
- xmlLinkPtr lk;
-
- for(lk = l->sentinel->prev; lk != l->sentinel; lk = lk->prev) {
- if((walker(lk->data, user)) == 0)
- break;
- }
-}
-
-/**
- * xmlListMerge:
- * @l1: the original list
- * @l2: the new list
- *
- * include all the elements of the second list in the first one and
- * clear the second list
- */
-void
-xmlListMerge(xmlListPtr l1, xmlListPtr l2)
-{
- xmlListCopy(l1, l2);
- xmlListClear(l2);
-}
-
-/**
- * xmlListDup:
- * @old: the list
- *
- * Duplicate the list
- *
- * Returns a new copy of the list or NULL in case of error
- */
-xmlListPtr
-xmlListDup(const xmlListPtr old)
-{
- xmlListPtr cur;
- /* Hmmm, how to best deal with allocation issues when copying
- * lists. If there is a de-allocator, should responsibility lie with
- * the new list or the old list. Surely not both. I'll arbitrarily
- * set it to be the old list for the time being whilst I work out
- * the answer
- */
- if (NULL ==(cur = xmlListCreate(NULL, old->linkCompare)))
- return (NULL);
- if (0 != xmlListCopy(cur, old))
- return NULL;
- return cur;
-}
-
-/**
- * xmlListCopy:
- * @cur: the new list
- * @old: the old list
- *
- * Move all the element from the old list in the new list
- *
- * Returns 0 in case of success 1 in case of error
- */
-int
-xmlListCopy(xmlListPtr cur, const xmlListPtr old)
-{
- /* Walk the old tree and insert the data into the new one */
- xmlLinkPtr lk;
-
- for(lk = old->sentinel->next; lk != old->sentinel; lk = lk->next) {
- if (0 !=xmlListInsert(cur, lk->data)) {
- xmlListDelete(cur);
- return (1);
- }
- }
- return (0);
-}
-/* xmlListUnique() */
-/* xmlListSwap */
diff --git a/bundle/libxml/nanoftp.c b/bundle/libxml/nanoftp.c
deleted file mode 100644
index 4f3b819238..0000000000
--- a/bundle/libxml/nanoftp.c
+++ /dev/null
@@ -1,1924 +0,0 @@
-/*
- * nanoftp.c: basic FTP client support
- *
- * Reference: RFC 959
- */
-
-#ifdef TESTING
-#define STANDALONE
-#define HAVE_STDLIB_H
-#define HAVE_UNISTD_H
-#define HAVE_SYS_SOCKET_H
-#define HAVE_NETINET_IN_H
-#define HAVE_NETDB_H
-#define HAVE_SYS_TIME_H
-#else /* TESTING */
-#define NEED_SOCKETS
-#endif /* TESTING */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#ifdef LIBXML_FTP_ENABLED
-#include <string.h>
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-#include <libxml/xmlerror.h>
-#include <libxml/nanoftp.h>
-#include <libxml/globals.h>
-
-/* #define DEBUG_FTP 1 */
-#ifdef STANDALONE
-#ifndef DEBUG_FTP
-#define DEBUG_FTP 1
-#endif
-#endif
-
-/**
- * A couple portability macros
- */
-#ifndef _WINSOCKAPI_
-#define closesocket(s) close(s)
-#define SOCKET int
-#endif
-#if defined(VMS) || defined(__VMS)
-#define SOCKLEN_T unsigned int
-#endif
-
-/*
- * Hack to make compilation work -SH
- */
-#ifndef SOCKLEN_T
-#define SOCKLEN_T unsigned int
-#endif
-
-#define FTP_COMMAND_OK 200
-#define FTP_SYNTAX_ERROR 500
-#define FTP_GET_PASSWD 331
-#define FTP_BUF_SIZE 512
-
-typedef struct xmlNanoFTPCtxt {
- char *protocol; /* the protocol name */
- char *hostname; /* the host name */
- int port; /* the port */
- char *path; /* the path within the URL */
- char *user; /* user string */
- char *passwd; /* passwd string */
- struct sockaddr_in ftpAddr; /* the socket address struct */
- int passive; /* currently we support only passive !!! */
- SOCKET controlFd; /* the file descriptor for the control socket */
- SOCKET dataFd; /* the file descriptor for the data socket */
- int state; /* WRITE / READ / CLOSED */
- int returnValue; /* the protocol return value */
- /* buffer for data received from the control connection */
- char controlBuf[FTP_BUF_SIZE + 1];
- int controlBufIndex;
- int controlBufUsed;
- int controlBufAnswer;
-} xmlNanoFTPCtxt, *xmlNanoFTPCtxtPtr;
-
-static int initialized = 0;
-static char *proxy = NULL; /* the proxy name if any */
-static int proxyPort = 0; /* the proxy port if any */
-static char *proxyUser = NULL; /* user for proxy authentication */
-static char *proxyPasswd = NULL;/* passwd for proxy authentication */
-static int proxyType = 0; /* uses TYPE or a@b ? */
-
-/**
- * xmlNanoFTPInit:
- *
- * Initialize the FTP protocol layer.
- * Currently it just checks for proxy informations,
- * and get the hostname
- */
-
-void
-xmlNanoFTPInit(void) {
- const char *env;
-#ifdef _WINSOCKAPI_
- WSADATA wsaData;
-#endif
-
- if (initialized)
- return;
-
-#ifdef _WINSOCKAPI_
- if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0)
- return;
-#endif
-
- proxyPort = 21;
- env = getenv("no_proxy");
- if (env != NULL)
- return;
- env = getenv("ftp_proxy");
- if (env != NULL) {
- xmlNanoFTPScanProxy(env);
- } else {
- env = getenv("FTP_PROXY");
- if (env != NULL) {
- xmlNanoFTPScanProxy(env);
- }
- }
- env = getenv("ftp_proxy_user");
- if (env != NULL) {
- proxyUser = xmlMemStrdup(env);
- }
- env = getenv("ftp_proxy_password");
- if (env != NULL) {
- proxyPasswd = xmlMemStrdup(env);
- }
- initialized = 1;
-}
-
-/**
- * xmlNanoFTPCleanup:
- *
- * Cleanup the FTP protocol layer. This cleanup proxy informations.
- */
-
-void
-xmlNanoFTPCleanup(void) {
- if (proxy != NULL) {
- xmlFree(proxy);
- proxy = NULL;
- }
- if (proxyUser != NULL) {
- xmlFree(proxyUser);
- proxyUser = NULL;
- }
- if (proxyPasswd != NULL) {
- xmlFree(proxyPasswd);
- proxyPasswd = NULL;
- }
-#ifdef _WINSOCKAPI_
- if (initialized)
- WSACleanup();
-#endif
- initialized = 0;
-}
-
-/**
- * xmlNanoFTPProxy:
- * @host: the proxy host name
- * @port: the proxy port
- * @user: the proxy user name
- * @passwd: the proxy password
- * @type: the type of proxy 1 for using SITE, 2 for USER a@b
- *
- * Setup the FTP proxy informations.
- * This can also be done by using ftp_proxy ftp_proxy_user and
- * ftp_proxy_password environment variables.
- */
-
-void
-xmlNanoFTPProxy(const char *host, int port, const char *user,
- const char *passwd, int type) {
- if (proxy != NULL)
- xmlFree(proxy);
- if (proxyUser != NULL)
- xmlFree(proxyUser);
- if (proxyPasswd != NULL)
- xmlFree(proxyPasswd);
- if (host)
- proxy = xmlMemStrdup(host);
- if (user)
- proxyUser = xmlMemStrdup(user);
- if (passwd)
- proxyPasswd = xmlMemStrdup(passwd);
- proxyPort = port;
- proxyType = type;
-}
-
-/**
- * xmlNanoFTPScanURL:
- * @ctx: an FTP context
- * @URL: The URL used to initialize the context
- *
- * (Re)Initialize an FTP context by parsing the URL and finding
- * the protocol host port and path it indicates.
- */
-
-static void
-xmlNanoFTPScanURL(void *ctx, const char *URL) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- const char *cur = URL;
- char buf[4096];
- int indx = 0;
- int port = 0;
-
- if (ctxt->protocol != NULL) {
- xmlFree(ctxt->protocol);
- ctxt->protocol = NULL;
- }
- if (ctxt->hostname != NULL) {
- xmlFree(ctxt->hostname);
- ctxt->hostname = NULL;
- }
- if (ctxt->path != NULL) {
- xmlFree(ctxt->path);
- ctxt->path = NULL;
- }
- if (URL == NULL) return;
- buf[indx] = 0;
- while (*cur != 0) {
- if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
- buf[indx] = 0;
- ctxt->protocol = xmlMemStrdup(buf);
- indx = 0;
- cur += 3;
- break;
- }
- buf[indx++] = *cur++;
- }
- if (*cur == 0) return;
-
- buf[indx] = 0;
- /* allow user@ and user:pass@ forms */
- {
- const char *p = strchr(cur, '@');
- if(p) {
- while(1) {
- if(cur[0] == ':' || cur[0] == '@') break;
- buf[indx++] = *cur++;
- }
- buf[indx] = 0;
- ctxt->user = xmlMemStrdup(buf);
- indx = 0;
- if(cur[0] == ':') {
- cur++;
- while(1) {
- if(cur[0] == '@') break;
- buf[indx++] = *cur++;
- }
- buf[indx] = 0;
- ctxt->passwd = xmlMemStrdup(buf);
- indx = 0;
- }
- cur = p+1;
- }
- }
-
- while (1) {
- if (cur[0] == ':') {
- buf[indx] = 0;
- ctxt->hostname = xmlMemStrdup(buf);
- indx = 0;
- cur += 1;
- while ((*cur >= '0') && (*cur <= '9')) {
- port *= 10;
- port += *cur - '0';
- cur++;
- }
- if (port != 0) ctxt->port = port;
- while ((cur[0] != '/') && (*cur != 0))
- cur++;
- break;
- }
- if ((*cur == '/') || (*cur == 0)) {
- buf[indx] = 0;
- ctxt->hostname = xmlMemStrdup(buf);
- indx = 0;
- break;
- }
- buf[indx++] = *cur++;
- }
- if (*cur == 0)
- ctxt->path = xmlMemStrdup("/");
- else {
- indx = 0;
- buf[indx] = 0;
- while (*cur != 0)
- buf[indx++] = *cur++;
- buf[indx] = 0;
- ctxt->path = xmlMemStrdup(buf);
- }
-}
-
-/**
- * xmlNanoFTPUpdateURL:
- * @ctx: an FTP context
- * @URL: The URL used to update the context
- *
- * Update an FTP context by parsing the URL and finding
- * new path it indicates. If there is an error in the
- * protocol, hostname, port or other information, the
- * error is raised. It indicates a new connection has to
- * be established.
- *
- * Returns 0 if Ok, -1 in case of error (other host).
- */
-
-int
-xmlNanoFTPUpdateURL(void *ctx, const char *URL) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- const char *cur = URL;
- char buf[4096];
- int indx = 0;
- int port = 0;
-
- if (URL == NULL)
- return(-1);
- if (ctxt == NULL)
- return(-1);
- if (ctxt->protocol == NULL)
- return(-1);
- if (ctxt->hostname == NULL)
- return(-1);
- buf[indx] = 0;
- while (*cur != 0) {
- if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
- buf[indx] = 0;
- if (strcmp(ctxt->protocol, buf))
- return(-1);
- indx = 0;
- cur += 3;
- break;
- }
- buf[indx++] = *cur++;
- }
- if (*cur == 0)
- return(-1);
-
- buf[indx] = 0;
- while (1) {
- if (cur[0] == ':') {
- buf[indx] = 0;
- if (strcmp(ctxt->hostname, buf))
- return(-1);
- indx = 0;
- cur += 1;
- while ((*cur >= '0') && (*cur <= '9')) {
- port *= 10;
- port += *cur - '0';
- cur++;
- }
- if (port != ctxt->port)
- return(-1);
- while ((cur[0] != '/') && (*cur != 0))
- cur++;
- break;
- }
- if ((*cur == '/') || (*cur == 0)) {
- buf[indx] = 0;
- if (strcmp(ctxt->hostname, buf))
- return(-1);
- indx = 0;
- break;
- }
- buf[indx++] = *cur++;
- }
- if (ctxt->path != NULL) {
- xmlFree(ctxt->path);
- ctxt->path = NULL;
- }
-
- if (*cur == 0)
- ctxt->path = xmlMemStrdup("/");
- else {
- indx = 0;
- buf[indx] = 0;
- while (*cur != 0)
- buf[indx++] = *cur++;
- buf[indx] = 0;
- ctxt->path = xmlMemStrdup(buf);
- }
- return(0);
-}
-
-/**
- * xmlNanoFTPScanProxy:
- * @URL: The proxy URL used to initialize the proxy context
- *
- * (Re)Initialize the FTP Proxy context by parsing the URL and finding
- * the protocol host port it indicates.
- * Should be like ftp://myproxy/ or ftp://myproxy:3128/
- * A NULL URL cleans up proxy informations.
- */
-
-void
-xmlNanoFTPScanProxy(const char *URL) {
- const char *cur = URL;
- char buf[4096];
- int indx = 0;
- int port = 0;
-
- if (proxy != NULL) {
- xmlFree(proxy);
- proxy = NULL;
- }
- if (proxyPort != 0) {
- proxyPort = 0;
- }
-#ifdef DEBUG_FTP
- if (URL == NULL)
- xmlGenericError(xmlGenericErrorContext, "Removing FTP proxy info\n");
- else
- xmlGenericError(xmlGenericErrorContext, "Using FTP proxy %s\n", URL);
-#endif
- if (URL == NULL) return;
- buf[indx] = 0;
- while (*cur != 0) {
- if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
- buf[indx] = 0;
- indx = 0;
- cur += 3;
- break;
- }
- buf[indx++] = *cur++;
- }
- if (*cur == 0) return;
-
- buf[indx] = 0;
- while (1) {
- if (cur[0] == ':') {
- buf[indx] = 0;
- proxy = xmlMemStrdup(buf);
- indx = 0;
- cur += 1;
- while ((*cur >= '0') && (*cur <= '9')) {
- port *= 10;
- port += *cur - '0';
- cur++;
- }
- if (port != 0) proxyPort = port;
- while ((cur[0] != '/') && (*cur != 0))
- cur++;
- break;
- }
- if ((*cur == '/') || (*cur == 0)) {
- buf[indx] = 0;
- proxy = xmlMemStrdup(buf);
- indx = 0;
- break;
- }
- buf[indx++] = *cur++;
- }
-}
-
-/**
- * xmlNanoFTPNewCtxt:
- * @URL: The URL used to initialize the context
- *
- * Allocate and initialize a new FTP context.
- *
- * Returns an FTP context or NULL in case of error.
- */
-
-void*
-xmlNanoFTPNewCtxt(const char *URL) {
- xmlNanoFTPCtxtPtr ret;
-
- ret = (xmlNanoFTPCtxtPtr) xmlMalloc(sizeof(xmlNanoFTPCtxt));
- if (ret == NULL) return(NULL);
-
- memset(ret, 0, sizeof(xmlNanoFTPCtxt));
- ret->port = 21;
- ret->passive = 1;
- ret->returnValue = 0;
- ret->controlBufIndex = 0;
- ret->controlBufUsed = 0;
- ret->controlFd = -1;
-
- if (URL != NULL)
- xmlNanoFTPScanURL(ret, URL);
-
- return(ret);
-}
-
-/**
- * xmlNanoFTPFreeCtxt:
- * @ctx: an FTP context
- *
- * Frees the context after closing the connection.
- */
-
-void
-xmlNanoFTPFreeCtxt(void * ctx) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- if (ctxt == NULL) return;
- if (ctxt->hostname != NULL) xmlFree(ctxt->hostname);
- if (ctxt->protocol != NULL) xmlFree(ctxt->protocol);
- if (ctxt->path != NULL) xmlFree(ctxt->path);
- ctxt->passive = 1;
- if (ctxt->controlFd >= 0) closesocket(ctxt->controlFd);
- ctxt->controlFd = -1;
- ctxt->controlBufIndex = -1;
- ctxt->controlBufUsed = -1;
- xmlFree(ctxt);
-}
-
-/**
- * xmlNanoFTPParseResponse:
- * @buf: the buffer containing the response
- * @len: the buffer length
- *
- * Parsing of the server answer, we just extract the code.
- *
- * returns 0 for errors
- * +XXX for last line of response
- * -XXX for response to be continued
- */
-static int
-xmlNanoFTPParseResponse(char *buf, int len) {
- int val = 0;
-
- if (len < 3) return(-1);
- if ((*buf >= '0') && (*buf <= '9'))
- val = val * 10 + (*buf - '0');
- else
- return(0);
- buf++;
- if ((*buf >= '0') && (*buf <= '9'))
- val = val * 10 + (*buf - '0');
- else
- return(0);
- buf++;
- if ((*buf >= '0') && (*buf <= '9'))
- val = val * 10 + (*buf - '0');
- else
- return(0);
- buf++;
- if (*buf == '-')
- return(-val);
- return(val);
-}
-
-/**
- * xmlNanoFTPGetMore:
- * @ctx: an FTP context
- *
- * Read more information from the FTP control connection
- * Returns the number of bytes read, < 0 indicates an error
- */
-static int
-xmlNanoFTPGetMore(void *ctx) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- int len;
- int size;
-
- if ((ctxt->controlBufIndex < 0) || (ctxt->controlBufIndex > FTP_BUF_SIZE)) {
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext,
- "xmlNanoFTPGetMore : controlBufIndex = %d\n",
- ctxt->controlBufIndex);
-#endif
- return(-1);
- }
-
- if ((ctxt->controlBufUsed < 0) || (ctxt->controlBufUsed > FTP_BUF_SIZE)) {
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext,
- "xmlNanoFTPGetMore : controlBufUsed = %d\n",
- ctxt->controlBufUsed);
-#endif
- return(-1);
- }
- if (ctxt->controlBufIndex > ctxt->controlBufUsed) {
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext,
- "xmlNanoFTPGetMore : controlBufIndex > controlBufUsed %d > %d\n",
- ctxt->controlBufIndex, ctxt->controlBufUsed);
-#endif
- return(-1);
- }
-
- /*
- * First pack the control buffer
- */
- if (ctxt->controlBufIndex > 0) {
- memmove(&ctxt->controlBuf[0], &ctxt->controlBuf[ctxt->controlBufIndex],
- ctxt->controlBufUsed - ctxt->controlBufIndex);
- ctxt->controlBufUsed -= ctxt->controlBufIndex;
- ctxt->controlBufIndex = 0;
- }
- size = FTP_BUF_SIZE - ctxt->controlBufUsed;
- if (size == 0) {
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext,
- "xmlNanoFTPGetMore : buffer full %d \n", ctxt->controlBufUsed);
-#endif
- return(0);
- }
-
- /*
- * Read the amount left on the control connection
- */
- if ((len = recv(ctxt->controlFd, &ctxt->controlBuf[ctxt->controlBufIndex],
- size, 0)) < 0) {
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- ctxt->controlFd = -1;
- return(-1);
- }
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext,
- "xmlNanoFTPGetMore : read %d [%d - %d]\n", len,
- ctxt->controlBufUsed, ctxt->controlBufUsed + len);
-#endif
- ctxt->controlBufUsed += len;
- ctxt->controlBuf[ctxt->controlBufUsed] = 0;
-
- return(len);
-}
-
-/**
- * xmlNanoFTPReadResponse:
- * @ctx: an FTP context
- *
- * Read the response from the FTP server after a command.
- * Returns the code number
- */
-static int
-xmlNanoFTPReadResponse(void *ctx) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- char *ptr, *end;
- int len;
- int res = -1, cur = -1;
-
-get_more:
- /*
- * Assumes everything up to controlBuf[controlBufIndex] has been read
- * and analyzed.
- */
- len = xmlNanoFTPGetMore(ctx);
- if (len < 0) {
- return(-1);
- }
- if ((ctxt->controlBufUsed == 0) && (len == 0)) {
- return(-1);
- }
- ptr = &ctxt->controlBuf[ctxt->controlBufIndex];
- end = &ctxt->controlBuf[ctxt->controlBufUsed];
-
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext,
- "\n<<<\n%s\n--\n", ptr);
-#endif
- while (ptr < end) {
- cur = xmlNanoFTPParseResponse(ptr, end - ptr);
- if (cur > 0) {
- /*
- * Successfully scanned the control code, scratch
- * till the end of the line, but keep the index to be
- * able to analyze the result if needed.
- */
- res = cur;
- ptr += 3;
- ctxt->controlBufAnswer = ptr - ctxt->controlBuf;
- while ((ptr < end) && (*ptr != '\n')) ptr++;
- if (*ptr == '\n') ptr++;
- if (*ptr == '\r') ptr++;
- break;
- }
- while ((ptr < end) && (*ptr != '\n')) ptr++;
- if (ptr >= end) {
- ctxt->controlBufIndex = ctxt->controlBufUsed;
- goto get_more;
- }
- if (*ptr != '\r') ptr++;
- }
-
- if (res < 0) goto get_more;
- ctxt->controlBufIndex = ptr - ctxt->controlBuf;
-#ifdef DEBUG_FTP
- ptr = &ctxt->controlBuf[ctxt->controlBufIndex];
- xmlGenericError(xmlGenericErrorContext, "\n---\n%s\n--\n", ptr);
-#endif
-
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "Got %d\n", res);
-#endif
- return(res / 100);
-}
-
-/**
- * xmlNanoFTPGetResponse:
- * @ctx: an FTP context
- *
- * Get the response from the FTP server after a command.
- * Returns the code number
- */
-
-int
-xmlNanoFTPGetResponse(void *ctx) {
- int res;
-
- res = xmlNanoFTPReadResponse(ctx);
-
- return(res);
-}
-
-/**
- * xmlNanoFTPCheckResponse:
- * @ctx: an FTP context
- *
- * Check if there is a response from the FTP server after a command.
- * Returns the code number, or 0
- */
-
-int
-xmlNanoFTPCheckResponse(void *ctx) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- fd_set rfd;
- struct timeval tv;
-
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- FD_ZERO(&rfd);
- FD_SET(ctxt->controlFd, &rfd);
- switch(select(ctxt->controlFd + 1, &rfd, NULL, NULL, &tv)) {
- case 0:
- return(0);
- case -1:
-#ifdef DEBUG_FTP
- perror("select");
-#endif
- return(-1);
-
- }
-
- return(xmlNanoFTPReadResponse(ctx));
-}
-
-/**
- * Send the user authentication
- */
-
-static int
-xmlNanoFTPSendUser(void *ctx) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- char buf[200];
- int len;
- int res;
-
- if (ctxt->user == NULL)
- snprintf(buf, sizeof(buf), "USER anonymous\r\n");
- else
- snprintf(buf, sizeof(buf), "USER %s\r\n", ctxt->user);
- buf[sizeof(buf) - 1] = 0;
- len = strlen(buf);
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "%s", buf);
-#endif
- res = send(ctxt->controlFd, buf, len, 0);
- if (res < 0) return(res);
- return(0);
-}
-
-/**
- * Send the password authentication
- */
-
-static int
-xmlNanoFTPSendPasswd(void *ctx) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- char buf[200];
- int len;
- int res;
-
- if (ctxt->passwd == NULL)
- snprintf(buf, sizeof(buf), "PASS anonymous@\r\n");
- else
- snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd);
- buf[sizeof(buf) - 1] = 0;
- len = strlen(buf);
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "%s", buf);
-#endif
- res = send(ctxt->controlFd, buf, len, 0);
- if (res < 0) return(res);
- return(0);
-}
-
-/**
- * xmlNanoFTPQuit:
- * @ctx: an FTP context
- *
- * Send a QUIT command to the server
- *
- * Returns -1 in case of error, 0 otherwise
- */
-
-
-int
-xmlNanoFTPQuit(void *ctx) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- char buf[200];
- int len;
- int res;
-
- snprintf(buf, sizeof(buf), "QUIT\r\n");
- len = strlen(buf);
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "%s", buf); /* Just to be consistent, even though we know it can't have a % in it */
-#endif
- res = send(ctxt->controlFd, buf, len, 0);
- return(0);
-}
-
-/**
- * xmlNanoFTPConnect:
- * @ctx: an FTP context
- *
- * Tries to open a control connection
- *
- * Returns -1 in case of error, 0 otherwise
- */
-
-int
-xmlNanoFTPConnect(void *ctx) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- struct hostent *hp;
- int port;
- int res;
-
- if (ctxt == NULL)
- return(-1);
- if (ctxt->hostname == NULL)
- return(-1);
-
- /*
- * do the blocking DNS query.
- */
- if (proxy)
- hp = gethostbyname(proxy);
- else
- hp = gethostbyname(ctxt->hostname);
- if (hp == NULL)
- return(-1);
-
- /*
- * Prepare the socket
- */
- memset(&ctxt->ftpAddr, 0, sizeof(ctxt->ftpAddr));
- ctxt->ftpAddr.sin_family = AF_INET;
- memcpy(&ctxt->ftpAddr.sin_addr, hp->h_addr_list[0], hp->h_length);
- if (proxy) {
- port = proxyPort;
- } else {
- port = ctxt->port;
- }
- if (port == 0)
- port = 21;
- ctxt->ftpAddr.sin_port = htons(port);
- ctxt->controlFd = socket(AF_INET, SOCK_STREAM, 0);
- if (ctxt->controlFd < 0)
- return(-1);
-
- /*
- * Do the connect.
- */
- if (connect(ctxt->controlFd, (struct sockaddr *) &ctxt->ftpAddr,
- sizeof(struct sockaddr_in)) < 0) {
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- ctxt->controlFd = -1;
- return(-1);
- }
-
- /*
- * Wait for the HELLO from the server.
- */
- res = xmlNanoFTPGetResponse(ctxt);
- if (res != 2) {
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- ctxt->controlFd = -1;
- return(-1);
- }
-
- /*
- * State diagram for the login operation on the FTP server
- *
- * Reference: RFC 959
- *
- * 1
- * +---+ USER +---+------------->+---+
- * | B |---------->| W | 2 ---->| E |
- * +---+ +---+------ | -->+---+
- * | | | | |
- * 3 | | 4,5 | | |
- * -------------- ----- | | |
- * | | | | |
- * | | | | |
- * | --------- |
- * | 1| | | |
- * V | | | |
- * +---+ PASS +---+ 2 | ------>+---+
- * | |---------->| W |------------->| S |
- * +---+ +---+ ---------->+---+
- * | | | | |
- * 3 | |4,5| | |
- * -------------- -------- |
- * | | | | |
- * | | | | |
- * | -----------
- * | 1,3| | | |
- * V | 2| | |
- * +---+ ACCT +---+-- | ----->+---+
- * | |---------->| W | 4,5 -------->| F |
- * +---+ +---+------------->+---+
- *
- * Of course in case of using a proxy this get really nasty and is not
- * standardized at all :-(
- */
- if (proxy) {
- int len;
- char buf[400];
-
- if (proxyUser != NULL) {
- /*
- * We need proxy auth
- */
- snprintf(buf, sizeof(buf), "USER %s\r\n", proxyUser);
- buf[sizeof(buf) - 1] = 0;
- len = strlen(buf);
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "%s", buf);
-#endif
- res = send(ctxt->controlFd, buf, len, 0);
- if (res < 0) {
- closesocket(ctxt->controlFd);
- ctxt->controlFd = -1;
- return(res);
- }
- res = xmlNanoFTPGetResponse(ctxt);
- switch (res) {
- case 2:
- if (proxyPasswd == NULL)
- break;
- case 3:
- if (proxyPasswd != NULL)
- snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd);
- else
- snprintf(buf, sizeof(buf), "PASS anonymous@\r\n");
- buf[sizeof(buf) - 1] = 0;
- len = strlen(buf);
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "%s", buf);
-#endif
- res = send(ctxt->controlFd, buf, len, 0);
- if (res < 0) {
- closesocket(ctxt->controlFd);
- ctxt->controlFd = -1;
- return(res);
- }
- res = xmlNanoFTPGetResponse(ctxt);
- if (res > 3) {
- closesocket(ctxt->controlFd);
- ctxt->controlFd = -1;
- return(-1);
- }
- break;
- case 1:
- break;
- case 4:
- case 5:
- case -1:
- default:
- closesocket(ctxt->controlFd);
- ctxt->controlFd = -1;
- return(-1);
- }
- }
-
- /*
- * We assume we don't need more authentication to the proxy
- * and that it succeeded :-\
- */
- switch (proxyType) {
- case 0:
- /* we will try in sequence */
- case 1:
- /* Using SITE command */
- snprintf(buf, sizeof(buf), "SITE %s\r\n", ctxt->hostname);
- buf[sizeof(buf) - 1] = 0;
- len = strlen(buf);
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "%s", buf);
-#endif
- res = send(ctxt->controlFd, buf, len, 0);
- if (res < 0) {
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- ctxt->controlFd = -1;
- return(res);
- }
- res = xmlNanoFTPGetResponse(ctxt);
- if (res == 2) {
- /* we assume it worked :-\ 1 is error for SITE command */
- proxyType = 1;
- break;
- }
- if (proxyType == 1) {
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- ctxt->controlFd = -1;
- return(-1);
- }
- case 2:
- /* USER user@host command */
- if (ctxt->user == NULL)
- snprintf(buf, sizeof(buf), "USER anonymous@%s\r\n",
- ctxt->hostname);
- else
- snprintf(buf, sizeof(buf), "USER %s@%s\r\n",
- ctxt->user, ctxt->hostname);
- buf[sizeof(buf) - 1] = 0;
- len = strlen(buf);
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "%s", buf);
-#endif
- res = send(ctxt->controlFd, buf, len, 0);
- if (res < 0) {
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- ctxt->controlFd = -1;
- return(res);
- }
- res = xmlNanoFTPGetResponse(ctxt);
- if ((res == 1) || (res == 2)) {
- /* we assume it worked :-\ */
- proxyType = 2;
- return(0);
- }
- if (ctxt->passwd == NULL)
- snprintf(buf, sizeof(buf), "PASS anonymous@\r\n");
- else
- snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd);
- buf[sizeof(buf) - 1] = 0;
- len = strlen(buf);
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "%s", buf);
-#endif
- res = send(ctxt->controlFd, buf, len, 0);
- if (res < 0) {
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- ctxt->controlFd = -1;
- return(res);
- }
- res = xmlNanoFTPGetResponse(ctxt);
- if ((res == 1) || (res == 2)) {
- /* we assume it worked :-\ */
- proxyType = 2;
- return(0);
- }
- if (proxyType == 2) {
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- ctxt->controlFd = -1;
- return(-1);
- }
- case 3:
- /*
- * If you need support for other Proxy authentication scheme
- * send the code or at least the sequence in use.
- */
- default:
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- ctxt->controlFd = -1;
- return(-1);
- }
- }
- /*
- * Non-proxy handling.
- */
- res = xmlNanoFTPSendUser(ctxt);
- if (res < 0) {
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- ctxt->controlFd = -1;
- return(-1);
- }
- res = xmlNanoFTPGetResponse(ctxt);
- switch (res) {
- case 2:
- return(0);
- case 3:
- break;
- case 1:
- case 4:
- case 5:
- case -1:
- default:
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- ctxt->controlFd = -1;
- return(-1);
- }
- res = xmlNanoFTPSendPasswd(ctxt);
- if (res < 0) {
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- ctxt->controlFd = -1;
- return(-1);
- }
- res = xmlNanoFTPGetResponse(ctxt);
- switch (res) {
- case 2:
- break;
- case 3:
- xmlGenericError(xmlGenericErrorContext,
- "FTP server asking for ACCNT on anonymous\n");
- case 1:
- case 4:
- case 5:
- case -1:
- default:
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- ctxt->controlFd = -1;
- return(-1);
- }
-
- return(0);
-}
-
-/**
- * xmlNanoFTPConnectTo:
- * @server: an FTP server name
- * @port: the port (use 21 if 0)
- *
- * Tries to open a control connection to the given server/port
- *
- * Returns an fTP context or NULL if it failed
- */
-
-void*
-xmlNanoFTPConnectTo(const char *server, int port) {
- xmlNanoFTPCtxtPtr ctxt;
- int res;
-
- xmlNanoFTPInit();
- if (server == NULL)
- return(NULL);
- ctxt = (xmlNanoFTPCtxtPtr) xmlNanoFTPNewCtxt(NULL);
- ctxt->hostname = xmlMemStrdup(server);
- if (port != 0)
- ctxt->port = port;
- res = xmlNanoFTPConnect(ctxt);
- if (res < 0) {
- xmlNanoFTPFreeCtxt(ctxt);
- return(NULL);
- }
- return(ctxt);
-}
-
-/**
- * xmlNanoFTPCwd:
- * @ctx: an FTP context
- * @directory: a directory on the server
- *
- * Tries to change the remote directory
- *
- * Returns -1 incase of error, 1 if CWD worked, 0 if it failed
- */
-
-int
-xmlNanoFTPCwd(void *ctx, char *directory) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- char buf[400];
- int len;
- int res;
-
- /*
- * Expected response code for CWD:
- *
- * CWD
- * 250
- * 500, 501, 502, 421, 530, 550
- */
- snprintf(buf, sizeof(buf), "CWD %s\r\n", directory);
- buf[sizeof(buf) - 1] = 0;
- len = strlen(buf);
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "%s", buf);
-#endif
- res = send(ctxt->controlFd, buf, len, 0);
- if (res < 0) return(res);
- res = xmlNanoFTPGetResponse(ctxt);
- if (res == 4) {
- return(-1);
- }
- if (res == 2) return(1);
- if (res == 5) {
- return(0);
- }
- return(0);
-}
-
-/**
- * xmlNanoFTPGetConnection:
- * @ctx: an FTP context
- *
- * Try to open a data connection to the server. Currently only
- * passive mode is supported.
- *
- * Returns -1 incase of error, 0 otherwise
- */
-
-int
-xmlNanoFTPGetConnection(void *ctx) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- char buf[200], *cur;
- int len, i;
- int res;
- unsigned char ad[6], *adp, *portp;
- unsigned int temp[6];
- struct sockaddr_in dataAddr;
- SOCKLEN_T dataAddrLen;
-
- ctxt->dataFd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
- if (ctxt->dataFd < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNanoFTPGetConnection: failed to create socket\n");
- return(-1);
- }
- dataAddrLen = sizeof(dataAddr);
- memset(&dataAddr, 0, dataAddrLen);
- dataAddr.sin_family = AF_INET;
-
- if (ctxt->passive) {
- snprintf(buf, sizeof(buf), "PASV\r\n");
- len = strlen(buf);
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "%s", buf);
-#endif
- res = send(ctxt->controlFd, buf, len, 0);
- if (res < 0) {
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return(res);
- }
- res = xmlNanoFTPReadResponse(ctx);
- if (res != 2) {
- if (res == 5) {
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return(-1);
- } else {
- /*
- * retry with an active connection
- */
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- ctxt->passive = 0;
- }
- }
- cur = &ctxt->controlBuf[ctxt->controlBufAnswer];
- while (((*cur < '0') || (*cur > '9')) && *cur != '\0') cur++;
- if (sscanf(cur, "%u,%u,%u,%u,%u,%u", &temp[0], &temp[1], &temp[2],
- &temp[3], &temp[4], &temp[5]) != 6) {
- xmlGenericError(xmlGenericErrorContext,
- "Invalid answer to PASV\n");
- if (ctxt->dataFd != -1) {
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- }
- return(-1);
- }
- for (i=0; i<6; i++) ad[i] = (unsigned char) (temp[i] & 0xff);
- memcpy(&dataAddr.sin_addr, &ad[0], 4);
- memcpy(&dataAddr.sin_port, &ad[4], 2);
- if (connect(ctxt->dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "Failed to create a data connection\n");
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return (-1);
- }
- } else {
- getsockname(ctxt->dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen);
- dataAddr.sin_port = 0;
- if (bind(ctxt->dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "Failed to bind a port\n");
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return (-1);
- }
- getsockname(ctxt->dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen);
-
- if (listen(ctxt->dataFd, 1) < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "Could not listen on port %d\n",
- ntohs(dataAddr.sin_port));
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return (-1);
- }
- adp = (unsigned char *) &dataAddr.sin_addr;
- portp = (unsigned char *) &dataAddr.sin_port;
- snprintf(buf, sizeof(buf), "PORT %d,%d,%d,%d,%d,%d\r\n",
- adp[0] & 0xff, adp[1] & 0xff, adp[2] & 0xff, adp[3] & 0xff,
- portp[0] & 0xff, portp[1] & 0xff);
- buf[sizeof(buf) - 1] = 0;
- len = strlen(buf);
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "%s", buf);
-#endif
-
- res = send(ctxt->controlFd, buf, len, 0);
- if (res < 0) {
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return(res);
- }
- res = xmlNanoFTPGetResponse(ctxt);
- if (res != 2) {
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return(-1);
- }
- }
- return(ctxt->dataFd);
-
-}
-
-/**
- * xmlNanoFTPCloseConnection:
- * @ctx: an FTP context
- *
- * Close the data connection from the server
- *
- * Returns -1 incase of error, 0 otherwise
- */
-
-int
-xmlNanoFTPCloseConnection(void *ctx) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- int res;
- fd_set rfd, efd;
- struct timeval tv;
-
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- tv.tv_sec = 15;
- tv.tv_usec = 0;
- FD_ZERO(&rfd);
- FD_SET(ctxt->controlFd, &rfd);
- FD_ZERO(&efd);
- FD_SET(ctxt->controlFd, &efd);
- res = select(ctxt->controlFd + 1, &rfd, NULL, &efd, &tv);
- if (res < 0) {
-#ifdef DEBUG_FTP
- perror("select");
-#endif
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- return(-1);
- }
- if (res == 0) {
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext,
- "xmlNanoFTPCloseConnection: timeout\n");
-#endif
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- } else {
- res = xmlNanoFTPGetResponse(ctxt);
- if (res != 2) {
- closesocket(ctxt->controlFd); ctxt->controlFd = -1;
- return(-1);
- }
- }
- return(0);
-}
-
-/**
- * xmlNanoFTPParseList:
- * @list: some data listing received from the server
- * @callback: the user callback
- * @userData: the user callback data
- *
- * Parse at most one entry from the listing.
- *
- * Returns -1 incase of error, the length of data parsed otherwise
- */
-
-static int
-xmlNanoFTPParseList(const char *list, ftpListCallback callback, void *userData) {
- const char *cur = list;
- char filename[151];
- char attrib[11];
- char owner[11];
- char group[11];
- char month[4];
- int year = 0;
- int minute = 0;
- int hour = 0;
- int day = 0;
- unsigned long size = 0;
- int links = 0;
- int i;
-
- if (!strncmp(cur, "total", 5)) {
- cur += 5;
- while (*cur == ' ') cur++;
- while ((*cur >= '0') && (*cur <= '9'))
- links = (links * 10) + (*cur++ - '0');
- while ((*cur == ' ') || (*cur == '\n') || (*cur == '\r'))
- cur++;
- return(cur - list);
- } else if (*list == '+') {
- return(0);
- } else {
- while ((*cur == ' ') || (*cur == '\n') || (*cur == '\r'))
- cur++;
- if (*cur == 0) return(0);
- i = 0;
- while (*cur != ' ') {
- if (i < 10)
- attrib[i++] = *cur;
- cur++;
- if (*cur == 0) return(0);
- }
- attrib[10] = 0;
- while (*cur == ' ') cur++;
- if (*cur == 0) return(0);
- while ((*cur >= '0') && (*cur <= '9'))
- links = (links * 10) + (*cur++ - '0');
- while (*cur == ' ') cur++;
- if (*cur == 0) return(0);
- i = 0;
- while (*cur != ' ') {
- if (i < 10)
- owner[i++] = *cur;
- cur++;
- if (*cur == 0) return(0);
- }
- owner[i] = 0;
- while (*cur == ' ') cur++;
- if (*cur == 0) return(0);
- i = 0;
- while (*cur != ' ') {
- if (i < 10)
- group[i++] = *cur;
- cur++;
- if (*cur == 0) return(0);
- }
- group[i] = 0;
- while (*cur == ' ') cur++;
- if (*cur == 0) return(0);
- while ((*cur >= '0') && (*cur <= '9'))
- size = (size * 10) + (*cur++ - '0');
- while (*cur == ' ') cur++;
- if (*cur == 0) return(0);
- i = 0;
- while (*cur != ' ') {
- if (i < 3)
- month[i++] = *cur;
- cur++;
- if (*cur == 0) return(0);
- }
- month[i] = 0;
- while (*cur == ' ') cur++;
- if (*cur == 0) return(0);
- while ((*cur >= '0') && (*cur <= '9'))
- day = (day * 10) + (*cur++ - '0');
- while (*cur == ' ') cur++;
- if (*cur == 0) return(0);
- if ((cur[1] == 0) || (cur[2] == 0)) return(0);
- if ((cur[1] == ':') || (cur[2] == ':')) {
- while ((*cur >= '0') && (*cur <= '9'))
- hour = (hour * 10) + (*cur++ - '0');
- if (*cur == ':') cur++;
- while ((*cur >= '0') && (*cur <= '9'))
- minute = (minute * 10) + (*cur++ - '0');
- } else {
- while ((*cur >= '0') && (*cur <= '9'))
- year = (year * 10) + (*cur++ - '0');
- }
- while (*cur == ' ') cur++;
- if (*cur == 0) return(0);
- i = 0;
- while ((*cur != '\n') && (*cur != '\r')) {
- if (i < 150)
- filename[i++] = *cur;
- cur++;
- if (*cur == 0) return(0);
- }
- filename[i] = 0;
- if ((*cur != '\n') && (*cur != '\r'))
- return(0);
- while ((*cur == '\n') || (*cur == '\r'))
- cur++;
- }
- if (callback != NULL) {
- callback(userData, filename, attrib, owner, group, size, links,
- year, month, day, hour, minute);
- }
- return(cur - list);
-}
-
-/**
- * xmlNanoFTPList:
- * @ctx: an FTP context
- * @callback: the user callback
- * @userData: the user callback data
- * @filename: optional files to list
- *
- * Do a listing on the server. All files info are passed back
- * in the callbacks.
- *
- * Returns -1 incase of error, 0 otherwise
- */
-
-int
-xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData,
- char *filename) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- char buf[4096 + 1];
- int len, res;
- int indx = 0, base;
- fd_set rfd, efd;
- struct timeval tv;
-
- if (filename == NULL) {
- if (xmlNanoFTPCwd(ctxt, ctxt->path) < 1)
- return(-1);
- ctxt->dataFd = xmlNanoFTPGetConnection(ctxt);
- if (ctxt->dataFd == -1)
- return(-1);
- snprintf(buf, sizeof(buf), "LIST -L\r\n");
- } else {
- if (filename[0] != '/') {
- if (xmlNanoFTPCwd(ctxt, ctxt->path) < 1)
- return(-1);
- }
- ctxt->dataFd = xmlNanoFTPGetConnection(ctxt);
- if (ctxt->dataFd == -1)
- return(-1);
- snprintf(buf, sizeof(buf), "LIST -L %s\r\n", filename);
- }
- buf[sizeof(buf) - 1] = 0;
- len = strlen(buf);
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "%s", buf);
-#endif
- res = send(ctxt->controlFd, buf, len, 0);
- if (res < 0) {
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return(res);
- }
- res = xmlNanoFTPReadResponse(ctxt);
- if (res != 1) {
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return(-res);
- }
-
- do {
- tv.tv_sec = 1;
- tv.tv_usec = 0;
- FD_ZERO(&rfd);
- FD_SET(ctxt->dataFd, &rfd);
- FD_ZERO(&efd);
- FD_SET(ctxt->dataFd, &efd);
- res = select(ctxt->dataFd + 1, &rfd, NULL, &efd, &tv);
- if (res < 0) {
-#ifdef DEBUG_FTP
- perror("select");
-#endif
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return(-1);
- }
- if (res == 0) {
- res = xmlNanoFTPCheckResponse(ctxt);
- if (res < 0) {
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- ctxt->dataFd = -1;
- return(-1);
- }
- if (res == 2) {
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return(0);
- }
-
- continue;
- }
-
- if ((len = recv(ctxt->dataFd, &buf[indx], sizeof(buf) - (indx + 1), 0)) < 0) {
-#ifdef DEBUG_FTP
- perror("recv");
-#endif
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- ctxt->dataFd = -1;
- return(-1);
- }
-#ifdef DEBUG_FTP
- write(1, &buf[indx], len);
-#endif
- indx += len;
- buf[indx] = 0;
- base = 0;
- do {
- res = xmlNanoFTPParseList(&buf[base], callback, userData);
- base += res;
- } while (res > 0);
-
- memmove(&buf[0], &buf[base], indx - base);
- indx -= base;
- } while (len != 0);
- xmlNanoFTPCloseConnection(ctxt);
- return(0);
-}
-
-/**
- * xmlNanoFTPGetSocket:
- * @ctx: an FTP context
- * @filename: the file to retrieve (or NULL if path is in context).
- *
- * Initiate fetch of the given file from the server.
- *
- * Returns the socket for the data connection, or <0 in case of error
- */
-
-
-int
-xmlNanoFTPGetSocket(void *ctx, const char *filename) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- char buf[300];
- int res, len;
- if ((filename == NULL) && (ctxt->path == NULL))
- return(-1);
- ctxt->dataFd = xmlNanoFTPGetConnection(ctxt);
- if (ctxt->dataFd == -1)
- return(-1);
-
- snprintf(buf, sizeof(buf), "TYPE I\r\n");
- len = strlen(buf);
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "%s", buf);
-#endif
- res = send(ctxt->controlFd, buf, len, 0);
- if (res < 0) {
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return(res);
- }
- res = xmlNanoFTPReadResponse(ctxt);
- if (res != 2) {
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return(-res);
- }
- if (filename == NULL)
- snprintf(buf, sizeof(buf), "RETR %s\r\n", ctxt->path);
- else
- snprintf(buf, sizeof(buf), "RETR %s\r\n", filename);
- buf[sizeof(buf) - 1] = 0;
- len = strlen(buf);
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "%s", buf);
-#endif
- res = send(ctxt->controlFd, buf, len, 0);
- if (res < 0) {
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return(res);
- }
- res = xmlNanoFTPReadResponse(ctxt);
- if (res != 1) {
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return(-res);
- }
- return(ctxt->dataFd);
-}
-
-/**
- * xmlNanoFTPGet:
- * @ctx: an FTP context
- * @callback: the user callback
- * @userData: the user callback data
- * @filename: the file to retrieve
- *
- * Fetch the given file from the server. All data are passed back
- * in the callbacks. The last callback has a size of 0 block.
- *
- * Returns -1 incase of error, 0 otherwise
- */
-
-int
-xmlNanoFTPGet(void *ctx, ftpDataCallback callback, void *userData,
- const char *filename) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
- char buf[4096];
- int len = 0, res;
- fd_set rfd;
- struct timeval tv;
-
- if ((filename == NULL) && (ctxt->path == NULL))
- return(-1);
- if (callback == NULL)
- return(-1);
- if (xmlNanoFTPGetSocket(ctxt, filename) < 0)
- return(-1);
-
- do {
- tv.tv_sec = 1;
- tv.tv_usec = 0;
- FD_ZERO(&rfd);
- FD_SET(ctxt->dataFd, &rfd);
- res = select(ctxt->dataFd + 1, &rfd, NULL, NULL, &tv);
- if (res < 0) {
-#ifdef DEBUG_FTP
- perror("select");
-#endif
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return(-1);
- }
- if (res == 0) {
- res = xmlNanoFTPCheckResponse(ctxt);
- if (res < 0) {
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- ctxt->dataFd = -1;
- return(-1);
- }
- if (res == 2) {
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return(0);
- }
-
- continue;
- }
- if ((len = recv(ctxt->dataFd, buf, sizeof(buf), 0)) < 0) {
- callback(userData, buf, len);
- closesocket(ctxt->dataFd); ctxt->dataFd = -1;
- return(-1);
- }
- callback(userData, buf, len);
- } while (len != 0);
-
- return(xmlNanoFTPCloseConnection(ctxt));
-}
-
-/**
- * xmlNanoFTPRead:
- * @ctx: the FTP context
- * @dest: a buffer
- * @len: the buffer length
- *
- * This function tries to read @len bytes from the existing FTP connection
- * and saves them in @dest. This is a blocking call.
- *
- * Returns the number of byte read. 0 is an indication of an end of connection.
- * -1 indicates a parameter error.
- */
-int
-xmlNanoFTPRead(void *ctx, void *dest, int len) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
-
- if (ctx == NULL) return(-1);
- if (ctxt->dataFd < 0) return(0);
- if (dest == NULL) return(-1);
- if (len <= 0) return(0);
-
- len = recv(ctxt->dataFd, dest, len, 0);
-#ifdef DEBUG_FTP
- xmlGenericError(xmlGenericErrorContext, "Recvd %d bytes\n", len);
-#endif
- if (len <= 0) {
- xmlNanoFTPCloseConnection(ctxt);
- }
- return(len);
-}
-
-/**
- * xmlNanoFTPOpen:
- * @URL: the URL to the resource
- *
- * Start to fetch the given ftp:// resource
- *
- * Returns an FTP context, or NULL
- */
-
-void*
-xmlNanoFTPOpen(const char *URL) {
- xmlNanoFTPCtxtPtr ctxt;
- int sock;
-
- xmlNanoFTPInit();
- if (URL == NULL) return(NULL);
- if (strncmp("ftp://", URL, 6)) return(NULL);
-
- ctxt = (xmlNanoFTPCtxtPtr) xmlNanoFTPNewCtxt(URL);
- if (ctxt == NULL) return(NULL);
- if (xmlNanoFTPConnect(ctxt) < 0) {
- xmlNanoFTPFreeCtxt(ctxt);
- return(NULL);
- }
- sock = xmlNanoFTPGetSocket(ctxt, ctxt->path);
- if (sock < 0) {
- xmlNanoFTPFreeCtxt(ctxt);
- return(NULL);
- }
- return(ctxt);
-}
-
-/**
- * xmlNanoFTPClose:
- * @ctx: an FTP context
- *
- * Close the connection and both control and transport
- *
- * Returns -1 incase of error, 0 otherwise
- */
-
-int
-xmlNanoFTPClose(void *ctx) {
- xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
-
- if (ctxt == NULL)
- return(-1);
-
- if (ctxt->dataFd >= 0) {
- closesocket(ctxt->dataFd);
- ctxt->dataFd = -1;
- }
- if (ctxt->controlFd >= 0) {
- xmlNanoFTPQuit(ctxt);
- closesocket(ctxt->controlFd);
- ctxt->controlFd = -1;
- }
- xmlNanoFTPFreeCtxt(ctxt);
- return(0);
-}
-
-#ifdef STANDALONE
-/************************************************************************
- * *
- * Basic test in Standalone mode *
- * *
- ************************************************************************/
-static
-void ftpList(void *userData, const char *filename, const char* attrib,
- const char *owner, const char *group, unsigned long size, int links,
- int year, const char *month, int day, int hour, int minute) {
- xmlGenericError(xmlGenericErrorContext,
- "%s %s %s %ld %s\n", attrib, owner, group, size, filename);
-}
-static
-void ftpData(void *userData, const char *data, int len) {
- if (userData == NULL) return;
- if (len <= 0) {
- fclose(userData);
- return;
- }
- fwrite(data, len, 1, userData);
-}
-
-int main(int argc, char **argv) {
- void *ctxt;
- FILE *output;
- char *tstfile = NULL;
-
- xmlNanoFTPInit();
- if (argc > 1) {
- ctxt = xmlNanoFTPNewCtxt(argv[1]);
- if (xmlNanoFTPConnect(ctxt) < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "Couldn't connect to %s\n", argv[1]);
- exit(1);
- }
- if (argc > 2)
- tstfile = argv[2];
- } else
- ctxt = xmlNanoFTPConnectTo("localhost", 0);
- if (ctxt == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Couldn't connect to localhost\n");
- exit(1);
- }
- xmlNanoFTPList(ctxt, ftpList, NULL, tstfile);
- output = fopen("/tmp/tstdata", "w");
- if (output != NULL) {
- if (xmlNanoFTPGet(ctxt, ftpData, (void *) output, tstfile) < 0)
- xmlGenericError(xmlGenericErrorContext,
- "Failed to get file\n");
-
- }
- xmlNanoFTPClose(ctxt);
- xmlMemoryDump();
- exit(0);
-}
-#endif /* STANDALONE */
-#else /* !LIBXML_FTP_ENABLED */
-#ifdef STANDALONE
-#include <stdio.h>
-int main(int argc, char **argv) {
- xmlGenericError(xmlGenericErrorContext,
- "%s : FTP support not compiled in\n", argv[0]);
- return(0);
-}
-#endif /* STANDALONE */
-#endif /* LIBXML_FTP_ENABLED */
diff --git a/bundle/libxml/nanohttp.c b/bundle/libxml/nanohttp.c
deleted file mode 100644
index 5a126b8868..0000000000
--- a/bundle/libxml/nanohttp.c
+++ /dev/null
@@ -1,1528 +0,0 @@
-/*
- * nanohttp.c: minimalist HTTP GET implementation to fetch external subsets.
- * focuses on size, streamability, reentrancy and portability
- *
- * This is clearly not a general purpose HTTP implementation
- * If you look for one, check:
- * http://www.w3.org/Library/
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-/* TODO add compression support, Send the Accept- , and decompress on the
- fly with ZLIB if found at compile-time */
-
-#define NEED_SOCKETS
-#define IN_LIBXML
-#include "libxml.h"
-/* Hack to get compilation to work -SH */
-#include <errno.h>
-
-#ifdef LIBXML_HTTP_ENABLED
-#include <string.h>
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_RESOLV_H
-#ifdef HAVE_ARPA_NAMESER_H
-#include <arpa/nameser.h>
-#endif
-#include <resolv.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#ifdef SUPPORT_IP6
-#include <resolv.h>
-#endif
-
-#ifdef VMS
-#include <stropts>
-#define SOCKLEN_T unsigned int
-#define SOCKET int
-#endif
-
-#include <libxml/globals.h>
-#include <libxml/xmlerror.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h> /* for xmlStr(n)casecmp() */
-#include <libxml/nanohttp.h>
-#include <libxml/globals.h>
-#include <libxml/uri.h>
-
-/**
- * A couple portability macros
- */
-#ifndef _WINSOCKAPI_
-#define closesocket(s) close(s)
-#define SOCKET int
-#endif
-
-#ifndef SOCKLEN_T
-#define SOCKLEN_T unsigned int
-#endif
-#ifndef SOCKET
-#define SOCKET int
-#endif
-
-#ifdef STANDALONE
-#define DEBUG_HTTP
-#define xmlStrncasecmp(a, b, n) strncasecmp((char *)a, (char *)b, n)
-#define xmlStrcasecmpi(a, b) strcasecmp((char *)a, (char *)b)
-#endif
-
-#define XML_NANO_HTTP_MAX_REDIR 10
-
-#define XML_NANO_HTTP_CHUNK 4096
-
-#define XML_NANO_HTTP_CLOSED 0
-#define XML_NANO_HTTP_WRITE 1
-#define XML_NANO_HTTP_READ 2
-#define XML_NANO_HTTP_NONE 4
-
-typedef struct xmlNanoHTTPCtxt {
- char *protocol; /* the protocol name */
- char *hostname; /* the host name */
- int port; /* the port */
- char *path; /* the path within the URL */
- SOCKET fd; /* the file descriptor for the socket */
- int state; /* WRITE / READ / CLOSED */
- char *out; /* buffer sent (zero terminated) */
- char *outptr; /* index within the buffer sent */
- char *in; /* the receiving buffer */
- char *content; /* the start of the content */
- char *inptr; /* the next byte to read from network */
- char *inrptr; /* the next byte to give back to the client */
- int inlen; /* len of the input buffer */
- int last; /* return code for last operation */
- int returnValue; /* the protocol return value */
- int ContentLength; /* specified content length from HTTP header */
- char *contentType; /* the MIME type for the input */
- char *location; /* the new URL in case of redirect */
- char *authHeader; /* contents of {WWW,Proxy}-Authenticate header */
-} xmlNanoHTTPCtxt, *xmlNanoHTTPCtxtPtr;
-
-static int initialized = 0;
-static char *proxy = NULL; /* the proxy name if any */
-static int proxyPort; /* the proxy port if any */
-static unsigned int timeout = 60;/* the select() timeout in seconds */
-
-int xmlNanoHTTPFetchContent( void * ctx, char ** ptr, int * len );
-int xmlNanoHTTPContentLength( void * ctx );
-
-/**
- * A portability function
- */
-static int socket_errno(void) {
-#ifdef _WINSOCKAPI_
- return(WSAGetLastError());
-#else
- return(errno);
-#endif
-}
-
-/**
- * xmlNanoHTTPInit:
- *
- * Initialize the HTTP protocol layer.
- * Currently it just checks for proxy informations
- */
-
-void
-xmlNanoHTTPInit(void) {
- const char *env;
-#ifdef _WINSOCKAPI_
- WSADATA wsaData;
-#endif
-
- if (initialized)
- return;
-
-#ifdef _WINSOCKAPI_
- if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0)
- return;
-#endif
-
- if (proxy == NULL) {
- proxyPort = 80;
- env = getenv("no_proxy");
- if (env != NULL)
- goto done;
- env = getenv("http_proxy");
- if (env != NULL) {
- xmlNanoHTTPScanProxy(env);
- goto done;
- }
- env = getenv("HTTP_PROXY");
- if (env != NULL) {
- xmlNanoHTTPScanProxy(env);
- goto done;
- }
- }
-done:
- initialized = 1;
-}
-
-/**
- * xmlNanoHTTPCleanup:
- *
- * Cleanup the HTTP protocol layer.
- */
-
-void
-xmlNanoHTTPCleanup(void) {
- if (proxy != NULL)
- xmlFree(proxy);
-#ifdef _WINSOCKAPI_
- if (initialized)
- WSACleanup();
-#endif
- initialized = 0;
- return;
-}
-
-/**
- * xmlNanoHTTPScanURL:
- * @ctxt: an HTTP context
- * @URL: The URL used to initialize the context
- *
- * (Re)Initialize an HTTP context by parsing the URL and finding
- * the protocol host port and path it indicates.
- */
-
-static void
-xmlNanoHTTPScanURL(xmlNanoHTTPCtxtPtr ctxt, const char *URL) {
- const char *cur = URL;
- char buf[4096];
- int indx = 0;
- int port = 0;
-
- if (ctxt->protocol != NULL) {
- xmlFree(ctxt->protocol);
- ctxt->protocol = NULL;
- }
- if (ctxt->hostname != NULL) {
- xmlFree(ctxt->hostname);
- ctxt->hostname = NULL;
- }
- if (ctxt->path != NULL) {
- xmlFree(ctxt->path);
- ctxt->path = NULL;
- }
- if (URL == NULL) return;
- buf[indx] = 0;
- while (*cur != 0) {
- if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
- buf[indx] = 0;
- ctxt->protocol = xmlMemStrdup(buf);
- indx = 0;
- cur += 3;
- break;
- }
- buf[indx++] = *cur++;
- }
- if (*cur == 0) return;
-
- buf[indx] = 0;
- while (1) {
- if (cur[0] == ':') {
- buf[indx] = 0;
- ctxt->hostname = xmlMemStrdup(buf);
- indx = 0;
- cur += 1;
- while ((*cur >= '0') && (*cur <= '9')) {
- port *= 10;
- port += *cur - '0';
- cur++;
- }
- if (port != 0) ctxt->port = port;
- while ((cur[0] != '/') && (*cur != 0))
- cur++;
- break;
- }
- if ((*cur == '/') || (*cur == 0)) {
- buf[indx] = 0;
- ctxt->hostname = xmlMemStrdup(buf);
- indx = 0;
- break;
- }
- buf[indx++] = *cur++;
- }
- if (*cur == 0)
- ctxt->path = xmlMemStrdup("/");
- else {
- indx = 0;
- buf[indx] = 0;
- while (*cur != 0)
- buf[indx++] = *cur++;
- buf[indx] = 0;
- ctxt->path = xmlMemStrdup(buf);
- }
-}
-
-/**
- * xmlNanoHTTPScanProxy:
- * @URL: The proxy URL used to initialize the proxy context
- *
- * (Re)Initialize the HTTP Proxy context by parsing the URL and finding
- * the protocol host port it indicates.
- * Should be like http://myproxy/ or http://myproxy:3128/
- * A NULL URL cleans up proxy informations.
- */
-
-void
-xmlNanoHTTPScanProxy(const char *URL) {
- const char *cur = URL;
- char buf[4096];
- int indx = 0;
- int port = 0;
-
- if (proxy != NULL) {
- xmlFree(proxy);
- proxy = NULL;
- }
- if (proxyPort != 0) {
- proxyPort = 0;
- }
-#ifdef DEBUG_HTTP
- if (URL == NULL)
- xmlGenericError(xmlGenericErrorContext,
- "Removing HTTP proxy info\n");
- else
- xmlGenericError(xmlGenericErrorContext,
- "Using HTTP proxy %s\n", URL);
-#endif
- if (URL == NULL) return;
- buf[indx] = 0;
- while (*cur != 0) {
- if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
- buf[indx] = 0;
- indx = 0;
- cur += 3;
- break;
- }
- buf[indx++] = *cur++;
- }
- if (*cur == 0) return;
-
- buf[indx] = 0;
- while (1) {
- if (cur[0] == ':') {
- buf[indx] = 0;
- proxy = xmlMemStrdup(buf);
- indx = 0;
- cur += 1;
- while ((*cur >= '0') && (*cur <= '9')) {
- port *= 10;
- port += *cur - '0';
- cur++;
- }
- if (port != 0) proxyPort = port;
- while ((cur[0] != '/') && (*cur != 0))
- cur++;
- break;
- }
- if ((*cur == '/') || (*cur == 0)) {
- buf[indx] = 0;
- proxy = xmlMemStrdup(buf);
- indx = 0;
- break;
- }
- buf[indx++] = *cur++;
- }
-}
-
-/**
- * xmlNanoHTTPNewCtxt:
- * @URL: The URL used to initialize the context
- *
- * Allocate and initialize a new HTTP context.
- *
- * Returns an HTTP context or NULL in case of error.
- */
-
-static xmlNanoHTTPCtxtPtr
-xmlNanoHTTPNewCtxt(const char *URL) {
- xmlNanoHTTPCtxtPtr ret;
- xmlChar *escaped;
-
- ret = (xmlNanoHTTPCtxtPtr) xmlMalloc(sizeof(xmlNanoHTTPCtxt));
- if (ret == NULL) return(NULL);
-
- memset(ret, 0, sizeof(xmlNanoHTTPCtxt));
- ret->port = 80;
- ret->returnValue = 0;
- ret->fd = -1;
- ret->ContentLength = -1;
-
- escaped = xmlURIEscapeStr(BAD_CAST URL, BAD_CAST"@/:=?;#%&");
- if (escaped != NULL) {
- xmlNanoHTTPScanURL(ret, (const char *) escaped);
- xmlFree(escaped);
- } else {
- xmlNanoHTTPScanURL(ret, URL);
- }
-
- return(ret);
-}
-
-/**
- * xmlNanoHTTPFreeCtxt:
- * @ctxt: an HTTP context
- *
- * Frees the context after closing the connection.
- */
-
-static void
-xmlNanoHTTPFreeCtxt(xmlNanoHTTPCtxtPtr ctxt) {
- if (ctxt == NULL) return;
- if (ctxt->hostname != NULL) xmlFree(ctxt->hostname);
- if (ctxt->protocol != NULL) xmlFree(ctxt->protocol);
- if (ctxt->path != NULL) xmlFree(ctxt->path);
- if (ctxt->out != NULL) xmlFree(ctxt->out);
- if (ctxt->in != NULL) xmlFree(ctxt->in);
- if (ctxt->contentType != NULL) xmlFree(ctxt->contentType);
- if (ctxt->location != NULL) xmlFree(ctxt->location);
- if (ctxt->authHeader != NULL) xmlFree(ctxt->authHeader);
- ctxt->state = XML_NANO_HTTP_NONE;
- if (ctxt->fd >= 0) closesocket(ctxt->fd);
- ctxt->fd = -1;
- xmlFree(ctxt);
-}
-
-/**
- * xmlNanoHTTPSend:
- * @ctxt: an HTTP context
- *
- * Send the input needed to initiate the processing on the server side
- * Returns number of bytes sent or -1 on error.
- */
-
-static int
-xmlNanoHTTPSend(xmlNanoHTTPCtxtPtr ctxt, const char * xmt_ptr, int outlen) {
-
- int total_sent = 0;
-
- if ( (ctxt->state & XML_NANO_HTTP_WRITE) && (xmt_ptr != NULL ) ) {
- while (total_sent < outlen) {
- int nsent = send(ctxt->fd, xmt_ptr + total_sent,
- outlen - total_sent, 0);
- if (nsent>0)
- total_sent += nsent;
- else if ( ( nsent == -1 ) &&
-#if defined(EAGAIN) && EAGAIN != EWOULDBLOCK
- ( socket_errno( ) != EAGAIN ) &&
-#endif
- ( socket_errno( ) != EWOULDBLOCK ) ) {
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPSend error: %s",
- strerror( socket_errno( ) ) );
-
- if ( total_sent == 0 )
- total_sent = -1;
- break;
- }
- else {
- /*
- ** No data sent
- ** Since non-blocking sockets are used, wait for
- ** socket to be writable or default timeout prior
- ** to retrying.
- */
-
- struct timeval tv;
- fd_set wfd;
-
- tv.tv_sec = timeout;
- tv.tv_usec = 0;
- FD_ZERO( &wfd );
- FD_SET( ctxt->fd, &wfd );
- (void)select( ctxt->fd + 1, NULL, &wfd, NULL, &tv );
- }
- }
- }
-
- return total_sent;
-}
-
-/**
- * xmlNanoHTTPRecv:
- * @ctxt: an HTTP context
- *
- * Read information coming from the HTTP connection.
- * This is a blocking call (but it blocks in select(), not read()).
- *
- * Returns the number of byte read or -1 in case of error.
- */
-
-static int
-xmlNanoHTTPRecv(xmlNanoHTTPCtxtPtr ctxt) {
- fd_set rfd;
- struct timeval tv;
-
-
- while (ctxt->state & XML_NANO_HTTP_READ) {
- if (ctxt->in == NULL) {
- ctxt->in = (char *) xmlMalloc(65000 * sizeof(char));
- if (ctxt->in == NULL) {
- ctxt->last = -1;
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPRecv: Error allocating input memory." );
- return(-1);
- }
- ctxt->inlen = 65000;
- ctxt->inptr = ctxt->content = ctxt->inrptr = ctxt->in;
- }
- if (ctxt->inrptr > ctxt->in + XML_NANO_HTTP_CHUNK) {
- int delta = ctxt->inrptr - ctxt->in;
- int len = ctxt->inptr - ctxt->inrptr;
-
- memmove(ctxt->in, ctxt->inrptr, len);
- ctxt->inrptr -= delta;
- ctxt->content -= delta;
- ctxt->inptr -= delta;
- }
- if ((ctxt->in + ctxt->inlen) < (ctxt->inptr + XML_NANO_HTTP_CHUNK)) {
- int d_inptr = ctxt->inptr - ctxt->in;
- int d_content = ctxt->content - ctxt->in;
- int d_inrptr = ctxt->inrptr - ctxt->in;
- char * tmp_ptr = ctxt->in;
-
- ctxt->inlen *= 2;
- ctxt->in = (char *) xmlRealloc(tmp_ptr, ctxt->inlen);
- if (ctxt->in == NULL) {
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPRecv: %s %d bytes.",
- "Failed to realloc input buffer to",
- ctxt->inlen );
- xmlFree( tmp_ptr );
- ctxt->last = -1;
- return(-1);
- }
- ctxt->inptr = ctxt->in + d_inptr;
- ctxt->content = ctxt->in + d_content;
- ctxt->inrptr = ctxt->in + d_inrptr;
- }
- ctxt->last = recv(ctxt->fd, ctxt->inptr, XML_NANO_HTTP_CHUNK, 0);
- if (ctxt->last > 0) {
- ctxt->inptr += ctxt->last;
- return(ctxt->last);
- }
- if (ctxt->last == 0) {
- return(0);
- }
- if (ctxt->last == -1) {
- switch (socket_errno()) {
- case EINPROGRESS:
- case EWOULDBLOCK:
-#if defined(EAGAIN) && EAGAIN != EWOULDBLOCK
- case EAGAIN:
-#endif
- break;
-
- case ECONNRESET:
- case ESHUTDOWN:
- return ( 0 );
-
- default:
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPRecv: recv( ) failure - %s",
- strerror( socket_errno( ) ) );
- return(-1);
- }
- }
-
- tv.tv_sec = timeout;
- tv.tv_usec = 0;
- FD_ZERO(&rfd);
- FD_SET(ctxt->fd, &rfd);
-
- if ( (select(ctxt->fd+1, &rfd, NULL, NULL, &tv)<1)
-#if defined(EINTR)
- && (errno != EINTR)
-#endif
- )
- return(0);
- }
- return(0);
-}
-
-/**
- * xmlNanoHTTPReadLine:
- * @ctxt: an HTTP context
- *
- * Read one line in the HTTP server output, usually for extracting
- * the HTTP protocol informations from the answer header.
- *
- * Returns a newly allocated string with a copy of the line, or NULL
- * which indicate the end of the input.
- */
-
-static char *
-xmlNanoHTTPReadLine(xmlNanoHTTPCtxtPtr ctxt) {
- char buf[4096];
- char *bp = buf;
- int rc;
-
- while (bp - buf < 4095) {
- if (ctxt->inrptr == ctxt->inptr) {
- if ( (rc = xmlNanoHTTPRecv(ctxt)) == 0) {
- if (bp == buf)
- return(NULL);
- else
- *bp = 0;
- return(xmlMemStrdup(buf));
- }
- else if ( rc == -1 ) {
- return ( NULL );
- }
- }
- *bp = *ctxt->inrptr++;
- if (*bp == '\n') {
- *bp = 0;
- return(xmlMemStrdup(buf));
- }
- if (*bp != '\r')
- bp++;
- }
- buf[4095] = 0;
- return(xmlMemStrdup(buf));
-}
-
-
-/**
- * xmlNanoHTTPScanAnswer:
- * @ctxt: an HTTP context
- * @line: an HTTP header line
- *
- * Try to extract useful informations from the server answer.
- * We currently parse and process:
- * - The HTTP revision/ return code
- * - The Content-Type
- * - The Location for redirect processing.
- *
- * Returns -1 in case of failure, the file descriptor number otherwise
- */
-
-static void
-xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) {
- const char *cur = line;
-
- if (line == NULL) return;
-
- if (!strncmp(line, "HTTP/", 5)) {
- int version = 0;
- int ret = 0;
-
- cur += 5;
- while ((*cur >= '0') && (*cur <= '9')) {
- version *= 10;
- version += *cur - '0';
- cur++;
- }
- if (*cur == '.') {
- cur++;
- if ((*cur >= '0') && (*cur <= '9')) {
- version *= 10;
- version += *cur - '0';
- cur++;
- }
- while ((*cur >= '0') && (*cur <= '9'))
- cur++;
- } else
- version *= 10;
- if ((*cur != ' ') && (*cur != '\t')) return;
- while ((*cur == ' ') || (*cur == '\t')) cur++;
- if ((*cur < '0') || (*cur > '9')) return;
- while ((*cur >= '0') && (*cur <= '9')) {
- ret *= 10;
- ret += *cur - '0';
- cur++;
- }
- if ((*cur != 0) && (*cur != ' ') && (*cur != '\t')) return;
- ctxt->returnValue = ret;
- } else if (!xmlStrncasecmp(BAD_CAST line, BAD_CAST"Content-Type:", 13)) {
- cur += 13;
- while ((*cur == ' ') || (*cur == '\t')) cur++;
- if (ctxt->contentType != NULL)
- xmlFree(ctxt->contentType);
- ctxt->contentType = xmlMemStrdup(cur);
- } else if (!xmlStrncasecmp(BAD_CAST line, BAD_CAST"ContentType:", 12)) {
- cur += 12;
- if (ctxt->contentType != NULL) return;
- while ((*cur == ' ') || (*cur == '\t')) cur++;
- ctxt->contentType = xmlMemStrdup(cur);
- } else if (!xmlStrncasecmp(BAD_CAST line, BAD_CAST"Location:", 9)) {
- cur += 9;
- while ((*cur == ' ') || (*cur == '\t')) cur++;
- if (ctxt->location != NULL)
- xmlFree(ctxt->location);
- ctxt->location = xmlMemStrdup(cur);
- } else if (!xmlStrncasecmp(BAD_CAST line, BAD_CAST"WWW-Authenticate:", 17)) {
- cur += 17;
- while ((*cur == ' ') || (*cur == '\t')) cur++;
- if (ctxt->authHeader != NULL)
- xmlFree(ctxt->authHeader);
- ctxt->authHeader = xmlMemStrdup(cur);
- } else if (!xmlStrncasecmp(BAD_CAST line, BAD_CAST"Proxy-Authenticate:", 19)) {
- cur += 19;
- while ((*cur == ' ') || (*cur == '\t')) cur++;
- if (ctxt->authHeader != NULL)
- xmlFree(ctxt->authHeader);
- ctxt->authHeader = xmlMemStrdup(cur);
- } else if ( !xmlStrncasecmp( BAD_CAST line, BAD_CAST"Content-Length:", 15) ) {
- cur += 15;
- ctxt->ContentLength = strtol( cur, NULL, 10 );
- }
-}
-
-/**
- * xmlNanoHTTPConnectAttempt:
- * @addr: a socket address structure
- *
- * Attempt a connection to the given IP:port endpoint. It forces
- * non-blocking semantic on the socket, and allow 60 seconds for
- * the host to answer.
- *
- * Returns -1 in case of failure, the file descriptor number otherwise
- */
-
-static int
-xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
-{
- SOCKET s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
- fd_set wfd;
- struct timeval tv;
- int status;
-
- if (s==-1) {
-#ifdef DEBUG_HTTP
- perror("socket");
-#endif
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPConnectAttempt: %s - %s",
- "socket creation failure",
- strerror( socket_errno( ) ) );
- return(-1);
- }
-
-#ifdef _WINSOCKAPI_
- {
- u_long one = 1;
-
- status = ioctlsocket(s, FIONBIO, &one) == SOCKET_ERROR ? -1 : 0;
- }
-#else /* _WINSOCKAPI_ */
-#if defined(VMS)
- {
- int enable = 1;
- status = ioctl(s, FIONBIO, &enable);
- }
-#else /* VMS */
- if ((status = fcntl(s, F_GETFL, 0)) != -1) {
-#ifdef O_NONBLOCK
- status |= O_NONBLOCK;
-#else /* O_NONBLOCK */
-#ifdef F_NDELAY
- status |= F_NDELAY;
-#endif /* F_NDELAY */
-#endif /* !O_NONBLOCK */
- status = fcntl(s, F_SETFL, status);
- }
- if (status < 0) {
-#ifdef DEBUG_HTTP
- perror("nonblocking");
-#endif
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPConnectAttempt: %s - %s",
- "error setting non-blocking IO",
- strerror( socket_errno( ) ) );
- closesocket(s);
- return(-1);
- }
-#endif /* !VMS */
-#endif /* !_WINSOCKAPI_ */
-
- if ((connect(s, addr, sizeof(*addr))==-1)) {
- switch (socket_errno()) {
- case EINPROGRESS:
- case EWOULDBLOCK:
- break;
- default:
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPConnectAttempt: %s - %s",
- "error connecting to HTTP server",
- strerror( socket_errno( ) ) );
- closesocket(s);
- return(-1);
- }
- }
-
- tv.tv_sec = timeout;
- tv.tv_usec = 0;
-
- FD_ZERO(&wfd);
- FD_SET(s, &wfd);
-
- switch(select(s+1, NULL, &wfd, NULL, &tv))
- {
- case 0:
- /* Time out */
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPConnectAttempt: %s",
- "Connect attempt timed out." );
- closesocket(s);
- return(-1);
- case -1:
- /* Ermm.. ?? */
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPConnectAttempt: %s - %s",
- "Error connecting to host",
- strerror( socket_errno( ) ) );
- closesocket(s);
- return(-1);
- }
-
- if ( FD_ISSET(s, &wfd) ) {
- SOCKLEN_T len;
- len = sizeof(status);
- if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char*)&status, &len) < 0 ) {
- /* Solaris error code */
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPConnectAttempt: %s - %s",
- "Error retrieving pending socket errors",
- strerror( socket_errno( ) ) );
- return (-1);
- }
- if ( status ) {
- closesocket(s);
- errno = status;
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPConnectAttempt: %s - %s",
- "Error connecting to remote host",
- strerror( status ) );
- return (-1);
- }
- } else {
- /* pbm */
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPConnectAttempt: %s\n",
- "Select returned, but descriptor not set for connection.\n" );
- closesocket(s);
- return (-1);
- }
-
- return(s);
-}
-
-/**
- * xmlNanoHTTPConnectHost:
- * @host: the host name
- * @port: the port number
- *
- * Attempt a connection to the given host:port endpoint. It tries
- * the multiple IP provided by the DNS if available.
- *
- * Returns -1 in case of failure, the file descriptor number otherwise
- */
-
-static int
-xmlNanoHTTPConnectHost(const char *host, int port)
-{
- struct hostent *h;
- struct sockaddr *addr;
- struct in_addr ia;
- struct sockaddr_in sockin;
-
-#ifdef SUPPORT_IP6
- struct in6_addr ia6;
- struct sockaddr_in6 sockin6;
-#endif
- int i;
- int s;
-
-#if defined(SUPPORT_IP6) && defined(RES_USE_INET6)
- if (!(_res.options & RES_INIT))
- res_init();
- _res.options |= RES_USE_INET6;
-#endif
- h = gethostbyname(host);
- if (h == NULL) {
-
-/*
- * Okay, I got fed up by the non-portability of this error message
- * extraction code. it work on Linux, if it work on your platform
- * and one want to enable it, send me the defined(foobar) needed
- */
-#if defined(HAVE_NETDB_H) && defined(HOST_NOT_FOUND) && defined(linux)
- const char *h_err_txt = "";
-
- switch (h_errno) {
- case HOST_NOT_FOUND:
- h_err_txt = "Authoritive host not found";
- break;
-
- case TRY_AGAIN:
- h_err_txt =
- "Non-authoritive host not found or server failure.";
- break;
-
- case NO_RECOVERY:
- h_err_txt =
- "Non-recoverable errors: FORMERR, REFUSED, or NOTIMP.";
- break;
-
- case NO_ADDRESS:
- h_err_txt =
- "Valid name, no data record of requested type.";
- break;
-
- default:
- h_err_txt = "No error text defined.";
- break;
- }
- xmlGenericError(xmlGenericErrorContext,
- "xmlNanoHTTPConnectHost: %s '%s' - %s",
- "Failed to resolve host", host, h_err_txt);
-#else
- xmlGenericError(xmlGenericErrorContext,
- "xmlNanoHTTPConnectHost: %s '%s'",
- "Failed to resolve host", host);
-#endif
- return (-1);
- }
-
- for (i = 0; h->h_addr_list[i]; i++) {
- if (h->h_addrtype == AF_INET) {
- /* A records (IPv4) */
- memcpy(&ia, h->h_addr_list[i], h->h_length);
- sockin.sin_family = h->h_addrtype;
- sockin.sin_addr = ia;
- sockin.sin_port = htons(port);
- addr = (struct sockaddr *) &sockin;
-#ifdef SUPPORT_IP6
- } else if (h->h_addrtype == AF_INET6) {
- /* AAAA records (IPv6) */
- memcpy(&ia6, h->h_addr_list[i], h->h_length);
- sockin6.sin_family = h->h_addrtype;
- sockin6.sin_addr = ia6;
- sockin6.sin_port = htons(port);
- addr = (struct sockaddr *) &sockin6;
-#endif
- } else
- break; /* for */
-
- s = xmlNanoHTTPConnectAttempt(addr);
- if (s != -1)
- return (s);
- }
-
-#ifdef DEBUG_HTTP
- xmlGenericError(xmlGenericErrorContext,
- "xmlNanoHTTPConnectHost: unable to connect to '%s'.\n",
- host);
-#endif
- return (-1);
-}
-
-
-/**
- * xmlNanoHTTPOpen:
- * @URL: The URL to load
- * @contentType: if available the Content-Type information will be
- * returned at that location
- *
- * This function try to open a connection to the indicated resource
- * via HTTP GET.
- *
- * Returns NULL in case of failure, otherwise a request handler.
- * The contentType, if provided must be freed by the caller
- */
-
-void*
-xmlNanoHTTPOpen(const char *URL, char **contentType) {
- if (contentType != NULL) *contentType = NULL;
- return(xmlNanoHTTPMethod(URL, NULL, NULL, contentType, NULL, 0));
-}
-
-/**
- * xmlNanoHTTPOpenRedir:
- * @URL: The URL to load
- * @contentType: if available the Content-Type information will be
- * returned at that location
- * @redir: if available the redirected URL will be returned
- *
- * This function try to open a connection to the indicated resource
- * via HTTP GET.
- *
- * Returns NULL in case of failure, otherwise a request handler.
- * The contentType, if provided must be freed by the caller
- */
-
-void*
-xmlNanoHTTPOpenRedir(const char *URL, char **contentType, char **redir) {
- if (contentType != NULL) *contentType = NULL;
- if (redir != NULL) *redir = NULL;
- return(xmlNanoHTTPMethodRedir(URL, NULL, NULL, contentType, redir, NULL,0));
-}
-
-/**
- * xmlNanoHTTPRead:
- * @ctx: the HTTP context
- * @dest: a buffer
- * @len: the buffer length
- *
- * This function tries to read @len bytes from the existing HTTP connection
- * and saves them in @dest. This is a blocking call.
- *
- * Returns the number of byte read. 0 is an indication of an end of connection.
- * -1 indicates a parameter error.
- */
-int
-xmlNanoHTTPRead(void *ctx, void *dest, int len) {
- xmlNanoHTTPCtxtPtr ctxt = (xmlNanoHTTPCtxtPtr) ctx;
-
- if (ctx == NULL) return(-1);
- if (dest == NULL) return(-1);
- if (len <= 0) return(0);
-
- while (ctxt->inptr - ctxt->inrptr < len) {
- if (xmlNanoHTTPRecv(ctxt) <= 0) break;
- }
- if (ctxt->inptr - ctxt->inrptr < len)
- len = ctxt->inptr - ctxt->inrptr;
- memcpy(dest, ctxt->inrptr, len);
- ctxt->inrptr += len;
- return(len);
-}
-
-/**
- * xmlNanoHTTPClose:
- * @ctx: the HTTP context
- *
- * This function closes an HTTP context, it ends up the connection and
- * free all data related to it.
- */
-void
-xmlNanoHTTPClose(void *ctx) {
- xmlNanoHTTPCtxtPtr ctxt = (xmlNanoHTTPCtxtPtr) ctx;
-
- if (ctx == NULL) return;
-
- xmlNanoHTTPFreeCtxt(ctxt);
-}
-
-/**
- * xmlNanoHTTPMethodRedir:
- * @URL: The URL to load
- * @method: the HTTP method to use
- * @input: the input string if any
- * @contentType: the Content-Type information IN and OUT
- * @redir: the redirected URL OUT
- * @headers: the extra headers
- * @ilen: input length
- *
- * This function try to open a connection to the indicated resource
- * via HTTP using the given @method, adding the given extra headers
- * and the input buffer for the request content.
- *
- * Returns NULL in case of failure, otherwise a request handler.
- * The contentType, or redir, if provided must be freed by the caller
- */
-
-void*
-xmlNanoHTTPMethodRedir(const char *URL, const char *method, const char *input,
- char **contentType, char **redir,
- const char *headers, int ilen ) {
- xmlNanoHTTPCtxtPtr ctxt;
- char *bp, *p;
- int blen, ret;
- int head;
- int xmt_bytes;
- int nbRedirects = 0;
- char *redirURL = NULL;
-
- if (URL == NULL) return(NULL);
- if (method == NULL) method = "GET";
- xmlNanoHTTPInit();
-
-retry:
- if (redirURL == NULL)
- ctxt = xmlNanoHTTPNewCtxt(URL);
- else {
- ctxt = xmlNanoHTTPNewCtxt(redirURL);
- }
-
- if ( ctxt == NULL ) {
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPMethodRedir: %s %s.",
- "Unable to allocate HTTP context to URI",
- ( ( redirURL == NULL ) ? URL : redirURL ) );
- return ( NULL );
- }
-
- if ((ctxt->protocol == NULL) || (strcmp(ctxt->protocol, "http"))) {
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPMethodRedir: %s - %s.",
- "Not a valid HTTP URI",
- ( ( redirURL == NULL ) ? URL : redirURL ) );
- xmlNanoHTTPFreeCtxt(ctxt);
- if (redirURL != NULL) xmlFree(redirURL);
- return(NULL);
- }
- if (ctxt->hostname == NULL) {
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPMethodRedir: %s - %s",
- "Failed to identify host in URI",
- ( ( redirURL == NULL ) ? URL : redirURL ) );
- xmlNanoHTTPFreeCtxt(ctxt);
- if (redirURL != NULL) xmlFree(redirURL);
- return(NULL);
- }
- if (proxy) {
- blen = strlen(ctxt->hostname) * 2 + 16;
- ret = xmlNanoHTTPConnectHost(proxy, proxyPort);
- }
- else {
- blen = strlen(ctxt->hostname);
- ret = xmlNanoHTTPConnectHost(ctxt->hostname, ctxt->port);
- }
- if (ret < 0) {
- xmlNanoHTTPFreeCtxt(ctxt);
- if (redirURL != NULL) xmlFree(redirURL);
- return(NULL);
- }
- ctxt->fd = ret;
-
- if (input == NULL)
- ilen = 0;
- else
- blen += 36;
-
- if (headers != NULL)
- blen += strlen(headers) + 2;
- if (contentType && *contentType)
- blen += strlen(*contentType) + 16;
- blen += strlen(method) + strlen(ctxt->path) + 24;
- bp = xmlMalloc(blen);
- if ( bp == NULL ) {
- xmlNanoHTTPFreeCtxt( ctxt );
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPMethodRedir: %s",
- "Error allocating HTTP header buffer." );
- return ( NULL );
- }
-
- p = bp;
-
- if (proxy) {
- if (ctxt->port != 80) {
- p += snprintf( p, blen - (p - bp), "%s http://%s:%d%s",
- method, ctxt->hostname,
- ctxt->port, ctxt->path );
- }
- else
- p += snprintf( p, blen - (p - bp), "%s http://%s%s", method,
- ctxt->hostname, ctxt->path);
- }
- else
- p += snprintf( p, blen - (p - bp), "%s %s", method, ctxt->path);
-
- p += snprintf( p, blen - (p - bp), " HTTP/1.0\r\nHost: %s\r\n",
- ctxt->hostname);
-
- if (contentType != NULL && *contentType)
- p += snprintf(p, blen - (p - bp), "Content-Type: %s\r\n", *contentType);
-
- if (headers != NULL)
- p += snprintf( p, blen - (p - bp), "%s", headers );
-
- if (input != NULL)
- snprintf(p, blen - (p - bp), "Content-Length: %d\r\n\r\n", ilen );
- else
- snprintf(p, blen - (p - bp), "\r\n");
-
-#ifdef DEBUG_HTTP
- xmlGenericError(xmlGenericErrorContext,
- "-> %s%s", proxy? "(Proxy) " : "", bp);
- if ((blen -= strlen(bp)+1) < 0)
- xmlGenericError(xmlGenericErrorContext,
- "ERROR: overflowed buffer by %d bytes\n", -blen);
-#endif
- ctxt->outptr = ctxt->out = bp;
- ctxt->state = XML_NANO_HTTP_WRITE;
- blen = strlen( ctxt->out );
- xmt_bytes = xmlNanoHTTPSend(ctxt, ctxt->out, blen );
-#ifdef DEBUG_HTTP
- if ( xmt_bytes != blen )
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPMethodRedir: Only %d of %d %s %s\n",
- xmt_bytes, blen,
- "bytes of HTTP headers sent to host",
- ctxt->hostname );
-#endif
-
- if ( input != NULL ) {
- xmt_bytes = xmlNanoHTTPSend( ctxt, input, ilen );
-
-#ifdef DEBUG_HTTP
- if ( xmt_bytes != ilen )
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPMethodRedir: Only %d of %d %s %s\n",
- xmt_bytes, ilen,
- "bytes of HTTP content sent to host",
- ctxt->hostname );
-#endif
- }
-
- ctxt->state = XML_NANO_HTTP_READ;
- head = 1;
-
- while ((p = xmlNanoHTTPReadLine(ctxt)) != NULL) {
- if (head && (*p == 0)) {
- head = 0;
- ctxt->content = ctxt->inrptr;
- xmlFree(p);
- break;
- }
- xmlNanoHTTPScanAnswer(ctxt, p);
-
-#ifdef DEBUG_HTTP
- xmlGenericError(xmlGenericErrorContext, "<- %s\n", p);
-#endif
- xmlFree(p);
- }
-
- if ((ctxt->location != NULL) && (ctxt->returnValue >= 300) &&
- (ctxt->returnValue < 400)) {
-#ifdef DEBUG_HTTP
- xmlGenericError(xmlGenericErrorContext,
- "\nRedirect to: %s\n", ctxt->location);
-#endif
- while ( xmlNanoHTTPRecv(ctxt) > 0 ) ;
- if (nbRedirects < XML_NANO_HTTP_MAX_REDIR) {
- nbRedirects++;
- if (redirURL != NULL)
- xmlFree(redirURL);
- redirURL = xmlMemStrdup(ctxt->location);
- xmlNanoHTTPFreeCtxt(ctxt);
- goto retry;
- }
- xmlNanoHTTPFreeCtxt(ctxt);
- if (redirURL != NULL) xmlFree(redirURL);
-#ifdef DEBUG_HTTP
- xmlGenericError(xmlGenericErrorContext,
- "xmlNanoHTTPMethodRedir: Too many redirects, aborting ...\n");
-#endif
- return(NULL);
- }
-
- if (contentType != NULL) {
- if (ctxt->contentType != NULL)
- *contentType = xmlMemStrdup(ctxt->contentType);
- else
- *contentType = NULL;
- }
-
- if ((redir != NULL) && (redirURL != NULL)) {
- *redir = redirURL;
- } else {
- if (redirURL != NULL)
- xmlFree(redirURL);
- if (redir != NULL)
- *redir = NULL;
- }
-
-#ifdef DEBUG_HTTP
- if (ctxt->contentType != NULL)
- xmlGenericError(xmlGenericErrorContext,
- "\nCode %d, content-type '%s'\n\n",
- ctxt->returnValue, ctxt->contentType);
- else
- xmlGenericError(xmlGenericErrorContext,
- "\nCode %d, no content-type\n\n",
- ctxt->returnValue);
-#endif
-
- return((void *) ctxt);
-}
-
-/**
- * xmlNanoHTTPMethod:
- * @URL: The URL to load
- * @method: the HTTP method to use
- * @input: the input string if any
- * @contentType: the Content-Type information IN and OUT
- * @headers: the extra headers
- * @ilen: input length
- *
- * This function try to open a connection to the indicated resource
- * via HTTP using the given @method, adding the given extra headers
- * and the input buffer for the request content.
- *
- * Returns NULL in case of failure, otherwise a request handler.
- * The contentType, if provided must be freed by the caller
- */
-
-void*
-xmlNanoHTTPMethod(const char *URL, const char *method, const char *input,
- char **contentType, const char *headers, int ilen) {
- return(xmlNanoHTTPMethodRedir(URL, method, input, contentType,
- NULL, headers, ilen));
-}
-
-/**
- * xmlNanoHTTPFetch:
- * @URL: The URL to load
- * @filename: the filename where the content should be saved
- * @contentType: if available the Content-Type information will be
- * returned at that location
- *
- * This function try to fetch the indicated resource via HTTP GET
- * and save it's content in the file.
- *
- * Returns -1 in case of failure, 0 incase of success. The contentType,
- * if provided must be freed by the caller
- */
-int
-xmlNanoHTTPFetch(const char *URL, const char *filename, char **contentType) {
- void *ctxt = NULL;
- char *buf = NULL;
- int fd;
- int len;
-
- ctxt = xmlNanoHTTPOpen(URL, contentType);
- if (ctxt == NULL) return(-1);
-
- if (!strcmp(filename, "-"))
- fd = 0;
- else {
- fd = open(filename, O_CREAT | O_WRONLY, 00644);
- if (fd < 0) {
- xmlNanoHTTPClose(ctxt);
- if ((contentType != NULL) && (*contentType != NULL)) {
- xmlFree(*contentType);
- *contentType = NULL;
- }
- return(-1);
- }
- }
-
- xmlNanoHTTPFetchContent( ctxt, &buf, &len );
- if ( len > 0 ) {
- write(fd, buf, len);
- }
-
- xmlNanoHTTPClose(ctxt);
- close(fd);
- return(0);
-}
-
-/**
- * xmlNanoHTTPSave:
- * @ctxt: the HTTP context
- * @filename: the filename where the content should be saved
- *
- * This function saves the output of the HTTP transaction to a file
- * It closes and free the context at the end
- *
- * Returns -1 in case of failure, 0 incase of success.
- */
-int
-xmlNanoHTTPSave(void *ctxt, const char *filename) {
- char *buf = NULL;
- int fd;
- int len;
-
- if (ctxt == NULL) return(-1);
-
- if (!strcmp(filename, "-"))
- fd = 0;
- else {
- fd = open(filename, O_CREAT | O_WRONLY);
- if (fd < 0) {
- xmlNanoHTTPClose(ctxt);
- return(-1);
- }
- }
-
- xmlNanoHTTPFetchContent( ctxt, &buf, &len );
- if ( len > 0 ) {
- write(fd, buf, len);
- }
-
- xmlNanoHTTPClose(ctxt);
- return(0);
-}
-
-/**
- * xmlNanoHTTPReturnCode:
- * @ctx: the HTTP context
- *
- * Get the latest HTTP return code received
- *
- * Returns the HTTP return code for the request.
- */
-int
-xmlNanoHTTPReturnCode(void *ctx) {
- xmlNanoHTTPCtxtPtr ctxt = (xmlNanoHTTPCtxtPtr) ctx;
-
- if (ctxt == NULL) return(-1);
-
- return(ctxt->returnValue);
-}
-
-/**
- * xmlNanoHTTPAuthHeader:
- * @ctx: the HTTP context
- *
- * Get the authentication header of an HTTP context
- *
- * Returns the stashed value of the WWW-Authenticate or Proxy-Authenticate
- * header.
- */
-const char *
-xmlNanoHTTPAuthHeader(void *ctx) {
- xmlNanoHTTPCtxtPtr ctxt = (xmlNanoHTTPCtxtPtr) ctx;
-
- if (ctxt == NULL) return(NULL);
-
- return(ctxt->authHeader);
-}
-
-/**
- * xmlNanoHTTPContentLength:
- * @ctx: the HTTP context
- *
- * Provides the specified content length from the HTTP header.
- *
- * Return the specified content length from the HTTP header. Note that
- * a value of -1 indicates that the content length element was not included in
- * the response header.
- */
-int
-xmlNanoHTTPContentLength( void * ctx ) {
- xmlNanoHTTPCtxtPtr ctxt = ctx;
-
- return ( ( ctxt == NULL ) ? -1 : ctxt->ContentLength );
-}
-
-/**
- * xmlNanoHTTPFetchContent:
- * @ctx: the HTTP context
- * @ptr: pointer to set to the content buffer.
- * @len: integer pointer to hold the length of the content
- *
- * Check if all the content was read
- *
- * Returns 0 if all the content was read and available, returns
- * -1 if received content length was less than specified or an error
- * occurred.
- */
-int
-xmlNanoHTTPFetchContent( void * ctx, char ** ptr, int * len ) {
- xmlNanoHTTPCtxtPtr ctxt = ctx;
-
- int rc = 0;
- int cur_lgth;
- int rcvd_lgth;
- int dummy_int;
- char * dummy_ptr = NULL;
-
- /* Dummy up return input parameters if not provided */
-
- if ( len == NULL )
- len = &dummy_int;
-
- if ( ptr == NULL )
- ptr = &dummy_ptr;
-
- /* But can't work without the context pointer */
-
- if ( ( ctxt == NULL ) || ( ctxt->content == NULL ) ) {
- *len = 0;
- *ptr = NULL;
- return ( -1 );
- }
-
- rcvd_lgth = ctxt->inptr - ctxt->content;
-
- while ( (cur_lgth = xmlNanoHTTPRecv( ctxt )) > 0 ) {
-
- rcvd_lgth += cur_lgth;
- if ( (ctxt->ContentLength > 0) && (rcvd_lgth >= ctxt->ContentLength) )
- break;
- }
-
- *ptr = ctxt->content;
- *len = rcvd_lgth;
-
- if ( ( ctxt->ContentLength > 0 ) && ( rcvd_lgth < ctxt->ContentLength ) )
- rc = -1;
- else if ( rcvd_lgth == 0 )
- rc = -1;
-
- return ( rc );
-}
-
-#ifdef STANDALONE
-int main(int argc, char **argv) {
- char *contentType = NULL;
-
- if (argv[1] != NULL) {
- if (argv[2] != NULL)
- xmlNanoHTTPFetch(argv[1], argv[2], &contentType);
- else
- xmlNanoHTTPFetch(argv[1], "-", &contentType);
- if (contentType != NULL) xmlFree(contentType);
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "%s: minimal HTTP GET implementation\n", argv[0]);
- xmlGenericError(xmlGenericErrorContext,
- "\tusage %s [ URL [ filename ] ]\n", argv[0]);
- }
- xmlNanoHTTPCleanup();
- xmlMemoryDump();
- return(0);
-}
-#endif /* STANDALONE */
-#else /* !LIBXML_HTTP_ENABLED */
-#ifdef STANDALONE
-#include <stdio.h>
-int main(int argc, char **argv) {
- xmlGenericError(xmlGenericErrorContext,
- "%s : HTTP support not compiled in\n", argv[0]);
- return(0);
-}
-#endif /* STANDALONE */
-#endif /* LIBXML_HTTP_ENABLED */
diff --git a/bundle/libxml/parser.c b/bundle/libxml/parser.c
deleted file mode 100644
index 66908264fc..0000000000
--- a/bundle/libxml/parser.c
+++ /dev/null
@@ -1,10912 +0,0 @@
-/*
- * parser.c : an XML 1.0 parser, namespaces and validity support are mostly
- * implemented on top of the SAX interfaces
- *
- * References:
- * The XML specification:
- * http://www.w3.org/TR/REC-xml
- * Original 1.0 version:
- * http://www.w3.org/TR/1998/REC-xml-19980210
- * XML second edition working draft
- * http://www.w3.org/TR/2000/WD-xml-2e-20000814
- *
- * Okay this is a big file, the parser core is around 7000 lines, then it
- * is followed by the progressive parser top routines, then the various
- * high level APIs to call the parser and a few miscellaneous functions.
- * A number of helper functions and deprecated ones have been moved to
- * parserInternals.c to reduce this file size.
- * As much as possible the functions are associated with their relative
- * production in the XML specification. A few productions defining the
- * different ranges of character are actually implanted either in
- * parserInternals.h or parserInternals.c
- * The DOM tree build is realized from the default SAX callbacks in
- * the module SAX.c.
- * The routines doing the validation checks are in valid.c and called either
- * from the SAX callbacks or as standalone functions using a preparsed
- * document.
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#if defined(WIN32) && !defined (__CYGWIN__)
-#define XML_DIR_SEP '\\'
-#else
-#define XML_DIR_SEP '/'
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/threads.h>
-#include <libxml/globals.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-#include <libxml/valid.h>
-#include <libxml/entities.h>
-#include <libxml/xmlerror.h>
-#include <libxml/encoding.h>
-#include <libxml/xmlIO.h>
-#include <libxml/uri.h>
-#ifdef LIBXML_CATALOG_ENABLED
-#include <libxml/catalog.h>
-#endif
-
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_ZLIB_H
-#include <zlib.h>
-#endif
-
-
-#define XML_PARSER_BIG_BUFFER_SIZE 300
-#define XML_PARSER_BUFFER_SIZE 100
-
-#define SAX_COMPAT_MODE BAD_CAST "SAX compatibility mode document"
-
-/*
- * List of XML prefixed PI allowed by W3C specs
- */
-
-static const char *xmlW3CPIs[] = {
- "xml-stylesheet",
- NULL
-};
-
-/* DEPR void xmlParserHandleReference(xmlParserCtxtPtr ctxt); */
-xmlEntityPtr xmlParseStringPEReference(xmlParserCtxtPtr ctxt,
- const xmlChar **str);
-
-static int
-xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
- xmlSAXHandlerPtr sax,
- void *user_data, int depth, const xmlChar *URL,
- const xmlChar *ID, xmlNodePtr *list);
-
-static void
-xmlAddEntityReference(xmlEntityPtr ent, xmlNodePtr firstNode,
- xmlNodePtr lastNode);
-
-static int
-xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
- const xmlChar *string, void *user_data, xmlNodePtr *lst);
-/************************************************************************
- * *
- * Parser stacks related functions and macros *
- * *
- ************************************************************************/
-
-xmlEntityPtr xmlParseStringEntityRef(xmlParserCtxtPtr ctxt,
- const xmlChar ** str);
-
-/**
- * inputPush:
- * @ctxt: an XML parser context
- * @value: the parser input
- *
- * Pushes a new parser input on top of the input stack
- *
- * Returns 0 in case of error, the index in the stack otherwise
- */
-extern int
-inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
-{
- if (ctxt->inputNr >= ctxt->inputMax) {
- ctxt->inputMax *= 2;
- ctxt->inputTab =
- (xmlParserInputPtr *) xmlRealloc(ctxt->inputTab,
- ctxt->inputMax *
- sizeof(ctxt->inputTab[0]));
- if (ctxt->inputTab == NULL) {
- xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
- return (0);
- }
- }
- ctxt->inputTab[ctxt->inputNr] = value;
- ctxt->input = value;
- return (ctxt->inputNr++);
-}
-/**
- * inputPop:
- * @ctxt: an XML parser context
- *
- * Pops the top parser input from the input stack
- *
- * Returns the input just removed
- */
-extern xmlParserInputPtr
-inputPop(xmlParserCtxtPtr ctxt)
-{
- xmlParserInputPtr ret;
-
- if (ctxt->inputNr <= 0)
- return (0);
- ctxt->inputNr--;
- if (ctxt->inputNr > 0)
- ctxt->input = ctxt->inputTab[ctxt->inputNr - 1];
- else
- ctxt->input = NULL;
- ret = ctxt->inputTab[ctxt->inputNr];
- ctxt->inputTab[ctxt->inputNr] = 0;
- return (ret);
-}
-/**
- * nodePush:
- * @ctxt: an XML parser context
- * @value: the element node
- *
- * Pushes a new element node on top of the node stack
- *
- * Returns 0 in case of error, the index in the stack otherwise
- */
-extern int
-nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value)
-{
- if (ctxt->nodeNr >= ctxt->nodeMax) {
- ctxt->nodeMax *= 2;
- ctxt->nodeTab =
- (xmlNodePtr *) xmlRealloc(ctxt->nodeTab,
- ctxt->nodeMax *
- sizeof(ctxt->nodeTab[0]));
- if (ctxt->nodeTab == NULL) {
- xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
- return (0);
- }
- }
- ctxt->nodeTab[ctxt->nodeNr] = value;
- ctxt->node = value;
- return (ctxt->nodeNr++);
-}
-/**
- * nodePop:
- * @ctxt: an XML parser context
- *
- * Pops the top element node from the node stack
- *
- * Returns the node just removed
- */
-extern xmlNodePtr
-nodePop(xmlParserCtxtPtr ctxt)
-{
- xmlNodePtr ret;
-
- if (ctxt->nodeNr <= 0)
- return (0);
- ctxt->nodeNr--;
- if (ctxt->nodeNr > 0)
- ctxt->node = ctxt->nodeTab[ctxt->nodeNr - 1];
- else
- ctxt->node = NULL;
- ret = ctxt->nodeTab[ctxt->nodeNr];
- ctxt->nodeTab[ctxt->nodeNr] = 0;
- return (ret);
-}
-/**
- * namePush:
- * @ctxt: an XML parser context
- * @value: the element name
- *
- * Pushes a new element name on top of the name stack
- *
- * Returns 0 in case of error, the index in the stack otherwise
- */
-extern int
-namePush(xmlParserCtxtPtr ctxt, xmlChar * value)
-{
- if (ctxt->nameNr >= ctxt->nameMax) {
- ctxt->nameMax *= 2;
- ctxt->nameTab =
- (xmlChar * *)xmlRealloc(ctxt->nameTab,
- ctxt->nameMax *
- sizeof(ctxt->nameTab[0]));
- if (ctxt->nameTab == NULL) {
- xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
- return (0);
- }
- }
- ctxt->nameTab[ctxt->nameNr] = value;
- ctxt->name = value;
- return (ctxt->nameNr++);
-}
-/**
- * namePop:
- * @ctxt: an XML parser context
- *
- * Pops the top element name from the name stack
- *
- * Returns the name just removed
- */
-extern xmlChar *
-namePop(xmlParserCtxtPtr ctxt)
-{
- xmlChar *ret;
-
- if (ctxt->nameNr <= 0)
- return (0);
- ctxt->nameNr--;
- if (ctxt->nameNr > 0)
- ctxt->name = ctxt->nameTab[ctxt->nameNr - 1];
- else
- ctxt->name = NULL;
- ret = ctxt->nameTab[ctxt->nameNr];
- ctxt->nameTab[ctxt->nameNr] = 0;
- return (ret);
-}
-
-static int spacePush(xmlParserCtxtPtr ctxt, int val) {
- if (ctxt->spaceNr >= ctxt->spaceMax) {
- ctxt->spaceMax *= 2;
- ctxt->spaceTab = (int *) xmlRealloc(ctxt->spaceTab,
- ctxt->spaceMax * sizeof(ctxt->spaceTab[0]));
- if (ctxt->spaceTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc failed !\n");
- return(0);
- }
- }
- ctxt->spaceTab[ctxt->spaceNr] = val;
- ctxt->space = &ctxt->spaceTab[ctxt->spaceNr];
- return(ctxt->spaceNr++);
-}
-
-static int spacePop(xmlParserCtxtPtr ctxt) {
- int ret;
- if (ctxt->spaceNr <= 0) return(0);
- ctxt->spaceNr--;
- if (ctxt->spaceNr > 0)
- ctxt->space = &ctxt->spaceTab[ctxt->spaceNr - 1];
- else
- ctxt->space = NULL;
- ret = ctxt->spaceTab[ctxt->spaceNr];
- ctxt->spaceTab[ctxt->spaceNr] = -1;
- return(ret);
-}
-
-/*
- * Macros for accessing the content. Those should be used only by the parser,
- * and not exported.
- *
- * Dirty macros, i.e. one often need to make assumption on the context to
- * use them
- *
- * CUR_PTR return the current pointer to the xmlChar to be parsed.
- * To be used with extreme caution since operations consuming
- * characters may move the input buffer to a different location !
- * CUR returns the current xmlChar value, i.e. a 8 bit value if compiled
- * This should be used internally by the parser
- * only to compare to ASCII values otherwise it would break when
- * running with UTF-8 encoding.
- * RAW same as CUR but in the input buffer, bypass any token
- * extraction that may have been done
- * NXT(n) returns the n'th next xmlChar. Same as CUR is should be used only
- * to compare on ASCII based substring.
- * SKIP(n) Skip n xmlChar, and must also be used only to skip ASCII defined
- * strings within the parser.
- *
- * Clean macros, not dependent of an ASCII context, expect UTF-8 encoding
- *
- * NEXT Skip to the next character, this does the proper decoding
- * in UTF-8 mode. It also pop-up unfinished entities on the fly.
- * NEXTL(l) Skip l xmlChar in the input buffer
- * CUR_CHAR(l) returns the current unicode character (int), set l
- * to the number of xmlChars used for the encoding [0-5].
- * CUR_SCHAR same but operate on a string instead of the context
- * COPY_BUF copy the current unicode char to the target buffer, increment
- * the index
- * GROW, SHRINK handling of input buffers
- */
-
-#define RAW (*ctxt->input->cur)
-#define CUR (*ctxt->input->cur)
-#define NXT(val) ctxt->input->cur[(val)]
-#define CUR_PTR ctxt->input->cur
-
-#define SKIP(val) do { \
- ctxt->nbChars += (val),ctxt->input->cur += (val); \
- if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \
- if ((*ctxt->input->cur == 0) && \
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) \
- xmlPopInput(ctxt); \
- } while (0)
-
-#define SHRINK if (ctxt->input->cur - ctxt->input->base > INPUT_CHUNK) \
- xmlSHRINK (ctxt);
-
-static void xmlSHRINK (xmlParserCtxtPtr ctxt) {
- xmlParserInputShrink(ctxt->input);
- if ((*ctxt->input->cur == 0) &&
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0))
- xmlPopInput(ctxt);
- }
-
-#define GROW if (ctxt->input->end - ctxt->input->cur < INPUT_CHUNK) \
- xmlGROW (ctxt);
-
-static void xmlGROW (xmlParserCtxtPtr ctxt) {
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- if ((*ctxt->input->cur == 0) &&
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0))
- xmlPopInput(ctxt);
- }
-
-#define SKIP_BLANKS xmlSkipBlankChars(ctxt)
-
-#define NEXT xmlNextChar(ctxt)
-
-#define NEXT1 { \
- ctxt->input->cur++; \
- ctxt->nbChars++; \
- if (*ctxt->input->cur == 0) \
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK); \
- }
-
-#define NEXTL(l) do { \
- if (*(ctxt->input->cur) == '\n') { \
- ctxt->input->line++; ctxt->input->col = 1; \
- } else ctxt->input->col++; \
- ctxt->input->cur += l; \
- if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \
- } while (0)
-
-#define CUR_CHAR(l) xmlCurrentChar(ctxt, &l)
-#define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l)
-
-#define COPY_BUF(l,b,i,v) \
- if (l == 1) b[i++] = (xmlChar) v; \
- else i += xmlCopyCharMultiByte(&b[i],v)
-
-/**
- * xmlSkipBlankChars:
- * @ctxt: the XML parser context
- *
- * skip all blanks character found at that point in the input streams.
- * It pops up finished entities in the process if allowable at that point.
- *
- * Returns the number of space chars skipped
- */
-
-int
-xmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
- int res = 0;
-
- /*
- * It's Okay to use CUR/NEXT here since all the blanks are on
- * the ASCII range.
- */
- if ((ctxt->inputNr == 1) && (ctxt->instate != XML_PARSER_DTD)) {
- const xmlChar *cur;
- /*
- * if we are in the document content, go really fast
- */
- cur = ctxt->input->cur;
- while (IS_BLANK(*cur)) {
- if (*cur == '\n') {
- ctxt->input->line++; ctxt->input->col = 1;
- }
- cur++;
- res++;
- if (*cur == 0) {
- ctxt->input->cur = cur;
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- cur = ctxt->input->cur;
- }
- }
- ctxt->input->cur = cur;
- } else {
- int cur;
- do {
- cur = CUR;
- while (IS_BLANK(cur)) { /* CHECKED tstblanks.xml */
- NEXT;
- cur = CUR;
- res++;
- }
- while ((cur == 0) && (ctxt->inputNr > 1) &&
- (ctxt->instate != XML_PARSER_COMMENT)) {
- xmlPopInput(ctxt);
- cur = CUR;
- }
- /*
- * Need to handle support of entities branching here
- */
- if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt);
- } while (IS_BLANK(cur)); /* CHECKED tstblanks.xml */
- }
- return(res);
-}
-
-/************************************************************************
- * *
- * Commodity functions to handle entities *
- * *
- ************************************************************************/
-
-/**
- * xmlPopInput:
- * @ctxt: an XML parser context
- *
- * xmlPopInput: the current input pointed by ctxt->input came to an end
- * pop it and return the next char.
- *
- * Returns the current xmlChar in the parser context
- */
-xmlChar
-xmlPopInput(xmlParserCtxtPtr ctxt) {
- if (ctxt->inputNr == 1) return(0); /* End of main Input */
- if (xmlParserDebugEntities)
- xmlGenericError(xmlGenericErrorContext,
- "Popping input %d\n", ctxt->inputNr);
- xmlFreeInputStream(inputPop(ctxt));
- if ((*ctxt->input->cur == 0) &&
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0))
- return(xmlPopInput(ctxt));
- return(CUR);
-}
-
-/**
- * xmlPushInput:
- * @ctxt: an XML parser context
- * @input: an XML parser input fragment (entity, XML fragment ...).
- *
- * xmlPushInput: switch to a new input stream which is stacked on top
- * of the previous one(s).
- */
-void
-xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) {
- if (input == NULL) return;
-
- if (xmlParserDebugEntities) {
- if ((ctxt->input != NULL) && (ctxt->input->filename))
- xmlGenericError(xmlGenericErrorContext,
- "%s(%d): ", ctxt->input->filename,
- ctxt->input->line);
- xmlGenericError(xmlGenericErrorContext,
- "Pushing input %d : %.30s\n", ctxt->inputNr+1, input->cur);
- }
- inputPush(ctxt, input);
- GROW;
-}
-
-/**
- * xmlParseCharRef:
- * @ctxt: an XML parser context
- *
- * parse Reference declarations
- *
- * [66] CharRef ::= '&#' [0-9]+ ';' |
- * '&#x' [0-9a-fA-F]+ ';'
- *
- * [ WFC: Legal Character ]
- * Characters referred to using character references must match the
- * production for Char.
- *
- * Returns the value parsed (as an int), 0 in case of error
- */
-int
-xmlParseCharRef(xmlParserCtxtPtr ctxt) {
- unsigned int val = 0;
- int count = 0;
-
- /*
- * Using RAW/CUR/NEXT is okay since we are working on ASCII range here
- */
- if ((RAW == '&') && (NXT(1) == '#') &&
- (NXT(2) == 'x')) {
- SKIP(3);
- GROW;
- while (RAW != ';') { /* loop blocked by count */
- if (count++ > 20) {
- count = 0;
- GROW;
- }
- if ((RAW >= '0') && (RAW <= '9'))
- val = val * 16 + (CUR - '0');
- else if ((RAW >= 'a') && (RAW <= 'f') && (count < 20))
- val = val * 16 + (CUR - 'a') + 10;
- else if ((RAW >= 'A') && (RAW <= 'F') && (count < 20))
- val = val * 16 + (CUR - 'A') + 10;
- else {
- ctxt->errNo = XML_ERR_INVALID_HEX_CHARREF;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseCharRef: invalid hexadecimal value\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- val = 0;
- break;
- }
- NEXT;
- count++;
- }
- if (RAW == ';') {
- /* on purpose to avoid reentrancy problems with NEXT and SKIP */
- ctxt->nbChars ++;
- ctxt->input->cur++;
- }
- } else if ((RAW == '&') && (NXT(1) == '#')) {
- SKIP(2);
- GROW;
- while (RAW != ';') { /* loop blocked by count */
- if (count++ > 20) {
- count = 0;
- GROW;
- }
- if ((RAW >= '0') && (RAW <= '9'))
- val = val * 10 + (CUR - '0');
- else {
- ctxt->errNo = XML_ERR_INVALID_DEC_CHARREF;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseCharRef: invalid decimal value\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- val = 0;
- break;
- }
- NEXT;
- count++;
- }
- if (RAW == ';') {
- /* on purpose to avoid reentrancy problems with NEXT and SKIP */
- ctxt->nbChars ++;
- ctxt->input->cur++;
- }
- } else {
- ctxt->errNo = XML_ERR_INVALID_CHARREF;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseCharRef: invalid value\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- /*
- * [ WFC: Legal Character ]
- * Characters referred to using character references must match the
- * production for Char.
- */
- if (IS_CHAR(val)) {
- return(val);
- } else {
- ctxt->errNo = XML_ERR_INVALID_CHAR;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseCharRef: invalid xmlChar value %d\n",
- val);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- return(0);
-}
-
-/**
- * xmlParseStringCharRef:
- * @ctxt: an XML parser context
- * @str: a pointer to an index in the string
- *
- * parse Reference declarations, variant parsing from a string rather
- * than an an input flow.
- *
- * [66] CharRef ::= '&#' [0-9]+ ';' |
- * '&#x' [0-9a-fA-F]+ ';'
- *
- * [ WFC: Legal Character ]
- * Characters referred to using character references must match the
- * production for Char.
- *
- * Returns the value parsed (as an int), 0 in case of error, str will be
- * updated to the current value of the index
- */
-static int
-xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) {
- const xmlChar *ptr;
- xmlChar cur;
- int val = 0;
-
- if ((str == NULL) || (*str == NULL)) return(0);
- ptr = *str;
- cur = *ptr;
- if ((cur == '&') && (ptr[1] == '#') && (ptr[2] == 'x')) {
- ptr += 3;
- cur = *ptr;
- while (cur != ';') { /* Non input consuming loop */
- if ((cur >= '0') && (cur <= '9'))
- val = val * 16 + (cur - '0');
- else if ((cur >= 'a') && (cur <= 'f'))
- val = val * 16 + (cur - 'a') + 10;
- else if ((cur >= 'A') && (cur <= 'F'))
- val = val * 16 + (cur - 'A') + 10;
- else {
- ctxt->errNo = XML_ERR_INVALID_HEX_CHARREF;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseStringCharRef: invalid hexadecimal value\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- val = 0;
- break;
- }
- ptr++;
- cur = *ptr;
- }
- if (cur == ';')
- ptr++;
- } else if ((cur == '&') && (ptr[1] == '#')){
- ptr += 2;
- cur = *ptr;
- while (cur != ';') { /* Non input consuming loops */
- if ((cur >= '0') && (cur <= '9'))
- val = val * 10 + (cur - '0');
- else {
- ctxt->errNo = XML_ERR_INVALID_DEC_CHARREF;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseStringCharRef: invalid decimal value\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- val = 0;
- break;
- }
- ptr++;
- cur = *ptr;
- }
- if (cur == ';')
- ptr++;
- } else {
- ctxt->errNo = XML_ERR_INVALID_CHARREF;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseStringCharRef: invalid value\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(0);
- }
- *str = ptr;
-
- /*
- * [ WFC: Legal Character ]
- * Characters referred to using character references must match the
- * production for Char.
- */
- if (IS_CHAR(val)) {
- return(val);
- } else {
- ctxt->errNo = XML_ERR_INVALID_CHAR;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseStringCharRef: invalid xmlChar value %d\n", val);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- return(0);
-}
-
-/**
- * xmlNewBlanksWrapperInputStream:
- * @ctxt: an XML parser context
- * @entity: an Entity pointer
- *
- * Create a new input stream for wrapping
- * blanks around a PEReference
- *
- * Returns the new input stream or NULL
- */
-
-static void deallocblankswrapper (xmlChar *str) {xmlFree(str);}
-
-static xmlParserInputPtr
-xmlNewBlanksWrapperInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
- xmlParserInputPtr input;
- xmlChar *buffer;
- size_t length;
- if (entity == NULL) {
- ctxt->errNo = XML_ERR_INTERNAL_ERROR;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "internal: xmlNewBlanksWrapperInputStream entity = NULL\n");
- ctxt->errNo = XML_ERR_INTERNAL_ERROR;
- return(NULL);
- }
- if (xmlParserDebugEntities)
- xmlGenericError(xmlGenericErrorContext,
- "new blanks wrapper for entity: %s\n", entity->name);
- input = xmlNewInputStream(ctxt);
- if (input == NULL) {
- return(NULL);
- }
- length = xmlStrlen(entity->name) + 5;
- buffer = xmlMalloc(length);
- if (buffer == NULL) {
- return(NULL);
- }
- buffer [0] = ' ';
- buffer [1] = '%';
- buffer [length-3] = ';';
- buffer [length-2] = ' ';
- buffer [length-1] = 0;
- memcpy(buffer + 2, entity->name, length - 5);
- input->free = deallocblankswrapper;
- input->base = buffer;
- input->cur = buffer;
- input->length = length;
- input->end = &buffer[length];
- return(input);
-}
-
-/**
- * xmlParserHandlePEReference:
- * @ctxt: the parser context
- *
- * [69] PEReference ::= '%' Name ';'
- *
- * [ WFC: No Recursion ]
- * A parsed entity must not contain a recursive
- * reference to itself, either directly or indirectly.
- *
- * [ WFC: Entity Declared ]
- * In a document without any DTD, a document with only an internal DTD
- * subset which contains no parameter entity references, or a document
- * with "standalone='yes'", ... ... The declaration of a parameter
- * entity must precede any reference to it...
- *
- * [ VC: Entity Declared ]
- * In a document with an external subset or external parameter entities
- * with "standalone='no'", ... ... The declaration of a parameter entity
- * must precede any reference to it...
- *
- * [ WFC: In DTD ]
- * Parameter-entity references may only appear in the DTD.
- * NOTE: misleading but this is handled.
- *
- * A PEReference may have been detected in the current input stream
- * the handling is done accordingly to
- * http://www.w3.org/TR/REC-xml#entproc
- * i.e.
- * - Included in literal in entity values
- * - Included as Parameter Entity reference within DTDs
- */
-void
-xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlEntityPtr entity = NULL;
- xmlParserInputPtr input;
-
- if (RAW != '%') return;
- switch(ctxt->instate) {
- case XML_PARSER_CDATA_SECTION:
- return;
- case XML_PARSER_COMMENT:
- return;
- case XML_PARSER_START_TAG:
- return;
- case XML_PARSER_END_TAG:
- return;
- case XML_PARSER_EOF:
- ctxt->errNo = XML_ERR_PEREF_AT_EOF;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "PEReference at EOF\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return;
- case XML_PARSER_PROLOG:
- case XML_PARSER_START:
- case XML_PARSER_MISC:
- ctxt->errNo = XML_ERR_PEREF_IN_PROLOG;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "PEReference in prolog!\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return;
- case XML_PARSER_ENTITY_DECL:
- case XML_PARSER_CONTENT:
- case XML_PARSER_ATTRIBUTE_VALUE:
- case XML_PARSER_PI:
- case XML_PARSER_SYSTEM_LITERAL:
- case XML_PARSER_PUBLIC_LITERAL:
- /* we just ignore it there */
- return;
- case XML_PARSER_EPILOG:
- ctxt->errNo = XML_ERR_PEREF_IN_EPILOG;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "PEReference in epilog!\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return;
- case XML_PARSER_ENTITY_VALUE:
- /*
- * NOTE: in the case of entity values, we don't do the
- * substitution here since we need the literal
- * entity value to be able to save the internal
- * subset of the document.
- * This will be handled by xmlStringDecodeEntities
- */
- return;
- case XML_PARSER_DTD:
- /*
- * [WFC: Well-Formedness Constraint: PEs in Internal Subset]
- * In the internal DTD subset, parameter-entity references
- * can occur only where markup declarations can occur, not
- * within markup declarations.
- * In that case this is handled in xmlParseMarkupDecl
- */
- if ((ctxt->external == 0) && (ctxt->inputNr == 1))
- return;
- if (IS_BLANK(NXT(1)) || NXT(1) == 0)
- return;
- break;
- case XML_PARSER_IGNORE:
- return;
- }
-
- NEXT;
- name = xmlParseName(ctxt);
- if (xmlParserDebugEntities)
- xmlGenericError(xmlGenericErrorContext,
- "PEReference: %s\n", name);
- if (name == NULL) {
- ctxt->errNo = XML_ERR_PEREF_NO_NAME;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "xmlParserHandlePEReference: no name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- if (RAW == ';') {
- NEXT;
- if ((ctxt->sax != NULL) && (ctxt->sax->getParameterEntity != NULL))
- entity = ctxt->sax->getParameterEntity(ctxt->userData, name);
- if (entity == NULL) {
-
- /*
- * [ WFC: Entity Declared ]
- * In a document without any DTD, a document with only an
- * internal DTD subset which contains no parameter entity
- * references, or a document with "standalone='yes'", ...
- * ... The declaration of a parameter entity must precede
- * any reference to it...
- */
- if ((ctxt->standalone == 1) ||
- ((ctxt->hasExternalSubset == 0) &&
- (ctxt->hasPErefs == 0))) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "PEReference: %%%s; not found\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- /*
- * [ VC: Entity Declared ]
- * In a document with an external subset or external
- * parameter entities with "standalone='no'", ...
- * ... The declaration of a parameter entity must precede
- * any reference to it...
- */
- if ((!ctxt->disableSAX) &&
- (ctxt->validate) && (ctxt->vctxt.error != NULL)) {
- ctxt->vctxt.error(ctxt->vctxt.userData,
- "PEReference: %%%s; not found\n", name);
- } else if ((!ctxt->disableSAX) &&
- (ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData,
- "PEReference: %%%s; not found\n", name);
- ctxt->valid = 0;
- }
- } else if (ctxt->input->free != deallocblankswrapper) {
- input = xmlNewBlanksWrapperInputStream(ctxt, entity);
- xmlPushInput(ctxt, input);
- } else {
- if ((entity->etype == XML_INTERNAL_PARAMETER_ENTITY) ||
- (entity->etype == XML_EXTERNAL_PARAMETER_ENTITY)) {
- xmlChar start[4];
- xmlCharEncoding enc;
-
- /*
- * handle the extra spaces added before and after
- * c.f. http://www.w3.org/TR/REC-xml#as-PE
- * this is done independently.
- */
- input = xmlNewEntityInputStream(ctxt, entity);
- xmlPushInput(ctxt, input);
-
- /*
- * Get the 4 first bytes and decode the charset
- * if enc != XML_CHAR_ENCODING_NONE
- * plug some encoding conversion routines.
- */
- GROW
- if (entity->length >= 4) {
- start[0] = RAW;
- start[1] = NXT(1);
- start[2] = NXT(2);
- start[3] = NXT(3);
- enc = xmlDetectCharEncoding(start, 4);
- if (enc != XML_CHAR_ENCODING_NONE) {
- xmlSwitchEncoding(ctxt, enc);
- }
- }
-
- if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
- (RAW == '<') && (NXT(1) == '?') &&
- (NXT(2) == 'x') && (NXT(3) == 'm') &&
- (NXT(4) == 'l') && (IS_BLANK(NXT(5)))) {
- xmlParseTextDecl(ctxt);
- }
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParserHandlePEReference: %s is not a parameter entity\n",
- name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- }
- } else {
- ctxt->errNo = XML_ERR_PEREF_SEMICOL_MISSING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParserHandlePEReference: expecting ';'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- xmlFree(name);
- }
-}
-
-/*
- * Macro used to grow the current buffer.
- */
-#define growBuffer(buffer) { \
- buffer##_size *= 2; \
- buffer = (xmlChar *) \
- xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \
- if (buffer == NULL) { \
- xmlGenericError(xmlGenericErrorContext, "realloc failed"); \
- return(NULL); \
- } \
-}
-
-/**
- * xmlStringDecodeEntities:
- * @ctxt: the parser context
- * @str: the input string
- * @what: combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF
- * @end: an end marker xmlChar, 0 if none
- * @end2: an end marker xmlChar, 0 if none
- * @end3: an end marker xmlChar, 0 if none
- *
- * Takes a entity string content and process to do the adequate substitutions.
- *
- * [67] Reference ::= EntityRef | CharRef
- *
- * [69] PEReference ::= '%' Name ';'
- *
- * Returns A newly allocated string with the substitution done. The caller
- * must deallocate it !
- */
-xmlChar *
-xmlStringDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int what,
- xmlChar end, xmlChar end2, xmlChar end3) {
- xmlChar *buffer = NULL;
- int buffer_size = 0;
-
- xmlChar *current = NULL;
- xmlEntityPtr ent;
- int c,l;
- int nbchars = 0;
-
- if (str == NULL)
- return(NULL);
-
- if (ctxt->depth > 40) {
- ctxt->errNo = XML_ERR_ENTITY_LOOP;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Detected entity reference loop\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(NULL);
- }
-
- /*
- * allocate a translation buffer.
- */
- buffer_size = XML_PARSER_BIG_BUFFER_SIZE;
- buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
- if (buffer == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlStringDecodeEntities: malloc failed");
- return(NULL);
- }
-
- /*
- * OK loop until we reach one of the ending char or a size limit.
- * we are operating on already parsed values.
- */
- c = CUR_SCHAR(str, l);
- while ((c != 0) && (c != end) && /* non input consuming loop */
- (c != end2) && (c != end3)) {
-
- if (c == 0) break;
- if ((c == '&') && (str[1] == '#')) {
- int val = xmlParseStringCharRef(ctxt, &str);
- if (val != 0) {
- COPY_BUF(0,buffer,nbchars,val);
- }
- } else if ((c == '&') && (what & XML_SUBSTITUTE_REF)) {
- if (xmlParserDebugEntities)
- xmlGenericError(xmlGenericErrorContext,
- "String decoding Entity Reference: %.30s\n",
- str);
- ent = xmlParseStringEntityRef(ctxt, &str);
- if ((ent != NULL) &&
- (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
- if (ent->content != NULL) {
- COPY_BUF(0,buffer,nbchars,ent->content[0]);
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "internal error entity has no content\n");
- }
- } else if ((ent != NULL) && (ent->content != NULL)) {
- xmlChar *rep;
-
- ctxt->depth++;
- rep = xmlStringDecodeEntities(ctxt, ent->content, what,
- 0, 0, 0);
- ctxt->depth--;
- if (rep != NULL) {
- current = rep;
- while (*current != 0) { /* non input consuming loop */
- buffer[nbchars++] = *current++;
- if (nbchars >
- buffer_size - XML_PARSER_BUFFER_SIZE) {
- growBuffer(buffer);
- }
- }
- xmlFree(rep);
- }
- } else if (ent != NULL) {
- int i = xmlStrlen(ent->name);
- const xmlChar *cur = ent->name;
-
- buffer[nbchars++] = '&';
- if (nbchars > buffer_size - i - XML_PARSER_BUFFER_SIZE) {
- growBuffer(buffer);
- }
- for (;i > 0;i--)
- buffer[nbchars++] = *cur++;
- buffer[nbchars++] = ';';
- }
- } else if (c == '%' && (what & XML_SUBSTITUTE_PEREF)) {
- if (xmlParserDebugEntities)
- xmlGenericError(xmlGenericErrorContext,
- "String decoding PE Reference: %.30s\n", str);
- ent = xmlParseStringPEReference(ctxt, &str);
- if (ent != NULL) {
- xmlChar *rep;
-
- ctxt->depth++;
- rep = xmlStringDecodeEntities(ctxt, ent->content, what,
- 0, 0, 0);
- ctxt->depth--;
- if (rep != NULL) {
- current = rep;
- while (*current != 0) { /* non input consuming loop */
- buffer[nbchars++] = *current++;
- if (nbchars >
- buffer_size - XML_PARSER_BUFFER_SIZE) {
- growBuffer(buffer);
- }
- }
- xmlFree(rep);
- }
- }
- } else {
- COPY_BUF(l,buffer,nbchars,c);
- str += l;
- if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) {
- growBuffer(buffer);
- }
- }
- c = CUR_SCHAR(str, l);
- }
- buffer[nbchars++] = 0;
- return(buffer);
-}
-
-
-/************************************************************************
- * *
- * Commodity functions to handle xmlChars *
- * *
- ************************************************************************/
-
-/**
- * xmlStrndup:
- * @cur: the input xmlChar *
- * @len: the len of @cur
- *
- * a strndup for array of xmlChar's
- *
- * Returns a new xmlChar * or NULL
- */
-xmlChar *
-xmlStrndup(const xmlChar *cur, int len) {
- xmlChar *ret;
-
- if ((cur == NULL) || (len < 0)) return(NULL);
- ret = (xmlChar *) xmlMalloc((len + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %ld byte failed\n",
- (len + 1) * (long)sizeof(xmlChar));
- return(NULL);
- }
- memcpy(ret, cur, len * sizeof(xmlChar));
- ret[len] = 0;
- return(ret);
-}
-
-/**
- * xmlStrdup:
- * @cur: the input xmlChar *
- *
- * a strdup for array of xmlChar's. Since they are supposed to be
- * encoded in UTF-8 or an encoding with 8bit based chars, we assume
- * a termination mark of '0'.
- *
- * Returns a new xmlChar * or NULL
- */
-xmlChar *
-xmlStrdup(const xmlChar *cur) {
- const xmlChar *p = cur;
-
- if (cur == NULL) return(NULL);
- while (*p != 0) p++; /* non input consuming */
- return(xmlStrndup(cur, p - cur));
-}
-
-/**
- * xmlCharStrndup:
- * @cur: the input char *
- * @len: the len of @cur
- *
- * a strndup for char's to xmlChar's
- *
- * Returns a new xmlChar * or NULL
- */
-
-xmlChar *
-xmlCharStrndup(const char *cur, int len) {
- int i;
- xmlChar *ret;
-
- if ((cur == NULL) || (len < 0)) return(NULL);
- ret = (xmlChar *) xmlMalloc((len + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc of %ld byte failed\n",
- (len + 1) * (long)sizeof(xmlChar));
- return(NULL);
- }
- for (i = 0;i < len;i++)
- ret[i] = (xmlChar) cur[i];
- ret[len] = 0;
- return(ret);
-}
-
-/**
- * xmlCharStrdup:
- * @cur: the input char *
- *
- * a strdup for char's to xmlChar's
- *
- * Returns a new xmlChar * or NULL
- */
-
-xmlChar *
-xmlCharStrdup(const char *cur) {
- const char *p = cur;
-
- if (cur == NULL) return(NULL);
- while (*p != '\0') p++; /* non input consuming */
- return(xmlCharStrndup(cur, p - cur));
-}
-
-/**
- * xmlStrcmp:
- * @str1: the first xmlChar *
- * @str2: the second xmlChar *
- *
- * a strcmp for xmlChar's
- *
- * Returns the integer result of the comparison
- */
-
-int
-xmlStrcmp(const xmlChar *str1, const xmlChar *str2) {
- register int tmp;
-
- if (str1 == str2) return(0);
- if (str1 == NULL) return(-1);
- if (str2 == NULL) return(1);
- do {
- tmp = *str1++ - *str2;
- if (tmp != 0) return(tmp);
- } while (*str2++ != 0);
- return 0;
-}
-
-/**
- * xmlStrEqual:
- * @str1: the first xmlChar *
- * @str2: the second xmlChar *
- *
- * Check if both string are equal of have same content
- * Should be a bit more readable and faster than xmlStrEqual()
- *
- * Returns 1 if they are equal, 0 if they are different
- */
-
-int
-xmlStrEqual(const xmlChar *str1, const xmlChar *str2) {
- if (str1 == str2) return(1);
- if (str1 == NULL) return(0);
- if (str2 == NULL) return(0);
- do {
- if (*str1++ != *str2) return(0);
- } while (*str2++);
- return(1);
-}
-
-/**
- * xmlStrncmp:
- * @str1: the first xmlChar *
- * @str2: the second xmlChar *
- * @len: the max comparison length
- *
- * a strncmp for xmlChar's
- *
- * Returns the integer result of the comparison
- */
-
-int
-xmlStrncmp(const xmlChar *str1, const xmlChar *str2, int len) {
- register int tmp;
-
- if (len <= 0) return(0);
- if (str1 == str2) return(0);
- if (str1 == NULL) return(-1);
- if (str2 == NULL) return(1);
- do {
- tmp = *str1++ - *str2;
- if (tmp != 0 || --len == 0) return(tmp);
- } while (*str2++ != 0);
- return 0;
-}
-
-static const xmlChar casemap[256] = {
- 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
- 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
- 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
- 0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
- 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
- 0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
- 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,
- 0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
- 0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,
- 0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
- 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,
- 0x78,0x79,0x7A,0x7B,0x5C,0x5D,0x5E,0x5F,
- 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,
- 0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
- 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,
- 0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F,
- 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,
- 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,
- 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,
- 0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,
- 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,
- 0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,
- 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,
- 0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,
- 0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,
- 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,
- 0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,
- 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,
- 0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
- 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,
- 0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF
-};
-
-/**
- * xmlStrcasecmp:
- * @str1: the first xmlChar *
- * @str2: the second xmlChar *
- *
- * a strcasecmp for xmlChar's
- *
- * Returns the integer result of the comparison
- */
-
-int
-xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2) {
- register int tmp;
-
- if (str1 == str2) return(0);
- if (str1 == NULL) return(-1);
- if (str2 == NULL) return(1);
- do {
- tmp = casemap[*str1++] - casemap[*str2];
- if (tmp != 0) return(tmp);
- } while (*str2++ != 0);
- return 0;
-}
-
-/**
- * xmlStrncasecmp:
- * @str1: the first xmlChar *
- * @str2: the second xmlChar *
- * @len: the max comparison length
- *
- * a strncasecmp for xmlChar's
- *
- * Returns the integer result of the comparison
- */
-
-int
-xmlStrncasecmp(const xmlChar *str1, const xmlChar *str2, int len) {
- register int tmp;
-
- if (len <= 0) return(0);
- if (str1 == str2) return(0);
- if (str1 == NULL) return(-1);
- if (str2 == NULL) return(1);
- do {
- tmp = casemap[*str1++] - casemap[*str2];
- if (tmp != 0 || --len == 0) return(tmp);
- } while (*str2++ != 0);
- return 0;
-}
-
-/**
- * xmlStrchr:
- * @str: the xmlChar * array
- * @val: the xmlChar to search
- *
- * a strchr for xmlChar's
- *
- * Returns the xmlChar * for the first occurrence or NULL.
- */
-
-const xmlChar *
-xmlStrchr(const xmlChar *str, xmlChar val) {
- if (str == NULL) return(NULL);
- while (*str != 0) { /* non input consuming */
- if (*str == val) return((xmlChar *) str);
- str++;
- }
- return(NULL);
-}
-
-/**
- * xmlStrstr:
- * @str: the xmlChar * array (haystack)
- * @val: the xmlChar to search (needle)
- *
- * a strstr for xmlChar's
- *
- * Returns the xmlChar * for the first occurrence or NULL.
- */
-
-const xmlChar *
-xmlStrstr(const xmlChar *str, const xmlChar *val) {
- int n;
-
- if (str == NULL) return(NULL);
- if (val == NULL) return(NULL);
- n = xmlStrlen(val);
-
- if (n == 0) return(str);
- while (*str != 0) { /* non input consuming */
- if (*str == *val) {
- if (!xmlStrncmp(str, val, n)) return((const xmlChar *) str);
- }
- str++;
- }
- return(NULL);
-}
-
-/**
- * xmlStrcasestr:
- * @str: the xmlChar * array (haystack)
- * @val: the xmlChar to search (needle)
- *
- * a case-ignoring strstr for xmlChar's
- *
- * Returns the xmlChar * for the first occurrence or NULL.
- */
-
-const xmlChar *
-xmlStrcasestr(const xmlChar *str, xmlChar *val) {
- int n;
-
- if (str == NULL) return(NULL);
- if (val == NULL) return(NULL);
- n = xmlStrlen(val);
-
- if (n == 0) return(str);
- while (*str != 0) { /* non input consuming */
- if (casemap[*str] == casemap[*val])
- if (!xmlStrncasecmp(str, val, n)) return(str);
- str++;
- }
- return(NULL);
-}
-
-/**
- * xmlStrsub:
- * @str: the xmlChar * array (haystack)
- * @start: the index of the first char (zero based)
- * @len: the length of the substring
- *
- * Extract a substring of a given string
- *
- * Returns the xmlChar * for the first occurrence or NULL.
- */
-
-xmlChar *
-xmlStrsub(const xmlChar *str, int start, int len) {
- int i;
-
- if (str == NULL) return(NULL);
- if (start < 0) return(NULL);
- if (len < 0) return(NULL);
-
- for (i = 0;i < start;i++) {
- if (*str == 0) return(NULL);
- str++;
- }
- if (*str == 0) return(NULL);
- return(xmlStrndup(str, len));
-}
-
-/**
- * xmlStrlen:
- * @str: the xmlChar * array
- *
- * length of a xmlChar's string
- *
- * Returns the number of xmlChar contained in the ARRAY.
- */
-
-int
-xmlStrlen(const xmlChar *str) {
- int len = 0;
-
- if (str == NULL) return(0);
- while (*str != 0) { /* non input consuming */
- str++;
- len++;
- }
- return(len);
-}
-
-/**
- * xmlStrncat:
- * @cur: the original xmlChar * array
- * @add: the xmlChar * array added
- * @len: the length of @add
- *
- * a strncat for array of xmlChar's, it will extend @cur with the len
- * first bytes of @add.
- *
- * Returns a new xmlChar *, the original @cur is reallocated if needed
- * and should not be freed
- */
-
-xmlChar *
-xmlStrncat(xmlChar *cur, const xmlChar *add, int len) {
- int size;
- xmlChar *ret;
-
- if ((add == NULL) || (len == 0))
- return(cur);
- if (cur == NULL)
- return(xmlStrndup(add, len));
-
- size = xmlStrlen(cur);
- ret = (xmlChar *) xmlRealloc(cur, (size + len + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlStrncat: realloc of %ld byte failed\n",
- (size + len + 1) * (long)sizeof(xmlChar));
- return(cur);
- }
- memcpy(&ret[size], add, len * sizeof(xmlChar));
- ret[size + len] = 0;
- return(ret);
-}
-
-/**
- * xmlStrcat:
- * @cur: the original xmlChar * array
- * @add: the xmlChar * array added
- *
- * a strcat for array of xmlChar's. Since they are supposed to be
- * encoded in UTF-8 or an encoding with 8bit based chars, we assume
- * a termination mark of '0'.
- *
- * Returns a new xmlChar * containing the concatenated string.
- */
-xmlChar *
-xmlStrcat(xmlChar *cur, const xmlChar *add) {
- const xmlChar *p = add;
-
- if (add == NULL) return(cur);
- if (cur == NULL)
- return(xmlStrdup(add));
-
- while (*p != 0) p++; /* non input consuming */
- return(xmlStrncat(cur, add, p - add));
-}
-
-/************************************************************************
- * *
- * Commodity functions, cleanup needed ? *
- * *
- ************************************************************************/
-
-/**
- * areBlanks:
- * @ctxt: an XML parser context
- * @str: a xmlChar *
- * @len: the size of @str
- *
- * Is this a sequence of blank chars that one can ignore ?
- *
- * Returns 1 if ignorable 0 otherwise.
- */
-
-static int areBlanks(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
- int i, ret;
- xmlNodePtr lastChild;
-
- /*
- * Don't spend time trying to differentiate them, the same callback is
- * used !
- */
- if (ctxt->sax->ignorableWhitespace == ctxt->sax->characters)
- return(0);
-
- /*
- * Check for xml:space value.
- */
- if (*(ctxt->space) == 1)
- return(0);
-
- /*
- * Check that the string is made of blanks
- */
- for (i = 0;i < len;i++)
- if (!(IS_BLANK(str[i]))) return(0);
-
- /*
- * Look if the element is mixed content in the DTD if available
- */
- if (ctxt->node == NULL) return(0);
- if (ctxt->myDoc != NULL) {
- ret = xmlIsMixedElement(ctxt->myDoc, ctxt->node->name);
- if (ret == 0) return(1);
- if (ret == 1) return(0);
- }
-
- /*
- * Otherwise, heuristic :-\
- */
- if (RAW != '<') return(0);
- if ((ctxt->node->children == NULL) &&
- (RAW == '<') && (NXT(1) == '/')) return(0);
-
- lastChild = xmlGetLastChild(ctxt->node);
- if (lastChild == NULL) {
- if ((ctxt->node->type != XML_ELEMENT_NODE) &&
- (ctxt->node->content != NULL)) return(0);
- } else if (xmlNodeIsText(lastChild))
- return(0);
- else if ((ctxt->node->children != NULL) &&
- (xmlNodeIsText(ctxt->node->children)))
- return(0);
- return(1);
-}
-
-/************************************************************************
- * *
- * Extra stuff for namespace support *
- * Relates to http://www.w3.org/TR/WD-xml-names *
- * *
- ************************************************************************/
-
-/**
- * xmlSplitQName:
- * @ctxt: an XML parser context
- * @name: an XML parser context
- * @prefix: a xmlChar **
- *
- * parse an UTF8 encoded XML qualified name string
- *
- * [NS 5] QName ::= (Prefix ':')? LocalPart
- *
- * [NS 6] Prefix ::= NCName
- *
- * [NS 7] LocalPart ::= NCName
- *
- * Returns the local part, and prefix is updated
- * to get the Prefix if any.
- */
-
-xmlChar *
-xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
- xmlChar buf[XML_MAX_NAMELEN + 5];
- xmlChar *buffer = NULL;
- int len = 0;
- int max = XML_MAX_NAMELEN;
- xmlChar *ret = NULL;
- const xmlChar *cur = name;
- int c;
-
- *prefix = NULL;
-
-#ifndef XML_XML_NAMESPACE
- /* xml: prefix is not really a namespace */
- if ((cur[0] == 'x') && (cur[1] == 'm') &&
- (cur[2] == 'l') && (cur[3] == ':'))
- return(xmlStrdup(name));
-#endif
-
- /* nasty but valid */
- if (cur[0] == ':')
- return(xmlStrdup(name));
-
- c = *cur++;
- while ((c != 0) && (c != ':') && (len < max)) { /* tested bigname.xml */
- buf[len++] = c;
- c = *cur++;
- }
- if (len >= max) {
- /*
- * Okay someone managed to make a huge name, so he's ready to pay
- * for the processing speed.
- */
- max = len * 2;
-
- buffer = (xmlChar *) xmlMalloc(max * sizeof(xmlChar));
- if (buffer == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlSplitQName: out of memory\n");
- return(NULL);
- }
- memcpy(buffer, buf, len);
- while ((c != 0) && (c != ':')) { /* tested bigname.xml */
- if (len + 10 > max) {
- max *= 2;
- buffer = (xmlChar *) xmlRealloc(buffer,
- max * sizeof(xmlChar));
- if (buffer == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlSplitQName: out of memory\n");
- return(NULL);
- }
- }
- buffer[len++] = c;
- c = *cur++;
- }
- buffer[len] = 0;
- }
-
- if (buffer == NULL)
- ret = xmlStrndup(buf, len);
- else {
- ret = buffer;
- buffer = NULL;
- max = XML_MAX_NAMELEN;
- }
-
-
- if (c == ':') {
- c = *cur;
- if (c == 0) return(ret);
- *prefix = ret;
- len = 0;
-
- /*
- * Check that the first character is proper to start
- * a new name
- */
- if (!(((c >= 0x61) && (c <= 0x7A)) ||
- ((c >= 0x41) && (c <= 0x5A)) ||
- (c == '_') || (c == ':'))) {
- int l;
- int first = CUR_SCHAR(cur, l);
-
- if (!IS_LETTER(first) && (first != '_')) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Name %s is not XML Namespace compliant\n",
- name);
- }
- }
- cur++;
-
- while ((c != 0) && (len < max)) { /* tested bigname2.xml */
- buf[len++] = c;
- c = *cur++;
- }
- if (len >= max) {
- /*
- * Okay someone managed to make a huge name, so he's ready to pay
- * for the processing speed.
- */
- max = len * 2;
-
- buffer = (xmlChar *) xmlMalloc(max * sizeof(xmlChar));
- if (buffer == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlSplitQName: out of memory\n");
- return(NULL);
- }
- memcpy(buffer, buf, len);
- while (c != 0) { /* tested bigname2.xml */
- if (len + 10 > max) {
- max *= 2;
- buffer = (xmlChar *) xmlRealloc(buffer,
- max * sizeof(xmlChar));
- if (buffer == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlSplitQName: out of memory\n");
- return(NULL);
- }
- }
- buffer[len++] = c;
- c = *cur++;
- }
- buffer[len] = 0;
- }
-
- if (buffer == NULL)
- ret = xmlStrndup(buf, len);
- else {
- ret = buffer;
- }
- }
-
- return(ret);
-}
-
-/************************************************************************
- * *
- * The parser itself *
- * Relates to http://www.w3.org/TR/REC-xml *
- * *
- ************************************************************************/
-
-static xmlChar * xmlParseNameComplex(xmlParserCtxtPtr ctxt);
-/**
- * xmlParseName:
- * @ctxt: an XML parser context
- *
- * parse an XML name.
- *
- * [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |
- * CombiningChar | Extender
- *
- * [5] Name ::= (Letter | '_' | ':') (NameChar)*
- *
- * [6] Names ::= Name (S Name)*
- *
- * Returns the Name parsed or NULL
- */
-
-xmlChar *
-xmlParseName(xmlParserCtxtPtr ctxt) {
- const xmlChar *in;
- xmlChar *ret;
- int count = 0;
-
- GROW;
-
- /*
- * Accelerator for simple ASCII names
- */
- in = ctxt->input->cur;
- if (((*in >= 0x61) && (*in <= 0x7A)) ||
- ((*in >= 0x41) && (*in <= 0x5A)) ||
- (*in == '_') || (*in == ':')) {
- in++;
- while (((*in >= 0x61) && (*in <= 0x7A)) ||
- ((*in >= 0x41) && (*in <= 0x5A)) ||
- ((*in >= 0x30) && (*in <= 0x39)) ||
- (*in == '_') || (*in == '-') ||
- (*in == ':') || (*in == '.'))
- in++;
- if ((*in > 0) && (*in < 0x80)) {
- count = in - ctxt->input->cur;
- ret = xmlStrndup(ctxt->input->cur, count);
- ctxt->input->cur = in;
- return(ret);
- }
- }
- return(xmlParseNameComplex(ctxt));
-}
-
-/**
- * xmlParseNameAndCompare:
- * @ctxt: an XML parser context
- *
- * parse an XML name and compares for match
- * (specialized for endtag parsing)
- *
- *
- * Returns NULL for an illegal name, (xmlChar*) 1 for success
- * and the name for mismatch
- */
-
-static xmlChar *
-xmlParseNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *other) {
- const xmlChar *cmp = other;
- const xmlChar *in;
- xmlChar *ret;
-
- GROW;
-
- in = ctxt->input->cur;
- while (*in != 0 && *in == *cmp) {
- ++in;
- ++cmp;
- }
- if (*cmp == 0 && (*in == '>' || IS_BLANK (*in))) {
- /* success */
- ctxt->input->cur = in;
- return (xmlChar*) 1;
- }
- /* failure (or end of input buffer), check with full function */
- ret = xmlParseName (ctxt);
- if (ret != 0 && xmlStrEqual (ret, other)) {
- xmlFree (ret);
- return (xmlChar*) 1;
- }
- return ret;
-}
-
-static xmlChar *
-xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
- xmlChar buf[XML_MAX_NAMELEN + 5];
- int len = 0, l;
- int c;
- int count = 0;
-
- /*
- * Handler for more complex cases
- */
- GROW;
- c = CUR_CHAR(l);
- if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */
- (!IS_LETTER(c) && (c != '_') &&
- (c != ':'))) {
- return(NULL);
- }
-
- while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */
- ((IS_LETTER(c)) || (IS_DIGIT(c)) ||
- (c == '.') || (c == '-') ||
- (c == '_') || (c == ':') ||
- (IS_COMBINING(c)) ||
- (IS_EXTENDER(c)))) {
- if (count++ > 100) {
- count = 0;
- GROW;
- }
- COPY_BUF(l,buf,len,c);
- NEXTL(l);
- c = CUR_CHAR(l);
- if (len >= XML_MAX_NAMELEN) {
- /*
- * Okay someone managed to make a huge name, so he's ready to pay
- * for the processing speed.
- */
- xmlChar *buffer;
- int max = len * 2;
-
- buffer = (xmlChar *) xmlMalloc(max * sizeof(xmlChar));
- if (buffer == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseNameComplex: out of memory\n");
- return(NULL);
- }
- memcpy(buffer, buf, len);
- while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigname.xml */
- (c == '.') || (c == '-') ||
- (c == '_') || (c == ':') ||
- (IS_COMBINING(c)) ||
- (IS_EXTENDER(c))) {
- if (count++ > 100) {
- count = 0;
- GROW;
- }
- if (len + 10 > max) {
- max *= 2;
- buffer = (xmlChar *) xmlRealloc(buffer,
- max * sizeof(xmlChar));
- if (buffer == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseNameComplex: out of memory\n");
- return(NULL);
- }
- }
- COPY_BUF(l,buffer,len,c);
- NEXTL(l);
- c = CUR_CHAR(l);
- }
- buffer[len] = 0;
- return(buffer);
- }
- }
- return(xmlStrndup(buf, len));
-}
-
-/**
- * xmlParseStringName:
- * @ctxt: an XML parser context
- * @str: a pointer to the string pointer (IN/OUT)
- *
- * parse an XML name.
- *
- * [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |
- * CombiningChar | Extender
- *
- * [5] Name ::= (Letter | '_' | ':') (NameChar)*
- *
- * [6] Names ::= Name (S Name)*
- *
- * Returns the Name parsed or NULL. The @str pointer
- * is updated to the current location in the string.
- */
-
-static xmlChar *
-xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
- xmlChar buf[XML_MAX_NAMELEN + 5];
- const xmlChar *cur = *str;
- int len = 0, l;
- int c;
-
- c = CUR_SCHAR(cur, l);
- if (!IS_LETTER(c) && (c != '_') &&
- (c != ':')) {
- return(NULL);
- }
-
- while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigentname.xml */
- (c == '.') || (c == '-') ||
- (c == '_') || (c == ':') ||
- (IS_COMBINING(c)) ||
- (IS_EXTENDER(c))) {
- COPY_BUF(l,buf,len,c);
- cur += l;
- c = CUR_SCHAR(cur, l);
- if (len >= XML_MAX_NAMELEN) { /* test bigentname.xml */
- /*
- * Okay someone managed to make a huge name, so he's ready to pay
- * for the processing speed.
- */
- xmlChar *buffer;
- int max = len * 2;
-
- buffer = (xmlChar *) xmlMalloc(max * sizeof(xmlChar));
- if (buffer == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseStringName: out of memory\n");
- return(NULL);
- }
- memcpy(buffer, buf, len);
- while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigentname.xml */
- (c == '.') || (c == '-') ||
- (c == '_') || (c == ':') ||
- (IS_COMBINING(c)) ||
- (IS_EXTENDER(c))) {
- if (len + 10 > max) {
- max *= 2;
- buffer = (xmlChar *) xmlRealloc(buffer,
- max * sizeof(xmlChar));
- if (buffer == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseStringName: out of memory\n");
- return(NULL);
- }
- }
- COPY_BUF(l,buffer,len,c);
- cur += l;
- c = CUR_SCHAR(cur, l);
- }
- buffer[len] = 0;
- *str = cur;
- return(buffer);
- }
- }
- *str = cur;
- return(xmlStrndup(buf, len));
-}
-
-/**
- * xmlParseNmtoken:
- * @ctxt: an XML parser context
- *
- * parse an XML Nmtoken.
- *
- * [7] Nmtoken ::= (NameChar)+
- *
- * [8] Nmtokens ::= Nmtoken (S Nmtoken)*
- *
- * Returns the Nmtoken parsed or NULL
- */
-
-xmlChar *
-xmlParseNmtoken(xmlParserCtxtPtr ctxt) {
- xmlChar buf[XML_MAX_NAMELEN + 5];
- int len = 0, l;
- int c;
- int count = 0;
-
- GROW;
- c = CUR_CHAR(l);
-
- while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigtoken.xml */
- (c == '.') || (c == '-') ||
- (c == '_') || (c == ':') ||
- (IS_COMBINING(c)) ||
- (IS_EXTENDER(c))) {
- if (count++ > 100) {
- count = 0;
- GROW;
- }
- COPY_BUF(l,buf,len,c);
- NEXTL(l);
- c = CUR_CHAR(l);
- if (len >= XML_MAX_NAMELEN) {
- /*
- * Okay someone managed to make a huge token, so he's ready to pay
- * for the processing speed.
- */
- xmlChar *buffer;
- int max = len * 2;
-
- buffer = (xmlChar *) xmlMalloc(max * sizeof(xmlChar));
- if (buffer == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseNmtoken: out of memory\n");
- return(NULL);
- }
- memcpy(buffer, buf, len);
- while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigtoken.xml */
- (c == '.') || (c == '-') ||
- (c == '_') || (c == ':') ||
- (IS_COMBINING(c)) ||
- (IS_EXTENDER(c))) {
- if (count++ > 100) {
- count = 0;
- GROW;
- }
- if (len + 10 > max) {
- max *= 2;
- buffer = (xmlChar *) xmlRealloc(buffer,
- max * sizeof(xmlChar));
- if (buffer == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseNmtoken: out of memory\n");
- return(NULL);
- }
- }
- COPY_BUF(l,buffer,len,c);
- NEXTL(l);
- c = CUR_CHAR(l);
- }
- buffer[len] = 0;
- return(buffer);
- }
- }
- if (len == 0)
- return(NULL);
- return(xmlStrndup(buf, len));
-}
-
-/**
- * xmlParseEntityValue:
- * @ctxt: an XML parser context
- * @orig: if non-NULL store a copy of the original entity value
- *
- * parse a value for ENTITY declarations
- *
- * [9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' |
- * "'" ([^%&'] | PEReference | Reference)* "'"
- *
- * Returns the EntityValue parsed with reference substituted or NULL
- */
-
-xmlChar *
-xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
- xmlChar *buf = NULL;
- int len = 0;
- int size = XML_PARSER_BUFFER_SIZE;
- int c, l;
- xmlChar stop;
- xmlChar *ret = NULL;
- const xmlChar *cur = NULL;
- xmlParserInputPtr input;
-
- if (RAW == '"') stop = '"';
- else if (RAW == '\'') stop = '\'';
- else {
- ctxt->errNo = XML_ERR_ENTITY_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "EntityValue: \" or ' expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(NULL);
- }
- buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", size);
- return(NULL);
- }
-
- /*
- * The content of the entity definition is copied in a buffer.
- */
-
- ctxt->instate = XML_PARSER_ENTITY_VALUE;
- input = ctxt->input;
- GROW;
- NEXT;
- c = CUR_CHAR(l);
- /*
- * NOTE: 4.4.5 Included in Literal
- * When a parameter entity reference appears in a literal entity
- * value, ... a single or double quote character in the replacement
- * text is always treated as a normal data character and will not
- * terminate the literal.
- * In practice it means we stop the loop only when back at parsing
- * the initial entity and the quote is found
- */
- while ((IS_CHAR(c)) && ((c != stop) || /* checked */
- (ctxt->input != input))) {
- if (len + 5 >= size) {
- size *= 2;
- buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %d byte failed\n", size);
- return(NULL);
- }
- }
- COPY_BUF(l,buf,len,c);
- NEXTL(l);
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1)) /* non input consuming */
- xmlPopInput(ctxt);
-
- GROW;
- c = CUR_CHAR(l);
- if (c == 0) {
- GROW;
- c = CUR_CHAR(l);
- }
- }
- buf[len] = 0;
-
- /*
- * Raise problem w.r.t. '&' and '%' being used in non-entities
- * reference constructs. Note Charref will be handled in
- * xmlStringDecodeEntities()
- */
- cur = buf;
- while (*cur != 0) { /* non input consuming */
- if ((*cur == '%') || ((*cur == '&') && (cur[1] != '#'))) {
- xmlChar *name;
- xmlChar tmp = *cur;
-
- cur++;
- name = xmlParseStringName(ctxt, &cur);
- if ((name == NULL) || (*cur != ';')) {
- ctxt->errNo = XML_ERR_ENTITY_CHAR_ERROR;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "EntityValue: '%c' forbidden except for entities references\n",
- tmp);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if ((tmp == '%') && (ctxt->inSubset == 1) &&
- (ctxt->inputNr == 1)) {
- ctxt->errNo = XML_ERR_ENTITY_PE_INTERNAL;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "EntityValue: PEReferences forbidden in internal subset\n",
- tmp);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if (name != NULL)
- xmlFree(name);
- }
- cur++;
- }
-
- /*
- * Then PEReference entities are substituted.
- */
- if (c != stop) {
- ctxt->errNo = XML_ERR_ENTITY_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "EntityValue: \" expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- xmlFree(buf);
- } else {
- NEXT;
- /*
- * NOTE: 4.4.7 Bypassed
- * When a general entity reference appears in the EntityValue in
- * an entity declaration, it is bypassed and left as is.
- * so XML_SUBSTITUTE_REF is not set here.
- */
- ret = xmlStringDecodeEntities(ctxt, buf, XML_SUBSTITUTE_PEREF,
- 0, 0, 0);
- if (orig != NULL)
- *orig = buf;
- else
- xmlFree(buf);
- }
-
- return(ret);
-}
-
-/**
- * xmlParseAttValue:
- * @ctxt: an XML parser context
- *
- * parse a value for an attribute
- * Note: the parser won't do substitution of entities here, this
- * will be handled later in xmlStringGetNodeList
- *
- * [10] AttValue ::= '"' ([^<&"] | Reference)* '"' |
- * "'" ([^<&'] | Reference)* "'"
- *
- * 3.3.3 Attribute-Value Normalization:
- * Before the value of an attribute is passed to the application or
- * checked for validity, the XML processor must normalize it as follows:
- * - a character reference is processed by appending the referenced
- * character to the attribute value
- * - an entity reference is processed by recursively processing the
- * replacement text of the entity
- * - a whitespace character (#x20, #xD, #xA, #x9) is processed by
- * appending #x20 to the normalized value, except that only a single
- * #x20 is appended for a "#xD#xA" sequence that is part of an external
- * parsed entity or the literal entity value of an internal parsed entity
- * - other characters are processed by appending them to the normalized value
- * If the declared value is not CDATA, then the XML processor must further
- * process the normalized attribute value by discarding any leading and
- * trailing space (#x20) characters, and by replacing sequences of space
- * (#x20) characters by a single space (#x20) character.
- * All attributes for which no declaration has been read should be treated
- * by a non-validating parser as if declared CDATA.
- *
- * Returns the AttValue parsed or NULL. The value has to be freed by the caller.
- */
-
-xmlChar *
-xmlParseAttValueComplex(xmlParserCtxtPtr ctxt);
-
-xmlChar *
-xmlParseAttValue(xmlParserCtxtPtr ctxt) {
- xmlChar limit = 0;
- const xmlChar *in = NULL;
- xmlChar *ret = NULL;
- SHRINK;
- GROW;
- in = (xmlChar *) CUR_PTR;
- if (*in != '"' && *in != '\'') {
- ctxt->errNo = XML_ERR_ATTRIBUTE_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "AttValue: \" or ' expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(NULL);
- }
- ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE;
- limit = *in;
- ++in;
-
- while (*in != limit && *in >= 0x20 && *in <= 0x7f &&
- *in != '&' && *in != '<'
- ) {
- ++in;
- }
- if (*in != limit) {
- return xmlParseAttValueComplex(ctxt);
- }
- ++in;
- ret = xmlStrndup (CUR_PTR + 1, in - CUR_PTR - 2);
- CUR_PTR = in;
- return ret;
-}
-
-/**
- * xmlParseAttValueComplex:
- * @ctxt: an XML parser context
- *
- * parse a value for an attribute, this is the fallback function
- * of xmlParseAttValue() when the attribute parsing requires handling
- * of non-ASCII characters.
- *
- * Returns the AttValue parsed or NULL. The value has to be freed by the caller.
- */
-xmlChar *
-xmlParseAttValueComplex(xmlParserCtxtPtr ctxt) {
- xmlChar limit = 0;
- xmlChar *buf = NULL;
- int len = 0;
- int buf_size = 0;
- int c, l;
- xmlChar *current = NULL;
- xmlEntityPtr ent;
-
-
- SHRINK;
- if (NXT(0) == '"') {
- ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE;
- limit = '"';
- NEXT;
- } else if (NXT(0) == '\'') {
- limit = '\'';
- ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE;
- NEXT;
- } else {
- ctxt->errNo = XML_ERR_ATTRIBUTE_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "AttValue: \" or ' expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(NULL);
- }
-
- /*
- * allocate a translation buffer.
- */
- buf_size = XML_PARSER_BUFFER_SIZE;
- buf = (xmlChar *) xmlMalloc(buf_size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParseAttValue: malloc failed");
- return(NULL);
- }
-
- /*
- * OK loop until we reach one of the ending char or a size limit.
- */
- c = CUR_CHAR(l);
- while ((NXT(0) != limit) && /* checked */
- (c != '<')) {
- if (c == 0) break;
- if (c == '&') {
- if (NXT(1) == '#') {
- int val = xmlParseCharRef(ctxt);
- if (val == '&') {
- if (ctxt->replaceEntities) {
- if (len > buf_size - 10) {
- growBuffer(buf);
- }
- buf[len++] = '&';
- } else {
- /*
- * The reparsing will be done in xmlStringGetNodeList()
- * called by the attribute() function in SAX.c
- */
- static xmlChar buffer[6] = "&#38;";
-
- if (len > buf_size - 10) {
- growBuffer(buf);
- }
- current = &buffer[0];
- while (*current != 0) { /* non input consuming */
- buf[len++] = *current++;
- }
- }
- } else {
- if (len > buf_size - 10) {
- growBuffer(buf);
- }
- len += xmlCopyChar(0, &buf[len], val);
- }
- } else {
- ent = xmlParseEntityRef(ctxt);
- if ((ent != NULL) &&
- (ctxt->replaceEntities != 0)) {
- xmlChar *rep;
-
- if (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) {
- rep = xmlStringDecodeEntities(ctxt, ent->content,
- XML_SUBSTITUTE_REF, 0, 0, 0);
- if (rep != NULL) {
- current = rep;
- while (*current != 0) { /* non input consuming */
- buf[len++] = *current++;
- if (len > buf_size - 10) {
- growBuffer(buf);
- }
- }
- xmlFree(rep);
- }
- } else {
- if (len > buf_size - 10) {
- growBuffer(buf);
- }
- if (ent->content != NULL)
- buf[len++] = ent->content[0];
- }
- } else if (ent != NULL) {
- int i = xmlStrlen(ent->name);
- const xmlChar *cur = ent->name;
-
- /*
- * This may look absurd but is needed to detect
- * entities problems
- */
- if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) &&
- (ent->content != NULL)) {
- xmlChar *rep;
- rep = xmlStringDecodeEntities(ctxt, ent->content,
- XML_SUBSTITUTE_REF, 0, 0, 0);
- if (rep != NULL)
- xmlFree(rep);
- }
-
- /*
- * Just output the reference
- */
- buf[len++] = '&';
- if (len > buf_size - i - 10) {
- growBuffer(buf);
- }
- for (;i > 0;i--)
- buf[len++] = *cur++;
- buf[len++] = ';';
- }
- }
- } else {
- if ((c == 0x20) || (c == 0xD) || (c == 0xA) || (c == 0x9)) {
- COPY_BUF(l,buf,len,0x20);
- if (len > buf_size - 10) {
- growBuffer(buf);
- }
- } else {
- COPY_BUF(l,buf,len,c);
- if (len > buf_size - 10) {
- growBuffer(buf);
- }
- }
- NEXTL(l);
- }
- GROW;
- c = CUR_CHAR(l);
- }
- buf[len++] = 0;
- if (RAW == '<') {
- ctxt->errNo = XML_ERR_LT_IN_ATTRIBUTE;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Unescaped '<' not allowed in attributes values\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else if (RAW != limit) {
- ctxt->errNo = XML_ERR_ATTRIBUTE_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "AttValue: ' expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else
- NEXT;
- return(buf);
-}
-
-/**
- * xmlParseSystemLiteral:
- * @ctxt: an XML parser context
- *
- * parse an XML Literal
- *
- * [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")
- *
- * Returns the SystemLiteral parsed or NULL
- */
-
-xmlChar *
-xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) {
- xmlChar *buf = NULL;
- int len = 0;
- int size = XML_PARSER_BUFFER_SIZE;
- int cur, l;
- xmlChar stop;
- int state = ctxt->instate;
- int count = 0;
-
- SHRINK;
- if (RAW == '"') {
- NEXT;
- stop = '"';
- } else if (RAW == '\'') {
- NEXT;
- stop = '\'';
- } else {
- ctxt->errNo = XML_ERR_LITERAL_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "SystemLiteral \" or ' expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(NULL);
- }
-
- buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", size);
- return(NULL);
- }
- ctxt->instate = XML_PARSER_SYSTEM_LITERAL;
- cur = CUR_CHAR(l);
- while ((IS_CHAR(cur)) && (cur != stop)) { /* checked */
- if (len + 5 >= size) {
- size *= 2;
- buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %d byte failed\n", size);
- ctxt->instate = (xmlParserInputState) state;
- return(NULL);
- }
- }
- count++;
- if (count > 50) {
- GROW;
- count = 0;
- }
- COPY_BUF(l,buf,len,cur);
- NEXTL(l);
- cur = CUR_CHAR(l);
- if (cur == 0) {
- GROW;
- SHRINK;
- cur = CUR_CHAR(l);
- }
- }
- buf[len] = 0;
- ctxt->instate = (xmlParserInputState) state;
- if (!IS_CHAR(cur)) {
- ctxt->errNo = XML_ERR_LITERAL_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Unfinished SystemLiteral\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- NEXT;
- }
- return(buf);
-}
-
-/**
- * xmlParsePubidLiteral:
- * @ctxt: an XML parser context
- *
- * parse an XML public literal
- *
- * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
- *
- * Returns the PubidLiteral parsed or NULL.
- */
-
-xmlChar *
-xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
- xmlChar *buf = NULL;
- int len = 0;
- int size = XML_PARSER_BUFFER_SIZE;
- xmlChar cur;
- xmlChar stop;
- int count = 0;
- xmlParserInputState oldstate = ctxt->instate;
-
- SHRINK;
- if (RAW == '"') {
- NEXT;
- stop = '"';
- } else if (RAW == '\'') {
- NEXT;
- stop = '\'';
- } else {
- ctxt->errNo = XML_ERR_LITERAL_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "SystemLiteral \" or ' expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(NULL);
- }
- buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", size);
- return(NULL);
- }
- ctxt->instate = XML_PARSER_PUBLIC_LITERAL;
- cur = CUR;
- while ((IS_PUBIDCHAR(cur)) && (cur != stop)) { /* checked */
- if (len + 1 >= size) {
- size *= 2;
- buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %d byte failed\n", size);
- return(NULL);
- }
- }
- buf[len++] = cur;
- count++;
- if (count > 50) {
- GROW;
- count = 0;
- }
- NEXT;
- cur = CUR;
- if (cur == 0) {
- GROW;
- SHRINK;
- cur = CUR;
- }
- }
- buf[len] = 0;
- if (cur != stop) {
- ctxt->errNo = XML_ERR_LITERAL_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Unfinished PubidLiteral\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- NEXT;
- }
- ctxt->instate = oldstate;
- return(buf);
-}
-
-void xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata);
-/**
- * xmlParseCharData:
- * @ctxt: an XML parser context
- * @cdata: int indicating whether we are within a CDATA section
- *
- * parse a CharData section.
- * if we are within a CDATA section ']]>' marks an end of section.
- *
- * The right angle bracket (>) may be represented using the string "&gt;",
- * and must, for compatibility, be escaped using "&gt;" or a character
- * reference when it appears in the string "]]>" in content, when that
- * string is not marking the end of a CDATA section.
- *
- * [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)
- */
-
-void
-xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) {
- const xmlChar *in;
- int nbchar = 0;
- int line = ctxt->input->line;
- int col = ctxt->input->col;
-
- SHRINK;
- GROW;
- /*
- * Accelerated common case where input don't need to be
- * modified before passing it to the handler.
- */
- if (!cdata) {
- in = ctxt->input->cur;
- do {
-get_more:
- while (((*in >= 0x20) && (*in != '<') && (*in != ']') &&
- (*in != '&') && (*in <= 0x7F)) || (*in == 0x09))
- in++;
- if (*in == 0xA) {
- ctxt->input->line++;
- in++;
- while (*in == 0xA) {
- ctxt->input->line++;
- in++;
- }
- goto get_more;
- }
- if (*in == ']') {
- if ((in[1] == ']') && (in[2] == '>')) {
- ctxt->errNo = XML_ERR_MISPLACED_CDATA_END;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Sequence ']]>' not allowed in content\n");
- ctxt->input->cur = in;
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return;
- }
- in++;
- goto get_more;
- }
- nbchar = in - ctxt->input->cur;
- if (nbchar > 0) {
- if (IS_BLANK(*ctxt->input->cur)) {
- const xmlChar *tmp = ctxt->input->cur;
- ctxt->input->cur = in;
- if (areBlanks(ctxt, tmp, nbchar)) {
- if (ctxt->sax->ignorableWhitespace != NULL)
- ctxt->sax->ignorableWhitespace(ctxt->userData,
- tmp, nbchar);
- } else {
- if (ctxt->sax->characters != NULL)
- ctxt->sax->characters(ctxt->userData,
- tmp, nbchar);
- }
- line = ctxt->input->line;
- col = ctxt->input->col;
- } else {
- if (ctxt->sax->characters != NULL)
- ctxt->sax->characters(ctxt->userData,
- ctxt->input->cur, nbchar);
- line = ctxt->input->line;
- col = ctxt->input->col;
- }
- }
- ctxt->input->cur = in;
- if (*in == 0xD) {
- in++;
- if (*in == 0xA) {
- ctxt->input->cur = in;
- in++;
- ctxt->input->line++;
- continue; /* while */
- }
- in--;
- }
- if (*in == '<') {
- return;
- }
- if (*in == '&') {
- return;
- }
- SHRINK;
- GROW;
- in = ctxt->input->cur;
- } while ((*in >= 0x20) && (*in <= 0x7F));
- nbchar = 0;
- }
- ctxt->input->line = line;
- ctxt->input->col = col;
- xmlParseCharDataComplex(ctxt, cdata);
-}
-
-/**
- * xmlParseCharDataComplex:
- * @ctxt: an XML parser context
- * @cdata: int indicating whether we are within a CDATA section
- *
- * parse a CharData section.this is the fallback function
- * of xmlParseCharData() when the parsing requires handling
- * of non-ASCII characters.
- */
-void
-xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) {
- xmlChar buf[XML_PARSER_BIG_BUFFER_SIZE + 5];
- int nbchar = 0;
- int cur, l;
- int count = 0;
-
- SHRINK;
- GROW;
- cur = CUR_CHAR(l);
- while ((cur != '<') && /* checked */
- (cur != '&') &&
- (IS_CHAR(cur))) /* test also done in xmlCurrentChar() */ {
- if ((cur == ']') && (NXT(1) == ']') &&
- (NXT(2) == '>')) {
- if (cdata) break;
- else {
- ctxt->errNo = XML_ERR_MISPLACED_CDATA_END;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Sequence ']]>' not allowed in content\n");
- /* Should this be relaxed ??? I see a "must here */
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- }
- COPY_BUF(l,buf,nbchar,cur);
- if (nbchar >= XML_PARSER_BIG_BUFFER_SIZE) {
- /*
- * OK the segment is to be consumed as chars.
- */
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) {
- if (areBlanks(ctxt, buf, nbchar)) {
- if (ctxt->sax->ignorableWhitespace != NULL)
- ctxt->sax->ignorableWhitespace(ctxt->userData,
- buf, nbchar);
- } else {
- if (ctxt->sax->characters != NULL)
- ctxt->sax->characters(ctxt->userData, buf, nbchar);
- }
- }
- nbchar = 0;
- }
- count++;
- if (count > 50) {
- GROW;
- count = 0;
- }
- NEXTL(l);
- cur = CUR_CHAR(l);
- }
- if (nbchar != 0) {
- /*
- * OK the segment is to be consumed as chars.
- */
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) {
- if (areBlanks(ctxt, buf, nbchar)) {
- if (ctxt->sax->ignorableWhitespace != NULL)
- ctxt->sax->ignorableWhitespace(ctxt->userData, buf, nbchar);
- } else {
- if (ctxt->sax->characters != NULL)
- ctxt->sax->characters(ctxt->userData, buf, nbchar);
- }
- }
- }
-}
-
-/**
- * xmlParseExternalID:
- * @ctxt: an XML parser context
- * @publicID: a xmlChar** receiving PubidLiteral
- * @strict: indicate whether we should restrict parsing to only
- * production [75], see NOTE below
- *
- * Parse an External ID or a Public ID
- *
- * NOTE: Productions [75] and [83] interact badly since [75] can generate
- * 'PUBLIC' S PubidLiteral S SystemLiteral
- *
- * [75] ExternalID ::= 'SYSTEM' S SystemLiteral
- * | 'PUBLIC' S PubidLiteral S SystemLiteral
- *
- * [83] PublicID ::= 'PUBLIC' S PubidLiteral
- *
- * Returns the function returns SystemLiteral and in the second
- * case publicID receives PubidLiteral, is strict is off
- * it is possible to return NULL and have publicID set.
- */
-
-xmlChar *
-xmlParseExternalID(xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) {
- xmlChar *URI = NULL;
-
- SHRINK;
-
- *publicID = NULL;
- if ((RAW == 'S') && (NXT(1) == 'Y') &&
- (NXT(2) == 'S') && (NXT(3) == 'T') &&
- (NXT(4) == 'E') && (NXT(5) == 'M')) {
- SKIP(6);
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after 'SYSTEM'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
- URI = xmlParseSystemLiteral(ctxt);
- if (URI == NULL) {
- ctxt->errNo = XML_ERR_URI_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseExternalID: SYSTEM, no URI\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- } else if ((RAW == 'P') && (NXT(1) == 'U') &&
- (NXT(2) == 'B') && (NXT(3) == 'L') &&
- (NXT(4) == 'I') && (NXT(5) == 'C')) {
- SKIP(6);
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after 'PUBLIC'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
- *publicID = xmlParsePubidLiteral(ctxt);
- if (*publicID == NULL) {
- ctxt->errNo = XML_ERR_PUBID_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseExternalID: PUBLIC, no Public Identifier\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if (strict) {
- /*
- * We don't handle [83] so "S SystemLiteral" is required.
- */
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after the Public Identifier\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- } else {
- /*
- * We handle [83] so we return immediately, if
- * "S SystemLiteral" is not detected. From a purely parsing
- * point of view that's a nice mess.
- */
- const xmlChar *ptr;
- GROW;
-
- ptr = CUR_PTR;
- if (!IS_BLANK(*ptr)) return(NULL);
-
- while (IS_BLANK(*ptr)) ptr++; /* TODO: dangerous, fix ! */
- if ((*ptr != '\'') && (*ptr != '"')) return(NULL);
- }
- SKIP_BLANKS;
- URI = xmlParseSystemLiteral(ctxt);
- if (URI == NULL) {
- ctxt->errNo = XML_ERR_URI_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseExternalID: PUBLIC, no URI\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- }
- return(URI);
-}
-
-/**
- * xmlParseComment:
- * @ctxt: an XML parser context
- *
- * Skip an XML (SGML) comment <!-- .... -->
- * The spec says that "For compatibility, the string "--" (double-hyphen)
- * must not occur within comments. "
- *
- * [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
- */
-void
-xmlParseComment(xmlParserCtxtPtr ctxt) {
- xmlChar *buf = NULL;
- int len;
- int size = XML_PARSER_BUFFER_SIZE;
- int q, ql;
- int r, rl;
- int cur, l;
- xmlParserInputState state;
- xmlParserInputPtr input = ctxt->input;
- int count = 0;
-
- /*
- * Check that there is a comment right here.
- */
- if ((RAW != '<') || (NXT(1) != '!') ||
- (NXT(2) != '-') || (NXT(3) != '-')) return;
-
- state = ctxt->instate;
- ctxt->instate = XML_PARSER_COMMENT;
- SHRINK;
- SKIP(4);
- buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", size);
- ctxt->instate = state;
- return;
- }
- q = CUR_CHAR(ql);
- NEXTL(ql);
- r = CUR_CHAR(rl);
- NEXTL(rl);
- cur = CUR_CHAR(l);
- len = 0;
- while (IS_CHAR(cur) && /* checked */
- ((cur != '>') ||
- (r != '-') || (q != '-'))) {
- if ((r == '-') && (q == '-')) {
- ctxt->errNo = XML_ERR_HYPHEN_IN_COMMENT;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Comment must not contain '--' (double-hyphen)`\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if (len + 5 >= size) {
- size *= 2;
- buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %d byte failed\n", size);
- ctxt->instate = state;
- return;
- }
- }
- COPY_BUF(ql,buf,len,q);
- q = r;
- ql = rl;
- r = cur;
- rl = l;
-
- count++;
- if (count > 50) {
- GROW;
- count = 0;
- }
- NEXTL(l);
- cur = CUR_CHAR(l);
- if (cur == 0) {
- SHRINK;
- GROW;
- cur = CUR_CHAR(l);
- }
- }
- buf[len] = 0;
- if (!IS_CHAR(cur)) {
- ctxt->errNo = XML_ERR_COMMENT_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Comment not terminated \n<!--%.50s\n", buf);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- xmlFree(buf);
- } else {
- if (input != ctxt->input) {
- ctxt->errNo = XML_ERR_ENTITY_BOUNDARY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
-"Comment doesn't start and stop in the same entity\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- NEXT;
- if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) &&
- (!ctxt->disableSAX))
- ctxt->sax->comment(ctxt->userData, buf);
- xmlFree(buf);
- }
- ctxt->instate = state;
-}
-
-/**
- * xmlParsePITarget:
- * @ctxt: an XML parser context
- *
- * parse the name of a PI
- *
- * [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
- *
- * Returns the PITarget name or NULL
- */
-
-xmlChar *
-xmlParsePITarget(xmlParserCtxtPtr ctxt) {
- xmlChar *name;
-
- name = xmlParseName(ctxt);
- if ((name != NULL) &&
- ((name[0] == 'x') || (name[0] == 'X')) &&
- ((name[1] == 'm') || (name[1] == 'M')) &&
- ((name[2] == 'l') || (name[2] == 'L'))) {
- int i;
- if ((name[0] == 'x') && (name[1] == 'm') &&
- (name[2] == 'l') && (name[3] == 0)) {
- ctxt->errNo = XML_ERR_RESERVED_XML_NAME;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "XML declaration allowed only at the start of the document\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(name);
- } else if (name[3] == 0) {
- ctxt->errNo = XML_ERR_RESERVED_XML_NAME;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Invalid PI name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(name);
- }
- for (i = 0;;i++) {
- if (xmlW3CPIs[i] == NULL) break;
- if (xmlStrEqual(name, (const xmlChar *)xmlW3CPIs[i]))
- return(name);
- }
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) {
- ctxt->errNo = XML_ERR_RESERVED_XML_NAME;
- ctxt->sax->warning(ctxt->userData,
- "xmlParsePITarget: invalid name prefix 'xml'\n");
- }
- }
- return(name);
-}
-
-#ifdef LIBXML_CATALOG_ENABLED
-/**
- * xmlParseCatalogPI:
- * @ctxt: an XML parser context
- * @catalog: the PI value string
- *
- * parse an XML Catalog Processing Instruction.
- *
- * <?oasis-xml-catalog catalog="http://example.com/catalog.xml"?>
- *
- * Occurs only if allowed by the user and if happening in the Misc
- * part of the document before any doctype informations
- * This will add the given catalog to the parsing context in order
- * to be used if there is a resolution need further down in the document
- */
-
-static void
-xmlParseCatalogPI(xmlParserCtxtPtr ctxt, const xmlChar *catalog) {
- xmlChar *URL = NULL;
- const xmlChar *tmp, *base;
- xmlChar marker;
-
- tmp = catalog;
- while (IS_BLANK(*tmp)) tmp++;
- if (xmlStrncmp(tmp, BAD_CAST"catalog", 7))
- goto error;
- tmp += 7;
- while (IS_BLANK(*tmp)) tmp++;
- if (*tmp != '=') {
- return;
- }
- tmp++;
- while (IS_BLANK(*tmp)) tmp++;
- marker = *tmp;
- if ((marker != '\'') && (marker != '"'))
- goto error;
- tmp++;
- base = tmp;
- while ((*tmp != 0) && (*tmp != marker)) tmp++;
- if (*tmp == 0)
- goto error;
- URL = xmlStrndup(base, tmp - base);
- tmp++;
- while (IS_BLANK(*tmp)) tmp++;
- if (*tmp != 0)
- goto error;
-
- if (URL != NULL) {
- ctxt->catalogs = xmlCatalogAddLocal(ctxt->catalogs, URL);
- xmlFree(URL);
- }
- return;
-
-error:
- ctxt->errNo = XML_WAR_CATALOG_PI;
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData,
- "Catalog PI syntax error: %s\n", catalog);
- if (URL != NULL)
- xmlFree(URL);
-}
-#endif
-
-/**
- * xmlParsePI:
- * @ctxt: an XML parser context
- *
- * parse an XML Processing Instruction.
- *
- * [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
- *
- * The processing is transfered to SAX once parsed.
- */
-
-void
-xmlParsePI(xmlParserCtxtPtr ctxt) {
- xmlChar *buf = NULL;
- int len = 0;
- int size = XML_PARSER_BUFFER_SIZE;
- int cur, l;
- xmlChar *target;
- xmlParserInputState state;
- int count = 0;
-
- if ((RAW == '<') && (NXT(1) == '?')) {
- xmlParserInputPtr input = ctxt->input;
- state = ctxt->instate;
- ctxt->instate = XML_PARSER_PI;
- /*
- * this is a Processing Instruction.
- */
- SKIP(2);
- SHRINK;
-
- /*
- * Parse the target name and check for special support like
- * namespace.
- */
- target = xmlParsePITarget(ctxt);
- if (target != NULL) {
- if ((RAW == '?') && (NXT(1) == '>')) {
- if (input != ctxt->input) {
- ctxt->errNo = XML_ERR_ENTITY_BOUNDARY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "PI declaration doesn't start and stop in the same entity\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP(2);
-
- /*
- * SAX: PI detected.
- */
- if ((ctxt->sax) && (!ctxt->disableSAX) &&
- (ctxt->sax->processingInstruction != NULL))
- ctxt->sax->processingInstruction(ctxt->userData,
- target, NULL);
- ctxt->instate = state;
- xmlFree(target);
- return;
- }
- buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", size);
- ctxt->instate = state;
- return;
- }
- cur = CUR;
- if (!IS_BLANK(cur)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParsePI: PI %s space expected\n", target);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
- cur = CUR_CHAR(l);
- while (IS_CHAR(cur) && /* checked */
- ((cur != '?') || (NXT(1) != '>'))) {
- if (len + 5 >= size) {
- size *= 2;
- buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %d byte failed\n", size);
- ctxt->instate = state;
- return;
- }
- }
- count++;
- if (count > 50) {
- GROW;
- count = 0;
- }
- COPY_BUF(l,buf,len,cur);
- NEXTL(l);
- cur = CUR_CHAR(l);
- if (cur == 0) {
- SHRINK;
- GROW;
- cur = CUR_CHAR(l);
- }
- }
- buf[len] = 0;
- if (cur != '?') {
- ctxt->errNo = XML_ERR_PI_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParsePI: PI %s never end ...\n", target);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- if (input != ctxt->input) {
- ctxt->errNo = XML_ERR_ENTITY_BOUNDARY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "PI declaration doesn't start and stop in the same entity\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP(2);
-
-#ifdef LIBXML_CATALOG_ENABLED
- if (((state == XML_PARSER_MISC) ||
- (state == XML_PARSER_START)) &&
- (xmlStrEqual(target, XML_CATALOG_PI))) {
- xmlCatalogAllow allow = xmlCatalogGetDefaults();
- if ((allow == XML_CATA_ALLOW_DOCUMENT) ||
- (allow == XML_CATA_ALLOW_ALL))
- xmlParseCatalogPI(ctxt, buf);
- }
-#endif
-
-
- /*
- * SAX: PI detected.
- */
- if ((ctxt->sax) && (!ctxt->disableSAX) &&
- (ctxt->sax->processingInstruction != NULL))
- ctxt->sax->processingInstruction(ctxt->userData,
- target, buf);
- }
- xmlFree(buf);
- xmlFree(target);
- } else {
- ctxt->errNo = XML_ERR_PI_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParsePI : no target name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- ctxt->instate = state;
- }
-}
-
-/**
- * xmlParseNotationDecl:
- * @ctxt: an XML parser context
- *
- * parse a notation declaration
- *
- * [82] NotationDecl ::= '<!NOTATION' S Name S (ExternalID | PublicID) S? '>'
- *
- * Hence there is actually 3 choices:
- * 'PUBLIC' S PubidLiteral
- * 'PUBLIC' S PubidLiteral S SystemLiteral
- * and 'SYSTEM' S SystemLiteral
- *
- * See the NOTE on xmlParseExternalID().
- */
-
-void
-xmlParseNotationDecl(xmlParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlChar *Pubid;
- xmlChar *Systemid;
-
- if ((RAW == '<') && (NXT(1) == '!') &&
- (NXT(2) == 'N') && (NXT(3) == 'O') &&
- (NXT(4) == 'T') && (NXT(5) == 'A') &&
- (NXT(6) == 'T') && (NXT(7) == 'I') &&
- (NXT(8) == 'O') && (NXT(9) == 'N')) {
- xmlParserInputPtr input = ctxt->input;
- SHRINK;
- SKIP(10);
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after '<!NOTATION'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return;
- }
- SKIP_BLANKS;
-
- name = xmlParseName(ctxt);
- if (name == NULL) {
- ctxt->errNo = XML_ERR_NOTATION_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "NOTATION: Name expected here\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return;
- }
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after the NOTATION name'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return;
- }
- SKIP_BLANKS;
-
- /*
- * Parse the IDs.
- */
- Systemid = xmlParseExternalID(ctxt, &Pubid, 0);
- SKIP_BLANKS;
-
- if (RAW == '>') {
- if (input != ctxt->input) {
- ctxt->errNo = XML_ERR_ENTITY_BOUNDARY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
-"Notation declaration doesn't start and stop in the same entity\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- NEXT;
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
- (ctxt->sax->notationDecl != NULL))
- ctxt->sax->notationDecl(ctxt->userData, name, Pubid, Systemid);
- } else {
- ctxt->errNo = XML_ERR_NOTATION_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "'>' required to close NOTATION declaration\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- xmlFree(name);
- if (Systemid != NULL) xmlFree(Systemid);
- if (Pubid != NULL) xmlFree(Pubid);
- }
-}
-
-/**
- * xmlParseEntityDecl:
- * @ctxt: an XML parser context
- *
- * parse <!ENTITY declarations
- *
- * [70] EntityDecl ::= GEDecl | PEDecl
- *
- * [71] GEDecl ::= '<!ENTITY' S Name S EntityDef S? '>'
- *
- * [72] PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S? '>'
- *
- * [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)
- *
- * [74] PEDef ::= EntityValue | ExternalID
- *
- * [76] NDataDecl ::= S 'NDATA' S Name
- *
- * [ VC: Notation Declared ]
- * The Name must match the declared name of a notation.
- */
-
-void
-xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
- xmlChar *name = NULL;
- xmlChar *value = NULL;
- xmlChar *URI = NULL, *literal = NULL;
- xmlChar *ndata = NULL;
- int isParameter = 0;
- xmlChar *orig = NULL;
- int skipped;
-
- GROW;
- if ((RAW == '<') && (NXT(1) == '!') &&
- (NXT(2) == 'E') && (NXT(3) == 'N') &&
- (NXT(4) == 'T') && (NXT(5) == 'I') &&
- (NXT(6) == 'T') && (NXT(7) == 'Y')) {
- xmlParserInputPtr input = ctxt->input;
- SHRINK;
- SKIP(8);
- skipped = SKIP_BLANKS;
- if (skipped == 0) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after '<!ENTITY'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- if (RAW == '%') {
- NEXT;
- skipped = SKIP_BLANKS;
- if (skipped == 0) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after '%'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- isParameter = 1;
- }
-
- name = xmlParseName(ctxt);
- if (name == NULL) {
- ctxt->errNo = XML_ERR_NAME_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "xmlParseEntityDecl: no name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return;
- }
- skipped = SKIP_BLANKS;
- if (skipped == 0) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after the entity name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- ctxt->instate = XML_PARSER_ENTITY_DECL;
- /*
- * handle the various case of definitions...
- */
- if (isParameter) {
- if ((RAW == '"') || (RAW == '\'')) {
- value = xmlParseEntityValue(ctxt, &orig);
- if (value) {
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL))
- ctxt->sax->entityDecl(ctxt->userData, name,
- XML_INTERNAL_PARAMETER_ENTITY,
- NULL, NULL, value);
- }
- } else {
- URI = xmlParseExternalID(ctxt, &literal, 1);
- if ((URI == NULL) && (literal == NULL)) {
- ctxt->errNo = XML_ERR_VALUE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Entity value required\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if (URI) {
- xmlURIPtr uri;
-
- uri = xmlParseURI((const char *) URI);
- if (uri == NULL) {
- ctxt->errNo = XML_ERR_INVALID_URI;
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Invalid URI: %s\n", URI);
- /*
- * This really ought to be a well formedness error
- * but the XML Core WG decided otherwise c.f. issue
- * E26 of the XML erratas.
- */
- } else {
- if (uri->fragment != NULL) {
- ctxt->errNo = XML_ERR_URI_FRAGMENT;
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Fragment not allowed: %s\n", URI);
- /*
- * Okay this is foolish to block those but not
- * invalid URIs.
- */
- ctxt->wellFormed = 0;
- } else {
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) &&
- (ctxt->sax->entityDecl != NULL))
- ctxt->sax->entityDecl(ctxt->userData, name,
- XML_EXTERNAL_PARAMETER_ENTITY,
- literal, URI, NULL);
- }
- xmlFreeURI(uri);
- }
- }
- }
- } else {
- if ((RAW == '"') || (RAW == '\'')) {
- value = xmlParseEntityValue(ctxt, &orig);
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL))
- ctxt->sax->entityDecl(ctxt->userData, name,
- XML_INTERNAL_GENERAL_ENTITY,
- NULL, NULL, value);
- /*
- * For expat compatibility in SAX mode.
- */
- if ((ctxt->myDoc == NULL) ||
- (xmlStrEqual(ctxt->myDoc->version, SAX_COMPAT_MODE))) {
- if (ctxt->myDoc == NULL) {
- ctxt->myDoc = xmlNewDoc(SAX_COMPAT_MODE);
- }
- if (ctxt->myDoc->intSubset == NULL)
- ctxt->myDoc->intSubset = xmlNewDtd(ctxt->myDoc,
- BAD_CAST "fake", NULL, NULL);
-
- entityDecl(ctxt, name, XML_INTERNAL_GENERAL_ENTITY,
- NULL, NULL, value);
- }
- } else {
- URI = xmlParseExternalID(ctxt, &literal, 1);
- if ((URI == NULL) && (literal == NULL)) {
- ctxt->errNo = XML_ERR_VALUE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Entity value required\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if (URI) {
- xmlURIPtr uri;
-
- uri = xmlParseURI((const char *)URI);
- if (uri == NULL) {
- ctxt->errNo = XML_ERR_INVALID_URI;
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Invalid URI: %s\n", URI);
- /*
- * This really ought to be a well formedness error
- * but the XML Core WG decided otherwise c.f. issue
- * E26 of the XML erratas.
- */
- } else {
- if (uri->fragment != NULL) {
- ctxt->errNo = XML_ERR_URI_FRAGMENT;
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Fragment not allowed: %s\n", URI);
- /*
- * Okay this is foolish to block those but not
- * invalid URIs.
- */
- ctxt->wellFormed = 0;
- }
- xmlFreeURI(uri);
- }
- }
- if ((RAW != '>') && (!IS_BLANK(CUR))) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required before 'NDATA'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
- if ((RAW == 'N') && (NXT(1) == 'D') &&
- (NXT(2) == 'A') && (NXT(3) == 'T') &&
- (NXT(4) == 'A')) {
- SKIP(5);
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after 'NDATA'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
- ndata = xmlParseName(ctxt);
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
- (ctxt->sax->unparsedEntityDecl != NULL))
- ctxt->sax->unparsedEntityDecl(ctxt->userData, name,
- literal, URI, ndata);
- } else {
- if ((ctxt->sax != NULL) &&
- (!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL))
- ctxt->sax->entityDecl(ctxt->userData, name,
- XML_EXTERNAL_GENERAL_PARSED_ENTITY,
- literal, URI, NULL);
- /*
- * For expat compatibility in SAX mode.
- * assuming the entity repalcement was asked for
- */
- if ((ctxt->replaceEntities != 0) &&
- ((ctxt->myDoc == NULL) ||
- (xmlStrEqual(ctxt->myDoc->version, SAX_COMPAT_MODE)))) {
- if (ctxt->myDoc == NULL) {
- ctxt->myDoc = xmlNewDoc(SAX_COMPAT_MODE);
- }
-
- if (ctxt->myDoc->intSubset == NULL)
- ctxt->myDoc->intSubset = xmlNewDtd(ctxt->myDoc,
- BAD_CAST "fake", NULL, NULL);
- entityDecl(ctxt, name,
- XML_EXTERNAL_GENERAL_PARSED_ENTITY,
- literal, URI, NULL);
- }
- }
- }
- }
- SKIP_BLANKS;
- if (RAW != '>') {
- ctxt->errNo = XML_ERR_ENTITY_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseEntityDecl: entity %s not terminated\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- if (input != ctxt->input) {
- ctxt->errNo = XML_ERR_ENTITY_BOUNDARY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
-"Entity declaration doesn't start and stop in the same entity\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- NEXT;
- }
- if (orig != NULL) {
- /*
- * Ugly mechanism to save the raw entity value.
- */
- xmlEntityPtr cur = NULL;
-
- if (isParameter) {
- if ((ctxt->sax != NULL) &&
- (ctxt->sax->getParameterEntity != NULL))
- cur = ctxt->sax->getParameterEntity(ctxt->userData, name);
- } else {
- if ((ctxt->sax != NULL) &&
- (ctxt->sax->getEntity != NULL))
- cur = ctxt->sax->getEntity(ctxt->userData, name);
- if ((cur == NULL) && (ctxt->userData==ctxt)) {
- cur = getEntity(ctxt, name);
- }
- }
- if (cur != NULL) {
- if (cur->orig != NULL)
- xmlFree(orig);
- else
- cur->orig = orig;
- } else
- xmlFree(orig);
- }
- if (name != NULL) xmlFree(name);
- if (value != NULL) xmlFree(value);
- if (URI != NULL) xmlFree(URI);
- if (literal != NULL) xmlFree(literal);
- if (ndata != NULL) xmlFree(ndata);
- }
-}
-
-/**
- * xmlParseDefaultDecl:
- * @ctxt: an XML parser context
- * @value: Receive a possible fixed default value for the attribute
- *
- * Parse an attribute default declaration
- *
- * [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)
- *
- * [ VC: Required Attribute ]
- * if the default declaration is the keyword #REQUIRED, then the
- * attribute must be specified for all elements of the type in the
- * attribute-list declaration.
- *
- * [ VC: Attribute Default Legal ]
- * The declared default value must meet the lexical constraints of
- * the declared attribute type c.f. xmlValidateAttributeDecl()
- *
- * [ VC: Fixed Attribute Default ]
- * if an attribute has a default value declared with the #FIXED
- * keyword, instances of that attribute must match the default value.
- *
- * [ WFC: No < in Attribute Values ]
- * handled in xmlParseAttValue()
- *
- * returns: XML_ATTRIBUTE_NONE, XML_ATTRIBUTE_REQUIRED, XML_ATTRIBUTE_IMPLIED
- * or XML_ATTRIBUTE_FIXED.
- */
-
-int
-xmlParseDefaultDecl(xmlParserCtxtPtr ctxt, xmlChar **value) {
- int val;
- xmlChar *ret;
-
- *value = NULL;
- if ((RAW == '#') && (NXT(1) == 'R') &&
- (NXT(2) == 'E') && (NXT(3) == 'Q') &&
- (NXT(4) == 'U') && (NXT(5) == 'I') &&
- (NXT(6) == 'R') && (NXT(7) == 'E') &&
- (NXT(8) == 'D')) {
- SKIP(9);
- return(XML_ATTRIBUTE_REQUIRED);
- }
- if ((RAW == '#') && (NXT(1) == 'I') &&
- (NXT(2) == 'M') && (NXT(3) == 'P') &&
- (NXT(4) == 'L') && (NXT(5) == 'I') &&
- (NXT(6) == 'E') && (NXT(7) == 'D')) {
- SKIP(8);
- return(XML_ATTRIBUTE_IMPLIED);
- }
- val = XML_ATTRIBUTE_NONE;
- if ((RAW == '#') && (NXT(1) == 'F') &&
- (NXT(2) == 'I') && (NXT(3) == 'X') &&
- (NXT(4) == 'E') && (NXT(5) == 'D')) {
- SKIP(6);
- val = XML_ATTRIBUTE_FIXED;
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after '#FIXED'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
- }
- ret = xmlParseAttValue(ctxt);
- ctxt->instate = XML_PARSER_DTD;
- if (ret == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Attribute default value declaration error\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else
- *value = ret;
- return(val);
-}
-
-/**
- * xmlParseNotationType:
- * @ctxt: an XML parser context
- *
- * parse an Notation attribute type.
- *
- * Note: the leading 'NOTATION' S part has already being parsed...
- *
- * [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'
- *
- * [ VC: Notation Attributes ]
- * Values of this type must match one of the notation names included
- * in the declaration; all notation names in the declaration must be declared.
- *
- * Returns: the notation attribute tree built while parsing
- */
-
-xmlEnumerationPtr
-xmlParseNotationType(xmlParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlEnumerationPtr ret = NULL, last = NULL, cur;
-
- if (RAW != '(') {
- ctxt->errNo = XML_ERR_NOTATION_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "'(' required to start 'NOTATION'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(NULL);
- }
- SHRINK;
- do {
- NEXT;
- SKIP_BLANKS;
- name = xmlParseName(ctxt);
- if (name == NULL) {
- ctxt->errNo = XML_ERR_NAME_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Name expected in NOTATION declaration\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(ret);
- }
- cur = xmlCreateEnumeration(name);
- xmlFree(name);
- if (cur == NULL) return(ret);
- if (last == NULL) ret = last = cur;
- else {
- last->next = cur;
- last = cur;
- }
- SKIP_BLANKS;
- } while (RAW == '|');
- if (RAW != ')') {
- ctxt->errNo = XML_ERR_NOTATION_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "')' required to finish NOTATION declaration\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- if ((last != NULL) && (last != ret))
- xmlFreeEnumeration(last);
- return(ret);
- }
- NEXT;
- return(ret);
-}
-
-/**
- * xmlParseEnumerationType:
- * @ctxt: an XML parser context
- *
- * parse an Enumeration attribute type.
- *
- * [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'
- *
- * [ VC: Enumeration ]
- * Values of this type must match one of the Nmtoken tokens in
- * the declaration
- *
- * Returns: the enumeration attribute tree built while parsing
- */
-
-xmlEnumerationPtr
-xmlParseEnumerationType(xmlParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlEnumerationPtr ret = NULL, last = NULL, cur;
-
- if (RAW != '(') {
- ctxt->errNo = XML_ERR_ATTLIST_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "'(' required to start ATTLIST enumeration\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(NULL);
- }
- SHRINK;
- do {
- NEXT;
- SKIP_BLANKS;
- name = xmlParseNmtoken(ctxt);
- if (name == NULL) {
- ctxt->errNo = XML_ERR_NMTOKEN_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "NmToken expected in ATTLIST enumeration\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(ret);
- }
- cur = xmlCreateEnumeration(name);
- xmlFree(name);
- if (cur == NULL) return(ret);
- if (last == NULL) ret = last = cur;
- else {
- last->next = cur;
- last = cur;
- }
- SKIP_BLANKS;
- } while (RAW == '|');
- if (RAW != ')') {
- ctxt->errNo = XML_ERR_ATTLIST_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "')' required to finish ATTLIST enumeration\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(ret);
- }
- NEXT;
- return(ret);
-}
-
-/**
- * xmlParseEnumeratedType:
- * @ctxt: an XML parser context
- * @tree: the enumeration tree built while parsing
- *
- * parse an Enumerated attribute type.
- *
- * [57] EnumeratedType ::= NotationType | Enumeration
- *
- * [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'
- *
- *
- * Returns: XML_ATTRIBUTE_ENUMERATION or XML_ATTRIBUTE_NOTATION
- */
-
-int
-xmlParseEnumeratedType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) {
- if ((RAW == 'N') && (NXT(1) == 'O') &&
- (NXT(2) == 'T') && (NXT(3) == 'A') &&
- (NXT(4) == 'T') && (NXT(5) == 'I') &&
- (NXT(6) == 'O') && (NXT(7) == 'N')) {
- SKIP(8);
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after 'NOTATION'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(0);
- }
- SKIP_BLANKS;
- *tree = xmlParseNotationType(ctxt);
- if (*tree == NULL) return(0);
- return(XML_ATTRIBUTE_NOTATION);
- }
- *tree = xmlParseEnumerationType(ctxt);
- if (*tree == NULL) return(0);
- return(XML_ATTRIBUTE_ENUMERATION);
-}
-
-/**
- * xmlParseAttributeType:
- * @ctxt: an XML parser context
- * @tree: the enumeration tree built while parsing
- *
- * parse the Attribute list def for an element
- *
- * [54] AttType ::= StringType | TokenizedType | EnumeratedType
- *
- * [55] StringType ::= 'CDATA'
- *
- * [56] TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' |
- * 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS'
- *
- * Validity constraints for attribute values syntax are checked in
- * xmlValidateAttributeValue()
- *
- * [ VC: ID ]
- * Values of type ID must match the Name production. A name must not
- * appear more than once in an XML document as a value of this type;
- * i.e., ID values must uniquely identify the elements which bear them.
- *
- * [ VC: One ID per Element Type ]
- * No element type may have more than one ID attribute specified.
- *
- * [ VC: ID Attribute Default ]
- * An ID attribute must have a declared default of #IMPLIED or #REQUIRED.
- *
- * [ VC: IDREF ]
- * Values of type IDREF must match the Name production, and values
- * of type IDREFS must match Names; each IDREF Name must match the value
- * of an ID attribute on some element in the XML document; i.e. IDREF
- * values must match the value of some ID attribute.
- *
- * [ VC: Entity Name ]
- * Values of type ENTITY must match the Name production, values
- * of type ENTITIES must match Names; each Entity Name must match the
- * name of an unparsed entity declared in the DTD.
- *
- * [ VC: Name Token ]
- * Values of type NMTOKEN must match the Nmtoken production; values
- * of type NMTOKENS must match Nmtokens.
- *
- * Returns the attribute type
- */
-int
-xmlParseAttributeType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) {
- SHRINK;
- if ((RAW == 'C') && (NXT(1) == 'D') &&
- (NXT(2) == 'A') && (NXT(3) == 'T') &&
- (NXT(4) == 'A')) {
- SKIP(5);
- return(XML_ATTRIBUTE_CDATA);
- } else if ((RAW == 'I') && (NXT(1) == 'D') &&
- (NXT(2) == 'R') && (NXT(3) == 'E') &&
- (NXT(4) == 'F') && (NXT(5) == 'S')) {
- SKIP(6);
- return(XML_ATTRIBUTE_IDREFS);
- } else if ((RAW == 'I') && (NXT(1) == 'D') &&
- (NXT(2) == 'R') && (NXT(3) == 'E') &&
- (NXT(4) == 'F')) {
- SKIP(5);
- return(XML_ATTRIBUTE_IDREF);
- } else if ((RAW == 'I') && (NXT(1) == 'D')) {
- SKIP(2);
- return(XML_ATTRIBUTE_ID);
- } else if ((RAW == 'E') && (NXT(1) == 'N') &&
- (NXT(2) == 'T') && (NXT(3) == 'I') &&
- (NXT(4) == 'T') && (NXT(5) == 'Y')) {
- SKIP(6);
- return(XML_ATTRIBUTE_ENTITY);
- } else if ((RAW == 'E') && (NXT(1) == 'N') &&
- (NXT(2) == 'T') && (NXT(3) == 'I') &&
- (NXT(4) == 'T') && (NXT(5) == 'I') &&
- (NXT(6) == 'E') && (NXT(7) == 'S')) {
- SKIP(8);
- return(XML_ATTRIBUTE_ENTITIES);
- } else if ((RAW == 'N') && (NXT(1) == 'M') &&
- (NXT(2) == 'T') && (NXT(3) == 'O') &&
- (NXT(4) == 'K') && (NXT(5) == 'E') &&
- (NXT(6) == 'N') && (NXT(7) == 'S')) {
- SKIP(8);
- return(XML_ATTRIBUTE_NMTOKENS);
- } else if ((RAW == 'N') && (NXT(1) == 'M') &&
- (NXT(2) == 'T') && (NXT(3) == 'O') &&
- (NXT(4) == 'K') && (NXT(5) == 'E') &&
- (NXT(6) == 'N')) {
- SKIP(7);
- return(XML_ATTRIBUTE_NMTOKEN);
- }
- return(xmlParseEnumeratedType(ctxt, tree));
-}
-
-/**
- * xmlParseAttributeListDecl:
- * @ctxt: an XML parser context
- *
- * : parse the Attribute list def for an element
- *
- * [52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>'
- *
- * [53] AttDef ::= S Name S AttType S DefaultDecl
- *
- */
-void
-xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
- xmlChar *elemName;
- xmlChar *attrName;
- xmlEnumerationPtr tree;
-
- if ((RAW == '<') && (NXT(1) == '!') &&
- (NXT(2) == 'A') && (NXT(3) == 'T') &&
- (NXT(4) == 'T') && (NXT(5) == 'L') &&
- (NXT(6) == 'I') && (NXT(7) == 'S') &&
- (NXT(8) == 'T')) {
- xmlParserInputPtr input = ctxt->input;
-
- SKIP(9);
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after '<!ATTLIST'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
- elemName = xmlParseName(ctxt);
- if (elemName == NULL) {
- ctxt->errNo = XML_ERR_NAME_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "ATTLIST: no name for Element\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return;
- }
- SKIP_BLANKS;
- GROW;
- while (RAW != '>') {
- const xmlChar *check = CUR_PTR;
- int type;
- int def;
- xmlChar *defaultValue = NULL;
-
- GROW;
- tree = NULL;
- attrName = xmlParseName(ctxt);
- if (attrName == NULL) {
- ctxt->errNo = XML_ERR_NAME_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "ATTLIST: no name for Attribute\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- break;
- }
- GROW;
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after the attribute name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- if (attrName != NULL)
- xmlFree(attrName);
- if (defaultValue != NULL)
- xmlFree(defaultValue);
- break;
- }
- SKIP_BLANKS;
-
- type = xmlParseAttributeType(ctxt, &tree);
- if (type <= 0) {
- if (attrName != NULL)
- xmlFree(attrName);
- if (defaultValue != NULL)
- xmlFree(defaultValue);
- break;
- }
-
- GROW;
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after the attribute type\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- if (attrName != NULL)
- xmlFree(attrName);
- if (defaultValue != NULL)
- xmlFree(defaultValue);
- if (tree != NULL)
- xmlFreeEnumeration(tree);
- break;
- }
- SKIP_BLANKS;
-
- def = xmlParseDefaultDecl(ctxt, &defaultValue);
- if (def <= 0) {
- if (attrName != NULL)
- xmlFree(attrName);
- if (defaultValue != NULL)
- xmlFree(defaultValue);
- if (tree != NULL)
- xmlFreeEnumeration(tree);
- break;
- }
-
- GROW;
- if (RAW != '>') {
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after the attribute default value\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- if (attrName != NULL)
- xmlFree(attrName);
- if (defaultValue != NULL)
- xmlFree(defaultValue);
- if (tree != NULL)
- xmlFreeEnumeration(tree);
- break;
- }
- SKIP_BLANKS;
- }
- if (check == CUR_PTR) {
- ctxt->errNo = XML_ERR_INTERNAL_ERROR;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseAttributeListDecl: detected internal error\n");
- if (attrName != NULL)
- xmlFree(attrName);
- if (defaultValue != NULL)
- xmlFree(defaultValue);
- if (tree != NULL)
- xmlFreeEnumeration(tree);
- break;
- }
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
- (ctxt->sax->attributeDecl != NULL))
- ctxt->sax->attributeDecl(ctxt->userData, elemName, attrName,
- type, def, defaultValue, tree);
- if (attrName != NULL)
- xmlFree(attrName);
- if (defaultValue != NULL)
- xmlFree(defaultValue);
- GROW;
- }
- if (RAW == '>') {
- if (input != ctxt->input) {
- ctxt->errNo = XML_ERR_ENTITY_BOUNDARY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
-"Attribute list declaration doesn't start and stop in the same entity\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- NEXT;
- }
-
- xmlFree(elemName);
- }
-}
-
-/**
- * xmlParseElementMixedContentDecl:
- * @ctxt: an XML parser context
- * @inputchk: the input used for the current entity, needed for boundary checks
- *
- * parse the declaration for a Mixed Element content
- * The leading '(' and spaces have been skipped in xmlParseElementContentDecl
- *
- * [51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' |
- * '(' S? '#PCDATA' S? ')'
- *
- * [ VC: Proper Group/PE Nesting ] applies to [51] too (see [49])
- *
- * [ VC: No Duplicate Types ]
- * The same name must not appear more than once in a single
- * mixed-content declaration.
- *
- * returns: the list of the xmlElementContentPtr describing the element choices
- */
-xmlElementContentPtr
-xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt, xmlParserInputPtr inputchk) {
- xmlElementContentPtr ret = NULL, cur = NULL, n;
- xmlChar *elem = NULL;
-
- GROW;
- if ((RAW == '#') && (NXT(1) == 'P') &&
- (NXT(2) == 'C') && (NXT(3) == 'D') &&
- (NXT(4) == 'A') && (NXT(5) == 'T') &&
- (NXT(6) == 'A')) {
- SKIP(7);
- SKIP_BLANKS;
- SHRINK;
- if (RAW == ')') {
- if ((ctxt->validate) && (ctxt->input != inputchk)) {
- ctxt->errNo = XML_ERR_ENTITY_BOUNDARY;
- if (ctxt->vctxt.error != NULL)
- ctxt->vctxt.error(ctxt->vctxt.userData,
-"Element content declaration doesn't start and stop in the same entity\n");
- ctxt->valid = 0;
- }
- NEXT;
- ret = xmlNewElementContent(NULL, XML_ELEMENT_CONTENT_PCDATA);
- if (RAW == '*') {
- ret->ocur = XML_ELEMENT_CONTENT_MULT;
- NEXT;
- }
- return(ret);
- }
- if ((RAW == '(') || (RAW == '|')) {
- ret = cur = xmlNewElementContent(NULL, XML_ELEMENT_CONTENT_PCDATA);
- if (ret == NULL) return(NULL);
- }
- while (RAW == '|') {
- NEXT;
- if (elem == NULL) {
- ret = xmlNewElementContent(NULL, XML_ELEMENT_CONTENT_OR);
- if (ret == NULL) return(NULL);
- ret->c1 = cur;
- if (cur != NULL)
- cur->parent = ret;
- cur = ret;
- } else {
- n = xmlNewElementContent(NULL, XML_ELEMENT_CONTENT_OR);
- if (n == NULL) return(NULL);
- n->c1 = xmlNewElementContent(elem, XML_ELEMENT_CONTENT_ELEMENT);
- if (n->c1 != NULL)
- n->c1->parent = n;
- cur->c2 = n;
- if (n != NULL)
- n->parent = cur;
- cur = n;
- xmlFree(elem);
- }
- SKIP_BLANKS;
- elem = xmlParseName(ctxt);
- if (elem == NULL) {
- ctxt->errNo = XML_ERR_NAME_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseElementMixedContentDecl : Name expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- xmlFreeElementContent(cur);
- return(NULL);
- }
- SKIP_BLANKS;
- GROW;
- }
- if ((RAW == ')') && (NXT(1) == '*')) {
- if (elem != NULL) {
- cur->c2 = xmlNewElementContent(elem,
- XML_ELEMENT_CONTENT_ELEMENT);
- if (cur->c2 != NULL)
- cur->c2->parent = cur;
- xmlFree(elem);
- }
- ret->ocur = XML_ELEMENT_CONTENT_MULT;
- if ((ctxt->validate) && (ctxt->input != inputchk)) {
- ctxt->errNo = XML_ERR_ENTITY_BOUNDARY;
- if (ctxt->vctxt.error != NULL)
- ctxt->vctxt.error(ctxt->vctxt.userData,
-"Element content declaration doesn't start and stop in the same entity\n");
- ctxt->valid = 0;
- }
- SKIP(2);
- } else {
- if (elem != NULL) xmlFree(elem);
- xmlFreeElementContent(ret);
- ctxt->errNo = XML_ERR_MIXED_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseElementMixedContentDecl : '|' or ')*' expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(NULL);
- }
-
- } else {
- ctxt->errNo = XML_ERR_PCDATA_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseElementMixedContentDecl : '#PCDATA' expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- return(ret);
-}
-
-/**
- * xmlParseElementChildrenContentDecl:
- * @ctxt: an XML parser context
- * @inputchk: the input used for the current entity, needed for boundary checks
- *
- * parse the declaration for a Mixed Element content
- * The leading '(' and spaces have been skipped in xmlParseElementContentDecl
- *
- *
- * [47] children ::= (choice | seq) ('?' | '*' | '+')?
- *
- * [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?
- *
- * [49] choice ::= '(' S? cp ( S? '|' S? cp )* S? ')'
- *
- * [50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'
- *
- * [ VC: Proper Group/PE Nesting ] applies to [49] and [50]
- * TODO Parameter-entity replacement text must be properly nested
- * with parenthesized groups. That is to say, if either of the
- * opening or closing parentheses in a choice, seq, or Mixed
- * construct is contained in the replacement text for a parameter
- * entity, both must be contained in the same replacement text. For
- * interoperability, if a parameter-entity reference appears in a
- * choice, seq, or Mixed construct, its replacement text should not
- * be empty, and neither the first nor last non-blank character of
- * the replacement text should be a connector (| or ,).
- *
- * Returns the tree of xmlElementContentPtr describing the element
- * hierarchy.
- */
-xmlElementContentPtr
-xmlParseElementChildrenContentDecl
-(xmlParserCtxtPtr ctxt, xmlParserInputPtr inputchk) {
- xmlElementContentPtr ret = NULL, cur = NULL, last = NULL, op = NULL;
- xmlChar *elem;
- xmlChar type = 0;
-
- SKIP_BLANKS;
- GROW;
- if (RAW == '(') {
- xmlParserInputPtr input = ctxt->input;
-
- /* Recurse on first child */
- NEXT;
- SKIP_BLANKS;
- cur = ret = xmlParseElementChildrenContentDecl(ctxt, input);
- SKIP_BLANKS;
- GROW;
- } else {
- elem = xmlParseName(ctxt);
- if (elem == NULL) {
- ctxt->errNo = XML_ERR_ELEMCONTENT_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseElementChildrenContentDecl : Name or '(' expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(NULL);
- }
- cur = ret = xmlNewElementContent(elem, XML_ELEMENT_CONTENT_ELEMENT);
- GROW;
- if (RAW == '?') {
- cur->ocur = XML_ELEMENT_CONTENT_OPT;
- NEXT;
- } else if (RAW == '*') {
- cur->ocur = XML_ELEMENT_CONTENT_MULT;
- NEXT;
- } else if (RAW == '+') {
- cur->ocur = XML_ELEMENT_CONTENT_PLUS;
- NEXT;
- } else {
- cur->ocur = XML_ELEMENT_CONTENT_ONCE;
- }
- xmlFree(elem);
- GROW;
- }
- SKIP_BLANKS;
- SHRINK;
- while (RAW != ')') {
- /*
- * Each loop we parse one separator and one element.
- */
- if (RAW == ',') {
- if (type == 0) type = CUR;
-
- /*
- * Detect "Name | Name , Name" error
- */
- else if (type != CUR) {
- ctxt->errNo = XML_ERR_SEPARATOR_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseElementChildrenContentDecl : '%c' expected\n",
- type);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- if ((last != NULL) && (last != ret))
- xmlFreeElementContent(last);
- if (ret != NULL)
- xmlFreeElementContent(ret);
- return(NULL);
- }
- NEXT;
-
- op = xmlNewElementContent(NULL, XML_ELEMENT_CONTENT_SEQ);
- if (op == NULL) {
- if ((last != NULL) && (last != ret))
- xmlFreeElementContent(last);
- xmlFreeElementContent(ret);
- return(NULL);
- }
- if (last == NULL) {
- op->c1 = ret;
- if (ret != NULL)
- ret->parent = op;
- ret = cur = op;
- } else {
- cur->c2 = op;
- if (op != NULL)
- op->parent = cur;
- op->c1 = last;
- if (last != NULL)
- last->parent = op;
- cur =op;
- last = NULL;
- }
- } else if (RAW == '|') {
- if (type == 0) type = CUR;
-
- /*
- * Detect "Name , Name | Name" error
- */
- else if (type != CUR) {
- ctxt->errNo = XML_ERR_SEPARATOR_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseElementChildrenContentDecl : '%c' expected\n",
- type);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- if ((last != NULL) && (last != ret))
- xmlFreeElementContent(last);
- if (ret != NULL)
- xmlFreeElementContent(ret);
- return(NULL);
- }
- NEXT;
-
- op = xmlNewElementContent(NULL, XML_ELEMENT_CONTENT_OR);
- if (op == NULL) {
- if ((last != NULL) && (last != ret))
- xmlFreeElementContent(last);
- if (ret != NULL)
- xmlFreeElementContent(ret);
- return(NULL);
- }
- if (last == NULL) {
- op->c1 = ret;
- if (ret != NULL)
- ret->parent = op;
- ret = cur = op;
- } else {
- cur->c2 = op;
- if (op != NULL)
- op->parent = cur;
- op->c1 = last;
- if (last != NULL)
- last->parent = op;
- cur =op;
- last = NULL;
- }
- } else {
- ctxt->errNo = XML_ERR_ELEMCONTENT_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseElementChildrenContentDecl : ',' '|' or ')' expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- if (ret != NULL)
- xmlFreeElementContent(ret);
- return(NULL);
- }
- GROW;
- SKIP_BLANKS;
- GROW;
- if (RAW == '(') {
- xmlParserInputPtr input = ctxt->input;
- /* Recurse on second child */
- NEXT;
- SKIP_BLANKS;
- last = xmlParseElementChildrenContentDecl(ctxt, input);
- SKIP_BLANKS;
- } else {
- elem = xmlParseName(ctxt);
- if (elem == NULL) {
- ctxt->errNo = XML_ERR_ELEMCONTENT_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseElementChildrenContentDecl : Name or '(' expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- if (ret != NULL)
- xmlFreeElementContent(ret);
- return(NULL);
- }
- last = xmlNewElementContent(elem, XML_ELEMENT_CONTENT_ELEMENT);
- xmlFree(elem);
- if (RAW == '?') {
- last->ocur = XML_ELEMENT_CONTENT_OPT;
- NEXT;
- } else if (RAW == '*') {
- last->ocur = XML_ELEMENT_CONTENT_MULT;
- NEXT;
- } else if (RAW == '+') {
- last->ocur = XML_ELEMENT_CONTENT_PLUS;
- NEXT;
- } else {
- last->ocur = XML_ELEMENT_CONTENT_ONCE;
- }
- }
- SKIP_BLANKS;
- GROW;
- }
- if ((cur != NULL) && (last != NULL)) {
- cur->c2 = last;
- if (last != NULL)
- last->parent = cur;
- }
- if ((ctxt->validate) && (ctxt->input != inputchk)) {
- ctxt->errNo = XML_ERR_ENTITY_BOUNDARY;
- if (ctxt->vctxt.error != NULL)
- ctxt->vctxt.error(ctxt->vctxt.userData,
-"Element content declaration doesn't start and stop in the same entity\n");
- ctxt->valid = 0;
- }
- NEXT;
- if (RAW == '?') {
- if (ret != NULL)
- ret->ocur = XML_ELEMENT_CONTENT_OPT;
- NEXT;
- } else if (RAW == '*') {
- if (ret != NULL) {
- ret->ocur = XML_ELEMENT_CONTENT_MULT;
- cur = ret;
- /*
- * Some normalization:
- * (a | b* | c?)* == (a | b | c)*
- */
- while (cur->type == XML_ELEMENT_CONTENT_OR) {
- if ((cur->c1 != NULL) &&
- ((cur->c1->ocur == XML_ELEMENT_CONTENT_OPT) ||
- (cur->c1->ocur == XML_ELEMENT_CONTENT_MULT)))
- cur->c1->ocur = XML_ELEMENT_CONTENT_ONCE;
- if ((cur->c2 != NULL) &&
- ((cur->c2->ocur == XML_ELEMENT_CONTENT_OPT) ||
- (cur->c2->ocur == XML_ELEMENT_CONTENT_MULT)))
- cur->c2->ocur = XML_ELEMENT_CONTENT_ONCE;
- cur = cur->c2;
- }
- }
- NEXT;
- } else if (RAW == '+') {
- if (ret != NULL) {
- int found = 0;
-
- ret->ocur = XML_ELEMENT_CONTENT_PLUS;
- /*
- * Some normalization:
- * (a | b*)+ == (a | b)*
- * (a | b?)+ == (a | b)*
- */
- while (cur->type == XML_ELEMENT_CONTENT_OR) {
- if ((cur->c1 != NULL) &&
- ((cur->c1->ocur == XML_ELEMENT_CONTENT_OPT) ||
- (cur->c1->ocur == XML_ELEMENT_CONTENT_MULT))) {
- cur->c1->ocur = XML_ELEMENT_CONTENT_ONCE;
- found = 1;
- }
- if ((cur->c2 != NULL) &&
- ((cur->c2->ocur == XML_ELEMENT_CONTENT_OPT) ||
- (cur->c2->ocur == XML_ELEMENT_CONTENT_MULT))) {
- cur->c2->ocur = XML_ELEMENT_CONTENT_ONCE;
- found = 1;
- }
- cur = cur->c2;
- }
- if (found)
- ret->ocur = XML_ELEMENT_CONTENT_MULT;
- }
- NEXT;
- }
- return(ret);
-}
-
-/**
- * xmlParseElementContentDecl:
- * @ctxt: an XML parser context
- * @name: the name of the element being defined.
- * @result: the Element Content pointer will be stored here if any
- *
- * parse the declaration for an Element content either Mixed or Children,
- * the cases EMPTY and ANY are handled directly in xmlParseElementDecl
- *
- * [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children
- *
- * returns: the type of element content XML_ELEMENT_TYPE_xxx
- */
-
-int
-xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, xmlChar *name,
- xmlElementContentPtr *result) {
-
- xmlElementContentPtr tree = NULL;
- xmlParserInputPtr input = ctxt->input;
- int res;
-
- *result = NULL;
-
- if (RAW != '(') {
- ctxt->errNo = XML_ERR_ELEMCONTENT_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseElementContentDecl : %s '(' expected\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(-1);
- }
- NEXT;
- GROW;
- SKIP_BLANKS;
- if ((RAW == '#') && (NXT(1) == 'P') &&
- (NXT(2) == 'C') && (NXT(3) == 'D') &&
- (NXT(4) == 'A') && (NXT(5) == 'T') &&
- (NXT(6) == 'A')) {
- tree = xmlParseElementMixedContentDecl(ctxt, input);
- res = XML_ELEMENT_TYPE_MIXED;
- } else {
- tree = xmlParseElementChildrenContentDecl(ctxt, input);
- res = XML_ELEMENT_TYPE_ELEMENT;
- }
- SKIP_BLANKS;
- *result = tree;
- return(res);
-}
-
-/**
- * xmlParseElementDecl:
- * @ctxt: an XML parser context
- *
- * parse an Element declaration.
- *
- * [45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>'
- *
- * [ VC: Unique Element Type Declaration ]
- * No element type may be declared more than once
- *
- * Returns the type of the element, or -1 in case of error
- */
-int
-xmlParseElementDecl(xmlParserCtxtPtr ctxt) {
- xmlChar *name;
- int ret = -1;
- xmlElementContentPtr content = NULL;
-
- GROW;
- if ((RAW == '<') && (NXT(1) == '!') &&
- (NXT(2) == 'E') && (NXT(3) == 'L') &&
- (NXT(4) == 'E') && (NXT(5) == 'M') &&
- (NXT(6) == 'E') && (NXT(7) == 'N') &&
- (NXT(8) == 'T')) {
- xmlParserInputPtr input = ctxt->input;
-
- SKIP(9);
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after 'ELEMENT'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
- name = xmlParseName(ctxt);
- if (name == NULL) {
- ctxt->errNo = XML_ERR_NAME_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseElementDecl: no name for Element\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(-1);
- }
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space required after the element name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
- if ((RAW == 'E') && (NXT(1) == 'M') &&
- (NXT(2) == 'P') && (NXT(3) == 'T') &&
- (NXT(4) == 'Y')) {
- SKIP(5);
- /*
- * Element must always be empty.
- */
- ret = XML_ELEMENT_TYPE_EMPTY;
- } else if ((RAW == 'A') && (NXT(1) == 'N') &&
- (NXT(2) == 'Y')) {
- SKIP(3);
- /*
- * Element is a generic container.
- */
- ret = XML_ELEMENT_TYPE_ANY;
- } else if (RAW == '(') {
- ret = xmlParseElementContentDecl(ctxt, name, &content);
- } else {
- /*
- * [ WFC: PEs in Internal Subset ] error handling.
- */
- if ((RAW == '%') && (ctxt->external == 0) &&
- (ctxt->inputNr == 1)) {
- ctxt->errNo = XML_ERR_PEREF_IN_INT_SUBSET;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "PEReference: forbidden within markup decl in internal subset\n");
- } else {
- ctxt->errNo = XML_ERR_ELEMCONTENT_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseElementDecl: 'EMPTY', 'ANY' or '(' expected\n");
- }
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- if (name != NULL) xmlFree(name);
- return(-1);
- }
-
- SKIP_BLANKS;
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
- SKIP_BLANKS;
-
- if (RAW != '>') {
- ctxt->errNo = XML_ERR_GT_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseElementDecl: expected '>' at the end\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- if (input != ctxt->input) {
- ctxt->errNo = XML_ERR_ENTITY_BOUNDARY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
-"Element declaration doesn't start and stop in the same entity\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- NEXT;
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
- (ctxt->sax->elementDecl != NULL))
- ctxt->sax->elementDecl(ctxt->userData, name, ret,
- content);
- }
- if (content != NULL) {
- xmlFreeElementContent(content);
- }
- if (name != NULL) {
- xmlFree(name);
- }
- }
- return(ret);
-}
-
-/**
- * xmlParseConditionalSections
- * @ctxt: an XML parser context
- *
- * [61] conditionalSect ::= includeSect | ignoreSect
- * [62] includeSect ::= '<![' S? 'INCLUDE' S? '[' extSubsetDecl ']]>'
- * [63] ignoreSect ::= '<![' S? 'IGNORE' S? '[' ignoreSectContents* ']]>'
- * [64] ignoreSectContents ::= Ignore ('<![' ignoreSectContents ']]>' Ignore)*
- * [65] Ignore ::= Char* - (Char* ('<![' | ']]>') Char*)
- */
-
-static void
-xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
- SKIP(3);
- SKIP_BLANKS;
- if ((RAW == 'I') && (NXT(1) == 'N') && (NXT(2) == 'C') &&
- (NXT(3) == 'L') && (NXT(4) == 'U') && (NXT(5) == 'D') &&
- (NXT(6) == 'E')) {
- SKIP(7);
- SKIP_BLANKS;
- if (RAW != '[') {
- ctxt->errNo = XML_ERR_CONDSEC_INVALID;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "XML conditional section '[' expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- NEXT;
- }
- if (xmlParserDebugEntities) {
- if ((ctxt->input != NULL) && (ctxt->input->filename))
- xmlGenericError(xmlGenericErrorContext,
- "%s(%d): ", ctxt->input->filename,
- ctxt->input->line);
- xmlGenericError(xmlGenericErrorContext,
- "Entering INCLUDE Conditional Section\n");
- }
-
- while ((RAW != 0) && ((RAW != ']') || (NXT(1) != ']') ||
- (NXT(2) != '>'))) {
- const xmlChar *check = CUR_PTR;
- int cons = ctxt->input->consumed;
-
- if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
- xmlParseConditionalSections(ctxt);
- } else if (IS_BLANK(CUR)) {
- NEXT;
- } else if (RAW == '%') {
- xmlParsePEReference(ctxt);
- } else
- xmlParseMarkupDecl(ctxt);
-
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
-
- if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {
- ctxt->errNo = XML_ERR_EXT_SUBSET_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Content error in the external subset\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- break;
- }
- }
- if (xmlParserDebugEntities) {
- if ((ctxt->input != NULL) && (ctxt->input->filename))
- xmlGenericError(xmlGenericErrorContext,
- "%s(%d): ", ctxt->input->filename,
- ctxt->input->line);
- xmlGenericError(xmlGenericErrorContext,
- "Leaving INCLUDE Conditional Section\n");
- }
-
- } else if ((RAW == 'I') && (NXT(1) == 'G') && (NXT(2) == 'N') &&
- (NXT(3) == 'O') && (NXT(4) == 'R') && (NXT(5) == 'E')) {
- int state;
- int instate;
- int depth = 0;
-
- SKIP(6);
- SKIP_BLANKS;
- if (RAW != '[') {
- ctxt->errNo = XML_ERR_CONDSEC_INVALID;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "XML conditional section '[' expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- NEXT;
- }
- if (xmlParserDebugEntities) {
- if ((ctxt->input != NULL) && (ctxt->input->filename))
- xmlGenericError(xmlGenericErrorContext,
- "%s(%d): ", ctxt->input->filename,
- ctxt->input->line);
- xmlGenericError(xmlGenericErrorContext,
- "Entering IGNORE Conditional Section\n");
- }
-
- /*
- * Parse up to the end of the conditional section
- * But disable SAX event generating DTD building in the meantime
- */
- state = ctxt->disableSAX;
- instate = ctxt->instate;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- ctxt->instate = XML_PARSER_IGNORE;
-
- while ((depth >= 0) && (RAW != 0)) {
- if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
- depth++;
- SKIP(3);
- continue;
- }
- if ((RAW == ']') && (NXT(1) == ']') && (NXT(2) == '>')) {
- if (--depth >= 0) SKIP(3);
- continue;
- }
- NEXT;
- continue;
- }
-
- ctxt->disableSAX = state;
- ctxt->instate = instate;
-
- if (xmlParserDebugEntities) {
- if ((ctxt->input != NULL) && (ctxt->input->filename))
- xmlGenericError(xmlGenericErrorContext,
- "%s(%d): ", ctxt->input->filename,
- ctxt->input->line);
- xmlGenericError(xmlGenericErrorContext,
- "Leaving IGNORE Conditional Section\n");
- }
-
- } else {
- ctxt->errNo = XML_ERR_CONDSEC_INVALID;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "XML conditional section INCLUDE or IGNORE keyword expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- if (RAW == 0)
- SHRINK;
-
- if (RAW == 0) {
- ctxt->errNo = XML_ERR_CONDSEC_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "XML conditional section not closed\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- SKIP(3);
- }
-}
-
-/**
- * xmlParseMarkupDecl:
- * @ctxt: an XML parser context
- *
- * parse Markup declarations
- *
- * [29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl |
- * NotationDecl | PI | Comment
- *
- * [ VC: Proper Declaration/PE Nesting ]
- * Parameter-entity replacement text must be properly nested with
- * markup declarations. That is to say, if either the first character
- * or the last character of a markup declaration (markupdecl above) is
- * contained in the replacement text for a parameter-entity reference,
- * both must be contained in the same replacement text.
- *
- * [ WFC: PEs in Internal Subset ]
- * In the internal DTD subset, parameter-entity references can occur
- * only where markup declarations can occur, not within markup declarations.
- * (This does not apply to references that occur in external parameter
- * entities or to the external subset.)
- */
-void
-xmlParseMarkupDecl(xmlParserCtxtPtr ctxt) {
- GROW;
- xmlParseElementDecl(ctxt);
- xmlParseAttributeListDecl(ctxt);
- xmlParseEntityDecl(ctxt);
- xmlParseNotationDecl(ctxt);
- xmlParsePI(ctxt);
- xmlParseComment(ctxt);
- /*
- * This is only for internal subset. On external entities,
- * the replacement is done before parsing stage
- */
- if ((ctxt->external == 0) && (ctxt->inputNr == 1))
- xmlParsePEReference(ctxt);
-
- /*
- * Conditional sections are allowed from entities included
- * by PE References in the internal subset.
- */
- if ((ctxt->external == 0) && (ctxt->inputNr > 1)) {
- if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
- xmlParseConditionalSections(ctxt);
- }
- }
-
- ctxt->instate = XML_PARSER_DTD;
-}
-
-/**
- * xmlParseTextDecl:
- * @ctxt: an XML parser context
- *
- * parse an XML declaration header for external entities
- *
- * [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
- *
- * Question: Seems that EncodingDecl is mandatory ? Is that a typo ?
- */
-
-void
-xmlParseTextDecl(xmlParserCtxtPtr ctxt) {
- xmlChar *version;
-
- /*
- * We know that '<?xml' is here.
- */
- if ((RAW == '<') && (NXT(1) == '?') &&
- (NXT(2) == 'x') && (NXT(3) == 'm') &&
- (NXT(4) == 'l') && (IS_BLANK(NXT(5)))) {
- SKIP(5);
- } else {
- ctxt->errNo = XML_ERR_XMLDECL_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Text declaration '<?xml' required\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
-
- return;
- }
-
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Space needed after '<?xml'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
-
- /*
- * We may have the VersionInfo here.
- */
- version = xmlParseVersionInfo(ctxt);
- if (version == NULL)
- version = xmlCharStrdup(XML_DEFAULT_VERSION);
- else {
- if (!IS_BLANK(CUR)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Space needed here\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- }
- ctxt->input->version = version;
-
- /*
- * We must have the encoding declaration
- */
- xmlParseEncodingDecl(ctxt);
- if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
- /*
- * The XML REC instructs us to stop parsing right here
- */
- return;
- }
-
- SKIP_BLANKS;
- if ((RAW == '?') && (NXT(1) == '>')) {
- SKIP(2);
- } else if (RAW == '>') {
- /* Deprecated old WD ... */
- ctxt->errNo = XML_ERR_XMLDECL_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "XML declaration must end-up with '?>'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- NEXT;
- } else {
- ctxt->errNo = XML_ERR_XMLDECL_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "parsing XML declaration: '?>' expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- MOVETO_ENDTAG(CUR_PTR);
- NEXT;
- }
-}
-
-/**
- * xmlParseExternalSubset:
- * @ctxt: an XML parser context
- * @ExternalID: the external identifier
- * @SystemID: the system identifier (or URL)
- *
- * parse Markup declarations from an external subset
- *
- * [30] extSubset ::= textDecl? extSubsetDecl
- *
- * [31] extSubsetDecl ::= (markupdecl | conditionalSect | PEReference | S) *
- */
-void
-xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID,
- const xmlChar *SystemID) {
- GROW;
- if ((RAW == '<') && (NXT(1) == '?') &&
- (NXT(2) == 'x') && (NXT(3) == 'm') &&
- (NXT(4) == 'l')) {
- xmlParseTextDecl(ctxt);
- if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
- /*
- * The XML REC instructs us to stop parsing right here
- */
- ctxt->instate = XML_PARSER_EOF;
- return;
- }
- }
- if (ctxt->myDoc == NULL) {
- ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0");
- }
- if ((ctxt->myDoc != NULL) && (ctxt->myDoc->intSubset == NULL))
- xmlCreateIntSubset(ctxt->myDoc, NULL, ExternalID, SystemID);
-
- ctxt->instate = XML_PARSER_DTD;
- ctxt->external = 1;
- while (((RAW == '<') && (NXT(1) == '?')) ||
- ((RAW == '<') && (NXT(1) == '!')) ||
- (RAW == '%') || IS_BLANK(CUR)) {
- const xmlChar *check = CUR_PTR;
- int cons = ctxt->input->consumed;
-
- GROW;
- if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
- xmlParseConditionalSections(ctxt);
- } else if (IS_BLANK(CUR)) {
- NEXT;
- } else if (RAW == '%') {
- xmlParsePEReference(ctxt);
- } else
- xmlParseMarkupDecl(ctxt);
-
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
-
- if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {
- ctxt->errNo = XML_ERR_EXT_SUBSET_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Content error in the external subset\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- break;
- }
- }
-
- if (RAW != 0) {
- ctxt->errNo = XML_ERR_EXT_SUBSET_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Extra content at the end of the document\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
-}
-
-/**
- * xmlParseReference:
- * @ctxt: an XML parser context
- *
- * parse and handle entity references in content, depending on the SAX
- * interface, this may end-up in a call to character() if this is a
- * CharRef, a predefined entity, if there is no reference() callback.
- * or if the parser was asked to switch to that mode.
- *
- * [67] Reference ::= EntityRef | CharRef
- */
-void
-xmlParseReference(xmlParserCtxtPtr ctxt) {
- xmlEntityPtr ent;
- xmlChar *val;
- if (RAW != '&') return;
-
- if (NXT(1) == '#') {
- int i = 0;
- xmlChar out[10];
- int hex = NXT(2);
- int value = xmlParseCharRef(ctxt);
-
- if (ctxt->charset != XML_CHAR_ENCODING_UTF8) {
- /*
- * So we are using non-UTF-8 buffers
- * Check that the char fit on 8bits, if not
- * generate a CharRef.
- */
- if (value <= 0xFF) {
- out[0] = value;
- out[1] = 0;
- if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL) &&
- (!ctxt->disableSAX))
- ctxt->sax->characters(ctxt->userData, out, 1);
- } else {
- if ((hex == 'x') || (hex == 'X'))
- snprintf((char *)out, sizeof(out), "#x%X", value);
- else
- snprintf((char *)out, sizeof(out), "#%d", value);
- if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) &&
- (!ctxt->disableSAX))
- ctxt->sax->reference(ctxt->userData, out);
- }
- } else {
- /*
- * Just encode the value in UTF-8
- */
- COPY_BUF(0 ,out, i, value);
- out[i] = 0;
- if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL) &&
- (!ctxt->disableSAX))
- ctxt->sax->characters(ctxt->userData, out, i);
- }
- } else {
- ent = xmlParseEntityRef(ctxt);
- if (ent == NULL) return;
- if (!ctxt->wellFormed)
- return;
- if ((ent->name != NULL) &&
- (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY)) {
- xmlNodePtr list = NULL;
- int ret;
-
-
- /*
- * The first reference to the entity trigger a parsing phase
- * where the ent->children is filled with the result from
- * the parsing.
- */
- if (ent->children == NULL) {
- xmlChar *value;
- value = ent->content;
-
- /*
- * Check that this entity is well formed
- */
- if ((value != NULL) &&
- (value[1] == 0) && (value[0] == '<') &&
- (xmlStrEqual(ent->name, BAD_CAST "lt"))) {
- /*
- * DONE: get definite answer on this !!!
- * Lots of entity decls are used to declare a single
- * char
- * <!ENTITY lt "<">
- * Which seems to be valid since
- * 2.4: The ampersand character (&) and the left angle
- * bracket (<) may appear in their literal form only
- * when used ... They are also legal within the literal
- * entity value of an internal entity declaration;i
- * see "4.3.2 Well-Formed Parsed Entities".
- * IMHO 2.4 and 4.3.2 are directly in contradiction.
- * Looking at the OASIS test suite and James Clark
- * tests, this is broken. However the XML REC uses
- * it. Is the XML REC not well-formed ????
- * This is a hack to avoid this problem
- *
- * ANSWER: since lt gt amp .. are already defined,
- * this is a redefinition and hence the fact that the
- * content is not well balanced is not a Wf error, this
- * is lousy but acceptable.
- */
- list = xmlNewDocText(ctxt->myDoc, value);
- if (list != NULL) {
- if ((ent->etype == XML_INTERNAL_GENERAL_ENTITY) &&
- (ent->children == NULL)) {
- ent->children = list;
- ent->last = list;
- list->parent = (xmlNodePtr) ent;
- } else {
- xmlFreeNodeList(list);
- }
- } else if (list != NULL) {
- xmlFreeNodeList(list);
- }
- } else {
- /*
- * 4.3.2: An internal general parsed entity is well-formed
- * if its replacement text matches the production labeled
- * content.
- */
-
- void *user_data;
- /*
- * This is a bit hackish but this seems the best
- * way to make sure both SAX and DOM entity support
- * behaves okay.
- */
- if (ctxt->userData == ctxt)
- user_data = NULL;
- else
- user_data = ctxt->userData;
-
- if (ent->etype == XML_INTERNAL_GENERAL_ENTITY) {
- ctxt->depth++;
- ret = xmlParseBalancedChunkMemoryInternal(ctxt,
- value, user_data, &list);
- ctxt->depth--;
- } else if (ent->etype ==
- XML_EXTERNAL_GENERAL_PARSED_ENTITY) {
- ctxt->depth++;
- ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt,
- ctxt->sax, user_data, ctxt->depth,
- ent->URI, ent->ExternalID, &list);
- ctxt->depth--;
- } else {
- ret = -1;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Internal: invalid entity type\n");
- }
- if (ret == XML_ERR_ENTITY_LOOP) {
- ctxt->errNo = XML_ERR_ENTITY_LOOP;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Detected entity reference loop\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return;
- } else if ((ret == 0) && (list != NULL)) {
- if (((ent->etype == XML_INTERNAL_GENERAL_ENTITY) ||
- (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY))&&
- (ent->children == NULL)) {
- ent->children = list;
- if (ctxt->replaceEntities) {
- /*
- * Prune it directly in the generated document
- * except for single text nodes.
- */
- if ((list->type == XML_TEXT_NODE) &&
- (list->next == NULL)) {
- list->parent = (xmlNodePtr) ent;
- list = NULL;
- } else {
- while (list != NULL) {
- list->parent = (xmlNodePtr) ctxt->node;
- list->doc = ctxt->myDoc;
- if (list->next == NULL)
- ent->last = list;
- list = list->next;
- }
- list = ent->children;
- if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)
- xmlAddEntityReference(ent, list, NULL);
- }
- } else {
- while (list != NULL) {
- list->parent = (xmlNodePtr) ent;
- if (list->next == NULL)
- ent->last = list;
- list = list->next;
- }
- }
- } else {
- xmlFreeNodeList(list);
- list = NULL;
- }
- } else if (ret > 0) {
- ctxt->errNo = ret;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Entity value required\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else if (list != NULL) {
- xmlFreeNodeList(list);
- list = NULL;
- }
- }
- }
- if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) &&
- (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) {
- /*
- * Create a node.
- */
- ctxt->sax->reference(ctxt->userData, ent->name);
- return;
- } else if (ctxt->replaceEntities) {
- if ((ctxt->node != NULL) && (ent->children != NULL)) {
- /*
- * Seems we are generating the DOM content, do
- * a simple tree copy for all references except the first
- * In the first occurrence list contains the replacement
- */
- if (list == NULL) {
- xmlNodePtr new = NULL, cur, firstChild = NULL;
- cur = ent->children;
- while (cur != NULL) {
- new = xmlCopyNode(cur, 1);
- if (firstChild == NULL){
- firstChild = new;
- }
- xmlAddChild(ctxt->node, new);
- if (cur == ent->last)
- break;
- cur = cur->next;
- }
- if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)
- xmlAddEntityReference(ent, firstChild, new);
- } else {
- /*
- * the name change is to avoid coalescing of the
- * node with a possible previous text one which
- * would make ent->children a dangling pointer
- */
- if (ent->children->type == XML_TEXT_NODE)
- ent->children->name = xmlStrdup(BAD_CAST "nbktext");
- if ((ent->last != ent->children) &&
- (ent->last->type == XML_TEXT_NODE))
- ent->last->name = xmlStrdup(BAD_CAST "nbktext");
- xmlAddChildList(ctxt->node, ent->children);
- }
-
- /*
- * This is to avoid a nasty side effect, see
- * characters() in SAX.c
- */
- ctxt->nodemem = 0;
- ctxt->nodelen = 0;
- return;
- } else {
- /*
- * Probably running in SAX mode
- */
- xmlParserInputPtr input;
-
- input = xmlNewEntityInputStream(ctxt, ent);
- xmlPushInput(ctxt, input);
- if ((ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) &&
- (RAW == '<') && (NXT(1) == '?') &&
- (NXT(2) == 'x') && (NXT(3) == 'm') &&
- (NXT(4) == 'l') && (IS_BLANK(NXT(5)))) {
- xmlParseTextDecl(ctxt);
- if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
- /*
- * The XML REC instructs us to stop parsing right here
- */
- ctxt->instate = XML_PARSER_EOF;
- return;
- }
- if (input->standalone == 1) {
- ctxt->errNo = XML_ERR_EXT_ENTITY_STANDALONE;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "external parsed entities cannot be standalone\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- }
- return;
- }
- }
- } else {
- val = ent->content;
- if (val == NULL) return;
- /*
- * inline the entity.
- */
- if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL) &&
- (!ctxt->disableSAX))
- ctxt->sax->characters(ctxt->userData, val, xmlStrlen(val));
- }
- }
-}
-
-/**
- * xmlParseEntityRef:
- * @ctxt: an XML parser context
- *
- * parse ENTITY references declarations
- *
- * [68] EntityRef ::= '&' Name ';'
- *
- * [ WFC: Entity Declared ]
- * In a document without any DTD, a document with only an internal DTD
- * subset which contains no parameter entity references, or a document
- * with "standalone='yes'", the Name given in the entity reference
- * must match that in an entity declaration, except that well-formed
- * documents need not declare any of the following entities: amp, lt,
- * gt, apos, quot. The declaration of a parameter entity must precede
- * any reference to it. Similarly, the declaration of a general entity
- * must precede any reference to it which appears in a default value in an
- * attribute-list declaration. Note that if entities are declared in the
- * external subset or in external parameter entities, a non-validating
- * processor is not obligated to read and process their declarations;
- * for such documents, the rule that an entity must be declared is a
- * well-formedness constraint only if standalone='yes'.
- *
- * [ WFC: Parsed Entity ]
- * An entity reference must not contain the name of an unparsed entity
- *
- * Returns the xmlEntityPtr if found, or NULL otherwise.
- */
-xmlEntityPtr
-xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlEntityPtr ent = NULL;
-
- GROW;
-
- if (RAW == '&') {
- NEXT;
- name = xmlParseName(ctxt);
- if (name == NULL) {
- ctxt->errNo = XML_ERR_NAME_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseEntityRef: no name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- if (RAW == ';') {
- NEXT;
- /*
- * Ask first SAX for entity resolution, otherwise try the
- * predefined set.
- */
- if (ctxt->sax != NULL) {
- if (ctxt->sax->getEntity != NULL)
- ent = ctxt->sax->getEntity(ctxt->userData, name);
- if (ent == NULL)
- ent = xmlGetPredefinedEntity(name);
- if ((ent == NULL) && (ctxt->userData==ctxt)) {
- ent = getEntity(ctxt, name);
- }
- }
- /*
- * [ WFC: Entity Declared ]
- * In a document without any DTD, a document with only an
- * internal DTD subset which contains no parameter entity
- * references, or a document with "standalone='yes'", the
- * Name given in the entity reference must match that in an
- * entity declaration, except that well-formed documents
- * need not declare any of the following entities: amp, lt,
- * gt, apos, quot.
- * The declaration of a parameter entity must precede any
- * reference to it.
- * Similarly, the declaration of a general entity must
- * precede any reference to it which appears in a default
- * value in an attribute-list declaration. Note that if
- * entities are declared in the external subset or in
- * external parameter entities, a non-validating processor
- * is not obligated to read and process their declarations;
- * for such documents, the rule that an entity must be
- * declared is a well-formedness constraint only if
- * standalone='yes'.
- */
- if (ent == NULL) {
- if ((ctxt->standalone == 1) ||
- ((ctxt->hasExternalSubset == 0) &&
- (ctxt->hasPErefs == 0))) {
- ctxt->errNo = XML_ERR_UNDECLARED_ENTITY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Entity '%s' not defined\n", name);
- ctxt->wellFormed = 0;
- ctxt->valid = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- ctxt->errNo = XML_WAR_UNDECLARED_ENTITY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Entity '%s' not defined\n", name);
- ctxt->valid = 0;
- }
- }
-
- /*
- * [ WFC: Parsed Entity ]
- * An entity reference must not contain the name of an
- * unparsed entity
- */
- else if (ent->etype == XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
- ctxt->errNo = XML_ERR_UNPARSED_ENTITY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Entity reference to unparsed entity %s\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- /*
- * [ WFC: No External Entity References ]
- * Attribute values cannot contain direct or indirect
- * entity references to external entities.
- */
- else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
- (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) {
- ctxt->errNo = XML_ERR_ENTITY_IS_EXTERNAL;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Attribute references external entity '%s'\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- /*
- * [ WFC: No < in Attribute Values ]
- * The replacement text of any entity referred to directly or
- * indirectly in an attribute value (other than "&lt;") must
- * not contain a <.
- */
- else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
- (ent != NULL) &&
- (!xmlStrEqual(ent->name, BAD_CAST "lt")) &&
- (ent->content != NULL) &&
- (xmlStrchr(ent->content, '<'))) {
- ctxt->errNo = XML_ERR_LT_IN_ATTRIBUTE;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "'<' in entity '%s' is not allowed in attributes values\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- /*
- * Internal check, no parameter entities here ...
- */
- else {
- switch (ent->etype) {
- case XML_INTERNAL_PARAMETER_ENTITY:
- case XML_EXTERNAL_PARAMETER_ENTITY:
- ctxt->errNo = XML_ERR_ENTITY_IS_PARAMETER;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Attempt to reference the parameter entity '%s'\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- break;
- default:
- break;
- }
- }
-
- /*
- * [ WFC: No Recursion ]
- * A parsed entity must not contain a recursive reference
- * to itself, either directly or indirectly.
- * Done somewhere else
- */
-
- } else {
- ctxt->errNo = XML_ERR_ENTITYREF_SEMICOL_MISSING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseEntityRef: expecting ';'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- xmlFree(name);
- }
- }
- return(ent);
-}
-
-/**
- * xmlParseStringEntityRef:
- * @ctxt: an XML parser context
- * @str: a pointer to an index in the string
- *
- * parse ENTITY references declarations, but this version parses it from
- * a string value.
- *
- * [68] EntityRef ::= '&' Name ';'
- *
- * [ WFC: Entity Declared ]
- * In a document without any DTD, a document with only an internal DTD
- * subset which contains no parameter entity references, or a document
- * with "standalone='yes'", the Name given in the entity reference
- * must match that in an entity declaration, except that well-formed
- * documents need not declare any of the following entities: amp, lt,
- * gt, apos, quot. The declaration of a parameter entity must precede
- * any reference to it. Similarly, the declaration of a general entity
- * must precede any reference to it which appears in a default value in an
- * attribute-list declaration. Note that if entities are declared in the
- * external subset or in external parameter entities, a non-validating
- * processor is not obligated to read and process their declarations;
- * for such documents, the rule that an entity must be declared is a
- * well-formedness constraint only if standalone='yes'.
- *
- * [ WFC: Parsed Entity ]
- * An entity reference must not contain the name of an unparsed entity
- *
- * Returns the xmlEntityPtr if found, or NULL otherwise. The str pointer
- * is updated to the current location in the string.
- */
-xmlEntityPtr
-xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
- xmlChar *name;
- const xmlChar *ptr;
- xmlChar cur;
- xmlEntityPtr ent = NULL;
-
- if ((str == NULL) || (*str == NULL))
- return(NULL);
- ptr = *str;
- cur = *ptr;
- if (cur == '&') {
- ptr++;
- cur = *ptr;
- name = xmlParseStringName(ctxt, &ptr);
- if (name == NULL) {
- ctxt->errNo = XML_ERR_NAME_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseStringEntityRef: no name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- if (*ptr == ';') {
- ptr++;
- /*
- * Ask first SAX for entity resolution, otherwise try the
- * predefined set.
- */
- if (ctxt->sax != NULL) {
- if (ctxt->sax->getEntity != NULL)
- ent = ctxt->sax->getEntity(ctxt->userData, name);
- if (ent == NULL)
- ent = xmlGetPredefinedEntity(name);
- if ((ent == NULL) && (ctxt->userData==ctxt)) {
- ent = getEntity(ctxt, name);
- }
- }
- /*
- * [ WFC: Entity Declared ]
- * In a document without any DTD, a document with only an
- * internal DTD subset which contains no parameter entity
- * references, or a document with "standalone='yes'", the
- * Name given in the entity reference must match that in an
- * entity declaration, except that well-formed documents
- * need not declare any of the following entities: amp, lt,
- * gt, apos, quot.
- * The declaration of a parameter entity must precede any
- * reference to it.
- * Similarly, the declaration of a general entity must
- * precede any reference to it which appears in a default
- * value in an attribute-list declaration. Note that if
- * entities are declared in the external subset or in
- * external parameter entities, a non-validating processor
- * is not obligated to read and process their declarations;
- * for such documents, the rule that an entity must be
- * declared is a well-formedness constraint only if
- * standalone='yes'.
- */
- if (ent == NULL) {
- if ((ctxt->standalone == 1) ||
- ((ctxt->hasExternalSubset == 0) &&
- (ctxt->hasPErefs == 0))) {
- ctxt->errNo = XML_ERR_UNDECLARED_ENTITY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Entity '%s' not defined\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- ctxt->errNo = XML_WAR_UNDECLARED_ENTITY;
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData,
- "Entity '%s' not defined\n", name);
- }
- }
-
- /*
- * [ WFC: Parsed Entity ]
- * An entity reference must not contain the name of an
- * unparsed entity
- */
- else if (ent->etype == XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
- ctxt->errNo = XML_ERR_UNPARSED_ENTITY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Entity reference to unparsed entity %s\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- /*
- * [ WFC: No External Entity References ]
- * Attribute values cannot contain direct or indirect
- * entity references to external entities.
- */
- else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
- (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) {
- ctxt->errNo = XML_ERR_ENTITY_IS_EXTERNAL;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Attribute references external entity '%s'\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- /*
- * [ WFC: No < in Attribute Values ]
- * The replacement text of any entity referred to directly or
- * indirectly in an attribute value (other than "&lt;") must
- * not contain a <.
- */
- else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
- (ent != NULL) &&
- (!xmlStrEqual(ent->name, BAD_CAST "lt")) &&
- (ent->content != NULL) &&
- (xmlStrchr(ent->content, '<'))) {
- ctxt->errNo = XML_ERR_LT_IN_ATTRIBUTE;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "'<' in entity '%s' is not allowed in attributes values\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- /*
- * Internal check, no parameter entities here ...
- */
- else {
- switch (ent->etype) {
- case XML_INTERNAL_PARAMETER_ENTITY:
- case XML_EXTERNAL_PARAMETER_ENTITY:
- ctxt->errNo = XML_ERR_ENTITY_IS_PARAMETER;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Attempt to reference the parameter entity '%s'\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- break;
- default:
- break;
- }
- }
-
- /*
- * [ WFC: No Recursion ]
- * A parsed entity must not contain a recursive reference
- * to itself, either directly or indirectly.
- * Done somewhere else
- */
-
- } else {
- ctxt->errNo = XML_ERR_ENTITYREF_SEMICOL_MISSING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseStringEntityRef: expecting ';'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- xmlFree(name);
- }
- }
- *str = ptr;
- return(ent);
-}
-
-/**
- * xmlParsePEReference:
- * @ctxt: an XML parser context
- *
- * parse PEReference declarations
- * The entity content is handled directly by pushing it's content as
- * a new input stream.
- *
- * [69] PEReference ::= '%' Name ';'
- *
- * [ WFC: No Recursion ]
- * A parsed entity must not contain a recursive
- * reference to itself, either directly or indirectly.
- *
- * [ WFC: Entity Declared ]
- * In a document without any DTD, a document with only an internal DTD
- * subset which contains no parameter entity references, or a document
- * with "standalone='yes'", ... ... The declaration of a parameter
- * entity must precede any reference to it...
- *
- * [ VC: Entity Declared ]
- * In a document with an external subset or external parameter entities
- * with "standalone='no'", ... ... The declaration of a parameter entity
- * must precede any reference to it...
- *
- * [ WFC: In DTD ]
- * Parameter-entity references may only appear in the DTD.
- * NOTE: misleading but this is handled.
- */
-void
-xmlParsePEReference(xmlParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlEntityPtr entity = NULL;
- xmlParserInputPtr input;
-
- if (RAW == '%') {
- NEXT;
- name = xmlParseName(ctxt);
- if (name == NULL) {
- ctxt->errNo = XML_ERR_NAME_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParsePEReference: no name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- if (RAW == ';') {
- NEXT;
- if ((ctxt->sax != NULL) &&
- (ctxt->sax->getParameterEntity != NULL))
- entity = ctxt->sax->getParameterEntity(ctxt->userData,
- name);
- if (entity == NULL) {
- /*
- * [ WFC: Entity Declared ]
- * In a document without any DTD, a document with only an
- * internal DTD subset which contains no parameter entity
- * references, or a document with "standalone='yes'", ...
- * ... The declaration of a parameter entity must precede
- * any reference to it...
- */
- if ((ctxt->standalone == 1) ||
- ((ctxt->hasExternalSubset == 0) &&
- (ctxt->hasPErefs == 0))) {
- ctxt->errNo = XML_ERR_UNDECLARED_ENTITY;
- if ((!ctxt->disableSAX) &&
- (ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "PEReference: %%%s; not found\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- /*
- * [ VC: Entity Declared ]
- * In a document with an external subset or external
- * parameter entities with "standalone='no'", ...
- * ... The declaration of a parameter entity must precede
- * any reference to it...
- */
- if ((!ctxt->disableSAX) &&
- (ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData,
- "PEReference: %%%s; not found\n", name);
- ctxt->valid = 0;
- }
- } else {
- /*
- * Internal checking in case the entity quest barfed
- */
- if ((entity->etype != XML_INTERNAL_PARAMETER_ENTITY) &&
- (entity->etype != XML_EXTERNAL_PARAMETER_ENTITY)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData,
- "Internal: %%%s; is not a parameter entity\n", name);
- } else if (ctxt->input->free != deallocblankswrapper) {
- input = xmlNewBlanksWrapperInputStream(ctxt, entity);
- xmlPushInput(ctxt, input);
- } else {
- /*
- * TODO !!!
- * handle the extra spaces added before and after
- * c.f. http://www.w3.org/TR/REC-xml#as-PE
- */
- input = xmlNewEntityInputStream(ctxt, entity);
- xmlPushInput(ctxt, input);
- if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
- (RAW == '<') && (NXT(1) == '?') &&
- (NXT(2) == 'x') && (NXT(3) == 'm') &&
- (NXT(4) == 'l') && (IS_BLANK(NXT(5)))) {
- xmlParseTextDecl(ctxt);
- if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
- /*
- * The XML REC instructs us to stop parsing
- * right here
- */
- ctxt->instate = XML_PARSER_EOF;
- xmlFree(name);
- return;
- }
- }
- }
- }
- ctxt->hasPErefs = 1;
- } else {
- ctxt->errNo = XML_ERR_ENTITYREF_SEMICOL_MISSING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParsePEReference: expecting ';'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- xmlFree(name);
- }
- }
-}
-
-/**
- * xmlParseStringPEReference:
- * @ctxt: an XML parser context
- * @str: a pointer to an index in the string
- *
- * parse PEReference declarations
- *
- * [69] PEReference ::= '%' Name ';'
- *
- * [ WFC: No Recursion ]
- * A parsed entity must not contain a recursive
- * reference to itself, either directly or indirectly.
- *
- * [ WFC: Entity Declared ]
- * In a document without any DTD, a document with only an internal DTD
- * subset which contains no parameter entity references, or a document
- * with "standalone='yes'", ... ... The declaration of a parameter
- * entity must precede any reference to it...
- *
- * [ VC: Entity Declared ]
- * In a document with an external subset or external parameter entities
- * with "standalone='no'", ... ... The declaration of a parameter entity
- * must precede any reference to it...
- *
- * [ WFC: In DTD ]
- * Parameter-entity references may only appear in the DTD.
- * NOTE: misleading but this is handled.
- *
- * Returns the string of the entity content.
- * str is updated to the current value of the index
- */
-xmlEntityPtr
-xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
- const xmlChar *ptr;
- xmlChar cur;
- xmlChar *name;
- xmlEntityPtr entity = NULL;
-
- if ((str == NULL) || (*str == NULL)) return(NULL);
- ptr = *str;
- cur = *ptr;
- if (cur == '%') {
- ptr++;
- cur = *ptr;
- name = xmlParseStringName(ctxt, &ptr);
- if (name == NULL) {
- ctxt->errNo = XML_ERR_NAME_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseStringPEReference: no name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- cur = *ptr;
- if (cur == ';') {
- ptr++;
- cur = *ptr;
- if ((ctxt->sax != NULL) &&
- (ctxt->sax->getParameterEntity != NULL))
- entity = ctxt->sax->getParameterEntity(ctxt->userData,
- name);
- if (entity == NULL) {
- /*
- * [ WFC: Entity Declared ]
- * In a document without any DTD, a document with only an
- * internal DTD subset which contains no parameter entity
- * references, or a document with "standalone='yes'", ...
- * ... The declaration of a parameter entity must precede
- * any reference to it...
- */
- if ((ctxt->standalone == 1) ||
- ((ctxt->hasExternalSubset == 0) &&
- (ctxt->hasPErefs == 0))) {
- ctxt->errNo = XML_ERR_UNDECLARED_ENTITY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "PEReference: %%%s; not found\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- /*
- * [ VC: Entity Declared ]
- * In a document with an external subset or external
- * parameter entities with "standalone='no'", ...
- * ... The declaration of a parameter entity must
- * precede any reference to it...
- */
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData,
- "PEReference: %%%s; not found\n", name);
- ctxt->valid = 0;
- }
- } else {
- /*
- * Internal checking in case the entity quest barfed
- */
- if ((entity->etype != XML_INTERNAL_PARAMETER_ENTITY) &&
- (entity->etype != XML_EXTERNAL_PARAMETER_ENTITY)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData,
- "Internal: %%%s; is not a parameter entity\n", name);
- }
- }
- ctxt->hasPErefs = 1;
- } else {
- ctxt->errNo = XML_ERR_ENTITYREF_SEMICOL_MISSING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseStringPEReference: expecting ';'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- xmlFree(name);
- }
- }
- *str = ptr;
- return(entity);
-}
-
-/**
- * xmlParseDocTypeDecl:
- * @ctxt: an XML parser context
- *
- * parse a DOCTYPE declaration
- *
- * [28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S?
- * ('[' (markupdecl | PEReference | S)* ']' S?)? '>'
- *
- * [ VC: Root Element Type ]
- * The Name in the document type declaration must match the element
- * type of the root element.
- */
-
-void
-xmlParseDocTypeDecl(xmlParserCtxtPtr ctxt) {
- xmlChar *name = NULL;
- xmlChar *ExternalID = NULL;
- xmlChar *URI = NULL;
-
- /*
- * We know that '<!DOCTYPE' has been detected.
- */
- SKIP(9);
-
- SKIP_BLANKS;
-
- /*
- * Parse the DOCTYPE name.
- */
- name = xmlParseName(ctxt);
- if (name == NULL) {
- ctxt->errNo = XML_ERR_NAME_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseDocTypeDecl : no DOCTYPE name !\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- ctxt->intSubName = name;
-
- SKIP_BLANKS;
-
- /*
- * Check for SystemID and ExternalID
- */
- URI = xmlParseExternalID(ctxt, &ExternalID, 1);
-
- if ((URI != NULL) || (ExternalID != NULL)) {
- ctxt->hasExternalSubset = 1;
- }
- ctxt->extSubURI = URI;
- ctxt->extSubSystem = ExternalID;
-
- SKIP_BLANKS;
-
- /*
- * Create and update the internal subset.
- */
- if ((ctxt->sax != NULL) && (ctxt->sax->internalSubset != NULL) &&
- (!ctxt->disableSAX))
- ctxt->sax->internalSubset(ctxt->userData, name, ExternalID, URI);
-
- /*
- * Is there any internal subset declarations ?
- * they are handled separately in xmlParseInternalSubset()
- */
- if (RAW == '[')
- return;
-
- /*
- * We should be at the end of the DOCTYPE declaration.
- */
- if (RAW != '>') {
- ctxt->errNo = XML_ERR_DOCTYPE_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "DOCTYPE improperly terminated\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- NEXT;
-}
-
-/**
- * xmlParseInternalSubset:
- * @ctxt: an XML parser context
- *
- * parse the internal subset declaration
- *
- * [28 end] ('[' (markupdecl | PEReference | S)* ']' S?)? '>'
- */
-
-static void
-xmlParseInternalSubset(xmlParserCtxtPtr ctxt) {
- /*
- * Is there any DTD definition ?
- */
- if (RAW == '[') {
- ctxt->instate = XML_PARSER_DTD;
- NEXT;
- /*
- * Parse the succession of Markup declarations and
- * PEReferences.
- * Subsequence (markupdecl | PEReference | S)*
- */
- while (RAW != ']') {
- const xmlChar *check = CUR_PTR;
- int cons = ctxt->input->consumed;
-
- SKIP_BLANKS;
- xmlParseMarkupDecl(ctxt);
- xmlParsePEReference(ctxt);
-
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
-
- if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {
- ctxt->errNo = XML_ERR_INTERNAL_ERROR;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseInternalSubset: error detected in Markup declaration\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- break;
- }
- }
- if (RAW == ']') {
- NEXT;
- SKIP_BLANKS;
- }
- }
-
- /*
- * We should be at the end of the DOCTYPE declaration.
- */
- if (RAW != '>') {
- ctxt->errNo = XML_ERR_DOCTYPE_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "DOCTYPE improperly terminated\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- NEXT;
-}
-
-/**
- * xmlParseAttribute:
- * @ctxt: an XML parser context
- * @value: a xmlChar ** used to store the value of the attribute
- *
- * parse an attribute
- *
- * [41] Attribute ::= Name Eq AttValue
- *
- * [ WFC: No External Entity References ]
- * Attribute values cannot contain direct or indirect entity references
- * to external entities.
- *
- * [ WFC: No < in Attribute Values ]
- * The replacement text of any entity referred to directly or indirectly in
- * an attribute value (other than "&lt;") must not contain a <.
- *
- * [ VC: Attribute Value Type ]
- * The attribute must have been declared; the value must be of the type
- * declared for it.
- *
- * [25] Eq ::= S? '=' S?
- *
- * With namespace:
- *
- * [NS 11] Attribute ::= QName Eq AttValue
- *
- * Also the case QName == xmlns:??? is handled independently as a namespace
- * definition.
- *
- * Returns the attribute name, and the value in *value.
- */
-
-xmlChar *
-xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlChar **value) {
- xmlChar *name, *val;
-
- *value = NULL;
- GROW;
- name = xmlParseName(ctxt);
- if (name == NULL) {
- ctxt->errNo = XML_ERR_NAME_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "error parsing attribute name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(NULL);
- }
-
- /*
- * read the value
- */
- SKIP_BLANKS;
- if (RAW == '=') {
- NEXT;
- SKIP_BLANKS;
- val = xmlParseAttValue(ctxt);
- ctxt->instate = XML_PARSER_CONTENT;
- } else {
- ctxt->errNo = XML_ERR_ATTRIBUTE_WITHOUT_VALUE;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Specification mandate value for attribute %s\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- xmlFree(name);
- return(NULL);
- }
-
- /*
- * Check that xml:lang conforms to the specification
- * No more registered as an error, just generate a warning now
- * since this was deprecated in XML second edition
- */
- if ((ctxt->pedantic) && (xmlStrEqual(name, BAD_CAST "xml:lang"))) {
- if (!xmlCheckLanguageID(val)) {
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData,
- "Malformed value for xml:lang : %s\n", val);
- }
- }
-
- /*
- * Check that xml:space conforms to the specification
- */
- if (xmlStrEqual(name, BAD_CAST "xml:space")) {
- if (xmlStrEqual(val, BAD_CAST "default"))
- *(ctxt->space) = 0;
- else if (xmlStrEqual(val, BAD_CAST "preserve"))
- *(ctxt->space) = 1;
- else {
- ctxt->errNo = XML_ERR_ATTRIBUTE_WITHOUT_VALUE;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
-"Invalid value for xml:space : \"%s\", \"default\" or \"preserve\" expected\n",
- val);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- }
-
- *value = val;
- return(name);
-}
-
-/**
- * xmlParseStartTag:
- * @ctxt: an XML parser context
- *
- * parse a start of tag either for rule element or
- * EmptyElement. In both case we don't parse the tag closing chars.
- *
- * [40] STag ::= '<' Name (S Attribute)* S? '>'
- *
- * [ WFC: Unique Att Spec ]
- * No attribute name may appear more than once in the same start-tag or
- * empty-element tag.
- *
- * [44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>'
- *
- * [ WFC: Unique Att Spec ]
- * No attribute name may appear more than once in the same start-tag or
- * empty-element tag.
- *
- * With namespace:
- *
- * [NS 8] STag ::= '<' QName (S Attribute)* S? '>'
- *
- * [NS 10] EmptyElement ::= '<' QName (S Attribute)* S? '/>'
- *
- * Returns the element name parsed
- */
-
-xmlChar *
-xmlParseStartTag(xmlParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlChar *attname;
- xmlChar *attvalue;
- const xmlChar **atts = NULL;
- int nbatts = 0;
- int maxatts = 0;
- int i;
-
- if (RAW != '<') return(NULL);
- NEXT1;
-
- name = xmlParseName(ctxt);
- if (name == NULL) {
- ctxt->errNo = XML_ERR_NAME_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseStartTag: invalid element name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(NULL);
- }
-
- /*
- * Now parse the attributes, it ends up with the ending
- *
- * (S Attribute)* S?
- */
- SKIP_BLANKS;
- GROW;
-
- while ((RAW != '>') &&
- ((RAW != '/') || (NXT(1) != '>')) &&
- (IS_CHAR(RAW))) {
- const xmlChar *q = CUR_PTR;
- int cons = ctxt->input->consumed;
-
- attname = xmlParseAttribute(ctxt, &attvalue);
- if ((attname != NULL) && (attvalue != NULL)) {
- /*
- * [ WFC: Unique Att Spec ]
- * No attribute name may appear more than once in the same
- * start-tag or empty-element tag.
- */
- for (i = 0; i < nbatts;i += 2) {
- if (xmlStrEqual(atts[i], attname)) {
- ctxt->errNo = XML_ERR_ATTRIBUTE_REDEFINED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Attribute %s redefined\n",
- attname);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- xmlFree(attname);
- xmlFree(attvalue);
- goto failed;
- }
- }
-
- /*
- * Add the pair to atts
- */
- if (atts == NULL) {
- maxatts = 10;
- atts = (const xmlChar **) xmlMalloc(maxatts * sizeof(xmlChar *));
- if (atts == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %ld byte failed\n",
- maxatts * (long)sizeof(xmlChar *));
- return(NULL);
- }
- } else if (nbatts + 4 > maxatts) {
- maxatts *= 2;
- atts = (const xmlChar **) xmlRealloc((void *) atts,
- maxatts * sizeof(xmlChar *));
- if (atts == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %ld byte failed\n",
- maxatts * (long)sizeof(xmlChar *));
- return(NULL);
- }
- }
- atts[nbatts++] = attname;
- atts[nbatts++] = attvalue;
- atts[nbatts] = NULL;
- atts[nbatts + 1] = NULL;
- } else {
- if (attname != NULL)
- xmlFree(attname);
- if (attvalue != NULL)
- xmlFree(attvalue);
- }
-
-failed:
-
- if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>'))))
- break;
- if (!IS_BLANK(RAW)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "attributes construct error\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
- if ((cons == ctxt->input->consumed) && (q == CUR_PTR)) {
- ctxt->errNo = XML_ERR_INTERNAL_ERROR;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseStartTag: problem parsing attributes\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- break;
- }
- GROW;
- }
-
- /*
- * SAX: Start of Element !
- */
- if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL) &&
- (!ctxt->disableSAX))
- ctxt->sax->startElement(ctxt->userData, name, atts);
-
- if (atts != NULL) {
- for (i = 0;i < nbatts;i++) xmlFree((xmlChar *) atts[i]);
- xmlFree((void *) atts);
- }
- return(name);
-}
-
-/**
- * xmlParseEndTag:
- * @ctxt: an XML parser context
- *
- * parse an end of tag
- *
- * [42] ETag ::= '</' Name S? '>'
- *
- * With namespace
- *
- * [NS 9] ETag ::= '</' QName S? '>'
- */
-
-void
-xmlParseEndTag(xmlParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlChar *oldname;
-
- GROW;
- if ((RAW != '<') || (NXT(1) != '/')) {
- ctxt->errNo = XML_ERR_LTSLASH_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "xmlParseEndTag: '</' not found\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return;
- }
- SKIP(2);
-
- name = xmlParseNameAndCompare(ctxt,ctxt->name);
-
- /*
- * We should definitely be at the ending "S? '>'" part
- */
- GROW;
- SKIP_BLANKS;
- if ((!IS_CHAR(RAW)) || (RAW != '>')) {
- ctxt->errNo = XML_ERR_GT_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "End tag : expected '>'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else
- NEXT1;
-
- /*
- * [ WFC: Element Type Match ]
- * The Name in an element's end-tag must match the element type in the
- * start-tag.
- *
- */
- if (name != (xmlChar*)1) {
- ctxt->errNo = XML_ERR_TAG_NAME_MISMATCH;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) {
- if (name != NULL) {
- ctxt->sax->error(ctxt->userData,
- "Opening and ending tag mismatch: %s and %s\n",
- ctxt->name, name);
- } else {
- ctxt->sax->error(ctxt->userData,
- "Ending tag error for: %s\n", ctxt->name);
- }
-
- }
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
-#if 0
- else {
- /*
- * Recover in case of one missing close
- */
- if ((ctxt->nameNr > 2) &&
- (xmlStrEqual(ctxt->nameTab[ctxt->nameNr -2], name))) {
- namePop(ctxt);
- spacePop(ctxt);
- }
- }
-#endif
- if (name != NULL)
- xmlFree(name);
- }
-
- /*
- * SAX: End of Tag
- */
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL) &&
- (!ctxt->disableSAX))
- ctxt->sax->endElement(ctxt->userData, ctxt->name);
-
- oldname = namePop(ctxt);
- spacePop(ctxt);
- if (oldname != NULL) {
-#ifdef DEBUG_STACK
- xmlGenericError(xmlGenericErrorContext,"Close: popped %s\n", oldname);
-#endif
- xmlFree(oldname);
- }
- return;
-}
-
-/**
- * xmlParseCDSect:
- * @ctxt: an XML parser context
- *
- * Parse escaped pure raw content.
- *
- * [18] CDSect ::= CDStart CData CDEnd
- *
- * [19] CDStart ::= '<![CDATA['
- *
- * [20] Data ::= (Char* - (Char* ']]>' Char*))
- *
- * [21] CDEnd ::= ']]>'
- */
-void
-xmlParseCDSect(xmlParserCtxtPtr ctxt) {
- xmlChar *buf = NULL;
- int len = 0;
- int size = XML_PARSER_BUFFER_SIZE;
- int r, rl;
- int s, sl;
- int cur, l;
- int count = 0;
-
- if ((NXT(0) == '<') && (NXT(1) == '!') &&
- (NXT(2) == '[') && (NXT(3) == 'C') &&
- (NXT(4) == 'D') && (NXT(5) == 'A') &&
- (NXT(6) == 'T') && (NXT(7) == 'A') &&
- (NXT(8) == '[')) {
- SKIP(9);
- } else
- return;
-
- ctxt->instate = XML_PARSER_CDATA_SECTION;
- r = CUR_CHAR(rl);
- if (!IS_CHAR(r)) {
- ctxt->errNo = XML_ERR_CDATA_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "CData section not finished\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- ctxt->instate = XML_PARSER_CONTENT;
- return;
- }
- NEXTL(rl);
- s = CUR_CHAR(sl);
- if (!IS_CHAR(s)) {
- ctxt->errNo = XML_ERR_CDATA_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "CData section not finished\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- ctxt->instate = XML_PARSER_CONTENT;
- return;
- }
- NEXTL(sl);
- cur = CUR_CHAR(l);
- buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", size);
- return;
- }
- while (IS_CHAR(cur) &&
- ((r != ']') || (s != ']') || (cur != '>'))) {
- if (len + 5 >= size) {
- size *= 2;
- buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %d byte failed\n", size);
- return;
- }
- }
- COPY_BUF(rl,buf,len,r);
- r = s;
- rl = sl;
- s = cur;
- sl = l;
- count++;
- if (count > 50) {
- GROW;
- count = 0;
- }
- NEXTL(l);
- cur = CUR_CHAR(l);
- }
- buf[len] = 0;
- ctxt->instate = XML_PARSER_CONTENT;
- if (cur != '>') {
- ctxt->errNo = XML_ERR_CDATA_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "CData section not finished\n%.50s\n", buf);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- xmlFree(buf);
- return;
- }
- NEXTL(l);
-
- /*
- * OK the buffer is to be consumed as cdata.
- */
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) {
- if (ctxt->sax->cdataBlock != NULL)
- ctxt->sax->cdataBlock(ctxt->userData, buf, len);
- else if (ctxt->sax->characters != NULL)
- ctxt->sax->characters(ctxt->userData, buf, len);
- }
- xmlFree(buf);
-}
-
-/**
- * xmlParseContent:
- * @ctxt: an XML parser context
- *
- * Parse a content:
- *
- * [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*
- */
-
-void
-xmlParseContent(xmlParserCtxtPtr ctxt) {
- GROW;
- while ((RAW != 0) &&
- ((RAW != '<') || (NXT(1) != '/'))) {
- const xmlChar *test = CUR_PTR;
- int cons = ctxt->input->consumed;
- const xmlChar *cur = ctxt->input->cur;
-
- /*
- * First case : a Processing Instruction.
- */
- if ((*cur == '<') && (cur[1] == '?')) {
- xmlParsePI(ctxt);
- }
-
- /*
- * Second case : a CDSection
- */
- else if ((*cur == '<') && (NXT(1) == '!') &&
- (NXT(2) == '[') && (NXT(3) == 'C') &&
- (NXT(4) == 'D') && (NXT(5) == 'A') &&
- (NXT(6) == 'T') && (NXT(7) == 'A') &&
- (NXT(8) == '[')) {
- xmlParseCDSect(ctxt);
- }
-
- /*
- * Third case : a comment
- */
- else if ((*cur == '<') && (NXT(1) == '!') &&
- (NXT(2) == '-') && (NXT(3) == '-')) {
- xmlParseComment(ctxt);
- ctxt->instate = XML_PARSER_CONTENT;
- }
-
- /*
- * Fourth case : a sub-element.
- */
- else if (*cur == '<') {
- xmlParseElement(ctxt);
- }
-
- /*
- * Fifth case : a reference. If if has not been resolved,
- * parsing returns it's Name, create the node
- */
-
- else if (*cur == '&') {
- xmlParseReference(ctxt);
- }
-
- /*
- * Last case, text. Note that References are handled directly.
- */
- else {
- xmlParseCharData(ctxt, 0);
- }
-
- GROW;
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
- SHRINK;
-
- if ((cons == ctxt->input->consumed) && (test == CUR_PTR)) {
- ctxt->errNo = XML_ERR_INTERNAL_ERROR;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "detected an error in element content\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- ctxt->instate = XML_PARSER_EOF;
- break;
- }
- }
-}
-
-/**
- * xmlParseElement:
- * @ctxt: an XML parser context
- *
- * parse an XML element, this is highly recursive
- *
- * [39] element ::= EmptyElemTag | STag content ETag
- *
- * [ WFC: Element Type Match ]
- * The Name in an element's end-tag must match the element type in the
- * start-tag.
- *
- * [ VC: Element Valid ]
- * An element is valid if there is a declaration matching elementdecl
- * where the Name matches the element type and one of the following holds:
- * - The declaration matches EMPTY and the element has no content.
- * - The declaration matches children and the sequence of child elements
- * belongs to the language generated by the regular expression in the
- * content model, with optional white space (characters matching the
- * nonterminal S) between each pair of child elements.
- * - The declaration matches Mixed and the content consists of character
- * data and child elements whose types match names in the content model.
- * - The declaration matches ANY, and the types of any child elements have
- * been declared.
- */
-
-void
-xmlParseElement(xmlParserCtxtPtr ctxt) {
- xmlChar *name;
- xmlChar *oldname;
- xmlParserNodeInfo node_info;
- xmlNodePtr ret;
-
- /* Capture start position */
- if (ctxt->record_info) {
- node_info.begin_pos = ctxt->input->consumed +
- (CUR_PTR - ctxt->input->base);
- node_info.begin_line = ctxt->input->line;
- }
-
- if (ctxt->spaceNr == 0)
- spacePush(ctxt, -1);
- else
- spacePush(ctxt, *ctxt->space);
-
- name = xmlParseStartTag(ctxt);
- if (name == NULL) {
- spacePop(ctxt);
- return;
- }
- namePush(ctxt, name);
- ret = ctxt->node;
-
- /*
- * [ VC: Root Element Type ]
- * The Name in the document type declaration must match the element
- * type of the root element.
- */
- if (ctxt->validate && ctxt->wellFormed && ctxt->myDoc &&
- ctxt->node && (ctxt->node == ctxt->myDoc->children))
- ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
-
- /*
- * Check for an Empty Element.
- */
- if ((RAW == '/') && (NXT(1) == '>')) {
- SKIP(2);
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL) &&
- (!ctxt->disableSAX))
- ctxt->sax->endElement(ctxt->userData, name);
- oldname = namePop(ctxt);
- spacePop(ctxt);
- if (oldname != NULL) {
-#ifdef DEBUG_STACK
- xmlGenericError(xmlGenericErrorContext,"Close: popped %s\n", oldname);
-#endif
- xmlFree(oldname);
- }
- if ( ret != NULL && ctxt->record_info ) {
- node_info.end_pos = ctxt->input->consumed +
- (CUR_PTR - ctxt->input->base);
- node_info.end_line = ctxt->input->line;
- node_info.node = ret;
- xmlParserAddNodeInfo(ctxt, &node_info);
- }
- return;
- }
- if (RAW == '>') {
- NEXT1;
- } else {
- ctxt->errNo = XML_ERR_GT_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Couldn't find end of Start Tag %s\n",
- name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
-
- /*
- * end of parsing of this node.
- */
- nodePop(ctxt);
- oldname = namePop(ctxt);
- spacePop(ctxt);
- if (oldname != NULL) {
-#ifdef DEBUG_STACK
- xmlGenericError(xmlGenericErrorContext,"Close: popped %s\n", oldname);
-#endif
- xmlFree(oldname);
- }
-
- /*
- * Capture end position and add node
- */
- if ( ret != NULL && ctxt->record_info ) {
- node_info.end_pos = ctxt->input->consumed +
- (CUR_PTR - ctxt->input->base);
- node_info.end_line = ctxt->input->line;
- node_info.node = ret;
- xmlParserAddNodeInfo(ctxt, &node_info);
- }
- return;
- }
-
- /*
- * Parse the content of the element:
- */
- xmlParseContent(ctxt);
- if (!IS_CHAR(RAW)) {
- ctxt->errNo = XML_ERR_TAG_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Premature end of data in tag %s\n", name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
-
- /*
- * end of parsing of this node.
- */
- nodePop(ctxt);
- oldname = namePop(ctxt);
- spacePop(ctxt);
- if (oldname != NULL) {
-#ifdef DEBUG_STACK
- xmlGenericError(xmlGenericErrorContext,"Close: popped %s\n", oldname);
-#endif
- xmlFree(oldname);
- }
- return;
- }
-
- /*
- * parse the end of tag: '</' should be here.
- */
- xmlParseEndTag(ctxt);
-
- /*
- * Capture end position and add node
- */
- if ( ret != NULL && ctxt->record_info ) {
- node_info.end_pos = ctxt->input->consumed +
- (CUR_PTR - ctxt->input->base);
- node_info.end_line = ctxt->input->line;
- node_info.node = ret;
- xmlParserAddNodeInfo(ctxt, &node_info);
- }
-}
-
-/**
- * xmlParseVersionNum:
- * @ctxt: an XML parser context
- *
- * parse the XML version value.
- *
- * [26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')+
- *
- * Returns the string giving the XML version number, or NULL
- */
-xmlChar *
-xmlParseVersionNum(xmlParserCtxtPtr ctxt) {
- xmlChar *buf = NULL;
- int len = 0;
- int size = 10;
- xmlChar cur;
-
- buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", size);
- return(NULL);
- }
- cur = CUR;
- while (((cur >= 'a') && (cur <= 'z')) ||
- ((cur >= 'A') && (cur <= 'Z')) ||
- ((cur >= '0') && (cur <= '9')) ||
- (cur == '_') || (cur == '.') ||
- (cur == ':') || (cur == '-')) {
- if (len + 1 >= size) {
- size *= 2;
- buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %d byte failed\n", size);
- return(NULL);
- }
- }
- buf[len++] = cur;
- NEXT;
- cur=CUR;
- }
- buf[len] = 0;
- return(buf);
-}
-
-/**
- * xmlParseVersionInfo:
- * @ctxt: an XML parser context
- *
- * parse the XML version.
- *
- * [24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ")
- *
- * [25] Eq ::= S? '=' S?
- *
- * Returns the version string, e.g. "1.0"
- */
-
-xmlChar *
-xmlParseVersionInfo(xmlParserCtxtPtr ctxt) {
- xmlChar *version = NULL;
- const xmlChar *q;
-
- if ((RAW == 'v') && (NXT(1) == 'e') &&
- (NXT(2) == 'r') && (NXT(3) == 's') &&
- (NXT(4) == 'i') && (NXT(5) == 'o') &&
- (NXT(6) == 'n')) {
- SKIP(7);
- SKIP_BLANKS;
- if (RAW != '=') {
- ctxt->errNo = XML_ERR_EQUAL_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseVersionInfo : expected '='\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(NULL);
- }
- NEXT;
- SKIP_BLANKS;
- if (RAW == '"') {
- NEXT;
- q = CUR_PTR;
- version = xmlParseVersionNum(ctxt);
- if (RAW != '"') {
- ctxt->errNo = XML_ERR_STRING_NOT_CLOSED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "String not closed\n%.50s\n", q);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else
- NEXT;
- } else if (RAW == '\''){
- NEXT;
- q = CUR_PTR;
- version = xmlParseVersionNum(ctxt);
- if (RAW != '\'') {
- ctxt->errNo = XML_ERR_STRING_NOT_CLOSED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "String not closed\n%.50s\n", q);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else
- NEXT;
- } else {
- ctxt->errNo = XML_ERR_STRING_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseVersionInfo : expected ' or \"\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- }
- return(version);
-}
-
-/**
- * xmlParseEncName:
- * @ctxt: an XML parser context
- *
- * parse the XML encoding name
- *
- * [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
- *
- * Returns the encoding name value or NULL
- */
-xmlChar *
-xmlParseEncName(xmlParserCtxtPtr ctxt) {
- xmlChar *buf = NULL;
- int len = 0;
- int size = 10;
- xmlChar cur;
-
- cur = CUR;
- if (((cur >= 'a') && (cur <= 'z')) ||
- ((cur >= 'A') && (cur <= 'Z'))) {
- buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", size);
- return(NULL);
- }
-
- buf[len++] = cur;
- NEXT;
- cur = CUR;
- while (((cur >= 'a') && (cur <= 'z')) ||
- ((cur >= 'A') && (cur <= 'Z')) ||
- ((cur >= '0') && (cur <= '9')) ||
- (cur == '.') || (cur == '_') ||
- (cur == '-')) {
- if (len + 1 >= size) {
- size *= 2;
- buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %d byte failed\n", size);
- return(NULL);
- }
- }
- buf[len++] = cur;
- NEXT;
- cur = CUR;
- if (cur == 0) {
- SHRINK;
- GROW;
- cur = CUR;
- }
- }
- buf[len] = 0;
- } else {
- ctxt->errNo = XML_ERR_ENCODING_NAME;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Invalid XML encoding name\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- return(buf);
-}
-
-/**
- * xmlParseEncodingDecl:
- * @ctxt: an XML parser context
- *
- * parse the XML encoding declaration
- *
- * [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName "'")
- *
- * this setups the conversion filters.
- *
- * Returns the encoding value or NULL
- */
-
-xmlChar *
-xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) {
- xmlChar *encoding = NULL;
- const xmlChar *q;
-
- SKIP_BLANKS;
- if ((RAW == 'e') && (NXT(1) == 'n') &&
- (NXT(2) == 'c') && (NXT(3) == 'o') &&
- (NXT(4) == 'd') && (NXT(5) == 'i') &&
- (NXT(6) == 'n') && (NXT(7) == 'g')) {
- SKIP(8);
- SKIP_BLANKS;
- if (RAW != '=') {
- ctxt->errNo = XML_ERR_EQUAL_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseEncodingDecl : expected '='\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(NULL);
- }
- NEXT;
- SKIP_BLANKS;
- if (RAW == '"') {
- NEXT;
- q = CUR_PTR;
- encoding = xmlParseEncName(ctxt);
- if (RAW != '"') {
- ctxt->errNo = XML_ERR_STRING_NOT_CLOSED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "String not closed\n%.50s\n", q);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else
- NEXT;
- } else if (RAW == '\''){
- NEXT;
- q = CUR_PTR;
- encoding = xmlParseEncName(ctxt);
- if (RAW != '\'') {
- ctxt->errNo = XML_ERR_STRING_NOT_CLOSED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "String not closed\n%.50s\n", q);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else
- NEXT;
- } else {
- ctxt->errNo = XML_ERR_STRING_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseEncodingDecl : expected ' or \"\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if (encoding != NULL) {
- xmlCharEncoding enc;
- xmlCharEncodingHandlerPtr handler;
-
- if (ctxt->input->encoding != NULL)
- xmlFree((xmlChar *) ctxt->input->encoding);
- ctxt->input->encoding = encoding;
-
- enc = xmlParseCharEncoding((const char *) encoding);
- /*
- * registered set of known encodings
- */
- if (enc != XML_CHAR_ENCODING_ERROR) {
- xmlSwitchEncoding(ctxt, enc);
- if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
- ctxt->input->encoding = NULL;
- xmlFree(encoding);
- return(NULL);
- }
- } else {
- /*
- * fallback for unknown encodings
- */
- handler = xmlFindCharEncodingHandler((const char *) encoding);
- if (handler != NULL) {
- xmlSwitchToEncoding(ctxt, handler);
- } else {
- ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Unsupported encoding %s\n", encoding);
- return(NULL);
- }
- }
- }
- }
- return(encoding);
-}
-
-/**
- * xmlParseSDDecl:
- * @ctxt: an XML parser context
- *
- * parse the XML standalone declaration
- *
- * [32] SDDecl ::= S 'standalone' Eq
- * (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no')'"'))
- *
- * [ VC: Standalone Document Declaration ]
- * TODO The standalone document declaration must have the value "no"
- * if any external markup declarations contain declarations of:
- * - attributes with default values, if elements to which these
- * attributes apply appear in the document without specifications
- * of values for these attributes, or
- * - entities (other than amp, lt, gt, apos, quot), if references
- * to those entities appear in the document, or
- * - attributes with values subject to normalization, where the
- * attribute appears in the document with a value which will change
- * as a result of normalization, or
- * - element types with element content, if white space occurs directly
- * within any instance of those types.
- *
- * Returns 1 if standalone, 0 otherwise
- */
-
-int
-xmlParseSDDecl(xmlParserCtxtPtr ctxt) {
- int standalone = -1;
-
- SKIP_BLANKS;
- if ((RAW == 's') && (NXT(1) == 't') &&
- (NXT(2) == 'a') && (NXT(3) == 'n') &&
- (NXT(4) == 'd') && (NXT(5) == 'a') &&
- (NXT(6) == 'l') && (NXT(7) == 'o') &&
- (NXT(8) == 'n') && (NXT(9) == 'e')) {
- SKIP(10);
- SKIP_BLANKS;
- if (RAW != '=') {
- ctxt->errNo = XML_ERR_EQUAL_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "XML standalone declaration : expected '='\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return(standalone);
- }
- NEXT;
- SKIP_BLANKS;
- if (RAW == '\''){
- NEXT;
- if ((RAW == 'n') && (NXT(1) == 'o')) {
- standalone = 0;
- SKIP(2);
- } else if ((RAW == 'y') && (NXT(1) == 'e') &&
- (NXT(2) == 's')) {
- standalone = 1;
- SKIP(3);
- } else {
- ctxt->errNo = XML_ERR_STANDALONE_VALUE;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "standalone accepts only 'yes' or 'no'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if (RAW != '\'') {
- ctxt->errNo = XML_ERR_STRING_NOT_CLOSED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "String not closed\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else
- NEXT;
- } else if (RAW == '"'){
- NEXT;
- if ((RAW == 'n') && (NXT(1) == 'o')) {
- standalone = 0;
- SKIP(2);
- } else if ((RAW == 'y') && (NXT(1) == 'e') &&
- (NXT(2) == 's')) {
- standalone = 1;
- SKIP(3);
- } else {
- ctxt->errNo = XML_ERR_STANDALONE_VALUE;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "standalone accepts only 'yes' or 'no'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if (RAW != '"') {
- ctxt->errNo = XML_ERR_STRING_NOT_CLOSED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "String not closed\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else
- NEXT;
- } else {
- ctxt->errNo = XML_ERR_STRING_NOT_STARTED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Standalone value not found\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- }
- return(standalone);
-}
-
-/**
- * xmlParseXMLDecl:
- * @ctxt: an XML parser context
- *
- * parse an XML declaration header
- *
- * [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
- */
-
-void
-xmlParseXMLDecl(xmlParserCtxtPtr ctxt) {
- xmlChar *version;
-
- /*
- * We know that '<?xml' is here.
- */
- SKIP(5);
-
- if (!IS_BLANK(RAW)) {
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Blank needed after '<?xml'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
-
- /*
- * We must have the VersionInfo here.
- */
- version = xmlParseVersionInfo(ctxt);
- if (version == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Malformed declaration expecting version\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- if (!xmlStrEqual(version, (const xmlChar *) XML_DEFAULT_VERSION)) {
- /*
- * TODO: Blueberry should be detected here
- */
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData, "Unsupported version '%s'\n",
- version);
- }
- if (ctxt->version != NULL)
- xmlFree((void *) ctxt->version);
- ctxt->version = version;
- }
-
- /*
- * We may have the encoding declaration
- */
- if (!IS_BLANK(RAW)) {
- if ((RAW == '?') && (NXT(1) == '>')) {
- SKIP(2);
- return;
- }
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Blank needed here\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- xmlParseEncodingDecl(ctxt);
- if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
- /*
- * The XML REC instructs us to stop parsing right here
- */
- return;
- }
-
- /*
- * We may have the standalone status.
- */
- if ((ctxt->input->encoding != NULL) && (!IS_BLANK(RAW))) {
- if ((RAW == '?') && (NXT(1) == '>')) {
- SKIP(2);
- return;
- }
- ctxt->errNo = XML_ERR_SPACE_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Blank needed here\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- SKIP_BLANKS;
- ctxt->input->standalone = xmlParseSDDecl(ctxt);
-
- SKIP_BLANKS;
- if ((RAW == '?') && (NXT(1) == '>')) {
- SKIP(2);
- } else if (RAW == '>') {
- /* Deprecated old WD ... */
- ctxt->errNo = XML_ERR_XMLDECL_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "XML declaration must end-up with '?>'\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- NEXT;
- } else {
- ctxt->errNo = XML_ERR_XMLDECL_NOT_FINISHED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "parsing XML declaration: '?>' expected\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- MOVETO_ENDTAG(CUR_PTR);
- NEXT;
- }
-}
-
-/**
- * xmlParseMisc:
- * @ctxt: an XML parser context
- *
- * parse an XML Misc* optional field.
- *
- * [27] Misc ::= Comment | PI | S
- */
-
-void
-xmlParseMisc(xmlParserCtxtPtr ctxt) {
- while (((RAW == '<') && (NXT(1) == '?')) ||
- ((RAW == '<') && (NXT(1) == '!') &&
- (NXT(2) == '-') && (NXT(3) == '-')) ||
- IS_BLANK(CUR)) {
- if ((RAW == '<') && (NXT(1) == '?')) {
- xmlParsePI(ctxt);
- } else if (IS_BLANK(CUR)) {
- NEXT;
- } else
- xmlParseComment(ctxt);
- }
-}
-
-/**
- * xmlParseDocument:
- * @ctxt: an XML parser context
- *
- * parse an XML document (and build a tree if using the standard SAX
- * interface).
- *
- * [1] document ::= prolog element Misc*
- *
- * [22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?
- *
- * Returns 0, -1 in case of error. the parser context is augmented
- * as a result of the parsing.
- */
-
-int
-xmlParseDocument(xmlParserCtxtPtr ctxt) {
- xmlChar start[4];
- xmlCharEncoding enc;
-
- xmlInitParser();
-
- GROW;
-
- /*
- * SAX: beginning of the document processing.
- */
- if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
- ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator);
-
- if (ctxt->encoding == (const xmlChar *)XML_CHAR_ENCODING_NONE) {
- /*
- * Get the 4 first bytes and decode the charset
- * if enc != XML_CHAR_ENCODING_NONE
- * plug some encoding conversion routines.
- */
- start[0] = RAW;
- start[1] = NXT(1);
- start[2] = NXT(2);
- start[3] = NXT(3);
- enc = xmlDetectCharEncoding(start, 4);
- if (enc != XML_CHAR_ENCODING_NONE) {
- xmlSwitchEncoding(ctxt, enc);
- }
- }
-
-
- if (CUR == 0) {
- ctxt->errNo = XML_ERR_DOCUMENT_EMPTY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Document is empty\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- /*
- * Check for the XMLDecl in the Prolog.
- */
- GROW;
- if ((RAW == '<') && (NXT(1) == '?') &&
- (NXT(2) == 'x') && (NXT(3) == 'm') &&
- (NXT(4) == 'l') && (IS_BLANK(NXT(5)))) {
-
- /*
- * Note that we will switch encoding on the fly.
- */
- xmlParseXMLDecl(ctxt);
- if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
- /*
- * The XML REC instructs us to stop parsing right here
- */
- return(-1);
- }
- ctxt->standalone = ctxt->input->standalone;
- SKIP_BLANKS;
- } else {
- ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION);
- }
- if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX))
- ctxt->sax->startDocument(ctxt->userData);
-
- /*
- * The Misc part of the Prolog
- */
- GROW;
- xmlParseMisc(ctxt);
-
- /*
- * Then possibly doc type declaration(s) and more Misc
- * (doctypedecl Misc*)?
- */
- GROW;
- if ((RAW == '<') && (NXT(1) == '!') &&
- (NXT(2) == 'D') && (NXT(3) == 'O') &&
- (NXT(4) == 'C') && (NXT(5) == 'T') &&
- (NXT(6) == 'Y') && (NXT(7) == 'P') &&
- (NXT(8) == 'E')) {
-
- ctxt->inSubset = 1;
- xmlParseDocTypeDecl(ctxt);
- if (RAW == '[') {
- ctxt->instate = XML_PARSER_DTD;
- xmlParseInternalSubset(ctxt);
- }
-
- /*
- * Create and update the external subset.
- */
- ctxt->inSubset = 2;
- if ((ctxt->sax != NULL) && (ctxt->sax->externalSubset != NULL) &&
- (!ctxt->disableSAX))
- ctxt->sax->externalSubset(ctxt->userData, ctxt->intSubName,
- ctxt->extSubSystem, ctxt->extSubURI);
- ctxt->inSubset = 0;
-
-
- ctxt->instate = XML_PARSER_PROLOG;
- xmlParseMisc(ctxt);
- }
-
- /*
- * Time to start parsing the tree itself
- */
- GROW;
- if (RAW != '<') {
- ctxt->errNo = XML_ERR_DOCUMENT_EMPTY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Start tag expected, '<' not found\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- ctxt->instate = XML_PARSER_EOF;
- } else {
- ctxt->instate = XML_PARSER_CONTENT;
- xmlParseElement(ctxt);
- ctxt->instate = XML_PARSER_EPILOG;
-
-
- /*
- * The Misc part at the end
- */
- xmlParseMisc(ctxt);
-
- if (RAW != 0) {
- ctxt->errNo = XML_ERR_DOCUMENT_END;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Extra content at the end of the document\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- ctxt->instate = XML_PARSER_EOF;
- }
-
- /*
- * SAX: end of the document processing.
- */
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
-
- /*
- * Remove locally kept entity definitions if the tree was not built
- */
- if ((ctxt->myDoc != NULL) &&
- (xmlStrEqual(ctxt->myDoc->version, SAX_COMPAT_MODE))) {
- xmlFreeDoc(ctxt->myDoc);
- ctxt->myDoc = NULL;
- }
-
- if (! ctxt->wellFormed) {
- ctxt->valid = 0;
- return(-1);
- }
- return(0);
-}
-
-/**
- * xmlParseExtParsedEnt:
- * @ctxt: an XML parser context
- *
- * parse a general parsed entity
- * An external general parsed entity is well-formed if it matches the
- * production labeled extParsedEnt.
- *
- * [78] extParsedEnt ::= TextDecl? content
- *
- * Returns 0, -1 in case of error. the parser context is augmented
- * as a result of the parsing.
- */
-
-int
-xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) {
- xmlChar start[4];
- xmlCharEncoding enc;
-
- xmlDefaultSAXHandlerInit();
-
- GROW;
-
- /*
- * SAX: beginning of the document processing.
- */
- if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
- ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator);
-
- /*
- * Get the 4 first bytes and decode the charset
- * if enc != XML_CHAR_ENCODING_NONE
- * plug some encoding conversion routines.
- */
- start[0] = RAW;
- start[1] = NXT(1);
- start[2] = NXT(2);
- start[3] = NXT(3);
- enc = xmlDetectCharEncoding(start, 4);
- if (enc != XML_CHAR_ENCODING_NONE) {
- xmlSwitchEncoding(ctxt, enc);
- }
-
-
- if (CUR == 0) {
- ctxt->errNo = XML_ERR_DOCUMENT_EMPTY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Document is empty\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- /*
- * Check for the XMLDecl in the Prolog.
- */
- GROW;
- if ((RAW == '<') && (NXT(1) == '?') &&
- (NXT(2) == 'x') && (NXT(3) == 'm') &&
- (NXT(4) == 'l') && (IS_BLANK(NXT(5)))) {
-
- /*
- * Note that we will switch encoding on the fly.
- */
- xmlParseXMLDecl(ctxt);
- if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
- /*
- * The XML REC instructs us to stop parsing right here
- */
- return(-1);
- }
- SKIP_BLANKS;
- } else {
- ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION);
- }
- if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX))
- ctxt->sax->startDocument(ctxt->userData);
-
- /*
- * Doing validity checking on chunk doesn't make sense
- */
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->validate = 0;
- ctxt->loadsubset = 0;
- ctxt->depth = 0;
-
- xmlParseContent(ctxt);
-
- if ((RAW == '<') && (NXT(1) == '/')) {
- ctxt->errNo = XML_ERR_NOT_WELL_BALANCED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "chunk is not well balanced\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else if (RAW != 0) {
- ctxt->errNo = XML_ERR_EXTRA_CONTENT;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "extra content at the end of well balanced chunk\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- /*
- * SAX: end of the document processing.
- */
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
-
- if (! ctxt->wellFormed) return(-1);
- return(0);
-}
-
-/************************************************************************
- * *
- * Progressive parsing interfaces *
- * *
- ************************************************************************/
-
-/**
- * xmlParseLookupSequence:
- * @ctxt: an XML parser context
- * @first: the first char to lookup
- * @next: the next char to lookup or zero
- * @third: the next char to lookup or zero
- *
- * Try to find if a sequence (first, next, third) or just (first next) or
- * (first) is available in the input stream.
- * This function has a side effect of (possibly) incrementing ctxt->checkIndex
- * to avoid rescanning sequences of bytes, it DOES change the state of the
- * parser, do not use liberally.
- *
- * Returns the index to the current parsing point if the full sequence
- * is available, -1 otherwise.
- */
-static int
-xmlParseLookupSequence(xmlParserCtxtPtr ctxt, xmlChar first,
- xmlChar next, xmlChar third) {
- int base, len;
- xmlParserInputPtr in;
- const xmlChar *buf;
-
- in = ctxt->input;
- if (in == NULL) return(-1);
- base = in->cur - in->base;
- if (base < 0) return(-1);
- if (ctxt->checkIndex > base)
- base = ctxt->checkIndex;
- if (in->buf == NULL) {
- buf = in->base;
- len = in->length;
- } else {
- buf = in->buf->buffer->content;
- len = in->buf->buffer->use;
- }
- /* take into account the sequence length */
- if (third) len -= 2;
- else if (next) len --;
- for (;base < len;base++) {
- if (buf[base] == first) {
- if (third != 0) {
- if ((buf[base + 1] != next) ||
- (buf[base + 2] != third)) continue;
- } else if (next != 0) {
- if (buf[base + 1] != next) continue;
- }
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- if (next == 0)
- xmlGenericError(xmlGenericErrorContext,
- "PP: lookup '%c' found at %d\n",
- first, base);
- else if (third == 0)
- xmlGenericError(xmlGenericErrorContext,
- "PP: lookup '%c%c' found at %d\n",
- first, next, base);
- else
- xmlGenericError(xmlGenericErrorContext,
- "PP: lookup '%c%c%c' found at %d\n",
- first, next, third, base);
-#endif
- return(base - (in->cur - in->base));
- }
- }
- ctxt->checkIndex = base;
-#ifdef DEBUG_PUSH
- if (next == 0)
- xmlGenericError(xmlGenericErrorContext,
- "PP: lookup '%c' failed\n", first);
- else if (third == 0)
- xmlGenericError(xmlGenericErrorContext,
- "PP: lookup '%c%c' failed\n", first, next);
- else
- xmlGenericError(xmlGenericErrorContext,
- "PP: lookup '%c%c%c' failed\n", first, next, third);
-#endif
- return(-1);
-}
-
-/**
- * xmlParseTryOrFinish:
- * @ctxt: an XML parser context
- * @terminate: last chunk indicator
- *
- * Try to progress on parsing
- *
- * Returns zero if no parsing was possible
- */
-static int
-xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
- int ret = 0;
- int avail;
- xmlChar cur, next;
-
-#ifdef DEBUG_PUSH
- switch (ctxt->instate) {
- case XML_PARSER_EOF:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try EOF\n"); break;
- case XML_PARSER_START:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try START\n"); break;
- case XML_PARSER_MISC:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try MISC\n");break;
- case XML_PARSER_COMMENT:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try COMMENT\n");break;
- case XML_PARSER_PROLOG:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try PROLOG\n");break;
- case XML_PARSER_START_TAG:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try START_TAG\n");break;
- case XML_PARSER_CONTENT:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try CONTENT\n");break;
- case XML_PARSER_CDATA_SECTION:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try CDATA_SECTION\n");break;
- case XML_PARSER_END_TAG:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try END_TAG\n");break;
- case XML_PARSER_ENTITY_DECL:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try ENTITY_DECL\n");break;
- case XML_PARSER_ENTITY_VALUE:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try ENTITY_VALUE\n");break;
- case XML_PARSER_ATTRIBUTE_VALUE:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try ATTRIBUTE_VALUE\n");break;
- case XML_PARSER_DTD:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try DTD\n");break;
- case XML_PARSER_EPILOG:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try EPILOG\n");break;
- case XML_PARSER_PI:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try PI\n");break;
- case XML_PARSER_IGNORE:
- xmlGenericError(xmlGenericErrorContext,
- "PP: try IGNORE\n");break;
- }
-#endif
-
- while (1) {
- SHRINK;
-
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
-
- if (ctxt->input ==NULL) break;
- if (ctxt->input->buf == NULL)
- avail = ctxt->input->length - (ctxt->input->cur - ctxt->input->base);
- else {
- /*
- * If we are operating on converted input, try to flush
- * remainng chars to avoid them stalling in the non-converted
- * buffer.
- */
- if ((ctxt->input->buf->raw != NULL) &&
- (ctxt->input->buf->raw->use > 0)) {
- int base = ctxt->input->base -
- ctxt->input->buf->buffer->content;
- int current = ctxt->input->cur - ctxt->input->base;
-
- xmlParserInputBufferPush(ctxt->input->buf, 0, "");
- ctxt->input->base = ctxt->input->buf->buffer->content + base;
- ctxt->input->cur = ctxt->input->base + current;
- ctxt->input->end =
- &ctxt->input->buf->buffer->content[
- ctxt->input->buf->buffer->use];
- }
- avail = ctxt->input->buf->buffer->use -
- (ctxt->input->cur - ctxt->input->base);
- }
- if (avail < 1)
- goto done;
- switch (ctxt->instate) {
- case XML_PARSER_EOF:
- /*
- * Document parsing is done !
- */
- goto done;
- case XML_PARSER_START:
- if (ctxt->charset == XML_CHAR_ENCODING_NONE) {
- xmlChar start[4];
- xmlCharEncoding enc;
-
- /*
- * Very first chars read from the document flow.
- */
- if (avail < 4)
- goto done;
-
- /*
- * Get the 4 first bytes and decode the charset
- * if enc != XML_CHAR_ENCODING_NONE
- * plug some encoding conversion routines.
- */
- start[0] = RAW;
- start[1] = NXT(1);
- start[2] = NXT(2);
- start[3] = NXT(3);
- enc = xmlDetectCharEncoding(start, 4);
- if (enc != XML_CHAR_ENCODING_NONE) {
- xmlSwitchEncoding(ctxt, enc);
- }
- break;
- }
-
- cur = ctxt->input->cur[0];
- next = ctxt->input->cur[1];
- if (cur == 0) {
- if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
- ctxt->sax->setDocumentLocator(ctxt->userData,
- &xmlDefaultSAXLocator);
- ctxt->errNo = XML_ERR_DOCUMENT_EMPTY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Document is empty\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- ctxt->instate = XML_PARSER_EOF;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering EOF\n");
-#endif
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
- goto done;
- }
- if ((cur == '<') && (next == '?')) {
- /* PI or XML decl */
- if (avail < 5) return(ret);
- if ((!terminate) &&
- (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0))
- return(ret);
- if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
- ctxt->sax->setDocumentLocator(ctxt->userData,
- &xmlDefaultSAXLocator);
- if ((ctxt->input->cur[2] == 'x') &&
- (ctxt->input->cur[3] == 'm') &&
- (ctxt->input->cur[4] == 'l') &&
- (IS_BLANK(ctxt->input->cur[5]))) {
- ret += 5;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: Parsing XML Decl\n");
-#endif
- xmlParseXMLDecl(ctxt);
- if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
- /*
- * The XML REC instructs us to stop parsing right
- * here
- */
- ctxt->instate = XML_PARSER_EOF;
- return(0);
- }
- ctxt->standalone = ctxt->input->standalone;
- if ((ctxt->encoding == NULL) &&
- (ctxt->input->encoding != NULL))
- ctxt->encoding = xmlStrdup(ctxt->input->encoding);
- if ((ctxt->sax) && (ctxt->sax->startDocument) &&
- (!ctxt->disableSAX))
- ctxt->sax->startDocument(ctxt->userData);
- ctxt->instate = XML_PARSER_MISC;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering MISC\n");
-#endif
- } else {
- ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION);
- if ((ctxt->sax) && (ctxt->sax->startDocument) &&
- (!ctxt->disableSAX))
- ctxt->sax->startDocument(ctxt->userData);
- ctxt->instate = XML_PARSER_MISC;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering MISC\n");
-#endif
- }
- } else {
- if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
- ctxt->sax->setDocumentLocator(ctxt->userData,
- &xmlDefaultSAXLocator);
- ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION);
- if ((ctxt->sax) && (ctxt->sax->startDocument) &&
- (!ctxt->disableSAX))
- ctxt->sax->startDocument(ctxt->userData);
- ctxt->instate = XML_PARSER_MISC;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering MISC\n");
-#endif
- }
- break;
- case XML_PARSER_MISC:
- SKIP_BLANKS;
- if (ctxt->input->buf == NULL)
- avail = ctxt->input->length - (ctxt->input->cur - ctxt->input->base);
- else
- avail = ctxt->input->buf->buffer->use - (ctxt->input->cur - ctxt->input->base);
- if (avail < 2)
- goto done;
- cur = ctxt->input->cur[0];
- next = ctxt->input->cur[1];
- if ((cur == '<') && (next == '?')) {
- if ((!terminate) &&
- (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: Parsing PI\n");
-#endif
- xmlParsePI(ctxt);
- } else if ((cur == '<') && (next == '!') &&
- (ctxt->input->cur[2] == '-') && (ctxt->input->cur[3] == '-')) {
- if ((!terminate) &&
- (xmlParseLookupSequence(ctxt, '-', '-', '>') < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: Parsing Comment\n");
-#endif
- xmlParseComment(ctxt);
- ctxt->instate = XML_PARSER_MISC;
- } else if ((cur == '<') && (next == '!') &&
- (ctxt->input->cur[2] == 'D') && (ctxt->input->cur[3] == 'O') &&
- (ctxt->input->cur[4] == 'C') && (ctxt->input->cur[5] == 'T') &&
- (ctxt->input->cur[6] == 'Y') && (ctxt->input->cur[7] == 'P') &&
- (ctxt->input->cur[8] == 'E')) {
- if ((!terminate) &&
- (xmlParseLookupSequence(ctxt, '>', 0, 0) < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: Parsing internal subset\n");
-#endif
- ctxt->inSubset = 1;
- xmlParseDocTypeDecl(ctxt);
- if (RAW == '[') {
- ctxt->instate = XML_PARSER_DTD;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering DTD\n");
-#endif
- } else {
- /*
- * Create and update the external subset.
- */
- ctxt->inSubset = 2;
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
- (ctxt->sax->externalSubset != NULL))
- ctxt->sax->externalSubset(ctxt->userData,
- ctxt->intSubName, ctxt->extSubSystem,
- ctxt->extSubURI);
- ctxt->inSubset = 0;
- ctxt->instate = XML_PARSER_PROLOG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering PROLOG\n");
-#endif
- }
- } else if ((cur == '<') && (next == '!') &&
- (avail < 9)) {
- goto done;
- } else {
- ctxt->instate = XML_PARSER_START_TAG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering START_TAG\n");
-#endif
- }
- break;
- case XML_PARSER_IGNORE:
- xmlGenericError(xmlGenericErrorContext,
- "PP: internal error, state == IGNORE");
- ctxt->instate = XML_PARSER_DTD;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering DTD\n");
-#endif
- break;
- case XML_PARSER_PROLOG:
- SKIP_BLANKS;
- if (ctxt->input->buf == NULL)
- avail = ctxt->input->length - (ctxt->input->cur - ctxt->input->base);
- else
- avail = ctxt->input->buf->buffer->use - (ctxt->input->cur - ctxt->input->base);
- if (avail < 2)
- goto done;
- cur = ctxt->input->cur[0];
- next = ctxt->input->cur[1];
- if ((cur == '<') && (next == '?')) {
- if ((!terminate) &&
- (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: Parsing PI\n");
-#endif
- xmlParsePI(ctxt);
- } else if ((cur == '<') && (next == '!') &&
- (ctxt->input->cur[2] == '-') && (ctxt->input->cur[3] == '-')) {
- if ((!terminate) &&
- (xmlParseLookupSequence(ctxt, '-', '-', '>') < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: Parsing Comment\n");
-#endif
- xmlParseComment(ctxt);
- ctxt->instate = XML_PARSER_PROLOG;
- } else if ((cur == '<') && (next == '!') &&
- (avail < 4)) {
- goto done;
- } else {
- ctxt->instate = XML_PARSER_START_TAG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering START_TAG\n");
-#endif
- }
- break;
- case XML_PARSER_EPILOG:
- SKIP_BLANKS;
- if (ctxt->input->buf == NULL)
- avail = ctxt->input->length - (ctxt->input->cur - ctxt->input->base);
- else
- avail = ctxt->input->buf->buffer->use - (ctxt->input->cur - ctxt->input->base);
- if (avail < 2)
- goto done;
- cur = ctxt->input->cur[0];
- next = ctxt->input->cur[1];
- if ((cur == '<') && (next == '?')) {
- if ((!terminate) &&
- (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: Parsing PI\n");
-#endif
- xmlParsePI(ctxt);
- ctxt->instate = XML_PARSER_EPILOG;
- } else if ((cur == '<') && (next == '!') &&
- (ctxt->input->cur[2] == '-') && (ctxt->input->cur[3] == '-')) {
- if ((!terminate) &&
- (xmlParseLookupSequence(ctxt, '-', '-', '>') < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: Parsing Comment\n");
-#endif
- xmlParseComment(ctxt);
- ctxt->instate = XML_PARSER_EPILOG;
- } else if ((cur == '<') && (next == '!') &&
- (avail < 4)) {
- goto done;
- } else {
- ctxt->errNo = XML_ERR_DOCUMENT_END;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Extra content at the end of the document\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- ctxt->instate = XML_PARSER_EOF;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering EOF\n");
-#endif
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
- goto done;
- }
- break;
- case XML_PARSER_START_TAG: {
- xmlChar *name, *oldname;
-
- if ((avail < 2) && (ctxt->inputNr == 1))
- goto done;
- cur = ctxt->input->cur[0];
- if (cur != '<') {
- ctxt->errNo = XML_ERR_DOCUMENT_EMPTY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Start tag expect, '<' not found\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- ctxt->instate = XML_PARSER_EOF;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering EOF\n");
-#endif
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
- goto done;
- }
- if ((!terminate) &&
- (xmlParseLookupSequence(ctxt, '>', 0, 0) < 0))
- goto done;
- if (ctxt->spaceNr == 0)
- spacePush(ctxt, -1);
- else
- spacePush(ctxt, *ctxt->space);
- name = xmlParseStartTag(ctxt);
- if (name == NULL) {
- spacePop(ctxt);
- ctxt->instate = XML_PARSER_EOF;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering EOF\n");
-#endif
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
- goto done;
- }
- namePush(ctxt, xmlStrdup(name));
-
- /*
- * [ VC: Root Element Type ]
- * The Name in the document type declaration must match
- * the element type of the root element.
- */
- if (ctxt->validate && ctxt->wellFormed && ctxt->myDoc &&
- ctxt->node && (ctxt->node == ctxt->myDoc->children))
- ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
-
- /*
- * Check for an Empty Element.
- */
- if ((RAW == '/') && (NXT(1) == '>')) {
- SKIP(2);
- if ((ctxt->sax != NULL) &&
- (ctxt->sax->endElement != NULL) && (!ctxt->disableSAX))
- ctxt->sax->endElement(ctxt->userData, name);
- xmlFree(name);
- oldname = namePop(ctxt);
- spacePop(ctxt);
- if (oldname != NULL) {
-#ifdef DEBUG_STACK
- xmlGenericError(xmlGenericErrorContext,"Close: popped %s\n", oldname);
-#endif
- xmlFree(oldname);
- }
- if (ctxt->name == NULL) {
- ctxt->instate = XML_PARSER_EPILOG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering EPILOG\n");
-#endif
- } else {
- ctxt->instate = XML_PARSER_CONTENT;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering CONTENT\n");
-#endif
- }
- break;
- }
- if (RAW == '>') {
- NEXT;
- } else {
- ctxt->errNo = XML_ERR_GT_REQUIRED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Couldn't find end of Start Tag %s\n",
- name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
-
- /*
- * end of parsing of this node.
- */
- nodePop(ctxt);
- oldname = namePop(ctxt);
- spacePop(ctxt);
- if (oldname != NULL) {
-#ifdef DEBUG_STACK
- xmlGenericError(xmlGenericErrorContext,"Close: popped %s\n", oldname);
-#endif
- xmlFree(oldname);
- }
- }
- xmlFree(name);
- ctxt->instate = XML_PARSER_CONTENT;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering CONTENT\n");
-#endif
- break;
- }
- case XML_PARSER_CONTENT: {
- const xmlChar *test;
- int cons;
- if ((avail < 2) && (ctxt->inputNr == 1))
- goto done;
- cur = ctxt->input->cur[0];
- next = ctxt->input->cur[1];
-
- test = CUR_PTR;
- cons = ctxt->input->consumed;
- if ((cur == '<') && (next == '?')) {
- if ((!terminate) &&
- (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: Parsing PI\n");
-#endif
- xmlParsePI(ctxt);
- } else if ((cur == '<') && (next == '!') &&
- (ctxt->input->cur[2] == '-') && (ctxt->input->cur[3] == '-')) {
- if ((!terminate) &&
- (xmlParseLookupSequence(ctxt, '-', '-', '>') < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: Parsing Comment\n");
-#endif
- xmlParseComment(ctxt);
- ctxt->instate = XML_PARSER_CONTENT;
- } else if ((cur == '<') && (ctxt->input->cur[1] == '!') &&
- (ctxt->input->cur[2] == '[') && (NXT(3) == 'C') &&
- (ctxt->input->cur[4] == 'D') && (NXT(5) == 'A') &&
- (ctxt->input->cur[6] == 'T') && (NXT(7) == 'A') &&
- (ctxt->input->cur[8] == '[')) {
- SKIP(9);
- ctxt->instate = XML_PARSER_CDATA_SECTION;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering CDATA_SECTION\n");
-#endif
- break;
- } else if ((cur == '<') && (next == '!') &&
- (avail < 9)) {
- goto done;
- } else if ((cur == '<') && (next == '/')) {
- ctxt->instate = XML_PARSER_END_TAG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering END_TAG\n");
-#endif
- break;
- } else if (cur == '<') {
- ctxt->instate = XML_PARSER_START_TAG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering START_TAG\n");
-#endif
- break;
- } else if (cur == '&') {
- if ((!terminate) &&
- (xmlParseLookupSequence(ctxt, ';', 0, 0) < 0))
- goto done;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: Parsing Reference\n");
-#endif
- xmlParseReference(ctxt);
- } else {
- /* TODO Avoid the extra copy, handle directly !!! */
- /*
- * Goal of the following test is:
- * - minimize calls to the SAX 'character' callback
- * when they are mergeable
- * - handle an problem for isBlank when we only parse
- * a sequence of blank chars and the next one is
- * not available to check against '<' presence.
- * - tries to homogenize the differences in SAX
- * callbacks between the push and pull versions
- * of the parser.
- */
- if ((ctxt->inputNr == 1) &&
- (avail < XML_PARSER_BIG_BUFFER_SIZE)) {
- if ((!terminate) &&
- (xmlParseLookupSequence(ctxt, '<', 0, 0) < 0))
- goto done;
- }
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: Parsing char data\n");
-#endif
- xmlParseCharData(ctxt, 0);
- }
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
- if ((cons == ctxt->input->consumed) && (test == CUR_PTR)) {
- ctxt->errNo = XML_ERR_INTERNAL_ERROR;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "detected an error in element content\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- ctxt->instate = XML_PARSER_EOF;
- break;
- }
- break;
- }
- case XML_PARSER_CDATA_SECTION: {
- /*
- * The Push mode need to have the SAX callback for
- * cdataBlock merge back contiguous callbacks.
- */
- int base;
-
- base = xmlParseLookupSequence(ctxt, ']', ']', '>');
- if (base < 0) {
- if (avail >= XML_PARSER_BIG_BUFFER_SIZE + 2) {
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) {
- if (ctxt->sax->cdataBlock != NULL)
- ctxt->sax->cdataBlock(ctxt->userData, ctxt->input->cur,
- XML_PARSER_BIG_BUFFER_SIZE);
- }
- SKIP(XML_PARSER_BIG_BUFFER_SIZE);
- ctxt->checkIndex = 0;
- }
- goto done;
- } else {
- if ((ctxt->sax != NULL) && (base > 0) &&
- (!ctxt->disableSAX)) {
- if (ctxt->sax->cdataBlock != NULL)
- ctxt->sax->cdataBlock(ctxt->userData,
- ctxt->input->cur, base);
- }
- SKIP(base + 3);
- ctxt->checkIndex = 0;
- ctxt->instate = XML_PARSER_CONTENT;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering CONTENT\n");
-#endif
- }
- break;
- }
- case XML_PARSER_END_TAG:
- if (avail < 2)
- goto done;
- if ((!terminate) &&
- (xmlParseLookupSequence(ctxt, '>', 0, 0) < 0))
- goto done;
- xmlParseEndTag(ctxt);
- if (ctxt->name == NULL) {
- ctxt->instate = XML_PARSER_EPILOG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering EPILOG\n");
-#endif
- } else {
- ctxt->instate = XML_PARSER_CONTENT;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering CONTENT\n");
-#endif
- }
- break;
- case XML_PARSER_DTD: {
- /*
- * Sorry but progressive parsing of the internal subset
- * is not expected to be supported. We first check that
- * the full content of the internal subset is available and
- * the parsing is launched only at that point.
- * Internal subset ends up with "']' S? '>'" in an unescaped
- * section and not in a ']]>' sequence which are conditional
- * sections (whoever argued to keep that crap in XML deserve
- * a place in hell !).
- */
- int base, i;
- xmlChar *buf;
- xmlChar quote = 0;
-
- base = ctxt->input->cur - ctxt->input->base;
- if (base < 0) return(0);
- if (ctxt->checkIndex > base)
- base = ctxt->checkIndex;
- buf = ctxt->input->buf->buffer->content;
- for (;(unsigned int) base < ctxt->input->buf->buffer->use;
- base++) {
- if (quote != 0) {
- if (buf[base] == quote)
- quote = 0;
- continue;
- }
- if (buf[base] == '"') {
- quote = '"';
- continue;
- }
- if (buf[base] == '\'') {
- quote = '\'';
- continue;
- }
- if (buf[base] == ']') {
- if ((unsigned int) base +1 >=
- ctxt->input->buf->buffer->use)
- break;
- if (buf[base + 1] == ']') {
- /* conditional crap, skip both ']' ! */
- base++;
- continue;
- }
- for (i = 0;
- (unsigned int) base + i < ctxt->input->buf->buffer->use;
- i++) {
- if (buf[base + i] == '>')
- goto found_end_int_subset;
- }
- break;
- }
- }
- /*
- * We didn't found the end of the Internal subset
- */
- if (quote == 0)
- ctxt->checkIndex = base;
-#ifdef DEBUG_PUSH
- if (next == 0)
- xmlGenericError(xmlGenericErrorContext,
- "PP: lookup of int subset end filed\n");
-#endif
- goto done;
-
-found_end_int_subset:
- xmlParseInternalSubset(ctxt);
- ctxt->inSubset = 2;
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
- (ctxt->sax->externalSubset != NULL))
- ctxt->sax->externalSubset(ctxt->userData, ctxt->intSubName,
- ctxt->extSubSystem, ctxt->extSubURI);
- ctxt->inSubset = 0;
- ctxt->instate = XML_PARSER_PROLOG;
- ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering PROLOG\n");
-#endif
- break;
- }
- case XML_PARSER_COMMENT:
- xmlGenericError(xmlGenericErrorContext,
- "PP: internal error, state == COMMENT\n");
- ctxt->instate = XML_PARSER_CONTENT;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_PI:
- xmlGenericError(xmlGenericErrorContext,
- "PP: internal error, state == PI\n");
- ctxt->instate = XML_PARSER_CONTENT;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering CONTENT\n");
-#endif
- break;
- case XML_PARSER_ENTITY_DECL:
- xmlGenericError(xmlGenericErrorContext,
- "PP: internal error, state == ENTITY_DECL\n");
- ctxt->instate = XML_PARSER_DTD;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering DTD\n");
-#endif
- break;
- case XML_PARSER_ENTITY_VALUE:
- xmlGenericError(xmlGenericErrorContext,
- "PP: internal error, state == ENTITY_VALUE\n");
- ctxt->instate = XML_PARSER_CONTENT;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering DTD\n");
-#endif
- break;
- case XML_PARSER_ATTRIBUTE_VALUE:
- xmlGenericError(xmlGenericErrorContext,
- "PP: internal error, state == ATTRIBUTE_VALUE\n");
- ctxt->instate = XML_PARSER_START_TAG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering START_TAG\n");
-#endif
- break;
- case XML_PARSER_SYSTEM_LITERAL:
- xmlGenericError(xmlGenericErrorContext,
- "PP: internal error, state == SYSTEM_LITERAL\n");
- ctxt->instate = XML_PARSER_START_TAG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering START_TAG\n");
-#endif
- break;
- case XML_PARSER_PUBLIC_LITERAL:
- xmlGenericError(xmlGenericErrorContext,
- "PP: internal error, state == PUBLIC_LITERAL\n");
- ctxt->instate = XML_PARSER_START_TAG;
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "PP: entering START_TAG\n");
-#endif
- break;
- }
- }
-done:
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext, "PP: done %d\n", ret);
-#endif
- return(ret);
-}
-
-/**
- * xmlParseChunk:
- * @ctxt: an XML parser context
- * @chunk: an char array
- * @size: the size in byte of the chunk
- * @terminate: last chunk indicator
- *
- * Parse a Chunk of memory
- *
- * Returns zero if no error, the xmlParserErrors otherwise.
- */
-int
-xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
- int terminate) {
- if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) &&
- (ctxt->input->buf != NULL) && (ctxt->instate != XML_PARSER_EOF)) {
- int base = ctxt->input->base - ctxt->input->buf->buffer->content;
- int cur = ctxt->input->cur - ctxt->input->base;
-
- xmlParserInputBufferPush(ctxt->input->buf, size, chunk);
- ctxt->input->base = ctxt->input->buf->buffer->content + base;
- ctxt->input->cur = ctxt->input->base + cur;
- ctxt->input->end =
- &ctxt->input->buf->buffer->content[ctxt->input->buf->buffer->use];
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext, "PP: pushed %d\n", size);
-#endif
-
- if ((terminate) || (ctxt->input->buf->buffer->use > 80))
- xmlParseTryOrFinish(ctxt, terminate);
- } else if (ctxt->instate != XML_PARSER_EOF) {
- if ((ctxt->input != NULL) && ctxt->input->buf != NULL) {
- xmlParserInputBufferPtr in = ctxt->input->buf;
- if ((in->encoder != NULL) && (in->buffer != NULL) &&
- (in->raw != NULL)) {
- int nbchars;
-
- nbchars = xmlCharEncInFunc(in->encoder, in->buffer, in->raw);
- if (nbchars < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParseChunk: encoder error\n");
- return(XML_ERR_INVALID_ENCODING);
- }
- }
- }
- }
- xmlParseTryOrFinish(ctxt, terminate);
- if (terminate) {
- /*
- * Check for termination
- */
- int avail = 0;
- if (ctxt->input->buf == NULL)
- avail = ctxt->input->length -
- (ctxt->input->cur - ctxt->input->base);
- else
- avail = ctxt->input->buf->buffer->use -
- (ctxt->input->cur - ctxt->input->base);
-
- if ((ctxt->instate != XML_PARSER_EOF) &&
- (ctxt->instate != XML_PARSER_EPILOG)) {
- ctxt->errNo = XML_ERR_DOCUMENT_END;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Extra content at the end of the document\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if ((ctxt->instate == XML_PARSER_EPILOG) && (avail > 0)) {
- ctxt->errNo = XML_ERR_DOCUMENT_END;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Extra content at the end of the document\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
-
- }
- if (ctxt->instate != XML_PARSER_EOF) {
- if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
- ctxt->sax->endDocument(ctxt->userData);
- }
- ctxt->instate = XML_PARSER_EOF;
- }
- return((xmlParserErrors) ctxt->errNo);
-}
-
-/************************************************************************
- * *
- * I/O front end functions to the parser *
- * *
- ************************************************************************/
-
-/**
- * xmlStopParser:
- * @ctxt: an XML parser context
- *
- * Blocks further parser processing
- */
-void
-xmlStopParser(xmlParserCtxtPtr ctxt) {
- ctxt->instate = XML_PARSER_EOF;
- if (ctxt->input != NULL)
- ctxt->input->cur = BAD_CAST"";
-}
-
-/**
- * xmlCreatePushParserCtxt:
- * @sax: a SAX handler
- * @user_data: The user data returned on SAX callbacks
- * @chunk: a pointer to an array of chars
- * @size: number of chars in the array
- * @filename: an optional file name or URI
- *
- * Create a parser context for using the XML parser in push mode.
- * If @buffer and @size are non-NULL, the data is used to detect
- * the encoding. The remaining characters will be parsed so they
- * don't need to be fed in again through xmlParseChunk.
- * To allow content encoding detection, @size should be >= 4
- * The value of @filename is used for fetching external entities
- * and error/warning reports.
- *
- * Returns the new parser context or NULL
- */
-
-xmlParserCtxtPtr
-xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
- const char *chunk, int size, const char *filename) {
- xmlParserCtxtPtr ctxt;
- xmlParserInputPtr inputStream;
- xmlParserInputBufferPtr buf;
- xmlCharEncoding enc = XML_CHAR_ENCODING_NONE;
-
- /*
- * plug some encoding conversion routines
- */
- if ((chunk != NULL) && (size >= 4))
- enc = xmlDetectCharEncoding((const xmlChar *) chunk, size);
-
- buf = xmlAllocParserInputBuffer(enc);
- if (buf == NULL) return(NULL);
-
- ctxt = xmlNewParserCtxt();
- if (ctxt == NULL) {
- xmlFree(buf);
- return(NULL);
- }
- if (sax != NULL) {
- if (ctxt->sax != &xmlDefaultSAXHandler)
- xmlFree(ctxt->sax);
- ctxt->sax = (xmlSAXHandlerPtr) xmlMalloc(sizeof(xmlSAXHandler));
- if (ctxt->sax == NULL) {
- xmlFree(buf);
- xmlFree(ctxt);
- return(NULL);
- }
- memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler));
- if (user_data != NULL)
- ctxt->userData = user_data;
- }
- if (filename == NULL) {
- ctxt->directory = NULL;
- } else {
- ctxt->directory = xmlParserGetDirectory(filename);
- }
-
- inputStream = xmlNewInputStream(ctxt);
- if (inputStream == NULL) {
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
-
- if (filename == NULL)
- inputStream->filename = NULL;
- else
- inputStream->filename = (char *)
- xmlNormalizeWindowsPath((const xmlChar *) filename);
- inputStream->buf = buf;
- inputStream->base = inputStream->buf->buffer->content;
- inputStream->cur = inputStream->buf->buffer->content;
- inputStream->end =
- &inputStream->buf->buffer->content[inputStream->buf->buffer->use];
-
- inputPush(ctxt, inputStream);
-
- if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) &&
- (ctxt->input->buf != NULL)) {
- int base = ctxt->input->base - ctxt->input->buf->buffer->content;
- int cur = ctxt->input->cur - ctxt->input->base;
-
- xmlParserInputBufferPush(ctxt->input->buf, size, chunk);
-
- ctxt->input->base = ctxt->input->buf->buffer->content + base;
- ctxt->input->cur = ctxt->input->base + cur;
- ctxt->input->end =
- &ctxt->input->buf->buffer->content[ctxt->input->buf->buffer->use];
-#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext, "PP: pushed %d\n", size);
-#endif
- }
-
- if (enc != XML_CHAR_ENCODING_NONE) {
- xmlSwitchEncoding(ctxt, enc);
- }
-
- return(ctxt);
-}
-
-/**
- * xmlCreateIOParserCtxt:
- * @sax: a SAX handler
- * @user_data: The user data returned on SAX callbacks
- * @ioread: an I/O read function
- * @ioclose: an I/O close function
- * @ioctx: an I/O handler
- * @enc: the charset encoding if known
- *
- * Create a parser context for using the XML parser with an existing
- * I/O stream
- *
- * Returns the new parser context or NULL
- */
-xmlParserCtxtPtr
-xmlCreateIOParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
- xmlInputReadCallback ioread, xmlInputCloseCallback ioclose,
- void *ioctx, xmlCharEncoding enc) {
- xmlParserCtxtPtr ctxt;
- xmlParserInputPtr inputStream;
- xmlParserInputBufferPtr buf;
-
- buf = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, enc);
- if (buf == NULL) return(NULL);
-
- ctxt = xmlNewParserCtxt();
- if (ctxt == NULL) {
- xmlFree(buf);
- return(NULL);
- }
- if (sax != NULL) {
- if (ctxt->sax != &xmlDefaultSAXHandler)
- xmlFree(ctxt->sax);
- ctxt->sax = (xmlSAXHandlerPtr) xmlMalloc(sizeof(xmlSAXHandler));
- if (ctxt->sax == NULL) {
- xmlFree(buf);
- xmlFree(ctxt);
- return(NULL);
- }
- memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler));
- if (user_data != NULL)
- ctxt->userData = user_data;
- }
-
- inputStream = xmlNewIOInputStream(ctxt, buf, enc);
- if (inputStream == NULL) {
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
- inputPush(ctxt, inputStream);
-
- return(ctxt);
-}
-
-/************************************************************************
- * *
- * Front ends when parsing a DTD *
- * *
- ************************************************************************/
-
-/**
- * xmlIOParseDTD:
- * @sax: the SAX handler block or NULL
- * @input: an Input Buffer
- * @enc: the charset encoding if known
- *
- * Load and parse a DTD
- *
- * Returns the resulting xmlDtdPtr or NULL in case of error.
- * @input will be freed at parsing end.
- */
-
-xmlDtdPtr
-xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
- xmlCharEncoding enc) {
- xmlDtdPtr ret = NULL;
- xmlParserCtxtPtr ctxt;
- xmlParserInputPtr pinput = NULL;
- xmlChar start[4];
-
- if (input == NULL)
- return(NULL);
-
- ctxt = xmlNewParserCtxt();
- if (ctxt == NULL) {
- return(NULL);
- }
-
- /*
- * Set-up the SAX context
- */
- if (sax != NULL) {
- if (ctxt->sax != NULL)
- xmlFree(ctxt->sax);
- ctxt->sax = sax;
- ctxt->userData = NULL;
- }
-
- /*
- * generate a parser input from the I/O handler
- */
-
- pinput = xmlNewIOInputStream(ctxt, input, enc);
- if (pinput == NULL) {
- if (sax != NULL) ctxt->sax = NULL;
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
-
- /*
- * plug some encoding conversion routines here.
- */
- xmlPushInput(ctxt, pinput);
-
- pinput->filename = NULL;
- pinput->line = 1;
- pinput->col = 1;
- pinput->base = ctxt->input->cur;
- pinput->cur = ctxt->input->cur;
- pinput->free = NULL;
-
- /*
- * let's parse that entity knowing it's an external subset.
- */
- ctxt->inSubset = 2;
- ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0");
- ctxt->myDoc->extSubset = xmlNewDtd(ctxt->myDoc, BAD_CAST "none",
- BAD_CAST "none", BAD_CAST "none");
-
- if (enc == XML_CHAR_ENCODING_NONE) {
- /*
- * Get the 4 first bytes and decode the charset
- * if enc != XML_CHAR_ENCODING_NONE
- * plug some encoding conversion routines.
- */
- start[0] = RAW;
- start[1] = NXT(1);
- start[2] = NXT(2);
- start[3] = NXT(3);
- enc = xmlDetectCharEncoding(start, 4);
- if (enc != XML_CHAR_ENCODING_NONE) {
- xmlSwitchEncoding(ctxt, enc);
- }
- }
-
- xmlParseExternalSubset(ctxt, BAD_CAST "none", BAD_CAST "none");
-
- if (ctxt->myDoc != NULL) {
- if (ctxt->wellFormed) {
- ret = ctxt->myDoc->extSubset;
- ctxt->myDoc->extSubset = NULL;
- } else {
- ret = NULL;
- }
- xmlFreeDoc(ctxt->myDoc);
- ctxt->myDoc = NULL;
- }
- if (sax != NULL) ctxt->sax = NULL;
- xmlFreeParserCtxt(ctxt);
-
- return(ret);
-}
-
-/**
- * xmlSAXParseDTD:
- * @sax: the SAX handler block
- * @ExternalID: a NAME* containing the External ID of the DTD
- * @SystemID: a NAME* containing the URL to the DTD
- *
- * Load and parse an external subset.
- *
- * Returns the resulting xmlDtdPtr or NULL in case of error.
- */
-
-xmlDtdPtr
-xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
- const xmlChar *SystemID) {
- xmlDtdPtr ret = NULL;
- xmlParserCtxtPtr ctxt;
- xmlParserInputPtr input = NULL;
- xmlCharEncoding enc;
-
- if ((ExternalID == NULL) && (SystemID == NULL)) return(NULL);
-
- ctxt = xmlNewParserCtxt();
- if (ctxt == NULL) {
- return(NULL);
- }
-
- /*
- * Set-up the SAX context
- */
- if (sax != NULL) {
- if (ctxt->sax != NULL)
- xmlFree(ctxt->sax);
- ctxt->sax = sax;
- ctxt->userData = NULL;
- }
-
- /*
- * Ask the Entity resolver to load the damn thing
- */
-
- if ((ctxt->sax != NULL) && (ctxt->sax->resolveEntity != NULL))
- input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID, SystemID);
- if (input == NULL) {
- if (sax != NULL) ctxt->sax = NULL;
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
-
- /*
- * plug some encoding conversion routines here.
- */
- xmlPushInput(ctxt, input);
- enc = xmlDetectCharEncoding(ctxt->input->cur, 4);
- xmlSwitchEncoding(ctxt, enc);
-
- if (input->filename == NULL)
- input->filename = (char *) xmlStrdup(SystemID);
- input->line = 1;
- input->col = 1;
- input->base = ctxt->input->cur;
- input->cur = ctxt->input->cur;
- input->free = NULL;
-
- /*
- * let's parse that entity knowing it's an external subset.
- */
- ctxt->inSubset = 2;
- ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0");
- ctxt->myDoc->extSubset = xmlNewDtd(ctxt->myDoc, BAD_CAST "none",
- ExternalID, SystemID);
- xmlParseExternalSubset(ctxt, ExternalID, SystemID);
-
- if (ctxt->myDoc != NULL) {
- if (ctxt->wellFormed) {
- ret = ctxt->myDoc->extSubset;
- ctxt->myDoc->extSubset = NULL;
- } else {
- ret = NULL;
- }
- xmlFreeDoc(ctxt->myDoc);
- ctxt->myDoc = NULL;
- }
- if (sax != NULL) ctxt->sax = NULL;
- xmlFreeParserCtxt(ctxt);
-
- return(ret);
-}
-
-/**
- * xmlParseDTD:
- * @ExternalID: a NAME* containing the External ID of the DTD
- * @SystemID: a NAME* containing the URL to the DTD
- *
- * Load and parse an external subset.
- *
- * Returns the resulting xmlDtdPtr or NULL in case of error.
- */
-
-xmlDtdPtr
-xmlParseDTD(const xmlChar *ExternalID, const xmlChar *SystemID) {
- return(xmlSAXParseDTD(NULL, ExternalID, SystemID));
-}
-
-/************************************************************************
- * *
- * Front ends when parsing an Entity *
- * *
- ************************************************************************/
-
-/**
- * xmlParseCtxtExternalEntity:
- * @ctx: the existing parsing context
- * @URL: the URL for the entity to load
- * @ID: the System ID for the entity to load
- * @lst: the return value for the set of parsed nodes
- *
- * Parse an external general entity within an existing parsing context
- * An external general parsed entity is well-formed if it matches the
- * production labeled extParsedEnt.
- *
- * [78] extParsedEnt ::= TextDecl? content
- *
- * Returns 0 if the entity is well formed, -1 in case of args problem and
- * the parser error code otherwise
- */
-
-int
-xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL,
- const xmlChar *ID, xmlNodePtr *lst) {
- xmlParserCtxtPtr ctxt;
- xmlDocPtr newDoc;
- xmlSAXHandlerPtr oldsax = NULL;
- int ret = 0;
- xmlChar start[4];
- xmlCharEncoding enc;
-
- if (ctx->depth > 40) {
- return(XML_ERR_ENTITY_LOOP);
- }
-
- if (lst != NULL)
- *lst = NULL;
- if ((URL == NULL) && (ID == NULL))
- return(-1);
- if (ctx->myDoc == NULL) /* @@ relax but check for dereferences */
- return(-1);
-
-
- ctxt = xmlCreateEntityParserCtxt(URL, ID, NULL);
- if (ctxt == NULL) return(-1);
- ctxt->userData = ctxt;
- oldsax = ctxt->sax;
- ctxt->sax = ctx->sax;
- newDoc = xmlNewDoc(BAD_CAST "1.0");
- if (newDoc == NULL) {
- xmlFreeParserCtxt(ctxt);
- return(-1);
- }
- if (ctx->myDoc != NULL) {
- newDoc->intSubset = ctx->myDoc->intSubset;
- newDoc->extSubset = ctx->myDoc->extSubset;
- }
- if (ctx->myDoc->URL != NULL) {
- newDoc->URL = xmlStrdup(ctx->myDoc->URL);
- }
- newDoc->children = xmlNewDocNode(newDoc, NULL, BAD_CAST "pseudoroot", NULL);
- if (newDoc->children == NULL) {
- ctxt->sax = oldsax;
- xmlFreeParserCtxt(ctxt);
- newDoc->intSubset = NULL;
- newDoc->extSubset = NULL;
- xmlFreeDoc(newDoc);
- return(-1);
- }
- nodePush(ctxt, newDoc->children);
- if (ctx->myDoc == NULL) {
- ctxt->myDoc = newDoc;
- } else {
- ctxt->myDoc = ctx->myDoc;
- newDoc->children->doc = ctx->myDoc;
- }
-
- /*
- * Get the 4 first bytes and decode the charset
- * if enc != XML_CHAR_ENCODING_NONE
- * plug some encoding conversion routines.
- */
- GROW
- start[0] = RAW;
- start[1] = NXT(1);
- start[2] = NXT(2);
- start[3] = NXT(3);
- enc = xmlDetectCharEncoding(start, 4);
- if (enc != XML_CHAR_ENCODING_NONE) {
- xmlSwitchEncoding(ctxt, enc);
- }
-
- /*
- * Parse a possible text declaration first
- */
- if ((RAW == '<') && (NXT(1) == '?') &&
- (NXT(2) == 'x') && (NXT(3) == 'm') &&
- (NXT(4) == 'l') && (IS_BLANK(NXT(5)))) {
- xmlParseTextDecl(ctxt);
- }
-
- /*
- * Doing validity checking on chunk doesn't make sense
- */
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->validate = ctx->validate;
- ctxt->loadsubset = ctx->loadsubset;
- ctxt->depth = ctx->depth + 1;
- ctxt->replaceEntities = ctx->replaceEntities;
- if (ctxt->validate) {
- ctxt->vctxt.error = ctx->vctxt.error;
- ctxt->vctxt.warning = ctx->vctxt.warning;
- } else {
- ctxt->vctxt.error = NULL;
- ctxt->vctxt.warning = NULL;
- }
- ctxt->vctxt.nodeTab = NULL;
- ctxt->vctxt.nodeNr = 0;
- ctxt->vctxt.nodeMax = 0;
- ctxt->vctxt.node = NULL;
-
- xmlParseContent(ctxt);
-
- if ((RAW == '<') && (NXT(1) == '/')) {
- ctxt->errNo = XML_ERR_NOT_WELL_BALANCED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "chunk is not well balanced\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else if (RAW != 0) {
- ctxt->errNo = XML_ERR_EXTRA_CONTENT;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "extra content at the end of well balanced chunk\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if (ctxt->node != newDoc->children) {
- ctxt->errNo = XML_ERR_NOT_WELL_BALANCED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "chunk is not well balanced\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- if (!ctxt->wellFormed) {
- if (ctxt->errNo == 0)
- ret = 1;
- else
- ret = ctxt->errNo;
- } else {
- if (lst != NULL) {
- xmlNodePtr cur;
-
- /*
- * Return the newly created nodeset after unlinking it from
- * they pseudo parent.
- */
- cur = newDoc->children->children;
- *lst = cur;
- while (cur != NULL) {
- cur->parent = NULL;
- cur = cur->next;
- }
- newDoc->children->children = NULL;
- }
- ret = 0;
- }
- ctxt->sax = oldsax;
- xmlFreeParserCtxt(ctxt);
- newDoc->intSubset = NULL;
- newDoc->extSubset = NULL;
- xmlFreeDoc(newDoc);
-
- return(ret);
-}
-
-/**
- * xmlParseExternalEntityPrivate:
- * @doc: the document the chunk pertains to
- * @oldctxt: the previous parser context if available
- * @sax: the SAX handler bloc (possibly NULL)
- * @user_data: The user data returned on SAX callbacks (possibly NULL)
- * @depth: Used for loop detection, use 0
- * @URL: the URL for the entity to load
- * @ID: the System ID for the entity to load
- * @list: the return value for the set of parsed nodes
- *
- * Private version of xmlParseExternalEntity()
- *
- * Returns 0 if the entity is well formed, -1 in case of args problem and
- * the parser error code otherwise
- */
-
-static int
-xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
- xmlSAXHandlerPtr sax,
- void *user_data, int depth, const xmlChar *URL,
- const xmlChar *ID, xmlNodePtr *list) {
- xmlParserCtxtPtr ctxt;
- xmlDocPtr newDoc;
- xmlSAXHandlerPtr oldsax = NULL;
- int ret = 0;
- xmlChar start[4];
- xmlCharEncoding enc;
-
- if (depth > 40) {
- return(XML_ERR_ENTITY_LOOP);
- }
-
-
-
- if (list != NULL)
- *list = NULL;
- if ((URL == NULL) && (ID == NULL))
- return(-1);
- if (doc == NULL) /* @@ relax but check for dereferences */
- return(-1);
-
-
- ctxt = xmlCreateEntityParserCtxt(URL, ID, NULL);
- if (ctxt == NULL) return(-1);
- ctxt->userData = ctxt;
- if (oldctxt != NULL) {
- ctxt->_private = oldctxt->_private;
- ctxt->loadsubset = oldctxt->loadsubset;
- ctxt->validate = oldctxt->validate;
- ctxt->external = oldctxt->external;
- } else {
- /*
- * Doing validity checking on chunk without context
- * doesn't make sense
- */
- ctxt->_private = NULL;
- ctxt->validate = 0;
- ctxt->external = 2;
- ctxt->loadsubset = 0;
- }
- if (sax != NULL) {
- oldsax = ctxt->sax;
- ctxt->sax = sax;
- if (user_data != NULL)
- ctxt->userData = user_data;
- }
- newDoc = xmlNewDoc(BAD_CAST "1.0");
- if (newDoc == NULL) {
- xmlFreeParserCtxt(ctxt);
- return(-1);
- }
- if (doc != NULL) {
- newDoc->intSubset = doc->intSubset;
- newDoc->extSubset = doc->extSubset;
- }
- if (doc->URL != NULL) {
- newDoc->URL = xmlStrdup(doc->URL);
- }
- newDoc->children = xmlNewDocNode(newDoc, NULL, BAD_CAST "pseudoroot", NULL);
- if (newDoc->children == NULL) {
- if (sax != NULL)
- ctxt->sax = oldsax;
- xmlFreeParserCtxt(ctxt);
- newDoc->intSubset = NULL;
- newDoc->extSubset = NULL;
- xmlFreeDoc(newDoc);
- return(-1);
- }
- nodePush(ctxt, newDoc->children);
- if (doc == NULL) {
- ctxt->myDoc = newDoc;
- } else {
- ctxt->myDoc = doc;
- newDoc->children->doc = doc;
- }
-
- /*
- * Get the 4 first bytes and decode the charset
- * if enc != XML_CHAR_ENCODING_NONE
- * plug some encoding conversion routines.
- */
- GROW;
- start[0] = RAW;
- start[1] = NXT(1);
- start[2] = NXT(2);
- start[3] = NXT(3);
- enc = xmlDetectCharEncoding(start, 4);
- if (enc != XML_CHAR_ENCODING_NONE) {
- xmlSwitchEncoding(ctxt, enc);
- }
-
- /*
- * Parse a possible text declaration first
- */
- if ((RAW == '<') && (NXT(1) == '?') &&
- (NXT(2) == 'x') && (NXT(3) == 'm') &&
- (NXT(4) == 'l') && (IS_BLANK(NXT(5)))) {
- xmlParseTextDecl(ctxt);
- }
-
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->depth = depth;
-
- xmlParseContent(ctxt);
-
- if ((RAW == '<') && (NXT(1) == '/')) {
- ctxt->errNo = XML_ERR_NOT_WELL_BALANCED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "chunk is not well balanced\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else if (RAW != 0) {
- ctxt->errNo = XML_ERR_EXTRA_CONTENT;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "extra content at the end of well balanced chunk\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if (ctxt->node != newDoc->children) {
- ctxt->errNo = XML_ERR_NOT_WELL_BALANCED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "chunk is not well balanced\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- if (!ctxt->wellFormed) {
- if (ctxt->errNo == 0)
- ret = 1;
- else
- ret = ctxt->errNo;
- } else {
- if (list != NULL) {
- xmlNodePtr cur;
-
- /*
- * Return the newly created nodeset after unlinking it from
- * they pseudo parent.
- */
- cur = newDoc->children->children;
- *list = cur;
- while (cur != NULL) {
- cur->parent = NULL;
- cur = cur->next;
- }
- newDoc->children->children = NULL;
- }
- ret = 0;
- }
- if (sax != NULL)
- ctxt->sax = oldsax;
- xmlFreeParserCtxt(ctxt);
- newDoc->intSubset = NULL;
- newDoc->extSubset = NULL;
- xmlFreeDoc(newDoc);
-
- return(ret);
-}
-
-/**
- * xmlParseExternalEntity:
- * @doc: the document the chunk pertains to
- * @sax: the SAX handler bloc (possibly NULL)
- * @user_data: The user data returned on SAX callbacks (possibly NULL)
- * @depth: Used for loop detection, use 0
- * @URL: the URL for the entity to load
- * @ID: the System ID for the entity to load
- * @lst: the return value for the set of parsed nodes
- *
- * Parse an external general entity
- * An external general parsed entity is well-formed if it matches the
- * production labeled extParsedEnt.
- *
- * [78] extParsedEnt ::= TextDecl? content
- *
- * Returns 0 if the entity is well formed, -1 in case of args problem and
- * the parser error code otherwise
- */
-
-int
-xmlParseExternalEntity(xmlDocPtr doc, xmlSAXHandlerPtr sax, void *user_data,
- int depth, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *lst) {
- return(xmlParseExternalEntityPrivate(doc, NULL, sax, user_data, depth, URL,
- ID, lst));
-}
-
-/**
- * xmlParseBalancedChunkMemory:
- * @doc: the document the chunk pertains to
- * @sax: the SAX handler bloc (possibly NULL)
- * @user_data: The user data returned on SAX callbacks (possibly NULL)
- * @depth: Used for loop detection, use 0
- * @string: the input string in UTF8 or ISO-Latin (zero terminated)
- * @lst: the return value for the set of parsed nodes
- *
- * Parse a well-balanced chunk of an XML document
- * called by the parser
- * The allowed sequence for the Well Balanced Chunk is the one defined by
- * the content production in the XML grammar:
- *
- * [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*
- *
- * Returns 0 if the chunk is well balanced, -1 in case of args problem and
- * the parser error code otherwise
- */
-
-int
-xmlParseBalancedChunkMemory(xmlDocPtr doc, xmlSAXHandlerPtr sax,
- void *user_data, int depth, const xmlChar *string, xmlNodePtr *lst) {
- return xmlParseBalancedChunkMemoryRecover( doc, sax, user_data,
- depth, string, lst, 0 );
-}
-
-/**
- * xmlParseBalancedChunkMemoryInternal:
- * @oldctxt: the existing parsing context
- * @string: the input string in UTF8 or ISO-Latin (zero terminated)
- * @user_data: the user data field for the parser context
- * @lst: the return value for the set of parsed nodes
- *
- *
- * Parse a well-balanced chunk of an XML document
- * called by the parser
- * The allowed sequence for the Well Balanced Chunk is the one defined by
- * the content production in the XML grammar:
- *
- * [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*
- *
- * Returns 0 if the chunk is well balanced, -1 in case of args problem and
- * the parser error code otherwise
- *
- * In case recover is set to 1, the nodelist will not be empty even if
- * the parsed chunk is not well balanced.
- */
-static int
-xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
- const xmlChar *string, void *user_data, xmlNodePtr *lst) {
- xmlParserCtxtPtr ctxt;
- xmlDocPtr newDoc = NULL;
- xmlSAXHandlerPtr oldsax = NULL;
- xmlNodePtr content = NULL;
- int size;
- int ret = 0;
-
- if (oldctxt->depth > 40) {
- return(XML_ERR_ENTITY_LOOP);
- }
-
-
- if (lst != NULL)
- *lst = NULL;
- if (string == NULL)
- return(-1);
-
- size = xmlStrlen(string);
-
- ctxt = xmlCreateMemoryParserCtxt((char *) string, size);
- if (ctxt == NULL) return(-1);
- if (user_data != NULL)
- ctxt->userData = user_data;
- else
- ctxt->userData = ctxt;
-
- oldsax = ctxt->sax;
- ctxt->sax = oldctxt->sax;
- ctxt->_private = oldctxt->_private;
- if (oldctxt->myDoc == NULL) {
- newDoc = xmlNewDoc(BAD_CAST "1.0");
- if (newDoc == NULL) {
- ctxt->sax = oldsax;
- xmlFreeParserCtxt(ctxt);
- return(-1);
- }
- ctxt->myDoc = newDoc;
- } else {
- ctxt->myDoc = oldctxt->myDoc;
- content = ctxt->myDoc->children;
- }
- ctxt->myDoc->children = xmlNewDocNode(ctxt->myDoc, NULL,
- BAD_CAST "pseudoroot", NULL);
- if (ctxt->myDoc->children == NULL) {
- ctxt->sax = oldsax;
- xmlFreeParserCtxt(ctxt);
- if (newDoc != NULL)
- xmlFreeDoc(newDoc);
- return(-1);
- }
- nodePush(ctxt, ctxt->myDoc->children);
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->depth = oldctxt->depth + 1;
-
- /*
- * Doing validity checking on chunk doesn't make sense
- */
- ctxt->validate = 0;
- ctxt->loadsubset = oldctxt->loadsubset;
-
- xmlParseContent(ctxt);
- if ((RAW == '<') && (NXT(1) == '/')) {
- ctxt->errNo = XML_ERR_NOT_WELL_BALANCED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "chunk is not well balanced\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else if (RAW != 0) {
- ctxt->errNo = XML_ERR_EXTRA_CONTENT;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "extra content at the end of well balanced chunk\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if (ctxt->node != ctxt->myDoc->children) {
- ctxt->errNo = XML_ERR_NOT_WELL_BALANCED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "chunk is not well balanced\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- if (!ctxt->wellFormed) {
- if (ctxt->errNo == 0)
- ret = 1;
- else
- ret = ctxt->errNo;
- } else {
- ret = 0;
- }
-
- if ((lst != NULL) && (ret == 0)) {
- xmlNodePtr cur;
-
- /*
- * Return the newly created nodeset after unlinking it from
- * they pseudo parent.
- */
- cur = ctxt->myDoc->children->children;
- *lst = cur;
- while (cur != NULL) {
- cur->parent = NULL;
- cur = cur->next;
- }
- ctxt->myDoc->children->children = NULL;
- }
- if (ctxt->myDoc != NULL) {
- xmlFreeNode(ctxt->myDoc->children);
- ctxt->myDoc->children = content;
- }
-
- ctxt->sax = oldsax;
- xmlFreeParserCtxt(ctxt);
- if (newDoc != NULL)
- xmlFreeDoc(newDoc);
-
- return(ret);
-}
-
-/**
- * xmlParseBalancedChunkMemoryRecover:
- * @doc: the document the chunk pertains to
- * @sax: the SAX handler bloc (possibly NULL)
- * @user_data: The user data returned on SAX callbacks (possibly NULL)
- * @depth: Used for loop detection, use 0
- * @string: the input string in UTF8 or ISO-Latin (zero terminated)
- * @lst: the return value for the set of parsed nodes
- * @recover: return nodes even if the data is broken (use 0)
- *
- *
- * Parse a well-balanced chunk of an XML document
- * called by the parser
- * The allowed sequence for the Well Balanced Chunk is the one defined by
- * the content production in the XML grammar:
- *
- * [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*
- *
- * Returns 0 if the chunk is well balanced, -1 in case of args problem and
- * the parser error code otherwise
- *
- * In case recover is set to 1, the nodelist will not be empty even if
- * the parsed chunk is not well balanced.
- */
-int
-xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax,
- void *user_data, int depth, const xmlChar *string, xmlNodePtr *lst,
- int recover) {
- xmlParserCtxtPtr ctxt;
- xmlDocPtr newDoc;
- xmlSAXHandlerPtr oldsax = NULL;
- xmlNodePtr content;
- int size;
- int ret = 0;
-
- if (depth > 40) {
- return(XML_ERR_ENTITY_LOOP);
- }
-
-
- if (lst != NULL)
- *lst = NULL;
- if (string == NULL)
- return(-1);
-
- size = xmlStrlen(string);
-
- ctxt = xmlCreateMemoryParserCtxt((char *) string, size);
- if (ctxt == NULL) return(-1);
- ctxt->userData = ctxt;
- if (sax != NULL) {
- oldsax = ctxt->sax;
- ctxt->sax = sax;
- if (user_data != NULL)
- ctxt->userData = user_data;
- }
- newDoc = xmlNewDoc(BAD_CAST "1.0");
- if (newDoc == NULL) {
- xmlFreeParserCtxt(ctxt);
- return(-1);
- }
- if (doc != NULL) {
- newDoc->intSubset = doc->intSubset;
- newDoc->extSubset = doc->extSubset;
- }
- newDoc->children = xmlNewDocNode(newDoc, NULL, BAD_CAST "pseudoroot", NULL);
- if (newDoc->children == NULL) {
- if (sax != NULL)
- ctxt->sax = oldsax;
- xmlFreeParserCtxt(ctxt);
- newDoc->intSubset = NULL;
- newDoc->extSubset = NULL;
- xmlFreeDoc(newDoc);
- return(-1);
- }
- nodePush(ctxt, newDoc->children);
- if (doc == NULL) {
- ctxt->myDoc = newDoc;
- } else {
- ctxt->myDoc = newDoc;
- newDoc->children->doc = doc;
- }
- ctxt->instate = XML_PARSER_CONTENT;
- ctxt->depth = depth;
-
- /*
- * Doing validity checking on chunk doesn't make sense
- */
- ctxt->validate = 0;
- ctxt->loadsubset = 0;
-
- if ( doc != NULL ){
- content = doc->children;
- doc->children = NULL;
- xmlParseContent(ctxt);
- doc->children = content;
- }
- else {
- xmlParseContent(ctxt);
- }
- if ((RAW == '<') && (NXT(1) == '/')) {
- ctxt->errNo = XML_ERR_NOT_WELL_BALANCED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "chunk is not well balanced\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else if (RAW != 0) {
- ctxt->errNo = XML_ERR_EXTRA_CONTENT;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "extra content at the end of well balanced chunk\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- if (ctxt->node != newDoc->children) {
- ctxt->errNo = XML_ERR_NOT_WELL_BALANCED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "chunk is not well balanced\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
-
- if (!ctxt->wellFormed) {
- if (ctxt->errNo == 0)
- ret = 1;
- else
- ret = ctxt->errNo;
- } else {
- ret = 0;
- }
-
- if (lst != NULL && (ret == 0 || recover == 1)) {
- xmlNodePtr cur;
-
- /*
- * Return the newly created nodeset after unlinking it from
- * they pseudo parent.
- */
- cur = newDoc->children->children;
- *lst = cur;
- while (cur != NULL) {
- cur->parent = NULL;
- cur = cur->next;
- }
- newDoc->children->children = NULL;
- }
-
- if (sax != NULL)
- ctxt->sax = oldsax;
- xmlFreeParserCtxt(ctxt);
- newDoc->intSubset = NULL;
- newDoc->extSubset = NULL;
- xmlFreeDoc(newDoc);
-
- return(ret);
-}
-
-/**
- * xmlSAXParseEntity:
- * @sax: the SAX handler block
- * @filename: the filename
- *
- * parse an XML external entity out of context and build a tree.
- * It use the given SAX function block to handle the parsing callback.
- * If sax is NULL, fallback to the default DOM tree building routines.
- *
- * [78] extParsedEnt ::= TextDecl? content
- *
- * This correspond to a "Well Balanced" chunk
- *
- * Returns the resulting document tree
- */
-
-xmlDocPtr
-xmlSAXParseEntity(xmlSAXHandlerPtr sax, const char *filename) {
- xmlDocPtr ret;
- xmlParserCtxtPtr ctxt;
- char *directory = NULL;
-
- ctxt = xmlCreateFileParserCtxt(filename);
- if (ctxt == NULL) {
- return(NULL);
- }
- if (sax != NULL) {
- if (ctxt->sax != NULL)
- xmlFree(ctxt->sax);
- ctxt->sax = sax;
- ctxt->userData = NULL;
- }
-
- if ((ctxt->directory == NULL) && (directory == NULL))
- directory = xmlParserGetDirectory(filename);
-
- xmlParseExtParsedEnt(ctxt);
-
- if (ctxt->wellFormed)
- ret = ctxt->myDoc;
- else {
- ret = NULL;
- xmlFreeDoc(ctxt->myDoc);
- ctxt->myDoc = NULL;
- }
- if (sax != NULL)
- ctxt->sax = NULL;
- xmlFreeParserCtxt(ctxt);
-
- return(ret);
-}
-
-/**
- * xmlParseEntity:
- * @filename: the filename
- *
- * parse an XML external entity out of context and build a tree.
- *
- * [78] extParsedEnt ::= TextDecl? content
- *
- * This correspond to a "Well Balanced" chunk
- *
- * Returns the resulting document tree
- */
-
-xmlDocPtr
-xmlParseEntity(const char *filename) {
- return(xmlSAXParseEntity(NULL, filename));
-}
-
-/**
- * xmlCreateEntityParserCtxt:
- * @URL: the entity URL
- * @ID: the entity PUBLIC ID
- * @base: a possible base for the target URI
- *
- * Create a parser context for an external entity
- * Automatic support for ZLIB/Compress compressed document is provided
- * by default if found at compile-time.
- *
- * Returns the new parser context or NULL
- */
-xmlParserCtxtPtr
-xmlCreateEntityParserCtxt(const xmlChar *URL, const xmlChar *ID,
- const xmlChar *base) {
- xmlParserCtxtPtr ctxt;
- xmlParserInputPtr inputStream;
- char *directory = NULL;
- xmlChar *uri;
-
- ctxt = xmlNewParserCtxt();
- if (ctxt == NULL) {
- return(NULL);
- }
-
- uri = xmlBuildURI(URL, base);
-
- if (uri == NULL) {
- inputStream = xmlLoadExternalEntity((char *)URL, (char *)ID, ctxt);
- if (inputStream == NULL) {
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
-
- inputPush(ctxt, inputStream);
-
- if ((ctxt->directory == NULL) && (directory == NULL))
- directory = xmlParserGetDirectory((char *)URL);
- if ((ctxt->directory == NULL) && (directory != NULL))
- ctxt->directory = directory;
- } else {
- inputStream = xmlLoadExternalEntity((char *)uri, (char *)ID, ctxt);
- if (inputStream == NULL) {
- xmlFree(uri);
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
-
- inputPush(ctxt, inputStream);
-
- if ((ctxt->directory == NULL) && (directory == NULL))
- directory = xmlParserGetDirectory((char *)uri);
- if ((ctxt->directory == NULL) && (directory != NULL))
- ctxt->directory = directory;
- xmlFree(uri);
- }
-
- return(ctxt);
-}
-
-/************************************************************************
- * *
- * Front ends when parsing from a file *
- * *
- ************************************************************************/
-
-/**
- * xmlCreateFileParserCtxt:
- * @filename: the filename
- *
- * Create a parser context for a file content.
- * Automatic support for ZLIB/Compress compressed document is provided
- * by default if found at compile-time.
- *
- * Returns the new parser context or NULL
- */
-xmlParserCtxtPtr
-xmlCreateFileParserCtxt(const char *filename)
-{
- xmlParserCtxtPtr ctxt;
- xmlParserInputPtr inputStream;
- char *directory = NULL;
- xmlChar *normalized;
-
- ctxt = xmlNewParserCtxt();
- if (ctxt == NULL) {
- if (xmlDefaultSAXHandler.error != NULL) {
- xmlDefaultSAXHandler.error(NULL, "out of memory\n");
- }
- return(NULL);
- }
-
- normalized = xmlNormalizeWindowsPath((const xmlChar *) filename);
- if (normalized == NULL) {
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
- inputStream = xmlLoadExternalEntity((char *) normalized, NULL, ctxt);
- if (inputStream == NULL) {
- xmlFreeParserCtxt(ctxt);
- xmlFree(normalized);
- return(NULL);
- }
-
- inputPush(ctxt, inputStream);
- if ((ctxt->directory == NULL) && (directory == NULL))
- directory = xmlParserGetDirectory((char *) normalized);
- if ((ctxt->directory == NULL) && (directory != NULL))
- ctxt->directory = directory;
-
- xmlFree(normalized);
-
- return(ctxt);
-}
-
-/**
- * xmlSAXParseFileWithData:
- * @sax: the SAX handler block
- * @filename: the filename
- * @recovery: work in recovery mode, i.e. tries to read no Well Formed
- * documents
- * @data: the userdata
- *
- * parse an XML file and build a tree. Automatic support for ZLIB/Compress
- * compressed document is provided by default if found at compile-time.
- * It use the given SAX function block to handle the parsing callback.
- * If sax is NULL, fallback to the default DOM tree building routines.
- *
- * User data (void *) is stored within the parser context in the
- * context's _private member, so it is available nearly everywhere in libxml
- *
- * Returns the resulting document tree
- */
-
-xmlDocPtr
-xmlSAXParseFileWithData(xmlSAXHandlerPtr sax, const char *filename,
- int recovery, void *data) {
- xmlDocPtr ret;
- xmlParserCtxtPtr ctxt;
- char *directory = NULL;
-
- xmlInitParser();
-
- ctxt = xmlCreateFileParserCtxt(filename);
- if (ctxt == NULL) {
- return(NULL);
- }
- if (sax != NULL) {
- if (ctxt->sax != NULL)
- xmlFree(ctxt->sax);
- ctxt->sax = sax;
- }
- if (data!=NULL) {
- ctxt->_private=data;
- }
-
- if ((ctxt->directory == NULL) && (directory == NULL))
- directory = xmlParserGetDirectory(filename);
- if ((ctxt->directory == NULL) && (directory != NULL))
- ctxt->directory = (char *) xmlStrdup((xmlChar *) directory);
-
- ctxt->recovery = recovery;
-
- xmlParseDocument(ctxt);
-
- if ((ctxt->wellFormed) || recovery) ret = ctxt->myDoc;
- else {
- ret = NULL;
- xmlFreeDoc(ctxt->myDoc);
- ctxt->myDoc = NULL;
- }
- if (sax != NULL)
- ctxt->sax = NULL;
- xmlFreeParserCtxt(ctxt);
-
- return(ret);
-}
-
-/**
- * xmlSAXParseFile:
- * @sax: the SAX handler block
- * @filename: the filename
- * @recovery: work in recovery mode, i.e. tries to read no Well Formed
- * documents
- *
- * parse an XML file and build a tree. Automatic support for ZLIB/Compress
- * compressed document is provided by default if found at compile-time.
- * It use the given SAX function block to handle the parsing callback.
- * If sax is NULL, fallback to the default DOM tree building routines.
- *
- * Returns the resulting document tree
- */
-
-xmlDocPtr
-xmlSAXParseFile(xmlSAXHandlerPtr sax, const char *filename,
- int recovery) {
- return(xmlSAXParseFileWithData(sax,filename,recovery,NULL));
-}
-
-/**
- * xmlRecoverDoc:
- * @cur: a pointer to an array of xmlChar
- *
- * parse an XML in-memory document and build a tree.
- * In the case the document is not Well Formed, a tree is built anyway
- *
- * Returns the resulting document tree
- */
-
-xmlDocPtr
-xmlRecoverDoc(xmlChar *cur) {
- return(xmlSAXParseDoc(NULL, cur, 1));
-}
-
-/**
- * xmlParseFile:
- * @filename: the filename
- *
- * parse an XML file and build a tree. Automatic support for ZLIB/Compress
- * compressed document is provided by default if found at compile-time.
- *
- * Returns the resulting document tree if the file was wellformed,
- * NULL otherwise.
- */
-
-xmlDocPtr
-xmlParseFile(const char *filename) {
- return(xmlSAXParseFile(NULL, filename, 0));
-}
-
-/**
- * xmlRecoverFile:
- * @filename: the filename
- *
- * parse an XML file and build a tree. Automatic support for ZLIB/Compress
- * compressed document is provided by default if found at compile-time.
- * In the case the document is not Well Formed, a tree is built anyway
- *
- * Returns the resulting document tree
- */
-
-xmlDocPtr
-xmlRecoverFile(const char *filename) {
- return(xmlSAXParseFile(NULL, filename, 1));
-}
-
-
-/**
- * xmlSetupParserForBuffer:
- * @ctxt: an XML parser context
- * @buffer: a xmlChar * buffer
- * @filename: a file name
- *
- * Setup the parser context to parse a new buffer; Clears any prior
- * contents from the parser context. The buffer parameter must not be
- * NULL, but the filename parameter can be
- */
-void
-xmlSetupParserForBuffer(xmlParserCtxtPtr ctxt, const xmlChar* buffer,
- const char* filename)
-{
- xmlParserInputPtr input;
-
- input = xmlNewInputStream(ctxt);
- if (input == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc");
- xmlFree(ctxt);
- return;
- }
-
- xmlClearParserCtxt(ctxt);
- if (filename != NULL)
- input->filename = xmlMemStrdup(filename);
- input->base = buffer;
- input->cur = buffer;
- input->end = &buffer[xmlStrlen(buffer)];
- inputPush(ctxt, input);
-}
-
-/**
- * xmlSAXUserParseFile:
- * @sax: a SAX handler
- * @user_data: The user data returned on SAX callbacks
- * @filename: a file name
- *
- * parse an XML file and call the given SAX handler routines.
- * Automatic support for ZLIB/Compress compressed document is provided
- *
- * Returns 0 in case of success or a error number otherwise
- */
-int
-xmlSAXUserParseFile(xmlSAXHandlerPtr sax, void *user_data,
- const char *filename) {
- int ret = 0;
- xmlParserCtxtPtr ctxt;
-
- ctxt = xmlCreateFileParserCtxt(filename);
- if (ctxt == NULL) return -1;
- if (ctxt->sax != &xmlDefaultSAXHandler)
- xmlFree(ctxt->sax);
- ctxt->sax = sax;
- if (user_data != NULL)
- ctxt->userData = user_data;
-
- xmlParseDocument(ctxt);
-
- if (ctxt->wellFormed)
- ret = 0;
- else {
- if (ctxt->errNo != 0)
- ret = ctxt->errNo;
- else
- ret = -1;
- }
- if (sax != NULL)
- ctxt->sax = NULL;
- xmlFreeParserCtxt(ctxt);
-
- return ret;
-}
-
-/************************************************************************
- * *
- * Front ends when parsing from memory *
- * *
- ************************************************************************/
-
-/**
- * xmlCreateMemoryParserCtxt:
- * @buffer: a pointer to a char array
- * @size: the size of the array
- *
- * Create a parser context for an XML in-memory document.
- *
- * Returns the new parser context or NULL
- */
-xmlParserCtxtPtr
-xmlCreateMemoryParserCtxt(const char *buffer, int size) {
- xmlParserCtxtPtr ctxt;
- xmlParserInputPtr input;
- xmlParserInputBufferPtr buf;
-
- if (buffer == NULL)
- return(NULL);
- if (size <= 0)
- return(NULL);
-
- ctxt = xmlNewParserCtxt();
- if (ctxt == NULL)
- return(NULL);
-
- buf = xmlParserInputBufferCreateMem(buffer, size, XML_CHAR_ENCODING_NONE);
- if (buf == NULL) {
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
-
- input = xmlNewInputStream(ctxt);
- if (input == NULL) {
- xmlFreeParserInputBuffer(buf);
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
-
- input->filename = NULL;
- input->buf = buf;
- input->base = input->buf->buffer->content;
- input->cur = input->buf->buffer->content;
- input->end = &input->buf->buffer->content[input->buf->buffer->use];
-
- inputPush(ctxt, input);
- return(ctxt);
-}
-
-/**
- * xmlSAXParseMemoryWithData:
- * @sax: the SAX handler block
- * @buffer: an pointer to a char array
- * @size: the size of the array
- * @recovery: work in recovery mode, i.e. tries to read no Well Formed
- * documents
- * @data: the userdata
- *
- * parse an XML in-memory block and use the given SAX function block
- * to handle the parsing callback. If sax is NULL, fallback to the default
- * DOM tree building routines.
- *
- * User data (void *) is stored within the parser context in the
- * context's _private member, so it is available nearly everywhere in libxml
- *
- * Returns the resulting document tree
- */
-
-xmlDocPtr
-xmlSAXParseMemoryWithData(xmlSAXHandlerPtr sax, const char *buffer,
- int size, int recovery, void *data) {
- xmlDocPtr ret;
- xmlParserCtxtPtr ctxt;
-
- ctxt = xmlCreateMemoryParserCtxt(buffer, size);
- if (ctxt == NULL) return(NULL);
- if (sax != NULL) {
- if (ctxt->sax != NULL)
- xmlFree(ctxt->sax);
- ctxt->sax = sax;
- }
- if (data!=NULL) {
- ctxt->_private=data;
- }
-
- xmlParseDocument(ctxt);
-
- if ((ctxt->wellFormed) || recovery) ret = ctxt->myDoc;
- else {
- ret = NULL;
- xmlFreeDoc(ctxt->myDoc);
- ctxt->myDoc = NULL;
- }
- if (sax != NULL)
- ctxt->sax = NULL;
- xmlFreeParserCtxt(ctxt);
-
- return(ret);
-}
-
-/**
- * xmlSAXParseMemory:
- * @sax: the SAX handler block
- * @buffer: an pointer to a char array
- * @size: the size of the array
- * @recovery: work in recovery mode, i.e. tries to read not Well Formed
- * documents
- *
- * parse an XML in-memory block and use the given SAX function block
- * to handle the parsing callback. If sax is NULL, fallback to the default
- * DOM tree building routines.
- *
- * Returns the resulting document tree
- */
-xmlDocPtr
-xmlSAXParseMemory(xmlSAXHandlerPtr sax, const char *buffer,
- int size, int recovery) {
- return xmlSAXParseMemoryWithData(sax, buffer, size, recovery, NULL);
-}
-
-/**
- * xmlParseMemory:
- * @buffer: an pointer to a char array
- * @size: the size of the array
- *
- * parse an XML in-memory block and build a tree.
- *
- * Returns the resulting document tree
- */
-
-xmlDocPtr xmlParseMemory(const char *buffer, int size) {
- return(xmlSAXParseMemory(NULL, buffer, size, 0));
-}
-
-/**
- * xmlRecoverMemory:
- * @buffer: an pointer to a char array
- * @size: the size of the array
- *
- * parse an XML in-memory block and build a tree.
- * In the case the document is not Well Formed, a tree is built anyway
- *
- * Returns the resulting document tree
- */
-
-xmlDocPtr xmlRecoverMemory(const char *buffer, int size) {
- return(xmlSAXParseMemory(NULL, buffer, size, 1));
-}
-
-/**
- * xmlSAXUserParseMemory:
- * @sax: a SAX handler
- * @user_data: The user data returned on SAX callbacks
- * @buffer: an in-memory XML document input
- * @size: the length of the XML document in bytes
- *
- * A better SAX parsing routine.
- * parse an XML in-memory buffer and call the given SAX handler routines.
- *
- * Returns 0 in case of success or a error number otherwise
- */
-int xmlSAXUserParseMemory(xmlSAXHandlerPtr sax, void *user_data,
- const char *buffer, int size) {
- int ret = 0;
- xmlParserCtxtPtr ctxt;
- xmlSAXHandlerPtr oldsax = NULL;
-
- if (sax == NULL) return -1;
- ctxt = xmlCreateMemoryParserCtxt(buffer, size);
- if (ctxt == NULL) return -1;
- oldsax = ctxt->sax;
- ctxt->sax = sax;
- if (user_data != NULL)
- ctxt->userData = user_data;
-
- xmlParseDocument(ctxt);
-
- if (ctxt->wellFormed)
- ret = 0;
- else {
- if (ctxt->errNo != 0)
- ret = ctxt->errNo;
- else
- ret = -1;
- }
- ctxt->sax = oldsax;
- xmlFreeParserCtxt(ctxt);
-
- return ret;
-}
-
-/**
- * xmlCreateDocParserCtxt:
- * @cur: a pointer to an array of xmlChar
- *
- * Creates a parser context for an XML in-memory document.
- *
- * Returns the new parser context or NULL
- */
-xmlParserCtxtPtr
-xmlCreateDocParserCtxt(xmlChar *cur) {
- int len;
-
- if (cur == NULL)
- return(NULL);
- len = xmlStrlen(cur);
- return(xmlCreateMemoryParserCtxt((char *)cur, len));
-}
-
-/**
- * xmlSAXParseDoc:
- * @sax: the SAX handler block
- * @cur: a pointer to an array of xmlChar
- * @recovery: work in recovery mode, i.e. tries to read no Well Formed
- * documents
- *
- * parse an XML in-memory document and build a tree.
- * It use the given SAX function block to handle the parsing callback.
- * If sax is NULL, fallback to the default DOM tree building routines.
- *
- * Returns the resulting document tree
- */
-
-xmlDocPtr
-xmlSAXParseDoc(xmlSAXHandlerPtr sax, xmlChar *cur, int recovery) {
- xmlDocPtr ret;
- xmlParserCtxtPtr ctxt;
-
- if (cur == NULL) return(NULL);
-
-
- ctxt = xmlCreateDocParserCtxt(cur);
- if (ctxt == NULL) return(NULL);
- if (sax != NULL) {
- ctxt->sax = sax;
- ctxt->userData = NULL;
- }
-
- xmlParseDocument(ctxt);
- if ((ctxt->wellFormed) || recovery) ret = ctxt->myDoc;
- else {
- ret = NULL;
- xmlFreeDoc(ctxt->myDoc);
- ctxt->myDoc = NULL;
- }
- if (sax != NULL)
- ctxt->sax = NULL;
- xmlFreeParserCtxt(ctxt);
-
- return(ret);
-}
-
-/**
- * xmlParseDoc:
- * @cur: a pointer to an array of xmlChar
- *
- * parse an XML in-memory document and build a tree.
- *
- * Returns the resulting document tree
- */
-
-xmlDocPtr
-xmlParseDoc(xmlChar *cur) {
- return(xmlSAXParseDoc(NULL, cur, 0));
-}
-
-/************************************************************************
- * *
- * Specific function to keep track of entities references *
- * and used by the XSLT debugger *
- * *
- ************************************************************************/
-
-static xmlEntityReferenceFunc xmlEntityRefFunc = NULL;
-
-/**
- * xmlAddEntityReference:
- * @ent : A valid entity
- * @firstNode : A valid first node for children of entity
- * @lastNode : A valid last node of children entity
- *
- * Notify of a reference to an entity of type XML_EXTERNAL_GENERAL_PARSED_ENTITY
- */
-static void
-xmlAddEntityReference(xmlEntityPtr ent, xmlNodePtr firstNode,
- xmlNodePtr lastNode)
-{
- if (xmlEntityRefFunc != NULL) {
- (*xmlEntityRefFunc) (ent, firstNode, lastNode);
- }
-}
-
-
-/**
- * xmlSetEntityReferenceFunc:
- * @func: A valid function
- *
- * Set the function to call call back when a xml reference has been made
- */
-void
-xmlSetEntityReferenceFunc(xmlEntityReferenceFunc func)
-{
- xmlEntityRefFunc = func;
-}
-
-/************************************************************************
- * *
- * Miscellaneous *
- * *
- ************************************************************************/
-
-#ifdef LIBXML_XPATH_ENABLED
-#include <libxml/xpath.h>
-#endif
-
-extern void xmlGenericErrorDefaultFunc(void *ctx, const char *msg, ...);
-static int xmlParserInitialized = 0;
-
-/**
- * xmlInitParser:
- *
- * Initialization function for the XML parser.
- * This is not reentrant. Call once before processing in case of
- * use in multithreaded programs.
- */
-
-void
-xmlInitParser(void) {
- if (xmlParserInitialized != 0)
- return;
-
- if ((xmlGenericError == xmlGenericErrorDefaultFunc) ||
- (xmlGenericError == NULL))
- initGenericErrorDefaultFunc(NULL);
- xmlInitThreads();
- xmlInitMemory();
- xmlInitCharEncodingHandlers();
- xmlInitializePredefinedEntities();
- xmlDefaultSAXHandlerInit();
- xmlRegisterDefaultInputCallbacks();
- xmlRegisterDefaultOutputCallbacks();
-#ifdef LIBXML_HTML_ENABLED
- htmlInitAutoClose();
- htmlDefaultSAXHandlerInit();
-#endif
-#ifdef LIBXML_XPATH_ENABLED
- xmlXPathInit();
-#endif
- xmlParserInitialized = 1;
-}
-
-/**
- * xmlCleanupParser:
- *
- * Cleanup function for the XML parser. It tries to reclaim all
- * parsing related global memory allocated for the parser processing.
- * It doesn't deallocate any document related memory. Calling this
- * function should not prevent reusing the parser.
- */
-
-void
-xmlCleanupParser(void) {
- xmlCleanupCharEncodingHandlers();
- xmlCleanupPredefinedEntities();
-#ifdef LIBXML_CATALOG_ENABLED
- xmlCatalogCleanup();
-#endif
- xmlCleanupThreads();
- xmlParserInitialized = 0;
-}
diff --git a/bundle/libxml/parserInternals.c b/bundle/libxml/parserInternals.c
deleted file mode 100644
index 65551441ee..0000000000
--- a/bundle/libxml/parserInternals.c
+++ /dev/null
@@ -1,3481 +0,0 @@
-/*
- * parserInternals.c : Internal routines (and obsolete ones) needed for the
- * XML and HTML parsers.
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#if defined(WIN32) && !defined (__CYGWIN__)
-#define XML_DIR_SEP '\\'
-#else
-#define XML_DIR_SEP '/'
-#endif
-
-#include <string.h>
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_ZLIB_H
-#include <zlib.h>
-#endif
-
-#include <libxml/xmlmemory.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-#include <libxml/valid.h>
-#include <libxml/entities.h>
-#include <libxml/xmlerror.h>
-#include <libxml/encoding.h>
-#include <libxml/valid.h>
-#include <libxml/xmlIO.h>
-#include <libxml/uri.h>
-#include <libxml/SAX.h>
-#ifdef LIBXML_CATALOG_ENABLED
-#include <libxml/catalog.h>
-#endif
-#include <libxml/globals.h>
-
-void xmlUpgradeOldNs(xmlDocPtr doc);
-
-/*
- * Various global defaults for parsing
- */
-
-/**
- * xmlCheckVersion:
- * @version: the include version number
- *
- * check the compiled lib version against the include one.
- * This can warn or immediately kill the application
- */
-void
-xmlCheckVersion(int version) {
- int myversion = (int) LIBXML_VERSION;
-
- xmlInitParser();
-
- if ((myversion / 10000) != (version / 10000)) {
- xmlGenericError(xmlGenericErrorContext,
- "Fatal: program compiled against libxml %d using libxml %d\n",
- (version / 10000), (myversion / 10000));
- fprintf(stderr,
- "Fatal: program compiled against libxml %d using libxml %d\n",
- (version / 10000), (myversion / 10000));
- }
- if ((myversion / 100) < (version / 100)) {
- xmlGenericError(xmlGenericErrorContext,
- "Warning: program compiled against libxml %d using older %d\n",
- (version / 100), (myversion / 100));
- }
-}
-
-
-static const char *xmlFeaturesList[] = {
- "validate",
- "load subset",
- "keep blanks",
- "disable SAX",
- "fetch external entities",
- "substitute entities",
- "gather line info",
- "user data",
- "is html",
- "is standalone",
- "stop parser",
- "document",
- "is well formed",
- "is valid",
- "SAX block",
- "SAX function internalSubset",
- "SAX function isStandalone",
- "SAX function hasInternalSubset",
- "SAX function hasExternalSubset",
- "SAX function resolveEntity",
- "SAX function getEntity",
- "SAX function entityDecl",
- "SAX function notationDecl",
- "SAX function attributeDecl",
- "SAX function elementDecl",
- "SAX function unparsedEntityDecl",
- "SAX function setDocumentLocator",
- "SAX function startDocument",
- "SAX function endDocument",
- "SAX function startElement",
- "SAX function endElement",
- "SAX function reference",
- "SAX function characters",
- "SAX function ignorableWhitespace",
- "SAX function processingInstruction",
- "SAX function comment",
- "SAX function warning",
- "SAX function error",
- "SAX function fatalError",
- "SAX function getParameterEntity",
- "SAX function cdataBlock",
- "SAX function externalSubset",
-};
-
-/**
- * xmlGetFeaturesList:
- * @len: the length of the features name array (input/output)
- * @result: an array of string to be filled with the features name.
- *
- * Copy at most *@len feature names into the @result array
- *
- * Returns -1 in case or error, or the total number of features,
- * len is updated with the number of strings copied,
- * strings must not be deallocated
- */
-int
-xmlGetFeaturesList(int *len, const char **result) {
- int ret, i;
-
- ret = sizeof(xmlFeaturesList)/sizeof(xmlFeaturesList[0]);
- if ((len == NULL) || (result == NULL))
- return(ret);
- if ((*len < 0) || (*len >= 1000))
- return(-1);
- if (*len > ret)
- *len = ret;
- for (i = 0;i < *len;i++)
- result[i] = xmlFeaturesList[i];
- return(ret);
-}
-
-/**
- * xmlGetFeature:
- * @ctxt: an XML/HTML parser context
- * @name: the feature name
- * @result: location to store the result
- *
- * Read the current value of one feature of this parser instance
- *
- * Returns -1 in case or error, 0 otherwise
- */
-int
-xmlGetFeature(xmlParserCtxtPtr ctxt, const char *name, void *result) {
- if ((ctxt == NULL) || (name == NULL) || (result == NULL))
- return(-1);
-
- if (!strcmp(name, "validate")) {
- *((int *) result) = ctxt->validate;
- } else if (!strcmp(name, "keep blanks")) {
- *((int *) result) = ctxt->keepBlanks;
- } else if (!strcmp(name, "disable SAX")) {
- *((int *) result) = ctxt->disableSAX;
- } else if (!strcmp(name, "fetch external entities")) {
- *((int *) result) = ctxt->loadsubset;
- } else if (!strcmp(name, "substitute entities")) {
- *((int *) result) = ctxt->replaceEntities;
- } else if (!strcmp(name, "gather line info")) {
- *((int *) result) = ctxt->record_info;
- } else if (!strcmp(name, "user data")) {
- *((void **)result) = ctxt->userData;
- } else if (!strcmp(name, "is html")) {
- *((int *) result) = ctxt->html;
- } else if (!strcmp(name, "is standalone")) {
- *((int *) result) = ctxt->standalone;
- } else if (!strcmp(name, "document")) {
- *((xmlDocPtr *) result) = ctxt->myDoc;
- } else if (!strcmp(name, "is well formed")) {
- *((int *) result) = ctxt->wellFormed;
- } else if (!strcmp(name, "is valid")) {
- *((int *) result) = ctxt->valid;
- } else if (!strcmp(name, "SAX block")) {
- *((xmlSAXHandlerPtr *) result) = ctxt->sax;
- } else if (!strcmp(name, "SAX function internalSubset")) {
- *((internalSubsetSAXFunc *) result) = ctxt->sax->internalSubset;
- } else if (!strcmp(name, "SAX function isStandalone")) {
- *((isStandaloneSAXFunc *) result) = ctxt->sax->isStandalone;
- } else if (!strcmp(name, "SAX function hasInternalSubset")) {
- *((hasInternalSubsetSAXFunc *) result) = ctxt->sax->hasInternalSubset;
- } else if (!strcmp(name, "SAX function hasExternalSubset")) {
- *((hasExternalSubsetSAXFunc *) result) = ctxt->sax->hasExternalSubset;
- } else if (!strcmp(name, "SAX function resolveEntity")) {
- *((resolveEntitySAXFunc *) result) = ctxt->sax->resolveEntity;
- } else if (!strcmp(name, "SAX function getEntity")) {
- *((getEntitySAXFunc *) result) = ctxt->sax->getEntity;
- } else if (!strcmp(name, "SAX function entityDecl")) {
- *((entityDeclSAXFunc *) result) = ctxt->sax->entityDecl;
- } else if (!strcmp(name, "SAX function notationDecl")) {
- *((notationDeclSAXFunc *) result) = ctxt->sax->notationDecl;
- } else if (!strcmp(name, "SAX function attributeDecl")) {
- *((attributeDeclSAXFunc *) result) = ctxt->sax->attributeDecl;
- } else if (!strcmp(name, "SAX function elementDecl")) {
- *((elementDeclSAXFunc *) result) = ctxt->sax->elementDecl;
- } else if (!strcmp(name, "SAX function unparsedEntityDecl")) {
- *((unparsedEntityDeclSAXFunc *) result) = ctxt->sax->unparsedEntityDecl;
- } else if (!strcmp(name, "SAX function setDocumentLocator")) {
- *((setDocumentLocatorSAXFunc *) result) = ctxt->sax->setDocumentLocator;
- } else if (!strcmp(name, "SAX function startDocument")) {
- *((startDocumentSAXFunc *) result) = ctxt->sax->startDocument;
- } else if (!strcmp(name, "SAX function endDocument")) {
- *((endDocumentSAXFunc *) result) = ctxt->sax->endDocument;
- } else if (!strcmp(name, "SAX function startElement")) {
- *((startElementSAXFunc *) result) = ctxt->sax->startElement;
- } else if (!strcmp(name, "SAX function endElement")) {
- *((endElementSAXFunc *) result) = ctxt->sax->endElement;
- } else if (!strcmp(name, "SAX function reference")) {
- *((referenceSAXFunc *) result) = ctxt->sax->reference;
- } else if (!strcmp(name, "SAX function characters")) {
- *((charactersSAXFunc *) result) = ctxt->sax->characters;
- } else if (!strcmp(name, "SAX function ignorableWhitespace")) {
- *((ignorableWhitespaceSAXFunc *) result) = ctxt->sax->ignorableWhitespace;
- } else if (!strcmp(name, "SAX function processingInstruction")) {
- *((processingInstructionSAXFunc *) result) = ctxt->sax->processingInstruction;
- } else if (!strcmp(name, "SAX function comment")) {
- *((commentSAXFunc *) result) = ctxt->sax->comment;
- } else if (!strcmp(name, "SAX function warning")) {
- *((warningSAXFunc *) result) = ctxt->sax->warning;
- } else if (!strcmp(name, "SAX function error")) {
- *((errorSAXFunc *) result) = ctxt->sax->error;
- } else if (!strcmp(name, "SAX function fatalError")) {
- *((fatalErrorSAXFunc *) result) = ctxt->sax->fatalError;
- } else if (!strcmp(name, "SAX function getParameterEntity")) {
- *((getParameterEntitySAXFunc *) result) = ctxt->sax->getParameterEntity;
- } else if (!strcmp(name, "SAX function cdataBlock")) {
- *((cdataBlockSAXFunc *) result) = ctxt->sax->cdataBlock;
- } else if (!strcmp(name, "SAX function externalSubset")) {
- *((externalSubsetSAXFunc *) result) = ctxt->sax->externalSubset;
- } else {
- return(-1);
- }
- return(0);
-}
-
-/**
- * xmlSetFeature:
- * @ctxt: an XML/HTML parser context
- * @name: the feature name
- * @value: pointer to the location of the new value
- *
- * Change the current value of one feature of this parser instance
- *
- * Returns -1 in case or error, 0 otherwise
- */
-int
-xmlSetFeature(xmlParserCtxtPtr ctxt, const char *name, void *value) {
- if ((ctxt == NULL) || (name == NULL) || (value == NULL))
- return(-1);
-
- if (!strcmp(name, "validate")) {
- int newvalidate = *((int *) value);
- if ((!ctxt->validate) && (newvalidate != 0)) {
- if (ctxt->vctxt.warning == NULL)
- ctxt->vctxt.warning = xmlParserValidityWarning;
- if (ctxt->vctxt.error == NULL)
- ctxt->vctxt.error = xmlParserValidityError;
- ctxt->vctxt.nodeMax = 0;
- }
- ctxt->validate = newvalidate;
- } else if (!strcmp(name, "keep blanks")) {
- ctxt->keepBlanks = *((int *) value);
- } else if (!strcmp(name, "disable SAX")) {
- ctxt->disableSAX = *((int *) value);
- } else if (!strcmp(name, "fetch external entities")) {
- ctxt->loadsubset = *((int *) value);
- } else if (!strcmp(name, "substitute entities")) {
- ctxt->replaceEntities = *((int *) value);
- } else if (!strcmp(name, "gather line info")) {
- ctxt->record_info = *((int *) value);
- } else if (!strcmp(name, "user data")) {
- ctxt->userData = *((void **)value);
- } else if (!strcmp(name, "is html")) {
- ctxt->html = *((int *) value);
- } else if (!strcmp(name, "is standalone")) {
- ctxt->standalone = *((int *) value);
- } else if (!strcmp(name, "document")) {
- ctxt->myDoc = *((xmlDocPtr *) value);
- } else if (!strcmp(name, "is well formed")) {
- ctxt->wellFormed = *((int *) value);
- } else if (!strcmp(name, "is valid")) {
- ctxt->valid = *((int *) value);
- } else if (!strcmp(name, "SAX block")) {
- ctxt->sax = *((xmlSAXHandlerPtr *) value);
- } else if (!strcmp(name, "SAX function internalSubset")) {
- ctxt->sax->internalSubset = *((internalSubsetSAXFunc *) value);
- } else if (!strcmp(name, "SAX function isStandalone")) {
- ctxt->sax->isStandalone = *((isStandaloneSAXFunc *) value);
- } else if (!strcmp(name, "SAX function hasInternalSubset")) {
- ctxt->sax->hasInternalSubset = *((hasInternalSubsetSAXFunc *) value);
- } else if (!strcmp(name, "SAX function hasExternalSubset")) {
- ctxt->sax->hasExternalSubset = *((hasExternalSubsetSAXFunc *) value);
- } else if (!strcmp(name, "SAX function resolveEntity")) {
- ctxt->sax->resolveEntity = *((resolveEntitySAXFunc *) value);
- } else if (!strcmp(name, "SAX function getEntity")) {
- ctxt->sax->getEntity = *((getEntitySAXFunc *) value);
- } else if (!strcmp(name, "SAX function entityDecl")) {
- ctxt->sax->entityDecl = *((entityDeclSAXFunc *) value);
- } else if (!strcmp(name, "SAX function notationDecl")) {
- ctxt->sax->notationDecl = *((notationDeclSAXFunc *) value);
- } else if (!strcmp(name, "SAX function attributeDecl")) {
- ctxt->sax->attributeDecl = *((attributeDeclSAXFunc *) value);
- } else if (!strcmp(name, "SAX function elementDecl")) {
- ctxt->sax->elementDecl = *((elementDeclSAXFunc *) value);
- } else if (!strcmp(name, "SAX function unparsedEntityDecl")) {
- ctxt->sax->unparsedEntityDecl = *((unparsedEntityDeclSAXFunc *) value);
- } else if (!strcmp(name, "SAX function setDocumentLocator")) {
- ctxt->sax->setDocumentLocator = *((setDocumentLocatorSAXFunc *) value);
- } else if (!strcmp(name, "SAX function startDocument")) {
- ctxt->sax->startDocument = *((startDocumentSAXFunc *) value);
- } else if (!strcmp(name, "SAX function endDocument")) {
- ctxt->sax->endDocument = *((endDocumentSAXFunc *) value);
- } else if (!strcmp(name, "SAX function startElement")) {
- ctxt->sax->startElement = *((startElementSAXFunc *) value);
- } else if (!strcmp(name, "SAX function endElement")) {
- ctxt->sax->endElement = *((endElementSAXFunc *) value);
- } else if (!strcmp(name, "SAX function reference")) {
- ctxt->sax->reference = *((referenceSAXFunc *) value);
- } else if (!strcmp(name, "SAX function characters")) {
- ctxt->sax->characters = *((charactersSAXFunc *) value);
- } else if (!strcmp(name, "SAX function ignorableWhitespace")) {
- ctxt->sax->ignorableWhitespace = *((ignorableWhitespaceSAXFunc *) value);
- } else if (!strcmp(name, "SAX function processingInstruction")) {
- ctxt->sax->processingInstruction = *((processingInstructionSAXFunc *) value);
- } else if (!strcmp(name, "SAX function comment")) {
- ctxt->sax->comment = *((commentSAXFunc *) value);
- } else if (!strcmp(name, "SAX function warning")) {
- ctxt->sax->warning = *((warningSAXFunc *) value);
- } else if (!strcmp(name, "SAX function error")) {
- ctxt->sax->error = *((errorSAXFunc *) value);
- } else if (!strcmp(name, "SAX function fatalError")) {
- ctxt->sax->fatalError = *((fatalErrorSAXFunc *) value);
- } else if (!strcmp(name, "SAX function getParameterEntity")) {
- ctxt->sax->getParameterEntity = *((getParameterEntitySAXFunc *) value);
- } else if (!strcmp(name, "SAX function cdataBlock")) {
- ctxt->sax->cdataBlock = *((cdataBlockSAXFunc *) value);
- } else if (!strcmp(name, "SAX function externalSubset")) {
- ctxt->sax->externalSubset = *((externalSubsetSAXFunc *) value);
- } else {
- return(-1);
- }
- return(0);
-}
-
-/************************************************************************
- * *
- * Some functions to avoid too large macros *
- * *
- ************************************************************************/
-
-/**
- * xmlIsChar:
- * @c: an unicode character (int)
- *
- * Check whether the character is allowed by the production
- * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
- * | [#x10000-#x10FFFF]
- * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
- * Also available as a macro IS_CHAR()
- *
- * Returns 0 if not, non-zero otherwise
- */
-int
-xmlIsChar(int c) {
- return(
- ((c) == 0x09) || ((c) == 0x0A) || ((c) == 0x0D) ||
- (((c) >= 0x20) && ((c) <= 0xD7FF)) ||
- (((c) >= 0xE000) && ((c) <= 0xFFFD)) ||
- (((c) >= 0x10000) && ((c) <= 0x10FFFF)));
-}
-
-/**
- * xmlIsBlank:
- * @c: an unicode character (int)
- *
- * Check whether the character is allowed by the production
- * [3] S ::= (#x20 | #x9 | #xD | #xA)+
- * Also available as a macro IS_BLANK()
- *
- * Returns 0 if not, non-zero otherwise
- */
-int
-xmlIsBlank(int c) {
- return(((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) || ((c) == 0x0D));
-}
-
-static int xmlBaseArray[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0000 - 0x000F */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0010 - 0x001F */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0020 - 0x002F */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0030 - 0x003F */
- 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x0040 - 0x004F */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 0x0050 - 0x005F */
- 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x0060 - 0x006F */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 0x0070 - 0x007F */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0080 - 0x008F */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0090 - 0x009F */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00A0 - 0x00AF */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00B0 - 0x00BF */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x00C0 - 0x00CF */
- 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x00D0 - 0x00DF */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x00E0 - 0x00EF */
- 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x00F0 - 0x00FF */
-};
-
-/**
- * xmlIsBaseChar:
- * @c: an unicode character (int)
- *
- * Check whether the character is allowed by the production
- * [85] BaseChar ::= ... long list see REC ...
- *
- * VI is your friend !
- * :1,$ s/\[#x\([0-9A-Z]*\)-#x\([0-9A-Z]*\)\]/ (((c) >= 0x\1) \&\& ((c) <= 0x\2)) ||/
- * and
- * :1,$ s/#x\([0-9A-Z]*\)/ ((c) == 0x\1) ||/
- *
- * Returns 0 if not, non-zero otherwise
- */
-int
-xmlIsBaseChar(int c) {
- return(
- (((c) < 0x0100) ? xmlBaseArray[c] :
- ( /* accelerator */
- (((c) >= 0x0100) && ((c) <= 0x0131)) ||
- (((c) >= 0x0134) && ((c) <= 0x013E)) ||
- (((c) >= 0x0141) && ((c) <= 0x0148)) ||
- (((c) >= 0x014A) && ((c) <= 0x017E)) ||
- (((c) >= 0x0180) && ((c) <= 0x01C3)) ||
- (((c) >= 0x01CD) && ((c) <= 0x01F0)) ||
- (((c) >= 0x01F4) && ((c) <= 0x01F5)) ||
- (((c) >= 0x01FA) && ((c) <= 0x0217)) ||
- (((c) >= 0x0250) && ((c) <= 0x02A8)) ||
- (((c) >= 0x02BB) && ((c) <= 0x02C1)) ||
- ((c) == 0x0386) ||
- (((c) >= 0x0388) && ((c) <= 0x038A)) ||
- ((c) == 0x038C) ||
- (((c) >= 0x038E) && ((c) <= 0x03A1)) ||
- (((c) >= 0x03A3) && ((c) <= 0x03CE)) ||
- (((c) >= 0x03D0) && ((c) <= 0x03D6)) ||
- ((c) == 0x03DA) ||
- ((c) == 0x03DC) ||
- ((c) == 0x03DE) ||
- ((c) == 0x03E0) ||
- (((c) >= 0x03E2) && ((c) <= 0x03F3)) ||
- (((c) >= 0x0401) && ((c) <= 0x040C)) ||
- (((c) >= 0x040E) && ((c) <= 0x044F)) ||
- (((c) >= 0x0451) && ((c) <= 0x045C)) ||
- (((c) >= 0x045E) && ((c) <= 0x0481)) ||
- (((c) >= 0x0490) && ((c) <= 0x04C4)) ||
- (((c) >= 0x04C7) && ((c) <= 0x04C8)) ||
- (((c) >= 0x04CB) && ((c) <= 0x04CC)) ||
- (((c) >= 0x04D0) && ((c) <= 0x04EB)) ||
- (((c) >= 0x04EE) && ((c) <= 0x04F5)) ||
- (((c) >= 0x04F8) && ((c) <= 0x04F9)) ||
- (((c) >= 0x0531) && ((c) <= 0x0556)) ||
- ((c) == 0x0559) ||
- (((c) >= 0x0561) && ((c) <= 0x0586)) ||
- (((c) >= 0x05D0) && ((c) <= 0x05EA)) ||
- (((c) >= 0x05F0) && ((c) <= 0x05F2)) ||
- (((c) >= 0x0621) && ((c) <= 0x063A)) ||
- (((c) >= 0x0641) && ((c) <= 0x064A)) ||
- (((c) >= 0x0671) && ((c) <= 0x06B7)) ||
- (((c) >= 0x06BA) && ((c) <= 0x06BE)) ||
- (((c) >= 0x06C0) && ((c) <= 0x06CE)) ||
- (((c) >= 0x06D0) && ((c) <= 0x06D3)) ||
- ((c) == 0x06D5) ||
- (((c) >= 0x06E5) && ((c) <= 0x06E6)) ||
- (((c) >= 0x905) && ( /* accelerator */
- (((c) >= 0x0905) && ((c) <= 0x0939)) ||
- ((c) == 0x093D) ||
- (((c) >= 0x0958) && ((c) <= 0x0961)) ||
- (((c) >= 0x0985) && ((c) <= 0x098C)) ||
- (((c) >= 0x098F) && ((c) <= 0x0990)) ||
- (((c) >= 0x0993) && ((c) <= 0x09A8)) ||
- (((c) >= 0x09AA) && ((c) <= 0x09B0)) ||
- ((c) == 0x09B2) ||
- (((c) >= 0x09B6) && ((c) <= 0x09B9)) ||
- (((c) >= 0x09DC) && ((c) <= 0x09DD)) ||
- (((c) >= 0x09DF) && ((c) <= 0x09E1)) ||
- (((c) >= 0x09F0) && ((c) <= 0x09F1)) ||
- (((c) >= 0x0A05) && ((c) <= 0x0A0A)) ||
- (((c) >= 0x0A0F) && ((c) <= 0x0A10)) ||
- (((c) >= 0x0A13) && ((c) <= 0x0A28)) ||
- (((c) >= 0x0A2A) && ((c) <= 0x0A30)) ||
- (((c) >= 0x0A32) && ((c) <= 0x0A33)) ||
- (((c) >= 0x0A35) && ((c) <= 0x0A36)) ||
- (((c) >= 0x0A38) && ((c) <= 0x0A39)) ||
- (((c) >= 0x0A59) && ((c) <= 0x0A5C)) ||
- ((c) == 0x0A5E) ||
- (((c) >= 0x0A72) && ((c) <= 0x0A74)) ||
- (((c) >= 0x0A85) && ((c) <= 0x0A8B)) ||
- ((c) == 0x0A8D) ||
- (((c) >= 0x0A8F) && ((c) <= 0x0A91)) ||
- (((c) >= 0x0A93) && ((c) <= 0x0AA8)) ||
- (((c) >= 0x0AAA) && ((c) <= 0x0AB0)) ||
- (((c) >= 0x0AB2) && ((c) <= 0x0AB3)) ||
- (((c) >= 0x0AB5) && ((c) <= 0x0AB9)) ||
- ((c) == 0x0ABD) ||
- ((c) == 0x0AE0) ||
- (((c) >= 0x0B05) && ((c) <= 0x0B0C)) ||
- (((c) >= 0x0B0F) && ((c) <= 0x0B10)) ||
- (((c) >= 0x0B13) && ((c) <= 0x0B28)) ||
- (((c) >= 0x0B2A) && ((c) <= 0x0B30)) ||
- (((c) >= 0x0B32) && ((c) <= 0x0B33)) ||
- (((c) >= 0x0B36) && ((c) <= 0x0B39)) ||
- ((c) == 0x0B3D) ||
- (((c) >= 0x0B5C) && ((c) <= 0x0B5D)) ||
- (((c) >= 0x0B5F) && ((c) <= 0x0B61)) ||
- (((c) >= 0x0B85) && ((c) <= 0x0B8A)) ||
- (((c) >= 0x0B8E) && ((c) <= 0x0B90)) ||
- (((c) >= 0x0B92) && ((c) <= 0x0B95)) ||
- (((c) >= 0x0B99) && ((c) <= 0x0B9A)) ||
- ((c) == 0x0B9C) ||
- (((c) >= 0x0B9E) && ((c) <= 0x0B9F)) ||
- (((c) >= 0x0BA3) && ((c) <= 0x0BA4)) ||
- (((c) >= 0x0BA8) && ((c) <= 0x0BAA)) ||
- (((c) >= 0x0BAE) && ((c) <= 0x0BB5)) ||
- (((c) >= 0x0BB7) && ((c) <= 0x0BB9)) ||
- (((c) >= 0x0C05) && ((c) <= 0x0C0C)) ||
- (((c) >= 0x0C0E) && ((c) <= 0x0C10)) ||
- (((c) >= 0x0C12) && ((c) <= 0x0C28)) ||
- (((c) >= 0x0C2A) && ((c) <= 0x0C33)) ||
- (((c) >= 0x0C35) && ((c) <= 0x0C39)) ||
- (((c) >= 0x0C60) && ((c) <= 0x0C61)) ||
- (((c) >= 0x0C85) && ((c) <= 0x0C8C)) ||
- (((c) >= 0x0C8E) && ((c) <= 0x0C90)) ||
- (((c) >= 0x0C92) && ((c) <= 0x0CA8)) ||
- (((c) >= 0x0CAA) && ((c) <= 0x0CB3)) ||
- (((c) >= 0x0CB5) && ((c) <= 0x0CB9)) ||
- ((c) == 0x0CDE) ||
- (((c) >= 0x0CE0) && ((c) <= 0x0CE1)) ||
- (((c) >= 0x0D05) && ((c) <= 0x0D0C)) ||
- (((c) >= 0x0D0E) && ((c) <= 0x0D10)) ||
- (((c) >= 0x0D12) && ((c) <= 0x0D28)) ||
- (((c) >= 0x0D2A) && ((c) <= 0x0D39)) ||
- (((c) >= 0x0D60) && ((c) <= 0x0D61)) ||
- (((c) >= 0x0E01) && ((c) <= 0x0E2E)) ||
- ((c) == 0x0E30) ||
- (((c) >= 0x0E32) && ((c) <= 0x0E33)) ||
- (((c) >= 0x0E40) && ((c) <= 0x0E45)) ||
- (((c) >= 0x0E81) && ((c) <= 0x0E82)) ||
- ((c) == 0x0E84) ||
- (((c) >= 0x0E87) && ((c) <= 0x0E88)) ||
- ((c) == 0x0E8A) ||
- ((c) == 0x0E8D) ||
- (((c) >= 0x0E94) && ((c) <= 0x0E97)) ||
- (((c) >= 0x0E99) && ((c) <= 0x0E9F)) ||
- (((c) >= 0x0EA1) && ((c) <= 0x0EA3)) ||
- ((c) == 0x0EA5) ||
- ((c) == 0x0EA7) ||
- (((c) >= 0x0EAA) && ((c) <= 0x0EAB)) ||
- (((c) >= 0x0EAD) && ((c) <= 0x0EAE)) ||
- ((c) == 0x0EB0) ||
- (((c) >= 0x0EB2) && ((c) <= 0x0EB3)) ||
- ((c) == 0x0EBD) ||
- (((c) >= 0x0EC0) && ((c) <= 0x0EC4)) ||
- (((c) >= 0x0F40) && ((c) <= 0x0F47)) ||
- (((c) >= 0x0F49) && ((c) <= 0x0F69)) ||
- (((c) >= 0x10A0) && ( /* accelerator */
- (((c) >= 0x10A0) && ((c) <= 0x10C5)) ||
- (((c) >= 0x10D0) && ((c) <= 0x10F6)) ||
- ((c) == 0x1100) ||
- (((c) >= 0x1102) && ((c) <= 0x1103)) ||
- (((c) >= 0x1105) && ((c) <= 0x1107)) ||
- ((c) == 0x1109) ||
- (((c) >= 0x110B) && ((c) <= 0x110C)) ||
- (((c) >= 0x110E) && ((c) <= 0x1112)) ||
- ((c) == 0x113C) ||
- ((c) == 0x113E) ||
- ((c) == 0x1140) ||
- ((c) == 0x114C) ||
- ((c) == 0x114E) ||
- ((c) == 0x1150) ||
- (((c) >= 0x1154) && ((c) <= 0x1155)) ||
- ((c) == 0x1159) ||
- (((c) >= 0x115F) && ((c) <= 0x1161)) ||
- ((c) == 0x1163) ||
- ((c) == 0x1165) ||
- ((c) == 0x1167) ||
- ((c) == 0x1169) ||
- (((c) >= 0x116D) && ((c) <= 0x116E)) ||
- (((c) >= 0x1172) && ((c) <= 0x1173)) ||
- ((c) == 0x1175) ||
- ((c) == 0x119E) ||
- ((c) == 0x11A8) ||
- ((c) == 0x11AB) ||
- (((c) >= 0x11AE) && ((c) <= 0x11AF)) ||
- (((c) >= 0x11B7) && ((c) <= 0x11B8)) ||
- ((c) == 0x11BA) ||
- (((c) >= 0x11BC) && ((c) <= 0x11C2)) ||
- ((c) == 0x11EB) ||
- ((c) == 0x11F0) ||
- ((c) == 0x11F9) ||
- (((c) >= 0x1E00) && ((c) <= 0x1E9B)) ||
- (((c) >= 0x1EA0) && ((c) <= 0x1EF9)) ||
- (((c) >= 0x1F00) && ((c) <= 0x1F15)) ||
- (((c) >= 0x1F18) && ((c) <= 0x1F1D)) ||
- (((c) >= 0x1F20) && ((c) <= 0x1F45)) ||
- (((c) >= 0x1F48) && ((c) <= 0x1F4D)) ||
- (((c) >= 0x1F50) && ((c) <= 0x1F57)) ||
- ((c) == 0x1F59) ||
- ((c) == 0x1F5B) ||
- ((c) == 0x1F5D) ||
- (((c) >= 0x1F5F) && ((c) <= 0x1F7D)) ||
- (((c) >= 0x1F80) && ((c) <= 0x1FB4)) ||
- (((c) >= 0x1FB6) && ((c) <= 0x1FBC)) ||
- ((c) == 0x1FBE) ||
- (((c) >= 0x1FC2) && ((c) <= 0x1FC4)) ||
- (((c) >= 0x1FC6) && ((c) <= 0x1FCC)) ||
- (((c) >= 0x1FD0) && ((c) <= 0x1FD3)) ||
- (((c) >= 0x1FD6) && ((c) <= 0x1FDB)) ||
- (((c) >= 0x1FE0) && ((c) <= 0x1FEC)) ||
- (((c) >= 0x1FF2) && ((c) <= 0x1FF4)) ||
- (((c) >= 0x1FF6) && ((c) <= 0x1FFC)) ||
- ((c) == 0x2126) ||
- (((c) >= 0x212A) && ((c) <= 0x212B)) ||
- ((c) == 0x212E) ||
- (((c) >= 0x2180) && ((c) <= 0x2182)) ||
- (((c) >= 0x3041) && ((c) <= 0x3094)) ||
- (((c) >= 0x30A1) && ((c) <= 0x30FA)) ||
- (((c) >= 0x3105) && ((c) <= 0x312C)) ||
- (((c) >= 0xAC00) && ((c) <= 0xD7A3))) /* accelerators */ ))))));
-}
-
-/**
- * xmlIsDigit:
- * @c: an unicode character (int)
- *
- * Check whether the character is allowed by the production
- * [88] Digit ::= ... long list see REC ...
- *
- * Returns 0 if not, non-zero otherwise
- */
-int
-xmlIsDigit(int c) {
- return(
- (((c) >= 0x0030) && ((c) <= 0x0039)) ||
- (((c) >= 0x660) && ( /* accelerator */
- (((c) >= 0x0660) && ((c) <= 0x0669)) ||
- (((c) >= 0x06F0) && ((c) <= 0x06F9)) ||
- (((c) >= 0x0966) && ((c) <= 0x096F)) ||
- (((c) >= 0x09E6) && ((c) <= 0x09EF)) ||
- (((c) >= 0x0A66) && ((c) <= 0x0A6F)) ||
- (((c) >= 0x0AE6) && ((c) <= 0x0AEF)) ||
- (((c) >= 0x0B66) && ((c) <= 0x0B6F)) ||
- (((c) >= 0x0BE7) && ((c) <= 0x0BEF)) ||
- (((c) >= 0x0C66) && ((c) <= 0x0C6F)) ||
- (((c) >= 0x0CE6) && ((c) <= 0x0CEF)) ||
- (((c) >= 0x0D66) && ((c) <= 0x0D6F)) ||
- (((c) >= 0x0E50) && ((c) <= 0x0E59)) ||
- (((c) >= 0x0ED0) && ((c) <= 0x0ED9)) ||
- (((c) >= 0x0F20) && ((c) <= 0x0F29))) /* accelerator */ ));
-}
-
-/**
- * xmlIsCombining:
- * @c: an unicode character (int)
- *
- * Check whether the character is allowed by the production
- * [87] CombiningChar ::= ... long list see REC ...
- *
- * Returns 0 if not, non-zero otherwise
- */
-int
-xmlIsCombining(int c) {
- return(
- (((c) >= 0x300) && ( /* accelerator */
- (((c) >= 0x0300) && ((c) <= 0x0345)) ||
- (((c) >= 0x0360) && ((c) <= 0x0361)) ||
- (((c) >= 0x0483) && ((c) <= 0x0486)) ||
- (((c) >= 0x0591) && ((c) <= 0x05A1)) ||
- (((c) >= 0x05A3) && ((c) <= 0x05B9)) ||
- (((c) >= 0x05BB) && ((c) <= 0x05BD)) ||
- ((c) == 0x05BF) ||
- (((c) >= 0x05C1) && ((c) <= 0x05C2)) ||
- ((c) == 0x05C4) ||
- (((c) >= 0x064B) && ((c) <= 0x0652)) ||
- ((c) == 0x0670) ||
- (((c) >= 0x06D6) && ((c) <= 0x06DC)) ||
- (((c) >= 0x06DD) && ((c) <= 0x06DF)) ||
- (((c) >= 0x06E0) && ((c) <= 0x06E4)) ||
- (((c) >= 0x06E7) && ((c) <= 0x06E8)) ||
- (((c) >= 0x06EA) && ((c) <= 0x06ED)) ||
- (((c) >= 0x0901) && ( /* accelerator */
- (((c) >= 0x0901) && ((c) <= 0x0903)) ||
- ((c) == 0x093C) ||
- (((c) >= 0x093E) && ((c) <= 0x094C)) ||
- ((c) == 0x094D) ||
- (((c) >= 0x0951) && ((c) <= 0x0954)) ||
- (((c) >= 0x0962) && ((c) <= 0x0963)) ||
- (((c) >= 0x0981) && ((c) <= 0x0983)) ||
- ((c) == 0x09BC) ||
- ((c) == 0x09BE) ||
- ((c) == 0x09BF) ||
- (((c) >= 0x09C0) && ((c) <= 0x09C4)) ||
- (((c) >= 0x09C7) && ((c) <= 0x09C8)) ||
- (((c) >= 0x09CB) && ((c) <= 0x09CD)) ||
- ((c) == 0x09D7) ||
- (((c) >= 0x09E2) && ((c) <= 0x09E3)) ||
- (((c) >= 0x0A02) && ( /* accelerator */
- ((c) == 0x0A02) ||
- ((c) == 0x0A3C) ||
- ((c) == 0x0A3E) ||
- ((c) == 0x0A3F) ||
- (((c) >= 0x0A40) && ((c) <= 0x0A42)) ||
- (((c) >= 0x0A47) && ((c) <= 0x0A48)) ||
- (((c) >= 0x0A4B) && ((c) <= 0x0A4D)) ||
- (((c) >= 0x0A70) && ((c) <= 0x0A71)) ||
- (((c) >= 0x0A81) && ((c) <= 0x0A83)) ||
- ((c) == 0x0ABC) ||
- (((c) >= 0x0ABE) && ((c) <= 0x0AC5)) ||
- (((c) >= 0x0AC7) && ((c) <= 0x0AC9)) ||
- (((c) >= 0x0ACB) && ((c) <= 0x0ACD)) ||
- (((c) >= 0x0B01) && ((c) <= 0x0B03)) ||
- ((c) == 0x0B3C) ||
- (((c) >= 0x0B3E) && ((c) <= 0x0B43)) ||
- (((c) >= 0x0B47) && ((c) <= 0x0B48)) ||
- (((c) >= 0x0B4B) && ((c) <= 0x0B4D)) ||
- (((c) >= 0x0B56) && ((c) <= 0x0B57)) ||
- (((c) >= 0x0B82) && ((c) <= 0x0B83)) ||
- (((c) >= 0x0BBE) && ((c) <= 0x0BC2)) ||
- (((c) >= 0x0BC6) && ((c) <= 0x0BC8)) ||
- (((c) >= 0x0BCA) && ((c) <= 0x0BCD)) ||
- ((c) == 0x0BD7) ||
- (((c) >= 0x0C01) && ((c) <= 0x0C03)) ||
- (((c) >= 0x0C3E) && ((c) <= 0x0C44)) ||
- (((c) >= 0x0C46) && ((c) <= 0x0C48)) ||
- (((c) >= 0x0C4A) && ((c) <= 0x0C4D)) ||
- (((c) >= 0x0C55) && ((c) <= 0x0C56)) ||
- (((c) >= 0x0C82) && ((c) <= 0x0C83)) ||
- (((c) >= 0x0CBE) && ((c) <= 0x0CC4)) ||
- (((c) >= 0x0CC6) && ((c) <= 0x0CC8)) ||
- (((c) >= 0x0CCA) && ((c) <= 0x0CCD)) ||
- (((c) >= 0x0CD5) && ((c) <= 0x0CD6)) ||
- (((c) >= 0x0D02) && ((c) <= 0x0D03)) ||
- (((c) >= 0x0D3E) && ((c) <= 0x0D43)) ||
- (((c) >= 0x0D46) && ((c) <= 0x0D48)) ||
- (((c) >= 0x0D4A) && ((c) <= 0x0D4D)) ||
- ((c) == 0x0D57) ||
- (((c) >= 0x0E31) && ( /* accelerator */
- ((c) == 0x0E31) ||
- (((c) >= 0x0E34) && ((c) <= 0x0E3A)) ||
- (((c) >= 0x0E47) && ((c) <= 0x0E4E)) ||
- ((c) == 0x0EB1) ||
- (((c) >= 0x0EB4) && ((c) <= 0x0EB9)) ||
- (((c) >= 0x0EBB) && ((c) <= 0x0EBC)) ||
- (((c) >= 0x0EC8) && ((c) <= 0x0ECD)) ||
- (((c) >= 0x0F18) && ((c) <= 0x0F19)) ||
- ((c) == 0x0F35) ||
- ((c) == 0x0F37) ||
- ((c) == 0x0F39) ||
- ((c) == 0x0F3E) ||
- ((c) == 0x0F3F) ||
- (((c) >= 0x0F71) && ((c) <= 0x0F84)) ||
- (((c) >= 0x0F86) && ((c) <= 0x0F8B)) ||
- (((c) >= 0x0F90) && ((c) <= 0x0F95)) ||
- ((c) == 0x0F97) ||
- (((c) >= 0x0F99) && ((c) <= 0x0FAD)) ||
- (((c) >= 0x0FB1) && ((c) <= 0x0FB7)) ||
- ((c) == 0x0FB9) ||
- (((c) >= 0x20D0) && ((c) <= 0x20DC)) ||
- ((c) == 0x20E1) ||
- (((c) >= 0x302A) && ((c) <= 0x302F)) ||
- ((c) == 0x3099) ||
- ((c) == 0x309A))))))))));
-}
-
-/**
- * xmlIsExtender:
- * @c: an unicode character (int)
- *
- * Check whether the character is allowed by the production
- * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
- * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
- * [#x309D-#x309E] | [#x30FC-#x30FE]
- *
- * Returns 0 if not, non-zero otherwise
- */
-int
-xmlIsExtender(int c) {
- switch (c) {
- case 0x00B7: case 0x02D0: case 0x02D1: case 0x0387:
- case 0x0640: case 0x0E46: case 0x0EC6: case 0x3005:
- case 0x3031: case 0x3032: case 0x3033: case 0x3034:
- case 0x3035: case 0x309D: case 0x309E: case 0x30FC:
- case 0x30FD: case 0x30FE:
- return 1;
- default:
- return 0;
- }
-}
-
-/**
- * xmlIsIdeographic:
- * @c: an unicode character (int)
- *
- * Check whether the character is allowed by the production
- * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
- *
- * Returns 0 if not, non-zero otherwise
- */
-int
-xmlIsIdeographic(int c) {
- return(((c) < 0x0100) ? 0 :
- (((c) >= 0x4e00) && ((c) <= 0x9fa5)) ||
- (((c) >= 0xf900) && ((c) <= 0xfa2d)) ||
- (((c) >= 0x3021) && ((c) <= 0x3029)) ||
- ((c) == 0x3007));
-}
-
-/**
- * xmlIsLetter:
- * @c: an unicode character (int)
- *
- * Check whether the character is allowed by the production
- * [84] Letter ::= BaseChar | Ideographic
- *
- * Returns 0 if not, non-zero otherwise
- */
-int
-xmlIsLetter(int c) {
- return(IS_BASECHAR(c) || IS_IDEOGRAPHIC(c));
-}
-
-/**
- * xmlIsPubidChar:
- * @c: an unicode character (int)
- *
- * Check whether the character is allowed by the production
- * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
- *
- * Returns 0 if not, non-zero otherwise
- */
-int
-xmlIsPubidChar(int c) {
- return(
- ((c) == 0x20) || ((c) == 0x0D) || ((c) == 0x0A) ||
- (((c) >= 'a') && ((c) <= 'z')) ||
- (((c) >= 'A') && ((c) <= 'Z')) ||
- (((c) >= '0') && ((c) <= '9')) ||
- ((c) == '-') || ((c) == '\'') || ((c) == '(') || ((c) == ')') ||
- ((c) == '+') || ((c) == ',') || ((c) == '.') || ((c) == '/') ||
- ((c) == ':') || ((c) == '=') || ((c) == '?') || ((c) == ';') ||
- ((c) == '!') || ((c) == '*') || ((c) == '#') || ((c) == '@') ||
- ((c) == '$') || ((c) == '_') || ((c) == '%'));
-}
-
-/************************************************************************
- * *
- * Input handling functions for progressive parsing *
- * *
- ************************************************************************/
-
-/* #define DEBUG_INPUT */
-/* #define DEBUG_STACK */
-/* #define DEBUG_PUSH */
-
-
-/* we need to keep enough input to show errors in context */
-#define LINE_LEN 80
-
-#ifdef DEBUG_INPUT
-#define CHECK_BUFFER(in) check_buffer(in)
-
-static
-void check_buffer(xmlParserInputPtr in) {
- if (in->base != in->buf->buffer->content) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParserInput: base mismatch problem\n");
- }
- if (in->cur < in->base) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParserInput: cur < base problem\n");
- }
- if (in->cur > in->base + in->buf->buffer->use) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParserInput: cur > base + use problem\n");
- }
- xmlGenericError(xmlGenericErrorContext,"buffer %x : content %x, cur %d, use %d, size %d\n",
- (int) in, (int) in->buf->buffer->content, in->cur - in->base,
- in->buf->buffer->use, in->buf->buffer->size);
-}
-
-#else
-#define CHECK_BUFFER(in)
-#endif
-
-
-/**
- * xmlParserInputRead:
- * @in: an XML parser input
- * @len: an indicative size for the lookahead
- *
- * This function refresh the input for the parser. It doesn't try to
- * preserve pointers to the input buffer, and discard already read data
- *
- * Returns the number of xmlChars read, or -1 in case of error, 0 indicate the
- * end of this entity
- */
-int
-xmlParserInputRead(xmlParserInputPtr in, int len) {
- int ret;
- int used;
- int indx;
-
-#ifdef DEBUG_INPUT
- xmlGenericError(xmlGenericErrorContext, "Read\n");
-#endif
- if (in->buf == NULL) return(-1);
- if (in->base == NULL) return(-1);
- if (in->cur == NULL) return(-1);
- if (in->buf->buffer == NULL) return(-1);
- if (in->buf->readcallback == NULL) return(-1);
-
- CHECK_BUFFER(in);
-
- used = in->cur - in->buf->buffer->content;
- ret = xmlBufferShrink(in->buf->buffer, used);
- if (ret > 0) {
- in->cur -= ret;
- in->consumed += ret;
- }
- ret = xmlParserInputBufferRead(in->buf, len);
- if (in->base != in->buf->buffer->content) {
- /*
- * the buffer has been reallocated
- */
- indx = in->cur - in->base;
- in->base = in->buf->buffer->content;
- in->cur = &in->buf->buffer->content[indx];
- }
- in->end = &in->buf->buffer->content[in->buf->buffer->use];
-
- CHECK_BUFFER(in);
-
- return(ret);
-}
-
-/**
- * xmlParserInputGrow:
- * @in: an XML parser input
- * @len: an indicative size for the lookahead
- *
- * This function increase the input for the parser. It tries to
- * preserve pointers to the input buffer, and keep already read data
- *
- * Returns the number of xmlChars read, or -1 in case of error, 0 indicate the
- * end of this entity
- */
-int
-xmlParserInputGrow(xmlParserInputPtr in, int len) {
- int ret;
- int indx;
-
-#ifdef DEBUG_INPUT
- xmlGenericError(xmlGenericErrorContext, "Grow\n");
-#endif
- if (in->buf == NULL) return(-1);
- if (in->base == NULL) return(-1);
- if (in->cur == NULL) return(-1);
- if (in->buf->buffer == NULL) return(-1);
-
- CHECK_BUFFER(in);
-
- indx = in->cur - in->base;
- if (in->buf->buffer->use > (unsigned int) indx + INPUT_CHUNK) {
-
- CHECK_BUFFER(in);
-
- return(0);
- }
- if (in->buf->readcallback != NULL)
- ret = xmlParserInputBufferGrow(in->buf, len);
- else
- return(0);
-
- /*
- * NOTE : in->base may be a "dangling" i.e. freed pointer in this
- * block, but we use it really as an integer to do some
- * pointer arithmetic. Insure will raise it as a bug but in
- * that specific case, that's not !
- */
- if (in->base != in->buf->buffer->content) {
- /*
- * the buffer has been reallocated
- */
- indx = in->cur - in->base;
- in->base = in->buf->buffer->content;
- in->cur = &in->buf->buffer->content[indx];
- }
- in->end = &in->buf->buffer->content[in->buf->buffer->use];
-
- CHECK_BUFFER(in);
-
- return(ret);
-}
-
-/**
- * xmlParserInputShrink:
- * @in: an XML parser input
- *
- * This function removes used input for the parser.
- */
-void
-xmlParserInputShrink(xmlParserInputPtr in) {
- int used;
- int ret;
- int indx;
-
-#ifdef DEBUG_INPUT
- xmlGenericError(xmlGenericErrorContext, "Shrink\n");
-#endif
- if (in->buf == NULL) return;
- if (in->base == NULL) return;
- if (in->cur == NULL) return;
- if (in->buf->buffer == NULL) return;
-
- CHECK_BUFFER(in);
-
- used = in->cur - in->buf->buffer->content;
- /*
- * Do not shrink on large buffers whose only a tiny fraction
- * was consumed
- */
- if ((int) in->buf->buffer->use > used + 2 * INPUT_CHUNK)
- return;
- if (used > INPUT_CHUNK) {
- ret = xmlBufferShrink(in->buf->buffer, used - LINE_LEN);
- if (ret > 0) {
- in->cur -= ret;
- in->consumed += ret;
- }
- in->end = &in->buf->buffer->content[in->buf->buffer->use];
- }
-
- CHECK_BUFFER(in);
-
- if (in->buf->buffer->use > INPUT_CHUNK) {
- return;
- }
- xmlParserInputBufferRead(in->buf, 2 * INPUT_CHUNK);
- if (in->base != in->buf->buffer->content) {
- /*
- * the buffer has been reallocated
- */
- indx = in->cur - in->base;
- in->base = in->buf->buffer->content;
- in->cur = &in->buf->buffer->content[indx];
- }
- in->end = &in->buf->buffer->content[in->buf->buffer->use];
-
- CHECK_BUFFER(in);
-}
-
-/************************************************************************
- * *
- * UTF8 character input and related functions *
- * *
- ************************************************************************/
-
-/**
- * xmlNextChar:
- * @ctxt: the XML parser context
- *
- * Skip to the next char input char.
- */
-
-void
-xmlNextChar(xmlParserCtxtPtr ctxt) {
- if (ctxt->instate == XML_PARSER_EOF)
- return;
-
- /*
- * 2.11 End-of-Line Handling
- * the literal two-character sequence "#xD#xA" or a standalone
- * literal #xD, an XML processor must pass to the application
- * the single character #xA.
- */
- if (ctxt->charset == XML_CHAR_ENCODING_UTF8) {
- if ((*ctxt->input->cur == 0) &&
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0) &&
- (ctxt->instate != XML_PARSER_COMMENT)) {
- /*
- * If we are at the end of the current entity and
- * the context allows it, we pop consumed entities
- * automatically.
- * the auto closing should be blocked in other cases
- */
- xmlPopInput(ctxt);
- } else {
- if (*(ctxt->input->cur) == '\n') {
- ctxt->input->line++; ctxt->input->col = 1;
- } else ctxt->input->col++;
- if (ctxt->charset == XML_CHAR_ENCODING_UTF8) {
- /*
- * We are supposed to handle UTF8, check it's valid
- * From rfc2044: encoding of the Unicode values on UTF-8:
- *
- * UCS-4 range (hex.) UTF-8 octet sequence (binary)
- * 0000 0000-0000 007F 0xxxxxxx
- * 0000 0080-0000 07FF 110xxxxx 10xxxxxx
- * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx
- *
- * Check for the 0x110000 limit too
- */
- const unsigned char *cur = ctxt->input->cur;
- unsigned char c;
-
- c = *cur;
- if (c & 0x80) {
- if (cur[1] == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- if ((cur[1] & 0xc0) != 0x80)
- goto encoding_error;
- if ((c & 0xe0) == 0xe0) {
- unsigned int val;
-
- if (cur[2] == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- if ((cur[2] & 0xc0) != 0x80)
- goto encoding_error;
- if ((c & 0xf0) == 0xf0) {
- if (cur[3] == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- if (((c & 0xf8) != 0xf0) ||
- ((cur[3] & 0xc0) != 0x80))
- goto encoding_error;
- /* 4-byte code */
- ctxt->input->cur += 4;
- val = (cur[0] & 0x7) << 18;
- val |= (cur[1] & 0x3f) << 12;
- val |= (cur[2] & 0x3f) << 6;
- val |= cur[3] & 0x3f;
- } else {
- /* 3-byte code */
- ctxt->input->cur += 3;
- val = (cur[0] & 0xf) << 12;
- val |= (cur[1] & 0x3f) << 6;
- val |= cur[2] & 0x3f;
- }
- if (((val > 0xd7ff) && (val < 0xe000)) ||
- ((val > 0xfffd) && (val < 0x10000)) ||
- (val >= 0x110000)) {
- if ((ctxt->sax != NULL) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Char 0x%X out of allowed range\n", val);
- ctxt->errNo = XML_ERR_INVALID_ENCODING;
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- } else
- /* 2-byte code */
- ctxt->input->cur += 2;
- } else
- /* 1-byte code */
- ctxt->input->cur++;
- } else {
- /*
- * Assume it's a fixed length encoding (1) with
- * a compatible encoding for the ASCII set, since
- * XML constructs only use < 128 chars
- */
- ctxt->input->cur++;
- }
- ctxt->nbChars++;
- if (*ctxt->input->cur == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- }
- } else {
- ctxt->input->cur++;
- ctxt->nbChars++;
- if (*ctxt->input->cur == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- }
- if ((*ctxt->input->cur == '%') && (!ctxt->html))
- xmlParserHandlePEReference(ctxt);
- if ((*ctxt->input->cur == 0) &&
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0))
- xmlPopInput(ctxt);
- return;
-encoding_error:
- /*
- * If we detect an UTF8 error that probably mean that the
- * input encoding didn't get properly advertised in the
- * declaration header. Report the error and switch the encoding
- * to ISO-Latin-1 (if you don't like this policy, just declare the
- * encoding !)
- */
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) {
- ctxt->sax->error(ctxt->userData,
- "Input is not proper UTF-8, indicate encoding !\n");
- ctxt->sax->error(ctxt->userData, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
- ctxt->input->cur[0], ctxt->input->cur[1],
- ctxt->input->cur[2], ctxt->input->cur[3]);
- }
- ctxt->wellFormed = 0;
- ctxt->errNo = XML_ERR_INVALID_ENCODING;
-
- ctxt->charset = XML_CHAR_ENCODING_8859_1;
- ctxt->input->cur++;
- return;
-}
-
-/**
- * xmlCurrentChar:
- * @ctxt: the XML parser context
- * @len: pointer to the length of the char read
- *
- * The current char value, if using UTF-8 this may actually span multiple
- * bytes in the input buffer. Implement the end of line normalization:
- * 2.11 End-of-Line Handling
- * Wherever an external parsed entity or the literal entity value
- * of an internal parsed entity contains either the literal two-character
- * sequence "#xD#xA" or a standalone literal #xD, an XML processor
- * must pass to the application the single character #xA.
- * This behavior can conveniently be produced by normalizing all
- * line breaks to #xA on input, before parsing.)
- *
- * Returns the current char value and its length
- */
-
-int
-xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
- if (ctxt->instate == XML_PARSER_EOF)
- return(0);
-
- if ((*ctxt->input->cur >= 0x20) && (*ctxt->input->cur <= 0x7F)) {
- *len = 1;
- return((int) *ctxt->input->cur);
- }
- if (ctxt->charset == XML_CHAR_ENCODING_UTF8) {
- /*
- * We are supposed to handle UTF8, check it's valid
- * From rfc2044: encoding of the Unicode values on UTF-8:
- *
- * UCS-4 range (hex.) UTF-8 octet sequence (binary)
- * 0000 0000-0000 007F 0xxxxxxx
- * 0000 0080-0000 07FF 110xxxxx 10xxxxxx
- * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx
- *
- * Check for the 0x110000 limit too
- */
- const unsigned char *cur = ctxt->input->cur;
- unsigned char c;
- unsigned int val;
-
- c = *cur;
- if (c & 0x80) {
- if (cur[1] == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- if ((cur[1] & 0xc0) != 0x80)
- goto encoding_error;
- if ((c & 0xe0) == 0xe0) {
-
- if (cur[2] == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- if ((cur[2] & 0xc0) != 0x80)
- goto encoding_error;
- if ((c & 0xf0) == 0xf0) {
- if (cur[3] == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- if (((c & 0xf8) != 0xf0) ||
- ((cur[3] & 0xc0) != 0x80))
- goto encoding_error;
- /* 4-byte code */
- *len = 4;
- val = (cur[0] & 0x7) << 18;
- val |= (cur[1] & 0x3f) << 12;
- val |= (cur[2] & 0x3f) << 6;
- val |= cur[3] & 0x3f;
- } else {
- /* 3-byte code */
- *len = 3;
- val = (cur[0] & 0xf) << 12;
- val |= (cur[1] & 0x3f) << 6;
- val |= cur[2] & 0x3f;
- }
- } else {
- /* 2-byte code */
- *len = 2;
- val = (cur[0] & 0x1f) << 6;
- val |= cur[1] & 0x3f;
- }
- if (!IS_CHAR(val)) {
- if ((ctxt->sax != NULL) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Char 0x%X out of allowed range\n", val);
- ctxt->errNo = XML_ERR_INVALID_ENCODING;
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- return(val);
- } else {
- /* 1-byte code */
- *len = 1;
- if (*ctxt->input->cur == 0xD) {
- if (ctxt->input->cur[1] == 0xA) {
- ctxt->nbChars++;
- ctxt->input->cur++;
- }
- return(0xA);
- }
- return((int) *ctxt->input->cur);
- }
- }
- /*
- * Assume it's a fixed length encoding (1) with
- * a compatible encoding for the ASCII set, since
- * XML constructs only use < 128 chars
- */
- *len = 1;
- if (*ctxt->input->cur == 0xD) {
- if (ctxt->input->cur[1] == 0xA) {
- ctxt->nbChars++;
- ctxt->input->cur++;
- }
- return(0xA);
- }
- return((int) *ctxt->input->cur);
-encoding_error:
- /*
- * An encoding problem may arise from a truncated input buffer
- * splitting a character in the middle. In that case do not raise
- * an error but return 0 to endicate an end of stream problem
- */
- if (ctxt->input->end - ctxt->input->cur < 4) {
- *len = 0;
- return(0);
- }
-
- /*
- * If we detect an UTF8 error that probably mean that the
- * input encoding didn't get properly advertised in the
- * declaration header. Report the error and switch the encoding
- * to ISO-Latin-1 (if you don't like this policy, just declare the
- * encoding !)
- */
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) {
- ctxt->sax->error(ctxt->userData,
- "Input is not proper UTF-8, indicate encoding !\n");
- ctxt->sax->error(ctxt->userData, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
- ctxt->input->cur[0], ctxt->input->cur[1],
- ctxt->input->cur[2], ctxt->input->cur[3]);
- }
- ctxt->wellFormed = 0;
- ctxt->errNo = XML_ERR_INVALID_ENCODING;
-
- ctxt->charset = XML_CHAR_ENCODING_8859_1;
- *len = 1;
- return((int) *ctxt->input->cur);
-}
-
-/**
- * xmlStringCurrentChar:
- * @ctxt: the XML parser context
- * @cur: pointer to the beginning of the char
- * @len: pointer to the length of the char read
- *
- * The current char value, if using UTF-8 this may actually span multiple
- * bytes in the input buffer.
- *
- * Returns the current char value and its length
- */
-
-int
-xmlStringCurrentChar(xmlParserCtxtPtr ctxt, const xmlChar * cur, int *len)
-{
- if ((ctxt == NULL) || (ctxt->charset == XML_CHAR_ENCODING_UTF8)) {
- /*
- * We are supposed to handle UTF8, check it's valid
- * From rfc2044: encoding of the Unicode values on UTF-8:
- *
- * UCS-4 range (hex.) UTF-8 octet sequence (binary)
- * 0000 0000-0000 007F 0xxxxxxx
- * 0000 0080-0000 07FF 110xxxxx 10xxxxxx
- * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx
- *
- * Check for the 0x110000 limit too
- */
- unsigned char c;
- unsigned int val;
-
- c = *cur;
- if (c & 0x80) {
- if ((cur[1] & 0xc0) != 0x80)
- goto encoding_error;
- if ((c & 0xe0) == 0xe0) {
-
- if ((cur[2] & 0xc0) != 0x80)
- goto encoding_error;
- if ((c & 0xf0) == 0xf0) {
- if (((c & 0xf8) != 0xf0) || ((cur[3] & 0xc0) != 0x80))
- goto encoding_error;
- /* 4-byte code */
- *len = 4;
- val = (cur[0] & 0x7) << 18;
- val |= (cur[1] & 0x3f) << 12;
- val |= (cur[2] & 0x3f) << 6;
- val |= cur[3] & 0x3f;
- } else {
- /* 3-byte code */
- *len = 3;
- val = (cur[0] & 0xf) << 12;
- val |= (cur[1] & 0x3f) << 6;
- val |= cur[2] & 0x3f;
- }
- } else {
- /* 2-byte code */
- *len = 2;
- val = (cur[0] & 0x1f) << 6;
- val |= cur[1] & 0x3f;
- }
- if (!IS_CHAR(val)) {
- if ((ctxt != NULL) && (ctxt->sax != NULL) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Char 0x%X out of allowed range\n",
- val);
- if (ctxt != NULL) {
- ctxt->errNo = XML_ERR_INVALID_ENCODING;
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- }
- }
- return (val);
- } else {
- /* 1-byte code */
- *len = 1;
- return ((int) *cur);
- }
- }
- /*
- * Assume it's a fixed length encoding (1) with
- * a compatible encoding for the ASCII set, since
- * XML constructs only use < 128 chars
- */
- *len = 1;
- return ((int) *cur);
-encoding_error:
-
- /*
- * If we detect an UTF8 error that probably mean that the
- * input encoding didn't get properly advertised in the
- * declaration header. Report the error and switch the encoding
- * to ISO-Latin-1 (if you don't like this policy, just declare the
- * encoding !)
- */
- if (ctxt != NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) {
- ctxt->sax->error(ctxt->userData,
- "Input is not proper UTF-8, indicate encoding !\n");
- ctxt->sax->error(ctxt->userData,
- "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
- ctxt->input->cur[0], ctxt->input->cur[1],
- ctxt->input->cur[2], ctxt->input->cur[3]);
- }
- ctxt->errNo = XML_ERR_INVALID_ENCODING;
- ctxt->wellFormed = 0;
- }
-
- *len = 1;
- return ((int) *cur);
-}
-
-/**
- * xmlCopyCharMultiByte:
- * @out: pointer to an array of xmlChar
- * @val: the char value
- *
- * append the char value in the array
- *
- * Returns the number of xmlChar written
- */
-int
-xmlCopyCharMultiByte(xmlChar *out, int val) {
- /*
- * We are supposed to handle UTF8, check it's valid
- * From rfc2044: encoding of the Unicode values on UTF-8:
- *
- * UCS-4 range (hex.) UTF-8 octet sequence (binary)
- * 0000 0000-0000 007F 0xxxxxxx
- * 0000 0080-0000 07FF 110xxxxx 10xxxxxx
- * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx
- */
- if (val >= 0x80) {
- xmlChar *savedout = out;
- int bits;
- if (val < 0x800) { *out++= (val >> 6) | 0xC0; bits= 0; }
- else if (val < 0x10000) { *out++= (val >> 12) | 0xE0; bits= 6;}
- else if (val < 0x110000) { *out++= (val >> 18) | 0xF0; bits= 12; }
- else {
- xmlGenericError(xmlGenericErrorContext,
- "Internal error, xmlCopyCharMultiByte 0x%X out of bound\n",
- val);
- return(0);
- }
- for ( ; bits >= 0; bits-= 6)
- *out++= ((val >> bits) & 0x3F) | 0x80 ;
- return (out - savedout);
- }
- *out = (xmlChar) val;
- return 1;
-}
-
-/**
- * xmlCopyChar:
- * @len: Ignored, compatibility
- * @out: pointer to an array of xmlChar
- * @val: the char value
- *
- * append the char value in the array
- *
- * Returns the number of xmlChar written
- */
-
-int
-xmlCopyChar(int len ATTRIBUTE_UNUSED, xmlChar *out, int val) {
- /* the len parameter is ignored */
- if (val >= 0x80) {
- return(xmlCopyCharMultiByte (out, val));
- }
- *out = (xmlChar) val;
- return 1;
-}
-
-/************************************************************************
- * *
- * Commodity functions to switch encodings *
- * *
- ************************************************************************/
-
-/**
- * xmlSwitchEncoding:
- * @ctxt: the parser context
- * @enc: the encoding value (number)
- *
- * change the input functions when discovering the character encoding
- * of a given entity.
- *
- * Returns 0 in case of success, -1 otherwise
- */
-int
-xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
-{
- xmlCharEncodingHandlerPtr handler;
-
- switch (enc) {
- case XML_CHAR_ENCODING_ERROR:
- ctxt->errNo = XML_ERR_UNKNOWN_ENCODING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "encoding unknown\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- break;
- case XML_CHAR_ENCODING_NONE:
- /* let's assume it's UTF-8 without the XML decl */
- ctxt->charset = XML_CHAR_ENCODING_UTF8;
- return(0);
- case XML_CHAR_ENCODING_UTF8:
- /* default encoding, no conversion should be needed */
- ctxt->charset = XML_CHAR_ENCODING_UTF8;
-
- /*
- * Errata on XML-1.0 June 20 2001
- * Specific handling of the Byte Order Mark for
- * UTF-8
- */
- if ((ctxt->input != NULL) &&
- (ctxt->input->cur[0] == 0xEF) &&
- (ctxt->input->cur[1] == 0xBB) &&
- (ctxt->input->cur[2] == 0xBF)) {
- ctxt->input->cur += 3;
- }
- return(0);
- default:
- break;
- }
- handler = xmlGetCharEncodingHandler(enc);
- if (handler == NULL) {
- /*
- * Default handlers.
- */
- switch (enc) {
- case XML_CHAR_ENCODING_ERROR:
- ctxt->errNo = XML_ERR_UNKNOWN_ENCODING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "encoding unknown\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- ctxt->charset = XML_CHAR_ENCODING_UTF8;
- break;
- case XML_CHAR_ENCODING_NONE:
- /* let's assume it's UTF-8 without the XML decl */
- ctxt->charset = XML_CHAR_ENCODING_UTF8;
- return(0);
- case XML_CHAR_ENCODING_UTF8:
- case XML_CHAR_ENCODING_ASCII:
- /* default encoding, no conversion should be needed */
- ctxt->charset = XML_CHAR_ENCODING_UTF8;
- return(0);
- case XML_CHAR_ENCODING_UTF16LE:
- break;
- case XML_CHAR_ENCODING_UTF16BE:
- break;
- case XML_CHAR_ENCODING_UCS4LE:
- ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "char encoding USC4 little endian not supported\n");
- break;
- case XML_CHAR_ENCODING_UCS4BE:
- ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "char encoding USC4 big endian not supported\n");
- break;
- case XML_CHAR_ENCODING_EBCDIC:
- ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "char encoding EBCDIC not supported\n");
- break;
- case XML_CHAR_ENCODING_UCS4_2143:
- ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "char encoding UCS4 2143 not supported\n");
- break;
- case XML_CHAR_ENCODING_UCS4_3412:
- ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "char encoding UCS4 3412 not supported\n");
- break;
- case XML_CHAR_ENCODING_UCS2:
- ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "char encoding UCS2 not supported\n");
- break;
- case XML_CHAR_ENCODING_8859_1:
- case XML_CHAR_ENCODING_8859_2:
- case XML_CHAR_ENCODING_8859_3:
- case XML_CHAR_ENCODING_8859_4:
- case XML_CHAR_ENCODING_8859_5:
- case XML_CHAR_ENCODING_8859_6:
- case XML_CHAR_ENCODING_8859_7:
- case XML_CHAR_ENCODING_8859_8:
- case XML_CHAR_ENCODING_8859_9:
- /*
- * We used to keep the internal content in the
- * document encoding however this turns being unmaintainable
- * So xmlGetCharEncodingHandler() will return non-null
- * values for this now.
- */
- if ((ctxt->inputNr == 1) &&
- (ctxt->encoding == NULL) &&
- (ctxt->input->encoding != NULL)) {
- ctxt->encoding = xmlStrdup(ctxt->input->encoding);
- }
- ctxt->charset = enc;
- return(0);
- case XML_CHAR_ENCODING_2022_JP:
- ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "char encoding ISO-2022-JPnot supported\n");
- break;
- case XML_CHAR_ENCODING_SHIFT_JIS:
- ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "char encoding Shift_JIS not supported\n");
- break;
- case XML_CHAR_ENCODING_EUC_JP:
- ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "char encoding EUC-JPnot supported\n");
- break;
- }
- }
- if (handler == NULL)
- return(-1);
- ctxt->charset = XML_CHAR_ENCODING_UTF8;
- return(xmlSwitchToEncoding(ctxt, handler));
-}
-
-/**
- * xmlSwitchToEncoding:
- * @ctxt: the parser context
- * @handler: the encoding handler
- *
- * change the input functions when discovering the character encoding
- * of a given entity.
- *
- * Returns 0 in case of success, -1 otherwise
- */
-int
-xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
-{
- int nbchars;
-
- if (handler != NULL) {
- if (ctxt->input != NULL) {
- if (ctxt->input->buf != NULL) {
- if (ctxt->input->buf->encoder != NULL) {
- /*
- * Check in case the auto encoding detetection triggered
- * in already.
- */
- if (ctxt->input->buf->encoder == handler)
- return(0);
-
- /*
- * "UTF-16" can be used for both LE and BE
- */
- if ((!xmlStrncmp(BAD_CAST ctxt->input->buf->encoder->name,
- BAD_CAST "UTF-16", 6)) &&
- (!xmlStrncmp(BAD_CAST handler->name,
- BAD_CAST "UTF-16", 6))) {
- return(0);
- }
-
- /*
- * Note: this is a bit dangerous, but that's what it
- * takes to use nearly compatible signature for different
- * encodings.
- */
- xmlCharEncCloseFunc(ctxt->input->buf->encoder);
- ctxt->input->buf->encoder = handler;
- return(0);
- }
- ctxt->input->buf->encoder = handler;
-
- /*
- * Is there already some content down the pipe to convert ?
- */
- if ((ctxt->input->buf->buffer != NULL) &&
- (ctxt->input->buf->buffer->use > 0)) {
- int processed;
-
- /*
- * Specific handling of the Byte Order Mark for
- * UTF-16
- */
- if ((handler->name != NULL) &&
- (!strcmp(handler->name, "UTF-16LE")) &&
- (ctxt->input->cur[0] == 0xFF) &&
- (ctxt->input->cur[1] == 0xFE)) {
- ctxt->input->cur += 2;
- }
- if ((handler->name != NULL) &&
- (!strcmp(handler->name, "UTF-16BE")) &&
- (ctxt->input->cur[0] == 0xFE) &&
- (ctxt->input->cur[1] == 0xFF)) {
- ctxt->input->cur += 2;
- }
- /*
- * Errata on XML-1.0 June 20 2001
- * Specific handling of the Byte Order Mark for
- * UTF-8
- */
- if ((handler->name != NULL) &&
- (!strcmp(handler->name, "UTF-8")) &&
- (ctxt->input->cur[0] == 0xEF) &&
- (ctxt->input->cur[1] == 0xBB) &&
- (ctxt->input->cur[2] == 0xBF)) {
- ctxt->input->cur += 3;
- }
-
- /*
- * Shrink the current input buffer.
- * Move it as the raw buffer and create a new input buffer
- */
- processed = ctxt->input->cur - ctxt->input->base;
- xmlBufferShrink(ctxt->input->buf->buffer, processed);
- ctxt->input->buf->raw = ctxt->input->buf->buffer;
- ctxt->input->buf->buffer = xmlBufferCreate();
-
- if (ctxt->html) {
- /*
- * convert as much as possible of the buffer
- */
- nbchars = xmlCharEncInFunc(ctxt->input->buf->encoder,
- ctxt->input->buf->buffer,
- ctxt->input->buf->raw);
- } else {
- /*
- * convert just enough to get
- * '<?xml version="1.0" encoding="xxx"?>'
- * parsed with the autodetected encoding
- * into the parser reading buffer.
- */
- nbchars = xmlCharEncFirstLine(ctxt->input->buf->encoder,
- ctxt->input->buf->buffer,
- ctxt->input->buf->raw);
- }
- if (nbchars < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSwitchToEncoding: encoder error\n");
- return(-1);
- }
- ctxt->input->base =
- ctxt->input->cur = ctxt->input->buf->buffer->content;
- ctxt->input->end =
- &ctxt->input->base[ctxt->input->buf->buffer->use];
-
- }
- return(0);
- } else {
- if ((ctxt->input->length == 0) || (ctxt->input->buf == NULL)) {
- /*
- * When parsing a static memory array one must know the
- * size to be able to convert the buffer.
- */
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlSwitchToEncoding : no input\n");
- return(-1);
- } else {
- int processed;
-
- /*
- * Shrink the current input buffer.
- * Move it as the raw buffer and create a new input buffer
- */
- processed = ctxt->input->cur - ctxt->input->base;
-
- ctxt->input->buf->raw = xmlBufferCreate();
- xmlBufferAdd(ctxt->input->buf->raw, ctxt->input->cur,
- ctxt->input->length - processed);
- ctxt->input->buf->buffer = xmlBufferCreate();
-
- /*
- * convert as much as possible of the raw input
- * to the parser reading buffer.
- */
- nbchars = xmlCharEncInFunc(ctxt->input->buf->encoder,
- ctxt->input->buf->buffer,
- ctxt->input->buf->raw);
- if (nbchars < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSwitchToEncoding: encoder error\n");
- return(-1);
- }
-
- /*
- * Conversion succeeded, get rid of the old buffer
- */
- if ((ctxt->input->free != NULL) &&
- (ctxt->input->base != NULL))
- ctxt->input->free((xmlChar *) ctxt->input->base);
- ctxt->input->base =
- ctxt->input->cur = ctxt->input->buf->buffer->content;
- ctxt->input->end =
- &ctxt->input->base[ctxt->input->buf->buffer->use];
- }
- }
- } else {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlSwitchToEncoding : no input\n");
- return(-1);
- }
- /*
- * The parsing is now done in UTF8 natively
- */
- ctxt->charset = XML_CHAR_ENCODING_UTF8;
- } else
- return(-1);
- return(0);
-
-}
-
-/************************************************************************
- * *
- * Commodity functions to handle entities processing *
- * *
- ************************************************************************/
-
-/**
- * xmlFreeInputStream:
- * @input: an xmlParserInputPtr
- *
- * Free up an input stream.
- */
-void
-xmlFreeInputStream(xmlParserInputPtr input) {
- if (input == NULL) return;
-
- if (input->filename != NULL) xmlFree((char *) input->filename);
- if (input->directory != NULL) xmlFree((char *) input->directory);
- if (input->encoding != NULL) xmlFree((char *) input->encoding);
- if (input->version != NULL) xmlFree((char *) input->version);
- if ((input->free != NULL) && (input->base != NULL))
- input->free((xmlChar *) input->base);
- if (input->buf != NULL)
- xmlFreeParserInputBuffer(input->buf);
- xmlFree(input);
-}
-
-/**
- * xmlNewInputStream:
- * @ctxt: an XML parser context
- *
- * Create a new input stream structure
- * Returns the new input stream or NULL
- */
-xmlParserInputPtr
-xmlNewInputStream(xmlParserCtxtPtr ctxt) {
- xmlParserInputPtr input;
-
- input = (xmlParserInputPtr) xmlMalloc(sizeof(xmlParserInput));
- if (input == NULL) {
- if (ctxt != NULL) {
- ctxt->errNo = XML_ERR_NO_MEMORY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "malloc: couldn't allocate a new input stream\n");
- ctxt->errNo = XML_ERR_NO_MEMORY;
- }
- return(NULL);
- }
- memset(input, 0, sizeof(xmlParserInput));
- input->line = 1;
- input->col = 1;
- input->standalone = -1;
- return(input);
-}
-
-/**
- * xmlNewIOInputStream:
- * @ctxt: an XML parser context
- * @input: an I/O Input
- * @enc: the charset encoding if known
- *
- * Create a new input stream structure encapsulating the @input into
- * a stream suitable for the parser.
- *
- * Returns the new input stream or NULL
- */
-xmlParserInputPtr
-xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input,
- xmlCharEncoding enc) {
- xmlParserInputPtr inputStream;
-
- if (xmlParserDebugEntities)
- xmlGenericError(xmlGenericErrorContext, "new input from I/O\n");
- inputStream = xmlNewInputStream(ctxt);
- if (inputStream == NULL) {
- return(NULL);
- }
- inputStream->filename = NULL;
- inputStream->buf = input;
- inputStream->base = inputStream->buf->buffer->content;
- inputStream->cur = inputStream->buf->buffer->content;
- inputStream->end = &inputStream->base[inputStream->buf->buffer->use];
- if (enc != XML_CHAR_ENCODING_NONE) {
- xmlSwitchEncoding(ctxt, enc);
- }
-
- return(inputStream);
-}
-
-/**
- * xmlNewEntityInputStream:
- * @ctxt: an XML parser context
- * @entity: an Entity pointer
- *
- * Create a new input stream based on an xmlEntityPtr
- *
- * Returns the new input stream or NULL
- */
-xmlParserInputPtr
-xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
- xmlParserInputPtr input;
-
- if (entity == NULL) {
- ctxt->errNo = XML_ERR_INTERNAL_ERROR;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "internal: xmlNewEntityInputStream entity = NULL\n");
- ctxt->errNo = XML_ERR_INTERNAL_ERROR;
- return(NULL);
- }
- if (xmlParserDebugEntities)
- xmlGenericError(xmlGenericErrorContext,
- "new input from entity: %s\n", entity->name);
- if (entity->content == NULL) {
- switch (entity->etype) {
- case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY:
- ctxt->errNo = XML_ERR_UNPARSED_ENTITY;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlNewEntityInputStream unparsed entity !\n");
- break;
- case XML_EXTERNAL_GENERAL_PARSED_ENTITY:
- case XML_EXTERNAL_PARAMETER_ENTITY:
- return(xmlLoadExternalEntity((char *) entity->URI,
- (char *) entity->ExternalID, ctxt));
- case XML_INTERNAL_GENERAL_ENTITY:
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Internal entity %s without content !\n", entity->name);
- break;
- case XML_INTERNAL_PARAMETER_ENTITY:
- ctxt->errNo = XML_ERR_INTERNAL_ERROR;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Internal parameter entity %s without content !\n", entity->name);
- break;
- case XML_INTERNAL_PREDEFINED_ENTITY:
- ctxt->errNo = XML_ERR_INTERNAL_ERROR;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Predefined entity %s without content !\n", entity->name);
- break;
- }
- return(NULL);
- }
- input = xmlNewInputStream(ctxt);
- if (input == NULL) {
- return(NULL);
- }
- input->filename = (char *) entity->URI;
- input->base = entity->content;
- input->cur = entity->content;
- input->length = entity->length;
- input->end = &entity->content[input->length];
- return(input);
-}
-
-/**
- * xmlNewStringInputStream:
- * @ctxt: an XML parser context
- * @buffer: an memory buffer
- *
- * Create a new input stream based on a memory buffer.
- * Returns the new input stream
- */
-xmlParserInputPtr
-xmlNewStringInputStream(xmlParserCtxtPtr ctxt, const xmlChar *buffer) {
- xmlParserInputPtr input;
-
- if (buffer == NULL) {
- ctxt->errNo = XML_ERR_INTERNAL_ERROR;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "internal: xmlNewStringInputStream string = NULL\n");
- return(NULL);
- }
- if (xmlParserDebugEntities)
- xmlGenericError(xmlGenericErrorContext,
- "new fixed input: %.30s\n", buffer);
- input = xmlNewInputStream(ctxt);
- if (input == NULL) {
- return(NULL);
- }
- input->base = buffer;
- input->cur = buffer;
- input->length = xmlStrlen(buffer);
- input->end = &buffer[input->length];
- return(input);
-}
-
-/**
- * xmlNewInputFromFile:
- * @ctxt: an XML parser context
- * @filename: the filename to use as entity
- *
- * Create a new input stream based on a file.
- *
- * Returns the new input stream or NULL in case of error
- */
-xmlParserInputPtr
-xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) {
- xmlParserInputBufferPtr buf;
- xmlParserInputPtr inputStream;
- char *directory = NULL;
- xmlChar *URI = NULL;
-
- if (xmlParserDebugEntities)
- xmlGenericError(xmlGenericErrorContext,
- "new input from file: %s\n", filename);
- if (ctxt == NULL) return(NULL);
- buf = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE);
- if (buf == NULL)
- return(NULL);
-
- URI = xmlStrdup((xmlChar *) filename);
- directory = xmlParserGetDirectory((const char *) URI);
-
- inputStream = xmlNewInputStream(ctxt);
- if (inputStream == NULL) {
- if (directory != NULL) xmlFree((char *) directory);
- if (URI != NULL) xmlFree((char *) URI);
- return(NULL);
- }
-
- inputStream->filename = (const char *) URI;
- inputStream->directory = directory;
- inputStream->buf = buf;
-
- inputStream->base = inputStream->buf->buffer->content;
- inputStream->cur = inputStream->buf->buffer->content;
- inputStream->end = &inputStream->base[inputStream->buf->buffer->use];
- if ((ctxt->directory == NULL) && (directory != NULL))
- ctxt->directory = (char *) xmlStrdup((const xmlChar *) directory);
- return(inputStream);
-}
-
-/************************************************************************
- * *
- * Commodity functions to handle parser contexts *
- * *
- ************************************************************************/
-
-/**
- * xmlInitParserCtxt:
- * @ctxt: an XML parser context
- *
- * Initialize a parser context
- */
-
-void
-xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
-{
- if(ctxt==NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlInitParserCtxt: NULL context given\n");
- return;
- }
-
- xmlDefaultSAXHandlerInit();
-
- ctxt->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
- if (ctxt->sax == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlInitParserCtxt: out of memory\n");
- }
- else
- memcpy(ctxt->sax, &xmlDefaultSAXHandler, sizeof(xmlSAXHandler));
-
- /* Allocate the Input stack */
- ctxt->inputTab = (xmlParserInputPtr *)
- xmlMalloc(5 * sizeof(xmlParserInputPtr));
- if (ctxt->inputTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlInitParserCtxt: out of memory\n");
- ctxt->inputNr = 0;
- ctxt->inputMax = 0;
- ctxt->input = NULL;
- return;
- }
- ctxt->inputNr = 0;
- ctxt->inputMax = 5;
- ctxt->input = NULL;
-
- ctxt->version = NULL;
- ctxt->encoding = NULL;
- ctxt->standalone = -1;
- ctxt->hasExternalSubset = 0;
- ctxt->hasPErefs = 0;
- ctxt->html = 0;
- ctxt->external = 0;
- ctxt->instate = XML_PARSER_START;
- ctxt->token = 0;
- ctxt->directory = NULL;
-
- /* Allocate the Node stack */
- ctxt->nodeTab = (xmlNodePtr *) xmlMalloc(10 * sizeof(xmlNodePtr));
- if (ctxt->nodeTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlInitParserCtxt: out of memory\n");
- ctxt->nodeNr = 0;
- ctxt->nodeMax = 0;
- ctxt->node = NULL;
- ctxt->inputNr = 0;
- ctxt->inputMax = 0;
- ctxt->input = NULL;
- return;
- }
- ctxt->nodeNr = 0;
- ctxt->nodeMax = 10;
- ctxt->node = NULL;
-
- /* Allocate the Name stack */
- ctxt->nameTab = (xmlChar **) xmlMalloc(10 * sizeof(xmlChar *));
- if (ctxt->nameTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlInitParserCtxt: out of memory\n");
- ctxt->nodeNr = 0;
- ctxt->nodeMax = 0;
- ctxt->node = NULL;
- ctxt->inputNr = 0;
- ctxt->inputMax = 0;
- ctxt->input = NULL;
- ctxt->nameNr = 0;
- ctxt->nameMax = 0;
- ctxt->name = NULL;
- return;
- }
- ctxt->nameNr = 0;
- ctxt->nameMax = 10;
- ctxt->name = NULL;
-
- /* Allocate the space stack */
- ctxt->spaceTab = (int *) xmlMalloc(10 * sizeof(int));
- if (ctxt->spaceTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlInitParserCtxt: out of memory\n");
- ctxt->nodeNr = 0;
- ctxt->nodeMax = 0;
- ctxt->node = NULL;
- ctxt->inputNr = 0;
- ctxt->inputMax = 0;
- ctxt->input = NULL;
- ctxt->nameNr = 0;
- ctxt->nameMax = 0;
- ctxt->name = NULL;
- ctxt->spaceNr = 0;
- ctxt->spaceMax = 0;
- ctxt->space = NULL;
- return;
- }
- ctxt->spaceNr = 1;
- ctxt->spaceMax = 10;
- ctxt->spaceTab[0] = -1;
- ctxt->space = &ctxt->spaceTab[0];
- ctxt->userData = ctxt;
- ctxt->myDoc = NULL;
- ctxt->wellFormed = 1;
- ctxt->valid = 1;
- ctxt->loadsubset = xmlLoadExtDtdDefaultValue;
- ctxt->validate = xmlDoValidityCheckingDefaultValue;
- ctxt->pedantic = xmlPedanticParserDefaultValue;
- ctxt->linenumbers = xmlLineNumbersDefaultValue;
- ctxt->keepBlanks = xmlKeepBlanksDefaultValue;
- if (ctxt->keepBlanks == 0)
- ctxt->sax->ignorableWhitespace = ignorableWhitespace;
-
- ctxt->vctxt.userData = ctxt;
- ctxt->vctxt.error = xmlParserValidityError;
- ctxt->vctxt.warning = xmlParserValidityWarning;
- if (ctxt->validate) {
- if (xmlGetWarningsDefaultValue == 0)
- ctxt->vctxt.warning = NULL;
- else
- ctxt->vctxt.warning = xmlParserValidityWarning;
- ctxt->vctxt.nodeMax = 0;
- }
- ctxt->replaceEntities = xmlSubstituteEntitiesDefaultValue;
- ctxt->record_info = 0;
- ctxt->nbChars = 0;
- ctxt->checkIndex = 0;
- ctxt->inSubset = 0;
- ctxt->errNo = XML_ERR_OK;
- ctxt->depth = 0;
- ctxt->charset = XML_CHAR_ENCODING_UTF8;
- ctxt->catalogs = NULL;
- xmlInitNodeInfoSeq(&ctxt->node_seq);
-}
-
-/**
- * xmlFreeParserCtxt:
- * @ctxt: an XML parser context
- *
- * Free all the memory used by a parser context. However the parsed
- * document in ctxt->myDoc is not freed.
- */
-
-void
-xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
-{
- xmlParserInputPtr input;
- xmlChar *oldname;
-
- if (ctxt == NULL) return;
-
- while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */
- xmlFreeInputStream(input);
- }
- while ((oldname = namePop(ctxt)) != NULL) { /* Non consuming */
- xmlFree(oldname);
- }
- if (ctxt->spaceTab != NULL) xmlFree(ctxt->spaceTab);
- if (ctxt->nameTab != NULL) xmlFree(ctxt->nameTab);
- if (ctxt->nodeTab != NULL) xmlFree(ctxt->nodeTab);
- if (ctxt->inputTab != NULL) xmlFree(ctxt->inputTab);
- if (ctxt->version != NULL) xmlFree((char *) ctxt->version);
- if (ctxt->encoding != NULL) xmlFree((char *) ctxt->encoding);
- if (ctxt->intSubName != NULL) xmlFree((char *) ctxt->intSubName);
- if (ctxt->extSubURI != NULL) xmlFree((char *) ctxt->extSubURI);
- if (ctxt->extSubSystem != NULL) xmlFree((char *) ctxt->extSubSystem);
- if ((ctxt->sax != NULL) && (ctxt->sax != &xmlDefaultSAXHandler))
- xmlFree(ctxt->sax);
- if (ctxt->directory != NULL) xmlFree((char *) ctxt->directory);
- if (ctxt->vctxt.nodeTab != NULL) xmlFree(ctxt->vctxt.nodeTab);
-#ifdef LIBXML_CATALOG_ENABLED
- if (ctxt->catalogs != NULL)
- xmlCatalogFreeLocal(ctxt->catalogs);
-#endif
- xmlFree(ctxt);
-}
-
-/**
- * xmlNewParserCtxt:
- *
- * Allocate and initialize a new parser context.
- *
- * Returns the xmlParserCtxtPtr or NULL
- */
-
-xmlParserCtxtPtr
-xmlNewParserCtxt()
-{
- xmlParserCtxtPtr ctxt;
-
- ctxt = (xmlParserCtxtPtr) xmlMalloc(sizeof(xmlParserCtxt));
- if (ctxt == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewParserCtxt : cannot allocate context\n");
- xmlGenericError(xmlGenericErrorContext, "malloc failed");
- return(NULL);
- }
- memset(ctxt, 0, sizeof(xmlParserCtxt));
- xmlInitParserCtxt(ctxt);
- return(ctxt);
-}
-
-/************************************************************************
- * *
- * Handling of node informations *
- * *
- ************************************************************************/
-
-/**
- * xmlClearParserCtxt:
- * @ctxt: an XML parser context
- *
- * Clear (release owned resources) and reinitialize a parser context
- */
-
-void
-xmlClearParserCtxt(xmlParserCtxtPtr ctxt)
-{
- if (ctxt==NULL)
- return;
- xmlClearNodeInfoSeq(&ctxt->node_seq);
- xmlInitParserCtxt(ctxt);
-}
-
-/**
- * xmlParserFindNodeInfo:
- * @ctx: an XML parser context
- * @node: an XML node within the tree
- *
- * Find the parser node info struct for a given node
- *
- * Returns an xmlParserNodeInfo block pointer or NULL
- */
-const xmlParserNodeInfo* xmlParserFindNodeInfo(const xmlParserCtxtPtr ctx,
- const xmlNodePtr node)
-{
- unsigned long pos;
-
- /* Find position where node should be at */
- pos = xmlParserFindNodeInfoIndex(&ctx->node_seq, node);
- if (pos < ctx->node_seq.length && ctx->node_seq.buffer[pos].node == node)
- return &ctx->node_seq.buffer[pos];
- else
- return NULL;
-}
-
-
-/**
- * xmlInitNodeInfoSeq:
- * @seq: a node info sequence pointer
- *
- * -- Initialize (set to initial state) node info sequence
- */
-void
-xmlInitNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
-{
- seq->length = 0;
- seq->maximum = 0;
- seq->buffer = NULL;
-}
-
-/**
- * xmlClearNodeInfoSeq:
- * @seq: a node info sequence pointer
- *
- * -- Clear (release memory and reinitialize) node
- * info sequence
- */
-void
-xmlClearNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
-{
- if ( seq->buffer != NULL )
- xmlFree(seq->buffer);
- xmlInitNodeInfoSeq(seq);
-}
-
-
-/**
- * xmlParserFindNodeInfoIndex:
- * @seq: a node info sequence pointer
- * @node: an XML node pointer
- *
- *
- * xmlParserFindNodeInfoIndex : Find the index that the info record for
- * the given node is or should be at in a sorted sequence
- *
- * Returns a long indicating the position of the record
- */
-unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
- const xmlNodePtr node)
-{
- unsigned long upper, lower, middle;
- int found = 0;
-
- /* Do a binary search for the key */
- lower = 1;
- upper = seq->length;
- middle = 0;
- while ( lower <= upper && !found) {
- middle = lower + (upper - lower) / 2;
- if ( node == seq->buffer[middle - 1].node )
- found = 1;
- else if ( node < seq->buffer[middle - 1].node )
- upper = middle - 1;
- else
- lower = middle + 1;
- }
-
- /* Return position */
- if ( middle == 0 || seq->buffer[middle - 1].node < node )
- return middle;
- else
- return middle - 1;
-}
-
-
-/**
- * xmlParserAddNodeInfo:
- * @ctxt: an XML parser context
- * @info: a node info sequence pointer
- *
- * Insert node info record into the sorted sequence
- */
-void
-xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt,
- const xmlParserNodeInfoPtr info)
-{
- unsigned long pos;
-
- /* Find pos and check to see if node is already in the sequence */
- pos = xmlParserFindNodeInfoIndex(&ctxt->node_seq, (const xmlNodePtr)
- info->node);
- if (pos < ctxt->node_seq.length
- && ctxt->node_seq.buffer[pos].node == info->node) {
- ctxt->node_seq.buffer[pos] = *info;
- }
-
- /* Otherwise, we need to add new node to buffer */
- else {
- if (ctxt->node_seq.length + 1 > ctxt->node_seq.maximum) {
- xmlParserNodeInfo *tmp_buffer;
- unsigned int byte_size;
-
- if (ctxt->node_seq.maximum == 0)
- ctxt->node_seq.maximum = 2;
- byte_size = (sizeof(*ctxt->node_seq.buffer) *
- (2 * ctxt->node_seq.maximum));
-
- if (ctxt->node_seq.buffer == NULL)
- tmp_buffer = (xmlParserNodeInfo *) xmlMalloc(byte_size);
- else
- tmp_buffer =
- (xmlParserNodeInfo *) xmlRealloc(ctxt->node_seq.buffer,
- byte_size);
-
- if (tmp_buffer == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Out of memory\n");
- ctxt->errNo = XML_ERR_NO_MEMORY;
- return;
- }
- ctxt->node_seq.buffer = tmp_buffer;
- ctxt->node_seq.maximum *= 2;
- }
-
- /* If position is not at end, move elements out of the way */
- if (pos != ctxt->node_seq.length) {
- unsigned long i;
-
- for (i = ctxt->node_seq.length; i > pos; i--)
- ctxt->node_seq.buffer[i] = ctxt->node_seq.buffer[i - 1];
- }
-
- /* Copy element and increase length */
- ctxt->node_seq.buffer[pos] = *info;
- ctxt->node_seq.length++;
- }
-}
-
-/************************************************************************
- * *
- * Defaults settings *
- * *
- ************************************************************************/
-/**
- * xmlPedanticParserDefault:
- * @val: int 0 or 1
- *
- * Set and return the previous value for enabling pedantic warnings.
- *
- * Returns the last value for 0 for no substitution, 1 for substitution.
- */
-
-int
-xmlPedanticParserDefault(int val) {
- int old = xmlPedanticParserDefaultValue;
-
- xmlPedanticParserDefaultValue = val;
- return(old);
-}
-
-/**
- * xmlLineNumbersDefault:
- * @val: int 0 or 1
- *
- * Set and return the previous value for enabling line numbers in elements
- * contents. This may break on old application and is turned off by default.
- *
- * Returns the last value for 0 for no substitution, 1 for substitution.
- */
-
-int
-xmlLineNumbersDefault(int val) {
- int old = xmlLineNumbersDefaultValue;
-
- xmlLineNumbersDefaultValue = val;
- return(old);
-}
-
-/**
- * xmlSubstituteEntitiesDefault:
- * @val: int 0 or 1
- *
- * Set and return the previous value for default entity support.
- * Initially the parser always keep entity references instead of substituting
- * entity values in the output. This function has to be used to change the
- * default parser behavior
- * SAX::substituteEntities() has to be used for changing that on a file by
- * file basis.
- *
- * Returns the last value for 0 for no substitution, 1 for substitution.
- */
-
-int
-xmlSubstituteEntitiesDefault(int val) {
- int old = xmlSubstituteEntitiesDefaultValue;
-
- xmlSubstituteEntitiesDefaultValue = val;
- return(old);
-}
-
-/**
- * xmlKeepBlanksDefault:
- * @val: int 0 or 1
- *
- * Set and return the previous value for default blanks text nodes support.
- * The 1.x version of the parser used an heuristic to try to detect
- * ignorable white spaces. As a result the SAX callback was generating
- * ignorableWhitespace() callbacks instead of characters() one, and when
- * using the DOM output text nodes containing those blanks were not generated.
- * The 2.x and later version will switch to the XML standard way and
- * ignorableWhitespace() are only generated when running the parser in
- * validating mode and when the current element doesn't allow CDATA or
- * mixed content.
- * This function is provided as a way to force the standard behavior
- * on 1.X libs and to switch back to the old mode for compatibility when
- * running 1.X client code on 2.X . Upgrade of 1.X code should be done
- * by using xmlIsBlankNode() commodity function to detect the "empty"
- * nodes generated.
- * This value also affect autogeneration of indentation when saving code
- * if blanks sections are kept, indentation is not generated.
- *
- * Returns the last value for 0 for no substitution, 1 for substitution.
- */
-
-int
-xmlKeepBlanksDefault(int val) {
- int old = xmlKeepBlanksDefaultValue;
-
- xmlKeepBlanksDefaultValue = val;
- xmlIndentTreeOutput = !val;
- return(old);
-}
-
-/************************************************************************
- * *
- * Deprecated functions kept for compatibility *
- * *
- ************************************************************************/
-
-/**
- * xmlCheckLanguageID:
- * @lang: pointer to the string value
- *
- * Checks that the value conforms to the LanguageID production:
- *
- * NOTE: this is somewhat deprecated, those productions were removed from
- * the XML Second edition.
- *
- * [33] LanguageID ::= Langcode ('-' Subcode)*
- * [34] Langcode ::= ISO639Code | IanaCode | UserCode
- * [35] ISO639Code ::= ([a-z] | [A-Z]) ([a-z] | [A-Z])
- * [36] IanaCode ::= ('i' | 'I') '-' ([a-z] | [A-Z])+
- * [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+
- * [38] Subcode ::= ([a-z] | [A-Z])+
- *
- * Returns 1 if correct 0 otherwise
- **/
-int
-xmlCheckLanguageID(const xmlChar *lang) {
- const xmlChar *cur = lang;
-
- if (cur == NULL)
- return(0);
- if (((cur[0] == 'i') && (cur[1] == '-')) ||
- ((cur[0] == 'I') && (cur[1] == '-'))) {
- /*
- * IANA code
- */
- cur += 2;
- while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */
- ((cur[0] >= 'a') && (cur[0] <= 'z')))
- cur++;
- } else if (((cur[0] == 'x') && (cur[1] == '-')) ||
- ((cur[0] == 'X') && (cur[1] == '-'))) {
- /*
- * User code
- */
- cur += 2;
- while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */
- ((cur[0] >= 'a') && (cur[0] <= 'z')))
- cur++;
- } else if (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
- ((cur[0] >= 'a') && (cur[0] <= 'z'))) {
- /*
- * ISO639
- */
- cur++;
- if (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
- ((cur[0] >= 'a') && (cur[0] <= 'z')))
- cur++;
- else
- return(0);
- } else
- return(0);
- while (cur[0] != 0) { /* non input consuming */
- if (cur[0] != '-')
- return(0);
- cur++;
- if (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
- ((cur[0] >= 'a') && (cur[0] <= 'z')))
- cur++;
- else
- return(0);
- while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */
- ((cur[0] >= 'a') && (cur[0] <= 'z')))
- cur++;
- }
- return(1);
-}
-
-/**
- * xmlDecodeEntities:
- * @ctxt: the parser context
- * @len: the len to decode (in bytes !), -1 for no size limit
- * @what: combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF
- * @end: an end marker xmlChar, 0 if none
- * @end2: an end marker xmlChar, 0 if none
- * @end3: an end marker xmlChar, 0 if none
- *
- * This function is deprecated, we now always process entities content
- * through xmlStringDecodeEntities
- *
- * TODO: remove it in next major release.
- *
- * [67] Reference ::= EntityRef | CharRef
- *
- * [69] PEReference ::= '%' Name ';'
- *
- * Returns A newly allocated string with the substitution done. The caller
- * must deallocate it !
- */
-xmlChar *
-xmlDecodeEntities(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUSED, int what ATTRIBUTE_UNUSED,
- xmlChar end ATTRIBUTE_UNUSED, xmlChar end2 ATTRIBUTE_UNUSED, xmlChar end3 ATTRIBUTE_UNUSED) {
-#if 0
- xmlChar *buffer = NULL;
- unsigned int buffer_size = 0;
- unsigned int nbchars = 0;
-
- xmlChar *current = NULL;
- xmlEntityPtr ent;
- unsigned int max = (unsigned int) len;
- int c,l;
-#endif
-
- static int deprecated = 0;
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlDecodeEntities() deprecated function reached\n");
- deprecated = 1;
- }
-
-#if 0
- if (ctxt->depth > 40) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Detected entity reference loop\n");
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- ctxt->errNo = XML_ERR_ENTITY_LOOP;
- return(NULL);
- }
-
- /*
- * allocate a translation buffer.
- */
- buffer_size = XML_PARSER_BIG_BUFFER_SIZE;
- buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
- if (buffer == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlDecodeEntities: malloc failed");
- return(NULL);
- }
-
- /*
- * OK loop until we reach one of the ending char or a size limit.
- */
- GROW;
- c = CUR_CHAR(l);
- while ((nbchars < max) && (c != end) && /* NOTUSED */
- (c != end2) && (c != end3)) {
- GROW;
- if (c == 0) break;
- if ((c == '&') && (NXT(1) == '#')) {
- int val = xmlParseCharRef(ctxt);
- COPY_BUF(0,buffer,nbchars,val);
- NEXTL(l);
- } else if (c == '&') &&
- (what & XML_SUBSTITUTE_REF)) {
- if (xmlParserDebugEntities)
- xmlGenericError(xmlGenericErrorContext,
- "decoding Entity Reference\n");
- ent = xmlParseEntityRef(ctxt);
- if ((ent != NULL) &&
- (ctxt->replaceEntities != 0)) {
- current = ent->content;
- while (*current != 0) { /* non input consuming loop */
- buffer[nbchars++] = *current++;
- if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) {
- growBuffer(buffer);
- }
- }
- } else if (ent != NULL) {
- const xmlChar *cur = ent->name;
-
- buffer[nbchars++] = '&';
- if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) {
- growBuffer(buffer);
- }
- while (*cur != 0) { /* non input consuming loop */
- buffer[nbchars++] = *cur++;
- }
- buffer[nbchars++] = ';';
- }
- } else if (c == '%' && (what & XML_SUBSTITUTE_PEREF)) {
- /*
- * a PEReference induce to switch the entity flow,
- * we break here to flush the current set of chars
- * parsed if any. We will be called back later.
- */
- if (xmlParserDebugEntities)
- xmlGenericError(xmlGenericErrorContext,
- "decoding PE Reference\n");
- if (nbchars != 0) break;
-
- xmlParsePEReference(ctxt);
-
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1)) /* non input consuming */
- xmlPopInput(ctxt);
-
- break;
- } else {
- COPY_BUF(l,buffer,nbchars,c);
- NEXTL(l);
- if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) {
- growBuffer(buffer);
- }
- }
- c = CUR_CHAR(l);
- }
- buffer[nbchars++] = 0;
- return(buffer);
-#endif
- return(NULL);
-}
-
-/**
- * xmlNamespaceParseNCName:
- * @ctxt: an XML parser context
- *
- * parse an XML namespace name.
- *
- * TODO: this seems not in use anymore, the namespace handling is done on
- * top of the SAX interfaces, i.e. not on raw input.
- *
- * [NS 3] NCName ::= (Letter | '_') (NCNameChar)*
- *
- * [NS 4] NCNameChar ::= Letter | Digit | '.' | '-' | '_' |
- * CombiningChar | Extender
- *
- * Returns the namespace name or NULL
- */
-
-xmlChar *
-xmlNamespaceParseNCName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) {
-#if 0
- xmlChar buf[XML_MAX_NAMELEN + 5];
- int len = 0, l;
- int cur = CUR_CHAR(l);
-#endif
-
- static int deprecated = 0;
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNamespaceParseNCName() deprecated function reached\n");
- deprecated = 1;
- }
-
-#if 0
- /* load first the value of the char !!! */
- GROW;
- if (!IS_LETTER(cur) && (cur != '_')) return(NULL);
-
-xmlGenericError(xmlGenericErrorContext,
- "xmlNamespaceParseNCName: reached loop 3\n");
- while ((IS_LETTER(cur)) || (IS_DIGIT(cur)) || /* NOT REACHED */
- (cur == '.') || (cur == '-') ||
- (cur == '_') ||
- (IS_COMBINING(cur)) ||
- (IS_EXTENDER(cur))) {
- COPY_BUF(l,buf,len,cur);
- NEXTL(l);
- cur = CUR_CHAR(l);
- if (len >= XML_MAX_NAMELEN) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNamespaceParseNCName: reached XML_MAX_NAMELEN limit\n");
- while ((IS_LETTER(cur)) || (IS_DIGIT(cur)) ||/* NOT REACHED */
- (cur == '.') || (cur == '-') ||
- (cur == '_') ||
- (IS_COMBINING(cur)) ||
- (IS_EXTENDER(cur))) {
- NEXTL(l);
- cur = CUR_CHAR(l);
- }
- break;
- }
- }
- return(xmlStrndup(buf, len));
-#endif
- return(NULL);
-}
-
-/**
- * xmlNamespaceParseQName:
- * @ctxt: an XML parser context
- * @prefix: a xmlChar **
- *
- * TODO: this seems not in use anymore, the namespace handling is done on
- * top of the SAX interfaces, i.e. not on raw input.
- *
- * parse an XML qualified name
- *
- * [NS 5] QName ::= (Prefix ':')? LocalPart
- *
- * [NS 6] Prefix ::= NCName
- *
- * [NS 7] LocalPart ::= NCName
- *
- * Returns the local part, and prefix is updated
- * to get the Prefix if any.
- */
-
-xmlChar *
-xmlNamespaceParseQName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlChar **prefix ATTRIBUTE_UNUSED) {
-
- static int deprecated = 0;
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNamespaceParseQName() deprecated function reached\n");
- deprecated = 1;
- }
-
-#if 0
- xmlChar *ret = NULL;
-
- *prefix = NULL;
- ret = xmlNamespaceParseNCName(ctxt);
- if (RAW == ':') {
- *prefix = ret;
- NEXT;
- ret = xmlNamespaceParseNCName(ctxt);
- }
-
- return(ret);
-#endif
- return(NULL);
-}
-
-/**
- * xmlNamespaceParseNSDef:
- * @ctxt: an XML parser context
- *
- * parse a namespace prefix declaration
- *
- * TODO: this seems not in use anymore, the namespace handling is done on
- * top of the SAX interfaces, i.e. not on raw input.
- *
- * [NS 1] NSDef ::= PrefixDef Eq SystemLiteral
- *
- * [NS 2] PrefixDef ::= 'xmlns' (':' NCName)?
- *
- * Returns the namespace name
- */
-
-xmlChar *
-xmlNamespaceParseNSDef(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) {
- static int deprecated = 0;
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNamespaceParseNSDef() deprecated function reached\n");
- deprecated = 1;
- }
- return(NULL);
-#if 0
- xmlChar *name = NULL;
-
- if ((RAW == 'x') && (NXT(1) == 'm') &&
- (NXT(2) == 'l') && (NXT(3) == 'n') &&
- (NXT(4) == 's')) {
- SKIP(5);
- if (RAW == ':') {
- NEXT;
- name = xmlNamespaceParseNCName(ctxt);
- }
- }
- return(name);
-#endif
-}
-
-/**
- * xmlParseQuotedString:
- * @ctxt: an XML parser context
- *
- * Parse and return a string between quotes or doublequotes
- *
- * TODO: Deprecated, to be removed at next drop of binary compatibility
- *
- * Returns the string parser or NULL.
- */
-xmlChar *
-xmlParseQuotedString(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) {
- static int deprecated = 0;
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParseQuotedString() deprecated function reached\n");
- deprecated = 1;
- }
- return(NULL);
-
-#if 0
- xmlChar *buf = NULL;
- int len = 0,l;
- int size = XML_PARSER_BUFFER_SIZE;
- int c;
-
- buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc of %d byte failed\n", size);
- return(NULL);
- }
-xmlGenericError(xmlGenericErrorContext,
- "xmlParseQuotedString: reached loop 4\n");
- if (RAW == '"') {
- NEXT;
- c = CUR_CHAR(l);
- while (IS_CHAR(c) && (c != '"')) { /* NOTUSED */
- if (len + 5 >= size) {
- size *= 2;
- buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %d byte failed\n", size);
- return(NULL);
- }
- }
- COPY_BUF(l,buf,len,c);
- NEXTL(l);
- c = CUR_CHAR(l);
- }
- if (c != '"') {
- ctxt->errNo = XML_ERR_STRING_NOT_CLOSED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "String not closed \"%.50s\"\n", buf);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- NEXT;
- }
- } else if (RAW == '\''){
- NEXT;
- c = CUR;
- while (IS_CHAR(c) && (c != '\'')) { /* NOTUSED */
- if (len + 1 >= size) {
- size *= 2;
- buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
- if (buf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc of %d byte failed\n", size);
- return(NULL);
- }
- }
- buf[len++] = c;
- NEXT;
- c = CUR;
- }
- if (RAW != '\'') {
- ctxt->errNo = XML_ERR_STRING_NOT_CLOSED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "String not closed \"%.50s\"\n", buf);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- } else {
- NEXT;
- }
- }
- return(buf);
-#endif
-}
-
-/**
- * xmlParseNamespace:
- * @ctxt: an XML parser context
- *
- * xmlParseNamespace: parse specific PI '<?namespace ...' constructs.
- *
- * This is what the older xml-name Working Draft specified, a bunch of
- * other stuff may still rely on it, so support is still here as
- * if it was declared on the root of the Tree:-(
- *
- * TODO: remove from library
- *
- * To be removed at next drop of binary compatibility
- */
-
-void
-xmlParseNamespace(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) {
- static int deprecated = 0;
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParseNamespace() deprecated function reached\n");
- deprecated = 1;
- }
-
-#if 0
- xmlChar *href = NULL;
- xmlChar *prefix = NULL;
- int garbage = 0;
-
- /*
- * We just skipped "namespace" or "xml:namespace"
- */
- SKIP_BLANKS;
-
-xmlGenericError(xmlGenericErrorContext,
- "xmlParseNamespace: reached loop 5\n");
- while (IS_CHAR(RAW) && (RAW != '>')) { /* NOT REACHED */
- /*
- * We can have "ns" or "prefix" attributes
- * Old encoding as 'href' or 'AS' attributes is still supported
- */
- if ((RAW == 'n') && (NXT(1) == 's')) {
- garbage = 0;
- SKIP(2);
- SKIP_BLANKS;
-
- if (RAW != '=') continue;
- NEXT;
- SKIP_BLANKS;
-
- href = xmlParseQuotedString(ctxt);
- SKIP_BLANKS;
- } else if ((RAW == 'h') && (NXT(1) == 'r') &&
- (NXT(2) == 'e') && (NXT(3) == 'f')) {
- garbage = 0;
- SKIP(4);
- SKIP_BLANKS;
-
- if (RAW != '=') continue;
- NEXT;
- SKIP_BLANKS;
-
- href = xmlParseQuotedString(ctxt);
- SKIP_BLANKS;
- } else if ((RAW == 'p') && (NXT(1) == 'r') &&
- (NXT(2) == 'e') && (NXT(3) == 'f') &&
- (NXT(4) == 'i') && (NXT(5) == 'x')) {
- garbage = 0;
- SKIP(6);
- SKIP_BLANKS;
-
- if (RAW != '=') continue;
- NEXT;
- SKIP_BLANKS;
-
- prefix = xmlParseQuotedString(ctxt);
- SKIP_BLANKS;
- } else if ((RAW == 'A') && (NXT(1) == 'S')) {
- garbage = 0;
- SKIP(2);
- SKIP_BLANKS;
-
- if (RAW != '=') continue;
- NEXT;
- SKIP_BLANKS;
-
- prefix = xmlParseQuotedString(ctxt);
- SKIP_BLANKS;
- } else if ((RAW == '?') && (NXT(1) == '>')) {
- garbage = 0;
- NEXT;
- } else {
- /*
- * Found garbage when parsing the namespace
- */
- if (!garbage) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "xmlParseNamespace found garbage\n");
- }
- ctxt->errNo = XML_ERR_NS_DECL_ERROR;
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- NEXT;
- }
- }
-
- MOVETO_ENDTAG(CUR_PTR);
- NEXT;
-
- /*
- * Register the DTD.
- if (href != NULL)
- if ((ctxt->sax != NULL) && (ctxt->sax->globalNamespace != NULL))
- ctxt->sax->globalNamespace(ctxt->userData, href, prefix);
- */
-
- if (prefix != NULL) xmlFree(prefix);
- if (href != NULL) xmlFree(href);
-#endif
-}
-
-/**
- * xmlScanName:
- * @ctxt: an XML parser context
- *
- * Trickery: parse an XML name but without consuming the input flow
- * Needed for rollback cases. Used only when parsing entities references.
- *
- * TODO: seems deprecated now, only used in the default part of
- * xmlParserHandleReference
- *
- * [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |
- * CombiningChar | Extender
- *
- * [5] Name ::= (Letter | '_' | ':') (NameChar)*
- *
- * [6] Names ::= Name (S Name)*
- *
- * Returns the Name parsed or NULL
- */
-
-xmlChar *
-xmlScanName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) {
- static int deprecated = 0;
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlScanName() deprecated function reached\n");
- deprecated = 1;
- }
- return(NULL);
-
-#if 0
- xmlChar buf[XML_MAX_NAMELEN];
- int len = 0;
-
- GROW;
- if (!IS_LETTER(RAW) && (RAW != '_') &&
- (RAW != ':')) {
- return(NULL);
- }
-
-
- while ((IS_LETTER(NXT(len))) || (IS_DIGIT(NXT(len))) || /* NOT REACHED */
- (NXT(len) == '.') || (NXT(len) == '-') ||
- (NXT(len) == '_') || (NXT(len) == ':') ||
- (IS_COMBINING(NXT(len))) ||
- (IS_EXTENDER(NXT(len)))) {
- GROW;
- buf[len] = NXT(len);
- len++;
- if (len >= XML_MAX_NAMELEN) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlScanName: reached XML_MAX_NAMELEN limit\n");
- while ((IS_LETTER(NXT(len))) || /* NOT REACHED */
- (IS_DIGIT(NXT(len))) ||
- (NXT(len) == '.') || (NXT(len) == '-') ||
- (NXT(len) == '_') || (NXT(len) == ':') ||
- (IS_COMBINING(NXT(len))) ||
- (IS_EXTENDER(NXT(len))))
- len++;
- break;
- }
- }
- return(xmlStrndup(buf, len));
-#endif
-}
-
-/**
- * xmlParserHandleReference:
- * @ctxt: the parser context
- *
- * TODO: Remove, now deprecated ... the test is done directly in the
- * content parsing
- * routines.
- *
- * [67] Reference ::= EntityRef | CharRef
- *
- * [68] EntityRef ::= '&' Name ';'
- *
- * [ WFC: Entity Declared ]
- * the Name given in the entity reference must match that in an entity
- * declaration, except that well-formed documents need not declare any
- * of the following entities: amp, lt, gt, apos, quot.
- *
- * [ WFC: Parsed Entity ]
- * An entity reference must not contain the name of an unparsed entity
- *
- * [66] CharRef ::= '&#' [0-9]+ ';' |
- * '&#x' [0-9a-fA-F]+ ';'
- *
- * A PEReference may have been detected in the current input stream
- * the handling is done accordingly to
- * http://www.w3.org/TR/REC-xml#entproc
- */
-void
-xmlParserHandleReference(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) {
- static int deprecated = 0;
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParserHandleReference() deprecated function reached\n");
- deprecated = 1;
- }
-
- return;
-}
-
-/**
- * xmlHandleEntity:
- * @ctxt: an XML parser context
- * @entity: an XML entity pointer.
- *
- * Default handling of defined entities, when should we define a new input
- * stream ? When do we just handle that as a set of chars ?
- *
- * OBSOLETE: to be removed at some point.
- */
-
-void
-xmlHandleEntity(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlEntityPtr entity ATTRIBUTE_UNUSED) {
- static int deprecated = 0;
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlHandleEntity() deprecated function reached\n");
- deprecated = 1;
- }
-
-#if 0
- int len;
- xmlParserInputPtr input;
-
- if (entity->content == NULL) {
- ctxt->errNo = XML_ERR_INTERNAL_ERROR;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "xmlHandleEntity %s: content == NULL\n",
- entity->name);
- ctxt->wellFormed = 0;
- if (ctxt->recovery == 0) ctxt->disableSAX = 1;
- return;
- }
- len = xmlStrlen(entity->content);
- if (len <= 2) goto handle_as_char;
-
- /*
- * Redefine its content as an input stream.
- */
- input = xmlNewEntityInputStream(ctxt, entity);
- xmlPushInput(ctxt, input);
- return;
-
-handle_as_char:
- /*
- * Just handle the content as a set of chars.
- */
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
- (ctxt->sax->characters != NULL))
- ctxt->sax->characters(ctxt->userData, entity->content, len);
-#endif
-}
-
-/**
- * xmlNewGlobalNs:
- * @doc: the document carrying the namespace
- * @href: the URI associated
- * @prefix: the prefix for the namespace
- *
- * Creation of a Namespace, the old way using PI and without scoping
- * DEPRECATED !!!
- * It now create a namespace on the root element of the document if found.
- * Returns NULL this functionality had been removed
- */
-xmlNsPtr
-xmlNewGlobalNs(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *href ATTRIBUTE_UNUSED,
- const xmlChar *prefix ATTRIBUTE_UNUSED) {
- static int deprecated = 0;
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewGlobalNs() deprecated function reached\n");
- deprecated = 1;
- }
- return(NULL);
-#if 0
- xmlNodePtr root;
-
- xmlNsPtr cur;
-
- root = xmlDocGetRootElement(doc);
- if (root != NULL)
- return(xmlNewNs(root, href, prefix));
-
- /*
- * if there is no root element yet, create an old Namespace type
- * and it will be moved to the root at save time.
- */
- cur = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewGlobalNs : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlNs));
- cur->type = XML_GLOBAL_NAMESPACE;
-
- if (href != NULL)
- cur->href = xmlStrdup(href);
- if (prefix != NULL)
- cur->prefix = xmlStrdup(prefix);
-
- /*
- * Add it at the end to preserve parsing order ...
- */
- if (doc != NULL) {
- if (doc->oldNs == NULL) {
- doc->oldNs = cur;
- } else {
- xmlNsPtr prev = doc->oldNs;
-
- while (prev->next != NULL) prev = prev->next;
- prev->next = cur;
- }
- }
-
- return(NULL);
-#endif
-}
-
-/**
- * xmlUpgradeOldNs:
- * @doc: a document pointer
- *
- * Upgrade old style Namespaces (PI) and move them to the root of the document.
- * DEPRECATED
- */
-void
-xmlUpgradeOldNs(xmlDocPtr doc ATTRIBUTE_UNUSED) {
- static int deprecated = 0;
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlUpgradeOldNs() deprecated function reached\n");
- deprecated = 1;
- }
-#if 0
- xmlNsPtr cur;
-
- if ((doc == NULL) || (doc->oldNs == NULL)) return;
- if (doc->children == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlUpgradeOldNs: failed no root !\n");
-#endif
- return;
- }
-
- cur = doc->oldNs;
- while (cur->next != NULL) {
- cur->type = XML_LOCAL_NAMESPACE;
- cur = cur->next;
- }
- cur->type = XML_LOCAL_NAMESPACE;
- cur->next = doc->children->nsDef;
- doc->children->nsDef = doc->oldNs;
- doc->oldNs = NULL;
-#endif
-}
-
diff --git a/bundle/libxml/stamp-h.in b/bundle/libxml/stamp-h.in
deleted file mode 100644
index 9788f70238..0000000000
--- a/bundle/libxml/stamp-h.in
+++ /dev/null
@@ -1 +0,0 @@
-timestamp
diff --git a/bundle/libxml/threads.c b/bundle/libxml/threads.c
deleted file mode 100644
index 6aa5ecc307..0000000000
--- a/bundle/libxml/threads.c
+++ /dev/null
@@ -1,537 +0,0 @@
-/**
- * threads.c: set of generic threading related routines
- *
- * See Copyright for the status of this software.
- *
- * Gary Pennington <Gary.Pennington@uk.sun.com>
- * daniel@veillard.com
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#include <string.h>
-
-#include <libxml/threads.h>
-#include <libxml/globals.h>
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
-#endif
-
-#ifdef HAVE_WIN32_THREADS
-#include <windows.h>
-#ifndef HAVE_COMPILER_TLS
-#include <process.h>
-#endif
-#endif
-
-#if defined(SOLARIS)
-#include <note.h>
-#endif
-
-/* #define DEBUG_THREADS */
-
-/*
- * TODO: this module still uses malloc/free and not xmlMalloc/xmlFree
- * to avoid some crazyness since xmlMalloc/xmlFree may actually
- * be hosted on allocated blocks needing them for the allocation ...
- */
-
-/*
- * xmlMutex are a simple mutual exception locks
- */
-struct _xmlMutex {
-#ifdef HAVE_PTHREAD_H
- pthread_mutex_t lock;
-#elif defined HAVE_WIN32_THREADS
- HANDLE mutex;
-#else
- int empty;
-#endif
-};
-
-/*
- * xmlRMutex are reentrant mutual exception locks
- */
-struct _xmlRMutex {
-#ifdef HAVE_PTHREAD_H
- pthread_mutex_t lock;
- unsigned int held;
- unsigned int waiters;
- pthread_t tid;
- pthread_cond_t cv;
-#elif defined HAVE_WIN32_THREADS
- CRITICAL_SECTION cs;
- unsigned int count;
-#else
- int empty;
-#endif
-};
-/*
- * This module still has some internal static data.
- * - xmlLibraryLock a global lock
- * - globalkey used for per-thread data
- */
-
-#ifdef HAVE_PTHREAD_H
-static pthread_key_t globalkey;
-static pthread_t mainthread;
-static pthread_once_t once_control = PTHREAD_ONCE_INIT;
-#elif defined HAVE_WIN32_THREADS
-#if defined(HAVE_COMPILER_TLS)
-static __declspec(thread) xmlGlobalState tlstate;
-static __declspec(thread) int tlstate_inited = 0;
-#else /* HAVE_COMPILER_TLS */
-static DWORD globalkey;
-#endif /* HAVE_COMPILER_TLS */
-static DWORD mainthread;
-static int run_once_init = 1;
-#endif /* HAVE_WIN32_THREADS */
-
-static xmlRMutexPtr xmlLibraryLock = NULL;
-static void xmlOnceInit(void);
-
-/**
- * xmlNewMutex:
- *
- * xmlNewMutex() is used to allocate a libxml2 token struct for use in
- * synchronizing access to data.
- *
- * Returns a new simple mutex pointer or NULL in case of error
- */
-xmlMutexPtr
-xmlNewMutex(void)
-{
- xmlMutexPtr tok;
-
- if ((tok = malloc(sizeof(xmlMutex))) == NULL)
- return (NULL);
-#ifdef HAVE_PTHREAD_H
- pthread_mutex_init(&tok->lock, NULL);
-#elif defined HAVE_WIN32_THREADS
- tok->mutex = CreateMutex(NULL, FALSE, NULL);
-#endif
- return (tok);
-}
-
-/**
- * xmlFreeMutex:
- * @tok: the simple mutex
- *
- * xmlFreeMutex() is used to reclaim resources associated with a libxml2 token
- * struct.
- */
-void
-xmlFreeMutex(xmlMutexPtr tok)
-{
-#ifdef HAVE_PTHREAD_H
- pthread_mutex_destroy(&tok->lock);
-#elif defined HAVE_WIN32_THREADS
- CloseHandle(tok->mutex);
-#endif
- free(tok);
-}
-
-/**
- * xmlMutexLock:
- * @tok: the simple mutex
- *
- * xmlMutexLock() is used to lock a libxml2 token.
- */
-void
-xmlMutexLock(xmlMutexPtr tok ATTRIBUTE_UNUSED)
-{
-#ifdef HAVE_PTHREAD_H
- pthread_mutex_lock(&tok->lock);
-#elif defined HAVE_WIN32_THREADS
- WaitForSingleObject(tok->mutex, INFINITE);
-#endif
-
-}
-
-/**
- * xmlMutexUnlock:
- * @tok: the simple mutex
- *
- * xmlMutexUnlock() is used to unlock a libxml2 token.
- */
-void
-xmlMutexUnlock(xmlMutexPtr tok ATTRIBUTE_UNUSED)
-{
-#ifdef HAVE_PTHREAD_H
- pthread_mutex_unlock(&tok->lock);
-#elif defined HAVE_WIN32_THREADS
- ReleaseMutex(tok->mutex);
-#endif
-}
-
-/**
- * xmlNewRMutex:
- *
- * xmlRNewMutex() is used to allocate a reentrant mutex for use in
- * synchronizing access to data. token_r is a re-entrant lock and thus useful
- * for synchronizing access to data structures that may be manipulated in a
- * recursive fashion.
- *
- * Returns the new reentrant mutex pointer or NULL in case of error
- */
-xmlRMutexPtr
-xmlNewRMutex(void)
-{
- xmlRMutexPtr tok;
-
- if ((tok = malloc(sizeof(xmlRMutex))) == NULL)
- return (NULL);
-#ifdef HAVE_PTHREAD_H
- pthread_mutex_init(&tok->lock, NULL);
- tok->held = 0;
- tok->waiters = 0;
-#elif defined HAVE_WIN32_THREADS
- InitializeCriticalSection(&tok->cs);
- tok->count = 0;
-#endif
- return (tok);
-}
-
-/**
- * xmlFreeRMutex:
- * @tok: the reentrant mutex
- *
- * xmlRFreeMutex() is used to reclaim resources associated with a
- * reentrant mutex.
- */
-void
-xmlFreeRMutex(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
-{
-#ifdef HAVE_PTHREAD_H
- pthread_mutex_destroy(&tok->lock);
-#elif defined HAVE_WIN32_THREADS
- DeleteCriticalSection(&tok->cs);
-#endif
- free(tok);
-}
-
-/**
- * xmlRMutexLock:
- * @tok: the reentrant mutex
- *
- * xmlRMutexLock() is used to lock a libxml2 token_r.
- */
-void
-xmlRMutexLock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
-{
-#ifdef HAVE_PTHREAD_H
- pthread_mutex_lock(&tok->lock);
- if (tok->held) {
- if (pthread_equal(tok->tid, pthread_self())) {
- tok->held++;
- pthread_mutex_unlock(&tok->lock);
- return;
- } else {
- tok->waiters++;
- while (tok->held)
- pthread_cond_wait(&tok->cv, &tok->lock);
- tok->waiters--;
- }
- }
- tok->tid = pthread_self();
- tok->held = 1;
- pthread_mutex_unlock(&tok->lock);
-#elif defined HAVE_WIN32_THREADS
- EnterCriticalSection(&tok->cs);
- ++tok->count;
-#endif
-}
-
-/**
- * xmlRMutexUnlock:
- * @tok: the reentrant mutex
- *
- * xmlRMutexUnlock() is used to unlock a libxml2 token_r.
- */
-void
-xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
-{
-#ifdef HAVE_PTHREAD_H
- pthread_mutex_lock(&tok->lock);
- tok->held--;
- if (tok->held == 0) {
- if (tok->waiters)
- pthread_cond_signal(&tok->cv);
- tok->tid = 0;
- }
- pthread_mutex_unlock(&tok->lock);
-#elif defined HAVE_WIN32_THREADS
- if (!--tok->count)
- LeaveCriticalSection(&tok->cs);
-#endif
-}
-
-/************************************************************************
- * *
- * Per thread global state handling *
- * *
- ************************************************************************/
-
-#ifdef LIBXML_THREAD_ENABLED
-/**
- * xmlFreeGlobalState:
- * @state: a thread global state
- *
- * xmlFreeGlobalState() is called when a thread terminates with a non-NULL
- * global state. It is is used here to reclaim memory resources.
- */
-static void
-xmlFreeGlobalState(void *state)
-{
- free(state);
-}
-
-/**
- * xmlNewGlobalState:
- *
- * xmlNewGlobalState() allocates a global state. This structure is used to
- * hold all data for use by a thread when supporting backwards compatibility
- * of libxml2 to pre-thread-safe behaviour.
- *
- * Returns the newly allocated xmlGlobalStatePtr or NULL in case of error
- */
-static xmlGlobalStatePtr
-xmlNewGlobalState(void)
-{
- xmlGlobalState *gs;
-
- gs = malloc(sizeof(xmlGlobalState));
- if (gs == NULL)
- return(NULL);
-
- memset(gs, 0, sizeof(xmlGlobalState));
- xmlInitializeGlobalState(gs);
- return (gs);
-}
-#endif /* LIBXML_THREAD_ENABLED */
-
-
-#ifdef HAVE_WIN32_THREADS
-#if !defined(HAVE_COMPILER_TLS)
-typedef struct _xmlGlobalStateCleanupHelperParams
-{
- HANDLE thread;
- void *memory;
-} xmlGlobalStateCleanupHelperParams;
-
-static void xmlGlobalStateCleanupHelper (void *p)
-{
- xmlGlobalStateCleanupHelperParams *params = (xmlGlobalStateCleanupHelperParams *) p;
- WaitForSingleObject(params->thread, INFINITE);
- CloseHandle(params->thread);
- xmlFreeGlobalState(params->memory);
- free(params);
- _endthread();
-}
-#endif /* HAVE_COMPILER_TLS */
-#endif /* HAVE_WIN32_THREADS */
-
-/**
- * xmlGetGlobalState:
- *
- * xmlGetGlobalState() is called to retrieve the global state for a thread.
- *
- * Returns the thread global state or NULL in case of error
- */
-xmlGlobalStatePtr
-xmlGetGlobalState(void)
-{
-#ifdef HAVE_PTHREAD_H
- xmlGlobalState *globalval;
-
- pthread_once(&once_control, xmlOnceInit);
-
- if ((globalval = (xmlGlobalState *)
- pthread_getspecific(globalkey)) == NULL) {
- xmlGlobalState *tsd = xmlNewGlobalState();
-
- pthread_setspecific(globalkey, tsd);
- return (tsd);
- }
- return (globalval);
-#elif defined HAVE_WIN32_THREADS
-#if defined(HAVE_COMPILER_TLS)
- if (!tlstate_inited) {
- tlstate_inited = 1;
- xmlInitializeGlobalState(&tlstate);
- }
- return &tlstate;
-#else /* HAVE_COMPILER_TLS */
- xmlGlobalState *globalval;
-
- if (run_once_init) {
- run_once_init = 0;
- xmlOnceInit();
- }
- if ((globalval = (xmlGlobalState *) TlsGetValue(globalkey)) == NULL) {
- xmlGlobalState *tsd = xmlNewGlobalState();
- xmlGlobalStateCleanupHelperParams *p =
- (xmlGlobalStateCleanupHelperParams *) malloc(sizeof(xmlGlobalStateCleanupHelperParams));
- p->memory = tsd;
- DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),
- GetCurrentProcess(), &p->thread, 0, TRUE, DUPLICATE_SAME_ACCESS);
- TlsSetValue(globalkey, tsd);
- _beginthread(xmlGlobalStateCleanupHelper, 0, p);
-
- return (tsd);
- }
- return (globalval);
-#endif /* HAVE_COMPILER_TLS */
-#else
- return(NULL);
-#endif
-}
-
-/************************************************************************
- * *
- * Library wide thread interfaces *
- * *
- ************************************************************************/
-
-/**
- * xmlGetThreadId:
- *
- * xmlGetThreadId() find the current thread ID number
- *
- * Returns the current thread ID number
- */
-int
-xmlGetThreadId(void)
-{
-#ifdef HAVE_PTHREAD_H
- return((int) pthread_self());
-#elif defined HAVE_WIN32_THREADS
- return GetCurrentThreadId();
-#else
- return((int) 0);
-#endif
-}
-
-/**
- * xmlIsMainThread:
- *
- * xmlIsMainThread() check whether the current thread is the main thread.
- *
- * Returns 1 if the current thread is the main thread, 0 otherwise
- */
-int
-xmlIsMainThread(void)
-{
-#ifdef HAVE_PTHREAD_H
- pthread_once(&once_control, xmlOnceInit);
-#elif defined HAVE_WIN32_THREADS
- if (run_once_init) {
- run_once_init = 0;
- xmlOnceInit ();
- }
-#endif
-
-#ifdef DEBUG_THREADS
- xmlGenericError(xmlGenericErrorContext, "xmlIsMainThread()\n");
-#endif
-#ifdef HAVE_PTHREAD_H
- return(mainthread == pthread_self());
-#elif defined HAVE_WIN32_THREADS
- return(mainthread == GetCurrentThreadId ());
-#else
- return(1);
-#endif
-}
-
-/**
- * xmlLockLibrary:
- *
- * xmlLockLibrary() is used to take out a re-entrant lock on the libxml2
- * library.
- */
-void
-xmlLockLibrary(void)
-{
-#ifdef DEBUG_THREADS
- xmlGenericError(xmlGenericErrorContext, "xmlLockLibrary()\n");
-#endif
- xmlRMutexLock(xmlLibraryLock);
-}
-
-/**
- * xmlUnlockLibrary:
- *
- * xmlUnlockLibrary() is used to release a re-entrant lock on the libxml2
- * library.
- */
-void
-xmlUnlockLibrary(void)
-{
-#ifdef DEBUG_THREADS
- xmlGenericError(xmlGenericErrorContext, "xmlUnlockLibrary()\n");
-#endif
- xmlRMutexUnlock(xmlLibraryLock);
-}
-
-/**
- * xmlInitThreads:
- *
- * xmlInitThreads() is used to to initialize all the thread related
- * data of the libxml2 library.
- */
-void
-xmlInitThreads(void)
-{
-#ifdef DEBUG_THREADS
- xmlGenericError(xmlGenericErrorContext, "xmlInitThreads()\n");
-#endif
-}
-
-/**
- * xmlCleanupThreads:
- *
- * xmlCleanupThreads() is used to to cleanup all the thread related
- * data of the libxml2 library once processing has ended.
- */
-void
-xmlCleanupThreads(void)
-{
-#ifdef DEBUG_THREADS
- xmlGenericError(xmlGenericErrorContext, "xmlCleanupThreads()\n");
-#endif
-}
-
-/**
- * xmlOnceInit
- *
- * xmlOnceInit() is used to initialize the value of mainthread for use
- * in other routines. This function should only be called using
- * pthread_once() in association with the once_control variable to ensure
- * that the function is only called once. See man pthread_once for more
- * details.
- */
-static void
-xmlOnceInit(void) {
-#ifdef HAVE_PTHREAD_H
- (void) pthread_key_create(&globalkey, xmlFreeGlobalState);
- mainthread = pthread_self();
-#endif
-
-#if defined(HAVE_WIN32_THREADS)
-#if !defined(HAVE_COMPILER_TLS)
- globalkey = TlsAlloc();
-#endif
- mainthread = GetCurrentThreadId();
-#endif
-}
diff --git a/bundle/libxml/tree.c b/bundle/libxml/tree.c
deleted file mode 100644
index c3d304501f..0000000000
--- a/bundle/libxml/tree.c
+++ /dev/null
@@ -1,7566 +0,0 @@
-/*
- * tree.c : implementation of access function for an XML tree.
- *
- * References:
- * XHTML 1.0 W3C REC: http://www.w3.org/TR/2002/REC-xhtml1-20020801/
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- *
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#include <string.h> /* for memset() only ! */
-
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_ZLIB_H
-#include <zlib.h>
-#endif
-
-#include <libxml/xmlmemory.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/uri.h>
-#include <libxml/entities.h>
-#include <libxml/valid.h>
-#include <libxml/xmlerror.h>
-#include <libxml/parserInternals.h>
-#include <libxml/globals.h>
-#ifdef LIBXML_HTML_ENABLED
-#include <libxml/HTMLtree.h>
-#endif
-
-xmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
-
-/************************************************************************
- * *
- * A few static variables and macros *
- * *
- ************************************************************************/
-/* #undef xmlStringText */
-const xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
-/* #undef xmlStringTextNoenc */
-const xmlChar xmlStringTextNoenc[] =
- { 't', 'e', 'x', 't', 'n', 'o', 'e', 'n', 'c', 0 };
-/* #undef xmlStringComment */
-const xmlChar xmlStringComment[] = { 'c', 'o', 'm', 'm', 'e', 'n', 't', 0 };
-
-static int xmlCompressMode = 0;
-static int xmlCheckDTD = 1;
-
-#define UPDATE_LAST_CHILD_AND_PARENT(n) if ((n) != NULL) { \
- xmlNodePtr ulccur = (n)->children; \
- if (ulccur == NULL) { \
- (n)->last = NULL; \
- } else { \
- while (ulccur->next != NULL) { \
- ulccur->parent = (n); \
- ulccur = ulccur->next; \
- } \
- ulccur->parent = (n); \
- (n)->last = ulccur; \
-}}
-
-/* #define DEBUG_BUFFER */
-/* #define DEBUG_TREE */
-
-/************************************************************************
- * *
- * Functions to move to entities.c once the *
- * API freeze is smoothen and they can be made public. *
- * *
- ************************************************************************/
-#include <libxml/hash.h>
-
-/**
- * xmlGetEntityFromDtd:
- * @dtd: A pointer to the DTD to search
- * @name: The entity name
- *
- * Do an entity lookup in the DTD entity hash table and
- * return the corresponding entity, if found.
- *
- * Returns A pointer to the entity structure or NULL if not found.
- */
-static xmlEntityPtr
-xmlGetEntityFromDtd(xmlDtdPtr dtd, const xmlChar *name) {
- xmlEntitiesTablePtr table;
-
- if((dtd != NULL) && (dtd->entities != NULL)) {
- table = (xmlEntitiesTablePtr) dtd->entities;
- return((xmlEntityPtr) xmlHashLookup(table, name));
- /* return(xmlGetEntityFromTable(table, name)); */
- }
- return(NULL);
-}
-/**
- * xmlGetParameterEntityFromDtd:
- * @dtd: A pointer to the DTD to search
- * @name: The entity name
- *
- * Do an entity lookup in the DTD pararmeter entity hash table and
- * return the corresponding entity, if found.
- *
- * Returns A pointer to the entity structure or NULL if not found.
- */
-static xmlEntityPtr
-xmlGetParameterEntityFromDtd(xmlDtdPtr dtd, const xmlChar *name) {
- xmlEntitiesTablePtr table;
-
- if ((dtd != NULL) && (dtd->pentities != NULL)) {
- table = (xmlEntitiesTablePtr) dtd->pentities;
- return((xmlEntityPtr) xmlHashLookup(table, name));
- /* return(xmlGetEntityFromTable(table, name)); */
- }
- return(NULL);
-}
-
-/************************************************************************
- * *
- * Allocation and deallocation of basic structures *
- * *
- ************************************************************************/
-
-/**
- * xmlSetBufferAllocationScheme:
- * @scheme: allocation method to use
- *
- * Set the buffer allocation method. Types are
- * XML_BUFFER_ALLOC_EXACT - use exact sizes, keeps memory usage down
- * XML_BUFFER_ALLOC_DOUBLEIT - double buffer when extra needed,
- * improves performance
- */
-void
-xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme) {
- xmlBufferAllocScheme = scheme;
-}
-
-/**
- * xmlGetBufferAllocationScheme:
- *
- * Types are
- * XML_BUFFER_ALLOC_EXACT - use exact sizes, keeps memory usage down
- * XML_BUFFER_ALLOC_DOUBLEIT - double buffer when extra needed,
- * improves performance
- *
- * Returns the current allocation scheme
- */
-xmlBufferAllocationScheme
-xmlGetBufferAllocationScheme(void) {
- return(xmlBufferAllocScheme);
-}
-
-/**
- * xmlNewNs:
- * @node: the element carrying the namespace
- * @href: the URI associated
- * @prefix: the prefix for the namespace
- *
- * Creation of a new Namespace. This function will refuse to create
- * a namespace with a similar prefix than an existing one present on this
- * node.
- * We use href==NULL in the case of an element creation where the namespace
- * was not defined.
- * Returns a new namespace pointer or NULL
- */
-xmlNsPtr
-xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix) {
- xmlNsPtr cur;
-
- if ((node != NULL) && (node->type != XML_ELEMENT_NODE))
- return(NULL);
-
- if ((prefix != NULL) && (xmlStrEqual(prefix, BAD_CAST "xml")))
- return(NULL);
-
- /*
- * Allocate a new Namespace and fill the fields.
- */
- cur = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewNs : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlNs));
- cur->type = XML_LOCAL_NAMESPACE;
-
- if (href != NULL)
- cur->href = xmlStrdup(href);
- if (prefix != NULL)
- cur->prefix = xmlStrdup(prefix);
-
- /*
- * Add it at the end to preserve parsing order ...
- * and checks for existing use of the prefix
- */
- if (node != NULL) {
- if (node->nsDef == NULL) {
- node->nsDef = cur;
- } else {
- xmlNsPtr prev = node->nsDef;
-
- if (((prev->prefix == NULL) && (cur->prefix == NULL)) ||
- (xmlStrEqual(prev->prefix, cur->prefix))) {
- xmlFreeNs(cur);
- return(NULL);
- }
- while (prev->next != NULL) {
- prev = prev->next;
- if (((prev->prefix == NULL) && (cur->prefix == NULL)) ||
- (xmlStrEqual(prev->prefix, cur->prefix))) {
- xmlFreeNs(cur);
- return(NULL);
- }
- }
- prev->next = cur;
- }
- }
- return(cur);
-}
-
-/**
- * xmlSetNs:
- * @node: a node in the document
- * @ns: a namespace pointer
- *
- * Associate a namespace to a node, a posteriori.
- */
-void
-xmlSetNs(xmlNodePtr node, xmlNsPtr ns) {
- if (node == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlSetNs: node == NULL\n");
-#endif
- return;
- }
- node->ns = ns;
-}
-
-/**
- * xmlFreeNs:
- * @cur: the namespace pointer
- *
- * Free up the structures associated to a namespace
- */
-void
-xmlFreeNs(xmlNsPtr cur) {
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlFreeNs : ns == NULL\n");
-#endif
- return;
- }
- if (cur->href != NULL) xmlFree((char *) cur->href);
- if (cur->prefix != NULL) xmlFree((char *) cur->prefix);
- xmlFree(cur);
-}
-
-/**
- * xmlFreeNsList:
- * @cur: the first namespace pointer
- *
- * Free up all the structures associated to the chained namespaces.
- */
-void
-xmlFreeNsList(xmlNsPtr cur) {
- xmlNsPtr next;
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlFreeNsList : ns == NULL\n");
-#endif
- return;
- }
- while (cur != NULL) {
- next = cur->next;
- xmlFreeNs(cur);
- cur = next;
- }
-}
-
-/**
- * xmlNewDtd:
- * @doc: the document pointer
- * @name: the DTD name
- * @ExternalID: the external ID
- * @SystemID: the system ID
- *
- * Creation of a new DTD for the external subset. To create an
- * internal subset, use xmlCreateIntSubset().
- *
- * Returns a pointer to the new DTD structure
- */
-xmlDtdPtr
-xmlNewDtd(xmlDocPtr doc, const xmlChar *name,
- const xmlChar *ExternalID, const xmlChar *SystemID) {
- xmlDtdPtr cur;
-
- if ((doc != NULL) && (doc->extSubset != NULL)) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewDtd(%s): document %s already have a DTD %s\n",
- /* !!! */ (char *) name, doc->name,
- /* !!! */ (char *)doc->extSubset->name);
-#endif
- return(NULL);
- }
-
- /*
- * Allocate a new DTD and fill the fields.
- */
- cur = (xmlDtdPtr) xmlMalloc(sizeof(xmlDtd));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewDtd : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0 , sizeof(xmlDtd));
- cur->type = XML_DTD_NODE;
-
- if (name != NULL)
- cur->name = xmlStrdup(name);
- if (ExternalID != NULL)
- cur->ExternalID = xmlStrdup(ExternalID);
- if (SystemID != NULL)
- cur->SystemID = xmlStrdup(SystemID);
- if (doc != NULL)
- doc->extSubset = cur;
- cur->doc = doc;
-
- return(cur);
-}
-
-/**
- * xmlGetIntSubset:
- * @doc: the document pointer
- *
- * Get the internal subset of a document
- * Returns a pointer to the DTD structure or NULL if not found
- */
-
-xmlDtdPtr
-xmlGetIntSubset(xmlDocPtr doc) {
- xmlNodePtr cur;
-
- if (doc == NULL)
- return(NULL);
- cur = doc->children;
- while (cur != NULL) {
- if (cur->type == XML_DTD_NODE)
- return((xmlDtdPtr) cur);
- cur = cur->next;
- }
- return((xmlDtdPtr) doc->intSubset);
-}
-
-/**
- * xmlCreateIntSubset:
- * @doc: the document pointer
- * @name: the DTD name
- * @ExternalID: the external (PUBLIC) ID
- * @SystemID: the system ID
- *
- * Create the internal subset of a document
- * Returns a pointer to the new DTD structure
- */
-xmlDtdPtr
-xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name,
- const xmlChar *ExternalID, const xmlChar *SystemID) {
- xmlDtdPtr cur;
-
- if ((doc != NULL) && (xmlGetIntSubset(doc) != NULL)) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
-
- "xmlCreateIntSubset(): document %s already have an internal subset\n",
- doc->name);
-#endif
- return(NULL);
- }
-
- /*
- * Allocate a new DTD and fill the fields.
- */
- cur = (xmlDtdPtr) xmlMalloc(sizeof(xmlDtd));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlCreateIntSubset : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlDtd));
- cur->type = XML_DTD_NODE;
-
- if (name != NULL)
- cur->name = xmlStrdup(name);
- if (ExternalID != NULL)
- cur->ExternalID = xmlStrdup(ExternalID);
- if (SystemID != NULL)
- cur->SystemID = xmlStrdup(SystemID);
- if (doc != NULL) {
- doc->intSubset = cur;
- cur->parent = doc;
- cur->doc = doc;
- if (doc->children == NULL) {
- doc->children = (xmlNodePtr) cur;
- doc->last = (xmlNodePtr) cur;
- } else {
- if (doc->type == XML_HTML_DOCUMENT_NODE) {
- xmlNodePtr prev;
-
- prev = doc->children;
- prev->prev = (xmlNodePtr) cur;
- cur->next = prev;
- doc->children = (xmlNodePtr) cur;
- } else {
- xmlNodePtr next;
-
- next = doc->children;
- while ((next != NULL) && (next->type != XML_ELEMENT_NODE))
- next = next->next;
- if (next == NULL) {
- cur->prev = doc->last;
- cur->prev->next = (xmlNodePtr) cur;
- cur->next = NULL;
- doc->last = (xmlNodePtr) cur;
- } else {
- cur->next = next;
- cur->prev = next->prev;
- if (cur->prev == NULL)
- doc->children = (xmlNodePtr) cur;
- else
- cur->prev->next = (xmlNodePtr) cur;
- next->prev = (xmlNodePtr) cur;
- }
- }
- }
- }
- return(cur);
-}
-
-/**
- * xmlFreeDtd:
- * @cur: the DTD structure to free up
- *
- * Free a DTD structure.
- */
-void
-xmlFreeDtd(xmlDtdPtr cur) {
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlFreeDtd : DTD == NULL\n");
-#endif
- return;
- }
- if (cur->children != NULL) {
- xmlNodePtr next, c = cur->children;
-
- /*
- * Cleanup all the DTD comments they are not in the DTD
- * indexes.
- */
- while (c != NULL) {
- next = c->next;
- if (c->type == XML_COMMENT_NODE) {
- xmlUnlinkNode(c);
- xmlFreeNode(c);
- }
- c = next;
- }
- }
- if (cur->name != NULL) xmlFree((char *) cur->name);
- if (cur->SystemID != NULL) xmlFree((char *) cur->SystemID);
- if (cur->ExternalID != NULL) xmlFree((char *) cur->ExternalID);
- /* TODO !!! */
- if (cur->notations != NULL)
- xmlFreeNotationTable((xmlNotationTablePtr) cur->notations);
-
- if (cur->elements != NULL)
- xmlFreeElementTable((xmlElementTablePtr) cur->elements);
- if (cur->attributes != NULL)
- xmlFreeAttributeTable((xmlAttributeTablePtr) cur->attributes);
- if (cur->entities != NULL)
- xmlFreeEntitiesTable((xmlEntitiesTablePtr) cur->entities);
- if (cur->pentities != NULL)
- xmlFreeEntitiesTable((xmlEntitiesTablePtr) cur->pentities);
-
- xmlFree(cur);
-}
-
-/**
- * xmlNewDoc:
- * @version: xmlChar string giving the version of XML "1.0"
- *
- * Creates a new XML document
- *
- * Returns a new document
- */
-xmlDocPtr
-xmlNewDoc(const xmlChar *version) {
- xmlDocPtr cur;
-
- if (version == NULL)
- version = (const xmlChar *) "1.0";
-
- /*
- * Allocate a new document and fill the fields.
- */
- cur = (xmlDocPtr) xmlMalloc(sizeof(xmlDoc));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewDoc : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlDoc));
- cur->type = XML_DOCUMENT_NODE;
-
- cur->version = xmlStrdup(version);
- cur->standalone = -1;
- cur->compression = -1; /* not initialized */
- cur->doc = cur;
- cur->charset = XML_CHAR_ENCODING_UTF8;
- return(cur);
-}
-
-/**
- * xmlFreeDoc:
- * @cur: pointer to the document
- *
- * Free up all the structures used by a document, tree included.
- */
-void
-xmlFreeDoc(xmlDocPtr cur) {
- xmlDtdPtr extSubset, intSubset;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlFreeDoc : document == NULL\n");
-#endif
- return;
- }
- /*
- * Do this before freeing the children list to avoid ID lookups
- */
- if (cur->ids != NULL) xmlFreeIDTable((xmlIDTablePtr) cur->ids);
- cur->ids = NULL;
- if (cur->refs != NULL) xmlFreeRefTable((xmlRefTablePtr) cur->refs);
- cur->refs = NULL;
- extSubset = cur->extSubset;
- intSubset = cur->intSubset;
- if (intSubset == extSubset)
- extSubset = NULL;
- if (extSubset != NULL) {
- xmlUnlinkNode((xmlNodePtr) cur->extSubset);
- cur->extSubset = NULL;
- xmlFreeDtd(extSubset);
- }
- if (intSubset != NULL) {
- xmlUnlinkNode((xmlNodePtr) cur->intSubset);
- cur->intSubset = NULL;
- xmlFreeDtd(intSubset);
- }
-
- if (cur->children != NULL) xmlFreeNodeList(cur->children);
-
- if (cur->version != NULL) xmlFree((char *) cur->version);
- if (cur->name != NULL) xmlFree((char *) cur->name);
- if (cur->encoding != NULL) xmlFree((char *) cur->encoding);
- if (cur->oldNs != NULL) xmlFreeNsList(cur->oldNs);
- if (cur->URL != NULL) xmlFree((char *) cur->URL);
- xmlFree(cur);
-}
-
-/**
- * xmlStringLenGetNodeList:
- * @doc: the document
- * @value: the value of the text
- * @len: the length of the string value
- *
- * Parse the value string and build the node list associated. Should
- * produce a flat tree with only TEXTs and ENTITY_REFs.
- * Returns a pointer to the first child
- */
-xmlNodePtr
-xmlStringLenGetNodeList(xmlDocPtr doc, const xmlChar *value, int len) {
- xmlNodePtr ret = NULL, last = NULL;
- xmlNodePtr node;
- xmlChar *val;
- const xmlChar *cur = value;
- const xmlChar *q;
- xmlEntityPtr ent;
-
- if (value == NULL) return(NULL);
-
- q = cur;
- while ((*cur != 0) && (cur - value < len)) {
- if (*cur == '&') {
- /*
- * Save the current text.
- */
- if (cur != q) {
- if ((last != NULL) && (last->type == XML_TEXT_NODE)) {
- xmlNodeAddContentLen(last, q, cur - q);
- } else {
- node = xmlNewDocTextLen(doc, q, cur - q);
- if (node == NULL) return(ret);
- if (last == NULL)
- last = ret = node;
- else {
- last->next = node;
- node->prev = last;
- last = node;
- }
- }
- }
- /*
- * Read the entity string
- */
- cur++;
- q = cur;
- while ((*cur != 0) && (cur - value < len) && (*cur != ';')) cur++;
- if ((*cur == 0) || (cur - value >= len)) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlStringLenGetNodeList: unterminated entity %30s\n", q);
-#endif
- return(ret);
- }
- if (cur != q) {
- /*
- * Predefined entities don't generate nodes
- */
- val = xmlStrndup(q, cur - q);
- ent = xmlGetDocEntity(doc, val);
- if ((ent != NULL) &&
- (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
- if (last == NULL) {
- node = xmlNewDocText(doc, ent->content);
- last = ret = node;
- } else
- xmlNodeAddContent(last, ent->content);
-
- } else {
- /*
- * Create a new REFERENCE_REF node
- */
- node = xmlNewReference(doc, val);
- if (node == NULL) {
- if (val != NULL) xmlFree(val);
- return(ret);
- }
- else if ((ent != NULL) && (ent->children == NULL)) {
- xmlNodePtr tmp;
-
- ent->children =
- xmlStringGetNodeList(doc, (const xmlChar*)node->content);
- tmp = ent->children;
- while (tmp) {
- tmp->parent = (xmlNodePtr)ent;
- tmp = tmp->next;
- }
- }
- if (last == NULL)
- last = ret = node;
- else {
- last->next = node;
- node->prev = last;
- last = node;
- }
- }
- xmlFree(val);
- }
- cur++;
- q = cur;
- } else
- cur++;
- }
- if (cur != q) {
- /*
- * Handle the last piece of text.
- */
- if ((last != NULL) && (last->type == XML_TEXT_NODE)) {
- xmlNodeAddContentLen(last, q, cur - q);
- } else {
- node = xmlNewDocTextLen(doc, q, cur - q);
- if (node == NULL) return(ret);
- if (last == NULL)
- last = ret = node;
- else {
- last->next = node;
- node->prev = last;
- last = node;
- }
- }
- }
- return(ret);
-}
-
-/**
- * xmlStringGetNodeList:
- * @doc: the document
- * @value: the value of the attribute
- *
- * Parse the value string and build the node list associated. Should
- * produce a flat tree with only TEXTs and ENTITY_REFs.
- * Returns a pointer to the first child
- */
-xmlNodePtr
-xmlStringGetNodeList(xmlDocPtr doc, const xmlChar *value) {
- xmlNodePtr ret = NULL, last = NULL;
- xmlNodePtr node;
- xmlChar *val;
- const xmlChar *cur = value;
- const xmlChar *q;
- xmlEntityPtr ent;
-
- if (value == NULL) return(NULL);
-
- q = cur;
- while (*cur != 0) {
- if (cur[0] == '&') {
- int charval = 0;
- xmlChar tmp;
-
- /*
- * Save the current text.
- */
- if (cur != q) {
- if ((last != NULL) && (last->type == XML_TEXT_NODE)) {
- xmlNodeAddContentLen(last, q, cur - q);
- } else {
- node = xmlNewDocTextLen(doc, q, cur - q);
- if (node == NULL) return(ret);
- if (last == NULL)
- last = ret = node;
- else {
- last->next = node;
- node->prev = last;
- last = node;
- }
- }
- }
- q = cur;
- if ((cur[1] == '#') && (cur[2] == 'x')) {
- cur += 3;
- tmp = *cur;
- while (tmp != ';') { /* Non input consuming loop */
- if ((tmp >= '0') && (tmp <= '9'))
- charval = charval * 16 + (tmp - '0');
- else if ((tmp >= 'a') && (tmp <= 'f'))
- charval = charval * 16 + (tmp - 'a') + 10;
- else if ((tmp >= 'A') && (tmp <= 'F'))
- charval = charval * 16 + (tmp - 'A') + 10;
- else {
- xmlGenericError(xmlGenericErrorContext,
- "xmlStringGetNodeList: invalid hexadecimal charvalue\n");
- charval = 0;
- break;
- }
- cur++;
- tmp = *cur;
- }
- if (tmp == ';')
- cur++;
- q = cur;
- } else if (cur[1] == '#') {
- cur += 2;
- tmp = *cur;
- while (tmp != ';') { /* Non input consuming loops */
- if ((tmp >= '0') && (tmp <= '9'))
- charval = charval * 10 + (tmp - '0');
- else {
- xmlGenericError(xmlGenericErrorContext,
- "xmlStringGetNodeList: invalid decimal charvalue\n");
- charval = 0;
- break;
- }
- cur++;
- tmp = *cur;
- }
- if (tmp == ';')
- cur++;
- q = cur;
- } else {
- /*
- * Read the entity string
- */
- cur++;
- q = cur;
- while ((*cur != 0) && (*cur != ';')) cur++;
- if (*cur == 0) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlStringGetNodeList: unterminated entity %30s\n", q);
-#endif
- return(ret);
- }
- if (cur != q) {
- /*
- * Predefined entities don't generate nodes
- */
- val = xmlStrndup(q, cur - q);
- ent = xmlGetDocEntity(doc, val);
- if ((ent != NULL) &&
- (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
- if (last == NULL) {
- node = xmlNewDocText(doc, ent->content);
- last = ret = node;
- } else if (last->type != XML_TEXT_NODE) {
- node = xmlNewDocText(doc, ent->content);
- last = xmlAddNextSibling(last, node);
- } else
- xmlNodeAddContent(last, ent->content);
-
- } else {
- /*
- * Create a new REFERENCE_REF node
- */
- node = xmlNewReference(doc, val);
- if (node == NULL) {
- if (val != NULL) xmlFree(val);
- return(ret);
- }
- else if ((ent != NULL) && (ent->children == NULL)) {
- xmlNodePtr temp;
-
- ent->children = xmlStringGetNodeList(doc,
- (const xmlChar*)node->content);
- temp = ent->children;
- while (temp) {
- temp->parent = (xmlNodePtr)ent;
- temp = temp->next;
- }
- }
- if (last == NULL) {
- last = ret = node;
- } else {
- last = xmlAddNextSibling(last, node);
- }
- }
- xmlFree(val);
- }
- cur++;
- q = cur;
- }
- if (charval != 0) {
- xmlChar buf[10];
- int len;
-
- len = xmlCopyCharMultiByte(buf, charval);
- buf[len] = 0;
- node = xmlNewDocText(doc, buf);
- if (node != NULL) {
- if (last == NULL) {
- last = ret = node;
- } else {
- last = xmlAddNextSibling(last, node);
- }
- }
-
- charval = 0;
- }
- } else
- cur++;
- }
- if ((cur != q) || (ret == NULL)) {
- /*
- * Handle the last piece of text.
- */
- if ((last != NULL) && (last->type == XML_TEXT_NODE)) {
- xmlNodeAddContentLen(last, q, cur - q);
- } else {
- node = xmlNewDocTextLen(doc, q, cur - q);
- if (node == NULL) return(ret);
- if (last == NULL) {
- last = ret = node;
- } else {
- last = xmlAddNextSibling(last, node);
- }
- }
- }
- return(ret);
-}
-
-/**
- * xmlNodeListGetString:
- * @doc: the document
- * @list: a Node list
- * @inLine: should we replace entity contents or show their external form
- *
- * Build the string equivalent to the text contained in the Node list
- * made of TEXTs and ENTITY_REFs
- *
- * Returns a pointer to the string copy, the caller must free it with xmlFree().
- */
-xmlChar *
-xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr list, int inLine)
-{
- xmlNodePtr node = list;
- xmlChar *ret = NULL;
- xmlEntityPtr ent;
-
- if (list == NULL)
- return (NULL);
-
- while (node != NULL) {
- if ((node->type == XML_TEXT_NODE) ||
- (node->type == XML_CDATA_SECTION_NODE)) {
- if (inLine) {
- ret = xmlStrcat(ret, node->content);
- } else {
- xmlChar *buffer;
-
- buffer = xmlEncodeEntitiesReentrant(doc, node->content);
- if (buffer != NULL) {
- ret = xmlStrcat(ret, buffer);
- xmlFree(buffer);
- }
- }
- } else if (node->type == XML_ENTITY_REF_NODE) {
- if (inLine) {
- ent = xmlGetDocEntity(doc, node->name);
- if (ent != NULL) {
- xmlChar *buffer;
-
- /* an entity content can be any "well balanced chunk",
- * i.e. the result of the content [43] production:
- * http://www.w3.org/TR/REC-xml#NT-content.
- * So it can contain text, CDATA section or nested
- * entity reference nodes (among others).
- * -> we recursive call xmlNodeListGetString()
- * which handles these types */
- buffer = xmlNodeListGetString(doc, ent->children, 1);
- if (buffer != NULL) {
- ret = xmlStrcat(ret, buffer);
- xmlFree(buffer);
- }
- } else {
- ret = xmlStrcat(ret, node->content);
- }
- } else {
- xmlChar buf[2];
-
- buf[0] = '&';
- buf[1] = 0;
- ret = xmlStrncat(ret, buf, 1);
- ret = xmlStrcat(ret, node->name);
- buf[0] = ';';
- buf[1] = 0;
- ret = xmlStrncat(ret, buf, 1);
- }
- }
-#if 0
- else {
- xmlGenericError(xmlGenericErrorContext,
- "xmlGetNodeListString : invalid node type %d\n",
- node->type);
- }
-#endif
- node = node->next;
- }
- return (ret);
-}
-/**
- * xmlNodeListGetRawString:
- * @doc: the document
- * @list: a Node list
- * @inLine: should we replace entity contents or show their external form
- *
- * Builds the string equivalent to the text contained in the Node list
- * made of TEXTs and ENTITY_REFs, contrary to xmlNodeListGetString()
- * this function doesn't do any character encoding handling.
- *
- * Returns a pointer to the string copy, the caller must free it with xmlFree().
- */
-xmlChar *
-xmlNodeListGetRawString(xmlDocPtr doc, xmlNodePtr list, int inLine)
-{
- xmlNodePtr node = list;
- xmlChar *ret = NULL;
- xmlEntityPtr ent;
-
- if (list == NULL)
- return (NULL);
-
- while (node != NULL) {
- if ((node->type == XML_TEXT_NODE) ||
- (node->type == XML_CDATA_SECTION_NODE)) {
- if (inLine) {
- ret = xmlStrcat(ret, node->content);
- } else {
- xmlChar *buffer;
-
- buffer = xmlEncodeSpecialChars(doc, node->content);
- if (buffer != NULL) {
- ret = xmlStrcat(ret, buffer);
- xmlFree(buffer);
- }
- }
- } else if (node->type == XML_ENTITY_REF_NODE) {
- if (inLine) {
- ent = xmlGetDocEntity(doc, node->name);
- if (ent != NULL) {
- xmlChar *buffer;
-
- /* an entity content can be any "well balanced chunk",
- * i.e. the result of the content [43] production:
- * http://www.w3.org/TR/REC-xml#NT-content.
- * So it can contain text, CDATA section or nested
- * entity reference nodes (among others).
- * -> we recursive call xmlNodeListGetRawString()
- * which handles these types */
- buffer =
- xmlNodeListGetRawString(doc, ent->children, 1);
- if (buffer != NULL) {
- ret = xmlStrcat(ret, buffer);
- xmlFree(buffer);
- }
- } else {
- ret = xmlStrcat(ret, node->content);
- }
- } else {
- xmlChar buf[2];
-
- buf[0] = '&';
- buf[1] = 0;
- ret = xmlStrncat(ret, buf, 1);
- ret = xmlStrcat(ret, node->name);
- buf[0] = ';';
- buf[1] = 0;
- ret = xmlStrncat(ret, buf, 1);
- }
- }
-#if 0
- else {
- xmlGenericError(xmlGenericErrorContext,
- "xmlGetNodeListString : invalid node type %d\n",
- node->type);
- }
-#endif
- node = node->next;
- }
- return (ret);
-}
-
-/**
- * xmlNewProp:
- * @node: the holding node
- * @name: the name of the attribute
- * @value: the value of the attribute
- *
- * Create a new property carried by a node.
- * Returns a pointer to the attribute
- */
-xmlAttrPtr
-xmlNewProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) {
- xmlAttrPtr cur;
- xmlDocPtr doc = NULL;
-
- if (name == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewProp : name == NULL\n");
-#endif
- return(NULL);
- }
-
- /*
- * Allocate a new property and fill the fields.
- */
- cur = (xmlAttrPtr) xmlMalloc(sizeof(xmlAttr));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewProp : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlAttr));
- cur->type = XML_ATTRIBUTE_NODE;
-
- cur->parent = node;
- if (node != NULL) {
- doc = node->doc;
- cur->doc = doc;
- }
- cur->name = xmlStrdup(name);
- if (value != NULL) {
- xmlChar *buffer;
- xmlNodePtr tmp;
-
- buffer = xmlEncodeEntitiesReentrant(doc, value);
- cur->children = xmlStringGetNodeList(doc, buffer);
- cur->last = NULL;
- tmp = cur->children;
- while (tmp != NULL) {
- tmp->parent = (xmlNodePtr) cur;
- tmp->doc = doc;
- if (tmp->next == NULL)
- cur->last = tmp;
- tmp = tmp->next;
- }
- xmlFree(buffer);
- }
-
- /*
- * Add it at the end to preserve parsing order ...
- */
- if (node != NULL) {
- if (node->properties == NULL) {
- node->properties = cur;
- } else {
- xmlAttrPtr prev = node->properties;
-
- while (prev->next != NULL) prev = prev->next;
- prev->next = cur;
- cur->prev = prev;
- }
- }
- return(cur);
-}
-
-/**
- * xmlNewNsProp:
- * @node: the holding node
- * @ns: the namespace
- * @name: the name of the attribute
- * @value: the value of the attribute
- *
- * Create a new property tagged with a namespace and carried by a node.
- * Returns a pointer to the attribute
- */
-xmlAttrPtr
-xmlNewNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name,
- const xmlChar *value) {
- xmlAttrPtr cur;
- xmlDocPtr doc = NULL;
-
- if (name == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewNsProp : name == NULL\n");
-#endif
- return(NULL);
- }
-
- /*
- * Allocate a new property and fill the fields.
- */
- cur = (xmlAttrPtr) xmlMalloc(sizeof(xmlAttr));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewNsProp : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlAttr));
- cur->type = XML_ATTRIBUTE_NODE;
-
- cur->parent = node;
- if (node != NULL) {
- doc = node->doc;
- cur->doc = doc;
- }
- cur->ns = ns;
- cur->name = xmlStrdup(name);
- if (value != NULL) {
- xmlChar *buffer;
- xmlNodePtr tmp;
-
- buffer = xmlEncodeEntitiesReentrant(doc, value);
- cur->children = xmlStringGetNodeList(doc, buffer);
- cur->last = NULL;
- tmp = cur->children;
- while (tmp != NULL) {
- tmp->parent = (xmlNodePtr) cur;
- if (tmp->next == NULL)
- cur->last = tmp;
- tmp = tmp->next;
- }
- xmlFree(buffer);
- }
-
- /*
- * Add it at the end to preserve parsing order ...
- */
- if (node != NULL) {
- if (node->properties == NULL) {
- node->properties = cur;
- } else {
- xmlAttrPtr prev = node->properties;
-
- while (prev->next != NULL) prev = prev->next;
- prev->next = cur;
- cur->prev = prev;
- }
- }
- return(cur);
-}
-
-/**
- * xmlNewNsPropEatName:
- * @node: the holding node
- * @ns: the namespace
- * @name: the name of the attribute
- * @value: the value of the attribute
- *
- * Create a new property tagged with a namespace and carried by a node.
- * Returns a pointer to the attribute
- */
-xmlAttrPtr
-xmlNewNsPropEatName(xmlNodePtr node, xmlNsPtr ns, xmlChar *name,
- const xmlChar *value) {
- xmlAttrPtr cur;
- xmlDocPtr doc = NULL;
-
- if (name == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewNsPropEatName : name == NULL\n");
-#endif
- return(NULL);
- }
-
- /*
- * Allocate a new property and fill the fields.
- */
- cur = (xmlAttrPtr) xmlMalloc(sizeof(xmlAttr));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewNsPropEatName : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlAttr));
- cur->type = XML_ATTRIBUTE_NODE;
-
- cur->parent = node;
- if (node != NULL) {
- doc = node->doc;
- cur->doc = doc;
- }
- cur->ns = ns;
- cur->name = name;
- if (value != NULL) {
- xmlChar *buffer;
- xmlNodePtr tmp;
-
- buffer = xmlEncodeEntitiesReentrant(doc, value);
- cur->children = xmlStringGetNodeList(doc, buffer);
- cur->last = NULL;
- tmp = cur->children;
- while (tmp != NULL) {
- tmp->parent = (xmlNodePtr) cur;
- if (tmp->next == NULL)
- cur->last = tmp;
- tmp = tmp->next;
- }
- xmlFree(buffer);
- }
-
- /*
- * Add it at the end to preserve parsing order ...
- */
- if (node != NULL) {
- if (node->properties == NULL) {
- node->properties = cur;
- } else {
- xmlAttrPtr prev = node->properties;
-
- while (prev->next != NULL) prev = prev->next;
- prev->next = cur;
- cur->prev = prev;
- }
- }
- return(cur);
-}
-
-/**
- * xmlNewDocProp:
- * @doc: the document
- * @name: the name of the attribute
- * @value: the value of the attribute
- *
- * Create a new property carried by a document.
- * Returns a pointer to the attribute
- */
-xmlAttrPtr
-xmlNewDocProp(xmlDocPtr doc, const xmlChar *name, const xmlChar *value) {
- xmlAttrPtr cur;
-
- if (name == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewDocProp : name == NULL\n");
-#endif
- return(NULL);
- }
-
- /*
- * Allocate a new property and fill the fields.
- */
- cur = (xmlAttrPtr) xmlMalloc(sizeof(xmlAttr));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewDocProp : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlAttr));
- cur->type = XML_ATTRIBUTE_NODE;
-
- cur->name = xmlStrdup(name);
- cur->doc = doc;
- if (value != NULL) {
- xmlNodePtr tmp;
-
- cur->children = xmlStringGetNodeList(doc, value);
- cur->last = NULL;
-
- tmp = cur->children;
- while (tmp != NULL) {
- tmp->parent = (xmlNodePtr) cur;
- if (tmp->next == NULL)
- cur->last = tmp;
- tmp = tmp->next;
- }
- }
- return(cur);
-}
-
-/**
- * xmlFreePropList:
- * @cur: the first property in the list
- *
- * Free a property and all its siblings, all the children are freed too.
- */
-void
-xmlFreePropList(xmlAttrPtr cur) {
- xmlAttrPtr next;
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlFreePropList : property == NULL\n");
-#endif
- return;
- }
- while (cur != NULL) {
- next = cur->next;
- xmlFreeProp(cur);
- cur = next;
- }
-}
-
-/**
- * xmlFreeProp:
- * @cur: an attribute
- *
- * Free one attribute, all the content is freed too
- */
-void
-xmlFreeProp(xmlAttrPtr cur) {
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlFreeProp : property == NULL\n");
-#endif
- return;
- }
- /* Check for ID removal -> leading to invalid references ! */
- if ((cur->parent != NULL) && (cur->parent->doc != NULL) &&
- ((cur->parent->doc->intSubset != NULL) ||
- (cur->parent->doc->extSubset != NULL))) {
- if (xmlIsID(cur->parent->doc, cur->parent, cur))
- xmlRemoveID(cur->parent->doc, cur);
- }
- if (cur->name != NULL) xmlFree((char *) cur->name);
- if (cur->children != NULL) xmlFreeNodeList(cur->children);
- xmlFree(cur);
-}
-
-/**
- * xmlRemoveProp:
- * @cur: an attribute
- *
- * Unlink and free one attribute, all the content is freed too
- * Note this doesn't work for namespace definition attributes
- *
- * Returns 0 if success and -1 in case of error.
- */
-int
-xmlRemoveProp(xmlAttrPtr cur) {
- xmlAttrPtr tmp;
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlRemoveProp : cur == NULL\n");
-#endif
- return(-1);
- }
- if (cur->parent == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlRemoveProp : cur->parent == NULL\n");
-#endif
- return(-1);
- }
- tmp = cur->parent->properties;
- if (tmp == cur) {
- cur->parent->properties = cur->next;
- xmlFreeProp(cur);
- return(0);
- }
- while (tmp != NULL) {
- if (tmp->next == cur) {
- tmp->next = cur->next;
- if (tmp->next != NULL)
- tmp->next->prev = tmp;
- xmlFreeProp(cur);
- return(0);
- }
- tmp = tmp->next;
- }
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlRemoveProp : attribute not owned by its node\n");
-#endif
- return(-1);
-}
-
-/**
- * xmlNewPI:
- * @name: the processing instruction name
- * @content: the PI content
- *
- * Creation of a processing instruction element.
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewPI(const xmlChar *name, const xmlChar *content) {
- xmlNodePtr cur;
-
- if (name == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewPI : name == NULL\n");
-#endif
- return(NULL);
- }
-
- /*
- * Allocate a new node and fill the fields.
- */
- cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewPI : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlNode));
- cur->type = XML_PI_NODE;
-
- cur->name = xmlStrdup(name);
- if (content != NULL) {
- cur->content = xmlStrdup(content);
- }
- return(cur);
-}
-
-/**
- * xmlNewNode:
- * @ns: namespace if any
- * @name: the node name
- *
- * Creation of a new node element. @ns is optional (NULL).
- *
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewNode(xmlNsPtr ns, const xmlChar *name) {
- xmlNodePtr cur;
-
- if (name == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewNode : name == NULL\n");
-#endif
- return(NULL);
- }
-
- /*
- * Allocate a new node and fill the fields.
- */
- cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewNode : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlNode));
- cur->type = XML_ELEMENT_NODE;
-
- cur->name = xmlStrdup(name);
- cur->ns = ns;
- return(cur);
-}
-
-/**
- * xmlNewNodeEatName:
- * @ns: namespace if any
- * @name: the node name
- *
- * Creation of a new node element. @ns is optional (NULL).
- *
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewNodeEatName(xmlNsPtr ns, xmlChar *name) {
- xmlNodePtr cur;
-
- if (name == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewNode : name == NULL\n");
-#endif
- return(NULL);
- }
-
- /*
- * Allocate a new node and fill the fields.
- */
- cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewNode : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlNode));
- cur->type = XML_ELEMENT_NODE;
-
- cur->name = name;
- cur->ns = ns;
- return(cur);
-}
-
-/**
- * xmlNewDocNode:
- * @doc: the document
- * @ns: namespace if any
- * @name: the node name
- * @content: the XML text content if any
- *
- * Creation of a new node element within a document. @ns and @content
- * are optional (NULL).
- * NOTE: @content is supposed to be a piece of XML CDATA, so it allow entities
- * references, but XML special chars need to be escaped first by using
- * xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you don't
- * need entities support.
- *
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewDocNode(xmlDocPtr doc, xmlNsPtr ns,
- const xmlChar *name, const xmlChar *content) {
- xmlNodePtr cur;
-
- cur = xmlNewNode(ns, name);
- if (cur != NULL) {
- cur->doc = doc;
- if (content != NULL) {
- cur->children = xmlStringGetNodeList(doc, content);
- UPDATE_LAST_CHILD_AND_PARENT(cur)
- }
- }
- return(cur);
-}
-
-/**
- * xmlNewDocNodeEatName:
- * @doc: the document
- * @ns: namespace if any
- * @name: the node name
- * @content: the XML text content if any
- *
- * Creation of a new node element within a document. @ns and @content
- * are optional (NULL).
- * NOTE: @content is supposed to be a piece of XML CDATA, so it allow entities
- * references, but XML special chars need to be escaped first by using
- * xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you don't
- * need entities support.
- *
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewDocNodeEatName(xmlDocPtr doc, xmlNsPtr ns,
- xmlChar *name, const xmlChar *content) {
- xmlNodePtr cur;
-
- cur = xmlNewNodeEatName(ns, name);
- if (cur != NULL) {
- cur->doc = doc;
- if (content != NULL) {
- cur->children = xmlStringGetNodeList(doc, content);
- UPDATE_LAST_CHILD_AND_PARENT(cur)
- }
- }
- return(cur);
-}
-
-
-/**
- * xmlNewDocRawNode:
- * @doc: the document
- * @ns: namespace if any
- * @name: the node name
- * @content: the text content if any
- *
- * Creation of a new node element within a document. @ns and @content
- * are optional (NULL).
- *
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewDocRawNode(xmlDocPtr doc, xmlNsPtr ns,
- const xmlChar *name, const xmlChar *content) {
- xmlNodePtr cur;
-
- cur = xmlNewNode(ns, name);
- if (cur != NULL) {
- cur->doc = doc;
- if (content != NULL) {
- cur->children = xmlNewDocText(doc, content);
- UPDATE_LAST_CHILD_AND_PARENT(cur)
- }
- }
- return(cur);
-}
-
-/**
- * xmlNewDocFragment:
- * @doc: the document owning the fragment
- *
- * Creation of a new Fragment node.
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewDocFragment(xmlDocPtr doc) {
- xmlNodePtr cur;
-
- /*
- * Allocate a new DocumentFragment node and fill the fields.
- */
- cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewDocFragment : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlNode));
- cur->type = XML_DOCUMENT_FRAG_NODE;
-
- cur->doc = doc;
- return(cur);
-}
-
-/**
- * xmlNewText:
- * @content: the text content
- *
- * Creation of a new text node.
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewText(const xmlChar *content) {
- xmlNodePtr cur;
-
- /*
- * Allocate a new node and fill the fields.
- */
- cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewText : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlNode));
- cur->type = XML_TEXT_NODE;
-
- cur->name = xmlStringText;
- if (content != NULL) {
- cur->content = xmlStrdup(content);
- }
- return(cur);
-}
-
-/**
- * xmlNewTextChild:
- * @parent: the parent node
- * @ns: a namespace if any
- * @name: the name of the child
- * @content: the text content of the child if any.
- *
- * Creation of a new child element, added at the end of @parent children list.
- * @ns and @content parameters are optional (NULL). If content is non NULL,
- * a child TEXT node will be created containing the string content.
- *
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewTextChild(xmlNodePtr parent, xmlNsPtr ns,
- const xmlChar *name, const xmlChar *content) {
- xmlNodePtr cur, prev;
-
- if (parent == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewTextChild : parent == NULL\n");
-#endif
- return(NULL);
- }
-
- if (name == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewTextChild : name == NULL\n");
-#endif
- return(NULL);
- }
-
- /*
- * Allocate a new node
- */
- if (ns == NULL)
- cur = xmlNewDocRawNode(parent->doc, parent->ns, name, content);
- else
- cur = xmlNewDocRawNode(parent->doc, ns, name, content);
- if (cur == NULL) return(NULL);
-
- /*
- * add the new element at the end of the children list.
- */
- cur->type = XML_ELEMENT_NODE;
- cur->parent = parent;
- cur->doc = parent->doc;
- if (parent->children == NULL) {
- parent->children = cur;
- parent->last = cur;
- } else {
- prev = parent->last;
- prev->next = cur;
- cur->prev = prev;
- parent->last = cur;
- }
-
- return(cur);
-}
-
-/**
- * xmlNewCharRef:
- * @doc: the document
- * @name: the char ref string, starting with # or "&# ... ;"
- *
- * Creation of a new character reference node.
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewCharRef(xmlDocPtr doc, const xmlChar *name) {
- xmlNodePtr cur;
-
- /*
- * Allocate a new node and fill the fields.
- */
- cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewCharRef : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlNode));
- cur->type = XML_ENTITY_REF_NODE;
-
- cur->doc = doc;
- if (name[0] == '&') {
- int len;
- name++;
- len = xmlStrlen(name);
- if (name[len - 1] == ';')
- cur->name = xmlStrndup(name, len - 1);
- else
- cur->name = xmlStrndup(name, len);
- } else
- cur->name = xmlStrdup(name);
- return(cur);
-}
-
-/**
- * xmlNewReference:
- * @doc: the document
- * @name: the reference name, or the reference string with & and ;
- *
- * Creation of a new reference node.
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewReference(xmlDocPtr doc, const xmlChar *name) {
- xmlNodePtr cur;
- xmlEntityPtr ent;
-
- /*
- * Allocate a new node and fill the fields.
- */
- cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewReference : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlNode));
- cur->type = XML_ENTITY_REF_NODE;
-
- cur->doc = doc;
- if (name[0] == '&') {
- int len;
- name++;
- len = xmlStrlen(name);
- if (name[len - 1] == ';')
- cur->name = xmlStrndup(name, len - 1);
- else
- cur->name = xmlStrndup(name, len);
- } else
- cur->name = xmlStrdup(name);
-
- ent = xmlGetDocEntity(doc, cur->name);
- if (ent != NULL) {
- cur->content = ent->content;
- /*
- * The parent pointer in entity is a DTD pointer and thus is NOT
- * updated. Not sure if this is 100% correct.
- * -George
- */
- cur->children = (xmlNodePtr) ent;
- cur->last = (xmlNodePtr) ent;
- }
- return(cur);
-}
-
-/**
- * xmlNewDocText:
- * @doc: the document
- * @content: the text content
- *
- * Creation of a new text node within a document.
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewDocText(xmlDocPtr doc, const xmlChar *content) {
- xmlNodePtr cur;
-
- cur = xmlNewText(content);
- if (cur != NULL) cur->doc = doc;
- return(cur);
-}
-
-/**
- * xmlNewTextLen:
- * @content: the text content
- * @len: the text len.
- *
- * Creation of a new text node with an extra parameter for the content's length
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewTextLen(const xmlChar *content, int len) {
- xmlNodePtr cur;
-
- /*
- * Allocate a new node and fill the fields.
- */
- cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewTextLen : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlNode));
- cur->type = XML_TEXT_NODE;
-
- cur->name = xmlStringText;
- if (content != NULL) {
- cur->content = xmlStrndup(content, len);
- }
- return(cur);
-}
-
-/**
- * xmlNewDocTextLen:
- * @doc: the document
- * @content: the text content
- * @len: the text len.
- *
- * Creation of a new text node with an extra content length parameter. The
- * text node pertain to a given document.
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewDocTextLen(xmlDocPtr doc, const xmlChar *content, int len) {
- xmlNodePtr cur;
-
- cur = xmlNewTextLen(content, len);
- if (cur != NULL) cur->doc = doc;
- return(cur);
-}
-
-/**
- * xmlNewComment:
- * @content: the comment content
- *
- * Creation of a new node containing a comment.
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewComment(const xmlChar *content) {
- xmlNodePtr cur;
-
- /*
- * Allocate a new node and fill the fields.
- */
- cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewComment : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlNode));
- cur->type = XML_COMMENT_NODE;
-
- cur->name = xmlStringComment;
- if (content != NULL) {
- cur->content = xmlStrdup(content);
- }
- return(cur);
-}
-
-/**
- * xmlNewCDataBlock:
- * @doc: the document
- * @content: the CDATA block content content
- * @len: the length of the block
- *
- * Creation of a new node containing a CDATA block.
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewCDataBlock(xmlDocPtr doc, const xmlChar *content, int len) {
- xmlNodePtr cur;
-
- /*
- * Allocate a new node and fill the fields.
- */
- cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewCDataBlock : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlNode));
- cur->type = XML_CDATA_SECTION_NODE;
- cur->doc = doc;
-
- if (content != NULL) {
- cur->content = xmlStrndup(content, len);
- }
- return(cur);
-}
-
-/**
- * xmlNewDocComment:
- * @doc: the document
- * @content: the comment content
- *
- * Creation of a new node containing a comment within a document.
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewDocComment(xmlDocPtr doc, const xmlChar *content) {
- xmlNodePtr cur;
-
- cur = xmlNewComment(content);
- if (cur != NULL) cur->doc = doc;
- return(cur);
-}
-
-/**
- * xmlSetTreeDoc:
- * @tree: the top element
- * @doc: the document
- *
- * update all nodes under the tree to point to the right document
- */
-void
-xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) {
- xmlAttrPtr prop;
-
- if (tree == NULL)
- return;
- if (tree->doc != doc) {
- if(tree->type == XML_ELEMENT_NODE) {
- prop = tree->properties;
- while (prop != NULL) {
- prop->doc = doc;
- xmlSetListDoc(prop->children, doc);
- prop = prop->next;
- }
- }
- if (tree->children != NULL)
- xmlSetListDoc(tree->children, doc);
- tree->doc = doc;
- }
-}
-
-/**
- * xmlSetListDoc:
- * @list: the first element
- * @doc: the document
- *
- * update all nodes in the list to point to the right document
- */
-void
-xmlSetListDoc(xmlNodePtr list, xmlDocPtr doc) {
- xmlNodePtr cur;
-
- if (list == NULL)
- return;
- cur = list;
- while (cur != NULL) {
- if (cur->doc != doc)
- xmlSetTreeDoc(cur, doc);
- cur = cur->next;
- }
-}
-
-
-/**
- * xmlNewChild:
- * @parent: the parent node
- * @ns: a namespace if any
- * @name: the name of the child
- * @content: the XML content of the child if any.
- *
- * Creation of a new child element, added at the end of @parent children list.
- * @ns and @content parameters are optional (NULL). If content is non NULL,
- * a child list containing the TEXTs and ENTITY_REFs node will be created.
- * NOTE: @content is supposed to be a piece of XML CDATA, so it allow entities
- * references, but XML special chars need to be escaped first by using
- * xmlEncodeEntitiesReentrant(). Use xmlNewTextChild() if entities
- * support is not needed.
- *
- * Returns a pointer to the new node object.
- */
-xmlNodePtr
-xmlNewChild(xmlNodePtr parent, xmlNsPtr ns,
- const xmlChar *name, const xmlChar *content) {
- xmlNodePtr cur, prev;
-
- if (parent == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewChild : parent == NULL\n");
-#endif
- return(NULL);
- }
-
- if (name == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewChild : name == NULL\n");
-#endif
- return(NULL);
- }
-
- /*
- * Allocate a new node
- */
- if (parent->type == XML_ELEMENT_NODE) {
- if (ns == NULL)
- cur = xmlNewDocNode(parent->doc, parent->ns, name, content);
- else
- cur = xmlNewDocNode(parent->doc, ns, name, content);
- } else if ((parent->type == XML_DOCUMENT_NODE) ||
- (parent->type == XML_HTML_DOCUMENT_NODE)) {
- if (ns == NULL)
- cur = xmlNewDocNode((xmlDocPtr) parent, NULL, name, content);
- else
- cur = xmlNewDocNode((xmlDocPtr) parent, ns, name, content);
- } else if (parent->type == XML_DOCUMENT_FRAG_NODE) {
- cur = xmlNewDocNode( parent->doc, ns, name, content);
- } else {
- return(NULL);
- }
- if (cur == NULL) return(NULL);
-
- /*
- * add the new element at the end of the children list.
- */
- cur->type = XML_ELEMENT_NODE;
- cur->parent = parent;
- cur->doc = parent->doc;
- if (parent->children == NULL) {
- parent->children = cur;
- parent->last = cur;
- } else {
- prev = parent->last;
- prev->next = cur;
- cur->prev = prev;
- parent->last = cur;
- }
-
- return(cur);
-}
-
-/**
- * xmlAddNextSibling:
- * @cur: the child node
- * @elem: the new node
- *
- * Add a new node @elem as the next sibling of @cur
- * If the new node was already inserted in a document it is
- * first unlinked from its existing context.
- * As a result of text merging @elem may be freed.
- * If the new node is ATTRIBUTE, it is added into properties instead of children.
- * If there is an attribute with equal name, it is first destroyed.
- *
- * Returns the new node or NULL in case of error.
- */
-xmlNodePtr
-xmlAddNextSibling(xmlNodePtr cur, xmlNodePtr elem) {
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddNextSibling : cur == NULL\n");
-#endif
- return(NULL);
- }
- if (elem == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddNextSibling : elem == NULL\n");
-#endif
- return(NULL);
- }
-
- xmlUnlinkNode(elem);
-
- if (elem->type == XML_TEXT_NODE) {
- if (cur->type == XML_TEXT_NODE) {
- xmlNodeAddContent(cur, elem->content);
- xmlFreeNode(elem);
- return(cur);
- }
- if ((cur->next != NULL) && (cur->next->type == XML_TEXT_NODE) &&
- (cur->name == cur->next->name)) {
- xmlChar *tmp;
-
- tmp = xmlStrdup(elem->content);
- tmp = xmlStrcat(tmp, cur->next->content);
- xmlNodeSetContent(cur->next, tmp);
- xmlFree(tmp);
- xmlFreeNode(elem);
- return(cur->next);
- }
- } else if (elem->type == XML_ATTRIBUTE_NODE) {
- /* check if an attribute with the same name exists */
- xmlAttrPtr attr;
-
- if (elem->ns == NULL)
- attr = xmlHasProp(cur->parent, elem->name);
- else
- attr = xmlHasNsProp(cur->parent, elem->name, elem->ns->href);
- if ((attr != NULL) && (attr != (xmlAttrPtr) elem)) {
- /* different instance, destroy it (attributes must be unique) */
- xmlFreeProp(attr);
- }
- }
-
- if (elem->doc != cur->doc) {
- xmlSetTreeDoc(elem, cur->doc);
- }
- elem->parent = cur->parent;
- elem->prev = cur;
- elem->next = cur->next;
- cur->next = elem;
- if (elem->next != NULL)
- elem->next->prev = elem;
- if ((elem->parent != NULL) && (elem->parent->last == cur) && (elem->type != XML_ATTRIBUTE_NODE))
- elem->parent->last = elem;
- return(elem);
-}
-
-/**
- * xmlAddPrevSibling:
- * @cur: the child node
- * @elem: the new node
- *
- * Add a new node @elem as the previous sibling of @cur
- * merging adjacent TEXT nodes (@elem may be freed)
- * If the new node was already inserted in a document it is
- * first unlinked from its existing context.
- * If the new node is ATTRIBUTE, it is added into properties instead of children.
- * If there is an attribute with equal name, it is first destroyed.
- *
- * Returns the new node or NULL in case of error.
- */
-xmlNodePtr
-xmlAddPrevSibling(xmlNodePtr cur, xmlNodePtr elem) {
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddPrevSibling : cur == NULL\n");
-#endif
- return(NULL);
- }
- if (elem == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddPrevSibling : elem == NULL\n");
-#endif
- return(NULL);
- }
-
- xmlUnlinkNode(elem);
-
- if (elem->type == XML_TEXT_NODE) {
- if (cur->type == XML_TEXT_NODE) {
- xmlChar *tmp;
-
- tmp = xmlStrdup(elem->content);
- tmp = xmlStrcat(tmp, cur->content);
- xmlNodeSetContent(cur, tmp);
- xmlFree(tmp);
- xmlFreeNode(elem);
- return(cur);
- }
- if ((cur->prev != NULL) && (cur->prev->type == XML_TEXT_NODE) &&
- (cur->name == cur->prev->name)) {
- xmlNodeAddContent(cur->prev, elem->content);
- xmlFreeNode(elem);
- return(cur->prev);
- }
- } else if (elem->type == XML_ATTRIBUTE_NODE) {
- /* check if an attribute with the same name exists */
- xmlAttrPtr attr;
-
- if (elem->ns == NULL)
- attr = xmlHasProp(cur->parent, elem->name);
- else
- attr = xmlHasNsProp(cur->parent, elem->name, elem->ns->href);
- if ((attr != NULL) && (attr != (xmlAttrPtr) elem)) {
- /* different instance, destroy it (attributes must be unique) */
- xmlFreeProp(attr);
- }
- }
-
- if (elem->doc != cur->doc) {
- xmlSetTreeDoc(elem, cur->doc);
- }
- elem->parent = cur->parent;
- elem->next = cur;
- elem->prev = cur->prev;
- cur->prev = elem;
- if (elem->prev != NULL)
- elem->prev->next = elem;
- if (elem->parent != NULL) {
- if (elem->type == XML_ATTRIBUTE_NODE) {
- if (elem->parent->properties == (xmlAttrPtr) cur) {
- elem->parent->properties = (xmlAttrPtr) elem;
- }
- } else {
- if (elem->parent->children == cur) {
- elem->parent->children = elem;
- }
- }
- }
- return(elem);
-}
-
-/**
- * xmlAddSibling:
- * @cur: the child node
- * @elem: the new node
- *
- * Add a new element @elem to the list of siblings of @cur
- * merging adjacent TEXT nodes (@elem may be freed)
- * If the new element was already inserted in a document it is
- * first unlinked from its existing context.
- *
- * Returns the new element or NULL in case of error.
- */
-xmlNodePtr
-xmlAddSibling(xmlNodePtr cur, xmlNodePtr elem) {
- xmlNodePtr parent;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddSibling : cur == NULL\n");
-#endif
- return(NULL);
- }
-
- if (elem == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddSibling : elem == NULL\n");
-#endif
- return(NULL);
- }
-
- /*
- * Constant time is we can rely on the ->parent->last to find
- * the last sibling.
- */
- if ((cur->parent != NULL) &&
- (cur->parent->children != NULL) &&
- (cur->parent->last != NULL) &&
- (cur->parent->last->next == NULL)) {
- cur = cur->parent->last;
- } else {
- while (cur->next != NULL) cur = cur->next;
- }
-
- xmlUnlinkNode(elem);
-
- if ((cur->type == XML_TEXT_NODE) && (elem->type == XML_TEXT_NODE)) {
- xmlNodeAddContent(cur, elem->content);
- xmlFreeNode(elem);
- return(cur);
- }
-
- if (elem->doc != cur->doc) {
- xmlSetTreeDoc(elem, cur->doc);
- }
- parent = cur->parent;
- elem->prev = cur;
- elem->next = NULL;
- elem->parent = parent;
- cur->next = elem;
- if (parent != NULL)
- parent->last = elem;
-
- return(elem);
-}
-
-/**
- * xmlAddChildList:
- * @parent: the parent node
- * @cur: the first node in the list
- *
- * Add a list of node at the end of the child list of the parent
- * merging adjacent TEXT nodes (@cur may be freed)
- *
- * Returns the last child or NULL in case of error.
- */
-xmlNodePtr
-xmlAddChildList(xmlNodePtr parent, xmlNodePtr cur) {
- xmlNodePtr prev;
-
- if (parent == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddChildList : parent == NULL\n");
-#endif
- return(NULL);
- }
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddChildList : child == NULL\n");
-#endif
- return(NULL);
- }
-
- if ((cur->doc != NULL) && (parent->doc != NULL) &&
- (cur->doc != parent->doc)) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "Elements moved to a different document\n");
-#endif
- }
-
- /*
- * add the first element at the end of the children list.
- */
- if (parent->children == NULL) {
- parent->children = cur;
- } else {
- /*
- * If cur and parent->last both are TEXT nodes, then merge them.
- */
- if ((cur->type == XML_TEXT_NODE) &&
- (parent->last->type == XML_TEXT_NODE) &&
- (cur->name == parent->last->name)) {
- xmlNodeAddContent(parent->last, cur->content);
- /*
- * if it's the only child, nothing more to be done.
- */
- if (cur->next == NULL) {
- xmlFreeNode(cur);
- return(parent->last);
- }
- prev = cur;
- cur = cur->next;
- xmlFreeNode(prev);
- }
- prev = parent->last;
- prev->next = cur;
- cur->prev = prev;
- }
- while (cur->next != NULL) {
- cur->parent = parent;
- if (cur->doc != parent->doc) {
- xmlSetTreeDoc(cur, parent->doc);
- }
- cur = cur->next;
- }
- cur->parent = parent;
- cur->doc = parent->doc; /* the parent may not be linked to a doc ! */
- parent->last = cur;
-
- return(cur);
-}
-
-/**
- * xmlAddChild:
- * @parent: the parent node
- * @cur: the child node
- *
- * Add a new node to @parent, at the end of the child (or property) list
- * merging adjacent TEXT nodes (in which case @cur is freed)
- * If the new node was already inserted in a document it is
- * first unlinked from its existing context.
- * If the new node is ATTRIBUTE, it is added into properties instead of children.
- * If there is an attribute with equal name, it is first destroyed.
- *
- * Returns the child or NULL in case of error.
- */
-xmlNodePtr
-xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) {
- xmlNodePtr prev;
-
- if (parent == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddChild : parent == NULL\n");
-#endif
- return(NULL);
- }
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddChild : child == NULL\n");
-#endif
- return(NULL);
- }
-
- /*
- * If cur is a TEXT node, merge its content with adjacent TEXT nodes
- * cur is then freed.
- */
- if (cur->type == XML_TEXT_NODE) {
- if ((parent->type == XML_TEXT_NODE) &&
- (parent->content != NULL)) {
- xmlNodeAddContent(parent, cur->content);
- xmlFreeNode(cur);
- return(parent);
- }
- if ((parent->last != NULL) && (parent->last->type == XML_TEXT_NODE) &&
- (parent->last->name == cur->name)) {
- xmlNodeAddContent(parent->last, cur->content);
- xmlFreeNode(cur);
- return(parent->last);
- }
- }
-
- /*
- * add the new element at the end of the children list.
- */
- cur->parent = parent;
- if (cur->doc != parent->doc) {
- xmlSetTreeDoc(cur, parent->doc);
- }
-
- /*
- * Coalescing
- */
- if ((parent->type == XML_TEXT_NODE) &&
- (parent->content != NULL)) {
- xmlNodeAddContent(parent, cur->content);
- xmlFreeNode(cur);
- return(parent);
- }
- if (cur->type == XML_ATTRIBUTE_NODE) {
- if (parent->properties == NULL) {
- parent->properties = (xmlAttrPtr) cur;
- } else {
- /* check if an attribute with the same name exists */
- xmlAttrPtr lastattr;
-
- if (cur->ns == NULL)
- lastattr = xmlHasProp(parent, cur->name);
- else
- lastattr = xmlHasNsProp(parent, cur->name, cur->ns->href);
- if ((lastattr != NULL) && (lastattr != (xmlAttrPtr) cur)) {
- /* different instance, destroy it (attributes must be unique) */
- xmlFreeProp(lastattr);
- }
- /* find the end */
- lastattr = parent->properties;
- while (lastattr->next != NULL) {
- lastattr = lastattr->next;
- }
- lastattr->next = (xmlAttrPtr) cur;
- ((xmlAttrPtr) cur)->prev = lastattr;
- }
- } else {
- if (parent->children == NULL) {
- parent->children = cur;
- parent->last = cur;
- } else {
- prev = parent->last;
- prev->next = cur;
- cur->prev = prev;
- parent->last = cur;
- }
- }
- return(cur);
-}
-
-/**
- * xmlGetLastChild:
- * @parent: the parent node
- *
- * Search the last child of a node.
- * Returns the last child or NULL if none.
- */
-xmlNodePtr
-xmlGetLastChild(xmlNodePtr parent) {
- if (parent == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlGetLastChild : parent == NULL\n");
-#endif
- return(NULL);
- }
- return(parent->last);
-}
-
-/**
- * xmlFreeNodeList:
- * @cur: the first node in the list
- *
- * Free a node and all its siblings, this is a recursive behaviour, all
- * the children are freed too.
- */
-void
-xmlFreeNodeList(xmlNodePtr cur) {
- xmlNodePtr next;
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlFreeNodeList : node == NULL\n");
-#endif
- return;
- }
- if (cur->type == XML_NAMESPACE_DECL) {
- xmlFreeNsList((xmlNsPtr) cur);
- return;
- }
- while (cur != NULL) {
- next = cur->next;
- /* unroll to speed up freeing the document */
- if (cur->type != XML_DTD_NODE) {
- if ((cur->children != NULL) &&
- (cur->type != XML_ENTITY_REF_NODE))
- xmlFreeNodeList(cur->children);
- if (((cur->type == XML_ELEMENT_NODE) ||
- (cur->type == XML_XINCLUDE_START) ||
- (cur->type == XML_XINCLUDE_END)) &&
- (cur->properties != NULL))
- xmlFreePropList(cur->properties);
- if ((cur->type != XML_ELEMENT_NODE) &&
- (cur->type != XML_XINCLUDE_START) &&
- (cur->type != XML_XINCLUDE_END) &&
- (cur->type != XML_ENTITY_REF_NODE)) {
- if (cur->content != NULL) xmlFree(cur->content);
- }
- if (((cur->type == XML_ELEMENT_NODE) ||
- (cur->type == XML_XINCLUDE_START) ||
- (cur->type == XML_XINCLUDE_END)) &&
- (cur->nsDef != NULL))
- xmlFreeNsList(cur->nsDef);
-
- /*
- * When a node is a text node or a comment, it uses a global static
- * variable for the name of the node.
- *
- * The xmlStrEqual comparisons need to be done when (happened with
- * XML::libXML and XML::libXSLT) the library is included twice
- * statically in the binary and a tree allocated by one occurrence
- * of the lib gets freed by the other occurrence, in this case
- * the string addresses compare are not sufficient.
- */
- if ((cur->name != NULL) &&
- (cur->name != xmlStringText) &&
- (cur->name != xmlStringTextNoenc) &&
- (cur->name != xmlStringComment)) {
- if (cur->type == XML_TEXT_NODE) {
- if ((!xmlStrEqual(cur->name, xmlStringText)) &&
- (!xmlStrEqual(cur->name, xmlStringTextNoenc)))
- xmlFree((char *) cur->name);
- } else if (cur->type == XML_COMMENT_NODE) {
- if (!xmlStrEqual(cur->name, xmlStringComment))
- xmlFree((char *) cur->name);
- } else
- xmlFree((char *) cur->name);
- }
- /* TODO : derecursivate this function */
- xmlFree(cur);
- }
- cur = next;
- }
-}
-
-/**
- * xmlFreeNode:
- * @cur: the node
- *
- * Free a node, this is a recursive behaviour, all the children are freed too.
- * This doesn't unlink the child from the list, use xmlUnlinkNode() first.
- */
-void
-xmlFreeNode(xmlNodePtr cur) {
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlFreeNode : node == NULL\n");
-#endif
- return;
- }
- /* use xmlFreeDtd for DTD nodes */
- if (cur->type == XML_DTD_NODE) {
- xmlFreeDtd((xmlDtdPtr) cur);
- return;
- }
- if (cur->type == XML_NAMESPACE_DECL) {
- xmlFreeNs((xmlNsPtr) cur);
- return;
- }
- if (cur->type == XML_ATTRIBUTE_NODE) {
- xmlFreeProp((xmlAttrPtr) cur);
- return;
- }
- if ((cur->children != NULL) &&
- (cur->type != XML_ENTITY_REF_NODE))
- xmlFreeNodeList(cur->children);
- if (((cur->type == XML_ELEMENT_NODE) ||
- (cur->type == XML_XINCLUDE_START) ||
- (cur->type == XML_XINCLUDE_END)) &&
- (cur->properties != NULL))
- xmlFreePropList(cur->properties);
- if ((cur->type != XML_ELEMENT_NODE) &&
- (cur->content != NULL) &&
- (cur->type != XML_ENTITY_REF_NODE) &&
- (cur->type != XML_XINCLUDE_END) &&
- (cur->type != XML_XINCLUDE_START)) {
- xmlFree(cur->content);
- }
-
- /*
- * When a node is a text node or a comment, it uses a global static
- * variable for the name of the node.
- *
- * The xmlStrEqual comparisons need to be done when (happened with
- * XML::libXML and XML::libXSLT) the library is included twice statically
- * in the binary and a tree allocated by one occurence of the lib gets
- * freed by the other occurrence, in this case the string addresses compare
- * are not sufficient.
- */
- if ((cur->name != NULL) &&
- (cur->name != xmlStringText) &&
- (cur->name != xmlStringTextNoenc) &&
- (cur->name != xmlStringComment)) {
- if (cur->type == XML_TEXT_NODE) {
- if ((!xmlStrEqual(cur->name, xmlStringText)) &&
- (!xmlStrEqual(cur->name, xmlStringTextNoenc)))
- xmlFree((char *) cur->name);
- } else if (cur->type == XML_COMMENT_NODE) {
- if (!xmlStrEqual(cur->name, xmlStringComment))
- xmlFree((char *) cur->name);
- } else
- xmlFree((char *) cur->name);
- }
-
- if (((cur->type == XML_ELEMENT_NODE) ||
- (cur->type == XML_XINCLUDE_START) ||
- (cur->type == XML_XINCLUDE_END)) &&
- (cur->nsDef != NULL))
- xmlFreeNsList(cur->nsDef);
- xmlFree(cur);
-}
-
-/**
- * xmlUnlinkNode:
- * @cur: the node
- *
- * Unlink a node from it's current context, the node is not freed
- */
-void
-xmlUnlinkNode(xmlNodePtr cur) {
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlUnlinkNode : node == NULL\n");
-#endif
- return;
- }
- if (cur->type == XML_DTD_NODE) {
- xmlDocPtr doc;
- doc = cur->doc;
- if (doc->intSubset == (xmlDtdPtr) cur)
- doc->intSubset = NULL;
- if (doc->extSubset == (xmlDtdPtr) cur)
- doc->extSubset = NULL;
- }
- if (cur->parent != NULL) {
- xmlNodePtr parent;
- parent = cur->parent;
- if (cur->type == XML_ATTRIBUTE_NODE) {
- if (parent->properties == (xmlAttrPtr) cur)
- parent->properties = ((xmlAttrPtr) cur)->next;
- } else {
- if (parent->children == cur)
- parent->children = cur->next;
- if (parent->last == cur)
- parent->last = cur->prev;
- }
- cur->parent = NULL;
- }
- if (cur->next != NULL)
- cur->next->prev = cur->prev;
- if (cur->prev != NULL)
- cur->prev->next = cur->next;
- cur->next = cur->prev = NULL;
-}
-
-/**
- * xmlReplaceNode:
- * @old: the old node
- * @cur: the node
- *
- * Unlink the old node from it's current context, prune the new one
- * at the same place. If @cur was already inserted in a document it is
- * first unlinked from its existing context.
- *
- * Returns the @old node
- */
-xmlNodePtr
-xmlReplaceNode(xmlNodePtr old, xmlNodePtr cur) {
- if (old == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlReplaceNode : old == NULL\n");
-#endif
- return(NULL);
- }
- if (cur == NULL) {
- xmlUnlinkNode(old);
- return(old);
- }
- if (cur == old) {
- return(old);
- }
- if ((old->type==XML_ATTRIBUTE_NODE) && (cur->type!=XML_ATTRIBUTE_NODE)) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlReplaceNode : Trying to replace attribute node with other node type\n");
-#endif
- return(old);
- }
- if ((cur->type==XML_ATTRIBUTE_NODE) && (old->type!=XML_ATTRIBUTE_NODE)) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlReplaceNode : Trying to replace a non-attribute node with attribute node\n");
-#endif
- return(old);
- }
- if ((old->type==XML_ATTRIBUTE_NODE) && (cur->type!=XML_ATTRIBUTE_NODE)) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlReplaceNode : Trying to replace attribute node with other node type\n");
-#endif
- return(old);
- }
- if ((cur->type==XML_ATTRIBUTE_NODE) && (old->type!=XML_ATTRIBUTE_NODE)) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlReplaceNode : Trying to replace a non-attribute node with attribute node\n");
-#endif
- return(old);
- }
- xmlUnlinkNode(cur);
- cur->doc = old->doc;
- cur->parent = old->parent;
- cur->next = old->next;
- if (cur->next != NULL)
- cur->next->prev = cur;
- cur->prev = old->prev;
- if (cur->prev != NULL)
- cur->prev->next = cur;
- if (cur->parent != NULL) {
- if (cur->type == XML_ATTRIBUTE_NODE) {
- if (cur->parent->properties == (xmlAttrPtr)old)
- cur->parent->properties = ((xmlAttrPtr) cur);
- } else {
- if (cur->parent->children == old)
- cur->parent->children = cur;
- if (cur->parent->last == old)
- cur->parent->last = cur;
- }
- }
- old->next = old->prev = NULL;
- old->parent = NULL;
- return(old);
-}
-
-/************************************************************************
- * *
- * Copy operations *
- * *
- ************************************************************************/
-
-/**
- * xmlCopyNamespace:
- * @cur: the namespace
- *
- * Do a copy of the namespace.
- *
- * Returns: a new #xmlNsPtr, or NULL in case of error.
- */
-xmlNsPtr
-xmlCopyNamespace(xmlNsPtr cur) {
- xmlNsPtr ret;
-
- if (cur == NULL) return(NULL);
- switch (cur->type) {
- case XML_LOCAL_NAMESPACE:
- ret = xmlNewNs(NULL, cur->href, cur->prefix);
- break;
- default:
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlCopyNamespace: invalid type %d\n", cur->type);
-#endif
- return(NULL);
- }
- return(ret);
-}
-
-/**
- * xmlCopyNamespaceList:
- * @cur: the first namespace
- *
- * Do a copy of an namespace list.
- *
- * Returns: a new #xmlNsPtr, or NULL in case of error.
- */
-xmlNsPtr
-xmlCopyNamespaceList(xmlNsPtr cur) {
- xmlNsPtr ret = NULL;
- xmlNsPtr p = NULL,q;
-
- while (cur != NULL) {
- q = xmlCopyNamespace(cur);
- if (p == NULL) {
- ret = p = q;
- } else {
- p->next = q;
- p = q;
- }
- cur = cur->next;
- }
- return(ret);
-}
-
-static xmlNodePtr
-xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent);
-/**
- * xmlCopyProp:
- * @target: the element where the attribute will be grafted
- * @cur: the attribute
- *
- * Do a copy of the attribute.
- *
- * Returns: a new #xmlAttrPtr, or NULL in case of error.
- */
-xmlAttrPtr
-xmlCopyProp(xmlNodePtr target, xmlAttrPtr cur) {
- xmlAttrPtr ret;
-
- if (cur == NULL) return(NULL);
- if (target != NULL)
- ret = xmlNewDocProp(target->doc, cur->name, NULL);
- else if (cur->parent != NULL)
- ret = xmlNewDocProp(cur->parent->doc, cur->name, NULL);
- else if (cur->children != NULL)
- ret = xmlNewDocProp(cur->children->doc, cur->name, NULL);
- else
- ret = xmlNewDocProp(NULL, cur->name, NULL);
- if (ret == NULL) return(NULL);
- ret->parent = target;
-
- if ((cur->ns != NULL) && (target != NULL)) {
- xmlNsPtr ns;
-/*
- * if (target->doc)
- * ns = xmlSearchNs(target->doc, target, cur->ns->prefix);
- * else if (cur->doc) / * target may not yet have a doc : KPI * /
- * ns = xmlSearchNs(cur->doc, target, cur->ns->prefix);
- * else
- * ns = NULL;
- * ret->ns = ns;
- */
- ns = xmlSearchNs(target->doc, target, cur->ns->prefix);
- if (ns == NULL) {
- /*
- * Humm, we are copying an element whose namespace is defined
- * out of the new tree scope. Search it in the original tree
- * and add it at the top of the new tree
- */
- ns = xmlSearchNs(cur->doc, cur->parent, cur->ns->prefix);
- if (ns != NULL) {
- xmlNodePtr root = target;
- xmlNodePtr pred = NULL;
-
- while (root->parent != NULL) {
- pred = root;
- root = root->parent;
- }
- if (root == (xmlNodePtr) target->doc) {
- /* correct possibly cycling above the document elt */
- root = pred;
- }
- ret->ns = xmlNewNs(root, ns->href, ns->prefix);
- }
- } else {
- /*
- * we have to find something appropriate here since
- * we cant be sure, that the namespce we found is identified
- * by the prefix
- */
- if (xmlStrEqual(ns->href, cur->ns->href)) {
- /* this is the nice case */
- ret->ns = ns;
- } else {
- /*
- * we are in trouble: we need a new reconcilied namespace.
- * This is expensive
- */
- ret->ns = xmlNewReconciliedNs(target->doc, target, cur->ns);
- }
- }
-
- } else
- ret->ns = NULL;
-
- if (cur->children != NULL) {
- xmlNodePtr tmp;
-
- ret->children = xmlStaticCopyNodeList(cur->children, ret->doc, (xmlNodePtr) ret);
- ret->last = NULL;
- tmp = ret->children;
- while (tmp != NULL) {
- /* tmp->parent = (xmlNodePtr)ret; */
- if (tmp->next == NULL)
- ret->last = tmp;
- tmp = tmp->next;
- }
- }
- /*
- * Try to handle IDs
- */
- if ((target!= NULL) && (cur!= NULL) &&
- (target->doc != NULL) && (cur->doc != NULL) &&
- (cur->doc->ids != NULL) && (cur->parent != NULL)) {
- if (xmlIsID(cur->doc, cur->parent, cur)) {
- xmlChar *id;
-
- id = xmlNodeListGetString(cur->doc, cur->children, 1);
- if (id != NULL) {
- xmlAddID(NULL, target->doc, id, ret);
- xmlFree(id);
- }
- }
- }
- return(ret);
-}
-
-/**
- * xmlCopyPropList:
- * @target: the element where the attributes will be grafted
- * @cur: the first attribute
- *
- * Do a copy of an attribute list.
- *
- * Returns: a new #xmlAttrPtr, or NULL in case of error.
- */
-xmlAttrPtr
-xmlCopyPropList(xmlNodePtr target, xmlAttrPtr cur) {
- xmlAttrPtr ret = NULL;
- xmlAttrPtr p = NULL,q;
-
- while (cur != NULL) {
- q = xmlCopyProp(target, cur);
- if (p == NULL) {
- ret = p = q;
- } else {
- p->next = q;
- q->prev = p;
- p = q;
- }
- cur = cur->next;
- }
- return(ret);
-}
-
-/*
- * NOTE about the CopyNode operations !
- *
- * They are split into external and internal parts for one
- * tricky reason: namespaces. Doing a direct copy of a node
- * say RPM:Copyright without changing the namespace pointer to
- * something else can produce stale links. One way to do it is
- * to keep a reference counter but this doesn't work as soon
- * as one move the element or the subtree out of the scope of
- * the existing namespace. The actual solution seems to add
- * a copy of the namespace at the top of the copied tree if
- * not available in the subtree.
- * Hence two functions, the public front-end call the inner ones
- */
-
-static xmlNodePtr
-xmlStaticCopyNode(const xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
- int recursive) {
- xmlNodePtr ret;
-
- if (node == NULL) return(NULL);
- switch (node->type) {
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_ELEMENT_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- break;
- case XML_ATTRIBUTE_NODE:
- return((xmlNodePtr) xmlCopyProp(parent, (xmlAttrPtr) node));
- case XML_NAMESPACE_DECL:
- return((xmlNodePtr) xmlCopyNamespaceList((xmlNsPtr) node));
-
- case XML_DOCUMENT_NODE:
- case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- return((xmlNodePtr) xmlCopyDoc((xmlDocPtr) node, recursive));
- case XML_DOCUMENT_TYPE_NODE:
- case XML_NOTATION_NODE:
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- return(NULL);
- }
-
- /*
- * Allocate a new node and fill the fields.
- */
- ret = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlStaticCopyNode : malloc failed\n");
- return(NULL);
- }
- memset(ret, 0, sizeof(xmlNode));
- ret->type = node->type;
-
- ret->doc = doc;
- ret->parent = parent;
- if (node->name == xmlStringText)
- ret->name = xmlStringText;
- else if (node->name == xmlStringTextNoenc)
- ret->name = xmlStringTextNoenc;
- else if (node->name == xmlStringComment)
- ret->name = xmlStringComment;
- else if (node->name != NULL)
- ret->name = xmlStrdup(node->name);
- if ((node->type != XML_ELEMENT_NODE) &&
- (node->content != NULL) &&
- (node->type != XML_ENTITY_REF_NODE) &&
- (node->type != XML_XINCLUDE_END) &&
- (node->type != XML_XINCLUDE_START)) {
- ret->content = xmlStrdup(node->content);
- }else{
- if (node->type == XML_ELEMENT_NODE)
- ret->content = (void*)(long) node->content;
- }
- if (parent != NULL) {
- xmlNodePtr tmp;
-
- tmp = xmlAddChild(parent, ret);
- /* node could have coalesced */
- if (tmp != ret)
- return(tmp);
- }
-
- if (!recursive) return(ret);
- if (node->nsDef != NULL)
- ret->nsDef = xmlCopyNamespaceList(node->nsDef);
-
- if (node->ns != NULL) {
- xmlNsPtr ns;
-
- ns = xmlSearchNs(doc, ret, node->ns->prefix);
- if (ns == NULL) {
- /*
- * Humm, we are copying an element whose namespace is defined
- * out of the new tree scope. Search it in the original tree
- * and add it at the top of the new tree
- */
- ns = xmlSearchNs(node->doc, node, node->ns->prefix);
- if (ns != NULL) {
- xmlNodePtr root = ret;
-
- while (root->parent != NULL) root = root->parent;
- ret->ns = xmlNewNs(root, ns->href, ns->prefix);
- }
- } else {
- /*
- * reference the existing namespace definition in our own tree.
- */
- ret->ns = ns;
- }
- }
- if (node->properties != NULL)
- ret->properties = xmlCopyPropList(ret, node->properties);
- if (node->type == XML_ENTITY_REF_NODE) {
- if ((doc == NULL) || (node->doc != doc)) {
- /*
- * The copied node will go into a separate document, so
- * to avoid dangling references to the ENTITY_DECL node
- * we cannot keep the reference. Try to find it in the
- * target document.
- */
- ret->children = (xmlNodePtr) xmlGetDocEntity(doc, ret->name);
- } else {
- ret->children = node->children;
- }
- ret->last = ret->children;
- } else if (node->children != NULL) {
- ret->children = xmlStaticCopyNodeList(node->children, doc, ret);
- UPDATE_LAST_CHILD_AND_PARENT(ret)
- }
- return(ret);
-}
-
-static xmlNodePtr
-xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
- xmlNodePtr ret = NULL;
- xmlNodePtr p = NULL,q;
-
- while (node != NULL) {
- if (node->type == XML_DTD_NODE ) {
- if (doc == NULL) {
- node = node->next;
- continue;
- }
- if (doc->intSubset == NULL) {
- q = (xmlNodePtr) xmlCopyDtd( (xmlDtdPtr) node );
- q->doc = doc;
- q->parent = parent;
- doc->intSubset = (xmlDtdPtr) q;
- xmlAddChild(parent, q);
- } else {
- q = (xmlNodePtr) doc->intSubset;
- xmlAddChild(parent, q);
- }
- } else
- q = xmlStaticCopyNode(node, doc, parent, 1);
- if (ret == NULL) {
- q->prev = NULL;
- ret = p = q;
- } else if (p != q) {
- /* the test is required if xmlStaticCopyNode coalesced 2 text nodes */
- p->next = q;
- q->prev = p;
- p = q;
- }
- node = node->next;
- }
- return(ret);
-}
-
-/**
- * xmlCopyNode:
- * @node: the node
- * @recursive: if 1 do a recursive copy.
- *
- * Do a copy of the node.
- *
- * Returns: a new #xmlNodePtr, or NULL in case of error.
- */
-xmlNodePtr
-xmlCopyNode(const xmlNodePtr node, int recursive) {
- xmlNodePtr ret;
-
- ret = xmlStaticCopyNode(node, NULL, NULL, recursive);
- return(ret);
-}
-
-/**
- * xmlDocCopyNode:
- * @node: the node
- * @doc: the document
- * @recursive: if 1 do a recursive copy.
- *
- * Do a copy of the node to a given document.
- *
- * Returns: a new #xmlNodePtr, or NULL in case of error.
- */
-xmlNodePtr
-xmlDocCopyNode(const xmlNodePtr node, xmlDocPtr doc, int recursive) {
- xmlNodePtr ret;
-
- ret = xmlStaticCopyNode(node, doc, NULL, recursive);
- return(ret);
-}
-
-/**
- * xmlCopyNodeList:
- * @node: the first node in the list.
- *
- * Do a recursive copy of the node list.
- *
- * Returns: a new #xmlNodePtr, or NULL in case of error.
- */
-xmlNodePtr xmlCopyNodeList(const xmlNodePtr node) {
- xmlNodePtr ret = xmlStaticCopyNodeList(node, NULL, NULL);
- return(ret);
-}
-
-/**
- * xmlCopyDtd:
- * @dtd: the dtd
- *
- * Do a copy of the dtd.
- *
- * Returns: a new #xmlDtdPtr, or NULL in case of error.
- */
-xmlDtdPtr
-xmlCopyDtd(xmlDtdPtr dtd) {
- xmlDtdPtr ret;
- xmlNodePtr cur, p = NULL, q;
-
- if (dtd == NULL) return(NULL);
- ret = xmlNewDtd(NULL, dtd->name, dtd->ExternalID, dtd->SystemID);
- if (ret == NULL) return(NULL);
- if (dtd->entities != NULL)
- ret->entities = (void *) xmlCopyEntitiesTable(
- (xmlEntitiesTablePtr) dtd->entities);
- if (dtd->notations != NULL)
- ret->notations = (void *) xmlCopyNotationTable(
- (xmlNotationTablePtr) dtd->notations);
- if (dtd->elements != NULL)
- ret->elements = (void *) xmlCopyElementTable(
- (xmlElementTablePtr) dtd->elements);
- if (dtd->attributes != NULL)
- ret->attributes = (void *) xmlCopyAttributeTable(
- (xmlAttributeTablePtr) dtd->attributes);
- if (dtd->pentities != NULL)
- ret->pentities = (void *) xmlCopyEntitiesTable(
- (xmlEntitiesTablePtr) dtd->pentities);
-
- cur = dtd->children;
- while (cur != NULL) {
- q = NULL;
-
- if (cur->type == XML_ENTITY_DECL) {
- xmlEntityPtr tmp = (xmlEntityPtr) cur;
- switch (tmp->etype) {
- case XML_INTERNAL_GENERAL_ENTITY:
- case XML_EXTERNAL_GENERAL_PARSED_ENTITY:
- case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY:
- q = (xmlNodePtr) xmlGetEntityFromDtd(ret, tmp->name);
- break;
- case XML_INTERNAL_PARAMETER_ENTITY:
- case XML_EXTERNAL_PARAMETER_ENTITY:
- q = (xmlNodePtr)
- xmlGetParameterEntityFromDtd(ret, tmp->name);
- break;
- case XML_INTERNAL_PREDEFINED_ENTITY:
- break;
- }
- } else if (cur->type == XML_ELEMENT_DECL) {
- xmlElementPtr tmp = (xmlElementPtr) cur;
- q = (xmlNodePtr)
- xmlGetDtdQElementDesc(ret, tmp->name, tmp->prefix);
- } else if (cur->type == XML_ATTRIBUTE_DECL) {
- xmlAttributePtr tmp = (xmlAttributePtr) cur;
- q = (xmlNodePtr)
- xmlGetDtdQAttrDesc(ret, tmp->elem, tmp->name, tmp->prefix);
- } else if (cur->type == XML_COMMENT_NODE) {
- q = xmlCopyNode(cur, 0);
- }
-
- if (q == NULL) {
- cur = cur->next;
- continue;
- }
-
- if (p == NULL)
- ret->children = q;
- else
- p->next = q;
-
- q->prev = p;
- q->parent = (xmlNodePtr) ret;
- q->next = NULL;
- ret->last = q;
- p = q;
- cur = cur->next;
- }
-
- return(ret);
-}
-
-/**
- * xmlCopyDoc:
- * @doc: the document
- * @recursive: if 1 do a recursive copy.
- *
- * Do a copy of the document info. If recursive, the content tree will
- * be copied too as well as DTD, namespaces and entities.
- *
- * Returns: a new #xmlDocPtr, or NULL in case of error.
- */
-xmlDocPtr
-xmlCopyDoc(xmlDocPtr doc, int recursive) {
- xmlDocPtr ret;
-
- if (doc == NULL) return(NULL);
- ret = xmlNewDoc(doc->version);
- if (ret == NULL) return(NULL);
- if (doc->name != NULL)
- ret->name = xmlMemStrdup(doc->name);
- if (doc->encoding != NULL)
- ret->encoding = xmlStrdup(doc->encoding);
- ret->charset = doc->charset;
- ret->compression = doc->compression;
- ret->standalone = doc->standalone;
- if (!recursive) return(ret);
-
- ret->last = NULL;
- ret->children = NULL;
- if (doc->intSubset != NULL) {
- ret->intSubset = xmlCopyDtd(doc->intSubset);
- xmlSetTreeDoc((xmlNodePtr)ret->intSubset, ret);
- ret->intSubset->parent = ret;
- }
- if (doc->oldNs != NULL)
- ret->oldNs = xmlCopyNamespaceList(doc->oldNs);
- if (doc->children != NULL) {
- xmlNodePtr tmp;
-
- ret->children = xmlStaticCopyNodeList(doc->children, ret,
- (xmlNodePtr)ret);
- ret->last = NULL;
- tmp = ret->children;
- while (tmp != NULL) {
- if (tmp->next == NULL)
- ret->last = tmp;
- tmp = tmp->next;
- }
- }
- return(ret);
-}
-
-/************************************************************************
- * *
- * Content access functions *
- * *
- ************************************************************************/
-
-/**
- * xmlGetLineNo:
- * @node: valid node
- *
- * Get line number of node. this requires activation of this option
- * before invoking the parser by calling xmlLineNumbersDefault(1)
- *
- * Returns the line number if successful, -1 otherwise
- */
-long
-xmlGetLineNo(xmlNodePtr node)
-{
- long result = -1;
-
- if (!node)
- return result;
- if (node->type == XML_ELEMENT_NODE)
- result = (long) node->content;
- else if ((node->prev != NULL) &&
- ((node->prev->type == XML_ELEMENT_NODE) ||
- (node->prev->type == XML_TEXT_NODE)))
- result = xmlGetLineNo(node->prev);
- else if ((node->parent != NULL) &&
- ((node->parent->type == XML_ELEMENT_NODE) ||
- (node->parent->type == XML_TEXT_NODE)))
- result = xmlGetLineNo(node->parent);
-
- return result;
-}
-
-/**
- * xmlGetNodePath:
- * @node: a node
- *
- * Build a structure based Path for the given node
- *
- * Returns the new path or NULL in case of error. The caller must free
- * the returned string
- */
-xmlChar *
-xmlGetNodePath(xmlNodePtr node)
-{
- xmlNodePtr cur, tmp, next;
- xmlChar *buffer = NULL, *temp;
- size_t buf_len;
- xmlChar *buf;
- const char *sep;
- const char *name;
- char nametemp[100];
- int occur = 0;
-
- if (node == NULL)
- return (NULL);
-
- buf_len = 500;
- buffer = (xmlChar *) xmlMalloc(buf_len * sizeof(xmlChar));
- if (buffer == NULL)
- return (NULL);
- buf = (xmlChar *) xmlMalloc(buf_len * sizeof(xmlChar));
- if (buf == NULL) {
- xmlFree(buffer);
- return (NULL);
- }
-
- buffer[0] = 0;
- cur = node;
- do {
- name = "";
- sep = "?";
- occur = 0;
- if ((cur->type == XML_DOCUMENT_NODE) ||
- (cur->type == XML_HTML_DOCUMENT_NODE)) {
- if (buffer[0] == '/')
- break;
- sep = "/";
- next = NULL;
- } else if (cur->type == XML_ELEMENT_NODE) {
- sep = "/";
- name = (const char *) cur->name;
- if (cur->ns) {
- snprintf(nametemp, sizeof(nametemp) - 1,
- "%s:%s", cur->ns->prefix, cur->name);
- nametemp[sizeof(nametemp) - 1] = 0;
- name = nametemp;
- }
- next = cur->parent;
-
- /*
- * Thumbler index computation
- */
- tmp = cur->prev;
- while (tmp != NULL) {
- if ((tmp->type == XML_ELEMENT_NODE) &&
- (xmlStrEqual(cur->name, tmp->name)))
- occur++;
- tmp = tmp->prev;
- }
- if (occur == 0) {
- tmp = cur->next;
- while (tmp != NULL && occur == 0) {
- if ((tmp->type == XML_ELEMENT_NODE) &&
- (xmlStrEqual(cur->name, tmp->name)))
- occur++;
- tmp = tmp->next;
- }
- if (occur != 0)
- occur = 1;
- } else
- occur++;
- } else if (cur->type == XML_COMMENT_NODE) {
- sep = "/";
- name = "comment()";
- next = cur->parent;
-
- /*
- * Thumbler index computation
- */
- tmp = cur->prev;
- while (tmp != NULL) {
- if (tmp->type == XML_COMMENT_NODE)
- occur++;
- tmp = tmp->prev;
- }
- if (occur == 0) {
- tmp = cur->next;
- while (tmp != NULL && occur == 0) {
- if (tmp->type == XML_COMMENT_NODE)
- occur++;
- tmp = tmp->next;
- }
- if (occur != 0)
- occur = 1;
- } else
- occur++;
- } else if ((cur->type == XML_TEXT_NODE) ||
- (cur->type == XML_CDATA_SECTION_NODE)) {
- sep = "/";
- name = "text()";
- next = cur->parent;
-
- /*
- * Thumbler index computation
- */
- tmp = cur->prev;
- while (tmp != NULL) {
- if ((cur->type == XML_TEXT_NODE) ||
- (cur->type == XML_CDATA_SECTION_NODE))
- occur++;
- tmp = tmp->prev;
- }
- if (occur == 0) {
- tmp = cur->next;
- while (tmp != NULL && occur == 0) {
- if ((cur->type == XML_TEXT_NODE) ||
- (cur->type == XML_CDATA_SECTION_NODE))
- occur++;
- tmp = tmp->next;
- }
- if (occur != 0)
- occur = 1;
- } else
- occur++;
- } else if (cur->type == XML_PI_NODE) {
- sep = "/";
- snprintf(nametemp, sizeof(nametemp) - 1,
- "processing-instruction('%s')", cur->name);
- nametemp[sizeof(nametemp) - 1] = 0;
- name = nametemp;
-
- next = cur->parent;
-
- /*
- * Thumbler index computation
- */
- tmp = cur->prev;
- while (tmp != NULL) {
- if ((tmp->type == XML_PI_NODE) &&
- (xmlStrEqual(cur->name, tmp->name)))
- occur++;
- tmp = tmp->prev;
- }
- if (occur == 0) {
- tmp = cur->next;
- while (tmp != NULL && occur == 0) {
- if ((tmp->type == XML_PI_NODE) &&
- (xmlStrEqual(cur->name, tmp->name)))
- occur++;
- tmp = tmp->next;
- }
- if (occur != 0)
- occur = 1;
- } else
- occur++;
-
- } else if (cur->type == XML_ATTRIBUTE_NODE) {
- sep = "/@";
- name = (const char *) (((xmlAttrPtr) cur)->name);
- next = ((xmlAttrPtr) cur)->parent;
- } else {
- next = cur->parent;
- }
-
- /*
- * Make sure there is enough room
- */
- if (xmlStrlen(buffer) + sizeof(nametemp) + 20 > buf_len) {
- buf_len =
- 2 * buf_len + xmlStrlen(buffer) + sizeof(nametemp) + 20;
- temp = (xmlChar *) xmlRealloc(buffer, buf_len);
- if (temp == NULL) {
- xmlFree(buf);
- xmlFree(buffer);
- return (NULL);
- }
- buffer = temp;
- temp = (xmlChar *) xmlRealloc(buf, buf_len);
- if (temp == NULL) {
- xmlFree(buf);
- xmlFree(buffer);
- return (NULL);
- }
- buf = temp;
- }
- if (occur == 0)
- snprintf((char *) buf, buf_len, "%s%s%s",
- sep, name, (char *) buffer);
- else
- snprintf((char *) buf, buf_len, "%s%s[%d]%s",
- sep, name, occur, (char *) buffer);
- snprintf((char *) buffer, buf_len, "%s", buf);
- cur = next;
- } while (cur != NULL);
- xmlFree(buf);
- return (buffer);
-}
-
-/**
- * xmlDocGetRootElement:
- * @doc: the document
- *
- * Get the root element of the document (doc->children is a list
- * containing possibly comments, PIs, etc ...).
- *
- * Returns the #xmlNodePtr for the root or NULL
- */
-xmlNodePtr
-xmlDocGetRootElement(xmlDocPtr doc) {
- xmlNodePtr ret;
-
- if (doc == NULL) return(NULL);
- ret = doc->children;
- while (ret != NULL) {
- if (ret->type == XML_ELEMENT_NODE)
- return(ret);
- ret = ret->next;
- }
- return(ret);
-}
-
-/**
- * xmlDocSetRootElement:
- * @doc: the document
- * @root: the new document root element
- *
- * Set the root element of the document (doc->children is a list
- * containing possibly comments, PIs, etc ...).
- *
- * Returns the old root element if any was found
- */
-xmlNodePtr
-xmlDocSetRootElement(xmlDocPtr doc, xmlNodePtr root) {
- xmlNodePtr old = NULL;
-
- if (doc == NULL) return(NULL);
- if (root == NULL)
- return(NULL);
- xmlUnlinkNode(root);
- root->doc = doc;
- root->parent = (xmlNodePtr) doc;
- old = doc->children;
- while (old != NULL) {
- if (old->type == XML_ELEMENT_NODE)
- break;
- old = old->next;
- }
- if (old == NULL) {
- if (doc->children == NULL) {
- doc->children = root;
- doc->last = root;
- } else {
- xmlAddSibling(doc->children, root);
- }
- } else {
- xmlReplaceNode(old, root);
- }
- return(old);
-}
-
-/**
- * xmlNodeSetLang:
- * @cur: the node being changed
- * @lang: the language description
- *
- * Set the language of a node, i.e. the values of the xml:lang
- * attribute.
- */
-void
-xmlNodeSetLang(xmlNodePtr cur, const xmlChar *lang) {
- xmlNsPtr ns;
-
- if (cur == NULL) return;
- switch(cur->type) {
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_COMMENT_NODE:
- case XML_DOCUMENT_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_NOTATION_NODE:
- case XML_HTML_DOCUMENT_NODE:
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- case XML_PI_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_NAMESPACE_DECL:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- return;
- case XML_ELEMENT_NODE:
- case XML_ATTRIBUTE_NODE:
- break;
- }
- ns = xmlSearchNsByHref(cur->doc, cur, XML_XML_NAMESPACE);
- if (ns == NULL)
- return;
- xmlSetNsProp(cur, ns, BAD_CAST "lang", lang);
-}
-
-/**
- * xmlNodeGetLang:
- * @cur: the node being checked
- *
- * Searches the language of a node, i.e. the values of the xml:lang
- * attribute or the one carried by the nearest ancestor.
- *
- * Returns a pointer to the lang value, or NULL if not found
- * It's up to the caller to free the memory with xmlFree().
- */
-xmlChar *
-xmlNodeGetLang(xmlNodePtr cur) {
- xmlChar *lang;
-
- while (cur != NULL) {
- lang = xmlGetNsProp(cur, BAD_CAST "lang", XML_XML_NAMESPACE);
- if (lang != NULL)
- return(lang);
- cur = cur->parent;
- }
- return(NULL);
-}
-
-
-/**
- * xmlNodeSetSpacePreserve:
- * @cur: the node being changed
- * @val: the xml:space value ("0": default, 1: "preserve")
- *
- * Set (or reset) the space preserving behaviour of a node, i.e. the
- * value of the xml:space attribute.
- */
-void
-xmlNodeSetSpacePreserve(xmlNodePtr cur, int val) {
- xmlNsPtr ns;
-
- if (cur == NULL) return;
- switch(cur->type) {
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_COMMENT_NODE:
- case XML_DOCUMENT_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_NOTATION_NODE:
- case XML_HTML_DOCUMENT_NODE:
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- case XML_PI_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_NAMESPACE_DECL:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- return;
- case XML_ELEMENT_NODE:
- case XML_ATTRIBUTE_NODE:
- break;
- }
- ns = xmlSearchNsByHref(cur->doc, cur, XML_XML_NAMESPACE);
- if (ns == NULL)
- return;
- switch (val) {
- case 0:
- xmlSetNsProp(cur, ns, BAD_CAST "space", BAD_CAST "default");
- break;
- case 1:
- xmlSetNsProp(cur, ns, BAD_CAST "space", BAD_CAST "preserve");
- break;
- }
-}
-
-/**
- * xmlNodeGetSpacePreserve:
- * @cur: the node being checked
- *
- * Searches the space preserving behaviour of a node, i.e. the values
- * of the xml:space attribute or the one carried by the nearest
- * ancestor.
- *
- * Returns -1 if xml:space is not inherited, 0 if "default", 1 if "preserve"
- */
-int
-xmlNodeGetSpacePreserve(xmlNodePtr cur) {
- xmlChar *space;
-
- while (cur != NULL) {
- space = xmlGetNsProp(cur, BAD_CAST "space", XML_XML_NAMESPACE);
- if (space != NULL) {
- if (xmlStrEqual(space, BAD_CAST "preserve")) {
- xmlFree(space);
- return(1);
- }
- if (xmlStrEqual(space, BAD_CAST "default")) {
- xmlFree(space);
- return(0);
- }
- xmlFree(space);
- }
- cur = cur->parent;
- }
- return(-1);
-}
-
-/**
- * xmlNodeSetName:
- * @cur: the node being changed
- * @name: the new tag name
- *
- * Set (or reset) the name of a node.
- */
-void
-xmlNodeSetName(xmlNodePtr cur, const xmlChar *name) {
- if (cur == NULL) return;
- if (name == NULL) return;
- switch(cur->type) {
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_COMMENT_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_NOTATION_NODE:
- case XML_HTML_DOCUMENT_NODE:
- case XML_NAMESPACE_DECL:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- return;
- case XML_ELEMENT_NODE:
- case XML_ATTRIBUTE_NODE:
- case XML_PI_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_DTD_NODE:
- case XML_DOCUMENT_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- break;
- }
- if (cur->name != NULL) xmlFree((xmlChar *) cur->name);
- cur->name = xmlStrdup(name);
-}
-
-/**
- * xmlNodeSetBase:
- * @cur: the node being changed
- * @uri: the new base URI
- *
- * Set (or reset) the base URI of a node, i.e. the value of the
- * xml:base attribute.
- */
-void
-xmlNodeSetBase(xmlNodePtr cur, xmlChar* uri) {
- xmlNsPtr ns;
-
- if (cur == NULL) return;
- switch(cur->type) {
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_COMMENT_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_NOTATION_NODE:
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- case XML_PI_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_NAMESPACE_DECL:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- return;
- case XML_ELEMENT_NODE:
- case XML_ATTRIBUTE_NODE:
- break;
- case XML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- case XML_HTML_DOCUMENT_NODE: {
- xmlDocPtr doc = (xmlDocPtr) cur;
-
- if (doc->URL != NULL)
- xmlFree((xmlChar *) doc->URL);
- if (uri == NULL)
- doc->URL = NULL;
- else
- doc->URL = xmlStrdup(uri);
- return;
- }
- }
-
- ns = xmlSearchNsByHref(cur->doc, cur, XML_XML_NAMESPACE);
- if (ns == NULL)
- return;
- xmlSetNsProp(cur, ns, BAD_CAST "base", uri);
-}
-
-/**
- * xmlNodeGetBase:
- * @doc: the document the node pertains to
- * @cur: the node being checked
- *
- * Searches for the BASE URL. The code should work on both XML
- * and HTML document even if base mechanisms are completely different.
- * It returns the base as defined in RFC 2396 sections
- * 5.1.1. Base URI within Document Content
- * and
- * 5.1.2. Base URI from the Encapsulating Entity
- * However it does not return the document base (5.1.3), use
- * xmlDocumentGetBase() for this
- *
- * Returns a pointer to the base URL, or NULL if not found
- * It's up to the caller to free the memory with xmlFree().
- */
-xmlChar *
-xmlNodeGetBase(xmlDocPtr doc, xmlNodePtr cur) {
- xmlChar *oldbase = NULL;
- xmlChar *base, *newbase;
-
- if ((cur == NULL) && (doc == NULL))
- return(NULL);
- if (doc == NULL) doc = cur->doc;
- if ((doc != NULL) && (doc->type == XML_HTML_DOCUMENT_NODE)) {
- cur = doc->children;
- while ((cur != NULL) && (cur->name != NULL)) {
- if (cur->type != XML_ELEMENT_NODE) {
- cur = cur->next;
- continue;
- }
- if (!xmlStrcasecmp(cur->name, BAD_CAST "html")) {
- cur = cur->children;
- continue;
- }
- if (!xmlStrcasecmp(cur->name, BAD_CAST "head")) {
- cur = cur->children;
- continue;
- }
- if (!xmlStrcasecmp(cur->name, BAD_CAST "base")) {
- return(xmlGetProp(cur, BAD_CAST "href"));
- }
- cur = cur->next;
- }
- return(NULL);
- }
- while (cur != NULL) {
- if (cur->type == XML_ENTITY_DECL) {
- xmlEntityPtr ent = (xmlEntityPtr) cur;
- return(xmlStrdup(ent->URI));
- }
- if (cur->type == XML_ELEMENT_NODE) {
- base = xmlGetNsProp(cur, BAD_CAST "base", XML_XML_NAMESPACE);
- if (base != NULL) {
- if (oldbase != NULL) {
- newbase = xmlBuildURI(oldbase, base);
- if (newbase != NULL) {
- xmlFree(oldbase);
- xmlFree(base);
- oldbase = newbase;
- } else {
- xmlFree(oldbase);
- xmlFree(base);
- return(NULL);
- }
- } else {
- oldbase = base;
- }
- if ((!xmlStrncmp(oldbase, BAD_CAST "http://", 7)) ||
- (!xmlStrncmp(oldbase, BAD_CAST "ftp://", 6)) ||
- (!xmlStrncmp(oldbase, BAD_CAST "urn:", 4)))
- return(oldbase);
- }
- }
- cur = cur->parent;
- }
- if ((doc != NULL) && (doc->URL != NULL)) {
- if (oldbase == NULL)
- return(xmlStrdup(doc->URL));
- newbase = xmlBuildURI(oldbase, doc->URL);
- xmlFree(oldbase);
- return(newbase);
- }
- return(oldbase);
-}
-
-/**
- * xmlNodeGetContent:
- * @cur: the node being read
- *
- * Read the value of a node, this can be either the text carried
- * directly by this node if it's a TEXT node or the aggregate string
- * of the values carried by this node child's (TEXT and ENTITY_REF).
- * Entity references are substituted.
- * Returns a new #xmlChar * or NULL if no content is available.
- * It's up to the caller to free the memory with xmlFree().
- */
-xmlChar *
-xmlNodeGetContent(xmlNodePtr cur)
-{
- if (cur == NULL)
- return (NULL);
- switch (cur->type) {
- case XML_DOCUMENT_FRAG_NODE:
- case XML_ELEMENT_NODE:{
- xmlNodePtr tmp = cur;
- xmlBufferPtr buffer;
- xmlChar *ret;
-
- buffer = xmlBufferCreate();
- if (buffer == NULL)
- return (NULL);
- while (tmp != NULL) {
- switch (tmp->type) {
- case XML_CDATA_SECTION_NODE:
- case XML_TEXT_NODE:
- if (tmp->content != NULL)
- xmlBufferCat(buffer, tmp->content);
- break;
- case XML_ENTITY_REF_NODE:{
- /* recursive substitution of entity references */
- xmlChar *cont = xmlNodeGetContent(tmp);
-
- if (cont) {
- xmlBufferCat(buffer,
- (const xmlChar *) cont);
- xmlFree(cont);
- }
- break;
- }
- default:
- break;
- }
- /*
- * Skip to next node
- */
- if (tmp->children != NULL) {
- if (tmp->children->type != XML_ENTITY_DECL) {
- tmp = tmp->children;
- continue;
- }
- }
- if (tmp == cur)
- break;
-
- if (tmp->next != NULL) {
- tmp = tmp->next;
- continue;
- }
-
- do {
- tmp = tmp->parent;
- if (tmp == NULL)
- break;
- if (tmp == cur) {
- tmp = NULL;
- break;
- }
- if (tmp->next != NULL) {
- tmp = tmp->next;
- break;
- }
- } while (tmp != NULL);
- }
- ret = buffer->content;
- buffer->content = NULL;
- xmlBufferFree(buffer);
- return (ret);
- }
- case XML_ATTRIBUTE_NODE:{
- xmlAttrPtr attr = (xmlAttrPtr) cur;
-
- if (attr->parent != NULL)
- return (xmlNodeListGetString
- (attr->parent->doc, attr->children, 1));
- else
- return (xmlNodeListGetString(NULL, attr->children, 1));
- break;
- }
- case XML_COMMENT_NODE:
- case XML_PI_NODE:
- if (cur->content != NULL)
- return (xmlStrdup(cur->content));
- return (NULL);
- case XML_ENTITY_REF_NODE:{
- xmlEntityPtr ent;
- xmlNodePtr tmp;
- xmlBufferPtr buffer;
- xmlChar *ret;
-
- /* lookup entity declaration */
- ent = xmlGetDocEntity(cur->doc, cur->name);
- if (ent == NULL)
- return (NULL);
-
- buffer = xmlBufferCreate();
- if (buffer == NULL)
- return (NULL);
-
- /* an entity content can be any "well balanced chunk",
- * i.e. the result of the content [43] production:
- * http://www.w3.org/TR/REC-xml#NT-content
- * -> we iterate through child nodes and recursive call
- * xmlNodeGetContent() which handles all possible node types */
- tmp = ent->children;
- while (tmp) {
- xmlChar *cont = xmlNodeGetContent(tmp);
-
- if (cont) {
- xmlBufferCat(buffer, (const xmlChar *) cont);
- xmlFree(cont);
- }
- tmp = tmp->next;
- }
-
- ret = buffer->content;
- buffer->content = NULL;
- xmlBufferFree(buffer);
- return (ret);
- }
- case XML_ENTITY_NODE:
- case XML_DOCUMENT_NODE:
- case XML_HTML_DOCUMENT_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_NOTATION_NODE:
- case XML_DTD_NODE:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- return (NULL);
- case XML_NAMESPACE_DECL: {
- xmlChar *tmp;
-
- tmp = xmlStrdup(((xmlNsPtr) cur)->href);
- return (tmp);
- }
- case XML_ELEMENT_DECL:
- /* TODO !!! */
- return (NULL);
- case XML_ATTRIBUTE_DECL:
- /* TODO !!! */
- return (NULL);
- case XML_ENTITY_DECL:
- /* TODO !!! */
- return (NULL);
- case XML_CDATA_SECTION_NODE:
- case XML_TEXT_NODE:
- if (cur->content != NULL)
- return (xmlStrdup(cur->content));
- return (NULL);
- }
- return (NULL);
-}
-/**
- * xmlNodeSetContent:
- * @cur: the node being modified
- * @content: the new value of the content
- *
- * Replace the content of a node.
- */
-void
-xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) {
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNodeSetContent : node == NULL\n");
-#endif
- return;
- }
- switch (cur->type) {
- case XML_DOCUMENT_FRAG_NODE:
- case XML_ELEMENT_NODE:
- case XML_ATTRIBUTE_NODE:
- if (cur->children != NULL) xmlFreeNodeList(cur->children);
- cur->children = xmlStringGetNodeList(cur->doc, content);
- UPDATE_LAST_CHILD_AND_PARENT(cur)
- break;
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- if (cur->content != NULL) {
- xmlFree(cur->content);
- }
- if (cur->children != NULL) xmlFreeNodeList(cur->children);
- cur->last = cur->children = NULL;
- if (content != NULL) {
- cur->content = xmlStrdup(content);
- } else
- cur->content = NULL;
- break;
- case XML_DOCUMENT_NODE:
- case XML_HTML_DOCUMENT_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- break;
- case XML_NOTATION_NODE:
- break;
- case XML_DTD_NODE:
- break;
- case XML_NAMESPACE_DECL:
- break;
- case XML_ELEMENT_DECL:
- /* TODO !!! */
- break;
- case XML_ATTRIBUTE_DECL:
- /* TODO !!! */
- break;
- case XML_ENTITY_DECL:
- /* TODO !!! */
- break;
- }
-}
-
-/**
- * xmlNodeSetContentLen:
- * @cur: the node being modified
- * @content: the new value of the content
- * @len: the size of @content
- *
- * Replace the content of a node.
- */
-void
-xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNodeSetContentLen : node == NULL\n");
-#endif
- return;
- }
- switch (cur->type) {
- case XML_DOCUMENT_FRAG_NODE:
- case XML_ELEMENT_NODE:
- case XML_ATTRIBUTE_NODE:
- if (cur->children != NULL) xmlFreeNodeList(cur->children);
- cur->children = xmlStringLenGetNodeList(cur->doc, content, len);
- UPDATE_LAST_CHILD_AND_PARENT(cur)
- break;
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_NOTATION_NODE:
- if (cur->content != NULL) {
- xmlFree(cur->content);
- }
- if (cur->children != NULL) xmlFreeNodeList(cur->children);
- cur->children = cur->last = NULL;
- if (content != NULL) {
- cur->content = xmlStrndup(content, len);
- } else
- cur->content = NULL;
- break;
- case XML_DOCUMENT_NODE:
- case XML_DTD_NODE:
- case XML_HTML_DOCUMENT_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_NAMESPACE_DECL:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- break;
- case XML_ELEMENT_DECL:
- /* TODO !!! */
- break;
- case XML_ATTRIBUTE_DECL:
- /* TODO !!! */
- break;
- case XML_ENTITY_DECL:
- /* TODO !!! */
- break;
- }
-}
-
-/**
- * xmlNodeAddContentLen:
- * @cur: the node being modified
- * @content: extra content
- * @len: the size of @content
- *
- * Append the extra substring to the node content.
- */
-void
-xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNodeAddContentLen : node == NULL\n");
-#endif
- return;
- }
- if (len <= 0) return;
- switch (cur->type) {
- case XML_DOCUMENT_FRAG_NODE:
- case XML_ELEMENT_NODE: {
- xmlNodePtr last, newNode, tmp;
-
- last = cur->last;
- newNode = xmlNewTextLen(content, len);
- if (newNode != NULL) {
- tmp = xmlAddChild(cur, newNode);
- if (tmp != newNode)
- return;
- if ((last != NULL) && (last->next == newNode)) {
- xmlTextMerge(last, newNode);
- }
- }
- break;
- }
- case XML_ATTRIBUTE_NODE:
- break;
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_NOTATION_NODE:
- if (content != NULL) {
- cur->content = xmlStrncat(cur->content, content, len);
- }
- case XML_DOCUMENT_NODE:
- case XML_DTD_NODE:
- case XML_HTML_DOCUMENT_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_NAMESPACE_DECL:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- break;
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- break;
- }
-}
-
-/**
- * xmlNodeAddContent:
- * @cur: the node being modified
- * @content: extra content
- *
- * Append the extra substring to the node content.
- */
-void
-xmlNodeAddContent(xmlNodePtr cur, const xmlChar *content) {
- int len;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNodeAddContent : node == NULL\n");
-#endif
- return;
- }
- if (content == NULL) return;
- len = xmlStrlen(content);
- xmlNodeAddContentLen(cur, content, len);
-}
-
-/**
- * xmlTextMerge:
- * @first: the first text node
- * @second: the second text node being merged
- *
- * Merge two text nodes into one
- * Returns the first text node augmented
- */
-xmlNodePtr
-xmlTextMerge(xmlNodePtr first, xmlNodePtr second) {
- if (first == NULL) return(second);
- if (second == NULL) return(first);
- if (first->type != XML_TEXT_NODE) return(first);
- if (second->type != XML_TEXT_NODE) return(first);
- if (second->name != first->name)
- return(first);
- xmlNodeAddContent(first, second->content);
- xmlUnlinkNode(second);
- xmlFreeNode(second);
- return(first);
-}
-
-/**
- * xmlGetNsList:
- * @doc: the document
- * @node: the current node
- *
- * Search all the namespace applying to a given element.
- * Returns an NULL terminated array of all the #xmlNsPtr found
- * that need to be freed by the caller or NULL if no
- * namespace if defined
- */
-xmlNsPtr *
-xmlGetNsList(xmlDocPtr doc ATTRIBUTE_UNUSED, xmlNodePtr node)
-{
- xmlNsPtr cur;
- xmlNsPtr *ret = NULL;
- int nbns = 0;
- int maxns = 10;
- int i;
-
- while (node != NULL) {
- if (node->type == XML_ELEMENT_NODE) {
- cur = node->nsDef;
- while (cur != NULL) {
- if (ret == NULL) {
- ret =
- (xmlNsPtr *) xmlMalloc((maxns + 1) *
- sizeof(xmlNsPtr));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlGetNsList : out of memory!\n");
- return (NULL);
- }
- ret[nbns] = NULL;
- }
- for (i = 0; i < nbns; i++) {
- if ((cur->prefix == ret[i]->prefix) ||
- (xmlStrEqual(cur->prefix, ret[i]->prefix)))
- break;
- }
- if (i >= nbns) {
- if (nbns >= maxns) {
- maxns *= 2;
- ret = (xmlNsPtr *) xmlRealloc(ret,
- (maxns +
- 1) *
- sizeof(xmlNsPtr));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlGetNsList : realloc failed!\n");
- return (NULL);
- }
- }
- ret[nbns++] = cur;
- ret[nbns] = NULL;
- }
-
- cur = cur->next;
- }
- }
- node = node->parent;
- }
- return (ret);
-}
-
-/**
- * xmlSearchNs:
- * @doc: the document
- * @node: the current node
- * @nameSpace: the namespace prefix
- *
- * Search a Ns registered under a given name space for a document.
- * recurse on the parents until it finds the defined namespace
- * or return NULL otherwise.
- * @nameSpace can be NULL, this is a search for the default namespace.
- * We don't allow to cross entities boundaries. If you don't declare
- * the namespace within those you will be in troubles !!! A warning
- * is generated to cover this case.
- *
- * Returns the namespace pointer or NULL.
- */
-xmlNsPtr
-xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) {
- xmlNsPtr cur;
-
- if (node == NULL) return(NULL);
- if ((nameSpace != NULL) &&
- (xmlStrEqual(nameSpace, (const xmlChar *)"xml"))) {
- if ((doc == NULL) && (node->type == XML_ELEMENT_NODE)) {
- /*
- * The XML-1.0 namespace is normally held on the root
- * element. In this case exceptionally create it on the
- * node element.
- */
- cur = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSearchNs : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlNs));
- cur->type = XML_LOCAL_NAMESPACE;
- cur->href = xmlStrdup(XML_XML_NAMESPACE);
- cur->prefix = xmlStrdup((const xmlChar *)"xml");
- cur->next = node->nsDef;
- node->nsDef = cur;
- return(cur);
- }
- if (doc->oldNs == NULL) {
- /*
- * Allocate a new Namespace and fill the fields.
- */
- doc->oldNs = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
- if (doc->oldNs == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSearchNs : malloc failed\n");
- return(NULL);
- }
- memset(doc->oldNs, 0, sizeof(xmlNs));
- doc->oldNs->type = XML_LOCAL_NAMESPACE;
-
- doc->oldNs->href = xmlStrdup(XML_XML_NAMESPACE);
- doc->oldNs->prefix = xmlStrdup((const xmlChar *)"xml");
- }
- return(doc->oldNs);
- }
- while (node != NULL) {
- if ((node->type == XML_ENTITY_REF_NODE) ||
- (node->type == XML_ENTITY_NODE) ||
- (node->type == XML_ENTITY_DECL))
- return(NULL);
- if (node->type == XML_ELEMENT_NODE) {
- cur = node->nsDef;
- while (cur != NULL) {
- if ((cur->prefix == NULL) && (nameSpace == NULL) &&
- (cur->href != NULL))
- return(cur);
- if ((cur->prefix != NULL) && (nameSpace != NULL) &&
- (cur->href != NULL) &&
- (xmlStrEqual(cur->prefix, nameSpace)))
- return(cur);
- cur = cur->next;
- }
- }
- node = node->parent;
- }
- return(NULL);
-}
-
-/**
- * xmlSearchNsByHref:
- * @doc: the document
- * @node: the current node
- * @href: the namespace value
- *
- * Search a Ns aliasing a given URI. Recurse on the parents until it finds
- * the defined namespace or return NULL otherwise.
- * Returns the namespace pointer or NULL.
- */
-xmlNsPtr
-xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar *href) {
- xmlNsPtr cur;
- xmlNodePtr orig = node;
-
- if ((node == NULL) || (href == NULL)) return(NULL);
- if (xmlStrEqual(href, XML_XML_NAMESPACE)) {
- /*
- * Only the document can hold the XML spec namespace.
- */
- if ((doc == NULL) && (node->type == XML_ELEMENT_NODE)) {
- /*
- * The XML-1.0 namespace is normally held on the root
- * element. In this case exceptionally create it on the
- * node element.
- */
- cur = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSearchNs : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlNs));
- cur->type = XML_LOCAL_NAMESPACE;
- cur->href = xmlStrdup(XML_XML_NAMESPACE);
- cur->prefix = xmlStrdup((const xmlChar *)"xml");
- cur->next = node->nsDef;
- node->nsDef = cur;
- return(cur);
- }
- if (doc->oldNs == NULL) {
- /*
- * Allocate a new Namespace and fill the fields.
- */
- doc->oldNs = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
- if (doc->oldNs == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSearchNsByHref : malloc failed\n");
- return(NULL);
- }
- memset(doc->oldNs, 0, sizeof(xmlNs));
- doc->oldNs->type = XML_LOCAL_NAMESPACE;
-
- doc->oldNs->href = xmlStrdup(XML_XML_NAMESPACE);
- doc->oldNs->prefix = xmlStrdup((const xmlChar *)"xml");
- }
- return(doc->oldNs);
- }
- while (node != NULL) {
- cur = node->nsDef;
- while (cur != NULL) {
- if ((cur->href != NULL) && (href != NULL) &&
- (xmlStrEqual(cur->href, href))) {
- /*
- * Check that the prefix is not shadowed between orig and node
- */
- xmlNodePtr check = orig;
- xmlNsPtr tst;
-
- while (check != node) {
- tst = check->nsDef;
- while (tst != NULL) {
- if ((tst->prefix == NULL) && (cur->prefix == NULL))
- goto shadowed;
- if ((tst->prefix != NULL) && (cur->prefix != NULL) &&
- (xmlStrEqual(tst->prefix, cur->prefix)))
- goto shadowed;
- tst = tst->next;
- }
- check = check->parent;
- }
- return(cur);
- }
-shadowed:
- cur = cur->next;
- }
- node = node->parent;
- }
- return(NULL);
-}
-
-/**
- * xmlNewReconciliedNs:
- * @doc: the document
- * @tree: a node expected to hold the new namespace
- * @ns: the original namespace
- *
- * This function tries to locate a namespace definition in a tree
- * ancestors, or create a new namespace definition node similar to
- * @ns trying to reuse the same prefix. However if the given prefix is
- * null (default namespace) or reused within the subtree defined by
- * @tree or on one of its ancestors then a new prefix is generated.
- * Returns the (new) namespace definition or NULL in case of error
- */
-xmlNsPtr
-xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) {
- xmlNsPtr def;
- xmlChar prefix[50];
- int counter = 1;
-
- if (tree == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewReconciliedNs : tree == NULL\n");
-#endif
- return(NULL);
- }
- if (ns == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewReconciliedNs : ns == NULL\n");
-#endif
- return(NULL);
- }
- /*
- * Search an existing namespace definition inherited.
- */
- def = xmlSearchNsByHref(doc, tree, ns->href);
- if (def != NULL)
- return(def);
-
- /*
- * Find a close prefix which is not already in use.
- * Let's strip namespace prefixes longer than 20 chars !
- */
- if (ns->prefix == NULL)
- snprintf((char *) prefix, sizeof(prefix), "default");
- else
- snprintf((char *) prefix, sizeof(prefix), "%.20s", ns->prefix);
-
- def = xmlSearchNs(doc, tree, prefix);
- while (def != NULL) {
- if (counter > 1000) return(NULL);
- if (ns->prefix == NULL)
- snprintf((char *) prefix, sizeof(prefix), "default%d", counter++);
- else
- snprintf((char *) prefix, sizeof(prefix), "%.20s%d", ns->prefix, counter++);
- def = xmlSearchNs(doc, tree, prefix);
- }
-
- /*
- * OK, now we are ready to create a new one.
- */
- def = xmlNewNs(tree, ns->href, prefix);
- return(def);
-}
-
-/**
- * xmlReconciliateNs:
- * @doc: the document
- * @tree: a node defining the subtree to reconciliate
- *
- * This function checks that all the namespaces declared within the given
- * tree are properly declared. This is needed for example after Copy or Cut
- * and then paste operations. The subtree may still hold pointers to
- * namespace declarations outside the subtree or invalid/masked. As much
- * as possible the function try to reuse the existing namespaces found in
- * the new environment. If not possible the new namespaces are redeclared
- * on @tree at the top of the given subtree.
- * Returns the number of namespace declarations created or -1 in case of error.
- */
-int
-xmlReconciliateNs(xmlDocPtr doc, xmlNodePtr tree) {
- xmlNsPtr *oldNs = NULL;
- xmlNsPtr *newNs = NULL;
- int sizeCache = 0;
- int nbCache = 0;
-
- xmlNsPtr n;
- xmlNodePtr node = tree;
- xmlAttrPtr attr;
- int ret = 0, i;
-
- while (node != NULL) {
- /*
- * Reconciliate the node namespace
- */
- if (node->ns != NULL) {
- /*
- * initialize the cache if needed
- */
- if (sizeCache == 0) {
- sizeCache = 10;
- oldNs = (xmlNsPtr *) xmlMalloc(sizeCache *
- sizeof(xmlNsPtr));
- if (oldNs == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlReconciliateNs : memory pbm\n");
- return(-1);
- }
- newNs = (xmlNsPtr *) xmlMalloc(sizeCache *
- sizeof(xmlNsPtr));
- if (newNs == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlReconciliateNs : memory pbm\n");
- xmlFree(oldNs);
- return(-1);
- }
- }
- for (i = 0;i < nbCache;i++) {
- if (oldNs[i] == node->ns) {
- node->ns = newNs[i];
- break;
- }
- }
- if (i == nbCache) {
- /*
- * OK we need to recreate a new namespace definition
- */
- n = xmlNewReconciliedNs(doc, tree, node->ns);
- if (n != NULL) { /* :-( what if else ??? */
- /*
- * check if we need to grow the cache buffers.
- */
- if (sizeCache <= nbCache) {
- sizeCache *= 2;
- oldNs = (xmlNsPtr *) xmlRealloc(oldNs, sizeCache *
- sizeof(xmlNsPtr));
- if (oldNs == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlReconciliateNs : memory pbm\n");
- xmlFree(newNs);
- return(-1);
- }
- newNs = (xmlNsPtr *) xmlRealloc(newNs, sizeCache *
- sizeof(xmlNsPtr));
- if (newNs == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlReconciliateNs : memory pbm\n");
- xmlFree(oldNs);
- return(-1);
- }
- }
- newNs[nbCache] = n;
- oldNs[nbCache++] = node->ns;
- node->ns = n;
- }
- }
- }
- /*
- * now check for namespace hold by attributes on the node.
- */
- attr = node->properties;
- while (attr != NULL) {
- if (attr->ns != NULL) {
- /*
- * initialize the cache if needed
- */
- if (sizeCache == 0) {
- sizeCache = 10;
- oldNs = (xmlNsPtr *) xmlMalloc(sizeCache *
- sizeof(xmlNsPtr));
- if (oldNs == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlReconciliateNs : memory pbm\n");
- return(-1);
- }
- newNs = (xmlNsPtr *) xmlMalloc(sizeCache *
- sizeof(xmlNsPtr));
- if (newNs == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlReconciliateNs : memory pbm\n");
- xmlFree(oldNs);
- return(-1);
- }
- }
- for (i = 0;i < nbCache;i++) {
- if (oldNs[i] == attr->ns) {
- attr->ns = newNs[i];
- break;
- }
- }
- if (i == nbCache) {
- /*
- * OK we need to recreate a new namespace definition
- */
- n = xmlNewReconciliedNs(doc, tree, attr->ns);
- if (n != NULL) { /* :-( what if else ??? */
- /*
- * check if we need to grow the cache buffers.
- */
- if (sizeCache <= nbCache) {
- sizeCache *= 2;
- oldNs = (xmlNsPtr *) xmlRealloc(oldNs, sizeCache *
- sizeof(xmlNsPtr));
- if (oldNs == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlReconciliateNs : memory pbm\n");
- xmlFree(newNs);
- return(-1);
- }
- newNs = (xmlNsPtr *) xmlRealloc(newNs, sizeCache *
- sizeof(xmlNsPtr));
- if (newNs == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlReconciliateNs : memory pbm\n");
- xmlFree(oldNs);
- return(-1);
- }
- }
- newNs[nbCache] = n;
- oldNs[nbCache++] = attr->ns;
- attr->ns = n;
- }
- }
- }
- attr = attr->next;
- }
-
- /*
- * Browse the full subtree, deep first
- */
- if (node->children != NULL) {
- /* deep first */
- node = node->children;
- } else if ((node != tree) && (node->next != NULL)) {
- /* then siblings */
- node = node->next;
- } else if (node != tree) {
- /* go up to parents->next if needed */
- while (node != tree) {
- if (node->parent != NULL)
- node = node->parent;
- if ((node != tree) && (node->next != NULL)) {
- node = node->next;
- break;
- }
- if (node->parent == NULL) {
- node = NULL;
- break;
- }
- }
- /* exit condition */
- if (node == tree)
- node = NULL;
- } else
- break;
- }
- if (oldNs != NULL)
- xmlFree(oldNs);
- if (newNs != NULL)
- xmlFree(newNs);
- return(ret);
-}
-
-/**
- * xmlHasProp:
- * @node: the node
- * @name: the attribute name
- *
- * Search an attribute associated to a node
- * This function also looks in DTD attribute declaration for #FIXED or
- * default declaration values unless DTD use has been turned off.
- *
- * Returns the attribute or the attribute declaration or NULL if
- * neither was found.
- */
-xmlAttrPtr
-xmlHasProp(xmlNodePtr node, const xmlChar *name) {
- xmlAttrPtr prop;
- xmlDocPtr doc;
-
- if ((node == NULL) || (name == NULL)) return(NULL);
- /*
- * Check on the properties attached to the node
- */
- prop = node->properties;
- while (prop != NULL) {
- if (xmlStrEqual(prop->name, name)) {
- return(prop);
- }
- prop = prop->next;
- }
- if (!xmlCheckDTD) return(NULL);
-
- /*
- * Check if there is a default declaration in the internal
- * or external subsets
- */
- doc = node->doc;
- if (doc != NULL) {
- xmlAttributePtr attrDecl;
- if (doc->intSubset != NULL) {
- attrDecl = xmlGetDtdAttrDesc(doc->intSubset, node->name, name);
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdAttrDesc(doc->extSubset, node->name, name);
- if (attrDecl != NULL)
- return((xmlAttrPtr) attrDecl);
- }
- }
- return(NULL);
-}
-
-/**
- * xmlHasNsProp:
- * @node: the node
- * @name: the attribute name
- * @nameSpace: the URI of the namespace
- *
- * Search for an attribute associated to a node
- * This attribute has to be anchored in the namespace specified.
- * This does the entity substitution.
- * This function looks in DTD attribute declaration for #FIXED or
- * default declaration values unless DTD use has been turned off.
- *
- * Returns the attribute or the attribute declaration or NULL
- * if neither was found.
- */
-xmlAttrPtr
-xmlHasNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
- xmlAttrPtr prop;
- xmlDocPtr doc;
-
- if (node == NULL)
- return(NULL);
-
- prop = node->properties;
- if (nameSpace == NULL)
- return(xmlHasProp(node, name));
- while (prop != NULL) {
- /*
- * One need to have
- * - same attribute names
- * - and the attribute carrying that namespace
- */
- if ((xmlStrEqual(prop->name, name)) &&
- ((prop->ns != NULL) && (xmlStrEqual(prop->ns->href, nameSpace)))) {
- return(prop);
- }
- prop = prop->next;
- }
- if (!xmlCheckDTD) return(NULL);
-
- /*
- * Check if there is a default declaration in the internal
- * or external subsets
- */
- doc = node->doc;
- if (doc != NULL) {
- if (doc->intSubset != NULL) {
- xmlAttributePtr attrDecl = NULL;
- xmlNsPtr *nsList, *cur;
- xmlChar *ename;
-
- nsList = xmlGetNsList(node->doc, node);
- if (nsList == NULL)
- return(NULL);
- if ((node->ns != NULL) && (node->ns->prefix != NULL)) {
- ename = xmlStrdup(node->ns->prefix);
- ename = xmlStrcat(ename, BAD_CAST ":");
- ename = xmlStrcat(ename, node->name);
- } else {
- ename = xmlStrdup(node->name);
- }
- if (ename == NULL) {
- xmlFree(nsList);
- return(NULL);
- }
-
- cur = nsList;
- while (*cur != NULL) {
- if (xmlStrEqual((*cur)->href, nameSpace)) {
- attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, ename,
- name, (*cur)->prefix);
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, ename,
- name, (*cur)->prefix);
- }
- cur++;
- }
- xmlFree(nsList);
- xmlFree(ename);
- return((xmlAttrPtr) attrDecl);
- }
- }
- return(NULL);
-}
-
-/**
- * xmlGetProp:
- * @node: the node
- * @name: the attribute name
- *
- * Search and get the value of an attribute associated to a node
- * This does the entity substitution.
- * This function looks in DTD attribute declaration for #FIXED or
- * default declaration values unless DTD use has been turned off.
- *
- * Returns the attribute value or NULL if not found.
- * It's up to the caller to free the memory with xmlFree().
- */
-xmlChar *
-xmlGetProp(xmlNodePtr node, const xmlChar *name) {
- xmlAttrPtr prop;
- xmlDocPtr doc;
-
- if ((node == NULL) || (name == NULL)) return(NULL);
- /*
- * Check on the properties attached to the node
- */
- prop = node->properties;
- while (prop != NULL) {
- if (xmlStrEqual(prop->name, name)) {
- xmlChar *ret;
-
- ret = xmlNodeListGetString(node->doc, prop->children, 1);
- if (ret == NULL) return(xmlStrdup((xmlChar *)""));
- return(ret);
- }
- prop = prop->next;
- }
- if (!xmlCheckDTD) return(NULL);
-
- /*
- * Check if there is a default declaration in the internal
- * or external subsets
- */
- doc = node->doc;
- if (doc != NULL) {
- xmlAttributePtr attrDecl;
- if (doc->intSubset != NULL) {
- attrDecl = xmlGetDtdAttrDesc(doc->intSubset, node->name, name);
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdAttrDesc(doc->extSubset, node->name, name);
- if (attrDecl != NULL)
- return(xmlStrdup(attrDecl->defaultValue));
- }
- }
- return(NULL);
-}
-
-/**
- * xmlGetNsProp:
- * @node: the node
- * @name: the attribute name
- * @nameSpace: the URI of the namespace
- *
- * Search and get the value of an attribute associated to a node
- * This attribute has to be anchored in the namespace specified.
- * This does the entity substitution.
- * This function looks in DTD attribute declaration for #FIXED or
- * default declaration values unless DTD use has been turned off.
- *
- * Returns the attribute value or NULL if not found.
- * It's up to the caller to free the memory with xmlFree().
- */
-xmlChar *
-xmlGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
- xmlAttrPtr prop;
- xmlDocPtr doc;
- xmlNsPtr ns;
-
- if (node == NULL)
- return(NULL);
-
- prop = node->properties;
- if (nameSpace == NULL)
- return(xmlGetProp(node, name));
- while (prop != NULL) {
- /*
- * One need to have
- * - same attribute names
- * - and the attribute carrying that namespace
- */
- if ((xmlStrEqual(prop->name, name)) &&
- ((prop->ns != NULL) &&
- (xmlStrEqual(prop->ns->href, nameSpace)))) {
- xmlChar *ret;
-
- ret = xmlNodeListGetString(node->doc, prop->children, 1);
- if (ret == NULL) return(xmlStrdup((xmlChar *)""));
- return(ret);
- }
- prop = prop->next;
- }
- if (!xmlCheckDTD) return(NULL);
-
- /*
- * Check if there is a default declaration in the internal
- * or external subsets
- */
- doc = node->doc;
- if (doc != NULL) {
- if (doc->intSubset != NULL) {
- xmlAttributePtr attrDecl;
-
- attrDecl = xmlGetDtdAttrDesc(doc->intSubset, node->name, name);
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdAttrDesc(doc->extSubset, node->name, name);
-
- if ((attrDecl != NULL) && (attrDecl->prefix != NULL)) {
- /*
- * The DTD declaration only allows a prefix search
- */
- ns = xmlSearchNs(doc, node, attrDecl->prefix);
- if ((ns != NULL) && (xmlStrEqual(ns->href, nameSpace)))
- return(xmlStrdup(attrDecl->defaultValue));
- }
- }
- }
- return(NULL);
-}
-
-/**
- * xmlSetProp:
- * @node: the node
- * @name: the attribute name
- * @value: the attribute value
- *
- * Set (or reset) an attribute carried by a node.
- * Returns the attribute pointer.
- */
-xmlAttrPtr
-xmlSetProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) {
- xmlAttrPtr prop;
- xmlDocPtr doc;
-
- if ((node == NULL) || (name == NULL))
- return(NULL);
- doc = node->doc;
- prop = node->properties;
- while (prop != NULL) {
- if ((xmlStrEqual(prop->name, name)) &&
- (prop->ns == NULL)){
- xmlNodePtr oldprop = prop->children;
-
- prop->children = NULL;
- prop->last = NULL;
- if (value != NULL) {
- xmlChar *buffer;
- xmlNodePtr tmp;
-
- buffer = xmlEncodeEntitiesReentrant(node->doc, value);
- prop->children = xmlStringGetNodeList(node->doc, buffer);
- prop->last = NULL;
- prop->doc = doc;
- tmp = prop->children;
- while (tmp != NULL) {
- tmp->parent = (xmlNodePtr) prop;
- tmp->doc = doc;
- if (tmp->next == NULL)
- prop->last = tmp;
- tmp = tmp->next;
- }
- xmlFree(buffer);
- }
- if (oldprop != NULL)
- xmlFreeNodeList(oldprop);
- return(prop);
- }
- prop = prop->next;
- }
- prop = xmlNewProp(node, name, value);
- return(prop);
-}
-
-/**
- * xmlUnsetProp:
- * @node: the node
- * @name: the attribute name
- *
- * Remove an attribute carried by a node.
- * Returns 0 if successful, -1 if not found
- */
-int
-xmlUnsetProp(xmlNodePtr node, const xmlChar *name) {
- xmlAttrPtr prop = node->properties, prev = NULL;;
-
- if ((node == NULL) || (name == NULL))
- return(-1);
- while (prop != NULL) {
- if ((xmlStrEqual(prop->name, name)) &&
- (prop->ns == NULL)) {
- if (prev == NULL)
- node->properties = prop->next;
- else
- prev->next = prop->next;
- xmlFreeProp(prop);
- return(0);
- }
- prev = prop;
- prop = prop->next;
- }
- return(-1);
-}
-
-/**
- * xmlSetNsProp:
- * @node: the node
- * @ns: the namespace definition
- * @name: the attribute name
- * @value: the attribute value
- *
- * Set (or reset) an attribute carried by a node.
- * The ns structure must be in scope, this is not checked.
- *
- * Returns the attribute pointer.
- */
-xmlAttrPtr
-xmlSetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name,
- const xmlChar *value) {
- xmlAttrPtr prop;
-
- if ((node == NULL) || (name == NULL))
- return(NULL);
-
- if (ns == NULL)
- return(xmlSetProp(node, name, value));
- if (ns->href == NULL)
- return(NULL);
- prop = node->properties;
-
- while (prop != NULL) {
- /*
- * One need to have
- * - same attribute names
- * - and the attribute carrying that namespace
- */
- if ((xmlStrEqual(prop->name, name)) &&
- (prop->ns != NULL) && (xmlStrEqual(prop->ns->href, ns->href))) {
- if (prop->children != NULL)
- xmlFreeNodeList(prop->children);
- prop->children = NULL;
- prop->last = NULL;
- prop->ns = ns;
- if (value != NULL) {
- xmlChar *buffer;
- xmlNodePtr tmp;
-
- buffer = xmlEncodeEntitiesReentrant(node->doc, value);
- prop->children = xmlStringGetNodeList(node->doc, buffer);
- prop->last = NULL;
- tmp = prop->children;
- while (tmp != NULL) {
- tmp->parent = (xmlNodePtr) prop;
- if (tmp->next == NULL)
- prop->last = tmp;
- tmp = tmp->next;
- }
- xmlFree(buffer);
- }
- return(prop);
- }
- prop = prop->next;
- }
- prop = xmlNewNsProp(node, ns, name, value);
- return(prop);
-}
-
-/**
- * xmlUnsetNsProp:
- * @node: the node
- * @ns: the namespace definition
- * @name: the attribute name
- *
- * Remove an attribute carried by a node.
- * Returns 0 if successful, -1 if not found
- */
-int
-xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) {
- xmlAttrPtr prop = node->properties, prev = NULL;;
-
- if ((node == NULL) || (name == NULL))
- return(-1);
- if (ns == NULL)
- return(xmlUnsetProp(node, name));
- if (ns->href == NULL)
- return(-1);
- while (prop != NULL) {
- if ((xmlStrEqual(prop->name, name)) &&
- (prop->ns != NULL) && (xmlStrEqual(prop->ns->href, ns->href))) {
- if (prev == NULL)
- node->properties = prop->next;
- else
- prev->next = prop->next;
- xmlFreeProp(prop);
- return(0);
- }
- prev = prop;
- prop = prop->next;
- }
- return(-1);
-}
-
-/**
- * xmlNodeIsText:
- * @node: the node
- *
- * Is this node a Text node ?
- * Returns 1 yes, 0 no
- */
-int
-xmlNodeIsText(xmlNodePtr node) {
- if (node == NULL) return(0);
-
- if (node->type == XML_TEXT_NODE) return(1);
- return(0);
-}
-
-/**
- * xmlIsBlankNode:
- * @node: the node
- *
- * Checks whether this node is an empty or whitespace only
- * (and possibly ignorable) text-node.
- *
- * Returns 1 yes, 0 no
- */
-int
-xmlIsBlankNode(xmlNodePtr node) {
- const xmlChar *cur;
- if (node == NULL) return(0);
-
- if ((node->type != XML_TEXT_NODE) &&
- (node->type != XML_CDATA_SECTION_NODE))
- return(0);
- if (node->content == NULL) return(1);
- cur = node->content;
- while (*cur != 0) {
- if (!IS_BLANK(*cur)) return(0);
- cur++;
- }
-
- return(1);
-}
-
-/**
- * xmlTextConcat:
- * @node: the node
- * @content: the content
- * @len: @content length
- *
- * Concat the given string at the end of the existing node content
- */
-
-void
-xmlTextConcat(xmlNodePtr node, const xmlChar *content, int len) {
- if (node == NULL) return;
-
- if ((node->type != XML_TEXT_NODE) &&
- (node->type != XML_CDATA_SECTION_NODE)) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlTextConcat: node is not text nor CDATA\n");
-#endif
- return;
- }
- node->content = xmlStrncat(node->content, content, len);
-}
-
-/************************************************************************
- * *
- * Output : to a FILE or in memory *
- * *
- ************************************************************************/
-
-/**
- * xmlBufferCreate:
- *
- * routine to create an XML buffer.
- * returns the new structure.
- */
-xmlBufferPtr
-xmlBufferCreate(void) {
- xmlBufferPtr ret;
-
- ret = (xmlBufferPtr) xmlMalloc(sizeof(xmlBuffer));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferCreate : out of memory!\n");
- return(NULL);
- }
- ret->use = 0;
- ret->size = xmlDefaultBufferSize;
- ret->alloc = xmlBufferAllocScheme;
- ret->content = (xmlChar *) xmlMalloc(ret->size * sizeof(xmlChar));
- if (ret->content == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferCreate : out of memory!\n");
- xmlFree(ret);
- return(NULL);
- }
- ret->content[0] = 0;
- return(ret);
-}
-
-/**
- * xmlBufferCreateSize:
- * @size: initial size of buffer
- *
- * routine to create an XML buffer.
- * returns the new structure.
- */
-xmlBufferPtr
-xmlBufferCreateSize(size_t size) {
- xmlBufferPtr ret;
-
- ret = (xmlBufferPtr) xmlMalloc(sizeof(xmlBuffer));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferCreate : out of memory!\n");
- return(NULL);
- }
- ret->use = 0;
- ret->alloc = xmlBufferAllocScheme;
- ret->size = (size ? size+2 : 0); /* +1 for ending null */
- if (ret->size){
- ret->content = (xmlChar *) xmlMalloc(ret->size * sizeof(xmlChar));
- if (ret->content == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferCreate : out of memory!\n");
- xmlFree(ret);
- return(NULL);
- }
- ret->content[0] = 0;
- } else
- ret->content = NULL;
- return(ret);
-}
-
-/**
- * xmlBufferSetAllocationScheme:
- * @buf: the buffer to tune
- * @scheme: allocation scheme to use
- *
- * Sets the allocation scheme for this buffer
- */
-void
-xmlBufferSetAllocationScheme(xmlBufferPtr buf,
- xmlBufferAllocationScheme scheme) {
- if (buf == NULL) {
-#ifdef DEBUG_BUFFER
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferSetAllocationScheme: buf == NULL\n");
-#endif
- return;
- }
-
- buf->alloc = scheme;
-}
-
-/**
- * xmlBufferFree:
- * @buf: the buffer to free
- *
- * Frees an XML buffer. It frees both the content and the structure which
- * encapsulate it.
- */
-void
-xmlBufferFree(xmlBufferPtr buf) {
- if (buf == NULL) {
-#ifdef DEBUG_BUFFER
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferFree: buf == NULL\n");
-#endif
- return;
- }
- if (buf->content != NULL) {
- xmlFree(buf->content);
- }
- xmlFree(buf);
-}
-
-/**
- * xmlBufferEmpty:
- * @buf: the buffer
- *
- * empty a buffer.
- */
-void
-xmlBufferEmpty(xmlBufferPtr buf) {
- if (buf->content == NULL) return;
- buf->use = 0;
- memset(buf->content, 0, buf->size);
-}
-
-/**
- * xmlBufferShrink:
- * @buf: the buffer to dump
- * @len: the number of xmlChar to remove
- *
- * Remove the beginning of an XML buffer.
- *
- * Returns the number of #xmlChar removed, or -1 in case of failure.
- */
-int
-xmlBufferShrink(xmlBufferPtr buf, unsigned int len) {
- if (len == 0) return(0);
- if (len > buf->use) return(-1);
-
- buf->use -= len;
- memmove(buf->content, &buf->content[len], buf->use * sizeof(xmlChar));
-
- buf->content[buf->use] = 0;
- return(len);
-}
-
-/**
- * xmlBufferGrow:
- * @buf: the buffer
- * @len: the minimum free size to allocate
- *
- * Grow the available space of an XML buffer.
- *
- * Returns the new available space or -1 in case of error
- */
-int
-xmlBufferGrow(xmlBufferPtr buf, unsigned int len) {
- int size;
- xmlChar *newbuf;
-
- if (len + buf->use < buf->size) return(0);
-
- size = buf->use + len + 100;
-
- newbuf = (xmlChar *) xmlRealloc(buf->content, size);
- if (newbuf == NULL) return(-1);
- buf->content = newbuf;
- buf->size = size;
- return(buf->size - buf->use);
-}
-
-/**
- * xmlBufferDump:
- * @file: the file output
- * @buf: the buffer to dump
- *
- * Dumps an XML buffer to a FILE *.
- * Returns the number of #xmlChar written
- */
-int
-xmlBufferDump(FILE *file, xmlBufferPtr buf) {
- int ret;
-
- if (buf == NULL) {
-#ifdef DEBUG_BUFFER
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferDump: buf == NULL\n");
-#endif
- return(0);
- }
- if (buf->content == NULL) {
-#ifdef DEBUG_BUFFER
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferDump: buf->content == NULL\n");
-#endif
- return(0);
- }
- if (file == NULL)
- file = stdout;
- ret = fwrite(buf->content, sizeof(xmlChar), buf->use, file);
- return(ret);
-}
-
-/**
- * xmlBufferContent:
- * @buf: the buffer
- *
- * Function to extract the content of a buffer
- *
- * Returns the internal content
- */
-
-const xmlChar *
-xmlBufferContent(const xmlBufferPtr buf)
-{
- if(!buf)
- return NULL;
-
- return buf->content;
-}
-
-/**
- * xmlBufferLength:
- * @buf: the buffer
- *
- * Function to get the length of a buffer
- *
- * Returns the length of data in the internal content
- */
-
-int
-xmlBufferLength(const xmlBufferPtr buf)
-{
- if(!buf)
- return 0;
-
- return buf->use;
-}
-
-/**
- * xmlBufferResize:
- * @buf: the buffer to resize
- * @size: the desired size
- *
- * Resize a buffer to accommodate minimum size of @size.
- *
- * Returns 0 in case of problems, 1 otherwise
- */
-int
-xmlBufferResize(xmlBufferPtr buf, unsigned int size)
-{
- unsigned int newSize;
- xmlChar* rebuf = NULL;
-
- /*take care of empty case*/
- newSize = (buf->size ? buf->size*2 : size);
-
- /* Don't resize if we don't have to */
- if (size < buf->size)
- return 1;
-
- /* figure out new size */
- switch (buf->alloc){
- case XML_BUFFER_ALLOC_DOUBLEIT:
- while (size > newSize) newSize *= 2;
- break;
- case XML_BUFFER_ALLOC_EXACT:
- newSize = size+10;
- break;
- default:
- newSize = size+10;
- break;
- }
-
- if (buf->content == NULL)
- rebuf = (xmlChar *) xmlMalloc(newSize * sizeof(xmlChar));
- else
- rebuf = (xmlChar *) xmlRealloc(buf->content,
- newSize * sizeof(xmlChar));
- if (rebuf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferResize : out of memory!\n");
- return 0;
- }
- buf->content = rebuf;
- buf->size = newSize;
-
- return 1;
-}
-
-/**
- * xmlBufferAdd:
- * @buf: the buffer to dump
- * @str: the #xmlChar string
- * @len: the number of #xmlChar to add
- *
- * Add a string range to an XML buffer. if len == -1, the length of
- * str is recomputed.
- */
-void
-xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
- unsigned int needSize;
-
- if (str == NULL) {
-#ifdef DEBUG_BUFFER
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferAdd: str == NULL\n");
-#endif
- return;
- }
- if (len < -1) {
-#ifdef DEBUG_BUFFER
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferAdd: len < 0\n");
-#endif
- return;
- }
- if (len == 0) return;
-
- if (len < 0)
- len = xmlStrlen(str);
-
- if (len <= 0) return;
-
- needSize = buf->use + len + 2;
- if (needSize > buf->size){
- if (!xmlBufferResize(buf, needSize)){
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferAdd : out of memory!\n");
- return;
- }
- }
-
- memmove(&buf->content[buf->use], str, len*sizeof(xmlChar));
- buf->use += len;
- buf->content[buf->use] = 0;
-}
-
-/**
- * xmlBufferAddHead:
- * @buf: the buffer
- * @str: the #xmlChar string
- * @len: the number of #xmlChar to add
- *
- * Add a string range to the beginning of an XML buffer.
- * if len == -1, the length of @str is recomputed.
- */
-void
-xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) {
- unsigned int needSize;
-
- if (str == NULL) {
-#ifdef DEBUG_BUFFER
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferAddHead: str == NULL\n");
-#endif
- return;
- }
- if (len < -1) {
-#ifdef DEBUG_BUFFER
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferAddHead: len < 0\n");
-#endif
- return;
- }
- if (len == 0) return;
-
- if (len < 0)
- len = xmlStrlen(str);
-
- if (len <= 0) return;
-
- needSize = buf->use + len + 2;
- if (needSize > buf->size){
- if (!xmlBufferResize(buf, needSize)){
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferAddHead : out of memory!\n");
- return;
- }
- }
-
- memmove(&buf->content[len], &buf->content[0], buf->use * sizeof(xmlChar));
- memmove(&buf->content[0], str, len * sizeof(xmlChar));
- buf->use += len;
- buf->content[buf->use] = 0;
-}
-
-/**
- * xmlBufferCat:
- * @buf: the buffer to dump
- * @str: the #xmlChar string
- *
- * Append a zero terminated string to an XML buffer.
- */
-void
-xmlBufferCat(xmlBufferPtr buf, const xmlChar *str) {
- if (str != NULL)
- xmlBufferAdd(buf, str, -1);
-}
-
-/**
- * xmlBufferCCat:
- * @buf: the buffer to dump
- * @str: the C char string
- *
- * Append a zero terminated C string to an XML buffer.
- */
-void
-xmlBufferCCat(xmlBufferPtr buf, const char *str) {
- const char *cur;
-
- if (str == NULL) {
-#ifdef DEBUG_BUFFER
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferCCat: str == NULL\n");
-#endif
- return;
- }
- for (cur = str;*cur != 0;cur++) {
- if (buf->use + 10 >= buf->size) {
- if (!xmlBufferResize(buf, buf->use+10)){
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferCCat : out of memory!\n");
- return;
- }
- }
- buf->content[buf->use++] = *cur;
- }
- buf->content[buf->use] = 0;
-}
-
-/**
- * xmlBufferWriteCHAR:
- * @buf: the XML buffer
- * @string: the string to add
- *
- * routine which manages and grows an output buffer. This one adds
- * xmlChars at the end of the buffer.
- */
-void
-xmlBufferWriteCHAR
-(xmlBufferPtr buf, const xmlChar *string) {
- xmlBufferCat(buf, string);
-}
-
-/**
- * xmlBufferWriteChar:
- * @buf: the XML buffer output
- * @string: the string to add
- *
- * routine which manage and grows an output buffer. This one add
- * C chars at the end of the array.
- */
-void
-xmlBufferWriteChar(xmlBufferPtr buf, const char *string) {
- xmlBufferCCat(buf, string);
-}
-
-
-/**
- * xmlBufferWriteQuotedString:
- * @buf: the XML buffer output
- * @string: the string to add
- *
- * routine which manage and grows an output buffer. This one writes
- * a quoted or double quoted #xmlChar string, checking first if it holds
- * quote or double-quotes internally
- */
-void
-xmlBufferWriteQuotedString(xmlBufferPtr buf, const xmlChar *string) {
- if (xmlStrchr(string, '"')) {
- if (xmlStrchr(string, '\'')) {
-#ifdef DEBUG_BUFFER
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferWriteQuotedString: string contains quote and double-quotes !\n");
-#endif
- }
- xmlBufferCCat(buf, "'");
- xmlBufferCat(buf, string);
- xmlBufferCCat(buf, "'");
- } else {
- xmlBufferCCat(buf, "\"");
- xmlBufferCat(buf, string);
- xmlBufferCCat(buf, "\"");
- }
-}
-
-
-/************************************************************************
- * *
- * Dumping XML tree content to a simple buffer *
- * *
- ************************************************************************/
-
-/**
- * xmlAttrSerializeContent:
- * @buf: the XML buffer output
- * @doc: the document
- * @attr: the attribute pointer
- *
- * Serialize the attribute in the buffer
- */
-static void
-xmlAttrSerializeContent(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr attr)
-{
- const xmlChar *cur, *base;
- xmlNodePtr children;
-
- children = attr->children;
- while (children != NULL) {
- switch (children->type) {
- case XML_TEXT_NODE:
- base = cur = children->content;
- while (*cur != 0) {
- if (*cur == '\n') {
- if (base != cur)
- xmlBufferAdd(buf, base, cur - base);
- xmlBufferAdd(buf, BAD_CAST "&#10;", 5);
- cur++;
- base = cur;
-#if 0
- } else if (*cur == '\'') {
- if (base != cur)
- xmlBufferAdd(buf, base, cur - base);
- xmlBufferAdd(buf, BAD_CAST "&apos;", 6);
- cur++;
- base = cur;
-#endif
- } else if (*cur == '"') {
- if (base != cur)
- xmlBufferAdd(buf, base, cur - base);
- xmlBufferAdd(buf, BAD_CAST "&quot;", 6);
- cur++;
- base = cur;
- } else if (*cur == '<') {
- if (base != cur)
- xmlBufferAdd(buf, base, cur - base);
- xmlBufferAdd(buf, BAD_CAST "&lt;", 4);
- cur++;
- base = cur;
- } else if (*cur == '>') {
- if (base != cur)
- xmlBufferAdd(buf, base, cur - base);
- xmlBufferAdd(buf, BAD_CAST "&gt;", 4);
- cur++;
- base = cur;
- } else if (*cur == '&') {
- if (base != cur)
- xmlBufferAdd(buf, base, cur - base);
- xmlBufferAdd(buf, BAD_CAST "&amp;", 5);
- cur++;
- base = cur;
- } else if ((*cur >= 0x80) && ((doc == NULL) ||
- (doc->encoding ==
- NULL))) {
- /*
- * We assume we have UTF-8 content.
- */
- char tmp[10];
- int val = 0, l = 1;
-
- if (base != cur)
- xmlBufferAdd(buf, base, cur - base);
- if (*cur < 0xC0) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAttrSerializeContent : input not UTF-8\n");
- if (doc != NULL)
- doc->encoding =
- xmlStrdup(BAD_CAST "ISO-8859-1");
- snprintf(tmp, sizeof(tmp), "&#%d;", *cur);
- tmp[sizeof(tmp) - 1] = 0;
- xmlBufferAdd(buf, (xmlChar *) tmp, -1);
- cur++;
- base = cur;
- continue;
- } else if (*cur < 0xE0) {
- val = (cur[0]) & 0x1F;
- val <<= 6;
- val |= (cur[1]) & 0x3F;
- l = 2;
- } else if (*cur < 0xF0) {
- val = (cur[0]) & 0x0F;
- val <<= 6;
- val |= (cur[1]) & 0x3F;
- val <<= 6;
- val |= (cur[2]) & 0x3F;
- l = 3;
- } else if (*cur < 0xF8) {
- val = (cur[0]) & 0x07;
- val <<= 6;
- val |= (cur[1]) & 0x3F;
- val <<= 6;
- val |= (cur[2]) & 0x3F;
- val <<= 6;
- val |= (cur[3]) & 0x3F;
- l = 4;
- }
- if ((l == 1) || (!IS_CHAR(val))) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAttrSerializeContent : char out of range\n");
- if (doc != NULL)
- doc->encoding =
- xmlStrdup(BAD_CAST "ISO-8859-1");
- snprintf(tmp, sizeof(tmp), "&#%d;", *cur);
- tmp[sizeof(tmp) - 1] = 0;
- xmlBufferAdd(buf, (xmlChar *) tmp, -1);
- cur++;
- base = cur;
- continue;
- }
- /*
- * We could do multiple things here. Just save
- * as a char ref
- */
- snprintf(tmp, sizeof(tmp), "&#x%X;", val);
- tmp[sizeof(tmp) - 1] = 0;
- xmlBufferAdd(buf, (xmlChar *) tmp, -1);
- cur += l;
- base = cur;
- } else {
- cur++;
- }
- }
- if (base != cur)
- xmlBufferAdd(buf, base, cur - base);
- break;
- case XML_ENTITY_REF_NODE:
- xmlBufferAdd(buf, BAD_CAST "&", 1);
- xmlBufferAdd(buf, children->name,
- xmlStrlen(children->name));
- xmlBufferAdd(buf, BAD_CAST ";", 1);
- break;
- default:
- /* should not happen unless we have a badly built tree */
- break;
- }
- children = children->next;
- }
-}
-
-/**
- * xmlNodeDump:
- * @buf: the XML buffer output
- * @doc: the document
- * @cur: the current node
- * @level: the imbrication level for indenting
- * @format: is formatting allowed
- *
- * Dump an XML node, recursive behaviour,children are printed too.
- * Note that format = 1 provide node indenting only if xmlIndentTreeOutput = 1
- * or xmlKeepBlanksDefault(0) was called
- *
- * Returns the number of bytes written to the buffer or -1 in case of error
- */
-int
-xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
- int format)
-{
- unsigned int use;
- int ret;
- xmlOutputBufferPtr outbuf;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNodeDump : node == NULL\n");
-#endif
- return (-1);
- }
- if (buf == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNodeDump : buf == NULL\n");
-#endif
- return (-1);
- }
- outbuf = (xmlOutputBufferPtr) xmlMalloc(sizeof(xmlOutputBuffer));
- if (outbuf == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNodeDump: out of memory!\n");
- return (-1);
- }
- memset(outbuf, 0, (size_t) sizeof(xmlOutputBuffer));
- outbuf->buffer = buf;
- outbuf->encoder = NULL;
- outbuf->writecallback = NULL;
- outbuf->closecallback = NULL;
- outbuf->context = NULL;
- outbuf->written = 0;
-
- use = buf->use;
- xmlNodeDumpOutput(outbuf, doc, cur, level, format, NULL);
- xmlFree(outbuf);
- ret = buf->use - use;
- return (ret);
-}
-
-/**
- * xmlElemDump:
- * @f: the FILE * for the output
- * @doc: the document
- * @cur: the current node
- *
- * Dump an XML/HTML node, recursive behaviour, children are printed too.
- */
-void
-xmlElemDump(FILE * f, xmlDocPtr doc, xmlNodePtr cur)
-{
- xmlOutputBufferPtr outbuf;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlElemDump : cur == NULL\n");
-#endif
- return;
- }
-#ifdef DEBUG_TREE
- if (doc == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlElemDump : doc == NULL\n");
- }
-#endif
-
- outbuf = xmlOutputBufferCreateFile(f, NULL);
- if (outbuf == NULL)
- return;
- if ((doc != NULL) && (doc->type == XML_HTML_DOCUMENT_NODE)) {
-#ifdef LIBXML_HTML_ENABLED
- htmlNodeDumpOutput(outbuf, doc, cur, NULL);
-#else
- xmlGenericError(xmlGenericErrorContext,
- "HTML support not compiled in\n");
-#endif /* LIBXML_HTML_ENABLED */
- } else
- xmlNodeDumpOutput(outbuf, doc, cur, 0, 1, NULL);
- xmlOutputBufferClose(outbuf);
-}
-
-/************************************************************************
- * *
- * Dumping XML tree content to an I/O output buffer *
- * *
- ************************************************************************/
-
-static void
-xhtmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
- int level, int format, const char *encoding);
-static void
-xmlNodeListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
- int level, int format, const char *encoding);
-static void
-xmlNodeDumpOutputInternal(xmlOutputBufferPtr buf, xmlDocPtr doc,
- xmlNodePtr cur, int level, int format, const char *encoding);
-
-/**
- * xmlNsDumpOutput:
- * @buf: the XML buffer output
- * @cur: a namespace
- *
- * Dump a local Namespace definition.
- * Should be called in the context of attributes dumps.
- */
-static void
-xmlNsDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur) {
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNsDumpOutput : Ns == NULL\n");
-#endif
- return;
- }
- if ((cur->type == XML_LOCAL_NAMESPACE) && (cur->href != NULL)) {
- if (xmlStrEqual(cur->prefix, BAD_CAST "xml"))
- return;
-
- /* Within the context of an element attributes */
- if (cur->prefix != NULL) {
- xmlOutputBufferWriteString(buf, " xmlns:");
- xmlOutputBufferWriteString(buf, (const char *)cur->prefix);
- } else
- xmlOutputBufferWriteString(buf, " xmlns");
- xmlOutputBufferWriteString(buf, "=");
- xmlBufferWriteQuotedString(buf->buffer, cur->href);
- }
-}
-
-/**
- * xmlNsListDumpOutput:
- * @buf: the XML buffer output
- * @cur: the first namespace
- *
- * Dump a list of local Namespace definitions.
- * Should be called in the context of attributes dumps.
- */
-static void
-xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur) {
- while (cur != NULL) {
- xmlNsDumpOutput(buf, cur);
- cur = cur->next;
- }
-}
-
-/**
- * xmlDtdDumpOutput:
- * @buf: the XML buffer output
- * @doc: the document
- * @encoding: an optional encoding string
- *
- * Dump the XML document DTD, if any.
- */
-static void
-xmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDtdPtr dtd, const char *encoding) {
- if (dtd == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlDtdDumpOutput : no internal subset\n");
-#endif
- return;
- }
- xmlOutputBufferWriteString(buf, "<!DOCTYPE ");
- xmlOutputBufferWriteString(buf, (const char *)dtd->name);
- if (dtd->ExternalID != NULL) {
- xmlOutputBufferWriteString(buf, " PUBLIC ");
- xmlBufferWriteQuotedString(buf->buffer, dtd->ExternalID);
- xmlOutputBufferWriteString(buf, " ");
- xmlBufferWriteQuotedString(buf->buffer, dtd->SystemID);
- } else if (dtd->SystemID != NULL) {
- xmlOutputBufferWriteString(buf, " SYSTEM ");
- xmlBufferWriteQuotedString(buf->buffer, dtd->SystemID);
- }
- if ((dtd->entities == NULL) && (dtd->elements == NULL) &&
- (dtd->attributes == NULL) && (dtd->notations == NULL)) {
- xmlOutputBufferWriteString(buf, ">");
- return;
- }
- xmlOutputBufferWriteString(buf, " [\n");
- xmlNodeListDumpOutput(buf, dtd->doc, dtd->children, -1, 0, encoding);
- xmlOutputBufferWriteString(buf, "]>");
-}
-
-/**
- * xmlAttrDumpOutput:
- * @buf: the XML buffer output
- * @doc: the document
- * @cur: the attribute pointer
- * @encoding: an optional encoding string
- *
- * Dump an XML attribute
- */
-static void
-xmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur,
- const char *encoding ATTRIBUTE_UNUSED) {
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlAttrDumpOutput : property == NULL\n");
-#endif
- return;
- }
- xmlOutputBufferWriteString(buf, " ");
- if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
- xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
- xmlOutputBufferWriteString(buf, ":");
- }
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- xmlOutputBufferWriteString(buf, "=\"");
- xmlAttrSerializeContent(buf->buffer, doc, cur);
- xmlOutputBufferWriteString(buf, "\"");
-}
-
-/**
- * xmlAttrListDumpOutput:
- * @buf: the XML buffer output
- * @doc: the document
- * @cur: the first attribute pointer
- * @encoding: an optional encoding string
- *
- * Dump a list of XML attributes
- */
-static void
-xmlAttrListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
- xmlAttrPtr cur, const char *encoding) {
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlAttrListDumpOutput : property == NULL\n");
-#endif
- return;
- }
- while (cur != NULL) {
- xmlAttrDumpOutput(buf, doc, cur, encoding);
- cur = cur->next;
- }
-}
-
-
-
-/**
- * xmlNodeListDumpOutput:
- * @buf: the XML buffer output
- * @doc: the document
- * @cur: the first node
- * @level: the imbrication level for indenting
- * @format: is formatting allowed
- * @encoding: an optional encoding string
- *
- * Dump an XML node list, recursive behaviour, children are printed too.
- * Note that format = 1 provide node indenting only if xmlIndentTreeOutput = 1
- * or xmlKeepBlanksDefault(0) was called
- */
-static void
-xmlNodeListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
- xmlNodePtr cur, int level, int format, const char *encoding) {
- int i;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNodeListDumpOutput : node == NULL\n");
-#endif
- return;
- }
- while (cur != NULL) {
- if ((format) && (xmlIndentTreeOutput) &&
- (cur->type == XML_ELEMENT_NODE))
- for (i = 0;i < level;i++)
- xmlOutputBufferWriteString(buf, xmlTreeIndentString);
- xmlNodeDumpOutputInternal(buf, doc, cur, level, format, encoding);
- if (format) {
- xmlOutputBufferWriteString(buf, "\n");
- }
- cur = cur->next;
- }
-}
-
-/**
- * xmlNodeDumpOutputInternal:
- * @buf: the XML buffer output
- * @doc: the document
- * @cur: the current node
- * @level: the imbrication level for indenting
- * @format: is formatting allowed
- * @encoding: an optional encoding string
- *
- * Dump an XML node, recursive behaviour, children are printed too.
- * Note that format = 1 provide node indenting only if xmlIndentTreeOutput = 1
- * or xmlKeepBlanksDefault(0) was called
- */
-static void
-xmlNodeDumpOutputInternal(xmlOutputBufferPtr buf, xmlDocPtr doc,
- xmlNodePtr cur, int level, int format, const char *encoding) {
- int i;
- xmlNodePtr tmp;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNodeDumpOutput : node == NULL\n");
-#endif
- return;
- }
- if (cur->type == XML_XINCLUDE_START)
- return;
- if (cur->type == XML_XINCLUDE_END)
- return;
- if (cur->type == XML_DTD_NODE) {
- xmlDtdDumpOutput(buf, (xmlDtdPtr) cur, encoding);
- return;
- }
- if (cur->type == XML_ELEMENT_DECL) {
- xmlDumpElementDecl(buf->buffer, (xmlElementPtr) cur);
- return;
- }
- if (cur->type == XML_ATTRIBUTE_DECL) {
- xmlDumpAttributeDecl(buf->buffer, (xmlAttributePtr) cur);
- return;
- }
- if (cur->type == XML_ENTITY_DECL) {
- xmlDumpEntityDecl(buf->buffer, (xmlEntityPtr) cur);
- return;
- }
- if (cur->type == XML_TEXT_NODE) {
- if (cur->content != NULL) {
- if ((cur->name == xmlStringText) ||
- (cur->name != xmlStringTextNoenc)) {
- xmlChar *buffer;
-
- if (encoding == NULL)
- buffer = xmlEncodeEntitiesReentrant(doc, cur->content);
- else
- buffer = xmlEncodeSpecialChars(doc, cur->content);
- if (buffer != NULL) {
- xmlOutputBufferWriteString(buf, (const char *)buffer);
- xmlFree(buffer);
- }
- } else {
- /*
- * Disable escaping, needed for XSLT
- */
- xmlOutputBufferWriteString(buf, (const char *) cur->content);
- }
- }
-
- return;
- }
- if (cur->type == XML_PI_NODE) {
- if (cur->content != NULL) {
- xmlOutputBufferWriteString(buf, "<?");
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- if (cur->content != NULL) {
- xmlOutputBufferWriteString(buf, " ");
- xmlOutputBufferWriteString(buf, (const char *)cur->content);
- }
- xmlOutputBufferWriteString(buf, "?>");
- } else {
- xmlOutputBufferWriteString(buf, "<?");
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- xmlOutputBufferWriteString(buf, "?>");
- }
- return;
- }
- if (cur->type == XML_COMMENT_NODE) {
- if (cur->content != NULL) {
- xmlOutputBufferWriteString(buf, "<!--");
- xmlOutputBufferWriteString(buf, (const char *)cur->content);
- xmlOutputBufferWriteString(buf, "-->");
- }
- return;
- }
- if (cur->type == XML_ENTITY_REF_NODE) {
- xmlOutputBufferWriteString(buf, "&");
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- xmlOutputBufferWriteString(buf, ";");
- return;
- }
- if (cur->type == XML_CDATA_SECTION_NODE) {
- xmlOutputBufferWriteString(buf, "<![CDATA[");
- if (cur->content != NULL)
- xmlOutputBufferWriteString(buf, (const char *)cur->content);
- xmlOutputBufferWriteString(buf, "]]>");
- return;
- }
-
- if (format == 1) {
- tmp = cur->children;
- while (tmp != NULL) {
- if ((tmp->type == XML_TEXT_NODE) ||
- (tmp->type == XML_ENTITY_REF_NODE)) {
- format = 0;
- break;
- }
- tmp = tmp->next;
- }
- }
- xmlOutputBufferWriteString(buf, "<");
- if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
- xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
- xmlOutputBufferWriteString(buf, ":");
- }
-
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- if (cur->nsDef)
- xmlNsListDumpOutput(buf, cur->nsDef);
- if (cur->properties != NULL)
- xmlAttrListDumpOutput(buf, doc, cur->properties, encoding);
-
- if (((cur->type == XML_ELEMENT_NODE) || (cur->content == NULL)) &&
- (cur->children == NULL) && (!xmlSaveNoEmptyTags)) {
- xmlOutputBufferWriteString(buf, "/>");
- return;
- }
- xmlOutputBufferWriteString(buf, ">");
- if ((cur->type != XML_ELEMENT_NODE) && (cur->content != NULL)) {
- xmlChar *buffer;
-
- if (encoding == NULL)
- buffer = xmlEncodeEntitiesReentrant(doc, cur->content);
- else
- buffer = xmlEncodeSpecialChars(doc, cur->content);
- if (buffer != NULL) {
- xmlOutputBufferWriteString(buf, (const char *)buffer);
- xmlFree(buffer);
- }
- }
- if (cur->children != NULL) {
- if (format) xmlOutputBufferWriteString(buf, "\n");
- xmlNodeListDumpOutput(buf, doc, cur->children,
- (level >= 0?level+1:-1), format, encoding);
- if ((xmlIndentTreeOutput) && (format))
- for (i = 0;i < level;i++)
- xmlOutputBufferWriteString(buf, xmlTreeIndentString);
- }
- xmlOutputBufferWriteString(buf, "</");
- if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
- xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
- xmlOutputBufferWriteString(buf, ":");
- }
-
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- xmlOutputBufferWriteString(buf, ">");
-}
-
-/**
- * xmlNodeDumpOutput:
- * @buf: the XML buffer output
- * @doc: the document
- * @cur: the current node
- * @level: the imbrication level for indenting
- * @format: is formatting allowed
- * @encoding: an optional encoding string
- *
- * Dump an XML node, recursive behaviour, children are printed too.
- * Note that format = 1 provide node indenting only if xmlIndentTreeOutput = 1
- * or xmlKeepBlanksDefault(0) was called
- */
-void
-xmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
- int level, int format, const char *encoding)
-{
-#ifdef LIBXML_HTML_ENABLED
- xmlDtdPtr dtd;
- int is_xhtml = 0;
-
- dtd = xmlGetIntSubset(doc);
- if (dtd != NULL) {
- is_xhtml = xmlIsXHTML(dtd->SystemID, dtd->ExternalID);
- if (is_xhtml < 0)
- is_xhtml = 0;
- if ((is_xhtml) && (cur->parent == (xmlNodePtr) doc) &&
- (cur->type == XML_ELEMENT_NODE) &&
- (xmlStrEqual(cur->name, BAD_CAST "html"))) {
- if (encoding != NULL)
- htmlSetMetaEncoding((htmlDocPtr) cur,
- (const xmlChar *) encoding);
- else
- htmlSetMetaEncoding((htmlDocPtr) cur, BAD_CAST "UTF-8");
- }
- }
-
- if (is_xhtml)
- xhtmlNodeDumpOutput(buf, doc, cur, level, format, encoding);
- else
-#endif
- xmlNodeDumpOutputInternal(buf, doc, cur, level, format, encoding);
-}
-
-/**
- * xmlDocContentDumpOutput:
- * @buf: the XML buffer output
- * @cur: the document
- * @encoding: an optional encoding string
- * @format: should formatting spaces been added
- *
- * Dump an XML document.
- * Note that format = 1 provide node indenting only if xmlIndentTreeOutput = 1
- * or xmlKeepBlanksDefault(0) was called
- */
-static void
-xmlDocContentDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr cur,
- const char *encoding, int format) {
-#ifdef LIBXML_HTML_ENABLED
- xmlDtdPtr dtd;
- int is_xhtml = 0;
-#endif
-
- xmlOutputBufferWriteString(buf, "<?xml version=");
- if (cur->version != NULL)
- xmlBufferWriteQuotedString(buf->buffer, cur->version);
- else
- xmlOutputBufferWriteString(buf, "\"1.0\"");
- if (encoding == NULL) {
- if (cur->encoding != NULL)
- encoding = (const char *) cur->encoding;
- else if (cur->charset != XML_CHAR_ENCODING_UTF8)
- encoding = xmlGetCharEncodingName((xmlCharEncoding) cur->charset);
- }
- if (encoding != NULL) {
- xmlOutputBufferWriteString(buf, " encoding=");
- xmlBufferWriteQuotedString(buf->buffer, (xmlChar *) encoding);
- }
- switch (cur->standalone) {
- case 0:
- xmlOutputBufferWriteString(buf, " standalone=\"no\"");
- break;
- case 1:
- xmlOutputBufferWriteString(buf, " standalone=\"yes\"");
- break;
- }
- xmlOutputBufferWriteString(buf, "?>\n");
-
-#ifdef LIBXML_HTML_ENABLED
- dtd = xmlGetIntSubset(cur);
- if (dtd != NULL) {
- is_xhtml = xmlIsXHTML(dtd->SystemID, dtd->ExternalID);
- if (is_xhtml < 0) is_xhtml = 0;
- }
- if (is_xhtml) {
- if (encoding != NULL)
- htmlSetMetaEncoding(cur, (const xmlChar *) encoding);
- else
- htmlSetMetaEncoding(cur, BAD_CAST "UTF-8");
- }
-#endif
- if (cur->children != NULL) {
- xmlNodePtr child = cur->children;
-
- while (child != NULL) {
-#ifdef LIBXML_HTML_ENABLED
- if (is_xhtml)
- xhtmlNodeDumpOutput(buf, cur, child, 0, format, encoding);
- else
-#endif
- xmlNodeDumpOutputInternal(buf, cur, child, 0, format, encoding);
- xmlOutputBufferWriteString(buf, "\n");
- child = child->next;
- }
- }
-}
-
-#ifdef LIBXML_HTML_ENABLED
-/************************************************************************
- * *
- * Functions specific to XHTML serialization *
- * *
- ************************************************************************/
-
-#define XHTML_STRICT_PUBLIC_ID BAD_CAST \
- "-//W3C//DTD XHTML 1.0 Strict//EN"
-#define XHTML_STRICT_SYSTEM_ID BAD_CAST \
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-#define XHTML_FRAME_PUBLIC_ID BAD_CAST \
- "-//W3C//DTD XHTML 1.0 Frameset//EN"
-#define XHTML_FRAME_SYSTEM_ID BAD_CAST \
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
-#define XHTML_TRANS_PUBLIC_ID BAD_CAST \
- "-//W3C//DTD XHTML 1.0 Transitional//EN"
-#define XHTML_TRANS_SYSTEM_ID BAD_CAST \
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
-
-#define XHTML_NS_NAME BAD_CAST "http://www.w3.org/1999/xhtml"
-/**
- * xmlIsXHTML:
- * @systemID: the system identifier
- * @publicID: the public identifier
- *
- * Try to find if the document correspond to an XHTML DTD
- *
- * Returns 1 if true, 0 if not and -1 in case of error
- */
-int
-xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID) {
- if ((systemID == NULL) && (publicID == NULL))
- return(-1);
- if (publicID != NULL) {
- if (xmlStrEqual(publicID, XHTML_STRICT_PUBLIC_ID)) return(1);
- if (xmlStrEqual(publicID, XHTML_FRAME_PUBLIC_ID)) return(1);
- if (xmlStrEqual(publicID, XHTML_TRANS_PUBLIC_ID)) return(1);
- }
- if (systemID != NULL) {
- if (xmlStrEqual(systemID, XHTML_STRICT_SYSTEM_ID)) return(1);
- if (xmlStrEqual(systemID, XHTML_FRAME_SYSTEM_ID)) return(1);
- if (xmlStrEqual(systemID, XHTML_TRANS_SYSTEM_ID)) return(1);
- }
- return(0);
-}
-
-/**
- * xhtmlIsEmpty:
- * @node: the node
- *
- * Check if a node is an empty xhtml node
- *
- * Returns 1 if the node is an empty node, 0 if not and -1 in case of error
- */
-static int
-xhtmlIsEmpty(xmlNodePtr node) {
- if (node == NULL)
- return(-1);
- if (node->type != XML_ELEMENT_NODE)
- return(0);
- if ((node->ns != NULL) && (!xmlStrEqual(node->ns->href, XHTML_NS_NAME)))
- return(0);
- if (node->children != NULL)
- return(0);
- switch (node->name[0]) {
- case 'a':
- if (xmlStrEqual(node->name, BAD_CAST "area"))
- return(1);
- return(0);
- case 'b':
- if (xmlStrEqual(node->name, BAD_CAST "br"))
- return(1);
- if (xmlStrEqual(node->name, BAD_CAST "base"))
- return(1);
- if (xmlStrEqual(node->name, BAD_CAST "basefont"))
- return(1);
- return(0);
- case 'c':
- if (xmlStrEqual(node->name, BAD_CAST "col"))
- return(1);
- return(0);
- case 'f':
- if (xmlStrEqual(node->name, BAD_CAST "frame"))
- return(1);
- return(0);
- case 'h':
- if (xmlStrEqual(node->name, BAD_CAST "hr"))
- return(1);
- return(0);
- case 'i':
- if (xmlStrEqual(node->name, BAD_CAST "img"))
- return(1);
- if (xmlStrEqual(node->name, BAD_CAST "input"))
- return(1);
- if (xmlStrEqual(node->name, BAD_CAST "isindex"))
- return(1);
- return(0);
- case 'l':
- if (xmlStrEqual(node->name, BAD_CAST "link"))
- return(1);
- return(0);
- case 'm':
- if (xmlStrEqual(node->name, BAD_CAST "meta"))
- return(1);
- return(0);
- case 'p':
- if (xmlStrEqual(node->name, BAD_CAST "param"))
- return(1);
- return(0);
- }
- return(0);
-}
-
-/**
- * xhtmlAttrListDumpOutput:
- * @buf: the XML buffer output
- * @doc: the document
- * @cur: the first attribute pointer
- * @encoding: an optional encoding string
- *
- * Dump a list of XML attributes
- */
-static void
-xhtmlAttrListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
- xmlAttrPtr cur, const char *encoding) {
- xmlAttrPtr xml_lang = NULL;
- xmlAttrPtr lang = NULL;
- xmlAttrPtr name = NULL;
- xmlAttrPtr id = NULL;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlAttrListDumpOutput : property == NULL\n");
-#endif
- return;
- }
- while (cur != NULL) {
- if ((cur->ns == NULL) && (xmlStrEqual(cur->name, BAD_CAST "id")))
- id = cur;
- else
- if ((cur->ns == NULL) && (xmlStrEqual(cur->name, BAD_CAST "name")))
- name = cur;
- else
- if ((cur->ns == NULL) && (xmlStrEqual(cur->name, BAD_CAST "lang")))
- lang = cur;
- else
- if ((cur->ns != NULL) && (xmlStrEqual(cur->name, BAD_CAST "lang")) &&
- (xmlStrEqual(cur->ns->prefix, BAD_CAST "xml")))
- xml_lang = cur;
- else if ((cur->ns == NULL) &&
- ((cur->children == NULL) ||
- (cur->children->content == NULL) ||
- (cur->children->content[0] == 0)) &&
- (htmlIsBooleanAttr(cur->name))) {
- if (cur->children != NULL)
- xmlFreeNode(cur->children);
- cur->children = xmlNewText(cur->name);
- if (cur->children != NULL)
- cur->children->parent = (xmlNodePtr) cur;
- }
- xmlAttrDumpOutput(buf, doc, cur, encoding);
- cur = cur->next;
- }
- /*
- * C.8
- */
- if ((name != NULL) && (id == NULL)) {
- xmlOutputBufferWriteString(buf, " id=\"");
- xmlAttrSerializeContent(buf->buffer, doc, name);
- xmlOutputBufferWriteString(buf, "\"");
- }
- /*
- * C.7.
- */
- if ((lang != NULL) && (xml_lang == NULL)) {
- xmlOutputBufferWriteString(buf, " xml:lang=\"");
- xmlAttrSerializeContent(buf->buffer, doc, lang);
- xmlOutputBufferWriteString(buf, "\"");
- } else
- if ((xml_lang != NULL) && (lang == NULL)) {
- xmlOutputBufferWriteString(buf, " lang=\"");
- xmlAttrSerializeContent(buf->buffer, doc, xml_lang);
- xmlOutputBufferWriteString(buf, "\"");
- }
-}
-
-/**
- * xhtmlNodeListDumpOutput:
- * @buf: the XML buffer output
- * @doc: the XHTML document
- * @cur: the first node
- * @level: the imbrication level for indenting
- * @format: is formatting allowed
- * @encoding: an optional encoding string
- *
- * Dump an XML node list, recursive behaviour, children are printed too.
- * Note that format = 1 provide node indenting only if xmlIndentTreeOutput = 1
- * or xmlKeepBlanksDefault(0) was called
- */
-static void
-xhtmlNodeListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
- xmlNodePtr cur, int level, int format, const char *encoding) {
- int i;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xhtmlNodeListDumpOutput : node == NULL\n");
-#endif
- return;
- }
- while (cur != NULL) {
- if ((format) && (xmlIndentTreeOutput) &&
- (cur->type == XML_ELEMENT_NODE))
- for (i = 0;i < level;i++)
- xmlOutputBufferWriteString(buf, xmlTreeIndentString);
- xhtmlNodeDumpOutput(buf, doc, cur, level, format, encoding);
- if (format) {
- xmlOutputBufferWriteString(buf, "\n");
- }
- cur = cur->next;
- }
-}
-
-/**
- * xhtmlNodeDumpOutput:
- * @buf: the XML buffer output
- * @doc: the XHTML document
- * @cur: the current node
- * @level: the imbrication level for indenting
- * @format: is formatting allowed
- * @encoding: an optional encoding string
- *
- * Dump an XHTML node, recursive behaviour, children are printed too.
- * Note that format = 1 provide node indenting only if xmlIndentTreeOutput = 1
- * or xmlKeepBlanksDefault(0) was called
- */
-static void
-xhtmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
- int level, int format, const char *encoding) {
- int i;
- xmlNodePtr tmp;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlNodeDumpOutput : node == NULL\n");
-#endif
- return;
- }
- if (cur->type == XML_XINCLUDE_START)
- return;
- if (cur->type == XML_XINCLUDE_END)
- return;
- if (cur->type == XML_DTD_NODE) {
- xmlDtdDumpOutput(buf, (xmlDtdPtr) cur, encoding);
- return;
- }
- if (cur->type == XML_ELEMENT_DECL) {
- xmlDumpElementDecl(buf->buffer, (xmlElementPtr) cur);
- return;
- }
- if (cur->type == XML_ATTRIBUTE_DECL) {
- xmlDumpAttributeDecl(buf->buffer, (xmlAttributePtr) cur);
- return;
- }
- if (cur->type == XML_ENTITY_DECL) {
- xmlDumpEntityDecl(buf->buffer, (xmlEntityPtr) cur);
- return;
- }
- if (cur->type == XML_TEXT_NODE) {
- if (cur->content != NULL) {
- if ((cur->name == xmlStringText) ||
- (cur->name != xmlStringTextNoenc)) {
- xmlChar *buffer;
-
- if (encoding == NULL)
- buffer = xmlEncodeEntitiesReentrant(doc, cur->content);
- else
- buffer = xmlEncodeSpecialChars(doc, cur->content);
- if (buffer != NULL) {
- xmlOutputBufferWriteString(buf, (const char *)buffer);
- xmlFree(buffer);
- }
- } else {
- /*
- * Disable escaping, needed for XSLT
- */
- xmlOutputBufferWriteString(buf, (const char *) cur->content);
- }
- }
-
- return;
- }
- if (cur->type == XML_PI_NODE) {
- if (cur->content != NULL) {
- xmlOutputBufferWriteString(buf, "<?");
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- if (cur->content != NULL) {
- xmlOutputBufferWriteString(buf, " ");
- xmlOutputBufferWriteString(buf, (const char *)cur->content);
- }
- xmlOutputBufferWriteString(buf, "?>");
- } else {
- xmlOutputBufferWriteString(buf, "<?");
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- xmlOutputBufferWriteString(buf, "?>");
- }
- return;
- }
- if (cur->type == XML_COMMENT_NODE) {
- if (cur->content != NULL) {
- xmlOutputBufferWriteString(buf, "<!--");
- xmlOutputBufferWriteString(buf, (const char *)cur->content);
- xmlOutputBufferWriteString(buf, "-->");
- }
- return;
- }
- if (cur->type == XML_ENTITY_REF_NODE) {
- xmlOutputBufferWriteString(buf, "&");
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- xmlOutputBufferWriteString(buf, ";");
- return;
- }
- if (cur->type == XML_CDATA_SECTION_NODE) {
- xmlOutputBufferWriteString(buf, "<![CDATA[");
- if (cur->content != NULL)
- xmlOutputBufferWriteString(buf, (const char *)cur->content);
- xmlOutputBufferWriteString(buf, "]]>");
- return;
- }
-
- if (format == 1) {
- tmp = cur->children;
- while (tmp != NULL) {
- if ((tmp->type == XML_TEXT_NODE) ||
- (tmp->type == XML_ENTITY_REF_NODE)) {
- format = 0;
- break;
- }
- tmp = tmp->next;
- }
- }
- xmlOutputBufferWriteString(buf, "<");
- if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
- xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
- xmlOutputBufferWriteString(buf, ":");
- }
-
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- if (cur->nsDef)
- xmlNsListDumpOutput(buf, cur->nsDef);
- if ((xmlStrEqual(cur->name, BAD_CAST "html") &&
- (cur->ns == NULL) && (cur->nsDef == NULL))) {
- /*
- * 3.1.1. Strictly Conforming Documents A.3.1.1 3/
- */
- xmlOutputBufferWriteString(buf,
- " xmlns=\"http://www.w3.org/1999/xhtml\"");
- }
- if (cur->properties != NULL)
- xhtmlAttrListDumpOutput(buf, doc, cur->properties, encoding);
-
- if ((cur->type == XML_ELEMENT_NODE) && (cur->children == NULL)) {
- if (((cur->ns == NULL) || (cur->ns->prefix == NULL)) &&
- (xhtmlIsEmpty(cur) == 1)) {
- /*
- * C.2. Empty Elements
- */
- xmlOutputBufferWriteString(buf, " />");
- } else {
- /*
- * C.3. Element Minimization and Empty Element Content
- */
- xmlOutputBufferWriteString(buf, "></");
- if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
- xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
- xmlOutputBufferWriteString(buf, ":");
- }
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- xmlOutputBufferWriteString(buf, ">");
- }
- return;
- }
- xmlOutputBufferWriteString(buf, ">");
- if ((cur->type != XML_ELEMENT_NODE) && (cur->content != NULL)) {
- xmlChar *buffer;
-
- if (encoding == NULL)
- buffer = xmlEncodeEntitiesReentrant(doc, cur->content);
- else
- buffer = xmlEncodeSpecialChars(doc, cur->content);
- if (buffer != NULL) {
- xmlOutputBufferWriteString(buf, (const char *)buffer);
- xmlFree(buffer);
- }
- }
-
- /*
- * 4.8. Script and Style elements
- */
- if ((cur->type == XML_ELEMENT_NODE) &&
- ((xmlStrEqual(cur->name, BAD_CAST "script")) ||
- (xmlStrEqual(cur->name, BAD_CAST "style"))) &&
- ((cur->ns == NULL) ||
- (xmlStrEqual(cur->ns->href, XHTML_NS_NAME)))) {
- xmlNodePtr child = cur->children;
-
- while (child != NULL) {
- if ((child->type == XML_TEXT_NODE) ||
- (child->type == XML_CDATA_SECTION_NODE)) {
- /*
- * Apparently CDATA escaping for style just break on IE,
- * mozilla and galeon, so ...
- */
- if (xmlStrEqual(cur->name, BAD_CAST "style") &&
- (xmlStrchr(child->content, '<') == NULL) &&
- (xmlStrchr(child->content, '>') == NULL) &&
- (xmlStrchr(child->content, '&') == NULL)) {
- xhtmlNodeDumpOutput(buf, doc, child, 0, 0, encoding);
- } else {
- xmlOutputBufferWriteString(buf, "<![CDATA[");
- if (child->content != NULL)
- xmlOutputBufferWriteString(buf,
- (const char *)child->content);
- xmlOutputBufferWriteString(buf, "]]>");
- }
- } else {
- xhtmlNodeDumpOutput(buf, doc, child, 0, 0, encoding);
- }
- child = child->next;
- }
- } else if (cur->children != NULL) {
- if (format) xmlOutputBufferWriteString(buf, "\n");
- xhtmlNodeListDumpOutput(buf, doc, cur->children,
- (level >= 0?level+1:-1), format, encoding);
- if ((xmlIndentTreeOutput) && (format))
- for (i = 0;i < level;i++)
- xmlOutputBufferWriteString(buf, xmlTreeIndentString);
- }
- xmlOutputBufferWriteString(buf, "</");
- if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
- xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
- xmlOutputBufferWriteString(buf, ":");
- }
-
- xmlOutputBufferWriteString(buf, (const char *)cur->name);
- xmlOutputBufferWriteString(buf, ">");
-}
-#endif
-
-/************************************************************************
- * *
- * Saving functions front-ends *
- * *
- ************************************************************************/
-
-/**
- * xmlDocDumpFormatMemoryEnc:
- * @out_doc: Document to generate XML text from
- * @doc_txt_ptr: Memory pointer for allocated XML text
- * @doc_txt_len: Length of the generated XML text
- * @txt_encoding: Character encoding to use when generating XML text
- * @format: should formatting spaces been added
- *
- * Dump the current DOM tree into memory using the character encoding specified
- * by the caller. Note it is up to the caller of this function to free the
- * allocated memory with xmlFree().
- * Note that format = 1 provide node indenting only if xmlIndentTreeOutput = 1
- * or xmlKeepBlanksDefault(0) was called
- */
-
-void
-xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr,
- int * doc_txt_len, const char * txt_encoding,
- int format) {
- int dummy = 0;
-
- xmlCharEncoding doc_charset;
- xmlOutputBufferPtr out_buff = NULL;
- xmlCharEncodingHandlerPtr conv_hdlr = NULL;
-
- if (doc_txt_len == NULL) {
- doc_txt_len = &dummy; /* Continue, caller just won't get length */
- }
-
- if (doc_txt_ptr == NULL) {
- *doc_txt_len = 0;
- xmlGenericError(xmlGenericErrorContext,
- "xmlDocDumpFormatMemoryEnc: Null return buffer pointer.");
- return;
- }
-
- *doc_txt_ptr = NULL;
- *doc_txt_len = 0;
-
- if (out_doc == NULL) {
- /* No document, no output */
- xmlGenericError(xmlGenericErrorContext,
- "xmlDocDumpFormatMemoryEnc: Null DOM tree document pointer.\n");
- return;
- }
-
- /*
- * Validate the encoding value, if provided.
- * This logic is copied from xmlSaveFileEnc.
- */
-
- if (txt_encoding == NULL)
- txt_encoding = (const char *) out_doc->encoding;
- if (txt_encoding != NULL) {
- doc_charset = xmlParseCharEncoding(txt_encoding);
-
- if (out_doc->charset != XML_CHAR_ENCODING_UTF8) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlDocDumpFormatMemoryEnc: Source document not in UTF8\n");
- return;
-
- } else if (doc_charset != XML_CHAR_ENCODING_UTF8) {
- conv_hdlr = xmlFindCharEncodingHandler(txt_encoding);
- if ( conv_hdlr == NULL ) {
- xmlGenericError(xmlGenericErrorContext,
- "%s: %s %s '%s'\n",
- "xmlDocDumpFormatMemoryEnc",
- "Failed to identify encoding handler for",
- "character set",
- txt_encoding);
- return;
- }
- }
- }
-
- if ((out_buff = xmlAllocOutputBuffer(conv_hdlr)) == NULL ) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlDocDumpFormatMemoryEnc: Failed to allocate output buffer.\n");
- return;
- }
-
- xmlDocContentDumpOutput(out_buff, out_doc, txt_encoding, format);
- xmlOutputBufferFlush(out_buff);
- if (out_buff->conv != NULL) {
- *doc_txt_len = out_buff->conv->use;
- *doc_txt_ptr = xmlStrndup(out_buff->conv->content, *doc_txt_len);
- } else {
- *doc_txt_len = out_buff->buffer->use;
- *doc_txt_ptr = xmlStrndup(out_buff->buffer->content, *doc_txt_len);
- }
- (void)xmlOutputBufferClose(out_buff);
-
- if ((*doc_txt_ptr == NULL) && (*doc_txt_len > 0)) {
- *doc_txt_len = 0;
- xmlGenericError(xmlGenericErrorContext,
- "xmlDocDumpFormatMemoryEnc: %s\n",
- "Failed to allocate memory for document text representation.");
- }
-
- return;
-}
-
-/**
- * xmlDocDumpMemory:
- * @cur: the document
- * @mem: OUT: the memory pointer
- * @size: OUT: the memory length
- *
- * Dump an XML document in memory and return the #xmlChar * and it's size.
- * It's up to the caller to free the memory with xmlFree().
- */
-void
-xmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) {
- xmlDocDumpFormatMemoryEnc(cur, mem, size, NULL, 0);
-}
-
-/**
- * xmlDocDumpFormatMemory:
- * @cur: the document
- * @mem: OUT: the memory pointer
- * @size: OUT: the memory length
- * @format: should formatting spaces been added
- *
- *
- * Dump an XML document in memory and return the #xmlChar * and it's size.
- * It's up to the caller to free the memory with xmlFree().
- * Note that format = 1 provide node indenting only if xmlIndentTreeOutput = 1
- * or xmlKeepBlanksDefault(0) was called
- */
-void
-xmlDocDumpFormatMemory(xmlDocPtr cur, xmlChar**mem, int *size, int format) {
- xmlDocDumpFormatMemoryEnc(cur, mem, size, NULL, format);
-}
-
-/**
- * xmlDocDumpMemoryEnc:
- * @out_doc: Document to generate XML text from
- * @doc_txt_ptr: Memory pointer for allocated XML text
- * @doc_txt_len: Length of the generated XML text
- * @txt_encoding: Character encoding to use when generating XML text
- *
- * Dump the current DOM tree into memory using the character encoding specified
- * by the caller. Note it is up to the caller of this function to free the
- * allocated memory with xmlFree().
- */
-
-void
-xmlDocDumpMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr,
- int * doc_txt_len, const char * txt_encoding) {
- xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len,
- txt_encoding, 0);
-}
-
-/**
- * xmlGetDocCompressMode:
- * @doc: the document
- *
- * get the compression ratio for a document, ZLIB based
- * Returns 0 (uncompressed) to 9 (max compression)
- */
-int
-xmlGetDocCompressMode (xmlDocPtr doc) {
- if (doc == NULL) return(-1);
- return(doc->compression);
-}
-
-/**
- * xmlSetDocCompressMode:
- * @doc: the document
- * @mode: the compression ratio
- *
- * set the compression ratio for a document, ZLIB based
- * Correct values: 0 (uncompressed) to 9 (max compression)
- */
-void
-xmlSetDocCompressMode (xmlDocPtr doc, int mode) {
- if (doc == NULL) return;
- if (mode < 0) doc->compression = 0;
- else if (mode > 9) doc->compression = 9;
- else doc->compression = mode;
-}
-
-/**
- * xmlGetCompressMode:
- *
- * get the default compression mode used, ZLIB based.
- * Returns 0 (uncompressed) to 9 (max compression)
- */
-int
-xmlGetCompressMode(void)
-{
- return (xmlCompressMode);
-}
-
-/**
- * xmlSetCompressMode:
- * @mode: the compression ratio
- *
- * set the default compression mode used, ZLIB based
- * Correct values: 0 (uncompressed) to 9 (max compression)
- */
-void
-xmlSetCompressMode(int mode) {
- if (mode < 0) xmlCompressMode = 0;
- else if (mode > 9) xmlCompressMode = 9;
- else xmlCompressMode = mode;
-}
-
-/**
- * xmlDocFormatDump:
- * @f: the FILE*
- * @cur: the document
- * @format: should formatting spaces been added
- *
- * Dump an XML document to an open FILE.
- *
- * returns: the number of bytes written or -1 in case of failure.
- */
-int
-xmlDocFormatDump(FILE *f, xmlDocPtr cur, int format) {
- xmlOutputBufferPtr buf;
- const char * encoding;
- xmlCharEncodingHandlerPtr handler = NULL;
- int ret;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- xmlGenericError(xmlGenericErrorContext,
- "xmlDocDump : document == NULL\n");
-#endif
- return(-1);
- }
- encoding = (const char *) cur->encoding;
-
- if (encoding != NULL) {
- xmlCharEncoding enc;
-
- enc = xmlParseCharEncoding(encoding);
-
- if (cur->charset != XML_CHAR_ENCODING_UTF8) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlDocDump: document not in UTF8\n");
- return(-1);
- }
- if (enc != XML_CHAR_ENCODING_UTF8) {
- handler = xmlFindCharEncodingHandler(encoding);
- if (handler == NULL) {
- xmlFree((char *) cur->encoding);
- cur->encoding = NULL;
- }
- }
- }
- buf = xmlOutputBufferCreateFile(f, handler);
- if (buf == NULL) return(-1);
- xmlDocContentDumpOutput(buf, cur, NULL, format);
-
- ret = xmlOutputBufferClose(buf);
- return(ret);
-}
-
-/**
- * xmlDocDump:
- * @f: the FILE*
- * @cur: the document
- *
- * Dump an XML document to an open FILE.
- *
- * returns: the number of bytes written or -1 in case of failure.
- */
-int
-xmlDocDump(FILE *f, xmlDocPtr cur) {
- return(xmlDocFormatDump (f, cur, 0));
-}
-
-/**
- * xmlSaveFileTo:
- * @buf: an output I/O buffer
- * @cur: the document
- * @encoding: the encoding if any assuming the I/O layer handles the trancoding
- *
- * Dump an XML document to an I/O buffer.
- *
- * returns: the number of bytes written or -1 in case of failure.
- */
-int
-xmlSaveFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding) {
- int ret;
-
- if (buf == NULL) return(0);
- xmlDocContentDumpOutput(buf, cur, encoding, 0);
- ret = xmlOutputBufferClose(buf);
- return(ret);
-}
-
-/**
- * xmlSaveFormatFileTo:
- * @buf: an output I/O buffer
- * @cur: the document
- * @encoding: the encoding if any assuming the I/O layer handles the trancoding
- * @format: should formatting spaces been added
- *
- * Dump an XML document to an I/O buffer.
- *
- * returns: the number of bytes written or -1 in case of failure.
- */
-int
-xmlSaveFormatFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding, int format) {
- int ret;
-
- if (buf == NULL) return(0);
- xmlDocContentDumpOutput(buf, cur, encoding, format);
- ret = xmlOutputBufferClose(buf);
- return(ret);
-}
-
-/**
- * xmlSaveFormatFileEnc:
- * @filename: the filename or URL to output
- * @cur: the document being saved
- * @encoding: the name of the encoding to use or NULL.
- * @format: should formatting spaces be added.
- *
- * Dump an XML document to a file or an URL.
- *
- * Returns the number of bytes written or -1 in case of error.
- */
-int
-xmlSaveFormatFileEnc( const char * filename, xmlDocPtr cur,
- const char * encoding, int format ) {
- xmlOutputBufferPtr buf;
- xmlCharEncodingHandlerPtr handler = NULL;
- xmlCharEncoding enc;
- int ret;
-
- if (encoding == NULL)
- encoding = (const char *) cur->encoding;
-
- if (encoding != NULL) {
-
- enc = xmlParseCharEncoding(encoding);
- if (cur->charset != XML_CHAR_ENCODING_UTF8) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveFormatFileEnc: document not in UTF8\n");
- return(-1);
- }
- if (enc != XML_CHAR_ENCODING_UTF8) {
- handler = xmlFindCharEncodingHandler(encoding);
- if (handler == NULL)
- return(-1);
- }
- }
-
-#ifdef HAVE_ZLIB_H
- if (cur->compression < 0) cur->compression = xmlCompressMode;
-#endif
- /*
- * save the content to a temp buffer.
- */
- buf = xmlOutputBufferCreateFilename(filename, handler, cur->compression);
- if (buf == NULL) return(-1);
-
- xmlDocContentDumpOutput(buf, cur, encoding, format);
-
- ret = xmlOutputBufferClose(buf);
- return(ret);
-}
-
-
-/**
- * xmlSaveFileEnc:
- * @filename: the filename (or URL)
- * @cur: the document
- * @encoding: the name of an encoding (or NULL)
- *
- * Dump an XML document, converting it to the given encoding
- *
- * returns: the number of bytes written or -1 in case of failure.
- */
-int
-xmlSaveFileEnc(const char *filename, xmlDocPtr cur, const char *encoding) {
- return ( xmlSaveFormatFileEnc( filename, cur, encoding, 0 ) );
-}
-
-/**
- * xmlSaveFormatFile:
- * @filename: the filename (or URL)
- * @cur: the document
- * @format: should formatting spaces been added
- *
- * Dump an XML document to a file. Will use compression if
- * compiled in and enabled. If @filename is "-" the stdout file is
- * used. If @format is set then the document will be indented on output.
- *
- * returns: the number of bytes written or -1 in case of failure.
- */
-int
-xmlSaveFormatFile(const char *filename, xmlDocPtr cur, int format) {
- return ( xmlSaveFormatFileEnc( filename, cur, NULL, format ) );
-}
-
-/**
- * xmlSaveFile:
- * @filename: the filename (or URL)
- * @cur: the document
- *
- * Dump an XML document to a file. Will use compression if
- * compiled in and enabled. If @filename is "-" the stdout file is
- * used.
- * returns: the number of bytes written or -1 in case of failure.
- */
-int
-xmlSaveFile(const char *filename, xmlDocPtr cur) {
- return(xmlSaveFormatFileEnc(filename, cur, NULL, 0));
-}
-
diff --git a/bundle/libxml/trio.c b/bundle/libxml/trio.c
deleted file mode 100644
index 7593e58180..0000000000
--- a/bundle/libxml/trio.c
+++ /dev/null
@@ -1,6760 +0,0 @@
-/*************************************************************************
- *
- * $Id$
- *
- * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- *************************************************************************
- *
- * A note to trio contributors:
- *
- * Avoid heap allocation at all costs to ensure that the trio functions
- * are async-safe. The exceptions are the printf/fprintf functions, which
- * uses fputc, and the asprintf functions and the <alloc> modifier, which
- * by design are required to allocate form the heap.
- *
- ************************************************************************/
-
-/*
- * TODO:
- * - Scan is probably too permissive about its modifiers.
- * - C escapes in %#[] ?
- * - Multibyte characters (done for format parsing, except scan groups)
- * - Complex numbers? (C99 _Complex)
- * - Boolean values? (C99 _Bool)
- * - C99 NaN(n-char-sequence) missing
- * - Should we support the GNU %a alloc modifier? GNU has an ugly hack
- * for %a, because C99 used %a for other purposes. If specified as
- * %as or %a[ it is interpreted as the alloc modifier, otherwise as
- * the C99 hex-float. This means that you cannot scan %as as a hex-float
- * immediately followed by an 's'.
- * - Scanning of collating symbols.
- */
-
-/*************************************************************************
- * Trio include files
- */
-#include "triodef.h"
-#include "trio.h"
-#include "triop.h"
-#include "trionan.h"
-#if !defined(TRIO_MINIMAL)
-# include "triostr.h"
-#endif
-
-/**************************************************************************
- *
- * Definitions
- *
- *************************************************************************/
-
-#if defined(__STDC_ISO_10646__) || defined(MB_LEN_MAX) || defined(USE_MULTIBYTE) || TRIO_WIDECHAR
-# define TRIO_COMPILER_SUPPORTS_MULTIBYTE
-# if !defined(MB_LEN_MAX)
-# define MB_LEN_MAX 6
-# endif
-#endif
-
-/*************************************************************************
- * Generic definitions
- */
-
-#if !(defined(DEBUG) || defined(NDEBUG))
-# define NDEBUG
-#endif
-#include <assert.h>
-#include <ctype.h>
-#if !defined(TRIO_COMPILER_SUPPORTS_C99)
-# define isblank(x) (((x)==32) || ((x)==9))
-#endif
-#include <math.h>
-#include <limits.h>
-#include <float.h>
-#if defined(TRIO_COMPILER_ANCIENT)
-# include <varargs.h>
-#else
-# include <stdarg.h>
-#endif
-#include <stddef.h>
-#include <errno.h>
-
-#ifndef NULL
-# define NULL 0
-#endif
-#define NIL ((char)0)
-#ifndef FALSE
-# define FALSE (1 == 0)
-# define TRUE (! FALSE)
-#endif
-#define BOOLEAN_T int
-
-/* mincore() can be used for debugging purposes */
-#define VALID(x) (NULL != (x))
-
-#if TRIO_ERRORS
- /*
- * Encode the error code and the position. This is decoded
- * with TRIO_ERROR_CODE and TRIO_ERROR_POSITION.
- */
-# define TRIO_ERROR_RETURN(x,y) (- ((x) + ((y) << 8)))
-#else
-# define TRIO_ERROR_RETURN(x,y) (-1)
-#endif
-
-
-/*************************************************************************
- * Platform specific definitions
- */
-#if defined(TRIO_PLATFORM_UNIX)
-# include <unistd.h>
-# include <signal.h>
-# include <locale.h>
-# define USE_LOCALE
-#endif /* TRIO_PLATFORM_UNIX */
-#if defined(TRIO_PLATFORM_VMS)
-# include <unistd.h>
-#endif
-#if defined(TRIO_PLATFORM_WIN32)
-# include <io.h>
-# define read _read
-# define write _write
-#endif /* TRIO_PLATFORM_WIN32 */
-
-#define TRIO_MSVC_VERSION_5 1100
-
-#if TRIO_WIDECHAR
-# if defined(TRIO_COMPILER_SUPPORTS_ISO94)
-# include <wchar.h>
-# include <wctype.h>
-typedef wchar_t trio_wchar_t;
-typedef wint_t trio_wint_t;
-# else
-typedef char trio_wchar_t;
-typedef int trio_wint_t;
-# define WCONST(x) L ## x
-# define WEOF EOF
-# define iswalnum(x) isalnum(x)
-# define iswalpha(x) isalpha(x)
-# define iswblank(x) isblank(x)
-# define iswcntrl(x) iscntrl(x)
-# define iswdigit(x) isdigit(x)
-# define iswgraph(x) isgraph(x)
-# define iswlower(x) islower(x)
-# define iswprint(x) isprint(x)
-# define iswpunct(x) ispunct(x)
-# define iswspace(x) isspace(x)
-# define iswupper(x) isupper(x)
-# define iswxdigit(x) isxdigit(x)
-# endif
-#endif
-
-
-/*************************************************************************
- * Compiler dependent definitions
- */
-
-/* Support for long long */
-#ifndef __cplusplus
-# if !defined(USE_LONGLONG)
-# if defined(TRIO_COMPILER_GCC) && !defined(__STRICT_ANSI__)
-# define USE_LONGLONG
-# elif defined(TRIO_COMPILER_SUNPRO)
-# define USE_LONGLONG
-# elif defined(_LONG_LONG) || defined(_LONGLONG)
-# define USE_LONGLONG
-# endif
-# endif
-#endif
-
-/* The extra long numbers */
-#if defined(USE_LONGLONG)
-typedef signed long long int trio_longlong_t;
-typedef unsigned long long int trio_ulonglong_t;
-#elif defined(TRIO_COMPILER_MSVC)
-# if (_MSC_VER >= TRIO_MSVC_VERSION_5)
-typedef signed __int64 trio_longlong_t;
-typedef unsigned __int64 trio_ulonglong_t;
-# else
-typedef signed long int trio_longlong_t;
-typedef unsigned long int trio_ulonglong_t;
-# endif
-#else
-typedef TRIO_SIGNED long int trio_longlong_t;
-typedef unsigned long int trio_ulonglong_t;
-#endif
-
-/* Maximal and fixed integer types */
-#if defined(TRIO_COMPILER_SUPPORTS_C99)
-# include <stdint.h>
-typedef intmax_t trio_intmax_t;
-typedef uintmax_t trio_uintmax_t;
-typedef int8_t trio_int8_t;
-typedef int16_t trio_int16_t;
-typedef int32_t trio_int32_t;
-typedef int64_t trio_int64_t;
-#elif defined(TRIO_COMPILER_SUPPORTS_UNIX98)
-# include <inttypes.h>
-typedef intmax_t trio_intmax_t;
-typedef uintmax_t trio_uintmax_t;
-typedef int8_t trio_int8_t;
-typedef int16_t trio_int16_t;
-typedef int32_t trio_int32_t;
-typedef int64_t trio_int64_t;
-#elif defined(TRIO_COMPILER_MSVC) && (_MSC_VER >= TRIO_MSVC_VERSION_5)
-typedef trio_longlong_t trio_intmax_t;
-typedef trio_ulonglong_t trio_uintmax_t;
-typedef __int8 trio_int8_t;
-typedef __int16 trio_int16_t;
-typedef __int32 trio_int32_t;
-typedef __int64 trio_int64_t;
-#else
-typedef trio_longlong_t trio_intmax_t;
-typedef trio_ulonglong_t trio_uintmax_t;
-# if defined(TRIO_INT8_T)
-typedef TRIO_INT8_T trio_int8_t;
-# else
-typedef TRIO_SIGNED char trio_int8_t;
-# endif
-# if defined(TRIO_INT16_T)
-typedef TRIO_INT16_T trio_int16_t;
-# else
-typedef TRIO_SIGNED short trio_int16_t;
-# endif
-# if defined(TRIO_INT32_T)
-typedef TRIO_INT32_T trio_int32_t;
-# else
-typedef TRIO_SIGNED int trio_int32_t;
-# endif
-# if defined(TRIO_INT64_T)
-typedef TRIO_INT64_T trio_int64_t;
-# else
-typedef trio_longlong_t trio_int64_t;
-# endif
-#endif
-
-#if !(defined(TRIO_COMPILER_SUPPORTS_C99) \
- || defined(TRIO_COMPILER_SUPPORTS_UNIX01))
-# define floorl(x) floor((double)(x))
-# define fmodl(x,y) fmod((double)(x),(double)(y))
-# define powl(x,y) pow((double)(x),(double)(y))
-#endif
-
-#define TRIO_FABS(x) (((x) < 0.0) ? -(x) : (x))
-
-/*************************************************************************
- * Internal Definitions
- */
-
-#ifndef DECIMAL_DIG
-# define DECIMAL_DIG DBL_DIG
-#endif
-
-/* Long double sizes */
-#ifdef LDBL_DIG
-# define MAX_MANTISSA_DIGITS LDBL_DIG
-# define MAX_EXPONENT_DIGITS 4
-# define MAX_DOUBLE_DIGITS LDBL_MAX_10_EXP
-#else
-# define MAX_MANTISSA_DIGITS DECIMAL_DIG
-# define MAX_EXPONENT_DIGITS 3
-# define MAX_DOUBLE_DIGITS DBL_MAX_10_EXP
-#endif
-
-#if defined(TRIO_COMPILER_ANCIENT) || !defined(LDBL_DIG)
-# undef LDBL_DIG
-# undef LDBL_MANT_DIG
-# undef LDBL_EPSILON
-# define LDBL_DIG DBL_DIG
-# define LDBL_MANT_DIG DBL_MANT_DIG
-# define LDBL_EPSILON DBL_EPSILON
-#endif
-
-/* The maximal number of digits is for base 2 */
-#define MAX_CHARS_IN(x) (sizeof(x) * CHAR_BIT)
-/* The width of a pointer. The number of bits in a hex digit is 4 */
-#define POINTER_WIDTH ((sizeof("0x") - 1) + sizeof(trio_pointer_t) * CHAR_BIT / 4)
-
-/* Infinite and Not-A-Number for floating-point */
-#define INFINITE_LOWER "inf"
-#define INFINITE_UPPER "INF"
-#define LONG_INFINITE_LOWER "infinite"
-#define LONG_INFINITE_UPPER "INFINITE"
-#define NAN_LOWER "nan"
-#define NAN_UPPER "NAN"
-
-/* Various constants */
-enum {
- TYPE_PRINT = 1,
- TYPE_SCAN = 2,
-
- /* Flags. Use maximum 32 */
- FLAGS_NEW = 0,
- FLAGS_STICKY = 1,
- FLAGS_SPACE = 2 * FLAGS_STICKY,
- FLAGS_SHOWSIGN = 2 * FLAGS_SPACE,
- FLAGS_LEFTADJUST = 2 * FLAGS_SHOWSIGN,
- FLAGS_ALTERNATIVE = 2 * FLAGS_LEFTADJUST,
- FLAGS_SHORT = 2 * FLAGS_ALTERNATIVE,
- FLAGS_SHORTSHORT = 2 * FLAGS_SHORT,
- FLAGS_LONG = 2 * FLAGS_SHORTSHORT,
- FLAGS_QUAD = 2 * FLAGS_LONG,
- FLAGS_LONGDOUBLE = 2 * FLAGS_QUAD,
- FLAGS_SIZE_T = 2 * FLAGS_LONGDOUBLE,
- FLAGS_PTRDIFF_T = 2 * FLAGS_SIZE_T,
- FLAGS_INTMAX_T = 2 * FLAGS_PTRDIFF_T,
- FLAGS_NILPADDING = 2 * FLAGS_INTMAX_T,
- FLAGS_UNSIGNED = 2 * FLAGS_NILPADDING,
- FLAGS_UPPER = 2 * FLAGS_UNSIGNED,
- FLAGS_WIDTH = 2 * FLAGS_UPPER,
- FLAGS_WIDTH_PARAMETER = 2 * FLAGS_WIDTH,
- FLAGS_PRECISION = 2 * FLAGS_WIDTH_PARAMETER,
- FLAGS_PRECISION_PARAMETER = 2 * FLAGS_PRECISION,
- FLAGS_BASE = 2 * FLAGS_PRECISION_PARAMETER,
- FLAGS_BASE_PARAMETER = 2 * FLAGS_BASE,
- FLAGS_FLOAT_E = 2 * FLAGS_BASE_PARAMETER,
- FLAGS_FLOAT_G = 2 * FLAGS_FLOAT_E,
- FLAGS_QUOTE = 2 * FLAGS_FLOAT_G,
- FLAGS_WIDECHAR = 2 * FLAGS_QUOTE,
- FLAGS_ALLOC = 2 * FLAGS_WIDECHAR,
- FLAGS_IGNORE = 2 * FLAGS_ALLOC,
- FLAGS_IGNORE_PARAMETER = 2 * FLAGS_IGNORE,
- FLAGS_VARSIZE_PARAMETER = 2 * FLAGS_IGNORE_PARAMETER,
- FLAGS_FIXED_SIZE = 2 * FLAGS_VARSIZE_PARAMETER,
- /* Reused flags */
- FLAGS_EXCLUDE = FLAGS_SHORT,
- FLAGS_USER_DEFINED = FLAGS_IGNORE,
- FLAGS_ROUNDING = FLAGS_INTMAX_T,
- /* Compounded flags */
- FLAGS_ALL_VARSIZES = FLAGS_LONG | FLAGS_QUAD | FLAGS_INTMAX_T | FLAGS_PTRDIFF_T | FLAGS_SIZE_T,
- FLAGS_ALL_SIZES = FLAGS_ALL_VARSIZES | FLAGS_SHORTSHORT | FLAGS_SHORT,
-
- NO_POSITION = -1,
- NO_WIDTH = 0,
- NO_PRECISION = -1,
- NO_SIZE = -1,
-
- /* Do not change these */
- NO_BASE = -1,
- MIN_BASE = 2,
- MAX_BASE = 36,
- BASE_BINARY = 2,
- BASE_OCTAL = 8,
- BASE_DECIMAL = 10,
- BASE_HEX = 16,
-
- /* Maximal number of allowed parameters */
- MAX_PARAMETERS = 64,
- /* Maximal number of characters in class */
- MAX_CHARACTER_CLASS = UCHAR_MAX + 1,
-
- /* Maximal string lengths for user-defined specifiers */
- MAX_USER_NAME = 64,
- MAX_USER_DATA = 256,
-
- /* Maximal length of locale separator strings */
- MAX_LOCALE_SEPARATOR_LENGTH = MB_LEN_MAX,
- /* Maximal number of integers in grouping */
- MAX_LOCALE_GROUPS = 64,
-
- /* Initial size of asprintf buffer */
- DYNAMIC_START_SIZE = 32
-};
-
-#define NO_GROUPING ((int)CHAR_MAX)
-
-/* Fundamental formatting parameter types */
-#define FORMAT_UNKNOWN 0
-#define FORMAT_INT 1
-#define FORMAT_DOUBLE 2
-#define FORMAT_CHAR 3
-#define FORMAT_STRING 4
-#define FORMAT_POINTER 5
-#define FORMAT_COUNT 6
-#define FORMAT_PARAMETER 7
-#define FORMAT_GROUP 8
-#if TRIO_GNU
-# define FORMAT_ERRNO 9
-#endif
-#if TRIO_EXTENSION
-# define FORMAT_USER_DEFINED 10
-#endif
-
-/* Character constants */
-#define CHAR_IDENTIFIER '%'
-#define CHAR_BACKSLASH '\\'
-#define CHAR_QUOTE '\"'
-#define CHAR_ADJUST ' '
-
-/* Character class expressions */
-#define CLASS_ALNUM "[:alnum:]"
-#define CLASS_ALPHA "[:alpha:]"
-#define CLASS_BLANK "[:blank:]"
-#define CLASS_CNTRL "[:cntrl:]"
-#define CLASS_DIGIT "[:digit:]"
-#define CLASS_GRAPH "[:graph:]"
-#define CLASS_LOWER "[:lower:]"
-#define CLASS_PRINT "[:print:]"
-#define CLASS_PUNCT "[:punct:]"
-#define CLASS_SPACE "[:space:]"
-#define CLASS_UPPER "[:upper:]"
-#define CLASS_XDIGIT "[:xdigit:]"
-
-/*
- * SPECIFIERS:
- *
- *
- * a Hex-float
- * A Hex-float
- * c Character
- * C Widechar character (wint_t)
- * d Decimal
- * e Float
- * E Float
- * F Float
- * F Float
- * g Float
- * G Float
- * i Integer
- * m Error message
- * n Count
- * o Octal
- * p Pointer
- * s String
- * S Widechar string (wchar_t *)
- * u Unsigned
- * x Hex
- * X Hex
- * [] Group
- * <> User-defined
- *
- * Reserved:
- *
- * D Binary Coded Decimal %D(length,precision) (OS/390)
- */
-#define SPECIFIER_CHAR 'c'
-#define SPECIFIER_STRING 's'
-#define SPECIFIER_DECIMAL 'd'
-#define SPECIFIER_INTEGER 'i'
-#define SPECIFIER_UNSIGNED 'u'
-#define SPECIFIER_OCTAL 'o'
-#define SPECIFIER_HEX 'x'
-#define SPECIFIER_HEX_UPPER 'X'
-#define SPECIFIER_FLOAT_E 'e'
-#define SPECIFIER_FLOAT_E_UPPER 'E'
-#define SPECIFIER_FLOAT_F 'f'
-#define SPECIFIER_FLOAT_F_UPPER 'F'
-#define SPECIFIER_FLOAT_G 'g'
-#define SPECIFIER_FLOAT_G_UPPER 'G'
-#define SPECIFIER_POINTER 'p'
-#define SPECIFIER_GROUP '['
-#define SPECIFIER_UNGROUP ']'
-#define SPECIFIER_COUNT 'n'
-#if TRIO_UNIX98
-# define SPECIFIER_CHAR_UPPER 'C'
-# define SPECIFIER_STRING_UPPER 'S'
-#endif
-#if TRIO_C99
-# define SPECIFIER_HEXFLOAT 'a'
-# define SPECIFIER_HEXFLOAT_UPPER 'A'
-#endif
-#if TRIO_GNU
-# define SPECIFIER_ERRNO 'm'
-#endif
-#if TRIO_EXTENSION
-# define SPECIFIER_BINARY 'b'
-# define SPECIFIER_BINARY_UPPER 'B'
-# define SPECIFIER_USER_DEFINED_BEGIN '<'
-# define SPECIFIER_USER_DEFINED_END '>'
-# define SPECIFIER_USER_DEFINED_SEPARATOR ':'
-#endif
-
-/*
- * QUALIFIERS:
- *
- *
- * Numbers = d,i,o,u,x,X
- * Float = a,A,e,E,f,F,g,G
- * String = s
- * Char = c
- *
- *
- * 9$ Position
- * Use the 9th parameter. 9 can be any number between 1 and
- * the maximal argument
- *
- * 9 Width
- * Set width to 9. 9 can be any number, but must not be postfixed
- * by '$'
- *
- * h Short
- * Numbers:
- * (unsigned) short int
- *
- * hh Short short
- * Numbers:
- * (unsigned) char
- *
- * l Long
- * Numbers:
- * (unsigned) long int
- * String:
- * as the S specifier
- * Char:
- * as the C specifier
- *
- * ll Long Long
- * Numbers:
- * (unsigned) long long int
- *
- * L Long Double
- * Float
- * long double
- *
- * # Alternative
- * Float:
- * Decimal-point is always present
- * String:
- * non-printable characters are handled as \number
- *
- * Spacing
- *
- * + Sign
- *
- * - Alignment
- *
- * . Precision
- *
- * * Parameter
- * print: use parameter
- * scan: no parameter (ignore)
- *
- * q Quad
- *
- * Z size_t
- *
- * w Widechar
- *
- * ' Thousands/quote
- * Numbers:
- * Integer part grouped in thousands
- * Binary numbers:
- * Number grouped in nibbles (4 bits)
- * String:
- * Quoted string
- *
- * j intmax_t
- * t prtdiff_t
- * z size_t
- *
- * ! Sticky
- * @ Parameter (for both print and scan)
- *
- * I n-bit Integer
- * Numbers:
- * The following options exists
- * I8 = 8-bit integer
- * I16 = 16-bit integer
- * I32 = 32-bit integer
- * I64 = 64-bit integer
- */
-#define QUALIFIER_POSITION '$'
-#define QUALIFIER_SHORT 'h'
-#define QUALIFIER_LONG 'l'
-#define QUALIFIER_LONG_UPPER 'L'
-#define QUALIFIER_ALTERNATIVE '#'
-#define QUALIFIER_SPACE ' '
-#define QUALIFIER_PLUS '+'
-#define QUALIFIER_MINUS '-'
-#define QUALIFIER_DOT '.'
-#define QUALIFIER_STAR '*'
-#define QUALIFIER_CIRCUMFLEX '^' /* For scanlists */
-#if TRIO_C99
-# define QUALIFIER_SIZE_T 'z'
-# define QUALIFIER_PTRDIFF_T 't'
-# define QUALIFIER_INTMAX_T 'j'
-#endif
-#if TRIO_BSD || TRIO_GNU
-# define QUALIFIER_QUAD 'q'
-#endif
-#if TRIO_GNU
-# define QUALIFIER_SIZE_T_UPPER 'Z'
-#endif
-#if TRIO_MISC
-# define QUALIFIER_WIDECHAR 'w'
-#endif
-#if TRIO_MICROSOFT
-# define QUALIFIER_FIXED_SIZE 'I'
-#endif
-#if TRIO_EXTENSION
-# define QUALIFIER_QUOTE '\''
-# define QUALIFIER_STICKY '!'
-# define QUALIFIER_VARSIZE '&' /* This should remain undocumented */
-# define QUALIFIER_PARAM '@' /* Experimental */
-# define QUALIFIER_COLON ':' /* For scanlists */
-# define QUALIFIER_EQUAL '=' /* For scanlists */
-# define QUALIFIER_ROUNDING_UPPER 'R'
-#endif
-
-
-/*************************************************************************
- *
- * Internal Structures
- *
- *************************************************************************/
-
-/* Parameters */
-typedef struct {
- /* An indication of which entry in the data union is used */
- int type;
- /* The flags */
- unsigned long flags;
- /* The width qualifier */
- int width;
- /* The precision qualifier */
- int precision;
- /* The base qualifier */
- int base;
- /* The size for the variable size qualifier */
- int varsize;
- /* The marker of the end of the specifier */
- int indexAfterSpecifier;
- /* The data from the argument list */
- union {
- char *string;
-#if TRIO_WIDECHAR
- trio_wchar_t *wstring;
-#endif
- trio_pointer_t pointer;
- union {
- trio_intmax_t as_signed;
- trio_uintmax_t as_unsigned;
- } number;
- double doubleNumber;
- double *doublePointer;
- trio_long_double_t longdoubleNumber;
- trio_long_double_t *longdoublePointer;
- int errorNumber;
- } data;
- /* For the user-defined specifier */
- char user_name[MAX_USER_NAME];
- char user_data[MAX_USER_DATA];
-} trio_parameter_t;
-
-/* Container for customized functions */
-typedef struct {
- union {
- trio_outstream_t out;
- trio_instream_t in;
- } stream;
- trio_pointer_t closure;
-} trio_custom_t;
-
-/* General trio "class" */
-typedef struct _trio_class_t {
- /*
- * The function to write characters to a stream.
- */
- void (*OutStream) TRIO_PROTO((struct _trio_class_t *, int));
- /*
- * The function to read characters from a stream.
- */
- void (*InStream) TRIO_PROTO((struct _trio_class_t *, int *));
- /*
- * The current location in the stream.
- */
- trio_pointer_t location;
- /*
- * The character currently being processed.
- */
- int current;
- /*
- * The number of characters that would have been written/read
- * if there had been sufficient space.
- */
- int processed;
- /*
- * The number of characters that are actually written/read.
- * Processed and committed will only differ for the *nprintf
- * and *nscanf functions.
- */
- int committed;
- /*
- * The upper limit of characters that may be written/read.
- */
- int max;
- /*
- * The last output error that was detected.
- */
- int error;
-} trio_class_t;
-
-/* References (for user-defined callbacks) */
-typedef struct _trio_reference_t {
- trio_class_t *data;
- trio_parameter_t *parameter;
-} trio_reference_t;
-
-/* Registered entries (for user-defined callbacks) */
-typedef struct _trio_userdef_t {
- struct _trio_userdef_t *next;
- trio_callback_t callback;
- char *name;
-} trio_userdef_t;
-
-
-/*************************************************************************
- *
- * Internal Variables
- *
- *************************************************************************/
-
-static TRIO_CONST char rcsid[] = "@(#)$Id$";
-
-/*
- * Need this to workaround a parser bug in HP C/iX compiler that fails
- * to resolves macro definitions that includes type 'long double',
- * e.g: va_arg(arg_ptr, long double)
- */
-#if defined(TRIO_PLATFORM_MPEIX)
-static TRIO_CONST trio_long_double_t ___dummy_long_double = 0;
-#endif
-
-static TRIO_CONST char internalNullString[] = "(nil)";
-
-#if defined(USE_LOCALE)
-static struct lconv *internalLocaleValues = NULL;
-#endif
-
-/*
- * UNIX98 says "in a locale where the radix character is not defined,
- * the radix character defaults to a period (.)"
- */
-static int internalDecimalPointLength = 1;
-static int internalThousandSeparatorLength = 1;
-static char internalDecimalPoint = '.';
-static char internalDecimalPointString[MAX_LOCALE_SEPARATOR_LENGTH + 1] = ".";
-static char internalThousandSeparator[MAX_LOCALE_SEPARATOR_LENGTH + 1] = ",";
-static char internalGrouping[MAX_LOCALE_GROUPS] = { (char)NO_GROUPING };
-
-static TRIO_CONST char internalDigitsLower[] = "0123456789abcdefghijklmnopqrstuvwxyz";
-static TRIO_CONST char internalDigitsUpper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-static BOOLEAN_T internalDigitsUnconverted = TRUE;
-static int internalDigitArray[128];
-#if TRIO_EXTENSION
-static BOOLEAN_T internalCollationUnconverted = TRUE;
-static char internalCollationArray[MAX_CHARACTER_CLASS][MAX_CHARACTER_CLASS];
-#endif
-
-#if TRIO_EXTENSION
-static TRIO_VOLATILE trio_callback_t internalEnterCriticalRegion = NULL;
-static TRIO_VOLATILE trio_callback_t internalLeaveCriticalRegion = NULL;
-static trio_userdef_t *internalUserDef = NULL;
-#endif
-
-
-/*************************************************************************
- *
- * Internal Functions
- *
- ************************************************************************/
-
-#if defined(TRIO_MINIMAL)
-# define TRIO_STRING_PUBLIC static
-# include "triostr.c"
-#endif /* defined(TRIO_MINIMAL) */
-
-/*************************************************************************
- * TrioIsQualifier
- *
- * Description:
- * Remember to add all new qualifiers to this function.
- * QUALIFIER_POSITION must not be added.
- */
-TRIO_PRIVATE BOOLEAN_T
-TrioIsQualifier
-TRIO_ARGS1((character),
- TRIO_CONST char character)
-{
- /* QUALIFIER_POSITION is not included */
- switch (character)
- {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- case QUALIFIER_PLUS:
- case QUALIFIER_MINUS:
- case QUALIFIER_SPACE:
- case QUALIFIER_DOT:
- case QUALIFIER_STAR:
- case QUALIFIER_ALTERNATIVE:
- case QUALIFIER_SHORT:
- case QUALIFIER_LONG:
- case QUALIFIER_LONG_UPPER:
- case QUALIFIER_CIRCUMFLEX:
-#if defined(QUALIFIER_SIZE_T)
- case QUALIFIER_SIZE_T:
-#endif
-#if defined(QUALIFIER_PTRDIFF_T)
- case QUALIFIER_PTRDIFF_T:
-#endif
-#if defined(QUALIFIER_INTMAX_T)
- case QUALIFIER_INTMAX_T:
-#endif
-#if defined(QUALIFIER_QUAD)
- case QUALIFIER_QUAD:
-#endif
-#if defined(QUALIFIER_SIZE_T_UPPER)
- case QUALIFIER_SIZE_T_UPPER:
-#endif
-#if defined(QUALIFIER_WIDECHAR)
- case QUALIFIER_WIDECHAR:
-#endif
-#if defined(QUALIFIER_QUOTE)
- case QUALIFIER_QUOTE:
-#endif
-#if defined(QUALIFIER_STICKY)
- case QUALIFIER_STICKY:
-#endif
-#if defined(QUALIFIER_VARSIZE)
- case QUALIFIER_VARSIZE:
-#endif
-#if defined(QUALIFIER_PARAM)
- case QUALIFIER_PARAM:
-#endif
-#if defined(QUALIFIER_FIXED_SIZE)
- case QUALIFIER_FIXED_SIZE:
-#endif
-#if defined(QUALIFIER_ROUNDING_UPPER)
- case QUALIFIER_ROUNDING_UPPER:
-#endif
- return TRUE;
- default:
- return FALSE;
- }
-}
-
-/*************************************************************************
- * TrioSetLocale
- */
-#if defined(USE_LOCALE)
-TRIO_PRIVATE void
-TrioSetLocale(TRIO_NOARGS)
-{
- internalLocaleValues = (struct lconv *)localeconv();
- if (internalLocaleValues)
- {
- if ((internalLocaleValues->decimal_point) &&
- (internalLocaleValues->decimal_point[0] != NIL))
- {
- internalDecimalPointLength = trio_length(internalLocaleValues->decimal_point);
- if (internalDecimalPointLength == 1)
- {
- internalDecimalPoint = internalLocaleValues->decimal_point[0];
- }
- else
- {
- internalDecimalPoint = NIL;
- trio_copy_max(internalDecimalPointString,
- sizeof(internalDecimalPointString),
- internalLocaleValues->decimal_point);
- }
- }
- if ((internalLocaleValues->thousands_sep) &&
- (internalLocaleValues->thousands_sep[0] != NIL))
- {
- trio_copy_max(internalThousandSeparator,
- sizeof(internalThousandSeparator),
- internalLocaleValues->thousands_sep);
- internalThousandSeparatorLength = trio_length(internalThousandSeparator);
- }
- if ((internalLocaleValues->grouping) &&
- (internalLocaleValues->grouping[0] != NIL))
- {
- trio_copy_max(internalGrouping,
- sizeof(internalGrouping),
- internalLocaleValues->grouping);
- }
- }
-}
-#endif /* defined(USE_LOCALE) */
-
-TRIO_PRIVATE int
-TrioCalcThousandSeparatorLength
-TRIO_ARGS1((digits),
- int digits)
-{
-#if TRIO_EXTENSION
- int count = 0;
- int step = NO_GROUPING;
- char *groupingPointer = internalGrouping;
-
- while (digits > 0)
- {
- if (*groupingPointer == CHAR_MAX)
- {
- /* Disable grouping */
- break; /* while */
- }
- else if (*groupingPointer == 0)
- {
- /* Repeat last group */
- if (step == NO_GROUPING)
- {
- /* Error in locale */
- break; /* while */
- }
- }
- else
- {
- step = *groupingPointer++;
- }
- if (digits > step)
- count += internalThousandSeparatorLength;
- digits -= step;
- }
- return count;
-#else
- return 0;
-#endif
-}
-
-TRIO_PRIVATE BOOLEAN_T
-TrioFollowedBySeparator
-TRIO_ARGS1((position),
- int position)
-{
-#if TRIO_EXTENSION
- int step = 0;
- char *groupingPointer = internalGrouping;
-
- position--;
- if (position == 0)
- return FALSE;
- while (position > 0)
- {
- if (*groupingPointer == CHAR_MAX)
- {
- /* Disable grouping */
- break; /* while */
- }
- else if (*groupingPointer != 0)
- {
- step = *groupingPointer++;
- }
- if (step == 0)
- break;
- position -= step;
- }
- return (position == 0);
-#else
- return FALSE;
-#endif
-}
-
-/*************************************************************************
- * TrioGetPosition
- *
- * Get the %n$ position.
- */
-TRIO_PRIVATE int
-TrioGetPosition
-TRIO_ARGS2((format, indexPointer),
- TRIO_CONST char *format,
- int *indexPointer)
-{
-#if TRIO_UNIX98
- char *tmpformat;
- int number = 0;
- int index = *indexPointer;
-
- number = (int)trio_to_long(&format[index], &tmpformat, BASE_DECIMAL);
- index = (int)(tmpformat - format);
- if ((number != 0) && (QUALIFIER_POSITION == format[index++]))
- {
- *indexPointer = index;
- /*
- * number is decreased by 1, because n$ starts from 1, whereas
- * the array it is indexing starts from 0.
- */
- return number - 1;
- }
-#endif
- return NO_POSITION;
-}
-
-#if TRIO_EXTENSION
-/*************************************************************************
- * TrioFindNamespace
- *
- * Find registered user-defined specifier.
- * The prev argument is used for optimization only.
- */
-TRIO_PRIVATE trio_userdef_t *
-TrioFindNamespace
-TRIO_ARGS2((name, prev),
- TRIO_CONST char *name,
- trio_userdef_t **prev)
-{
- trio_userdef_t *def;
-
- if (internalEnterCriticalRegion)
- (void)internalEnterCriticalRegion(NULL);
-
- for (def = internalUserDef; def; def = def->next)
- {
- /* Case-sensitive string comparison */
- if (trio_equal_case(def->name, name))
- break;
-
- if (prev)
- *prev = def;
- }
-
- if (internalLeaveCriticalRegion)
- (void)internalLeaveCriticalRegion(NULL);
-
- return def;
-}
-#endif
-
-/*************************************************************************
- * TrioPower
- *
- * Description:
- * Calculate pow(base, exponent), where number and exponent are integers.
- */
-TRIO_PRIVATE trio_long_double_t
-TrioPower
-TRIO_ARGS2((number, exponent),
- int number,
- int exponent)
-{
- trio_long_double_t result;
-
- if (number == 10)
- {
- switch (exponent)
- {
- /* Speed up calculation of common cases */
- case 0:
- result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E-1);
- break;
- case 1:
- result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+0);
- break;
- case 2:
- result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+1);
- break;
- case 3:
- result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+2);
- break;
- case 4:
- result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+3);
- break;
- case 5:
- result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+4);
- break;
- case 6:
- result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+5);
- break;
- case 7:
- result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+6);
- break;
- case 8:
- result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+7);
- break;
- case 9:
- result = (trio_long_double_t)number * TRIO_SUFFIX_LONG(1E+8);
- break;
- default:
- result = powl((trio_long_double_t)number,
- (trio_long_double_t)exponent);
- break;
- }
- }
- else
- {
- return powl((trio_long_double_t)number, (trio_long_double_t)exponent);
- }
- return result;
-}
-
-/*************************************************************************
- * TrioLogarithm
- */
-TRIO_PRIVATE double
-TrioLogarithm
-TRIO_ARGS2((number, base),
- double number,
- int base)
-{
- double result;
-
- if (number <= 0.0)
- {
- /* xlC crashes on log(0) */
- result = (number == 0.0) ? trio_ninf() : trio_nan();
- }
- else
- {
- if (base == 10)
- {
- result = log10(number);
- }
- else
- {
- result = log10(number) / log10((double)base);
- }
- }
- return result;
-}
-
-/*************************************************************************
- * TrioLogarithmBase
- */
-TRIO_PRIVATE double
-TrioLogarithmBase
-TRIO_ARGS1((base),
- int base)
-{
- switch (base)
- {
- case BASE_BINARY : return 1.0;
- case BASE_OCTAL : return 3.0;
- case BASE_DECIMAL: return 3.321928094887362345;
- case BASE_HEX : return 4.0;
- default : return TrioLogarithm((double)base, 2);
- }
-}
-
-/*************************************************************************
- * TrioParse
- *
- * Description:
- * Parse the format string
- */
-TRIO_PRIVATE int
-TrioParse
-TRIO_ARGS5((type, format, parameters, arglist, argarray),
- int type,
- TRIO_CONST char *format,
- trio_parameter_t *parameters,
- va_list *arglist,
- trio_pointer_t *argarray)
-{
- /* Count the number of times a parameter is referenced */
- unsigned short usedEntries[MAX_PARAMETERS];
- /* Parameter counters */
- int parameterPosition;
- int currentParam;
- int maxParam = -1;
- /* Utility variables */
- unsigned long flags;
- int width;
- int precision;
- int varsize;
- int base;
- int index; /* Index into formatting string */
- int dots; /* Count number of dots in modifier part */
- BOOLEAN_T positional; /* Does the specifier have a positional? */
- BOOLEAN_T gotSticky = FALSE; /* Are there any sticky modifiers at all? */
- /*
- * indices specifies the order in which the parameters must be
- * read from the va_args (this is necessary to handle positionals)
- */
- int indices[MAX_PARAMETERS];
- int pos = 0;
- /* Various variables */
- char ch;
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- int charlen;
-#endif
- int save_errno;
- int i = -1;
- int num;
- char *tmpformat;
-
- /* One and only one of arglist and argarray must be used */
- assert((arglist != NULL) ^ (argarray != NULL));
-
- /*
- * The 'parameters' array is not initialized, but we need to
- * know which entries we have used.
- */
- memset(usedEntries, 0, sizeof(usedEntries));
-
- save_errno = errno;
- index = 0;
- parameterPosition = 0;
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- (void)mblen(NULL, 0);
-#endif
-
- while (format[index])
- {
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- if (! isascii(format[index]))
- {
- /*
- * Multibyte characters cannot be legal specifiers or
- * modifiers, so we skip over them.
- */
- charlen = mblen(&format[index], MB_LEN_MAX);
- index += (charlen > 0) ? charlen : 1;
- continue; /* while */
- }
-#endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */
- if (CHAR_IDENTIFIER == format[index++])
- {
- if (CHAR_IDENTIFIER == format[index])
- {
- index++;
- continue; /* while */
- }
-
- flags = FLAGS_NEW;
- dots = 0;
- currentParam = TrioGetPosition(format, &index);
- positional = (NO_POSITION != currentParam);
- if (!positional)
- {
- /* We have no positional, get the next counter */
- currentParam = parameterPosition;
- }
- if(currentParam >= MAX_PARAMETERS)
- {
- /* Bail out completely to make the error more obvious */
- return TRIO_ERROR_RETURN(TRIO_ETOOMANY, index);
- }
-
- if (currentParam > maxParam)
- maxParam = currentParam;
-
- /* Default values */
- width = NO_WIDTH;
- precision = NO_PRECISION;
- base = NO_BASE;
- varsize = NO_SIZE;
-
- while (TrioIsQualifier(format[index]))
- {
- ch = format[index++];
-
- switch (ch)
- {
- case QUALIFIER_SPACE:
- flags |= FLAGS_SPACE;
- break;
-
- case QUALIFIER_PLUS:
- flags |= FLAGS_SHOWSIGN;
- break;
-
- case QUALIFIER_MINUS:
- flags |= FLAGS_LEFTADJUST;
- flags &= ~FLAGS_NILPADDING;
- break;
-
- case QUALIFIER_ALTERNATIVE:
- flags |= FLAGS_ALTERNATIVE;
- break;
-
- case QUALIFIER_DOT:
- if (dots == 0) /* Precision */
- {
- dots++;
-
- /* Skip if no precision */
- if (QUALIFIER_DOT == format[index])
- break;
-
- /* After the first dot we have the precision */
- flags |= FLAGS_PRECISION;
- if ((QUALIFIER_STAR == format[index])
-#if defined(QUALIFIER_PARAM)
- || (QUALIFIER_PARAM == format[index])
-#endif
- )
- {
- index++;
- flags |= FLAGS_PRECISION_PARAMETER;
-
- precision = TrioGetPosition(format, &index);
- if (precision == NO_POSITION)
- {
- parameterPosition++;
- if (positional)
- precision = parameterPosition;
- else
- {
- precision = currentParam;
- currentParam = precision + 1;
- }
- }
- else
- {
- if (! positional)
- currentParam = precision + 1;
- if (width > maxParam)
- maxParam = precision;
- }
- if (currentParam > maxParam)
- maxParam = currentParam;
- }
- else
- {
- precision = trio_to_long(&format[index],
- &tmpformat,
- BASE_DECIMAL);
- index = (int)(tmpformat - format);
- }
- }
- else if (dots == 1) /* Base */
- {
- dots++;
-
- /* After the second dot we have the base */
- flags |= FLAGS_BASE;
- if ((QUALIFIER_STAR == format[index])
-#if defined(QUALIFIER_PARAM)
- || (QUALIFIER_PARAM == format[index])
-#endif
- )
- {
- index++;
- flags |= FLAGS_BASE_PARAMETER;
- base = TrioGetPosition(format, &index);
- if (base == NO_POSITION)
- {
- parameterPosition++;
- if (positional)
- base = parameterPosition;
- else
- {
- base = currentParam;
- currentParam = base + 1;
- }
- }
- else
- {
- if (! positional)
- currentParam = base + 1;
- if (base > maxParam)
- maxParam = base;
- }
- if (currentParam > maxParam)
- maxParam = currentParam;
- }
- else
- {
- base = trio_to_long(&format[index],
- &tmpformat,
- BASE_DECIMAL);
- if (base > MAX_BASE)
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- index = (int)(tmpformat - format);
- }
- }
- else
- {
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- }
- break; /* QUALIFIER_DOT */
-
-#if defined(QUALIFIER_PARAM)
- case QUALIFIER_PARAM:
- type = TYPE_PRINT;
- /* FALLTHROUGH */
-#endif
- case QUALIFIER_STAR:
- /* This has different meanings for print and scan */
- if (TYPE_PRINT == type)
- {
- /* Read with from parameter */
- flags |= (FLAGS_WIDTH | FLAGS_WIDTH_PARAMETER);
- width = TrioGetPosition(format, &index);
- if (width == NO_POSITION)
- {
- parameterPosition++;
- if (positional)
- width = parameterPosition;
- else
- {
- width = currentParam;
- currentParam = width + 1;
- }
- }
- else
- {
- if (! positional)
- currentParam = width + 1;
- if (width > maxParam)
- maxParam = width;
- }
- if (currentParam > maxParam)
- maxParam = currentParam;
- }
- else
- {
- /* Scan, but do not store result */
- flags |= FLAGS_IGNORE;
- }
-
- break; /* QUALIFIER_STAR */
-
- case '0':
- if (! (flags & FLAGS_LEFTADJUST))
- flags |= FLAGS_NILPADDING;
- /* FALLTHROUGH */
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- flags |= FLAGS_WIDTH;
- /* &format[index - 1] is used to "rewind" the read
- * character from format
- */
- width = trio_to_long(&format[index - 1],
- &tmpformat,
- BASE_DECIMAL);
- index = (int)(tmpformat - format);
- break;
-
- case QUALIFIER_SHORT:
- if (flags & FLAGS_SHORTSHORT)
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- else if (flags & FLAGS_SHORT)
- flags |= FLAGS_SHORTSHORT;
- else
- flags |= FLAGS_SHORT;
- break;
-
- case QUALIFIER_LONG:
- if (flags & FLAGS_QUAD)
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- else if (flags & FLAGS_LONG)
- flags |= FLAGS_QUAD;
- else
- flags |= FLAGS_LONG;
- break;
-
- case QUALIFIER_LONG_UPPER:
- flags |= FLAGS_LONGDOUBLE;
- break;
-
-#if defined(QUALIFIER_SIZE_T)
- case QUALIFIER_SIZE_T:
- flags |= FLAGS_SIZE_T;
- /* Modify flags for later truncation of number */
- if (sizeof(size_t) == sizeof(trio_ulonglong_t))
- flags |= FLAGS_QUAD;
- else if (sizeof(size_t) == sizeof(long))
- flags |= FLAGS_LONG;
- break;
-#endif
-
-#if defined(QUALIFIER_PTRDIFF_T)
- case QUALIFIER_PTRDIFF_T:
- flags |= FLAGS_PTRDIFF_T;
- if (sizeof(ptrdiff_t) == sizeof(trio_ulonglong_t))
- flags |= FLAGS_QUAD;
- else if (sizeof(ptrdiff_t) == sizeof(long))
- flags |= FLAGS_LONG;
- break;
-#endif
-
-#if defined(QUALIFIER_INTMAX_T)
- case QUALIFIER_INTMAX_T:
- flags |= FLAGS_INTMAX_T;
- if (sizeof(trio_intmax_t) == sizeof(trio_ulonglong_t))
- flags |= FLAGS_QUAD;
- else if (sizeof(trio_intmax_t) == sizeof(long))
- flags |= FLAGS_LONG;
- break;
-#endif
-
-#if defined(QUALIFIER_QUAD)
- case QUALIFIER_QUAD:
- flags |= FLAGS_QUAD;
- break;
-#endif
-
-#if defined(QUALIFIER_FIXED_SIZE)
- case QUALIFIER_FIXED_SIZE:
- if (flags & FLAGS_FIXED_SIZE)
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
-
- if (flags & (FLAGS_ALL_SIZES | FLAGS_LONGDOUBLE |
- FLAGS_WIDECHAR | FLAGS_VARSIZE_PARAMETER))
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
-
- if ((format[index] == '6') &&
- (format[index + 1] == '4'))
- {
- varsize = sizeof(trio_int64_t);
- index += 2;
- }
- else if ((format[index] == '3') &&
- (format[index + 1] == '2'))
- {
- varsize = sizeof(trio_int32_t);
- index += 2;
- }
- else if ((format[index] == '1') &&
- (format[index + 1] == '6'))
- {
- varsize = sizeof(trio_int16_t);
- index += 2;
- }
- else if (format[index] == '8')
- {
- varsize = sizeof(trio_int8_t);
- index++;
- }
- else
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
-
- flags |= FLAGS_FIXED_SIZE;
- break;
-#endif
-
-#if defined(QUALIFIER_WIDECHAR)
- case QUALIFIER_WIDECHAR:
- flags |= FLAGS_WIDECHAR;
- break;
-#endif
-
-#if defined(QUALIFIER_SIZE_T_UPPER)
- case QUALIFIER_SIZE_T_UPPER:
- break;
-#endif
-
-#if defined(QUALIFIER_QUOTE)
- case QUALIFIER_QUOTE:
- flags |= FLAGS_QUOTE;
- break;
-#endif
-
-#if defined(QUALIFIER_STICKY)
- case QUALIFIER_STICKY:
- flags |= FLAGS_STICKY;
- gotSticky = TRUE;
- break;
-#endif
-
-#if defined(QUALIFIER_VARSIZE)
- case QUALIFIER_VARSIZE:
- flags |= FLAGS_VARSIZE_PARAMETER;
- parameterPosition++;
- if (positional)
- varsize = parameterPosition;
- else
- {
- varsize = currentParam;
- currentParam = varsize + 1;
- }
- if (currentParam > maxParam)
- maxParam = currentParam;
- break;
-#endif
-
-#if defined(QUALIFIER_ROUNDING_UPPER)
- case QUALIFIER_ROUNDING_UPPER:
- flags |= FLAGS_ROUNDING;
- break;
-#endif
-
- default:
- /* Bail out completely to make the error more obvious */
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- }
- } /* while qualifier */
-
- /*
- * Parameters only need the type and value. The value is
- * read later.
- */
- if (flags & FLAGS_WIDTH_PARAMETER)
- {
- usedEntries[width] += 1;
- parameters[pos].type = FORMAT_PARAMETER;
- parameters[pos].flags = 0;
- indices[width] = pos;
- width = pos++;
- }
- if (flags & FLAGS_PRECISION_PARAMETER)
- {
- usedEntries[precision] += 1;
- parameters[pos].type = FORMAT_PARAMETER;
- parameters[pos].flags = 0;
- indices[precision] = pos;
- precision = pos++;
- }
- if (flags & FLAGS_BASE_PARAMETER)
- {
- usedEntries[base] += 1;
- parameters[pos].type = FORMAT_PARAMETER;
- parameters[pos].flags = 0;
- indices[base] = pos;
- base = pos++;
- }
- if (flags & FLAGS_VARSIZE_PARAMETER)
- {
- usedEntries[varsize] += 1;
- parameters[pos].type = FORMAT_PARAMETER;
- parameters[pos].flags = 0;
- indices[varsize] = pos;
- varsize = pos++;
- }
-
- indices[currentParam] = pos;
-
- switch (format[index++])
- {
-#if defined(SPECIFIER_CHAR_UPPER)
- case SPECIFIER_CHAR_UPPER:
- flags |= FLAGS_WIDECHAR;
- /* FALLTHROUGH */
-#endif
- case SPECIFIER_CHAR:
- if (flags & FLAGS_LONG)
- flags |= FLAGS_WIDECHAR;
- else if (flags & FLAGS_SHORT)
- flags &= ~FLAGS_WIDECHAR;
- parameters[pos].type = FORMAT_CHAR;
- break;
-
-#if defined(SPECIFIER_STRING_UPPER)
- case SPECIFIER_STRING_UPPER:
- flags |= FLAGS_WIDECHAR;
- /* FALLTHROUGH */
-#endif
- case SPECIFIER_STRING:
- if (flags & FLAGS_LONG)
- flags |= FLAGS_WIDECHAR;
- else if (flags & FLAGS_SHORT)
- flags &= ~FLAGS_WIDECHAR;
- parameters[pos].type = FORMAT_STRING;
- break;
-
- case SPECIFIER_GROUP:
- if (TYPE_SCAN == type)
- {
- int depth = 1;
- parameters[pos].type = FORMAT_GROUP;
- if (format[index] == QUALIFIER_CIRCUMFLEX)
- index++;
- if (format[index] == SPECIFIER_UNGROUP)
- index++;
- if (format[index] == QUALIFIER_MINUS)
- index++;
- /* Skip nested brackets */
- while (format[index] != NIL)
- {
- if (format[index] == SPECIFIER_GROUP)
- {
- depth++;
- }
- else if (format[index] == SPECIFIER_UNGROUP)
- {
- if (--depth <= 0)
- {
- index++;
- break;
- }
- }
- index++;
- }
- }
- break;
-
- case SPECIFIER_INTEGER:
- parameters[pos].type = FORMAT_INT;
- break;
-
- case SPECIFIER_UNSIGNED:
- flags |= FLAGS_UNSIGNED;
- parameters[pos].type = FORMAT_INT;
- break;
-
- case SPECIFIER_DECIMAL:
- /* Disable base modifier */
- flags &= ~FLAGS_BASE_PARAMETER;
- base = BASE_DECIMAL;
- parameters[pos].type = FORMAT_INT;
- break;
-
- case SPECIFIER_OCTAL:
- flags &= ~FLAGS_BASE_PARAMETER;
- base = BASE_OCTAL;
- parameters[pos].type = FORMAT_INT;
- break;
-
-#if defined(SPECIFIER_BINARY)
- case SPECIFIER_BINARY_UPPER:
- flags |= FLAGS_UPPER;
- /* FALLTHROUGH */
- case SPECIFIER_BINARY:
- flags |= FLAGS_NILPADDING;
- flags &= ~FLAGS_BASE_PARAMETER;
- base = BASE_BINARY;
- parameters[pos].type = FORMAT_INT;
- break;
-#endif
-
- case SPECIFIER_HEX_UPPER:
- flags |= FLAGS_UPPER;
- /* FALLTHROUGH */
- case SPECIFIER_HEX:
- flags |= FLAGS_UNSIGNED;
- flags &= ~FLAGS_BASE_PARAMETER;
- base = BASE_HEX;
- parameters[pos].type = FORMAT_INT;
- break;
-
- case SPECIFIER_FLOAT_E_UPPER:
- flags |= FLAGS_UPPER;
- /* FALLTHROUGH */
- case SPECIFIER_FLOAT_E:
- flags |= FLAGS_FLOAT_E;
- parameters[pos].type = FORMAT_DOUBLE;
- break;
-
- case SPECIFIER_FLOAT_G_UPPER:
- flags |= FLAGS_UPPER;
- /* FALLTHROUGH */
- case SPECIFIER_FLOAT_G:
- flags |= FLAGS_FLOAT_G;
- parameters[pos].type = FORMAT_DOUBLE;
- break;
-
- case SPECIFIER_FLOAT_F_UPPER:
- flags |= FLAGS_UPPER;
- /* FALLTHROUGH */
- case SPECIFIER_FLOAT_F:
- parameters[pos].type = FORMAT_DOUBLE;
- break;
-
- case SPECIFIER_POINTER:
- if (sizeof(trio_pointer_t) == sizeof(trio_ulonglong_t))
- flags |= FLAGS_QUAD;
- else if (sizeof(trio_pointer_t) == sizeof(long))
- flags |= FLAGS_LONG;
- parameters[pos].type = FORMAT_POINTER;
- break;
-
- case SPECIFIER_COUNT:
- parameters[pos].type = FORMAT_COUNT;
- break;
-
-#if defined(SPECIFIER_HEXFLOAT)
-# if defined(SPECIFIER_HEXFLOAT_UPPER)
- case SPECIFIER_HEXFLOAT_UPPER:
- flags |= FLAGS_UPPER;
- /* FALLTHROUGH */
-# endif
- case SPECIFIER_HEXFLOAT:
- base = BASE_HEX;
- parameters[pos].type = FORMAT_DOUBLE;
- break;
-#endif
-
-#if defined(FORMAT_ERRNO)
- case SPECIFIER_ERRNO:
- parameters[pos].type = FORMAT_ERRNO;
- break;
-#endif
-
-#if defined(SPECIFIER_USER_DEFINED_BEGIN)
- case SPECIFIER_USER_DEFINED_BEGIN:
- {
- unsigned int max;
- int without_namespace = TRUE;
-
- parameters[pos].type = FORMAT_USER_DEFINED;
- parameters[pos].user_name[0] = NIL;
- tmpformat = (char *)&format[index];
-
- while ((ch = format[index]))
- {
- index++;
- if (ch == SPECIFIER_USER_DEFINED_END)
- {
- if (without_namespace)
- {
- /* We must get the handle first */
- parameters[pos].type = FORMAT_PARAMETER;
- parameters[pos].indexAfterSpecifier = index;
- parameters[pos].flags = FLAGS_USER_DEFINED;
- /* Adjust parameters for insertion of new one */
- pos++;
- usedEntries[currentParam] += 1;
- parameters[pos].type = FORMAT_USER_DEFINED;
- currentParam++;
- indices[currentParam] = pos;
- if (currentParam > maxParam)
- maxParam = currentParam;
- }
- /* Copy the user data */
- max = (unsigned int)(&format[index] - tmpformat);
- if (max > MAX_USER_DATA)
- max = MAX_USER_DATA;
- trio_copy_max(parameters[pos].user_data,
- max,
- tmpformat);
- break; /* while */
- }
- if (ch == SPECIFIER_USER_DEFINED_SEPARATOR)
- {
- without_namespace = FALSE;
- /* Copy the namespace for later looking-up */
- max = (int)(&format[index] - tmpformat);
- if (max > MAX_USER_NAME)
- max = MAX_USER_NAME;
- trio_copy_max(parameters[pos].user_name,
- max,
- tmpformat);
- tmpformat = (char *)&format[index];
- }
- }
- if (ch != SPECIFIER_USER_DEFINED_END)
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- }
- break;
-#endif /* defined(SPECIFIER_USER_DEFINED_BEGIN) */
-
- default:
- /* Bail out completely to make the error more obvious */
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- }
-
- /* Count the number of times this entry has been used */
- usedEntries[currentParam] += 1;
-
- /* Find last sticky parameters */
- if (gotSticky && !(flags & FLAGS_STICKY))
- {
- for (i = pos - 1; i >= 0; i--)
- {
- if (parameters[i].type == FORMAT_PARAMETER)
- continue;
- if ((parameters[i].flags & FLAGS_STICKY) &&
- (parameters[i].type == parameters[pos].type))
- {
- /* Do not overwrite current qualifiers */
- flags |= (parameters[i].flags & (unsigned long)~FLAGS_STICKY);
- if (width == NO_WIDTH)
- width = parameters[i].width;
- if (precision == NO_PRECISION)
- precision = parameters[i].precision;
- if (base == NO_BASE)
- base = parameters[i].base;
- break;
- }
- }
- }
-
- parameters[pos].indexAfterSpecifier = index;
- parameters[pos].flags = flags;
- parameters[pos].width = width;
- parameters[pos].precision = precision;
- parameters[pos].base = (base == NO_BASE) ? BASE_DECIMAL : base;
- parameters[pos].varsize = varsize;
- pos++;
-
- if (! positional)
- parameterPosition++;
-
- } /* if identifier */
-
- } /* while format characters left */
-
- for (num = 0; num <= maxParam; num++)
- {
- if (usedEntries[num] != 1)
- {
- if (usedEntries[num] == 0) /* gap detected */
- return TRIO_ERROR_RETURN(TRIO_EGAP, num);
- else /* double references detected */
- return TRIO_ERROR_RETURN(TRIO_EDBLREF, num);
- }
-
- i = indices[num];
-
- /*
- * FORMAT_PARAMETERS are only present if they must be read,
- * so it makes no sense to check the ignore flag (besides,
- * the flags variable is not set for that particular type)
- */
- if ((parameters[i].type != FORMAT_PARAMETER) &&
- (parameters[i].flags & FLAGS_IGNORE))
- continue; /* for all arguments */
-
- /*
- * The stack arguments are read according to ANSI C89
- * default argument promotions:
- *
- * char = int
- * short = int
- * unsigned char = unsigned int
- * unsigned short = unsigned int
- * float = double
- *
- * In addition to the ANSI C89 these types are read (the
- * default argument promotions of C99 has not been
- * considered yet)
- *
- * long long
- * long double
- * size_t
- * ptrdiff_t
- * intmax_t
- */
- switch (parameters[i].type)
- {
- case FORMAT_GROUP:
- case FORMAT_STRING:
-#if TRIO_WIDECHAR
- if (flags & FLAGS_WIDECHAR)
- {
- parameters[i].data.wstring = (argarray == NULL)
- ? va_arg(*arglist, trio_wchar_t *)
- : (trio_wchar_t *)(argarray[num]);
- }
- else
-#endif
- {
- parameters[i].data.string = (argarray == NULL)
- ? va_arg(*arglist, char *)
- : (char *)(argarray[num]);
- }
- break;
-
-#if defined(FORMAT_USER_DEFINED)
- case FORMAT_USER_DEFINED:
-#endif
- case FORMAT_POINTER:
- case FORMAT_COUNT:
- case FORMAT_UNKNOWN:
- parameters[i].data.pointer = (argarray == NULL)
- ? va_arg(*arglist, trio_pointer_t )
- : argarray[num];
- break;
-
- case FORMAT_CHAR:
- case FORMAT_INT:
- if (TYPE_SCAN == type)
- {
- if (argarray == NULL)
- parameters[i].data.pointer =
- (trio_pointer_t)va_arg(*arglist, trio_pointer_t);
- else
- {
- if (parameters[i].type == FORMAT_CHAR)
- parameters[i].data.pointer =
- (trio_pointer_t)((char *)argarray[num]);
- else if (parameters[i].flags & FLAGS_SHORT)
- parameters[i].data.pointer =
- (trio_pointer_t)((short *)argarray[num]);
- else
- parameters[i].data.pointer =
- (trio_pointer_t)((int *)argarray[num]);
- }
- }
- else
- {
-#if defined(QUALIFIER_VARSIZE) || defined(QUALIFIER_FIXED_SIZE)
- if (parameters[i].flags
- & (FLAGS_VARSIZE_PARAMETER | FLAGS_FIXED_SIZE))
- {
- if (parameters[i].flags & FLAGS_VARSIZE_PARAMETER)
- {
- /*
- * Variable sizes are mapped onto the fixed sizes, in
- * accordance with integer promotion.
- *
- * Please note that this may not be portable, as we
- * only guess the size, not the layout of the numbers.
- * For example, if int is little-endian, and long is
- * big-endian, then this will fail.
- */
- varsize = (int)parameters[parameters[i].varsize].data.number.as_unsigned;
- }
- else
- {
- /* Used for the I<bits> modifiers */
- varsize = parameters[i].varsize;
- }
- parameters[i].flags &= ~FLAGS_ALL_VARSIZES;
-
- if (varsize <= (int)sizeof(int))
- ;
- else if (varsize <= (int)sizeof(long))
- parameters[i].flags |= FLAGS_LONG;
-#if defined(QUALIFIER_INTMAX_T)
- else if (varsize <= (int)sizeof(trio_longlong_t))
- parameters[i].flags |= FLAGS_QUAD;
- else
- parameters[i].flags |= FLAGS_INTMAX_T;
-#else
- else
- parameters[i].flags |= FLAGS_QUAD;
-#endif
- }
-#endif /* defined(QUALIFIER_VARSIZE) */
-#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER)
- if (parameters[i].flags & FLAGS_SIZE_T)
- parameters[i].data.number.as_unsigned = (argarray == NULL)
- ? (trio_uintmax_t)va_arg(*arglist, size_t)
- : (trio_uintmax_t)(*((size_t *)argarray[num]));
- else
-#endif
-#if defined(QUALIFIER_PTRDIFF_T)
- if (parameters[i].flags & FLAGS_PTRDIFF_T)
- parameters[i].data.number.as_unsigned = (argarray == NULL)
- ? (trio_uintmax_t)va_arg(*arglist, ptrdiff_t)
- : (trio_uintmax_t)(*((ptrdiff_t *)argarray[num]));
- else
-#endif
-#if defined(QUALIFIER_INTMAX_T)
- if (parameters[i].flags & FLAGS_INTMAX_T)
- parameters[i].data.number.as_unsigned = (argarray == NULL)
- ? (trio_uintmax_t)va_arg(*arglist, trio_intmax_t)
- : (trio_uintmax_t)(*((trio_intmax_t *)argarray[num]));
- else
-#endif
- if (parameters[i].flags & FLAGS_QUAD)
- parameters[i].data.number.as_unsigned = (argarray == NULL)
- ? (trio_uintmax_t)va_arg(*arglist, trio_ulonglong_t)
- : (trio_uintmax_t)(*((trio_ulonglong_t *)argarray[num]));
- else if (parameters[i].flags & FLAGS_LONG)
- parameters[i].data.number.as_unsigned = (argarray == NULL)
- ? (trio_uintmax_t)va_arg(*arglist, long)
- : (trio_uintmax_t)(*((long *)argarray[num]));
- else
- {
- if (argarray == NULL)
- parameters[i].data.number.as_unsigned = (trio_uintmax_t)va_arg(*arglist, int);
- else
- {
- if (parameters[i].type == FORMAT_CHAR)
- parameters[i].data.number.as_unsigned = (trio_uintmax_t)(*((char *)argarray[num]));
- else if (parameters[i].flags & FLAGS_SHORT)
- parameters[i].data.number.as_unsigned = (trio_uintmax_t)(*((short *)argarray[num]));
- else
- parameters[i].data.number.as_unsigned = (trio_uintmax_t)(*((int *)argarray[num]));
- }
- }
- }
- break;
-
- case FORMAT_PARAMETER:
- /*
- * The parameter for the user-defined specifier is a pointer,
- * whereas the rest (width, precision, base) uses an integer.
- */
- if (parameters[i].flags & FLAGS_USER_DEFINED)
- parameters[i].data.pointer = (argarray == NULL)
- ? va_arg(*arglist, trio_pointer_t )
- : argarray[num];
- else
- parameters[i].data.number.as_unsigned = (argarray == NULL)
- ? (trio_uintmax_t)va_arg(*arglist, int)
- : (trio_uintmax_t)(*((int *)argarray[num]));
- break;
-
- case FORMAT_DOUBLE:
- if (TYPE_SCAN == type)
- {
- if (parameters[i].flags & FLAGS_LONGDOUBLE)
- parameters[i].data.longdoublePointer = (argarray == NULL)
- ? va_arg(*arglist, trio_long_double_t *)
- : (trio_long_double_t *)argarray[num];
- else
- {
- if (parameters[i].flags & FLAGS_LONG)
- parameters[i].data.doublePointer = (argarray == NULL)
- ? va_arg(*arglist, double *)
- : (double *)argarray[num];
- else
- parameters[i].data.doublePointer = (argarray == NULL)
- ? (double *)va_arg(*arglist, float *)
- : (double *)((float *)argarray[num]);
- }
- }
- else
- {
- if (parameters[i].flags & FLAGS_LONGDOUBLE)
- parameters[i].data.longdoubleNumber = (argarray == NULL)
- ? va_arg(*arglist, trio_long_double_t)
- : (trio_long_double_t)(*((trio_long_double_t *)argarray[num]));
- else
- {
- if (argarray == NULL)
- parameters[i].data.longdoubleNumber =
- (trio_long_double_t)va_arg(*arglist, double);
- else
- {
- if (parameters[i].flags & FLAGS_SHORT)
- parameters[i].data.longdoubleNumber =
- (trio_long_double_t)(*((float *)argarray[num]));
- else
- parameters[i].data.longdoubleNumber =
- (trio_long_double_t)(*((double *)argarray[num]));
- }
- }
- }
- break;
-
-#if defined(FORMAT_ERRNO)
- case FORMAT_ERRNO:
- parameters[i].data.errorNumber = save_errno;
- break;
-#endif
-
- default:
- break;
- }
- } /* for all specifiers */
- return num;
-}
-
-
-/*************************************************************************
- *
- * FORMATTING
- *
- ************************************************************************/
-
-
-/*************************************************************************
- * TrioWriteNumber
- *
- * Description:
- * Output a number.
- * The complexity of this function is a result of the complexity
- * of the dependencies of the flags.
- */
-TRIO_PRIVATE void
-TrioWriteNumber
-TRIO_ARGS6((self, number, flags, width, precision, base),
- trio_class_t *self,
- trio_uintmax_t number,
- unsigned long flags,
- int width,
- int precision,
- int base)
-{
- BOOLEAN_T isNegative;
- char buffer[MAX_CHARS_IN(trio_uintmax_t) * (1 + MAX_LOCALE_SEPARATOR_LENGTH) + 1];
- char *bufferend;
- char *pointer;
- TRIO_CONST char *digits;
- int i;
- int length;
- char *p;
- int count;
-
- assert(VALID(self));
- assert(VALID(self->OutStream));
- assert(((base >= MIN_BASE) && (base <= MAX_BASE)) || (base == NO_BASE));
-
- digits = (flags & FLAGS_UPPER) ? internalDigitsUpper : internalDigitsLower;
- if (base == NO_BASE)
- base = BASE_DECIMAL;
-
- isNegative = (flags & FLAGS_UNSIGNED)
- ? FALSE
- : ((trio_intmax_t)number < 0);
- if (isNegative)
- number = -((trio_intmax_t)number);
-
- if (flags & FLAGS_QUAD)
- number &= (trio_ulonglong_t)-1;
- else if (flags & FLAGS_LONG)
- number &= (unsigned long)-1;
- else
- number &= (unsigned int)-1;
-
- /* Build number */
- pointer = bufferend = &buffer[sizeof(buffer) - 1];
- *pointer-- = NIL;
- for (i = 1; i < (int)sizeof(buffer); i++)
- {
- *pointer-- = digits[number % base];
- number /= base;
- if (number == 0)
- break;
-
- if ((flags & FLAGS_QUOTE) && TrioFollowedBySeparator(i + 1))
- {
- /*
- * We are building the number from the least significant
- * to the most significant digit, so we have to copy the
- * thousand separator backwards
- */
- length = internalThousandSeparatorLength;
- if (((int)(pointer - buffer) - length) > 0)
- {
- p = &internalThousandSeparator[length - 1];
- while (length-- > 0)
- *pointer-- = *p--;
- }
- }
- }
-
- /* Adjust width */
- width -= (bufferend - pointer) - 1;
-
- /* Adjust precision */
- if (NO_PRECISION != precision)
- {
- precision -= (bufferend - pointer) - 1;
- if (precision < 0)
- precision = 0;
- flags |= FLAGS_NILPADDING;
- }
-
- /* Adjust width further */
- if (isNegative || (flags & FLAGS_SHOWSIGN) || (flags & FLAGS_SPACE))
- width--;
- if (flags & FLAGS_ALTERNATIVE)
- {
- switch (base)
- {
- case BASE_BINARY:
- case BASE_HEX:
- width -= 2;
- break;
- case BASE_OCTAL:
- width--;
- break;
- default:
- break;
- }
- }
-
- /* Output prefixes spaces if needed */
- if (! ((flags & FLAGS_LEFTADJUST) ||
- ((flags & FLAGS_NILPADDING) && (precision == NO_PRECISION))))
- {
- count = (precision == NO_PRECISION) ? 0 : precision;
- while (width-- > count)
- self->OutStream(self, CHAR_ADJUST);
- }
-
- /* width has been adjusted for signs and alternatives */
- if (isNegative)
- self->OutStream(self, '-');
- else if (flags & FLAGS_SHOWSIGN)
- self->OutStream(self, '+');
- else if (flags & FLAGS_SPACE)
- self->OutStream(self, ' ');
-
- if (flags & FLAGS_ALTERNATIVE)
- {
- switch (base)
- {
- case BASE_BINARY:
- self->OutStream(self, '0');
- self->OutStream(self, (flags & FLAGS_UPPER) ? 'B' : 'b');
- break;
-
- case BASE_OCTAL:
- self->OutStream(self, '0');
- break;
-
- case BASE_HEX:
- self->OutStream(self, '0');
- self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x');
- break;
-
- default:
- break;
- } /* switch base */
- }
-
- /* Output prefixed zero padding if needed */
- if (flags & FLAGS_NILPADDING)
- {
- if (precision == NO_PRECISION)
- precision = width;
- while (precision-- > 0)
- {
- self->OutStream(self, '0');
- width--;
- }
- }
-
- /* Output the number itself */
- while (*(++pointer))
- {
- self->OutStream(self, *pointer);
- }
-
- /* Output trailing spaces if needed */
- if (flags & FLAGS_LEFTADJUST)
- {
- while (width-- > 0)
- self->OutStream(self, CHAR_ADJUST);
- }
-}
-
-/*************************************************************************
- * TrioWriteStringCharacter
- *
- * Description:
- * Output a single character of a string
- */
-TRIO_PRIVATE void
-TrioWriteStringCharacter
-TRIO_ARGS3((self, ch, flags),
- trio_class_t *self,
- int ch,
- unsigned long flags)
-{
- if (flags & FLAGS_ALTERNATIVE)
- {
- if (! isprint(ch))
- {
- /*
- * Non-printable characters are converted to C escapes or
- * \number, if no C escape exists.
- */
- self->OutStream(self, CHAR_BACKSLASH);
- switch (ch)
- {
- case '\007': self->OutStream(self, 'a'); break;
- case '\b': self->OutStream(self, 'b'); break;
- case '\f': self->OutStream(self, 'f'); break;
- case '\n': self->OutStream(self, 'n'); break;
- case '\r': self->OutStream(self, 'r'); break;
- case '\t': self->OutStream(self, 't'); break;
- case '\v': self->OutStream(self, 'v'); break;
- case '\\': self->OutStream(self, '\\'); break;
- default:
- self->OutStream(self, 'x');
- TrioWriteNumber(self, (trio_uintmax_t)ch,
- FLAGS_UNSIGNED | FLAGS_NILPADDING,
- 2, 2, BASE_HEX);
- break;
- }
- }
- else if (ch == CHAR_BACKSLASH)
- {
- self->OutStream(self, CHAR_BACKSLASH);
- self->OutStream(self, CHAR_BACKSLASH);
- }
- else
- {
- self->OutStream(self, ch);
- }
- }
- else
- {
- self->OutStream(self, ch);
- }
-}
-
-/*************************************************************************
- * TrioWriteString
- *
- * Description:
- * Output a string
- */
-TRIO_PRIVATE void
-TrioWriteString
-TRIO_ARGS5((self, string, flags, width, precision),
- trio_class_t *self,
- TRIO_CONST char *string,
- unsigned long flags,
- int width,
- int precision)
-{
- int length;
- int ch;
-
- assert(VALID(self));
- assert(VALID(self->OutStream));
-
- if (string == NULL)
- {
- string = internalNullString;
- length = sizeof(internalNullString) - 1;
- /* Disable quoting for the null pointer */
- flags &= (~FLAGS_QUOTE);
- width = 0;
- }
- else
- {
- length = trio_length(string);
- }
- if ((NO_PRECISION != precision) &&
- (precision < length))
- {
- length = precision;
- }
- width -= length;
-
- if (flags & FLAGS_QUOTE)
- self->OutStream(self, CHAR_QUOTE);
-
- if (! (flags & FLAGS_LEFTADJUST))
- {
- while (width-- > 0)
- self->OutStream(self, CHAR_ADJUST);
- }
-
- while (length-- > 0)
- {
- /* The ctype parameters must be an unsigned char (or EOF) */
- ch = (int)((unsigned char)(*string++));
- TrioWriteStringCharacter(self, ch, flags);
- }
-
- if (flags & FLAGS_LEFTADJUST)
- {
- while (width-- > 0)
- self->OutStream(self, CHAR_ADJUST);
- }
- if (flags & FLAGS_QUOTE)
- self->OutStream(self, CHAR_QUOTE);
-}
-
-/*************************************************************************
- * TrioWriteWideStringCharacter
- *
- * Description:
- * Output a wide string as a multi-byte sequence
- */
-#if TRIO_WIDECHAR
-TRIO_PRIVATE int
-TrioWriteWideStringCharacter
-TRIO_ARGS4((self, wch, flags, width),
- trio_class_t *self,
- trio_wchar_t wch,
- unsigned long flags,
- int width)
-{
- int size;
- int i;
- int ch;
- char *string;
- char buffer[MB_LEN_MAX + 1];
-
- if (width == NO_WIDTH)
- width = sizeof(buffer);
-
- size = wctomb(buffer, wch);
- if ((size <= 0) || (size > width) || (buffer[0] == NIL))
- return 0;
-
- string = buffer;
- i = size;
- while ((width >= i) && (width-- > 0) && (i-- > 0))
- {
- /* The ctype parameters must be an unsigned char (or EOF) */
- ch = (int)((unsigned char)(*string++));
- TrioWriteStringCharacter(self, ch, flags);
- }
- return size;
-}
-#endif /* TRIO_WIDECHAR */
-
-/*************************************************************************
- * TrioWriteWideString
- *
- * Description:
- * Output a wide character string as a multi-byte string
- */
-#if TRIO_WIDECHAR
-TRIO_PRIVATE void
-TrioWriteWideString
-TRIO_ARGS5((self, wstring, flags, width, precision),
- trio_class_t *self,
- TRIO_CONST trio_wchar_t *wstring,
- unsigned long flags,
- int width,
- int precision)
-{
- int length;
- int size;
-
- assert(VALID(self));
- assert(VALID(self->OutStream));
-
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- (void)mblen(NULL, 0);
-#endif
-
- if (wstring == NULL)
- {
- TrioWriteString(self, NULL, flags, width, precision);
- return;
- }
-
- if (NO_PRECISION == precision)
- {
- length = INT_MAX;
- }
- else
- {
- length = precision;
- width -= length;
- }
-
- if (flags & FLAGS_QUOTE)
- self->OutStream(self, CHAR_QUOTE);
-
- if (! (flags & FLAGS_LEFTADJUST))
- {
- while (width-- > 0)
- self->OutStream(self, CHAR_ADJUST);
- }
-
- while (length > 0)
- {
- size = TrioWriteWideStringCharacter(self, *wstring++, flags, length);
- if (size == 0)
- break; /* while */
- length -= size;
- }
-
- if (flags & FLAGS_LEFTADJUST)
- {
- while (width-- > 0)
- self->OutStream(self, CHAR_ADJUST);
- }
- if (flags & FLAGS_QUOTE)
- self->OutStream(self, CHAR_QUOTE);
-}
-#endif /* TRIO_WIDECHAR */
-
-/*************************************************************************
- * TrioWriteDouble
- *
- * http://wwwold.dkuug.dk/JTC1/SC22/WG14/www/docs/dr_211.htm
- *
- * "5.2.4.2.2 paragraph #4
- *
- * The accuracy [...] is implementation defined, as is the accuracy
- * of the conversion between floating-point internal representations
- * and string representations performed by the libray routine in
- * <stdio.h>"
- */
-/* FIXME: handle all instances of constant long-double number (L)
- * and *l() math functions.
- */
-TRIO_PRIVATE void
-TrioWriteDouble
-TRIO_ARGS6((self, number, flags, width, precision, base),
- trio_class_t *self,
- trio_long_double_t number,
- unsigned long flags,
- int width,
- int precision,
- int base)
-{
- trio_long_double_t integerNumber;
- trio_long_double_t fractionNumber;
- trio_long_double_t workNumber;
- int integerDigits;
- int fractionDigits;
- int exponentDigits;
- int baseDigits;
- int integerThreshold;
- int fractionThreshold;
- int expectedWidth;
- int exponent = 0;
- unsigned int uExponent = 0;
- int exponentBase;
- trio_long_double_t dblBase;
- trio_long_double_t dblIntegerBase;
- trio_long_double_t dblFractionBase;
- trio_long_double_t integerAdjust;
- trio_long_double_t fractionAdjust;
- BOOLEAN_T isNegative;
- BOOLEAN_T isExponentNegative = FALSE;
- BOOLEAN_T requireTwoDigitExponent;
- BOOLEAN_T isHex;
- TRIO_CONST char *digits;
- char *groupingPointer;
- int i;
- int index;
- BOOLEAN_T hasOnlyZeroes;
- int zeroes = 0;
- register int trailingZeroes;
- BOOLEAN_T keepTrailingZeroes;
- BOOLEAN_T keepDecimalPoint;
- trio_long_double_t epsilon;
-
- assert(VALID(self));
- assert(VALID(self->OutStream));
- assert(((base >= MIN_BASE) && (base <= MAX_BASE)) || (base == NO_BASE));
-
- /* Determine sign and look for special quantities */
- switch (trio_fpclassify_and_signbit(number, &isNegative))
- {
- case TRIO_FP_NAN:
- TrioWriteString(self,
- (flags & FLAGS_UPPER)
- ? NAN_UPPER
- : NAN_LOWER,
- flags, width, precision);
- return;
-
- case TRIO_FP_INFINITE:
- if (isNegative)
- {
- /* Negative infinity */
- TrioWriteString(self,
- (flags & FLAGS_UPPER)
- ? "-" INFINITE_UPPER
- : "-" INFINITE_LOWER,
- flags, width, precision);
- return;
- }
- else
- {
- /* Positive infinity */
- TrioWriteString(self,
- (flags & FLAGS_UPPER)
- ? INFINITE_UPPER
- : INFINITE_LOWER,
- flags, width, precision);
- return;
- }
-
- default:
- /* Finitude */
- break;
- }
-
- /* Normal numbers */
- if (flags & FLAGS_LONGDOUBLE)
- {
- baseDigits = (base == 10)
- ? LDBL_DIG
- : (int)floor(LDBL_MANT_DIG / TrioLogarithmBase(base));
- epsilon = LDBL_EPSILON;
- }
- else if (flags & FLAGS_SHORT)
- {
- baseDigits = (base == BASE_DECIMAL)
- ? FLT_DIG
- : (int)floor(FLT_MANT_DIG / TrioLogarithmBase(base));
- epsilon = FLT_EPSILON;
- }
- else
- {
- baseDigits = (base == BASE_DECIMAL)
- ? DBL_DIG
- : (int)floor(DBL_MANT_DIG / TrioLogarithmBase(base));
- epsilon = DBL_EPSILON;
- }
-
- digits = (flags & FLAGS_UPPER) ? internalDigitsUpper : internalDigitsLower;
- isHex = (base == BASE_HEX);
- if (base == NO_BASE)
- base = BASE_DECIMAL;
- dblBase = (trio_long_double_t)base;
- keepTrailingZeroes = !( (flags & FLAGS_ROUNDING) ||
- ( (flags & FLAGS_FLOAT_G) &&
- !(flags & FLAGS_ALTERNATIVE) ) );
-
- if (flags & FLAGS_ROUNDING)
- precision = baseDigits;
-
- if (precision == NO_PRECISION)
- precision = FLT_DIG;
-
- if (isNegative)
- number = -number;
-
- if (isHex)
- flags |= FLAGS_FLOAT_E;
-
- if (flags & FLAGS_FLOAT_G)
- {
- if (precision == 0)
- precision = 1;
-
- if ((number < 1.0E-4) || (number > powl(base,
- (trio_long_double_t)precision)))
- {
- /* Use scientific notation */
- flags |= FLAGS_FLOAT_E;
- }
- else if (number < 1.0)
- {
- /*
- * Use normal notation. If the integer part of the number is
- * zero, then adjust the precision to include leading fractional
- * zeros.
- */
- workNumber = TrioLogarithm(number, base);
- workNumber = TRIO_FABS(workNumber);
- if (workNumber - floorl(workNumber) < 0.001)
- workNumber--;
- zeroes = (int)floorl(workNumber);
- }
- }
-
- if (flags & FLAGS_FLOAT_E)
- {
- /* Scale the number */
- workNumber = TrioLogarithm(number, base);
- if (trio_isinf(workNumber) == -1)
- {
- exponent = 0;
- /* Undo setting */
- if (flags & FLAGS_FLOAT_G)
- flags &= ~FLAGS_FLOAT_E;
- }
- else
- {
- exponent = (int)floorl(workNumber);
- number /= powl(dblBase, (trio_long_double_t)exponent);
- isExponentNegative = (exponent < 0);
- uExponent = (isExponentNegative) ? -exponent : exponent;
- /* No thousand separators */
- flags &= ~FLAGS_QUOTE;
- }
- }
-
- integerNumber = floorl(number);
- fractionNumber = number - integerNumber;
-
- /*
- * Truncated number.
- *
- * Precision is number of significant digits for FLOAT_G
- * and number of fractional digits for others.
- */
- integerDigits = (integerNumber > epsilon)
- ? 1 + (int)TrioLogarithm(integerNumber, base)
- : 1;
- fractionDigits = ((flags & FLAGS_FLOAT_G) && (zeroes == 0))
- ? precision - integerDigits
- : zeroes + precision;
-
- dblFractionBase = TrioPower(base, fractionDigits);
-
- workNumber = number + 0.5 / dblFractionBase;
- if (floorl(number) != floorl(workNumber))
- {
- if (flags & FLAGS_FLOAT_E)
- {
- /* Adjust if number was rounded up one digit (ie. 0.99 to 1.00) */
- exponent++;
- isExponentNegative = (exponent < 0);
- uExponent = (isExponentNegative) ? -exponent : exponent;
- workNumber = (number + 0.5 / dblFractionBase) / dblBase;
- integerNumber = floorl(workNumber);
- fractionNumber = workNumber - integerNumber;
- }
- else
- {
- /* Adjust if number was rounded up one digit (ie. 99 to 100) */
- integerNumber = floorl(number + 0.5);
- fractionNumber = 0.0;
- integerDigits = (integerNumber > epsilon)
- ? 1 + (int)TrioLogarithm(integerNumber, base)
- : 1;
- }
- }
-
- /* Estimate accuracy */
- integerAdjust = fractionAdjust = 0.5;
- if (flags & FLAGS_ROUNDING)
- {
- if (integerDigits > baseDigits)
- {
- integerThreshold = baseDigits;
- fractionDigits = 0;
- dblFractionBase = 1.0;
- fractionThreshold = 0;
- precision = 0; /* Disable decimal-point */
- integerAdjust = TrioPower(base, integerDigits - integerThreshold - 1);
- fractionAdjust = 0.0;
- }
- else
- {
- integerThreshold = integerDigits;
- fractionThreshold = fractionDigits - integerThreshold;
- fractionAdjust = 1.0;
- }
- }
- else
- {
- integerThreshold = INT_MAX;
- fractionThreshold = INT_MAX;
- }
-
- /*
- * Calculate expected width.
- * sign + integer part + thousands separators + decimal point
- * + fraction + exponent
- */
- fractionAdjust /= dblFractionBase;
- hasOnlyZeroes = (floorl((fractionNumber + fractionAdjust) * dblFractionBase) < epsilon);
- keepDecimalPoint = ( (flags & FLAGS_ALTERNATIVE) ||
- !((precision == 0) ||
- (!keepTrailingZeroes && hasOnlyZeroes)) );
- if (flags & FLAGS_FLOAT_E)
- {
- exponentDigits = (uExponent == 0)
- ? 1
- : (int)ceil(TrioLogarithm((double)(uExponent + 1), base));
- }
- else
- exponentDigits = 0;
- requireTwoDigitExponent = ((base == BASE_DECIMAL) && (exponentDigits == 1));
-
- expectedWidth = integerDigits + fractionDigits
- + (keepDecimalPoint
- ? internalDecimalPointLength
- : 0)
- + ((flags & FLAGS_QUOTE)
- ? TrioCalcThousandSeparatorLength(integerDigits)
- : 0);
- if (isNegative || (flags & FLAGS_SHOWSIGN) || (flags & FLAGS_SPACE))
- expectedWidth += sizeof("-") - 1;
- if (exponentDigits > 0)
- expectedWidth += exponentDigits +
- ((requireTwoDigitExponent ? sizeof("E+0") : sizeof("E+")) - 1);
- if (isHex)
- expectedWidth += sizeof("0X") - 1;
-
- /* Output prefixing */
- if (flags & FLAGS_NILPADDING)
- {
- /* Leading zeros must be after sign */
- if (isNegative)
- self->OutStream(self, '-');
- else if (flags & FLAGS_SHOWSIGN)
- self->OutStream(self, '+');
- else if (flags & FLAGS_SPACE)
- self->OutStream(self, ' ');
- if (isHex)
- {
- self->OutStream(self, '0');
- self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x');
- }
- if (!(flags & FLAGS_LEFTADJUST))
- {
- for (i = expectedWidth; i < width; i++)
- {
- self->OutStream(self, '0');
- }
- }
- }
- else
- {
- /* Leading spaces must be before sign */
- if (!(flags & FLAGS_LEFTADJUST))
- {
- for (i = expectedWidth; i < width; i++)
- {
- self->OutStream(self, CHAR_ADJUST);
- }
- }
- if (isNegative)
- self->OutStream(self, '-');
- else if (flags & FLAGS_SHOWSIGN)
- self->OutStream(self, '+');
- else if (flags & FLAGS_SPACE)
- self->OutStream(self, ' ');
- if (isHex)
- {
- self->OutStream(self, '0');
- self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x');
- }
- }
-
- /* Output the integer part and thousand separators */
- dblIntegerBase = 1.0 / TrioPower(base, integerDigits - 1);
- for (i = 0; i < integerDigits; i++)
- {
- workNumber = floorl(((integerNumber + integerAdjust) * dblIntegerBase));
- if (i > integerThreshold)
- {
- /* Beyond accuracy */
- self->OutStream(self, digits[0]);
- }
- else
- {
- self->OutStream(self, digits[(int)fmodl(workNumber, dblBase)]);
- }
- dblIntegerBase *= dblBase;
-
- if (((flags & (FLAGS_FLOAT_E | FLAGS_QUOTE)) == FLAGS_QUOTE)
- && TrioFollowedBySeparator(integerDigits - i))
- {
- for (groupingPointer = internalThousandSeparator;
- *groupingPointer != NIL;
- groupingPointer++)
- {
- self->OutStream(self, *groupingPointer);
- }
- }
- }
-
- /* Insert decimal point and build the fraction part */
- trailingZeroes = 0;
-
- if (keepDecimalPoint)
- {
- if (internalDecimalPoint)
- {
- self->OutStream(self, internalDecimalPoint);
- }
- else
- {
- for (i = 0; i < internalDecimalPointLength; i++)
- {
- self->OutStream(self, internalDecimalPointString[i]);
- }
- }
- }
-
- for (i = 0; i < fractionDigits; i++)
- {
- if ((integerDigits > integerThreshold) || (i > fractionThreshold))
- {
- /* Beyond accuracy */
- trailingZeroes++;
- }
- else
- {
- fractionNumber *= dblBase;
- fractionAdjust *= dblBase;
- workNumber = floorl(fractionNumber + fractionAdjust);
- fractionNumber -= workNumber;
- index = (int)fmodl(workNumber, dblBase);
- if (index == 0)
- {
- trailingZeroes++;
- }
- else
- {
- while (trailingZeroes > 0)
- {
- /* Not trailing zeroes after all */
- self->OutStream(self, digits[0]);
- trailingZeroes--;
- }
- self->OutStream(self, digits[index]);
- }
- }
- }
-
- if (keepTrailingZeroes)
- {
- while (trailingZeroes > 0)
- {
- self->OutStream(self, digits[0]);
- trailingZeroes--;
- }
- }
-
- /* Output exponent */
- if (exponentDigits > 0)
- {
- self->OutStream(self,
- isHex
- ? ((flags & FLAGS_UPPER) ? 'P' : 'p')
- : ((flags & FLAGS_UPPER) ? 'E' : 'e'));
- self->OutStream(self, (isExponentNegative) ? '-' : '+');
-
- /* The exponent must contain at least two digits */
- if (requireTwoDigitExponent)
- self->OutStream(self, '0');
-
- exponentBase = (int)TrioPower(base, exponentDigits - 1);
- for (i = 0; i < exponentDigits; i++)
- {
- self->OutStream(self, digits[(uExponent / exponentBase) % base]);
- exponentBase /= base;
- }
- }
- /* Output trailing spaces */
- if (flags & FLAGS_LEFTADJUST)
- {
- for (i = expectedWidth; i < width; i++)
- {
- self->OutStream(self, CHAR_ADJUST);
- }
- }
-}
-
-/*************************************************************************
- * TrioFormatProcess
- *
- * Description:
- * This is the main engine for formatting output
- */
-TRIO_PRIVATE int
-TrioFormatProcess
-TRIO_ARGS3((data, format, parameters),
- trio_class_t *data,
- TRIO_CONST char *format,
- trio_parameter_t *parameters)
-{
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- int charlen;
-#endif
- int i;
- TRIO_CONST char *string;
- trio_pointer_t pointer;
- unsigned long flags;
- int width;
- int precision;
- int base;
- int index;
-
- index = 0;
- i = 0;
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- (void)mblen(NULL, 0);
-#endif
-
- while (format[index])
- {
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- if (! isascii(format[index]))
- {
- charlen = mblen(&format[index], MB_LEN_MAX);
- /*
- * Only valid multibyte characters are handled here. Invalid
- * multibyte characters (charlen == -1) are handled as normal
- * characters.
- */
- if (charlen != -1)
- {
- while (charlen-- > 0)
- {
- data->OutStream(data, format[index++]);
- }
- continue; /* while characters left in formatting string */
- }
- }
-#endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */
- if (CHAR_IDENTIFIER == format[index])
- {
- if (CHAR_IDENTIFIER == format[index + 1])
- {
- data->OutStream(data, CHAR_IDENTIFIER);
- index += 2;
- }
- else
- {
- /* Skip the parameter entries */
- while (parameters[i].type == FORMAT_PARAMETER)
- i++;
-
- flags = parameters[i].flags;
-
- /* Find width */
- width = parameters[i].width;
- if (flags & FLAGS_WIDTH_PARAMETER)
- {
- /* Get width from parameter list */
- width = (int)parameters[width].data.number.as_signed;
- }
-
- /* Find precision */
- if (flags & FLAGS_PRECISION)
- {
- precision = parameters[i].precision;
- if (flags & FLAGS_PRECISION_PARAMETER)
- {
- /* Get precision from parameter list */
- precision = (int)parameters[precision].data.number.as_signed;
- }
- }
- else
- {
- precision = NO_PRECISION;
- }
-
- /* Find base */
- base = parameters[i].base;
- if (flags & FLAGS_BASE_PARAMETER)
- {
- /* Get base from parameter list */
- base = (int)parameters[base].data.number.as_signed;
- }
-
- switch (parameters[i].type)
- {
- case FORMAT_CHAR:
- if (flags & FLAGS_QUOTE)
- data->OutStream(data, CHAR_QUOTE);
- if (! (flags & FLAGS_LEFTADJUST))
- {
- while (--width > 0)
- data->OutStream(data, CHAR_ADJUST);
- }
-#if TRIO_WIDECHAR
- if (flags & FLAGS_WIDECHAR)
- {
- TrioWriteWideStringCharacter(data,
- (trio_wchar_t)parameters[i].data.number.as_signed,
- flags,
- NO_WIDTH);
- }
- else
-#endif
- {
- TrioWriteStringCharacter(data,
- (int)parameters[i].data.number.as_signed,
- flags);
- }
-
- if (flags & FLAGS_LEFTADJUST)
- {
- while(--width > 0)
- data->OutStream(data, CHAR_ADJUST);
- }
- if (flags & FLAGS_QUOTE)
- data->OutStream(data, CHAR_QUOTE);
-
- break; /* FORMAT_CHAR */
-
- case FORMAT_INT:
- TrioWriteNumber(data,
- parameters[i].data.number.as_unsigned,
- flags,
- width,
- precision,
- base);
-
- break; /* FORMAT_INT */
-
- case FORMAT_DOUBLE:
- TrioWriteDouble(data,
- parameters[i].data.longdoubleNumber,
- flags,
- width,
- precision,
- base);
- break; /* FORMAT_DOUBLE */
-
- case FORMAT_STRING:
-#if TRIO_WIDECHAR
- if (flags & FLAGS_WIDECHAR)
- {
- TrioWriteWideString(data,
- parameters[i].data.wstring,
- flags,
- width,
- precision);
- }
- else
-#endif
- {
- TrioWriteString(data,
- parameters[i].data.string,
- flags,
- width,
- precision);
- }
- break; /* FORMAT_STRING */
-
- case FORMAT_POINTER:
- {
- trio_reference_t reference;
-
- reference.data = data;
- reference.parameter = &parameters[i];
- trio_print_pointer(&reference, parameters[i].data.pointer);
- }
- break; /* FORMAT_POINTER */
-
- case FORMAT_COUNT:
- pointer = parameters[i].data.pointer;
- if (NULL != pointer)
- {
- /*
- * C99 paragraph 7.19.6.1.8 says "the number of
- * characters written to the output stream so far by
- * this call", which is data->committed
- */
-#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER)
- if (flags & FLAGS_SIZE_T)
- *(size_t *)pointer = (size_t)data->committed;
- else
-#endif
-#if defined(QUALIFIER_PTRDIFF_T)
- if (flags & FLAGS_PTRDIFF_T)
- *(ptrdiff_t *)pointer = (ptrdiff_t)data->committed;
- else
-#endif
-#if defined(QUALIFIER_INTMAX_T)
- if (flags & FLAGS_INTMAX_T)
- *(trio_intmax_t *)pointer = (trio_intmax_t)data->committed;
- else
-#endif
- if (flags & FLAGS_QUAD)
- {
- *(trio_ulonglong_t *)pointer = (trio_ulonglong_t)data->committed;
- }
- else if (flags & FLAGS_LONG)
- {
- *(long int *)pointer = (long int)data->committed;
- }
- else if (flags & FLAGS_SHORT)
- {
- *(short int *)pointer = (short int)data->committed;
- }
- else
- {
- *(int *)pointer = (int)data->committed;
- }
- }
- break; /* FORMAT_COUNT */
-
- case FORMAT_PARAMETER:
- break; /* FORMAT_PARAMETER */
-
-#if defined(FORMAT_ERRNO)
- case FORMAT_ERRNO:
- string = trio_error(parameters[i].data.errorNumber);
- if (string)
- {
- TrioWriteString(data,
- string,
- flags,
- width,
- precision);
- }
- else
- {
- data->OutStream(data, '#');
- TrioWriteNumber(data,
- (trio_uintmax_t)parameters[i].data.errorNumber,
- flags,
- width,
- precision,
- BASE_DECIMAL);
- }
- break; /* FORMAT_ERRNO */
-#endif /* defined(FORMAT_ERRNO) */
-
-#if defined(FORMAT_USER_DEFINED)
- case FORMAT_USER_DEFINED:
- {
- trio_reference_t reference;
- trio_userdef_t *def = NULL;
-
- if (parameters[i].user_name[0] == NIL)
- {
- /* Use handle */
- if ((i > 0) ||
- (parameters[i - 1].type == FORMAT_PARAMETER))
- def = (trio_userdef_t *)parameters[i - 1].data.pointer;
- }
- else
- {
- /* Look up namespace */
- def = TrioFindNamespace(parameters[i].user_name, NULL);
- }
- if (def) {
- reference.data = data;
- reference.parameter = &parameters[i];
- def->callback(&reference);
- }
- }
- break;
-#endif /* defined(FORMAT_USER_DEFINED) */
-
- default:
- break;
- } /* switch parameter type */
-
- /* Prepare for next */
- index = parameters[i].indexAfterSpecifier;
- i++;
- }
- }
- else /* not identifier */
- {
- data->OutStream(data, format[index++]);
- }
- }
- return data->processed;
-}
-
-/*************************************************************************
- * TrioFormatRef
- */
-TRIO_PRIVATE int
-TrioFormatRef
-TRIO_ARGS4((reference, format, arglist, argarray),
- trio_reference_t *reference,
- TRIO_CONST char *format,
- va_list *arglist,
- trio_pointer_t *argarray)
-{
- int status;
- trio_parameter_t parameters[MAX_PARAMETERS];
-
- status = TrioParse(TYPE_PRINT, format, parameters, arglist, argarray);
- if (status < 0)
- return status;
-
- status = TrioFormatProcess(reference->data, format, parameters);
- if (reference->data->error != 0)
- {
- status = reference->data->error;
- }
- return status;
-}
-
-/*************************************************************************
- * TrioFormat
- */
-TRIO_PRIVATE int
-TrioFormat
-TRIO_ARGS6((destination, destinationSize, OutStream, format, arglist, argarray),
- trio_pointer_t destination,
- size_t destinationSize,
- void (*OutStream) TRIO_PROTO((trio_class_t *, int)),
- TRIO_CONST char *format,
- va_list *arglist,
- trio_pointer_t *argarray)
-{
- int status;
- trio_class_t data;
- trio_parameter_t parameters[MAX_PARAMETERS];
-
- assert(VALID(OutStream));
- assert(VALID(format));
-
- memset(&data, 0, sizeof(data));
- data.OutStream = OutStream;
- data.location = destination;
- data.max = destinationSize;
- data.error = 0;
-
-#if defined(USE_LOCALE)
- if (NULL == internalLocaleValues)
- {
- TrioSetLocale();
- }
-#endif
-
- status = TrioParse(TYPE_PRINT, format, parameters, arglist, argarray);
- if (status < 0)
- return status;
-
- status = TrioFormatProcess(&data, format, parameters);
- if (data.error != 0)
- {
- status = data.error;
- }
- return status;
-}
-
-/*************************************************************************
- * TrioOutStreamFile
- */
-TRIO_PRIVATE void
-TrioOutStreamFile
-TRIO_ARGS2((self, output),
- trio_class_t *self,
- int output)
-{
- FILE *file;
-
- assert(VALID(self));
- assert(VALID(self->location));
-
- file = (FILE *)self->location;
- self->processed++;
- if (fputc(output, file) == EOF)
- {
- self->error = TRIO_ERROR_RETURN(TRIO_EOF, 0);
- }
- else
- {
- self->committed++;
- }
-}
-
-/*************************************************************************
- * TrioOutStreamFileDescriptor
- */
-TRIO_PRIVATE void
-TrioOutStreamFileDescriptor
-TRIO_ARGS2((self, output),
- trio_class_t *self,
- int output)
-{
- int fd;
- char ch;
-
- assert(VALID(self));
-
- fd = *((int *)self->location);
- ch = (char)output;
- self->processed++;
- if (write(fd, &ch, sizeof(char)) == -1)
- {
- self->error = TRIO_ERROR_RETURN(TRIO_ERRNO, 0);
- }
- else
- {
- self->committed++;
- }
-}
-
-/*************************************************************************
- * TrioOutStreamCustom
- */
-TRIO_PRIVATE void
-TrioOutStreamCustom
-TRIO_ARGS2((self, output),
- trio_class_t *self,
- int output)
-{
- int status;
- trio_custom_t *data;
-
- assert(VALID(self));
- assert(VALID(self->location));
-
- data = (trio_custom_t *)self->location;
- if (data->stream.out)
- {
- status = (data->stream.out)(data->closure, output);
- if (status >= 0)
- {
- self->committed++;
- }
- else
- {
- if (self->error == 0)
- {
- self->error = TRIO_ERROR_RETURN(TRIO_ECUSTOM, -status);
- }
- }
- }
- self->processed++;
-}
-
-/*************************************************************************
- * TrioOutStreamString
- */
-TRIO_PRIVATE void
-TrioOutStreamString
-TRIO_ARGS2((self, output),
- trio_class_t *self,
- int output)
-{
- char **buffer;
-
- assert(VALID(self));
- assert(VALID(self->location));
-
- buffer = (char **)self->location;
- **buffer = (char)output;
- (*buffer)++;
- self->processed++;
- self->committed++;
-}
-
-/*************************************************************************
- * TrioOutStreamStringMax
- */
-TRIO_PRIVATE void
-TrioOutStreamStringMax
-TRIO_ARGS2((self, output),
- trio_class_t *self,
- int output)
-{
- char **buffer;
-
- assert(VALID(self));
- assert(VALID(self->location));
-
- buffer = (char **)self->location;
-
- if (self->processed < self->max)
- {
- **buffer = (char)output;
- (*buffer)++;
- self->committed++;
- }
- self->processed++;
-}
-
-/*************************************************************************
- * TrioOutStreamStringDynamic
- */
-TRIO_PRIVATE void
-TrioOutStreamStringDynamic
-TRIO_ARGS2((self, output),
- trio_class_t *self,
- int output)
-{
- assert(VALID(self));
- assert(VALID(self->location));
-
- if (self->error == 0)
- {
- trio_xstring_append_char((trio_string_t *)self->location,
- (char)output);
- self->committed++;
- }
- /* The processed variable must always be increased */
- self->processed++;
-}
-
-/*************************************************************************
- *
- * Formatted printing functions
- *
- ************************************************************************/
-
-#if defined(TRIO_DOCUMENTATION)
-# include "doc/doc_printf.h"
-#endif
-/** @addtogroup Printf
- @{
-*/
-
-/*************************************************************************
- * printf
- */
-
-/**
- Print to standard output stream.
-
- @param format Formatting string.
- @param ... Arguments.
- @return Number of printed characters.
- */
-TRIO_PUBLIC int
-trio_printf
-TRIO_VARGS2((format, va_alist),
- TRIO_CONST char *format,
- TRIO_VA_DECL)
-{
- int status;
- va_list args;
-
- assert(VALID(format));
-
- TRIO_VA_START(args, format);
- status = TrioFormat(stdout, 0, TrioOutStreamFile, format, &args, NULL);
- TRIO_VA_END(args);
- return status;
-}
-
-/**
- Print to standard output stream.
-
- @param format Formatting string.
- @param args Arguments.
- @return Number of printed characters.
- */
-TRIO_PUBLIC int
-trio_vprintf
-TRIO_ARGS2((format, args),
- TRIO_CONST char *format,
- va_list args)
-{
- assert(VALID(format));
-
- return TrioFormat(stdout, 0, TrioOutStreamFile, format, &args, NULL);
-}
-
-/**
- Print to standard output stream.
-
- @param format Formatting string.
- @param args Arguments.
- @return Number of printed characters.
- */
-TRIO_PUBLIC int
-trio_printfv
-TRIO_ARGS2((format, args),
- TRIO_CONST char *format,
- trio_pointer_t * args)
-{
- assert(VALID(format));
-
- return TrioFormat(stdout, 0, TrioOutStreamFile, format, NULL, args);
-}
-
-/*************************************************************************
- * fprintf
- */
-
-/**
- Print to file.
-
- @param file File pointer.
- @param format Formatting string.
- @param ... Arguments.
- @return Number of printed characters.
- */
-TRIO_PUBLIC int
-trio_fprintf
-TRIO_VARGS3((file, format, va_alist),
- FILE *file,
- TRIO_CONST char *format,
- TRIO_VA_DECL)
-{
- int status;
- va_list args;
-
- assert(VALID(file));
- assert(VALID(format));
-
- TRIO_VA_START(args, format);
- status = TrioFormat(file, 0, TrioOutStreamFile, format, &args, NULL);
- TRIO_VA_END(args);
- return status;
-}
-
-/**
- Print to file.
-
- @param file File pointer.
- @param format Formatting string.
- @param args Arguments.
- @return Number of printed characters.
- */
-TRIO_PUBLIC int
-trio_vfprintf
-TRIO_ARGS3((file, format, args),
- FILE *file,
- TRIO_CONST char *format,
- va_list args)
-{
- assert(VALID(file));
- assert(VALID(format));
-
- return TrioFormat(file, 0, TrioOutStreamFile, format, &args, NULL);
-}
-
-/**
- Print to file.
-
- @param file File pointer.
- @param format Formatting string.
- @param args Arguments.
- @return Number of printed characters.
- */
-TRIO_PUBLIC int
-trio_fprintfv
-TRIO_ARGS3((file, format, args),
- FILE *file,
- TRIO_CONST char *format,
- trio_pointer_t * args)
-{
- assert(VALID(file));
- assert(VALID(format));
-
- return TrioFormat(file, 0, TrioOutStreamFile, format, NULL, args);
-}
-
-/*************************************************************************
- * dprintf
- */
-
-/**
- Print to file descriptor.
-
- @param fd File descriptor.
- @param format Formatting string.
- @param ... Arguments.
- @return Number of printed characters.
- */
-TRIO_PUBLIC int
-trio_dprintf
-TRIO_VARGS3((fd, format, va_alist),
- int fd,
- TRIO_CONST char *format,
- TRIO_VA_DECL)
-{
- int status;
- va_list args;
-
- assert(VALID(format));
-
- TRIO_VA_START(args, format);
- status = TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, &args, NULL);
- TRIO_VA_END(args);
- return status;
-}
-
-/**
- Print to file descriptor.
-
- @param fd File descriptor.
- @param format Formatting string.
- @param args Arguments.
- @return Number of printed characters.
- */
-TRIO_PUBLIC int
-trio_vdprintf
-TRIO_ARGS3((fd, format, args),
- int fd,
- TRIO_CONST char *format,
- va_list args)
-{
- assert(VALID(format));
-
- return TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, &args, NULL);
-}
-
-/**
- Print to file descriptor.
-
- @param fd File descriptor.
- @param format Formatting string.
- @param args Arguments.
- @return Number of printed characters.
- */
-TRIO_PUBLIC int
-trio_dprintfv
-TRIO_ARGS3((fd, format, args),
- int fd,
- TRIO_CONST char *format,
- trio_pointer_t *args)
-{
- assert(VALID(format));
-
- return TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, NULL, args);
-}
-
-/*************************************************************************
- * cprintf
- */
-TRIO_PUBLIC int
-trio_cprintf
-TRIO_VARGS4((stream, closure, format, va_alist),
- trio_outstream_t stream,
- trio_pointer_t closure,
- TRIO_CONST char *format,
- TRIO_VA_DECL)
-{
- int status;
- va_list args;
- trio_custom_t data;
-
- assert(VALID(stream));
- assert(VALID(format));
-
- TRIO_VA_START(args, format);
- data.stream.out = stream;
- data.closure = closure;
- status = TrioFormat(&data, 0, TrioOutStreamCustom, format, &args, NULL);
- TRIO_VA_END(args);
- return status;
-}
-
-TRIO_PUBLIC int
-trio_vcprintf
-TRIO_ARGS4((stream, closure, format, args),
- trio_outstream_t stream,
- trio_pointer_t closure,
- TRIO_CONST char *format,
- va_list args)
-{
- trio_custom_t data;
-
- assert(VALID(stream));
- assert(VALID(format));
-
- data.stream.out = stream;
- data.closure = closure;
- return TrioFormat(&data, 0, TrioOutStreamCustom, format, &args, NULL);
-}
-
-TRIO_PUBLIC int
-trio_cprintfv
-TRIO_ARGS4((stream, closure, format, args),
- trio_outstream_t stream,
- trio_pointer_t closure,
- TRIO_CONST char *format,
- void **args)
-{
- trio_custom_t data;
-
- assert(VALID(stream));
- assert(VALID(format));
-
- data.stream.out = stream;
- data.closure = closure;
- return TrioFormat(&data, 0, TrioOutStreamCustom, format, NULL, args);
-}
-
-/*************************************************************************
- * sprintf
- */
-
-/**
- Print to string.
-
- @param buffer Output string.
- @param format Formatting string.
- @param ... Arguments.
- @return Number of printed characters.
- */
-TRIO_PUBLIC int
-trio_sprintf
-TRIO_VARGS3((buffer, format, va_alist),
- char *buffer,
- TRIO_CONST char *format,
- TRIO_VA_DECL)
-{
- int status;
- va_list args;
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- TRIO_VA_START(args, format);
- status = TrioFormat(&buffer, 0, TrioOutStreamString, format, &args, NULL);
- *buffer = NIL; /* Terminate with NIL character */
- TRIO_VA_END(args);
- return status;
-}
-
-/**
- Print to string.
-
- @param buffer Output string.
- @param format Formatting string.
- @param args Arguments.
- @return Number of printed characters.
- */
-TRIO_PUBLIC int
-trio_vsprintf
-TRIO_ARGS3((buffer, format, args),
- char *buffer,
- TRIO_CONST char *format,
- va_list args)
-{
- int status;
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- status = TrioFormat(&buffer, 0, TrioOutStreamString, format, &args, NULL);
- *buffer = NIL;
- return status;
-}
-
-/**
- Print to string.
-
- @param buffer Output string.
- @param format Formatting string.
- @param args Arguments.
- @return Number of printed characters.
- */
-TRIO_PUBLIC int
-trio_sprintfv
-TRIO_ARGS3((buffer, format, args),
- char *buffer,
- TRIO_CONST char *format,
- trio_pointer_t *args)
-{
- int status;
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- status = TrioFormat(&buffer, 0, TrioOutStreamString, format, NULL, args);
- *buffer = NIL;
- return status;
-}
-
-/*************************************************************************
- * snprintf
- */
-
-/**
- Print at most @p max characters to string.
-
- @param buffer Output string.
- @param max Maximum number of characters to print.
- @param format Formatting string.
- @param ... Arguments.
- @return Number of printed characters.
- */
-TRIO_PUBLIC int
-trio_snprintf
-TRIO_VARGS4((buffer, max, format, va_alist),
- char *buffer,
- size_t max,
- TRIO_CONST char *format,
- TRIO_VA_DECL)
-{
- int status;
- va_list args;
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- TRIO_VA_START(args, format);
- status = TrioFormat(&buffer, max > 0 ? max - 1 : 0,
- TrioOutStreamStringMax, format, &args, NULL);
- if (max > 0)
- *buffer = NIL;
- TRIO_VA_END(args);
- return status;
-}
-
-/**
- Print at most @p max characters to string.
-
- @param buffer Output string.
- @param max Maximum number of characters to print.
- @param format Formatting string.
- @param args Arguments.
- @return Number of printed characters.
- */
-TRIO_PUBLIC int
-trio_vsnprintf
-TRIO_ARGS4((buffer, max, format, args),
- char *buffer,
- size_t max,
- TRIO_CONST char *format,
- va_list args)
-{
- int status;
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- status = TrioFormat(&buffer, max > 0 ? max - 1 : 0,
- TrioOutStreamStringMax, format, &args, NULL);
- if (max > 0)
- *buffer = NIL;
- return status;
-}
-
-/**
- Print at most @p max characters to string.
-
- @param buffer Output string.
- @param max Maximum number of characters to print.
- @param format Formatting string.
- @param args Arguments.
- @return Number of printed characters.
- */
-TRIO_PUBLIC int
-trio_snprintfv
-TRIO_ARGS4((buffer, max, format, args),
- char *buffer,
- size_t max,
- TRIO_CONST char *format,
- trio_pointer_t *args)
-{
- int status;
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- status = TrioFormat(&buffer, max > 0 ? max - 1 : 0,
- TrioOutStreamStringMax, format, NULL, args);
- if (max > 0)
- *buffer = NIL;
- return status;
-}
-
-/*************************************************************************
- * snprintfcat
- * Appends the new string to the buffer string overwriting the '\0'
- * character at the end of buffer.
- */
-TRIO_PUBLIC int
-trio_snprintfcat
-TRIO_VARGS4((buffer, max, format, va_alist),
- char *buffer,
- size_t max,
- TRIO_CONST char *format,
- TRIO_VA_DECL)
-{
- int status;
- va_list args;
- size_t buf_len;
-
- TRIO_VA_START(args, format);
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- buf_len = trio_length(buffer);
- buffer = &buffer[buf_len];
-
- status = TrioFormat(&buffer, max - 1 - buf_len,
- TrioOutStreamStringMax, format, &args, NULL);
- TRIO_VA_END(args);
- *buffer = NIL;
- return status;
-}
-
-TRIO_PUBLIC int
-trio_vsnprintfcat
-TRIO_ARGS4((buffer, max, format, args),
- char *buffer,
- size_t max,
- TRIO_CONST char *format,
- va_list args)
-{
- int status;
- size_t buf_len;
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- buf_len = trio_length(buffer);
- buffer = &buffer[buf_len];
- status = TrioFormat(&buffer, max - 1 - buf_len,
- TrioOutStreamStringMax, format, &args, NULL);
- *buffer = NIL;
- return status;
-}
-
-/*************************************************************************
- * trio_aprintf
- */
-
-/* Deprecated */
-TRIO_PUBLIC char *
-trio_aprintf
-TRIO_VARGS2((format, va_alist),
- TRIO_CONST char *format,
- TRIO_VA_DECL)
-{
- va_list args;
- trio_string_t *info;
- char *result = NULL;
-
- assert(VALID(format));
-
- info = trio_xstring_duplicate("");
- if (info)
- {
- TRIO_VA_START(args, format);
- (void)TrioFormat(info, 0, TrioOutStreamStringDynamic,
- format, &args, NULL);
- TRIO_VA_END(args);
-
- trio_string_terminate(info);
- result = trio_string_extract(info);
- trio_string_destroy(info);
- }
- return result;
-}
-
-/* Deprecated */
-TRIO_PUBLIC char *
-trio_vaprintf
-TRIO_ARGS2((format, args),
- TRIO_CONST char *format,
- va_list args)
-{
- trio_string_t *info;
- char *result = NULL;
-
- assert(VALID(format));
-
- info = trio_xstring_duplicate("");
- if (info)
- {
- (void)TrioFormat(info, 0, TrioOutStreamStringDynamic,
- format, &args, NULL);
- trio_string_terminate(info);
- result = trio_string_extract(info);
- trio_string_destroy(info);
- }
- return result;
-}
-
-TRIO_PUBLIC int
-trio_asprintf
-TRIO_VARGS3((result, format, va_alist),
- char **result,
- TRIO_CONST char *format,
- TRIO_VA_DECL)
-{
- va_list args;
- int status;
- trio_string_t *info;
-
- assert(VALID(format));
-
- *result = NULL;
-
- info = trio_xstring_duplicate("");
- if (info == NULL)
- {
- status = TRIO_ERROR_RETURN(TRIO_ENOMEM, 0);
- }
- else
- {
- TRIO_VA_START(args, format);
- status = TrioFormat(info, 0, TrioOutStreamStringDynamic,
- format, &args, NULL);
- TRIO_VA_END(args);
- if (status >= 0)
- {
- trio_string_terminate(info);
- *result = trio_string_extract(info);
- }
- trio_string_destroy(info);
- }
- return status;
-}
-
-TRIO_PUBLIC int
-trio_vasprintf
-TRIO_ARGS3((result, format, args),
- char **result,
- TRIO_CONST char *format,
- va_list args)
-{
- int status;
- trio_string_t *info;
-
- assert(VALID(format));
-
- *result = NULL;
-
- info = trio_xstring_duplicate("");
- if (info == NULL)
- {
- status = TRIO_ERROR_RETURN(TRIO_ENOMEM, 0);
- }
- else
- {
- status = TrioFormat(info, 0, TrioOutStreamStringDynamic,
- format, &args, NULL);
- if (status >= 0)
- {
- trio_string_terminate(info);
- *result = trio_string_extract(info);
- }
- trio_string_destroy(info);
- }
- return status;
-}
-
-/** @} End of Printf documentation module */
-
-/*************************************************************************
- *
- * CALLBACK
- *
- ************************************************************************/
-
-#if defined(TRIO_DOCUMENTATION)
-# include "doc/doc_register.h"
-#endif
-/**
- @addtogroup UserDefined
- @{
-*/
-
-#if TRIO_EXTENSION
-
-/*************************************************************************
- * trio_register
- */
-
-/**
- Register new user-defined specifier.
-
- @param callback
- @param name
- @return Handle.
- */
-TRIO_PUBLIC trio_pointer_t
-trio_register
-TRIO_ARGS2((callback, name),
- trio_callback_t callback,
- TRIO_CONST char *name)
-{
- trio_userdef_t *def;
- trio_userdef_t *prev = NULL;
-
- if (callback == NULL)
- return NULL;
-
- if (name)
- {
- /* Handle built-in namespaces */
- if (name[0] == ':')
- {
- if (trio_equal(name, ":enter"))
- {
- internalEnterCriticalRegion = callback;
- }
- else if (trio_equal(name, ":leave"))
- {
- internalLeaveCriticalRegion = callback;
- }
- return NULL;
- }
-
- /* Bail out if namespace is too long */
- if (trio_length(name) >= MAX_USER_NAME)
- return NULL;
-
- /* Bail out if namespace already is registered */
- def = TrioFindNamespace(name, &prev);
- if (def)
- return NULL;
- }
-
- def = (trio_userdef_t *)TRIO_MALLOC(sizeof(trio_userdef_t));
- if (def)
- {
- if (internalEnterCriticalRegion)
- (void)internalEnterCriticalRegion(NULL);
-
- if (name)
- {
- /* Link into internal list */
- if (prev == NULL)
- internalUserDef = def;
- else
- prev->next = def;
- }
- /* Initialize */
- def->callback = callback;
- def->name = (name == NULL)
- ? NULL
- : trio_duplicate(name);
- def->next = NULL;
-
- if (internalLeaveCriticalRegion)
- (void)internalLeaveCriticalRegion(NULL);
- }
- return (trio_pointer_t)def;
-}
-
-/**
- Unregister an existing user-defined specifier.
-
- @param handle
- */
-void
-trio_unregister
-TRIO_ARGS1((handle),
- trio_pointer_t handle)
-{
- trio_userdef_t *self = (trio_userdef_t *)handle;
- trio_userdef_t *def;
- trio_userdef_t *prev = NULL;
-
- assert(VALID(self));
-
- if (self->name)
- {
- def = TrioFindNamespace(self->name, &prev);
- if (def)
- {
- if (internalEnterCriticalRegion)
- (void)internalEnterCriticalRegion(NULL);
-
- if (prev == NULL)
- internalUserDef = NULL;
- else
- prev->next = def->next;
-
- if (internalLeaveCriticalRegion)
- (void)internalLeaveCriticalRegion(NULL);
- }
- trio_destroy(self->name);
- }
- TRIO_FREE(self);
-}
-
-/*************************************************************************
- * trio_get_format [public]
- */
-TRIO_CONST char *
-trio_get_format
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
-#if defined(FORMAT_USER_DEFINED)
- assert(((trio_reference_t *)ref)->parameter->type == FORMAT_USER_DEFINED);
-#endif
-
- return (((trio_reference_t *)ref)->parameter->user_data);
-}
-
-/*************************************************************************
- * trio_get_argument [public]
- */
-trio_pointer_t
-trio_get_argument
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
-#if defined(FORMAT_USER_DEFINED)
- assert(((trio_reference_t *)ref)->parameter->type == FORMAT_USER_DEFINED);
-#endif
-
- return ((trio_reference_t *)ref)->parameter->data.pointer;
-}
-
-/*************************************************************************
- * trio_get_width / trio_set_width [public]
- */
-int
-trio_get_width
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return ((trio_reference_t *)ref)->parameter->width;
-}
-
-void
-trio_set_width
-TRIO_ARGS2((ref, width),
- trio_pointer_t ref,
- int width)
-{
- ((trio_reference_t *)ref)->parameter->width = width;
-}
-
-/*************************************************************************
- * trio_get_precision / trio_set_precision [public]
- */
-int
-trio_get_precision
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->precision);
-}
-
-void
-trio_set_precision
-TRIO_ARGS2((ref, precision),
- trio_pointer_t ref,
- int precision)
-{
- ((trio_reference_t *)ref)->parameter->precision = precision;
-}
-
-/*************************************************************************
- * trio_get_base / trio_set_base [public]
- */
-int
-trio_get_base
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->base);
-}
-
-void
-trio_set_base
-TRIO_ARGS2((ref, base),
- trio_pointer_t ref,
- int base)
-{
- ((trio_reference_t *)ref)->parameter->base = base;
-}
-
-/*************************************************************************
- * trio_get_long / trio_set_long [public]
- */
-int
-trio_get_long
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->flags & FLAGS_LONG);
-}
-
-void
-trio_set_long
-TRIO_ARGS2((ref, is_long),
- trio_pointer_t ref,
- int is_long)
-{
- if (is_long)
- ((trio_reference_t *)ref)->parameter->flags |= FLAGS_LONG;
- else
- ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_LONG;
-}
-
-/*************************************************************************
- * trio_get_longlong / trio_set_longlong [public]
- */
-int
-trio_get_longlong
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->flags & FLAGS_QUAD);
-}
-
-void
-trio_set_longlong
-TRIO_ARGS2((ref, is_longlong),
- trio_pointer_t ref,
- int is_longlong)
-{
- if (is_longlong)
- ((trio_reference_t *)ref)->parameter->flags |= FLAGS_QUAD;
- else
- ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_QUAD;
-}
-
-/*************************************************************************
- * trio_get_longdouble / trio_set_longdouble [public]
- */
-int
-trio_get_longdouble
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->flags & FLAGS_LONGDOUBLE);
-}
-
-void
-trio_set_longdouble
-TRIO_ARGS2((ref, is_longdouble),
- trio_pointer_t ref,
- int is_longdouble)
-{
- if (is_longdouble)
- ((trio_reference_t *)ref)->parameter->flags |= FLAGS_LONGDOUBLE;
- else
- ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_LONGDOUBLE;
-}
-
-/*************************************************************************
- * trio_get_short / trio_set_short [public]
- */
-int
-trio_get_short
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->flags & FLAGS_SHORT);
-}
-
-void
-trio_set_short
-TRIO_ARGS2((ref, is_short),
- trio_pointer_t ref,
- int is_short)
-{
- if (is_short)
- ((trio_reference_t *)ref)->parameter->flags |= FLAGS_SHORT;
- else
- ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_SHORT;
-}
-
-/*************************************************************************
- * trio_get_shortshort / trio_set_shortshort [public]
- */
-int
-trio_get_shortshort
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->flags & FLAGS_SHORTSHORT);
-}
-
-void
-trio_set_shortshort
-TRIO_ARGS2((ref, is_shortshort),
- trio_pointer_t ref,
- int is_shortshort)
-{
- if (is_shortshort)
- ((trio_reference_t *)ref)->parameter->flags |= FLAGS_SHORTSHORT;
- else
- ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_SHORTSHORT;
-}
-
-/*************************************************************************
- * trio_get_alternative / trio_set_alternative [public]
- */
-int
-trio_get_alternative
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->flags & FLAGS_ALTERNATIVE);
-}
-
-void
-trio_set_alternative
-TRIO_ARGS2((ref, is_alternative),
- trio_pointer_t ref,
- int is_alternative)
-{
- if (is_alternative)
- ((trio_reference_t *)ref)->parameter->flags |= FLAGS_ALTERNATIVE;
- else
- ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_ALTERNATIVE;
-}
-
-/*************************************************************************
- * trio_get_alignment / trio_set_alignment [public]
- */
-int
-trio_get_alignment
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->flags & FLAGS_LEFTADJUST);
-}
-
-void
-trio_set_alignment
-TRIO_ARGS2((ref, is_leftaligned),
- trio_pointer_t ref,
- int is_leftaligned)
-{
- if (is_leftaligned)
- ((trio_reference_t *)ref)->parameter->flags |= FLAGS_LEFTADJUST;
- else
- ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_LEFTADJUST;
-}
-
-/*************************************************************************
- * trio_get_spacing /trio_set_spacing [public]
- */
-int
-trio_get_spacing
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->flags & FLAGS_SPACE);
-}
-
-void
-trio_set_spacing
-TRIO_ARGS2((ref, is_space),
- trio_pointer_t ref,
- int is_space)
-{
- if (is_space)
- ((trio_reference_t *)ref)->parameter->flags |= FLAGS_SPACE;
- else
- ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_SPACE;
-}
-
-/*************************************************************************
- * trio_get_sign / trio_set_sign [public]
- */
-int
-trio_get_sign
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->flags & FLAGS_SHOWSIGN);
-}
-
-void
-trio_set_sign
-TRIO_ARGS2((ref, is_sign),
- trio_pointer_t ref,
- int is_sign)
-{
- if (is_sign)
- ((trio_reference_t *)ref)->parameter->flags |= FLAGS_SHOWSIGN;
- else
- ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_SHOWSIGN;
-}
-
-/*************************************************************************
- * trio_get_padding / trio_set_padding [public]
- */
-int
-trio_get_padding
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->flags & FLAGS_NILPADDING);
-}
-
-void
-trio_set_padding
-TRIO_ARGS2((ref, is_padding),
- trio_pointer_t ref,
- int is_padding)
-{
- if (is_padding)
- ((trio_reference_t *)ref)->parameter->flags |= FLAGS_NILPADDING;
- else
- ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_NILPADDING;
-}
-
-/*************************************************************************
- * trio_get_quote / trio_set_quote [public]
- */
-int
-trio_get_quote
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->flags & FLAGS_QUOTE);
-}
-
-void
-trio_set_quote
-TRIO_ARGS2((ref, is_quote),
- trio_pointer_t ref,
- int is_quote)
-{
- if (is_quote)
- ((trio_reference_t *)ref)->parameter->flags |= FLAGS_QUOTE;
- else
- ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_QUOTE;
-}
-
-/*************************************************************************
- * trio_get_upper / trio_set_upper [public]
- */
-int
-trio_get_upper
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->flags & FLAGS_UPPER);
-}
-
-void
-trio_set_upper
-TRIO_ARGS2((ref, is_upper),
- trio_pointer_t ref,
- int is_upper)
-{
- if (is_upper)
- ((trio_reference_t *)ref)->parameter->flags |= FLAGS_UPPER;
- else
- ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_UPPER;
-}
-
-/*************************************************************************
- * trio_get_largest / trio_set_largest [public]
- */
-#if TRIO_C99
-int
-trio_get_largest
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->flags & FLAGS_INTMAX_T);
-}
-
-void
-trio_set_largest
-TRIO_ARGS2((ref, is_largest),
- trio_pointer_t ref,
- int is_largest)
-{
- if (is_largest)
- ((trio_reference_t *)ref)->parameter->flags |= FLAGS_INTMAX_T;
- else
- ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_INTMAX_T;
-}
-#endif
-
-/*************************************************************************
- * trio_get_ptrdiff / trio_set_ptrdiff [public]
- */
-int
-trio_get_ptrdiff
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->flags & FLAGS_PTRDIFF_T);
-}
-
-void
-trio_set_ptrdiff
-TRIO_ARGS2((ref, is_ptrdiff),
- trio_pointer_t ref,
- int is_ptrdiff)
-{
- if (is_ptrdiff)
- ((trio_reference_t *)ref)->parameter->flags |= FLAGS_PTRDIFF_T;
- else
- ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_PTRDIFF_T;
-}
-
-/*************************************************************************
- * trio_get_size / trio_set_size [public]
- */
-#if TRIO_C99
-int
-trio_get_size
-TRIO_ARGS1((ref),
- trio_pointer_t ref)
-{
- return (((trio_reference_t *)ref)->parameter->flags & FLAGS_SIZE_T);
-}
-
-void
-trio_set_size
-TRIO_ARGS2((ref, is_size),
- trio_pointer_t ref,
- int is_size)
-{
- if (is_size)
- ((trio_reference_t *)ref)->parameter->flags |= FLAGS_SIZE_T;
- else
- ((trio_reference_t *)ref)->parameter->flags &= ~FLAGS_SIZE_T;
-}
-#endif
-
-/*************************************************************************
- * trio_print_int [public]
- */
-void
-trio_print_int
-TRIO_ARGS2((ref, number),
- trio_pointer_t ref,
- int number)
-{
- trio_reference_t *self = (trio_reference_t *)ref;
-
- TrioWriteNumber(self->data,
- (trio_uintmax_t)number,
- self->parameter->flags,
- self->parameter->width,
- self->parameter->precision,
- self->parameter->base);
-}
-
-/*************************************************************************
- * trio_print_uint [public]
- */
-void
-trio_print_uint
-TRIO_ARGS2((ref, number),
- trio_pointer_t ref,
- unsigned int number)
-{
- trio_reference_t *self = (trio_reference_t *)ref;
-
- TrioWriteNumber(self->data,
- (trio_uintmax_t)number,
- self->parameter->flags | FLAGS_UNSIGNED,
- self->parameter->width,
- self->parameter->precision,
- self->parameter->base);
-}
-
-/*************************************************************************
- * trio_print_double [public]
- */
-void
-trio_print_double
-TRIO_ARGS2((ref, number),
- trio_pointer_t ref,
- double number)
-{
- trio_reference_t *self = (trio_reference_t *)ref;
-
- TrioWriteDouble(self->data,
- number,
- self->parameter->flags,
- self->parameter->width,
- self->parameter->precision,
- self->parameter->base);
-}
-
-/*************************************************************************
- * trio_print_string [public]
- */
-void
-trio_print_string
-TRIO_ARGS2((ref, string),
- trio_pointer_t ref,
- char *string)
-{
- trio_reference_t *self = (trio_reference_t *)ref;
-
- TrioWriteString(self->data,
- string,
- self->parameter->flags,
- self->parameter->width,
- self->parameter->precision);
-}
-
-/*************************************************************************
- * trio_print_ref [public]
- */
-int
-trio_print_ref
-TRIO_VARGS3((ref, format, va_alist),
- trio_pointer_t ref,
- TRIO_CONST char *format,
- TRIO_VA_DECL)
-{
- int status;
- va_list arglist;
-
- assert(VALID(format));
-
- TRIO_VA_START(arglist, format);
- status = TrioFormatRef((trio_reference_t *)ref, format, &arglist, NULL);
- TRIO_VA_END(arglist);
- return status;
-}
-
-/*************************************************************************
- * trio_vprint_ref [public]
- */
-int
-trio_vprint_ref
-TRIO_ARGS3((ref, format, arglist),
- trio_pointer_t ref,
- TRIO_CONST char *format,
- va_list arglist)
-{
- assert(VALID(format));
-
- return TrioFormatRef((trio_reference_t *)ref, format, &arglist, NULL);
-}
-
-/*************************************************************************
- * trio_printv_ref [public]
- */
-int
-trio_printv_ref
-TRIO_ARGS3((ref, format, argarray),
- trio_pointer_t ref,
- TRIO_CONST char *format,
- trio_pointer_t *argarray)
-{
- assert(VALID(format));
-
- return TrioFormatRef((trio_reference_t *)ref, format, NULL, argarray);
-}
-
-#endif /* TRIO_EXTENSION */
-
-/*************************************************************************
- * trio_print_pointer [public]
- */
-void
-trio_print_pointer
-TRIO_ARGS2((ref, pointer),
- trio_pointer_t ref,
- trio_pointer_t pointer)
-{
- trio_reference_t *self = (trio_reference_t *)ref;
- unsigned long flags;
- trio_uintmax_t number;
-
- if (NULL == pointer)
- {
- TRIO_CONST char *string = internalNullString;
- while (*string)
- self->data->OutStream(self->data, *string++);
- }
- else
- {
- /*
- * The subtraction of the null pointer is a workaround
- * to avoid a compiler warning. The performance overhead
- * is negligible (and likely to be removed by an
- * optimizing compiler). The (char *) casting is done
- * to please ANSI C++.
- */
- number = (trio_uintmax_t)((char *)pointer - (char *)0);
- /* Shrink to size of pointer */
- number &= (trio_uintmax_t)-1;
- flags = self->parameter->flags;
- flags |= (FLAGS_UNSIGNED | FLAGS_ALTERNATIVE |
- FLAGS_NILPADDING);
- TrioWriteNumber(self->data,
- number,
- flags,
- POINTER_WIDTH,
- NO_PRECISION,
- BASE_HEX);
- }
-}
-
-/** @} End of UserDefined documentation module */
-
-/*************************************************************************
- *
- * LOCALES
- *
- ************************************************************************/
-
-/*************************************************************************
- * trio_locale_set_decimal_point
- *
- * Decimal point can only be one character. The input argument is a
- * string to enable multibyte characters. At most MB_LEN_MAX characters
- * will be used.
- */
-TRIO_PUBLIC void
-trio_locale_set_decimal_point
-TRIO_ARGS1((decimalPoint),
- char *decimalPoint)
-{
-#if defined(USE_LOCALE)
- if (NULL == internalLocaleValues)
- {
- TrioSetLocale();
- }
-#endif
- internalDecimalPointLength = trio_length(decimalPoint);
- if (internalDecimalPointLength == 1)
- {
- internalDecimalPoint = *decimalPoint;
- }
- else
- {
- internalDecimalPoint = NIL;
- trio_copy_max(internalDecimalPointString,
- sizeof(internalDecimalPointString),
- decimalPoint);
- }
-}
-
-/*************************************************************************
- * trio_locale_set_thousand_separator
- *
- * See trio_locale_set_decimal_point
- */
-TRIO_PUBLIC void
-trio_locale_set_thousand_separator
-TRIO_ARGS1((thousandSeparator),
- char *thousandSeparator)
-{
-#if defined(USE_LOCALE)
- if (NULL == internalLocaleValues)
- {
- TrioSetLocale();
- }
-#endif
- trio_copy_max(internalThousandSeparator,
- sizeof(internalThousandSeparator),
- thousandSeparator);
- internalThousandSeparatorLength = trio_length(internalThousandSeparator);
-}
-
-/*************************************************************************
- * trio_locale_set_grouping
- *
- * Array of bytes. Reversed order.
- *
- * CHAR_MAX : No further grouping
- * 0 : Repeat last group for the remaining digits (not necessary
- * as C strings are zero-terminated)
- * n : Set current group to n
- *
- * Same order as the grouping attribute in LC_NUMERIC.
- */
-TRIO_PUBLIC void
-trio_locale_set_grouping
-TRIO_ARGS1((grouping),
- char *grouping)
-{
-#if defined(USE_LOCALE)
- if (NULL == internalLocaleValues)
- {
- TrioSetLocale();
- }
-#endif
- trio_copy_max(internalGrouping,
- sizeof(internalGrouping),
- grouping);
-}
-
-
-/*************************************************************************
- *
- * SCANNING
- *
- ************************************************************************/
-
-/*************************************************************************
- * TrioSkipWhitespaces
- */
-TRIO_PRIVATE int
-TrioSkipWhitespaces
-TRIO_ARGS1((self),
- trio_class_t *self)
-{
- int ch;
-
- ch = self->current;
- while (isspace(ch))
- {
- self->InStream(self, &ch);
- }
- return ch;
-}
-
-/*************************************************************************
- * TrioGetCollation
- */
-#if TRIO_EXTENSION
-TRIO_PRIVATE void
-TrioGetCollation(TRIO_NOARGS)
-{
- int i;
- int j;
- int k;
- char first[2];
- char second[2];
-
- /* This is computational expensive */
- first[1] = NIL;
- second[1] = NIL;
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- {
- k = 0;
- first[0] = (char)i;
- for (j = 0; j < MAX_CHARACTER_CLASS; j++)
- {
- second[0] = (char)j;
- if (trio_equal_locale(first, second))
- internalCollationArray[i][k++] = (char)j;
- }
- internalCollationArray[i][k] = NIL;
- }
-}
-#endif
-
-/*************************************************************************
- * TrioGetCharacterClass
- *
- * FIXME:
- * multibyte
- */
-TRIO_PRIVATE int
-TrioGetCharacterClass
-TRIO_ARGS4((format, indexPointer, flagsPointer, characterclass),
- TRIO_CONST char *format,
- int *indexPointer,
- unsigned long *flagsPointer,
- int *characterclass)
-{
- int index = *indexPointer;
- int i;
- char ch;
- char range_begin;
- char range_end;
-
- *flagsPointer &= ~FLAGS_EXCLUDE;
-
- if (format[index] == QUALIFIER_CIRCUMFLEX)
- {
- *flagsPointer |= FLAGS_EXCLUDE;
- index++;
- }
- /*
- * If the ungroup character is at the beginning of the scanlist,
- * it will be part of the class, and a second ungroup character
- * must follow to end the group.
- */
- if (format[index] == SPECIFIER_UNGROUP)
- {
- characterclass[(int)SPECIFIER_UNGROUP]++;
- index++;
- }
- /*
- * Minus is used to specify ranges. To include minus in the class,
- * it must be at the beginning of the list
- */
- if (format[index] == QUALIFIER_MINUS)
- {
- characterclass[(int)QUALIFIER_MINUS]++;
- index++;
- }
- /* Collect characters */
- for (ch = format[index];
- (ch != SPECIFIER_UNGROUP) && (ch != NIL);
- ch = format[++index])
- {
- switch (ch)
- {
- case QUALIFIER_MINUS: /* Scanlist ranges */
-
- /*
- * Both C99 and UNIX98 describes ranges as implementation-
- * defined.
- *
- * We support the following behaviour (although this may
- * change as we become wiser)
- * - only increasing ranges, ie. [a-b] but not [b-a]
- * - transitive ranges, ie. [a-b-c] == [a-c]
- * - trailing minus, ie. [a-] is interpreted as an 'a'
- * and a '-'
- * - duplicates (although we can easily convert these
- * into errors)
- */
- range_begin = format[index - 1];
- range_end = format[++index];
- if (range_end == SPECIFIER_UNGROUP)
- {
- /* Trailing minus is included */
- characterclass[(int)ch]++;
- ch = range_end;
- break; /* for */
- }
- if (range_end == NIL)
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- if (range_begin > range_end)
- return TRIO_ERROR_RETURN(TRIO_ERANGE, index);
-
- for (i = (int)range_begin; i <= (int)range_end; i++)
- characterclass[i]++;
-
- ch = range_end;
- break;
-
-#if TRIO_EXTENSION
-
- case SPECIFIER_GROUP:
-
- switch (format[index + 1])
- {
- case QUALIFIER_DOT: /* Collating symbol */
- /*
- * FIXME: This will be easier to implement when multibyte
- * characters have been implemented. Until now, we ignore
- * this feature.
- */
- for (i = index + 2; ; i++)
- {
- if (format[i] == NIL)
- /* Error in syntax */
- return -1;
- else if (format[i] == QUALIFIER_DOT)
- break; /* for */
- }
- if (format[++i] != SPECIFIER_UNGROUP)
- return -1;
-
- index = i;
- break;
-
- case QUALIFIER_EQUAL: /* Equivalence class expressions */
- {
- unsigned int j;
- unsigned int k;
-
- if (internalCollationUnconverted)
- {
- /* Lazy evaluation of collation array */
- TrioGetCollation();
- internalCollationUnconverted = FALSE;
- }
- for (i = index + 2; ; i++)
- {
- if (format[i] == NIL)
- /* Error in syntax */
- return -1;
- else if (format[i] == QUALIFIER_EQUAL)
- break; /* for */
- else
- {
- /* Mark any equivalent character */
- k = (unsigned int)format[i];
- for (j = 0; internalCollationArray[k][j] != NIL; j++)
- characterclass[(int)internalCollationArray[k][j]]++;
- }
- }
- if (format[++i] != SPECIFIER_UNGROUP)
- return -1;
-
- index = i;
- }
- break;
-
- case QUALIFIER_COLON: /* Character class expressions */
-
- if (trio_equal_max(CLASS_ALNUM, sizeof(CLASS_ALNUM) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isalnum(i))
- characterclass[i]++;
- index += sizeof(CLASS_ALNUM) - 1;
- }
- else if (trio_equal_max(CLASS_ALPHA, sizeof(CLASS_ALPHA) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isalpha(i))
- characterclass[i]++;
- index += sizeof(CLASS_ALPHA) - 1;
- }
- else if (trio_equal_max(CLASS_CNTRL, sizeof(CLASS_CNTRL) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (iscntrl(i))
- characterclass[i]++;
- index += sizeof(CLASS_CNTRL) - 1;
- }
- else if (trio_equal_max(CLASS_DIGIT, sizeof(CLASS_DIGIT) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isdigit(i))
- characterclass[i]++;
- index += sizeof(CLASS_DIGIT) - 1;
- }
- else if (trio_equal_max(CLASS_GRAPH, sizeof(CLASS_GRAPH) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isgraph(i))
- characterclass[i]++;
- index += sizeof(CLASS_GRAPH) - 1;
- }
- else if (trio_equal_max(CLASS_LOWER, sizeof(CLASS_LOWER) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (islower(i))
- characterclass[i]++;
- index += sizeof(CLASS_LOWER) - 1;
- }
- else if (trio_equal_max(CLASS_PRINT, sizeof(CLASS_PRINT) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isprint(i))
- characterclass[i]++;
- index += sizeof(CLASS_PRINT) - 1;
- }
- else if (trio_equal_max(CLASS_PUNCT, sizeof(CLASS_PUNCT) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (ispunct(i))
- characterclass[i]++;
- index += sizeof(CLASS_PUNCT) - 1;
- }
- else if (trio_equal_max(CLASS_SPACE, sizeof(CLASS_SPACE) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isspace(i))
- characterclass[i]++;
- index += sizeof(CLASS_SPACE) - 1;
- }
- else if (trio_equal_max(CLASS_UPPER, sizeof(CLASS_UPPER) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isupper(i))
- characterclass[i]++;
- index += sizeof(CLASS_UPPER) - 1;
- }
- else if (trio_equal_max(CLASS_XDIGIT, sizeof(CLASS_XDIGIT) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isxdigit(i))
- characterclass[i]++;
- index += sizeof(CLASS_XDIGIT) - 1;
- }
- else
- {
- characterclass[(int)ch]++;
- }
- break;
-
- default:
- characterclass[(int)ch]++;
- break;
- }
- break;
-
-#endif /* TRIO_EXTENSION */
-
- default:
- characterclass[(int)ch]++;
- break;
- }
- }
- return 0;
-}
-
-/*************************************************************************
- * TrioReadNumber
- *
- * We implement our own number conversion in preference of strtol and
- * strtoul, because we must handle 'long long' and thousand separators.
- */
-TRIO_PRIVATE BOOLEAN_T
-TrioReadNumber
-TRIO_ARGS5((self, target, flags, width, base),
- trio_class_t *self,
- trio_uintmax_t *target,
- unsigned long flags,
- int width,
- int base)
-{
- trio_uintmax_t number = 0;
- int digit;
- int count;
- BOOLEAN_T isNegative = FALSE;
- BOOLEAN_T gotNumber = FALSE;
- int j;
-
- assert(VALID(self));
- assert(VALID(self->InStream));
- assert((base >= MIN_BASE && base <= MAX_BASE) || (base == NO_BASE));
-
- if (internalDigitsUnconverted)
- {
- /* Lazy evaluation of digits array */
- memset(internalDigitArray, -1, sizeof(internalDigitArray));
- for (j = 0; j < (int)sizeof(internalDigitsLower) - 1; j++)
- {
- internalDigitArray[(int)internalDigitsLower[j]] = j;
- internalDigitArray[(int)internalDigitsUpper[j]] = j;
- }
- internalDigitsUnconverted = FALSE;
- }
-
- TrioSkipWhitespaces(self);
-
- if (!(flags & FLAGS_UNSIGNED))
- {
- /* Leading sign */
- if (self->current == '+')
- {
- self->InStream(self, NULL);
- }
- else if (self->current == '-')
- {
- self->InStream(self, NULL);
- isNegative = TRUE;
- }
- }
-
- count = self->processed;
-
- if (flags & FLAGS_ALTERNATIVE)
- {
- switch (base)
- {
- case NO_BASE:
- case BASE_OCTAL:
- case BASE_HEX:
- case BASE_BINARY:
- if (self->current == '0')
- {
- self->InStream(self, NULL);
- if (self->current)
- {
- if ((base == BASE_HEX) &&
- (toupper(self->current) == 'X'))
- {
- self->InStream(self, NULL);
- }
- else if ((base == BASE_BINARY) &&
- (toupper(self->current) == 'B'))
- {
- self->InStream(self, NULL);
- }
- }
- }
- else
- return FALSE;
- break;
- default:
- break;
- }
- }
-
- while (((width == NO_WIDTH) || (self->processed - count < width)) &&
- (! ((self->current == EOF) || isspace(self->current))))
- {
- if (isascii(self->current))
- {
- digit = internalDigitArray[self->current];
- /* Abort if digit is not allowed in the specified base */
- if ((digit == -1) || (digit >= base))
- break;
- }
- else if (flags & FLAGS_QUOTE)
- {
- /* Compare with thousands separator */
- for (j = 0; internalThousandSeparator[j] && self->current; j++)
- {
- if (internalThousandSeparator[j] != self->current)
- break;
-
- self->InStream(self, NULL);
- }
- if (internalThousandSeparator[j])
- break; /* Mismatch */
- else
- continue; /* Match */
- }
- else
- break;
-
- number *= base;
- number += digit;
- gotNumber = TRUE; /* we need at least one digit */
-
- self->InStream(self, NULL);
- }
-
- /* Was anything read at all? */
- if (!gotNumber)
- return FALSE;
-
- if (target)
- *target = (isNegative) ? -((trio_intmax_t)number) : number;
- return TRUE;
-}
-
-/*************************************************************************
- * TrioReadChar
- */
-TRIO_PRIVATE int
-TrioReadChar
-TRIO_ARGS4((self, target, flags, width),
- trio_class_t *self,
- char *target,
- unsigned long flags,
- int width)
-{
- int i;
- char ch;
- trio_uintmax_t number;
-
- assert(VALID(self));
- assert(VALID(self->InStream));
-
- for (i = 0;
- (self->current != EOF) && (i < width);
- i++)
- {
- ch = (char)self->current;
- self->InStream(self, NULL);
- if ((flags & FLAGS_ALTERNATIVE) && (ch == CHAR_BACKSLASH))
- {
- switch (self->current)
- {
- case '\\': ch = '\\'; break;
- case 'a': ch = '\007'; break;
- case 'b': ch = '\b'; break;
- case 'f': ch = '\f'; break;
- case 'n': ch = '\n'; break;
- case 'r': ch = '\r'; break;
- case 't': ch = '\t'; break;
- case 'v': ch = '\v'; break;
- default:
- if (isdigit(self->current))
- {
- /* Read octal number */
- if (!TrioReadNumber(self, &number, 0, 3, BASE_OCTAL))
- return 0;
- ch = (char)number;
- }
- else if (toupper(self->current) == 'X')
- {
- /* Read hexadecimal number */
- self->InStream(self, NULL);
- if (!TrioReadNumber(self, &number, 0, 2, BASE_HEX))
- return 0;
- ch = (char)number;
- }
- else
- {
- ch = (char)self->current;
- }
- break;
- }
- }
-
- if (target)
- target[i] = ch;
- }
- return i + 1;
-}
-
-/*************************************************************************
- * TrioReadString
- */
-TRIO_PRIVATE BOOLEAN_T
-TrioReadString
-TRIO_ARGS4((self, target, flags, width),
- trio_class_t *self,
- char *target,
- unsigned long flags,
- int width)
-{
- int i;
-
- assert(VALID(self));
- assert(VALID(self->InStream));
-
- TrioSkipWhitespaces(self);
-
- /*
- * Continue until end of string is reached, a whitespace is encountered,
- * or width is exceeded
- */
- for (i = 0;
- ((width == NO_WIDTH) || (i < width)) &&
- (! ((self->current == EOF) || isspace(self->current)));
- i++)
- {
- if (TrioReadChar(self, (target ? &target[i] : 0), flags, 1) == 0)
- break; /* for */
- }
- if (target)
- target[i] = NIL;
- return TRUE;
-}
-
-/*************************************************************************
- * TrioReadWideChar
- */
-#if TRIO_WIDECHAR
-TRIO_PRIVATE int
-TrioReadWideChar
-TRIO_ARGS4((self, target, flags, width),
- trio_class_t *self,
- trio_wchar_t *target,
- unsigned long flags,
- int width)
-{
- int i;
- int j;
- int size;
- int amount = 0;
- trio_wchar_t wch;
- char buffer[MB_LEN_MAX + 1];
-
- assert(VALID(self));
- assert(VALID(self->InStream));
-
- for (i = 0;
- (self->current != EOF) && (i < width);
- i++)
- {
- if (isascii(self->current))
- {
- if (TrioReadChar(self, buffer, flags, 1) == 0)
- return 0;
- buffer[1] = NIL;
- }
- else
- {
- /*
- * Collect a multibyte character, by enlarging buffer until
- * it contains a fully legal multibyte character, or the
- * buffer is full.
- */
- j = 0;
- do
- {
- buffer[j++] = (char)self->current;
- buffer[j] = NIL;
- self->InStream(self, NULL);
- }
- while ((j < (int)sizeof(buffer)) && (mblen(buffer, (size_t)j) != j));
- }
- if (target)
- {
- size = mbtowc(&wch, buffer, sizeof(buffer));
- if (size > 0)
- target[i] = wch;
- }
- amount += size;
- self->InStream(self, NULL);
- }
- return amount;
-}
-#endif /* TRIO_WIDECHAR */
-
-/*************************************************************************
- * TrioReadWideString
- */
-#if TRIO_WIDECHAR
-TRIO_PRIVATE BOOLEAN_T
-TrioReadWideString
-TRIO_ARGS4((self, target, flags, width),
- trio_class_t *self,
- trio_wchar_t *target,
- unsigned long flags,
- int width)
-{
- int i;
- int size;
-
- assert(VALID(self));
- assert(VALID(self->InStream));
-
- TrioSkipWhitespaces(self);
-
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- (void)mblen(NULL, 0);
-#endif
-
- /*
- * Continue until end of string is reached, a whitespace is encountered,
- * or width is exceeded
- */
- for (i = 0;
- ((width == NO_WIDTH) || (i < width)) &&
- (! ((self->current == EOF) || isspace(self->current)));
- )
- {
- size = TrioReadWideChar(self, &target[i], flags, 1);
- if (size == 0)
- break; /* for */
-
- i += size;
- }
- if (target)
- target[i] = WCONST('\0');
- return TRUE;
-}
-#endif /* TRIO_WIDECHAR */
-
-/*************************************************************************
- * TrioReadGroup
- *
- * FIXME: characterclass does not work with multibyte characters
- */
-TRIO_PRIVATE BOOLEAN_T
-TrioReadGroup
-TRIO_ARGS5((self, target, characterclass, flags, width),
- trio_class_t *self,
- char *target,
- int *characterclass,
- unsigned long flags,
- int width)
-{
- int ch;
- int i;
-
- assert(VALID(self));
- assert(VALID(self->InStream));
-
- ch = self->current;
- for (i = 0;
- ((width == NO_WIDTH) || (i < width)) &&
- (! ((ch == EOF) ||
- (((flags & FLAGS_EXCLUDE) != 0) ^ (characterclass[ch] == 0))));
- i++)
- {
- if (target)
- target[i] = (char)ch;
- self->InStream(self, &ch);
- }
-
- if (target)
- target[i] = NIL;
- return TRUE;
-}
-
-/*************************************************************************
- * TrioReadDouble
- *
- * FIXME:
- * add long double
- * handle base
- */
-TRIO_PRIVATE BOOLEAN_T
-TrioReadDouble
-TRIO_ARGS4((self, target, flags, width),
- trio_class_t *self,
- trio_pointer_t target,
- unsigned long flags,
- int width)
-{
- int ch;
- char doubleString[512];
- int index = 0;
- int start;
- int j;
- BOOLEAN_T isHex = FALSE;
-
- doubleString[0] = 0;
-
- if ((width == NO_WIDTH) || (width > (int)sizeof(doubleString) - 1))
- width = sizeof(doubleString) - 1;
-
- TrioSkipWhitespaces(self);
-
- /*
- * Read entire double number from stream. trio_to_double requires
- * a string as input, but InStream can be anything, so we have to
- * collect all characters.
- */
- ch = self->current;
- if ((ch == '+') || (ch == '-'))
- {
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- width--;
- }
-
- start = index;
- switch (ch)
- {
- case 'n':
- case 'N':
- /* Not-a-number */
- if (index != 0)
- break;
- /* FALLTHROUGH */
- case 'i':
- case 'I':
- /* Infinity */
- while (isalpha(ch) && (index - start < width))
- {
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- }
- doubleString[index] = NIL;
-
- /* Case insensitive string comparison */
- if (trio_equal(&doubleString[start], INFINITE_UPPER) ||
- trio_equal(&doubleString[start], LONG_INFINITE_UPPER))
- {
- if (flags & FLAGS_LONGDOUBLE)
- {
- if ((start == 1) && (doubleString[0] == '-'))
- {
- *((trio_long_double_t *)target) = trio_ninf();
- }
- else
- {
- *((trio_long_double_t *)target) = trio_pinf();
- }
- }
- else
- {
- if ((start == 1) && (doubleString[0] == '-'))
- {
- *((double *)target) = trio_ninf();
- }
- else
- {
- *((double *)target) = trio_pinf();
- }
- }
- return TRUE;
- }
- if (trio_equal(doubleString, NAN_UPPER))
- {
- /* NaN must not have a preceeding + nor - */
- if (flags & FLAGS_LONGDOUBLE)
- {
- *((trio_long_double_t *)target) = trio_nan();
- }
- else
- {
- *((double *)target) = trio_nan();
- }
- return TRUE;
- }
- return FALSE;
-
- case '0':
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- if (toupper(ch) == 'X')
- {
- isHex = TRUE;
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- }
- break;
-
- default:
- break;
- }
-
- while ((ch != EOF) && (index - start < width))
- {
- /* Integer part */
- if (isHex ? isxdigit(ch) : isdigit(ch))
- {
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- }
- else if (flags & FLAGS_QUOTE)
- {
- /* Compare with thousands separator */
- for (j = 0; internalThousandSeparator[j] && self->current; j++)
- {
- if (internalThousandSeparator[j] != self->current)
- break;
-
- self->InStream(self, &ch);
- }
- if (internalThousandSeparator[j])
- break; /* Mismatch */
- else
- continue; /* Match */
- }
- else
- break; /* while */
- }
- if (ch == '.')
- {
- /* Decimal part */
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- while ((isHex ? isxdigit(ch) : isdigit(ch)) &&
- (index - start < width))
- {
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- }
- if (isHex ? (toupper(ch) == 'P') : (toupper(ch) == 'E'))
- {
- /* Exponent */
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- if ((ch == '+') || (ch == '-'))
- {
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- }
- while ((isHex ? isxdigit(ch) : isdigit(ch)) &&
- (index - start < width))
- {
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- }
- }
- }
-
- if ((index == start) || (*doubleString == NIL))
- return FALSE;
-
- doubleString[index] = 0;
-
- if (flags & FLAGS_LONGDOUBLE)
- {
- *((trio_long_double_t *)target) = trio_to_long_double(doubleString, NULL);
- }
- else
- {
- *((double *)target) = trio_to_double(doubleString, NULL);
- }
- return TRUE;
-}
-
-/*************************************************************************
- * TrioReadPointer
- */
-TRIO_PRIVATE BOOLEAN_T
-TrioReadPointer
-TRIO_ARGS3((self, target, flags),
- trio_class_t *self,
- trio_pointer_t *target,
- unsigned long flags)
-{
- trio_uintmax_t number;
- char buffer[sizeof(internalNullString)];
-
- flags |= (FLAGS_UNSIGNED | FLAGS_ALTERNATIVE | FLAGS_NILPADDING);
-
- if (TrioReadNumber(self,
- &number,
- flags,
- POINTER_WIDTH,
- BASE_HEX))
- {
- /*
- * The strange assignment of number is a workaround for a compiler
- * warning
- */
- if (target)
- *target = (char *)0 + number;
- return TRUE;
- }
- else if (TrioReadString(self,
- (flags & FLAGS_IGNORE)
- ? NULL
- : buffer,
- 0,
- sizeof(internalNullString) - 1))
- {
- if (trio_equal_case(buffer, internalNullString))
- {
- if (target)
- *target = NULL;
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/*************************************************************************
- * TrioScanProcess
- */
-TRIO_PRIVATE int
-TrioScanProcess
-TRIO_ARGS3((data, format, parameters),
- trio_class_t *data,
- TRIO_CONST char *format,
- trio_parameter_t *parameters)
-{
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- int charlen;
- int cnt;
-#endif
- int assignment;
- int ch;
- int index; /* Index of format string */
- int i; /* Index of current parameter */
- unsigned long flags;
- int width;
- int base;
- trio_pointer_t pointer;
-
- assignment = 0;
- i = 0;
- index = 0;
- data->InStream(data, &ch);
-
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- (void)mblen(NULL, 0);
-#endif
-
- while (format[index])
- {
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- if (! isascii(format[index]))
- {
- charlen = mblen(&format[index], MB_LEN_MAX);
- if (charlen != -1)
- {
- /* Compare multibyte characters in format string */
- for (cnt = 0; cnt < charlen - 1; cnt++)
- {
- if (ch != format[index + cnt])
- {
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- }
- data->InStream(data, &ch);
- }
- continue; /* while characters left in formatting string */
- }
- }
-#endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */
-
- if ((EOF == ch) && (parameters[i].type != FORMAT_COUNT))
- {
- return (assignment > 0) ? assignment : EOF;
- }
-
- if (CHAR_IDENTIFIER == format[index])
- {
- if (CHAR_IDENTIFIER == format[index + 1])
- {
- /* Two % in format matches one % in input stream */
- if (CHAR_IDENTIFIER == ch)
- {
- data->InStream(data, &ch);
- index += 2;
- continue; /* while format chars left */
- }
- else
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- }
-
- /* Skip the parameter entries */
- while (parameters[i].type == FORMAT_PARAMETER)
- i++;
-
- flags = parameters[i].flags;
- /* Find width */
- width = parameters[i].width;
- if (flags & FLAGS_WIDTH_PARAMETER)
- {
- /* Get width from parameter list */
- width = (int)parameters[width].data.number.as_signed;
- }
- /* Find base */
- base = parameters[i].base;
- if (flags & FLAGS_BASE_PARAMETER)
- {
- /* Get base from parameter list */
- base = (int)parameters[base].data.number.as_signed;
- }
-
- switch (parameters[i].type)
- {
- case FORMAT_INT:
- {
- trio_uintmax_t number;
-
- if (0 == base)
- base = BASE_DECIMAL;
-
- if (!TrioReadNumber(data,
- &number,
- flags,
- width,
- base))
- return assignment;
-
- if (!(flags & FLAGS_IGNORE))
- {
- assignment++;
-
- pointer = parameters[i].data.pointer;
-#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER)
- if (flags & FLAGS_SIZE_T)
- *(size_t *)pointer = (size_t)number;
- else
-#endif
-#if defined(QUALIFIER_PTRDIFF_T)
- if (flags & FLAGS_PTRDIFF_T)
- *(ptrdiff_t *)pointer = (ptrdiff_t)number;
- else
-#endif
-#if defined(QUALIFIER_INTMAX_T)
- if (flags & FLAGS_INTMAX_T)
- *(trio_intmax_t *)pointer = (trio_intmax_t)number;
- else
-#endif
- if (flags & FLAGS_QUAD)
- *(trio_ulonglong_t *)pointer = (trio_ulonglong_t)number;
- else if (flags & FLAGS_LONG)
- *(long int *)pointer = (long int)number;
- else if (flags & FLAGS_SHORT)
- *(short int *)pointer = (short int)number;
- else
- *(int *)pointer = (int)number;
- }
- }
- break; /* FORMAT_INT */
-
- case FORMAT_STRING:
-#if TRIO_WIDECHAR
- if (flags & FLAGS_WIDECHAR)
- {
- if (!TrioReadWideString(data,
- (flags & FLAGS_IGNORE)
- ? NULL
- : parameters[i].data.wstring,
- flags,
- width))
- return assignment;
- }
- else
-#endif
- {
- if (!TrioReadString(data,
- (flags & FLAGS_IGNORE)
- ? NULL
- : parameters[i].data.string,
- flags,
- width))
- return assignment;
- }
- if (!(flags & FLAGS_IGNORE))
- assignment++;
- break; /* FORMAT_STRING */
-
- case FORMAT_DOUBLE:
- {
- trio_pointer_t pointer;
-
- if (flags & FLAGS_IGNORE)
- {
- pointer = NULL;
- }
- else
- {
- pointer = (flags & FLAGS_LONGDOUBLE)
- ? (trio_pointer_t)parameters[i].data.longdoublePointer
- : (trio_pointer_t)parameters[i].data.doublePointer;
- }
- if (!TrioReadDouble(data, pointer, flags, width))
- {
- return assignment;
- }
- if (!(flags & FLAGS_IGNORE))
- {
- assignment++;
- }
- break; /* FORMAT_DOUBLE */
- }
- case FORMAT_GROUP:
- {
- int characterclass[MAX_CHARACTER_CLASS + 1];
- int rc;
-
- /* Skip over modifiers */
- while (format[index] != SPECIFIER_GROUP)
- {
- index++;
- }
- /* Skip over group specifier */
- index++;
-
- memset(characterclass, 0, sizeof(characterclass));
- rc = TrioGetCharacterClass(format,
- &index,
- &flags,
- characterclass);
- if (rc < 0)
- return rc;
-
- if (!TrioReadGroup(data,
- (flags & FLAGS_IGNORE)
- ? NULL
- : parameters[i].data.string,
- characterclass,
- flags,
- parameters[i].width))
- return assignment;
- if (!(flags & FLAGS_IGNORE))
- assignment++;
- }
- break; /* FORMAT_GROUP */
-
- case FORMAT_COUNT:
- pointer = parameters[i].data.pointer;
- if (NULL != pointer)
- {
- int count = data->committed;
- if (ch != EOF)
- count--; /* a character is read, but is not consumed yet */
-#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER)
- if (flags & FLAGS_SIZE_T)
- *(size_t *)pointer = (size_t)count;
- else
-#endif
-#if defined(QUALIFIER_PTRDIFF_T)
- if (flags & FLAGS_PTRDIFF_T)
- *(ptrdiff_t *)pointer = (ptrdiff_t)count;
- else
-#endif
-#if defined(QUALIFIER_INTMAX_T)
- if (flags & FLAGS_INTMAX_T)
- *(trio_intmax_t *)pointer = (trio_intmax_t)count;
- else
-#endif
- if (flags & FLAGS_QUAD)
- {
- *(trio_ulonglong_t *)pointer = (trio_ulonglong_t)count;
- }
- else if (flags & FLAGS_LONG)
- {
- *(long int *)pointer = (long int)count;
- }
- else if (flags & FLAGS_SHORT)
- {
- *(short int *)pointer = (short int)count;
- }
- else
- {
- *(int *)pointer = (int)count;
- }
- }
- break; /* FORMAT_COUNT */
-
- case FORMAT_CHAR:
-#if TRIO_WIDECHAR
- if (flags & FLAGS_WIDECHAR)
- {
- if (TrioReadWideChar(data,
- (flags & FLAGS_IGNORE)
- ? NULL
- : parameters[i].data.wstring,
- flags,
- (width == NO_WIDTH) ? 1 : width) == 0)
- return assignment;
- }
- else
-#endif
- {
- if (TrioReadChar(data,
- (flags & FLAGS_IGNORE)
- ? NULL
- : parameters[i].data.string,
- flags,
- (width == NO_WIDTH) ? 1 : width) == 0)
- return assignment;
- }
- if (!(flags & FLAGS_IGNORE))
- assignment++;
- break; /* FORMAT_CHAR */
-
- case FORMAT_POINTER:
- if (!TrioReadPointer(data,
- (flags & FLAGS_IGNORE)
- ? NULL
- : (trio_pointer_t *)parameters[i].data.pointer,
- flags))
- return assignment;
- if (!(flags & FLAGS_IGNORE))
- assignment++;
- break; /* FORMAT_POINTER */
-
- case FORMAT_PARAMETER:
- break; /* FORMAT_PARAMETER */
-
- default:
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- }
- ch = data->current;
- index = parameters[i].indexAfterSpecifier;
- i++;
- }
- else /* Not an % identifier */
- {
- if (isspace((int)format[index]))
- {
- /* Whitespaces may match any amount of whitespaces */
- ch = TrioSkipWhitespaces(data);
- }
- else if (ch == format[index])
- {
- data->InStream(data, &ch);
- }
- else
- return assignment;
-
- index++;
- }
- }
- return assignment;
-}
-
-/*************************************************************************
- * TrioScan
- */
-TRIO_PRIVATE int
-TrioScan
-TRIO_ARGS6((source, sourceSize, InStream, format, arglist, argarray),
- trio_pointer_t source,
- size_t sourceSize,
- void (*InStream) TRIO_PROTO((trio_class_t *, int *)),
- TRIO_CONST char *format,
- va_list *arglist,
- trio_pointer_t *argarray)
-{
- int status;
- trio_parameter_t parameters[MAX_PARAMETERS];
- trio_class_t data;
-
- assert(VALID(InStream));
- assert(VALID(format));
-
- memset(&data, 0, sizeof(data));
- data.InStream = InStream;
- data.location = (trio_pointer_t)source;
- data.max = sourceSize;
- data.error = 0;
-
-#if defined(USE_LOCALE)
- if (NULL == internalLocaleValues)
- {
- TrioSetLocale();
- }
-#endif
-
- status = TrioParse(TYPE_SCAN, format, parameters, arglist, argarray);
- if (status < 0)
- return status;
-
- status = TrioScanProcess(&data, format, parameters);
- if (data.error != 0)
- {
- status = data.error;
- }
- return status;
-}
-
-/*************************************************************************
- * TrioInStreamFile
- */
-TRIO_PRIVATE void
-TrioInStreamFile
-TRIO_ARGS2((self, intPointer),
- trio_class_t *self,
- int *intPointer)
-{
- FILE *file = (FILE *)self->location;
-
- assert(VALID(self));
- assert(VALID(file));
-
- self->current = fgetc(file);
- if (self->current == EOF)
- {
- self->error = (ferror(file))
- ? TRIO_ERROR_RETURN(TRIO_ERRNO, 0)
- : TRIO_ERROR_RETURN(TRIO_EOF, 0);
- }
- else
- {
- self->processed++;
- self->committed++;
- }
-
- if (VALID(intPointer))
- {
- *intPointer = self->current;
- }
-}
-
-/*************************************************************************
- * TrioInStreamFileDescriptor
- */
-TRIO_PRIVATE void
-TrioInStreamFileDescriptor
-TRIO_ARGS2((self, intPointer),
- trio_class_t *self,
- int *intPointer)
-{
- int fd = *((int *)self->location);
- int size;
- unsigned char input;
-
- assert(VALID(self));
-
- size = read(fd, &input, sizeof(char));
- if (size == -1)
- {
- self->error = TRIO_ERROR_RETURN(TRIO_ERRNO, 0);
- self->current = EOF;
- }
- else
- {
- self->current = (size == 0) ? EOF : input;
- }
- if (self->current != EOF)
- {
- self->committed++;
- self->processed++;
- }
-
- if (VALID(intPointer))
- {
- *intPointer = self->current;
- }
-}
-
-/*************************************************************************
- * TrioInStreamCustom
- */
-TRIO_PRIVATE void
-TrioInStreamCustom
-TRIO_ARGS2((self, intPointer),
- trio_class_t *self,
- int *intPointer)
-{
- trio_custom_t *data;
-
- assert(VALID(self));
- assert(VALID(self->location));
-
- data = (trio_custom_t *)self->location;
-
- self->current = (data->stream.in == NULL)
- ? NIL
- : (data->stream.in)(data->closure);
-
- if (self->current == NIL)
- {
- self->current = EOF;
- }
- else
- {
- self->processed++;
- self->committed++;
- }
-
- if (VALID(intPointer))
- {
- *intPointer = self->current;
- }
-}
-
-/*************************************************************************
- * TrioInStreamString
- */
-TRIO_PRIVATE void
-TrioInStreamString
-TRIO_ARGS2((self, intPointer),
- trio_class_t *self,
- int *intPointer)
-{
- unsigned char **buffer;
-
- assert(VALID(self));
- assert(VALID(self->location));
-
- buffer = (unsigned char **)self->location;
- self->current = (*buffer)[0];
- if (self->current == NIL)
- {
- self->current = EOF;
- }
- else
- {
- (*buffer)++;
- self->processed++;
- self->committed++;
- }
-
- if (VALID(intPointer))
- {
- *intPointer = self->current;
- }
-}
-
-/*************************************************************************
- *
- * Formatted scanning functions
- *
- ************************************************************************/
-
-#if defined(TRIO_DOCUMENTATION)
-# include "doc/doc_scanf.h"
-#endif
-/** @addtogroup Scanf
- @{
-*/
-
-/*************************************************************************
- * scanf
- */
-
-/**
- Scan characters from standard input stream.
-
- @param format Formatting string.
- @param ... Arguments.
- @return Number of scanned characters.
- */
-TRIO_PUBLIC int
-trio_scanf
-TRIO_VARGS2((format, va_alist),
- TRIO_CONST char *format,
- TRIO_VA_DECL)
-{
- int status;
- va_list args;
-
- assert(VALID(format));
-
- TRIO_VA_START(args, format);
- status = TrioScan((trio_pointer_t)stdin, 0,
- TrioInStreamFile,
- format, &args, NULL);
- TRIO_VA_END(args);
- return status;
-}
-
-TRIO_PUBLIC int
-trio_vscanf
-TRIO_ARGS2((format, args),
- TRIO_CONST char *format,
- va_list args)
-{
- assert(VALID(format));
-
- return TrioScan((trio_pointer_t)stdin, 0,
- TrioInStreamFile,
- format, &args, NULL);
-}
-
-TRIO_PUBLIC int
-trio_scanfv
-TRIO_ARGS2((format, args),
- TRIO_CONST char *format,
- trio_pointer_t *args)
-{
- assert(VALID(format));
-
- return TrioScan((trio_pointer_t)stdin, 0,
- TrioInStreamFile,
- format, NULL, args);
-}
-
-/*************************************************************************
- * fscanf
- */
-TRIO_PUBLIC int
-trio_fscanf
-TRIO_VARGS3((file, format, va_alist),
- FILE *file,
- TRIO_CONST char *format,
- TRIO_VA_DECL)
-{
- int status;
- va_list args;
-
- assert(VALID(file));
- assert(VALID(format));
-
- TRIO_VA_START(args, format);
- status = TrioScan((trio_pointer_t)file, 0,
- TrioInStreamFile,
- format, &args, NULL);
- TRIO_VA_END(args);
- return status;
-}
-
-TRIO_PUBLIC int
-trio_vfscanf
-TRIO_ARGS3((file, format, args),
- FILE *file,
- TRIO_CONST char *format,
- va_list args)
-{
- assert(VALID(file));
- assert(VALID(format));
-
- return TrioScan((trio_pointer_t)file, 0,
- TrioInStreamFile,
- format, &args, NULL);
-}
-
-TRIO_PUBLIC int
-trio_fscanfv
-TRIO_ARGS3((file, format, args),
- FILE *file,
- TRIO_CONST char *format,
- trio_pointer_t *args)
-{
- assert(VALID(file));
- assert(VALID(format));
-
- return TrioScan((trio_pointer_t)file, 0,
- TrioInStreamFile,
- format, NULL, args);
-}
-
-/*************************************************************************
- * dscanf
- */
-TRIO_PUBLIC int
-trio_dscanf
-TRIO_VARGS3((fd, format, va_alist),
- int fd,
- TRIO_CONST char *format,
- TRIO_VA_DECL)
-{
- int status;
- va_list args;
-
- assert(VALID(format));
-
- TRIO_VA_START(args, format);
- status = TrioScan((trio_pointer_t)&fd, 0,
- TrioInStreamFileDescriptor,
- format, &args, NULL);
- TRIO_VA_END(args);
- return status;
-}
-
-TRIO_PUBLIC int
-trio_vdscanf
-TRIO_ARGS3((fd, format, args),
- int fd,
- TRIO_CONST char *format,
- va_list args)
-{
- assert(VALID(format));
-
- return TrioScan((trio_pointer_t)&fd, 0,
- TrioInStreamFileDescriptor,
- format, &args, NULL);
-}
-
-TRIO_PUBLIC int
-trio_dscanfv
-TRIO_ARGS3((fd, format, args),
- int fd,
- TRIO_CONST char *format,
- trio_pointer_t *args)
-{
- assert(VALID(format));
-
- return TrioScan((trio_pointer_t)&fd, 0,
- TrioInStreamFileDescriptor,
- format, NULL, args);
-}
-
-/*************************************************************************
- * cscanf
- */
-TRIO_PUBLIC int
-trio_cscanf
-TRIO_VARGS4((stream, closure, format, va_alist),
- trio_instream_t stream,
- trio_pointer_t closure,
- TRIO_CONST char *format,
- TRIO_VA_DECL)
-{
- int status;
- va_list args;
- trio_custom_t data;
-
- assert(VALID(stream));
- assert(VALID(format));
-
- TRIO_VA_START(args, format);
- data.stream.in = stream;
- data.closure = closure;
- status = TrioScan(&data, 0, TrioInStreamCustom, format, &args, NULL);
- TRIO_VA_END(args);
- return status;
-}
-
-TRIO_PUBLIC int
-trio_vcscanf
-TRIO_ARGS4((stream, closure, format, args),
- trio_instream_t stream,
- trio_pointer_t closure,
- TRIO_CONST char *format,
- va_list args)
-{
- trio_custom_t data;
-
- assert(VALID(stream));
- assert(VALID(format));
-
- data.stream.in = stream;
- data.closure = closure;
- return TrioScan(&data, 0, TrioInStreamCustom, format, &args, NULL);
-}
-
-TRIO_PUBLIC int
-trio_cscanfv
-TRIO_ARGS4((stream, closure, format, args),
- trio_instream_t stream,
- trio_pointer_t closure,
- TRIO_CONST char *format,
- trio_pointer_t *args)
-{
- trio_custom_t data;
-
- assert(VALID(stream));
- assert(VALID(format));
-
- data.stream.in = stream;
- data.closure = closure;
- return TrioScan(&data, 0, TrioInStreamCustom, format, NULL, args);
-}
-
-/*************************************************************************
- * sscanf
- */
-TRIO_PUBLIC int
-trio_sscanf
-TRIO_VARGS3((buffer, format, va_alist),
- TRIO_CONST char *buffer,
- TRIO_CONST char *format,
- TRIO_VA_DECL)
-{
- int status;
- va_list args;
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- TRIO_VA_START(args, format);
- status = TrioScan((trio_pointer_t)&buffer, 0,
- TrioInStreamString,
- format, &args, NULL);
- TRIO_VA_END(args);
- return status;
-}
-
-TRIO_PUBLIC int
-trio_vsscanf
-TRIO_ARGS3((buffer, format, args),
- TRIO_CONST char *buffer,
- TRIO_CONST char *format,
- va_list args)
-{
- assert(VALID(buffer));
- assert(VALID(format));
-
- return TrioScan((trio_pointer_t)&buffer, 0,
- TrioInStreamString,
- format, &args, NULL);
-}
-
-TRIO_PUBLIC int
-trio_sscanfv
-TRIO_ARGS3((buffer, format, args),
- TRIO_CONST char *buffer,
- TRIO_CONST char *format,
- trio_pointer_t *args)
-{
- assert(VALID(buffer));
- assert(VALID(format));
-
- return TrioScan((trio_pointer_t)&buffer, 0,
- TrioInStreamString,
- format, NULL, args);
-}
-
-/** @} End of Scanf documentation module */
-
-/*************************************************************************
- * trio_strerror
- */
-TRIO_PUBLIC TRIO_CONST char *
-trio_strerror
-TRIO_ARGS1((errorcode),
- int errorcode)
-{
- /* Textual versions of the error codes */
- switch (TRIO_ERROR_CODE(errorcode))
- {
- case TRIO_EOF:
- return "End of file";
- case TRIO_EINVAL:
- return "Invalid argument";
- case TRIO_ETOOMANY:
- return "Too many arguments";
- case TRIO_EDBLREF:
- return "Double reference";
- case TRIO_EGAP:
- return "Reference gap";
- case TRIO_ENOMEM:
- return "Out of memory";
- case TRIO_ERANGE:
- return "Invalid range";
- case TRIO_ECUSTOM:
- return "Custom error";
- default:
- return "Unknown";
- }
-}
diff --git a/bundle/libxml/trio.h b/bundle/libxml/trio.h
deleted file mode 100644
index 770c6a6f58..0000000000
--- a/bundle/libxml/trio.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*************************************************************************
- *
- * $Id$
- *
- * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- *************************************************************************
- *
- * http://ctrio.sourceforge.net/
- *
- ************************************************************************/
-
-#ifndef TRIO_TRIO_H
-#define TRIO_TRIO_H
-
-#include <stdio.h>
-#include <stdlib.h>
-#if defined(TRIO_COMPILER_ANCIENT)
-# include <varargs.h>
-#else
-# include <stdarg.h>
-#endif
-
-#if !defined(WITHOUT_TRIO)
-
-/*
- * Use autoconf defines if present. Packages using trio must define
- * HAVE_CONFIG_H as a compiler option themselves.
- */
-#if defined(HAVE_CONFIG_H)
-# include <config.h>
-#endif
-
-#include "triodef.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Error codes.
- *
- * Remember to add a textual description to trio_strerror.
- */
-enum {
- TRIO_EOF = 1,
- TRIO_EINVAL = 2,
- TRIO_ETOOMANY = 3,
- TRIO_EDBLREF = 4,
- TRIO_EGAP = 5,
- TRIO_ENOMEM = 6,
- TRIO_ERANGE = 7,
- TRIO_ERRNO = 8,
- TRIO_ECUSTOM = 9
-};
-
-/* Error macros */
-#define TRIO_ERROR_CODE(x) ((-(x)) & 0x00FF)
-#define TRIO_ERROR_POSITION(x) ((-(x)) >> 8)
-#define TRIO_ERROR_NAME(x) trio_strerror(x)
-
-typedef int (*trio_outstream_t) TRIO_PROTO((trio_pointer_t, int));
-typedef int (*trio_instream_t) TRIO_PROTO((trio_pointer_t));
-
-TRIO_CONST char *trio_strerror TRIO_PROTO((int));
-
-/*************************************************************************
- * Print Functions
- */
-
-int trio_printf TRIO_PROTO((TRIO_CONST char *format, ...));
-int trio_vprintf TRIO_PROTO((TRIO_CONST char *format, va_list args));
-int trio_printfv TRIO_PROTO((TRIO_CONST char *format, void **args));
-
-int trio_fprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...));
-int trio_vfprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args));
-int trio_fprintfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args));
-
-int trio_dprintf TRIO_PROTO((int fd, TRIO_CONST char *format, ...));
-int trio_vdprintf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args));
-int trio_dprintfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args));
-
-int trio_cprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
- TRIO_CONST char *format, ...));
-int trio_vcprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
- TRIO_CONST char *format, va_list args));
-int trio_cprintfv TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
- TRIO_CONST char *format, void **args));
-
-int trio_sprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, ...));
-int trio_vsprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, va_list args));
-int trio_sprintfv TRIO_PROTO((char *buffer, TRIO_CONST char *format, void **args));
-
-int trio_snprintf TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...));
-int trio_vsnprintf TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
- va_list args));
-int trio_snprintfv TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
- void **args));
-
-int trio_snprintfcat TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...));
-int trio_vsnprintfcat TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
- va_list args));
-
-char *trio_aprintf TRIO_PROTO((TRIO_CONST char *format, ...));
-char *trio_vaprintf TRIO_PROTO((TRIO_CONST char *format, va_list args));
-
-int trio_asprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, ...));
-int trio_vasprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, va_list args));
-
-/*************************************************************************
- * Scan Functions
- */
-int trio_scanf TRIO_PROTO((TRIO_CONST char *format, ...));
-int trio_vscanf TRIO_PROTO((TRIO_CONST char *format, va_list args));
-int trio_scanfv TRIO_PROTO((TRIO_CONST char *format, void **args));
-
-int trio_fscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...));
-int trio_vfscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args));
-int trio_fscanfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args));
-
-int trio_dscanf TRIO_PROTO((int fd, TRIO_CONST char *format, ...));
-int trio_vdscanf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args));
-int trio_dscanfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args));
-
-int trio_cscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
- TRIO_CONST char *format, ...));
-int trio_vcscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
- TRIO_CONST char *format, va_list args));
-int trio_cscanfv TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
- TRIO_CONST char *format, void **args));
-
-int trio_sscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, ...));
-int trio_vsscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, va_list args));
-int trio_sscanfv TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, void **args));
-
-/*************************************************************************
- * Locale Functions
- */
-void trio_locale_set_decimal_point TRIO_PROTO((char *decimalPoint));
-void trio_locale_set_thousand_separator TRIO_PROTO((char *thousandSeparator));
-void trio_locale_set_grouping TRIO_PROTO((char *grouping));
-
-/*************************************************************************
- * Renaming
- */
-#ifdef TRIO_REPLACE_STDIO
-/* Replace the <stdio.h> functions */
-#ifndef HAVE_PRINTF
-# define printf trio_printf
-#endif
-#ifndef HAVE_VPRINTF
-# define vprintf trio_vprintf
-#endif
-#ifndef HAVE_FPRINTF
-# define fprintf trio_fprintf
-#endif
-#ifndef HAVE_VFPRINTF
-# define vfprintf trio_vfprintf
-#endif
-#ifndef HAVE_SPRINTF
-# define sprintf trio_sprintf
-#endif
-#ifndef HAVE_VSPRINTF
-# define vsprintf trio_vsprintf
-#endif
-#ifndef HAVE_SNPRINTF
-# define snprintf trio_snprintf
-#endif
-#ifndef HAVE_VSNPRINTF
-# define vsnprintf trio_vsnprintf
-#endif
-#ifndef HAVE_SCANF
-# define scanf trio_scanf
-#endif
-#ifndef HAVE_VSCANF
-# define vscanf trio_vscanf
-#endif
-#ifndef HAVE_FSCANF
-# define fscanf trio_fscanf
-#endif
-#ifndef HAVE_VFSCANF
-# define vfscanf trio_vfscanf
-#endif
-#ifndef HAVE_SSCANF
-# define sscanf trio_sscanf
-#endif
-#ifndef HAVE_VSSCANF
-# define vsscanf trio_vsscanf
-#endif
-/* These aren't stdio functions, but we make them look similar */
-#define dprintf trio_dprintf
-#define vdprintf trio_vdprintf
-#define aprintf trio_aprintf
-#define vaprintf trio_vaprintf
-#define asprintf trio_asprintf
-#define vasprintf trio_vasprintf
-#define dscanf trio_dscanf
-#define vdscanf trio_vdscanf
-#endif
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* WITHOUT_TRIO */
-
-#endif /* TRIO_TRIO_H */
diff --git a/bundle/libxml/triodef.h b/bundle/libxml/triodef.h
deleted file mode 100644
index 73d64311a7..0000000000
--- a/bundle/libxml/triodef.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/*************************************************************************
- *
- * $Id$
- *
- * Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- ************************************************************************/
-
-#ifndef TRIO_TRIODEF_H
-#define TRIO_TRIODEF_H
-
-/*************************************************************************
- * Platform and compiler support detection
- */
-#if defined(__GNUC__)
-# define TRIO_COMPILER_GCC
-#elif defined(__SUNPRO_C)
-# define TRIO_COMPILER_SUNPRO
-#elif defined(__SUNPRO_CC)
-# define TRIO_COMPILER_SUNPRO
-# define __SUNPRO_C __SUNPRO_CC
-#elif defined(__xlC__) || defined(__IBMC__) || defined(__IBMCPP__)
-# define TRIO_COMPILER_XLC
-#elif defined(_AIX) && !defined(__GNUC__)
-# define TRIO_COMPILER_XLC /* Workaround for old xlc */
-#elif defined(__DECC) || defined(__DECCXX)
-# define TRIO_COMPILER_DECC
-#elif defined(__osf__) && defined(__LANGUAGE_C__)
-# define TRIO_COMPILER_DECC /* Workaround for old DEC C compilers */
-#elif defined(_MSC_VER)
-# define TRIO_COMPILER_MSVC
-#elif defined(__BORLANDC__)
-# define TRIO_COMPILER_BCB
-#endif
-
-#if defined(unix) || defined(__unix) || defined(__unix__)
-# define TRIO_PLATFORM_UNIX
-#elif defined(TRIO_COMPILER_XLC) || defined(_AIX)
-# define TRIO_PLATFORM_UNIX
-#elif ( defined(TRIO_COMPILER_DECC) && !defined(__VMS) ) || defined(__osf__)
-# define TRIO_PLATFORM_UNIX
-#elif defined(__NetBSD__)
-# define TRIO_PLATFORM_UNIX
-#elif defined(__QNX__)
-# define TRIO_PLATFORM_UNIX
-# define TRIO_PLATFORM_QNX
-#elif defined(__CYGWIN__)
-# define TRIO_PLATFORM_UNIX
-#elif defined(AMIGA) && defined(TRIO_COMPILER_GCC)
-# define TRIO_PLATFORM_UNIX
-#elif defined(TRIO_COMPILER_MSVC) || defined(WIN32) || defined(_WIN32)
-# define TRIO_PLATFORM_WIN32
-#elif defined(VMS) || defined(__VMS)
-# define TRIO_PLATFORM_VMS
-#elif defined(mpeix) || defined(__mpexl)
-# define TRIO_PLATFORM_MPEIX
-#endif
-
-#if defined(__STDC__) || defined(TRIO_COMPILER_MSVC)
-# define TRIO_COMPILER_SUPPORTS_C89
-# if defined(__STDC_VERSION__)
-# define TRIO_COMPILER_SUPPORTS_C90
-# if (__STDC_VERSION__ >= 199409L)
-# define TRIO_COMPILER_SUPPORTS_C94
-# endif
-# if (__STDC_VERSION__ >= 199901L)
-# define TRIO_COMPILER_SUPPORTS_C99
-# endif
-# elif defined(TRIO_COMPILER_SUNPRO)
-# if (__SUNPRO_C >= 0x420)
-# define TRIO_COMPILER_SUPPORTS_C94
-# endif
-# endif
-#endif
-
-#if defined(TRIO_PLATFORM_VMS)
- /* The compiler does support C99 but the library still does not have things
- * the standard requires (like nan() and strtof()) as of __CRTL_VER 70300022.
- */
-# undef TRIO_COMPILER_SUPPORTS_C99
-
- /* Computations done with constants at compile time can trigger these
- * even when compiling with IEEE enabled.
- */
-# pragma message disable (UNDERFLOW,FLOATOVERFL)
-#endif /* TRIO_PLATFORM_VMS */
-
-#if defined(_XOPEN_SOURCE)
-# if defined(_XOPEN_SOURCE_EXTENDED)
-# define TRIO_COMPILER_SUPPORTS_UNIX95
-# endif
-# if (_XOPEN_VERSION >= 500)
-# define TRIO_COMPILER_SUPPORTS_UNIX98
-# endif
-# if (_XOPEN_VERSION >= 600)
-# define TRIO_COMPILER_SUPPORTS_UNIX01
-# endif
-#endif
-
-/*************************************************************************
- * Generic defines
- */
-
-#if !defined(TRIO_PUBLIC)
-# define TRIO_PUBLIC
-#endif
-#if !defined(TRIO_PRIVATE)
-# define TRIO_PRIVATE static
-#endif
-
-#if !(defined(TRIO_COMPILER_SUPPORTS_C89) || defined(__cplusplus))
-# define TRIO_COMPILER_ANCIENT
-#endif
-
-#if defined(TRIO_COMPILER_ANCIENT)
-# define TRIO_CONST
-# define TRIO_VOLATILE
-# define TRIO_SIGNED
-typedef double trio_long_double_t;
-typedef char * trio_pointer_t;
-# define TRIO_SUFFIX_LONG(x) x
-# define TRIO_PROTO(x) ()
-# define TRIO_NOARGS
-# define TRIO_ARGS1(list,a1) list a1;
-# define TRIO_ARGS2(list,a1,a2) list a1; a2;
-# define TRIO_ARGS3(list,a1,a2,a3) list a1; a2; a3;
-# define TRIO_ARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4;
-# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5;
-# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) list a1; a2; a3; a4; a5; a6;
-# define TRIO_VARGS2(list,a1,a2) list a1; a2
-# define TRIO_VARGS3(list,a1,a2,a3) list a1; a2; a3
-# define TRIO_VARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4
-# define TRIO_VARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5
-# define TRIO_VA_DECL va_dcl
-# define TRIO_VA_START(x,y) va_start((x))
-# define TRIO_VA_END(x) va_end(x)
-#else /* ANSI C */
-# define TRIO_CONST const
-# define TRIO_VOLATILE volatile
-# define TRIO_SIGNED signed
-typedef long double trio_long_double_t;
-typedef void * trio_pointer_t;
-# define TRIO_SUFFIX_LONG(x) x ## L
-# define TRIO_PROTO(x) x
-# define TRIO_NOARGS void
-# define TRIO_ARGS1(list,a1) (a1)
-# define TRIO_ARGS2(list,a1,a2) (a1,a2)
-# define TRIO_ARGS3(list,a1,a2,a3) (a1,a2,a3)
-# define TRIO_ARGS4(list,a1,a2,a3,a4) (a1,a2,a3,a4)
-# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) (a1,a2,a3,a4,a5)
-# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) (a1,a2,a3,a4,a5,a6)
-# define TRIO_VARGS2 TRIO_ARGS2
-# define TRIO_VARGS3 TRIO_ARGS3
-# define TRIO_VARGS4 TRIO_ARGS4
-# define TRIO_VARGS5 TRIO_ARGS5
-# define TRIO_VA_DECL ...
-# define TRIO_VA_START(x,y) va_start((x),(y))
-# define TRIO_VA_END(x) va_end(x)
-#endif
-
-#if defined(TRIO_COMPILER_SUPPORTS_C99) || defined(__cplusplus)
-# define TRIO_INLINE inline
-#elif defined(TRIO_COMPILER_GCC)
-# define TRIO_INLINE __inline__
-#elif defined(TRIO_COMPILER_MSVC)
-# define TRIO_INLINE _inline
-#elif defined(TRIO_COMPILER_BCB)
-# define TRIO_INLINE __inline
-#else
-# define TRIO_INLINE
-#endif
-
-#endif /* TRIO_TRIODEF_H */
diff --git a/bundle/libxml/trionan.c b/bundle/libxml/trionan.c
deleted file mode 100644
index 3a65986b85..0000000000
--- a/bundle/libxml/trionan.c
+++ /dev/null
@@ -1,913 +0,0 @@
-/*************************************************************************
- *
- * $Id$
- *
- * Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- ************************************************************************
- *
- * Functions to handle special quantities in floating-point numbers
- * (that is, NaNs and infinity). They provide the capability to detect
- * and fabricate special quantities.
- *
- * Although written to be as portable as possible, it can never be
- * guaranteed to work on all platforms, as not all hardware supports
- * special quantities.
- *
- * The approach used here (approximately) is to:
- *
- * 1. Use C99 functionality when available.
- * 2. Use IEEE 754 bit-patterns if possible.
- * 3. Use platform-specific techniques.
- *
- ************************************************************************/
-
-/*
- * TODO:
- * o Put all the magic into trio_fpclassify_and_signbit(), and use this from
- * trio_isnan() etc.
- */
-
-/*************************************************************************
- * Include files
- */
-#include "triodef.h"
-#include "trionan.h"
-
-#include <math.h>
-#include <string.h>
-#include <limits.h>
-#include <float.h>
-#if defined(TRIO_PLATFORM_UNIX)
-# include <signal.h>
-#endif
-#if defined(TRIO_COMPILER_DECC)
-# include <fp_class.h>
-#endif
-#include <assert.h>
-
-#if defined(TRIO_DOCUMENTATION)
-# include "doc/doc_nan.h"
-#endif
-/** @addtogroup SpecialQuantities
- @{
-*/
-
-/*************************************************************************
- * Definitions
- */
-
-#define TRIO_TRUE (1 == 1)
-#define TRIO_FALSE (0 == 1)
-
-/* We must enable IEEE floating-point on Alpha */
-#if defined(__alpha) && !defined(_IEEE_FP)
-# if defined(TRIO_COMPILER_DECC)
-# if defined(TRIO_PLATFORM_VMS)
-# error "Must be compiled with option /IEEE_MODE=UNDERFLOW_TO_ZERO/FLOAT=IEEE"
-# else
-# if !defined(_CFE)
-# error "Must be compiled with option -ieee"
-# endif
-# endif
-# elif defined(TRIO_COMPILER_GCC) && (defined(__osf__) || defined(__linux__))
-# error "Must be compiled with option -mieee"
-# endif
-#endif /* __alpha && ! _IEEE_FP */
-
-/*
- * In ANSI/IEEE 754-1985 64-bits double format numbers have the
- * following properties (amoungst others)
- *
- * o FLT_RADIX == 2: binary encoding
- * o DBL_MAX_EXP == 1024: 11 bits exponent, where one bit is used
- * to indicate special numbers (e.g. NaN and Infinity), so the
- * maximum exponent is 10 bits wide (2^10 == 1024).
- * o DBL_MANT_DIG == 53: The mantissa is 52 bits wide, but because
- * numbers are normalized the initial binary 1 is represented
- * implicitly (the so-called "hidden bit"), which leaves us with
- * the ability to represent 53 bits wide mantissa.
- */
-#if (FLT_RADIX == 2) && (DBL_MAX_EXP == 1024) && (DBL_MANT_DIG == 53)
-# define USE_IEEE_754
-#endif
-
-
-/*************************************************************************
- * Constants
- */
-
-static TRIO_CONST char rcsid[] = "@(#)$Id$";
-
-#if defined(USE_IEEE_754)
-
-/*
- * Endian-agnostic indexing macro.
- *
- * The value of internalEndianMagic, when converted into a 64-bit
- * integer, becomes 0x0706050403020100 (we could have used a 64-bit
- * integer value instead of a double, but not all platforms supports
- * that type). The value is automatically encoded with the correct
- * endianess by the compiler, which means that we can support any
- * kind of endianess. The individual bytes are then used as an index
- * for the IEEE 754 bit-patterns and masks.
- */
-#define TRIO_DOUBLE_INDEX(x) (((unsigned char *)&internalEndianMagic)[7-(x)])
-
-static TRIO_CONST double internalEndianMagic = 7.949928895127363e-275;
-
-/* Mask for the exponent */
-static TRIO_CONST unsigned char ieee_754_exponent_mask[] = {
- 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-/* Mask for the mantissa */
-static TRIO_CONST unsigned char ieee_754_mantissa_mask[] = {
- 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
-};
-
-/* Mask for the sign bit */
-static TRIO_CONST unsigned char ieee_754_sign_mask[] = {
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-/* Bit-pattern for negative zero */
-static TRIO_CONST unsigned char ieee_754_negzero_array[] = {
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-/* Bit-pattern for infinity */
-static TRIO_CONST unsigned char ieee_754_infinity_array[] = {
- 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-/* Bit-pattern for quiet NaN */
-static TRIO_CONST unsigned char ieee_754_qnan_array[] = {
- 0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-
-/*************************************************************************
- * Functions
- */
-
-/*
- * trio_make_double
- */
-TRIO_PRIVATE double
-trio_make_double
-TRIO_ARGS1((values),
- TRIO_CONST unsigned char *values)
-{
- TRIO_VOLATILE double result;
- int i;
-
- for (i = 0; i < (int)sizeof(double); i++) {
- ((TRIO_VOLATILE unsigned char *)&result)[TRIO_DOUBLE_INDEX(i)] = values[i];
- }
- return result;
-}
-
-/*
- * trio_is_special_quantity
- */
-TRIO_PRIVATE int
-trio_is_special_quantity
-TRIO_ARGS2((number, has_mantissa),
- double number,
- int *has_mantissa)
-{
- unsigned int i;
- unsigned char current;
- int is_special_quantity = TRIO_TRUE;
-
- *has_mantissa = 0;
-
- for (i = 0; i < (unsigned int)sizeof(double); i++) {
- current = ((unsigned char *)&number)[TRIO_DOUBLE_INDEX(i)];
- is_special_quantity
- &= ((current & ieee_754_exponent_mask[i]) == ieee_754_exponent_mask[i]);
- *has_mantissa |= (current & ieee_754_mantissa_mask[i]);
- }
- return is_special_quantity;
-}
-
-/*
- * trio_is_negative
- */
-TRIO_PRIVATE int
-trio_is_negative
-TRIO_ARGS1((number),
- double number)
-{
- unsigned int i;
- int is_negative = TRIO_FALSE;
-
- for (i = 0; i < (unsigned int)sizeof(double); i++) {
- is_negative |= (((unsigned char *)&number)[TRIO_DOUBLE_INDEX(i)]
- & ieee_754_sign_mask[i]);
- }
- return is_negative;
-}
-
-#endif /* USE_IEEE_754 */
-
-
-/**
- Generate negative zero.
-
- @return Floating-point representation of negative zero.
-*/
-TRIO_PUBLIC double
-trio_nzero(TRIO_NOARGS)
-{
-#if defined(USE_IEEE_754)
- return trio_make_double(ieee_754_negzero_array);
-#else
- TRIO_VOLATILE double zero = 0.0;
-
- return -zero;
-#endif
-}
-
-/**
- Generate positive infinity.
-
- @return Floating-point representation of positive infinity.
-*/
-TRIO_PUBLIC double
-trio_pinf(TRIO_NOARGS)
-{
- /* Cache the result */
- static double result = 0.0;
-
- if (result == 0.0) {
-
-#if defined(INFINITY) && defined(__STDC_IEC_559__)
- result = (double)INFINITY;
-
-#elif defined(USE_IEEE_754)
- result = trio_make_double(ieee_754_infinity_array);
-
-#else
- /*
- * If HUGE_VAL is different from DBL_MAX, then HUGE_VAL is used
- * as infinity. Otherwise we have to resort to an overflow
- * operation to generate infinity.
- */
-# if defined(TRIO_PLATFORM_UNIX)
- void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN);
-# endif
-
- result = HUGE_VAL;
- if (HUGE_VAL == DBL_MAX) {
- /* Force overflow */
- result += HUGE_VAL;
- }
-
-# if defined(TRIO_PLATFORM_UNIX)
- signal(SIGFPE, signal_handler);
-# endif
-
-#endif
- }
- return result;
-}
-
-/**
- Generate negative infinity.
-
- @return Floating-point value of negative infinity.
-*/
-TRIO_PUBLIC double
-trio_ninf(TRIO_NOARGS)
-{
- static double result = 0.0;
-
- if (result == 0.0) {
- /*
- * Negative infinity is calculated by negating positive infinity,
- * which can be done because it is legal to do calculations on
- * infinity (for example, 1 / infinity == 0).
- */
- result = -trio_pinf();
- }
- return result;
-}
-
-/**
- Generate NaN.
-
- @return Floating-point representation of NaN.
-*/
-TRIO_PUBLIC double
-trio_nan(TRIO_NOARGS)
-{
- /* Cache the result */
- static double result = 0.0;
-
- if (result == 0.0) {
-
-#if defined(TRIO_COMPILER_SUPPORTS_C99)
- result = nan("");
-
-#elif defined(NAN) && defined(__STDC_IEC_559__)
- result = (double)NAN;
-
-#elif defined(USE_IEEE_754)
- result = trio_make_double(ieee_754_qnan_array);
-
-#else
- /*
- * There are several ways to generate NaN. The one used here is
- * to divide infinity by infinity. I would have preferred to add
- * negative infinity to positive infinity, but that yields wrong
- * result (infinity) on FreeBSD.
- *
- * This may fail if the hardware does not support NaN, or if
- * the Invalid Operation floating-point exception is unmasked.
- */
-# if defined(TRIO_PLATFORM_UNIX)
- void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN);
-# endif
-
- result = trio_pinf() / trio_pinf();
-
-# if defined(TRIO_PLATFORM_UNIX)
- signal(SIGFPE, signal_handler);
-# endif
-
-#endif
- }
- return result;
-}
-
-/**
- Check for NaN.
-
- @param number An arbitrary floating-point number.
- @return Boolean value indicating whether or not the number is a NaN.
-*/
-TRIO_PUBLIC int
-trio_isnan
-TRIO_ARGS1((number),
- double number)
-{
-#if (defined(TRIO_COMPILER_SUPPORTS_C99) && defined(isnan)) \
- || defined(TRIO_COMPILER_SUPPORTS_UNIX95)
- /*
- * C99 defines isnan() as a macro. UNIX95 defines isnan() as a
- * function. This function was already present in XPG4, but this
- * is a bit tricky to detect with compiler defines, so we choose
- * the conservative approach and only use it for UNIX95.
- */
- return isnan(number);
-
-#elif defined(TRIO_COMPILER_MSVC)
- /*
- * MSVC has an _isnan() function
- */
- return _isnan(number);
-
-#elif defined(USE_IEEE_754)
- /*
- * Examine IEEE 754 bit-pattern. A NaN must have a special exponent
- * pattern, and a non-empty mantissa.
- */
- int has_mantissa;
- int is_special_quantity;
-
- is_special_quantity = trio_is_special_quantity(number, &has_mantissa);
-
- return (is_special_quantity && has_mantissa);
-
-#else
- /*
- * Fallback solution
- */
- int status;
- double integral, fraction;
-
-# if defined(TRIO_PLATFORM_UNIX)
- void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN);
-# endif
-
- status = (/*
- * NaN is the only number which does not compare to itself
- */
- ((TRIO_VOLATILE double)number != (TRIO_VOLATILE double)number) ||
- /*
- * Fallback solution if NaN compares to NaN
- */
- ((number != 0.0) &&
- (fraction = modf(number, &integral),
- integral == fraction)));
-
-# if defined(TRIO_PLATFORM_UNIX)
- signal(SIGFPE, signal_handler);
-# endif
-
- return status;
-
-#endif
-}
-
-/**
- Check for infinity.
-
- @param number An arbitrary floating-point number.
- @return 1 if positive infinity, -1 if negative infinity, 0 otherwise.
-*/
-TRIO_PUBLIC int
-trio_isinf
-TRIO_ARGS1((number),
- double number)
-{
-#if defined(TRIO_COMPILER_DECC)
- /*
- * DECC has an isinf() macro, but it works differently than that
- * of C99, so we use the fp_class() function instead.
- */
- return ((fp_class(number) == FP_POS_INF)
- ? 1
- : ((fp_class(number) == FP_NEG_INF) ? -1 : 0));
-
-#elif defined(isinf)
- /*
- * C99 defines isinf() as a macro.
- */
- return isinf(number)
- ? ((number > 0.0) ? 1 : -1)
- : 0;
-
-#elif defined(TRIO_COMPILER_MSVC)
- /*
- * MSVC has an _fpclass() function that can be used to detect infinity.
- */
- return ((_fpclass(number) == _FPCLASS_PINF)
- ? 1
- : ((_fpclass(number) == _FPCLASS_NINF) ? -1 : 0));
-
-#elif defined(USE_IEEE_754)
- /*
- * Examine IEEE 754 bit-pattern. Infinity must have a special exponent
- * pattern, and an empty mantissa.
- */
- int has_mantissa;
- int is_special_quantity;
-
- is_special_quantity = trio_is_special_quantity(number, &has_mantissa);
-
- return (is_special_quantity && !has_mantissa)
- ? ((number < 0.0) ? -1 : 1)
- : 0;
-
-#else
- /*
- * Fallback solution.
- */
- int status;
-
-# if defined(TRIO_PLATFORM_UNIX)
- void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN);
-# endif
-
- double infinity = trio_pinf();
-
- status = ((number == infinity)
- ? 1
- : ((number == -infinity) ? -1 : 0));
-
-# if defined(TRIO_PLATFORM_UNIX)
- signal(SIGFPE, signal_handler);
-# endif
-
- return status;
-
-#endif
-}
-
-
-/**
- Check for finity.
-
- @param number An arbitrary floating-point number.
- @return Boolean value indicating whether or not the number is a finite.
-*/
-TRIO_PUBLIC int
-trio_isfinite
-TRIO_ARGS1((number),
- double number)
-{
-#if defined(TRIO_COMPILER_SUPPORTS_C99) && defined(isfinite)
- /*
- * C99 defines isfinite() as a macro.
- */
- return isfinite(number);
-
-#elif defined(TRIO_COMPILER_MSVC)
- /*
- * MSVC uses _finite().
- */
- return _finite(number);
-
-#elif defined(USE_IEEE_754)
- /*
- * Examine IEEE 754 bit-pattern. For finity we do not care about the
- * mantissa.
- */
- int dummy;
-
- return (! trio_is_special_quantity(number, &dummy));
-
-#else
- /*
- * Fallback solution.
- */
- return ((trio_isinf(number) == 0) && (trio_isnan(number) == 0));
-
-#endif
-}
-
-/*
- * The sign of NaN is always false
- */
-TRIO_PUBLIC int
-trio_fpclassify_and_signbit
-TRIO_ARGS2((number, is_negative),
- double number,
- int *is_negative)
-{
-#if defined(fpclassify) && defined(signbit)
- /*
- * C99 defines fpclassify() and signbit() as a macros
- */
- *is_negative = signbit(number);
- switch (fpclassify(number)) {
- case FP_NAN:
- return TRIO_FP_NAN;
- case FP_INFINITE:
- return TRIO_FP_INFINITE;
- case FP_SUBNORMAL:
- return TRIO_FP_SUBNORMAL;
- case FP_ZERO:
- return TRIO_FP_ZERO;
- default:
- return TRIO_FP_NORMAL;
- }
-
-#elif defined(TRIO_COMPILER_DECC)
- /*
- * DECC has an fp_class() function.
- */
- switch (fp_class(number)) {
- case FP_QNAN:
- case FP_SNAN:
- *is_negative = TRIO_FALSE; /* NaN has no sign */
- return TRIO_FP_NAN;
- case FP_POS_INF:
- *is_negative = TRIO_FALSE;
- return TRIO_FP_INFINITE;
- case FP_NEG_INF:
- *is_negative = TRIO_TRUE;
- return TRIO_FP_INFINITE;
- case FP_POS_DENORM:
- *is_negative = TRIO_FALSE;
- return TRIO_FP_SUBNORMAL;
- case FP_NEG_DENORM:
- *is_negative = TRIO_TRUE;
- return TRIO_FP_SUBNORMAL;
- case FP_POS_ZERO:
- *is_negative = TRIO_FALSE;
- return TRIO_FP_ZERO;
- case FP_NEG_ZERO:
- *is_negative = TRIO_TRUE;
- return TRIO_FP_ZERO;
- case FP_POS_NORM:
- *is_negative = TRIO_FALSE;
- return TRIO_FP_NORMAL;
- case FP_NEG_NORM:
- *is_negative = TRIO_TRUE;
- return TRIO_FP_NORMAL;
- default:
- /* Just in case... */
- *is_negative = (number < 0.0);
- return TRIO_FP_NORMAL;
- }
-
-#elif defined(TRIO_COMPILER_MSVC)
- /*
- * MSVC has an _fpclass() function.
- */
- switch (_fpclass(number)) {
- case _FPCLASS_QNAN:
- case _FPCLASS_SNAN:
- *is_negative = TRIO_FALSE;
- return TRIO_FP_NAN;
- case _FPCLASS_PINF:
- *is_negative = TRIO_FALSE;
- return TRIO_FP_INFINITE;
- case _FPCLASS_NINF:
- *is_negative = TRIO_TRUE;
- return TRIO_FP_INFINITE;
- case _FPCLASS_PD:
- *is_negative = TRIO_FALSE;
- return TRIO_FP_SUBNORMAL;
- case _FPCLASS_ND:
- *is_negative = TRIO_TRUE;
- return TRIO_FP_SUBNORMAL;
- case _FPCLASS_PZ:
- *is_negative = TRIO_FALSE;
- return TRIO_FP_ZERO;
- case _FPCLASS_NZ:
- *is_negative = TRIO_TRUE;
- return TRIO_FP_ZERO;
- case _FPCLASS_PN:
- *is_negative = TRIO_FALSE;
- return TRIO_FP_NORMAL;
- case _FPCLASS_NN:
- *is_negative = TRIO_TRUE;
- return TRIO_FP_NORMAL;
- default:
- /* Just in case... */
- *is_negative = (number < 0.0);
- return TRIO_FP_NORMAL;
- }
-
-#elif defined(FP_PLUS_NORM) || defined(__hpux)
-
- /*
- * HP-UX 9.x and 10.x have an fpclassify() function, that is different
- * from the C99 fpclassify() macro supported on HP-UX 11.x.
- */
- switch (fpclassify(number)) {
- case FP_QNAN:
- case FP_SNAN:
- *is_negative = TRIO_FALSE;
- return TRIO_FP_NAN;
- case FP_PLUS_INF:
- *is_negative = TRIO_FALSE;
- return TRIO_FP_INFINITE;
- case FP_MINUS_INF:
- *is_negative = TRIO_TRUE;
- return TRIO_FP_INFINITE;
- case FP_PLUS_DENORM:
- *is_negative = TRIO_FALSE;
- return TRIO_FP_SUBNORMAL;
- case FP_MINUS_DENORM:
- *is_negative = TRIO_TRUE;
- return TRIO_FP_SUBNORMAL;
- case FP_PLUS_ZERO:
- *is_negative = TRIO_FALSE;
- return TRIO_FP_ZERO;
- case FP_MINUS_ZERO:
- *is_negative = TRIO_TRUE;
- return TRIO_FP_ZERO;
- case FP_PLUS_NORM:
- *is_negative = TRIO_FALSE;
- return TRIO_FP_NORMAL;
- case FP_MINUS_NORM:
- *is_negative = TRIO_TRUE;
- return TRIO_FP_NORMAL;
- default:
- assert(0);
- }
-
-#else
- /*
- * Fallback solution.
- */
- int rc;
-
- if (number == 0.0) {
- /*
- * In IEEE 754 the sign of zero is ignored in comparisons, so we
- * have to handle this as a special case by examining the sign bit
- * directly.
- */
-#if defined(USE_IEEE_754)
- *is_negative = trio_is_negative(number);
-#else
- *is_negative = TRIO_FALSE; /* FIXME */
-#endif
- return TRIO_FP_ZERO;
- }
- if (trio_isnan(number)) {
- *is_negative = TRIO_FALSE;
- return TRIO_FP_NAN;
- }
- if ((rc = trio_isinf(number))) {
- *is_negative = (rc == -1);
- return TRIO_FP_INFINITE;
- }
- if ((number > 0.0) && (number < DBL_MIN)) {
- *is_negative = TRIO_FALSE;
- return TRIO_FP_SUBNORMAL;
- }
- if ((number < 0.0) && (number > -DBL_MIN)) {
- *is_negative = TRIO_TRUE;
- return TRIO_FP_SUBNORMAL;
- }
- *is_negative = (number < 0.0);
- return TRIO_FP_NORMAL;
-
-#endif
-}
-
-/**
- Examine the sign of a number.
-
- @param number An arbitrary floating-point number.
- @return Boolean value indicating whether or not the number has the
- sign bit set (i.e. is negative).
-*/
-TRIO_PUBLIC int
-trio_signbit
-TRIO_ARGS1((number),
- double number)
-{
- int is_negative;
-
- (void)trio_fpclassify_and_signbit(number, &is_negative);
- return is_negative;
-}
-
-/**
- Examine the class of a number.
-
- @param number An arbitrary floating-point number.
- @return Enumerable value indicating the class of @p number
-*/
-TRIO_PUBLIC int
-trio_fpclassify
-TRIO_ARGS1((number),
- double number)
-{
- int dummy;
-
- return trio_fpclassify_and_signbit(number, &dummy);
-}
-
-
-/** @} SpecialQuantities */
-
-/*************************************************************************
- * For test purposes.
- *
- * Add the following compiler option to include this test code.
- *
- * Unix : -DSTANDALONE
- * VMS : /DEFINE=(STANDALONE)
- */
-#if defined(STANDALONE)
-# include <stdio.h>
-
-static TRIO_CONST char *
-getClassification
-TRIO_ARGS1((type),
- int type)
-{
- switch (type) {
- case TRIO_FP_INFINITE:
- return "FP_INFINITE";
- case TRIO_FP_NAN:
- return "FP_NAN";
- case TRIO_FP_NORMAL:
- return "FP_NORMAL";
- case TRIO_FP_SUBNORMAL:
- return "FP_SUBNORMAL";
- case TRIO_FP_ZERO:
- return "FP_ZERO";
- default:
- return "FP_UNKNOWN";
- }
-}
-
-static void
-print_class
-TRIO_ARGS2((prefix, number),
- TRIO_CONST char *prefix,
- double number)
-{
- printf("%-6s: %s %-15s %g\n",
- prefix,
- trio_signbit(number) ? "-" : "+",
- getClassification(trio_fpclassify(number)),
- number);
-}
-
-int main(TRIO_NOARGS)
-{
- double my_nan;
- double my_pinf;
- double my_ninf;
-# if defined(TRIO_PLATFORM_UNIX)
- void (*signal_handler) TRIO_PROTO((int));
-# endif
-
- my_nan = trio_nan();
- my_pinf = trio_pinf();
- my_ninf = trio_ninf();
-
- print_class("Nan", my_nan);
- print_class("PInf", my_pinf);
- print_class("NInf", my_ninf);
- print_class("PZero", 0.0);
- print_class("NZero", -0.0);
- print_class("PNorm", 1.0);
- print_class("NNorm", -1.0);
- print_class("PSub", 1.01e-307 - 1.00e-307);
- print_class("NSub", 1.00e-307 - 1.01e-307);
-
- printf("NaN : %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
- my_nan,
- ((unsigned char *)&my_nan)[0],
- ((unsigned char *)&my_nan)[1],
- ((unsigned char *)&my_nan)[2],
- ((unsigned char *)&my_nan)[3],
- ((unsigned char *)&my_nan)[4],
- ((unsigned char *)&my_nan)[5],
- ((unsigned char *)&my_nan)[6],
- ((unsigned char *)&my_nan)[7],
- trio_isnan(my_nan), trio_isinf(my_nan));
- printf("PInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
- my_pinf,
- ((unsigned char *)&my_pinf)[0],
- ((unsigned char *)&my_pinf)[1],
- ((unsigned char *)&my_pinf)[2],
- ((unsigned char *)&my_pinf)[3],
- ((unsigned char *)&my_pinf)[4],
- ((unsigned char *)&my_pinf)[5],
- ((unsigned char *)&my_pinf)[6],
- ((unsigned char *)&my_pinf)[7],
- trio_isnan(my_pinf), trio_isinf(my_pinf));
- printf("NInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
- my_ninf,
- ((unsigned char *)&my_ninf)[0],
- ((unsigned char *)&my_ninf)[1],
- ((unsigned char *)&my_ninf)[2],
- ((unsigned char *)&my_ninf)[3],
- ((unsigned char *)&my_ninf)[4],
- ((unsigned char *)&my_ninf)[5],
- ((unsigned char *)&my_ninf)[6],
- ((unsigned char *)&my_ninf)[7],
- trio_isnan(my_ninf), trio_isinf(my_ninf));
-
-# if defined(TRIO_PLATFORM_UNIX)
- signal_handler = signal(SIGFPE, SIG_IGN);
-# endif
-
- my_pinf = DBL_MAX + DBL_MAX;
- my_ninf = -my_pinf;
- my_nan = my_pinf / my_pinf;
-
-# if defined(TRIO_PLATFORM_UNIX)
- signal(SIGFPE, signal_handler);
-# endif
-
- printf("NaN : %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
- my_nan,
- ((unsigned char *)&my_nan)[0],
- ((unsigned char *)&my_nan)[1],
- ((unsigned char *)&my_nan)[2],
- ((unsigned char *)&my_nan)[3],
- ((unsigned char *)&my_nan)[4],
- ((unsigned char *)&my_nan)[5],
- ((unsigned char *)&my_nan)[6],
- ((unsigned char *)&my_nan)[7],
- trio_isnan(my_nan), trio_isinf(my_nan));
- printf("PInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
- my_pinf,
- ((unsigned char *)&my_pinf)[0],
- ((unsigned char *)&my_pinf)[1],
- ((unsigned char *)&my_pinf)[2],
- ((unsigned char *)&my_pinf)[3],
- ((unsigned char *)&my_pinf)[4],
- ((unsigned char *)&my_pinf)[5],
- ((unsigned char *)&my_pinf)[6],
- ((unsigned char *)&my_pinf)[7],
- trio_isnan(my_pinf), trio_isinf(my_pinf));
- printf("NInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n",
- my_ninf,
- ((unsigned char *)&my_ninf)[0],
- ((unsigned char *)&my_ninf)[1],
- ((unsigned char *)&my_ninf)[2],
- ((unsigned char *)&my_ninf)[3],
- ((unsigned char *)&my_ninf)[4],
- ((unsigned char *)&my_ninf)[5],
- ((unsigned char *)&my_ninf)[6],
- ((unsigned char *)&my_ninf)[7],
- trio_isnan(my_ninf), trio_isinf(my_ninf));
-
- return 0;
-}
-#endif
diff --git a/bundle/libxml/trionan.h b/bundle/libxml/trionan.h
deleted file mode 100644
index bed0c120f9..0000000000
--- a/bundle/libxml/trionan.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*************************************************************************
- *
- * $Id$
- *
- * Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- ************************************************************************/
-
-#ifndef TRIO_NAN_H
-#define TRIO_NAN_H
-
-#include "triodef.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum {
- TRIO_FP_INFINITE,
- TRIO_FP_NAN,
- TRIO_FP_NORMAL,
- TRIO_FP_SUBNORMAL,
- TRIO_FP_ZERO
-};
-
-/*
- * Return NaN (Not-a-Number).
- */
-TRIO_PUBLIC double trio_nan TRIO_PROTO((void));
-
-/*
- * Return positive infinity.
- */
-TRIO_PUBLIC double trio_pinf TRIO_PROTO((void));
-
-/*
- * Return negative infinity.
- */
-TRIO_PUBLIC double trio_ninf TRIO_PROTO((void));
-
-/*
- * Return negative zero.
- */
-TRIO_PUBLIC double trio_nzero TRIO_PROTO((TRIO_NOARGS));
-
-/*
- * If number is a NaN return non-zero, otherwise return zero.
- */
-TRIO_PUBLIC int trio_isnan TRIO_PROTO((double number));
-
-/*
- * If number is positive infinity return 1, if number is negative
- * infinity return -1, otherwise return 0.
- */
-TRIO_PUBLIC int trio_isinf TRIO_PROTO((double number));
-
-/*
- * If number is finite return non-zero, otherwise return zero.
- */
-TRIO_PUBLIC int trio_isfinite TRIO_PROTO((double number));
-
-TRIO_PUBLIC int trio_signbit TRIO_PROTO((double number));
-
-TRIO_PUBLIC int trio_fpclassify TRIO_PROTO((double number));
-
-TRIO_PUBLIC int trio_fpclassify_and_signbit TRIO_PROTO((double number, int *is_negative));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* TRIO_NAN_H */
diff --git a/bundle/libxml/triop.h b/bundle/libxml/triop.h
deleted file mode 100644
index 8462c56f87..0000000000
--- a/bundle/libxml/triop.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*************************************************************************
- *
- * $Id$
- *
- * Copyright (C) 2000 Bjorn Reese and Daniel Stenberg.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- ************************************************************************
- *
- * Private functions, types, etc. used for callback functions.
- *
- * The ref pointer is an opaque type and should remain as such.
- * Private data must only be accessible through the getter and
- * setter functions.
- *
- ************************************************************************/
-
-#ifndef TRIO_TRIOP_H
-#define TRIO_TRIOP_H
-
-#include "triodef.h"
-
-#include <stdlib.h>
-#if defined(TRIO_COMPILER_ANCIENT)
-# include <varargs.h>
-#else
-# include <stdarg.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef TRIO_C99
-# define TRIO_C99 1
-#endif
-#ifndef TRIO_BSD
-# define TRIO_BSD 1
-#endif
-#ifndef TRIO_GNU
-# define TRIO_GNU 1
-#endif
-#ifndef TRIO_MISC
-# define TRIO_MISC 1
-#endif
-#ifndef TRIO_UNIX98
-# define TRIO_UNIX98 1
-#endif
-#ifndef TRIO_MICROSOFT
-# define TRIO_MICROSOFT 1
-#endif
-#ifndef TRIO_EXTENSION
-# define TRIO_EXTENSION 1
-#endif
-#ifndef TRIO_WIDECHAR /* Does not work yet. Do not enable */
-# define TRIO_WIDECHAR 0
-#endif
-#ifndef TRIO_ERRORS
-# define TRIO_ERRORS 1
-#endif
-
-#ifndef TRIO_MALLOC
-# define TRIO_MALLOC(n) malloc(n)
-#endif
-#ifndef TRIO_REALLOC
-# define TRIO_REALLOC(x,n) realloc((x),(n))
-#endif
-#ifndef TRIO_FREE
-# define TRIO_FREE(x) free(x)
-#endif
-
-
-/*************************************************************************
- * User-defined specifiers
- */
-
-typedef int (*trio_callback_t) TRIO_PROTO((trio_pointer_t));
-
-trio_pointer_t trio_register TRIO_PROTO((trio_callback_t callback, const char *name));
-void trio_unregister TRIO_PROTO((trio_pointer_t handle));
-
-TRIO_CONST char *trio_get_format TRIO_PROTO((trio_pointer_t ref));
-trio_pointer_t trio_get_argument TRIO_PROTO((trio_pointer_t ref));
-
-/* Modifiers */
-int trio_get_width TRIO_PROTO((trio_pointer_t ref));
-void trio_set_width TRIO_PROTO((trio_pointer_t ref, int width));
-int trio_get_precision TRIO_PROTO((trio_pointer_t ref));
-void trio_set_precision TRIO_PROTO((trio_pointer_t ref, int precision));
-int trio_get_base TRIO_PROTO((trio_pointer_t ref));
-void trio_set_base TRIO_PROTO((trio_pointer_t ref, int base));
-int trio_get_padding TRIO_PROTO((trio_pointer_t ref));
-void trio_set_padding TRIO_PROTO((trio_pointer_t ref, int is_padding));
-int trio_get_short TRIO_PROTO((trio_pointer_t ref)); /* h */
-void trio_set_shortshort TRIO_PROTO((trio_pointer_t ref, int is_shortshort));
-int trio_get_shortshort TRIO_PROTO((trio_pointer_t ref)); /* hh */
-void trio_set_short TRIO_PROTO((trio_pointer_t ref, int is_short));
-int trio_get_long TRIO_PROTO((trio_pointer_t ref)); /* l */
-void trio_set_long TRIO_PROTO((trio_pointer_t ref, int is_long));
-int trio_get_longlong TRIO_PROTO((trio_pointer_t ref)); /* ll */
-void trio_set_longlong TRIO_PROTO((trio_pointer_t ref, int is_longlong));
-int trio_get_longdouble TRIO_PROTO((trio_pointer_t ref)); /* L */
-void trio_set_longdouble TRIO_PROTO((trio_pointer_t ref, int is_longdouble));
-int trio_get_alternative TRIO_PROTO((trio_pointer_t ref)); /* # */
-void trio_set_alternative TRIO_PROTO((trio_pointer_t ref, int is_alternative));
-int trio_get_alignment TRIO_PROTO((trio_pointer_t ref)); /* - */
-void trio_set_alignment TRIO_PROTO((trio_pointer_t ref, int is_leftaligned));
-int trio_get_spacing TRIO_PROTO((trio_pointer_t ref)); /* TRIO_PROTO((space) */
-void trio_set_spacing TRIO_PROTO((trio_pointer_t ref, int is_space));
-int trio_get_sign TRIO_PROTO((trio_pointer_t ref)); /* + */
-void trio_set_sign TRIO_PROTO((trio_pointer_t ref, int is_showsign));
-int trio_get_quote TRIO_PROTO((trio_pointer_t ref)); /* ' */
-void trio_set_quote TRIO_PROTO((trio_pointer_t ref, int is_quote));
-int trio_get_upper TRIO_PROTO((trio_pointer_t ref));
-void trio_set_upper TRIO_PROTO((trio_pointer_t ref, int is_upper));
-#if TRIO_C99
-int trio_get_largest TRIO_PROTO((trio_pointer_t ref)); /* j */
-void trio_set_largest TRIO_PROTO((trio_pointer_t ref, int is_largest));
-int trio_get_ptrdiff TRIO_PROTO((trio_pointer_t ref)); /* t */
-void trio_set_ptrdiff TRIO_PROTO((trio_pointer_t ref, int is_ptrdiff));
-int trio_get_size TRIO_PROTO((trio_pointer_t ref)); /* z / Z */
-void trio_set_size TRIO_PROTO((trio_pointer_t ref, int is_size));
-#endif
-
-/* Printing */
-int trio_print_ref TRIO_PROTO((trio_pointer_t ref, const char *format, ...));
-int trio_vprint_ref TRIO_PROTO((trio_pointer_t ref, const char *format, va_list args));
-int trio_printv_ref TRIO_PROTO((trio_pointer_t ref, const char *format, trio_pointer_t *args));
-
-void trio_print_int TRIO_PROTO((trio_pointer_t ref, int number));
-void trio_print_uint TRIO_PROTO((trio_pointer_t ref, unsigned int number));
-/* void trio_print_long TRIO_PROTO((trio_pointer_t ref, long number)); */
-/* void trio_print_ulong TRIO_PROTO((trio_pointer_t ref, unsigned long number)); */
-void trio_print_double TRIO_PROTO((trio_pointer_t ref, double number));
-void trio_print_string TRIO_PROTO((trio_pointer_t ref, char *string));
-void trio_print_pointer TRIO_PROTO((trio_pointer_t ref, trio_pointer_t pointer));
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* TRIO_TRIOP_H */
diff --git a/bundle/libxml/triostr.c b/bundle/libxml/triostr.c
deleted file mode 100644
index 43a30dad9f..0000000000
--- a/bundle/libxml/triostr.c
+++ /dev/null
@@ -1,2024 +0,0 @@
-/*************************************************************************
- *
- * $Id$
- *
- * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- ************************************************************************/
-
-/*************************************************************************
- * Include files
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <math.h>
-#include "triodef.h"
-#include "triostr.h"
-
-/*************************************************************************
- * Definitions
- */
-
-#if !defined(TRIO_STRING_PUBLIC)
-# define TRIO_STRING_PUBLIC TRIO_PUBLIC
-#endif
-#if !defined(TRIO_STRING_PRIVATE)
-# define TRIO_STRING_PRIVATE TRIO_PRIVATE
-#endif
-
-#if !defined(NULL)
-# define NULL 0
-#endif
-#if !defined(NIL)
-# define NIL ((char)0)
-#endif
-#if !defined(FALSE)
-# define FALSE (1 == 0)
-# define TRUE (! FALSE)
-#endif
-#if !defined(BOOLEAN_T)
-# define BOOLEAN_T int
-#endif
-
-#if defined(TRIO_COMPILER_SUPPORTS_C99)
-# define USE_STRTOD
-# define USE_STRTOF
-#elif defined(TRIO_COMPILER_MSVC)
-# define USE_STRTOD
-#endif
-
-#if defined(TRIO_PLATFORM_UNIX)
-# define USE_STRCASECMP
-# define USE_STRNCASECMP
-# define USE_STRERROR
-# if defined(TRIO_PLATFORM_QNX)
-# define strcasecmp(x,y) stricmp(x,y)
-# define strncasecmp(x,y,n) strnicmp(x,y,n)
-# endif
-#elif defined(TRIO_PLATFORM_WIN32)
-# define USE_STRCASECMP
-# define strcasecmp(x,y) strcmpi(x,y)
-#endif
-
-/*************************************************************************
- * Structures
- */
-
-struct _trio_string_t
-{
- char *content;
- size_t length;
- size_t allocated;
-};
-
-/*************************************************************************
- * Constants
- */
-
-#if !defined(TRIO_MINIMAL)
-static TRIO_CONST char rcsid[] = "@(#)$Id$";
-#endif
-
-/*************************************************************************
- * Static String Functions
- */
-
-#if defined(TRIO_DOCUMENTATION)
-# include "doc/doc_static.h"
-#endif
-/** @addtogroup StaticStrings
- @{
-*/
-
-/**
- Create new string.
-
- @param size Size of new string.
- @return Pointer to string, or NULL if allocation failed.
-*/
-TRIO_STRING_PUBLIC char *
-trio_create
-TRIO_ARGS1((size),
- size_t size)
-{
- return (char *)TRIO_MALLOC(size);
-}
-
-
-/**
- Destroy string.
-
- @param string String to be freed.
-*/
-TRIO_STRING_PUBLIC void
-trio_destroy
-TRIO_ARGS1((string),
- char *string)
-{
- if (string)
- {
- TRIO_FREE(string);
- }
-}
-
-
-/**
- Count the number of characters in a string.
-
- @param string String to measure.
- @return Number of characters in @string.
-*/
-TRIO_STRING_PUBLIC size_t
-trio_length
-TRIO_ARGS1((string),
- TRIO_CONST char *string)
-{
- return strlen(string);
-}
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Append @p source at the end of @p target.
-
- @param target Target string.
- @param source Source string.
- @return Boolean value indicating success or failure.
-
- @pre @p target must point to a memory chunk with sufficient room to
- contain the @p target string and @p source string.
- @pre No boundary checking is performed, so insufficient memory will
- result in a buffer overrun.
- @post @p target will be zero terminated.
-*/
-TRIO_STRING_PUBLIC int
-trio_append
-TRIO_ARGS2((target, source),
- char *target,
- TRIO_CONST char *source)
-{
- assert(target);
- assert(source);
-
- return (strcat(target, source) != NULL);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-#if !defined(TRIO_MINIMAL)
-/**
- Append at most @p max characters from @p source to @p target.
-
- @param target Target string.
- @param max Maximum number of characters to append.
- @param source Source string.
- @return Boolean value indicating success or failure.
-
- @pre @p target must point to a memory chuck with sufficient room to
- contain the @p target string and the @p source string (at most @p max
- characters).
- @pre No boundary checking is performed, so insufficient memory will
- result in a buffer overrun.
- @post @p target will be zero terminated.
-*/
-TRIO_STRING_PUBLIC int
-trio_append_max
-TRIO_ARGS3((target, max, source),
- char *target,
- size_t max,
- TRIO_CONST char *source)
-{
- size_t length;
-
- assert(target);
- assert(source);
-
- length = trio_length(target);
-
- if (max > length)
- {
- strncat(target, source, max - length - 1);
- }
- return TRUE;
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Determine if a string contains a substring.
-
- @param string String to be searched.
- @param substring String to be found.
- @return Boolean value indicating success or failure.
-*/
-TRIO_STRING_PUBLIC int
-trio_contains
-TRIO_ARGS2((string, substring),
- TRIO_CONST char *string,
- TRIO_CONST char *substring)
-{
- assert(string);
- assert(substring);
-
- return (0 != strstr(string, substring));
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Copy @p source to @p target.
-
- @param target Target string.
- @param source Source string.
- @return Boolean value indicating success or failure.
-
- @pre @p target must point to a memory chunk with sufficient room to
- contain the @p source string.
- @pre No boundary checking is performed, so insufficient memory will
- result in a buffer overrun.
- @post @p target will be zero terminated.
-*/
-TRIO_STRING_PUBLIC int
-trio_copy
-TRIO_ARGS2((target, source),
- char *target,
- TRIO_CONST char *source)
-{
- assert(target);
- assert(source);
-
- (void)strcpy(target, source);
- return TRUE;
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-/**
- Copy at most @p max characters from @p source to @p target.
-
- @param target Target string.
- @param max Maximum number of characters to append.
- @param source Source string.
- @return Boolean value indicating success or failure.
-
- @pre @p target must point to a memory chunk with sufficient room to
- contain the @p source string (at most @p max characters).
- @pre No boundary checking is performed, so insufficient memory will
- result in a buffer overrun.
- @post @p target will be zero terminated.
-*/
-TRIO_STRING_PUBLIC int
-trio_copy_max
-TRIO_ARGS3((target, max, source),
- char *target,
- size_t max,
- TRIO_CONST char *source)
-{
- assert(target);
- assert(source);
- assert(max > 0); /* Includes != 0 */
-
- (void)strncpy(target, source, max - 1);
- target[max - 1] = (char)0;
- return TRUE;
-}
-
-
-/*
- * TrioDuplicateMax
- */
-TRIO_STRING_PRIVATE char *
-TrioDuplicateMax
-TRIO_ARGS2((source, size),
- TRIO_CONST char *source,
- size_t size)
-{
- char *target;
-
- assert(source);
-
- /* Make room for string plus a terminating zero */
- size++;
- target = trio_create(size);
- if (target)
- {
- trio_copy_max(target, size, source);
- }
- return target;
-}
-
-
-/**
- Duplicate @p source.
-
- @param source Source string.
- @return A copy of the @p source string.
-
- @post @p target will be zero terminated.
-*/
-TRIO_STRING_PUBLIC char *
-trio_duplicate
-TRIO_ARGS1((source),
- TRIO_CONST char *source)
-{
- return TrioDuplicateMax(source, trio_length(source));
-}
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Duplicate at most @p max characters of @p source.
-
- @param source Source string.
- @param max Maximum number of characters to duplicate.
- @return A copy of the @p source string.
-
- @post @p target will be zero terminated.
-*/
-TRIO_STRING_PUBLIC char *
-trio_duplicate_max TRIO_ARGS2((source, max),
- TRIO_CONST char *source,
- size_t max)
-{
- size_t length;
-
- assert(source);
- assert(max > 0);
-
- length = trio_length(source);
- if (length > max)
- {
- length = max;
- }
- return TrioDuplicateMax(source, length);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-/**
- Compare if two strings are equal.
-
- @param first First string.
- @param second Second string.
- @return Boolean indicating whether the two strings are equal or not.
-
- Case-insensitive comparison.
-*/
-TRIO_STRING_PUBLIC int
-trio_equal
-TRIO_ARGS2((first, second),
- TRIO_CONST char *first,
- TRIO_CONST char *second)
-{
- assert(first);
- assert(second);
-
- if ((first != NULL) && (second != NULL))
- {
-#if defined(USE_STRCASECMP)
- return (0 == strcasecmp(first, second));
-#else
- while ((*first != NIL) && (*second != NIL))
- {
- if (toupper(*first) != toupper(*second))
- {
- break;
- }
- first++;
- second++;
- }
- return ((*first == NIL) && (*second == NIL));
-#endif
- }
- return FALSE;
-}
-
-
-/**
- Compare if two strings are equal.
-
- @param first First string.
- @param second Second string.
- @return Boolean indicating whether the two strings are equal or not.
-
- Case-sensitive comparison.
-*/
-TRIO_STRING_PUBLIC int
-trio_equal_case
-TRIO_ARGS2((first, second),
- TRIO_CONST char *first,
- TRIO_CONST char *second)
-{
- assert(first);
- assert(second);
-
- if ((first != NULL) && (second != NULL))
- {
- return (0 == strcmp(first, second));
- }
- return FALSE;
-}
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Compare if two strings up until the first @p max characters are equal.
-
- @param first First string.
- @param max Maximum number of characters to compare.
- @param second Second string.
- @return Boolean indicating whether the two strings are equal or not.
-
- Case-sensitive comparison.
-*/
-TRIO_STRING_PUBLIC int
-trio_equal_case_max
-TRIO_ARGS3((first, max, second),
- TRIO_CONST char *first,
- size_t max,
- TRIO_CONST char *second)
-{
- assert(first);
- assert(second);
-
- if ((first != NULL) && (second != NULL))
- {
- return (0 == strncmp(first, second, max));
- }
- return FALSE;
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-/**
- Compare if two strings are equal.
-
- @param first First string.
- @param second Second string.
- @return Boolean indicating whether the two strings are equal or not.
-
- Collating characters are considered equal.
-*/
-TRIO_STRING_PUBLIC int
-trio_equal_locale
-TRIO_ARGS2((first, second),
- TRIO_CONST char *first,
- TRIO_CONST char *second)
-{
- assert(first);
- assert(second);
-
-#if defined(LC_COLLATE)
- return (strcoll(first, second) == 0);
-#else
- return trio_equal(first, second);
-#endif
-}
-
-
-/**
- Compare if two strings up until the first @p max characters are equal.
-
- @param first First string.
- @param max Maximum number of characters to compare.
- @param second Second string.
- @return Boolean indicating whether the two strings are equal or not.
-
- Case-insensitive comparison.
-*/
-TRIO_STRING_PUBLIC int
-trio_equal_max
-TRIO_ARGS3((first, max, second),
- TRIO_CONST char *first,
- size_t max,
- TRIO_CONST char *second)
-{
- assert(first);
- assert(second);
-
- if ((first != NULL) && (second != NULL))
- {
-#if defined(USE_STRNCASECMP)
- return (0 == strncasecmp(first, second, max));
-#else
- /* Not adequately tested yet */
- size_t cnt = 0;
- while ((*first != NIL) && (*second != NIL) && (cnt <= max))
- {
- if (toupper(*first) != toupper(*second))
- {
- break;
- }
- first++;
- second++;
- cnt++;
- }
- return ((cnt == max) || ((*first == NIL) && (*second == NIL)));
-#endif
- }
- return FALSE;
-}
-
-
-/**
- Provide a textual description of an error code (errno).
-
- @param error_number Error number.
- @return Textual description of @p error_number.
-*/
-TRIO_STRING_PUBLIC TRIO_CONST char *
-trio_error
-TRIO_ARGS1((error_number),
- int error_number)
-{
-#if defined(USE_STRERROR)
- return strerror(error_number);
-#else
- return "unknown";
-#endif
-}
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Format the date/time according to @p format.
-
- @param target Target string.
- @param max Maximum number of characters to format.
- @param format Formatting string.
- @param datetime Date/time structure.
- @return Number of formatted characters.
-
- The formatting string accepts the same specifiers as the standard C
- function strftime.
-*/
-TRIO_STRING_PUBLIC size_t
-trio_format_date_max
-TRIO_ARGS4((target, max, format, datetime),
- char *target,
- size_t max,
- TRIO_CONST char *format,
- TRIO_CONST struct tm *datetime)
-{
- assert(target);
- assert(format);
- assert(datetime);
- assert(max > 0);
-
- return strftime(target, max, format, datetime);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Calculate a hash value for a string.
-
- @param string String to be calculated on.
- @param type Hash function.
- @return Calculated hash value.
-
- @p type can be one of the following
- @li @c TRIO_HASH_PLAIN Plain hash function.
-*/
-TRIO_STRING_PUBLIC unsigned long
-trio_hash
-TRIO_ARGS2((string, type),
- TRIO_CONST char *string,
- int type)
-{
- unsigned long value = 0L;
- char ch;
-
- assert(string);
-
- switch (type)
- {
- case TRIO_HASH_PLAIN:
- while ( (ch = *string++) != NIL )
- {
- value *= 31;
- value += (unsigned long)ch;
- }
- break;
- default:
- assert(FALSE);
- break;
- }
- return value;
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Find first occurrence of a character in a string.
-
- @param string String to be searched.
- @param character Character to be found.
- @param A pointer to the found character, or NULL if character was not found.
- */
-TRIO_STRING_PUBLIC char *
-trio_index
-TRIO_ARGS2((string, character),
- TRIO_CONST char *string,
- int character)
-{
- assert(string);
-
- return strchr(string, character);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Find last occurrence of a character in a string.
-
- @param string String to be searched.
- @param character Character to be found.
- @param A pointer to the found character, or NULL if character was not found.
- */
-TRIO_STRING_PUBLIC char *
-trio_index_last
-TRIO_ARGS2((string, character),
- TRIO_CONST char *string,
- int character)
-{
- assert(string);
-
- return strchr(string, character);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Convert the alphabetic letters in the string to lower-case.
-
- @param target String to be converted.
- @return Number of processed characters (converted or not).
-*/
-TRIO_STRING_PUBLIC int
-trio_lower
-TRIO_ARGS1((target),
- char *target)
-{
- assert(target);
-
- return trio_span_function(target, target, tolower);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Compare two strings using wildcards.
-
- @param string String to be searched.
- @param pattern Pattern, including wildcards, to search for.
- @return Boolean value indicating success or failure.
-
- Case-insensitive comparison.
-
- The following wildcards can be used
- @li @c * Match any number of characters.
- @li @c ? Match a single character.
-*/
-TRIO_STRING_PUBLIC int
-trio_match
-TRIO_ARGS2((string, pattern),
- TRIO_CONST char *string,
- TRIO_CONST char *pattern)
-{
- assert(string);
- assert(pattern);
-
- for (; ('*' != *pattern); ++pattern, ++string)
- {
- if (NIL == *string)
- {
- return (NIL == *pattern);
- }
- if ((toupper((int)*string) != toupper((int)*pattern))
- && ('?' != *pattern))
- {
- return FALSE;
- }
- }
- /* two-line patch to prevent *too* much recursiveness: */
- while ('*' == pattern[1])
- pattern++;
-
- do
- {
- if ( trio_match(string, &pattern[1]) )
- {
- return TRUE;
- }
- }
- while (*string++);
-
- return FALSE;
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Compare two strings using wildcards.
-
- @param string String to be searched.
- @param pattern Pattern, including wildcards, to search for.
- @return Boolean value indicating success or failure.
-
- Case-sensitive comparison.
-
- The following wildcards can be used
- @li @c * Match any number of characters.
- @li @c ? Match a single character.
-*/
-TRIO_STRING_PUBLIC int
-trio_match_case
-TRIO_ARGS2((string, pattern),
- TRIO_CONST char *string,
- TRIO_CONST char *pattern)
-{
- assert(string);
- assert(pattern);
-
- for (; ('*' != *pattern); ++pattern, ++string)
- {
- if (NIL == *string)
- {
- return (NIL == *pattern);
- }
- if ((*string != *pattern)
- && ('?' != *pattern))
- {
- return FALSE;
- }
- }
- /* two-line patch to prevent *too* much recursiveness: */
- while ('*' == pattern[1])
- pattern++;
-
- do
- {
- if ( trio_match_case(string, &pattern[1]) )
- {
- return TRUE;
- }
- }
- while (*string++);
-
- return FALSE;
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Execute a function on each character in string.
-
- @param target Target string.
- @param source Source string.
- @param Function Function to be executed.
- @return Number of processed characters.
-*/
-TRIO_STRING_PUBLIC size_t
-trio_span_function
-TRIO_ARGS3((target, source, Function),
- char *target,
- TRIO_CONST char *source,
- int (*Function) TRIO_PROTO((int)))
-{
- size_t count = 0;
-
- assert(target);
- assert(source);
- assert(Function);
-
- while (*source != NIL)
- {
- *target++ = Function(*source++);
- count++;
- }
- return count;
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Search for a substring in a string.
-
- @param string String to be searched.
- @param substring String to be found.
- @return Pointer to first occurrence of @p substring in @p string, or NULL
- if no match was found.
-*/
-TRIO_STRING_PUBLIC char *
-trio_substring
-TRIO_ARGS2((string, substring),
- TRIO_CONST char *string,
- TRIO_CONST char *substring)
-{
- assert(string);
- assert(substring);
-
- return strstr(string, substring);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Search for a substring in the first @p max characters of a string.
-
- @param string String to be searched.
- @param max Maximum characters to be searched.
- @param substring String to be found.
- @return Pointer to first occurrence of @p substring in @p string, or NULL
- if no match was found.
-*/
-TRIO_STRING_PUBLIC char *
-trio_substring_max
-TRIO_ARGS3((string, max, substring),
- TRIO_CONST char *string,
- size_t max,
- TRIO_CONST char *substring)
-{
- size_t count;
- size_t size;
- char *result = NULL;
-
- assert(string);
- assert(substring);
-
- size = trio_length(substring);
- if (size <= max)
- {
- for (count = 0; count <= max - size; count++)
- {
- if (trio_equal_max(substring, size, &string[count]))
- {
- result = (char *)&string[count];
- break;
- }
- }
- }
- return result;
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Tokenize string.
-
- @param string String to be tokenized.
- @param tokens String containing list of delimiting characters.
- @return Start of new token.
-
- @warning @p string will be destroyed.
-*/
-TRIO_STRING_PUBLIC char *
-trio_tokenize
-TRIO_ARGS2((string, delimiters),
- char *string,
- TRIO_CONST char *delimiters)
-{
- assert(delimiters);
-
- return strtok(string, delimiters);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-/**
- Convert string to floating-point number.
-
- @param source String to be converted.
- @param endp Pointer to end of the converted string.
- @return A floating-point number.
-
- The following Extended Backus-Naur form is used
- @verbatim
- double ::= [ <sign> ]
- ( <number> |
- <number> <decimal_point> <number> |
- <decimal_point> <number> )
- [ <exponential> [ <sign> ] <number> ]
- number ::= 1*( <digit> )
- digit ::= ( '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' )
- exponential ::= ( 'e' | 'E' )
- sign ::= ( '-' | '+' )
- decimal_point ::= '.'
- @endverbatim
-*/
-/* FIXME: Add EBNF for hex-floats */
-TRIO_STRING_PUBLIC trio_long_double_t
-trio_to_long_double
-TRIO_ARGS2((source, endp),
- TRIO_CONST char *source,
- char **endp)
-{
-#if defined(USE_STRTOLD)
- return strtold(source, endp);
-#else
- int isNegative = FALSE;
- int isExponentNegative = FALSE;
- trio_long_double_t integer = 0.0;
- trio_long_double_t fraction = 0.0;
- unsigned long exponent = 0;
- trio_long_double_t base;
- trio_long_double_t fracdiv = 1.0;
- trio_long_double_t value = 0.0;
-
- /* First try hex-floats */
- if ((source[0] == '0') && ((source[1] == 'x') || (source[1] == 'X')))
- {
- base = 16.0;
- source += 2;
- while (isxdigit((int)*source))
- {
- integer *= base;
- integer += (isdigit((int)*source)
- ? (*source - '0')
- : 10 + (toupper((int)*source) - 'A'));
- source++;
- }
- if (*source == '.')
- {
- source++;
- while (isxdigit((int)*source))
- {
- fracdiv /= base;
- fraction += fracdiv * (isdigit((int)*source)
- ? (*source - '0')
- : 10 + (toupper((int)*source) - 'A'));
- source++;
- }
- if ((*source == 'p') || (*source == 'P'))
- {
- source++;
- if ((*source == '+') || (*source == '-'))
- {
- isExponentNegative = (*source == '-');
- source++;
- }
- while (isdigit((int)*source))
- {
- exponent *= (int)base;
- exponent += (*source - '0');
- source++;
- }
- }
- }
- }
- else /* Then try normal decimal floats */
- {
- base = 10.0;
- isNegative = (*source == '-');
- /* Skip sign */
- if ((*source == '+') || (*source == '-'))
- source++;
-
- /* Integer part */
- while (isdigit((int)*source))
- {
- integer *= base;
- integer += (*source - '0');
- source++;
- }
-
- if (*source == '.')
- {
- source++; /* skip decimal point */
- while (isdigit((int)*source))
- {
- fracdiv /= base;
- fraction += (*source - '0') * fracdiv;
- source++;
- }
- }
- if ((*source == 'e')
- || (*source == 'E')
-#if TRIO_MICROSOFT
- || (*source == 'd')
- || (*source == 'D')
-#endif
- )
- {
- source++; /* Skip exponential indicator */
- isExponentNegative = (*source == '-');
- if ((*source == '+') || (*source == '-'))
- source++;
- while (isdigit((int)*source))
- {
- exponent *= (int)base;
- exponent += (*source - '0');
- source++;
- }
- }
- }
-
- value = integer + fraction;
- if (exponent != 0)
- {
- if (isExponentNegative)
- value /= pow(base, (double)exponent);
- else
- value *= pow(base, (double)exponent);
- }
- if (isNegative)
- value = -value;
-
- if (endp)
- *endp = (char *)source;
- return value;
-#endif
-}
-
-
-/**
- Convert string to floating-point number.
-
- @param source String to be converted.
- @param endp Pointer to end of the converted string.
- @return A floating-point number.
-
- See @ref trio_to_long_double.
-*/
-TRIO_STRING_PUBLIC double
-trio_to_double
-TRIO_ARGS2((source, endp),
- TRIO_CONST char *source,
- char **endp)
-{
-#if defined(USE_STRTOD)
- return strtod(source, endp);
-#else
- return (double)trio_to_long_double(source, endp);
-#endif
-}
-
-#if !defined(TRIO_MINIMAL)
-/**
- Convert string to floating-point number.
-
- @param source String to be converted.
- @param endp Pointer to end of the converted string.
- @return A floating-point number.
-
- See @ref trio_to_long_double.
-*/
-TRIO_STRING_PUBLIC float
-trio_to_float
-TRIO_ARGS2((source, endp),
- TRIO_CONST char *source,
- char **endp)
-{
-#if defined(USE_STRTOF)
- return strtof(source, endp);
-#else
- return (float)trio_to_long_double(source, endp);
-#endif
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-/**
- Convert string to signed integer.
-
- @param string String to be converted.
- @param endp Pointer to end of converted string.
- @param base Radix number of number.
-*/
-TRIO_STRING_PUBLIC long
-trio_to_long
-TRIO_ARGS3((string, endp, base),
- TRIO_CONST char *string,
- char **endp,
- int base)
-{
- assert(string);
- assert((base >= 2) && (base <= 36));
-
- return strtol(string, endp, base);
-}
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Convert string to unsigned integer.
-
- @param string String to be converted.
- @param endp Pointer to end of converted string.
- @param base Radix number of number.
-*/
-TRIO_STRING_PUBLIC unsigned long
-trio_to_unsigned_long
-TRIO_ARGS3((string, endp, base),
- TRIO_CONST char *string,
- char **endp,
- int base)
-{
- assert(string);
- assert((base >= 2) && (base <= 36));
-
- return strtoul(string, endp, base);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Convert the alphabetic letters in the string to upper-case.
-
- @param target The string to be converted.
- @return The number of processed characters (converted or not).
-*/
-TRIO_STRING_PUBLIC int
-trio_upper
-TRIO_ARGS1((target),
- char *target)
-{
- assert(target);
-
- return trio_span_function(target, target, toupper);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-/** @} End of StaticStrings */
-
-
-/*************************************************************************
- * Dynamic String Functions
- */
-
-#if defined(TRIO_DOCUMENTATION)
-# include "doc/doc_dynamic.h"
-#endif
-/** @addtogroup DynamicStrings
- @{
-*/
-
-/*
- * TrioStringAlloc
- */
-TRIO_STRING_PRIVATE trio_string_t *
-TrioStringAlloc(TRIO_NOARGS)
-{
- trio_string_t *self;
-
- self = (trio_string_t *)TRIO_MALLOC(sizeof(trio_string_t));
- if (self)
- {
- self->content = NULL;
- self->length = 0;
- self->allocated = 0;
- }
- return self;
-}
-
-
-/*
- * TrioStringGrow
- *
- * The size of the string will be increased by 'delta' characters. If
- * 'delta' is zero, the size will be doubled.
- */
-TRIO_STRING_PRIVATE BOOLEAN_T
-TrioStringGrow
-TRIO_ARGS2((self, delta),
- trio_string_t *self,
- size_t delta)
-{
- BOOLEAN_T status = FALSE;
- char *new_content;
- size_t new_size;
-
- new_size = (delta == 0)
- ? ( (self->allocated == 0) ? 1 : self->allocated * 2 )
- : self->allocated + delta;
-
- new_content = (char *)TRIO_REALLOC(self->content, new_size);
- if (new_content)
- {
- self->content = new_content;
- self->allocated = new_size;
- status = TRUE;
- }
- return status;
-}
-
-
-/*
- * TrioStringGrowTo
- *
- * The size of the string will be increased to 'length' plus one characters.
- * If 'length' is less than the original size, the original size will be
- * used (that is, the size of the string is never decreased).
- */
-TRIO_STRING_PRIVATE BOOLEAN_T
-TrioStringGrowTo
-TRIO_ARGS2((self, length),
- trio_string_t *self,
- size_t length)
-{
- length++; /* Room for terminating zero */
- return (self->allocated < length)
- ? TrioStringGrow(self, length - self->allocated)
- : TRUE;
-}
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Create a new dynamic string.
-
- @param initial_size Initial size of the buffer.
- @return Newly allocated dynamic string, or NULL if memory allocation failed.
-*/
-TRIO_STRING_PUBLIC trio_string_t *
-trio_string_create
-TRIO_ARGS1((initial_size),
- int initial_size)
-{
- trio_string_t *self;
-
- self = TrioStringAlloc();
- if (self)
- {
- if (TrioStringGrow(self,
- (size_t)((initial_size > 0) ? initial_size : 1)))
- {
- self->content[0] = (char)0;
- self->allocated = initial_size;
- }
- else
- {
- trio_string_destroy(self);
- self = NULL;
- }
- }
- return self;
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-/**
- Deallocate the dynamic string and its contents.
-
- @param self Dynamic string
-*/
-TRIO_STRING_PUBLIC void
-trio_string_destroy
-TRIO_ARGS1((self),
- trio_string_t *self)
-{
- assert(self);
-
- if (self)
- {
- trio_destroy(self->content);
- TRIO_FREE(self);
- }
-}
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Get a pointer to the content.
-
- @param self Dynamic string.
- @param offset Offset into content.
- @return Pointer to the content.
-
- @p Offset can be zero, positive, or negative. If @p offset is zero,
- then the start of the content will be returned. If @p offset is positive,
- then a pointer to @p offset number of characters from the beginning of the
- content is returned. If @p offset is negative, then a pointer to @p offset
- number of characters from the ending of the string, starting at the
- terminating zero, is returned.
-*/
-TRIO_STRING_PUBLIC char *
-trio_string_get
-TRIO_ARGS2((self, offset),
- trio_string_t *self,
- int offset)
-{
- char *result = NULL;
-
- assert(self);
-
- if (self->content != NULL)
- {
- if (self->length == 0)
- {
- (void)trio_string_length(self);
- }
- if (offset >= 0)
- {
- if (offset > (int)self->length)
- {
- offset = self->length;
- }
- }
- else
- {
- offset += self->length + 1;
- if (offset < 0)
- {
- offset = 0;
- }
- }
- result = &(self->content[offset]);
- }
- return result;
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-/**
- Extract the content.
-
- @param self Dynamic String
- @return Content of dynamic string.
-
- The content is removed from the dynamic string. This enables destruction
- of the dynamic string without deallocation of the content.
-*/
-TRIO_STRING_PUBLIC char *
-trio_string_extract
-TRIO_ARGS1((self),
- trio_string_t *self)
-{
- char *result;
-
- assert(self);
-
- result = self->content;
- /* FIXME: Allocate new empty buffer? */
- self->content = NULL;
- self->length = self->allocated = 0;
- return result;
-}
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Set the content of the dynamic string.
-
- @param self Dynamic String
- @param buffer The new content.
-
- Sets the content of the dynamic string to a copy @p buffer.
- An existing content will be deallocated first, if necessary.
-
- @remark
- This function will make a copy of @p buffer.
- You are responsible for deallocating @p buffer yourself.
-*/
-TRIO_STRING_PUBLIC void
-trio_xstring_set
-TRIO_ARGS2((self, buffer),
- trio_string_t *self,
- char *buffer)
-{
- assert(self);
-
- trio_destroy(self->content);
- self->content = trio_duplicate(buffer);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-/*
- * trio_string_size
- */
-TRIO_STRING_PUBLIC int
-trio_string_size
-TRIO_ARGS1((self),
- trio_string_t *self)
-{
- assert(self);
-
- return self->allocated;
-}
-
-
-/*
- * trio_string_terminate
- */
-TRIO_STRING_PUBLIC void
-trio_string_terminate
-TRIO_ARGS1((self),
- trio_string_t *self)
-{
- trio_xstring_append_char(self, 0);
-}
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Append the second string to the first.
-
- @param self Dynamic string to be modified.
- @param other Dynamic string to copy from.
- @return Boolean value indicating success or failure.
-*/
-TRIO_STRING_PUBLIC int
-trio_string_append
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- trio_string_t *other)
-{
- size_t length;
-
- assert(self);
- assert(other);
-
- length = self->length + other->length;
- if (!TrioStringGrowTo(self, length))
- goto error;
- trio_copy(&self->content[self->length], other->content);
- self->length = length;
- return TRUE;
-
- error:
- return FALSE;
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_xstring_append
- */
-TRIO_STRING_PUBLIC int
-trio_xstring_append
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- TRIO_CONST char *other)
-{
- size_t length;
-
- assert(self);
- assert(other);
-
- length = self->length + trio_length(other);
- if (!TrioStringGrowTo(self, length))
- goto error;
- trio_copy(&self->content[self->length], other);
- self->length = length;
- return TRUE;
-
- error:
- return FALSE;
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-/*
- * trio_xstring_append_char
- */
-TRIO_STRING_PUBLIC int
-trio_xstring_append_char
-TRIO_ARGS2((self, character),
- trio_string_t *self,
- char character)
-{
- assert(self);
-
- if ((int)self->length >= trio_string_size(self))
- {
- if (!TrioStringGrow(self, 0))
- goto error;
- }
- self->content[self->length] = character;
- self->length++;
- return TRUE;
-
- error:
- return FALSE;
-}
-
-
-#if !defined(TRIO_MINIMAL)
-/**
- Search for the first occurrence of second parameter in the first.
-
- @param self Dynamic string to be modified.
- @param other Dynamic string to copy from.
- @return Boolean value indicating success or failure.
-*/
-TRIO_STRING_PUBLIC int
-trio_string_contains
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- trio_string_t *other)
-{
- assert(self);
- assert(other);
-
- return trio_contains(self->content, other->content);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_xstring_contains
- */
-TRIO_STRING_PUBLIC int
-trio_xstring_contains
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- TRIO_CONST char *other)
-{
- assert(self);
- assert(other);
-
- return trio_contains(self->content, other);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_string_copy
- */
-TRIO_STRING_PUBLIC int
-trio_string_copy
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- trio_string_t *other)
-{
- assert(self);
- assert(other);
-
- self->length = 0;
- return trio_string_append(self, other);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_xstring_copy
- */
-TRIO_STRING_PUBLIC int
-trio_xstring_copy
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- TRIO_CONST char *other)
-{
- assert(self);
- assert(other);
-
- self->length = 0;
- return trio_xstring_append(self, other);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_string_duplicate
- */
-TRIO_STRING_PUBLIC trio_string_t *
-trio_string_duplicate
-TRIO_ARGS1((other),
- trio_string_t *other)
-{
- trio_string_t *self;
-
- assert(other);
-
- self = TrioStringAlloc();
- if (self)
- {
- self->content = TrioDuplicateMax(other->content, other->length);
- if (self->content)
- {
- self->length = other->length;
- self->allocated = self->length + 1;
- }
- else
- {
- self->length = self->allocated = 0;
- }
- }
- return self;
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-/*
- * trio_xstring_duplicate
- */
-TRIO_STRING_PUBLIC trio_string_t *
-trio_xstring_duplicate
-TRIO_ARGS1((other),
- TRIO_CONST char *other)
-{
- trio_string_t *self;
-
- assert(other);
-
- self = TrioStringAlloc();
- if (self)
- {
- self->content = TrioDuplicateMax(other, trio_length(other));
- if (self->content)
- {
- self->length = trio_length(self->content);
- self->allocated = self->length + 1;
- }
- else
- {
- self->length = self->allocated = 0;
- }
- }
- return self;
-}
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_string_equal
- */
-TRIO_STRING_PUBLIC int
-trio_string_equal
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- trio_string_t *other)
-{
- assert(self);
- assert(other);
-
- return trio_equal(self->content, other->content);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_xstring_equal
- */
-TRIO_STRING_PUBLIC int
-trio_xstring_equal
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- TRIO_CONST char *other)
-{
- assert(self);
- assert(other);
-
- return trio_equal(self->content, other);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_string_equal_max
- */
-TRIO_STRING_PUBLIC int
-trio_string_equal_max
-TRIO_ARGS3((self, max, other),
- trio_string_t *self,
- size_t max,
- trio_string_t *other)
-{
- assert(self);
- assert(other);
-
- return trio_equal_max(self->content, max, other->content);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_xstring_equal_max
- */
-TRIO_STRING_PUBLIC int
-trio_xstring_equal_max
-TRIO_ARGS3((self, max, other),
- trio_string_t *self,
- size_t max,
- TRIO_CONST char *other)
-{
- assert(self);
- assert(other);
-
- return trio_equal_max(self->content, max, other);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_string_equal_case
- */
-TRIO_STRING_PUBLIC int
-trio_string_equal_case
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- trio_string_t *other)
-{
- assert(self);
- assert(other);
-
- return trio_equal_case(self->content, other->content);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_xstring_equal_case
- */
-TRIO_STRING_PUBLIC int
-trio_xstring_equal_case
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- TRIO_CONST char *other)
-{
- assert(self);
- assert(other);
-
- return trio_equal_case(self->content, other);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_string_equal_case_max
- */
-TRIO_STRING_PUBLIC int
-trio_string_equal_case_max
-TRIO_ARGS3((self, max, other),
- trio_string_t *self,
- size_t max,
- trio_string_t *other)
-{
- assert(self);
- assert(other);
-
- return trio_equal_case_max(self->content, max, other->content);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_xstring_equal_case_max
- */
-TRIO_STRING_PUBLIC int
-trio_xstring_equal_case_max
-TRIO_ARGS3((self, max, other),
- trio_string_t *self,
- size_t max,
- TRIO_CONST char *other)
-{
- assert(self);
- assert(other);
-
- return trio_equal_case_max(self->content, max, other);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_string_format_data_max
- */
-TRIO_STRING_PUBLIC size_t
-trio_string_format_date_max
-TRIO_ARGS4((self, max, format, datetime),
- trio_string_t *self,
- size_t max,
- TRIO_CONST char *format,
- TRIO_CONST struct tm *datetime)
-{
- assert(self);
-
- return trio_format_date_max(self->content, max, format, datetime);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_string_index
- */
-TRIO_STRING_PUBLIC char *
-trio_string_index
-TRIO_ARGS2((self, character),
- trio_string_t *self,
- int character)
-{
- assert(self);
-
- return trio_index(self->content, character);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_string_index_last
- */
-TRIO_STRING_PUBLIC char *
-trio_string_index_last
-TRIO_ARGS2((self, character),
- trio_string_t *self,
- int character)
-{
- assert(self);
-
- return trio_index_last(self->content, character);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_string_length
- */
-TRIO_STRING_PUBLIC int
-trio_string_length
-TRIO_ARGS1((self),
- trio_string_t *self)
-{
- assert(self);
-
- if (self->length == 0)
- {
- self->length = trio_length(self->content);
- }
- return self->length;
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_string_lower
- */
-TRIO_STRING_PUBLIC int
-trio_string_lower
-TRIO_ARGS1((self),
- trio_string_t *self)
-{
- assert(self);
-
- return trio_lower(self->content);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_string_match
- */
-TRIO_STRING_PUBLIC int
-trio_string_match
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- trio_string_t *other)
-{
- assert(self);
- assert(other);
-
- return trio_match(self->content, other->content);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_xstring_match
- */
-TRIO_STRING_PUBLIC int
-trio_xstring_match
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- TRIO_CONST char *other)
-{
- assert(self);
- assert(other);
-
- return trio_match(self->content, other);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_string_match_case
- */
-TRIO_STRING_PUBLIC int
-trio_string_match_case
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- trio_string_t *other)
-{
- assert(self);
- assert(other);
-
- return trio_match_case(self->content, other->content);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_xstring_match_case
- */
-TRIO_STRING_PUBLIC int
-trio_xstring_match_case
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- TRIO_CONST char *other)
-{
- assert(self);
- assert(other);
-
- return trio_match_case(self->content, other);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_string_substring
- */
-TRIO_STRING_PUBLIC char *
-trio_string_substring
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- trio_string_t *other)
-{
- assert(self);
- assert(other);
-
- return trio_substring(self->content, other->content);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_xstring_substring
- */
-TRIO_STRING_PUBLIC char *
-trio_xstring_substring
-TRIO_ARGS2((self, other),
- trio_string_t *self,
- TRIO_CONST char *other)
-{
- assert(self);
- assert(other);
-
- return trio_substring(self->content, other);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-
-#if !defined(TRIO_MINIMAL)
-/*
- * trio_string_upper
- */
-TRIO_STRING_PUBLIC int
-trio_string_upper
-TRIO_ARGS1((self),
- trio_string_t *self)
-{
- assert(self);
-
- return trio_upper(self->content);
-}
-#endif /* !defined(TRIO_MINIMAL) */
-
-/** @} End of DynamicStrings */
diff --git a/bundle/libxml/triostr.h b/bundle/libxml/triostr.h
deleted file mode 100644
index 083e2a52ff..0000000000
--- a/bundle/libxml/triostr.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*************************************************************************
- *
- * $Id$
- *
- * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- ************************************************************************/
-
-#ifndef TRIO_TRIOSTR_H
-#define TRIO_TRIOSTR_H
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include "triodef.h"
-#include "triop.h"
-
-enum {
- TRIO_HASH_NONE = 0,
- TRIO_HASH_PLAIN,
- TRIO_HASH_TWOSIGNED
-};
-
-#if !defined(TRIO_STRING_PUBLIC)
-# if !defined(TRIO_PUBLIC)
-# define TRIO_PUBLIC
-# endif
-# define TRIO_STRING_PUBLIC TRIO_PUBLIC
-#endif
-
-/*************************************************************************
- * String functions
- */
-
-TRIO_STRING_PUBLIC int trio_append TRIO_PROTO((char *target, const char *source));
-TRIO_STRING_PUBLIC int trio_append_max TRIO_PROTO((char *target, size_t max, const char *source));
-TRIO_STRING_PUBLIC int trio_contains TRIO_PROTO((const char *string, const char *substring));
-TRIO_STRING_PUBLIC int trio_copy TRIO_PROTO((char *target, const char *source));
-TRIO_STRING_PUBLIC int trio_copy_max TRIO_PROTO((char *target, size_t max, const char *source));
-TRIO_STRING_PUBLIC char *trio_create TRIO_PROTO((size_t size));
-TRIO_STRING_PUBLIC void trio_destroy TRIO_PROTO((char *string));
-TRIO_STRING_PUBLIC char *trio_duplicate TRIO_PROTO((const char *source));
-TRIO_STRING_PUBLIC char *trio_duplicate_max TRIO_PROTO((const char *source, size_t max));
-TRIO_STRING_PUBLIC int trio_equal TRIO_PROTO((const char *first, const char *second));
-TRIO_STRING_PUBLIC int trio_equal_case TRIO_PROTO((const char *first, const char *second));
-TRIO_STRING_PUBLIC int trio_equal_case_max TRIO_PROTO((const char *first, size_t max, const char *second));
-TRIO_STRING_PUBLIC int trio_equal_locale TRIO_PROTO((const char *first, const char *second));
-TRIO_STRING_PUBLIC int trio_equal_max TRIO_PROTO((const char *first, size_t max, const char *second));
-TRIO_STRING_PUBLIC TRIO_CONST char *trio_error TRIO_PROTO((int));
-TRIO_STRING_PUBLIC size_t trio_format_date_max TRIO_PROTO((char *target, size_t max, const char *format, const struct tm *datetime));
-TRIO_STRING_PUBLIC unsigned long trio_hash TRIO_PROTO((const char *string, int type));
-TRIO_STRING_PUBLIC char *trio_index TRIO_PROTO((const char *string, int character));
-TRIO_STRING_PUBLIC char *trio_index_last TRIO_PROTO((const char *string, int character));
-TRIO_STRING_PUBLIC size_t trio_length TRIO_PROTO((const char *string));
-TRIO_STRING_PUBLIC int trio_lower TRIO_PROTO((char *target));
-TRIO_STRING_PUBLIC int trio_match TRIO_PROTO((const char *string, const char *pattern));
-TRIO_STRING_PUBLIC int trio_match_case TRIO_PROTO((const char *string, const char *pattern));
-TRIO_STRING_PUBLIC size_t trio_span_function TRIO_PROTO((char *target, const char *source, int (*Function) TRIO_PROTO((int))));
-TRIO_STRING_PUBLIC char *trio_substring TRIO_PROTO((const char *string, const char *substring));
-TRIO_STRING_PUBLIC char *trio_substring_max TRIO_PROTO((const char *string, size_t max, const char *substring));
-TRIO_STRING_PUBLIC double trio_to_double TRIO_PROTO((const char *source, char **endp));
-TRIO_STRING_PUBLIC float trio_to_float TRIO_PROTO((const char *source, char **endp));
-TRIO_STRING_PUBLIC trio_long_double_t trio_to_long_double TRIO_PROTO((const char *source, char **endp));
-TRIO_STRING_PUBLIC long trio_to_long TRIO_PROTO((const char *source, char **endp, int base));
-TRIO_STRING_PUBLIC unsigned long trio_to_unsigned_long TRIO_PROTO((const char *source, char **endp, int base));
-TRIO_STRING_PUBLIC char *trio_tokenize TRIO_PROTO((char *string, const char *delimiters));
-TRIO_STRING_PUBLIC int trio_upper TRIO_PROTO((char *target));
-
-/*************************************************************************
- * Dynamic string functions
- */
-
-/*
- * Opaque type for dynamic strings
- */
-typedef struct _trio_string_t trio_string_t;
-
-TRIO_STRING_PUBLIC trio_string_t *trio_string_create TRIO_PROTO((int initial_size));
-TRIO_STRING_PUBLIC void trio_string_destroy TRIO_PROTO((trio_string_t *self));
-TRIO_STRING_PUBLIC char *trio_string_get TRIO_PROTO((trio_string_t *self, int offset));
-TRIO_STRING_PUBLIC void trio_xstring_set TRIO_PROTO((trio_string_t *self, char *buffer));
-TRIO_STRING_PUBLIC char *trio_string_extract TRIO_PROTO((trio_string_t *self));
-TRIO_STRING_PUBLIC int trio_string_size TRIO_PROTO((trio_string_t *self));
-TRIO_STRING_PUBLIC void trio_string_terminate TRIO_PROTO((trio_string_t *self));
-
-TRIO_STRING_PUBLIC int trio_string_append TRIO_PROTO((trio_string_t *self, trio_string_t *other));
-TRIO_STRING_PUBLIC int trio_string_contains TRIO_PROTO((trio_string_t *self, trio_string_t *other));
-TRIO_STRING_PUBLIC int trio_string_copy TRIO_PROTO((trio_string_t *self, trio_string_t *other));
-TRIO_STRING_PUBLIC trio_string_t *trio_string_duplicate TRIO_PROTO((trio_string_t *other));
-TRIO_STRING_PUBLIC int trio_string_equal TRIO_PROTO((trio_string_t *self, trio_string_t *other));
-TRIO_STRING_PUBLIC int trio_string_equal_max TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *second));
-TRIO_STRING_PUBLIC int trio_string_equal_case TRIO_PROTO((trio_string_t *self, trio_string_t *other));
-TRIO_STRING_PUBLIC int trio_string_equal_case_max TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *other));
-TRIO_STRING_PUBLIC size_t trio_string_format_date_max TRIO_PROTO((trio_string_t *self, size_t max, const char *format, const struct tm *datetime));
-TRIO_STRING_PUBLIC char *trio_string_index TRIO_PROTO((trio_string_t *self, int character));
-TRIO_STRING_PUBLIC char *trio_string_index_last TRIO_PROTO((trio_string_t *self, int character));
-TRIO_STRING_PUBLIC int trio_string_length TRIO_PROTO((trio_string_t *self));
-TRIO_STRING_PUBLIC int trio_string_lower TRIO_PROTO((trio_string_t *self));
-TRIO_STRING_PUBLIC int trio_string_match TRIO_PROTO((trio_string_t *self, trio_string_t *other));
-TRIO_STRING_PUBLIC int trio_string_match_case TRIO_PROTO((trio_string_t *self, trio_string_t *other));
-TRIO_STRING_PUBLIC char *trio_string_substring TRIO_PROTO((trio_string_t *self, trio_string_t *other));
-TRIO_STRING_PUBLIC int trio_string_upper TRIO_PROTO((trio_string_t *self));
-
-TRIO_STRING_PUBLIC int trio_xstring_append_char TRIO_PROTO((trio_string_t *self, char character));
-TRIO_STRING_PUBLIC int trio_xstring_append TRIO_PROTO((trio_string_t *self, const char *other));
-TRIO_STRING_PUBLIC int trio_xstring_contains TRIO_PROTO((trio_string_t *self, const char *other));
-TRIO_STRING_PUBLIC int trio_xstring_copy TRIO_PROTO((trio_string_t *self, const char *other));
-TRIO_STRING_PUBLIC trio_string_t *trio_xstring_duplicate TRIO_PROTO((const char *other));
-TRIO_STRING_PUBLIC int trio_xstring_equal TRIO_PROTO((trio_string_t *self, const char *other));
-TRIO_STRING_PUBLIC int trio_xstring_equal_max TRIO_PROTO((trio_string_t *self, size_t max, const char *other));
-TRIO_STRING_PUBLIC int trio_xstring_equal_case TRIO_PROTO((trio_string_t *self, const char *other));
-TRIO_STRING_PUBLIC int trio_xstring_equal_case_max TRIO_PROTO((trio_string_t *self, size_t max, const char *other));
-TRIO_STRING_PUBLIC int trio_xstring_match TRIO_PROTO((trio_string_t *self, const char *other));
-TRIO_STRING_PUBLIC int trio_xstring_match_case TRIO_PROTO((trio_string_t *self, const char *other));
-TRIO_STRING_PUBLIC char *trio_xstring_substring TRIO_PROTO((trio_string_t *self, const char *other));
-
-#endif /* TRIO_TRIOSTR_H */
diff --git a/bundle/libxml/uri.c b/bundle/libxml/uri.c
deleted file mode 100644
index 1f4ab600bd..0000000000
--- a/bundle/libxml/uri.c
+++ /dev/null
@@ -1,1962 +0,0 @@
-/**
- * uri.c: set of generic URI related routines
- *
- * Reference: RFC 2396
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#include <string.h>
-
-#include <libxml/xmlmemory.h>
-#include <libxml/uri.h>
-#include <libxml/globals.h>
-#include <libxml/xmlerror.h>
-
-/************************************************************************
- * *
- * Macros to differentiate various character type *
- * directly extracted from RFC 2396 *
- * *
- ************************************************************************/
-
-/*
- * alpha = lowalpha | upalpha
- */
-#define IS_ALPHA(x) (IS_LOWALPHA(x) || IS_UPALPHA(x))
-
-
-/*
- * lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" |
- * "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" |
- * "u" | "v" | "w" | "x" | "y" | "z"
- */
-
-#define IS_LOWALPHA(x) (((x) >= 'a') && ((x) <= 'z'))
-
-/*
- * upalpha = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" |
- * "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" |
- * "U" | "V" | "W" | "X" | "Y" | "Z"
- */
-#define IS_UPALPHA(x) (((x) >= 'A') && ((x) <= 'Z'))
-
-/*
- * digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
- */
-
-#define IS_DIGIT(x) (((x) >= '0') && ((x) <= '9'))
-
-/*
- * alphanum = alpha | digit
- */
-
-#define IS_ALPHANUM(x) (IS_ALPHA(x) || IS_DIGIT(x))
-
-/*
- * hex = digit | "A" | "B" | "C" | "D" | "E" | "F" |
- * "a" | "b" | "c" | "d" | "e" | "f"
- */
-
-#define IS_HEX(x) ((IS_DIGIT(x)) || (((x) >= 'a') && ((x) <= 'f')) || \
- (((x) >= 'A') && ((x) <= 'F')))
-
-/*
- * mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
- */
-
-#define IS_MARK(x) (((x) == '-') || ((x) == '_') || ((x) == '.') || \
- ((x) == '!') || ((x) == '~') || ((x) == '*') || ((x) == '\'') || \
- ((x) == '(') || ((x) == ')'))
-
-
-/*
- * reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | ","
- */
-
-#define IS_RESERVED(x) (((x) == ';') || ((x) == '/') || ((x) == '?') || \
- ((x) == ':') || ((x) == '@') || ((x) == '&') || ((x) == '=') || \
- ((x) == '+') || ((x) == '$') || ((x) == ','))
-
-/*
- * unreserved = alphanum | mark
- */
-
-#define IS_UNRESERVED(x) (IS_ALPHANUM(x) || IS_MARK(x))
-
-/*
- * escaped = "%" hex hex
- */
-
-#define IS_ESCAPED(p) ((*(p) == '%') && (IS_HEX((p)[1])) && \
- (IS_HEX((p)[2])))
-
-/*
- * uric_no_slash = unreserved | escaped | ";" | "?" | ":" | "@" |
- * "&" | "=" | "+" | "$" | ","
- */
-#define IS_URIC_NO_SLASH(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) ||\
- ((*(p) == ';')) || ((*(p) == '?')) || ((*(p) == ':')) ||\
- ((*(p) == '@')) || ((*(p) == '&')) || ((*(p) == '=')) ||\
- ((*(p) == '+')) || ((*(p) == '$')) || ((*(p) == ',')))
-
-/*
- * pchar = unreserved | escaped | ":" | "@" | "&" | "=" | "+" | "$" | ","
- */
-#define IS_PCHAR(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) || \
- ((*(p) == ':')) || ((*(p) == '@')) || ((*(p) == '&')) ||\
- ((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) ||\
- ((*(p) == ',')))
-
-/*
- * rel_segment = 1*( unreserved | escaped |
- * ";" | "@" | "&" | "=" | "+" | "$" | "," )
- */
-
-#define IS_SEGMENT(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) || \
- ((*(p) == ';')) || ((*(p) == '@')) || ((*(p) == '&')) || \
- ((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) || \
- ((*(p) == ',')))
-
-/*
- * scheme = alpha *( alpha | digit | "+" | "-" | "." )
- */
-
-#define IS_SCHEME(x) ((IS_ALPHA(x)) || (IS_DIGIT(x)) || \
- ((x) == '+') || ((x) == '-') || ((x) == '.'))
-
-/*
- * reg_name = 1*( unreserved | escaped | "$" | "," |
- * ";" | ":" | "@" | "&" | "=" | "+" )
- */
-
-#define IS_REG_NAME(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) || \
- ((*(p) == '$')) || ((*(p) == ',')) || ((*(p) == ';')) || \
- ((*(p) == ':')) || ((*(p) == '@')) || ((*(p) == '&')) || \
- ((*(p) == '=')) || ((*(p) == '+')))
-
-/*
- * userinfo = *( unreserved | escaped | ";" | ":" | "&" | "=" |
- * "+" | "$" | "," )
- */
-#define IS_USERINFO(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) || \
- ((*(p) == ';')) || ((*(p) == ':')) || ((*(p) == '&')) || \
- ((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) || \
- ((*(p) == ',')))
-
-/*
- * uric = reserved | unreserved | escaped
- */
-
-#define IS_URIC(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) || \
- (IS_RESERVED(*(p))))
-
-/*
-* unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`"
-*/
-
-#define IS_UNWISE(p) \
- (((*(p) == '{')) || ((*(p) == '}')) || ((*(p) == '|')) || \
- ((*(p) == '\\')) || ((*(p) == '^')) || ((*(p) == '[')) || \
- ((*(p) == ']')) || ((*(p) == '`')))
-
-/*
- * Skip to next pointer char, handle escaped sequences
- */
-
-#define NEXT(p) ((*p == '%')? p += 3 : p++)
-
-/*
- * Productions from the spec.
- *
- * authority = server | reg_name
- * reg_name = 1*( unreserved | escaped | "$" | "," |
- * ";" | ":" | "@" | "&" | "=" | "+" )
- *
- * path = [ abs_path | opaque_part ]
- */
-
-/************************************************************************
- * *
- * Generic URI structure functions *
- * *
- ************************************************************************/
-
-/**
- * xmlCreateURI:
- *
- * Simply creates an empty xmlURI
- *
- * Returns the new structure or NULL in case of error
- */
-xmlURIPtr
-xmlCreateURI(void) {
- xmlURIPtr ret;
-
- ret = (xmlURIPtr) xmlMalloc(sizeof(xmlURI));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlCreateURI: out of memory\n");
- return(NULL);
- }
- memset(ret, 0, sizeof(xmlURI));
- return(ret);
-}
-
-/**
- * xmlSaveUri:
- * @uri: pointer to an xmlURI
- *
- * Save the URI as an escaped string
- *
- * Returns a new string (to be deallocated by caller)
- */
-xmlChar *
-xmlSaveUri(xmlURIPtr uri) {
- xmlChar *ret = NULL;
- const char *p;
- int len;
- int max;
-
- if (uri == NULL) return(NULL);
-
-
- max = 80;
- ret = (xmlChar *) xmlMalloc((max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- len = 0;
-
- if (uri->scheme != NULL) {
- p = uri->scheme;
- while (*p != 0) {
- if (len >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- ret[len++] = *p++;
- }
- if (len >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- ret[len++] = ':';
- }
- if (uri->opaque != NULL) {
- p = uri->opaque;
- while (*p != 0) {
- if (len + 3 >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- if ((IS_UNRESERVED(*(p))) ||
- ((*(p) == ';')) || ((*(p) == '?')) || ((*(p) == ':')) ||
- ((*(p) == '@')) || ((*(p) == '&')) || ((*(p) == '=')) ||
- ((*(p) == '+')) || ((*(p) == '$')) || ((*(p) == ',')))
- ret[len++] = *p++;
- else {
- int val = *(unsigned char *)p++;
- int hi = val / 0x10, lo = val % 0x10;
- ret[len++] = '%';
- ret[len++] = hi + (hi > 9? 'A'-10 : '0');
- ret[len++] = lo + (lo > 9? 'A'-10 : '0');
- }
- }
- } else {
- if (uri->server != NULL) {
- if (len + 3 >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- ret[len++] = '/';
- ret[len++] = '/';
- if (uri->user != NULL) {
- p = uri->user;
- while (*p != 0) {
- if (len + 3 >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret,
- (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- if ((IS_UNRESERVED(*(p))) ||
- ((*(p) == ';')) || ((*(p) == ':')) ||
- ((*(p) == '&')) || ((*(p) == '=')) ||
- ((*(p) == '+')) || ((*(p) == '$')) ||
- ((*(p) == ',')))
- ret[len++] = *p++;
- else {
- int val = *(unsigned char *)p++;
- int hi = val / 0x10, lo = val % 0x10;
- ret[len++] = '%';
- ret[len++] = hi + (hi > 9? 'A'-10 : '0');
- ret[len++] = lo + (lo > 9? 'A'-10 : '0');
- }
- }
- if (len + 3 >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret,
- (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- ret[len++] = '@';
- }
- p = uri->server;
- while (*p != 0) {
- if (len >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret,
- (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- ret[len++] = *p++;
- }
- if (uri->port > 0) {
- if (len + 10 >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret,
- (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- len += snprintf((char *) &ret[len], max - len, ":%d", uri->port);
- }
- } else if (uri->authority != NULL) {
- if (len + 3 >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret,
- (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- ret[len++] = '/';
- ret[len++] = '/';
- p = uri->authority;
- while (*p != 0) {
- if (len + 3 >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret,
- (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- if ((IS_UNRESERVED(*(p))) ||
- ((*(p) == '$')) || ((*(p) == ',')) || ((*(p) == ';')) ||
- ((*(p) == ':')) || ((*(p) == '@')) || ((*(p) == '&')) ||
- ((*(p) == '=')) || ((*(p) == '+')))
- ret[len++] = *p++;
- else {
- int val = *(unsigned char *)p++;
- int hi = val / 0x10, lo = val % 0x10;
- ret[len++] = '%';
- ret[len++] = hi + (hi > 9? 'A'-10 : '0');
- ret[len++] = lo + (lo > 9? 'A'-10 : '0');
- }
- }
- } else if (uri->scheme != NULL) {
- if (len + 3 >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret,
- (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- ret[len++] = '/';
- ret[len++] = '/';
- }
- if (uri->path != NULL) {
- p = uri->path;
- while (*p != 0) {
- if (len + 3 >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret,
- (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- if ((IS_UNRESERVED(*(p))) || ((*(p) == '/')) ||
- ((*(p) == ';')) || ((*(p) == '@')) || ((*(p) == '&')) ||
- ((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) ||
- ((*(p) == ',')))
- ret[len++] = *p++;
- else {
- int val = *(unsigned char *)p++;
- int hi = val / 0x10, lo = val % 0x10;
- ret[len++] = '%';
- ret[len++] = hi + (hi > 9? 'A'-10 : '0');
- ret[len++] = lo + (lo > 9? 'A'-10 : '0');
- }
- }
- }
- if (uri->query != NULL) {
- if (len + 3 >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret,
- (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- ret[len++] = '?';
- p = uri->query;
- while (*p != 0) {
- if (len + 3 >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret,
- (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- if ((IS_UNRESERVED(*(p))) || (IS_RESERVED(*(p))))
- ret[len++] = *p++;
- else {
- int val = *(unsigned char *)p++;
- int hi = val / 0x10, lo = val % 0x10;
- ret[len++] = '%';
- ret[len++] = hi + (hi > 9? 'A'-10 : '0');
- ret[len++] = lo + (lo > 9? 'A'-10 : '0');
- }
- }
- }
- }
- if (uri->fragment != NULL) {
- if (len + 3 >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret,
- (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- ret[len++] = '#';
- p = uri->fragment;
- while (*p != 0) {
- if (len + 3 >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret,
- (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- if ((IS_UNRESERVED(*(p))) || (IS_RESERVED(*(p))))
- ret[len++] = *p++;
- else {
- int val = *(unsigned char *)p++;
- int hi = val / 0x10, lo = val % 0x10;
- ret[len++] = '%';
- ret[len++] = hi + (hi > 9? 'A'-10 : '0');
- ret[len++] = lo + (lo > 9? 'A'-10 : '0');
- }
- }
- }
- if (len >= max) {
- max *= 2;
- ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlSaveUri: out of memory\n");
- return(NULL);
- }
- }
- ret[len++] = 0;
- return(ret);
-}
-
-/**
- * xmlPrintURI:
- * @stream: a FILE* for the output
- * @uri: pointer to an xmlURI
- *
- * Prints the URI in the stream @steam.
- */
-void
-xmlPrintURI(FILE *stream, xmlURIPtr uri) {
- xmlChar *out;
-
- out = xmlSaveUri(uri);
- if (out != NULL) {
- fprintf(stream, "%s", out);
- xmlFree(out);
- }
-}
-
-/**
- * xmlCleanURI:
- * @uri: pointer to an xmlURI
- *
- * Make sure the xmlURI struct is free of content
- */
-static void
-xmlCleanURI(xmlURIPtr uri) {
- if (uri == NULL) return;
-
- if (uri->scheme != NULL) xmlFree(uri->scheme);
- uri->scheme = NULL;
- if (uri->server != NULL) xmlFree(uri->server);
- uri->server = NULL;
- if (uri->user != NULL) xmlFree(uri->user);
- uri->user = NULL;
- if (uri->path != NULL) xmlFree(uri->path);
- uri->path = NULL;
- if (uri->fragment != NULL) xmlFree(uri->fragment);
- uri->fragment = NULL;
- if (uri->opaque != NULL) xmlFree(uri->opaque);
- uri->opaque = NULL;
- if (uri->authority != NULL) xmlFree(uri->authority);
- uri->authority = NULL;
- if (uri->query != NULL) xmlFree(uri->query);
- uri->query = NULL;
-}
-
-/**
- * xmlFreeURI:
- * @uri: pointer to an xmlURI
- *
- * Free up the xmlURI struct
- */
-void
-xmlFreeURI(xmlURIPtr uri) {
- if (uri == NULL) return;
-
- if (uri->scheme != NULL) xmlFree(uri->scheme);
- if (uri->server != NULL) xmlFree(uri->server);
- if (uri->user != NULL) xmlFree(uri->user);
- if (uri->path != NULL) xmlFree(uri->path);
- if (uri->fragment != NULL) xmlFree(uri->fragment);
- if (uri->opaque != NULL) xmlFree(uri->opaque);
- if (uri->authority != NULL) xmlFree(uri->authority);
- if (uri->query != NULL) xmlFree(uri->query);
- xmlFree(uri);
-}
-
-/************************************************************************
- * *
- * Helper functions *
- * *
- ************************************************************************/
-
-/**
- * xmlNormalizeURIPath:
- * @path: pointer to the path string
- *
- * Applies the 5 normalization steps to a path string--that is, RFC 2396
- * Section 5.2, steps 6.c through 6.g.
- *
- * Normalization occurs directly on the string, no new allocation is done
- *
- * Returns 0 or an error code
- */
-int
-xmlNormalizeURIPath(char *path) {
- char *cur, *out;
-
- if (path == NULL)
- return(-1);
-
- /* Skip all initial "/" chars. We want to get to the beginning of the
- * first non-empty segment.
- */
- cur = path;
- while (cur[0] == '/')
- ++cur;
- if (cur[0] == '\0')
- return(0);
-
- /* Keep everything we've seen so far. */
- out = cur;
-
- /*
- * Analyze each segment in sequence for cases (c) and (d).
- */
- while (cur[0] != '\0') {
- /*
- * c) All occurrences of "./", where "." is a complete path segment,
- * are removed from the buffer string.
- */
- if ((cur[0] == '.') && (cur[1] == '/')) {
- cur += 2;
- /* '//' normalization should be done at this point too */
- while (cur[0] == '/')
- cur++;
- continue;
- }
-
- /*
- * d) If the buffer string ends with "." as a complete path segment,
- * that "." is removed.
- */
- if ((cur[0] == '.') && (cur[1] == '\0'))
- break;
-
- /* Otherwise keep the segment. */
- while (cur[0] != '/') {
- if (cur[0] == '\0')
- goto done_cd;
- (out++)[0] = (cur++)[0];
- }
- /* nomalize // */
- while ((cur[0] == '/') && (cur[1] == '/'))
- cur++;
-
- (out++)[0] = (cur++)[0];
- }
- done_cd:
- out[0] = '\0';
-
- /* Reset to the beginning of the first segment for the next sequence. */
- cur = path;
- while (cur[0] == '/')
- ++cur;
- if (cur[0] == '\0')
- return(0);
-
- /*
- * Analyze each segment in sequence for cases (e) and (f).
- *
- * e) All occurrences of "<segment>/../", where <segment> is a
- * complete path segment not equal to "..", are removed from the
- * buffer string. Removal of these path segments is performed
- * iteratively, removing the leftmost matching pattern on each
- * iteration, until no matching pattern remains.
- *
- * f) If the buffer string ends with "<segment>/..", where <segment>
- * is a complete path segment not equal to "..", that
- * "<segment>/.." is removed.
- *
- * To satisfy the "iterative" clause in (e), we need to collapse the
- * string every time we find something that needs to be removed. Thus,
- * we don't need to keep two pointers into the string: we only need a
- * "current position" pointer.
- */
- while (1) {
- char *segp;
-
- /* At the beginning of each iteration of this loop, "cur" points to
- * the first character of the segment we want to examine.
- */
-
- /* Find the end of the current segment. */
- segp = cur;
- while ((segp[0] != '/') && (segp[0] != '\0'))
- ++segp;
-
- /* If this is the last segment, we're done (we need at least two
- * segments to meet the criteria for the (e) and (f) cases).
- */
- if (segp[0] == '\0')
- break;
-
- /* If the first segment is "..", or if the next segment _isn't_ "..",
- * keep this segment and try the next one.
- */
- ++segp;
- if (((cur[0] == '.') && (cur[1] == '.') && (segp == cur+3))
- || ((segp[0] != '.') || (segp[1] != '.')
- || ((segp[2] != '/') && (segp[2] != '\0')))) {
- cur = segp;
- continue;
- }
-
- /* If we get here, remove this segment and the next one and back up
- * to the previous segment (if there is one), to implement the
- * "iteratively" clause. It's pretty much impossible to back up
- * while maintaining two pointers into the buffer, so just compact
- * the whole buffer now.
- */
-
- /* If this is the end of the buffer, we're done. */
- if (segp[2] == '\0') {
- cur[0] = '\0';
- break;
- }
- strcpy(cur, segp + 3);
-
- /* If there are no previous segments, then keep going from here. */
- segp = cur;
- while ((segp > path) && ((--segp)[0] == '/'))
- ;
- if (segp == path)
- continue;
-
- /* "segp" is pointing to the end of a previous segment; find it's
- * start. We need to back up to the previous segment and start
- * over with that to handle things like "foo/bar/../..". If we
- * don't do this, then on the first pass we'll remove the "bar/..",
- * but be pointing at the second ".." so we won't realize we can also
- * remove the "foo/..".
- */
- cur = segp;
- while ((cur > path) && (cur[-1] != '/'))
- --cur;
- }
- out[0] = '\0';
-
- /*
- * g) If the resulting buffer string still begins with one or more
- * complete path segments of "..", then the reference is
- * considered to be in error. Implementations may handle this
- * error by retaining these components in the resolved path (i.e.,
- * treating them as part of the final URI), by removing them from
- * the resolved path (i.e., discarding relative levels above the
- * root), or by avoiding traversal of the reference.
- *
- * We discard them from the final path.
- */
- if (path[0] == '/') {
- cur = path;
- while ((cur[1] == '.') && (cur[2] == '.')
- && ((cur[3] == '/') || (cur[3] == '\0')))
- cur += 3;
-
- if (cur != path) {
- out = path;
- while (cur[0] != '\0')
- (out++)[0] = (cur++)[0];
- out[0] = 0;
- }
- }
-
- return(0);
-}
-
-/**
- * xmlURIUnescapeString:
- * @str: the string to unescape
- * @len: the length in bytes to unescape (or <= 0 to indicate full string)
- * @target: optional destination buffer
- *
- * Unescaping routine, does not do validity checks !
- * Output is direct unsigned char translation of %XX values (no encoding)
- *
- * Returns an copy of the string, but unescaped
- */
-char *
-xmlURIUnescapeString(const char *str, int len, char *target) {
- char *ret, *out;
- const char *in;
-
- if (str == NULL)
- return(NULL);
- if (len <= 0) len = strlen(str);
- if (len <= 0) return(NULL);
-
- if (target == NULL) {
- ret = (char *) xmlMalloc(len + 1);
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlURIUnescapeString: out of memory\n");
- return(NULL);
- }
- } else
- ret = target;
- in = str;
- out = ret;
- while(len > 0) {
- if (*in == '%') {
- in++;
- if ((*in >= '0') && (*in <= '9'))
- *out = (*in - '0');
- else if ((*in >= 'a') && (*in <= 'f'))
- *out = (*in - 'a') + 10;
- else if ((*in >= 'A') && (*in <= 'F'))
- *out = (*in - 'A') + 10;
- in++;
- if ((*in >= '0') && (*in <= '9'))
- *out = *out * 16 + (*in - '0');
- else if ((*in >= 'a') && (*in <= 'f'))
- *out = *out * 16 + (*in - 'a') + 10;
- else if ((*in >= 'A') && (*in <= 'F'))
- *out = *out * 16 + (*in - 'A') + 10;
- in++;
- len -= 3;
- out++;
- } else {
- *out++ = *in++;
- len--;
- }
- }
- *out = 0;
- return(ret);
-}
-
-/**
- * xmlURIEscapeStr:
- * @str: string to escape
- * @list: exception list string of chars not to escape
- *
- * This routine escapes a string to hex, ignoring reserved characters (a-z)
- * and the characters in the exception list.
- *
- * Returns a new escaped string or NULL in case of error.
- */
-xmlChar *
-xmlURIEscapeStr(const xmlChar *str, const xmlChar *list) {
- xmlChar *ret, ch;
- const xmlChar *in;
-
- unsigned int len, out;
-
- if (str == NULL)
- return(NULL);
- len = xmlStrlen(str);
- if (!(len > 0)) return(NULL);
-
- len += 20;
- ret = (xmlChar *) xmlMalloc(len);
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlURIEscapeStr: out of memory\n");
- return(NULL);
- }
- in = (const xmlChar *) str;
- out = 0;
- while(*in != 0) {
- if (len - out <= 3) {
- len += 20;
- ret = (xmlChar *) xmlRealloc(ret, len);
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlURIEscapeStr: out of memory\n");
- return(NULL);
- }
- }
-
- ch = *in;
-
- if ((ch != '@') && (!IS_UNRESERVED(ch)) && (!xmlStrchr(list, ch))) {
- unsigned char val;
- ret[out++] = '%';
- val = ch >> 4;
- if (val <= 9)
- ret[out++] = '0' + val;
- else
- ret[out++] = 'A' + val - 0xA;
- val = ch & 0xF;
- if (val <= 9)
- ret[out++] = '0' + val;
- else
- ret[out++] = 'A' + val - 0xA;
- in++;
- } else {
- ret[out++] = *in++;
- }
-
- }
- ret[out] = 0;
- return(ret);
-}
-
-/**
- * xmlURIEscape:
- * @str: the string of the URI to escape
- *
- * Escaping routine, does not do validity checks !
- * It will try to escape the chars needing this, but this is heuristic
- * based it's impossible to be sure.
- *
- * Returns an copy of the string, but escaped
- *
- * 25 May 2001
- * Uses xmlParseURI and xmlURIEscapeStr to try to escape correctly
- * according to RFC2396.
- * - Carl Douglas
- */
-xmlChar *
-xmlURIEscape(const xmlChar * str)
-{
- xmlChar *ret, *segment = NULL;
- xmlURIPtr uri;
- int ret2;
-
-#define NULLCHK(p) if(!p) { \
- xmlGenericError(xmlGenericErrorContext, \
- "xmlURIEscape: out of memory\n"); \
- return NULL; }
-
- if (str == NULL)
- return (NULL);
-
- uri = xmlCreateURI();
- if (uri != NULL) {
- /*
- * Allow escaping errors in the unescaped form
- */
- uri->cleanup = 1;
- ret2 = xmlParseURIReference(uri, (const char *)str);
- if (ret2) {
- xmlFreeURI(uri);
- return (NULL);
- }
- }
-
- if (!uri)
- return NULL;
-
- ret = NULL;
-
- if (uri->scheme) {
- segment = xmlURIEscapeStr(BAD_CAST uri->scheme, BAD_CAST "+-.");
- NULLCHK(segment)
- ret = xmlStrcat(ret, segment);
- ret = xmlStrcat(ret, BAD_CAST ":");
- xmlFree(segment);
- }
-
- if (uri->authority) {
- segment =
- xmlURIEscapeStr(BAD_CAST uri->authority, BAD_CAST "/?;:@");
- NULLCHK(segment)
- ret = xmlStrcat(ret, BAD_CAST "//");
- ret = xmlStrcat(ret, segment);
- xmlFree(segment);
- }
-
- if (uri->user) {
- segment = xmlURIEscapeStr(BAD_CAST uri->user, BAD_CAST ";:&=+$,");
- NULLCHK(segment)
- ret = xmlStrcat(ret, segment);
- ret = xmlStrcat(ret, BAD_CAST "@");
- xmlFree(segment);
- }
-
- if (uri->server) {
- segment = xmlURIEscapeStr(BAD_CAST uri->server, BAD_CAST "/?;:@");
- NULLCHK(segment)
- ret = xmlStrcat(ret, BAD_CAST "//");
- ret = xmlStrcat(ret, segment);
- xmlFree(segment);
- }
-
- if (uri->port) {
- xmlChar port[10];
-
- snprintf((char *) port, 10, "%d", uri->port);
- ret = xmlStrcat(ret, BAD_CAST ":");
- ret = xmlStrcat(ret, port);
- }
-
- if (uri->path) {
- segment =
- xmlURIEscapeStr(BAD_CAST uri->path, BAD_CAST ":@&=+$,/?;");
- NULLCHK(segment)
- ret = xmlStrcat(ret, segment);
- xmlFree(segment);
- }
-
- if (uri->query) {
- segment =
- xmlURIEscapeStr(BAD_CAST uri->query, BAD_CAST ";/?:@&=+,$");
- NULLCHK(segment)
- ret = xmlStrcat(ret, BAD_CAST "?");
- ret = xmlStrcat(ret, segment);
- xmlFree(segment);
- }
-
- if (uri->opaque) {
- segment = xmlURIEscapeStr(BAD_CAST uri->opaque, BAD_CAST "");
- NULLCHK(segment)
- ret = xmlStrcat(ret, segment);
- xmlFree(segment);
- }
-
- if (uri->fragment) {
- segment = xmlURIEscapeStr(BAD_CAST uri->fragment, BAD_CAST "#");
- NULLCHK(segment)
- ret = xmlStrcat(ret, BAD_CAST "#");
- ret = xmlStrcat(ret, segment);
- xmlFree(segment);
- }
-
- xmlFreeURI(uri);
-#undef NULLCHK
-
- return (ret);
-}
-
-/************************************************************************
- * *
- * Escaped URI parsing *
- * *
- ************************************************************************/
-
-/**
- * xmlParseURIFragment:
- * @uri: pointer to an URI structure
- * @str: pointer to the string to analyze
- *
- * Parse an URI fragment string and fills in the appropriate fields
- * of the @uri structure.
- *
- * fragment = *uric
- *
- * Returns 0 or the error code
- */
-static int
-xmlParseURIFragment(xmlURIPtr uri, const char **str)
-{
- const char *cur = *str;
-
- if (str == NULL)
- return (-1);
-
- while (IS_URIC(cur) || IS_UNWISE(cur))
- NEXT(cur);
- if (uri != NULL) {
- if (uri->fragment != NULL)
- xmlFree(uri->fragment);
- uri->fragment = xmlURIUnescapeString(*str, cur - *str, NULL);
- }
- *str = cur;
- return (0);
-}
-
-/**
- * xmlParseURIQuery:
- * @uri: pointer to an URI structure
- * @str: pointer to the string to analyze
- *
- * Parse the query part of an URI
- *
- * query = *uric
- *
- * Returns 0 or the error code
- */
-static int
-xmlParseURIQuery(xmlURIPtr uri, const char **str)
-{
- const char *cur = *str;
-
- if (str == NULL)
- return (-1);
-
- while (IS_URIC(cur) || ((uri->cleanup) && (IS_UNWISE(cur))))
- NEXT(cur);
- if (uri != NULL) {
- if (uri->query != NULL)
- xmlFree(uri->query);
- uri->query = xmlURIUnescapeString(*str, cur - *str, NULL);
- }
- *str = cur;
- return (0);
-}
-
-/**
- * xmlParseURIScheme:
- * @uri: pointer to an URI structure
- * @str: pointer to the string to analyze
- *
- * Parse an URI scheme
- *
- * scheme = alpha *( alpha | digit | "+" | "-" | "." )
- *
- * Returns 0 or the error code
- */
-static int
-xmlParseURIScheme(xmlURIPtr uri, const char **str) {
- const char *cur;
-
- if (str == NULL)
- return(-1);
-
- cur = *str;
- if (!IS_ALPHA(*cur))
- return(2);
- cur++;
- while (IS_SCHEME(*cur)) cur++;
- if (uri != NULL) {
- if (uri->scheme != NULL) xmlFree(uri->scheme);
- /* !!! strndup */
- uri->scheme = xmlURIUnescapeString(*str, cur - *str, NULL);
- }
- *str = cur;
- return(0);
-}
-
-/**
- * xmlParseURIOpaquePart:
- * @uri: pointer to an URI structure
- * @str: pointer to the string to analyze
- *
- * Parse an URI opaque part
- *
- * opaque_part = uric_no_slash *uric
- *
- * Returns 0 or the error code
- */
-static int
-xmlParseURIOpaquePart(xmlURIPtr uri, const char **str)
-{
- const char *cur;
-
- if (str == NULL)
- return (-1);
-
- cur = *str;
- if (!(IS_URIC_NO_SLASH(cur) || ((uri->cleanup) && (IS_UNWISE(cur))))) {
- return (3);
- }
- NEXT(cur);
- while (IS_URIC(cur) || ((uri->cleanup) && (IS_UNWISE(cur))))
- NEXT(cur);
- if (uri != NULL) {
- if (uri->opaque != NULL)
- xmlFree(uri->opaque);
- uri->opaque = xmlURIUnescapeString(*str, cur - *str, NULL);
- }
- *str = cur;
- return (0);
-}
-
-/**
- * xmlParseURIServer:
- * @uri: pointer to an URI structure
- * @str: pointer to the string to analyze
- *
- * Parse a server subpart of an URI, it's a finer grain analysis
- * of the authority part.
- *
- * server = [ [ userinfo "@" ] hostport ]
- * userinfo = *( unreserved | escaped |
- * ";" | ":" | "&" | "=" | "+" | "$" | "," )
- * hostport = host [ ":" port ]
- * host = hostname | IPv4address
- * hostname = *( domainlabel "." ) toplabel [ "." ]
- * domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
- * toplabel = alpha | alpha *( alphanum | "-" ) alphanum
- * IPv4address = 1*digit "." 1*digit "." 1*digit "." 1*digit
- * port = *digit
- *
- * Returns 0 or the error code
- */
-static int
-xmlParseURIServer(xmlURIPtr uri, const char **str) {
- const char *cur;
- const char *host, *tmp;
-
- if (str == NULL)
- return(-1);
-
- cur = *str;
-
- /*
- * is there an userinfo ?
- */
- while (IS_USERINFO(cur)) NEXT(cur);
- if (*cur == '@') {
- if (uri != NULL) {
- if (uri->user != NULL) xmlFree(uri->user);
- uri->user = xmlURIUnescapeString(*str, cur - *str, NULL);
- }
- cur++;
- } else {
- if (uri != NULL) {
- if (uri->user != NULL) xmlFree(uri->user);
- uri->user = NULL;
- }
- cur = *str;
- }
- /*
- * This can be empty in the case where there is no server
- */
- host = cur;
- if (*cur == '/') {
- if (uri != NULL) {
- if (uri->authority != NULL) xmlFree(uri->authority);
- uri->authority = NULL;
- if (uri->server != NULL) xmlFree(uri->server);
- uri->server = NULL;
- uri->port = 0;
- }
- return(0);
- }
- /*
- * host part of hostport can derive either an IPV4 address
- * or an unresolved name. Check the IP first, it easier to detect
- * errors if wrong one
- */
- if (IS_DIGIT(*cur)) {
- while(IS_DIGIT(*cur)) cur++;
- if (*cur != '.')
- goto host_name;
- cur++;
- if (!IS_DIGIT(*cur))
- goto host_name;
- while(IS_DIGIT(*cur)) cur++;
- if (*cur != '.')
- goto host_name;
- cur++;
- if (!IS_DIGIT(*cur))
- goto host_name;
- while(IS_DIGIT(*cur)) cur++;
- if (*cur != '.')
- goto host_name;
- cur++;
- if (!IS_DIGIT(*cur))
- goto host_name;
- while(IS_DIGIT(*cur)) cur++;
- if (uri != NULL) {
- if (uri->authority != NULL) xmlFree(uri->authority);
- uri->authority = NULL;
- if (uri->server != NULL) xmlFree(uri->server);
- uri->server = xmlURIUnescapeString(host, cur - host, NULL);
- }
- goto host_done;
- }
-host_name:
- /*
- * the hostname production as-is is a parser nightmare.
- * simplify it to
- * hostname = *( domainlabel "." ) domainlabel [ "." ]
- * and just make sure the last label starts with a non numeric char.
- */
- if (!IS_ALPHANUM(*cur))
- return(6);
- while (IS_ALPHANUM(*cur)) {
- while ((IS_ALPHANUM(*cur)) || (*cur == '-')) cur++;
- if (*cur == '.')
- cur++;
- }
- tmp = cur;
- tmp--;
- while (IS_ALPHANUM(*tmp) && (*tmp != '.') && (tmp >= host)) tmp--;
- tmp++;
- if (!IS_ALPHA(*tmp))
- return(7);
- if (uri != NULL) {
- if (uri->authority != NULL) xmlFree(uri->authority);
- uri->authority = NULL;
- if (uri->server != NULL) xmlFree(uri->server);
- uri->server = xmlURIUnescapeString(host, cur - host, NULL);
- }
-
-host_done:
-
- /*
- * finish by checking for a port presence.
- */
- if (*cur == ':') {
- cur++;
- if (IS_DIGIT(*cur)) {
- if (uri != NULL)
- uri->port = 0;
- while (IS_DIGIT(*cur)) {
- if (uri != NULL)
- uri->port = uri->port * 10 + (*cur - '0');
- cur++;
- }
- }
- }
- *str = cur;
- return(0);
-}
-
-/**
- * xmlParseURIRelSegment:
- * @uri: pointer to an URI structure
- * @str: pointer to the string to analyze
- *
- * Parse an URI relative segment
- *
- * rel_segment = 1*( unreserved | escaped | ";" | "@" | "&" | "=" |
- * "+" | "$" | "," )
- *
- * Returns 0 or the error code
- */
-static int
-xmlParseURIRelSegment(xmlURIPtr uri, const char **str)
-{
- const char *cur;
-
- if (str == NULL)
- return (-1);
-
- cur = *str;
- if (!(IS_SEGMENT(cur) || ((uri->cleanup) && (IS_UNWISE(cur))))) {
- return (3);
- }
- NEXT(cur);
- while (IS_SEGMENT(cur) || ((uri->cleanup) && (IS_UNWISE(cur))))
- NEXT(cur);
- if (uri != NULL) {
- if (uri->path != NULL)
- xmlFree(uri->path);
- uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
- }
- *str = cur;
- return (0);
-}
-
-/**
- * xmlParseURIPathSegments:
- * @uri: pointer to an URI structure
- * @str: pointer to the string to analyze
- * @slash: should we add a leading slash
- *
- * Parse an URI set of path segments
- *
- * path_segments = segment *( "/" segment )
- * segment = *pchar *( ";" param )
- * param = *pchar
- *
- * Returns 0 or the error code
- */
-static int
-xmlParseURIPathSegments(xmlURIPtr uri, const char **str, int slash)
-{
- const char *cur;
-
- if (str == NULL)
- return (-1);
-
- cur = *str;
-
- do {
- while (IS_PCHAR(cur) || ((uri->cleanup) && (IS_UNWISE(cur))))
- NEXT(cur);
- while (*cur == ';') {
- cur++;
- while (IS_PCHAR(cur) || ((uri->cleanup) && (IS_UNWISE(cur))))
- NEXT(cur);
- }
- if (*cur != '/')
- break;
- cur++;
- } while (1);
- if (uri != NULL) {
- int len, len2 = 0;
- char *path;
-
- /*
- * Concat the set of path segments to the current path
- */
- len = cur - *str;
- if (slash)
- len++;
-
- if (uri->path != NULL) {
- len2 = strlen(uri->path);
- len += len2;
- }
- path = (char *) xmlMalloc(len + 1);
- if (path == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParseURIPathSegments: out of memory\n");
- *str = cur;
- return (-1);
- }
- if (uri->path != NULL)
- memcpy(path, uri->path, len2);
- if (slash) {
- path[len2] = '/';
- len2++;
- }
- path[len2] = 0;
- if (cur - *str > 0)
- xmlURIUnescapeString(*str, cur - *str, &path[len2]);
- if (uri->path != NULL)
- xmlFree(uri->path);
- uri->path = path;
- }
- *str = cur;
- return (0);
-}
-
-/**
- * xmlParseURIAuthority:
- * @uri: pointer to an URI structure
- * @str: pointer to the string to analyze
- *
- * Parse the authority part of an URI.
- *
- * authority = server | reg_name
- * server = [ [ userinfo "@" ] hostport ]
- * reg_name = 1*( unreserved | escaped | "$" | "," | ";" | ":" |
- * "@" | "&" | "=" | "+" )
- *
- * Note : this is completely ambiguous since reg_name is allowed to
- * use the full set of chars in use by server:
- *
- * 3.2.1. Registry-based Naming Authority
- *
- * The structure of a registry-based naming authority is specific
- * to the URI scheme, but constrained to the allowed characters
- * for an authority component.
- *
- * Returns 0 or the error code
- */
-static int
-xmlParseURIAuthority(xmlURIPtr uri, const char **str) {
- const char *cur;
- int ret;
-
- if (str == NULL)
- return(-1);
-
- cur = *str;
-
- /*
- * try first to parse it as a server string.
- */
- ret = xmlParseURIServer(uri, str);
- if (ret == 0)
- return(0);
-
- /*
- * failed, fallback to reg_name
- */
- if (!IS_REG_NAME(cur)) {
- return(5);
- }
- NEXT(cur);
- while (IS_REG_NAME(cur)) NEXT(cur);
- if (uri != NULL) {
- if (uri->server != NULL) xmlFree(uri->server);
- uri->server = NULL;
- if (uri->user != NULL) xmlFree(uri->user);
- uri->user = NULL;
- if (uri->authority != NULL) xmlFree(uri->authority);
- uri->authority = xmlURIUnescapeString(*str, cur - *str, NULL);
- }
- *str = cur;
- return(0);
-}
-
-/**
- * xmlParseURIHierPart:
- * @uri: pointer to an URI structure
- * @str: pointer to the string to analyze
- *
- * Parse an URI hierarchical part
- *
- * hier_part = ( net_path | abs_path ) [ "?" query ]
- * abs_path = "/" path_segments
- * net_path = "//" authority [ abs_path ]
- *
- * Returns 0 or the error code
- */
-static int
-xmlParseURIHierPart(xmlURIPtr uri, const char **str) {
- int ret;
- const char *cur;
-
- if (str == NULL)
- return(-1);
-
- cur = *str;
-
- if ((cur[0] == '/') && (cur[1] == '/')) {
- cur += 2;
- ret = xmlParseURIAuthority(uri, &cur);
- if (ret != 0)
- return(ret);
- if (cur[0] == '/') {
- cur++;
- ret = xmlParseURIPathSegments(uri, &cur, 1);
- }
- } else if (cur[0] == '/') {
- cur++;
- ret = xmlParseURIPathSegments(uri, &cur, 1);
- } else {
- return(4);
- }
- if (ret != 0)
- return(ret);
- if (*cur == '?') {
- cur++;
- ret = xmlParseURIQuery(uri, &cur);
- if (ret != 0)
- return(ret);
- }
- *str = cur;
- return(0);
-}
-
-/**
- * xmlParseAbsoluteURI:
- * @uri: pointer to an URI structure
- * @str: pointer to the string to analyze
- *
- * Parse an URI reference string and fills in the appropriate fields
- * of the @uri structure
- *
- * absoluteURI = scheme ":" ( hier_part | opaque_part )
- *
- * Returns 0 or the error code
- */
-static int
-xmlParseAbsoluteURI(xmlURIPtr uri, const char **str) {
- int ret;
- const char *cur;
-
- if (str == NULL)
- return(-1);
-
- cur = *str;
-
- ret = xmlParseURIScheme(uri, str);
- if (ret != 0) return(ret);
- if (**str != ':') {
- *str = cur;
- return(1);
- }
- (*str)++;
- if (**str == '/')
- return(xmlParseURIHierPart(uri, str));
- return(xmlParseURIOpaquePart(uri, str));
-}
-
-/**
- * xmlParseRelativeURI:
- * @uri: pointer to an URI structure
- * @str: pointer to the string to analyze
- *
- * Parse an relative URI string and fills in the appropriate fields
- * of the @uri structure
- *
- * relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ]
- * abs_path = "/" path_segments
- * net_path = "//" authority [ abs_path ]
- * rel_path = rel_segment [ abs_path ]
- *
- * Returns 0 or the error code
- */
-static int
-xmlParseRelativeURI(xmlURIPtr uri, const char **str) {
- int ret = 0;
- const char *cur;
-
- if (str == NULL)
- return(-1);
-
- cur = *str;
- if ((cur[0] == '/') && (cur[1] == '/')) {
- cur += 2;
- ret = xmlParseURIAuthority(uri, &cur);
- if (ret != 0)
- return(ret);
- if (cur[0] == '/') {
- cur++;
- ret = xmlParseURIPathSegments(uri, &cur, 1);
- }
- } else if (cur[0] == '/') {
- cur++;
- ret = xmlParseURIPathSegments(uri, &cur, 1);
- } else if (cur[0] != '#' && cur[0] != '?') {
- ret = xmlParseURIRelSegment(uri, &cur);
- if (ret != 0)
- return(ret);
- if (cur[0] == '/') {
- cur++;
- ret = xmlParseURIPathSegments(uri, &cur, 1);
- }
- }
- if (ret != 0)
- return(ret);
- if (*cur == '?') {
- cur++;
- ret = xmlParseURIQuery(uri, &cur);
- if (ret != 0)
- return(ret);
- }
- *str = cur;
- return(ret);
-}
-
-/**
- * xmlParseURIReference:
- * @uri: pointer to an URI structure
- * @str: the string to analyze
- *
- * Parse an URI reference string and fills in the appropriate fields
- * of the @uri structure
- *
- * URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
- *
- * Returns 0 or the error code
- */
-int
-xmlParseURIReference(xmlURIPtr uri, const char *str) {
- int ret;
- const char *tmp = str;
-
- if (str == NULL)
- return(-1);
- xmlCleanURI(uri);
-
- /*
- * Try first to parse absolute refs, then fallback to relative if
- * it fails.
- */
- ret = xmlParseAbsoluteURI(uri, &str);
- if (ret != 0) {
- xmlCleanURI(uri);
- str = tmp;
- ret = xmlParseRelativeURI(uri, &str);
- }
- if (ret != 0) {
- xmlCleanURI(uri);
- return(ret);
- }
-
- if (*str == '#') {
- str++;
- ret = xmlParseURIFragment(uri, &str);
- if (ret != 0) return(ret);
- }
- if (*str != 0) {
- xmlCleanURI(uri);
- return(1);
- }
- return(0);
-}
-
-/**
- * xmlParseURI:
- * @str: the URI string to analyze
- *
- * Parse an URI
- *
- * URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
- *
- * Returns a newly build xmlURIPtr or NULL in case of error
- */
-xmlURIPtr
-xmlParseURI(const char *str) {
- xmlURIPtr uri;
- int ret;
-
- if (str == NULL)
- return(NULL);
- uri = xmlCreateURI();
- if (uri != NULL) {
- ret = xmlParseURIReference(uri, str);
- if (ret) {
- xmlFreeURI(uri);
- return(NULL);
- }
- }
- return(uri);
-}
-
-/************************************************************************
- * *
- * Public functions *
- * *
- ************************************************************************/
-
-/**
- * xmlBuildURI:
- * @URI: the URI instance found in the document
- * @base: the base value
- *
- * Computes he final URI of the reference done by checking that
- * the given URI is valid, and building the final URI using the
- * base URI. This is processed according to section 5.2 of the
- * RFC 2396
- *
- * 5.2. Resolving Relative References to Absolute Form
- *
- * Returns a new URI string (to be freed by the caller) or NULL in case
- * of error.
- */
-xmlChar *
-xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
- xmlChar *val = NULL;
- int ret, len, indx, cur, out;
- xmlURIPtr ref = NULL;
- xmlURIPtr bas = NULL;
- xmlURIPtr res = NULL;
-
- /*
- * 1) The URI reference is parsed into the potential four components and
- * fragment identifier, as described in Section 4.3.
- *
- * NOTE that a completely empty URI is treated by modern browsers
- * as a reference to "." rather than as a synonym for the current
- * URI. Should we do that here?
- */
- if (URI == NULL)
- ret = -1;
- else {
- if (*URI) {
- ref = xmlCreateURI();
- if (ref == NULL)
- goto done;
- ret = xmlParseURIReference(ref, (const char *) URI);
- }
- else
- ret = 0;
- }
- if (ret != 0)
- goto done;
- if (base == NULL)
- ret = -1;
- else {
- bas = xmlCreateURI();
- if (bas == NULL)
- goto done;
- ret = xmlParseURIReference(bas, (const char *) base);
- }
- if (ret != 0) {
- if (ref)
- val = xmlSaveUri(ref);
- goto done;
- }
- if (ref == NULL) {
- /*
- * the base fragment must be ignored
- */
- if (bas->fragment != NULL) {
- xmlFree(bas->fragment);
- bas->fragment = NULL;
- }
- val = xmlSaveUri(bas);
- goto done;
- }
-
- /*
- * 2) If the path component is empty and the scheme, authority, and
- * query components are undefined, then it is a reference to the
- * current document and we are done. Otherwise, the reference URI's
- * query and fragment components are defined as found (or not found)
- * within the URI reference and not inherited from the base URI.
- *
- * NOTE that in modern browsers, the parsing differs from the above
- * in the following aspect: the query component is allowed to be
- * defined while still treating this as a reference to the current
- * document.
- */
- res = xmlCreateURI();
- if (res == NULL)
- goto done;
- if ((ref->scheme == NULL) && (ref->path == NULL) &&
- ((ref->authority == NULL) && (ref->server == NULL))) {
- if (bas->scheme != NULL)
- res->scheme = xmlMemStrdup(bas->scheme);
- if (bas->authority != NULL)
- res->authority = xmlMemStrdup(bas->authority);
- else if (bas->server != NULL) {
- res->server = xmlMemStrdup(bas->server);
- if (bas->user != NULL)
- res->user = xmlMemStrdup(bas->user);
- res->port = bas->port;
- }
- if (bas->path != NULL)
- res->path = xmlMemStrdup(bas->path);
- if (ref->query != NULL)
- res->query = xmlMemStrdup(ref->query);
- else if (bas->query != NULL)
- res->query = xmlMemStrdup(bas->query);
- if (ref->fragment != NULL)
- res->fragment = xmlMemStrdup(ref->fragment);
- goto step_7;
- }
-
- if (ref->query != NULL)
- res->query = xmlMemStrdup(ref->query);
- if (ref->fragment != NULL)
- res->fragment = xmlMemStrdup(ref->fragment);
-
- /*
- * 3) If the scheme component is defined, indicating that the reference
- * starts with a scheme name, then the reference is interpreted as an
- * absolute URI and we are done. Otherwise, the reference URI's
- * scheme is inherited from the base URI's scheme component.
- */
- if (ref->scheme != NULL) {
- val = xmlSaveUri(ref);
- goto done;
- }
- if (bas->scheme != NULL)
- res->scheme = xmlMemStrdup(bas->scheme);
-
- /*
- * 4) If the authority component is defined, then the reference is a
- * network-path and we skip to step 7. Otherwise, the reference
- * URI's authority is inherited from the base URI's authority
- * component, which will also be undefined if the URI scheme does not
- * use an authority component.
- */
- if ((ref->authority != NULL) || (ref->server != NULL)) {
- if (ref->authority != NULL)
- res->authority = xmlMemStrdup(ref->authority);
- else {
- res->server = xmlMemStrdup(ref->server);
- if (ref->user != NULL)
- res->user = xmlMemStrdup(ref->user);
- res->port = ref->port;
- }
- if (ref->path != NULL)
- res->path = xmlMemStrdup(ref->path);
- goto step_7;
- }
- if (bas->authority != NULL)
- res->authority = xmlMemStrdup(bas->authority);
- else if (bas->server != NULL) {
- res->server = xmlMemStrdup(bas->server);
- if (bas->user != NULL)
- res->user = xmlMemStrdup(bas->user);
- res->port = bas->port;
- }
-
- /*
- * 5) If the path component begins with a slash character ("/"), then
- * the reference is an absolute-path and we skip to step 7.
- */
- if ((ref->path != NULL) && (ref->path[0] == '/')) {
- res->path = xmlMemStrdup(ref->path);
- goto step_7;
- }
-
-
- /*
- * 6) If this step is reached, then we are resolving a relative-path
- * reference. The relative path needs to be merged with the base
- * URI's path. Although there are many ways to do this, we will
- * describe a simple method using a separate string buffer.
- *
- * Allocate a buffer large enough for the result string.
- */
- len = 2; /* extra / and 0 */
- if (ref->path != NULL)
- len += strlen(ref->path);
- if (bas->path != NULL)
- len += strlen(bas->path);
- res->path = (char *) xmlMalloc(len);
- if (res->path == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlBuildURI: out of memory\n");
- goto done;
- }
- res->path[0] = 0;
-
- /*
- * a) All but the last segment of the base URI's path component is
- * copied to the buffer. In other words, any characters after the
- * last (right-most) slash character, if any, are excluded.
- */
- cur = 0;
- out = 0;
- if (bas->path != NULL) {
- while (bas->path[cur] != 0) {
- while ((bas->path[cur] != 0) && (bas->path[cur] != '/'))
- cur++;
- if (bas->path[cur] == 0)
- break;
-
- cur++;
- while (out < cur) {
- res->path[out] = bas->path[out];
- out++;
- }
- }
- }
- res->path[out] = 0;
-
- /*
- * b) The reference's path component is appended to the buffer
- * string.
- */
- if (ref->path != NULL && ref->path[0] != 0) {
- indx = 0;
- /*
- * Ensure the path includes a '/'
- */
- if ((out == 0) && (bas->server != NULL))
- res->path[out++] = '/';
- while (ref->path[indx] != 0) {
- res->path[out++] = ref->path[indx++];
- }
- }
- res->path[out] = 0;
-
- /*
- * Steps c) to h) are really path normalization steps
- */
- xmlNormalizeURIPath(res->path);
-
-step_7:
-
- /*
- * 7) The resulting URI components, including any inherited from the
- * base URI, are recombined to give the absolute form of the URI
- * reference.
- */
- val = xmlSaveUri(res);
-
-done:
- if (ref != NULL)
- xmlFreeURI(ref);
- if (bas != NULL)
- xmlFreeURI(bas);
- if (res != NULL)
- xmlFreeURI(res);
- return(val);
-}
-
-
diff --git a/bundle/libxml/valid.c b/bundle/libxml/valid.c
deleted file mode 100644
index 421a29aae5..0000000000
--- a/bundle/libxml/valid.c
+++ /dev/null
@@ -1,5968 +0,0 @@
-/*
- * valid.c : part of the code use to do the DTD handling and the validity
- * checking
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#include <string.h>
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#include <libxml/xmlmemory.h>
-#include <libxml/hash.h>
-#include <libxml/valid.h>
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-#include <libxml/xmlerror.h>
-#include <libxml/list.h>
-#include <libxml/globals.h>
-
-/* #define DEBUG_VALID_ALGO */
-/* #define DEBUG_REGEXP_ALGO */
-
-#define TODO \
- xmlGenericError(xmlGenericErrorContext, \
- "Unimplemented block at %s:%d\n", \
- __FILE__, __LINE__);
-
-
-#ifndef LIBXML_REGEXP_ENABLED
-/*
- * If regexp are not enabled, it uses a home made algorithm less
- * complex and easier to
- * debug/maintain than a generic NFA -> DFA state based algo. The
- * only restriction is on the deepness of the tree limited by the
- * size of the occurs bitfield
- *
- * this is the content of a saved state for rollbacks
- */
-
-#define ROLLBACK_OR 0
-#define ROLLBACK_PARENT 1
-
-typedef struct _xmlValidState {
- xmlElementContentPtr cont; /* pointer to the content model subtree */
- xmlNodePtr node; /* pointer to the current node in the list */
- long occurs;/* bitfield for multiple occurrences */
- unsigned char depth; /* current depth in the overall tree */
- unsigned char state; /* ROLLBACK_XXX */
-} _xmlValidState;
-
-#define MAX_RECURSE 25000
-#define MAX_DEPTH ((sizeof(_xmlValidState.occurs)) * 8)
-#define CONT ctxt->vstate->cont
-#define NODE ctxt->vstate->node
-#define DEPTH ctxt->vstate->depth
-#define OCCURS ctxt->vstate->occurs
-#define STATE ctxt->vstate->state
-
-#define OCCURRENCE (ctxt->vstate->occurs & (1 << DEPTH))
-#define PARENT_OCCURRENCE (ctxt->vstate->occurs & ((1 << DEPTH) - 1))
-
-#define SET_OCCURRENCE ctxt->vstate->occurs |= (1 << DEPTH)
-#define RESET_OCCURRENCE ctxt->vstate->occurs &= ((1 << DEPTH) - 1)
-
-static int
-vstateVPush(xmlValidCtxtPtr ctxt, xmlElementContentPtr cont,
- xmlNodePtr node, unsigned char depth, long occurs,
- unsigned char state) {
- int i = ctxt->vstateNr - 1;
-
- if (ctxt->vstateNr > MAX_RECURSE) {
- return(-1);
- }
- if (ctxt->vstateNr >= ctxt->vstateMax) {
- ctxt->vstateMax *= 2;
- ctxt->vstateTab = (xmlValidState *) xmlRealloc(ctxt->vstateTab,
- ctxt->vstateMax * sizeof(ctxt->vstateTab[0]));
- if (ctxt->vstateTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc failed !n");
- return(-1);
- }
- ctxt->vstate = &ctxt->vstateTab[0];
- }
- /*
- * Don't push on the stack a state already here
- */
- if ((i >= 0) && (ctxt->vstateTab[i].cont == cont) &&
- (ctxt->vstateTab[i].node == node) &&
- (ctxt->vstateTab[i].depth == depth) &&
- (ctxt->vstateTab[i].occurs == occurs) &&
- (ctxt->vstateTab[i].state == state))
- return(ctxt->vstateNr);
- ctxt->vstateTab[ctxt->vstateNr].cont = cont;
- ctxt->vstateTab[ctxt->vstateNr].node = node;
- ctxt->vstateTab[ctxt->vstateNr].depth = depth;
- ctxt->vstateTab[ctxt->vstateNr].occurs = occurs;
- ctxt->vstateTab[ctxt->vstateNr].state = state;
- return(ctxt->vstateNr++);
-}
-
-static int
-vstateVPop(xmlValidCtxtPtr ctxt) {
- if (ctxt->vstateNr <= 1) return(-1);
- ctxt->vstateNr--;
- ctxt->vstate = &ctxt->vstateTab[0];
- ctxt->vstate->cont = ctxt->vstateTab[ctxt->vstateNr].cont;
- ctxt->vstate->node = ctxt->vstateTab[ctxt->vstateNr].node;
- ctxt->vstate->depth = ctxt->vstateTab[ctxt->vstateNr].depth;
- ctxt->vstate->occurs = ctxt->vstateTab[ctxt->vstateNr].occurs;
- ctxt->vstate->state = ctxt->vstateTab[ctxt->vstateNr].state;
- return(ctxt->vstateNr);
-}
-
-#endif /* LIBXML_REGEXP_ENABLED */
-
-static int
-nodeVPush(xmlValidCtxtPtr ctxt, xmlNodePtr value)
-{
- if (ctxt->nodeMax <= 0) {
- ctxt->nodeMax = 4;
- ctxt->nodeTab =
- (xmlNodePtr *) xmlMalloc(ctxt->nodeMax *
- sizeof(ctxt->nodeTab[0]));
- if (ctxt->nodeTab == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc failed !\n");
- ctxt->nodeMax = 0;
- return (0);
- }
- }
- if (ctxt->nodeNr >= ctxt->nodeMax) {
- ctxt->nodeMax *= 2;
- ctxt->nodeTab =
- (xmlNodePtr *) xmlRealloc(ctxt->nodeTab,
- ctxt->nodeMax *
- sizeof(ctxt->nodeTab[0]));
- if (ctxt->nodeTab == NULL) {
- xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
- return (0);
- }
- }
- ctxt->nodeTab[ctxt->nodeNr] = value;
- ctxt->node = value;
- return (ctxt->nodeNr++);
-}
-static xmlNodePtr
-nodeVPop(xmlValidCtxtPtr ctxt)
-{
- xmlNodePtr ret;
-
- if (ctxt->nodeNr <= 0)
- return (0);
- ctxt->nodeNr--;
- if (ctxt->nodeNr > 0)
- ctxt->node = ctxt->nodeTab[ctxt->nodeNr - 1];
- else
- ctxt->node = NULL;
- ret = ctxt->nodeTab[ctxt->nodeNr];
- ctxt->nodeTab[ctxt->nodeNr] = 0;
- return (ret);
-}
-
-#ifdef DEBUG_VALID_ALGO
-static void
-xmlValidPrintNode(xmlNodePtr cur) {
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext, "null");
- return;
- }
- switch (cur->type) {
- case XML_ELEMENT_NODE:
- xmlGenericError(xmlGenericErrorContext, "%s ", cur->name);
- break;
- case XML_TEXT_NODE:
- xmlGenericError(xmlGenericErrorContext, "text ");
- break;
- case XML_CDATA_SECTION_NODE:
- xmlGenericError(xmlGenericErrorContext, "cdata ");
- break;
- case XML_ENTITY_REF_NODE:
- xmlGenericError(xmlGenericErrorContext, "&%s; ", cur->name);
- break;
- case XML_PI_NODE:
- xmlGenericError(xmlGenericErrorContext, "pi(%s) ", cur->name);
- break;
- case XML_COMMENT_NODE:
- xmlGenericError(xmlGenericErrorContext, "comment ");
- break;
- case XML_ATTRIBUTE_NODE:
- xmlGenericError(xmlGenericErrorContext, "?attr? ");
- break;
- case XML_ENTITY_NODE:
- xmlGenericError(xmlGenericErrorContext, "?ent? ");
- break;
- case XML_DOCUMENT_NODE:
- xmlGenericError(xmlGenericErrorContext, "?doc? ");
- break;
- case XML_DOCUMENT_TYPE_NODE:
- xmlGenericError(xmlGenericErrorContext, "?doctype? ");
- break;
- case XML_DOCUMENT_FRAG_NODE:
- xmlGenericError(xmlGenericErrorContext, "?frag? ");
- break;
- case XML_NOTATION_NODE:
- xmlGenericError(xmlGenericErrorContext, "?nota? ");
- break;
- case XML_HTML_DOCUMENT_NODE:
- xmlGenericError(xmlGenericErrorContext, "?html? ");
- break;
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
- xmlGenericError(xmlGenericErrorContext, "?docb? ");
- break;
-#endif
- case XML_DTD_NODE:
- xmlGenericError(xmlGenericErrorContext, "?dtd? ");
- break;
- case XML_ELEMENT_DECL:
- xmlGenericError(xmlGenericErrorContext, "?edecl? ");
- break;
- case XML_ATTRIBUTE_DECL:
- xmlGenericError(xmlGenericErrorContext, "?adecl? ");
- break;
- case XML_ENTITY_DECL:
- xmlGenericError(xmlGenericErrorContext, "?entdecl? ");
- break;
- case XML_NAMESPACE_DECL:
- xmlGenericError(xmlGenericErrorContext, "?nsdecl? ");
- break;
- case XML_XINCLUDE_START:
- xmlGenericError(xmlGenericErrorContext, "incstart ");
- break;
- case XML_XINCLUDE_END:
- xmlGenericError(xmlGenericErrorContext, "incend ");
- break;
- }
-}
-
-static void
-xmlValidPrintNodeList(xmlNodePtr cur) {
- if (cur == NULL)
- xmlGenericError(xmlGenericErrorContext, "null ");
- while (cur != NULL) {
- xmlValidPrintNode(cur);
- cur = cur->next;
- }
-}
-
-static void
-xmlValidDebug(xmlNodePtr cur, xmlElementContentPtr cont) {
- char expr[1000];
-
- expr[0] = 0;
- xmlGenericError(xmlGenericErrorContext, "valid: ");
- xmlValidPrintNodeList(cur);
- xmlGenericError(xmlGenericErrorContext, "against ");
- xmlSnprintfElementContent(expr, 5000, cont, 1);
- xmlGenericError(xmlGenericErrorContext, "%s\n", expr);
-}
-
-static void
-xmlValidDebugState(xmlValidStatePtr state) {
- xmlGenericError(xmlGenericErrorContext, "(");
- if (state->cont == NULL)
- xmlGenericError(xmlGenericErrorContext, "null,");
- else
- switch (state->cont->type) {
- case XML_ELEMENT_CONTENT_PCDATA:
- xmlGenericError(xmlGenericErrorContext, "pcdata,");
- break;
- case XML_ELEMENT_CONTENT_ELEMENT:
- xmlGenericError(xmlGenericErrorContext, "%s,",
- state->cont->name);
- break;
- case XML_ELEMENT_CONTENT_SEQ:
- xmlGenericError(xmlGenericErrorContext, "seq,");
- break;
- case XML_ELEMENT_CONTENT_OR:
- xmlGenericError(xmlGenericErrorContext, "or,");
- break;
- }
- xmlValidPrintNode(state->node);
- xmlGenericError(xmlGenericErrorContext, ",%d,%X,%d)",
- state->depth, state->occurs, state->state);
-}
-
-static void
-xmlValidStateDebug(xmlValidCtxtPtr ctxt) {
- int i, j;
-
- xmlGenericError(xmlGenericErrorContext, "state: ");
- xmlValidDebugState(ctxt->vstate);
- xmlGenericError(xmlGenericErrorContext, " stack: %d ",
- ctxt->vstateNr - 1);
- for (i = 0, j = ctxt->vstateNr - 1;(i < 3) && (j > 0);i++,j--)
- xmlValidDebugState(&ctxt->vstateTab[j]);
- xmlGenericError(xmlGenericErrorContext, "\n");
-}
-
-/*****
-#define DEBUG_VALID_STATE(n,c) xmlValidDebug(n,c);
- *****/
-
-#define DEBUG_VALID_STATE(n,c) xmlValidStateDebug(ctxt);
-#define DEBUG_VALID_MSG(m) \
- xmlGenericError(xmlGenericErrorContext, "%s\n", m);
-
-#else
-#define DEBUG_VALID_STATE(n,c)
-#define DEBUG_VALID_MSG(m)
-#endif
-
-/* TODO: use hash table for accesses to elem and attribute definitions */
-
-#define VECTXT(ctxt, node) \
- if ((ctxt != NULL) && (ctxt->error != NULL) && \
- (node != NULL)) { \
- xmlChar *base = xmlNodeGetBase(NULL,node); \
- if (base != NULL) { \
- ctxt->error(ctxt->userData, "%s:%d: ", base, \
- (int) (long) node->content); \
- xmlFree(base); \
- } else \
- ctxt->error(ctxt->userData, ":%d: ", \
- (int) (long) node->content); \
- }
-
-#define VWCTXT(ctxt, node) \
- if ((ctxt != NULL) && (ctxt->warning != NULL) && \
- (node != NULL)) { \
- xmlChar *base = xmlNodeGetBase(NULL,node); \
- if (base != NULL) { \
- ctxt->warning(ctxt->userData, "%s:%d: ", base, \
- (int) (long) node->content); \
- xmlFree(base); \
- } else \
- ctxt->warning(ctxt->userData, ":%d: ", \
- (int) (long) node->content); \
- }
-
-#define VERROR \
- if ((ctxt != NULL) && (ctxt->error != NULL)) ctxt->error
-
-#define VWARNING \
- if ((ctxt != NULL) && (ctxt->warning != NULL)) ctxt->warning
-
-#define CHECK_DTD \
- if (doc == NULL) return(0); \
- else if ((doc->intSubset == NULL) && \
- (doc->extSubset == NULL)) return(0)
-
-static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name,
- int create);
-xmlAttributePtr xmlScanAttributeDecl(xmlDtdPtr dtd, const xmlChar *elem);
-
-#ifdef LIBXML_REGEXP_ENABLED
-
-/************************************************************************
- * *
- * Content model validation based on the regexps *
- * *
- ************************************************************************/
-
-/**
- * xmlValidBuildAContentModel:
- * @content: the content model
- * @ctxt: the schema parser context
- * @name: the element name whose content is being built
- *
- * Generate the automata sequence needed for that type
- *
- * Returns 1 if successful or 0 in case of error.
- */
-static int
-xmlValidBuildAContentModel(xmlElementContentPtr content,
- xmlValidCtxtPtr ctxt,
- const xmlChar *name) {
- if (content == NULL) {
- VERROR(ctxt->userData,
- "Found unexpected type = NULL in %s content model\n", name);
- return(0);
- }
- switch (content->type) {
- case XML_ELEMENT_CONTENT_PCDATA:
- VERROR(ctxt->userData, "ContentModel found PCDATA for element %s\n",
- name);
- return(0);
- break;
- case XML_ELEMENT_CONTENT_ELEMENT: {
- xmlAutomataStatePtr oldstate = ctxt->state;
- xmlChar *QName = NULL;
- const xmlChar *fname = content->name;
-
- if (content->prefix != NULL) {
- int len;
-
- len = xmlStrlen(content->name) +
- xmlStrlen(content->prefix) + 2;
- QName = xmlMalloc(len);
- if (QName == NULL) {
- VERROR(ctxt->userData,
- "ContentModel %s : alloc failed\n", name);
- return(0);
- }
- snprintf((char *) QName, len, "%s:%s",
- (char *)content->prefix,
- (char *)content->name);
- fname = QName;
- }
-
- switch (content->ocur) {
- case XML_ELEMENT_CONTENT_ONCE:
- ctxt->state = xmlAutomataNewTransition(ctxt->am,
- ctxt->state, NULL, fname, NULL);
- break;
- case XML_ELEMENT_CONTENT_OPT:
- ctxt->state = xmlAutomataNewTransition(ctxt->am,
- ctxt->state, NULL, fname, NULL);
- xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
- break;
- case XML_ELEMENT_CONTENT_PLUS:
- ctxt->state = xmlAutomataNewTransition(ctxt->am,
- ctxt->state, NULL, fname, NULL);
- xmlAutomataNewTransition(ctxt->am, ctxt->state,
- ctxt->state, fname, NULL);
- break;
- case XML_ELEMENT_CONTENT_MULT:
- xmlAutomataNewTransition(ctxt->am, ctxt->state,
- ctxt->state, fname, NULL);
- break;
- }
- if (QName != NULL)
- xmlFree(QName);
- break;
- }
- case XML_ELEMENT_CONTENT_SEQ: {
- xmlAutomataStatePtr oldstate, oldend;
- xmlElementContentOccur ocur;
-
- /*
- * Simply iterate over the content
- */
- oldstate = ctxt->state;
- ocur = content->ocur;
- do {
- xmlValidBuildAContentModel(content->c1, ctxt, name);
- content = content->c2;
- } while ((content->type == XML_ELEMENT_CONTENT_SEQ) &&
- (content->ocur == XML_ELEMENT_CONTENT_ONCE));
- xmlValidBuildAContentModel(content, ctxt, name);
- oldend = ctxt->state;
- ctxt->state = xmlAutomataNewEpsilon(ctxt->am, oldend, NULL);
- switch (ocur) {
- case XML_ELEMENT_CONTENT_ONCE:
- break;
- case XML_ELEMENT_CONTENT_OPT:
- xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
- break;
- case XML_ELEMENT_CONTENT_MULT:
- xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
- xmlAutomataNewEpsilon(ctxt->am, oldend, oldstate);
- break;
- case XML_ELEMENT_CONTENT_PLUS:
- xmlAutomataNewEpsilon(ctxt->am, oldend, oldstate);
- break;
- }
- break;
- }
- case XML_ELEMENT_CONTENT_OR: {
- xmlAutomataStatePtr oldstate, oldend;
- xmlElementContentOccur ocur;
-
- ocur = content->ocur;
- if ((ocur == XML_ELEMENT_CONTENT_PLUS) ||
- (ocur == XML_ELEMENT_CONTENT_MULT)) {
- ctxt->state = xmlAutomataNewEpsilon(ctxt->am,
- ctxt->state, NULL);
- }
- oldstate = ctxt->state;
- oldend = xmlAutomataNewState(ctxt->am);
-
- /*
- * iterate over the subtypes and remerge the end with an
- * epsilon transition
- */
- do {
- ctxt->state = oldstate;
- xmlValidBuildAContentModel(content->c1, ctxt, name);
- xmlAutomataNewEpsilon(ctxt->am, ctxt->state, oldend);
- content = content->c2;
- } while ((content->type == XML_ELEMENT_CONTENT_OR) &&
- (content->ocur == XML_ELEMENT_CONTENT_ONCE));
- ctxt->state = oldstate;
- xmlValidBuildAContentModel(content, ctxt, name);
- xmlAutomataNewEpsilon(ctxt->am, ctxt->state, oldend);
- ctxt->state = xmlAutomataNewEpsilon(ctxt->am, oldend, NULL);
- switch (ocur) {
- case XML_ELEMENT_CONTENT_ONCE:
- break;
- case XML_ELEMENT_CONTENT_OPT:
- xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
- break;
- case XML_ELEMENT_CONTENT_MULT:
- xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
- xmlAutomataNewEpsilon(ctxt->am, oldend, oldstate);
- break;
- case XML_ELEMENT_CONTENT_PLUS:
- xmlAutomataNewEpsilon(ctxt->am, oldend, oldstate);
- break;
- }
- break;
- }
- default:
- VERROR(ctxt->userData, "ContentModel broken for element %s\n",
- name);
- return(0);
- }
- return(1);
-}
-/**
- * xmlValidBuildContentModel:
- * @ctxt: a validation context
- * @elem: an element declaration node
- *
- * (Re)Build the automata associated to the content model of this
- * element
- *
- * Returns 1 in case of success, 0 in case of error
- */
-int
-xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem) {
- xmlAutomataStatePtr start;
-
- if ((ctxt == NULL) || (elem == NULL))
- return(0);
- if (elem->type != XML_ELEMENT_DECL)
- return(0);
- if (elem->etype != XML_ELEMENT_TYPE_ELEMENT)
- return(1);
- /* TODO: should we rebuild in this case ? */
- if (elem->contModel != NULL)
- return(1);
-
- ctxt->am = xmlNewAutomata();
- if (ctxt->am == NULL) {
- VERROR(ctxt->userData, "Cannot create automata for element %s\n",
- elem->name);
- return(0);
- }
- start = ctxt->state = xmlAutomataGetInitState(ctxt->am);
- xmlValidBuildAContentModel(elem->content, ctxt, elem->name);
- xmlAutomataSetFinalState(ctxt->am, ctxt->state);
- elem->contModel = xmlAutomataCompile(ctxt->am);
- if (!xmlRegexpIsDeterminist(elem->contModel)) {
- char expr[5000];
- expr[0] = 0;
- xmlSnprintfElementContent(expr, 5000, elem->content, 1);
- VERROR(ctxt->userData, "Content model of %s is not determinist: %s\n",
- elem->name, expr);
-#ifdef DEBUG_REGEXP_ALGO
- xmlRegexpPrint(stderr, elem->contModel);
-#endif
- ctxt->valid = 0;
- }
- ctxt->state = NULL;
- xmlFreeAutomata(ctxt->am);
- ctxt->am = NULL;
- return(1);
-}
-
-#endif /* LIBXML_REGEXP_ENABLED */
-
-/************************************************************************
- * *
- * QName handling helper *
- * *
- ************************************************************************/
-
-/**
- * xmlSplitQName2:
- * @name: an XML parser context
- * @prefix: a xmlChar **
- *
- * parse an XML qualified name string
- *
- * [NS 5] QName ::= (Prefix ':')? LocalPart
- *
- * [NS 6] Prefix ::= NCName
- *
- * [NS 7] LocalPart ::= NCName
- *
- * Returns NULL if not a QName, otherwise the local part, and prefix
- * is updated to get the Prefix if any.
- */
-
-xmlChar *
-xmlSplitQName2(const xmlChar *name, xmlChar **prefix) {
- int len = 0;
- xmlChar *ret = NULL;
-
- *prefix = NULL;
-
-#ifndef XML_XML_NAMESPACE
- /* xml: prefix is not really a namespace */
- if ((name[0] == 'x') && (name[1] == 'm') &&
- (name[2] == 'l') && (name[3] == ':'))
- return(NULL);
-#endif
-
- /* nasty but valid */
- if (name[0] == ':')
- return(NULL);
-
- /*
- * we are not trying to validate but just to cut, and yes it will
- * work even if this is as set of UTF-8 encoded chars
- */
- while ((name[len] != 0) && (name[len] != ':'))
- len++;
-
- if (name[len] == 0)
- return(NULL);
-
- *prefix = xmlStrndup(name, len);
- ret = xmlStrdup(&name[len + 1]);
-
- return(ret);
-}
-
-/****************************************************************
- * *
- * Util functions for data allocation/deallocation *
- * *
- ****************************************************************/
-
-/**
- * xmlNewElementContent:
- * @name: the subelement name or NULL
- * @type: the type of element content decl
- *
- * Allocate an element content structure.
- *
- * Returns NULL if not, otherwise the new element content structure
- */
-xmlElementContentPtr
-xmlNewElementContent(xmlChar *name, xmlElementContentType type) {
- xmlElementContentPtr ret;
-
- switch(type) {
- case XML_ELEMENT_CONTENT_ELEMENT:
- if (name == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewElementContent : name == NULL !\n");
- }
- break;
- case XML_ELEMENT_CONTENT_PCDATA:
- case XML_ELEMENT_CONTENT_SEQ:
- case XML_ELEMENT_CONTENT_OR:
- if (name != NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewElementContent : name != NULL !\n");
- }
- break;
- default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewElementContent: unknown type %d\n", type);
- return(NULL);
- }
- ret = (xmlElementContentPtr) xmlMalloc(sizeof(xmlElementContent));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewElementContent : out of memory!\n");
- return(NULL);
- }
- memset(ret, 0, sizeof(xmlElementContent));
- ret->type = type;
- ret->ocur = XML_ELEMENT_CONTENT_ONCE;
- if (name != NULL) {
- xmlChar *prefix = NULL;
- ret->name = xmlSplitQName2(name, &prefix);
- if (ret->name == NULL)
- ret->name = xmlStrdup(name);
- ret->prefix = prefix;
- } else {
- ret->name = NULL;
- ret->prefix = NULL;
- }
- ret->c1 = ret->c2 = ret->parent = NULL;
- return(ret);
-}
-
-/**
- * xmlCopyElementContent:
- * @cur: An element content pointer.
- *
- * Build a copy of an element content description.
- *
- * Returns the new xmlElementContentPtr or NULL in case of error.
- */
-xmlElementContentPtr
-xmlCopyElementContent(xmlElementContentPtr cur) {
- xmlElementContentPtr ret;
-
- if (cur == NULL) return(NULL);
- ret = xmlNewElementContent((xmlChar *) cur->name, cur->type);
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlCopyElementContent : out of memory\n");
- return(NULL);
- }
- if (cur->prefix != NULL)
- ret->prefix = xmlStrdup(cur->prefix);
- ret->ocur = cur->ocur;
- if (cur->c1 != NULL) ret->c1 = xmlCopyElementContent(cur->c1);
- if (ret->c1 != NULL)
- ret->c1->parent = ret;
- if (cur->c2 != NULL) ret->c2 = xmlCopyElementContent(cur->c2);
- if (ret->c2 != NULL)
- ret->c2->parent = ret;
- return(ret);
-}
-
-/**
- * xmlFreeElementContent:
- * @cur: the element content tree to free
- *
- * Free an element content structure. This is a recursive call !
- */
-void
-xmlFreeElementContent(xmlElementContentPtr cur) {
- if (cur == NULL) return;
- switch (cur->type) {
- case XML_ELEMENT_CONTENT_PCDATA:
- case XML_ELEMENT_CONTENT_ELEMENT:
- case XML_ELEMENT_CONTENT_SEQ:
- case XML_ELEMENT_CONTENT_OR:
- break;
- default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlFreeElementContent : type %d\n", cur->type);
- return;
- }
- if (cur->c1 != NULL) xmlFreeElementContent(cur->c1);
- if (cur->c2 != NULL) xmlFreeElementContent(cur->c2);
- if (cur->name != NULL) xmlFree((xmlChar *) cur->name);
- if (cur->prefix != NULL) xmlFree((xmlChar *) cur->prefix);
- xmlFree(cur);
-}
-
-/**
- * xmlDumpElementContent:
- * @buf: An XML buffer
- * @content: An element table
- * @glob: 1 if one must print the englobing parenthesis, 0 otherwise
- *
- * This will dump the content of the element table as an XML DTD definition
- */
-static void
-xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content, int glob) {
- if (content == NULL) return;
-
- if (glob) xmlBufferWriteChar(buf, "(");
- switch (content->type) {
- case XML_ELEMENT_CONTENT_PCDATA:
- xmlBufferWriteChar(buf, "#PCDATA");
- break;
- case XML_ELEMENT_CONTENT_ELEMENT:
- if (content->prefix != NULL) {
- xmlBufferWriteCHAR(buf, content->prefix);
- xmlBufferWriteChar(buf, ":");
- }
- xmlBufferWriteCHAR(buf, content->name);
- break;
- case XML_ELEMENT_CONTENT_SEQ:
- if ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
- (content->c1->type == XML_ELEMENT_CONTENT_SEQ))
- xmlDumpElementContent(buf, content->c1, 1);
- else
- xmlDumpElementContent(buf, content->c1, 0);
- xmlBufferWriteChar(buf, " , ");
- if (content->c2->type == XML_ELEMENT_CONTENT_OR)
- xmlDumpElementContent(buf, content->c2, 1);
- else
- xmlDumpElementContent(buf, content->c2, 0);
- break;
- case XML_ELEMENT_CONTENT_OR:
- if ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
- (content->c1->type == XML_ELEMENT_CONTENT_SEQ))
- xmlDumpElementContent(buf, content->c1, 1);
- else
- xmlDumpElementContent(buf, content->c1, 0);
- xmlBufferWriteChar(buf, " | ");
- if (content->c2->type == XML_ELEMENT_CONTENT_SEQ)
- xmlDumpElementContent(buf, content->c2, 1);
- else
- xmlDumpElementContent(buf, content->c2, 0);
- break;
- default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlDumpElementContent: unknown type %d\n",
- content->type);
- }
- if (glob)
- xmlBufferWriteChar(buf, ")");
- switch (content->ocur) {
- case XML_ELEMENT_CONTENT_ONCE:
- break;
- case XML_ELEMENT_CONTENT_OPT:
- xmlBufferWriteChar(buf, "?");
- break;
- case XML_ELEMENT_CONTENT_MULT:
- xmlBufferWriteChar(buf, "*");
- break;
- case XML_ELEMENT_CONTENT_PLUS:
- xmlBufferWriteChar(buf, "+");
- break;
- }
-}
-
-/**
- * xmlSprintfElementContent:
- * @buf: an output buffer
- * @content: An element table
- * @glob: 1 if one must print the englobing parenthesis, 0 otherwise
- *
- * Deprecated, unsafe, use xmlSnprintfElementContent
- */
-void
-xmlSprintfElementContent(char *buf ATTRIBUTE_UNUSED,
- xmlElementContentPtr content ATTRIBUTE_UNUSED,
- int glob ATTRIBUTE_UNUSED) {
-}
-
-/**
- * xmlSnprintfElementContent:
- * @buf: an output buffer
- * @size: the buffer size
- * @content: An element table
- * @glob: 1 if one must print the englobing parenthesis, 0 otherwise
- *
- * This will dump the content of the element content definition
- * Intended just for the debug routine
- */
-void
-xmlSnprintfElementContent(char *buf, int size, xmlElementContentPtr content, int glob) {
- int len;
-
- if (content == NULL) return;
- len = strlen(buf);
- if (size - len < 50) {
- if ((size - len > 4) && (buf[len - 1] != '.'))
- strcat(buf, " ...");
- return;
- }
- if (glob) strcat(buf, "(");
- switch (content->type) {
- case XML_ELEMENT_CONTENT_PCDATA:
- strcat(buf, "#PCDATA");
- break;
- case XML_ELEMENT_CONTENT_ELEMENT:
- if (content->prefix != NULL) {
- if (size - len < xmlStrlen(content->prefix) + 10) {
- strcat(buf, " ...");
- return;
- }
- strcat(buf, (char *) content->prefix);
- strcat(buf, ":");
- }
- if (size - len < xmlStrlen(content->name) + 10) {
- strcat(buf, " ...");
- return;
- }
- strcat(buf, (char *) content->name);
- break;
- case XML_ELEMENT_CONTENT_SEQ:
- if ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
- (content->c1->type == XML_ELEMENT_CONTENT_SEQ))
- xmlSnprintfElementContent(buf, size, content->c1, 1);
- else
- xmlSnprintfElementContent(buf, size, content->c1, 0);
- len = strlen(buf);
- if (size - len < 50) {
- if ((size - len > 4) && (buf[len - 1] != '.'))
- strcat(buf, " ...");
- return;
- }
- strcat(buf, " , ");
- if (((content->c2->type == XML_ELEMENT_CONTENT_OR) ||
- (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE)) &&
- (content->c2->type != XML_ELEMENT_CONTENT_ELEMENT))
- xmlSnprintfElementContent(buf, size, content->c2, 1);
- else
- xmlSnprintfElementContent(buf, size, content->c2, 0);
- break;
- case XML_ELEMENT_CONTENT_OR:
- if ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
- (content->c1->type == XML_ELEMENT_CONTENT_SEQ))
- xmlSnprintfElementContent(buf, size, content->c1, 1);
- else
- xmlSnprintfElementContent(buf, size, content->c1, 0);
- len = strlen(buf);
- if (size - len < 50) {
- if ((size - len > 4) && (buf[len - 1] != '.'))
- strcat(buf, " ...");
- return;
- }
- strcat(buf, " | ");
- if (((content->c2->type == XML_ELEMENT_CONTENT_SEQ) ||
- (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE)) &&
- (content->c2->type != XML_ELEMENT_CONTENT_ELEMENT))
- xmlSnprintfElementContent(buf, size, content->c2, 1);
- else
- xmlSnprintfElementContent(buf, size, content->c2, 0);
- break;
- }
- if (glob)
- strcat(buf, ")");
- switch (content->ocur) {
- case XML_ELEMENT_CONTENT_ONCE:
- break;
- case XML_ELEMENT_CONTENT_OPT:
- strcat(buf, "?");
- break;
- case XML_ELEMENT_CONTENT_MULT:
- strcat(buf, "*");
- break;
- case XML_ELEMENT_CONTENT_PLUS:
- strcat(buf, "+");
- break;
- }
-}
-
-/****************************************************************
- * *
- * Registration of DTD declarations *
- * *
- ****************************************************************/
-
-/**
- * xmlCreateElementTable:
- *
- * create and initialize an empty element hash table.
- *
- * Returns the xmlElementTablePtr just created or NULL in case of error.
- */
-static xmlElementTablePtr
-xmlCreateElementTable(void) {
- return(xmlHashCreate(0));
-}
-
-/**
- * xmlFreeElement:
- * @elem: An element
- *
- * Deallocate the memory used by an element definition
- */
-static void
-xmlFreeElement(xmlElementPtr elem) {
- if (elem == NULL) return;
- xmlUnlinkNode((xmlNodePtr) elem);
- xmlFreeElementContent(elem->content);
- if (elem->name != NULL)
- xmlFree((xmlChar *) elem->name);
- if (elem->prefix != NULL)
- xmlFree((xmlChar *) elem->prefix);
-#ifdef LIBXML_REGEXP_ENABLED
- if (elem->contModel != NULL)
- xmlRegFreeRegexp(elem->contModel);
-#endif
- xmlFree(elem);
-}
-
-
-/**
- * xmlAddElementDecl:
- * @ctxt: the validation context
- * @dtd: pointer to the DTD
- * @name: the entity name
- * @type: the element type
- * @content: the element content tree or NULL
- *
- * Register a new element declaration
- *
- * Returns NULL if not, otherwise the entity
- */
-xmlElementPtr
-xmlAddElementDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name,
- xmlElementTypeVal type,
- xmlElementContentPtr content) {
- xmlElementPtr ret;
- xmlElementTablePtr table;
- xmlAttributePtr oldAttributes = NULL;
- xmlChar *ns, *uqname;
-
- if (dtd == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: dtd == NULL\n");
- return(NULL);
- }
- if (name == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: name == NULL\n");
- return(NULL);
- }
- switch (type) {
- case XML_ELEMENT_TYPE_EMPTY:
- if (content != NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: content != NULL for EMPTY\n");
- return(NULL);
- }
- break;
- case XML_ELEMENT_TYPE_ANY:
- if (content != NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: content != NULL for ANY\n");
- return(NULL);
- }
- break;
- case XML_ELEMENT_TYPE_MIXED:
- if (content == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: content == NULL for MIXED\n");
- return(NULL);
- }
- break;
- case XML_ELEMENT_TYPE_ELEMENT:
- if (content == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: content == NULL for ELEMENT\n");
- return(NULL);
- }
- break;
- default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: unknown type %d\n", type);
- return(NULL);
- }
-
- /*
- * check if name is a QName
- */
- uqname = xmlSplitQName2(name, &ns);
- if (uqname != NULL)
- name = uqname;
-
- /*
- * Create the Element table if needed.
- */
- table = (xmlElementTablePtr) dtd->elements;
- if (table == NULL) {
- table = xmlCreateElementTable();
- dtd->elements = (void *) table;
- }
- if (table == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: Table creation failed!\n");
- return(NULL);
- }
-
- /*
- * lookup old attributes inserted on an undefined element in the
- * internal subset.
- */
- if ((dtd->doc != NULL) && (dtd->doc->intSubset != NULL)) {
- ret = xmlHashLookup2(dtd->doc->intSubset->elements, name, ns);
- if ((ret != NULL) && (ret->etype == XML_ELEMENT_TYPE_UNDEFINED)) {
- oldAttributes = ret->attributes;
- ret->attributes = NULL;
- xmlHashRemoveEntry2(dtd->doc->intSubset->elements, name, ns, NULL);
- xmlFreeElement(ret);
- }
- }
-
- /*
- * The element may already be present if one of its attribute
- * was registered first
- */
- ret = xmlHashLookup2(table, name, ns);
- if (ret != NULL) {
- if (ret->etype != XML_ELEMENT_TYPE_UNDEFINED) {
- /*
- * The element is already defined in this DTD.
- */
- VERROR(ctxt->userData, "Redefinition of element %s\n", name);
- if (uqname != NULL)
- xmlFree(uqname);
- return(NULL);
- }
- } else {
- ret = (xmlElementPtr) xmlMalloc(sizeof(xmlElement));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: out of memory\n");
- return(NULL);
- }
- memset(ret, 0, sizeof(xmlElement));
- ret->type = XML_ELEMENT_DECL;
-
- /*
- * fill the structure.
- */
- ret->name = xmlStrdup(name);
- ret->prefix = ns;
-
- /*
- * Validity Check:
- * Insertion must not fail
- */
- if (xmlHashAddEntry2(table, name, ns, ret)) {
- /*
- * The element is already defined in this DTD.
- */
- VERROR(ctxt->userData, "Redefinition of element %s\n", name);
- xmlFreeElement(ret);
- if (uqname != NULL)
- xmlFree(uqname);
- return(NULL);
- }
- }
-
- /*
- * Finish to fill the structure.
- */
- ret->etype = type;
- ret->content = xmlCopyElementContent(content);
- ret->attributes = oldAttributes;
-
- /*
- * Link it to the DTD
- */
- ret->parent = dtd;
- ret->doc = dtd->doc;
- if (dtd->last == NULL) {
- dtd->children = dtd->last = (xmlNodePtr) ret;
- } else {
- dtd->last->next = (xmlNodePtr) ret;
- ret->prev = dtd->last;
- dtd->last = (xmlNodePtr) ret;
- }
- if (uqname != NULL)
- xmlFree(uqname);
- return(ret);
-}
-
-/**
- * xmlFreeElementTable:
- * @table: An element table
- *
- * Deallocate the memory used by an element hash table.
- */
-void
-xmlFreeElementTable(xmlElementTablePtr table) {
- xmlHashFree(table, (xmlHashDeallocator) xmlFreeElement);
-}
-
-/**
- * xmlCopyElement:
- * @elem: An element
- *
- * Build a copy of an element.
- *
- * Returns the new xmlElementPtr or NULL in case of error.
- */
-static xmlElementPtr
-xmlCopyElement(xmlElementPtr elem) {
- xmlElementPtr cur;
-
- cur = (xmlElementPtr) xmlMalloc(sizeof(xmlElement));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlCopyElement: out of memory !\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlElement));
- cur->type = XML_ELEMENT_DECL;
- cur->etype = elem->etype;
- if (elem->name != NULL)
- cur->name = xmlStrdup(elem->name);
- else
- cur->name = NULL;
- if (elem->prefix != NULL)
- cur->prefix = xmlStrdup(elem->prefix);
- else
- cur->prefix = NULL;
- cur->content = xmlCopyElementContent(elem->content);
- /* TODO : rebuild the attribute list on the copy */
- cur->attributes = NULL;
- return(cur);
-}
-
-/**
- * xmlCopyElementTable:
- * @table: An element table
- *
- * Build a copy of an element table.
- *
- * Returns the new xmlElementTablePtr or NULL in case of error.
- */
-xmlElementTablePtr
-xmlCopyElementTable(xmlElementTablePtr table) {
- return((xmlElementTablePtr) xmlHashCopy(table,
- (xmlHashCopier) xmlCopyElement));
-}
-
-/**
- * xmlDumpElementDecl:
- * @buf: the XML buffer output
- * @elem: An element table
- *
- * This will dump the content of the element declaration as an XML
- * DTD definition
- */
-void
-xmlDumpElementDecl(xmlBufferPtr buf, xmlElementPtr elem) {
- switch (elem->etype) {
- case XML_ELEMENT_TYPE_EMPTY:
- xmlBufferWriteChar(buf, "<!ELEMENT ");
- if (elem->prefix != NULL) {
- xmlBufferWriteCHAR(buf, elem->prefix);
- xmlBufferWriteChar(buf, ":");
- }
- xmlBufferWriteCHAR(buf, elem->name);
- xmlBufferWriteChar(buf, " EMPTY>\n");
- break;
- case XML_ELEMENT_TYPE_ANY:
- xmlBufferWriteChar(buf, "<!ELEMENT ");
- if (elem->prefix != NULL) {
- xmlBufferWriteCHAR(buf, elem->prefix);
- xmlBufferWriteChar(buf, ":");
- }
- xmlBufferWriteCHAR(buf, elem->name);
- xmlBufferWriteChar(buf, " ANY>\n");
- break;
- case XML_ELEMENT_TYPE_MIXED:
- xmlBufferWriteChar(buf, "<!ELEMENT ");
- if (elem->prefix != NULL) {
- xmlBufferWriteCHAR(buf, elem->prefix);
- xmlBufferWriteChar(buf, ":");
- }
- xmlBufferWriteCHAR(buf, elem->name);
- xmlBufferWriteChar(buf, " ");
- xmlDumpElementContent(buf, elem->content, 1);
- xmlBufferWriteChar(buf, ">\n");
- break;
- case XML_ELEMENT_TYPE_ELEMENT:
- xmlBufferWriteChar(buf, "<!ELEMENT ");
- if (elem->prefix != NULL) {
- xmlBufferWriteCHAR(buf, elem->prefix);
- xmlBufferWriteChar(buf, ":");
- }
- xmlBufferWriteCHAR(buf, elem->name);
- xmlBufferWriteChar(buf, " ");
- xmlDumpElementContent(buf, elem->content, 1);
- xmlBufferWriteChar(buf, ">\n");
- break;
- default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlDumpElementDecl: internal: unknown type %d\n",
- elem->etype);
- }
-}
-
-/**
- * xmlDumpElementTable:
- * @buf: the XML buffer output
- * @table: An element table
- *
- * This will dump the content of the element table as an XML DTD definition
- */
-void
-xmlDumpElementTable(xmlBufferPtr buf, xmlElementTablePtr table) {
- xmlHashScan(table, (xmlHashScanner) xmlDumpElementDecl, buf);
-}
-
-/**
- * xmlCreateEnumeration:
- * @name: the enumeration name or NULL
- *
- * create and initialize an enumeration attribute node.
- *
- * Returns the xmlEnumerationPtr just created or NULL in case
- * of error.
- */
-xmlEnumerationPtr
-xmlCreateEnumeration(xmlChar *name) {
- xmlEnumerationPtr ret;
-
- ret = (xmlEnumerationPtr) xmlMalloc(sizeof(xmlEnumeration));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlCreateEnumeration : xmlMalloc(%ld) failed\n",
- (long)sizeof(xmlEnumeration));
- return(NULL);
- }
- memset(ret, 0, sizeof(xmlEnumeration));
-
- if (name != NULL)
- ret->name = xmlStrdup(name);
- return(ret);
-}
-
-/**
- * xmlFreeEnumeration:
- * @cur: the tree to free.
- *
- * free an enumeration attribute node (recursive).
- */
-void
-xmlFreeEnumeration(xmlEnumerationPtr cur) {
- if (cur == NULL) return;
-
- if (cur->next != NULL) xmlFreeEnumeration(cur->next);
-
- if (cur->name != NULL) xmlFree((xmlChar *) cur->name);
- xmlFree(cur);
-}
-
-/**
- * xmlCopyEnumeration:
- * @cur: the tree to copy.
- *
- * Copy an enumeration attribute node (recursive).
- *
- * Returns the xmlEnumerationPtr just created or NULL in case
- * of error.
- */
-xmlEnumerationPtr
-xmlCopyEnumeration(xmlEnumerationPtr cur) {
- xmlEnumerationPtr ret;
-
- if (cur == NULL) return(NULL);
- ret = xmlCreateEnumeration((xmlChar *) cur->name);
-
- if (cur->next != NULL) ret->next = xmlCopyEnumeration(cur->next);
- else ret->next = NULL;
-
- return(ret);
-}
-
-/**
- * xmlDumpEnumeration:
- * @buf: the XML buffer output
- * @enum: An enumeration
- *
- * This will dump the content of the enumeration
- */
-static void
-xmlDumpEnumeration(xmlBufferPtr buf, xmlEnumerationPtr cur) {
- if (cur == NULL) return;
-
- xmlBufferWriteCHAR(buf, cur->name);
- if (cur->next == NULL)
- xmlBufferWriteChar(buf, ")");
- else {
- xmlBufferWriteChar(buf, " | ");
- xmlDumpEnumeration(buf, cur->next);
- }
-}
-
-/**
- * xmlCreateAttributeTable:
- *
- * create and initialize an empty attribute hash table.
- *
- * Returns the xmlAttributeTablePtr just created or NULL in case
- * of error.
- */
-static xmlAttributeTablePtr
-xmlCreateAttributeTable(void) {
- return(xmlHashCreate(0));
-}
-
-/**
- * xmlScanAttributeDeclCallback:
- * @attr: the attribute decl
- * @list: the list to update
- *
- * Callback called by xmlScanAttributeDecl when a new attribute
- * has to be entered in the list.
- */
-static void
-xmlScanAttributeDeclCallback(xmlAttributePtr attr, xmlAttributePtr *list,
- const xmlChar* name ATTRIBUTE_UNUSED) {
- attr->nexth = *list;
- *list = attr;
-}
-
-/**
- * xmlScanAttributeDecl:
- * @dtd: pointer to the DTD
- * @elem: the element name
- *
- * When inserting a new element scan the DtD for existing attributes
- * for that element and initialize the Attribute chain
- *
- * Returns the pointer to the first attribute decl in the chain,
- * possibly NULL.
- */
-xmlAttributePtr
-xmlScanAttributeDecl(xmlDtdPtr dtd, const xmlChar *elem) {
- xmlAttributePtr ret = NULL;
- xmlAttributeTablePtr table;
-
- if (dtd == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlScanAttributeDecl: dtd == NULL\n");
- return(NULL);
- }
- if (elem == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlScanAttributeDecl: elem == NULL\n");
- return(NULL);
- }
- table = (xmlAttributeTablePtr) dtd->attributes;
- if (table == NULL)
- return(NULL);
-
- /* WRONG !!! */
- xmlHashScan3(table, NULL, NULL, elem,
- (xmlHashScanner) xmlScanAttributeDeclCallback, &ret);
- return(ret);
-}
-
-/**
- * xmlScanIDAttributeDecl:
- * @ctxt: the validation context
- * @elem: the element name
- *
- * Verify that the element don't have too many ID attributes
- * declared.
- *
- * Returns the number of ID attributes found.
- */
-static int
-xmlScanIDAttributeDecl(xmlValidCtxtPtr ctxt, xmlElementPtr elem) {
- xmlAttributePtr cur;
- int ret = 0;
-
- if (elem == NULL) return(0);
- cur = elem->attributes;
- while (cur != NULL) {
- if (cur->atype == XML_ATTRIBUTE_ID) {
- ret ++;
- if (ret > 1)
- VERROR(ctxt->userData,
- "Element %s has too many ID attributes defined : %s\n",
- elem->name, cur->name);
- }
- cur = cur->nexth;
- }
- return(ret);
-}
-
-/**
- * xmlFreeAttribute:
- * @elem: An attribute
- *
- * Deallocate the memory used by an attribute definition
- */
-static void
-xmlFreeAttribute(xmlAttributePtr attr) {
- if (attr == NULL) return;
- xmlUnlinkNode((xmlNodePtr) attr);
- if (attr->tree != NULL)
- xmlFreeEnumeration(attr->tree);
- if (attr->elem != NULL)
- xmlFree((xmlChar *) attr->elem);
- if (attr->name != NULL)
- xmlFree((xmlChar *) attr->name);
- if (attr->defaultValue != NULL)
- xmlFree((xmlChar *) attr->defaultValue);
- if (attr->prefix != NULL)
- xmlFree((xmlChar *) attr->prefix);
- xmlFree(attr);
-}
-
-
-/**
- * xmlAddAttributeDecl:
- * @ctxt: the validation context
- * @dtd: pointer to the DTD
- * @elem: the element name
- * @name: the attribute name
- * @ns: the attribute namespace prefix
- * @type: the attribute type
- * @def: the attribute default type
- * @defaultValue: the attribute default value
- * @tree: if it's an enumeration, the associated list
- *
- * Register a new attribute declaration
- * Note that @tree becomes the ownership of the DTD
- *
- * Returns NULL if not new, otherwise the attribute decl
- */
-xmlAttributePtr
-xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem,
- const xmlChar *name, const xmlChar *ns,
- xmlAttributeType type, xmlAttributeDefault def,
- const xmlChar *defaultValue, xmlEnumerationPtr tree) {
- xmlAttributePtr ret;
- xmlAttributeTablePtr table;
- xmlElementPtr elemDef;
-
- if (dtd == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddAttributeDecl: dtd == NULL\n");
- xmlFreeEnumeration(tree);
- return(NULL);
- }
- if (name == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddAttributeDecl: name == NULL\n");
- xmlFreeEnumeration(tree);
- return(NULL);
- }
- if (elem == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddAttributeDecl: elem == NULL\n");
- xmlFreeEnumeration(tree);
- return(NULL);
- }
-
- /*
- * Check the type and possibly the default value.
- */
- switch (type) {
- case XML_ATTRIBUTE_CDATA:
- break;
- case XML_ATTRIBUTE_ID:
- break;
- case XML_ATTRIBUTE_IDREF:
- break;
- case XML_ATTRIBUTE_IDREFS:
- break;
- case XML_ATTRIBUTE_ENTITY:
- break;
- case XML_ATTRIBUTE_ENTITIES:
- break;
- case XML_ATTRIBUTE_NMTOKEN:
- break;
- case XML_ATTRIBUTE_NMTOKENS:
- break;
- case XML_ATTRIBUTE_ENUMERATION:
- break;
- case XML_ATTRIBUTE_NOTATION:
- break;
- default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddAttributeDecl: unknown type %d\n", type);
- xmlFreeEnumeration(tree);
- return(NULL);
- }
- if ((defaultValue != NULL) &&
- (!xmlValidateAttributeValue(type, defaultValue))) {
- VERROR(ctxt->userData, "Attribute %s of %s: invalid default value\n",
- elem, name, defaultValue);
- defaultValue = NULL;
- ctxt->valid = 0;
- }
-
- /*
- * Check first that an attribute defined in the external subset wasn't
- * already defined in the internal subset
- */
- if ((dtd->doc != NULL) && (dtd->doc->extSubset == dtd) &&
- (dtd->doc->intSubset != NULL) &&
- (dtd->doc->intSubset->attributes != NULL)) {
- ret = xmlHashLookup3(dtd->doc->intSubset->attributes, name, ns, elem);
- if (ret != NULL)
- return(NULL);
- }
-
- /*
- * Create the Attribute table if needed.
- */
- table = (xmlAttributeTablePtr) dtd->attributes;
- if (table == NULL) {
- table = xmlCreateAttributeTable();
- dtd->attributes = (void *) table;
- }
- if (table == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddAttributeDecl: Table creation failed!\n");
- return(NULL);
- }
-
-
- ret = (xmlAttributePtr) xmlMalloc(sizeof(xmlAttribute));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddAttributeDecl: out of memory\n");
- return(NULL);
- }
- memset(ret, 0, sizeof(xmlAttribute));
- ret->type = XML_ATTRIBUTE_DECL;
-
- /*
- * fill the structure.
- */
- ret->atype = type;
- ret->name = xmlStrdup(name);
- ret->prefix = xmlStrdup(ns);
- ret->elem = xmlStrdup(elem);
- ret->def = def;
- ret->tree = tree;
- if (defaultValue != NULL)
- ret->defaultValue = xmlStrdup(defaultValue);
-
- /*
- * Validity Check:
- * Search the DTD for previous declarations of the ATTLIST
- */
- if (xmlHashAddEntry3(table, name, ns, elem, ret) < 0) {
- /*
- * The attribute is already defined in this DTD.
- */
- VWARNING(ctxt->userData,
- "Attribute %s of element %s: already defined\n",
- name, elem);
- xmlFreeAttribute(ret);
- return(NULL);
- }
-
- /*
- * Validity Check:
- * Multiple ID per element
- */
- elemDef = xmlGetDtdElementDesc2(dtd, elem, 1);
- if (elemDef != NULL) {
-
- if ((type == XML_ATTRIBUTE_ID) &&
- (xmlScanIDAttributeDecl(NULL, elemDef) != 0)) {
- VERROR(ctxt->userData,
- "Element %s has too may ID attributes defined : %s\n",
- elem, name);
- ctxt->valid = 0;
- }
-
- /*
- * Insert namespace default def first they need to be
- * processed first.
- */
- if ((xmlStrEqual(ret->name, BAD_CAST "xmlns")) ||
- ((ret->prefix != NULL &&
- (xmlStrEqual(ret->prefix, BAD_CAST "xmlns"))))) {
- ret->nexth = elemDef->attributes;
- elemDef->attributes = ret;
- } else {
- xmlAttributePtr tmp = elemDef->attributes;
-
- while ((tmp != NULL) &&
- ((xmlStrEqual(tmp->name, BAD_CAST "xmlns")) ||
- ((ret->prefix != NULL &&
- (xmlStrEqual(ret->prefix, BAD_CAST "xmlns")))))) {
- if (tmp->nexth == NULL)
- break;
- tmp = tmp->nexth;
- }
- if (tmp != NULL) {
- ret->nexth = tmp->nexth;
- tmp->nexth = ret;
- } else {
- ret->nexth = elemDef->attributes;
- elemDef->attributes = ret;
- }
- }
- }
-
- /*
- * Link it to the DTD
- */
- ret->parent = dtd;
- ret->doc = dtd->doc;
- if (dtd->last == NULL) {
- dtd->children = dtd->last = (xmlNodePtr) ret;
- } else {
- dtd->last->next = (xmlNodePtr) ret;
- ret->prev = dtd->last;
- dtd->last = (xmlNodePtr) ret;
- }
- return(ret);
-}
-
-/**
- * xmlFreeAttributeTable:
- * @table: An attribute table
- *
- * Deallocate the memory used by an entities hash table.
- */
-void
-xmlFreeAttributeTable(xmlAttributeTablePtr table) {
- xmlHashFree(table, (xmlHashDeallocator) xmlFreeAttribute);
-}
-
-/**
- * xmlCopyAttribute:
- * @attr: An attribute
- *
- * Build a copy of an attribute.
- *
- * Returns the new xmlAttributePtr or NULL in case of error.
- */
-static xmlAttributePtr
-xmlCopyAttribute(xmlAttributePtr attr) {
- xmlAttributePtr cur;
-
- cur = (xmlAttributePtr) xmlMalloc(sizeof(xmlAttribute));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlCopyAttribute: out of memory !\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlAttribute));
- cur->type = XML_ATTRIBUTE_DECL;
- cur->atype = attr->atype;
- cur->def = attr->def;
- cur->tree = xmlCopyEnumeration(attr->tree);
- if (attr->elem != NULL)
- cur->elem = xmlStrdup(attr->elem);
- if (attr->name != NULL)
- cur->name = xmlStrdup(attr->name);
- if (attr->prefix != NULL)
- cur->prefix = xmlStrdup(attr->prefix);
- if (attr->defaultValue != NULL)
- cur->defaultValue = xmlStrdup(attr->defaultValue);
- return(cur);
-}
-
-/**
- * xmlCopyAttributeTable:
- * @table: An attribute table
- *
- * Build a copy of an attribute table.
- *
- * Returns the new xmlAttributeTablePtr or NULL in case of error.
- */
-xmlAttributeTablePtr
-xmlCopyAttributeTable(xmlAttributeTablePtr table) {
- return((xmlAttributeTablePtr) xmlHashCopy(table,
- (xmlHashCopier) xmlCopyAttribute));
-}
-
-/**
- * xmlDumpAttributeDecl:
- * @buf: the XML buffer output
- * @attr: An attribute declaration
- *
- * This will dump the content of the attribute declaration as an XML
- * DTD definition
- */
-void
-xmlDumpAttributeDecl(xmlBufferPtr buf, xmlAttributePtr attr) {
- xmlBufferWriteChar(buf, "<!ATTLIST ");
- xmlBufferWriteCHAR(buf, attr->elem);
- xmlBufferWriteChar(buf, " ");
- if (attr->prefix != NULL) {
- xmlBufferWriteCHAR(buf, attr->prefix);
- xmlBufferWriteChar(buf, ":");
- }
- xmlBufferWriteCHAR(buf, attr->name);
- switch (attr->atype) {
- case XML_ATTRIBUTE_CDATA:
- xmlBufferWriteChar(buf, " CDATA");
- break;
- case XML_ATTRIBUTE_ID:
- xmlBufferWriteChar(buf, " ID");
- break;
- case XML_ATTRIBUTE_IDREF:
- xmlBufferWriteChar(buf, " IDREF");
- break;
- case XML_ATTRIBUTE_IDREFS:
- xmlBufferWriteChar(buf, " IDREFS");
- break;
- case XML_ATTRIBUTE_ENTITY:
- xmlBufferWriteChar(buf, " ENTITY");
- break;
- case XML_ATTRIBUTE_ENTITIES:
- xmlBufferWriteChar(buf, " ENTITIES");
- break;
- case XML_ATTRIBUTE_NMTOKEN:
- xmlBufferWriteChar(buf, " NMTOKEN");
- break;
- case XML_ATTRIBUTE_NMTOKENS:
- xmlBufferWriteChar(buf, " NMTOKENS");
- break;
- case XML_ATTRIBUTE_ENUMERATION:
- xmlBufferWriteChar(buf, " (");
- xmlDumpEnumeration(buf, attr->tree);
- break;
- case XML_ATTRIBUTE_NOTATION:
- xmlBufferWriteChar(buf, " NOTATION (");
- xmlDumpEnumeration(buf, attr->tree);
- break;
- default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlDumpAttributeDecl: internal: unknown type %d\n",
- attr->atype);
- }
- switch (attr->def) {
- case XML_ATTRIBUTE_NONE:
- break;
- case XML_ATTRIBUTE_REQUIRED:
- xmlBufferWriteChar(buf, " #REQUIRED");
- break;
- case XML_ATTRIBUTE_IMPLIED:
- xmlBufferWriteChar(buf, " #IMPLIED");
- break;
- case XML_ATTRIBUTE_FIXED:
- xmlBufferWriteChar(buf, " #FIXED");
- break;
- default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlDumpAttributeDecl: internal: unknown default %d\n",
- attr->def);
- }
- if (attr->defaultValue != NULL) {
- xmlBufferWriteChar(buf, " ");
- xmlBufferWriteQuotedString(buf, attr->defaultValue);
- }
- xmlBufferWriteChar(buf, ">\n");
-}
-
-/**
- * xmlDumpAttributeTable:
- * @buf: the XML buffer output
- * @table: An attribute table
- *
- * This will dump the content of the attribute table as an XML DTD definition
- */
-void
-xmlDumpAttributeTable(xmlBufferPtr buf, xmlAttributeTablePtr table) {
- xmlHashScan(table, (xmlHashScanner) xmlDumpAttributeDecl, buf);
-}
-
-/************************************************************************
- * *
- * NOTATIONs *
- * *
- ************************************************************************/
-/**
- * xmlCreateNotationTable:
- *
- * create and initialize an empty notation hash table.
- *
- * Returns the xmlNotationTablePtr just created or NULL in case
- * of error.
- */
-static xmlNotationTablePtr
-xmlCreateNotationTable(void) {
- return(xmlHashCreate(0));
-}
-
-/**
- * xmlFreeNotation:
- * @not: A notation
- *
- * Deallocate the memory used by an notation definition
- */
-static void
-xmlFreeNotation(xmlNotationPtr nota) {
- if (nota == NULL) return;
- if (nota->name != NULL)
- xmlFree((xmlChar *) nota->name);
- if (nota->PublicID != NULL)
- xmlFree((xmlChar *) nota->PublicID);
- if (nota->SystemID != NULL)
- xmlFree((xmlChar *) nota->SystemID);
- xmlFree(nota);
-}
-
-
-/**
- * xmlAddNotationDecl:
- * @dtd: pointer to the DTD
- * @ctxt: the validation context
- * @name: the entity name
- * @PublicID: the public identifier or NULL
- * @SystemID: the system identifier or NULL
- *
- * Register a new notation declaration
- *
- * Returns NULL if not, otherwise the entity
- */
-xmlNotationPtr
-xmlAddNotationDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDtdPtr dtd,
- const xmlChar *name,
- const xmlChar *PublicID, const xmlChar *SystemID) {
- xmlNotationPtr ret;
- xmlNotationTablePtr table;
-
- if (dtd == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddNotationDecl: dtd == NULL\n");
- return(NULL);
- }
- if (name == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddNotationDecl: name == NULL\n");
- return(NULL);
- }
- if ((PublicID == NULL) && (SystemID == NULL)) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddNotationDecl: no PUBLIC ID nor SYSTEM ID\n");
- return(NULL);
- }
-
- /*
- * Create the Notation table if needed.
- */
- table = (xmlNotationTablePtr) dtd->notations;
- if (table == NULL)
- dtd->notations = table = xmlCreateNotationTable();
- if (table == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddNotationDecl: Table creation failed!\n");
- return(NULL);
- }
-
- ret = (xmlNotationPtr) xmlMalloc(sizeof(xmlNotation));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddNotationDecl: out of memory\n");
- return(NULL);
- }
- memset(ret, 0, sizeof(xmlNotation));
-
- /*
- * fill the structure.
- */
- ret->name = xmlStrdup(name);
- if (SystemID != NULL)
- ret->SystemID = xmlStrdup(SystemID);
- if (PublicID != NULL)
- ret->PublicID = xmlStrdup(PublicID);
-
- /*
- * Validity Check:
- * Check the DTD for previous declarations of the ATTLIST
- */
- if (xmlHashAddEntry(table, name, ret)) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddNotationDecl: %s already defined\n", name);
- xmlFreeNotation(ret);
- return(NULL);
- }
- return(ret);
-}
-
-/**
- * xmlFreeNotationTable:
- * @table: An notation table
- *
- * Deallocate the memory used by an entities hash table.
- */
-void
-xmlFreeNotationTable(xmlNotationTablePtr table) {
- xmlHashFree(table, (xmlHashDeallocator) xmlFreeNotation);
-}
-
-/**
- * xmlCopyNotation:
- * @nota: A notation
- *
- * Build a copy of a notation.
- *
- * Returns the new xmlNotationPtr or NULL in case of error.
- */
-static xmlNotationPtr
-xmlCopyNotation(xmlNotationPtr nota) {
- xmlNotationPtr cur;
-
- cur = (xmlNotationPtr) xmlMalloc(sizeof(xmlNotation));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlCopyNotation: out of memory !\n");
- return(NULL);
- }
- if (nota->name != NULL)
- cur->name = xmlStrdup(nota->name);
- else
- cur->name = NULL;
- if (nota->PublicID != NULL)
- cur->PublicID = xmlStrdup(nota->PublicID);
- else
- cur->PublicID = NULL;
- if (nota->SystemID != NULL)
- cur->SystemID = xmlStrdup(nota->SystemID);
- else
- cur->SystemID = NULL;
- return(cur);
-}
-
-/**
- * xmlCopyNotationTable:
- * @table: A notation table
- *
- * Build a copy of a notation table.
- *
- * Returns the new xmlNotationTablePtr or NULL in case of error.
- */
-xmlNotationTablePtr
-xmlCopyNotationTable(xmlNotationTablePtr table) {
- return((xmlNotationTablePtr) xmlHashCopy(table,
- (xmlHashCopier) xmlCopyNotation));
-}
-
-/**
- * xmlDumpNotationDecl:
- * @buf: the XML buffer output
- * @nota: A notation declaration
- *
- * This will dump the content the notation declaration as an XML DTD definition
- */
-void
-xmlDumpNotationDecl(xmlBufferPtr buf, xmlNotationPtr nota) {
- xmlBufferWriteChar(buf, "<!NOTATION ");
- xmlBufferWriteCHAR(buf, nota->name);
- if (nota->PublicID != NULL) {
- xmlBufferWriteChar(buf, " PUBLIC ");
- xmlBufferWriteQuotedString(buf, nota->PublicID);
- if (nota->SystemID != NULL) {
- xmlBufferWriteChar(buf, " ");
- xmlBufferWriteCHAR(buf, nota->SystemID);
- }
- } else {
- xmlBufferWriteChar(buf, " SYSTEM ");
- xmlBufferWriteCHAR(buf, nota->SystemID);
- }
- xmlBufferWriteChar(buf, " >\n");
-}
-
-/**
- * xmlDumpNotationTable:
- * @buf: the XML buffer output
- * @table: A notation table
- *
- * This will dump the content of the notation table as an XML DTD definition
- */
-void
-xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table) {
- xmlHashScan(table, (xmlHashScanner) xmlDumpNotationDecl, buf);
-}
-
-/************************************************************************
- * *
- * IDs *
- * *
- ************************************************************************/
-/**
- * xmlCreateIDTable:
- *
- * create and initialize an empty id hash table.
- *
- * Returns the xmlIDTablePtr just created or NULL in case
- * of error.
- */
-static xmlIDTablePtr
-xmlCreateIDTable(void) {
- return(xmlHashCreate(0));
-}
-
-/**
- * xmlFreeID:
- * @not: A id
- *
- * Deallocate the memory used by an id definition
- */
-static void
-xmlFreeID(xmlIDPtr id) {
- if (id == NULL) return;
- if (id->value != NULL)
- xmlFree((xmlChar *) id->value);
- xmlFree(id);
-}
-
-/**
- * xmlAddID:
- * @ctxt: the validation context
- * @doc: pointer to the document
- * @value: the value name
- * @attr: the attribute holding the ID
- *
- * Register a new id declaration
- *
- * Returns NULL if not, otherwise the new xmlIDPtr
- */
-xmlIDPtr
-xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
- xmlAttrPtr attr) {
- xmlIDPtr ret;
- xmlIDTablePtr table;
-
- if (doc == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddID: doc == NULL\n");
- return(NULL);
- }
- if (value == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddID: value == NULL\n");
- return(NULL);
- }
- if (attr == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddID: attr == NULL\n");
- return(NULL);
- }
-
- /*
- * Create the ID table if needed.
- */
- table = (xmlIDTablePtr) doc->ids;
- if (table == NULL)
- doc->ids = table = xmlCreateIDTable();
- if (table == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddID: Table creation failed!\n");
- return(NULL);
- }
-
- ret = (xmlIDPtr) xmlMalloc(sizeof(xmlID));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddID: out of memory\n");
- return(NULL);
- }
-
- /*
- * fill the structure.
- */
- ret->value = xmlStrdup(value);
- ret->attr = attr;
-
- if (xmlHashAddEntry(table, value, ret) < 0) {
- /*
- * The id is already defined in this DTD.
- */
- if (ctxt != NULL) {
- VECTXT(ctxt, attr->parent);
- VERROR(ctxt->userData, "ID %s already defined\n", value);
- }
- xmlFreeID(ret);
- return(NULL);
- }
- return(ret);
-}
-
-/**
- * xmlFreeIDTable:
- * @table: An id table
- *
- * Deallocate the memory used by an ID hash table.
- */
-void
-xmlFreeIDTable(xmlIDTablePtr table) {
- xmlHashFree(table, (xmlHashDeallocator) xmlFreeID);
-}
-
-/**
- * xmlIsID:
- * @doc: the document
- * @elem: the element carrying the attribute
- * @attr: the attribute
- *
- * Determine whether an attribute is of type ID. In case we have DTD(s)
- * then this is done if DTD loading has been requested. In the case
- * of HTML documents parsed with the HTML parser, then ID detection is
- * done systematically.
- *
- * Returns 0 or 1 depending on the lookup result
- */
-int
-xmlIsID(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) {
- if (doc == NULL) return(0);
- if (attr == NULL) return(0);
- if ((doc->intSubset == NULL) && (doc->extSubset == NULL)) {
- return(0);
- } else if (doc->type == XML_HTML_DOCUMENT_NODE) {
- if ((xmlStrEqual(BAD_CAST "id", attr->name)) ||
- (xmlStrEqual(BAD_CAST "name", attr->name)))
- return(1);
- return(0);
- } else {
- xmlAttributePtr attrDecl;
-
- if (elem == NULL) return(0);
- if ((elem->ns != NULL) && (elem->ns->prefix != NULL)) {
- /*
- * TODO: this sucks ... recomputing this every time is stupid
- */
- int len = xmlStrlen(elem->name) + xmlStrlen(elem->ns->prefix) + 2;
- xmlChar *fullname;
-
- fullname = xmlMalloc(len);
- if (fullname == NULL)
- return(0);
- snprintf((char *) fullname, len, "%s:%s", (char *) elem->ns->prefix,
- (char *) elem->name);
- attrDecl = xmlGetDtdAttrDesc(doc->intSubset, fullname,
- attr->name);
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdAttrDesc(doc->extSubset, fullname,
- attr->name);
- xmlFree(fullname);
- } else {
- attrDecl = xmlGetDtdAttrDesc(doc->intSubset, elem->name,
- attr->name);
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdAttrDesc(doc->extSubset, elem->name,
- attr->name);
- }
-
- if ((attrDecl != NULL) && (attrDecl->atype == XML_ATTRIBUTE_ID))
- return(1);
- }
- return(0);
-}
-
-/**
- * xmlRemoveID:
- * @doc: the document
- * @attr: the attribute
- *
- * Remove the given attribute from the ID table maintained internally.
- *
- * Returns -1 if the lookup failed and 0 otherwise
- */
-int
-xmlRemoveID(xmlDocPtr doc, xmlAttrPtr attr) {
- xmlAttrPtr cur;
- xmlIDTablePtr table;
- xmlChar *ID;
-
- if (doc == NULL) return(-1);
- if (attr == NULL) return(-1);
- table = (xmlIDTablePtr) doc->ids;
- if (table == NULL)
- return(-1);
-
- if (attr == NULL)
- return(-1);
- ID = xmlNodeListGetString(doc, attr->children, 1);
- if (ID == NULL)
- return(-1);
- cur = xmlHashLookup(table, ID);
- if (cur != attr) {
- xmlFree(ID);
- return(-1);
- }
- xmlHashUpdateEntry(table, ID, NULL, (xmlHashDeallocator) xmlFreeID);
- xmlFree(ID);
- return(0);
-}
-
-/**
- * xmlGetID:
- * @doc: pointer to the document
- * @ID: the ID value
- *
- * Search the attribute declaring the given ID
- *
- * Returns NULL if not found, otherwise the xmlAttrPtr defining the ID
- */
-xmlAttrPtr
-xmlGetID(xmlDocPtr doc, const xmlChar *ID) {
- xmlIDTablePtr table;
- xmlIDPtr id;
-
- if (doc == NULL) {
- xmlGenericError(xmlGenericErrorContext, "xmlGetID: doc == NULL\n");
- return(NULL);
- }
-
- if (ID == NULL) {
- xmlGenericError(xmlGenericErrorContext, "xmlGetID: ID == NULL\n");
- return(NULL);
- }
-
- table = (xmlIDTablePtr) doc->ids;
- if (table == NULL)
- return(NULL);
-
- id = xmlHashLookup(table, ID);
- if (id == NULL)
- return(NULL);
- return(id->attr);
-}
-
-/************************************************************************
- * *
- * Refs *
- * *
- ************************************************************************/
-typedef struct xmlRemoveMemo_t
-{
- xmlListPtr l;
- xmlAttrPtr ap;
-} xmlRemoveMemo;
-
-typedef xmlRemoveMemo *xmlRemoveMemoPtr;
-
-typedef struct xmlValidateMemo_t
-{
- xmlValidCtxtPtr ctxt;
- const xmlChar *name;
-} xmlValidateMemo;
-
-typedef xmlValidateMemo *xmlValidateMemoPtr;
-
-/**
- * xmlCreateRefTable:
- *
- * create and initialize an empty ref hash table.
- *
- * Returns the xmlRefTablePtr just created or NULL in case
- * of error.
- */
-static xmlRefTablePtr
-xmlCreateRefTable(void) {
- return(xmlHashCreate(0));
-}
-
-/**
- * xmlFreeRef:
- * @lk: A list link
- *
- * Deallocate the memory used by a ref definition
- */
-static void
-xmlFreeRef(xmlLinkPtr lk) {
- xmlRefPtr ref = (xmlRefPtr)xmlLinkGetData(lk);
- if (ref == NULL) return;
- if (ref->value != NULL)
- xmlFree((xmlChar *)ref->value);
- xmlFree(ref);
-}
-
-/**
- * xmlFreeRefList:
- * @list_ref: A list of references.
- *
- * Deallocate the memory used by a list of references
- */
-static void
-xmlFreeRefList(xmlListPtr list_ref) {
- if (list_ref == NULL) return;
- xmlListDelete(list_ref);
-}
-
-/**
- * xmlWalkRemoveRef:
- * @data: Contents of current link
- * @user: Value supplied by the user
- *
- * Returns 0 to abort the walk or 1 to continue
- */
-static int
-xmlWalkRemoveRef(const void *data, const void *user)
-{
- xmlAttrPtr attr0 = ((xmlRefPtr)data)->attr;
- xmlAttrPtr attr1 = ((xmlRemoveMemoPtr)user)->ap;
- xmlListPtr ref_list = ((xmlRemoveMemoPtr)user)->l;
-
- if (attr0 == attr1) { /* Matched: remove and terminate walk */
- xmlListRemoveFirst(ref_list, (void *)data);
- return 0;
- }
- return 1;
-}
-
-/**
- * xmlAddRef:
- * @ctxt: the validation context
- * @doc: pointer to the document
- * @value: the value name
- * @attr: the attribute holding the Ref
- *
- * Register a new ref declaration
- *
- * Returns NULL if not, otherwise the new xmlRefPtr
- */
-xmlRefPtr
-xmlAddRef(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDocPtr doc, const xmlChar *value,
- xmlAttrPtr attr) {
- xmlRefPtr ret;
- xmlRefTablePtr table;
- xmlListPtr ref_list;
-
- if (doc == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddRef: doc == NULL\n");
- return(NULL);
- }
- if (value == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddRef: value == NULL\n");
- return(NULL);
- }
- if (attr == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddRef: attr == NULL\n");
- return(NULL);
- }
-
- /*
- * Create the Ref table if needed.
- */
- table = (xmlRefTablePtr) doc->refs;
- if (table == NULL)
- doc->refs = table = xmlCreateRefTable();
- if (table == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddRef: Table creation failed!\n");
- return(NULL);
- }
-
- ret = (xmlRefPtr) xmlMalloc(sizeof(xmlRef));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddRef: out of memory\n");
- return(NULL);
- }
-
- /*
- * fill the structure.
- */
- ret->value = xmlStrdup(value);
- ret->attr = attr;
-
- /* To add a reference :-
- * References are maintained as a list of references,
- * Lookup the entry, if no entry create new nodelist
- * Add the owning node to the NodeList
- * Return the ref
- */
-
- if (NULL == (ref_list = xmlHashLookup(table, value))) {
- if (NULL == (ref_list = xmlListCreate(xmlFreeRef, NULL))) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddRef: Reference list creation failed!\n");
- return(NULL);
- }
- if (xmlHashAddEntry(table, value, ref_list) < 0) {
- xmlListDelete(ref_list);
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddRef: Reference list insertion failed!\n");
- return(NULL);
- }
- }
- xmlListInsert(ref_list, ret);
- return(ret);
-}
-
-/**
- * xmlFreeRefTable:
- * @table: An ref table
- *
- * Deallocate the memory used by an Ref hash table.
- */
-void
-xmlFreeRefTable(xmlRefTablePtr table) {
- xmlHashFree(table, (xmlHashDeallocator) xmlFreeRefList);
-}
-
-/**
- * xmlIsRef:
- * @doc: the document
- * @elem: the element carrying the attribute
- * @attr: the attribute
- *
- * Determine whether an attribute is of type Ref. In case we have DTD(s)
- * then this is simple, otherwise we use an heuristic: name Ref (upper
- * or lowercase).
- *
- * Returns 0 or 1 depending on the lookup result
- */
-int
-xmlIsRef(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) {
- if ((doc->intSubset == NULL) && (doc->extSubset == NULL)) {
- return(0);
- } else if (doc->type == XML_HTML_DOCUMENT_NODE) {
- /* TODO @@@ */
- return(0);
- } else {
- xmlAttributePtr attrDecl;
-
- attrDecl = xmlGetDtdAttrDesc(doc->intSubset, elem->name, attr->name);
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdAttrDesc(doc->extSubset,
- elem->name, attr->name);
-
- if ((attrDecl != NULL) &&
- (attrDecl->atype == XML_ATTRIBUTE_IDREF ||
- attrDecl->atype == XML_ATTRIBUTE_IDREFS))
- return(1);
- }
- return(0);
-}
-
-/**
- * xmlRemoveRef:
- * @doc: the document
- * @attr: the attribute
- *
- * Remove the given attribute from the Ref table maintained internally.
- *
- * Returns -1 if the lookup failed and 0 otherwise
- */
-int
-xmlRemoveRef(xmlDocPtr doc, xmlAttrPtr attr) {
- xmlListPtr ref_list;
- xmlRefTablePtr table;
- xmlChar *ID;
- xmlRemoveMemo target;
-
- if (doc == NULL) return(-1);
- if (attr == NULL) return(-1);
- table = (xmlRefTablePtr) doc->refs;
- if (table == NULL)
- return(-1);
-
- if (attr == NULL)
- return(-1);
- ID = xmlNodeListGetString(doc, attr->children, 1);
- if (ID == NULL)
- return(-1);
- ref_list = xmlHashLookup(table, ID);
-
- if(ref_list == NULL) {
- xmlFree(ID);
- return (-1);
- }
- /* At this point, ref_list refers to a list of references which
- * have the same key as the supplied attr. Our list of references
- * is ordered by reference address and we don't have that information
- * here to use when removing. We'll have to walk the list and
- * check for a matching attribute, when we find one stop the walk
- * and remove the entry.
- * The list is ordered by reference, so that means we don't have the
- * key. Passing the list and the reference to the walker means we
- * will have enough data to be able to remove the entry.
- */
- target.l = ref_list;
- target.ap = attr;
-
- /* Remove the supplied attr from our list */
- xmlListWalk(ref_list, xmlWalkRemoveRef, &target);
-
- /*If the list is empty then remove the list entry in the hash */
- if (xmlListEmpty(ref_list))
- xmlHashUpdateEntry(table, ID, NULL, (xmlHashDeallocator)
- xmlFreeRefList);
- xmlFree(ID);
- return(0);
-}
-
-/**
- * xmlGetRefs:
- * @doc: pointer to the document
- * @ID: the ID value
- *
- * Find the set of references for the supplied ID.
- *
- * Returns NULL if not found, otherwise node set for the ID.
- */
-xmlListPtr
-xmlGetRefs(xmlDocPtr doc, const xmlChar *ID) {
- xmlRefTablePtr table;
-
- if (doc == NULL) {
- xmlGenericError(xmlGenericErrorContext, "xmlGetRefs: doc == NULL\n");
- return(NULL);
- }
-
- if (ID == NULL) {
- xmlGenericError(xmlGenericErrorContext, "xmlGetRefs: ID == NULL\n");
- return(NULL);
- }
-
- table = (xmlRefTablePtr) doc->refs;
- if (table == NULL)
- return(NULL);
-
- return (xmlHashLookup(table, ID));
-}
-
-/************************************************************************
- * *
- * Routines for validity checking *
- * *
- ************************************************************************/
-
-/**
- * xmlGetDtdElementDesc:
- * @dtd: a pointer to the DtD to search
- * @name: the element name
- *
- * Search the DTD for the description of this element
- *
- * returns the xmlElementPtr if found or NULL
- */
-
-xmlElementPtr
-xmlGetDtdElementDesc(xmlDtdPtr dtd, const xmlChar *name) {
- xmlElementTablePtr table;
- xmlElementPtr cur;
- xmlChar *uqname = NULL, *prefix = NULL;
-
- if (dtd == NULL) return(NULL);
- if (dtd->elements == NULL)
- return(NULL);
- table = (xmlElementTablePtr) dtd->elements;
-
- uqname = xmlSplitQName2(name, &prefix);
- if (uqname != NULL)
- name = uqname;
- cur = xmlHashLookup2(table, name, prefix);
- if (prefix != NULL) xmlFree(prefix);
- if (uqname != NULL) xmlFree(uqname);
- return(cur);
-}
-/**
- * xmlGetDtdElementDesc2:
- * @dtd: a pointer to the DtD to search
- * @name: the element name
- * @create: create an empty description if not found
- *
- * Search the DTD for the description of this element
- *
- * returns the xmlElementPtr if found or NULL
- */
-
-static xmlElementPtr
-xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, int create) {
- xmlElementTablePtr table;
- xmlElementPtr cur;
- xmlChar *uqname = NULL, *prefix = NULL;
-
- if (dtd == NULL) return(NULL);
- if (dtd->elements == NULL) {
- if (!create)
- return(NULL);
- /*
- * Create the Element table if needed.
- */
- table = (xmlElementTablePtr) dtd->elements;
- if (table == NULL) {
- table = xmlCreateElementTable();
- dtd->elements = (void *) table;
- }
- if (table == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlGetDtdElementDesc2: Table creation failed!\n");
- return(NULL);
- }
- }
- table = (xmlElementTablePtr) dtd->elements;
-
- uqname = xmlSplitQName2(name, &prefix);
- if (uqname != NULL)
- name = uqname;
- cur = xmlHashLookup2(table, name, prefix);
- if ((cur == NULL) && (create)) {
- cur = (xmlElementPtr) xmlMalloc(sizeof(xmlElement));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlGetDtdElementDesc2: out of memory\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlElement));
- cur->type = XML_ELEMENT_DECL;
-
- /*
- * fill the structure.
- */
- cur->name = xmlStrdup(name);
- cur->prefix = xmlStrdup(prefix);
- cur->etype = XML_ELEMENT_TYPE_UNDEFINED;
-
- xmlHashAddEntry2(table, name, prefix, cur);
- }
- if (prefix != NULL) xmlFree(prefix);
- if (uqname != NULL) xmlFree(uqname);
- return(cur);
-}
-
-/**
- * xmlGetDtdQElementDesc:
- * @dtd: a pointer to the DtD to search
- * @name: the element name
- * @prefix: the element namespace prefix
- *
- * Search the DTD for the description of this element
- *
- * returns the xmlElementPtr if found or NULL
- */
-
-xmlElementPtr
-xmlGetDtdQElementDesc(xmlDtdPtr dtd, const xmlChar *name,
- const xmlChar *prefix) {
- xmlElementTablePtr table;
-
- if (dtd == NULL) return(NULL);
- if (dtd->elements == NULL) return(NULL);
- table = (xmlElementTablePtr) dtd->elements;
-
- return(xmlHashLookup2(table, name, prefix));
-}
-
-/**
- * xmlGetDtdAttrDesc:
- * @dtd: a pointer to the DtD to search
- * @elem: the element name
- * @name: the attribute name
- *
- * Search the DTD for the description of this attribute on
- * this element.
- *
- * returns the xmlAttributePtr if found or NULL
- */
-
-xmlAttributePtr
-xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name) {
- xmlAttributeTablePtr table;
- xmlAttributePtr cur;
- xmlChar *uqname = NULL, *prefix = NULL;
-
- if (dtd == NULL) return(NULL);
- if (dtd->attributes == NULL) return(NULL);
-
- table = (xmlAttributeTablePtr) dtd->attributes;
- if (table == NULL)
- return(NULL);
-
- uqname = xmlSplitQName2(name, &prefix);
-
- if (uqname != NULL) {
- cur = xmlHashLookup3(table, uqname, prefix, elem);
- if (prefix != NULL) xmlFree(prefix);
- if (uqname != NULL) xmlFree(uqname);
- } else
- cur = xmlHashLookup3(table, name, NULL, elem);
- return(cur);
-}
-
-/**
- * xmlGetDtdQAttrDesc:
- * @dtd: a pointer to the DtD to search
- * @elem: the element name
- * @name: the attribute name
- * @prefix: the attribute namespace prefix
- *
- * Search the DTD for the description of this qualified attribute on
- * this element.
- *
- * returns the xmlAttributePtr if found or NULL
- */
-
-xmlAttributePtr
-xmlGetDtdQAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name,
- const xmlChar *prefix) {
- xmlAttributeTablePtr table;
-
- if (dtd == NULL) return(NULL);
- if (dtd->attributes == NULL) return(NULL);
- table = (xmlAttributeTablePtr) dtd->attributes;
-
- return(xmlHashLookup3(table, name, prefix, elem));
-}
-
-/**
- * xmlGetDtdNotationDesc:
- * @dtd: a pointer to the DtD to search
- * @name: the notation name
- *
- * Search the DTD for the description of this notation
- *
- * returns the xmlNotationPtr if found or NULL
- */
-
-xmlNotationPtr
-xmlGetDtdNotationDesc(xmlDtdPtr dtd, const xmlChar *name) {
- xmlNotationTablePtr table;
-
- if (dtd == NULL) return(NULL);
- if (dtd->notations == NULL) return(NULL);
- table = (xmlNotationTablePtr) dtd->notations;
-
- return(xmlHashLookup(table, name));
-}
-
-/**
- * xmlValidateNotationUse:
- * @ctxt: the validation context
- * @doc: the document
- * @notationName: the notation name to check
- *
- * Validate that the given name match a notation declaration.
- * - [ VC: Notation Declared ]
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateNotationUse(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
- const xmlChar *notationName) {
- xmlNotationPtr notaDecl;
- if ((doc == NULL) || (doc->intSubset == NULL)) return(-1);
-
- notaDecl = xmlGetDtdNotationDesc(doc->intSubset, notationName);
- if ((notaDecl == NULL) && (doc->extSubset != NULL))
- notaDecl = xmlGetDtdNotationDesc(doc->extSubset, notationName);
-
- if (notaDecl == NULL) {
- VERROR(ctxt->userData, "NOTATION %s is not declared\n",
- notationName);
- return(0);
- }
- return(1);
-}
-
-/**
- * xmlIsMixedElement:
- * @doc: the document
- * @name: the element name
- *
- * Search in the DtDs whether an element accept Mixed content (or ANY)
- * basically if it is supposed to accept text childs
- *
- * returns 0 if no, 1 if yes, and -1 if no element description is available
- */
-
-int
-xmlIsMixedElement(xmlDocPtr doc, const xmlChar *name) {
- xmlElementPtr elemDecl;
-
- if ((doc == NULL) || (doc->intSubset == NULL)) return(-1);
-
- elemDecl = xmlGetDtdElementDesc(doc->intSubset, name);
- if ((elemDecl == NULL) && (doc->extSubset != NULL))
- elemDecl = xmlGetDtdElementDesc(doc->extSubset, name);
- if (elemDecl == NULL) return(-1);
- switch (elemDecl->etype) {
- case XML_ELEMENT_TYPE_UNDEFINED:
- return(-1);
- case XML_ELEMENT_TYPE_ELEMENT:
- return(0);
- case XML_ELEMENT_TYPE_EMPTY:
- /*
- * return 1 for EMPTY since we want VC error to pop up
- * on <empty> </empty> for example
- */
- case XML_ELEMENT_TYPE_ANY:
- case XML_ELEMENT_TYPE_MIXED:
- return(1);
- }
- return(1);
-}
-
-/**
- * xmlValidateNameValue:
- * @value: an Name value
- *
- * Validate that the given value match Name production
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateNameValue(const xmlChar *value) {
- const xmlChar *cur;
- int val, len;
-
- if (value == NULL) return(0);
- cur = value;
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
- if (!IS_LETTER(val) && (val != '_') &&
- (val != ':')) {
- return(0);
- }
-
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
- while ((IS_LETTER(val)) || (IS_DIGIT(val)) ||
- (val == '.') || (val == '-') ||
- (val == '_') || (val == ':') ||
- (IS_COMBINING(val)) ||
- (IS_EXTENDER(val))) {
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
- }
-
- if (val != 0) return(0);
-
- return(1);
-}
-
-/**
- * xmlValidateNamesValue:
- * @value: an Names value
- *
- * Validate that the given value match Names production
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateNamesValue(const xmlChar *value) {
- const xmlChar *cur;
- int val, len;
-
- if (value == NULL) return(0);
- cur = value;
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
-
- if (!IS_LETTER(val) && (val != '_') &&
- (val != ':')) {
- return(0);
- }
-
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
- while ((IS_LETTER(val)) || (IS_DIGIT(val)) ||
- (val == '.') || (val == '-') ||
- (val == '_') || (val == ':') ||
- (IS_COMBINING(val)) ||
- (IS_EXTENDER(val))) {
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
- }
-
- while (IS_BLANK(val)) {
- while (IS_BLANK(val)) {
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
- }
-
- if (!IS_LETTER(val) && (val != '_') &&
- (val != ':')) {
- return(0);
- }
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
-
- while ((IS_LETTER(val)) || (IS_DIGIT(val)) ||
- (val == '.') || (val == '-') ||
- (val == '_') || (val == ':') ||
- (IS_COMBINING(val)) ||
- (IS_EXTENDER(val))) {
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
- }
- }
-
- if (val != 0) return(0);
-
- return(1);
-}
-
-/**
- * xmlValidateNmtokenValue:
- * @value: an Nmtoken value
- *
- * Validate that the given value match Nmtoken production
- *
- * [ VC: Name Token ]
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateNmtokenValue(const xmlChar *value) {
- const xmlChar *cur;
- int val, len;
-
- if (value == NULL) return(0);
- cur = value;
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
-
- if (!IS_LETTER(val) && !IS_DIGIT(val) &&
- (val != '.') && (val != '-') &&
- (val != '_') && (val != ':') &&
- (!IS_COMBINING(val)) &&
- (!IS_EXTENDER(val)))
- return(0);
-
- while ((IS_LETTER(val)) || (IS_DIGIT(val)) ||
- (val == '.') || (val == '-') ||
- (val == '_') || (val == ':') ||
- (IS_COMBINING(val)) ||
- (IS_EXTENDER(val))) {
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
- }
-
- if (val != 0) return(0);
-
- return(1);
-}
-
-/**
- * xmlValidateNmtokensValue:
- * @value: an Nmtokens value
- *
- * Validate that the given value match Nmtokens production
- *
- * [ VC: Name Token ]
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateNmtokensValue(const xmlChar *value) {
- const xmlChar *cur;
- int val, len;
-
- if (value == NULL) return(0);
- cur = value;
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
-
- while (IS_BLANK(val)) {
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
- }
-
- if (!IS_LETTER(val) && !IS_DIGIT(val) &&
- (val != '.') && (val != '-') &&
- (val != '_') && (val != ':') &&
- (!IS_COMBINING(val)) &&
- (!IS_EXTENDER(val)))
- return(0);
-
- while ((IS_LETTER(val)) || (IS_DIGIT(val)) ||
- (val == '.') || (val == '-') ||
- (val == '_') || (val == ':') ||
- (IS_COMBINING(val)) ||
- (IS_EXTENDER(val))) {
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
- }
-
- while (IS_BLANK(val)) {
- while (IS_BLANK(val)) {
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
- }
- if (val == 0) return(1);
-
- if (!IS_LETTER(val) && !IS_DIGIT(val) &&
- (val != '.') && (val != '-') &&
- (val != '_') && (val != ':') &&
- (!IS_COMBINING(val)) &&
- (!IS_EXTENDER(val)))
- return(0);
-
- while ((IS_LETTER(val)) || (IS_DIGIT(val)) ||
- (val == '.') || (val == '-') ||
- (val == '_') || (val == ':') ||
- (IS_COMBINING(val)) ||
- (IS_EXTENDER(val))) {
- val = xmlStringCurrentChar(NULL, cur, &len);
- cur += len;
- }
- }
-
- if (val != 0) return(0);
-
- return(1);
-}
-
-/**
- * xmlValidateNotationDecl:
- * @ctxt: the validation context
- * @doc: a document instance
- * @nota: a notation definition
- *
- * Try to validate a single notation definition
- * basically it does the following checks as described by the
- * XML-1.0 recommendation:
- * - it seems that no validity constraint exists on notation declarations
- * But this function get called anyway ...
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateNotationDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDocPtr doc ATTRIBUTE_UNUSED,
- xmlNotationPtr nota ATTRIBUTE_UNUSED) {
- int ret = 1;
-
- return(ret);
-}
-
-/**
- * xmlValidateAttributeValue:
- * @type: an attribute type
- * @value: an attribute value
- *
- * Validate that the given attribute value match the proper production
- *
- * [ VC: ID ]
- * Values of type ID must match the Name production....
- *
- * [ VC: IDREF ]
- * Values of type IDREF must match the Name production, and values
- * of type IDREFS must match Names ...
- *
- * [ VC: Entity Name ]
- * Values of type ENTITY must match the Name production, values
- * of type ENTITIES must match Names ...
- *
- * [ VC: Name Token ]
- * Values of type NMTOKEN must match the Nmtoken production; values
- * of type NMTOKENS must match Nmtokens.
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateAttributeValue(xmlAttributeType type, const xmlChar *value) {
- switch (type) {
- case XML_ATTRIBUTE_ENTITIES:
- case XML_ATTRIBUTE_IDREFS:
- return(xmlValidateNamesValue(value));
- case XML_ATTRIBUTE_ENTITY:
- case XML_ATTRIBUTE_IDREF:
- case XML_ATTRIBUTE_ID:
- case XML_ATTRIBUTE_NOTATION:
- return(xmlValidateNameValue(value));
- case XML_ATTRIBUTE_NMTOKENS:
- case XML_ATTRIBUTE_ENUMERATION:
- return(xmlValidateNmtokensValue(value));
- case XML_ATTRIBUTE_NMTOKEN:
- return(xmlValidateNmtokenValue(value));
- case XML_ATTRIBUTE_CDATA:
- break;
- }
- return(1);
-}
-
-/**
- * xmlValidateAttributeValue2:
- * @ctxt: the validation context
- * @doc: the document
- * @name: the attribute name (used for error reporting only)
- * @type: the attribute type
- * @value: the attribute value
- *
- * Validate that the given attribute value match a given type.
- * This typically cannot be done before having finished parsing
- * the subsets.
- *
- * [ VC: IDREF ]
- * Values of type IDREF must match one of the declared IDs
- * Values of type IDREFS must match a sequence of the declared IDs
- * each Name must match the value of an ID attribute on some element
- * in the XML document; i.e. IDREF values must match the value of
- * some ID attribute
- *
- * [ VC: Entity Name ]
- * Values of type ENTITY must match one declared entity
- * Values of type ENTITIES must match a sequence of declared entities
- *
- * [ VC: Notation Attributes ]
- * all notation names in the declaration must be declared.
- *
- * returns 1 if valid or 0 otherwise
- */
-
-static int
-xmlValidateAttributeValue2(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
- const xmlChar *name, xmlAttributeType type, const xmlChar *value) {
- int ret = 1;
- switch (type) {
- case XML_ATTRIBUTE_IDREFS:
- case XML_ATTRIBUTE_IDREF:
- case XML_ATTRIBUTE_ID:
- case XML_ATTRIBUTE_NMTOKENS:
- case XML_ATTRIBUTE_ENUMERATION:
- case XML_ATTRIBUTE_NMTOKEN:
- case XML_ATTRIBUTE_CDATA:
- break;
- case XML_ATTRIBUTE_ENTITY: {
- xmlEntityPtr ent;
-
- ent = xmlGetDocEntity(doc, value);
- if ((ent == NULL) && (doc->standalone == 1)) {
- doc->standalone = 0;
- ent = xmlGetDocEntity(doc, value);
- if (ent != NULL) {
- VERROR(ctxt->userData,
-"standalone problem: attribute %s reference entity \"%s\" in external subset\n",
- name, value);
- /* WAIT to get answer from the Core WG on this
- ret = 0;
- */
- }
- }
- if (ent == NULL) {
- VERROR(ctxt->userData,
- "ENTITY attribute %s reference an unknown entity \"%s\"\n",
- name, value);
- ret = 0;
- } else if (ent->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
- VERROR(ctxt->userData,
- "ENTITY attribute %s reference an entity \"%s\" of wrong type\n",
- name, value);
- ret = 0;
- }
- break;
- }
- case XML_ATTRIBUTE_ENTITIES: {
- xmlChar *dup, *nam = NULL, *cur, save;
- xmlEntityPtr ent;
-
- dup = xmlStrdup(value);
- if (dup == NULL)
- return(0);
- cur = dup;
- while (*cur != 0) {
- nam = cur;
- while ((*cur != 0) && (!IS_BLANK(*cur))) cur++;
- save = *cur;
- *cur = 0;
- ent = xmlGetDocEntity(doc, nam);
- if (ent == NULL) {
- VERROR(ctxt->userData,
- "ENTITIES attribute %s reference an unknown entity \"%s\"\n",
- name, nam);
- ret = 0;
- } else if (ent->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
- VERROR(ctxt->userData,
- "ENTITIES attribute %s reference an entity \"%s\" of wrong type\n",
- name, nam);
- ret = 0;
- }
- if (save == 0)
- break;
- *cur = save;
- while (IS_BLANK(*cur)) cur++;
- }
- xmlFree(dup);
- break;
- }
- case XML_ATTRIBUTE_NOTATION: {
- xmlNotationPtr nota;
-
- nota = xmlGetDtdNotationDesc(doc->intSubset, value);
- if ((nota == NULL) && (doc->extSubset != NULL))
- nota = xmlGetDtdNotationDesc(doc->extSubset, value);
-
- if (nota == NULL) {
- VERROR(ctxt->userData,
- "NOTATION attribute %s reference an unknown notation \"%s\"\n",
- name, value);
- ret = 0;
- }
- break;
- }
- }
- return(ret);
-}
-
-/**
- * xmlValidCtxtNormalizeAttributeValue:
- * @ctxt: the validation context
- * @doc: the document
- * @elem: the parent
- * @name: the attribute name
- * @value: the attribute value
- * @ctxt: the validation context or NULL
- *
- * Does the validation related extra step of the normalization of attribute
- * values:
- *
- * If the declared value is not CDATA, then the XML processor must further
- * process the normalized attribute value by discarding any leading and
- * trailing space (#x20) characters, and by replacing sequences of space
- * (#x20) characters by single space (#x20) character.
- *
- * Also check VC: Standalone Document Declaration in P32, and update
- * ctxt->valid accordingly
- *
- * returns a new normalized string if normalization is needed, NULL otherwise
- * the caller must free the returned value.
- */
-
-xmlChar *
-xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
- xmlNodePtr elem, const xmlChar *name, const xmlChar *value) {
- xmlChar *ret, *dst;
- const xmlChar *src;
- xmlAttributePtr attrDecl = NULL;
- int extsubset = 0;
-
- if (doc == NULL) return(NULL);
- if (elem == NULL) return(NULL);
- if (name == NULL) return(NULL);
- if (value == NULL) return(NULL);
-
- if ((elem->ns != NULL) && (elem->ns->prefix != NULL)) {
- xmlChar qname[500];
- snprintf((char *) qname, sizeof(qname), "%s:%s",
- elem->ns->prefix, elem->name);
- qname[sizeof(qname) - 1] = 0;
- attrDecl = xmlGetDtdAttrDesc(doc->intSubset, qname, name);
- if ((attrDecl == NULL) && (doc->extSubset != NULL)) {
- attrDecl = xmlGetDtdAttrDesc(doc->extSubset, qname, name);
- if (attrDecl != NULL)
- extsubset = 1;
- }
- }
- if ((attrDecl == NULL) && (doc->intSubset != NULL))
- attrDecl = xmlGetDtdAttrDesc(doc->intSubset, elem->name, name);
- if ((attrDecl == NULL) && (doc->extSubset != NULL)) {
- attrDecl = xmlGetDtdAttrDesc(doc->extSubset, elem->name, name);
- if (attrDecl != NULL)
- extsubset = 1;
- }
-
- if (attrDecl == NULL)
- return(NULL);
- if (attrDecl->atype == XML_ATTRIBUTE_CDATA)
- return(NULL);
-
- ret = xmlStrdup(value);
- if (ret == NULL)
- return(NULL);
- src = value;
- dst = ret;
- while (*src == 0x20) src++;
- while (*src != 0) {
- if (*src == 0x20) {
- while (*src == 0x20) src++;
- if (*src != 0)
- *dst++ = 0x20;
- } else {
- *dst++ = *src++;
- }
- }
- *dst = 0;
- if ((doc->standalone) && (extsubset == 1) && (!xmlStrEqual(value, ret))) {
- VERROR(ctxt->userData,
-"standalone: %s on %s value had to be normalized based on external subset declaration\n",
- name, elem->name);
- ctxt->valid = 0;
- }
- return(ret);
-}
-
-/**
- * xmlValidNormalizeAttributeValue:
- * @doc: the document
- * @elem: the parent
- * @name: the attribute name
- * @value: the attribute value
- *
- * Does the validation related extra step of the normalization of attribute
- * values:
- *
- * If the declared value is not CDATA, then the XML processor must further
- * process the normalized attribute value by discarding any leading and
- * trailing space (#x20) characters, and by replacing sequences of space
- * (#x20) characters by single space (#x20) character.
- *
- * returns a new normalized string if normalization is needed, NULL otherwise
- * the caller must free the returned value.
- */
-
-xmlChar *
-xmlValidNormalizeAttributeValue(xmlDocPtr doc, xmlNodePtr elem,
- const xmlChar *name, const xmlChar *value) {
- xmlChar *ret, *dst;
- const xmlChar *src;
- xmlAttributePtr attrDecl = NULL;
-
- if (doc == NULL) return(NULL);
- if (elem == NULL) return(NULL);
- if (name == NULL) return(NULL);
- if (value == NULL) return(NULL);
-
- if ((elem->ns != NULL) && (elem->ns->prefix != NULL)) {
- xmlChar qname[500];
- snprintf((char *) qname, sizeof(qname), "%s:%s",
- elem->ns->prefix, elem->name);
- qname[sizeof(qname) - 1] = 0;
- attrDecl = xmlGetDtdAttrDesc(doc->intSubset, qname, name);
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdAttrDesc(doc->extSubset, qname, name);
- }
- attrDecl = xmlGetDtdAttrDesc(doc->intSubset, elem->name, name);
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdAttrDesc(doc->extSubset, elem->name, name);
-
- if (attrDecl == NULL)
- return(NULL);
- if (attrDecl->atype == XML_ATTRIBUTE_CDATA)
- return(NULL);
-
- ret = xmlStrdup(value);
- if (ret == NULL)
- return(NULL);
- src = value;
- dst = ret;
- while (*src == 0x20) src++;
- while (*src != 0) {
- if (*src == 0x20) {
- while (*src == 0x20) src++;
- if (*src != 0)
- *dst++ = 0x20;
- } else {
- *dst++ = *src++;
- }
- }
- *dst = 0;
- return(ret);
-}
-
-static void
-xmlValidateAttributeIdCallback(xmlAttributePtr attr, int *count,
- const xmlChar* name ATTRIBUTE_UNUSED) {
- if (attr->atype == XML_ATTRIBUTE_ID) (*count)++;
-}
-
-/**
- * xmlValidateAttributeDecl:
- * @ctxt: the validation context
- * @doc: a document instance
- * @attr: an attribute definition
- *
- * Try to validate a single attribute definition
- * basically it does the following checks as described by the
- * XML-1.0 recommendation:
- * - [ VC: Attribute Default Legal ]
- * - [ VC: Enumeration ]
- * - [ VC: ID Attribute Default ]
- *
- * The ID/IDREF uniqueness and matching are done separately
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
- xmlAttributePtr attr) {
- int ret = 1;
- int val;
- CHECK_DTD;
- if(attr == NULL) return(1);
-
- /* Attribute Default Legal */
- /* Enumeration */
- if (attr->defaultValue != NULL) {
- val = xmlValidateAttributeValue(attr->atype, attr->defaultValue);
- if (val == 0) {
- VERROR(ctxt->userData,
- "Syntax of default value for attribute %s of %s is not valid\n",
- attr->name, attr->elem);
- }
- ret &= val;
- }
-
- /* ID Attribute Default */
- if ((attr->atype == XML_ATTRIBUTE_ID)&&
- (attr->def != XML_ATTRIBUTE_IMPLIED) &&
- (attr->def != XML_ATTRIBUTE_REQUIRED)) {
- VERROR(ctxt->userData,
- "ID attribute %s of %s is not valid must be #IMPLIED or #REQUIRED\n",
- attr->name, attr->elem);
- ret = 0;
- }
-
- /* One ID per Element Type */
- if (attr->atype == XML_ATTRIBUTE_ID) {
- int nbId;
-
- /* the trick is that we parse DtD as their own internal subset */
- xmlElementPtr elem = xmlGetDtdElementDesc(doc->intSubset,
- attr->elem);
- if (elem != NULL) {
- nbId = xmlScanIDAttributeDecl(NULL, elem);
- } else {
- xmlAttributeTablePtr table;
-
- /*
- * The attribute may be declared in the internal subset and the
- * element in the external subset.
- */
- nbId = 0;
- table = (xmlAttributeTablePtr) doc->intSubset->attributes;
- xmlHashScan3(table, NULL, NULL, attr->elem, (xmlHashScanner)
- xmlValidateAttributeIdCallback, &nbId);
- }
- if (nbId > 1) {
- VERROR(ctxt->userData,
- "Element %s has %d ID attribute defined in the internal subset : %s\n",
- attr->elem, nbId, attr->name);
- } else if (doc->extSubset != NULL) {
- int extId = 0;
- elem = xmlGetDtdElementDesc(doc->extSubset, attr->elem);
- if (elem != NULL) {
- extId = xmlScanIDAttributeDecl(NULL, elem);
- }
- if (extId > 1) {
- VERROR(ctxt->userData,
- "Element %s has %d ID attribute defined in the external subset : %s\n",
- attr->elem, extId, attr->name);
- } else if (extId + nbId > 1) {
- VERROR(ctxt->userData,
-"Element %s has ID attributes defined in the internal and external subset : %s\n",
- attr->elem, attr->name);
- }
- }
- }
-
- /* Validity Constraint: Enumeration */
- if ((attr->defaultValue != NULL) && (attr->tree != NULL)) {
- xmlEnumerationPtr tree = attr->tree;
- while (tree != NULL) {
- if (xmlStrEqual(tree->name, attr->defaultValue)) break;
- tree = tree->next;
- }
- if (tree == NULL) {
- VERROR(ctxt->userData,
-"Default value \"%s\" for attribute %s of %s is not among the enumerated set\n",
- attr->defaultValue, attr->name, attr->elem);
- ret = 0;
- }
- }
-
- return(ret);
-}
-
-/**
- * xmlValidateElementDecl:
- * @ctxt: the validation context
- * @doc: a document instance
- * @elem: an element definition
- *
- * Try to validate a single element definition
- * basically it does the following checks as described by the
- * XML-1.0 recommendation:
- * - [ VC: One ID per Element Type ]
- * - [ VC: No Duplicate Types ]
- * - [ VC: Unique Element Type Declaration ]
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
- xmlElementPtr elem) {
- int ret = 1;
- xmlElementPtr tst;
-
- CHECK_DTD;
-
- if (elem == NULL) return(1);
-
-#if 0
-#ifdef LIBXML_REGEXP_ENABLED
- /* Build the regexp associated to the content model */
- ret = xmlValidBuildContentModel(ctxt, elem);
-#endif
-#endif
-
- /* No Duplicate Types */
- if (elem->etype == XML_ELEMENT_TYPE_MIXED) {
- xmlElementContentPtr cur, next;
- const xmlChar *name;
-
- cur = elem->content;
- while (cur != NULL) {
- if (cur->type != XML_ELEMENT_CONTENT_OR) break;
- if (cur->c1 == NULL) break;
- if (cur->c1->type == XML_ELEMENT_CONTENT_ELEMENT) {
- name = cur->c1->name;
- next = cur->c2;
- while (next != NULL) {
- if (next->type == XML_ELEMENT_CONTENT_ELEMENT) {
- if (xmlStrEqual(next->name, name)) {
- VERROR(ctxt->userData,
- "Definition of %s has duplicate references of %s\n",
- elem->name, name);
- ret = 0;
- }
- break;
- }
- if (next->c1 == NULL) break;
- if (next->c1->type != XML_ELEMENT_CONTENT_ELEMENT) break;
- if (xmlStrEqual(next->c1->name, name)) {
- VERROR(ctxt->userData,
- "Definition of %s has duplicate references of %s\n",
- elem->name, name);
- ret = 0;
- }
- next = next->c2;
- }
- }
- cur = cur->c2;
- }
- }
-
- /* VC: Unique Element Type Declaration */
- tst = xmlGetDtdElementDesc(doc->intSubset, elem->name);
- if ((tst != NULL ) && (tst != elem) &&
- ((tst->prefix == elem->prefix) ||
- (xmlStrEqual(tst->prefix, elem->prefix))) &&
- (tst->etype != XML_ELEMENT_TYPE_UNDEFINED)) {
- VERROR(ctxt->userData, "Redefinition of element %s\n",
- elem->name);
- ret = 0;
- }
- tst = xmlGetDtdElementDesc(doc->extSubset, elem->name);
- if ((tst != NULL ) && (tst != elem) &&
- ((tst->prefix == elem->prefix) ||
- (xmlStrEqual(tst->prefix, elem->prefix))) &&
- (tst->etype != XML_ELEMENT_TYPE_UNDEFINED)) {
- VERROR(ctxt->userData, "Redefinition of element %s\n",
- elem->name);
- ret = 0;
- }
- /* One ID per Element Type
- * already done when registering the attribute
- if (xmlScanIDAttributeDecl(ctxt, elem) > 1) {
- ret = 0;
- } */
- return(ret);
-}
-
-/**
- * xmlValidateOneAttribute:
- * @ctxt: the validation context
- * @doc: a document instance
- * @elem: an element instance
- * @attr: an attribute instance
- * @value: the attribute value (without entities processing)
- *
- * Try to validate a single attribute for an element
- * basically it does the following checks as described by the
- * XML-1.0 recommendation:
- * - [ VC: Attribute Value Type ]
- * - [ VC: Fixed Attribute Default ]
- * - [ VC: Entity Name ]
- * - [ VC: Name Token ]
- * - [ VC: ID ]
- * - [ VC: IDREF ]
- * - [ VC: Entity Name ]
- * - [ VC: Notation Attributes ]
- *
- * The ID/IDREF uniqueness and matching are done separately
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
- xmlNodePtr elem, xmlAttrPtr attr, const xmlChar *value) {
- /* xmlElementPtr elemDecl; */
- xmlAttributePtr attrDecl = NULL;
- int val;
- int ret = 1;
-
- CHECK_DTD;
- if ((elem == NULL) || (elem->name == NULL)) return(0);
- if ((attr == NULL) || (attr->name == NULL)) return(0);
-
- if ((elem->ns != NULL) && (elem->ns->prefix != NULL)) {
- xmlChar qname[500];
- snprintf((char *) qname, sizeof(qname), "%s:%s",
- elem->ns->prefix, elem->name);
- qname[sizeof(qname) - 1] = 0;
- if (attr->ns != NULL) {
- attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, qname,
- attr->name, attr->ns->prefix);
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, qname,
- attr->name, attr->ns->prefix);
- } else {
- attrDecl = xmlGetDtdAttrDesc(doc->intSubset, qname, attr->name);
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdAttrDesc(doc->extSubset,
- qname, attr->name);
- }
- }
- if (attrDecl == NULL) {
- if (attr->ns != NULL) {
- attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, elem->name,
- attr->name, attr->ns->prefix);
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, elem->name,
- attr->name, attr->ns->prefix);
- } else {
- attrDecl = xmlGetDtdAttrDesc(doc->intSubset,
- elem->name, attr->name);
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdAttrDesc(doc->extSubset,
- elem->name, attr->name);
- }
- }
-
-
- /* Validity Constraint: Attribute Value Type */
- if (attrDecl == NULL) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "No declaration for attribute %s of element %s\n",
- attr->name, elem->name);
- return(0);
- }
- attr->atype = attrDecl->atype;
-
- val = xmlValidateAttributeValue(attrDecl->atype, value);
- if (val == 0) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Syntax of value for attribute %s of %s is not valid\n",
- attr->name, elem->name);
- ret = 0;
- }
-
- /* Validity constraint: Fixed Attribute Default */
- if (attrDecl->def == XML_ATTRIBUTE_FIXED) {
- if (!xmlStrEqual(value, attrDecl->defaultValue)) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Value for attribute %s of %s is different from default \"%s\"\n",
- attr->name, elem->name, attrDecl->defaultValue);
- ret = 0;
- }
- }
-
- /* Validity Constraint: ID uniqueness */
- if (attrDecl->atype == XML_ATTRIBUTE_ID) {
- if (xmlAddID(ctxt, doc, value, attr) == NULL)
- ret = 0;
- }
-
- if ((attrDecl->atype == XML_ATTRIBUTE_IDREF) ||
- (attrDecl->atype == XML_ATTRIBUTE_IDREFS)) {
- if (xmlAddRef(ctxt, doc, value, attr) == NULL)
- ret = 0;
- }
-
- /* Validity Constraint: Notation Attributes */
- if (attrDecl->atype == XML_ATTRIBUTE_NOTATION) {
- xmlEnumerationPtr tree = attrDecl->tree;
- xmlNotationPtr nota;
-
- /* First check that the given NOTATION was declared */
- nota = xmlGetDtdNotationDesc(doc->intSubset, value);
- if (nota == NULL)
- nota = xmlGetDtdNotationDesc(doc->extSubset, value);
-
- if (nota == NULL) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Value \"%s\" for attribute %s of %s is not a declared Notation\n",
- value, attr->name, elem->name);
- ret = 0;
- }
-
- /* Second, verify that it's among the list */
- while (tree != NULL) {
- if (xmlStrEqual(tree->name, value)) break;
- tree = tree->next;
- }
- if (tree == NULL) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
-"Value \"%s\" for attribute %s of %s is not among the enumerated notations\n",
- value, attr->name, elem->name);
- ret = 0;
- }
- }
-
- /* Validity Constraint: Enumeration */
- if (attrDecl->atype == XML_ATTRIBUTE_ENUMERATION) {
- xmlEnumerationPtr tree = attrDecl->tree;
- while (tree != NULL) {
- if (xmlStrEqual(tree->name, value)) break;
- tree = tree->next;
- }
- if (tree == NULL) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Value \"%s\" for attribute %s of %s is not among the enumerated set\n",
- value, attr->name, elem->name);
- ret = 0;
- }
- }
-
- /* Fixed Attribute Default */
- if ((attrDecl->def == XML_ATTRIBUTE_FIXED) &&
- (!xmlStrEqual(attrDecl->defaultValue, value))) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Value for attribute %s of %s must be \"%s\"\n",
- attr->name, elem->name, attrDecl->defaultValue);
- ret = 0;
- }
-
- /* Extra check for the attribute value */
- ret &= xmlValidateAttributeValue2(ctxt, doc, attr->name,
- attrDecl->atype, value);
-
- return(ret);
-}
-
-/**
- * xmlValidateOneNamespace:
- * @ctxt: the validation context
- * @doc: a document instance
- * @elem: an element instance
- * @prefix: the namespace prefix
- * @ns: an namespace declaration instance
- * @value: the attribute value (without entities processing)
- *
- * Try to validate a single namespace declaration for an element
- * basically it does the following checks as described by the
- * XML-1.0 recommendation:
- * - [ VC: Attribute Value Type ]
- * - [ VC: Fixed Attribute Default ]
- * - [ VC: Entity Name ]
- * - [ VC: Name Token ]
- * - [ VC: ID ]
- * - [ VC: IDREF ]
- * - [ VC: Entity Name ]
- * - [ VC: Notation Attributes ]
- *
- * The ID/IDREF uniqueness and matching are done separately
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateOneNamespace(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
-xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) {
- /* xmlElementPtr elemDecl; */
- xmlAttributePtr attrDecl = NULL;
- int val;
- int ret = 1;
-
- CHECK_DTD;
- if ((elem == NULL) || (elem->name == NULL)) return(0);
- if ((ns == NULL) || (ns->href == NULL)) return(0);
-
- if (prefix != NULL) {
- xmlChar qname[500];
- snprintf((char *) qname, sizeof(qname), "%s:%s",
- prefix, elem->name);
- qname[sizeof(qname) - 1] = 0;
- if (ns->prefix != NULL) {
- attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, qname,
- ns->prefix, BAD_CAST "xmlns");
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, qname,
- ns->prefix, BAD_CAST "xmlns");
- } else {
- attrDecl = xmlGetDtdAttrDesc(doc->intSubset, qname,
- BAD_CAST "xmlns");
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdAttrDesc(doc->extSubset, qname,
- BAD_CAST "xmlns");
- }
- }
- if (attrDecl == NULL) {
- if (ns->prefix != NULL) {
- attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, elem->name,
- ns->prefix, BAD_CAST "xmlns");
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, elem->name,
- ns->prefix, BAD_CAST "xmlns");
- } else {
- attrDecl = xmlGetDtdAttrDesc(doc->intSubset,
- elem->name, BAD_CAST "xmlns");
- if ((attrDecl == NULL) && (doc->extSubset != NULL))
- attrDecl = xmlGetDtdAttrDesc(doc->extSubset,
- elem->name, BAD_CAST "xmlns");
- }
- }
-
-
- /* Validity Constraint: Attribute Value Type */
- if (attrDecl == NULL) {
- VECTXT(ctxt, elem);
- if (ns->prefix != NULL) {
- VERROR(ctxt->userData,
- "No declaration for attribute xmlns:%s of element %s\n",
- ns->prefix, elem->name);
- } else {
- VERROR(ctxt->userData,
- "No declaration for attribute xmlns of element %s\n",
- elem->name);
- }
- return(0);
- }
-
- val = xmlValidateAttributeValue(attrDecl->atype, value);
- if (val == 0) {
- VECTXT(ctxt, elem);
- if (ns->prefix != NULL) {
- VERROR(ctxt->userData,
- "Syntax of value for attribute xmlns:%s of %s is not valid\n",
- ns->prefix, elem->name);
- } else {
- VERROR(ctxt->userData,
- "Syntax of value for attribute xmlns of %s is not valid\n",
- elem->name);
- }
- ret = 0;
- }
-
- /* Validity constraint: Fixed Attribute Default */
- if (attrDecl->def == XML_ATTRIBUTE_FIXED) {
- if (!xmlStrEqual(value, attrDecl->defaultValue)) {
- VECTXT(ctxt, elem);
- if (ns->prefix != NULL) {
- VERROR(ctxt->userData,
- "Value for attribute xmlns:%s of %s is different from default \"%s\"\n",
- ns->prefix, elem->name, attrDecl->defaultValue);
- } else {
- VERROR(ctxt->userData,
- "Value for attribute xmlns of %s is different from default \"%s\"\n",
- elem->name, attrDecl->defaultValue);
- }
- ret = 0;
- }
- }
-
- /* Validity Constraint: ID uniqueness */
- if (attrDecl->atype == XML_ATTRIBUTE_ID) {
- if (xmlAddID(ctxt, doc, value, (xmlAttrPtr) ns) == NULL)
- ret = 0;
- }
-
- if ((attrDecl->atype == XML_ATTRIBUTE_IDREF) ||
- (attrDecl->atype == XML_ATTRIBUTE_IDREFS)) {
- if (xmlAddRef(ctxt, doc, value, (xmlAttrPtr) ns) == NULL)
- ret = 0;
- }
-
- /* Validity Constraint: Notation Attributes */
- if (attrDecl->atype == XML_ATTRIBUTE_NOTATION) {
- xmlEnumerationPtr tree = attrDecl->tree;
- xmlNotationPtr nota;
-
- /* First check that the given NOTATION was declared */
- nota = xmlGetDtdNotationDesc(doc->intSubset, value);
- if (nota == NULL)
- nota = xmlGetDtdNotationDesc(doc->extSubset, value);
-
- if (nota == NULL) {
- VECTXT(ctxt, elem);
- if (ns->prefix != NULL) {
- VERROR(ctxt->userData,
- "Value \"%s\" for attribute xmlns:%s of %s is not a declared Notation\n",
- value, ns->prefix, elem->name);
- } else {
- VERROR(ctxt->userData,
- "Value \"%s\" for attribute xmlns of %s is not a declared Notation\n",
- value, elem->name);
- }
- ret = 0;
- }
-
- /* Second, verify that it's among the list */
- while (tree != NULL) {
- if (xmlStrEqual(tree->name, value)) break;
- tree = tree->next;
- }
- if (tree == NULL) {
- VECTXT(ctxt, elem);
- if (ns->prefix != NULL) {
- VERROR(ctxt->userData,
-"Value \"%s\" for attribute xmlns:%s of %s is not among the enumerated notations\n",
- value, ns->prefix, elem->name);
- } else {
- VERROR(ctxt->userData,
-"Value \"%s\" for attribute xmlns of %s is not among the enumerated notations\n",
- value, elem->name);
- }
- ret = 0;
- }
- }
-
- /* Validity Constraint: Enumeration */
- if (attrDecl->atype == XML_ATTRIBUTE_ENUMERATION) {
- xmlEnumerationPtr tree = attrDecl->tree;
- while (tree != NULL) {
- if (xmlStrEqual(tree->name, value)) break;
- tree = tree->next;
- }
- if (tree == NULL) {
- VECTXT(ctxt, elem);
- if (ns->prefix != NULL) {
- VERROR(ctxt->userData,
-"Value \"%s\" for attribute xmlns:%s of %s is not among the enumerated set\n",
- value, ns->prefix, elem->name);
- } else {
- VERROR(ctxt->userData,
-"Value \"%s\" for attribute xmlns of %s is not among the enumerated set\n",
- value, elem->name);
- }
- ret = 0;
- }
- }
-
- /* Fixed Attribute Default */
- if ((attrDecl->def == XML_ATTRIBUTE_FIXED) &&
- (!xmlStrEqual(attrDecl->defaultValue, value))) {
- VECTXT(ctxt, elem);
- if (ns->prefix != NULL) {
- VERROR(ctxt->userData,
- "Value for attribute xmlns:%s of %s must be \"%s\"\n",
- ns->prefix, elem->name, attrDecl->defaultValue);
- } else {
- VERROR(ctxt->userData,
- "Value for attribute xmlns of %s must be \"%s\"\n",
- elem->name, attrDecl->defaultValue);
- }
- ret = 0;
- }
-
- /* Extra check for the attribute value */
- if (ns->prefix != NULL) {
- ret &= xmlValidateAttributeValue2(ctxt, doc, ns->prefix,
- attrDecl->atype, value);
- } else {
- ret &= xmlValidateAttributeValue2(ctxt, doc, BAD_CAST "xmlns",
- attrDecl->atype, value);
- }
-
- return(ret);
-}
-
-#ifndef LIBXML_REGEXP_ENABLED
-/**
- * xmlValidateSkipIgnorable:
- * @ctxt: the validation context
- * @child: the child list
- *
- * Skip ignorable elements w.r.t. the validation process
- *
- * returns the first element to consider for validation of the content model
- */
-
-static xmlNodePtr
-xmlValidateSkipIgnorable(xmlNodePtr child) {
- while (child != NULL) {
- switch (child->type) {
- /* These things are ignored (skipped) during validation. */
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- child = child->next;
- break;
- case XML_TEXT_NODE:
- if (xmlIsBlankNode(child))
- child = child->next;
- else
- return(child);
- break;
- /* keep current node */
- default:
- return(child);
- }
- }
- return(child);
-}
-
-/**
- * xmlValidateElementType:
- * @ctxt: the validation context
- *
- * Try to validate the content model of an element internal function
- *
- * returns 1 if valid or 0 ,-1 in case of error, -2 if an entity
- * reference is found and -3 if the validation succeeded but
- * the content model is not determinist.
- */
-
-static int
-xmlValidateElementType(xmlValidCtxtPtr ctxt) {
- int ret = -1;
- int determinist = 1;
-
- NODE = xmlValidateSkipIgnorable(NODE);
- if ((NODE == NULL) && (CONT == NULL))
- return(1);
- if ((NODE == NULL) &&
- ((CONT->ocur == XML_ELEMENT_CONTENT_MULT) ||
- (CONT->ocur == XML_ELEMENT_CONTENT_OPT))) {
- return(1);
- }
- if (CONT == NULL) return(-1);
- if ((NODE != NULL) && (NODE->type == XML_ENTITY_REF_NODE))
- return(-2);
-
- /*
- * We arrive here when more states need to be examined
- */
-cont:
-
- /*
- * We just recovered from a rollback generated by a possible
- * epsilon transition, go directly to the analysis phase
- */
- if (STATE == ROLLBACK_PARENT) {
- DEBUG_VALID_MSG("restored parent branch");
- DEBUG_VALID_STATE(NODE, CONT)
- ret = 1;
- goto analyze;
- }
-
- DEBUG_VALID_STATE(NODE, CONT)
- /*
- * we may have to save a backup state here. This is the equivalent
- * of handling epsilon transition in NFAs.
- */
- if ((CONT != NULL) &&
- ((CONT->parent == NULL) ||
- (CONT->parent->type != XML_ELEMENT_CONTENT_OR)) &&
- ((CONT->ocur == XML_ELEMENT_CONTENT_MULT) ||
- (CONT->ocur == XML_ELEMENT_CONTENT_OPT) ||
- ((CONT->ocur == XML_ELEMENT_CONTENT_PLUS) && (OCCURRENCE)))) {
- DEBUG_VALID_MSG("saving parent branch");
- if (vstateVPush(ctxt, CONT, NODE, DEPTH, OCCURS, ROLLBACK_PARENT) < 0)
- return(0);
- }
-
-
- /*
- * Check first if the content matches
- */
- switch (CONT->type) {
- case XML_ELEMENT_CONTENT_PCDATA:
- if (NODE == NULL) {
- DEBUG_VALID_MSG("pcdata failed no node");
- ret = 0;
- break;
- }
- if (NODE->type == XML_TEXT_NODE) {
- DEBUG_VALID_MSG("pcdata found, skip to next");
- /*
- * go to next element in the content model
- * skipping ignorable elems
- */
- do {
- NODE = NODE->next;
- NODE = xmlValidateSkipIgnorable(NODE);
- if ((NODE != NULL) &&
- (NODE->type == XML_ENTITY_REF_NODE))
- return(-2);
- } while ((NODE != NULL) &&
- ((NODE->type != XML_ELEMENT_NODE) &&
- (NODE->type != XML_TEXT_NODE) &&
- (NODE->type != XML_CDATA_SECTION_NODE)));
- ret = 1;
- break;
- } else {
- DEBUG_VALID_MSG("pcdata failed");
- ret = 0;
- break;
- }
- break;
- case XML_ELEMENT_CONTENT_ELEMENT:
- if (NODE == NULL) {
- DEBUG_VALID_MSG("element failed no node");
- ret = 0;
- break;
- }
- ret = ((NODE->type == XML_ELEMENT_NODE) &&
- (xmlStrEqual(NODE->name, CONT->name)));
- if (ret == 1) {
- if ((NODE->ns == NULL) || (NODE->ns->prefix == NULL)) {
- ret = (CONT->prefix == NULL);
- } else if (CONT->prefix == NULL) {
- ret = 0;
- } else {
- ret = xmlStrEqual(NODE->ns->prefix, CONT->prefix);
- }
- }
- if (ret == 1) {
- DEBUG_VALID_MSG("element found, skip to next");
- /*
- * go to next element in the content model
- * skipping ignorable elems
- */
- do {
- NODE = NODE->next;
- NODE = xmlValidateSkipIgnorable(NODE);
- if ((NODE != NULL) &&
- (NODE->type == XML_ENTITY_REF_NODE))
- return(-2);
- } while ((NODE != NULL) &&
- ((NODE->type != XML_ELEMENT_NODE) &&
- (NODE->type != XML_TEXT_NODE) &&
- (NODE->type != XML_CDATA_SECTION_NODE)));
- } else {
- DEBUG_VALID_MSG("element failed");
- ret = 0;
- break;
- }
- break;
- case XML_ELEMENT_CONTENT_OR:
- /*
- * Small optimization.
- */
- if (CONT->c1->type == XML_ELEMENT_CONTENT_ELEMENT) {
- if ((NODE == NULL) ||
- (!xmlStrEqual(NODE->name, CONT->c1->name))) {
- DEPTH++;
- CONT = CONT->c2;
- goto cont;
- }
- if ((NODE->ns == NULL) || (NODE->ns->prefix == NULL)) {
- ret = (CONT->c1->prefix == NULL);
- } else if (CONT->c1->prefix == NULL) {
- ret = 0;
- } else {
- ret = xmlStrEqual(NODE->ns->prefix, CONT->c1->prefix);
- }
- if (ret == 0) {
- DEPTH++;
- CONT = CONT->c2;
- goto cont;
- }
- }
-
- /*
- * save the second branch 'or' branch
- */
- DEBUG_VALID_MSG("saving 'or' branch");
- if (vstateVPush(ctxt, CONT->c2, NODE, (unsigned char)(DEPTH + 1),
- OCCURS, ROLLBACK_OR) < 0)
- return(-1);
- DEPTH++;
- CONT = CONT->c1;
- goto cont;
- case XML_ELEMENT_CONTENT_SEQ:
- /*
- * Small optimization.
- */
- if ((CONT->c1->type == XML_ELEMENT_CONTENT_ELEMENT) &&
- ((CONT->c1->ocur == XML_ELEMENT_CONTENT_OPT) ||
- (CONT->c1->ocur == XML_ELEMENT_CONTENT_MULT))) {
- if ((NODE == NULL) ||
- (!xmlStrEqual(NODE->name, CONT->c1->name))) {
- DEPTH++;
- CONT = CONT->c2;
- goto cont;
- }
- if ((NODE->ns == NULL) || (NODE->ns->prefix == NULL)) {
- ret = (CONT->c1->prefix == NULL);
- } else if (CONT->c1->prefix == NULL) {
- ret = 0;
- } else {
- ret = xmlStrEqual(NODE->ns->prefix, CONT->c1->prefix);
- }
- if (ret == 0) {
- DEPTH++;
- CONT = CONT->c2;
- goto cont;
- }
- }
- DEPTH++;
- CONT = CONT->c1;
- goto cont;
- }
-
- /*
- * At this point handle going up in the tree
- */
- if (ret == -1) {
- DEBUG_VALID_MSG("error found returning");
- return(ret);
- }
-analyze:
- while (CONT != NULL) {
- /*
- * First do the analysis depending on the occurrence model at
- * this level.
- */
- if (ret == 0) {
- switch (CONT->ocur) {
- xmlNodePtr cur;
-
- case XML_ELEMENT_CONTENT_ONCE:
- cur = ctxt->vstate->node;
- DEBUG_VALID_MSG("Once branch failed, rollback");
- if (vstateVPop(ctxt) < 0 ) {
- DEBUG_VALID_MSG("exhaustion, failed");
- return(0);
- }
- if (cur != ctxt->vstate->node)
- determinist = -3;
- goto cont;
- case XML_ELEMENT_CONTENT_PLUS:
- if (OCCURRENCE == 0) {
- cur = ctxt->vstate->node;
- DEBUG_VALID_MSG("Plus branch failed, rollback");
- if (vstateVPop(ctxt) < 0 ) {
- DEBUG_VALID_MSG("exhaustion, failed");
- return(0);
- }
- if (cur != ctxt->vstate->node)
- determinist = -3;
- goto cont;
- }
- DEBUG_VALID_MSG("Plus branch found");
- ret = 1;
- break;
- case XML_ELEMENT_CONTENT_MULT:
-#ifdef DEBUG_VALID_ALGO
- if (OCCURRENCE == 0) {
- DEBUG_VALID_MSG("Mult branch failed");
- } else {
- DEBUG_VALID_MSG("Mult branch found");
- }
-#endif
- ret = 1;
- break;
- case XML_ELEMENT_CONTENT_OPT:
- DEBUG_VALID_MSG("Option branch failed");
- ret = 1;
- break;
- }
- } else {
- switch (CONT->ocur) {
- case XML_ELEMENT_CONTENT_OPT:
- DEBUG_VALID_MSG("Option branch succeeded");
- ret = 1;
- break;
- case XML_ELEMENT_CONTENT_ONCE:
- DEBUG_VALID_MSG("Once branch succeeded");
- ret = 1;
- break;
- case XML_ELEMENT_CONTENT_PLUS:
- if (STATE == ROLLBACK_PARENT) {
- DEBUG_VALID_MSG("Plus branch rollback");
- ret = 1;
- break;
- }
- if (NODE == NULL) {
- DEBUG_VALID_MSG("Plus branch exhausted");
- ret = 1;
- break;
- }
- DEBUG_VALID_MSG("Plus branch succeeded, continuing");
- SET_OCCURRENCE;
- goto cont;
- case XML_ELEMENT_CONTENT_MULT:
- if (STATE == ROLLBACK_PARENT) {
- DEBUG_VALID_MSG("Mult branch rollback");
- ret = 1;
- break;
- }
- if (NODE == NULL) {
- DEBUG_VALID_MSG("Mult branch exhausted");
- ret = 1;
- break;
- }
- DEBUG_VALID_MSG("Mult branch succeeded, continuing");
- /* SET_OCCURRENCE; */
- goto cont;
- }
- }
- STATE = 0;
-
- /*
- * Then act accordingly at the parent level
- */
- RESET_OCCURRENCE;
- if (CONT->parent == NULL)
- break;
-
- switch (CONT->parent->type) {
- case XML_ELEMENT_CONTENT_PCDATA:
- DEBUG_VALID_MSG("Error: parent pcdata");
- return(-1);
- case XML_ELEMENT_CONTENT_ELEMENT:
- DEBUG_VALID_MSG("Error: parent element");
- return(-1);
- case XML_ELEMENT_CONTENT_OR:
- if (ret == 1) {
- DEBUG_VALID_MSG("Or succeeded");
- CONT = CONT->parent;
- DEPTH--;
- } else {
- DEBUG_VALID_MSG("Or failed");
- CONT = CONT->parent;
- DEPTH--;
- }
- break;
- case XML_ELEMENT_CONTENT_SEQ:
- if (ret == 0) {
- DEBUG_VALID_MSG("Sequence failed");
- CONT = CONT->parent;
- DEPTH--;
- } else if (CONT == CONT->parent->c1) {
- DEBUG_VALID_MSG("Sequence testing 2nd branch");
- CONT = CONT->parent->c2;
- goto cont;
- } else {
- DEBUG_VALID_MSG("Sequence succeeded");
- CONT = CONT->parent;
- DEPTH--;
- }
- }
- }
- if (NODE != NULL) {
- xmlNodePtr cur;
-
- cur = ctxt->vstate->node;
- DEBUG_VALID_MSG("Failed, remaining input, rollback");
- if (vstateVPop(ctxt) < 0 ) {
- DEBUG_VALID_MSG("exhaustion, failed");
- return(0);
- }
- if (cur != ctxt->vstate->node)
- determinist = -3;
- goto cont;
- }
- if (ret == 0) {
- xmlNodePtr cur;
-
- cur = ctxt->vstate->node;
- DEBUG_VALID_MSG("Failure, rollback");
- if (vstateVPop(ctxt) < 0 ) {
- DEBUG_VALID_MSG("exhaustion, failed");
- return(0);
- }
- if (cur != ctxt->vstate->node)
- determinist = -3;
- goto cont;
- }
- return(determinist);
-}
-#endif
-
-/**
- * xmlSnprintfElements:
- * @buf: an output buffer
- * @size: the size of the buffer
- * @content: An element
- * @glob: 1 if one must print the englobing parenthesis, 0 otherwise
- *
- * This will dump the list of elements to the buffer
- * Intended just for the debug routine
- */
-static void
-xmlSnprintfElements(char *buf, int size, xmlNodePtr node, int glob) {
- xmlNodePtr cur;
- int len;
-
- if (node == NULL) return;
- if (glob) strcat(buf, "(");
- cur = node;
- while (cur != NULL) {
- len = strlen(buf);
- if (size - len < 50) {
- if ((size - len > 4) && (buf[len - 1] != '.'))
- strcat(buf, " ...");
- return;
- }
- switch (cur->type) {
- case XML_ELEMENT_NODE:
- if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
- if (size - len < xmlStrlen(cur->ns->prefix) + 10) {
- if ((size - len > 4) && (buf[len - 1] != '.'))
- strcat(buf, " ...");
- return;
- }
- strcat(buf, (char *) cur->ns->prefix);
- strcat(buf, ":");
- }
- if (size - len < xmlStrlen(cur->name) + 10) {
- if ((size - len > 4) && (buf[len - 1] != '.'))
- strcat(buf, " ...");
- return;
- }
- strcat(buf, (char *) cur->name);
- if (cur->next != NULL)
- strcat(buf, " ");
- break;
- case XML_TEXT_NODE:
- if (xmlIsBlankNode(cur))
- break;
- case XML_CDATA_SECTION_NODE:
- case XML_ENTITY_REF_NODE:
- strcat(buf, "CDATA");
- if (cur->next != NULL)
- strcat(buf, " ");
- break;
- case XML_ATTRIBUTE_NODE:
- case XML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- case XML_HTML_DOCUMENT_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_NOTATION_NODE:
- case XML_NAMESPACE_DECL:
- strcat(buf, "???");
- if (cur->next != NULL)
- strcat(buf, " ");
- break;
- case XML_ENTITY_NODE:
- case XML_PI_NODE:
- case XML_DTD_NODE:
- case XML_COMMENT_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- break;
- }
- cur = cur->next;
- }
- if (glob) strcat(buf, ")");
-}
-
-/**
- * xmlValidateElementContent:
- * @ctxt: the validation context
- * @child: the child list
- * @elemDecl: pointer to the element declaration
- * @warn: emit the error message
- * @parent: the parent element (for error reporting)
- *
- * Try to validate the content model of an element
- *
- * returns 1 if valid or 0 if not and -1 in case of error
- */
-
-static int
-xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child,
- xmlElementPtr elemDecl, int warn, xmlNodePtr parent) {
- int ret = 1;
-#ifndef LIBXML_REGEXP_ENABLED
- xmlNodePtr repl = NULL, last = NULL, tmp;
-#endif
- xmlNodePtr cur;
- xmlElementContentPtr cont;
- const xmlChar *name;
-
- if (elemDecl == NULL)
- return(-1);
- cont = elemDecl->content;
- name = elemDecl->name;
-
-#ifdef LIBXML_REGEXP_ENABLED
- /* Build the regexp associated to the content model */
- if (elemDecl->contModel == NULL)
- ret = xmlValidBuildContentModel(ctxt, elemDecl);
- if (elemDecl->contModel == NULL) {
- ret = -1;
- } else {
- xmlRegExecCtxtPtr exec;
-
- ctxt->nodeMax = 0;
- ctxt->nodeNr = 0;
- ctxt->nodeTab = NULL;
- exec = xmlRegNewExecCtxt(elemDecl->contModel, NULL, NULL);
- if (exec != NULL) {
- cur = child;
- while (cur != NULL) {
- switch (cur->type) {
- case XML_ENTITY_REF_NODE:
- /*
- * Push the current node to be able to roll back
- * and process within the entity
- */
- if ((cur->children != NULL) &&
- (cur->children->children != NULL)) {
- nodeVPush(ctxt, cur);
- cur = cur->children->children;
- continue;
- }
- break;
- case XML_TEXT_NODE:
- if (xmlIsBlankNode(cur))
- break;
- ret = 0;
- goto fail;
- case XML_CDATA_SECTION_NODE:
- TODO
- ret = 0;
- goto fail;
- case XML_ELEMENT_NODE:
- if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
- xmlChar *QName;
- int len;
-
- len = xmlStrlen(cur->name) +
- xmlStrlen(cur->ns->prefix) + 2;
- QName = xmlMalloc(len);
- if (QName == NULL) {
- ret = -1;
- goto fail;
- }
- snprintf((char *) QName, len, "%s:%s",
- (char *)cur->ns->prefix,
- (char *)cur->name);
- ret = xmlRegExecPushString(exec, QName, NULL);
- xmlFree(QName);
- } else {
- ret = xmlRegExecPushString(exec, cur->name, NULL);
- }
- break;
- default:
- break;
- }
- /*
- * Switch to next element
- */
- cur = cur->next;
- while (cur == NULL) {
- cur = nodeVPop(ctxt);
- if (cur == NULL)
- break;
- cur = cur->next;
- }
- }
- ret = xmlRegExecPushString(exec, NULL, NULL);
-fail:
- xmlRegFreeExecCtxt(exec);
- }
- }
-#else /* LIBXML_REGEXP_ENABLED */
- /*
- * Allocate the stack
- */
- ctxt->vstateMax = 8;
- ctxt->vstateTab = (xmlValidState *) xmlMalloc(
- ctxt->vstateMax * sizeof(ctxt->vstateTab[0]));
- if (ctxt->vstateTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc failed !n");
- return(-1);
- }
- /*
- * The first entry in the stack is reserved to the current state
- */
- ctxt->nodeMax = 0;
- ctxt->nodeNr = 0;
- ctxt->nodeTab = NULL;
- ctxt->vstate = &ctxt->vstateTab[0];
- ctxt->vstateNr = 1;
- CONT = cont;
- NODE = child;
- DEPTH = 0;
- OCCURS = 0;
- STATE = 0;
- ret = xmlValidateElementType(ctxt);
- if ((ret == -3) && (warn)) {
- VWARNING(ctxt->userData,
- "Content model for Element %s is ambiguous\n", name);
- } else if (ret == -2) {
- /*
- * An entities reference appeared at this level.
- * Buid a minimal representation of this node content
- * sufficient to run the validation process on it
- */
- DEBUG_VALID_MSG("Found an entity reference, linearizing");
- cur = child;
- while (cur != NULL) {
- switch (cur->type) {
- case XML_ENTITY_REF_NODE:
- /*
- * Push the current node to be able to roll back
- * and process within the entity
- */
- if ((cur->children != NULL) &&
- (cur->children->children != NULL)) {
- nodeVPush(ctxt, cur);
- cur = cur->children->children;
- continue;
- }
- break;
- case XML_TEXT_NODE:
- if (xmlIsBlankNode(cur))
- break;
- /* no break on purpose */
- case XML_CDATA_SECTION_NODE:
- /* no break on purpose */
- case XML_ELEMENT_NODE:
- /*
- * Allocate a new node and minimally fills in
- * what's required
- */
- tmp = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
- if (tmp == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlValidateElementContent : malloc failed\n");
- xmlFreeNodeList(repl);
- ret = -1;
- goto done;
- }
- tmp->type = cur->type;
- tmp->name = cur->name;
- tmp->ns = cur->ns;
- tmp->next = NULL;
- tmp->content = NULL;
- if (repl == NULL)
- repl = last = tmp;
- else {
- last->next = tmp;
- last = tmp;
- }
- if (cur->type == XML_CDATA_SECTION_NODE) {
- /*
- * E59 spaces in CDATA does not match the
- * nonterminal S
- */
- tmp->content = xmlStrdup(BAD_CAST "CDATA");
- }
- break;
- default:
- break;
- }
- /*
- * Switch to next element
- */
- cur = cur->next;
- while (cur == NULL) {
- cur = nodeVPop(ctxt);
- if (cur == NULL)
- break;
- cur = cur->next;
- }
- }
-
- /*
- * Relaunch the validation
- */
- ctxt->vstate = &ctxt->vstateTab[0];
- ctxt->vstateNr = 1;
- CONT = cont;
- NODE = repl;
- DEPTH = 0;
- OCCURS = 0;
- STATE = 0;
- ret = xmlValidateElementType(ctxt);
- }
-#endif /* LIBXML_REGEXP_ENABLED */
- if ((warn) && ((ret != 1) && (ret != -3))) {
- if ((ctxt != NULL) && (ctxt->warning != NULL)) {
- char expr[5000];
- char list[5000];
-
- expr[0] = 0;
- xmlSnprintfElementContent(expr, 5000, cont, 1);
- list[0] = 0;
-#ifndef LIBXML_REGEXP_ENABLED
- if (repl != NULL)
- xmlSnprintfElements(list, 5000, repl, 1);
- else
-#endif /* LIBXML_REGEXP_ENABLED */
- xmlSnprintfElements(list, 5000, child, 1);
-
- if (name != NULL) {
- if (parent != NULL) VECTXT(ctxt, parent);
- VERROR(ctxt->userData,
- "Element %s content does not follow the DTD\nExpecting %s, got %s\n",
- name, expr, list);
- } else {
- if (parent != NULL) VECTXT(ctxt, parent);
- VERROR(ctxt->userData,
- "Element content does not follow the DTD\nExpecting %s, got %s\n",
- expr, list);
- }
- } else {
- if (name != NULL) {
- if (parent != NULL) VECTXT(ctxt, parent);
- VERROR(ctxt->userData,
- "Element %s content does not follow the DTD\n",
- name);
- } else {
- if (parent != NULL) VECTXT(ctxt, parent);
- VERROR(ctxt->userData,
- "Element content does not follow the DTD\n");
- }
- }
- ret = 0;
- }
- if (ret == -3)
- ret = 1;
-
-#ifndef LIBXML_REGEXP_ENABLED
-done:
- /*
- * Deallocate the copy if done, and free up the validation stack
- */
- while (repl != NULL) {
- tmp = repl->next;
- xmlFree(repl);
- repl = tmp;
- }
- ctxt->vstateMax = 0;
- if (ctxt->vstateTab != NULL) {
- xmlFree(ctxt->vstateTab);
- ctxt->vstateTab = NULL;
- }
-#endif
- ctxt->nodeMax = 0;
- ctxt->nodeNr = 0;
- if (ctxt->nodeTab != NULL) {
- xmlFree(ctxt->nodeTab);
- ctxt->nodeTab = NULL;
- }
- return(ret);
-
-}
-
-/**
- * xmlValidateCdataElement:
- * @ctxt: the validation context
- * @doc: a document instance
- * @elem: an element instance
- *
- * Check that an element follows #CDATA
- *
- * returns 1 if valid or 0 otherwise
- */
-static int
-xmlValidateOneCdataElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
- xmlNodePtr elem) {
- int ret = 1;
- xmlNodePtr cur, child;
-
- if ((ctxt == NULL) || (doc == NULL) || (elem == NULL))
- return(0);
-
- child = elem->children;
-
- cur = child;
- while (cur != NULL) {
- switch (cur->type) {
- case XML_ENTITY_REF_NODE:
- /*
- * Push the current node to be able to roll back
- * and process within the entity
- */
- if ((cur->children != NULL) &&
- (cur->children->children != NULL)) {
- nodeVPush(ctxt, cur);
- cur = cur->children->children;
- continue;
- }
- break;
- case XML_COMMENT_NODE:
- case XML_PI_NODE:
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- break;
- default:
- ret = 0;
- goto done;
- }
- /*
- * Switch to next element
- */
- cur = cur->next;
- while (cur == NULL) {
- cur = nodeVPop(ctxt);
- if (cur == NULL)
- break;
- cur = cur->next;
- }
- }
-done:
- ctxt->nodeMax = 0;
- ctxt->nodeNr = 0;
- if (ctxt->nodeTab != NULL) {
- xmlFree(ctxt->nodeTab);
- ctxt->nodeTab = NULL;
- }
- return(ret);
-}
-
-/**
- * xmlValidateOneElement:
- * @ctxt: the validation context
- * @doc: a document instance
- * @elem: an element instance
- *
- * Try to validate a single element and it's attributes,
- * basically it does the following checks as described by the
- * XML-1.0 recommendation:
- * - [ VC: Element Valid ]
- * - [ VC: Required Attribute ]
- * Then call xmlValidateOneAttribute() for each attribute present.
- *
- * The ID/IDREF checkings are done separately
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
- xmlNodePtr elem) {
- xmlElementPtr elemDecl = NULL;
- xmlElementContentPtr cont;
- xmlAttributePtr attr;
- xmlNodePtr child;
- int ret = 1, tmp;
- const xmlChar *name;
- const xmlChar *prefix = NULL;
- int extsubset = 0;
-
- CHECK_DTD;
-
- if (elem == NULL) return(0);
- switch (elem->type) {
- case XML_ATTRIBUTE_NODE:
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Attribute element not expected here\n");
- return(0);
- case XML_TEXT_NODE:
- if (elem->children != NULL) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData, "Text element has childs !\n");
- return(0);
- }
- if (elem->properties != NULL) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData, "Text element has attributes !\n");
- return(0);
- }
- if (elem->ns != NULL) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData, "Text element has namespace !\n");
- return(0);
- }
- if (elem->nsDef != NULL) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Text element carries namespace definitions !\n");
- return(0);
- }
- if (elem->content == NULL) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Text element has no content !\n");
- return(0);
- }
- return(1);
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- return(1);
- case XML_CDATA_SECTION_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- return(1);
- case XML_ENTITY_NODE:
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Entity element not expected here\n");
- return(0);
- case XML_NOTATION_NODE:
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Notation element not expected here\n");
- return(0);
- case XML_DOCUMENT_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Document element not expected here\n");
- return(0);
- case XML_HTML_DOCUMENT_NODE:
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "\n");
- return(0);
- case XML_ELEMENT_NODE:
- break;
- default:
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "unknown element type %d\n", elem->type);
- return(0);
- }
- if (elem->name == NULL) return(0);
-
- /*
- * Fetch the declaration for the qualified name
- */
- if ((elem->ns != NULL) && (elem->ns->prefix != NULL))
- prefix = elem->ns->prefix;
-
- if (prefix != NULL) {
- elemDecl = xmlGetDtdQElementDesc(doc->intSubset,
- elem->name, prefix);
- if ((elemDecl == NULL) && (doc->extSubset != NULL)) {
- elemDecl = xmlGetDtdQElementDesc(doc->extSubset,
- elem->name, prefix);
- if (elemDecl != NULL)
- extsubset = 1;
- }
- }
-
- /*
- * Fetch the declaration for the non qualified name
- * This is "non-strict" validation should be done on the
- * full QName but in that case being flexible makes sense.
- */
- if (elemDecl == NULL) {
- elemDecl = xmlGetDtdElementDesc(doc->intSubset, elem->name);
- if ((elemDecl == NULL) && (doc->extSubset != NULL)) {
- elemDecl = xmlGetDtdElementDesc(doc->extSubset, elem->name);
- if (elemDecl != NULL)
- extsubset = 1;
- }
- }
- if (elemDecl == NULL) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData, "No declaration for element %s\n",
- elem->name);
- return(0);
- }
-
- /* Check that the element content matches the definition */
- switch (elemDecl->etype) {
- case XML_ELEMENT_TYPE_UNDEFINED:
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData, "No declaration for element %s\n",
- elem->name);
- return(0);
- case XML_ELEMENT_TYPE_EMPTY:
- if (elem->children != NULL) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Element %s was declared EMPTY this one has content\n",
- elem->name);
- ret = 0;
- }
- break;
- case XML_ELEMENT_TYPE_ANY:
- /* I don't think anything is required then */
- break;
- case XML_ELEMENT_TYPE_MIXED:
-
- /* simple case of declared as #PCDATA */
- if ((elemDecl->content != NULL) &&
- (elemDecl->content->type == XML_ELEMENT_CONTENT_PCDATA)) {
- ret = xmlValidateOneCdataElement(ctxt, doc, elem);
- if (!ret) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Element %s was declared #PCDATA but contains non text nodes\n",
- elem->name);
- }
- break;
- }
- child = elem->children;
- /* Hum, this start to get messy */
- while (child != NULL) {
- if (child->type == XML_ELEMENT_NODE) {
- name = child->name;
- if ((child->ns != NULL) && (child->ns->prefix != NULL)) {
- xmlChar qname[500];
- snprintf((char *) qname, sizeof(qname), "%s:%s",
- child->ns->prefix, child->name);
- qname[sizeof(qname) - 1] = 0;
- cont = elemDecl->content;
- while (cont != NULL) {
- if (cont->type == XML_ELEMENT_CONTENT_ELEMENT) {
- if (xmlStrEqual(cont->name, qname)) break;
- } else if ((cont->type == XML_ELEMENT_CONTENT_OR) &&
- (cont->c1 != NULL) &&
- (cont->c1->type == XML_ELEMENT_CONTENT_ELEMENT)){
- if (xmlStrEqual(cont->c1->name, qname)) break;
- } else if ((cont->type != XML_ELEMENT_CONTENT_OR) ||
- (cont->c1 == NULL) ||
- (cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){
- /* Internal error !!! */
- xmlGenericError(xmlGenericErrorContext,
- "Internal: MIXED struct bad\n");
- break;
- }
- cont = cont->c2;
- }
- if (cont != NULL)
- goto child_ok;
- }
- cont = elemDecl->content;
- while (cont != NULL) {
- if (cont->type == XML_ELEMENT_CONTENT_ELEMENT) {
- if (xmlStrEqual(cont->name, name)) break;
- } else if ((cont->type == XML_ELEMENT_CONTENT_OR) &&
- (cont->c1 != NULL) &&
- (cont->c1->type == XML_ELEMENT_CONTENT_ELEMENT)) {
- if (xmlStrEqual(cont->c1->name, name)) break;
- } else if ((cont->type != XML_ELEMENT_CONTENT_OR) ||
- (cont->c1 == NULL) ||
- (cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)) {
- /* Internal error !!! */
- xmlGenericError(xmlGenericErrorContext,
- "Internal: MIXED struct bad\n");
- break;
- }
- cont = cont->c2;
- }
- if (cont == NULL) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Element %s is not declared in %s list of possible children\n",
- name, elem->name);
- ret = 0;
- }
- }
-child_ok:
- child = child->next;
- }
- break;
- case XML_ELEMENT_TYPE_ELEMENT:
- if ((doc->standalone == 1) && (extsubset == 1)) {
- /*
- * VC: Standalone Document Declaration
- * - element types with element content, if white space
- * occurs directly within any instance of those types.
- */
- child = elem->children;
- while (child != NULL) {
- if (child->type == XML_TEXT_NODE) {
- const xmlChar *content = child->content;
-
- while (IS_BLANK(*content))
- content++;
- if (*content == 0) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
-"standalone: %s declared in the external subset contains white spaces nodes\n",
- elem->name);
- ret = 0;
- break;
- }
- }
- child =child->next;
- }
- }
- child = elem->children;
- cont = elemDecl->content;
- tmp = xmlValidateElementContent(ctxt, child, elemDecl, 1, elem);
- if (tmp <= 0)
- ret = tmp;
- break;
- }
-
- /* [ VC: Required Attribute ] */
- attr = elemDecl->attributes;
- while (attr != NULL) {
- if (attr->def == XML_ATTRIBUTE_REQUIRED) {
- int qualified = -1;
-
- if ((attr->prefix == NULL) &&
- (xmlStrEqual(attr->name, BAD_CAST "xmlns"))) {
- xmlNsPtr ns;
-
- ns = elem->nsDef;
- while (ns != NULL) {
- if (ns->prefix == NULL)
- goto found;
- ns = ns->next;
- }
- } else if (xmlStrEqual(attr->prefix, BAD_CAST "xmlns")) {
- xmlNsPtr ns;
-
- ns = elem->nsDef;
- while (ns != NULL) {
- if (xmlStrEqual(attr->name, ns->prefix))
- goto found;
- ns = ns->next;
- }
- } else {
- xmlAttrPtr attrib;
-
- attrib = elem->properties;
- while (attrib != NULL) {
- if (xmlStrEqual(attrib->name, attr->name)) {
- if (attr->prefix != NULL) {
- xmlNsPtr nameSpace = attrib->ns;
-
- if (nameSpace == NULL)
- nameSpace = elem->ns;
- /*
- * qualified names handling is problematic, having a
- * different prefix should be possible but DTDs don't
- * allow to define the URI instead of the prefix :-(
- */
- if (nameSpace == NULL) {
- if (qualified < 0)
- qualified = 0;
- } else if (!xmlStrEqual(nameSpace->prefix,
- attr->prefix)) {
- if (qualified < 1)
- qualified = 1;
- } else
- goto found;
- } else {
- /*
- * We should allow applications to define namespaces
- * for their application even if the DTD doesn't
- * carry one, otherwise, basically we would always
- * break.
- */
- goto found;
- }
- }
- attrib = attrib->next;
- }
- }
- if (qualified == -1) {
- if (attr->prefix == NULL) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Element %s does not carry attribute %s\n",
- elem->name, attr->name);
- ret = 0;
- } else {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Element %s does not carry attribute %s:%s\n",
- elem->name, attr->prefix,attr->name);
- ret = 0;
- }
- } else if (qualified == 0) {
- VWARNING(ctxt->userData,
- "Element %s required attribute %s:%s has no prefix\n",
- elem->name, attr->prefix,attr->name);
- } else if (qualified == 1) {
- VWARNING(ctxt->userData,
- "Element %s required attribute %s:%s has different prefix\n",
- elem->name, attr->prefix,attr->name);
- }
- } else if (attr->def == XML_ATTRIBUTE_FIXED) {
- /*
- * Special tests checking #FIXED namespace declarations
- * have the right value since this is not done as an
- * attribute checking
- */
- if ((attr->prefix == NULL) &&
- (xmlStrEqual(attr->name, BAD_CAST "xmlns"))) {
- xmlNsPtr ns;
-
- ns = elem->nsDef;
- while (ns != NULL) {
- if (ns->prefix == NULL) {
- if (!xmlStrEqual(attr->defaultValue, ns->href)) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Element %s namespace name for default namespace does not match the DTD\n",
- elem->name);
- ret = 0;
- }
- goto found;
- }
- ns = ns->next;
- }
- } else if (xmlStrEqual(attr->prefix, BAD_CAST "xmlns")) {
- xmlNsPtr ns;
-
- ns = elem->nsDef;
- while (ns != NULL) {
- if (xmlStrEqual(attr->name, ns->prefix)) {
- if (!xmlStrEqual(attr->defaultValue, ns->href)) {
- VECTXT(ctxt, elem);
- VERROR(ctxt->userData,
- "Element %s namespace name for %s does not match the DTD\n",
- elem->name, ns->prefix);
- ret = 0;
- }
- goto found;
- }
- ns = ns->next;
- }
- }
- }
-found:
- attr = attr->nexth;
- }
- return(ret);
-}
-
-/**
- * xmlValidateRoot:
- * @ctxt: the validation context
- * @doc: a document instance
- *
- * Try to validate a the root element
- * basically it does the following check as described by the
- * XML-1.0 recommendation:
- * - [ VC: Root Element Type ]
- * it doesn't try to recurse or apply other check to the element
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateRoot(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
- xmlNodePtr root;
- if (doc == NULL) return(0);
-
- root = xmlDocGetRootElement(doc);
- if ((root == NULL) || (root->name == NULL)) {
- VERROR(ctxt->userData, "Not valid: no root element\n");
- return(0);
- }
-
- /*
- * When doing post validation against a separate DTD, those may
- * no internal subset has been generated
- */
- if ((doc->intSubset != NULL) &&
- (doc->intSubset->name != NULL)) {
- /*
- * Check first the document root against the NQName
- */
- if (!xmlStrEqual(doc->intSubset->name, root->name)) {
- if ((root->ns != NULL) && (root->ns->prefix != NULL)) {
- xmlChar qname[500];
- snprintf((char *) qname, sizeof(qname), "%s:%s",
- root->ns->prefix, root->name);
- qname[sizeof(qname) - 1] = 0;
- if (xmlStrEqual(doc->intSubset->name, qname))
- goto name_ok;
- }
- if ((xmlStrEqual(doc->intSubset->name, BAD_CAST "HTML")) &&
- (xmlStrEqual(root->name, BAD_CAST "html")))
- goto name_ok;
- VECTXT(ctxt, root);
- VERROR(ctxt->userData,
- "Not valid: root and DTD name do not match '%s' and '%s'\n",
- root->name, doc->intSubset->name);
- return(0);
-
- }
- }
-name_ok:
- return(1);
-}
-
-
-/**
- * xmlValidateElement:
- * @ctxt: the validation context
- * @doc: a document instance
- * @elem: an element instance
- *
- * Try to validate the subtree under an element
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem) {
- xmlNodePtr child;
- xmlAttrPtr attr;
- xmlChar *value;
- int ret = 1;
-
- if (elem == NULL) return(0);
-
- /*
- * XInclude elements were added after parsing in the infoset,
- * they don't really mean anything validation wise.
- */
- if ((elem->type == XML_XINCLUDE_START) ||
- (elem->type == XML_XINCLUDE_END))
- return(1);
-
- CHECK_DTD;
-
- /*
- * Entities references have to be handled separately
- */
- if (elem->type == XML_ENTITY_REF_NODE) {
- return(1);
- }
-
- ret &= xmlValidateOneElement(ctxt, doc, elem);
- attr = elem->properties;
- while(attr != NULL) {
- value = xmlNodeListGetString(doc, attr->children, 0);
- ret &= xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
- if (value != NULL)
- xmlFree(value);
- attr= attr->next;
- }
- child = elem->children;
- while (child != NULL) {
- ret &= xmlValidateElement(ctxt, doc, child);
- child = child->next;
- }
-
- return(ret);
-}
-
-/**
- * xmlValidateRef:
- * @ref: A reference to be validated
- * @ctxt: Validation context
- * @name: Name of ID we are searching for
- *
- */
-static void
-xmlValidateRef(xmlRefPtr ref, xmlValidCtxtPtr ctxt,
- const xmlChar *name) {
- xmlAttrPtr id;
- xmlAttrPtr attr;
-
- if (ref == NULL)
- return;
- attr = ref->attr;
- if (attr == NULL)
- return;
- if (attr->atype == XML_ATTRIBUTE_IDREF) {
- id = xmlGetID(ctxt->doc, name);
- if (id == NULL) {
- VECTXT(ctxt, attr->parent);
- VERROR(ctxt->userData,
- "IDREF attribute %s references an unknown ID \"%s\"\n",
- attr->name, name);
- ctxt->valid = 0;
- }
- } else if (attr->atype == XML_ATTRIBUTE_IDREFS) {
- xmlChar *dup, *str = NULL, *cur, save;
-
- dup = xmlStrdup(name);
- if (dup == NULL) {
- ctxt->valid = 0;
- return;
- }
- cur = dup;
- while (*cur != 0) {
- str = cur;
- while ((*cur != 0) && (!IS_BLANK(*cur))) cur++;
- save = *cur;
- *cur = 0;
- id = xmlGetID(ctxt->doc, str);
- if (id == NULL) {
- VECTXT(ctxt, attr->parent);
- VERROR(ctxt->userData,
- "IDREFS attribute %s references an unknown ID \"%s\"\n",
- attr->name, str);
- ctxt->valid = 0;
- }
- if (save == 0)
- break;
- *cur = save;
- while (IS_BLANK(*cur)) cur++;
- }
- xmlFree(dup);
- }
-}
-
-/**
- * xmlWalkValidateList:
- * @data: Contents of current link
- * @user: Value supplied by the user
- *
- * Returns 0 to abort the walk or 1 to continue
- */
-static int
-xmlWalkValidateList(const void *data, const void *user)
-{
- xmlValidateMemoPtr memo = (xmlValidateMemoPtr)user;
- xmlValidateRef((xmlRefPtr)data, memo->ctxt, memo->name);
- return 1;
-}
-
-/**
- * xmlValidateCheckRefCallback:
- * @ref_list: List of references
- * @ctxt: Validation context
- * @name: Name of ID we are searching for
- *
- */
-static void
-xmlValidateCheckRefCallback(xmlListPtr ref_list, xmlValidCtxtPtr ctxt,
- const xmlChar *name) {
- xmlValidateMemo memo;
-
- if (ref_list == NULL)
- return;
- memo.ctxt = ctxt;
- memo.name = name;
-
- xmlListWalk(ref_list, xmlWalkValidateList, &memo);
-
-}
-
-/**
- * xmlValidateDocumentFinal:
- * @ctxt: the validation context
- * @doc: a document instance
- *
- * Does the final step for the document validation once all the
- * incremental validation steps have been completed
- *
- * basically it does the following checks described by the XML Rec
- *
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
- xmlRefTablePtr table;
-
- if (doc == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlValidateDocumentFinal: doc == NULL\n");
- return(0);
- }
-
- /*
- * Check all the NOTATION/NOTATIONS attributes
- */
- /*
- * Check all the ENTITY/ENTITIES attributes definition for validity
- */
- /*
- * Check all the IDREF/IDREFS attributes definition for validity
- */
- table = (xmlRefTablePtr) doc->refs;
- ctxt->doc = doc;
- ctxt->valid = 1;
- xmlHashScan(table, (xmlHashScanner) xmlValidateCheckRefCallback, ctxt);
- return(ctxt->valid);
-}
-
-/**
- * xmlValidateDtd:
- * @ctxt: the validation context
- * @doc: a document instance
- * @dtd: a dtd instance
- *
- * Try to validate the document against the dtd instance
- *
- * basically it does check all the definitions in the DtD.
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateDtd(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlDtdPtr dtd) {
- int ret;
- xmlDtdPtr oldExt;
- xmlNodePtr root;
-
- if (dtd == NULL) return(0);
- if (doc == NULL) return(0);
- oldExt = doc->extSubset;
- doc->extSubset = dtd;
- ret = xmlValidateRoot(ctxt, doc);
- if (ret == 0) {
- doc->extSubset = oldExt;
- return(ret);
- }
- if (doc->ids != NULL) {
- xmlFreeIDTable(doc->ids);
- doc->ids = NULL;
- }
- if (doc->refs != NULL) {
- xmlFreeRefTable(doc->refs);
- doc->refs = NULL;
- }
- root = xmlDocGetRootElement(doc);
- ret = xmlValidateElement(ctxt, doc, root);
- ret &= xmlValidateDocumentFinal(ctxt, doc);
- doc->extSubset = oldExt;
- return(ret);
-}
-
-static void
-xmlValidateNotationCallback(xmlEntityPtr cur, xmlValidCtxtPtr ctxt,
- const xmlChar *name ATTRIBUTE_UNUSED) {
- if (cur == NULL)
- return;
- if (cur->etype == XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
- xmlChar *notation = cur->content;
-
- if (notation != NULL) {
- int ret;
-
- ret = xmlValidateNotationUse(ctxt, cur->doc, notation);
- if (ret != 1) {
- ctxt->valid = 0;
- }
- }
- }
-}
-
-static void
-xmlValidateAttributeCallback(xmlAttributePtr cur, xmlValidCtxtPtr ctxt,
- const xmlChar *name ATTRIBUTE_UNUSED) {
- int ret;
- xmlDocPtr doc;
- xmlElementPtr elem;
-
- if (cur == NULL)
- return;
- switch (cur->atype) {
- case XML_ATTRIBUTE_CDATA:
- case XML_ATTRIBUTE_ID:
- case XML_ATTRIBUTE_IDREF :
- case XML_ATTRIBUTE_IDREFS:
- case XML_ATTRIBUTE_NMTOKEN:
- case XML_ATTRIBUTE_NMTOKENS:
- case XML_ATTRIBUTE_ENUMERATION:
- break;
- case XML_ATTRIBUTE_ENTITY:
- case XML_ATTRIBUTE_ENTITIES:
- case XML_ATTRIBUTE_NOTATION:
- if (cur->defaultValue != NULL) {
-
- ret = xmlValidateAttributeValue2(ctxt, ctxt->doc, cur->name,
- cur->atype, cur->defaultValue);
- if ((ret == 0) && (ctxt->valid == 1))
- ctxt->valid = 0;
- }
- if (cur->tree != NULL) {
- xmlEnumerationPtr tree = cur->tree;
- while (tree != NULL) {
- ret = xmlValidateAttributeValue2(ctxt, ctxt->doc,
- cur->name, cur->atype, tree->name);
- if ((ret == 0) && (ctxt->valid == 1))
- ctxt->valid = 0;
- tree = tree->next;
- }
- }
- }
- if (cur->atype == XML_ATTRIBUTE_NOTATION) {
- doc = cur->doc;
- if ((doc == NULL) || (cur->elem == NULL)) {
- VERROR(ctxt->userData,
- "xmlValidateAttributeCallback(%s): internal error\n",
- cur->name);
- return;
- }
- elem = xmlGetDtdElementDesc(doc->intSubset, cur->elem);
- if (elem == NULL)
- elem = xmlGetDtdElementDesc(doc->extSubset, cur->elem);
- if (elem == NULL) {
- VERROR(ctxt->userData,
- "attribute %s: could not find decl for element %s\n",
- cur->name, cur->elem);
- return;
- }
- if (elem->etype == XML_ELEMENT_TYPE_EMPTY) {
- VERROR(ctxt->userData,
- "NOTATION attribute %s declared for EMPTY element %s\n",
- cur->name, cur->elem);
- ctxt->valid = 0;
- }
- }
-}
-
-/**
- * xmlValidateDtdFinal:
- * @ctxt: the validation context
- * @doc: a document instance
- *
- * Does the final step for the dtds validation once all the
- * subsets have been parsed
- *
- * basically it does the following checks described by the XML Rec
- * - check that ENTITY and ENTITIES type attributes default or
- * possible values matches one of the defined entities.
- * - check that NOTATION type attributes default or
- * possible values matches one of the defined notations.
- *
- * returns 1 if valid or 0 if invalid and -1 if not well-formed
- */
-
-int
-xmlValidateDtdFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
- xmlDtdPtr dtd;
- xmlAttributeTablePtr table;
- xmlEntitiesTablePtr entities;
-
- if (doc == NULL) return(0);
- if ((doc->intSubset == NULL) && (doc->extSubset == NULL))
- return(0);
- ctxt->doc = doc;
- ctxt->valid = 1;
- dtd = doc->intSubset;
- if ((dtd != NULL) && (dtd->attributes != NULL)) {
- table = (xmlAttributeTablePtr) dtd->attributes;
- xmlHashScan(table, (xmlHashScanner) xmlValidateAttributeCallback, ctxt);
- }
- if ((dtd != NULL) && (dtd->entities != NULL)) {
- entities = (xmlEntitiesTablePtr) dtd->entities;
- xmlHashScan(entities, (xmlHashScanner) xmlValidateNotationCallback,
- ctxt);
- }
- dtd = doc->extSubset;
- if ((dtd != NULL) && (dtd->attributes != NULL)) {
- table = (xmlAttributeTablePtr) dtd->attributes;
- xmlHashScan(table, (xmlHashScanner) xmlValidateAttributeCallback, ctxt);
- }
- if ((dtd != NULL) && (dtd->entities != NULL)) {
- entities = (xmlEntitiesTablePtr) dtd->entities;
- xmlHashScan(entities, (xmlHashScanner) xmlValidateNotationCallback,
- ctxt);
- }
- return(ctxt->valid);
-}
-
-/**
- * xmlValidateDocument:
- * @ctxt: the validation context
- * @doc: a document instance
- *
- * Try to validate the document instance
- *
- * basically it does the all the checks described by the XML Rec
- * i.e. validates the internal and external subset (if present)
- * and validate the document tree.
- *
- * returns 1 if valid or 0 otherwise
- */
-
-int
-xmlValidateDocument(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
- int ret;
- xmlNodePtr root;
-
- if ((doc->intSubset == NULL) && (doc->extSubset == NULL)) {
- VERROR(ctxt->userData, "no DTD found!\n" );
- return(0);
- }
- if ((doc->intSubset != NULL) && ((doc->intSubset->SystemID != NULL) ||
- (doc->intSubset->ExternalID != NULL)) && (doc->extSubset == NULL)) {
- doc->extSubset = xmlParseDTD(doc->intSubset->ExternalID,
- doc->intSubset->SystemID);
- if (doc->extSubset == NULL) {
- if (doc->intSubset->SystemID != NULL) {
- VERROR(ctxt->userData,
- "Could not load the external subset \"%s\"\n",
- doc->intSubset->SystemID);
- } else {
- VERROR(ctxt->userData,
- "Could not load the external subset \"%s\"\n",
- doc->intSubset->ExternalID);
- }
- return(0);
- }
- }
-
- if (doc->ids != NULL) {
- xmlFreeIDTable(doc->ids);
- doc->ids = NULL;
- }
- if (doc->refs != NULL) {
- xmlFreeRefTable(doc->refs);
- doc->refs = NULL;
- }
- ret = xmlValidateDtdFinal(ctxt, doc);
- if (!xmlValidateRoot(ctxt, doc)) return(0);
-
- root = xmlDocGetRootElement(doc);
- ret &= xmlValidateElement(ctxt, doc, root);
- ret &= xmlValidateDocumentFinal(ctxt, doc);
- return(ret);
-}
-
-
-/************************************************************************
- * *
- * Routines for dynamic validation editing *
- * *
- ************************************************************************/
-
-/**
- * xmlValidGetPotentialChildren:
- * @ctree: an element content tree
- * @list: an array to store the list of child names
- * @len: a pointer to the number of element in the list
- * @max: the size of the array
- *
- * Build/extend a list of potential children allowed by the content tree
- *
- * returns the number of element in the list, or -1 in case of error.
- */
-
-int
-xmlValidGetPotentialChildren(xmlElementContent *ctree, const xmlChar **list,
- int *len, int max) {
- int i;
-
- if ((ctree == NULL) || (list == NULL) || (len == NULL))
- return(-1);
- if (*len >= max) return(*len);
-
- switch (ctree->type) {
- case XML_ELEMENT_CONTENT_PCDATA:
- for (i = 0; i < *len;i++)
- if (xmlStrEqual(BAD_CAST "#PCDATA", list[i])) return(*len);
- list[(*len)++] = BAD_CAST "#PCDATA";
- break;
- case XML_ELEMENT_CONTENT_ELEMENT:
- for (i = 0; i < *len;i++)
- if (xmlStrEqual(ctree->name, list[i])) return(*len);
- list[(*len)++] = ctree->name;
- break;
- case XML_ELEMENT_CONTENT_SEQ:
- xmlValidGetPotentialChildren(ctree->c1, list, len, max);
- xmlValidGetPotentialChildren(ctree->c2, list, len, max);
- break;
- case XML_ELEMENT_CONTENT_OR:
- xmlValidGetPotentialChildren(ctree->c1, list, len, max);
- xmlValidGetPotentialChildren(ctree->c2, list, len, max);
- break;
- }
-
- return(*len);
-}
-
-/**
- * xmlValidGetValidElements:
- * @prev: an element to insert after
- * @next: an element to insert next
- * @list: an array to store the list of child names
- * @max: the size of the array
- *
- * This function returns the list of authorized children to insert
- * within an existing tree while respecting the validity constraints
- * forced by the Dtd. The insertion point is defined using @prev and
- * @next in the following ways:
- * to insert before 'node': xmlValidGetValidElements(node->prev, node, ...
- * to insert next 'node': xmlValidGetValidElements(node, node->next, ...
- * to replace 'node': xmlValidGetValidElements(node->prev, node->next, ...
- * to prepend a child to 'node': xmlValidGetValidElements(NULL, node->childs,
- * to append a child to 'node': xmlValidGetValidElements(node->last, NULL, ...
- *
- * pointers to the element names are inserted at the beginning of the array
- * and do not need to be freed.
- *
- * returns the number of element in the list, or -1 in case of error. If
- * the function returns the value @max the caller is invited to grow the
- * receiving array and retry.
- */
-
-int
-xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **list,
- int max) {
- xmlValidCtxt vctxt;
- int nb_valid_elements = 0;
- const xmlChar *elements[256];
- int nb_elements = 0, i;
- const xmlChar *name;
-
- xmlNode *ref_node;
- xmlNode *parent;
- xmlNode *test_node;
-
- xmlNode *prev_next;
- xmlNode *next_prev;
- xmlNode *parent_childs;
- xmlNode *parent_last;
-
- xmlElement *element_desc;
-
- memset(&vctxt, 0, sizeof (xmlValidCtxt));
-
- if (prev == NULL && next == NULL)
- return(-1);
-
- if (list == NULL) return(-1);
- if (max <= 0) return(-1);
-
- nb_valid_elements = 0;
- ref_node = prev ? prev : next;
- parent = ref_node->parent;
-
- /*
- * Retrieves the parent element declaration
- */
- element_desc = xmlGetDtdElementDesc(parent->doc->intSubset,
- parent->name);
- if ((element_desc == NULL) && (parent->doc->extSubset != NULL))
- element_desc = xmlGetDtdElementDesc(parent->doc->extSubset,
- parent->name);
- if (element_desc == NULL) return(-1);
-
- /*
- * Do a backup of the current tree structure
- */
- prev_next = prev ? prev->next : NULL;
- next_prev = next ? next->prev : NULL;
- parent_childs = parent->children;
- parent_last = parent->last;
-
- /*
- * Creates a dummy node and insert it into the tree
- */
- test_node = xmlNewNode (NULL, BAD_CAST "<!dummy?>");
- test_node->doc = ref_node->doc;
- test_node->parent = parent;
- test_node->prev = prev;
- test_node->next = next;
- name = test_node->name;
-
- if (prev) prev->next = test_node;
- else parent->children = test_node;
-
- if (next) next->prev = test_node;
- else parent->last = test_node;
-
- /*
- * Insert each potential child node and check if the parent is
- * still valid
- */
- nb_elements = xmlValidGetPotentialChildren(element_desc->content,
- elements, &nb_elements, 256);
-
- for (i = 0;i < nb_elements;i++) {
- test_node->name = elements[i];
- if (xmlValidateOneElement(&vctxt, parent->doc, parent)) {
- int j;
-
- for (j = 0; j < nb_valid_elements;j++)
- if (xmlStrEqual(elements[i], list[j])) break;
- list[nb_valid_elements++] = elements[i];
- if (nb_valid_elements >= max) break;
- }
- }
-
- /*
- * Restore the tree structure
- */
- if (prev) prev->next = prev_next;
- if (next) next->prev = next_prev;
- parent->children = parent_childs;
- parent->last = parent_last;
-
- /*
- * Free up the dummy node
- */
- test_node->name = name;
- xmlFreeNode(test_node);
-
- return(nb_valid_elements);
-}
diff --git a/bundle/libxml/xinclude.c b/bundle/libxml/xinclude.c
deleted file mode 100644
index 78ee0427b2..0000000000
--- a/bundle/libxml/xinclude.c
+++ /dev/null
@@ -1,1729 +0,0 @@
-/*
- * xinclude.c : Code to implement XInclude processing
- *
- * World Wide Web Consortium W3C Last Call Working Draft 16 May 2001
- * http://www.w3.org/TR/2001/WD-xinclude-20010516/
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-/*
- * TODO: compute XPointers nodesets
- * TODO: add an node intermediate API and handle recursion at this level
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#include <string.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/uri.h>
-#include <libxml/xpointer.h>
-#include <libxml/parserInternals.h>
-#include <libxml/xmlerror.h>
-#include <libxml/encoding.h>
-#include <libxml/globals.h>
-
-#ifdef LIBXML_XINCLUDE_ENABLED
-#include <libxml/xinclude.h>
-
-#define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2001/XInclude"
-#define XINCLUDE_NODE (const xmlChar *) "include"
-#define XINCLUDE_FALLBACK (const xmlChar *) "fallback"
-#define XINCLUDE_HREF (const xmlChar *) "href"
-#define XINCLUDE_PARSE (const xmlChar *) "parse"
-#define XINCLUDE_PARSE_XML (const xmlChar *) "xml"
-#define XINCLUDE_PARSE_TEXT (const xmlChar *) "text"
-#define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding"
-
-/* #define DEBUG_XINCLUDE */
-#ifdef DEBUG_XINCLUDE
-#ifdef LIBXML_DEBUG_ENABLED
-#include <libxml/debugXML.h>
-#endif
-#endif
-
-/************************************************************************
- * *
- * XInclude contexts handling *
- * *
- ************************************************************************/
-
-/*
- * An XInclude context
- */
-typedef xmlChar *xmlURL;
-
-typedef struct _xmlXIncludeRef xmlXIncludeRef;
-typedef xmlXIncludeRef *xmlXIncludeRefPtr;
-struct _xmlXIncludeRef {
- xmlChar *URI; /* the rully resolved resource URL */
- xmlChar *fragment; /* the fragment in the URI */
- xmlDocPtr doc; /* the parsed document */
- xmlNodePtr ref; /* the node making the reference in the source */
- xmlNodePtr inc; /* the included copy */
- int xml; /* xml or txt */
- int count; /* how many refs use that specific doc */
-};
-
-typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt;
-typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr;
-struct _xmlXIncludeCtxt {
- xmlDocPtr doc; /* the source document */
- int incBase; /* the first include for this document */
- int incNr; /* number of includes */
- int incMax; /* size of includes tab */
- xmlXIncludeRefPtr *incTab; /* array of included references */
-
- int txtNr; /* number of unparsed documents */
- int txtMax; /* size of unparsed documents tab */
- xmlNodePtr *txtTab; /* array of unparsed text nodes */
- xmlURL *txturlTab; /* array of unparsed txtuments URLs */
-};
-
-static int
-xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc);
-
-/**
- * xmlXIncludeFreeRef:
- * @ref: the XInclude reference
- *
- * Free an XInclude reference
- */
-static void
-xmlXIncludeFreeRef(xmlXIncludeRefPtr ref) {
- if (ref == NULL)
- return;
-#ifdef DEBUG_XINCLUDE
- xmlGenericError(xmlGenericErrorContext, "Freeing ref\n");
-#endif
- if (ref->doc != NULL) {
-#ifdef DEBUG_XINCLUDE
- xmlGenericError(xmlGenericErrorContext, "Freeing doc %s\n", ref->URI);
-#endif
- xmlFreeDoc(ref->doc);
- }
- if (ref->URI != NULL)
- xmlFree(ref->URI);
- if (ref->fragment != NULL)
- xmlFree(ref->fragment);
- xmlFree(ref);
-}
-
-/**
- * xmlXIncludeNewRef:
- * @ctxt: the XInclude context
- * @URI: the resource URI
- *
- * Creates a new reference within an XInclude context
- *
- * Returns the new set
- */
-static xmlXIncludeRefPtr
-xmlXIncludeNewRef(xmlXIncludeCtxtPtr ctxt, const xmlChar *URI,
- xmlNodePtr ref) {
- xmlXIncludeRefPtr ret;
-
-#ifdef DEBUG_XINCLUDE
- xmlGenericError(xmlGenericErrorContext, "New ref %s\n", URI);
-#endif
- ret = (xmlXIncludeRefPtr) xmlMalloc(sizeof(xmlXIncludeRef));
- if (ret == NULL)
- return(NULL);
- memset(ret, 0, sizeof(xmlXIncludeRef));
- if (URI == NULL)
- ret->URI = NULL;
- else
- ret->URI = xmlStrdup(URI);
- ret->fragment = NULL;
- ret->ref = ref;
- ret->doc = 0;
- ret->count = 0;
- ret->xml = 0;
- ret->inc = NULL;
- if (ctxt->incMax == 0) {
- ctxt->incMax = 4;
- ctxt->incTab = (xmlXIncludeRefPtr *) xmlMalloc(ctxt->incMax *
- sizeof(ctxt->incTab[0]));
- if (ctxt->incTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc failed !\n");
- xmlXIncludeFreeRef(ret);
- return(NULL);
- }
- }
- if (ctxt->incNr >= ctxt->incMax) {
- ctxt->incMax *= 2;
- ctxt->incTab = (xmlXIncludeRefPtr *) xmlRealloc(ctxt->incTab,
- ctxt->incMax * sizeof(ctxt->incTab[0]));
- if (ctxt->incTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc failed !\n");
- xmlXIncludeFreeRef(ret);
- return(NULL);
- }
- }
- ctxt->incTab[ctxt->incNr++] = ret;
- return(ret);
-}
-
-/**
- * xmlXIncludeNewContext:
- * @doc: an XML Document
- *
- * Creates a new XInclude context
- *
- * Returns the new set
- */
-static xmlXIncludeCtxtPtr
-xmlXIncludeNewContext(xmlDocPtr doc) {
- xmlXIncludeCtxtPtr ret;
-
-#ifdef DEBUG_XINCLUDE
- xmlGenericError(xmlGenericErrorContext, "New context\n");
-#endif
- if (doc == NULL)
- return(NULL);
- ret = (xmlXIncludeCtxtPtr) xmlMalloc(sizeof(xmlXIncludeCtxt));
- if (ret == NULL)
- return(NULL);
- memset(ret, 0, sizeof(xmlXIncludeCtxt));
- ret->doc = doc;
- ret->incNr = 0;
- ret->incBase = 0;
- ret->incMax = 0;
- ret->incTab = NULL;
- return(ret);
-}
-
-/**
- * xmlXIncludeFreeContext:
- * @ctxt: the XInclude context
- *
- * Free an XInclude context
- */
-static void
-xmlXIncludeFreeContext(xmlXIncludeCtxtPtr ctxt) {
- int i;
-
-#ifdef DEBUG_XINCLUDE
- xmlGenericError(xmlGenericErrorContext, "Freeing context\n");
-#endif
- if (ctxt == NULL)
- return;
- for (i = 0;i < ctxt->incNr;i++) {
- if (ctxt->incTab[i] != NULL)
- xmlXIncludeFreeRef(ctxt->incTab[i]);
- }
- for (i = 0;i < ctxt->txtNr;i++) {
- if (ctxt->txturlTab[i] != NULL)
- xmlFree(ctxt->txturlTab[i]);
- }
- if (ctxt->incTab != NULL)
- xmlFree(ctxt->incTab);
- if (ctxt->txtTab != NULL)
- xmlFree(ctxt->txtTab);
- if (ctxt->txturlTab != NULL)
- xmlFree(ctxt->txturlTab);
- xmlFree(ctxt);
-}
-
-/**
- * xmlXIncludeAddNode:
- * @ctxt: the XInclude context
- * @cur: the new node
- *
- * Add a new node to process to an XInclude context
- */
-static int
-xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) {
- xmlXIncludeRefPtr ref;
- xmlURIPtr uri;
- xmlChar *URL;
- xmlChar *fragment = NULL;
- xmlChar *href;
- xmlChar *parse;
- xmlChar *base;
- xmlChar *URI;
- int xml = 1; /* default Issue 64 */
-
-
- if (ctxt == NULL)
- return(-1);
- if (cur == NULL)
- return(-1);
-
-#ifdef DEBUG_XINCLUDE
- xmlGenericError(xmlGenericErrorContext, "Add node\n");
-#endif
- /*
- * read the attributes
- */
- href = xmlGetNsProp(cur, XINCLUDE_NS, XINCLUDE_HREF);
- if (href == NULL) {
- href = xmlGetProp(cur, XINCLUDE_HREF);
- if (href == NULL) {
- xmlGenericError(xmlGenericErrorContext, "XInclude: no href\n");
- return(-1);
- }
- }
- parse = xmlGetNsProp(cur, XINCLUDE_NS, XINCLUDE_PARSE);
- if (parse == NULL) {
- parse = xmlGetProp(cur, XINCLUDE_PARSE);
- }
- if (parse != NULL) {
- if (xmlStrEqual(parse, XINCLUDE_PARSE_XML))
- xml = 1;
- else if (xmlStrEqual(parse, XINCLUDE_PARSE_TEXT))
- xml = 0;
- else {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: invalid value %s for %s\n",
- parse, XINCLUDE_PARSE);
- if (href != NULL)
- xmlFree(href);
- if (parse != NULL)
- xmlFree(parse);
- return(-1);
- }
- }
-
- /*
- * compute the URI
- */
- base = xmlNodeGetBase(ctxt->doc, cur);
- if (base == NULL) {
- URI = xmlBuildURI(href, ctxt->doc->URL);
- } else {
- URI = xmlBuildURI(href, base);
- }
- if (URI == NULL) {
- xmlChar *escbase;
- xmlChar *eschref;
- /*
- * Some escaping may be needed
- */
- escbase = xmlURIEscape(base);
- eschref = xmlURIEscape(href);
- URI = xmlBuildURI(eschref, escbase);
- if (escbase != NULL)
- xmlFree(escbase);
- if (eschref != NULL)
- xmlFree(eschref);
- }
- if (parse != NULL)
- xmlFree(parse);
- if (href != NULL)
- xmlFree(href);
- if (base != NULL)
- xmlFree(base);
- if (URI == NULL) {
- xmlGenericError(xmlGenericErrorContext, "XInclude: failed build URL\n");
- return(-1);
- }
-
- /*
- * Check the URL and remove any fragment identifier
- */
- uri = xmlParseURI((const char *)URI);
- if (uri == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: invalid value URI %s\n", URI);
- return(-1);
- }
- if (uri->fragment != NULL) {
- fragment = (xmlChar *) uri->fragment;
- uri->fragment = NULL;
- }
- URL = xmlSaveUri(uri);
- xmlFreeURI(uri);
- xmlFree(URI);
- if (URL == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: invalid value URI %s\n", URI);
- if (fragment != NULL)
- xmlFree(fragment);
- return(-1);
- }
-
- ref = xmlXIncludeNewRef(ctxt, URL, cur);
- if (ref == NULL) {
- return(-1);
- }
- ref->fragment = fragment;
- ref->doc = NULL;
- ref->xml = xml;
- ref->count = 1;
- xmlFree(URL);
- return(0);
-}
-
-/**
- * xmlXIncludeRecurseDoc:
- * @ctxt: the XInclude context
- * @doc: the new document
- * @url: the associated URL
- *
- * The XInclude recursive nature is handled at this point.
- */
-static void
-xmlXIncludeRecurseDoc(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc,
- const xmlURL url ATTRIBUTE_UNUSED) {
- xmlXIncludeCtxtPtr newctxt;
- int i;
-
-#ifdef DEBUG_XINCLUDE
- xmlGenericError(xmlGenericErrorContext, "Recursing in doc %s\n", doc->URL);
-#endif
- /*
- * Handle recursion here.
- */
-
- newctxt = xmlXIncludeNewContext(doc);
- if (newctxt != NULL) {
- /*
- * Copy the existing document set
- */
- newctxt->incMax = ctxt->incMax;
- newctxt->incNr = ctxt->incNr;
- newctxt->incTab = (xmlXIncludeRefPtr *) xmlMalloc(newctxt->incMax *
- sizeof(newctxt->incTab[0]));
- if (newctxt->incTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc failed !\n");
- xmlFree(newctxt);
- return;
- }
-
- /*
- * Inherit the documents already in use by others includes
- */
- newctxt->incBase = ctxt->incNr;
- for (i = 0;i < ctxt->incNr;i++) {
- newctxt->incTab[i] = ctxt->incTab[i];
- newctxt->incTab[i]->count++; /* prevent the recursion from
- freeing it */
- }
- xmlXIncludeDoProcess(newctxt, doc);
- for (i = 0;i < ctxt->incNr;i++) {
- newctxt->incTab[i]->count--;
- newctxt->incTab[i] = NULL;
- }
- xmlXIncludeFreeContext(newctxt);
- }
-#ifdef DEBUG_XINCLUDE
- xmlGenericError(xmlGenericErrorContext, "Done recursing in doc %s\n", url);
-#endif
-}
-
-/**
- * xmlXIncludeAddTxt:
- * @ctxt: the XInclude context
- * @txt: the new text node
- * @url: the associated URL
- *
- * Add a new txtument to the list
- */
-static void
-xmlXIncludeAddTxt(xmlXIncludeCtxtPtr ctxt, xmlNodePtr txt, const xmlURL url) {
-#ifdef DEBUG_XINCLUDE
- xmlGenericError(xmlGenericErrorContext, "Adding text %s\n", url);
-#endif
- if (ctxt->txtMax == 0) {
- ctxt->txtMax = 4;
- ctxt->txtTab = (xmlNodePtr *) xmlMalloc(ctxt->txtMax *
- sizeof(ctxt->txtTab[0]));
- if (ctxt->txtTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc failed !\n");
- return;
- }
- ctxt->txturlTab = (xmlURL *) xmlMalloc(ctxt->txtMax *
- sizeof(ctxt->txturlTab[0]));
- if (ctxt->txturlTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc failed !\n");
- return;
- }
- }
- if (ctxt->txtNr >= ctxt->txtMax) {
- ctxt->txtMax *= 2;
- ctxt->txtTab = (xmlNodePtr *) xmlRealloc(ctxt->txtTab,
- ctxt->txtMax * sizeof(ctxt->txtTab[0]));
- if (ctxt->txtTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc failed !\n");
- return;
- }
- ctxt->txturlTab = (xmlURL *) xmlRealloc(ctxt->txturlTab,
- ctxt->txtMax * sizeof(ctxt->txturlTab[0]));
- if (ctxt->txturlTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc failed !\n");
- return;
- }
- }
- ctxt->txtTab[ctxt->txtNr] = txt;
- ctxt->txturlTab[ctxt->txtNr] = xmlStrdup(url);
- ctxt->txtNr++;
-}
-
-/************************************************************************
- * *
- * Node copy with specific semantic *
- * *
- ************************************************************************/
-
-/**
- * xmlXIncludeCopyNode:
- * @ctxt: the XInclude context
- * @target: the document target
- * @source: the document source
- * @elem: the element
- *
- * Make a copy of the node while preserving the XInclude semantic
- * of the Infoset copy
- */
-static xmlNodePtr
-xmlXIncludeCopyNode(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
- xmlDocPtr source, xmlNodePtr elem) {
- xmlNodePtr result = NULL;
-
- if ((ctxt == NULL) || (target == NULL) || (source == NULL) ||
- (elem == NULL))
- return(NULL);
- if (elem->type == XML_DTD_NODE)
- return(NULL);
- result = xmlDocCopyNode(elem, target, 1);
- return(result);
-}
-
-/**
- * xmlXIncludeCopyNodeList:
- * @ctxt: the XInclude context
- * @target: the document target
- * @source: the document source
- * @elem: the element list
- *
- * Make a copy of the node list while preserving the XInclude semantic
- * of the Infoset copy
- */
-static xmlNodePtr
-xmlXIncludeCopyNodeList(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
- xmlDocPtr source, xmlNodePtr elem) {
- xmlNodePtr cur, res, result = NULL, last = NULL;
-
- if ((ctxt == NULL) || (target == NULL) || (source == NULL) ||
- (elem == NULL))
- return(NULL);
- cur = elem;
- while (cur != NULL) {
- res = xmlXIncludeCopyNode(ctxt, target, source, cur);
- if (res != NULL) {
- if (result == NULL) {
- result = last = res;
- } else {
- last->next = res;
- res->prev = last;
- last = res;
- }
- }
- cur = cur->next;
- }
- return(result);
-}
-
-/**
- * xmlXInclueGetNthChild:
- * @cur: the node
- * @no: the child number
- *
- * Returns the @no'th element child of @cur or NULL
- */
-static xmlNodePtr
-xmlXIncludeGetNthChild(xmlNodePtr cur, int no) {
- int i;
- if (cur == NULL)
- return(cur);
- cur = cur->children;
- for (i = 0;i <= no;cur = cur->next) {
- if (cur == NULL)
- return(cur);
- if ((cur->type == XML_ELEMENT_NODE) ||
- (cur->type == XML_DOCUMENT_NODE) ||
- (cur->type == XML_HTML_DOCUMENT_NODE)) {
- i++;
- if (i == no)
- break;
- }
- }
- return(cur);
-}
-
-xmlNodePtr xmlXPtrAdvanceNode(xmlNodePtr cur);
-
-/**
- * xmlXIncludeCopyRange:
- * @ctxt: the XInclude context
- * @target: the document target
- * @source: the document source
- * @obj: the XPointer result from the evaluation.
- *
- * Build a node list tree copy of the XPointer result.
- *
- * Returns an xmlNodePtr list or NULL.
- * the caller has to free the node tree.
- */
-static xmlNodePtr
-xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
- xmlDocPtr source, xmlXPathObjectPtr range) {
- /* pointers to generated nodes */
- xmlNodePtr list = NULL, last = NULL, parent = NULL, tmp;
- /* pointers to traversal nodes */
- xmlNodePtr start, cur, end;
- int index1, index2;
-
- if ((ctxt == NULL) || (target == NULL) || (source == NULL) ||
- (range == NULL))
- return(NULL);
- if (range->type != XPATH_RANGE)
- return(NULL);
- start = (xmlNodePtr) range->user;
-
- if (start == NULL)
- return(NULL);
- end = range->user2;
- if (end == NULL)
- return(xmlDocCopyNode(start, target, 1));
-
- cur = start;
- index1 = range->index;
- index2 = range->index2;
- while (cur != NULL) {
- if (cur == end) {
- if (cur->type == XML_TEXT_NODE) {
- const xmlChar *content = cur->content;
- int len;
-
- if (content == NULL) {
- tmp = xmlNewTextLen(NULL, 0);
- } else {
- len = index2;
- if ((cur == start) && (index1 > 1)) {
- content += (index1 - 1);
- len -= (index1 - 1);
- index1 = 0;
- } else {
- len = index2;
- }
- tmp = xmlNewTextLen(content, len);
- }
- /* single sub text node selection */
- if (list == NULL)
- return(tmp);
- /* prune and return full set */
- if (last != NULL)
- xmlAddNextSibling(last, tmp);
- else
- xmlAddChild(parent, tmp);
- return(list);
- } else {
- tmp = xmlDocCopyNode(cur, target, 0);
- if (list == NULL)
- list = tmp;
- else {
- if (last != NULL)
- xmlAddNextSibling(last, tmp);
- else
- xmlAddChild(parent, tmp);
- }
- last = NULL;
- parent = tmp;
-
- if (index2 > 1) {
- end = xmlXIncludeGetNthChild(cur, index2 - 1);
- index2 = 0;
- }
- if ((cur == start) && (index1 > 1)) {
- cur = xmlXIncludeGetNthChild(cur, index1 - 1);
- index1 = 0;
- } else {
- cur = cur->children;
- }
- /*
- * Now gather the remaining nodes from cur to end
- */
- continue; /* while */
- }
- } else if ((cur == start) &&
- (list == NULL) /* looks superfluous but ... */ ) {
- if ((cur->type == XML_TEXT_NODE) ||
- (cur->type == XML_CDATA_SECTION_NODE)) {
- const xmlChar *content = cur->content;
-
- if (content == NULL) {
- tmp = xmlNewTextLen(NULL, 0);
- } else {
- if (index1 > 1) {
- content += (index1 - 1);
- }
- tmp = xmlNewText(content);
- }
- last = list = tmp;
- } else {
- if ((cur == start) && (index1 > 1)) {
- tmp = xmlDocCopyNode(cur, target, 0);
- list = tmp;
- parent = tmp;
- last = NULL;
- cur = xmlXIncludeGetNthChild(cur, index1 - 1);
- index1 = 0;
- /*
- * Now gather the remaining nodes from cur to end
- */
- continue; /* while */
- }
- tmp = xmlDocCopyNode(cur, target, 1);
- list = tmp;
- parent = NULL;
- last = tmp;
- }
- } else {
- tmp = NULL;
- switch (cur->type) {
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_NODE:
- /* Do not copy DTD informations */
- break;
- case XML_ENTITY_DECL:
- /* handle crossing entities -> stack needed */
- break;
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- /* don't consider it part of the tree content */
- break;
- case XML_ATTRIBUTE_NODE:
- /* Humm, should not happen ! */
- break;
- default:
- tmp = xmlDocCopyNode(cur, target, 1);
- break;
- }
- if (tmp != NULL) {
- if ((list == NULL) || ((last == NULL) && (parent == NULL))) {
- return(NULL);
- }
- if (last != NULL)
- xmlAddNextSibling(last, tmp);
- else {
- xmlAddChild(parent, tmp);
- last = tmp;
- }
- }
- }
- /*
- * Skip to next node in document order
- */
- if ((list == NULL) || ((last == NULL) && (parent == NULL))) {
- return(NULL);
- }
- cur = xmlXPtrAdvanceNode(cur);
- }
- return(list);
-}
-
-/**
- * xmlXIncludeBuildNodeList:
- * @ctxt: the XInclude context
- * @target: the document target
- * @source: the document source
- * @obj: the XPointer result from the evaluation.
- *
- * Build a node list tree copy of the XPointer result.
- * This will drop Attributes and Namespace declarations.
- *
- * Returns an xmlNodePtr list or NULL.
- * the caller has to free the node tree.
- */
-static xmlNodePtr
-xmlXIncludeCopyXPointer(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
- xmlDocPtr source, xmlXPathObjectPtr obj) {
- xmlNodePtr list = NULL, last = NULL;
- int i;
-
- if ((ctxt == NULL) || (target == NULL) || (source == NULL) ||
- (obj == NULL))
- return(NULL);
- switch (obj->type) {
- case XPATH_NODESET: {
- xmlNodeSetPtr set = obj->nodesetval;
- if (set == NULL)
- return(NULL);
- for (i = 0;i < set->nodeNr;i++) {
- if (set->nodeTab[i] == NULL)
- continue;
- switch (set->nodeTab[i]->type) {
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_ELEMENT_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_DOCUMENT_NODE:
- case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- break;
- case XML_ATTRIBUTE_NODE:
- case XML_NAMESPACE_DECL:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_NOTATION_NODE:
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- continue; /* for */
- }
- if (last == NULL)
- list = last = xmlXIncludeCopyNode(ctxt, target, source,
- set->nodeTab[i]);
- else {
- xmlAddNextSibling(last,
- xmlXIncludeCopyNode(ctxt, target, source,
- set->nodeTab[i]));
- if (last->next != NULL)
- last = last->next;
- }
- }
- break;
- }
- case XPATH_LOCATIONSET: {
- xmlLocationSetPtr set = (xmlLocationSetPtr) obj->user;
- if (set == NULL)
- return(NULL);
- for (i = 0;i < set->locNr;i++) {
- if (last == NULL)
- list = last = xmlXIncludeCopyXPointer(ctxt, target, source,
- set->locTab[i]);
- else
- xmlAddNextSibling(last,
- xmlXIncludeCopyXPointer(ctxt, target, source,
- set->locTab[i]));
- if (last != NULL) {
- while (last->next != NULL)
- last = last->next;
- }
- }
- break;
- }
- case XPATH_RANGE:
- return(xmlXIncludeCopyRange(ctxt, target, source, obj));
- case XPATH_POINT:
- /* points are ignored in XInclude */
- break;
- default:
- break;
- }
- return(list);
-}
-/************************************************************************
- * *
- * XInclude I/O handling *
- * *
- ************************************************************************/
-
-/**
- * xmlXIncludeLoadDoc:
- * @ctxt: the XInclude context
- * @url: the associated URL
- * @nr: the xinclude node number
- *
- * Load the document, and store the result in the XInclude context
- *
- * Returns 0 in case of success, -1 in case of failure
- */
-static int
-xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
- xmlDocPtr doc;
- xmlURIPtr uri;
- xmlChar *URL;
- xmlChar *fragment = NULL;
- int i = 0;
-
-#ifdef DEBUG_XINCLUDE
- xmlGenericError(xmlGenericErrorContext, "Loading doc %s:%d\n", url, nr);
-#endif
- /*
- * Check the URL and remove any fragment identifier
- */
- uri = xmlParseURI((const char *)url);
- if (uri == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: invalid value URI %s\n", url);
- return(-1);
- }
- if (uri->fragment != NULL) {
- fragment = (xmlChar *) uri->fragment;
- uri->fragment = NULL;
- }
- URL = xmlSaveUri(uri);
- xmlFreeURI(uri);
- if (URL == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: invalid value URI %s\n", url);
- if (fragment != NULL)
- xmlFree(fragment);
- return(-1);
- }
-
- /*
- * Handling of references to the local document are done
- * directly through ctxt->doc.
- */
- if ((URL[0] == 0) || (URL[0] == '#')) {
- doc = NULL;
- goto loaded;
- }
-
- /*
- * Prevent reloading twice the document.
- */
- for (i = 0; i < ctxt->incNr; i++) {
- if ((xmlStrEqual(URL, ctxt->incTab[i]->URI)) &&
- (ctxt->incTab[i]->doc != NULL)) {
- doc = ctxt->incTab[i]->doc;
-#ifdef DEBUG_XINCLUDE
- printf("Already loaded %s\n", URL);
-#endif
- goto loaded;
- }
- }
-
- /*
- * Load it.
- */
-#ifdef DEBUG_XINCLUDE
- printf("loading %s\n", URL);
-#endif
- doc = xmlParseFile((const char *)URL);
- if (doc == NULL) {
- xmlFree(URL);
- if (fragment != NULL)
- xmlFree(fragment);
- return(-1);
- }
- ctxt->incTab[nr]->doc = doc;
-
- /*
- * TODO: Make sure we have all entities fixed up
- */
-
- /*
- * We don't need the DTD anymore, free up space
- if (doc->intSubset != NULL) {
- xmlUnlinkNode((xmlNodePtr) doc->intSubset);
- xmlFreeNode((xmlNodePtr) doc->intSubset);
- doc->intSubset = NULL;
- }
- if (doc->extSubset != NULL) {
- xmlUnlinkNode((xmlNodePtr) doc->extSubset);
- xmlFreeNode((xmlNodePtr) doc->extSubset);
- doc->extSubset = NULL;
- }
- */
- xmlXIncludeRecurseDoc(ctxt, doc, URL);
-
-loaded:
- if (fragment == NULL) {
- /*
- * Add the top children list as the replacement copy.
- */
- if (doc == NULL)
- {
- /* Hopefully a DTD declaration won't be copied from
- * the same document */
- ctxt->incTab[nr]->inc = xmlCopyNodeList(ctxt->doc->children);
- } else {
- ctxt->incTab[nr]->inc = xmlXIncludeCopyNodeList(ctxt, ctxt->doc,
- doc, doc->children);
- }
- } else {
- /*
- * Computes the XPointer expression and make a copy used
- * as the replacement copy.
- */
- xmlXPathObjectPtr xptr;
- xmlXPathContextPtr xptrctxt;
- xmlNodeSetPtr set;
-
- if (doc == NULL) {
- xptrctxt = xmlXPtrNewContext(ctxt->doc, ctxt->incTab[nr]->ref,
- NULL);
- } else {
- xptrctxt = xmlXPtrNewContext(doc, NULL, NULL);
- }
- if (xptrctxt == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: could create XPointer context\n");
- xmlFree(URL);
- xmlFree(fragment);
- return(-1);
- }
- xptr = xmlXPtrEval(fragment, xptrctxt);
- if (xptr == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: XPointer evaluation failed: #%s\n",
- fragment);
- xmlXPathFreeContext(xptrctxt);
- xmlFree(URL);
- xmlFree(fragment);
- return(-1);
- }
- switch (xptr->type) {
- case XPATH_UNDEFINED:
- case XPATH_BOOLEAN:
- case XPATH_NUMBER:
- case XPATH_STRING:
- case XPATH_POINT:
- case XPATH_USERS:
- case XPATH_XSLT_TREE:
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: XPointer is not a range: #%s\n",
- fragment);
- xmlXPathFreeContext(xptrctxt);
- xmlFree(URL);
- xmlFree(fragment);
- return(-1);
- case XPATH_NODESET:
- case XPATH_RANGE:
- case XPATH_LOCATIONSET:
- break;
- }
- set = xptr->nodesetval;
- if (set != NULL) {
- for (i = 0;i < set->nodeNr;i++) {
- if (set->nodeTab[i] == NULL)
- continue;
- switch (set->nodeTab[i]->type) {
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_ELEMENT_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_DOCUMENT_NODE:
- case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- continue;
- case XML_ATTRIBUTE_NODE:
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: XPointer selects an attribute: #%s\n",
- fragment);
- set->nodeTab[i] = NULL;
- continue;
- case XML_NAMESPACE_DECL:
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: XPointer selects a namespace: #%s\n",
- fragment);
- set->nodeTab[i] = NULL;
- continue;
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_NOTATION_NODE:
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: XPointer selects unexpected nodes: #%s\n",
- fragment);
- set->nodeTab[i] = NULL;
- set->nodeTab[i] = NULL;
- continue; /* for */
- }
- }
- }
- ctxt->incTab[nr]->inc =
- xmlXIncludeCopyXPointer(ctxt, ctxt->doc, doc, xptr);
- xmlXPathFreeObject(xptr);
- xmlXPathFreeContext(xptrctxt);
- xmlFree(fragment);
- }
-
- /*
- * Do the xml:base fixup if needed
- */
- if ((doc != NULL) && (URL != NULL) && (xmlStrchr(URL, (xmlChar) '/'))) {
- xmlNodePtr node;
-
- node = ctxt->incTab[nr]->inc;
- while (node != NULL) {
- if (node->type == XML_ELEMENT_NODE)
- xmlNodeSetBase(node, URL);
- node = node->next;
- }
- }
- if ((nr < ctxt->incNr) && (ctxt->incTab[nr]->doc != NULL) &&
- (ctxt->incTab[nr]->count <= 1)) {
-#ifdef DEBUG_XINCLUDE
- printf("freeing %s\n", ctxt->incTab[nr]->doc->URL);
-#endif
- xmlFreeDoc(ctxt->incTab[nr]->doc);
- ctxt->incTab[nr]->doc = NULL;
- }
- xmlFree(URL);
- return(0);
-}
-
-/**
- * xmlXIncludeLoadTxt:
- * @ctxt: the XInclude context
- * @url: the associated URL
- * @nr: the xinclude node number
- *
- * Load the content, and store the result in the XInclude context
- *
- * Returns 0 in case of success, -1 in case of failure
- */
-static int
-xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
- xmlParserInputBufferPtr buf;
- xmlNodePtr node;
- xmlURIPtr uri;
- xmlChar *URL;
- int i;
- xmlChar *encoding = NULL;
- xmlCharEncoding enc = 0;
-
- /*
- * Check the URL and remove any fragment identifier
- */
- uri = xmlParseURI((const char *)url);
- if (uri == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: invalid value URI %s\n", url);
- return(-1);
- }
- if (uri->fragment != NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: fragment identifier forbidden for text: %s\n",
- uri->fragment);
- xmlFreeURI(uri);
- return(-1);
- }
- URL = xmlSaveUri(uri);
- xmlFreeURI(uri);
- if (URL == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: invalid value URI %s\n", url);
- return(-1);
- }
-
- /*
- * Handling of references to the local document are done
- * directly through ctxt->doc.
- */
- if (URL[0] == 0) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: text serialization of document not available\n");
- xmlFree(URL);
- return(-1);
- }
-
- /*
- * Prevent reloading twice the document.
- */
- for (i = 0; i < ctxt->txtNr; i++) {
- if (xmlStrEqual(URL, ctxt->txturlTab[i])) {
- node = xmlCopyNode(ctxt->txtTab[i], 1);
- goto loaded;
- }
- }
- /*
- * Try to get the encoding if available
- */
- if ((ctxt->incTab[nr] != NULL) && (ctxt->incTab[nr]->ref != NULL)) {
- encoding = xmlGetProp(ctxt->incTab[nr]->ref, XINCLUDE_PARSE_ENCODING);
- }
- if (encoding != NULL) {
- /*
- * TODO: we should not have to remap to the xmlCharEncoding
- * predefined set, a better interface than
- * xmlParserInputBufferCreateFilename should allow any
- * encoding supported by iconv
- */
- enc = xmlParseCharEncoding((const char *) encoding);
- if (enc == XML_CHAR_ENCODING_ERROR) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: encoding %s not supported\n", encoding);
- xmlFree(encoding);
- xmlFree(URL);
- return(-1);
- }
- xmlFree(encoding);
- }
-
- /*
- * Load it.
- */
- buf = xmlParserInputBufferCreateFilename((const char *)URL, enc);
- if (buf == NULL) {
- xmlFree(URL);
- return(-1);
- }
- node = xmlNewText(NULL);
-
- /*
- * Scan all chars from the resource and add the to the node
- */
- while (xmlParserInputBufferRead(buf, 128) > 0) {
- int len;
- const xmlChar *content;
-
- content = xmlBufferContent(buf->buffer);
- len = xmlBufferLength(buf->buffer);
- for (i = 0;i < len;) {
- int cur;
- int l;
-
- cur = xmlStringCurrentChar(NULL, &content[i], &l);
- if (!IS_CHAR(cur)) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: %s contains invalid char %d\n", URL, cur);
- } else {
- xmlNodeAddContentLen(node, &content[i], l);
- }
- i += l;
- }
- xmlBufferShrink(buf->buffer, len);
- }
- xmlFreeParserInputBuffer(buf);
- xmlXIncludeAddTxt(ctxt, node, URL);
-
-loaded:
- /*
- * Add the element as the replacement copy.
- */
- ctxt->incTab[nr]->inc = node;
- xmlFree(URL);
- return(0);
-}
-
-/**
- * xmlXIncludeLoadFallback:
- * @ctxt: the XInclude context
- * @fallback: the fallback node
- * @nr: the xinclude node number
- *
- * Load the content of the fallback node, and store the result
- * in the XInclude context
- *
- * Returns 0 in case of success, -1 in case of failure
- */
-static int
-xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback, int nr) {
- if ((fallback == NULL) || (ctxt == NULL))
- return(-1);
-
- ctxt->incTab[nr]->inc = xmlCopyNode(fallback->children, 1);
- return(0);
-}
-
-/************************************************************************
- * *
- * XInclude Processing *
- * *
- ************************************************************************/
-
-/**
- * xmlXIncludePreProcessNode:
- * @ctxt: an XInclude context
- * @node: an XInclude node
- *
- * Implement the XInclude preprocessing, currently just adding the element
- * for further processing.
- *
- * Returns the result list or NULL in case of error
- */
-static xmlNodePtr
-xmlXIncludePreProcessNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) {
- xmlXIncludeAddNode(ctxt, node);
- return(0);
-}
-
-#if 0
-/**
- * xmlXIncludePreloadNode:
- * @ctxt: an XInclude context
- * @nr: the node number
- *
- * Do some precomputations and preload shared documents
- *
- * Returns 0 if substitution succeeded, -1 if some processing failed
- */
-static int
-xmlXIncludePreloadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
- xmlNodePtr cur;
- xmlChar *href;
- xmlChar *parse;
- xmlChar *base;
- xmlChar *URI;
- int xml = 1; /* default Issue 64 */
- xmlURIPtr uri;
- xmlChar *URL;
- xmlChar *fragment = NULL;
- int i;
-
-
- if (ctxt == NULL)
- return(-1);
- if ((nr < 0) || (nr >= ctxt->incNr))
- return(-1);
- cur = ctxt->incTab[nr]->ref;
- if (cur == NULL)
- return(-1);
-
- /*
- * read the attributes
- */
- href = xmlGetNsProp(cur, XINCLUDE_NS, XINCLUDE_HREF);
- if (href == NULL) {
- href = xmlGetProp(cur, XINCLUDE_HREF);
- if (href == NULL) {
- xmlGenericError(xmlGenericErrorContext, "XInclude: no href\n");
- return(-1);
- }
- }
- parse = xmlGetNsProp(cur, XINCLUDE_NS, XINCLUDE_PARSE);
- if (parse == NULL) {
- parse = xmlGetProp(cur, XINCLUDE_PARSE);
- }
- if (parse != NULL) {
- if (xmlStrEqual(parse, XINCLUDE_PARSE_XML))
- xml = 1;
- else if (xmlStrEqual(parse, XINCLUDE_PARSE_TEXT))
- xml = 0;
- else {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: invalid value %s for %s\n",
- parse, XINCLUDE_PARSE);
- if (href != NULL)
- xmlFree(href);
- if (parse != NULL)
- xmlFree(parse);
- return(-1);
- }
- }
-
- /*
- * compute the URI
- */
- base = xmlNodeGetBase(ctxt->doc, cur);
- if (base == NULL) {
- URI = xmlBuildURI(href, ctxt->doc->URL);
- } else {
- URI = xmlBuildURI(href, base);
- }
- if (URI == NULL) {
- xmlChar *escbase;
- xmlChar *eschref;
- /*
- * Some escaping may be needed
- */
- escbase = xmlURIEscape(base);
- eschref = xmlURIEscape(href);
- URI = xmlBuildURI(eschref, escbase);
- if (escbase != NULL)
- xmlFree(escbase);
- if (eschref != NULL)
- xmlFree(eschref);
- }
- if (parse != NULL)
- xmlFree(parse);
- if (href != NULL)
- xmlFree(href);
- if (base != NULL)
- xmlFree(base);
- if (URI == NULL) {
- xmlGenericError(xmlGenericErrorContext, "XInclude: failed build URL\n");
- return(-1);
- }
-
- /*
- * Check the URL and remove any fragment identifier
- */
- uri = xmlParseURI((const char *)URI);
- if (uri == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: invalid value URI %s\n", URI);
- xmlFree(URI);
- return(-1);
- }
- if (uri->fragment != NULL) {
- fragment = (xmlChar *) uri->fragment;
- uri->fragment = NULL;
- }
- URL = xmlSaveUri(uri);
- xmlFreeURI(uri);
- if (URL == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: invalid value URI %s\n", URI);
- if (fragment != NULL)
- xmlFree(fragment);
- xmlFree(URI);
- return(-1);
- }
- xmlFree(URI);
- if (fragment != NULL)
- xmlFree(fragment);
-
- for (i = 0; i < nr; i++) {
- if (xmlStrEqual(URL, ctxt->incTab[i]->URI)) {
-#ifdef DEBUG_XINCLUDE
- printf("Incrementing count for %d : %s\n", i, ctxt->incTab[i]->URI);
-#endif
- ctxt->incTab[i]->count++;
- break;
- }
- }
- xmlFree(URL);
- return(0);
-}
-#endif
-
-/**
- * xmlXIncludeLoadNode:
- * @ctxt: an XInclude context
- * @nr: the node number
- *
- * Find and load the infoset replacement for the given node.
- *
- * Returns 0 if substitution succeeded, -1 if some processing failed
- */
-static int
-xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
- xmlNodePtr cur;
- xmlChar *href;
- xmlChar *parse;
- xmlChar *base;
- xmlChar *URI;
- int xml = 1; /* default Issue 64 */
- int ret;
-
- if (ctxt == NULL)
- return(-1);
- if ((nr < 0) || (nr >= ctxt->incNr))
- return(-1);
- cur = ctxt->incTab[nr]->ref;
- if (cur == NULL)
- return(-1);
-
- /*
- * read the attributes
- */
- href = xmlGetNsProp(cur, XINCLUDE_NS, XINCLUDE_HREF);
- if (href == NULL) {
- href = xmlGetProp(cur, XINCLUDE_HREF);
- if (href == NULL) {
- xmlGenericError(xmlGenericErrorContext, "XInclude: no href\n");
- return(-1);
- }
- }
- parse = xmlGetNsProp(cur, XINCLUDE_NS, XINCLUDE_PARSE);
- if (parse == NULL) {
- parse = xmlGetProp(cur, XINCLUDE_PARSE);
- }
- if (parse != NULL) {
- if (xmlStrEqual(parse, XINCLUDE_PARSE_XML))
- xml = 1;
- else if (xmlStrEqual(parse, XINCLUDE_PARSE_TEXT))
- xml = 0;
- else {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: invalid value %s for %s\n",
- parse, XINCLUDE_PARSE);
- if (href != NULL)
- xmlFree(href);
- if (parse != NULL)
- xmlFree(parse);
- return(-1);
- }
- }
-
- /*
- * compute the URI
- */
- base = xmlNodeGetBase(ctxt->doc, cur);
- if (base == NULL) {
- URI = xmlBuildURI(href, ctxt->doc->URL);
- } else {
- URI = xmlBuildURI(href, base);
- }
- if (URI == NULL) {
- xmlChar *escbase;
- xmlChar *eschref;
- /*
- * Some escaping may be needed
- */
- escbase = xmlURIEscape(base);
- eschref = xmlURIEscape(href);
- URI = xmlBuildURI(eschref, escbase);
- if (escbase != NULL)
- xmlFree(escbase);
- if (eschref != NULL)
- xmlFree(eschref);
- }
- if (URI == NULL) {
- xmlGenericError(xmlGenericErrorContext, "XInclude: failed build URL\n");
- if (parse != NULL)
- xmlFree(parse);
- if (href != NULL)
- xmlFree(href);
- if (base != NULL)
- xmlFree(base);
- return(-1);
- }
-#ifdef DEBUG_XINCLUDE
- xmlGenericError(xmlGenericErrorContext, "parse: %s\n",
- xml ? "xml": "text");
- xmlGenericError(xmlGenericErrorContext, "URI: %s\n", URI);
-#endif
-
- /*
- * Cleanup
- */
- if (xml) {
- ret = xmlXIncludeLoadDoc(ctxt, URI, nr);
- /* xmlXIncludeGetFragment(ctxt, cur, URI); */
- } else {
- ret = xmlXIncludeLoadTxt(ctxt, URI, nr);
- }
- if (ret < 0) {
- xmlNodePtr children;
-
- /*
- * Time to try a fallback if availble
- */
-#ifdef DEBUG_XINCLUDE
- xmlGenericError(xmlGenericErrorContext, "error looking for fallback\n");
-#endif
- children = cur->children;
- while (children != NULL) {
- if ((children->type == XML_ELEMENT_NODE) &&
- (children->ns != NULL) &&
- (xmlStrEqual(children->name, XINCLUDE_FALLBACK)) &&
- (xmlStrEqual(children->ns->href, XINCLUDE_NS))) {
- ret = xmlXIncludeLoadFallback(ctxt, children, nr);
- if (ret == 0)
- break;
- }
- children = children->next;
- }
- }
- if (ret < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: could not load %s, and no fallback was found\n",
- URI);
- }
-
- /*
- * Cleanup
- */
- if (URI != NULL)
- xmlFree(URI);
- if (parse != NULL)
- xmlFree(parse);
- if (href != NULL)
- xmlFree(href);
- if (base != NULL)
- xmlFree(base);
- return(0);
-}
-
-/**
- * xmlXIncludeIncludeNode:
- * @ctxt: an XInclude context
- * @nr: the node number
- *
- * Inplement the infoset replacement for the given node
- *
- * Returns 0 if substitution succeeded, -1 if some processing failed
- */
-static int
-xmlXIncludeIncludeNode(xmlXIncludeCtxtPtr ctxt, int nr) {
- xmlNodePtr cur, end, list;
-
- if (ctxt == NULL)
- return(-1);
- if ((nr < 0) || (nr >= ctxt->incNr))
- return(-1);
- cur = ctxt->incTab[nr]->ref;
- if (cur == NULL)
- return(-1);
-
- /*
- * Change the current node as an XInclude start one, and add an
- * entity end one
- */
- cur->type = XML_XINCLUDE_START;
- end = xmlNewNode(cur->ns, cur->name);
- if (end == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "XInclude: failed to build node\n");
- return(-1);
- }
- end->type = XML_XINCLUDE_END;
- xmlAddNextSibling(cur, end);
-
- /*
- * Add the list of nodes
- */
- list = ctxt->incTab[nr]->inc;
- ctxt->incTab[nr]->inc = NULL;
- while (list != NULL) {
- cur = list;
- list = list->next;
-
- xmlAddPrevSibling(end, cur);
- }
-
-
- return(0);
-}
-
-/**
- * xmlXIncludeTestNode:
- * @node: an XInclude node
- *
- * test if the node is an XInclude node
- *
- * Returns 1 true, 0 otherwise
- */
-static int
-xmlXIncludeTestNode(xmlNodePtr node) {
- if (node == NULL)
- return(0);
- if (node->ns == NULL)
- return(0);
- if ((xmlStrEqual(node->name, XINCLUDE_NODE)) &&
- (xmlStrEqual(node->ns->href, XINCLUDE_NS))) return(1);
- return(0);
-}
-
-/**
- * xmlXIncludeDoProcess:
- * @ctxt:
- * @doc: an XML document
- *
- * Implement the XInclude substitution on the XML document @doc
- *
- * Returns 0 if no substitution were done, -1 if some processing failed
- * or the number of substitutions done.
- */
-static int
-xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc) {
- xmlNodePtr cur;
- int ret = 0;
- int i;
-
- if (doc == NULL)
- return(-1);
- if (ctxt == NULL)
- return(-1);
-
- /*
- * First phase: lookup the elements in the document
- */
- cur = xmlDocGetRootElement(doc);
- if (xmlXIncludeTestNode(cur))
- xmlXIncludePreProcessNode(ctxt, cur);
- while (cur != NULL) {
- /* TODO: need to work on entities -> stack */
- if ((cur->children != NULL) &&
- (cur->children->type != XML_ENTITY_DECL)) {
- cur = cur->children;
- if (xmlXIncludeTestNode(cur))
- xmlXIncludePreProcessNode(ctxt, cur);
- } else if (cur->next != NULL) {
- cur = cur->next;
- if (xmlXIncludeTestNode(cur))
- xmlXIncludePreProcessNode(ctxt, cur);
- } else {
- do {
- cur = cur->parent;
- if (cur == NULL) break; /* do */
- if (cur->next != NULL) {
- cur = cur->next;
- if (xmlXIncludeTestNode(cur))
- xmlXIncludePreProcessNode(ctxt, cur);
- break; /* do */
- }
- } while (cur != NULL);
- }
- }
-
- /*
- * Second Phase : collect the infosets fragments
- */
- /*
- for (i = ctxt->incBase;i < ctxt->incNr; i++) {
- xmlXIncludePreloadNode(ctxt, i);
- }
- */
- for (i = ctxt->incBase;i < ctxt->incNr; i++) {
- xmlXIncludeLoadNode(ctxt, i);
- }
-
- /*
- * Third phase: extend the original document infoset.
- */
- for (i = ctxt->incBase;i < ctxt->incNr; i++) {
- xmlXIncludeIncludeNode(ctxt, i);
- }
-
- return(ret);
-}
-
-/**
- * xmlXIncludeProcess:
- * @doc: an XML document
- *
- * Implement the XInclude substitution on the XML document @doc
- *
- * Returns 0 if no substitution were done, -1 if some processing failed
- * or the number of substitutions done.
- */
-int
-xmlXIncludeProcess(xmlDocPtr doc) {
- xmlXIncludeCtxtPtr ctxt;
- int ret = 0;
-
- if (doc == NULL)
- return(-1);
- ctxt = xmlXIncludeNewContext(doc);
- if (ctxt == NULL)
- return(-1);
- ret = xmlXIncludeDoProcess(ctxt, doc);
-
- xmlXIncludeFreeContext(ctxt);
- return(ret);
-}
-
-#else /* !LIBXML_XINCLUDE_ENABLED */
-#endif
diff --git a/bundle/libxml/xlink.c b/bundle/libxml/xlink.c
deleted file mode 100644
index 17ec77f66f..0000000000
--- a/bundle/libxml/xlink.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * xlink.c : implementation of the hyperlinks detection module
- * This version supports both XML XLinks and HTML simple links
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#include <string.h> /* for memset() only */
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_ZLIB_H
-#include <zlib.h>
-#endif
-
-#include <libxml/xmlmemory.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/valid.h>
-#include <libxml/xlink.h>
-#include <libxml/globals.h>
-
-#define XLINK_NAMESPACE (BAD_CAST "http://www.w3.org/1999/xlink/namespace/")
-#define XHTML_NAMESPACE (BAD_CAST "http://www.w3.org/1999/xhtml/")
-
-/****************************************************************
- * *
- * Default setting and related functions *
- * *
- ****************************************************************/
-
-static xlinkHandlerPtr xlinkDefaultHandler = NULL;
-static xlinkNodeDetectFunc xlinkDefaultDetect = NULL;
-
-/**
- * xlinkGetDefaultHandler:
- *
- * Get the default xlink handler.
- *
- * Returns the current xlinkHandlerPtr value.
- */
-xlinkHandlerPtr
-xlinkGetDefaultHandler(void) {
- return(xlinkDefaultHandler);
-}
-
-
-/**
- * xlinkSetDefaultHandler:
- * @handler: the new value for the xlink handler block
- *
- * Set the default xlink handlers
- */
-void
-xlinkSetDefaultHandler(xlinkHandlerPtr handler) {
- xlinkDefaultHandler = handler;
-}
-
-/**
- * xlinkGetDefaultDetect:
- *
- * Get the default xlink detection routine
- *
- * Returns the current function or NULL;
- */
-xlinkNodeDetectFunc
-xlinkGetDefaultDetect (void) {
- return(xlinkDefaultDetect);
-}
-
-/**
- * xlinkSetDefaultDetect:
- * @func: pointer to the new detection routine.
- *
- * Set the default xlink detection routine
- */
-void
-xlinkSetDefaultDetect (xlinkNodeDetectFunc func) {
- xlinkDefaultDetect = func;
-}
-
-/****************************************************************
- * *
- * The detection routines *
- * *
- ****************************************************************/
-
-
-/**
- * xlinkIsLink:
- * @doc: the document containing the node
- * @node: the node pointer itself
- *
- * Check whether the given node carries the attributes needed
- * to be a link element (or is one of the linking elements issued
- * from the (X)HTML DtDs).
- * This routine don't try to do full checking of the link validity
- * but tries to detect and return the appropriate link type.
- *
- * Returns the xlinkType of the node (XLINK_TYPE_NONE if there is no
- * link detected.
- */
-xlinkType
-xlinkIsLink (xmlDocPtr doc, xmlNodePtr node) {
- xmlChar *type = NULL, *role = NULL;
- xlinkType ret = XLINK_TYPE_NONE;
-
- if (node == NULL) return(XLINK_TYPE_NONE);
- if (doc == NULL) doc = node->doc;
- if ((doc != NULL) && (doc->type == XML_HTML_DOCUMENT_NODE)) {
- /*
- * This is an HTML document.
- */
- } else if ((node->ns != NULL) &&
- (xmlStrEqual(node->ns->href, XHTML_NAMESPACE))) {
- /*
- * !!!! We really need an IS_XHTML_ELEMENT function from HTMLtree.h @@@
- */
- /*
- * This is an XHTML element within an XML document
- * Check whether it's one of the element able to carry links
- * and in that case if it holds the attributes.
- */
- }
-
- /*
- * We don't prevent a-priori having XML Linking constructs on
- * XHTML elements
- */
- type = xmlGetNsProp(node, BAD_CAST"type", XLINK_NAMESPACE);
- if (type != NULL) {
- if (!xmlStrEqual(type, BAD_CAST "simple")) {
- ret = XLINK_TYPE_SIMPLE;
- } if (!xmlStrEqual(type, BAD_CAST "extended")) {
- role = xmlGetNsProp(node, BAD_CAST "role", XLINK_NAMESPACE);
- if (role != NULL) {
- xmlNsPtr xlink;
- xlink = xmlSearchNs(doc, node, XLINK_NAMESPACE);
- if (xlink == NULL) {
- /* Humm, fallback method */
- if (xmlStrEqual(role, BAD_CAST"xlink:external-linkset"))
- ret = XLINK_TYPE_EXTENDED_SET;
- } else {
- xmlChar buf[200];
- snprintf((char *) buf, sizeof(buf), "%s:external-linkset",
- (char *) xlink->prefix);
- buf[sizeof(buf) - 1] = 0;
- if (xmlStrEqual(role, buf))
- ret = XLINK_TYPE_EXTENDED_SET;
-
- }
-
- }
- ret = XLINK_TYPE_EXTENDED;
- }
- }
-
- if (type != NULL) xmlFree(type);
- if (role != NULL) xmlFree(role);
- return(ret);
-}
diff --git a/bundle/libxml/xmlIO.c b/bundle/libxml/xmlIO.c
deleted file mode 100644
index 8bd9f9ca18..0000000000
--- a/bundle/libxml/xmlIO.c
+++ /dev/null
@@ -1,2839 +0,0 @@
-/*
- * xmlIO.c : implementation of the I/O interfaces used by the parser
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- *
- * 14 Nov 2000 ht - for VMS, truncated name of long functions to under 32 char
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#include <string.h>
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_ZLIB_H
-#include <zlib.h>
-#endif
-
-/* Figure a portable way to know if a file is a directory. */
-#ifndef HAVE_STAT
-# ifdef HAVE__STAT
- /* MS C library seems to define stat and _stat. The definition
- is identical. Still, mapping them to each other causes a warning. */
-# ifndef _MSC_VER
-# define stat(x,y) _stat(x,y)
-# endif
-# define HAVE_STAT
-# endif
-#endif
-#ifdef HAVE_STAT
-# ifndef S_ISDIR
-# ifdef _S_ISDIR
-# define S_ISDIR(x) _S_ISDIR(x)
-# else
-# ifdef S_IFDIR
-# ifndef S_IFMT
-# ifdef _S_IFMT
-# define S_IFMT _S_IFMT
-# endif
-# endif
-# ifdef S_IFMT
-# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-# endif
-# endif
-# endif
-# endif
-#endif
-
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-#include <libxml/xmlIO.h>
-#include <libxml/uri.h>
-#include <libxml/nanohttp.h>
-#include <libxml/nanoftp.h>
-#include <libxml/xmlerror.h>
-#ifdef LIBXML_CATALOG_ENABLED
-#include <libxml/catalog.h>
-#endif
-#include <libxml/globals.h>
-
-/* #define VERBOSE_FAILURE */
-/* #define DEBUG_EXTERNAL_ENTITIES */
-/* #define DEBUG_INPUT */
-
-#ifdef DEBUG_INPUT
-#define MINLEN 40
-#else
-#define MINLEN 4000
-#endif
-
-/*
- * Input I/O callback sets
- */
-typedef struct _xmlInputCallback {
- xmlInputMatchCallback matchcallback;
- xmlInputOpenCallback opencallback;
- xmlInputReadCallback readcallback;
- xmlInputCloseCallback closecallback;
-} xmlInputCallback;
-
-#define MAX_INPUT_CALLBACK 15
-
-static xmlInputCallback xmlInputCallbackTable[MAX_INPUT_CALLBACK];
-static int xmlInputCallbackNr = 0;
-static int xmlInputCallbackInitialized = 0;
-
-/*
- * Output I/O callback sets
- */
-typedef struct _xmlOutputCallback {
- xmlOutputMatchCallback matchcallback;
- xmlOutputOpenCallback opencallback;
- xmlOutputWriteCallback writecallback;
- xmlOutputCloseCallback closecallback;
-} xmlOutputCallback;
-
-#define MAX_OUTPUT_CALLBACK 15
-
-static xmlOutputCallback xmlOutputCallbackTable[MAX_OUTPUT_CALLBACK];
-static int xmlOutputCallbackNr = 0;
-static int xmlOutputCallbackInitialized = 0;
-
-/************************************************************************
- * *
- * Handling of Windows file paths *
- * *
- ************************************************************************/
-
-#define IS_WINDOWS_PATH(p) \
- ((p != NULL) && \
- (((p[0] >= 'a') && (p[0] <= 'z')) || \
- ((p[0] >= 'A') && (p[0] <= 'Z'))) && \
- (p[1] == ':') && ((p[2] == '/') || (p[2] == '\\')))
-
-
-/**
- * xmlNormalizeWindowsPath:
- * @path: a windows path like "C:/foo/bar"
- *
- * Normalize a Windows path to make an URL from it
- *
- * Returns a new URI which must be freed by the caller or NULL
- * in case of error
- */
-xmlChar *
-xmlNormalizeWindowsPath(const xmlChar *path)
-{
- int len, i = 0, j;
- xmlChar *ret;
-
- if (path == NULL)
- return(NULL);
-
- len = xmlStrlen(path);
- if (!IS_WINDOWS_PATH(path)) {
- ret = xmlStrdup(path);
- if (ret == NULL)
- return(NULL);
- j = 0;
- } else {
- ret = xmlMalloc(len + 10);
- if (ret == NULL)
- return(NULL);
- ret[0] = 'f';
- ret[1] = 'i';
- ret[2] = 'l';
- ret[3] = 'e';
- ret[4] = ':';
- ret[5] = '/';
- ret[6] = '/';
- ret[7] = '/';
- j = 8;
- }
-
- while (i < len) {
- /* TODO: UTF8 conversion + URI escaping ??? */
- if (path[i] == '\\')
- ret[j] = '/';
- else
- ret[j] = path[i];
- i++;
- j++;
- }
- ret[j] = 0;
-
- return(ret);
-}
-
-/**
- * xmlCleanupInputCallbacks:
- *
- * clears the entire input callback table. this includes the
- * compiled-in I/O.
- */
-void
-xmlCleanupInputCallbacks(void)
-{
- int i;
-
- if (!xmlInputCallbackInitialized)
- return;
-
- for (i = xmlInputCallbackNr - 1; i >= 0; i--) {
- xmlInputCallbackTable[i].matchcallback = NULL;
- xmlInputCallbackTable[i].opencallback = NULL;
- xmlInputCallbackTable[i].readcallback = NULL;
- xmlInputCallbackTable[i].closecallback = NULL;
- }
- xmlInputCallbackInitialized = 0;
-
- xmlInputCallbackNr = 0;
- xmlInputCallbackInitialized = 0;
-}
-
-/**
- * xmlCleanupOutputCallbacks:
- *
- * clears the entire output callback table. this includes the
- * compiled-in I/O callbacks.
- */
-void
-xmlCleanupOutputCallbacks(void)
-{
- int i;
-
- if (!xmlOutputCallbackInitialized)
- return;
-
- for (i = xmlOutputCallbackNr - 1; i >= 0; i--) {
- xmlOutputCallbackTable[i].matchcallback = NULL;
- xmlOutputCallbackTable[i].opencallback = NULL;
- xmlOutputCallbackTable[i].writecallback = NULL;
- xmlOutputCallbackTable[i].closecallback = NULL;
- }
- xmlOutputCallbackInitialized = 0;
-
- xmlOutputCallbackNr = 0;
- xmlOutputCallbackInitialized = 0;
-}
-
-/************************************************************************
- * *
- * Standard I/O for file accesses *
- * *
- ************************************************************************/
-
-/**
- * xmlCheckFilename:
- * @path: the path to check
- *
- * function checks to see if @path is a valid source
- * (file, socket...) for XML.
- *
- * if stat is not available on the target machine,
- * returns 1. if stat fails, returns 0 (if calling
- * stat on the filename fails, it can't be right).
- * if stat succeeds and the file is a directory,
- * returns 2. otherwise returns 1.
- */
-
-int
-xmlCheckFilename (const char *path)
-{
-#ifdef HAVE_STAT
- struct stat stat_buffer;
-
- if (stat(path, &stat_buffer) == -1)
- return 0;
-
-#ifdef S_ISDIR
- if (S_ISDIR(stat_buffer.st_mode)) {
- return 2;
- }
-#endif
-#endif
- return 1;
-}
-
-static int
-xmlNop(void) {
- return(0);
-}
-
-/**
- * xmlFdRead:
- * @context: the I/O context
- * @buffer: where to drop data
- * @len: number of bytes to read
- *
- * Read @len bytes to @buffer from the I/O channel.
- *
- * Returns the number of bytes written
- */
-static int
-xmlFdRead (void * context, char * buffer, int len) {
- return(read((int) (long) context, &buffer[0], len));
-}
-
-/**
- * xmlFdWrite:
- * @context: the I/O context
- * @buffer: where to get data
- * @len: number of bytes to write
- *
- * Write @len bytes from @buffer to the I/O channel.
- *
- * Returns the number of bytes written
- */
-static int
-xmlFdWrite (void * context, const char * buffer, int len) {
- return(write((int) (long) context, &buffer[0], len));
-}
-
-/**
- * xmlFdClose:
- * @context: the I/O context
- *
- * Close an I/O channel
- *
- * Returns 0 in case of success and error code otherwise
- */
-static int
-xmlFdClose (void * context) {
- return ( close((int) (long) context) );
-}
-
-/**
- * xmlFileMatch:
- * @filename: the URI for matching
- *
- * input from FILE *
- *
- * Returns 1 if matches, 0 otherwise
- */
-int
-xmlFileMatch (const char *filename ATTRIBUTE_UNUSED) {
- return(1);
-}
-
-/**
- * xmlFileOpen:
- * @filename: the URI for matching
- *
- * input from FILE *, supports compressed input
- * if @filename is " " then the standard input is used
- *
- * Returns an I/O context or NULL in case of error
- */
-void *
-xmlFileOpen (const char *filename) {
- const char *path = NULL;
- FILE *fd;
-
- if (!strcmp(filename, "-")) {
- fd = stdin;
- return((void *) fd);
- }
-
- if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17))
-#if defined (_WIN32) && !defined(__CYGWIN__)
- path = &filename[17];
-#else
- path = &filename[16];
-#endif
- else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
-#if defined (_WIN32) && !defined(__CYGWIN__)
- path = &filename[8];
-#else
- path = &filename[7];
-#endif
- } else
- path = filename;
-
- if (path == NULL)
- return(NULL);
- if (!xmlCheckFilename(path))
- return(NULL);
-
-#if defined(WIN32) || defined (__CYGWIN__)
- fd = fopen(path, "rb");
-#else
- fd = fopen(path, "r");
-#endif /* WIN32 */
- return((void *) fd);
-}
-
-/**
- * xmlFileOpenW:
- * @filename: the URI for matching
- *
- * output to from FILE *,
- * if @filename is "-" then the standard output is used
- *
- * Returns an I/O context or NULL in case of error
- */
-static void *
-xmlFileOpenW (const char *filename) {
- const char *path = NULL;
- FILE *fd;
-
- if (!strcmp(filename, "-")) {
- fd = stdout;
- return((void *) fd);
- }
-
- if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17))
-#if defined (_WIN32) && !defined(__CYGWIN__)
- path = &filename[17];
-#else
- path = &filename[16];
-#endif
- else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
-#if defined (_WIN32) && !defined(__CYGWIN__)
- path = &filename[8];
-#else
- path = &filename[7];
-#endif
- } else
- path = filename;
-
- if (path == NULL)
- return(NULL);
-
- fd = fopen(path, "w");
- return((void *) fd);
-}
-
-/**
- * xmlFileRead:
- * @context: the I/O context
- * @buffer: where to drop data
- * @len: number of bytes to write
- *
- * Read @len bytes to @buffer from the I/O channel.
- *
- * Returns the number of bytes written
- */
-int
-xmlFileRead (void * context, char * buffer, int len) {
- return(fread(&buffer[0], 1, len, (FILE *) context));
-}
-
-/**
- * xmlFileWrite:
- * @context: the I/O context
- * @buffer: where to drop data
- * @len: number of bytes to write
- *
- * Write @len bytes from @buffer to the I/O channel.
- *
- * Returns the number of bytes written
- */
-static int
-xmlFileWrite (void * context, const char * buffer, int len) {
- return(fwrite(&buffer[0], 1, len, (FILE *) context));
-}
-
-/**
- * xmlFileClose:
- * @context: the I/O context
- *
- * Close an I/O channel
- *
- * Returns 0 or -1 in case of error
- */
-int
-xmlFileClose (void * context) {
- FILE *fil;
-
- fil = (FILE *) context;
- if (fil == stdin)
- return(0);
- if (fil == stdout)
- return(0);
- if (fil == stderr)
- return(0);
- return ( ( fclose((FILE *) context) == EOF ) ? -1 : 0 );
-}
-
-/**
- * xmlFileFlush:
- * @context: the I/O context
- *
- * Flush an I/O channel
- */
-static int
-xmlFileFlush (void * context) {
- return ( ( fflush((FILE *) context) == EOF ) ? -1 : 0 );
-}
-
-#ifdef HAVE_ZLIB_H
-/************************************************************************
- * *
- * I/O for compressed file accesses *
- * *
- ************************************************************************/
-/**
- * xmlGzfileMatch:
- * @filename: the URI for matching
- *
- * input from compressed file test
- *
- * Returns 1 if matches, 0 otherwise
- */
-static int
-xmlGzfileMatch (const char *filename ATTRIBUTE_UNUSED) {
- return(1);
-}
-
-/**
- * xmlGzfileOpen:
- * @filename: the URI for matching
- *
- * input from compressed file open
- * if @filename is " " then the standard input is used
- *
- * Returns an I/O context or NULL in case of error
- */
-static void *
-xmlGzfileOpen (const char *filename) {
- const char *path = NULL;
- gzFile fd;
-
- if (!strcmp(filename, "-")) {
- fd = gzdopen(dup(0), "rb");
- return((void *) fd);
- }
-
- if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17))
-#if defined (_WIN32) && !defined(__CYGWIN__)
- path = &filename[17];
-#else
- path = &filename[16];
-#endif
- else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
-#if defined (_WIN32) && !defined(__CYGWIN__)
- path = &filename[8];
-#else
- path = &filename[7];
-#endif
- } else
- path = filename;
-
- if (path == NULL)
- return(NULL);
- if (!xmlCheckFilename(path))
- return(NULL);
-
- fd = gzopen(path, "rb");
- return((void *) fd);
-}
-
-/**
- * xmlGzfileOpenW:
- * @filename: the URI for matching
- * @compression: the compression factor (0 - 9 included)
- *
- * input from compressed file open
- * if @filename is " " then the standard input is used
- *
- * Returns an I/O context or NULL in case of error
- */
-static void *
-xmlGzfileOpenW (const char *filename, int compression) {
- const char *path = NULL;
- char mode[15];
- gzFile fd;
-
- snprintf(mode, sizeof(mode), "wb%d", compression);
- if (!strcmp(filename, "-")) {
- fd = gzdopen(dup(1), mode);
- return((void *) fd);
- }
-
- if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17))
-#if defined (_WIN32) && !defined(__CYGWIN__)
- path = &filename[17];
-#else
- path = &filename[16];
-#endif
- else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
-#if defined (_WIN32) && !defined(__CYGWIN__)
- path = &filename[8];
-#else
- path = &filename[7];
-#endif
- } else
- path = filename;
-
- if (path == NULL)
- return(NULL);
-
- fd = gzopen(path, mode);
- return((void *) fd);
-}
-
-/**
- * xmlGzfileRead:
- * @context: the I/O context
- * @buffer: where to drop data
- * @len: number of bytes to write
- *
- * Read @len bytes to @buffer from the compressed I/O channel.
- *
- * Returns the number of bytes written
- */
-static int
-xmlGzfileRead (void * context, char * buffer, int len) {
- return(gzread((gzFile) context, &buffer[0], len));
-}
-
-/**
- * xmlGzfileWrite:
- * @context: the I/O context
- * @buffer: where to drop data
- * @len: number of bytes to write
- *
- * Write @len bytes from @buffer to the compressed I/O channel.
- *
- * Returns the number of bytes written
- */
-static int
-xmlGzfileWrite (void * context, const char * buffer, int len) {
- return(gzwrite((gzFile) context, (char *) &buffer[0], len));
-}
-
-/**
- * xmlGzfileClose:
- * @context: the I/O context
- *
- * Close a compressed I/O channel
- */
-static int
-xmlGzfileClose (void * context) {
- return ( ( gzclose((gzFile) context) == Z_OK ) ? 0 : -1 );
-}
-#endif /* HAVE_ZLIB_H */
-
-#ifdef LIBXML_HTTP_ENABLED
-/************************************************************************
- * *
- * I/O for HTTP file accesses *
- * *
- ************************************************************************/
-
-typedef struct xmlIOHTTPWriteCtxt_
-{
- int compression;
-
- char * uri;
-
- void * doc_buff;
-
-} xmlIOHTTPWriteCtxt, *xmlIOHTTPWriteCtxtPtr;
-
-#ifdef HAVE_ZLIB_H
-
-#define DFLT_WBITS ( -15 )
-#define DFLT_MEM_LVL ( 8 )
-#define GZ_MAGIC1 ( 0x1f )
-#define GZ_MAGIC2 ( 0x8b )
-#define LXML_ZLIB_OS_CODE ( 0x03 )
-#define INIT_HTTP_BUFF_SIZE ( 32768 )
-#define DFLT_ZLIB_RATIO ( 5 )
-
-/*
-** Data structure and functions to work with sending compressed data
-** via HTTP.
-*/
-
-typedef struct xmlZMemBuff_
-{
- unsigned long size;
- unsigned long crc;
-
- unsigned char * zbuff;
- z_stream zctrl;
-
-} xmlZMemBuff, *xmlZMemBuffPtr;
-
-/**
- * append_reverse_ulong
- * @buff: Compressed memory buffer
- * @data: Unsigned long to append
- *
- * Append a unsigned long in reverse byte order to the end of the
- * memory buffer.
- */
-static void
-append_reverse_ulong( xmlZMemBuff * buff, unsigned long data ) {
-
- int idx;
-
- if ( buff == NULL )
- return;
-
- /*
- ** This is plagiarized from putLong in gzio.c (zlib source) where
- ** the number "4" is hardcoded. If zlib is ever patched to
- ** support 64 bit file sizes, this code would need to be patched
- ** as well.
- */
-
- for ( idx = 0; idx < 4; idx++ ) {
- *buff->zctrl.next_out = ( data & 0xff );
- data >>= 8;
- buff->zctrl.next_out++;
- }
-
- return;
-}
-
-/**
- *
- * xmlFreeZMemBuff
- * @buff: The memory buffer context to clear
- *
- * Release all the resources associated with the compressed memory buffer.
- */
-static void
-xmlFreeZMemBuff( xmlZMemBuffPtr buff ) {
-
- int z_err;
-
- if ( buff == NULL )
- return;
-
- xmlFree( buff->zbuff );
- z_err = deflateEnd( &buff->zctrl );
-#ifdef DEBUG_HTTP
- if ( z_err != Z_OK )
- xmlGenericError( xmlGenericErrorContext,
- "xmlFreeZMemBuff: Error releasing zlib context: %d\n",
- z_err );
-#endif
-
- xmlFree( buff );
- return;
-}
-
-/**
- * xmlCreateZMemBuff
- *@compression: Compression value to use
- *
- * Create a memory buffer to hold the compressed XML document. The
- * compressed document in memory will end up being identical to what
- * would be created if gzopen/gzwrite/gzclose were being used to
- * write the document to disk. The code for the header/trailer data to
- * the compression is plagiarized from the zlib source files.
- */
-static void *
-xmlCreateZMemBuff( int compression ) {
-
- int z_err;
- int hdr_lgth;
- xmlZMemBuffPtr buff = NULL;
-
- if ( ( compression < 1 ) || ( compression > 9 ) )
- return ( NULL );
-
- /* Create the control and data areas */
-
- buff = xmlMalloc( sizeof( xmlZMemBuff ) );
- if ( buff == NULL ) {
- xmlGenericError( xmlGenericErrorContext,
- "xmlCreateZMemBuff: %s\n",
- "Failure allocating buffer context." );
- return ( NULL );
- }
-
- (void)memset( buff, 0, sizeof( xmlZMemBuff ) );
- buff->size = INIT_HTTP_BUFF_SIZE;
- buff->zbuff = xmlMalloc( buff->size );
- if ( buff->zbuff == NULL ) {
- xmlFreeZMemBuff( buff );
- xmlGenericError( xmlGenericErrorContext,
- "xmlCreateZMemBuff: %s\n",
- "Failure allocating data buffer." );
- return ( NULL );
- }
-
- z_err = deflateInit2( &buff->zctrl, compression, Z_DEFLATED,
- DFLT_WBITS, DFLT_MEM_LVL, Z_DEFAULT_STRATEGY );
- if ( z_err != Z_OK ) {
- xmlFreeZMemBuff( buff );
- buff = NULL;
- xmlGenericError( xmlGenericErrorContext,
- "xmlCreateZMemBuff: %s %d\n",
- "Error initializing compression context. ZLIB error:",
- z_err );
- return ( NULL );
- }
-
- /* Set the header data. The CRC will be needed for the trailer */
- buff->crc = crc32( 0L, Z_NULL, 0 );
- hdr_lgth = snprintf( (char *)buff->zbuff, buff->size,
- "%c%c%c%c%c%c%c%c%c%c",
- GZ_MAGIC1, GZ_MAGIC2, Z_DEFLATED,
- 0, 0, 0, 0, 0, 0, LXML_ZLIB_OS_CODE );
- buff->zctrl.next_out = buff->zbuff + hdr_lgth;
- buff->zctrl.avail_out = buff->size - hdr_lgth;
-
- return ( buff );
-}
-
-/**
- * xmlZMemBuffExtend
- * @buff: Buffer used to compress and consolidate data.
- * @ext_amt: Number of bytes to extend the buffer.
- *
- * Extend the internal buffer used to store the compressed data by the
- * specified amount.
- *
- * Returns 0 on success or -1 on failure to extend the buffer. On failure
- * the original buffer still exists at the original size.
- */
-static int
-xmlZMemBuffExtend( xmlZMemBuffPtr buff, size_t ext_amt ) {
-
- int rc = -1;
- size_t new_size;
- size_t cur_used;
-
- unsigned char * tmp_ptr = NULL;
-
- if ( buff == NULL )
- return ( -1 );
-
- else if ( ext_amt == 0 )
- return ( 0 );
-
- cur_used = buff->zctrl.next_out - buff->zbuff;
- new_size = buff->size + ext_amt;
-
-#ifdef DEBUG_HTTP
- if ( cur_used > new_size )
- xmlGenericError( xmlGenericErrorContext,
- "xmlZMemBuffExtend: %s\n%s %d bytes.\n",
- "Buffer overwrite detected during compressed memory",
- "buffer extension. Overflowed by",
- (cur_used - new_size ) );
-#endif
-
- tmp_ptr = xmlRealloc( buff->zbuff, new_size );
- if ( tmp_ptr != NULL ) {
- rc = 0;
- buff->size = new_size;
- buff->zbuff = tmp_ptr;
- buff->zctrl.next_out = tmp_ptr + cur_used;
- buff->zctrl.avail_out = new_size - cur_used;
- }
- else {
- xmlGenericError( xmlGenericErrorContext,
- "xmlZMemBuffExtend: %s %lu bytes.\n",
- "Allocation failure extending output buffer to",
- new_size );
- }
-
- return ( rc );
-}
-
-/**
- * xmlZMemBuffAppend
- * @buff: Buffer used to compress and consolidate data
- * @src: Uncompressed source content to append to buffer
- * @len: Length of source data to append to buffer
- *
- * Compress and append data to the internal buffer. The data buffer
- * will be expanded if needed to store the additional data.
- *
- * Returns the number of bytes appended to the buffer or -1 on error.
- */
-static int
-xmlZMemBuffAppend( xmlZMemBuffPtr buff, const char * src, int len ) {
-
- int z_err;
- size_t min_accept;
-
- if ( ( buff == NULL ) || ( src == NULL ) )
- return ( -1 );
-
- buff->zctrl.avail_in = len;
- buff->zctrl.next_in = (unsigned char *)src;
- while ( buff->zctrl.avail_in > 0 ) {
- /*
- ** Extend the buffer prior to deflate call if a reasonable amount
- ** of output buffer space is not available.
- */
- min_accept = buff->zctrl.avail_in / DFLT_ZLIB_RATIO;
- if ( buff->zctrl.avail_out <= min_accept ) {
- if ( xmlZMemBuffExtend( buff, buff->size ) == -1 )
- return ( -1 );
- }
-
- z_err = deflate( &buff->zctrl, Z_NO_FLUSH );
- if ( z_err != Z_OK ) {
- xmlGenericError( xmlGenericErrorContext,
- "xmlZMemBuffAppend: %s %d %s - %d",
- "Compression error while appending",
- len, "bytes to buffer. ZLIB error", z_err );
- return ( -1 );
- }
- }
-
- buff->crc = crc32( buff->crc, (unsigned char *)src, len );
-
- return ( len );
-}
-
-/**
- * xmlZMemBuffGetContent
- * @buff: Compressed memory content buffer
- * @data_ref: Pointer reference to point to compressed content
- *
- * Flushes the compression buffers, appends gzip file trailers and
- * returns the compressed content and length of the compressed data.
- * NOTE: The gzip trailer code here is plagiarized from zlib source.
- *
- * Returns the length of the compressed data or -1 on error.
- */
-static int
-xmlZMemBuffGetContent( xmlZMemBuffPtr buff, char ** data_ref ) {
-
- int zlgth = -1;
- int z_err;
-
- if ( ( buff == NULL ) || ( data_ref == NULL ) )
- return ( -1 );
-
- /* Need to loop until compression output buffers are flushed */
-
- do
- {
- z_err = deflate( &buff->zctrl, Z_FINISH );
- if ( z_err == Z_OK ) {
- /* In this case Z_OK means more buffer space needed */
-
- if ( xmlZMemBuffExtend( buff, buff->size ) == -1 )
- return ( -1 );
- }
- }
- while ( z_err == Z_OK );
-
- /* If the compression state is not Z_STREAM_END, some error occurred */
-
- if ( z_err == Z_STREAM_END ) {
-
- /* Need to append the gzip data trailer */
-
- if ( buff->zctrl.avail_out < ( 2 * sizeof( unsigned long ) ) ) {
- if ( xmlZMemBuffExtend(buff, (2 * sizeof(unsigned long))) == -1 )
- return ( -1 );
- }
-
- /*
- ** For whatever reason, the CRC and length data are pushed out
- ** in reverse byte order. So a memcpy can't be used here.
- */
-
- append_reverse_ulong( buff, buff->crc );
- append_reverse_ulong( buff, buff->zctrl.total_in );
-
- zlgth = buff->zctrl.next_out - buff->zbuff;
- *data_ref = (char *)buff->zbuff;
- }
-
- else
- xmlGenericError( xmlGenericErrorContext,
- "xmlZMemBuffGetContent: %s - %d\n",
- "Error flushing zlib buffers. Error code", z_err );
-
- return ( zlgth );
-}
-#endif /* HAVE_ZLIB_H */
-
-/**
- * xmlFreeHTTPWriteCtxt
- * @ctxt: Context to cleanup
- *
- * Free allocated memory and reclaim system resources.
- *
- * No return value.
- */
-static void
-xmlFreeHTTPWriteCtxt( xmlIOHTTPWriteCtxtPtr ctxt )
-{
- if ( ctxt->uri != NULL )
- xmlFree( ctxt->uri );
-
- if ( ctxt->doc_buff != NULL ) {
-
-#ifdef HAVE_ZLIB_H
- if ( ctxt->compression > 0 ) {
- xmlFreeZMemBuff( ctxt->doc_buff );
- }
- else
-#endif
- {
- xmlOutputBufferClose( ctxt->doc_buff );
- }
- }
-
- xmlFree( ctxt );
- return;
-}
-
-
-/**
- * xmlIOHTTPMatch:
- * @filename: the URI for matching
- *
- * check if the URI matches an HTTP one
- *
- * Returns 1 if matches, 0 otherwise
- */
-int
-xmlIOHTTPMatch (const char *filename) {
- if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "http://", 7))
- return(1);
- return(0);
-}
-
-/**
- * xmlIOHTTPOpen:
- * @filename: the URI for matching
- *
- * open an HTTP I/O channel
- *
- * Returns an I/O context or NULL in case of error
- */
-void *
-xmlIOHTTPOpen (const char *filename) {
- return(xmlNanoHTTPOpen(filename, NULL));
-}
-
-/**
- * xmlIOHTTPOpenW:
- * @post_uri: The destination URI for the document
- * @compression: The compression desired for the document.
- *
- * Open a temporary buffer to collect the document for a subsequent HTTP POST
- * request. Non-static as is called from the output buffer creation routine.
- *
- * Returns an I/O context or NULL in case of error.
- */
-
-void *
-xmlIOHTTPOpenW(const char *post_uri, int compression)
-{
-
- xmlIOHTTPWriteCtxtPtr ctxt = NULL;
-
- if (post_uri == NULL)
- return (NULL);
-
- ctxt = xmlMalloc(sizeof(xmlIOHTTPWriteCtxt));
- if (ctxt == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlIOHTTPOpenW: Failed to create output HTTP context.\n");
- return (NULL);
- }
-
- (void) memset(ctxt, 0, sizeof(xmlIOHTTPWriteCtxt));
-
- ctxt->uri = (char *) xmlStrdup((const xmlChar *)post_uri);
- if (ctxt->uri == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlIOHTTPOpenW: Failed to duplicate destination URI.\n");
- xmlFreeHTTPWriteCtxt(ctxt);
- return (NULL);
- }
-
- /*
- * ** Since the document length is required for an HTTP post,
- * ** need to put the document into a buffer. A memory buffer
- * ** is being used to avoid pushing the data to disk and back.
- */
-
-#ifdef HAVE_ZLIB_H
- if ((compression > 0) && (compression <= 9)) {
-
- ctxt->compression = compression;
- ctxt->doc_buff = xmlCreateZMemBuff(compression);
- } else
-#endif
- {
- /* Any character conversions should have been done before this */
-
- ctxt->doc_buff = xmlAllocOutputBuffer(NULL);
- }
-
- if (ctxt->doc_buff == NULL) {
- xmlFreeHTTPWriteCtxt(ctxt);
- ctxt = NULL;
- }
-
- return (ctxt);
-}
-
-/**
- * xmlIOHTTPDfltOpenW
- * @post_uri: The destination URI for this document.
- *
- * Calls xmlIOHTTPOpenW with no compression to set up for a subsequent
- * HTTP post command. This function should generally not be used as
- * the open callback is short circuited in xmlOutputBufferCreateFile.
- *
- * Returns a pointer to the new IO context.
- */
-static void *
-xmlIOHTTPDfltOpenW( const char * post_uri ) {
- return ( xmlIOHTTPOpenW( post_uri, 0 ) );
-}
-
-/**
- * xmlIOHTTPRead:
- * @context: the I/O context
- * @buffer: where to drop data
- * @len: number of bytes to write
- *
- * Read @len bytes to @buffer from the I/O channel.
- *
- * Returns the number of bytes written
- */
-int
-xmlIOHTTPRead(void * context, char * buffer, int len) {
- return(xmlNanoHTTPRead(context, &buffer[0], len));
-}
-
-/**
- * xmlIOHTTPWrite
- * @context: previously opened writing context
- * @buffer: data to output to temporary buffer
- * @len: bytes to output
- *
- * Collect data from memory buffer into a temporary file for later
- * processing.
- *
- * Returns number of bytes written.
- */
-
-static int
-xmlIOHTTPWrite( void * context, const char * buffer, int len ) {
-
- xmlIOHTTPWriteCtxtPtr ctxt = context;
-
- if ( ( ctxt == NULL ) || ( ctxt->doc_buff == NULL ) || ( buffer == NULL ) )
- return ( -1 );
-
- if ( len > 0 ) {
-
- /* Use gzwrite or fwrite as previously setup in the open call */
-
-#ifdef HAVE_ZLIB_H
- if ( ctxt->compression > 0 )
- len = xmlZMemBuffAppend( ctxt->doc_buff, buffer, len );
-
- else
-#endif
- len = xmlOutputBufferWrite( ctxt->doc_buff, len, buffer );
-
- if ( len < 0 ) {
- xmlGenericError( xmlGenericErrorContext,
- "xmlIOHTTPWrite: %s\n%s '%s'.\n",
- "Error appending to internal buffer.",
- "Error sending document to URI",
- ctxt->uri );
- }
- }
-
- return ( len );
-}
-
-
-/**
- * xmlIOHTTPClose:
- * @context: the I/O context
- *
- * Close an HTTP I/O channel
- *
- * Returns 0
- */
-int
-xmlIOHTTPClose (void * context) {
- xmlNanoHTTPClose(context);
- return 0;
-}
-
-/**
- * xmlIOHTTCloseWrite
- * @context: The I/O context
- * @http_mthd: The HTTP method to be used when sending the data
- *
- * Close the transmit HTTP I/O channel and actually send the data.
- */
-static int
-xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) {
-
- int close_rc = -1;
- int http_rtn = 0;
- int content_lgth = 0;
- xmlIOHTTPWriteCtxtPtr ctxt = context;
-
- char * http_content = NULL;
- char * content_encoding = NULL;
- char * content_type = (char *) "text/xml";
- void * http_ctxt = NULL;
-
- if ( ( ctxt == NULL ) || ( http_mthd == NULL ) )
- return ( -1 );
-
- /* Retrieve the content from the appropriate buffer */
-
-#ifdef HAVE_ZLIB_H
-
- if ( ctxt->compression > 0 ) {
- content_lgth = xmlZMemBuffGetContent( ctxt->doc_buff, &http_content );
- content_encoding = (char *) "Content-Encoding: gzip";
- }
- else
-#endif
- {
- /* Pull the data out of the memory output buffer */
-
- xmlOutputBufferPtr dctxt = ctxt->doc_buff;
- http_content = (char *)dctxt->buffer->content;
- content_lgth = dctxt->buffer->use;
- }
-
- if ( http_content == NULL ) {
- xmlGenericError( xmlGenericErrorContext,
- "xmlIOHTTPCloseWrite: %s '%s' %s '%s'.\n",
- "Error retrieving content.\nUnable to",
- http_mthd, "data to URI", ctxt->uri );
- }
-
- else {
-
- http_ctxt = xmlNanoHTTPMethod( ctxt->uri, http_mthd, http_content,
- &content_type, content_encoding,
- content_lgth );
-
- if ( http_ctxt != NULL ) {
-#ifdef DEBUG_HTTP
- /* If testing/debugging - dump reply with request content */
-
- FILE * tst_file = NULL;
- char buffer[ 4096 ];
- char * dump_name = NULL;
- int avail;
-
- xmlGenericError( xmlGenericErrorContext,
- "xmlNanoHTTPCloseWrite: HTTP %s to\n%s returned %d.\n",
- http_mthd, ctxt->uri,
- xmlNanoHTTPReturnCode( http_ctxt ) );
-
- /*
- ** Since either content or reply may be gzipped,
- ** dump them to separate files instead of the
- ** standard error context.
- */
-
- dump_name = tempnam( NULL, "lxml" );
- if ( dump_name != NULL ) {
- (void)snprintf( buffer, sizeof(buffer), "%s.content", dump_name );
-
- tst_file = fopen( buffer, "w" );
- if ( tst_file != NULL ) {
- xmlGenericError( xmlGenericErrorContext,
- "Transmitted content saved in file: %s\n", buffer );
-
- fwrite( http_content, sizeof( char ),
- content_lgth, tst_file );
- fclose( tst_file );
- }
-
- (void)snprintf( buffer, sizeof(buffer), "%s.reply", dump_name );
- tst_file = fopen( buffer, "w" );
- if ( tst_file != NULL ) {
- xmlGenericError( xmlGenericErrorContext,
- "Reply content saved in file: %s\n", buffer );
-
-
- while ( (avail = xmlNanoHTTPRead( http_ctxt,
- buffer, sizeof( buffer ) )) > 0 ) {
-
- fwrite( buffer, sizeof( char ), avail, tst_file );
- }
-
- fclose( tst_file );
- }
-
- free( dump_name );
- }
-#endif /* DEBUG_HTTP */
-
- http_rtn = xmlNanoHTTPReturnCode( http_ctxt );
- if ( ( http_rtn >= 200 ) && ( http_rtn < 300 ) )
- close_rc = 0;
- else
- xmlGenericError( xmlGenericErrorContext,
- "xmlIOHTTPCloseWrite: HTTP '%s' of %d %s\n'%s' %s %d\n",
- http_mthd, content_lgth,
- "bytes to URI", ctxt->uri,
- "failed. HTTP return code:", http_rtn );
-
- xmlNanoHTTPClose( http_ctxt );
- xmlFree( content_type );
- }
- }
-
- /* Final cleanups */
-
- xmlFreeHTTPWriteCtxt( ctxt );
-
- return ( close_rc );
-}
-
-/**
- * xmlIOHTTPClosePut
- *
- * @context: The I/O context
- *
- * Close the transmit HTTP I/O channel and actually send data using a PUT
- * HTTP method.
- */
-static int
-xmlIOHTTPClosePut( void * ctxt ) {
- return ( xmlIOHTTPCloseWrite( ctxt, "PUT" ) );
-}
-
-
-/**
- * xmlIOHTTPClosePost
- *
- * @context: The I/O context
- *
- * Close the transmit HTTP I/O channel and actually send data using a POST
- * HTTP method.
- */
-static int
-xmlIOHTTPClosePost( void * ctxt ) {
- return ( xmlIOHTTPCloseWrite( ctxt, "POST" ) );
-}
-
-#endif /* LIBXML_HTTP_ENABLED */
-
-#ifdef LIBXML_FTP_ENABLED
-/************************************************************************
- * *
- * I/O for FTP file accesses *
- * *
- ************************************************************************/
-/**
- * xmlIOFTPMatch:
- * @filename: the URI for matching
- *
- * check if the URI matches an FTP one
- *
- * Returns 1 if matches, 0 otherwise
- */
-int
-xmlIOFTPMatch (const char *filename) {
- if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "ftp://", 6))
- return(1);
- return(0);
-}
-
-/**
- * xmlIOFTPOpen:
- * @filename: the URI for matching
- *
- * open an FTP I/O channel
- *
- * Returns an I/O context or NULL in case of error
- */
-void *
-xmlIOFTPOpen (const char *filename) {
- return(xmlNanoFTPOpen(filename));
-}
-
-/**
- * xmlIOFTPRead:
- * @context: the I/O context
- * @buffer: where to drop data
- * @len: number of bytes to write
- *
- * Read @len bytes to @buffer from the I/O channel.
- *
- * Returns the number of bytes written
- */
-int
-xmlIOFTPRead(void * context, char * buffer, int len) {
- return(xmlNanoFTPRead(context, &buffer[0], len));
-}
-
-/**
- * xmlIOFTPClose:
- * @context: the I/O context
- *
- * Close an FTP I/O channel
- *
- * Returns 0
- */
-int
-xmlIOFTPClose (void * context) {
- return ( xmlNanoFTPClose(context) );
-}
-#endif /* LIBXML_FTP_ENABLED */
-
-
-/**
- * xmlRegisterInputCallbacks:
- * @matchFunc: the xmlInputMatchCallback
- * @openFunc: the xmlInputOpenCallback
- * @readFunc: the xmlInputReadCallback
- * @closeFunc: the xmlInputCloseCallback
- *
- * Register a new set of I/O callback for handling parser input.
- *
- * Returns the registered handler number or -1 in case of error
- */
-int
-xmlRegisterInputCallbacks(xmlInputMatchCallback matchFunc,
- xmlInputOpenCallback openFunc, xmlInputReadCallback readFunc,
- xmlInputCloseCallback closeFunc) {
- if (xmlInputCallbackNr >= MAX_INPUT_CALLBACK) {
- return(-1);
- }
- xmlInputCallbackTable[xmlInputCallbackNr].matchcallback = matchFunc;
- xmlInputCallbackTable[xmlInputCallbackNr].opencallback = openFunc;
- xmlInputCallbackTable[xmlInputCallbackNr].readcallback = readFunc;
- xmlInputCallbackTable[xmlInputCallbackNr].closecallback = closeFunc;
- return(xmlInputCallbackNr++);
-}
-
-/**
- * xmlRegisterOutputCallbacks:
- * @matchFunc: the xmlOutputMatchCallback
- * @openFunc: the xmlOutputOpenCallback
- * @writeFunc: the xmlOutputWriteCallback
- * @closeFunc: the xmlOutputCloseCallback
- *
- * Register a new set of I/O callback for handling output.
- *
- * Returns the registered handler number or -1 in case of error
- */
-int
-xmlRegisterOutputCallbacks(xmlOutputMatchCallback matchFunc,
- xmlOutputOpenCallback openFunc, xmlOutputWriteCallback writeFunc,
- xmlOutputCloseCallback closeFunc) {
- if (xmlOutputCallbackNr >= MAX_INPUT_CALLBACK) {
- return(-1);
- }
- xmlOutputCallbackTable[xmlOutputCallbackNr].matchcallback = matchFunc;
- xmlOutputCallbackTable[xmlOutputCallbackNr].opencallback = openFunc;
- xmlOutputCallbackTable[xmlOutputCallbackNr].writecallback = writeFunc;
- xmlOutputCallbackTable[xmlOutputCallbackNr].closecallback = closeFunc;
- return(xmlOutputCallbackNr++);
-}
-
-/**
- * xmlRegisterDefaultInputCallbacks:
- *
- * Registers the default compiled-in I/O handlers.
- */
-void
-xmlRegisterDefaultInputCallbacks
-(void) {
- if (xmlInputCallbackInitialized)
- return;
-
- xmlRegisterInputCallbacks(xmlFileMatch, xmlFileOpen,
- xmlFileRead, xmlFileClose);
-#ifdef HAVE_ZLIB_H
- xmlRegisterInputCallbacks(xmlGzfileMatch, xmlGzfileOpen,
- xmlGzfileRead, xmlGzfileClose);
-#endif /* HAVE_ZLIB_H */
-
-#ifdef LIBXML_HTTP_ENABLED
- xmlRegisterInputCallbacks(xmlIOHTTPMatch, xmlIOHTTPOpen,
- xmlIOHTTPRead, xmlIOHTTPClose);
-#endif /* LIBXML_HTTP_ENABLED */
-
-#ifdef LIBXML_FTP_ENABLED
- xmlRegisterInputCallbacks(xmlIOFTPMatch, xmlIOFTPOpen,
- xmlIOFTPRead, xmlIOFTPClose);
-#endif /* LIBXML_FTP_ENABLED */
- xmlInputCallbackInitialized = 1;
-}
-
-/**
- * xmlRegisterDefaultOutputCallbacks:
- *
- * Registers the default compiled-in I/O handlers.
- */
-void
-xmlRegisterDefaultOutputCallbacks
-(void) {
- if (xmlOutputCallbackInitialized)
- return;
-
- xmlRegisterOutputCallbacks(xmlFileMatch, xmlFileOpenW,
- xmlFileWrite, xmlFileClose);
-
-#ifdef LIBXML_HTTP_ENABLED
- xmlRegisterOutputCallbacks(xmlIOHTTPMatch, xmlIOHTTPDfltOpenW,
- xmlIOHTTPWrite, xmlIOHTTPClosePut);
-#endif
-
-/*********************************
- No way a-priori to distinguish between gzipped files from
- uncompressed ones except opening if existing then closing
- and saving with same compression ratio ... a pain.
-
-#ifdef HAVE_ZLIB_H
- xmlRegisterOutputCallbacks(xmlGzfileMatch, xmlGzfileOpen,
- xmlGzfileWrite, xmlGzfileClose);
-#endif
-
- Nor FTP PUT ....
-#ifdef LIBXML_FTP_ENABLED
- xmlRegisterOutputCallbacks(xmlIOFTPMatch, xmlIOFTPOpen,
- xmlIOFTPWrite, xmlIOFTPClose);
-#endif
- **********************************/
- xmlOutputCallbackInitialized = 1;
-}
-
-#ifdef LIBXML_HTTP_ENABLED
-/**
- * xmlRegisterHTTPPostCallbacks:
- *
- * By default, libxml submits HTTP output requests using the "PUT" method.
- * Calling this method changes the HTTP output method to use the "POST"
- * method instead.
- *
- */
-void
-xmlRegisterHTTPPostCallbacks( void ) {
-
- /* Register defaults if not done previously */
-
- if ( xmlOutputCallbackInitialized == 0 )
- xmlRegisterDefaultOutputCallbacks( );
-
- xmlRegisterOutputCallbacks(xmlIOHTTPMatch, xmlIOHTTPDfltOpenW,
- xmlIOHTTPWrite, xmlIOHTTPClosePost);
- return;
-}
-#endif
-
-/**
- * xmlAllocParserInputBuffer:
- * @enc: the charset encoding if known
- *
- * Create a buffered parser input for progressive parsing
- *
- * Returns the new parser input or NULL
- */
-xmlParserInputBufferPtr
-xmlAllocParserInputBuffer(xmlCharEncoding enc) {
- xmlParserInputBufferPtr ret;
-
- ret = (xmlParserInputBufferPtr) xmlMalloc(sizeof(xmlParserInputBuffer));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAllocParserInputBuffer : out of memory!\n");
- return(NULL);
- }
- memset(ret, 0, (size_t) sizeof(xmlParserInputBuffer));
- ret->buffer = xmlBufferCreate();
- if (ret->buffer == NULL) {
- xmlFree(ret);
- return(NULL);
- }
- ret->buffer->alloc = XML_BUFFER_ALLOC_DOUBLEIT;
- ret->encoder = xmlGetCharEncodingHandler(enc);
- if (ret->encoder != NULL)
- ret->raw = xmlBufferCreate();
- else
- ret->raw = NULL;
- ret->readcallback = NULL;
- ret->closecallback = NULL;
- ret->context = NULL;
-
- return(ret);
-}
-
-/**
- * xmlAllocOutputBuffer:
- * @encoder: the encoding converter or NULL
- *
- * Create a buffered parser output
- *
- * Returns the new parser output or NULL
- */
-xmlOutputBufferPtr
-xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) {
- xmlOutputBufferPtr ret;
-
- ret = (xmlOutputBufferPtr) xmlMalloc(sizeof(xmlOutputBuffer));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAllocOutputBuffer : out of memory!\n");
- return(NULL);
- }
- memset(ret, 0, (size_t) sizeof(xmlOutputBuffer));
- ret->buffer = xmlBufferCreate();
- if (ret->buffer == NULL) {
- xmlFree(ret);
- return(NULL);
- }
- ret->buffer->alloc = XML_BUFFER_ALLOC_DOUBLEIT;
- ret->encoder = encoder;
- if (encoder != NULL) {
- ret->conv = xmlBufferCreateSize(4000);
- /*
- * This call is designed to initiate the encoder state
- */
- xmlCharEncOutFunc(encoder, ret->conv, NULL);
- } else
- ret->conv = NULL;
- ret->writecallback = NULL;
- ret->closecallback = NULL;
- ret->context = NULL;
- ret->written = 0;
-
- return(ret);
-}
-
-/**
- * xmlFreeParserInputBuffer:
- * @in: a buffered parser input
- *
- * Free up the memory used by a buffered parser input
- */
-void
-xmlFreeParserInputBuffer(xmlParserInputBufferPtr in) {
- if (in->raw) {
- xmlBufferFree(in->raw);
- in->raw = NULL;
- }
- if (in->encoder != NULL) {
- xmlCharEncCloseFunc(in->encoder);
- }
- if (in->closecallback != NULL) {
- in->closecallback(in->context);
- }
- if (in->buffer != NULL) {
- xmlBufferFree(in->buffer);
- in->buffer = NULL;
- }
-
- xmlFree(in);
-}
-
-/**
- * xmlOutputBufferClose:
- * @out: a buffered output
- *
- * flushes and close the output I/O channel
- * and free up all the associated resources
- *
- * Returns the number of byte written or -1 in case of error.
- */
-int
-xmlOutputBufferClose(xmlOutputBufferPtr out) {
- int written;
- int err_rc = 0;
-
- if (out == NULL)
- return(-1);
- if (out->writecallback != NULL)
- xmlOutputBufferFlush(out);
- if (out->closecallback != NULL) {
- err_rc = out->closecallback(out->context);
- }
- written = out->written;
- if (out->conv) {
- xmlBufferFree(out->conv);
- out->conv = NULL;
- }
- if (out->encoder != NULL) {
- xmlCharEncCloseFunc(out->encoder);
- }
- if (out->buffer != NULL) {
- xmlBufferFree(out->buffer);
- out->buffer = NULL;
- }
-
- xmlFree(out);
- return( ( err_rc == 0 ) ? written : err_rc );
-}
-
-/**
- * xmlParserInputBufferCreateFname:
- * @URI: a C string containing the URI or filename
- * @enc: the charset encoding if known
- *
- * Returns the new parser input or NULL
- */
-/**
- * xmlParserInputBufferCreateFilename:
- * @URI: a C string containing the URI or filename
- * @enc: the charset encoding if known
- *
- * Create a buffered parser input for the progressive parsing of a file
- * If filename is "-' then we use stdin as the input.
- * Automatic support for ZLIB/Compress compressed document is provided
- * by default if found at compile-time.
- * Do an encoding check if enc == XML_CHAR_ENCODING_NONE
- *
- * Returns the new parser input or NULL
- */
-xmlParserInputBufferPtr
-xmlParserInputBufferCreateFilename
-(const char *URI, xmlCharEncoding enc) {
- xmlParserInputBufferPtr ret;
- int i = 0;
- void *context = NULL;
- char *unescaped;
- char *normalized;
-
- if (xmlInputCallbackInitialized == 0)
- xmlRegisterDefaultInputCallbacks();
-
- if (URI == NULL) return(NULL);
- normalized = (char *) xmlNormalizeWindowsPath((const xmlChar *)URI);
- if (normalized == NULL) return(NULL);
-
-#ifdef LIBXML_CATALOG_ENABLED
-#endif
-
- /*
- * Try to find one of the input accept method accepting that scheme
- * Go in reverse to give precedence to user defined handlers.
- * try with an unescaped version of the URI
- */
- unescaped = xmlURIUnescapeString((char *) normalized, 0, NULL);
- if (unescaped != NULL) {
- for (i = xmlInputCallbackNr - 1;i >= 0;i--) {
- if ((xmlInputCallbackTable[i].matchcallback != NULL) &&
- (xmlInputCallbackTable[i].matchcallback(unescaped) != 0)) {
- context = xmlInputCallbackTable[i].opencallback(unescaped);
- if (context != NULL)
- break;
- }
- }
- xmlFree(unescaped);
- }
-
- /*
- * If this failed try with a non-escaped URI this may be a strange
- * filename
- */
- if (context == NULL) {
- for (i = xmlInputCallbackNr - 1;i >= 0;i--) {
- if ((xmlInputCallbackTable[i].matchcallback != NULL) &&
- (xmlInputCallbackTable[i].matchcallback(URI) != 0)) {
- context = xmlInputCallbackTable[i].opencallback(normalized);
- if (context != NULL)
- break;
- }
- }
- }
- xmlFree(normalized);
- if (context == NULL) {
- return(NULL);
- }
-
- /*
- * Allocate the Input buffer front-end.
- */
- ret = xmlAllocParserInputBuffer(enc);
- if (ret != NULL) {
- ret->context = context;
- ret->readcallback = xmlInputCallbackTable[i].readcallback;
- ret->closecallback = xmlInputCallbackTable[i].closecallback;
- }
- return(ret);
-}
-
-/**
- * xmlOutputBufferCreateFilename:
- * @URI: a C string containing the URI or filename
- * @encoder: the encoding converter or NULL
- * @compression: the compression ration (0 none, 9 max).
- *
- * Create a buffered output for the progressive saving of a file
- * If filename is "-' then we use stdout as the output.
- * Automatic support for ZLIB/Compress compressed document is provided
- * by default if found at compile-time.
- * TODO: currently if compression is set, the library only support
- * writing to a local file.
- *
- * Returns the new output or NULL
- */
-xmlOutputBufferPtr
-xmlOutputBufferCreateFilename(const char *URI,
- xmlCharEncodingHandlerPtr encoder,
- int compression) {
- xmlOutputBufferPtr ret;
- int i = 0;
- void *context = NULL;
- char *unescaped;
- char *normalized;
-
- int is_http_uri = 0; /* Can't change if HTTP disabled */
-
- if (xmlOutputCallbackInitialized == 0)
- xmlRegisterDefaultOutputCallbacks();
-
- if (URI == NULL) return(NULL);
- normalized = (char *) xmlNormalizeWindowsPath((const xmlChar *)URI);
- if (normalized == NULL) return(NULL);
-
-#ifdef LIBXML_HTTP_ENABLED
- /* Need to prevent HTTP URI's from falling into zlib short circuit */
-
- is_http_uri = xmlIOHTTPMatch( normalized );
-#endif
-
-
- /*
- * Try to find one of the output accept method accepting that scheme
- * Go in reverse to give precedence to user defined handlers.
- * try with an unescaped version of the URI
- */
- unescaped = xmlURIUnescapeString(normalized, 0, NULL);
- if (unescaped != NULL) {
-#ifdef HAVE_ZLIB_H
- if ((compression > 0) && (compression <= 9) && (is_http_uri == 0)) {
- context = xmlGzfileOpenW(unescaped, compression);
- if (context != NULL) {
- ret = xmlAllocOutputBuffer(encoder);
- if (ret != NULL) {
- ret->context = context;
- ret->writecallback = xmlGzfileWrite;
- ret->closecallback = xmlGzfileClose;
- }
- xmlFree(unescaped);
- xmlFree(normalized);
- return(ret);
- }
- }
-#endif
- for (i = xmlOutputCallbackNr - 1;i >= 0;i--) {
- if ((xmlOutputCallbackTable[i].matchcallback != NULL) &&
- (xmlOutputCallbackTable[i].matchcallback(unescaped) != 0)) {
-#if defined(LIBXML_HTTP_ENABLED) && defined(HAVE_ZLIB_H)
- /* Need to pass compression parameter into HTTP open calls */
- if (xmlOutputCallbackTable[i].matchcallback == xmlIOHTTPMatch)
- context = xmlIOHTTPOpenW(unescaped, compression);
- else
-#endif
- context = xmlOutputCallbackTable[i].opencallback(unescaped);
- if (context != NULL)
- break;
- }
- }
- xmlFree(unescaped);
- }
-
- /*
- * If this failed try with a non-escaped URI this may be a strange
- * filename
- */
- if (context == NULL) {
-#ifdef HAVE_ZLIB_H
- if ((compression > 0) && (compression <= 9) && (is_http_uri == 0)) {
- context = xmlGzfileOpenW(normalized, compression);
- if (context != NULL) {
- ret = xmlAllocOutputBuffer(encoder);
- if (ret != NULL) {
- ret->context = context;
- ret->writecallback = xmlGzfileWrite;
- ret->closecallback = xmlGzfileClose;
- }
- xmlFree(normalized);
- return(ret);
- }
- }
-#endif
- for (i = xmlOutputCallbackNr - 1;i >= 0;i--) {
- if ((xmlOutputCallbackTable[i].matchcallback != NULL) &&
- (xmlOutputCallbackTable[i].matchcallback(normalized) != 0)) {
-#if defined(LIBXML_HTTP_ENABLED) && defined(HAVE_ZLIB_H)
- /* Need to pass compression parameter into HTTP open calls */
- if (xmlOutputCallbackTable[i].matchcallback == xmlIOHTTPMatch)
- context = xmlIOHTTPOpenW(URI, compression);
- else
-#endif
- context = xmlOutputCallbackTable[i].opencallback(URI);
- if (context != NULL)
- break;
- }
- }
- }
- xmlFree(normalized);
-
- if (context == NULL) {
- return(NULL);
- }
-
- /*
- * Allocate the Output buffer front-end.
- */
- ret = xmlAllocOutputBuffer(encoder);
- if (ret != NULL) {
- ret->context = context;
- ret->writecallback = xmlOutputCallbackTable[i].writecallback;
- ret->closecallback = xmlOutputCallbackTable[i].closecallback;
- }
- return(ret);
-}
-
-/**
- * xmlParserInputBufferCreateFile:
- * @file: a FILE*
- * @enc: the charset encoding if known
- *
- * Create a buffered parser input for the progressive parsing of a FILE *
- * buffered C I/O
- *
- * Returns the new parser input or NULL
- */
-xmlParserInputBufferPtr
-xmlParserInputBufferCreateFile(FILE *file, xmlCharEncoding enc) {
- xmlParserInputBufferPtr ret;
-
- if (xmlInputCallbackInitialized == 0)
- xmlRegisterDefaultInputCallbacks();
-
- if (file == NULL) return(NULL);
-
- ret = xmlAllocParserInputBuffer(enc);
- if (ret != NULL) {
- ret->context = file;
- ret->readcallback = xmlFileRead;
- ret->closecallback = xmlFileFlush;
- }
-
- return(ret);
-}
-
-/**
- * xmlOutputBufferCreateFile:
- * @file: a FILE*
- * @encoder: the encoding converter or NULL
- *
- * Create a buffered output for the progressive saving to a FILE *
- * buffered C I/O
- *
- * Returns the new parser output or NULL
- */
-xmlOutputBufferPtr
-xmlOutputBufferCreateFile(FILE *file, xmlCharEncodingHandlerPtr encoder) {
- xmlOutputBufferPtr ret;
-
- if (xmlOutputCallbackInitialized == 0)
- xmlRegisterDefaultOutputCallbacks();
-
- if (file == NULL) return(NULL);
-
- ret = xmlAllocOutputBuffer(encoder);
- if (ret != NULL) {
- ret->context = file;
- ret->writecallback = xmlFileWrite;
- ret->closecallback = xmlFileFlush;
- }
-
- return(ret);
-}
-
-/**
- * xmlParserInputBufferCreateFd:
- * @fd: a file descriptor number
- * @enc: the charset encoding if known
- *
- * Create a buffered parser input for the progressive parsing for the input
- * from a file descriptor
- *
- * Returns the new parser input or NULL
- */
-xmlParserInputBufferPtr
-xmlParserInputBufferCreateFd(int fd, xmlCharEncoding enc) {
- xmlParserInputBufferPtr ret;
-
- if (fd < 0) return(NULL);
-
- ret = xmlAllocParserInputBuffer(enc);
- if (ret != NULL) {
- ret->context = (void *) (long) fd;
- ret->readcallback = xmlFdRead;
- ret->closecallback = xmlFdClose;
- }
-
- return(ret);
-}
-
-/**
- * xmlParserInputBufferCreateMem:
- * @mem: the memory input
- * @size: the length of the memory block
- * @enc: the charset encoding if known
- *
- * Create a buffered parser input for the progressive parsing for the input
- * from a memory area.
- *
- * Returns the new parser input or NULL
- */
-xmlParserInputBufferPtr
-xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc) {
- xmlParserInputBufferPtr ret;
-
- if (size <= 0) return(NULL);
- if (mem == NULL) return(NULL);
-
- ret = xmlAllocParserInputBuffer(enc);
- if (ret != NULL) {
- ret->context = (void *) mem;
- ret->readcallback = (xmlInputReadCallback) xmlNop;
- ret->closecallback = NULL;
- xmlBufferAdd(ret->buffer, (const xmlChar *) mem, size);
- }
-
- return(ret);
-}
-
-/**
- * xmlOutputBufferCreateFd:
- * @fd: a file descriptor number
- * @encoder: the encoding converter or NULL
- *
- * Create a buffered output for the progressive saving
- * to a file descriptor
- *
- * Returns the new parser output or NULL
- */
-xmlOutputBufferPtr
-xmlOutputBufferCreateFd(int fd, xmlCharEncodingHandlerPtr encoder) {
- xmlOutputBufferPtr ret;
-
- if (fd < 0) return(NULL);
-
- ret = xmlAllocOutputBuffer(encoder);
- if (ret != NULL) {
- ret->context = (void *) (long) fd;
- ret->writecallback = xmlFdWrite;
- ret->closecallback = NULL;
- }
-
- return(ret);
-}
-
-/**
- * xmlParserInputBufferCreateIO:
- * @ioread: an I/O read function
- * @ioclose: an I/O close function
- * @ioctx: an I/O handler
- * @enc: the charset encoding if known
- *
- * Create a buffered parser input for the progressive parsing for the input
- * from an I/O handler
- *
- * Returns the new parser input or NULL
- */
-xmlParserInputBufferPtr
-xmlParserInputBufferCreateIO(xmlInputReadCallback ioread,
- xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc) {
- xmlParserInputBufferPtr ret;
-
- if (ioread == NULL) return(NULL);
-
- ret = xmlAllocParserInputBuffer(enc);
- if (ret != NULL) {
- ret->context = (void *) ioctx;
- ret->readcallback = ioread;
- ret->closecallback = ioclose;
- }
-
- return(ret);
-}
-
-/**
- * xmlOutputBufferCreateIO:
- * @iowrite: an I/O write function
- * @ioclose: an I/O close function
- * @ioctx: an I/O handler
- * @encoder: the charset encoding if known
- *
- * Create a buffered output for the progressive saving
- * to an I/O handler
- *
- * Returns the new parser output or NULL
- */
-xmlOutputBufferPtr
-xmlOutputBufferCreateIO(xmlOutputWriteCallback iowrite,
- xmlOutputCloseCallback ioclose, void *ioctx,
- xmlCharEncodingHandlerPtr encoder) {
- xmlOutputBufferPtr ret;
-
- if (iowrite == NULL) return(NULL);
-
- ret = xmlAllocOutputBuffer(encoder);
- if (ret != NULL) {
- ret->context = (void *) ioctx;
- ret->writecallback = iowrite;
- ret->closecallback = ioclose;
- }
-
- return(ret);
-}
-
-/**
- * xmlParserInputBufferPush:
- * @in: a buffered parser input
- * @len: the size in bytes of the array.
- * @buf: an char array
- *
- * Push the content of the arry in the input buffer
- * This routine handle the I18N transcoding to internal UTF-8
- * This is used when operating the parser in progressive (push) mode.
- *
- * Returns the number of chars read and stored in the buffer, or -1
- * in case of error.
- */
-int
-xmlParserInputBufferPush(xmlParserInputBufferPtr in,
- int len, const char *buf) {
- int nbchars = 0;
-
- if (len < 0) return(0);
- if (in->encoder != NULL) {
- /*
- * Store the data in the incoming raw buffer
- */
- if (in->raw == NULL) {
- in->raw = xmlBufferCreate();
- }
- xmlBufferAdd(in->raw, (const xmlChar *) buf, len);
-
- /*
- * convert as much as possible to the parser reading buffer.
- */
- nbchars = xmlCharEncInFunc(in->encoder, in->buffer, in->raw);
- if (nbchars < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParserInputBufferPush: encoder error\n");
- return(-1);
- }
- } else {
- nbchars = len;
- xmlBufferAdd(in->buffer, (xmlChar *) buf, nbchars);
- }
-#ifdef DEBUG_INPUT
- xmlGenericError(xmlGenericErrorContext,
- "I/O: pushed %d chars, buffer %d/%d\n",
- nbchars, in->buffer->use, in->buffer->size);
-#endif
- return(nbchars);
-}
-
-/**
- * endOfInput:
- *
- * When reading from an Input channel indicated end of file or error
- * don't reread from it again.
- */
-static int
-endOfInput (void * context ATTRIBUTE_UNUSED,
- char * buffer ATTRIBUTE_UNUSED,
- int len ATTRIBUTE_UNUSED) {
- return(0);
-}
-
-/**
- * xmlParserInputBufferGrow:
- * @in: a buffered parser input
- * @len: indicative value of the amount of chars to read
- *
- * Grow up the content of the input buffer, the old data are preserved
- * This routine handle the I18N transcoding to internal UTF-8
- * This routine is used when operating the parser in normal (pull) mode
- *
- * TODO: one should be able to remove one extra copy by copying directly
- * onto in->buffer or in->raw
- *
- * Returns the number of chars read and stored in the buffer, or -1
- * in case of error.
- */
-int
-xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
- char *buffer = NULL;
- int res = 0;
- int nbchars = 0;
- int buffree;
- unsigned int needSize;
-
- if ((len <= MINLEN) && (len != 4))
- len = MINLEN;
- buffree = in->buffer->size - in->buffer->use;
- if (buffree <= 0) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParserInputBufferGrow : buffer full !\n");
- return(0);
- }
- if (len > buffree)
- len = buffree;
-
- needSize = in->buffer->use + len + 1;
- if (needSize > in->buffer->size){
- if (!xmlBufferResize(in->buffer, needSize)){
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferAdd : out of memory!\n");
- return(0);
- }
- }
- buffer = (char *)&in->buffer->content[in->buffer->use];
-
- /*
- * Call the read method for this I/O type.
- */
- if (in->readcallback != NULL) {
- res = in->readcallback(in->context, &buffer[0], len);
- if (res <= 0)
- in->readcallback = endOfInput;
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParserInputBufferGrow : no input !\n");
- return(-1);
- }
- if (res < 0) {
- return(-1);
- }
- len = res;
- if (in->encoder != NULL) {
- /*
- * Store the data in the incoming raw buffer
- */
- if (in->raw == NULL) {
- in->raw = xmlBufferCreate();
- }
- xmlBufferAdd(in->raw, (const xmlChar *) buffer, len);
-
- /*
- * convert as much as possible to the parser reading buffer.
- */
- nbchars = xmlCharEncInFunc(in->encoder, in->buffer, in->raw);
- if (nbchars < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParserInputBufferGrow: encoder error\n");
- return(-1);
- }
- } else {
- nbchars = len;
- in->buffer->use += nbchars;
- buffer[nbchars] = 0;
- }
-#ifdef DEBUG_INPUT
- xmlGenericError(xmlGenericErrorContext,
- "I/O: read %d chars, buffer %d/%d\n",
- nbchars, in->buffer->use, in->buffer->size);
-#endif
- return(nbchars);
-}
-
-/**
- * xmlParserInputBufferRead:
- * @in: a buffered parser input
- * @len: indicative value of the amount of chars to read
- *
- * Refresh the content of the input buffer, the old data are considered
- * consumed
- * This routine handle the I18N transcoding to internal UTF-8
- *
- * Returns the number of chars read and stored in the buffer, or -1
- * in case of error.
- */
-int
-xmlParserInputBufferRead(xmlParserInputBufferPtr in, int len) {
- /* xmlBufferEmpty(in->buffer); */
- if (in->readcallback != NULL)
- return(xmlParserInputBufferGrow(in, len));
- else
- return(-1);
-}
-
-/**
- * xmlOutputBufferWrite:
- * @out: a buffered parser output
- * @len: the size in bytes of the array.
- * @buf: an char array
- *
- * Write the content of the array in the output I/O buffer
- * This routine handle the I18N transcoding from internal UTF-8
- * The buffer is lossless, i.e. will store in case of partial
- * or delayed writes.
- *
- * Returns the number of chars immediately written, or -1
- * in case of error.
- */
-int
-xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *buf) {
- int nbchars = 0; /* number of chars to output to I/O */
- int ret; /* return from function call */
- int written = 0; /* number of char written to I/O so far */
- int chunk; /* number of byte curreent processed from buf */
-
- if (len < 0) return(0);
-
- do {
- chunk = len;
- if (chunk > 4 * MINLEN)
- chunk = 4 * MINLEN;
-
- /*
- * first handle encoding stuff.
- */
- if (out->encoder != NULL) {
- /*
- * Store the data in the incoming raw buffer
- */
- if (out->conv == NULL) {
- out->conv = xmlBufferCreate();
- }
- xmlBufferAdd(out->buffer, (const xmlChar *) buf, chunk);
-
- if ((out->buffer->use < MINLEN) && (chunk == len))
- goto done;
-
- /*
- * convert as much as possible to the parser reading buffer.
- */
- ret = xmlCharEncOutFunc(out->encoder, out->conv, out->buffer);
- if (ret < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlOutputBufferWrite: encoder error\n");
- return(-1);
- }
- nbchars = out->conv->use;
- } else {
- xmlBufferAdd(out->buffer, (const xmlChar *) buf, chunk);
- nbchars = out->buffer->use;
- }
- buf += chunk;
- len -= chunk;
-
- if ((nbchars < MINLEN) && (len <= 0))
- goto done;
-
- if (out->writecallback) {
- /*
- * second write the stuff to the I/O channel
- */
- if (out->encoder != NULL) {
- ret = out->writecallback(out->context,
- (const char *)out->conv->content, nbchars);
- if (ret >= 0)
- xmlBufferShrink(out->conv, ret);
- } else {
- ret = out->writecallback(out->context,
- (const char *)out->buffer->content, nbchars);
- if (ret >= 0)
- xmlBufferShrink(out->buffer, ret);
- }
- if (ret < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "I/O: error %d writing %d bytes\n", ret, nbchars);
- return(ret);
- }
- out->written += ret;
- }
- written += nbchars;
- } while (len > 0);
-
-done:
-#ifdef DEBUG_INPUT
- xmlGenericError(xmlGenericErrorContext,
- "I/O: wrote %d chars\n", written);
-#endif
- return(written);
-}
-
-/**
- * xmlOutputBufferWriteString:
- * @out: a buffered parser output
- * @str: a zero terminated C string
- *
- * Write the content of the string in the output I/O buffer
- * This routine handle the I18N transcoding from internal UTF-8
- * The buffer is lossless, i.e. will store in case of partial
- * or delayed writes.
- *
- * Returns the number of chars immediately written, or -1
- * in case of error.
- */
-int
-xmlOutputBufferWriteString(xmlOutputBufferPtr out, const char *str) {
- int len;
-
- if (str == NULL)
- return(-1);
- len = strlen(str);
-
- if (len > 0)
- return(xmlOutputBufferWrite(out, len, str));
- return(len);
-}
-
-/**
- * xmlOutputBufferFlush:
- * @out: a buffered output
- *
- * flushes the output I/O channel
- *
- * Returns the number of byte written or -1 in case of error.
- */
-int
-xmlOutputBufferFlush(xmlOutputBufferPtr out) {
- int nbchars = 0, ret = 0;
-
- /*
- * first handle encoding stuff.
- */
- if ((out->conv != NULL) && (out->encoder != NULL)) {
- /*
- * convert as much as possible to the parser reading buffer.
- */
- nbchars = xmlCharEncOutFunc(out->encoder, out->conv, out->buffer);
- if (nbchars < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlOutputBufferFlush: encoder error\n");
- return(-1);
- }
- }
-
- /*
- * second flush the stuff to the I/O channel
- */
- if ((out->conv != NULL) && (out->encoder != NULL) &&
- (out->writecallback != NULL)) {
- ret = out->writecallback(out->context,
- (const char *)out->conv->content, out->conv->use);
- if (ret >= 0)
- xmlBufferShrink(out->conv, ret);
- } else if (out->writecallback != NULL) {
- ret = out->writecallback(out->context,
- (const char *)out->buffer->content, out->buffer->use);
- if (ret >= 0)
- xmlBufferShrink(out->buffer, ret);
- }
- if (ret < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "I/O: error %d flushing %d bytes\n", ret, nbchars);
- return(ret);
- }
- out->written += ret;
-
-#ifdef DEBUG_INPUT
- xmlGenericError(xmlGenericErrorContext,
- "I/O: flushed %d chars\n", ret);
-#endif
- return(ret);
-}
-
-/**
- * xmlParserGetDirectory:
- * @filename: the path to a file
- *
- * lookup the directory for that file
- *
- * Returns a new allocated string containing the directory, or NULL.
- */
-char *
-xmlParserGetDirectory(const char *filename) {
- char *ret = NULL;
- char dir[1024];
- char *cur;
- char sep = '/';
-
-#ifdef _WIN32_WCE /* easy way by now ... wince does not have dirs! */
- return NULL;
-#endif
-
- if (xmlInputCallbackInitialized == 0)
- xmlRegisterDefaultInputCallbacks();
-
- if (filename == NULL) return(NULL);
-#if defined(WIN32) && !defined(__CYGWIN__)
- sep = '\\';
-#endif
-
- strncpy(dir, filename, 1023);
- dir[1023] = 0;
- cur = &dir[strlen(dir)];
- while (cur > dir) {
- if (*cur == sep) break;
- cur --;
- }
- if (*cur == sep) {
- if (cur == dir) dir[1] = 0;
- else *cur = 0;
- ret = xmlMemStrdup(dir);
- } else {
- if (getcwd(dir, 1024) != NULL) {
- dir[1023] = 0;
- ret = xmlMemStrdup(dir);
- }
- }
- return(ret);
-}
-
-/****************************************************************
- * *
- * External entities loading *
- * *
- ****************************************************************/
-
-#ifdef LIBXML_CATALOG_ENABLED
-static int xmlSysIDExists(const char *URL) {
-#ifdef HAVE_STAT
- int ret;
- struct stat info;
- const char *path;
-
- if (URL == NULL)
- return(0);
-
- if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file://localhost/", 17))
-#if defined (_WIN32) && !defined(__CYGWIN__)
- path = &URL[17];
-#else
- path = &URL[16];
-#endif
- else if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file:///", 8)) {
-#if defined (_WIN32) && !defined(__CYGWIN__)
- path = &URL[8];
-#else
- path = &URL[7];
-#endif
- } else
- path = URL;
- ret = stat(path, &info);
- if (ret == 0)
- return(1);
-#endif
- return(0);
-}
-#endif
-
-/**
- * xmlDefaultExternalEntityLoader:
- * @URL: the URL for the entity to load
- * @ID: the System ID for the entity to load
- * @ctxt: the context in which the entity is called or NULL
- *
- * By default we don't load external entitites, yet.
- *
- * Returns a new allocated xmlParserInputPtr, or NULL.
- */
-static
-xmlParserInputPtr
-xmlDefaultExternalEntityLoader(const char *URL, const char *ID,
- xmlParserCtxtPtr ctxt) {
- xmlParserInputPtr ret = NULL;
- xmlChar *resource = NULL;
-#ifdef LIBXML_CATALOG_ENABLED
- xmlCatalogAllow pref;
-#endif
-
-#ifdef DEBUG_EXTERNAL_ENTITIES
- xmlGenericError(xmlGenericErrorContext,
- "xmlDefaultExternalEntityLoader(%s, xxx)\n", URL);
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
- /*
- * If the resource doesn't exists as a file,
- * try to load it from the resource pointed in the catalogs
- */
- pref = xmlCatalogGetDefaults();
-
- if ((pref != XML_CATA_ALLOW_NONE) && (!xmlSysIDExists(URL))) {
- /*
- * Do a local lookup
- */
- if ((ctxt->catalogs != NULL) &&
- ((pref == XML_CATA_ALLOW_ALL) ||
- (pref == XML_CATA_ALLOW_DOCUMENT))) {
- resource = xmlCatalogLocalResolve(ctxt->catalogs,
- (const xmlChar *)ID,
- (const xmlChar *)URL);
- }
- /*
- * Try a global lookup
- */
- if ((resource == NULL) &&
- ((pref == XML_CATA_ALLOW_ALL) ||
- (pref == XML_CATA_ALLOW_GLOBAL))) {
- resource = xmlCatalogResolve((const xmlChar *)ID,
- (const xmlChar *)URL);
- }
- if ((resource == NULL) && (URL != NULL))
- resource = xmlStrdup((const xmlChar *) URL);
-
- /*
- * TODO: do an URI lookup on the reference
- */
- if ((resource != NULL) && (!xmlSysIDExists((const char *)resource))) {
- xmlChar *tmp = NULL;
-
- if ((ctxt->catalogs != NULL) &&
- ((pref == XML_CATA_ALLOW_ALL) ||
- (pref == XML_CATA_ALLOW_DOCUMENT))) {
- tmp = xmlCatalogLocalResolveURI(ctxt->catalogs, resource);
- }
- if ((tmp == NULL) &&
- ((pref == XML_CATA_ALLOW_ALL) ||
- (pref == XML_CATA_ALLOW_GLOBAL))) {
- tmp = xmlCatalogResolveURI(resource);
- }
-
- if (tmp != NULL) {
- xmlFree(resource);
- resource = tmp;
- }
- }
- }
-#endif
-
- if (resource == NULL)
- resource = (xmlChar *) URL;
-
- if (resource == NULL) {
- if (ID == NULL)
- ID = "NULL";
- if ((ctxt->validate) && (ctxt->sax != NULL) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
- "failed to load external entity \"%s\"\n", ID);
- else if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt,
- "failed to load external entity \"%s\"\n", ID);
- return(NULL);
- }
- ret = xmlNewInputFromFile(ctxt, (const char *)resource);
- if (ret == NULL) {
- if ((ctxt->validate) && (ctxt->sax != NULL) &&
- (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
- "failed to load external entity \"%s\"\n", resource);
- else if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt,
- "failed to load external entity \"%s\"\n", resource);
- }
- if ((resource != NULL) && (resource != (xmlChar *) URL))
- xmlFree(resource);
- return(ret);
-}
-
-static xmlExternalEntityLoader xmlCurrentExternalEntityLoader =
- xmlDefaultExternalEntityLoader;
-
-/**
- * xmlSetExternalEntityLoader:
- * @f: the new entity resolver function
- *
- * Changes the defaultexternal entity resolver function for the application
- */
-void
-xmlSetExternalEntityLoader(xmlExternalEntityLoader f) {
- xmlCurrentExternalEntityLoader = f;
-}
-
-/**
- * xmlGetExternalEntityLoader:
- *
- * Get the default external entity resolver function for the application
- *
- * Returns the xmlExternalEntityLoader function pointer
- */
-xmlExternalEntityLoader
-xmlGetExternalEntityLoader(void) {
- return(xmlCurrentExternalEntityLoader);
-}
-
-/**
- * xmlLoadExternalEntity:
- * @URL: the URL for the entity to load
- * @ID: the Public ID for the entity to load
- * @ctxt: the context in which the entity is called or NULL
- *
- * Load an external entity, note that the use of this function for
- * unparsed entities may generate problems
- * TODO: a more generic External entity API must be designed
- *
- * Returns the xmlParserInputPtr or NULL
- */
-xmlParserInputPtr
-xmlLoadExternalEntity(const char *URL, const char *ID,
- xmlParserCtxtPtr ctxt) {
- return(xmlCurrentExternalEntityLoader(URL, ID, ctxt));
-}
-
-/************************************************************************
- * *
- * Disabling Network access *
- * *
- ************************************************************************/
-
-#ifdef LIBXML_CATALOG_ENABLED
-static int
-xmlNoNetExists(const char *URL)
-{
-#ifdef HAVE_STAT
- int ret;
- struct stat info;
- const char *path;
-
- if (URL == NULL)
- return (0);
-
- if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file://localhost/", 17))
-#if defined (_WIN32) && !defined(__CYGWIN__)
- path = &URL[17];
-#else
- path = &URL[16];
-#endif
- else if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file:///", 8)) {
-#if defined (_WIN32) && !defined(__CYGWIN__)
- path = &URL[8];
-#else
- path = &URL[7];
-#endif
- } else
- path = URL;
- ret = stat(path, &info);
- if (ret == 0)
- return (1);
-#endif
- return (0);
-}
-#endif
-
-/**
- * xmlNoNetExternalEntityLoader:
- * @URL: the URL for the entity to load
- * @ID: the System ID for the entity to load
- * @ctxt: the context in which the entity is called or NULL
- *
- * A specific entity loader disabling network accesses, though still
- * allowing local catalog accesses for resolution.
- *
- * Returns a new allocated xmlParserInputPtr, or NULL.
- */
-xmlParserInputPtr
-xmlNoNetExternalEntityLoader(const char *URL, const char *ID,
- xmlParserCtxtPtr ctxt) {
- xmlParserInputPtr input = NULL;
- xmlChar *resource = NULL;
-
-#ifdef LIBXML_CATALOG_ENABLED
- xmlCatalogAllow pref;
-
- /*
- * If the resource doesn't exists as a file,
- * try to load it from the resource pointed in the catalogs
- */
- pref = xmlCatalogGetDefaults();
-
- if ((pref != XML_CATA_ALLOW_NONE) && (!xmlNoNetExists(URL))) {
- /*
- * Do a local lookup
- */
- if ((ctxt->catalogs != NULL) &&
- ((pref == XML_CATA_ALLOW_ALL) ||
- (pref == XML_CATA_ALLOW_DOCUMENT))) {
- resource = xmlCatalogLocalResolve(ctxt->catalogs,
- (const xmlChar *)ID,
- (const xmlChar *)URL);
- }
- /*
- * Try a global lookup
- */
- if ((resource == NULL) &&
- ((pref == XML_CATA_ALLOW_ALL) ||
- (pref == XML_CATA_ALLOW_GLOBAL))) {
- resource = xmlCatalogResolve((const xmlChar *)ID,
- (const xmlChar *)URL);
- }
- if ((resource == NULL) && (URL != NULL))
- resource = xmlStrdup((const xmlChar *) URL);
-
- /*
- * TODO: do an URI lookup on the reference
- */
- if ((resource != NULL) && (!xmlNoNetExists((const char *)resource))) {
- xmlChar *tmp = NULL;
-
- if ((ctxt->catalogs != NULL) &&
- ((pref == XML_CATA_ALLOW_ALL) ||
- (pref == XML_CATA_ALLOW_DOCUMENT))) {
- tmp = xmlCatalogLocalResolveURI(ctxt->catalogs, resource);
- }
- if ((tmp == NULL) &&
- ((pref == XML_CATA_ALLOW_ALL) ||
- (pref == XML_CATA_ALLOW_GLOBAL))) {
- tmp = xmlCatalogResolveURI(resource);
- }
-
- if (tmp != NULL) {
- xmlFree(resource);
- resource = tmp;
- }
- }
- }
-#endif
- if (resource == NULL)
- resource = (xmlChar *) URL;
-
- if (resource != NULL) {
- if ((!xmlStrncasecmp(BAD_CAST resource, BAD_CAST "ftp://", 6)) ||
- (!xmlStrncasecmp(BAD_CAST resource, BAD_CAST "http://", 7))) {
- xmlGenericError(xmlGenericErrorContext,
- "Attempt to load network entity %s \n", resource);
-
- if (resource != (xmlChar *) URL)
- xmlFree(resource);
- return(NULL);
- }
- }
- input = xmlDefaultExternalEntityLoader((const char *) resource, ID, ctxt);
- if (resource != (xmlChar *) URL)
- xmlFree(resource);
- return(input);
-}
-
diff --git a/bundle/libxml/xmlmemory.c b/bundle/libxml/xmlmemory.c
deleted file mode 100644
index 2add3a321d..0000000000
--- a/bundle/libxml/xmlmemory.c
+++ /dev/null
@@ -1,777 +0,0 @@
-/*
- * xmlmemory.c: libxml memory allocator wrapper.
- *
- * daniel@veillard.com
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#include <string.h>
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#else
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#endif
-
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-
-/**
- * MEM_LIST:
- *
- * keep track of all allocated blocks for error reporting
- * Always build the memory list !
- */
-#if DEBUG && !defined(MEMLIST)
-#define MEM_LIST /* keep a list of all the allocated memory blocks */
-#else
-#undef MEM_LIST
-#endif
-
-#include <libxml/xmlmemory.h>
-#include <libxml/globals.h>
-#include <libxml/xmlerror.h>
-
-void xmlMallocBreakpoint(void);
-void * xmlMemMalloc(size_t size);
-void * xmlMemRealloc(void *ptr,size_t size);
-void xmlMemFree(void *ptr);
-char * xmlMemoryStrdup(const char *str);
-
-/************************************************************************
- * *
- * Macros, variables and associated types *
- * *
- ************************************************************************/
-
-
-#ifdef xmlMalloc
-#undef xmlMalloc
-#endif
-#ifdef xmlRealloc
-#undef xmlRealloc
-#endif
-#ifdef xmlMemStrdup
-#undef xmlMemStrdup
-#endif
-
-
-/*
- * Each of the blocks allocated begin with a header containing informations
- */
-
-#define MEMTAG 0x5aa5
-
-#define MALLOC_TYPE 1
-#define REALLOC_TYPE 2
-#define STRDUP_TYPE 3
-
-typedef struct memnod {
- unsigned int mh_tag;
- unsigned int mh_type;
- unsigned long mh_number;
- size_t mh_size;
-#ifdef MEM_LIST
- struct memnod *mh_next;
- struct memnod *mh_prev;
-#endif
- const char *mh_file;
- unsigned int mh_line;
-} MEMHDR;
-
-
-#ifdef SUN4
-#define ALIGN_SIZE 16
-#else
-#define ALIGN_SIZE sizeof(double)
-#endif
-#define HDR_SIZE sizeof(MEMHDR)
-#define RESERVE_SIZE (((HDR_SIZE + (ALIGN_SIZE-1)) \
- / ALIGN_SIZE ) * ALIGN_SIZE)
-
-
-#define CLIENT_2_HDR(a) ((MEMHDR *) (((char *) (a)) - RESERVE_SIZE))
-#define HDR_2_CLIENT(a) ((void *) (((char *) (a)) + RESERVE_SIZE))
-
-
-static unsigned long debugMemSize = 0;
-static unsigned long debugMaxMemSize = 0;
-static int block=0;
-static int xmlMemStopAtBlock = 0;
-static void *xmlMemTraceBlockAt = NULL;
-static int xmlMemInitialized = 0;
-#ifdef MEM_LIST
-static MEMHDR *memlist = NULL;
-#endif
-
-static void debugmem_tag_error(void *addr);
-#ifdef MEM_LIST
-static void debugmem_list_add(MEMHDR *);
-static void debugmem_list_delete(MEMHDR *);
-#endif
-#define Mem_Tag_Err(a) debugmem_tag_error(a);
-
-#ifndef TEST_POINT
-#define TEST_POINT
-#endif
-
-/**
- * xmlMallocBreakpoint:
- *
- * Breakpoint to use in conjunction with xmlMemStopAtBlock. When the block
- * number reaches the specified value this function is called. One need to add a breakpoint
- * to it to get the context in which the given block is allocated.
- */
-
-void
-xmlMallocBreakpoint(void) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlMallocBreakpoint reached on block %d\n", xmlMemStopAtBlock);
-}
-
-/**
- * xmlMallocLoc:
- * @size: an int specifying the size in byte to allocate.
- * @file: the file name or NULL
- * @line: the line number
- *
- * a malloc() equivalent, with logging of the allocation info.
- *
- * Returns a pointer to the allocated area or NULL in case of lack of memory.
- */
-
-void *
-xmlMallocLoc(size_t size, const char * file, int line)
-{
- MEMHDR *p;
- void *ret;
-
- if (!xmlMemInitialized) xmlInitMemory();
-#ifdef DEBUG_MEMORY
- xmlGenericError(xmlGenericErrorContext,
- "Malloc(%d)\n",size);
-#endif
-
- TEST_POINT
-
- p = (MEMHDR *) malloc(RESERVE_SIZE+size);
-
- if (!p) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlMallocLoc : Out of free space\n");
- xmlMemoryDump();
- return(NULL);
- }
- p->mh_tag = MEMTAG;
- p->mh_number = ++block;
- p->mh_size = size;
- p->mh_type = MALLOC_TYPE;
- p->mh_file = file;
- p->mh_line = line;
- debugMemSize += size;
- if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
-#ifdef MEM_LIST
- debugmem_list_add(p);
-#endif
-
-#ifdef DEBUG_MEMORY
- xmlGenericError(xmlGenericErrorContext,
- "Malloc(%d) Ok\n",size);
-#endif
-
- if (xmlMemStopAtBlock == block) xmlMallocBreakpoint();
-
- ret = HDR_2_CLIENT(p);
-
- if (xmlMemTraceBlockAt == ret) {
- xmlGenericError(xmlGenericErrorContext,
- "%p : Malloc(%d) Ok\n", xmlMemTraceBlockAt, size);
- xmlMallocBreakpoint();
- }
-
- TEST_POINT
-
- return(ret);
-}
-
-/**
- * xmlMemMalloc:
- * @size: an int specifying the size in byte to allocate.
- *
- * a malloc() equivalent, with logging of the allocation info.
- *
- * Returns a pointer to the allocated area or NULL in case of lack of memory.
- */
-
-void *
-xmlMemMalloc(size_t size)
-{
- return(xmlMallocLoc(size, "none", 0));
-}
-
-/**
- * xmlReallocLoc:
- * @ptr: the initial memory block pointer
- * @size: an int specifying the size in byte to allocate.
- * @file: the file name or NULL
- * @line: the line number
- *
- * a realloc() equivalent, with logging of the allocation info.
- *
- * Returns a pointer to the allocated area or NULL in case of lack of memory.
- */
-
-void *
-xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
-{
- MEMHDR *p;
- unsigned long number;
-
- if (!xmlMemInitialized) xmlInitMemory();
- TEST_POINT
-
- p = CLIENT_2_HDR(ptr);
- number = p->mh_number;
- if (p->mh_tag != MEMTAG) {
- Mem_Tag_Err(p);
- goto error;
- }
- p->mh_tag = ~MEMTAG;
- debugMemSize -= p->mh_size;
-#ifdef MEM_LIST
- debugmem_list_delete(p);
-#endif
-
- p = (MEMHDR *) realloc(p,RESERVE_SIZE+size);
- if (!p) {
- goto error;
- }
- if (xmlMemTraceBlockAt == ptr) {
- xmlGenericError(xmlGenericErrorContext,
- "%p : Realloced(%d -> %d) Ok\n",
- xmlMemTraceBlockAt, p->mh_size, size);
- xmlMallocBreakpoint();
- }
- p->mh_tag = MEMTAG;
- p->mh_number = number;
- p->mh_type = REALLOC_TYPE;
- p->mh_size = size;
- p->mh_file = file;
- p->mh_line = line;
- debugMemSize += size;
- if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
-#ifdef MEM_LIST
- debugmem_list_add(p);
-#endif
-
- TEST_POINT
-
- return(HDR_2_CLIENT(p));
-
-error:
- return(NULL);
-}
-
-/**
- * xmlMemRealloc:
- * @ptr: the initial memory block pointer
- * @size: an int specifying the size in byte to allocate.
- *
- * a realloc() equivalent, with logging of the allocation info.
- *
- * Returns a pointer to the allocated area or NULL in case of lack of memory.
- */
-
-void *
-xmlMemRealloc(void *ptr,size_t size) {
- return(xmlReallocLoc(ptr, size, "none", 0));
-}
-
-/**
- * xmlMemFree:
- * @ptr: the memory block pointer
- *
- * a free() equivalent, with error checking.
- */
-void
-xmlMemFree(void *ptr)
-{
- MEMHDR *p;
- char *target;
-
- if (ptr == (void *) -1) {
- xmlGenericError(xmlGenericErrorContext,
- "trying to free pointer from freed area\n");
- goto error;
- }
-
- if (xmlMemTraceBlockAt == ptr) {
- xmlGenericError(xmlGenericErrorContext,
- "%p : Freed()\n", xmlMemTraceBlockAt);
- xmlMallocBreakpoint();
- }
-
- TEST_POINT
-
- target = (char *) ptr;
-
- p = CLIENT_2_HDR(ptr);
- if (p->mh_tag != MEMTAG) {
- Mem_Tag_Err(p);
- goto error;
- }
- p->mh_tag = ~MEMTAG;
- debugMemSize -= p->mh_size;
- memset(target, -1, p->mh_size);
-
-#ifdef MEM_LIST
- debugmem_list_delete(p);
-#endif
- free(p);
-
- TEST_POINT
-
- return;
-
-error:
- xmlGenericError(xmlGenericErrorContext,
- "xmlMemFree(%lX) error\n", (unsigned long) ptr);
- xmlMallocBreakpoint();
- return;
-}
-
-/**
- * xmlMemStrdupLoc:
- * @str: the initial string pointer
- * @file: the file name or NULL
- * @line: the line number
- *
- * a strdup() equivalent, with logging of the allocation info.
- *
- * Returns a pointer to the new string or NULL if allocation error occurred.
- */
-
-char *
-xmlMemStrdupLoc(const char *str, const char *file, int line)
-{
- char *s;
- size_t size = strlen(str) + 1;
- MEMHDR *p;
-
- if (!xmlMemInitialized) xmlInitMemory();
- TEST_POINT
-
- p = (MEMHDR *) malloc(RESERVE_SIZE+size);
- if (!p) {
- goto error;
- }
- p->mh_tag = MEMTAG;
- p->mh_number = ++block;
- p->mh_size = size;
- p->mh_type = STRDUP_TYPE;
- p->mh_file = file;
- p->mh_line = line;
- debugMemSize += size;
- if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
-#ifdef MEM_LIST
- debugmem_list_add(p);
-#endif
- s = (char *) HDR_2_CLIENT(p);
-
- if (xmlMemStopAtBlock == block) xmlMallocBreakpoint();
-
- if (s != NULL)
- strcpy(s,str);
- else
- goto error;
-
- TEST_POINT
-
- if (xmlMemTraceBlockAt == s) {
- xmlGenericError(xmlGenericErrorContext,
- "%p : Strdup() Ok\n", xmlMemTraceBlockAt);
- xmlMallocBreakpoint();
- }
-
- return(s);
-
-error:
- return(NULL);
-}
-
-/**
- * xmlMemoryStrdup:
- * @str: the initial string pointer
- *
- * a strdup() equivalent, with logging of the allocation info.
- *
- * Returns a pointer to the new string or NULL if allocation error occurred.
- */
-
-char *
-xmlMemoryStrdup(const char *str) {
- return(xmlMemStrdupLoc(str, "none", 0));
-}
-
-/**
- * xmlMemUsed:
- *
- * Provides the amount of memory currently allocated
- *
- * Returns an int representing the amount of memory allocated.
- */
-
-int
-xmlMemUsed(void) {
- return(debugMemSize);
-}
-
-#ifdef MEM_LIST
-/**
- * xmlMemContentShow:
- * @fp: a FILE descriptor used as the output file
- * @p: a memory block header
- *
- * tries to show some content from the memory block
- */
-
-static void
-xmlMemContentShow(FILE *fp, MEMHDR *p)
-{
- int i,j,len = p->mh_size;
- const char *buf = (const char *) HDR_2_CLIENT(p);
-
- if (p == NULL) {
- fprintf(fp, " NULL");
- return;
- }
-
- for (i = 0;i < len;i++) {
- if (buf[i] == 0) break;
- if (!isprint((unsigned char) buf[i])) break;
- }
- if ((i < 4) && ((buf[i] != 0) || (i == 0))) {
- if (len >= 4) {
- MEMHDR *q;
- void *cur;
-
- for (j = 0;j < len -3;j += 4) {
- cur = *((void **) &buf[j]);
- q = CLIENT_2_HDR(cur);
- p = memlist;
- while (p != NULL) {
- if (p == q) break;
- p = p->mh_next;
- }
- if ((p != NULL) && (p == q)) {
- fprintf(fp, " pointer to #%lu at index %d",
- p->mh_number, j);
- return;
- }
- }
- }
- } else if ((i == 0) && (buf[i] == 0)) {
- fprintf(fp," null");
- } else {
- if (buf[i] == 0) fprintf(fp," \"%.25s\"", buf);
- else {
- fprintf(fp," [");
- for (j = 0;j < i;j++)
- fprintf(fp,"%c", buf[j]);
- fprintf(fp,"]");
- }
- }
-}
-#endif
-
-/**
- * xmlMemShow:
- * @fp: a FILE descriptor used as the output file
- * @nr: number of entries to dump
- *
- * show a show display of the memory allocated, and dump
- * the @nr last allocated areas which were not freed
- */
-
-void
-xmlMemShow(FILE *fp, int nr)
-{
-#ifdef MEM_LIST
- MEMHDR *p;
-#endif
-
- if (fp != NULL)
- fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n",
- debugMemSize, debugMaxMemSize);
-#ifdef MEM_LIST
- if (nr > 0) {
- fprintf(fp,"NUMBER SIZE TYPE WHERE\n");
- p = memlist;
- while ((p) && nr > 0) {
- fprintf(fp,"%6lu %6lu ",p->mh_number,(unsigned long)p->mh_size);
- switch (p->mh_type) {
- case STRDUP_TYPE:fprintf(fp,"strdup() in ");break;
- case MALLOC_TYPE:fprintf(fp,"malloc() in ");break;
- case REALLOC_TYPE:fprintf(fp,"realloc() in ");break;
- default:fprintf(fp," ??? in ");break;
- }
- if (p->mh_file != NULL)
- fprintf(fp,"%s(%d)", p->mh_file, p->mh_line);
- if (p->mh_tag != MEMTAG)
- fprintf(fp," INVALID");
- xmlMemContentShow(fp, p);
- fprintf(fp,"\n");
- nr--;
- p = p->mh_next;
- }
- }
-#endif /* MEM_LIST */
-}
-
-/**
- * xmlMemDisplay:
- * @fp: a FILE descriptor used as the output file, if NULL, the result is
- * written to the file .memorylist
- *
- * show in-extenso the memory blocks allocated
- */
-
-void
-xmlMemDisplay(FILE *fp)
-{
-#ifdef MEM_LIST
- MEMHDR *p;
- unsigned idx;
- int nb = 0;
-#if defined(HAVE_LOCALTIME) && defined(HAVE_STRFTIME)
- time_t currentTime;
- char buf[500];
- struct tm * tstruct;
-
- currentTime = time(NULL);
- tstruct = localtime(&currentTime);
- strftime(buf, sizeof(buf) - 1, "%I:%M:%S %p", tstruct);
- fprintf(fp," %s\n\n", buf);
-#endif
-
-
- fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n",
- debugMemSize, debugMaxMemSize);
- fprintf(fp,"BLOCK NUMBER SIZE TYPE\n");
- idx = 0;
- p = memlist;
- while (p) {
- fprintf(fp,"%-5u %6lu %6lu ",idx++,p->mh_number,
- (unsigned long)p->mh_size);
- switch (p->mh_type) {
- case STRDUP_TYPE:fprintf(fp,"strdup() in ");break;
- case MALLOC_TYPE:fprintf(fp,"malloc() in ");break;
- case REALLOC_TYPE:fprintf(fp,"realloc() in ");break;
- default:fprintf(fp," ??? in ");break;
- }
- if (p->mh_file != NULL) fprintf(fp,"%s(%d)", p->mh_file, p->mh_line);
- if (p->mh_tag != MEMTAG)
- fprintf(fp," INVALID");
- nb++;
- if (nb < 100)
- xmlMemContentShow(fp, p);
- else
- fprintf(fp," skip");
-
- fprintf(fp,"\n");
- p = p->mh_next;
- }
-#else
- fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n");
-#endif
-}
-
-#ifdef MEM_LIST
-
-static void debugmem_list_add(MEMHDR *p)
-{
- p->mh_next = memlist;
- p->mh_prev = NULL;
- if (memlist) memlist->mh_prev = p;
- memlist = p;
-#ifdef MEM_LIST_DEBUG
- if (stderr)
- Mem_Display(stderr);
-#endif
-}
-
-static void debugmem_list_delete(MEMHDR *p)
-{
- if (p->mh_next)
- p->mh_next->mh_prev = p->mh_prev;
- if (p->mh_prev)
- p->mh_prev->mh_next = p->mh_next;
- else memlist = p->mh_next;
-#ifdef MEM_LIST_DEBUG
- if (stderr)
- Mem_Display(stderr);
-#endif
-}
-
-#endif
-
-/*
- * debugmem_tag_error:
- *
- * internal error function.
- */
-
-static void debugmem_tag_error(void *p)
-{
- xmlGenericError(xmlGenericErrorContext,
- "Memory tag error occurs :%p \n\t bye\n", p);
-#ifdef MEM_LIST
- if (stderr)
- xmlMemDisplay(stderr);
-#endif
-}
-
-static FILE *xmlMemoryDumpFile = NULL;
-
-
-/**
- * xmlMemoryDump:
- *
- * Dump in-extenso the memory blocks allocated to the file .memorylist
- */
-
-void
-xmlMemoryDump(void)
-{
- FILE *dump;
-
- if (debugMaxMemSize == 0)
- return;
- dump = fopen(".memdump", "w");
- if (dump == NULL)
- xmlMemoryDumpFile = stderr;
- else xmlMemoryDumpFile = dump;
-
- xmlMemDisplay(xmlMemoryDumpFile);
-
- if (dump != NULL) fclose(dump);
-}
-
-
-/****************************************************************
- * *
- * Initialization Routines *
- * *
- ****************************************************************/
-
-static int xmlInitMemoryDone = 0;
-
-/**
- * xmlInitMemory:
- *
- * Initialize the memory layer.
- *
- * Returns 0 on success
- */
-int
-xmlInitMemory(void)
-{
- int ret;
-
-#ifdef HAVE_STDLIB_H
- char *breakpoint;
-#endif
-
- if (xmlInitMemoryDone) return(-1);
-
-#ifdef HAVE_STDLIB_H
- breakpoint = getenv("XML_MEM_BREAKPOINT");
- if (breakpoint != NULL) {
- sscanf(breakpoint, "%d", &xmlMemStopAtBlock);
- }
-#endif
-#ifdef HAVE_STDLIB_H
- breakpoint = getenv("XML_MEM_TRACE");
- if (breakpoint != NULL) {
- sscanf(breakpoint, "%p", &xmlMemTraceBlockAt);
- }
-#endif
-
-#ifdef DEBUG_MEMORY
- xmlGenericError(xmlGenericErrorContext,
- "xmlInitMemory() Ok\n");
-#endif
- xmlMemInitialized = 1;
- xmlInitMemoryDone = 1;
-
- ret = 0;
- return(ret);
-}
-
-/**
- * xmlMemSetup:
- * @freeFunc: the free() function to use
- * @mallocFunc: the malloc() function to use
- * @reallocFunc: the realloc() function to use
- * @strdupFunc: the strdup() function to use
- *
- * Override the default memory access functions with a new set
- * This has to be called before any other libxml routines !
- *
- * Should this be blocked if there was already some allocations
- * done ?
- *
- * Returns 0 on success
- */
-int
-xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc,
- xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc) {
- if (freeFunc == NULL)
- return(-1);
- if (mallocFunc == NULL)
- return(-1);
- if (reallocFunc == NULL)
- return(-1);
- if (strdupFunc == NULL)
- return(-1);
- xmlFree = freeFunc;
- xmlMalloc = mallocFunc;
- xmlRealloc = reallocFunc;
- xmlMemStrdup = strdupFunc;
- return(0);
-}
-
-/**
- * xmlMemGet:
- * @freeFunc: place to save the free() function in use
- * @mallocFunc: place to save the malloc() function in use
- * @reallocFunc: place to save the realloc() function in use
- * @strdupFunc: place to save the strdup() function in use
- *
- * Provides the memory access functions set currently in use
- *
- * Returns 0 on success
- */
-int
-xmlMemGet(xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc,
- xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc) {
- if (freeFunc != NULL) *freeFunc = xmlFree;
- if (mallocFunc != NULL) *mallocFunc = xmlMalloc;
- if (reallocFunc != NULL) *reallocFunc = xmlRealloc;
- if (strdupFunc != NULL) *strdupFunc = xmlMemStrdup;
- return(0);
-}
-
diff --git a/bundle/libxml/xmlreader.c b/bundle/libxml/xmlreader.c
deleted file mode 100644
index 65ca8e8ae1..0000000000
--- a/bundle/libxml/xmlreader.c
+++ /dev/null
@@ -1,882 +0,0 @@
-/*
- * xmlreader.c: implements the xmlTextReader streaming node API
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#include <string.h> /* for memset() only ! */
-
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#include <libxml/xmlmemory.h>
-#include <libxml/xmlIO.h>
-#include <libxml/xmlreader.h>
-
-/* #define DEBUG_CALLBACKS */
-/* #define DEBUG_READER */
-
-/**
- * TODO:
- *
- * macro to flag unimplemented blocks
- */
-#define TODO \
- xmlGenericError(xmlGenericErrorContext, \
- "Unimplemented block at %s:%d\n", \
- __FILE__, __LINE__);
-
-#ifdef DEBUG_READER
-#define DUMP_READER xmlTextReaderDebug(reader);
-#else
-#define DUMP_READER
-#endif
-
-/************************************************************************
- * *
- * The parser: maps the Text Reader API on top of the existing *
- * parsing routines building a tree *
- * *
- ************************************************************************/
-
-#define XML_TEXTREADER_INPUT 1
-#define XML_TEXTREADER_CTXT 2
-
-typedef enum {
- XML_TEXTREADER_MODE_NORMAL = 0,
- XML_TEXTREADER_MODE_EOF = 1
-} xmlTextReaderMode;
-
-typedef enum {
- XML_TEXTREADER_NONE = -1,
- XML_TEXTREADER_START= 0,
- XML_TEXTREADER_ELEMENT= 1,
- XML_TEXTREADER_END= 2,
- XML_TEXTREADER_EMPTY= 3,
- XML_TEXTREADER_BACKTRACK= 4
-} xmlTextReaderState;
-
-struct _xmlTextReader {
- int mode; /* the parsing mode */
- int allocs; /* what structure were deallocated */
- xmlTextReaderState state;
- xmlParserCtxtPtr ctxt; /* the parser context */
- xmlSAXHandlerPtr sax; /* the parser SAX callbacks */
- xmlParserInputBufferPtr input; /* the input */
- startElementSAXFunc startElement;/* initial SAX callbacks */
- endElementSAXFunc endElement; /* idem */
- unsigned int base; /* base of the segment in the input */
- unsigned int cur; /* current position in the input */
- xmlNodePtr node; /* current node */
- int depth; /* depth of the current node */
-};
-
-#ifdef DEBUG_READER
-static void
-xmlTextReaderDebug(xmlTextReaderPtr reader) {
- if ((reader == NULL) || (reader->ctxt == NULL)) {
- fprintf(stderr, "xmlTextReader NULL\n");
- return;
- }
- fprintf(stderr, "xmlTextReader: state %d depth %d ",
- reader->state, reader->depth);
- if (reader->node == NULL) {
- fprintf(stderr, "node = NULL\n");
- } else {
- fprintf(stderr, "node %s\n", reader->node->name);
- }
- fprintf(stderr, " input: base %d, cur %d, depth %d: ",
- reader->base, reader->cur, reader->ctxt->nodeNr);
- if (reader->input->buffer == NULL) {
- fprintf(stderr, "buffer is NULL\n");
- } else {
-#ifdef LIBXML_DEBUG_ENABLED
- xmlDebugDumpString(stderr,
- &reader->input->buffer->content[reader->cur]);
-#endif
- fprintf(stderr, "\n");
- }
-}
-#endif
-
-/**
- * xmlTextReaderStartElement:
- * @ctx: the user data (XML parser context)
- * @fullname: The element name, including namespace prefix
- * @atts: An array of name/value attributes pairs, NULL terminated
- *
- * called when an opening tag has been processed.
- */
-static void
-xmlTextReaderStartElement(void *ctx, const xmlChar *fullname,
- const xmlChar **atts) {
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlTextReaderPtr reader = ctxt->_private;
-
-#ifdef DEBUG_CALLBACKS
- printf("xmlTextReaderStartElement(%s)\n", fullname);
-#endif
- if ((reader != NULL) && (reader->startElement != NULL))
- reader->startElement(ctx, fullname, atts);
- reader->state = XML_TEXTREADER_ELEMENT;
-}
-
-/**
- * xmlTextReaderEndElement:
- * @ctx: the user data (XML parser context)
- * @fullname: The element name, including namespace prefix
- *
- * called when an ending tag has been processed.
- */
-static void
-xmlTextReaderEndElement(void *ctx, const xmlChar *fullname) {
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlTextReaderPtr reader = ctxt->_private;
-
-#ifdef DEBUG_CALLBACKS
- printf("xmlTextReaderEndElement(%s)\n", fullname);
-#endif
- if ((reader != NULL) && (reader->endElement != NULL))
- reader->endElement(ctx, fullname);
- if (reader->state == XML_TEXTREADER_ELEMENT)
- reader->state = XML_TEXTREADER_EMPTY;
- else
- reader->state = XML_TEXTREADER_END;
-}
-
-/**
- * xmlTextReaderPushData:
- * @reader: the xmlTextReaderPtr used
- *
- * Push data down the progressive parser until a significant callback
- * got raised.
- *
- * Returns -1 in case of failure, 0 otherwise
- */
-static int
-xmlTextReaderPushData(xmlTextReaderPtr reader) {
- unsigned int cur = reader->cur;
- xmlBufferPtr inbuf;
- int val;
-
- if ((reader->input == NULL) || (reader->input->buffer == NULL))
- return(-1);
-
- reader->state = XML_TEXTREADER_NONE;
- inbuf = reader->input->buffer;
- while (reader->state == XML_TEXTREADER_NONE) {
- if (cur >= inbuf->use) {
- /*
- * Refill the buffer unless we are at the end of the stream
- */
- if (reader->mode != XML_TEXTREADER_MODE_EOF) {
- val = xmlParserInputBufferRead(reader->input, 4096);
- if (val <= 0) {
- reader->mode = XML_TEXTREADER_MODE_EOF;
- return(val);
- }
- } else
- break;
- }
- if ((inbuf->content[cur] == '>') || (inbuf->content[cur] == '&')) {
- cur = cur + 1;
- val = xmlParseChunk(reader->ctxt,
- (const char *) &inbuf->content[reader->cur],
- cur - reader->cur, 0);
- if (val != 0)
- return(-1);
- reader->cur = cur;
- break;
- } else {
- cur = cur + 1;
-
- /*
- * One may have to force a flush at some point when parsing really
- * large CDATA sections
- */
- if ((cur - reader->cur > 4096) && (reader->base == 0) &&
- (reader->mode == XML_TEXTREADER_MODE_NORMAL)) {
- cur = cur + 1;
- val = xmlParseChunk(reader->ctxt,
- (const char *) &inbuf->content[reader->cur],
- cur - reader->cur, 0);
- if (val != 0)
- return(-1);
- reader->cur = cur;
- }
- }
- }
- /*
- * Discard the consumed input when needed and possible
- */
- if (reader->mode == XML_TEXTREADER_MODE_NORMAL) {
- if ((reader->cur >= 4096) && (reader->base == 0)) {
- val = xmlBufferShrink(inbuf, cur);
- if (val >= 0) {
- reader->cur -= val;
- }
- }
- }
-
- /*
- * At the end of the stream signal that the work is done to the Push
- * parser.
- */
- if ((reader->mode == XML_TEXTREADER_MODE_EOF) && (cur >= inbuf->use)) {
- val = xmlParseChunk(reader->ctxt,
- (const char *) &inbuf->content[reader->cur], 0, 1);
- }
- return(0);
-}
-
-/**
- * xmlTextReaderRead:
- * @reader: the xmlTextReaderPtr used
- *
- * Moves the position of the current instance to the next node in
- * the stream, exposing its properties.
- *
- * Returns 1 if the node was read successfully, 0 if there is no more
- * nodes to read, or -1 in case of error
- */
-int
-xmlTextReaderRead(xmlTextReaderPtr reader) {
- int val, olddepth;
- xmlTextReaderState oldstate;
- xmlNodePtr oldnode;
-
- if ((reader == NULL) || (reader->ctxt == NULL))
- return(-1);
- if (reader->ctxt->wellFormed != 1)
- return(-1);
-
-#ifdef DEBUG_READER
- fprintf(stderr, "\nREAD ");
- DUMP_READER
-#endif
- if (reader->node == NULL) {
- /*
- * Initial state
- */
- do {
- val = xmlTextReaderPushData(reader);
- if (val < 0)
- return(-1);
- } while ((reader->ctxt->node == NULL) &&
- (reader->mode != XML_TEXTREADER_MODE_EOF));
- if (reader->ctxt->node == NULL) {
- if (reader->ctxt->myDoc != NULL)
- reader->node = reader->ctxt->myDoc->children;
- if (reader->node == NULL)
- return(-1);
- } else {
- reader->node = reader->ctxt->node;
- }
- reader->depth = 1;
- return(1);
- }
- oldstate = reader->state;
- olddepth = reader->ctxt->nodeNr;
- oldnode = reader->node;
- /*
- * If we are not backtracking on ancestors or examined nodes,
- * that the parser didn't finished or that we arent at the end
- * of stream, continue processing.
- */
- if (oldstate != XML_TEXTREADER_BACKTRACK) {
- while (((reader->node->children == NULL) ||
- (reader->node->type == XML_ENTITY_REF_NODE) ||
- (reader->node->type == XML_DTD_NODE)) &&
- (reader->node->next == NULL) &&
- (reader->ctxt->nodeNr == olddepth) &&
- (reader->ctxt->instate != XML_PARSER_EOF)) {
- val = xmlTextReaderPushData(reader);
- if (val < 0)
- return(-1);
- if (reader->node == NULL)
- return(0);
- }
- if ((reader->node->children != NULL) &&
- (reader->node->type != XML_ENTITY_REF_NODE) &&
- (reader->node->type != XML_DTD_NODE)) {
- reader->node = reader->node->children;
- reader->depth++;
- if ((reader->state != XML_TEXTREADER_ELEMENT) &&
- (reader->state != XML_TEXTREADER_EMPTY))
- reader->state = XML_TEXTREADER_ELEMENT;
- DUMP_READER
- return(1);
- }
- }
- if (reader->node->next != NULL) {
- if ((oldstate == XML_TEXTREADER_ELEMENT) &&
- (reader->node->type == XML_ELEMENT_NODE)) {
- reader->state = XML_TEXTREADER_END;
- DUMP_READER
- return(1);
- }
- reader->node = reader->node->next;
- reader->state = XML_TEXTREADER_ELEMENT;
- DUMP_READER
- /*
- * Cleanup of the old node
- */
- if (oldnode->type != XML_DTD_NODE) {
- xmlUnlinkNode(oldnode);
- xmlFreeNode(oldnode);
- }
-
- return(1);
- }
- reader->node = reader->node->parent;
- if ((reader->node == NULL) ||
- (reader->node->type == XML_DOCUMENT_NODE) ||
-#ifdef LIBXML_DOCB_ENABLED
- (reader->node->type == XML_DOCB_DOCUMENT_NODE) ||
-#endif
- (reader->node->type == XML_HTML_DOCUMENT_NODE)) {
- reader->node = NULL;
- reader->depth = 0;
-
- /*
- * Cleanup of the old node
- */
- if (oldnode->type != XML_DTD_NODE) {
- xmlUnlinkNode(oldnode);
- xmlFreeNode(oldnode);
- }
-
- return(0);
- }
- reader->depth--;
- reader->state = XML_TEXTREADER_BACKTRACK;
- DUMP_READER
- return(1);
-}
-
-/************************************************************************
- * *
- * Constructor and destructors *
- * *
- ************************************************************************/
-/**
- * xmlNewTextReader:
- * @input: the xmlParserInputBufferPtr used to read data
- *
- * Create an xmlTextReader structure fed with @input
- *
- * Returns the new xmlTextReaderPtr or NULL in case of error
- */
-xmlTextReaderPtr
-xmlNewTextReader(xmlParserInputBufferPtr input) {
- xmlTextReaderPtr ret;
- int val;
-
- if (input == NULL)
- return(NULL);
- ret = xmlMalloc(sizeof(xmlTextReader));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewTextReader : malloc failed\n");
- return(NULL);
- }
- memset(ret, 0, sizeof(xmlTextReader));
- ret->input = input;
- ret->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
- if (ret->sax == NULL) {
- xmlFree(ret);
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewTextReader : malloc failed\n");
- return(NULL);
- }
- memcpy(ret->sax, &xmlDefaultSAXHandler, sizeof(xmlSAXHandler));
- ret->startElement = ret->sax->startElement;
- ret->sax->startElement = xmlTextReaderStartElement;
- ret->endElement = ret->sax->endElement;
- ret->sax->endElement = xmlTextReaderEndElement;
-
- ret->mode = XML_TEXTREADER_MODE_NORMAL;
- ret->node = NULL;
- val = xmlParserInputBufferRead(input, 4);
- if (val >= 4) {
- ret->ctxt = xmlCreatePushParserCtxt(ret->sax, NULL,
- (const char *) ret->input->buffer->content, 4, NULL);
- ret->base = 0;
- ret->cur = 4;
- } else {
- ret->ctxt = xmlCreatePushParserCtxt(ret->sax, NULL, NULL, 0, NULL);
- ret->base = 0;
- ret->cur = 0;
- }
- ret->ctxt->_private = ret;
- ret->allocs = XML_TEXTREADER_CTXT;
- return(ret);
-
-}
-
-/**
- * xmlNewTextReaderFilename:
- * @URI: the URI of the resource to process
- *
- * Create an xmlTextReader structure fed with the resource at @URI
- *
- * Returns the new xmlTextReaderPtr or NULL in case of error
- */
-xmlTextReaderPtr
-xmlNewTextReaderFilename(const char *URI) {
- xmlParserInputBufferPtr input;
- xmlTextReaderPtr ret;
-
- input = xmlParserInputBufferCreateFilename(URI, XML_CHAR_ENCODING_NONE);
- if (input == NULL)
- return(NULL);
- ret = xmlNewTextReader(input);
- if (ret == NULL) {
- xmlFreeParserInputBuffer(input);
- return(NULL);
- }
- ret->allocs |= XML_TEXTREADER_INPUT;
- return(ret);
-}
-
-/**
- * xmlFreeTextReader:
- * @reader: the xmlTextReaderPtr
- *
- * Deallocate all the resources associated to the reader
- */
-void
-xmlFreeTextReader(xmlTextReaderPtr reader) {
- if (reader == NULL)
- return;
- if (reader->ctxt != NULL) {
- if (reader->ctxt->myDoc != NULL) {
- xmlFreeDoc(reader->ctxt->myDoc);
- reader->ctxt->myDoc = NULL;
- }
- if (reader->allocs & XML_TEXTREADER_CTXT)
- xmlFreeParserCtxt(reader->ctxt);
- }
- if (reader->sax != NULL)
- xmlFree(reader->sax);
- if ((reader->input != NULL) && (reader->allocs & XML_TEXTREADER_INPUT))
- xmlFreeParserInputBuffer(reader->input);
- xmlFree(reader);
-}
-
-/************************************************************************
- * *
- * Acces API to the current node *
- * *
- ************************************************************************/
-/**
- * xmlTextReaderAttributeCount:
- * @reader: the xmlTextReaderPtr used
- *
- * Provides the number of attributes of the current node
- *
- * Returns 0 i no attributes, -1 in case of error or the attribute count
- */
-int
-xmlTextReaderAttributeCount(xmlTextReaderPtr reader) {
- int ret;
- xmlAttrPtr attr;
-
- if (reader == NULL)
- return(-1);
- if (reader->node == NULL)
- return(0);
- if (reader->node->type != XML_ELEMENT_NODE)
- return(0);
- if ((reader->state == XML_TEXTREADER_END) ||
- (reader->state == XML_TEXTREADER_BACKTRACK))
- return(0);
- ret = 0;
- attr = reader->node->properties;
- while (attr != NULL) {
- ret++;
- attr = attr->next;
- }
- return(ret);
-}
-
-/**
- * xmlTextReaderNodeType:
- * @reader: the xmlTextReaderPtr used
- *
- * Get the node type of the current node
- * Reference:
- * http://dotgnu.org/pnetlib-doc/System/Xml/XmlNodeType.html
- *
- * Returns the xmlNodeType of the current node or -1 in case of error
- */
-int
-xmlTextReaderNodeType(xmlTextReaderPtr reader) {
- if (reader == NULL)
- return(-1);
- if (reader->node == NULL)
- return(0);
- switch (reader->node->type) {
- case XML_ELEMENT_NODE:
- if ((reader->state == XML_TEXTREADER_END) ||
- (reader->state == XML_TEXTREADER_BACKTRACK))
- return(15);
- return(1);
- case XML_ATTRIBUTE_NODE:
- return(2);
- case XML_TEXT_NODE:
- return(3); /* TODO: SignificantWhitespace == 14 Whitespace == 13 */
- case XML_CDATA_SECTION_NODE:
- return(4);
- case XML_ENTITY_REF_NODE:
- return(5);
- case XML_ENTITY_NODE:
- return(6);
- case XML_PI_NODE:
- return(7);
- case XML_COMMENT_NODE:
- return(8);
- case XML_DOCUMENT_NODE:
- case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- return(9);
- case XML_DOCUMENT_FRAG_NODE:
- return(11);
- case XML_NOTATION_NODE:
- return(12);
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DTD_NODE:
- return(10);
-
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- case XML_NAMESPACE_DECL:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- return(0);
- }
- return(-1);
-}
-
-/**
- * xmlTextReaderIsEmptyElement:
- * @reader: the xmlTextReaderPtr used
- *
- * Check if the current node is empty
- *
- * Returns 1 if empty, 0 if not and -1 in case of error
- */
-int
-xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader) {
- if ((reader == NULL) || (reader->node == NULL))
- return(-1);
- if (reader->node->children != NULL)
- return(0);
- if ((reader->state == XML_TEXTREADER_EMPTY) ||
- (reader->state == XML_TEXTREADER_BACKTRACK))
- return(1);
- return(0);
-}
-
-/**
- * xmlTextReaderLocalName:
- * @reader: the xmlTextReaderPtr used
- *
- * The local name of the node.
- *
- * Returns the local name or NULL if not available
- */
-xmlChar *
-xmlTextReaderLocalName(xmlTextReaderPtr reader) {
- if ((reader == NULL) || (reader->node == NULL))
- return(NULL);
- if ((reader->node->type != XML_ELEMENT_NODE) &&
- (reader->node->type != XML_ATTRIBUTE_NODE))
- return(xmlTextReaderName(reader));
- return(xmlStrdup(reader->node->name));
-}
-
-/**
- * xmlTextReaderName:
- * @reader: the xmlTextReaderPtr used
- *
- * The qualified name of the node, equal to Prefix :LocalName.
- *
- * Returns the local name or NULL if not available
- */
-xmlChar *
-xmlTextReaderName(xmlTextReaderPtr reader) {
- xmlChar *ret;
-
- if ((reader == NULL) || (reader->node == NULL))
- return(NULL);
- switch (reader->node->type) {
- case XML_ELEMENT_NODE:
- case XML_ATTRIBUTE_NODE:
- if ((reader->node->ns == NULL) ||
- (reader->node->ns->prefix == NULL))
- return(xmlStrdup(reader->node->name));
-
- ret = xmlStrdup(reader->node->ns->prefix);
- ret = xmlStrcat(ret, BAD_CAST ":");
- ret = xmlStrcat(ret, reader->node->name);
- return(ret);
- case XML_TEXT_NODE:
- return(xmlStrdup(BAD_CAST "#text"));
- case XML_CDATA_SECTION_NODE:
- return(xmlStrdup(BAD_CAST "#cdata-section"));
- case XML_ENTITY_NODE:
- case XML_ENTITY_REF_NODE:
- return(xmlStrdup(reader->node->name));
- case XML_PI_NODE:
- return(xmlStrdup(reader->node->name));
- case XML_COMMENT_NODE:
- return(xmlStrdup(BAD_CAST "#comment"));
- case XML_DOCUMENT_NODE:
- case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- return(xmlStrdup(BAD_CAST "#document"));
- case XML_DOCUMENT_FRAG_NODE:
- return(xmlStrdup(BAD_CAST "#document-fragment"));
- case XML_NOTATION_NODE:
- return(xmlStrdup(reader->node->name));
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DTD_NODE:
- return(xmlStrdup(reader->node->name));
-
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- case XML_NAMESPACE_DECL:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- return(NULL);
- }
- return(NULL);
-}
-
-/**
- * xmlTextReaderPrefix:
- * @reader: the xmlTextReaderPtr used
- *
- * A shorthand reference to the namespace associated with the node.
- *
- * Returns the prefix or NULL if not available
- */
-xmlChar *
-xmlTextReaderPrefix(xmlTextReaderPtr reader) {
- if ((reader == NULL) || (reader->node == NULL))
- return(NULL);
- if ((reader->node->type != XML_ELEMENT_NODE) &&
- (reader->node->type != XML_ATTRIBUTE_NODE))
- return(NULL);
- if ((reader->node->ns != NULL) || (reader->node->ns->prefix != NULL))
- return(xmlStrdup(reader->node->ns->prefix));
- return(NULL);
-}
-
-/**
- * xmlTextReaderNamespaceUri:
- * @reader: the xmlTextReaderPtr used
- *
- * The URI defining the namespace associated with the node.
- *
- * Returns the namespace URI or NULL if not available
- */
-xmlChar *
-xmlTextReaderNamespaceUri(xmlTextReaderPtr reader) {
- if ((reader == NULL) || (reader->node == NULL))
- return(NULL);
- if ((reader->node->type != XML_ELEMENT_NODE) &&
- (reader->node->type != XML_ATTRIBUTE_NODE))
- return(NULL);
- if (reader->node->ns != NULL)
- return(xmlStrdup(reader->node->ns->href));
- return(NULL);
-}
-
-/**
- * xmlTextReaderBaseUri:
- * @reader: the xmlTextReaderPtr used
- *
- * The base URI of the node.
- *
- * Returns the base URI or NULL if not available
- */
-xmlChar *
-xmlTextReaderBaseUri(xmlTextReaderPtr reader) {
- if ((reader == NULL) || (reader->node == NULL))
- return(NULL);
- return(xmlNodeGetBase(NULL, reader->node));
-}
-
-/**
- * xmlTextReaderDepth:
- * @reader: the xmlTextReaderPtr used
- *
- * The depth of the node in the tree.
- *
- * Returns the depth or -1 in case of error
- */
-int
-xmlTextReaderDepth(xmlTextReaderPtr reader) {
- if (reader == NULL)
- return(-1);
- if (reader->node == NULL)
- return(0);
-
- return(reader->depth);
-}
-
-/**
- * xmlTextReaderHasAttributes:
- * @reader: the xmlTextReaderPtr used
- *
- * Whether the node has attributes.
- *
- * Returns 1 if true, 0 if false, and -1 in case or error
- */
-int
-xmlTextReaderHasAttributes(xmlTextReaderPtr reader) {
- if (reader == NULL)
- return(-1);
- if (reader->node == NULL)
- return(0);
-
- if ((reader->node->type == XML_ELEMENT_NODE) &&
- (reader->node->properties != NULL))
- return(1);
- /* TODO: handle the xmlDecl */
- return(0);
-}
-
-/**
- * xmlTextReaderHasValue:
- * @reader: the xmlTextReaderPtr used
- *
- * Whether the node can have a text value.
- *
- * Returns 1 if true, 0 if false, and -1 in case or error
- */
-int
-xmlTextReaderHasValue(xmlTextReaderPtr reader) {
- if (reader == NULL)
- return(-1);
- if (reader->node == NULL)
- return(0);
-
- switch (reader->node->type) {
- case XML_ATTRIBUTE_NODE:
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- return(1);
- default:
- return(0);
- }
- return(0);
-}
-
-/**
- * xmlTextReaderValue:
- * @reader: the xmlTextReaderPtr used
- *
- * Provides the text value of the node if present
- *
- * Returns the string or NULL if not available. The retsult must be deallocated
- * with xmlFree()
- */
-xmlChar *
-xmlTextReaderValue(xmlTextReaderPtr reader) {
- if (reader == NULL)
- return(NULL);
- if (reader->node == NULL)
- return(NULL);
-
- switch (reader->node->type) {
- case XML_ATTRIBUTE_NODE:{
- xmlAttrPtr attr = (xmlAttrPtr) reader->node;
-
- if (attr->parent != NULL)
- return (xmlNodeListGetString
- (attr->parent->doc, attr->children, 1));
- else
- return (xmlNodeListGetString(NULL, attr->children, 1));
- break;
- }
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- if (reader->node->content != NULL)
- return (xmlStrdup(reader->node->content));
- default:
- return(NULL);
- }
- return(NULL);
-}
-
-/**
- * xmlTextReaderIsDefault:
- * @reader: the xmlTextReaderPtr used
- *
- * Whether an Attribute node was generated from the default value
- * defined in the DTD or schema.
- *
- * Returns 0 if not defaulted, 1 if defaulted, and -1 in case of error
- */
-int
-xmlTextReaderIsDefault(xmlTextReaderPtr reader) {
- if (reader == NULL)
- return(-1);
- return(0);
-}
-
-/**
- * xmlTextReaderQuoteChar:
- * @reader: the xmlTextReaderPtr used
- *
- * The quotation mark character used to enclose the value of an attribute.
- *
- * Returns " or ' and -1 in case of error
- */
-int
-xmlTextReaderQuoteChar(xmlTextReaderPtr reader) {
- if (reader == NULL)
- return(-1);
- /* TODO maybe lookup the attribute value for " first */
- return((int) '"');
-}
-
-/**
- * xmlTextReaderXmlLang:
- * @reader: the xmlTextReaderPtr used
- *
- * The xml:lang scope within which the node resides.
- *
- * Returns the xml:lang value or NULL if none exists.
- */
-xmlChar *
-xmlTextReaderXmlLang(xmlTextReaderPtr reader) {
- if (reader == NULL)
- return(NULL);
- if (reader->node == NULL)
- return(NULL);
- return(xmlNodeGetLang(reader->node));
-}
-
diff --git a/bundle/libxml/xmlregexp.c b/bundle/libxml/xmlregexp.c
deleted file mode 100644
index 129c1269ec..0000000000
--- a/bundle/libxml/xmlregexp.c
+++ /dev/null
@@ -1,4319 +0,0 @@
-/*
- * regexp.c: generic and extensible Regular Expression engine
- *
- * Basically designed with the purpose of compiling regexps for
- * the variety of validation/shemas mechanisms now available in
- * XML related specifications thise includes:
- * - XML-1.0 DTD validation
- * - XML Schemas structure part 1
- * - XML Schemas Datatypes part 2 especially Appendix F
- * - RELAX-NG/TREX i.e. the counter proposal
- *
- * See Copyright for the status of this software.
- *
- * Daniel Veillard <veillard@redhat.com>
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#ifdef LIBXML_REGEXP_ENABLED
-
-#include <stdio.h>
-#include <string.h>
-#include <libxml/tree.h>
-#include <libxml/parserInternals.h>
-#include <libxml/xmlregexp.h>
-#include <libxml/xmlautomata.h>
-#include <libxml/xmlunicode.h>
-
-/* #define DEBUG_REGEXP_GRAPH */
-/* #define DEBUG_REGEXP_EXEC */
-/* #define DEBUG_PUSH */
-/* #define DEBUG_COMPACTION */
-
-#define ERROR(str) ctxt->error = 1; \
- xmlGenericError(xmlGenericErrorContext, "Regexp: %s: %s\n", str, ctxt->cur)
-#define NEXT ctxt->cur++
-#define CUR (*(ctxt->cur))
-#define NXT(index) (ctxt->cur[index])
-
-#define CUR_SCHAR(s, l) xmlStringCurrentChar(NULL, s, &l)
-#define NEXTL(l) ctxt->cur += l;
-
-/**
- * TODO:
- *
- * macro to flag unimplemented blocks
- */
-#define TODO \
- xmlGenericError(xmlGenericErrorContext, \
- "Unimplemented block at %s:%d\n", \
- __FILE__, __LINE__);
-
-
-/************************************************************************
- * *
- * Datatypes and structures *
- * *
- ************************************************************************/
-
-typedef enum {
- XML_REGEXP_EPSILON = 1,
- XML_REGEXP_CHARVAL,
- XML_REGEXP_RANGES,
- XML_REGEXP_SUBREG,
- XML_REGEXP_STRING,
- XML_REGEXP_ANYCHAR, /* . */
- XML_REGEXP_ANYSPACE, /* \s */
- XML_REGEXP_NOTSPACE, /* \S */
- XML_REGEXP_INITNAME, /* \l */
- XML_REGEXP_NOTINITNAME, /* \l */
- XML_REGEXP_NAMECHAR, /* \c */
- XML_REGEXP_NOTNAMECHAR, /* \C */
- XML_REGEXP_DECIMAL, /* \d */
- XML_REGEXP_NOTDECIMAL, /* \d */
- XML_REGEXP_REALCHAR, /* \w */
- XML_REGEXP_NOTREALCHAR, /* \w */
- XML_REGEXP_LETTER,
- XML_REGEXP_LETTER_UPPERCASE,
- XML_REGEXP_LETTER_LOWERCASE,
- XML_REGEXP_LETTER_TITLECASE,
- XML_REGEXP_LETTER_MODIFIER,
- XML_REGEXP_LETTER_OTHERS,
- XML_REGEXP_MARK,
- XML_REGEXP_MARK_NONSPACING,
- XML_REGEXP_MARK_SPACECOMBINING,
- XML_REGEXP_MARK_ENCLOSING,
- XML_REGEXP_NUMBER,
- XML_REGEXP_NUMBER_DECIMAL,
- XML_REGEXP_NUMBER_LETTER,
- XML_REGEXP_NUMBER_OTHERS,
- XML_REGEXP_PUNCT,
- XML_REGEXP_PUNCT_CONNECTOR,
- XML_REGEXP_PUNCT_DASH,
- XML_REGEXP_PUNCT_OPEN,
- XML_REGEXP_PUNCT_CLOSE,
- XML_REGEXP_PUNCT_INITQUOTE,
- XML_REGEXP_PUNCT_FINQUOTE,
- XML_REGEXP_PUNCT_OTHERS,
- XML_REGEXP_SEPAR,
- XML_REGEXP_SEPAR_SPACE,
- XML_REGEXP_SEPAR_LINE,
- XML_REGEXP_SEPAR_PARA,
- XML_REGEXP_SYMBOL,
- XML_REGEXP_SYMBOL_MATH,
- XML_REGEXP_SYMBOL_CURRENCY,
- XML_REGEXP_SYMBOL_MODIFIER,
- XML_REGEXP_SYMBOL_OTHERS,
- XML_REGEXP_OTHER,
- XML_REGEXP_OTHER_CONTROL,
- XML_REGEXP_OTHER_FORMAT,
- XML_REGEXP_OTHER_PRIVATE,
- XML_REGEXP_OTHER_NA,
- XML_REGEXP_BLOCK_NAME
-} xmlRegAtomType;
-
-typedef enum {
- XML_REGEXP_QUANT_EPSILON = 1,
- XML_REGEXP_QUANT_ONCE,
- XML_REGEXP_QUANT_OPT,
- XML_REGEXP_QUANT_MULT,
- XML_REGEXP_QUANT_PLUS,
- XML_REGEXP_QUANT_ONCEONLY,
- XML_REGEXP_QUANT_ALL,
- XML_REGEXP_QUANT_RANGE
-} xmlRegQuantType;
-
-typedef enum {
- XML_REGEXP_START_STATE = 1,
- XML_REGEXP_FINAL_STATE,
- XML_REGEXP_TRANS_STATE
-} xmlRegStateType;
-
-typedef enum {
- XML_REGEXP_MARK_NORMAL = 0,
- XML_REGEXP_MARK_START,
- XML_REGEXP_MARK_VISITED
-} xmlRegMarkedType;
-
-typedef struct _xmlRegRange xmlRegRange;
-typedef xmlRegRange *xmlRegRangePtr;
-
-struct _xmlRegRange {
- int neg;
- xmlRegAtomType type;
- int start;
- int end;
- xmlChar *blockName;
-};
-
-typedef struct _xmlRegAtom xmlRegAtom;
-typedef xmlRegAtom *xmlRegAtomPtr;
-
-typedef struct _xmlAutomataState xmlRegState;
-typedef xmlRegState *xmlRegStatePtr;
-
-struct _xmlRegAtom {
- int no;
- xmlRegAtomType type;
- xmlRegQuantType quant;
- int min;
- int max;
-
- void *valuep;
- void *valuep2;
- int neg;
- int codepoint;
- xmlRegStatePtr start;
- xmlRegStatePtr stop;
- int maxRanges;
- int nbRanges;
- xmlRegRangePtr *ranges;
- void *data;
-};
-
-typedef struct _xmlRegCounter xmlRegCounter;
-typedef xmlRegCounter *xmlRegCounterPtr;
-
-struct _xmlRegCounter {
- int min;
- int max;
-};
-
-typedef struct _xmlRegTrans xmlRegTrans;
-typedef xmlRegTrans *xmlRegTransPtr;
-
-struct _xmlRegTrans {
- xmlRegAtomPtr atom;
- int to;
- int counter;
- int count;
-};
-
-struct _xmlAutomataState {
- xmlRegStateType type;
- xmlRegMarkedType mark;
- xmlRegMarkedType reached;
- int no;
-
- int maxTrans;
- int nbTrans;
- xmlRegTrans *trans;
-};
-
-typedef struct _xmlAutomata xmlRegParserCtxt;
-typedef xmlRegParserCtxt *xmlRegParserCtxtPtr;
-
-struct _xmlAutomata {
- xmlChar *string;
- xmlChar *cur;
-
- int error;
- int neg;
-
- xmlRegStatePtr start;
- xmlRegStatePtr end;
- xmlRegStatePtr state;
-
- xmlRegAtomPtr atom;
-
- int maxAtoms;
- int nbAtoms;
- xmlRegAtomPtr *atoms;
-
- int maxStates;
- int nbStates;
- xmlRegStatePtr *states;
-
- int maxCounters;
- int nbCounters;
- xmlRegCounter *counters;
-
- int determinist;
-};
-
-struct _xmlRegexp {
- xmlChar *string;
- int nbStates;
- xmlRegStatePtr *states;
- int nbAtoms;
- xmlRegAtomPtr *atoms;
- int nbCounters;
- xmlRegCounter *counters;
- int determinist;
- /*
- * That's the compact form for determinists automatas
- */
- int nbstates;
- int *compact;
- void **transdata;
- int nbstrings;
- xmlChar **stringMap;
-};
-
-typedef struct _xmlRegExecRollback xmlRegExecRollback;
-typedef xmlRegExecRollback *xmlRegExecRollbackPtr;
-
-struct _xmlRegExecRollback {
- xmlRegStatePtr state;/* the current state */
- int index; /* the index in the input stack */
- int nextbranch; /* the next transition to explore in that state */
- int *counts; /* save the automate state if it has some */
-};
-
-typedef struct _xmlRegInputToken xmlRegInputToken;
-typedef xmlRegInputToken *xmlRegInputTokenPtr;
-
-struct _xmlRegInputToken {
- xmlChar *value;
- void *data;
-};
-
-struct _xmlRegExecCtxt {
- int status; /* execution status != 0 indicate an error */
- int determinist; /* did we found an inderterministic behaviour */
- xmlRegexpPtr comp; /* the compiled regexp */
- xmlRegExecCallbacks callback;
- void *data;
-
- xmlRegStatePtr state;/* the current state */
- int transno; /* the current transition on that state */
- int transcount; /* the number of char in char counted transitions */
-
- /*
- * A stack of rollback states
- */
- int maxRollbacks;
- int nbRollbacks;
- xmlRegExecRollback *rollbacks;
-
- /*
- * The state of the automata if any
- */
- int *counts;
-
- /*
- * The input stack
- */
- int inputStackMax;
- int inputStackNr;
- int index;
- int *charStack;
- const xmlChar *inputString; /* when operating on characters */
- xmlRegInputTokenPtr inputStack;/* when operating on strings */
-
-};
-
-#define REGEXP_ALL_COUNTER 0x123456
-#define REGEXP_ALL_LAX_COUNTER 0x123457
-
-static void xmlFAParseRegExp(xmlRegParserCtxtPtr ctxt, int top);
-static void xmlRegFreeState(xmlRegStatePtr state);
-static void xmlRegFreeAtom(xmlRegAtomPtr atom);
-
-/************************************************************************
- * *
- * Allocation/Deallocation *
- * *
- ************************************************************************/
-
-static int xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt);
-/**
- * xmlRegEpxFromParse:
- * @ctxt: the parser context used to build it
- *
- * Allocate a new regexp and fill it with the reult from the parser
- *
- * Returns the new regexp or NULL in case of error
- */
-static xmlRegexpPtr
-xmlRegEpxFromParse(xmlRegParserCtxtPtr ctxt) {
- xmlRegexpPtr ret;
-
- ret = (xmlRegexpPtr) xmlMalloc(sizeof(xmlRegexp));
- if (ret == NULL)
- return(NULL);
- memset(ret, 0, sizeof(xmlRegexp));
- ret->string = ctxt->string;
- ctxt->string = NULL;
- ret->nbStates = ctxt->nbStates;
- ctxt->nbStates = 0;
- ret->states = ctxt->states;
- ctxt->states = NULL;
- ret->nbAtoms = ctxt->nbAtoms;
- ctxt->nbAtoms = 0;
- ret->atoms = ctxt->atoms;
- ctxt->atoms = NULL;
- ret->nbCounters = ctxt->nbCounters;
- ctxt->nbCounters = 0;
- ret->counters = ctxt->counters;
- ctxt->counters = NULL;
- ret->determinist = ctxt->determinist;
-
- if ((ret->determinist != 0) &&
- (ret->nbCounters == 0) &&
- (ret->atoms != NULL) &&
- (ret->atoms[0] != NULL) &&
- (ret->atoms[0]->type == XML_REGEXP_STRING)) {
- int i, j, nbstates = 0, nbatoms = 0;
- int *stateRemap;
- int *stringRemap;
- int *transitions;
- void **transdata;
- xmlChar **stringMap;
- xmlChar *value;
-
- /*
- * Switch to a compact representation
- * 1/ counting the effective number of states left
- * 2/ conting the unique number of atoms, and check that
- * they are all of the string type
- * 3/ build a table state x atom for the transitions
- */
-
- stateRemap = xmlMalloc(ret->nbStates * sizeof(int));
- for (i = 0;i < ret->nbStates;i++) {
- if (ret->states[i] != NULL) {
- stateRemap[i] = nbstates;
- nbstates++;
- } else {
- stateRemap[i] = -1;
- }
- }
-#ifdef DEBUG_COMPACTION
- printf("Final: %d states\n", nbstates);
-#endif
- stringMap = xmlMalloc(ret->nbAtoms * sizeof(char *));
- stringRemap = xmlMalloc(ret->nbAtoms * sizeof(int));
- for (i = 0;i < ret->nbAtoms;i++) {
- if ((ret->atoms[i]->type == XML_REGEXP_STRING) &&
- (ret->atoms[i]->quant == XML_REGEXP_QUANT_ONCE)) {
- value = ret->atoms[i]->valuep;
- for (j = 0;j < nbatoms;j++) {
- if (xmlStrEqual(stringMap[j], value)) {
- stringRemap[i] = j;
- break;
- }
- }
- if (j >= nbatoms) {
- stringRemap[i] = nbatoms;
- stringMap[nbatoms] = xmlStrdup(value);
- nbatoms++;
- }
- } else {
- xmlFree(stateRemap);
- xmlFree(stringRemap);
- for (i = 0;i < nbatoms;i++)
- xmlFree(stringMap[i]);
- xmlFree(stringMap);
- goto fail_compact;
- }
- }
-#ifdef DEBUG_COMPACTION
- printf("Final: %d atoms\n", nbatoms);
-#endif
-
- /*
- * Allocate the transition table. The first entry for each
- * state correspond to the state type.
- */
- transitions = (int *) xmlMalloc(nbstates * (nbatoms + 1) * sizeof(int));
- transdata = NULL;
- memset(transitions, 0, nbstates * (nbatoms + 1) * sizeof(int));
-
- for (i = 0;i < ret->nbStates;i++) {
- int stateno, atomno, targetno, prev;
- xmlRegStatePtr state;
- xmlRegTransPtr trans;
-
- stateno = stateRemap[i];
- if (stateno == -1)
- continue;
- state = ret->states[i];
-
- transitions[stateno * (nbatoms + 1)] = state->type;
-
- for (j = 0;j < state->nbTrans;j++) {
- trans = &(state->trans[j]);
- if ((trans->to == -1) || (trans->atom == NULL))
- continue;
- atomno = stringRemap[trans->atom->no];
- if ((trans->atom->data != NULL) && (transdata == NULL)) {
- transdata = (void **) xmlMalloc(nbstates * nbatoms *
- sizeof(void *));
- if (transdata != NULL)
- memset(transdata, 0,
- nbstates * nbatoms * sizeof(void *));
- }
- targetno = stateRemap[trans->to];
- /*
- * if the same atome can generate transition to 2 different
- * states then it means the automata is not determinist and
- * the compact form can't be used !
- */
- prev = transitions[stateno * (nbatoms + 1) + atomno + 1];
- if (prev != 0) {
- if (prev != targetno + 1) {
- printf("not determinist\n");
- ret->determinist = 0;
-#ifdef DEBUG_COMPACTION
- printf("Indet: state %d trans %d, atom %d to %d : %d to %d\n",
- i, j, trans->atom->no, trans->to, atomno, targetno);
- printf(" previous to is %d\n", prev);
-#endif
- ret->determinist = 0;
- if (transdata != NULL)
- xmlFree(transdata);
- xmlFree(transitions);
- xmlFree(stateRemap);
- xmlFree(stringRemap);
- for (i = 0;i < nbatoms;i++)
- xmlFree(stringMap[i]);
- xmlFree(stringMap);
- goto fail_compact;
- }
- } else {
-#if 0
- printf("State %d trans %d: atom %d to %d : %d to %d\n",
- i, j, trans->atom->no, trans->to, atomno, targetno);
-#endif
- transitions[stateno * (nbatoms + 1) + atomno + 1] =
- targetno + 1; /* to avoid 0 */
- if (transdata != NULL)
- transdata[stateno * nbatoms + atomno] =
- trans->atom->data;
- }
- }
- }
- ret->determinist = 1;
-#ifdef DEBUG_COMPACTION
- /*
- * Debug
- */
- for (i = 0;i < nbstates;i++) {
- for (j = 0;j < nbatoms + 1;j++) {
- printf("%02d ", transitions[i * (nbatoms + 1) + j]);
- }
- printf("\n");
- }
- printf("\n");
-#endif
- /*
- * Cleanup of the old data
- */
- if (ret->states != NULL) {
- for (i = 0;i < ret->nbStates;i++)
- xmlRegFreeState(ret->states[i]);
- xmlFree(ret->states);
- }
- ret->states = NULL;
- ret->nbStates = 0;
- if (ret->atoms != NULL) {
- for (i = 0;i < ret->nbAtoms;i++)
- xmlRegFreeAtom(ret->atoms[i]);
- xmlFree(ret->atoms);
- }
- ret->atoms = NULL;
- ret->nbAtoms = 0;
-
- ret->compact = transitions;
- ret->transdata = transdata;
- ret->stringMap = stringMap;
- ret->nbstrings = nbatoms;
- ret->nbstates = nbstates;
- xmlFree(stateRemap);
- xmlFree(stringRemap);
- }
-fail_compact:
- return(ret);
-}
-
-/**
- * xmlRegNewParserCtxt:
- * @string: the string to parse
- *
- * Allocate a new regexp parser context
- *
- * Returns the new context or NULL in case of error
- */
-static xmlRegParserCtxtPtr
-xmlRegNewParserCtxt(const xmlChar *string) {
- xmlRegParserCtxtPtr ret;
-
- ret = (xmlRegParserCtxtPtr) xmlMalloc(sizeof(xmlRegParserCtxt));
- if (ret == NULL)
- return(NULL);
- memset(ret, 0, sizeof(xmlRegParserCtxt));
- if (string != NULL)
- ret->string = xmlStrdup(string);
- ret->cur = ret->string;
- ret->neg = 0;
- ret->error = 0;
- ret->determinist = -1;
- return(ret);
-}
-
-/**
- * xmlRegNewRange:
- * @ctxt: the regexp parser context
- * @neg: is that negative
- * @type: the type of range
- * @start: the start codepoint
- * @end: the end codepoint
- *
- * Allocate a new regexp range
- *
- * Returns the new range or NULL in case of error
- */
-static xmlRegRangePtr
-xmlRegNewRange(xmlRegParserCtxtPtr ctxt,
- int neg, xmlRegAtomType type, int start, int end) {
- xmlRegRangePtr ret;
-
- ret = (xmlRegRangePtr) xmlMalloc(sizeof(xmlRegRange));
- if (ret == NULL) {
- ERROR("failed to allocate regexp range");
- return(NULL);
- }
- ret->neg = neg;
- ret->type = type;
- ret->start = start;
- ret->end = end;
- return(ret);
-}
-
-/**
- * xmlRegFreeRange:
- * @range: the regexp range
- *
- * Free a regexp range
- */
-static void
-xmlRegFreeRange(xmlRegRangePtr range) {
- if (range == NULL)
- return;
-
- if (range->blockName != NULL)
- xmlFree(range->blockName);
- xmlFree(range);
-}
-
-/**
- * xmlRegNewAtom:
- * @ctxt: the regexp parser context
- * @type: the type of atom
- *
- * Allocate a new regexp range
- *
- * Returns the new atom or NULL in case of error
- */
-static xmlRegAtomPtr
-xmlRegNewAtom(xmlRegParserCtxtPtr ctxt, xmlRegAtomType type) {
- xmlRegAtomPtr ret;
-
- ret = (xmlRegAtomPtr) xmlMalloc(sizeof(xmlRegAtom));
- if (ret == NULL) {
- ERROR("failed to allocate regexp atom");
- return(NULL);
- }
- memset(ret, 0, sizeof(xmlRegAtom));
- ret->type = type;
- ret->quant = XML_REGEXP_QUANT_ONCE;
- ret->min = 0;
- ret->max = 0;
- return(ret);
-}
-
-/**
- * xmlRegFreeAtom:
- * @atom: the regexp atom
- *
- * Free a regexp atom
- */
-static void
-xmlRegFreeAtom(xmlRegAtomPtr atom) {
- int i;
-
- if (atom == NULL)
- return;
-
- for (i = 0;i < atom->nbRanges;i++)
- xmlRegFreeRange(atom->ranges[i]);
- if (atom->ranges != NULL)
- xmlFree(atom->ranges);
- if (atom->type == XML_REGEXP_STRING)
- xmlFree(atom->valuep);
- xmlFree(atom);
-}
-
-static xmlRegStatePtr
-xmlRegNewState(xmlRegParserCtxtPtr ctxt) {
- xmlRegStatePtr ret;
-
- ret = (xmlRegStatePtr) xmlMalloc(sizeof(xmlRegState));
- if (ret == NULL) {
- ERROR("failed to allocate regexp state");
- return(NULL);
- }
- memset(ret, 0, sizeof(xmlRegState));
- ret->type = XML_REGEXP_TRANS_STATE;
- ret->mark = XML_REGEXP_MARK_NORMAL;
- return(ret);
-}
-
-/**
- * xmlRegFreeState:
- * @state: the regexp state
- *
- * Free a regexp state
- */
-static void
-xmlRegFreeState(xmlRegStatePtr state) {
- if (state == NULL)
- return;
-
- if (state->trans != NULL)
- xmlFree(state->trans);
- xmlFree(state);
-}
-
-/**
- * xmlRegFreeParserCtxt:
- * @ctxt: the regexp parser context
- *
- * Free a regexp parser context
- */
-static void
-xmlRegFreeParserCtxt(xmlRegParserCtxtPtr ctxt) {
- int i;
- if (ctxt == NULL)
- return;
-
- if (ctxt->string != NULL)
- xmlFree(ctxt->string);
- if (ctxt->states != NULL) {
- for (i = 0;i < ctxt->nbStates;i++)
- xmlRegFreeState(ctxt->states[i]);
- xmlFree(ctxt->states);
- }
- if (ctxt->atoms != NULL) {
- for (i = 0;i < ctxt->nbAtoms;i++)
- xmlRegFreeAtom(ctxt->atoms[i]);
- xmlFree(ctxt->atoms);
- }
- if (ctxt->counters != NULL)
- xmlFree(ctxt->counters);
- xmlFree(ctxt);
-}
-
-/************************************************************************
- * *
- * Display of Data structures *
- * *
- ************************************************************************/
-
-static void
-xmlRegPrintAtomType(FILE *output, xmlRegAtomType type) {
- switch (type) {
- case XML_REGEXP_EPSILON:
- fprintf(output, "epsilon "); break;
- case XML_REGEXP_CHARVAL:
- fprintf(output, "charval "); break;
- case XML_REGEXP_RANGES:
- fprintf(output, "ranges "); break;
- case XML_REGEXP_SUBREG:
- fprintf(output, "subexpr "); break;
- case XML_REGEXP_STRING:
- fprintf(output, "string "); break;
- case XML_REGEXP_ANYCHAR:
- fprintf(output, "anychar "); break;
- case XML_REGEXP_ANYSPACE:
- fprintf(output, "anyspace "); break;
- case XML_REGEXP_NOTSPACE:
- fprintf(output, "notspace "); break;
- case XML_REGEXP_INITNAME:
- fprintf(output, "initname "); break;
- case XML_REGEXP_NOTINITNAME:
- fprintf(output, "notinitname "); break;
- case XML_REGEXP_NAMECHAR:
- fprintf(output, "namechar "); break;
- case XML_REGEXP_NOTNAMECHAR:
- fprintf(output, "notnamechar "); break;
- case XML_REGEXP_DECIMAL:
- fprintf(output, "decimal "); break;
- case XML_REGEXP_NOTDECIMAL:
- fprintf(output, "notdecimal "); break;
- case XML_REGEXP_REALCHAR:
- fprintf(output, "realchar "); break;
- case XML_REGEXP_NOTREALCHAR:
- fprintf(output, "notrealchar "); break;
- case XML_REGEXP_LETTER:
- fprintf(output, "LETTER "); break;
- case XML_REGEXP_LETTER_UPPERCASE:
- fprintf(output, "LETTER_UPPERCASE "); break;
- case XML_REGEXP_LETTER_LOWERCASE:
- fprintf(output, "LETTER_LOWERCASE "); break;
- case XML_REGEXP_LETTER_TITLECASE:
- fprintf(output, "LETTER_TITLECASE "); break;
- case XML_REGEXP_LETTER_MODIFIER:
- fprintf(output, "LETTER_MODIFIER "); break;
- case XML_REGEXP_LETTER_OTHERS:
- fprintf(output, "LETTER_OTHERS "); break;
- case XML_REGEXP_MARK:
- fprintf(output, "MARK "); break;
- case XML_REGEXP_MARK_NONSPACING:
- fprintf(output, "MARK_NONSPACING "); break;
- case XML_REGEXP_MARK_SPACECOMBINING:
- fprintf(output, "MARK_SPACECOMBINING "); break;
- case XML_REGEXP_MARK_ENCLOSING:
- fprintf(output, "MARK_ENCLOSING "); break;
- case XML_REGEXP_NUMBER:
- fprintf(output, "NUMBER "); break;
- case XML_REGEXP_NUMBER_DECIMAL:
- fprintf(output, "NUMBER_DECIMAL "); break;
- case XML_REGEXP_NUMBER_LETTER:
- fprintf(output, "NUMBER_LETTER "); break;
- case XML_REGEXP_NUMBER_OTHERS:
- fprintf(output, "NUMBER_OTHERS "); break;
- case XML_REGEXP_PUNCT:
- fprintf(output, "PUNCT "); break;
- case XML_REGEXP_PUNCT_CONNECTOR:
- fprintf(output, "PUNCT_CONNECTOR "); break;
- case XML_REGEXP_PUNCT_DASH:
- fprintf(output, "PUNCT_DASH "); break;
- case XML_REGEXP_PUNCT_OPEN:
- fprintf(output, "PUNCT_OPEN "); break;
- case XML_REGEXP_PUNCT_CLOSE:
- fprintf(output, "PUNCT_CLOSE "); break;
- case XML_REGEXP_PUNCT_INITQUOTE:
- fprintf(output, "PUNCT_INITQUOTE "); break;
- case XML_REGEXP_PUNCT_FINQUOTE:
- fprintf(output, "PUNCT_FINQUOTE "); break;
- case XML_REGEXP_PUNCT_OTHERS:
- fprintf(output, "PUNCT_OTHERS "); break;
- case XML_REGEXP_SEPAR:
- fprintf(output, "SEPAR "); break;
- case XML_REGEXP_SEPAR_SPACE:
- fprintf(output, "SEPAR_SPACE "); break;
- case XML_REGEXP_SEPAR_LINE:
- fprintf(output, "SEPAR_LINE "); break;
- case XML_REGEXP_SEPAR_PARA:
- fprintf(output, "SEPAR_PARA "); break;
- case XML_REGEXP_SYMBOL:
- fprintf(output, "SYMBOL "); break;
- case XML_REGEXP_SYMBOL_MATH:
- fprintf(output, "SYMBOL_MATH "); break;
- case XML_REGEXP_SYMBOL_CURRENCY:
- fprintf(output, "SYMBOL_CURRENCY "); break;
- case XML_REGEXP_SYMBOL_MODIFIER:
- fprintf(output, "SYMBOL_MODIFIER "); break;
- case XML_REGEXP_SYMBOL_OTHERS:
- fprintf(output, "SYMBOL_OTHERS "); break;
- case XML_REGEXP_OTHER:
- fprintf(output, "OTHER "); break;
- case XML_REGEXP_OTHER_CONTROL:
- fprintf(output, "OTHER_CONTROL "); break;
- case XML_REGEXP_OTHER_FORMAT:
- fprintf(output, "OTHER_FORMAT "); break;
- case XML_REGEXP_OTHER_PRIVATE:
- fprintf(output, "OTHER_PRIVATE "); break;
- case XML_REGEXP_OTHER_NA:
- fprintf(output, "OTHER_NA "); break;
- case XML_REGEXP_BLOCK_NAME:
- fprintf(output, "BLOCK "); break;
- }
-}
-
-static void
-xmlRegPrintQuantType(FILE *output, xmlRegQuantType type) {
- switch (type) {
- case XML_REGEXP_QUANT_EPSILON:
- fprintf(output, "epsilon "); break;
- case XML_REGEXP_QUANT_ONCE:
- fprintf(output, "once "); break;
- case XML_REGEXP_QUANT_OPT:
- fprintf(output, "? "); break;
- case XML_REGEXP_QUANT_MULT:
- fprintf(output, "* "); break;
- case XML_REGEXP_QUANT_PLUS:
- fprintf(output, "+ "); break;
- case XML_REGEXP_QUANT_RANGE:
- fprintf(output, "range "); break;
- case XML_REGEXP_QUANT_ONCEONLY:
- fprintf(output, "onceonly "); break;
- case XML_REGEXP_QUANT_ALL:
- fprintf(output, "all "); break;
- }
-}
-static void
-xmlRegPrintRange(FILE *output, xmlRegRangePtr range) {
- fprintf(output, " range: ");
- if (range->neg)
- fprintf(output, "negative ");
- xmlRegPrintAtomType(output, range->type);
- fprintf(output, "%c - %c\n", range->start, range->end);
-}
-
-static void
-xmlRegPrintAtom(FILE *output, xmlRegAtomPtr atom) {
- fprintf(output, " atom: ");
- if (atom == NULL) {
- fprintf(output, "NULL\n");
- return;
- }
- xmlRegPrintAtomType(output, atom->type);
- xmlRegPrintQuantType(output, atom->quant);
- if (atom->quant == XML_REGEXP_QUANT_RANGE)
- fprintf(output, "%d-%d ", atom->min, atom->max);
- if (atom->type == XML_REGEXP_STRING)
- fprintf(output, "'%s' ", (char *) atom->valuep);
- if (atom->type == XML_REGEXP_CHARVAL)
- fprintf(output, "char %c\n", atom->codepoint);
- else if (atom->type == XML_REGEXP_RANGES) {
- int i;
- fprintf(output, "%d entries\n", atom->nbRanges);
- for (i = 0; i < atom->nbRanges;i++)
- xmlRegPrintRange(output, atom->ranges[i]);
- } else if (atom->type == XML_REGEXP_SUBREG) {
- fprintf(output, "start %d end %d\n", atom->start->no, atom->stop->no);
- } else {
- fprintf(output, "\n");
- }
-}
-
-static void
-xmlRegPrintTrans(FILE *output, xmlRegTransPtr trans) {
- fprintf(output, " trans: ");
- if (trans == NULL) {
- fprintf(output, "NULL\n");
- return;
- }
- if (trans->to < 0) {
- fprintf(output, "removed\n");
- return;
- }
- if (trans->counter >= 0) {
- fprintf(output, "counted %d, ", trans->counter);
- }
- if (trans->count == REGEXP_ALL_COUNTER) {
- fprintf(output, "all transition, ");
- } else if (trans->count >= 0) {
- fprintf(output, "count based %d, ", trans->count);
- }
- if (trans->atom == NULL) {
- fprintf(output, "epsilon to %d\n", trans->to);
- return;
- }
- if (trans->atom->type == XML_REGEXP_CHARVAL)
- fprintf(output, "char %c ", trans->atom->codepoint);
- fprintf(output, "atom %d, to %d\n", trans->atom->no, trans->to);
-}
-
-static void
-xmlRegPrintState(FILE *output, xmlRegStatePtr state) {
- int i;
-
- fprintf(output, " state: ");
- if (state == NULL) {
- fprintf(output, "NULL\n");
- return;
- }
- if (state->type == XML_REGEXP_START_STATE)
- fprintf(output, "START ");
- if (state->type == XML_REGEXP_FINAL_STATE)
- fprintf(output, "FINAL ");
-
- fprintf(output, "%d, %d transitions:\n", state->no, state->nbTrans);
- for (i = 0;i < state->nbTrans; i++) {
- xmlRegPrintTrans(output, &(state->trans[i]));
- }
-}
-
-#ifdef DEBUG_REGEXP_GRAPH
-static void
-xmlRegPrintCtxt(FILE *output, xmlRegParserCtxtPtr ctxt) {
- int i;
-
- fprintf(output, " ctxt: ");
- if (ctxt == NULL) {
- fprintf(output, "NULL\n");
- return;
- }
- fprintf(output, "'%s' ", ctxt->string);
- if (ctxt->error)
- fprintf(output, "error ");
- if (ctxt->neg)
- fprintf(output, "neg ");
- fprintf(output, "\n");
- fprintf(output, "%d atoms:\n", ctxt->nbAtoms);
- for (i = 0;i < ctxt->nbAtoms; i++) {
- fprintf(output, " %02d ", i);
- xmlRegPrintAtom(output, ctxt->atoms[i]);
- }
- if (ctxt->atom != NULL) {
- fprintf(output, "current atom:\n");
- xmlRegPrintAtom(output, ctxt->atom);
- }
- fprintf(output, "%d states:", ctxt->nbStates);
- if (ctxt->start != NULL)
- fprintf(output, " start: %d", ctxt->start->no);
- if (ctxt->end != NULL)
- fprintf(output, " end: %d", ctxt->end->no);
- fprintf(output, "\n");
- for (i = 0;i < ctxt->nbStates; i++) {
- xmlRegPrintState(output, ctxt->states[i]);
- }
- fprintf(output, "%d counters:\n", ctxt->nbCounters);
- for (i = 0;i < ctxt->nbCounters; i++) {
- fprintf(output, " %d: min %d max %d\n", i, ctxt->counters[i].min,
- ctxt->counters[i].max);
- }
-}
-#endif
-
-/************************************************************************
- * *
- * Finite Automata structures manipulations *
- * *
- ************************************************************************/
-
-static void
-xmlRegAtomAddRange(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom,
- int neg, xmlRegAtomType type, int start, int end,
- xmlChar *blockName) {
- xmlRegRangePtr range;
-
- if (atom == NULL) {
- ERROR("add range: atom is NULL");
- return;
- }
- if (atom->type != XML_REGEXP_RANGES) {
- ERROR("add range: atom is not ranges");
- return;
- }
- if (atom->maxRanges == 0) {
- atom->maxRanges = 4;
- atom->ranges = (xmlRegRangePtr *) xmlMalloc(atom->maxRanges *
- sizeof(xmlRegRangePtr));
- if (atom->ranges == NULL) {
- ERROR("add range: allocation failed");
- atom->maxRanges = 0;
- return;
- }
- } else if (atom->nbRanges >= atom->maxRanges) {
- xmlRegRangePtr *tmp;
- atom->maxRanges *= 2;
- tmp = (xmlRegRangePtr *) xmlRealloc(atom->ranges, atom->maxRanges *
- sizeof(xmlRegRangePtr));
- if (tmp == NULL) {
- ERROR("add range: allocation failed");
- atom->maxRanges /= 2;
- return;
- }
- atom->ranges = tmp;
- }
- range = xmlRegNewRange(ctxt, neg, type, start, end);
- if (range == NULL)
- return;
- range->blockName = blockName;
- atom->ranges[atom->nbRanges++] = range;
-
-}
-
-static int
-xmlRegGetCounter(xmlRegParserCtxtPtr ctxt) {
- if (ctxt->maxCounters == 0) {
- ctxt->maxCounters = 4;
- ctxt->counters = (xmlRegCounter *) xmlMalloc(ctxt->maxCounters *
- sizeof(xmlRegCounter));
- if (ctxt->counters == NULL) {
- ERROR("reg counter: allocation failed");
- ctxt->maxCounters = 0;
- return(-1);
- }
- } else if (ctxt->nbCounters >= ctxt->maxCounters) {
- xmlRegCounter *tmp;
- ctxt->maxCounters *= 2;
- tmp = (xmlRegCounter *) xmlRealloc(ctxt->counters, ctxt->maxCounters *
- sizeof(xmlRegCounter));
- if (tmp == NULL) {
- ERROR("reg counter: allocation failed");
- ctxt->maxCounters /= 2;
- return(-1);
- }
- ctxt->counters = tmp;
- }
- ctxt->counters[ctxt->nbCounters].min = -1;
- ctxt->counters[ctxt->nbCounters].max = -1;
- return(ctxt->nbCounters++);
-}
-
-static void
-xmlRegAtomPush(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom) {
- if (atom == NULL) {
- ERROR("atom push: atom is NULL");
- return;
- }
- if (ctxt->maxAtoms == 0) {
- ctxt->maxAtoms = 4;
- ctxt->atoms = (xmlRegAtomPtr *) xmlMalloc(ctxt->maxAtoms *
- sizeof(xmlRegAtomPtr));
- if (ctxt->atoms == NULL) {
- ERROR("atom push: allocation failed");
- ctxt->maxAtoms = 0;
- return;
- }
- } else if (ctxt->nbAtoms >= ctxt->maxAtoms) {
- xmlRegAtomPtr *tmp;
- ctxt->maxAtoms *= 2;
- tmp = (xmlRegAtomPtr *) xmlRealloc(ctxt->atoms, ctxt->maxAtoms *
- sizeof(xmlRegAtomPtr));
- if (tmp == NULL) {
- ERROR("atom push: allocation failed");
- ctxt->maxAtoms /= 2;
- return;
- }
- ctxt->atoms = tmp;
- }
- atom->no = ctxt->nbAtoms;
- ctxt->atoms[ctxt->nbAtoms++] = atom;
-}
-
-static void
-xmlRegStateAddTrans(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state,
- xmlRegAtomPtr atom, xmlRegStatePtr target,
- int counter, int count) {
- if (state == NULL) {
- ERROR("add state: state is NULL");
- return;
- }
- if (target == NULL) {
- ERROR("add state: target is NULL");
- return;
- }
- if (state->maxTrans == 0) {
- state->maxTrans = 4;
- state->trans = (xmlRegTrans *) xmlMalloc(state->maxTrans *
- sizeof(xmlRegTrans));
- if (state->trans == NULL) {
- ERROR("add range: allocation failed");
- state->maxTrans = 0;
- return;
- }
- } else if (state->nbTrans >= state->maxTrans) {
- xmlRegTrans *tmp;
- state->maxTrans *= 2;
- tmp = (xmlRegTrans *) xmlRealloc(state->trans, state->maxTrans *
- sizeof(xmlRegTrans));
- if (tmp == NULL) {
- ERROR("add range: allocation failed");
- state->maxTrans /= 2;
- return;
- }
- state->trans = tmp;
- }
-#ifdef DEBUG_REGEXP_GRAPH
- printf("Add trans from %d to %d ", state->no, target->no);
- if (count == REGEXP_ALL_COUNTER)
- printf("all transition");
- else if (count >= 0)
- printf("count based %d", count);
- else if (counter >= 0)
- printf("counted %d", counter);
- else if (atom == NULL)
- printf("epsilon transition");
- printf("\n");
-#endif
-
- state->trans[state->nbTrans].atom = atom;
- state->trans[state->nbTrans].to = target->no;
- state->trans[state->nbTrans].counter = counter;
- state->trans[state->nbTrans].count = count;
- state->nbTrans++;
-}
-
-static void
-xmlRegStatePush(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state) {
- if (ctxt->maxStates == 0) {
- ctxt->maxStates = 4;
- ctxt->states = (xmlRegStatePtr *) xmlMalloc(ctxt->maxStates *
- sizeof(xmlRegStatePtr));
- if (ctxt->states == NULL) {
- ERROR("add range: allocation failed");
- ctxt->maxStates = 0;
- return;
- }
- } else if (ctxt->nbStates >= ctxt->maxStates) {
- xmlRegStatePtr *tmp;
- ctxt->maxStates *= 2;
- tmp = (xmlRegStatePtr *) xmlRealloc(ctxt->states, ctxt->maxStates *
- sizeof(xmlRegStatePtr));
- if (tmp == NULL) {
- ERROR("add range: allocation failed");
- ctxt->maxStates /= 2;
- return;
- }
- ctxt->states = tmp;
- }
- state->no = ctxt->nbStates;
- ctxt->states[ctxt->nbStates++] = state;
-}
-
-/**
- * xmlFAGenerateAllTransition:
- * @ctxt: a regexp parser context
- * @from: the from state
- * @to: the target state or NULL for building a new one
- * @lax:
- *
- */
-static void
-xmlFAGenerateAllTransition(xmlRegParserCtxtPtr ctxt,
- xmlRegStatePtr from, xmlRegStatePtr to,
- int lax) {
- if (to == NULL) {
- to = xmlRegNewState(ctxt);
- xmlRegStatePush(ctxt, to);
- ctxt->state = to;
- }
- if (lax)
- xmlRegStateAddTrans(ctxt, from, NULL, to, -1, REGEXP_ALL_LAX_COUNTER);
- else
- xmlRegStateAddTrans(ctxt, from, NULL, to, -1, REGEXP_ALL_COUNTER);
-}
-
-/**
- * xmlFAGenerateEpsilonTransition:
- * @ctxt: a regexp parser context
- * @from: the from state
- * @to: the target state or NULL for building a new one
- *
- */
-static void
-xmlFAGenerateEpsilonTransition(xmlRegParserCtxtPtr ctxt,
- xmlRegStatePtr from, xmlRegStatePtr to) {
- if (to == NULL) {
- to = xmlRegNewState(ctxt);
- xmlRegStatePush(ctxt, to);
- ctxt->state = to;
- }
- xmlRegStateAddTrans(ctxt, from, NULL, to, -1, -1);
-}
-
-/**
- * xmlFAGenerateCountedEpsilonTransition:
- * @ctxt: a regexp parser context
- * @from: the from state
- * @to: the target state or NULL for building a new one
- * counter: the counter for that transition
- *
- */
-static void
-xmlFAGenerateCountedEpsilonTransition(xmlRegParserCtxtPtr ctxt,
- xmlRegStatePtr from, xmlRegStatePtr to, int counter) {
- if (to == NULL) {
- to = xmlRegNewState(ctxt);
- xmlRegStatePush(ctxt, to);
- ctxt->state = to;
- }
- xmlRegStateAddTrans(ctxt, from, NULL, to, counter, -1);
-}
-
-/**
- * xmlFAGenerateCountedTransition:
- * @ctxt: a regexp parser context
- * @from: the from state
- * @to: the target state or NULL for building a new one
- * counter: the counter for that transition
- *
- */
-static void
-xmlFAGenerateCountedTransition(xmlRegParserCtxtPtr ctxt,
- xmlRegStatePtr from, xmlRegStatePtr to, int counter) {
- if (to == NULL) {
- to = xmlRegNewState(ctxt);
- xmlRegStatePush(ctxt, to);
- ctxt->state = to;
- }
- xmlRegStateAddTrans(ctxt, from, NULL, to, -1, counter);
-}
-
-/**
- * xmlFAGenerateTransitions:
- * @ctxt: a regexp parser context
- * @from: the from state
- * @to: the target state or NULL for building a new one
- * @atom: the atom generating the transition
- *
- */
-static void
-xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
- xmlRegStatePtr to, xmlRegAtomPtr atom) {
- if (atom == NULL) {
- ERROR("genrate transition: atom == NULL");
- return;
- }
- if (atom->type == XML_REGEXP_SUBREG) {
- /*
- * this is a subexpression handling one should not need to
- * create a new node excep for XML_REGEXP_QUANT_RANGE.
- */
- xmlRegAtomPush(ctxt, atom);
- if ((to != NULL) && (atom->stop != to) &&
- (atom->quant != XML_REGEXP_QUANT_RANGE)) {
- /*
- * Generate an epsilon transition to link to the target
- */
- xmlFAGenerateEpsilonTransition(ctxt, atom->stop, to);
- }
- switch (atom->quant) {
- case XML_REGEXP_QUANT_OPT:
- atom->quant = XML_REGEXP_QUANT_ONCE;
- xmlFAGenerateEpsilonTransition(ctxt, atom->start, atom->stop);
- break;
- case XML_REGEXP_QUANT_MULT:
- atom->quant = XML_REGEXP_QUANT_ONCE;
- xmlFAGenerateEpsilonTransition(ctxt, atom->start, atom->stop);
- xmlFAGenerateEpsilonTransition(ctxt, atom->stop, atom->start);
- break;
- case XML_REGEXP_QUANT_PLUS:
- atom->quant = XML_REGEXP_QUANT_ONCE;
- xmlFAGenerateEpsilonTransition(ctxt, atom->stop, atom->start);
- break;
- case XML_REGEXP_QUANT_RANGE: {
- int counter;
- xmlRegStatePtr newstate;
-
- /*
- * This one is nasty:
- * 1/ register a new counter
- * 2/ register an epsilon transition associated to
- * this counter going from atom->stop to atom->start
- * 3/ create a new state
- * 4/ generate a counted transition from atom->stop to
- * that state
- */
- counter = xmlRegGetCounter(ctxt);
- ctxt->counters[counter].min = atom->min - 1;
- ctxt->counters[counter].max = atom->max - 1;
- atom->min = 0;
- atom->max = 0;
- atom->quant = XML_REGEXP_QUANT_ONCE;
- xmlFAGenerateCountedEpsilonTransition(ctxt, atom->stop,
- atom->start, counter);
- if (to != NULL) {
- newstate = to;
- } else {
- newstate = xmlRegNewState(ctxt);
- xmlRegStatePush(ctxt, newstate);
- ctxt->state = newstate;
- }
- xmlFAGenerateCountedTransition(ctxt, atom->stop,
- newstate, counter);
- }
- default:
- break;
- }
- return;
- } else {
- if (to == NULL) {
- to = xmlRegNewState(ctxt);
- xmlRegStatePush(ctxt, to);
- }
- xmlRegStateAddTrans(ctxt, from, atom, to, -1, -1);
- xmlRegAtomPush(ctxt, atom);
- ctxt->state = to;
- }
- switch (atom->quant) {
- case XML_REGEXP_QUANT_OPT:
- atom->quant = XML_REGEXP_QUANT_ONCE;
- xmlFAGenerateEpsilonTransition(ctxt, from, to);
- break;
- case XML_REGEXP_QUANT_MULT:
- atom->quant = XML_REGEXP_QUANT_ONCE;
- xmlFAGenerateEpsilonTransition(ctxt, from, to);
- xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1);
- break;
- case XML_REGEXP_QUANT_PLUS:
- atom->quant = XML_REGEXP_QUANT_ONCE;
- xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1);
- break;
- default:
- break;
- }
-}
-
-/**
- * xmlFAReduceEpsilonTransitions:
- * @ctxt: a regexp parser context
- * @fromnr: the from state
- * @tonr: the to state
- * @cpunter: should that transition be associted to a counted
- *
- */
-static void
-xmlFAReduceEpsilonTransitions(xmlRegParserCtxtPtr ctxt, int fromnr,
- int tonr, int counter) {
- int transnr;
- xmlRegStatePtr from;
- xmlRegStatePtr to;
-
-#ifdef DEBUG_REGEXP_GRAPH
- printf("xmlFAReduceEpsilonTransitions(%d, %d)\n", fromnr, tonr);
-#endif
- from = ctxt->states[fromnr];
- if (from == NULL)
- return;
- to = ctxt->states[tonr];
- if (to == NULL)
- return;
- if ((to->mark == XML_REGEXP_MARK_START) ||
- (to->mark == XML_REGEXP_MARK_VISITED))
- return;
-
- to->mark = XML_REGEXP_MARK_VISITED;
- if (to->type == XML_REGEXP_FINAL_STATE) {
-#ifdef DEBUG_REGEXP_GRAPH
- printf("State %d is final, so %d becomes final\n", tonr, fromnr);
-#endif
- from->type = XML_REGEXP_FINAL_STATE;
- }
- for (transnr = 0;transnr < to->nbTrans;transnr++) {
- if (to->trans[transnr].atom == NULL) {
- /*
- * Don't remove counted transitions
- * Don't loop either
- */
- if (to->trans[transnr].to != fromnr) {
- if (to->trans[transnr].count >= 0) {
- int newto = to->trans[transnr].to;
-
- xmlRegStateAddTrans(ctxt, from, NULL,
- ctxt->states[newto],
- -1, to->trans[transnr].count);
- } else {
-#ifdef DEBUG_REGEXP_GRAPH
- printf("Found epsilon trans %d from %d to %d\n",
- transnr, tonr, to->trans[transnr].to);
-#endif
- if (to->trans[transnr].counter >= 0) {
- xmlFAReduceEpsilonTransitions(ctxt, fromnr,
- to->trans[transnr].to,
- to->trans[transnr].counter);
- } else {
- xmlFAReduceEpsilonTransitions(ctxt, fromnr,
- to->trans[transnr].to,
- counter);
- }
- }
- }
- } else {
- int newto = to->trans[transnr].to;
-
- if (to->trans[transnr].counter >= 0) {
- xmlRegStateAddTrans(ctxt, from, to->trans[transnr].atom,
- ctxt->states[newto],
- to->trans[transnr].counter, -1);
- } else {
- xmlRegStateAddTrans(ctxt, from, to->trans[transnr].atom,
- ctxt->states[newto], counter, -1);
- }
- }
- }
- to->mark = XML_REGEXP_MARK_NORMAL;
-}
-
-/**
- * xmlFAEliminateEpsilonTransitions:
- * @ctxt: a regexp parser context
- *
- */
-static void
-xmlFAEliminateEpsilonTransitions(xmlRegParserCtxtPtr ctxt) {
- int statenr, transnr;
- xmlRegStatePtr state;
-
- /*
- * build the completed transitions bypassing the epsilons
- * Use a marking algorithm to avoid loops
- */
- for (statenr = 0;statenr < ctxt->nbStates;statenr++) {
- state = ctxt->states[statenr];
- if (state == NULL)
- continue;
- for (transnr = 0;transnr < state->nbTrans;transnr++) {
- if ((state->trans[transnr].atom == NULL) &&
- (state->trans[transnr].to >= 0)) {
- if (state->trans[transnr].to == statenr) {
- state->trans[transnr].to = -1;
-#ifdef DEBUG_REGEXP_GRAPH
- printf("Removed loopback epsilon trans %d on %d\n",
- transnr, statenr);
-#endif
- } else if (state->trans[transnr].count < 0) {
- int newto = state->trans[transnr].to;
-
-#ifdef DEBUG_REGEXP_GRAPH
- printf("Found epsilon trans %d from %d to %d\n",
- transnr, statenr, newto);
-#endif
- state->mark = XML_REGEXP_MARK_START;
- xmlFAReduceEpsilonTransitions(ctxt, statenr,
- newto, state->trans[transnr].counter);
- state->mark = XML_REGEXP_MARK_NORMAL;
-#ifdef DEBUG_REGEXP_GRAPH
- } else {
- printf("Found counted transition %d on %d\n",
- transnr, statenr);
-#endif
- }
- }
- }
- }
- /*
- * Eliminate the epsilon transitions
- */
- for (statenr = 0;statenr < ctxt->nbStates;statenr++) {
- state = ctxt->states[statenr];
- if (state == NULL)
- continue;
- for (transnr = 0;transnr < state->nbTrans;transnr++) {
- if ((state->trans[transnr].atom == NULL) &&
- (state->trans[transnr].count < 0) &&
- (state->trans[transnr].to >= 0)) {
- state->trans[transnr].to = -1;
- }
- }
- }
-
- /*
- * Use this pass to detect unreachable states too
- */
- for (statenr = 0;statenr < ctxt->nbStates;statenr++) {
- state = ctxt->states[statenr];
- if (state != NULL)
- state->reached = 0;
- }
- state = ctxt->states[0];
- if (state != NULL)
- state->reached = 1;
- while (state != NULL) {
- xmlRegStatePtr target = NULL;
- state->reached = 2;
- /*
- * Mark all state reachable from the current reachable state
- */
- for (transnr = 0;transnr < state->nbTrans;transnr++) {
- if ((state->trans[transnr].to >= 0) &&
- ((state->trans[transnr].atom != NULL) ||
- (state->trans[transnr].count >= 0))) {
- int newto = state->trans[transnr].to;
-
- if (ctxt->states[newto] == NULL)
- continue;
- if (ctxt->states[newto]->reached == 0) {
- ctxt->states[newto]->reached = 1;
- target = ctxt->states[newto];
- }
- }
- }
- /*
- * find the next accessible state not explored
- */
- if (target == NULL) {
- for (statenr = 1;statenr < ctxt->nbStates;statenr++) {
- state = ctxt->states[statenr];
- if ((state != NULL) && (state->reached == 1)) {
- target = state;
- break;
- }
- }
- }
- state = target;
- }
- for (statenr = 0;statenr < ctxt->nbStates;statenr++) {
- state = ctxt->states[statenr];
- if ((state != NULL) && (state->reached == 0)) {
-#ifdef DEBUG_REGEXP_GRAPH
- printf("Removed unreachable state %d\n", statenr);
-#endif
- xmlRegFreeState(state);
- ctxt->states[statenr] = NULL;
- }
- }
-
-}
-
-/**
- * xmlFACompareAtoms:
- * @atom1: an atom
- * @atom2: an atom
- *
- * Compares two atoms to check whether they are equivatents
- *
- * Returns 1 if yes and 0 otherwise
- */
-static int
-xmlFACompareAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) {
- if (atom1 == atom2)
- return(1);
- if ((atom1 == NULL) || (atom2 == NULL))
- return(0);
-
- if (atom1->type != atom2->type)
- return(0);
- switch (atom1->type) {
- case XML_REGEXP_STRING:
- return(xmlStrEqual((xmlChar *)atom1->valuep,
- (xmlChar *)atom2->valuep));
- case XML_REGEXP_EPSILON:
- return(1);
- case XML_REGEXP_CHARVAL:
- return(atom1->codepoint == atom2->codepoint);
- case XML_REGEXP_RANGES:
- TODO;
- return(0);
- default:
- break;
- }
- return(1);
-}
-
-/**
- * xmlFARecurseDeterminism:
- * @ctxt: a regexp parser context
- *
- * Check whether the associated regexp is determinist,
- * should be called after xmlFAEliminateEpsilonTransitions()
- *
- */
-static int
-xmlFARecurseDeterminism(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state,
- int to, xmlRegAtomPtr atom) {
- int ret = 1;
- int transnr;
- xmlRegTransPtr t1;
-
- if (state == NULL)
- return(ret);
- for (transnr = 0;transnr < state->nbTrans;transnr++) {
- t1 = &(state->trans[transnr]);
- /*
- * check transitions conflicting with the one looked at
- */
- if (t1->atom == NULL) {
- if (t1->to == -1)
- continue;
- ret = xmlFARecurseDeterminism(ctxt, ctxt->states[t1->to],
- to, atom);
- if (ret == 0)
- return(0);
- continue;
- }
- if (t1->to != to)
- continue;
- if (xmlFACompareAtoms(t1->atom, atom))
- return(0);
- }
- return(ret);
-}
-
-/**
- * xmlFAComputesDeterminism:
- * @ctxt: a regexp parser context
- *
- * Check whether the associated regexp is determinist,
- * should be called after xmlFAEliminateEpsilonTransitions()
- *
- */
-static int
-xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) {
- int statenr, transnr;
- xmlRegStatePtr state;
- xmlRegTransPtr t1, t2;
- int i;
- int ret = 1;
-
-#ifdef DEBUG_REGEXP_GRAPH
- printf("xmlFAComputesDeterminism\n");
- xmlRegPrintCtxt(stdout, ctxt);
-#endif
- if (ctxt->determinist != -1)
- return(ctxt->determinist);
-
- /*
- * Check for all states that there isn't 2 transitions
- * with the same atom and a different target.
- */
- for (statenr = 0;statenr < ctxt->nbStates;statenr++) {
- state = ctxt->states[statenr];
- if (state == NULL)
- continue;
- for (transnr = 0;transnr < state->nbTrans;transnr++) {
- t1 = &(state->trans[transnr]);
- /*
- * Determinism checks in case of counted or all transitions
- * will have to be handled separately
- */
- if (t1->atom == NULL)
- continue;
- if (t1->to == -1) /* eliminated */
- continue;
- for (i = 0;i < transnr;i++) {
- t2 = &(state->trans[i]);
- if (t2->to == -1) /* eliminated */
- continue;
- if (t2->atom != NULL) {
- if (t1->to == t2->to) {
- if (xmlFACompareAtoms(t1->atom, t2->atom))
- t2->to = -1; /* eliminate */
- } else {
- /* not determinist ! */
- if (xmlFACompareAtoms(t1->atom, t2->atom))
- ret = 0;
- }
- } else if (t1->to != -1) {
- /*
- * do the closure in case of remaining specific
- * epsilon transitions like choices or all
- */
- ret = xmlFARecurseDeterminism(ctxt, ctxt->states[t1->to],
- t2->to, t2->atom);
- if (ret == 0)
- return(0);
- }
- }
- if (ret == 0)
- break;
- }
- if (ret == 0)
- break;
- }
- ctxt->determinist = ret;
- return(ret);
-}
-
-/************************************************************************
- * *
- * Routines to check input against transition atoms *
- * *
- ************************************************************************/
-
-static int
-xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint, int neg,
- int start, int end, const xmlChar *blockName) {
- int ret = 0;
-
- switch (type) {
- case XML_REGEXP_STRING:
- case XML_REGEXP_SUBREG:
- case XML_REGEXP_RANGES:
- case XML_REGEXP_EPSILON:
- return(-1);
- case XML_REGEXP_ANYCHAR:
- ret = ((codepoint != '\n') && (codepoint != '\r'));
- break;
- case XML_REGEXP_CHARVAL:
- ret = ((codepoint >= start) && (codepoint <= end));
- break;
- case XML_REGEXP_NOTSPACE:
- neg = !neg;
- case XML_REGEXP_ANYSPACE:
- ret = ((codepoint == '\n') || (codepoint == '\r') ||
- (codepoint == '\t') || (codepoint == ' '));
- break;
- case XML_REGEXP_NOTINITNAME:
- neg = !neg;
- case XML_REGEXP_INITNAME:
- ret = (xmlIsLetter(codepoint) ||
- (codepoint == '_') || (codepoint == ':'));
- break;
- case XML_REGEXP_NOTNAMECHAR:
- neg = !neg;
- case XML_REGEXP_NAMECHAR:
- ret = (xmlIsLetter(codepoint) || xmlIsDigit(codepoint) ||
- (codepoint == '.') || (codepoint == '-') ||
- (codepoint == '_') || (codepoint == ':') ||
- xmlIsCombining(codepoint) || xmlIsExtender(codepoint));
- break;
- case XML_REGEXP_NOTDECIMAL:
- neg = !neg;
- case XML_REGEXP_DECIMAL:
- ret = xmlUCSIsCatNd(codepoint);
- break;
- case XML_REGEXP_REALCHAR:
- neg = !neg;
- case XML_REGEXP_NOTREALCHAR:
- ret = xmlUCSIsCatP(codepoint);
- if (ret == 0)
- ret = xmlUCSIsCatZ(codepoint);
- if (ret == 0)
- ret = xmlUCSIsCatC(codepoint);
- break;
- case XML_REGEXP_LETTER:
- ret = xmlUCSIsCatL(codepoint);
- break;
- case XML_REGEXP_LETTER_UPPERCASE:
- ret = xmlUCSIsCatLu(codepoint);
- break;
- case XML_REGEXP_LETTER_LOWERCASE:
- ret = xmlUCSIsCatLl(codepoint);
- break;
- case XML_REGEXP_LETTER_TITLECASE:
- ret = xmlUCSIsCatLt(codepoint);
- break;
- case XML_REGEXP_LETTER_MODIFIER:
- ret = xmlUCSIsCatLm(codepoint);
- break;
- case XML_REGEXP_LETTER_OTHERS:
- ret = xmlUCSIsCatLo(codepoint);
- break;
- case XML_REGEXP_MARK:
- ret = xmlUCSIsCatM(codepoint);
- break;
- case XML_REGEXP_MARK_NONSPACING:
- ret = xmlUCSIsCatMn(codepoint);
- break;
- case XML_REGEXP_MARK_SPACECOMBINING:
- ret = xmlUCSIsCatMc(codepoint);
- break;
- case XML_REGEXP_MARK_ENCLOSING:
- ret = xmlUCSIsCatMe(codepoint);
- break;
- case XML_REGEXP_NUMBER:
- ret = xmlUCSIsCatN(codepoint);
- break;
- case XML_REGEXP_NUMBER_DECIMAL:
- ret = xmlUCSIsCatNd(codepoint);
- break;
- case XML_REGEXP_NUMBER_LETTER:
- ret = xmlUCSIsCatNl(codepoint);
- break;
- case XML_REGEXP_NUMBER_OTHERS:
- ret = xmlUCSIsCatNo(codepoint);
- break;
- case XML_REGEXP_PUNCT:
- ret = xmlUCSIsCatP(codepoint);
- break;
- case XML_REGEXP_PUNCT_CONNECTOR:
- ret = xmlUCSIsCatPc(codepoint);
- break;
- case XML_REGEXP_PUNCT_DASH:
- ret = xmlUCSIsCatPd(codepoint);
- break;
- case XML_REGEXP_PUNCT_OPEN:
- ret = xmlUCSIsCatPs(codepoint);
- break;
- case XML_REGEXP_PUNCT_CLOSE:
- ret = xmlUCSIsCatPe(codepoint);
- break;
- case XML_REGEXP_PUNCT_INITQUOTE:
- ret = xmlUCSIsCatPi(codepoint);
- break;
- case XML_REGEXP_PUNCT_FINQUOTE:
- ret = xmlUCSIsCatPf(codepoint);
- break;
- case XML_REGEXP_PUNCT_OTHERS:
- ret = xmlUCSIsCatPo(codepoint);
- break;
- case XML_REGEXP_SEPAR:
- ret = xmlUCSIsCatZ(codepoint);
- break;
- case XML_REGEXP_SEPAR_SPACE:
- ret = xmlUCSIsCatZs(codepoint);
- break;
- case XML_REGEXP_SEPAR_LINE:
- ret = xmlUCSIsCatZl(codepoint);
- break;
- case XML_REGEXP_SEPAR_PARA:
- ret = xmlUCSIsCatZp(codepoint);
- break;
- case XML_REGEXP_SYMBOL:
- ret = xmlUCSIsCatS(codepoint);
- break;
- case XML_REGEXP_SYMBOL_MATH:
- ret = xmlUCSIsCatSm(codepoint);
- break;
- case XML_REGEXP_SYMBOL_CURRENCY:
- ret = xmlUCSIsCatSc(codepoint);
- break;
- case XML_REGEXP_SYMBOL_MODIFIER:
- ret = xmlUCSIsCatSk(codepoint);
- break;
- case XML_REGEXP_SYMBOL_OTHERS:
- ret = xmlUCSIsCatSo(codepoint);
- break;
- case XML_REGEXP_OTHER:
- ret = xmlUCSIsCatC(codepoint);
- break;
- case XML_REGEXP_OTHER_CONTROL:
- ret = xmlUCSIsCatCc(codepoint);
- break;
- case XML_REGEXP_OTHER_FORMAT:
- ret = xmlUCSIsCatCf(codepoint);
- break;
- case XML_REGEXP_OTHER_PRIVATE:
- ret = xmlUCSIsCatCo(codepoint);
- break;
- case XML_REGEXP_OTHER_NA:
- /* ret = xmlUCSIsCatCn(codepoint); */
- /* Seems it doesn't exist anymore in recent Unicode releases */
- ret = 0;
- break;
- case XML_REGEXP_BLOCK_NAME:
- ret = xmlUCSIsBlock(codepoint, (const char *) blockName);
- break;
- }
- if (neg)
- return(!ret);
- return(ret);
-}
-
-static int
-xmlRegCheckCharacter(xmlRegAtomPtr atom, int codepoint) {
- int i, ret = 0;
- xmlRegRangePtr range;
-
- if ((atom == NULL) || (!xmlIsChar(codepoint)))
- return(-1);
-
- switch (atom->type) {
- case XML_REGEXP_SUBREG:
- case XML_REGEXP_EPSILON:
- return(-1);
- case XML_REGEXP_CHARVAL:
- return(codepoint == atom->codepoint);
- case XML_REGEXP_RANGES: {
- int accept = 0;
- for (i = 0;i < atom->nbRanges;i++) {
- range = atom->ranges[i];
- if (range->neg) {
- ret = xmlRegCheckCharacterRange(range->type, codepoint,
- 0, range->start, range->end,
- range->blockName);
- if (ret != 0)
- return(0); /* excluded char */
- } else {
- ret = xmlRegCheckCharacterRange(range->type, codepoint,
- 0, range->start, range->end,
- range->blockName);
- if (ret != 0)
- accept = 1; /* might still be excluded */
- }
- }
- return(accept);
- }
- case XML_REGEXP_STRING:
- printf("TODO: XML_REGEXP_STRING\n");
- return(-1);
- case XML_REGEXP_ANYCHAR:
- case XML_REGEXP_ANYSPACE:
- case XML_REGEXP_NOTSPACE:
- case XML_REGEXP_INITNAME:
- case XML_REGEXP_NOTINITNAME:
- case XML_REGEXP_NAMECHAR:
- case XML_REGEXP_NOTNAMECHAR:
- case XML_REGEXP_DECIMAL:
- case XML_REGEXP_NOTDECIMAL:
- case XML_REGEXP_REALCHAR:
- case XML_REGEXP_NOTREALCHAR:
- case XML_REGEXP_LETTER:
- case XML_REGEXP_LETTER_UPPERCASE:
- case XML_REGEXP_LETTER_LOWERCASE:
- case XML_REGEXP_LETTER_TITLECASE:
- case XML_REGEXP_LETTER_MODIFIER:
- case XML_REGEXP_LETTER_OTHERS:
- case XML_REGEXP_MARK:
- case XML_REGEXP_MARK_NONSPACING:
- case XML_REGEXP_MARK_SPACECOMBINING:
- case XML_REGEXP_MARK_ENCLOSING:
- case XML_REGEXP_NUMBER:
- case XML_REGEXP_NUMBER_DECIMAL:
- case XML_REGEXP_NUMBER_LETTER:
- case XML_REGEXP_NUMBER_OTHERS:
- case XML_REGEXP_PUNCT:
- case XML_REGEXP_PUNCT_CONNECTOR:
- case XML_REGEXP_PUNCT_DASH:
- case XML_REGEXP_PUNCT_OPEN:
- case XML_REGEXP_PUNCT_CLOSE:
- case XML_REGEXP_PUNCT_INITQUOTE:
- case XML_REGEXP_PUNCT_FINQUOTE:
- case XML_REGEXP_PUNCT_OTHERS:
- case XML_REGEXP_SEPAR:
- case XML_REGEXP_SEPAR_SPACE:
- case XML_REGEXP_SEPAR_LINE:
- case XML_REGEXP_SEPAR_PARA:
- case XML_REGEXP_SYMBOL:
- case XML_REGEXP_SYMBOL_MATH:
- case XML_REGEXP_SYMBOL_CURRENCY:
- case XML_REGEXP_SYMBOL_MODIFIER:
- case XML_REGEXP_SYMBOL_OTHERS:
- case XML_REGEXP_OTHER:
- case XML_REGEXP_OTHER_CONTROL:
- case XML_REGEXP_OTHER_FORMAT:
- case XML_REGEXP_OTHER_PRIVATE:
- case XML_REGEXP_OTHER_NA:
- case XML_REGEXP_BLOCK_NAME:
- ret = xmlRegCheckCharacterRange(atom->type, codepoint, 0, 0, 0,
- (const xmlChar *)atom->valuep);
- if (atom->neg)
- ret = !ret;
- break;
- }
- return(ret);
-}
-
-/************************************************************************
- * *
- * Saving an restoring state of an execution context *
- * *
- ************************************************************************/
-
-#ifdef DEBUG_REGEXP_EXEC
-static void
-xmlFARegDebugExec(xmlRegExecCtxtPtr exec) {
- printf("state: %d:%d:idx %d", exec->state->no, exec->transno, exec->index);
- if (exec->inputStack != NULL) {
- int i;
- printf(": ");
- for (i = 0;(i < 3) && (i < exec->inputStackNr);i++)
- printf("%s ", exec->inputStack[exec->inputStackNr - (i + 1)]);
- } else {
- printf(": %s", &(exec->inputString[exec->index]));
- }
- printf("\n");
-}
-#endif
-
-static void
-xmlFARegExecSave(xmlRegExecCtxtPtr exec) {
-#ifdef DEBUG_REGEXP_EXEC
- printf("saving ");
- exec->transno++;
- xmlFARegDebugExec(exec);
- exec->transno--;
-#endif
-
- if (exec->maxRollbacks == 0) {
- exec->maxRollbacks = 4;
- exec->rollbacks = (xmlRegExecRollback *) xmlMalloc(exec->maxRollbacks *
- sizeof(xmlRegExecRollback));
- if (exec->rollbacks == NULL) {
- fprintf(stderr, "exec save: allocation failed");
- exec->maxRollbacks = 0;
- return;
- }
- memset(exec->rollbacks, 0,
- exec->maxRollbacks * sizeof(xmlRegExecRollback));
- } else if (exec->nbRollbacks >= exec->maxRollbacks) {
- xmlRegExecRollback *tmp;
- int len = exec->maxRollbacks;
-
- exec->maxRollbacks *= 2;
- tmp = (xmlRegExecRollback *) xmlRealloc(exec->rollbacks,
- exec->maxRollbacks * sizeof(xmlRegExecRollback));
- if (tmp == NULL) {
- fprintf(stderr, "exec save: allocation failed");
- exec->maxRollbacks /= 2;
- return;
- }
- exec->rollbacks = tmp;
- tmp = &exec->rollbacks[len];
- memset(tmp, 0, (exec->maxRollbacks - len) * sizeof(xmlRegExecRollback));
- }
- exec->rollbacks[exec->nbRollbacks].state = exec->state;
- exec->rollbacks[exec->nbRollbacks].index = exec->index;
- exec->rollbacks[exec->nbRollbacks].nextbranch = exec->transno + 1;
- if (exec->comp->nbCounters > 0) {
- if (exec->rollbacks[exec->nbRollbacks].counts == NULL) {
- exec->rollbacks[exec->nbRollbacks].counts = (int *)
- xmlMalloc(exec->comp->nbCounters * sizeof(int));
- if (exec->rollbacks[exec->nbRollbacks].counts == NULL) {
- fprintf(stderr, "exec save: allocation failed");
- exec->status = -5;
- return;
- }
- }
- memcpy(exec->rollbacks[exec->nbRollbacks].counts, exec->counts,
- exec->comp->nbCounters * sizeof(int));
- }
- exec->nbRollbacks++;
-}
-
-static void
-xmlFARegExecRollBack(xmlRegExecCtxtPtr exec) {
- if (exec->nbRollbacks <= 0) {
- exec->status = -1;
-#ifdef DEBUG_REGEXP_EXEC
- printf("rollback failed on empty stack\n");
-#endif
- return;
- }
- exec->nbRollbacks--;
- exec->state = exec->rollbacks[exec->nbRollbacks].state;
- exec->index = exec->rollbacks[exec->nbRollbacks].index;
- exec->transno = exec->rollbacks[exec->nbRollbacks].nextbranch;
- if (exec->comp->nbCounters > 0) {
- if (exec->rollbacks[exec->nbRollbacks].counts == NULL) {
- fprintf(stderr, "exec save: allocation failed");
- exec->status = -6;
- return;
- }
- memcpy(exec->counts, exec->rollbacks[exec->nbRollbacks].counts,
- exec->comp->nbCounters * sizeof(int));
- }
-
-#ifdef DEBUG_REGEXP_EXEC
- printf("restored ");
- xmlFARegDebugExec(exec);
-#endif
-}
-
-/************************************************************************
- * *
- * Verifyer, running an input against a compiled regexp *
- * *
- ************************************************************************/
-
-static int
-xmlFARegExec(xmlRegexpPtr comp, const xmlChar *content) {
- xmlRegExecCtxt execval;
- xmlRegExecCtxtPtr exec = &execval;
- int ret, codepoint, len;
-
- exec->inputString = content;
- exec->index = 0;
- exec->determinist = 1;
- exec->maxRollbacks = 0;
- exec->nbRollbacks = 0;
- exec->rollbacks = NULL;
- exec->status = 0;
- exec->comp = comp;
- exec->state = comp->states[0];
- exec->transno = 0;
- exec->transcount = 0;
- if (comp->nbCounters > 0) {
- exec->counts = (int *) xmlMalloc(comp->nbCounters * sizeof(int));
- if (exec->counts == NULL)
- return(-1);
- memset(exec->counts, 0, comp->nbCounters * sizeof(int));
- } else
- exec->counts = NULL;
- while ((exec->status == 0) &&
- ((exec->inputString[exec->index] != 0) ||
- (exec->state->type != XML_REGEXP_FINAL_STATE))) {
- xmlRegTransPtr trans;
- xmlRegAtomPtr atom;
-
- /*
- * End of input on non-terminal state, rollback, however we may
- * still have epsilon like transition for counted transitions
- * on counters, in that case don't break too early.
- */
- if ((exec->inputString[exec->index] == 0) && (exec->counts == NULL))
- goto rollback;
-
- exec->transcount = 0;
- for (;exec->transno < exec->state->nbTrans;exec->transno++) {
- trans = &exec->state->trans[exec->transno];
- if (trans->to < 0)
- continue;
- atom = trans->atom;
- ret = 0;
- if (trans->count >= 0) {
- int count;
- xmlRegCounterPtr counter;
-
- /*
- * A counted transition.
- */
-
- count = exec->counts[trans->count];
- counter = &exec->comp->counters[trans->count];
-#ifdef DEBUG_REGEXP_EXEC
- printf("testing count %d: val %d, min %d, max %d\n",
- trans->count, count, counter->min, counter->max);
-#endif
- ret = ((count >= counter->min) && (count <= counter->max));
- } else if (atom == NULL) {
- fprintf(stderr, "epsilon transition left at runtime\n");
- exec->status = -2;
- break;
- } else if (exec->inputString[exec->index] != 0) {
- codepoint = CUR_SCHAR(&(exec->inputString[exec->index]), len);
- ret = xmlRegCheckCharacter(atom, codepoint);
- if ((ret == 1) && (atom->min > 0) && (atom->max > 0)) {
- xmlRegStatePtr to = comp->states[trans->to];
-
- /*
- * this is a multiple input sequence
- */
- if (exec->state->nbTrans > exec->transno + 1) {
- xmlFARegExecSave(exec);
- }
- exec->transcount = 1;
- do {
- /*
- * Try to progress as much as possible on the input
- */
- if (exec->transcount == atom->max) {
- break;
- }
- exec->index += len;
- /*
- * End of input: stop here
- */
- if (exec->inputString[exec->index] == 0) {
- exec->index -= len;
- break;
- }
- if (exec->transcount >= atom->min) {
- int transno = exec->transno;
- xmlRegStatePtr state = exec->state;
-
- /*
- * The transition is acceptable save it
- */
- exec->transno = -1; /* trick */
- exec->state = to;
- xmlFARegExecSave(exec);
- exec->transno = transno;
- exec->state = state;
- }
- codepoint = CUR_SCHAR(&(exec->inputString[exec->index]),
- len);
- ret = xmlRegCheckCharacter(atom, codepoint);
- exec->transcount++;
- } while (ret == 1);
- if (exec->transcount < atom->min)
- ret = 0;
-
- /*
- * If the last check failed but one transition was found
- * possible, rollback
- */
- if (ret < 0)
- ret = 0;
- if (ret == 0) {
- goto rollback;
- }
- }
- }
- if (ret == 1) {
- if (exec->state->nbTrans > exec->transno + 1) {
- xmlFARegExecSave(exec);
- }
- if (trans->counter >= 0) {
-#ifdef DEBUG_REGEXP_EXEC
- printf("Increasing count %d\n", trans->counter);
-#endif
- exec->counts[trans->counter]++;
- }
-#ifdef DEBUG_REGEXP_EXEC
- printf("entering state %d\n", trans->to);
-#endif
- exec->state = comp->states[trans->to];
- exec->transno = 0;
- if (trans->atom != NULL) {
- exec->index += len;
- }
- goto progress;
- } else if (ret < 0) {
- exec->status = -4;
- break;
- }
- }
- if ((exec->transno != 0) || (exec->state->nbTrans == 0)) {
-rollback:
- /*
- * Failed to find a way out
- */
- exec->determinist = 0;
- xmlFARegExecRollBack(exec);
- }
-progress:
- continue;
- }
- if (exec->rollbacks != NULL) {
- if (exec->counts != NULL) {
- int i;
-
- for (i = 0;i < exec->maxRollbacks;i++)
- if (exec->rollbacks[i].counts != NULL)
- xmlFree(exec->rollbacks[i].counts);
- }
- xmlFree(exec->rollbacks);
- }
- if (exec->counts != NULL)
- xmlFree(exec->counts);
- if (exec->status == 0)
- return(1);
- if (exec->status == -1)
- return(0);
- return(exec->status);
-}
-
-/************************************************************************
- * *
- * Progressive interface to the verifyer one atom at a time *
- * *
- ************************************************************************/
-
-/**
- * xmlRegNewExecCtxt:
- * @comp: a precompiled regular expression
- * @callback: a callback function used for handling progresses in the
- * automata matching phase
- * @data: the context data associated to the callback in this context
- *
- * Build a context used for progressive evaluation of a regexp.
- *
- * Returns the new context
- */
-xmlRegExecCtxtPtr
-xmlRegNewExecCtxt(xmlRegexpPtr comp, xmlRegExecCallbacks callback, void *data) {
- xmlRegExecCtxtPtr exec;
-
- if (comp == NULL)
- return(NULL);
- exec = (xmlRegExecCtxtPtr) xmlMalloc(sizeof(xmlRegExecCtxt));
- if (exec == NULL) {
- return(NULL);
- }
- memset(exec, 0, sizeof(xmlRegExecCtxt));
- exec->inputString = NULL;
- exec->index = 0;
- exec->determinist = 1;
- exec->maxRollbacks = 0;
- exec->nbRollbacks = 0;
- exec->rollbacks = NULL;
- exec->status = 0;
- exec->comp = comp;
- if (comp->compact == NULL)
- exec->state = comp->states[0];
- exec->transno = 0;
- exec->transcount = 0;
- exec->callback = callback;
- exec->data = data;
- if (comp->nbCounters > 0) {
- exec->counts = (int *) xmlMalloc(comp->nbCounters * sizeof(int));
- if (exec->counts == NULL) {
- xmlFree(exec);
- return(NULL);
- }
- memset(exec->counts, 0, comp->nbCounters * sizeof(int));
- } else
- exec->counts = NULL;
- exec->inputStackMax = 0;
- exec->inputStackNr = 0;
- exec->inputStack = NULL;
- return(exec);
-}
-
-/**
- * xmlRegFreeExecCtxt:
- * @exec: a regular expression evaulation context
- *
- * Free the structures associated to a regular expression evaulation context.
- */
-void
-xmlRegFreeExecCtxt(xmlRegExecCtxtPtr exec) {
- if (exec == NULL)
- return;
-
- if (exec->rollbacks != NULL) {
- if (exec->counts != NULL) {
- int i;
-
- for (i = 0;i < exec->maxRollbacks;i++)
- if (exec->rollbacks[i].counts != NULL)
- xmlFree(exec->rollbacks[i].counts);
- }
- xmlFree(exec->rollbacks);
- }
- if (exec->counts != NULL)
- xmlFree(exec->counts);
- if (exec->inputStack != NULL) {
- int i;
-
- for (i = 0;i < exec->inputStackNr;i++) {
- if (exec->inputStack[i].value != NULL)
- xmlFree(exec->inputStack[i].value);
- }
- xmlFree(exec->inputStack);
- }
- xmlFree(exec);
-}
-
-static void
-xmlFARegExecSaveInputString(xmlRegExecCtxtPtr exec, const xmlChar *value,
- void *data) {
-#ifdef DEBUG_PUSH
- printf("saving value: %d:%s\n", exec->inputStackNr, value);
-#endif
- if (exec->inputStackMax == 0) {
- exec->inputStackMax = 4;
- exec->inputStack = (xmlRegInputTokenPtr)
- xmlMalloc(exec->inputStackMax * sizeof(xmlRegInputToken));
- if (exec->inputStack == NULL) {
- fprintf(stderr, "push input: allocation failed");
- exec->inputStackMax = 0;
- return;
- }
- } else if (exec->inputStackNr + 1 >= exec->inputStackMax) {
- xmlRegInputTokenPtr tmp;
-
- exec->inputStackMax *= 2;
- tmp = (xmlRegInputTokenPtr) xmlRealloc(exec->inputStack,
- exec->inputStackMax * sizeof(xmlRegInputToken));
- if (tmp == NULL) {
- fprintf(stderr, "push input: allocation failed");
- exec->inputStackMax /= 2;
- return;
- }
- exec->inputStack = tmp;
- }
- exec->inputStack[exec->inputStackNr].value = xmlStrdup(value);
- exec->inputStack[exec->inputStackNr].data = data;
- exec->inputStackNr++;
- exec->inputStack[exec->inputStackNr].value = NULL;
- exec->inputStack[exec->inputStackNr].data = NULL;
-}
-
-
-/**
- * xmlRegCompactPushString:
- * @exec: a regexp execution context
- * @comp: the precompiled exec with a compact table
- * @value: a string token input
- * @data: data associated to the token to reuse in callbacks
- *
- * Push one input token in the execution context
- *
- * Returns: 1 if the regexp reached a final state, 0 if non-final, and
- * a negative value in case of error.
- */
-static int
-xmlRegCompactPushString(xmlRegExecCtxtPtr exec,
- xmlRegexpPtr comp,
- const xmlChar *value,
- void *data) {
- int state = exec->index;
- int i, target;
-
- if ((comp == NULL) || (comp->compact == NULL) || (comp->stringMap == NULL))
- return(-1);
-
- if (value == NULL) {
- /*
- * are we at a final state ?
- */
- if (comp->compact[state * (comp->nbstrings + 1)] ==
- XML_REGEXP_FINAL_STATE)
- return(1);
- return(0);
- }
-
-#ifdef DEBUG_PUSH
- printf("value pushed: %s\n", value);
-#endif
-
- /*
- * Examine all outside transition from current state
- */
- for (i = 0;i < comp->nbstrings;i++) {
- target = comp->compact[state * (comp->nbstrings + 1) + i + 1];
- if ((target > 0) && (target <= comp->nbstates)) {
- target--; /* to avoid 0 */
- if (xmlStrEqual(comp->stringMap[i], value)) {
- exec->index = target;
- if ((exec->callback != NULL) && (comp->transdata != NULL)) {
- exec->callback(exec->data, value,
- comp->transdata[state * comp->nbstrings + i], data);
- }
-#ifdef DEBUG_PUSH
- printf("entering state %d\n", target);
-#endif
- if (comp->compact[target * (comp->nbstrings + 1)] ==
- XML_REGEXP_FINAL_STATE)
- return(1);
- return(0);
- }
- }
- }
- /*
- * Failed to find an exit transition out from current state for the
- * current token
- */
-#ifdef DEBUG_PUSH
- printf("failed to find a transition for %s on state %d\n", value, state);
-#endif
- exec->status = -1;
- return(-1);
-}
-
-/**
- * xmlRegExecPushString:
- * @exec: a regexp execution context
- * @value: a string token input
- * @data: data associated to the token to reuse in callbacks
- *
- * Push one input token in the execution context
- *
- * Returns: 1 if the regexp reached a final state, 0 if non-final, and
- * a negative value in case of error.
- */
-int
-xmlRegExecPushString(xmlRegExecCtxtPtr exec, const xmlChar *value,
- void *data) {
- xmlRegTransPtr trans;
- xmlRegAtomPtr atom;
- int ret;
- int final = 0;
-
- if (exec == NULL)
- return(-1);
- if (exec->comp == NULL)
- return(-1);
- if (exec->status != 0)
- return(exec->status);
-
- if (exec->comp->compact != NULL)
- return(xmlRegCompactPushString(exec, exec->comp, value, data));
-
- if (value == NULL) {
- if (exec->state->type == XML_REGEXP_FINAL_STATE)
- return(1);
- final = 1;
- }
-
-#ifdef DEBUG_PUSH
- printf("value pushed: %s\n", value);
-#endif
- /*
- * If we have an active rollback stack push the new value there
- * and get back to where we were left
- */
- if ((value != NULL) && (exec->inputStackNr > 0)) {
- xmlFARegExecSaveInputString(exec, value, data);
- value = exec->inputStack[exec->index].value;
- data = exec->inputStack[exec->index].data;
-#ifdef DEBUG_PUSH
- printf("value loaded: %s\n", value);
-#endif
- }
-
- while ((exec->status == 0) &&
- ((value != NULL) ||
- ((final == 1) &&
- (exec->state->type != XML_REGEXP_FINAL_STATE)))) {
-
- /*
- * End of input on non-terminal state, rollback, however we may
- * still have epsilon like transition for counted transitions
- * on counters, in that case don't break too early.
- */
- if ((value == NULL) && (exec->counts == NULL))
- goto rollback;
-
- exec->transcount = 0;
- for (;exec->transno < exec->state->nbTrans;exec->transno++) {
- trans = &exec->state->trans[exec->transno];
- if (trans->to < 0)
- continue;
- atom = trans->atom;
- ret = 0;
- if (trans->count == REGEXP_ALL_LAX_COUNTER) {
- int i;
- int count;
- xmlRegTransPtr t;
- xmlRegCounterPtr counter;
-
- ret = 0;
-
-#ifdef DEBUG_PUSH
- printf("testing all lax %d\n", trans->count);
-#endif
- /*
- * Check all counted transitions from the current state
- */
- if ((value == NULL) && (final)) {
- ret = 1;
- } else if (value != NULL) {
- for (i = 0;i < exec->state->nbTrans;i++) {
- t = &exec->state->trans[i];
- if ((t->counter < 0) || (t == trans))
- continue;
- counter = &exec->comp->counters[t->counter];
- count = exec->counts[t->counter];
- if ((count < counter->max) &&
- (t->atom != NULL) &&
- (xmlStrEqual(value, t->atom->valuep))) {
- ret = 0;
- break;
- }
- if ((count >= counter->min) &&
- (count < counter->max) &&
- (xmlStrEqual(value, t->atom->valuep))) {
- ret = 1;
- break;
- }
- }
- }
- } else if (trans->count == REGEXP_ALL_COUNTER) {
- int i;
- int count;
- xmlRegTransPtr t;
- xmlRegCounterPtr counter;
-
- ret = 1;
-
-#ifdef DEBUG_PUSH
- printf("testing all %d\n", trans->count);
-#endif
- /*
- * Check all counted transitions from the current state
- */
- for (i = 0;i < exec->state->nbTrans;i++) {
- t = &exec->state->trans[i];
- if ((t->counter < 0) || (t == trans))
- continue;
- counter = &exec->comp->counters[t->counter];
- count = exec->counts[t->counter];
- if ((count < counter->min) || (count > counter->max)) {
- ret = 0;
- break;
- }
- }
- } else if (trans->count >= 0) {
- int count;
- xmlRegCounterPtr counter;
-
- /*
- * A counted transition.
- */
-
- count = exec->counts[trans->count];
- counter = &exec->comp->counters[trans->count];
-#ifdef DEBUG_PUSH
- printf("testing count %d: val %d, min %d, max %d\n",
- trans->count, count, counter->min, counter->max);
-#endif
- ret = ((count >= counter->min) && (count <= counter->max));
- } else if (atom == NULL) {
- fprintf(stderr, "epsilon transition left at runtime\n");
- exec->status = -2;
- break;
- } else if (value != NULL) {
- ret = xmlStrEqual(value, atom->valuep);
- if ((ret == 1) && (trans->counter >= 0)) {
- xmlRegCounterPtr counter;
- int count;
-
- count = exec->counts[trans->counter];
- counter = &exec->comp->counters[trans->counter];
- if (count >= counter->max)
- ret = 0;
- }
-
- if ((ret == 1) && (atom->min > 0) && (atom->max > 0)) {
- xmlRegStatePtr to = exec->comp->states[trans->to];
-
- /*
- * this is a multiple input sequence
- */
- if (exec->state->nbTrans > exec->transno + 1) {
- if (exec->inputStackNr <= 0) {
- xmlFARegExecSaveInputString(exec, value, data);
- }
- xmlFARegExecSave(exec);
- }
- exec->transcount = 1;
- do {
- /*
- * Try to progress as much as possible on the input
- */
- if (exec->transcount == atom->max) {
- break;
- }
- exec->index++;
- value = exec->inputStack[exec->index].value;
- data = exec->inputStack[exec->index].data;
-#ifdef DEBUG_PUSH
- printf("value loaded: %s\n", value);
-#endif
-
- /*
- * End of input: stop here
- */
- if (value == NULL) {
- exec->index --;
- break;
- }
- if (exec->transcount >= atom->min) {
- int transno = exec->transno;
- xmlRegStatePtr state = exec->state;
-
- /*
- * The transition is acceptable save it
- */
- exec->transno = -1; /* trick */
- exec->state = to;
- if (exec->inputStackNr <= 0) {
- xmlFARegExecSaveInputString(exec, value, data);
- }
- xmlFARegExecSave(exec);
- exec->transno = transno;
- exec->state = state;
- }
- ret = xmlStrEqual(value, atom->valuep);
- exec->transcount++;
- } while (ret == 1);
- if (exec->transcount < atom->min)
- ret = 0;
-
- /*
- * If the last check failed but one transition was found
- * possible, rollback
- */
- if (ret < 0)
- ret = 0;
- if (ret == 0) {
- goto rollback;
- }
- }
- }
- if (ret == 1) {
- if ((exec->callback != NULL) && (atom != NULL)) {
- exec->callback(exec->data, atom->valuep,
- atom->data, data);
- }
- if (exec->state->nbTrans > exec->transno + 1) {
- if (exec->inputStackNr <= 0) {
- xmlFARegExecSaveInputString(exec, value, data);
- }
- xmlFARegExecSave(exec);
- }
- if (trans->counter >= 0) {
-#ifdef DEBUG_PUSH
- printf("Increasing count %d\n", trans->counter);
-#endif
- exec->counts[trans->counter]++;
- }
-#ifdef DEBUG_PUSH
- printf("entering state %d\n", trans->to);
-#endif
- exec->state = exec->comp->states[trans->to];
- exec->transno = 0;
- if (trans->atom != NULL) {
- if (exec->inputStack != NULL) {
- exec->index++;
- if (exec->index < exec->inputStackNr) {
- value = exec->inputStack[exec->index].value;
- data = exec->inputStack[exec->index].data;
-#ifdef DEBUG_PUSH
- printf("value loaded: %s\n", value);
-#endif
- } else {
- value = NULL;
- data = NULL;
-#ifdef DEBUG_PUSH
- printf("end of input\n");
-#endif
- }
- } else {
- value = NULL;
- data = NULL;
-#ifdef DEBUG_PUSH
- printf("end of input\n");
-#endif
- }
- }
- goto progress;
- } else if (ret < 0) {
- exec->status = -4;
- break;
- }
- }
- if ((exec->transno != 0) || (exec->state->nbTrans == 0)) {
-rollback:
- /*
- * Failed to find a way out
- */
- exec->determinist = 0;
- xmlFARegExecRollBack(exec);
- if (exec->status == 0) {
- value = exec->inputStack[exec->index].value;
- data = exec->inputStack[exec->index].data;
-#ifdef DEBUG_PUSH
- printf("value loaded: %s\n", value);
-#endif
- }
- }
-progress:
- continue;
- }
- if (exec->status == 0) {
- return(exec->state->type == XML_REGEXP_FINAL_STATE);
- }
- return(exec->status);
-}
-
-#if 0
-static int
-xmlRegExecPushChar(xmlRegExecCtxtPtr exec, int UCS) {
- xmlRegTransPtr trans;
- xmlRegAtomPtr atom;
- int ret;
- int codepoint, len;
-
- if (exec == NULL)
- return(-1);
- if (exec->status != 0)
- return(exec->status);
-
- while ((exec->status == 0) &&
- ((exec->inputString[exec->index] != 0) ||
- (exec->state->type != XML_REGEXP_FINAL_STATE))) {
-
- /*
- * End of input on non-terminal state, rollback, however we may
- * still have epsilon like transition for counted transitions
- * on counters, in that case don't break too early.
- */
- if ((exec->inputString[exec->index] == 0) && (exec->counts == NULL))
- goto rollback;
-
- exec->transcount = 0;
- for (;exec->transno < exec->state->nbTrans;exec->transno++) {
- trans = &exec->state->trans[exec->transno];
- if (trans->to < 0)
- continue;
- atom = trans->atom;
- ret = 0;
- if (trans->count >= 0) {
- int count;
- xmlRegCounterPtr counter;
-
- /*
- * A counted transition.
- */
-
- count = exec->counts[trans->count];
- counter = &exec->comp->counters[trans->count];
-#ifdef DEBUG_REGEXP_EXEC
- printf("testing count %d: val %d, min %d, max %d\n",
- trans->count, count, counter->min, counter->max);
-#endif
- ret = ((count >= counter->min) && (count <= counter->max));
- } else if (atom == NULL) {
- fprintf(stderr, "epsilon transition left at runtime\n");
- exec->status = -2;
- break;
- } else if (exec->inputString[exec->index] != 0) {
- codepoint = CUR_SCHAR(&(exec->inputString[exec->index]), len);
- ret = xmlRegCheckCharacter(atom, codepoint);
- if ((ret == 1) && (atom->min > 0) && (atom->max > 0)) {
- xmlRegStatePtr to = exec->comp->states[trans->to];
-
- /*
- * this is a multiple input sequence
- */
- if (exec->state->nbTrans > exec->transno + 1) {
- xmlFARegExecSave(exec);
- }
- exec->transcount = 1;
- do {
- /*
- * Try to progress as much as possible on the input
- */
- if (exec->transcount == atom->max) {
- break;
- }
- exec->index += len;
- /*
- * End of input: stop here
- */
- if (exec->inputString[exec->index] == 0) {
- exec->index -= len;
- break;
- }
- if (exec->transcount >= atom->min) {
- int transno = exec->transno;
- xmlRegStatePtr state = exec->state;
-
- /*
- * The transition is acceptable save it
- */
- exec->transno = -1; /* trick */
- exec->state = to;
- xmlFARegExecSave(exec);
- exec->transno = transno;
- exec->state = state;
- }
- codepoint = CUR_SCHAR(&(exec->inputString[exec->index]),
- len);
- ret = xmlRegCheckCharacter(atom, codepoint);
- exec->transcount++;
- } while (ret == 1);
- if (exec->transcount < atom->min)
- ret = 0;
-
- /*
- * If the last check failed but one transition was found
- * possible, rollback
- */
- if (ret < 0)
- ret = 0;
- if (ret == 0) {
- goto rollback;
- }
- }
- }
- if (ret == 1) {
- if (exec->state->nbTrans > exec->transno + 1) {
- xmlFARegExecSave(exec);
- }
- if (trans->counter >= 0) {
-#ifdef DEBUG_REGEXP_EXEC
- printf("Increasing count %d\n", trans->counter);
-#endif
- exec->counts[trans->counter]++;
- }
-#ifdef DEBUG_REGEXP_EXEC
- printf("entering state %d\n", trans->to);
-#endif
- exec->state = exec->comp->states[trans->to];
- exec->transno = 0;
- if (trans->atom != NULL) {
- exec->index += len;
- }
- goto progress;
- } else if (ret < 0) {
- exec->status = -4;
- break;
- }
- }
- if ((exec->transno != 0) || (exec->state->nbTrans == 0)) {
-rollback:
- /*
- * Failed to find a way out
- */
- exec->determinist = 0;
- xmlFARegExecRollBack(exec);
- }
-progress:
- continue;
- }
-}
-#endif
-/************************************************************************
- * *
- * Parser for the Shemas Datatype Regular Expressions *
- * http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#regexs *
- * *
- ************************************************************************/
-
-/**
- * xmlFAIsChar:
- * @ctxt: a regexp parser context
- *
- * [10] Char ::= [^.\?*+()|#x5B#x5D]
- */
-static int
-xmlFAIsChar(xmlRegParserCtxtPtr ctxt) {
- int cur;
- int len;
-
- cur = CUR_SCHAR(ctxt->cur, len);
- if ((cur == '.') || (cur == '\\') || (cur == '?') ||
- (cur == '*') || (cur == '+') || (cur == '(') ||
- (cur == ')') || (cur == '|') || (cur == 0x5B) ||
- (cur == 0x5D) || (cur == 0))
- return(-1);
- return(cur);
-}
-
-/**
- * xmlFAParseCharProp:
- * @ctxt: a regexp parser context
- *
- * [27] charProp ::= IsCategory | IsBlock
- * [28] IsCategory ::= Letters | Marks | Numbers | Punctuation |
- * Separators | Symbols | Others
- * [29] Letters ::= 'L' [ultmo]?
- * [30] Marks ::= 'M' [nce]?
- * [31] Numbers ::= 'N' [dlo]?
- * [32] Punctuation ::= 'P' [cdseifo]?
- * [33] Separators ::= 'Z' [slp]?
- * [34] Symbols ::= 'S' [mcko]?
- * [35] Others ::= 'C' [cfon]?
- * [36] IsBlock ::= 'Is' [a-zA-Z0-9#x2D]+
- */
-static void
-xmlFAParseCharProp(xmlRegParserCtxtPtr ctxt) {
- int cur;
- xmlRegAtomType type = 0;
- xmlChar *blockName = NULL;
-
- cur = CUR;
- if (cur == 'L') {
- NEXT;
- cur = CUR;
- if (cur == 'u') {
- NEXT;
- type = XML_REGEXP_LETTER_UPPERCASE;
- } else if (cur == 'l') {
- NEXT;
- type = XML_REGEXP_LETTER_LOWERCASE;
- } else if (cur == 't') {
- NEXT;
- type = XML_REGEXP_LETTER_TITLECASE;
- } else if (cur == 'm') {
- NEXT;
- type = XML_REGEXP_LETTER_MODIFIER;
- } else if (cur == 'o') {
- NEXT;
- type = XML_REGEXP_LETTER_OTHERS;
- } else {
- type = XML_REGEXP_LETTER;
- }
- } else if (cur == 'M') {
- NEXT;
- cur = CUR;
- if (cur == 'n') {
- NEXT;
- /* nonspacing */
- type = XML_REGEXP_MARK_NONSPACING;
- } else if (cur == 'c') {
- NEXT;
- /* spacing combining */
- type = XML_REGEXP_MARK_SPACECOMBINING;
- } else if (cur == 'e') {
- NEXT;
- /* enclosing */
- type = XML_REGEXP_MARK_ENCLOSING;
- } else {
- /* all marks */
- type = XML_REGEXP_MARK;
- }
- } else if (cur == 'N') {
- NEXT;
- cur = CUR;
- if (cur == 'd') {
- NEXT;
- /* digital */
- type = XML_REGEXP_NUMBER_DECIMAL;
- } else if (cur == 'l') {
- NEXT;
- /* letter */
- type = XML_REGEXP_NUMBER_LETTER;
- } else if (cur == 'o') {
- NEXT;
- /* other */
- type = XML_REGEXP_NUMBER_OTHERS;
- } else {
- /* all numbers */
- type = XML_REGEXP_NUMBER;
- }
- } else if (cur == 'P') {
- NEXT;
- cur = CUR;
- if (cur == 'c') {
- NEXT;
- /* connector */
- type = XML_REGEXP_PUNCT_CONNECTOR;
- } else if (cur == 'd') {
- NEXT;
- /* dash */
- type = XML_REGEXP_PUNCT_DASH;
- } else if (cur == 's') {
- NEXT;
- /* open */
- type = XML_REGEXP_PUNCT_OPEN;
- } else if (cur == 'e') {
- NEXT;
- /* close */
- type = XML_REGEXP_PUNCT_CLOSE;
- } else if (cur == 'i') {
- NEXT;
- /* initial quote */
- type = XML_REGEXP_PUNCT_INITQUOTE;
- } else if (cur == 'f') {
- NEXT;
- /* final quote */
- type = XML_REGEXP_PUNCT_FINQUOTE;
- } else if (cur == 'o') {
- NEXT;
- /* other */
- type = XML_REGEXP_PUNCT_OTHERS;
- } else {
- /* all punctuation */
- type = XML_REGEXP_PUNCT;
- }
- } else if (cur == 'Z') {
- NEXT;
- cur = CUR;
- if (cur == 's') {
- NEXT;
- /* space */
- type = XML_REGEXP_SEPAR_SPACE;
- } else if (cur == 'l') {
- NEXT;
- /* line */
- type = XML_REGEXP_SEPAR_LINE;
- } else if (cur == 'p') {
- NEXT;
- /* paragraph */
- type = XML_REGEXP_SEPAR_PARA;
- } else {
- /* all separators */
- type = XML_REGEXP_SEPAR;
- }
- } else if (cur == 'S') {
- NEXT;
- cur = CUR;
- if (cur == 'm') {
- NEXT;
- type = XML_REGEXP_SYMBOL_MATH;
- /* math */
- } else if (cur == 'c') {
- NEXT;
- type = XML_REGEXP_SYMBOL_CURRENCY;
- /* currency */
- } else if (cur == 'k') {
- NEXT;
- type = XML_REGEXP_SYMBOL_MODIFIER;
- /* modifiers */
- } else if (cur == 'o') {
- NEXT;
- type = XML_REGEXP_SYMBOL_OTHERS;
- /* other */
- } else {
- /* all symbols */
- type = XML_REGEXP_SYMBOL;
- }
- } else if (cur == 'C') {
- NEXT;
- cur = CUR;
- if (cur == 'c') {
- NEXT;
- /* control */
- type = XML_REGEXP_OTHER_CONTROL;
- } else if (cur == 'f') {
- NEXT;
- /* format */
- type = XML_REGEXP_OTHER_FORMAT;
- } else if (cur == 'o') {
- NEXT;
- /* private use */
- type = XML_REGEXP_OTHER_PRIVATE;
- } else if (cur == 'n') {
- NEXT;
- /* not assigned */
- type = XML_REGEXP_OTHER_NA;
- } else {
- /* all others */
- type = XML_REGEXP_OTHER;
- }
- } else if (cur == 'I') {
- const xmlChar *start;
- NEXT;
- cur = CUR;
- if (cur != 's') {
- ERROR("IsXXXX expected");
- return;
- }
- NEXT;
- start = ctxt->cur;
- cur = CUR;
- if (((cur >= 'a') && (cur <= 'z')) ||
- ((cur >= 'A') && (cur <= 'Z')) ||
- ((cur >= '0') && (cur <= '9')) ||
- (cur == 0x2D)) {
- NEXT;
- cur = CUR;
- while (((cur >= 'a') && (cur <= 'z')) ||
- ((cur >= 'A') && (cur <= 'Z')) ||
- ((cur >= '0') && (cur <= '9')) ||
- (cur == 0x2D)) {
- NEXT;
- cur = CUR;
- }
- }
- type = XML_REGEXP_BLOCK_NAME;
- blockName = xmlStrndup(start, ctxt->cur - start);
- } else {
- ERROR("Unknown char property");
- return;
- }
- if (ctxt->atom == NULL) {
- ctxt->atom = xmlRegNewAtom(ctxt, type);
- if (ctxt->atom != NULL)
- ctxt->atom->valuep = blockName;
- } else if (ctxt->atom->type == XML_REGEXP_RANGES) {
- xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
- type, 0, 0, blockName);
- }
-}
-
-/**
- * xmlFAParseCharClassEsc:
- * @ctxt: a regexp parser context
- *
- * [23] charClassEsc ::= ( SingleCharEsc | MultiCharEsc | catEsc | complEsc )
- * [24] SingleCharEsc ::= '\' [nrt\|.?*+(){}#x2D#x5B#x5D#x5E]
- * [25] catEsc ::= '\p{' charProp '}'
- * [26] complEsc ::= '\P{' charProp '}'
- * [37] MultiCharEsc ::= '.' | ('\' [sSiIcCdDwW])
- */
-static void
-xmlFAParseCharClassEsc(xmlRegParserCtxtPtr ctxt) {
- int cur;
-
- if (CUR == '.') {
- if (ctxt->atom == NULL) {
- ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_ANYCHAR);
- } else if (ctxt->atom->type == XML_REGEXP_RANGES) {
- xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
- XML_REGEXP_ANYCHAR, 0, 0, NULL);
- }
- NEXT;
- return;
- }
- if (CUR != '\\') {
- ERROR("Escaped sequence: expecting \\");
- return;
- }
- NEXT;
- cur = CUR;
- if (cur == 'p') {
- NEXT;
- if (CUR != '{') {
- ERROR("Expecting '{'");
- return;
- }
- NEXT;
- xmlFAParseCharProp(ctxt);
- if (CUR != '}') {
- ERROR("Expecting '}'");
- return;
- }
- NEXT;
- } else if (cur == 'P') {
- NEXT;
- if (CUR != '{') {
- ERROR("Expecting '{'");
- return;
- }
- NEXT;
- xmlFAParseCharProp(ctxt);
- ctxt->atom->neg = 1;
- if (CUR != '}') {
- ERROR("Expecting '}'");
- return;
- }
- NEXT;
- } else if ((cur == 'n') || (cur == 'r') || (cur == 't') || (cur == '\\') ||
- (cur == '|') || (cur == '.') || (cur == '?') || (cur == '*') ||
- (cur == '+') || (cur == '(') || (cur == ')') || (cur == '{') ||
- (cur == '}') || (cur == 0x2D) || (cur == 0x5B) || (cur == 0x5D) ||
- (cur == 0x5E)) {
- if (ctxt->atom == NULL) {
- ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_CHARVAL);
- if (ctxt->atom != NULL)
- ctxt->atom->codepoint = cur;
- } else if (ctxt->atom->type == XML_REGEXP_RANGES) {
- xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
- XML_REGEXP_CHARVAL, cur, cur, NULL);
- }
- NEXT;
- } else if ((cur == 's') || (cur == 'S') || (cur == 'i') || (cur == 'I') ||
- (cur == 'c') || (cur == 'C') || (cur == 'd') || (cur == 'D') ||
- (cur == 'w') || (cur == 'W')) {
- xmlRegAtomType type = XML_REGEXP_ANYSPACE;
-
- switch (cur) {
- case 's':
- type = XML_REGEXP_ANYSPACE;
- break;
- case 'S':
- type = XML_REGEXP_NOTSPACE;
- break;
- case 'i':
- type = XML_REGEXP_INITNAME;
- break;
- case 'I':
- type = XML_REGEXP_NOTINITNAME;
- break;
- case 'c':
- type = XML_REGEXP_NAMECHAR;
- break;
- case 'C':
- type = XML_REGEXP_NOTNAMECHAR;
- break;
- case 'd':
- type = XML_REGEXP_DECIMAL;
- break;
- case 'D':
- type = XML_REGEXP_NOTDECIMAL;
- break;
- case 'w':
- type = XML_REGEXP_REALCHAR;
- break;
- case 'W':
- type = XML_REGEXP_NOTREALCHAR;
- break;
- }
- NEXT;
- if (ctxt->atom == NULL) {
- ctxt->atom = xmlRegNewAtom(ctxt, type);
- } else if (ctxt->atom->type == XML_REGEXP_RANGES) {
- xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
- type, 0, 0, NULL);
- }
- }
-}
-
-/**
- * xmlFAParseCharRef:
- * @ctxt: a regexp parser context
- *
- * [19] XmlCharRef ::= ( '&#' [0-9]+ ';' ) | (' &#x' [0-9a-fA-F]+ ';' )
- */
-static int
-xmlFAParseCharRef(xmlRegParserCtxtPtr ctxt) {
- int ret = 0, cur;
-
- if ((CUR != '&') || (NXT(1) != '#'))
- return(-1);
- NEXT;
- NEXT;
- cur = CUR;
- if (cur == 'x') {
- NEXT;
- cur = CUR;
- if (((cur >= '0') && (cur <= '9')) ||
- ((cur >= 'a') && (cur <= 'f')) ||
- ((cur >= 'A') && (cur <= 'F'))) {
- while (((cur >= '0') && (cur <= '9')) ||
- ((cur >= 'A') && (cur <= 'F'))) {
- if ((cur >= '0') && (cur <= '9'))
- ret = ret * 16 + cur - '0';
- else if ((cur >= 'a') && (cur <= 'f'))
- ret = ret * 16 + 10 + (cur - 'a');
- else
- ret = ret * 16 + 10 + (cur - 'A');
- NEXT;
- cur = CUR;
- }
- } else {
- ERROR("Char ref: expecting [0-9A-F]");
- return(-1);
- }
- } else {
- if ((cur >= '0') && (cur <= '9')) {
- while ((cur >= '0') && (cur <= '9')) {
- ret = ret * 10 + cur - '0';
- NEXT;
- cur = CUR;
- }
- } else {
- ERROR("Char ref: expecting [0-9]");
- return(-1);
- }
- }
- if (cur != ';') {
- ERROR("Char ref: expecting ';'");
- return(-1);
- } else {
- NEXT;
- }
- return(ret);
-}
-
-/**
- * xmlFAParseCharRange:
- * @ctxt: a regexp parser context
- *
- * [17] charRange ::= seRange | XmlCharRef | XmlCharIncDash
- * [18] seRange ::= charOrEsc '-' charOrEsc
- * [20] charOrEsc ::= XmlChar | SingleCharEsc
- * [21] XmlChar ::= [^\#x2D#x5B#x5D]
- * [22] XmlCharIncDash ::= [^\#x5B#x5D]
- */
-static void
-xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) {
- int cur;
- int start = -1;
- int end = -1;
-
- if ((CUR == '&') && (NXT(1) == '#')) {
- end = start = xmlFAParseCharRef(ctxt);
- xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
- XML_REGEXP_CHARVAL, start, end, NULL);
- return;
- }
- cur = CUR;
- if (cur == '\\') {
- NEXT;
- cur = CUR;
- switch (cur) {
- case 'n': start = 0xA; break;
- case 'r': start = 0xD; break;
- case 't': start = 0x9; break;
- case '\\': case '|': case '.': case '-': case '^': case '?':
- case '*': case '+': case '{': case '}': case '(': case ')':
- case '[': case ']':
- start = cur; break;
- default:
- ERROR("Invalid escape value");
- return;
- }
- end = start;
- } else if ((cur != 0x5B) && (cur != 0x5D)) {
- end = start = cur;
- } else {
- ERROR("Expecting a char range");
- return;
- }
- NEXT;
- if (start == '-') {
- return;
- }
- cur = CUR;
- if (cur != '-') {
- xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
- XML_REGEXP_CHARVAL, start, end, NULL);
- return;
- }
- NEXT;
- cur = CUR;
- if (cur == '\\') {
- NEXT;
- cur = CUR;
- switch (cur) {
- case 'n': end = 0xA; break;
- case 'r': end = 0xD; break;
- case 't': end = 0x9; break;
- case '\\': case '|': case '.': case '-': case '^': case '?':
- case '*': case '+': case '{': case '}': case '(': case ')':
- case '[': case ']':
- end = cur; break;
- default:
- ERROR("Invalid escape value");
- return;
- }
- } else if ((cur != 0x5B) && (cur != 0x5D)) {
- end = cur;
- } else {
- ERROR("Expecting the end of a char range");
- return;
- }
- NEXT;
- /* TODO check that the values are acceptable character ranges for XML */
- if (end < start) {
- ERROR("End of range is before start of range");
- } else {
- xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
- XML_REGEXP_CHARVAL, start, end, NULL);
- }
- return;
-}
-
-/**
- * xmlFAParsePosCharGroup:
- * @ctxt: a regexp parser context
- *
- * [14] posCharGroup ::= ( charRange | charClassEsc )+
- */
-static void
-xmlFAParsePosCharGroup(xmlRegParserCtxtPtr ctxt) {
- do {
- if ((CUR == '\\') || (CUR == '.')) {
- xmlFAParseCharClassEsc(ctxt);
- } else {
- xmlFAParseCharRange(ctxt);
- }
- } while ((CUR != ']') && (CUR != '^') && (CUR != '-') &&
- (ctxt->error == 0));
-}
-
-/**
- * xmlFAParseCharGroup:
- * @ctxt: a regexp parser context
- *
- * [13] charGroup ::= posCharGroup | negCharGroup | charClassSub
- * [15] negCharGroup ::= '^' posCharGroup
- * [16] charClassSub ::= ( posCharGroup | negCharGroup ) '-' charClassExpr
- * [12] charClassExpr ::= '[' charGroup ']'
- */
-static void
-xmlFAParseCharGroup(xmlRegParserCtxtPtr ctxt) {
- int n = ctxt->neg;
- while ((CUR != ']') && (ctxt->error == 0)) {
- if (CUR == '^') {
- int neg = ctxt->neg;
-
- NEXT;
- ctxt->neg = !ctxt->neg;
- xmlFAParsePosCharGroup(ctxt);
- ctxt->neg = neg;
- } else if (CUR == '-') {
- NEXT;
- ctxt->neg = !ctxt->neg;
- if (CUR != '[') {
- ERROR("charClassExpr: '[' expected");
- break;
- }
- NEXT;
- xmlFAParseCharGroup(ctxt);
- if (CUR == ']') {
- NEXT;
- } else {
- ERROR("charClassExpr: ']' expected");
- break;
- }
- break;
- } else if (CUR != ']') {
- xmlFAParsePosCharGroup(ctxt);
- }
- }
- ctxt->neg = n;
-}
-
-/**
- * xmlFAParseCharClass:
- * @ctxt: a regexp parser context
- *
- * [11] charClass ::= charClassEsc | charClassExpr
- * [12] charClassExpr ::= '[' charGroup ']'
- */
-static void
-xmlFAParseCharClass(xmlRegParserCtxtPtr ctxt) {
- if (CUR == '[') {
- NEXT;
- ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_RANGES);
- if (ctxt->atom == NULL)
- return;
- xmlFAParseCharGroup(ctxt);
- if (CUR == ']') {
- NEXT;
- } else {
- ERROR("xmlFAParseCharClass: ']' expected");
- }
- } else {
- xmlFAParseCharClassEsc(ctxt);
- }
-}
-
-/**
- * xmlFAParseQuantExact:
- * @ctxt: a regexp parser context
- *
- * [8] QuantExact ::= [0-9]+
- */
-static int
-xmlFAParseQuantExact(xmlRegParserCtxtPtr ctxt) {
- int ret = 0;
- int ok = 0;
-
- while ((CUR >= '0') && (CUR <= '9')) {
- ret = ret * 10 + (CUR - '0');
- ok = 1;
- NEXT;
- }
- if (ok != 1) {
- return(-1);
- }
- return(ret);
-}
-
-/**
- * xmlFAParseQuantifier:
- * @ctxt: a regexp parser context
- *
- * [4] quantifier ::= [?*+] | ( '{' quantity '}' )
- * [5] quantity ::= quantRange | quantMin | QuantExact
- * [6] quantRange ::= QuantExact ',' QuantExact
- * [7] quantMin ::= QuantExact ','
- * [8] QuantExact ::= [0-9]+
- */
-static int
-xmlFAParseQuantifier(xmlRegParserCtxtPtr ctxt) {
- int cur;
-
- cur = CUR;
- if ((cur == '?') || (cur == '*') || (cur == '+')) {
- if (ctxt->atom != NULL) {
- if (cur == '?')
- ctxt->atom->quant = XML_REGEXP_QUANT_OPT;
- else if (cur == '*')
- ctxt->atom->quant = XML_REGEXP_QUANT_MULT;
- else if (cur == '+')
- ctxt->atom->quant = XML_REGEXP_QUANT_PLUS;
- }
- NEXT;
- return(1);
- }
- if (cur == '{') {
- int min = 0, max = 0;
-
- NEXT;
- cur = xmlFAParseQuantExact(ctxt);
- if (cur >= 0)
- min = cur;
- if (CUR == ',') {
- NEXT;
- cur = xmlFAParseQuantExact(ctxt);
- if (cur >= 0)
- max = cur;
- }
- if (CUR == '}') {
- NEXT;
- } else {
- ERROR("Unterminated quantifier");
- }
- if (max == 0)
- max = min;
- if (ctxt->atom != NULL) {
- ctxt->atom->quant = XML_REGEXP_QUANT_RANGE;
- ctxt->atom->min = min;
- ctxt->atom->max = max;
- }
- return(1);
- }
- return(0);
-}
-
-/**
- * xmlFAParseAtom:
- * @ctxt: a regexp parser context
- *
- * [9] atom ::= Char | charClass | ( '(' regExp ')' )
- */
-static int
-xmlFAParseAtom(xmlRegParserCtxtPtr ctxt) {
- int codepoint, len;
-
- codepoint = xmlFAIsChar(ctxt);
- if (codepoint > 0) {
- ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_CHARVAL);
- if (ctxt->atom == NULL)
- return(-1);
- codepoint = CUR_SCHAR(ctxt->cur, len);
- ctxt->atom->codepoint = codepoint;
- NEXTL(len);
- return(1);
- } else if (CUR == '|') {
- return(0);
- } else if (CUR == 0) {
- return(0);
- } else if (CUR == ')') {
- return(0);
- } else if (CUR == '(') {
- xmlRegStatePtr start, oldend;
-
- NEXT;
- xmlFAGenerateEpsilonTransition(ctxt, ctxt->state, NULL);
- start = ctxt->state;
- oldend = ctxt->end;
- ctxt->end = NULL;
- ctxt->atom = NULL;
- xmlFAParseRegExp(ctxt, 0);
- if (CUR == ')') {
- NEXT;
- } else {
- ERROR("xmlFAParseAtom: expecting ')'");
- }
- ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_SUBREG);
- if (ctxt->atom == NULL)
- return(-1);
- ctxt->atom->start = start;
- ctxt->atom->stop = ctxt->state;
- ctxt->end = oldend;
- return(1);
- } else if ((CUR == '[') || (CUR == '\\') || (CUR == '.')) {
- xmlFAParseCharClass(ctxt);
- return(1);
- }
- return(0);
-}
-
-/**
- * xmlFAParsePiece:
- * @ctxt: a regexp parser context
- *
- * [3] piece ::= atom quantifier?
- */
-static int
-xmlFAParsePiece(xmlRegParserCtxtPtr ctxt) {
- int ret;
-
- ctxt->atom = NULL;
- ret = xmlFAParseAtom(ctxt);
- if (ret == 0)
- return(0);
- if (ctxt->atom == NULL) {
- ERROR("internal: no atom generated");
- }
- xmlFAParseQuantifier(ctxt);
- return(1);
-}
-
-/**
- * xmlFAParseBranch:
- * @ctxt: a regexp parser context
- * @first: is taht the first
- *
- * [2] branch ::= piece*
- */
-static void
-xmlFAParseBranch(xmlRegParserCtxtPtr ctxt, int first) {
- xmlRegStatePtr previous;
- xmlRegAtomPtr prevatom = NULL;
- int ret;
-
- previous = ctxt->state;
- ret = xmlFAParsePiece(ctxt);
- if (ret != 0) {
- if (first) {
- xmlFAGenerateTransitions(ctxt, previous, NULL, ctxt->atom);
- previous = ctxt->state;
- } else {
- prevatom = ctxt->atom;
- }
- ctxt->atom = NULL;
- }
- while ((ret != 0) && (ctxt->error == 0)) {
- ret = xmlFAParsePiece(ctxt);
- if (ret != 0) {
- if (first) {
- xmlFAGenerateTransitions(ctxt, previous, NULL, ctxt->atom);
- } else {
- xmlFAGenerateTransitions(ctxt, previous, NULL, prevatom);
- prevatom = ctxt->atom;
- }
- previous = ctxt->state;
- ctxt->atom = NULL;
- }
- }
- if (!first) {
- xmlFAGenerateTransitions(ctxt, previous, ctxt->end, prevatom);
- }
-}
-
-/**
- * xmlFAParseRegExp:
- * @ctxt: a regexp parser context
- * @top: is that the top-level expressions ?
- *
- * [1] regExp ::= branch ( '|' branch )*
- */
-static void
-xmlFAParseRegExp(xmlRegParserCtxtPtr ctxt, int top) {
- xmlRegStatePtr start, end, oldend;
-
- oldend = ctxt->end;
-
- start = ctxt->state;
- xmlFAParseBranch(ctxt, (ctxt->end == NULL));
- if (CUR != '|') {
- ctxt->end = ctxt->state;
- return;
- }
- end = ctxt->state;
- while ((CUR == '|') && (ctxt->error == 0)) {
- NEXT;
- ctxt->state = start;
- ctxt->end = end;
- xmlFAParseBranch(ctxt, 0);
- }
- if (!top)
- ctxt->end = oldend;
-}
-
-/************************************************************************
- * *
- * The basic API *
- * *
- ************************************************************************/
-
-/**
- * xmlRegexpPrint:
- * @output: the file for the output debug
- * @regexp: the compiled regexp
- *
- * Print the content of the compiled regular expression
- */
-void
-xmlRegexpPrint(FILE *output, xmlRegexpPtr regexp) {
- int i;
-
- fprintf(output, " regexp: ");
- if (regexp == NULL) {
- fprintf(output, "NULL\n");
- return;
- }
- fprintf(output, "'%s' ", regexp->string);
- fprintf(output, "\n");
- fprintf(output, "%d atoms:\n", regexp->nbAtoms);
- for (i = 0;i < regexp->nbAtoms; i++) {
- fprintf(output, " %02d ", i);
- xmlRegPrintAtom(output, regexp->atoms[i]);
- }
- fprintf(output, "%d states:", regexp->nbStates);
- fprintf(output, "\n");
- for (i = 0;i < regexp->nbStates; i++) {
- xmlRegPrintState(output, regexp->states[i]);
- }
- fprintf(output, "%d counters:\n", regexp->nbCounters);
- for (i = 0;i < regexp->nbCounters; i++) {
- fprintf(output, " %d: min %d max %d\n", i, regexp->counters[i].min,
- regexp->counters[i].max);
- }
-}
-
-/**
- * xmlRegexpCompile:
- * @regexp: a regular expression string
- *
- * Parses a regular expression conforming to XML Schemas Part 2 Datatype
- * Appendix F and build an automata suitable for testing strings against
- * that regular expression
- *
- * Returns the compiled expression or NULL in case of error
- */
-xmlRegexpPtr
-xmlRegexpCompile(const xmlChar *regexp) {
- xmlRegexpPtr ret;
- xmlRegParserCtxtPtr ctxt;
-
- ctxt = xmlRegNewParserCtxt(regexp);
- if (ctxt == NULL)
- return(NULL);
-
- /* initialize the parser */
- ctxt->end = NULL;
- ctxt->start = ctxt->state = xmlRegNewState(ctxt);
- xmlRegStatePush(ctxt, ctxt->start);
-
- /* parse the expression building an automata */
- xmlFAParseRegExp(ctxt, 1);
- if (CUR != 0) {
- ERROR("xmlFAParseRegExp: extra characters");
- }
- ctxt->end = ctxt->state;
- ctxt->start->type = XML_REGEXP_START_STATE;
- ctxt->end->type = XML_REGEXP_FINAL_STATE;
-
- /* remove the Epsilon except for counted transitions */
- xmlFAEliminateEpsilonTransitions(ctxt);
-
-
- if (ctxt->error != 0) {
- xmlRegFreeParserCtxt(ctxt);
- return(NULL);
- }
- ret = xmlRegEpxFromParse(ctxt);
- xmlRegFreeParserCtxt(ctxt);
- return(ret);
-}
-
-/**
- * xmlRegexpExec:
- * @comp: the compiled regular expression
- * @content: the value to check against the regular expression
- *
- * Check if the regular expression generate the value
- *
- * Returns 1 if it matches, 0 if not and a negativa value in case of error
- */
-int
-xmlRegexpExec(xmlRegexpPtr comp, const xmlChar *content) {
- if ((comp == NULL) || (content == NULL))
- return(-1);
- return(xmlFARegExec(comp, content));
-}
-
-/**
- * xmlRegexpIsDeterminist:
- * @comp: the compiled regular expression
- *
- * Check if the regular expression is determinist
- *
- * Returns 1 if it yes, 0 if not and a negativa value in case of error
- */
-int
-xmlRegexpIsDeterminist(xmlRegexpPtr comp) {
- xmlAutomataPtr am;
- int ret;
-
- if (comp == NULL)
- return(-1);
- if (comp->determinist != -1)
- return(comp->determinist);
-
- am = xmlNewAutomata();
- if (am->states != NULL) {
- int i;
-
- for (i = 0;i < am->nbStates;i++)
- xmlRegFreeState(am->states[i]);
- xmlFree(am->states);
- }
- am->nbAtoms = comp->nbAtoms;
- am->atoms = comp->atoms;
- am->nbStates = comp->nbStates;
- am->states = comp->states;
- am->determinist = -1;
- ret = xmlFAComputesDeterminism(am);
- am->atoms = NULL;
- am->states = NULL;
- xmlFreeAutomata(am);
- return(ret);
-}
-
-/**
- * xmlRegFreeRegexp:
- * @regexp: the regexp
- *
- * Free a regexp
- */
-void
-xmlRegFreeRegexp(xmlRegexpPtr regexp) {
- int i;
- if (regexp == NULL)
- return;
-
- if (regexp->string != NULL)
- xmlFree(regexp->string);
- if (regexp->states != NULL) {
- for (i = 0;i < regexp->nbStates;i++)
- xmlRegFreeState(regexp->states[i]);
- xmlFree(regexp->states);
- }
- if (regexp->atoms != NULL) {
- for (i = 0;i < regexp->nbAtoms;i++)
- xmlRegFreeAtom(regexp->atoms[i]);
- xmlFree(regexp->atoms);
- }
- if (regexp->counters != NULL)
- xmlFree(regexp->counters);
- if (regexp->compact != NULL)
- xmlFree(regexp->compact);
- if (regexp->transdata != NULL)
- xmlFree(regexp->transdata);
- if (regexp->stringMap != NULL) {
- for (i = 0; i < regexp->nbstrings;i++)
- xmlFree(regexp->stringMap[i]);
- xmlFree(regexp->stringMap);
- }
-
- xmlFree(regexp);
-}
-
-#ifdef LIBXML_AUTOMATA_ENABLED
-/************************************************************************
- * *
- * The Automata interface *
- * *
- ************************************************************************/
-
-/**
- * xmlNewAutomata:
- *
- * Create a new automata
- *
- * Returns the new object or NULL in case of failure
- */
-xmlAutomataPtr
-xmlNewAutomata(void) {
- xmlAutomataPtr ctxt;
-
- ctxt = xmlRegNewParserCtxt(NULL);
- if (ctxt == NULL)
- return(NULL);
-
- /* initialize the parser */
- ctxt->end = NULL;
- ctxt->start = ctxt->state = xmlRegNewState(ctxt);
- xmlRegStatePush(ctxt, ctxt->start);
-
- return(ctxt);
-}
-
-/**
- * xmlFreeAutomata:
- * @am: an automata
- *
- * Free an automata
- */
-void
-xmlFreeAutomata(xmlAutomataPtr am) {
- if (am == NULL)
- return;
- xmlRegFreeParserCtxt(am);
-}
-
-/**
- * xmlAutomataGetInitState:
- * @am: an automata
- *
- * Initial state lookup
- *
- * Returns the initial state of the automata
- */
-xmlAutomataStatePtr
-xmlAutomataGetInitState(xmlAutomataPtr am) {
- if (am == NULL)
- return(NULL);
- return(am->start);
-}
-
-/**
- * xmlAutomataSetFinalState:
- * @am: an automata
- * @state: a state in this automata
- *
- * Makes that state a final state
- *
- * Returns 0 or -1 in case of error
- */
-int
-xmlAutomataSetFinalState(xmlAutomataPtr am, xmlAutomataStatePtr state) {
- if ((am == NULL) || (state == NULL))
- return(-1);
- state->type = XML_REGEXP_FINAL_STATE;
- return(0);
-}
-
-/**
- * xmlAutomataNewTransition:
- * @am: an automata
- * @from: the starting point of the transition
- * @to: the target point of the transition or NULL
- * @token: the input string associated to that transition
- * @data: data passed to the callback function if the transition is activated
- *
- * If @to is NULL, this create first a new target state in the automata
- * and then adds a transition from the @from state to the target state
- * activated by the value of @token
- *
- * Returns the target state or NULL in case of error
- */
-xmlAutomataStatePtr
-xmlAutomataNewTransition(xmlAutomataPtr am, xmlAutomataStatePtr from,
- xmlAutomataStatePtr to, const xmlChar *token,
- void *data) {
- xmlRegAtomPtr atom;
-
- if ((am == NULL) || (from == NULL) || (token == NULL))
- return(NULL);
- atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
- atom->data = data;
- if (atom == NULL)
- return(NULL);
- atom->valuep = xmlStrdup(token);
-
- xmlFAGenerateTransitions(am, from, to, atom);
- if (to == NULL)
- return(am->state);
- return(to);
-}
-
-/**
- * xmlAutomataNewCountTrans:
- * @am: an automata
- * @from: the starting point of the transition
- * @to: the target point of the transition or NULL
- * @token: the input string associated to that transition
- * @min: the minimum successive occurences of token
- * @max: the maximum successive occurences of token
- * @data: data associated to the transition
- *
- * If @to is NULL, this create first a new target state in the automata
- * and then adds a transition from the @from state to the target state
- * activated by a succession of input of value @token and whose number
- * is between @min and @max
- *
- * Returns the target state or NULL in case of error
- */
-xmlAutomataStatePtr
-xmlAutomataNewCountTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
- xmlAutomataStatePtr to, const xmlChar *token,
- int min, int max, void *data) {
- xmlRegAtomPtr atom;
-
- if ((am == NULL) || (from == NULL) || (token == NULL))
- return(NULL);
- if (min < 0)
- return(NULL);
- if ((max < min) || (max < 1))
- return(NULL);
- atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
- if (atom == NULL)
- return(NULL);
- atom->valuep = xmlStrdup(token);
- atom->data = data;
- if (min == 0)
- atom->min = 1;
- else
- atom->min = min;
- atom->max = max;
-
- xmlFAGenerateTransitions(am, from, to, atom);
- if (to == NULL)
- to = am->state;
- if (to == NULL)
- return(NULL);
- if (min == 0)
- xmlFAGenerateEpsilonTransition(am, from, to);
- return(to);
-}
-
-/**
- * xmlAutomataNewOnceTrans:
- * @am: an automata
- * @from: the starting point of the transition
- * @to: the target point of the transition or NULL
- * @token: the input string associated to that transition
- * @min: the minimum successive occurences of token
- * @max: the maximum successive occurences of token
- * @data: data associated to the transition
- *
- * If @to is NULL, this create first a new target state in the automata
- * and then adds a transition from the @from state to the target state
- * activated by a succession of input of value @token and whose number
- * is between @min and @max, moreover that transistion can only be crossed
- * once.
- *
- * Returns the target state or NULL in case of error
- */
-xmlAutomataStatePtr
-xmlAutomataNewOnceTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
- xmlAutomataStatePtr to, const xmlChar *token,
- int min, int max, void *data) {
- xmlRegAtomPtr atom;
- int counter;
-
- if ((am == NULL) || (from == NULL) || (token == NULL))
- return(NULL);
- if (min < 1)
- return(NULL);
- if ((max < min) || (max < 1))
- return(NULL);
- atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
- if (atom == NULL)
- return(NULL);
- atom->valuep = xmlStrdup(token);
- atom->data = data;
- atom->quant = XML_REGEXP_QUANT_ONCEONLY;
- if (min == 0)
- atom->min = 1;
- else
- atom->min = min;
- atom->max = max;
- /*
- * associate a counter to the transition.
- */
- counter = xmlRegGetCounter(am);
- am->counters[counter].min = 1;
- am->counters[counter].max = 1;
-
- /* xmlFAGenerateTransitions(am, from, to, atom); */
- if (to == NULL) {
- to = xmlRegNewState(am);
- xmlRegStatePush(am, to);
- }
- xmlRegStateAddTrans(am, from, atom, to, counter, -1);
- xmlRegAtomPush(am, atom);
- am->state = to;
- if (to == NULL)
- to = am->state;
- if (to == NULL)
- return(NULL);
- return(to);
-}
-
-/**
- * xmlAutomataNewState:
- * @am: an automata
- *
- * Create a new disconnected state in the automata
- *
- * Returns the new state or NULL in case of error
- */
-xmlAutomataStatePtr
-xmlAutomataNewState(xmlAutomataPtr am) {
- xmlAutomataStatePtr to;
-
- if (am == NULL)
- return(NULL);
- to = xmlRegNewState(am);
- xmlRegStatePush(am, to);
- return(to);
-}
-
-/**
- * xmlAutomataNewEpsilon:
- * @am: an automata
- * @from: the starting point of the transition
- * @to: the target point of the transition or NULL
- *
- * If @to is NULL, this create first a new target state in the automata
- * and then adds a an epsilon transition from the @from state to the
- * target state
- *
- * Returns the target state or NULL in case of error
- */
-xmlAutomataStatePtr
-xmlAutomataNewEpsilon(xmlAutomataPtr am, xmlAutomataStatePtr from,
- xmlAutomataStatePtr to) {
- if ((am == NULL) || (from == NULL))
- return(NULL);
- xmlFAGenerateEpsilonTransition(am, from, to);
- if (to == NULL)
- return(am->state);
- return(to);
-}
-
-/**
- * xmlAutomataNewAllTrans:
- * @am: an automata
- * @from: the starting point of the transition
- * @to: the target point of the transition or NULL
- * @lax: allow to transition if not all all transitions have been activated
- *
- * If @to is NULL, this create first a new target state in the automata
- * and then adds a an ALL transition from the @from state to the
- * target state. That transition is an epsilon transition allowed only when
- * all transitions from the @from node have been activated.
- *
- * Returns the target state or NULL in case of error
- */
-xmlAutomataStatePtr
-xmlAutomataNewAllTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
- xmlAutomataStatePtr to, int lax) {
- if ((am == NULL) || (from == NULL))
- return(NULL);
- xmlFAGenerateAllTransition(am, from, to, lax);
- if (to == NULL)
- return(am->state);
- return(to);
-}
-
-/**
- * xmlAutomataNewCounter:
- * @am: an automata
- * @min: the minimal value on the counter
- * @max: the maximal value on the counter
- *
- * Create a new counter
- *
- * Returns the counter number or -1 in case of error
- */
-int
-xmlAutomataNewCounter(xmlAutomataPtr am, int min, int max) {
- int ret;
-
- if (am == NULL)
- return(-1);
-
- ret = xmlRegGetCounter(am);
- if (ret < 0)
- return(-1);
- am->counters[ret].min = min;
- am->counters[ret].max = max;
- return(ret);
-}
-
-/**
- * xmlAutomataNewCountedTrans:
- * @am: an automata
- * @from: the starting point of the transition
- * @to: the target point of the transition or NULL
- * @counter: the counter associated to that transition
- *
- * If @to is NULL, this create first a new target state in the automata
- * and then adds an epsilon transition from the @from state to the target state
- * which will increment the counter provided
- *
- * Returns the target state or NULL in case of error
- */
-xmlAutomataStatePtr
-xmlAutomataNewCountedTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
- xmlAutomataStatePtr to, int counter) {
- if ((am == NULL) || (from == NULL) || (counter < 0))
- return(NULL);
- xmlFAGenerateCountedEpsilonTransition(am, from, to, counter);
- if (to == NULL)
- return(am->state);
- return(to);
-}
-
-/**
- * xmlAutomataNewCounterTrans:
- * @am: an automata
- * @from: the starting point of the transition
- * @to: the target point of the transition or NULL
- * @counter: the counter associated to that transition
- *
- * If @to is NULL, this create first a new target state in the automata
- * and then adds an epsilon transition from the @from state to the target state
- * which will be allowed only if the counter is within the right range.
- *
- * Returns the target state or NULL in case of error
- */
-xmlAutomataStatePtr
-xmlAutomataNewCounterTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
- xmlAutomataStatePtr to, int counter) {
- if ((am == NULL) || (from == NULL) || (counter < 0))
- return(NULL);
- xmlFAGenerateCountedTransition(am, from, to, counter);
- if (to == NULL)
- return(am->state);
- return(to);
-}
-
-/**
- * xmlAutomataCompile:
- * @am: an automata
- *
- * Compile the automata into a Reg Exp ready for being executed.
- * The automata should be free after this point.
- *
- * Returns the compiled regexp or NULL in case of error
- */
-xmlRegexpPtr
-xmlAutomataCompile(xmlAutomataPtr am) {
- xmlRegexpPtr ret;
-
- xmlFAEliminateEpsilonTransitions(am);
- /* xmlFAComputesDeterminism(am); */
- ret = xmlRegEpxFromParse(am);
-
- return(ret);
-}
-
-/**
- * xmlAutomataIsDeterminist:
- * @am: an automata
- *
- * Checks if an automata is determinist.
- *
- * Returns 1 if true, 0 if not, and -1 in case of error
- */
-int
-xmlAutomataIsDeterminist(xmlAutomataPtr am) {
- int ret;
-
- if (am == NULL)
- return(-1);
-
- ret = xmlFAComputesDeterminism(am);
- return(ret);
-}
-#endif /* LIBXML_AUTOMATA_ENABLED */
-#endif /* LIBXML_REGEXP_ENABLED */
diff --git a/bundle/libxml/xmlschemas.c b/bundle/libxml/xmlschemas.c
deleted file mode 100644
index 9bafb2dcf9..0000000000
--- a/bundle/libxml/xmlschemas.c
+++ /dev/null
@@ -1,5468 +0,0 @@
-/*
- * schemas.c : implementation of the XML Schema handling and
- * schema validity checking
- *
- * See Copyright for the status of this software.
- *
- * Daniel Veillard <veillard@redhat.com>
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#ifdef LIBXML_SCHEMAS_ENABLED
-
-#include <string.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-#include <libxml/hash.h>
-#include <libxml/uri.h>
-
-#include <libxml/xmlschemas.h>
-#include <libxml/schemasInternals.h>
-#include <libxml/xmlschemastypes.h>
-#include <libxml/xmlautomata.h>
-#include <libxml/xmlregexp.h>
-
-#define DEBUG 1 /* very verbose output */
-#define DEBUG_CONTENT 1
-#define DEBUG_TYPE 1
-/* #define DEBUG_CONTENT_REGEXP 1 */
-/* #define DEBUG_AUTOMATA 1 */
-
-#define UNBOUNDED (1 << 30)
-#define TODO \
- xmlGenericError(xmlGenericErrorContext, \
- "Unimplemented block at %s:%d\n", \
- __FILE__, __LINE__);
-
-#define XML_SCHEMAS_DEFAULT_NAMESPACE (const xmlChar *)"the default namespace"
-
-/*
- * The XML Schemas namespaces
- */
-static const xmlChar *xmlSchemaNs = (const xmlChar *)
- "http://www.w3.org/2001/XMLSchema";
-
-static const xmlChar *xmlSchemaInstanceNs = (const xmlChar *)
- "http://www.w3.org/2001/XMLSchema-instance";
-
-#define IS_SCHEMA(node, type) \
- ((node != NULL) && (node->ns != NULL) && \
- (xmlStrEqual(node->name, (const xmlChar *) type)) && \
- (xmlStrEqual(node->ns->href, xmlSchemaNs)))
-
-#define XML_SCHEMAS_PARSE_ERROR 1
-
-struct _xmlSchemaParserCtxt {
- void *userData; /* user specific data block */
- xmlSchemaValidityErrorFunc error; /* the callback in case of errors */
- xmlSchemaValidityWarningFunc warning;/* the callback in case of warning */
- xmlSchemaValidError err;
-
- xmlSchemaPtr schema; /* The schema in use */
- xmlChar *container; /* the current element, group, ... */
- int counter;
-
- xmlChar *URL;
- xmlDocPtr doc;
-
- const char *buffer;
- int size;
-
- /*
- * Used to build complex element content models
- */
- xmlAutomataPtr am;
- xmlAutomataStatePtr start;
- xmlAutomataStatePtr end;
- xmlAutomataStatePtr state;
-};
-
-
-#define XML_SCHEMAS_ATTR_UNKNOWN 1
-#define XML_SCHEMAS_ATTR_CHECKED 2
-
-typedef struct _xmlSchemaAttrState xmlSchemaAttrState;
-typedef xmlSchemaAttrState *xmlSchemaAttrStatePtr;
-struct _xmlSchemaAttrState {
- xmlAttrPtr attr;
- int state;
-};
-
-/**
- * xmlSchemaValidCtxt:
- *
- * A Schemas validation context
- */
-
-struct _xmlSchemaValidCtxt {
- void *userData; /* user specific data block */
- xmlSchemaValidityErrorFunc error; /* the callback in case of errors */
- xmlSchemaValidityWarningFunc warning;/* the callback in case of warning */
-
- xmlSchemaPtr schema; /* The schema in use */
- xmlDocPtr doc;
- xmlParserInputBufferPtr input;
- xmlCharEncoding enc;
- xmlSAXHandlerPtr sax;
- void *user_data;
-
- xmlDocPtr myDoc;
- int err;
-
- xmlNodePtr node;
- xmlSchemaTypePtr type;
-
- xmlRegExecCtxtPtr regexp;
- xmlSchemaValPtr value;
-
- int attrNr;
- int attrBase;
- int attrMax;
- xmlSchemaAttrStatePtr attr;
-};
-
-
-/************************************************************************
- * *
- * Some predeclarations *
- * *
- ************************************************************************/
-static int xmlSchemaValidateSimpleValue(xmlSchemaValidCtxtPtr ctxt,
- xmlSchemaTypePtr type,
- xmlChar *value);
-
-/************************************************************************
- * *
- * Allocation functions *
- * *
- ************************************************************************/
-
-/**
- * xmlSchemaNewSchema:
- * @ctxt: a schema validation context (optional)
- *
- * Allocate a new Schema structure.
- *
- * Returns the newly allocated structure or NULL in case or error
- */
-static xmlSchemaPtr
-xmlSchemaNewSchema(xmlSchemaParserCtxtPtr ctxt)
-{
- xmlSchemaPtr ret;
-
- ret = (xmlSchemaPtr) xmlMalloc(sizeof(xmlSchema));
- if (ret == NULL) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Out of memory\n");
- return (NULL);
- }
- memset(ret, 0, sizeof(xmlSchema));
-
- return (ret);
-}
-
-/**
- * xmlSchemaNewFacet:
- * @ctxt: a schema validation context (optional)
- *
- * Allocate a new Facet structure.
- *
- * Returns the newly allocated structure or NULL in case or error
- */
-static xmlSchemaFacetPtr
-xmlSchemaNewFacet(xmlSchemaParserCtxtPtr ctxt)
-{
- xmlSchemaFacetPtr ret;
-
- ret = (xmlSchemaFacetPtr) xmlMalloc(sizeof(xmlSchemaFacet));
- if (ret == NULL) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Out of memory\n");
- return (NULL);
- }
- memset(ret, 0, sizeof(xmlSchemaFacet));
-
- return (ret);
-}
-
-/**
- * xmlSchemaNewAnnot:
- * @ctxt: a schema validation context (optional)
- * @node: a node
- *
- * Allocate a new annotation structure.
- *
- * Returns the newly allocated structure or NULL in case or error
- */
-static xmlSchemaAnnotPtr
-xmlSchemaNewAnnot(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node)
-{
- xmlSchemaAnnotPtr ret;
-
- ret = (xmlSchemaAnnotPtr) xmlMalloc(sizeof(xmlSchemaAnnot));
- if (ret == NULL) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Out of memory\n");
- return (NULL);
- }
- memset(ret, 0, sizeof(xmlSchemaAnnot));
- ret->content = node;
- return (ret);
-}
-
-/**
- * xmlSchemaFreeAnnot:
- * @annot: a schema type structure
- *
- * Deallocate a annotation structure
- */
-static void
-xmlSchemaFreeAnnot(xmlSchemaAnnotPtr annot)
-{
- if (annot == NULL)
- return;
- xmlFree(annot);
-}
-
-/**
- * xmlSchemaFreeNotation:
- * @schema: a schema notation structure
- *
- * Deallocate a Schema Notation structure.
- */
-static void
-xmlSchemaFreeNotation(xmlSchemaNotationPtr nota)
-{
- if (nota == NULL)
- return;
- if (nota->name != NULL)
- xmlFree((xmlChar *) nota->name);
- xmlFree(nota);
-}
-
-/**
- * xmlSchemaFreeAttribute:
- * @schema: a schema attribute structure
- *
- * Deallocate a Schema Attribute structure.
- */
-static void
-xmlSchemaFreeAttribute(xmlSchemaAttributePtr attr)
-{
- if (attr == NULL)
- return;
- if (attr->name != NULL)
- xmlFree((xmlChar *) attr->name);
- if (attr->ref != NULL)
- xmlFree((xmlChar *) attr->ref);
- if (attr->refNs != NULL)
- xmlFree((xmlChar *) attr->refNs);
- if (attr->typeName != NULL)
- xmlFree((xmlChar *) attr->typeName);
- if (attr->typeNs != NULL)
- xmlFree((xmlChar *) attr->typeNs);
- xmlFree(attr);
-}
-
-/**
- * xmlSchemaFreeAttributeGroup:
- * @schema: a schema attribute group structure
- *
- * Deallocate a Schema Attribute Group structure.
- */
-static void
-xmlSchemaFreeAttributeGroup(xmlSchemaAttributeGroupPtr attr)
-{
- if (attr == NULL)
- return;
- if (attr->name != NULL)
- xmlFree((xmlChar *) attr->name);
- xmlFree(attr);
-}
-
-/**
- * xmlSchemaFreeElement:
- * @schema: a schema element structure
- *
- * Deallocate a Schema Element structure.
- */
-static void
-xmlSchemaFreeElement(xmlSchemaElementPtr elem)
-{
- if (elem == NULL)
- return;
- if (elem->name != NULL)
- xmlFree((xmlChar *) elem->name);
- if (elem->namedType != NULL)
- xmlFree((xmlChar *) elem->namedType);
- if (elem->namedTypeNs != NULL)
- xmlFree((xmlChar *) elem->namedTypeNs);
- if (elem->ref != NULL)
- xmlFree((xmlChar *) elem->ref);
- if (elem->refNs != NULL)
- xmlFree((xmlChar *) elem->refNs);
- if (elem->annot != NULL)
- xmlSchemaFreeAnnot(elem->annot);
- if (elem->contModel != NULL)
- xmlRegFreeRegexp(elem->contModel);
- xmlFree(elem);
-}
-
-/**
- * xmlSchemaFreeFacet:
- * @facet: a schema facet structure
- *
- * Deallocate a Schema Facet structure.
- */
-static void
-xmlSchemaFreeFacet(xmlSchemaFacetPtr facet)
-{
- if (facet == NULL)
- return;
- if (facet->value != NULL)
- xmlFree((xmlChar *) facet->value);
- if (facet->id != NULL)
- xmlFree((xmlChar *) facet->id);
- if (facet->val != NULL)
- xmlSchemaFreeValue(facet->val);
- if (facet->regexp != NULL)
- xmlRegFreeRegexp(facet->regexp);
- if (facet->annot != NULL)
- xmlSchemaFreeAnnot(facet->annot);
- xmlFree(facet);
-}
-
-/**
- * xmlSchemaFreeType:
- * @type: a schema type structure
- *
- * Deallocate a Schema Type structure.
- */
-void
-xmlSchemaFreeType(xmlSchemaTypePtr type)
-{
- if (type == NULL)
- return;
- if (type->name != NULL)
- xmlFree((xmlChar *) type->name);
- if (type->base != NULL)
- xmlFree((xmlChar *) type->base);
- if (type->baseNs != NULL)
- xmlFree((xmlChar *) type->baseNs);
- if (type->annot != NULL)
- xmlSchemaFreeAnnot(type->annot);
- if (type->facets != NULL) {
- xmlSchemaFacetPtr facet, next;
-
- facet = type->facets;
- while (facet != NULL) {
- next = facet->next;
- xmlSchemaFreeFacet(facet);
- facet = next;
- }
- }
- xmlFree(type);
-}
-
-/**
- * xmlSchemaFree:
- * @schema: a schema structure
- *
- * Deallocate a Schema structure.
- */
-void
-xmlSchemaFree(xmlSchemaPtr schema)
-{
- if (schema == NULL)
- return;
-
- if (schema->name != NULL)
- xmlFree((xmlChar *) schema->name);
- if (schema->notaDecl != NULL)
- xmlHashFree(schema->notaDecl,
- (xmlHashDeallocator) xmlSchemaFreeNotation);
- if (schema->attrDecl != NULL)
- xmlHashFree(schema->attrDecl,
- (xmlHashDeallocator) xmlSchemaFreeAttribute);
- if (schema->attrgrpDecl != NULL)
- xmlHashFree(schema->attrgrpDecl,
- (xmlHashDeallocator) xmlSchemaFreeAttributeGroup);
- if (schema->elemDecl != NULL)
- xmlHashFree(schema->elemDecl,
- (xmlHashDeallocator) xmlSchemaFreeElement);
- if (schema->typeDecl != NULL)
- xmlHashFree(schema->typeDecl,
- (xmlHashDeallocator) xmlSchemaFreeType);
- if (schema->annot != NULL)
- xmlSchemaFreeAnnot(schema->annot);
- if (schema->doc != NULL)
- xmlFreeDoc(schema->doc);
-
- xmlFree(schema);
-}
-
-/************************************************************************
- * *
- * Error functions *
- * *
- ************************************************************************/
-
-/**
- * xmlSchemaErrorContext:
- * @ctxt: the parsing context
- * @schema: the schema being built
- * @node: the node being processed
- * @child: the child being processed
- *
- * Dump a SchemaType structure
- */
-static void
-xmlSchemaErrorContext(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node, xmlNodePtr child)
-{
- int line = 0;
- const xmlChar *file = NULL;
- const xmlChar *name = NULL;
- const char *type = "error";
-
- if ((ctxt == NULL) || (ctxt->error == NULL))
- return;
-
- if (child != NULL)
- node = child;
-
- if (node != NULL) {
- if ((node->type == XML_DOCUMENT_NODE) ||
- (node->type == XML_HTML_DOCUMENT_NODE)) {
- xmlDocPtr doc = (xmlDocPtr) node;
-
- file = doc->URL;
- } else {
- /*
- * Try to find contextual informations to report
- */
- if (node->type == XML_ELEMENT_NODE) {
- line = (int) node->content;
- } else if ((node->prev != NULL) &&
- (node->prev->type == XML_ELEMENT_NODE)) {
- line = (int) node->prev->content;
- } else if ((node->parent != NULL) &&
- (node->parent->type == XML_ELEMENT_NODE)) {
- line = (int) node->parent->content;
- }
- if ((node->doc != NULL) && (node->doc->URL != NULL))
- file = node->doc->URL;
- if (node->name != NULL)
- name = node->name;
- }
- }
-
- if (ctxt != NULL)
- type = "compilation error";
- else if (schema != NULL)
- type = "runtime error";
-
- if ((file != NULL) && (line != 0) && (name != NULL))
- ctxt->error(ctxt->userData, "%s: file %s line %d element %s\n",
- type, file, line, name);
- else if ((file != NULL) && (name != NULL))
- ctxt->error(ctxt->userData, "%s: file %s element %s\n",
- type, file, name);
- else if ((file != NULL) && (line != 0))
- ctxt->error(ctxt->userData, "%s: file %s line %d\n", type, file, line);
- else if (file != NULL)
- ctxt->error(ctxt->userData, "%s: file %s\n", type, file);
- else if (name != NULL)
- ctxt->error(ctxt->userData, "%s: element %s\n", type, name);
- else
- ctxt->error(ctxt->userData, "%s\n", type);
-}
-
-/************************************************************************
- * *
- * Debug functions *
- * *
- ************************************************************************/
-
-/**
- * xmlSchemaElementDump:
- * @elem: an element
- * @output: the file output
- *
- * Dump the element
- */
-static void
-xmlSchemaElementDump(xmlSchemaElementPtr elem, FILE * output,
- const xmlChar *name ATTRIBUTE_UNUSED,
- const xmlChar *context ATTRIBUTE_UNUSED,
- const xmlChar *namespace ATTRIBUTE_UNUSED)
-{
- if (elem == NULL)
- return;
-
- fprintf(output, "Element ");
- if (elem->flags & XML_SCHEMAS_ELEM_TOPLEVEL)
- fprintf(output, "toplevel ");
- fprintf(output, ": %s ", elem->name);
- if (namespace != NULL)
- fprintf(output, "namespace '%s' ", namespace);
-
- if (elem->flags & XML_SCHEMAS_ELEM_NILLABLE)
- fprintf(output, "nillable ");
- if (elem->flags & XML_SCHEMAS_ELEM_GLOBAL)
- fprintf(output, "global ");
- if (elem->flags & XML_SCHEMAS_ELEM_DEFAULT)
- fprintf(output, "default ");
- if (elem->flags & XML_SCHEMAS_ELEM_FIXED)
- fprintf(output, "fixed ");
- if (elem->flags & XML_SCHEMAS_ELEM_ABSTRACT)
- fprintf(output, "abstract ");
- if (elem->flags & XML_SCHEMAS_ELEM_REF)
- fprintf(output, "ref '%s' ", elem->ref);
- if (elem->id != NULL)
- fprintf(output, "id '%s' ", elem->id);
- fprintf(output, "\n");
- if ((elem->minOccurs != 1) || (elem->maxOccurs != 1)) {
- fprintf(output, " ");
- if (elem->minOccurs != 1)
- fprintf(output, "min: %d ", elem->minOccurs);
- if (elem->maxOccurs >= UNBOUNDED)
- fprintf(output, "max: unbounded\n");
- else if (elem->maxOccurs != 1)
- fprintf(output, "max: %d\n", elem->maxOccurs);
- else
- fprintf(output, "\n");
- }
- if (elem->namedType != NULL) {
- fprintf(output, " type: %s", elem->namedType);
- if (elem->namedTypeNs != NULL)
- fprintf(output, " ns %s\n", elem->namedTypeNs);
- else
- fprintf(output, "\n");
- }
- if (elem->substGroup != NULL) {
- fprintf(output, " substitutionGroup: %s", elem->substGroup);
- if (elem->substGroupNs != NULL)
- fprintf(output, " ns %s\n", elem->substGroupNs);
- else
- fprintf(output, "\n");
- }
- if (elem->value != NULL)
- fprintf(output, " default: %s", elem->value);
-}
-
-/**
- * xmlSchemaAnnotDump:
- * @output: the file output
- * @annot: a annotation
- *
- * Dump the annotation
- */
-static void
-xmlSchemaAnnotDump(FILE * output, xmlSchemaAnnotPtr annot)
-{
- xmlChar *content;
-
- if (annot == NULL)
- return;
-
- content = xmlNodeGetContent(annot->content);
- if (content != NULL) {
- fprintf(output, " Annot: %s\n", content);
- xmlFree(content);
- } else
- fprintf(output, " Annot: empty\n");
-}
-
-/**
- * xmlSchemaTypeDump:
- * @output: the file output
- * @type: a type structure
- *
- * Dump a SchemaType structure
- */
-static void
-xmlSchemaTypeDump(xmlSchemaTypePtr type, FILE * output)
-{
- if (type == NULL) {
- fprintf(output, "Type: NULL\n");
- return;
- }
- fprintf(output, "Type: ");
- if (type->name != NULL)
- fprintf(output, "%s, ", type->name);
- else
- fprintf(output, "no name");
- switch (type->type) {
- case XML_SCHEMA_TYPE_BASIC:
- fprintf(output, "basic ");
- break;
- case XML_SCHEMA_TYPE_SIMPLE:
- fprintf(output, "simple ");
- break;
- case XML_SCHEMA_TYPE_COMPLEX:
- fprintf(output, "complex ");
- break;
- case XML_SCHEMA_TYPE_SEQUENCE:
- fprintf(output, "sequence ");
- break;
- case XML_SCHEMA_TYPE_CHOICE:
- fprintf(output, "choice ");
- break;
- case XML_SCHEMA_TYPE_ALL:
- fprintf(output, "all ");
- break;
- case XML_SCHEMA_TYPE_UR:
- fprintf(output, "ur ");
- break;
- case XML_SCHEMA_TYPE_RESTRICTION:
- fprintf(output, "restriction ");
- break;
- case XML_SCHEMA_TYPE_EXTENSION:
- fprintf(output, "extension ");
- break;
- default:
- fprintf(output, "unknowntype%d ", type->type);
- break;
- }
- if (type->base != NULL) {
- fprintf(output, "base %s, ", type->base);
- }
- switch (type->contentType) {
- case XML_SCHEMA_CONTENT_UNKNOWN:
- fprintf(output, "unknown ");
- break;
- case XML_SCHEMA_CONTENT_EMPTY:
- fprintf(output, "empty ");
- break;
- case XML_SCHEMA_CONTENT_ELEMENTS:
- fprintf(output, "element ");
- break;
- case XML_SCHEMA_CONTENT_MIXED:
- fprintf(output, "mixed ");
- break;
- case XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS:
- fprintf(output, "mixed_or_elems ");
- break;
- case XML_SCHEMA_CONTENT_BASIC:
- fprintf(output, "basic ");
- break;
- case XML_SCHEMA_CONTENT_SIMPLE:
- fprintf(output, "simple ");
- break;
- case XML_SCHEMA_CONTENT_ANY:
- fprintf(output, "any ");
- break;
- }
- fprintf(output, "\n");
- if ((type->minOccurs != 1) || (type->maxOccurs != 1)) {
- fprintf(output, " ");
- if (type->minOccurs != 1)
- fprintf(output, "min: %d ", type->minOccurs);
- if (type->maxOccurs >= UNBOUNDED)
- fprintf(output, "max: unbounded\n");
- else if (type->maxOccurs != 1)
- fprintf(output, "max: %d\n", type->maxOccurs);
- else
- fprintf(output, "\n");
- }
- if (type->annot != NULL)
- xmlSchemaAnnotDump(output, type->annot);
- if (type->subtypes != NULL) {
- xmlSchemaTypePtr sub = type->subtypes;
-
- fprintf(output, " subtypes: ");
- while (sub != NULL) {
- fprintf(output, "%s ", sub->name);
- sub = sub->next;
- }
- fprintf(output, "\n");
- }
-
-}
-
-/**
- * xmlSchemaDump:
- * @output: the file output
- * @schema: a schema structure
- *
- * Dump a Schema structure.
- */
-void
-xmlSchemaDump(FILE * output, xmlSchemaPtr schema)
-{
- if (schema == NULL) {
- fprintf(output, "Schemas: NULL\n");
- return;
- }
- fprintf(output, "Schemas: ");
- if (schema->name != NULL)
- fprintf(output, "%s, ", schema->name);
- else
- fprintf(output, "no name, ");
- if (schema->targetNamespace != NULL)
- fprintf(output, "%s", schema->targetNamespace);
- else
- fprintf(output, "no target namespace");
- fprintf(output, "\n");
- if (schema->annot != NULL)
- xmlSchemaAnnotDump(output, schema->annot);
-
- xmlHashScan(schema->typeDecl, (xmlHashScanner) xmlSchemaTypeDump,
- output);
- xmlHashScanFull(schema->elemDecl,
- (xmlHashScannerFull) xmlSchemaElementDump, output);
-}
-
-/************************************************************************
- * *
- * Parsing functions *
- * *
- ************************************************************************/
-
-/**
- * xmlSchemaGetType:
- * @schema: the schemas context
- * @name: the type name
- * @ns: the type namespace
- *
- * Lookup a type in the schemas or the predefined types
- *
- * Returns 1 if the string is NULL or made of blanks chars, 0 otherwise
- */
-static xmlSchemaTypePtr
-xmlSchemaGetType(xmlSchemaPtr schema, const xmlChar * name,
- const xmlChar * namespace) {
- xmlSchemaTypePtr ret;
-
- if (name == NULL)
- return(NULL);
- if (schema != NULL) {
- ret = xmlHashLookup2(schema->typeDecl, name, namespace);
- if (ret != NULL)
- return(ret);
- }
- ret = xmlSchemaGetPredefinedType(name, namespace);
-#ifdef DEBUG
- if (ret == NULL) {
- if (namespace == NULL)
- fprintf(stderr, "Unable to lookup type %s", name);
- else
- fprintf(stderr, "Unable to lookup type %s:%s", name, namespace);
- }
-#endif
- return(ret);
-}
-
-/************************************************************************
- * *
- * Parsing functions *
- * *
- ************************************************************************/
-
-#define IS_BLANK_NODE(n) \
- (((n)->type == XML_TEXT_NODE) && (xmlSchemaIsBlank((n)->content)))
-
-/**
- * xmlSchemaIsBlank:
- * @str: a string
- *
- * Check if a string is ignorable
- *
- * Returns 1 if the string is NULL or made of blanks chars, 0 otherwise
- */
-static int
-xmlSchemaIsBlank(xmlChar *str) {
- if (str == NULL)
- return(1);
- while (*str != 0) {
- if (!(IS_BLANK(*str))) return(0);
- str++;
- }
- return(1);
-}
-
-/**
- * xmlSchemaAddNotation:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @name: the item name
- *
- * Add an XML schema Attrribute declaration
- * *WARNING* this interface is highly subject to change
- *
- * Returns the new struture or NULL in case of error
- */
-static xmlSchemaNotationPtr
-xmlSchemaAddNotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- const xmlChar * name)
-{
- xmlSchemaNotationPtr ret = NULL;
- int val;
-
- if ((ctxt == NULL) || (schema == NULL) || (name == NULL))
- return (NULL);
-
- if (schema->notaDecl == NULL)
- schema->notaDecl = xmlHashCreate(10);
- if (schema->notaDecl == NULL)
- return (NULL);
-
- ret = (xmlSchemaNotationPtr) xmlMalloc(sizeof(xmlSchemaNotation));
- if (ret == NULL) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Out of memory\n");
- return (NULL);
- }
- memset(ret, 0, sizeof(xmlSchemaNotation));
- ret->name = xmlStrdup(name);
- val = xmlHashAddEntry2(schema->notaDecl, name, schema->targetNamespace,
- ret);
- if (val != 0) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Could not add notation %s\n",
- name);
- xmlFree((char *) ret->name);
- xmlFree(ret);
- return (NULL);
- }
- return (ret);
-}
-
-
-/**
- * xmlSchemaAddAttribute:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @name: the item name
- * @container: the container's name
- *
- * Add an XML schema Attrribute declaration
- * *WARNING* this interface is highly subject to change
- *
- * Returns the new struture or NULL in case of error
- */
-static xmlSchemaAttributePtr
-xmlSchemaAddAttribute(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- const xmlChar * name)
-{
- xmlSchemaAttributePtr ret = NULL;
- int val;
-
- if ((ctxt == NULL) || (schema == NULL) || (name == NULL))
- return (NULL);
-
- if (schema->attrDecl == NULL)
- schema->attrDecl = xmlHashCreate(10);
- if (schema->attrDecl == NULL)
- return (NULL);
-
- ret = (xmlSchemaAttributePtr) xmlMalloc(sizeof(xmlSchemaAttribute));
- if (ret == NULL) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Out of memory\n");
- return (NULL);
- }
- memset(ret, 0, sizeof(xmlSchemaAttribute));
- ret->name = xmlStrdup(name);
- val = xmlHashAddEntry3(schema->attrDecl, name,
- schema->targetNamespace, ctxt->container, ret);
- if (val != 0) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Could not add attribute %s\n",
- name);
- xmlFree((char *) ret->name);
- xmlFree(ret);
- return (NULL);
- }
- return (ret);
-}
-
-/**
- * xmlSchemaAddAttributeGroup:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @name: the item name
- *
- * Add an XML schema Attrribute Group declaration
- *
- * Returns the new struture or NULL in case of error
- */
-static xmlSchemaAttributeGroupPtr
-xmlSchemaAddAttributeGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- const xmlChar * name)
-{
- xmlSchemaAttributeGroupPtr ret = NULL;
- int val;
-
- if ((ctxt == NULL) || (schema == NULL) || (name == NULL))
- return (NULL);
-
- if (schema->attrgrpDecl == NULL)
- schema->attrgrpDecl = xmlHashCreate(10);
- if (schema->attrgrpDecl == NULL)
- return (NULL);
-
- ret = (xmlSchemaAttributeGroupPtr) xmlMalloc(sizeof(xmlSchemaAttributeGroup));
- if (ret == NULL) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Out of memory\n");
- return (NULL);
- }
- memset(ret, 0, sizeof(xmlSchemaAttributeGroup));
- ret->name = xmlStrdup(name);
- val = xmlHashAddEntry3(schema->attrgrpDecl, name,
- schema->targetNamespace, ctxt->container, ret);
- if (val != 0) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Could not add attribute group %s\n",
- name);
- xmlFree((char *) ret->name);
- xmlFree(ret);
- return (NULL);
- }
- return (ret);
-}
-
-/**
- * xmlSchemaAddElement:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @name: the type name
- * @namespace: the type namespace
- *
- * Add an XML schema Element declaration
- * *WARNING* this interface is highly subject to change
- *
- * Returns the new struture or NULL in case of error
- */
-static xmlSchemaElementPtr
-xmlSchemaAddElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- const xmlChar * name, const xmlChar * namespace)
-{
- xmlSchemaElementPtr ret = NULL;
- int val;
-
- if ((ctxt == NULL) || (schema == NULL) || (name == NULL))
- return (NULL);
-
- if (schema->elemDecl == NULL)
- schema->elemDecl = xmlHashCreate(10);
- if (schema->elemDecl == NULL)
- return (NULL);
-
- ret = (xmlSchemaElementPtr) xmlMalloc(sizeof(xmlSchemaElement));
- if (ret == NULL) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Out of memory\n");
- return (NULL);
- }
- memset(ret, 0, sizeof(xmlSchemaElement));
- ret->name = xmlStrdup(name);
- val = xmlHashAddEntry3(schema->elemDecl, name,
- namespace, ctxt->container, ret);
- if (val != 0) {
- char buf[100];
-
- snprintf(buf, 99, "privatieelem%d", ctxt->counter++ + 1);
- val = xmlHashAddEntry3(schema->elemDecl, name, (xmlChar *) buf,
- namespace, ret);
- if (val != 0) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Could not add element %s\n",
- name);
- xmlFree((char *) ret->name);
- xmlFree(ret);
- return (NULL);
- }
- }
- return (ret);
-}
-
-/**
- * xmlSchemaAddType:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @name: the item name
- *
- * Add an XML schema Simple Type definition
- * *WARNING* this interface is highly subject to change
- *
- * Returns the new struture or NULL in case of error
- */
-static xmlSchemaTypePtr
-xmlSchemaAddType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- const xmlChar * name)
-{
- xmlSchemaTypePtr ret = NULL;
- int val;
-
- if ((ctxt == NULL) || (schema == NULL) || (name == NULL))
- return (NULL);
-
- if (schema->typeDecl == NULL)
- schema->typeDecl = xmlHashCreate(10);
- if (schema->typeDecl == NULL)
- return (NULL);
-
- ret = (xmlSchemaTypePtr) xmlMalloc(sizeof(xmlSchemaType));
- if (ret == NULL) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Out of memory\n");
- return (NULL);
- }
- memset(ret, 0, sizeof(xmlSchemaType));
- ret->name = xmlStrdup(name);
- val = xmlHashAddEntry2(schema->typeDecl, name, schema->targetNamespace,
- ret);
- if (val != 0) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Could not add type %s\n", name);
- xmlFree((char *) ret->name);
- xmlFree(ret);
- return (NULL);
- }
- ret->minOccurs = 1;
- ret->maxOccurs = 1;
-
- return (ret);
-}
-
-/************************************************************************
- * *
- * Utilities for parsing *
- * *
- ************************************************************************/
-
-/**
- * xmlGetQNameProp:
- * @ctxt: a schema validation context
- * @node: a subtree containing XML Schema informations
- * @name: the attribute name
- * @namespace: the result namespace if any
- *
- * Extract a QName Attribute value
- *
- * Returns the NCName or NULL if not found, and also update @namespace
- * with the namespace URI
- */
-static xmlChar *
-xmlGetQNameProp(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node,
- const char *name,
- xmlChar **namespace) {
- xmlChar *val, *ret, *prefix;
- xmlNsPtr ns;
-
-
- if (namespace != NULL)
- *namespace = NULL;
- val = xmlGetProp(node, (const xmlChar *) name);
- if (val == NULL)
- return(NULL);
-
- ret = xmlSplitQName2(val, &prefix);
- if (ret == NULL)
- return(val);
- xmlFree(val);
-
- ns = xmlSearchNs(node->doc, node, prefix);
- if (ns == NULL) {
- xmlSchemaErrorContext(ctxt, NULL, node, NULL);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Attribute %s: the QName prefix %s is undefined\n",
- name, prefix);
- } else {
- *namespace = xmlStrdup(ns->href);
- }
- xmlFree(prefix);
- return(ret);
-}
-
-/**
- * xmlGetMaxOccurs:
- * @ctxt: a schema validation context
- * @node: a subtree containing XML Schema informations
- *
- * Get the maxOccurs property
- *
- * Returns the default if not found, or the value
- */
-static int
-xmlGetMaxOccurs(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node) {
- xmlChar *val, *cur;
- int ret = 0;
-
- val = xmlGetProp(node, (const xmlChar *) "maxOccurs");
- if (val == NULL)
- return(1);
-
- if (xmlStrEqual(val, (const xmlChar *) "unbounded")) {
- xmlFree(val);
- return(UNBOUNDED); /* encoding it with -1 might be another option */
- }
-
- cur = val;
- while (IS_BLANK(*cur)) cur++;
- while ((*cur >= '0') && (*cur <= '9')) {
- ret = ret * 10 + (*cur - '0');
- cur++;
- }
- while (IS_BLANK(*cur)) cur++;
- if (*cur != 0) {
- xmlSchemaErrorContext(ctxt, NULL, node, NULL);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "invalid value for minOccurs: %s\n",
- val);
- xmlFree(val);
- return(1);
- }
- xmlFree(val);
- return(ret);
-}
-
-/**
- * xmlGetMinOccurs:
- * @ctxt: a schema validation context
- * @node: a subtree containing XML Schema informations
- *
- * Get the minOccurs property
- *
- * Returns the default if not found, or the value
- */
-static int
-xmlGetMinOccurs(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node) {
- xmlChar *val, *cur;
- int ret = 0;
-
- val = xmlGetProp(node, (const xmlChar *) "minOccurs");
- if (val == NULL)
- return(1);
-
- cur = val;
- while (IS_BLANK(*cur)) cur++;
- while ((*cur >= '0') && (*cur <= '9')) {
- ret = ret * 10 + (*cur - '0');
- cur++;
- }
- while (IS_BLANK(*cur)) cur++;
- if (*cur != 0) {
- xmlSchemaErrorContext(ctxt, NULL, node, NULL);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "invalid value for minOccurs: %s\n",
- val);
- xmlFree(val);
- return(1);
- }
- xmlFree(val);
- return(ret);
-}
-
-/**
- * xmlGetBooleanProp:
- * @ctxt: a schema validation context
- * @node: a subtree containing XML Schema informations
- * @name: the attribute name
- * @def: the default value
- *
- * Get is a bolean property is set
- *
- * Returns the default if not found, 0 if found to be false,
- * 1 if found to be true
- */
-static int
-xmlGetBooleanProp(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node,
- const char *name, int def) {
- xmlChar *val;
-
- val = xmlGetProp(node, (const xmlChar *) name);
- if (val == NULL)
- return(def);
-
- if (xmlStrEqual(val, BAD_CAST"true"))
- def = 1;
- else if (xmlStrEqual(val, BAD_CAST"false"))
- def = 0;
- else {
- xmlSchemaErrorContext(ctxt, NULL, node, NULL);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Attribute %s: the value %s is not boolean\n",
- name, val);
- }
- xmlFree(val);
- return(def);
-}
-
-/************************************************************************
- * *
- * Shema extraction from an Infoset *
- * *
- ************************************************************************/
-static xmlSchemaTypePtr xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr
- ctxt, xmlSchemaPtr schema,
- xmlNodePtr node);
-static xmlSchemaTypePtr xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt,
- xmlSchemaPtr schema,
- xmlNodePtr node);
-static xmlSchemaTypePtr xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt,
- xmlSchemaPtr schema,
- xmlNodePtr node,
- int simple);
-static xmlSchemaTypePtr xmlSchemaParseSequence(xmlSchemaParserCtxtPtr ctxt,
- xmlSchemaPtr schema,
- xmlNodePtr node);
-static xmlSchemaTypePtr xmlSchemaParseAll(xmlSchemaParserCtxtPtr ctxt,
- xmlSchemaPtr schema,
- xmlNodePtr node);
-static xmlSchemaAttributePtr xmlSchemaParseAttribute(xmlSchemaParserCtxtPtr
- ctxt,
- xmlSchemaPtr schema,
- xmlNodePtr node);
-static xmlSchemaAttributeGroupPtr
-xmlSchemaParseAttributeGroup(xmlSchemaParserCtxtPtr ctxt,
- xmlSchemaPtr schema, xmlNodePtr node);
-static xmlSchemaTypePtr xmlSchemaParseChoice(xmlSchemaParserCtxtPtr ctxt,
- xmlSchemaPtr schema,
- xmlNodePtr node);
-static xmlSchemaTypePtr xmlSchemaParseList(xmlSchemaParserCtxtPtr ctxt,
- xmlSchemaPtr schema,
- xmlNodePtr node);
-static xmlSchemaAttributePtr
-xmlSchemaParseAnyAttribute(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node);
-
-/**
- * xmlSchemaParseAttrDecls:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- * @type: the hosting type
- *
- * parse a XML schema attrDecls declaration corresponding to
- * <!ENTITY % attrDecls
- * '((%attribute;| %attributeGroup;)*,(%anyAttribute;)?)'>
- */
-static xmlNodePtr
-xmlSchemaParseAttrDecls(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr child, xmlSchemaTypePtr type)
-{
- xmlSchemaAttributePtr lastattr, attr;
-
- lastattr = NULL;
- while ((IS_SCHEMA(child, "attribute")) ||
- (IS_SCHEMA(child, "attributeGroup"))) {
- attr = NULL;
- if (IS_SCHEMA(child, "attribute")) {
- attr = xmlSchemaParseAttribute(ctxt, schema, child);
- } else if (IS_SCHEMA(child, "attributeGroup")) {
- attr = (xmlSchemaAttributePtr)
- xmlSchemaParseAttributeGroup(ctxt, schema, child);
- }
- if (attr != NULL) {
- if (lastattr == NULL) {
- type->attributes = attr;
- lastattr = attr
- ;
- } else {
- lastattr->next = attr;
- lastattr = attr;
- }
- }
- child = child->next;
- }
- if (IS_SCHEMA(child, "anyAttribute")) {
- attr = xmlSchemaParseAnyAttribute(ctxt, schema, child);
- if (attr != NULL) {
- if (lastattr == NULL) {
- type->attributes = attr;
- lastattr = attr
- ;
- } else {
- lastattr->next = attr;
- lastattr = attr;
- }
- }
- child = child->next;
- }
- return(child);
-}
-
-/**
- * xmlSchemaParseAnnotation:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema Attrribute declaration
- * *WARNING* this interface is highly subject to change
- *
- * Returns -1 in case of error, 0 if the declaration is inproper and
- * 1 in case of success.
- */
-static xmlSchemaAnnotPtr
-xmlSchemaParseAnnotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlSchemaAnnotPtr ret;
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
- ret = xmlSchemaNewAnnot(ctxt, node);
-
- return (ret);
-}
-
-/**
- * xmlSchemaParseFacet:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema Facet declaration
- * *WARNING* this interface is highly subject to change
- *
- * Returns the new type structure or NULL in case of error
- */
-static xmlSchemaFacetPtr
-xmlSchemaParseFacet(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlSchemaFacetPtr facet;
- xmlNodePtr child = NULL;
- xmlChar *value;
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
-
- facet = xmlSchemaNewFacet(ctxt);
- if (facet == NULL)
- return (NULL);
- facet->node = node;
- value = xmlGetProp(node, (const xmlChar *) "value");
- if (value == NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Facet %s has no value\n", node->name);
- xmlSchemaFreeFacet(facet);
- return (NULL);
- }
- if (IS_SCHEMA(node, "minInclusive")) {
- facet->type = XML_SCHEMA_FACET_MININCLUSIVE;
- } else if (IS_SCHEMA(node, "minExclusive")) {
- facet->type = XML_SCHEMA_FACET_MINEXCLUSIVE;
- } else if (IS_SCHEMA(node, "maxInclusive")) {
- facet->type = XML_SCHEMA_FACET_MAXINCLUSIVE;
- } else if (IS_SCHEMA(node, "maxExclusive")) {
- facet->type = XML_SCHEMA_FACET_MAXEXCLUSIVE;
- } else if (IS_SCHEMA(node, "totalDigits")) {
- facet->type = XML_SCHEMA_FACET_TOTALDIGITS;
- } else if (IS_SCHEMA(node, "fractionDigits")) {
- facet->type = XML_SCHEMA_FACET_FRACTIONDIGITS;
- } else if (IS_SCHEMA(node, "pattern")) {
- facet->type = XML_SCHEMA_FACET_PATTERN;
- } else if (IS_SCHEMA(node, "enumeration")) {
- facet->type = XML_SCHEMA_FACET_ENUMERATION;
- } else if (IS_SCHEMA(node, "whiteSpace")) {
- facet->type = XML_SCHEMA_FACET_WHITESPACE;
- } else if (IS_SCHEMA(node, "length")) {
- facet->type = XML_SCHEMA_FACET_LENGTH;
- } else if (IS_SCHEMA(node, "maxLength")) {
- facet->type = XML_SCHEMA_FACET_MAXLENGTH;
- } else if (IS_SCHEMA(node, "minLength")) {
- facet->type = XML_SCHEMA_FACET_MINLENGTH;
- } else {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Unknown facet type %s\n", node->name);
- xmlSchemaFreeFacet(facet);
- return(NULL);
- }
- facet->id = xmlGetProp(node, (const xmlChar *) "id");
- facet->value = value;
- child = node->children;
-
- if (IS_SCHEMA(child, "annotation")) {
- facet->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Facet %s has unexpected child content\n",
- node->name);
- }
- return (facet);
-}
-
-/**
- * xmlSchemaParseAny:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema Any declaration
- * *WARNING* this interface is highly subject to change
- *
- * Returns the new type structure or NULL in case of error
- */
-static xmlSchemaTypePtr
-xmlSchemaParseAny(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlSchemaTypePtr type;
- xmlNodePtr child = NULL;
- xmlChar name[30];
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
- snprintf((char *)name, 30, "any %d", ctxt->counter++ + 1);
- type = xmlSchemaAddType(ctxt, schema, name);
- if (type == NULL)
- return (NULL);
- type->node = node;
- type->type = XML_SCHEMA_TYPE_ANY;
- child = node->children;
- type->minOccurs = xmlGetMinOccurs(ctxt, node);
- type->maxOccurs = xmlGetMaxOccurs(ctxt, node);
-
- if (IS_SCHEMA(child, "annotation")) {
- type->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Sequence %s has unexpected content\n",
- type->name);
- }
-
- return (type);
-}
-
-/**
- * xmlSchemaParseNotation:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema Notation declaration
- *
- * Returns the new structure or NULL in case of error
- */
-static xmlSchemaNotationPtr
-xmlSchemaParseNotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlChar *name;
- xmlSchemaNotationPtr ret;
- xmlNodePtr child = NULL;
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
- name = xmlGetProp(node, (const xmlChar *) "name");
- if (name == NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Notation has no name\n");
- return (NULL);
- }
- ret = xmlSchemaAddNotation(ctxt, schema, name);
- if (ret == NULL) {
- xmlFree(name);
- return (NULL);
- }
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- ret->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "notation %s has unexpected content\n",
- name);
- }
-
- return (ret);
-}
-
-/**
- * xmlSchemaParseAnyAttribute:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema AnyAttrribute declaration
- * *WARNING* this interface is highly subject to change
- *
- * Returns an attribute def structure or NULL
- */
-static xmlSchemaAttributePtr
-xmlSchemaParseAnyAttribute(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlChar *processContents;
- xmlSchemaAttributePtr ret;
- xmlNodePtr child = NULL;
- char name[100];
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
-
- snprintf(name, 99, "anyattr %d", ctxt->counter++ + 1);
- ret = xmlSchemaAddAttribute(ctxt, schema, (xmlChar *)name);
- if (ret == NULL) {
- return (NULL);
- }
- ret->id = xmlGetProp(node, (const xmlChar *) "id");
- processContents = xmlGetProp(node, (const xmlChar *) "processContents");
- if ((processContents == NULL) ||
- (xmlStrEqual(processContents, (const xmlChar *)"strict"))) {
- ret->occurs = XML_SCHEMAS_ANYATTR_STRICT;
- } else if (xmlStrEqual(processContents, (const xmlChar *)"skip")) {
- ret->occurs = XML_SCHEMAS_ANYATTR_SKIP;
- } else if (xmlStrEqual(processContents, (const xmlChar *)"lax")) {
- ret->occurs = XML_SCHEMAS_ANYATTR_LAX;
- } else {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "anyAttribute has unexpected content for processContents: %s\n",
- processContents);
- ret->occurs = XML_SCHEMAS_ANYATTR_STRICT;
- }
- if (processContents != NULL)
- xmlFree(processContents);
-
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- ret->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "anyAttribute %s has unexpected content\n",
- name);
- }
-
- return (ret);
-}
-
-
-/**
- * xmlSchemaParseAttribute:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema Attrribute declaration
- * *WARNING* this interface is highly subject to change
- *
- * Returns -1 in case of error, 0 if the declaration is inproper and
- * 1 in case of success.
- */
-static xmlSchemaAttributePtr
-xmlSchemaParseAttribute(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlChar *name, *refNs = NULL, *ref = NULL;
- xmlSchemaAttributePtr ret;
- xmlNodePtr child = NULL;
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
- name = xmlGetProp(node, (const xmlChar *) "name");
- if (name == NULL) {
- char buf[100];
-
- ref = xmlGetQNameProp(ctxt, node, "ref", &refNs);
- if (ref == NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Attribute has no name nor ref\n");
- return (NULL);
- }
- snprintf(buf, 99, "anonattr%d", ctxt->counter++ + 1);
- name = xmlStrdup((xmlChar *) buf);
- }
- ret = xmlSchemaAddAttribute(ctxt, schema, name);
- if (ret == NULL) {
- xmlFree(name);
- if (ref != NULL)
- xmlFree(ref);
- return (NULL);
- }
- xmlFree(name);
- ret->ref = ref;
- ret->refNs = refNs;
- ret->typeName = xmlGetQNameProp(ctxt, node, "type", &(ret->typeNs));
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- ret->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- if (IS_SCHEMA(child, "simpleType")) {
- ret->subtypes = xmlSchemaParseSimpleType(ctxt, schema, child);
- child = child->next;
- }
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "attribute %s has unexpected content\n",
- name);
- }
-
- return (ret);
-}
-
-/**
- * xmlSchemaParseAttributeGroup:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema Attribute Group declaration
- * *WARNING* this interface is highly subject to change
- *
- * Returns the attribute group or NULL in case of error.
- */
-static xmlSchemaAttributeGroupPtr
-xmlSchemaParseAttributeGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlChar *name, *refNs = NULL, *ref = NULL;
- xmlSchemaAttributeGroupPtr ret;
- xmlSchemaAttributePtr last = NULL, attr;
- xmlNodePtr child = NULL;
- xmlChar *oldcontainer;
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
- oldcontainer = ctxt->container;
- name = xmlGetProp(node, (const xmlChar *) "name");
- if (name == NULL) {
- char buf[100];
-
- ref = xmlGetQNameProp(ctxt, node, "ref", &refNs);
- if (ref == NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "AttributeGroup has no name nor ref\n");
- return (NULL);
- }
- snprintf(buf, 99, "anonattrgroup%d", ctxt->counter++ + 1);
- name = xmlStrdup((xmlChar *) buf);
- }
- ret = xmlSchemaAddAttributeGroup(ctxt, schema, name);
- if (ret == NULL) {
- xmlFree(name);
- if (ref != NULL)
- xmlFree(ref);
- return (NULL);
- }
- ret->ref = ref;
- ret->refNs = refNs;
- ret->type = XML_SCHEMA_TYPE_ATTRIBUTEGROUP;
- child = node->children;
- ctxt->container = name;
- if (IS_SCHEMA(child, "annotation")) {
- ret->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- while ((IS_SCHEMA(child, "attribute")) ||
- (IS_SCHEMA(child, "attributeGroup"))) {
- attr = NULL;
- if (IS_SCHEMA(child, "attribute")) {
- attr = xmlSchemaParseAttribute(ctxt, schema, child);
- } else if (IS_SCHEMA(child, "attributeGroup")) {
- attr = (xmlSchemaAttributePtr)
- xmlSchemaParseAttributeGroup(ctxt, schema, child);
- }
- if (attr != NULL) {
- if (last == NULL) {
- ret->attributes = attr;
- last = attr;
- } else {
- last->next = attr;
- last = attr;
- }
- }
- child = child->next;
- }
- if (IS_SCHEMA(child, "anyAttribute")) {
- TODO
- child = child->next;
- }
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "attribute group %s has unexpected content\n",
- name);
- }
-
- ctxt->container = oldcontainer;
- return (ret);
-}
-
-/**
- * xmlSchemaParseElement:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema Element declaration
- * *WARNING* this interface is highly subject to change
- *
- * Returns -1 in case of error, 0 if the declaration is inproper and
- * 1 in case of success.
- */
-static xmlSchemaElementPtr
-xmlSchemaParseElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node, int toplevel)
-{
- xmlChar *name, *refNs = NULL, *ref = NULL, *namespace, *fixed;
- xmlSchemaElementPtr ret;
- xmlNodePtr child = NULL;
- xmlChar *oldcontainer;
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
- oldcontainer = ctxt->container;
- name = xmlGetProp(node, (const xmlChar *) "name");
- if (name == NULL) {
- char buf[100];
-
- ref = xmlGetQNameProp(ctxt, node, "ref", &refNs);
- if (ref == NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Element has no name nor ref\n");
- return (NULL);
- }
- snprintf(buf, 99, "anonelem%d", ctxt->counter++ + 1);
- name = xmlStrdup((xmlChar *) buf);
- }
- namespace = xmlGetProp(node, (const xmlChar *) "targetNamespace");
- if (namespace == NULL)
- ret =
- xmlSchemaAddElement(ctxt, schema, name,
- schema->targetNamespace);
- else
- ret = xmlSchemaAddElement(ctxt, schema, name, namespace);
- if (namespace != NULL)
- xmlFree(namespace);
- if (ret == NULL) {
- xmlFree(name);
- if (ref != NULL)
- xmlFree(ref);
- return (NULL);
- }
- ret->type = XML_SCHEMA_TYPE_ELEMENT;
- ret->ref = ref;
- ret->refNs = refNs;
- if (ref != NULL)
- ret->flags |= XML_SCHEMAS_ELEM_REF;
- if (toplevel)
- ret->flags |= XML_SCHEMAS_ELEM_TOPLEVEL;
- if (xmlGetBooleanProp(ctxt, node, "nillable", 0))
- ret->flags |= XML_SCHEMAS_ELEM_NILLABLE;
- if (xmlGetBooleanProp(ctxt, node, "abstract", 0))
- ret->flags |= XML_SCHEMAS_ELEM_NILLABLE;
- ctxt->container = name;
-
- ret->id = xmlGetProp(node, BAD_CAST "id");
- ret->namedType = xmlGetQNameProp(ctxt, node, "type", &(ret->namedTypeNs));
- ret->substGroup = xmlGetQNameProp(ctxt, node, "substitutionGroup",
- &(ret->substGroupNs));
- fixed = xmlGetProp(node, BAD_CAST "fixed");
- ret->minOccurs = xmlGetMinOccurs(ctxt, node);
- ret->maxOccurs = xmlGetMaxOccurs(ctxt, node);
-
- ret->value = xmlGetProp(node, BAD_CAST "default");
- if ((ret->value != NULL) && (fixed != NULL)) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- ctxt->error(ctxt->userData,
- "Element %s has both default and fixed\n",
- ret->name);
- xmlFree(fixed);
- } else if (fixed != NULL) {
- ret->flags |= XML_SCHEMAS_ELEM_FIXED;
- ret->value = fixed;
- }
-
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- ret->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- if (IS_SCHEMA(child, "complexType")) {
- ret->subtypes = xmlSchemaParseComplexType(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "simpleType")) {
- ret->subtypes = xmlSchemaParseSimpleType(ctxt, schema, child);
- child = child->next;
- }
- while ((IS_SCHEMA(child, "unique")) ||
- (IS_SCHEMA(child, "key")) ||
- (IS_SCHEMA(child, "keyref"))) {
- TODO
- child = child->next;
- }
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "element %s has unexpected content\n",
- name);
- }
-
- ctxt->container = oldcontainer;
- xmlFree(name);
- return (ret);
-}
-
-/**
- * xmlSchemaParseUnion:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema Union definition
- * *WARNING* this interface is highly subject to change
- *
- * Returns -1 in case of error, 0 if the declaration is inproper and
- * 1 in case of success.
- */
-static xmlSchemaTypePtr
-xmlSchemaParseUnion(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlSchemaTypePtr type, subtype, last = NULL;
- xmlNodePtr child = NULL;
- xmlChar name[30];
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
-
-
- snprintf((char *)name, 30, "union %d", ctxt->counter++ + 1);
- type = xmlSchemaAddType(ctxt, schema, name);
- if (type == NULL)
- return (NULL);
- type->node = node;
- type->type = XML_SCHEMA_TYPE_LIST;
- type->id = xmlGetProp(node, BAD_CAST "id");
- type->ref = xmlGetProp(node, BAD_CAST "memberTypes");
-
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- type->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- while (IS_SCHEMA(child, "simpleType")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseSimpleType(ctxt, schema, child);
- if (subtype != NULL) {
- if (last == NULL) {
- type->subtypes = subtype;
- last = subtype;
- } else {
- last->next = subtype;
- last = subtype;
- }
- last->next = NULL;
- }
- child = child->next;
- }
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Union %s has unexpected content\n",
- type->name);
- }
- return (type);
-}
-
-/**
- * xmlSchemaParseList:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema List definition
- * *WARNING* this interface is highly subject to change
- *
- * Returns -1 in case of error, 0 if the declaration is inproper and
- * 1 in case of success.
- */
-static xmlSchemaTypePtr
-xmlSchemaParseList(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlSchemaTypePtr type, subtype;
- xmlNodePtr child = NULL;
- xmlChar name[30];
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
-
- snprintf((char *)name, 30, "list %d", ctxt->counter++ + 1);
- type = xmlSchemaAddType(ctxt, schema, name);
- if (type == NULL)
- return (NULL);
- type->node = node;
- type->type = XML_SCHEMA_TYPE_LIST;
- type->id = xmlGetProp(node, BAD_CAST "id");
- type->ref = xmlGetQNameProp(ctxt, node, "ref", &(type->refNs));
-
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- type->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- subtype = NULL;
- if (IS_SCHEMA(child, "simpleType")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseSimpleType(ctxt, schema, child);
- child = child->next;
- type->subtypes = subtype;
- }
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "List %s has unexpected content\n",
- type->name);
- }
- return (type);
-}
-/**
- * xmlSchemaParseSimpleType:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema Simple Type definition
- * *WARNING* this interface is highly subject to change
- *
- * Returns -1 in case of error, 0 if the declaration is inproper and
- * 1 in case of success.
- */
-static xmlSchemaTypePtr
-xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlSchemaTypePtr type, subtype;
- xmlNodePtr child = NULL;
- xmlChar *name;
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
-
-
- name = xmlGetProp(node, (const xmlChar *) "name");
- if (name == NULL) {
- char buf[100];
-
- snprintf(buf, 99, "simpletype%d", ctxt->counter++ + 1);
- name = xmlStrdup((xmlChar *) buf);
- }
- if (name == NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "simpleType has no name\n");
- return (NULL);
- }
- type = xmlSchemaAddType(ctxt, schema, name);
- xmlFree(name);
- if (type == NULL)
- return (NULL);
- type->node = node;
- type->type = XML_SCHEMA_TYPE_SIMPLE;
- type->id = xmlGetProp(node, BAD_CAST "id");
-
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- type->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- subtype = NULL;
- if (IS_SCHEMA(child, "restriction")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseRestriction(ctxt, schema, child, 1);
- child = child->next;
- } else if (IS_SCHEMA(child, "list")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseList(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "union")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseUnion(ctxt, schema, child);
- child = child->next;
- }
- type->subtypes = subtype;
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "SimpleType %s has unexpected content\n",
- type->name);
- }
-
- return (type);
-}
-
-
-/**
- * xmlSchemaParseGroup:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema Group definition
- * *WARNING* this interface is highly subject to change
- *
- * Returns -1 in case of error, 0 if the declaration is inproper and
- * 1 in case of success.
- */
-static xmlSchemaTypePtr
-xmlSchemaParseGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlSchemaTypePtr type, subtype;
- xmlNodePtr child = NULL;
- xmlChar *name, *ref = NULL, *refNs = NULL;
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
-
-
- name = xmlGetProp(node, (const xmlChar *) "name");
- if (name == NULL) {
- char buf[100];
-
- ref = xmlGetQNameProp(ctxt, node, "ref", &refNs);
- if (ref == NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "Group has no name nor ref\n");
- return (NULL);
- }
- snprintf(buf, 99, "anongroup%d", ctxt->counter++ + 1);
- name = xmlStrdup((xmlChar *) buf);
- }
- type = xmlSchemaAddType(ctxt, schema, name);
- if (type == NULL)
- return (NULL);
- type->node = node;
- type->type = XML_SCHEMA_TYPE_GROUP;
- type->id = xmlGetProp(node, BAD_CAST "id");
- type->ref = ref;
- type->refNs = refNs;
- type->minOccurs = xmlGetMinOccurs(ctxt, node);
- type->maxOccurs = xmlGetMaxOccurs(ctxt, node);
-
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- type->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- subtype = NULL;
- if (IS_SCHEMA(child, "all")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseAll(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "choice")) {
- subtype = xmlSchemaParseChoice(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "sequence")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseSequence(ctxt, schema, child);
- child = child->next;
- }
- if (subtype != NULL)
- type->subtypes = subtype;
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Group %s has unexpected content\n",
- type->name);
- }
-
- return (type);
-}
-
-/**
- * xmlSchemaParseAll:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema All definition
- * *WARNING* this interface is highly subject to change
- *
- * Returns -1 in case of error, 0 if the declaration is inproper and
- * 1 in case of success.
- */
-static xmlSchemaTypePtr
-xmlSchemaParseAll(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlSchemaTypePtr type, subtype, last = NULL;
- xmlNodePtr child = NULL;
- xmlChar name[30];
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
-
-
- snprintf((char *)name, 30, "all%d", ctxt->counter++ + 1);
- type = xmlSchemaAddType(ctxt, schema, name);
- if (type == NULL)
- return (NULL);
- type->node = node;
- type->type = XML_SCHEMA_TYPE_ALL;
- type->id = xmlGetProp(node, BAD_CAST "id");
- type->minOccurs = xmlGetMinOccurs(ctxt, node);
- type->maxOccurs = xmlGetMaxOccurs(ctxt, node);
-
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- type->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- while (IS_SCHEMA(child, "element")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseElement(ctxt, schema, child, 0);
- if (subtype != NULL) {
- if (last == NULL) {
- type->subtypes = subtype;
- last = subtype;
- } else {
- last->next = subtype;
- last = subtype;
- }
- last->next = NULL;
- }
- child = child->next;
- }
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "All %s has unexpected content\n",
- type->name);
- }
-
- return (type);
-}
-
-/**
- * xmlSchemaParseImport:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema Import definition
- * *WARNING* this interface is highly subject to change
- *
- * Returns -1 in case of error, 0 if the declaration is inproper and
- * 1 in case of success.
- */
-static int
-xmlSchemaParseImport(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlNodePtr child = NULL;
- xmlChar *namespace;
- xmlChar *schemaLocation;
- xmlChar *previous;
- xmlURIPtr check;
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (-1);
-
- namespace = xmlGetProp(node, BAD_CAST "namespace");
- if (namespace != NULL) {
- check = xmlParseURI((const char *) namespace);
- if (check == NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Import namespace attribute is not an URI: %s\n",
- namespace);
- xmlFree(namespace);
- return(-1);
- } else {
- xmlFreeURI(check);
- }
- }
- schemaLocation = xmlGetProp(node, BAD_CAST "schemaLocation");
- if (schemaLocation != NULL) {
- check = xmlParseURI((const char *) schemaLocation);
- if (check == NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Import schemaLocation attribute is not an URI: %s\n",
- schemaLocation);
- if (namespace != NULL)
- xmlFree(namespace);
- xmlFree(schemaLocation);
- return(-1);
- } else {
- xmlFreeURI(check);
- }
- }
- if (schema->schemasImports == NULL) {
- schema->schemasImports = xmlHashCreate(10);
- if (schema->schemasImports == NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Internal: failed to build import table\n");
- if (namespace != NULL)
- xmlFree(namespace);
- if (schemaLocation != NULL)
- xmlFree(schemaLocation);
- return(-1);
- }
- }
- if (namespace == NULL) {
- previous = xmlHashLookup(schema->schemasImports,
- XML_SCHEMAS_DEFAULT_NAMESPACE);
- if (schemaLocation != NULL) {
- if (previous != NULL) {
- if (!xmlStrEqual(schemaLocation, previous)) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Redefining import for default namespace with a different URI: %s\n",
- schemaLocation);
- }
- } else {
- xmlHashAddEntry(schema->schemasImports,
- XML_SCHEMAS_DEFAULT_NAMESPACE, schemaLocation);
- }
- }
- } else {
- previous = xmlHashLookup(schema->schemasImports, namespace);
- if (schemaLocation != NULL) {
- if (previous != NULL) {
- if (!xmlStrEqual(schemaLocation, previous)) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Redefining import for namespace %s with a different URI: %s\n",
- namespace, schemaLocation);
- }
- } else {
- xmlHashAddEntry(schema->schemasImports,
- namespace, schemaLocation);
- }
- }
- }
-
- child = node->children;
- while (IS_SCHEMA(child, "annotation")) {
- /*
- * the annotations here are simply discarded ...
- */
- child = child->next;
- }
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Import has unexpected content\n");
- return(-1);
- }
- return(1);
-}
-
-/**
- * xmlSchemaParseChoice:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema Choice definition
- * *WARNING* this interface is highly subject to change
- *
- * Returns -1 in case of error, 0 if the declaration is inproper and
- * 1 in case of success.
- */
-static xmlSchemaTypePtr
-xmlSchemaParseChoice(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlSchemaTypePtr type, subtype, last = NULL;
- xmlNodePtr child = NULL;
- xmlChar name[30];
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
-
-
- snprintf((char *)name, 30, "choice %d", ctxt->counter++ + 1);
- type = xmlSchemaAddType(ctxt, schema, name);
- if (type == NULL)
- return (NULL);
- type->node = node;
- type->type = XML_SCHEMA_TYPE_CHOICE;
- type->id = xmlGetProp(node, BAD_CAST "id");
- type->minOccurs = xmlGetMinOccurs(ctxt, node);
- type->maxOccurs = xmlGetMaxOccurs(ctxt, node);
-
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- type->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- while ((IS_SCHEMA(child, "element")) ||
- (IS_SCHEMA(child, "group")) ||
- (IS_SCHEMA(child, "any")) ||
- (IS_SCHEMA(child, "choice")) ||
- (IS_SCHEMA(child, "sequence"))) {
- subtype = NULL;
- if (IS_SCHEMA(child, "element")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseElement(ctxt, schema, child, 0);
- } else if (IS_SCHEMA(child, "group")) {
- subtype = xmlSchemaParseGroup(ctxt, schema, child);
- } else if (IS_SCHEMA(child, "any")) {
- subtype = xmlSchemaParseAny(ctxt, schema, child);
- } else if (IS_SCHEMA(child, "sequence")) {
- subtype = xmlSchemaParseSequence(ctxt, schema, child);
- } else if (IS_SCHEMA(child, "choice")) {
- subtype = xmlSchemaParseChoice(ctxt, schema, child);
- }
- if (subtype != NULL) {
- if (last == NULL) {
- type->subtypes = subtype;
- last = subtype;
- } else {
- last->next = subtype;
- last = subtype;
- }
- last->next = NULL;
- }
- child = child->next;
- }
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Choice %s has unexpected content\n",
- type->name);
- }
-
- return (type);
-}
-
-/**
- * xmlSchemaParseSequence:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema Sequence definition
- * *WARNING* this interface is highly subject to change
- *
- * Returns -1 in case of error, 0 if the declaration is inproper and
- * 1 in case of success.
- */
-static xmlSchemaTypePtr
-xmlSchemaParseSequence(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlSchemaTypePtr type, subtype, last = NULL;
- xmlNodePtr child = NULL;
- xmlChar name[30];
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
-
-
- snprintf((char *)name, 30, "sequence %d", ctxt->counter++ + 1);
- type = xmlSchemaAddType(ctxt, schema, name);
- if (type == NULL)
- return (NULL);
- type->node = node;
- type->type = XML_SCHEMA_TYPE_SEQUENCE;
- type->id = xmlGetProp(node, BAD_CAST "id");
- type->minOccurs = xmlGetMinOccurs(ctxt, node);
- type->maxOccurs = xmlGetMaxOccurs(ctxt, node);
-
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- type->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- while ((IS_SCHEMA(child, "element")) ||
- (IS_SCHEMA(child, "group")) ||
- (IS_SCHEMA(child, "any")) ||
- (IS_SCHEMA(child, "choice")) ||
- (IS_SCHEMA(child, "sequence"))) {
- subtype = NULL;
- if (IS_SCHEMA(child, "element")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseElement(ctxt, schema, child, 0);
- } else if (IS_SCHEMA(child, "group")) {
- subtype = xmlSchemaParseGroup(ctxt, schema, child);
- } else if (IS_SCHEMA(child, "any")) {
- subtype = xmlSchemaParseAny(ctxt, schema, child);
- } else if (IS_SCHEMA(child, "choice")) {
- subtype = xmlSchemaParseChoice(ctxt, schema, child);
- } else if (IS_SCHEMA(child, "sequence")) {
- subtype = xmlSchemaParseSequence(ctxt, schema, child);
- }
- if (subtype != NULL) {
- if (last == NULL) {
- type->subtypes = subtype;
- last = subtype;
- } else {
- last->next = subtype;
- last = subtype;
- }
- last->next = NULL;
- }
- child = child->next;
- }
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Sequence %s has unexpected content\n",
- type->name);
- }
-
- return (type);
-}
-
-/**
- * xmlSchemaParseRestriction:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- * @simple: is that part of a simple type.
- *
- * parse a XML schema Restriction definition
- * *WARNING* this interface is highly subject to change
- *
- * Returns the type definition or NULL in case of error
- */
-static xmlSchemaTypePtr
-xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node, int simple)
-{
- xmlSchemaTypePtr type, subtype;
- xmlSchemaFacetPtr facet, lastfacet = NULL;
- xmlNodePtr child = NULL;
- xmlChar name[30];
- xmlChar *oldcontainer;
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
-
- oldcontainer = ctxt->container;
-
- snprintf((char *)name, 30, "restriction %d", ctxt->counter++ + 1);
- type = xmlSchemaAddType(ctxt, schema, name);
- if (type == NULL)
- return (NULL);
- type->node = node;
- type->type = XML_SCHEMA_TYPE_RESTRICTION;
- type->id = xmlGetProp(node, BAD_CAST "id");
- type->base = xmlGetQNameProp(ctxt, node, "base", &(type->baseNs));
- if ((!simple) && (type->base == NULL)) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Restriction %s has no base\n",
- type->name);
- }
- ctxt->container = name;
-
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- type->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- subtype = NULL;
-
- if (IS_SCHEMA(child, "all")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseAll(ctxt, schema, child);
- child = child->next;
- type->subtypes = subtype;
- } else if (IS_SCHEMA(child, "choice")) {
- subtype = xmlSchemaParseChoice(ctxt, schema, child);
- child = child->next;
- type->subtypes = subtype;
- } else if (IS_SCHEMA(child, "sequence")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseSequence(ctxt, schema, child);
- child = child->next;
- type->subtypes = subtype;
- } else if (IS_SCHEMA(child, "group")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseGroup(ctxt, schema, child);
- child = child->next;
- type->subtypes = subtype;
- } else {
- if (IS_SCHEMA(child, "simpleType")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseSimpleType(ctxt, schema, child);
- child = child->next;
- type->baseType = subtype;
- }
- /*
- * Facets
- */
- while ((IS_SCHEMA(child, "minInclusive")) ||
- (IS_SCHEMA(child, "minExclusive")) ||
- (IS_SCHEMA(child, "maxInclusive")) ||
- (IS_SCHEMA(child, "maxExclusive")) ||
- (IS_SCHEMA(child, "totalDigits")) ||
- (IS_SCHEMA(child, "fractionDigits")) ||
- (IS_SCHEMA(child, "pattern")) ||
- (IS_SCHEMA(child, "enumeration")) ||
- (IS_SCHEMA(child, "whiteSpace")) ||
- (IS_SCHEMA(child, "length")) ||
- (IS_SCHEMA(child, "maxLength")) ||
- (IS_SCHEMA(child, "minLength"))) {
- facet = xmlSchemaParseFacet(ctxt, schema, child);
- if (facet != NULL) {
- if (lastfacet == NULL) {
- type->facets = facet;
- lastfacet = facet;
- } else {
- lastfacet->next = facet;
- lastfacet = facet;
- }
- lastfacet->next = NULL;
- }
- child = child->next;
- }
- }
- child = xmlSchemaParseAttrDecls(ctxt, schema, child, type);
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Restriction %s has unexpected content\n",
- type->name);
- }
- ctxt->container = oldcontainer;
- return (type);
-}
-
-/**
- * xmlSchemaParseExtension:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema Extension definition
- * *WARNING* this interface is highly subject to change
- *
- * Returns the type definition or NULL in case of error
- */
-static xmlSchemaTypePtr
-xmlSchemaParseExtension(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlSchemaTypePtr type, subtype;
- xmlNodePtr child = NULL;
- xmlChar name[30];
- xmlChar *oldcontainer;
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
-
- oldcontainer = ctxt->container;
-
- snprintf((char *)name, 30, "extension %d", ctxt->counter++ + 1);
- type = xmlSchemaAddType(ctxt, schema, name);
- if (type == NULL)
- return (NULL);
- type->node = node;
- type->type = XML_SCHEMA_TYPE_EXTENSION;
- type->id = xmlGetProp(node, BAD_CAST "id");
- ctxt->container = name;
-
- type->base = xmlGetQNameProp(ctxt, node, "base", &(type->baseNs));
- if (type->base == NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Extension %s has no base\n",
- type->name);
- }
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- type->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- subtype = NULL;
-
- if (IS_SCHEMA(child, "all")) {
- subtype = xmlSchemaParseAll(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "choice")) {
- subtype = xmlSchemaParseChoice(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "sequence")) {
- subtype = xmlSchemaParseSequence(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "group")) {
- subtype = xmlSchemaParseGroup(ctxt, schema, child);
- child = child->next;
- }
- if (subtype != NULL)
- type->subtypes = subtype;
- child = xmlSchemaParseAttrDecls(ctxt, schema, child, type);
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Extension %s has unexpected content\n",
- type->name);
- }
- ctxt->container = oldcontainer;
- return (type);
-}
-
-/**
- * xmlSchemaParseSimpleContent:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema SimpleContent definition
- * *WARNING* this interface is highly subject to change
- *
- * Returns the type definition or NULL in case of error
- */
-static xmlSchemaTypePtr
-xmlSchemaParseSimpleContent(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlSchemaTypePtr type, subtype;
- xmlNodePtr child = NULL;
- xmlChar name[30];
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
-
-
- snprintf((char *)name, 30, "complexContent %d", ctxt->counter++ + 1);
- type = xmlSchemaAddType(ctxt, schema, name);
- if (type == NULL)
- return (NULL);
- type->node = node;
- type->type = XML_SCHEMA_TYPE_SIMPLE_CONTENT;
- type->id = xmlGetProp(node, BAD_CAST "id");
-
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- type->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- subtype = NULL;
- if (IS_SCHEMA(child, "restriction")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseRestriction(ctxt, schema, child, 0);
- child = child->next;
- } else if (IS_SCHEMA(child, "extension")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseExtension(ctxt, schema, child);
- child = child->next;
- }
- type->subtypes = subtype;
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "SimpleContent %s has unexpected content\n",
- type->name);
- }
- return (type);
-}
-
-/**
- * xmlSchemaParseComplexContent:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema ComplexContent definition
- * *WARNING* this interface is highly subject to change
- *
- * Returns the type definition or NULL in case of error
- */
-static xmlSchemaTypePtr
-xmlSchemaParseComplexContent(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlSchemaTypePtr type, subtype;
- xmlNodePtr child = NULL;
- xmlChar name[30];
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
-
-
- snprintf((char *)name, 30, "complexContent %d", ctxt->counter++ + 1);
- type = xmlSchemaAddType(ctxt, schema, name);
- if (type == NULL)
- return (NULL);
- type->node = node;
- type->type = XML_SCHEMA_TYPE_COMPLEX_CONTENT;
- type->id = xmlGetProp(node, BAD_CAST "id");
-
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- type->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- subtype = NULL;
- if (IS_SCHEMA(child, "restriction")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseRestriction(ctxt, schema, child, 0);
- child = child->next;
- } else if (IS_SCHEMA(child, "extension")) {
- subtype = (xmlSchemaTypePtr)
- xmlSchemaParseExtension(ctxt, schema, child);
- child = child->next;
- }
- type->subtypes = subtype;
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "ComplexContent %s has unexpected content\n",
- type->name);
- }
- return (type);
-}
-
-/**
- * xmlSchemaParseComplexType:
- * @ctxt: a schema validation context
- * @schema: the schema being built
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema Complex Type definition
- * *WARNING* this interface is highly subject to change
- *
- * Returns the type definition or NULL in case of error
- */
-static xmlSchemaTypePtr
-xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
- xmlNodePtr node)
-{
- xmlSchemaTypePtr type, subtype;
- xmlNodePtr child = NULL;
- xmlChar *name;
- xmlChar *oldcontainer;
-
- if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
- return (NULL);
-
- oldcontainer = ctxt->container;
- name = xmlGetProp(node, (const xmlChar *) "name");
- if (name == NULL) {
- char buf[100];
-
- snprintf(buf, 99, "anontype%d", ctxt->counter++ + 1);
- name = xmlStrdup((xmlChar *) buf);
- }
- if (name == NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData, "complexType has no name\n");
- return (NULL);
- }
- type = xmlSchemaAddType(ctxt, schema, name);
- if (type == NULL) {
- xmlFree(name);
- return (NULL);
- }
- type->node = node;
- type->type = XML_SCHEMA_TYPE_COMPLEX;
- type->id = xmlGetProp(node, BAD_CAST "id");
- ctxt->container = name;
-
- child = node->children;
- if (IS_SCHEMA(child, "annotation")) {
- type->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- child = child->next;
- }
- if (IS_SCHEMA(child, "simpleContent")) {
- type->subtypes = xmlSchemaParseSimpleContent(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "complexContent")) {
- type->subtypes = xmlSchemaParseComplexContent(ctxt, schema, child);
- child = child->next;
- } else {
- subtype = NULL;
-
- if (IS_SCHEMA(child, "all")) {
- subtype = xmlSchemaParseAll(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "choice")) {
- subtype = xmlSchemaParseChoice(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "sequence")) {
- subtype = xmlSchemaParseSequence(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "group")) {
- subtype = xmlSchemaParseGroup(ctxt, schema, child);
- child = child->next;
- }
- if (subtype != NULL)
- type->subtypes = subtype;
- child = xmlSchemaParseAttrDecls(ctxt, schema, child, type);
- }
- if (child != NULL) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "ComplexType %s has unexpected content\n",
- type->name);
- }
- ctxt->container = oldcontainer;
- xmlFree(name);
- return (type);
-}
-
-
-/**
- * xmlSchemaParseSchema:
- * @ctxt: a schema validation context
- * @node: a subtree containing XML Schema informations
- *
- * parse a XML schema definition from a node set
- * *WARNING* this interface is highly subject to change
- *
- * Returns the internal XML Schema structure built from the resource or
- * NULL in case of error
- */
-static xmlSchemaPtr
-xmlSchemaParseSchema(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node)
-{
- xmlSchemaPtr schema = NULL;
- xmlSchemaAnnotPtr annot;
- xmlNodePtr child = NULL;
- xmlChar *val;
-
- if ((ctxt == NULL) || (node == NULL))
- return (NULL);
-
- if (IS_SCHEMA(node, "schema")) {
- schema = xmlSchemaNewSchema(ctxt);
- if (schema == NULL)
- return(NULL);
- schema->targetNamespace = xmlGetProp(node, BAD_CAST "targetNamespace");
- schema->id = xmlGetProp(node, BAD_CAST "id");
- schema->version = xmlGetProp(node, BAD_CAST "version");
- val = xmlGetProp(node, BAD_CAST "elementFormDefault");
- if (val != NULL) {
- if (xmlStrEqual(val, BAD_CAST "qualified"))
- schema->flags |= XML_SCHEMAS_QUALIF_ELEM;
- else if (!xmlStrEqual(val, BAD_CAST "unqualified")) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL)) {
- ctxt->error(ctxt->userData,
- "Invalid value %s for elementFormDefault\n",
- val);
- }
- }
- xmlFree(val);
- }
- val = xmlGetProp(node, BAD_CAST "attributeFormDefault");
- if (val != NULL) {
- if (xmlStrEqual(val, BAD_CAST "qualified"))
- schema->flags |= XML_SCHEMAS_QUALIF_ATTR;
- else if (!xmlStrEqual(val, BAD_CAST "unqualified")) {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL)) {
- ctxt->error(ctxt->userData,
- "Invalid value %s for elementFormDefault\n",
- val);
- }
- }
- xmlFree(val);
- }
-
- child = node->children;
- while ((IS_SCHEMA(child, "include")) ||
- (IS_SCHEMA(child, "import")) ||
- (IS_SCHEMA(child, "redefine")) ||
- (IS_SCHEMA(child, "annotation"))) {
- if (IS_SCHEMA(child, "annotation")) {
- annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- if (schema->annot == NULL)
- schema->annot = annot;
- else
- xmlSchemaFreeAnnot(annot);
- } else if (IS_SCHEMA(child, "include")) {
- TODO
- } else if (IS_SCHEMA(child, "import")) {
- xmlSchemaParseImport(ctxt, schema, child);
- } else if (IS_SCHEMA(child, "redefine")) {
- TODO
- }
- child = child->next;
- }
- while (child != NULL) {
- if (IS_SCHEMA(child, "complexType")) {
- xmlSchemaParseComplexType(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "simpleType")) {
- xmlSchemaParseSimpleType(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "element")) {
- xmlSchemaParseElement(ctxt, schema, child, 1);
- child = child->next;
- } else if (IS_SCHEMA(child, "attribute")) {
- xmlSchemaParseAttribute(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "attributeGroup")) {
- xmlSchemaParseAttributeGroup(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "group")) {
- xmlSchemaParseGroup(ctxt, schema, child);
- child = child->next;
- } else if (IS_SCHEMA(child, "notation")) {
- xmlSchemaParseNotation(ctxt, schema, child);
- child = child->next;
- } else {
- xmlSchemaErrorContext(ctxt, schema, node, child);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Schemas: unexpected element %s here \n",
- child->name);
- child = child->next;
- }
- while (IS_SCHEMA(child, "annotation")) {
- annot = xmlSchemaParseAnnotation(ctxt, schema, child);
- if (schema->annot == NULL)
- schema->annot = annot;
- else
- xmlSchemaFreeAnnot(annot);
- child = child->next;
- }
- }
- }
-#ifdef DEBUG
- if (schema == NULL)
- xmlGenericError(xmlGenericErrorContext,
- "xmlSchemaParse() failed\n");
-#endif
-
- return (schema);
-}
-
-/************************************************************************
- * *
- * Validating using Schemas *
- * *
- ************************************************************************/
-
-/************************************************************************
- * *
- * Reading/Writing Schemas *
- * *
- ************************************************************************/
-
-/**
- * xmlSchemaNewParserCtxt:
- * @URL: the location of the schema
- *
- * Create an XML Schemas parse context for that file/resource expected
- * to contain an XML Schemas file.
- *
- * Returns the parser context or NULL in case of error
- */
-xmlSchemaParserCtxtPtr
-xmlSchemaNewParserCtxt(const char *URL) {
- xmlSchemaParserCtxtPtr ret;
-
- if (URL == NULL)
- return(NULL);
-
- ret = (xmlSchemaParserCtxtPtr) xmlMalloc(sizeof(xmlSchemaParserCtxt));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Failed to allocate new schama parser context for %s\n", URL);
- return (NULL);
- }
- memset(ret, 0, sizeof(xmlSchemaParserCtxt));
- ret->URL = xmlStrdup((const xmlChar *)URL);
- return (ret);
-}
-
-/**
- * xmlSchemaNewMemParserCtxt:
- * @buffer: a pointer to a char array containing the schemas
- * @size: the size of the array
- *
- * Create an XML Schemas parse context for that memory buffer expected
- * to contain an XML Schemas file.
- *
- * Returns the parser context or NULL in case of error
- */
-xmlSchemaParserCtxtPtr
-xmlSchemaNewMemParserCtxt(const char *buffer, int size) {
- xmlSchemaParserCtxtPtr ret;
-
- if ((buffer == NULL) || (size <= 0))
- return(NULL);
-
- ret = (xmlSchemaParserCtxtPtr) xmlMalloc(sizeof(xmlSchemaParserCtxt));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Failed to allocate new schama parser context\n");
- return (NULL);
- }
- memset(ret, 0, sizeof(xmlSchemaParserCtxt));
- ret->buffer = buffer;
- ret->size = size;
- return (ret);
-}
-
-/**
- * xmlSchemaFreeParserCtxt:
- * @ctxt: the schema parser context
- *
- * Free the resources associated to the schema parser context
- */
-void
-xmlSchemaFreeParserCtxt(xmlSchemaParserCtxtPtr ctxt) {
- if (ctxt == NULL)
- return;
- if (ctxt->URL != NULL)
- xmlFree(ctxt->URL);
- if (ctxt->doc != NULL)
- xmlFreeDoc(ctxt->doc);
- xmlFree(ctxt);
-}
-
-/************************************************************************
- * *
- * Building the content models *
- * *
- ************************************************************************/
-/**
- * xmlSchemaBuildAContentModel:
- * @type: the schema type definition
- * @ctxt: the schema parser context
- * @name: the element name whose content is being built
- *
- * Generate the automata sequence needed for that type
- */
-static void
-xmlSchemaBuildAContentModel(xmlSchemaTypePtr type,
- xmlSchemaParserCtxtPtr ctxt,
- const xmlChar *name) {
- if (type == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Found unexpected type = NULL in %s content model\n",
- name);
- return;
- }
- switch (type->type) {
- case XML_SCHEMA_TYPE_ANY:
- /* TODO : handle the namespace too */
- /* TODO : make that a specific transition type */
- TODO
- ctxt->state = xmlAutomataNewTransition(ctxt->am, ctxt->state,
- NULL, BAD_CAST "*", NULL);
- break;
- case XML_SCHEMA_TYPE_ELEMENT: {
- xmlSchemaElementPtr elem = (xmlSchemaElementPtr) type;
- /* TODO : handle the namespace too */
- xmlAutomataStatePtr oldstate = ctxt->state;
- if (elem->maxOccurs >= UNBOUNDED) {
- if (elem->minOccurs > 1) {
- xmlAutomataStatePtr tmp;
- int counter;
-
- ctxt->state = xmlAutomataNewEpsilon(ctxt->am,
- oldstate, NULL);
- oldstate = ctxt->state;
-
- counter = xmlAutomataNewCounter(ctxt->am,
- elem->minOccurs - 1, UNBOUNDED);
-
- if (elem->refDecl != NULL) {
- xmlSchemaBuildAContentModel(
- (xmlSchemaTypePtr) elem->refDecl,
- ctxt, elem->refDecl->name);
- } else {
- ctxt->state = xmlAutomataNewTransition(ctxt->am,
- ctxt->state, NULL, elem->name, type);
- }
- tmp = ctxt->state;
- xmlAutomataNewCountedTrans(ctxt->am, tmp, oldstate,
- counter);
- ctxt->state = xmlAutomataNewCounterTrans(ctxt->am, tmp,
- NULL, counter);
-
- } else {
- if (elem->refDecl != NULL) {
- xmlSchemaBuildAContentModel(
- (xmlSchemaTypePtr) elem->refDecl,
- ctxt, elem->refDecl->name);
- } else {
- ctxt->state = xmlAutomataNewTransition(ctxt->am,
- ctxt->state, NULL, elem->name, type);
- }
- xmlAutomataNewEpsilon(ctxt->am, ctxt->state, oldstate);
- if (elem->minOccurs == 0) {
- /* basically an elem* */
- xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
- }
- }
- } else if ((elem->maxOccurs > 1) || (elem->minOccurs > 1)) {
- xmlAutomataStatePtr tmp;
- int counter;
-
- ctxt->state = xmlAutomataNewEpsilon(ctxt->am,
- oldstate, NULL);
- oldstate = ctxt->state;
-
- counter = xmlAutomataNewCounter(ctxt->am,
- elem->minOccurs - 1, elem->maxOccurs - 1);
-
- if (elem->refDecl != NULL) {
- xmlSchemaBuildAContentModel(
- (xmlSchemaTypePtr) elem->refDecl,
- ctxt, elem->refDecl->name);
- } else {
- ctxt->state = xmlAutomataNewTransition(ctxt->am,
- ctxt->state, NULL, elem->name, type);
- }
- tmp = ctxt->state;
- xmlAutomataNewCountedTrans(ctxt->am, tmp, oldstate,
- counter);
- ctxt->state = xmlAutomataNewCounterTrans(ctxt->am, tmp,
- NULL, counter);
- if (elem->minOccurs == 0) {
- /* basically an elem? */
- xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
- }
-
- } else {
- if (elem->refDecl != NULL) {
- xmlSchemaBuildAContentModel(
- (xmlSchemaTypePtr) elem->refDecl,
- ctxt, elem->refDecl->name);
- } else {
- ctxt->state = xmlAutomataNewTransition(ctxt->am,
- ctxt->state, NULL, elem->name, type);
- }
- if (elem->minOccurs == 0) {
- /* basically an elem? */
- xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
- }
- }
- break;
- }
- case XML_SCHEMA_TYPE_SEQUENCE: {
- xmlSchemaTypePtr subtypes;
-
- /*
- * If max and min occurances are default (1) then
- * simply iterate over the subtypes
- */
- if ((type->minOccurs == 1 ) && (type->maxOccurs == 1)) {
- subtypes = type->subtypes;
- while (subtypes != NULL) {
- xmlSchemaBuildAContentModel(subtypes, ctxt, name);
- subtypes = subtypes->next;
- }
- } else {
- xmlAutomataStatePtr oldstate = ctxt->state;
- if (type->maxOccurs >= UNBOUNDED) {
- if (type->minOccurs > 1) {
- xmlAutomataStatePtr tmp;
- int counter;
-
- ctxt->state = xmlAutomataNewEpsilon(ctxt->am,
- oldstate, NULL);
- oldstate = ctxt->state;
-
- counter = xmlAutomataNewCounter(ctxt->am,
- type->minOccurs - 1, UNBOUNDED);
-
- subtypes = type->subtypes;
- while (subtypes != NULL) {
- xmlSchemaBuildAContentModel(subtypes, ctxt, name);
- subtypes = subtypes->next;
- }
- tmp = ctxt->state;
- xmlAutomataNewCountedTrans(ctxt->am, tmp, oldstate,
- counter);
- ctxt->state = xmlAutomataNewCounterTrans(ctxt->am, tmp,
- NULL, counter);
-
- } else {
- subtypes = type->subtypes;
- while (subtypes != NULL) {
- xmlSchemaBuildAContentModel(subtypes, ctxt, name);
- subtypes = subtypes->next;
- }
- xmlAutomataNewEpsilon(ctxt->am, ctxt->state, oldstate);
- if (type->minOccurs == 0) {
- xmlAutomataNewEpsilon(ctxt->am, oldstate,
- ctxt->state);
- }
- }
- } else if ((type->maxOccurs > 1) || (type->minOccurs > 1)) {
- xmlAutomataStatePtr tmp;
- int counter;
-
- ctxt->state = xmlAutomataNewEpsilon(ctxt->am,
- oldstate, NULL);
- oldstate = ctxt->state;
-
- counter = xmlAutomataNewCounter(ctxt->am,
- type->minOccurs - 1, type->maxOccurs - 1);
-
- subtypes = type->subtypes;
- while (subtypes != NULL) {
- xmlSchemaBuildAContentModel(subtypes, ctxt, name);
- subtypes = subtypes->next;
- }
- tmp = ctxt->state;
- xmlAutomataNewCountedTrans(ctxt->am, tmp, oldstate,
- counter);
- ctxt->state = xmlAutomataNewCounterTrans(ctxt->am, tmp,
- NULL, counter);
- if (type->minOccurs == 0) {
- xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
- }
-
- } else {
- subtypes = type->subtypes;
- while (subtypes != NULL) {
- xmlSchemaBuildAContentModel(subtypes, ctxt, name);
- subtypes = subtypes->next;
- }
- if (type->minOccurs == 0) {
- xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
- }
- }
- }
- break;
- }
- case XML_SCHEMA_TYPE_CHOICE: {
- xmlSchemaTypePtr subtypes;
- xmlAutomataStatePtr start, end;
-
- start = ctxt->state;
- end = xmlAutomataNewState(ctxt->am);
-
- /*
- * iterate over the subtypes and remerge the end with an
- * epsilon transition
- */
- if (type->maxOccurs == 1) {
- subtypes = type->subtypes;
- while (subtypes != NULL) {
- ctxt->state = start;
- xmlSchemaBuildAContentModel(subtypes, ctxt, name);
- xmlAutomataNewEpsilon(ctxt->am, ctxt->state, end);
- subtypes = subtypes->next;
- }
- } else {
- int counter;
- xmlAutomataStatePtr hop;
- int maxOccurs = type->maxOccurs == UNBOUNDED ?
- UNBOUNDED : type->maxOccurs - 1;
- int minOccurs = type->minOccurs < 1 ? 0 : type->minOccurs - 1;
-
- /*
- * use a counter to keep track of the number of transtions
- * which went through the choice.
- */
- counter = xmlAutomataNewCounter(ctxt->am, minOccurs, maxOccurs);
- hop = xmlAutomataNewState(ctxt->am);
-
- subtypes = type->subtypes;
- while (subtypes != NULL) {
- ctxt->state = start;
- xmlSchemaBuildAContentModel(subtypes, ctxt, name);
- xmlAutomataNewEpsilon(ctxt->am, ctxt->state, hop);
- subtypes = subtypes->next;
- }
- xmlAutomataNewCountedTrans(ctxt->am, hop, start, counter);
- xmlAutomataNewCounterTrans(ctxt->am, hop, end, counter);
- }
- if (type->minOccurs == 0) {
- xmlAutomataNewEpsilon(ctxt->am, start, end);
- }
- ctxt->state = end;
- break;
- }
- case XML_SCHEMA_TYPE_ALL: {
- xmlAutomataStatePtr start;
- xmlSchemaTypePtr subtypes;
- xmlSchemaElementPtr elem = (xmlSchemaElementPtr) type;
- int lax;
-
- subtypes = type->subtypes;
- if (subtypes == NULL)
- break;
- start = ctxt->state;
- while (subtypes != NULL) {
- ctxt->state = start;
- elem = (xmlSchemaElementPtr) subtypes;
-
- /* TODO : handle the namespace too */
- xmlAutomataNewOnceTrans(ctxt->am, ctxt->state, ctxt->state,
- elem->name, elem->minOccurs, elem->maxOccurs,
- subtypes);
- subtypes = subtypes->next;
- }
- lax = type->minOccurs == 0;
- ctxt->state = xmlAutomataNewAllTrans(ctxt->am, ctxt->state, NULL,
- lax);
- break;
- }
- case XML_SCHEMA_TYPE_RESTRICTION:
- if (type->subtypes != NULL)
- xmlSchemaBuildAContentModel(type->subtypes, ctxt, name);
- break;
- case XML_SCHEMA_TYPE_EXTENSION:
- if (type->baseType != NULL) {
- xmlSchemaTypePtr subtypes;
-
- xmlSchemaBuildAContentModel(type->baseType, ctxt, name);
- subtypes = type->subtypes;
- while (subtypes != NULL) {
- xmlSchemaBuildAContentModel(subtypes, ctxt, name);
- subtypes = subtypes->next;
- }
- } else if (type->subtypes != NULL)
- xmlSchemaBuildAContentModel(type->subtypes, ctxt, name);
- break;
- case XML_SCHEMA_TYPE_GROUP:
- case XML_SCHEMA_TYPE_COMPLEX:
- case XML_SCHEMA_TYPE_COMPLEX_CONTENT:
- if (type->subtypes != NULL)
- xmlSchemaBuildAContentModel(type->subtypes, ctxt, name);
- break;
- default:
- xmlGenericError(xmlGenericErrorContext,
- "Found unexpected type %d in %s content model\n",
- type->type, name);
- return;
- }
-}
-/**
- * xmlSchemaBuildContentModel:
- * @typeDecl: the schema type definition
- * @ctxt: the schema parser context
- *
- * Fixes the content model of the element.
- */
-static void
-xmlSchemaBuildContentModel(xmlSchemaElementPtr elem,
- xmlSchemaParserCtxtPtr ctxt,
- const xmlChar *name) {
- xmlAutomataStatePtr start;
-
- if (elem->contModel != NULL)
- return;
- if (elem->subtypes == NULL) {
- elem->contentType = XML_SCHEMA_CONTENT_ANY;
- return;
- }
- if (elem->subtypes->type != XML_SCHEMA_TYPE_COMPLEX)
- return;
- if (elem->subtypes->contentType == XML_SCHEMA_CONTENT_BASIC)
- return;
-
-#ifdef DEBUG_CONTENT
- xmlGenericError(xmlGenericErrorContext,
- "Building content model for %s\n", name);
-#endif
-
- ctxt->am = xmlNewAutomata();
- if (ctxt->am == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Cannot create automata for elem %s\n", name);
- return;
- }
- start = ctxt->state = xmlAutomataGetInitState(ctxt->am);
- xmlSchemaBuildAContentModel(elem->subtypes, ctxt, name);
- xmlAutomataSetFinalState(ctxt->am, ctxt->state);
- elem->contModel = xmlAutomataCompile(ctxt->am);
- if (!xmlAutomataIsDeterminist(ctxt->am)) {
- xmlGenericError(xmlGenericErrorContext,
- "Content model of %s is not determinist:\n", name);
- ctxt->err = XML_SCHEMAS_ERR_NOTDETERMINIST;
- ctxt->state = NULL;
- } else {
-#ifdef DEBUG_CONTENT_REGEXP
- xmlGenericError(xmlGenericErrorContext,
- "Content model of %s:\n", name);
- xmlRegexpPrint(stderr, elem->contModel);
-#endif
- ctxt->state = NULL;
- }
- xmlFreeAutomata(ctxt->am);
- ctxt->am = NULL;
-}
-
-/**
- * xmlSchemaRefFixupCallback:
- * @elem: the schema element context
- * @ctxt: the schema parser context
- *
- * Free the resources associated to the schema parser context
- */
-static void
-xmlSchemaRefFixupCallback(xmlSchemaElementPtr elem,
- xmlSchemaParserCtxtPtr ctxt,
- const xmlChar *name,
- const xmlChar *context ATTRIBUTE_UNUSED,
- const xmlChar *namespace ATTRIBUTE_UNUSED)
-{
- if ((ctxt == NULL) || (elem == NULL))
- return;
- if (elem->ref != NULL) {
- xmlSchemaElementPtr elemDecl;
-
- if (elem->subtypes != NULL) {
- xmlSchemaErrorContext(ctxt, NULL, elem->node, NULL);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Schemas: element %s have both ref and subtype\n",
- name);
- return;
- }
- elemDecl = xmlHashLookup2(ctxt->schema->elemDecl,
- elem->ref, elem->refNs);
-
- if (elemDecl == NULL) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Schemas: element %s ref to %s not found\n",
- name, elem->ref);
- return;
- }
- elem->refDecl = elemDecl;
- } else if (elem->namedType != NULL) {
- xmlSchemaTypePtr typeDecl;
-
- if (elem->subtypes != NULL) {
- xmlSchemaErrorContext(ctxt, NULL, elem->node, NULL);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Schemas: element %s have both type and subtype\n",
- name);
- return;
- }
- typeDecl = xmlSchemaGetType(ctxt->schema, elem->namedType,
- elem->namedTypeNs);
-
- if (typeDecl == NULL) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Schemas: element %s type %s not found\n",
- name, elem->namedType);
- return;
- }
- elem->subtypes = typeDecl;
- }
-}
-
-/**
- * xmlSchemaTypeFixup:
- * @typeDecl: the schema type definition
- * @ctxt: the schema parser context
- *
- * Fixes the content model of the type.
- */
-static void
-xmlSchemaTypeFixup(xmlSchemaTypePtr typeDecl,
- xmlSchemaParserCtxtPtr ctxt,
- const xmlChar *name)
-{
- if (name == NULL)
- name = typeDecl->name;
- if (typeDecl->contentType == XML_SCHEMA_CONTENT_UNKNOWN) {
- switch (typeDecl->type) {
- case XML_SCHEMA_TYPE_SIMPLE_CONTENT: {
- xmlSchemaTypeFixup(typeDecl->subtypes, ctxt, NULL);
- typeDecl->contentType = typeDecl->subtypes->contentType;
- break;
- }
- case XML_SCHEMA_TYPE_RESTRICTION: {
- if (typeDecl->subtypes != NULL)
- xmlSchemaTypeFixup(typeDecl->subtypes, ctxt, NULL);
-
- if (typeDecl->base != NULL) {
- xmlSchemaTypePtr baseType;
-
- baseType = xmlSchemaGetType(ctxt->schema, typeDecl->base,
- typeDecl->baseNs);
- if (baseType == NULL) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Schemas: type %s base type %s not found\n",
- name, typeDecl->base);
- }
- typeDecl->baseType = baseType;
- }
- if (typeDecl->subtypes == NULL)
- /* 1.1.1 */
- typeDecl->contentType = XML_SCHEMA_CONTENT_EMPTY;
- else if ((typeDecl->subtypes->subtypes == NULL) &&
- ((typeDecl->subtypes->type == XML_SCHEMA_TYPE_ALL) ||
- (typeDecl->subtypes->type == XML_SCHEMA_TYPE_SEQUENCE)))
- /* 1.1.2 */
- typeDecl->contentType = XML_SCHEMA_CONTENT_EMPTY;
- else if ((typeDecl->subtypes->type == XML_SCHEMA_TYPE_CHOICE) &&
- (typeDecl->subtypes->subtypes == NULL))
- /* 1.1.3 */
- typeDecl->contentType = XML_SCHEMA_CONTENT_EMPTY;
- else {
- /* 1.2 and 2.X are applied at the other layer */
- typeDecl->contentType = XML_SCHEMA_CONTENT_ELEMENTS;
- }
- break;
- }
- case XML_SCHEMA_TYPE_EXTENSION: {
- xmlSchemaContentType explicitContentType;
- xmlSchemaTypePtr base;
-
- if (typeDecl->base != NULL) {
- xmlSchemaTypePtr baseType;
-
- baseType = xmlSchemaGetType(ctxt->schema, typeDecl->base,
- typeDecl->baseNs);
- if (baseType == NULL) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Schemas: type %s base type %s not found\n",
- name, typeDecl->base);
- }
- typeDecl->baseType = baseType;
- }
- if (typeDecl->subtypes != NULL)
- xmlSchemaTypeFixup(typeDecl->subtypes, ctxt, NULL);
-
- explicitContentType = XML_SCHEMA_CONTENT_ELEMENTS;
- if (typeDecl->subtypes == NULL)
- /* 1.1.1 */
- explicitContentType = XML_SCHEMA_CONTENT_EMPTY;
- else if ((typeDecl->subtypes->subtypes == NULL) &&
- ((typeDecl->subtypes->type == XML_SCHEMA_TYPE_ALL) ||
- (typeDecl->subtypes->type == XML_SCHEMA_TYPE_SEQUENCE)))
- /* 1.1.2 */
- explicitContentType = XML_SCHEMA_CONTENT_EMPTY;
- else if ((typeDecl->subtypes->type == XML_SCHEMA_TYPE_CHOICE) &&
- (typeDecl->subtypes->subtypes == NULL))
- /* 1.1.3 */
- explicitContentType = XML_SCHEMA_CONTENT_EMPTY;
-
- base = xmlSchemaGetType(ctxt->schema, typeDecl->base,
- typeDecl->baseNs);
- if (base == NULL) {
- xmlSchemaErrorContext(ctxt, NULL, typeDecl->node, NULL);
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Schemas: base type %s of type %s not found\n",
- typeDecl->base, name);
- return;
- }
- xmlSchemaTypeFixup(base, ctxt, NULL);
- if (explicitContentType == XML_SCHEMA_CONTENT_EMPTY) {
- /* 2.1 */
- typeDecl->contentType = base->contentType;
- } else if (base->contentType == XML_SCHEMA_CONTENT_EMPTY) {
- /* 2.2 imbitable ! */
- typeDecl->contentType = XML_SCHEMA_CONTENT_ELEMENTS;
- } else {
- /* 2.3 imbitable pareil ! */
- typeDecl->contentType = XML_SCHEMA_CONTENT_ELEMENTS;
- }
- break;
- }
- case XML_SCHEMA_TYPE_COMPLEX: {
- if (typeDecl->subtypes == NULL) {
- typeDecl->contentType = XML_SCHEMA_CONTENT_EMPTY;
- } else {
- if (typeDecl->flags & XML_SCHEMAS_TYPE_MIXED)
- typeDecl->contentType = XML_SCHEMA_CONTENT_MIXED;
- else {
- xmlSchemaTypeFixup(typeDecl->subtypes, ctxt, NULL);
- typeDecl->contentType = typeDecl->subtypes->contentType;
- }
- }
- break;
- }
- case XML_SCHEMA_TYPE_COMPLEX_CONTENT: {
- if (typeDecl->subtypes == NULL) {
- typeDecl->contentType = XML_SCHEMA_CONTENT_EMPTY;
- } else {
- if (typeDecl->flags & XML_SCHEMAS_TYPE_MIXED)
- typeDecl->contentType = XML_SCHEMA_CONTENT_MIXED;
- else {
- xmlSchemaTypeFixup(typeDecl->subtypes, ctxt, NULL);
- typeDecl->contentType = typeDecl->subtypes->contentType;
- }
- }
- break;
- }
- case XML_SCHEMA_TYPE_SEQUENCE:
- case XML_SCHEMA_TYPE_GROUP:
- case XML_SCHEMA_TYPE_ALL:
- case XML_SCHEMA_TYPE_CHOICE:
- typeDecl->contentType = XML_SCHEMA_CONTENT_ELEMENTS;
- break;
- case XML_SCHEMA_TYPE_BASIC:
- case XML_SCHEMA_TYPE_ANY:
- case XML_SCHEMA_TYPE_FACET:
- case XML_SCHEMA_TYPE_SIMPLE:
- case XML_SCHEMA_TYPE_UR:
- case XML_SCHEMA_TYPE_ELEMENT:
- case XML_SCHEMA_TYPE_ATTRIBUTE:
- case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
- case XML_SCHEMA_TYPE_NOTATION:
- case XML_SCHEMA_TYPE_LIST:
- case XML_SCHEMA_TYPE_UNION:
- case XML_SCHEMA_FACET_MININCLUSIVE:
- case XML_SCHEMA_FACET_MINEXCLUSIVE:
- case XML_SCHEMA_FACET_MAXINCLUSIVE:
- case XML_SCHEMA_FACET_MAXEXCLUSIVE:
- case XML_SCHEMA_FACET_TOTALDIGITS:
- case XML_SCHEMA_FACET_FRACTIONDIGITS:
- case XML_SCHEMA_FACET_PATTERN:
- case XML_SCHEMA_FACET_ENUMERATION:
- case XML_SCHEMA_FACET_WHITESPACE:
- case XML_SCHEMA_FACET_LENGTH:
- case XML_SCHEMA_FACET_MAXLENGTH:
- case XML_SCHEMA_FACET_MINLENGTH:
- typeDecl->contentType = XML_SCHEMA_CONTENT_SIMPLE;
- break;
- }
- }
-#ifdef DEBUG_TYPE
- if (typeDecl->node != NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Type of %s : %s:%d :", name, typeDecl->node->doc->URL,
- xmlGetLineNo(typeDecl->node));
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "Type of %s :", name);
- }
- switch (typeDecl->contentType) {
- case XML_SCHEMA_CONTENT_SIMPLE:
- xmlGenericError(xmlGenericErrorContext,
- "simple\n"); break;
- case XML_SCHEMA_CONTENT_ELEMENTS:
- xmlGenericError(xmlGenericErrorContext,
- "elements\n"); break;
- case XML_SCHEMA_CONTENT_UNKNOWN:
- xmlGenericError(xmlGenericErrorContext,
- "unknown !!!\n"); break;
- case XML_SCHEMA_CONTENT_EMPTY:
- xmlGenericError(xmlGenericErrorContext,
- "empty\n"); break;
- case XML_SCHEMA_CONTENT_MIXED:
- xmlGenericError(xmlGenericErrorContext,
- "mixed\n"); break;
- case XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS:
- xmlGenericError(xmlGenericErrorContext,
- "mixed or elems\n"); break;
- case XML_SCHEMA_CONTENT_BASIC:
- xmlGenericError(xmlGenericErrorContext,
- "basic\n"); break;
- default:
- xmlGenericError(xmlGenericErrorContext,
- "not registered !!!\n"); break;
- }
-#endif
-}
-
-/**
- * xmlSchemaCheckDefaults:
- * @typeDecl: the schema type definition
- * @ctxt: the schema parser context
- *
- * Checks the default values types, especially for facets
- */
-static void
-xmlSchemaCheckDefaults(xmlSchemaTypePtr typeDecl,
- xmlSchemaParserCtxtPtr ctxt,
- const xmlChar *name)
-{
- static xmlSchemaTypePtr nonNegativeIntegerType = NULL;
- if (name == NULL)
- name = typeDecl->name;
- if (nonNegativeIntegerType == NULL) {
- nonNegativeIntegerType = xmlSchemaGetPredefinedType(
- BAD_CAST "nonNegativeInteger", xmlSchemaNs);
- }
- if (typeDecl->type == XML_SCHEMA_TYPE_RESTRICTION) {
- if (typeDecl->facets != NULL) {
- xmlSchemaFacetPtr facet = typeDecl->facets;
- while (facet != NULL) {
- switch (facet->type) {
- case XML_SCHEMA_FACET_MININCLUSIVE:
- case XML_SCHEMA_FACET_MINEXCLUSIVE:
- case XML_SCHEMA_FACET_MAXINCLUSIVE:
- case XML_SCHEMA_FACET_MAXEXCLUSIVE: {
- /*
- * Okay we need to validate the value
- * at that point.
- */
- xmlSchemaValidCtxtPtr vctxt;
-
- vctxt = xmlSchemaNewValidCtxt(NULL);
- if (vctxt == NULL)
- break;
- xmlSchemaValidateSimpleValue(vctxt, typeDecl,
- facet->value);
- facet->val = vctxt->value;
- vctxt->value = NULL;
- if (facet->val == NULL) {
- /* error code */
- xmlSchemaErrorContext(ctxt, NULL,
- facet->node, NULL);
- ctxt->error(ctxt->userData,
- "Schemas: type %s facet value %s invalid\n",
- name, facet->value);
- }
- xmlSchemaFreeValidCtxt(vctxt);
- break;
- }
- case XML_SCHEMA_FACET_ENUMERATION: {
- /*
- * Okay we need to validate the value
- * at that point.
- */
- xmlSchemaValidCtxtPtr vctxt;
- int ret;
-
- vctxt = xmlSchemaNewValidCtxt(NULL);
- if (vctxt == NULL)
- break;
- ret = xmlSchemaValidateSimpleValue(vctxt, typeDecl,
- facet->value);
- if (ret != 0) {
- xmlSchemaErrorContext(ctxt, NULL,
- facet->node, NULL);
- ctxt->error(ctxt->userData,
- "Schemas: type %s enumeration value %s invalid\n",
- name, facet->value);
- }
- xmlSchemaFreeValidCtxt(vctxt);
- break;
- }
- case XML_SCHEMA_FACET_PATTERN:
- facet->regexp = xmlRegexpCompile(facet->value);
- if (facet->regexp == NULL) {
- /* error code */
- ctxt->error(ctxt->userData,
- "Schemas: type %s facet regexp %s invalid\n",
- name, facet->value);
- }
- break;
- case XML_SCHEMA_FACET_TOTALDIGITS:
- case XML_SCHEMA_FACET_FRACTIONDIGITS:
- case XML_SCHEMA_FACET_LENGTH:
- case XML_SCHEMA_FACET_MAXLENGTH:
- case XML_SCHEMA_FACET_MINLENGTH: {
- int ret;
-
- ret = xmlSchemaValidatePredefinedType(
- nonNegativeIntegerType, facet->value,
- &facet->val);
- if (ret != 0) {
- /* error code */
- xmlSchemaErrorContext(ctxt, NULL,
- facet->node, NULL);
- ctxt->error(ctxt->userData,
- "Schemas: type %s facet value %s invalid\n",
- name, facet->value);
- }
- break;
- }
- case XML_SCHEMA_FACET_WHITESPACE: {
- if (xmlStrEqual(facet->value, BAD_CAST"preserve")) {
- facet->whitespace = XML_SCHEMAS_FACET_PRESERVE;
- } else if (xmlStrEqual(facet->value,
- BAD_CAST"replace")) {
- facet->whitespace = XML_SCHEMAS_FACET_REPLACE;
- } else if (xmlStrEqual(facet->value,
- BAD_CAST"collapse")) {
- facet->whitespace = XML_SCHEMAS_FACET_COLLAPSE;
- } else {
- xmlSchemaErrorContext(ctxt, NULL,
- facet->node, NULL);
- ctxt->error(ctxt->userData,
- "Schemas: type %s whiteSpace value %s invalid\n",
- name, facet->value);
- }
- }
- default:
- break;
- }
- facet = facet->next;
- }
- }
- }
-}
-
-/**
- * xmlSchemaAttrGrpFixup:
- * @attrgrpDecl: the schema attribute definition
- * @ctxt: the schema parser context
- * @name: the attribute name
- *
- * Fixes finish doing the computations on the attributes definitions
- */
-static void
-xmlSchemaAttrGrpFixup(xmlSchemaAttributeGroupPtr attrgrpDecl,
- xmlSchemaParserCtxtPtr ctxt,
- const xmlChar *name)
-{
- if (name == NULL)
- name = attrgrpDecl->name;
- if (attrgrpDecl->attributes != NULL)
- return;
- if (attrgrpDecl->ref != NULL) {
- xmlSchemaAttributeGroupPtr ref;
-
- ref = xmlHashLookup2(ctxt->schema->attrgrpDecl, attrgrpDecl->ref,
- attrgrpDecl->refNs);
- if (ref == NULL) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Schemas: attribute group %s reference %s not found\n",
- name, attrgrpDecl->ref);
- return;
- }
- xmlSchemaAttrGrpFixup(ref, ctxt, NULL);
- attrgrpDecl->attributes = ref->attributes;
- } else {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Schemas: attribute %s has no attributes nor reference\n",
- name);
- }
-}
-
-/**
- * xmlSchemaAttrFixup:
- * @attrDecl: the schema attribute definition
- * @ctxt: the schema parser context
- * @name: the attribute name
- *
- * Fixes finish doing the computations on the attributes definitions
- */
-static void
-xmlSchemaAttrFixup(xmlSchemaAttributePtr attrDecl,
- xmlSchemaParserCtxtPtr ctxt,
- const xmlChar *name)
-{
- if (name == NULL)
- name = attrDecl->name;
- if (attrDecl->subtypes != NULL)
- return;
- if (attrDecl->typeName != NULL) {
- xmlSchemaTypePtr type;
-
- type = xmlSchemaGetType(ctxt->schema, attrDecl->typeName,
- attrDecl->typeNs);
- if (type == NULL) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Schemas: attribute %s type %s not found\n",
- name, attrDecl->typeName);
- }
- attrDecl->subtypes = type;
- } else if (attrDecl->ref != NULL) {
- xmlSchemaAttributePtr ref;
-
- ref = xmlHashLookup2(ctxt->schema->attrDecl, attrDecl->ref,
- attrDecl->refNs);
- if (ref == NULL) {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Schemas: attribute %s reference %s not found\n",
- name, attrDecl->ref);
- return;
- }
- xmlSchemaAttrFixup(ref, ctxt, NULL);
- attrDecl->subtypes = ref->subtypes;
- } else {
- if ((ctxt != NULL) && (ctxt->error != NULL))
- ctxt->error(ctxt->userData,
- "Schemas: attribute %s has no type nor reference\n",
- name);
- }
-}
-
-/**
- * xmlSchemaParse:
- * @ctxt: a schema validation context
- *
- * parse a schema definition resource and build an internal
- * XML Shema struture which can be used to validate instances.
- * *WARNING* this interface is highly subject to change
- *
- * Returns the internal XML Schema structure built from the resource or
- * NULL in case of error
- */
-xmlSchemaPtr
-xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt)
-{
- xmlSchemaPtr ret = NULL;
- xmlDocPtr doc;
- xmlNodePtr root, cur, delete;
-
- xmlSchemaInitTypes();
-
- if (ctxt == NULL)
- return (NULL);
-
- ctxt->counter = 0;
- ctxt->container = NULL;
-
- /*
- * First step is to parse the input document into an DOM/Infoset
- */
- if (ctxt->URL != NULL) {
- doc = xmlParseFile((const char *) ctxt->URL);
- if (doc == NULL) {
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "xmlSchemaParse: could not load %s\n", ctxt->URL);
- return (NULL);
- }
- } else if (ctxt->buffer != NULL) {
- doc = xmlParseMemory(ctxt->buffer, ctxt->size);
- if (doc == NULL) {
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "xmlSchemaParse: could not parse schemas\n");
- return (NULL);
- }
- doc->URL = xmlStrdup(BAD_CAST "in_memory_buffer");
- ctxt->URL = xmlStrdup(BAD_CAST "in_memory_buffer");
- } else {
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "xmlSchemaParse: nothing to parse\n");
- return (NULL);
- }
-
- /*
- * Then extract the root and Schema parse it
- */
- root = xmlDocGetRootElement(doc);
- if (root == NULL) {
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData, "xmlSchemaParse: %s is empty\n",
- ctxt->URL);
- return (NULL);
- }
-
- /*
- * Remove all the blank text nodes
- */
- delete = NULL;
- cur = root;
- while (cur != NULL) {
- if (delete != NULL) {
- xmlUnlinkNode(delete);
- xmlFreeNode(delete);
- delete = NULL;
- }
- if (cur->type == XML_TEXT_NODE) {
- if (IS_BLANK_NODE(cur)) {
- if (xmlNodeGetSpacePreserve(cur) != 1) {
- delete = cur;
- }
- }
- } else if ((cur->type != XML_ELEMENT_NODE) &&
- (cur->type != XML_CDATA_SECTION_NODE)) {
- delete = cur;
- goto skip_children;
- }
-
- /*
- * Skip to next node
- */
- if (cur->children != NULL) {
- if ((cur->children->type != XML_ENTITY_DECL) &&
- (cur->children->type != XML_ENTITY_REF_NODE) &&
- (cur->children->type != XML_ENTITY_NODE)) {
- cur = cur->children;
- continue;
- }
- }
-skip_children:
- if (cur->next != NULL) {
- cur = cur->next;
- continue;
- }
-
- do {
- cur = cur->parent;
- if (cur == NULL)
- break;
- if (cur == root) {
- cur = NULL;
- break;
- }
- if (cur->next != NULL) {
- cur = cur->next;
- break;
- }
- } while (cur != NULL);
- }
- if (delete != NULL) {
- xmlUnlinkNode(delete);
- xmlFreeNode(delete);
- delete = NULL;
- }
-
- /*
- * Then do the parsing for good
- */
- ret = xmlSchemaParseSchema(ctxt, root);
- if (ret == NULL)
- return(NULL);
- ret->doc = doc;
-
- /*
- * Then fix all the references.
- */
- ctxt->schema = ret;
- xmlHashScanFull(ret->elemDecl,
- (xmlHashScannerFull) xmlSchemaRefFixupCallback, ctxt);
-
- /*
- * Then fixup all types properties
- */
- xmlHashScan(ret->typeDecl, (xmlHashScanner) xmlSchemaTypeFixup, ctxt);
-
- /*
- * Then build the content model for all elements
- */
- xmlHashScan(ret->elemDecl,
- (xmlHashScanner) xmlSchemaBuildContentModel, ctxt);
-
- /*
- * Then check the defaults part of the type like facets values
- */
- xmlHashScan(ret->typeDecl, (xmlHashScanner) xmlSchemaCheckDefaults, ctxt);
-
- /*
- * Then fixup all attributes declarations
- */
- xmlHashScan(ret->attrDecl, (xmlHashScanner) xmlSchemaAttrFixup, ctxt);
-
- /*
- * Then fixup all attributes group declarations
- */
- xmlHashScan(ret->attrgrpDecl, (xmlHashScanner) xmlSchemaAttrGrpFixup, ctxt);
-
- return (ret);
-}
-
-/**
- * xmlSchemaSetParserErrors:
- * @ctxt: a schema validation context
- * @err: the error callback
- * @warn: the warning callback
- * @ctx: contextual data for the callbacks
- *
- * Set the callback functions used to handle errors for a validation context
- */
-void
-xmlSchemaSetParserErrors(xmlSchemaParserCtxtPtr ctxt,
- xmlSchemaValidityErrorFunc err,
- xmlSchemaValidityWarningFunc warn, void *ctx) {
- if (ctxt == NULL)
- return;
- ctxt->error = err;
- ctxt->warning = warn;
- ctxt->userData = ctx;
-}
-
-/************************************************************************
- * *
- * Simple type validation *
- * *
- ************************************************************************/
-
-/**
- * xmlSchemaValidateSimpleValue:
- * @ctxt: a schema validation context
- * @type: the type declaration
- * @value: the value to validate
- *
- * Validate a value against a simple type
- *
- * Returns 0 if the value is valid, a positive error code
- * number otherwise and -1 in case of internal or API error.
- */
-static int
-xmlSchemaValidateSimpleValue(xmlSchemaValidCtxtPtr ctxt,
- xmlSchemaTypePtr type,
- xmlChar *value) {
- int ret = 0;
- /*
- * First normalize the value accordingly to Schema Datatype
- * 4.3.6 whiteSpace definition of the whiteSpace facet of type
- */
- /*
- * Then check the normalized value against the lexical space of the
- * type.
- */
- if (type->type == XML_SCHEMA_TYPE_BASIC) {
- if (ctxt->value != NULL) {
- xmlSchemaFreeValue(ctxt->value);
- ctxt->value = NULL;
- }
- ret = xmlSchemaValidatePredefinedType(type, value, &(ctxt->value));
- } else if (type->type == XML_SCHEMA_TYPE_RESTRICTION) {
- xmlSchemaTypePtr base;
- xmlSchemaFacetPtr facet;
- int tmp;
-
- base = type->baseType;
- if (base != NULL) {
- ret = xmlSchemaValidateSimpleValue(ctxt, base, value);
- } else if (type->subtypes != NULL) {
-
- }
- /*
- * Do not validate facets when working on building the Schemas
- */
- if (ctxt->schema != NULL) {
- if (ret == 0) {
- facet = type->facets;
- if ((type->type == XML_SCHEMA_TYPE_RESTRICTION) &&
- (facet != NULL) &&
- (facet->type == XML_SCHEMA_FACET_ENUMERATION)) {
- while (facet != NULL) {
- ret = 1;
-
- tmp = xmlSchemaValidateFacet(base, facet, value,
- ctxt->value);
- if (tmp == 0) {
- ret = 0;
- break;
- }
- facet = facet->next;
- }
- } else {
- while (facet != NULL) {
- tmp = xmlSchemaValidateFacet(base, facet, value,
- ctxt->value);
- if (tmp != 0)
- ret = tmp;
- facet = facet->next;
- }
- }
- }
- }
- } else if (type->type == XML_SCHEMA_TYPE_SIMPLE) {
- xmlSchemaTypePtr base;
-
- base = type->subtypes;
- if (base != NULL) {
- ret = xmlSchemaValidateSimpleValue(ctxt, base, value);
- } else {
- TODO
- }
- } else if (type->type == XML_SCHEMA_TYPE_LIST) {
- xmlSchemaTypePtr base;
- xmlChar *cur, *end, tmp;
- int ret2;
-
- base = type->subtypes;
- if (base == NULL) {
- ctxt->err = XML_SCHEMAS_ERR_INTERNAL;
- if (ctxt->error != NULL) {
- xmlSchemaErrorContext(NULL, ctxt->schema, type->node, NULL);
- ctxt->error(ctxt->userData,
- "Internal: List type %s has no base type\n",
- type->name);
- }
- return(-1);
- }
- cur = value;
- do {
- while (IS_BLANK(*cur)) cur++;
- end = cur;
- while ((*end != 0) && (!(IS_BLANK(*end)))) end++;
- if (end == cur)
- break;
- tmp = *end;
- *end = 0;
- ret2 = xmlSchemaValidateSimpleValue(ctxt, base, cur);
- if (ret2 != 0)
- ret = 1;
- *end = tmp;
- cur = end;
- } while (*cur != 0);
- } else {
- TODO
- }
- return(ret);
-}
-
-/************************************************************************
- * *
- * DOM Validation code *
- * *
- ************************************************************************/
-
-static int xmlSchemaValidateContent(xmlSchemaValidCtxtPtr ctxt,
- xmlNodePtr node);
-static int xmlSchemaValidateAttributes(xmlSchemaValidCtxtPtr ctxt,
- xmlNodePtr elem, xmlSchemaAttributePtr attributes);
-static int xmlSchemaValidateType(xmlSchemaValidCtxtPtr ctxt,
- xmlNodePtr elem, xmlSchemaElementPtr elemDecl, xmlSchemaTypePtr type);
-
-/**
- * xmlSchemaRegisterAttributes:
- * @ctxt: a schema validation context
- * @attrs: a list of attributes
- *
- * Register the list of attributes as the set to be validated on that element
- *
- * Returns -1 in case of error, 0 otherwise
- */
-static int
-xmlSchemaRegisterAttributes(xmlSchemaValidCtxtPtr ctxt,
- xmlAttrPtr attrs) {
- while (attrs != NULL) {
- if ((attrs->ns != NULL) &&
- (xmlStrEqual(attrs->ns->href, xmlSchemaInstanceNs))) {
- attrs = attrs->next;
- continue;
- }
- if (ctxt->attrNr >= ctxt->attrMax) {
- xmlSchemaAttrStatePtr tmp;
-
- ctxt->attrMax *= 2;
- tmp = (xmlSchemaAttrStatePtr)
- xmlRealloc(ctxt->attr, ctxt->attrMax *
- sizeof(xmlSchemaAttrState));
- if (tmp == NULL) {
- ctxt->attrMax /= 2;
- return(-1);
- }
- ctxt->attr = tmp;
- }
- ctxt->attr[ctxt->attrNr].attr = attrs;
- ctxt->attr[ctxt->attrNr].state = XML_SCHEMAS_ATTR_UNKNOWN;
- ctxt->attrNr++;
- attrs = attrs->next;
- }
- return(0);
-}
-
-/**
- * xmlSchemaCheckAttributes:
- * @ctxt: a schema validation context
- * @node: the node carrying it.
- *
- * Check that the registered set of attributes on the current node
- * has been properly validated.
- *
- * Returns 0 if validity constraints are met, 1 otherwise.
- */
-static int
-xmlSchemaCheckAttributes(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr node) {
- int ret = 0;
- int i;
-
- for (i = ctxt->attrBase;i < ctxt->attrNr;i++) {
- if (ctxt->attr[i].attr == NULL)
- break;
- if (ctxt->attr[i].state == XML_SCHEMAS_ATTR_UNKNOWN) {
- ret = 1;
- ctxt->err = XML_SCHEMAS_ERR_ATTRUNKNOWN;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Attribute %s on %s is unknown\n",
- ctxt->attr[i].attr->name,
- node->name);
- }
- }
- return(ret);
-}
-
-/**
- * xmlSchemaValidateSimpleContent:
- * @ctxt: a schema validation context
- * @elem: an element
- * @type: the type declaration
- *
- * Validate the content of an element expected to be a simple type
- *
- * Returns 0 if the element is schemas valid, a positive error code
- * number otherwise and -1 in case of internal or API error.
- */
-static int
-xmlSchemaValidateSimpleContent(xmlSchemaValidCtxtPtr ctxt,
- xmlNodePtr node ATTRIBUTE_UNUSED) {
- xmlNodePtr child;
- xmlSchemaTypePtr type, base;
- xmlChar *value;
- int ret = 0, tmp;
-
- child = ctxt->node;
- type = ctxt->type;
-
- /*
- * Validation Rule: Element Locally Valid (Type): 3.1.3
- */
- value = xmlNodeGetContent(child);
- /* xmlSchemaValidateSimpleValue(ctxt, type, value); */
- switch (type->type) {
- case XML_SCHEMA_TYPE_RESTRICTION: {
- xmlSchemaFacetPtr facet;
-
- base = type->baseType;
- if (base != NULL) {
- ret = xmlSchemaValidateSimpleValue(ctxt, base, value);
- } else {
- TODO
- }
- if (ret == 0) {
- facet = type->facets;
- while (facet != NULL) {
- tmp = xmlSchemaValidateFacet(base, facet, value,
- ctxt->value);
- if (tmp != 0)
- ret = tmp;
- facet = facet->next;
- }
- }
- break;
- }
- default:
- TODO
- }
- if (value != NULL)
- xmlFree(value);
-
- return(ret);
-}
-
-/**
- * xmlSchemaValidateCheckNodeList
- * @nodelist: the list of nodes
- *
- * Check the node list is only made of text nodes and entities pointing
- * to text nodes
- *
- * Returns 1 if true, 0 if false and -1 in case of error
- */
-static int
-xmlSchemaValidateCheckNodeList(xmlNodePtr nodelist) {
- while (nodelist != NULL) {
- if (nodelist->type == XML_ENTITY_REF_NODE) {
- TODO /* implement recursion in the entity content */
- }
- if ((nodelist->type != XML_TEXT_NODE) &&
- (nodelist->type != XML_COMMENT_NODE) &&
- (nodelist->type != XML_PI_NODE) &&
- (nodelist->type != XML_PI_NODE)) {
- return(0);
- }
- nodelist = nodelist->next;
- }
- return(1);
-}
-
-/**
- * xmlSchemaSkipIgnored:
- * @ctxt: a schema validation context
- * @type: the current type context
- * @node: the top node.
- *
- * Skip ignorable nodes in that context
- *
- * Returns the new sibling
- * number otherwise and -1 in case of internal or API error.
- */
-static xmlNodePtr
-xmlSchemaSkipIgnored(xmlSchemaValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
- xmlSchemaTypePtr type,
- xmlNodePtr node) {
- int mixed = 0;
- /*
- * TODO complete and handle entities
- */
- mixed = ((type->contentType == XML_SCHEMA_CONTENT_MIXED) ||
- (type->contentType == XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS));
- while ((node != NULL) &&
- ((node->type == XML_COMMENT_NODE) ||
- ((mixed == 1) && (node->type == XML_TEXT_NODE)) ||
- (((type->contentType == XML_SCHEMA_CONTENT_ELEMENTS) &&
- (node->type == XML_TEXT_NODE) &&
- (IS_BLANK_NODE(node)))))) {
- node = node->next;
- }
- return(node);
-}
-
-/**
- * xmlSchemaValidateCallback:
- * @ctxt: a schema validation context
- * @name: the name of the element detected (might be NULL)
- * @type: the type
- *
- * A transition has been made in the automata associated to an element
- * content model
- */
-static void
-xmlSchemaValidateCallback(xmlSchemaValidCtxtPtr ctxt,
- const xmlChar *name ATTRIBUTE_UNUSED,
- xmlSchemaTypePtr type,
- xmlNodePtr node) {
- xmlSchemaTypePtr oldtype = ctxt->type;
- xmlNodePtr oldnode = ctxt->node;
-#ifdef DEBUG_CONTENT
- xmlGenericError(xmlGenericErrorContext,
- "xmlSchemaValidateCallback: %s, %s, %s\n",
- name, type->name, node->name);
-#endif
- ctxt->type = type;
- ctxt->node = node;
- xmlSchemaValidateContent(ctxt, node);
- ctxt->type = oldtype;
- ctxt->node = oldnode;
-}
-
-
-#if 0
-/**
- * xmlSchemaValidateSimpleRestrictionType:
- * @ctxt: a schema validation context
- * @node: the top node.
- *
- * Validate the content of a restriction type.
- *
- * Returns 0 if the element is schemas valid, a positive error code
- * number otherwise and -1 in case of internal or API error.
- */
-static int
-xmlSchemaValidateSimpleRestrictionType(xmlSchemaValidCtxtPtr ctxt,
- xmlNodePtr node)
-{
- xmlNodePtr child;
- xmlSchemaTypePtr type;
- int ret;
-
- child = ctxt->node;
- type = ctxt->type;
-
- if ((ctxt == NULL) || (type == NULL)) {
- ctxt->err = XML_SCHEMAS_ERR_INTERNAL;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Internal error: xmlSchemaValidateSimpleRestrictionType %s\n",
- node->name);
- return (-1);
- }
- /*
- * Only text and text based entities references shall be found there
- */
- ret = xmlSchemaValidateCheckNodeList(child);
- if (ret < 0) {
- ctxt->err = XML_SCHEMAS_ERR_INTERNAL;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Internal error: xmlSchemaValidateSimpleType %s content\n",
- node->name);
- return (-1);
- } else if (ret == 0) {
- ctxt->err = XML_SCHEMAS_ERR_NOTSIMPLE;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Element %s content is not a simple type\n",
- node->name);
- return (-1);
- }
- ctxt->type = type->subtypes;
- xmlSchemaValidateContent(ctxt, node);
- ctxt->type = type;
- return (ret);
-}
-#endif
-
-/**
- * xmlSchemaValidateSimpleType:
- * @ctxt: a schema validation context
- * @node: the top node.
- *
- * Validate the content of an simple type.
- *
- * Returns 0 if the element is schemas valid, a positive error code
- * number otherwise and -1 in case of internal or API error.
- */
-static int
-xmlSchemaValidateSimpleType(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr node) {
- xmlNodePtr child;
- xmlSchemaTypePtr type;
- xmlAttrPtr attr;
- int ret;
-
- child = ctxt->node;
- type = ctxt->type;
-
- if ((ctxt == NULL) || (type == NULL)) {
- ctxt->err = XML_SCHEMAS_ERR_INTERNAL;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Internal error: xmlSchemaValidateSimpleType %s\n",
- node->name);
- return(-1);
- }
- /*
- * Only text and text based entities references shall be found there
- */
- ret = xmlSchemaValidateCheckNodeList(child);
- if (ret < 0) {
- ctxt->err = XML_SCHEMAS_ERR_INTERNAL;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Internal error: xmlSchemaValidateSimpleType %s content\n",
- node->name);
- return(-1);
- } else if (ret == 0) {
- ctxt->err = XML_SCHEMAS_ERR_NOTSIMPLE;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Element %s content is not a simple type\n",
- node->name);
- return(-1);
- }
- /*
- * Validation Rule: Element Locally Valid (Type): 3.1.1
- */
- attr = node->properties;
- while (attr != NULL) {
- if ((attr->ns == NULL) ||
- (!xmlStrEqual(attr->ns->href, xmlSchemaInstanceNs)) ||
- ((!xmlStrEqual(attr->name, BAD_CAST"type")) &&
- (!xmlStrEqual(attr->name, BAD_CAST"nil")) &&
- (!xmlStrEqual(attr->name, BAD_CAST"schemasLocation")) &&
- (!xmlStrEqual(attr->name, BAD_CAST"noNamespaceSchemaLocation")))) {
- ctxt->err = XML_SCHEMAS_ERR_INVALIDATTR;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Element %s: attribute %s should not be present\n",
- child->name, attr->name);
- return(ctxt->err);
- }
- }
-
- ctxt->type = type->subtypes;
- ret = xmlSchemaValidateSimpleContent(ctxt, node);
- ctxt->type = type;
- return(ret);
-}
-
-/**
- * xmlSchemaValidateElementType:
- * @ctxt: a schema validation context
- * @node: the top node.
- *
- * Validate the content of an element type.
- * Validation Rule: Element Locally Valid (Complex Type)
- *
- * Returns 0 if the element is schemas valid, a positive error code
- * number otherwise and -1 in case of internal or API error.
- */
-static int
-xmlSchemaValidateElementType(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr node) {
- xmlNodePtr child;
- xmlSchemaTypePtr type;
- xmlRegExecCtxtPtr oldregexp; /* cont model of the parent */
- xmlSchemaElementPtr decl;
- int ret, attrBase;
-
- oldregexp = ctxt->regexp;
-
- child = ctxt->node;
- type = ctxt->type;
-
- if ((ctxt == NULL) || (type == NULL)) {
- ctxt->err = XML_SCHEMAS_ERR_INTERNAL;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Internal error: xmlSchemaValidateElementType\n",
- node->name);
- return(-1);
- }
- if (child == NULL) {
- if (type->minOccurs > 0) {
- ctxt->err = XML_SCHEMAS_ERR_MISSING;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Element %s: missing child %s\n",
- node->name, type->name);
- }
- return(ctxt->err);
- }
-
- /*
- * Verify the element matches
- */
- if (!xmlStrEqual(child->name, type->name)) {
- ctxt->err = XML_SCHEMAS_ERR_WRONGELEM;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Element %s: missing child %s found %s\n",
- node->name, type->name, child->name);
- return(ctxt->err);
- }
- /*
- * Verify the attributes
- */
- attrBase = ctxt->attrBase;
- ctxt->attrBase = ctxt->attrNr;
- xmlSchemaRegisterAttributes(ctxt, child->properties);
- xmlSchemaValidateAttributes(ctxt, child, type->attributes);
- /*
- * Verify the element content recursively
- */
- decl = (xmlSchemaElementPtr) type;
- oldregexp = ctxt->regexp;
- if (decl->contModel != NULL) {
- ctxt->regexp = xmlRegNewExecCtxt(decl->contModel,
- (xmlRegExecCallbacks) xmlSchemaValidateCallback,
- ctxt);
-#ifdef DEBUG_AUTOMATA
- xmlGenericError(xmlGenericErrorContext,
- "====> %s\n", node->name);
-#endif
- }
- xmlSchemaValidateType(ctxt, child, (xmlSchemaElementPtr)type,
- type->subtypes);
-
- if (decl->contModel != NULL) {
- ret = xmlRegExecPushString(ctxt->regexp, NULL, NULL);
-#ifdef DEBUG_AUTOMATA
- xmlGenericError(xmlGenericErrorContext,
- "====> %s : %d\n", node->name, ret);
-#endif
- if (ret == 0) {
- ctxt->err = XML_SCHEMAS_ERR_ELEMCONT;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData, "Element %s content check failed\n",
- node->name);
- } else if (ret < 0) {
- ctxt->err = XML_SCHEMAS_ERR_ELEMCONT;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData, "Element %s content check failure\n",
- node->name);
-#ifdef DEBUG_CONTENT
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "Element %s content check succeeded\n", node->name);
-
-#endif
- }
- xmlRegFreeExecCtxt(ctxt->regexp);
- }
- /*
- * Verify that all attributes were Schemas-validated
- */
- xmlSchemaCheckAttributes(ctxt, node);
- ctxt->attrNr = ctxt->attrBase;
- ctxt->attrBase = attrBase;
-
- ctxt->regexp = oldregexp;
-
- ctxt->node = child;
- ctxt->type = type;
- return(ctxt->err);
-}
-
-/**
- * xmlSchemaValidateBasicType:
- * @ctxt: a schema validation context
- * @node: the top node.
- *
- * Validate the content of an element expected to be a basic type type
- *
- * Returns 0 if the element is schemas valid, a positive error code
- * number otherwise and -1 in case of internal or API error.
- */
-static int
-xmlSchemaValidateBasicType(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr node) {
- int ret;
- xmlNodePtr child, cur;
- xmlSchemaTypePtr type;
- xmlChar *value; /* lexical representation */
-
- child = ctxt->node;
- type = ctxt->type;
-
- if ((ctxt == NULL) || (type == NULL)) {
- ctxt->err = XML_SCHEMAS_ERR_INTERNAL;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Internal error: xmlSchemaValidateBasicType\n",
- node->name);
- return(-1);
- }
- /*
- * First check the content model of the node.
- */
- cur = child;
- while (cur != NULL) {
- switch (cur->type) {
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- break;
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- TODO
- break;
- case XML_ELEMENT_NODE:
- ctxt->err = XML_SCHEMAS_ERR_INVALIDELEM;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Element %s: child %s should not be present\n",
- node->name, cur->name);
- return(ctxt->err);
- case XML_ATTRIBUTE_NODE:
- case XML_DOCUMENT_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_NOTATION_NODE:
- case XML_HTML_DOCUMENT_NODE:
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- case XML_NAMESPACE_DECL:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- ctxt->err = XML_SCHEMAS_ERR_INVALIDELEM;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Element %s: node type %d unexpected here\n",
- node->name, cur->type);
- return(ctxt->err);
- }
- cur = cur->next;
- }
- if (child == NULL)
- value = NULL;
- else
- value = xmlNodeGetContent(child->parent);
-
- if (ctxt->value != NULL) {
- xmlSchemaFreeValue(ctxt->value);
- ctxt->value = NULL;
- }
- ret = xmlSchemaValidatePredefinedType(type, value, &(ctxt->value));
- if (value != NULL)
- xmlFree(value);
- if (ret != 0) {
- ctxt->error(ctxt->userData,
- "Element %s: failed to validate basic type %s\n",
- node->name, type->name);
- }
- return(ret);
-}
-
-/**
- * xmlSchemaValidateComplexType:
- * @ctxt: a schema validation context
- * @node: the top node.
- *
- * Validate the content of an element expected to be a complex type type
- * xmlschema-1.html#cvc-complex-type
- * Validation Rule: Element Locally Valid (Complex Type)
- *
- * Returns 0 if the element is schemas valid, a positive error code
- * number otherwise and -1 in case of internal or API error.
- */
-static int
-xmlSchemaValidateComplexType(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr node) {
- xmlNodePtr child;
- xmlSchemaTypePtr type, subtype;
- int ret;
-
- child = ctxt->node;
- type = ctxt->type;
-
- switch (type->contentType) {
- case XML_SCHEMA_CONTENT_EMPTY:
- if (child != NULL) {
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Element %s is supposed to be empty\n",
- node->name);
- }
- if (type->attributes != NULL) {
- xmlSchemaValidateAttributes(ctxt, node, type->attributes);
- }
- subtype = type->subtypes;
- while (subtype != NULL) {
- ctxt->type = subtype;
- xmlSchemaValidateComplexType(ctxt, node);
- subtype = subtype->next;
- }
- break;
- case XML_SCHEMA_CONTENT_ELEMENTS:
- case XML_SCHEMA_CONTENT_MIXED:
- case XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS:
- /*
- * Skip ignorable nodes in that context
- */
- child = xmlSchemaSkipIgnored(ctxt, type, child);
- while (child != NULL) {
- if (child->type == XML_ELEMENT_NODE) {
- ret = xmlRegExecPushString(ctxt->regexp,
- child->name, child);
-#ifdef DEBUG_AUTOMATA
- if (ret < 0)
- xmlGenericError(xmlGenericErrorContext,
- " --> %s Error\n", child->name);
- else
- xmlGenericError(xmlGenericErrorContext,
- " --> %s\n", child->name);
-#endif
- }
- child = child->next;
- /*
- * Skip ignorable nodes in that context
- */
- child = xmlSchemaSkipIgnored(ctxt, type, child);
- }
- break;
- case XML_SCHEMA_CONTENT_BASIC: {
- if (type->subtypes != NULL) {
- ctxt->type = type->subtypes;
- xmlSchemaValidateComplexType(ctxt, node);
- }
- if (type->baseType != NULL) {
- ctxt->type = type->baseType;
- xmlSchemaValidateBasicType(ctxt, node);
- }
- if (type->attributes != NULL) {
- xmlSchemaValidateAttributes(ctxt, node, type->attributes);
- }
- ctxt->type = type;
- break;
- }
- default:
- TODO
- xmlGenericError(xmlGenericErrorContext,
- "unimplemented content type %d\n",
- type->contentType);
- }
- return(ctxt->err);
-}
-
-/**
- * xmlSchemaValidateContent:
- * @ctxt: a schema validation context
- * @elem: an element
- * @type: the type declaration
- *
- * Validate the content of an element against the type.
- *
- * Returns 0 if the element is schemas valid, a positive error code
- * number otherwise and -1 in case of internal or API error.
- */
-static int
-xmlSchemaValidateContent(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr node) {
- xmlNodePtr child;
- xmlSchemaTypePtr type;
-
- child = ctxt->node;
- type = ctxt->type;
-
- xmlSchemaValidateAttributes(ctxt, node, type->attributes);
-
- switch (type->type) {
- case XML_SCHEMA_TYPE_ANY:
- /* Any type will do it, fine */
- TODO /* handle recursivity */
- break;
- case XML_SCHEMA_TYPE_COMPLEX:
- xmlSchemaValidateComplexType(ctxt, node);
- break;
- case XML_SCHEMA_TYPE_ELEMENT: {
- xmlSchemaElementPtr decl = (xmlSchemaElementPtr) type;
- /*
- * Handle element reference here
- */
- if (decl->ref != NULL) {
- if (decl->refDecl == NULL) {
- ctxt->err = XML_SCHEMAS_ERR_INTERNAL;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Internal error: element reference %s not resolved\n",
- decl->ref);
- return(-1);
- }
- ctxt->type = (xmlSchemaTypePtr) decl->refDecl;
- decl = decl->refDecl;
- }
- xmlSchemaValidateElementType(ctxt, node);
- ctxt->type = type;
- break;
- }
- case XML_SCHEMA_TYPE_BASIC:
- xmlSchemaValidateBasicType(ctxt, node);
- break;
- case XML_SCHEMA_TYPE_FACET:
- TODO
- break;
- case XML_SCHEMA_TYPE_SIMPLE:
- xmlSchemaValidateSimpleType(ctxt, node);
- break;
- case XML_SCHEMA_TYPE_SEQUENCE:
- TODO
- break;
- case XML_SCHEMA_TYPE_CHOICE:
- TODO
- break;
- case XML_SCHEMA_TYPE_ALL:
- TODO
- break;
- case XML_SCHEMA_TYPE_SIMPLE_CONTENT:
- TODO
- break;
- case XML_SCHEMA_TYPE_COMPLEX_CONTENT:
- TODO
- break;
- case XML_SCHEMA_TYPE_UR:
- TODO
- break;
- case XML_SCHEMA_TYPE_RESTRICTION:
- /*xmlSchemaValidateRestrictionType(ctxt, node); */
- TODO
- break;
- case XML_SCHEMA_TYPE_EXTENSION:
- TODO
- break;
- case XML_SCHEMA_TYPE_ATTRIBUTE:
- TODO
- break;
- case XML_SCHEMA_TYPE_GROUP:
- TODO
- break;
- case XML_SCHEMA_TYPE_NOTATION:
- TODO
- break;
- case XML_SCHEMA_TYPE_LIST:
- TODO
- break;
- case XML_SCHEMA_TYPE_UNION:
- TODO
- break;
- case XML_SCHEMA_FACET_MININCLUSIVE:
- TODO
- break;
- case XML_SCHEMA_FACET_MINEXCLUSIVE:
- TODO
- break;
- case XML_SCHEMA_FACET_MAXINCLUSIVE:
- TODO
- break;
- case XML_SCHEMA_FACET_MAXEXCLUSIVE:
- TODO
- break;
- case XML_SCHEMA_FACET_TOTALDIGITS:
- TODO
- break;
- case XML_SCHEMA_FACET_FRACTIONDIGITS:
- TODO
- break;
- case XML_SCHEMA_FACET_PATTERN:
- TODO
- break;
- case XML_SCHEMA_FACET_ENUMERATION:
- TODO
- break;
- case XML_SCHEMA_FACET_WHITESPACE:
- TODO
- break;
- case XML_SCHEMA_FACET_LENGTH:
- TODO
- break;
- case XML_SCHEMA_FACET_MAXLENGTH:
- TODO
- break;
- case XML_SCHEMA_FACET_MINLENGTH:
- TODO
- break;
- case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
- TODO
- break;
- }
- xmlSchemaValidateAttributes(ctxt, node, type->attributes);
-
- if (ctxt->node == NULL)
- return(ctxt->err);
- ctxt->node = ctxt->node->next;
- ctxt->type = type->next;
- return(ctxt->err);
-}
-
-/**
- * xmlSchemaValidateType:
- * @ctxt: a schema validation context
- * @elem: an element
- * @type: the list of type declarations
- *
- * Validate the content of an element against the types.
- *
- * Returns 0 if the element is schemas valid, a positive error code
- * number otherwise and -1 in case of internal or API error.
- */
-static int
-xmlSchemaValidateType(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr elem,
- xmlSchemaElementPtr elemDecl,
- xmlSchemaTypePtr type) {
- xmlChar *nil;
-
- if ((elem->content == NULL) || (type == NULL) || (elemDecl == NULL))
- return(0);
- /*
- * 3.3.4 : 2
- */
- if (elemDecl->flags & XML_SCHEMAS_ELEM_ABSTRACT) {
- ctxt->err = XML_SCHEMAS_ERR_ISABSTRACT;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData, "Element %s is abstract\n", elem->name);
- return(ctxt->err);
- }
- /*
- * 3.3.4: 3
- */
- nil = xmlGetNsProp(elem, BAD_CAST "nil", xmlSchemaInstanceNs);
- if (elemDecl->flags & XML_SCHEMAS_ELEM_NILLABLE) {
- /* 3.3.4: 3.2 */
- if (xmlStrEqual(nil, BAD_CAST "true")) {
- if (elem->children != NULL) {
- ctxt->err = XML_SCHEMAS_ERR_NOTEMPTY;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData, "Element %s is not empty\n",
- elem->name);
- return(ctxt->err);
- }
- if ((elemDecl->flags & XML_SCHEMAS_ELEM_FIXED) &&
- (elemDecl->value != NULL)) {
- ctxt->err = XML_SCHEMAS_ERR_HAVEDEFAULT;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Empty element %s cannot get a fixed value\n",
- elem->name);
- return(ctxt->err);
- }
- }
- } else {
- /* 3.3.4: 3.1 */
- if (nil != NULL) {
- ctxt->err = XML_SCHEMAS_ERR_NOTNILLABLE;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Element %s with xs:nil but not nillable\n",
- elem->name);
- xmlFree(nil);
- return(ctxt->err);
- }
- }
-
- /* TODO 3.3.4: 4 if the element carries xs:type*/
-
- ctxt->type = elemDecl->subtypes;
- ctxt->node = elem->children;
- xmlSchemaValidateContent(ctxt, elem);
- xmlSchemaValidateAttributes(ctxt, elem, elemDecl->attributes);
-
- return(ctxt->err);
-}
-
-
-/**
- * xmlSchemaValidateAttributes:
- * @ctxt: a schema validation context
- * @elem: an element
- * @attributes: the list of attribute declarations
- *
- * Validate the attributes of an element.
- *
- * Returns 0 if the element is schemas valid, a positive error code
- * number otherwise and -1 in case of internal or API error.
- */
-static int
-xmlSchemaValidateAttributes(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr elem,
- xmlSchemaAttributePtr attributes) {
- int i, ret;
- xmlAttrPtr attr;
- xmlChar *value;
- xmlSchemaAttributeGroupPtr group = NULL;
-
- if (attributes == NULL)
- return(0);
- while (attributes != NULL) {
- /*
- * Handle attribute groups
- */
- if (attributes->type == XML_SCHEMA_TYPE_ATTRIBUTEGROUP) {
- group = (xmlSchemaAttributeGroupPtr) attributes;
- xmlSchemaValidateAttributes(ctxt, elem, group->attributes);
- attributes = group->next;
- continue;
- }
- for (i = ctxt->attrBase;i < ctxt->attrNr;i++) {
- attr = ctxt->attr[i].attr;
- if (attr == NULL)
- continue;
- if (!xmlStrEqual(attr->name, attributes->name))
- continue;
- /*
- * TODO: handle the mess about namespaces here.
- */
- if ((attr->ns != NULL) /* || (attributes->ns != NULL) */) {
- TODO
- }
- if (attributes->subtypes == NULL) {
- ctxt->err = XML_SCHEMAS_ERR_INTERNAL;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "Internal error: attribute %s type not resolved\n",
- attr->name);
- continue;
- }
- value = xmlNodeListGetString(elem->doc, attr->children, 1);
- ret = xmlSchemaValidateSimpleValue(ctxt, attributes->subtypes,
- value);
- if (ret != 0) {
- ctxt->err = XML_SCHEMAS_ERR_ATTRINVALID;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData,
- "attribute %s on %s does not match type\n",
- attr->name, elem->name);
- } else {
- ctxt->attr[i].state = XML_SCHEMAS_ATTR_CHECKED;
- }
- if (value != NULL) {
- xmlFree(value);
- }
- }
- attributes = attributes->next;
- }
- return(ctxt->err);
-}
-
-/**
- * xmlSchemaValidateElement:
- * @ctxt: a schema validation context
- * @elem: an element
- *
- * Validate an element in a tree
- *
- * Returns 0 if the element is schemas valid, a positive error code
- * number otherwise and -1 in case of internal or API error.
- */
-static int
-xmlSchemaValidateElement(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr elem) {
- xmlSchemaElementPtr elemDecl;
- int ret, attrBase;
-
- if (elem->ns != NULL)
- elemDecl = xmlHashLookup3(ctxt->schema->elemDecl,
- elem->name, elem->ns->href, NULL);
- else
- elemDecl = xmlHashLookup3(ctxt->schema->elemDecl,
- elem->name, NULL, NULL);
- /*
- * 3.3.4 : 1
- */
- if (elemDecl == NULL) {
- ctxt->err = XML_SCHEMAS_ERR_UNDECLAREDELEM;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData, "Element %s not declared\n",
- elem->name);
- return(ctxt->err);
- }
- if (elemDecl->subtypes == NULL) {
- ctxt->err = XML_SCHEMAS_ERR_NOTYPE;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData, "Element %s has no type\n",
- elem->name);
- return(ctxt->err);
- }
- /*
- * Verify the attributes
- */
- attrBase = ctxt->attrBase;
- ctxt->attrBase = ctxt->attrNr;
- xmlSchemaRegisterAttributes(ctxt, elem->properties);
- xmlSchemaValidateAttributes(ctxt, elem, elemDecl->attributes);
- /*
- * Verify the element content recursively
- */
- if (elemDecl->contModel != NULL) {
- ctxt->regexp = xmlRegNewExecCtxt(elemDecl->contModel,
- (xmlRegExecCallbacks) xmlSchemaValidateCallback,
- ctxt);
-#ifdef DEBUG_AUTOMATA
- xmlGenericError(xmlGenericErrorContext,
- "====> %s\n", elem->name);
-#endif
- }
- xmlSchemaValidateType(ctxt, elem, elemDecl, elemDecl->subtypes);
- if (elemDecl->contModel != NULL) {
- ret = xmlRegExecPushString(ctxt->regexp, NULL, NULL);
-#ifdef DEBUG_AUTOMATA
- xmlGenericError(xmlGenericErrorContext,
- "====> %s : %d\n", elem->name, ret);
-#endif
- if (ret == 0) {
- ctxt->err = XML_SCHEMAS_ERR_ELEMCONT;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData, "Element %s content check failed\n",
- elem->name);
- } else if (ret < 0) {
- ctxt->err = XML_SCHEMAS_ERR_ELEMCONT;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData, "Element %s content check failed\n",
- elem->name);
-#ifdef DEBUG_CONTENT
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "Element %s content check succeeded\n", elem->name);
-
-#endif
- }
- xmlRegFreeExecCtxt(ctxt->regexp);
- }
- /*
- * Verify that all attributes were Schemas-validated
- */
- xmlSchemaCheckAttributes(ctxt, elem);
- ctxt->attrNr = ctxt->attrBase;
- ctxt->attrBase = attrBase;
-
- return(ctxt->err);
-}
-
-/**
- * xmlSchemaValidateDocument:
- * @ctxt: a schema validation context
- * @doc: a parsed document tree
- *
- * Validate a document tree in memory.
- *
- * Returns 0 if the document is schemas valid, a positive error code
- * number otherwise and -1 in case of internal or API error.
- */
-static int
-xmlSchemaValidateDocument(xmlSchemaValidCtxtPtr ctxt, xmlDocPtr doc) {
- xmlNodePtr root;
- xmlSchemaElementPtr elemDecl;
-
- root = xmlDocGetRootElement(doc);
- if (root == NULL) {
- ctxt->err = XML_SCHEMAS_ERR_NOROOT;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData, "document has no root\n");
- return(ctxt->err);
- }
- if (root->ns != NULL)
- elemDecl = xmlHashLookup3(ctxt->schema->elemDecl,
- root->name, root->ns->href, NULL);
- else
- elemDecl = xmlHashLookup3(ctxt->schema->elemDecl,
- root->name, NULL, NULL);
- if (elemDecl == NULL) {
- ctxt->err = XML_SCHEMAS_ERR_UNDECLAREDELEM;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData, "Element %s not declared\n",
- root->name);
- } else if ((elemDecl->flags & XML_SCHEMAS_ELEM_TOPLEVEL) == 0) {
- ctxt->err = XML_SCHEMAS_ERR_NOTTOPLEVEL;
- if (ctxt->error != NULL)
- ctxt->error(ctxt->userData, "Root element %s not toplevel\n",
- root->name);
- }
- /*
- * Okay, start the recursive validation
- */
- xmlSchemaValidateElement(ctxt, root);
-
- return(ctxt->err);
-}
-
-/************************************************************************
- * *
- * SAX Validation code *
- * *
- ************************************************************************/
-
-/************************************************************************
- * *
- * Validation interfaces *
- * *
- ************************************************************************/
-
-/**
- * xmlSchemaNewValidCtxt:
- * @schema: a precompiled XML Schemas
- *
- * Create an XML Schemas validation context based on the given schema
- *
- * Returns the validation context or NULL in case of error
- */
-xmlSchemaValidCtxtPtr
-xmlSchemaNewValidCtxt(xmlSchemaPtr schema) {
- xmlSchemaValidCtxtPtr ret;
-
- ret = (xmlSchemaValidCtxtPtr) xmlMalloc(sizeof(xmlSchemaValidCtxt));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Failed to allocate new schama validation context\n");
- return (NULL);
- }
- memset(ret, 0, sizeof(xmlSchemaValidCtxt));
- ret->schema = schema;
- ret->attrNr = 0;
- ret->attrMax = 10;
- ret->attr = (xmlSchemaAttrStatePtr) xmlMalloc(ret->attrMax *
- sizeof(xmlSchemaAttrState));
- if (ret->attr == NULL) {
- free(ret);
- return(NULL);
- }
- memset(ret->attr, 0, ret->attrMax * sizeof(xmlSchemaAttrState));
- return (ret);
-}
-
-/**
- * xmlSchemaFreeValidCtxt:
- * @ctxt: the schema validation context
- *
- * Free the resources associated to the schema validation context
- */
-void
-xmlSchemaFreeValidCtxt(xmlSchemaValidCtxtPtr ctxt) {
- if (ctxt == NULL)
- return;
- if (ctxt->attr != NULL)
- xmlFree(ctxt->attr);
- if (ctxt->value != NULL)
- xmlSchemaFreeValue(ctxt->value);
- xmlFree(ctxt);
-}
-
-/**
- * xmlSchemaSetValidErrors:
- * @ctxt: a schema validation context
- * @err: the error function
- * @warn: the warning function
- * @ctx: the functions context
- *
- * Set the error and warning callback informations
- */
-void
-xmlSchemaSetValidErrors(xmlSchemaValidCtxtPtr ctxt,
- xmlSchemaValidityErrorFunc err,
- xmlSchemaValidityWarningFunc warn, void *ctx) {
- if (ctxt == NULL)
- return;
- ctxt->error = err;
- ctxt->warning = warn;
- ctxt->userData = ctx;
-}
-
-/**
- * xmlSchemaValidateDoc:
- * @ctxt: a schema validation context
- * @doc: a parsed document tree
- *
- * Validate a document tree in memory.
- *
- * Returns 0 if the document is schemas valid, a positive error code
- * number otherwise and -1 in case of internal or API error.
- */
-int
-xmlSchemaValidateDoc(xmlSchemaValidCtxtPtr ctxt, xmlDocPtr doc) {
- int ret;
-
- if ((ctxt == NULL) || (doc == NULL))
- return(-1);
-
- ctxt->doc = doc;
- ret = xmlSchemaValidateDocument(ctxt, doc);
- return(ret);
-}
-
-/**
- * xmlSchemaValidateStream:
- * @ctxt: a schema validation context
- * @input: the input to use for reading the data
- * @enc: an optional encoding information
- * @sax: a SAX handler for the resulting events
- * @user_data: the context to provide to the SAX handler.
- *
- * Validate a document tree in memory.
- *
- * Returns 0 if the document is schemas valid, a positive error code
- * number otherwise and -1 in case of internal or API error.
- */
-int
-xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt,
- xmlParserInputBufferPtr input, xmlCharEncoding enc,
- xmlSAXHandlerPtr sax, void *user_data) {
- if ((ctxt == NULL) || (input == NULL))
- return(-1);
- ctxt->input = input;
- ctxt->enc = enc;
- ctxt->sax = sax;
- ctxt->user_data = user_data;
- TODO
- return(0);
-}
-
-#endif /* LIBXML_SCHEMAS_ENABLED */
diff --git a/bundle/libxml/xmlschemastypes.c b/bundle/libxml/xmlschemastypes.c
deleted file mode 100644
index 1be67c8622..0000000000
--- a/bundle/libxml/xmlschemastypes.c
+++ /dev/null
@@ -1,1880 +0,0 @@
-/*
- * schemastypes.c : implementation of the XML Schema Datatypes
- * definition and validity checking
- *
- * See Copyright for the status of this software.
- *
- * Daniel Veillard <veillard@redhat.com>
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#ifdef LIBXML_SCHEMAS_ENABLED
-
-#include <string.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-#include <libxml/hash.h>
-#include <libxml/valid.h>
-
-#include <libxml/xmlschemas.h>
-#include <libxml/schemasInternals.h>
-#include <libxml/xmlschemastypes.h>
-
-#ifdef HAVE_MATH_H
-#include <math.h>
-#endif
-
-#define DEBUG
-
-#define TODO \
- xmlGenericError(xmlGenericErrorContext, \
- "Unimplemented block at %s:%d\n", \
- __FILE__, __LINE__);
-
-#define XML_SCHEMAS_NAMESPACE_NAME \
- (const xmlChar *)"http://www.w3.org/2001/XMLSchema"
-
-typedef enum {
- XML_SCHEMAS_UNKNOWN = 0,
- XML_SCHEMAS_STRING,
- XML_SCHEMAS_NMTOKEN,
- XML_SCHEMAS_DECIMAL,
- XML_SCHEMAS_TIME,
- XML_SCHEMAS_GDAY,
- XML_SCHEMAS_GMONTH,
- XML_SCHEMAS_GMONTHDAY,
- XML_SCHEMAS_GYEAR,
- XML_SCHEMAS_GYEARMONTH,
- XML_SCHEMAS_DATE,
- XML_SCHEMAS_DATETIME,
- XML_SCHEMAS_DURATION,
- XML_SCHEMAS_FLOAT,
- XML_SCHEMAS_DOUBLE,
- XML_SCHEMAS_,
- XML_SCHEMAS_XXX
-} xmlSchemaValType;
-
-unsigned long powten[10] = {
- 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000L,
- 100000000L, 1000000000L
-};
-
-/* Date value */
-typedef struct _xmlSchemaValDate xmlSchemaValDate;
-typedef xmlSchemaValDate *xmlSchemaValDatePtr;
-struct _xmlSchemaValDate {
- long year;
- unsigned int mon :4; /* 1 <= mon <= 12 */
- unsigned int day :5; /* 1 <= day <= 31 */
- unsigned int hour :5; /* 0 <= hour <= 23 */
- unsigned int min :6; /* 0 <= min <= 59 */
- double sec;
- int tz_flag :1; /* is tzo explicitely set? */
- int tzo :11; /* -1440 <= tzo <= 1440 */
-};
-
-/* Duration value */
-typedef struct _xmlSchemaValDuration xmlSchemaValDuration;
-typedef xmlSchemaValDuration *xmlSchemaValDurationPtr;
-struct _xmlSchemaValDuration {
- long mon; /* mon stores years also */
- long day;
- double sec; /* sec stores min and hour also */
-};
-
-typedef struct _xmlSchemaValDecimal xmlSchemaValDecimal;
-typedef xmlSchemaValDecimal *xmlSchemaValDecimalPtr;
-struct _xmlSchemaValDecimal {
- /* would use long long but not portable */
- unsigned long base;
- unsigned int extra;
- unsigned int sign:1;
- int frac:7;
- int total:8;
-};
-
-struct _xmlSchemaVal {
- xmlSchemaValType type;
- union {
- xmlSchemaValDecimal decimal;
- xmlSchemaValDate date;
- xmlSchemaValDuration dur;
- float f;
- double d;
- } value;
-};
-
-static int xmlSchemaTypesInitialized = 0;
-static xmlHashTablePtr xmlSchemaTypesBank = NULL;
-
-static xmlSchemaTypePtr xmlSchemaTypeStringDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeAnyTypeDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeAnySimpleTypeDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeDecimalDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeDatetimeDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeDateDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeTimeDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeGYearDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeGYearMonthDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeGDayDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeGMonthDayDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeGMonthDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeDurationDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypePositiveIntegerDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeNonNegativeIntegerDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeNmtoken = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeFloatDef = NULL;
-static xmlSchemaTypePtr xmlSchemaTypeDoubleDef = NULL;
-
-/*
- * xmlSchemaInitBasicType:
- * @name: the type name
- *
- * Initialize one default type
- */
-static xmlSchemaTypePtr
-xmlSchemaInitBasicType(const char *name) {
- xmlSchemaTypePtr ret;
-
- ret = (xmlSchemaTypePtr) xmlMalloc(sizeof(xmlSchemaType));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Could not initilize type %s: out of memory\n", name);
- return(NULL);
- }
- memset(ret, 0, sizeof(xmlSchemaType));
- ret->name = xmlStrdup((const xmlChar *)name);
- ret->type = XML_SCHEMA_TYPE_BASIC;
- ret->contentType = XML_SCHEMA_CONTENT_BASIC;
- xmlHashAddEntry2(xmlSchemaTypesBank, ret->name,
- XML_SCHEMAS_NAMESPACE_NAME, ret);
- return(ret);
-}
-
-/*
- * xmlSchemaInitTypes:
- *
- * Initialize the default XML Schemas type library
- */
-void
-xmlSchemaInitTypes(void) {
- if (xmlSchemaTypesInitialized != 0)
- return;
- xmlSchemaTypesBank = xmlHashCreate(40);
-
- xmlSchemaTypeStringDef = xmlSchemaInitBasicType("string");
- xmlSchemaTypeAnyTypeDef = xmlSchemaInitBasicType("anyType");
- xmlSchemaTypeAnySimpleTypeDef = xmlSchemaInitBasicType("anySimpleType");
- xmlSchemaTypeDecimalDef = xmlSchemaInitBasicType("decimal");
- xmlSchemaTypeDateDef = xmlSchemaInitBasicType("date");
- xmlSchemaTypeDatetimeDef = xmlSchemaInitBasicType("dateTime");
- xmlSchemaTypeTimeDef = xmlSchemaInitBasicType("time");
- xmlSchemaTypeGYearDef = xmlSchemaInitBasicType("gYear");
- xmlSchemaTypeGYearMonthDef = xmlSchemaInitBasicType("gYearMonth");
- xmlSchemaTypeGMonthDef = xmlSchemaInitBasicType("gMonth");
- xmlSchemaTypeGMonthDayDef = xmlSchemaInitBasicType("gMonthDay");
- xmlSchemaTypeGDayDef = xmlSchemaInitBasicType("gDay");
- xmlSchemaTypeDurationDef = xmlSchemaInitBasicType("duration");
- xmlSchemaTypePositiveIntegerDef = xmlSchemaInitBasicType("positiveInteger");
- xmlSchemaTypeNonNegativeIntegerDef =
- xmlSchemaInitBasicType("nonNegativeInteger");
- xmlSchemaTypeNmtoken = xmlSchemaInitBasicType("NMTOKEN");
- xmlSchemaTypeFloatDef = xmlSchemaInitBasicType("float");
- xmlSchemaTypeDoubleDef = xmlSchemaInitBasicType("double");
-
- xmlSchemaTypesInitialized = 1;
-}
-
-/**
- * xmlSchemaCleanupTypes:
- *
- * Cleanup the default XML Schemas type library
- */
-void
-xmlSchemaCleanupTypes(void) {
- if (xmlSchemaTypesInitialized == 0)
- return;
- xmlHashFree(xmlSchemaTypesBank, (xmlHashDeallocator) xmlSchemaFreeType);
- xmlSchemaTypesInitialized = 0;
-}
-
-/**
- * xmlSchemaNewValue:
- * @type: the value type
- *
- * Allocate a new simple type value
- *
- * Returns a pointer to the new value or NULL in case of error
- */
-static xmlSchemaValPtr
-xmlSchemaNewValue(xmlSchemaValType type) {
- xmlSchemaValPtr value;
-
- value = (xmlSchemaValPtr) xmlMalloc(sizeof(xmlSchemaVal));
- if (value == NULL) {
- return(NULL);
- }
- memset(value, 0, sizeof(xmlSchemaVal));
- value->type = type;
- return(value);
-}
-
-/**
- * xmlSchemaFreeValue:
- * @value: the value to free
- *
- * Cleanup the default XML Schemas type library
- */
-void
-xmlSchemaFreeValue(xmlSchemaValPtr value) {
- if (value == NULL)
- return;
- xmlFree(value);
-}
-
-/**
- * xmlSchemaGetPredefinedType:
- * @name: the type name
- * @ns: the URI of the namespace usually "http://www.w3.org/2001/XMLSchema"
- *
- * Lookup a type in the default XML Schemas type library
- *
- * Returns the type if found, NULL otherwise
- */
-xmlSchemaTypePtr
-xmlSchemaGetPredefinedType(const xmlChar *name, const xmlChar *ns) {
- if (xmlSchemaTypesInitialized == 0)
- xmlSchemaInitTypes();
- if (name == NULL)
- return(NULL);
- return((xmlSchemaTypePtr) xmlHashLookup2(xmlSchemaTypesBank, name, ns));
-}
-
-/****************************************************************
- * *
- * Convenience macros and functions *
- * *
- ****************************************************************/
-
-#define IS_TZO_CHAR(c) \
- ((c == 0) || (c == 'Z') || (c == '+') || (c == '-'))
-
-#define VALID_YEAR(yr) (yr != 0)
-#define VALID_MONTH(mon) ((mon >= 1) && (mon <= 12))
-/* VALID_DAY should only be used when month is unknown */
-#define VALID_DAY(day) ((day >= 1) && (day <= 31))
-#define VALID_HOUR(hr) ((hr >= 0) && (hr <= 23))
-#define VALID_MIN(min) ((min >= 0) && (min <= 59))
-#define VALID_SEC(sec) ((sec >= 0) && (sec < 60))
-#define VALID_TZO(tzo) ((tzo > -1440) && (tzo < 1440))
-#define IS_LEAP(y) \
- (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0))
-
-static const long daysInMonth[12] =
- { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-static const long daysInMonthLeap[12] =
- { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-
-#define MAX_DAYINMONTH(yr,mon) \
- (IS_LEAP(yr) ? daysInMonthLeap[mon - 1] : daysInMonth[mon - 1])
-
-#define VALID_MDAY(dt) \
- (IS_LEAP(dt->year) ? \
- (dt->day <= daysInMonthLeap[dt->mon - 1]) : \
- (dt->day <= daysInMonth[dt->mon - 1]))
-
-#define VALID_DATE(dt) \
- (VALID_YEAR(dt->year) && VALID_MONTH(dt->mon) && VALID_MDAY(dt))
-
-#define VALID_TIME(dt) \
- (VALID_HOUR(dt->hour) && VALID_MIN(dt->min) && \
- VALID_SEC(dt->sec) && VALID_TZO(dt->tzo))
-
-#define VALID_DATETIME(dt) \
- (VALID_DATE(dt) && VALID_TIME(dt))
-
-#define SECS_PER_MIN (60)
-#define SECS_PER_HOUR (60 * SECS_PER_MIN)
-#define SECS_PER_DAY (24 * SECS_PER_HOUR)
-
-static const long dayInYearByMonth[12] =
- { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
-static const long dayInLeapYearByMonth[12] =
- { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 };
-
-#define DAY_IN_YEAR(day, month, year) \
- ((IS_LEAP(year) ? \
- dayInLeapYearByMonth[month - 1] : \
- dayInYearByMonth[month - 1]) + day)
-
-#ifdef DEBUG
-#define DEBUG_DATE(dt) \
- xmlGenericError(xmlGenericErrorContext, \
- "type=%o %04ld-%02u-%02uT%02u:%02u:%03f", \
- dt->type,dt->value.date.year,dt->value.date.mon, \
- dt->value.date.day,dt->value.date.hour,dt->value.date.min, \
- dt->value.date.sec); \
- if (dt->value.date.tz_flag) \
- if (dt->value.date.tzo != 0) \
- xmlGenericError(xmlGenericErrorContext, \
- "%+05d\n",dt->value.date.tzo); \
- else \
- xmlGenericError(xmlGenericErrorContext, "Z\n"); \
- else \
- xmlGenericError(xmlGenericErrorContext,"\n")
-#else
-#define DEBUG_DATE(dt)
-#endif
-
-/**
- * _xmlSchemaParseGYear:
- * @dt: pointer to a date structure
- * @str: pointer to the string to analyze
- *
- * Parses a xs:gYear without time zone and fills in the appropriate
- * field of the @dt structure. @str is updated to point just after the
- * xs:gYear. It is supposed that @dt->year is big enough to contain
- * the year.
- *
- * Returns 0 or the error code
- */
-static int
-_xmlSchemaParseGYear (xmlSchemaValDatePtr dt, const xmlChar **str) {
- const xmlChar *cur = *str, *firstChar;
- int isneg = 0, digcnt = 0;
-
- if (((*cur < '0') || (*cur > '9')) &&
- (*cur != '-') && (*cur != '+'))
- return -1;
-
- if (*cur == '-') {
- isneg = 1;
- cur++;
- }
-
- firstChar = cur;
-
- while ((*cur >= '0') && (*cur <= '9')) {
- dt->year = dt->year * 10 + (*cur - '0');
- cur++;
- digcnt++;
- }
-
- /* year must be at least 4 digits (CCYY); over 4
- * digits cannot have a leading zero. */
- if ((digcnt < 4) || ((digcnt > 4) && (*firstChar == '0')))
- return 1;
-
- if (isneg)
- dt->year = - dt->year;
-
- if (!VALID_YEAR(dt->year))
- return 2;
-
- *str = cur;
- return 0;
-}
-
-/**
- * PARSE_2_DIGITS:
- * @num: the integer to fill in
- * @cur: an #xmlChar *
- * @invalid: an integer
- *
- * Parses a 2-digits integer and updates @num with the value. @cur is
- * updated to point just after the integer.
- * In case of error, @invalid is set to %TRUE, values of @num and
- * @cur are undefined.
- */
-#define PARSE_2_DIGITS(num, cur, invalid) \
- if ((cur[0] < '0') || (cur[0] > '9') || \
- (cur[1] < '0') || (cur[1] > '9')) \
- invalid = 1; \
- else \
- num = (cur[0] - '0') * 10 + (cur[1] - '0'); \
- cur += 2;
-
-/**
- * PARSE_FLOAT:
- * @num: the double to fill in
- * @cur: an #xmlChar *
- * @invalid: an integer
- *
- * Parses a float and updates @num with the value. @cur is
- * updated to point just after the float. The float must have a
- * 2-digits integer part and may or may not have a decimal part.
- * In case of error, @invalid is set to %TRUE, values of @num and
- * @cur are undefined.
- */
-#define PARSE_FLOAT(num, cur, invalid) \
- PARSE_2_DIGITS(num, cur, invalid); \
- if (!invalid && (*cur == '.')) { \
- double mult = 1; \
- cur++; \
- if ((*cur < '0') || (*cur > '9')) \
- invalid = 1; \
- while ((*cur >= '0') && (*cur <= '9')) { \
- mult /= 10; \
- num += (*cur - '0') * mult; \
- cur++; \
- } \
- }
-
-/**
- * _xmlSchemaParseGMonth:
- * @dt: pointer to a date structure
- * @str: pointer to the string to analyze
- *
- * Parses a xs:gMonth without time zone and fills in the appropriate
- * field of the @dt structure. @str is updated to point just after the
- * xs:gMonth.
- *
- * Returns 0 or the error code
- */
-static int
-_xmlSchemaParseGMonth (xmlSchemaValDatePtr dt, const xmlChar **str) {
- const xmlChar *cur = *str;
- int ret = 0;
-
- PARSE_2_DIGITS(dt->mon, cur, ret);
- if (ret != 0)
- return ret;
-
- if (!VALID_MONTH(dt->mon))
- return 2;
-
- *str = cur;
- return 0;
-}
-
-/**
- * _xmlSchemaParseGDay:
- * @dt: pointer to a date structure
- * @str: pointer to the string to analyze
- *
- * Parses a xs:gDay without time zone and fills in the appropriate
- * field of the @dt structure. @str is updated to point just after the
- * xs:gDay.
- *
- * Returns 0 or the error code
- */
-static int
-_xmlSchemaParseGDay (xmlSchemaValDatePtr dt, const xmlChar **str) {
- const xmlChar *cur = *str;
- int ret = 0;
-
- PARSE_2_DIGITS(dt->day, cur, ret);
- if (ret != 0)
- return ret;
-
- if (!VALID_DAY(dt->day))
- return 2;
-
- *str = cur;
- return 0;
-}
-
-/**
- * _xmlSchemaParseTime:
- * @dt: pointer to a date structure
- * @str: pointer to the string to analyze
- *
- * Parses a xs:time without time zone and fills in the appropriate
- * fields of the @dt structure. @str is updated to point just after the
- * xs:time.
- * In case of error, values of @dt fields are undefined.
- *
- * Returns 0 or the error code
- */
-static int
-_xmlSchemaParseTime (xmlSchemaValDatePtr dt, const xmlChar **str) {
- const xmlChar *cur = *str;
- unsigned int hour = 0; /* use temp var in case str is not xs:time */
- int ret = 0;
-
- PARSE_2_DIGITS(hour, cur, ret);
- if (ret != 0)
- return ret;
-
- if (*cur != ':')
- return 1;
- cur++;
-
- /* the ':' insures this string is xs:time */
- dt->hour = hour;
-
- PARSE_2_DIGITS(dt->min, cur, ret);
- if (ret != 0)
- return ret;
-
- if (*cur != ':')
- return 1;
- cur++;
-
- PARSE_FLOAT(dt->sec, cur, ret);
- if (ret != 0)
- return ret;
-
- if (!VALID_TIME(dt))
- return 2;
-
- *str = cur;
- return 0;
-}
-
-/**
- * _xmlSchemaParseTimeZone:
- * @dt: pointer to a date structure
- * @str: pointer to the string to analyze
- *
- * Parses a time zone without time zone and fills in the appropriate
- * field of the @dt structure. @str is updated to point just after the
- * time zone.
- *
- * Returns 0 or the error code
- */
-static int
-_xmlSchemaParseTimeZone (xmlSchemaValDatePtr dt, const xmlChar **str) {
- const xmlChar *cur = *str;
- int ret = 0;
-
- if (str == NULL)
- return -1;
-
- switch (*cur) {
- case 0:
- dt->tz_flag = 0;
- dt->tzo = 0;
- break;
-
- case 'Z':
- dt->tz_flag = 1;
- dt->tzo = 0;
- cur++;
- break;
-
- case '+':
- case '-': {
- int isneg = 0, tmp = 0;
- isneg = (*cur == '-');
-
- cur++;
-
- PARSE_2_DIGITS(tmp, cur, ret);
- if (ret != 0)
- return ret;
- if (!VALID_HOUR(tmp))
- return 2;
-
- if (*cur != ':')
- return 1;
- cur++;
-
- dt->tzo = tmp * 60;
-
- PARSE_2_DIGITS(tmp, cur, ret);
- if (ret != 0)
- return ret;
- if (!VALID_MIN(tmp))
- return 2;
-
- dt->tzo += tmp;
- if (isneg)
- dt->tzo = - dt->tzo;
-
- if (!VALID_TZO(dt->tzo))
- return 2;
-
- dt->tz_flag = 1;
- break;
- }
- default:
- return 1;
- }
-
- *str = cur;
- return 0;
-}
-
-/****************************************************************
- * *
- * XML Schema Dates/Times Datatypes Handling *
- * *
- ****************************************************************/
-
-/**
- * PARSE_DIGITS:
- * @num: the integer to fill in
- * @cur: an #xmlChar *
- * @num_type: an integer flag
- *
- * Parses a digits integer and updates @num with the value. @cur is
- * updated to point just after the integer.
- * In case of error, @num_type is set to -1, values of @num and
- * @cur are undefined.
- */
-#define PARSE_DIGITS(num, cur, num_type) \
- if ((*cur < '0') || (*cur > '9')) \
- num_type = -1; \
- else \
- while ((*cur >= '0') && (*cur <= '9')) { \
- num = num * 10 + (*cur - '0'); \
- cur++; \
- }
-
-/**
- * PARSE_NUM:
- * @num: the double to fill in
- * @cur: an #xmlChar *
- * @num_type: an integer flag
- *
- * Parses a float or integer and updates @num with the value. @cur is
- * updated to point just after the number. If the number is a float,
- * then it must have an integer part and a decimal part; @num_type will
- * be set to 1. If there is no decimal part, @num_type is set to zero.
- * In case of error, @num_type is set to -1, values of @num and
- * @cur are undefined.
- */
-#define PARSE_NUM(num, cur, num_type) \
- num = 0; \
- PARSE_DIGITS(num, cur, num_type); \
- if (!num_type && (*cur == '.')) { \
- double mult = 1; \
- cur++; \
- if ((*cur < '0') || (*cur > '9')) \
- num_type = -1; \
- else \
- num_type = 1; \
- while ((*cur >= '0') && (*cur <= '9')) { \
- mult /= 10; \
- num += (*cur - '0') * mult; \
- cur++; \
- } \
- }
-
-/**
- * xmlSchemaValidateDates:
- * @type: the predefined type
- * @dateTime: string to analyze
- * @val: the return computed value
- *
- * Check that @dateTime conforms to the lexical space of one of the date types.
- * if true a value is computed and returned in @val.
- *
- * Returns 0 if this validates, a positive error code number otherwise
- * and -1 in case of internal or API error.
- */
-static int
-xmlSchemaValidateDates (xmlSchemaTypePtr type ATTRIBUTE_UNUSED,
- const xmlChar *dateTime, xmlSchemaValPtr *val) {
- xmlSchemaValPtr dt;
- int ret;
- const xmlChar *cur = dateTime;
-
-#define RETURN_TYPE_IF_VALID(t) \
- if (IS_TZO_CHAR(*cur)) { \
- ret = _xmlSchemaParseTimeZone(&(dt->value.date), &cur); \
- if (ret == 0) { \
- if (*cur != 0) \
- goto error; \
- dt->type = t; \
- if (val != NULL) \
- *val = dt; \
- return 0; \
- } \
- }
-
- if (dateTime == NULL)
- return -1;
-
- if ((*cur != '-') && (*cur < '0') && (*cur > '9'))
- return 1;
-
- dt = xmlSchemaNewValue(XML_SCHEMAS_UNKNOWN);
- if (dt == NULL)
- return -1;
-
- if ((cur[0] == '-') && (cur[1] == '-')) {
- /*
- * It's an incomplete date (xs:gMonthDay, xs:gMonth or
- * xs:gDay)
- */
- cur += 2;
-
- /* is it an xs:gDay? */
- if (*cur == '-') {
- ++cur;
- ret = _xmlSchemaParseGDay(&(dt->value.date), &cur);
- if (ret != 0)
- goto error;
-
- RETURN_TYPE_IF_VALID(XML_SCHEMAS_GDAY);
-
- goto error;
- }
-
- /*
- * it should be an xs:gMonthDay or xs:gMonth
- */
- ret = _xmlSchemaParseGMonth(&(dt->value.date), &cur);
- if (ret != 0)
- goto error;
-
- if (*cur != '-')
- goto error;
- cur++;
-
- /* is it an xs:gMonth? */
- if (*cur == '-') {
- cur++;
- RETURN_TYPE_IF_VALID(XML_SCHEMAS_GMONTH);
- goto error;
- }
-
- /* it should be an xs:gMonthDay */
- ret = _xmlSchemaParseGDay(&(dt->value.date), &cur);
- if (ret != 0)
- goto error;
-
- RETURN_TYPE_IF_VALID(XML_SCHEMAS_GMONTHDAY);
-
- goto error;
- }
-
- /*
- * It's a right-truncated date or an xs:time.
- * Try to parse an xs:time then fallback on right-truncated dates.
- */
- if ((*cur >= '0') && (*cur <= '9')) {
- ret = _xmlSchemaParseTime(&(dt->value.date), &cur);
- if (ret == 0) {
- /* it's an xs:time */
- RETURN_TYPE_IF_VALID(XML_SCHEMAS_TIME);
- }
- }
-
- /* fallback on date parsing */
- cur = dateTime;
-
- ret = _xmlSchemaParseGYear(&(dt->value.date), &cur);
- if (ret != 0)
- goto error;
-
- /* is it an xs:gYear? */
- RETURN_TYPE_IF_VALID(XML_SCHEMAS_GYEAR);
-
- if (*cur != '-')
- goto error;
- cur++;
-
- ret = _xmlSchemaParseGMonth(&(dt->value.date), &cur);
- if (ret != 0)
- goto error;
-
- /* is it an xs:gYearMonth? */
- RETURN_TYPE_IF_VALID(XML_SCHEMAS_GYEARMONTH);
-
- if (*cur != '-')
- goto error;
- cur++;
-
- ret = _xmlSchemaParseGDay(&(dt->value.date), &cur);
- if ((ret != 0) || !VALID_DATE((&(dt->value.date))))
- goto error;
-
- /* is it an xs:date? */
- RETURN_TYPE_IF_VALID(XML_SCHEMAS_DATE);
-
- if (*cur != 'T')
- goto error;
- cur++;
-
- /* it should be an xs:dateTime */
- ret = _xmlSchemaParseTime(&(dt->value.date), &cur);
- if (ret != 0)
- goto error;
-
- ret = _xmlSchemaParseTimeZone(&(dt->value.date), &cur);
- if ((ret != 0) || (*cur != 0) || !VALID_DATETIME((&(dt->value.date))))
- goto error;
-
- dt->type = XML_SCHEMAS_DATETIME;
-
- if (val != NULL)
- *val = dt;
-
- return 0;
-
-error:
- if (dt != NULL)
- xmlSchemaFreeValue(dt);
- return 1;
-}
-
-/**
- * xmlSchemaValidateDuration:
- * @type: the predefined type
- * @duration: string to analyze
- * @val: the return computed value
- *
- * Check that @duration conforms to the lexical space of the duration type.
- * if true a value is computed and returned in @val.
- *
- * Returns 0 if this validates, a positive error code number otherwise
- * and -1 in case of internal or API error.
- */
-static int
-xmlSchemaValidateDuration (xmlSchemaTypePtr type ATTRIBUTE_UNUSED,
- const xmlChar *duration, xmlSchemaValPtr *val) {
- const xmlChar *cur = duration;
- xmlSchemaValPtr dur;
- int isneg = 0;
- unsigned int seq = 0;
-
- if (duration == NULL)
- return -1;
-
- if (*cur == '-') {
- isneg = 1;
- cur++;
- }
-
- /* duration must start with 'P' (after sign) */
- if (*cur++ != 'P')
- return 1;
-
- dur = xmlSchemaNewValue(XML_SCHEMAS_DURATION);
- if (dur == NULL)
- return -1;
-
- while (*cur != 0) {
- double num;
- int num_type = 0; /* -1 = invalid, 0 = int, 1 = floating */
- const xmlChar desig[] = {'Y', 'M', 'D', 'H', 'M', 'S'};
- const double multi[] = { 0.0, 0.0, 86400.0, 3600.0, 60.0, 1.0, 0.0};
-
- /* input string should be empty or invalid date/time item */
- if (seq >= sizeof(desig))
- goto error;
-
- /* T designator must be present for time items */
- if (*cur == 'T') {
- if (seq <= 3) {
- seq = 3;
- cur++;
- } else
- return 1;
- } else if (seq == 3)
- goto error;
-
- /* parse the number portion of the item */
- PARSE_NUM(num, cur, num_type);
-
- if ((num_type == -1) || (*cur == 0))
- goto error;
-
- /* update duration based on item type */
- while (seq < sizeof(desig)) {
- if (*cur == desig[seq]) {
-
- /* verify numeric type; only seconds can be float */
- if ((num_type != 0) && (seq < (sizeof(desig)-1)))
- goto error;
-
- switch (seq) {
- case 0:
- dur->value.dur.mon = (long)num * 12;
- break;
- case 1:
- dur->value.dur.mon += (long)num;
- break;
- default:
- /* convert to seconds using multiplier */
- dur->value.dur.sec += num * multi[seq];
- seq++;
- break;
- }
-
- break; /* exit loop */
- }
- /* no date designators found? */
- if (++seq == 3)
- goto error;
- }
- cur++;
- }
-
- if (isneg) {
- dur->value.dur.mon = -dur->value.dur.mon;
- dur->value.dur.day = -dur->value.dur.day;
- dur->value.dur.sec = -dur->value.dur.sec;
- }
-
- if (val != NULL)
- *val = dur;
-
- return 0;
-
-error:
- if (dur != NULL)
- xmlSchemaFreeValue(dur);
- return 1;
-}
-
-/**
- * xmlSchemaValidatePredefinedType:
- * @type: the predefined type
- * @value: the value to check
- * @val: the return computed value
- *
- * Check that a value conforms to the lexical space of the predefined type.
- * if true a value is computed and returned in @val.
- *
- * Returns 0 if this validates, a positive error code number otherwise
- * and -1 in case of internal or API error.
- */
-int
-xmlSchemaValidatePredefinedType(xmlSchemaTypePtr type, const xmlChar *value,
- xmlSchemaValPtr *val) {
- xmlSchemaValPtr v;
-
- if (xmlSchemaTypesInitialized == 0)
- return(-1);
- if (type == NULL)
- return(-1);
-
- if (val != NULL)
- *val = NULL;
- if (type == xmlSchemaTypeStringDef) {
- return(0);
- } else if (type == xmlSchemaTypeAnyTypeDef) {
- return(0);
- } else if (type == xmlSchemaTypeAnySimpleTypeDef) {
- return(0);
- } else if (type == xmlSchemaTypeNmtoken) {
- if (xmlValidateNmtokenValue(value))
- return(0);
- return(1);
- } else if (type == xmlSchemaTypeDecimalDef) {
- const xmlChar *cur = value, *tmp;
- int frac = 0, len, neg = 0;
- unsigned long base = 0;
- if (cur == NULL)
- return(1);
- if (*cur == '+')
- cur++;
- else if (*cur == '-') {
- neg = 1;
- cur++;
- }
- tmp = cur;
- while ((*cur >= '0') && (*cur <= '9')) {
- base = base * 10 + (*cur - '0');
- cur++;
- }
- len = cur - tmp;
- if (*cur == '.') {
- cur++;
- tmp = cur;
- while ((*cur >= '0') && (*cur <= '9')) {
- base = base * 10 + (*cur - '0');
- cur++;
- }
- frac = cur - tmp;
- }
- if (*cur != 0)
- return(1);
- if (val != NULL) {
- v = xmlSchemaNewValue(XML_SCHEMAS_DECIMAL);
- if (v != NULL) {
- v->value.decimal.base = base;
- v->value.decimal.sign = neg;
- v->value.decimal.frac = frac;
- v->value.decimal.total = frac + len;
- *val = v;
- }
- }
- return(0);
- } else if (type == xmlSchemaTypeDurationDef) {
- return xmlSchemaValidateDuration(type, value, val);
- } else if ((type == xmlSchemaTypeDatetimeDef) ||
- (type == xmlSchemaTypeTimeDef) ||
- (type == xmlSchemaTypeDateDef) ||
- (type == xmlSchemaTypeGYearDef) ||
- (type == xmlSchemaTypeGYearMonthDef) ||
- (type == xmlSchemaTypeGMonthDef) ||
- (type == xmlSchemaTypeGMonthDayDef) ||
- (type == xmlSchemaTypeGDayDef)) {
- return xmlSchemaValidateDates(type, value, val);
- } else if (type == xmlSchemaTypePositiveIntegerDef) {
- const xmlChar *cur = value;
- unsigned long base = 0;
- int total = 0;
- if (cur == NULL)
- return(1);
- if (*cur == '+')
- cur++;
- while ((*cur >= '0') && (*cur <= '9')) {
- base = base * 10 + (*cur - '0');
- total++;
- cur++;
- }
- if (*cur != 0)
- return(1);
- if (val != NULL) {
- v = xmlSchemaNewValue(XML_SCHEMAS_DECIMAL);
- if (v != NULL) {
- v->value.decimal.base = base;
- v->value.decimal.sign = 0;
- v->value.decimal.frac = 0;
- v->value.decimal.total = total;
- *val = v;
- }
- }
- return(0);
- } else if (type == xmlSchemaTypeNonNegativeIntegerDef) {
- const xmlChar *cur = value;
- unsigned long base = 0;
- int total = 0;
- int sign = 0;
- if (cur == NULL)
- return(1);
- if (*cur == '-') {
- sign = 1;
- cur++;
- } else if (*cur == '+')
- cur++;
- while ((*cur >= '0') && (*cur <= '9')) {
- base = base * 10 + (*cur - '0');
- total++;
- cur++;
- }
- if (*cur != 0)
- return(1);
- if ((sign == 1) && (base != 0))
- return(1);
- if (val != NULL) {
- v = xmlSchemaNewValue(XML_SCHEMAS_DECIMAL);
- if (v != NULL) {
- v->value.decimal.base = base;
- v->value.decimal.sign = 0;
- v->value.decimal.frac = 0;
- v->value.decimal.total = total;
- *val = v;
- }
- }
- return(0);
- } else if (type == xmlSchemaTypeFloatDef) {
- const xmlChar *cur = value, *tmp;
- int frac = 0, len, neg = 0;
- unsigned long base = 0;
- if (cur == NULL)
- return(1);
- if (*cur == '+')
- cur++;
- else if (*cur == '-') {
- neg = 1;
- cur++;
- }
- tmp = cur;
- while ((*cur >= '0') && (*cur <= '9')) {
- base = base * 10 + (*cur - '0');
- cur++;
- }
- len = cur - tmp;
- if (*cur == '.') {
- cur++;
- tmp = cur;
- while ((*cur >= '0') && (*cur <= '9')) {
- base = base * 10 + (*cur - '0');
- cur++;
- }
- frac = cur - tmp;
- }
- TODO
- return(0);
- } else if (type == xmlSchemaTypeDoubleDef) {
- TODO
- return(0);
- } else {
- TODO
- return(0);
- }
-}
-
-/**
- * xmlSchemaCompareDecimals:
- * @x: a first decimal value
- * @y: a second decimal value
- *
- * Compare 2 decimals
- *
- * Returns -1 if x < y, 0 if x == y, 1 if x > y and -2 in case of error
- */
-static int
-xmlSchemaCompareDecimals(xmlSchemaValPtr x, xmlSchemaValPtr y)
-{
- xmlSchemaValPtr swp;
- int order = 1;
- unsigned long tmp;
-
- if ((x->value.decimal.sign) && (x->value.decimal.sign))
- order = -1;
- else if (x->value.decimal.sign)
- return (-1);
- else if (y->value.decimal.sign)
- return (1);
- if (x->value.decimal.frac == y->value.decimal.frac) {
- if (x->value.decimal.base < y->value.decimal.base)
- return (-1);
- return (x->value.decimal.base > y->value.decimal.base);
- }
- if (y->value.decimal.frac > x->value.decimal.frac) {
- swp = y;
- y = x;
- x = swp;
- order = -order;
- }
- tmp =
- x->value.decimal.base / powten[x->value.decimal.frac -
- y->value.decimal.frac];
- if (tmp > y->value.decimal.base)
- return (order);
- if (tmp < y->value.decimal.base)
- return (-order);
- tmp =
- y->value.decimal.base * powten[x->value.decimal.frac -
- y->value.decimal.frac];
- if (x->value.decimal.base < tmp)
- return (-order);
- if (x->value.decimal.base == tmp)
- return (0);
- return (order);
-}
-
-/**
- * xmlSchemaCompareDurations:
- * @x: a first duration value
- * @y: a second duration value
- *
- * Compare 2 durations
- *
- * Returns -1 if x < y, 0 if x == y, 1 if x > y, 2 if x <> y, and -2 in
- * case of error
- */
-static int
-xmlSchemaCompareDurations(xmlSchemaValPtr x, xmlSchemaValPtr y)
-{
- long carry, mon, day;
- double sec;
- long xmon, xday, myear, lyear, minday, maxday;
- static const long dayRange [2][12] = {
- { 0, 28, 59, 89, 120, 150, 181, 212, 242, 273, 303, 334, },
- { 0, 31, 62, 92, 123, 153, 184, 215, 245, 276, 306, 337} };
-
- if ((x == NULL) || (y == NULL))
- return -2;
-
- /* months */
- mon = x->value.dur.mon - y->value.dur.mon;
-
- /* seconds */
- sec = x->value.dur.sec - y->value.dur.sec;
- carry = (long)sec / SECS_PER_DAY;
- sec -= (double)(carry * SECS_PER_DAY);
-
- /* days */
- day = x->value.dur.day - y->value.dur.day + carry;
-
- /* easy test */
- if (mon == 0) {
- if (day == 0)
- if (sec == 0.0)
- return 0;
- else if (sec < 0.0)
- return -1;
- else
- return 1;
- else if (day < 0)
- return -1;
- else
- return 1;
- }
-
- if (mon > 0) {
- if ((day >= 0) && (sec >= 0.0))
- return 1;
- else {
- xmon = mon;
- xday = -day;
- }
- } else if ((day <= 0) && (sec <= 0.0)) {
- return -1;
- } else {
- xmon = -mon;
- xday = day;
- }
-
- myear = xmon / 12;
- lyear = myear / 4;
- minday = (myear * 365) + (lyear != 0 ? lyear - 1 : 0);
- maxday = (myear * 365) + (lyear != 0 ? lyear + 1 : 0);
-
- xmon = xmon % 12;
- minday += dayRange[0][xmon];
- maxday += dayRange[1][xmon];
-
- if (maxday < xday)
- return 1;
- else if (minday > xday)
- return -1;
-
- /* indeterminate */
- return 2;
-}
-
-/*
- * macros for adding date/times and durations
- */
-#define FQUOTIENT(a,b) (floor(((double)a/(double)b)))
-#define MODULO(a,b) (a - FQUOTIENT(a,b) * b)
-#define FQUOTIENT_RANGE(a,low,high) (FQUOTIENT((a-low),(high-low)))
-#define MODULO_RANGE(a,low,high) ((MODULO((a-low),(high-low)))+low)
-
-/**
- * _xmlSchemaDateAdd:
- * @dt: an #xmlSchemaValPtr
- * @dur: an #xmlSchemaValPtr of type #XS_DURATION
- *
- * Compute a new date/time from @dt and @dur. This function assumes @dt
- * is either #XML_SCHEMAS_DATETIME, #XML_SCHEMAS_DATE, #XML_SCHEMAS_GYEARMONTH,
- * or #XML_SCHEMAS_GYEAR.
- *
- * Returns date/time pointer or NULL.
- */
-static xmlSchemaValPtr
-_xmlSchemaDateAdd (xmlSchemaValPtr dt, xmlSchemaValPtr dur)
-{
- xmlSchemaValPtr ret;
- long carry, tempdays, temp;
- xmlSchemaValDatePtr r, d;
- xmlSchemaValDurationPtr u;
-
- if ((dt == NULL) || (dur == NULL))
- return NULL;
-
- ret = xmlSchemaNewValue(dt->type);
- if (ret == NULL)
- return NULL;
-
- r = &(ret->value.date);
- d = &(dt->value.date);
- u = &(dur->value.dur);
-
- /* normalization */
- if (d->mon == 0)
- d->mon = 1;
-
- /* normalize for time zone offset */
- u->sec -= (d->tzo * 60);
- d->tzo = 0;
-
- /* normalization */
- if (d->day == 0)
- d->day = 1;
-
- /* month */
- carry = d->mon + u->mon;
- r->mon = MODULO_RANGE(carry, 1, 13);
- carry = FQUOTIENT_RANGE(carry, 1, 13);
-
- /* year (may be modified later) */
- r->year = d->year + carry;
- if (r->year == 0) {
- if (d->year > 0)
- r->year--;
- else
- r->year++;
- }
-
- /* time zone */
- r->tzo = d->tzo;
- r->tz_flag = d->tz_flag;
-
- /* seconds */
- r->sec = d->sec + u->sec;
- carry = FQUOTIENT((long)r->sec, 60);
- if (r->sec != 0.0) {
- r->sec = MODULO(r->sec, 60.0);
- }
-
- /* minute */
- carry += d->min;
- r->min = MODULO(carry, 60);
- carry = FQUOTIENT(carry, 60);
-
- /* hours */
- carry += d->hour;
- r->hour = MODULO(carry, 24);
- carry = FQUOTIENT(carry, 24);
-
- /*
- * days
- * Note we use tempdays because the temporary values may need more
- * than 5 bits
- */
- if ((VALID_YEAR(r->year)) && (VALID_MONTH(r->mon)) &&
- (d->day > MAX_DAYINMONTH(r->year, r->mon)))
- tempdays = MAX_DAYINMONTH(r->year, r->mon);
- else if (d->day < 1)
- tempdays = 1;
- else
- tempdays = d->day;
-
- tempdays += u->day + carry;
-
- while (1) {
- if (tempdays < 1) {
- long tmon = MODULO_RANGE(r->mon-1, 1, 13);
- long tyr = r->year + FQUOTIENT_RANGE(r->mon-1, 1, 13);
- if (tyr == 0)
- tyr--;
- tempdays += MAX_DAYINMONTH(tyr, tmon);
- carry = -1;
- } else if (tempdays > MAX_DAYINMONTH(r->year, r->mon)) {
- tempdays = tempdays - MAX_DAYINMONTH(r->year, r->mon);
- carry = 1;
- } else
- break;
-
- temp = r->mon + carry;
- r->mon = MODULO_RANGE(temp, 1, 13);
- r->year = r->year + FQUOTIENT_RANGE(temp, 1, 13);
- if (r->year == 0) {
- if (temp < 1)
- r->year--;
- else
- r->year++;
- }
- }
-
- r->day = tempdays;
-
- /*
- * adjust the date/time type to the date values
- */
- if (ret->type != XML_SCHEMAS_DATETIME) {
- if ((r->hour) || (r->min) || (r->sec))
- ret->type = XML_SCHEMAS_DATETIME;
- else if (ret->type != XML_SCHEMAS_DATE) {
- if ((r->mon != 1) && (r->day != 1))
- ret->type = XML_SCHEMAS_DATE;
- else if ((ret->type != XML_SCHEMAS_GYEARMONTH) && (r->mon != 1))
- ret->type = XML_SCHEMAS_GYEARMONTH;
- }
- }
-
- return ret;
-}
-
-/**
- * xmlSchemaDupVal:
- * @v: value to duplicate
- *
- * returns a duplicated value.
- */
-static xmlSchemaValPtr
-xmlSchemaDupVal (xmlSchemaValPtr v)
-{
- xmlSchemaValPtr ret = xmlSchemaNewValue(v->type);
- if (ret == NULL)
- return ret;
-
- memcpy(ret, v, sizeof(xmlSchemaVal));
- return ret;
-}
-
-/**
- * xmlSchemaDateNormalize:
- * @dt: an #xmlSchemaValPtr
- *
- * Normalize @dt to GMT time.
- *
- */
-static xmlSchemaValPtr
-xmlSchemaDateNormalize (xmlSchemaValPtr dt, double offset)
-{
- xmlSchemaValPtr dur, ret;
-
- if (dt == NULL)
- return NULL;
-
- if (((dt->type != XML_SCHEMAS_TIME) &&
- (dt->type != XML_SCHEMAS_DATETIME)) || (dt->value.date.tzo == 0))
- return xmlSchemaDupVal(dt);
-
- dur = xmlSchemaNewValue(XML_SCHEMAS_DURATION);
- if (dur == NULL)
- return NULL;
-
- dur->value.date.sec -= offset;
-
- ret = _xmlSchemaDateAdd(dt, dur);
- if (ret == NULL)
- return NULL;
-
- xmlSchemaFreeValue(dur);
-
- /* ret->value.date.tzo = 0; */
- return ret;
-}
-
-/**
- * _xmlSchemaDateCastYMToDays:
- * @dt: an #xmlSchemaValPtr
- *
- * Convert mon and year of @dt to total number of days. Take the
- * number of years since (or before) 1 AD and add the number of leap
- * years. This is a function because negative
- * years must be handled a little differently and there is no zero year.
- *
- * Returns number of days.
- */
-static long
-_xmlSchemaDateCastYMToDays (const xmlSchemaValPtr dt)
-{
- long ret;
-
- if (dt->value.date.year < 0)
- ret = (dt->value.date.year * 365) +
- (((dt->value.date.year+1)/4)-((dt->value.date.year+1)/100)+
- ((dt->value.date.year+1)/400)) +
- DAY_IN_YEAR(0, dt->value.date.mon, dt->value.date.year);
- else
- ret = ((dt->value.date.year-1) * 365) +
- (((dt->value.date.year-1)/4)-((dt->value.date.year-1)/100)+
- ((dt->value.date.year-1)/400)) +
- DAY_IN_YEAR(0, dt->value.date.mon, dt->value.date.year);
-
- return ret;
-}
-
-/**
- * TIME_TO_NUMBER:
- * @dt: an #xmlSchemaValPtr
- *
- * Calculates the number of seconds in the time portion of @dt.
- *
- * Returns seconds.
- */
-#define TIME_TO_NUMBER(dt) \
- ((double)((dt->value.date.hour * SECS_PER_HOUR) + \
- (dt->value.date.min * SECS_PER_MIN)) + dt->value.date.sec)
-
-/**
- * xmlSchemaCompareDates:
- * @x: a first date/time value
- * @y: a second date/time value
- *
- * Compare 2 date/times
- *
- * Returns -1 if x < y, 0 if x == y, 1 if x > y, 2 if x <> y, and -2 in
- * case of error
- */
-static int
-xmlSchemaCompareDates (xmlSchemaValPtr x, xmlSchemaValPtr y)
-{
- unsigned char xmask, ymask, xor_mask, and_mask;
- xmlSchemaValPtr p1, p2, q1, q2;
- long p1d, p2d, q1d, q2d;
-
- if ((x == NULL) || (y == NULL))
- return -2;
-
- if (x->value.date.tz_flag) {
-
- if (!y->value.date.tz_flag) {
- p1 = xmlSchemaDateNormalize(x, 0);
- p1d = _xmlSchemaDateCastYMToDays(p1) + p1->value.date.day;
- /* normalize y + 14:00 */
- q1 = xmlSchemaDateNormalize(y, (14 * SECS_PER_HOUR));
-
- q1d = _xmlSchemaDateCastYMToDays(q1) + q1->value.date.day;
- if (p1d < q1d) {
- xmlSchemaFreeValue(p1);
- xmlSchemaFreeValue(q1);
- return -1;
- } else if (p1d == q1d) {
- double sec;
-
- sec = TIME_TO_NUMBER(p1) - TIME_TO_NUMBER(q1);
- if (sec < 0.0) {
- xmlSchemaFreeValue(p1);
- xmlSchemaFreeValue(q1);
- return -1;
- } else {
- /* normalize y - 14:00 */
- q2 = xmlSchemaDateNormalize(y, -(14 * SECS_PER_HOUR));
- q2d = _xmlSchemaDateCastYMToDays(q2) + q2->value.date.day;
- xmlSchemaFreeValue(p1);
- xmlSchemaFreeValue(q1);
- xmlSchemaFreeValue(q2);
- if (p1d > q2d)
- return 1;
- else if (p1d == q2d) {
- sec = TIME_TO_NUMBER(p1) - TIME_TO_NUMBER(q2);
- if (sec > 0.0)
- return 1;
- else
- return 2; /* indeterminate */
- }
- }
- } else {
- xmlSchemaFreeValue(p1);
- xmlSchemaFreeValue(q1);
- }
- }
- } else if (y->value.date.tz_flag) {
- q1 = xmlSchemaDateNormalize(y, 0);
- q1d = _xmlSchemaDateCastYMToDays(q1) + q1->value.date.day;
-
- /* normalize x - 14:00 */
- p1 = xmlSchemaDateNormalize(x, -(14 * SECS_PER_HOUR));
- p1d = _xmlSchemaDateCastYMToDays(p1) + p1->value.date.day;
-
- if (p1d < q1d) {
- xmlSchemaFreeValue(p1);
- xmlSchemaFreeValue(q1);
- return -1;
- } else if (p1d == q1d) {
- double sec;
-
- sec = TIME_TO_NUMBER(p1) - TIME_TO_NUMBER(q1);
- if (sec < 0.0) {
- xmlSchemaFreeValue(p1);
- xmlSchemaFreeValue(q1);
- return -1;
- } else {
- /* normalize x + 14:00 */
- p2 = xmlSchemaDateNormalize(x, (14 * SECS_PER_HOUR));
- p2d = _xmlSchemaDateCastYMToDays(p2) + p2->value.date.day;
-
- xmlSchemaFreeValue(p1);
- xmlSchemaFreeValue(q1);
- xmlSchemaFreeValue(p2);
- if (p2d > q1d)
- return 1;
- else if (p2d == q1d) {
- sec = TIME_TO_NUMBER(p2) - TIME_TO_NUMBER(q1);
- if (sec > 0.0)
- return 1;
- else
- return 2; /* indeterminate */
- }
- }
- } else {
- xmlSchemaFreeValue(p1);
- xmlSchemaFreeValue(q1);
- }
- }
-
- /*
- * if the same type then calculate the difference
- */
- if (x->type == y->type) {
- q1 = xmlSchemaDateNormalize(y, 0);
- q1d = _xmlSchemaDateCastYMToDays(q1) + q1->value.date.day;
-
- p1 = xmlSchemaDateNormalize(x, 0);
- p1d = _xmlSchemaDateCastYMToDays(p1) + p1->value.date.day;
-
- if (p1d < q1d) {
- xmlSchemaFreeValue(p1);
- xmlSchemaFreeValue(q1);
- return -1;
- } else if (p1d > q1d) {
- xmlSchemaFreeValue(p1);
- xmlSchemaFreeValue(q1);
- return 1;
- } else {
- double sec;
-
- sec = TIME_TO_NUMBER(p1) - TIME_TO_NUMBER(q1);
- xmlSchemaFreeValue(p1);
- xmlSchemaFreeValue(q1);
- if (sec < 0.0)
- return -1;
- else if (sec > 0.0)
- return 1;
-
- }
- return 0;
- }
-
- switch (x->type) {
- case XML_SCHEMAS_DATETIME:
- xmask = 0xf;
- break;
- case XML_SCHEMAS_DATE:
- xmask = 0x7;
- break;
- case XML_SCHEMAS_GYEAR:
- xmask = 0x1;
- break;
- case XML_SCHEMAS_GMONTH:
- xmask = 0x2;
- break;
- case XML_SCHEMAS_GDAY:
- xmask = 0x3;
- break;
- case XML_SCHEMAS_GYEARMONTH:
- xmask = 0x3;
- break;
- case XML_SCHEMAS_GMONTHDAY:
- xmask = 0x6;
- break;
- case XML_SCHEMAS_TIME:
- xmask = 0x8;
- break;
- default:
- xmask = 0;
- break;
- }
-
- switch (y->type) {
- case XML_SCHEMAS_DATETIME:
- ymask = 0xf;
- break;
- case XML_SCHEMAS_DATE:
- ymask = 0x7;
- break;
- case XML_SCHEMAS_GYEAR:
- ymask = 0x1;
- break;
- case XML_SCHEMAS_GMONTH:
- ymask = 0x2;
- break;
- case XML_SCHEMAS_GDAY:
- ymask = 0x3;
- break;
- case XML_SCHEMAS_GYEARMONTH:
- ymask = 0x3;
- break;
- case XML_SCHEMAS_GMONTHDAY:
- ymask = 0x6;
- break;
- case XML_SCHEMAS_TIME:
- ymask = 0x8;
- break;
- default:
- ymask = 0;
- break;
- }
-
- xor_mask = xmask ^ ymask; /* mark type differences */
- and_mask = xmask & ymask; /* mark field specification */
-
- /* year */
- if (xor_mask & 1)
- return 2; /* indeterminate */
- else if (and_mask & 1) {
- if (x->value.date.year < y->value.date.year)
- return -1;
- else if (x->value.date.year > y->value.date.year)
- return 1;
- }
-
- /* month */
- if (xor_mask & 2)
- return 2; /* indeterminate */
- else if (and_mask & 2) {
- if (x->value.date.mon < y->value.date.mon)
- return -1;
- else if (x->value.date.mon > y->value.date.mon)
- return 1;
- }
-
- /* day */
- if (xor_mask & 4)
- return 2; /* indeterminate */
- else if (and_mask & 4) {
- if (x->value.date.day < y->value.date.day)
- return -1;
- else if (x->value.date.day > y->value.date.day)
- return 1;
- }
-
- /* time */
- if (xor_mask & 8)
- return 2; /* indeterminate */
- else if (and_mask & 8) {
- if (x->value.date.hour < y->value.date.hour)
- return -1;
- else if (x->value.date.hour > y->value.date.hour)
- return 1;
- else if (x->value.date.min < y->value.date.min)
- return -1;
- else if (x->value.date.min > y->value.date.min)
- return 1;
- else if (x->value.date.sec < y->value.date.sec)
- return -1;
- else if (x->value.date.sec > y->value.date.sec)
- return 1;
- }
-
- return 0;
-}
-
-/**
- * xmlSchemaCompareValues:
- * @x: a first value
- * @y: a second value
- *
- * Compare 2 values
- *
- * Returns -1 if x < y, 0 if x == y, 1 if x > y, 2 if x <> y, and -2 in
- * case of error
- */
-static int
-xmlSchemaCompareValues(xmlSchemaValPtr x, xmlSchemaValPtr y) {
- if ((x == NULL) || (y == NULL))
- return(-2);
-
- switch (x->type) {
- case XML_SCHEMAS_STRING:
- TODO
- case XML_SCHEMAS_DECIMAL:
- if (y->type == XML_SCHEMAS_DECIMAL)
- return(xmlSchemaCompareDecimals(x, y));
- return(-2);
- case XML_SCHEMAS_DURATION:
- if (y->type == XML_SCHEMAS_DURATION)
- return(xmlSchemaCompareDurations(x, y));
- return(-2);
- case XML_SCHEMAS_TIME:
- case XML_SCHEMAS_GDAY:
- case XML_SCHEMAS_GMONTH:
- case XML_SCHEMAS_GMONTHDAY:
- case XML_SCHEMAS_GYEAR:
- case XML_SCHEMAS_GYEARMONTH:
- case XML_SCHEMAS_DATE:
- case XML_SCHEMAS_DATETIME:
- if ((y->type == XML_SCHEMAS_DATETIME) ||
- (y->type == XML_SCHEMAS_TIME) ||
- (y->type == XML_SCHEMAS_GDAY) ||
- (y->type == XML_SCHEMAS_GMONTH) ||
- (y->type == XML_SCHEMAS_GMONTHDAY) ||
- (y->type == XML_SCHEMAS_GYEAR) ||
- (y->type == XML_SCHEMAS_DATE) ||
- (y->type == XML_SCHEMAS_GYEARMONTH))
- return (xmlSchemaCompareDates(x, y));
-
- return (-2);
- default:
- TODO
- }
- return -2;
-}
-
-/**
- * xmlSchemaValidateFacet:
- * @base: the base type
- * @facet: the facet to check
- * @value: the lexical repr of the value to validate
- * @val: the precomputed value
- *
- * Check a value against a facet condition
- *
- * Returns 0 if the element is schemas valid, a positive error code
- * number otherwise and -1 in case of internal or API error.
- */
-int
-xmlSchemaValidateFacet(xmlSchemaTypePtr base ATTRIBUTE_UNUSED,
- xmlSchemaFacetPtr facet,
- const xmlChar *value, xmlSchemaValPtr val)
-{
- int ret;
-
- switch (facet->type) {
- case XML_SCHEMA_FACET_PATTERN:
- ret = xmlRegexpExec(facet->regexp, value);
- if (ret == 1)
- return(0);
- if (ret == 0) {
- TODO /* error code */
- return(1);
- }
- return(ret);
- case XML_SCHEMA_FACET_MAXEXCLUSIVE:
- ret = xmlSchemaCompareValues(val, facet->val);
- if (ret == -2) {
- TODO /* error code */
- return(-1);
- }
- if (ret == -1)
- return(0);
- /* error code */
- return(1);
- case XML_SCHEMA_FACET_MAXINCLUSIVE:
- ret = xmlSchemaCompareValues(val, facet->val);
- if (ret == -2) {
- TODO /* error code */
- return(-1);
- }
- if ((ret == -1) || (ret == 0))
- return(0);
- /* error code */
- return(1);
- case XML_SCHEMA_FACET_MINEXCLUSIVE:
- ret = xmlSchemaCompareValues(val, facet->val);
- if (ret == -2) {
- TODO /* error code */
- return(-1);
- }
- if (ret == 1)
- return(0);
- /* error code */
- return(1);
- case XML_SCHEMA_FACET_MININCLUSIVE:
- ret = xmlSchemaCompareValues(val, facet->val);
- if (ret == -2) {
- TODO /* error code */
- return(-1);
- }
- if ((ret == 1) || (ret == 0))
- return(0);
- /* error code */
- return(1);
- case XML_SCHEMA_FACET_WHITESPACE:
- TODO /* whitespaces */
- return(0);
- case XML_SCHEMA_FACET_MAXLENGTH:
- if ((facet->val != NULL) &&
- (facet->val->type == XML_SCHEMAS_DECIMAL) &&
- (facet->val->value.decimal.frac == 0)) {
- unsigned int len;
-
- if (facet->val->value.decimal.sign == 1)
- return(1);
- len = xmlUTF8Strlen(value);
- if (len > facet->val->value.decimal.base)
- return(1);
- return(0);
- }
- TODO /* error code */
- return(1);
- case XML_SCHEMA_FACET_ENUMERATION:
- if ((facet->value != NULL) &&
- (xmlStrEqual(facet->value, value)))
- return(0);
- return(1);
- default:
- TODO
- }
- return(0);
-}
-
-#endif /* LIBXML_SCHEMAS_ENABLED */
diff --git a/bundle/libxml/xmlunicode.c b/bundle/libxml/xmlunicode.c
deleted file mode 100644
index 8baf8d18c7..0000000000
--- a/bundle/libxml/xmlunicode.c
+++ /dev/null
@@ -1,4290 +0,0 @@
-/*
- * xmlunicode.c: this module implements the Unicode character APIs
- *
- * This file is automatically generated from the
- * UCS description files of the Unicode Character Database
- * http://www.unicode.org/Public/3.1-Update/UnicodeCharacterDatabase-3.1.0.html
- * using the genUnicode.py Python script.
- *
- * Generation date: Tue Apr 16 17:28:05 2002
- * Sources: Blocks-4.txt UnicodeData-3.1.0.txt
- * Daniel Veillard <veillard@redhat.com>
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-#ifdef LIBXML_UNICODE_ENABLED
-
-#include <string.h>
-#include <libxml/xmlversion.h>
-#include <libxml/xmlunicode.h>
-
-/**
- * xmlUCSIsAlphabeticPresentationForms:
- * @code: UCS code point
- *
- * Check whether the character is part of AlphabeticPresentationForms UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsAlphabeticPresentationForms(int code) {
- return((code >= 0xFB00) && (code <= 0xFB4F));
-}
-
-/**
- * xmlUCSIsArabic:
- * @code: UCS code point
- *
- * Check whether the character is part of Arabic UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsArabic(int code) {
- return((code >= 0x0600) && (code <= 0x06FF));
-}
-
-/**
- * xmlUCSIsArabicPresentationFormsA:
- * @code: UCS code point
- *
- * Check whether the character is part of ArabicPresentationForms-A UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsArabicPresentationFormsA(int code) {
- return((code >= 0xFB50) && (code <= 0xFDFF));
-}
-
-/**
- * xmlUCSIsArabicPresentationFormsB:
- * @code: UCS code point
- *
- * Check whether the character is part of ArabicPresentationForms-B UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsArabicPresentationFormsB(int code) {
- return((code >= 0xFE70) && (code <= 0xFEFE));
-}
-
-/**
- * xmlUCSIsArmenian:
- * @code: UCS code point
- *
- * Check whether the character is part of Armenian UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsArmenian(int code) {
- return((code >= 0x0530) && (code <= 0x058F));
-}
-
-/**
- * xmlUCSIsArrows:
- * @code: UCS code point
- *
- * Check whether the character is part of Arrows UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsArrows(int code) {
- return((code >= 0x2190) && (code <= 0x21FF));
-}
-
-/**
- * xmlUCSIsBasicLatin:
- * @code: UCS code point
- *
- * Check whether the character is part of BasicLatin UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsBasicLatin(int code) {
- return((code >= 0x0000) && (code <= 0x007F));
-}
-
-/**
- * xmlUCSIsBengali:
- * @code: UCS code point
- *
- * Check whether the character is part of Bengali UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsBengali(int code) {
- return((code >= 0x0980) && (code <= 0x09FF));
-}
-
-/**
- * xmlUCSIsBlockElements:
- * @code: UCS code point
- *
- * Check whether the character is part of BlockElements UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsBlockElements(int code) {
- return((code >= 0x2580) && (code <= 0x259F));
-}
-
-/**
- * xmlUCSIsBopomofo:
- * @code: UCS code point
- *
- * Check whether the character is part of Bopomofo UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsBopomofo(int code) {
- return((code >= 0x3100) && (code <= 0x312F));
-}
-
-/**
- * xmlUCSIsBopomofoExtended:
- * @code: UCS code point
- *
- * Check whether the character is part of BopomofoExtended UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsBopomofoExtended(int code) {
- return((code >= 0x31A0) && (code <= 0x31BF));
-}
-
-/**
- * xmlUCSIsBoxDrawing:
- * @code: UCS code point
- *
- * Check whether the character is part of BoxDrawing UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsBoxDrawing(int code) {
- return((code >= 0x2500) && (code <= 0x257F));
-}
-
-/**
- * xmlUCSIsBraillePatterns:
- * @code: UCS code point
- *
- * Check whether the character is part of BraillePatterns UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsBraillePatterns(int code) {
- return((code >= 0x2800) && (code <= 0x28FF));
-}
-
-/**
- * xmlUCSIsByzantineMusicalSymbols:
- * @code: UCS code point
- *
- * Check whether the character is part of ByzantineMusicalSymbols UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsByzantineMusicalSymbols(int code) {
- return((code >= 0x1D000) && (code <= 0x1D0FF));
-}
-
-/**
- * xmlUCSIsCJKCompatibility:
- * @code: UCS code point
- *
- * Check whether the character is part of CJKCompatibility UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCJKCompatibility(int code) {
- return((code >= 0x3300) && (code <= 0x33FF));
-}
-
-/**
- * xmlUCSIsCJKCompatibilityForms:
- * @code: UCS code point
- *
- * Check whether the character is part of CJKCompatibilityForms UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCJKCompatibilityForms(int code) {
- return((code >= 0xFE30) && (code <= 0xFE4F));
-}
-
-/**
- * xmlUCSIsCJKCompatibilityIdeographs:
- * @code: UCS code point
- *
- * Check whether the character is part of CJKCompatibilityIdeographs UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCJKCompatibilityIdeographs(int code) {
- return((code >= 0xF900) && (code <= 0xFAFF));
-}
-
-/**
- * xmlUCSIsCJKCompatibilityIdeographsSupplement:
- * @code: UCS code point
- *
- * Check whether the character is part of CJKCompatibilityIdeographsSupplement UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCJKCompatibilityIdeographsSupplement(int code) {
- return((code >= 0x2F800) && (code <= 0x2FA1F));
-}
-
-/**
- * xmlUCSIsCJKRadicalsSupplement:
- * @code: UCS code point
- *
- * Check whether the character is part of CJKRadicalsSupplement UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCJKRadicalsSupplement(int code) {
- return((code >= 0x2E80) && (code <= 0x2EFF));
-}
-
-/**
- * xmlUCSIsCJKSymbolsandPunctuation:
- * @code: UCS code point
- *
- * Check whether the character is part of CJKSymbolsandPunctuation UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCJKSymbolsandPunctuation(int code) {
- return((code >= 0x3000) && (code <= 0x303F));
-}
-
-/**
- * xmlUCSIsCJKUnifiedIdeographs:
- * @code: UCS code point
- *
- * Check whether the character is part of CJKUnifiedIdeographs UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCJKUnifiedIdeographs(int code) {
- return((code >= 0x4E00) && (code <= 0x9FFF));
-}
-
-/**
- * xmlUCSIsCJKUnifiedIdeographsExtensionA:
- * @code: UCS code point
- *
- * Check whether the character is part of CJKUnifiedIdeographsExtensionA UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCJKUnifiedIdeographsExtensionA(int code) {
- return((code >= 0x3400) && (code <= 0x4DB5));
-}
-
-/**
- * xmlUCSIsCJKUnifiedIdeographsExtensionB:
- * @code: UCS code point
- *
- * Check whether the character is part of CJKUnifiedIdeographsExtensionB UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCJKUnifiedIdeographsExtensionB(int code) {
- return((code >= 0x20000) && (code <= 0x2A6D6));
-}
-
-/**
- * xmlUCSIsCherokee:
- * @code: UCS code point
- *
- * Check whether the character is part of Cherokee UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCherokee(int code) {
- return((code >= 0x13A0) && (code <= 0x13FF));
-}
-
-/**
- * xmlUCSIsCombiningDiacriticalMarks:
- * @code: UCS code point
- *
- * Check whether the character is part of CombiningDiacriticalMarks UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCombiningDiacriticalMarks(int code) {
- return((code >= 0x0300) && (code <= 0x036F));
-}
-
-/**
- * xmlUCSIsCombiningHalfMarks:
- * @code: UCS code point
- *
- * Check whether the character is part of CombiningHalfMarks UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCombiningHalfMarks(int code) {
- return((code >= 0xFE20) && (code <= 0xFE2F));
-}
-
-/**
- * xmlUCSIsCombiningMarksforSymbols:
- * @code: UCS code point
- *
- * Check whether the character is part of CombiningMarksforSymbols UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCombiningMarksforSymbols(int code) {
- return((code >= 0x20D0) && (code <= 0x20FF));
-}
-
-/**
- * xmlUCSIsControlPictures:
- * @code: UCS code point
- *
- * Check whether the character is part of ControlPictures UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsControlPictures(int code) {
- return((code >= 0x2400) && (code <= 0x243F));
-}
-
-/**
- * xmlUCSIsCurrencySymbols:
- * @code: UCS code point
- *
- * Check whether the character is part of CurrencySymbols UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCurrencySymbols(int code) {
- return((code >= 0x20A0) && (code <= 0x20CF));
-}
-
-/**
- * xmlUCSIsCyrillic:
- * @code: UCS code point
- *
- * Check whether the character is part of Cyrillic UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCyrillic(int code) {
- return((code >= 0x0400) && (code <= 0x04FF));
-}
-
-/**
- * xmlUCSIsDeseret:
- * @code: UCS code point
- *
- * Check whether the character is part of Deseret UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsDeseret(int code) {
- return((code >= 0x10400) && (code <= 0x1044F));
-}
-
-/**
- * xmlUCSIsDevanagari:
- * @code: UCS code point
- *
- * Check whether the character is part of Devanagari UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsDevanagari(int code) {
- return((code >= 0x0900) && (code <= 0x097F));
-}
-
-/**
- * xmlUCSIsDingbats:
- * @code: UCS code point
- *
- * Check whether the character is part of Dingbats UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsDingbats(int code) {
- return((code >= 0x2700) && (code <= 0x27BF));
-}
-
-/**
- * xmlUCSIsEnclosedAlphanumerics:
- * @code: UCS code point
- *
- * Check whether the character is part of EnclosedAlphanumerics UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsEnclosedAlphanumerics(int code) {
- return((code >= 0x2460) && (code <= 0x24FF));
-}
-
-/**
- * xmlUCSIsEnclosedCJKLettersandMonths:
- * @code: UCS code point
- *
- * Check whether the character is part of EnclosedCJKLettersandMonths UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsEnclosedCJKLettersandMonths(int code) {
- return((code >= 0x3200) && (code <= 0x32FF));
-}
-
-/**
- * xmlUCSIsEthiopic:
- * @code: UCS code point
- *
- * Check whether the character is part of Ethiopic UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsEthiopic(int code) {
- return((code >= 0x1200) && (code <= 0x137F));
-}
-
-/**
- * xmlUCSIsGeneralPunctuation:
- * @code: UCS code point
- *
- * Check whether the character is part of GeneralPunctuation UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsGeneralPunctuation(int code) {
- return((code >= 0x2000) && (code <= 0x206F));
-}
-
-/**
- * xmlUCSIsGeometricShapes:
- * @code: UCS code point
- *
- * Check whether the character is part of GeometricShapes UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsGeometricShapes(int code) {
- return((code >= 0x25A0) && (code <= 0x25FF));
-}
-
-/**
- * xmlUCSIsGeorgian:
- * @code: UCS code point
- *
- * Check whether the character is part of Georgian UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsGeorgian(int code) {
- return((code >= 0x10A0) && (code <= 0x10FF));
-}
-
-/**
- * xmlUCSIsGothic:
- * @code: UCS code point
- *
- * Check whether the character is part of Gothic UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsGothic(int code) {
- return((code >= 0x10330) && (code <= 0x1034F));
-}
-
-/**
- * xmlUCSIsGreek:
- * @code: UCS code point
- *
- * Check whether the character is part of Greek UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsGreek(int code) {
- return((code >= 0x0370) && (code <= 0x03FF));
-}
-
-/**
- * xmlUCSIsGreekExtended:
- * @code: UCS code point
- *
- * Check whether the character is part of GreekExtended UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsGreekExtended(int code) {
- return((code >= 0x1F00) && (code <= 0x1FFF));
-}
-
-/**
- * xmlUCSIsGujarati:
- * @code: UCS code point
- *
- * Check whether the character is part of Gujarati UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsGujarati(int code) {
- return((code >= 0x0A80) && (code <= 0x0AFF));
-}
-
-/**
- * xmlUCSIsGurmukhi:
- * @code: UCS code point
- *
- * Check whether the character is part of Gurmukhi UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsGurmukhi(int code) {
- return((code >= 0x0A00) && (code <= 0x0A7F));
-}
-
-/**
- * xmlUCSIsHalfwidthandFullwidthForms:
- * @code: UCS code point
- *
- * Check whether the character is part of HalfwidthandFullwidthForms UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsHalfwidthandFullwidthForms(int code) {
- return((code >= 0xFF00) && (code <= 0xFFEF));
-}
-
-/**
- * xmlUCSIsHangulCompatibilityJamo:
- * @code: UCS code point
- *
- * Check whether the character is part of HangulCompatibilityJamo UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsHangulCompatibilityJamo(int code) {
- return((code >= 0x3130) && (code <= 0x318F));
-}
-
-/**
- * xmlUCSIsHangulJamo:
- * @code: UCS code point
- *
- * Check whether the character is part of HangulJamo UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsHangulJamo(int code) {
- return((code >= 0x1100) && (code <= 0x11FF));
-}
-
-/**
- * xmlUCSIsHangulSyllables:
- * @code: UCS code point
- *
- * Check whether the character is part of HangulSyllables UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsHangulSyllables(int code) {
- return((code >= 0xAC00) && (code <= 0xD7A3));
-}
-
-/**
- * xmlUCSIsHebrew:
- * @code: UCS code point
- *
- * Check whether the character is part of Hebrew UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsHebrew(int code) {
- return((code >= 0x0590) && (code <= 0x05FF));
-}
-
-/**
- * xmlUCSIsHighPrivateUseSurrogates:
- * @code: UCS code point
- *
- * Check whether the character is part of HighPrivateUseSurrogates UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsHighPrivateUseSurrogates(int code) {
- return((code >= 0xDB80) && (code <= 0xDBFF));
-}
-
-/**
- * xmlUCSIsHighSurrogates:
- * @code: UCS code point
- *
- * Check whether the character is part of HighSurrogates UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsHighSurrogates(int code) {
- return((code >= 0xD800) && (code <= 0xDB7F));
-}
-
-/**
- * xmlUCSIsHiragana:
- * @code: UCS code point
- *
- * Check whether the character is part of Hiragana UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsHiragana(int code) {
- return((code >= 0x3040) && (code <= 0x309F));
-}
-
-/**
- * xmlUCSIsIPAExtensions:
- * @code: UCS code point
- *
- * Check whether the character is part of IPAExtensions UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsIPAExtensions(int code) {
- return((code >= 0x0250) && (code <= 0x02AF));
-}
-
-/**
- * xmlUCSIsIdeographicDescriptionCharacters:
- * @code: UCS code point
- *
- * Check whether the character is part of IdeographicDescriptionCharacters UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsIdeographicDescriptionCharacters(int code) {
- return((code >= 0x2FF0) && (code <= 0x2FFF));
-}
-
-/**
- * xmlUCSIsKanbun:
- * @code: UCS code point
- *
- * Check whether the character is part of Kanbun UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsKanbun(int code) {
- return((code >= 0x3190) && (code <= 0x319F));
-}
-
-/**
- * xmlUCSIsKangxiRadicals:
- * @code: UCS code point
- *
- * Check whether the character is part of KangxiRadicals UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsKangxiRadicals(int code) {
- return((code >= 0x2F00) && (code <= 0x2FDF));
-}
-
-/**
- * xmlUCSIsKannada:
- * @code: UCS code point
- *
- * Check whether the character is part of Kannada UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsKannada(int code) {
- return((code >= 0x0C80) && (code <= 0x0CFF));
-}
-
-/**
- * xmlUCSIsKatakana:
- * @code: UCS code point
- *
- * Check whether the character is part of Katakana UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsKatakana(int code) {
- return((code >= 0x30A0) && (code <= 0x30FF));
-}
-
-/**
- * xmlUCSIsKhmer:
- * @code: UCS code point
- *
- * Check whether the character is part of Khmer UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsKhmer(int code) {
- return((code >= 0x1780) && (code <= 0x17FF));
-}
-
-/**
- * xmlUCSIsLao:
- * @code: UCS code point
- *
- * Check whether the character is part of Lao UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsLao(int code) {
- return((code >= 0x0E80) && (code <= 0x0EFF));
-}
-
-/**
- * xmlUCSIsLatin1Supplement:
- * @code: UCS code point
- *
- * Check whether the character is part of Latin-1Supplement UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsLatin1Supplement(int code) {
- return((code >= 0x0080) && (code <= 0x00FF));
-}
-
-/**
- * xmlUCSIsLatinExtendedA:
- * @code: UCS code point
- *
- * Check whether the character is part of LatinExtended-A UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsLatinExtendedA(int code) {
- return((code >= 0x0100) && (code <= 0x017F));
-}
-
-/**
- * xmlUCSIsLatinExtendedB:
- * @code: UCS code point
- *
- * Check whether the character is part of LatinExtended-B UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsLatinExtendedB(int code) {
- return((code >= 0x0180) && (code <= 0x024F));
-}
-
-/**
- * xmlUCSIsLatinExtendedAdditional:
- * @code: UCS code point
- *
- * Check whether the character is part of LatinExtendedAdditional UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsLatinExtendedAdditional(int code) {
- return((code >= 0x1E00) && (code <= 0x1EFF));
-}
-
-/**
- * xmlUCSIsLetterlikeSymbols:
- * @code: UCS code point
- *
- * Check whether the character is part of LetterlikeSymbols UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsLetterlikeSymbols(int code) {
- return((code >= 0x2100) && (code <= 0x214F));
-}
-
-/**
- * xmlUCSIsLowSurrogates:
- * @code: UCS code point
- *
- * Check whether the character is part of LowSurrogates UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsLowSurrogates(int code) {
- return((code >= 0xDC00) && (code <= 0xDFFF));
-}
-
-/**
- * xmlUCSIsMalayalam:
- * @code: UCS code point
- *
- * Check whether the character is part of Malayalam UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsMalayalam(int code) {
- return((code >= 0x0D00) && (code <= 0x0D7F));
-}
-
-/**
- * xmlUCSIsMathematicalAlphanumericSymbols:
- * @code: UCS code point
- *
- * Check whether the character is part of MathematicalAlphanumericSymbols UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsMathematicalAlphanumericSymbols(int code) {
- return((code >= 0x1D400) && (code <= 0x1D7FF));
-}
-
-/**
- * xmlUCSIsMathematicalOperators:
- * @code: UCS code point
- *
- * Check whether the character is part of MathematicalOperators UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsMathematicalOperators(int code) {
- return((code >= 0x2200) && (code <= 0x22FF));
-}
-
-/**
- * xmlUCSIsMiscellaneousSymbols:
- * @code: UCS code point
- *
- * Check whether the character is part of MiscellaneousSymbols UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsMiscellaneousSymbols(int code) {
- return((code >= 0x2600) && (code <= 0x26FF));
-}
-
-/**
- * xmlUCSIsMiscellaneousTechnical:
- * @code: UCS code point
- *
- * Check whether the character is part of MiscellaneousTechnical UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsMiscellaneousTechnical(int code) {
- return((code >= 0x2300) && (code <= 0x23FF));
-}
-
-/**
- * xmlUCSIsMongolian:
- * @code: UCS code point
- *
- * Check whether the character is part of Mongolian UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsMongolian(int code) {
- return((code >= 0x1800) && (code <= 0x18AF));
-}
-
-/**
- * xmlUCSIsMusicalSymbols:
- * @code: UCS code point
- *
- * Check whether the character is part of MusicalSymbols UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsMusicalSymbols(int code) {
- return((code >= 0x1D100) && (code <= 0x1D1FF));
-}
-
-/**
- * xmlUCSIsMyanmar:
- * @code: UCS code point
- *
- * Check whether the character is part of Myanmar UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsMyanmar(int code) {
- return((code >= 0x1000) && (code <= 0x109F));
-}
-
-/**
- * xmlUCSIsNumberForms:
- * @code: UCS code point
- *
- * Check whether the character is part of NumberForms UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsNumberForms(int code) {
- return((code >= 0x2150) && (code <= 0x218F));
-}
-
-/**
- * xmlUCSIsOgham:
- * @code: UCS code point
- *
- * Check whether the character is part of Ogham UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsOgham(int code) {
- return((code >= 0x1680) && (code <= 0x169F));
-}
-
-/**
- * xmlUCSIsOldItalic:
- * @code: UCS code point
- *
- * Check whether the character is part of OldItalic UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsOldItalic(int code) {
- return((code >= 0x10300) && (code <= 0x1032F));
-}
-
-/**
- * xmlUCSIsOpticalCharacterRecognition:
- * @code: UCS code point
- *
- * Check whether the character is part of OpticalCharacterRecognition UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsOpticalCharacterRecognition(int code) {
- return((code >= 0x2440) && (code <= 0x245F));
-}
-
-/**
- * xmlUCSIsOriya:
- * @code: UCS code point
- *
- * Check whether the character is part of Oriya UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsOriya(int code) {
- return((code >= 0x0B00) && (code <= 0x0B7F));
-}
-
-/**
- * xmlUCSIsPrivateUse:
- * @code: UCS code point
- *
- * Check whether the character is part of PrivateUse UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsPrivateUse(int code) {
- return((code >= 0x100000) && (code <= 0x10FFFD));
-}
-
-/**
- * xmlUCSIsRunic:
- * @code: UCS code point
- *
- * Check whether the character is part of Runic UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsRunic(int code) {
- return((code >= 0x16A0) && (code <= 0x16FF));
-}
-
-/**
- * xmlUCSIsSinhala:
- * @code: UCS code point
- *
- * Check whether the character is part of Sinhala UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsSinhala(int code) {
- return((code >= 0x0D80) && (code <= 0x0DFF));
-}
-
-/**
- * xmlUCSIsSmallFormVariants:
- * @code: UCS code point
- *
- * Check whether the character is part of SmallFormVariants UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsSmallFormVariants(int code) {
- return((code >= 0xFE50) && (code <= 0xFE6F));
-}
-
-/**
- * xmlUCSIsSpacingModifierLetters:
- * @code: UCS code point
- *
- * Check whether the character is part of SpacingModifierLetters UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsSpacingModifierLetters(int code) {
- return((code >= 0x02B0) && (code <= 0x02FF));
-}
-
-/**
- * xmlUCSIsSpecials:
- * @code: UCS code point
- *
- * Check whether the character is part of Specials UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsSpecials(int code) {
- return((code >= 0xFFF0) && (code <= 0xFFFD));
-}
-
-/**
- * xmlUCSIsSuperscriptsandSubscripts:
- * @code: UCS code point
- *
- * Check whether the character is part of SuperscriptsandSubscripts UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsSuperscriptsandSubscripts(int code) {
- return((code >= 0x2070) && (code <= 0x209F));
-}
-
-/**
- * xmlUCSIsSyriac:
- * @code: UCS code point
- *
- * Check whether the character is part of Syriac UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsSyriac(int code) {
- return((code >= 0x0700) && (code <= 0x074F));
-}
-
-/**
- * xmlUCSIsTags:
- * @code: UCS code point
- *
- * Check whether the character is part of Tags UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsTags(int code) {
- return((code >= 0xE0000) && (code <= 0xE007F));
-}
-
-/**
- * xmlUCSIsTamil:
- * @code: UCS code point
- *
- * Check whether the character is part of Tamil UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsTamil(int code) {
- return((code >= 0x0B80) && (code <= 0x0BFF));
-}
-
-/**
- * xmlUCSIsTelugu:
- * @code: UCS code point
- *
- * Check whether the character is part of Telugu UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsTelugu(int code) {
- return((code >= 0x0C00) && (code <= 0x0C7F));
-}
-
-/**
- * xmlUCSIsThaana:
- * @code: UCS code point
- *
- * Check whether the character is part of Thaana UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsThaana(int code) {
- return((code >= 0x0780) && (code <= 0x07BF));
-}
-
-/**
- * xmlUCSIsThai:
- * @code: UCS code point
- *
- * Check whether the character is part of Thai UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsThai(int code) {
- return((code >= 0x0E00) && (code <= 0x0E7F));
-}
-
-/**
- * xmlUCSIsTibetan:
- * @code: UCS code point
- *
- * Check whether the character is part of Tibetan UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsTibetan(int code) {
- return((code >= 0x0F00) && (code <= 0x0FFF));
-}
-
-/**
- * xmlUCSIsUnifiedCanadianAboriginalSyllabics:
- * @code: UCS code point
- *
- * Check whether the character is part of UnifiedCanadianAboriginalSyllabics UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsUnifiedCanadianAboriginalSyllabics(int code) {
- return((code >= 0x1400) && (code <= 0x167F));
-}
-
-/**
- * xmlUCSIsYiRadicals:
- * @code: UCS code point
- *
- * Check whether the character is part of YiRadicals UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsYiRadicals(int code) {
- return((code >= 0xA490) && (code <= 0xA4CF));
-}
-
-/**
- * xmlUCSIsYiSyllables:
- * @code: UCS code point
- *
- * Check whether the character is part of YiSyllables UCS Block
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsYiSyllables(int code) {
- return((code >= 0xA000) && (code <= 0xA48F));
-}
-
-/**
- * xmlUCSIsBlock:
- * @code: UCS code point
- * @block: UCS block name
- *
- * Check whether the caracter is part of the UCS Block
- *
- * Returns 1 if true, 0 if false and -1 on unknown block
- */
-int
-xmlUCSIsBlock(int code, const char *block) {
- if (!strcmp(block, "AlphabeticPresentationForms"))
- return(xmlUCSIsAlphabeticPresentationForms(code));
- if (!strcmp(block, "Arabic"))
- return(xmlUCSIsArabic(code));
- if (!strcmp(block, "ArabicPresentationForms-A"))
- return(xmlUCSIsArabicPresentationFormsA(code));
- if (!strcmp(block, "ArabicPresentationForms-B"))
- return(xmlUCSIsArabicPresentationFormsB(code));
- if (!strcmp(block, "Armenian"))
- return(xmlUCSIsArmenian(code));
- if (!strcmp(block, "Arrows"))
- return(xmlUCSIsArrows(code));
- if (!strcmp(block, "BasicLatin"))
- return(xmlUCSIsBasicLatin(code));
- if (!strcmp(block, "Bengali"))
- return(xmlUCSIsBengali(code));
- if (!strcmp(block, "BlockElements"))
- return(xmlUCSIsBlockElements(code));
- if (!strcmp(block, "Bopomofo"))
- return(xmlUCSIsBopomofo(code));
- if (!strcmp(block, "BopomofoExtended"))
- return(xmlUCSIsBopomofoExtended(code));
- if (!strcmp(block, "BoxDrawing"))
- return(xmlUCSIsBoxDrawing(code));
- if (!strcmp(block, "BraillePatterns"))
- return(xmlUCSIsBraillePatterns(code));
- if (!strcmp(block, "ByzantineMusicalSymbols"))
- return(xmlUCSIsByzantineMusicalSymbols(code));
- if (!strcmp(block, "CJKCompatibility"))
- return(xmlUCSIsCJKCompatibility(code));
- if (!strcmp(block, "CJKCompatibilityForms"))
- return(xmlUCSIsCJKCompatibilityForms(code));
- if (!strcmp(block, "CJKCompatibilityIdeographs"))
- return(xmlUCSIsCJKCompatibilityIdeographs(code));
- if (!strcmp(block, "CJKCompatibilityIdeographsSupplement"))
- return(xmlUCSIsCJKCompatibilityIdeographsSupplement(code));
- if (!strcmp(block, "CJKRadicalsSupplement"))
- return(xmlUCSIsCJKRadicalsSupplement(code));
- if (!strcmp(block, "CJKSymbolsandPunctuation"))
- return(xmlUCSIsCJKSymbolsandPunctuation(code));
- if (!strcmp(block, "CJKUnifiedIdeographs"))
- return(xmlUCSIsCJKUnifiedIdeographs(code));
- if (!strcmp(block, "CJKUnifiedIdeographsExtensionA"))
- return(xmlUCSIsCJKUnifiedIdeographsExtensionA(code));
- if (!strcmp(block, "CJKUnifiedIdeographsExtensionB"))
- return(xmlUCSIsCJKUnifiedIdeographsExtensionB(code));
- if (!strcmp(block, "Cherokee"))
- return(xmlUCSIsCherokee(code));
- if (!strcmp(block, "CombiningDiacriticalMarks"))
- return(xmlUCSIsCombiningDiacriticalMarks(code));
- if (!strcmp(block, "CombiningHalfMarks"))
- return(xmlUCSIsCombiningHalfMarks(code));
- if (!strcmp(block, "CombiningMarksforSymbols"))
- return(xmlUCSIsCombiningMarksforSymbols(code));
- if (!strcmp(block, "ControlPictures"))
- return(xmlUCSIsControlPictures(code));
- if (!strcmp(block, "CurrencySymbols"))
- return(xmlUCSIsCurrencySymbols(code));
- if (!strcmp(block, "Cyrillic"))
- return(xmlUCSIsCyrillic(code));
- if (!strcmp(block, "Deseret"))
- return(xmlUCSIsDeseret(code));
- if (!strcmp(block, "Devanagari"))
- return(xmlUCSIsDevanagari(code));
- if (!strcmp(block, "Dingbats"))
- return(xmlUCSIsDingbats(code));
- if (!strcmp(block, "EnclosedAlphanumerics"))
- return(xmlUCSIsEnclosedAlphanumerics(code));
- if (!strcmp(block, "EnclosedCJKLettersandMonths"))
- return(xmlUCSIsEnclosedCJKLettersandMonths(code));
- if (!strcmp(block, "Ethiopic"))
- return(xmlUCSIsEthiopic(code));
- if (!strcmp(block, "GeneralPunctuation"))
- return(xmlUCSIsGeneralPunctuation(code));
- if (!strcmp(block, "GeometricShapes"))
- return(xmlUCSIsGeometricShapes(code));
- if (!strcmp(block, "Georgian"))
- return(xmlUCSIsGeorgian(code));
- if (!strcmp(block, "Gothic"))
- return(xmlUCSIsGothic(code));
- if (!strcmp(block, "Greek"))
- return(xmlUCSIsGreek(code));
- if (!strcmp(block, "GreekExtended"))
- return(xmlUCSIsGreekExtended(code));
- if (!strcmp(block, "Gujarati"))
- return(xmlUCSIsGujarati(code));
- if (!strcmp(block, "Gurmukhi"))
- return(xmlUCSIsGurmukhi(code));
- if (!strcmp(block, "HalfwidthandFullwidthForms"))
- return(xmlUCSIsHalfwidthandFullwidthForms(code));
- if (!strcmp(block, "HangulCompatibilityJamo"))
- return(xmlUCSIsHangulCompatibilityJamo(code));
- if (!strcmp(block, "HangulJamo"))
- return(xmlUCSIsHangulJamo(code));
- if (!strcmp(block, "HangulSyllables"))
- return(xmlUCSIsHangulSyllables(code));
- if (!strcmp(block, "Hebrew"))
- return(xmlUCSIsHebrew(code));
- if (!strcmp(block, "HighPrivateUseSurrogates"))
- return(xmlUCSIsHighPrivateUseSurrogates(code));
- if (!strcmp(block, "HighSurrogates"))
- return(xmlUCSIsHighSurrogates(code));
- if (!strcmp(block, "Hiragana"))
- return(xmlUCSIsHiragana(code));
- if (!strcmp(block, "IPAExtensions"))
- return(xmlUCSIsIPAExtensions(code));
- if (!strcmp(block, "IdeographicDescriptionCharacters"))
- return(xmlUCSIsIdeographicDescriptionCharacters(code));
- if (!strcmp(block, "Kanbun"))
- return(xmlUCSIsKanbun(code));
- if (!strcmp(block, "KangxiRadicals"))
- return(xmlUCSIsKangxiRadicals(code));
- if (!strcmp(block, "Kannada"))
- return(xmlUCSIsKannada(code));
- if (!strcmp(block, "Katakana"))
- return(xmlUCSIsKatakana(code));
- if (!strcmp(block, "Khmer"))
- return(xmlUCSIsKhmer(code));
- if (!strcmp(block, "Lao"))
- return(xmlUCSIsLao(code));
- if (!strcmp(block, "Latin-1Supplement"))
- return(xmlUCSIsLatin1Supplement(code));
- if (!strcmp(block, "LatinExtended-A"))
- return(xmlUCSIsLatinExtendedA(code));
- if (!strcmp(block, "LatinExtended-B"))
- return(xmlUCSIsLatinExtendedB(code));
- if (!strcmp(block, "LatinExtendedAdditional"))
- return(xmlUCSIsLatinExtendedAdditional(code));
- if (!strcmp(block, "LetterlikeSymbols"))
- return(xmlUCSIsLetterlikeSymbols(code));
- if (!strcmp(block, "LowSurrogates"))
- return(xmlUCSIsLowSurrogates(code));
- if (!strcmp(block, "Malayalam"))
- return(xmlUCSIsMalayalam(code));
- if (!strcmp(block, "MathematicalAlphanumericSymbols"))
- return(xmlUCSIsMathematicalAlphanumericSymbols(code));
- if (!strcmp(block, "MathematicalOperators"))
- return(xmlUCSIsMathematicalOperators(code));
- if (!strcmp(block, "MiscellaneousSymbols"))
- return(xmlUCSIsMiscellaneousSymbols(code));
- if (!strcmp(block, "MiscellaneousTechnical"))
- return(xmlUCSIsMiscellaneousTechnical(code));
- if (!strcmp(block, "Mongolian"))
- return(xmlUCSIsMongolian(code));
- if (!strcmp(block, "MusicalSymbols"))
- return(xmlUCSIsMusicalSymbols(code));
- if (!strcmp(block, "Myanmar"))
- return(xmlUCSIsMyanmar(code));
- if (!strcmp(block, "NumberForms"))
- return(xmlUCSIsNumberForms(code));
- if (!strcmp(block, "Ogham"))
- return(xmlUCSIsOgham(code));
- if (!strcmp(block, "OldItalic"))
- return(xmlUCSIsOldItalic(code));
- if (!strcmp(block, "OpticalCharacterRecognition"))
- return(xmlUCSIsOpticalCharacterRecognition(code));
- if (!strcmp(block, "Oriya"))
- return(xmlUCSIsOriya(code));
- if (!strcmp(block, "PrivateUse"))
- return(xmlUCSIsPrivateUse(code));
- if (!strcmp(block, "Runic"))
- return(xmlUCSIsRunic(code));
- if (!strcmp(block, "Sinhala"))
- return(xmlUCSIsSinhala(code));
- if (!strcmp(block, "SmallFormVariants"))
- return(xmlUCSIsSmallFormVariants(code));
- if (!strcmp(block, "SpacingModifierLetters"))
- return(xmlUCSIsSpacingModifierLetters(code));
- if (!strcmp(block, "Specials"))
- return(xmlUCSIsSpecials(code));
- if (!strcmp(block, "SuperscriptsandSubscripts"))
- return(xmlUCSIsSuperscriptsandSubscripts(code));
- if (!strcmp(block, "Syriac"))
- return(xmlUCSIsSyriac(code));
- if (!strcmp(block, "Tags"))
- return(xmlUCSIsTags(code));
- if (!strcmp(block, "Tamil"))
- return(xmlUCSIsTamil(code));
- if (!strcmp(block, "Telugu"))
- return(xmlUCSIsTelugu(code));
- if (!strcmp(block, "Thaana"))
- return(xmlUCSIsThaana(code));
- if (!strcmp(block, "Thai"))
- return(xmlUCSIsThai(code));
- if (!strcmp(block, "Tibetan"))
- return(xmlUCSIsTibetan(code));
- if (!strcmp(block, "UnifiedCanadianAboriginalSyllabics"))
- return(xmlUCSIsUnifiedCanadianAboriginalSyllabics(code));
- if (!strcmp(block, "YiRadicals"))
- return(xmlUCSIsYiRadicals(code));
- if (!strcmp(block, "YiSyllables"))
- return(xmlUCSIsYiSyllables(code));
- return(-1);
-}
-
-/**
- * xmlUCSIsCatC:
- * @code: UCS code point
- *
- * Check whether the character is part of C UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatC(int code) {
- return(((code >= 0x0) && (code <= 0x1f)) ||
- ((code >= 0x7f) && (code <= 0x9f)) ||
- (code == 0x70f) ||
- ((code >= 0x180b) && (code <= 0x180e)) ||
- ((code >= 0x200c) && (code <= 0x200f)) ||
- ((code >= 0x202a) && (code <= 0x202e)) ||
- ((code >= 0x206a) && (code <= 0x206f)) ||
- (code == 0xd800) ||
- ((code >= 0xdb7f) && (code <= 0xdb80)) ||
- ((code >= 0xdbff) && (code <= 0xdc00)) ||
- ((code >= 0xdfff) && (code <= 0xe000)) ||
- (code == 0xf8ff) ||
- (code == 0xfeff) ||
- ((code >= 0xfff9) && (code <= 0xfffb)) ||
- ((code >= 0x1d173) && (code <= 0x1d17a)) ||
- (code == 0xe0001) ||
- ((code >= 0xe0020) && (code <= 0xe007f)) ||
- (code == 0xf0000) ||
- (code == 0xffffd) ||
- (code == 0x100000) ||
- (code == 0x10fffd));
-}
-
-/**
- * xmlUCSIsCatCc:
- * @code: UCS code point
- *
- * Check whether the character is part of Cc UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatCc(int code) {
- return(((code >= 0x0) && (code <= 0x1f)) ||
- ((code >= 0x7f) && (code <= 0x9f)));
-}
-
-/**
- * xmlUCSIsCatCf:
- * @code: UCS code point
- *
- * Check whether the character is part of Cf UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatCf(int code) {
- return((code == 0x70f) ||
- ((code >= 0x180b) && (code <= 0x180e)) ||
- ((code >= 0x200c) && (code <= 0x200f)) ||
- ((code >= 0x202a) && (code <= 0x202e)) ||
- ((code >= 0x206a) && (code <= 0x206f)) ||
- (code == 0xfeff) ||
- ((code >= 0xfff9) && (code <= 0xfffb)) ||
- ((code >= 0x1d173) && (code <= 0x1d17a)) ||
- (code == 0xe0001) ||
- ((code >= 0xe0020) && (code <= 0xe007f)));
-}
-
-/**
- * xmlUCSIsCatCo:
- * @code: UCS code point
- *
- * Check whether the character is part of Co UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatCo(int code) {
- return((code == 0xe000) ||
- (code == 0xf8ff) ||
- (code == 0xf0000) ||
- (code == 0xffffd) ||
- (code == 0x100000) ||
- (code == 0x10fffd));
-}
-
-/**
- * xmlUCSIsCatCs:
- * @code: UCS code point
- *
- * Check whether the character is part of Cs UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatCs(int code) {
- return((code == 0xd800) ||
- ((code >= 0xdb7f) && (code <= 0xdb80)) ||
- ((code >= 0xdbff) && (code <= 0xdc00)) ||
- (code == 0xdfff));
-}
-
-/**
- * xmlUCSIsCatL:
- * @code: UCS code point
- *
- * Check whether the character is part of L UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatL(int code) {
- return(((code >= 0x41) && (code <= 0x5a)) ||
- ((code >= 0x61) && (code <= 0x7a)) ||
- (code == 0xaa) ||
- (code == 0xb5) ||
- (code == 0xba) ||
- ((code >= 0xc0) && (code <= 0xd6)) ||
- ((code >= 0xd8) && (code <= 0xf6)) ||
- ((code >= 0xf8) && (code <= 0x21f)) ||
- ((code >= 0x222) && (code <= 0x233)) ||
- ((code >= 0x250) && (code <= 0x2ad)) ||
- ((code >= 0x2b0) && (code <= 0x2b8)) ||
- ((code >= 0x2bb) && (code <= 0x2c1)) ||
- ((code >= 0x2d0) && (code <= 0x2d1)) ||
- ((code >= 0x2e0) && (code <= 0x2e4)) ||
- (code == 0x2ee) ||
- (code == 0x37a) ||
- (code == 0x386) ||
- ((code >= 0x388) && (code <= 0x38a)) ||
- (code == 0x38c) ||
- ((code >= 0x38e) && (code <= 0x3a1)) ||
- ((code >= 0x3a3) && (code <= 0x3ce)) ||
- ((code >= 0x3d0) && (code <= 0x3d7)) ||
- ((code >= 0x3da) && (code <= 0x3f5)) ||
- ((code >= 0x400) && (code <= 0x481)) ||
- ((code >= 0x48c) && (code <= 0x4c4)) ||
- ((code >= 0x4c7) && (code <= 0x4c8)) ||
- ((code >= 0x4cb) && (code <= 0x4cc)) ||
- ((code >= 0x4d0) && (code <= 0x4f5)) ||
- ((code >= 0x4f8) && (code <= 0x4f9)) ||
- ((code >= 0x531) && (code <= 0x556)) ||
- (code == 0x559) ||
- ((code >= 0x561) && (code <= 0x587)) ||
- ((code >= 0x5d0) && (code <= 0x5ea)) ||
- ((code >= 0x5f0) && (code <= 0x5f2)) ||
- ((code >= 0x621) && (code <= 0x63a)) ||
- ((code >= 0x640) && (code <= 0x64a)) ||
- ((code >= 0x671) && (code <= 0x6d3)) ||
- (code == 0x6d5) ||
- ((code >= 0x6e5) && (code <= 0x6e6)) ||
- ((code >= 0x6fa) && (code <= 0x6fc)) ||
- (code == 0x710) ||
- ((code >= 0x712) && (code <= 0x72c)) ||
- ((code >= 0x780) && (code <= 0x7a5)) ||
- ((code >= 0x905) && (code <= 0x939)) ||
- (code == 0x93d) ||
- (code == 0x950) ||
- ((code >= 0x958) && (code <= 0x961)) ||
- ((code >= 0x985) && (code <= 0x98c)) ||
- ((code >= 0x98f) && (code <= 0x990)) ||
- ((code >= 0x993) && (code <= 0x9a8)) ||
- ((code >= 0x9aa) && (code <= 0x9b0)) ||
- (code == 0x9b2) ||
- ((code >= 0x9b6) && (code <= 0x9b9)) ||
- ((code >= 0x9dc) && (code <= 0x9dd)) ||
- ((code >= 0x9df) && (code <= 0x9e1)) ||
- ((code >= 0x9f0) && (code <= 0x9f1)) ||
- ((code >= 0xa05) && (code <= 0xa0a)) ||
- ((code >= 0xa0f) && (code <= 0xa10)) ||
- ((code >= 0xa13) && (code <= 0xa28)) ||
- ((code >= 0xa2a) && (code <= 0xa30)) ||
- ((code >= 0xa32) && (code <= 0xa33)) ||
- ((code >= 0xa35) && (code <= 0xa36)) ||
- ((code >= 0xa38) && (code <= 0xa39)) ||
- ((code >= 0xa59) && (code <= 0xa5c)) ||
- (code == 0xa5e) ||
- ((code >= 0xa72) && (code <= 0xa74)) ||
- ((code >= 0xa85) && (code <= 0xa8b)) ||
- (code == 0xa8d) ||
- ((code >= 0xa8f) && (code <= 0xa91)) ||
- ((code >= 0xa93) && (code <= 0xaa8)) ||
- ((code >= 0xaaa) && (code <= 0xab0)) ||
- ((code >= 0xab2) && (code <= 0xab3)) ||
- ((code >= 0xab5) && (code <= 0xab9)) ||
- (code == 0xabd) ||
- (code == 0xad0) ||
- (code == 0xae0) ||
- ((code >= 0xb05) && (code <= 0xb0c)) ||
- ((code >= 0xb0f) && (code <= 0xb10)) ||
- ((code >= 0xb13) && (code <= 0xb28)) ||
- ((code >= 0xb2a) && (code <= 0xb30)) ||
- ((code >= 0xb32) && (code <= 0xb33)) ||
- ((code >= 0xb36) && (code <= 0xb39)) ||
- (code == 0xb3d) ||
- ((code >= 0xb5c) && (code <= 0xb5d)) ||
- ((code >= 0xb5f) && (code <= 0xb61)) ||
- ((code >= 0xb85) && (code <= 0xb8a)) ||
- ((code >= 0xb8e) && (code <= 0xb90)) ||
- ((code >= 0xb92) && (code <= 0xb95)) ||
- ((code >= 0xb99) && (code <= 0xb9a)) ||
- (code == 0xb9c) ||
- ((code >= 0xb9e) && (code <= 0xb9f)) ||
- ((code >= 0xba3) && (code <= 0xba4)) ||
- ((code >= 0xba8) && (code <= 0xbaa)) ||
- ((code >= 0xbae) && (code <= 0xbb5)) ||
- ((code >= 0xbb7) && (code <= 0xbb9)) ||
- ((code >= 0xc05) && (code <= 0xc0c)) ||
- ((code >= 0xc0e) && (code <= 0xc10)) ||
- ((code >= 0xc12) && (code <= 0xc28)) ||
- ((code >= 0xc2a) && (code <= 0xc33)) ||
- ((code >= 0xc35) && (code <= 0xc39)) ||
- ((code >= 0xc60) && (code <= 0xc61)) ||
- ((code >= 0xc85) && (code <= 0xc8c)) ||
- ((code >= 0xc8e) && (code <= 0xc90)) ||
- ((code >= 0xc92) && (code <= 0xca8)) ||
- ((code >= 0xcaa) && (code <= 0xcb3)) ||
- ((code >= 0xcb5) && (code <= 0xcb9)) ||
- (code == 0xcde) ||
- ((code >= 0xce0) && (code <= 0xce1)) ||
- ((code >= 0xd05) && (code <= 0xd0c)) ||
- ((code >= 0xd0e) && (code <= 0xd10)) ||
- ((code >= 0xd12) && (code <= 0xd28)) ||
- ((code >= 0xd2a) && (code <= 0xd39)) ||
- ((code >= 0xd60) && (code <= 0xd61)) ||
- ((code >= 0xd85) && (code <= 0xd96)) ||
- ((code >= 0xd9a) && (code <= 0xdb1)) ||
- ((code >= 0xdb3) && (code <= 0xdbb)) ||
- (code == 0xdbd) ||
- ((code >= 0xdc0) && (code <= 0xdc6)) ||
- ((code >= 0xe01) && (code <= 0xe30)) ||
- ((code >= 0xe32) && (code <= 0xe33)) ||
- ((code >= 0xe40) && (code <= 0xe46)) ||
- ((code >= 0xe81) && (code <= 0xe82)) ||
- (code == 0xe84) ||
- ((code >= 0xe87) && (code <= 0xe88)) ||
- (code == 0xe8a) ||
- (code == 0xe8d) ||
- ((code >= 0xe94) && (code <= 0xe97)) ||
- ((code >= 0xe99) && (code <= 0xe9f)) ||
- ((code >= 0xea1) && (code <= 0xea3)) ||
- (code == 0xea5) ||
- (code == 0xea7) ||
- ((code >= 0xeaa) && (code <= 0xeab)) ||
- ((code >= 0xead) && (code <= 0xeb0)) ||
- ((code >= 0xeb2) && (code <= 0xeb3)) ||
- (code == 0xebd) ||
- ((code >= 0xec0) && (code <= 0xec4)) ||
- (code == 0xec6) ||
- ((code >= 0xedc) && (code <= 0xedd)) ||
- (code == 0xf00) ||
- ((code >= 0xf40) && (code <= 0xf47)) ||
- ((code >= 0xf49) && (code <= 0xf6a)) ||
- ((code >= 0xf88) && (code <= 0xf8b)) ||
- ((code >= 0x1000) && (code <= 0x1021)) ||
- ((code >= 0x1023) && (code <= 0x1027)) ||
- ((code >= 0x1029) && (code <= 0x102a)) ||
- ((code >= 0x1050) && (code <= 0x1055)) ||
- ((code >= 0x10a0) && (code <= 0x10c5)) ||
- ((code >= 0x10d0) && (code <= 0x10f6)) ||
- ((code >= 0x1100) && (code <= 0x1159)) ||
- ((code >= 0x115f) && (code <= 0x11a2)) ||
- ((code >= 0x11a8) && (code <= 0x11f9)) ||
- ((code >= 0x1200) && (code <= 0x1206)) ||
- ((code >= 0x1208) && (code <= 0x1246)) ||
- (code == 0x1248) ||
- ((code >= 0x124a) && (code <= 0x124d)) ||
- ((code >= 0x1250) && (code <= 0x1256)) ||
- (code == 0x1258) ||
- ((code >= 0x125a) && (code <= 0x125d)) ||
- ((code >= 0x1260) && (code <= 0x1286)) ||
- (code == 0x1288) ||
- ((code >= 0x128a) && (code <= 0x128d)) ||
- ((code >= 0x1290) && (code <= 0x12ae)) ||
- (code == 0x12b0) ||
- ((code >= 0x12b2) && (code <= 0x12b5)) ||
- ((code >= 0x12b8) && (code <= 0x12be)) ||
- (code == 0x12c0) ||
- ((code >= 0x12c2) && (code <= 0x12c5)) ||
- ((code >= 0x12c8) && (code <= 0x12ce)) ||
- ((code >= 0x12d0) && (code <= 0x12d6)) ||
- ((code >= 0x12d8) && (code <= 0x12ee)) ||
- ((code >= 0x12f0) && (code <= 0x130e)) ||
- (code == 0x1310) ||
- ((code >= 0x1312) && (code <= 0x1315)) ||
- ((code >= 0x1318) && (code <= 0x131e)) ||
- ((code >= 0x1320) && (code <= 0x1346)) ||
- ((code >= 0x1348) && (code <= 0x135a)) ||
- ((code >= 0x13a0) && (code <= 0x13f4)) ||
- ((code >= 0x1401) && (code <= 0x166c)) ||
- ((code >= 0x166f) && (code <= 0x1676)) ||
- ((code >= 0x1681) && (code <= 0x169a)) ||
- ((code >= 0x16a0) && (code <= 0x16ea)) ||
- ((code >= 0x1780) && (code <= 0x17b3)) ||
- ((code >= 0x1820) && (code <= 0x1877)) ||
- ((code >= 0x1880) && (code <= 0x18a8)) ||
- ((code >= 0x1e00) && (code <= 0x1e9b)) ||
- ((code >= 0x1ea0) && (code <= 0x1ef9)) ||
- ((code >= 0x1f00) && (code <= 0x1f15)) ||
- ((code >= 0x1f18) && (code <= 0x1f1d)) ||
- ((code >= 0x1f20) && (code <= 0x1f45)) ||
- ((code >= 0x1f48) && (code <= 0x1f4d)) ||
- ((code >= 0x1f50) && (code <= 0x1f57)) ||
- (code == 0x1f59) ||
- (code == 0x1f5b) ||
- (code == 0x1f5d) ||
- ((code >= 0x1f5f) && (code <= 0x1f7d)) ||
- ((code >= 0x1f80) && (code <= 0x1fb4)) ||
- ((code >= 0x1fb6) && (code <= 0x1fbc)) ||
- (code == 0x1fbe) ||
- ((code >= 0x1fc2) && (code <= 0x1fc4)) ||
- ((code >= 0x1fc6) && (code <= 0x1fcc)) ||
- ((code >= 0x1fd0) && (code <= 0x1fd3)) ||
- ((code >= 0x1fd6) && (code <= 0x1fdb)) ||
- ((code >= 0x1fe0) && (code <= 0x1fec)) ||
- ((code >= 0x1ff2) && (code <= 0x1ff4)) ||
- ((code >= 0x1ff6) && (code <= 0x1ffc)) ||
- (code == 0x207f) ||
- (code == 0x2102) ||
- (code == 0x2107) ||
- ((code >= 0x210a) && (code <= 0x2113)) ||
- (code == 0x2115) ||
- ((code >= 0x2119) && (code <= 0x211d)) ||
- (code == 0x2124) ||
- (code == 0x2126) ||
- (code == 0x2128) ||
- ((code >= 0x212a) && (code <= 0x212d)) ||
- ((code >= 0x212f) && (code <= 0x2131)) ||
- ((code >= 0x2133) && (code <= 0x2139)) ||
- ((code >= 0x3005) && (code <= 0x3006)) ||
- ((code >= 0x3031) && (code <= 0x3035)) ||
- ((code >= 0x3041) && (code <= 0x3094)) ||
- ((code >= 0x309d) && (code <= 0x309e)) ||
- ((code >= 0x30a1) && (code <= 0x30fa)) ||
- ((code >= 0x30fc) && (code <= 0x30fe)) ||
- ((code >= 0x3105) && (code <= 0x312c)) ||
- ((code >= 0x3131) && (code <= 0x318e)) ||
- ((code >= 0x31a0) && (code <= 0x31b7)) ||
- (code == 0x3400) ||
- (code == 0x4db5) ||
- (code == 0x4e00) ||
- (code == 0x9fa5) ||
- ((code >= 0xa000) && (code <= 0xa48c)) ||
- (code == 0xac00) ||
- (code == 0xd7a3) ||
- ((code >= 0xf900) && (code <= 0xfa2d)) ||
- ((code >= 0xfb00) && (code <= 0xfb06)) ||
- ((code >= 0xfb13) && (code <= 0xfb17)) ||
- (code == 0xfb1d) ||
- ((code >= 0xfb1f) && (code <= 0xfb28)) ||
- ((code >= 0xfb2a) && (code <= 0xfb36)) ||
- ((code >= 0xfb38) && (code <= 0xfb3c)) ||
- (code == 0xfb3e) ||
- ((code >= 0xfb40) && (code <= 0xfb41)) ||
- ((code >= 0xfb43) && (code <= 0xfb44)) ||
- ((code >= 0xfb46) && (code <= 0xfbb1)) ||
- ((code >= 0xfbd3) && (code <= 0xfd3d)) ||
- ((code >= 0xfd50) && (code <= 0xfd8f)) ||
- ((code >= 0xfd92) && (code <= 0xfdc7)) ||
- ((code >= 0xfdf0) && (code <= 0xfdfb)) ||
- ((code >= 0xfe70) && (code <= 0xfe72)) ||
- (code == 0xfe74) ||
- ((code >= 0xfe76) && (code <= 0xfefc)) ||
- ((code >= 0xff21) && (code <= 0xff3a)) ||
- ((code >= 0xff41) && (code <= 0xff5a)) ||
- ((code >= 0xff66) && (code <= 0xffbe)) ||
- ((code >= 0xffc2) && (code <= 0xffc7)) ||
- ((code >= 0xffca) && (code <= 0xffcf)) ||
- ((code >= 0xffd2) && (code <= 0xffd7)) ||
- ((code >= 0xffda) && (code <= 0xffdc)) ||
- ((code >= 0x10300) && (code <= 0x1031e)) ||
- ((code >= 0x10330) && (code <= 0x10349)) ||
- ((code >= 0x10400) && (code <= 0x10425)) ||
- ((code >= 0x10428) && (code <= 0x1044d)) ||
- ((code >= 0x1d400) && (code <= 0x1d454)) ||
- ((code >= 0x1d456) && (code <= 0x1d49c)) ||
- ((code >= 0x1d49e) && (code <= 0x1d49f)) ||
- (code == 0x1d4a2) ||
- ((code >= 0x1d4a5) && (code <= 0x1d4a6)) ||
- ((code >= 0x1d4a9) && (code <= 0x1d4ac)) ||
- ((code >= 0x1d4ae) && (code <= 0x1d4b9)) ||
- (code == 0x1d4bb) ||
- ((code >= 0x1d4bd) && (code <= 0x1d4c0)) ||
- ((code >= 0x1d4c2) && (code <= 0x1d4c3)) ||
- ((code >= 0x1d4c5) && (code <= 0x1d505)) ||
- ((code >= 0x1d507) && (code <= 0x1d50a)) ||
- ((code >= 0x1d50d) && (code <= 0x1d514)) ||
- ((code >= 0x1d516) && (code <= 0x1d51c)) ||
- ((code >= 0x1d51e) && (code <= 0x1d539)) ||
- ((code >= 0x1d53b) && (code <= 0x1d53e)) ||
- ((code >= 0x1d540) && (code <= 0x1d544)) ||
- (code == 0x1d546) ||
- ((code >= 0x1d54a) && (code <= 0x1d550)) ||
- ((code >= 0x1d552) && (code <= 0x1d6a3)) ||
- ((code >= 0x1d6a8) && (code <= 0x1d6c0)) ||
- ((code >= 0x1d6c2) && (code <= 0x1d6da)) ||
- ((code >= 0x1d6dc) && (code <= 0x1d6fa)) ||
- ((code >= 0x1d6fc) && (code <= 0x1d714)) ||
- ((code >= 0x1d716) && (code <= 0x1d734)) ||
- ((code >= 0x1d736) && (code <= 0x1d74e)) ||
- ((code >= 0x1d750) && (code <= 0x1d76e)) ||
- ((code >= 0x1d770) && (code <= 0x1d788)) ||
- ((code >= 0x1d78a) && (code <= 0x1d7a8)) ||
- ((code >= 0x1d7aa) && (code <= 0x1d7c2)) ||
- ((code >= 0x1d7c4) && (code <= 0x1d7c9)) ||
- (code == 0x20000) ||
- (code == 0x2a6d6) ||
- ((code >= 0x2f800) && (code <= 0x2fa1d)));
-}
-
-/**
- * xmlUCSIsCatLl:
- * @code: UCS code point
- *
- * Check whether the character is part of Ll UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatLl(int code) {
- return(((code >= 0x61) && (code <= 0x7a)) ||
- (code == 0xaa) ||
- (code == 0xb5) ||
- (code == 0xba) ||
- ((code >= 0xdf) && (code <= 0xf6)) ||
- ((code >= 0xf8) && (code <= 0xff)) ||
- (code == 0x101) ||
- (code == 0x103) ||
- (code == 0x105) ||
- (code == 0x107) ||
- (code == 0x109) ||
- (code == 0x10b) ||
- (code == 0x10d) ||
- (code == 0x10f) ||
- (code == 0x111) ||
- (code == 0x113) ||
- (code == 0x115) ||
- (code == 0x117) ||
- (code == 0x119) ||
- (code == 0x11b) ||
- (code == 0x11d) ||
- (code == 0x11f) ||
- (code == 0x121) ||
- (code == 0x123) ||
- (code == 0x125) ||
- (code == 0x127) ||
- (code == 0x129) ||
- (code == 0x12b) ||
- (code == 0x12d) ||
- (code == 0x12f) ||
- (code == 0x131) ||
- (code == 0x133) ||
- (code == 0x135) ||
- ((code >= 0x137) && (code <= 0x138)) ||
- (code == 0x13a) ||
- (code == 0x13c) ||
- (code == 0x13e) ||
- (code == 0x140) ||
- (code == 0x142) ||
- (code == 0x144) ||
- (code == 0x146) ||
- ((code >= 0x148) && (code <= 0x149)) ||
- (code == 0x14b) ||
- (code == 0x14d) ||
- (code == 0x14f) ||
- (code == 0x151) ||
- (code == 0x153) ||
- (code == 0x155) ||
- (code == 0x157) ||
- (code == 0x159) ||
- (code == 0x15b) ||
- (code == 0x15d) ||
- (code == 0x15f) ||
- (code == 0x161) ||
- (code == 0x163) ||
- (code == 0x165) ||
- (code == 0x167) ||
- (code == 0x169) ||
- (code == 0x16b) ||
- (code == 0x16d) ||
- (code == 0x16f) ||
- (code == 0x171) ||
- (code == 0x173) ||
- (code == 0x175) ||
- (code == 0x177) ||
- (code == 0x17a) ||
- (code == 0x17c) ||
- ((code >= 0x17e) && (code <= 0x180)) ||
- (code == 0x183) ||
- (code == 0x185) ||
- (code == 0x188) ||
- ((code >= 0x18c) && (code <= 0x18d)) ||
- (code == 0x192) ||
- (code == 0x195) ||
- ((code >= 0x199) && (code <= 0x19b)) ||
- (code == 0x19e) ||
- (code == 0x1a1) ||
- (code == 0x1a3) ||
- (code == 0x1a5) ||
- (code == 0x1a8) ||
- ((code >= 0x1aa) && (code <= 0x1ab)) ||
- (code == 0x1ad) ||
- (code == 0x1b0) ||
- (code == 0x1b4) ||
- (code == 0x1b6) ||
- ((code >= 0x1b9) && (code <= 0x1ba)) ||
- ((code >= 0x1bd) && (code <= 0x1bf)) ||
- (code == 0x1c6) ||
- (code == 0x1c9) ||
- (code == 0x1cc) ||
- (code == 0x1ce) ||
- (code == 0x1d0) ||
- (code == 0x1d2) ||
- (code == 0x1d4) ||
- (code == 0x1d6) ||
- (code == 0x1d8) ||
- (code == 0x1da) ||
- ((code >= 0x1dc) && (code <= 0x1dd)) ||
- (code == 0x1df) ||
- (code == 0x1e1) ||
- (code == 0x1e3) ||
- (code == 0x1e5) ||
- (code == 0x1e7) ||
- (code == 0x1e9) ||
- (code == 0x1eb) ||
- (code == 0x1ed) ||
- ((code >= 0x1ef) && (code <= 0x1f0)) ||
- (code == 0x1f3) ||
- (code == 0x1f5) ||
- (code == 0x1f9) ||
- (code == 0x1fb) ||
- (code == 0x1fd) ||
- (code == 0x1ff) ||
- (code == 0x201) ||
- (code == 0x203) ||
- (code == 0x205) ||
- (code == 0x207) ||
- (code == 0x209) ||
- (code == 0x20b) ||
- (code == 0x20d) ||
- (code == 0x20f) ||
- (code == 0x211) ||
- (code == 0x213) ||
- (code == 0x215) ||
- (code == 0x217) ||
- (code == 0x219) ||
- (code == 0x21b) ||
- (code == 0x21d) ||
- (code == 0x21f) ||
- (code == 0x223) ||
- (code == 0x225) ||
- (code == 0x227) ||
- (code == 0x229) ||
- (code == 0x22b) ||
- (code == 0x22d) ||
- (code == 0x22f) ||
- (code == 0x231) ||
- (code == 0x233) ||
- ((code >= 0x250) && (code <= 0x2ad)) ||
- (code == 0x390) ||
- ((code >= 0x3ac) && (code <= 0x3ce)) ||
- ((code >= 0x3d0) && (code <= 0x3d1)) ||
- ((code >= 0x3d5) && (code <= 0x3d7)) ||
- (code == 0x3db) ||
- (code == 0x3dd) ||
- (code == 0x3df) ||
- (code == 0x3e1) ||
- (code == 0x3e3) ||
- (code == 0x3e5) ||
- (code == 0x3e7) ||
- (code == 0x3e9) ||
- (code == 0x3eb) ||
- (code == 0x3ed) ||
- ((code >= 0x3ef) && (code <= 0x3f3)) ||
- (code == 0x3f5) ||
- ((code >= 0x430) && (code <= 0x45f)) ||
- (code == 0x461) ||
- (code == 0x463) ||
- (code == 0x465) ||
- (code == 0x467) ||
- (code == 0x469) ||
- (code == 0x46b) ||
- (code == 0x46d) ||
- (code == 0x46f) ||
- (code == 0x471) ||
- (code == 0x473) ||
- (code == 0x475) ||
- (code == 0x477) ||
- (code == 0x479) ||
- (code == 0x47b) ||
- (code == 0x47d) ||
- (code == 0x47f) ||
- (code == 0x481) ||
- (code == 0x48d) ||
- (code == 0x48f) ||
- (code == 0x491) ||
- (code == 0x493) ||
- (code == 0x495) ||
- (code == 0x497) ||
- (code == 0x499) ||
- (code == 0x49b) ||
- (code == 0x49d) ||
- (code == 0x49f) ||
- (code == 0x4a1) ||
- (code == 0x4a3) ||
- (code == 0x4a5) ||
- (code == 0x4a7) ||
- (code == 0x4a9) ||
- (code == 0x4ab) ||
- (code == 0x4ad) ||
- (code == 0x4af) ||
- (code == 0x4b1) ||
- (code == 0x4b3) ||
- (code == 0x4b5) ||
- (code == 0x4b7) ||
- (code == 0x4b9) ||
- (code == 0x4bb) ||
- (code == 0x4bd) ||
- (code == 0x4bf) ||
- (code == 0x4c2) ||
- (code == 0x4c4) ||
- (code == 0x4c8) ||
- (code == 0x4cc) ||
- (code == 0x4d1) ||
- (code == 0x4d3) ||
- (code == 0x4d5) ||
- (code == 0x4d7) ||
- (code == 0x4d9) ||
- (code == 0x4db) ||
- (code == 0x4dd) ||
- (code == 0x4df) ||
- (code == 0x4e1) ||
- (code == 0x4e3) ||
- (code == 0x4e5) ||
- (code == 0x4e7) ||
- (code == 0x4e9) ||
- (code == 0x4eb) ||
- (code == 0x4ed) ||
- (code == 0x4ef) ||
- (code == 0x4f1) ||
- (code == 0x4f3) ||
- (code == 0x4f5) ||
- (code == 0x4f9) ||
- ((code >= 0x561) && (code <= 0x587)) ||
- (code == 0x1e01) ||
- (code == 0x1e03) ||
- (code == 0x1e05) ||
- (code == 0x1e07) ||
- (code == 0x1e09) ||
- (code == 0x1e0b) ||
- (code == 0x1e0d) ||
- (code == 0x1e0f) ||
- (code == 0x1e11) ||
- (code == 0x1e13) ||
- (code == 0x1e15) ||
- (code == 0x1e17) ||
- (code == 0x1e19) ||
- (code == 0x1e1b) ||
- (code == 0x1e1d) ||
- (code == 0x1e1f) ||
- (code == 0x1e21) ||
- (code == 0x1e23) ||
- (code == 0x1e25) ||
- (code == 0x1e27) ||
- (code == 0x1e29) ||
- (code == 0x1e2b) ||
- (code == 0x1e2d) ||
- (code == 0x1e2f) ||
- (code == 0x1e31) ||
- (code == 0x1e33) ||
- (code == 0x1e35) ||
- (code == 0x1e37) ||
- (code == 0x1e39) ||
- (code == 0x1e3b) ||
- (code == 0x1e3d) ||
- (code == 0x1e3f) ||
- (code == 0x1e41) ||
- (code == 0x1e43) ||
- (code == 0x1e45) ||
- (code == 0x1e47) ||
- (code == 0x1e49) ||
- (code == 0x1e4b) ||
- (code == 0x1e4d) ||
- (code == 0x1e4f) ||
- (code == 0x1e51) ||
- (code == 0x1e53) ||
- (code == 0x1e55) ||
- (code == 0x1e57) ||
- (code == 0x1e59) ||
- (code == 0x1e5b) ||
- (code == 0x1e5d) ||
- (code == 0x1e5f) ||
- (code == 0x1e61) ||
- (code == 0x1e63) ||
- (code == 0x1e65) ||
- (code == 0x1e67) ||
- (code == 0x1e69) ||
- (code == 0x1e6b) ||
- (code == 0x1e6d) ||
- (code == 0x1e6f) ||
- (code == 0x1e71) ||
- (code == 0x1e73) ||
- (code == 0x1e75) ||
- (code == 0x1e77) ||
- (code == 0x1e79) ||
- (code == 0x1e7b) ||
- (code == 0x1e7d) ||
- (code == 0x1e7f) ||
- (code == 0x1e81) ||
- (code == 0x1e83) ||
- (code == 0x1e85) ||
- (code == 0x1e87) ||
- (code == 0x1e89) ||
- (code == 0x1e8b) ||
- (code == 0x1e8d) ||
- (code == 0x1e8f) ||
- (code == 0x1e91) ||
- (code == 0x1e93) ||
- ((code >= 0x1e95) && (code <= 0x1e9b)) ||
- (code == 0x1ea1) ||
- (code == 0x1ea3) ||
- (code == 0x1ea5) ||
- (code == 0x1ea7) ||
- (code == 0x1ea9) ||
- (code == 0x1eab) ||
- (code == 0x1ead) ||
- (code == 0x1eaf) ||
- (code == 0x1eb1) ||
- (code == 0x1eb3) ||
- (code == 0x1eb5) ||
- (code == 0x1eb7) ||
- (code == 0x1eb9) ||
- (code == 0x1ebb) ||
- (code == 0x1ebd) ||
- (code == 0x1ebf) ||
- (code == 0x1ec1) ||
- (code == 0x1ec3) ||
- (code == 0x1ec5) ||
- (code == 0x1ec7) ||
- (code == 0x1ec9) ||
- (code == 0x1ecb) ||
- (code == 0x1ecd) ||
- (code == 0x1ecf) ||
- (code == 0x1ed1) ||
- (code == 0x1ed3) ||
- (code == 0x1ed5) ||
- (code == 0x1ed7) ||
- (code == 0x1ed9) ||
- (code == 0x1edb) ||
- (code == 0x1edd) ||
- (code == 0x1edf) ||
- (code == 0x1ee1) ||
- (code == 0x1ee3) ||
- (code == 0x1ee5) ||
- (code == 0x1ee7) ||
- (code == 0x1ee9) ||
- (code == 0x1eeb) ||
- (code == 0x1eed) ||
- (code == 0x1eef) ||
- (code == 0x1ef1) ||
- (code == 0x1ef3) ||
- (code == 0x1ef5) ||
- (code == 0x1ef7) ||
- (code == 0x1ef9) ||
- ((code >= 0x1f00) && (code <= 0x1f07)) ||
- ((code >= 0x1f10) && (code <= 0x1f15)) ||
- ((code >= 0x1f20) && (code <= 0x1f27)) ||
- ((code >= 0x1f30) && (code <= 0x1f37)) ||
- ((code >= 0x1f40) && (code <= 0x1f45)) ||
- ((code >= 0x1f50) && (code <= 0x1f57)) ||
- ((code >= 0x1f60) && (code <= 0x1f67)) ||
- ((code >= 0x1f70) && (code <= 0x1f7d)) ||
- ((code >= 0x1f80) && (code <= 0x1f87)) ||
- ((code >= 0x1f90) && (code <= 0x1f97)) ||
- ((code >= 0x1fa0) && (code <= 0x1fa7)) ||
- ((code >= 0x1fb0) && (code <= 0x1fb4)) ||
- ((code >= 0x1fb6) && (code <= 0x1fb7)) ||
- (code == 0x1fbe) ||
- ((code >= 0x1fc2) && (code <= 0x1fc4)) ||
- ((code >= 0x1fc6) && (code <= 0x1fc7)) ||
- ((code >= 0x1fd0) && (code <= 0x1fd3)) ||
- ((code >= 0x1fd6) && (code <= 0x1fd7)) ||
- ((code >= 0x1fe0) && (code <= 0x1fe7)) ||
- ((code >= 0x1ff2) && (code <= 0x1ff4)) ||
- ((code >= 0x1ff6) && (code <= 0x1ff7)) ||
- (code == 0x207f) ||
- (code == 0x210a) ||
- ((code >= 0x210e) && (code <= 0x210f)) ||
- (code == 0x2113) ||
- (code == 0x212f) ||
- (code == 0x2134) ||
- (code == 0x2139) ||
- ((code >= 0xfb00) && (code <= 0xfb06)) ||
- ((code >= 0xfb13) && (code <= 0xfb17)) ||
- ((code >= 0xff41) && (code <= 0xff5a)) ||
- ((code >= 0x10428) && (code <= 0x1044d)) ||
- ((code >= 0x1d41a) && (code <= 0x1d433)) ||
- ((code >= 0x1d44e) && (code <= 0x1d454)) ||
- ((code >= 0x1d456) && (code <= 0x1d467)) ||
- ((code >= 0x1d482) && (code <= 0x1d49b)) ||
- ((code >= 0x1d4b6) && (code <= 0x1d4b9)) ||
- (code == 0x1d4bb) ||
- ((code >= 0x1d4bd) && (code <= 0x1d4c0)) ||
- ((code >= 0x1d4c2) && (code <= 0x1d4c3)) ||
- ((code >= 0x1d4c5) && (code <= 0x1d4cf)) ||
- ((code >= 0x1d4ea) && (code <= 0x1d503)) ||
- ((code >= 0x1d51e) && (code <= 0x1d537)) ||
- ((code >= 0x1d552) && (code <= 0x1d56b)) ||
- ((code >= 0x1d586) && (code <= 0x1d59f)) ||
- ((code >= 0x1d5ba) && (code <= 0x1d5d3)) ||
- ((code >= 0x1d5ee) && (code <= 0x1d607)) ||
- ((code >= 0x1d622) && (code <= 0x1d63b)) ||
- ((code >= 0x1d656) && (code <= 0x1d66f)) ||
- ((code >= 0x1d68a) && (code <= 0x1d6a3)) ||
- ((code >= 0x1d6c2) && (code <= 0x1d6da)) ||
- ((code >= 0x1d6dc) && (code <= 0x1d6e1)) ||
- ((code >= 0x1d6fc) && (code <= 0x1d714)) ||
- ((code >= 0x1d716) && (code <= 0x1d71b)) ||
- ((code >= 0x1d736) && (code <= 0x1d74e)) ||
- ((code >= 0x1d750) && (code <= 0x1d755)) ||
- ((code >= 0x1d770) && (code <= 0x1d788)) ||
- ((code >= 0x1d78a) && (code <= 0x1d78f)) ||
- ((code >= 0x1d7aa) && (code <= 0x1d7c2)) ||
- ((code >= 0x1d7c4) && (code <= 0x1d7c9)));
-}
-
-/**
- * xmlUCSIsCatLm:
- * @code: UCS code point
- *
- * Check whether the character is part of Lm UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatLm(int code) {
- return(((code >= 0x2b0) && (code <= 0x2b8)) ||
- ((code >= 0x2bb) && (code <= 0x2c1)) ||
- ((code >= 0x2d0) && (code <= 0x2d1)) ||
- ((code >= 0x2e0) && (code <= 0x2e4)) ||
- (code == 0x2ee) ||
- (code == 0x37a) ||
- (code == 0x559) ||
- (code == 0x640) ||
- ((code >= 0x6e5) && (code <= 0x6e6)) ||
- (code == 0xe46) ||
- (code == 0xec6) ||
- (code == 0x1843) ||
- (code == 0x3005) ||
- ((code >= 0x3031) && (code <= 0x3035)) ||
- ((code >= 0x309d) && (code <= 0x309e)) ||
- ((code >= 0x30fc) && (code <= 0x30fe)) ||
- (code == 0xff70) ||
- ((code >= 0xff9e) && (code <= 0xff9f)));
-}
-
-/**
- * xmlUCSIsCatLo:
- * @code: UCS code point
- *
- * Check whether the character is part of Lo UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatLo(int code) {
- return((code == 0x1bb) ||
- ((code >= 0x1c0) && (code <= 0x1c3)) ||
- ((code >= 0x5d0) && (code <= 0x5ea)) ||
- ((code >= 0x5f0) && (code <= 0x5f2)) ||
- ((code >= 0x621) && (code <= 0x63a)) ||
- ((code >= 0x641) && (code <= 0x64a)) ||
- ((code >= 0x671) && (code <= 0x6d3)) ||
- (code == 0x6d5) ||
- ((code >= 0x6fa) && (code <= 0x6fc)) ||
- (code == 0x710) ||
- ((code >= 0x712) && (code <= 0x72c)) ||
- ((code >= 0x780) && (code <= 0x7a5)) ||
- ((code >= 0x905) && (code <= 0x939)) ||
- (code == 0x93d) ||
- (code == 0x950) ||
- ((code >= 0x958) && (code <= 0x961)) ||
- ((code >= 0x985) && (code <= 0x98c)) ||
- ((code >= 0x98f) && (code <= 0x990)) ||
- ((code >= 0x993) && (code <= 0x9a8)) ||
- ((code >= 0x9aa) && (code <= 0x9b0)) ||
- (code == 0x9b2) ||
- ((code >= 0x9b6) && (code <= 0x9b9)) ||
- ((code >= 0x9dc) && (code <= 0x9dd)) ||
- ((code >= 0x9df) && (code <= 0x9e1)) ||
- ((code >= 0x9f0) && (code <= 0x9f1)) ||
- ((code >= 0xa05) && (code <= 0xa0a)) ||
- ((code >= 0xa0f) && (code <= 0xa10)) ||
- ((code >= 0xa13) && (code <= 0xa28)) ||
- ((code >= 0xa2a) && (code <= 0xa30)) ||
- ((code >= 0xa32) && (code <= 0xa33)) ||
- ((code >= 0xa35) && (code <= 0xa36)) ||
- ((code >= 0xa38) && (code <= 0xa39)) ||
- ((code >= 0xa59) && (code <= 0xa5c)) ||
- (code == 0xa5e) ||
- ((code >= 0xa72) && (code <= 0xa74)) ||
- ((code >= 0xa85) && (code <= 0xa8b)) ||
- (code == 0xa8d) ||
- ((code >= 0xa8f) && (code <= 0xa91)) ||
- ((code >= 0xa93) && (code <= 0xaa8)) ||
- ((code >= 0xaaa) && (code <= 0xab0)) ||
- ((code >= 0xab2) && (code <= 0xab3)) ||
- ((code >= 0xab5) && (code <= 0xab9)) ||
- (code == 0xabd) ||
- (code == 0xad0) ||
- (code == 0xae0) ||
- ((code >= 0xb05) && (code <= 0xb0c)) ||
- ((code >= 0xb0f) && (code <= 0xb10)) ||
- ((code >= 0xb13) && (code <= 0xb28)) ||
- ((code >= 0xb2a) && (code <= 0xb30)) ||
- ((code >= 0xb32) && (code <= 0xb33)) ||
- ((code >= 0xb36) && (code <= 0xb39)) ||
- (code == 0xb3d) ||
- ((code >= 0xb5c) && (code <= 0xb5d)) ||
- ((code >= 0xb5f) && (code <= 0xb61)) ||
- ((code >= 0xb85) && (code <= 0xb8a)) ||
- ((code >= 0xb8e) && (code <= 0xb90)) ||
- ((code >= 0xb92) && (code <= 0xb95)) ||
- ((code >= 0xb99) && (code <= 0xb9a)) ||
- (code == 0xb9c) ||
- ((code >= 0xb9e) && (code <= 0xb9f)) ||
- ((code >= 0xba3) && (code <= 0xba4)) ||
- ((code >= 0xba8) && (code <= 0xbaa)) ||
- ((code >= 0xbae) && (code <= 0xbb5)) ||
- ((code >= 0xbb7) && (code <= 0xbb9)) ||
- ((code >= 0xc05) && (code <= 0xc0c)) ||
- ((code >= 0xc0e) && (code <= 0xc10)) ||
- ((code >= 0xc12) && (code <= 0xc28)) ||
- ((code >= 0xc2a) && (code <= 0xc33)) ||
- ((code >= 0xc35) && (code <= 0xc39)) ||
- ((code >= 0xc60) && (code <= 0xc61)) ||
- ((code >= 0xc85) && (code <= 0xc8c)) ||
- ((code >= 0xc8e) && (code <= 0xc90)) ||
- ((code >= 0xc92) && (code <= 0xca8)) ||
- ((code >= 0xcaa) && (code <= 0xcb3)) ||
- ((code >= 0xcb5) && (code <= 0xcb9)) ||
- (code == 0xcde) ||
- ((code >= 0xce0) && (code <= 0xce1)) ||
- ((code >= 0xd05) && (code <= 0xd0c)) ||
- ((code >= 0xd0e) && (code <= 0xd10)) ||
- ((code >= 0xd12) && (code <= 0xd28)) ||
- ((code >= 0xd2a) && (code <= 0xd39)) ||
- ((code >= 0xd60) && (code <= 0xd61)) ||
- ((code >= 0xd85) && (code <= 0xd96)) ||
- ((code >= 0xd9a) && (code <= 0xdb1)) ||
- ((code >= 0xdb3) && (code <= 0xdbb)) ||
- (code == 0xdbd) ||
- ((code >= 0xdc0) && (code <= 0xdc6)) ||
- ((code >= 0xe01) && (code <= 0xe30)) ||
- ((code >= 0xe32) && (code <= 0xe33)) ||
- ((code >= 0xe40) && (code <= 0xe45)) ||
- ((code >= 0xe81) && (code <= 0xe82)) ||
- (code == 0xe84) ||
- ((code >= 0xe87) && (code <= 0xe88)) ||
- (code == 0xe8a) ||
- (code == 0xe8d) ||
- ((code >= 0xe94) && (code <= 0xe97)) ||
- ((code >= 0xe99) && (code <= 0xe9f)) ||
- ((code >= 0xea1) && (code <= 0xea3)) ||
- (code == 0xea5) ||
- (code == 0xea7) ||
- ((code >= 0xeaa) && (code <= 0xeab)) ||
- ((code >= 0xead) && (code <= 0xeb0)) ||
- ((code >= 0xeb2) && (code <= 0xeb3)) ||
- (code == 0xebd) ||
- ((code >= 0xec0) && (code <= 0xec4)) ||
- ((code >= 0xedc) && (code <= 0xedd)) ||
- (code == 0xf00) ||
- ((code >= 0xf40) && (code <= 0xf47)) ||
- ((code >= 0xf49) && (code <= 0xf6a)) ||
- ((code >= 0xf88) && (code <= 0xf8b)) ||
- ((code >= 0x1000) && (code <= 0x1021)) ||
- ((code >= 0x1023) && (code <= 0x1027)) ||
- ((code >= 0x1029) && (code <= 0x102a)) ||
- ((code >= 0x1050) && (code <= 0x1055)) ||
- ((code >= 0x10d0) && (code <= 0x10f6)) ||
- ((code >= 0x1100) && (code <= 0x1159)) ||
- ((code >= 0x115f) && (code <= 0x11a2)) ||
- ((code >= 0x11a8) && (code <= 0x11f9)) ||
- ((code >= 0x1200) && (code <= 0x1206)) ||
- ((code >= 0x1208) && (code <= 0x1246)) ||
- (code == 0x1248) ||
- ((code >= 0x124a) && (code <= 0x124d)) ||
- ((code >= 0x1250) && (code <= 0x1256)) ||
- (code == 0x1258) ||
- ((code >= 0x125a) && (code <= 0x125d)) ||
- ((code >= 0x1260) && (code <= 0x1286)) ||
- (code == 0x1288) ||
- ((code >= 0x128a) && (code <= 0x128d)) ||
- ((code >= 0x1290) && (code <= 0x12ae)) ||
- (code == 0x12b0) ||
- ((code >= 0x12b2) && (code <= 0x12b5)) ||
- ((code >= 0x12b8) && (code <= 0x12be)) ||
- (code == 0x12c0) ||
- ((code >= 0x12c2) && (code <= 0x12c5)) ||
- ((code >= 0x12c8) && (code <= 0x12ce)) ||
- ((code >= 0x12d0) && (code <= 0x12d6)) ||
- ((code >= 0x12d8) && (code <= 0x12ee)) ||
- ((code >= 0x12f0) && (code <= 0x130e)) ||
- (code == 0x1310) ||
- ((code >= 0x1312) && (code <= 0x1315)) ||
- ((code >= 0x1318) && (code <= 0x131e)) ||
- ((code >= 0x1320) && (code <= 0x1346)) ||
- ((code >= 0x1348) && (code <= 0x135a)) ||
- ((code >= 0x13a0) && (code <= 0x13f4)) ||
- ((code >= 0x1401) && (code <= 0x166c)) ||
- ((code >= 0x166f) && (code <= 0x1676)) ||
- ((code >= 0x1681) && (code <= 0x169a)) ||
- ((code >= 0x16a0) && (code <= 0x16ea)) ||
- ((code >= 0x1780) && (code <= 0x17b3)) ||
- ((code >= 0x1820) && (code <= 0x1842)) ||
- ((code >= 0x1844) && (code <= 0x1877)) ||
- ((code >= 0x1880) && (code <= 0x18a8)) ||
- ((code >= 0x2135) && (code <= 0x2138)) ||
- (code == 0x3006) ||
- ((code >= 0x3041) && (code <= 0x3094)) ||
- ((code >= 0x30a1) && (code <= 0x30fa)) ||
- ((code >= 0x3105) && (code <= 0x312c)) ||
- ((code >= 0x3131) && (code <= 0x318e)) ||
- ((code >= 0x31a0) && (code <= 0x31b7)) ||
- (code == 0x3400) ||
- (code == 0x4db5) ||
- (code == 0x4e00) ||
- (code == 0x9fa5) ||
- ((code >= 0xa000) && (code <= 0xa48c)) ||
- (code == 0xac00) ||
- (code == 0xd7a3) ||
- ((code >= 0xf900) && (code <= 0xfa2d)) ||
- (code == 0xfb1d) ||
- ((code >= 0xfb1f) && (code <= 0xfb28)) ||
- ((code >= 0xfb2a) && (code <= 0xfb36)) ||
- ((code >= 0xfb38) && (code <= 0xfb3c)) ||
- (code == 0xfb3e) ||
- ((code >= 0xfb40) && (code <= 0xfb41)) ||
- ((code >= 0xfb43) && (code <= 0xfb44)) ||
- ((code >= 0xfb46) && (code <= 0xfbb1)) ||
- ((code >= 0xfbd3) && (code <= 0xfd3d)) ||
- ((code >= 0xfd50) && (code <= 0xfd8f)) ||
- ((code >= 0xfd92) && (code <= 0xfdc7)) ||
- ((code >= 0xfdf0) && (code <= 0xfdfb)) ||
- ((code >= 0xfe70) && (code <= 0xfe72)) ||
- (code == 0xfe74) ||
- ((code >= 0xfe76) && (code <= 0xfefc)) ||
- ((code >= 0xff66) && (code <= 0xff6f)) ||
- ((code >= 0xff71) && (code <= 0xff9d)) ||
- ((code >= 0xffa0) && (code <= 0xffbe)) ||
- ((code >= 0xffc2) && (code <= 0xffc7)) ||
- ((code >= 0xffca) && (code <= 0xffcf)) ||
- ((code >= 0xffd2) && (code <= 0xffd7)) ||
- ((code >= 0xffda) && (code <= 0xffdc)) ||
- ((code >= 0x10300) && (code <= 0x1031e)) ||
- ((code >= 0x10330) && (code <= 0x10349)) ||
- (code == 0x20000) ||
- (code == 0x2a6d6) ||
- ((code >= 0x2f800) && (code <= 0x2fa1d)));
-}
-
-/**
- * xmlUCSIsCatLt:
- * @code: UCS code point
- *
- * Check whether the character is part of Lt UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatLt(int code) {
- return((code == 0x1c5) ||
- (code == 0x1c8) ||
- (code == 0x1cb) ||
- (code == 0x1f2) ||
- ((code >= 0x1f88) && (code <= 0x1f8f)) ||
- ((code >= 0x1f98) && (code <= 0x1f9f)) ||
- ((code >= 0x1fa8) && (code <= 0x1faf)) ||
- (code == 0x1fbc) ||
- (code == 0x1fcc) ||
- (code == 0x1ffc));
-}
-
-/**
- * xmlUCSIsCatLu:
- * @code: UCS code point
- *
- * Check whether the character is part of Lu UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatLu(int code) {
- return(((code >= 0x41) && (code <= 0x5a)) ||
- ((code >= 0xc0) && (code <= 0xd6)) ||
- ((code >= 0xd8) && (code <= 0xde)) ||
- (code == 0x100) ||
- (code == 0x102) ||
- (code == 0x104) ||
- (code == 0x106) ||
- (code == 0x108) ||
- (code == 0x10a) ||
- (code == 0x10c) ||
- (code == 0x10e) ||
- (code == 0x110) ||
- (code == 0x112) ||
- (code == 0x114) ||
- (code == 0x116) ||
- (code == 0x118) ||
- (code == 0x11a) ||
- (code == 0x11c) ||
- (code == 0x11e) ||
- (code == 0x120) ||
- (code == 0x122) ||
- (code == 0x124) ||
- (code == 0x126) ||
- (code == 0x128) ||
- (code == 0x12a) ||
- (code == 0x12c) ||
- (code == 0x12e) ||
- (code == 0x130) ||
- (code == 0x132) ||
- (code == 0x134) ||
- (code == 0x136) ||
- (code == 0x139) ||
- (code == 0x13b) ||
- (code == 0x13d) ||
- (code == 0x13f) ||
- (code == 0x141) ||
- (code == 0x143) ||
- (code == 0x145) ||
- (code == 0x147) ||
- (code == 0x14a) ||
- (code == 0x14c) ||
- (code == 0x14e) ||
- (code == 0x150) ||
- (code == 0x152) ||
- (code == 0x154) ||
- (code == 0x156) ||
- (code == 0x158) ||
- (code == 0x15a) ||
- (code == 0x15c) ||
- (code == 0x15e) ||
- (code == 0x160) ||
- (code == 0x162) ||
- (code == 0x164) ||
- (code == 0x166) ||
- (code == 0x168) ||
- (code == 0x16a) ||
- (code == 0x16c) ||
- (code == 0x16e) ||
- (code == 0x170) ||
- (code == 0x172) ||
- (code == 0x174) ||
- (code == 0x176) ||
- ((code >= 0x178) && (code <= 0x179)) ||
- (code == 0x17b) ||
- (code == 0x17d) ||
- ((code >= 0x181) && (code <= 0x182)) ||
- (code == 0x184) ||
- ((code >= 0x186) && (code <= 0x187)) ||
- ((code >= 0x189) && (code <= 0x18b)) ||
- ((code >= 0x18e) && (code <= 0x191)) ||
- ((code >= 0x193) && (code <= 0x194)) ||
- ((code >= 0x196) && (code <= 0x198)) ||
- ((code >= 0x19c) && (code <= 0x19d)) ||
- ((code >= 0x19f) && (code <= 0x1a0)) ||
- (code == 0x1a2) ||
- (code == 0x1a4) ||
- ((code >= 0x1a6) && (code <= 0x1a7)) ||
- (code == 0x1a9) ||
- (code == 0x1ac) ||
- ((code >= 0x1ae) && (code <= 0x1af)) ||
- ((code >= 0x1b1) && (code <= 0x1b3)) ||
- (code == 0x1b5) ||
- ((code >= 0x1b7) && (code <= 0x1b8)) ||
- (code == 0x1bc) ||
- (code == 0x1c4) ||
- (code == 0x1c7) ||
- (code == 0x1ca) ||
- (code == 0x1cd) ||
- (code == 0x1cf) ||
- (code == 0x1d1) ||
- (code == 0x1d3) ||
- (code == 0x1d5) ||
- (code == 0x1d7) ||
- (code == 0x1d9) ||
- (code == 0x1db) ||
- (code == 0x1de) ||
- (code == 0x1e0) ||
- (code == 0x1e2) ||
- (code == 0x1e4) ||
- (code == 0x1e6) ||
- (code == 0x1e8) ||
- (code == 0x1ea) ||
- (code == 0x1ec) ||
- (code == 0x1ee) ||
- (code == 0x1f1) ||
- (code == 0x1f4) ||
- ((code >= 0x1f6) && (code <= 0x1f8)) ||
- (code == 0x1fa) ||
- (code == 0x1fc) ||
- (code == 0x1fe) ||
- (code == 0x200) ||
- (code == 0x202) ||
- (code == 0x204) ||
- (code == 0x206) ||
- (code == 0x208) ||
- (code == 0x20a) ||
- (code == 0x20c) ||
- (code == 0x20e) ||
- (code == 0x210) ||
- (code == 0x212) ||
- (code == 0x214) ||
- (code == 0x216) ||
- (code == 0x218) ||
- (code == 0x21a) ||
- (code == 0x21c) ||
- (code == 0x21e) ||
- (code == 0x222) ||
- (code == 0x224) ||
- (code == 0x226) ||
- (code == 0x228) ||
- (code == 0x22a) ||
- (code == 0x22c) ||
- (code == 0x22e) ||
- (code == 0x230) ||
- (code == 0x232) ||
- (code == 0x386) ||
- ((code >= 0x388) && (code <= 0x38a)) ||
- (code == 0x38c) ||
- ((code >= 0x38e) && (code <= 0x38f)) ||
- ((code >= 0x391) && (code <= 0x3a1)) ||
- ((code >= 0x3a3) && (code <= 0x3ab)) ||
- ((code >= 0x3d2) && (code <= 0x3d4)) ||
- (code == 0x3da) ||
- (code == 0x3dc) ||
- (code == 0x3de) ||
- (code == 0x3e0) ||
- (code == 0x3e2) ||
- (code == 0x3e4) ||
- (code == 0x3e6) ||
- (code == 0x3e8) ||
- (code == 0x3ea) ||
- (code == 0x3ec) ||
- (code == 0x3ee) ||
- (code == 0x3f4) ||
- ((code >= 0x400) && (code <= 0x42f)) ||
- (code == 0x460) ||
- (code == 0x462) ||
- (code == 0x464) ||
- (code == 0x466) ||
- (code == 0x468) ||
- (code == 0x46a) ||
- (code == 0x46c) ||
- (code == 0x46e) ||
- (code == 0x470) ||
- (code == 0x472) ||
- (code == 0x474) ||
- (code == 0x476) ||
- (code == 0x478) ||
- (code == 0x47a) ||
- (code == 0x47c) ||
- (code == 0x47e) ||
- (code == 0x480) ||
- (code == 0x48c) ||
- (code == 0x48e) ||
- (code == 0x490) ||
- (code == 0x492) ||
- (code == 0x494) ||
- (code == 0x496) ||
- (code == 0x498) ||
- (code == 0x49a) ||
- (code == 0x49c) ||
- (code == 0x49e) ||
- (code == 0x4a0) ||
- (code == 0x4a2) ||
- (code == 0x4a4) ||
- (code == 0x4a6) ||
- (code == 0x4a8) ||
- (code == 0x4aa) ||
- (code == 0x4ac) ||
- (code == 0x4ae) ||
- (code == 0x4b0) ||
- (code == 0x4b2) ||
- (code == 0x4b4) ||
- (code == 0x4b6) ||
- (code == 0x4b8) ||
- (code == 0x4ba) ||
- (code == 0x4bc) ||
- (code == 0x4be) ||
- ((code >= 0x4c0) && (code <= 0x4c1)) ||
- (code == 0x4c3) ||
- (code == 0x4c7) ||
- (code == 0x4cb) ||
- (code == 0x4d0) ||
- (code == 0x4d2) ||
- (code == 0x4d4) ||
- (code == 0x4d6) ||
- (code == 0x4d8) ||
- (code == 0x4da) ||
- (code == 0x4dc) ||
- (code == 0x4de) ||
- (code == 0x4e0) ||
- (code == 0x4e2) ||
- (code == 0x4e4) ||
- (code == 0x4e6) ||
- (code == 0x4e8) ||
- (code == 0x4ea) ||
- (code == 0x4ec) ||
- (code == 0x4ee) ||
- (code == 0x4f0) ||
- (code == 0x4f2) ||
- (code == 0x4f4) ||
- (code == 0x4f8) ||
- ((code >= 0x531) && (code <= 0x556)) ||
- ((code >= 0x10a0) && (code <= 0x10c5)) ||
- (code == 0x1e00) ||
- (code == 0x1e02) ||
- (code == 0x1e04) ||
- (code == 0x1e06) ||
- (code == 0x1e08) ||
- (code == 0x1e0a) ||
- (code == 0x1e0c) ||
- (code == 0x1e0e) ||
- (code == 0x1e10) ||
- (code == 0x1e12) ||
- (code == 0x1e14) ||
- (code == 0x1e16) ||
- (code == 0x1e18) ||
- (code == 0x1e1a) ||
- (code == 0x1e1c) ||
- (code == 0x1e1e) ||
- (code == 0x1e20) ||
- (code == 0x1e22) ||
- (code == 0x1e24) ||
- (code == 0x1e26) ||
- (code == 0x1e28) ||
- (code == 0x1e2a) ||
- (code == 0x1e2c) ||
- (code == 0x1e2e) ||
- (code == 0x1e30) ||
- (code == 0x1e32) ||
- (code == 0x1e34) ||
- (code == 0x1e36) ||
- (code == 0x1e38) ||
- (code == 0x1e3a) ||
- (code == 0x1e3c) ||
- (code == 0x1e3e) ||
- (code == 0x1e40) ||
- (code == 0x1e42) ||
- (code == 0x1e44) ||
- (code == 0x1e46) ||
- (code == 0x1e48) ||
- (code == 0x1e4a) ||
- (code == 0x1e4c) ||
- (code == 0x1e4e) ||
- (code == 0x1e50) ||
- (code == 0x1e52) ||
- (code == 0x1e54) ||
- (code == 0x1e56) ||
- (code == 0x1e58) ||
- (code == 0x1e5a) ||
- (code == 0x1e5c) ||
- (code == 0x1e5e) ||
- (code == 0x1e60) ||
- (code == 0x1e62) ||
- (code == 0x1e64) ||
- (code == 0x1e66) ||
- (code == 0x1e68) ||
- (code == 0x1e6a) ||
- (code == 0x1e6c) ||
- (code == 0x1e6e) ||
- (code == 0x1e70) ||
- (code == 0x1e72) ||
- (code == 0x1e74) ||
- (code == 0x1e76) ||
- (code == 0x1e78) ||
- (code == 0x1e7a) ||
- (code == 0x1e7c) ||
- (code == 0x1e7e) ||
- (code == 0x1e80) ||
- (code == 0x1e82) ||
- (code == 0x1e84) ||
- (code == 0x1e86) ||
- (code == 0x1e88) ||
- (code == 0x1e8a) ||
- (code == 0x1e8c) ||
- (code == 0x1e8e) ||
- (code == 0x1e90) ||
- (code == 0x1e92) ||
- (code == 0x1e94) ||
- (code == 0x1ea0) ||
- (code == 0x1ea2) ||
- (code == 0x1ea4) ||
- (code == 0x1ea6) ||
- (code == 0x1ea8) ||
- (code == 0x1eaa) ||
- (code == 0x1eac) ||
- (code == 0x1eae) ||
- (code == 0x1eb0) ||
- (code == 0x1eb2) ||
- (code == 0x1eb4) ||
- (code == 0x1eb6) ||
- (code == 0x1eb8) ||
- (code == 0x1eba) ||
- (code == 0x1ebc) ||
- (code == 0x1ebe) ||
- (code == 0x1ec0) ||
- (code == 0x1ec2) ||
- (code == 0x1ec4) ||
- (code == 0x1ec6) ||
- (code == 0x1ec8) ||
- (code == 0x1eca) ||
- (code == 0x1ecc) ||
- (code == 0x1ece) ||
- (code == 0x1ed0) ||
- (code == 0x1ed2) ||
- (code == 0x1ed4) ||
- (code == 0x1ed6) ||
- (code == 0x1ed8) ||
- (code == 0x1eda) ||
- (code == 0x1edc) ||
- (code == 0x1ede) ||
- (code == 0x1ee0) ||
- (code == 0x1ee2) ||
- (code == 0x1ee4) ||
- (code == 0x1ee6) ||
- (code == 0x1ee8) ||
- (code == 0x1eea) ||
- (code == 0x1eec) ||
- (code == 0x1eee) ||
- (code == 0x1ef0) ||
- (code == 0x1ef2) ||
- (code == 0x1ef4) ||
- (code == 0x1ef6) ||
- (code == 0x1ef8) ||
- ((code >= 0x1f08) && (code <= 0x1f0f)) ||
- ((code >= 0x1f18) && (code <= 0x1f1d)) ||
- ((code >= 0x1f28) && (code <= 0x1f2f)) ||
- ((code >= 0x1f38) && (code <= 0x1f3f)) ||
- ((code >= 0x1f48) && (code <= 0x1f4d)) ||
- (code == 0x1f59) ||
- (code == 0x1f5b) ||
- (code == 0x1f5d) ||
- (code == 0x1f5f) ||
- ((code >= 0x1f68) && (code <= 0x1f6f)) ||
- ((code >= 0x1fb8) && (code <= 0x1fbb)) ||
- ((code >= 0x1fc8) && (code <= 0x1fcb)) ||
- ((code >= 0x1fd8) && (code <= 0x1fdb)) ||
- ((code >= 0x1fe8) && (code <= 0x1fec)) ||
- ((code >= 0x1ff8) && (code <= 0x1ffb)) ||
- (code == 0x2102) ||
- (code == 0x2107) ||
- ((code >= 0x210b) && (code <= 0x210d)) ||
- ((code >= 0x2110) && (code <= 0x2112)) ||
- (code == 0x2115) ||
- ((code >= 0x2119) && (code <= 0x211d)) ||
- (code == 0x2124) ||
- (code == 0x2126) ||
- (code == 0x2128) ||
- ((code >= 0x212a) && (code <= 0x212d)) ||
- ((code >= 0x2130) && (code <= 0x2131)) ||
- (code == 0x2133) ||
- ((code >= 0xff21) && (code <= 0xff3a)) ||
- ((code >= 0x10400) && (code <= 0x10425)) ||
- ((code >= 0x1d400) && (code <= 0x1d419)) ||
- ((code >= 0x1d434) && (code <= 0x1d44d)) ||
- ((code >= 0x1d468) && (code <= 0x1d481)) ||
- (code == 0x1d49c) ||
- ((code >= 0x1d49e) && (code <= 0x1d49f)) ||
- (code == 0x1d4a2) ||
- ((code >= 0x1d4a5) && (code <= 0x1d4a6)) ||
- ((code >= 0x1d4a9) && (code <= 0x1d4ac)) ||
- ((code >= 0x1d4ae) && (code <= 0x1d4b5)) ||
- ((code >= 0x1d4d0) && (code <= 0x1d4e9)) ||
- ((code >= 0x1d504) && (code <= 0x1d505)) ||
- ((code >= 0x1d507) && (code <= 0x1d50a)) ||
- ((code >= 0x1d50d) && (code <= 0x1d514)) ||
- ((code >= 0x1d516) && (code <= 0x1d51c)) ||
- ((code >= 0x1d538) && (code <= 0x1d539)) ||
- ((code >= 0x1d53b) && (code <= 0x1d53e)) ||
- ((code >= 0x1d540) && (code <= 0x1d544)) ||
- (code == 0x1d546) ||
- ((code >= 0x1d54a) && (code <= 0x1d550)) ||
- ((code >= 0x1d56c) && (code <= 0x1d585)) ||
- ((code >= 0x1d5a0) && (code <= 0x1d5b9)) ||
- ((code >= 0x1d5d4) && (code <= 0x1d5ed)) ||
- ((code >= 0x1d608) && (code <= 0x1d621)) ||
- ((code >= 0x1d63c) && (code <= 0x1d655)) ||
- ((code >= 0x1d670) && (code <= 0x1d689)) ||
- ((code >= 0x1d6a8) && (code <= 0x1d6c0)) ||
- ((code >= 0x1d6e2) && (code <= 0x1d6fa)) ||
- ((code >= 0x1d71c) && (code <= 0x1d734)) ||
- ((code >= 0x1d756) && (code <= 0x1d76e)) ||
- ((code >= 0x1d790) && (code <= 0x1d7a8)));
-}
-
-/**
- * xmlUCSIsCatM:
- * @code: UCS code point
- *
- * Check whether the character is part of M UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatM(int code) {
- return(((code >= 0x300) && (code <= 0x34e)) ||
- ((code >= 0x360) && (code <= 0x362)) ||
- ((code >= 0x483) && (code <= 0x486)) ||
- ((code >= 0x488) && (code <= 0x489)) ||
- ((code >= 0x591) && (code <= 0x5a1)) ||
- ((code >= 0x5a3) && (code <= 0x5b9)) ||
- ((code >= 0x5bb) && (code <= 0x5bd)) ||
- (code == 0x5bf) ||
- ((code >= 0x5c1) && (code <= 0x5c2)) ||
- (code == 0x5c4) ||
- ((code >= 0x64b) && (code <= 0x655)) ||
- (code == 0x670) ||
- ((code >= 0x6d6) && (code <= 0x6e4)) ||
- ((code >= 0x6e7) && (code <= 0x6e8)) ||
- ((code >= 0x6ea) && (code <= 0x6ed)) ||
- (code == 0x711) ||
- ((code >= 0x730) && (code <= 0x74a)) ||
- ((code >= 0x7a6) && (code <= 0x7b0)) ||
- ((code >= 0x901) && (code <= 0x903)) ||
- (code == 0x93c) ||
- ((code >= 0x93e) && (code <= 0x94d)) ||
- ((code >= 0x951) && (code <= 0x954)) ||
- ((code >= 0x962) && (code <= 0x963)) ||
- ((code >= 0x981) && (code <= 0x983)) ||
- (code == 0x9bc) ||
- ((code >= 0x9be) && (code <= 0x9c4)) ||
- ((code >= 0x9c7) && (code <= 0x9c8)) ||
- ((code >= 0x9cb) && (code <= 0x9cd)) ||
- (code == 0x9d7) ||
- ((code >= 0x9e2) && (code <= 0x9e3)) ||
- (code == 0xa02) ||
- (code == 0xa3c) ||
- ((code >= 0xa3e) && (code <= 0xa42)) ||
- ((code >= 0xa47) && (code <= 0xa48)) ||
- ((code >= 0xa4b) && (code <= 0xa4d)) ||
- ((code >= 0xa70) && (code <= 0xa71)) ||
- ((code >= 0xa81) && (code <= 0xa83)) ||
- (code == 0xabc) ||
- ((code >= 0xabe) && (code <= 0xac5)) ||
- ((code >= 0xac7) && (code <= 0xac9)) ||
- ((code >= 0xacb) && (code <= 0xacd)) ||
- ((code >= 0xb01) && (code <= 0xb03)) ||
- (code == 0xb3c) ||
- ((code >= 0xb3e) && (code <= 0xb43)) ||
- ((code >= 0xb47) && (code <= 0xb48)) ||
- ((code >= 0xb4b) && (code <= 0xb4d)) ||
- ((code >= 0xb56) && (code <= 0xb57)) ||
- ((code >= 0xb82) && (code <= 0xb83)) ||
- ((code >= 0xbbe) && (code <= 0xbc2)) ||
- ((code >= 0xbc6) && (code <= 0xbc8)) ||
- ((code >= 0xbca) && (code <= 0xbcd)) ||
- (code == 0xbd7) ||
- ((code >= 0xc01) && (code <= 0xc03)) ||
- ((code >= 0xc3e) && (code <= 0xc44)) ||
- ((code >= 0xc46) && (code <= 0xc48)) ||
- ((code >= 0xc4a) && (code <= 0xc4d)) ||
- ((code >= 0xc55) && (code <= 0xc56)) ||
- ((code >= 0xc82) && (code <= 0xc83)) ||
- ((code >= 0xcbe) && (code <= 0xcc4)) ||
- ((code >= 0xcc6) && (code <= 0xcc8)) ||
- ((code >= 0xcca) && (code <= 0xccd)) ||
- ((code >= 0xcd5) && (code <= 0xcd6)) ||
- ((code >= 0xd02) && (code <= 0xd03)) ||
- ((code >= 0xd3e) && (code <= 0xd43)) ||
- ((code >= 0xd46) && (code <= 0xd48)) ||
- ((code >= 0xd4a) && (code <= 0xd4d)) ||
- (code == 0xd57) ||
- ((code >= 0xd82) && (code <= 0xd83)) ||
- (code == 0xdca) ||
- ((code >= 0xdcf) && (code <= 0xdd4)) ||
- (code == 0xdd6) ||
- ((code >= 0xdd8) && (code <= 0xddf)) ||
- ((code >= 0xdf2) && (code <= 0xdf3)) ||
- (code == 0xe31) ||
- ((code >= 0xe34) && (code <= 0xe3a)) ||
- ((code >= 0xe47) && (code <= 0xe4e)) ||
- (code == 0xeb1) ||
- ((code >= 0xeb4) && (code <= 0xeb9)) ||
- ((code >= 0xebb) && (code <= 0xebc)) ||
- ((code >= 0xec8) && (code <= 0xecd)) ||
- ((code >= 0xf18) && (code <= 0xf19)) ||
- (code == 0xf35) ||
- (code == 0xf37) ||
- (code == 0xf39) ||
- ((code >= 0xf3e) && (code <= 0xf3f)) ||
- ((code >= 0xf71) && (code <= 0xf84)) ||
- ((code >= 0xf86) && (code <= 0xf87)) ||
- ((code >= 0xf90) && (code <= 0xf97)) ||
- ((code >= 0xf99) && (code <= 0xfbc)) ||
- (code == 0xfc6) ||
- ((code >= 0x102c) && (code <= 0x1032)) ||
- ((code >= 0x1036) && (code <= 0x1039)) ||
- ((code >= 0x1056) && (code <= 0x1059)) ||
- ((code >= 0x17b4) && (code <= 0x17d3)) ||
- (code == 0x18a9) ||
- ((code >= 0x20d0) && (code <= 0x20e3)) ||
- ((code >= 0x302a) && (code <= 0x302f)) ||
- ((code >= 0x3099) && (code <= 0x309a)) ||
- (code == 0xfb1e) ||
- ((code >= 0xfe20) && (code <= 0xfe23)) ||
- ((code >= 0x1d165) && (code <= 0x1d169)) ||
- ((code >= 0x1d16d) && (code <= 0x1d172)) ||
- ((code >= 0x1d17b) && (code <= 0x1d182)) ||
- ((code >= 0x1d185) && (code <= 0x1d18b)) ||
- ((code >= 0x1d1aa) && (code <= 0x1d1ad)));
-}
-
-/**
- * xmlUCSIsCatMc:
- * @code: UCS code point
- *
- * Check whether the character is part of Mc UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatMc(int code) {
- return((code == 0x903) ||
- ((code >= 0x93e) && (code <= 0x940)) ||
- ((code >= 0x949) && (code <= 0x94c)) ||
- ((code >= 0x982) && (code <= 0x983)) ||
- ((code >= 0x9be) && (code <= 0x9c0)) ||
- ((code >= 0x9c7) && (code <= 0x9c8)) ||
- ((code >= 0x9cb) && (code <= 0x9cc)) ||
- (code == 0x9d7) ||
- ((code >= 0xa3e) && (code <= 0xa40)) ||
- (code == 0xa83) ||
- ((code >= 0xabe) && (code <= 0xac0)) ||
- (code == 0xac9) ||
- ((code >= 0xacb) && (code <= 0xacc)) ||
- ((code >= 0xb02) && (code <= 0xb03)) ||
- (code == 0xb3e) ||
- (code == 0xb40) ||
- ((code >= 0xb47) && (code <= 0xb48)) ||
- ((code >= 0xb4b) && (code <= 0xb4c)) ||
- (code == 0xb57) ||
- (code == 0xb83) ||
- ((code >= 0xbbe) && (code <= 0xbbf)) ||
- ((code >= 0xbc1) && (code <= 0xbc2)) ||
- ((code >= 0xbc6) && (code <= 0xbc8)) ||
- ((code >= 0xbca) && (code <= 0xbcc)) ||
- (code == 0xbd7) ||
- ((code >= 0xc01) && (code <= 0xc03)) ||
- ((code >= 0xc41) && (code <= 0xc44)) ||
- ((code >= 0xc82) && (code <= 0xc83)) ||
- (code == 0xcbe) ||
- ((code >= 0xcc0) && (code <= 0xcc4)) ||
- ((code >= 0xcc7) && (code <= 0xcc8)) ||
- ((code >= 0xcca) && (code <= 0xccb)) ||
- ((code >= 0xcd5) && (code <= 0xcd6)) ||
- ((code >= 0xd02) && (code <= 0xd03)) ||
- ((code >= 0xd3e) && (code <= 0xd40)) ||
- ((code >= 0xd46) && (code <= 0xd48)) ||
- ((code >= 0xd4a) && (code <= 0xd4c)) ||
- (code == 0xd57) ||
- ((code >= 0xd82) && (code <= 0xd83)) ||
- ((code >= 0xdcf) && (code <= 0xdd1)) ||
- ((code >= 0xdd8) && (code <= 0xddf)) ||
- ((code >= 0xdf2) && (code <= 0xdf3)) ||
- ((code >= 0xf3e) && (code <= 0xf3f)) ||
- (code == 0xf7f) ||
- (code == 0x102c) ||
- (code == 0x1031) ||
- (code == 0x1038) ||
- ((code >= 0x1056) && (code <= 0x1057)) ||
- ((code >= 0x17b4) && (code <= 0x17b6)) ||
- ((code >= 0x17be) && (code <= 0x17c5)) ||
- ((code >= 0x17c7) && (code <= 0x17c8)) ||
- ((code >= 0x1d165) && (code <= 0x1d166)) ||
- ((code >= 0x1d16d) && (code <= 0x1d172)));
-}
-
-/**
- * xmlUCSIsCatMe:
- * @code: UCS code point
- *
- * Check whether the character is part of Me UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatMe(int code) {
- return(((code >= 0x488) && (code <= 0x489)) ||
- ((code >= 0x6dd) && (code <= 0x6de)) ||
- ((code >= 0x20dd) && (code <= 0x20e0)) ||
- ((code >= 0x20e2) && (code <= 0x20e3)));
-}
-
-/**
- * xmlUCSIsCatMn:
- * @code: UCS code point
- *
- * Check whether the character is part of Mn UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatMn(int code) {
- return(((code >= 0x300) && (code <= 0x34e)) ||
- ((code >= 0x360) && (code <= 0x362)) ||
- ((code >= 0x483) && (code <= 0x486)) ||
- ((code >= 0x591) && (code <= 0x5a1)) ||
- ((code >= 0x5a3) && (code <= 0x5b9)) ||
- ((code >= 0x5bb) && (code <= 0x5bd)) ||
- (code == 0x5bf) ||
- ((code >= 0x5c1) && (code <= 0x5c2)) ||
- (code == 0x5c4) ||
- ((code >= 0x64b) && (code <= 0x655)) ||
- (code == 0x670) ||
- ((code >= 0x6d6) && (code <= 0x6dc)) ||
- ((code >= 0x6df) && (code <= 0x6e4)) ||
- ((code >= 0x6e7) && (code <= 0x6e8)) ||
- ((code >= 0x6ea) && (code <= 0x6ed)) ||
- (code == 0x711) ||
- ((code >= 0x730) && (code <= 0x74a)) ||
- ((code >= 0x7a6) && (code <= 0x7b0)) ||
- ((code >= 0x901) && (code <= 0x902)) ||
- (code == 0x93c) ||
- ((code >= 0x941) && (code <= 0x948)) ||
- (code == 0x94d) ||
- ((code >= 0x951) && (code <= 0x954)) ||
- ((code >= 0x962) && (code <= 0x963)) ||
- (code == 0x981) ||
- (code == 0x9bc) ||
- ((code >= 0x9c1) && (code <= 0x9c4)) ||
- (code == 0x9cd) ||
- ((code >= 0x9e2) && (code <= 0x9e3)) ||
- (code == 0xa02) ||
- (code == 0xa3c) ||
- ((code >= 0xa41) && (code <= 0xa42)) ||
- ((code >= 0xa47) && (code <= 0xa48)) ||
- ((code >= 0xa4b) && (code <= 0xa4d)) ||
- ((code >= 0xa70) && (code <= 0xa71)) ||
- ((code >= 0xa81) && (code <= 0xa82)) ||
- (code == 0xabc) ||
- ((code >= 0xac1) && (code <= 0xac5)) ||
- ((code >= 0xac7) && (code <= 0xac8)) ||
- (code == 0xacd) ||
- (code == 0xb01) ||
- (code == 0xb3c) ||
- (code == 0xb3f) ||
- ((code >= 0xb41) && (code <= 0xb43)) ||
- (code == 0xb4d) ||
- (code == 0xb56) ||
- (code == 0xb82) ||
- (code == 0xbc0) ||
- (code == 0xbcd) ||
- ((code >= 0xc3e) && (code <= 0xc40)) ||
- ((code >= 0xc46) && (code <= 0xc48)) ||
- ((code >= 0xc4a) && (code <= 0xc4d)) ||
- ((code >= 0xc55) && (code <= 0xc56)) ||
- (code == 0xcbf) ||
- (code == 0xcc6) ||
- ((code >= 0xccc) && (code <= 0xccd)) ||
- ((code >= 0xd41) && (code <= 0xd43)) ||
- (code == 0xd4d) ||
- (code == 0xdca) ||
- ((code >= 0xdd2) && (code <= 0xdd4)) ||
- (code == 0xdd6) ||
- (code == 0xe31) ||
- ((code >= 0xe34) && (code <= 0xe3a)) ||
- ((code >= 0xe47) && (code <= 0xe4e)) ||
- (code == 0xeb1) ||
- ((code >= 0xeb4) && (code <= 0xeb9)) ||
- ((code >= 0xebb) && (code <= 0xebc)) ||
- ((code >= 0xec8) && (code <= 0xecd)) ||
- ((code >= 0xf18) && (code <= 0xf19)) ||
- (code == 0xf35) ||
- (code == 0xf37) ||
- (code == 0xf39) ||
- ((code >= 0xf71) && (code <= 0xf7e)) ||
- ((code >= 0xf80) && (code <= 0xf84)) ||
- ((code >= 0xf86) && (code <= 0xf87)) ||
- ((code >= 0xf90) && (code <= 0xf97)) ||
- ((code >= 0xf99) && (code <= 0xfbc)) ||
- (code == 0xfc6) ||
- ((code >= 0x102d) && (code <= 0x1030)) ||
- (code == 0x1032) ||
- ((code >= 0x1036) && (code <= 0x1037)) ||
- (code == 0x1039) ||
- ((code >= 0x1058) && (code <= 0x1059)) ||
- ((code >= 0x17b7) && (code <= 0x17bd)) ||
- (code == 0x17c6) ||
- ((code >= 0x17c9) && (code <= 0x17d3)) ||
- (code == 0x18a9) ||
- ((code >= 0x20d0) && (code <= 0x20dc)) ||
- (code == 0x20e1) ||
- ((code >= 0x302a) && (code <= 0x302f)) ||
- ((code >= 0x3099) && (code <= 0x309a)) ||
- (code == 0xfb1e) ||
- ((code >= 0xfe20) && (code <= 0xfe23)) ||
- ((code >= 0x1d167) && (code <= 0x1d169)) ||
- ((code >= 0x1d17b) && (code <= 0x1d182)) ||
- ((code >= 0x1d185) && (code <= 0x1d18b)) ||
- ((code >= 0x1d1aa) && (code <= 0x1d1ad)));
-}
-
-/**
- * xmlUCSIsCatN:
- * @code: UCS code point
- *
- * Check whether the character is part of N UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatN(int code) {
- return(((code >= 0x30) && (code <= 0x39)) ||
- ((code >= 0xb2) && (code <= 0xb3)) ||
- (code == 0xb9) ||
- ((code >= 0xbc) && (code <= 0xbe)) ||
- ((code >= 0x660) && (code <= 0x669)) ||
- ((code >= 0x6f0) && (code <= 0x6f9)) ||
- ((code >= 0x966) && (code <= 0x96f)) ||
- ((code >= 0x9e6) && (code <= 0x9ef)) ||
- ((code >= 0x9f4) && (code <= 0x9f9)) ||
- ((code >= 0xa66) && (code <= 0xa6f)) ||
- ((code >= 0xae6) && (code <= 0xaef)) ||
- ((code >= 0xb66) && (code <= 0xb6f)) ||
- ((code >= 0xbe7) && (code <= 0xbf2)) ||
- ((code >= 0xc66) && (code <= 0xc6f)) ||
- ((code >= 0xce6) && (code <= 0xcef)) ||
- ((code >= 0xd66) && (code <= 0xd6f)) ||
- ((code >= 0xe50) && (code <= 0xe59)) ||
- ((code >= 0xed0) && (code <= 0xed9)) ||
- ((code >= 0xf20) && (code <= 0xf33)) ||
- ((code >= 0x1040) && (code <= 0x1049)) ||
- ((code >= 0x1369) && (code <= 0x137c)) ||
- ((code >= 0x16ee) && (code <= 0x16f0)) ||
- ((code >= 0x17e0) && (code <= 0x17e9)) ||
- ((code >= 0x1810) && (code <= 0x1819)) ||
- (code == 0x2070) ||
- ((code >= 0x2074) && (code <= 0x2079)) ||
- ((code >= 0x2080) && (code <= 0x2089)) ||
- ((code >= 0x2153) && (code <= 0x2183)) ||
- ((code >= 0x2460) && (code <= 0x249b)) ||
- (code == 0x24ea) ||
- ((code >= 0x2776) && (code <= 0x2793)) ||
- (code == 0x3007) ||
- ((code >= 0x3021) && (code <= 0x3029)) ||
- ((code >= 0x3038) && (code <= 0x303a)) ||
- ((code >= 0x3192) && (code <= 0x3195)) ||
- ((code >= 0x3220) && (code <= 0x3229)) ||
- ((code >= 0x3280) && (code <= 0x3289)) ||
- ((code >= 0xff10) && (code <= 0xff19)) ||
- ((code >= 0x10320) && (code <= 0x10323)) ||
- (code == 0x1034a) ||
- ((code >= 0x1d7ce) && (code <= 0x1d7ff)));
-}
-
-/**
- * xmlUCSIsCatNd:
- * @code: UCS code point
- *
- * Check whether the character is part of Nd UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatNd(int code) {
- return(((code >= 0x30) && (code <= 0x39)) ||
- ((code >= 0x660) && (code <= 0x669)) ||
- ((code >= 0x6f0) && (code <= 0x6f9)) ||
- ((code >= 0x966) && (code <= 0x96f)) ||
- ((code >= 0x9e6) && (code <= 0x9ef)) ||
- ((code >= 0xa66) && (code <= 0xa6f)) ||
- ((code >= 0xae6) && (code <= 0xaef)) ||
- ((code >= 0xb66) && (code <= 0xb6f)) ||
- ((code >= 0xbe7) && (code <= 0xbef)) ||
- ((code >= 0xc66) && (code <= 0xc6f)) ||
- ((code >= 0xce6) && (code <= 0xcef)) ||
- ((code >= 0xd66) && (code <= 0xd6f)) ||
- ((code >= 0xe50) && (code <= 0xe59)) ||
- ((code >= 0xed0) && (code <= 0xed9)) ||
- ((code >= 0xf20) && (code <= 0xf29)) ||
- ((code >= 0x1040) && (code <= 0x1049)) ||
- ((code >= 0x1369) && (code <= 0x1371)) ||
- ((code >= 0x17e0) && (code <= 0x17e9)) ||
- ((code >= 0x1810) && (code <= 0x1819)) ||
- ((code >= 0xff10) && (code <= 0xff19)) ||
- ((code >= 0x1d7ce) && (code <= 0x1d7ff)));
-}
-
-/**
- * xmlUCSIsCatNl:
- * @code: UCS code point
- *
- * Check whether the character is part of Nl UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatNl(int code) {
- return(((code >= 0x16ee) && (code <= 0x16f0)) ||
- ((code >= 0x2160) && (code <= 0x2183)) ||
- (code == 0x3007) ||
- ((code >= 0x3021) && (code <= 0x3029)) ||
- ((code >= 0x3038) && (code <= 0x303a)) ||
- (code == 0x1034a));
-}
-
-/**
- * xmlUCSIsCatNo:
- * @code: UCS code point
- *
- * Check whether the character is part of No UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatNo(int code) {
- return(((code >= 0xb2) && (code <= 0xb3)) ||
- (code == 0xb9) ||
- ((code >= 0xbc) && (code <= 0xbe)) ||
- ((code >= 0x9f4) && (code <= 0x9f9)) ||
- ((code >= 0xbf0) && (code <= 0xbf2)) ||
- ((code >= 0xf2a) && (code <= 0xf33)) ||
- ((code >= 0x1372) && (code <= 0x137c)) ||
- (code == 0x2070) ||
- ((code >= 0x2074) && (code <= 0x2079)) ||
- ((code >= 0x2080) && (code <= 0x2089)) ||
- ((code >= 0x2153) && (code <= 0x215f)) ||
- ((code >= 0x2460) && (code <= 0x249b)) ||
- (code == 0x24ea) ||
- ((code >= 0x2776) && (code <= 0x2793)) ||
- ((code >= 0x3192) && (code <= 0x3195)) ||
- ((code >= 0x3220) && (code <= 0x3229)) ||
- ((code >= 0x3280) && (code <= 0x3289)) ||
- ((code >= 0x10320) && (code <= 0x10323)));
-}
-
-/**
- * xmlUCSIsCatP:
- * @code: UCS code point
- *
- * Check whether the character is part of P UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatP(int code) {
- return(((code >= 0x21) && (code <= 0x23)) ||
- ((code >= 0x25) && (code <= 0x2a)) ||
- ((code >= 0x2c) && (code <= 0x2f)) ||
- ((code >= 0x3a) && (code <= 0x3b)) ||
- ((code >= 0x3f) && (code <= 0x40)) ||
- ((code >= 0x5b) && (code <= 0x5d)) ||
- (code == 0x5f) ||
- (code == 0x7b) ||
- (code == 0x7d) ||
- (code == 0xa1) ||
- (code == 0xab) ||
- (code == 0xad) ||
- (code == 0xb7) ||
- (code == 0xbb) ||
- (code == 0xbf) ||
- (code == 0x37e) ||
- (code == 0x387) ||
- ((code >= 0x55a) && (code <= 0x55f)) ||
- ((code >= 0x589) && (code <= 0x58a)) ||
- (code == 0x5be) ||
- (code == 0x5c0) ||
- (code == 0x5c3) ||
- ((code >= 0x5f3) && (code <= 0x5f4)) ||
- (code == 0x60c) ||
- (code == 0x61b) ||
- (code == 0x61f) ||
- ((code >= 0x66a) && (code <= 0x66d)) ||
- (code == 0x6d4) ||
- ((code >= 0x700) && (code <= 0x70d)) ||
- ((code >= 0x964) && (code <= 0x965)) ||
- (code == 0x970) ||
- (code == 0xdf4) ||
- (code == 0xe4f) ||
- ((code >= 0xe5a) && (code <= 0xe5b)) ||
- ((code >= 0xf04) && (code <= 0xf12)) ||
- ((code >= 0xf3a) && (code <= 0xf3d)) ||
- (code == 0xf85) ||
- ((code >= 0x104a) && (code <= 0x104f)) ||
- (code == 0x10fb) ||
- ((code >= 0x1361) && (code <= 0x1368)) ||
- ((code >= 0x166d) && (code <= 0x166e)) ||
- ((code >= 0x169b) && (code <= 0x169c)) ||
- ((code >= 0x16eb) && (code <= 0x16ed)) ||
- ((code >= 0x17d4) && (code <= 0x17da)) ||
- (code == 0x17dc) ||
- ((code >= 0x1800) && (code <= 0x180a)) ||
- ((code >= 0x2010) && (code <= 0x2027)) ||
- ((code >= 0x2030) && (code <= 0x2043)) ||
- ((code >= 0x2045) && (code <= 0x2046)) ||
- ((code >= 0x2048) && (code <= 0x204d)) ||
- ((code >= 0x207d) && (code <= 0x207e)) ||
- ((code >= 0x208d) && (code <= 0x208e)) ||
- ((code >= 0x2329) && (code <= 0x232a)) ||
- ((code >= 0x3001) && (code <= 0x3003)) ||
- ((code >= 0x3008) && (code <= 0x3011)) ||
- ((code >= 0x3014) && (code <= 0x301f)) ||
- (code == 0x3030) ||
- (code == 0x30fb) ||
- ((code >= 0xfd3e) && (code <= 0xfd3f)) ||
- ((code >= 0xfe30) && (code <= 0xfe44)) ||
- ((code >= 0xfe49) && (code <= 0xfe52)) ||
- ((code >= 0xfe54) && (code <= 0xfe61)) ||
- (code == 0xfe63) ||
- (code == 0xfe68) ||
- ((code >= 0xfe6a) && (code <= 0xfe6b)) ||
- ((code >= 0xff01) && (code <= 0xff03)) ||
- ((code >= 0xff05) && (code <= 0xff0a)) ||
- ((code >= 0xff0c) && (code <= 0xff0f)) ||
- ((code >= 0xff1a) && (code <= 0xff1b)) ||
- ((code >= 0xff1f) && (code <= 0xff20)) ||
- ((code >= 0xff3b) && (code <= 0xff3d)) ||
- (code == 0xff3f) ||
- (code == 0xff5b) ||
- (code == 0xff5d) ||
- ((code >= 0xff61) && (code <= 0xff65)));
-}
-
-/**
- * xmlUCSIsCatPc:
- * @code: UCS code point
- *
- * Check whether the character is part of Pc UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatPc(int code) {
- return((code == 0x5f) ||
- ((code >= 0x203f) && (code <= 0x2040)) ||
- (code == 0x30fb) ||
- ((code >= 0xfe33) && (code <= 0xfe34)) ||
- ((code >= 0xfe4d) && (code <= 0xfe4f)) ||
- (code == 0xff3f) ||
- (code == 0xff65));
-}
-
-/**
- * xmlUCSIsCatPd:
- * @code: UCS code point
- *
- * Check whether the character is part of Pd UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatPd(int code) {
- return((code == 0x2d) ||
- (code == 0xad) ||
- (code == 0x58a) ||
- (code == 0x1806) ||
- ((code >= 0x2010) && (code <= 0x2015)) ||
- (code == 0x301c) ||
- (code == 0x3030) ||
- ((code >= 0xfe31) && (code <= 0xfe32)) ||
- (code == 0xfe58) ||
- (code == 0xfe63) ||
- (code == 0xff0d));
-}
-
-/**
- * xmlUCSIsCatPe:
- * @code: UCS code point
- *
- * Check whether the character is part of Pe UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatPe(int code) {
- return((code == 0x29) ||
- (code == 0x5d) ||
- (code == 0x7d) ||
- (code == 0xf3b) ||
- (code == 0xf3d) ||
- (code == 0x169c) ||
- (code == 0x2046) ||
- (code == 0x207e) ||
- (code == 0x208e) ||
- (code == 0x232a) ||
- (code == 0x3009) ||
- (code == 0x300b) ||
- (code == 0x300d) ||
- (code == 0x300f) ||
- (code == 0x3011) ||
- (code == 0x3015) ||
- (code == 0x3017) ||
- (code == 0x3019) ||
- (code == 0x301b) ||
- ((code >= 0x301e) && (code <= 0x301f)) ||
- (code == 0xfd3f) ||
- (code == 0xfe36) ||
- (code == 0xfe38) ||
- (code == 0xfe3a) ||
- (code == 0xfe3c) ||
- (code == 0xfe3e) ||
- (code == 0xfe40) ||
- (code == 0xfe42) ||
- (code == 0xfe44) ||
- (code == 0xfe5a) ||
- (code == 0xfe5c) ||
- (code == 0xfe5e) ||
- (code == 0xff09) ||
- (code == 0xff3d) ||
- (code == 0xff5d) ||
- (code == 0xff63));
-}
-
-/**
- * xmlUCSIsCatPf:
- * @code: UCS code point
- *
- * Check whether the character is part of Pf UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatPf(int code) {
- return((code == 0xbb) ||
- (code == 0x2019) ||
- (code == 0x201d) ||
- (code == 0x203a));
-}
-
-/**
- * xmlUCSIsCatPi:
- * @code: UCS code point
- *
- * Check whether the character is part of Pi UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatPi(int code) {
- return((code == 0xab) ||
- (code == 0x2018) ||
- ((code >= 0x201b) && (code <= 0x201c)) ||
- (code == 0x201f) ||
- (code == 0x2039));
-}
-
-/**
- * xmlUCSIsCatPo:
- * @code: UCS code point
- *
- * Check whether the character is part of Po UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatPo(int code) {
- return(((code >= 0x21) && (code <= 0x23)) ||
- ((code >= 0x25) && (code <= 0x27)) ||
- (code == 0x2a) ||
- (code == 0x2c) ||
- ((code >= 0x2e) && (code <= 0x2f)) ||
- ((code >= 0x3a) && (code <= 0x3b)) ||
- ((code >= 0x3f) && (code <= 0x40)) ||
- (code == 0x5c) ||
- (code == 0xa1) ||
- (code == 0xb7) ||
- (code == 0xbf) ||
- (code == 0x37e) ||
- (code == 0x387) ||
- ((code >= 0x55a) && (code <= 0x55f)) ||
- (code == 0x589) ||
- (code == 0x5be) ||
- (code == 0x5c0) ||
- (code == 0x5c3) ||
- ((code >= 0x5f3) && (code <= 0x5f4)) ||
- (code == 0x60c) ||
- (code == 0x61b) ||
- (code == 0x61f) ||
- ((code >= 0x66a) && (code <= 0x66d)) ||
- (code == 0x6d4) ||
- ((code >= 0x700) && (code <= 0x70d)) ||
- ((code >= 0x964) && (code <= 0x965)) ||
- (code == 0x970) ||
- (code == 0xdf4) ||
- (code == 0xe4f) ||
- ((code >= 0xe5a) && (code <= 0xe5b)) ||
- ((code >= 0xf04) && (code <= 0xf12)) ||
- (code == 0xf85) ||
- ((code >= 0x104a) && (code <= 0x104f)) ||
- (code == 0x10fb) ||
- ((code >= 0x1361) && (code <= 0x1368)) ||
- ((code >= 0x166d) && (code <= 0x166e)) ||
- ((code >= 0x16eb) && (code <= 0x16ed)) ||
- ((code >= 0x17d4) && (code <= 0x17da)) ||
- (code == 0x17dc) ||
- ((code >= 0x1800) && (code <= 0x1805)) ||
- ((code >= 0x1807) && (code <= 0x180a)) ||
- ((code >= 0x2016) && (code <= 0x2017)) ||
- ((code >= 0x2020) && (code <= 0x2027)) ||
- ((code >= 0x2030) && (code <= 0x2038)) ||
- ((code >= 0x203b) && (code <= 0x203e)) ||
- ((code >= 0x2041) && (code <= 0x2043)) ||
- ((code >= 0x2048) && (code <= 0x204d)) ||
- ((code >= 0x3001) && (code <= 0x3003)) ||
- (code == 0xfe30) ||
- ((code >= 0xfe49) && (code <= 0xfe4c)) ||
- ((code >= 0xfe50) && (code <= 0xfe52)) ||
- ((code >= 0xfe54) && (code <= 0xfe57)) ||
- ((code >= 0xfe5f) && (code <= 0xfe61)) ||
- (code == 0xfe68) ||
- ((code >= 0xfe6a) && (code <= 0xfe6b)) ||
- ((code >= 0xff01) && (code <= 0xff03)) ||
- ((code >= 0xff05) && (code <= 0xff07)) ||
- (code == 0xff0a) ||
- (code == 0xff0c) ||
- ((code >= 0xff0e) && (code <= 0xff0f)) ||
- ((code >= 0xff1a) && (code <= 0xff1b)) ||
- ((code >= 0xff1f) && (code <= 0xff20)) ||
- (code == 0xff3c) ||
- (code == 0xff61) ||
- (code == 0xff64));
-}
-
-/**
- * xmlUCSIsCatPs:
- * @code: UCS code point
- *
- * Check whether the character is part of Ps UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatPs(int code) {
- return((code == 0x28) ||
- (code == 0x5b) ||
- (code == 0x7b) ||
- (code == 0xf3a) ||
- (code == 0xf3c) ||
- (code == 0x169b) ||
- (code == 0x201a) ||
- (code == 0x201e) ||
- (code == 0x2045) ||
- (code == 0x207d) ||
- (code == 0x208d) ||
- (code == 0x2329) ||
- (code == 0x3008) ||
- (code == 0x300a) ||
- (code == 0x300c) ||
- (code == 0x300e) ||
- (code == 0x3010) ||
- (code == 0x3014) ||
- (code == 0x3016) ||
- (code == 0x3018) ||
- (code == 0x301a) ||
- (code == 0x301d) ||
- (code == 0xfd3e) ||
- (code == 0xfe35) ||
- (code == 0xfe37) ||
- (code == 0xfe39) ||
- (code == 0xfe3b) ||
- (code == 0xfe3d) ||
- (code == 0xfe3f) ||
- (code == 0xfe41) ||
- (code == 0xfe43) ||
- (code == 0xfe59) ||
- (code == 0xfe5b) ||
- (code == 0xfe5d) ||
- (code == 0xff08) ||
- (code == 0xff3b) ||
- (code == 0xff5b) ||
- (code == 0xff62));
-}
-
-/**
- * xmlUCSIsCatS:
- * @code: UCS code point
- *
- * Check whether the character is part of S UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatS(int code) {
- return((code == 0x24) ||
- (code == 0x2b) ||
- ((code >= 0x3c) && (code <= 0x3e)) ||
- (code == 0x5e) ||
- (code == 0x60) ||
- (code == 0x7c) ||
- (code == 0x7e) ||
- ((code >= 0xa2) && (code <= 0xa9)) ||
- (code == 0xac) ||
- ((code >= 0xae) && (code <= 0xb1)) ||
- (code == 0xb4) ||
- (code == 0xb6) ||
- (code == 0xb8) ||
- (code == 0xd7) ||
- (code == 0xf7) ||
- ((code >= 0x2b9) && (code <= 0x2ba)) ||
- ((code >= 0x2c2) && (code <= 0x2cf)) ||
- ((code >= 0x2d2) && (code <= 0x2df)) ||
- ((code >= 0x2e5) && (code <= 0x2ed)) ||
- ((code >= 0x374) && (code <= 0x375)) ||
- ((code >= 0x384) && (code <= 0x385)) ||
- (code == 0x482) ||
- (code == 0x6e9) ||
- ((code >= 0x6fd) && (code <= 0x6fe)) ||
- ((code >= 0x9f2) && (code <= 0x9f3)) ||
- (code == 0x9fa) ||
- (code == 0xb70) ||
- (code == 0xe3f) ||
- ((code >= 0xf01) && (code <= 0xf03)) ||
- ((code >= 0xf13) && (code <= 0xf17)) ||
- ((code >= 0xf1a) && (code <= 0xf1f)) ||
- (code == 0xf34) ||
- (code == 0xf36) ||
- (code == 0xf38) ||
- ((code >= 0xfbe) && (code <= 0xfc5)) ||
- ((code >= 0xfc7) && (code <= 0xfcc)) ||
- (code == 0xfcf) ||
- (code == 0x17db) ||
- (code == 0x1fbd) ||
- ((code >= 0x1fbf) && (code <= 0x1fc1)) ||
- ((code >= 0x1fcd) && (code <= 0x1fcf)) ||
- ((code >= 0x1fdd) && (code <= 0x1fdf)) ||
- ((code >= 0x1fed) && (code <= 0x1fef)) ||
- ((code >= 0x1ffd) && (code <= 0x1ffe)) ||
- (code == 0x2044) ||
- ((code >= 0x207a) && (code <= 0x207c)) ||
- ((code >= 0x208a) && (code <= 0x208c)) ||
- ((code >= 0x20a0) && (code <= 0x20af)) ||
- ((code >= 0x2100) && (code <= 0x2101)) ||
- ((code >= 0x2103) && (code <= 0x2106)) ||
- ((code >= 0x2108) && (code <= 0x2109)) ||
- (code == 0x2114) ||
- ((code >= 0x2116) && (code <= 0x2118)) ||
- ((code >= 0x211e) && (code <= 0x2123)) ||
- (code == 0x2125) ||
- (code == 0x2127) ||
- (code == 0x2129) ||
- (code == 0x212e) ||
- (code == 0x2132) ||
- (code == 0x213a) ||
- ((code >= 0x2190) && (code <= 0x21f3)) ||
- ((code >= 0x2200) && (code <= 0x22f1)) ||
- ((code >= 0x2300) && (code <= 0x2328)) ||
- ((code >= 0x232b) && (code <= 0x237b)) ||
- ((code >= 0x237d) && (code <= 0x239a)) ||
- ((code >= 0x2400) && (code <= 0x2426)) ||
- ((code >= 0x2440) && (code <= 0x244a)) ||
- ((code >= 0x249c) && (code <= 0x24e9)) ||
- ((code >= 0x2500) && (code <= 0x2595)) ||
- ((code >= 0x25a0) && (code <= 0x25f7)) ||
- ((code >= 0x2600) && (code <= 0x2613)) ||
- ((code >= 0x2619) && (code <= 0x2671)) ||
- ((code >= 0x2701) && (code <= 0x2704)) ||
- ((code >= 0x2706) && (code <= 0x2709)) ||
- ((code >= 0x270c) && (code <= 0x2727)) ||
- ((code >= 0x2729) && (code <= 0x274b)) ||
- (code == 0x274d) ||
- ((code >= 0x274f) && (code <= 0x2752)) ||
- (code == 0x2756) ||
- ((code >= 0x2758) && (code <= 0x275e)) ||
- ((code >= 0x2761) && (code <= 0x2767)) ||
- (code == 0x2794) ||
- ((code >= 0x2798) && (code <= 0x27af)) ||
- ((code >= 0x27b1) && (code <= 0x27be)) ||
- ((code >= 0x2800) && (code <= 0x28ff)) ||
- ((code >= 0x2e80) && (code <= 0x2e99)) ||
- ((code >= 0x2e9b) && (code <= 0x2ef3)) ||
- ((code >= 0x2f00) && (code <= 0x2fd5)) ||
- ((code >= 0x2ff0) && (code <= 0x2ffb)) ||
- (code == 0x3004) ||
- ((code >= 0x3012) && (code <= 0x3013)) ||
- (code == 0x3020) ||
- ((code >= 0x3036) && (code <= 0x3037)) ||
- ((code >= 0x303e) && (code <= 0x303f)) ||
- ((code >= 0x309b) && (code <= 0x309c)) ||
- ((code >= 0x3190) && (code <= 0x3191)) ||
- ((code >= 0x3196) && (code <= 0x319f)) ||
- ((code >= 0x3200) && (code <= 0x321c)) ||
- ((code >= 0x322a) && (code <= 0x3243)) ||
- ((code >= 0x3260) && (code <= 0x327b)) ||
- (code == 0x327f) ||
- ((code >= 0x328a) && (code <= 0x32b0)) ||
- ((code >= 0x32c0) && (code <= 0x32cb)) ||
- ((code >= 0x32d0) && (code <= 0x32fe)) ||
- ((code >= 0x3300) && (code <= 0x3376)) ||
- ((code >= 0x337b) && (code <= 0x33dd)) ||
- ((code >= 0x33e0) && (code <= 0x33fe)) ||
- ((code >= 0xa490) && (code <= 0xa4a1)) ||
- ((code >= 0xa4a4) && (code <= 0xa4b3)) ||
- ((code >= 0xa4b5) && (code <= 0xa4c0)) ||
- ((code >= 0xa4c2) && (code <= 0xa4c4)) ||
- (code == 0xa4c6) ||
- (code == 0xfb29) ||
- (code == 0xfe62) ||
- ((code >= 0xfe64) && (code <= 0xfe66)) ||
- (code == 0xfe69) ||
- (code == 0xff04) ||
- (code == 0xff0b) ||
- ((code >= 0xff1c) && (code <= 0xff1e)) ||
- (code == 0xff3e) ||
- (code == 0xff40) ||
- (code == 0xff5c) ||
- (code == 0xff5e) ||
- ((code >= 0xffe0) && (code <= 0xffe6)) ||
- ((code >= 0xffe8) && (code <= 0xffee)) ||
- ((code >= 0xfffc) && (code <= 0xfffd)) ||
- ((code >= 0x1d000) && (code <= 0x1d0f5)) ||
- ((code >= 0x1d100) && (code <= 0x1d126)) ||
- ((code >= 0x1d12a) && (code <= 0x1d164)) ||
- ((code >= 0x1d16a) && (code <= 0x1d16c)) ||
- ((code >= 0x1d183) && (code <= 0x1d184)) ||
- ((code >= 0x1d18c) && (code <= 0x1d1a9)) ||
- ((code >= 0x1d1ae) && (code <= 0x1d1dd)) ||
- (code == 0x1d6c1) ||
- (code == 0x1d6db) ||
- (code == 0x1d6fb) ||
- (code == 0x1d715) ||
- (code == 0x1d735) ||
- (code == 0x1d74f) ||
- (code == 0x1d76f) ||
- (code == 0x1d789) ||
- (code == 0x1d7a9) ||
- (code == 0x1d7c3));
-}
-
-/**
- * xmlUCSIsCatSc:
- * @code: UCS code point
- *
- * Check whether the character is part of Sc UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatSc(int code) {
- return((code == 0x24) ||
- ((code >= 0xa2) && (code <= 0xa5)) ||
- ((code >= 0x9f2) && (code <= 0x9f3)) ||
- (code == 0xe3f) ||
- (code == 0x17db) ||
- ((code >= 0x20a0) && (code <= 0x20af)) ||
- (code == 0xfe69) ||
- (code == 0xff04) ||
- ((code >= 0xffe0) && (code <= 0xffe1)) ||
- ((code >= 0xffe5) && (code <= 0xffe6)));
-}
-
-/**
- * xmlUCSIsCatSk:
- * @code: UCS code point
- *
- * Check whether the character is part of Sk UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatSk(int code) {
- return((code == 0x5e) ||
- (code == 0x60) ||
- (code == 0xa8) ||
- (code == 0xaf) ||
- (code == 0xb4) ||
- (code == 0xb8) ||
- ((code >= 0x2b9) && (code <= 0x2ba)) ||
- ((code >= 0x2c2) && (code <= 0x2cf)) ||
- ((code >= 0x2d2) && (code <= 0x2df)) ||
- ((code >= 0x2e5) && (code <= 0x2ed)) ||
- ((code >= 0x374) && (code <= 0x375)) ||
- ((code >= 0x384) && (code <= 0x385)) ||
- (code == 0x1fbd) ||
- ((code >= 0x1fbf) && (code <= 0x1fc1)) ||
- ((code >= 0x1fcd) && (code <= 0x1fcf)) ||
- ((code >= 0x1fdd) && (code <= 0x1fdf)) ||
- ((code >= 0x1fed) && (code <= 0x1fef)) ||
- ((code >= 0x1ffd) && (code <= 0x1ffe)) ||
- ((code >= 0x309b) && (code <= 0x309c)) ||
- (code == 0xff3e) ||
- (code == 0xff40) ||
- (code == 0xffe3));
-}
-
-/**
- * xmlUCSIsCatSm:
- * @code: UCS code point
- *
- * Check whether the character is part of Sm UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatSm(int code) {
- return((code == 0x2b) ||
- ((code >= 0x3c) && (code <= 0x3e)) ||
- (code == 0x7c) ||
- (code == 0x7e) ||
- (code == 0xac) ||
- (code == 0xb1) ||
- (code == 0xd7) ||
- (code == 0xf7) ||
- (code == 0x2044) ||
- ((code >= 0x207a) && (code <= 0x207c)) ||
- ((code >= 0x208a) && (code <= 0x208c)) ||
- ((code >= 0x2190) && (code <= 0x2194)) ||
- ((code >= 0x219a) && (code <= 0x219b)) ||
- (code == 0x21a0) ||
- (code == 0x21a3) ||
- (code == 0x21a6) ||
- (code == 0x21ae) ||
- ((code >= 0x21ce) && (code <= 0x21cf)) ||
- (code == 0x21d2) ||
- (code == 0x21d4) ||
- ((code >= 0x2200) && (code <= 0x22f1)) ||
- ((code >= 0x2308) && (code <= 0x230b)) ||
- ((code >= 0x2320) && (code <= 0x2321)) ||
- (code == 0x25b7) ||
- (code == 0x25c1) ||
- (code == 0x266f) ||
- (code == 0xfb29) ||
- (code == 0xfe62) ||
- ((code >= 0xfe64) && (code <= 0xfe66)) ||
- (code == 0xff0b) ||
- ((code >= 0xff1c) && (code <= 0xff1e)) ||
- (code == 0xff5c) ||
- (code == 0xff5e) ||
- (code == 0xffe2) ||
- ((code >= 0xffe9) && (code <= 0xffec)) ||
- (code == 0x1d6c1) ||
- (code == 0x1d6db) ||
- (code == 0x1d6fb) ||
- (code == 0x1d715) ||
- (code == 0x1d735) ||
- (code == 0x1d74f) ||
- (code == 0x1d76f) ||
- (code == 0x1d789) ||
- (code == 0x1d7a9) ||
- (code == 0x1d7c3));
-}
-
-/**
- * xmlUCSIsCatSo:
- * @code: UCS code point
- *
- * Check whether the character is part of So UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatSo(int code) {
- return(((code >= 0xa6) && (code <= 0xa7)) ||
- (code == 0xa9) ||
- (code == 0xae) ||
- (code == 0xb0) ||
- (code == 0xb6) ||
- (code == 0x482) ||
- (code == 0x6e9) ||
- ((code >= 0x6fd) && (code <= 0x6fe)) ||
- (code == 0x9fa) ||
- (code == 0xb70) ||
- ((code >= 0xf01) && (code <= 0xf03)) ||
- ((code >= 0xf13) && (code <= 0xf17)) ||
- ((code >= 0xf1a) && (code <= 0xf1f)) ||
- (code == 0xf34) ||
- (code == 0xf36) ||
- (code == 0xf38) ||
- ((code >= 0xfbe) && (code <= 0xfc5)) ||
- ((code >= 0xfc7) && (code <= 0xfcc)) ||
- (code == 0xfcf) ||
- ((code >= 0x2100) && (code <= 0x2101)) ||
- ((code >= 0x2103) && (code <= 0x2106)) ||
- ((code >= 0x2108) && (code <= 0x2109)) ||
- (code == 0x2114) ||
- ((code >= 0x2116) && (code <= 0x2118)) ||
- ((code >= 0x211e) && (code <= 0x2123)) ||
- (code == 0x2125) ||
- (code == 0x2127) ||
- (code == 0x2129) ||
- (code == 0x212e) ||
- (code == 0x2132) ||
- (code == 0x213a) ||
- ((code >= 0x2195) && (code <= 0x2199)) ||
- ((code >= 0x219c) && (code <= 0x219f)) ||
- ((code >= 0x21a1) && (code <= 0x21a2)) ||
- ((code >= 0x21a4) && (code <= 0x21a5)) ||
- ((code >= 0x21a7) && (code <= 0x21ad)) ||
- ((code >= 0x21af) && (code <= 0x21cd)) ||
- ((code >= 0x21d0) && (code <= 0x21d1)) ||
- (code == 0x21d3) ||
- ((code >= 0x21d5) && (code <= 0x21f3)) ||
- ((code >= 0x2300) && (code <= 0x2307)) ||
- ((code >= 0x230c) && (code <= 0x231f)) ||
- ((code >= 0x2322) && (code <= 0x2328)) ||
- ((code >= 0x232b) && (code <= 0x237b)) ||
- ((code >= 0x237d) && (code <= 0x239a)) ||
- ((code >= 0x2400) && (code <= 0x2426)) ||
- ((code >= 0x2440) && (code <= 0x244a)) ||
- ((code >= 0x249c) && (code <= 0x24e9)) ||
- ((code >= 0x2500) && (code <= 0x2595)) ||
- ((code >= 0x25a0) && (code <= 0x25b6)) ||
- ((code >= 0x25b8) && (code <= 0x25c0)) ||
- ((code >= 0x25c2) && (code <= 0x25f7)) ||
- ((code >= 0x2600) && (code <= 0x2613)) ||
- ((code >= 0x2619) && (code <= 0x266e)) ||
- ((code >= 0x2670) && (code <= 0x2671)) ||
- ((code >= 0x2701) && (code <= 0x2704)) ||
- ((code >= 0x2706) && (code <= 0x2709)) ||
- ((code >= 0x270c) && (code <= 0x2727)) ||
- ((code >= 0x2729) && (code <= 0x274b)) ||
- (code == 0x274d) ||
- ((code >= 0x274f) && (code <= 0x2752)) ||
- (code == 0x2756) ||
- ((code >= 0x2758) && (code <= 0x275e)) ||
- ((code >= 0x2761) && (code <= 0x2767)) ||
- (code == 0x2794) ||
- ((code >= 0x2798) && (code <= 0x27af)) ||
- ((code >= 0x27b1) && (code <= 0x27be)) ||
- ((code >= 0x2800) && (code <= 0x28ff)) ||
- ((code >= 0x2e80) && (code <= 0x2e99)) ||
- ((code >= 0x2e9b) && (code <= 0x2ef3)) ||
- ((code >= 0x2f00) && (code <= 0x2fd5)) ||
- ((code >= 0x2ff0) && (code <= 0x2ffb)) ||
- (code == 0x3004) ||
- ((code >= 0x3012) && (code <= 0x3013)) ||
- (code == 0x3020) ||
- ((code >= 0x3036) && (code <= 0x3037)) ||
- ((code >= 0x303e) && (code <= 0x303f)) ||
- ((code >= 0x3190) && (code <= 0x3191)) ||
- ((code >= 0x3196) && (code <= 0x319f)) ||
- ((code >= 0x3200) && (code <= 0x321c)) ||
- ((code >= 0x322a) && (code <= 0x3243)) ||
- ((code >= 0x3260) && (code <= 0x327b)) ||
- (code == 0x327f) ||
- ((code >= 0x328a) && (code <= 0x32b0)) ||
- ((code >= 0x32c0) && (code <= 0x32cb)) ||
- ((code >= 0x32d0) && (code <= 0x32fe)) ||
- ((code >= 0x3300) && (code <= 0x3376)) ||
- ((code >= 0x337b) && (code <= 0x33dd)) ||
- ((code >= 0x33e0) && (code <= 0x33fe)) ||
- ((code >= 0xa490) && (code <= 0xa4a1)) ||
- ((code >= 0xa4a4) && (code <= 0xa4b3)) ||
- ((code >= 0xa4b5) && (code <= 0xa4c0)) ||
- ((code >= 0xa4c2) && (code <= 0xa4c4)) ||
- (code == 0xa4c6) ||
- (code == 0xffe4) ||
- (code == 0xffe8) ||
- ((code >= 0xffed) && (code <= 0xffee)) ||
- ((code >= 0xfffc) && (code <= 0xfffd)) ||
- ((code >= 0x1d000) && (code <= 0x1d0f5)) ||
- ((code >= 0x1d100) && (code <= 0x1d126)) ||
- ((code >= 0x1d12a) && (code <= 0x1d164)) ||
- ((code >= 0x1d16a) && (code <= 0x1d16c)) ||
- ((code >= 0x1d183) && (code <= 0x1d184)) ||
- ((code >= 0x1d18c) && (code <= 0x1d1a9)) ||
- ((code >= 0x1d1ae) && (code <= 0x1d1dd)));
-}
-
-/**
- * xmlUCSIsCatZ:
- * @code: UCS code point
- *
- * Check whether the character is part of Z UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatZ(int code) {
- return((code == 0x20) ||
- (code == 0xa0) ||
- (code == 0x1680) ||
- ((code >= 0x2000) && (code <= 0x200b)) ||
- ((code >= 0x2028) && (code <= 0x2029)) ||
- (code == 0x202f) ||
- (code == 0x3000));
-}
-
-/**
- * xmlUCSIsCatZl:
- * @code: UCS code point
- *
- * Check whether the character is part of Zl UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatZl(int code) {
- return((code == 0x2028));
-}
-
-/**
- * xmlUCSIsCatZp:
- * @code: UCS code point
- *
- * Check whether the character is part of Zp UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatZp(int code) {
- return((code == 0x2029));
-}
-
-/**
- * xmlUCSIsCatZs:
- * @code: UCS code point
- *
- * Check whether the character is part of Zs UCS Category
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlUCSIsCatZs(int code) {
- return((code == 0x20) ||
- (code == 0xa0) ||
- (code == 0x1680) ||
- ((code >= 0x2000) && (code <= 0x200b)) ||
- (code == 0x202f) ||
- (code == 0x3000));
-}
-
-/**
- * xmlUCSIsCat:
- * @code: UCS code point
- * @cat: UCS Category name
- *
- * Check whether the caracter is part of the UCS Category
- *
- * Returns 1 if true, 0 if false and -1 on unknown category
- */
-int
-xmlUCSIsCat(int code, const char *cat) {
- if (!strcmp(cat, "C"))
- return(xmlUCSIsCatC(code));
- if (!strcmp(cat, "Cc"))
- return(xmlUCSIsCatCc(code));
- if (!strcmp(cat, "Cf"))
- return(xmlUCSIsCatCf(code));
- if (!strcmp(cat, "Co"))
- return(xmlUCSIsCatCo(code));
- if (!strcmp(cat, "Cs"))
- return(xmlUCSIsCatCs(code));
- if (!strcmp(cat, "L"))
- return(xmlUCSIsCatL(code));
- if (!strcmp(cat, "Ll"))
- return(xmlUCSIsCatLl(code));
- if (!strcmp(cat, "Lm"))
- return(xmlUCSIsCatLm(code));
- if (!strcmp(cat, "Lo"))
- return(xmlUCSIsCatLo(code));
- if (!strcmp(cat, "Lt"))
- return(xmlUCSIsCatLt(code));
- if (!strcmp(cat, "Lu"))
- return(xmlUCSIsCatLu(code));
- if (!strcmp(cat, "M"))
- return(xmlUCSIsCatM(code));
- if (!strcmp(cat, "Mc"))
- return(xmlUCSIsCatMc(code));
- if (!strcmp(cat, "Me"))
- return(xmlUCSIsCatMe(code));
- if (!strcmp(cat, "Mn"))
- return(xmlUCSIsCatMn(code));
- if (!strcmp(cat, "N"))
- return(xmlUCSIsCatN(code));
- if (!strcmp(cat, "Nd"))
- return(xmlUCSIsCatNd(code));
- if (!strcmp(cat, "Nl"))
- return(xmlUCSIsCatNl(code));
- if (!strcmp(cat, "No"))
- return(xmlUCSIsCatNo(code));
- if (!strcmp(cat, "P"))
- return(xmlUCSIsCatP(code));
- if (!strcmp(cat, "Pc"))
- return(xmlUCSIsCatPc(code));
- if (!strcmp(cat, "Pd"))
- return(xmlUCSIsCatPd(code));
- if (!strcmp(cat, "Pe"))
- return(xmlUCSIsCatPe(code));
- if (!strcmp(cat, "Pf"))
- return(xmlUCSIsCatPf(code));
- if (!strcmp(cat, "Pi"))
- return(xmlUCSIsCatPi(code));
- if (!strcmp(cat, "Po"))
- return(xmlUCSIsCatPo(code));
- if (!strcmp(cat, "Ps"))
- return(xmlUCSIsCatPs(code));
- if (!strcmp(cat, "S"))
- return(xmlUCSIsCatS(code));
- if (!strcmp(cat, "Sc"))
- return(xmlUCSIsCatSc(code));
- if (!strcmp(cat, "Sk"))
- return(xmlUCSIsCatSk(code));
- if (!strcmp(cat, "Sm"))
- return(xmlUCSIsCatSm(code));
- if (!strcmp(cat, "So"))
- return(xmlUCSIsCatSo(code));
- if (!strcmp(cat, "Z"))
- return(xmlUCSIsCatZ(code));
- if (!strcmp(cat, "Zl"))
- return(xmlUCSIsCatZl(code));
- if (!strcmp(cat, "Zp"))
- return(xmlUCSIsCatZp(code));
- if (!strcmp(cat, "Zs"))
- return(xmlUCSIsCatZs(code));
- return(-1);
-}
-
-
-#endif /* LIBXML_UNICODE_ENABLED */
diff --git a/bundle/libxml/xpath.c b/bundle/libxml/xpath.c
deleted file mode 100644
index 305bccf335..0000000000
--- a/bundle/libxml/xpath.c
+++ /dev/null
@@ -1,10990 +0,0 @@
-/*
- * xpath.c: XML Path Language implementation
- * XPath is a language for addressing parts of an XML document,
- * designed to be used by both XSLT and XPointer
- *
- * Reference: W3C Recommendation 16 November 1999
- * http://www.w3.org/TR/1999/REC-xpath-19991116
- * Public reference:
- * http://www.w3.org/TR/xpath
- *
- * See Copyright for the status of this software
- *
- * Author: daniel@veillard.com
- *
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-#ifdef LIBXML_XPATH_ENABLED
-
-#include <string.h>
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_MATH_H
-#include <math.h>
-#endif
-#ifdef HAVE_FLOAT_H
-#include <float.h>
-#endif
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-
-#include <libxml/xmlmemory.h>
-#include <libxml/tree.h>
-#include <libxml/valid.h>
-#include <libxml/xpath.h>
-#include <libxml/xpathInternals.h>
-#include <libxml/parserInternals.h>
-#include <libxml/hash.h>
-#ifdef LIBXML_XPTR_ENABLED
-#include <libxml/xpointer.h>
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-#include <libxml/debugXML.h>
-#endif
-#include <libxml/xmlerror.h>
-#include <libxml/threads.h>
-#include <libxml/globals.h>
-
-/* #define DEBUG */
-/* #define DEBUG_STEP */
-/* #define DEBUG_STEP_NTH */
-/* #define DEBUG_EXPR */
-/* #define DEBUG_EVAL_COUNTS */
-
-static xmlNs xmlXPathXMLNamespaceStruct = {
- NULL,
- XML_NAMESPACE_DECL,
- XML_XML_NAMESPACE,
- BAD_CAST "xml",
- NULL
-};
-static xmlNsPtr xmlXPathXMLNamespace = &xmlXPathXMLNamespaceStruct;
-#ifndef LIBXML_THREAD_ENABLED
-/*
- * Optimizer is disabled only when threaded apps are detected while
- * the library ain't compiled for thread safety.
- */
-static int xmlXPathDisableOptimizer = 0;
-#endif
-
-/************************************************************************
- * *
- * Floating point stuff *
- * *
- ************************************************************************/
-
-#ifndef TRIO_REPLACE_STDIO
-#define TRIO_PUBLIC static
-#endif
-#include "trionan.c"
-
-/*
- * The lack of portability of this section of the libc is annoying !
- */
-double xmlXPathNAN = 0;
-double xmlXPathPINF = 1;
-double xmlXPathNINF = -1;
-double xmlXPathNZERO = 0;
-static int xmlXPathInitialized = 0;
-
-/**
- * xmlXPathInit:
- *
- * Initialize the XPath environment
- */
-void
-xmlXPathInit(void) {
- if (xmlXPathInitialized) return;
-
- xmlXPathPINF = trio_pinf();
- xmlXPathNINF = trio_ninf();
- xmlXPathNAN = trio_nan();
- xmlXPathNZERO = trio_nzero();
-
- xmlXPathInitialized = 1;
-}
-
-/**
- * xmlXPathIsNaN:
- * @val: a double value
- *
- * Provides a portable isnan() function to detect whether a double
- * is a NotaNumber. Based on trio code
- * http://sourceforge.net/projects/ctrio/
- *
- * Returns 1 if the value is a NaN, 0 otherwise
- */
-int
-xmlXPathIsNaN(double val) {
- return(trio_isnan(val));
-}
-
-/**
- * xmlXPathIsInf:
- * @val: a double value
- *
- * Provides a portable isinf() function to detect whether a double
- * is a +Infinite or -Infinite. Based on trio code
- * http://sourceforge.net/projects/ctrio/
- *
- * Returns 1 vi the value is +Infinite, -1 if -Infinite, 0 otherwise
- */
-int
-xmlXPathIsInf(double val) {
- return(trio_isinf(val));
-}
-
-/**
- * xmlXPathGetSign:
- * @val: a double value
- *
- * Provides a portable function to detect the sign of a double
- * Modified from trio code
- * http://sourceforge.net/projects/ctrio/
- *
- * Returns 1 if the value is Negative, 0 if positive
- */
-static int
-xmlXPathGetSign(double val) {
- return(trio_signbit(val));
-}
-
-
-/************************************************************************
- * *
- * Parser Types *
- * *
- ************************************************************************/
-
-/*
- * Types are private:
- */
-
-typedef enum {
- XPATH_OP_END=0,
- XPATH_OP_AND,
- XPATH_OP_OR,
- XPATH_OP_EQUAL,
- XPATH_OP_CMP,
- XPATH_OP_PLUS,
- XPATH_OP_MULT,
- XPATH_OP_UNION,
- XPATH_OP_ROOT,
- XPATH_OP_NODE,
- XPATH_OP_RESET,
- XPATH_OP_COLLECT,
- XPATH_OP_VALUE,
- XPATH_OP_VARIABLE,
- XPATH_OP_FUNCTION,
- XPATH_OP_ARG,
- XPATH_OP_PREDICATE,
- XPATH_OP_FILTER,
- XPATH_OP_SORT
-#ifdef LIBXML_XPTR_ENABLED
- ,XPATH_OP_RANGETO
-#endif
-} xmlXPathOp;
-
-typedef enum {
- AXIS_ANCESTOR = 1,
- AXIS_ANCESTOR_OR_SELF,
- AXIS_ATTRIBUTE,
- AXIS_CHILD,
- AXIS_DESCENDANT,
- AXIS_DESCENDANT_OR_SELF,
- AXIS_FOLLOWING,
- AXIS_FOLLOWING_SIBLING,
- AXIS_NAMESPACE,
- AXIS_PARENT,
- AXIS_PRECEDING,
- AXIS_PRECEDING_SIBLING,
- AXIS_SELF
-} xmlXPathAxisVal;
-
-typedef enum {
- NODE_TEST_NONE = 0,
- NODE_TEST_TYPE = 1,
- NODE_TEST_PI = 2,
- NODE_TEST_ALL = 3,
- NODE_TEST_NS = 4,
- NODE_TEST_NAME = 5
-} xmlXPathTestVal;
-
-typedef enum {
- NODE_TYPE_NODE = 0,
- NODE_TYPE_COMMENT = XML_COMMENT_NODE,
- NODE_TYPE_TEXT = XML_TEXT_NODE,
- NODE_TYPE_PI = XML_PI_NODE
-} xmlXPathTypeVal;
-
-
-typedef struct _xmlXPathStepOp xmlXPathStepOp;
-typedef xmlXPathStepOp *xmlXPathStepOpPtr;
-struct _xmlXPathStepOp {
- xmlXPathOp op;
- int ch1;
- int ch2;
- int value;
- int value2;
- int value3;
- void *value4;
- void *value5;
- void *cache;
- void *cacheURI;
-};
-
-struct _xmlXPathCompExpr {
- int nbStep;
- int maxStep;
- xmlXPathStepOp *steps; /* ops for computation */
- int last;
- xmlChar *expr;
-#ifdef DEBUG_EVAL_COUNTS
- int nb;
- xmlChar *string;
-#endif
-};
-
-/************************************************************************
- * *
- * Parser Type functions *
- * *
- ************************************************************************/
-
-/**
- * xmlXPathNewCompExpr:
- *
- * Create a new Xpath component
- *
- * Returns the newly allocated xmlXPathCompExprPtr or NULL in case of error
- */
-static xmlXPathCompExprPtr
-xmlXPathNewCompExpr(void) {
- xmlXPathCompExprPtr cur;
-
- cur = (xmlXPathCompExprPtr) xmlMalloc(sizeof(xmlXPathCompExpr));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNewCompExpr : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlXPathCompExpr));
- cur->maxStep = 10;
- cur->nbStep = 0;
- cur->steps = (xmlXPathStepOp *) xmlMalloc(cur->maxStep *
- sizeof(xmlXPathStepOp));
- if (cur->steps == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNewCompExpr : malloc failed\n");
- xmlFree(cur);
- return(NULL);
- }
- memset(cur->steps, 0, cur->maxStep * sizeof(xmlXPathStepOp));
- cur->last = -1;
-#ifdef DEBUG_EVAL_COUNTS
- cur->nb = 0;
-#endif
- return(cur);
-}
-
-/**
- * xmlXPathFreeCompExpr:
- * @comp: an XPATH comp
- *
- * Free up the memory allocated by @comp
- */
-void
-xmlXPathFreeCompExpr(xmlXPathCompExprPtr comp)
-{
- xmlXPathStepOpPtr op;
- int i;
-
- if (comp == NULL)
- return;
- for (i = 0; i < comp->nbStep; i++) {
- op = &comp->steps[i];
- if (op->value4 != NULL) {
- if (op->op == XPATH_OP_VALUE)
- xmlXPathFreeObject(op->value4);
- else
- xmlFree(op->value4);
- }
- if (op->value5 != NULL)
- xmlFree(op->value5);
- }
- if (comp->steps != NULL) {
- xmlFree(comp->steps);
- }
-#ifdef DEBUG_EVAL_COUNTS
- if (comp->string != NULL) {
- xmlFree(comp->string);
- }
-#endif
- if (comp->expr != NULL) {
- xmlFree(comp->expr);
- }
-
- xmlFree(comp);
-}
-
-/**
- * xmlXPathCompExprAdd:
- * @comp: the compiled expression
- * @ch1: first child index
- * @ch2: second child index
- * @op: an op
- * @value: the first int value
- * @value2: the second int value
- * @value3: the third int value
- * @value4: the first string value
- * @value5: the second string value
- *
- * Add an step to an XPath Compiled Expression
- *
- * Returns -1 in case of failure, the index otherwise
- */
-static int
-xmlXPathCompExprAdd(xmlXPathCompExprPtr comp, int ch1, int ch2,
- xmlXPathOp op, int value,
- int value2, int value3, void *value4, void *value5) {
- if (comp->nbStep >= comp->maxStep) {
- xmlXPathStepOp *real;
-
- comp->maxStep *= 2;
- real = (xmlXPathStepOp *) xmlRealloc(comp->steps,
- comp->maxStep * sizeof(xmlXPathStepOp));
- if (real == NULL) {
- comp->maxStep /= 2;
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathCompExprAdd : realloc failed\n");
- return(-1);
- }
- comp->steps = real;
- }
- comp->last = comp->nbStep;
- comp->steps[comp->nbStep].ch1 = ch1;
- comp->steps[comp->nbStep].ch2 = ch2;
- comp->steps[comp->nbStep].op = op;
- comp->steps[comp->nbStep].value = value;
- comp->steps[comp->nbStep].value2 = value2;
- comp->steps[comp->nbStep].value3 = value3;
- comp->steps[comp->nbStep].value4 = value4;
- comp->steps[comp->nbStep].value5 = value5;
- comp->steps[comp->nbStep].cache = NULL;
- return(comp->nbStep++);
-}
-
-/**
- * xmlXPathCompSwap:
- * @comp: the compiled expression
- * @op: operation index
- *
- * Swaps 2 operations in the compiled expression
- */
-static void
-xmlXPathCompSwap(xmlXPathStepOpPtr op) {
- int tmp;
-
-#ifndef LIBXML_THREAD_ENABLED
- /*
- * Since this manipulates possibly shared variables, this is
- * disable if one detects that the library is used in a multithreaded
- * application
- */
- if (xmlXPathDisableOptimizer)
- return;
-#endif
-
- tmp = op->ch1;
- op->ch1 = op->ch2;
- op->ch2 = tmp;
-}
-
-#define PUSH_FULL_EXPR(op, op1, op2, val, val2, val3, val4, val5) \
- xmlXPathCompExprAdd(ctxt->comp, (op1), (op2), \
- (op), (val), (val2), (val3), (val4), (val5))
-#define PUSH_LONG_EXPR(op, val, val2, val3, val4, val5) \
- xmlXPathCompExprAdd(ctxt->comp, ctxt->comp->last, -1, \
- (op), (val), (val2), (val3), (val4), (val5))
-
-#define PUSH_LEAVE_EXPR(op, val, val2) \
-xmlXPathCompExprAdd(ctxt->comp, -1, -1, (op), (val), (val2), 0 ,NULL ,NULL)
-
-#define PUSH_UNARY_EXPR(op, ch, val, val2) \
-xmlXPathCompExprAdd(ctxt->comp, (ch), -1, (op), (val), (val2), 0 ,NULL ,NULL)
-
-#define PUSH_BINARY_EXPR(op, ch1, ch2, val, val2) \
-xmlXPathCompExprAdd(ctxt->comp, (ch1), (ch2), (op), (val), (val2), 0 ,NULL ,NULL)
-
-/************************************************************************
- * *
- * Debugging related functions *
- * *
- ************************************************************************/
-
-#define TODO \
- xmlGenericError(xmlGenericErrorContext, \
- "Unimplemented block at %s:%d\n", \
- __FILE__, __LINE__);
-
-#define STRANGE \
- xmlGenericError(xmlGenericErrorContext, \
- "Internal error at %s:%d\n", \
- __FILE__, __LINE__);
-
-#ifdef LIBXML_DEBUG_ENABLED
-static void
-xmlXPathDebugDumpNode(FILE *output, xmlNodePtr cur, int depth) {
- int i;
- char shift[100];
-
- for (i = 0;((i < depth) && (i < 25));i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
- if (cur == NULL) {
- fprintf(output, shift);
- fprintf(output, "Node is NULL !\n");
- return;
-
- }
-
- if ((cur->type == XML_DOCUMENT_NODE) ||
- (cur->type == XML_HTML_DOCUMENT_NODE)) {
- fprintf(output, shift);
- fprintf(output, " /\n");
- } else if (cur->type == XML_ATTRIBUTE_NODE)
- xmlDebugDumpAttr(output, (xmlAttrPtr)cur, depth);
- else
- xmlDebugDumpOneNode(output, cur, depth);
-}
-static void
-xmlXPathDebugDumpNodeList(FILE *output, xmlNodePtr cur, int depth) {
- xmlNodePtr tmp;
- int i;
- char shift[100];
-
- for (i = 0;((i < depth) && (i < 25));i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
- if (cur == NULL) {
- fprintf(output, shift);
- fprintf(output, "Node is NULL !\n");
- return;
-
- }
-
- while (cur != NULL) {
- tmp = cur;
- cur = cur->next;
- xmlDebugDumpOneNode(output, tmp, depth);
- }
-}
-
-static void
-xmlXPathDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur, int depth) {
- int i;
- char shift[100];
-
- for (i = 0;((i < depth) && (i < 25));i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
-
- if (cur == NULL) {
- fprintf(output, shift);
- fprintf(output, "NodeSet is NULL !\n");
- return;
-
- }
-
- if (cur != NULL) {
- fprintf(output, "Set contains %d nodes:\n", cur->nodeNr);
- for (i = 0;i < cur->nodeNr;i++) {
- fprintf(output, shift);
- fprintf(output, "%d", i + 1);
- xmlXPathDebugDumpNode(output, cur->nodeTab[i], depth + 1);
- }
- }
-}
-
-static void
-xmlXPathDebugDumpValueTree(FILE *output, xmlNodeSetPtr cur, int depth) {
- int i;
- char shift[100];
-
- for (i = 0;((i < depth) && (i < 25));i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
-
- if ((cur == NULL) || (cur->nodeNr == 0) || (cur->nodeTab[0] == NULL)) {
- fprintf(output, shift);
- fprintf(output, "Value Tree is NULL !\n");
- return;
-
- }
-
- fprintf(output, shift);
- fprintf(output, "%d", i + 1);
- xmlXPathDebugDumpNodeList(output, cur->nodeTab[0]->children, depth + 1);
-}
-#if defined(LIBXML_XPTR_ENABLED)
-static void
-xmlXPathDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur, int depth) {
- int i;
- char shift[100];
-
- for (i = 0;((i < depth) && (i < 25));i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
-
- if (cur == NULL) {
- fprintf(output, shift);
- fprintf(output, "LocationSet is NULL !\n");
- return;
-
- }
-
- for (i = 0;i < cur->locNr;i++) {
- fprintf(output, shift);
- fprintf(output, "%d : ", i + 1);
- xmlXPathDebugDumpObject(output, cur->locTab[i], depth + 1);
- }
-}
-#endif /* LIBXML_XPTR_ENABLED */
-
-/**
- * xmlXPathDebugDumpObject:
- * @output: the FILE * to dump the output
- * @cur: the object to inspect
- * @depth: indentation level
- *
- * Dump the content of the object for debugging purposes
- */
-void
-xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) {
- int i;
- char shift[100];
-
- for (i = 0;((i < depth) && (i < 25));i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
-
- fprintf(output, shift);
-
- if (cur == NULL) {
- fprintf(output, "Object is empty (NULL)\n");
- return;
- }
- switch(cur->type) {
- case XPATH_UNDEFINED:
- fprintf(output, "Object is uninitialized\n");
- break;
- case XPATH_NODESET:
- fprintf(output, "Object is a Node Set :\n");
- xmlXPathDebugDumpNodeSet(output, cur->nodesetval, depth);
- break;
- case XPATH_XSLT_TREE:
- fprintf(output, "Object is an XSLT value tree :\n");
- xmlXPathDebugDumpValueTree(output, cur->nodesetval, depth);
- break;
- case XPATH_BOOLEAN:
- fprintf(output, "Object is a Boolean : ");
- if (cur->boolval) fprintf(output, "true\n");
- else fprintf(output, "false\n");
- break;
- case XPATH_NUMBER:
- switch (xmlXPathIsInf(cur->floatval)) {
- case 1:
- fprintf(output, "Object is a number : Infinity\n");
- break;
- case -1:
- fprintf(output, "Object is a number : -Infinity\n");
- break;
- default:
- if (xmlXPathIsNaN(cur->floatval)) {
- fprintf(output, "Object is a number : NaN\n");
- } else if (cur->floatval == 0 && xmlXPathGetSign(cur->floatval) != 0) {
- fprintf(output, "Object is a number : 0\n");
- } else {
- fprintf(output, "Object is a number : %0g\n", cur->floatval);
- }
- }
- break;
- case XPATH_STRING:
- fprintf(output, "Object is a string : ");
- xmlDebugDumpString(output, cur->stringval);
- fprintf(output, "\n");
- break;
- case XPATH_POINT:
- fprintf(output, "Object is a point : index %d in node", cur->index);
- xmlXPathDebugDumpNode(output, (xmlNodePtr) cur->user, depth + 1);
- fprintf(output, "\n");
- break;
- case XPATH_RANGE:
- if ((cur->user2 == NULL) ||
- ((cur->user2 == cur->user) && (cur->index == cur->index2))) {
- fprintf(output, "Object is a collapsed range :\n");
- fprintf(output, shift);
- if (cur->index >= 0)
- fprintf(output, "index %d in ", cur->index);
- fprintf(output, "node\n");
- xmlXPathDebugDumpNode(output, (xmlNodePtr) cur->user,
- depth + 1);
- } else {
- fprintf(output, "Object is a range :\n");
- fprintf(output, shift);
- fprintf(output, "From ");
- if (cur->index >= 0)
- fprintf(output, "index %d in ", cur->index);
- fprintf(output, "node\n");
- xmlXPathDebugDumpNode(output, (xmlNodePtr) cur->user,
- depth + 1);
- fprintf(output, shift);
- fprintf(output, "To ");
- if (cur->index2 >= 0)
- fprintf(output, "index %d in ", cur->index2);
- fprintf(output, "node\n");
- xmlXPathDebugDumpNode(output, (xmlNodePtr) cur->user2,
- depth + 1);
- fprintf(output, "\n");
- }
- break;
- case XPATH_LOCATIONSET:
-#if defined(LIBXML_XPTR_ENABLED)
- fprintf(output, "Object is a Location Set:\n");
- xmlXPathDebugDumpLocationSet(output,
- (xmlLocationSetPtr) cur->user, depth);
-#endif
- break;
- case XPATH_USERS:
- fprintf(output, "Object is user defined\n");
- break;
- }
-}
-
-static void
-xmlXPathDebugDumpStepOp(FILE *output, xmlXPathCompExprPtr comp,
- xmlXPathStepOpPtr op, int depth) {
- int i;
- char shift[100];
-
- for (i = 0;((i < depth) && (i < 25));i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
-
- fprintf(output, shift);
- if (op == NULL) {
- fprintf(output, "Step is NULL\n");
- return;
- }
- switch (op->op) {
- case XPATH_OP_END:
- fprintf(output, "END"); break;
- case XPATH_OP_AND:
- fprintf(output, "AND"); break;
- case XPATH_OP_OR:
- fprintf(output, "OR"); break;
- case XPATH_OP_EQUAL:
- if (op->value)
- fprintf(output, "EQUAL =");
- else
- fprintf(output, "EQUAL !=");
- break;
- case XPATH_OP_CMP:
- if (op->value)
- fprintf(output, "CMP <");
- else
- fprintf(output, "CMP >");
- if (!op->value2)
- fprintf(output, "=");
- break;
- case XPATH_OP_PLUS:
- if (op->value == 0)
- fprintf(output, "PLUS -");
- else if (op->value == 1)
- fprintf(output, "PLUS +");
- else if (op->value == 2)
- fprintf(output, "PLUS unary -");
- else if (op->value == 3)
- fprintf(output, "PLUS unary - -");
- break;
- case XPATH_OP_MULT:
- if (op->value == 0)
- fprintf(output, "MULT *");
- else if (op->value == 1)
- fprintf(output, "MULT div");
- else
- fprintf(output, "MULT mod");
- break;
- case XPATH_OP_UNION:
- fprintf(output, "UNION"); break;
- case XPATH_OP_ROOT:
- fprintf(output, "ROOT"); break;
- case XPATH_OP_NODE:
- fprintf(output, "NODE"); break;
- case XPATH_OP_RESET:
- fprintf(output, "RESET"); break;
- case XPATH_OP_SORT:
- fprintf(output, "SORT"); break;
- case XPATH_OP_COLLECT: {
- xmlXPathAxisVal axis = op->value;
- xmlXPathTestVal test = op->value2;
- xmlXPathTypeVal type = op->value3;
- const xmlChar *prefix = op->value4;
- const xmlChar *name = op->value5;
-
- fprintf(output, "COLLECT ");
- switch (axis) {
- case AXIS_ANCESTOR:
- fprintf(output, " 'ancestors' "); break;
- case AXIS_ANCESTOR_OR_SELF:
- fprintf(output, " 'ancestors-or-self' "); break;
- case AXIS_ATTRIBUTE:
- fprintf(output, " 'attributes' "); break;
- case AXIS_CHILD:
- fprintf(output, " 'child' "); break;
- case AXIS_DESCENDANT:
- fprintf(output, " 'descendant' "); break;
- case AXIS_DESCENDANT_OR_SELF:
- fprintf(output, " 'descendant-or-self' "); break;
- case AXIS_FOLLOWING:
- fprintf(output, " 'following' "); break;
- case AXIS_FOLLOWING_SIBLING:
- fprintf(output, " 'following-siblings' "); break;
- case AXIS_NAMESPACE:
- fprintf(output, " 'namespace' "); break;
- case AXIS_PARENT:
- fprintf(output, " 'parent' "); break;
- case AXIS_PRECEDING:
- fprintf(output, " 'preceding' "); break;
- case AXIS_PRECEDING_SIBLING:
- fprintf(output, " 'preceding-sibling' "); break;
- case AXIS_SELF:
- fprintf(output, " 'self' "); break;
- }
- switch (test) {
- case NODE_TEST_NONE:
- fprintf(output, "'none' "); break;
- case NODE_TEST_TYPE:
- fprintf(output, "'type' "); break;
- case NODE_TEST_PI:
- fprintf(output, "'PI' "); break;
- case NODE_TEST_ALL:
- fprintf(output, "'all' "); break;
- case NODE_TEST_NS:
- fprintf(output, "'namespace' "); break;
- case NODE_TEST_NAME:
- fprintf(output, "'name' "); break;
- }
- switch (type) {
- case NODE_TYPE_NODE:
- fprintf(output, "'node' "); break;
- case NODE_TYPE_COMMENT:
- fprintf(output, "'comment' "); break;
- case NODE_TYPE_TEXT:
- fprintf(output, "'text' "); break;
- case NODE_TYPE_PI:
- fprintf(output, "'PI' "); break;
- }
- if (prefix != NULL)
- fprintf(output, "%s:", prefix);
- if (name != NULL)
- fprintf(output, "%s", name);
- break;
-
- }
- case XPATH_OP_VALUE: {
- xmlXPathObjectPtr object = (xmlXPathObjectPtr) op->value4;
-
- fprintf(output, "ELEM ");
- xmlXPathDebugDumpObject(output, object, 0);
- goto finish;
- }
- case XPATH_OP_VARIABLE: {
- const xmlChar *prefix = op->value5;
- const xmlChar *name = op->value4;
-
- if (prefix != NULL)
- fprintf(output, "VARIABLE %s:%s", prefix, name);
- else
- fprintf(output, "VARIABLE %s", name);
- break;
- }
- case XPATH_OP_FUNCTION: {
- int nbargs = op->value;
- const xmlChar *prefix = op->value5;
- const xmlChar *name = op->value4;
-
- if (prefix != NULL)
- fprintf(output, "FUNCTION %s:%s(%d args)",
- prefix, name, nbargs);
- else
- fprintf(output, "FUNCTION %s(%d args)", name, nbargs);
- break;
- }
- case XPATH_OP_ARG: fprintf(output, "ARG"); break;
- case XPATH_OP_PREDICATE: fprintf(output, "PREDICATE"); break;
- case XPATH_OP_FILTER: fprintf(output, "FILTER"); break;
-#ifdef LIBXML_XPTR_ENABLED
- case XPATH_OP_RANGETO: fprintf(output, "RANGETO"); break;
-#endif
- default:
- fprintf(output, "UNKNOWN %d\n", op->op); return;
- }
- fprintf(output, "\n");
-finish:
- if (op->ch1 >= 0)
- xmlXPathDebugDumpStepOp(output, comp, &comp->steps[op->ch1], depth + 1);
- if (op->ch2 >= 0)
- xmlXPathDebugDumpStepOp(output, comp, &comp->steps[op->ch2], depth + 1);
-}
-
-/**
- * xmlXPathDebugDumpCompExpr:
- * @output: the FILE * for the output
- * @comp: the precompiled XPath expression
- * @depth: the indentation level.
- *
- * Dumps the tree of the compiled XPath expression.
- */
-void
-xmlXPathDebugDumpCompExpr(FILE *output, xmlXPathCompExprPtr comp,
- int depth) {
- int i;
- char shift[100];
-
- for (i = 0;((i < depth) && (i < 25));i++)
- shift[2 * i] = shift[2 * i + 1] = ' ';
- shift[2 * i] = shift[2 * i + 1] = 0;
-
- fprintf(output, shift);
-
- if (comp == NULL) {
- fprintf(output, "Compiled Expression is NULL\n");
- return;
- }
- fprintf(output, "Compiled Expression : %d elements\n",
- comp->nbStep);
- i = comp->last;
- xmlXPathDebugDumpStepOp(output, comp, &comp->steps[i], depth + 1);
-}
-#endif /* LIBXML_DEBUG_ENABLED */
-
-/************************************************************************
- * *
- * Parser stacks related functions and macros *
- * *
- ************************************************************************/
-
-/**
- * valuePop:
- * @ctxt: an XPath evaluation context
- *
- * Pops the top XPath object from the value stack
- *
- * Returns the XPath object just removed
- */
-extern xmlXPathObjectPtr
-valuePop(xmlXPathParserContextPtr ctxt)
-{
- xmlXPathObjectPtr ret;
-
- if (ctxt->valueNr <= 0)
- return (0);
- ctxt->valueNr--;
- if (ctxt->valueNr > 0)
- ctxt->value = ctxt->valueTab[ctxt->valueNr - 1];
- else
- ctxt->value = NULL;
- ret = ctxt->valueTab[ctxt->valueNr];
- ctxt->valueTab[ctxt->valueNr] = 0;
- return (ret);
-}
-/**
- * valuePush:
- * @ctxt: an XPath evaluation context
- * @value: the XPath object
- *
- * Pushes a new XPath object on top of the value stack
- *
- * returns the number of items on the value stack
- */
-extern int
-valuePush(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value)
-{
- if (ctxt->valueNr >= ctxt->valueMax) {
- ctxt->valueMax *= 2;
- ctxt->valueTab =
- (xmlXPathObjectPtr *) xmlRealloc(ctxt->valueTab,
- ctxt->valueMax *
- sizeof(ctxt->valueTab[0]));
- if (ctxt->valueTab == NULL) {
- xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
- return (0);
- }
- }
- ctxt->valueTab[ctxt->valueNr] = value;
- ctxt->value = value;
- return (ctxt->valueNr++);
-}
-
-/**
- * xmlXPathPopBoolean:
- * @ctxt: an XPath parser context
- *
- * Pops a boolean from the stack, handling conversion if needed.
- * Check error with #xmlXPathCheckError.
- *
- * Returns the boolean
- */
-int
-xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt) {
- xmlXPathObjectPtr obj;
- int ret;
-
- obj = valuePop(ctxt);
- if (obj == NULL) {
- xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND);
- return(0);
- }
- ret = xmlXPathCastToBoolean(obj);
- xmlXPathFreeObject(obj);
- return(ret);
-}
-
-/**
- * xmlXPathPopNumber:
- * @ctxt: an XPath parser context
- *
- * Pops a number from the stack, handling conversion if needed.
- * Check error with #xmlXPathCheckError.
- *
- * Returns the number
- */
-double
-xmlXPathPopNumber (xmlXPathParserContextPtr ctxt) {
- xmlXPathObjectPtr obj;
- double ret;
-
- obj = valuePop(ctxt);
- if (obj == NULL) {
- xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND);
- return(0);
- }
- ret = xmlXPathCastToNumber(obj);
- xmlXPathFreeObject(obj);
- return(ret);
-}
-
-/**
- * xmlXPathPopString:
- * @ctxt: an XPath parser context
- *
- * Pops a string from the stack, handling conversion if needed.
- * Check error with #xmlXPathCheckError.
- *
- * Returns the string
- */
-xmlChar *
-xmlXPathPopString (xmlXPathParserContextPtr ctxt) {
- xmlXPathObjectPtr obj;
- xmlChar * ret;
-
- obj = valuePop(ctxt);
- if (obj == NULL) {
- xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND);
- return(NULL);
- }
- ret = xmlXPathCastToString(obj);
- /* TODO: needs refactoring somewhere else */
- if (obj->stringval == ret)
- obj->stringval = NULL;
- xmlXPathFreeObject(obj);
- return(ret);
-}
-
-/**
- * xmlXPathPopNodeSet:
- * @ctxt: an XPath parser context
- *
- * Pops a node-set from the stack, handling conversion if needed.
- * Check error with #xmlXPathCheckError.
- *
- * Returns the node-set
- */
-xmlNodeSetPtr
-xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt) {
- xmlXPathObjectPtr obj;
- xmlNodeSetPtr ret;
-
- if (ctxt->value == NULL) {
- xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND);
- return(NULL);
- }
- if (!xmlXPathStackIsNodeSet(ctxt)) {
- xmlXPathSetTypeError(ctxt);
- return(NULL);
- }
- obj = valuePop(ctxt);
- ret = obj->nodesetval;
- xmlXPathFreeNodeSetList(obj);
- return(ret);
-}
-
-/**
- * xmlXPathPopExternal:
- * @ctxt: an XPath parser context
- *
- * Pops an external object from the stack, handling conversion if needed.
- * Check error with #xmlXPathCheckError.
- *
- * Returns the object
- */
-void *
-xmlXPathPopExternal (xmlXPathParserContextPtr ctxt) {
- xmlXPathObjectPtr obj;
- void * ret;
-
- if (ctxt->value == NULL) {
- xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND);
- return(NULL);
- }
- if (ctxt->value->type != XPATH_USERS) {
- xmlXPathSetTypeError(ctxt);
- return(NULL);
- }
- obj = valuePop(ctxt);
- ret = obj->user;
- xmlXPathFreeObject(obj);
- return(ret);
-}
-
-/*
- * Macros for accessing the content. Those should be used only by the parser,
- * and not exported.
- *
- * Dirty macros, i.e. one need to make assumption on the context to use them
- *
- * CUR_PTR return the current pointer to the xmlChar to be parsed.
- * CUR returns the current xmlChar value, i.e. a 8 bit value
- * in ISO-Latin or UTF-8.
- * This should be used internally by the parser
- * only to compare to ASCII values otherwise it would break when
- * running with UTF-8 encoding.
- * NXT(n) returns the n'th next xmlChar. Same as CUR is should be used only
- * to compare on ASCII based substring.
- * SKIP(n) Skip n xmlChar, and must also be used only to skip ASCII defined
- * strings within the parser.
- * CURRENT Returns the current char value, with the full decoding of
- * UTF-8 if we are using this mode. It returns an int.
- * NEXT Skip to the next character, this does the proper decoding
- * in UTF-8 mode. It also pop-up unfinished entities on the fly.
- * It returns the pointer to the current xmlChar.
- */
-
-#define CUR (*ctxt->cur)
-#define SKIP(val) ctxt->cur += (val)
-#define NXT(val) ctxt->cur[(val)]
-#define CUR_PTR ctxt->cur
-#define CUR_CHAR(l) xmlXPathCurrentChar(ctxt, &l)
-
-#define COPY_BUF(l,b,i,v) \
- if (l == 1) b[i++] = (xmlChar) v; \
- else i += xmlCopyChar(l,&b[i],v)
-
-#define NEXTL(l) ctxt->cur += l
-
-#define SKIP_BLANKS \
- while (IS_BLANK(*(ctxt->cur))) NEXT
-
-#define CURRENT (*ctxt->cur)
-#define NEXT ((*ctxt->cur) ? ctxt->cur++: ctxt->cur)
-
-
-#ifndef DBL_DIG
-#define DBL_DIG 16
-#endif
-#ifndef DBL_EPSILON
-#define DBL_EPSILON 1E-9
-#endif
-
-#define UPPER_DOUBLE 1E9
-#define LOWER_DOUBLE 1E-5
-
-#define INTEGER_DIGITS DBL_DIG
-#define FRACTION_DIGITS (DBL_DIG + 1)
-#define EXPONENT_DIGITS (3 + 2)
-
-/**
- * xmlXPathFormatNumber:
- * @number: number to format
- * @buffer: output buffer
- * @buffersize: size of output buffer
- *
- * Convert the number into a string representation.
- */
-static void
-xmlXPathFormatNumber(double number, char buffer[], int buffersize)
-{
- switch (xmlXPathIsInf(number)) {
- case 1:
- if (buffersize > (int)sizeof("Infinity"))
- snprintf(buffer, buffersize, "Infinity");
- break;
- case -1:
- if (buffersize > (int)sizeof("-Infinity"))
- snprintf(buffer, buffersize, "-Infinity");
- break;
- default:
- if (xmlXPathIsNaN(number)) {
- if (buffersize > (int)sizeof("NaN"))
- snprintf(buffer, buffersize, "NaN");
- } else if (number == 0 && xmlXPathGetSign(number) != 0) {
- snprintf(buffer, buffersize, "0");
- } else if (number == ((int) number)) {
- char work[30];
- char *ptr, *cur;
- int res, value = (int) number;
-
- ptr = &buffer[0];
- if (value < 0) {
- *ptr++ = '-';
- value = -value;
- }
- if (value == 0) {
- *ptr++ = '0';
- } else {
- cur = &work[0];
- while (value != 0) {
- res = value % 10;
- value = value / 10;
- *cur++ = '0' + res;
- }
- cur--;
- while ((cur >= &work[0]) && (ptr - buffer < buffersize)) {
- *ptr++ = *cur--;
- }
- }
- if (ptr - buffer < buffersize) {
- *ptr = 0;
- } else if (buffersize > 0) {
- ptr--;
- *ptr = 0;
- }
- } else {
- /* 3 is sign, decimal point, and terminating zero */
- char work[DBL_DIG + EXPONENT_DIGITS + 3];
- int integer_place, fraction_place;
- char *ptr;
- char *after_fraction;
- double absolute_value;
- int size;
-
- absolute_value = fabs(number);
-
- /*
- * First choose format - scientific or regular floating point.
- * In either case, result is in work, and after_fraction points
- * just past the fractional part.
- */
- if ( ((absolute_value > UPPER_DOUBLE) ||
- (absolute_value < LOWER_DOUBLE)) &&
- (absolute_value != 0.0) ) {
- /* Use scientific notation */
- integer_place = DBL_DIG + EXPONENT_DIGITS + 1;
- fraction_place = DBL_DIG - 1;
- snprintf(work, sizeof(work),"%*.*e",
- integer_place, fraction_place, number);
- after_fraction = strchr(work + DBL_DIG, 'e');
- }
- else {
- /* Use regular notation */
- if (absolute_value > 0.0)
- integer_place = 1 + (int)log10(absolute_value);
- else
- integer_place = 0;
- fraction_place = (integer_place > 0)
- ? DBL_DIG - integer_place
- : DBL_DIG;
- size = snprintf(work, sizeof(work), "%0.*f",
- fraction_place, number);
- after_fraction = work + size;
- }
-
- /* Remove fractional trailing zeroes */
- ptr = after_fraction;
- while (*(--ptr) == '0')
- ;
- if (*ptr != '.')
- ptr++;
- strcpy(ptr, after_fraction);
-
- /* Finally copy result back to caller */
- size = strlen(work) + 1;
- if (size > buffersize) {
- work[buffersize - 1] = 0;
- size = buffersize;
- }
- memcpy(buffer, work, size);
- }
- break;
- }
-}
-
-/************************************************************************
- * *
- * Error handling routines *
- * *
- ************************************************************************/
-
-
-static const char *xmlXPathErrorMessages[] = {
- "Ok",
- "Number encoding",
- "Unfinished literal",
- "Start of literal",
- "Expected $ for variable reference",
- "Undefined variable",
- "Invalid predicate",
- "Invalid expression",
- "Missing closing curly brace",
- "Unregistered function",
- "Invalid operand",
- "Invalid type",
- "Invalid number of arguments",
- "Invalid context size",
- "Invalid context position",
- "Memory allocation error",
- "Syntax error",
- "Resource error",
- "Sub resource error",
- "Undefined namespace prefix",
- "Encoding error",
- "Char out of XML range"
-};
-
-/**
- * xmlXPatherror:
- * @ctxt: the XPath Parser context
- * @file: the file name
- * @line: the line number
- * @no: the error number
- *
- * Formats an error message.
- */
-void
-xmlXPatherror(xmlXPathParserContextPtr ctxt, const char *file ATTRIBUTE_UNUSED,
- int line ATTRIBUTE_UNUSED, int no) {
- int n;
- const xmlChar *cur;
- const xmlChar *base;
-
- cur = ctxt->cur;
- base = ctxt->base;
- if ((cur == NULL) || (base == NULL)) {
- if ((ctxt->comp != NULL) && (ctxt->comp->expr != NULL)) {
- xmlGenericError(xmlGenericErrorContext,
- "XPath error %s in %s\n", xmlXPathErrorMessages[no],
- ctxt->comp->expr);
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "XPath error %s\n", xmlXPathErrorMessages[no]);
- }
-
- return;
- }
- xmlGenericError(xmlGenericErrorContext,
- "XPath error %s\n", xmlXPathErrorMessages[no]);
-
- while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) {
- cur--;
- }
- n = 0;
- while ((n++ < 80) && (cur > base) && (*cur != '\n') && (*cur != '\r'))
- cur--;
- if ((*cur == '\n') || (*cur == '\r')) cur++;
- base = cur;
- n = 0;
- while ((*cur != 0) && (*cur != '\n') && (*cur != '\r') && (n < 79)) {
- xmlGenericError(xmlGenericErrorContext, "%c", (unsigned char) *cur++);
- n++;
- }
- xmlGenericError(xmlGenericErrorContext, "\n");
- cur = ctxt->cur;
- while ((*cur == '\n') || (*cur == '\r'))
- cur--;
- n = 0;
- while ((cur != base) && (n++ < 80)) {
- xmlGenericError(xmlGenericErrorContext, " ");
- base++;
- }
- xmlGenericError(xmlGenericErrorContext,"^\n");
-}
-
-
-/************************************************************************
- * *
- * Routines to handle NodeSets *
- * *
- ************************************************************************/
-
-/**
- * xmlXPathCmpNodes:
- * @node1: the first node
- * @node2: the second node
- *
- * Compare two nodes w.r.t document order
- *
- * Returns -2 in case of error 1 if first point < second point, 0 if
- * that's the same node, -1 otherwise
- */
-int
-xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) {
- int depth1, depth2;
- xmlNodePtr cur, root;
-
- if ((node1 == NULL) || (node2 == NULL))
- return(-2);
- /*
- * a couple of optimizations which will avoid computations in most cases
- */
- if (node1 == node2)
- return(0);
- if ((node1->type == XML_NAMESPACE_DECL) ||
- (node2->type == XML_NAMESPACE_DECL))
- return(1);
- if (node1 == node2->prev)
- return(1);
- if (node1 == node2->next)
- return(-1);
-
-#if 0
- Unfortunately this does not work. Line number in entities reset
- to 1 within the entity :-(
-
- /*
- * Speedup using line numbers if availble.
- */
- if ((node1->type == XML_ELEMENT_NODE) &&
- (node2->type == XML_ELEMENT_NODE) &&
- (0 != (int) node1->content) && (0 != (int) node2->content)) {
- int l1, l2;
- l1 = (int) node1->content;
- l2 = (int) node2->content;
- if (l1 < l2)
- return(1);
- if (l1 > l2)
- return(-1);
- }
-#endif
- /*
- * compute depth to root
- */
- for (depth2 = 0, cur = node2;cur->parent != NULL;cur = cur->parent) {
- if (cur == node1)
- return(1);
- depth2++;
- }
- root = cur;
- for (depth1 = 0, cur = node1;cur->parent != NULL;cur = cur->parent) {
- if (cur == node2)
- return(-1);
- depth1++;
- }
- /*
- * Distinct document (or distinct entities :-( ) case.
- */
- if (root != cur) {
- return(-2);
- }
- /*
- * get the nearest common ancestor.
- */
- while (depth1 > depth2) {
- depth1--;
- node1 = node1->parent;
- }
- while (depth2 > depth1) {
- depth2--;
- node2 = node2->parent;
- }
- while (node1->parent != node2->parent) {
- node1 = node1->parent;
- node2 = node2->parent;
- /* should not happen but just in case ... */
- if ((node1 == NULL) || (node2 == NULL))
- return(-2);
- }
- /*
- * Find who's first.
- */
- if (node1 == node2->next)
- return(-1);
- for (cur = node1->next;cur != NULL;cur = cur->next)
- if (cur == node2)
- return(1);
- return(-1); /* assume there is no sibling list corruption */
-}
-
-/**
- * xmlXPathNodeSetSort:
- * @set: the node set
- *
- * Sort the node set in document order
- */
-void
-xmlXPathNodeSetSort(xmlNodeSetPtr set) {
- int i, j, incr, len;
- xmlNodePtr tmp;
-
- if (set == NULL)
- return;
-
- /* Use Shell's sort to sort the node-set */
- len = set->nodeNr;
- for (incr = len / 2; incr > 0; incr /= 2) {
- for (i = incr; i < len; i++) {
- j = i - incr;
- while (j >= 0) {
- if (xmlXPathCmpNodes(set->nodeTab[j],
- set->nodeTab[j + incr]) == -1) {
- tmp = set->nodeTab[j];
- set->nodeTab[j] = set->nodeTab[j + incr];
- set->nodeTab[j + incr] = tmp;
- j -= incr;
- } else
- break;
- }
- }
- }
-}
-
-#define XML_NODESET_DEFAULT 10
-/**
- * xmlXPathNodeSetDupNs:
- * @node: the parent node of the namespace XPath node
- * @ns: the libxml namespace declaration node.
- *
- * Namespace node in libxml don't match the XPath semantic. In a node set
- * the namespace nodes are duplicated and the next pointer is set to the
- * parent node in the XPath semantic.
- *
- * Returns the newly created object.
- */
-static xmlNodePtr
-xmlXPathNodeSetDupNs(xmlNodePtr node, xmlNsPtr ns) {
- xmlNsPtr cur;
-
- if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL))
- return(NULL);
- if ((node == NULL) || (node->type == XML_NAMESPACE_DECL))
- return((xmlNodePtr) ns);
-
- /*
- * Allocate a new Namespace and fill the fields.
- */
- cur = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
- if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNodeSetDupNs : malloc failed\n");
- return(NULL);
- }
- memset(cur, 0, sizeof(xmlNs));
- cur->type = XML_NAMESPACE_DECL;
- if (ns->href != NULL)
- cur->href = xmlStrdup(ns->href);
- if (ns->prefix != NULL)
- cur->prefix = xmlStrdup(ns->prefix);
- cur->next = (xmlNsPtr) node;
- return((xmlNodePtr) cur);
-}
-
-/**
- * xmlXPathNodeSetFreeNs:
- * @ns: the XPath namespace node found in a nodeset.
- *
- * Namespace node in libxml don't match the XPath semantic. In a node set
- * the namespace nodes are duplicated and the next pointer is set to the
- * parent node in the XPath semantic. Check if such a node need to be freed
- */
-void
-xmlXPathNodeSetFreeNs(xmlNsPtr ns) {
- if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL))
- return;
-
- if ((ns->next != NULL) && (ns->next->type != XML_NAMESPACE_DECL)) {
- if (ns->href != NULL)
- xmlFree((xmlChar *)ns->href);
- if (ns->prefix != NULL)
- xmlFree((xmlChar *)ns->prefix);
- xmlFree(ns);
- }
-}
-
-/**
- * xmlXPathNodeSetCreate:
- * @val: an initial xmlNodePtr, or NULL
- *
- * Create a new xmlNodeSetPtr of type double and of value @val
- *
- * Returns the newly created object.
- */
-xmlNodeSetPtr
-xmlXPathNodeSetCreate(xmlNodePtr val) {
- xmlNodeSetPtr ret;
-
- ret = (xmlNodeSetPtr) xmlMalloc(sizeof(xmlNodeSet));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNodeSetCreate: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlNodeSet));
- if (val != NULL) {
- ret->nodeTab = (xmlNodePtr *) xmlMalloc(XML_NODESET_DEFAULT *
- sizeof(xmlNodePtr));
- if (ret->nodeTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNodeSetCreate: out of memory\n");
- return(NULL);
- }
- memset(ret->nodeTab, 0 ,
- XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
- ret->nodeMax = XML_NODESET_DEFAULT;
- if (val->type == XML_NAMESPACE_DECL) {
- xmlNsPtr ns = (xmlNsPtr) val;
-
- ret->nodeTab[ret->nodeNr++] =
- xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
- } else
- ret->nodeTab[ret->nodeNr++] = val;
- }
- return(ret);
-}
-
-/**
- * xmlXPathNodeSetContains:
- * @cur: the node-set
- * @val: the node
- *
- * checks whether @cur contains @val
- *
- * Returns true (1) if @cur contains @val, false (0) otherwise
- */
-int
-xmlXPathNodeSetContains (xmlNodeSetPtr cur, xmlNodePtr val) {
- int i;
-
- if (val->type == XML_NAMESPACE_DECL) {
- for (i = 0; i < cur->nodeNr; i++) {
- if (cur->nodeTab[i]->type == XML_NAMESPACE_DECL) {
- xmlNsPtr ns1, ns2;
-
- ns1 = (xmlNsPtr) val;
- ns2 = (xmlNsPtr) cur->nodeTab[i];
- if (ns1 == ns2)
- return(1);
- if ((ns1->next != NULL) && (ns2->next == ns1->next) &&
- (xmlStrEqual(ns1->prefix, ns2->prefix)))
- return(1);
- }
- }
- } else {
- for (i = 0; i < cur->nodeNr; i++) {
- if (cur->nodeTab[i] == val)
- return(1);
- }
- }
- return(0);
-}
-
-/**
- * xmlXPathNodeSetAddNs:
- * @cur: the initial node set
- * @node: the hosting node
- * @ns: a the namespace node
- *
- * add a new namespace node to an existing NodeSet
- */
-void
-xmlXPathNodeSetAddNs(xmlNodeSetPtr cur, xmlNodePtr node, xmlNsPtr ns) {
- int i;
-
- if ((ns == NULL) || (node == NULL) || (ns->type != XML_NAMESPACE_DECL) ||
- (node->type != XML_ELEMENT_NODE))
- return;
-
- /* @@ with_ns to check wether namespace nodes should be looked at @@ */
- /*
- * check against doublons
- */
- for (i = 0;i < cur->nodeNr;i++) {
- if ((cur->nodeTab[i] != NULL) &&
- (cur->nodeTab[i]->type == XML_NAMESPACE_DECL) &&
- (((xmlNsPtr)cur->nodeTab[i])->next == (xmlNsPtr) node) &&
- (xmlStrEqual(ns->prefix, ((xmlNsPtr)cur->nodeTab[i])->prefix)))
- return;
- }
-
- /*
- * grow the nodeTab if needed
- */
- if (cur->nodeMax == 0) {
- cur->nodeTab = (xmlNodePtr *) xmlMalloc(XML_NODESET_DEFAULT *
- sizeof(xmlNodePtr));
- if (cur->nodeTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNodeSetAdd: out of memory\n");
- return;
- }
- memset(cur->nodeTab, 0 ,
- XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
- cur->nodeMax = XML_NODESET_DEFAULT;
- } else if (cur->nodeNr == cur->nodeMax) {
- xmlNodePtr *temp;
-
- cur->nodeMax *= 2;
- temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax *
- sizeof(xmlNodePtr));
- if (temp == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNodeSetAdd: out of memory\n");
- return;
- }
- cur->nodeTab = temp;
- }
- cur->nodeTab[cur->nodeNr++] = xmlXPathNodeSetDupNs(node, ns);
-}
-
-/**
- * xmlXPathNodeSetAdd:
- * @cur: the initial node set
- * @val: a new xmlNodePtr
- *
- * add a new xmlNodePtr to an existing NodeSet
- */
-void
-xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) {
- int i;
-
- if (val == NULL) return;
-
- /* @@ with_ns to check wether namespace nodes should be looked at @@ */
- /*
- * check against doublons
- */
- for (i = 0;i < cur->nodeNr;i++)
- if (cur->nodeTab[i] == val) return;
-
- /*
- * grow the nodeTab if needed
- */
- if (cur->nodeMax == 0) {
- cur->nodeTab = (xmlNodePtr *) xmlMalloc(XML_NODESET_DEFAULT *
- sizeof(xmlNodePtr));
- if (cur->nodeTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNodeSetAdd: out of memory\n");
- return;
- }
- memset(cur->nodeTab, 0 ,
- XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
- cur->nodeMax = XML_NODESET_DEFAULT;
- } else if (cur->nodeNr == cur->nodeMax) {
- xmlNodePtr *temp;
-
- cur->nodeMax *= 2;
- temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax *
- sizeof(xmlNodePtr));
- if (temp == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNodeSetAdd: out of memory\n");
- return;
- }
- cur->nodeTab = temp;
- }
- if (val->type == XML_NAMESPACE_DECL) {
- xmlNsPtr ns = (xmlNsPtr) val;
-
- cur->nodeTab[cur->nodeNr++] =
- xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
- } else
- cur->nodeTab[cur->nodeNr++] = val;
-}
-
-/**
- * xmlXPathNodeSetAddUnique:
- * @cur: the initial node set
- * @val: a new xmlNodePtr
- *
- * add a new xmlNodePtr to an existing NodeSet, optimized version
- * when we are sure the node is not already in the set.
- */
-void
-xmlXPathNodeSetAddUnique(xmlNodeSetPtr cur, xmlNodePtr val) {
- if (val == NULL) return;
-
- /* @@ with_ns to check wether namespace nodes should be looked at @@ */
- /*
- * grow the nodeTab if needed
- */
- if (cur->nodeMax == 0) {
- cur->nodeTab = (xmlNodePtr *) xmlMalloc(XML_NODESET_DEFAULT *
- sizeof(xmlNodePtr));
- if (cur->nodeTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNodeSetAddUnique: out of memory\n");
- return;
- }
- memset(cur->nodeTab, 0 ,
- XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
- cur->nodeMax = XML_NODESET_DEFAULT;
- } else if (cur->nodeNr == cur->nodeMax) {
- xmlNodePtr *temp;
-
- cur->nodeMax *= 2;
- temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax *
- sizeof(xmlNodePtr));
- if (temp == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNodeSetAddUnique: out of memory\n");
- return;
- }
- cur->nodeTab = temp;
- }
- if (val->type == XML_NAMESPACE_DECL) {
- xmlNsPtr ns = (xmlNsPtr) val;
-
- cur->nodeTab[cur->nodeNr++] =
- xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
- } else
- cur->nodeTab[cur->nodeNr++] = val;
-}
-
-/**
- * xmlXPathNodeSetMerge:
- * @val1: the first NodeSet or NULL
- * @val2: the second NodeSet
- *
- * Merges two nodesets, all nodes from @val2 are added to @val1
- * if @val1 is NULL, a new set is created and copied from @val2
- *
- * Returns @val1 once extended or NULL in case of error.
- */
-xmlNodeSetPtr
-xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) {
- int i, j, initNr, skip;
-
- if (val2 == NULL) return(val1);
- if (val1 == NULL) {
- val1 = xmlXPathNodeSetCreate(NULL);
- }
-
- /* @@ with_ns to check wether namespace nodes should be looked at @@ */
- initNr = val1->nodeNr;
-
- for (i = 0;i < val2->nodeNr;i++) {
- /*
- * check against doublons
- */
- skip = 0;
- for (j = 0; j < initNr; j++) {
- if (val1->nodeTab[j] == val2->nodeTab[i]) {
- skip = 1;
- break;
- } else if ((val1->nodeTab[j]->type == XML_NAMESPACE_DECL) &&
- (val2->nodeTab[i]->type == XML_NAMESPACE_DECL)) {
- xmlNsPtr ns1, ns2;
- ns1 = (xmlNsPtr) val1->nodeTab[j];
- ns2 = (xmlNsPtr) val2->nodeTab[i];
- if ((ns1->next == ns2->next) &&
- (xmlStrEqual(ns1->prefix, ns2->prefix))) {
- skip = 1;
- break;
- }
- }
- }
- if (skip)
- continue;
-
- /*
- * grow the nodeTab if needed
- */
- if (val1->nodeMax == 0) {
- val1->nodeTab = (xmlNodePtr *) xmlMalloc(XML_NODESET_DEFAULT *
- sizeof(xmlNodePtr));
- if (val1->nodeTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNodeSetMerge: out of memory\n");
- return(NULL);
- }
- memset(val1->nodeTab, 0 ,
- XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
- val1->nodeMax = XML_NODESET_DEFAULT;
- } else if (val1->nodeNr == val1->nodeMax) {
- xmlNodePtr *temp;
-
- val1->nodeMax *= 2;
- temp = (xmlNodePtr *) xmlRealloc(val1->nodeTab, val1->nodeMax *
- sizeof(xmlNodePtr));
- if (temp == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNodeSetMerge: out of memory\n");
- return(NULL);
- }
- val1->nodeTab = temp;
- }
- if (val2->nodeTab[i]->type == XML_NAMESPACE_DECL) {
- xmlNsPtr ns = (xmlNsPtr) val2->nodeTab[i];
-
- val1->nodeTab[val1->nodeNr++] =
- xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
- } else
- val1->nodeTab[val1->nodeNr++] = val2->nodeTab[i];
- }
-
- return(val1);
-}
-
-/**
- * xmlXPathNodeSetMergeUnique:
- * @val1: the first NodeSet or NULL
- * @val2: the second NodeSet
- *
- * Merges two nodesets, all nodes from @val2 are added to @val1
- * if @val1 is NULL, a new set is created and copied from @val2
- *
- * Returns @val1 once extended or NULL in case of error.
- */
-static xmlNodeSetPtr
-xmlXPathNodeSetMergeUnique(xmlNodeSetPtr val1, xmlNodeSetPtr val2) {
- int i, initNr;
-
- if (val2 == NULL) return(val1);
- if (val1 == NULL) {
- val1 = xmlXPathNodeSetCreate(NULL);
- }
-
- /* @@ with_ns to check wether namespace nodes should be looked at @@ */
- initNr = val1->nodeNr;
-
- for (i = 0;i < val2->nodeNr;i++) {
- /*
- * grow the nodeTab if needed
- */
- if (val1->nodeMax == 0) {
- val1->nodeTab = (xmlNodePtr *) xmlMalloc(XML_NODESET_DEFAULT *
- sizeof(xmlNodePtr));
- if (val1->nodeTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNodeSetMerge: out of memory\n");
- return(NULL);
- }
- memset(val1->nodeTab, 0 ,
- XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
- val1->nodeMax = XML_NODESET_DEFAULT;
- } else if (val1->nodeNr == val1->nodeMax) {
- xmlNodePtr *temp;
-
- val1->nodeMax *= 2;
- temp = (xmlNodePtr *) xmlRealloc(val1->nodeTab, val1->nodeMax *
- sizeof(xmlNodePtr));
- if (temp == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNodeSetMerge: out of memory\n");
- return(NULL);
- }
- val1->nodeTab = temp;
- }
- if (val2->nodeTab[i]->type == XML_NAMESPACE_DECL) {
- xmlNsPtr ns = (xmlNsPtr) val2->nodeTab[i];
-
- val1->nodeTab[val1->nodeNr++] =
- xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
- } else
- val1->nodeTab[val1->nodeNr++] = val2->nodeTab[i];
- }
-
- return(val1);
-}
-
-/**
- * xmlXPathNodeSetDel:
- * @cur: the initial node set
- * @val: an xmlNodePtr
- *
- * Removes an xmlNodePtr from an existing NodeSet
- */
-void
-xmlXPathNodeSetDel(xmlNodeSetPtr cur, xmlNodePtr val) {
- int i;
-
- if (cur == NULL) return;
- if (val == NULL) return;
-
- /*
- * check against doublons
- */
- for (i = 0;i < cur->nodeNr;i++)
- if (cur->nodeTab[i] == val) break;
-
- if (i >= cur->nodeNr) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNodeSetDel: Node %s wasn't found in NodeList\n",
- val->name);
-#endif
- return;
- }
- if ((cur->nodeTab[i] != NULL) &&
- (cur->nodeTab[i]->type == XML_NAMESPACE_DECL))
- xmlXPathNodeSetFreeNs((xmlNsPtr) cur->nodeTab[i]);
- cur->nodeNr--;
- for (;i < cur->nodeNr;i++)
- cur->nodeTab[i] = cur->nodeTab[i + 1];
- cur->nodeTab[cur->nodeNr] = NULL;
-}
-
-/**
- * xmlXPathNodeSetRemove:
- * @cur: the initial node set
- * @val: the index to remove
- *
- * Removes an entry from an existing NodeSet list.
- */
-void
-xmlXPathNodeSetRemove(xmlNodeSetPtr cur, int val) {
- if (cur == NULL) return;
- if (val >= cur->nodeNr) return;
- if ((cur->nodeTab[val] != NULL) &&
- (cur->nodeTab[val]->type == XML_NAMESPACE_DECL))
- xmlXPathNodeSetFreeNs((xmlNsPtr) cur->nodeTab[val]);
- cur->nodeNr--;
- for (;val < cur->nodeNr;val++)
- cur->nodeTab[val] = cur->nodeTab[val + 1];
- cur->nodeTab[cur->nodeNr] = NULL;
-}
-
-/**
- * xmlXPathFreeNodeSet:
- * @obj: the xmlNodeSetPtr to free
- *
- * Free the NodeSet compound (not the actual nodes !).
- */
-void
-xmlXPathFreeNodeSet(xmlNodeSetPtr obj) {
- if (obj == NULL) return;
- if (obj->nodeTab != NULL) {
- int i;
-
- /* @@ with_ns to check wether namespace nodes should be looked at @@ */
- for (i = 0;i < obj->nodeNr;i++)
- if ((obj->nodeTab[i] != NULL) &&
- (obj->nodeTab[i]->type == XML_NAMESPACE_DECL))
- xmlXPathNodeSetFreeNs((xmlNsPtr) obj->nodeTab[i]);
- xmlFree(obj->nodeTab);
- }
- xmlFree(obj);
-}
-
-/**
- * xmlXPathFreeValueTree:
- * @obj: the xmlNodeSetPtr to free
- *
- * Free the NodeSet compound and the actual tree, this is different
- * from xmlXPathFreeNodeSet()
- */
-static void
-xmlXPathFreeValueTree(xmlNodeSetPtr obj) {
- int i;
-
- if (obj == NULL) return;
-
- if (obj->nodeTab != NULL) {
- for (i = 0;i < obj->nodeNr;i++) {
- if (obj->nodeTab[i] != NULL) {
- if (obj->nodeTab[i]->type == XML_NAMESPACE_DECL) {
- xmlXPathNodeSetFreeNs((xmlNsPtr) obj->nodeTab[i]);
- } else {
- xmlFreeNodeList(obj->nodeTab[i]);
- }
- }
- }
- xmlFree(obj->nodeTab);
- }
- xmlFree(obj);
-}
-
-#if defined(DEBUG) || defined(DEBUG_STEP)
-/**
- * xmlGenericErrorContextNodeSet:
- * @output: a FILE * for the output
- * @obj: the xmlNodeSetPtr to free
- *
- * Quick display of a NodeSet
- */
-void
-xmlGenericErrorContextNodeSet(FILE *output, xmlNodeSetPtr obj) {
- int i;
-
- if (output == NULL) output = xmlGenericErrorContext;
- if (obj == NULL) {
- fprintf(output, "NodeSet == NULL !\n");
- return;
- }
- if (obj->nodeNr == 0) {
- fprintf(output, "NodeSet is empty\n");
- return;
- }
- if (obj->nodeTab == NULL) {
- fprintf(output, " nodeTab == NULL !\n");
- return;
- }
- for (i = 0; i < obj->nodeNr; i++) {
- if (obj->nodeTab[i] == NULL) {
- fprintf(output, " NULL !\n");
- return;
- }
- if ((obj->nodeTab[i]->type == XML_DOCUMENT_NODE) ||
- (obj->nodeTab[i]->type == XML_HTML_DOCUMENT_NODE))
- fprintf(output, " /");
- else if (obj->nodeTab[i]->name == NULL)
- fprintf(output, " noname!");
- else fprintf(output, " %s", obj->nodeTab[i]->name);
- }
- fprintf(output, "\n");
-}
-#endif
-
-/**
- * xmlXPathNewNodeSet:
- * @val: the NodePtr value
- *
- * Create a new xmlXPathObjectPtr of type NodeSet and initialize
- * it with the single Node @val
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPathNewNodeSet(xmlNodePtr val) {
- xmlXPathObjectPtr ret;
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNewNodeSet: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_NODESET;
- ret->boolval = 0;
- ret->nodesetval = xmlXPathNodeSetCreate(val);
- /* @@ with_ns to check wether namespace nodes should be looked at @@ */
- return(ret);
-}
-
-/**
- * xmlXPathNewValueTree:
- * @val: the NodePtr value
- *
- * Create a new xmlXPathObjectPtr of type Value Tree (XSLT) and initialize
- * it with the tree root @val
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPathNewValueTree(xmlNodePtr val) {
- xmlXPathObjectPtr ret;
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNewNodeSet: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_XSLT_TREE;
- ret->boolval = 1;
- ret->user = (void *) val;
- ret->nodesetval = xmlXPathNodeSetCreate(val);
- return(ret);
-}
-
-/**
- * xmlXPathNewNodeSetList:
- * @val: an existing NodeSet
- *
- * Create a new xmlXPathObjectPtr of type NodeSet and initialize
- * it with the Nodeset @val
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPathNewNodeSetList(xmlNodeSetPtr val)
-{
- xmlXPathObjectPtr ret;
- int i;
-
- if (val == NULL)
- ret = NULL;
- else if (val->nodeTab == NULL)
- ret = xmlXPathNewNodeSet(NULL);
- else {
- ret = xmlXPathNewNodeSet(val->nodeTab[0]);
- for (i = 1; i < val->nodeNr; ++i)
- xmlXPathNodeSetAddUnique(ret->nodesetval, val->nodeTab[i]);
- }
-
- return (ret);
-}
-
-/**
- * xmlXPathWrapNodeSet:
- * @val: the NodePtr value
- *
- * Wrap the Nodeset @val in a new xmlXPathObjectPtr
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPathWrapNodeSet(xmlNodeSetPtr val) {
- xmlXPathObjectPtr ret;
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathWrapNodeSet: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_NODESET;
- ret->nodesetval = val;
- return(ret);
-}
-
-/**
- * xmlXPathFreeNodeSetList:
- * @obj: an existing NodeSetList object
- *
- * Free up the xmlXPathObjectPtr @obj but don't deallocate the objects in
- * the list contrary to xmlXPathFreeObject().
- */
-void
-xmlXPathFreeNodeSetList(xmlXPathObjectPtr obj) {
- if (obj == NULL) return;
- xmlFree(obj);
-}
-
-/**
- * xmlXPathDifference:
- * @nodes1: a node-set
- * @nodes2: a node-set
- *
- * Implements the EXSLT - Sets difference() function:
- * node-set set:difference (node-set, node-set)
- *
- * Returns the difference between the two node sets, or nodes1 if
- * nodes2 is empty
- */
-xmlNodeSetPtr
-xmlXPathDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
- xmlNodeSetPtr ret;
- int i, l1;
- xmlNodePtr cur;
-
- if (xmlXPathNodeSetIsEmpty(nodes2))
- return(nodes1);
-
- ret = xmlXPathNodeSetCreate(NULL);
- if (xmlXPathNodeSetIsEmpty(nodes1))
- return(ret);
-
- l1 = xmlXPathNodeSetGetLength(nodes1);
-
- for (i = 0; i < l1; i++) {
- cur = xmlXPathNodeSetItem(nodes1, i);
- if (!xmlXPathNodeSetContains(nodes2, cur))
- xmlXPathNodeSetAddUnique(ret, cur);
- }
- return(ret);
-}
-
-/**
- * xmlXPathIntersection:
- * @nodes1: a node-set
- * @nodes2: a node-set
- *
- * Implements the EXSLT - Sets intersection() function:
- * node-set set:intersection (node-set, node-set)
- *
- * Returns a node set comprising the nodes that are within both the
- * node sets passed as arguments
- */
-xmlNodeSetPtr
-xmlXPathIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
- xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL);
- int i, l1;
- xmlNodePtr cur;
-
- if (xmlXPathNodeSetIsEmpty(nodes1))
- return(ret);
- if (xmlXPathNodeSetIsEmpty(nodes2))
- return(ret);
-
- l1 = xmlXPathNodeSetGetLength(nodes1);
-
- for (i = 0; i < l1; i++) {
- cur = xmlXPathNodeSetItem(nodes1, i);
- if (xmlXPathNodeSetContains(nodes2, cur))
- xmlXPathNodeSetAddUnique(ret, cur);
- }
- return(ret);
-}
-
-/**
- * xmlXPathDistinctSorted:
- * @nodes: a node-set, sorted by document order
- *
- * Implements the EXSLT - Sets distinct() function:
- * node-set set:distinct (node-set)
- *
- * Returns a subset of the nodes contained in @nodes, or @nodes if
- * it is empty
- */
-xmlNodeSetPtr
-xmlXPathDistinctSorted (xmlNodeSetPtr nodes) {
- xmlNodeSetPtr ret;
- xmlHashTablePtr hash;
- int i, l;
- xmlChar * strval;
- xmlNodePtr cur;
-
- if (xmlXPathNodeSetIsEmpty(nodes))
- return(nodes);
-
- ret = xmlXPathNodeSetCreate(NULL);
- l = xmlXPathNodeSetGetLength(nodes);
- hash = xmlHashCreate (l);
- for (i = 0; i < l; i++) {
- cur = xmlXPathNodeSetItem(nodes, i);
- strval = xmlXPathCastNodeToString(cur);
- if (xmlHashLookup(hash, strval) == NULL) {
- xmlHashAddEntry(hash, strval, strval);
- xmlXPathNodeSetAddUnique(ret, cur);
- } else {
- xmlFree(strval);
- }
- }
- xmlHashFree(hash, (xmlHashDeallocator) xmlFree);
- return(ret);
-}
-
-/**
- * xmlXPathDistinct:
- * @nodes: a node-set
- *
- * Implements the EXSLT - Sets distinct() function:
- * node-set set:distinct (node-set)
- * @nodes is sorted by document order, then #exslSetsDistinctSorted
- * is called with the sorted node-set
- *
- * Returns a subset of the nodes contained in @nodes, or @nodes if
- * it is empty
- */
-xmlNodeSetPtr
-xmlXPathDistinct (xmlNodeSetPtr nodes) {
- if (xmlXPathNodeSetIsEmpty(nodes))
- return(nodes);
-
- xmlXPathNodeSetSort(nodes);
- return(xmlXPathDistinctSorted(nodes));
-}
-
-/**
- * xmlXPathHasSameNodes:
- * @nodes1: a node-set
- * @nodes2: a node-set
- *
- * Implements the EXSLT - Sets has-same-nodes function:
- * boolean set:has-same-node(node-set, node-set)
- *
- * Returns true (1) if @nodes1 shares any node with @nodes2, false (0)
- * otherwise
- */
-int
-xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
- int i, l;
- xmlNodePtr cur;
-
- if (xmlXPathNodeSetIsEmpty(nodes1) ||
- xmlXPathNodeSetIsEmpty(nodes2))
- return(0);
-
- l = xmlXPathNodeSetGetLength(nodes1);
- for (i = 0; i < l; i++) {
- cur = xmlXPathNodeSetItem(nodes1, i);
- if (xmlXPathNodeSetContains(nodes2, cur))
- return(1);
- }
- return(0);
-}
-
-/**
- * xmlXPathNodeLeadingSorted:
- * @nodes: a node-set, sorted by document order
- * @node: a node
- *
- * Implements the EXSLT - Sets leading() function:
- * node-set set:leading (node-set, node-set)
- *
- * Returns the nodes in @nodes that precede @node in document order,
- * @nodes if @node is NULL or an empty node-set if @nodes
- * doesn't contain @node
- */
-xmlNodeSetPtr
-xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
- int i, l;
- xmlNodePtr cur;
- xmlNodeSetPtr ret;
-
- if (node == NULL)
- return(nodes);
-
- ret = xmlXPathNodeSetCreate(NULL);
- if (xmlXPathNodeSetIsEmpty(nodes) ||
- (!xmlXPathNodeSetContains(nodes, node)))
- return(ret);
-
- l = xmlXPathNodeSetGetLength(nodes);
- for (i = 0; i < l; i++) {
- cur = xmlXPathNodeSetItem(nodes, i);
- if (cur == node)
- break;
- xmlXPathNodeSetAddUnique(ret, cur);
- }
- return(ret);
-}
-
-/**
- * xmlXPathNodeLeading:
- * @nodes: a node-set
- * @node: a node
- *
- * Implements the EXSLT - Sets leading() function:
- * node-set set:leading (node-set, node-set)
- * @nodes is sorted by document order, then #exslSetsNodeLeadingSorted
- * is called.
- *
- * Returns the nodes in @nodes that precede @node in document order,
- * @nodes if @node is NULL or an empty node-set if @nodes
- * doesn't contain @node
- */
-xmlNodeSetPtr
-xmlXPathNodeLeading (xmlNodeSetPtr nodes, xmlNodePtr node) {
- xmlXPathNodeSetSort(nodes);
- return(xmlXPathNodeLeadingSorted(nodes, node));
-}
-
-/**
- * xmlXPathLeadingSorted:
- * @nodes1: a node-set, sorted by document order
- * @nodes2: a node-set, sorted by document order
- *
- * Implements the EXSLT - Sets leading() function:
- * node-set set:leading (node-set, node-set)
- *
- * Returns the nodes in @nodes1 that precede the first node in @nodes2
- * in document order, @nodes1 if @nodes2 is NULL or empty or
- * an empty node-set if @nodes1 doesn't contain @nodes2
- */
-xmlNodeSetPtr
-xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
- if (xmlXPathNodeSetIsEmpty(nodes2))
- return(nodes1);
- return(xmlXPathNodeLeadingSorted(nodes1,
- xmlXPathNodeSetItem(nodes2, 1)));
-}
-
-/**
- * xmlXPathLeading:
- * @nodes1: a node-set
- * @nodes2: a node-set
- *
- * Implements the EXSLT - Sets leading() function:
- * node-set set:leading (node-set, node-set)
- * @nodes1 and @nodes2 are sorted by document order, then
- * #exslSetsLeadingSorted is called.
- *
- * Returns the nodes in @nodes1 that precede the first node in @nodes2
- * in document order, @nodes1 if @nodes2 is NULL or empty or
- * an empty node-set if @nodes1 doesn't contain @nodes2
- */
-xmlNodeSetPtr
-xmlXPathLeading (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
- if (xmlXPathNodeSetIsEmpty(nodes2))
- return(nodes1);
- if (xmlXPathNodeSetIsEmpty(nodes1))
- return(xmlXPathNodeSetCreate(NULL));
- xmlXPathNodeSetSort(nodes1);
- xmlXPathNodeSetSort(nodes2);
- return(xmlXPathNodeLeadingSorted(nodes1,
- xmlXPathNodeSetItem(nodes2, 1)));
-}
-
-/**
- * xmlXPathNodeTrailingSorted:
- * @nodes: a node-set, sorted by document order
- * @node: a node
- *
- * Implements the EXSLT - Sets trailing() function:
- * node-set set:trailing (node-set, node-set)
- *
- * Returns the nodes in @nodes that follow @node in document order,
- * @nodes if @node is NULL or an empty node-set if @nodes
- * doesn't contain @node
- */
-xmlNodeSetPtr
-xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
- int i, l;
- xmlNodePtr cur;
- xmlNodeSetPtr ret;
-
- if (node == NULL)
- return(nodes);
-
- ret = xmlXPathNodeSetCreate(NULL);
- if (xmlXPathNodeSetIsEmpty(nodes) ||
- (!xmlXPathNodeSetContains(nodes, node)))
- return(ret);
-
- l = xmlXPathNodeSetGetLength(nodes);
- for (i = l; i > 0; i--) {
- cur = xmlXPathNodeSetItem(nodes, i);
- if (cur == node)
- break;
- xmlXPathNodeSetAddUnique(ret, cur);
- }
- return(ret);
-}
-
-/**
- * xmlXPathNodeTrailing:
- * @nodes: a node-set
- * @node: a node
- *
- * Implements the EXSLT - Sets trailing() function:
- * node-set set:trailing (node-set, node-set)
- * @nodes is sorted by document order, then #xmlXPathNodeTrailingSorted
- * is called.
- *
- * Returns the nodes in @nodes that follow @node in document order,
- * @nodes if @node is NULL or an empty node-set if @nodes
- * doesn't contain @node
- */
-xmlNodeSetPtr
-xmlXPathNodeTrailing (xmlNodeSetPtr nodes, xmlNodePtr node) {
- xmlXPathNodeSetSort(nodes);
- return(xmlXPathNodeTrailingSorted(nodes, node));
-}
-
-/**
- * xmlXPathTrailingSorted:
- * @nodes1: a node-set, sorted by document order
- * @nodes2: a node-set, sorted by document order
- *
- * Implements the EXSLT - Sets trailing() function:
- * node-set set:trailing (node-set, node-set)
- *
- * Returns the nodes in @nodes1 that follow the first node in @nodes2
- * in document order, @nodes1 if @nodes2 is NULL or empty or
- * an empty node-set if @nodes1 doesn't contain @nodes2
- */
-xmlNodeSetPtr
-xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
- if (xmlXPathNodeSetIsEmpty(nodes2))
- return(nodes1);
- return(xmlXPathNodeTrailingSorted(nodes1,
- xmlXPathNodeSetItem(nodes2, 0)));
-}
-
-/**
- * xmlXPathTrailing:
- * @nodes1: a node-set
- * @nodes2: a node-set
- *
- * Implements the EXSLT - Sets trailing() function:
- * node-set set:trailing (node-set, node-set)
- * @nodes1 and @nodes2 are sorted by document order, then
- * #xmlXPathTrailingSorted is called.
- *
- * Returns the nodes in @nodes1 that follow the first node in @nodes2
- * in document order, @nodes1 if @nodes2 is NULL or empty or
- * an empty node-set if @nodes1 doesn't contain @nodes2
- */
-xmlNodeSetPtr
-xmlXPathTrailing (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
- if (xmlXPathNodeSetIsEmpty(nodes2))
- return(nodes1);
- if (xmlXPathNodeSetIsEmpty(nodes1))
- return(xmlXPathNodeSetCreate(NULL));
- xmlXPathNodeSetSort(nodes1);
- xmlXPathNodeSetSort(nodes2);
- return(xmlXPathNodeTrailingSorted(nodes1,
- xmlXPathNodeSetItem(nodes2, 0)));
-}
-
-/************************************************************************
- * *
- * Routines to handle extra functions *
- * *
- ************************************************************************/
-
-/**
- * xmlXPathRegisterFunc:
- * @ctxt: the XPath context
- * @name: the function name
- * @f: the function implementation or NULL
- *
- * Register a new function. If @f is NULL it unregisters the function
- *
- * Returns 0 in case of success, -1 in case of error
- */
-int
-xmlXPathRegisterFunc(xmlXPathContextPtr ctxt, const xmlChar *name,
- xmlXPathFunction f) {
- return(xmlXPathRegisterFuncNS(ctxt, name, NULL, f));
-}
-
-/**
- * xmlXPathRegisterFuncNS:
- * @ctxt: the XPath context
- * @name: the function name
- * @ns_uri: the function namespace URI
- * @f: the function implementation or NULL
- *
- * Register a new function. If @f is NULL it unregisters the function
- *
- * Returns 0 in case of success, -1 in case of error
- */
-int
-xmlXPathRegisterFuncNS(xmlXPathContextPtr ctxt, const xmlChar *name,
- const xmlChar *ns_uri, xmlXPathFunction f) {
- if (ctxt == NULL)
- return(-1);
- if (name == NULL)
- return(-1);
-
- if (ctxt->funcHash == NULL)
- ctxt->funcHash = xmlHashCreate(0);
- if (ctxt->funcHash == NULL)
- return(-1);
- return(xmlHashAddEntry2(ctxt->funcHash, name, ns_uri, (void *) f));
-}
-
-/**
- * xmlXPathRegisterFuncLookup:
- * @ctxt: the XPath context
- * @f: the lookup function
- * @funcCtxt: the lookup data
- *
- * Registers an external mechanism to do function lookup.
- */
-void
-xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt,
- xmlXPathFuncLookupFunc f,
- void *funcCtxt) {
- if (ctxt == NULL)
- return;
- ctxt->funcLookupFunc = (void *) f;
- ctxt->funcLookupData = funcCtxt;
-}
-
-/**
- * xmlXPathFunctionLookup:
- * @ctxt: the XPath context
- * @name: the function name
- *
- * Search in the Function array of the context for the given
- * function.
- *
- * Returns the xmlXPathFunction or NULL if not found
- */
-xmlXPathFunction
-xmlXPathFunctionLookup(xmlXPathContextPtr ctxt, const xmlChar *name) {
- if (ctxt == NULL)
- return (NULL);
-
- if (ctxt->funcLookupFunc != NULL) {
- xmlXPathFunction ret;
- xmlXPathFuncLookupFunc f;
-
- f = (xmlXPathFuncLookupFunc) ctxt->funcLookupFunc;
- ret = f(ctxt->funcLookupData, name, NULL);
- if (ret != NULL)
- return(ret);
- }
- return(xmlXPathFunctionLookupNS(ctxt, name, NULL));
-}
-
-/**
- * xmlXPathFunctionLookupNS:
- * @ctxt: the XPath context
- * @name: the function name
- * @ns_uri: the function namespace URI
- *
- * Search in the Function array of the context for the given
- * function.
- *
- * Returns the xmlXPathFunction or NULL if not found
- */
-xmlXPathFunction
-xmlXPathFunctionLookupNS(xmlXPathContextPtr ctxt, const xmlChar *name,
- const xmlChar *ns_uri) {
- if (ctxt == NULL)
- return(NULL);
- if (name == NULL)
- return(NULL);
-
- if (ctxt->funcLookupFunc != NULL) {
- xmlXPathFunction ret;
- xmlXPathFuncLookupFunc f;
-
- f = (xmlXPathFuncLookupFunc) ctxt->funcLookupFunc;
- ret = f(ctxt->funcLookupData, name, ns_uri);
- if (ret != NULL)
- return(ret);
- }
-
- if (ctxt->funcHash == NULL)
- return(NULL);
-
- return((xmlXPathFunction) xmlHashLookup2(ctxt->funcHash, name, ns_uri));
-}
-
-/**
- * xmlXPathRegisteredFuncsCleanup:
- * @ctxt: the XPath context
- *
- * Cleanup the XPath context data associated to registered functions
- */
-void
-xmlXPathRegisteredFuncsCleanup(xmlXPathContextPtr ctxt) {
- if (ctxt == NULL)
- return;
-
- xmlHashFree(ctxt->funcHash, NULL);
- ctxt->funcHash = NULL;
-}
-
-/************************************************************************
- * *
- * Routines to handle Variable *
- * *
- ************************************************************************/
-
-/**
- * xmlXPathRegisterVariable:
- * @ctxt: the XPath context
- * @name: the variable name
- * @value: the variable value or NULL
- *
- * Register a new variable value. If @value is NULL it unregisters
- * the variable
- *
- * Returns 0 in case of success, -1 in case of error
- */
-int
-xmlXPathRegisterVariable(xmlXPathContextPtr ctxt, const xmlChar *name,
- xmlXPathObjectPtr value) {
- return(xmlXPathRegisterVariableNS(ctxt, name, NULL, value));
-}
-
-/**
- * xmlXPathRegisterVariableNS:
- * @ctxt: the XPath context
- * @name: the variable name
- * @ns_uri: the variable namespace URI
- * @value: the variable value or NULL
- *
- * Register a new variable value. If @value is NULL it unregisters
- * the variable
- *
- * Returns 0 in case of success, -1 in case of error
- */
-int
-xmlXPathRegisterVariableNS(xmlXPathContextPtr ctxt, const xmlChar *name,
- const xmlChar *ns_uri,
- xmlXPathObjectPtr value) {
- if (ctxt == NULL)
- return(-1);
- if (name == NULL)
- return(-1);
-
- if (ctxt->varHash == NULL)
- ctxt->varHash = xmlHashCreate(0);
- if (ctxt->varHash == NULL)
- return(-1);
- return(xmlHashUpdateEntry2(ctxt->varHash, name, ns_uri,
- (void *) value,
- (xmlHashDeallocator)xmlXPathFreeObject));
-}
-
-/**
- * xmlXPathRegisterVariableLookup:
- * @ctxt: the XPath context
- * @f: the lookup function
- * @data: the lookup data
- *
- * register an external mechanism to do variable lookup
- */
-void
-xmlXPathRegisterVariableLookup(xmlXPathContextPtr ctxt,
- xmlXPathVariableLookupFunc f, void *data) {
- if (ctxt == NULL)
- return;
- ctxt->varLookupFunc = (void *) f;
- ctxt->varLookupData = data;
-}
-
-/**
- * xmlXPathVariableLookup:
- * @ctxt: the XPath context
- * @name: the variable name
- *
- * Search in the Variable array of the context for the given
- * variable value.
- *
- * Returns a copy of the value or NULL if not found
- */
-xmlXPathObjectPtr
-xmlXPathVariableLookup(xmlXPathContextPtr ctxt, const xmlChar *name) {
- if (ctxt == NULL)
- return(NULL);
-
- if (ctxt->varLookupFunc != NULL) {
- xmlXPathObjectPtr ret;
-
- ret = ((xmlXPathVariableLookupFunc)ctxt->varLookupFunc)
- (ctxt->varLookupData, name, NULL);
- return(ret);
- }
- return(xmlXPathVariableLookupNS(ctxt, name, NULL));
-}
-
-/**
- * xmlXPathVariableLookupNS:
- * @ctxt: the XPath context
- * @name: the variable name
- * @ns_uri: the variable namespace URI
- *
- * Search in the Variable array of the context for the given
- * variable value.
- *
- * Returns the a copy of the value or NULL if not found
- */
-xmlXPathObjectPtr
-xmlXPathVariableLookupNS(xmlXPathContextPtr ctxt, const xmlChar *name,
- const xmlChar *ns_uri) {
- if (ctxt == NULL)
- return(NULL);
-
- if (ctxt->varLookupFunc != NULL) {
- xmlXPathObjectPtr ret;
-
- ret = ((xmlXPathVariableLookupFunc)ctxt->varLookupFunc)
- (ctxt->varLookupData, name, ns_uri);
- if (ret != NULL) return(ret);
- }
-
- if (ctxt->varHash == NULL)
- return(NULL);
- if (name == NULL)
- return(NULL);
-
- return(xmlXPathObjectCopy((xmlXPathObjectPtr)
- xmlHashLookup2(ctxt->varHash, name, ns_uri)));
-}
-
-/**
- * xmlXPathRegisteredVariablesCleanup:
- * @ctxt: the XPath context
- *
- * Cleanup the XPath context data associated to registered variables
- */
-void
-xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt) {
- if (ctxt == NULL)
- return;
-
- xmlHashFree(ctxt->varHash, (xmlHashDeallocator)xmlXPathFreeObject);
- ctxt->varHash = NULL;
-}
-
-/**
- * xmlXPathRegisterNs:
- * @ctxt: the XPath context
- * @prefix: the namespace prefix
- * @ns_uri: the namespace name
- *
- * Register a new namespace. If @ns_uri is NULL it unregisters
- * the namespace
- *
- * Returns 0 in case of success, -1 in case of error
- */
-int
-xmlXPathRegisterNs(xmlXPathContextPtr ctxt, const xmlChar *prefix,
- const xmlChar *ns_uri) {
- if (ctxt == NULL)
- return(-1);
- if (prefix == NULL)
- return(-1);
-
- if (ctxt->nsHash == NULL)
- ctxt->nsHash = xmlHashCreate(10);
- if (ctxt->nsHash == NULL)
- return(-1);
- return(xmlHashUpdateEntry(ctxt->nsHash, prefix, (void *) xmlStrdup(ns_uri),
- (xmlHashDeallocator)xmlFree));
-}
-
-/**
- * xmlXPathNsLookup:
- * @ctxt: the XPath context
- * @prefix: the namespace prefix value
- *
- * Search in the namespace declaration array of the context for the given
- * namespace name associated to the given prefix
- *
- * Returns the value or NULL if not found
- */
-const xmlChar *
-xmlXPathNsLookup(xmlXPathContextPtr ctxt, const xmlChar *prefix) {
- if (ctxt == NULL)
- return(NULL);
- if (prefix == NULL)
- return(NULL);
-
-#ifdef XML_XML_NAMESPACE
- if (xmlStrEqual(prefix, (const xmlChar *) "xml"))
- return(XML_XML_NAMESPACE);
-#endif
-
- if (ctxt->namespaces != NULL) {
- int i;
-
- for (i = 0;i < ctxt->nsNr;i++) {
- if ((ctxt->namespaces[i] != NULL) &&
- (xmlStrEqual(ctxt->namespaces[i]->prefix, prefix)))
- return(ctxt->namespaces[i]->href);
- }
- }
-
- return((const xmlChar *) xmlHashLookup(ctxt->nsHash, prefix));
-}
-
-/**
- * xmlXPathRegisteredNsCleanup:
- * @ctxt: the XPath context
- *
- * Cleanup the XPath context data associated to registered variables
- */
-void
-xmlXPathRegisteredNsCleanup(xmlXPathContextPtr ctxt) {
- if (ctxt == NULL)
- return;
-
- xmlHashFree(ctxt->nsHash, (xmlHashDeallocator)xmlFree);
- ctxt->nsHash = NULL;
-}
-
-/************************************************************************
- * *
- * Routines to handle Values *
- * *
- ************************************************************************/
-
-/* Allocations are terrible, one need to optimize all this !!! */
-
-/**
- * xmlXPathNewFloat:
- * @val: the double value
- *
- * Create a new xmlXPathObjectPtr of type double and of value @val
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPathNewFloat(double val) {
- xmlXPathObjectPtr ret;
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNewFloat: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_NUMBER;
- ret->floatval = val;
- return(ret);
-}
-
-/**
- * xmlXPathNewBoolean:
- * @val: the boolean value
- *
- * Create a new xmlXPathObjectPtr of type boolean and of value @val
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPathNewBoolean(int val) {
- xmlXPathObjectPtr ret;
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNewBoolean: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_BOOLEAN;
- ret->boolval = (val != 0);
- return(ret);
-}
-
-/**
- * xmlXPathNewString:
- * @val: the xmlChar * value
- *
- * Create a new xmlXPathObjectPtr of type string and of value @val
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPathNewString(const xmlChar *val) {
- xmlXPathObjectPtr ret;
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNewString: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_STRING;
- if (val != NULL)
- ret->stringval = xmlStrdup(val);
- else
- ret->stringval = xmlStrdup((const xmlChar *)"");
- return(ret);
-}
-
-/**
- * xmlXPathWrapString:
- * @val: the xmlChar * value
- *
- * Wraps the @val string into an XPath object.
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPathWrapString (xmlChar *val) {
- xmlXPathObjectPtr ret;
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathWrapString: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_STRING;
- ret->stringval = val;
- return(ret);
-}
-
-/**
- * xmlXPathNewCString:
- * @val: the char * value
- *
- * Create a new xmlXPathObjectPtr of type string and of value @val
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPathNewCString(const char *val) {
- xmlXPathObjectPtr ret;
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNewCString: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_STRING;
- ret->stringval = xmlStrdup(BAD_CAST val);
- return(ret);
-}
-
-/**
- * xmlXPathWrapCString:
- * @val: the char * value
- *
- * Wraps a string into an XPath object.
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPathWrapCString (char * val) {
- return(xmlXPathWrapString((xmlChar *)(val)));
-}
-
-/**
- * xmlXPathWrapExternal:
- * @val: the user data
- *
- * Wraps the @val data into an XPath object.
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPathWrapExternal (void *val) {
- xmlXPathObjectPtr ret;
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathWrapExternal: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_USERS;
- ret->user = val;
- return(ret);
-}
-
-/**
- * xmlXPathObjectCopy:
- * @val: the original object
- *
- * allocate a new copy of a given object
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPathObjectCopy(xmlXPathObjectPtr val) {
- xmlXPathObjectPtr ret;
-
- if (val == NULL)
- return(NULL);
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathObjectCopy: out of memory\n");
- return(NULL);
- }
- memcpy(ret, val , (size_t) sizeof(xmlXPathObject));
- switch (val->type) {
- case XPATH_BOOLEAN:
- case XPATH_NUMBER:
- case XPATH_POINT:
- case XPATH_RANGE:
- break;
- case XPATH_STRING:
- ret->stringval = xmlStrdup(val->stringval);
- break;
- case XPATH_XSLT_TREE:
- if ((val->nodesetval != NULL) &&
- (val->nodesetval->nodeTab != NULL)) {
- ret->boolval = 1;
- ret->user = xmlDocCopyNode(val->nodesetval->nodeTab[0],
- val->nodesetval->nodeTab[0]->doc, 1);
- ret->nodesetval = xmlXPathNodeSetCreate(
- (xmlNodePtr) ret->user);
- } else
- ret->nodesetval = xmlXPathNodeSetCreate(NULL);
- /* Deallocate the copied tree value */
- break;
- case XPATH_NODESET:
- ret->nodesetval = xmlXPathNodeSetMerge(NULL, val->nodesetval);
- /* Do not deallocate the copied tree value */
- ret->boolval = 0;
- break;
- case XPATH_LOCATIONSET:
-#ifdef LIBXML_XPTR_ENABLED
- {
- xmlLocationSetPtr loc = val->user;
- ret->user = (void *) xmlXPtrLocationSetMerge(NULL, loc);
- break;
- }
-#endif
- case XPATH_USERS:
- ret->user = val->user;
- break;
- case XPATH_UNDEFINED:
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathObjectCopy: unsupported type %d\n",
- val->type);
- break;
- }
- return(ret);
-}
-
-/**
- * xmlXPathFreeObject:
- * @obj: the object to free
- *
- * Free up an xmlXPathObjectPtr object.
- */
-void
-xmlXPathFreeObject(xmlXPathObjectPtr obj) {
- if (obj == NULL) return;
- if ((obj->type == XPATH_NODESET) || (obj->type == XPATH_XSLT_TREE)) {
- if (obj->boolval) {
- if (obj->user != NULL) {
- xmlXPathFreeNodeSet(obj->nodesetval);
- xmlFreeNodeList((xmlNodePtr) obj->user);
- } else if (obj->nodesetval != NULL)
- xmlXPathFreeValueTree(obj->nodesetval);
- } else {
- if (obj->nodesetval != NULL)
- xmlXPathFreeNodeSet(obj->nodesetval);
- }
-#ifdef LIBXML_XPTR_ENABLED
- } else if (obj->type == XPATH_LOCATIONSET) {
- if (obj->user != NULL)
- xmlXPtrFreeLocationSet(obj->user);
-#endif
- } else if (obj->type == XPATH_STRING) {
- if (obj->stringval != NULL)
- xmlFree(obj->stringval);
- }
-
- xmlFree(obj);
-}
-
-
-/************************************************************************
- * *
- * Type Casting Routines *
- * *
- ************************************************************************/
-
-/**
- * xmlXPathCastBooleanToString:
- * @val: a boolean
- *
- * Converts a boolean to its string value.
- *
- * Returns a newly allocated string.
- */
-xmlChar *
-xmlXPathCastBooleanToString (int val) {
- xmlChar *ret;
- if (val)
- ret = xmlStrdup((const xmlChar *) "true");
- else
- ret = xmlStrdup((const xmlChar *) "false");
- return(ret);
-}
-
-/**
- * xmlXPathCastNumberToString:
- * @val: a number
- *
- * Converts a number to its string value.
- *
- * Returns a newly allocated string.
- */
-xmlChar *
-xmlXPathCastNumberToString (double val) {
- xmlChar *ret;
- switch (xmlXPathIsInf(val)) {
- case 1:
- ret = xmlStrdup((const xmlChar *) "Infinity");
- break;
- case -1:
- ret = xmlStrdup((const xmlChar *) "-Infinity");
- break;
- default:
- if (xmlXPathIsNaN(val)) {
- ret = xmlStrdup((const xmlChar *) "NaN");
- } else if (val == 0 && xmlXPathGetSign(val) != 0) {
- ret = xmlStrdup((const xmlChar *) "0");
- } else {
- /* could be improved */
- char buf[100];
- xmlXPathFormatNumber(val, buf, 100);
- ret = xmlStrdup((const xmlChar *) buf);
- }
- }
- return(ret);
-}
-
-/**
- * xmlXPathCastNodeToString:
- * @node: a node
- *
- * Converts a node to its string value.
- *
- * Returns a newly allocated string.
- */
-xmlChar *
-xmlXPathCastNodeToString (xmlNodePtr node) {
- if ((node != NULL) && (node->type == XML_DOCUMENT_NODE))
- node = xmlDocGetRootElement((xmlDocPtr) node);
- return(xmlNodeGetContent(node));
-}
-
-/**
- * xmlXPathCastNodeSetToString:
- * @ns: a node-set
- *
- * Converts a node-set to its string value.
- *
- * Returns a newly allocated string.
- */
-xmlChar *
-xmlXPathCastNodeSetToString (xmlNodeSetPtr ns) {
- if ((ns == NULL) || (ns->nodeNr == 0) || (ns->nodeTab == NULL))
- return(xmlStrdup((const xmlChar *) ""));
-
- xmlXPathNodeSetSort(ns);
- return(xmlXPathCastNodeToString(ns->nodeTab[0]));
-}
-
-/**
- * xmlXPathCastToString:
- * @val: an XPath object
- *
- * Converts an existing object to its string() equivalent
- *
- * Returns the string value of the object, NULL in case of error.
- * A new string is allocated only if needed (@val isn't a
- * string object).
- */
-xmlChar *
-xmlXPathCastToString(xmlXPathObjectPtr val) {
- xmlChar *ret = NULL;
-
- if (val == NULL)
- return(xmlStrdup((const xmlChar *) ""));
- switch (val->type) {
- case XPATH_UNDEFINED:
-#ifdef DEBUG_EXPR
- xmlGenericError(xmlGenericErrorContext, "String: undefined\n");
-#endif
- ret = xmlStrdup((const xmlChar *) "");
- break;
- case XPATH_NODESET:
- case XPATH_XSLT_TREE:
- ret = xmlXPathCastNodeSetToString(val->nodesetval);
- break;
- case XPATH_STRING:
- return(xmlStrdup(val->stringval));
- case XPATH_BOOLEAN:
- ret = xmlXPathCastBooleanToString(val->boolval);
- break;
- case XPATH_NUMBER: {
- ret = xmlXPathCastNumberToString(val->floatval);
- break;
- }
- case XPATH_USERS:
- case XPATH_POINT:
- case XPATH_RANGE:
- case XPATH_LOCATIONSET:
- TODO
- ret = xmlStrdup((const xmlChar *) "");
- break;
- }
- return(ret);
-}
-
-/**
- * xmlXPathConvertString:
- * @val: an XPath object
- *
- * Converts an existing object to its string() equivalent
- *
- * Returns the new object, the old one is freed (or the operation
- * is done directly on @val)
- */
-xmlXPathObjectPtr
-xmlXPathConvertString(xmlXPathObjectPtr val) {
- xmlChar *res = NULL;
-
- if (val == NULL)
- return(xmlXPathNewCString(""));
-
- switch (val->type) {
- case XPATH_UNDEFINED:
-#ifdef DEBUG_EXPR
- xmlGenericError(xmlGenericErrorContext, "STRING: undefined\n");
-#endif
- break;
- case XPATH_NODESET:
- case XPATH_XSLT_TREE:
- res = xmlXPathCastNodeSetToString(val->nodesetval);
- break;
- case XPATH_STRING:
- return(val);
- case XPATH_BOOLEAN:
- res = xmlXPathCastBooleanToString(val->boolval);
- break;
- case XPATH_NUMBER:
- res = xmlXPathCastNumberToString(val->floatval);
- break;
- case XPATH_USERS:
- case XPATH_POINT:
- case XPATH_RANGE:
- case XPATH_LOCATIONSET:
- TODO;
- break;
- }
- xmlXPathFreeObject(val);
- if (res == NULL)
- return(xmlXPathNewCString(""));
- return(xmlXPathWrapString(res));
-}
-
-/**
- * xmlXPathCastBooleanToNumber:
- * @val: a boolean
- *
- * Converts a boolean to its number value
- *
- * Returns the number value
- */
-double
-xmlXPathCastBooleanToNumber(int val) {
- if (val)
- return(1.0);
- return(0.0);
-}
-
-/**
- * xmlXPathCastStringToNumber:
- * @val: a string
- *
- * Converts a string to its number value
- *
- * Returns the number value
- */
-double
-xmlXPathCastStringToNumber(const xmlChar * val) {
- return(xmlXPathStringEvalNumber(val));
-}
-
-/**
- * xmlXPathCastNodeToNumber:
- * @node: a node
- *
- * Converts a node to its number value
- *
- * Returns the number value
- */
-double
-xmlXPathCastNodeToNumber (xmlNodePtr node) {
- xmlChar *strval;
- double ret;
-
- if (node == NULL)
- return(xmlXPathNAN);
- strval = xmlXPathCastNodeToString(node);
- if (strval == NULL)
- return(xmlXPathNAN);
- ret = xmlXPathCastStringToNumber(strval);
- xmlFree(strval);
-
- return(ret);
-}
-
-/**
- * xmlXPathCastNodeSetToNumber:
- * @ns: a node-set
- *
- * Converts a node-set to its number value
- *
- * Returns the number value
- */
-double
-xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns) {
- xmlChar *str;
- double ret;
-
- if (ns == NULL)
- return(xmlXPathNAN);
- str = xmlXPathCastNodeSetToString(ns);
- ret = xmlXPathCastStringToNumber(str);
- xmlFree(str);
- return(ret);
-}
-
-/**
- * xmlXPathCastToNumber:
- * @val: an XPath object
- *
- * Converts an XPath object to its number value
- *
- * Returns the number value
- */
-double
-xmlXPathCastToNumber(xmlXPathObjectPtr val) {
- double ret = 0.0;
-
- if (val == NULL)
- return(xmlXPathNAN);
- switch (val->type) {
- case XPATH_UNDEFINED:
-#ifdef DEGUB_EXPR
- xmlGenericError(xmlGenericErrorContext, "NUMBER: undefined\n");
-#endif
- ret = xmlXPathNAN;
- break;
- case XPATH_NODESET:
- case XPATH_XSLT_TREE:
- ret = xmlXPathCastNodeSetToNumber(val->nodesetval);
- break;
- case XPATH_STRING:
- ret = xmlXPathCastStringToNumber(val->stringval);
- break;
- case XPATH_NUMBER:
- ret = val->floatval;
- break;
- case XPATH_BOOLEAN:
- ret = xmlXPathCastBooleanToNumber(val->boolval);
- break;
- case XPATH_USERS:
- case XPATH_POINT:
- case XPATH_RANGE:
- case XPATH_LOCATIONSET:
- TODO;
- ret = xmlXPathNAN;
- break;
- }
- return(ret);
-}
-
-/**
- * xmlXPathConvertNumber:
- * @val: an XPath object
- *
- * Converts an existing object to its number() equivalent
- *
- * Returns the new object, the old one is freed (or the operation
- * is done directly on @val)
- */
-xmlXPathObjectPtr
-xmlXPathConvertNumber(xmlXPathObjectPtr val) {
- xmlXPathObjectPtr ret;
-
- if (val == NULL)
- return(xmlXPathNewFloat(0.0));
- if (val->type == XPATH_NUMBER)
- return(val);
- ret = xmlXPathNewFloat(xmlXPathCastToNumber(val));
- xmlXPathFreeObject(val);
- return(ret);
-}
-
-/**
- * xmlXPathCastNumberToBoolean:
- * @val: a number
- *
- * Converts a number to its boolean value
- *
- * Returns the boolean value
- */
-int
-xmlXPathCastNumberToBoolean (double val) {
- if (xmlXPathIsNaN(val) || (val == 0.0))
- return(0);
- return(1);
-}
-
-/**
- * xmlXPathCastStringToBoolean:
- * @val: a string
- *
- * Converts a string to its boolean value
- *
- * Returns the boolean value
- */
-int
-xmlXPathCastStringToBoolean (const xmlChar *val) {
- if ((val == NULL) || (xmlStrlen(val) == 0))
- return(0);
- return(1);
-}
-
-/**
- * xmlXPathCastNodeSetToBoolean:
- * @ns: a node-set
- *
- * Converts a node-set to its boolean value
- *
- * Returns the boolean value
- */
-int
-xmlXPathCastNodeSetToBoolean (xmlNodeSetPtr ns) {
- if ((ns == NULL) || (ns->nodeNr == 0))
- return(0);
- return(1);
-}
-
-/**
- * xmlXPathCastToBoolean:
- * @val: an XPath object
- *
- * Converts an XPath object to its boolean value
- *
- * Returns the boolean value
- */
-int
-xmlXPathCastToBoolean (xmlXPathObjectPtr val) {
- int ret = 0;
-
- if (val == NULL)
- return(0);
- switch (val->type) {
- case XPATH_UNDEFINED:
-#ifdef DEBUG_EXPR
- xmlGenericError(xmlGenericErrorContext, "BOOLEAN: undefined\n");
-#endif
- ret = 0;
- break;
- case XPATH_NODESET:
- case XPATH_XSLT_TREE:
- ret = xmlXPathCastNodeSetToBoolean(val->nodesetval);
- break;
- case XPATH_STRING:
- ret = xmlXPathCastStringToBoolean(val->stringval);
- break;
- case XPATH_NUMBER:
- ret = xmlXPathCastNumberToBoolean(val->floatval);
- break;
- case XPATH_BOOLEAN:
- ret = val->boolval;
- break;
- case XPATH_USERS:
- case XPATH_POINT:
- case XPATH_RANGE:
- case XPATH_LOCATIONSET:
- TODO;
- ret = 0;
- break;
- }
- return(ret);
-}
-
-
-/**
- * xmlXPathConvertBoolean:
- * @val: an XPath object
- *
- * Converts an existing object to its boolean() equivalent
- *
- * Returns the new object, the old one is freed (or the operation
- * is done directly on @val)
- */
-xmlXPathObjectPtr
-xmlXPathConvertBoolean(xmlXPathObjectPtr val) {
- xmlXPathObjectPtr ret;
-
- if (val == NULL)
- return(xmlXPathNewBoolean(0));
- if (val->type == XPATH_BOOLEAN)
- return(val);
- ret = xmlXPathNewBoolean(xmlXPathCastToBoolean(val));
- xmlXPathFreeObject(val);
- return(ret);
-}
-
-/************************************************************************
- * *
- * Routines to handle XPath contexts *
- * *
- ************************************************************************/
-
-/**
- * xmlXPathNewContext:
- * @doc: the XML document
- *
- * Create a new xmlXPathContext
- *
- * Returns the xmlXPathContext just allocated. The caller will need to free it.
- */
-xmlXPathContextPtr
-xmlXPathNewContext(xmlDocPtr doc) {
- xmlXPathContextPtr ret;
-
- ret = (xmlXPathContextPtr) xmlMalloc(sizeof(xmlXPathContext));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNewContext: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathContext));
- ret->doc = doc;
- ret->node = NULL;
-
- ret->varHash = NULL;
-
- ret->nb_types = 0;
- ret->max_types = 0;
- ret->types = NULL;
-
- ret->funcHash = xmlHashCreate(0);
-
- ret->nb_axis = 0;
- ret->max_axis = 0;
- ret->axis = NULL;
-
- ret->nsHash = NULL;
- ret->user = NULL;
-
- ret->contextSize = -1;
- ret->proximityPosition = -1;
-
- xmlXPathRegisterAllFunctions(ret);
-
- return(ret);
-}
-
-/**
- * xmlXPathFreeContext:
- * @ctxt: the context to free
- *
- * Free up an xmlXPathContext
- */
-void
-xmlXPathFreeContext(xmlXPathContextPtr ctxt) {
- xmlXPathRegisteredNsCleanup(ctxt);
- xmlXPathRegisteredFuncsCleanup(ctxt);
- xmlXPathRegisteredVariablesCleanup(ctxt);
- xmlFree(ctxt);
-}
-
-/************************************************************************
- * *
- * Routines to handle XPath parser contexts *
- * *
- ************************************************************************/
-
-#define CHECK_CTXT(ctxt) \
- if (ctxt == NULL) { \
- xmlGenericError(xmlGenericErrorContext, \
- "%s:%d Internal error: ctxt == NULL\n", \
- __FILE__, __LINE__); \
- } \
-
-
-#define CHECK_CONTEXT(ctxt) \
- if (ctxt == NULL) { \
- xmlGenericError(xmlGenericErrorContext, \
- "%s:%d Internal error: no context\n", \
- __FILE__, __LINE__); \
- } \
- else if (ctxt->doc == NULL) { \
- xmlGenericError(xmlGenericErrorContext, \
- "%s:%d Internal error: no document\n", \
- __FILE__, __LINE__); \
- } \
- else if (ctxt->doc->children == NULL) { \
- xmlGenericError(xmlGenericErrorContext, \
- "%s:%d Internal error: document without root\n", \
- __FILE__, __LINE__); \
- } \
-
-
-/**
- * xmlXPathNewParserContext:
- * @str: the XPath expression
- * @ctxt: the XPath context
- *
- * Create a new xmlXPathParserContext
- *
- * Returns the xmlXPathParserContext just allocated.
- */
-xmlXPathParserContextPtr
-xmlXPathNewParserContext(const xmlChar *str, xmlXPathContextPtr ctxt) {
- xmlXPathParserContextPtr ret;
-
- ret = (xmlXPathParserContextPtr) xmlMalloc(sizeof(xmlXPathParserContext));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathNewParserContext: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathParserContext));
- ret->cur = ret->base = str;
- ret->context = ctxt;
-
- ret->comp = xmlXPathNewCompExpr();
- if (ret->comp == NULL) {
- xmlFree(ret->valueTab);
- xmlFree(ret);
- return(NULL);
- }
-
- return(ret);
-}
-
-/**
- * xmlXPathCompParserContext:
- * @comp: the XPath compiled expression
- * @ctxt: the XPath context
- *
- * Create a new xmlXPathParserContext when processing a compiled expression
- *
- * Returns the xmlXPathParserContext just allocated.
- */
-static xmlXPathParserContextPtr
-xmlXPathCompParserContext(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctxt) {
- xmlXPathParserContextPtr ret;
-
- ret = (xmlXPathParserContextPtr) xmlMalloc(sizeof(xmlXPathParserContext));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathCompParserContext: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathParserContext));
-
- /* Allocate the value stack */
- ret->valueTab = (xmlXPathObjectPtr *)
- xmlMalloc(10 * sizeof(xmlXPathObjectPtr));
- if (ret->valueTab == NULL) {
- xmlFree(ret);
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathCompParserContext: out of memory\n");
- return(NULL);
- }
- ret->valueNr = 0;
- ret->valueMax = 10;
- ret->value = NULL;
-
- ret->context = ctxt;
- ret->comp = comp;
-
- return(ret);
-}
-
-/**
- * xmlXPathFreeParserContext:
- * @ctxt: the context to free
- *
- * Free up an xmlXPathParserContext
- */
-void
-xmlXPathFreeParserContext(xmlXPathParserContextPtr ctxt) {
- if (ctxt->valueTab != NULL) {
- xmlFree(ctxt->valueTab);
- }
- if (ctxt->comp)
- xmlXPathFreeCompExpr(ctxt->comp);
- xmlFree(ctxt);
-}
-
-/************************************************************************
- * *
- * The implicit core function library *
- * *
- ************************************************************************/
-
-/**
- * xmlXPathNodeValHash:
- * @node: a node pointer
- *
- * Function computing the beginning of the string value of the node,
- * used to speed up comparisons
- *
- * Returns an int usable as a hash
- */
-static unsigned int
-xmlXPathNodeValHash(xmlNodePtr node) {
- int len = 2;
- const xmlChar * string = NULL;
- xmlNodePtr tmp = NULL;
- unsigned int ret = 0;
-
- if (node == NULL)
- return(0);
-
-
- switch (node->type) {
- case XML_COMMENT_NODE:
- case XML_PI_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_TEXT_NODE:
- string = node->content;
- if (string == NULL)
- return(0);
- if (string[0] == 0)
- return(0);
- return(((unsigned int) string[0]) +
- (((unsigned int) string[1]) << 8));
- case XML_NAMESPACE_DECL:
- string = ((xmlNsPtr)node)->href;
- if (string == NULL)
- return(0);
- if (string[0] == 0)
- return(0);
- return(((unsigned int) string[0]) +
- (((unsigned int) string[1]) << 8));
- case XML_ATTRIBUTE_NODE:
- tmp = ((xmlAttrPtr) node)->children;
- break;
- case XML_ELEMENT_NODE:
- tmp = node->children;
- break;
- default:
- return(0);
- }
- while (tmp != NULL) {
- switch (tmp->type) {
- case XML_COMMENT_NODE:
- case XML_PI_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_TEXT_NODE:
- string = tmp->content;
- break;
- case XML_NAMESPACE_DECL:
- string = ((xmlNsPtr)tmp)->href;
- break;
- default:
- break;
- }
- if ((string != NULL) && (string[0] != 0)) {
- if (string[0] == 0)
- return(0);
- if (len == 1) {
- return(ret + (((unsigned int) string[0]) << 8));
- }
- if (string[1] == 0) {
- len = 1;
- ret = (unsigned int) string[0];
- } else {
- return(((unsigned int) string[0]) +
- (((unsigned int) string[1]) << 8));
- }
- }
- /*
- * Skip to next node
- */
- if ((tmp->children != NULL) && (tmp->type != XML_DTD_NODE)) {
- if (tmp->children->type != XML_ENTITY_DECL) {
- tmp = tmp->children;
- continue;
- }
- }
- if (tmp == node)
- break;
-
- if (tmp->next != NULL) {
- tmp = tmp->next;
- continue;
- }
-
- do {
- tmp = tmp->parent;
- if (tmp == NULL)
- break;
- if (tmp == node) {
- tmp = NULL;
- break;
- }
- if (tmp->next != NULL) {
- tmp = tmp->next;
- break;
- }
- } while (tmp != NULL);
- }
- return(ret);
-}
-
-/**
- * xmlXPathStringHash:
- * @string: a string
- *
- * Function computing the beginning of the string value of the node,
- * used to speed up comparisons
- *
- * Returns an int usable as a hash
- */
-static unsigned int
-xmlXPathStringHash(const xmlChar * string) {
- if (string == NULL)
- return((unsigned int) 0);
- if (string[0] == 0)
- return(0);
- return(((unsigned int) string[0]) +
- (((unsigned int) string[1]) << 8));
-}
-
-/**
- * xmlXPathCompareNodeSetFloat:
- * @ctxt: the XPath Parser context
- * @inf: less than (1) or greater than (0)
- * @strict: is the comparison strict
- * @arg: the node set
- * @f: the value
- *
- * Implement the compare operation between a nodeset and a number
- * @ns < @val (1, 1, ...
- * @ns <= @val (1, 0, ...
- * @ns > @val (0, 1, ...
- * @ns >= @val (0, 0, ...
- *
- * If one object to be compared is a node-set and the other is a number,
- * then the comparison will be true if and only if there is a node in the
- * node-set such that the result of performing the comparison on the number
- * to be compared and on the result of converting the string-value of that
- * node to a number using the number function is true.
- *
- * Returns 0 or 1 depending on the results of the test.
- */
-static int
-xmlXPathCompareNodeSetFloat(xmlXPathParserContextPtr ctxt, int inf, int strict,
- xmlXPathObjectPtr arg, xmlXPathObjectPtr f) {
- int i, ret = 0;
- xmlNodeSetPtr ns;
- xmlChar *str2;
-
- if ((f == NULL) || (arg == NULL) ||
- ((arg->type != XPATH_NODESET) && (arg->type != XPATH_XSLT_TREE))) {
- xmlXPathFreeObject(arg);
- xmlXPathFreeObject(f);
- return(0);
- }
- ns = arg->nodesetval;
- if (ns != NULL) {
- for (i = 0;i < ns->nodeNr;i++) {
- str2 = xmlXPathCastNodeToString(ns->nodeTab[i]);
- if (str2 != NULL) {
- valuePush(ctxt,
- xmlXPathNewString(str2));
- xmlFree(str2);
- xmlXPathNumberFunction(ctxt, 1);
- valuePush(ctxt, xmlXPathObjectCopy(f));
- ret = xmlXPathCompareValues(ctxt, inf, strict);
- if (ret)
- break;
- }
- }
- }
- xmlXPathFreeObject(arg);
- xmlXPathFreeObject(f);
- return(ret);
-}
-
-/**
- * xmlXPathCompareNodeSetString:
- * @ctxt: the XPath Parser context
- * @inf: less than (1) or greater than (0)
- * @strict: is the comparison strict
- * @arg: the node set
- * @s: the value
- *
- * Implement the compare operation between a nodeset and a string
- * @ns < @val (1, 1, ...
- * @ns <= @val (1, 0, ...
- * @ns > @val (0, 1, ...
- * @ns >= @val (0, 0, ...
- *
- * If one object to be compared is a node-set and the other is a string,
- * then the comparison will be true if and only if there is a node in
- * the node-set such that the result of performing the comparison on the
- * string-value of the node and the other string is true.
- *
- * Returns 0 or 1 depending on the results of the test.
- */
-static int
-xmlXPathCompareNodeSetString(xmlXPathParserContextPtr ctxt, int inf, int strict,
- xmlXPathObjectPtr arg, xmlXPathObjectPtr s) {
- int i, ret = 0;
- xmlNodeSetPtr ns;
- xmlChar *str2;
-
- if ((s == NULL) || (arg == NULL) ||
- ((arg->type != XPATH_NODESET) && (arg->type != XPATH_XSLT_TREE))) {
- xmlXPathFreeObject(arg);
- xmlXPathFreeObject(s);
- return(0);
- }
- ns = arg->nodesetval;
- if (ns != NULL) {
- for (i = 0;i < ns->nodeNr;i++) {
- str2 = xmlXPathCastNodeToString(ns->nodeTab[i]);
- if (str2 != NULL) {
- valuePush(ctxt,
- xmlXPathNewString(str2));
- xmlFree(str2);
- valuePush(ctxt, xmlXPathObjectCopy(s));
- ret = xmlXPathCompareValues(ctxt, inf, strict);
- if (ret)
- break;
- }
- }
- }
- xmlXPathFreeObject(arg);
- xmlXPathFreeObject(s);
- return(ret);
-}
-
-/**
- * xmlXPathCompareNodeSets:
- * @inf: less than (1) or greater than (0)
- * @strict: is the comparison strict
- * @arg1: the first node set object
- * @arg2: the second node set object
- *
- * Implement the compare operation on nodesets:
- *
- * If both objects to be compared are node-sets, then the comparison
- * will be true if and only if there is a node in the first node-set
- * and a node in the second node-set such that the result of performing
- * the comparison on the string-values of the two nodes is true.
- * ....
- * When neither object to be compared is a node-set and the operator
- * is <=, <, >= or >, then the objects are compared by converting both
- * objects to numbers and comparing the numbers according to IEEE 754.
- * ....
- * The number function converts its argument to a number as follows:
- * - a string that consists of optional whitespace followed by an
- * optional minus sign followed by a Number followed by whitespace
- * is converted to the IEEE 754 number that is nearest (according
- * to the IEEE 754 round-to-nearest rule) to the mathematical value
- * represented by the string; any other string is converted to NaN
- *
- * Conclusion all nodes need to be converted first to their string value
- * and then the comparison must be done when possible
- */
-static int
-xmlXPathCompareNodeSets(int inf, int strict,
- xmlXPathObjectPtr arg1, xmlXPathObjectPtr arg2) {
- int i, j, init = 0;
- double val1;
- double *values2;
- int ret = 0;
- xmlNodeSetPtr ns1;
- xmlNodeSetPtr ns2;
-
- if ((arg1 == NULL) ||
- ((arg1->type != XPATH_NODESET) && (arg1->type != XPATH_XSLT_TREE))) {
- xmlXPathFreeObject(arg2);
- return(0);
- }
- if ((arg2 == NULL) ||
- ((arg2->type != XPATH_NODESET) && (arg2->type != XPATH_XSLT_TREE))) {
- xmlXPathFreeObject(arg1);
- xmlXPathFreeObject(arg2);
- return(0);
- }
-
- ns1 = arg1->nodesetval;
- ns2 = arg2->nodesetval;
-
- if ((ns1 == NULL) || (ns1->nodeNr <= 0)) {
- xmlXPathFreeObject(arg1);
- xmlXPathFreeObject(arg2);
- return(0);
- }
- if ((ns2 == NULL) || (ns2->nodeNr <= 0)) {
- xmlXPathFreeObject(arg1);
- xmlXPathFreeObject(arg2);
- return(0);
- }
-
- values2 = (double *) xmlMalloc(ns2->nodeNr * sizeof(double));
- if (values2 == NULL) {
- xmlXPathFreeObject(arg1);
- xmlXPathFreeObject(arg2);
- return(0);
- }
- for (i = 0;i < ns1->nodeNr;i++) {
- val1 = xmlXPathCastNodeToNumber(ns1->nodeTab[i]);
- if (xmlXPathIsNaN(val1))
- continue;
- for (j = 0;j < ns2->nodeNr;j++) {
- if (init == 0) {
- values2[j] = xmlXPathCastNodeToNumber(ns2->nodeTab[j]);
- }
- if (xmlXPathIsNaN(values2[j]))
- continue;
- if (inf && strict)
- ret = (val1 < values2[j]);
- else if (inf && !strict)
- ret = (val1 <= values2[j]);
- else if (!inf && strict)
- ret = (val1 > values2[j]);
- else if (!inf && !strict)
- ret = (val1 >= values2[j]);
- if (ret)
- break;
- }
- if (ret)
- break;
- init = 1;
- }
- xmlFree(values2);
- xmlXPathFreeObject(arg1);
- xmlXPathFreeObject(arg2);
- return(ret);
-}
-
-/**
- * xmlXPathCompareNodeSetValue:
- * @ctxt: the XPath Parser context
- * @inf: less than (1) or greater than (0)
- * @strict: is the comparison strict
- * @arg: the node set
- * @val: the value
- *
- * Implement the compare operation between a nodeset and a value
- * @ns < @val (1, 1, ...
- * @ns <= @val (1, 0, ...
- * @ns > @val (0, 1, ...
- * @ns >= @val (0, 0, ...
- *
- * If one object to be compared is a node-set and the other is a boolean,
- * then the comparison will be true if and only if the result of performing
- * the comparison on the boolean and on the result of converting
- * the node-set to a boolean using the boolean function is true.
- *
- * Returns 0 or 1 depending on the results of the test.
- */
-static int
-xmlXPathCompareNodeSetValue(xmlXPathParserContextPtr ctxt, int inf, int strict,
- xmlXPathObjectPtr arg, xmlXPathObjectPtr val) {
- if ((val == NULL) || (arg == NULL) ||
- ((arg->type != XPATH_NODESET) && (arg->type != XPATH_XSLT_TREE)))
- return(0);
-
- switch(val->type) {
- case XPATH_NUMBER:
- return(xmlXPathCompareNodeSetFloat(ctxt, inf, strict, arg, val));
- case XPATH_NODESET:
- case XPATH_XSLT_TREE:
- return(xmlXPathCompareNodeSets(inf, strict, arg, val));
- case XPATH_STRING:
- return(xmlXPathCompareNodeSetString(ctxt, inf, strict, arg, val));
- case XPATH_BOOLEAN:
- valuePush(ctxt, arg);
- xmlXPathBooleanFunction(ctxt, 1);
- valuePush(ctxt, val);
- return(xmlXPathCompareValues(ctxt, inf, strict));
- default:
- TODO
- }
- return(0);
-}
-
-/**
- * xmlXPathEqualNodeSetString:
- * @arg: the nodeset object argument
- * @str: the string to compare to.
- * @neq: flag to show whether for '=' (0) or '!=' (1)
- *
- * Implement the equal operation on XPath objects content: @arg1 == @arg2
- * If one object to be compared is a node-set and the other is a string,
- * then the comparison will be true if and only if there is a node in
- * the node-set such that the result of performing the comparison on the
- * string-value of the node and the other string is true.
- *
- * Returns 0 or 1 depending on the results of the test.
- */
-static int
-xmlXPathEqualNodeSetString(xmlXPathObjectPtr arg, const xmlChar * str, int neq)
-{
- int i;
- xmlNodeSetPtr ns;
- xmlChar *str2;
- unsigned int hash;
-
- if ((str == NULL) || (arg == NULL) ||
- ((arg->type != XPATH_NODESET) && (arg->type != XPATH_XSLT_TREE)))
- return (0);
- ns = arg->nodesetval;
- hash = xmlXPathStringHash(str);
- if (ns == NULL)
- return (0);
- if (ns->nodeNr <= 0) {
- if (hash == 0)
- return(neq ^ 1);
- return(neq);
- }
- for (i = 0; i < ns->nodeNr; i++) {
- if (xmlXPathNodeValHash(ns->nodeTab[i]) == hash) {
- str2 = xmlNodeGetContent(ns->nodeTab[i]);
- if ((str2 != NULL) && (xmlStrEqual(str, str2))) {
- xmlFree(str2);
- if (neq)
- continue;
- return (1);
- } else if (neq) {
- if (str2 != NULL)
- xmlFree(str2);
- return (1);
- }
- if (str2 != NULL)
- xmlFree(str2);
- } else if (neq)
- return (1);
- }
- return (0);
-}
-
-/**
- * xmlXPathEqualNodeSetFloat:
- * @arg: the nodeset object argument
- * @f: the float to compare to
- * @neq: flag to show whether to compare '=' (0) or '!=' (1)
- *
- * Implement the equal operation on XPath objects content: @arg1 == @arg2
- * If one object to be compared is a node-set and the other is a number,
- * then the comparison will be true if and only if there is a node in
- * the node-set such that the result of performing the comparison on the
- * number to be compared and on the result of converting the string-value
- * of that node to a number using the number function is true.
- *
- * Returns 0 or 1 depending on the results of the test.
- */
-static int
-xmlXPathEqualNodeSetFloat(xmlXPathParserContextPtr ctxt,
- xmlXPathObjectPtr arg, double f, int neq) {
- int i, ret=0;
- xmlNodeSetPtr ns;
- xmlChar *str2;
- xmlXPathObjectPtr val;
- double v;
-
- if ((arg == NULL) ||
- ((arg->type != XPATH_NODESET) && (arg->type != XPATH_XSLT_TREE)))
- return(0);
-
- ns = arg->nodesetval;
- if (ns != NULL) {
- for (i=0;i<ns->nodeNr;i++) {
- str2 = xmlXPathCastNodeToString(ns->nodeTab[i]);
- if (str2 != NULL) {
- valuePush(ctxt, xmlXPathNewString(str2));
- xmlFree(str2);
- xmlXPathNumberFunction(ctxt, 1);
- val = valuePop(ctxt);
- v = val->floatval;
- xmlXPathFreeObject(val);
- if (!xmlXPathIsNaN(v)) {
- if ((!neq) && (v==f)) {
- ret = 1;
- break;
- } else if ((neq) && (v!=f)) {
- ret = 1;
- break;
- }
- }
- }
- }
- }
-
- return(ret);
-}
-
-
-/**
- * xmlXPathEqualNodeSets:
- * @arg1: first nodeset object argument
- * @arg2: second nodeset object argument
- * @neq: flag to show whether to test '=' (0) or '!=' (1)
- *
- * Implement the equal / not equal operation on XPath nodesets:
- * @arg1 == @arg2 or @arg1 != @arg2
- * If both objects to be compared are node-sets, then the comparison
- * will be true if and only if there is a node in the first node-set and
- * a node in the second node-set such that the result of performing the
- * comparison on the string-values of the two nodes is true.
- *
- * (needless to say, this is a costly operation)
- *
- * Returns 0 or 1 depending on the results of the test.
- */
-static int
-xmlXPathEqualNodeSets(xmlXPathObjectPtr arg1, xmlXPathObjectPtr arg2, int neq) {
- int i, j;
- unsigned int *hashs1;
- unsigned int *hashs2;
- xmlChar **values1;
- xmlChar **values2;
- int ret = 0;
- xmlNodeSetPtr ns1;
- xmlNodeSetPtr ns2;
-
- if ((arg1 == NULL) ||
- ((arg1->type != XPATH_NODESET) && (arg1->type != XPATH_XSLT_TREE)))
- return(0);
- if ((arg2 == NULL) ||
- ((arg2->type != XPATH_NODESET) && (arg2->type != XPATH_XSLT_TREE)))
- return(0);
-
- ns1 = arg1->nodesetval;
- ns2 = arg2->nodesetval;
-
- if ((ns1 == NULL) || (ns1->nodeNr <= 0))
- return(0);
- if ((ns2 == NULL) || (ns2->nodeNr <= 0))
- return(0);
-
- /*
- * for equal, check if there is a node pertaining to both sets
- */
- if (neq == 0)
- for (i = 0;i < ns1->nodeNr;i++)
- for (j = 0;j < ns2->nodeNr;j++)
- if (ns1->nodeTab[i] == ns2->nodeTab[j])
- return(1);
-
- values1 = (xmlChar **) xmlMalloc(ns1->nodeNr * sizeof(xmlChar *));
- if (values1 == NULL)
- return(0);
- hashs1 = (unsigned int *) xmlMalloc(ns1->nodeNr * sizeof(unsigned int));
- if (hashs1 == NULL) {
- xmlFree(values1);
- return(0);
- }
- memset(values1, 0, ns1->nodeNr * sizeof(xmlChar *));
- values2 = (xmlChar **) xmlMalloc(ns2->nodeNr * sizeof(xmlChar *));
- if (values2 == NULL) {
- xmlFree(hashs1);
- xmlFree(values1);
- return(0);
- }
- hashs2 = (unsigned int *) xmlMalloc(ns2->nodeNr * sizeof(unsigned int));
- if (hashs2 == NULL) {
- xmlFree(hashs1);
- xmlFree(values1);
- xmlFree(values2);
- return(0);
- }
- memset(values2, 0, ns2->nodeNr * sizeof(xmlChar *));
- for (i = 0;i < ns1->nodeNr;i++) {
- hashs1[i] = xmlXPathNodeValHash(ns1->nodeTab[i]);
- for (j = 0;j < ns2->nodeNr;j++) {
- if (i == 0)
- hashs2[j] = xmlXPathNodeValHash(ns2->nodeTab[j]);
- if (hashs1[i] != hashs2[j]) {
- if (neq) {
- ret = 1;
- break;
- }
- }
- else {
- if (values1[i] == NULL)
- values1[i] = xmlNodeGetContent(ns1->nodeTab[i]);
- if (values2[j] == NULL)
- values2[j] = xmlNodeGetContent(ns2->nodeTab[j]);
- ret = xmlStrEqual(values1[i], values2[j]) ^ neq;
- if (ret)
- break;
- }
- }
- if (ret)
- break;
- }
- for (i = 0;i < ns1->nodeNr;i++)
- if (values1[i] != NULL)
- xmlFree(values1[i]);
- for (j = 0;j < ns2->nodeNr;j++)
- if (values2[j] != NULL)
- xmlFree(values2[j]);
- xmlFree(values1);
- xmlFree(values2);
- xmlFree(hashs1);
- xmlFree(hashs2);
- return(ret);
-}
-
-static int
-xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt,
- xmlXPathObjectPtr arg1, xmlXPathObjectPtr arg2) {
- int ret = 0;
- /*
- *At this point we are assured neither arg1 nor arg2
- *is a nodeset, so we can just pick the appropriate routine.
- */
- switch (arg1->type) {
- case XPATH_UNDEFINED:
-#ifdef DEBUG_EXPR
- xmlGenericError(xmlGenericErrorContext,
- "Equal: undefined\n");
-#endif
- break;
- case XPATH_BOOLEAN:
- switch (arg2->type) {
- case XPATH_UNDEFINED:
-#ifdef DEBUG_EXPR
- xmlGenericError(xmlGenericErrorContext,
- "Equal: undefined\n");
-#endif
- break;
- case XPATH_BOOLEAN:
-#ifdef DEBUG_EXPR
- xmlGenericError(xmlGenericErrorContext,
- "Equal: %d boolean %d \n",
- arg1->boolval, arg2->boolval);
-#endif
- ret = (arg1->boolval == arg2->boolval);
- break;
- case XPATH_NUMBER:
- ret = (arg1->boolval ==
- xmlXPathCastNumberToBoolean(arg2->floatval));
- break;
- case XPATH_STRING:
- if ((arg2->stringval == NULL) ||
- (arg2->stringval[0] == 0)) ret = 0;
- else
- ret = 1;
- ret = (arg1->boolval == ret);
- break;
- case XPATH_USERS:
- case XPATH_POINT:
- case XPATH_RANGE:
- case XPATH_LOCATIONSET:
- TODO
- break;
- case XPATH_NODESET:
- case XPATH_XSLT_TREE:
- break;
- }
- break;
- case XPATH_NUMBER:
- switch (arg2->type) {
- case XPATH_UNDEFINED:
-#ifdef DEBUG_EXPR
- xmlGenericError(xmlGenericErrorContext,
- "Equal: undefined\n");
-#endif
- break;
- case XPATH_BOOLEAN:
- ret = (arg2->boolval==
- xmlXPathCastNumberToBoolean(arg1->floatval));
- break;
- case XPATH_STRING:
- valuePush(ctxt, arg2);
- xmlXPathNumberFunction(ctxt, 1);
- arg2 = valuePop(ctxt);
- /* no break on purpose */
- case XPATH_NUMBER:
- /* Hand check NaN and Infinity equalities */
- if (xmlXPathIsNaN(arg1->floatval) || xmlXPathIsNaN(arg2->floatval)) {
- ret = 0;
- } else if (xmlXPathIsInf(arg1->floatval) == 1) {
- if (xmlXPathIsInf(arg2->floatval) == 1)
- ret = 1;
- else
- ret = 0;
- } else if (xmlXPathIsInf(arg1->floatval) == -1) {
- if (xmlXPathIsInf(arg2->floatval) == -1)
- ret = 1;
- else
- ret = 0;
- } else if (xmlXPathIsInf(arg2->floatval) == 1) {
- if (xmlXPathIsInf(arg1->floatval) == 1)
- ret = 1;
- else
- ret = 0;
- } else if (xmlXPathIsInf(arg2->floatval) == -1) {
- if (xmlXPathIsInf(arg1->floatval) == -1)
- ret = 1;
- else
- ret = 0;
- } else {
- ret = (arg1->floatval == arg2->floatval);
- }
- break;
- case XPATH_USERS:
- case XPATH_POINT:
- case XPATH_RANGE:
- case XPATH_LOCATIONSET:
- TODO
- break;
- case XPATH_NODESET:
- case XPATH_XSLT_TREE:
- break;
- }
- break;
- case XPATH_STRING:
- switch (arg2->type) {
- case XPATH_UNDEFINED:
-#ifdef DEBUG_EXPR
- xmlGenericError(xmlGenericErrorContext,
- "Equal: undefined\n");
-#endif
- break;
- case XPATH_BOOLEAN:
- if ((arg1->stringval == NULL) ||
- (arg1->stringval[0] == 0)) ret = 0;
- else
- ret = 1;
- ret = (arg2->boolval == ret);
- break;
- case XPATH_STRING:
- ret = xmlStrEqual(arg1->stringval, arg2->stringval);
- break;
- case XPATH_NUMBER:
- valuePush(ctxt, arg1);
- xmlXPathNumberFunction(ctxt, 1);
- arg1 = valuePop(ctxt);
- /* Hand check NaN and Infinity equalities */
- if (xmlXPathIsNaN(arg1->floatval) || xmlXPathIsNaN(arg2->floatval)) {
- ret = 0;
- } else if (xmlXPathIsInf(arg1->floatval) == 1) {
- if (xmlXPathIsInf(arg2->floatval) == 1)
- ret = 1;
- else
- ret = 0;
- } else if (xmlXPathIsInf(arg1->floatval) == -1) {
- if (xmlXPathIsInf(arg2->floatval) == -1)
- ret = 1;
- else
- ret = 0;
- } else if (xmlXPathIsInf(arg2->floatval) == 1) {
- if (xmlXPathIsInf(arg1->floatval) == 1)
- ret = 1;
- else
- ret = 0;
- } else if (xmlXPathIsInf(arg2->floatval) == -1) {
- if (xmlXPathIsInf(arg1->floatval) == -1)
- ret = 1;
- else
- ret = 0;
- } else {
- ret = (arg1->floatval == arg2->floatval);
- }
- break;
- case XPATH_USERS:
- case XPATH_POINT:
- case XPATH_RANGE:
- case XPATH_LOCATIONSET:
- TODO
- break;
- case XPATH_NODESET:
- case XPATH_XSLT_TREE:
- break;
- }
- break;
- case XPATH_USERS:
- case XPATH_POINT:
- case XPATH_RANGE:
- case XPATH_LOCATIONSET:
- TODO
- break;
- case XPATH_NODESET:
- case XPATH_XSLT_TREE:
- break;
- }
- xmlXPathFreeObject(arg1);
- xmlXPathFreeObject(arg2);
- return(ret);
-}
-
-/**
- * xmlXPathEqualValues:
- * @ctxt: the XPath Parser context
- *
- * Implement the equal operation on XPath objects content: @arg1 == @arg2
- *
- * Returns 0 or 1 depending on the results of the test.
- */
-int
-xmlXPathEqualValues(xmlXPathParserContextPtr ctxt) {
- xmlXPathObjectPtr arg1, arg2, argtmp;
- int ret = 0;
-
- arg2 = valuePop(ctxt);
- arg1 = valuePop(ctxt);
- if ((arg1 == NULL) || (arg2 == NULL)) {
- if (arg1 != NULL)
- xmlXPathFreeObject(arg1);
- else
- xmlXPathFreeObject(arg2);
- XP_ERROR0(XPATH_INVALID_OPERAND);
- }
-
- if (arg1 == arg2) {
-#ifdef DEBUG_EXPR
- xmlGenericError(xmlGenericErrorContext,
- "Equal: by pointer\n");
-#endif
- return(1);
- }
-
- /*
- *If either argument is a nodeset, it's a 'special case'
- */
- if ((arg2->type == XPATH_NODESET) || (arg2->type == XPATH_XSLT_TREE) ||
- (arg1->type == XPATH_NODESET) || (arg1->type == XPATH_XSLT_TREE)) {
- /*
- *Hack it to assure arg1 is the nodeset
- */
- if ((arg1->type != XPATH_NODESET) && (arg1->type != XPATH_XSLT_TREE)) {
- argtmp = arg2;
- arg2 = arg1;
- arg1 = argtmp;
- }
- switch (arg2->type) {
- case XPATH_UNDEFINED:
-#ifdef DEBUG_EXPR
- xmlGenericError(xmlGenericErrorContext,
- "Equal: undefined\n");
-#endif
- break;
- case XPATH_NODESET:
- case XPATH_XSLT_TREE:
- ret = xmlXPathEqualNodeSets(arg1, arg2, 0);
- break;
- case XPATH_BOOLEAN:
- if ((arg1->nodesetval == NULL) ||
- (arg1->nodesetval->nodeNr == 0)) ret = 0;
- else
- ret = 1;
- ret = (ret == arg2->boolval);
- break;
- case XPATH_NUMBER:
- ret = xmlXPathEqualNodeSetFloat(ctxt, arg1, arg2->floatval, 0);
- break;
- case XPATH_STRING:
- ret = xmlXPathEqualNodeSetString(arg1, arg2->stringval, 0);
- break;
- case XPATH_USERS:
- case XPATH_POINT:
- case XPATH_RANGE:
- case XPATH_LOCATIONSET:
- TODO
- break;
- }
- xmlXPathFreeObject(arg1);
- xmlXPathFreeObject(arg2);
- return(ret);
- }
-
- return (xmlXPathEqualValuesCommon(ctxt, arg1, arg2));
-}
-
-/**
- * xmlXPathNotEqualValues:
- * @ctxt: the XPath Parser context
- *
- * Implement the equal operation on XPath objects content: @arg1 == @arg2
- *
- * Returns 0 or 1 depending on the results of the test.
- */
-int
-xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt) {
- xmlXPathObjectPtr arg1, arg2, argtmp;
- int ret = 0;
-
- arg2 = valuePop(ctxt);
- arg1 = valuePop(ctxt);
- if ((arg1 == NULL) || (arg2 == NULL)) {
- if (arg1 != NULL)
- xmlXPathFreeObject(arg1);
- else
- xmlXPathFreeObject(arg2);
- XP_ERROR0(XPATH_INVALID_OPERAND);
- }
-
- if (arg1 == arg2) {
-#ifdef DEBUG_EXPR
- xmlGenericError(xmlGenericErrorContext,
- "NotEqual: by pointer\n");
-#endif
- return(0);
- }
-
- /*
- *If either argument is a nodeset, it's a 'special case'
- */
- if ((arg2->type == XPATH_NODESET) || (arg2->type == XPATH_XSLT_TREE) ||
- (arg1->type == XPATH_NODESET) || (arg1->type == XPATH_XSLT_TREE)) {
- /*
- *Hack it to assure arg1 is the nodeset
- */
- if ((arg1->type != XPATH_NODESET) && (arg1->type != XPATH_XSLT_TREE)) {
- argtmp = arg2;
- arg2 = arg1;
- arg1 = argtmp;
- }
- switch (arg2->type) {
- case XPATH_UNDEFINED:
-#ifdef DEBUG_EXPR
- xmlGenericError(xmlGenericErrorContext,
- "NotEqual: undefined\n");
-#endif
- break;
- case XPATH_NODESET:
- case XPATH_XSLT_TREE:
- ret = xmlXPathEqualNodeSets(arg1, arg2, 1);
- break;
- case XPATH_BOOLEAN:
- if ((arg1->nodesetval == NULL) ||
- (arg1->nodesetval->nodeNr == 0)) ret = 0;
- else
- ret = 1;
- ret = (ret != arg2->boolval);
- break;
- case XPATH_NUMBER:
- ret = xmlXPathEqualNodeSetFloat(ctxt, arg1, arg2->floatval, 1);
- break;
- case XPATH_STRING:
- ret = xmlXPathEqualNodeSetString(arg1, arg2->stringval,1);
- break;
- case XPATH_USERS:
- case XPATH_POINT:
- case XPATH_RANGE:
- case XPATH_LOCATIONSET:
- TODO
- break;
- }
- xmlXPathFreeObject(arg1);
- xmlXPathFreeObject(arg2);
- return(ret);
- }
-
- return (!xmlXPathEqualValuesCommon(ctxt, arg1, arg2));
-}
-
-/**
- * xmlXPathCompareValues:
- * @ctxt: the XPath Parser context
- * @inf: less than (1) or greater than (0)
- * @strict: is the comparison strict
- *
- * Implement the compare operation on XPath objects:
- * @arg1 < @arg2 (1, 1, ...
- * @arg1 <= @arg2 (1, 0, ...
- * @arg1 > @arg2 (0, 1, ...
- * @arg1 >= @arg2 (0, 0, ...
- *
- * When neither object to be compared is a node-set and the operator is
- * <=, <, >=, >, then the objects are compared by converted both objects
- * to numbers and comparing the numbers according to IEEE 754. The <
- * comparison will be true if and only if the first number is less than the
- * second number. The <= comparison will be true if and only if the first
- * number is less than or equal to the second number. The > comparison
- * will be true if and only if the first number is greater than the second
- * number. The >= comparison will be true if and only if the first number
- * is greater than or equal to the second number.
- *
- * Returns 1 if the comparison succeeded, 0 if it failed
- */
-int
-xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict) {
- int ret = 0, arg1i = 0, arg2i = 0;
- xmlXPathObjectPtr arg1, arg2;
-
- arg2 = valuePop(ctxt);
- arg1 = valuePop(ctxt);
- if ((arg1 == NULL) || (arg2 == NULL)) {
- if (arg1 != NULL)
- xmlXPathFreeObject(arg1);
- else
- xmlXPathFreeObject(arg2);
- XP_ERROR0(XPATH_INVALID_OPERAND);
- }
-
- if ((arg2->type == XPATH_NODESET) || (arg2->type == XPATH_XSLT_TREE) ||
- (arg1->type == XPATH_NODESET) || (arg1->type == XPATH_XSLT_TREE)) {
- if (((arg2->type == XPATH_NODESET) || (arg2->type == XPATH_XSLT_TREE)) &&
- ((arg1->type == XPATH_NODESET) || (arg1->type == XPATH_XSLT_TREE))){
- ret = xmlXPathCompareNodeSets(inf, strict, arg1, arg2);
- } else {
- if ((arg1->type == XPATH_NODESET) || (arg1->type == XPATH_XSLT_TREE)) {
- ret = xmlXPathCompareNodeSetValue(ctxt, inf, strict,
- arg1, arg2);
- } else {
- ret = xmlXPathCompareNodeSetValue(ctxt, !inf, strict,
- arg2, arg1);
- }
- }
- return(ret);
- }
-
- if (arg1->type != XPATH_NUMBER) {
- valuePush(ctxt, arg1);
- xmlXPathNumberFunction(ctxt, 1);
- arg1 = valuePop(ctxt);
- }
- if (arg1->type != XPATH_NUMBER) {
- xmlXPathFreeObject(arg1);
- xmlXPathFreeObject(arg2);
- XP_ERROR0(XPATH_INVALID_OPERAND);
- }
- if (arg2->type != XPATH_NUMBER) {
- valuePush(ctxt, arg2);
- xmlXPathNumberFunction(ctxt, 1);
- arg2 = valuePop(ctxt);
- }
- if (arg2->type != XPATH_NUMBER) {
- xmlXPathFreeObject(arg1);
- xmlXPathFreeObject(arg2);
- XP_ERROR0(XPATH_INVALID_OPERAND);
- }
- /*
- * Add tests for infinity and nan
- * => feedback on 3.4 for Inf and NaN
- */
- /* Hand check NaN and Infinity comparisons */
- if (xmlXPathIsNaN(arg1->floatval) || xmlXPathIsNaN(arg2->floatval)) {
- ret=0;
- } else {
- arg1i=xmlXPathIsInf(arg1->floatval);
- arg2i=xmlXPathIsInf(arg2->floatval);
- if (inf && strict) {
- if ((arg1i == -1 && arg2i != -1) ||
- (arg2i == 1 && arg1i != 1)) {
- ret = 1;
- } else if (arg1i == 0 && arg2i == 0) {
- ret = (arg1->floatval < arg2->floatval);
- } else {
- ret = 0;
- }
- }
- else if (inf && !strict) {
- if (arg1i == -1 || arg2i == 1) {
- ret = 1;
- } else if (arg1i == 0 && arg2i == 0) {
- ret = (arg1->floatval <= arg2->floatval);
- } else {
- ret = 0;
- }
- }
- else if (!inf && strict) {
- if ((arg1i == 1 && arg2i != 1) ||
- (arg2i == -1 && arg1i != -1)) {
- ret = 1;
- } else if (arg1i == 0 && arg2i == 0) {
- ret = (arg1->floatval > arg2->floatval);
- } else {
- ret = 0;
- }
- }
- else if (!inf && !strict) {
- if (arg1i == 1 || arg2i == -1) {
- ret = 1;
- } else if (arg1i == 0 && arg2i == 0) {
- ret = (arg1->floatval >= arg2->floatval);
- } else {
- ret = 0;
- }
- }
- }
- xmlXPathFreeObject(arg1);
- xmlXPathFreeObject(arg2);
- return(ret);
-}
-
-/**
- * xmlXPathValueFlipSign:
- * @ctxt: the XPath Parser context
- *
- * Implement the unary - operation on an XPath object
- * The numeric operators convert their operands to numbers as if
- * by calling the number function.
- */
-void
-xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt) {
- CAST_TO_NUMBER;
- CHECK_TYPE(XPATH_NUMBER);
- if (xmlXPathIsNaN(ctxt->value->floatval))
- ctxt->value->floatval=xmlXPathNAN;
- else if (xmlXPathIsInf(ctxt->value->floatval) == 1)
- ctxt->value->floatval=xmlXPathNINF;
- else if (xmlXPathIsInf(ctxt->value->floatval) == -1)
- ctxt->value->floatval=xmlXPathPINF;
- else if (ctxt->value->floatval == 0) {
- if (xmlXPathGetSign(ctxt->value->floatval) == 0)
- ctxt->value->floatval = xmlXPathNZERO;
- else
- ctxt->value->floatval = 0;
- }
- else
- ctxt->value->floatval = - ctxt->value->floatval;
-}
-
-/**
- * xmlXPathAddValues:
- * @ctxt: the XPath Parser context
- *
- * Implement the add operation on XPath objects:
- * The numeric operators convert their operands to numbers as if
- * by calling the number function.
- */
-void
-xmlXPathAddValues(xmlXPathParserContextPtr ctxt) {
- xmlXPathObjectPtr arg;
- double val;
-
- arg = valuePop(ctxt);
- if (arg == NULL)
- XP_ERROR(XPATH_INVALID_OPERAND);
- val = xmlXPathCastToNumber(arg);
- xmlXPathFreeObject(arg);
-
- CAST_TO_NUMBER;
- CHECK_TYPE(XPATH_NUMBER);
- ctxt->value->floatval += val;
-}
-
-/**
- * xmlXPathSubValues:
- * @ctxt: the XPath Parser context
- *
- * Implement the subtraction operation on XPath objects:
- * The numeric operators convert their operands to numbers as if
- * by calling the number function.
- */
-void
-xmlXPathSubValues(xmlXPathParserContextPtr ctxt) {
- xmlXPathObjectPtr arg;
- double val;
-
- arg = valuePop(ctxt);
- if (arg == NULL)
- XP_ERROR(XPATH_INVALID_OPERAND);
- val = xmlXPathCastToNumber(arg);
- xmlXPathFreeObject(arg);
-
- CAST_TO_NUMBER;
- CHECK_TYPE(XPATH_NUMBER);
- ctxt->value->floatval -= val;
-}
-
-/**
- * xmlXPathMultValues:
- * @ctxt: the XPath Parser context
- *
- * Implement the multiply operation on XPath objects:
- * The numeric operators convert their operands to numbers as if
- * by calling the number function.
- */
-void
-xmlXPathMultValues(xmlXPathParserContextPtr ctxt) {
- xmlXPathObjectPtr arg;
- double val;
-
- arg = valuePop(ctxt);
- if (arg == NULL)
- XP_ERROR(XPATH_INVALID_OPERAND);
- val = xmlXPathCastToNumber(arg);
- xmlXPathFreeObject(arg);
-
- CAST_TO_NUMBER;
- CHECK_TYPE(XPATH_NUMBER);
- ctxt->value->floatval *= val;
-}
-
-/**
- * xmlXPathDivValues:
- * @ctxt: the XPath Parser context
- *
- * Implement the div operation on XPath objects @arg1 / @arg2:
- * The numeric operators convert their operands to numbers as if
- * by calling the number function.
- */
-void
-xmlXPathDivValues(xmlXPathParserContextPtr ctxt) {
- xmlXPathObjectPtr arg;
- double val;
-
- arg = valuePop(ctxt);
- if (arg == NULL)
- XP_ERROR(XPATH_INVALID_OPERAND);
- val = xmlXPathCastToNumber(arg);
- xmlXPathFreeObject(arg);
-
- CAST_TO_NUMBER;
- CHECK_TYPE(XPATH_NUMBER);
- if (xmlXPathIsNaN(val) || xmlXPathIsNaN(ctxt->value->floatval))
- ctxt->value->floatval = xmlXPathNAN;
- else if (val == 0 && xmlXPathGetSign(val) != 0) {
- if (ctxt->value->floatval == 0)
- ctxt->value->floatval = xmlXPathNAN;
- else if (ctxt->value->floatval > 0)
- ctxt->value->floatval = xmlXPathNINF;
- else if (ctxt->value->floatval < 0)
- ctxt->value->floatval = xmlXPathPINF;
- }
- else if (val == 0) {
- if (ctxt->value->floatval == 0)
- ctxt->value->floatval = xmlXPathNAN;
- else if (ctxt->value->floatval > 0)
- ctxt->value->floatval = xmlXPathPINF;
- else if (ctxt->value->floatval < 0)
- ctxt->value->floatval = xmlXPathNINF;
- } else
- ctxt->value->floatval /= val;
-}
-
-/**
- * xmlXPathModValues:
- * @ctxt: the XPath Parser context
- *
- * Implement the mod operation on XPath objects: @arg1 / @arg2
- * The numeric operators convert their operands to numbers as if
- * by calling the number function.
- */
-void
-xmlXPathModValues(xmlXPathParserContextPtr ctxt) {
- xmlXPathObjectPtr arg;
- double arg1, arg2;
-
- arg = valuePop(ctxt);
- if (arg == NULL)
- XP_ERROR(XPATH_INVALID_OPERAND);
- arg2 = xmlXPathCastToNumber(arg);
- xmlXPathFreeObject(arg);
-
- CAST_TO_NUMBER;
- CHECK_TYPE(XPATH_NUMBER);
- arg1 = ctxt->value->floatval;
- if (arg2 == 0)
- ctxt->value->floatval = xmlXPathNAN;
- else {
- ctxt->value->floatval = fmod(arg1, arg2);
- }
-}
-
-/************************************************************************
- * *
- * The traversal functions *
- * *
- ************************************************************************/
-
-/*
- * A traversal function enumerates nodes along an axis.
- * Initially it must be called with NULL, and it indicates
- * termination on the axis by returning NULL.
- */
-typedef xmlNodePtr (*xmlXPathTraversalFunction)
- (xmlXPathParserContextPtr ctxt, xmlNodePtr cur);
-
-/**
- * xmlXPathNextSelf:
- * @ctxt: the XPath Parser context
- * @cur: the current node in the traversal
- *
- * Traversal function for the "self" direction
- * The self axis contains just the context node itself
- *
- * Returns the next element following that axis
- */
-xmlNodePtr
-xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
- if (cur == NULL)
- return(ctxt->context->node);
- return(NULL);
-}
-
-/**
- * xmlXPathNextChild:
- * @ctxt: the XPath Parser context
- * @cur: the current node in the traversal
- *
- * Traversal function for the "child" direction
- * The child axis contains the children of the context node in document order.
- *
- * Returns the next element following that axis
- */
-xmlNodePtr
-xmlXPathNextChild(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
- if (cur == NULL) {
- if (ctxt->context->node == NULL) return(NULL);
- switch (ctxt->context->node->type) {
- case XML_ELEMENT_NODE:
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_NOTATION_NODE:
- case XML_DTD_NODE:
- return(ctxt->context->node->children);
- case XML_DOCUMENT_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- return(((xmlDocPtr) ctxt->context->node)->children);
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- case XML_ATTRIBUTE_NODE:
- case XML_NAMESPACE_DECL:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- return(NULL);
- }
- return(NULL);
- }
- if ((cur->type == XML_DOCUMENT_NODE) ||
- (cur->type == XML_HTML_DOCUMENT_NODE))
- return(NULL);
- return(cur->next);
-}
-
-/**
- * xmlXPathNextDescendant:
- * @ctxt: the XPath Parser context
- * @cur: the current node in the traversal
- *
- * Traversal function for the "descendant" direction
- * the descendant axis contains the descendants of the context node in document
- * order; a descendant is a child or a child of a child and so on.
- *
- * Returns the next element following that axis
- */
-xmlNodePtr
-xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
- if (cur == NULL) {
- if (ctxt->context->node == NULL)
- return(NULL);
- if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
- (ctxt->context->node->type == XML_NAMESPACE_DECL))
- return(NULL);
-
- if (ctxt->context->node == (xmlNodePtr) ctxt->context->doc)
- return(ctxt->context->doc->children);
- return(ctxt->context->node->children);
- }
-
- if (cur->children != NULL) {
- /*
- * Do not descend on entities declarations
- */
- if (cur->children->type != XML_ENTITY_DECL) {
- cur = cur->children;
- /*
- * Skip DTDs
- */
- if (cur->type != XML_DTD_NODE)
- return(cur);
- }
- }
-
- if (cur == ctxt->context->node) return(NULL);
-
- while (cur->next != NULL) {
- cur = cur->next;
- if ((cur->type != XML_ENTITY_DECL) &&
- (cur->type != XML_DTD_NODE))
- return(cur);
- }
-
- do {
- cur = cur->parent;
- if (cur == NULL) return(NULL);
- if (cur == ctxt->context->node) return(NULL);
- if (cur->next != NULL) {
- cur = cur->next;
- return(cur);
- }
- } while (cur != NULL);
- return(cur);
-}
-
-/**
- * xmlXPathNextDescendantOrSelf:
- * @ctxt: the XPath Parser context
- * @cur: the current node in the traversal
- *
- * Traversal function for the "descendant-or-self" direction
- * the descendant-or-self axis contains the context node and the descendants
- * of the context node in document order; thus the context node is the first
- * node on the axis, and the first child of the context node is the second node
- * on the axis
- *
- * Returns the next element following that axis
- */
-xmlNodePtr
-xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
- if (cur == NULL) {
- if (ctxt->context->node == NULL)
- return(NULL);
- if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
- (ctxt->context->node->type == XML_NAMESPACE_DECL))
- return(NULL);
- return(ctxt->context->node);
- }
-
- return(xmlXPathNextDescendant(ctxt, cur));
-}
-
-/**
- * xmlXPathNextParent:
- * @ctxt: the XPath Parser context
- * @cur: the current node in the traversal
- *
- * Traversal function for the "parent" direction
- * The parent axis contains the parent of the context node, if there is one.
- *
- * Returns the next element following that axis
- */
-xmlNodePtr
-xmlXPathNextParent(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
- /*
- * the parent of an attribute or namespace node is the element
- * to which the attribute or namespace node is attached
- * Namespace handling !!!
- */
- if (cur == NULL) {
- if (ctxt->context->node == NULL) return(NULL);
- switch (ctxt->context->node->type) {
- case XML_ELEMENT_NODE:
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_NOTATION_NODE:
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- case XML_ENTITY_DECL:
- if (ctxt->context->node->parent == NULL)
- return((xmlNodePtr) ctxt->context->doc);
- return(ctxt->context->node->parent);
- case XML_ATTRIBUTE_NODE: {
- xmlAttrPtr att = (xmlAttrPtr) ctxt->context->node;
-
- return(att->parent);
- }
- case XML_DOCUMENT_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- return(NULL);
- case XML_NAMESPACE_DECL: {
- xmlNsPtr ns = (xmlNsPtr) ctxt->context->node;
-
- if ((ns->next != NULL) &&
- (ns->next->type != XML_NAMESPACE_DECL))
- return((xmlNodePtr) ns->next);
- return(NULL);
- }
- }
- }
- return(NULL);
-}
-
-/**
- * xmlXPathNextAncestor:
- * @ctxt: the XPath Parser context
- * @cur: the current node in the traversal
- *
- * Traversal function for the "ancestor" direction
- * the ancestor axis contains the ancestors of the context node; the ancestors
- * of the context node consist of the parent of context node and the parent's
- * parent and so on; the nodes are ordered in reverse document order; thus the
- * parent is the first node on the axis, and the parent's parent is the second
- * node on the axis
- *
- * Returns the next element following that axis
- */
-xmlNodePtr
-xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
- /*
- * the parent of an attribute or namespace node is the element
- * to which the attribute or namespace node is attached
- * !!!!!!!!!!!!!
- */
- if (cur == NULL) {
- if (ctxt->context->node == NULL) return(NULL);
- switch (ctxt->context->node->type) {
- case XML_ELEMENT_NODE:
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- case XML_NOTATION_NODE:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- if (ctxt->context->node->parent == NULL)
- return((xmlNodePtr) ctxt->context->doc);
- return(ctxt->context->node->parent);
- case XML_ATTRIBUTE_NODE: {
- xmlAttrPtr tmp = (xmlAttrPtr) ctxt->context->node;
-
- return(tmp->parent);
- }
- case XML_DOCUMENT_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- return(NULL);
- case XML_NAMESPACE_DECL: {
- xmlNsPtr ns = (xmlNsPtr) ctxt->context->node;
-
- if ((ns->next != NULL) &&
- (ns->next->type != XML_NAMESPACE_DECL))
- return((xmlNodePtr) ns->next);
- /* Bad, how did that namespace ended-up there ? */
- return(NULL);
- }
- }
- return(NULL);
- }
- if (cur == ctxt->context->doc->children)
- return((xmlNodePtr) ctxt->context->doc);
- if (cur == (xmlNodePtr) ctxt->context->doc)
- return(NULL);
- switch (cur->type) {
- case XML_ELEMENT_NODE:
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_NOTATION_NODE:
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- return(cur->parent);
- case XML_ATTRIBUTE_NODE: {
- xmlAttrPtr att = (xmlAttrPtr) ctxt->context->node;
-
- return(att->parent);
- }
- case XML_NAMESPACE_DECL: {
- xmlNsPtr ns = (xmlNsPtr) ctxt->context->node;
-
- if ((ns->next != NULL) &&
- (ns->next->type != XML_NAMESPACE_DECL))
- return((xmlNodePtr) ns->next);
- /* Bad, how did that namespace ended-up there ? */
- return(NULL);
- }
- case XML_DOCUMENT_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- return(NULL);
- }
- return(NULL);
-}
-
-/**
- * xmlXPathNextAncestorOrSelf:
- * @ctxt: the XPath Parser context
- * @cur: the current node in the traversal
- *
- * Traversal function for the "ancestor-or-self" direction
- * he ancestor-or-self axis contains the context node and ancestors of
- * the context node in reverse document order; thus the context node is
- * the first node on the axis, and the context node's parent the second;
- * parent here is defined the same as with the parent axis.
- *
- * Returns the next element following that axis
- */
-xmlNodePtr
-xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
- if (cur == NULL)
- return(ctxt->context->node);
- return(xmlXPathNextAncestor(ctxt, cur));
-}
-
-/**
- * xmlXPathNextFollowingSibling:
- * @ctxt: the XPath Parser context
- * @cur: the current node in the traversal
- *
- * Traversal function for the "following-sibling" direction
- * The following-sibling axis contains the following siblings of the context
- * node in document order.
- *
- * Returns the next element following that axis
- */
-xmlNodePtr
-xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
- if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
- (ctxt->context->node->type == XML_NAMESPACE_DECL))
- return(NULL);
- if (cur == (xmlNodePtr) ctxt->context->doc)
- return(NULL);
- if (cur == NULL)
- return(ctxt->context->node->next);
- return(cur->next);
-}
-
-/**
- * xmlXPathNextPrecedingSibling:
- * @ctxt: the XPath Parser context
- * @cur: the current node in the traversal
- *
- * Traversal function for the "preceding-sibling" direction
- * The preceding-sibling axis contains the preceding siblings of the context
- * node in reverse document order; the first preceding sibling is first on the
- * axis; the sibling preceding that node is the second on the axis and so on.
- *
- * Returns the next element following that axis
- */
-xmlNodePtr
-xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
- if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
- (ctxt->context->node->type == XML_NAMESPACE_DECL))
- return(NULL);
- if (cur == (xmlNodePtr) ctxt->context->doc)
- return(NULL);
- if (cur == NULL)
- return(ctxt->context->node->prev);
- if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE)) {
- cur = cur->prev;
- if (cur == NULL)
- return(ctxt->context->node->prev);
- }
- return(cur->prev);
-}
-
-/**
- * xmlXPathNextFollowing:
- * @ctxt: the XPath Parser context
- * @cur: the current node in the traversal
- *
- * Traversal function for the "following" direction
- * The following axis contains all nodes in the same document as the context
- * node that are after the context node in document order, excluding any
- * descendants and excluding attribute nodes and namespace nodes; the nodes
- * are ordered in document order
- *
- * Returns the next element following that axis
- */
-xmlNodePtr
-xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
- if (cur != NULL && cur->children != NULL)
- return cur->children ;
- if (cur == NULL) cur = ctxt->context->node;
- if (cur == NULL) return(NULL) ; /* ERROR */
- if (cur->next != NULL) return(cur->next) ;
- do {
- cur = cur->parent;
- if (cur == NULL) return(NULL);
- if (cur == (xmlNodePtr) ctxt->context->doc) return(NULL);
- if (cur->next != NULL) return(cur->next);
- } while (cur != NULL);
- return(cur);
-}
-
-/*
- * xmlXPathIsAncestor:
- * @ancestor: the ancestor node
- * @node: the current node
- *
- * Check that @ancestor is a @node's ancestor
- *
- * returns 1 if @ancestor is a @node's ancestor, 0 otherwise.
- */
-static int
-xmlXPathIsAncestor(xmlNodePtr ancestor, xmlNodePtr node) {
- if ((ancestor == NULL) || (node == NULL)) return(0);
- /* nodes need to be in the same document */
- if (ancestor->doc != node->doc) return(0);
- /* avoid searching if ancestor or node is the root node */
- if (ancestor == (xmlNodePtr) node->doc) return(1);
- if (node == (xmlNodePtr) ancestor->doc) return(0);
- while (node->parent != NULL) {
- if (node->parent == ancestor)
- return(1);
- node = node->parent;
- }
- return(0);
-}
-
-/**
- * xmlXPathNextPreceding:
- * @ctxt: the XPath Parser context
- * @cur: the current node in the traversal
- *
- * Traversal function for the "preceding" direction
- * the preceding axis contains all nodes in the same document as the context
- * node that are before the context node in document order, excluding any
- * ancestors and excluding attribute nodes and namespace nodes; the nodes are
- * ordered in reverse document order
- *
- * Returns the next element following that axis
- */
-xmlNodePtr
-xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur)
-{
- if (cur == NULL)
- cur = ctxt->context->node;
- if (cur == NULL)
- return (NULL);
- if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
- cur = cur->prev;
- do {
- if (cur->prev != NULL) {
- for (cur = cur->prev; cur->last != NULL; cur = cur->last) ;
- return (cur);
- }
-
- cur = cur->parent;
- if (cur == NULL)
- return (NULL);
- if (cur == ctxt->context->doc->children)
- return (NULL);
- } while (xmlXPathIsAncestor(cur, ctxt->context->node));
- return (cur);
-}
-
-/**
- * xmlXPathNextPrecedingInternal:
- * @ctxt: the XPath Parser context
- * @cur: the current node in the traversal
- *
- * Traversal function for the "preceding" direction
- * the preceding axis contains all nodes in the same document as the context
- * node that are before the context node in document order, excluding any
- * ancestors and excluding attribute nodes and namespace nodes; the nodes are
- * ordered in reverse document order
- * This is a faster implementation but internal only since it requires a
- * state kept in the parser context: ctxt->ancestor.
- *
- * Returns the next element following that axis
- */
-static xmlNodePtr
-xmlXPathNextPrecedingInternal(xmlXPathParserContextPtr ctxt,
- xmlNodePtr cur)
-{
- if (cur == NULL) {
- cur = ctxt->context->node;
- if (cur == NULL)
- return (NULL);
- ctxt->ancestor = cur->parent;
- }
- if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
- cur = cur->prev;
- while (cur->prev == NULL) {
- cur = cur->parent;
- if (cur == NULL)
- return (NULL);
- if (cur == ctxt->context->doc->children)
- return (NULL);
- if (cur != ctxt->ancestor)
- return (cur);
- ctxt->ancestor = cur->parent;
- }
- cur = cur->prev;
- while (cur->last != NULL)
- cur = cur->last;
- return (cur);
-}
-
-/**
- * xmlXPathNextNamespace:
- * @ctxt: the XPath Parser context
- * @cur: the current attribute in the traversal
- *
- * Traversal function for the "namespace" direction
- * the namespace axis contains the namespace nodes of the context node;
- * the order of nodes on this axis is implementation-defined; the axis will
- * be empty unless the context node is an element
- *
- * We keep the XML namespace node at the end of the list.
- *
- * Returns the next element following that axis
- */
-xmlNodePtr
-xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
- if (ctxt->context->node->type != XML_ELEMENT_NODE) return(NULL);
- if (ctxt->context->tmpNsList == NULL && cur != (xmlNodePtr) xmlXPathXMLNamespace) {
- if (ctxt->context->tmpNsList != NULL)
- xmlFree(ctxt->context->tmpNsList);
- ctxt->context->tmpNsList =
- xmlGetNsList(ctxt->context->doc, ctxt->context->node);
- ctxt->context->tmpNsNr = 0;
- if (ctxt->context->tmpNsList != NULL) {
- while (ctxt->context->tmpNsList[ctxt->context->tmpNsNr] != NULL) {
- ctxt->context->tmpNsNr++;
- }
- }
- return((xmlNodePtr) xmlXPathXMLNamespace);
- }
- if (ctxt->context->tmpNsNr > 0) {
- return (xmlNodePtr)ctxt->context->tmpNsList[--ctxt->context->tmpNsNr];
- } else {
- if (ctxt->context->tmpNsList != NULL)
- xmlFree(ctxt->context->tmpNsList);
- ctxt->context->tmpNsList = NULL;
- return(NULL);
- }
-}
-
-/**
- * xmlXPathNextAttribute:
- * @ctxt: the XPath Parser context
- * @cur: the current attribute in the traversal
- *
- * Traversal function for the "attribute" direction
- * TODO: support DTD inherited default attributes
- *
- * Returns the next element following that axis
- */
-xmlNodePtr
-xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
- if (ctxt->context->node == NULL)
- return(NULL);
- if (ctxt->context->node->type != XML_ELEMENT_NODE)
- return(NULL);
- if (cur == NULL) {
- if (ctxt->context->node == (xmlNodePtr) ctxt->context->doc)
- return(NULL);
- return((xmlNodePtr)ctxt->context->node->properties);
- }
- return((xmlNodePtr)cur->next);
-}
-
-/************************************************************************
- * *
- * NodeTest Functions *
- * *
- ************************************************************************/
-
-#define IS_FUNCTION 200
-
-
-/************************************************************************
- * *
- * Implicit tree core function library *
- * *
- ************************************************************************/
-
-/**
- * xmlXPathRoot:
- * @ctxt: the XPath Parser context
- *
- * Initialize the context to the root of the document
- */
-void
-xmlXPathRoot(xmlXPathParserContextPtr ctxt) {
- ctxt->context->node = (xmlNodePtr) ctxt->context->doc;
- valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node));
-}
-
-/************************************************************************
- * *
- * The explicit core function library *
- *http://www.w3.org/Style/XSL/Group/1999/07/xpath-19990705.html#corelib *
- * *
- ************************************************************************/
-
-
-/**
- * xmlXPathLastFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the last() XPath function
- * number last()
- * The last function returns the number of nodes in the context node list.
- */
-void
-xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- CHECK_ARITY(0);
- if (ctxt->context->contextSize >= 0) {
- valuePush(ctxt, xmlXPathNewFloat((double) ctxt->context->contextSize));
-#ifdef DEBUG_EXPR
- xmlGenericError(xmlGenericErrorContext,
- "last() : %d\n", ctxt->context->contextSize);
-#endif
- } else {
- XP_ERROR(XPATH_INVALID_CTXT_SIZE);
- }
-}
-
-/**
- * xmlXPathPositionFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the position() XPath function
- * number position()
- * The position function returns the position of the context node in the
- * context node list. The first position is 1, and so the last position
- * will be equal to last().
- */
-void
-xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- CHECK_ARITY(0);
- if (ctxt->context->proximityPosition >= 0) {
- valuePush(ctxt,
- xmlXPathNewFloat((double) ctxt->context->proximityPosition));
-#ifdef DEBUG_EXPR
- xmlGenericError(xmlGenericErrorContext, "position() : %d\n",
- ctxt->context->proximityPosition);
-#endif
- } else {
- XP_ERROR(XPATH_INVALID_CTXT_POSITION);
- }
-}
-
-/**
- * xmlXPathCountFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the count() XPath function
- * number count(node-set)
- */
-void
-xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr cur;
-
- CHECK_ARITY(1);
- if ((ctxt->value == NULL) ||
- ((ctxt->value->type != XPATH_NODESET) &&
- (ctxt->value->type != XPATH_XSLT_TREE)))
- XP_ERROR(XPATH_INVALID_TYPE);
- cur = valuePop(ctxt);
-
- if ((cur == NULL) || (cur->nodesetval == NULL))
- valuePush(ctxt, xmlXPathNewFloat((double) 0));
- else if ((cur->type == XPATH_NODESET) || (cur->type == XPATH_XSLT_TREE)) {
- valuePush(ctxt, xmlXPathNewFloat((double) cur->nodesetval->nodeNr));
- } else {
- if ((cur->nodesetval->nodeNr != 1) ||
- (cur->nodesetval->nodeTab == NULL)) {
- valuePush(ctxt, xmlXPathNewFloat((double) 0));
- } else {
- xmlNodePtr tmp;
- int i = 0;
-
- tmp = cur->nodesetval->nodeTab[0];
- if (tmp != NULL) {
- tmp = tmp->children;
- while (tmp != NULL) {
- tmp = tmp->next;
- i++;
- }
- }
- valuePush(ctxt, xmlXPathNewFloat((double) i));
- }
- }
- xmlXPathFreeObject(cur);
-}
-
-/**
- * xmlXPathGetElementsByIds:
- * @doc: the document
- * @ids: a whitespace separated list of IDs
- *
- * Selects elements by their unique ID.
- *
- * Returns a node-set of selected elements.
- */
-static xmlNodeSetPtr
-xmlXPathGetElementsByIds (xmlDocPtr doc, const xmlChar *ids) {
- xmlNodeSetPtr ret;
- const xmlChar *cur = ids;
- xmlChar *ID;
- xmlAttrPtr attr;
- xmlNodePtr elem = NULL;
-
- ret = xmlXPathNodeSetCreate(NULL);
-
- while (IS_BLANK(*cur)) cur++;
- while (*cur != 0) {
- while ((IS_LETTER(*cur)) || (IS_DIGIT(*cur)) ||
- (*cur == '.') || (*cur == '-') ||
- (*cur == '_') || (*cur == ':') ||
- (IS_COMBINING(*cur)) ||
- (IS_EXTENDER(*cur)))
- cur++;
-
- if ((!IS_BLANK(*cur)) && (*cur != 0)) break;
-
- ID = xmlStrndup(ids, cur - ids);
- attr = xmlGetID(doc, ID);
- if (attr != NULL) {
- elem = attr->parent;
- xmlXPathNodeSetAdd(ret, elem);
- }
- if (ID != NULL)
- xmlFree(ID);
-
- while (IS_BLANK(*cur)) cur++;
- ids = cur;
- }
- return(ret);
-}
-
-/**
- * xmlXPathIdFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the id() XPath function
- * node-set id(object)
- * The id function selects elements by their unique ID
- * (see [5.2.1 Unique IDs]). When the argument to id is of type node-set,
- * then the result is the union of the result of applying id to the
- * string value of each of the nodes in the argument node-set. When the
- * argument to id is of any other type, the argument is converted to a
- * string as if by a call to the string function; the string is split
- * into a whitespace-separated list of tokens (whitespace is any sequence
- * of characters matching the production S); the result is a node-set
- * containing the elements in the same document as the context node that
- * have a unique ID equal to any of the tokens in the list.
- */
-void
-xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlChar *tokens;
- xmlNodeSetPtr ret;
- xmlXPathObjectPtr obj;
-
- CHECK_ARITY(1);
- obj = valuePop(ctxt);
- if (obj == NULL) XP_ERROR(XPATH_INVALID_OPERAND);
- if ((obj->type == XPATH_NODESET) || (obj->type == XPATH_XSLT_TREE)) {
- xmlNodeSetPtr ns;
- int i;
-
- ret = xmlXPathNodeSetCreate(NULL);
-
- if (obj->nodesetval != NULL) {
- for (i = 0; i < obj->nodesetval->nodeNr; i++) {
- tokens =
- xmlXPathCastNodeToString(obj->nodesetval->nodeTab[i]);
- ns = xmlXPathGetElementsByIds(ctxt->context->doc, tokens);
- ret = xmlXPathNodeSetMerge(ret, ns);
- xmlXPathFreeNodeSet(ns);
- if (tokens != NULL)
- xmlFree(tokens);
- }
- }
-
- xmlXPathFreeObject(obj);
- valuePush(ctxt, xmlXPathWrapNodeSet(ret));
- return;
- }
- obj = xmlXPathConvertString(obj);
-
- ret = xmlXPathGetElementsByIds(ctxt->context->doc, obj->stringval);
- valuePush(ctxt, xmlXPathWrapNodeSet(ret));
-
- xmlXPathFreeObject(obj);
- return;
-}
-
-/**
- * xmlXPathLocalNameFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the local-name() XPath function
- * string local-name(node-set?)
- * The local-name function returns a string containing the local part
- * of the name of the node in the argument node-set that is first in
- * document order. If the node-set is empty or the first node has no
- * name, an empty string is returned. If the argument is omitted it
- * defaults to the context node.
- */
-void
-xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr cur;
-
- if (nargs == 0) {
- valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node));
- nargs = 1;
- }
-
- CHECK_ARITY(1);
- if ((ctxt->value == NULL) ||
- ((ctxt->value->type != XPATH_NODESET) &&
- (ctxt->value->type != XPATH_XSLT_TREE)))
- XP_ERROR(XPATH_INVALID_TYPE);
- cur = valuePop(ctxt);
-
- if ((cur->nodesetval == NULL) || (cur->nodesetval->nodeNr == 0)) {
- valuePush(ctxt, xmlXPathNewCString(""));
- } else {
- int i = 0; /* Should be first in document order !!!!! */
- switch (cur->nodesetval->nodeTab[i]->type) {
- case XML_ELEMENT_NODE:
- case XML_ATTRIBUTE_NODE:
- case XML_PI_NODE:
- valuePush(ctxt,
- xmlXPathNewString(cur->nodesetval->nodeTab[i]->name));
- break;
- case XML_NAMESPACE_DECL:
- valuePush(ctxt, xmlXPathNewString(
- ((xmlNsPtr)cur->nodesetval->nodeTab[i])->prefix));
- break;
- default:
- valuePush(ctxt, xmlXPathNewCString(""));
- }
- }
- xmlXPathFreeObject(cur);
-}
-
-/**
- * xmlXPathNamespaceURIFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the namespace-uri() XPath function
- * string namespace-uri(node-set?)
- * The namespace-uri function returns a string containing the
- * namespace URI of the expanded name of the node in the argument
- * node-set that is first in document order. If the node-set is empty,
- * the first node has no name, or the expanded name has no namespace
- * URI, an empty string is returned. If the argument is omitted it
- * defaults to the context node.
- */
-void
-xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr cur;
-
- if (nargs == 0) {
- valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node));
- nargs = 1;
- }
- CHECK_ARITY(1);
- if ((ctxt->value == NULL) ||
- ((ctxt->value->type != XPATH_NODESET) &&
- (ctxt->value->type != XPATH_XSLT_TREE)))
- XP_ERROR(XPATH_INVALID_TYPE);
- cur = valuePop(ctxt);
-
- if ((cur->nodesetval == NULL) || (cur->nodesetval->nodeNr == 0)) {
- valuePush(ctxt, xmlXPathNewCString(""));
- } else {
- int i = 0; /* Should be first in document order !!!!! */
- switch (cur->nodesetval->nodeTab[i]->type) {
- case XML_ELEMENT_NODE:
- case XML_ATTRIBUTE_NODE:
- if (cur->nodesetval->nodeTab[i]->ns == NULL)
- valuePush(ctxt, xmlXPathNewCString(""));
- else
- valuePush(ctxt, xmlXPathNewString(
- cur->nodesetval->nodeTab[i]->ns->href));
- break;
- default:
- valuePush(ctxt, xmlXPathNewCString(""));
- }
- }
- xmlXPathFreeObject(cur);
-}
-
-/**
- * xmlXPathNameFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the name() XPath function
- * string name(node-set?)
- * The name function returns a string containing a QName representing
- * the name of the node in the argument node-set that is first in document
- * order. The QName must represent the name with respect to the namespace
- * declarations in effect on the node whose name is being represented.
- * Typically, this will be the form in which the name occurred in the XML
- * source. This need not be the case if there are namespace declarations
- * in effect on the node that associate multiple prefixes with the same
- * namespace. However, an implementation may include information about
- * the original prefix in its representation of nodes; in this case, an
- * implementation can ensure that the returned string is always the same
- * as the QName used in the XML source. If the argument it omitted it
- * defaults to the context node.
- * Libxml keep the original prefix so the "real qualified name" used is
- * returned.
- */
-static void
-xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs)
-{
- xmlXPathObjectPtr cur;
-
- if (nargs == 0) {
- valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node));
- nargs = 1;
- }
-
- CHECK_ARITY(1);
- if ((ctxt->value == NULL) ||
- ((ctxt->value->type != XPATH_NODESET) &&
- (ctxt->value->type != XPATH_XSLT_TREE)))
- XP_ERROR(XPATH_INVALID_TYPE);
- cur = valuePop(ctxt);
-
- if ((cur->nodesetval == NULL) || (cur->nodesetval->nodeNr == 0)) {
- valuePush(ctxt, xmlXPathNewCString(""));
- } else {
- int i = 0; /* Should be first in document order !!!!! */
-
- switch (cur->nodesetval->nodeTab[i]->type) {
- case XML_ELEMENT_NODE:
- case XML_ATTRIBUTE_NODE:
- if ((cur->nodesetval->nodeTab[i]->ns == NULL) ||
- (cur->nodesetval->nodeTab[i]->ns->prefix == NULL))
- valuePush(ctxt,
- xmlXPathNewString(cur->nodesetval->
- nodeTab[i]->name));
-
- else {
- char name[2000];
-
- snprintf(name, sizeof(name), "%s:%s",
- (char *) cur->nodesetval->nodeTab[i]->ns->
- prefix,
- (char *) cur->nodesetval->nodeTab[i]->name);
- name[sizeof(name) - 1] = 0;
- valuePush(ctxt, xmlXPathNewCString(name));
- }
- break;
- default:
- valuePush(ctxt,
- xmlXPathNewNodeSet(cur->nodesetval->nodeTab[i]));
- xmlXPathLocalNameFunction(ctxt, 1);
- }
- }
- xmlXPathFreeObject(cur);
-}
-
-
-/**
- * xmlXPathStringFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the string() XPath function
- * string string(object?)
- * he string function converts an object to a string as follows:
- * - A node-set is converted to a string by returning the value of
- * the node in the node-set that is first in document order.
- * If the node-set is empty, an empty string is returned.
- * - A number is converted to a string as follows
- * + NaN is converted to the string NaN
- * + positive zero is converted to the string 0
- * + negative zero is converted to the string 0
- * + positive infinity is converted to the string Infinity
- * + negative infinity is converted to the string -Infinity
- * + if the number is an integer, the number is represented in
- * decimal form as a Number with no decimal point and no leading
- * zeros, preceded by a minus sign (-) if the number is negative
- * + otherwise, the number is represented in decimal form as a
- * Number including a decimal point with at least one digit
- * before the decimal point and at least one digit after the
- * decimal point, preceded by a minus sign (-) if the number
- * is negative; there must be no leading zeros before the decimal
- * point apart possibly from the one required digit immediately
- * before the decimal point; beyond the one required digit
- * after the decimal point there must be as many, but only as
- * many, more digits as are needed to uniquely distinguish the
- * number from all other IEEE 754 numeric values.
- * - The boolean false value is converted to the string false.
- * The boolean true value is converted to the string true.
- *
- * If the argument is omitted, it defaults to a node-set with the
- * context node as its only member.
- */
-void
-xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr cur;
-
- if (nargs == 0) {
- valuePush(ctxt,
- xmlXPathWrapString(
- xmlXPathCastNodeToString(ctxt->context->node)));
- return;
- }
-
- CHECK_ARITY(1);
- cur = valuePop(ctxt);
- if (cur == NULL) XP_ERROR(XPATH_INVALID_OPERAND);
- cur = xmlXPathConvertString(cur);
- valuePush(ctxt, cur);
-}
-
-/**
- * xmlXPathStringLengthFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the string-length() XPath function
- * number string-length(string?)
- * The string-length returns the number of characters in the string
- * (see [3.6 Strings]). If the argument is omitted, it defaults to
- * the context node converted to a string, in other words the value
- * of the context node.
- */
-void
-xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr cur;
-
- if (nargs == 0) {
- if (ctxt->context->node == NULL) {
- valuePush(ctxt, xmlXPathNewFloat(0));
- } else {
- xmlChar *content;
-
- content = xmlXPathCastNodeToString(ctxt->context->node);
- valuePush(ctxt, xmlXPathNewFloat(xmlUTF8Strlen(content)));
- xmlFree(content);
- }
- return;
- }
- CHECK_ARITY(1);
- CAST_TO_STRING;
- CHECK_TYPE(XPATH_STRING);
- cur = valuePop(ctxt);
- valuePush(ctxt, xmlXPathNewFloat(xmlUTF8Strlen(cur->stringval)));
- xmlXPathFreeObject(cur);
-}
-
-/**
- * xmlXPathConcatFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the concat() XPath function
- * string concat(string, string, string*)
- * The concat function returns the concatenation of its arguments.
- */
-void
-xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr cur, newobj;
- xmlChar *tmp;
-
- if (nargs < 2) {
- CHECK_ARITY(2);
- }
-
- CAST_TO_STRING;
- cur = valuePop(ctxt);
- if ((cur == NULL) || (cur->type != XPATH_STRING)) {
- xmlXPathFreeObject(cur);
- return;
- }
- nargs--;
-
- while (nargs > 0) {
- CAST_TO_STRING;
- newobj = valuePop(ctxt);
- if ((newobj == NULL) || (newobj->type != XPATH_STRING)) {
- xmlXPathFreeObject(newobj);
- xmlXPathFreeObject(cur);
- XP_ERROR(XPATH_INVALID_TYPE);
- }
- tmp = xmlStrcat(newobj->stringval, cur->stringval);
- newobj->stringval = cur->stringval;
- cur->stringval = tmp;
-
- xmlXPathFreeObject(newobj);
- nargs--;
- }
- valuePush(ctxt, cur);
-}
-
-/**
- * xmlXPathContainsFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the contains() XPath function
- * boolean contains(string, string)
- * The contains function returns true if the first argument string
- * contains the second argument string, and otherwise returns false.
- */
-void
-xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr hay, needle;
-
- CHECK_ARITY(2);
- CAST_TO_STRING;
- CHECK_TYPE(XPATH_STRING);
- needle = valuePop(ctxt);
- CAST_TO_STRING;
- hay = valuePop(ctxt);
- if ((hay == NULL) || (hay->type != XPATH_STRING)) {
- xmlXPathFreeObject(hay);
- xmlXPathFreeObject(needle);
- XP_ERROR(XPATH_INVALID_TYPE);
- }
- if (xmlStrstr(hay->stringval, needle->stringval))
- valuePush(ctxt, xmlXPathNewBoolean(1));
- else
- valuePush(ctxt, xmlXPathNewBoolean(0));
- xmlXPathFreeObject(hay);
- xmlXPathFreeObject(needle);
-}
-
-/**
- * xmlXPathStartsWithFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the starts-with() XPath function
- * boolean starts-with(string, string)
- * The starts-with function returns true if the first argument string
- * starts with the second argument string, and otherwise returns false.
- */
-void
-xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr hay, needle;
- int n;
-
- CHECK_ARITY(2);
- CAST_TO_STRING;
- CHECK_TYPE(XPATH_STRING);
- needle = valuePop(ctxt);
- CAST_TO_STRING;
- hay = valuePop(ctxt);
- if ((hay == NULL) || (hay->type != XPATH_STRING)) {
- xmlXPathFreeObject(hay);
- xmlXPathFreeObject(needle);
- XP_ERROR(XPATH_INVALID_TYPE);
- }
- n = xmlStrlen(needle->stringval);
- if (xmlStrncmp(hay->stringval, needle->stringval, n))
- valuePush(ctxt, xmlXPathNewBoolean(0));
- else
- valuePush(ctxt, xmlXPathNewBoolean(1));
- xmlXPathFreeObject(hay);
- xmlXPathFreeObject(needle);
-}
-
-/**
- * xmlXPathSubstringFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the substring() XPath function
- * string substring(string, number, number?)
- * The substring function returns the substring of the first argument
- * starting at the position specified in the second argument with
- * length specified in the third argument. For example,
- * substring("12345",2,3) returns "234". If the third argument is not
- * specified, it returns the substring starting at the position specified
- * in the second argument and continuing to the end of the string. For
- * example, substring("12345",2) returns "2345". More precisely, each
- * character in the string (see [3.6 Strings]) is considered to have a
- * numeric position: the position of the first character is 1, the position
- * of the second character is 2 and so on. The returned substring contains
- * those characters for which the position of the character is greater than
- * or equal to the second argument and, if the third argument is specified,
- * less than the sum of the second and third arguments; the comparisons
- * and addition used for the above follow the standard IEEE 754 rules. Thus:
- * - substring("12345", 1.5, 2.6) returns "234"
- * - substring("12345", 0, 3) returns "12"
- * - substring("12345", 0 div 0, 3) returns ""
- * - substring("12345", 1, 0 div 0) returns ""
- * - substring("12345", -42, 1 div 0) returns "12345"
- * - substring("12345", -1 div 0, 1 div 0) returns ""
- */
-void
-xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr str, start, len;
- double le=0, in;
- int i, l, m;
- xmlChar *ret;
-
- if (nargs < 2) {
- CHECK_ARITY(2);
- }
- if (nargs > 3) {
- CHECK_ARITY(3);
- }
- /*
- * take care of possible last (position) argument
- */
- if (nargs == 3) {
- CAST_TO_NUMBER;
- CHECK_TYPE(XPATH_NUMBER);
- len = valuePop(ctxt);
- le = len->floatval;
- xmlXPathFreeObject(len);
- }
-
- CAST_TO_NUMBER;
- CHECK_TYPE(XPATH_NUMBER);
- start = valuePop(ctxt);
- in = start->floatval;
- xmlXPathFreeObject(start);
- CAST_TO_STRING;
- CHECK_TYPE(XPATH_STRING);
- str = valuePop(ctxt);
- m = xmlUTF8Strlen((const unsigned char *)str->stringval);
-
- /*
- * If last pos not present, calculate last position
- */
- if (nargs != 3) {
- le = (double)m;
- if (in < 1.0)
- in = 1.0;
- }
-
- /* Need to check for the special cases where either
- * the index is NaN, the length is NaN, or both
- * arguments are infinity (relying on Inf + -Inf = NaN)
- */
- if (!xmlXPathIsNaN(in + le) && !xmlXPathIsInf(in)) {
- /*
- * To meet the requirements of the spec, the arguments
- * must be converted to integer format before
- * initial index calculations are done
- *
- * First we go to integer form, rounding up
- * and checking for special cases
- */
- i = (int) in;
- if (((double)i)+0.5 <= in) i++;
-
- if (xmlXPathIsInf(le) == 1) {
- l = m;
- if (i < 1)
- i = 1;
- }
- else if (xmlXPathIsInf(le) == -1 || le < 0.0)
- l = 0;
- else {
- l = (int) le;
- if (((double)l)+0.5 <= le) l++;
- }
-
- /* Now we normalize inidices */
- i -= 1;
- l += i;
- if (i < 0)
- i = 0;
- if (l > m)
- l = m;
-
- /* number of chars to copy */
- l -= i;
-
- ret = xmlUTF8Strsub(str->stringval, i, l);
- }
- else {
- ret = NULL;
- }
-
- if (ret == NULL)
- valuePush(ctxt, xmlXPathNewCString(""));
- else {
- valuePush(ctxt, xmlXPathNewString(ret));
- xmlFree(ret);
- }
-
- xmlXPathFreeObject(str);
-}
-
-/**
- * xmlXPathSubstringBeforeFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the substring-before() XPath function
- * string substring-before(string, string)
- * The substring-before function returns the substring of the first
- * argument string that precedes the first occurrence of the second
- * argument string in the first argument string, or the empty string
- * if the first argument string does not contain the second argument
- * string. For example, substring-before("1999/04/01","/") returns 1999.
- */
-void
-xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr str;
- xmlXPathObjectPtr find;
- xmlBufferPtr target;
- const xmlChar *point;
- int offset;
-
- CHECK_ARITY(2);
- CAST_TO_STRING;
- find = valuePop(ctxt);
- CAST_TO_STRING;
- str = valuePop(ctxt);
-
- target = xmlBufferCreate();
- if (target) {
- point = xmlStrstr(str->stringval, find->stringval);
- if (point) {
- offset = (int)(point - str->stringval);
- xmlBufferAdd(target, str->stringval, offset);
- }
- valuePush(ctxt, xmlXPathNewString(xmlBufferContent(target)));
- xmlBufferFree(target);
- }
-
- xmlXPathFreeObject(str);
- xmlXPathFreeObject(find);
-}
-
-/**
- * xmlXPathSubstringAfterFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the substring-after() XPath function
- * string substring-after(string, string)
- * The substring-after function returns the substring of the first
- * argument string that follows the first occurrence of the second
- * argument string in the first argument string, or the empty stringi
- * if the first argument string does not contain the second argument
- * string. For example, substring-after("1999/04/01","/") returns 04/01,
- * and substring-after("1999/04/01","19") returns 99/04/01.
- */
-void
-xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr str;
- xmlXPathObjectPtr find;
- xmlBufferPtr target;
- const xmlChar *point;
- int offset;
-
- CHECK_ARITY(2);
- CAST_TO_STRING;
- find = valuePop(ctxt);
- CAST_TO_STRING;
- str = valuePop(ctxt);
-
- target = xmlBufferCreate();
- if (target) {
- point = xmlStrstr(str->stringval, find->stringval);
- if (point) {
- offset = (int)(point - str->stringval) + xmlStrlen(find->stringval);
- xmlBufferAdd(target, &str->stringval[offset],
- xmlStrlen(str->stringval) - offset);
- }
- valuePush(ctxt, xmlXPathNewString(xmlBufferContent(target)));
- xmlBufferFree(target);
- }
-
- xmlXPathFreeObject(str);
- xmlXPathFreeObject(find);
-}
-
-/**
- * xmlXPathNormalizeFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the normalize-space() XPath function
- * string normalize-space(string?)
- * The normalize-space function returns the argument string with white
- * space normalized by stripping leading and trailing whitespace
- * and replacing sequences of whitespace characters by a single
- * space. Whitespace characters are the same allowed by the S production
- * in XML. If the argument is omitted, it defaults to the context
- * node converted to a string, in other words the value of the context node.
- */
-void
-xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr obj = NULL;
- xmlChar *source = NULL;
- xmlBufferPtr target;
- xmlChar blank;
-
- if (nargs == 0) {
- /* Use current context node */
- valuePush(ctxt,
- xmlXPathWrapString(
- xmlXPathCastNodeToString(ctxt->context->node)));
- nargs = 1;
- }
-
- CHECK_ARITY(1);
- CAST_TO_STRING;
- CHECK_TYPE(XPATH_STRING);
- obj = valuePop(ctxt);
- source = obj->stringval;
-
- target = xmlBufferCreate();
- if (target && source) {
-
- /* Skip leading whitespaces */
- while (IS_BLANK(*source))
- source++;
-
- /* Collapse intermediate whitespaces, and skip trailing whitespaces */
- blank = 0;
- while (*source) {
- if (IS_BLANK(*source)) {
- blank = 0x20;
- } else {
- if (blank) {
- xmlBufferAdd(target, &blank, 1);
- blank = 0;
- }
- xmlBufferAdd(target, source, 1);
- }
- source++;
- }
-
- valuePush(ctxt, xmlXPathNewString(xmlBufferContent(target)));
- xmlBufferFree(target);
- }
- xmlXPathFreeObject(obj);
-}
-
-/**
- * xmlXPathTranslateFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the translate() XPath function
- * string translate(string, string, string)
- * The translate function returns the first argument string with
- * occurrences of characters in the second argument string replaced
- * by the character at the corresponding position in the third argument
- * string. For example, translate("bar","abc","ABC") returns the string
- * BAr. If there is a character in the second argument string with no
- * character at a corresponding position in the third argument string
- * (because the second argument string is longer than the third argument
- * string), then occurrences of that character in the first argument
- * string are removed. For example, translate("--aaa--","abc-","ABC")
- * returns "AAA". If a character occurs more than once in second
- * argument string, then the first occurrence determines the replacement
- * character. If the third argument string is longer than the second
- * argument string, then excess characters are ignored.
- */
-void
-xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr str;
- xmlXPathObjectPtr from;
- xmlXPathObjectPtr to;
- xmlBufferPtr target;
- int offset, max;
- xmlChar ch;
- xmlChar *point;
- xmlChar *cptr;
-
- CHECK_ARITY(3);
-
- CAST_TO_STRING;
- to = valuePop(ctxt);
- CAST_TO_STRING;
- from = valuePop(ctxt);
- CAST_TO_STRING;
- str = valuePop(ctxt);
-
- target = xmlBufferCreate();
- if (target) {
- max = xmlUTF8Strlen(to->stringval);
- for (cptr = str->stringval; (ch=*cptr); ) {
- offset = xmlUTF8Strloc(from->stringval, cptr);
- if (offset >= 0) {
- if (offset < max) {
- point = xmlUTF8Strpos(to->stringval, offset);
- if (point)
- xmlBufferAdd(target, point, xmlUTF8Strsize(point, 1));
- }
- } else
- xmlBufferAdd(target, cptr, xmlUTF8Strsize(cptr, 1));
-
- /* Step to next character in input */
- cptr++;
- if ( ch & 0x80 ) {
- /* if not simple ascii, verify proper format */
- if ( (ch & 0xc0) != 0xc0 ) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathTranslateFunction: Invalid UTF8 string\n");
- break;
- }
- /* then skip over remaining bytes for this char */
- while ( (ch <<= 1) & 0x80 )
- if ( (*cptr++ & 0xc0) != 0x80 ) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathTranslateFunction: Invalid UTF8 string\n");
- break;
- }
- if (ch & 0x80) /* must have had error encountered */
- break;
- }
- }
- }
- valuePush(ctxt, xmlXPathNewString(xmlBufferContent(target)));
- xmlBufferFree(target);
- xmlXPathFreeObject(str);
- xmlXPathFreeObject(from);
- xmlXPathFreeObject(to);
-}
-
-/**
- * xmlXPathBooleanFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the boolean() XPath function
- * boolean boolean(object)
- * he boolean function converts its argument to a boolean as follows:
- * - a number is true if and only if it is neither positive or
- * negative zero nor NaN
- * - a node-set is true if and only if it is non-empty
- * - a string is true if and only if its length is non-zero
- */
-void
-xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr cur;
-
- CHECK_ARITY(1);
- cur = valuePop(ctxt);
- if (cur == NULL) XP_ERROR(XPATH_INVALID_OPERAND);
- cur = xmlXPathConvertBoolean(cur);
- valuePush(ctxt, cur);
-}
-
-/**
- * xmlXPathNotFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the not() XPath function
- * boolean not(boolean)
- * The not function returns true if its argument is false,
- * and false otherwise.
- */
-void
-xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- CHECK_ARITY(1);
- CAST_TO_BOOLEAN;
- CHECK_TYPE(XPATH_BOOLEAN);
- ctxt->value->boolval = ! ctxt->value->boolval;
-}
-
-/**
- * xmlXPathTrueFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the true() XPath function
- * boolean true()
- */
-void
-xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- CHECK_ARITY(0);
- valuePush(ctxt, xmlXPathNewBoolean(1));
-}
-
-/**
- * xmlXPathFalseFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the false() XPath function
- * boolean false()
- */
-void
-xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- CHECK_ARITY(0);
- valuePush(ctxt, xmlXPathNewBoolean(0));
-}
-
-/**
- * xmlXPathLangFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the lang() XPath function
- * boolean lang(string)
- * The lang function returns true or false depending on whether the
- * language of the context node as specified by xml:lang attributes
- * is the same as or is a sublanguage of the language specified by
- * the argument string. The language of the context node is determined
- * by the value of the xml:lang attribute on the context node, or, if
- * the context node has no xml:lang attribute, by the value of the
- * xml:lang attribute on the nearest ancestor of the context node that
- * has an xml:lang attribute. If there is no such attribute, then lang
- * returns false. If there is such an attribute, then lang returns
- * true if the attribute value is equal to the argument ignoring case,
- * or if there is some suffix starting with - such that the attribute
- * value is equal to the argument ignoring that suffix of the attribute
- * value and ignoring case.
- */
-void
-xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr val;
- const xmlChar *theLang;
- const xmlChar *lang;
- int ret = 0;
- int i;
-
- CHECK_ARITY(1);
- CAST_TO_STRING;
- CHECK_TYPE(XPATH_STRING);
- val = valuePop(ctxt);
- lang = val->stringval;
- theLang = xmlNodeGetLang(ctxt->context->node);
- if ((theLang != NULL) && (lang != NULL)) {
- for (i = 0;lang[i] != 0;i++)
- if (toupper(lang[i]) != toupper(theLang[i]))
- goto not_equal;
- ret = 1;
- }
-not_equal:
- xmlXPathFreeObject(val);
- valuePush(ctxt, xmlXPathNewBoolean(ret));
-}
-
-/**
- * xmlXPathNumberFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the number() XPath function
- * number number(object?)
- */
-void
-xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr cur;
- double res;
-
- if (nargs == 0) {
- if (ctxt->context->node == NULL) {
- valuePush(ctxt, xmlXPathNewFloat(0.0));
- } else {
- xmlChar* content = xmlNodeGetContent(ctxt->context->node);
-
- res = xmlXPathStringEvalNumber(content);
- valuePush(ctxt, xmlXPathNewFloat(res));
- xmlFree(content);
- }
- return;
- }
-
- CHECK_ARITY(1);
- cur = valuePop(ctxt);
- cur = xmlXPathConvertNumber(cur);
- valuePush(ctxt, cur);
-}
-
-/**
- * xmlXPathSumFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the sum() XPath function
- * number sum(node-set)
- * The sum function returns the sum of the values of the nodes in
- * the argument node-set.
- */
-void
-xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr cur;
- int i;
- double res = 0.0;
-
- CHECK_ARITY(1);
- if ((ctxt->value == NULL) ||
- ((ctxt->value->type != XPATH_NODESET) &&
- (ctxt->value->type != XPATH_XSLT_TREE)))
- XP_ERROR(XPATH_INVALID_TYPE);
- cur = valuePop(ctxt);
-
- if ((cur->nodesetval == NULL) || (cur->nodesetval->nodeNr == 0)) {
- valuePush(ctxt, xmlXPathNewFloat(0.0));
- } else {
- for (i = 0; i < cur->nodesetval->nodeNr; i++) {
- res += xmlXPathCastNodeToNumber(cur->nodesetval->nodeTab[i]);
- }
- valuePush(ctxt, xmlXPathNewFloat(res));
- }
- xmlXPathFreeObject(cur);
-}
-
-/**
- * xmlXPathFloorFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the floor() XPath function
- * number floor(number)
- * The floor function returns the largest (closest to positive infinity)
- * number that is not greater than the argument and that is an integer.
- */
-void
-xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- double f;
-
- CHECK_ARITY(1);
- CAST_TO_NUMBER;
- CHECK_TYPE(XPATH_NUMBER);
-
- f = (double)((int) ctxt->value->floatval);
- if (f != ctxt->value->floatval) {
- if (ctxt->value->floatval > 0)
- ctxt->value->floatval = f;
- else
- ctxt->value->floatval = f - 1;
- }
-}
-
-/**
- * xmlXPathCeilingFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the ceiling() XPath function
- * number ceiling(number)
- * The ceiling function returns the smallest (closest to negative infinity)
- * number that is not less than the argument and that is an integer.
- */
-void
-xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- double f;
-
- CHECK_ARITY(1);
- CAST_TO_NUMBER;
- CHECK_TYPE(XPATH_NUMBER);
-
-#if 0
- ctxt->value->floatval = ceil(ctxt->value->floatval);
-#else
- f = (double)((int) ctxt->value->floatval);
- if (f != ctxt->value->floatval) {
- if (ctxt->value->floatval > 0)
- ctxt->value->floatval = f + 1;
- else {
- if (ctxt->value->floatval < 0 && f == 0)
- ctxt->value->floatval = xmlXPathNZERO;
- else
- ctxt->value->floatval = f;
- }
-
- }
-#endif
-}
-
-/**
- * xmlXPathRoundFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the round() XPath function
- * number round(number)
- * The round function returns the number that is closest to the
- * argument and that is an integer. If there are two such numbers,
- * then the one that is even is returned.
- */
-void
-xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- double f;
-
- CHECK_ARITY(1);
- CAST_TO_NUMBER;
- CHECK_TYPE(XPATH_NUMBER);
-
- if ((xmlXPathIsNaN(ctxt->value->floatval)) ||
- (xmlXPathIsInf(ctxt->value->floatval) == 1) ||
- (xmlXPathIsInf(ctxt->value->floatval) == -1) ||
- (ctxt->value->floatval == 0.0))
- return;
-
- f = (double)((int) ctxt->value->floatval);
- if (ctxt->value->floatval < 0) {
- if (ctxt->value->floatval < f - 0.5)
- ctxt->value->floatval = f - 1;
- else
- ctxt->value->floatval = f;
- if (ctxt->value->floatval == 0)
- ctxt->value->floatval = xmlXPathNZERO;
- } else {
- if (ctxt->value->floatval < f + 0.5)
- ctxt->value->floatval = f;
- else
- ctxt->value->floatval = f + 1;
- }
-}
-
-/************************************************************************
- * *
- * The Parser *
- * *
- ************************************************************************/
-
-/*
- * a couple of forward declarations since we use a recursive call based
- * implementation.
- */
-static void xmlXPathCompileExpr(xmlXPathParserContextPtr ctxt);
-static void xmlXPathCompPredicate(xmlXPathParserContextPtr ctxt, int filter);
-static void xmlXPathCompLocationPath(xmlXPathParserContextPtr ctxt);
-static void xmlXPathCompRelativeLocationPath(xmlXPathParserContextPtr ctxt);
-static xmlChar * xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt,
- int qualified);
-
-/**
- * xmlXPathCurrentChar:
- * @ctxt: the XPath parser context
- * @cur: pointer to the beginning of the char
- * @len: pointer to the length of the char read
- *
- * The current char value, if using UTF-8 this may actually span multiple
- * bytes in the input buffer.
- *
- * Returns the current char value and its length
- */
-
-static int
-xmlXPathCurrentChar(xmlXPathParserContextPtr ctxt, int *len) {
- unsigned char c;
- unsigned int val;
- const xmlChar *cur;
-
- if (ctxt == NULL)
- return(0);
- cur = ctxt->cur;
-
- /*
- * We are supposed to handle UTF8, check it's valid
- * From rfc2044: encoding of the Unicode values on UTF-8:
- *
- * UCS-4 range (hex.) UTF-8 octet sequence (binary)
- * 0000 0000-0000 007F 0xxxxxxx
- * 0000 0080-0000 07FF 110xxxxx 10xxxxxx
- * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx
- *
- * Check for the 0x110000 limit too
- */
- c = *cur;
- if (c & 0x80) {
- if ((cur[1] & 0xc0) != 0x80)
- goto encoding_error;
- if ((c & 0xe0) == 0xe0) {
-
- if ((cur[2] & 0xc0) != 0x80)
- goto encoding_error;
- if ((c & 0xf0) == 0xf0) {
- if (((c & 0xf8) != 0xf0) ||
- ((cur[3] & 0xc0) != 0x80))
- goto encoding_error;
- /* 4-byte code */
- *len = 4;
- val = (cur[0] & 0x7) << 18;
- val |= (cur[1] & 0x3f) << 12;
- val |= (cur[2] & 0x3f) << 6;
- val |= cur[3] & 0x3f;
- } else {
- /* 3-byte code */
- *len = 3;
- val = (cur[0] & 0xf) << 12;
- val |= (cur[1] & 0x3f) << 6;
- val |= cur[2] & 0x3f;
- }
- } else {
- /* 2-byte code */
- *len = 2;
- val = (cur[0] & 0x1f) << 6;
- val |= cur[1] & 0x3f;
- }
- if (!IS_CHAR(val)) {
- XP_ERROR0(XPATH_INVALID_CHAR_ERROR);
- }
- return(val);
- } else {
- /* 1-byte code */
- *len = 1;
- return((int) *cur);
- }
-encoding_error:
- /*
- * If we detect an UTF8 error that probably mean that the
- * input encoding didn't get properly advertized in the
- * declaration header. Report the error and switch the encoding
- * to ISO-Latin-1 (if you don't like this policy, just declare the
- * encoding !)
- */
- *len = 0;
- XP_ERROR0(XPATH_ENCODING_ERROR);
-}
-
-/**
- * xmlXPathParseNCName:
- * @ctxt: the XPath Parser context
- *
- * parse an XML namespace non qualified name.
- *
- * [NS 3] NCName ::= (Letter | '_') (NCNameChar)*
- *
- * [NS 4] NCNameChar ::= Letter | Digit | '.' | '-' | '_' |
- * CombiningChar | Extender
- *
- * Returns the namespace name or NULL
- */
-
-xmlChar *
-xmlXPathParseNCName(xmlXPathParserContextPtr ctxt) {
- const xmlChar *in;
- xmlChar *ret;
- int count = 0;
-
- /*
- * Accelerator for simple ASCII names
- */
- in = ctxt->cur;
- if (((*in >= 0x61) && (*in <= 0x7A)) ||
- ((*in >= 0x41) && (*in <= 0x5A)) ||
- (*in == '_')) {
- in++;
- while (((*in >= 0x61) && (*in <= 0x7A)) ||
- ((*in >= 0x41) && (*in <= 0x5A)) ||
- ((*in >= 0x30) && (*in <= 0x39)) ||
- (*in == '_') || (*in == '.') ||
- (*in == '-'))
- in++;
- if ((*in == ' ') || (*in == '>') || (*in == '/') ||
- (*in == '[') || (*in == ']') || (*in == ':') ||
- (*in == '@') || (*in == '*')) {
- count = in - ctxt->cur;
- if (count == 0)
- return(NULL);
- ret = xmlStrndup(ctxt->cur, count);
- ctxt->cur = in;
- return(ret);
- }
- }
- return(xmlXPathParseNameComplex(ctxt, 0));
-}
-
-
-/**
- * xmlXPathParseQName:
- * @ctxt: the XPath Parser context
- * @prefix: a xmlChar **
- *
- * parse an XML qualified name
- *
- * [NS 5] QName ::= (Prefix ':')? LocalPart
- *
- * [NS 6] Prefix ::= NCName
- *
- * [NS 7] LocalPart ::= NCName
- *
- * Returns the function returns the local part, and prefix is updated
- * to get the Prefix if any.
- */
-
-static xmlChar *
-xmlXPathParseQName(xmlXPathParserContextPtr ctxt, xmlChar **prefix) {
- xmlChar *ret = NULL;
-
- *prefix = NULL;
- ret = xmlXPathParseNCName(ctxt);
- if (CUR == ':') {
- *prefix = ret;
- NEXT;
- ret = xmlXPathParseNCName(ctxt);
- }
- return(ret);
-}
-
-/**
- * xmlXPathParseName:
- * @ctxt: the XPath Parser context
- *
- * parse an XML name
- *
- * [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |
- * CombiningChar | Extender
- *
- * [5] Name ::= (Letter | '_' | ':') (NameChar)*
- *
- * Returns the namespace name or NULL
- */
-
-xmlChar *
-xmlXPathParseName(xmlXPathParserContextPtr ctxt) {
- const xmlChar *in;
- xmlChar *ret;
- int count = 0;
-
- /*
- * Accelerator for simple ASCII names
- */
- in = ctxt->cur;
- if (((*in >= 0x61) && (*in <= 0x7A)) ||
- ((*in >= 0x41) && (*in <= 0x5A)) ||
- (*in == '_') || (*in == ':')) {
- in++;
- while (((*in >= 0x61) && (*in <= 0x7A)) ||
- ((*in >= 0x41) && (*in <= 0x5A)) ||
- ((*in >= 0x30) && (*in <= 0x39)) ||
- (*in == '_') || (*in == '-') ||
- (*in == ':') || (*in == '.'))
- in++;
- if ((*in > 0) && (*in < 0x80)) {
- count = in - ctxt->cur;
- ret = xmlStrndup(ctxt->cur, count);
- ctxt->cur = in;
- return(ret);
- }
- }
- return(xmlXPathParseNameComplex(ctxt, 1));
-}
-
-static xmlChar *
-xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) {
- xmlChar buf[XML_MAX_NAMELEN + 5];
- int len = 0, l;
- int c;
-
- /*
- * Handler for more complex cases
- */
- c = CUR_CHAR(l);
- if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */
- (c == '[') || (c == ']') || (c == '@') || /* accelerators */
- (c == '*') || /* accelerators */
- (!IS_LETTER(c) && (c != '_') &&
- ((qualified) && (c != ':')))) {
- return(NULL);
- }
-
- while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */
- ((IS_LETTER(c)) || (IS_DIGIT(c)) ||
- (c == '.') || (c == '-') ||
- (c == '_') || ((qualified) && (c == ':')) ||
- (IS_COMBINING(c)) ||
- (IS_EXTENDER(c)))) {
- COPY_BUF(l,buf,len,c);
- NEXTL(l);
- c = CUR_CHAR(l);
- if (len >= XML_MAX_NAMELEN) {
- /*
- * Okay someone managed to make a huge name, so he's ready to pay
- * for the processing speed.
- */
- xmlChar *buffer;
- int max = len * 2;
-
- buffer = (xmlChar *) xmlMalloc(max * sizeof(xmlChar));
- if (buffer == NULL) {
- XP_ERROR0(XPATH_MEMORY_ERROR);
- }
- memcpy(buffer, buf, len);
- while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigname.xml */
- (c == '.') || (c == '-') ||
- (c == '_') || ((qualified) && (c == ':')) ||
- (IS_COMBINING(c)) ||
- (IS_EXTENDER(c))) {
- if (len + 10 > max) {
- max *= 2;
- buffer = (xmlChar *) xmlRealloc(buffer,
- max * sizeof(xmlChar));
- if (buffer == NULL) {
- XP_ERROR0(XPATH_MEMORY_ERROR);
- }
- }
- COPY_BUF(l,buffer,len,c);
- NEXTL(l);
- c = CUR_CHAR(l);
- }
- buffer[len] = 0;
- return(buffer);
- }
- }
- if (len == 0)
- return(NULL);
- return(xmlStrndup(buf, len));
-}
-
-#define MAX_FRAC 20
-
-static double my_pow10[MAX_FRAC] = {
- 1.0, 10.0, 100.0, 1000.0, 10000.0,
- 100000.0, 1000000.0, 10000000.0, 100000000.0, 1000000000.0,
- 10000000000.0, 100000000000.0, 1000000000000.0, 10000000000000.0,
- 100000000000000.0,
- 1000000000000000.0, 10000000000000000.0, 100000000000000000.0,
- 1000000000000000000.0, 10000000000000000000.0
-};
-
-/**
- * xmlXPathStringEvalNumber:
- * @str: A string to scan
- *
- * [30a] Float ::= Number ('e' Digits?)?
- *
- * [30] Number ::= Digits ('.' Digits?)?
- * | '.' Digits
- * [31] Digits ::= [0-9]+
- *
- * Compile a Number in the string
- * In complement of the Number expression, this function also handles
- * negative values : '-' Number.
- *
- * Returns the double value.
- */
-double
-xmlXPathStringEvalNumber(const xmlChar *str) {
- const xmlChar *cur = str;
- double ret;
- int ok = 0;
- int isneg = 0;
- int exponent = 0;
- int is_exponent_negative = 0;
-#ifdef __GNUC__
- unsigned long tmp = 0;
- double temp;
-#endif
- if (cur == NULL) return(0);
- while (IS_BLANK(*cur)) cur++;
- if ((*cur != '.') && ((*cur < '0') || (*cur > '9')) && (*cur != '-')) {
- return(xmlXPathNAN);
- }
- if (*cur == '-') {
- isneg = 1;
- cur++;
- }
-
-#ifdef __GNUC__
- /*
- * tmp/temp is a workaround against a gcc compiler bug
- * http://veillard.com/gcc.bug
- */
- ret = 0;
- while ((*cur >= '0') && (*cur <= '9')) {
- ret = ret * 10;
- tmp = (*cur - '0');
- ok = 1;
- cur++;
- temp = (double) tmp;
- ret = ret + temp;
- }
-#else
- ret = 0;
- while ((*cur >= '0') && (*cur <= '9')) {
- ret = ret * 10 + (*cur - '0');
- ok = 1;
- cur++;
- }
-#endif
-
- if (*cur == '.') {
- int v, frac = 0;
- double fraction = 0;
-
- cur++;
- if (((*cur < '0') || (*cur > '9')) && (!ok)) {
- return(xmlXPathNAN);
- }
- while (((*cur >= '0') && (*cur <= '9')) && (frac < MAX_FRAC)) {
- v = (*cur - '0');
- fraction = fraction * 10 + v;
- frac = frac + 1;
- cur++;
- }
- fraction /= my_pow10[frac];
- ret = ret + fraction;
- while ((*cur >= '0') && (*cur <= '9'))
- cur++;
- }
- if ((*cur == 'e') || (*cur == 'E')) {
- cur++;
- if (*cur == '-') {
- is_exponent_negative = 1;
- cur++;
- }
- while ((*cur >= '0') && (*cur <= '9')) {
- exponent = exponent * 10 + (*cur - '0');
- cur++;
- }
- }
- while (IS_BLANK(*cur)) cur++;
- if (*cur != 0) return(xmlXPathNAN);
- if (isneg) ret = -ret;
- if (is_exponent_negative) exponent = -exponent;
- ret *= pow(10.0, (double)exponent);
- return(ret);
-}
-
-/**
- * xmlXPathCompNumber:
- * @ctxt: the XPath Parser context
- *
- * [30] Number ::= Digits ('.' Digits?)?
- * | '.' Digits
- * [31] Digits ::= [0-9]+
- *
- * Compile a Number, then push it on the stack
- *
- */
-static void
-xmlXPathCompNumber(xmlXPathParserContextPtr ctxt)
-{
- double ret = 0.0;
- double mult = 1;
- int ok = 0;
- int exponent = 0;
- int is_exponent_negative = 0;
-#ifdef __GNUC__
- unsigned long tmp = 0;
- double temp;
-#endif
-
- CHECK_ERROR;
- if ((CUR != '.') && ((CUR < '0') || (CUR > '9'))) {
- XP_ERROR(XPATH_NUMBER_ERROR);
- }
-#ifdef __GNUC__
- /*
- * tmp/temp is a workaround against a gcc compiler bug
- * http://veillard.com/gcc.bug
- */
- ret = 0;
- while ((CUR >= '0') && (CUR <= '9')) {
- ret = ret * 10;
- tmp = (CUR - '0');
- ok = 1;
- NEXT;
- temp = (double) tmp;
- ret = ret + temp;
- }
-#else
- ret = 0;
- while ((CUR >= '0') && (CUR <= '9')) {
- ret = ret * 10 + (CUR - '0');
- ok = 1;
- NEXT;
- }
-#endif
- if (CUR == '.') {
- NEXT;
- if (((CUR < '0') || (CUR > '9')) && (!ok)) {
- XP_ERROR(XPATH_NUMBER_ERROR);
- }
- while ((CUR >= '0') && (CUR <= '9')) {
- mult /= 10;
- ret = ret + (CUR - '0') * mult;
- NEXT;
- }
- }
- if ((CUR == 'e') || (CUR == 'E')) {
- NEXT;
- if (CUR == '-') {
- is_exponent_negative = 1;
- NEXT;
- }
- while ((CUR >= '0') && (CUR <= '9')) {
- exponent = exponent * 10 + (CUR - '0');
- NEXT;
- }
- if (is_exponent_negative)
- exponent = -exponent;
- ret *= pow(10.0, (double) exponent);
- }
- PUSH_LONG_EXPR(XPATH_OP_VALUE, XPATH_NUMBER, 0, 0,
- xmlXPathNewFloat(ret), NULL);
-}
-
-/**
- * xmlXPathParseLiteral:
- * @ctxt: the XPath Parser context
- *
- * Parse a Literal
- *
- * [29] Literal ::= '"' [^"]* '"'
- * | "'" [^']* "'"
- *
- * Returns the value found or NULL in case of error
- */
-static xmlChar *
-xmlXPathParseLiteral(xmlXPathParserContextPtr ctxt) {
- const xmlChar *q;
- xmlChar *ret = NULL;
-
- if (CUR == '"') {
- NEXT;
- q = CUR_PTR;
- while ((IS_CHAR(CUR)) && (CUR != '"'))
- NEXT;
- if (!IS_CHAR(CUR)) {
- XP_ERROR0(XPATH_UNFINISHED_LITERAL_ERROR);
- } else {
- ret = xmlStrndup(q, CUR_PTR - q);
- NEXT;
- }
- } else if (CUR == '\'') {
- NEXT;
- q = CUR_PTR;
- while ((IS_CHAR(CUR)) && (CUR != '\''))
- NEXT;
- if (!IS_CHAR(CUR)) {
- XP_ERROR0(XPATH_UNFINISHED_LITERAL_ERROR);
- } else {
- ret = xmlStrndup(q, CUR_PTR - q);
- NEXT;
- }
- } else {
- XP_ERROR0(XPATH_START_LITERAL_ERROR);
- }
- return(ret);
-}
-
-/**
- * xmlXPathCompLiteral:
- * @ctxt: the XPath Parser context
- *
- * Parse a Literal and push it on the stack.
- *
- * [29] Literal ::= '"' [^"]* '"'
- * | "'" [^']* "'"
- *
- * TODO: xmlXPathCompLiteral memory allocation could be improved.
- */
-static void
-xmlXPathCompLiteral(xmlXPathParserContextPtr ctxt) {
- const xmlChar *q;
- xmlChar *ret = NULL;
-
- if (CUR == '"') {
- NEXT;
- q = CUR_PTR;
- while ((IS_CHAR(CUR)) && (CUR != '"'))
- NEXT;
- if (!IS_CHAR(CUR)) {
- XP_ERROR(XPATH_UNFINISHED_LITERAL_ERROR);
- } else {
- ret = xmlStrndup(q, CUR_PTR - q);
- NEXT;
- }
- } else if (CUR == '\'') {
- NEXT;
- q = CUR_PTR;
- while ((IS_CHAR(CUR)) && (CUR != '\''))
- NEXT;
- if (!IS_CHAR(CUR)) {
- XP_ERROR(XPATH_UNFINISHED_LITERAL_ERROR);
- } else {
- ret = xmlStrndup(q, CUR_PTR - q);
- NEXT;
- }
- } else {
- XP_ERROR(XPATH_START_LITERAL_ERROR);
- }
- if (ret == NULL) return;
- PUSH_LONG_EXPR(XPATH_OP_VALUE, XPATH_STRING, 0, 0,
- xmlXPathNewString(ret), NULL);
- xmlFree(ret);
-}
-
-/**
- * xmlXPathCompVariableReference:
- * @ctxt: the XPath Parser context
- *
- * Parse a VariableReference, evaluate it and push it on the stack.
- *
- * The variable bindings consist of a mapping from variable names
- * to variable values. The value of a variable is an object, which
- * of any of the types that are possible for the value of an expression,
- * and may also be of additional types not specified here.
- *
- * Early evaluation is possible since:
- * The variable bindings [...] used to evaluate a subexpression are
- * always the same as those used to evaluate the containing expression.
- *
- * [36] VariableReference ::= '$' QName
- */
-static void
-xmlXPathCompVariableReference(xmlXPathParserContextPtr ctxt) {
- xmlChar *name;
- xmlChar *prefix;
-
- SKIP_BLANKS;
- if (CUR != '$') {
- XP_ERROR(XPATH_VARIABLE_REF_ERROR);
- }
- NEXT;
- name = xmlXPathParseQName(ctxt, &prefix);
- if (name == NULL) {
- XP_ERROR(XPATH_VARIABLE_REF_ERROR);
- }
- ctxt->comp->last = -1;
- PUSH_LONG_EXPR(XPATH_OP_VARIABLE, 0, 0, 0,
- name, prefix);
- SKIP_BLANKS;
-}
-
-/**
- * xmlXPathIsNodeType:
- * @name: a name string
- *
- * Is the name given a NodeType one.
- *
- * [38] NodeType ::= 'comment'
- * | 'text'
- * | 'processing-instruction'
- * | 'node'
- *
- * Returns 1 if true 0 otherwise
- */
-int
-xmlXPathIsNodeType(const xmlChar *name) {
- if (name == NULL)
- return(0);
-
- if (xmlStrEqual(name, BAD_CAST "node"))
- return(1);
- if (xmlStrEqual(name, BAD_CAST "text"))
- return(1);
- if (xmlStrEqual(name, BAD_CAST "comment"))
- return(1);
- if (xmlStrEqual(name, BAD_CAST "processing-instruction"))
- return(1);
- return(0);
-}
-
-/**
- * xmlXPathCompFunctionCall:
- * @ctxt: the XPath Parser context
- *
- * [16] FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')'
- * [17] Argument ::= Expr
- *
- * Compile a function call, the evaluation of all arguments are
- * pushed on the stack
- */
-static void
-xmlXPathCompFunctionCall(xmlXPathParserContextPtr ctxt) {
- xmlChar *name;
- xmlChar *prefix;
- int nbargs = 0;
-
- name = xmlXPathParseQName(ctxt, &prefix);
- if (name == NULL) {
- XP_ERROR(XPATH_EXPR_ERROR);
- }
- SKIP_BLANKS;
-#ifdef DEBUG_EXPR
- if (prefix == NULL)
- xmlGenericError(xmlGenericErrorContext, "Calling function %s\n",
- name);
- else
- xmlGenericError(xmlGenericErrorContext, "Calling function %s:%s\n",
- prefix, name);
-#endif
-
- if (CUR != '(') {
- XP_ERROR(XPATH_EXPR_ERROR);
- }
- NEXT;
- SKIP_BLANKS;
-
- ctxt->comp->last = -1;
- while (CUR != ')') {
- int op1 = ctxt->comp->last;
- ctxt->comp->last = -1;
- xmlXPathCompileExpr(ctxt);
- CHECK_ERROR;
- PUSH_BINARY_EXPR(XPATH_OP_ARG, op1, ctxt->comp->last, 0, 0);
- nbargs++;
- if (CUR == ')') break;
- if (CUR != ',') {
- XP_ERROR(XPATH_EXPR_ERROR);
- }
- NEXT;
- SKIP_BLANKS;
- }
- PUSH_LONG_EXPR(XPATH_OP_FUNCTION, nbargs, 0, 0,
- name, prefix);
- NEXT;
- SKIP_BLANKS;
-}
-
-/**
- * xmlXPathCompPrimaryExpr:
- * @ctxt: the XPath Parser context
- *
- * [15] PrimaryExpr ::= VariableReference
- * | '(' Expr ')'
- * | Literal
- * | Number
- * | FunctionCall
- *
- * Compile a primary expression.
- */
-static void
-xmlXPathCompPrimaryExpr(xmlXPathParserContextPtr ctxt) {
- SKIP_BLANKS;
- if (CUR == '$') xmlXPathCompVariableReference(ctxt);
- else if (CUR == '(') {
- NEXT;
- SKIP_BLANKS;
- xmlXPathCompileExpr(ctxt);
- CHECK_ERROR;
- if (CUR != ')') {
- XP_ERROR(XPATH_EXPR_ERROR);
- }
- NEXT;
- SKIP_BLANKS;
- } else if (IS_DIGIT(CUR) || (CUR == '.' && IS_DIGIT(NXT(1)))) {
- xmlXPathCompNumber(ctxt);
- } else if ((CUR == '\'') || (CUR == '"')) {
- xmlXPathCompLiteral(ctxt);
- } else {
- xmlXPathCompFunctionCall(ctxt);
- }
- SKIP_BLANKS;
-}
-
-/**
- * xmlXPathCompFilterExpr:
- * @ctxt: the XPath Parser context
- *
- * [20] FilterExpr ::= PrimaryExpr
- * | FilterExpr Predicate
- *
- * Compile a filter expression.
- * Square brackets are used to filter expressions in the same way that
- * they are used in location paths. It is an error if the expression to
- * be filtered does not evaluate to a node-set. The context node list
- * used for evaluating the expression in square brackets is the node-set
- * to be filtered listed in document order.
- */
-
-static void
-xmlXPathCompFilterExpr(xmlXPathParserContextPtr ctxt) {
- xmlXPathCompPrimaryExpr(ctxt);
- CHECK_ERROR;
- SKIP_BLANKS;
-
- while (CUR == '[') {
- xmlXPathCompPredicate(ctxt, 1);
- SKIP_BLANKS;
- }
-
-
-}
-
-/**
- * xmlXPathScanName:
- * @ctxt: the XPath Parser context
- *
- * Trickery: parse an XML name but without consuming the input flow
- * Needed to avoid insanity in the parser state.
- *
- * [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |
- * CombiningChar | Extender
- *
- * [5] Name ::= (Letter | '_' | ':') (NameChar)*
- *
- * [6] Names ::= Name (S Name)*
- *
- * Returns the Name parsed or NULL
- */
-
-static xmlChar *
-xmlXPathScanName(xmlXPathParserContextPtr ctxt) {
- xmlChar buf[XML_MAX_NAMELEN];
- int len = 0;
-
- SKIP_BLANKS;
- if (!IS_LETTER(CUR) && (CUR != '_') &&
- (CUR != ':')) {
- return(NULL);
- }
-
- while ((IS_LETTER(NXT(len))) || (IS_DIGIT(NXT(len))) ||
- (NXT(len) == '.') || (NXT(len) == '-') ||
- (NXT(len) == '_') || (NXT(len) == ':') ||
- (IS_COMBINING(NXT(len))) ||
- (IS_EXTENDER(NXT(len)))) {
- buf[len] = NXT(len);
- len++;
- if (len >= XML_MAX_NAMELEN) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlScanName: reached XML_MAX_NAMELEN limit\n");
- while ((IS_LETTER(NXT(len))) || (IS_DIGIT(NXT(len))) ||
- (NXT(len) == '.') || (NXT(len) == '-') ||
- (NXT(len) == '_') || (NXT(len) == ':') ||
- (IS_COMBINING(NXT(len))) ||
- (IS_EXTENDER(NXT(len))))
- len++;
- break;
- }
- }
- return(xmlStrndup(buf, len));
-}
-
-/**
- * xmlXPathCompPathExpr:
- * @ctxt: the XPath Parser context
- *
- * [19] PathExpr ::= LocationPath
- * | FilterExpr
- * | FilterExpr '/' RelativeLocationPath
- * | FilterExpr '//' RelativeLocationPath
- *
- * Compile a path expression.
- * The / operator and // operators combine an arbitrary expression
- * and a relative location path. It is an error if the expression
- * does not evaluate to a node-set.
- * The / operator does composition in the same way as when / is
- * used in a location path. As in location paths, // is short for
- * /descendant-or-self::node()/.
- */
-
-static void
-xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) {
- int lc = 1; /* Should we branch to LocationPath ? */
- xmlChar *name = NULL; /* we may have to preparse a name to find out */
-
- SKIP_BLANKS;
- if ((CUR == '$') || (CUR == '(') || (IS_DIGIT(CUR)) ||
- (CUR == '\'') || (CUR == '"') || (CUR == '.' && IS_DIGIT(NXT(1)))) {
- lc = 0;
- } else if (CUR == '*') {
- /* relative or absolute location path */
- lc = 1;
- } else if (CUR == '/') {
- /* relative or absolute location path */
- lc = 1;
- } else if (CUR == '@') {
- /* relative abbreviated attribute location path */
- lc = 1;
- } else if (CUR == '.') {
- /* relative abbreviated attribute location path */
- lc = 1;
- } else {
- /*
- * Problem is finding if we have a name here whether it's:
- * - a nodetype
- * - a function call in which case it's followed by '('
- * - an axis in which case it's followed by ':'
- * - a element name
- * We do an a priori analysis here rather than having to
- * maintain parsed token content through the recursive function
- * calls. This looks uglier but makes the code quite easier to
- * read/write/debug.
- */
- SKIP_BLANKS;
- name = xmlXPathScanName(ctxt);
- if ((name != NULL) && (xmlStrstr(name, (xmlChar *) "::") != NULL)) {
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext,
- "PathExpr: Axis\n");
-#endif
- lc = 1;
- xmlFree(name);
- } else if (name != NULL) {
- int len =xmlStrlen(name);
- int blank = 0;
-
-
- while (NXT(len) != 0) {
- if (NXT(len) == '/') {
- /* element name */
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext,
- "PathExpr: AbbrRelLocation\n");
-#endif
- lc = 1;
- break;
- } else if (IS_BLANK(NXT(len))) {
- /* skip to next */
- blank = 1;
- } else if (NXT(len) == ':') {
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext,
- "PathExpr: AbbrRelLocation\n");
-#endif
- lc = 1;
- break;
- } else if ((NXT(len) == '(')) {
- /* Note Type or Function */
- if (xmlXPathIsNodeType(name)) {
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext,
- "PathExpr: Type search\n");
-#endif
- lc = 1;
- } else {
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext,
- "PathExpr: function call\n");
-#endif
- lc = 0;
- }
- break;
- } else if ((NXT(len) == '[')) {
- /* element name */
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext,
- "PathExpr: AbbrRelLocation\n");
-#endif
- lc = 1;
- break;
- } else if ((NXT(len) == '<') || (NXT(len) == '>') ||
- (NXT(len) == '=')) {
- lc = 1;
- break;
- } else {
- lc = 1;
- break;
- }
- len++;
- }
- if (NXT(len) == 0) {
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext,
- "PathExpr: AbbrRelLocation\n");
-#endif
- /* element name */
- lc = 1;
- }
- xmlFree(name);
- } else {
- /* make sure all cases are covered explicitely */
- XP_ERROR(XPATH_EXPR_ERROR);
- }
- }
-
- if (lc) {
- if (CUR == '/') {
- PUSH_LEAVE_EXPR(XPATH_OP_ROOT, 0, 0);
- } else {
- PUSH_LEAVE_EXPR(XPATH_OP_NODE, 0, 0);
- }
- xmlXPathCompLocationPath(ctxt);
- } else {
- xmlXPathCompFilterExpr(ctxt);
- CHECK_ERROR;
- if ((CUR == '/') && (NXT(1) == '/')) {
- SKIP(2);
- SKIP_BLANKS;
-
- PUSH_LONG_EXPR(XPATH_OP_COLLECT, AXIS_DESCENDANT_OR_SELF,
- NODE_TEST_TYPE, NODE_TYPE_NODE, NULL, NULL);
- PUSH_UNARY_EXPR(XPATH_OP_RESET, ctxt->comp->last, 1, 0);
-
- xmlXPathCompRelativeLocationPath(ctxt);
- } else if (CUR == '/') {
- xmlXPathCompRelativeLocationPath(ctxt);
- }
- }
- SKIP_BLANKS;
-}
-
-/**
- * xmlXPathCompUnionExpr:
- * @ctxt: the XPath Parser context
- *
- * [18] UnionExpr ::= PathExpr
- * | UnionExpr '|' PathExpr
- *
- * Compile an union expression.
- */
-
-static void
-xmlXPathCompUnionExpr(xmlXPathParserContextPtr ctxt) {
- xmlXPathCompPathExpr(ctxt);
- CHECK_ERROR;
- SKIP_BLANKS;
- while (CUR == '|') {
- int op1 = ctxt->comp->last;
- PUSH_LEAVE_EXPR(XPATH_OP_NODE, 0, 0);
-
- NEXT;
- SKIP_BLANKS;
- xmlXPathCompPathExpr(ctxt);
-
- PUSH_BINARY_EXPR(XPATH_OP_UNION, op1, ctxt->comp->last, 0, 0);
-
- SKIP_BLANKS;
- }
-}
-
-/**
- * xmlXPathCompUnaryExpr:
- * @ctxt: the XPath Parser context
- *
- * [27] UnaryExpr ::= UnionExpr
- * | '-' UnaryExpr
- *
- * Compile an unary expression.
- */
-
-static void
-xmlXPathCompUnaryExpr(xmlXPathParserContextPtr ctxt) {
- int minus = 0;
- int found = 0;
-
- SKIP_BLANKS;
- while (CUR == '-') {
- minus = 1 - minus;
- found = 1;
- NEXT;
- SKIP_BLANKS;
- }
-
- xmlXPathCompUnionExpr(ctxt);
- CHECK_ERROR;
- if (found) {
- if (minus)
- PUSH_UNARY_EXPR(XPATH_OP_PLUS, ctxt->comp->last, 2, 0);
- else
- PUSH_UNARY_EXPR(XPATH_OP_PLUS, ctxt->comp->last, 3, 0);
- }
-}
-
-/**
- * xmlXPathCompMultiplicativeExpr:
- * @ctxt: the XPath Parser context
- *
- * [26] MultiplicativeExpr ::= UnaryExpr
- * | MultiplicativeExpr MultiplyOperator UnaryExpr
- * | MultiplicativeExpr 'div' UnaryExpr
- * | MultiplicativeExpr 'mod' UnaryExpr
- * [34] MultiplyOperator ::= '*'
- *
- * Compile an Additive expression.
- */
-
-static void
-xmlXPathCompMultiplicativeExpr(xmlXPathParserContextPtr ctxt) {
- xmlXPathCompUnaryExpr(ctxt);
- CHECK_ERROR;
- SKIP_BLANKS;
- while ((CUR == '*') ||
- ((CUR == 'd') && (NXT(1) == 'i') && (NXT(2) == 'v')) ||
- ((CUR == 'm') && (NXT(1) == 'o') && (NXT(2) == 'd'))) {
- int op = -1;
- int op1 = ctxt->comp->last;
-
- if (CUR == '*') {
- op = 0;
- NEXT;
- } else if (CUR == 'd') {
- op = 1;
- SKIP(3);
- } else if (CUR == 'm') {
- op = 2;
- SKIP(3);
- }
- SKIP_BLANKS;
- xmlXPathCompUnaryExpr(ctxt);
- CHECK_ERROR;
- PUSH_BINARY_EXPR(XPATH_OP_MULT, op1, ctxt->comp->last, op, 0);
- SKIP_BLANKS;
- }
-}
-
-/**
- * xmlXPathCompAdditiveExpr:
- * @ctxt: the XPath Parser context
- *
- * [25] AdditiveExpr ::= MultiplicativeExpr
- * | AdditiveExpr '+' MultiplicativeExpr
- * | AdditiveExpr '-' MultiplicativeExpr
- *
- * Compile an Additive expression.
- */
-
-static void
-xmlXPathCompAdditiveExpr(xmlXPathParserContextPtr ctxt) {
-
- xmlXPathCompMultiplicativeExpr(ctxt);
- CHECK_ERROR;
- SKIP_BLANKS;
- while ((CUR == '+') || (CUR == '-')) {
- int plus;
- int op1 = ctxt->comp->last;
-
- if (CUR == '+') plus = 1;
- else plus = 0;
- NEXT;
- SKIP_BLANKS;
- xmlXPathCompMultiplicativeExpr(ctxt);
- CHECK_ERROR;
- PUSH_BINARY_EXPR(XPATH_OP_PLUS, op1, ctxt->comp->last, plus, 0);
- SKIP_BLANKS;
- }
-}
-
-/**
- * xmlXPathCompRelationalExpr:
- * @ctxt: the XPath Parser context
- *
- * [24] RelationalExpr ::= AdditiveExpr
- * | RelationalExpr '<' AdditiveExpr
- * | RelationalExpr '>' AdditiveExpr
- * | RelationalExpr '<=' AdditiveExpr
- * | RelationalExpr '>=' AdditiveExpr
- *
- * A <= B > C is allowed ? Answer from James, yes with
- * (AdditiveExpr <= AdditiveExpr) > AdditiveExpr
- * which is basically what got implemented.
- *
- * Compile a Relational expression, then push the result
- * on the stack
- */
-
-static void
-xmlXPathCompRelationalExpr(xmlXPathParserContextPtr ctxt) {
- xmlXPathCompAdditiveExpr(ctxt);
- CHECK_ERROR;
- SKIP_BLANKS;
- while ((CUR == '<') ||
- (CUR == '>') ||
- ((CUR == '<') && (NXT(1) == '=')) ||
- ((CUR == '>') && (NXT(1) == '='))) {
- int inf, strict;
- int op1 = ctxt->comp->last;
-
- if (CUR == '<') inf = 1;
- else inf = 0;
- if (NXT(1) == '=') strict = 0;
- else strict = 1;
- NEXT;
- if (!strict) NEXT;
- SKIP_BLANKS;
- xmlXPathCompAdditiveExpr(ctxt);
- CHECK_ERROR;
- PUSH_BINARY_EXPR(XPATH_OP_CMP, op1, ctxt->comp->last, inf, strict);
- SKIP_BLANKS;
- }
-}
-
-/**
- * xmlXPathCompEqualityExpr:
- * @ctxt: the XPath Parser context
- *
- * [23] EqualityExpr ::= RelationalExpr
- * | EqualityExpr '=' RelationalExpr
- * | EqualityExpr '!=' RelationalExpr
- *
- * A != B != C is allowed ? Answer from James, yes with
- * (RelationalExpr = RelationalExpr) = RelationalExpr
- * (RelationalExpr != RelationalExpr) != RelationalExpr
- * which is basically what got implemented.
- *
- * Compile an Equality expression.
- *
- */
-static void
-xmlXPathCompEqualityExpr(xmlXPathParserContextPtr ctxt) {
- xmlXPathCompRelationalExpr(ctxt);
- CHECK_ERROR;
- SKIP_BLANKS;
- while ((CUR == '=') || ((CUR == '!') && (NXT(1) == '='))) {
- int eq;
- int op1 = ctxt->comp->last;
-
- if (CUR == '=') eq = 1;
- else eq = 0;
- NEXT;
- if (!eq) NEXT;
- SKIP_BLANKS;
- xmlXPathCompRelationalExpr(ctxt);
- CHECK_ERROR;
- PUSH_BINARY_EXPR(XPATH_OP_EQUAL, op1, ctxt->comp->last, eq, 0);
- SKIP_BLANKS;
- }
-}
-
-/**
- * xmlXPathCompAndExpr:
- * @ctxt: the XPath Parser context
- *
- * [22] AndExpr ::= EqualityExpr
- * | AndExpr 'and' EqualityExpr
- *
- * Compile an AND expression.
- *
- */
-static void
-xmlXPathCompAndExpr(xmlXPathParserContextPtr ctxt) {
- xmlXPathCompEqualityExpr(ctxt);
- CHECK_ERROR;
- SKIP_BLANKS;
- while ((CUR == 'a') && (NXT(1) == 'n') && (NXT(2) == 'd')) {
- int op1 = ctxt->comp->last;
- SKIP(3);
- SKIP_BLANKS;
- xmlXPathCompEqualityExpr(ctxt);
- CHECK_ERROR;
- PUSH_BINARY_EXPR(XPATH_OP_AND, op1, ctxt->comp->last, 0, 0);
- SKIP_BLANKS;
- }
-}
-
-/**
- * xmlXPathCompExpr:
- * @ctxt: the XPath Parser context
- *
- * [14] Expr ::= OrExpr
- * [21] OrExpr ::= AndExpr
- * | OrExpr 'or' AndExpr
- *
- * Parse and compile an expression
- */
-static void
-xmlXPathCompileExpr(xmlXPathParserContextPtr ctxt) {
- xmlXPathCompAndExpr(ctxt);
- CHECK_ERROR;
- SKIP_BLANKS;
- while ((CUR == 'o') && (NXT(1) == 'r')) {
- int op1 = ctxt->comp->last;
- SKIP(2);
- SKIP_BLANKS;
- xmlXPathCompAndExpr(ctxt);
- CHECK_ERROR;
- PUSH_BINARY_EXPR(XPATH_OP_OR, op1, ctxt->comp->last, 0, 0);
- op1 = ctxt->comp->nbStep;
- SKIP_BLANKS;
- }
- if (ctxt->comp->steps[ctxt->comp->last].op != XPATH_OP_VALUE) {
- /* more ops could be optimized too */
- PUSH_UNARY_EXPR(XPATH_OP_SORT, ctxt->comp->last , 0, 0);
- }
-}
-
-/**
- * xmlXPathCompPredicate:
- * @ctxt: the XPath Parser context
- * @filter: act as a filter
- *
- * [8] Predicate ::= '[' PredicateExpr ']'
- * [9] PredicateExpr ::= Expr
- *
- * Compile a predicate expression
- */
-static void
-xmlXPathCompPredicate(xmlXPathParserContextPtr ctxt, int filter) {
- int op1 = ctxt->comp->last;
-
- SKIP_BLANKS;
- if (CUR != '[') {
- XP_ERROR(XPATH_INVALID_PREDICATE_ERROR);
- }
- NEXT;
- SKIP_BLANKS;
-
- ctxt->comp->last = -1;
- xmlXPathCompileExpr(ctxt);
- CHECK_ERROR;
-
- if (CUR != ']') {
- XP_ERROR(XPATH_INVALID_PREDICATE_ERROR);
- }
-
- if (filter)
- PUSH_BINARY_EXPR(XPATH_OP_FILTER, op1, ctxt->comp->last, 0, 0);
- else
- PUSH_BINARY_EXPR(XPATH_OP_PREDICATE, op1, ctxt->comp->last, 0, 0);
-
- NEXT;
- SKIP_BLANKS;
-}
-
-/**
- * xmlXPathCompNodeTest:
- * @ctxt: the XPath Parser context
- * @test: pointer to a xmlXPathTestVal
- * @type: pointer to a xmlXPathTypeVal
- * @prefix: placeholder for a possible name prefix
- *
- * [7] NodeTest ::= NameTest
- * | NodeType '(' ')'
- * | 'processing-instruction' '(' Literal ')'
- *
- * [37] NameTest ::= '*'
- * | NCName ':' '*'
- * | QName
- * [38] NodeType ::= 'comment'
- * | 'text'
- * | 'processing-instruction'
- * | 'node'
- *
- * Returns the name found and update @test, @type and @prefix appropriately
- */
-static xmlChar *
-xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test,
- xmlXPathTypeVal *type, const xmlChar **prefix,
- xmlChar *name) {
- int blanks;
-
- if ((test == NULL) || (type == NULL) || (prefix == NULL)) {
- STRANGE;
- return(NULL);
- }
- *type = 0;
- *test = 0;
- *prefix = NULL;
- SKIP_BLANKS;
-
- if ((name == NULL) && (CUR == '*')) {
- /*
- * All elements
- */
- NEXT;
- *test = NODE_TEST_ALL;
- return(NULL);
- }
-
- if (name == NULL)
- name = xmlXPathParseNCName(ctxt);
- if (name == NULL) {
- XP_ERROR0(XPATH_EXPR_ERROR);
- }
-
- blanks = IS_BLANK(CUR);
- SKIP_BLANKS;
- if (CUR == '(') {
- NEXT;
- /*
- * NodeType or PI search
- */
- if (xmlStrEqual(name, BAD_CAST "comment"))
- *type = NODE_TYPE_COMMENT;
- else if (xmlStrEqual(name, BAD_CAST "node"))
- *type = NODE_TYPE_NODE;
- else if (xmlStrEqual(name, BAD_CAST "processing-instruction"))
- *type = NODE_TYPE_PI;
- else if (xmlStrEqual(name, BAD_CAST "text"))
- *type = NODE_TYPE_TEXT;
- else {
- if (name != NULL)
- xmlFree(name);
- XP_ERROR0(XPATH_EXPR_ERROR);
- }
-
- *test = NODE_TEST_TYPE;
-
- SKIP_BLANKS;
- if (*type == NODE_TYPE_PI) {
- /*
- * Specific case: search a PI by name.
- */
- if (name != NULL)
- xmlFree(name);
- name = NULL;
- if (CUR != ')') {
- name = xmlXPathParseLiteral(ctxt);
- CHECK_ERROR 0;
- *test = NODE_TEST_PI;
- SKIP_BLANKS;
- }
- }
- if (CUR != ')') {
- if (name != NULL)
- xmlFree(name);
- XP_ERROR0(XPATH_UNCLOSED_ERROR);
- }
- NEXT;
- return(name);
- }
- *test = NODE_TEST_NAME;
- if ((!blanks) && (CUR == ':')) {
- NEXT;
-
- /*
- * Since currently the parser context don't have a
- * namespace list associated:
- * The namespace name for this prefix can be computed
- * only at evaluation time. The compilation is done
- * outside of any context.
- */
-#if 0
- *prefix = xmlXPathNsLookup(ctxt->context, name);
- if (name != NULL)
- xmlFree(name);
- if (*prefix == NULL) {
- XP_ERROR0(XPATH_UNDEF_PREFIX_ERROR);
- }
-#else
- *prefix = name;
-#endif
-
- if (CUR == '*') {
- /*
- * All elements
- */
- NEXT;
- *test = NODE_TEST_ALL;
- return(NULL);
- }
-
- name = xmlXPathParseNCName(ctxt);
- if (name == NULL) {
- XP_ERROR0(XPATH_EXPR_ERROR);
- }
- }
- return(name);
-}
-
-/**
- * xmlXPathIsAxisName:
- * @name: a preparsed name token
- *
- * [6] AxisName ::= 'ancestor'
- * | 'ancestor-or-self'
- * | 'attribute'
- * | 'child'
- * | 'descendant'
- * | 'descendant-or-self'
- * | 'following'
- * | 'following-sibling'
- * | 'namespace'
- * | 'parent'
- * | 'preceding'
- * | 'preceding-sibling'
- * | 'self'
- *
- * Returns the axis or 0
- */
-static xmlXPathAxisVal
-xmlXPathIsAxisName(const xmlChar *name) {
- xmlXPathAxisVal ret = 0;
- switch (name[0]) {
- case 'a':
- if (xmlStrEqual(name, BAD_CAST "ancestor"))
- ret = AXIS_ANCESTOR;
- if (xmlStrEqual(name, BAD_CAST "ancestor-or-self"))
- ret = AXIS_ANCESTOR_OR_SELF;
- if (xmlStrEqual(name, BAD_CAST "attribute"))
- ret = AXIS_ATTRIBUTE;
- break;
- case 'c':
- if (xmlStrEqual(name, BAD_CAST "child"))
- ret = AXIS_CHILD;
- break;
- case 'd':
- if (xmlStrEqual(name, BAD_CAST "descendant"))
- ret = AXIS_DESCENDANT;
- if (xmlStrEqual(name, BAD_CAST "descendant-or-self"))
- ret = AXIS_DESCENDANT_OR_SELF;
- break;
- case 'f':
- if (xmlStrEqual(name, BAD_CAST "following"))
- ret = AXIS_FOLLOWING;
- if (xmlStrEqual(name, BAD_CAST "following-sibling"))
- ret = AXIS_FOLLOWING_SIBLING;
- break;
- case 'n':
- if (xmlStrEqual(name, BAD_CAST "namespace"))
- ret = AXIS_NAMESPACE;
- break;
- case 'p':
- if (xmlStrEqual(name, BAD_CAST "parent"))
- ret = AXIS_PARENT;
- if (xmlStrEqual(name, BAD_CAST "preceding"))
- ret = AXIS_PRECEDING;
- if (xmlStrEqual(name, BAD_CAST "preceding-sibling"))
- ret = AXIS_PRECEDING_SIBLING;
- break;
- case 's':
- if (xmlStrEqual(name, BAD_CAST "self"))
- ret = AXIS_SELF;
- break;
- }
- return(ret);
-}
-
-/**
- * xmlXPathCompStep:
- * @ctxt: the XPath Parser context
- *
- * [4] Step ::= AxisSpecifier NodeTest Predicate*
- * | AbbreviatedStep
- *
- * [12] AbbreviatedStep ::= '.' | '..'
- *
- * [5] AxisSpecifier ::= AxisName '::'
- * | AbbreviatedAxisSpecifier
- *
- * [13] AbbreviatedAxisSpecifier ::= '@'?
- *
- * Modified for XPtr range support as:
- *
- * [4xptr] Step ::= AxisSpecifier NodeTest Predicate*
- * | AbbreviatedStep
- * | 'range-to' '(' Expr ')' Predicate*
- *
- * Compile one step in a Location Path
- * A location step of . is short for self::node(). This is
- * particularly useful in conjunction with //. For example, the
- * location path .//para is short for
- * self::node()/descendant-or-self::node()/child::para
- * and so will select all para descendant elements of the context
- * node.
- * Similarly, a location step of .. is short for parent::node().
- * For example, ../title is short for parent::node()/child::title
- * and so will select the title children of the parent of the context
- * node.
- */
-static void
-xmlXPathCompStep(xmlXPathParserContextPtr ctxt) {
-#ifdef LIBXML_XPTR_ENABLED
- int rangeto = 0;
- int op2 = -1;
-#endif
-
- SKIP_BLANKS;
- if ((CUR == '.') && (NXT(1) == '.')) {
- SKIP(2);
- SKIP_BLANKS;
- PUSH_LONG_EXPR(XPATH_OP_COLLECT, AXIS_PARENT,
- NODE_TEST_TYPE, NODE_TYPE_NODE, NULL, NULL);
- } else if (CUR == '.') {
- NEXT;
- SKIP_BLANKS;
- } else {
- xmlChar *name = NULL;
- const xmlChar *prefix = NULL;
- xmlXPathTestVal test;
- xmlXPathAxisVal axis = 0;
- xmlXPathTypeVal type;
- int op1;
-
- /*
- * The modification needed for XPointer change to the production
- */
-#ifdef LIBXML_XPTR_ENABLED
- if (ctxt->xptr) {
- name = xmlXPathParseNCName(ctxt);
- if ((name != NULL) && (xmlStrEqual(name, BAD_CAST "range-to"))) {
- op2 = ctxt->comp->last;
- xmlFree(name);
- SKIP_BLANKS;
- if (CUR != '(') {
- XP_ERROR(XPATH_EXPR_ERROR);
- }
- NEXT;
- SKIP_BLANKS;
-
- xmlXPathCompileExpr(ctxt);
- /* PUSH_BINARY_EXPR(XPATH_OP_RANGETO, op2, ctxt->comp->last, 0, 0); */
- CHECK_ERROR;
-
- SKIP_BLANKS;
- if (CUR != ')') {
- XP_ERROR(XPATH_EXPR_ERROR);
- }
- NEXT;
- rangeto = 1;
- goto eval_predicates;
- }
- }
-#endif
- if (CUR == '*') {
- axis = AXIS_CHILD;
- } else {
- if (name == NULL)
- name = xmlXPathParseNCName(ctxt);
- if (name != NULL) {
- axis = xmlXPathIsAxisName(name);
- if (axis != 0) {
- SKIP_BLANKS;
- if ((CUR == ':') && (NXT(1) == ':')) {
- SKIP(2);
- xmlFree(name);
- name = NULL;
- } else {
- /* an element name can conflict with an axis one :-\ */
- axis = AXIS_CHILD;
- }
- } else {
- axis = AXIS_CHILD;
- }
- } else if (CUR == '@') {
- NEXT;
- axis = AXIS_ATTRIBUTE;
- } else {
- axis = AXIS_CHILD;
- }
- }
-
- CHECK_ERROR;
-
- name = xmlXPathCompNodeTest(ctxt, &test, &type, &prefix, name);
- if (test == 0)
- return;
-
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext,
- "Basis : computing new set\n");
-#endif
-
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext, "Basis : ");
- if (ctxt->value == NULL)
- xmlGenericError(xmlGenericErrorContext, "no value\n");
- else if (ctxt->value->nodesetval == NULL)
- xmlGenericError(xmlGenericErrorContext, "Empty\n");
- else
- xmlGenericErrorContextNodeSet(stdout, ctxt->value->nodesetval);
-#endif
-
-eval_predicates:
- op1 = ctxt->comp->last;
- ctxt->comp->last = -1;
-
- SKIP_BLANKS;
- while (CUR == '[') {
- xmlXPathCompPredicate(ctxt, 0);
- }
-
-#ifdef LIBXML_XPTR_ENABLED
- if (rangeto) {
- PUSH_BINARY_EXPR(XPATH_OP_RANGETO, op2, op1, 0, 0);
- } else
-#endif
- PUSH_FULL_EXPR(XPATH_OP_COLLECT, op1, ctxt->comp->last, axis,
- test, type, (void *)prefix, (void *)name);
-
- }
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext, "Step : ");
- if (ctxt->value == NULL)
- xmlGenericError(xmlGenericErrorContext, "no value\n");
- else if (ctxt->value->nodesetval == NULL)
- xmlGenericError(xmlGenericErrorContext, "Empty\n");
- else
- xmlGenericErrorContextNodeSet(xmlGenericErrorContext,
- ctxt->value->nodesetval);
-#endif
-}
-
-/**
- * xmlXPathCompRelativeLocationPath:
- * @ctxt: the XPath Parser context
- *
- * [3] RelativeLocationPath ::= Step
- * | RelativeLocationPath '/' Step
- * | AbbreviatedRelativeLocationPath
- * [11] AbbreviatedRelativeLocationPath ::= RelativeLocationPath '//' Step
- *
- * Compile a relative location path.
- */
-static void
-xmlXPathCompRelativeLocationPath
-(xmlXPathParserContextPtr ctxt) {
- SKIP_BLANKS;
- if ((CUR == '/') && (NXT(1) == '/')) {
- SKIP(2);
- SKIP_BLANKS;
- PUSH_LONG_EXPR(XPATH_OP_COLLECT, AXIS_DESCENDANT_OR_SELF,
- NODE_TEST_TYPE, NODE_TYPE_NODE, NULL, NULL);
- } else if (CUR == '/') {
- NEXT;
- SKIP_BLANKS;
- }
- xmlXPathCompStep(ctxt);
- SKIP_BLANKS;
- while (CUR == '/') {
- if ((CUR == '/') && (NXT(1) == '/')) {
- SKIP(2);
- SKIP_BLANKS;
- PUSH_LONG_EXPR(XPATH_OP_COLLECT, AXIS_DESCENDANT_OR_SELF,
- NODE_TEST_TYPE, NODE_TYPE_NODE, NULL, NULL);
- xmlXPathCompStep(ctxt);
- } else if (CUR == '/') {
- NEXT;
- SKIP_BLANKS;
- xmlXPathCompStep(ctxt);
- }
- SKIP_BLANKS;
- }
-}
-
-/**
- * xmlXPathCompLocationPath:
- * @ctxt: the XPath Parser context
- *
- * [1] LocationPath ::= RelativeLocationPath
- * | AbsoluteLocationPath
- * [2] AbsoluteLocationPath ::= '/' RelativeLocationPath?
- * | AbbreviatedAbsoluteLocationPath
- * [10] AbbreviatedAbsoluteLocationPath ::=
- * '//' RelativeLocationPath
- *
- * Compile a location path
- *
- * // is short for /descendant-or-self::node()/. For example,
- * //para is short for /descendant-or-self::node()/child::para and
- * so will select any para element in the document (even a para element
- * that is a document element will be selected by //para since the
- * document element node is a child of the root node); div//para is
- * short for div/descendant-or-self::node()/child::para and so will
- * select all para descendants of div children.
- */
-static void
-xmlXPathCompLocationPath(xmlXPathParserContextPtr ctxt) {
- SKIP_BLANKS;
- if (CUR != '/') {
- xmlXPathCompRelativeLocationPath(ctxt);
- } else {
- while (CUR == '/') {
- if ((CUR == '/') && (NXT(1) == '/')) {
- SKIP(2);
- SKIP_BLANKS;
- PUSH_LONG_EXPR(XPATH_OP_COLLECT, AXIS_DESCENDANT_OR_SELF,
- NODE_TEST_TYPE, NODE_TYPE_NODE, NULL, NULL);
- xmlXPathCompRelativeLocationPath(ctxt);
- } else if (CUR == '/') {
- NEXT;
- SKIP_BLANKS;
- if ((CUR != 0 ) &&
- ((IS_LETTER(CUR)) || (CUR == '_') || (CUR == '.') ||
- (CUR == '@') || (CUR == '*')))
- xmlXPathCompRelativeLocationPath(ctxt);
- }
- }
- }
-}
-
-/************************************************************************
- * *
- * XPath precompiled expression evaluation *
- * *
- ************************************************************************/
-
-static int
-xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op);
-
-/**
- * xmlXPathNodeCollectAndTest:
- * @ctxt: the XPath Parser context
- * @op: the XPath precompiled step operation
- * @first: pointer to the first element in document order
- * @last: pointer to the last element in document order
- *
- * This is the function implementing a step: based on the current list
- * of nodes, it builds up a new list, looking at all nodes under that
- * axis and selecting them it also do the predicate filtering
- *
- * Pushes the new NodeSet resulting from the search.
- *
- * Returns the number of node traversed
- */
-static int
-xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
- xmlXPathStepOpPtr op,
- xmlNodePtr * first, xmlNodePtr * last)
-{
- xmlXPathAxisVal axis = op->value;
- xmlXPathTestVal test = op->value2;
- xmlXPathTypeVal type = op->value3;
- const xmlChar *prefix = op->value4;
- const xmlChar *name = op->value5;
- const xmlChar *URI = NULL;
-
-#ifdef DEBUG_STEP
- int n = 0;
-#endif
- int i, t = 0;
- xmlNodeSetPtr ret, list;
- xmlXPathTraversalFunction next = NULL;
- void (*addNode) (xmlNodeSetPtr, xmlNodePtr);
- xmlNodeSetPtr (*mergeNodeSet) (xmlNodeSetPtr, xmlNodeSetPtr);
- xmlNodePtr cur = NULL;
- xmlXPathObjectPtr obj;
- xmlNodeSetPtr nodelist;
- xmlNodePtr tmp;
-
- CHECK_TYPE0(XPATH_NODESET);
- obj = valuePop(ctxt);
- addNode = xmlXPathNodeSetAdd;
- mergeNodeSet = xmlXPathNodeSetMerge;
- if (prefix != NULL) {
- URI = xmlXPathNsLookup(ctxt->context, prefix);
- if (URI == NULL)
- XP_ERROR0(XPATH_UNDEF_PREFIX_ERROR);
- }
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext, "new step : ");
-#endif
- switch (axis) {
- case AXIS_ANCESTOR:
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext, "axis 'ancestors' ");
-#endif
- first = NULL;
- next = xmlXPathNextAncestor;
- break;
- case AXIS_ANCESTOR_OR_SELF:
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext,
- "axis 'ancestors-or-self' ");
-#endif
- first = NULL;
- next = xmlXPathNextAncestorOrSelf;
- break;
- case AXIS_ATTRIBUTE:
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext, "axis 'attributes' ");
-#endif
- first = NULL;
- last = NULL;
- next = xmlXPathNextAttribute;
- mergeNodeSet = xmlXPathNodeSetMergeUnique;
- break;
- case AXIS_CHILD:
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext, "axis 'child' ");
-#endif
- last = NULL;
- next = xmlXPathNextChild;
- mergeNodeSet = xmlXPathNodeSetMergeUnique;
- break;
- case AXIS_DESCENDANT:
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext, "axis 'descendant' ");
-#endif
- last = NULL;
- next = xmlXPathNextDescendant;
- break;
- case AXIS_DESCENDANT_OR_SELF:
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext,
- "axis 'descendant-or-self' ");
-#endif
- last = NULL;
- next = xmlXPathNextDescendantOrSelf;
- break;
- case AXIS_FOLLOWING:
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext, "axis 'following' ");
-#endif
- last = NULL;
- next = xmlXPathNextFollowing;
- break;
- case AXIS_FOLLOWING_SIBLING:
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext,
- "axis 'following-siblings' ");
-#endif
- last = NULL;
- next = xmlXPathNextFollowingSibling;
- break;
- case AXIS_NAMESPACE:
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext, "axis 'namespace' ");
-#endif
- first = NULL;
- last = NULL;
- next = (xmlXPathTraversalFunction) xmlXPathNextNamespace;
- mergeNodeSet = xmlXPathNodeSetMergeUnique;
- break;
- case AXIS_PARENT:
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext, "axis 'parent' ");
-#endif
- first = NULL;
- next = xmlXPathNextParent;
- break;
- case AXIS_PRECEDING:
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext, "axis 'preceding' ");
-#endif
- first = NULL;
- next = xmlXPathNextPrecedingInternal;
- break;
- case AXIS_PRECEDING_SIBLING:
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext,
- "axis 'preceding-sibling' ");
-#endif
- first = NULL;
- next = xmlXPathNextPrecedingSibling;
- break;
- case AXIS_SELF:
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext, "axis 'self' ");
-#endif
- first = NULL;
- last = NULL;
- next = xmlXPathNextSelf;
- mergeNodeSet = xmlXPathNodeSetMergeUnique;
- break;
- }
- if (next == NULL)
- return(0);
-
- nodelist = obj->nodesetval;
- if (nodelist == NULL) {
- xmlXPathFreeObject(obj);
- valuePush(ctxt, xmlXPathWrapNodeSet(NULL));
- return(0);
- }
- addNode = xmlXPathNodeSetAddUnique;
- ret = NULL;
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext,
- " context contains %d nodes\n", nodelist->nodeNr);
- switch (test) {
- case NODE_TEST_NONE:
- xmlGenericError(xmlGenericErrorContext,
- " searching for none !!!\n");
- break;
- case NODE_TEST_TYPE:
- xmlGenericError(xmlGenericErrorContext,
- " searching for type %d\n", type);
- break;
- case NODE_TEST_PI:
- xmlGenericError(xmlGenericErrorContext,
- " searching for PI !!!\n");
- break;
- case NODE_TEST_ALL:
- xmlGenericError(xmlGenericErrorContext,
- " searching for *\n");
- break;
- case NODE_TEST_NS:
- xmlGenericError(xmlGenericErrorContext,
- " searching for namespace %s\n",
- prefix);
- break;
- case NODE_TEST_NAME:
- xmlGenericError(xmlGenericErrorContext,
- " searching for name %s\n", name);
- if (prefix != NULL)
- xmlGenericError(xmlGenericErrorContext,
- " with namespace %s\n", prefix);
- break;
- }
- xmlGenericError(xmlGenericErrorContext, "Testing : ");
-#endif
- /*
- * 2.3 Node Tests
- * - For the attribute axis, the principal node type is attribute.
- * - For the namespace axis, the principal node type is namespace.
- * - For other axes, the principal node type is element.
- *
- * A node test * is true for any node of the
- * principal node type. For example, child::* will
- * select all element children of the context node
- */
- tmp = ctxt->context->node;
- for (i = 0; i < nodelist->nodeNr; i++) {
- ctxt->context->node = nodelist->nodeTab[i];
-
- cur = NULL;
- list = xmlXPathNodeSetCreate(NULL);
- do {
- cur = next(ctxt, cur);
- if (cur == NULL)
- break;
- if ((first != NULL) && (*first == cur))
- break;
- if (((t % 256) == 0) &&
- (first != NULL) && (*first != NULL) &&
- (xmlXPathCmpNodes(*first, cur) >= 0))
- break;
- if ((last != NULL) && (*last == cur))
- break;
- if (((t % 256) == 0) &&
- (last != NULL) && (*last != NULL) &&
- (xmlXPathCmpNodes(cur, *last) >= 0))
- break;
- t++;
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext, " %s", cur->name);
-#endif
- switch (test) {
- case NODE_TEST_NONE:
- ctxt->context->node = tmp;
- STRANGE return(t);
- case NODE_TEST_TYPE:
- if ((cur->type == type) ||
- ((type == NODE_TYPE_NODE) &&
- ((cur->type == XML_DOCUMENT_NODE) ||
- (cur->type == XML_HTML_DOCUMENT_NODE) ||
- (cur->type == XML_ELEMENT_NODE) ||
- (cur->type == XML_NAMESPACE_DECL) ||
- (cur->type == XML_ATTRIBUTE_NODE) ||
- (cur->type == XML_PI_NODE) ||
- (cur->type == XML_COMMENT_NODE) ||
- (cur->type == XML_CDATA_SECTION_NODE) ||
- (cur->type == XML_TEXT_NODE))) ||
- ((type == NODE_TYPE_TEXT) &&
- (cur->type == XML_CDATA_SECTION_NODE))) {
-#ifdef DEBUG_STEP
- n++;
-#endif
- addNode(list, cur);
- }
- break;
- case NODE_TEST_PI:
- if (cur->type == XML_PI_NODE) {
- if ((name != NULL) &&
- (!xmlStrEqual(name, cur->name)))
- break;
-#ifdef DEBUG_STEP
- n++;
-#endif
- addNode(list, cur);
- }
- break;
- case NODE_TEST_ALL:
- if (axis == AXIS_ATTRIBUTE) {
- if (cur->type == XML_ATTRIBUTE_NODE) {
-#ifdef DEBUG_STEP
- n++;
-#endif
- addNode(list, cur);
- }
- } else if (axis == AXIS_NAMESPACE) {
- if (cur->type == XML_NAMESPACE_DECL) {
-#ifdef DEBUG_STEP
- n++;
-#endif
- xmlXPathNodeSetAddNs(list, ctxt->context->node,
- (xmlNsPtr) cur);
- }
- } else {
- if (cur->type == XML_ELEMENT_NODE) {
- if (prefix == NULL) {
-#ifdef DEBUG_STEP
- n++;
-#endif
- addNode(list, cur);
- } else if ((cur->ns != NULL) &&
- (xmlStrEqual(URI, cur->ns->href))) {
-#ifdef DEBUG_STEP
- n++;
-#endif
- addNode(list, cur);
- }
- }
- }
- break;
- case NODE_TEST_NS:{
- TODO;
- break;
- }
- case NODE_TEST_NAME:
- switch (cur->type) {
- case XML_ELEMENT_NODE:
- if (xmlStrEqual(name, cur->name)) {
- if (prefix == NULL) {
- if (cur->ns == NULL) {
-#ifdef DEBUG_STEP
- n++;
-#endif
- addNode(list, cur);
- }
- } else {
- if ((cur->ns != NULL) &&
- (xmlStrEqual(URI,
- cur->ns->href))) {
-#ifdef DEBUG_STEP
- n++;
-#endif
- addNode(list, cur);
- }
- }
- }
- break;
- case XML_ATTRIBUTE_NODE:{
- xmlAttrPtr attr = (xmlAttrPtr) cur;
-
- if (xmlStrEqual(name, attr->name)) {
- if (prefix == NULL) {
- if ((attr->ns == NULL) ||
- (attr->ns->prefix == NULL)) {
-#ifdef DEBUG_STEP
- n++;
-#endif
- addNode(list,
- (xmlNodePtr) attr);
- }
- } else {
- if ((attr->ns != NULL) &&
- (xmlStrEqual(URI,
- attr->ns->
- href))) {
-#ifdef DEBUG_STEP
- n++;
-#endif
- addNode(list,
- (xmlNodePtr) attr);
- }
- }
- }
- break;
- }
- case XML_NAMESPACE_DECL:
- if (cur->type == XML_NAMESPACE_DECL) {
- xmlNsPtr ns = (xmlNsPtr) cur;
-
- if ((ns->prefix != NULL) && (name != NULL)
- && (xmlStrEqual(ns->prefix, name))) {
-#ifdef DEBUG_STEP
- n++;
-#endif
- xmlXPathNodeSetAddNs(list,
- ctxt->context->node, (xmlNsPtr) cur);
- }
- }
- break;
- default:
- break;
- }
- break;
- break;
- }
- } while (cur != NULL);
-
- /*
- * If there is some predicate filtering do it now
- */
- if ((op->ch2 != -1) && (list != NULL) && (list->nodeNr > 0)) {
- xmlXPathObjectPtr obj2;
-
- valuePush(ctxt, xmlXPathWrapNodeSet(list));
- xmlXPathCompOpEval(ctxt, &ctxt->comp->steps[op->ch2]);
- CHECK_TYPE0(XPATH_NODESET);
- obj2 = valuePop(ctxt);
- list = obj2->nodesetval;
- obj2->nodesetval = NULL;
- xmlXPathFreeObject(obj2);
- }
- if (ret == NULL) {
- ret = list;
- } else {
- ret = mergeNodeSet(ret, list);
- xmlXPathFreeNodeSet(list);
- }
- }
- ctxt->context->node = tmp;
-#ifdef DEBUG_STEP
- xmlGenericError(xmlGenericErrorContext,
- "\nExamined %d nodes, found %d nodes at that step\n",
- t, n);
-#endif
- valuePush(ctxt, xmlXPathWrapNodeSet(ret));
- if ((obj->boolval) && (obj->user != NULL)) {
- ctxt->value->boolval = 1;
- ctxt->value->user = obj->user;
- obj->user = NULL;
- obj->boolval = 0;
- }
- xmlXPathFreeObject(obj);
- return(t);
-}
-
-/**
- * xmlXPathNodeCollectAndTestNth:
- * @ctxt: the XPath Parser context
- * @op: the XPath precompiled step operation
- * @indx: the index to collect
- * @first: pointer to the first element in document order
- * @last: pointer to the last element in document order
- *
- * This is the function implementing a step: based on the current list
- * of nodes, it builds up a new list, looking at all nodes under that
- * axis and selecting them it also do the predicate filtering
- *
- * Pushes the new NodeSet resulting from the search.
- * Returns the number of node traversed
- */
-static int
-xmlXPathNodeCollectAndTestNth(xmlXPathParserContextPtr ctxt,
- xmlXPathStepOpPtr op, int indx,
- xmlNodePtr * first, xmlNodePtr * last)
-{
- xmlXPathAxisVal axis = op->value;
- xmlXPathTestVal test = op->value2;
- xmlXPathTypeVal type = op->value3;
- const xmlChar *prefix = op->value4;
- const xmlChar *name = op->value5;
- const xmlChar *URI = NULL;
- int n = 0, t = 0;
-
- int i;
- xmlNodeSetPtr list;
- xmlXPathTraversalFunction next = NULL;
- void (*addNode) (xmlNodeSetPtr, xmlNodePtr);
- xmlNodePtr cur = NULL;
- xmlXPathObjectPtr obj;
- xmlNodeSetPtr nodelist;
- xmlNodePtr tmp;
-
- CHECK_TYPE0(XPATH_NODESET);
- obj = valuePop(ctxt);
- addNode = xmlXPathNodeSetAdd;
- if (prefix != NULL) {
- URI = xmlXPathNsLookup(ctxt->context, prefix);
- if (URI == NULL)
- XP_ERROR0(XPATH_UNDEF_PREFIX_ERROR);
- }
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext, "new step : ");
- if (first != NULL) {
- if (*first != NULL)
- xmlGenericError(xmlGenericErrorContext, "first = %s ",
- (*first)->name);
- else
- xmlGenericError(xmlGenericErrorContext, "first = NULL ");
- }
- if (last != NULL) {
- if (*last != NULL)
- xmlGenericError(xmlGenericErrorContext, "last = %s ",
- (*last)->name);
- else
- xmlGenericError(xmlGenericErrorContext, "last = NULL ");
- }
-#endif
- switch (axis) {
- case AXIS_ANCESTOR:
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext, "axis 'ancestors' ");
-#endif
- first = NULL;
- next = xmlXPathNextAncestor;
- break;
- case AXIS_ANCESTOR_OR_SELF:
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext,
- "axis 'ancestors-or-self' ");
-#endif
- first = NULL;
- next = xmlXPathNextAncestorOrSelf;
- break;
- case AXIS_ATTRIBUTE:
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext, "axis 'attributes' ");
-#endif
- first = NULL;
- last = NULL;
- next = xmlXPathNextAttribute;
- break;
- case AXIS_CHILD:
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext, "axis 'child' ");
-#endif
- last = NULL;
- next = xmlXPathNextChild;
- break;
- case AXIS_DESCENDANT:
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext, "axis 'descendant' ");
-#endif
- last = NULL;
- next = xmlXPathNextDescendant;
- break;
- case AXIS_DESCENDANT_OR_SELF:
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext,
- "axis 'descendant-or-self' ");
-#endif
- last = NULL;
- next = xmlXPathNextDescendantOrSelf;
- break;
- case AXIS_FOLLOWING:
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext, "axis 'following' ");
-#endif
- last = NULL;
- next = xmlXPathNextFollowing;
- break;
- case AXIS_FOLLOWING_SIBLING:
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext,
- "axis 'following-siblings' ");
-#endif
- last = NULL;
- next = xmlXPathNextFollowingSibling;
- break;
- case AXIS_NAMESPACE:
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext, "axis 'namespace' ");
-#endif
- last = NULL;
- first = NULL;
- next = (xmlXPathTraversalFunction) xmlXPathNextNamespace;
- break;
- case AXIS_PARENT:
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext, "axis 'parent' ");
-#endif
- first = NULL;
- next = xmlXPathNextParent;
- break;
- case AXIS_PRECEDING:
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext, "axis 'preceding' ");
-#endif
- first = NULL;
- next = xmlXPathNextPrecedingInternal;
- break;
- case AXIS_PRECEDING_SIBLING:
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext,
- "axis 'preceding-sibling' ");
-#endif
- first = NULL;
- next = xmlXPathNextPrecedingSibling;
- break;
- case AXIS_SELF:
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext, "axis 'self' ");
-#endif
- first = NULL;
- last = NULL;
- next = xmlXPathNextSelf;
- break;
- }
- if (next == NULL)
- return(0);
-
- nodelist = obj->nodesetval;
- if (nodelist == NULL) {
- xmlXPathFreeObject(obj);
- valuePush(ctxt, xmlXPathWrapNodeSet(NULL));
- return(0);
- }
- addNode = xmlXPathNodeSetAddUnique;
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext,
- " context contains %d nodes\n", nodelist->nodeNr);
- switch (test) {
- case NODE_TEST_NONE:
- xmlGenericError(xmlGenericErrorContext,
- " searching for none !!!\n");
- break;
- case NODE_TEST_TYPE:
- xmlGenericError(xmlGenericErrorContext,
- " searching for type %d\n", type);
- break;
- case NODE_TEST_PI:
- xmlGenericError(xmlGenericErrorContext,
- " searching for PI !!!\n");
- break;
- case NODE_TEST_ALL:
- xmlGenericError(xmlGenericErrorContext,
- " searching for *\n");
- break;
- case NODE_TEST_NS:
- xmlGenericError(xmlGenericErrorContext,
- " searching for namespace %s\n",
- prefix);
- break;
- case NODE_TEST_NAME:
- xmlGenericError(xmlGenericErrorContext,
- " searching for name %s\n", name);
- if (prefix != NULL)
- xmlGenericError(xmlGenericErrorContext,
- " with namespace %s\n", prefix);
- break;
- }
- xmlGenericError(xmlGenericErrorContext, "Testing : ");
-#endif
- /*
- * 2.3 Node Tests
- * - For the attribute axis, the principal node type is attribute.
- * - For the namespace axis, the principal node type is namespace.
- * - For other axes, the principal node type is element.
- *
- * A node test * is true for any node of the
- * principal node type. For example, child::* will
- * select all element children of the context node
- */
- tmp = ctxt->context->node;
- list = xmlXPathNodeSetCreate(NULL);
- for (i = 0; i < nodelist->nodeNr; i++) {
- ctxt->context->node = nodelist->nodeTab[i];
-
- cur = NULL;
- n = 0;
- do {
- cur = next(ctxt, cur);
- if (cur == NULL)
- break;
- if ((first != NULL) && (*first == cur))
- break;
- if (((t % 256) == 0) &&
- (first != NULL) && (*first != NULL) &&
- (xmlXPathCmpNodes(*first, cur) >= 0))
- break;
- if ((last != NULL) && (*last == cur))
- break;
- if (((t % 256) == 0) &&
- (last != NULL) && (*last != NULL) &&
- (xmlXPathCmpNodes(cur, *last) >= 0))
- break;
- t++;
- switch (test) {
- case NODE_TEST_NONE:
- ctxt->context->node = tmp;
- STRANGE return(0);
- case NODE_TEST_TYPE:
- if ((cur->type == type) ||
- ((type == NODE_TYPE_NODE) &&
- ((cur->type == XML_DOCUMENT_NODE) ||
- (cur->type == XML_HTML_DOCUMENT_NODE) ||
- (cur->type == XML_ELEMENT_NODE) ||
- (cur->type == XML_PI_NODE) ||
- (cur->type == XML_COMMENT_NODE) ||
- (cur->type == XML_CDATA_SECTION_NODE) ||
- (cur->type == XML_TEXT_NODE))) ||
- ((type == NODE_TYPE_TEXT) &&
- (cur->type == XML_CDATA_SECTION_NODE))) {
- n++;
- if (n == indx)
- addNode(list, cur);
- }
- break;
- case NODE_TEST_PI:
- if (cur->type == XML_PI_NODE) {
- if ((name != NULL) &&
- (!xmlStrEqual(name, cur->name)))
- break;
- n++;
- if (n == indx)
- addNode(list, cur);
- }
- break;
- case NODE_TEST_ALL:
- if (axis == AXIS_ATTRIBUTE) {
- if (cur->type == XML_ATTRIBUTE_NODE) {
- n++;
- if (n == indx)
- addNode(list, cur);
- }
- } else if (axis == AXIS_NAMESPACE) {
- if (cur->type == XML_NAMESPACE_DECL) {
- n++;
- if (n == indx)
- xmlXPathNodeSetAddNs(list, ctxt->context->node,
- (xmlNsPtr) cur);
- }
- } else {
- if (cur->type == XML_ELEMENT_NODE) {
- if (prefix == NULL) {
- n++;
- if (n == indx)
- addNode(list, cur);
- } else if ((cur->ns != NULL) &&
- (xmlStrEqual(URI, cur->ns->href))) {
- n++;
- if (n == indx)
- addNode(list, cur);
- }
- }
- }
- break;
- case NODE_TEST_NS:{
- TODO;
- break;
- }
- case NODE_TEST_NAME:
- switch (cur->type) {
- case XML_ELEMENT_NODE:
- if (xmlStrEqual(name, cur->name)) {
- if (prefix == NULL) {
- if (cur->ns == NULL) {
- n++;
- if (n == indx)
- addNode(list, cur);
- }
- } else {
- if ((cur->ns != NULL) &&
- (xmlStrEqual(URI,
- cur->ns->href))) {
- n++;
- if (n == indx)
- addNode(list, cur);
- }
- }
- }
- break;
- case XML_ATTRIBUTE_NODE:{
- xmlAttrPtr attr = (xmlAttrPtr) cur;
-
- if (xmlStrEqual(name, attr->name)) {
- if (prefix == NULL) {
- if ((attr->ns == NULL) ||
- (attr->ns->prefix == NULL)) {
- n++;
- if (n == indx)
- addNode(list, cur);
- }
- } else {
- if ((attr->ns != NULL) &&
- (xmlStrEqual(URI,
- attr->ns->
- href))) {
- n++;
- if (n == indx)
- addNode(list, cur);
- }
- }
- }
- break;
- }
- case XML_NAMESPACE_DECL:
- if (cur->type == XML_NAMESPACE_DECL) {
- xmlNsPtr ns = (xmlNsPtr) cur;
-
- if ((ns->prefix != NULL) && (name != NULL)
- && (xmlStrEqual(ns->prefix, name))) {
- n++;
- if (n == indx)
- xmlXPathNodeSetAddNs(list,
- ctxt->context->node, (xmlNsPtr) cur);
- }
- }
- break;
- default:
- break;
- }
- break;
- break;
- }
- } while (n < indx);
- }
- ctxt->context->node = tmp;
-#ifdef DEBUG_STEP_NTH
- xmlGenericError(xmlGenericErrorContext,
- "\nExamined %d nodes, found %d nodes at that step\n",
- t, list->nodeNr);
-#endif
- valuePush(ctxt, xmlXPathWrapNodeSet(list));
- if ((obj->boolval) && (obj->user != NULL)) {
- ctxt->value->boolval = 1;
- ctxt->value->user = obj->user;
- obj->user = NULL;
- obj->boolval = 0;
- }
- xmlXPathFreeObject(obj);
- return(t);
-}
-
-/**
- * xmlXPathCompOpEvalFirst:
- * @ctxt: the XPath parser context with the compiled expression
- * @op: an XPath compiled operation
- * @first: the first elem found so far
- *
- * Evaluate the Precompiled XPath operation searching only the first
- * element in document order
- *
- * Returns the number of examined objects.
- */
-static int
-xmlXPathCompOpEvalFirst(xmlXPathParserContextPtr ctxt,
- xmlXPathStepOpPtr op, xmlNodePtr * first)
-{
- int total = 0, cur;
- xmlXPathCompExprPtr comp;
- xmlXPathObjectPtr arg1, arg2;
-
- CHECK_ERROR0;
- comp = ctxt->comp;
- switch (op->op) {
- case XPATH_OP_END:
- return (0);
- case XPATH_OP_UNION:
- total =
- xmlXPathCompOpEvalFirst(ctxt, &comp->steps[op->ch1],
- first);
- CHECK_ERROR0;
- if ((ctxt->value != NULL)
- && (ctxt->value->type == XPATH_NODESET)
- && (ctxt->value->nodesetval != NULL)
- && (ctxt->value->nodesetval->nodeNr >= 1)) {
- /*
- * limit tree traversing to first node in the result
- */
- xmlXPathNodeSetSort(ctxt->value->nodesetval);
- *first = ctxt->value->nodesetval->nodeTab[0];
- }
- cur =
- xmlXPathCompOpEvalFirst(ctxt, &comp->steps[op->ch2],
- first);
- CHECK_ERROR0;
- CHECK_TYPE0(XPATH_NODESET);
- arg2 = valuePop(ctxt);
-
- CHECK_TYPE0(XPATH_NODESET);
- arg1 = valuePop(ctxt);
-
- arg1->nodesetval = xmlXPathNodeSetMerge(arg1->nodesetval,
- arg2->nodesetval);
- valuePush(ctxt, arg1);
- xmlXPathFreeObject(arg2);
- /* optimizer */
- if (total > cur)
- xmlXPathCompSwap(op);
- return (total + cur);
- case XPATH_OP_ROOT:
- xmlXPathRoot(ctxt);
- return (0);
- case XPATH_OP_NODE:
- if (op->ch1 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- if (op->ch2 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- CHECK_ERROR0;
- valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node));
- return (total);
- case XPATH_OP_RESET:
- if (op->ch1 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- if (op->ch2 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- CHECK_ERROR0;
- ctxt->context->node = NULL;
- return (total);
- case XPATH_OP_COLLECT:{
- if (op->ch1 == -1)
- return (total);
-
- total = xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
-
- /*
- * Optimization for [n] selection where n is a number
- */
- if ((op->ch2 != -1) &&
- (comp->steps[op->ch2].op == XPATH_OP_PREDICATE) &&
- (comp->steps[op->ch2].ch1 == -1) &&
- (comp->steps[op->ch2].ch2 != -1) &&
- (comp->steps[comp->steps[op->ch2].ch2].op ==
- XPATH_OP_VALUE)) {
- xmlXPathObjectPtr val;
-
- val = comp->steps[comp->steps[op->ch2].ch2].value4;
- if ((val != NULL) && (val->type == XPATH_NUMBER)) {
- int indx = (int) val->floatval;
-
- if (val->floatval == (float) indx) {
- xmlXPathNodeCollectAndTestNth(ctxt, op, indx,
- first, NULL);
- return (total);
- }
- }
- }
- total += xmlXPathNodeCollectAndTest(ctxt, op, first, NULL);
- return (total);
- }
- case XPATH_OP_VALUE:
- valuePush(ctxt,
- xmlXPathObjectCopy((xmlXPathObjectPtr) op->value4));
- return (0);
- case XPATH_OP_SORT:
- if (op->ch1 != -1)
- total +=
- xmlXPathCompOpEvalFirst(ctxt, &comp->steps[op->ch1],
- first);
- CHECK_ERROR0;
- if ((ctxt->value != NULL)
- && (ctxt->value->type == XPATH_NODESET)
- && (ctxt->value->nodesetval != NULL))
- xmlXPathNodeSetSort(ctxt->value->nodesetval);
- return (total);
- default:
- return (xmlXPathCompOpEval(ctxt, op));
- }
-}
-
-/**
- * xmlXPathCompOpEvalLast:
- * @ctxt: the XPath parser context with the compiled expression
- * @op: an XPath compiled operation
- * @last: the last elem found so far
- *
- * Evaluate the Precompiled XPath operation searching only the last
- * element in document order
- *
- * Returns the number of node traversed
- */
-static int
-xmlXPathCompOpEvalLast(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op,
- xmlNodePtr * last)
-{
- int total = 0, cur;
- xmlXPathCompExprPtr comp;
- xmlXPathObjectPtr arg1, arg2;
-
- CHECK_ERROR0;
- comp = ctxt->comp;
- switch (op->op) {
- case XPATH_OP_END:
- return (0);
- case XPATH_OP_UNION:
- total =
- xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch1], last);
- CHECK_ERROR0;
- if ((ctxt->value != NULL)
- && (ctxt->value->type == XPATH_NODESET)
- && (ctxt->value->nodesetval != NULL)
- && (ctxt->value->nodesetval->nodeNr >= 1)) {
- /*
- * limit tree traversing to first node in the result
- */
- xmlXPathNodeSetSort(ctxt->value->nodesetval);
- *last =
- ctxt->value->nodesetval->nodeTab[ctxt->value->
- nodesetval->nodeNr -
- 1];
- }
- cur =
- xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch2], last);
- CHECK_ERROR0;
- if ((ctxt->value != NULL)
- && (ctxt->value->type == XPATH_NODESET)
- && (ctxt->value->nodesetval != NULL)
- && (ctxt->value->nodesetval->nodeNr >= 1)) {
- }
- CHECK_TYPE0(XPATH_NODESET);
- arg2 = valuePop(ctxt);
-
- CHECK_TYPE0(XPATH_NODESET);
- arg1 = valuePop(ctxt);
-
- arg1->nodesetval = xmlXPathNodeSetMerge(arg1->nodesetval,
- arg2->nodesetval);
- valuePush(ctxt, arg1);
- xmlXPathFreeObject(arg2);
- /* optimizer */
- if (total > cur)
- xmlXPathCompSwap(op);
- return (total + cur);
- case XPATH_OP_ROOT:
- xmlXPathRoot(ctxt);
- return (0);
- case XPATH_OP_NODE:
- if (op->ch1 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- if (op->ch2 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- CHECK_ERROR0;
- valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node));
- return (total);
- case XPATH_OP_RESET:
- if (op->ch1 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- if (op->ch2 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- CHECK_ERROR0;
- ctxt->context->node = NULL;
- return (total);
- case XPATH_OP_COLLECT:{
- if (op->ch1 == -1)
- return (0);
-
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
-
- /*
- * Optimization for [n] selection where n is a number
- */
- if ((op->ch2 != -1) &&
- (comp->steps[op->ch2].op == XPATH_OP_PREDICATE) &&
- (comp->steps[op->ch2].ch1 == -1) &&
- (comp->steps[op->ch2].ch2 != -1) &&
- (comp->steps[comp->steps[op->ch2].ch2].op ==
- XPATH_OP_VALUE)) {
- xmlXPathObjectPtr val;
-
- val = comp->steps[comp->steps[op->ch2].ch2].value4;
- if ((val != NULL) && (val->type == XPATH_NUMBER)) {
- int indx = (int) val->floatval;
-
- if (val->floatval == (float) indx) {
- total +=
- xmlXPathNodeCollectAndTestNth(ctxt, op,
- indx, NULL,
- last);
- return (total);
- }
- }
- }
- total += xmlXPathNodeCollectAndTest(ctxt, op, NULL, last);
- return (total);
- }
- case XPATH_OP_VALUE:
- valuePush(ctxt,
- xmlXPathObjectCopy((xmlXPathObjectPtr) op->value4));
- return (0);
- case XPATH_OP_SORT:
- if (op->ch1 != -1)
- total +=
- xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch1],
- last);
- CHECK_ERROR0;
- if ((ctxt->value != NULL)
- && (ctxt->value->type == XPATH_NODESET)
- && (ctxt->value->nodesetval != NULL))
- xmlXPathNodeSetSort(ctxt->value->nodesetval);
- return (total);
- default:
- return (xmlXPathCompOpEval(ctxt, op));
- }
-}
-
-/**
- * xmlXPathCompOpEval:
- * @ctxt: the XPath parser context with the compiled expression
- * @op: an XPath compiled operation
- *
- * Evaluate the Precompiled XPath operation
- * Returns the number of node traversed
- */
-static int
-xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
-{
- int total = 0;
- int equal, ret;
- xmlXPathCompExprPtr comp;
- xmlXPathObjectPtr arg1, arg2;
- xmlNodePtr bak;
- xmlDocPtr bakd;
- int pp;
- int cs;
-
- CHECK_ERROR0;
- comp = ctxt->comp;
- switch (op->op) {
- case XPATH_OP_END:
- return (0);
- case XPATH_OP_AND:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- xmlXPathBooleanFunction(ctxt, 1);
- if ((ctxt->value == NULL) || (ctxt->value->boolval == 0))
- return (total);
- arg2 = valuePop(ctxt);
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- ctxt->context->proximityPosition = pp;
- ctxt->context->contextSize = cs;
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- if (ctxt->error) {
- xmlXPathFreeObject(arg2);
- return(0);
- }
- xmlXPathBooleanFunction(ctxt, 1);
- arg1 = valuePop(ctxt);
- arg1->boolval &= arg2->boolval;
- valuePush(ctxt, arg1);
- xmlXPathFreeObject(arg2);
- return (total);
- case XPATH_OP_OR:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- xmlXPathBooleanFunction(ctxt, 1);
- if ((ctxt->value == NULL) || (ctxt->value->boolval == 1))
- return (total);
- arg2 = valuePop(ctxt);
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- ctxt->context->proximityPosition = pp;
- ctxt->context->contextSize = cs;
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- if (ctxt->error) {
- xmlXPathFreeObject(arg2);
- return(0);
- }
- xmlXPathBooleanFunction(ctxt, 1);
- arg1 = valuePop(ctxt);
- arg1->boolval |= arg2->boolval;
- valuePush(ctxt, arg1);
- xmlXPathFreeObject(arg2);
- return (total);
- case XPATH_OP_EQUAL:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- ctxt->context->proximityPosition = pp;
- ctxt->context->contextSize = cs;
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- CHECK_ERROR0;
- if (op->value)
- equal = xmlXPathEqualValues(ctxt);
- else
- equal = xmlXPathNotEqualValues(ctxt);
- valuePush(ctxt, xmlXPathNewBoolean(equal));
- return (total);
- case XPATH_OP_CMP:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- ctxt->context->proximityPosition = pp;
- ctxt->context->contextSize = cs;
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- CHECK_ERROR0;
- ret = xmlXPathCompareValues(ctxt, op->value, op->value2);
- valuePush(ctxt, xmlXPathNewBoolean(ret));
- return (total);
- case XPATH_OP_PLUS:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- if (op->ch2 != -1) {
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- ctxt->context->proximityPosition = pp;
- ctxt->context->contextSize = cs;
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- }
- CHECK_ERROR0;
- if (op->value == 0)
- xmlXPathSubValues(ctxt);
- else if (op->value == 1)
- xmlXPathAddValues(ctxt);
- else if (op->value == 2)
- xmlXPathValueFlipSign(ctxt);
- else if (op->value == 3) {
- CAST_TO_NUMBER;
- CHECK_TYPE0(XPATH_NUMBER);
- }
- return (total);
- case XPATH_OP_MULT:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- ctxt->context->proximityPosition = pp;
- ctxt->context->contextSize = cs;
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- CHECK_ERROR0;
- if (op->value == 0)
- xmlXPathMultValues(ctxt);
- else if (op->value == 1)
- xmlXPathDivValues(ctxt);
- else if (op->value == 2)
- xmlXPathModValues(ctxt);
- return (total);
- case XPATH_OP_UNION:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- ctxt->context->proximityPosition = pp;
- ctxt->context->contextSize = cs;
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- CHECK_ERROR0;
- CHECK_TYPE0(XPATH_NODESET);
- arg2 = valuePop(ctxt);
-
- CHECK_TYPE0(XPATH_NODESET);
- arg1 = valuePop(ctxt);
-
- arg1->nodesetval = xmlXPathNodeSetMerge(arg1->nodesetval,
- arg2->nodesetval);
- valuePush(ctxt, arg1);
- xmlXPathFreeObject(arg2);
- return (total);
- case XPATH_OP_ROOT:
- xmlXPathRoot(ctxt);
- return (total);
- case XPATH_OP_NODE:
- if (op->ch1 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- if (op->ch2 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- CHECK_ERROR0;
- valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node));
- return (total);
- case XPATH_OP_RESET:
- if (op->ch1 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- if (op->ch2 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- CHECK_ERROR0;
- ctxt->context->node = NULL;
- return (total);
- case XPATH_OP_COLLECT:{
- if (op->ch1 == -1)
- return (total);
-
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
-
- /*
- * Optimization for [n] selection where n is a number
- */
- if ((op->ch2 != -1) &&
- (comp->steps[op->ch2].op == XPATH_OP_PREDICATE) &&
- (comp->steps[op->ch2].ch1 == -1) &&
- (comp->steps[op->ch2].ch2 != -1) &&
- (comp->steps[comp->steps[op->ch2].ch2].op ==
- XPATH_OP_VALUE)) {
- xmlXPathObjectPtr val;
-
- val = comp->steps[comp->steps[op->ch2].ch2].value4;
- if ((val != NULL) && (val->type == XPATH_NUMBER)) {
- int indx = (int) val->floatval;
-
- if (val->floatval == (float) indx) {
- total +=
- xmlXPathNodeCollectAndTestNth(ctxt, op,
- indx, NULL,
- NULL);
- return (total);
- }
- }
- }
- total += xmlXPathNodeCollectAndTest(ctxt, op, NULL, NULL);
- return (total);
- }
- case XPATH_OP_VALUE:
- valuePush(ctxt,
- xmlXPathObjectCopy((xmlXPathObjectPtr) op->value4));
- return (total);
- case XPATH_OP_VARIABLE:{
- xmlXPathObjectPtr val;
-
- if (op->ch1 != -1)
- total +=
- xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- if (op->value5 == NULL) {
- val = xmlXPathVariableLookup(ctxt->context, op->value4);
- if (val == NULL) {
- ctxt->error = XPATH_UNDEF_VARIABLE_ERROR;
- return(0);
- }
- valuePush(ctxt, val);
- } else {
- const xmlChar *URI;
-
- URI = xmlXPathNsLookup(ctxt->context, op->value5);
- if (URI == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathCompOpEval: variable %s bound to undefined prefix %s\n",
- op->value4, op->value5);
- return (total);
- }
- val = xmlXPathVariableLookupNS(ctxt->context,
- op->value4, URI);
- if (val == NULL) {
- ctxt->error = XPATH_UNDEF_VARIABLE_ERROR;
- return(0);
- }
- valuePush(ctxt, val);
- }
- return (total);
- }
- case XPATH_OP_FUNCTION:{
- xmlXPathFunction func;
- const xmlChar *oldFunc, *oldFuncURI;
- int i;
-
- if (op->ch1 != -1)
- total +=
- xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- if (ctxt->valueNr < op->value) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathCompOpEval: parameter error\n");
- ctxt->error = XPATH_INVALID_OPERAND;
- return (total);
- }
- for (i = 0; i < op->value; i++)
- if (ctxt->valueTab[(ctxt->valueNr - 1) - i] == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathCompOpEval: parameter error\n");
- ctxt->error = XPATH_INVALID_OPERAND;
- return (total);
- }
- if (op->cache != NULL)
- func = (xmlXPathFunction) op->cache;
- else {
- const xmlChar *URI = NULL;
-
- if (op->value5 == NULL)
- func =
- xmlXPathFunctionLookup(ctxt->context,
- op->value4);
- else {
- URI = xmlXPathNsLookup(ctxt->context, op->value5);
- if (URI == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathCompOpEval: function %s bound to undefined prefix %s\n",
- op->value4, op->value5);
- return (total);
- }
- func = xmlXPathFunctionLookupNS(ctxt->context,
- op->value4, URI);
- }
- if (func == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathCompOpEval: function %s not found\n",
- op->value4);
- XP_ERROR0(XPATH_UNKNOWN_FUNC_ERROR);
- }
- op->cache = (void *) func;
- op->cacheURI = (void *) URI;
- }
- oldFunc = ctxt->context->function;
- oldFuncURI = ctxt->context->functionURI;
- ctxt->context->function = op->value4;
- ctxt->context->functionURI = op->cacheURI;
- func(ctxt, op->value);
- ctxt->context->function = oldFunc;
- ctxt->context->functionURI = oldFuncURI;
- return (total);
- }
- case XPATH_OP_ARG:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- if (op->ch1 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- CHECK_ERROR0;
- if (op->ch2 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- CHECK_ERROR0;
- return (total);
- case XPATH_OP_PREDICATE:
- case XPATH_OP_FILTER:{
- xmlXPathObjectPtr res;
- xmlXPathObjectPtr obj, tmp;
- xmlNodeSetPtr newset = NULL;
- xmlNodeSetPtr oldset;
- xmlNodePtr oldnode;
- int i;
-
- /*
- * Optimization for ()[1] selection i.e. the first elem
- */
- if ((op->ch1 != -1) && (op->ch2 != -1) &&
- (comp->steps[op->ch1].op == XPATH_OP_SORT) &&
- (comp->steps[op->ch2].op == XPATH_OP_VALUE)) {
- xmlXPathObjectPtr val;
-
- val = comp->steps[op->ch2].value4;
- if ((val != NULL) && (val->type == XPATH_NUMBER) &&
- (val->floatval == 1.0)) {
- xmlNodePtr first = NULL;
-
- total +=
- xmlXPathCompOpEvalFirst(ctxt,
- &comp->steps[op->ch1],
- &first);
- CHECK_ERROR0;
- /*
- * The nodeset should be in document order,
- * Keep only the first value
- */
- if ((ctxt->value != NULL) &&
- (ctxt->value->type == XPATH_NODESET) &&
- (ctxt->value->nodesetval != NULL) &&
- (ctxt->value->nodesetval->nodeNr > 1))
- ctxt->value->nodesetval->nodeNr = 1;
- return (total);
- }
- }
- /*
- * Optimization for ()[last()] selection i.e. the last elem
- */
- if ((op->ch1 != -1) && (op->ch2 != -1) &&
- (comp->steps[op->ch1].op == XPATH_OP_SORT) &&
- (comp->steps[op->ch2].op == XPATH_OP_SORT)) {
- int f = comp->steps[op->ch2].ch1;
-
- if ((f != -1) &&
- (comp->steps[f].op == XPATH_OP_FUNCTION) &&
- (comp->steps[f].value5 == NULL) &&
- (comp->steps[f].value == 0) &&
- (comp->steps[f].value4 != NULL) &&
- (xmlStrEqual
- (comp->steps[f].value4, BAD_CAST "last"))) {
- xmlNodePtr last = NULL;
-
- total +=
- xmlXPathCompOpEvalLast(ctxt,
- &comp->steps[op->ch1],
- &last);
- CHECK_ERROR0;
- /*
- * The nodeset should be in document order,
- * Keep only the last value
- */
- if ((ctxt->value != NULL) &&
- (ctxt->value->type == XPATH_NODESET) &&
- (ctxt->value->nodesetval != NULL) &&
- (ctxt->value->nodesetval->nodeTab != NULL) &&
- (ctxt->value->nodesetval->nodeNr > 1)) {
- ctxt->value->nodesetval->nodeTab[0] =
- ctxt->value->nodesetval->nodeTab[ctxt->
- value->
- nodesetval->
- nodeNr -
- 1];
- ctxt->value->nodesetval->nodeNr = 1;
- }
- return (total);
- }
- }
-
- if (op->ch1 != -1)
- total +=
- xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- if (op->ch2 == -1)
- return (total);
- if (ctxt->value == NULL)
- return (total);
-
- oldnode = ctxt->context->node;
-
-#ifdef LIBXML_XPTR_ENABLED
- /*
- * Hum are we filtering the result of an XPointer expression
- */
- if (ctxt->value->type == XPATH_LOCATIONSET) {
- xmlLocationSetPtr newlocset = NULL;
- xmlLocationSetPtr oldlocset;
-
- /*
- * Extract the old locset, and then evaluate the result of the
- * expression for all the element in the locset. use it to grow
- * up a new locset.
- */
- CHECK_TYPE0(XPATH_LOCATIONSET);
- obj = valuePop(ctxt);
- oldlocset = obj->user;
- ctxt->context->node = NULL;
-
- if ((oldlocset == NULL) || (oldlocset->locNr == 0)) {
- ctxt->context->contextSize = 0;
- ctxt->context->proximityPosition = 0;
- if (op->ch2 != -1)
- total +=
- xmlXPathCompOpEval(ctxt,
- &comp->steps[op->ch2]);
- res = valuePop(ctxt);
- if (res != NULL)
- xmlXPathFreeObject(res);
- valuePush(ctxt, obj);
- CHECK_ERROR0;
- return (total);
- }
- newlocset = xmlXPtrLocationSetCreate(NULL);
-
- for (i = 0; i < oldlocset->locNr; i++) {
- /*
- * Run the evaluation with a node list made of a
- * single item in the nodelocset.
- */
- ctxt->context->node = oldlocset->locTab[i]->user;
- tmp = xmlXPathNewNodeSet(ctxt->context->node);
- valuePush(ctxt, tmp);
- ctxt->context->contextSize = oldlocset->locNr;
- ctxt->context->proximityPosition = i + 1;
-
- if (op->ch2 != -1)
- total +=
- xmlXPathCompOpEval(ctxt,
- &comp->steps[op->ch2]);
- CHECK_ERROR0;
-
- /*
- * The result of the evaluation need to be tested to
- * decided whether the filter succeeded or not
- */
- res = valuePop(ctxt);
- if (xmlXPathEvaluatePredicateResult(ctxt, res)) {
- xmlXPtrLocationSetAdd(newlocset,
- xmlXPathObjectCopy
- (oldlocset->locTab[i]));
- }
-
- /*
- * Cleanup
- */
- if (res != NULL)
- xmlXPathFreeObject(res);
- if (ctxt->value == tmp) {
- res = valuePop(ctxt);
- xmlXPathFreeObject(res);
- }
-
- ctxt->context->node = NULL;
- }
-
- /*
- * The result is used as the new evaluation locset.
- */
- xmlXPathFreeObject(obj);
- ctxt->context->node = NULL;
- ctxt->context->contextSize = -1;
- ctxt->context->proximityPosition = -1;
- valuePush(ctxt, xmlXPtrWrapLocationSet(newlocset));
- ctxt->context->node = oldnode;
- return (total);
- }
-#endif /* LIBXML_XPTR_ENABLED */
-
- /*
- * Extract the old set, and then evaluate the result of the
- * expression for all the element in the set. use it to grow
- * up a new set.
- */
- CHECK_TYPE0(XPATH_NODESET);
- obj = valuePop(ctxt);
- oldset = obj->nodesetval;
-
- oldnode = ctxt->context->node;
- ctxt->context->node = NULL;
-
- if ((oldset == NULL) || (oldset->nodeNr == 0)) {
- ctxt->context->contextSize = 0;
- ctxt->context->proximityPosition = 0;
- if (op->ch2 != -1)
- total +=
- xmlXPathCompOpEval(ctxt,
- &comp->steps[op->ch2]);
- CHECK_ERROR0;
- res = valuePop(ctxt);
- if (res != NULL)
- xmlXPathFreeObject(res);
- valuePush(ctxt, obj);
- ctxt->context->node = oldnode;
- CHECK_ERROR0;
- } else {
- /*
- * Initialize the new set.
- */
- newset = xmlXPathNodeSetCreate(NULL);
-
- for (i = 0; i < oldset->nodeNr; i++) {
- /*
- * Run the evaluation with a node list made of
- * a single item in the nodeset.
- */
- ctxt->context->node = oldset->nodeTab[i];
- tmp = xmlXPathNewNodeSet(ctxt->context->node);
- valuePush(ctxt, tmp);
- ctxt->context->contextSize = oldset->nodeNr;
- ctxt->context->proximityPosition = i + 1;
-
- if (op->ch2 != -1)
- total +=
- xmlXPathCompOpEval(ctxt,
- &comp->steps[op->ch2]);
- CHECK_ERROR0;
-
- /*
- * The result of the evaluation need to be tested to
- * decided whether the filter succeeded or not
- */
- res = valuePop(ctxt);
- if (xmlXPathEvaluatePredicateResult(ctxt, res)) {
- xmlXPathNodeSetAdd(newset, oldset->nodeTab[i]);
- }
-
- /*
- * Cleanup
- */
- if (res != NULL)
- xmlXPathFreeObject(res);
- if (ctxt->value == tmp) {
- res = valuePop(ctxt);
- xmlXPathFreeObject(res);
- }
-
- ctxt->context->node = NULL;
- }
-
- /*
- * The result is used as the new evaluation set.
- */
- xmlXPathFreeObject(obj);
- ctxt->context->node = NULL;
- ctxt->context->contextSize = -1;
- ctxt->context->proximityPosition = -1;
- valuePush(ctxt, xmlXPathWrapNodeSet(newset));
- }
- ctxt->context->node = oldnode;
- return (total);
- }
- case XPATH_OP_SORT:
- if (op->ch1 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- if ((ctxt->value != NULL) &&
- (ctxt->value->type == XPATH_NODESET) &&
- (ctxt->value->nodesetval != NULL))
- xmlXPathNodeSetSort(ctxt->value->nodesetval);
- return (total);
-#ifdef LIBXML_XPTR_ENABLED
- case XPATH_OP_RANGETO:{
- xmlXPathObjectPtr range;
- xmlXPathObjectPtr res, obj;
- xmlXPathObjectPtr tmp;
- xmlLocationSetPtr newset = NULL;
- xmlNodeSetPtr oldset;
- int i;
-
- if (op->ch1 != -1)
- total +=
- xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- if (op->ch2 == -1)
- return (total);
-
- CHECK_TYPE0(XPATH_NODESET);
- obj = valuePop(ctxt);
- oldset = obj->nodesetval;
- ctxt->context->node = NULL;
-
- newset = xmlXPtrLocationSetCreate(NULL);
-
- if (oldset != NULL) {
- for (i = 0; i < oldset->nodeNr; i++) {
- /*
- * Run the evaluation with a node list made of a single item
- * in the nodeset.
- */
- ctxt->context->node = oldset->nodeTab[i];
- tmp = xmlXPathNewNodeSet(ctxt->context->node);
- valuePush(ctxt, tmp);
-
- if (op->ch2 != -1)
- total +=
- xmlXPathCompOpEval(ctxt,
- &comp->steps[op->ch2]);
- CHECK_ERROR0;
-
- /*
- * The result of the evaluation need to be tested to
- * decided whether the filter succeeded or not
- */
- res = valuePop(ctxt);
- range =
- xmlXPtrNewRangeNodeObject(oldset->nodeTab[i],
- res);
- if (range != NULL) {
- xmlXPtrLocationSetAdd(newset, range);
- }
-
- /*
- * Cleanup
- */
- if (res != NULL)
- xmlXPathFreeObject(res);
- if (ctxt->value == tmp) {
- res = valuePop(ctxt);
- xmlXPathFreeObject(res);
- }
-
- ctxt->context->node = NULL;
- }
- }
-
- /*
- * The result is used as the new evaluation set.
- */
- xmlXPathFreeObject(obj);
- ctxt->context->node = NULL;
- ctxt->context->contextSize = -1;
- ctxt->context->proximityPosition = -1;
- valuePush(ctxt, xmlXPtrWrapLocationSet(newset));
- return (total);
- }
-#endif /* LIBXML_XPTR_ENABLED */
- }
- xmlGenericError(xmlGenericErrorContext,
- "XPath: unknown precompiled operation %d\n", op->op);
- return (total);
-}
-
-/**
- * xmlXPathRunEval:
- * @ctxt: the XPath parser context with the compiled expression
- *
- * Evaluate the Precompiled XPath expression in the given context.
- */
-static void
-xmlXPathRunEval(xmlXPathParserContextPtr ctxt) {
- xmlXPathCompExprPtr comp;
-
- if ((ctxt == NULL) || (ctxt->comp == NULL))
- return;
-
- if (ctxt->valueTab == NULL) {
- /* Allocate the value stack */
- ctxt->valueTab = (xmlXPathObjectPtr *)
- xmlMalloc(10 * sizeof(xmlXPathObjectPtr));
- if (ctxt->valueTab == NULL) {
- xmlFree(ctxt);
- }
- ctxt->valueNr = 0;
- ctxt->valueMax = 10;
- ctxt->value = NULL;
- }
- comp = ctxt->comp;
- if(comp->last < 0) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathRunEval: last is less than zero\n");
- return;
- }
- xmlXPathCompOpEval(ctxt, &comp->steps[comp->last]);
-}
-
-/************************************************************************
- * *
- * Public interfaces *
- * *
- ************************************************************************/
-
-/**
- * xmlXPathEvalPredicate:
- * @ctxt: the XPath context
- * @res: the Predicate Expression evaluation result
- *
- * Evaluate a predicate result for the current node.
- * A PredicateExpr is evaluated by evaluating the Expr and converting
- * the result to a boolean. If the result is a number, the result will
- * be converted to true if the number is equal to the position of the
- * context node in the context node list (as returned by the position
- * function) and will be converted to false otherwise; if the result
- * is not a number, then the result will be converted as if by a call
- * to the boolean function.
- *
- * Returns 1 if predicate is true, 0 otherwise
- */
-int
-xmlXPathEvalPredicate(xmlXPathContextPtr ctxt, xmlXPathObjectPtr res) {
- if (res == NULL) return(0);
- switch (res->type) {
- case XPATH_BOOLEAN:
- return(res->boolval);
- case XPATH_NUMBER:
- return(res->floatval == ctxt->proximityPosition);
- case XPATH_NODESET:
- case XPATH_XSLT_TREE:
- if (res->nodesetval == NULL)
- return(0);
- return(res->nodesetval->nodeNr != 0);
- case XPATH_STRING:
- return((res->stringval != NULL) &&
- (xmlStrlen(res->stringval) != 0));
- default:
- STRANGE
- }
- return(0);
-}
-
-/**
- * xmlXPathEvaluatePredicateResult:
- * @ctxt: the XPath Parser context
- * @res: the Predicate Expression evaluation result
- *
- * Evaluate a predicate result for the current node.
- * A PredicateExpr is evaluated by evaluating the Expr and converting
- * the result to a boolean. If the result is a number, the result will
- * be converted to true if the number is equal to the position of the
- * context node in the context node list (as returned by the position
- * function) and will be converted to false otherwise; if the result
- * is not a number, then the result will be converted as if by a call
- * to the boolean function.
- *
- * Returns 1 if predicate is true, 0 otherwise
- */
-int
-xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt,
- xmlXPathObjectPtr res) {
- if (res == NULL) return(0);
- switch (res->type) {
- case XPATH_BOOLEAN:
- return(res->boolval);
- case XPATH_NUMBER:
- return(res->floatval == ctxt->context->proximityPosition);
- case XPATH_NODESET:
- case XPATH_XSLT_TREE:
- if (res->nodesetval == NULL)
- return(0);
- return(res->nodesetval->nodeNr != 0);
- case XPATH_STRING:
- return((res->stringval != NULL) &&
- (xmlStrlen(res->stringval) != 0));
- default:
- STRANGE
- }
- return(0);
-}
-
-/**
- * xmlXPathCompile:
- * @str: the XPath expression
- *
- * Compile an XPath expression
- *
- * Returns the xmlXPathObjectPtr resulting from the evaluation or NULL.
- * the caller has to free the object.
- */
-xmlXPathCompExprPtr
-xmlXPathCompile(const xmlChar *str) {
- xmlXPathParserContextPtr ctxt;
- xmlXPathCompExprPtr comp;
-
- xmlXPathInit();
-
- ctxt = xmlXPathNewParserContext(str, NULL);
- xmlXPathCompileExpr(ctxt);
-
- if (*ctxt->cur != 0) {
- /*
- * aleksey: in some cases this line prints *second* error message
- * (see bug #78858) and probably this should be fixed.
- * However, we are not sure that all error messages are printed
- * out in other places. It's not critical so we leave it as-is for now
- */
- xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_EXPR_ERROR);
- comp = NULL;
- } else {
- comp = ctxt->comp;
- ctxt->comp = NULL;
- }
- xmlXPathFreeParserContext(ctxt);
- if (comp != NULL) {
- comp->expr = xmlStrdup(str);
-#ifdef DEBUG_EVAL_COUNTS
- comp->string = xmlStrdup(str);
- comp->nb = 0;
-#endif
- }
- return(comp);
-}
-
-/**
- * xmlXPathCompiledEval:
- * @comp: the compiled XPath expression
- * @ctx: the XPath context
- *
- * Evaluate the Precompiled XPath expression in the given context.
- *
- * Returns the xmlXPathObjectPtr resulting from the evaluation or NULL.
- * the caller has to free the object.
- */
-xmlXPathObjectPtr
-xmlXPathCompiledEval(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctx) {
- xmlXPathParserContextPtr ctxt;
- xmlXPathObjectPtr res, tmp, init = NULL;
- int stack = 0;
-#ifndef LIBXML_THREAD_ENABLED
- static int reentance = 0;
-#endif
-
- if ((comp == NULL) || (ctx == NULL))
- return(NULL);
- xmlXPathInit();
-
- CHECK_CONTEXT(ctx)
-
-#ifndef LIBXML_THREAD_ENABLED
- reentance++;
- if (reentance > 1)
- xmlXPathDisableOptimizer = 1;
-#endif
-
-#ifdef DEBUG_EVAL_COUNTS
- comp->nb++;
- if ((comp->string != NULL) && (comp->nb > 100)) {
- fprintf(stderr, "100 x %s\n", comp->string);
- comp->nb = 0;
- }
-#endif
- ctxt = xmlXPathCompParserContext(comp, ctx);
- xmlXPathRunEval(ctxt);
-
- if (ctxt->value == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathCompiledEval: evaluation failed\n");
- res = NULL;
- } else {
- res = valuePop(ctxt);
- }
-
-
- do {
- tmp = valuePop(ctxt);
- if (tmp != NULL) {
- if (tmp != init)
- stack++;
- xmlXPathFreeObject(tmp);
- }
- } while (tmp != NULL);
- if ((stack != 0) && (res != NULL)) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathCompiledEval: %d object left on the stack\n",
- stack);
- }
- if (ctxt->error != XPATH_EXPRESSION_OK) {
- xmlXPathFreeObject(res);
- res = NULL;
- }
-
-
- ctxt->comp = NULL;
- xmlXPathFreeParserContext(ctxt);
-#ifndef LIBXML_THREAD_ENABLED
- reentance--;
-#endif
- return(res);
-}
-
-/**
- * xmlXPathEvalExpr:
- * @ctxt: the XPath Parser context
- *
- * Parse and evaluate an XPath expression in the given context,
- * then push the result on the context stack
- */
-void
-xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) {
- xmlXPathCompileExpr(ctxt);
- CHECK_ERROR;
- xmlXPathRunEval(ctxt);
-}
-
-/**
- * xmlXPathEval:
- * @str: the XPath expression
- * @ctx: the XPath context
- *
- * Evaluate the XPath Location Path in the given context.
- *
- * Returns the xmlXPathObjectPtr resulting from the evaluation or NULL.
- * the caller has to free the object.
- */
-xmlXPathObjectPtr
-xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) {
- xmlXPathParserContextPtr ctxt;
- xmlXPathObjectPtr res, tmp, init = NULL;
- int stack = 0;
-
- xmlXPathInit();
-
- CHECK_CONTEXT(ctx)
-
- ctxt = xmlXPathNewParserContext(str, ctx);
- xmlXPathEvalExpr(ctxt);
-
- if (ctxt->value == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathEval: evaluation failed\n");
- res = NULL;
- } else if (*ctxt->cur != 0) {
- xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_EXPR_ERROR);
- res = NULL;
- } else {
- res = valuePop(ctxt);
- }
-
- do {
- tmp = valuePop(ctxt);
- if (tmp != NULL) {
- if (tmp != init)
- stack++;
- xmlXPathFreeObject(tmp);
- }
- } while (tmp != NULL);
- if ((stack != 0) && (res != NULL)) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathEval: %d object left on the stack\n",
- stack);
- }
- if (ctxt->error != XPATH_EXPRESSION_OK) {
- xmlXPathFreeObject(res);
- res = NULL;
- }
-
- xmlXPathFreeParserContext(ctxt);
- return(res);
-}
-
-/**
- * xmlXPathEvalExpression:
- * @str: the XPath expression
- * @ctxt: the XPath context
- *
- * Evaluate the XPath expression in the given context.
- *
- * Returns the xmlXPathObjectPtr resulting from the evaluation or NULL.
- * the caller has to free the object.
- */
-xmlXPathObjectPtr
-xmlXPathEvalExpression(const xmlChar *str, xmlXPathContextPtr ctxt) {
- xmlXPathParserContextPtr pctxt;
- xmlXPathObjectPtr res, tmp;
- int stack = 0;
-
- xmlXPathInit();
-
- CHECK_CONTEXT(ctxt)
-
- pctxt = xmlXPathNewParserContext(str, ctxt);
- xmlXPathEvalExpr(pctxt);
-
- if (*pctxt->cur != 0) {
- xmlXPatherror(pctxt, __FILE__, __LINE__, XPATH_EXPR_ERROR);
- res = NULL;
- } else {
- res = valuePop(pctxt);
- }
- do {
- tmp = valuePop(pctxt);
- if (tmp != NULL) {
- xmlXPathFreeObject(tmp);
- stack++;
- }
- } while (tmp != NULL);
- if ((stack != 0) && (res != NULL)) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathEvalExpression: %d object left on the stack\n",
- stack);
- }
- xmlXPathFreeParserContext(pctxt);
- return(res);
-}
-
-/************************************************************************
- * *
- * Extra functions not pertaining to the XPath spec *
- * *
- ************************************************************************/
-/**
- * xmlXPathEscapeUriFunction:
- * @ctxt: the XPath Parser context
- * @nargs: the number of arguments
- *
- * Implement the escape-uri() XPath function
- * string escape-uri(string $str, bool $escape-reserved)
- *
- * This function applies the URI escaping rules defined in section 2 of [RFC
- * 2396] to the string supplied as $uri-part, which typically represents all
- * or part of a URI. The effect of the function is to replace any special
- * character in the string by an escape sequence of the form %xx%yy...,
- * where xxyy... is the hexadecimal representation of the octets used to
- * represent the character in UTF-8.
- *
- * The set of characters that are escaped depends on the setting of the
- * boolean argument $escape-reserved.
- *
- * If $escape-reserved is true, all characters are escaped other than lower
- * case letters a-z, upper case letters A-Z, digits 0-9, and the characters
- * referred to in [RFC 2396] as "marks": specifically, "-" | "_" | "." | "!"
- * | "~" | "*" | "'" | "(" | ")". The "%" character itself is escaped only
- * if it is not followed by two hexadecimal digits (that is, 0-9, a-f, and
- * A-F).
- *
- * If $escape-reserved is false, the behavior differs in that characters
- * referred to in [RFC 2396] as reserved characters are not escaped. These
- * characters are ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | ",".
- *
- * [RFC 2396] does not define whether escaped URIs should use lower case or
- * upper case for hexadecimal digits. To ensure that escaped URIs can be
- * compared using string comparison functions, this function must always use
- * the upper-case letters A-F.
- *
- * Generally, $escape-reserved should be set to true when escaping a string
- * that is to form a single part of a URI, and to false when escaping an
- * entire URI or URI reference.
- *
- * In the case of non-ascii characters, the string is encoded according to
- * utf-8 and then converted according to RFC 2396.
- *
- * Examples
- * xf:escape-uri ("gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles#ocean"), true())
- * returns "gopher%3A%2F%2Fspinaltap.micro.umn.edu%2F00%2FWeather%2FCalifornia%2FLos%20Angeles%23ocean"
- * xf:escape-uri ("gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles#ocean"), false())
- * returns "gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles%23ocean"
- *
- */
-static void
-xmlXPathEscapeUriFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr str;
- int escape_reserved;
- xmlBufferPtr target;
- xmlChar *cptr;
- xmlChar escape[4];
-
- CHECK_ARITY(2);
-
- escape_reserved = xmlXPathPopBoolean(ctxt);
-
- CAST_TO_STRING;
- str = valuePop(ctxt);
-
- target = xmlBufferCreate();
-
- escape[0] = '%';
- escape[3] = 0;
-
- if (target) {
- for (cptr = str->stringval; *cptr; cptr++) {
- if ((*cptr >= 'A' && *cptr <= 'Z') ||
- (*cptr >= 'a' && *cptr <= 'z') ||
- (*cptr >= '0' && *cptr <= '9') ||
- *cptr == '-' || *cptr == '_' || *cptr == '.' ||
- *cptr == '!' || *cptr == '~' || *cptr == '*' ||
- *cptr == '\''|| *cptr == '(' || *cptr == ')' ||
- (*cptr == '%' &&
- ((cptr[1] >= 'A' && cptr[1] <= 'F') ||
- (cptr[1] >= 'a' && cptr[1] <= 'f') ||
- (cptr[1] >= '0' && cptr[1] <= '9')) &&
- ((cptr[2] >= 'A' && cptr[2] <= 'F') ||
- (cptr[2] >= 'a' && cptr[2] <= 'f') ||
- (cptr[2] >= '0' && cptr[2] <= '9'))) ||
- (!escape_reserved &&
- (*cptr == ';' || *cptr == '/' || *cptr == '?' ||
- *cptr == ':' || *cptr == '@' || *cptr == '&' ||
- *cptr == '=' || *cptr == '+' || *cptr == '$' ||
- *cptr == ','))) {
- xmlBufferAdd(target, cptr, 1);
- } else {
- if ((*cptr >> 4) < 10)
- escape[1] = '0' + (*cptr >> 4);
- else
- escape[1] = 'A' - 10 + (*cptr >> 4);
- if ((*cptr & 0xF) < 10)
- escape[2] = '0' + (*cptr & 0xF);
- else
- escape[2] = 'A' - 10 + (*cptr & 0xF);
-
- xmlBufferAdd(target, &escape[0], 3);
- }
- }
- }
- valuePush(ctxt, xmlXPathNewString(xmlBufferContent(target)));
- xmlBufferFree(target);
- xmlXPathFreeObject(str);
-}
-
-/**
- * xmlXPathRegisterAllFunctions:
- * @ctxt: the XPath context
- *
- * Registers all default XPath functions in this context
- */
-void
-xmlXPathRegisterAllFunctions(xmlXPathContextPtr ctxt)
-{
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"boolean",
- xmlXPathBooleanFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"ceiling",
- xmlXPathCeilingFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"count",
- xmlXPathCountFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"concat",
- xmlXPathConcatFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"contains",
- xmlXPathContainsFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"id",
- xmlXPathIdFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"false",
- xmlXPathFalseFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"floor",
- xmlXPathFloorFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"last",
- xmlXPathLastFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"lang",
- xmlXPathLangFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"local-name",
- xmlXPathLocalNameFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"not",
- xmlXPathNotFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"name",
- xmlXPathNameFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"namespace-uri",
- xmlXPathNamespaceURIFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"normalize-space",
- xmlXPathNormalizeFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"number",
- xmlXPathNumberFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"position",
- xmlXPathPositionFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"round",
- xmlXPathRoundFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"string",
- xmlXPathStringFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"string-length",
- xmlXPathStringLengthFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"starts-with",
- xmlXPathStartsWithFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"substring",
- xmlXPathSubstringFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"substring-before",
- xmlXPathSubstringBeforeFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"substring-after",
- xmlXPathSubstringAfterFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"sum",
- xmlXPathSumFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"true",
- xmlXPathTrueFunction);
- xmlXPathRegisterFunc(ctxt, (const xmlChar *)"translate",
- xmlXPathTranslateFunction);
-
- xmlXPathRegisterFuncNS(ctxt, (const xmlChar *)"escape-uri",
- (const xmlChar *)"http://www.w3.org/2002/08/xquery-functions",
- xmlXPathEscapeUriFunction);
-}
-
-#endif /* LIBXML_XPATH_ENABLED */
diff --git a/bundle/libxml/xpointer.c b/bundle/libxml/xpointer.c
deleted file mode 100644
index 4c4cf991c5..0000000000
--- a/bundle/libxml/xpointer.c
+++ /dev/null
@@ -1,2902 +0,0 @@
-/*
- * xpointer.c : Code to handle XML Pointer
- *
- * World Wide Web Consortium Working Draft 03-March-1998
- * http://www.w3.org/TR/2000/CR-xptr-20000607
- *
- * See Copyright for the status of this software.
- *
- * daniel@veillard.com
- */
-
-#define IN_LIBXML
-#include "libxml.h"
-
-/*
- * TODO: better handling of error cases, the full expression should
- * be parsed beforehand instead of a progressive evaluation
- * TODO: Access into entities references are not supported now ...
- * need a start to be able to pop out of entities refs since
- * parent is the endity declaration, not the ref.
- */
-
-#include <string.h>
-#include <libxml/xpointer.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/parserInternals.h>
-#include <libxml/uri.h>
-#include <libxml/xpath.h>
-#include <libxml/xpathInternals.h>
-#include <libxml/xmlerror.h>
-#include <libxml/globals.h>
-
-#ifdef LIBXML_XPTR_ENABLED
-
-/* Add support of the xmlns() xpointer scheme to initialize the namespaces */
-#define XPTR_XMLNS_SCHEME
-
-/* #define DEBUG_RANGES */
-#ifdef DEBUG_RANGES
-#ifdef LIBXML_DEBUG_ENABLED
-#include <libxml/debugXML.h>
-#endif
-#endif
-
-#define TODO \
- xmlGenericError(xmlGenericErrorContext, \
- "Unimplemented block at %s:%d\n", \
- __FILE__, __LINE__);
-
-#define STRANGE \
- xmlGenericError(xmlGenericErrorContext, \
- "Internal error at %s:%d\n", \
- __FILE__, __LINE__);
-
-/************************************************************************
- * *
- * A few helper functions for child sequences *
- * *
- ************************************************************************/
-
-xmlNodePtr xmlXPtrAdvanceNode(xmlNodePtr cur);
-/**
- * xmlXPtrGetArity:
- * @cur: the node
- *
- * Returns the number of child for an element, -1 in case of error
- */
-static int
-xmlXPtrGetArity(xmlNodePtr cur) {
- int i;
- if (cur == NULL)
- return(-1);
- cur = cur->children;
- for (i = 0;cur != NULL;cur = cur->next) {
- if ((cur->type == XML_ELEMENT_NODE) ||
- (cur->type == XML_DOCUMENT_NODE) ||
- (cur->type == XML_HTML_DOCUMENT_NODE)) {
- i++;
- }
- }
- return(i);
-}
-
-/**
- * xmlXPtrGetIndex:
- * @cur: the node
- *
- * Returns the index of the node in its parent children list, -1
- * in case of error
- */
-static int
-xmlXPtrGetIndex(xmlNodePtr cur) {
- int i;
- if (cur == NULL)
- return(-1);
- for (i = 1;cur != NULL;cur = cur->prev) {
- if ((cur->type == XML_ELEMENT_NODE) ||
- (cur->type == XML_DOCUMENT_NODE) ||
- (cur->type == XML_HTML_DOCUMENT_NODE)) {
- i++;
- }
- }
- return(i);
-}
-
-/**
- * xmlXPtrGetNthChild:
- * @cur: the node
- * @no: the child number
- *
- * Returns the @no'th element child of @cur or NULL
- */
-static xmlNodePtr
-xmlXPtrGetNthChild(xmlNodePtr cur, int no) {
- int i;
- if (cur == NULL)
- return(cur);
- cur = cur->children;
- for (i = 0;i <= no;cur = cur->next) {
- if (cur == NULL)
- return(cur);
- if ((cur->type == XML_ELEMENT_NODE) ||
- (cur->type == XML_DOCUMENT_NODE) ||
- (cur->type == XML_HTML_DOCUMENT_NODE)) {
- i++;
- if (i == no)
- break;
- }
- }
- return(cur);
-}
-
-/************************************************************************
- * *
- * Handling of XPointer specific types *
- * *
- ************************************************************************/
-
-/**
- * xmlXPtrCmpPoints:
- * @node1: the first node
- * @index1: the first index
- * @node2: the second node
- * @index2: the second index
- *
- * Compare two points w.r.t document order
- *
- * Returns -2 in case of error 1 if first point < second point, 0 if
- * that's the same point, -1 otherwise
- */
-static int
-xmlXPtrCmpPoints(xmlNodePtr node1, int index1, xmlNodePtr node2, int index2) {
- if ((node1 == NULL) || (node2 == NULL))
- return(-2);
- /*
- * a couple of optimizations which will avoid computations in most cases
- */
- if (node1 == node2) {
- if (index1 < index2)
- return(1);
- if (index1 > index2)
- return(-1);
- return(0);
- }
- return(xmlXPathCmpNodes(node1, node2));
-}
-
-/**
- * xmlXPtrNewPoint:
- * @node: the xmlNodePtr
- * @indx: the indx within the node
- *
- * Create a new xmlXPathObjectPtr of type point
- *
- * Returns the newly created object.
- */
-static xmlXPathObjectPtr
-xmlXPtrNewPoint(xmlNodePtr node, int indx) {
- xmlXPathObjectPtr ret;
-
- if (node == NULL)
- return(NULL);
- if (indx < 0)
- return(NULL);
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrNewPoint: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_POINT;
- ret->user = (void *) node;
- ret->index = indx;
- return(ret);
-}
-
-/**
- * xmlXPtrRangeCheckOrder:
- * @range: an object range
- *
- * Make sure the points in the range are in the right order
- */
-static void
-xmlXPtrRangeCheckOrder(xmlXPathObjectPtr range) {
- int tmp;
- xmlNodePtr tmp2;
- if (range == NULL)
- return;
- if (range->type != XPATH_RANGE)
- return;
- if (range->user2 == NULL)
- return;
- tmp = xmlXPtrCmpPoints(range->user, range->index,
- range->user2, range->index2);
- if (tmp == -1) {
- tmp2 = range->user;
- range->user = range->user2;
- range->user2 = tmp2;
- tmp = range->index;
- range->index = range->index2;
- range->index2 = tmp;
- }
-}
-
-/**
- * xmlXPtrRangesEqual:
- * @range1: the first range
- * @range2: the second range
- *
- * Compare two ranges
- *
- * Returns 1 if equal, 0 otherwise
- */
-static int
-xmlXPtrRangesEqual(xmlXPathObjectPtr range1, xmlXPathObjectPtr range2) {
- if (range1 == range2)
- return(1);
- if ((range1 == NULL) || (range2 == NULL))
- return(0);
- if (range1->type != range2->type)
- return(0);
- if (range1->type != XPATH_RANGE)
- return(0);
- if (range1->user != range2->user)
- return(0);
- if (range1->index != range2->index)
- return(0);
- if (range1->user2 != range2->user2)
- return(0);
- if (range1->index2 != range2->index2)
- return(0);
- return(1);
-}
-
-/**
- * xmlXPtrNewRange:
- * @start: the starting node
- * @startindex: the start index
- * @end: the ending point
- * @endindex: the ending index
- *
- * Create a new xmlXPathObjectPtr of type range
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPtrNewRange(xmlNodePtr start, int startindex,
- xmlNodePtr end, int endindex) {
- xmlXPathObjectPtr ret;
-
- if (start == NULL)
- return(NULL);
- if (end == NULL)
- return(NULL);
- if (startindex < 0)
- return(NULL);
- if (endindex < 0)
- return(NULL);
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrNewRange: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_RANGE;
- ret->user = start;
- ret->index = startindex;
- ret->user2 = end;
- ret->index2 = endindex;
- xmlXPtrRangeCheckOrder(ret);
- return(ret);
-}
-
-/**
- * xmlXPtrNewRangePoints:
- * @start: the starting point
- * @end: the ending point
- *
- * Create a new xmlXPathObjectPtr of type range using 2 Points
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPtrNewRangePoints(xmlXPathObjectPtr start, xmlXPathObjectPtr end) {
- xmlXPathObjectPtr ret;
-
- if (start == NULL)
- return(NULL);
- if (end == NULL)
- return(NULL);
- if (start->type != XPATH_POINT)
- return(NULL);
- if (end->type != XPATH_POINT)
- return(NULL);
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrNewRangePoints: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_RANGE;
- ret->user = start->user;
- ret->index = start->index;
- ret->user2 = end->user;
- ret->index2 = end->index;
- xmlXPtrRangeCheckOrder(ret);
- return(ret);
-}
-
-/**
- * xmlXPtrNewRangePointNode:
- * @start: the starting point
- * @end: the ending node
- *
- * Create a new xmlXPathObjectPtr of type range from a point to a node
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPtrNewRangePointNode(xmlXPathObjectPtr start, xmlNodePtr end) {
- xmlXPathObjectPtr ret;
-
- if (start == NULL)
- return(NULL);
- if (end == NULL)
- return(NULL);
- if (start->type != XPATH_POINT)
- return(NULL);
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrNewRangePointNode: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_RANGE;
- ret->user = start->user;
- ret->index = start->index;
- ret->user2 = end;
- ret->index2 = -1;
- xmlXPtrRangeCheckOrder(ret);
- return(ret);
-}
-
-/**
- * xmlXPtrNewRangeNodePoint:
- * @start: the starting node
- * @end: the ending point
- *
- * Create a new xmlXPathObjectPtr of type range from a node to a point
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPtrNewRangeNodePoint(xmlNodePtr start, xmlXPathObjectPtr end) {
- xmlXPathObjectPtr ret;
-
- if (start == NULL)
- return(NULL);
- if (end == NULL)
- return(NULL);
- if (start->type != XPATH_POINT)
- return(NULL);
- if (end->type != XPATH_POINT)
- return(NULL);
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrNewRangeNodePoint: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_RANGE;
- ret->user = start;
- ret->index = -1;
- ret->user2 = end->user;
- ret->index2 = end->index;
- xmlXPtrRangeCheckOrder(ret);
- return(ret);
-}
-
-/**
- * xmlXPtrNewRangeNodes:
- * @start: the starting node
- * @end: the ending node
- *
- * Create a new xmlXPathObjectPtr of type range using 2 nodes
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPtrNewRangeNodes(xmlNodePtr start, xmlNodePtr end) {
- xmlXPathObjectPtr ret;
-
- if (start == NULL)
- return(NULL);
- if (end == NULL)
- return(NULL);
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrNewRangeNodes: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_RANGE;
- ret->user = start;
- ret->index = -1;
- ret->user2 = end;
- ret->index2 = -1;
- xmlXPtrRangeCheckOrder(ret);
- return(ret);
-}
-
-/**
- * xmlXPtrNewCollapsedRange:
- * @start: the starting and ending node
- *
- * Create a new xmlXPathObjectPtr of type range using a single nodes
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPtrNewCollapsedRange(xmlNodePtr start) {
- xmlXPathObjectPtr ret;
-
- if (start == NULL)
- return(NULL);
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrNewCollapsedRange: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_RANGE;
- ret->user = start;
- ret->index = -1;
- ret->user2 = NULL;
- ret->index2 = -1;
- return(ret);
-}
-
-/**
- * xmlXPtrNewRangeNodeObject:
- * @start: the starting node
- * @end: the ending object
- *
- * Create a new xmlXPathObjectPtr of type range from a not to an object
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPtrNewRangeNodeObject(xmlNodePtr start, xmlXPathObjectPtr end) {
- xmlXPathObjectPtr ret;
-
- if (start == NULL)
- return(NULL);
- if (end == NULL)
- return(NULL);
- switch (end->type) {
- case XPATH_POINT:
- break;
- case XPATH_NODESET:
- /*
- * Empty set ...
- */
- if (end->nodesetval->nodeNr <= 0)
- return(NULL);
- break;
- default:
- TODO
- return(NULL);
- }
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrNewRangeNodeObject: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_RANGE;
- ret->user = start;
- ret->index = -1;
- switch (end->type) {
- case XPATH_POINT:
- ret->user2 = end->user;
- ret->index2 = end->index;
- case XPATH_NODESET: {
- ret->user2 = end->nodesetval->nodeTab[end->nodesetval->nodeNr - 1];
- ret->index2 = -1;
- break;
- }
- default:
- STRANGE
- return(NULL);
- }
- xmlXPtrRangeCheckOrder(ret);
- return(ret);
-}
-
-#define XML_RANGESET_DEFAULT 10
-
-/**
- * xmlXPtrLocationSetCreate:
- * @val: an initial xmlXPathObjectPtr, or NULL
- *
- * Create a new xmlLocationSetPtr of type double and of value @val
- *
- * Returns the newly created object.
- */
-xmlLocationSetPtr
-xmlXPtrLocationSetCreate(xmlXPathObjectPtr val) {
- xmlLocationSetPtr ret;
-
- ret = (xmlLocationSetPtr) xmlMalloc(sizeof(xmlLocationSet));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrLocationSetCreate: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlLocationSet));
- if (val != NULL) {
- ret->locTab = (xmlXPathObjectPtr *) xmlMalloc(XML_RANGESET_DEFAULT *
- sizeof(xmlXPathObjectPtr));
- if (ret->locTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrLocationSetCreate: out of memory\n");
- return(NULL);
- }
- memset(ret->locTab, 0 ,
- XML_RANGESET_DEFAULT * (size_t) sizeof(xmlXPathObjectPtr));
- ret->locMax = XML_RANGESET_DEFAULT;
- ret->locTab[ret->locNr++] = val;
- }
- return(ret);
-}
-
-/**
- * xmlXPtrLocationSetAdd:
- * @cur: the initial range set
- * @val: a new xmlXPathObjectPtr
- *
- * add a new xmlXPathObjectPtr to an existing LocationSet
- * If the location already exist in the set @val is freed.
- */
-void
-xmlXPtrLocationSetAdd(xmlLocationSetPtr cur, xmlXPathObjectPtr val) {
- int i;
-
- if (val == NULL) return;
-
- /*
- * check against doublons
- */
- for (i = 0;i < cur->locNr;i++) {
- if (xmlXPtrRangesEqual(cur->locTab[i], val)) {
- xmlXPathFreeObject(val);
- return;
- }
- }
-
- /*
- * grow the locTab if needed
- */
- if (cur->locMax == 0) {
- cur->locTab = (xmlXPathObjectPtr *) xmlMalloc(XML_RANGESET_DEFAULT *
- sizeof(xmlXPathObjectPtr));
- if (cur->locTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrLocationSetAdd: out of memory\n");
- return;
- }
- memset(cur->locTab, 0 ,
- XML_RANGESET_DEFAULT * (size_t) sizeof(xmlXPathObjectPtr));
- cur->locMax = XML_RANGESET_DEFAULT;
- } else if (cur->locNr == cur->locMax) {
- xmlXPathObjectPtr *temp;
-
- cur->locMax *= 2;
- temp = (xmlXPathObjectPtr *) xmlRealloc(cur->locTab, cur->locMax *
- sizeof(xmlXPathObjectPtr));
- if (temp == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrLocationSetAdd: out of memory\n");
- return;
- }
- cur->locTab = temp;
- }
- cur->locTab[cur->locNr++] = val;
-}
-
-/**
- * xmlXPtrLocationSetMerge:
- * @val1: the first LocationSet
- * @val2: the second LocationSet
- *
- * Merges two rangesets, all ranges from @val2 are added to @val1
- *
- * Returns val1 once extended or NULL in case of error.
- */
-xmlLocationSetPtr
-xmlXPtrLocationSetMerge(xmlLocationSetPtr val1, xmlLocationSetPtr val2) {
- int i;
-
- if (val1 == NULL) return(NULL);
- if (val2 == NULL) return(val1);
-
- /*
- * !!!!! this can be optimized a lot, knowing that both
- * val1 and val2 already have unicity of their values.
- */
-
- for (i = 0;i < val2->locNr;i++)
- xmlXPtrLocationSetAdd(val1, val2->locTab[i]);
-
- return(val1);
-}
-
-/**
- * xmlXPtrLocationSetDel:
- * @cur: the initial range set
- * @val: an xmlXPathObjectPtr
- *
- * Removes an xmlXPathObjectPtr from an existing LocationSet
- */
-void
-xmlXPtrLocationSetDel(xmlLocationSetPtr cur, xmlXPathObjectPtr val) {
- int i;
-
- if (cur == NULL) return;
- if (val == NULL) return;
-
- /*
- * check against doublons
- */
- for (i = 0;i < cur->locNr;i++)
- if (cur->locTab[i] == val) break;
-
- if (i >= cur->locNr) {
-#ifdef DEBUG
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrLocationSetDel: Range wasn't found in RangeList\n");
-#endif
- return;
- }
- cur->locNr--;
- for (;i < cur->locNr;i++)
- cur->locTab[i] = cur->locTab[i + 1];
- cur->locTab[cur->locNr] = NULL;
-}
-
-/**
- * xmlXPtrLocationSetRemove:
- * @cur: the initial range set
- * @val: the index to remove
- *
- * Removes an entry from an existing LocationSet list.
- */
-void
-xmlXPtrLocationSetRemove(xmlLocationSetPtr cur, int val) {
- if (cur == NULL) return;
- if (val >= cur->locNr) return;
- cur->locNr--;
- for (;val < cur->locNr;val++)
- cur->locTab[val] = cur->locTab[val + 1];
- cur->locTab[cur->locNr] = NULL;
-}
-
-/**
- * xmlXPtrFreeLocationSet:
- * @obj: the xmlLocationSetPtr to free
- *
- * Free the LocationSet compound (not the actual ranges !).
- */
-void
-xmlXPtrFreeLocationSet(xmlLocationSetPtr obj) {
- int i;
-
- if (obj == NULL) return;
- if (obj->locTab != NULL) {
- for (i = 0;i < obj->locNr; i++) {
- xmlXPathFreeObject(obj->locTab[i]);
- }
- xmlFree(obj->locTab);
- }
- xmlFree(obj);
-}
-
-/**
- * xmlXPtrNewLocationSetNodes:
- * @start: the start NodePtr value
- * @end: the end NodePtr value or NULL
- *
- * Create a new xmlXPathObjectPtr of type LocationSet and initialize
- * it with the single range made of the two nodes @start and @end
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPtrNewLocationSetNodes(xmlNodePtr start, xmlNodePtr end) {
- xmlXPathObjectPtr ret;
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrNewLocationSetNodes: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_LOCATIONSET;
- if (end == NULL)
- ret->user = xmlXPtrLocationSetCreate(xmlXPtrNewCollapsedRange(start));
- else
- ret->user = xmlXPtrLocationSetCreate(xmlXPtrNewRangeNodes(start,end));
- return(ret);
-}
-
-/**
- * xmlXPtrNewLocationSetNodeSet:
- * @set: a node set
- *
- * Create a new xmlXPathObjectPtr of type LocationSet and initialize
- * it with all the nodes from @set
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set) {
- xmlXPathObjectPtr ret;
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrNewLocationSetNodeSet: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_LOCATIONSET;
- if (set != NULL) {
- int i;
- xmlLocationSetPtr newset;
-
- newset = xmlXPtrLocationSetCreate(NULL);
- if (newset == NULL)
- return(ret);
-
- for (i = 0;i < set->nodeNr;i++)
- xmlXPtrLocationSetAdd(newset,
- xmlXPtrNewCollapsedRange(set->nodeTab[i]));
-
- ret->user = (void *) newset;
- }
- return(ret);
-}
-
-/**
- * xmlXPtrWrapLocationSet:
- * @val: the LocationSet value
- *
- * Wrap the LocationSet @val in a new xmlXPathObjectPtr
- *
- * Returns the newly created object.
- */
-xmlXPathObjectPtr
-xmlXPtrWrapLocationSet(xmlLocationSetPtr val) {
- xmlXPathObjectPtr ret;
-
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrWrapLocationSet: out of memory\n");
- return(NULL);
- }
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
- ret->type = XPATH_LOCATIONSET;
- ret->user = (void *) val;
- return(ret);
-}
-
-/************************************************************************
- * *
- * The parser *
- * *
- ************************************************************************/
-
-/*
- * Macros for accessing the content. Those should be used only by the parser,
- * and not exported.
- *
- * Dirty macros, i.e. one need to make assumption on the context to use them
- *
- * CUR_PTR return the current pointer to the xmlChar to be parsed.
- * CUR returns the current xmlChar value, i.e. a 8 bit value
- * in ISO-Latin or UTF-8.
- * This should be used internally by the parser
- * only to compare to ASCII values otherwise it would break when
- * running with UTF-8 encoding.
- * NXT(n) returns the n'th next xmlChar. Same as CUR is should be used only
- * to compare on ASCII based substring.
- * SKIP(n) Skip n xmlChar, and must also be used only to skip ASCII defined
- * strings within the parser.
- * CURRENT Returns the current char value, with the full decoding of
- * UTF-8 if we are using this mode. It returns an int.
- * NEXT Skip to the next character, this does the proper decoding
- * in UTF-8 mode. It also pop-up unfinished entities on the fly.
- * It returns the pointer to the current xmlChar.
- */
-
-#define CUR (*ctxt->cur)
-#define SKIP(val) ctxt->cur += (val)
-#define NXT(val) ctxt->cur[(val)]
-#define CUR_PTR ctxt->cur
-
-#define SKIP_BLANKS \
- while (IS_BLANK(*(ctxt->cur))) NEXT
-
-#define CURRENT (*ctxt->cur)
-#define NEXT ((*ctxt->cur) ? ctxt->cur++: ctxt->cur)
-
-/*
- * xmlXPtrGetChildNo:
- * @ctxt: the XPointer Parser context
- * @index: the child number
- *
- * Move the current node of the nodeset on the stack to the
- * given child if found
- */
-static void
-xmlXPtrGetChildNo(xmlXPathParserContextPtr ctxt, int indx) {
- xmlNodePtr cur = NULL;
- xmlXPathObjectPtr obj;
- xmlNodeSetPtr oldset;
-
- CHECK_TYPE(XPATH_NODESET);
- obj = valuePop(ctxt);
- oldset = obj->nodesetval;
- if ((indx <= 0) || (oldset == NULL) || (oldset->nodeNr != 1)) {
- xmlXPathFreeObject(obj);
- valuePush(ctxt, xmlXPathNewNodeSet(NULL));
- return;
- }
- cur = xmlXPtrGetNthChild(oldset->nodeTab[0], indx);
- if (cur == NULL) {
- xmlXPathFreeObject(obj);
- valuePush(ctxt, xmlXPathNewNodeSet(NULL));
- return;
- }
- oldset->nodeTab[0] = cur;
- valuePush(ctxt, obj);
-}
-
-/**
- * xmlXPtrEvalXPtrPart:
- * @ctxt: the XPointer Parser context
- * @name: the preparsed Scheme for the XPtrPart
- *
- * XPtrPart ::= 'xpointer' '(' XPtrExpr ')'
- * | Scheme '(' SchemeSpecificExpr ')'
- *
- * Scheme ::= NCName - 'xpointer' [VC: Non-XPointer schemes]
- *
- * SchemeSpecificExpr ::= StringWithBalancedParens
- *
- * StringWithBalancedParens ::=
- * [^()]* ('(' StringWithBalancedParens ')' [^()]*)*
- * [VC: Parenthesis escaping]
- *
- * XPtrExpr ::= Expr [VC: Parenthesis escaping]
- *
- * VC: Parenthesis escaping:
- * The end of an XPointer part is signaled by the right parenthesis ")"
- * character that is balanced with the left parenthesis "(" character
- * that began the part. Any unbalanced parenthesis character inside the
- * expression, even within literals, must be escaped with a circumflex (^)
- * character preceding it. If the expression contains any literal
- * occurrences of the circumflex, each must be escaped with an additional
- * circumflex (that is, ^^). If the unescaped parentheses in the expression
- * are not balanced, a syntax error results.
- *
- * Parse and evaluate an XPtrPart. Basically it generates the unescaped
- * string and if the scheme is 'xpointer' it will call the XPath interpreter.
- *
- * TODO: there is no new scheme registration mechanism
- */
-
-static void
-xmlXPtrEvalXPtrPart(xmlXPathParserContextPtr ctxt, xmlChar *name) {
- xmlChar *buffer, *cur;
- int len;
- int level;
-
- if (name == NULL)
- name = xmlXPathParseName(ctxt);
- if (name == NULL)
- XP_ERROR(XPATH_EXPR_ERROR);
-
- if (CUR != '(')
- XP_ERROR(XPATH_EXPR_ERROR);
- NEXT;
- level = 1;
-
- len = xmlStrlen(ctxt->cur);
- len++;
- buffer = (xmlChar *) xmlMalloc(len * sizeof (xmlChar));
- if (buffer == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrEvalXPtrPart: out of memory\n");
- return;
- }
-
- cur = buffer;
- while (CUR != 0) {
- if (CUR == ')') {
- level--;
- if (level == 0) {
- NEXT;
- break;
- }
- *cur++ = CUR;
- } else if (CUR == '(') {
- level++;
- *cur++ = CUR;
- } else if (CUR == '^') {
- NEXT;
- if ((CUR == ')') || (CUR == '(') || (CUR == '^')) {
- *cur++ = CUR;
- } else {
- *cur++ = '^';
- *cur++ = CUR;
- }
- } else {
- *cur++ = CUR;
- }
- NEXT;
- }
- *cur = 0;
-
- if ((level != 0) && (CUR == 0)) {
- xmlFree(buffer);
- XP_ERROR(XPTR_SYNTAX_ERROR);
- }
-
- if (xmlStrEqual(name, (xmlChar *) "xpointer")) {
- const xmlChar *left = CUR_PTR;
-
- CUR_PTR = buffer;
- xmlXPathEvalExpr(ctxt);
- CUR_PTR=left;
-#ifdef XPTR_XMLNS_SCHEME
- } else if (xmlStrEqual(name, (xmlChar *) "xmlns")) {
- const xmlChar *left = CUR_PTR;
- xmlChar *prefix;
- xmlChar *URI;
- xmlURIPtr value;
-
- CUR_PTR = buffer;
- prefix = xmlXPathParseNCName(ctxt);
- if (prefix == NULL) {
- xmlFree(buffer);
- xmlFree(name);
- XP_ERROR(XPTR_SYNTAX_ERROR);
- }
- SKIP_BLANKS;
- if (CUR != '=') {
- xmlFree(prefix);
- xmlFree(buffer);
- xmlFree(name);
- XP_ERROR(XPTR_SYNTAX_ERROR);
- }
- NEXT;
- SKIP_BLANKS;
- /* @@ check escaping in the XPointer WD */
-
- value = xmlParseURI((const char *)ctxt->cur);
- if (value == NULL) {
- xmlFree(prefix);
- xmlFree(buffer);
- xmlFree(name);
- XP_ERROR(XPTR_SYNTAX_ERROR);
- }
- URI = xmlSaveUri(value);
- xmlFreeURI(value);
- if (URI == NULL) {
- xmlFree(prefix);
- xmlFree(buffer);
- xmlFree(name);
- XP_ERROR(XPATH_MEMORY_ERROR);
- }
-
- xmlXPathRegisterNs(ctxt->context, prefix, URI);
- CUR_PTR = left;
- xmlFree(URI);
- xmlFree(prefix);
-#endif /* XPTR_XMLNS_SCHEME */
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "unsupported scheme '%s'\n", name);
- }
- xmlFree(buffer);
- xmlFree(name);
-}
-
-/**
- * xmlXPtrEvalFullXPtr:
- * @ctxt: the XPointer Parser context
- * @name: the preparsed Scheme for the first XPtrPart
- *
- * FullXPtr ::= XPtrPart (S? XPtrPart)*
- *
- * As the specs says:
- * -----------
- * When multiple XPtrParts are provided, they must be evaluated in
- * left-to-right order. If evaluation of one part fails, the nexti
- * is evaluated. The following conditions cause XPointer part failure:
- *
- * - An unknown scheme
- * - A scheme that does not locate any sub-resource present in the resource
- * - A scheme that is not applicable to the media type of the resource
- *
- * The XPointer application must consume a failed XPointer part and
- * attempt to evaluate the next one, if any. The result of the first
- * XPointer part whose evaluation succeeds is taken to be the fragment
- * located by the XPointer as a whole. If all the parts fail, the result
- * for the XPointer as a whole is a sub-resource error.
- * -----------
- *
- * Parse and evaluate a Full XPtr i.e. possibly a cascade of XPath based
- * expressions or other schemes.
- */
-static void
-xmlXPtrEvalFullXPtr(xmlXPathParserContextPtr ctxt, xmlChar *name) {
- if (name == NULL)
- name = xmlXPathParseName(ctxt);
- if (name == NULL)
- XP_ERROR(XPATH_EXPR_ERROR);
- while (name != NULL) {
- xmlXPtrEvalXPtrPart(ctxt, name);
-
- /* in case of syntax error, break here */
- if (ctxt->error != XPATH_EXPRESSION_OK)
- return;
-
- /*
- * If the returned value is a non-empty nodeset
- * or location set, return here.
- */
- if (ctxt->value != NULL) {
- xmlXPathObjectPtr obj = ctxt->value;
-
- switch (obj->type) {
- case XPATH_LOCATIONSET: {
- xmlLocationSetPtr loc = ctxt->value->user;
- if ((loc != NULL) && (loc->locNr > 0))
- return;
- break;
- }
- case XPATH_NODESET: {
- xmlNodeSetPtr loc = ctxt->value->nodesetval;
- if ((loc != NULL) && (loc->nodeNr > 0))
- return;
- break;
- }
- default:
- break;
- }
-
- /*
- * Evaluating to improper values is equivalent to
- * a sub-resource error, clean-up the stack
- */
- do {
- obj = valuePop(ctxt);
- if (obj != NULL) {
- xmlXPathFreeObject(obj);
- }
- } while (obj != NULL);
- }
-
- /*
- * Is there another XPointer part.
- */
- SKIP_BLANKS;
- name = xmlXPathParseName(ctxt);
- }
-}
-
-/**
- * xmlXPtrEvalChildSeq:
- * @ctxt: the XPointer Parser context
- * @name: a possible ID name of the child sequence
- *
- * ChildSeq ::= '/1' ('/' [0-9]*)*
- * | Name ('/' [0-9]*)+
- *
- * Parse and evaluate a Child Sequence. This routine also handle the
- * case of a Bare Name used to get a document ID.
- */
-static void
-xmlXPtrEvalChildSeq(xmlXPathParserContextPtr ctxt, xmlChar *name) {
- /*
- * XPointer don't allow by syntax to address in mutirooted trees
- * this might prove useful in some cases, warn about it.
- */
- if ((name == NULL) && (CUR == '/') && (NXT(1) != '1')) {
- xmlGenericError(xmlGenericErrorContext,
- "warning: ChildSeq not starting by /1\n");
- }
-
- if (name != NULL) {
- valuePush(ctxt, xmlXPathNewString(name));
- xmlFree(name);
- xmlXPathIdFunction(ctxt, 1);
- CHECK_ERROR;
- }
-
- while (CUR == '/') {
- int child = 0;
- NEXT;
-
- while ((CUR >= '0') && (CUR <= '9')) {
- child = child * 10 + (CUR - '0');
- NEXT;
- }
- xmlXPtrGetChildNo(ctxt, child);
- }
-}
-
-
-/**
- * xmlXPtrEvalXPointer:
- * @ctxt: the XPointer Parser context
- *
- * XPointer ::= Name
- * | ChildSeq
- * | FullXPtr
- *
- * Parse and evaluate an XPointer
- */
-static void
-xmlXPtrEvalXPointer(xmlXPathParserContextPtr ctxt) {
- if (ctxt->valueTab == NULL) {
- /* Allocate the value stack */
- ctxt->valueTab = (xmlXPathObjectPtr *)
- xmlMalloc(10 * sizeof(xmlXPathObjectPtr));
- if (ctxt->valueTab == NULL) {
- xmlFree(ctxt);
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathEvalXPointer: out of memory\n");
- return;
- }
- ctxt->valueNr = 0;
- ctxt->valueMax = 10;
- ctxt->value = NULL;
- }
- SKIP_BLANKS;
- if (CUR == '/') {
- xmlXPathRoot(ctxt);
- xmlXPtrEvalChildSeq(ctxt, NULL);
- } else {
- xmlChar *name;
-
- name = xmlXPathParseName(ctxt);
- if (name == NULL)
- XP_ERROR(XPATH_EXPR_ERROR);
- if (CUR == '(') {
- xmlXPtrEvalFullXPtr(ctxt, name);
- /* Short evaluation */
- return;
- } else {
- /* this handle both Bare Names and Child Sequences */
- xmlXPtrEvalChildSeq(ctxt, name);
- }
- }
- SKIP_BLANKS;
- if (CUR != 0)
- XP_ERROR(XPATH_EXPR_ERROR);
-}
-
-
-/************************************************************************
- * *
- * General routines *
- * *
- ************************************************************************/
-
-void xmlXPtrStringRangeFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPtrStartPointFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPtrEndPointFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPtrHereFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPtrOriginFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPtrRangeInsideFunction(xmlXPathParserContextPtr ctxt, int nargs);
-void xmlXPtrRangeFunction(xmlXPathParserContextPtr ctxt, int nargs);
-
-/**
- * xmlXPtrNewContext:
- * @doc: the XML document
- * @here: the node that directly contains the XPointer being evaluated or NULL
- * @origin: the element from which a user or program initiated traversal of
- * the link, or NULL.
- *
- * Create a new XPointer context
- *
- * Returns the xmlXPathContext just allocated.
- */
-xmlXPathContextPtr
-xmlXPtrNewContext(xmlDocPtr doc, xmlNodePtr here, xmlNodePtr origin) {
- xmlXPathContextPtr ret;
-
- ret = xmlXPathNewContext(doc);
- if (ret == NULL)
- return(ret);
- ret->xptr = 1;
- ret->here = here;
- ret->origin = origin;
-
- xmlXPathRegisterFunc(ret, (xmlChar *)"range-to",
- xmlXPtrRangeToFunction);
- xmlXPathRegisterFunc(ret, (xmlChar *)"range",
- xmlXPtrRangeFunction);
- xmlXPathRegisterFunc(ret, (xmlChar *)"range-inside",
- xmlXPtrRangeInsideFunction);
- xmlXPathRegisterFunc(ret, (xmlChar *)"string-range",
- xmlXPtrStringRangeFunction);
- xmlXPathRegisterFunc(ret, (xmlChar *)"start-point",
- xmlXPtrStartPointFunction);
- xmlXPathRegisterFunc(ret, (xmlChar *)"end-point",
- xmlXPtrEndPointFunction);
- xmlXPathRegisterFunc(ret, (xmlChar *)"here",
- xmlXPtrHereFunction);
- xmlXPathRegisterFunc(ret, (xmlChar *)" origin",
- xmlXPtrOriginFunction);
-
- return(ret);
-}
-
-/**
- * xmlXPtrEval:
- * @str: the XPointer expression
- * @ctx: the XPointer context
- *
- * Evaluate the XPath Location Path in the given context.
- *
- * Returns the xmlXPathObjectPtr resulting from the evaluation or NULL.
- * the caller has to free the object.
- */
-xmlXPathObjectPtr
-xmlXPtrEval(const xmlChar *str, xmlXPathContextPtr ctx) {
- xmlXPathParserContextPtr ctxt;
- xmlXPathObjectPtr res = NULL, tmp;
- xmlXPathObjectPtr init = NULL;
- int stack = 0;
-
- xmlXPathInit();
-
- if ((ctx == NULL) || (str == NULL))
- return(NULL);
-
- ctxt = xmlXPathNewParserContext(str, ctx);
- ctxt->xptr = 1;
- xmlXPtrEvalXPointer(ctxt);
-
- if ((ctxt->value != NULL) &&
- (ctxt->value->type != XPATH_NODESET) &&
- (ctxt->value->type != XPATH_LOCATIONSET)) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrEval: evaluation failed to return a node set\n");
- } else {
- res = valuePop(ctxt);
- }
-
- do {
- tmp = valuePop(ctxt);
- if (tmp != NULL) {
- if (tmp != init) {
- if (tmp->type == XPATH_NODESET) {
- /*
- * Evaluation may push a root nodeset which is unused
- */
- xmlNodeSetPtr set;
- set = tmp->nodesetval;
- if ((set->nodeNr != 1) ||
- (set->nodeTab[0] != (xmlNodePtr) ctx->doc))
- stack++;
- } else
- stack++;
- }
- xmlXPathFreeObject(tmp);
- }
- } while (tmp != NULL);
- if (stack != 0) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPtrEval: %d object left on the stack\n",
- stack);
- }
- if (ctxt->error != XPATH_EXPRESSION_OK) {
- xmlXPathFreeObject(res);
- res = NULL;
- }
-
- xmlXPathFreeParserContext(ctxt);
- return(res);
-}
-
-/**
- * xmlXPtrBuildRangeNodeList:
- * @range: a range object
- *
- * Build a node list tree copy of the range
- *
- * Returns an xmlNodePtr list or NULL.
- * the caller has to free the node tree.
- */
-static xmlNodePtr
-xmlXPtrBuildRangeNodeList(xmlXPathObjectPtr range) {
- /* pointers to generated nodes */
- xmlNodePtr list = NULL, last = NULL, parent = NULL, tmp;
- /* pointers to traversal nodes */
- xmlNodePtr start, cur, end;
- int index1, index2;
-
- if (range == NULL)
- return(NULL);
- if (range->type != XPATH_RANGE)
- return(NULL);
- start = (xmlNodePtr) range->user;
-
- if (start == NULL)
- return(NULL);
- end = range->user2;
- if (end == NULL)
- return(xmlCopyNode(start, 1));
-
- cur = start;
- index1 = range->index;
- index2 = range->index2;
- while (cur != NULL) {
- if (cur == end) {
- if (cur->type == XML_TEXT_NODE) {
- const xmlChar *content = cur->content;
- int len;
-
- if (content == NULL) {
- tmp = xmlNewTextLen(NULL, 0);
- } else {
- len = index2;
- if ((cur == start) && (index1 > 1)) {
- content += (index1 - 1);
- len -= (index1 - 1);
- index1 = 0;
- } else {
- len = index2;
- }
- tmp = xmlNewTextLen(content, len);
- }
- /* single sub text node selection */
- if (list == NULL)
- return(tmp);
- /* prune and return full set */
- if (last != NULL)
- xmlAddNextSibling(last, tmp);
- else
- xmlAddChild(parent, tmp);
- return(list);
- } else {
- tmp = xmlCopyNode(cur, 0);
- if (list == NULL)
- list = tmp;
- else {
- if (last != NULL)
- xmlAddNextSibling(last, tmp);
- else
- xmlAddChild(parent, tmp);
- }
- last = NULL;
- parent = tmp;
-
- if (index2 > 1) {
- end = xmlXPtrGetNthChild(cur, index2 - 1);
- index2 = 0;
- }
- if ((cur == start) && (index1 > 1)) {
- cur = xmlXPtrGetNthChild(cur, index1 - 1);
- index1 = 0;
- } else {
- cur = cur->children;
- }
- /*
- * Now gather the remaining nodes from cur to end
- */
- continue; /* while */
- }
- } else if ((cur == start) &&
- (list == NULL) /* looks superfluous but ... */ ) {
- if ((cur->type == XML_TEXT_NODE) ||
- (cur->type == XML_CDATA_SECTION_NODE)) {
- const xmlChar *content = cur->content;
-
- if (content == NULL) {
- tmp = xmlNewTextLen(NULL, 0);
- } else {
- if (index1 > 1) {
- content += (index1 - 1);
- }
- tmp = xmlNewText(content);
- }
- last = list = tmp;
- } else {
- if ((cur == start) && (index1 > 1)) {
- tmp = xmlCopyNode(cur, 0);
- list = tmp;
- parent = tmp;
- last = NULL;
- cur = xmlXPtrGetNthChild(cur, index1 - 1);
- index1 = 0;
- /*
- * Now gather the remaining nodes from cur to end
- */
- continue; /* while */
- }
- tmp = xmlCopyNode(cur, 1);
- list = tmp;
- parent = NULL;
- last = tmp;
- }
- } else {
- tmp = NULL;
- switch (cur->type) {
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_NODE:
- /* Do not copy DTD informations */
- break;
- case XML_ENTITY_DECL:
- TODO /* handle crossing entities -> stack needed */
- break;
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- /* don't consider it part of the tree content */
- break;
- case XML_ATTRIBUTE_NODE:
- /* Humm, should not happen ! */
- STRANGE
- break;
- default:
- tmp = xmlCopyNode(cur, 1);
- break;
- }
- if (tmp != NULL) {
- if ((list == NULL) || ((last == NULL) && (parent == NULL))) {
- STRANGE
- return(NULL);
- }
- if (last != NULL)
- xmlAddNextSibling(last, tmp);
- else {
- xmlAddChild(parent, tmp);
- last = tmp;
- }
- }
- }
- /*
- * Skip to next node in document order
- */
- if ((list == NULL) || ((last == NULL) && (parent == NULL))) {
- STRANGE
- return(NULL);
- }
- cur = xmlXPtrAdvanceNode(cur);
- }
- return(list);
-}
-
-/**
- * xmlXPtrBuildNodeList:
- * @obj: the XPointer result from the evaluation.
- *
- * Build a node list tree copy of the XPointer result.
- * This will drop Attributes and Namespace declarations.
- *
- * Returns an xmlNodePtr list or NULL.
- * the caller has to free the node tree.
- */
-xmlNodePtr
-xmlXPtrBuildNodeList(xmlXPathObjectPtr obj) {
- xmlNodePtr list = NULL, last = NULL;
- int i;
-
- if (obj == NULL)
- return(NULL);
- switch (obj->type) {
- case XPATH_NODESET: {
- xmlNodeSetPtr set = obj->nodesetval;
- if (set == NULL)
- return(NULL);
- for (i = 0;i < set->nodeNr;i++) {
- if (set->nodeTab[i] == NULL)
- continue;
- switch (set->nodeTab[i]->type) {
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_ELEMENT_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_DOCUMENT_NODE:
- case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- break;
- case XML_ATTRIBUTE_NODE:
- case XML_NAMESPACE_DECL:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_NOTATION_NODE:
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- continue; /* for */
- }
- if (last == NULL)
- list = last = xmlCopyNode(set->nodeTab[i], 1);
- else {
- xmlAddNextSibling(last, xmlCopyNode(set->nodeTab[i], 1));
- if (last->next != NULL)
- last = last->next;
- }
- }
- break;
- }
- case XPATH_LOCATIONSET: {
- xmlLocationSetPtr set = (xmlLocationSetPtr) obj->user;
- if (set == NULL)
- return(NULL);
- for (i = 0;i < set->locNr;i++) {
- if (last == NULL)
- list = last = xmlXPtrBuildNodeList(set->locTab[i]);
- else
- xmlAddNextSibling(last,
- xmlXPtrBuildNodeList(set->locTab[i]));
- if (last != NULL) {
- while (last->next != NULL)
- last = last->next;
- }
- }
- break;
- }
- case XPATH_RANGE:
- return(xmlXPtrBuildRangeNodeList(obj));
- case XPATH_POINT:
- return(xmlCopyNode(obj->user, 0));
- default:
- break;
- }
- return(list);
-}
-
-/************************************************************************
- * *
- * XPointer functions *
- * *
- ************************************************************************/
-
-/**
- * xmlXPtrNbLocChildren:
- * @node: an xmlNodePtr
- *
- * Count the number of location children of @node or the length of the
- * string value in case of text/PI/Comments nodes
- *
- * Returns the number of location children
- */
-static int
-xmlXPtrNbLocChildren(xmlNodePtr node) {
- int ret = 0;
- if (node == NULL)
- return(-1);
- switch (node->type) {
- case XML_HTML_DOCUMENT_NODE:
- case XML_DOCUMENT_NODE:
- case XML_ELEMENT_NODE:
- node = node->children;
- while (node != NULL) {
- if (node->type == XML_ELEMENT_NODE)
- ret++;
- node = node->next;
- }
- break;
- case XML_ATTRIBUTE_NODE:
- return(-1);
-
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_ENTITY_REF_NODE:
- ret = xmlStrlen(node->content);
- break;
- default:
- return(-1);
- }
- return(ret);
-}
-
-/**
- * xmlXPtrHereFunction:
- * @ctxt: the XPointer Parser context
- * @nargs: the number of args
- *
- * Function implementing here() operation
- * as described in 5.4.3
- */
-void
-xmlXPtrHereFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- CHECK_ARITY(0);
-
- if (ctxt->context->here == NULL)
- XP_ERROR(XPTR_SYNTAX_ERROR);
-
- valuePush(ctxt, xmlXPtrNewLocationSetNodes(ctxt->context->here, NULL));
-}
-
-/**
- * xmlXPtrOriginFunction:
- * @ctxt: the XPointer Parser context
- * @nargs: the number of args
- *
- * Function implementing origin() operation
- * as described in 5.4.3
- */
-void
-xmlXPtrOriginFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- CHECK_ARITY(0);
-
- if (ctxt->context->origin == NULL)
- XP_ERROR(XPTR_SYNTAX_ERROR);
-
- valuePush(ctxt, xmlXPtrNewLocationSetNodes(ctxt->context->origin, NULL));
-}
-
-/**
- * xmlXPtrStartPointFunction:
- * @ctxt: the XPointer Parser context
- * @nargs: the number of args
- *
- * Function implementing start-point() operation
- * as described in 5.4.3
- * ----------------
- * location-set start-point(location-set)
- *
- * For each location x in the argument location-set, start-point adds a
- * location of type point to the result location-set. That point represents
- * the start point of location x and is determined by the following rules:
- *
- * - If x is of type point, the start point is x.
- * - If x is of type range, the start point is the start point of x.
- * - If x is of type root, element, text, comment, or processing instruction,
- * - the container node of the start point is x and the index is 0.
- * - If x is of type attribute or namespace, the function must signal a
- * syntax error.
- * ----------------
- *
- */
-void
-xmlXPtrStartPointFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr tmp, obj, point;
- xmlLocationSetPtr newset = NULL;
- xmlLocationSetPtr oldset = NULL;
-
- CHECK_ARITY(1);
- if ((ctxt->value == NULL) ||
- ((ctxt->value->type != XPATH_LOCATIONSET) &&
- (ctxt->value->type != XPATH_NODESET)))
- XP_ERROR(XPATH_INVALID_TYPE)
-
- obj = valuePop(ctxt);
- if (obj->type == XPATH_NODESET) {
- /*
- * First convert to a location set
- */
- tmp = xmlXPtrNewLocationSetNodeSet(obj->nodesetval);
- xmlXPathFreeObject(obj);
- obj = tmp;
- }
-
- newset = xmlXPtrLocationSetCreate(NULL);
- if (newset == NULL) {
- xmlXPathFreeObject(obj);
- XP_ERROR(XPATH_MEMORY_ERROR);
- }
- oldset = (xmlLocationSetPtr) obj->user;
- if (oldset != NULL) {
- int i;
-
- for (i = 0; i < oldset->locNr; i++) {
- tmp = oldset->locTab[i];
- if (tmp == NULL)
- continue;
- point = NULL;
- switch (tmp->type) {
- case XPATH_POINT:
- point = xmlXPtrNewPoint(tmp->user, tmp->index);
- break;
- case XPATH_RANGE: {
- xmlNodePtr node = tmp->user;
- if (node != NULL) {
- if (node->type == XML_ATTRIBUTE_NODE) {
- /* TODO: Namespace Nodes ??? */
- xmlXPathFreeObject(obj);
- xmlXPtrFreeLocationSet(newset);
- XP_ERROR(XPTR_SYNTAX_ERROR);
- }
- point = xmlXPtrNewPoint(node, tmp->index);
- }
- break;
- }
- default:
- /*** Should we raise an error ?
- xmlXPathFreeObject(obj);
- xmlXPathFreeObject(newset);
- XP_ERROR(XPATH_INVALID_TYPE)
- ***/
- break;
- }
- if (point != NULL)
- xmlXPtrLocationSetAdd(newset, point);
- }
- }
- xmlXPathFreeObject(obj);
- valuePush(ctxt, xmlXPtrWrapLocationSet(newset));
-}
-
-/**
- * xmlXPtrEndPointFunction:
- * @ctxt: the XPointer Parser context
- * @nargs: the number of args
- *
- * Function implementing end-point() operation
- * as described in 5.4.3
- * ----------------------------
- * location-set end-point(location-set)
- *
- * For each location x in the argument location-set, end-point adds a
- * location of type point to the result location-set. That point represents
- * the end point of location x and is determined by the following rules:
- *
- * - If x is of type point, the resulting point is x.
- * - If x is of type range, the resulting point is the end point of x.
- * - If x is of type root or element, the container node of the resulting
- * point is x and the index is the number of location children of x.
- * - If x is of type text, comment, or processing instruction, the container
- * node of the resulting point is x and the index is the length of the
- * string-value of x.
- * - If x is of type attribute or namespace, the function must signal a
- * syntax error.
- * ----------------------------
- */
-void
-xmlXPtrEndPointFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr tmp, obj, point;
- xmlLocationSetPtr newset = NULL;
- xmlLocationSetPtr oldset = NULL;
-
- CHECK_ARITY(1);
- if ((ctxt->value == NULL) ||
- ((ctxt->value->type != XPATH_LOCATIONSET) &&
- (ctxt->value->type != XPATH_NODESET)))
- XP_ERROR(XPATH_INVALID_TYPE)
-
- obj = valuePop(ctxt);
- if (obj->type == XPATH_NODESET) {
- /*
- * First convert to a location set
- */
- tmp = xmlXPtrNewLocationSetNodeSet(obj->nodesetval);
- xmlXPathFreeObject(obj);
- obj = tmp;
- }
-
- newset = xmlXPtrLocationSetCreate(NULL);
- oldset = (xmlLocationSetPtr) obj->user;
- if (oldset != NULL) {
- int i;
-
- for (i = 0; i < oldset->locNr; i++) {
- tmp = oldset->locTab[i];
- if (tmp == NULL)
- continue;
- point = NULL;
- switch (tmp->type) {
- case XPATH_POINT:
- point = xmlXPtrNewPoint(tmp->user, tmp->index);
- break;
- case XPATH_RANGE: {
- xmlNodePtr node = tmp->user2;
- if (node != NULL) {
- if (node->type == XML_ATTRIBUTE_NODE) {
- /* TODO: Namespace Nodes ??? */
- xmlXPathFreeObject(obj);
- xmlXPtrFreeLocationSet(newset);
- XP_ERROR(XPTR_SYNTAX_ERROR);
- }
- point = xmlXPtrNewPoint(node, tmp->index2);
- } else if (tmp->user == NULL) {
- point = xmlXPtrNewPoint(node,
- xmlXPtrNbLocChildren(node));
- }
- break;
- }
- default:
- /*** Should we raise an error ?
- xmlXPathFreeObject(obj);
- xmlXPathFreeObject(newset);
- XP_ERROR(XPATH_INVALID_TYPE)
- ***/
- break;
- }
- if (point != NULL)
- xmlXPtrLocationSetAdd(newset, point);
- }
- }
- xmlXPathFreeObject(obj);
- valuePush(ctxt, xmlXPtrWrapLocationSet(newset));
-}
-
-
-/**
- * xmlXPtrCoveringRange:
- * @ctxt: the XPointer Parser context
- * @loc: the location for which the covering range must be computed
- *
- * A covering range is a range that wholly encompasses a location
- * Section 5.3.3. Covering Ranges for All Location Types
- * http://www.w3.org/TR/xptr#N2267
- *
- * Returns a new location or NULL in case of error
- */
-static xmlXPathObjectPtr
-xmlXPtrCoveringRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) {
- if (loc == NULL)
- return(NULL);
- if ((ctxt == NULL) || (ctxt->context == NULL) ||
- (ctxt->context->doc == NULL))
- return(NULL);
- switch (loc->type) {
- case XPATH_POINT:
- return(xmlXPtrNewRange(loc->user, loc->index,
- loc->user, loc->index));
- case XPATH_RANGE:
- if (loc->user2 != NULL) {
- return(xmlXPtrNewRange(loc->user, loc->index,
- loc->user2, loc->index2));
- } else {
- xmlNodePtr node = (xmlNodePtr) loc->user;
- if (node == (xmlNodePtr) ctxt->context->doc) {
- return(xmlXPtrNewRange(node, 0, node,
- xmlXPtrGetArity(node)));
- } else {
- switch (node->type) {
- case XML_ATTRIBUTE_NODE:
- /* !!! our model is slightly different than XPath */
- return(xmlXPtrNewRange(node, 0, node,
- xmlXPtrGetArity(node)));
- case XML_ELEMENT_NODE:
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_DOCUMENT_NODE:
- case XML_NOTATION_NODE:
- case XML_HTML_DOCUMENT_NODE: {
- int indx = xmlXPtrGetIndex(node);
-
- node = node->parent;
- return(xmlXPtrNewRange(node, indx - 1,
- node, indx + 1));
- }
- default:
- return(NULL);
- }
- }
- }
- default:
- TODO /* missed one case ??? */
- }
- return(NULL);
-}
-
-/**
- * xmlXPtrRangeFunction:
- * @ctxt: the XPointer Parser context
- * @nargs: the number of args
- *
- * Function implementing the range() function 5.4.3
- * location-set range(location-set )
- *
- * The range function returns ranges covering the locations in
- * the argument location-set. For each location x in the argument
- * location-set, a range location representing the covering range of
- * x is added to the result location-set.
- */
-void
-xmlXPtrRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- int i;
- xmlXPathObjectPtr set;
- xmlLocationSetPtr oldset;
- xmlLocationSetPtr newset;
-
- CHECK_ARITY(1);
- if ((ctxt->value == NULL) ||
- ((ctxt->value->type != XPATH_LOCATIONSET) &&
- (ctxt->value->type != XPATH_NODESET)))
- XP_ERROR(XPATH_INVALID_TYPE)
-
- set = valuePop(ctxt);
- if (set->type == XPATH_NODESET) {
- xmlXPathObjectPtr tmp;
-
- /*
- * First convert to a location set
- */
- tmp = xmlXPtrNewLocationSetNodeSet(set->nodesetval);
- xmlXPathFreeObject(set);
- set = tmp;
- }
- oldset = (xmlLocationSetPtr) set->user;
-
- /*
- * The loop is to compute the covering range for each item and add it
- */
- newset = xmlXPtrLocationSetCreate(NULL);
- for (i = 0;i < oldset->locNr;i++) {
- xmlXPtrLocationSetAdd(newset,
- xmlXPtrCoveringRange(ctxt, oldset->locTab[i]));
- }
-
- /*
- * Save the new value and cleanup
- */
- valuePush(ctxt, xmlXPtrWrapLocationSet(newset));
- xmlXPathFreeObject(set);
-}
-
-/**
- * xmlXPtrInsideRange:
- * @ctxt: the XPointer Parser context
- * @loc: the location for which the inside range must be computed
- *
- * A inside range is a range described in the range-inside() description
- *
- * Returns a new location or NULL in case of error
- */
-static xmlXPathObjectPtr
-xmlXPtrInsideRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) {
- if (loc == NULL)
- return(NULL);
- if ((ctxt == NULL) || (ctxt->context == NULL) ||
- (ctxt->context->doc == NULL))
- return(NULL);
- switch (loc->type) {
- case XPATH_POINT: {
- xmlNodePtr node = (xmlNodePtr) loc->user;
- switch (node->type) {
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE: {
- if (node->content == NULL) {
- return(xmlXPtrNewRange(node, 0, node, 0));
- } else {
- return(xmlXPtrNewRange(node, 0, node,
- xmlStrlen(node->content)));
- }
- }
- case XML_ATTRIBUTE_NODE:
- case XML_ELEMENT_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_DOCUMENT_NODE:
- case XML_NOTATION_NODE:
- case XML_HTML_DOCUMENT_NODE: {
- return(xmlXPtrNewRange(node, 0, node,
- xmlXPtrGetArity(node)));
- }
- default:
- break;
- }
- return(NULL);
- }
- case XPATH_RANGE: {
- xmlNodePtr node = (xmlNodePtr) loc->user;
- if (loc->user2 != NULL) {
- return(xmlXPtrNewRange(node, loc->index,
- loc->user2, loc->index2));
- } else {
- switch (node->type) {
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE: {
- if (node->content == NULL) {
- return(xmlXPtrNewRange(node, 0, node, 0));
- } else {
- return(xmlXPtrNewRange(node, 0, node,
- xmlStrlen(node->content)));
- }
- }
- case XML_ATTRIBUTE_NODE:
- case XML_ELEMENT_NODE:
- case XML_ENTITY_REF_NODE:
- case XML_DOCUMENT_NODE:
- case XML_NOTATION_NODE:
- case XML_HTML_DOCUMENT_NODE: {
- return(xmlXPtrNewRange(node, 0, node,
- xmlXPtrGetArity(node)));
- }
- default:
- break;
- }
- return(NULL);
- }
- }
- default:
- TODO /* missed one case ??? */
- }
- return(NULL);
-}
-
-/**
- * xmlXPtrRangeInsideFunction:
- * @ctxt: the XPointer Parser context
- * @nargs: the number of args
- *
- * Function implementing the range-inside() function 5.4.3
- * location-set range-inside(location-set )
- *
- * The range-inside function returns ranges covering the contents of
- * the locations in the argument location-set. For each location x in
- * the argument location-set, a range location is added to the result
- * location-set. If x is a range location, then x is added to the
- * result location-set. If x is not a range location, then x is used
- * as the container location of the start and end points of the range
- * location to be added; the index of the start point of the range is
- * zero; if the end point is a character point then its index is the
- * length of the string-value of x, and otherwise is the number of
- * location children of x.
- *
- */
-void
-xmlXPtrRangeInsideFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- int i;
- xmlXPathObjectPtr set;
- xmlLocationSetPtr oldset;
- xmlLocationSetPtr newset;
-
- CHECK_ARITY(1);
- if ((ctxt->value == NULL) ||
- ((ctxt->value->type != XPATH_LOCATIONSET) &&
- (ctxt->value->type != XPATH_NODESET)))
- XP_ERROR(XPATH_INVALID_TYPE)
-
- set = valuePop(ctxt);
- if (set->type == XPATH_NODESET) {
- xmlXPathObjectPtr tmp;
-
- /*
- * First convert to a location set
- */
- tmp = xmlXPtrNewLocationSetNodeSet(set->nodesetval);
- xmlXPathFreeObject(set);
- set = tmp;
- }
- oldset = (xmlLocationSetPtr) set->user;
-
- /*
- * The loop is to compute the covering range for each item and add it
- */
- newset = xmlXPtrLocationSetCreate(NULL);
- for (i = 0;i < oldset->locNr;i++) {
- xmlXPtrLocationSetAdd(newset,
- xmlXPtrInsideRange(ctxt, oldset->locTab[i]));
- }
-
- /*
- * Save the new value and cleanup
- */
- valuePush(ctxt, xmlXPtrWrapLocationSet(newset));
- xmlXPathFreeObject(set);
-}
-
-/**
- * xmlXPtrRangeToFunction:
- * @ctxt: the XPointer Parser context
- * @nargs: the number of args
- *
- * Implement the range-to() XPointer function
- */
-void
-xmlXPtrRangeToFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr range;
- const xmlChar *cur;
- xmlXPathObjectPtr res, obj;
- xmlXPathObjectPtr tmp;
- xmlLocationSetPtr newset = NULL;
- xmlNodeSetPtr oldset;
- int i;
-
- CHECK_ARITY(1);
- /*
- * Save the expression pointer since we will have to evaluate
- * it multiple times. Initialize the new set.
- */
- CHECK_TYPE(XPATH_NODESET);
- obj = valuePop(ctxt);
- oldset = obj->nodesetval;
- ctxt->context->node = NULL;
-
- cur = ctxt->cur;
- newset = xmlXPtrLocationSetCreate(NULL);
-
- for (i = 0; i < oldset->nodeNr; i++) {
- ctxt->cur = cur;
-
- /*
- * Run the evaluation with a node list made of a single item
- * in the nodeset.
- */
- ctxt->context->node = oldset->nodeTab[i];
- tmp = xmlXPathNewNodeSet(ctxt->context->node);
- valuePush(ctxt, tmp);
-
- xmlXPathEvalExpr(ctxt);
- CHECK_ERROR;
-
- /*
- * The result of the evaluation need to be tested to
- * decided whether the filter succeeded or not
- */
- res = valuePop(ctxt);
- range = xmlXPtrNewRangeNodeObject(oldset->nodeTab[i], res);
- if (range != NULL) {
- xmlXPtrLocationSetAdd(newset, range);
- }
-
- /*
- * Cleanup
- */
- if (res != NULL)
- xmlXPathFreeObject(res);
- if (ctxt->value == tmp) {
- res = valuePop(ctxt);
- xmlXPathFreeObject(res);
- }
-
- ctxt->context->node = NULL;
- }
-
- /*
- * The result is used as the new evaluation set.
- */
- xmlXPathFreeObject(obj);
- ctxt->context->node = NULL;
- ctxt->context->contextSize = -1;
- ctxt->context->proximityPosition = -1;
- valuePush(ctxt, xmlXPtrWrapLocationSet(newset));
-}
-
-/**
- * xmlXPtrAdvanceNode:
- * @cur: the node
- *
- * Advance to the next element or text node in document order
- * TODO: add a stack for entering/exiting entities
- *
- * Returns -1 in case of failure, 0 otherwise
- */
-xmlNodePtr
-xmlXPtrAdvanceNode(xmlNodePtr cur) {
-next:
- if (cur == NULL)
- return(NULL);
- if (cur->children != NULL) {
- cur = cur->children ;
- goto found;
- }
- if (cur->next != NULL) {
- cur = cur->next;
- goto found;
- }
- do {
- cur = cur->parent;
- if (cur == NULL) return(NULL);
- if (cur->next != NULL) {
- cur = cur->next;
- goto found;
- }
- } while (cur != NULL);
-
-found:
- if ((cur->type != XML_ELEMENT_NODE) &&
- (cur->type != XML_TEXT_NODE) &&
- (cur->type != XML_DOCUMENT_NODE) &&
- (cur->type != XML_HTML_DOCUMENT_NODE) &&
- (cur->type != XML_CDATA_SECTION_NODE))
- goto next;
- if (cur->type == XML_ENTITY_REF_NODE) {
- TODO
- }
- return(cur);
-}
-
-/**
- * xmlXPtrAdvanceChar:
- * @node: the node
- * @indx: the indx
- * @bytes: the number of bytes
- *
- * Advance a point of the associated number of bytes (not UTF8 chars)
- *
- * Returns -1 in case of failure, 0 otherwise
- */
-static int
-xmlXPtrAdvanceChar(xmlNodePtr *node, int *indx, int bytes) {
- xmlNodePtr cur;
- int pos;
- int len;
-
- if ((node == NULL) || (indx == NULL))
- return(-1);
- cur = *node;
- if (cur == NULL)
- return(-1);
- pos = *indx;
-
- while (bytes >= 0) {
- /*
- * First position to the beginning of the first text node
- * corresponding to this point
- */
- while ((cur != NULL) &&
- ((cur->type == XML_ELEMENT_NODE) ||
- (cur->type == XML_DOCUMENT_NODE) ||
- (cur->type == XML_HTML_DOCUMENT_NODE))) {
- if (pos > 0) {
- cur = xmlXPtrGetNthChild(cur, pos);
- pos = 0;
- } else {
- cur = xmlXPtrAdvanceNode(cur);
- pos = 0;
- }
- }
-
- if (cur == NULL) {
- *node = NULL;
- *indx = 0;
- return(-1);
- }
-
- /*
- * if there is no move needed return the current value.
- */
- if (pos == 0) pos = 1;
- if (bytes == 0) {
- *node = cur;
- *indx = pos;
- return(0);
- }
- /*
- * We should have a text (or cdata) node ...
- */
- len = 0;
- if ((cur->type != XML_ELEMENT_NODE) &&
- (cur->content != NULL)) {
- len = xmlStrlen(cur->content);
- }
- if (pos > len) {
- /* Strange, the indx in the text node is greater than it's len */
- STRANGE
- pos = len;
- }
- if (pos + bytes >= len) {
- bytes -= (len - pos);
- cur = xmlXPtrAdvanceNode(cur);
- cur = 0;
- } else if (pos + bytes < len) {
- pos += bytes;
- *node = cur;
- *indx = pos;
- return(0);
- }
- }
- return(-1);
-}
-
-/**
- * xmlXPtrMatchString:
- * @string: the string to search
- * @start: the start textnode
- * @startindex: the start index
- * @end: the end textnode IN/OUT
- * @endindex: the end index IN/OUT
- *
- * Check whether the document contains @string at the position
- * (@start, @startindex) and limited by the (@end, @endindex) point
- *
- * Returns -1 in case of failure, 0 if not found, 1 if found in which case
- * (@start, @startindex) will indicate the position of the beginning
- * of the range and (@end, @endindex) will indicate the end
- * of the range
- */
-static int
-xmlXPtrMatchString(const xmlChar *string, xmlNodePtr start, int startindex,
- xmlNodePtr *end, int *endindex) {
- xmlNodePtr cur;
- int pos; /* 0 based */
- int len; /* in bytes */
- int stringlen; /* in bytes */
- int match;
-
- if (string == NULL)
- return(-1);
- if (start == NULL)
- return(-1);
- if ((end == NULL) || (endindex == NULL))
- return(-1);
- cur = start;
- if (cur == NULL)
- return(-1);
- pos = startindex - 1;
- stringlen = xmlStrlen(string);
-
- while (stringlen > 0) {
- if ((cur == *end) && (pos + stringlen > *endindex))
- return(0);
-
- if ((cur->type != XML_ELEMENT_NODE) && (cur->content != NULL)) {
- len = xmlStrlen(cur->content);
- if (len >= pos + stringlen) {
- match = (!xmlStrncmp(&cur->content[pos], string, stringlen));
- if (match) {
-#ifdef DEBUG_RANGES
- xmlGenericError(xmlGenericErrorContext,
- "found range %d bytes at index %d of ->",
- stringlen, pos + 1);
- xmlDebugDumpString(stdout, cur->content);
- xmlGenericError(xmlGenericErrorContext, "\n");
-#endif
- *end = cur;
- *endindex = pos + stringlen;
- return(1);
- } else {
- return(0);
- }
- } else {
- int sub = len - pos;
- match = (!xmlStrncmp(&cur->content[pos], string, sub));
- if (match) {
-#ifdef DEBUG_RANGES
- xmlGenericError(xmlGenericErrorContext,
- "found subrange %d bytes at index %d of ->",
- sub, pos + 1);
- xmlDebugDumpString(stdout, cur->content);
- xmlGenericError(xmlGenericErrorContext, "\n");
-#endif
- string = &string[sub];
- stringlen -= sub;
- } else {
- return(0);
- }
- }
- }
- cur = xmlXPtrAdvanceNode(cur);
- if (cur == NULL)
- return(0);
- pos = 0;
- }
- return(1);
-}
-
-/**
- * xmlXPtrSearchString:
- * @string: the string to search
- * @start: the start textnode IN/OUT
- * @startindex: the start index IN/OUT
- * @end: the end textnode
- * @endindex: the end index
- *
- * Search the next occurrence of @string within the document content
- * until the (@end, @endindex) point is reached
- *
- * Returns -1 in case of failure, 0 if not found, 1 if found in which case
- * (@start, @startindex) will indicate the position of the beginning
- * of the range and (@end, @endindex) will indicate the end
- * of the range
- */
-static int
-xmlXPtrSearchString(const xmlChar *string, xmlNodePtr *start, int *startindex,
- xmlNodePtr *end, int *endindex) {
- xmlNodePtr cur;
- const xmlChar *str;
- int pos; /* 0 based */
- int len; /* in bytes */
- xmlChar first;
-
- if (string == NULL)
- return(-1);
- if ((start == NULL) || (startindex == NULL))
- return(-1);
- if ((end == NULL) || (endindex == NULL))
- return(-1);
- cur = *start;
- if (cur == NULL)
- return(-1);
- pos = *startindex - 1;
- first = string[0];
-
- while (cur != NULL) {
- if ((cur->type != XML_ELEMENT_NODE) && (cur->content != NULL)) {
- len = xmlStrlen(cur->content);
- while (pos <= len) {
- if (first != 0) {
- str = xmlStrchr(&cur->content[pos], first);
- if (str != NULL) {
- pos = (str - (xmlChar *)(cur->content));
-#ifdef DEBUG_RANGES
- xmlGenericError(xmlGenericErrorContext,
- "found '%c' at index %d of ->",
- first, pos + 1);
- xmlDebugDumpString(stdout, cur->content);
- xmlGenericError(xmlGenericErrorContext, "\n");
-#endif
- if (xmlXPtrMatchString(string, cur, pos + 1,
- end, endindex)) {
- *start = cur;
- *startindex = pos + 1;
- return(1);
- }
- pos++;
- } else {
- pos = len + 1;
- }
- } else {
- /*
- * An empty string is considered to match before each
- * character of the string-value and after the final
- * character.
- */
-#ifdef DEBUG_RANGES
- xmlGenericError(xmlGenericErrorContext,
- "found '' at index %d of ->",
- pos + 1);
- xmlDebugDumpString(stdout, cur->content);
- xmlGenericError(xmlGenericErrorContext, "\n");
-#endif
- *start = cur;
- *startindex = pos + 1;
- *end = cur;
- *endindex = pos + 1;
- return(1);
- }
- }
- }
- if ((cur == *end) && (pos >= *endindex))
- return(0);
- cur = xmlXPtrAdvanceNode(cur);
- if (cur == NULL)
- return(0);
- pos = 1;
- }
- return(0);
-}
-
-/**
- * xmlXPtrGetLastChar:
- * @node: the node
- * @index: the index
- *
- * Computes the point coordinates of the last char of this point
- *
- * Returns -1 in case of failure, 0 otherwise
- */
-static int
-xmlXPtrGetLastChar(xmlNodePtr *node, int *indx) {
- xmlNodePtr cur;
- int pos, len = 0;
-
- if ((node == NULL) || (indx == NULL))
- return(-1);
- cur = *node;
- pos = *indx;
-
- if (cur == NULL)
- return(-1);
-
- if ((cur->type == XML_ELEMENT_NODE) ||
- (cur->type == XML_DOCUMENT_NODE) ||
- (cur->type == XML_HTML_DOCUMENT_NODE)) {
- if (pos > 0) {
- cur = xmlXPtrGetNthChild(cur, pos);
- pos = 0;
- }
- }
- while (cur != NULL) {
- if (cur->last != NULL)
- cur = cur->last;
- else if ((cur->type != XML_ELEMENT_NODE) &&
- (cur->content != NULL)) {
- len = xmlStrlen(cur->content);
- break;
- } else {
- return(-1);
- }
- }
- if (cur == NULL)
- return(-1);
- *node = cur;
- *indx = len;
- return(0);
-}
-
-/**
- * xmlXPtrGetStartPoint:
- * @obj: an range
- * @node: the resulting node
- * @indx: the resulting index
- *
- * read the object and return the start point coordinates.
- *
- * Returns -1 in case of failure, 0 otherwise
- */
-static int
-xmlXPtrGetStartPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *indx) {
- if ((obj == NULL) || (node == NULL) || (indx == NULL))
- return(-1);
-
- switch (obj->type) {
- case XPATH_POINT:
- *node = obj->user;
- if (obj->index <= 0)
- *indx = 0;
- else
- *indx = obj->index;
- return(0);
- case XPATH_RANGE:
- *node = obj->user;
- if (obj->index <= 0)
- *indx = 0;
- else
- *indx = obj->index;
- return(0);
- default:
- break;
- }
- return(-1);
-}
-
-/**
- * xmlXPtrGetEndPoint:
- * @obj: an range
- * @node: the resulting node
- * @indx: the resulting indx
- *
- * read the object and return the end point coordinates.
- *
- * Returns -1 in case of failure, 0 otherwise
- */
-static int
-xmlXPtrGetEndPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *indx) {
- if ((obj == NULL) || (node == NULL) || (indx == NULL))
- return(-1);
-
- switch (obj->type) {
- case XPATH_POINT:
- *node = obj->user;
- if (obj->index <= 0)
- *indx = 0;
- else
- *indx = obj->index;
- return(0);
- case XPATH_RANGE:
- *node = obj->user;
- if (obj->index <= 0)
- *indx = 0;
- else
- *indx = obj->index;
- return(0);
- default:
- break;
- }
- return(-1);
-}
-
-/**
- * xmlXPtrStringRangeFunction:
- * @ctxt: the XPointer Parser context
- * @nargs: the number of args
- *
- * Function implementing the string-range() function
- * range as described in 5.4.2
- *
- * ------------------------------
- * [Definition: For each location in the location-set argument,
- * string-range returns a set of string ranges, a set of substrings in a
- * string. Specifically, the string-value of the location is searched for
- * substrings that match the string argument, and the resulting location-set
- * will contain a range location for each non-overlapping match.]
- * An empty string is considered to match before each character of the
- * string-value and after the final character. Whitespace in a string
- * is matched literally, with no normalization except that provided by
- * XML for line ends. The third argument gives the position of the first
- * character to be in the resulting range, relative to the start of the
- * match. The default value is 1, which makes the range start immediately
- * before the first character of the matched string. The fourth argument
- * gives the number of characters in the range; the default is that the
- * range extends to the end of the matched string.
- *
- * Element boundaries, as well as entire embedded nodes such as processing
- * instructions and comments, are ignored as defined in [XPath].
- *
- * If the string in the second argument is not found in the string-value
- * of the location, or if a value in the third or fourth argument indicates
- * a string that is beyond the beginning or end of the document, the
- * expression fails.
- *
- * The points of the range-locations in the returned location-set will
- * all be character points.
- * ------------------------------
- */
-void
-xmlXPtrStringRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- int i, startindex, endindex, fendindex;
- xmlNodePtr start, end, fend;
- xmlXPathObjectPtr set;
- xmlLocationSetPtr oldset;
- xmlLocationSetPtr newset;
- xmlXPathObjectPtr string;
- xmlXPathObjectPtr position = NULL;
- xmlXPathObjectPtr number = NULL;
- int found, pos = 0, num = 0;
-
- /*
- * Grab the arguments
- */
- if ((nargs < 2) || (nargs > 4))
- XP_ERROR(XPATH_INVALID_ARITY);
-
- if (nargs >= 4) {
- CHECK_TYPE(XPATH_NUMBER);
- number = valuePop(ctxt);
- if (number != NULL)
- num = (int) number->floatval;
- }
- if (nargs >= 3) {
- CHECK_TYPE(XPATH_NUMBER);
- position = valuePop(ctxt);
- if (position != NULL)
- pos = (int) position->floatval;
- }
- CHECK_TYPE(XPATH_STRING);
- string = valuePop(ctxt);
- if ((ctxt->value == NULL) ||
- ((ctxt->value->type != XPATH_LOCATIONSET) &&
- (ctxt->value->type != XPATH_NODESET)))
- XP_ERROR(XPATH_INVALID_TYPE)
-
- set = valuePop(ctxt);
- if (set->type == XPATH_NODESET) {
- xmlXPathObjectPtr tmp;
-
- /*
- * First convert to a location set
- */
- tmp = xmlXPtrNewLocationSetNodeSet(set->nodesetval);
- xmlXPathFreeObject(set);
- set = tmp;
- }
- oldset = (xmlLocationSetPtr) set->user;
-
- /*
- * The loop is to search for each element in the location set
- * the list of location set corresponding to that search
- */
- newset = xmlXPtrLocationSetCreate(NULL);
- for (i = 0;i < oldset->locNr;i++) {
-#ifdef DEBUG_RANGES
- xmlXPathDebugDumpObject(stdout, oldset->locTab[i], 0);
-#endif
-
- xmlXPtrGetStartPoint(oldset->locTab[i], &start, &startindex);
- xmlXPtrGetEndPoint(oldset->locTab[i], &end, &endindex);
- xmlXPtrAdvanceChar(&start, &startindex, 0);
- xmlXPtrGetLastChar(&end, &endindex);
-
-#ifdef DEBUG_RANGES
- xmlGenericError(xmlGenericErrorContext,
- "from index %d of ->", startindex);
- xmlDebugDumpString(stdout, start->content);
- xmlGenericError(xmlGenericErrorContext, "\n");
- xmlGenericError(xmlGenericErrorContext,
- "to index %d of ->", endindex);
- xmlDebugDumpString(stdout, end->content);
- xmlGenericError(xmlGenericErrorContext, "\n");
-#endif
- do {
- fend = end;
- fendindex = endindex;
- found = xmlXPtrSearchString(string->stringval, &start, &startindex,
- &fend, &fendindex);
- if (found == 1) {
- if (position == NULL) {
- xmlXPtrLocationSetAdd(newset,
- xmlXPtrNewRange(start, startindex, fend, fendindex));
- } else if (xmlXPtrAdvanceChar(&start, &startindex,
- pos - 1) == 0) {
- if ((number != NULL) && (num > 0)) {
- int rindx;
- xmlNodePtr rend;
- rend = start;
- rindx = startindex - 1;
- if (xmlXPtrAdvanceChar(&rend, &rindx,
- num) == 0) {
- xmlXPtrLocationSetAdd(newset,
- xmlXPtrNewRange(start, startindex,
- rend, rindx));
- }
- } else if ((number != NULL) && (num <= 0)) {
- xmlXPtrLocationSetAdd(newset,
- xmlXPtrNewRange(start, startindex,
- start, startindex));
- } else {
- xmlXPtrLocationSetAdd(newset,
- xmlXPtrNewRange(start, startindex,
- fend, fendindex));
- }
- }
- start = fend;
- startindex = fendindex;
- if (string->stringval[0] == 0)
- startindex++;
- }
- } while (found == 1);
- }
-
- /*
- * Save the new value and cleanup
- */
- valuePush(ctxt, xmlXPtrWrapLocationSet(newset));
- xmlXPathFreeObject(set);
- xmlXPathFreeObject(string);
- if (position) xmlXPathFreeObject(position);
- if (number) xmlXPathFreeObject(number);
-}
-
-/**
- * xmlXPtrEvalRangePredicate:
- * @ctxt: the XPointer Parser context
- *
- * [8] Predicate ::= '[' PredicateExpr ']'
- * [9] PredicateExpr ::= Expr
- *
- * Evaluate a predicate as in xmlXPathEvalPredicate() but for
- * a Location Set instead of a node set
- */
-void
-xmlXPtrEvalRangePredicate(xmlXPathParserContextPtr ctxt) {
- const xmlChar *cur;
- xmlXPathObjectPtr res;
- xmlXPathObjectPtr obj, tmp;
- xmlLocationSetPtr newset = NULL;
- xmlLocationSetPtr oldset;
- int i;
-
- SKIP_BLANKS;
- if (CUR != '[') {
- XP_ERROR(XPATH_INVALID_PREDICATE_ERROR);
- }
- NEXT;
- SKIP_BLANKS;
-
- /*
- * Extract the old set, and then evaluate the result of the
- * expression for all the element in the set. use it to grow
- * up a new set.
- */
- CHECK_TYPE(XPATH_LOCATIONSET);
- obj = valuePop(ctxt);
- oldset = obj->user;
- ctxt->context->node = NULL;
-
- if ((oldset == NULL) || (oldset->locNr == 0)) {
- ctxt->context->contextSize = 0;
- ctxt->context->proximityPosition = 0;
- xmlXPathEvalExpr(ctxt);
- res = valuePop(ctxt);
- if (res != NULL)
- xmlXPathFreeObject(res);
- valuePush(ctxt, obj);
- CHECK_ERROR;
- } else {
- /*
- * Save the expression pointer since we will have to evaluate
- * it multiple times. Initialize the new set.
- */
- cur = ctxt->cur;
- newset = xmlXPtrLocationSetCreate(NULL);
-
- for (i = 0; i < oldset->locNr; i++) {
- ctxt->cur = cur;
-
- /*
- * Run the evaluation with a node list made of a single item
- * in the nodeset.
- */
- ctxt->context->node = oldset->locTab[i]->user;
- tmp = xmlXPathNewNodeSet(ctxt->context->node);
- valuePush(ctxt, tmp);
- ctxt->context->contextSize = oldset->locNr;
- ctxt->context->proximityPosition = i + 1;
-
- xmlXPathEvalExpr(ctxt);
- CHECK_ERROR;
-
- /*
- * The result of the evaluation need to be tested to
- * decided whether the filter succeeded or not
- */
- res = valuePop(ctxt);
- if (xmlXPathEvaluatePredicateResult(ctxt, res)) {
- xmlXPtrLocationSetAdd(newset,
- xmlXPathObjectCopy(oldset->locTab[i]));
- }
-
- /*
- * Cleanup
- */
- if (res != NULL)
- xmlXPathFreeObject(res);
- if (ctxt->value == tmp) {
- res = valuePop(ctxt);
- xmlXPathFreeObject(res);
- }
-
- ctxt->context->node = NULL;
- }
-
- /*
- * The result is used as the new evaluation set.
- */
- xmlXPathFreeObject(obj);
- ctxt->context->node = NULL;
- ctxt->context->contextSize = -1;
- ctxt->context->proximityPosition = -1;
- valuePush(ctxt, xmlXPtrWrapLocationSet(newset));
- }
- if (CUR != ']') {
- XP_ERROR(XPATH_INVALID_PREDICATE_ERROR);
- }
-
- NEXT;
- SKIP_BLANKS;
-}
-
-#else
-#endif
-
diff --git a/config.guess b/config.guess
deleted file mode 100644
index 5145e35717..0000000000
--- a/config.guess
+++ /dev/null
@@ -1,1363 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002 Free Software Foundation, Inc.
-
-timestamp='2002-10-21'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Originally written by Per Bothner <per@bothner.com>.
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit 0 ;;
- --version | -v )
- echo "$version" ; exit 0 ;;
- --help | --h* | -h )
- echo "$usage"; exit 0 ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help" >&2
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# This shell variable is my proudest work .. or something. --bje
-
-set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
-(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
- || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
-dummy=$tmpdir/dummy ;
-files="$dummy.c $dummy.o $dummy.rel $dummy" ;
-trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- rm -f $files ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ;
-unset files'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- *:NetBSD:*:*)
- # NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
- # switched to ELF, *-*-netbsd* would select the old
- # object file format. This provides both forward
- # compatibility and a consistent mechanism for selecting the
- # object file format.
- #
- # Note: NetBSD doesn't particularly care about the vendor
- # portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
- armeb) machine=armeb-unknown ;;
- arm*) machine=arm-unknown ;;
- sh3el) machine=shl-unknown ;;
- sh3eb) machine=sh-unknown ;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
- esac
- # The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
- case "${UNAME_MACHINE_ARCH}" in
- arm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep __ELF__ >/dev/null
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- ;;
- *)
- os=netbsd
- ;;
- esac
- # The OS release
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
- # contains redundant information, the shorter form:
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}"
- exit 0 ;;
- amiga:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- hp300:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- macppc:OpenBSD:*:*)
- echo powerpc-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme88k:OpenBSD:*:*)
- echo m88k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvmeppc:OpenBSD:*:*)
- echo powerpc-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- pmax:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sgi:OpenBSD:*:*)
- echo mipseb-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sun3:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- wgrisc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- *:OpenBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- alpha:OSF1:*:*)
- if test $UNAME_RELEASE = "V4.0"; then
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- fi
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- eval $set_cc_for_build
- cat <<EOF >$dummy.s
- .data
-\$Lformat:
- .byte 37,100,45,37,120,10,0 # "%d-%x\n"
-
- .text
- .globl main
- .align 4
- .ent main
-main:
- .frame \$30,16,\$26,0
- ldgp \$29,0(\$27)
- .prologue 1
- .long 0x47e03d80 # implver \$0
- lda \$2,-1
- .long 0x47e20c21 # amask \$2,\$1
- lda \$16,\$Lformat
- mov \$0,\$17
- not \$1,\$18
- jsr \$26,printf
- ldgp \$29,0(\$26)
- mov 0,\$16
- jsr \$26,exit
- .end main
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
- if test "$?" = 0 ; then
- case `$dummy` in
- 0-0)
- UNAME_MACHINE="alpha"
- ;;
- 1-0)
- UNAME_MACHINE="alphaev5"
- ;;
- 1-1)
- UNAME_MACHINE="alphaev56"
- ;;
- 1-101)
- UNAME_MACHINE="alphapca56"
- ;;
- 2-303)
- UNAME_MACHINE="alphaev6"
- ;;
- 2-307)
- UNAME_MACHINE="alphaev67"
- ;;
- 2-1307)
- UNAME_MACHINE="alphaev68"
- ;;
- 3-1307)
- UNAME_MACHINE="alphaev7"
- ;;
- esac
- fi
- rm -f $dummy.s $dummy && rmdir $tmpdir
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- exit 0 ;;
- Alpha\ *:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # Should we change UNAME_MACHINE based on the output of uname instead
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit 0 ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit 0 ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit 0;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit 0 ;;
- *:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
- exit 0 ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit 0 ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit 0;;
- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit 0;;
- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit 0 ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit 0 ;;
- DRS?6000:UNIX_SV:4.2*:7*)
- case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7 && exit 0 ;;
- esac ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- i86pc:SunOS:5.*:*)
- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit 0 ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit 0 ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit 0 ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit 0 ;;
- # The situation for MiNT is a little confusing. The machine name
- # can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
- # to the lowercase version "mint" (or "freemint"). Finally
- # the system name "TOS" denotes a system which is actually not
- # MiNT. But MiNT is downward compatible to TOS, so this should
- # be no problem.
- atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit 0 ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit 0 ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit 0 ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit 0 ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit 0 ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit 0 ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c \
- && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
- && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
- rm -f $dummy.c $dummy && rmdir $tmpdir
- echo mips-mips-riscos${UNAME_RELEASE}
- exit 0 ;;
- Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit 0 ;;
- Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit 0 ;;
- Night_Hawk:*:*:PowerMAX_OS)
- echo powerpc-harris-powermax
- exit 0 ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit 0 ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit 0 ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit 0 ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit 0 ;;
- AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
- then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
- then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else
- echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit 0 ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit 0 ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit 0 ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit 0 ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit 0 ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit 0 ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i*86:AIX:*:*)
- echo i386-ibm-aix
- exit 0 ;;
- ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit 0 ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
- rm -f $dummy.c $dummy && rmdir $tmpdir
- echo rs6000-ibm-aix3.2.5
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit 0 ;;
- *:AIX:*:[45])
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit 0 ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit 0 ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit 0 ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit 0 ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit 0 ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit 0 ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit 0 ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit 0 ;;
- 9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
- '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
- fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
-
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
-EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
- if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
- rm -f $dummy.c $dummy && rmdir $tmpdir
- fi ;;
- esac
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit 0 ;;
- ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit 0 ;;
- 3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
- rm -f $dummy.c $dummy && rmdir $tmpdir
- echo unknown-hitachi-hiuxwe2
- exit 0 ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit 0 ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit 0 ;;
- *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit 0 ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit 0 ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit 0 ;;
- i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit 0 ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit 0 ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit 0 ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit 0 ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit 0 ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit 0 ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit 0 ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
- -e 's/\.[^.]*$/.X/'
- exit 0 ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
- CRAY*T3D:*:*:*)
- echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
- F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit 0 ;;
- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit 0 ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
- *:FreeBSD:*:*)
- # Determine whether the default compiler uses glibc.
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #if __GLIBC__ >= 2
- LIBC=gnu
- #else
- LIBC=
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- rm -f $dummy.c && rmdir $tmpdir
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
- exit 0 ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit 0 ;;
- i*:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit 0 ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit 0 ;;
- x86:Interix*:3*)
- echo i386-pc-interix3
- exit 0 ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i386-pc-interix
- exit 0 ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit 0 ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit 0 ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- *:GNU:*:*)
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit 0 ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit 0 ;;
- arm*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
- ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
- m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
- mips:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips
- #undef mipsel
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mipsel
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips
- #else
- CPU=
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- rm -f $dummy.c && rmdir $tmpdir
- test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
- ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
- exit 0 ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
- exit 0 ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
- exit 0 ;;
- parisc:Linux:*:* | hppa:Linux:*:*)
- # Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
- esac
- exit 0 ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
- exit 0 ;;
- s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
- exit 0 ;;
- sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
- sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
- x86_64:Linux:*:*)
- echo x86_64-unknown-linux-gnu
- exit 0 ;;
- i*86:Linux:*:*)
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us. cd to the root directory to prevent
- # problems with other programs or directories called `ld' in the path.
- # Set LC_ALL=C to ensure ld outputs messages in English.
- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
- | sed -ne '/supported targets:/!d
- s/[ ][ ]*/ /g
- s/.*supported targets: *//
- s/ .*//
- p'`
- case "$ld_supported_targets" in
- elf32-i386)
- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
- ;;
- a.out-i386-linux)
- echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit 0 ;;
- coff-i386)
- echo "${UNAME_MACHINE}-pc-linux-gnucoff"
- exit 0 ;;
- "")
- # Either a pre-BFD a.out linker (linux-gnuoldld) or
- # one that does not give us useful --help.
- echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
- exit 0 ;;
- esac
- # Determine whether the default compiler is a.out or elf
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #ifdef __ELF__
- # ifdef __GLIBC__
- # if __GLIBC__ >= 2
- LIBC=gnu
- # else
- LIBC=gnulibc1
- # endif
- # else
- LIBC=gnulibc1
- # endif
- #else
- #ifdef __INTEL_COMPILER
- LIBC=gnu
- #else
- LIBC=gnuaout
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- rm -f $dummy.c && rmdir $tmpdir
- test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
- ;;
- i*86:DYNIX/ptx:4*:*)
- # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
- # earlier versions are messed up and put the nodename in both
- # sysname and nodename.
- echo i386-sequent-sysv4
- exit 0 ;;
- i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit 0 ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- fi
- exit 0 ;;
- i*86:*:5:[78]*)
- case `/bin/uname -X | grep "^Machine"` in
- *486*) UNAME_MACHINE=i486 ;;
- *Pentium) UNAME_MACHINE=i586 ;;
- *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
- esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit 0 ;;
- i*86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
- (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit 0 ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit 0 ;;
- pc:*:*:*)
- # Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i386.
- echo i386-pc-msdosdjgpp
- exit 0 ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit 0 ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit 0 ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit 0 ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit 0 ;;
- mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit 0 ;;
- M68*:*:R3V[567]*:*)
- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4.3${OS_REL} && exit 0
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4 && exit 0 ;;
- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit 0 ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit 0 ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit 0 ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit 0 ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit 0 ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit 0 ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit 0 ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit 0 ;;
- *:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit 0 ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit 0 ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit 0 ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit 0 ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit 0 ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit 0 ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit 0 ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit 0 ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit 0 ;;
- SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
- exit 0 ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
- *:Darwin:*:*)
- echo `uname -p`-apple-darwin${UNAME_RELEASE}
- exit 0 ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = "x86"; then
- UNAME_PROCESSOR=i386
- UNAME_MACHINE=pc
- fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit 0 ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit 0 ;;
- NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit 0 ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit 0 ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit 0 ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit 0 ;;
- *:Plan9:*:*)
- # "uname -m" is not consistent, so use $cputype instead. 386
- # is converted to i386 for consistency with other x86
- # operating systems.
- if test "$cputype" = "386"; then
- UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
- fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit 0 ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit 0 ;;
- *:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit 0 ;;
- *:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit 0 ;;
- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit 0 ;;
- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit 0 ;;
- *:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit 0 ;;
- *:ITS:*:*)
- echo pdp10-unknown-its
- exit 0 ;;
- i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit 0 ;;
- i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit 0 ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- if (version < 4)
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
- else
- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
- exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
- printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
- printf ("ns32k-encore-mach\n"); exit (0);
-#else
- printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
- printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
- printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
- printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
- struct utsname un;
-
- uname(&un);
-
- if (strncmp(un.version, "V2", 2) == 0) {
- printf ("i386-sequent-ptx2\n"); exit (0);
- }
- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
- printf ("i386-sequent-ptx1\n"); exit (0);
- }
- printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-# include <sys/param.h>
-# if defined (BSD)
-# if BSD == 43
- printf ("vax-dec-bsd4.3\n"); exit (0);
-# else
-# if BSD == 199006
- printf ("vax-dec-bsd4.3reno\n"); exit (0);
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# endif
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# else
- printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
- printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
- exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
-rm -f $dummy.c $dummy && rmdir $tmpdir
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
- case `getsysinfo -f cpu_type` in
- c1*)
- echo c1-convex-bsd
- exit 0 ;;
- c2*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit 0 ;;
- c34*)
- echo c34-convex-bsd
- exit 0 ;;
- c38*)
- echo c38-convex-bsd
- exit 0 ;;
- c4*)
- echo c4-convex-bsd
- exit 0 ;;
- esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
- ftp://ftp.gnu.org/pub/gnu/config/
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/config.sub b/config.sub
deleted file mode 100644
index 1dea9b79d5..0000000000
--- a/config.sub
+++ /dev/null
@@ -1,1470 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002 Free Software Foundation, Inc.
-
-timestamp='2002-09-05'
-
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine. It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit 0 ;;
- --version | -v )
- echo "$version" ; exit 0 ;;
- --help | --h* | -h )
- echo "$usage"; exit 0 ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit 0;;
-
- * )
- break ;;
- esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
- exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
- exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis)
- os=
- basic_machine=$1
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -chorusos*)
- os=-chorusos
- basic_machine=$1
- ;;
- -chorusrdb)
- os=-chorusrdb
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
- | clipper \
- | d10v | d30v | dlx | dsp16xx \
- | fr30 | frv \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | i370 | i860 | i960 | ia64 \
- | ip2k \
- | m32r | m68000 | m68k | m88k | mcore \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64vr | mips64vrel \
- | mips64orion | mips64orionel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mipsisa32 | mipsisa32el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | ns16k | ns32k \
- | openrisc | or32 \
- | pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
- | pyramid \
- | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
- | sh64 | sh64le \
- | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
- | strongarm \
- | tahoe | thumb | tic80 | tron \
- | v850 | v850e \
- | we32k \
- | x86 | xscale | xstormy16 | xtensa \
- | z8k)
- basic_machine=$basic_machine-unknown
- ;;
- m6811 | m68hc11 | m6812 | m68hc12)
- # Motorola 68HC11/12.
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
- ;;
-
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
- | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
- | avr-* \
- | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
- | clipper-* | cydra-* \
- | d10v-* | d30v-* | dlx-* \
- | elxsi-* \
- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
- | h8300-* | h8500-* \
- | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
- | i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* \
- | m32r-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | mcore-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipstx39 | mipstx39el \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
- | pyramid-* \
- | romp-* | rs6000-* \
- | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
- | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
- | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
- | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
- | v850-* | v850e-* | vax-* \
- | we32k-* \
- | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
- | xtensa-* \
- | ymp-* \
- | z8k-*)
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- c90)
- basic_machine=c90-cray
- os=-unicos
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | j90)
- basic_machine=j90-cray
- os=-unicos
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=-tops10
- ;;
- decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=-tops20
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
- ;;
- hp9k78[0-9] | hp78[0-9])
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- ;;
-# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- i*86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- mingw32)
- basic_machine=i386-pc
- os=-mingw32
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- mmix*)
- basic_machine=mmix-knuth
- os=-mmixware
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- morphos)
- basic_machine=powerpc-unknown
- os=-morphos
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- or32 | or32-*)
- basic_machine=or32-unknown
- os=-coff
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2)
- basic_machine=i686-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc) basic_machine=powerpc-unknown
- ;;
- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64) basic_machine=powerpc64-unknown
- ;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
- basic_machine=powerpc64le-unknown
- ;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- s390 | s390-*)
- basic_machine=s390-ibm
- ;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
- ;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sparclite-wrs | simso-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- st2000)
- basic_machine=m68k-tandem
- ;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- t3d)
- basic_machine=alpha-cray
- os=-unicos
- ;;
- t3e)
- basic_machine=alphaev5-cray
- os=-unicos
- ;;
- t90)
- basic_machine=t90-cray
- os=-unicos
- ;;
- tic4x | c4x*)
- basic_machine=tic4x-unknown
- os=-coff
- ;;
- tic54x | c54x*)
- basic_machine=tic54x-unknown
- os=-coff
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- toad1)
- basic_machine=pdp10-xkl
- os=-tops20
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- w65*)
- basic_machine=w65-wdc
- os=-none
- ;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
- ;;
- windows32)
- basic_machine=i386-pc
- os=-windows32-msvcrt
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
- ;;
- op50n)
- basic_machine=hppa1.1-oki
- ;;
- op60c)
- basic_machine=hppa1.1-oki
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
- basic_machine=sh-unknown
- ;;
- sh64)
- basic_machine=sh64-unknown
- ;;
- sparc | sparcv9 | sparcv9b)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
- ;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
- ;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* \
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto*)
- os=-nto-qnx
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -opened*)
- os=-openedition
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -atheos*)
- os=-atheos
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -nova*)
- os=-rtmk-nova
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -ose*)
- os=-ose
- ;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- # This must come before the *-dec entry.
- pdp10-*)
- os=-tops20
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- or32-*)
- os=-coff
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-ibm)
- os=-aix
- ;;
- *-wec)
- os=-proelf
- ;;
- *-winbond)
- os=-proelf
- ;;
- *-oki)
- os=-proelf
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
- ;;
- *-rom68k)
- os=-coff
- ;;
- *-*bug)
- os=-coff
- ;;
- *-apple)
- os=-macos
- ;;
- *-atari*)
- os=-mint
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -aix*)
- vendor=ibm
- ;;
- -beos*)
- vendor=be
- ;;
- -hpux*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs* | -opened*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -vxsim* | -vxworks* | -windiss*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- vendor=atari
- ;;
- -vos*)
- vendor=stratus
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit 0
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/configure.in b/configure.in
deleted file mode 100644
index 730774022c..0000000000
--- a/configure.in
+++ /dev/null
@@ -1,1365 +0,0 @@
-dnl ## $Id$ -*- sh -*-
-dnl ## Process this file with autoconf to produce a configure script.
-
-divert(1)
-
-dnl ## Diversion 1 is the autoconf + automake setup phase. We also
-dnl ## set the PHP version, deal with platform-specific compile
-dnl ## options and check for the basic compile tools.
-
-dnl ## Diversion 2 is the initial checking of OS features, programs,
-dnl ## libraries and so on.
-
-dnl ## In diversion 3 we check for compile-time options to the PHP
-dnl ## core and how to deal with different system dependencies. This
-dnl ## includes what regex library is used and whether debugging or short
-dnl ## tags are enabled, and the default behaviour of php.ini options.
-dnl ## This is also where an SAPI interface is selected (choosing between
-dnl ## Apache module, CGI etc.)
-
-dnl ## In diversion 4 we check user-configurable general settings.
-
-dnl ## In diversion 5 we check which extensions should be compiled.
-dnl ## All of these are normally in the extension directories.
-dnl ## Diversion 5 is the last one. Here we generate files and clean up.
-
-
-dnl Basic autoconf + automake initialization, generation of config.nice.
-dnl -------------------------------------------------------------------------
-
-AC_PREREQ(2.13)
-AC_INIT(README.CVS-RULES)
-
-PHP_CONFIG_NICE(config.nice)
-for arg in $0 "$@"; do
- CONFIGURE_COMMAND="$CONFIGURE_COMMAND '$arg'"
-done
-
-AC_CANONICAL_HOST
-AC_CONFIG_HEADER(main/php_config.h)
-
-MAJOR_VERSION=5
-MINOR_VERSION=0
-RELEASE_VERSION=0
-EXTRA_VERSION="-dev"
-VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
-
-dnl Define where extension directories are located in the configure context
-AC_DEFUN(PHP_EXT_BUILDDIR,[ext/$1])dnl
-AC_DEFUN(PHP_EXT_DIR,[ext/$1])dnl
-AC_DEFUN(PHP_EXT_SRCDIR,[$abs_srcdir/ext/$1])dnl
-AC_DEFUN(PHP_ALWAYS_SHARED,[])dnl
-
-dnl Setting up the PHP version based on the information above.
-dnl -------------------------------------------------------------------------
-
-PHP_VERSION=$VERSION
-echo "/* automatically generated by configure */" > php_version.h.new
-echo "/* edit configure.in to change version number */" >> php_version.h.new
-echo "#define PHP_MAJOR_VERSION $MAJOR_VERSION" >> php_version.h.new
-echo "#define PHP_MINOR_VERSION $MINOR_VERSION" >> php_version.h.new
-echo "#define PHP_RELEASE_VERSION $RELEASE_VERSION" >> php_version.h.new
-echo "#define PHP_EXTRA_VERSION \"$EXTRA_VERSION\"" >> php_version.h.new
-echo "#define PHP_VERSION \"$PHP_VERSION\"" >> php_version.h.new
-cmp php_version.h.new $srcdir/main/php_version.h >/dev/null 2>&1
-if test $? -ne 0 ; then
- rm -f $srcdir/main/php_version.h && mv php_version.h.new $srcdir/main/php_version.h && \
- echo 'Updated main/php_version.h'
-else
- rm -f php_version.h.new
-fi
-
-
-dnl Catch common errors here to save a few seconds of our users' time
-dnl -------------------------------------------------------------------------
-
-if test "$with_shared_apache" != "no" && test -n "$with_shared_apache" ; then
- AC_MSG_ERROR([--with-shared-apache is not supported. Please refer to the documentation for using APXS])
-fi
-
-if test -n "$with_apache" && test -n "$with_apxs"; then
- AC_MSG_ERROR([--with-apache and --with-apxs cannot be used together])
-fi
-
-
-dnl Settings we want to make before the checks.
-dnl -------------------------------------------------------------------------
-
-cwd=`pwd`
-
-php_shtool=$srcdir/build/shtool
-T_MD=`$php_shtool echo -n -e %B`
-T_ME=`$php_shtool echo -n -e %b`
-
-PHP_INIT_BUILD_SYSTEM
-
-dnl We want this one before the checks, so the checks can modify CFLAGS.
-test -z "$CFLAGS" && auto_cflags=1
-
-abs_srcdir=`(cd $srcdir; pwd)`
-abs_builddir=`pwd`
-
-php_abs_top_srcdir=$abs_srcdir
-php_abs_top_builddir=$abs_builddir
-
-dnl Because ``make install'' is often performed by the superuser,
-dnl we create the libs subdirectory as the user who configures PHP.
-dnl Otherwise, the current user will not be able to delete libs
-dnl or the contents of libs.
-
-$php_shtool mkdir -p libs
-rm -f libs/*
-
-dnl Checks for programs.
-dnl -------------------------------------------------------------------------
-
-AC_PROG_CC
-AC_PROG_CC_C_O
-dnl Change to AC_PROG_CC_STDC when we start requiring a post-2.13 autoconf
-dnl AC_PROG_CC_STDC
-AC_PROG_CPP
-
-AC_AIX
-
-dnl AC_PROG_CXX
-dnl AC_PROG_CXXCPP
-
-dnl check for -R, etc. switch
-PHP_RUNPATH_SWITCH
-
-AC_PROG_RANLIB
-AC_PROG_LN_S
-AC_PROG_AWK
-AC_PROG_YACC
-if test "$YACC" != "bison -y"; then
- AC_MSG_WARN([You will need bison if you want to regenerate the PHP parsers.])
-else
- AC_MSG_CHECKING([bison version])
- set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /'|tr -d a-z`
- if test "${1}" = "1" -a "${2}" != "28" -a "${2}" != "35" -a "${2}" != "75"; then
- AC_MSG_WARN([You will need bison 1.28, 1.35 or 1.75 if you want to regenerate the Zend parser (found ${1}.${2}).])
- fi
- AC_MSG_RESULT(${1}.${2} (ok))
-fi
-AC_PROG_LEX
-if test -n "$LEX"; then
- AC_DECL_YYTEXT
- :
-fi
-dnl ## Make flex scanners use const if they can, even if __STDC__ is not
-dnl ## true, for compilers like Sun's that only set __STDC__ true in
-dnl ## "limit-to-ANSI-standard" mode, not in "ANSI-compatible" mode
-AC_C_CONST
-if test "$ac_cv_c_const" = "yes" ; then
- LEX_CFLAGS="-DYY_USE_CONST"
-fi
-
-AC_MSG_CHECKING([flex version])
-if test "$LEX" ;then
- flexvers=`echo "" | $LEX -V -v --version 2>/dev/null |
- sed -e 's/^.* //' -e 's/\./ /g'`
- if test ! -z "$flexvers"; then
- set $flexvers
- if test "${1}" != "2" -o "${2}" != "5" -o "${3}" != "4"; then
- AC_MSG_WARN(You will need flex 2.5.4 if you want to regenerate Zend/PHP lexical parsers.)
- fi
- fi
-AC_MSG_RESULT(${1}.${2}.${3} (ok))
-else
- AC_MSG_WARN(You will need flex 2.5.4 or later if you want to regenerate Zend/PHP lexical parsers.)
-fi
-
-dnl Platform-specific compile settings.
-dnl -------------------------------------------------------------------------
-
-dnl if host_alias is empty, ac_cv_host_alias may still have the info
-if test -z "$host_alias"; then
- host_alias=$ac_cv_host_alias
-fi
-
-case $host_alias in
-*solaris*)
- CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
- if test "${enable_libgcc+set}" != "set" && test "$GCC" = "yes"; then
- enable_libgcc=yes
- fi
- ;;
-*dgux*)
- CPPFLAGS="$CPPFLAGS -D_BSD_TIMEOFDAY_FLAVOR";;
-*darwin*|*rhapsody*)
- CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
- php_multiple_shlib_versions_ok=yes;;
-*beos*)
- beos_threads=1
- LIBS="$LIBS -lbe -lroot";;
-*mips*)
- CPPFLAGS="$CPPFLAGS -D_XPG_IV";;
-esac
-
-
-dnl Include Zend and TSRM configurations.
-dnl -------------------------------------------------------------------------
-
-sinclude(Zend/acinclude.m4)
-sinclude(Zend/Zend.m4)
-sinclude(TSRM/tsrm.m4)
-
-
-
-divert(2)
-
-dnl ## Diversion 2 is where we set PHP-specific options and come up
-dnl ## with reasonable default values for them. We check for pthreads here
-dnl ## because the information is needed by the SAPI configuration.
-dnl ## This is also where an SAPI interface is selected (choosing between
-dnl ## Apache module, CGI etc.)
-
-dnl .
-dnl -------------------------------------------------------------------------
-
-PTHREADS_CHECK
-PHP_HELP_SEPARATOR([SAPI modules:])
-PHP_SHLIB_SUFFIX_NAME
-PHP_SAPI=default
-PHP_BUILD_PROGRAM
-
-
-
-dnl SAPI configuration.
-dnl -------------------------------------------------------------------------
-
-dnl paths to the targets are relative to the build directory
-SAPI_SHARED=libs/libphp5.$SHLIB_SUFFIX_NAME
-SAPI_STATIC=libs/libphp5.a
-SAPI_LIBTOOL=libphp5.la
-
-PHP_CONFIGURE_PART(Configuring SAPI modules)
-
-esyscmd(./build/config-stubs sapi)
-
-dnl Show which main SAPI was selected
-AC_MSG_CHECKING([for chosen SAPI module])
-AC_MSG_RESULT([$PHP_SAPI])
-
-if test "$enable_maintainer_zts" = "yes"; then
- PTHREADS_ASSIGN_VARS
- PTHREADS_FLAGS
-fi
-
-if test "$PHP_ENABLE_FASTCGI" = "yes"; then
- PHP_CONFIGURE_PART(Running FastCGI checks)
- sinclude(sapi/cgi/libfcgi/acinclude.m4)
- sinclude(sapi/cgi/libfcgi/libfcgi.m4)
-fi
-
-divert(3)
-
-dnl ## In diversion 3 we check for compile-time options to the PHP
-dnl ## core and how to deal with different system dependencies. This
-dnl ## includes what regex library is used and whether debugging or short
-dnl ## tags are enabled, and the default behaviour of php.ini options.
-
-
-
-dnl Starting system checks.
-dnl -------------------------------------------------------------------------
-
-PHP_CONFIGURE_PART(Running system checks)
-
-PHP_MISSING_TIME_R_DECL
-PHP_PROG_SENDMAIL
-dnl Check whether the system uses EBCDIC (not ASCII) as its native codeset
-PHP_EBCDIC
-dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary
-dnl and source packages. This should be harmless on other OSs.
-if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
- CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
- LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
-fi
-INCLUDES="$INCLUDES -I\$(top_builddir)/Zend"
-test -d /usr/ucblib && PHP_ADD_LIBPATH(/usr/ucblib)
-
-
-dnl First, library checks.
-dnl -------------------------------------------------------------------------
-
-dnl Some systems (OpenServer 5) dislike -lsocket -lnsl, so we try
-dnl to avoid -lnsl checks, if we already have the functions which
-dnl are usually in libnsl
-dnl Also, uClibc will bark at linking with glibc's libnsl.
-
-PHP_CHECK_FUNC(socket, socket)
-PHP_CHECK_FUNC(htonl, socket)
-PHP_CHECK_FUNC(gethostname, nsl)
-PHP_CHECK_FUNC(gethostbyaddr, nsl)
-PHP_CHECK_FUNC(yp_get_default_domain, nsl)
-
-PHP_CHECK_FUNC(dlopen, dl)
-if test "$ac_cv_func_dlopen" = "yes"; then
- AC_DEFINE(HAVE_LIBDL, 1, [ ])
-fi
-AC_CHECK_LIB(m, sin)
-
-dnl Check for resolver routines.
-dnl Need to check for both res_search and __res_search
-dnl in -lc, -lbind, -lresolv and -lsocket
-PHP_CHECK_FUNC(res_search, resolv, bind, socket)
-
-dnl Check for inet_aton and dn_skipname
-dnl in -lc, -lbind and -lresolv
-PHP_CHECK_FUNC(inet_aton, resolv, bind)
-PHP_CHECK_FUNC(dn_skipname, resolv, bind)
-
-
-dnl Then headers.
-dnl -------------------------------------------------------------------------
-
-dnl Checks for header files.
-AC_HEADER_STDC
-
-dnl In QNX opendir resides in libc but dirent.h is still required
-if test "`uname -s 2>/dev/null`" != "QNX"; then
- AC_HEADER_DIRENT
-else
- AC_CHECK_HEADERS(dirent.h)
-fi
-PHP_MISSING_FCLOSE_DECL
-dnl QNX requires unix.h to allow functions in libunix to work properly
-AC_CHECK_HEADERS([ \
-ApplicationServices/ApplicationServices.h \
-sys/types.h \
-sys/time.h \
-netinet/in.h \
-alloca.h \
-arpa/inet.h \
-arpa/nameser.h \
-assert.h \
-crypt.h \
-fcntl.h \
-grp.h \
-ieeefp.h \
-langinfo.h \
-limits.h \
-locale.h \
-monetary.h \
-mach-o/dyld.h \
-netdb.h \
-pwd.h \
-resolv.h \
-signal.h \
-stdarg.h \
-stdlib.h \
-string.h \
-syslog.h \
-sysexits.h \
-sys/file.h \
-sys/mman.h \
-sys/mount.h \
-sys/poll.h \
-sys/resource.h \
-sys/select.h \
-sys/socket.h \
-sys/statfs.h \
-sys/statvfs.h \
-sys/vfs.h \
-sys/sysexits.h \
-sys/varargs.h \
-sys/wait.h \
-unistd.h \
-unix.h \
-utime.h \
-sys/utsname.h \
-sys/ipc.h \
-],[],[],[
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_NAMESER_H
-#include <arpa/nameser.h>
-#endif
-])
-
-PHP_FOPENCOOKIE
-PHP_BROKEN_GETCWD
-PHP_BROKEN_GLIBC_FOPEN_APPEND
-
-dnl Checks for typedefs, structures, and compiler characteristics.
-dnl -------------------------------------------------------------------------
-
-AC_STRUCT_TM
-AC_STRUCT_TIMEZONE
-
-PHP_TM_GMTOFF
-PHP_STRUCT_FLOCK
-PHP_SOCKLEN_T
-
-AC_CHECK_SIZEOF(long, 8)
-AC_CHECK_SIZEOF(int, 4)
-
-dnl Check for members of the stat structure
-AC_STRUCT_ST_BLKSIZE
-dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists
-dnl The WARNING_LEVEL required because cc in QNX hates -w option without an argument
-if test "`uname -s 2>/dev/null`" != "QNX"; then
- AC_STRUCT_ST_BLOCKS
-else
- AC_MSG_WARN([warnings level for cc set to 0])
- WARNING_LEVEL=0
-fi
-AC_STRUCT_ST_RDEV
-
-dnl Checks for types
-AC_TYPE_SIZE_T
-AC_TYPE_UID_T
-
-dnl Check for struct sockaddr_storage
-AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_sockaddr_storage,
-[AC_TRY_COMPILE([ #include <sys/types.h>
-#include <sys/socket.h>], [struct sockaddr_storage s; s],
- ac_cv_sockaddr_storage=yes, ac_cv_sockaddr_storage=no)])
-if test "$ac_cv_sockaddr_storage" = yes; then
- AC_DEFINE(HAVE_SOCKADDR_STORAGE,1,[Whether you have struct sockaddr_storage])
-fi
-
-dnl Check if sockaddr data structure includes an "sa_len" member
-
-AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/socket.h>
-], [static struct sockaddr sa; int n = (int) sa.sa_len; return n],
-[AC_DEFINE(HAVE_SOCKADDR_LEN,1,[Whether sockaddr struct has sa_len])],
-[])
-
-dnl Check for IPv6 support
-AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
-[AC_TRY_LINK([ #include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;],
- [ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])])
-
-
-
-dnl Checks for library functions.
-dnl -------------------------------------------------------------------------
-
-AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(
-alphasort \
-asctime_r \
-chroot \
-ctime_r \
-cuserid \
-crypt \
-flock \
-ftok \
-funopen \
-gai_strerror \
-gcvt \
-getlogin \
-getprotobyname \
-getprotobynumber \
-getservbyname \
-getservbyport \
-getrusage \
-gettimeofday \
-gmtime_r \
-inet_ntoa \
-inet_ntop \
-isascii \
-link \
-localtime_r \
-lockf \
-lrand48 \
-memcpy \
-memmove \
-mkstemp \
-mmap \
-nl_langinfo \
-perror \
-poll \
-putenv \
-realpath \
-random \
-rand_r \
-regcomp \
-res_search \
-scandir \
-setitimer \
-setlocale \
-localeconv \
-setsockopt \
-setvbuf \
-shutdown \
-sin \
-snprintf \
-srand48 \
-srandom \
-statfs \
-statvfs \
-std_syslog \
-strcasecmp \
-strcoll \
-strdup \
-strerror \
-strftime \
-strstr \
-strtok_r \
-symlink \
-tempnam \
-tzset \
-unsetenv \
-usleep \
-utime \
-vsnprintf \
-)
-
-dnl Check for getaddrinfo, should be a better way, but...
-AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
-[AC_TRY_COMPILE([#include <netdb.h>],
- [struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);],
- ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no)])
-if test "$ac_cv_func_getaddrinfo" = yes; then
- AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
-fi
-
-AC_REPLACE_FUNCS(strlcat strlcpy getopt)
-AC_FUNC_UTIME_NULL
-AC_FUNC_ALLOCA
-PHP_AC_BROKEN_SPRINTF
-PHP_AC_BROKEN_SNPRINTF
-PHP_DECLARED_TIMEZONE
-PHP_TIME_R_TYPE
-PHP_READDIR_R_TYPE
-
-dnl AIX keeps in_addr_t in /usr/include/netinet/in.h
-dnl AC_MSG_CHECKING([for in_addr_t])
-AC_CACHE_VAL(ac_cv_type_$1,
-[AC_EGREP_CPP(dnl
-changequote(<<,>>)dnl
-<<in_addr_t[^a-zA-Z_0-9]>>dnl
-changequote([,]), [#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif], ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)])dnl
-
-dnl AC_MSG_RESULT([$ac_cv_type_in_addr_t])
-if test $ac_cv_type_in_addr_t = no; then
- AC_DEFINE(in_addr_t, u_int, [ ])
-fi
-
-
-
-divert(4)
-
-dnl ## In diversion 4 we check user-configurable general settings.
-
-dnl General settings.
-dnl -------------------------------------------------------------------------
-PHP_CONFIGURE_PART(General settings)
-
-PHP_HELP_SEPARATOR([General settings:])
-
-PHP_ARG_ENABLE(debug, whether to include debugging symbols,
-[ --enable-debug Compile with debugging symbols.], no, no)
-
-if test "$PHP_DEBUG" = "yes"; then
- PHP_DEBUG=1
- ZEND_DEBUG=yes
-else
- PHP_DEBUG=0
- ZEND_DEBUG=no
-fi
-
-PHP_ARG_WITH(layout,[layout of installed files],
-[ --with-layout=TYPE Sets how installed files will be laid out. Type is
- one of "PHP" (default) or "GNU"], PHP, no)
-
-case $PHP_LAYOUT in
- GNU)
- oldstyleextdir=no
- ;;
- *)
- oldstyleextdir=yes
- ;;
-esac
-
-PHP_ARG_WITH(config-file-path,[path to configuration file],
-[ --with-config-file-path=PATH
- Sets the path in which to look for php.ini,
- defaults to PREFIX/lib], DEFAULT, no)
-
-if test "$PHP_CONFIG_FILE_PATH" = "DEFAULT"; then
- case $PHP_LAYOUT in
- GNU)
- PHP_CONFIG_FILE_PATH=$sysconfdir
- ;;
- *)
- PHP_CONFIG_FILE_PATH=$libdir
- ;;
- esac
-fi
-
-PHP_ARG_WITH(config-file-scan-dir,[directory to be scanned for configuration files],
-[ --with-config-file-scan-dir=PATH ], DEFAULT, no)
-if test "$PHP_CONFIG_FILE_SCAN_DIR" = "DEFAULT"; then
- PHP_CONFIG_FILE_SCAN_DIR=""
-fi
-
-# compatibility
-if test -z "$with_pear" && test "$enable_pear" = "no"; then
- with_pear=no
-fi
-
-PHP_ARG_WITH(pear, [whether to install PEAR, and where],
-[ --with-pear=DIR Install PEAR in DIR (default PREFIX/lib/php)
- --without-pear Do not install PEAR], DEFAULT, yes)
-
-if test "$PHP_PEAR" != "no" && test "$PHP_SAPI_CLI" != "no"; then
- install_pear="install-pear"
- PEAR_INSTALLDIR=$PHP_PEAR
-fi
-
-if test "$PHP_PEAR" = "DEFAULT" || test "$PHP_PEAR" = "yes"; then
- case $PHP_LAYOUT in
- GNU) PEAR_INSTALLDIR=$datadir/pear;;
- *) PEAR_INSTALLDIR=$libdir/php;;
- esac
-fi
-
-test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
-
-PHP_ARG_ENABLE(safe-mode, whether to enable safe mode by default,
-[ --enable-safe-mode Enable safe mode by default.], no, no)
-
-if test "$PHP_SAFE_MODE" = "yes"; then
- AC_DEFINE(PHP_SAFE_MODE,1,[ ])
-else
- AC_DEFINE(PHP_SAFE_MODE,0,[ ])
-fi
-
-AC_MSG_CHECKING([for safe mode exec dir])
-AC_ARG_WITH(exec-dir,
-[ --with-exec-dir[=DIR] Only allow executables in DIR when in safe mode
- defaults to /usr/local/php/bin],
-[
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin", [ ])
- AC_MSG_RESULT([/usr/local/php/bin])
- else
- AC_DEFINE_UNQUOTED(PHP_SAFE_MODE_EXEC_DIR,"$withval", [ ])
- AC_MSG_RESULT([$withval])
- fi
- else
- AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin", [ ])
- AC_MSG_RESULT([/usr/local/php/bin])
- fi
-],[
- AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin", [ ])
- AC_MSG_RESULT([/usr/local/php/bin])
-])
-
-PHP_ARG_ENABLE(sigchild,whether to enable PHP's own SIGCHLD handler,
-[ --enable-sigchild Enable PHP's own SIGCHLD handler.], no, no)
-
-if test "$PHP_SIGCHILD" = "yes"; then
- AC_DEFINE(PHP_SIGCHILD, 1, [ ])
-else
- AC_DEFINE(PHP_SIGCHILD, 0, [ ])
-fi
-
-PHP_ARG_ENABLE(magic-quotes,whether to enable magic quotes by default,
-[ --enable-magic-quotes Enable magic quotes by default.], no, no)
-
-if test "$PHP_MAGIC_QUOTES" = "yes"; then
- AC_DEFINE(MAGIC_QUOTES, 1, [ ])
-else
- AC_DEFINE(MAGIC_QUOTES, 0, [ ])
-fi
-
-PHP_ARG_ENABLE(rpath, whether to enable runpaths,
-[ --disable-rpath Disable passing additional runtime library
- search paths], yes, no)
-
-PHP_ARG_ENABLE(libgcc, whether to explicitly link against libgcc,
-[ --enable-libgcc Enable explicitly linking against libgcc], no, no)
-
-if test "$PHP_LIBGCC" = "yes"; then
- PHP_LIBGCC_LIBPATH(gcc)
- if test -z "$libgcc_libpath"; then
- AC_MSG_ERROR([Cannot locate libgcc. Make sure that gcc is in your path])
- fi
- PHP_ADD_LIBPATH($libgcc_libpath)
- PHP_ADD_LIBRARY(gcc, yes)
-fi
-
-PHP_ARG_ENABLE(short-tags,whether to enable short tags by default,
-[ --disable-short-tags Disable the short-form <? start tag by default.],yes, no)
-
-if test "$PHP_SHORT_TAGS" = "yes"; then
- AC_DEFINE(DEFAULT_SHORT_OPEN_TAG,"1",[ ])
-else
- AC_DEFINE(DEFAULT_SHORT_OPEN_TAG,"0",[ ])
-fi
-
-PHP_ARG_ENABLE(dmalloc,whether to enable dmalloc,
-[ --enable-dmalloc Enable dmalloc], no, no)
-
-if test "$PHP_DMALLOC" = "yes"; then
-
- AC_CHECK_LIB(dmalloc, dmalloc_error, [
- PHP_ADD_LIBRARY(dmalloc)
- AC_DEFINE(HAVE_DMALLOC,1,[Whether you have dmalloc])
- CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK"
- ], [
- AC_MSG_ERROR([Problem with enabling dmalloc. Please check config.log for details.])
- ])
-fi
-
-PHP_ARG_ENABLE(ipv6,whether to enable IPv6 support,
-[ --disable-ipv6 Disable IPv6 support], yes, no)
-
-if test "$PHP_IPV6" != "no" && test "$ac_cv_ipv6_support" = yes; then
- AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
-fi
-
-
-dnl
-dnl OpenSSL configure
-dnl
-PHP_ARG_WITH(openssl,for OpenSSL support,
-[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.6) ])
-
-if test "$PHP_OPENSSL" != "no"; then
- ext_openssl_shared=$ext_shared
- PHP_SETUP_OPENSSL
-fi
-
-divert(5)
-
-dnl ## In diversion 5 we check which extensions should be compiled.
-dnl ## All of these are normally in the extension directories.
-
-dnl Extension configuration.
-dnl -------------------------------------------------------------------------
-
-PHP_HELP_SEPARATOR([Extensions:
-
- --with-EXTENSION=[shared[,PATH]]
-
- NOTE: Not all extensions can be build as 'shared'.
-
- Example: --with-foobar=shared,/usr/local/foobar/
-
- o Builds the foobar extension as shared extension.
- o foobar package install prefix is /usr/local/foobar/
-])
-
-PHP_CONFIGURE_PART(Configuring extensions)
-
-dnl
-dnl Check if all enabled by default extensions should be disabled
-dnl
-
-AC_ARG_ENABLE(all,
-[ --disable-all Disable all extensions enabled by default.
-], [
- PHP_ENABLE_ALL=$enableval
-])
-
-AC_ARG_ENABLE(bundle-all,
-[ --disable-bundle-all Disable all bundled libraries by default.
-], [
- PHP_BUNDLE_ALL=$enableval
-])
-
-# reading config stubs
-esyscmd(./build/config-stubs ext)
-esyscmd(./build/config-stubs bundle)
-
-
-dnl Other settings.
-dnl -------------------------------------------------------------------------
-
-PHP_HELP_SEPARATOR([Other settings:])
-
-AC_MSG_CHECKING([whether to enable versioning])
-AC_ARG_ENABLE(versioning,
-[ --enable-versioning Export only required symbols.
- See INSTALL for more information], [
- if test "x$APXS" != "x"; then
- PHP_VERSIONING=$enableval
- else
- PHP_VERSIONING=no
- fi
-],[
- PHP_VERSIONING=no
-])
-AC_MSG_RESULT([$PHP_VERSIONING])
-
-if test "$PHP_VERSIONING" = "yes"; then
- test -z "$PHP_SYM_FILE" && PHP_SYM_FILE="$abs_srcdir/sapi/$PHP_SAPI/php.sym"
- if test -f "$PHP_SYM_FILE"; then
- EXTRA_LDFLAGS="-export-symbols $PHP_SYM_FILE $EXTRA_LDFLAGS"
- fi
-fi
-
-enable_shared=yes
-enable_static=yes
-unset with_pic
-
-case $php_build_target in
-program|static)
- standard_libtool_flag='-prefer-non-pic -static'
- if test -z "$PHP_MODULES"; then
- enable_shared=no
- fi
-;;
-shared)
- enable_static=no
- standard_libtool_flag=-prefer-pic
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -avoid-version -module"
-;;
-esac
-
-PHP_REGEX
-
-EXTRA_LIBS="$EXTRA_LIBS $DLIBS $LIBS"
-
-dnl this has to be here to prevent the openssl crypt() from
-dnl overriding the system provided crypt().
-if test "$ac_cv_lib_crypt_crypt" = "yes"; then
- EXTRA_LIBS="-lcrypt $EXTRA_LIBS -lcrypt"
-fi
-
-unset LIBS LDFLAGS
-
-dnl Configuring Zend and TSRM.
-dnl -------------------------------------------------------------------------
-
-PHP_CONFIGURE_PART(Configuring Zend)
-LIBZEND_BASIC_CHECKS
-LIBZEND_DLSYM_CHECK
-LIBZEND_OTHER_CHECKS
-
-TSRM_LIB='TSRM/libtsrm.la'
-TSRM_DIR=TSRM
-CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/TSRM"
-
-if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
- AC_DEFINE(ZTS,1,[ ])
- PHP_THREAD_SAFETY=yes
-else
- PHP_THREAD_SAFETY=no
-fi
-
-if test "$abs_srcdir" != "$abs_builddir"; then
- INCLUDES="$INCLUDES -I\$(top_srcdir)/main -I\$(top_srcdir)/Zend"
- INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM"
-fi
-
-ZEND_EXTRA_LIBS="$LIBS"
-unset LIBS LDFLAGS
-
-PHP_CONFIGURE_PART(Configuring TSRM)
-TSRM_BASIC_CHECKS
-if test "$PHP_THREAD_SAFETY" = "yes"; then
- TSRM_THREADS_CHECKS
-fi
-EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LDFLAGS"
-EXTRA_LIBS="$EXTRA_LIBS $LIBS"
-unset LIBS LDFLAGS
-
-test "$prefix" = "NONE" && prefix=/usr/local
-test "$exec_prefix" = "NONE" && exec_prefix='${prefix}'
-
-case $libdir in
- '${exec_prefix}/lib')
- libdir=$libdir/php
- ;;
-esac
-case $datadir in
- '${prefix}/share')
- datadir=$datadir/php
- ;;
- *) ;;
-esac
-
-phplibdir=`pwd`/modules
-$php_shtool mkdir -p $phplibdir
-phptempdir=`pwd`/libs
-
-old_exec_prefix=$exec_prefix
-old_libdir=$libdir
-old_datadir=$datadir
-exec_prefix=`eval echo $exec_prefix`
-libdir=`eval echo $libdir`
-datadir=`eval echo $datadir`
-
-dnl Build extension directory path
-
-ZEND_MODULE_API_NO=`grep -E '#define ZEND_MODULE_API_NO ' $srcdir/Zend/zend_modules.h|sed 's/#define ZEND_MODULE_API_NO //'`
-
-if test -z "$EXTENSION_DIR"; then
- extbasedir=$ZEND_MODULE_API_NO
- if test "$oldstyleextdir" = "yes"; then
- if test "$PHP_DEBUG" = "1"; then
- part1=debug
- else
- part1=no-debug
- fi
- if test "$enable_maintainer_zts" = "yes"; then
- part2=zts
- else
- part2=non-zts
- fi
- extbasedir=$part1-$part2-$extbasedir
- EXTENSION_DIR=$libdir/extensions/$extbasedir
- else
- if test "$enable_maintainer_zts" = "yes"; then
- extbasedir=$extbasedir-zts
- fi
-
- if test "$PHP_DEBUG" = "1"; then
- extbasedir=$extbasedir-debug
- fi
- EXTENSION_DIR=$libdir/$extbasedir
- fi
-fi
-
-dnl Expand all directory names for use in macros/constants
-EXPANDED_PEAR_INSTALLDIR=`eval echo $PEAR_INSTALLDIR`
-EXPANDED_EXTENSION_DIR=`eval echo $EXTENSION_DIR`
-EXPANDED_LOCALSTATEDIR=`eval echo $localstatedir`
-EXPANDED_BINDIR=`eval echo $bindir`
-EXPANDED_LIBDIR=$libdir
-EXPANDED_SYSCONFDIR=`eval echo $sysconfdir`
-EXPANDED_DATADIR=$datadir
-EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"`
-EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"`
-INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR
-
-exec_prefix=$old_exec_prefix
-libdir=$old_libdir
-datadir=$old_datadir
-
-AC_SUBST(INCLUDE_PATH)
-AC_SUBST(EXPANDED_PEAR_INSTALLDIR)
-AC_SUBST(EXPANDED_EXTENSION_DIR)
-AC_SUBST(EXPANDED_BINDIR)
-AC_SUBST(EXPANDED_LIBDIR)
-AC_SUBST(EXPANDED_DATADIR)
-AC_SUBST(EXPANDED_SYSCONFDIR)
-AC_SUBST(EXPANDED_LOCALSTATEDIR)
-AC_SUBST(EXPANDED_PHP_CONFIG_FILE_PATH)
-AC_SUBST(EXPANDED_PHP_CONFIG_FILE_SCAN_DIR)
-
-if test -n "$php_ldflags_add_usr_lib"; then
- PHP_RPATHS="$PHP_RPATHS /usr/lib"
-fi
-
-PHP_UTILIZE_RPATHS
-
-if test -z "$php_ldflags_add_usr_lib"; then
- PHP_REMOVE_USR_LIB(PHP_LDFLAGS)
- PHP_REMOVE_USR_LIB(LDFLAGS)
-fi
-
-EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS"
-
-PHP_BUILD_DATE=`date '+%Y-%m-%d'`
-AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE",[PHP build date])
-PHP_UNAME=`uname -a | xargs`
-AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output])
-PHP_OS=`uname | xargs`
-AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output])
-
-if test "$PHP_SAPI_CLI" != "no"; then
- PHP_CLI_TARGET="\$(SAPI_CLI_PATH)"
- PHP_INSTALL_CLI_TARGET="install-cli"
- PHP_ADD_SOURCES(sapi/cli, php_cli.c getopt.c,, cli)
-fi
-
-PHP_SUBST(PHP_CLI_TARGET)
-PHP_SUBST(PHP_SAPI_OBJS)
-PHP_SUBST(PHP_CLI_OBJS)
-PHP_SUBST(PHP_GLOBAL_OBJS)
-
-PHP_SUBST(PHP_MODULES)
-
-PHP_SUBST(EXT_LIBS)
-
-PHP_SUBST_OLD(abs_builddir)
-PHP_SUBST_OLD(abs_srcdir)
-PHP_SUBST_OLD(php_abs_top_builddir)
-PHP_SUBST_OLD(php_abs_top_srcdir)
-
-PHP_SUBST(bindir)
-PHP_SUBST(exec_prefix)
-PHP_SUBST(includedir)
-PHP_SUBST(libdir)
-PHP_SUBST(mandir)
-PHP_SUBST(phplibdir)
-PHP_SUBST(phptempdir)
-PHP_SUBST(prefix)
-PHP_SUBST(localstatedir)
-PHP_SUBST(datadir)
-PHP_SUBST(sysconfdir)
-
-PHP_SUBST(AWK)
-PHP_SUBST(CC)
-PHP_SUBST(CFLAGS)
-PHP_SUBST(CFLAGS_CLEAN)
-PHP_SUBST_OLD(CONFIGURE_COMMAND)
-PHP_SUBST(CPP)
-PHP_SUBST(CPPFLAGS)
-PHP_SUBST(CXX)
-PHP_SUBST(CXXFLAGS)
-PHP_SUBST(CXXFLAGS_CLEAN)
-PHP_SUBST(CXX_PHP_COMPILE)
-PHP_SUBST_OLD(DEBUG_CFLAGS)
-PHP_SUBST(DEFS)
-PHP_SUBST_OLD(EXTENSION_DIR)
-PHP_SUBST_OLD(EXTRA_LDFLAGS)
-PHP_SUBST_OLD(EXTRA_LIBS)
-PHP_SUBST_OLD(ZEND_EXTRA_LIBS)
-PHP_SUBST_OLD(INCLUDES)
-PHP_SUBST_OLD(EXTRA_INCLUDES)
-PHP_SUBST_OLD(INCLUDE_PATH)
-PHP_SUBST_OLD(INSTALL_IT)
-PHP_SUBST(LEX)
-PHP_SUBST(LEX_OUTPUT_ROOT)
-PHP_SUBST(LFLAGS)
-PHP_SUBST(LIBTOOL)
-PHP_SUBST(LN_S)
-PHP_SUBST_OLD(NATIVE_RPATHS)
-PHP_SUBST_OLD(PEAR_INSTALLDIR)
-PHP_SUBST(PHP_BUILD_DATE)
-PHP_SUBST(PHP_COMPILE)
-PHP_SUBST_OLD(PHP_LDFLAGS)
-PHP_SUBST_OLD(PHP_LIBS)
-PHP_SUBST(OVERALL_TARGET)
-PHP_SUBST(PHP_RPATHS)
-PHP_SUBST(PHP_SAPI)
-PHP_SUBST_OLD(PHP_VERSION)
-PHP_SUBST(PROG_SENDMAIL)
-PHP_SUBST(SHELL)
-PHP_SUBST(SHARED_LIBTOOL)
-PHP_SUBST(TSRM_DIR)
-PHP_SUBST(TSRM_LIB)
-PHP_SUBST(WARNING_LEVEL)
-PHP_SUBST(PHP_FRAMEWORKS)
-PHP_SUBST(PHP_FRAMEWORKPATH)
-PHP_SUBST_OLD(YACC)
-PHP_SUBST_OLD(SHLIB_SUFFIX_NAME)
-
-old_CC=$CC
-
-if test "$PHP_THREAD_SAFETY" = "yes" && test -n "$ac_cv_pthreads_cflags"; then
- CXXFLAGS="$CXXFLAGS $ac_cv_pthreads_cflags"
- INLINE_CFLAGS="$INLINE_CFLAGS $ac_cv_pthreads_cflags"
- cat >meta_ccld<<EOF
-#! /bin/sh
-exec $CC $ac_cv_pthreads_cflags \$@
-EOF
- CC="$abs_builddir/meta_ccld"
- chmod +x meta_ccld
-fi
-
-dnl This will go away, if we have a facility to run per-extension code
-dnl after the thread_safety decision was done
-if test "$PHP_THREAD_SAFETY" = "yes" && test "$PHP_MYSQL" = "yes"; then
- CPPFLAGS="$CPPFLAGS -DTHREAD=1"
-fi
-
-dnl
-dnl Libtool creation
-dnl
-
-PHP_CONFIGURE_PART(Configuring libtool)
-
-LDFLAGS="$LDFLAGS $PHP_AIX_LDFLAGS"
-AC_PROG_LIBTOOL
-if test "$enable_debug" != "yes"; then
- PHP_SET_LIBTOOL_VARIABLE([--silent])
-fi
-
-dnl libtool 1.4.3 needs this.
-PHP_SET_LIBTOOL_VARIABLE([--preserve-dup-deps])
-
-test -z "$PHP_COMPILE" && PHP_COMPILE='$(LIBTOOL) --mode=compile $(COMPILE) -c $<'
-test -z "$CXX_PHP_COMPILE" && CXX_PHP_COMPILE='$(LIBTOOL) --mode=compile $(CXX_COMPILE) -c $<'
-SHARED_LIBTOOL='$(LIBTOOL)'
-
-CC=$old_CC
-
-PHP_CONFIGURE_PART(Generating files)
-
-CXXFLAGS_CLEAN=$CXXFLAGS
-CFLAGS_CLEAN=$CFLAGS
-CFLAGS="\$(CFLAGS_CLEAN) $standard_libtool_flag"
-INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag"
-CXXFLAGS="$CXXFLAGS $standard_libtool_flag"
-
-all_targets='$(OVERALL_TARGET) $(PHP_MODULES) $(PHP_CLI_TARGET)'
-install_targets="install-sapi install-modules $install_pear install-build install-headers install-programs"
-if test "$PHP_SAPI" != "cgi"; then
- install_targets="$PHP_INSTALL_CLI_TARGET $install_targets"
-fi
-
-PHP_SUBST(all_targets)
-PHP_SUBST(install_targets)
-
-PHP_ADD_SOURCES(TSRM, TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c)
-
-PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c php_sprintf.c \
- safe_mode.c fopen_wrappers.c alloca.c php_scandir.c \
- php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
- strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \
- network.c php_open_temporary_file.c php_logos.c \
- output.c )
-
-PHP_ADD_SOURCES(main/streams, streams.c cast.c memory.c filter.c \
- plain_wrapper.c userspace.c transports.c xp_socket.c mmap.c)
-
-PHP_ADD_SOURCES(/main, internal_functions.c,, sapi)
-PHP_ADD_SOURCES(/main, internal_functions_cli.c,, cli)
-
-PHP_ADD_SOURCES(/Zend, zend_language_parser.c zend_language_scanner.c \
- zend_ini_parser.c zend_ini_scanner.c)
-
-PHP_ADD_SOURCES(Zend, \
- zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c \
- zend_execute_API.c zend_highlight.c zend_llist.c \
- zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
- zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
- zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
- zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c zend_stream.c zend_default_classes.c)
-
-if test -r "$abs_srcdir/Zend/zend_objects.c"; then
- PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c zend_mm.c)
-fi
-
-dnl Selectively disable optimization due to high RAM usage during
-dnl compiling the executor.
-if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
- flag=-O0
-else
- flag=
-fi
-
-PHP_ADD_SOURCES_X(Zend, zend_execute.c,,PHP_GLOBAL_OBJS,,$flag)
-
-PHP_ADD_BUILD_DIR(main)
-PHP_ADD_BUILD_DIR(regex)
-PHP_ADD_BUILD_DIR(sapi/$PHP_SAPI sapi/cli)
-PHP_ADD_BUILD_DIR(TSRM)
-PHP_ADD_BUILD_DIR(Zend)
-
-PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/scripts/Makefile.frag,$abs_srcdir/scripts,scripts)
-PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/pear/Makefile.frag,$abs_srcdir/pear,pear)
-PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Makefile.frag,$abs_srcdir/Zend,Zend)
-
-PHP_GEN_BUILD_DIRS
-PHP_GEN_GLOBAL_MAKEFILE
-
-AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ])
-
-$php_shtool mkdir -p pear/scripts
-$php_shtool mkdir -p scripts
-
-ALL_OUTPUT_FILES="php4.spec main/build-defs.h \
-scripts/phpize scripts/php-config \
-$PHP_OUTPUT_FILES"
-
-AC_OUTPUT($ALL_OUTPUT_FILES, [], [
-
-if test "\$CONFIG_FILES" = "$ALL_OUTPUT_FILES" || test "\$CONFIG_FILES" = " $ALL_OUTPUT_FILES" || test -z "\$CONFIG_FILES"; then
- REDO_ALL=yes
-fi
-
-if test ! -f $srcdir/ext/bcmath/number.c; then
- echo "creating number.c"
- echo "/* Dummy File */" > $srcdir/ext/bcmath/number.c
- echo "creating number.h"
- echo "/* Dummy File */" > $srcdir/ext/bcmath/number.h
-fi
-
-################################################################
-# Create configuration headers
-#
-
-test -d TSRM || $php_shtool mkdir TSRM
-echo '#include "../main/php_config.h"' > TSRM/tsrm_config.h
-
-test -d Zend || $php_shtool mkdir Zend
-
-cat >Zend/zend_config.h <<FEO
-#include "../main/php_config.h"
-#if defined(APACHE) && defined(PHP_API_VERSION)
-#undef HAVE_DLFCN_H
-#endif
-FEO
-
-# run this only when generating all the files?
-if test -n "\$REDO_ALL"; then
- # Hacking while airborne considered harmful.
- #
- echo "creating main/internal_functions.c"
- extensions="$EXT_STATIC"
-dnl mv -f main/internal_functions.c main/internal_functions.c.old 2>/dev/null
- sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" $AWK \$extensions > main/internal_functions.c
-
- echo "creating main/internal_functions_cli.c"
- cli_extensions="$EXT_CLI_STATIC"
- sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" $AWK \$cli_extensions > main/internal_functions_cli.c
-
-dnl if cmp main/internal_functions.c.old main/internal_functions.c > /dev/null 2>&1; then
-dnl echo "main/internal_functions.c is unchanged"
-dnl mv main/internal_functions.c.old main/internal_functions.c
-dnl else
-dnl rm -f main/internal_functions.c.old
-dnl fi
-
- if test "$UNAME" = "FreeBSD" && test "$PHP_SAPI" = "apache2filter" && test "$TSRM_PTH" != "pth-config" ; then
- echo "+--------------------------------------------------------------------+"
- echo "| *** WARNING *** |"
- echo "| |"
- echo "| In order to build PHP as a Apache2 module on FreeBSD, you have to |"
- echo "| add --with-tsrm-pth to your ./configure line. Therefore you need |"
- echo "| to install gnu-pth from /usr/ports/devel/pth. |"
- fi
-
- if test -n "$PHP_APXS_BROKEN"; then
- echo "+--------------------------------------------------------------------+"
- echo "| WARNING: Your $APXS script is most likely broken."
- echo "| |"
- echo "| Please go read http://www.php.net/faq.build#faq.build.apxs |"
- echo "| and make the changes described there and try again. |"
- fi
-
- # Warn about CGI version with no extra security options.
- if test "$PHP_SAPI" = "cgi"; then
- if test "$REDIRECT" = "0"; then
- if test "$DISCARD_PATH" = "0"; then
- echo "+--------------------------------------------------------------------+"
- echo "| *** WARNING *** |"
- echo "| |"
- echo "| You will be compiling the CGI version of PHP without any |"
- echo "| redirection checking. By putting this cgi binary somewhere in |"
- echo "| your web space, users may be able to circumvent existing .htaccess |"
- echo "| security by loading files directly through the parser. See |"
- echo "| http://www.php.net/manual/security.php for more details. |"
- fi
- fi
- fi
-
-
- if test -n "$DEBUG_LOG"; then
- rm -f config.cache
-cat <<X
-+--------------------------------------------------------------------+
-| *** ATTENTION *** |
-| |
-| Something is likely to be messed up here, because the configure |
-| script was not able to detect a simple feature on your platform. |
-| This is often caused by incorrect configuration parameters. Please |
-| see the file debug.log for error messages. |
-| |
-| If you are unable to fix this, send the file debug.log to the |
-| php-install@lists.php.net mailing list and include appropiate |
-| information about your setup. |
-X
- fi
-
- if test "$PHP_DB" != "no"; then
-cat <<X
-+--------------------------------------------------------------------+
-| *** WARNING *** |
-| |
-| You chose to compile PHP with DB extension. This extension is |
-| deprecated and does not support databse locking correctly. Please |
-| use DBA extension which is a fully operational superset. |
-X
- fi
-
- if test "$MYSQL_MODULE_TYPE" = "builtin" && test "$PHP_SAPI" != "cgi" && test "$PHP_SAPI" != "cli" && test "$php_multiple_shlib_versions_ok" != "yes"; then
-cat <<X
-+--------------------------------------------------------------------+
-| *** WARNING *** |
-| |
-| You chose to compile PHP with the built-in MySQL support. If you |
-| are compiling a server module, and intend to use other server |
-| modules that also use MySQL (e.g, mod_auth_mysql, PHP 3.0, |
-| mod_perl) you must NOT rely on PHP's built-in MySQL support, and |
-| instead build it with your local MySQL support files, by adding |
-| --with-mysql=/path/to/mysql to your configure line. |
-X
- fi
-
- # Warn about linking Apache with libpthread if oci8 extension is enabled on linux.
- if test "$PHP_OCI8" != "no" -o "$PHP_ORACLE" != "no"; then
- if test "$PHP_SAPI" = "apache"; then
- if test `uname` = "Linux"; then
-cat <<X
-+--------------------------------------------------------------------+
-| *** WARNING *** |
-| |
-| Please check that your Apache (httpd) is linked with libpthread. |
-| If not, you have to recompile Apache with pthread. For more |
-| details, see this page: http://www.php.net/manual/ref.oci8.php |
-X
- fi
- fi
-
- if test "$PHP_SIGCHILD" != "yes"; then
-cat <<X
-+--------------------------------------------------------------------+
-| Notice: |
-| If you encounter <defunc> processes when using a local Oracle-DB |
-| please recompile PHP and specify --enable-sigchild when configuring|
-| (This problem has been reported under Linux using Oracle >= 8.1.5) |
-X
- fi
- fi
-
-cat <<X
-+--------------------------------------------------------------------+
-| License: |
-| This software is subject to the PHP License, available in this |
-| distribution in the file LICENSE. By continuing this installation |
-| process, you are bound by the terms of this license agreement. |
-| If you do not agree with the terms of this license, you must abort |
-| the installation process at this point. |
-+--------------------------------------------------------------------+
-| *** NOTE *** |
-| The default for register_globals is now OFF! |
-| |
-| If your application relies on register_globals being ON, you |
-| should explicitly set it to on in your php.ini file. |
-| Note that you are strongly encouraged to read |
-| http://www.php.net/manual/en/security.registerglobals.php |
-| about the implications of having register_globals set to on, and |
-| avoid using it if possible. |
-+--------------------------------------------------------------------+
-
-Thank you for using PHP.
-
-X
-
-fi
-])
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/cvsclean b/cvsclean
deleted file mode 100755
index e98ec49b76..0000000000
--- a/cvsclean
+++ /dev/null
@@ -1,3 +0,0 @@
-#! /bin/sh
-
-${MAKE:-make} -f build/build.mk cvsclean
diff --git a/ext/bcmath/CREDITS b/ext/bcmath/CREDITS
deleted file mode 100644
index 7b4083ea13..0000000000
--- a/ext/bcmath/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-BC Math
-Andi Gutmans
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c
deleted file mode 100644
index 1799f0e64b..0000000000
--- a/ext/bcmath/bcmath.c
+++ /dev/null
@@ -1,557 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Andi Gutmans <andi@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if WITH_BCMATH
-
-#include "ext/standard/info.h"
-#include "php_bcmath.h"
-#include "libbcmath/src/bcmath.h"
-
-ZEND_DECLARE_MODULE_GLOBALS(bcmath);
-
-function_entry bcmath_functions[] = {
- PHP_FE(bcadd, NULL)
- PHP_FE(bcsub, NULL)
- PHP_FE(bcmul, NULL)
- PHP_FE(bcdiv, NULL)
- PHP_FE(bcmod, NULL)
- PHP_FE(bcpow, NULL)
- PHP_FE(bcsqrt, NULL)
- PHP_FE(bcscale, NULL)
- PHP_FE(bccomp, NULL)
- PHP_FE(bcpowmod, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry bcmath_module_entry = {
- STANDARD_MODULE_HEADER,
- "bcmath",
- bcmath_functions,
-#if ZTS
- PHP_MODULE_STARTUP_N(bcmath),
-#else
- NULL,
-#endif
- NULL,
- PHP_RINIT(bcmath),
- PHP_RSHUTDOWN(bcmath),
- PHP_MINFO(bcmath),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_BCMATH
-ZEND_GET_MODULE(bcmath)
-#endif
-
-#ifndef THREAD_SAFE
-static long bc_precision;
-#endif
-
-#if ZTS
-PHP_MODULE_STARTUP_D(bcmath)
-{
- zend_bcmath_globals *bcmath_globals;
-
- ts_allocate_id(&bcmath_globals_id, sizeof(zend_bcmath_globals), NULL, NULL);
- bcmath_globals = ts_resource(bcmath_globals_id);
- return SUCCESS;
-}
-#endif
-
-PHP_RSHUTDOWN_FUNCTION(bcmath)
-{
- bc_free_num(&BCG(_zero_));
- bc_free_num(&BCG(_one_));
- bc_free_num(&BCG(_two_));
-
- return SUCCESS;
-}
-
-
-PHP_RINIT_FUNCTION(bcmath)
-{
- if (cfg_get_long("bcmath.scale", &bc_precision) == FAILURE) {
- bc_precision = 0;
- }
-
- if (bc_precision < 0) {
- bc_precision = 0;
- }
-
- bc_init_numbers(TSRMLS_C);
-
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(bcmath)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "BCMath support", "enabled");
- php_info_print_table_end();
-}
-
-/* {{{ php_str2num
- Convert to bc_num detecting scale */
-static void php_str2num(bc_num *num, char *str TSRMLS_DC)
-{
- char *p;
-
- if (!(p = strchr(str, '.'))) {
- bc_str2num(num, str, 0 TSRMLS_CC);
- return;
- }
-
- bc_str2num(num, str, strlen(p+1) TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto string bcadd(string left_operand, string right_operand [, int scale])
- Returns the sum of two arbitrary precision numbers */
-PHP_FUNCTION(bcadd)
-{
- zval **left, **right, **scale_param;
- bc_num first, second, result;
- int scale = bc_precision;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scale_param);
- scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(left);
- convert_to_string_ex(right);
- bc_init_num(&first TSRMLS_CC);
- bc_init_num(&second TSRMLS_CC);
- bc_init_num(&result TSRMLS_CC);
- php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
- php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
- bc_add (first, second, &result, scale);
- if (result->n_scale > scale) {
- result->n_scale = scale;
- }
- Z_STRVAL_P(return_value) = bc_num2str(result);
- Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- bc_free_num(&first);
- bc_free_num(&second);
- bc_free_num(&result);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bcsub(string left_operand, string right_operand [, int scale])
- Returns the difference between two arbitrary precision numbers */
-PHP_FUNCTION(bcsub)
-{
- zval **left, **right, **scale_param;
- bc_num first, second, result;
- int scale = bc_precision;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scale_param);
- scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(left);
- convert_to_string_ex(right);
- bc_init_num(&first TSRMLS_CC);
- bc_init_num(&second TSRMLS_CC);
- bc_init_num(&result TSRMLS_CC);
- php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
- php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
- bc_sub (first, second, &result, scale);
- if (result->n_scale > scale) {
- result->n_scale = scale;
- }
- Z_STRVAL_P(return_value) = bc_num2str(result);
- Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- bc_free_num(&first);
- bc_free_num(&second);
- bc_free_num(&result);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bcmul(string left_operand, string right_operand [, int scale])
- Returns the multiplication of two arbitrary precision numbers */
-PHP_FUNCTION(bcmul)
-{
- zval **left, **right, **scale_param;
- bc_num first, second, result;
- int scale = bc_precision;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scale_param);
- scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(left);
- convert_to_string_ex(right);
- bc_init_num(&first TSRMLS_CC);
- bc_init_num(&second TSRMLS_CC);
- bc_init_num(&result TSRMLS_CC);
- php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
- php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
- bc_multiply (first, second, &result, scale TSRMLS_CC);
- if (result->n_scale > scale) {
- result->n_scale = scale;
- }
- Z_STRVAL_P(return_value) = bc_num2str(result);
- Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- bc_free_num(&first);
- bc_free_num(&second);
- bc_free_num(&result);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bcdiv(string left_operand, string right_operand [, int scale])
- Returns the quotient of two arbitrary precision numbers (division) */
-PHP_FUNCTION(bcdiv)
-{
- zval **left, **right, **scale_param;
- bc_num first, second, result;
- int scale = bc_precision;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scale_param);
- scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(left);
- convert_to_string_ex(right);
- bc_init_num(&first TSRMLS_CC);
- bc_init_num(&second TSRMLS_CC);
- bc_init_num(&result TSRMLS_CC);
- php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
- php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
- switch (bc_divide(first, second, &result, scale TSRMLS_CC)) {
- case 0: /* OK */
- if (result->n_scale > scale) {
- result->n_scale = scale;
- }
- Z_STRVAL_P(return_value) = bc_num2str(result);
- Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- break;
- case -1: /* division by zero */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Division by zero");
- break;
- }
- bc_free_num(&first);
- bc_free_num(&second);
- bc_free_num(&result);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bcmod(string left_operand, string right_operand)
- Returns the modulus of the two arbitrary precision operands */
-PHP_FUNCTION(bcmod)
-{
- zval **left, **right;
- bc_num first, second, result;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(left);
- convert_to_string_ex(right);
- bc_init_num(&first TSRMLS_CC);
- bc_init_num(&second TSRMLS_CC);
- bc_init_num(&result TSRMLS_CC);
- bc_str2num(&first, Z_STRVAL_PP(left), 0 TSRMLS_CC);
- bc_str2num(&second, Z_STRVAL_PP(right), 0 TSRMLS_CC);
- switch (bc_modulo(first, second, &result, 0 TSRMLS_CC)) {
- case 0:
- Z_STRVAL_P(return_value) = bc_num2str(result);
- Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- break;
- case -1:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Division by zero");
- break;
- }
- bc_free_num(&first);
- bc_free_num(&second);
- bc_free_num(&result);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bcpowmod(string x, string y, string mod [, int scale])
- Returns the value of an arbitrary precision number raised to the power of another reduced by a modulous */
-PHP_FUNCTION(bcpowmod)
-{
- char *left, *right, *modulous;
- int left_len, right_len, modulous_len;
- bc_num first, second, mod, result;
- int scale = bc_precision;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|l", &left, &left_len, &right, &right_len, &modulous, &modulous_len, &scale) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- bc_init_num(&first TSRMLS_CC);
- bc_init_num(&second TSRMLS_CC);
- bc_init_num(&mod TSRMLS_CC);
- bc_init_num(&result TSRMLS_CC);
- php_str2num(&first, left TSRMLS_CC);
- php_str2num(&second, right TSRMLS_CC);
- php_str2num(&mod, modulous TSRMLS_CC);
- bc_raisemod(first, second, mod, &result, scale TSRMLS_CC);
- if (result->n_scale > scale) {
- result->n_scale = scale;
- }
- Z_STRVAL_P(return_value) = bc_num2str(result);
- Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- bc_free_num(&first);
- bc_free_num(&second);
- bc_free_num(&mod);
- bc_free_num(&result);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bcpow(string x, string y [, int scale])
- Returns the value of an arbitrary precision number raised to the power of another */
-PHP_FUNCTION(bcpow)
-{
- zval **left, **right, **scale_param;
- bc_num first, second, result;
- int scale = bc_precision;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scale_param);
- scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(left);
- convert_to_string_ex(right);
- bc_init_num(&first TSRMLS_CC);
- bc_init_num(&second TSRMLS_CC);
- bc_init_num(&result TSRMLS_CC);
- php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
- php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
- bc_raise (first, second, &result, scale TSRMLS_CC);
- if (result->n_scale > scale) {
- result->n_scale = scale;
- }
- Z_STRVAL_P(return_value) = bc_num2str(result);
- Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- bc_free_num(&first);
- bc_free_num(&second);
- bc_free_num(&result);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bcsqrt(string operand [, int scale])
- Returns the square root of an arbitray precision number */
-PHP_FUNCTION(bcsqrt)
-{
- zval **left, **scale_param;
- bc_num result;
- int scale = bc_precision;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &left) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &left, &scale_param) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scale_param);
- scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(left);
- bc_init_num(&result TSRMLS_CC);
- php_str2num(&result, Z_STRVAL_PP(left) TSRMLS_CC);
- if (bc_sqrt (&result, scale TSRMLS_CC) != 0) {
- if (result->n_scale > scale) {
- result->n_scale = scale;
- }
- Z_STRVAL_P(return_value) = bc_num2str(result);
- Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Square root of negative number");
- }
- bc_free_num(&result);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bccomp(string left_operand, string right_operand [, int scale])
- Compares two arbitrary precision numbers */
-PHP_FUNCTION(bccomp)
-{
- zval **left, **right, **scale_param;
- bc_num first, second;
- int scale = bc_precision;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &left, &right) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &left, &right, &scale_param) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scale_param);
- scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string_ex(left);
- convert_to_string_ex(right);
- bc_init_num(&first TSRMLS_CC);
- bc_init_num(&second TSRMLS_CC);
-
- bc_str2num(&first, Z_STRVAL_PP(left), scale TSRMLS_CC);
- bc_str2num(&second, Z_STRVAL_PP(right), scale TSRMLS_CC);
- Z_LVAL_P(return_value) = bc_compare(first, second);
- Z_TYPE_P(return_value) = IS_LONG;
-
- bc_free_num(&first);
- bc_free_num(&second);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bcscale(int scale)
- Sets default scale parameter for all bc math functions */
-PHP_FUNCTION(bcscale)
-{
- zval **new_scale;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &new_scale) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(new_scale);
- bc_precision = (Z_LVAL_PP(new_scale) < 0) ? 0 : Z_LVAL_PP(new_scale);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/bcmath/config.m4 b/ext/bcmath/config.m4
deleted file mode 100644
index 0e008e736d..0000000000
--- a/ext/bcmath/config.m4
+++ /dev/null
@@ -1,17 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(bcmath, whether to enable bc style precision math functions,
-[ --enable-bcmath Enable bc style precision math functions.])
-
-if test "$PHP_BCMATH" != "no"; then
- AC_DEFINE(WITH_BCMATH, 1, [Whether you have bcmath])
- PHP_NEW_EXTENSION(bcmath, bcmath.c \
-libbcmath/src/add.c libbcmath/src/div.c libbcmath/src/init.c libbcmath/src/neg.c libbcmath/src/outofmem.c libbcmath/src/raisemod.c libbcmath/src/rt.c libbcmath/src/sub.c \
-libbcmath/src/compare.c libbcmath/src/divmod.c libbcmath/src/int2num.c libbcmath/src/num2long.c libbcmath/src/output.c libbcmath/src/recmul.c \
-libbcmath/src/sqrt.c libbcmath/src/zero.c libbcmath/src/debug.c libbcmath/src/doaddsub.c libbcmath/src/nearzero.c libbcmath/src/num2str.c libbcmath/src/raise.c \
-libbcmath/src/rmzero.c libbcmath/src/str2num.c,
- $ext_shared,,-I@ext_srcdir@/libbcmath/src)
- PHP_ADD_BUILD_DIR($ext_builddir/libbcmath/src)
-fi
diff --git a/ext/bcmath/libbcmath/AUTHORS b/ext/bcmath/libbcmath/AUTHORS
deleted file mode 100644
index 982db9dc40..0000000000
--- a/ext/bcmath/libbcmath/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-Phil Nelson <philnelson@acm.org> wrote bcmath library.
-
-
diff --git a/ext/bcmath/libbcmath/COPYING.LIB b/ext/bcmath/libbcmath/COPYING.LIB
deleted file mode 100644
index c4792dd27a..0000000000
--- a/ext/bcmath/libbcmath/COPYING.LIB
+++ /dev/null
@@ -1,515 +0,0 @@
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations
-below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-^L
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it
-becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-^L
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control
-compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-^L
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-^L
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-^L
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-^L
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply, and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License
-may add an explicit geographical distribution limitation excluding those
-countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-^L
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-^L
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms
-of the ordinary General Public License).
-
- To apply these terms, attach the following notices to the library.
-It is safest to attach them to the start of each source file to most
-effectively convey the exclusion of warranty; and each file should
-have at least the "copyright" line and a pointer to where the full
-notice is found.
-
-
- <one line to give the library's name and a brief idea of what it
-does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper
-mail.
-
-You should also get your employer (if you work as a programmer) or
-your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James
-Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/ext/bcmath/libbcmath/ChangeLog b/ext/bcmath/libbcmath/ChangeLog
deleted file mode 100644
index b8d459a2bb..0000000000
--- a/ext/bcmath/libbcmath/ChangeLog
+++ /dev/null
@@ -1,10 +0,0 @@
-Wed Jun 7 09:39:02 2000 Phil Nelson <phil@cs.wwu.edu>
-
- * configure.in and many others: version number now at 0.2.
- Many other changes/additions for getting a distribution
- to work.
-
-2000-05-21 Phil Nelson <phil@cs.wwu.edu>
-
- * Initial setup of bcmath library., calling it version 0.1.
-
diff --git a/ext/bcmath/libbcmath/FAQ b/ext/bcmath/libbcmath/FAQ
deleted file mode 100644
index 6499b1cffb..0000000000
--- a/ext/bcmath/libbcmath/FAQ
+++ /dev/null
@@ -1,21 +0,0 @@
-BCMATH FAQ:
-
-1) Why BCMATH?
-
-The math routines of GNU bc become more generally useful in a
-library form. By separating the BCMATH library from GNU bc,
-GNU bc can be under the GPL and BCMATH can be under the LGPL.
-
-2) Why BCMATH when GMP exists?
-
-GMP has "integers" (no digits after a decimal), "rational numbers"
-(stored as 2 integers) and "floats". None of these will correctly
-represent a POSIX BC number. Floats are the closest, but will not
-behave correctly for many computations. For example, BC numbers have
-a "scale" that represent the number of digits to represent after the
-decimal point. The multiplying two of these numbers requires one to
-calculate an exact number of digits after the decimal point regardless
-of the number of digits in the integer part. GMP floats have a
-"fixed, but arbitrary" mantissa and so multiplying two floats will end
-up dropping digits BC must calculate.
-
diff --git a/ext/bcmath/libbcmath/INSTALL b/ext/bcmath/libbcmath/INSTALL
deleted file mode 100644
index 8893a07827..0000000000
--- a/ext/bcmath/libbcmath/INSTALL
+++ /dev/null
@@ -1,9 +0,0 @@
-Currently, only libbcmath.a is built. To build and install it, do
-
- configure
- make
- make install
-
-Typical configure parameters are available. (e.g. PREFIX)
-
-Bugs and comments to philnelson@acm.org.
diff --git a/ext/bcmath/libbcmath/Makefile.am b/ext/bcmath/libbcmath/Makefile.am
deleted file mode 100644
index e5be8201b3..0000000000
--- a/ext/bcmath/libbcmath/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS= src doc
-
-MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in \
- stamp-h.in *~
-
-dist-hook:
- cp $(srcdir)/doc/bcmath.1 $(distdir)/doc
- cp $(srcdir)/src/private.h $(distdir)/src
- cp $(srcdir)/FAQ $(distdir)
-
diff --git a/ext/bcmath/libbcmath/NEWS b/ext/bcmath/libbcmath/NEWS
deleted file mode 100644
index 431d7b315d..0000000000
--- a/ext/bcmath/libbcmath/NEWS
+++ /dev/null
@@ -1,3 +0,0 @@
-NEWS for bcmath library:
-
- May 2000: The library is created.
diff --git a/ext/bcmath/libbcmath/README b/ext/bcmath/libbcmath/README
deleted file mode 100644
index cae5e5dc43..0000000000
--- a/ext/bcmath/libbcmath/README
+++ /dev/null
@@ -1,9 +0,0 @@
-This is bcmath, a library of arbitrary precision math routines.
-These routines, in a different form, are the routines that to
-the arbitrary precision calculations for GNU bc and GNU dc.
-
-This library is provided to make these routines useful in a
-larger context with less restrictions on the use of them.
-
-These routines do not duplicate functionality of the GNU gmp
-library. gmp is similar, but the actual computation is different.
diff --git a/ext/bcmath/libbcmath/acconfig.h b/ext/bcmath/libbcmath/acconfig.h
deleted file mode 100644
index 4d301dcacf..0000000000
--- a/ext/bcmath/libbcmath/acconfig.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* PACKAGE name */
-#undef PACKAGE
-
-/* Package VERSION number */
-#undef VERSION
-
-/* Define to `size_t' if <sys/types.h> and <stddef.h> don't define. */
-#undef ptrdiff_t
-
diff --git a/ext/bcmath/libbcmath/aclocal.m4 b/ext/bcmath/libbcmath/aclocal.m4
deleted file mode 100644
index f23ba2904e..0000000000
--- a/ext/bcmath/libbcmath/aclocal.m4
+++ /dev/null
@@ -1,127 +0,0 @@
-dnl aclocal.m4 generated automatically by aclocal 1.4
-
-dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-dnl PARTICULAR PURPOSE.
-
-# Do all the work for Automake. This macro actually does too much --
-# some checks are only needed if your package does certain things.
-# But this isn't really a big deal.
-
-# serial 1
-
-dnl Usage:
-dnl AM_INIT_AUTOMAKE(package,version, [no-define])
-
-AC_DEFUN(AM_INIT_AUTOMAKE,
-[AC_REQUIRE([AC_PROG_INSTALL])
-PACKAGE=[$1]
-AC_SUBST(PACKAGE)
-VERSION=[$2]
-AC_SUBST(VERSION)
-dnl test to see if srcdir already configured
-if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
- AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
-fi
-ifelse([$3],,
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
-AC_REQUIRE([AM_SANITY_CHECK])
-AC_REQUIRE([AC_ARG_PROGRAM])
-dnl FIXME This is truly gross.
-missing_dir=`cd $ac_aux_dir && pwd`
-AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
-AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
-AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
-AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
-AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
-AC_REQUIRE([AC_PROG_MAKE_SET])])
-
-#
-# Check to make sure that the build environment is sane.
-#
-
-AC_DEFUN(AM_SANITY_CHECK,
-[AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftestfile
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments. Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
- set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
- if test "[$]*" = "X"; then
- # -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
- fi
- if test "[$]*" != "X $srcdir/configure conftestfile" \
- && test "[$]*" != "X conftestfile $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
-alias in your environment])
- fi
-
- test "[$]2" = conftestfile
- )
-then
- # Ok.
- :
-else
- AC_MSG_ERROR([newly created file is older than distributed files!
-Check your system clock])
-fi
-rm -f conftest*
-AC_MSG_RESULT(yes)])
-
-dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
-dnl The program must properly implement --version.
-AC_DEFUN(AM_MISSING_PROG,
-[AC_MSG_CHECKING(for working $2)
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if ($2 --version) < /dev/null > /dev/null 2>&1; then
- $1=$2
- AC_MSG_RESULT(found)
-else
- $1="$3/missing $2"
- AC_MSG_RESULT(missing)
-fi
-AC_SUBST($1)])
-
-# Like AC_CONFIG_HEADER, but automatically create stamp file.
-
-AC_DEFUN(AM_CONFIG_HEADER,
-[AC_PREREQ([2.12])
-AC_CONFIG_HEADER([$1])
-dnl When config.status generates a header, we must update the stamp-h file.
-dnl This file resides in the same directory as the config header
-dnl that is generated. We must strip everything past the first ":",
-dnl and everything past the last "/".
-AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
-ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
-<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
-<<am_indx=1
-for am_file in <<$1>>; do
- case " <<$>>CONFIG_HEADERS " in
- *" <<$>>am_file "*<<)>>
- echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
- ;;
- esac
- am_indx=`expr "<<$>>am_indx" + 1`
-done<<>>dnl>>)
-changequote([,]))])
-
diff --git a/ext/bcmath/libbcmath/config.h.in b/ext/bcmath/libbcmath/config.h.in
deleted file mode 100644
index 21cfb9255f..0000000000
--- a/ext/bcmath/libbcmath/config.h.in
+++ /dev/null
@@ -1,41 +0,0 @@
-/* config.h.in. Generated automatically from configure.in by autoheader. */
-
-/* Define to empty if the keyword does not work. */
-#undef const
-
-/* Define to `unsigned' if <sys/types.h> doesn't define. */
-#undef size_t
-
-/* Define if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define to `size_t' if <sys/types.h> and <stddef.h> don't define. */
-#undef ptrdiff_t
-
-/* Define if you have the <lib.h> header file. */
-#undef HAVE_LIB_H
-
-/* Define if you have the <limits.h> header file. */
-#undef HAVE_LIMITS_H
-
-/* Define if you have the <stdarg.h> header file. */
-#undef HAVE_STDARG_H
-
-/* Define if you have the <stddef.h> header file. */
-#undef HAVE_STDDEF_H
-
-/* Define if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Name of package */
-#undef PACKAGE
-
-/* Version number of package */
-#undef VERSION
-
diff --git a/ext/bcmath/libbcmath/configure b/ext/bcmath/libbcmath/configure
deleted file mode 100644
index 026fd039c7..0000000000
--- a/ext/bcmath/libbcmath/configure
+++ /dev/null
@@ -1,1859 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-for ac_option
-do
-
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$ac_optarg" ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file="$ac_optarg" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he)
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --program-prefix=PREFIX prepend PREFIX to installed program names
- --program-suffix=SUFFIX append SUFFIX to installed program names
- --program-transform-name=PROGRAM
- run sed PROGRAM on installed program names
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir="$ac_optarg" ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir="$ac_optarg" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix="$ac_optarg" ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix="$ac_optarg" ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir="$ac_optarg" ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=no" ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes="$ac_optarg" ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries="$ac_optarg" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=doc/bcmath.1
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:556: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:609: checking whether build environment is sane" >&5
-# Just in case
-sleep 1
-echo timestamp > conftestfile
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments. Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
- set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
- if test "$*" = "X"; then
- # -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
- fi
- if test "$*" != "X $srcdir/configure conftestfile" \
- && test "$*" != "X conftestfile $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- { echo "configure: error: ls -t appears to fail. Make sure there is not a broken
-alias in your environment" 1>&2; exit 1; }
- fi
-
- test "$2" = conftestfile
- )
-then
- # Ok.
- :
-else
- { echo "configure: error: newly created file is older than distributed files!
-Check your system clock" 1>&2; exit 1; }
-fi
-rm -f conftest*
-echo "$ac_t""yes" 1>&6
-if test "$program_transform_name" = s,x,x,; then
- program_transform_name=
-else
- # Double any \ or $. echo might interpret backslashes.
- cat <<\EOF_SED > conftestsed
-s,\\,\\\\,g; s,\$,$$,g
-EOF_SED
- program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
- rm -f conftestsed
-fi
-test "$program_prefix" != NONE &&
- program_transform_name="s,^,${program_prefix},; $program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
- program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
-
-# sed with no file args requires a program.
-test "$program_transform_name" = "" && program_transform_name="s,x,x,"
-
-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:666: checking whether ${MAKE-make} sets \${MAKE}" >&5
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftestmake <<\EOF
-all:
- @echo 'ac_maketemp="${MAKE}"'
-EOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
- eval ac_cv_prog_make_${ac_make}_set=yes
-else
- eval ac_cv_prog_make_${ac_make}_set=no
-fi
-rm -f conftestmake
-fi
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- SET_MAKE=
-else
- echo "$ac_t""no" 1>&6
- SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-
-PACKAGE="bcmath"
-
-VERSION="0.2"
-
-if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
- { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
-fi
-cat >> confdefs.h <<EOF
-#define PACKAGE "$PACKAGE"
-EOF
-
-cat >> confdefs.h <<EOF
-#define VERSION "$VERSION"
-EOF
-
-
-
-missing_dir=`cd $ac_aux_dir && pwd`
-echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:712: checking for working aclocal" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (aclocal --version) < /dev/null > /dev/null 2>&1; then
- ACLOCAL=aclocal
- echo "$ac_t""found" 1>&6
-else
- ACLOCAL="$missing_dir/missing aclocal"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:725: checking for working autoconf" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (autoconf --version) < /dev/null > /dev/null 2>&1; then
- AUTOCONF=autoconf
- echo "$ac_t""found" 1>&6
-else
- AUTOCONF="$missing_dir/missing autoconf"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:738: checking for working automake" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (automake --version) < /dev/null > /dev/null 2>&1; then
- AUTOMAKE=automake
- echo "$ac_t""found" 1>&6
-else
- AUTOMAKE="$missing_dir/missing automake"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:751: checking for working autoheader" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (autoheader --version) < /dev/null > /dev/null 2>&1; then
- AUTOHEADER=autoheader
- echo "$ac_t""found" 1>&6
-else
- AUTOHEADER="$missing_dir/missing autoheader"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:764: checking for working makeinfo" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
- MAKEINFO=makeinfo
- echo "$ac_t""found" 1>&6
-else
- MAKEINFO="$missing_dir/missing makeinfo"
- echo "$ac_t""missing" 1>&6
-fi
-
-
-
-
-
-
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:784: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:814: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:865: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
- ;;
- esac
- fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:897: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 908 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:939: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:944: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:953: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-else
- GCC=
-fi
-
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:972: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1016: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-# Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1071: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1099: checking whether ${MAKE-make} sets \${MAKE}" >&5
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftestmake <<\EOF
-all:
- @echo 'ac_maketemp="${MAKE}"'
-EOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
- eval ac_cv_prog_make_${ac_make}_set=yes
-else
- eval ac_cv_prog_make_${ac_make}_set=no
-fi
-rm -f conftestmake
-fi
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- SET_MAKE=
-else
- echo "$ac_t""no" 1>&6
- SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1127: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 1142 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1148: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 1159 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1165: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -nologo -E"
- cat > conftest.$ac_ext <<EOF
-#line 1176 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
-fi
- CPP="$ac_cv_prog_CPP"
-else
- ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
-for ac_hdr in stdarg.h stddef.h stdlib.h string.h limits.h unistd.h lib.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1210: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1215 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1220: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1247: checking for working const" >&5
-if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1252 "configure"
-#include "confdefs.h"
-
-int main() {
-
-/* Ultrix mips cc rejects this. */
-typedef int charset[2]; const charset x;
-/* SunOS 4.1.1 cc rejects this. */
-char const *const *ccp;
-char **p;
-/* NEC SVR4.0.2 mips cc rejects this. */
-struct point {int x, y;};
-static struct point const zero = {0,0};
-/* AIX XL C 1.02.0.0 rejects this.
- It does not let you subtract one const X* pointer from another in an arm
- of an if-expression whose if-part is not a constant expression */
-const char *g = "string";
-ccp = &g + (g ? g-g : 0);
-/* HPUX 7.0 cc rejects these. */
-++ccp;
-p = (char**) ccp;
-ccp = (char const *const *) p;
-{ /* SCO 3.2v4 cc rejects this. */
- char *t;
- char const *s = 0 ? (char *) 0 : (char const *) 0;
-
- *t++ = 0;
-}
-{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
- int x[] = {25, 17};
- const int *foo = &x[0];
- ++foo;
-}
-{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
- typedef const int *iptr;
- iptr p = 0;
- ++p;
-}
-{ /* AIX XL C 1.02.0.0 rejects this saying
- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; };
- struct s *b; b->j = 5;
-}
-{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
- const int foo = 10;
-}
-
-; return 0; }
-EOF
-if { (eval echo configure:1301: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_c_const=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_c_const=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_c_const" 1>&6
-if test $ac_cv_c_const = no; then
- cat >> confdefs.h <<\EOF
-#define const
-EOF
-
-fi
-
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1322: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1327 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- ac_cv_header_stdc=yes
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1352 "configure"
-#include "confdefs.h"
-#include <string.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1370 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-if test "$cross_compiling" = yes; then
- :
-else
- cat > conftest.$ac_ext <<EOF
-#line 1391 "configure"
-#include "confdefs.h"
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
-
-EOF
-if { (eval echo configure:1402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- :
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_header_stdc=no
-fi
-rm -fr conftest*
-fi
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
-if test $ac_cv_header_stdc = yes; then
- cat >> confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
-
-fi
-
-echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1426: checking for size_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1431 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_size_t=yes
-else
- rm -rf conftest*
- ac_cv_type_size_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_size_t" 1>&6
-if test $ac_cv_type_size_t = no; then
- cat >> confdefs.h <<\EOF
-#define size_t unsigned
-EOF
-
-fi
-
-echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6
-echo "configure:1459: checking for ptrdiff_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_ptrdiff_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1464 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])ptrdiff_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_ptrdiff_t=yes
-else
- rm -rf conftest*
- ac_cv_type_ptrdiff_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_ptrdiff_t" 1>&6
-if test $ac_cv_type_ptrdiff_t = no; then
- cat >> confdefs.h <<\EOF
-#define ptrdiff_t size_t
-EOF
-
-fi
-
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-DEFS=-DHAVE_CONFIG_H
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "Makefile src/Makefile doc/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@PACKAGE@%$PACKAGE%g
-s%@VERSION@%$VERSION%g
-s%@ACLOCAL@%$ACLOCAL%g
-s%@AUTOCONF@%$AUTOCONF%g
-s%@AUTOMAKE@%$AUTOMAKE%g
-s%@AUTOHEADER@%$AUTOHEADER%g
-s%@MAKEINFO@%$MAKEINFO%g
-s%@SET_MAKE@%$SET_MAKE%g
-s%@CC@%$CC%g
-s%@RANLIB@%$RANLIB%g
-s%@CPP@%$CPP%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile src/Makefile doc/Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
-ac_dC='\3'
-ac_dD='%g'
-# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
-ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_uB='\([ ]\)%\1#\2define\3'
-ac_uC=' '
-ac_uD='\4%g'
-# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_eB='$%\1#\2define\3'
-ac_eC=' '
-ac_eD='%g'
-
-if test "${CONFIG_HEADERS+set}" != set; then
-EOF
-cat >> $CONFIG_STATUS <<EOF
- CONFIG_HEADERS="config.h"
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-fi
-for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- echo creating $ac_file
-
- rm -f conftest.frag conftest.in conftest.out
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- cat $ac_file_inputs > conftest.in
-
-EOF
-
-# Transform confdefs.h into a sed script conftest.vals that substitutes
-# the proper values into config.h.in to produce config.h. And first:
-# Protect against being on the right side of a sed subst in config.status.
-# Protect against being in an unquoted here document in config.status.
-rm -f conftest.vals
-cat > conftest.hdr <<\EOF
-s/[\\&%]/\\&/g
-s%[\\$`]%\\&%g
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
-s%ac_d%ac_u%gp
-s%ac_u%ac_e%gp
-EOF
-sed -n -f conftest.hdr confdefs.h > conftest.vals
-rm -f conftest.hdr
-
-# This sed command replaces #undef with comments. This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-cat >> conftest.vals <<\EOF
-s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
-EOF
-
-# Break up conftest.vals because some shells have a limit on
-# the size of here documents, and old seds have small limits too.
-
-rm -f conftest.tail
-while :
-do
- ac_lines=`grep -c . conftest.vals`
- # grep -c gives empty output for an empty file on some AIX systems.
- if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
- # Write a limited-size here document to conftest.frag.
- echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
- echo 'CEOF
- sed -f conftest.frag conftest.in > conftest.out
- rm -f conftest.in
- mv conftest.out conftest.in
-' >> $CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
- rm -f conftest.vals
- mv conftest.tail conftest.vals
-done
-rm -f conftest.vals
-
-cat >> $CONFIG_STATUS <<\EOF
- rm -f conftest.frag conftest.h
- echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
- cat conftest.in >> conftest.h
- rm -f conftest.in
- if cmp -s $ac_file conftest.h 2>/dev/null; then
- echo "$ac_file is unchanged"
- rm -f conftest.h
- else
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- fi
- rm -f $ac_file
- mv conftest.h $ac_file
- fi
-fi; done
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
-
diff --git a/ext/bcmath/libbcmath/configure.in b/ext/bcmath/libbcmath/configure.in
deleted file mode 100644
index 3da89e949f..0000000000
--- a/ext/bcmath/libbcmath/configure.in
+++ /dev/null
@@ -1,18 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(doc/bcmath.1)
-AM_INIT_AUTOMAKE("bcmath", "0.2")
-AM_CONFIG_HEADER(config.h)
-
-AC_PROG_CC
-
-AC_PROG_INSTALL
-AC_PROG_RANLIB
-AC_PROG_MAKE_SET
-
-AC_CHECK_HEADERS(stdarg.h stddef.h stdlib.h string.h limits.h unistd.h lib.h)
-AC_C_CONST
-AC_TYPE_SIZE_T
-AC_CHECK_TYPE(ptrdiff_t, size_t)
-
-AC_OUTPUT(Makefile src/Makefile doc/Makefile)
-
diff --git a/ext/bcmath/libbcmath/install-sh b/ext/bcmath/libbcmath/install-sh
deleted file mode 100644
index ab74c882e9..0000000000
--- a/ext/bcmath/libbcmath/install-sh
+++ /dev/null
@@ -1,238 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-tranformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/ext/bcmath/libbcmath/missing b/ext/bcmath/libbcmath/missing
deleted file mode 100644
index e4b838ca92..0000000000
--- a/ext/bcmath/libbcmath/missing
+++ /dev/null
@@ -1,134 +0,0 @@
-#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-if test $# -eq 0; then
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
-fi
-
-case "$1" in
-
- -h|--h|--he|--hel|--help)
- echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
-
-Options:
- -h, --help display this help and exit
- -v, --version output version information and exit
-
-Supported PROGRAM values:
- aclocal touch file \`aclocal.m4'
- autoconf touch file \`configure'
- autoheader touch file \`config.h.in'
- automake touch all \`Makefile.in' files
- bison touch file \`y.tab.c'
- makeinfo touch the output file
- yacc touch file \`y.tab.c'"
- ;;
-
- -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
- echo "missing - GNU libit 0.0"
- ;;
-
- -*)
- echo 1>&2 "$0: Unknown \`$1' option"
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
- ;;
-
- aclocal)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`acinclude.m4' or \`configure.in'. You might want
- to install the \`Automake' and \`Perl' packages. Grab them from
- any GNU archive site."
- touch aclocal.m4
- ;;
-
- autoconf)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`configure.in'. You might want to install the
- \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
- archive site."
- touch configure
- ;;
-
- autoheader)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`acconfig.h' or \`configure.in'. You might want
- to install the \`Autoconf' and \`GNU m4' packages. Grab them
- from any GNU archive site."
- touch config.h.in
- ;;
-
- automake)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
- You might want to install the \`Automake' and \`Perl' packages.
- Grab them from any GNU archive site."
- find . -type f -name Makefile.am -print \
- | sed 's/^\(.*\).am$/touch \1.in/' \
- | sh
- ;;
-
- bison|yacc)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- your modified any \`.y' file. For being effective, your
- modifications might require the \`Bison' package. Grab it from
- any GNU archive site."
- touch y.tab.c
- ;;
-
- makeinfo)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified a \`.texi' or \`.texinfo' file, or any other file
- indirectly affecting the aspect of the manual. The spurious
- call might also be the consequence of using a buggy \`make' (AIX,
- DU, IRIX). You might want to install the \`Texinfo' package or
- the \`GNU make' package. Grab either from any GNU archive site."
- file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
- if test -z "$file"; then
- file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
- file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
- fi
- touch $file
- ;;
-
- *)
- echo 1>&2 "\
-WARNING: \`$1' is needed, and you do not seem to have it handy on your
- system. You might have modified some files without having the
- proper tools for further handling them. Check the \`README' file,
- it often tells you about the needed prerequirements for installing
- this package. You may also peek at any GNU archive site, in case
- some other package would contain this missing \`$1' program."
- exit 1
- ;;
-esac
-
-exit 0
diff --git a/ext/bcmath/libbcmath/mkinstalldirs b/ext/bcmath/libbcmath/mkinstalldirs
deleted file mode 100644
index cc8783edce..0000000000
--- a/ext/bcmath/libbcmath/mkinstalldirs
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /bin/sh
-# mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
-# Created: 1993-05-16
-# Last modified: 1994-03-25
-# Public domain
-
-errstatus=0
-
-for file in ${1+"$@"} ; do
- set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
- shift
-
- pathcomp=
- for d in ${1+"$@"} ; do
- pathcomp="$pathcomp$d"
- case "$pathcomp" in
- -* ) pathcomp=./$pathcomp ;;
- esac
-
- if test ! -d "$pathcomp"; then
- echo "mkdir $pathcomp" 1>&2
- mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
- fi
-
- if test ! -d "$pathcomp"; then
- errstatus=$lasterr
- fi
-
- pathcomp="$pathcomp/"
- done
-done
-
-exit $errstatus
-
-# mkinstalldirs ends here
diff --git a/ext/bcmath/libbcmath/src/Makefile.am b/ext/bcmath/libbcmath/src/Makefile.am
deleted file mode 100644
index fab37d785e..0000000000
--- a/ext/bcmath/libbcmath/src/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-# Makefile for bcmath library
-
-lib_LIBRARIES = libbcmath.a
-
-include_HEADERS = bcmath.h
-
-libbcmath_a_SOURCES= add.c compare.c debug.c div.c divmod.c doaddsub.c \
- init.c int2num.c nearzero.c neg.c num2long.c num2str.c output.c \
- raise.c raisemod.c recmul.c rmzero.c sqrt.c str2num.c sub.c zero.c \
- outofmem.c rt.c
-
-INCLUDES = -I$(srcdir) -I..
-
-CFLAGS = @CFLAGS@
-CPPFLAGS = $(INCLUDES) -Wall
-
-MAINTAINERCLEANFILES= Makefile.in $(libbcmath_a_SOURCES) private.h bcmath.h
-
-all: $(bin_LIBRARIES)
-
-clean:
- rm -f $(OBJS) $(LIB) *~
diff --git a/ext/bcmath/libbcmath/src/add.c b/ext/bcmath/libbcmath/src/add.c
deleted file mode 100644
index 3b09af22b2..0000000000
--- a/ext/bcmath/libbcmath/src/add.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* add.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Here is the full add routine that takes care of negative numbers.
- N1 is added to N2 and the result placed into RESULT. SCALE_MIN
- is the minimum scale for the result. */
-
-void
-bc_add (n1, n2, result, scale_min)
- bc_num n1, n2, *result;
- int scale_min;
-{
- bc_num sum = NULL;
- int cmp_res;
- int res_scale;
-
- if (n1->n_sign == n2->n_sign)
- {
- sum = _bc_do_add (n1, n2, scale_min);
- sum->n_sign = n1->n_sign;
- }
- else
- {
- /* subtraction must be done. */
- cmp_res = _bc_do_compare (n1, n2, FALSE, FALSE); /* Compare magnitudes. */
- switch (cmp_res)
- {
- case -1:
- /* n1 is less than n2, subtract n1 from n2. */
- sum = _bc_do_sub (n2, n1, scale_min);
- sum->n_sign = n2->n_sign;
- break;
- case 0:
- /* They are equal! return zero with the correct scale! */
- res_scale = MAX (scale_min, MAX(n1->n_scale, n2->n_scale));
- sum = bc_new_num (1, res_scale);
- memset (sum->n_value, 0, res_scale+1);
- break;
- case 1:
- /* n2 is less than n1, subtract n2 from n1. */
- sum = _bc_do_sub (n1, n2, scale_min);
- sum->n_sign = n1->n_sign;
- }
- }
-
- /* Clean up and return. */
- bc_free_num (result);
- *result = sum;
-}
-
diff --git a/ext/bcmath/libbcmath/src/bcmath.h b/ext/bcmath/libbcmath/src/bcmath.h
deleted file mode 100644
index 1914d0bcdf..0000000000
--- a/ext/bcmath/libbcmath/src/bcmath.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* bcmath.h: bcmath library header. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#ifndef _BCMATH_H_
-#define _BCMATH_H_
-
-typedef enum {PLUS, MINUS} sign;
-
-typedef struct bc_struct *bc_num;
-
-typedef struct bc_struct
- {
- sign n_sign;
- int n_len; /* The number of digits before the decimal point. */
- int n_scale; /* The number of digits after the decimal point. */
- int n_refs; /* The number of pointers to this number. */
- bc_num n_next; /* Linked list for available list. */
- char *n_ptr; /* The pointer to the actual storage.
- If NULL, n_value points to the inside of
- another number (bc_multiply...) and should
- not be "freed." */
- char *n_value; /* The number. Not zero char terminated.
- May not point to the same place as n_ptr as
- in the case of leading zeros generated. */
- } bc_struct;
-
-#include "php.h"
-#include "ext/bcmath/php_bcmath.h"
-
-
-/* The base used in storing the numbers in n_value above.
- Currently this MUST be 10. */
-
-#define BASE 10
-
-/* Some useful macros and constants. */
-
-#define CH_VAL(c) (c - '0')
-#define BCD_CHAR(d) (d + '0')
-
-#ifdef MIN
-#undef MIN
-#undef MAX
-#endif
-#define MAX(a, b) ((a)>(b)?(a):(b))
-#define MIN(a, b) ((a)>(b)?(b):(a))
-#define ODD(a) ((a)&1)
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
-#ifndef LONG_MAX
-#define LONG_MAX 0x7ffffff
-#endif
-
-
-/* Function Prototypes */
-
-/* Define the _PROTOTYPE macro if it is needed. */
-
-#ifndef _PROTOTYPE
-#ifdef __STDC__
-#define _PROTOTYPE(func, args) func args
-#else
-#define _PROTOTYPE(func, args) func()
-#endif
-#endif
-
-_PROTOTYPE(void bc_init_numbers, (TSRMLS_D));
-
-_PROTOTYPE(bc_num bc_new_num, (int length, int scale));
-
-_PROTOTYPE(void bc_free_num, (bc_num *num));
-
-_PROTOTYPE(bc_num bc_copy_num, (bc_num num));
-
-_PROTOTYPE(void bc_init_num, (bc_num *num TSRMLS_DC));
-
-_PROTOTYPE(void bc_str2num, (bc_num *num, char *str, int scale TSRMLS_DC));
-
-_PROTOTYPE(char *bc_num2str, (bc_num num));
-
-_PROTOTYPE(void bc_int2num, (bc_num *num, int val));
-
-_PROTOTYPE(long bc_num2long, (bc_num num));
-
-_PROTOTYPE(int bc_compare, (bc_num n1, bc_num n2));
-
-_PROTOTYPE(char bc_is_zero, (bc_num num TSRMLS_DC));
-
-_PROTOTYPE(char bc_is_near_zero, (bc_num num, int scale));
-
-_PROTOTYPE(char bc_is_neg, (bc_num num));
-
-_PROTOTYPE(void bc_add, (bc_num n1, bc_num n2, bc_num *result, int scale_min));
-
-_PROTOTYPE(void bc_sub, (bc_num n1, bc_num n2, bc_num *result, int scale_min));
-
-_PROTOTYPE(void bc_multiply, (bc_num n1, bc_num n2, bc_num *prod, int scale TSRMLS_DC));
-
-_PROTOTYPE(int bc_divide, (bc_num n1, bc_num n2, bc_num *quot, int scale TSRMLS_DC));
-
-_PROTOTYPE(int bc_modulo, (bc_num num1, bc_num num2, bc_num *result,
- int scale TSRMLS_DC));
-
-_PROTOTYPE(int bc_divmod, (bc_num num1, bc_num num2, bc_num *quot,
- bc_num *rem, int scale TSRMLS_DC));
-
-_PROTOTYPE(int bc_raisemod, (bc_num base, bc_num expo, bc_num mod,
- bc_num *result, int scale TSRMLS_DC));
-
-_PROTOTYPE(void bc_raise, (bc_num num1, bc_num num2, bc_num *result,
- int scale TSRMLS_DC));
-
-_PROTOTYPE(int bc_sqrt, (bc_num *num, int scale TSRMLS_DC));
-
-_PROTOTYPE(void bc_out_num, (bc_num num, int o_base, void (* out_char)(int),
- int leading_zero TSRMLS_DC));
-
-/* Prototypes needed for external utility routines. */
-
-_PROTOTYPE(void bc_rt_warn, (char *mesg ,...));
-_PROTOTYPE(void bc_rt_error, (char *mesg ,...));
-_PROTOTYPE(void bc_out_of_memory, (void));
-#endif
diff --git a/ext/bcmath/libbcmath/src/compare.c b/ext/bcmath/libbcmath/src/compare.c
deleted file mode 100644
index 2f094a6917..0000000000
--- a/ext/bcmath/libbcmath/src/compare.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/* compare.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Compare two bc numbers. Return value is 0 if equal, -1 if N1 is less
- than N2 and +1 if N1 is greater than N2. If USE_SIGN is false, just
- compare the magnitudes. */
-
- int
-_bc_do_compare (n1, n2, use_sign, ignore_last)
- bc_num n1, n2;
- int use_sign;
- int ignore_last;
-{
- char *n1ptr, *n2ptr;
- int count;
-
- /* First, compare signs. */
- if (use_sign && n1->n_sign != n2->n_sign)
- {
- if (n1->n_sign == PLUS)
- return (1); /* Positive N1 > Negative N2 */
- else
- return (-1); /* Negative N1 < Positive N1 */
- }
-
- /* Now compare the magnitude. */
- if (n1->n_len != n2->n_len)
- {
- if (n1->n_len > n2->n_len)
- {
- /* Magnitude of n1 > n2. */
- if (!use_sign || n1->n_sign == PLUS)
- return (1);
- else
- return (-1);
- }
- else
- {
- /* Magnitude of n1 < n2. */
- if (!use_sign || n1->n_sign == PLUS)
- return (-1);
- else
- return (1);
- }
- }
-
- /* If we get here, they have the same number of integer digits.
- check the integer part and the equal length part of the fraction. */
- count = n1->n_len + MIN (n1->n_scale, n2->n_scale);
- n1ptr = n1->n_value;
- n2ptr = n2->n_value;
-
- while ((count > 0) && (*n1ptr == *n2ptr))
- {
- n1ptr++;
- n2ptr++;
- count--;
- }
- if (ignore_last && count == 1 && n1->n_scale == n2->n_scale)
- return (0);
- if (count != 0)
- {
- if (*n1ptr > *n2ptr)
- {
- /* Magnitude of n1 > n2. */
- if (!use_sign || n1->n_sign == PLUS)
- return (1);
- else
- return (-1);
- }
- else
- {
- /* Magnitude of n1 < n2. */
- if (!use_sign || n1->n_sign == PLUS)
- return (-1);
- else
- return (1);
- }
- }
-
- /* They are equal up to the last part of the equal part of the fraction. */
- if (n1->n_scale != n2->n_scale)
- {
- if (n1->n_scale > n2->n_scale)
- {
- for (count = n1->n_scale-n2->n_scale; count>0; count--)
- if (*n1ptr++ != 0)
- {
- /* Magnitude of n1 > n2. */
- if (!use_sign || n1->n_sign == PLUS)
- return (1);
- else
- return (-1);
- }
- }
- else
- {
- for (count = n2->n_scale-n1->n_scale; count>0; count--)
- if (*n2ptr++ != 0)
- {
- /* Magnitude of n1 < n2. */
- if (!use_sign || n1->n_sign == PLUS)
- return (-1);
- else
- return (1);
- }
- }
- }
-
- /* They must be equal! */
- return (0);
-}
-
-
-/* This is the "user callable" routine to compare numbers N1 and N2. */
-
-int
-bc_compare (n1, n2)
- bc_num n1, n2;
-{
- return _bc_do_compare (n1, n2, TRUE, FALSE);
-}
-
diff --git a/ext/bcmath/libbcmath/src/config.h b/ext/bcmath/libbcmath/src/config.h
deleted file mode 100644
index 89e3e43b69..0000000000
--- a/ext/bcmath/libbcmath/src/config.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#if PHP_WIN32
-#include "../../../../main/config.w32.h"
-#elif defined(NETWARE)
-#include "config.nw.h"
-#else
-#include "php_config.h"
-#endif
-
-#include "php.h"
-#include <string.h>
-#include "zend.h"
-#include "zend_alloc.h"
diff --git a/ext/bcmath/libbcmath/src/debug.c b/ext/bcmath/libbcmath/src/debug.c
deleted file mode 100644
index 52e4e044d5..0000000000
--- a/ext/bcmath/libbcmath/src/debug.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* debug.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* pn prints the number NUM in base 10. */
-
-static void
-out_char (int c)
-{
- putchar(c);
-}
-
-
-void
-pn (bc_num num TSRMLS_DC)
-{
- bc_out_num (num, 10, out_char, 0 TSRMLS_CC);
- out_char ('\n');
-}
-
-
-/* pv prints a character array as if it was a string of bcd digits. */
-void
-pv (name, num, len)
- char *name;
- unsigned char *num;
- int len;
-{
- int i;
- printf ("%s=", name);
- for (i=0; i<len; i++) printf ("%c",BCD_CHAR(num[i]));
- printf ("\n");
-}
diff --git a/ext/bcmath/libbcmath/src/div.c b/ext/bcmath/libbcmath/src/div.c
deleted file mode 100644
index 1ad3710128..0000000000
--- a/ext/bcmath/libbcmath/src/div.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/* div.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Some utility routines for the divide: First a one digit multiply.
- NUM (with SIZE digits) is multiplied by DIGIT and the result is
- placed into RESULT. It is written so that NUM and RESULT can be
- the same pointers. */
-
-static void
-_one_mult (num, size, digit, result)
- unsigned char *num;
- int size, digit;
- unsigned char *result;
-{
- int carry, value;
- unsigned char *nptr, *rptr;
-
- if (digit == 0)
- memset (result, 0, size);
- else
- {
- if (digit == 1)
- memcpy (result, num, size);
- else
- {
- /* Initialize */
- nptr = (unsigned char *) (num+size-1);
- rptr = (unsigned char *) (result+size-1);
- carry = 0;
-
- while (size-- > 0)
- {
- value = *nptr-- * digit + carry;
- *rptr-- = value % BASE;
- carry = value / BASE;
- }
-
- if (carry != 0) *rptr = carry;
- }
- }
-}
-
-
-/* The full division routine. This computes N1 / N2. It returns
- 0 if the division is ok and the result is in QUOT. The number of
- digits after the decimal point is SCALE. It returns -1 if division
- by zero is tried. The algorithm is found in Knuth Vol 2. p237. */
-
-int
-bc_divide (bc_num n1, bc_num n2, bc_num *quot, int scale TSRMLS_DC)
-{
- bc_num qval;
- unsigned char *num1, *num2;
- unsigned char *ptr1, *ptr2, *n2ptr, *qptr;
- int scale1, val;
- unsigned int len1, len2, scale2, qdigits, extra, count;
- unsigned int qdig, qguess, borrow, carry;
- unsigned char *mval;
- char zero;
- unsigned int norm;
-
- /* Test for divide by zero. */
- if (bc_is_zero (n2 TSRMLS_CC)) return -1;
-
- /* Test for divide by 1. If it is we must truncate. */
- if (n2->n_scale == 0)
- {
- if (n2->n_len == 1 && *n2->n_value == 1)
- {
- qval = bc_new_num (n1->n_len, scale);
- qval->n_sign = (n1->n_sign == n2->n_sign ? PLUS : MINUS);
- memset (&qval->n_value[n1->n_len],0,scale);
- memcpy (qval->n_value, n1->n_value,
- n1->n_len + MIN(n1->n_scale,scale));
- bc_free_num (quot);
- *quot = qval;
- }
- }
-
- /* Set up the divide. Move the decimal point on n1 by n2's scale.
- Remember, zeros on the end of num2 are wasted effort for dividing. */
- scale2 = n2->n_scale;
- n2ptr = (unsigned char *) n2->n_value+n2->n_len+scale2-1;
- while ((scale2 > 0) && (*n2ptr-- == 0)) scale2--;
-
- len1 = n1->n_len + scale2;
- scale1 = n1->n_scale - scale2;
- if (scale1 < scale)
- extra = scale - scale1;
- else
- extra = 0;
- num1 = (unsigned char *) emalloc (n1->n_len+n1->n_scale+extra+2);
- if (num1 == NULL) bc_out_of_memory();
- memset (num1, 0, n1->n_len+n1->n_scale+extra+2);
- memcpy (num1+1, n1->n_value, n1->n_len+n1->n_scale);
-
- len2 = n2->n_len + scale2;
- num2 = (unsigned char *) emalloc (len2+1);
- if (num2 == NULL) bc_out_of_memory();
- memcpy (num2, n2->n_value, len2);
- *(num2+len2) = 0;
- n2ptr = num2;
- while (*n2ptr == 0)
- {
- n2ptr++;
- len2--;
- }
-
- /* Calculate the number of quotient digits. */
- if (len2 > len1+scale)
- {
- qdigits = scale+1;
- zero = TRUE;
- }
- else
- {
- zero = FALSE;
- if (len2>len1)
- qdigits = scale+1; /* One for the zero integer part. */
- else
- qdigits = len1-len2+scale+1;
- }
-
- /* Allocate and zero the storage for the quotient. */
- qval = bc_new_num (qdigits-scale,scale);
- memset (qval->n_value, 0, qdigits);
-
- /* Allocate storage for the temporary storage mval. */
- mval = (unsigned char *) emalloc (len2+1);
- if (mval == NULL) bc_out_of_memory ();
-
- /* Now for the full divide algorithm. */
- if (!zero)
- {
- /* Normalize */
- norm = 10 / ((int)*n2ptr + 1);
- if (norm != 1)
- {
- _one_mult (num1, len1+scale1+extra+1, norm, num1);
- _one_mult (n2ptr, len2, norm, n2ptr);
- }
-
- /* Initialize divide loop. */
- qdig = 0;
- if (len2 > len1)
- qptr = (unsigned char *) qval->n_value+len2-len1;
- else
- qptr = (unsigned char *) qval->n_value;
-
- /* Loop */
- while (qdig <= len1+scale-len2)
- {
- /* Calculate the quotient digit guess. */
- if (*n2ptr == num1[qdig])
- qguess = 9;
- else
- qguess = (num1[qdig]*10 + num1[qdig+1]) / *n2ptr;
-
- /* Test qguess. */
- if (n2ptr[1]*qguess >
- (num1[qdig]*10 + num1[qdig+1] - *n2ptr*qguess)*10
- + num1[qdig+2])
- {
- qguess--;
- /* And again. */
- if (n2ptr[1]*qguess >
- (num1[qdig]*10 + num1[qdig+1] - *n2ptr*qguess)*10
- + num1[qdig+2])
- qguess--;
- }
-
- /* Multiply and subtract. */
- borrow = 0;
- if (qguess != 0)
- {
- *mval = 0;
- _one_mult (n2ptr, len2, qguess, mval+1);
- ptr1 = (unsigned char *) num1+qdig+len2;
- ptr2 = (unsigned char *) mval+len2;
- for (count = 0; count < len2+1; count++)
- {
- val = (int) *ptr1 - (int) *ptr2-- - borrow;
- if (val < 0)
- {
- val += 10;
- borrow = 1;
- }
- else
- borrow = 0;
- *ptr1-- = val;
- }
- }
-
- /* Test for negative result. */
- if (borrow == 1)
- {
- qguess--;
- ptr1 = (unsigned char *) num1+qdig+len2;
- ptr2 = (unsigned char *) n2ptr+len2-1;
- carry = 0;
- for (count = 0; count < len2; count++)
- {
- val = (int) *ptr1 + (int) *ptr2-- + carry;
- if (val > 9)
- {
- val -= 10;
- carry = 1;
- }
- else
- carry = 0;
- *ptr1-- = val;
- }
- if (carry == 1) *ptr1 = (*ptr1 + 1) % 10;
- }
-
- /* We now know the quotient digit. */
- *qptr++ = qguess;
- qdig++;
- }
- }
-
- /* Clean up and return the number. */
- qval->n_sign = ( n1->n_sign == n2->n_sign ? PLUS : MINUS );
- if (bc_is_zero (qval TSRMLS_CC)) qval->n_sign = PLUS;
- _bc_rm_leading_zeros (qval);
- bc_free_num (quot);
- *quot = qval;
-
- /* Clean up temporary storage. */
- efree (mval);
- efree (num1);
- efree (num2);
-
- return 0; /* Everything is OK. */
-}
-
diff --git a/ext/bcmath/libbcmath/src/divmod.c b/ext/bcmath/libbcmath/src/divmod.c
deleted file mode 100644
index 2949bd10d4..0000000000
--- a/ext/bcmath/libbcmath/src/divmod.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* divmod.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Division *and* modulo for numbers. This computes both NUM1 / NUM2 and
- NUM1 % NUM2 and puts the results in QUOT and REM, except that if QUOT
- is NULL then that store will be omitted.
- */
-
-int
-bc_divmod (bc_num num1, bc_num num2, bc_num *quot, bc_num *rem, int scale TSRMLS_DC)
-{
- bc_num quotient = NULL;
- bc_num temp;
- int rscale;
-
- /* Check for correct numbers. */
- if (bc_is_zero (num2 TSRMLS_CC)) return -1;
-
- /* Calculate final scale. */
- rscale = MAX (num1->n_scale, num2->n_scale+scale);
- bc_init_num(&temp TSRMLS_CC);
-
- /* Calculate it. */
- bc_divide (num1, num2, &temp, scale TSRMLS_CC);
- if (quot)
- quotient = bc_copy_num (temp);
- bc_multiply (temp, num2, &temp, rscale TSRMLS_CC);
- bc_sub (num1, temp, rem, rscale);
- bc_free_num (&temp);
-
- if (quot)
- {
- bc_free_num (quot);
- *quot = quotient;
- }
-
- return 0; /* Everything is OK. */
-}
-
-
-/* Modulo for numbers. This computes NUM1 % NUM2 and puts the
- result in RESULT. */
-
-int
-bc_modulo (bc_num num1, bc_num num2, bc_num *result, int scale TSRMLS_DC)
-{
- return bc_divmod (num1, num2, NULL, result, scale TSRMLS_CC);
-}
-
diff --git a/ext/bcmath/libbcmath/src/doaddsub.c b/ext/bcmath/libbcmath/src/doaddsub.c
deleted file mode 100644
index 5458fc5dfc..0000000000
--- a/ext/bcmath/libbcmath/src/doaddsub.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/* doaddsub.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Perform addition: N1 is added to N2 and the value is
- returned. The signs of N1 and N2 are ignored.
- SCALE_MIN is to set the minimum scale of the result. */
-
- bc_num
-_bc_do_add (n1, n2, scale_min)
- bc_num n1, n2;
- int scale_min;
-{
- bc_num sum;
- int sum_scale, sum_digits;
- char *n1ptr, *n2ptr, *sumptr;
- int carry, n1bytes, n2bytes;
- int count;
-
- /* Prepare sum. */
- sum_scale = MAX (n1->n_scale, n2->n_scale);
- sum_digits = MAX (n1->n_len, n2->n_len) + 1;
- sum = bc_new_num (sum_digits, MAX(sum_scale, scale_min));
-
- /* Zero extra digits made by scale_min. */
- if (scale_min > sum_scale)
- {
- sumptr = (char *) (sum->n_value + sum_scale + sum_digits);
- for (count = scale_min - sum_scale; count > 0; count--)
- *sumptr++ = 0;
- }
-
- /* Start with the fraction part. Initialize the pointers. */
- n1bytes = n1->n_scale;
- n2bytes = n2->n_scale;
- n1ptr = (char *) (n1->n_value + n1->n_len + n1bytes - 1);
- n2ptr = (char *) (n2->n_value + n2->n_len + n2bytes - 1);
- sumptr = (char *) (sum->n_value + sum_scale + sum_digits - 1);
-
- /* Add the fraction part. First copy the longer fraction.*/
- if (n1bytes != n2bytes)
- {
- if (n1bytes > n2bytes)
- while (n1bytes>n2bytes)
- { *sumptr-- = *n1ptr--; n1bytes--;}
- else
- while (n2bytes>n1bytes)
- { *sumptr-- = *n2ptr--; n2bytes--;}
- }
-
- /* Now add the remaining fraction part and equal size integer parts. */
- n1bytes += n1->n_len;
- n2bytes += n2->n_len;
- carry = 0;
- while ((n1bytes > 0) && (n2bytes > 0))
- {
- *sumptr = *n1ptr-- + *n2ptr-- + carry;
- if (*sumptr > (BASE-1))
- {
- carry = 1;
- *sumptr -= BASE;
- }
- else
- carry = 0;
- sumptr--;
- n1bytes--;
- n2bytes--;
- }
-
- /* Now add carry the longer integer part. */
- if (n1bytes == 0)
- { n1bytes = n2bytes; n1ptr = n2ptr; }
- while (n1bytes-- > 0)
- {
- *sumptr = *n1ptr-- + carry;
- if (*sumptr > (BASE-1))
- {
- carry = 1;
- *sumptr -= BASE;
- }
- else
- carry = 0;
- sumptr--;
- }
-
- /* Set final carry. */
- if (carry == 1)
- *sumptr += 1;
-
- /* Adjust sum and return. */
- _bc_rm_leading_zeros (sum);
- return sum;
-}
-
-
-/* Perform subtraction: N2 is subtracted from N1 and the value is
- returned. The signs of N1 and N2 are ignored. Also, N1 is
- assumed to be larger than N2. SCALE_MIN is the minimum scale
- of the result. */
-
- bc_num
-_bc_do_sub (n1, n2, scale_min)
- bc_num n1, n2;
- int scale_min;
-{
- bc_num diff;
- int diff_scale, diff_len;
- int min_scale, min_len;
- char *n1ptr, *n2ptr, *diffptr;
- int borrow, count, val;
-
- /* Allocate temporary storage. */
- diff_len = MAX (n1->n_len, n2->n_len);
- diff_scale = MAX (n1->n_scale, n2->n_scale);
- min_len = MIN (n1->n_len, n2->n_len);
- min_scale = MIN (n1->n_scale, n2->n_scale);
- diff = bc_new_num (diff_len, MAX(diff_scale, scale_min));
-
- /* Zero extra digits made by scale_min. */
- if (scale_min > diff_scale)
- {
- diffptr = (char *) (diff->n_value + diff_len + diff_scale);
- for (count = scale_min - diff_scale; count > 0; count--)
- *diffptr++ = 0;
- }
-
- /* Initialize the subtract. */
- n1ptr = (char *) (n1->n_value + n1->n_len + n1->n_scale -1);
- n2ptr = (char *) (n2->n_value + n2->n_len + n2->n_scale -1);
- diffptr = (char *) (diff->n_value + diff_len + diff_scale -1);
-
- /* Subtract the numbers. */
- borrow = 0;
-
- /* Take care of the longer scaled number. */
- if (n1->n_scale != min_scale)
- {
- /* n1 has the longer scale */
- for (count = n1->n_scale - min_scale; count > 0; count--)
- *diffptr-- = *n1ptr--;
- }
- else
- {
- /* n2 has the longer scale */
- for (count = n2->n_scale - min_scale; count > 0; count--)
- {
- val = - *n2ptr-- - borrow;
- if (val < 0)
- {
- val += BASE;
- borrow = 1;
- }
- else
- borrow = 0;
- *diffptr-- = val;
- }
- }
-
- /* Now do the equal length scale and integer parts. */
-
- for (count = 0; count < min_len + min_scale; count++)
- {
- val = *n1ptr-- - *n2ptr-- - borrow;
- if (val < 0)
- {
- val += BASE;
- borrow = 1;
- }
- else
- borrow = 0;
- *diffptr-- = val;
- }
-
- /* If n1 has more digits then n2, we now do that subtract. */
- if (diff_len != min_len)
- {
- for (count = diff_len - min_len; count > 0; count--)
- {
- val = *n1ptr-- - borrow;
- if (val < 0)
- {
- val += BASE;
- borrow = 1;
- }
- else
- borrow = 0;
- *diffptr-- = val;
- }
- }
-
- /* Clean up and return. */
- _bc_rm_leading_zeros (diff);
- return diff;
-}
-
diff --git a/ext/bcmath/libbcmath/src/init.c b/ext/bcmath/libbcmath/src/init.c
deleted file mode 100644
index d540a88060..0000000000
--- a/ext/bcmath/libbcmath/src/init.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/* init.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-#if SANDER_0
- bc_num _bc_Free_list = NULL;
-#endif
-
-/* new_num allocates a number and sets fields to known values. */
-
-bc_num
-bc_new_num (length, scale)
- int length, scale;
-{
- bc_num temp;
-
- /* PHP Change: malloc() -> emalloc(), removed free_list code */
- temp = (bc_num) emalloc (sizeof(bc_struct)+length+scale);
-#if 0
- if (_bc_Free_list != NULL) {
- temp = _bc_Free_list;
- _bc_Free_list = temp->n_next;
- } else {
- temp = (bc_num) emalloc (sizeof(bc_struct));
- if (temp == NULL) bc_out_of_memory ();
- }
-#endif
- temp->n_sign = PLUS;
- temp->n_len = length;
- temp->n_scale = scale;
- temp->n_refs = 1;
- /* PHP Change: malloc() -> emalloc() */
- temp->n_ptr = (char *) emalloc (length+scale);
- if (temp->n_ptr == NULL) bc_out_of_memory();
- temp->n_value = temp->n_ptr;
- memset (temp->n_ptr, 0, length+scale);
- return temp;
-}
-
-
-/* "Frees" a bc_num NUM. Actually decreases reference count and only
- frees the storage if reference count is zero. */
-
-void
-bc_free_num (num)
- bc_num *num;
-{
- if (*num == NULL) return;
- (*num)->n_refs--;
- if ((*num)->n_refs == 0) {
- if ((*num)->n_ptr)
- /* PHP Change: free() -> efree(), removed free_list code */
- efree ((*num)->n_ptr);
- efree(*num);
-#if 0
- (*num)->n_next = _bc_Free_list;
- _bc_Free_list = *num;
-#endif
- }
- *num = NULL;
-}
-
-
-/* Intitialize the number package! */
-
-void
-bc_init_numbers (TSRMLS_D)
-{
- BCG(_zero_) = bc_new_num (1,0);
- BCG(_one_) = bc_new_num (1,0);
- BCG(_one_)->n_value[0] = 1;
- BCG(_two_) = bc_new_num (1,0);
- BCG(_two_)->n_value[0] = 2;
-}
-
-
-/* Make a copy of a number! Just increments the reference count! */
-
-bc_num
-bc_copy_num (bc_num num)
-{
- num->n_refs++;
- return num;
-}
-
-
-/* Initialize a number NUM by making it a copy of zero. */
-
-void
-bc_init_num (bc_num *num TSRMLS_DC)
-{
- *num = bc_copy_num (BCG(_zero_));
-}
-
diff --git a/ext/bcmath/libbcmath/src/int2num.c b/ext/bcmath/libbcmath/src/int2num.c
deleted file mode 100644
index 34419c138f..0000000000
--- a/ext/bcmath/libbcmath/src/int2num.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* int2num.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Convert an integer VAL to a bc number NUM. */
-
-void
-bc_int2num (num, val)
- bc_num *num;
- int val;
-{
- char buffer[30];
- char *bptr, *vptr;
- int ix = 1;
- char neg = 0;
-
- /* Sign. */
- if (val < 0)
- {
- neg = 1;
- val = -val;
- }
-
- /* Get things going. */
- bptr = buffer;
- *bptr++ = val % BASE;
- val = val / BASE;
-
- /* Extract remaining digits. */
- while (val != 0)
- {
- *bptr++ = val % BASE;
- val = val / BASE;
- ix++; /* Count the digits. */
- }
-
- /* Make the number. */
- bc_free_num (num);
- *num = bc_new_num (ix, 0);
- if (neg) (*num)->n_sign = MINUS;
-
- /* Assign the digits. */
- vptr = (*num)->n_value;
- while (ix-- > 0)
- *vptr++ = *--bptr;
-}
-
diff --git a/ext/bcmath/libbcmath/src/nearzero.c b/ext/bcmath/libbcmath/src/nearzero.c
deleted file mode 100644
index ae16b65d8a..0000000000
--- a/ext/bcmath/libbcmath/src/nearzero.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* nearzero.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* In some places we need to check if the number NUM is almost zero.
- Specifically, all but the last digit is 0 and the last digit is 1.
- Last digit is defined by scale. */
-
-char
-bc_is_near_zero (num, scale)
- bc_num num;
- int scale;
-{
- int count;
- char *nptr;
-
- /* Error checking */
- if (scale > num->n_scale)
- scale = num->n_scale;
-
- /* Initialize */
- count = num->n_len + scale;
- nptr = num->n_value;
-
- /* The check */
- while ((count > 0) && (*nptr++ == 0)) count--;
-
- if (count != 0 && (count != 1 || *--nptr != 1))
- return FALSE;
- else
- return TRUE;
-}
-
diff --git a/ext/bcmath/libbcmath/src/neg.c b/ext/bcmath/libbcmath/src/neg.c
deleted file mode 100644
index c864d77f1d..0000000000
--- a/ext/bcmath/libbcmath/src/neg.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* neg.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* In some places we need to check if the number is negative. */
-
-char
-bc_is_neg (num)
- bc_num num;
-{
- return num->n_sign == MINUS;
-}
-
diff --git a/ext/bcmath/libbcmath/src/num2long.c b/ext/bcmath/libbcmath/src/num2long.c
deleted file mode 100644
index 0a6e0836ad..0000000000
--- a/ext/bcmath/libbcmath/src/num2long.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* num2long.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* Convert a number NUM to a long. The function returns only the integer
- part of the number. For numbers that are too large to represent as
- a long, this function returns a zero. This can be detected by checking
- the NUM for zero after having a zero returned. */
-
-long
-bc_num2long (num)
- bc_num num;
-{
- long val;
- char *nptr;
- int index;
-
- /* Extract the int value, ignore the fraction. */
- val = 0;
- nptr = num->n_value;
- for (index=num->n_len; (index>0) && (val<=(LONG_MAX/BASE)); index--)
- val = val*BASE + *nptr++;
-
- /* Check for overflow. If overflow, return zero. */
- if (index>0) val = 0;
- if (val < 0) val = 0;
-
- /* Return the value. */
- if (num->n_sign == PLUS)
- return (val);
- else
- return (-val);
-}
-
diff --git a/ext/bcmath/libbcmath/src/num2str.c b/ext/bcmath/libbcmath/src/num2str.c
deleted file mode 100644
index c47ec9bbad..0000000000
--- a/ext/bcmath/libbcmath/src/num2str.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* num2str.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* Convert a numbers to a string. Base 10 only.*/
-
-char
-*bc_num2str (num)
- bc_num num;
-{
- char *str, *sptr;
- char *nptr;
- int index, signch;
-
- /* Allocate the string memory. */
- signch = ( num->n_sign == PLUS ? 0 : 1 ); /* Number of sign chars. */
- if (num->n_scale > 0)
- str = (char *) emalloc (num->n_len + num->n_scale + 2 + signch);
- else
- str = (char *) emalloc (num->n_len + 1 + signch);
- if (str == NULL) bc_out_of_memory();
-
- /* The negative sign if needed. */
- sptr = str;
- if (signch) *sptr++ = '-';
-
- /* Load the whole number. */
- nptr = num->n_value;
- for (index=num->n_len; index>0; index--)
- *sptr++ = BCD_CHAR(*nptr++);
-
- /* Now the fraction. */
- if (num->n_scale > 0)
- {
- *sptr++ = '.';
- for (index=0; index<num->n_scale; index++)
- *sptr++ = BCD_CHAR(*nptr++);
- }
-
- /* Terminate the string and return it! */
- *sptr = '\0';
- return (str);
-}
diff --git a/ext/bcmath/libbcmath/src/outofmem.c b/ext/bcmath/libbcmath/src/outofmem.c
deleted file mode 100644
index 799a32d2ae..0000000000
--- a/ext/bcmath/libbcmath/src/outofmem.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* outofmem.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-void bc_out_of_memory (void)
-{
- (void) fprintf (stderr, "bcmath: out of memory!\n");
- exit (1);
-}
diff --git a/ext/bcmath/libbcmath/src/output.c b/ext/bcmath/libbcmath/src/output.c
deleted file mode 100644
index ab49b0e366..0000000000
--- a/ext/bcmath/libbcmath/src/output.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/* output.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* The following routines provide output for bcd numbers package
- using the rules of POSIX bc for output. */
-
-/* This structure is used for saving digits in the conversion process. */
-typedef struct stk_rec {
- long digit;
- struct stk_rec *next;
-} stk_rec;
-
-/* The reference string for digits. */
-static char ref_str[] = "0123456789ABCDEF";
-
-
-/* A special output routine for "multi-character digits." Exactly
- SIZE characters must be output for the value VAL. If SPACE is
- non-zero, we must output one space before the number. OUT_CHAR
- is the actual routine for writing the characters. */
-
-void
-bc_out_long (val, size, space, out_char)
- long val;
- int size, space;
-#ifdef __STDC__
- void (*out_char)(int);
-#else
- void (*out_char)();
-#endif
-{
- char digits[40];
- int len, ix;
-
- if (space) (*out_char) (' ');
- sprintf (digits, "%ld", val);
- len = strlen (digits);
- while (size > len)
- {
- (*out_char) ('0');
- size--;
- }
- for (ix=0; ix < len; ix++)
- (*out_char) (digits[ix]);
-}
-
-/* Output of a bcd number. NUM is written in base O_BASE using OUT_CHAR
- as the routine to do the actual output of the characters. */
-
-void
-#ifdef __STDC__
-bc_out_num (bc_num num, int o_base, void (*out_char)(int), int leading_zero TSRMLS_DC)
-#else
-bc_out_num (bc_num num, int o_base, void (*out_char)(), int leading_zero TSRMLS_DC)
-#endif
-{
- char *nptr;
- int index, fdigit, pre_space;
- stk_rec *digits, *temp;
- bc_num int_part, frac_part, base, cur_dig, t_num, max_o_digit;
-
- /* The negative sign if needed. */
- if (num->n_sign == MINUS) (*out_char) ('-');
-
- /* Output the number. */
- if (bc_is_zero (num TSRMLS_CC))
- (*out_char) ('0');
- else
- if (o_base == 10)
- {
- /* The number is in base 10, do it the fast way. */
- nptr = num->n_value;
- if (num->n_len > 1 || *nptr != 0)
- for (index=num->n_len; index>0; index--)
- (*out_char) (BCD_CHAR(*nptr++));
- else
- nptr++;
-
- if (leading_zero && bc_is_zero (num TSRMLS_CC))
- (*out_char) ('0');
-
- /* Now the fraction. */
- if (num->n_scale > 0)
- {
- (*out_char) ('.');
- for (index=0; index<num->n_scale; index++)
- (*out_char) (BCD_CHAR(*nptr++));
- }
- }
- else
- {
- /* special case ... */
- if (leading_zero && bc_is_zero (num TSRMLS_CC))
- (*out_char) ('0');
-
- /* The number is some other base. */
- digits = NULL;
- bc_init_num (&int_part TSRMLS_CC);
- bc_divide (num, BCG(_one_), &int_part, 0 TSRMLS_CC);
- bc_init_num (&frac_part TSRMLS_CC);
- bc_init_num (&cur_dig TSRMLS_CC);
- bc_init_num (&base TSRMLS_CC);
- bc_sub (num, int_part, &frac_part, 0);
- /* Make the INT_PART and FRAC_PART positive. */
- int_part->n_sign = PLUS;
- frac_part->n_sign = PLUS;
- bc_int2num (&base, o_base);
- bc_init_num (&max_o_digit TSRMLS_CC);
- bc_int2num (&max_o_digit, o_base-1);
-
-
- /* Get the digits of the integer part and push them on a stack. */
- while (!bc_is_zero (int_part TSRMLS_CC))
- {
- bc_modulo (int_part, base, &cur_dig, 0 TSRMLS_CC);
- /* PHP Change: malloc() -> emalloc() */
- temp = (stk_rec *) emalloc (sizeof(stk_rec));
- if (temp == NULL) bc_out_of_memory();
- temp->digit = bc_num2long (cur_dig);
- temp->next = digits;
- digits = temp;
- bc_divide (int_part, base, &int_part, 0 TSRMLS_CC);
- }
-
- /* Print the digits on the stack. */
- if (digits != NULL)
- {
- /* Output the digits. */
- while (digits != NULL)
- {
- temp = digits;
- digits = digits->next;
- if (o_base <= 16)
- (*out_char) (ref_str[ (int) temp->digit]);
- else
- bc_out_long (temp->digit, max_o_digit->n_len, 1, out_char);
- efree (temp);
- }
- }
-
- /* Get and print the digits of the fraction part. */
- if (num->n_scale > 0)
- {
- (*out_char) ('.');
- pre_space = 0;
- t_num = bc_copy_num (BCG(_one_));
- while (t_num->n_len <= num->n_scale) {
- bc_multiply (frac_part, base, &frac_part, num->n_scale TSRMLS_CC);
- fdigit = bc_num2long (frac_part);
- bc_int2num (&int_part, fdigit);
- bc_sub (frac_part, int_part, &frac_part, 0);
- if (o_base <= 16)
- (*out_char) (ref_str[fdigit]);
- else {
- bc_out_long (fdigit, max_o_digit->n_len, pre_space, out_char);
- pre_space = 1;
- }
- bc_multiply (t_num, base, &t_num, 0 TSRMLS_CC);
- }
- bc_free_num (&t_num);
- }
-
- /* Clean up. */
- bc_free_num (&int_part);
- bc_free_num (&frac_part);
- bc_free_num (&base);
- bc_free_num (&cur_dig);
- bc_free_num (&max_o_digit);
- }
-}
diff --git a/ext/bcmath/libbcmath/src/private.h b/ext/bcmath/libbcmath/src/private.h
deleted file mode 100644
index f8f1048ab7..0000000000
--- a/ext/bcmath/libbcmath/src/private.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* private.h: bcmath library header. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-/* "Private" routines to bcmath. */
-
-/* variables */
-#if SANDER_0
-extern bc_num _bc_Free_list;
-#endif
-
-/* routines */
-int _bc_do_compare (bc_num n1, bc_num n2, int use_sign, int ignore_last);
-bc_num _bc_do_add (bc_num n1, bc_num n2, int scale_min);
-bc_num _bc_do_sub (bc_num n1, bc_num n2, int scale_min);
-void _bc_rm_leading_zeros (bc_num num);
diff --git a/ext/bcmath/libbcmath/src/raise.c b/ext/bcmath/libbcmath/src/raise.c
deleted file mode 100644
index f2f4f4a1d7..0000000000
--- a/ext/bcmath/libbcmath/src/raise.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* raise.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Raise NUM1 to the NUM2 power. The result is placed in RESULT.
- Maximum exponent is LONG_MAX. If a NUM2 is not an integer,
- only the integer part is used. */
-
-void
-bc_raise (bc_num num1, bc_num num2, bc_num *result, int scale TSRMLS_DC)
-{
- bc_num temp, power;
- long exponent;
- int rscale;
- int pwrscale;
- int calcscale;
- char neg;
-
- /* Check the exponent for scale digits and convert to a long. */
- if (num2->n_scale != 0)
- bc_rt_warn ("non-zero scale in exponent");
- exponent = bc_num2long (num2);
- if (exponent == 0 && (num2->n_len > 1 || num2->n_value[0] != 0))
- bc_rt_error ("exponent too large in raise");
-
- /* Special case if exponent is a zero. */
- if (exponent == 0)
- {
- bc_free_num (result);
- *result = bc_copy_num (BCG(_one_));
- return;
- }
-
- /* Other initializations. */
- if (exponent < 0)
- {
- neg = TRUE;
- exponent = -exponent;
- rscale = scale;
- }
- else
- {
- neg = FALSE;
- rscale = MIN (num1->n_scale*exponent, MAX(scale, num1->n_scale));
- }
-
- /* Set initial value of temp. */
- power = bc_copy_num (num1);
- pwrscale = num1->n_scale;
- while ((exponent & 1) == 0)
- {
- pwrscale = 2*pwrscale;
- bc_multiply (power, power, &power, pwrscale TSRMLS_CC);
- exponent = exponent >> 1;
- }
- temp = bc_copy_num (power);
- calcscale = pwrscale;
- exponent = exponent >> 1;
-
- /* Do the calculation. */
- while (exponent > 0)
- {
- pwrscale = 2*pwrscale;
- bc_multiply (power, power, &power, pwrscale TSRMLS_CC);
- if ((exponent & 1) == 1) {
- calcscale = pwrscale + calcscale;
- bc_multiply (temp, power, &temp, calcscale TSRMLS_CC);
- }
- exponent = exponent >> 1;
- }
-
- /* Assign the value. */
- if (neg)
- {
- bc_divide (BCG(_one_), temp, result, rscale TSRMLS_CC);
- bc_free_num (&temp);
- }
- else
- {
- bc_free_num (result);
- *result = temp;
- if ((*result)->n_scale > rscale)
- (*result)->n_scale = rscale;
- }
- bc_free_num (&power);
-}
-
diff --git a/ext/bcmath/libbcmath/src/raisemod.c b/ext/bcmath/libbcmath/src/raisemod.c
deleted file mode 100644
index 3f6edcc2ac..0000000000
--- a/ext/bcmath/libbcmath/src/raisemod.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* raisemod.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* Raise BASE to the EXPO power, reduced modulo MOD. The result is
- placed in RESULT. If a EXPO is not an integer,
- only the integer part is used. */
-
-int
-bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale TSRMLS_DC)
-{
- bc_num power, exponent, parity, temp;
- int rscale;
-
- /* Check for correct numbers. */
- if (bc_is_zero(mod TSRMLS_CC)) return -1;
- if (bc_is_neg(expo)) return -1;
-
- /* Set initial values. */
- power = bc_copy_num (base);
- exponent = bc_copy_num (expo);
- temp = bc_copy_num (BCG(_one_));
- bc_init_num(&parity TSRMLS_CC);
-
- /* Check the base for scale digits. */
- if (base->n_scale != 0)
- bc_rt_warn ("non-zero scale in base");
-
- /* Check the exponent for scale digits. */
- if (exponent->n_scale != 0)
- {
- bc_rt_warn ("non-zero scale in exponent");
- bc_divide (exponent, BCG(_one_), &exponent, 0 TSRMLS_CC); /*truncate */
- }
-
- /* Check the modulus for scale digits. */
- if (mod->n_scale != 0)
- bc_rt_warn ("non-zero scale in modulus");
-
- /* Do the calculation. */
- rscale = MAX(scale, base->n_scale);
- while ( !bc_is_zero(exponent TSRMLS_CC) )
- {
- (void) bc_divmod (exponent, BCG(_two_), &exponent, &parity, 0 TSRMLS_CC);
- if ( !bc_is_zero(parity TSRMLS_CC) )
- {
- bc_multiply (temp, power, &temp, rscale TSRMLS_CC);
- (void) bc_modulo (temp, mod, &temp, scale TSRMLS_CC);
- }
-
- bc_multiply (power, power, &power, rscale TSRMLS_CC);
- (void) bc_modulo (power, mod, &power, scale TSRMLS_CC);
- }
-
- /* Assign the value. */
- bc_free_num (&power);
- bc_free_num (&exponent);
- bc_free_num (result);
- *result = temp;
- return 0; /* Everything is OK. */
-}
diff --git a/ext/bcmath/libbcmath/src/recmul.c b/ext/bcmath/libbcmath/src/recmul.c
deleted file mode 100644
index c31d09dc72..0000000000
--- a/ext/bcmath/libbcmath/src/recmul.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/* recmul.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* Recursive vs non-recursive multiply crossover ranges. */
-#if defined(MULDIGITS)
-#include "muldigits.h"
-#else
-#define MUL_BASE_DIGITS 80
-#endif
-
-int mul_base_digits = MUL_BASE_DIGITS;
-#define MUL_SMALL_DIGITS mul_base_digits/4
-
-/* Multiply utility routines */
-
-static bc_num
-new_sub_num (length, scale, value)
- int length, scale;
- char *value;
-{
- bc_num temp;
-
-#ifdef SANDER_0
- if (_bc_Free_list != NULL) {
- temp = _bc_Free_list;
- _bc_Free_list = temp->n_next;
- } else {
-#endif
- temp = (bc_num) emalloc (sizeof(bc_struct));
-#ifdef SANDER_0
- if (temp == NULL) bc_out_of_memory ();
- }
-#endif
- temp->n_sign = PLUS;
- temp->n_len = length;
- temp->n_scale = scale;
- temp->n_refs = 1;
- temp->n_ptr = NULL;
- temp->n_value = value;
- return temp;
-}
-
-static void
-_bc_simp_mul (bc_num n1, int n1len, bc_num n2, int n2len, bc_num *prod,
- int full_scale)
-{
- char *n1ptr, *n2ptr, *pvptr;
- char *n1end, *n2end; /* To the end of n1 and n2. */
- int indx, sum, prodlen;
-
- prodlen = n1len+n2len+1;
-
- *prod = bc_new_num (prodlen, 0);
-
- n1end = (char *) (n1->n_value + n1len - 1);
- n2end = (char *) (n2->n_value + n2len - 1);
- pvptr = (char *) ((*prod)->n_value + prodlen - 1);
- sum = 0;
-
- /* Here is the loop... */
- for (indx = 0; indx < prodlen-1; indx++)
- {
- n1ptr = (char *) (n1end - MAX(0, indx-n2len+1));
- n2ptr = (char *) (n2end - MIN(indx, n2len-1));
- while ((n1ptr >= n1->n_value) && (n2ptr <= n2end))
- sum += *n1ptr-- * *n2ptr++;
- *pvptr-- = sum % BASE;
- sum = sum / BASE;
- }
- *pvptr = sum;
-}
-
-
-/* A special adder/subtractor for the recursive divide and conquer
- multiply algorithm. Note: if sub is called, accum must
- be larger that what is being subtracted. Also, accum and val
- must have n_scale = 0. (e.g. they must look like integers. *) */
-static void
-_bc_shift_addsub (bc_num accum, bc_num val, int shift, int sub)
-{
- signed char *accp, *valp;
- int count, carry;
-
- count = val->n_len;
- if (val->n_value[0] == 0)
- count--;
- assert (accum->n_len+accum->n_scale >= shift+count);
-
- /* Set up pointers and others */
- accp = (signed char *)(accum->n_value +
- accum->n_len + accum->n_scale - shift - 1);
- valp = (signed char *)(val->n_value + val->n_len - 1);
- carry = 0;
-
- if (sub) {
- /* Subtraction, carry is really borrow. */
- while (count--) {
- *accp -= *valp-- + carry;
- if (*accp < 0) {
- carry = 1;
- *accp-- += BASE;
- } else {
- carry = 0;
- accp--;
- }
- }
- while (carry) {
- *accp -= carry;
- if (*accp < 0)
- *accp-- += BASE;
- else
- carry = 0;
- }
- } else {
- /* Addition */
- while (count--) {
- *accp += *valp-- + carry;
- if (*accp > (BASE-1)) {
- carry = 1;
- *accp-- -= BASE;
- } else {
- carry = 0;
- accp--;
- }
- }
- while (carry) {
- *accp += carry;
- if (*accp > (BASE-1))
- *accp-- -= BASE;
- else
- carry = 0;
- }
- }
-}
-
-/* Recursive divide and conquer multiply algorithm.
- Based on
- Let u = u0 + u1*(b^n)
- Let v = v0 + v1*(b^n)
- Then uv = (B^2n+B^n)*u1*v1 + B^n*(u1-u0)*(v0-v1) + (B^n+1)*u0*v0
-
- B is the base of storage, number of digits in u1,u0 close to equal.
-*/
-static void
-_bc_rec_mul (bc_num u, int ulen, bc_num v, int vlen, bc_num *prod,
- int full_scale TSRMLS_DC)
-{
- bc_num u0, u1, v0, v1;
- int u0len, v0len;
- bc_num m1, m2, m3, d1, d2;
- int n, prodlen, m1zero;
- int d1len, d2len;
-
- /* Base case? */
- if ((ulen+vlen) < mul_base_digits
- || ulen < MUL_SMALL_DIGITS
- || vlen < MUL_SMALL_DIGITS ) {
- _bc_simp_mul (u, ulen, v, vlen, prod, full_scale);
- return;
- }
-
- /* Calculate n -- the u and v split point in digits. */
- n = (MAX(ulen, vlen)+1) / 2;
-
- /* Split u and v. */
- if (ulen < n) {
- u1 = bc_copy_num (BCG(_zero_));
- u0 = new_sub_num (ulen,0, u->n_value);
- } else {
- u1 = new_sub_num (ulen-n, 0, u->n_value);
- u0 = new_sub_num (n, 0, u->n_value+ulen-n);
- }
- if (vlen < n) {
- v1 = bc_copy_num (BCG(_zero_));
- v0 = new_sub_num (vlen,0, v->n_value);
- } else {
- v1 = new_sub_num (vlen-n, 0, v->n_value);
- v0 = new_sub_num (n, 0, v->n_value+vlen-n);
- }
- _bc_rm_leading_zeros (u1);
- _bc_rm_leading_zeros (u0);
- u0len = u0->n_len;
- _bc_rm_leading_zeros (v1);
- _bc_rm_leading_zeros (v0);
- v0len = v0->n_len;
-
- m1zero = bc_is_zero(u1 TSRMLS_CC) || bc_is_zero(v1 TSRMLS_CC);
-
- /* Calculate sub results ... */
-
- bc_init_num(&d1 TSRMLS_CC);
- bc_init_num(&d2 TSRMLS_CC);
- bc_sub (u1, u0, &d1, 0);
- d1len = d1->n_len;
- bc_sub (v0, v1, &d2, 0);
- d2len = d2->n_len;
-
-
- /* Do recursive multiplies and shifted adds. */
- if (m1zero)
- m1 = bc_copy_num (BCG(_zero_));
- else
- _bc_rec_mul (u1, u1->n_len, v1, v1->n_len, &m1, 0 TSRMLS_CC);
-
- if (bc_is_zero(d1 TSRMLS_CC) || bc_is_zero(d2 TSRMLS_CC))
- m2 = bc_copy_num (BCG(_zero_));
- else
- _bc_rec_mul (d1, d1len, d2, d2len, &m2, 0 TSRMLS_CC);
-
- if (bc_is_zero(u0 TSRMLS_CC) || bc_is_zero(v0 TSRMLS_CC))
- m3 = bc_copy_num (BCG(_zero_));
- else
- _bc_rec_mul (u0, u0->n_len, v0, v0->n_len, &m3, 0 TSRMLS_CC);
-
- /* Initialize product */
- prodlen = ulen+vlen+1;
- *prod = bc_new_num(prodlen, 0);
-
- if (!m1zero) {
- _bc_shift_addsub (*prod, m1, 2*n, 0);
- _bc_shift_addsub (*prod, m1, n, 0);
- }
- _bc_shift_addsub (*prod, m3, n, 0);
- _bc_shift_addsub (*prod, m3, 0, 0);
- _bc_shift_addsub (*prod, m2, n, d1->n_sign != d2->n_sign);
-
- /* Now clean up! */
- bc_free_num (&u1);
- bc_free_num (&u0);
- bc_free_num (&v1);
- bc_free_num (&m1);
- bc_free_num (&v0);
- bc_free_num (&m2);
- bc_free_num (&m3);
- bc_free_num (&d1);
- bc_free_num (&d2);
-}
-
-/* The multiply routine. N2 times N1 is put int PROD with the scale of
- the result being MIN(N2 scale+N1 scale, MAX (SCALE, N2 scale, N1 scale)).
- */
-
-void
-bc_multiply (bc_num n1, bc_num n2, bc_num *prod, int scale TSRMLS_DC)
-{
- bc_num pval;
- int len1, len2;
- int full_scale, prod_scale;
-
- /* Initialize things. */
- len1 = n1->n_len + n1->n_scale;
- len2 = n2->n_len + n2->n_scale;
- full_scale = n1->n_scale + n2->n_scale;
- prod_scale = MIN(full_scale,MAX(scale,MAX(n1->n_scale,n2->n_scale)));
-
- /* Do the multiply */
- _bc_rec_mul (n1, len1, n2, len2, &pval, full_scale TSRMLS_CC);
-
- /* Assign to prod and clean up the number. */
- pval->n_sign = ( n1->n_sign == n2->n_sign ? PLUS : MINUS );
- pval->n_value = pval->n_ptr;
- pval->n_len = len2 + len1 + 1 - full_scale;
- pval->n_scale = prod_scale;
- _bc_rm_leading_zeros (pval);
- if (bc_is_zero (pval TSRMLS_CC))
- pval->n_sign = PLUS;
- bc_free_num (prod);
- *prod = pval;
-}
diff --git a/ext/bcmath/libbcmath/src/rmzero.c b/ext/bcmath/libbcmath/src/rmzero.c
deleted file mode 100644
index 63f7a0cb79..0000000000
--- a/ext/bcmath/libbcmath/src/rmzero.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* rmzero.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* For many things, we may have leading zeros in a number NUM.
- _bc_rm_leading_zeros just moves the data "value" pointer to the
- correct place and adjusts the length. */
-
- void
-_bc_rm_leading_zeros (num)
- bc_num num;
-{
- /* We can move n_value to point to the first non zero digit! */
- while (*num->n_value == 0 && num->n_len > 1) {
- num->n_value++;
- num->n_len--;
- }
-}
-
diff --git a/ext/bcmath/libbcmath/src/rt.c b/ext/bcmath/libbcmath/src/rt.c
deleted file mode 100644
index 2479104fe4..0000000000
--- a/ext/bcmath/libbcmath/src/rt.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* rt.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-void bc_rt_warn (char *mesg ,...)
-{
- va_list args;
- char error_mesg [255];
-
- va_start (args, mesg);
- vsprintf (error_mesg, mesg, args);
- va_end (args);
-
- fprintf (stderr, "bc math warning: %s\n", error_mesg);
-}
-
-
-void bc_rt_error (char *mesg ,...)
-{
- va_list args;
- char error_mesg [255];
-
- va_start (args, mesg);
- vsprintf (error_mesg, mesg, args);
- va_end (args);
-
- fprintf (stderr, "bc math error: %s\n", error_mesg);
-}
diff --git a/ext/bcmath/libbcmath/src/sqrt.c b/ext/bcmath/libbcmath/src/sqrt.c
deleted file mode 100644
index 5db5113eb5..0000000000
--- a/ext/bcmath/libbcmath/src/sqrt.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* sqrt.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* Take the square root NUM and return it in NUM with SCALE digits
- after the decimal place. */
-
-int
-bc_sqrt (bc_num *num, int scale TSRMLS_DC)
-{
- int rscale, cmp_res, done;
- int cscale;
- bc_num guess, guess1, point5, diff;
-
- /* Initial checks. */
- cmp_res = bc_compare (*num, BCG(_zero_));
- if (cmp_res < 0)
- return 0; /* error */
- else
- {
- if (cmp_res == 0)
- {
- bc_free_num (num);
- *num = bc_copy_num (BCG(_zero_));
- return 1;
- }
- }
- cmp_res = bc_compare (*num, BCG(_one_));
- if (cmp_res == 0)
- {
- bc_free_num (num);
- *num = bc_copy_num (BCG(_one_));
- return 1;
- }
-
- /* Initialize the variables. */
- rscale = MAX (scale, (*num)->n_scale);
- bc_init_num(&guess TSRMLS_CC);
- bc_init_num(&guess1 TSRMLS_CC);
- bc_init_num(&diff TSRMLS_CC);
- point5 = bc_new_num (1,1);
- point5->n_value[1] = 5;
-
-
- /* Calculate the initial guess. */
- if (cmp_res < 0)
- {
- /* The number is between 0 and 1. Guess should start at 1. */
- guess = bc_copy_num (BCG(_one_));
- cscale = (*num)->n_scale;
- }
- else
- {
- /* The number is greater than 1. Guess should start at 10^(exp/2). */
- bc_int2num (&guess,10);
-
- bc_int2num (&guess1,(*num)->n_len);
- bc_multiply (guess1, point5, &guess1, 0 TSRMLS_CC);
- guess1->n_scale = 0;
- bc_raise (guess, guess1, &guess, 0 TSRMLS_CC);
- bc_free_num (&guess1);
- cscale = 3;
- }
-
- /* Find the square root using Newton's algorithm. */
- done = FALSE;
- while (!done)
- {
- bc_free_num (&guess1);
- guess1 = bc_copy_num (guess);
- bc_divide (*num, guess, &guess, cscale TSRMLS_CC);
- bc_add (guess, guess1, &guess, 0);
- bc_multiply (guess, point5, &guess, cscale TSRMLS_CC);
- bc_sub (guess, guess1, &diff, cscale+1);
- if (bc_is_near_zero (diff, cscale))
- {
- if (cscale < rscale+1)
- cscale = MIN (cscale*3, rscale+1);
- else
- done = TRUE;
- }
- }
-
- /* Assign the number and clean up. */
- bc_free_num (num);
- bc_divide (guess,BCG(_one_),num,rscale TSRMLS_CC);
- bc_free_num (&guess);
- bc_free_num (&guess1);
- bc_free_num (&point5);
- bc_free_num (&diff);
- return 1;
-}
-
diff --git a/ext/bcmath/libbcmath/src/str2num.c b/ext/bcmath/libbcmath/src/str2num.c
deleted file mode 100644
index c484c158e5..0000000000
--- a/ext/bcmath/libbcmath/src/str2num.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* str2num.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* Convert strings to bc numbers. Base 10 only.*/
-
-void
-bc_str2num (bc_num *num, char *str, int scale TSRMLS_DC)
-{
- int digits, strscale;
- char *ptr, *nptr;
- char zero_int;
-
- /* Prepare num. */
- bc_free_num (num);
-
- /* Check for valid number and count digits. */
- ptr = str;
- digits = 0;
- strscale = 0;
- zero_int = FALSE;
- if ( (*ptr == '+') || (*ptr == '-')) ptr++; /* Sign */
- while (*ptr == '0') ptr++; /* Skip leading zeros. */
- while (isdigit((int)*ptr)) ptr++, digits++; /* digits */
- if (*ptr == '.') ptr++; /* decimal point */
- while (isdigit((int)*ptr)) ptr++, strscale++; /* digits */
- if ((*ptr != '\0') || (digits+strscale == 0))
- {
- *num = bc_copy_num (BCG(_zero_));
- return;
- }
-
- /* Adjust numbers and allocate storage and initialize fields. */
- strscale = MIN(strscale, scale);
- if (digits == 0)
- {
- zero_int = TRUE;
- digits = 1;
- }
- *num = bc_new_num (digits, strscale);
-
- /* Build the whole number. */
- ptr = str;
- if (*ptr == '-')
- {
- (*num)->n_sign = MINUS;
- ptr++;
- }
- else
- {
- (*num)->n_sign = PLUS;
- if (*ptr == '+') ptr++;
- }
- while (*ptr == '0') ptr++; /* Skip leading zeros. */
- nptr = (*num)->n_value;
- if (zero_int)
- {
- *nptr++ = 0;
- digits = 0;
- }
- for (;digits > 0; digits--)
- *nptr++ = CH_VAL(*ptr++);
-
-
- /* Build the fractional part. */
- if (strscale > 0)
- {
- ptr++; /* skip the decimal point! */
- for (;strscale > 0; strscale--)
- *nptr++ = CH_VAL(*ptr++);
- }
-}
-
diff --git a/ext/bcmath/libbcmath/src/sub.c b/ext/bcmath/libbcmath/src/sub.c
deleted file mode 100644
index 2dd8eb5ecc..0000000000
--- a/ext/bcmath/libbcmath/src/sub.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* sub.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Here is the full subtract routine that takes care of negative numbers.
- N2 is subtracted from N1 and the result placed in RESULT. SCALE_MIN
- is the minimum scale for the result. */
-
-void
-bc_sub (n1, n2, result, scale_min)
- bc_num n1, n2, *result;
- int scale_min;
-{
- bc_num diff = NULL;
- int cmp_res;
- int res_scale;
-
- if (n1->n_sign != n2->n_sign)
- {
- diff = _bc_do_add (n1, n2, scale_min);
- diff->n_sign = n1->n_sign;
- }
- else
- {
- /* subtraction must be done. */
- /* Compare magnitudes. */
- cmp_res = _bc_do_compare (n1, n2, FALSE, FALSE);
- switch (cmp_res)
- {
- case -1:
- /* n1 is less than n2, subtract n1 from n2. */
- diff = _bc_do_sub (n2, n1, scale_min);
- diff->n_sign = (n2->n_sign == PLUS ? MINUS : PLUS);
- break;
- case 0:
- /* They are equal! return zero! */
- res_scale = MAX (scale_min, MAX(n1->n_scale, n2->n_scale));
- diff = bc_new_num (1, res_scale);
- memset (diff->n_value, 0, res_scale+1);
- break;
- case 1:
- /* n2 is less than n1, subtract n2 from n1. */
- diff = _bc_do_sub (n1, n2, scale_min);
- diff->n_sign = n1->n_sign;
- break;
- }
- }
-
- /* Clean up and return. */
- bc_free_num (result);
- *result = diff;
-}
-
diff --git a/ext/bcmath/libbcmath/src/zero.c b/ext/bcmath/libbcmath/src/zero.c
deleted file mode 100644
index 4ee249ee71..0000000000
--- a/ext/bcmath/libbcmath/src/zero.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* zero.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* In some places we need to check if the number NUM is zero. */
-
-char
-bc_is_zero (bc_num num TSRMLS_DC)
-{
- int count;
- char *nptr;
-
- /* Quick check. */
- if (num == BCG(_zero_)) return TRUE;
-
- /* Initialize */
- count = num->n_len + num->n_scale;
- nptr = num->n_value;
-
- /* The check */
- while ((count > 0) && (*nptr++ == 0)) count--;
-
- if (count != 0)
- return FALSE;
- else
- return TRUE;
-}
-
diff --git a/ext/bcmath/php_bcmath.h b/ext/bcmath/php_bcmath.h
deleted file mode 100644
index 1e7e747f6b..0000000000
--- a/ext/bcmath/php_bcmath.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Andi Gutmans <andi@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_BCMATH_H
-#define PHP_BCMATH_H
-
-#if WITH_BCMATH
-
-#include "libbcmath/src/bcmath.h"
-
-ZEND_BEGIN_MODULE_GLOBALS(bcmath)
- bc_num _zero_;
- bc_num _one_;
- bc_num _two_;
-ZEND_END_MODULE_GLOBALS(bcmath)
-
-#if ZTS
-# define BCG(v) TSRMG(bcmath_globals_id, zend_bcmath_globals *, v)
-extern int bcmath_globals_id;
-#else
-# define BCG(v) (bcmath_globals.v)
-extern zend_bcmath_globals bcmath_globals;
-#endif
-
-#define BC
-
-extern zend_module_entry bcmath_module_entry;
-#define phpext_bcmath_ptr &bcmath_module_entry
-
-#if ZTS
-PHP_MINIT_FUNCTION(bcmath);
-#endif
-PHP_RINIT_FUNCTION(bcmath);
-PHP_RSHUTDOWN_FUNCTION(bcmath);
-PHP_MINFO_FUNCTION(bcmath);
-
-PHP_FUNCTION(bcadd);
-PHP_FUNCTION(bcsub);
-PHP_FUNCTION(bcmul);
-PHP_FUNCTION(bcdiv);
-PHP_FUNCTION(bcmod);
-PHP_FUNCTION(bcpow);
-PHP_FUNCTION(bcsqrt);
-PHP_FUNCTION(bccomp);
-PHP_FUNCTION(bcscale);
-PHP_FUNCTION(bcpowmod);
-
-#else
-
-#define phpext_bcmath_ptr NULL
-
-#endif
-
-#endif /* PHP_BCMATH_H */
diff --git a/ext/bcmath/tests/bcadd.phpt b/ext/bcmath/tests/bcadd.phpt
deleted file mode 100644
index 61552eecde..0000000000
--- a/ext/bcmath/tests/bcadd.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-bcadd() function
---SKIPIF--
-<?php if(!extension_loaded("bcmath")) print "skip"; ?>
---INI--
-bcmath.scale=0
---FILE--
-<?php
-echo bcadd("1", "2"),"\n";
-echo bcadd("-1", "5", 4),"\n";
-echo bcadd("1928372132132819737213", "8728932001983192837219398127471", 2),"\n";
-?>
---EXPECT--
-3
-4.0000
-8728932003911564969352217864684.00
diff --git a/ext/bcmath/tests/bccomp.phpt b/ext/bcmath/tests/bccomp.phpt
deleted file mode 100644
index b2bf9f4ac2..0000000000
--- a/ext/bcmath/tests/bccomp.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-bccomp() function
---SKIPIF--
-<?php if(!extension_loaded("bcmath")) print "skip"; ?>
---INI--
-bcmath.scale=0
---FILE--
-<?php
-echo bccomp("-1", "5", 4),"\n";
-echo bccomp("1928372132132819737213", "8728932001983192837219398127471"),"\n";
-echo bccomp("1.00000000000000000001", "1", 2),"\n";
-echo bccomp("97321", "2321"),"\n";
-?>
---EXPECT--
--1
--1
-0
-1
diff --git a/ext/bcmath/tests/bcdiv.phpt b/ext/bcmath/tests/bcdiv.phpt
deleted file mode 100644
index cda19496d5..0000000000
--- a/ext/bcmath/tests/bcdiv.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-bcdiv() function
---SKIPIF--
-<?php if(!extension_loaded("bcmath")) print "skip"; ?>
---INI--
-bcmath.scale=0
---FILE--
-<?php
-echo bcdiv("1", "2"),"\n";
-echo bcdiv("1", "2", 2),"\n";
-echo bcdiv("-1", "5", 4),"\n";
-echo bcdiv("8728932001983192837219398127471", "1928372132132819737213", 2),"\n";
-?>
---EXPECT--
-0
-0.50
--0.2000
-4526580661.75
diff --git a/ext/bcmath/tests/bcmod.phpt b/ext/bcmath/tests/bcmod.phpt
deleted file mode 100644
index 1d7be48a75..0000000000
--- a/ext/bcmath/tests/bcmod.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-bcmod() function
---SKIPIF--
-<?php if(!extension_loaded("bcmath")) print "skip"; ?>
---INI--
-bcmath.scale=0
---FILE--
-<?php
-echo bcmod("11", "2"),"\n";
-echo bcmod("-1", "5"),"\n";
-echo bcmod("8728932001983192837219398127471", "1928372132132819737213"),"\n";
-?>
---EXPECT--
-1
--1
-1459434331351930289678
diff --git a/ext/bcmath/tests/bcmul.phpt b/ext/bcmath/tests/bcmul.phpt
deleted file mode 100644
index 0ff322fe32..0000000000
--- a/ext/bcmath/tests/bcmul.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-bcmul() function
---SKIPIF--
-<?php if(!extension_loaded("bcmath")) print "skip"; ?>
---INI--
-bcmath.scale=0
---FILE--
-<?php
-echo bcmul("1", "2"),"\n";
-echo bcmul("-3", "5"),"\n";
-echo bcmul("1234567890", "9876543210"),"\n";
-echo bcmul("2.5", "1.5", 2),"\n";
-?>
---EXPECT--
-2
--15
-12193263111263526900
-3.75
diff --git a/ext/bcmath/tests/bcpow.phpt b/ext/bcmath/tests/bcpow.phpt
deleted file mode 100644
index bdd4e08cab..0000000000
--- a/ext/bcmath/tests/bcpow.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-bcpow() function
---SKIPIF--
-<?php if(!extension_loaded("bcmath")) print "skip"; ?>
---INI--
-bcmath.scale=0
---FILE--
-<?php
-echo bcpow("1", "2"),"\n";
-echo bcpow("-2", "5", 4),"\n";
-echo bcpow("2", "64"),"\n";
-?>
---EXPECT--
-1
--32
-18446744073709551616
diff --git a/ext/bcmath/tests/bcscale.phpt b/ext/bcmath/tests/bcscale.phpt
deleted file mode 100644
index 4fc2f85eb9..0000000000
--- a/ext/bcmath/tests/bcscale.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-bcscale() function
---SKIPIF--
-<?php if(!extension_loaded("bcmath")) print "skip"; ?>
---INI--
-bcmath.scale=0
---FILE--
-<?php
-echo bcadd("1", "2"),"\n";
-bcscale(2);
-echo bcadd("1", "2"),"\n";
-bcscale(10);
-echo bcadd("1", "2"),"\n";
-bcscale(0);
-echo bcadd("1", "2"),"\n";
-?>
---EXPECT--
-3
-3.00
-3.0000000000
-3
diff --git a/ext/bcmath/tests/bcsqrt.phpt b/ext/bcmath/tests/bcsqrt.phpt
deleted file mode 100644
index 46d92fd5ed..0000000000
--- a/ext/bcmath/tests/bcsqrt.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-bcsqrt() function
---SKIPIF--
-<?php if(!extension_loaded("bcmath")) print "skip"; ?>
---INI--
-bcmath.scale=0
---FILE--
-<?php
-echo bcsqrt("9"),"\n";
-echo bcsqrt("1928372132132819737213", 5),"\n";
-?>
---EXPECT--
-3
-43913234134.28826
diff --git a/ext/bcmath/tests/bcsub.phpt b/ext/bcmath/tests/bcsub.phpt
deleted file mode 100644
index 71726492f7..0000000000
--- a/ext/bcmath/tests/bcsub.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-bcsub() function
---SKIPIF--
-<?php if(!extension_loaded("bcmath")) print "skip"; ?>
---INI--
-bcmath.scale=0
---FILE--
-<?php
-echo bcsub("1", "2"),"\n";
-echo bcsub("-1", "5", 4),"\n";
-echo bcsub("8728932001983192837219398127471", "1928372132132819737213", 2),"\n";
-?>
---EXPECT--
--1
--6.0000
-8728932000054820705086578390258.00
diff --git a/ext/calendar/CREDITS b/ext/calendar/CREDITS
deleted file mode 100644
index a2904bd8b2..0000000000
--- a/ext/calendar/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Calendar
-Shane Caraveo, Colin Viebrock, Hartmut Holzgraefe, Wez Furlong
diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c
deleted file mode 100644
index 80a6dcf284..0000000000
--- a/ext/calendar/cal_unix.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Shane Caraveo <shane@caraveo.com> |
- | Colin Viebrock <colin@easydns.com> |
- | Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id: */
-
-#include "php.h"
-#include "php_calendar.h"
-#include "sdncal.h"
-#include <time.h>
-
-/* {{{ proto int unixtojd([int timestamp])
- Convert UNIX timestamp to Julian Day */
-PHP_FUNCTION(unixtojd)
-{
- pval *timestamp;
- long jdate;
- time_t t;
- struct tm *ta, tmbuf;
- int myargc=ZEND_NUM_ARGS();
-
- if ((myargc > 1) || (zend_get_parameters(ht, myargc, &timestamp) != SUCCESS)) {
- WRONG_PARAM_COUNT;
- }
-
- if(myargc==1) {
- convert_to_long(timestamp);
- t = Z_LVAL_P(timestamp);
- } else {
- t = time(NULL);
- }
-
- if(t < 0) {
- RETURN_FALSE;
- }
-
- ta = php_localtime_r(&t, &tmbuf);
- jdate = GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1, ta->tm_mday);
-
- RETURN_LONG(jdate);
-}
-/* }}} */
-
-/* {{{ proto int jdtounix(int jday)
- Convert Julian Day to UNIX timestamp */
-PHP_FUNCTION(jdtounix)
-{
- pval *jday;
- long uday;
-
- if ((ZEND_NUM_ARGS()!= 1) || (zend_get_parameters(ht, 1, &jday) != SUCCESS)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(jday);
-
- uday = Z_LVAL_P(jday) - 2440588 /* J.D. of 1.1.1970 */;
-
- if(uday<0) RETURN_FALSE; /* before beginning of unix epoch */
- if(uday>24755) RETURN_FALSE; /* behind end of unix epoch */
-
- RETURN_LONG(uday*24*3600);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c
deleted file mode 100644
index 8664c12910..0000000000
--- a/ext/calendar/calendar.c
+++ /dev/null
@@ -1,639 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Shane Caraveo <shane@caraveo.com> |
- | Colin Viebrock <colin@easydns.com> |
- | Hartmut Holzgraefe <hholzgra@php.net> |
- | Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef PHP_WIN32
-#define _WINNLS_
-#endif
-
-#include "php.h"
-#include "ext/standard/info.h"
-#include "php_calendar.h"
-#include "sdncal.h"
-
-#include <stdio.h>
-
-function_entry calendar_functions[] = {
- PHP_FE(jdtogregorian, NULL)
- PHP_FE(gregoriantojd, NULL)
- PHP_FE(jdtojulian, NULL)
- PHP_FE(juliantojd, NULL)
- PHP_FE(jdtojewish, NULL)
- PHP_FE(jewishtojd, NULL)
- PHP_FE(jdtofrench, NULL)
- PHP_FE(frenchtojd, NULL)
- PHP_FE(jddayofweek, NULL)
- PHP_FE(jdmonthname, NULL)
- PHP_FE(easter_date, NULL)
- PHP_FE(easter_days, NULL)
- PHP_FE(unixtojd, NULL)
- PHP_FE(jdtounix, NULL)
- PHP_FE(cal_to_jd, NULL)
- PHP_FE(cal_from_jd, NULL)
- PHP_FE(cal_days_in_month, NULL)
- PHP_FE(cal_info, NULL)
- {NULL, NULL, NULL}
-};
-
-
-zend_module_entry calendar_module_entry = {
- STANDARD_MODULE_HEADER,
- "calendar",
- calendar_functions,
- PHP_MINIT(calendar),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(calendar),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES,
-};
-
-#ifdef COMPILE_DL_CALENDAR
-ZEND_GET_MODULE(calendar)
-#endif
-
-/* this order must match the conversion table below */
-enum cal_name_type_t {
- CAL_GREGORIAN = 0,
- CAL_JULIAN,
- CAL_JEWISH,
- CAL_FRENCH,
- CAL_NUM_CALS
-};
-
-typedef long int (*cal_to_jd_func_t) (int month, int day, int year);
-typedef void (*cal_from_jd_func_t) (long int jd, int *year, int *month, int *day);
-typedef char *(*cal_as_string_func_t) (int year, int month, int day);
-
-struct cal_entry_t {
- char *name;
- char *symbol;
- cal_to_jd_func_t to_jd;
- cal_from_jd_func_t from_jd;
- int num_months;
- int max_days_in_month;
- char **month_name_short;
- char **month_name_long;
-};
-
-static struct cal_entry_t cal_conversion_table[CAL_NUM_CALS] = {
- {"Gregorian", "CAL_GREGORIAN", GregorianToSdn, SdnToGregorian, 12, 31,
- MonthNameShort, MonthNameLong},
- {"Julian", "CAL_JULIAN", JulianToSdn, SdnToJulian, 12, 31,
- MonthNameShort, MonthNameLong},
- {"Jewish", "CAL_JEWISH", JewishToSdn, SdnToJewish, 13, 30,
- JewishMonthName, JewishMonthName},
- {"French", "CAL_FRENCH", FrenchToSdn, SdnToFrench, 13, 30,
- FrenchMonthName, FrenchMonthName}
-};
-
-/* For jddayofweek */
-enum { CAL_DOW_DAYNO, CAL_DOW_SHORT, CAL_DOW_LONG };
-
-/* For jdmonthname */
-enum { CAL_MONTH_GREGORIAN_SHORT, CAL_MONTH_GREGORIAN_LONG,
- CAL_MONTH_JULIAN_SHORT, CAL_MONTH_JULIAN_LONG, CAL_MONTH_JEWISH,
- CAL_MONTH_FRENCH
-};
-
-/* for heb_number_to_chars */
-static char alef_bet[25] = "0àáâãäåæçèéëìîðñòôö÷øùú";
-
-#define CAL_JEWISH_ADD_ALAFIM_GERESH 0x2
-#define CAL_JEWISH_ADD_ALAFIM 0x4
-#define CAL_JEWISH_ADD_GERESHAYIM 0x8
-
-PHP_MINIT_FUNCTION(calendar)
-{
- REGISTER_LONG_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_FRENCH", CAL_FRENCH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_NUM_CALS", CAL_NUM_CALS, CONST_CS | CONST_PERSISTENT);
-/* constants for jddayofweek */
- REGISTER_LONG_CONSTANT("CAL_DOW_DAYNO", CAL_DOW_DAYNO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_DOW_SHORT", CAL_DOW_SHORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_DOW_LONG", CAL_DOW_LONG, CONST_CS | CONST_PERSISTENT);
-/* constants for jdmonthname */
- REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_SHORT", CAL_MONTH_GREGORIAN_SHORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_LONG", CAL_MONTH_GREGORIAN_LONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_SHORT", CAL_MONTH_JULIAN_SHORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_LONG", CAL_MONTH_JULIAN_LONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_MONTH_JEWISH", CAL_MONTH_JEWISH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_MONTH_FRENCH", CAL_MONTH_FRENCH, CONST_CS | CONST_PERSISTENT);
-/* constants for easter calculation */
- REGISTER_LONG_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_EASTER_ROMAN", CAL_EASTER_ROMAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_GREGORIAN", CAL_EASTER_ALWAYS_GREGORIAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT);
-/* constants for Jewish date formatting */
- REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM_GERESH", CAL_JEWISH_ADD_ALAFIM_GERESH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM", CAL_JEWISH_ADD_ALAFIM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_GERESHAYIM", CAL_JEWISH_ADD_GERESHAYIM, CONST_CS | CONST_PERSISTENT);
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(calendar)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Calendar support", "enabled");
- php_info_print_table_end();
-}
-
-/* {{{ proto array cal_info(int calendar)
- Returns information about a particular calendar */
-PHP_FUNCTION(cal_info)
-{
- long cal;
- zval *months, *smonths;
- int i;
- struct cal_entry_t *calendar;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &cal) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (cal < 0 || cal >= CAL_NUM_CALS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %d.", cal);
- RETURN_FALSE;
- }
-
- calendar = &cal_conversion_table[cal];
- array_init(return_value);
-
- MAKE_STD_ZVAL(months);
- MAKE_STD_ZVAL(smonths);
- array_init(months);
- array_init(smonths);
-
- for (i = 1; i <= calendar->num_months; i++) {
- add_index_string(months, i, calendar->month_name_long[i], 1);
- add_index_string(smonths, i, calendar->month_name_short[i], 1);
- }
- add_assoc_zval(return_value, "months", months);
- add_assoc_zval(return_value, "abbrevmonths", smonths);
- add_assoc_long(return_value, "maxdaysinmonth", calendar->max_days_in_month);
- add_assoc_string(return_value, "calname", calendar->name, 1);
- add_assoc_string(return_value, "calsymbol", calendar->symbol, 1);
-
-}
-/* }}} */
-
-/* {{{ proto int cal_days_in_month(int calendar, int month, int year)
- Returns the number of days in a month for a given year and calendar */
-PHP_FUNCTION(cal_days_in_month)
-{
- long cal, month, year;
- struct cal_entry_t *calendar;
- long sdn_start, sdn_next;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &cal, &month, &year) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (cal < 0 || cal >= CAL_NUM_CALS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %d.", cal);
- RETURN_FALSE;
- }
-
- calendar = &cal_conversion_table[cal];
-
- sdn_start = calendar->to_jd(year, month, 1);
-
- sdn_next = calendar->to_jd(year, 1 + month, 1);
-
- if (sdn_next == 0) {
-/* if invalid, try first month of the next year... */
- sdn_next = calendar->to_jd(year + 1, 1, 1);
- }
-
- RETURN_LONG(sdn_next - sdn_start);
-}
-/* }}} */
-
-/* {{{ proto int cal_to_jd(int calendar, int month, int day, int year)
- Converts from a supported calendar to Julian Day Count */
-PHP_FUNCTION(cal_to_jd)
-{
- long cal, month, day, year, jdate;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &cal, &month, &day, &year) != SUCCESS) {
- RETURN_FALSE;
- }
-
- if (cal < 0 || cal >= CAL_NUM_CALS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %d.", cal);
- RETURN_FALSE;
- }
-
- jdate = cal_conversion_table[cal].to_jd(year, month, day);
- RETURN_LONG(jdate);
-}
-/* }}} */
-
-/* {{{ proto array cal_from_jd(int jd, int calendar)
- Converts from Julian Day Count to a supported calendar and return extended information */
-PHP_FUNCTION(cal_from_jd)
-{
- long jd, cal;
- int month, day, year, dow;
- char date[16];
- struct cal_entry_t *calendar;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS()TSRMLS_CC, "ll", &jd, &cal) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (cal < 0 || cal >= CAL_NUM_CALS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %d", cal);
- RETURN_FALSE;
- }
- calendar = &cal_conversion_table[cal];
-
- array_init(return_value);
-
- calendar->from_jd(jd, &year, &month, &day);
-
- sprintf(date, "%i/%i/%i", month, day, year);
- add_assoc_string(return_value, "date", date, 1);
-
- add_assoc_long(return_value, "month", month);
- add_assoc_long(return_value, "day", day);
- add_assoc_long(return_value, "year", year);
-
-/* day of week */
- dow = DayOfWeek(jd);
- add_assoc_long(return_value, "dow", dow);
- add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow], 1);
- add_assoc_string(return_value, "dayname", DayNameLong[dow], 1);
-/* month name */
- add_assoc_string(return_value, "abbrevmonth", calendar->month_name_short[month], 1);
- add_assoc_string(return_value, "monthname", calendar->month_name_long[month], 1);
-}
-/* }}} */
-
-/* {{{ proto string jdtogregorian(int juliandaycount)
- Converts a julian day count to a gregorian calendar date */
-PHP_FUNCTION(jdtogregorian)
-{
- long julday;
- int year, month, day;
- char date[10];
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) {
- RETURN_FALSE;
- }
-
- SdnToGregorian(julday, &year, &month, &day);
- sprintf(date, "%i/%i/%i", month, day, year);
-
- RETURN_STRING(date, 1);
-}
-/* }}} */
-
-/* {{{ proto int gregoriantojd(int month, int day, int year)
- Converts a gregorian calendar date to julian day count */
-PHP_FUNCTION(gregoriantojd)
-{
- long year, month, day;
- int jdate;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
- RETURN_FALSE;
- }
-
- jdate = GregorianToSdn(year, month, day);
-
- RETURN_LONG(jdate);
-}
-/* }}} */
-
-/* {{{ proto string jdtojulian(int juliandaycount)
- Convert a julian day count to a julian calendar date */
-PHP_FUNCTION(jdtojulian)
-{
- long julday;
- int year, month, day;
- char date[10];
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) {
- RETURN_FALSE;
- }
-
- SdnToJulian(julday, &year, &month, &day);
- sprintf(date, "%i/%i/%i", month, day, year);
-
- RETURN_STRING(date, 1);
-}
-/* }}} */
-
-/* {{{ proto int juliantojd(int month, int day, int year)
- Converts a julian calendar date to julian day count */
-PHP_FUNCTION(juliantojd)
-{
- long year, month, day;
- int jdate;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
- RETURN_FALSE;
- }
-
- jdate = JulianToSdn(year, month, day);
-
- RETURN_LONG(jdate);
-}
-/* }}} */
-
-/* {{{ heb_number_to_chars*/
-/*
-caution: the Hebrew format produces non unique result.
-for example both: year '5' and year '5000' produce 'ä'.
-use the numeric one for calculations.
- */
-static char *heb_number_to_chars(int n, int fl, char **ret)
-{
- char *p, old[18], *endofalafim;
-
- p = endofalafim = old;
-/*
- prevents the option breaking the jewish beliefs, and some other
- critical resources ;)
- */
- if (n > 9999 || n < 1) {
- *ret = NULL;
- return NULL;
- }
-
-/* alafim (thousands) case */
- if (n / 1000) {
- *p = alef_bet[n / 1000];
- p++;
-
- if (CAL_JEWISH_ADD_ALAFIM_GERESH & fl) {
- *p = '\'';
- p++;
- }
- if (CAL_JEWISH_ADD_ALAFIM & fl) {
- strcpy(p, " àìôéí ");
- p += 7;
- }
-
- endofalafim = p;
- n = n % 1000;
- }
-
-/* tav-tav (tav=400) case */
- while (n >= 400) {
- *p = alef_bet[22];
- p++;
- n -= 400;
- }
-
-/* meot (hundreads) case */
- if (n >= 100) {
- *p = alef_bet[18 + n / 100];
- p++;
- n = n % 100;
- }
-
-/* tet-vav & tet-zain case (special case for 15 and 16) */
- if (n == 15 || n == 16) {
- *p = alef_bet[9];
- p++;
- *p = alef_bet[n - 9];
- p++;
- } else {
-/* asarot (tens) case */
- if (n >= 10) {
- *p = alef_bet[9 + n / 10];
- p++;
- n = n % 10;
- }
-
-/* yehidot (ones) case */
- if (n > 0) {
- *p = alef_bet[n];
- p++;
- }
- }
-
- if (CAL_JEWISH_ADD_GERESHAYIM & fl) {
- switch (p - endofalafim) {
- case 0:
- break;
- case 1:
- *p = '\'';
- p++;
- break;
- default:
- *(p) = *(p - 1);
- *(p - 1) = '"';
- p++;
- }
- }
-
- *p = '\0';
- *ret = estrndup(old, (p - old) + 1);
- p = *ret;
- return p;
-}
-/* }}} */
-
-/* {{{ proto string jdtojewish(int juliandaycount [, bool hebrew [, int fl]])
- Converts a julian day count to a jewish calendar date */
-PHP_FUNCTION(jdtojewish)
-{
- long julday, fl = 0;
- zend_bool heb = 0;
- int year, month, day;
- char date[10], hebdate[25];
- char *dayp, *yearp;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|bl", &julday, &heb, &fl) == FAILURE) {
- RETURN_FALSE;
- }
-
- SdnToJewish(julday, &year, &month, &day);
- if (!heb) {
- sprintf(date, "%i/%i/%i", month, day, year);
- RETURN_STRING(date, 1);
- } else {
- if (year <= 0 || year > 9999) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Year out of range (0-9999).");
- RETURN_FALSE;
- }
-
- sprintf(hebdate, "%s %s %s", heb_number_to_chars(day, fl, &dayp), JewishMonthHebName[month], heb_number_to_chars(year, fl, &yearp));
-
- if (dayp) {
- efree(dayp);
- }
- if (yearp) {
- efree(yearp);
- }
-
- RETURN_STRING(hebdate, 1);
-
- }
-}
-/* }}} */
-
-/* {{{ proto int jewishtojd(int month, int day, int year)
- Converts a jewish calendar date to a julian day count */
-PHP_FUNCTION(jewishtojd)
-{
- long year, month, day;
- int jdate;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
- RETURN_FALSE;
- }
-
- jdate = JewishToSdn(year, month, day);
-
- RETURN_LONG(jdate);
-}
-/* }}} */
-
-/* {{{ proto string jdtofrench(int juliandaycount)
- Converts a julian day count to a french republic calendar date */
-PHP_FUNCTION(jdtofrench)
-{
- long julday;
- int year, month, day;
- char date[10];
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) {
- RETURN_FALSE;
- }
-
- SdnToFrench(julday, &year, &month, &day);
- sprintf(date, "%i/%i/%i", month, day, year);
-
- RETURN_STRING(date, 1);
-}
-/* }}} */
-
-/* {{{ proto int frenchtojd(int month, int day, int year)
- Converts a french republic calendar date to julian day count */
-PHP_FUNCTION(frenchtojd)
-{
- long year, month, day;
- int jdate;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
- RETURN_FALSE;
- }
-
- jdate = FrenchToSdn(year, month, day);
-
- RETURN_LONG(jdate);
-}
-/* }}} */
-
-/* {{{ proto mixed jddayofweek(int juliandaycount [, int mode])
- Returns name or number of day of week from julian day count */
-PHP_FUNCTION(jddayofweek)
-{
- long julday, mode = CAL_DOW_DAYNO;
- int day;
- char *daynamel, *daynames;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &julday, &mode) == FAILURE) {
- RETURN_FALSE;
- }
-
- day = DayOfWeek(julday);
- daynamel = DayNameLong[day];
- daynames = DayNameShort[day];
-
- switch (mode) {
- case CAL_DOW_SHORT:
- RETURN_STRING(daynamel, 1);
- break;
- case CAL_DOW_LONG:
- RETURN_STRING(daynames, 1);
- break;
- case CAL_DOW_DAYNO:
- default:
- RETURN_LONG(day);
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto string jdmonthname(int juliandaycount, int mode)
- Returns name of month for julian day count */
-PHP_FUNCTION(jdmonthname)
-{
- long julday, mode;
- char *monthname = NULL;
- int month, day, year;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &julday, &mode) == FAILURE) {
- RETURN_FALSE;
- }
-
- switch (mode) {
- case CAL_MONTH_GREGORIAN_LONG: /* gregorian or julian month */
- SdnToGregorian(julday, &year, &month, &day);
- monthname = MonthNameLong[month];
- break;
- case CAL_MONTH_JULIAN_SHORT: /* gregorian or julian month */
- SdnToJulian(julday, &year, &month, &day);
- monthname = MonthNameShort[month];
- break;
- case CAL_MONTH_JULIAN_LONG: /* gregorian or julian month */
- SdnToJulian(julday, &year, &month, &day);
- monthname = MonthNameLong[month];
- break;
- case CAL_MONTH_JEWISH: /* jewish month */
- SdnToJewish(julday, &year, &month, &day);
- monthname = JewishMonthName[month];
- break;
- case CAL_MONTH_FRENCH: /* french month */
- SdnToFrench(julday, &year, &month, &day);
- monthname = FrenchMonthName[month];
- break;
- default: /* default gregorian */
- case CAL_MONTH_GREGORIAN_SHORT: /* gregorian or julian month */
- SdnToGregorian(julday, &year, &month, &day);
- monthname = MonthNameShort[month];
- break;
- }
-
- RETURN_STRING(monthname, 1);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/calendar/config.m4 b/ext/calendar/config.m4
deleted file mode 100644
index a80101adbb..0000000000
--- a/ext/calendar/config.m4
+++ /dev/null
@@ -1,11 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(calendar,whether to enable calendar conversion support,
-[ --enable-calendar Enable support for calendar conversion])
-
-if test "$PHP_CALENDAR" = "yes"; then
- AC_DEFINE(HAVE_CALENDAR,1,[ ])
- PHP_NEW_EXTENSION(calendar, calendar.c dow.c french.c gregor.c jewish.c julian.c easter.c cal_unix.c, $ext_shared)
-fi
diff --git a/ext/calendar/dow.c b/ext/calendar/dow.c
deleted file mode 100644
index 64ae008f77..0000000000
--- a/ext/calendar/dow.c
+++ /dev/null
@@ -1,76 +0,0 @@
-
-/* $selId: dow.c,v 2.0 1995/10/24 01:13:06 lees Exp $
- * Copyright 1993-1995, Scott E. Lee, all rights reserved.
- * Permission granted to use, copy, modify, distribute and sell so long as
- * the above copyright and this permission statement are retained in all
- * copies. THERE IS NO WARRANTY - USE AT YOUR OWN RISK.
- */
-
-/**************************************************************************
- *
- * These are the externally visible components of this file:
- *
- * int
- * DayOfWeek(
- * long int sdn);
- *
- * Convert a SDN to a day-of-week number (0 to 6). Where 0 stands for
- * Sunday, 1 for Monday, etc. and 6 stands for Saturday.
- *
- * char *DayNameShort[7];
- *
- * Convert a day-of-week number (0 to 6), as returned from DayOfWeek(), to
- * the abbreviated (three character) name of the day.
- *
- * char *DayNameLong[7];
- *
- * Convert a day-of-week number (0 to 6), as returned from DayOfWeek(), to
- * the name of the day.
- *
- **************************************************************************/
-
-#include "sdncal.h"
-
-int DayOfWeek(
- long int sdn)
-{
- int dow;
-
- dow = (sdn + 1) % 7;
- if (dow >= 0) {
- return (dow);
- } else {
- return (dow + 7);
- }
-}
-
-char *DayNameShort[7] =
-{
- "Sun",
- "Mon",
- "Tue",
- "Wed",
- "Thu",
- "Fri",
- "Sat"
-};
-
-char *DayNameLong[7] =
-{
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday"
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/calendar/easter.c b/ext/calendar/easter.c
deleted file mode 100644
index 758ee512ab..0000000000
--- a/ext/calendar/easter.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Shane Caraveo <shane@caraveo.com> |
- | Colin Viebrock <colin@easydns.com> |
- | Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id: */
-
-#include "php.h"
-#include "php_calendar.h"
-#include "sdncal.h"
-#include <time.h>
-
-static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm)
-{
-
- /* based on code by Simon Kershaw, <webmaster@ely.anglican.org> */
-
- struct tm te;
- long year, golden, solar, lunar, pfm, dom, tmp, easter;
- long method = CAL_EASTER_DEFAULT;
-
- /* Default to the current year if year parameter is not given */
- {
- time_t a;
- struct tm b;
- time(&a);
- php_localtime_r(&a, &b);
- year = 1900 + b.tm_year;
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
- "|ll", &year, &method) == FAILURE) {
- return;
- }
-
- if (gm && (year<1970 || year>2037)) { /* out of range for timestamps */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This function is only valid for years between 1970 and 2037 inclusive");
- RETURN_FALSE;
- }
-
- golden = (year % 19) + 1; /* the Golden number */
-
- if ((year <= 1582 && method != CAL_EASTER_ALWAYS_GREGORIAN) ||
- (year >= 1583 && year <= 1752 && method != CAL_EASTER_ROMAN && method != CAL_EASTER_ALWAYS_GREGORIAN) ||
- method == CAL_EASTER_ALWAYS_JULIAN) { /* JULIAN CALENDAR */
-
- dom = (year + (year/4) + 5) % 7; /* the "Dominical number" - finding a Sunday */
- if (dom < 0) {
- dom += 7;
- }
-
- pfm = (3 - (11*golden) - 7) % 30; /* uncorrected date of the Paschal full moon */
- if (pfm < 0) {
- pfm += 30;
- }
- } else { /* GREGORIAN CALENDAR */
- dom = (year + (year/4) - (year/100) + (year/400)) % 7; /* the "Domincal number" */
- if (dom < 0) {
- dom += 7;
- }
-
- solar = (year-1600)/100 - (year-1600)/400; /* the solar and lunar corrections */
- lunar = (((year-1400) / 100) * 8) / 25;
-
- pfm = (3 - (11*golden) + solar - lunar) % 30; /* uncorrected date of the Paschal full moon */
- if (pfm < 0) {
- pfm += 30;
- }
- }
-
- if ((pfm == 29) || (pfm == 28 && golden > 11)) { /* corrected date of the Paschal full moon */
- pfm--; /* - days after 21st March */
- }
-
- tmp = (4-pfm-dom) % 7;
- if (tmp < 0) {
- tmp += 7;
- }
-
- easter = pfm + tmp + 1; /* Easter as the number of days after 21st March */
-
- if (gm) { /* return a timestamp */
- te.tm_isdst = -1;
- te.tm_year = year-1900;
- te.tm_sec = 0;
- te.tm_min = 0;
- te.tm_hour = 0;
-
- if (easter < 11) {
- te.tm_mon = 2; /* March */
- te.tm_mday = easter+21;
- } else {
- te.tm_mon = 3; /* April */
- te.tm_mday = easter-10;
- }
-
- Z_LVAL_P(return_value) = mktime(&te);
- } else { /* return the days after March 21 */
- Z_LVAL_P(return_value) = easter;
- }
-
- Z_TYPE_P(return_value) = IS_LONG;
-
-}
-
-/* {{{ proto int easter_date([int year])
- Return the timestamp of midnight on Easter of a given year (defaults to current year) */
-PHP_FUNCTION(easter_date)
-{
- _cal_easter(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int easter_days([int year, [int method]])
- Return the number of days after March 21 that Easter falls on for a given year (defaults to current year) */
-PHP_FUNCTION(easter_days)
-{
- _cal_easter(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/calendar/french.c b/ext/calendar/french.c
deleted file mode 100644
index 5b4dd53750..0000000000
--- a/ext/calendar/french.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* $selId: french.c,v 2.0 1995/10/24 01:13:06 lees Exp $
- * Copyright 1993-1995, Scott E. Lee, all rights reserved.
- * Permission granted to use, copy, modify, distribute and sell so long as
- * the above copyright and this permission statement are retained in all
- * copies. THERE IS NO WARRANTY - USE AT YOUR OWN RISK.
- */
-
-/**************************************************************************
- *
- * These are the externally visible components of this file:
- *
- * void
- * SdnToFrench(
- * long int sdn,
- * int *pYear,
- * int *pMonth,
- * int *pDay);
- *
- * Convert a SDN to a French republican calendar date. If the input SDN is
- * before the first day of year 1 or after the last day of year 14, the
- * three output values will all be set to zero, otherwise *pYear will be in
- * the range 1 to 14 inclusive; *pMonth will be in the range 1 to 13
- * inclusive; *pDay will be in the range 1 to 30 inclusive. If *pMonth is
- * 13, the SDN represents one of the holidays at the end of the year and
- * *pDay will be in the range 1 to 6 inclusive.
- *
- * long int
- * FrenchToSdn(
- * int year,
- * int month,
- * int day);
- *
- * Convert a French republican calendar date to a SDN. Zero is returned
- * when the input date is detected as invalid or out of the supported
- * range. The return value will be > 0 for all valid, supported dates, but
- * there are some invalid dates that will return a positive value. To
- * verify that a date is valid, convert it to SDN and then back and compare
- * with the original.
- *
- * char *FrenchMonthName[14];
- *
- * Convert a French republican month number (1 to 13) to the name of the
- * French republican month (null terminated). An index of 13 (for the
- * "extra" days at the end of the year) will return the string "Extra". An
- * index of zero will return a zero length string.
- *
- * VALID RANGE
- *
- * These routines only convert dates in years 1 through 14 (Gregorian
- * dates 22 September 1792 through 22 September 1806). This more than
- * covers the period when the calendar was in use.
- *
- * I would support a wider range of dates, but I have not been able to
- * find an authoritative definition of when leap years were to have
- * occurred. There are suggestions that it was to skip a leap year ever
- * 100 years like the Gregorian calendar.
- *
- * CALENDAR OVERVIEW
- *
- * The French republican calendar was adopted in October 1793 during
- * the French Revolution and was abandoned in January 1806. The intent
- * was to create a new calendar system that was based on scientific
- * principals, not religious traditions.
- *
- * The year is divided into 12 months of 30 days each. The remaining 5
- * to 6 days in the year are grouped at the end and are holidays. Each
- * month is divided into three decades (instead of weeks) of 10 days
- * each.
- *
- * The epoch (first day of the first year) is 22 September 1792 in the
- * Gregorian calendar. Leap years are every fourth year (year 3, 7,
- * 11, etc.)
- *
- * TESTING
- *
- * This algorithm has been tested from the year 1 to 14. The source
- * code of the verification program is included in this package.
- *
- * REFERENCES
- *
- * I have found no detailed, authoritative reference on this calendar.
- * The algorithms are based on a preponderance of less authoritative
- * sources.
- *
- **************************************************************************/
-
-#include "sdncal.h"
-
-#define FRENCH_SDN_OFFSET 2375474
-#define DAYS_PER_4_YEARS 1461
-#define DAYS_PER_MONTH 30
-#define FIRST_VALID 2375840
-#define LAST_VALID 2380952
-
-void SdnToFrench(
- long int sdn,
- int *pYear,
- int *pMonth,
- int *pDay)
-{
- long int temp;
- int dayOfYear;
-
- if (sdn < FIRST_VALID || sdn > LAST_VALID) {
- *pYear = 0;
- *pMonth = 0;
- *pDay = 0;
- return;
- }
- temp = (sdn - FRENCH_SDN_OFFSET) * 4 - 1;
- *pYear = temp / DAYS_PER_4_YEARS;
- dayOfYear = (temp % DAYS_PER_4_YEARS) / 4;
- *pMonth = dayOfYear / DAYS_PER_MONTH + 1;
- *pDay = dayOfYear % DAYS_PER_MONTH + 1;
-}
-
-long int FrenchToSdn(
- int year,
- int month,
- int day)
-{
- /* check for invalid dates */
- if (year < 1 || year > 14 ||
- month < 1 || month > 13 ||
- day < 1 || day > 30) {
- return (0);
- }
- return ((year * DAYS_PER_4_YEARS) / 4
- + (month - 1) * DAYS_PER_MONTH
- + day
- + FRENCH_SDN_OFFSET);
-}
-
-char *FrenchMonthName[14] =
-{
- "",
- "Vendemiaire",
- "Brumaire",
- "Frimaire",
- "Nivose",
- "Pluviose",
- "Ventose",
- "Germinal",
- "Floreal",
- "Prairial",
- "Messidor",
- "Thermidor",
- "Fructidor",
- "Extra"
-};
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/calendar/gregor.c b/ext/calendar/gregor.c
deleted file mode 100644
index f48950901a..0000000000
--- a/ext/calendar/gregor.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* $selId: gregor.c,v 2.0 1995/10/24 01:13:06 lees Exp $
- * Copyright 1993-1995, Scott E. Lee, all rights reserved.
- * Permission granted to use, copy, modify, distribute and sell so long as
- * the above copyright and this permission statement are retained in all
- * copies. THERE IS NO WARRANTY - USE AT YOUR OWN RISK.
- */
-
-/**************************************************************************
- *
- * These are the externally visible components of this file:
- *
- * void
- * SdnToGregorian(
- * long int sdn,
- * int *pYear,
- * int *pMonth,
- * int *pDay);
- *
- * Convert a SDN to a Gregorian calendar date. If the input SDN is less
- * than 1, the three output values will all be set to zero, otherwise
- * *pYear will be >= -4714 and != 0; *pMonth will be in the range 1 to 12
- * inclusive; *pDay will be in the range 1 to 31 inclusive.
- *
- * long int
- * GregorianToSdn(
- * int inputYear,
- * int inputMonth,
- * int inputDay);
- *
- * Convert a Gregorian calendar date to a SDN. Zero is returned when the
- * input date is detected as invalid or out of the supported range. The
- * return value will be > 0 for all valid, supported dates, but there are
- * some invalid dates that will return a positive value. To verify that a
- * date is valid, convert it to SDN and then back and compare with the
- * original.
- *
- * char *MonthNameShort[13];
- *
- * Convert a Gregorian month number (1 to 12) to the abbreviated (three
- * character) name of the Gregorian month (null terminated). An index of
- * zero will return a zero length string.
- *
- * char *MonthNameLong[13];
- *
- * Convert a Gregorian month number (1 to 12) to the name of the Gregorian
- * month (null terminated). An index of zero will return a zero length
- * string.
- *
- * VALID RANGE
- *
- * 4714 B.C. to at least 10000 A.D.
- *
- * Although this software can handle dates all the way back to 4714
- * B.C., such use may not be meaningful. The Gregorian calendar was
- * not instituted until October 15, 1582 (or October 5, 1582 in the
- * Julian calendar). Some countries did not accept it until much
- * later. For example, Britain converted in 1752, The USSR in 1918 and
- * Greece in 1923. Most European countries used the Julian calendar
- * prior to the Gregorian.
- *
- * CALENDAR OVERVIEW
- *
- * The Gregorian calendar is a modified version of the Julian calendar.
- * The only difference being the specification of leap years. The
- * Julian calendar specifies that every year that is a multiple of 4
- * will be a leap year. This leads to a year that is 365.25 days long,
- * but the current accepted value for the tropical year is 365.242199
- * days.
- *
- * To correct this error in the length of the year and to bring the
- * vernal equinox back to March 21, Pope Gregory XIII issued a papal
- * bull declaring that Thursday October 4, 1582 would be followed by
- * Friday October 15, 1582 and that centennial years would only be a
- * leap year if they were a multiple of 400. This shortened the year
- * by 3 days per 400 years, giving a year of 365.2425 days.
- *
- * Another recently proposed change in the leap year rule is to make
- * years that are multiples of 4000 not a leap year, but this has never
- * been officially accepted and this rule is not implemented in these
- * algorithms.
- *
- * ALGORITHMS
- *
- * The calculations are based on three different cycles: a 400 year
- * cycle of leap years, a 4 year cycle of leap years and a 5 month
- * cycle of month lengths.
- *
- * The 5 month cycle is used to account for the varying lengths of
- * months. You will notice that the lengths alternate between 30
- * and 31 days, except for three anomalies: both July and August
- * have 31 days, both December and January have 31, and February
- * is less than 30. Starting with March, the lengths are in a
- * cycle of 5 months (31, 30, 31, 30, 31):
- *
- * Mar 31 days \
- * Apr 30 days |
- * May 31 days > First cycle
- * Jun 30 days |
- * Jul 31 days /
- *
- * Aug 31 days \
- * Sep 30 days |
- * Oct 31 days > Second cycle
- * Nov 30 days |
- * Dec 31 days /
- *
- * Jan 31 days \
- * Feb 28/9 days |
- * > Third cycle (incomplete)
- *
- * For this reason the calculations (internally) assume that the
- * year starts with March 1.
- *
- * TESTING
- *
- * This algorithm has been tested from the year 4714 B.C. to 10000
- * A.D. The source code of the verification program is included in
- * this package.
- *
- * REFERENCES
- *
- * Conversions Between Calendar Date and Julian Day Number by Robert J.
- * Tantzen, Communications of the Association for Computing Machinery
- * August 1963. (Also published in Collected Algorithms from CACM,
- * algorithm number 199).
- *
- **************************************************************************/
-
-#include "sdncal.h"
-
-#define GREGOR_SDN_OFFSET 32045
-#define DAYS_PER_5_MONTHS 153
-#define DAYS_PER_4_YEARS 1461
-#define DAYS_PER_400_YEARS 146097
-
-void SdnToGregorian(
- long int sdn,
- int *pYear,
- int *pMonth,
- int *pDay)
-{
- int century;
- int year;
- int month;
- int day;
- long int temp;
- int dayOfYear;
-
- if (sdn <= 0) {
- *pYear = 0;
- *pMonth = 0;
- *pDay = 0;
- return;
- }
- temp = (sdn + GREGOR_SDN_OFFSET) * 4 - 1;
-
- /* Calculate the century (year/100). */
- century = temp / DAYS_PER_400_YEARS;
-
- /* Calculate the year and day of year (1 <= dayOfYear <= 366). */
- temp = ((temp % DAYS_PER_400_YEARS) / 4) * 4 + 3;
- year = (century * 100) + (temp / DAYS_PER_4_YEARS);
- dayOfYear = (temp % DAYS_PER_4_YEARS) / 4 + 1;
-
- /* Calculate the month and day of month. */
- temp = dayOfYear * 5 - 3;
- month = temp / DAYS_PER_5_MONTHS;
- day = (temp % DAYS_PER_5_MONTHS) / 5 + 1;
-
- /* Convert to the normal beginning of the year. */
- if (month < 10) {
- month += 3;
- } else {
- year += 1;
- month -= 9;
- }
-
- /* Adjust to the B.C./A.D. type numbering. */
- year -= 4800;
- if (year <= 0)
- year--;
-
- *pYear = year;
- *pMonth = month;
- *pDay = day;
-}
-
-long int GregorianToSdn(
- int inputYear,
- int inputMonth,
- int inputDay)
-{
- int year;
- int month;
-
- /* check for invalid dates */
- if (inputYear == 0 || inputYear < -4714 ||
- inputMonth <= 0 || inputMonth > 12 ||
- inputDay <= 0 || inputDay > 31) {
- return (0);
- }
- /* check for dates before SDN 1 (Nov 25, 4714 B.C.) */
- if (inputYear == -4714) {
- if (inputMonth < 11) {
- return (0);
- }
- if (inputMonth == 11 && inputDay < 25) {
- return (0);
- }
- }
- /* Make year always a positive number. */
- if (inputYear < 0) {
- year = inputYear + 4801;
- } else {
- year = inputYear + 4800;
- }
-
- /* Adjust the start of the year. */
- if (inputMonth > 2) {
- month = inputMonth - 3;
- } else {
- month = inputMonth + 9;
- year--;
- }
-
- return (((year / 100) * DAYS_PER_400_YEARS) / 4
- + ((year % 100) * DAYS_PER_4_YEARS) / 4
- + (month * DAYS_PER_5_MONTHS + 2) / 5
- + inputDay
- - GREGOR_SDN_OFFSET);
-}
-
-char *MonthNameShort[13] =
-{
- "",
- "Jan",
- "Feb",
- "Mar",
- "Apr",
- "May",
- "Jun",
- "Jul",
- "Aug",
- "Sep",
- "Oct",
- "Nov",
- "Dec"
-};
-
-char *MonthNameLong[13] =
-{
- "",
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December"
-};
diff --git a/ext/calendar/jewish.c b/ext/calendar/jewish.c
deleted file mode 100644
index f4dc7c35ae..0000000000
--- a/ext/calendar/jewish.c
+++ /dev/null
@@ -1,763 +0,0 @@
-/* $selId: jewish.c,v 2.0 1995/10/24 01:13:06 lees Exp $
- * Copyright 1993-1995, Scott E. Lee, all rights reserved.
- * Permission granted to use, copy, modify, distribute and sell so long as
- * the above copyright and this permission statement are retained in all
- * copies. THERE IS NO WARRANTY - USE AT YOUR OWN RISK.
- */
-
-/**************************************************************************
- *
- * These are the externally visible components of this file:
- *
- * void
- * SdnToJewish(
- * long int sdn,
- * int *pYear,
- * int *pMonth,
- * int *pDay);
- *
- * Convert a SDN to a Jewish calendar date. If the input SDN is before the
- * first day of year 1, the three output values will all be set to zero,
- * otherwise *pYear will be > 0; *pMonth will be in the range 1 to 13
- * inclusive; *pDay will be in the range 1 to 30 inclusive. Note that Adar
- * II is assigned the month number 7 and Elul is always 13.
- *
- * long int
- * JewishToSdn(
- * int year,
- * int month,
- * int day);
- *
- * Convert a Jewish calendar date to a SDN. Zero is returned when the
- * input date is detected as invalid or out of the supported range. The
- * return value will be > 0 for all valid, supported dates, but there are
- * some invalid dates that will return a positive value. To verify that a
- * date is valid, convert it to SDN and then back and compare with the
- * original.
- *
- * char *JewishMonthName[14];
- *
- * Convert a Jewish month number (1 to 13) to the name of the Jewish month
- * (null terminated). An index of zero will return a zero length string.
- *
- * VALID RANGE
- *
- * Although this software can handle dates all the way back to the year
- * 1 (3761 B.C.), such use may not be meaningful.
- *
- * The Jewish calendar has been in use for several thousand years, but
- * in the early days there was no formula to determine the start of a
- * month. A new month was started when the new moon was first
- * observed.
- *
- * It is not clear when the current rule based calendar replaced the
- * observation based calendar. According to the book "Jewish Calendar
- * Mystery Dispelled" by George Zinberg, the patriarch Hillel II
- * published these rules in 358 A.D. But, according to The
- * Encyclopedia Judaica, Hillel II may have only published the 19 year
- * rule for determining the occurrence of leap years.
- *
- * I have yet to find a specific date when the current set of rules
- * were known to be in use.
- *
- * CALENDAR OVERVIEW
- *
- * The Jewish calendar is based on lunar as well as solar cycles. A
- * month always starts on or near a new moon and has either 29 or 30
- * days (a lunar cycle is about 29 1/2 days). Twelve of these
- * alternating 29-30 day months gives a year of 354 days, which is
- * about 11 1/4 days short of a solar year.
- *
- * Since a month is defined to be a lunar cycle (new moon to new moon),
- * this 11 1/4 day difference cannot be overcome by adding days to a
- * month as with the Gregorian calendar, so an entire month is
- * periodically added to the year, making some years 13 months long.
- *
- * For astronomical as well as ceremonial reasons, the start of a new
- * year may be delayed until a day or two after the new moon causing
- * years to vary in length. Leap years can be from 383 to 385 days and
- * common years can be from 353 to 355 days. These are the months of
- * the year and their possible lengths:
- *
- * COMMON YEAR LEAP YEAR
- * 1 Tishri 30 30 30 30 30 30
- * 2 Heshvan 29 29 30 29 29 30 (variable)
- * 3 Kislev 29 30 30 29 30 30 (variable)
- * 4 Tevet 29 29 29 29 29 29
- * 5 Shevat 30 30 30 30 30 30
- * 6 Adar I 29 29 29 30 30 30 (variable)
- * 7 Adar II -- -- -- 29 29 29 (optional)
- * 8 Nisan 30 30 30 30 30 30
- * 9 Iyyar 29 29 29 29 29 29
- * 10 Sivan 30 30 30 30 30 30
- * 11 Tammuz 29 29 29 29 29 29
- * 12 Av 30 30 30 30 30 30
- * 13 Elul 29 29 29 29 29 29
- * --- --- --- --- --- ---
- * 353 354 355 383 384 385
- *
- * Note that the month names and other words that appear in this file
- * have multiple possible spellings in the Roman character set. I have
- * chosen to use the spellings found in the Encyclopedia Judaica.
- *
- * Adar II, the month added for leap years, is sometimes referred to as
- * the 13th month, but I have chosen to assign it the number 7 to keep
- * the months in chronological order. This may not be consistent with
- * other numbering schemes.
- *
- * Leap years occur in a fixed pattern of 19 years called the metonic
- * cycle. The 3rd, 6th, 8th, 11th, 14th, 17th and 19th years of this
- * cycle are leap years. The first metonic cycle starts with Jewish
- * year 1, or 3761/60 B.C. This is believed to be the year of
- * creation.
- *
- * To construct the calendar for a year, you must first find the length
- * of the year by determining the first day of the year (Tishri 1, or
- * Rosh Ha-Shanah) and the first day of the following year. This
- * selects one of the six possible month length configurations listed
- * above.
- *
- * Finding the first day of the year is the most difficult part.
- * Finding the date and time of the new moon (or molad) is the first
- * step. For this purpose, the lunar cycle is assumed to be 29 days 12
- * hours and 793 halakim. A halakim is 1/1080th of an hour or 3 1/3
- * seconds. (This assumed value is only about 1/2 second less than the
- * value used by modern astronomers -- not bad for a number that was
- * determined so long ago.) The first molad of year 1 occurred on
- * Sunday at 11:20:11 P.M. This would actually be Monday, because the
- * Jewish day is considered to begin at sunset.
- *
- * Since sunset varies, the day is assumed to begin at 6:00 P.M. for
- * calendar calculation purposes. So, the first molad was 5 hours 793
- * halakim after the start of Tishri 1, 0001 (which was Monday
- * September 7, 4761 B.C. by the Gregorian calendar). All subsequent
- * molads can be calculated from this starting point by adding the
- * length of a lunar cycle.
- *
- * Once the molad that starts a year is determined the actual start of
- * the year (Tishri 1) can be determined. Tishri 1 will be the day of
- * the molad unless it is delayed by one of the following four rules
- * (called dehiyyot). Each rule can delay the start of the year by one
- * day, and since rule #1 can combine with one of the other rules, it
- * can be delayed as much as two days.
- *
- * 1. Tishri 1 must never be Sunday, Wednesday or Friday. (This
- * is largely to prevent certain holidays from occurring on the
- * day before or after the Sabbath.)
- *
- * 2. If the molad occurs on or after noon, Tishri 1 must be
- * delayed.
- *
- * 3. If it is a common (not leap) year and the molad occurs on
- * Tuesday at or after 3:11:20 A.M., Tishri 1 must be delayed.
- *
- * 4. If it is the year following a leap year and the molad occurs
- * on Monday at or after 9:32:43 and 1/3 sec, Tishri 1 must be
- * delayed.
- *
- * GLOSSARY
- *
- * dehiyyot The set of 4 rules that determine when the new year
- * starts relative to the molad.
- *
- * halakim 1/1080th of an hour or 3 1/3 seconds.
- *
- * lunar cycle The period of time between mean conjunctions of the
- * sun and moon (new moon to new moon). This is
- * assumed to be 29 days 12 hours and 793 halakim for
- * calendar purposes.
- *
- * metonic cycle A 19 year cycle which determines which years are
- * leap years and which are common years. The 3rd,
- * 6th, 8th, 11th, 14th, 17th and 19th years of this
- * cycle are leap years.
- *
- * molad The date and time of the mean conjunction of the
- * sun and moon (new moon). This is the approximate
- * beginning of a month.
- *
- * Rosh Ha-Shanah The first day of the Jewish year (Tishri 1).
- *
- * Tishri The first month of the Jewish year.
- *
- * ALGORITHMS
- *
- * SERIAL DAY NUMBER TO JEWISH DATE
- *
- * The simplest approach would be to use the rules stated above to find
- * the molad of Tishri before and after the given day number. Then use
- * the molads to find Tishri 1 of the current and following years.
- * From this the length of the year can be determined and thus the
- * length of each month. But this method is used as a last resort.
- *
- * The first 59 days of the year are the same regardless of the length
- * of the year. As a result, only the day number of the start of the
- * year is required.
- *
- * Similarly, the last 6 months do not change from year to year. And
- * since it can be determined whether the year is a leap year by simple
- * division, the lengths of Adar I and II can be easily calculated. In
- * fact, all dates after the 3rd month are consistent from year to year
- * (once it is known whether it is a leap year).
- *
- * This means that if the given day number falls in the 3rd month or on
- * the 30th day of the 2nd month the length of the year must be found,
- * but in no other case.
- *
- * So, the approach used is to take the given day number and round it
- * to the closest molad of Tishri (first new moon of the year). The
- * rounding is not really to the *closest* molad, but is such that if
- * the day number is before the middle of the 3rd month the molad at
- * the start of the year is found, otherwise the molad at the end of
- * the year is found.
- *
- * Only if the day number is actually found to be in the ambiguous
- * period of 29 to 31 days is the other molad calculated.
- *
- * JEWISH DATE TO SERIAL DAY NUMBER
- *
- * The year number is used to find which 19 year metonic cycle contains
- * the date and which year within the cycle (this is a division and
- * modulus). This also determines whether it is a leap year.
- *
- * If the month is 1 or 2, the calculation is simple addition to the
- * first of the year.
- *
- * If the month is 8 (Nisan) or greater, the calculation is simple
- * subtraction from beginning of the following year.
- *
- * If the month is 4 to 7, it is considered whether it is a leap year
- * and then simple subtraction from the beginning of the following year
- * is used.
- *
- * Only if it is the 3rd month is both the start and end of the year
- * required.
- *
- * TESTING
- *
- * This algorithm has been tested in two ways. First, 510 dates from a
- * table in "Jewish Calendar Mystery Dispelled" were calculated and
- * compared to the table. Second, the calculation algorithm described
- * in "Jewish Calendar Mystery Dispelled" was coded and used to verify
- * all dates from the year 1 (3761 B.C.) to the year 13760 (10000
- * A.D.).
- *
- * The source code of the verification program is included in this
- * package.
- *
- * REFERENCES
- *
- * The Encyclopedia Judaica, the entry for "Calendar"
- *
- * The Jewish Encyclopedia
- *
- * Jewish Calendar Mystery Dispelled by George Zinberg, Vantage Press,
- * 1963
- *
- * The Comprehensive Hebrew Calendar by Arthur Spier, Behrman House
- *
- * The Book of Calendars [note that this work contains many typos]
- *
- **************************************************************************/
-
-#if defined(PHP_WIN32) && _MSC_VER >= 1200
-#pragma setlocale("english")
-#endif
-
-#include "sdncal.h"
-
-#define HALAKIM_PER_HOUR 1080
-#define HALAKIM_PER_DAY 25920
-#define HALAKIM_PER_LUNAR_CYCLE ((29 * HALAKIM_PER_DAY) + 13753)
-#define HALAKIM_PER_METONIC_CYCLE (HALAKIM_PER_LUNAR_CYCLE * (12 * 19 + 7))
-
-#define JEWISH_SDN_OFFSET 347997
-#define NEW_MOON_OF_CREATION 31524
-
-#define SUNDAY 0
-#define MONDAY 1
-#define TUESDAY 2
-#define WEDNESDAY 3
-#define THURSDAY 4
-#define FRIDAY 5
-#define SATURDAY 6
-
-#define NOON (18 * HALAKIM_PER_HOUR)
-#define AM3_11_20 ((9 * HALAKIM_PER_HOUR) + 204)
-#define AM9_32_43 ((15 * HALAKIM_PER_HOUR) + 589)
-
-static int monthsPerYear[19] =
-{
-12, 12, 13, 12, 12, 13, 12, 13, 12, 12, 13, 12, 12, 13, 12, 12, 13, 12, 13
-};
-
-static int yearOffset[19] =
-{
- 0, 12, 24, 37, 49, 61, 74, 86, 99, 111, 123,
- 136, 148, 160, 173, 185, 197, 210, 222
-};
-
-char *JewishMonthName[14] =
-{
- "",
- "Tishri",
- "Heshvan",
- "Kislev",
- "Tevet",
- "Shevat",
- "AdarI",
- "AdarII",
- "Nisan",
- "Iyyar",
- "Sivan",
- "Tammuz",
- "Av",
- "Elul"
-};
-
-char *JewishMonthHebName[14] =
-{
- "",
- "úùøé",
- "çùåï",
- "ëñìå",
- "èáú",
- "ùáè",
- "àãø",
- "'àãø á",
- "ðéñï",
- "àééø",
- "ñéåï",
- "úîåæ",
- "àá",
- "àìåì"
-};
-
-/************************************************************************
- * Given the year within the 19 year metonic cycle and the time of a molad
- * (new moon) which starts that year, this routine will calculate what day
- * will be the actual start of the year (Tishri 1 or Rosh Ha-Shanah). This
- * first day of the year will be the day of the molad unless one of 4 rules
- * (called dehiyyot) delays it. These 4 rules can delay the start of the
- * year by as much as 2 days.
- */
-static long int Tishri1(
- int metonicYear,
- long int moladDay,
- long int moladHalakim)
-{
- long int tishri1;
- int dow;
- int leapYear;
- int lastWasLeapYear;
-
- tishri1 = moladDay;
- dow = tishri1 % 7;
- leapYear = metonicYear == 2 || metonicYear == 5 || metonicYear == 7
- || metonicYear == 10 || metonicYear == 13 || metonicYear == 16
- || metonicYear == 18;
- lastWasLeapYear = metonicYear == 3 || metonicYear == 6
- || metonicYear == 8 || metonicYear == 11 || metonicYear == 14
- || metonicYear == 17 || metonicYear == 0;
-
- /* Apply rules 2, 3 and 4. */
- if ((moladHalakim >= NOON) ||
- ((!leapYear) && dow == TUESDAY && moladHalakim >= AM3_11_20) ||
- (lastWasLeapYear && dow == MONDAY && moladHalakim >= AM9_32_43)) {
- tishri1++;
- dow++;
- if (dow == 7) {
- dow = 0;
- }
- }
- /* Apply rule 1 after the others because it can cause an additional
- * delay of one day. */
- if (dow == WEDNESDAY || dow == FRIDAY || dow == SUNDAY) {
- tishri1++;
- }
- return (tishri1);
-}
-
-/************************************************************************
- * Given a metonic cycle number, calculate the date and time of the molad
- * (new moon) that starts that cycle. Since the length of a metonic cycle
- * is a constant, this is a simple calculation, except that it requires an
- * intermediate value which is bigger that 32 bits. Because this
- * intermediate value only needs 36 to 37 bits and the other numbers are
- * constants, the process has been reduced to just a few steps.
- */
-static void MoladOfMetonicCycle(
- int metonicCycle,
- long int *pMoladDay,
- long int *pMoladHalakim)
-{
- register unsigned long int r1, r2, d1, d2;
-
- /* Start with the time of the first molad after creation. */
- r1 = NEW_MOON_OF_CREATION;
-
- /* Calculate metonicCycle * HALAKIM_PER_METONIC_CYCLE. The upper 32
- * bits of the result will be in r2 and the lower 16 bits will be
- * in r1. */
- r1 += metonicCycle * (HALAKIM_PER_METONIC_CYCLE & 0xFFFF);
- r2 = r1 >> 16;
- r2 += metonicCycle * ((HALAKIM_PER_METONIC_CYCLE >> 16) & 0xFFFF);
-
- /* Calculate r2r1 / HALAKIM_PER_DAY. The remainder will be in r1, the
- * upper 16 bits of the quotient will be in d2 and the lower 16 bits
- * will be in d1. */
- d2 = r2 / HALAKIM_PER_DAY;
- r2 -= d2 * HALAKIM_PER_DAY;
- r1 = (r2 << 16) | (r1 & 0xFFFF);
- d1 = r1 / HALAKIM_PER_DAY;
- r1 -= d1 * HALAKIM_PER_DAY;
-
- *pMoladDay = (d2 << 16) | d1;
- *pMoladHalakim = r1;
-}
-
-/************************************************************************
- * Given a day number, find the molad of Tishri (the new moon at the start
- * of a year) which is closest to that day number. It's not really the
- * *closest* molad that we want here. If the input day is in the first two
- * months, we want the molad at the start of the year. If the input day is
- * in the fourth to last months, we want the molad at the end of the year.
- * If the input day is in the third month, it doesn't matter which molad is
- * returned, because both will be required. This type of "rounding" allows
- * us to avoid calculating the length of the year in most cases.
- */
-static void FindTishriMolad(
- long int inputDay,
- int *pMetonicCycle,
- int *pMetonicYear,
- long int *pMoladDay,
- long int *pMoladHalakim)
-{
- long int moladDay;
- long int moladHalakim;
- int metonicCycle;
- int metonicYear;
-
- /* Estimate the metonic cycle number. Note that this may be an under
- * estimate because there are 6939.6896 days in a metonic cycle not
- * 6940, but it will never be an over estimate. The loop below will
- * correct for any error in this estimate. */
- metonicCycle = (inputDay + 310) / 6940;
-
- /* Calculate the time of the starting molad for this metonic cycle. */
- MoladOfMetonicCycle(metonicCycle, &moladDay, &moladHalakim);
-
- /* If the above was an under estimate, increment the cycle number until
- * the correct one is found. For modern dates this loop is about 98.6%
- * likely to not execute, even once, because the above estimate is
- * really quite close. */
- while (moladDay < inputDay - 6940 + 310) {
- metonicCycle++;
- moladHalakim += HALAKIM_PER_METONIC_CYCLE;
- moladDay += moladHalakim / HALAKIM_PER_DAY;
- moladHalakim = moladHalakim % HALAKIM_PER_DAY;
- }
-
- /* Find the molad of Tishri closest to this date. */
- for (metonicYear = 0; metonicYear < 18; metonicYear++) {
- if (moladDay > inputDay - 74) {
- break;
- }
- moladHalakim += HALAKIM_PER_LUNAR_CYCLE * monthsPerYear[metonicYear];
- moladDay += moladHalakim / HALAKIM_PER_DAY;
- moladHalakim = moladHalakim % HALAKIM_PER_DAY;
- }
-
- *pMetonicCycle = metonicCycle;
- *pMetonicYear = metonicYear;
- *pMoladDay = moladDay;
- *pMoladHalakim = moladHalakim;
-}
-
-/************************************************************************
- * Given a year, find the number of the first day of that year and the date
- * and time of the starting molad.
- */
-static void FindStartOfYear(
- int year,
- int *pMetonicCycle,
- int *pMetonicYear,
- long int *pMoladDay,
- long int *pMoladHalakim,
- int *pTishri1)
-{
- *pMetonicCycle = (year - 1) / 19;
- *pMetonicYear = (year - 1) % 19;
- MoladOfMetonicCycle(*pMetonicCycle, pMoladDay, pMoladHalakim);
-
- *pMoladHalakim += HALAKIM_PER_LUNAR_CYCLE * yearOffset[*pMetonicYear];
- *pMoladDay += *pMoladHalakim / HALAKIM_PER_DAY;
- *pMoladHalakim = *pMoladHalakim % HALAKIM_PER_DAY;
-
- *pTishri1 = Tishri1(*pMetonicYear, *pMoladDay, *pMoladHalakim);
-}
-
-/************************************************************************
- * Given a serial day number (SDN), find the corresponding year, month and
- * day in the Jewish calendar. The three output values will always be
- * modified. If the input SDN is before the first day of year 1, they will
- * all be set to zero, otherwise *pYear will be > 0; *pMonth will be in the
- * range 1 to 13 inclusive; *pDay will be in the range 1 to 30 inclusive.
- */
-void SdnToJewish(
- long int sdn,
- int *pYear,
- int *pMonth,
- int *pDay)
-{
- long int inputDay;
- long int day;
- long int halakim;
- int metonicCycle;
- int metonicYear;
- int tishri1;
- int tishri1After;
- int yearLength;
-
- if (sdn <= JEWISH_SDN_OFFSET) {
- *pYear = 0;
- *pMonth = 0;
- *pDay = 0;
- return;
- }
- inputDay = sdn - JEWISH_SDN_OFFSET;
-
- FindTishriMolad(inputDay, &metonicCycle, &metonicYear, &day, &halakim);
- tishri1 = Tishri1(metonicYear, day, halakim);
-
- if (inputDay >= tishri1) {
- /* It found Tishri 1 at the start of the year. */
- *pYear = metonicCycle * 19 + metonicYear + 1;
- if (inputDay < tishri1 + 59) {
- if (inputDay < tishri1 + 30) {
- *pMonth = 1;
- *pDay = inputDay - tishri1 + 1;
- } else {
- *pMonth = 2;
- *pDay = inputDay - tishri1 - 29;
- }
- return;
- }
- /* We need the length of the year to figure this out, so find
- * Tishri 1 of the next year. */
- halakim += HALAKIM_PER_LUNAR_CYCLE * monthsPerYear[metonicYear];
- day += halakim / HALAKIM_PER_DAY;
- halakim = halakim % HALAKIM_PER_DAY;
- tishri1After = Tishri1((metonicYear + 1) % 19, day, halakim);
- } else {
- /* It found Tishri 1 at the end of the year. */
- *pYear = metonicCycle * 19 + metonicYear;
- if (inputDay >= tishri1 - 177) {
- /* It is one of the last 6 months of the year. */
- if (inputDay > tishri1 - 30) {
- *pMonth = 13;
- *pDay = inputDay - tishri1 + 30;
- } else if (inputDay > tishri1 - 60) {
- *pMonth = 12;
- *pDay = inputDay - tishri1 + 60;
- } else if (inputDay > tishri1 - 89) {
- *pMonth = 11;
- *pDay = inputDay - tishri1 + 89;
- } else if (inputDay > tishri1 - 119) {
- *pMonth = 10;
- *pDay = inputDay - tishri1 + 119;
- } else if (inputDay > tishri1 - 148) {
- *pMonth = 9;
- *pDay = inputDay - tishri1 + 148;
- } else {
- *pMonth = 8;
- *pDay = inputDay - tishri1 + 178;
- }
- return;
- } else {
- if (monthsPerYear[(*pYear - 1) % 19] == 13) {
- *pMonth = 7;
- *pDay = inputDay - tishri1 + 207;
- if (*pDay > 0)
- return;
- (*pMonth)--;
- (*pDay) += 30;
- if (*pDay > 0)
- return;
- (*pMonth)--;
- (*pDay) += 30;
- } else {
- *pMonth = 6;
- *pDay = inputDay - tishri1 + 207;
- if (*pDay > 0)
- return;
- (*pMonth)--;
- (*pDay) += 30;
- }
- if (*pDay > 0)
- return;
- (*pMonth)--;
- (*pDay) += 29;
- if (*pDay > 0)
- return;
-
- /* We need the length of the year to figure this out, so find
- * Tishri 1 of this year. */
- tishri1After = tishri1;
- FindTishriMolad(day - 365,
- &metonicCycle, &metonicYear, &day, &halakim);
- tishri1 = Tishri1(metonicYear, day, halakim);
- }
- }
-
- yearLength = tishri1After - tishri1;
- day = inputDay - tishri1 - 29;
- if (yearLength == 355 || yearLength == 385) {
- /* Heshvan has 30 days */
- if (day <= 30) {
- *pMonth = 2;
- *pDay = day;
- return;
- }
- day -= 30;
- } else {
- /* Heshvan has 29 days */
- if (day <= 29) {
- *pMonth = 2;
- *pDay = day;
- return;
- }
- day -= 29;
- }
-
- /* It has to be Kislev. */
- *pMonth = 3;
- *pDay = day;
-}
-
-/************************************************************************
- * Given a year, month and day in the Jewish calendar, find the
- * corresponding serial day number (SDN). Zero is returned when the input
- * date is detected as invalid. The return value will be > 0 for all valid
- * dates, but there are some invalid dates that will return a positive
- * value. To verify that a date is valid, convert it to SDN and then back
- * and compare with the original.
- */
-long int JewishToSdn(
- int year,
- int month,
- int day)
-{
- long int sdn;
- int metonicCycle;
- int metonicYear;
- int tishri1;
- int tishri1After;
- long int moladDay;
- long int moladHalakim;
- int yearLength;
- int lengthOfAdarIAndII;
-
- if (year <= 0 || day <= 0 || day > 30) {
- return (0);
- }
- switch (month) {
- case 1:
- case 2:
- /* It is Tishri or Heshvan - don't need the year length. */
- FindStartOfYear(year, &metonicCycle, &metonicYear,
- &moladDay, &moladHalakim, &tishri1);
- if (month == 1) {
- sdn = tishri1 + day - 1;
- } else {
- sdn = tishri1 + day + 29;
- }
- break;
-
- case 3:
- /* It is Kislev - must find the year length. */
-
- /* Find the start of the year. */
- FindStartOfYear(year, &metonicCycle, &metonicYear,
- &moladDay, &moladHalakim, &tishri1);
-
- /* Find the end of the year. */
- moladHalakim += HALAKIM_PER_LUNAR_CYCLE * monthsPerYear[metonicYear];
- moladDay += moladHalakim / HALAKIM_PER_DAY;
- moladHalakim = moladHalakim % HALAKIM_PER_DAY;
- tishri1After = Tishri1((metonicYear + 1) % 19, moladDay, moladHalakim);
-
- yearLength = tishri1After - tishri1;
-
- if (yearLength == 355 || yearLength == 385) {
- sdn = tishri1 + day + 59;
- } else {
- sdn = tishri1 + day + 58;
- }
- break;
-
- case 4:
- case 5:
- case 6:
- /* It is Tevet, Shevat or Adar I - don't need the year length. */
-
- FindStartOfYear(year + 1, &metonicCycle, &metonicYear,
- &moladDay, &moladHalakim, &tishri1After);
-
- if (monthsPerYear[(year - 1) % 19] == 12) {
- lengthOfAdarIAndII = 29;
- } else {
- lengthOfAdarIAndII = 59;
- }
-
- if (month == 4) {
- sdn = tishri1After + day - lengthOfAdarIAndII - 237;
- } else if (month == 5) {
- sdn = tishri1After + day - lengthOfAdarIAndII - 208;
- } else {
- sdn = tishri1After + day - lengthOfAdarIAndII - 178;
- }
- break;
-
- default:
- /* It is Adar II or later - don't need the year length. */
- FindStartOfYear(year + 1, &metonicCycle, &metonicYear,
- &moladDay, &moladHalakim, &tishri1After);
-
- switch (month) {
- case 7:
- sdn = tishri1After + day - 207;
- break;
- case 8:
- sdn = tishri1After + day - 178;
- break;
- case 9:
- sdn = tishri1After + day - 148;
- break;
- case 10:
- sdn = tishri1After + day - 119;
- break;
- case 11:
- sdn = tishri1After + day - 89;
- break;
- case 12:
- sdn = tishri1After + day - 60;
- break;
- case 13:
- sdn = tishri1After + day - 30;
- break;
- default:
- return (0);
- }
- }
- return (sdn + JEWISH_SDN_OFFSET);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/calendar/julian.c b/ext/calendar/julian.c
deleted file mode 100644
index 39bcbc7e65..0000000000
--- a/ext/calendar/julian.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/* $selId: julian.c,v 2.0 1995/10/24 01:13:06 lees Exp $
- * Copyright 1993-1995, Scott E. Lee, all rights reserved.
- * Permission granted to use, copy, modify, distribute and sell so long as
- * the above copyright and this permission statement are retained in all
- * copies. THERE IS NO WARRANTY - USE AT YOUR OWN RISK.
- */
-
-/**************************************************************************
- *
- * These are the externally visible components of this file:
- *
- * void
- * SdnToJulian(
- * long int sdn,
- * int *pYear,
- * int *pMonth,
- * int *pDay);
- *
- * Convert a SDN to a Julian calendar date. If the input SDN is less than
- * 1, the three output values will all be set to zero, otherwise *pYear
- * will be >= -4713 and != 0; *pMonth will be in the range 1 to 12
- * inclusive; *pDay will be in the range 1 to 31 inclusive.
- *
- * long int
- * JulianToSdn(
- * int inputYear,
- * int inputMonth,
- * int inputDay);
- *
- * Convert a Julian calendar date to a SDN. Zero is returned when the
- * input date is detected as invalid or out of the supported range. The
- * return value will be > 0 for all valid, supported dates, but there are
- * some invalid dates that will return a positive value. To verify that a
- * date is valid, convert it to SDN and then back and compare with the
- * original.
- *
- * VALID RANGE
- *
- * 4713 B.C. to at least 10000 A.D.
- *
- * Although this software can handle dates all the way back to 4713
- * B.C., such use may not be meaningful. The calendar was created in
- * 46 B.C., but the details did not stabilize until at least 8 A.D.,
- * and perhaps as late at the 4th century. Also, the beginning of a
- * year varied from one culture to another - not all accepted January
- * as the first month.
- *
- * CALENDAR OVERVIEW
- *
- * Julias Ceasar created the calendar in 46 B.C. as a modified form of
- * the old Roman republican calendar which was based on lunar cycles.
- * The new Julian calendar set fixed lengths for the months, abandoning
- * the lunar cycle. It also specified that there would be exactly 12
- * months per year and 365.25 days per year with every 4th year being a
- * leap year.
- *
- * Note that the current accepted value for the tropical year is
- * 365.242199 days, not 365.25. This lead to an 11 day shift in the
- * calendar with respect to the seasons by the 16th century when the
- * Gregorian calendar was created to replace the Julian calendar.
- *
- * The difference between the Julian and today's Gregorian calendar is
- * that the Gregorian does not make centennial years leap years unless
- * they are a multiple of 400, which leads to a year of 365.2425 days.
- * In other words, in the Gregorian calendar, 1700, 1800 and 1900 are
- * not leap years, but 2000 is. All centennial years are leap years in
- * the Julian calendar.
- *
- * The details are unknown, but the lengths of the months were adjusted
- * until they finally stablized in 8 A.D. with their current lengths:
- *
- * January 31
- * February 28/29
- * March 31
- * April 30
- * May 31
- * June 30
- * Quintilis/July 31
- * Sextilis/August 31
- * September 30
- * October 31
- * November 30
- * December 31
- *
- * In the early days of the calendar, the days of the month were not
- * numbered as we do today. The numbers ran backwards (decreasing) and
- * were counted from the Ides (15th of the month - which in the old
- * Roman republican lunar calendar would have been the full moon) or
- * from the Nonae (9th day before the Ides) or from the beginning of
- * the next month.
- *
- * In the early years, the beginning of the year varied, sometimes
- * based on the ascension of rulers. It was not always the first of
- * January.
- *
- * Also, today's epoch, 1 A.D. or the birth of Jesus Christ, did not
- * come into use until several centuries later when Christianity became
- * a dominant religion.
- *
- * ALGORITHMS
- *
- * The calculations are based on two different cycles: a 4 year cycle
- * of leap years and a 5 month cycle of month lengths.
- *
- * The 5 month cycle is used to account for the varying lengths of
- * months. You will notice that the lengths alternate between 30 and
- * 31 days, except for three anomalies: both July and August have 31
- * days, both December and January have 31, and February is less than
- * 30. Starting with March, the lengths are in a cycle of 5 months
- * (31, 30, 31, 30, 31):
- *
- * Mar 31 days \
- * Apr 30 days |
- * May 31 days > First cycle
- * Jun 30 days |
- * Jul 31 days /
- *
- * Aug 31 days \
- * Sep 30 days |
- * Oct 31 days > Second cycle
- * Nov 30 days |
- * Dec 31 days /
- *
- * Jan 31 days \
- * Feb 28/9 days |
- * > Third cycle (incomplete)
- *
- * For this reason the calculations (internally) assume that the year
- * starts with March 1.
- *
- * TESTING
- *
- * This algorithm has been tested from the year 4713 B.C. to 10000 A.D.
- * The source code of the verification program is included in this
- * package.
- *
- * REFERENCES
- *
- * Conversions Between Calendar Date and Julian Day Number by Robert J.
- * Tantzen, Communications of the Association for Computing Machinery
- * August 1963. (Also published in Collected Algorithms from CACM,
- * algorithm number 199). [Note: the published algorithm is for the
- * Gregorian calendar, but was adjusted to use the Julian calendar's
- * simpler leap year rule.]
- *
- **************************************************************************/
-
-#include "sdncal.h"
-
-#define JULIAN_SDN_OFFSET 32083
-#define DAYS_PER_5_MONTHS 153
-#define DAYS_PER_4_YEARS 1461
-
-void SdnToJulian(
- long int sdn,
- int *pYear,
- int *pMonth,
- int *pDay)
-{
- int year;
- int month;
- int day;
- long int temp;
- int dayOfYear;
-
- if (sdn <= 0) {
- *pYear = 0;
- *pMonth = 0;
- *pDay = 0;
- return;
- }
- temp = (sdn + JULIAN_SDN_OFFSET) * 4 - 1;
-
- /* Calculate the year and day of year (1 <= dayOfYear <= 366). */
- year = temp / DAYS_PER_4_YEARS;
- dayOfYear = (temp % DAYS_PER_4_YEARS) / 4 + 1;
-
- /* Calculate the month and day of month. */
- temp = dayOfYear * 5 - 3;
- month = temp / DAYS_PER_5_MONTHS;
- day = (temp % DAYS_PER_5_MONTHS) / 5 + 1;
-
- /* Convert to the normal beginning of the year. */
- if (month < 10) {
- month += 3;
- } else {
- year += 1;
- month -= 9;
- }
-
- /* Adjust to the B.C./A.D. type numbering. */
- year -= 4800;
- if (year <= 0)
- year--;
-
- *pYear = year;
- *pMonth = month;
- *pDay = day;
-}
-
-long int JulianToSdn(
- int inputYear,
- int inputMonth,
- int inputDay)
-{
- int year;
- int month;
-
- /* check for invalid dates */
- if (inputYear == 0 || inputYear < -4713 ||
- inputMonth <= 0 || inputMonth > 12 ||
- inputDay <= 0 || inputDay > 31) {
- return (0);
- }
- /* check for dates before SDN 1 (Jan 2, 4713 B.C.) */
- if (inputYear == -4713) {
- if (inputMonth == 1 && inputDay == 1) {
- return (0);
- }
- }
- /* Make year always a positive number. */
- if (inputYear < 0) {
- year = inputYear + 4801;
- } else {
- year = inputYear + 4800;
- }
-
- /* Adjust the start of the year. */
- if (inputMonth > 2) {
- month = inputMonth - 3;
- } else {
- month = inputMonth + 9;
- year--;
- }
-
- return ((year * DAYS_PER_4_YEARS) / 4
- + (month * DAYS_PER_5_MONTHS + 2) / 5
- + inputDay
- - JULIAN_SDN_OFFSET);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/calendar/php_calendar.h b/ext/calendar/php_calendar.h
deleted file mode 100644
index 79c9edf73c..0000000000
--- a/ext/calendar/php_calendar.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef PHP_CALENDAR_H
-#define PHP_CALENDAR_H
-
-extern zend_module_entry calendar_module_entry;
-#define calendar_module_ptr &calendar_module_entry
-
-/* Functions */
-
-PHP_MINIT_FUNCTION(calendar);
-PHP_RINIT_FUNCTION(calendar);
-PHP_RSHUTDOWN_FUNCTION(calendar);
-PHP_MINFO_FUNCTION(calendar);
-
-PHP_FUNCTION(jdtogregorian);
-PHP_FUNCTION(gregoriantojd);
-PHP_FUNCTION(jdtojulian);
-PHP_FUNCTION(juliantojd);
-PHP_FUNCTION(jdtojewish);
-PHP_FUNCTION(jewishtojd);
-PHP_FUNCTION(jdtofrench);
-PHP_FUNCTION(frenchtojd);
-PHP_FUNCTION(jddayofweek);
-PHP_FUNCTION(jdmonthname);
-PHP_FUNCTION(easter_days);
-PHP_FUNCTION(easter_date);
-PHP_FUNCTION(unixtojd);
-PHP_FUNCTION(jdtounix);
-PHP_FUNCTION(cal_from_jd);
-PHP_FUNCTION(cal_to_jd);
-PHP_FUNCTION(cal_days_in_month);
-PHP_FUNCTION(cal_info);
-
-#define phpext_calendar_ptr calendar_module_ptr
-
-/*
- * Specifying the easter calculation method
- *
- * DEFAULT is Anglican, ie. use Julian calendar before 1753
- * and Gregorian after that. With ROMAN, the cutoff year is 1582.
- * ALWAYS_GREGORIAN and ALWAYS_JULIAN force the calendar
- * regardless of date.
- *
- */
-
-#define CAL_EASTER_DEFAULT 0
-#define CAL_EASTER_ROMAN 1
-#define CAL_EASTER_ALWAYS_GREGORIAN 2
-#define CAL_EASTER_ALWAYS_JULIAN 3
-
-#endif
diff --git a/ext/calendar/sdncal.h b/ext/calendar/sdncal.h
deleted file mode 100644
index 81328d1369..0000000000
--- a/ext/calendar/sdncal.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#ifndef SDNCAL_H
-#define SDNCAL_H
-/*
- * This code has been modified for use with PHP
- * by Shane Caraveo shane@caraveo.com
- * see below for more details
- *
- */
-
-/* $selId: sdncal.h,v 2.0 1995/10/24 01:13:06 lees Exp $
- * Copyright 1993-1995, Scott E. Lee, all rights reserved.
- * Permission granted to use, copy, modify, distribute and sell so long as
- * the above copyright and this permission statement are retained in all
- * copies. THERE IS NO WARRANTY - USE AT YOUR OWN RISK.
- */
-
-/**************************************************************************
- *
- * This package defines a set of routines that convert calendar dates to
- * and from a serial day number (SDN). The SDN is a serial numbering of
- * days where SDN 1 is November 25, 4714 BC in the Gregorian calendar and
- * SDN 2447893 is January 1, 1990. This system of day numbering is
- * sometimes referred to as Julian days, but to avoid confusion with the
- * Julian calendar, it is referred to as serial day numbers here. The term
- * Julian days is also used to mean the number of days since the beginning
- * of the current year.
- *
- * The SDN can be used as an intermediate step in converting from one
- * calendar system to another (such as Gregorian to Jewish). It can also
- * be used for date computations such as easily comparing two dates,
- * determining the day of the week, finding the date of yesterday or
- * calculating the number of days between two dates.
- *
- * When using this software on 16 bit systems, be careful to store SDNs in
- * a long int, because it will not fit in the 16 bits that some systems
- * allocate to an int.
- *
- * For each calendar, there are two routines provided. One converts dates
- * in that calendar to SDN and the other converts SDN to calendar dates.
- * The routines are named SdnTo<CALENDAR>() and <CALENDAR>ToSdn(), where
- * <CALENDAR> is the name of the calendar system.
- *
- * SDN values less than one are not supported. If a conversion routine
- * returns an SDN of zero, this means that the date given is either invalid
- * or is outside the supported range for that calendar.
- *
- * At least some validity checks are performed on input dates. For
- * example, a negative month number will result in the return of zero for
- * the SDN. A returned SDN greater than one does not necessarily mean that
- * the input date was valid. To determine if the date is valid, convert it
- * to SDN, and if the SDN is greater than zero, convert it back to a date
- * and compare to the original. For example:
- *
- * int y1, m1, d1;
- * int y2, m2, d2;
- * long int sdn;
- * ...
- * sdn = GregorianToSdn(y1, m1, d1);
- * if (sdn > 0) {
- * SdnToGregorian(sdn, &y2, &m2, &d2);
- * if (y1 == y2 && m1 == m2 && d1 == d2) {
- * ... date is valid ...
- * }
- * }
- *
- **************************************************************************/
-
-/* Gregorian calendar conversions. */
-void SdnToGregorian(long int sdn, int *pYear, int *pMonth, int *pDay);
-long int GregorianToSdn(int year, int month, int day);
-extern char *MonthNameShort[13];
-extern char *MonthNameLong[13];
-
-/* Julian calendar conversions. */
-void SdnToJulian(long int sdn, int *pYear, int *pMonth, int *pDay);
-long int JulianToSdn(int year, int month, int day);
-
-/* Jewish calendar conversions. */
-void SdnToJewish(long int sdn, int *pYear, int *pMonth, int *pDay);
-long int JewishToSdn(int year, int month, int day);
-extern char *JewishMonthName[14];
-extern char *JewishMonthHebName[14];
-
-/* French republic calendar conversions. */
-void SdnToFrench(long int sdn, int *pYear, int *pMonth, int *pDay);
-long int FrenchToSdn(int inputYear, int inputMonth, int inputDay);
-extern char *FrenchMonthName[14];
-
-/* Islamic calendar conversions. */
-/* Not implemented yet. */
-
-/* Day of week conversion. 0=Sunday, 6=Saturday */
-int DayOfWeek(long int sdn);
-extern char *DayNameShort[7];
-extern char *DayNameLong[7];
-
-#endif /* SDNCAL_H */
diff --git a/ext/calendar/tests/jdtojewish.phpt b/ext/calendar/tests/jdtojewish.phpt
deleted file mode 100644
index 9ec597aa95..0000000000
--- a/ext/calendar/tests/jdtojewish.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-jdtojewish() function
---FILE--
-<?
-
-var_dump(jdtojewish(gregoriantojd(10,28,2002))."\r\n".
- jdtojewish(gregoriantojd(10,28,2002),true)."\r\n".
- jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n".
- jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_ALAFIM)."\r\n".
- jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_ALAFIM_GERESH+CAL_JEWISH_ADD_ALAFIM)."\r\n".
- jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_GERESHAYIM)."\r\n".
- jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM)."\r\n".
- jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n".
- jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM)."\r\n".
- jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n");
-?>
---EXPECT--
-string(184) "2/22/5763
-ëá çùåï äúùñâ
-ëá çùåï ä'úùñâ
-ëá çùåï ä àìôéí úùñâ
-ëá çùåï ä' àìôéí úùñâ
-ë"á çùåï äúùñ"â
-á' çùåï äúùñ"â
-á' çùåï ä'úùñ"â
-á' çùåï ä àìôéí úùñ"â
-á' çùåï ä' àìôéí úùñ"â
-"
diff --git a/ext/cpdf/CREDITS b/ext/cpdf/CREDITS
deleted file mode 100644
index 94cc1de43c..0000000000
--- a/ext/cpdf/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-cpdf
-Uwe Steinmann
diff --git a/ext/cpdf/config.m4 b/ext/cpdf/config.m4
deleted file mode 100644
index 245dda826b..0000000000
--- a/ext/cpdf/config.m4
+++ /dev/null
@@ -1,96 +0,0 @@
-dnl $Id$
-
-AC_DEFUN(CPDF_TEMP_SUBST,[
- old_LIBS=$LIBS
- $1
- LIBS=$old_LIBS
-])
-
-AC_DEFUN(CPDF_JPEG_TEST,[
- CPDF_TEMP_SUBST([
- AC_ARG_WITH(jpeg-dir,
- [ --with-jpeg-dir[=DIR] CPDF: Set the path to libjpeg install prefix.],[
- for i in $withval /usr/local /usr; do
- if test -f "$i/lib/libjpeg.$SHLIB_SUFFIX_NAME" -o -f "$i/lib/libjpeg.a"; then
- CPDF_JPEG_DIR=$i
- break;
- fi
- done
- if test -z "$CPDF_JPEG_DIR"; then
- AC_MSG_CHECKING([for libjpeg (needed by cpdflib 2.x)])
- AC_MSG_ERROR([libjpeg.(a|so) not found.])
- fi
- LIBS="$LIBS -L$CPDF_JPEG_DIR/lib"
- ],)
- AC_CHECK_LIB(jpeg,jpeg_read_header, ,[AC_MSG_ERROR(Problem with libjpeg.(a|so). Please check config.log for more information.)],)
- if test -z "$CPDF_JPEG_DIR"; then
- PHP_ADD_LIBRARY(jpeg)
- else
- PHP_ADD_LIBRARY_WITH_PATH(jpeg, $CPDF_JPEG_DIR/lib)
- fi
- ])
-])
-
-AC_DEFUN(CPDF_TIFF_TEST,[
- CPDF_TEMP_SUBST([
- AC_ARG_WITH(tiff-dir,
- [ --with-tiff-dir[=DIR] CPDF: Set the path to libtiff install prefix.],[
- for i in $withval /usr/local /usr; do
- if test -f "$i/lib/libtiff.$SHLIB_SUFFIX_NAME" -o -f "$i/lib/libtiff.a"; then
- CPDF_TIFF_DIR=$i
- break;
- fi
- done
- if test -z "$CPDF_TIFF_DIR"; then
- AC_MSG_CHECKING([for libtiff (needed by cpdflib 2.x)])
- AC_MSG_ERROR([libtiff.(a|so) not found.])
- fi
- LIBS="$LIBS -L$CPDF_TIFF_DIR/lib"
- ],)
- AC_CHECK_LIB(tiff,TIFFOpen, ,[AC_MSG_ERROR(Problem with libtiff.(a|so). Please check config.log for more information.)],)
- if test -z "$CPDF_TIFF_DIR"; then
- PHP_ADD_LIBRARY(tiff)
- else
- PHP_ADD_LIBRARY_WITH_PATH(tiff, $CPDF_TIFF_DIR/lib)
- fi
- ])
-])
-
-AC_MSG_CHECKING(for cpdflib support)
-AC_ARG_WITH(cpdflib,
-[ --with-cpdflib[=DIR] Include cpdflib support (requires cpdflib >= 2).],
-[
- if test "$withval" = "no"; then
- AC_MSG_RESULT(no)
- else
- AC_MSG_RESULT(yes)
- PHP_NEW_EXTENSION(cpdf, cpdf.c)
- CPDF_JPEG_TEST
- CPDF_TIFF_TEST
- for i in $withval /usr /usr/local; do
- if test -f "$i/include/cpdflib.h"; then
- CPDFLIB_INCLUDE=$i/include
- AC_MSG_CHECKING(for cpdflib.h)
- AC_MSG_RESULT([in $i/include])
- CPDF_TEMP_SUBST([
- LIBS="$LIBS -L$i/lib"
- AC_CHECK_LIB(cpdf, cpdf_open, [AC_DEFINE(HAVE_CPDFLIB,1,[Whether you have cpdflib])],
- [AC_MSG_ERROR([Cpdflib module requires cpdflib >= 2.])])
- ])
- if test "$i" != "/usr" -a "$i" != "/usr/local"; then
- PHP_ADD_LIBRARY_WITH_PATH(cpdf, $i/lib)
- PHP_ADD_INCLUDE($CPDFLIB_INCLUDE)
- else
- PHP_ADD_LIBRARY(cpdf)
- fi
- break
- fi
- done
- if test -z "$CPDFLIB_INCLUDE"; then
- AC_MSG_CHECKING(for cpdflib.h)
- AC_MSG_ERROR([not found])
- fi
- fi
-],[
- AC_MSG_RESULT(no)
-])
diff --git a/ext/cpdf/cpdf.c b/ext/cpdf/cpdf.c
deleted file mode 100644
index 99edcacdaa..0000000000
--- a/ext/cpdf/cpdf.c
+++ /dev/null
@@ -1,2230 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-/* cpdflib.h -- C language API definitions for ClibPDF library
- * Copyright (C) 1998 FastIO Systems, All Rights Reserved.
-*/
-
-/* Note that there is no code from the cpdflib package in this file */
-
-#if defined(THREAD_SAFE)
-#undef THREAD_SAFE
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "zend_list.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/head.h"
-#include <math.h>
-#if HAVE_GD_BUNDLED
-# include "../gd/libgd/gd.h"
-#else
-# if HAVE_LIBGD13
-# include <gd.h>
-# endif
-#endif
-
-#include <cpdflib.h>
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef PHP_WIN32
-# include <io.h>
-# include <fcntl.h>
-#endif
-
-#if HAVE_CPDFLIB
-#include "php_cpdf.h"
-#include "ext/standard/info.h"
-
-#ifdef THREAD_SAFE
-DWORD CPDFlibTls;
-static int numthreads=0;
-
-typedef struct cpdflib_global_struct{
- int le_cpdf;
- int le_outline;
-#if HAVE_LIBGD13
- int le_gd;
-#endif
-} cpdflib_global_struct;
-
-# define CPDF_GLOBAL(v) TSRMG(CPDFlibTls, cpdflib_global_struct *, v)
-
-#else
-# define CPDF_GLOBAL(a) a
-static int le_cpdf;
-static int le_outline;
-#if HAVE_LIBGD13
-static int le_gd;
-#endif
-#endif
-
-#define CPDF_FETCH_CPDFDOC(pdf_zval) \
- convert_to_long_ex(pdf_zval); \
- id = Z_LVAL_PP(pdf_zval); \
- pdf = zend_list_find(id, &type); \
- if(!pdf || type != CPDF_GLOBAL(le_cpdf)) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find identifier %d", id); \
- RETURN_FALSE; \
- } \
-
-function_entry cpdf_functions[] = {
- PHP_FE(cpdf_global_set_document_limits, NULL)
- PHP_FE(cpdf_set_creator, NULL)
- PHP_FE(cpdf_set_title, NULL)
- PHP_FE(cpdf_set_subject, NULL)
- PHP_FE(cpdf_set_keywords, NULL)
- PHP_FE(cpdf_open, NULL)
- PHP_FE(cpdf_close, NULL)
- PHP_FE(cpdf_set_viewer_preferences, NULL)
- PHP_FE(cpdf_page_init, NULL)
- PHP_FE(cpdf_finalize_page, NULL)
- PHP_FE(cpdf_set_current_page, NULL)
- PHP_FE(cpdf_begin_text, NULL)
- PHP_FE(cpdf_end_text, NULL)
- PHP_FE(cpdf_show, NULL)
- PHP_FE(cpdf_show_xy, NULL)
- PHP_FE(cpdf_text, NULL)
- PHP_FE(cpdf_continue_text, NULL)
- PHP_FE(cpdf_set_font, NULL)
- PHP_FE(cpdf_set_font_directories, NULL)
- PHP_FE(cpdf_set_font_map_file, NULL)
- PHP_FE(cpdf_set_leading, NULL)
- PHP_FE(cpdf_set_text_rendering, NULL)
- PHP_FE(cpdf_set_horiz_scaling, NULL)
- PHP_FE(cpdf_set_text_rise, NULL)
- PHP_FE(cpdf_set_text_matrix, NULL)
- PHP_FE(cpdf_set_text_pos, NULL)
- PHP_FE(cpdf_rotate_text, NULL)
- PHP_FE(cpdf_set_char_spacing, NULL)
- PHP_FE(cpdf_set_word_spacing, NULL)
- PHP_FE(cpdf_stringwidth, NULL)
- PHP_FE(cpdf_save, NULL)
- PHP_FE(cpdf_restore, NULL)
- PHP_FE(cpdf_translate, NULL)
- PHP_FE(cpdf_scale, NULL)
- PHP_FE(cpdf_rotate, NULL)
- PHP_FE(cpdf_setflat, NULL)
- PHP_FE(cpdf_setlinejoin, NULL)
- PHP_FE(cpdf_setlinecap, NULL)
- PHP_FE(cpdf_setmiterlimit, NULL)
- PHP_FE(cpdf_setlinewidth, NULL)
- PHP_FE(cpdf_setdash, NULL)
- PHP_FE(cpdf_moveto, NULL)
- PHP_FE(cpdf_rmoveto, NULL)
- PHP_FE(cpdf_lineto, NULL)
- PHP_FE(cpdf_rlineto, NULL)
- PHP_FE(cpdf_curveto, NULL)
- PHP_FE(cpdf_circle, NULL)
- PHP_FE(cpdf_arc, NULL)
- PHP_FE(cpdf_rect, NULL)
- PHP_FE(cpdf_newpath, NULL)
- PHP_FE(cpdf_closepath, NULL)
- PHP_FE(cpdf_stroke, NULL)
- PHP_FE(cpdf_closepath_stroke, NULL)
- PHP_FE(cpdf_fill, NULL)
- PHP_FE(cpdf_fill_stroke, NULL)
- PHP_FE(cpdf_closepath_fill_stroke, NULL)
- PHP_FE(cpdf_clip, NULL)
- PHP_FE(cpdf_setgray_fill, NULL)
- PHP_FE(cpdf_setgray_stroke, NULL)
- PHP_FE(cpdf_setgray, NULL)
- PHP_FE(cpdf_setrgbcolor_fill, NULL)
- PHP_FE(cpdf_setrgbcolor_stroke, NULL)
- PHP_FE(cpdf_setrgbcolor, NULL)
- PHP_FE(cpdf_set_page_animation, NULL)
- PHP_FE(cpdf_finalize, NULL)
- PHP_FE(cpdf_output_buffer, NULL)
- PHP_FE(cpdf_save_to_file, NULL)
- PHP_FE(cpdf_import_jpeg, NULL)
-#if HAVE_LIBGD13
- PHP_FE(cpdf_place_inline_image, NULL)
-#endif
- PHP_FE(cpdf_add_annotation, NULL)
- PHP_FE(cpdf_add_outline, NULL)
- PHP_FE(cpdf_set_action_url, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry cpdf_module_entry = {
- STANDARD_MODULE_HEADER,
- "cpdf",
- cpdf_functions,
- PHP_MINIT(cpdf),
- PHP_MSHUTDOWN(cpdf),
- PHP_RINIT(cpdf),
- NULL,
- PHP_MINFO(cpdf),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_CPDF
-ZEND_GET_MODULE(cpdf)
-#endif
-
-static void _free_outline(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
-}
-
-static void _free_doc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- CPDFdoc *pdf = (CPDFdoc *)rsrc->ptr;
-
- cpdf_close(pdf);
-}
-
-PHP_MINIT_FUNCTION(cpdf)
-{
- CPDF_GLOBAL(le_outline) = zend_register_list_destructors_ex(_free_outline, NULL, "cpdf outline", module_number);
- CPDF_GLOBAL(le_cpdf) = zend_register_list_destructors_ex(_free_doc, NULL, "cpdf", module_number);
-
- REGISTER_LONG_CONSTANT("CPDF_PM_NONE", PM_NONE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CPDF_PM_OUTLINES", PM_OUTLINES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CPDF_PM_THUMBS", PM_THUMBS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CPDF_PM_FULLSCREEN", PM_FULLSCREEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CPDF_PL_SINGLE", PL_SINGLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CPDF_PL_1COLUMN", PL_1COLUMN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CPDF_PL_2LCOLUMN", PL_2LCOLUMN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CPDF_PL_2RCOLUMN", PL_2RCOLUMN, CONST_CS | CONST_PERSISTENT);
-
-
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(cpdf)
-{
-/* CPDF_GLOBAL(le_outline) = NULL; */
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(cpdf) {
- /* need to use a PHPAPI function here because it is external module in windows */
- /* (don't knwo if that still applies (cmv) */
- php_info_print_table_start();
- php_info_print_table_row(2, "CPDF Support", "enabled");
- php_info_print_table_row(2, "Version", cpdf_version() );
- php_info_print_table_end();
-}
-
-PHP_MSHUTDOWN_FUNCTION(cpdf)
-{
- return SUCCESS;
-}
-
-/* {{{ proto void cpdf_global_set_document_limits(int maxPages, int maxFonts, int maxImages, int maxAnnots, int maxObjects)
- Sets document settings for all documents */
-PHP_FUNCTION(cpdf_global_set_document_limits)
-{
- zval **argv[5];
-
- if (ZEND_NUM_ARGS() != 5 || (zend_get_parameters_array_ex(5, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(argv[0]);
- convert_to_long_ex(argv[1]);
- convert_to_long_ex(argv[2]);
- convert_to_long_ex(argv[3]);
- convert_to_long_ex(argv[4]);
-
- cpdf_setGlobalDocumentLimits(Z_LVAL_PP(argv[0]), Z_LVAL_PP(argv[1]), Z_LVAL_PP(argv[2]), Z_LVAL_PP(argv[3]), Z_LVAL_PP(argv[4]));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool cpdf_set_creator(int pdfdoc, string creator)
- Sets the creator field */
-PHP_FUNCTION(cpdf_set_creator)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_string_ex(arg2);
-
- cpdf_setCreator(pdf, Z_STRVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool cpdf_set_title(int pdfptr, string title)
- Fills the title field of the info structure */
-PHP_FUNCTION(cpdf_set_title)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_string_ex(arg2);
-
- cpdf_setTitle(pdf, Z_STRVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool cpdf_set_subject(int pdfptr, string subject)
- Fills the subject field of the info structure */
-PHP_FUNCTION(cpdf_set_subject)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_string_ex(arg2);
-
- cpdf_setSubject(pdf, Z_STRVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool cpdf_set_keywords(int pdfptr, string keywords)
- Fills the keywords field of the info structure */
-PHP_FUNCTION(cpdf_set_keywords)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_string_ex(arg2);
-
- cpdf_setKeywords(pdf, Z_STRVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_viewer_preferences(int pdfdoc, array preferences)
- How to show the document in the viewer */
-PHP_FUNCTION(cpdf_set_viewer_preferences)
-{
- zval **arg1, **arg2;
- zval **zvalue;
- int id, type;
- CPDFdoc *pdf;
- CPDFviewerPrefs vP = { 0, 0, 0, 0, 0, 0, 0, 0 };
-
- if(ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_array_ex(arg2);
-
- if (zend_hash_find (Z_ARRVAL_PP(arg2), "pagemode", sizeof ("pagemode"), (void **) &zvalue) == SUCCESS) {
- convert_to_long_ex(zvalue);
- vP.pageMode = Z_LVAL_PP(zvalue);
- }
- if (zend_hash_find (Z_ARRVAL_PP(arg2), "hidetoolbar", sizeof ("hidetoolbar"), (void **) &zvalue) == SUCCESS) {
- convert_to_long_ex(zvalue);
- vP.hideToolbar = Z_LVAL_PP(zvalue);
- }
- if (zend_hash_find (Z_ARRVAL_PP(arg2), "hidemenubar", sizeof ("hidemenubar"), (void **) &zvalue) == SUCCESS) {
- convert_to_long_ex(zvalue);
- vP.hideMenubar = Z_LVAL_PP(zvalue);
- }
- if (zend_hash_find (Z_ARRVAL_PP(arg2), "hidewindowui", sizeof ("hidewindowui"), (void **) &zvalue) == SUCCESS) {
- convert_to_long_ex(zvalue);
- vP.hideWindowUI = Z_LVAL_PP(zvalue);
- }
- if (zend_hash_find (Z_ARRVAL_PP(arg2), "fitwindow", sizeof ("fitwindow"), (void **) &zvalue) == SUCCESS) {
- convert_to_long_ex(zvalue);
- vP.fitWindow = Z_LVAL_PP(zvalue);
- }
- if (zend_hash_find (Z_ARRVAL_PP(arg2), "centerwindow", sizeof ("centerwindow"), (void **) &zvalue) == SUCCESS) {
- convert_to_long_ex(zvalue);
- vP.centerWindow = Z_LVAL_PP(zvalue);
- }
- if (zend_hash_find (Z_ARRVAL_PP(arg2), "pagelayout", sizeof ("pagelayout"), (void **) &zvalue) == SUCCESS) {
- convert_to_long_ex(zvalue);
- vP.pageLayout = Z_LVAL_PP(zvalue);
- }
- if (zend_hash_find (Z_ARRVAL_PP(arg2), "nonfspagemode", sizeof ("nonfspagemode"), (void **) &zvalue) == SUCCESS) {
- convert_to_long_ex(zvalue);
- vP.nonFSPageMode = Z_LVAL_PP(zvalue);
- }
-
- cpdf_setViewerPreferences(pdf, &vP);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int cpdf_open(int compression [, string filename [, array doc_limits]])
- Opens a new pdf document */
-PHP_FUNCTION(cpdf_open)
-{
- zval **arg1, **arg2 = NULL, **arg3 = NULL;
- int id;
- CPDFdoc *cpdf;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 3 || (zend_get_parameters_ex(ZEND_NUM_ARGS(), &arg1, &arg2, &arg3) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg1);
-
- cpdf = cpdf_open(0, NULL);
- if(!cpdf)
- RETURN_FALSE;
- if(Z_LVAL_PP(arg1) == 1)
- cpdf_enableCompression(cpdf, YES);
- else
- cpdf_enableCompression(cpdf, NO);
-
- if(arg2) {
- convert_to_string_ex(arg2);
-#if APACHE
- if(strcmp(Z_STRVAL_PP(arg2), "-") == 0)
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Write to a memory stream and use cpdf_output_buffer() instead.");
-#endif
- cpdf_setOutputFilename(cpdf, Z_STRVAL_PP(arg2));
- }
- cpdf_init(cpdf);
-
- id = zend_list_insert(cpdf, CPDF_GLOBAL(le_cpdf));
- RETURN_LONG(id);
-}
-/* }}} */
-
-/* {{{ proto void cpdf_close(int pdfdoc)
- Closes the pdf document */
-PHP_FUNCTION(cpdf_close)
-{
- zval **arg1;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
-
- zend_list_delete(id);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#define BUFFERLEN 40
-/* {{{ proto void cpdf_page_init(int pdfdoc, int pagenr, int orientation, int height, int width [, float unit])
- Starts page */
-PHP_FUNCTION(cpdf_page_init)
-{
- zval **argv[6];
- int id, type, pagenr, orientation;
- int height, width;
- char buffer[BUFFERLEN];
- CPDFdoc *pdf;
- int argc = ZEND_NUM_ARGS();
-
- if(argc < 5 || argc > 6 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_long_ex(argv[1]);
- convert_to_long_ex(argv[2]);
- convert_to_long_ex(argv[3]);
- convert_to_long_ex(argv[4]);
- pagenr=Z_LVAL_PP(argv[1]);
- orientation=Z_LVAL_PP(argv[2]);
- height = Z_LVAL_PP(argv[3]);
- width = Z_LVAL_PP(argv[4]);
-
- if(argc > 5) {
- convert_to_double_ex(argv[5]);
- if(Z_DVAL_PP(argv[5]) > 0.0)
- cpdf_setDefaultDomainUnit(pdf, Z_DVAL_PP(argv[5]));
- }
- snprintf(buffer, BUFFERLEN, "0 0 %d %d", width, height);
- cpdf_pageInit(pdf, pagenr, orientation, buffer, buffer);
-
- RETURN_TRUE;
-}
-/* }}} */
-#undef BUFFERLEN
-
-/* {{{ proto void cpdf_finalize_page(int pdfdoc, int pagenr)
- Ends the page to save memory */
-PHP_FUNCTION(cpdf_finalize_page)
-{
- zval **arg1, **arg2;
- int id, type, pagenr;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_long_ex(arg2);
- pagenr=Z_LVAL_PP(arg2);
-
- cpdf_finalizePage(pdf, pagenr);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_current_page(int pdfdoc, int pagenr)
- Sets page for output */
-PHP_FUNCTION(cpdf_set_current_page)
-{
- zval **arg1, **arg2;
- int id, type, pagenr;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_long_ex(arg2);
- pagenr=Z_LVAL_PP(arg2);
-
- cpdf_setCurrentPage(pdf, pagenr);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_begin_text(int pdfdoc)
- Starts text section */
-PHP_FUNCTION(cpdf_begin_text)
-{
- zval **arg1;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
-
- cpdf_beginText(pdf, 0);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_end_text(int pdfdoc)
- Ends text section */
-PHP_FUNCTION(cpdf_end_text)
-{
- zval **arg1;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
-
- cpdf_endText(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_show(int pdfdoc, string text)
- Output text at current position */
-PHP_FUNCTION(cpdf_show)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_string_ex(arg2);
-
- cpdf_textShow(pdf, Z_STRVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_show_xy(int pdfdoc, string text, float x-koor, float y-koor [, int mode])
- Output text at position */
-PHP_FUNCTION(cpdf_show_xy)
-{
- zval **argv[5];
- int id, type, mode = 0, argc = ZEND_NUM_ARGS();
- CPDFdoc *pdf;
-
- argc = ZEND_NUM_ARGS();
- if(argc < 4 || argc > 5 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_string_ex(argv[1]);
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
-
- if(argc == 5) {
- convert_to_long_ex(argv[4]);
- mode = Z_LVAL_PP(argv[4]);
- }
- if(mode == 1)
- cpdf_rawText(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), 0.0, Z_STRVAL_PP(argv[1]));
- else
- cpdf_text(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), 0.0, Z_STRVAL_PP(argv[1]));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_continue_text(int pdfdoc, string text)
- Outputs text in next line */
-PHP_FUNCTION(cpdf_continue_text)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_string_ex(arg2);
-
- cpdf_textCRLFshow(pdf, Z_STRVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_text(int pdfdoc, string text [, float x-koor, float y-koor [, int mode [, float orientation [, int alignmode]]]])
- Outputs text */
-PHP_FUNCTION(cpdf_text)
-{
- zval **argv[7];
- int id, type, mode = 0, argc = ZEND_NUM_ARGS();
- CPDFdoc *pdf;
-
- if(argc < 2 || argc == 3 || argc > 7 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_string_ex(argv[1]);
-
- if(argc > 4) {
- convert_to_long_ex(argv[4]);
- mode = Z_LVAL_PP(argv[2]);
- }
- switch(argc) {
- case 2:
- cpdf_textShow(pdf, Z_STRVAL_PP(argv[1]));
- break;
- case 4:
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
- cpdf_text(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), 0.0, Z_STRVAL_PP(argv[1]));
- break;
- case 5:
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
- if(mode == 1)
- cpdf_rawText(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), 0.0, Z_STRVAL_PP(argv[1]));
- else
- cpdf_text(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), 0.0, Z_STRVAL_PP(argv[1]));
- break;
- case 6:
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
- convert_to_double_ex(argv[5]);
- if(mode == 1)
- cpdf_rawText(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), (float) Z_DVAL_PP(argv[5]), Z_STRVAL_PP(argv[1]));
- else
- cpdf_text(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), (float) Z_DVAL_PP(argv[5]), Z_STRVAL_PP(argv[1]));
- break;
- case 7:
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
- convert_to_double_ex(argv[5]);
- convert_to_long_ex(argv[6]);
- if(mode == 1)
- cpdf_rawTextAligned(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), (float) Z_DVAL_PP(argv[5]), Z_LVAL_PP(argv[6]), Z_STRVAL_PP(argv[1]));
- else
- cpdf_textAligned(pdf, (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), (float) Z_DVAL_PP(argv[5]), Z_LVAL_PP(argv[6]), Z_STRVAL_PP(argv[1]));
- break;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_font(int pdfdoc, string font, float size, string encoding)
- Selects the current font face, size and encoding */
-PHP_FUNCTION(cpdf_set_font)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_string_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_string_ex(arg4);
-
-/* if(Z_LVAL_PP(arg4) > 6) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Font encoding set to 5");
- Z_LVAL_PP(arg4) = 5;
- }
-*/
- cpdf_setFont(pdf, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg4), (float) Z_DVAL_PP(arg3));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_font_directories(int pdfdoc, string pfmdir, string pfbdir)
- Sets directories to search when using external fonts */
-PHP_FUNCTION(cpdf_set_font_directories)
-{
- zval **arg1, **arg2, **arg3;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- cpdf_setFontDirectories(pdf, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_font_map_file(int pdfdoc, string filename)
- Sets fontname to filename translation map when using external fonts */
-PHP_FUNCTION(cpdf_set_font_map_file)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_string_ex(arg2);
-
- cpdf_setFontMapFile(pdf, Z_STRVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_leading(int pdfdoc, float distance)
- Sets distance between text lines */
-PHP_FUNCTION(cpdf_set_leading)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
-
- cpdf_setTextLeading(pdf, (float) Z_DVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_text_rendering(int pdfdoc, int rendermode)
- Determines how text is rendered */
-PHP_FUNCTION(cpdf_set_text_rendering)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_long_ex(arg2);
-
- cpdf_setTextRenderingMode(pdf, Z_LVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_horiz_scaling(int pdfdoc, float scale)
- Sets horizontal scaling of text */
-PHP_FUNCTION(cpdf_set_horiz_scaling)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
-
- cpdf_setHorizontalScaling(pdf, (float) Z_DVAL_PP(arg2) * 100.0);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_text_rise(int pdfdoc, float value)
- Sets the text rise */
-PHP_FUNCTION(cpdf_set_text_rise)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
-
- cpdf_setTextRise(pdf, (float) Z_DVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_text_matrix(int pdfdoc, array matrix)
- Sets the text matrix */
-PHP_FUNCTION(cpdf_set_text_matrix)
-{
- zval **arg1, **arg2, *data;
- int id, type, i;
- HashTable *matrix;
- CPDFdoc *pdf;
- float *pdfmatrixptr;
- float pdfmatrix[6];
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_array_ex(arg2);
- matrix = Z_ARRVAL_PP(arg2);
-
- if(zend_hash_num_elements(matrix) != 6) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Text matrix must have 6 elements");
- RETURN_FALSE;
- }
-
- pdfmatrixptr = pdfmatrix;
- zend_hash_internal_pointer_reset(matrix);
- for(i=0; i<zend_hash_num_elements(matrix); i++) {
- zend_hash_get_current_data(matrix, (void *) &data);
- switch(Z_TYPE_P(data)) {
- case IS_DOUBLE:
- *pdfmatrixptr++ = (float) Z_DVAL_P(data);
- break;
- default:
- *pdfmatrixptr++ = 0.0;
- break;
- }
- zend_hash_move_forward(matrix);
- }
-
- cpdf_setTextMatrix(pdf, pdfmatrix[0], pdfmatrix[1],
- pdfmatrix[2], pdfmatrix[3],
- pdfmatrix[4], pdfmatrix[5]);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_text_pos(int pdfdoc, float x, float y [, int mode])
- Sets the position of text for the next cpdf_show call */
-PHP_FUNCTION(cpdf_set_text_pos)
-{
- zval **argv[4];
- int id, type, mode = 0, argc = ZEND_NUM_ARGS();
- CPDFdoc *pdf;
-
- if(argc < 3 || argc > 4 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_double_ex(argv[1]);
- convert_to_double_ex(argv[2]);
-
- if(argc > 3) {
- convert_to_long_ex(argv[3]);
- mode = Z_LVAL_PP(argv[3]);
- }
- if(mode == 1)
- cpdf_rawSetTextPosition(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]));
- else
- cpdf_setTextPosition(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_rotate_text(int pdfdoc, float angle)
- Sets text rotation angle */
-PHP_FUNCTION(cpdf_rotate_text)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
-
- cpdf_rotateText(pdf, (float) Z_DVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_char_spacing(int pdfdoc, float space)
- Sets character spacing */
-PHP_FUNCTION(cpdf_set_char_spacing)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
-
- cpdf_setCharacterSpacing(pdf, (float) Z_DVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_word_spacing(int pdfdoc, float space)
- Sets spacing between words */
-PHP_FUNCTION(cpdf_set_word_spacing)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
-
- cpdf_setWordSpacing(pdf, (float) Z_DVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto float cpdf_stringwidth(int pdfdoc, string text)
- Returns width of text in current font */
-PHP_FUNCTION(cpdf_stringwidth)
-{
- zval **arg1, **arg2;
- int id, type;
- double width;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_string_ex(arg2);
-
- width = (double) cpdf_stringWidth(pdf, Z_STRVAL_PP(arg2));
-
- RETURN_DOUBLE((double)width);
-}
-/* }}} */
-
-/* {{{ proto void cpdf_save(int pdfdoc)
- Saves current enviroment */
-PHP_FUNCTION(cpdf_save)
-{
- zval **arg1;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
-
- cpdf_gsave(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_restore(int pdfdoc)
- Restores formerly saved enviroment */
-PHP_FUNCTION(cpdf_restore)
-{
- zval **arg1;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
-
- cpdf_grestore(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_translate(int pdfdoc, float x, float y)
- Sets origin of coordinate system */
-PHP_FUNCTION(cpdf_translate)
-{
- zval **arg1, **arg2, **arg3;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
-
- cpdf_rawTranslate(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_scale(int pdfdoc, float x_scale, float y_scale)
- Sets scaling */
-PHP_FUNCTION(cpdf_scale)
-{
- zval **arg1, **arg2, **arg3;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
-
- cpdf_scale(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_rotate(int pdfdoc, float angle)
- Sets rotation */
-PHP_FUNCTION(cpdf_rotate)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
-
- cpdf_rotate(pdf, (float) Z_DVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setflat(int pdfdoc, float value)
- Sets flatness */
-PHP_FUNCTION(cpdf_setflat)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
-
- if((Z_LVAL_PP(arg2) > 100) && (Z_LVAL_PP(arg2) < 0)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter has to between 0 and 100");
- RETURN_FALSE;
- }
-
- cpdf_setflat(pdf, (int) Z_DVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setlinejoin(int pdfdoc, int value)
- Sets linejoin parameter */
-PHP_FUNCTION(cpdf_setlinejoin)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_long_ex(arg2);
-
- if((Z_LVAL_PP(arg2) > 2) && (Z_LVAL_PP(arg2) < 0)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter has to between 0 and 2");
- RETURN_FALSE;
- }
-
- cpdf_setlinejoin(pdf, Z_LVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setlinecap(int pdfdoc, int value)
- Sets linecap parameter */
-PHP_FUNCTION(cpdf_setlinecap)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_long_ex(arg2);
-
- if((Z_LVAL_PP(arg2) > 2) && (Z_LVAL_PP(arg2) < 0)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter has to be > 0 and =< 2");
- RETURN_FALSE;
- }
-
- cpdf_setlinecap(pdf, Z_LVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setmiterlimit(int pdfdoc, float value)
- Sets miter limit */
-PHP_FUNCTION(cpdf_setmiterlimit)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
-
- if(Z_DVAL_PP(arg2) < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter has to be >= 1");
- RETURN_FALSE;
- }
-
- cpdf_setmiterlimit(pdf, (float) Z_DVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setlinewidth(int pdfdoc, float width)
- Sets line width */
-PHP_FUNCTION(cpdf_setlinewidth)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
-
- cpdf_setlinewidth(pdf, (float) Z_DVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#define BUFFERLEN 20
-/* {{{ proto void cpdf_setdash(int pdfdoc, long white, long black)
- Sets dash pattern */
-PHP_FUNCTION(cpdf_setdash)
-{
- zval **arg1, **arg2, **arg3;
- int id, type;
- char buffer[BUFFERLEN];
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
-
- snprintf(buffer, BUFFERLEN, "[%d %d] 0", (int) Z_LVAL_PP(arg2), (int) Z_LVAL_PP(arg3));
- cpdf_setdash(pdf, buffer);
-
- RETURN_TRUE;
-}
-/* }}} */
-#undef BUFFERLEN
-
-/* {{{ proto void cpdf_moveto(int pdfdoc, float x, float y [, int mode])
- Sets current point */
-PHP_FUNCTION(cpdf_moveto)
-{
- zval **argv[4];
- int id, type, mode = 0, argc = ZEND_NUM_ARGS();
- CPDFdoc *pdf;
-
- if(argc < 3 || argc > 4 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_double_ex(argv[1]);
- convert_to_double_ex(argv[2]);
-
- if(argc > 3) {
- convert_to_long_ex(argv[3]);
- mode = Z_LVAL_PP(argv[3]);
- }
- if(mode == 1)
- cpdf_rawMoveto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]));
- else
- cpdf_moveto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_rmoveto(int pdfdoc, float x, float y [, int mode])
- Sets current point */
-PHP_FUNCTION(cpdf_rmoveto)
-{
- zval **argv[4];
- int id, type, mode = 0, argc = ZEND_NUM_ARGS();
- CPDFdoc *pdf;
-
- if(argc < 3 || argc > 4 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_double_ex(argv[1]);
- convert_to_double_ex(argv[2]);
-
- if(argc > 3) {
- convert_to_long_ex(argv[3]);
- mode = Z_LVAL_PP(argv[3]);
- }
- if(mode == 1)
- cpdf_rawRmoveto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]));
- else
- cpdf_rmoveto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_curveto(int pdfdoc, float x1, float y1, float x2, float y2, float x3, float y3 [, int mode])
- Draws a curve */
-PHP_FUNCTION(cpdf_curveto)
-{
- zval **argv[8];
- int id, type, mode = 0, argc = ZEND_NUM_ARGS();
- CPDFdoc *pdf;
-
- if(argc < 7 || argc > 8 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_double_ex(argv[1]);
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
- convert_to_double_ex(argv[4]);
- convert_to_double_ex(argv[5]);
- convert_to_double_ex(argv[6]);
-
- if(argc > 7) {
- convert_to_long_ex(argv[7]);
- mode = Z_LVAL_PP(argv[7]);
- }
- if(mode == 1)
- cpdf_rawCurveto(pdf, (float) Z_DVAL_PP(argv[1]),
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]),
- (float) Z_DVAL_PP(argv[5]),
- (float) Z_DVAL_PP(argv[6]));
- else
- cpdf_curveto(pdf, (float) Z_DVAL_PP(argv[1]),
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]),
- (float) Z_DVAL_PP(argv[5]),
- (float) Z_DVAL_PP(argv[6]));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_lineto(int pdfdoc, float x, float y [, int mode])
- Draws a line */
-PHP_FUNCTION(cpdf_lineto)
-{
- zval **argv[4];
- int id, type, mode = 0, argc = ZEND_NUM_ARGS();
- CPDFdoc *pdf;
-
- if(argc < 3 || argc > 4 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_double_ex(argv[1]);
- convert_to_double_ex(argv[2]);
-
- if(argc > 3) {
- convert_to_long_ex(argv[3]);
- mode = Z_LVAL_PP(argv[3]);
- }
- if(mode == 1)
- cpdf_rawLineto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]));
- else
- cpdf_lineto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_rlineto(int pdfdoc, float x, float y [, int mode])
- Draws a line relative to current point */
-PHP_FUNCTION(cpdf_rlineto)
-{
- zval **argv[4];
- int id, type, mode = 0, argc = ZEND_NUM_ARGS();
- CPDFdoc *pdf;
-
- if(argc < 3 || argc > 4 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_double_ex(argv[1]);
- convert_to_double_ex(argv[2]);
-
- if(argc > 3) {
- convert_to_long_ex(argv[3]);
- mode = Z_LVAL_PP(argv[3]);
- }
- if(mode == 1)
- cpdf_rawRlineto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]));
- else
- cpdf_rlineto(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_circle(int pdfdoc, float x, float y, float radius [, int mode])
- Draws a circle */
-PHP_FUNCTION(cpdf_circle)
-{
- zval **argv[5];
- int id, type, mode = 0, argc = ZEND_NUM_ARGS();
- CPDFdoc *pdf;
-
- if(argc < 4 || argc > 5 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_double_ex(argv[1]);
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
-
- if(argc > 4) {
- convert_to_long_ex(argv[4]);
- mode = Z_LVAL_PP(argv[4]);
- }
- if(mode == 1)
- cpdf_rawCircle(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]));
- else
- cpdf_circle(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_arc(int pdfdoc, float x, float y, float radius, float start, float end [, int mode])
- Draws an arc */
-PHP_FUNCTION(cpdf_arc)
-{
- zval **argv[7];
- int id, type, mode = 0, argc = ZEND_NUM_ARGS();
- CPDFdoc *pdf;
-
- if(argc < 6 || argc > 7 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_double_ex(argv[1]);
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
- convert_to_double_ex(argv[4]);
- convert_to_double_ex(argv[5]);
-
- if(argc > 6) {
- convert_to_long_ex(argv[6]);
- mode = Z_LVAL_PP(argv[6]);
- }
- if(mode == 1)
- cpdf_rawArc(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), (float) Z_DVAL_PP(argv[4]), (float) Z_DVAL_PP(argv[5]), 1);
- else
- cpdf_arc(pdf, (float) Z_DVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]), (float) Z_DVAL_PP(argv[3]), (float) Z_DVAL_PP(argv[4]), (float) Z_DVAL_PP(argv[5]), 1);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_rect(int pdfdoc, float x, float y, float width, float height [, int mode])
- Draws a rectangle */
-PHP_FUNCTION(cpdf_rect)
-{
- zval **argv[6];
- int id, type, mode = 0, argc = ZEND_NUM_ARGS();
- CPDFdoc *pdf;
-
- if(argc < 5 || argc > 6 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_double_ex(argv[1]);
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
- convert_to_double_ex(argv[4]);
-
- if(argc > 5) {
- convert_to_long_ex(argv[5]);
- mode = Z_LVAL_PP(argv[5]);
- }
- if(mode == 1)
- cpdf_rawRect(pdf, (float) Z_DVAL_PP(argv[1]),
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]));
- else
- cpdf_rect(pdf, (float) Z_DVAL_PP(argv[1]),
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_newpath(int pdfdoc)
- Starts new path */
-PHP_FUNCTION(cpdf_newpath)
-{
- zval **arg1;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
-
- cpdf_newpath(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_closepath(int pdfdoc)
- Close path */
-PHP_FUNCTION(cpdf_closepath)
-{
- zval **arg1;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
-
- cpdf_closepath(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_closepath_stroke(int pdfdoc)
- Close path and draw line along path */
-PHP_FUNCTION(cpdf_closepath_stroke)
-{
- zval **arg1;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
-
- cpdf_closepath(pdf);
- cpdf_stroke(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_stroke(int pdfdoc)
- Draws line along path path */
-PHP_FUNCTION(cpdf_stroke)
-{
- zval **arg1;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
-
- cpdf_stroke(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_fill(int pdfdoc)
- Fills current path */
-PHP_FUNCTION(cpdf_fill)
-{
- zval **arg1;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
-
- cpdf_fill(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_fill_stroke(int pdfdoc)
- Fills and stroke current path */
-PHP_FUNCTION(cpdf_fill_stroke)
-{
- zval **arg1;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
-
- cpdf_fill(pdf);
- cpdf_stroke(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_closepath_fill_stroke(int pdfdoc)
- Close, fill and stroke current path */
-PHP_FUNCTION(cpdf_closepath_fill_stroke)
-{
- zval **arg1;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
-
- cpdf_closepath(pdf);
- cpdf_fill(pdf);
- cpdf_stroke(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_clip(int pdfdoc)
- Clips to current path */
-PHP_FUNCTION(cpdf_clip)
-{
- zval **arg1;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
-
- cpdf_clip(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setgray_fill(int pdfdoc, float value)
- Sets filling color to gray value */
-PHP_FUNCTION(cpdf_setgray_fill)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
-
- cpdf_setgrayFill(pdf, (float) Z_DVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setgray_stroke(int pdfdoc, float value)
- Sets drawing color to gray value */
-PHP_FUNCTION(cpdf_setgray_stroke)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
-
- cpdf_setgrayStroke(pdf, (float) Z_DVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setgray(int pdfdoc, float value)
- Sets drawing and filling color to gray value */
-PHP_FUNCTION(cpdf_setgray)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
-
- cpdf_setgray(pdf, (float) Z_DVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setrgbcolor_fill(int pdfdoc, float red, float green, float blue)
- Sets filling color to rgb color value */
-PHP_FUNCTION(cpdf_setrgbcolor_fill)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
-
- cpdf_setrgbcolorFill(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setrgbcolor_stroke(int pdfdoc, float red, float green, float blue)
- Sets drawing color to RGB color value */
-PHP_FUNCTION(cpdf_setrgbcolor_stroke)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
-
- cpdf_setrgbcolorStroke(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setrgbcolor(int pdfdoc, float red, float green, float blue)
- Sets drawing and filling color to RGB color value */
-PHP_FUNCTION(cpdf_setrgbcolor)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
-
- cpdf_setrgbcolor(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_page_animation(int pdfdoc, int transition, float duration, float direction, int orientation, int inout)
- Sets transition between pages */
-PHP_FUNCTION(cpdf_set_page_animation)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_long_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_long_ex(arg5);
- convert_to_long_ex(arg6);
-
- cpdf_setPageTransition(pdf, Z_LVAL_PP(arg2), Z_DVAL_PP(arg3), Z_DVAL_PP(arg4),
- Z_LVAL_PP(arg5), Z_LVAL_PP(arg6));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array cpdf_finalize(int pdfdoc)
- Creates PDF doc in memory */
-PHP_FUNCTION(cpdf_finalize)
-{
- zval **arg1;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
-
- cpdf_finalizeAll(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array cpdf_output_buffer(int pdfdoc)
- Returns the internal memory stream as string */
-PHP_FUNCTION(cpdf_output_buffer)
-{
- zval **arg1;
- int id, type, lenght;
- CPDFdoc *pdf;
- char *buffer;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
-
- buffer = cpdf_getBufferForPDF(pdf, &lenght);
-
- php_write(buffer, lenght TSRMLS_CC);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array cpdf_save_to_file(int pdfdoc, string filename)
- Saves the internal memory stream to a file */
-PHP_FUNCTION(cpdf_save_to_file)
-{
- zval **arg1, **arg2;
- int id, type;
- CPDFdoc *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(arg1);
- convert_to_string_ex(arg2);
-
-#if APACHE
- if(strcmp(Z_STRVAL_P(arg2), "-") == 0)
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Use cpdf_output_buffer() instead.");
-#endif
-
- cpdf_savePDFmemoryStreamToFile(pdf, Z_STRVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_import_jpeg(int pdfdoc, string filename, float x, float y, float angle, float width, float height, float x_scale, float y_scale, int gsave [, int mode])
- Includes JPEG image */
-PHP_FUNCTION(cpdf_import_jpeg)
-{
- zval **argv[11];
- int id, type, mode = 0, argc = ZEND_NUM_ARGS();
- float width, height, xscale, yscale;
- CPDFdoc *pdf;
-
- if(argc < 10 || argc > 11 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_string_ex(argv[1]);
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
- convert_to_double_ex(argv[4]);
- convert_to_double_ex(argv[5]);
- width = (float) Z_DVAL_PP(argv[5]);
- convert_to_double_ex(argv[6]);
- height = (float) Z_DVAL_PP(argv[6]);
- convert_to_double_ex(argv[7]);
- xscale = (float) Z_DVAL_PP(argv[7]);
- convert_to_double_ex(argv[8]);
- yscale = (float) Z_DVAL_PP(argv[8]);
- convert_to_long_ex(argv[9]);
-
- if(argc > 10) {
- convert_to_long_ex(argv[10]);
- mode = Z_LVAL_PP(argv[10]);
- }
- if(mode == 1)
- cpdf_rawImportImage(pdf, Z_STRVAL_PP(argv[1]),
- JPEG_IMG,
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]),
- &width,
- &height,
- &xscale,
- &yscale,
- Z_LVAL_PP(argv[9]));
- else
- cpdf_rawImportImage(pdf, Z_STRVAL_PP(argv[1]),
- JPEG_IMG,
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]),
- &width,
- &height,
- &xscale,
- &yscale,
- Z_LVAL_PP(argv[9]));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#if HAVE_LIBGD13
-/* {{{ proto void cpdf_place_inline_image(int pdfdoc, int gdimage, float x, float y, float angle, fload width, float height, int gsave [, int mode])
- Includes image */
-PHP_FUNCTION(cpdf_place_inline_image)
-{
- zval **argv[11];
- int id, gid, type, mode = 0, argc = ZEND_NUM_ARGS();
- int count, i, j, color;
- CPDFdoc *pdf;
- unsigned char *buffer, *ptr;
- gdImagePtr im;
-
- if(argc < 8 || argc > 9 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_long_ex(argv[1]);
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
- convert_to_double_ex(argv[4]);
- convert_to_double_ex(argv[5]);
- convert_to_double_ex(argv[6]);
- convert_to_long_ex(argv[7]);
-
- gid=Z_LVAL_PP(argv[1]);
- im = zend_list_find(gid, &type);
-
- ZEND_GET_RESOURCE_TYPE_ID(CPDF_GLOBAL(le_gd), "gd");
- if(!CPDF_GLOBAL(le_gd))
- {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to find handle for GD image stream. Please check the GD extension is loaded.");
- }
-
- if (!im || type != CPDF_GLOBAL(le_gd)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find image pointer");
- RETURN_FALSE;
- }
-
- if(argc > 8) {
- convert_to_long_ex(argv[8]);
- mode = Z_LVAL_PP(argv[8]);
- }
-
- count = 3 * im->sx * im->sy;
- if(NULL == (buffer = (unsigned char *) emalloc(count)))
- RETURN_FALSE;
-
- ptr = buffer;
- for(i=0; i<im->sy; i++) {
- for(j=0; j<im->sx; j++) {
- color = im->pixels[i][j];
- *ptr++ = im->red[color];
- *ptr++ = im->green[color];
- *ptr++ = im->blue[color];
- }
- }
-
- if(mode == 1)
- cpdf_placeInLineImage(pdf, buffer, count,
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]),
- (float) Z_DVAL_PP(argv[5]),
- (float) Z_DVAL_PP(argv[6]),
- im->sx,
- im->sy,
- 8, 2, Z_LVAL_PP(argv[7]));
- else
- cpdf_rawPlaceInLineImage(pdf, buffer, count,
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]),
- (float) Z_DVAL_PP(argv[5]),
- (float) Z_DVAL_PP(argv[6]),
- im->sx,
- im->sy,
- 8, 2, Z_LVAL_PP(argv[7]));
-
- efree(buffer);
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-/* {{{ proto void cpdf_add_annotation(int pdfdoc, float xll, float yll, float xur, float xur, string title, string text [, int mode])
- Sets annotation */
-PHP_FUNCTION(cpdf_add_annotation)
-{
- zval **argv[11];
- int id, type, mode = 0, argc = ZEND_NUM_ARGS();
- CPDFdoc *pdf;
- CPDFannotAttrib attrib;
-
- if(argc < 7 || argc > 8 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_double_ex(argv[1]);
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
- convert_to_double_ex(argv[4]);
- convert_to_string_ex(argv[5]);
- convert_to_string_ex(argv[6]);
-
- attrib.flags = AF_NOZOOM | AF_NOROTATE | AF_READONLY;
- attrib.border_array = "[0 0 1 [4 2]]";
- attrib.BS = NULL;
- attrib.r = 0.00;
- attrib.g = 1.00;
- attrib.b = 1.00;
- if(argc > 7) {
- convert_to_long_ex(argv[7]);
- mode = Z_LVAL_PP(argv[7]);
- }
- if(mode == 1)
- cpdf_rawSetAnnotation(pdf, (float) Z_DVAL_PP(argv[1]),
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]),
- Z_STRVAL_PP(argv[5]),
- Z_STRVAL_PP(argv[6]),
- &attrib);
- else
- cpdf_setAnnotation(pdf, (float) Z_DVAL_PP(argv[1]),
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]),
- Z_STRVAL_PP(argv[5]),
- Z_STRVAL_PP(argv[6]),
- &attrib);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_action_url(int pdfdoc, float xll, float yll, float xur, float xur, string url [, int mode])
- Sets hyperlink */
-PHP_FUNCTION(cpdf_set_action_url)
-{
- zval **argv[11];
- int id, type, mode = 0, argc = ZEND_NUM_ARGS();
- CPDFdoc *pdf;
- CPDFannotAttrib attrib;
-
- if(argc < 6 || argc > 7 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_double_ex(argv[1]);
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
- convert_to_double_ex(argv[4]);
- convert_to_string_ex(argv[5]);
-
- attrib.flags = AF_NOZOOM | AF_NOROTATE | AF_READONLY;
- attrib.border_array = "[0 0 1 [4 0]]";
- attrib.BS = NULL;
- attrib.r = 0.00;
- attrib.g = 0.00;
- attrib.b = 1.00;
- if(argc > 6) {
- convert_to_long_ex(argv[6]);
- mode = Z_LVAL_PP(argv[6]);
- }
- if(mode == 1)
- cpdf_rawSetActionURL(pdf, (float) Z_DVAL_PP(argv[1]),
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]),
- Z_STRVAL_PP(argv[5]),
- &attrib);
- else
- cpdf_setActionURL(pdf, (float) Z_DVAL_PP(argv[1]),
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]),
- Z_STRVAL_PP(argv[5]),
- &attrib);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int cpdf_add_outline(int pdfdoc, int lastoutline, int sublevel, int open, int pagenr, string title)
- Adds outline */
-PHP_FUNCTION(cpdf_add_outline)
-{
- zval **argv[11];
- int id, oid, type, argc = ZEND_NUM_ARGS();
- CPDFdoc *pdf;
- CPDFoutlineEntry *lastoutline;
-
- if(argc != 6 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- CPDF_FETCH_CPDFDOC(argv[0]);
- convert_to_long_ex(argv[1]);
- convert_to_long_ex(argv[2]);
- convert_to_long_ex(argv[3]);
- convert_to_long_ex(argv[4]);
- convert_to_string_ex(argv[5]);
-
- oid=Z_LVAL_PP(argv[1]);
- lastoutline = zend_list_find(oid, &type);
- if(!lastoutline || type!=CPDF_GLOBAL(le_outline)) {
- lastoutline = NULL;
-/* php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find last outline entry %d", id);
- RETURN_FALSE; */
- }
-
- lastoutline = cpdf_addOutlineEntry(pdf, lastoutline,
- Z_LVAL_PP(argv[2]),
- Z_LVAL_PP(argv[3]),
- Z_LVAL_PP(argv[4]),
- Z_STRVAL_PP(argv[5]),
- 1, 0.0, 0.0, 0.0, 0.0);
-
- id = zend_list_insert(lastoutline, CPDF_GLOBAL(le_outline));
- RETURN_LONG(id);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/cpdf/cpdf.dsp b/ext/cpdf/cpdf.dsp
deleted file mode 100644
index 671482e134..0000000000
--- a/ext/cpdf/cpdf.dsp
+++ /dev/null
@@ -1,111 +0,0 @@
-# Microsoft Developer Studio Project File - Name="cpdf" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=cpdf - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "cpdf.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "cpdf.mak" CFG="cpdf - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "cpdf - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "cpdf - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "cpdf - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CPDF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\bindlib_w32" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPDF_EXPORTS" /D "COMPILE_DL_CPDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CPDFLIB=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib cpdfi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib cpdf.lib user32.lib winspool.lib kernel32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_cpdf.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "cpdf - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CPDF" /D ZTS=1 /D MSSQL70=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\bindlib_w32" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPDF_EXPORTS" /D "COMPILE_DL_CPDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CPDFLIB=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib cpdfi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 cpdf.lib php4ts_debug.lib user32.lib winspool.lib kernel32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_cpdf.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "cpdf - Win32 Release_TS"
-# Name "cpdf - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\cpdf.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_cpdf.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/cpdf/php_cpdf.h b/ext/cpdf/php_cpdf.h
deleted file mode 100644
index 1207511e60..0000000000
--- a/ext/cpdf/php_cpdf.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef PHP_CPDF_H
-#define PHP_CPDF_H
-
-#if HAVE_CPDFLIB
-
-/* The macro T is defined in the IMAP headers and clashes with a function
- declaration here. Get rid of it. */
-
-#ifdef T
-#undef T
-#endif
-
-extern zend_module_entry cpdf_module_entry;
-#define cpdf_module_ptr &cpdf_module_entry
-
-PHP_MINFO_FUNCTION(cpdf);
-PHP_MINIT_FUNCTION(cpdf);
-PHP_RINIT_FUNCTION(cpdf);
-PHP_MSHUTDOWN_FUNCTION(cpdf);
-PHP_FUNCTION(cpdf_global_set_document_limits);
-PHP_FUNCTION(cpdf_set_creator);
-PHP_FUNCTION(cpdf_set_title);
-PHP_FUNCTION(cpdf_set_subject);
-PHP_FUNCTION(cpdf_set_keywords);
-PHP_FUNCTION(cpdf_set_viewer_preferences);
-PHP_FUNCTION(cpdf_open);
-PHP_FUNCTION(cpdf_close);
-PHP_FUNCTION(cpdf_page_init);
-PHP_FUNCTION(cpdf_finalize_page);
-PHP_FUNCTION(cpdf_set_current_page);
-PHP_FUNCTION(cpdf_begin_text);
-PHP_FUNCTION(cpdf_end_text);
-PHP_FUNCTION(cpdf_show);
-PHP_FUNCTION(cpdf_show_xy);
-PHP_FUNCTION(cpdf_continue_text);
-PHP_FUNCTION(cpdf_text);
-PHP_FUNCTION(cpdf_set_font);
-PHP_FUNCTION(cpdf_set_font_directories);
-PHP_FUNCTION(cpdf_set_font_map_file);
-PHP_FUNCTION(cpdf_set_leading);
-PHP_FUNCTION(cpdf_set_text_rendering);
-PHP_FUNCTION(cpdf_set_horiz_scaling);
-PHP_FUNCTION(cpdf_set_text_rise);
-PHP_FUNCTION(cpdf_set_text_matrix);
-PHP_FUNCTION(cpdf_set_text_pos);
-PHP_FUNCTION(cpdf_rotate_text);
-PHP_FUNCTION(cpdf_set_char_spacing);
-PHP_FUNCTION(cpdf_set_word_spacing);
-PHP_FUNCTION(cpdf_continue_text);
-PHP_FUNCTION(cpdf_stringwidth);
-PHP_FUNCTION(cpdf_save);
-PHP_FUNCTION(cpdf_restore);
-PHP_FUNCTION(cpdf_translate);
-PHP_FUNCTION(cpdf_scale);
-PHP_FUNCTION(cpdf_rotate);
-PHP_FUNCTION(cpdf_setflat);
-PHP_FUNCTION(cpdf_setlinejoin);
-PHP_FUNCTION(cpdf_setlinecap);
-PHP_FUNCTION(cpdf_setmiterlimit);
-PHP_FUNCTION(cpdf_setlinewidth);
-PHP_FUNCTION(cpdf_setdash);
-PHP_FUNCTION(cpdf_moveto);
-PHP_FUNCTION(cpdf_rmoveto);
-PHP_FUNCTION(cpdf_curveto);
-PHP_FUNCTION(cpdf_lineto);
-PHP_FUNCTION(cpdf_rlineto);
-PHP_FUNCTION(cpdf_circle);
-PHP_FUNCTION(cpdf_arc);
-PHP_FUNCTION(cpdf_rect);
-PHP_FUNCTION(cpdf_newpath);
-PHP_FUNCTION(cpdf_closepath);
-PHP_FUNCTION(cpdf_closepath_stroke);
-PHP_FUNCTION(cpdf_stroke);
-PHP_FUNCTION(cpdf_fill);
-PHP_FUNCTION(cpdf_fill_stroke);
-PHP_FUNCTION(cpdf_closepath_fill_stroke);
-PHP_FUNCTION(cpdf_endpath);
-PHP_FUNCTION(cpdf_clip);
-PHP_FUNCTION(cpdf_setgray_fill);
-PHP_FUNCTION(cpdf_setgray_stroke);
-PHP_FUNCTION(cpdf_setgray);
-PHP_FUNCTION(cpdf_setrgbcolor_fill);
-PHP_FUNCTION(cpdf_setrgbcolor_stroke);
-PHP_FUNCTION(cpdf_setrgbcolor);
-PHP_FUNCTION(cpdf_add_outline);
-PHP_FUNCTION(cpdf_set_page_animation);
-PHP_FUNCTION(cpdf_finalize);
-PHP_FUNCTION(cpdf_output_buffer);
-PHP_FUNCTION(cpdf_save_to_file);
-PHP_FUNCTION(cpdf_add_annotation);
-PHP_FUNCTION(cpdf_import_jpeg);
-#if HAVE_LIBGD13
-PHP_FUNCTION(cpdf_place_inline_image);
-#endif
-PHP_FUNCTION(cpdf_set_action_url);
-#else
-#define cpdf_module_ptr NULL
-#endif
-#define phpext_cpdf_ptr cpdf_module_ptr
-#endif /* _PHP_PDF_H */
diff --git a/ext/crack/CREDITS b/ext/crack/CREDITS
deleted file mode 100644
index d9421275c0..0000000000
--- a/ext/crack/CREDITS
+++ /dev/null
@@ -1,4 +0,0 @@
-crack
-Alexander Feldman
-Windows Port:
-Joseph Tate
diff --git a/ext/crack/EXPERIMENTAL b/ext/crack/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/crack/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/crack/config.m4 b/ext/crack/config.m4
deleted file mode 100644
index d88ccb14bf..0000000000
--- a/ext/crack/config.m4
+++ /dev/null
@@ -1,33 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(crack, for CRACKlib support,
-[ --with-crack[=DIR] Include crack support.])
-
-if test "$PHP_CRACK" != "no"; then
-
- for i in /usr/local/lib /usr/lib $PHP_CRACK/lib $PHP_CRACK/cracklib; do
- test -f $i/libcrack.$SHLIB_SUFFIX_NAME -o -f $i/libcrack.a && CRACK_LIBDIR=$i
- done
-
- for i in /usr/local/include /usr/include $PHP_CRACK/include $PHP_CRACK/cracklib; do
- test -f $i/packer.h && CRACK_INCLUDEDIR=$i
- done
-
- if test -z "$CRACK_LIBDIR"; then
- AC_MSG_ERROR(Cannot find the cracklib library file)
- fi
-
- if test -z "$CRACK_INCLUDEDIR"; then
- AC_MSG_ERROR(Cannot find a cracklib header file)
- fi
-
- PHP_ADD_INCLUDE($CRACK_INCLUDEDIR)
- PHP_ADD_LIBRARY_WITH_PATH(crack, $CRACK_LIBDIR, CRACK_SHARED_LIBADD)
-
- PHP_NEW_EXTENSION(crack, crack.c, $ext_shared)
- PHP_SUBST(CRACK_SHARED_LIBADD)
- AC_DEFINE(HAVE_CRACK, 1, [ ])
-fi
-
diff --git a/ext/crack/crack.c b/ext/crack/crack.c
deleted file mode 100644
index 5bd362d0f5..0000000000
--- a/ext/crack/crack.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Alexander Feldman |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_crack.h"
-
-#if HAVE_CRACK
-
-#include <packer.h>
-
-ZEND_DECLARE_MODULE_GLOBALS(crack)
-
-/* True global resources - no need for thread safety here */
-static int le_crack;
-
-function_entry crack_functions[] = {
- ZEND_FE(crack_opendict, NULL)
- ZEND_FE(crack_closedict, NULL)
- ZEND_FE(crack_check, NULL)
- ZEND_FE(crack_getlastmessage, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry crack_module_entry = {
- STANDARD_MODULE_HEADER,
- "crack",
- crack_functions,
- ZEND_MODULE_STARTUP_N(crack),
- ZEND_MODULE_SHUTDOWN_N(crack),
- ZEND_MODULE_ACTIVATE_N(crack),
- ZEND_MODULE_DEACTIVATE_N(crack),
- ZEND_MODULE_INFO_N(crack),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_CRACK
-ZEND_GET_MODULE(crack)
-#endif
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("crack.default_dictionary", NULL, PHP_INI_SYSTEM, OnUpdateString, default_dictionary, zend_crack_globals, crack_globals)
-PHP_INI_END()
-
-long _crack_open_dict(char *dictpath TSRMLS_DC)
-{
- PWDICT *pwdict;
- long resource;
-
- if (CRACKG(current_id) != -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not use more than one open dictionary with this implementation of libcrack");
- return -1;
- }
- if (NULL == (pwdict = PWOpen(dictpath, "r"))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open a crack dictionary");
- return -1;
- }
-
- resource = zend_list_insert(pwdict, le_crack);
-
-/* if (CRACKG(current_id) != -1) {
- zend_list_delete(CRACKG(current_id));
- }
-*/
- CRACKG(current_id) = resource;
-
- return resource;
-}
-
-void _close_crack_dict(PWDICT *pwdict)
-{
- PWClose(pwdict);
-}
-
-ZEND_MODULE_STARTUP_D(crack)
-{
-#ifdef ZTS
- zend_crack_globals *crack_globals;
-
- ts_allocate_id(&crack_globals_id, sizeof(zend_crack_globals), NULL, NULL);
- crack_globals = ts_resource(crack_globals_id);
-#endif
-
- REGISTER_INI_ENTRIES();
-
- le_crack = register_list_destructors(_close_crack_dict, NULL);
-
- return SUCCESS;
-}
-
-ZEND_MODULE_SHUTDOWN_D(crack)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-ZEND_MODULE_ACTIVATE_D(crack)
-{
- CRACKG(last_message) = NULL;
- CRACKG(current_id) = -1;
-
- return SUCCESS;
-}
-
-ZEND_MODULE_DEACTIVATE_D(crack)
-{
- if (NULL != CRACKG(last_message)) {
- efree(CRACKG(last_message));
- }
- return SUCCESS;
-}
-
-ZEND_MODULE_INFO_D(crack)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "crack support", "enabled");
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-/* {{{ proto string crack_opendict(string dictionary)
- Opens a new cracklib dictionary */
-ZEND_FUNCTION(crack_opendict)
-{
- zval **dictpath;
- long resource;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &dictpath) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(dictpath);
-
- if (-1 == (resource = _crack_open_dict(Z_STRVAL_PP(dictpath) TSRMLS_CC))) {
- RETURN_FALSE;
- }
-
- RETURN_RESOURCE(resource);
-}
-/* }}} */
-
-/* {{{ proto string crack_closedict([int link_identifier])
- Closes an open cracklib dictionary */
-ZEND_FUNCTION(crack_closedict)
-{
- PWDICT *pwdict;
- zval **dictionary;
- long id;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = CRACKG(current_id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &dictionary) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = Z_LVAL_PP(dictionary);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(pwdict, PWDICT *, dictionary, id, "cracklib dictionary", le_crack);
- if (CRACKG(current_id) == id) {
- CRACKG(current_id) = -1;
- }
- zend_list_delete(id);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string crack_check([int dictionary,] string password)
- Performs an obscure check with the given password */
-ZEND_FUNCTION(crack_check)
-{
- zval **dictionary = NULL, **password;
- char pwtrunced[STRINGSIZE];
- char *message;
- PWDICT *pwdict;
- long id;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &password) == FAILURE) {
- RETURN_FALSE;
- }
- if (NULL != CRACKG(default_dictionary) && CRACKG(current_id) == -1) {
- _crack_open_dict(CRACKG(default_dictionary) TSRMLS_CC);
- }
- id = CRACKG(current_id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &dictionary, &password) == FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(pwdict, PWDICT *, dictionary, id, "cracklib dictionary", le_crack);
- convert_to_string_ex(password);
-
- /* Prevent buffer overflow attacks. */
- strlcpy(pwtrunced, Z_STRVAL_PP(password), sizeof(pwtrunced));
-
- message = (char *)FascistLook(pwdict, pwtrunced);
-
- if (NULL != CRACKG(last_message)) {
- efree(CRACKG(last_message));
- }
-
- if (NULL == message) {
- CRACKG(last_message) = estrdup("strong password");
- RETURN_TRUE;
- }
-
- CRACKG(last_message) = estrdup(message);
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string crack_getlastmessage(void)
- Returns the message from the last obscure check */
-ZEND_FUNCTION(crack_getlastmessage)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- if (NULL == CRACKG(last_message)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No obscure checks in this session");
- RETURN_FALSE;
- }
-
- RETURN_STRING(CRACKG(last_message), 1);
-}
-/* }}} */
-
-#endif /* HAVE_CRACK */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/crack/crack.dsp b/ext/crack/crack.dsp
deleted file mode 100644
index bf0e0d9e2d..0000000000
--- a/ext/crack/crack.dsp
+++ /dev/null
@@ -1,114 +0,0 @@
-# Microsoft Developer Studio Project File - Name="crack" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=crack - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "crack.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "crack.mak" CFG="crack - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "crack - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "crack - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "crack - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CRACK" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "CRACK_EXPORTS" /D "COMPILE_DL_CRACK" /D ZTS=1 /D HAVE_CRACK=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 cracklib_Win32.lib wsock32.lib php4ts.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_crack.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "crack - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "mssql-70" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CRACK" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CRACK_EXPORTS" /D "COMPILE_DL_CRACK" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CRACK=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 cracklib_Win32.lib php4ts_debug.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_crack.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "crack - Win32 Release_TS"
-# Name "crack - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\crack.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_crack.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/crack/php_crack.h b/ext/crack/php_crack.h
deleted file mode 100644
index 22f0510cce..0000000000
--- a/ext/crack/php_crack.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Alexander Feldman |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef ZEND_CRACK_H
-#define ZEND_CRACK_H
-
-#if HAVE_CRACK
-
-extern zend_module_entry crack_module_entry;
-#define phpext_crack_ptr &crack_module_entry
-
-#ifdef ZEND_WIN32
-#define ZEND_CRACK_API __declspec(dllexport)
-#else
-#define ZEND_CRACK_API
-#endif
-
-ZEND_MINIT_FUNCTION(crack);
-ZEND_MSHUTDOWN_FUNCTION(crack);
-ZEND_RINIT_FUNCTION(crack);
-ZEND_RSHUTDOWN_FUNCTION(crack);
-PHP_MINFO_FUNCTION(crack);
-
-ZEND_FUNCTION(crack_opendict);
-ZEND_FUNCTION(crack_closedict);
-ZEND_FUNCTION(crack_check);
-ZEND_FUNCTION(crack_getlastmessage);
-
-ZEND_BEGIN_MODULE_GLOBALS(crack)
- char *default_dictionary;
- char *last_message;
- long current_id;
-ZEND_END_MODULE_GLOBALS(crack)
-
-#ifdef ZTS
-#define CRACKG(v) TSRMG(crack_globals_id, zend_crack_globals *, v)
-#else
-#define CRACKG(v) (crack_globals.v)
-#endif
-
-#else
-
-#define phpext_crack_ptr NULL
-
-#endif
-
-#endif /* ZEND_CRACK_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/crack/tests/001.phpt b/ext/crack/tests/001.phpt
deleted file mode 100644
index dc18ef5559..0000000000
--- a/ext/crack/tests/001.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Check for crack presence
---SKIPIF--
-<?php if (!extension_loaded("crack")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "crack extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php4/tests/README for further information on
- writing regression tests
-*/
-?>
---EXPECT--
-crack extension is available \ No newline at end of file
diff --git a/ext/ctype/CREDITS b/ext/ctype/CREDITS
deleted file mode 100644
index 22de902709..0000000000
--- a/ext/ctype/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-ctype
-Hartmut Holzgraefe
diff --git a/ext/ctype/README b/ext/ctype/README
deleted file mode 100644
index 1e78a3d933..0000000000
--- a/ext/ctype/README
+++ /dev/null
@@ -1,5 +0,0 @@
-this is an experimental extension that provides the
-ctype family of function available in C
-i'm not sure about whether they should go into ext/standard
-or stay as an extension of their own and about using
-a ctype_ prefix or sticking with the C names ...
diff --git a/ext/ctype/config.m4 b/ext/ctype/config.m4
deleted file mode 100644
index 7d575a3adc..0000000000
--- a/ext/ctype/config.m4
+++ /dev/null
@@ -1,11 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(ctype, whether to enable ctype functions,
-[ --disable-ctype Disable ctype functions], yes)
-
-if test "$PHP_CTYPE" != "no"; then
- AC_DEFINE(HAVE_CTYPE, 1, [ ])
- PHP_NEW_EXTENSION(ctype, ctype.c, $ext_shared)
-fi
diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c
deleted file mode 100644
index 8ee992fe4c..0000000000
--- a/ext/ctype/ctype.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_ctype.h"
-#include "SAPI.h"
-#include "ext/standard/info.h"
-
-#include <ctype.h>
-
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined.
-*/
-#if HAVE_CTYPE
-
-/* If you declare any globals in php_ctype.h uncomment this:
-ZEND_DECLARE_MODULE_GLOBALS(ctype)
-*/
-
-/* True global resources - no need for thread safety here */
-/* static int le_ctype; */
-
-/* {{{ ctype_functions[]
- * Every user visible function must have an entry in ctype_functions[].
- */
-function_entry ctype_functions[] = {
- PHP_FE(ctype_alnum, NULL)
- PHP_FE(ctype_alpha, NULL)
- PHP_FE(ctype_cntrl, NULL)
- PHP_FE(ctype_digit, NULL)
- PHP_FE(ctype_lower, NULL)
- PHP_FE(ctype_graph, NULL)
- PHP_FE(ctype_print, NULL)
- PHP_FE(ctype_punct, NULL)
- PHP_FE(ctype_space, NULL)
- PHP_FE(ctype_upper, NULL)
- PHP_FE(ctype_xdigit, NULL)
- {NULL, NULL, NULL} /* Must be the last line in ctype_functions[] */
-};
-/* }}} */
-
-/* {{{ ctype_module_entry
- */
-zend_module_entry ctype_module_entry = {
- STANDARD_MODULE_HEADER,
- "ctype",
- ctype_functions,
- NULL,
- NULL,
- NULL,
- NULL,
- PHP_MINFO(ctype),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_CTYPE
-ZEND_GET_MODULE(ctype)
-#endif
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(ctype)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "ctype functions", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ ctype
- */
-#define CTYPE(iswhat) \
- zval *c; \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &c) == FAILURE) \
- return; \
- switch (Z_TYPE_P(c)) { \
- case IS_LONG: \
- RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
- case IS_STRING: \
- { \
- char *p; \
- int n, len; \
- p=Z_STRVAL_P(c); \
- len = Z_STRLEN_P(c); \
- for(n=0;n<len;n++) { \
- if(!iswhat(*p++)) RETURN_FALSE; \
- } \
- RETURN_TRUE; \
- } \
- default: \
- break; \
- } \
- RETURN_FALSE;
-
-/* }}} */
-
-/* {{{ proto bool ctype_alnum(mixed c)
- Checks for alphanumeric character(s) */
-PHP_FUNCTION(ctype_alnum)
-{
- CTYPE(isalnum);
-}
-/* }}} */
-
-/* {{{ proto bool ctype_alpha(mixed c)
- Checks for alphabetic character(s) */
-PHP_FUNCTION(ctype_alpha)
-{
- CTYPE(isalpha);
-}
-/* }}} */
-
-/* {{{ proto bool ctype_cntrl(mixed c)
- Checks for control character(s) */
-PHP_FUNCTION(ctype_cntrl)
-{
- CTYPE(iscntrl);
-}
-/* }}} */
-
-/* {{{ proto bool ctype_digit(mixed c)
- Checks for numeric character(s) */
-PHP_FUNCTION(ctype_digit)
-{
- CTYPE(isdigit);
-}
-/* }}} */
-
-/* {{{ proto bool ctype_lower(mixed c)
- Checks for lowercase character(s) */
-PHP_FUNCTION(ctype_lower)
-{
- CTYPE(islower);
-}
-/* }}} */
-
-/* {{{ proto bool ctype_graph(mixed c)
- Checks for any printable character(s) except space */
-PHP_FUNCTION(ctype_graph)
-{
- CTYPE(isgraph);
-}
-/* }}} */
-
-/* {{{ proto bool ctype_print(mixed c)
- Checks for printable character(s) */
-PHP_FUNCTION(ctype_print)
-{
- CTYPE(isprint);
-}
-/* }}} */
-
-/* {{{ proto bool ctype_punct(mixed c)
- Checks for any printable character which is not whitespace or an alphanumeric character */
-PHP_FUNCTION(ctype_punct)
-{
- CTYPE(ispunct);
-}
-/* }}} */
-
-/* {{{ proto bool ctype_space(mixed c)
- Checks for whitespace character(s)*/
-PHP_FUNCTION(ctype_space)
-{
- CTYPE(isspace);
-}
-/* }}} */
-
-/* {{{ proto bool ctype_upper(mixed c)
- Checks for uppercase character(s) */
-PHP_FUNCTION(ctype_upper)
-{
- CTYPE(isupper);
-}
-/* }}} */
-
-/* {{{ proto bool ctype_xdigit(mixed c)
- Checks for character(s) representing a hexadecimal digit */
-PHP_FUNCTION(ctype_xdigit)
-{
- CTYPE(isxdigit);
-}
-/* }}} */
-
-#endif /* HAVE_CTYPE */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/ctype/ctype.dsp b/ext/ctype/ctype.dsp
deleted file mode 100644
index 8cb2837fed..0000000000
--- a/ext/ctype/ctype.dsp
+++ /dev/null
@@ -1,107 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ctype" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ctype - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ctype.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ctype.mak" CFG="ctype - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ctype - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ctype - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ctype - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CTYPE_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_CTYPE" /D ZTS=1 /D HAVE_CTYPE=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ctype.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ctype - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CTYPE_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_CTYPE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CTYPE=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ctype.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "ctype - Win32 Release_TS"
-# Name "ctype - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ctype.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_ctype.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/ctype/ctype.xml b/ext/ctype/ctype.xml
deleted file mode 100644
index 5837b9b5d0..0000000000
--- a/ext/ctype/ctype.xml
+++ /dev/null
@@ -1,245 +0,0 @@
- <reference id="ref.ctype">
- <title>Character type functions</title>
- <titleabbrev>ctype</titleabbrev>
-
- <partintro>
- <para>
- These functions check whether a character or string
- falls into a certain character class according to the i
- current locale.
- </para>
- <para>
- When called with an integer argument theese functions
- behave exactly like their C counterparts.
- </para>
- <para>
- When called with a string argument they will check
- every character in the string and will only return
- true if every character in the string matches the
- requested criteria.
- </para>
- <para>
- Passing anything else but a string or integer will
- return false immediately.
- </para>
- </partintro>
-
-
- <refentry id="function.isalnum">
- <refnamediv>
- <refname>isalnum</refname>
- <refpurpose>Check for alphanumeric character(s)</refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isalnum</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- See also <function>setlocale</function>.
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.isalpha">
- <refnamediv>
- <refname>isalpha</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isalpha</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.iscntrl">
- <refnamediv>
- <refname>iscntrl</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>iscntrl</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.isdigit">
- <refnamediv>
- <refname>isdigit</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isdigit</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.islower">
- <refnamediv>
- <refname>islower</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>islower</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.isgraph">
- <refnamediv>
- <refname>isgraph</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isgraph</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.isprint">
- <refnamediv>
- <refname>isprint</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isprint</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.ispunct">
- <refnamediv>
- <refname>ispunct</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>ispunct</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.isspace">
- <refnamediv>
- <refname>isspace</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isspace</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.isupper">
- <refnamediv>
- <refname>isupper</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isupper</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.isxdigit">
- <refnamediv>
- <refname>isxdigit</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isxdigit</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- </reference>
-
-<!-- Keep this comment at the end of the file
-Local variables:
-mode: sgml
-sgml-omittag:t
-sgml-shorttag:t
-sgml-minimize-attributes:nil
-sgml-always-quote-attributes:t
-sgml-indent-step:1
-sgml-indent-data:t
-sgml-parent-document:nil
-sgml-default-dtd-file:"../../manual.ced"
-sgml-exposed-tags:nil
-sgml-local-catalogs:nil
-sgml-local-ecat-files:nil
-End:
--->
-
diff --git a/ext/ctype/php_ctype.h b/ext/ctype/php_ctype.h
deleted file mode 100644
index 913b4f222d..0000000000
--- a/ext/ctype/php_ctype.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_CTYPE_H
-#define PHP_CTYPE_H
-
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined.
-*/
-#if HAVE_CTYPE
-
-extern zend_module_entry ctype_module_entry;
-#define phpext_ctype_ptr &ctype_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_CTYPE_API __declspec(dllexport)
-#else
-#define PHP_CTYPE_API
-#endif
-
-PHP_MINIT_FUNCTION(ctype);
-PHP_MSHUTDOWN_FUNCTION(ctype);
-PHP_RINIT_FUNCTION(ctype);
-PHP_RSHUTDOWN_FUNCTION(ctype);
-PHP_MINFO_FUNCTION(ctype);
-
-PHP_FUNCTION(ctype_alnum);
-PHP_FUNCTION(ctype_alpha);
-PHP_FUNCTION(ctype_cntrl);
-PHP_FUNCTION(ctype_digit);
-PHP_FUNCTION(ctype_lower);
-PHP_FUNCTION(ctype_graph);
-PHP_FUNCTION(ctype_print);
-PHP_FUNCTION(ctype_punct);
-PHP_FUNCTION(ctype_space);
-PHP_FUNCTION(ctype_upper);
-PHP_FUNCTION(ctype_xdigit);
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-
-ZEND_BEGIN_MODULE_GLOBALS(ctype)
- int global_variable;
-ZEND_END_MODULE_GLOBALS(ctype)
-*/
-
-#ifdef ZTS
-#define CTYPEG(v) TSRMG(ctype_globals_id, php_ctype_globals *, v)
-#else
-#define CTYPEG(v) (ctype_globals.v)
-#endif
-
-#else
-
-#define phpext_ctype_ptr NULL
-
-#endif
-
-#endif /* PHP_CTYPE_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/ctype/tests/001.phpt b/ext/ctype/tests/001.phpt
deleted file mode 100644
index da13514993..0000000000
--- a/ext/ctype/tests/001.phpt
+++ /dev/null
@@ -1,41 +0,0 @@
---TEST--
-ctype on integers
---SKIPIF--
-<?php if (!extension_loaded("ctype")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
- setlocale(LC_ALL,"C");
-
- function ctype_test_001($function) {
- $n=0;
- for($a=0;$a<256;$a++) {
- if($function($a)) $n++;
- }
- echo "$function $n\n";
- }
-ctype_test_001("ctype_lower");
-ctype_test_001("ctype_upper");
-ctype_test_001("ctype_alpha");
-ctype_test_001("ctype_digit");
-ctype_test_001("ctype_alnum");
-ctype_test_001("ctype_cntrl");
-ctype_test_001("ctype_graph");
-ctype_test_001("ctype_print");
-ctype_test_001("ctype_punct");
-ctype_test_001("ctype_space");
-ctype_test_001("ctype_xdigit");
-?>
---EXPECT--
-ctype_lower 26
-ctype_upper 26
-ctype_alpha 52
-ctype_digit 10
-ctype_alnum 62
-ctype_cntrl 33
-ctype_graph 94
-ctype_print 95
-ctype_punct 32
-ctype_space 6
-ctype_xdigit 22
diff --git a/ext/ctype/tests/002.phpt b/ext/ctype/tests/002.phpt
deleted file mode 100644
index 36e9f662ee..0000000000
--- a/ext/ctype/tests/002.phpt
+++ /dev/null
@@ -1,50 +0,0 @@
---TEST--
-ctype on strings
---SKIPIF--
-<?php if (!extension_loaded("ctype")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-
-setlocale(LC_ALL,"C");
-print "LOCALE is '" . setlocale(LC_ALL,0) . "'\n";
-
-function ctype_test_002($function) {
- $n1 = $n2 = $n3 = 0;
- // test portable POSIX characters 0..127
- for ($a=0;$a<128;$a++) {
- $c = chr($a);
- if($function($a)) $n1++;
- if($function("$c$c$c")) $n2++;
- if($function("1-$c$c$c-x")) $n3++;
- }
- print "$function $n1 $n2 $n3\n";
-}
-
-ctype_test_002("ctype_lower");
-ctype_test_002("ctype_upper");
-ctype_test_002("ctype_alpha");
-ctype_test_002("ctype_digit");
-ctype_test_002("ctype_alnum");
-ctype_test_002("ctype_cntrl");
-ctype_test_002("ctype_graph");
-ctype_test_002("ctype_print");
-ctype_test_002("ctype_punct");
-ctype_test_002("ctype_space");
-ctype_test_002("ctype_xdigit");
-
-?>
---EXPECTF--
-LOCALE is '%s'
-ctype_lower 26 26 0
-ctype_upper 26 26 0
-ctype_alpha 52 52 0
-ctype_digit 10 10 0
-ctype_alnum 62 62 0
-ctype_cntrl 33 33 0
-ctype_graph 94 94 94
-ctype_print 95 95 95
-ctype_punct 32 32 0
-ctype_space 6 6 0
-ctype_xdigit 22 22 0
diff --git a/ext/curl/CREDITS b/ext/curl/CREDITS
deleted file mode 100644
index 610e036787..0000000000
--- a/ext/curl/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-cURL
-Sterling Hughes
diff --git a/ext/curl/config.m4 b/ext/curl/config.m4
deleted file mode 100644
index 6a007b8c15..0000000000
--- a/ext/curl/config.m4
+++ /dev/null
@@ -1,78 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(curl, for CURL support,
-[ --with-curl[=DIR] Include CURL support])
-
-dnl Temporary option while we develop this aspect of the extension
-PHP_ARG_WITH(curlwrappers, if we should use CURL for url streams,
-[ --with-curlwrappers Use CURL for url streams], no, no)
-
-if test "$PHP_CURL" != "no"; then
- if test -r $PHP_CURL/include/curl/easy.h; then
- CURL_DIR=$PHP_CURL
- else
- AC_MSG_CHECKING(for CURL in default path)
- for i in /usr/local /usr; do
- if test -r $i/include/curl/easy.h; then
- CURL_DIR=$i
- AC_MSG_RESULT(found in $i)
- break
- fi
- done
- fi
-
- if test -z "$CURL_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the libcurl distribution -
- easy.h should be in <curl-dir>/include/curl/)
- fi
-
- CURL_CONFIG="curl-config"
- AC_MSG_CHECKING(for cURL 7.10.2 or greater)
-
- if ${CURL_DIR}/bin/curl-config --libs print > /dev/null 2>&1; then
- CURL_CONFIG=${CURL_DIR}/bin/curl-config
- else
- if ${CURL_DIR}/curl-config --libs print > /dev/null 2>&1; then
- CURL_CONFIG=${CURL_DIR}/curl-config
- fi
- fi
-
- curl_version_full=`$CURL_CONFIG --version`
- curl_version=`echo ${curl_version_full} | sed -e 's/libcurl //' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
- if test "$curl_version" -ge 7010002; then
- AC_MSG_RESULT($curl_version_full)
- CURL_LIBS=`$CURL_CONFIG --libs`
- else
- AC_MSG_ERROR(cURL version 7.10.2 or later is required to compile php with cURL support)
- fi
-
- PHP_ADD_INCLUDE($CURL_DIR/include)
- PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/lib, CURL_SHARED_LIBADD)
-
- PHP_CHECK_LIBRARY(curl,curl_easy_perform,
- [
- AC_DEFINE(HAVE_CURL,1,[ ])
- ],[
- AC_MSG_ERROR(There is something wrong. Please check config.log for more information.)
- ],[
- $CURL_LIBS -L$CURL_DIR/lib
- ])
-
- PHP_CHECK_LIBRARY(curl,curl_version_info,
- [
- AC_DEFINE(HAVE_CURL_VERSION_INFO,1,[ ])
- ],[],[
- $CURL_LIBS -L$CURL_DIR/lib
- ])
-
- if test "$PHP_CURLWRAPPERS" != "no" ; then
- AC_DEFINE(PHP_CURL_URL_WRAPPERS,1,[ ])
- fi
-
- PHP_NEW_EXTENSION(curl, interface.c multi.c streams.c, $ext_shared)
- PHP_SUBST(CURL_SHARED_LIBADD)
-fi
diff --git a/ext/curl/curl.dsp b/ext/curl/curl.dsp
deleted file mode 100644
index d0a7167a9b..0000000000
--- a/ext/curl/curl.dsp
+++ /dev/null
@@ -1,186 +0,0 @@
-# Microsoft Developer Studio Project File - Name="curl" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=curl - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "curl.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "curl.mak" CFG="curl - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "curl - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "curl - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "curl - Win32 Debug_TS_SSL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "curl - Win32 Release_TS_SSL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "curl - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CURL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\php_build\curl\include" /D "WIN32" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D HAVE_CURL=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /nodefaultlib:"MSVCRT" /out:"..\..\Release_TS/php_curl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\curl\lib"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "curl - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CURL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\php_build\curl\include" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CURL=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib wsock32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"MSVCRTD" /out:"..\..\Debug_TS/php_curl.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\curl\lib"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "curl - Win32 Debug_TS_SSL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "curl___Win32_Debug_TS_SSL"
-# PROP BASE Intermediate_Dir "curl___Win32_Debug_TS_SSL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS_SSL"
-# PROP Intermediate_Dir "Debug_TS_SSL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CURL=1 /FR /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\php_build\curl\include" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CURL=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts_debug.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"..\..\Debug_TS/php_curl.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php4ts_debug.lib libcurl.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"MSVCRTD" /out:"..\..\Debug_TS/php_curl.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\curl\lib"
-# SUBTRACT LINK32 /pdb:none /nodefaultlib
-
-!ELSEIF "$(CFG)" == "curl - Win32 Release_TS_SSL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "curl___Win32_Release_TS_SSL"
-# PROP BASE Intermediate_Dir "curl___Win32_Release_TS_SSL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_SSL"
-# PROP Intermediate_Dir "Release_TS_SSL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D HAVE_CURL=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\php_build\curl\include" /D "WIN32" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D HAVE_CURL=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"..\..\Release_TS/php_curl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php4ts.lib libcurl.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /nodefaultlib:"MSVCRT" /out:"..\..\Release_TS/php_curl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\curl\lib"
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "curl - Win32 Release_TS"
-# Name "curl - Win32 Debug_TS"
-# Name "curl - Win32 Debug_TS_SSL"
-# Name "curl - Win32 Release_TS_SSL"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\interface.c
-# End Source File
-
-# Begin Source File
-SOURCE=.\multi.c
-# End Source File
-
-# Begin Source File
-SOURCE=.\streams.c
-# End Source File
-
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_curl.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
deleted file mode 100644
index 8c6e7d297c..0000000000
--- a/ext/curl/interface.c
+++ /dev/null
@@ -1,1284 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_CURL
-
-#include <stdio.h>
-#include <string.h>
-
-#ifdef PHP_WIN32
-#include <winsock2.h>
-#include <sys/types.h>
-#endif
-
-#include <curl/curl.h>
-#include <curl/easy.h>
-
-#define SMART_STR_PREALLOC 4096
-
-#include "ext/standard/php_smart_str.h"
-#include "ext/standard/info.h"
-#include "ext/standard/file.h"
-#include "php_curl.h"
-
-static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-
-#define SAVE_CURL_ERROR(__handle, __err) (__handle)->err.no = (int) __err;
-
-#define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s), (long) v);
-#define CAAD(s, v) add_assoc_double_ex(return_value, s, sizeof(s), (double) v);
-#define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s), (char *) v, 1);
-#define CAAZ(s, v) add_assoc_zval_ex(return_value, s, sizeof(s), (zval *) v);
-
-/* {{{ curl_functions[]
- */
-function_entry curl_functions[] = {
- PHP_FE(curl_init, NULL)
- PHP_FE(curl_version, NULL)
- PHP_FE(curl_setopt, NULL)
- PHP_FE(curl_exec, NULL)
- PHP_FE(curl_getinfo, NULL)
- PHP_FE(curl_error, NULL)
- PHP_FE(curl_errno, NULL)
- PHP_FE(curl_close, NULL)
- PHP_FE(curl_multi_init, NULL)
- PHP_FE(curl_multi_add_handle, NULL)
- PHP_FE(curl_multi_remove_handle, NULL)
- PHP_FE(curl_multi_select, NULL)
- PHP_FE(curl_multi_exec, second_arg_force_ref)
- PHP_FE(curl_multi_getcontent, NULL)
- PHP_FE(curl_multi_info_read, NULL)
- PHP_FE(curl_multi_close, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ curl_module_entry
- */
-zend_module_entry curl_module_entry = {
- STANDARD_MODULE_HEADER,
- "curl",
- curl_functions,
- PHP_MINIT(curl),
- PHP_MSHUTDOWN(curl),
- NULL,
- NULL,
- PHP_MINFO(curl),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_CURL
-ZEND_GET_MODULE (curl)
-#endif
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(curl)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "CURL support", "enabled");
- php_info_print_table_row(2, "CURL Information", curl_version());
- php_info_print_table_end();
-}
-/* }}} */
-
-#define REGISTER_CURL_CONSTANT(__c) REGISTER_LONG_CONSTANT(#__c, __c, CONST_CS | CONST_PERSISTENT)
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(curl)
-{
- le_curl = zend_register_list_destructors_ex(_php_curl_close, NULL, "curl", module_number);
- le_curl_multi_handle = zend_register_list_destructors_ex(_php_curl_multi_close, NULL, "curl", module_number);
-
- /* Constants for curl_setopt() */
- REGISTER_CURL_CONSTANT(CURLOPT_DNS_USE_GLOBAL_CACHE);
- REGISTER_CURL_CONSTANT(CURLOPT_DNS_CACHE_TIMEOUT);
- REGISTER_CURL_CONSTANT(CURLOPT_PORT);
- REGISTER_CURL_CONSTANT(CURLOPT_FILE);
- REGISTER_CURL_CONSTANT(CURLOPT_INFILE);
- REGISTER_CURL_CONSTANT(CURLOPT_INFILESIZE);
- REGISTER_CURL_CONSTANT(CURLOPT_URL);
- REGISTER_CURL_CONSTANT(CURLOPT_PROXY);
- REGISTER_CURL_CONSTANT(CURLOPT_VERBOSE);
- REGISTER_CURL_CONSTANT(CURLOPT_HEADER);
- REGISTER_CURL_CONSTANT(CURLOPT_HTTPHEADER);
- REGISTER_CURL_CONSTANT(CURLOPT_NOPROGRESS);
- REGISTER_CURL_CONSTANT(CURLOPT_NOBODY);
- REGISTER_CURL_CONSTANT(CURLOPT_FAILONERROR);
- REGISTER_CURL_CONSTANT(CURLOPT_UPLOAD);
- REGISTER_CURL_CONSTANT(CURLOPT_POST);
- REGISTER_CURL_CONSTANT(CURLOPT_FTPLISTONLY);
- REGISTER_CURL_CONSTANT(CURLOPT_FTPAPPEND);
- REGISTER_CURL_CONSTANT(CURLOPT_NETRC);
- REGISTER_CURL_CONSTANT(CURLOPT_FOLLOWLOCATION);
- REGISTER_CURL_CONSTANT(CURLOPT_FTPASCII);
- REGISTER_CURL_CONSTANT(CURLOPT_PUT);
- REGISTER_CURL_CONSTANT(CURLOPT_MUTE);
- REGISTER_CURL_CONSTANT(CURLOPT_USERPWD);
- REGISTER_CURL_CONSTANT(CURLOPT_PROXYUSERPWD);
- REGISTER_CURL_CONSTANT(CURLOPT_RANGE);
- REGISTER_CURL_CONSTANT(CURLOPT_TIMEOUT);
- REGISTER_CURL_CONSTANT(CURLOPT_POSTFIELDS);
- REGISTER_CURL_CONSTANT(CURLOPT_REFERER);
- REGISTER_CURL_CONSTANT(CURLOPT_USERAGENT);
- REGISTER_CURL_CONSTANT(CURLOPT_FTPPORT);
- REGISTER_CURL_CONSTANT(CURLOPT_FTP_USE_EPSV);
- REGISTER_CURL_CONSTANT(CURLOPT_LOW_SPEED_LIMIT);
- REGISTER_CURL_CONSTANT(CURLOPT_LOW_SPEED_TIME);
- REGISTER_CURL_CONSTANT(CURLOPT_RESUME_FROM);
- REGISTER_CURL_CONSTANT(CURLOPT_COOKIE);
- REGISTER_CURL_CONSTANT(CURLOPT_SSLCERT);
- REGISTER_CURL_CONSTANT(CURLOPT_SSLCERTPASSWD);
- REGISTER_CURL_CONSTANT(CURLOPT_WRITEHEADER);
- REGISTER_CURL_CONSTANT(CURLOPT_SSL_VERIFYHOST);
- REGISTER_CURL_CONSTANT(CURLOPT_COOKIEFILE);
- REGISTER_CURL_CONSTANT(CURLOPT_SSLVERSION);
- REGISTER_CURL_CONSTANT(CURLOPT_TIMECONDITION);
- REGISTER_CURL_CONSTANT(CURLOPT_TIMEVALUE);
- REGISTER_CURL_CONSTANT(CURLOPT_CUSTOMREQUEST);
- REGISTER_CURL_CONSTANT(CURLOPT_STDERR);
- REGISTER_CURL_CONSTANT(CURLOPT_TRANSFERTEXT);
- REGISTER_CURL_CONSTANT(CURLOPT_RETURNTRANSFER);
- REGISTER_CURL_CONSTANT(CURLOPT_QUOTE);
- REGISTER_CURL_CONSTANT(CURLOPT_POSTQUOTE);
- REGISTER_CURL_CONSTANT(CURLOPT_INTERFACE);
- REGISTER_CURL_CONSTANT(CURLOPT_KRB4LEVEL);
- REGISTER_CURL_CONSTANT(CURLOPT_HTTPPROXYTUNNEL);
- REGISTER_CURL_CONSTANT(CURLOPT_FILETIME);
- REGISTER_CURL_CONSTANT(CURLOPT_WRITEFUNCTION);
- REGISTER_CURL_CONSTANT(CURLOPT_READFUNCTION);
- REGISTER_CURL_CONSTANT(CURLOPT_PASSWDFUNCTION);
- REGISTER_CURL_CONSTANT(CURLOPT_HEADERFUNCTION);
- REGISTER_CURL_CONSTANT(CURLOPT_MAXREDIRS);
- REGISTER_CURL_CONSTANT(CURLOPT_MAXCONNECTS);
- REGISTER_CURL_CONSTANT(CURLOPT_CLOSEPOLICY);
- REGISTER_CURL_CONSTANT(CURLOPT_FRESH_CONNECT);
- REGISTER_CURL_CONSTANT(CURLOPT_FORBID_REUSE);
- REGISTER_CURL_CONSTANT(CURLOPT_RANDOM_FILE);
- REGISTER_CURL_CONSTANT(CURLOPT_EGDSOCKET);
- REGISTER_CURL_CONSTANT(CURLOPT_CONNECTTIMEOUT);
- REGISTER_CURL_CONSTANT(CURLOPT_SSL_VERIFYPEER);
- REGISTER_CURL_CONSTANT(CURLOPT_CAINFO);
- REGISTER_CURL_CONSTANT(CURLOPT_CAPATH);
- REGISTER_CURL_CONSTANT(CURLOPT_COOKIEJAR);
- REGISTER_CURL_CONSTANT(CURLOPT_SSL_CIPHER_LIST);
- REGISTER_CURL_CONSTANT(CURLOPT_BINARYTRANSFER);
- REGISTER_CURL_CONSTANT(CURLOPT_NOSIGNAL);
- REGISTER_CURL_CONSTANT(CURLOPT_PROXYTYPE);
- REGISTER_CURL_CONSTANT(CURLOPT_BUFFERSIZE);
- REGISTER_CURL_CONSTANT(CURLOPT_HTTPGET);
- REGISTER_CURL_CONSTANT(CURLOPT_HTTP_VERSION);
- REGISTER_CURL_CONSTANT(CURLOPT_SSLKEY);
- REGISTER_CURL_CONSTANT(CURLOPT_SSLKEYTYPE);
- REGISTER_CURL_CONSTANT(CURLOPT_SSLKEYPASSWD);
- REGISTER_CURL_CONSTANT(CURLOPT_SSLENGINE);
- REGISTER_CURL_CONSTANT(CURLOPT_SSLENGINE_DEFAULT);
- REGISTER_CURL_CONSTANT(CURLOPT_CRLF);
- REGISTER_CURL_CONSTANT(CURLOPT_ENCODING);
-
- /* Constants effecting the way CURLOPT_CLOSEPOLICY works */
- REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_RECENTLY_USED);
- REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_TRAFFIC);
- REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_SLOWEST);
- REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_CALLBACK);
- REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_OLDEST);
-
- /* Info constants */
- REGISTER_CURL_CONSTANT(CURLINFO_EFFECTIVE_URL);
- REGISTER_CURL_CONSTANT(CURLINFO_HTTP_CODE);
- REGISTER_CURL_CONSTANT(CURLINFO_HEADER_SIZE);
- REGISTER_CURL_CONSTANT(CURLINFO_REQUEST_SIZE);
- REGISTER_CURL_CONSTANT(CURLINFO_TOTAL_TIME);
- REGISTER_CURL_CONSTANT(CURLINFO_NAMELOOKUP_TIME);
- REGISTER_CURL_CONSTANT(CURLINFO_CONNECT_TIME);
- REGISTER_CURL_CONSTANT(CURLINFO_PRETRANSFER_TIME);
- REGISTER_CURL_CONSTANT(CURLINFO_SIZE_UPLOAD);
- REGISTER_CURL_CONSTANT(CURLINFO_SIZE_DOWNLOAD);
- REGISTER_CURL_CONSTANT(CURLINFO_SPEED_DOWNLOAD);
- REGISTER_CURL_CONSTANT(CURLINFO_SPEED_UPLOAD);
- REGISTER_CURL_CONSTANT(CURLINFO_FILETIME);
- REGISTER_CURL_CONSTANT(CURLINFO_SSL_VERIFYRESULT);
- REGISTER_CURL_CONSTANT(CURLINFO_CONTENT_LENGTH_DOWNLOAD);
- REGISTER_CURL_CONSTANT(CURLINFO_CONTENT_LENGTH_UPLOAD);
- REGISTER_CURL_CONSTANT(CURLINFO_STARTTRANSFER_TIME);
- REGISTER_CURL_CONSTANT(CURLINFO_CONTENT_TYPE);
- REGISTER_CURL_CONSTANT(CURLINFO_REDIRECT_TIME);
- REGISTER_CURL_CONSTANT(CURLINFO_REDIRECT_COUNT);
-
- /* cURL protocol constants (curl_version) */
- REGISTER_CURL_CONSTANT(CURL_VERSION_IPV6);
- REGISTER_CURL_CONSTANT(CURL_VERSION_KERBEROS4);
- REGISTER_CURL_CONSTANT(CURL_VERSION_SSL);
- REGISTER_CURL_CONSTANT(CURL_VERSION_LIBZ);
-
- /* version constants */
- REGISTER_CURL_CONSTANT(CURLVERSION_NOW);
-
- /* Error Constants */
- REGISTER_CURL_CONSTANT(CURLE_OK);
- REGISTER_CURL_CONSTANT(CURLE_UNSUPPORTED_PROTOCOL);
- REGISTER_CURL_CONSTANT(CURLE_FAILED_INIT);
- REGISTER_CURL_CONSTANT(CURLE_URL_MALFORMAT);
- REGISTER_CURL_CONSTANT(CURLE_URL_MALFORMAT_USER);
- REGISTER_CURL_CONSTANT(CURLE_COULDNT_RESOLVE_PROXY);
- REGISTER_CURL_CONSTANT(CURLE_COULDNT_RESOLVE_HOST);
- REGISTER_CURL_CONSTANT(CURLE_COULDNT_CONNECT);
- REGISTER_CURL_CONSTANT(CURLE_FTP_WEIRD_SERVER_REPLY);
- REGISTER_CURL_CONSTANT(CURLE_FTP_ACCESS_DENIED);
- REGISTER_CURL_CONSTANT(CURLE_FTP_USER_PASSWORD_INCORRECT);
- REGISTER_CURL_CONSTANT(CURLE_FTP_WEIRD_PASS_REPLY);
- REGISTER_CURL_CONSTANT(CURLE_FTP_WEIRD_USER_REPLY);
- REGISTER_CURL_CONSTANT(CURLE_FTP_WEIRD_PASV_REPLY);
- REGISTER_CURL_CONSTANT(CURLE_FTP_WEIRD_227_FORMAT);
- REGISTER_CURL_CONSTANT(CURLE_FTP_CANT_GET_HOST);
- REGISTER_CURL_CONSTANT(CURLE_FTP_CANT_RECONNECT);
- REGISTER_CURL_CONSTANT(CURLE_FTP_COULDNT_SET_BINARY);
- REGISTER_CURL_CONSTANT(CURLE_PARTIAL_FILE);
- REGISTER_CURL_CONSTANT(CURLE_FTP_COULDNT_RETR_FILE);
- REGISTER_CURL_CONSTANT(CURLE_FTP_WRITE_ERROR);
- REGISTER_CURL_CONSTANT(CURLE_FTP_QUOTE_ERROR);
- REGISTER_CURL_CONSTANT(CURLE_HTTP_NOT_FOUND);
- REGISTER_CURL_CONSTANT(CURLE_WRITE_ERROR);
- REGISTER_CURL_CONSTANT(CURLE_MALFORMAT_USER);
- REGISTER_CURL_CONSTANT(CURLE_FTP_COULDNT_STOR_FILE);
- REGISTER_CURL_CONSTANT(CURLE_READ_ERROR);
- REGISTER_CURL_CONSTANT(CURLE_OUT_OF_MEMORY);
- REGISTER_CURL_CONSTANT(CURLE_OPERATION_TIMEOUTED);
- REGISTER_CURL_CONSTANT(CURLE_FTP_COULDNT_SET_ASCII);
- REGISTER_CURL_CONSTANT(CURLE_FTP_PORT_FAILED);
- REGISTER_CURL_CONSTANT(CURLE_FTP_COULDNT_USE_REST);
- REGISTER_CURL_CONSTANT(CURLE_FTP_COULDNT_GET_SIZE);
- REGISTER_CURL_CONSTANT(CURLE_HTTP_RANGE_ERROR);
- REGISTER_CURL_CONSTANT(CURLE_HTTP_POST_ERROR);
- REGISTER_CURL_CONSTANT(CURLE_SSL_CONNECT_ERROR);
- REGISTER_CURL_CONSTANT(CURLE_FTP_BAD_DOWNLOAD_RESUME);
- REGISTER_CURL_CONSTANT(CURLE_FILE_COULDNT_READ_FILE);
- REGISTER_CURL_CONSTANT(CURLE_LDAP_CANNOT_BIND);
- REGISTER_CURL_CONSTANT(CURLE_LDAP_SEARCH_FAILED);
- REGISTER_CURL_CONSTANT(CURLE_LIBRARY_NOT_FOUND);
- REGISTER_CURL_CONSTANT(CURLE_FUNCTION_NOT_FOUND);
- REGISTER_CURL_CONSTANT(CURLE_ABORTED_BY_CALLBACK);
- REGISTER_CURL_CONSTANT(CURLE_BAD_FUNCTION_ARGUMENT);
- REGISTER_CURL_CONSTANT(CURLE_BAD_CALLING_ORDER);
- REGISTER_CURL_CONSTANT(CURLE_HTTP_PORT_FAILED);
- REGISTER_CURL_CONSTANT(CURLE_BAD_PASSWORD_ENTERED);
- REGISTER_CURL_CONSTANT(CURLE_TOO_MANY_REDIRECTS);
- REGISTER_CURL_CONSTANT(CURLE_UNKNOWN_TELNET_OPTION);
- REGISTER_CURL_CONSTANT(CURLE_TELNET_OPTION_SYNTAX);
- REGISTER_CURL_CONSTANT(CURLE_OBSOLETE);
- REGISTER_CURL_CONSTANT(CURLE_SSL_PEER_CERTIFICATE);
-
- REGISTER_CURL_CONSTANT(CURLPROXY_HTTP);
- REGISTER_CURL_CONSTANT(CURLPROXY_SOCKS5);
-
- REGISTER_CURL_CONSTANT(CURL_NETRC_OPTIONAL);
- REGISTER_CURL_CONSTANT(CURL_NETRC_IGNORED);
- REGISTER_CURL_CONSTANT(CURL_NETRC_REQUIRED);
-
- REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_NONE);
- REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_1_0);
- REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_1_1);
-
- REGISTER_CURL_CONSTANT(CURLM_CALL_MULTI_PERFORM);
- REGISTER_CURL_CONSTANT(CURLM_OK);
- REGISTER_CURL_CONSTANT(CURLM_BAD_HANDLE);
- REGISTER_CURL_CONSTANT(CURLM_BAD_EASY_HANDLE);
- REGISTER_CURL_CONSTANT(CURLM_OUT_OF_MEMORY);
- REGISTER_CURL_CONSTANT(CURLM_INTERNAL_ERROR);
-
- REGISTER_CURL_CONSTANT(CURLMSG_DONE);
-
- if (curl_global_init(CURL_GLOBAL_SSL) != CURLE_OK) {
- return FAILURE;
- }
-
-#ifdef PHP_CURL_URL_WRAPPERS
-# if HAVE_CURL_VERSION_INFO
- {
- curl_version_info_data *info = curl_version_info(CURLVERSION_NOW);
- char **p = (char **)info->protocols;
-
- while (*p != NULL) {
- php_register_url_stream_wrapper(*p++, &php_curl_wrapper TSRMLS_CC);
- }
- }
-# else
- php_register_url_stream_wrapper("http", &php_curl_wrapper TSRMLS_CC);
- php_register_url_stream_wrapper("https", &php_curl_wrapper TSRMLS_CC);
- php_register_url_stream_wrapper("ftp", &php_curl_wrapper TSRMLS_CC);
- php_register_url_stream_wrapper("ldap", &php_curl_wrapper TSRMLS_CC);
-# endif
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(curl)
-{
-#ifdef PHP_CURL_URL_WRAPPERS
- php_unregister_url_stream_wrapper("http" TSRMLS_CC);
- php_unregister_url_stream_wrapper("https" TSRMLS_CC);
- php_unregister_url_stream_wrapper("ftp" TSRMLS_CC);
- php_unregister_url_stream_wrapper("ldap" TSRMLS_CC);
-#endif
- curl_global_cleanup();
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ curl_write
- */
-static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
-{
- php_curl *ch = (php_curl *) ctx;
- php_curl_write *t = ch->handlers->write;
- size_t length = size * nmemb;
- TSRMLS_FETCH_FROM_CTX(ch->thread_ctx);
-
-#if PHP_CURL_DEBUG
- fprintf(stderr, "curl_write() called\n");
- fprintf(stderr, "data = %s, size = %d, nmemb = %d, ctx = %x\n", data, size, nmemb, ctx);
-#endif
-
- switch (t->method) {
- case PHP_CURL_STDOUT:
- PHPWRITE(data, size);
- break;
- case PHP_CURL_FILE:
- return fwrite(data, size, nmemb, t->fp);
- case PHP_CURL_RETURN:
- smart_str_appendl(&t->buf, data, (int) length);
- break;
- case PHP_CURL_USER: {
- zval *argv[2];
- zval *retval;
- int error;
-
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(retval);
-
- ZVAL_RESOURCE(argv[0], ch->id);
- zend_list_addref(ch->id);
- ZVAL_STRINGL(argv[1], data, length, 1);
-
- error = call_user_function(EG(function_table), NULL, t->func, retval, 2, argv TSRMLS_CC);
-
- if (error == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_WRITEFUNCTION");
- length = -1;
- } else {
- length = Z_LVAL_P(retval);
- }
-
- zval_ptr_dtor(&argv[0]);
- zval_ptr_dtor(&argv[1]);
- zval_ptr_dtor(&retval);
- break;
- }
- }
-
- return length;
-}
-/* }}} */
-
-/* {{{ curl_read
- */
-static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
-{
- php_curl *ch = (php_curl *) ctx;
- php_curl_read *t = ch->handlers->read;
- int length = -1;
-
- switch (t->method) {
- case PHP_CURL_DIRECT:
- if (t->fp) {
- length = fread(data, size, nmemb, t->fp);
- }
- break;
- case PHP_CURL_USER: {
- zval *argv[3];
- zval *retval;
- int length;
- int error;
- TSRMLS_FETCH_FROM_CTX(ch->thread_ctx);
-
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
- MAKE_STD_ZVAL(retval);
-
- ZVAL_RESOURCE(argv[0], ch->id);
- zend_list_addref(ch->id);
- ZVAL_RESOURCE(argv[1], t->fd);
- zend_list_addref(t->fd);
- ZVAL_LONG(argv[2], (int) size * nmemb);
-
- error = call_user_function(EG(function_table), NULL, t->func, retval, 3, argv TSRMLS_CC);
- if (error == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_READFUNCTION");
- length = -1;
- } else {
- memcpy(data, Z_STRVAL_P(retval), size * nmemb);
- length = Z_STRLEN_P(retval);
- }
-
- zval_ptr_dtor(&argv[0]);
- zval_ptr_dtor(&argv[1]);
- zval_ptr_dtor(&argv[2]);
- zval_ptr_dtor(&retval);
- break;
- }
- }
-
- return length;
-}
-/* }}} */
-
-/* {{{ curl_write_header
- */
-static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx)
-{
- php_curl *ch = (php_curl *) ctx;
- php_curl_write *t = ch->handlers->write_header;
- size_t length = size * nmemb;
- TSRMLS_FETCH_FROM_CTX(ch->thread_ctx);
-
- switch (t->method) {
- case PHP_CURL_STDOUT:
- /* Handle special case write when we're returning the entire transfer
- */
- if (ch->handlers->write->method == PHP_CURL_RETURN) {
- smart_str_appendl(&ch->handlers->write->buf, data, (int) length);
- } else {
- PHPWRITE(data, size);
- }
- break;
- case PHP_CURL_FILE:
- return fwrite(data, size, nmemb, t->fp);
- case PHP_CURL_USER: {
- zval *argv[2];
- zval *retval;
- int error;
-
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(retval);
-
- ZVAL_RESOURCE(argv[0], ch->id);
- zend_list_addref(ch->id);
- ZVAL_STRINGL(argv[1], data, length, 1);
-
- error = call_user_function(EG(function_table), NULL, t->func, retval, 2, argv TSRMLS_CC);
- if (error == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_HEADERFUNCTION");
- length = -1;
- } else {
- length = Z_LVAL_P(retval);
- }
- zval_ptr_dtor(&argv[0]);
- zval_ptr_dtor(&argv[1]);
- zval_ptr_dtor(&retval);
- break;
- }
- case PHP_CURL_IGNORE:
- return length;
- }
-
- return length;
-}
-/* }}} */
-
-/* {{{ curl_passwd
- */
-static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
-{
- php_curl *ch = (php_curl *) ctx;
- zval *func = ch->handlers->passwd;
- zval *argv[3];
- zval *retval = NULL;
- int error;
- int ret = 0;
- TSRMLS_FETCH_FROM_CTX(ch->thread_ctx);
-
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
-
- ZVAL_RESOURCE(argv[0], ch->id);
- zend_list_addref(ch->id);
- ZVAL_STRING(argv[1], prompt, 1);
- ZVAL_LONG(argv[2], buflen);
-
- error = call_user_function(EG(function_table), NULL, func, retval, 2, argv TSRMLS_CC);
- if (error == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_PASSWDFUNCTION");
- ret = -1;
- } else {
- if (Z_STRLEN_P(retval) > buflen) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Returned password is too long for libcurl to handle");
- ret = -1;
- } else {
- strlcpy(buf, Z_STRVAL_P(retval), buflen);
- }
- }
-
- zval_ptr_dtor(&argv[0]);
- zval_ptr_dtor(&argv[1]);
- zval_ptr_dtor(&argv[2]);
- zval_ptr_dtor(&retval);
-
- return ret;
-}
-/* }}} */
-
-/* {{{ curl_free_string
- */
-static void curl_free_string(void **string)
-{
- efree(*string);
-}
-/* }}} */
-
-/* {{{ curl_free_post
- */
-static void curl_free_post(void **post)
-{
- curl_formfree((struct HttpPost *) *post);
-}
-/* }}} */
-
-/* {{{ curl_free_slist
- */
-static void curl_free_slist(void **slist)
-{
- curl_slist_free_all((struct curl_slist *) *slist);
-}
-/* }}} */
-
-/* {{{ proto array curl_version([int version])
- Return cURL version information. */
-PHP_FUNCTION(curl_version)
-{
- curl_version_info_data *d;
- long uversion = CURLVERSION_NOW;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &uversion) == FAILURE) {
- return;
- }
-
- d = curl_version_info(uversion);
- if (d == NULL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- CAAL("version_number", d->version_num);
- CAAL("age", d->age);
- CAAL("features", d->features);
- CAAL("ssl_version_number", d->ssl_version_num);
- CAAS("version", d->version);
- CAAS("host", d->host);
- CAAS("ssl_version", d->ssl_version);
- CAAS("libz_version", d->libz_version);
- /* Add an array of protocols */
- {
- char **p = (char **) d->protocols;
- zval *protocol_list = NULL;
-
- MAKE_STD_ZVAL(protocol_list);
- array_init(protocol_list);
-
- while (*p != NULL) {
- add_next_index_string(protocol_list, *p++, 1);
- }
- CAAZ("protocols", protocol_list);
- }
-}
-/* }}} */
-
-/* {{{ alloc_curl_handle
- */
-static void alloc_curl_handle(php_curl **ch)
-{
- *ch = emalloc(sizeof(php_curl));
- (*ch)->handlers = ecalloc(1, sizeof(php_curl_handlers));
- (*ch)->handlers->write = ecalloc(1, sizeof(php_curl_write));
- (*ch)->handlers->write_header = ecalloc(1, sizeof(php_curl_write));
- (*ch)->handlers->read = ecalloc(1, sizeof(php_curl_read));
-
- memset(&(*ch)->err, 0, sizeof((*ch)->err));
-
- zend_llist_init(&(*ch)->to_free.str, sizeof(char *), (void(*)(void *)) curl_free_string, 0);
- zend_llist_init(&(*ch)->to_free.slist, sizeof(struct curl_slist), (void(*)(void *)) curl_free_slist, 0);
- zend_llist_init(&(*ch)->to_free.post, sizeof(struct HttpPost), (void(*)(void *)) curl_free_post, 0);
-}
-/* }}} */
-
-/* {{{ proto resource curl_init([string url])
- Initialize a CURL session */
-PHP_FUNCTION(curl_init)
-{
- zval **url;
- php_curl *ch;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 0 || argc > 1 || zend_get_parameters_ex(argc, &url) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- alloc_curl_handle(&ch);
- TSRMLS_SET_CTX(ch->thread_ctx);
-
- ch->cp = curl_easy_init();
- if (!ch->cp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not initialize a new cURL handle");
- RETURN_FALSE;
- }
-
- ch->handlers->write->method = PHP_CURL_STDOUT;
- ch->handlers->write->type = PHP_CURL_ASCII;
- ch->handlers->read->method = PHP_CURL_DIRECT;
- ch->handlers->write_header->method = PHP_CURL_IGNORE;
-
- ch->uses = 0;
-
- curl_easy_setopt(ch->cp, CURLOPT_NOPROGRESS, 1);
- curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0);
- curl_easy_setopt(ch->cp, CURLOPT_ERRORBUFFER, ch->err.str);
- curl_easy_setopt(ch->cp, CURLOPT_WRITEFUNCTION, curl_write);
- curl_easy_setopt(ch->cp, CURLOPT_FILE, (void *) ch);
- curl_easy_setopt(ch->cp, CURLOPT_READFUNCTION, curl_read);
- curl_easy_setopt(ch->cp, CURLOPT_INFILE, (void *) ch);
- curl_easy_setopt(ch->cp, CURLOPT_HEADERFUNCTION, curl_write_header);
- curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER, (void *) ch);
- curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1);
- curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120);
-
- if (argc > 0) {
- char *urlcopy;
- convert_to_string_ex(url);
-
- urlcopy = estrndup(Z_STRVAL_PP(url), Z_STRLEN_PP(url));
- curl_easy_setopt(ch->cp, CURLOPT_URL, urlcopy);
- zend_llist_add_element(&ch->to_free.str, &urlcopy);
- }
-
- ZEND_REGISTER_RESOURCE(return_value, ch, le_curl);
- ch->id = Z_LVAL_P(return_value);
-}
-/* }}} */
-
-/* {{{ proto bool curl_setopt(resource ch, string option, mixed value)
- Set an option for a CURL transfer */
-PHP_FUNCTION(curl_setopt)
-{
- zval **zid, **zoption, **zvalue;
- php_curl *ch;
- CURLcode error=CURLE_OK;
- int option;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &zid, &zoption, &zvalue) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
-
- convert_to_long_ex(zoption);
-
- option = Z_LVAL_PP(zoption);
- switch (option) {
- case CURLOPT_INFILESIZE:
- case CURLOPT_VERBOSE:
- case CURLOPT_HEADER:
- case CURLOPT_NOPROGRESS:
- case CURLOPT_NOBODY:
- case CURLOPT_FAILONERROR:
- case CURLOPT_UPLOAD:
- case CURLOPT_POST:
- case CURLOPT_FTPLISTONLY:
- case CURLOPT_FTPAPPEND:
- case CURLOPT_NETRC:
- case CURLOPT_FOLLOWLOCATION:
- case CURLOPT_PUT:
- case CURLOPT_MUTE:
- case CURLOPT_TIMEOUT:
- case CURLOPT_FTP_USE_EPSV:
- case CURLOPT_LOW_SPEED_LIMIT:
- case CURLOPT_SSLVERSION:
- case CURLOPT_LOW_SPEED_TIME:
- case CURLOPT_RESUME_FROM:
- case CURLOPT_TIMEVALUE:
- case CURLOPT_TIMECONDITION:
- case CURLOPT_TRANSFERTEXT:
- case CURLOPT_HTTPPROXYTUNNEL:
- case CURLOPT_FILETIME:
- case CURLOPT_MAXREDIRS:
- case CURLOPT_MAXCONNECTS:
- case CURLOPT_CLOSEPOLICY:
- case CURLOPT_FRESH_CONNECT:
- case CURLOPT_FORBID_REUSE:
- case CURLOPT_CONNECTTIMEOUT:
- case CURLOPT_SSL_VERIFYHOST:
- case CURLOPT_SSL_VERIFYPEER:
- case CURLOPT_DNS_USE_GLOBAL_CACHE:
- case CURLOPT_NOSIGNAL:
- case CURLOPT_PROXYTYPE:
- case CURLOPT_BUFFERSIZE:
- case CURLOPT_HTTPGET:
- case CURLOPT_HTTP_VERSION:
- case CURLOPT_CRLF:
- convert_to_long_ex(zvalue);
- error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
- break;
- case CURLOPT_URL:
- case CURLOPT_PROXY:
- case CURLOPT_USERPWD:
- case CURLOPT_PROXYUSERPWD:
- case CURLOPT_RANGE:
- case CURLOPT_CUSTOMREQUEST:
- case CURLOPT_USERAGENT:
- case CURLOPT_FTPPORT:
- case CURLOPT_COOKIE:
- case CURLOPT_COOKIEFILE:
- case CURLOPT_REFERER:
- case CURLOPT_INTERFACE:
- case CURLOPT_KRB4LEVEL:
- case CURLOPT_RANDOM_FILE:
- case CURLOPT_EGDSOCKET:
- case CURLOPT_CAINFO:
- case CURLOPT_CAPATH:
- case CURLOPT_COOKIEJAR:
- case CURLOPT_SSL_CIPHER_LIST:
- case CURLOPT_SSLKEY:
- case CURLOPT_SSLCERT:
- case CURLOPT_SSLKEYTYPE:
- case CURLOPT_SSLKEYPASSWD:
- case CURLOPT_SSLENGINE:
- case CURLOPT_SSLENGINE_DEFAULT:
- case CURLOPT_ENCODING: {
- char *copystr = NULL;
-
- convert_to_string_ex(zvalue);
- copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
-
- error = curl_easy_setopt(ch->cp, option, copystr);
- zend_llist_add_element(&ch->to_free.str, &copystr);
-
- break;
- }
- case CURLOPT_FILE:
- case CURLOPT_INFILE:
- case CURLOPT_WRITEHEADER:
- case CURLOPT_STDERR: {
- FILE *fp = NULL;
- int type;
- void * what;
-
- what = zend_fetch_resource(zvalue TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream());
- ZEND_VERIFY_RESOURCE(what);
-
- if (FAILURE == php_stream_cast((php_stream *) what, PHP_STREAM_AS_STDIO, (void *) &fp, REPORT_ERRORS)) {
- RETURN_FALSE;
- }
-
- if (!fp) {
- RETURN_FALSE;
- }
-
- error = CURLE_OK;
- switch (option) {
- case CURLOPT_FILE:
- ch->handlers->write->fp = fp;
- ch->handlers->write->method = PHP_CURL_FILE;
- break;
- case CURLOPT_WRITEHEADER:
- ch->handlers->write_header->fp = fp;
- ch->handlers->write_header->method = PHP_CURL_FILE;
- break;
- case CURLOPT_INFILE:
- zend_list_addref(Z_LVAL_PP(zvalue));
- ch->handlers->read->fp = fp;
- ch->handlers->read->fd = Z_LVAL_PP(zvalue);
- break;
- default:
- error = curl_easy_setopt(ch->cp, option, fp);
- break;
- }
-
- break;
- }
- case CURLOPT_RETURNTRANSFER:
- convert_to_long_ex(zvalue);
-
- if (Z_LVAL_PP(zvalue)) {
- ch->handlers->write->method = PHP_CURL_RETURN;
- }
- break;
- case CURLOPT_BINARYTRANSFER:
- convert_to_long_ex(zvalue);
-
- if (Z_LVAL_PP(zvalue)) {
- ch->handlers->write->type = PHP_CURL_BINARY;
- }
- break;
- case CURLOPT_WRITEFUNCTION:
- if (ch->handlers->write->func) {
- zval_ptr_dtor(&ch->handlers->write->func);
- }
- zval_add_ref(zvalue);
- ch->handlers->write->func = *zvalue;
- ch->handlers->write->method = PHP_CURL_USER;
- break;
- case CURLOPT_READFUNCTION:
- if (ch->handlers->read->func) {
- zval_ptr_dtor(&ch->handlers->read->func);
- }
- zval_add_ref(zvalue);
- ch->handlers->read->func = *zvalue;
- ch->handlers->read->method = PHP_CURL_USER;
- break;
- case CURLOPT_HEADERFUNCTION:
- if (ch->handlers->write_header->func) {
- zval_ptr_dtor(&ch->handlers->write_header->func);
- }
- zval_add_ref(zvalue);
- ch->handlers->write_header->func = *zvalue;
- ch->handlers->write_header->method = PHP_CURL_USER;
- break;
- case CURLOPT_PASSWDFUNCTION:
- if (ch->handlers->passwd) {
- zval_ptr_dtor(&ch->handlers->passwd);
- }
- zval_add_ref(zvalue);
- ch->handlers->passwd = *zvalue;
- error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDFUNCTION, curl_passwd);
- error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDDATA, (void *) ch);
- break;
- case CURLOPT_POSTFIELDS:
- if (Z_TYPE_PP(zvalue) == IS_ARRAY || Z_TYPE_PP(zvalue) == IS_OBJECT) {
- zval **current;
- HashTable *postfields;
- struct HttpPost *first = NULL;
- struct HttpPost *last = NULL;
- char *postval;
- char *string_key = NULL;
- ulong num_key;
- uint string_key_len;
-
- postfields = HASH_OF(*zvalue);
- if (! postfields) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't get HashTable in CURLOPT_POSTFIELDS");
- RETURN_FALSE;
- }
-
- for (zend_hash_internal_pointer_reset(postfields);
- zend_hash_get_current_data(postfields, (void **) &current) == SUCCESS;
- zend_hash_move_forward(postfields)
- ) {
-
- SEPARATE_ZVAL(current);
- convert_to_string_ex(current);
-
- zend_hash_get_current_key_ex(postfields, &string_key, &string_key_len, &num_key, 0, NULL);
-
- postval = Z_STRVAL_PP(current);
- if (*postval == '@') {
- error = curl_formadd(&first, &last,
- CURLFORM_COPYNAME, string_key,
- CURLFORM_NAMELENGTH, string_key_len - 1,
- CURLFORM_FILE, ++postval,
- CURLFORM_END);
- } else {
- error = curl_formadd(&first, &last,
- CURLFORM_COPYNAME, string_key,
- CURLFORM_NAMELENGTH, string_key_len - 1,
- CURLFORM_PTRCONTENTS, postval,
- CURLFORM_CONTENTSLENGTH, Z_STRLEN_PP(current),
- CURLFORM_END);
- }
- }
-
- SAVE_CURL_ERROR(ch, error);
- if (error != CURLE_OK) {
- RETURN_FALSE;
- }
-
- zend_llist_add_element(&ch->to_free.post, &first);
- error = curl_easy_setopt(ch->cp, CURLOPT_HTTPPOST, first);
-
- } else {
- char *post = NULL;
-
- convert_to_string_ex(zvalue);
- post = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
- zend_llist_add_element(&ch->to_free.str, &post);
-
- error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
- error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_PP(zvalue));
- }
- break;
- case CURLOPT_HTTPHEADER:
- case CURLOPT_QUOTE:
- case CURLOPT_POSTQUOTE: {
- zval **current;
- HashTable *ph;
- struct curl_slist *slist = NULL;
-
- ph = HASH_OF(*zvalue);
- if (!ph) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must pass either an object or an array with the CURLOPT_HTTPHEADER, CURLOPT_QUOTE and CURLOPT_POSTQUOTE arguments");
- RETURN_FALSE;
- }
-
- for (zend_hash_internal_pointer_reset(ph);
- zend_hash_get_current_data(ph, (void **) &current) == SUCCESS;
- zend_hash_move_forward(ph)
- ) {
- char *indiv = NULL;
-
- SEPARATE_ZVAL(current);
- convert_to_string_ex(current);
-
- indiv = estrndup(Z_STRVAL_PP(current), Z_STRLEN_PP(current) + 1);
- slist = curl_slist_append(slist, indiv);
- if (!slist) {
- efree(indiv);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not build curl_slist");
- RETURN_FALSE;
- }
- zend_llist_add_element(&ch->to_free.str, &indiv);
- }
- zend_llist_add_element(&ch->to_free.slist, &slist);
-
- error = curl_easy_setopt(ch->cp, option, slist);
-
- break;
- }
- }
-
- SAVE_CURL_ERROR(ch, error);
- if (error != CURLE_OK) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ _php_curl_cleanup_handle(ch)
- Cleanup an execution phase */
-void _php_curl_cleanup_handle(php_curl *ch)
-{
- if (ch->uses < 1) {
- return;
- }
-
- if (ch->handlers->write->buf.len) {
- memset(&ch->handlers->write->buf, 0, sizeof(smart_str));
- }
-
- memset(ch->err.str, 0, CURL_ERROR_SIZE + 1);
- ch->err.no = 0;
-}
-/* }}} */
-
-/* {{{ proto bool curl_exec(resource ch)
- Perform a CURL session */
-PHP_FUNCTION(curl_exec)
-{
- zval **zid;
- php_curl *ch;
- CURLcode error;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
-
- _php_curl_cleanup_handle(ch);
-
- error = curl_easy_perform(ch->cp);
- SAVE_CURL_ERROR(ch, error);
- if (error != CURLE_OK) {
- if (ch->handlers->write->buf.len > 0) {
- smart_str_free(&ch->handlers->write->buf);
- }
-
- RETURN_FALSE;
- }
-
- ch->uses++;
-
- if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.len > 0) {
- if (ch->handlers->write->type != PHP_CURL_BINARY) {
- smart_str_0(&ch->handlers->write->buf);
- }
- RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 0);
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string curl_getinfo(resource ch, int opt)
- Get information regarding a specific transfer */
-PHP_FUNCTION(curl_getinfo)
-{
- zval **zid,
- **zoption;
- php_curl *ch;
- int option, argc = ZEND_NUM_ARGS();
-
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &zid, &zoption) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
-
- if (argc < 2) {
- char *s_code;
- long l_code;
- double d_code;
-
- array_init(return_value);
-
- if (curl_easy_getinfo(ch->cp, CURLINFO_EFFECTIVE_URL, &s_code) == CURLE_OK) {
- CAAS("url", s_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_CONTENT_TYPE, &s_code) == CURLE_OK) {
- if (s_code != NULL) {
- CAAS("content_type", s_code);
- }
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_HTTP_CODE, &l_code) == CURLE_OK) {
- CAAL("http_code", l_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_HEADER_SIZE, &l_code) == CURLE_OK) {
- CAAL("header_size", l_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_REQUEST_SIZE, &l_code) == CURLE_OK) {
- CAAL("request_size", l_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_FILETIME, &l_code) == CURLE_OK) {
- CAAL("filetime", l_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_SSL_VERIFYRESULT, &l_code) == CURLE_OK) {
- CAAL("ssl_verify_result", l_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_REDIRECT_COUNT, &l_code) == CURLE_OK) {
- CAAL("redirect_count", l_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_TOTAL_TIME, &d_code) == CURLE_OK) {
- CAAD("total_time", d_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_NAMELOOKUP_TIME, &d_code) == CURLE_OK) {
- CAAD("namelookup_time", d_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_CONNECT_TIME, &d_code) == CURLE_OK) {
- CAAD("connect_time", d_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_PRETRANSFER_TIME, &d_code) == CURLE_OK) {
- CAAD("pretransfer_time", d_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_SIZE_UPLOAD, &d_code) == CURLE_OK) {
- CAAD("size_upload", d_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_SIZE_DOWNLOAD, &d_code) == CURLE_OK) {
- CAAD("size_download", d_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_SPEED_DOWNLOAD, &d_code) == CURLE_OK) {
- CAAD("speed_download", d_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_SPEED_UPLOAD, &d_code) == CURLE_OK) {
- CAAD("speed_upload", d_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d_code) == CURLE_OK) {
- CAAD("download_content_length", d_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_CONTENT_LENGTH_UPLOAD, &d_code) == CURLE_OK) {
- CAAD("upload_content_length", d_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_STARTTRANSFER_TIME, &d_code) == CURLE_OK) {
- CAAD("starttransfer_time", d_code);
- }
- if (curl_easy_getinfo(ch->cp, CURLINFO_REDIRECT_TIME, &d_code) == CURLE_OK) {
- CAAD("redirect_time", d_code);
- }
- } else {
- option = Z_LVAL_PP(zoption);
- switch (option) {
- case CURLINFO_EFFECTIVE_URL:
- case CURLINFO_CONTENT_TYPE: {
- char *s_code;
-
- curl_easy_getinfo(ch->cp, option, &s_code);
- RETURN_STRING(s_code, 1);
- break;
- }
- case CURLINFO_HTTP_CODE:
- case CURLINFO_HEADER_SIZE:
- case CURLINFO_REQUEST_SIZE:
- case CURLINFO_FILETIME:
- case CURLINFO_SSL_VERIFYRESULT:
- case CURLINFO_REDIRECT_COUNT: {
- long code;
-
- curl_easy_getinfo(ch->cp, option, &code);
- RETURN_LONG(code);
- break;
- }
- case CURLINFO_TOTAL_TIME:
- case CURLINFO_NAMELOOKUP_TIME:
- case CURLINFO_CONNECT_TIME:
- case CURLINFO_PRETRANSFER_TIME:
- case CURLINFO_SIZE_UPLOAD:
- case CURLINFO_SIZE_DOWNLOAD:
- case CURLINFO_SPEED_DOWNLOAD:
- case CURLINFO_SPEED_UPLOAD:
- case CURLINFO_CONTENT_LENGTH_DOWNLOAD:
- case CURLINFO_CONTENT_LENGTH_UPLOAD:
- case CURLINFO_STARTTRANSFER_TIME:
- case CURLINFO_REDIRECT_TIME: {
- double code;
-
- curl_easy_getinfo(ch->cp, option, &code);
- RETURN_DOUBLE(code);
- break;
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string curl_error(resource ch)
- Return a string contain the last error for the current session */
-PHP_FUNCTION(curl_error)
-{
- zval **zid;
- php_curl *ch;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
-
- ch->err.str[CURL_ERROR_SIZE] = 0;
- RETURN_STRING(ch->err.str, 1);
-}
-/* }}} */
-
-/* {{{ proto int curl_errno(resource ch)
- Return an integer containing the last error number */
-PHP_FUNCTION(curl_errno)
-{
- zval **zid;
- php_curl *ch;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
-
- RETURN_LONG(ch->err.no);
-}
-/* }}} */
-
-/* {{{ proto void curl_close(resource ch)
- Close a CURL session */
-PHP_FUNCTION(curl_close)
-{
- zval **zid;
- php_curl *ch;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
-
- zend_list_delete(Z_LVAL_PP(zid));
-}
-/* }}} */
-
-/* {{{ _php_curl_close()
- List destructor for curl handles */
-static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- php_curl *ch = (php_curl *) rsrc->ptr;
-
-#if PHP_CURL_DEBUG
- fprintf(stderr, "DTOR CALLED, ch = %x\n", ch);
-#endif
-
- curl_easy_cleanup(ch->cp);
- zend_llist_clean(&ch->to_free.str);
- zend_llist_clean(&ch->to_free.slist);
- zend_llist_clean(&ch->to_free.post);
-
- if (ch->handlers->write->func) {
- zval_ptr_dtor(&ch->handlers->write->func);
- }
- if (ch->handlers->read->func) {
- zval_ptr_dtor(&ch->handlers->read->func);
- }
- if (ch->handlers->write_header->func) {
- zval_ptr_dtor(&ch->handlers->write_header->func);
- }
- if (ch->handlers->passwd) {
- zval_ptr_dtor(&ch->handlers->passwd);
- }
- efree(ch->handlers->write);
- efree(ch->handlers->write_header);
- efree(ch->handlers->read);
- efree(ch->handlers);
- efree(ch);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
deleted file mode 100644
index b5c373ec91..0000000000
--- a/ext/curl/multi.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_CURL
-
-#include "php_curl.h"
-
-#include <curl/curl.h>
-#include <curl/multi.h>
-
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-/* {{{ proto resource curl_multi_init(void)
- Returns a new cURL multi handle */
-PHP_FUNCTION(curl_multi_init)
-{
- php_curlm *mh;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- mh = ecalloc(1, sizeof(php_curlm));
- mh->multi = curl_multi_init();
-
- ZEND_REGISTER_RESOURCE(return_value, mh, le_curl_multi_handle);
-}
-/* }}} */
-
-/* {{{ proto int curl_multi_add_handle(resource multi, resource ch)
- Add a normal cURL handle to a cURL multi handle */
-PHP_FUNCTION(curl_multi_add_handle)
-{
- zval *z_mh;
- zval *z_ch;
- php_curlm *mh;
- php_curl *ch;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &z_mh, &z_ch) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(mh, php_curlm *, &z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle);
- ZEND_FETCH_RESOURCE(ch, php_curl *, &z_ch, -1, le_curl_name, le_curl);
-
- zval_add_ref(&z_ch);
-
- _php_curl_cleanup_handle(ch);
- ch->uses++;
-
- RETURN_LONG((long) curl_multi_add_handle(mh->multi, ch->cp));
-}
-/* }}} */
-
-/* {{{ proto int curl_multi_remove_handle(resource mh, resource ch)
- Remove a multi handle from a set of cURL handles */
-PHP_FUNCTION(curl_multi_remove_handle)
-{
- zval *z_mh;
- zval *z_ch;
- php_curlm *mh;
- php_curl *ch;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &z_mh, &z_ch) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(mh, php_curlm *, &z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle);
- ZEND_FETCH_RESOURCE(ch, php_curl *, &z_ch, -1, le_curl_name, le_curl);
-
- zval_ptr_dtor(&z_ch);
-
- RETURN_LONG((long) curl_multi_remove_handle(mh->multi, ch->cp));
-}
-/* }}} */
-
-static void _make_timeval_struct(struct timeval *to, double timeout)
-{
- unsigned long conv;
-
- conv = (unsigned long) (timeout * 1000000.0);
- to->tv_sec = conv / 1000000;
- to->tv_usec = conv % 1000000;
-}
-
-/* {{{ proto int curl_multi_select(resource mh[, double timeout])
- Get all the sockets associated with the cURL extension, which can then be "selected" */
-PHP_FUNCTION(curl_multi_select)
-{
- zval *z_mh;
- php_curlm *mh;
- fd_set readfds;
- fd_set writefds;
- fd_set exceptfds;
- int maxfd;
- double timeout = 1.0;
- struct timeval to;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|d", &z_mh, &timeout) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(mh, php_curlm *, &z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle);
-
- _make_timeval_struct(&to, timeout);
-
- FD_ZERO(&readfds);
- FD_ZERO(&writefds);
- FD_ZERO(&exceptfds);
-
- curl_multi_fdset(mh->multi, &readfds, &writefds, &exceptfds, &maxfd);
- RETURN_LONG(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to));
-}
-/* }}} */
-
-/* {{{ proto int curl_multi_exec(resource mh)
- Run the sub-connections of the current cURL handle */
-PHP_FUNCTION(curl_multi_exec)
-{
- zval *z_mh;
- zval *z_still_running;
- php_curlm *mh;
- int still_running;
- int result;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &z_mh, &z_still_running) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(mh, php_curlm *, &z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle);
-
- convert_to_long_ex(&z_still_running);
- still_running = Z_LVAL_P(z_still_running);
- result = curl_multi_perform(mh->multi, &still_running);
- ZVAL_LONG(z_still_running, still_running);
-
- RETURN_LONG(result);
-}
-/* }}} */
-
-/* {{{ proto string curl_multi_getcontent(resource ch)
- Return the content of a cURL handle if CURLOPT_RETURNTRANSFER is set */
-PHP_FUNCTION(curl_multi_getcontent)
-{
- zval *z_ch;
- php_curl *ch;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ch) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ch, php_curl *, &z_ch, -1, le_curl_name, le_curl);
-
- if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.len > 0) {
- if (ch->handlers->write->type == PHP_CURL_BINARY) {
- smart_str_0(&ch->handlers->write->buf);
- }
-
- RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 0);
- }
-}
-
-/* {{{ proto array curl_multi_info_read(resource mh)
- Get information about the current transfers */
-PHP_FUNCTION(curl_multi_info_read)
-{
- zval *z_mh;
- php_curlm *mh;
- CURLMsg *tmp_msg;
- int queued_msgs;
-
- /* XXX: Not Implemented */
- return;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_mh) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(mh, php_curlm *, &z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle);
-
- tmp_msg = curl_multi_info_read(mh->multi, &queued_msgs);
- if (tmp_msg == NULL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- add_assoc_long(return_value, "msg", tmp_msg->msg);
- add_assoc_long(return_value, "result", tmp_msg->data.result);
- /* add_assoc_resource(return_value, "handle", zend_list_id_by_pointer(tmp_msg->easy_handle, le_curl TSRMLS_CC)); */
- add_assoc_string(return_value, "whatever", (char *) tmp_msg->data.whatever, 1);
-}
-/* }}} */
-
-/* {{{ proto void curl_multi_close(resource mh)
- Close a set of cURL handles */
-PHP_FUNCTION(curl_multi_close)
-{
- zval *z_mh;
- php_curlm *mh;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_mh) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(mh, php_curlm *, &z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle);
-
- zend_list_delete(Z_LVAL_P(z_mh));
-}
-/* }}} */
-
-void _php_curl_multi_close(zend_rsrc_list_entry *rsrc)
-{
- php_curlm *mh = (php_curlm *) rsrc->ptr;
- curl_multi_cleanup(mh->multi);
- /* XXX: keep track of all curl handles and zval_ptr_dtor them here */
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h
deleted file mode 100644
index 7680f93dc3..0000000000
--- a/ext/curl/php_curl.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- | Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef _PHP_CURL_H
-#define _PHP_CURL_H
-
-#include "php.h"
-#include "ext/standard/php_smart_str.h"
-
-#ifdef COMPILE_DL_CURL
-#undef HAVE_CURL
-#define HAVE_CURL 1
-#endif
-
-#if HAVE_CURL
-
-#define PHP_CURL_DEBUG 0
-
-#include <curl/curl.h>
-#include <curl/multi.h>
-
-extern zend_module_entry curl_module_entry;
-#define curl_module_ptr &curl_module_entry
-
-#define CURLOPT_RETURNTRANSFER 19913
-#define CURLOPT_BINARYTRANSFER 19914
-#define PHP_CURL_STDOUT 0
-#define PHP_CURL_FILE 1
-#define PHP_CURL_USER 2
-#define PHP_CURL_DIRECT 3
-#define PHP_CURL_RETURN 4
-#define PHP_CURL_ASCII 5
-#define PHP_CURL_BINARY 6
-#define PHP_CURL_IGNORE 7
-
-int le_curl;
-#define le_curl_name "cURL handle"
-int le_curl_multi_handle;
-#define le_curl_multi_handle_name "cURL Multi Handle"
-
-PHP_MINIT_FUNCTION(curl);
-PHP_MSHUTDOWN_FUNCTION(curl);
-PHP_MINFO_FUNCTION(curl);
-PHP_FUNCTION(curl_version);
-PHP_FUNCTION(curl_init);
-PHP_FUNCTION(curl_setopt);
-PHP_FUNCTION(curl_exec);
-PHP_FUNCTION(curl_getinfo);
-PHP_FUNCTION(curl_error);
-PHP_FUNCTION(curl_errno);
-PHP_FUNCTION(curl_close);
-PHP_FUNCTION(curl_multi_init);
-PHP_FUNCTION(curl_multi_add_handle);
-PHP_FUNCTION(curl_multi_remove_handle);
-PHP_FUNCTION(curl_multi_select);
-PHP_FUNCTION(curl_multi_exec);
-PHP_FUNCTION(curl_multi_getcontent);
-PHP_FUNCTION(curl_multi_info_read);
-PHP_FUNCTION(curl_multi_close);
-void _php_curl_multi_close(zend_rsrc_list_entry *);
-
-typedef struct {
- zval *func;
- FILE *fp;
- smart_str buf;
- int method;
- int type;
-} php_curl_write;
-
-typedef struct {
- zval *func;
- FILE *fp;
- long fd;
- int method;
-} php_curl_read;
-
-typedef struct {
- php_curl_write *write;
- php_curl_write *write_header;
- php_curl_read *read;
- zval *passwd;
-} php_curl_handlers;
-
-struct _php_curl_error {
- char str[CURL_ERROR_SIZE + 1];
- int no;
-};
-
-struct _php_curl_free {
- zend_llist str;
- zend_llist post;
- zend_llist slist;
-};
-
-typedef struct {
- struct _php_curl_error err;
- struct _php_curl_free to_free;
- void ***thread_ctx;
- CURL *cp;
- php_curl_handlers *handlers;
- long id;
- unsigned int uses;
-} php_curl;
-
-typedef struct {
- int still_running;
- CURLM *multi;
-} php_curlm;
-
-void _php_curl_cleanup_handle(php_curl *);
-
-/* streams support */
-
-PHPAPI extern php_stream_ops php_curl_stream_ops;
-#define PHP_STREAM_IS_CURL &php_curl_stream_ops
-
-PHPAPI php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename, char *mode,
- int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
-
-extern php_stream_wrapper php_curl_wrapper;
-
-struct php_curl_buffer {
- off_t readpos, writepos;
- php_stream *buf;
-};
-
-typedef struct {
- CURL *curl;
- CURLM *multi;
- char *url;
- struct php_curl_buffer readbuffer; /* holds downloaded data */
- struct php_curl_buffer writebuffer; /* holds data to upload */
-
- fd_set readfds, writefds, excfds;
- int maxfd;
-
- char errstr[CURL_ERROR_SIZE + 1];
- CURLMcode mcode;
- int pending;
- zval *headers;
-} php_curl_stream;
-
-
-#else
-#define curl_module_ptr NULL
-#endif /* HAVE_CURL */
-#define phpext_curl_ptr curl_module_ptr
-#endif /* _PHP_CURL_H */
diff --git a/ext/curl/streams.c b/ext/curl/streams.c
deleted file mode 100644
index 1913672b20..0000000000
--- a/ext/curl/streams.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* This file implements cURL based wrappers.
- * NOTE: If you are implementing your own streams that are intended to
- * work independently of wrappers, this is not a good example to follow!
- **/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_memory_streams.h"
-
-#if HAVE_CURL
-
-#include <stdio.h>
-#include <string.h>
-
-#ifdef PHP_WIN32
-#include <winsock2.h>
-#include <sys/types.h>
-#endif
-
-#include <curl/curl.h>
-#include <curl/easy.h>
-
-#define SMART_STR_PREALLOC 4096
-
-#include "ext/standard/php_smart_str.h"
-#include "ext/standard/info.h"
-#include "ext/standard/file.h"
-#include "php_curl.h"
-
-static size_t on_data_available(char *data, size_t size, size_t nmemb, void *ctx)
-{
- php_stream *stream = (php_stream *) ctx;
- php_curl_stream *curlstream = (php_curl_stream *) stream->abstract;
- size_t wrote;
- TSRMLS_FETCH();
-
- /* TODO: I'd like to deprecate this.
- * This code is here because until we start getting real data, we don't know
- * if we have had all of the headers
- * */
- if (curlstream->readbuffer.writepos == 0) {
- zval *sym;
-
- MAKE_STD_ZVAL(sym);
- *sym = *curlstream->headers;
- zval_copy_ctor(sym);
- ZEND_SET_SYMBOL(EG(active_symbol_table), "http_response_header", sym);
- }
-
- php_stream_seek(curlstream->readbuffer.buf, curlstream->readbuffer.writepos, SEEK_SET);
- wrote = php_stream_write(curlstream->readbuffer.buf, data, size * nmemb);
- curlstream->readbuffer.writepos = php_stream_tell(curlstream->readbuffer.buf);
-
- return wrote;
-}
-
-/* cURL guarantees that headers are written as complete lines, with this function
- * called once for each header */
-static size_t on_header_available(char *data, size_t size, size_t nmemb, void *ctx)
-{
- size_t length = size * nmemb;
- zval *header;
- php_stream *stream = (php_stream *) ctx;
- php_curl_stream *curlstream = (php_curl_stream *) stream->abstract;
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(header);
- Z_STRLEN_P(header) = length;
- Z_STRVAL_P(header) = estrndup(data, length);
- if (Z_STRVAL_P(header)[length-1] == '\n') {
- Z_STRVAL_P(header)[length-1] = '\0';
- Z_STRLEN_P(header)--;
-
- if (Z_STRVAL_P(header)[length-2] == '\r') {
- Z_STRVAL_P(header)[length-2] = '\0';
- Z_STRLEN_P(header)--;
- }
- }
- Z_TYPE_P(header) = IS_STRING;
- zend_hash_next_index_insert(Z_ARRVAL_P(curlstream->headers), &header, sizeof(zval *), NULL);
-
- /* based on the header, we might need to trigger a notification */
- if (!strncasecmp(data, "Location: ", 10)) {
- php_stream_notify_info(stream->context, PHP_STREAM_NOTIFY_REDIRECTED, data + 10, 0);
- } else if (!strncasecmp(data, "Content-Type: ", 14)) {
- php_stream_notify_info(stream->context, PHP_STREAM_NOTIFY_MIME_TYPE_IS, data + 14, 0);
- } else if (!strncasecmp(data, "Context-Length: ", 16)) {
- php_stream_notify_file_size(stream->context, atoi(data + 16), data, 0);
- php_stream_notify_progress_init(stream->context, 0, 0);
- }
-
- return length;
-
-}
-
-static int on_progress_avail(php_stream *stream, double dltotal, double dlnow, double ultotal, double ulnow)
-{
- TSRMLS_FETCH();
-
- /* our notification system only works in a single direction; we should detect which
- * direction is important and use the correct values in this call */
- php_stream_notify_progress(stream->context, dlnow, dltotal);
- return 0;
-}
-
-static size_t php_curl_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
-{
- php_curl_stream *curlstream = (php_curl_stream *) stream->abstract;
-
- if (curlstream->writebuffer.buf) {
- return php_stream_write(curlstream->writebuffer.buf, buf, count);
- }
-
- return 0;
-}
-
-static size_t php_curl_stream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-{
- php_curl_stream *curlstream = (php_curl_stream *) stream->abstract;
- size_t didread = 0;
-
- if (curlstream->readbuffer.readpos >= curlstream->readbuffer.writepos && curlstream->pending) {
- /* we need to read some more data */
- struct timeval tv;
-
- /* fire up the connection */
- if (curlstream->readbuffer.writepos == 0) {
- while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform(curlstream->multi, &curlstream->pending));
- }
-
- do {
- /* get the descriptors from curl */
- curl_multi_fdset(curlstream->multi, &curlstream->readfds, &curlstream->writefds, &curlstream->excfds, &curlstream->maxfd);
-
- /* if we are in blocking mode, set a timeout */
- tv.tv_usec = 0;
- tv.tv_sec = 15; /* TODO: allow this to be configured from the script */
-
- /* wait for data */
- switch (select(curlstream->maxfd + 1, &curlstream->readfds, &curlstream->writefds, &curlstream->excfds, &tv)) {
- case -1:
- /* error */
- return 0;
- case 0:
- /* no data yet: timed-out */
- return 0;
- default:
- /* fetch the data */
- do {
- curlstream->mcode = curl_multi_perform(curlstream->multi, &curlstream->pending);
- } while (curlstream->mcode == CURLM_CALL_MULTI_PERFORM);
- }
- } while (curlstream->readbuffer.readpos >= curlstream->readbuffer.writepos && curlstream->pending > 0);
-
- }
-
- /* if there is data in the buffer, try and read it */
- if (curlstream->readbuffer.writepos > 0 && curlstream->readbuffer.readpos < curlstream->readbuffer.writepos) {
- php_stream_seek(curlstream->readbuffer.buf, curlstream->readbuffer.readpos, SEEK_SET);
- didread = php_stream_read(curlstream->readbuffer.buf, buf, count);
- curlstream->readbuffer.readpos = php_stream_tell(curlstream->readbuffer.buf);
- }
-
- if (didread == 0) {
- stream->eof = 1;
- }
-
- return didread;
-}
-
-static int php_curl_stream_close(php_stream *stream, int close_handle TSRMLS_DC)
-{
- php_curl_stream *curlstream = (php_curl_stream *) stream->abstract;
-
- /* TODO: respect the close_handle flag here, so that casting to a FILE* on
- * systems without fopencookie will work properly */
-
- curl_multi_remove_handle(curlstream->multi, curlstream->curl);
- curl_easy_cleanup(curlstream->curl);
- curl_multi_cleanup(curlstream->multi);
-
- /* we are not closing curlstream->readbuf here, because we export
- * it as a zval with the wrapperdata - the engine will garbage collect it */
-
- efree(curlstream->url);
- efree(curlstream);
-
- return 0;
-}
-
-static int php_curl_stream_flush(php_stream *stream TSRMLS_DC)
-{
- php_curl_stream *curlstream = (php_curl_stream *) stream->abstract;
- return 0;
-}
-
-static int php_curl_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC)
-{
- /* TODO: fill in details based on Data: and Content-Length: headers, and/or data
- * from curl_easy_getinfo().
- * For now, return -1 to indicate that it doesn't make sense to stat this stream */
- return -1;
-}
-
-static int php_curl_stream_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
-{
- php_curl_stream *curlstream = (php_curl_stream *) stream->abstract;
- /* delegate to the readbuffer stream */
- return php_stream_cast(curlstream->readbuffer.buf, castas, ret, 0);
-}
-
-PHPAPI php_stream_ops php_curl_stream_ops = {
- php_curl_stream_write,
- php_curl_stream_read,
- php_curl_stream_close,
- php_curl_stream_flush,
- "cURL",
- NULL, /* seek */
- php_curl_stream_cast, /* cast */
- php_curl_stream_stat /* stat */
-};
-
-
-PHPAPI php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename, char *mode,
- int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
-{
- php_stream *stream;
- php_curl_stream *curlstream;
- zval *tmp;
-
- curlstream = emalloc(sizeof(php_curl_stream));
- memset(curlstream, 0, sizeof(php_curl_stream));
-
- stream = php_stream_alloc(&php_curl_stream_ops, curlstream, 0, mode);
- php_stream_context_set(stream, context);
-
- curlstream->curl = curl_easy_init();
- curlstream->multi = curl_multi_init();
- curlstream->pending = 1;
-
- /* if opening for an include statement, ensure that the local storage will
- * have a FILE* associated with it.
- * Otherwise, use the "smart" memory stream that will turn itself into a file
- * when it gets large */
-#if !HAVE_FOPENCOOKIE
- if (options & STREAM_WILL_CAST) {
- curlstream->readbuffer.buf = php_stream_fopen_tmpfile();
- } else
-#endif
- {
- curlstream->readbuffer.buf = php_stream_temp_new();
- }
-
- /* curl requires the URL to be valid throughout it's operation, so dup it */
- curlstream->url = estrdup(filename);
- curl_easy_setopt(curlstream->curl, CURLOPT_URL, curlstream->url);
-
- /* feed curl data into our read buffer */
- curl_easy_setopt(curlstream->curl, CURLOPT_WRITEFUNCTION, on_data_available);
- curl_easy_setopt(curlstream->curl, CURLOPT_FILE, stream);
-
- /* feed headers */
- curl_easy_setopt(curlstream->curl, CURLOPT_HEADERFUNCTION, on_header_available);
- curl_easy_setopt(curlstream->curl, CURLOPT_WRITEHEADER, stream);
-
- /* currently buggy (bug is in curl) */
- curl_easy_setopt(curlstream->curl, CURLOPT_FOLLOWLOCATION, 1);
-
- curl_easy_setopt(curlstream->curl, CURLOPT_ERRORBUFFER, curlstream->errstr);
- curl_easy_setopt(curlstream->curl, CURLOPT_VERBOSE, 0);
-
- /* enable progress notification */
- curl_easy_setopt(curlstream->curl, CURLOPT_PROGRESSFUNCTION, on_progress_avail);
- curl_easy_setopt(curlstream->curl, CURLOPT_PROGRESSDATA, stream);
- curl_easy_setopt(curlstream->curl, CURLOPT_NOPROGRESS, 0);
-
- curl_easy_setopt(curlstream->curl, CURLOPT_USERAGENT, "PHP/" PHP_VERSION);
-
- /* TODO: read cookies and options from context */
-
- /* prepare for "pull" mode */
- curl_multi_add_handle(curlstream->multi, curlstream->curl);
-
- /* Prepare stuff for file_get_wrapper_data: the data is an array:
- *
- * data = array(
- * "headers" => array("Content-Type: text/html", "Xxx: Yyy"),
- * "readbuf" => resource (equivalent to curlstream->readbuffer)
- * );
- * */
- MAKE_STD_ZVAL(stream->wrapperdata);
- array_init(stream->wrapperdata);
-
- MAKE_STD_ZVAL(curlstream->headers);
- array_init(curlstream->headers);
-
- add_assoc_zval(stream->wrapperdata, "headers", curlstream->headers);
-
- MAKE_STD_ZVAL(tmp);
- php_stream_to_zval(curlstream->readbuffer.buf, tmp);
- add_assoc_zval(stream->wrapperdata, "readbuf", tmp);
-
-#if !HAVE_FOPENCOOKIE
- if (options & STREAM_WILL_CAST) {
- /* we will need to download the whole resource now,
- * since we cannot get the actual FD for the download,
- * so we won't be able to drive curl via stdio. */
-
-/* TODO: this needs finishing */
-
- curl_easy_perform(curlstream->curl);
- }
- else
-#endif
- {
- /* fire up the connection; we need to detect a connection error here,
- * otherwise the curlstream we return ends up doing nothing useful. */
- CURLMcode m;
-
- while (CURLM_CALL_MULTI_PERFORM == (m = curl_multi_perform(curlstream->multi, &curlstream->pending))) {
- ; /* spin */
- }
-
- if (m != CURLM_OK) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "There was an error mcode=%d", m);
- }
-
- }
-
- return stream;
-}
-
-static php_stream_wrapper_ops php_curl_wrapper_ops = {
- php_curl_stream_opener,
- NULL, /* stream_close: curl streams know how to clean themselves up */
- NULL, /* stream_stat: curl streams know how to stat themselves */
- NULL, /* stat url */
- NULL, /* opendir */
- NULL, /* label */
- NULL /* unlink */
-};
-
-php_stream_wrapper php_curl_wrapper = {
- &php_curl_wrapper_ops,
- NULL,
- 1 /* is_url */
-};
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/cyrus/CREDITS b/ext/cyrus/CREDITS
deleted file mode 100644
index 74371fa716..0000000000
--- a/ext/cyrus/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Cyrus
-Sterling Hughes
diff --git a/ext/cyrus/config.m4 b/ext/cyrus/config.m4
deleted file mode 100644
index 340514911c..0000000000
--- a/ext/cyrus/config.m4
+++ /dev/null
@@ -1,83 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(cyrus, for cyrus imap support,
-[ --with-cyrus[=dir] Include Cyrus IMAP support])
-
-if test "$PHP_CYRUS" != "no"; then
- found_cyrus=no
- found_sasl=no
- found_openssl=no
-
- dnl
- dnl Cyrus
- dnl
- for i in $PHP_CYRUS /usr/local /usr; do
- if test -r $i/include/cyrus/imclient.h && test "$found_cyrus" = "no"; then
- PHP_ADD_INCLUDE($i/include)
- PHP_ADD_LIBRARY_WITH_PATH(cyrus, $i/lib, CYRUS_SHARED_LIBADD)
- found_cyrus=yes
- CYRUS_INCPATH=$i/include
- break 2
- fi
- done
-
- dnl Check that imclient_connect() accepts 4 args
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS=-I$CYRUS_INCPATH
- AC_TRY_COMPILE([#include <stdio.h>
-#include <cyrus/imclient.h>], [imclient_connect(0,0,0,0)], [], [
- AC_MSG_ERROR(cyrus-imap version 2.0.8 or greater required)
- ])
- CPPFLAGS=$old_CPPFLAGS
-
- if test "$found_cyrus" = "no"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please Re-install the cyrus distribution)
- fi
-
- dnl
- dnl sasl/sasl2
- dnl
- for i in $PHP_CYRUS /usr/local /usr; do
- if test -r $i/include/sasl.h && test "$found_sasl" = "no"; then
- PHP_ADD_INCLUDE($i/include)
- found_sasl=yes
- elif test -r $i/include/sasl/sasl.h && test "$found_sasl" = "no"; then
- PHP_ADD_INCLUDE($i/include/sasl)
- found_sasl=yes
- fi
-
- if test "$found_sasl" = "yes"; then
- if test -f $i/lib/libsasl2.a || test -f $i/lib/libsasl2.$SHLIB_SUFFIX_NAME; then
- PHP_ADD_LIBRARY_WITH_PATH(sasl2, $i/lib, CYRUS_SHARED_LIBADD)
- else
- PHP_ADD_LIBRARY_WITH_PATH(sasl, $i/lib, CYRUS_SHARED_LIBADD)
- fi
- break 2
- fi
- done
-
- if test "$found_sasl" = "no"; then
- AC_MSG_RESULT(sasl not found)
- AC_MSG_ERROR(Please Re-install the cyrus distribution)
- fi
-
- dnl
- dnl OpenSSL
- dnl
- if test "$PHP_OPENSSL" = "no"; then
- for i in $PHP_CYRUS /usr/local /usr; do
- if test -r $i/include/openssl/ssl.h; then
- PHP_ADD_LIBRARY_WITH_PATH(ssl, $i/lib, CYRUS_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(crypto, $i/lib, CYRUS_SHARED_LIBADD)
- break 2
- fi
- done
- fi
-
- PHP_NEW_EXTENSION(cyrus, cyrus.c, $ext_shared)
- PHP_SUBST(CYRUS_SHARED_LIBADD)
- AC_DEFINE(HAVE_CYRUS,1,[ ])
-fi
diff --git a/ext/cyrus/cyrus.c b/ext/cyrus/cyrus.c
deleted file mode 100644
index ede15cc727..0000000000
--- a/ext/cyrus/cyrus.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_cyrus.h"
-
-#if HAVE_CYRUS
-
-#include <cyrus/imclient.h>
-
-#include <pwd.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <string.h>
-
-static int le_cyrus;
-#define le_cyrus_name "Cyrus IMAP connection"
-
-function_entry cyrus_functions[] = {
- PHP_FE(cyrus_connect, NULL)
- PHP_FE(cyrus_authenticate, NULL)
- PHP_FE(cyrus_bind, NULL)
- PHP_FE(cyrus_unbind, NULL)
- PHP_FE(cyrus_query, NULL)
- PHP_FE(cyrus_close, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry cyrus_module_entry = {
- STANDARD_MODULE_HEADER,
- "cyrus",
- cyrus_functions,
- PHP_MINIT(cyrus),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(cyrus),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_CYRUS
-ZEND_GET_MODULE(cyrus)
-#endif
-
-static void cyrus_free(zend_rsrc_list_entry *rsrc)
-{
- php_cyrus *conn = (php_cyrus *) rsrc->ptr;
-
- if (conn->client)
- imclient_close(conn->client);
-
- if (conn->host)
- efree(conn->host);
-
- if (conn->port)
- efree(conn->port);
-
- efree(conn);
-}
-
-PHP_MINIT_FUNCTION(cyrus)
-{
- le_cyrus = zend_register_list_destructors_ex(cyrus_free, NULL,
- le_cyrus_name, module_number);
-
- REGISTER_LONG_CONSTANT("CYRUS_CONN_NONSYNCLITERAL",
- IMCLIENT_CONN_NONSYNCLITERAL,
- CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CYRUS_CONN_INITIALRESPONSE",
- IMCLIENT_CONN_INITIALRESPONSE,
- CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CYRUS_CALLBACK_NUMBERED", CALLBACK_NUMBERED,
- CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CYRUS_CALLBACK_NOLITERAL", CALLBACK_NOLITERAL,
- CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(cyrus)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Cyrus IMAP support", "enabled");
- php_info_print_table_end();
-}
-
-extern void fatal(char *s, int exit)
-{
- TSRMLS_FETCH();
-
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "%s", s);
-}
-
-/* {{{ proto resource cyrus_connect([ string host [, string port [, int flags]]])
- Connect to a Cyrus IMAP server */
-PHP_FUNCTION(cyrus_connect)
-{
- zval **z_host;
- zval **z_port;
- zval **z_flags;
- php_cyrus *conn;
- struct imclient *client;
- char *host;
- char *port = NULL;
- int flags = 0;
- int error;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 0 || argc > 3 ||
- zend_get_parameters_ex(argc, &z_host, &z_port, &z_flags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc > 0) {
- convert_to_string_ex(z_host);
- host = estrndup(Z_STRVAL_PP(z_host), Z_STRLEN_PP(z_host));
- }
- else {
- host = estrndup("localhost", sizeof("localhost") - 1);
- }
-
- if (argc > 1) {
- convert_to_string_ex(z_port);
- port = estrndup(Z_STRVAL_PP(z_port), Z_STRLEN_PP(z_port));
- }
-
- if (argc > 2) {
- convert_to_long_ex(z_flags);
- flags = Z_LVAL_PP(z_flags);
- }
-
- error = imclient_connect(&client, host, port, NULL);
- switch (error) {
- case 0:
- if (client) {
- conn = ecalloc(1, sizeof *conn);
- conn->client = client;
- conn->host = host;
- conn->port = port;
-
- if (flags) {
- imclient_setflags(conn->client, flags);
- conn->flags = flags;
- }
- }
-
- break;
-
- case -1:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid hostname: %s", host);
- RETURN_FALSE;
-
- case -2:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid port: %d", port);
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, conn, le_cyrus);
- conn->id = Z_LVAL_P(return_value);
-}
-/* }}} */
-
-
-static void cyrus_capable_callback(struct imclient *client, void *rock,
- struct imclient_reply *reply)
-{
- char *token = NULL;
- char *token_buf;
- char *mechanism = rock;
-
-
- /* We need to split the reply up by the whitespace */
- token = php_strtok_r(reply->text, " ", &token_buf);
- while (token != NULL) {
- if (! strncmp(token, "AUTH=", 5)) {
- memcpy(mechanism, token + 5, strlen(token) - 5);
- break;
- }
-
- token = php_strtok_r(NULL, " ", &token_buf);
- }
-}
-
-
-/* {{{ proto bool cyrus_authenticate( resource connection [, string mechlist [, string service [, string user [, int minssf [, int maxssf]]]]])
- Authenticate agaings a Cyrus IMAP server */
-PHP_FUNCTION(cyrus_authenticate)
-{
- zval **z_conn;
- zval **z_mechlist;
- zval **z_service;
- zval **z_user;
- zval **z_minssf;
- zval **z_maxssf;
- php_cyrus *conn;
- char *mechlist;
- char *service;
- char *user;
- int minssf;
- int maxssf;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 1 || argc > 6 ||
- zend_get_parameters_ex(argc, &z_conn, &z_mechlist, &z_service, &z_user, &z_minssf, &z_maxssf) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(conn, php_cyrus *, z_conn, -1, le_cyrus_name, le_cyrus);
-
- /* Determine support mechanisms */
- if (argc > 1 && Z_TYPE_PP(z_mechlist) != IS_NULL) {
- convert_to_string_ex(z_mechlist);
-
- mechlist = estrndup(Z_STRVAL_PP(z_mechlist), Z_STRLEN_PP(z_mechlist));
- }
- else {
- char tmp_mechlist[100];
- int pos = 0;
-
- /* NULL out the buffer, ensures it has a safe ending and allows us to
- * test properly for the end of the buffer
- */
- memset(tmp_mechlist, 0, sizeof tmp_mechlist);
-
- /* We'll be calling the "CAPABILITY" command, which will give us a list
- * of the types of authorization the server is capable of
- */
- imclient_addcallback(conn->client, "CAPABILITY", 0,
- cyrus_capable_callback, (void *) tmp_mechlist, 0);
- imclient_send(conn->client, NULL, NULL, "CAPABILITY");
-
- /* Grab the end of string position into pos */
- while (tmp_mechlist[pos++] != 0)
- ;
-
- /* Tack on PLAIN to whatever the auth string is */
- memcpy(tmp_mechlist + pos, " PLAIN", 6);
-
- /* Copy it onto the main buffer */
- mechlist = estrndup(tmp_mechlist, pos + 6);
- }
-
- /* Determine the service type */
- if (argc > 2 && Z_TYPE_PP(z_service) != IS_NULL) {
- convert_to_string_ex(z_service);
- service = estrndup(Z_STRVAL_PP(z_service), Z_STRLEN_PP(z_service));
- }
- else {
- service = estrndup("imap", 4);
- }
-
- /* Determine the user */
- if (argc > 3 && Z_TYPE_PP(z_user) != IS_NULL) {
- convert_to_string_ex(z_user);
- user = estrndup(Z_STRVAL_PP(z_user), Z_STRLEN_PP(z_user));
- }
- else {
- /* XXX: UGLY, but works, determines the username to use */
- user = (char *) sapi_getenv("USER", 4);
- if (! user) {
- user = (char *) getenv("USER");
- if (! user) {
- user = (char *) sapi_getenv("LOGNAME", 7);
- if (! user) {
- user = (char *) getenv("LOGNAME");
- if (! user) {
- struct passwd *pwd = getpwuid(getuid());
- if (! pwd) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't determine user id");
- RETURN_FALSE;
- }
-
- user = estrdup(pwd->pw_name);
- }
- }
- }
- }
- }
-
- /* Determine the minssf */
- if (argc > 4 && Z_TYPE_PP(z_minssf) != NULL) {
- convert_to_long_ex(z_minssf);
- minssf = Z_LVAL_PP(z_minssf);
- }
- else {
- minssf = 0;
- }
-
- /* Determine the maxssf */
- if (argc > 5 && Z_TYPE_PP(z_maxssf) != NULL) {
- convert_to_long_ex(z_maxssf);
- maxssf = Z_LVAL_PP(z_maxssf);
- }
- else {
- maxssf = 1000;
- }
-
- imclient_authenticate(conn->client, mechlist, service,
- user, minssf, maxssf);
-
- efree(mechlist);
- efree(service);
- efree(user);
-}
-/* }}} */
-
-
-static void cyrus_generic_callback(struct imclient *client,
- void *rock,
- struct imclient_reply *reply)
-{
- php_cyrus_callback *callback = rock;
-
- if (client) {
- zval **argv[4];
- zval *retval;
- zval *cyrus;
- zval *keyword;
- zval *text;
- zval *msgno;
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(cyrus);
- MAKE_STD_ZVAL(keyword);
- MAKE_STD_ZVAL(text);
- MAKE_STD_ZVAL(msgno);
-
- ZVAL_RESOURCE(cyrus, callback->le);
- zend_list_addref(callback->le);
-
- ZVAL_STRING(keyword, reply->keyword, 1);
- ZVAL_STRING(text, reply->text, 1);
- ZVAL_LONG(msgno, reply->msgno);
-
- argv[0] = &cyrus;
- argv[1] = &keyword;
- argv[2] = &text;
- argv[3] = &msgno;
-
- if (call_user_function_ex(EG(function_table), NULL, callback->function,
- &retval, 4, argv, 0, NULL TSRMLS_CC) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't call the %s handler", callback->trigger);
- }
-
- zval_ptr_dtor(argv[0]);
- zval_ptr_dtor(argv[1]);
- zval_ptr_dtor(argv[2]);
- zval_ptr_dtor(argv[3]);
-
- efree(argv);
- }
- else {
- return;
- }
-}
-
-
-/* {{{ proto bool cyrus_bind( resource connection, array callbacks)
- Bind callbacks to a Cyrus IMAP connection */
-PHP_FUNCTION(cyrus_bind)
-{
- zval **z_conn;
- zval **z_callback;
- zval **tmp;
- HashTable *hash;
- php_cyrus *conn;
- php_cyrus_callback callback;
- char *string_key;
- ulong num_key;
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &z_conn, &z_callback) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(conn, php_cyrus *, z_conn, -1, le_cyrus_name, le_cyrus);
-
- hash = HASH_OF(*z_callback);
- if (! hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument must be an array or object");
- RETURN_FALSE;
- }
-
- for (zend_hash_internal_pointer_reset(hash);
- zend_hash_get_current_data(hash, (void **) &tmp) == SUCCESS;
- zend_hash_move_forward(hash)) {
- SEPARATE_ZVAL(tmp);
- zend_hash_get_current_key(hash, &string_key, &num_key, 0);
- if (! string_key)
- continue;
-
- if (! strcasecmp(string_key, "trigger")) {
- convert_to_string_ex(tmp);
- callback.trigger = estrndup(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
- }
- else if (! strcasecmp(string_key, "function")) {
- callback.function = *tmp;
- zval_add_ref(&callback.function);
- }
- else if (! strcasecmp(string_key, "flags")) {
- convert_to_long_ex(tmp);
- callback.flags |= Z_LVAL_PP(tmp);
- }
- }
-
- if (! callback.trigger) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must specify a trigger in your callback");
- RETURN_FALSE;
- }
-
- if (! callback.function) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must specify a function in your callback");
- RETURN_FALSE;
- }
-
- callback.le = conn->id;
-
- imclient_addcallback(conn->client, callback.trigger, callback.flags,
- cyrus_generic_callback, (void **) &callback, 0);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool cyrus_unbind( resource connection, string trigger_name)
- Unbind ... */
-PHP_FUNCTION(cyrus_unbind)
-{
- zval **z_conn;
- zval **trigger_name;
- php_cyrus *conn;
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &z_conn, &trigger_name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(conn, php_cyrus *, z_conn, -1, le_cyrus_name, le_cyrus);
- convert_to_string_ex(trigger_name);
-
- imclient_addcallback(conn->client, Z_STRVAL_PP(trigger_name), 0,
- NULL, NULL, 0);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool cyrus_query( resource connection, string query)
- Send a query to a Cyrus IMAP server */
-PHP_FUNCTION(cyrus_query)
-{
- zval **z_conn;
- zval **query;
- php_cyrus *conn;
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &z_conn, &query) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(conn, php_cyrus *, z_conn, -1, le_cyrus_name, le_cyrus);
- convert_to_string_ex(query);
-
- imclient_send(conn->client, NULL, NULL, Z_STRVAL_PP(query));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool cyrus_close( resource connection)
- Close connection to a cyrus server */
-PHP_FUNCTION(cyrus_close)
-{
- zval **z_conn;
- php_cyrus *conn;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &z_conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(conn, php_cyrus *, z_conn, -1, le_cyrus_name, le_cyrus);
-
- zend_list_delete(Z_LVAL_PP(z_conn));
-
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/cyrus/php_cyrus.h b/ext/cyrus/php_cyrus.h
deleted file mode 100644
index af040ab3dc..0000000000
--- a/ext/cyrus/php_cyrus.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_CYRUS_H
-#define PHP_CYRUS_H
-
-#include "php.h"
-
-#if HAVE_CYRUS
-
-#include <cyrus/imclient.h>
-
-extern zend_module_entry cyrus_module_entry;
-#define phpext_cyrus_ptr &cyrus_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_CYRUS_API __declspec(dllexport)
-#else
-#define PHP_CYRUS_API
-#endif
-
-PHP_MINIT_FUNCTION(cyrus);
-PHP_MINFO_FUNCTION(cyrus);
-
-PHP_FUNCTION(cyrus_connect);
-PHP_FUNCTION(cyrus_authenticate);
-PHP_FUNCTION(cyrus_bind);
-PHP_FUNCTION(cyrus_unbind);
-PHP_FUNCTION(cyrus_query);
-PHP_FUNCTION(cyrus_close);
-
-typedef struct {
- struct imclient *client;
- char *host;
- char *port;
- int flags;
- int id;
-}
-php_cyrus;
-
-typedef struct {
- zval *function;
- char *trigger;
- long le;
- int flags;
-}
-php_cyrus_callback;
-
-#endif
-
-
-#endif
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/db/CREDITS b/ext/db/CREDITS
deleted file mode 100644
index 9efbe3fe52..0000000000
--- a/ext/db/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-DBM
-Rasmus Lerdorf, Jim Winstead
diff --git a/ext/db/config.m4 b/ext/db/config.m4
deleted file mode 100644
index e425de42a3..0000000000
--- a/ext/db/config.m4
+++ /dev/null
@@ -1,58 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-# Checks for libraries.
-# Prefer gdbm, Berkeley DB and ndbm/dbm, in that order
-AC_DEFUN(AC_PREFERRED_DB_LIB,[
- AC_CHECK_LIB(gdbm, gdbm_open,[AC_DEFINE(GDBM,1, [Whether you have GDBM]) DBM_TYPE=gdbm; DBM_LIB=-lgdbm],
- [AC_CHECK_LIB(c, dbm_open,[AC_DEFINE(NDBM,1,[ ]) DBM_TYPE=ndbm; DBM_LIB=],
- [AC_CHECK_LIB(dbm, dbm_open,[AC_DEFINE(NDBM,1,[ ]) DBM_TYPE=ndbm; DBM_LIB=-ldbm],
- [AC_CHECK_LIB(db, dbm_open,[AC_DEFINE(NDBM,1, [Whether you have NDBM]) DBM_TYPE=ndbm; DBM_LIB=-ldb],
- [DBM_TYPE=""])
- ])
- ])
- ])
- AC_MSG_CHECKING([preferred dbm library])
- if test "a$DBM_TYPE" = a; then
- AC_MSG_RESULT(none found)
- AC_MSG_WARN(No dbm library found - using built-in flatfile support)
- else
- AC_MSG_RESULT($DBM_TYPE chosen)
- fi
- PHP_SUBST(DBM_LIB)
- PHP_SUBST(DBM_TYPE)
-])
-
-
-PHP_ARG_WITH(db, for xDBM support,
-[ --with-db Include old xDBM support (deprecated use --with-dba)])
-
-if test "$PHP_DB" != "no"; then
-
- AC_PREFERRED_DB_LIB
-
- if test "$DBM_LIB" = "-lgdbm"; then
- AC_CHECK_HEADER(gdbm.h, [ GDBM_INCLUDE="" ], [
- AC_MSG_RESULT("Try /usr/local/include/gdbm.h");
- AC_CHECK_HEADER(/usr/local/include/gdbm.h, [ GDBM_INCLUDE=-I/usr/local/include ],[
- AC_MSG_RESULT("Try /opt/local/include/gdbm.h");
- AC_CHECK_HEADER(/opt/local/include/gdbm.h, [ GDBM_INCLUDE=-I/opt/local/include ],[
- dnl if in /usr/pkg/include, do not add anything. See above.
- AC_MSG_RESULT("Try /usr/pkg/include/gdbm.h");
- AC_CHECK_HEADER(/usr/pkg/include/gdbm.h, [ GDBM_INCLUDE="" ],[
- AC_MSG_RESULT("Giving up - You need to install gdbm.h somewhere");
- exit
- ])
- ])
- ])
- ])
- fi
-
- if test -n "$DBM_LIB"; then
- INCLUDES="$INCLUDES $GDBM_INCLUDE"
- EXTRA_LIBS="$EXTRA_LIBS $DBM_LIB"
- fi
-
- PHP_NEW_EXTENSION(db, db.c)
-fi
diff --git a/ext/db/db.c b/ext/db/db.c
deleted file mode 100644
index 97a4a8cc96..0000000000
--- a/ext/db/db.c
+++ /dev/null
@@ -1,1204 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-#define IS_EXT_MODULE
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "safe_mode.h"
-#include "fopen_wrappers.h"
-#include "ext/standard/flock_compat.h"
-#include "ext/standard/info.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-
-#if HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-
-#if GDBM
-#include <gdbm.h>
-
-#define DBM_TYPE GDBM_FILE
-#define DBM_MODE_TYPE int
-#define DBM_WRITE_MODE GDBM_WRITER
-#define DBM_CREATE_MODE GDBM_WRCREAT
-#define DBM_NEW_MODE GDBM_NEWDB
-#define DBM_DEFAULT_MODE GDBM_READER
-#define DBM_OPEN(filename, mode) gdbm_open(filename, 512, mode, 0666, 0)
-#define DBM_CLOSE(dbf) gdbm_close(dbf)
-#define DBM_STORE(dbf, key, value, mode) gdbm_store(dbf, key, value, mode)
-#define DBM_FETCH(dbf, key) gdbm_fetch(dbf, key)
-#define DBM_EXISTS(dbf, key) gdbm_exists(dbf, key)
-#define DBM_DELETE(dbf, key) gdbm_delete(dbf, key)
-#define DBM_FIRSTKEY(dbf) gdbm_firstkey(dbf)
-#define DBM_NEXTKEY(dbf, key) gdbm_nextkey(dbf, key)
-
-#define DBM_INSERT GDBM_INSERT
-#define DBM_REPLACE GDBM_REPLACE
-#endif
-
-#if NDBM && !GDBM
-#if BSD2
-#define DB_DBM_HSEARCH 1
-#include <db.h>
-#else
-#ifdef HAVE_DB1_NDBM_H
-#include <db1/ndbm.h>
-#else
-#include <ndbm.h>
-#endif
-#endif
-
-#define DBM_TYPE DBM *
-#define DBM_MODE_TYPE int
-#define DBM_WRITE_MODE O_RDWR
-#define DBM_CREATE_MODE O_RDWR | O_CREAT
-#define DBM_NEW_MODE O_RDWR | O_CREAT | O_TRUNC
-#define DBM_DEFAULT_MODE O_RDONLY
-#define DBM_OPEN(filename, mode) dbm_open(filename, mode, 0666)
-#define DBM_CLOSE(dbf) dbm_close(dbf)
-#define DBM_STORE(dbf, key, value, mode) dbm_store(dbf, key, value, mode)
-#define DBM_FETCH(dbf, key) dbm_fetch(dbf, key)
-#define DBM_EXISTS(dbf, key) php_dbm_key_exists(dbf, key)
-#define DBM_DELETE(dbf, key) dbm_delete(dbf, key)
-#define DBM_FIRSTKEY(dbf) dbm_firstkey(dbf)
-#define DBM_NEXTKEY(dbf, key) dbm_nextkey(dbf)
-
-/* {{{ php_dbm_key_exists
- */
-static int php_dbm_key_exists(DBM *dbf, datum key_datum) {
- datum value_datum;
- int ret;
-
- value_datum = dbm_fetch(dbf, key_datum);
- if (value_datum.dptr)
- ret = 1;
- else
- ret = 0;
- return ret;
-}
-/* }}} */
-#endif
-
-#if !NDBM && !GDBM
-#define DBM_TYPE FILE *
-
-#define DBM_MODE_TYPE char *
-#define DBM_WRITE_MODE "r+b"
-#define DBM_CREATE_MODE "a+b"
-#define DBM_NEW_MODE "w+b"
-#define DBM_DEFAULT_MODE "r"
-#define DBM_OPEN(filename, mode) VCWD_FOPEN(filename, mode)
-#define DBM_CLOSE(dbf) fclose(dbf)
-#define DBM_STORE(dbf, key, value, mode) flatfile_store(dbf, key, value, mode)
-#define DBM_FETCH(dbf, key) flatfile_fetch(dbf, key)
-#define DBM_EXISTS(dbf, key) flatfile_findkey(dbf, key)
-#define DBM_DELETE(dbf, key) flatfile_delete(dbf, key)
-#define DBM_FIRSTKEY(dbf) flatfile_firstkey(dbf)
-#define DBM_NEXTKEY(dbf, key) flatfile_nextkey(dbf)
-
-#define DBM_INSERT 0
-#define DBM_REPLACE 1
-
-typedef struct {
- char *dptr;
- int dsize;
-} datum;
-
-int flatfile_store(FILE *dbf, datum key, datum value, int mode);
-datum flatfile_fetch(FILE *dbf, datum key);
-int flatfile_findkey(FILE *dbf, datum key);
-int flatfile_delete(FILE *dbf, datum key);
-datum flatfile_firstkey(FILE *dbf);
-datum flatfile_nextkey(FILE *dbf);
-
-#endif
-
-#include "php_db.h"
-#include "ext/standard/php_string.h"
-
-static int le_db;
-
-/* {{{ php_find_dbm
- */
-dbm_info *php_find_dbm(pval *id TSRMLS_DC)
-{
- list_entry *le;
- dbm_info *info;
- int numitems, i;
- int info_type;
-
- if (Z_TYPE_P(id) == IS_STRING) {
- numitems = zend_hash_next_free_element(&EG(regular_list));
- for (i=1; i<numitems; i++) {
- if (zend_hash_index_find(&EG(regular_list), i, (void **) &le)==FAILURE) {
- continue;
- }
- if (Z_TYPE_P(le) == le_db) {
- info = (dbm_info *)(le->ptr);
- if (!strcmp(info->filename, Z_STRVAL_P(id))) {
- return (dbm_info *)(le->ptr);
- }
- }
- }
- }
-
- /* didn't find it as a database filename, try as a number */
- convert_to_long(id);
- info = zend_list_find(Z_LVAL_P(id), &info_type);
- if (info_type != le_db)
- return NULL;
- return info;
-}
-/* }}} */
-
-/* {{{ proto array db_id_list(void)
- Return an associative array id->filename */
-#if HELLY_0
-/* New function not needed yet */
-PHP_FUNCTION(db_id_list)
-{
- ulong numitems, i;
- zend_rsrc_list_entry *le;
- dbm_info *info;
-
- if (ZEND_NUM_ARGS()!=0) {
- ZEND_WRONG_PARAM_COUNT();
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- numitems = zend_hash_next_free_element(&EG(regular_list));
- for (i=1; i<numitems; i++) {
- if (zend_hash_index_find(&EG(regular_list), i, (void **) &le)==FAILURE) {
- continue;
- }
- if (Z_TYPE_P(le) == le_db) {
- info = (dbm_info *)(le->ptr);
- add_next_index_string(return_value, info->filename, 1);
- }
- }
-}
-/* }}} */
-#endif
-
-/* {{{ php_get_info_db
- */
-static char *php_get_info_db(void)
-{
- static char temp1[128];
- static char temp[256];
-
- temp1[0]='\0';
- temp[0]='\0';
-
-#ifdef DB_VERSION_STRING /* using sleepycat dbm */
- strcat(temp, DB_VERSION_STRING);
-#endif
-
-#if GDBM
- sprintf(temp1, "%s", gdbm_version);
- strcat(temp, temp1);
-#endif
-
-#if NDBM && !GDBM
- strcat(temp, "ndbm support enabled");
-#endif
-
-#if !GDBM && !NDBM
- strcat(temp, "flat file support enabled");
-#endif
-
-#if NFS_HACK
- strcat(temp, "NFS hack in effect");
-#endif
-
- if (!*temp)
- strcat(temp, "No database support");
-
- return temp;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(db)
-{
- /* this isn't pretty ... should break out the info a bit more (cmv) */
- php_info_print_box_start(0);
- php_printf("%s", php_get_info_db());
- php_info_print_box_end();
-}
-/* }}} */
-
-/* {{{ proto string dblist(void)
- Describes the dbm-compatible library being used */
-PHP_FUNCTION(dblist)
-{
- char *str;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- str = php_get_info_db();
- RETURN_STRING(str, 1);
-}
-/* }}} */
-
-/* {{{ proto int dbmopen(string filename, string mode)
- Opens a dbm database */
-PHP_FUNCTION(dbmopen)
-{
- pval *filename, *mode;
- dbm_info *info=NULL;
- int ret;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters(ht, 2, &filename, &mode)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(filename);
- convert_to_string(mode);
-
- info = php_dbm_open(Z_STRVAL_P(filename), Z_STRVAL_P(mode) TSRMLS_CC);
- if (info) {
- ret = zend_list_insert(info, le_db);
- RETURN_LONG(ret);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_dbm_open
- */
-dbm_info *php_dbm_open(char *filename, char *mode TSRMLS_DC)
-{
- dbm_info *info;
- int ret, lock=0;
- char *lockfn = NULL;
- int lockfd = 0;
-#if NFS_HACK
- int last_try = 0;
- struct stat sb;
- int retries = 0;
-#endif
- DBM_TYPE dbf=NULL;
- DBM_MODE_TYPE imode;
-
- if (filename == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "NULL filename passed");
- return NULL;
- }
-
- if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- return NULL;
- }
-
- if (php_check_open_basedir(filename TSRMLS_CC)) {
- return NULL;
- }
-
- switch (*mode) {
- case 'w':
- imode = DBM_WRITE_MODE;
- lock = 1;
- break;
- case 'c':
- imode = DBM_CREATE_MODE;
- lock = 1;
- break;
- case 'n':
- imode = DBM_NEW_MODE;
- lock = 1;
- break;
- default:
- imode = DBM_DEFAULT_MODE;
- lock = 0;
- break;
- }
-
- if (lock) {
- lockfn = emalloc(strlen(filename) + 5);
- strcpy(lockfn, filename);
- strcat(lockfn, ".lck");
-
-#if NFS_HACK
- while((last_try = VCWD_STAT(lockfn, &sb))==0) {
- retries++;
- php_sleep(1);
- if (retries>30) break;
- }
- if (last_try!=0) {
- lockfd = open(lockfn, O_RDWR|O_CREAT, 0644);
- close(lockfd);
- } else {
- php_error_docref1(NULL TSRMLS_CC, filename, E_WARNING, "File appears to be locked [%s]", lockfn);
- return -1;
- }
-#else /* NFS_HACK */
-
- lockfd = VCWD_OPEN_MODE(lockfn, O_RDWR|O_CREAT, 0644);
-
- if (lockfd) {
- flock(lockfd, LOCK_EX);
- close(lockfd);
- } else {
- php_error_docref1(NULL TSRMLS_CC, filename, E_WARNING, "Unable to establish lock");
- }
-#endif /* else NFS_HACK */
-
- }
-
- dbf = DBM_OPEN(filename, imode);
-
-#if !NDBM && !GDBM
- if (dbf) {
- setvbuf(dbf, NULL, _IONBF, 0);
- }
-#endif
-
- if (dbf) {
- info = (dbm_info *)emalloc(sizeof(dbm_info));
-
- info->filename = estrdup(filename);
- info->lockfn = lockfn;
- info->lockfd = lockfd;
- info->dbf = dbf;
-
- return info;
- } else {
-#if GDBM
- php_error_docref1(NULL TSRMLS_CC, filename, E_WARNING, "%d [%s], %d [%s]", gdbm_errno, gdbm_strerror(gdbm_errno), errno, strerror(errno));
- if (gdbm_errno)
- ret = gdbm_errno;
- else if (errno)
- ret = errno;
- else
- ret = -1;
-#else
-#if NDBM
-#if PHP_DEBUG
- php_error_docref1(NULL TSRMLS_CC, filename, E_WARNING, "errno = %d [%s]\n", errno, strerror(errno));
-#endif
- if (errno) ret=errno;
- else ret = -1;
-#else
-#if PHP_DEBUG
- php_error_docref1(NULL TSRMLS_CC, filename, E_WARNING, "errno = %d [%s]\n", errno, strerror(errno));
-#endif
- if (errno) ret=errno;
- else ret = -1;
-#endif
-#endif
-
-#if NFS_HACK
- if (lockfn) {
- VCWD_UNLINK(lockfn);
- }
-#endif
- if (lockfn) efree(lockfn);
- }
-
- return NULL;
-}
-/* }}} */
-
-/* {{{ proto bool dbmclose(int dbm_identifier)
- Closes a dbm database */
-PHP_FUNCTION(dbmclose)
-{
- pval *id;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht, 1, &id)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(id);
-
- if (zend_list_delete(Z_LVAL_P(id)) == SUCCESS) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_dbm_close
- */
-void php_dbm_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- dbm_info *info = (dbm_info *)rsrc->ptr;
- DBM_TYPE dbf;
- int lockfd;
-
- dbf = info->dbf;
-
-#if NFS_HACK
- VCWD_UNLINK(info->lockfn);
-#else
- if (info->lockfn) {
- lockfd = VCWD_OPEN_MODE(info->lockfn, O_RDWR, 0644);
- flock(lockfd, LOCK_UN);
- close(lockfd);
- }
-#endif
-
- if (dbf)
- DBM_CLOSE(dbf);
-
- /* free the memory used by the dbm_info struct */
- if (info->filename) efree(info->filename);
- if (info->lockfn) efree(info->lockfn);
- efree(info);
-}
-/* }}} */
-
-/*
- * ret = -1 means that database was opened for read-only
- * ret = 0 success
- * ret = 1 key already exists - nothing done
- */
-/* {{{ proto int dbminsert(int dbm_identifier, string key, string value)
- Inserts a value for a key in a dbm database */
-PHP_FUNCTION(dbminsert)
-{
- pval *id, *key, *value;
- dbm_info *info;
- int ret;
-
- if (ZEND_NUM_ARGS()!=3||zend_get_parameters(ht, 3, &id, &key, &value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(key);
- convert_to_string(value);
-
- info = php_find_dbm(id TSRMLS_CC);
- if (!info) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
- RETURN_FALSE;
- }
-
- ret = php_dbm_insert_replace(info, Z_STRVAL_P(key), Z_STRVAL_P(value), 0 TSRMLS_CC);
- RETURN_LONG(ret);
-}
-/* }}} */
-
-
-/* {{{ proto int dbmreplace(int dbm_identifier, string key, string value)
- Replaces the value for a key in a dbm database */
-PHP_FUNCTION(dbmreplace)
-{
- pval *id, *key, *value;
- dbm_info *info;
- int ret;
-
- if (ZEND_NUM_ARGS()!=3||zend_get_parameters(ht, 3, &id, &key, &value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(key);
- convert_to_string(value);
-
- info = php_find_dbm(id TSRMLS_CC);
- if (!info) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
- RETURN_FALSE;
- }
-
- ret = php_dbm_insert_replace(info, Z_STRVAL_P(key), Z_STRVAL_P(value), 1 TSRMLS_CC);
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ php_dbm_replace
- */
-int php_dbm_insert_replace(dbm_info *info, char *key, char *value, int replace_mode TSRMLS_DC)
-{
- DBM_TYPE dbf;
- int ret;
- datum key_datum, value_datum;
-
- key = estrdup(key);
- value = estrdup(value);
-
- if (PG(magic_quotes_runtime)) {
- php_stripslashes(key, NULL TSRMLS_CC);
- php_stripslashes(value, NULL TSRMLS_CC);
- }
-
- value_datum.dptr = value;
- value_datum.dsize = strlen(value);
-
- key_datum.dptr = key;
- key_datum.dsize = strlen(key);
-#if GDBM_FIX
- key_datum.dsize++;
-#endif
-
- dbf = info->dbf;
- if (!dbf) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate dbm file");
- ret = 1;
- } else {
- if (!replace_mode) {
- ret = DBM_STORE(dbf, key_datum, value_datum, DBM_INSERT);
- } else {
- ret = DBM_STORE(dbf, key_datum, value_datum, DBM_REPLACE);
- }
- }
-
- /* free the memory */
- efree(key_datum.dptr); efree(value_datum.dptr);
-
- return(ret);
-}
-/* }}} */
-
-/* {{{ proto string dbmfetch(int dbm_identifier, string key)
- Fetches a value for a key from a dbm database */
-PHP_FUNCTION(dbmfetch)
-{
- pval *id, *key;
- dbm_info *info;
- char *ret;
-
- if (ZEND_NUM_ARGS()!=2||zend_get_parameters(ht, 2, &id, &key)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(key);
-
- info = php_find_dbm(id TSRMLS_CC);
- if (!info) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
- RETURN_FALSE;
- }
-
- ret = php_dbm_fetch(info, Z_STRVAL_P(key) TSRMLS_CC);
- if (ret) {
- RETVAL_STRING(ret, 0);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_dbm_fetch
- */
-char *php_dbm_fetch(dbm_info *info, char *key TSRMLS_DC)
-{
- datum key_datum, value_datum;
- char *ret;
- DBM_TYPE dbf;
-
- key_datum.dptr = key;
- key_datum.dsize = strlen(key);
-#if GDBM_FIX
- key_datum.dsize++;
-#endif
- value_datum.dptr = NULL;
- value_datum.dsize = 0;
-
- dbf = info->dbf;
- if (!dbf) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate dbm file");
- return(NULL);
- }
-
- value_datum = DBM_FETCH(dbf, key_datum);
-
- if (value_datum.dptr) {
- ret = (char *)emalloc(sizeof(char) * value_datum.dsize + 1);
- strncpy(ret, value_datum.dptr, value_datum.dsize);
- ret[value_datum.dsize] = '\0';
-
-#if GDBM
-/* all but NDBM use malloc to allocate the content blocks, so we need to free it */
- free(value_datum.dptr);
-#else
-# if !NDBM
- efree(value_datum.dptr);
-# endif
-#endif
- }
- else
- ret = NULL;
-
- if (ret && PG(magic_quotes_runtime)) {
- ret = php_addslashes(ret, value_datum.dsize, NULL, 1 TSRMLS_CC);
- }
- return(ret);
-}
-/* }}} */
-
-/* {{{ proto int dbmexists(int dbm_identifier, string key)
- Tells if a value exists for a key in a dbm database */
-PHP_FUNCTION(dbmexists)
-{
- pval *id, *key;
- dbm_info *info;
- int ret;
-
- if (ZEND_NUM_ARGS()!=2||zend_get_parameters(ht, 2, &id, &key)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(key);
-
- info = php_find_dbm(id TSRMLS_CC);
- if (!info) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
- RETURN_FALSE;
- }
-
- ret = php_dbm_exists(info, Z_STRVAL_P(key) TSRMLS_CC);
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ php_dbm_exists
- */
-int php_dbm_exists(dbm_info *info, char *key TSRMLS_DC) {
- datum key_datum;
- int ret;
- DBM_TYPE dbf;
-
- key_datum.dptr = key;
- key_datum.dsize = strlen(key);
-#if GDBM_FIX
- key_datum.dsize++;
-#endif
-
- dbf = info->dbf;
- if (!dbf) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate dbm file");
- return(0);
- }
-
- ret = DBM_EXISTS(dbf, key_datum);
-
- return(ret);
-}
-/* }}} */
-
-/* {{{ proto int dbmdelete(int dbm_identifier, string key)
- Deletes the value for a key from a dbm database */
-PHP_FUNCTION(dbmdelete)
-{
- pval *id, *key;
- dbm_info *info;
- int ret;
-
- if (ZEND_NUM_ARGS()!=2||zend_get_parameters(ht, 2, &id, &key)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(key);
-
- info = php_find_dbm(id TSRMLS_CC);
- if (!info) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
- RETURN_FALSE;
- }
-
- ret = php_dbm_delete(info, Z_STRVAL_P(key) TSRMLS_CC);
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ php_dbm_delete
- */
-int php_dbm_delete(dbm_info *info, char *key TSRMLS_DC) {
- datum key_datum;
- int ret;
- DBM_TYPE dbf;
-
- key_datum.dptr = key;
- key_datum.dsize = strlen(key);
-#if GDBM_FIX
- key_datum.dsize++;
-#endif
-
- dbf = info->dbf;
- if (!dbf) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate dbm file");
- return(0);
- }
-
- ret = DBM_DELETE(dbf, key_datum);
- return(ret);
-}
-/* }}} */
-
-/* {{{ proto string dbmfirstkey(int dbm_identifier)
- Retrieves the first key from a dbm database */
-PHP_FUNCTION(dbmfirstkey)
-{
- pval *id;
- dbm_info *info;
- char *ret;
-
- if (ZEND_NUM_ARGS()!=1||zend_get_parameters(ht, 1, &id)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- info = php_find_dbm(id TSRMLS_CC);
- if (!info) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
- RETURN_FALSE;
- }
-
- ret = php_dbm_first_key(info TSRMLS_CC);
- if (!ret) {
- RETURN_FALSE;
- } else {
- RETVAL_STRING(ret, 0);
- }
-}
-/* }}} */
-
-/* {{{ php_dbm_first_key
- */
-char *php_dbm_first_key(dbm_info *info TSRMLS_DC) {
- datum ret_datum;
- char *ret;
- DBM_TYPE dbf;
-
- dbf = info->dbf;
- if (!dbf) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate dbm file");
- return(NULL);
- }
-
- /* explicitly zero-out ret_datum */
- ret_datum.dptr = NULL;
- ret_datum.dsize = 0;
-
- ret_datum = DBM_FIRSTKEY(dbf);
-
- if (!ret_datum.dptr)
- return NULL;
-
- ret = (char *)emalloc((ret_datum.dsize + 1) * sizeof(char));
- strncpy(ret, ret_datum.dptr, ret_datum.dsize);
- ret[ret_datum.dsize] = '\0';
-
-#if !NDBM & !GDBM
- efree(ret_datum.dptr);
-#endif
-
- return (ret);
-}
-/* }}} */
-
-/* {{{ proto string dbmnextkey(int dbm_identifier, string key)
- Retrieves the next key from a dbm database */
-PHP_FUNCTION(dbmnextkey)
-{
- pval *id, *key;
- dbm_info *info;
- char *ret;
-
- if (ZEND_NUM_ARGS()!=2||zend_get_parameters(ht, 2, &id, &key)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(key);
-
- info = php_find_dbm(id TSRMLS_CC);
- if (!info) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
- RETURN_FALSE;
- }
-
- ret = php_dbm_nextkey(info, Z_STRVAL_P(key) TSRMLS_CC);
- if (!ret) {
- RETURN_FALSE;
- } else {
- RETVAL_STRING(ret, 0);
- }
-}
-/* }}} */
-
-/* {{{ php_dbm_nextkey
- */
-char *php_dbm_nextkey(dbm_info *info, char *key TSRMLS_DC)
-{
- datum key_datum, ret_datum;
- char *ret;
- DBM_TYPE dbf;
-
- key_datum.dptr = key;
- key_datum.dsize = strlen(key);
-#if GDBM_FIX
- key_datum.dsize++;
-#endif
-
- dbf = info->dbf;
- if (!dbf) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate dbm file");
- return(NULL);
- }
-
- /* explicitly zero-out ret_datum */
- ret_datum.dptr = NULL;
- ret_datum.dsize = 0;
-
- ret_datum = DBM_NEXTKEY(dbf, key_datum);
-
- if (ret_datum.dptr) {
- ret = (char *)emalloc(sizeof(char) * ret_datum.dsize + 1);
- strncpy(ret, ret_datum.dptr, ret_datum.dsize);
- ret[ret_datum.dsize] = '\0';
-#if GDBM
-/* GDBM uses malloc to allocate the value_datum block, so we need to free it */
- free(ret_datum.dptr);
-#else
-# if !NDBM
- efree(ret_datum.dptr);
-# endif
-#endif
- }
- else ret=NULL;
-
- if (ret && PG(magic_quotes_runtime)) {
- ret = php_addslashes(ret, ret_datum.dsize, NULL, 1 TSRMLS_CC);
- }
- return(ret);
-}
-/* }}} */
-
-#if !GDBM && !NDBM
-static long CurrentFlatFilePos = 0L;
-/* {{{ flatfile_store
- */
-int flatfile_store(FILE *dbf, datum key_datum, datum value_datum, int mode) {
- int ret;
-
- if (mode == DBM_INSERT) {
- if (flatfile_findkey(dbf, key_datum)) {
- return 1;
- }
- fseek(dbf, 0L, SEEK_END);
- fprintf(dbf, "%d\n", key_datum.dsize);
- fflush(dbf);
- ret = fwrite(key_datum.dptr, sizeof(char), key_datum.dsize, dbf);
- fprintf(dbf, "%d\n", value_datum.dsize);
- fflush(dbf);
- ret = fwrite(value_datum.dptr, sizeof(char), value_datum.dsize, dbf);
- } else { /* DBM_REPLACE */
- flatfile_delete(dbf, key_datum);
- fprintf(dbf, "%d\n", key_datum.dsize);
- fflush(dbf);
- ret = fwrite(key_datum.dptr, sizeof(char), key_datum.dsize, dbf);
- fprintf(dbf, "%d\n", value_datum.dsize);
- ret = fwrite(value_datum.dptr, sizeof(char), value_datum.dsize, dbf);
- }
-
- if (ret>0)
- ret=0;
- return ret;
-}
-/* }}} */
-
-/* {{{ flatfile_fetch
- */
-datum flatfile_fetch(FILE *dbf, datum key_datum) {
- datum value_datum = {NULL, 0};
- int num=0, buf_size=1024;
- char *buf;
-
- if (flatfile_findkey(dbf, key_datum)) {
- buf = emalloc((buf_size+1) * sizeof(char));
- if (fgets(buf, 15, dbf)) {
- num = atoi(buf);
- if (num > buf_size) {
- buf_size+=num;
- buf = erealloc(buf, (buf_size+1)*sizeof(char));
- }
- fread(buf, sizeof(char), num, dbf);
- value_datum.dptr = buf;
- value_datum.dsize = num;
- }
- }
- return value_datum;
-}
-/* }}} */
-
-/* {{{ flatfile_delete
- */
-int flatfile_delete(FILE *dbf, datum key_datum) {
- char *key = key_datum.dptr;
- int size = key_datum.dsize;
-
- char *buf;
- int num, buf_size = 1024;
- long pos;
-
- rewind(dbf);
-
- buf = emalloc((buf_size + 1)*sizeof(char));
- while(!feof(dbf)) {
- /* read in the length of the key name */
- if (!fgets(buf, 15, dbf))
- break;
- num = atoi(buf);
- if (num > buf_size) {
- buf_size += num;
- buf = erealloc(buf, (buf_size+1)*sizeof(char));
- }
- pos = ftell(dbf);
-
- /* read in the key name */
- num = fread(buf, sizeof(char), num, dbf);
- if (num<0) break;
- *(buf+num) = '\0';
-
- if (size == num && !memcmp(buf, key, size)) {
- fseek(dbf, pos, SEEK_SET);
- fputc(0, dbf);
- fflush(dbf);
- fseek(dbf, 0L, SEEK_END);
- if (buf) efree(buf);
- return SUCCESS;
- }
-
- /* read in the length of the value */
- if (!fgets(buf, 15, dbf))
- break;
- num = atoi(buf);
- if (num > buf_size) {
- buf_size+=num;
- if (buf) efree(buf);
- buf = emalloc((buf_size+1)*sizeof(char));
- }
- /* read in the value */
- num = fread(buf, sizeof(char), num, dbf);
- if (num<0)
- break;
- }
- if (buf) efree(buf);
- return FAILURE;
-}
-/* }}} */
-
-/* {{{ flatfile_findkey
- */
-int flatfile_findkey(FILE *dbf, datum key_datum) {
- char *buf = NULL;
- int num;
- int buf_size=1024;
- int ret=0;
- void *key = key_datum.dptr;
- int size = key_datum.dsize;
-
- rewind(dbf);
- buf = emalloc((buf_size+1)*sizeof(char));
- while (!feof(dbf)) {
- if (!fgets(buf, 15, dbf)) break;
- num = atoi(buf);
- if (num > buf_size) {
- if (buf) efree(buf);
- buf_size+=num;
- buf = emalloc((buf_size+1)*sizeof(char));
- }
- num = fread(buf, sizeof(char), num, dbf);
- if (num<0) break;
- *(buf+num) = '\0';
- if (size == num) {
- if (!memcmp(buf, key, size)) {
- ret = 1;
- break;
- }
- }
- if (!fgets(buf, 15, dbf))
- break;
- num = atoi(buf);
- if (num > buf_size) {
- if (buf) efree(buf);
- buf_size+=num;
- buf = emalloc((buf_size+1)*sizeof(char));
- }
- num = fread(buf, sizeof(char), num, dbf);
- if (num<0) break;
- *(buf+num) = '\0';
- }
- if (buf) efree(buf);
- return(ret);
-}
-/* }}} */
-
-/* {{{ flatfile_firstkey
- */
-datum flatfile_firstkey(FILE *dbf) {
- datum buf;
- int num;
- int buf_size=1024;
-
- rewind(dbf);
- buf.dptr = emalloc((buf_size+1)*sizeof(char));
- while(!feof(dbf)) {
- if (!fgets(buf.dptr, 15, dbf)) break;
- num = atoi(buf.dptr);
- if (num > buf_size) {
- buf_size+=num;
- if (buf.dptr) efree(buf.dptr);
- buf.dptr = emalloc((buf_size+1)*sizeof(char));
- }
- num = fread(buf.dptr, sizeof(char), num, dbf);
- if (num<0) break;
- buf.dsize = num;
- if (*(buf.dptr)!=0) {
- CurrentFlatFilePos = ftell(dbf);
- return(buf);
- }
- if (!fgets(buf.dptr, 15, dbf)) break;
- num = atoi(buf.dptr);
- if (num > buf_size) {
- buf_size+=num;
- if (buf.dptr) efree(buf.dptr);
- buf.dptr = emalloc((buf_size+1)*sizeof(char));
- }
- num = fread(buf.dptr, sizeof(char), num, dbf);
- if (num<0) break;
- }
- if (buf.dptr) efree(buf.dptr);
- buf.dptr = NULL;
- return(buf);
-}
-/* }}} */
-
-/* {{{ latfile_nextkey
- */
-datum flatfile_nextkey(FILE *dbf) {
- datum buf;
- int num;
- int buf_size=1024;
-
- fseek(dbf, CurrentFlatFilePos, SEEK_SET);
- buf.dptr = emalloc((buf_size+1)*sizeof(char));
- while(!feof(dbf)) {
- if (!fgets(buf.dptr, 15, dbf)) break;
- num = atoi(buf.dptr);
- if (num > buf_size) {
- buf_size+=num;
- if (buf.dptr) efree(buf.dptr);
- buf.dptr = emalloc((buf_size+1)*sizeof(char));
- }
- num = fread(buf.dptr, sizeof(char), num, dbf);
- if (num<0) break;
- if (!fgets(buf.dptr, 15, dbf)) break;
- num = atoi(buf.dptr);
- if (num > buf_size) {
- buf_size+=num;
- if (buf.dptr) efree(buf.dptr);
- buf.dptr = emalloc((buf_size+1)*sizeof(char));
- }
- num = fread(buf.dptr, sizeof(char), num, dbf);
- if (num<0) break;
- buf.dsize = num;
- if (*(buf.dptr)!=0) {
- CurrentFlatFilePos = ftell(dbf);
- return(buf);
- }
- }
- if (buf.dptr) efree(buf.dptr);
- buf.dptr = NULL;
- return(buf);
-}
-/* }}} */
-#endif
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(db)
-{
- le_db = zend_register_list_destructors_ex(php_dbm_close, NULL, "dbm", module_number);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(db)
-{
-#if !GDBM && !NDBM
- CurrentFlatFilePos = 0L;
-#endif
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ dbm_functions[]
- */
-function_entry dbm_functions[] = {
- PHP_FE(dblist, NULL)
- PHP_FE(dbmopen, NULL)
- PHP_FE(dbmclose, NULL)
- PHP_FE(dbminsert, NULL)
- PHP_FE(dbmfetch, NULL)
- PHP_FE(dbmreplace, NULL)
- PHP_FE(dbmexists, NULL)
- PHP_FE(dbmdelete, NULL)
- PHP_FE(dbmfirstkey, NULL)
- PHP_FE(dbmnextkey, NULL)
-#if HELLY_0
- PHP_FE(db_id_list, NULL)
-#endif
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry dbm_module_entry = {
- STANDARD_MODULE_HEADER,
- "db",
- dbm_functions,
- PHP_MINIT(db),
- NULL,
- PHP_RINIT(db),
- NULL,
- PHP_MINFO(db),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_DB
-ZEND_GET_MODULE(dbm)
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/db/db.dsp b/ext/db/db.dsp
deleted file mode 100644
index 8c5d37b37a..0000000000
--- a/ext/db/db.dsp
+++ /dev/null
@@ -1,114 +0,0 @@
-# Microsoft Developer Studio Project File - Name="db" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=db - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "db.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "db.mak" CFG="db - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "db - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "db - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "db - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DB" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "DB_EXPORTS" /D "COMPILE_DL_DB" /D ZTS=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "HAVE_INET_ATON" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_db.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "db - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DB" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB_EXPORTS" /D "COMPILE_DL_DB" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "HAVE_INET_ATON" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_db.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "db - Win32 Release_TS"
-# Name "db - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\db.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_db.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/db/php_db.h b/ext/db/php_db.h
deleted file mode 100644
index 6eb35533c3..0000000000
--- a/ext/db/php_db.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-
-#ifndef PHP_DB_H
-#define PHP_DB_H
-
-
-#ifndef DLEXPORT
-#define DLEXPORT
-#endif
-
-
-extern zend_module_entry dbm_module_entry;
-#define phpext_db_ptr &dbm_module_entry
-
-
-
-typedef struct dbm_info {
- char *filename;
- char *lockfn;
- int lockfd;
- void *dbf;
-} dbm_info;
-
-/*
- we're not going to bother with flatfile on win32
- because the dbm module will be external, and we
- do not want flatfile compiled staticly
-*/
-#if defined(PHP_WIN32) && !defined(COMPILE_DL_DB)
-#undef phpext_db_ptr
-#define phpext_db_ptr NULL
-#endif
-
-dbm_info *php_find_dbm(pval *id TSRMLS_DC);
-void php_dbm_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-dbm_info *php_dbm_open(char *filename, char *mode TSRMLS_DC);
-char *php_dbm_fetch(dbm_info *info, char *key TSRMLS_DC);
-int php_dbm_insert_replace(dbm_info *info, char *key, char *value, int replace_mode TSRMLS_DC);
-int php_dbm_exists(dbm_info *info, char *key TSRMLS_DC);
-int php_dbm_delete(dbm_info *info, char *key TSRMLS_DC);
-char *php_dbm_first_key(dbm_info *info TSRMLS_DC);
-char *php_dbm_nextkey(dbm_info *info, char *key TSRMLS_DC);
-
-/* db file functions */
-PHP_MINIT_FUNCTION(db);
-PHP_RINIT_FUNCTION(db);
-PHP_MINFO_FUNCTION(db);
-
-PHP_FUNCTION(dblist);
-PHP_FUNCTION(dbmopen);
-PHP_FUNCTION(dbmclose);
-PHP_FUNCTION(dbminsert);
-PHP_FUNCTION(dbmfetch);
-PHP_FUNCTION(dbmreplace);
-PHP_FUNCTION(dbmexists);
-PHP_FUNCTION(dbmdelete);
-PHP_FUNCTION(dbmfirstkey);
-PHP_FUNCTION(dbmnextkey);
-
-#endif /* PHP_DB_H */
diff --git a/ext/db/tests/001.phpt b/ext/db/tests/001.phpt
deleted file mode 100644
index a18e79a82b..0000000000
--- a/ext/db/tests/001.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-DBM File Creation Test
---SKIPIF--
-<?php if (!extension_loaded("db")) print "skip"; ?>
---FILE--
-<?php
- require_once('test.inc');
- if (dbmopen($db_file, "n") && file_exists($db_file)) {
- echo "database file created\n";
- } else {
- echo "$db_file does not exist\n";
- }
- dbmclose($db_file);
-?>
---EXPECT--
-database file created \ No newline at end of file
diff --git a/ext/db/tests/002.phpt b/ext/db/tests/002.phpt
deleted file mode 100644
index 3c797370c5..0000000000
--- a/ext/db/tests/002.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-DBM Insert/Fetch Test
---SKIPIF--
-<?php if (!extension_loaded("db")) print "skip";?>
---FILE--
-<?php
- require_once('test.inc');
- if (dbmopen($db_file, "n")) {
- dbminsert($db_file, "key1", "This is a test insert");
- echo dbmfetch($db_file, "key1");
- dbmclose($db_file);
- } else {
- echo "Error creating database\n";
- }
-?>
---EXPECT--
-This is a test insert
diff --git a/ext/db/tests/003.phpt b/ext/db/tests/003.phpt
deleted file mode 100644
index 6d3f7d3611..0000000000
--- a/ext/db/tests/003.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-DBM Insert/Replace/Fetch Test
---SKIPIF--
-<?php if (!extension_loaded("db")) print "skip"; ?>
---FILE--
-<?php
- require_once('test.inc');
- if (dbmopen($db_file, "n")) {
- dbminsert($db_file, "key1", "This is a test insert");
- dbmreplace($db_file, "key1", "This is the replacement text");
- @dbminsert($db_file, "key1", "This is another replacement text?");
- $a = dbmfetch($db_file, "key1");
- dbmclose($db_file);
- echo $a;
- } else {
- echo "Error creating database\n";
- }
-?>
---EXPECT--
-This is the replacement text
diff --git a/ext/db/tests/004.phpt b/ext/db/tests/004.phpt
deleted file mode 100644
index 4c19a38fe6..0000000000
--- a/ext/db/tests/004.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-DBM Multiple Insert/Fetch Test
---SKIPIF--
-<?php if (!extension_loaded("db")) print "skip"; ?>
---FILE--
-<?php
- require_once('test.inc');
- if (dbmopen($db_file, "n")) {
- dbminsert($db_file, "key1", "Content String 1");
- dbminsert($db_file, "key2", "Content String 2");
- dbminsert($db_file, "key3", "Third Content String");
- dbminsert($db_file, "key4", "Another Content String");
- dbminsert($db_file, "key5", "The last content string");
- $a = dbmfetch($db_file, "key4");
- $b = dbmfetch($db_file, "key2");
- dbmclose($db_file);
- echo "$a $b";
- } else {
- echo "Error creating database\n";
- }
-?>
---EXPECT--
-Another Content String Content String 2
diff --git a/ext/db/tests/005.phpt b/ext/db/tests/005.phpt
deleted file mode 100644
index 6105f533d8..0000000000
--- a/ext/db/tests/005.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-DBM FirstKey/NextKey Loop Test With 5 Items
---SKIPIF--
-<?php if (!extension_loaded("db")) print "skip"; ?>
---FILE--
-<?php
- require_once('test.inc');
- if (dbmopen($db_file, "n")) {
- dbminsert($db_file, "key1", "Content String 1");
- dbminsert($db_file, "key2", "Content String 2");
- dbminsert($db_file, "key3", "Third Content String");
- dbminsert($db_file, "key4", "Another Content String");
- dbminsert($db_file, "key5", "The last content string");
- $a = dbmfirstkey($db_file);
- $i=0;
- while($a) {
- $a = dbmnextkey($db_file, $a);
- $i++;
- }
- dbmclose($db_file);
- echo $i;
- } else {
- echo "Error creating database\n";
- }
-?>
---EXPECT--
-5
diff --git a/ext/db/tests/006.phpt b/ext/db/tests/006.phpt
deleted file mode 100644
index c5ffd597ca..0000000000
--- a/ext/db/tests/006.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-DBM FirstKey/NextKey with 2 deletes
---SKIPIF--
-<?php if (!extension_loaded("db")) print "skip"; ?>
---FILE--
-<?php
- require_once('test.inc');
- if (dbmopen($db_file, "n")) {
- dbminsert($db_file, "key1", "Content String 1");
- dbminsert($db_file, "key2", "Content String 2");
- dbminsert($db_file, "key3", "Third Content String");
- dbminsert($db_file, "key4", "Another Content String");
- dbminsert($db_file, "key5", "The last content string");
- dbmdelete($db_file, "key3");
- dbmdelete($db_file, "key1");
- $a = dbmfirstkey($db_file);
- $i=0;
- while($a) {
- $a = dbmnextkey($db_file, $a);
- $i++;
- }
- dbmclose($db_file);
- echo $i;
- } else {
- echo "Error creating database\n";
- }
-?>
---EXPECT--
-3
diff --git a/ext/db/tests/test.inc b/ext/db/tests/test.inc
deleted file mode 100644
index 1e384aa835..0000000000
--- a/ext/db/tests/test.inc
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
- $db_file = dirname(__FILE__).'/test.dbm';
-?>
diff --git a/ext/dba/CREDITS b/ext/dba/CREDITS
deleted file mode 100644
index 370b3ea271..0000000000
--- a/ext/dba/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-DBA
-Sascha Schumann, Marcus Boerger \ No newline at end of file
diff --git a/ext/dba/config.m4 b/ext/dba/config.m4
deleted file mode 100644
index 53ce333e5b..0000000000
--- a/ext/dba/config.m4
+++ /dev/null
@@ -1,443 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-dnl Suppose we need FlatFile if no support or only CDB is used.
-
-AC_DEFUN(PHP_DBA_STD_BEGIN,[
- unset THIS_INCLUDE THIS_LIBS THIS_LFLAGS THIS_PREFIX THIS_RESULT
-])
-
-AC_DEFUN(PHP_TEMP_LDFLAGS,[
- old_LDFLAGS=$LDFLAGS
- LDFLAGS="$1 $LDFLAGS"
- $2
- LDFLAGS=$old_LDFLAGS
-])
-
-dnl Assign INCLUDE/LFLAGS from PREFIX
-AC_DEFUN(PHP_DBA_STD_ASSIGN,[
- if test -n "$THIS_PREFIX" && test "$THIS_PREFIX" != "/usr"; then
- THIS_LFLAGS=$THIS_PREFIX/lib
- fi
-])
-
-dnl Standard check
-AC_DEFUN(PHP_DBA_STD_CHECK,[
- THIS_RESULT="yes"
- if test -z "$THIS_INCLUDE"; then
- AC_MSG_ERROR(cannot find necessary header file(s))
- fi
- if test -z "$THIS_LIBS"; then
- AC_MSG_ERROR(cannot find necessary library)
- fi
-])
-
-dnl Attach THIS_x to DBA_x
-AC_DEFUN(PHP_DBA_STD_ATTACH,[
- PHP_ADD_LIBRARY_WITH_PATH($THIS_LIBS, $THIS_LFLAGS, DBA_SHARED_LIBADD)
- unset THIS_INCLUDE THIS_LIBS THIS_LFLAGS THIS_PREFIX
-])
-
-dnl Print the result message
-dnl parameters(name [, full name [, empty or error message]])
-AC_DEFUN(AC_DBA_STD_RESULT,[
- THIS_NAME=[]translit($1,a-z0-9-,A-Z0-9_)
- if test -n "$2"; then
- THIS_FULL_NAME="$2"
- else
- THIS_FULL_NAME="$THIS_NAME"
- fi
- AC_MSG_CHECKING(for $THIS_FULL_NAME support)
- if test -n "$3"; then
- AC_MSG_ERROR($3)
- fi
- if test "$THIS_RESULT" = "yes" -o "$THIS_RESULT" = "builtin"; then
- HAVE_DBA=1
- eval HAVE_$THIS_NAME=1
- AC_MSG_RESULT($THIS_RESULT)
- else
- AC_MSG_RESULT(no)
- fi
- unset THIS_RESULT THIS_NAME THIS_FULL_NAME
-])
-
-PHP_ARG_ENABLE(dba,whether to enable DBA,
-[ --enable-dba Build DBA with builtin modules])
-
-AC_ARG_WITH(gdbm,
-[ --with-gdbm[=DIR] DBA: Include GDBM support],[
- if test "$withval" != "no"; then
- PHP_DBA_STD_BEGIN
- for i in $withval /usr/local /usr; do
- if test -f "$i/include/gdbm.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/gdbm.h
- break
- fi
- done
-
- if test -n "$THIS_INCLUDE"; then
- unset ac_cv_lib_gdbm_gdbm_open
- PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
- AC_CHECK_LIB(gdbm, gdbm_open, [
- AC_DEFINE_UNQUOTED(GDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
- AC_DEFINE(DBA_GDBM, 1, [ ])
- THIS_LIBS=gdbm
- ])
- ])
- fi
-
- PHP_DBA_STD_ASSIGN
- PHP_DBA_STD_CHECK
- PHP_DBA_STD_ATTACH
- fi
-])
-AC_DBA_STD_RESULT(gdbm)
-
-AC_ARG_WITH(ndbm,
-[ --with-ndbm[=DIR] DBA: Include NDBM support],[
- if test "$withval" != "no"; then
- PHP_DBA_STD_BEGIN
- for i in $withval /usr/local /usr; do
- if test -f "$i/include/ndbm.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/ndbm.h
- break
- elif test -f "$i/include/db1/ndbm.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/db1/ndbm.h
- break
- fi
- done
-
- if test -n "$THIS_INCLUDE"; then
- for LIB in ndbm db1 c; do
- PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
- AC_CHECK_LIB($LIB, dbm_open, [
- AC_DEFINE_UNQUOTED(NDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
- AC_DEFINE(DBA_NDBM,1, [ ])
- THIS_LIBS=$LIB
- break
- ])
- ])
- done
- fi
-
- PHP_DBA_STD_ASSIGN
- PHP_DBA_STD_CHECK
- PHP_DBA_STD_ATTACH
- fi
-])
-AC_DBA_STD_RESULT(ndbm)
-
-dnl Berkeley specific (library and version test)
-dnl parameters(version, library list, function)
-AC_DEFUN(PHP_DBA_DB_CHECK,[
- for LIB in $2; do
- if test -f $THIS_PREFIX/lib/lib$LIB.a -o -f $THIS_PREFIX/lib/lib$LIB.$SHLIB_SUFFIX_NAME; then
- PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib -l$LIB,[
- AC_TRY_LINK([
-#include "$THIS_INCLUDE"
- ],[
- (void)db_create((DB**)0, (DB_ENV*)0, 0);
- ],[
- AC_EGREP_CPP(yes,[
-#include "$THIS_INCLUDE"
-#if DB_VERSION_MAJOR == $1
- yes
-#endif
- ],[
- THIS_LIBS=$LIB
- break
- ])
- ])
- ])
- fi
- done
- if test -z "$THIS_LIBS"; then
- AC_MSG_CHECKING(for db$1 major version)
- AC_MSG_ERROR(Header contains different version)
- fi
- if test "$1" = "4"; then
- AC_MSG_CHECKING(for db4 minor version and patch level)
- AC_EGREP_CPP(yes,[
-#include "$THIS_INCLUDE"
-#if DB_VERSION_MINOR != 1 || DB_VERSION_PATCH >= 25
- yes
-#endif
- ],[
- AC_MSG_RESULT(ok)
- ],[
- AC_MSG_ERROR(Version 4.1 requires patch level 25)
- ])
- fi
- if test "$ext_shared" = "yes"; then
- AC_MSG_CHECKING(if db can be used as shared extension)
- AC_EGREP_CPP(yes,[
-#include "$THIS_INCLUDE"
-#if DB_VERSION_MAJOR > 3 || (DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR > 2)
- yes
-#endif
- ],[
- AC_MSG_RESULT(yes)
- ],[
- AC_MSG_ERROR(At least version 3.3 is required)
- ])
- fi
- if test -n "$THIS_LIBS"; then
- AC_DEFINE(DBA_DB$1, 1, [ ])
- if test -n "$THIS_INCLUDE"; then
- AC_DEFINE_UNQUOTED(DB$1_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
- fi
- fi
- PHP_DBA_STD_ASSIGN
- PHP_DBA_STD_CHECK
- PHP_DBA_STD_ATTACH
-])
-
-AC_ARG_WITH(db4,
-[ --with-db4[=DIR] DBA: Include Berkeley DB4 support],[
- if test "$withval" != "no"; then
- PHP_DBA_STD_BEGIN
- for i in $withval /usr/local/BerkeleyDB.4.1 /usr/local/BerkeleyDB.4.0 /usr/local /usr; do
- if test -f "$i/db4/db.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/db4/db.h
- break
- elif test -f "$i/include/db4/db.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/db4/db.h
- break
- elif test -f "$i/include/db/db4.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/db/db4.h
- break
- elif test -f "$i/include/db4.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/db4.h
- break
- elif test -f "$i/include/db.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/db.h
- break
- fi
- done
- PHP_DBA_DB_CHECK(4, db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
- fi
-])
-AC_DBA_STD_RESULT(db4,Berkeley DB4)
-
-AC_ARG_WITH(db3,
-[ --with-db3[=DIR] DBA: Include Berkeley DB3 support],[
- if test "$withval" != "no"; then
- PHP_DBA_STD_BEGIN
- if test "$HAVE_DB4" = "1"; then
- AC_DBA_STD_RESULT(db3,Berkeley DB3,You cannot combine --with-db3 with --with-db4)
- fi
- for i in $withval /usr/local/BerkeleyDB.3.3 /usr/local/BerkeleyDB.3.2 /usr/local/BerkeleyDB.3.1 /usr/local/BerkeleyDB.3.0 /usr/local /usr; do
- if test -f "$i/db3/db.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/db3/db.h
- break
- elif test -f "$i/include/db3/db.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/db3/db.h
- break
- elif test -f "$i/include/db/db3.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/db/db3.h
- break
- elif test -f "$i/include/db3.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/db3.h
- break
- elif test -f "$i/include/db.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/db.h
- break
- fi
- done
- PHP_DBA_DB_CHECK(3, db-3.3 db-3.2 db-3.1 db-3.0 db-3 db3 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
- fi
- ])
-AC_DBA_STD_RESULT(db3,Berkeley DB3)
-
-AC_ARG_WITH(db2,
-[ --with-db2[=DIR] DBA: Include Berkeley DB2 support],[
- if test "$withval" != "no"; then
- PHP_DBA_STD_BEGIN
- if test "$HAVE_DB3" = "1" -o "$HAVE_DB4" = "1"; then
- AC_DBA_STD_RESULT(db2,Berkeley DB2,You cannot combine --with-db2 with --with-db3 or --with-db4)
- fi
- for i in $withval $withval/BerkeleyDB /usr/BerkeleyDB /usr/local /usr; do
- if test -f "$i/db2/db.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/db2/db.h
- break
- elif test -f "$i/include/db2/db.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/db2/db.h
- break
- elif test -f "$i/include/db/db2.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/db/db2.h
- break
- elif test -f "$i/include/db2.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/db2.h
- break
- elif test -f "$i/include/db.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/db.h
- break
- fi
- done
- PHP_DBA_DB_CHECK(2, db-2 db2 db, [(void)db_appinit("", NULL, (DB_ENV*)0, 0)])
- fi
-])
-AC_DBA_STD_RESULT(db2,Berkeley DB2)
-
-AC_ARG_WITH(dbm,
-[ --with-dbm[=DIR] DBA: Include DBM support],[
- if test "$withval" != "no"; then
- PHP_DBA_STD_BEGIN
- for i in $withval /usr/local /usr; do
- if test -f "$i/include/dbm.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/dbm.h
- break
- elif test -f "$i/include/gdbm/dbm.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/gdbm/dbm.h
- break
- fi
- done
-
- if test -n "$THIS_INCLUDE"; then
- for LIB in dbm c gdbm; do
- PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
- AC_CHECK_LIB($LIB, dbminit, [
- AC_MSG_CHECKING(for DBM using GDBM)
- AC_DEFINE_UNQUOTED(DBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
- if test "$LIB" = "gdbm"; then
- AC_DEFINE_UNQUOTED(DBM_VERSION, "GDBM", [ ])
- AC_MSG_RESULT(yes)
- else
- AC_DEFINE_UNQUOTED(DBM_VERSION, "DBM", [ ])
- AC_MSG_RESULT(no)
- fi
- AC_DEFINE(DBA_DBM,1,[ ])
- THIS_LIBS=$LIB
- break
- ])
- ])
- done
- fi
-
- PHP_DBA_STD_ASSIGN
- PHP_DBA_STD_CHECK
- PHP_DBA_STD_ATTACH
- fi
-])
-AC_DBA_STD_RESULT(dbm)
-
-AC_DEFUN(PHP_DBA_BUILTIN_CDB,[
- PHP_ADD_BUILD_DIR($ext_builddir/libcdb)
- AC_DEFINE(DBA_CDB_BUILTIN, 1, [ ])
- AC_DEFINE(DBA_CDB_MAKE, 1, [ ])
- AC_DEFINE(DBA_CDB, 1, [ ])
- cdb_sources="libcdb/cdb.c libcdb/cdb_make.c libcdb/uint32.c"
- THIS_RESULT="builtin"
-])
-
-AC_ARG_WITH(cdb,
-[ --with-cdb[=DIR] DBA: Include CDB support],[
- if test "$withval" = "yes"; then
- PHP_DBA_BUILTIN_CDB
- elif test "$withval" != "no"; then
- PHP_DBA_STD_BEGIN
- for i in $withval /usr/local /usr; do
- if test -f "$i/include/cdb.h"; then
- THIS_PREFIX=$i
- THIS_INCLUDE=$i/include/cdb.h
- break
- fi
- done
-
- if test -n "$THIS_INCLUDE"; then
- for LIB in cdb c; do
- PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
- AC_CHECK_LIB($LIB, cdb_read, [
- AC_DEFINE_UNQUOTED(CDB_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
- AC_DEFINE(DBA_CDB,1,[ ])
- THIS_LIBS=$LIB
- break
- ])
- ])
- done
- fi
-
- PHP_DBA_STD_ASSIGN
- PHP_DBA_STD_CHECK
- PHP_DBA_STD_ATTACH
- fi
-],[
- if test "$PHP_DBA" != "no"; then
- PHP_DBA_BUILTIN_CDB
- fi
-])
-AC_DBA_STD_RESULT(cdb)
-
-AC_DEFUN(PHP_DBA_BUILTIN_INI,[
- PHP_ADD_BUILD_DIR($ext_builddir/libini)
- AC_DEFINE(DBA_INIFILE, 1, [ ])
- ini_sources="libinifile/inifile.c"
- THIS_RESULT="builtin"
-])
-
-AC_ARG_WITH(inifile,
-[ --with-inifile DBA: Include INI support],[
- if test "$withval" != "no"; then
- PHP_DBA_BUILTIN_INI
- fi
-],[
- if test "$PHP_DBA" != "no"; then
- PHP_DBA_BUILTIN_INI
- fi
-])
-AC_DBA_STD_RESULT(inifile,INI File)
-
-AC_DEFUN(PHP_DBA_BUILTIN_FLATFILE,[
- PHP_ADD_BUILD_DIR($ext_builddir/libflatfile)
- AC_DEFINE(DBA_FLATFILE, 1, [ ])
- flat_sources="libflatfile/flatfile.c"
- THIS_RESULT="builtin"
-])
-
-dnl
-dnl FlatFile check must be the last one.
-dnl
-AC_ARG_WITH(flatfile,
-[ --with-flatfile DBA: Include FlatFile support],[
- if test "$withval" != "no"; then
- PHP_DBA_BUILTIN_FLATFILE
- fi
-],[
- if test "$PHP_DBA" != "no"; then
- PHP_DBA_BUILTIN_FLATFILE
- fi
-])
-AC_DBA_STD_RESULT(FlatFile,FlatFile)
-
-AC_MSG_CHECKING(whether to enable DBA interface)
-if test "$HAVE_DBA" = "1"; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_DBA, 1, [ ])
- PHP_NEW_EXTENSION(dba, dba.c dba_cdb.c dba_db2.c dba_dbm.c dba_gdbm.c dba_ndbm.c dba_db3.c dba_db4.c dba_flatfile.c dba_inifile.c $cdb_sources $flat_sources $ini_sources, $ext_shared)
- PHP_ADD_BUILD_DIR($ext_builddir/libcdb)
- PHP_ADD_BUILD_DIR($ext_builddir/libflatfile)
- PHP_SUBST(DBA_SHARED_LIBADD)
-else
- AC_MSG_RESULT(no)
-fi
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
deleted file mode 100644
index f83ec079a8..0000000000
--- a/ext/dba/dba.c
+++ /dev/null
@@ -1,1026 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- | Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_DBA
-
-#include "php_ini.h"
-#include <stdio.h>
-#include <fcntl.h>
-#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-
-#include "php_dba.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-
-#include "php_gdbm.h"
-#include "php_ndbm.h"
-#include "php_dbm.h"
-#include "php_cdb.h"
-#include "php_db2.h"
-#include "php_db3.h"
-#include "php_db4.h"
-#include "php_flatfile.h"
-#include "php_inifile.h"
-
-/* {{{ dba_functions[]
- */
-function_entry dba_functions[] = {
- PHP_FE(dba_open, NULL)
- PHP_FE(dba_popen, NULL)
- /* Disabled until 4.3.1, when persistent STDIO streams are implemented. */
- /* PHP_FE(dba_popen, NULL) */
- PHP_FE(dba_close, NULL)
- PHP_FE(dba_delete, NULL)
- PHP_FE(dba_exists, NULL)
- PHP_FE(dba_fetch, NULL)
- PHP_FE(dba_insert, NULL)
- PHP_FE(dba_replace, NULL)
- PHP_FE(dba_firstkey, NULL)
- PHP_FE(dba_nextkey, NULL)
- PHP_FE(dba_optimize, NULL)
- PHP_FE(dba_sync, NULL)
- PHP_FE(dba_handlers, NULL)
- PHP_FE(dba_list, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-PHP_MINIT_FUNCTION(dba);
-PHP_MSHUTDOWN_FUNCTION(dba);
-PHP_MINFO_FUNCTION(dba);
-
-zend_module_entry dba_module_entry = {
- STANDARD_MODULE_HEADER,
- "dba",
- dba_functions,
- PHP_MINIT(dba),
- PHP_MSHUTDOWN(dba),
- NULL,
- NULL,
- PHP_MINFO(dba),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_DBA
-ZEND_GET_MODULE(dba)
-#endif
-
-/* {{{ macromania */
-
-#define DBA_ID_PARS \
- zval **id; \
- dba_info *info = NULL; \
- int ac = ZEND_NUM_ARGS()
-
-/* these are used to get the standard arguments */
-
-#define DBA_GET1 \
- if(ac != 1 || zend_get_parameters_ex(ac, &id) != SUCCESS) { \
- WRONG_PARAM_COUNT; \
- }
-
-/* {{{ php_dba_myke_key */
-static size_t php_dba_make_key(zval **key, char **key_str, char **key_free TSRMLS_DC)
-{
- if (Z_TYPE_PP(key) == IS_ARRAY) {
- zval **group, **name;
- HashPosition pos;
- size_t len;
-
- if (zend_hash_num_elements(Z_ARRVAL_PP(key)) != 2) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Key does not have exactly two elements: (key, name)");
- return -1;
- }
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(key), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_PP(key), (void **) &group, &pos);
- zend_hash_move_forward_ex(Z_ARRVAL_PP(key), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_PP(key), (void **) &name, &pos);
- convert_to_string_ex(group);
- convert_to_string_ex(name);
- if (Z_STRLEN_PP(group) == 0) {
- *key_str = Z_STRVAL_PP(name);
- *key_free = NULL;
- return Z_STRLEN_PP(name);
- }
- len = spprintf(key_str, 0, "[%s]%s", Z_STRVAL_PP(group), Z_STRVAL_PP(name));
- *key_free = *key_str;
- return len;
- } else {
- convert_to_string_ex(key);
- *key_str = Z_STRVAL_PP(key);
- *key_free = NULL;
- return Z_STRLEN_PP(key);
- }
-}
-/* }}} */
-
-#define DBA_GET2 \
- zval **key; \
- char *key_str, *key_free; \
- size_t key_len; \
- if(ac != 2 || zend_get_parameters_ex(ac, &key, &id) != SUCCESS) { \
- WRONG_PARAM_COUNT; \
- } \
- if ((key_len = php_dba_make_key(key, &key_str, &key_free TSRMLS_CC)) == 0) {\
- RETURN_FALSE; \
- }
-
-#define DBA_GET2_3 \
- zval **key; \
- char *key_str, *key_free; \
- size_t key_len; \
- zval **tmp; \
- int skip = 0; \
- switch(ac) { \
- case 2: \
- if (zend_get_parameters_ex(ac, &key, &id) != SUCCESS) { \
- WRONG_PARAM_COUNT; \
- } \
- break; \
- case 3: \
- if (zend_get_parameters_ex(ac, &key, &tmp, &id) != SUCCESS) { \
- WRONG_PARAM_COUNT; \
- } \
- convert_to_long_ex(tmp); \
- skip = Z_LVAL_PP(tmp); \
- break; \
- default: \
- WRONG_PARAM_COUNT; \
- } \
- if ((key_len = php_dba_make_key(key, &key_str, &key_free TSRMLS_CC)) == 0) {\
- RETURN_FALSE; \
- }
-
-#define DBA_GET3 \
- zval **key, **val; \
- char *key_str, *key_free; \
- size_t key_len; \
- if(ac != 3 || zend_get_parameters_ex(ac, &key, &val, &id) != SUCCESS) { \
- WRONG_PARAM_COUNT; \
- } \
- convert_to_string_ex(val); \
- if ((key_len = php_dba_make_key(key, &key_str, &key_free TSRMLS_CC)) == 0) {\
- RETURN_FALSE; \
- }
-
-#define DBA_ID_GET \
- ZEND_FETCH_RESOURCE2(info, dba_info *, id, -1, "DBA identifier", le_db, le_pdb);
-
-#define DBA_ID_GET1 DBA_ID_PARS; DBA_GET1; DBA_ID_GET
-#define DBA_ID_GET2 DBA_ID_PARS; DBA_GET2; DBA_ID_GET
-#define DBA_ID_GET2_3 DBA_ID_PARS; DBA_GET2_3; DBA_ID_GET
-#define DBA_ID_GET3 DBA_ID_PARS; DBA_GET3; DBA_ID_GET
-
-#define DBA_ID_DONE \
- if (key_free) efree(key_free)
-/* a DBA handler must have specific routines */
-
-#define DBA_NAMED_HND(alias, name, flags) \
-{\
- #alias, flags, dba_open_##name, dba_close_##name, dba_fetch_##name, dba_update_##name, \
- dba_exists_##name, dba_delete_##name, dba_firstkey_##name, dba_nextkey_##name, \
- dba_optimize_##name, dba_sync_##name, dba_info_##name \
-},
-
-#define DBA_HND(name, flags) DBA_NAMED_HND(name, name, flags)
-
-/* check whether the user has write access */
-#define DBA_WRITE_CHECK \
- if(info->mode != DBA_WRITER && info->mode != DBA_TRUNC && info->mode != DBA_CREAT) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You cannot perform a modification to a database without proper access"); \
- RETURN_FALSE; \
- }
-
-/* }}} */
-
-/* {{{ globals */
-
-static dba_handler handler[] = {
-#if DBA_GDBM
- DBA_HND(gdbm, DBA_LOCK_EXT) /* Locking done in library if set */
-#endif
-#if DBA_DBM
- DBA_HND(dbm, DBA_LOCK_ALL) /* No lock in lib */
-#endif
-#if DBA_NDBM
- DBA_HND(ndbm, DBA_LOCK_ALL) /* Could be done in library: filemode = 0644 + S_ENFMT */
-#endif
-#if DBA_CDB
- DBA_HND(cdb, DBA_STREAM_OPEN|DBA_LOCK_ALL) /* No lock in lib */
-#endif
-#if DBA_CDB_BUILTIN
- DBA_NAMED_HND(cdb_make, cdb, DBA_STREAM_OPEN|DBA_LOCK_ALL) /* No lock in lib */
-#endif
-#if DBA_DB2
- DBA_HND(db2, DBA_LOCK_ALL) /* No lock in lib */
-#endif
-#if DBA_DB3
- DBA_HND(db3, DBA_LOCK_ALL) /* No lock in lib */
-#endif
-#if DBA_DB4
- DBA_HND(db4, DBA_LOCK_ALL) /* No lock in lib */
-#endif
-#if DBA_INIFILE
- DBA_HND(inifile, DBA_STREAM_OPEN|DBA_LOCK_ALL) /* No lock in lib */
-#endif
-#if DBA_FLATFILE
- DBA_HND(flatfile, DBA_STREAM_OPEN|DBA_LOCK_ALL) /* No lock in lib */
-#endif
- { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
-};
-
-#if DBA_FLATFILE
-#define DBA_DEFAULT "flatfile"
-#elif DBA_DB4
-#define DBA_DEFAULT "db4"
-#elif DBA_DB3
-#define DBA_DEFAULT "db3"
-#elif DBA_DB2
-#define DBA_DEFAULT "db2"
-#elif DBA_GDBM
-#define DBA_DEFAULT "gdbm"
-#elif DBA_NBBM
-#define DBA_DEFAULT "ndbm"
-#elif DBA_DBM
-#define DBA_DEFAULT "dbm"
-#else
-#define DBA_DEFAULT ""
-#endif
-/* cdb/cdb_make and ini are no option here */
-
-ZEND_BEGIN_MODULE_GLOBALS(dba)
- char *default_handler;
- dba_handler *default_hptr;
-ZEND_END_MODULE_GLOBALS(dba)
-
-ZEND_DECLARE_MODULE_GLOBALS(dba)
-
-#ifdef ZTS
-#define DBA_G(v) TSRMG(dba_globals_id, zend_dba_globals *, v)
-#else
-#define DBA_G(v) (dba_globals.v)
-#endif
-
-static int le_db;
-static int le_pdb;
-
-/* {{{ dba_fetch_resource
-PHPAPI void dba_fetch_resource(dba_info **pinfo, zval **id TSRMLS_DC)
-{
- dba_info *info;
- DBA_ID_FETCH
- *pinfo = info;
-}
-*/
-/* }}} */
-
-/* {{{ dba_get_handler
-PHPAPI dba_handler *dba_get_handler(const char* handler_name)
-{
- dba_handler *hptr;
- for (hptr = handler; hptr->name && strcasecmp(hptr->name, handler_name); hptr++);
- return hptr;
-}
-*/
-/* }}} */
-
-/* {{{ dba_close
- */
-static void dba_close(dba_info *info TSRMLS_DC)
-{
- if (info->hnd) {
- info->hnd->close(info TSRMLS_CC);
- }
- if (info->path) {
- pefree(info->path, info->flags&DBA_PERSISTENT);
- }
- if (info->fp && info->fp!=info->lock.fp) {
- php_stream_close(info->fp);
- }
- if (info->lock.fp) {
- php_stream_close(info->lock.fp);
- }
- if (info->lock.name) {
- pefree(info->lock.name, info->flags&DBA_PERSISTENT);
- }
- pefree(info, info->flags&DBA_PERSISTENT);
-}
-/* }}} */
-
-/* {{{ dba_close_rsrc
- */
-static void dba_close_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- dba_info *info = (dba_info *)rsrc->ptr;
-
- dba_close(info TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ dba_close_pe_rsrc_deleter */
-int dba_close_pe_rsrc_deleter(list_entry *le, void *pDba TSRMLS_DC)
-{
- return le->ptr == pDba;
-}
-/* }}} */
-
-/* {{{ dba_close_pe_rsrc */
-static void dba_close_pe_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- dba_info *info = (dba_info *)rsrc->ptr;
-
- /* closes the resource by calling dba_close_rsrc() */
- zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) dba_close_pe_rsrc_deleter, info TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ PHP_INI
- */
-ZEND_INI_MH(OnUpdateDefaultHandler)
-{
- dba_handler *hptr;
-
- if (!strlen(new_value)) {
- DBA_G(default_hptr) = NULL;
- return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
- }
-
- for (hptr = handler; hptr->name && strcasecmp(hptr->name, new_value); hptr++);
-
- if (!hptr->name) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such handler: %s", new_value);
- return FAILURE;
- }
- DBA_G(default_hptr) = hptr;
- return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
-}
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("dba.default_handler", DBA_DEFAULT, PHP_INI_ALL, OnUpdateDefaultHandler, default_handler, zend_dba_globals, dba_globals)
-PHP_INI_END()
-/* }}} */
-
-/* {{{ php_dba_init_globals
- */
-static void php_dba_init_globals(zend_dba_globals *dba_globals)
-{
- dba_globals->default_handler = "";
- dba_globals->default_hptr = NULL;
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(dba)
-{
- ZEND_INIT_MODULE_GLOBALS(dba, php_dba_init_globals, NULL);
- REGISTER_INI_ENTRIES();
- le_db = zend_register_list_destructors_ex(dba_close_rsrc, NULL, "dba", module_number);
- le_pdb = zend_register_list_destructors_ex(dba_close_pe_rsrc, dba_close_rsrc, "dba persistent", module_number);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(dba)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-/* }}} */
-
-#include "ext/standard/php_smart_str.h"
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(dba)
-{
- dba_handler *hptr;
- smart_str handlers = {0};
-
- for(hptr = handler; hptr->name; hptr++) {
- smart_str_appends(&handlers, hptr->name);
- smart_str_appendc(&handlers, ' ');
- }
-
- php_info_print_table_start();
- php_info_print_table_row(2, "DBA support", "enabled");
- if (handlers.c) {
- smart_str_0(&handlers);
- php_info_print_table_row(2, "Supported handlers", handlers.c);
- smart_str_free(&handlers);
- } else {
- php_info_print_table_row(2, "Supported handlers", "none");
- }
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ php_dba_update
- */
-static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- char *v;
- int len;
- DBA_ID_GET3;
-
- DBA_WRITE_CHECK;
-
- if (PG(magic_quotes_runtime)) {
- len = Z_STRLEN_PP(val);
- v = estrndup(Z_STRVAL_PP(val), len);
- php_stripslashes(v, &len TSRMLS_CC);
- if(info->hnd->update(info, key_str, key_len, v, len, mode TSRMLS_CC) == SUCCESS) {
- efree(v);
- DBA_ID_DONE;
- RETURN_TRUE;
- }
- efree(v);
- } else {
- if(info->hnd->update(info, key_str, key_len, VALLEN(val), mode TSRMLS_CC) == SUCCESS)
- {
- DBA_ID_DONE;
- RETURN_TRUE;
- }
- }
- DBA_ID_DONE;
- RETURN_FALSE;
-}
-/* }}} */
-
-#define FREENOW if(args) efree(args); if(key) efree(key)
-
-/* {{{ php_find_dbm
- */
-dba_info *php_dba_find(const char* path TSRMLS_DC)
-{
- list_entry *le;
- dba_info *info;
- int numitems, i;
-
- numitems = zend_hash_next_free_element(&EG(regular_list));
- for (i=1; i<numitems; i++) {
- if (zend_hash_index_find(&EG(regular_list), i, (void **) &le)==FAILURE) {
- continue;
- }
- if (Z_TYPE_P(le) == le_db || Z_TYPE_P(le) == le_pdb) {
- info = (dba_info *)(le->ptr);
- if (!strcmp(info->path, path)) {
- return (dba_info *)(le->ptr);
- }
- }
- }
-
- return NULL;
-}
-/* }}} */
-
-/* {{{ php_dba_open
- */
-static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- zval ***args = (zval ***) NULL;
- int ac = ZEND_NUM_ARGS();
- dba_mode_t modenr;
- dba_info *info, *other;
- dba_handler *hptr;
- char *key = NULL, *error = NULL;
- int keylen = 0;
- int i;
- int lock_mode, lock_flag, lock_dbf = 0;
- char *file_mode;
- char mode[4], *pmode, *lock_file_mode = NULL;
- int persistent_flag = persistent ? STREAM_OPEN_PERSISTENT : 0;
-
- if(ac < 2) {
- WRONG_PARAM_COUNT;
- }
-
- /* we pass additional args to the respective handler */
- args = safe_emalloc(ac, sizeof(zval *), 0);
- if (zend_get_parameters_array_ex(ac, args) != SUCCESS) {
- FREENOW;
- WRONG_PARAM_COUNT;
- }
-
- /* we only take string arguments */
- for (i = 0; i < ac; i++) {
- convert_to_string_ex(args[i]);
- keylen += Z_STRLEN_PP(args[i]);
- }
-
- if (persistent) {
- list_entry *le;
-
- /* calculate hash */
- key = safe_emalloc(keylen, 1, 1);
- key[keylen] = '\0';
- keylen = 0;
-
- for(i = 0; i < ac; i++) {
- memcpy(key+keylen, Z_STRVAL_PP(args[i]), Z_STRLEN_PP(args[i]));
- keylen += Z_STRLEN_PP(args[i]);
- }
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), key, keylen+1, (void **) &le) == SUCCESS) {
- FREENOW;
-
- if (Z_TYPE_P(le) != le_pdb) {
- RETURN_FALSE;
- }
-
- info = (dba_info *)le->ptr;
-
- ZEND_REGISTER_RESOURCE(return_value, info, le_pdb);
- return;
- }
- }
-
- if (ac==2) {
- hptr = DBA_G(default_hptr);
- if (!hptr) {
- php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "No default handler selected");
- FREENOW;
- RETURN_FALSE;
- }
- } else {
- for (hptr = handler; hptr->name && strcasecmp(hptr->name, Z_STRVAL_PP(args[2])); hptr++);
- }
-
- if (!hptr->name) {
- php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "No such handler: %s", Z_STRVAL_PP(args[2]));
- FREENOW;
- RETURN_FALSE;
- }
-
- /* Check mode: [rwnc][fl]?t?
- * r: Read
- * w: Write
- * n: Create/Truncate
- * c: Create
- *
- * d: force lock on database file
- * l: force lock on lck file
- * -: ignore locking
- *
- * t: test open database, warning if locked
- */
- strlcpy(mode, Z_STRVAL_PP(args[1]), sizeof(mode));
- pmode = &mode[0];
- if (pmode[0] && (pmode[1]=='d' || pmode[1]=='l' || pmode[1]=='-')) { /* force lock on db file or lck file or disable locking */
- switch (pmode[1]) {
- case 'd':
- lock_dbf = 1;
- if ((hptr->flags & DBA_LOCK_ALL) == 0) {
- lock_flag = (hptr->flags & DBA_LOCK_ALL);
- break;
- }
- /* no break */
- case 'l':
- lock_flag = DBA_LOCK_ALL;
- if ((hptr->flags & DBA_LOCK_ALL) == 0) {
- php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_NOTICE, "Handler %s does locking internally", hptr->name);
- }
- break;
- default:
- case '-':
- if ((hptr->flags & DBA_LOCK_ALL) == 0) {
- php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Locking cannot be disabled for handler %s", hptr->name);
- FREENOW;
- RETURN_FALSE;
- }
- lock_flag = 0;
- break;
- }
- } else {
- lock_flag = (hptr->flags&DBA_LOCK_ALL);
- lock_dbf = 1;
- }
- switch (*pmode++) {
- case 'r':
- modenr = DBA_READER;
- lock_mode = (lock_flag & DBA_LOCK_READER) ? LOCK_SH : 0;
- file_mode = "r";
- break;
- case 'w':
- modenr = DBA_WRITER;
- lock_mode = (lock_flag & DBA_LOCK_WRITER) ? LOCK_EX : 0;
- file_mode = "r+b";
- break;
- case 'n':
- modenr = DBA_TRUNC;
- lock_mode = (lock_flag & DBA_LOCK_TRUNC) ? LOCK_EX : 0;
- file_mode = "w+b";
- break;
- case 'c':
- modenr = DBA_CREAT;
- lock_mode = (lock_flag & DBA_LOCK_CREAT) ? LOCK_EX : 0;
- file_mode = "a+b";
- break;
- default:
- modenr = 0;
- lock_mode = 0;
- file_mode = "";
- }
- if (*pmode=='d' || *pmode=='l' || *pmode=='-') {
- pmode++; /* done already - skip here */
- }
- if (*pmode=='t') {
- pmode++;
- if (!lock_flag) {
- php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "You cannot combine modifiers - (no lock) and t (test lock)", hptr->name);
- FREENOW;
- RETURN_FALSE;
- }
- if (!lock_mode) {
- if ((hptr->flags & DBA_LOCK_ALL) == 0) {
- php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Handler %s uses its own locking which doesn't support mode modifier t (test lock)", hptr->name);
- FREENOW;
- RETURN_FALSE;
- } else {
- php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Handler %s doesn't uses locking for this mode which makes modifier t (test lock) obsolete", hptr->name);
- FREENOW;
- RETURN_FALSE;
- }
- } else {
- lock_mode |= LOCK_NB; /* test =: non blocking */
- }
- }
- if (*pmode || !modenr) {
- php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Illegal DBA mode");
- FREENOW;
- RETURN_FALSE;
- }
-
- info = pemalloc(sizeof(dba_info), persistent);
- memset(info, 0, sizeof(dba_info));
- info->path = pestrdup(Z_STRVAL_PP(args[0]), persistent);
- info->mode = modenr;
- info->argc = ac - 3;
- info->argv = args + 3;
- info->flags = (hptr->flags & ~DBA_LOCK_ALL) | (lock_flag & DBA_LOCK_ALL) | (persistent ? DBA_PERSISTENT : 0);
- info->lock.mode = lock_mode;
-
- /* if any open call is a locking call:
- * check if we already habe a locking call open that should block this call
- * the problem is some systems would allow read during write
- */
- if (hptr->flags & DBA_LOCK_ALL) {
- if ((other = php_dba_find(info->path TSRMLS_CC)) != NULL) {
- if ( ( (lock_mode&LOCK_EX) && (other->lock.mode&(LOCK_EX|LOCK_SH)) )
- || ( (other->lock.mode&LOCK_EX) && (lock_mode&(LOCK_EX|LOCK_SH)) )
- ) {
- error = "Unable to establish lock (database file already open)"; /* force failure exit */
- }
- }
- }
-
- if (!error && lock_mode) {
- if (lock_dbf) {
- info->lock.name = pestrdup(info->path, persistent);
- lock_file_mode = file_mode;
- } else {
- spprintf(&info->lock.name, 0, "%s.lck", info->path);
- if (!strcmp(file_mode, "r")) {
- /* when in read only mode try to use existing .lck file first */
- /* do not log errors for .lck file while in read ony mode on .lck file */
- lock_file_mode = "rb";
- info->lock.fp = php_stream_open_wrapper(info->lock.name, lock_file_mode, STREAM_MUST_SEEK|IGNORE_PATH|ENFORCE_SAFE_MODE|persistent_flag, NULL);
- }
- if (!info->lock.fp) {
- /* when not in read mode or failed to open .lck file read only. now try again in create(write) mode and log errors */
- lock_file_mode = "a+b";
- }
- }
- if (!info->lock.fp) {
- info->lock.fp = php_stream_open_wrapper(info->lock.name, lock_file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE|persistent_flag, NULL);
- }
- if (!info->lock.fp) {
- dba_close(info TSRMLS_CC);
- /* stream operation already wrote an error message */
- FREENOW;
- RETURN_FALSE;
- }
- if (!php_stream_supports_lock(info->lock.fp)) {
- error = "Stream does not support locking";
- }
- if (php_stream_lock(info->lock.fp, lock_mode)) {
- error = "Unable to establish lock"; /* force failure exit */
- }
- }
-
- /* centralised open stream for builtin */
- if (!error && (hptr->flags&DBA_STREAM_OPEN)==DBA_STREAM_OPEN) {
- if (info->lock.fp && lock_dbf) {
- info->fp = info->lock.fp; /* use the same stream for locking and database access */
- } else {
- info->fp = php_stream_open_wrapper(info->path, file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE|persistent_flag, NULL);
- }
- if (!info->fp) {
- dba_close(info TSRMLS_CC);
- /* stream operation already wrote an error message */
- FREENOW;
- RETURN_FALSE;
- }
- }
-
- if (error || hptr->open(info, &error TSRMLS_CC) != SUCCESS) {
- dba_close(info TSRMLS_CC);
- php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Driver initialization failed for handler: %s%s%s", hptr->name, error?": ":"", error?error:"");
- FREENOW;
- RETURN_FALSE;
- }
-
- info->hnd = hptr;
- info->argc = 0;
- info->argv = NULL;
-
- if (persistent) {
- list_entry new_le;
-
- Z_TYPE(new_le) = le_pdb;
- new_le.ptr = info;
- if (zend_hash_update(&EG(persistent_list), key, keylen+1, &new_le, sizeof(list_entry), NULL) == FAILURE) {
- dba_close(info TSRMLS_CC);
- php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Could not register persistent resource");
- FREENOW;
- RETURN_FALSE;
- }
- }
-
- ZEND_REGISTER_RESOURCE(return_value, info, (persistent ? le_pdb : le_db));
- FREENOW;
-}
-/* }}} */
-#undef FREENOW
-
-/* {{{ proto int dba_popen(string path, string mode [, string handlername, string ...])
- Opens path using the specified handler in mode persistently */
-PHP_FUNCTION(dba_popen)
-{
- php_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int dba_open(string path, string mode [, string handlername, string ...])
- Opens path using the specified handler in mode*/
-PHP_FUNCTION(dba_open)
-{
- php_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto void dba_close(resource handle)
- Closes database */
-PHP_FUNCTION(dba_close)
-{
- DBA_ID_GET1;
-
- zend_list_delete(Z_RESVAL_PP(id));
-}
-/* }}} */
-
-/* {{{ proto bool dba_exists(string key, int handle)
- Checks, if the specified key exists */
-PHP_FUNCTION(dba_exists)
-{
- DBA_ID_GET2;
-
- if(info->hnd->exists(info, key_str, key_len TSRMLS_CC) == SUCCESS) {
- DBA_ID_DONE;
- RETURN_TRUE;
- }
- DBA_ID_DONE;
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string dba_fetch(string key, [int skip ,] int handle)
- Fetches the data associated with key */
-PHP_FUNCTION(dba_fetch)
-{
- char *val;
- int len = 0;
- DBA_ID_GET2_3;
-
- if (ac==3) {
- if (!strcmp(info->hnd->name, "cdb")) {
- if (skip < 0) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Handler %s accepts only skip values greater than or equal to zero, using skip=0", info->hnd->name);
- skip = 0;
- }
- } else if (!strcmp(info->hnd->name, "inifile")) {
- /* "-1" is compareable to 0 but allows a non restrictive
- * access which is fater. For example 'inifile' uses this
- * to allow faster access when the key was already found
- * using firstkey/nextkey. However explicitly setting the
- * value to 0 ensures the first value.
- */
- if (skip < -1) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Handler %s accepts only skip value -1 and greater, using skip=0", info->hnd->name);
- skip = 0;
- }
- } else {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Handler %s does not support optional skip parameter, the value will be ignored", info->hnd->name);
- skip = 0;
- }
- } else {
- skip = 0;
- }
- if((val = info->hnd->fetch(info, key_str, key_len, skip, &len TSRMLS_CC)) != NULL) {
- if (val && PG(magic_quotes_runtime)) {
- val = php_addslashes(val, len, &len, 1 TSRMLS_CC);
- }
- DBA_ID_DONE;
- RETURN_STRINGL(val, len, 0);
- }
- DBA_ID_DONE;
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string dba_firstkey(int handle)
- Resets the internal key pointer and returns the first key */
-PHP_FUNCTION(dba_firstkey)
-{
- char *fkey;
- int len;
- DBA_ID_GET1;
-
- fkey = info->hnd->firstkey(info, &len TSRMLS_CC);
- if(fkey)
- RETURN_STRINGL(fkey, len, 0);
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string dba_nextkey(int handle)
- Returns the next key */
-PHP_FUNCTION(dba_nextkey)
-{
- char *nkey;
- int len;
- DBA_ID_GET1;
-
- nkey = info->hnd->nextkey(info, &len TSRMLS_CC);
- if(nkey)
- RETURN_STRINGL(nkey, len, 0);
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool dba_delete(string key, int handle)
- Deletes the entry associated with key
- If inifile: remove all other key lines */
-PHP_FUNCTION(dba_delete)
-{
- DBA_ID_GET2;
-
- DBA_WRITE_CHECK;
-
- if(info->hnd->delete(info, key_str, key_len TSRMLS_CC) == SUCCESS)
- {
- DBA_ID_DONE;
- RETURN_TRUE;
- }
- DBA_ID_DONE;
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool dba_insert(string key, string value, int handle)
- If not inifile: Insert value as key, return false, if key exists already
- If inifile: Add vakue as key (next instance of key) */
-PHP_FUNCTION(dba_insert)
-{
- php_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto bool dba_replace(string key, string value, int handle)
- Inserts value as key, replaces key, if key exists already
- If inifile: remove all other key lines */
-PHP_FUNCTION(dba_replace)
-{
- php_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto bool dba_optimize(int handle)
- Optimizes (e.g. clean up, vacuum) database */
-PHP_FUNCTION(dba_optimize)
-{
- DBA_ID_GET1;
-
- DBA_WRITE_CHECK;
- if(info->hnd->optimize(info TSRMLS_CC) == SUCCESS) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool dba_sync(int handle)
- Synchronizes database */
-PHP_FUNCTION(dba_sync)
-{
- DBA_ID_GET1;
-
- if(info->hnd->sync(info TSRMLS_CC) == SUCCESS) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array dba_handlers([bool full_info])
- List configured databases */
-PHP_FUNCTION(dba_handlers)
-{
- dba_handler *hptr;
- zend_bool full_info = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &full_info) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- for(hptr = handler; hptr->name; hptr++) {
- if (full_info) {
- add_assoc_string(return_value, hptr->name, hptr->info(hptr, NULL TSRMLS_CC), 0);
- } else {
- add_next_index_string(return_value, hptr->name, 1);
- }
- }
-}
-/* }}} */
-
-/* {{{ proto array dba_list()
- List configured databases */
-PHP_FUNCTION(dba_list)
-{
- ulong numitems, i;
- zend_rsrc_list_entry *le;
- dba_info *info;
-
- if (ZEND_NUM_ARGS()!=0) {
- ZEND_WRONG_PARAM_COUNT();
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- numitems = zend_hash_next_free_element(&EG(regular_list));
- for (i=1; i<numitems; i++) {
- if (zend_hash_index_find(&EG(regular_list), i, (void **) &le)==FAILURE) {
- continue;
- }
- if (Z_TYPE_P(le) == le_db || Z_TYPE_P(le) == le_pdb) {
- info = (dba_info *)(le->ptr);
- add_index_string(return_value, i, info->path, 1);
- }
- }
-}
-/* }}} */
-
-#endif /* HAVE_DBA */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dba/dba.dsp b/ext/dba/dba.dsp
deleted file mode 100644
index 063d4e3ba2..0000000000
--- a/ext/dba/dba.dsp
+++ /dev/null
@@ -1,197 +0,0 @@
-# Microsoft Developer Studio Project File - Name="dba" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=dba - Win32 Debug_TS Berkeley DB3
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "dba.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "dba.mak" CFG="dba - Win32 Debug_TS Berkeley DB3"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "dba - Win32 Release_TS Berkeley DB3" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dba - Win32 Debug_TS Berkeley DB3" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "dba - Win32 Release_TS Berkeley DB3"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D DBA_DB3=1 /D DB3_INCLUDE_FILE="db.h" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D DBA_DB3=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D DBA_FLATFILE=1 /D DBA_CDB=1 /D DBA_CDB_MAKE=1 /D DBA_CDB_BUILTIN=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts.lib libdb31s.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dba.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 php4ts.lib libdb31s.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dba.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "dba - Win32 Debug_TS Berkeley DB3"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D "DBA_DB3" /D DB3_INCLUDE_FILE="db.h" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "DBA_DB3" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D DBA_FLATFILE=1 /D DBA_CDB=1 /D DBA_CDB_MAKE=1 /D DBA_CDB_BUILTIN=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_dba.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_dba.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "dba - Win32 Release_TS Berkeley DB3"
-# Name "dba - Win32 Debug_TS Berkeley DB3"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\libcdb\cdb.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libcdb\cdb_make.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_cdb.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_db2.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_db3.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_dbm.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_flatfile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_gdbm.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_ndbm.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libflatfile\flatfile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libcdb\uint32.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\libcdb\cdb.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libcdb\cdb_make.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libflatfile\flatfile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_cdb.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_db2.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_db3.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_dba.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_dbm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_flatfile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_gdbm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_ndbm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libcdb\uint32.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/dba/dba_cdb.c b/ext/dba/dba_cdb.c
deleted file mode 100644
index b6f1c5e8dc..0000000000
--- a/ext/dba/dba_cdb.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- | Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if DBA_CDB
-#include "php_cdb.h"
-
-#include <sys/types.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <fcntl.h>
-
-#if DBA_CDB_BUILTIN
-# include "libcdb/cdb.h"
-# include "libcdb/cdb_make.h"
-# include "libcdb/uint32.h"
-#else
-# ifdef CDB_INCLUDE_FILE
-# include CDB_INCLUDE_FILE
-# endif
-#endif
-
-#define CDB_INFO \
- dba_cdb *cdb = (dba_cdb *) info->dbf
-
-typedef struct {
- struct cdb c;
-#if DBA_CDB_BUILTIN
- struct cdb_make m;
- php_stream *file;
- int make;
-#else
- int file;
-#endif
- uint32 eod; /* size of constant database */
- uint32 pos; /* current position for traversing */
-} dba_cdb;
-
-DBA_OPEN_FUNC(cdb)
-{
-#if DBA_CDB_BUILTIN
- php_stream* file = 0;
- int make;
-#else
- int file = 0;
-#endif
- dba_cdb *cdb;
- dba_info *pinfo = (dba_info *) info;
-
- switch (info->mode) {
- case DBA_READER:
-#if DBA_CDB_BUILTIN
- make = 0;
- file = info->fp;
-#else
- file = VCWD_OPEN(info->path, O_RDONLY);
- if (file < 0) {
- *error = "Unable to open file";
- return FAILURE;
- }
-#endif
- break;
-#if DBA_CDB_BUILTIN
- case DBA_TRUNC:
- make = 1;
- file = info->fp;
- break;
- case DBA_CREAT:
- case DBA_WRITER:
- *error = "Update operations are not supported";
- return FAILURE; /* not supported */
-#endif
- default:
- *error = "Currently not supported";
- return FAILURE;
- }
-
- cdb = pemalloc(sizeof(dba_cdb), info->flags&DBA_PERSISTENT);
- memset(cdb, 0, sizeof(dba_cdb));
-
-#if DBA_CDB_BUILTIN
- if (make) {
- cdb_make_start(&cdb->m, file TSRMLS_CC);
- } else {
- cdb_init(&cdb->c, file TSRMLS_CC);
- }
- cdb->make = make;
-#else
- cdb_init(&cdb->c, file);
-#endif
- cdb->file = file;
-
- pinfo->dbf = cdb;
- return SUCCESS;
-}
-
-DBA_CLOSE_FUNC(cdb)
-{
- CDB_INFO;
-
- /* cdb_free does not close associated file */
-#if DBA_CDB_BUILTIN
- if (cdb->make) {
- cdb_make_finish(&cdb->m TSRMLS_CC);
- } else {
- cdb_free(&cdb->c TSRMLS_CC);
- }
-#else
- cdb_free(&cdb->c);
- close(cdb->file);
-#endif
- pefree(cdb, info->flags&DBA_PERSISTENT);
-}
-
-#if DBA_CDB_BUILTIN
-# define php_cdb_read(cdb, buf, len, pos) cdb_read(cdb, buf, len, pos TSRMLS_CC)
-# define php_cdb_findnext(cdb, key, len) cdb_findnext(cdb, key, len TSRMLS_CC)
-# define php_cdb_find(cdb, key, len) cdb_find(cdb, key, len TSRMLS_CC)
-#else
-# define php_cdb_read(cdb, buf, len, pos) cdb_read(cdb, buf, len, pos)
-# define php_cdb_findnext(cdb, key, len) cdb_findnext(cdb, key, len)
-# define php_cdb_find(cdb, key, len) cdb_find(cdb, key, len)
-#endif
-
-DBA_FETCH_FUNC(cdb)
-{
- CDB_INFO;
- unsigned int len;
- char *new_entry = NULL;
-
-#if DBA_CDB_BUILTIN
- if (cdb->make)
- return NULL; /* database was opened writeonly */
-#endif
- if (php_cdb_find(&cdb->c, key, keylen) == 1) {
- while(skip--) {
- if (php_cdb_findnext(&cdb->c, key, keylen) != 1) {
- return NULL;
- }
- }
- len = cdb_datalen(&cdb->c);
- new_entry = safe_emalloc(len, 1, 1);
-
- if (php_cdb_read(&cdb->c, new_entry, len, cdb_datapos(&cdb->c)) == -1) {
- efree(new_entry);
- return NULL;
- }
- new_entry[len] = 0;
- if (newlen)
- *newlen = len;
- }
-
- return new_entry;
-}
-
-DBA_UPDATE_FUNC(cdb)
-{
-#if DBA_CDB_BUILTIN
- CDB_INFO;
-
- if (!cdb->make)
- return FAILURE; /* database was opened readonly */
- if (!mode)
- return FAILURE; /* cdb_make dosn't know replace */
- if (cdb_make_add(&cdb->m, key, keylen, val, vallen TSRMLS_CC) != -1)
- return SUCCESS;
-#endif
- return FAILURE;
-}
-
-DBA_EXISTS_FUNC(cdb)
-{
- CDB_INFO;
-
-#if DBA_CDB_BUILTIN
- if (cdb->make)
- return FAILURE; /* database was opened writeonly */
-#endif
- if (php_cdb_find(&cdb->c, key, keylen) == 1)
- return SUCCESS;
- return FAILURE;
-}
-
-DBA_DELETE_FUNC(cdb)
-{
- return FAILURE; /* cdb doesn't support delete */
-}
-
-/* {{{ cdb_file_read */
-#if DBA_CDB_BUILTIN
-# define cdb_file_read(fildes, buf, size) php_stream_read(fildes, buf, size)
-#else
-# define cdb_file_read(fildes, buf, size) read(fildes, buf, size)
-#endif
-/* }}} */
-
-#define CREAD(n) do { \
- if (cdb_file_read(cdb->file, buf, n) < n) return NULL; \
-} while (0)
-
-/* {{{ cdb_file_lseek
- php_stream_seek does not return actual position */
-#if DBA_CDB_BUILTIN
-int cdb_file_lseek(php_stream *fp, off_t offset, int whence TSRMLS_DC) {
- php_stream_seek(fp, offset, whence);
- return php_stream_tell(fp);
-}
-#else
-int cdb_file_lseek(int fd, off_t offset, int whence TSRMLS_DC) {
- return lseek(fd, offset, whence);
-}
-#endif
-/* }}} */
-
-#define CSEEK(n) do { \
- if (n >= cdb->eod) return NULL; \
- if (cdb_file_lseek(cdb->file, (off_t)n, SEEK_SET TSRMLS_CC) != (off_t) n) return NULL; \
-} while (0)
-
-
-DBA_FIRSTKEY_FUNC(cdb)
-{
- CDB_INFO;
- uint32 klen, dlen;
- char buf[8];
- char *key;
-
-#if DBA_CDB_BUILTIN
- if (cdb->make)
- return NULL; /* database was opened writeonly */
-#endif
-
- cdb->eod = -1;
- CSEEK(0);
- CREAD(4);
-
- /* Total length of file in bytes */
- uint32_unpack(buf, &cdb->eod);
-
- CSEEK(2048);
- CREAD(8);
-
- /* The first four bytes contain the length of the key */
- uint32_unpack(buf, &klen);
- uint32_unpack(buf + 4, &dlen);
-
- key = safe_emalloc(klen, 1, 1);
- if (cdb_file_read(cdb->file, key, klen) < klen) {
- efree(key);
- key = NULL;
- } else {
- key[klen] = '\0';
- if (newlen) *newlen = klen;
- }
-
- /* header + klenlen + dlenlen + klen + dlen */
- cdb->pos = 2048 + 4 + 4 + klen + dlen;
-
- return key;
-}
-
-DBA_NEXTKEY_FUNC(cdb)
-{
- CDB_INFO;
- uint32 klen, dlen;
- char buf[8];
- char *key;
-
-#if DBA_CDB_BUILTIN
- if (cdb->make)
- return NULL; /* database was opened writeonly */
-#endif
-
- CSEEK(cdb->pos);
- CREAD(8);
- uint32_unpack(buf, &klen);
- uint32_unpack(buf + 4, &dlen);
-
- key = safe_emalloc(klen, 1, 1);
- if (cdb_file_read(cdb->file, key, klen) < klen) {
- efree(key);
- key = NULL;
- } else {
- key[klen] = '\0';
- if (newlen) *newlen = klen;
- }
-
- cdb->pos += 8 + klen + dlen;
-
- return key;
-}
-
-DBA_OPTIMIZE_FUNC(cdb)
-{
- return SUCCESS;
-}
-
-DBA_SYNC_FUNC(cdb)
-{
- /* this is read-only */
- return SUCCESS;
-}
-
-DBA_INFO_FUNC(cdb)
-{
-#if DBA_CDB_BUILTIN
- if (!strcmp(hnd->name, "cdb")) {
- return estrdup(cdb_version());
- } else {
- return estrdup(cdb_make_version());
- }
-#else
- return estrdup("External");
-#endif
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dba/dba_db2.c b/ext/dba/dba_db2.c
deleted file mode 100644
index 9ef28a7a66..0000000000
--- a/ext/dba/dba_db2.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if DBA_DB2
-#include "php_db2.h"
-#include <sys/stat.h>
-
-#include <string.h>
-#ifdef DB2_INCLUDE_FILE
-#include DB2_INCLUDE_FILE
-#endif
-
-#define DB2_DATA dba_db2_data *dba = info->dbf
-#define DB2_GKEY \
- DBT gkey = {0}; \
- gkey.data = (char *) key; \
- gkey.size = keylen
-
-typedef struct {
- DB *dbp;
- DBC *cursor;
-} dba_db2_data;
-
-DBA_OPEN_FUNC(db2)
-{
- DB *dbp;
- DBTYPE type;
- int gmode = 0;
- int filemode = 0644;
- struct stat check_stat;
- int s = VCWD_STAT(info->path, &check_stat);
-
- type = info->mode == DBA_READER ? DB_UNKNOWN :
- info->mode == DBA_TRUNC ? DB_BTREE :
- s ? DB_BTREE : DB_UNKNOWN;
-
- gmode = info->mode == DBA_READER ? DB_RDONLY :
- (info->mode == DBA_CREAT && s) ? DB_CREATE :
- (info->mode == DBA_CREAT && !s) ? 0 :
- info->mode == DBA_WRITER ? 0 :
- info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1;
-
- if (gmode == -1) {
- return FAILURE;/* not possible */
- }
-
- if (info->argc > 0) {
- convert_to_long_ex(info->argv[0]);
- filemode = Z_LVAL_PP(info->argv[0]);
- }
-
- if (db_open(info->path, type, gmode, filemode, NULL, NULL, &dbp)) {
- return FAILURE;
- }
-
- info->dbf = pemalloc(sizeof(dba_db2_data), info->flags&DBA_PERSISTENT);
- memset(info->dbf, 0, sizeof(dba_db2_data));
- ((dba_db2_data *) info->dbf)->dbp = dbp;
- return SUCCESS;
-}
-
-DBA_CLOSE_FUNC(db2)
-{
- DB2_DATA;
-
- if (dba->cursor)
- dba->cursor->c_close(dba->cursor);
- dba->dbp->close(dba->dbp, 0);
- pefree(dba, info->flags&DBA_PERSISTENT);
-}
-
-DBA_FETCH_FUNC(db2)
-{
- DBT gval = {0};
- DB2_DATA;
- DB2_GKEY;
-
- if (dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
- return NULL;
- }
-
- if (newlen) *newlen = gval.size;
- return estrndup(gval.data, gval.size);
-}
-
-DBA_UPDATE_FUNC(db2)
-{
- DBT gval = {0};
- DB2_DATA;
- DB2_GKEY;
-
- gval.data = (char *) val;
- gval.size = vallen;
-
- if (dba->dbp->put(dba->dbp, NULL, &gkey, &gval,
- mode == 1 ? DB_NOOVERWRITE : 0)) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-DBA_EXISTS_FUNC(db2)
-{
- DBT gval = {0};
- DB2_DATA;
- DB2_GKEY;
-
- if (dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-DBA_DELETE_FUNC(db2)
-{
- DB2_DATA;
- DB2_GKEY;
-
- return dba->dbp->del(dba->dbp, NULL, &gkey, 0) ? FAILURE : SUCCESS;
-}
-
-DBA_FIRSTKEY_FUNC(db2)
-{
- DB2_DATA;
-
- if (dba->cursor) {
- dba->cursor->c_close(dba->cursor);
- dba->cursor = NULL;
- }
-
-#if (DB_VERSION_MAJOR > 2) || (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR > 6) || (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 6 && DB_VERSION_PATCH >= 4)
- if (dba->dbp->cursor(dba->dbp, NULL, &dba->cursor, 0)) {
-#else
- if (dba->dbp->cursor(dba->dbp, NULL, &dba->cursor)) {
-#endif
- return NULL;
- }
-
- /* we should introduce something like PARAM_PASSTHRU... */
- return dba_nextkey_db2(info, newlen TSRMLS_CC);
-}
-
-DBA_NEXTKEY_FUNC(db2)
-{
- DB2_DATA;
- DBT gkey = {0}, gval = {0};
-
- if (dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT)
- || !gkey.data)
- return NULL;
-
- if (newlen) *newlen = gkey.size;
- return estrndup(gkey.data, gkey.size);
-}
-
-DBA_OPTIMIZE_FUNC(db2)
-{
- return SUCCESS;
-}
-
-DBA_SYNC_FUNC(db2)
-{
- DB2_DATA;
-
- return dba->dbp->sync(dba->dbp, 0) ? FAILURE : SUCCESS;
-}
-
-DBA_INFO_FUNC(db2)
-{
- return estrdup(DB_VERSION_STRING);
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dba/dba_db3.c b/ext/dba/dba_db3.c
deleted file mode 100644
index 3d0e892219..0000000000
--- a/ext/dba/dba_db3.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if DBA_DB3
-#include "php_db3.h"
-#include <sys/stat.h>
-
-#include <string.h>
-#ifdef DB3_INCLUDE_FILE
-#include DB3_INCLUDE_FILE
-#else
-#include <db.h>
-#endif
-
-static void php_dba_db3_errcall_fcn(const char *errpfx, char *msg)
-{
- TSRMLS_FETCH();
-
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s%s", errpfx?errpfx:"", msg);
-}
-
-#define DB3_DATA dba_db3_data *dba = info->dbf
-#define DB3_GKEY \
- DBT gkey; \
- memset(&gkey, 0, sizeof(gkey)); \
- gkey.data = (char *) key; gkey.size = keylen
-
-typedef struct {
- DB *dbp;
- DBC *cursor;
-} dba_db3_data;
-
-DBA_OPEN_FUNC(db3)
-{
- DB *dbp = NULL;
- DBTYPE type;
- int gmode = 0, err;
- int filemode = 0644;
- struct stat check_stat;
- int s = VCWD_STAT(info->path, &check_stat);
-
- type = info->mode == DBA_READER ? DB_UNKNOWN :
- info->mode == DBA_TRUNC ? DB_BTREE :
- s? DB_BTREE : DB_UNKNOWN;
-
- gmode = info->mode == DBA_READER ? DB_RDONLY :
- (info->mode == DBA_CREAT && s) ? DB_CREATE :
- (info->mode == DBA_CREAT && !s) ? 0 :
- info->mode == DBA_WRITER ? 0 :
- info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1;
-
- if (gmode == -1) {
- return FAILURE; /* not possible */
- }
-
- if (info->argc > 0) {
- convert_to_long_ex(info->argv[0]);
- filemode = Z_LVAL_PP(info->argv[0]);
- }
-
-#ifdef DB_FCNTL_LOCKING
- gmode |= DB_FCNTL_LOCKING;
-#endif
-
- if ((err=db_create(&dbp, NULL, 0)) == 0) {
- dbp->set_errcall(dbp, php_dba_db3_errcall_fcn);
- if ((err=dbp->open(dbp, info->path, NULL, type, gmode, filemode)) == 0) {
- dba_db3_data *data;
-
- data = pemalloc(sizeof(*data), info->flags&DBA_PERSISTENT);
- data->dbp = dbp;
- data->cursor = NULL;
- info->dbf = data;
-
- return SUCCESS;
- } else {
- dbp->close(dbp, 0);
- *error = db_strerror(err);
- }
- } else {
- *error = db_strerror(err);
- }
-
- return FAILURE;
-}
-
-DBA_CLOSE_FUNC(db3)
-{
- DB3_DATA;
-
- if (dba->cursor) dba->cursor->c_close(dba->cursor);
- dba->dbp->close(dba->dbp, 0);
- pefree(dba, info->flags&DBA_PERSISTENT);
-}
-
-DBA_FETCH_FUNC(db3)
-{
- DBT gval;
- char *new = NULL;
- DB3_DATA;
- DB3_GKEY;
-
- memset(&gval, 0, sizeof(gval));
- if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
- if (newlen) *newlen = gval.size;
- new = estrndup(gval.data, gval.size);
- }
- return new;
-}
-
-DBA_UPDATE_FUNC(db3)
-{
- DBT gval;
- DB3_DATA;
- DB3_GKEY;
-
- memset(&gval, 0, sizeof(gval));
- gval.data = (char *) val;
- gval.size = vallen;
-
- if (!dba->dbp->put(dba->dbp, NULL, &gkey, &gval,
- mode == 1 ? DB_NOOVERWRITE : 0)) {
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_EXISTS_FUNC(db3)
-{
- DBT gval;
- DB3_DATA;
- DB3_GKEY;
-
- memset(&gval, 0, sizeof(gval));
- if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_DELETE_FUNC(db3)
-{
- DB3_DATA;
- DB3_GKEY;
-
- return dba->dbp->del(dba->dbp, NULL, &gkey, 0) ? FAILURE : SUCCESS;
-}
-
-DBA_FIRSTKEY_FUNC(db3)
-{
- DB3_DATA;
-
- if (dba->cursor) {
- dba->cursor->c_close(dba->cursor);
- }
-
- dba->cursor = NULL;
- if (dba->dbp->cursor(dba->dbp, NULL, &dba->cursor, 0) != 0) {
- return NULL;
- }
-
- /* we should introduce something like PARAM_PASSTHRU... */
- return dba_nextkey_db3(info, newlen TSRMLS_CC);
-}
-
-DBA_NEXTKEY_FUNC(db3)
-{
- DB3_DATA;
- DBT gkey, gval;
- char *nkey = NULL;
-
- memset(&gkey, 0, sizeof(gkey));
- memset(&gval, 0, sizeof(gval));
-
- if (dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT) == 0) {
- if (gkey.data) {
- nkey = estrndup(gkey.data, gkey.size);
- if (newlen) *newlen = gkey.size;
- }
- }
-
- return nkey;
-}
-
-DBA_OPTIMIZE_FUNC(db3)
-{
- return SUCCESS;
-}
-
-DBA_SYNC_FUNC(db3)
-{
- DB3_DATA;
-
- return dba->dbp->sync(dba->dbp, 0) ? FAILURE : SUCCESS;
-}
-
-DBA_INFO_FUNC(db3)
-{
- return estrdup(DB_VERSION_STRING);
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dba/dba_db4.c b/ext/dba/dba_db4.c
deleted file mode 100644
index 0195d61400..0000000000
--- a/ext/dba/dba_db4.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if DBA_DB4
-#include "php_db4.h"
-#include <sys/stat.h>
-
-#include <string.h>
-#ifdef DB4_INCLUDE_FILE
-#include DB4_INCLUDE_FILE
-#else
-#include <db.h>
-#endif
-
-static void php_dba_db4_errcall_fcn(const char *errpfx, char *msg)
-{
- TSRMLS_FETCH();
-
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s%s", errpfx?errpfx:"", msg);
-}
-
-#define DB4_DATA dba_db4_data *dba = info->dbf
-#define DB4_GKEY \
- DBT gkey; \
- memset(&gkey, 0, sizeof(gkey)); \
- gkey.data = (char *) key; gkey.size = keylen
-
-typedef struct {
- DB *dbp;
- DBC *cursor;
-} dba_db4_data;
-
-DBA_OPEN_FUNC(db4)
-{
- DB *dbp = NULL;
- DBTYPE type;
- int gmode = 0, err;
- int filemode = 0644;
- struct stat check_stat;
- int s = VCWD_STAT(info->path, &check_stat);
-
- type = info->mode == DBA_READER ? DB_UNKNOWN :
- info->mode == DBA_TRUNC ? DB_BTREE :
- s? DB_BTREE : DB_UNKNOWN;
-
- gmode = info->mode == DBA_READER ? DB_RDONLY :
- (info->mode == DBA_CREAT && s) ? DB_CREATE :
- (info->mode == DBA_CREAT && !s) ? 0 :
- info->mode == DBA_WRITER ? 0 :
- info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1;
-
- if (gmode == -1) {
- return FAILURE; /* not possible */
- }
-
- if (info->argc > 0) {
- convert_to_long_ex(info->argv[0]);
- filemode = Z_LVAL_PP(info->argv[0]);
- }
-
-#ifdef DB_FCNTL_LOCKING
- gmode |= DB_FCNTL_LOCKING;
-#endif
-
- if ((err=db_create(&dbp, NULL, 0)) == 0) {
- dbp->set_errcall(dbp, php_dba_db4_errcall_fcn);
- if (
-#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
- (err=dbp->open(dbp, 0, info->path, NULL, type, gmode, filemode)) == 0) {
-#else
- (err=dbp->open(dbp, info->path, NULL, type, gmode, filemode)) == 0) {
-#endif
- dba_db4_data *data;
-
- data = pemalloc(sizeof(*data), info->flags&DBA_PERSISTENT);
- data->dbp = dbp;
- data->cursor = NULL;
- info->dbf = data;
-
- return SUCCESS;
- } else {
- dbp->close(dbp, 0);
- *error = db_strerror(err);
- }
- } else {
- *error = db_strerror(err);
- }
-
- return FAILURE;
-}
-
-DBA_CLOSE_FUNC(db4)
-{
- DB4_DATA;
-
- if (dba->cursor) dba->cursor->c_close(dba->cursor);
- dba->dbp->close(dba->dbp, 0);
- pefree(dba, info->flags&DBA_PERSISTENT);
-}
-
-DBA_FETCH_FUNC(db4)
-{
- DBT gval;
- char *new = NULL;
- DB4_DATA;
- DB4_GKEY;
-
- memset(&gval, 0, sizeof(gval));
- if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
- if (newlen) *newlen = gval.size;
- new = estrndup(gval.data, gval.size);
- }
- return new;
-}
-
-DBA_UPDATE_FUNC(db4)
-{
- DBT gval;
- DB4_DATA;
- DB4_GKEY;
-
- memset(&gval, 0, sizeof(gval));
- gval.data = (char *) val;
- gval.size = vallen;
-
- if (!dba->dbp->put(dba->dbp, NULL, &gkey, &gval,
- mode == 1 ? DB_NOOVERWRITE : 0)) {
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_EXISTS_FUNC(db4)
-{
- DBT gval;
- DB4_DATA;
- DB4_GKEY;
-
- memset(&gval, 0, sizeof(gval));
- if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_DELETE_FUNC(db4)
-{
- DB4_DATA;
- DB4_GKEY;
-
- return dba->dbp->del(dba->dbp, NULL, &gkey, 0) ? FAILURE : SUCCESS;
-}
-
-DBA_FIRSTKEY_FUNC(db4)
-{
- DB4_DATA;
-
- if (dba->cursor) {
- dba->cursor->c_close(dba->cursor);
- }
-
- dba->cursor = NULL;
- if (dba->dbp->cursor(dba->dbp, NULL, &dba->cursor, 0) != 0) {
- return NULL;
- }
-
- /* we should introduce something like PARAM_PASSTHRU... */
- return dba_nextkey_db4(info, newlen TSRMLS_CC);
-}
-
-DBA_NEXTKEY_FUNC(db4)
-{
- DB4_DATA;
- DBT gkey, gval;
- char *nkey = NULL;
-
- memset(&gkey, 0, sizeof(gkey));
- memset(&gval, 0, sizeof(gval));
-
- if (dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT) == 0) {
- if (gkey.data) {
- nkey = estrndup(gkey.data, gkey.size);
- if (newlen) *newlen = gkey.size;
- }
- }
-
- return nkey;
-}
-
-DBA_OPTIMIZE_FUNC(db4)
-{
- return SUCCESS;
-}
-
-DBA_SYNC_FUNC(db4)
-{
- DB4_DATA;
-
- return dba->dbp->sync(dba->dbp, 0) ? FAILURE : SUCCESS;
-}
-
-DBA_INFO_FUNC(db4)
-{
- return estrdup(DB_VERSION_STRING);
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dba/dba_dbm.c b/ext/dba/dba_dbm.c
deleted file mode 100644
index 06010af589..0000000000
--- a/ext/dba/dba_dbm.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if DBA_DBM
-#include "php_dbm.h"
-
-#ifdef DBM_INCLUDE_FILE
-#include DBM_INCLUDE_FILE
-#endif
-#if DBA_GDBM
-#include "php_gdbm.h"
-#endif
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#define DBM_DATA dba_dbm_data *dba = info->dbf
-#define DBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen
-
-#define TRUNC_IT(extension, mode) \
- snprintf(buf, MAXPATHLEN, "%s" extension, info->path); \
- buf[MAXPATHLEN-1] = '\0'; \
- if((fd = VCWD_OPEN_MODE(buf, O_CREAT | mode | O_WRONLY, filemode)) == -1) \
- return FAILURE; \
- close(fd);
-
-
-typedef struct {
- datum nextkey;
-} dba_dbm_data;
-
-DBA_OPEN_FUNC(dbm)
-{
- int fd;
- int filemode = 0644;
-
- if(info->argc > 0) {
- convert_to_long_ex(info->argv[0]);
- filemode = Z_LVAL_PP(info->argv[0]);
- }
-
- if(info->mode == DBA_TRUNC) {
- char buf[MAXPATHLEN];
-
- /* dbm/ndbm original */
- TRUNC_IT(".pag", O_TRUNC);
- TRUNC_IT(".dir", O_TRUNC);
- }
-
- if(info->mode == DBA_CREAT) {
- char buf[MAXPATHLEN];
-
- TRUNC_IT(".pag", 0);
- TRUNC_IT(".dir", 0);
- }
-
- if(dbminit((char *) info->path) == -1) {
- return FAILURE;
- }
-
- info->dbf = pemalloc(sizeof(dba_dbm_data), info->flags&DBA_PERSISTENT);
- memset(info->dbf, 0, sizeof(dba_dbm_data));
- return SUCCESS;
-}
-
-DBA_CLOSE_FUNC(dbm)
-{
- pefree(info->dbf, info->flags&DBA_PERSISTENT);
- dbmclose();
-}
-
-DBA_FETCH_FUNC(dbm)
-{
- datum gval;
- char *new = NULL;
-
- DBM_GKEY;
- gval = fetch(gkey);
- if(gval.dptr) {
- if(newlen) *newlen = gval.dsize;
- new = estrndup(gval.dptr, gval.dsize);
- }
- return new;
-}
-
-DBA_UPDATE_FUNC(dbm)
-{
- datum gval;
-
- DBM_GKEY;
-
- if (mode == 1) { /* insert */
- gval = fetch(gkey);
- if(gval.dptr) {
- return FAILURE;
- }
- }
-
- gval.dptr = (char *) val;
- gval.dsize = vallen;
-
- return (store(gkey, gval) == -1 ? FAILURE : SUCCESS);
-}
-
-DBA_EXISTS_FUNC(dbm)
-{
- datum gval;
- DBM_GKEY;
-
- gval = fetch(gkey);
- if(gval.dptr) {
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_DELETE_FUNC(dbm)
-{
- DBM_GKEY;
- return(delete(gkey) == -1 ? FAILURE : SUCCESS);
-}
-
-DBA_FIRSTKEY_FUNC(dbm)
-{
- DBM_DATA;
- datum gkey;
- char *key = NULL;
-
- gkey = firstkey();
- if(gkey.dptr) {
- if(newlen) *newlen = gkey.dsize;
- key = estrndup(gkey.dptr, gkey.dsize);
- dba->nextkey = gkey;
- } else
- dba->nextkey.dptr = NULL;
- return key;
-}
-
-DBA_NEXTKEY_FUNC(dbm)
-{
- DBM_DATA;
- datum gkey;
- char *nkey = NULL;
-
- if(!dba->nextkey.dptr) return NULL;
-
- gkey = nextkey(dba->nextkey);
- if(gkey.dptr) {
- if(newlen) *newlen = gkey.dsize;
- nkey = estrndup(gkey.dptr, gkey.dsize);
- dba->nextkey = gkey;
- } else
- dba->nextkey.dptr = NULL;
- return nkey;
-}
-
-DBA_OPTIMIZE_FUNC(dbm)
-{
- /* dummy */
- return SUCCESS;
-}
-
-DBA_SYNC_FUNC(dbm)
-{
- return SUCCESS;
-}
-
-DBA_INFO_FUNC(dbm)
-{
-#if DBA_GDBM
- if (!strcmp(DBM_VERSION, "GDBM"))
- {
- return dba_info_gdbm(hnd, info TSRMLS_CC);
- }
-#endif
- return estrdup(DBM_VERSION);
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dba/dba_flatfile.c b/ext/dba/dba_flatfile.c
deleted file mode 100644
index dd9d77c89d..0000000000
--- a/ext/dba/dba_flatfile.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if DBA_FLATFILE
-#include "php_flatfile.h"
-
-#include "libflatfile/flatfile.h"
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#define FLATFILE_DATA flatfile *dba = info->dbf
-#define FLATFILE_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen
-
-DBA_OPEN_FUNC(flatfile)
-{
- info->dbf = pemalloc(sizeof(flatfile), info->flags&DBA_PERSISTENT);
- memset(info->dbf, 0, sizeof(flatfile));
-
- ((flatfile*)info->dbf)->fp = info->fp;
-
- return SUCCESS;
-}
-
-DBA_CLOSE_FUNC(flatfile)
-{
- FLATFILE_DATA;
-
- if (dba->nextkey.dptr) {
- efree(dba->nextkey.dptr);
- }
- pefree(dba, info->flags&DBA_PERSISTENT);
-}
-
-DBA_FETCH_FUNC(flatfile)
-{
- datum gval;
- char *new = NULL;
-
- FLATFILE_DATA;
- FLATFILE_GKEY;
-
- gval = flatfile_fetch(dba, gkey TSRMLS_CC);
- if (gval.dptr) {
- if (newlen) {
- *newlen = gval.dsize;
- }
- new = estrndup(gval.dptr, gval.dsize);
- efree(gval.dptr);
- }
- return new;
-}
-
-DBA_UPDATE_FUNC(flatfile)
-{
- datum gval;
-
- FLATFILE_DATA;
- FLATFILE_GKEY;
- gval.dptr = (char *) val;
- gval.dsize = vallen;
-
- switch(flatfile_store(dba, gkey, gval, mode==1 ? FLATFILE_INSERT : FLATFILE_REPLACE TSRMLS_CC)) {
- case -1:
- php_error_docref1(NULL TSRMLS_CC, key, E_WARNING, "Operation not possible");
- return FAILURE;
- default:
- case 0:
- return SUCCESS;
- case 1:
- php_error_docref1(NULL TSRMLS_CC, key, E_WARNING, "Key already exists");
- return SUCCESS;
- }
-}
-
-DBA_EXISTS_FUNC(flatfile)
-{
- datum gval;
- FLATFILE_DATA;
- FLATFILE_GKEY;
-
- gval = flatfile_fetch(dba, gkey TSRMLS_CC);
- if (gval.dptr) {
- efree(gval.dptr);
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_DELETE_FUNC(flatfile)
-{
- FLATFILE_DATA;
- FLATFILE_GKEY;
- return(flatfile_delete(dba, gkey TSRMLS_CC) == -1 ? FAILURE : SUCCESS);
-}
-
-DBA_FIRSTKEY_FUNC(flatfile)
-{
- FLATFILE_DATA;
-
- if (dba->nextkey.dptr) {
- efree(dba->nextkey.dptr);
- }
- dba->nextkey = flatfile_firstkey(dba TSRMLS_CC);
- if (dba->nextkey.dptr) {
- if (newlen) {
- *newlen = dba->nextkey.dsize;
- }
- return estrndup(dba->nextkey.dptr, dba->nextkey.dsize);
- }
- return NULL;
-}
-
-DBA_NEXTKEY_FUNC(flatfile)
-{
- FLATFILE_DATA;
-
- if (!dba->nextkey.dptr) {
- return NULL;
- }
-
- if (dba->nextkey.dptr) {
- efree(dba->nextkey.dptr);
- }
- dba->nextkey = flatfile_nextkey(dba TSRMLS_CC);
- if (dba->nextkey.dptr) {
- if (newlen) {
- *newlen = dba->nextkey.dsize;
- }
- return estrndup(dba->nextkey.dptr, dba->nextkey.dsize);
- }
- return NULL;
-}
-
-DBA_OPTIMIZE_FUNC(flatfile)
-{
- /* dummy */
- return SUCCESS;
-}
-
-DBA_SYNC_FUNC(flatfile)
-{
- /* dummy */
- return SUCCESS;
-}
-
-DBA_INFO_FUNC(flatfile)
-{
- return estrdup(flatfile_version());
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dba/dba_gdbm.c b/ext/dba/dba_gdbm.c
deleted file mode 100644
index b3b8abdc73..0000000000
--- a/ext/dba/dba_gdbm.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if DBA_GDBM
-#include "php_gdbm.h"
-
-#ifdef GDBM_INCLUDE_FILE
-#include GDBM_INCLUDE_FILE
-#endif
-
-#define GDBM_DATA dba_gdbm_data *dba = info->dbf
-#define GDBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen
-
-typedef struct {
- GDBM_FILE dbf;
- datum nextkey;
-} dba_gdbm_data;
-
-DBA_OPEN_FUNC(gdbm)
-{
- GDBM_FILE dbf;
- int gmode = 0;
- int filemode = 0644;
-
- gmode = info->mode == DBA_READER ? GDBM_READER :
- info->mode == DBA_WRITER ? GDBM_WRITER :
- info->mode == DBA_CREAT ? GDBM_WRCREAT :
- info->mode == DBA_TRUNC ? GDBM_NEWDB : -1;
-
- if(gmode == -1)
- return FAILURE; /* not possible */
-
- if(info->argc > 0) {
- convert_to_long_ex(info->argv[0]);
- filemode = Z_LVAL_PP(info->argv[0]);
- }
-
- dbf = gdbm_open(info->path, 0, gmode, filemode, NULL);
-
- if(dbf) {
- info->dbf = pemalloc(sizeof(dba_gdbm_data), info->flags&DBA_PERSISTENT);
- memset(info->dbf, 0, sizeof(dba_gdbm_data));
- ((dba_gdbm_data *) info->dbf)->dbf = dbf;
- return SUCCESS;
- }
- *error = gdbm_strerror(gdbm_errno);
- return FAILURE;
-}
-
-DBA_CLOSE_FUNC(gdbm)
-{
- GDBM_DATA;
-
- if(dba->nextkey.dptr) free(dba->nextkey.dptr);
- gdbm_close(dba->dbf);
- pefree(dba, info->flags&DBA_PERSISTENT);
-}
-
-DBA_FETCH_FUNC(gdbm)
-{
- GDBM_DATA;
- datum gval;
- char *new = NULL;
-
- GDBM_GKEY;
- gval = gdbm_fetch(dba->dbf, gkey);
- if(gval.dptr) {
- if(newlen) *newlen = gval.dsize;
- new = estrndup(gval.dptr, gval.dsize);
- free(gval.dptr);
- }
- return new;
-}
-
-DBA_UPDATE_FUNC(gdbm)
-{
- datum gval;
- GDBM_DATA;
-
- GDBM_GKEY;
- gval.dptr = (char *) val;
- gval.dsize = vallen;
-
- if(gdbm_store(dba->dbf, gkey, gval,
- mode == 1 ? GDBM_INSERT : GDBM_REPLACE) == 0)
- return SUCCESS;
- php_error_docref2(NULL TSRMLS_CC, key, val, E_WARNING, "%s", gdbm_strerror(gdbm_errno));
- return FAILURE;
-}
-
-DBA_EXISTS_FUNC(gdbm)
-{
- GDBM_DATA;
- GDBM_GKEY;
-
- return gdbm_exists(dba->dbf, gkey) ? SUCCESS : FAILURE;
-}
-
-DBA_DELETE_FUNC(gdbm)
-{
- GDBM_DATA;
- GDBM_GKEY;
-
- return gdbm_delete(dba->dbf, gkey) == -1 ? FAILURE : SUCCESS;
-}
-
-DBA_FIRSTKEY_FUNC(gdbm)
-{
- GDBM_DATA;
- datum gkey;
- char *key = NULL;
-
- if(dba->nextkey.dptr) {
- free(dba->nextkey.dptr);
- }
-
- gkey = gdbm_firstkey(dba->dbf);
- if(gkey.dptr) {
- key = estrndup(gkey.dptr, gkey.dsize);
- if(newlen) *newlen = gkey.dsize;
- dba->nextkey = gkey;
- } else {
- dba->nextkey.dptr = NULL;
- }
- return key;
-}
-
-DBA_NEXTKEY_FUNC(gdbm)
-{
- GDBM_DATA;
- char *nkey = NULL;
- datum gkey;
-
- if(!dba->nextkey.dptr) return NULL;
-
- gkey = gdbm_nextkey(dba->dbf, dba->nextkey);
- free(dba->nextkey.dptr);
- if(gkey.dptr) {
- nkey = estrndup(gkey.dptr, gkey.dsize);
- if(newlen) *newlen = gkey.dsize;
- dba->nextkey = gkey;
- } else {
- dba->nextkey.dptr = NULL;
- }
- return nkey;
-}
-
-DBA_OPTIMIZE_FUNC(gdbm)
-{
- GDBM_DATA;
- gdbm_reorganize(dba->dbf);
- return SUCCESS;
-}
-
-DBA_SYNC_FUNC(gdbm)
-{
- GDBM_DATA;
-
- gdbm_sync(dba->dbf);
- return SUCCESS;
-}
-
-DBA_INFO_FUNC(gdbm)
-{
- return estrdup(gdbm_version);
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dba/dba_inifile.c b/ext/dba/dba_inifile.c
deleted file mode 100644
index 2a12179e78..0000000000
--- a/ext/dba/dba_inifile.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if DBA_INIFILE
-#include "php_inifile.h"
-
-#include "libinifile/inifile.h"
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#define INIFILE_DATA \
- inifile *dba = info->dbf
-
-#define INIFILE_GKEY \
- key_type ini_key = inifile_key_split((char*)key) /* keylen not needed here */
-
-#define INIFILE_DONE \
- inifile_key_free(&ini_key)
-
-DBA_OPEN_FUNC(inifile)
-{
- info->dbf = inifile_alloc(info->fp, info->mode == DBA_READER, info->flags&DBA_PERSISTENT TSRMLS_CC);
-
- return info->dbf ? SUCCESS : FAILURE;
-}
-
-DBA_CLOSE_FUNC(inifile)
-{
- INIFILE_DATA;
-
- inifile_free(dba, info->flags&DBA_PERSISTENT);
-}
-
-DBA_FETCH_FUNC(inifile)
-{
- val_type ini_val;
-
- INIFILE_DATA;
- INIFILE_GKEY;
-
- ini_val = inifile_fetch(dba, &ini_key, skip TSRMLS_CC);
- *newlen = ini_val.value ? strlen(ini_val.value) : 0;
- INIFILE_DONE;
- return ini_val.value;
-}
-
-DBA_UPDATE_FUNC(inifile)
-{
- val_type ini_val;
- int res;
-
- INIFILE_DATA;
- INIFILE_GKEY;
-
- ini_val.value = val;
-
- if (mode == 1) {
- res = inifile_append(dba, &ini_key, &ini_val TSRMLS_CC);
- } else {
- res = inifile_replace(dba, &ini_key, &ini_val TSRMLS_CC);
- }
- INIFILE_DONE;
- switch(res) {
- case -1:
- php_error_docref1(NULL TSRMLS_CC, key, E_WARNING, "Operation not possible");
- return FAILURE;
- default:
- case 0:
- return SUCCESS;
- case 1:
- php_error_docref1(NULL TSRMLS_CC, key, E_WARNING, "Key already exists");
- return SUCCESS;
- }
-}
-
-DBA_EXISTS_FUNC(inifile)
-{
- val_type ini_val;
-
- INIFILE_DATA;
- INIFILE_GKEY;
-
- ini_val = inifile_fetch(dba, &ini_key, 0 TSRMLS_CC);
- INIFILE_DONE;
- if (ini_val.value) {
- inifile_val_free(&ini_val);
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_DELETE_FUNC(inifile)
-{
- INIFILE_DATA;
- INIFILE_GKEY;
- int res = inifile_delete(dba, &ini_key TSRMLS_CC);
-
- INIFILE_DONE;
- return (res == -1 ? FAILURE : SUCCESS);
-}
-
-DBA_FIRSTKEY_FUNC(inifile)
-{
- INIFILE_DATA;
-
- if (inifile_firstkey(dba TSRMLS_CC)) {
- char *result = inifile_key_string(&dba->curr.key);
- *newlen = strlen(result);
- return result;
- } else {
- return NULL;
- }
-}
-
-DBA_NEXTKEY_FUNC(inifile)
-{
- INIFILE_DATA;
-
- if (!dba->curr.key.group && !dba->curr.key.name) {
- return NULL;
- }
-
- if (inifile_nextkey(dba TSRMLS_CC)) {
- char *result = inifile_key_string(&dba->curr.key);
- *newlen = strlen(result);
- return result;
- } else {
- return NULL;
- }
-}
-
-DBA_OPTIMIZE_FUNC(inifile)
-{
- /* dummy */
- return SUCCESS;
-}
-
-DBA_SYNC_FUNC(inifile)
-{
- /* dummy */
- return SUCCESS;
-}
-
-DBA_INFO_FUNC(inifile)
-{
- return estrdup(inifile_version());
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dba/dba_ndbm.c b/ext/dba/dba_ndbm.c
deleted file mode 100644
index 95cc34e625..0000000000
--- a/ext/dba/dba_ndbm.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if DBA_NDBM
-#include "php_ndbm.h"
-
-#include <fcntl.h>
-#ifdef NDBM_INCLUDE_FILE
-#include NDBM_INCLUDE_FILE
-#endif
-
-#define NDBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen
-
-DBA_OPEN_FUNC(ndbm)
-{
- DBM *dbf;
- int gmode = 0;
- int filemode = 0644;
- dba_info *pinfo = (dba_info *) info;
-
- switch(info->mode) {
- case DBA_READER:
- gmode = O_RDONLY;
- break;
- case DBA_WRITER:
- gmode = O_RDWR;
- break;
- case DBA_CREAT:
- gmode = O_RDWR | O_CREAT;
- break;
- case DBA_TRUNC:
- gmode = O_RDWR | O_CREAT | O_TRUNC;
- break;
- default:
- return FAILURE; /* not possible */
- }
-
- if(info->argc > 0) {
- convert_to_long_ex(info->argv[0]);
- filemode = Z_LVAL_PP(info->argv[0]);
- }
-
- dbf = dbm_open(info->path, gmode, filemode);
-
- pinfo->dbf = dbf;
- return SUCCESS;
-}
-
-DBA_CLOSE_FUNC(ndbm)
-{
- dbm_close(info->dbf);
-}
-
-DBA_FETCH_FUNC(ndbm)
-{
- datum gval;
- char *new = NULL;
-
- NDBM_GKEY;
- gval = dbm_fetch(info->dbf, gkey);
- if(gval.dptr) {
- if(newlen) *newlen = gval.dsize;
- new = estrndup(gval.dptr, gval.dsize);
- }
- return new;
-}
-
-DBA_UPDATE_FUNC(ndbm)
-{
- datum gval;
-
- NDBM_GKEY;
- gval.dptr = (char *) val;
- gval.dsize = vallen;
-
- if(!dbm_store(info->dbf, gkey, gval, mode == 1 ? DBM_INSERT : DBM_REPLACE))
- return SUCCESS;
- return FAILURE;
-}
-
-DBA_EXISTS_FUNC(ndbm)
-{
- datum gval;
- NDBM_GKEY;
- gval = dbm_fetch(info->dbf, gkey);
- if(gval.dptr) {
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_DELETE_FUNC(ndbm)
-{
- NDBM_GKEY;
- return(dbm_delete(info->dbf, gkey) == -1 ? FAILURE : SUCCESS);
-}
-
-DBA_FIRSTKEY_FUNC(ndbm)
-{
- datum gkey;
- char *key = NULL;
-
- gkey = dbm_firstkey(info->dbf);
- if(gkey.dptr) {
- if(newlen) *newlen = gkey.dsize;
- key = estrndup(gkey.dptr, gkey.dsize);
- }
- return key;
-}
-
-DBA_NEXTKEY_FUNC(ndbm)
-{
- datum gkey;
- char *nkey = NULL;
-
- gkey = dbm_nextkey(info->dbf);
- if(gkey.dptr) {
- if(newlen) *newlen = gkey.dsize;
- nkey = estrndup(gkey.dptr, gkey.dsize);
- }
- return nkey;
-}
-
-DBA_OPTIMIZE_FUNC(ndbm)
-{
- return SUCCESS;
-}
-
-DBA_SYNC_FUNC(ndbm)
-{
- return SUCCESS;
-}
-
-DBA_INFO_FUNC(ndbm)
-{
- return estrdup("NDBM");
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dba/install_cdb.sh b/ext/dba/install_cdb.sh
deleted file mode 100755
index ce5f3cc856..0000000000
--- a/ext/dba/install_cdb.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#! /bin/sh
-
-# You can use this script if you want to use an external cdb lib. If you
-# compile php using --with-cdb the internal functions will be used and no
-# external library is used so that this script is not necessary.
-#
-# cdb-0.75 lacks support for installing header files and creating a
-# library which programs can link against. This shell script fills
-# the gap.
-#
-# $Id: install_cdb.sh,v 1.2 2002-11-04 17:53:04 helly Exp $
-
-if test -r "cdb.a" && test -r "auto-str.c" && test -r "byte.a"; then
- :
-else
- echo "Please execute this script in the cdb-0.75 source directory after 'make'"
- exit 1
-fi
-
-prefix=$1
-
-if test -z "$prefix"; then
- prefix=/usr/local
-fi
-
-echo "Using prefix $prefix"
-
-if mkdir -p "$prefix/include" "$prefix/lib"; then
- :
-else
- echo "Creating directories failed. Please become superuser."
- exit 1
-fi
-
-mkdir -p tmp || exit 1
-cd tmp
-ar x ../cdb.a
-ar x ../byte.a
-ar x ../unix.a
-ar x ../byte.a
-ar x ../buffer.a
-cp ../error.o .
-
-# not really portable
-ar r "$prefix/lib/libcdb.a" *
-ranlib "$prefix/lib/libcdb.a"
-cd ..
-
-rm -rf tmp
-
-cp cdb.h uint32.h "$prefix/include"
-
-echo "done"
diff --git a/ext/dba/libcdb/cdb.c b/ext/dba/libcdb/cdb.c
deleted file mode 100644
index 16aaca037a..0000000000
--- a/ext/dba/libcdb/cdb.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifndef PHP_WIN32
-#include <sys/mman.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include <errno.h>
-#include "cdb.h"
-
-#ifndef EPROTO
-# define EPROTO -15 /* cdb 0.75's default for PROTOless systems */
-#endif
-
-/* {{{ cdb_match */
-static int cdb_match(struct cdb *c, char *key, unsigned int len, uint32 pos TSRMLS_DC)
-{
- char buf[32];
- unsigned int n;
-
- while (len > 0) {
- n = sizeof(buf);
- if (n > len)
- n = len;
- if (cdb_read(c, buf, n, pos TSRMLS_CC) == -1)
- return -1;
- if (memcmp(buf, key, n))
- return 0;
- pos += n;
- key += n;
- len -= n;
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ cdb_hash */
-uint32 cdb_hash(char *buf, unsigned int len)
-{
- uint32 h;
-
- h = CDB_HASHSTART;
- while (len--) {
- h = ( h + (h << 5)) ^ (*buf++);
- }
- return h;
-}
-/* }}} */
-
-/* {{{ cdb_free */
-void cdb_free(struct cdb *c TSRMLS_DC)
-{
-}
-/* }}} */
-
-/* {{{ cdb_findstart */
-void cdb_findstart(struct cdb *c TSRMLS_DC)
-{
- c->loop = 0;
-}
-/* }}} */
-
-/* {{{ cdb_init */
-void cdb_init(struct cdb *c, php_stream *fp TSRMLS_DC)
-{
- cdb_free(c TSRMLS_CC);
- cdb_findstart(c TSRMLS_CC);
- c->fp = fp;
-}
-/* }}} */
-
-/* {{{ cdb_read */
-int cdb_read(struct cdb *c, char *buf, unsigned int len, uint32 pos TSRMLS_DC)
-{
- if (php_stream_seek(c->fp, pos, SEEK_SET) == -1) {
- errno = EPROTO;
- return -1;
- }
- while (len > 0) {
- int r;
- do {
- r = php_stream_read(c->fp, buf, len);
- } while ((r == -1) && (errno == EINTR));
- if (r == -1)
- return -1;
- if (r == 0) {
- errno = EPROTO;
- return -1;
- }
- buf += r;
- len -= r;
- }
- return 0;
-}
-/* }}} */
-
-/* {{{ cdb_findnext */
-int cdb_findnext(struct cdb *c, char *key, unsigned int len TSRMLS_DC)
-{
- char buf[8];
- uint32 pos;
- uint32 u;
-
- if (!c->loop) {
- u = cdb_hash(key, len);
- if (cdb_read(c, buf, 8, (u << 3) & 2047 TSRMLS_CC) == -1)
- return -1;
- uint32_unpack(buf + 4,&c->hslots);
- if (!c->hslots)
- return 0;
- uint32_unpack(buf, &c->hpos);
- c->khash = u;
- u >>= 8;
- u %= c->hslots;
- u <<= 3;
- c->kpos = c->hpos + u;
- }
-
- while (c->loop < c->hslots) {
- if (cdb_read(c, buf, 8, c->kpos TSRMLS_CC) == -1)
- return -1;
- uint32_unpack(buf + 4, &pos);
- if (!pos)
- return 0;
- c->loop += 1;
- c->kpos += 8;
- if (c->kpos == c->hpos + (c->hslots << 3))
- c->kpos = c->hpos;
- uint32_unpack(buf, &u);
- if (u == c->khash) {
- if (cdb_read(c, buf, 8, pos TSRMLS_CC) == -1)
- return -1;
- uint32_unpack(buf, &u);
- if (u == len)
- switch(cdb_match(c, key, len, pos + 8 TSRMLS_CC)) {
- case -1:
- return -1;
- case 1:
- uint32_unpack(buf + 4, &c->dlen);
- c->dpos = pos + 8 + len;
- return 1;
- }
- }
- }
-
- return 0;
-}
-/* }}} */
-
-/* {{{ cdb_find */
-int cdb_find(struct cdb *c, char *key, unsigned int len TSRMLS_DC)
-{
- cdb_findstart(c TSRMLS_CC);
- return cdb_findnext(c, key, len TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ cdb_version */
-char *cdb_version()
-{
- return "0.75, $Revision$";
-}
-/* }}} */
diff --git a/ext/dba/libcdb/cdb.h b/ext/dba/libcdb/cdb.h
deleted file mode 100644
index 6a3b08db34..0000000000
--- a/ext/dba/libcdb/cdb.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
-
-#ifndef CDB_H
-#define CDB_H
-
-#include "uint32.h"
-
-#define CDB_HASHSTART 5381
-
-struct cdb {
- php_stream *fp;
- uint32 loop; /* number of hash slots searched under this key */
- uint32 khash; /* initialized if loop is nonzero */
- uint32 kpos; /* initialized if loop is nonzero */
- uint32 hpos; /* initialized if loop is nonzero */
- uint32 hslots; /* initialized if loop is nonzero */
- uint32 dpos; /* initialized if cdb_findnext() returns 1 */
- uint32 dlen; /* initialized if cdb_findnext() returns 1 */
-};
-
-uint32 cdb_hash(char *, unsigned int);
-
-void cdb_free(struct cdb * TSRMLS_DC);
-void cdb_init(struct cdb *, php_stream *fp TSRMLS_DC);
-
-int cdb_read(struct cdb *, char *, unsigned int, uint32 TSRMLS_DC);
-
-void cdb_findstart(struct cdb * TSRMLS_DC);
-int cdb_findnext(struct cdb *, char *, unsigned int TSRMLS_DC);
-int cdb_find(struct cdb *, char *, unsigned int TSRMLS_DC);
-
-#define cdb_datapos(c) ((c)->dpos)
-#define cdb_datalen(c) ((c)->dlen)
-
-char *cdb_version();
-
-#endif
diff --git a/ext/dba/libcdb/cdb_make.c b/ext/dba/libcdb/cdb_make.c
deleted file mode 100644
index 64525a17a2..0000000000
--- a/ext/dba/libcdb/cdb_make.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#include <sys/types.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include "cdb.h"
-#include "cdb_make.h"
-#include "uint32.h"
-
-/* {{{ cdb_make_write */
-static int cdb_make_write(struct cdb_make *c, char *buf, uint32 sz TSRMLS_DC) {
- return php_stream_write(c->fp, buf, sz) == sz ? 0 : -1;
-}
-
-/* {{{ cdb_posplus */
-static int cdb_posplus(struct cdb_make *c, uint32 len)
-{
- uint32 newpos = c->pos + len;
- if (newpos < len) {
- errno = ENOMEM;
- return -1;
- }
- c->pos = newpos;
- return 0;
-}
-/* }}} */
-
-/* {{{ cdb_make_start */
-int cdb_make_start(struct cdb_make *c, php_stream * f TSRMLS_DC)
-{
- c->head = 0;
- c->split = 0;
- c->hash = 0;
- c->numentries = 0;
- c->fp = f;
- c->pos = sizeof(c->final);
- if (php_stream_seek(f, c->pos, SEEK_SET) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Fseek failed");
- return -1;
- }
- return php_stream_tell(c->fp);
-}
-/* }}} */
-
-/* {{{ cdb_make_addend */
-int cdb_make_addend(struct cdb_make *c, unsigned int keylen, unsigned int datalen, uint32 h TSRMLS_DC)
-{
- struct cdb_hplist *head;
-
- head = c->head;
- if (!head || (head->num >= CDB_HPLIST)) {
- head = (struct cdb_hplist *) emalloc(sizeof(struct cdb_hplist));
- if (!head)
- return -1;
- head->num = 0;
- head->next = c->head;
- c->head = head;
- }
- head->hp[head->num].h = h;
- head->hp[head->num].p = c->pos;
- ++head->num;
- ++c->numentries;
- if (cdb_posplus(c,8) == -1)
- return -1;
- if (cdb_posplus(c, keylen) == -1)
- return -1;
- if (cdb_posplus(c, datalen) == -1)
- return -1;
- return 0;
-}
-/* }}} */
-
-/* {{{ cdb_make_addbegin */
-int cdb_make_addbegin(struct cdb_make *c, unsigned int keylen, unsigned int datalen TSRMLS_DC)
-{
- char buf[8];
-
- if (keylen > 0xffffffff) {
- errno = ENOMEM;
- return -1;
- }
- if (datalen > 0xffffffff) {
- errno = ENOMEM;
- return -1;
- }
-
- uint32_pack(buf, keylen);
- uint32_pack(buf + 4, datalen);
- if (cdb_make_write(c, buf, 8 TSRMLS_CC) != 0)
- return -1;
- return 0;
-}
-
-/* {{{ cdb_make_add */
-int cdb_make_add(struct cdb_make *c,char *key,unsigned int keylen,char *data,unsigned int datalen TSRMLS_DC)
-{
- if (cdb_make_addbegin(c, keylen, datalen TSRMLS_CC) == -1)
- return -1;
- if (cdb_make_write(c, key, keylen TSRMLS_CC) != 0)
- return -1;
- if (cdb_make_write(c, data, datalen TSRMLS_CC) != 0)
- return -1;
- return cdb_make_addend(c, keylen, datalen, cdb_hash(key, keylen) TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ cdb_make_finish */
-int cdb_make_finish(struct cdb_make *c TSRMLS_DC)
-{
- char buf[8];
- int i;
- uint32 len;
- uint32 u;
- uint32 memsize;
- uint32 count;
- uint32 where;
- struct cdb_hplist *x;
- struct cdb_hp *hp;
-
- for (i = 0;i < 256;++i)
- c->count[i] = 0;
-
- for (x = c->head; x; x = x->next) {
- i = x->num;
- while (i--)
- ++c->count[255 & x->hp[i].h];
- }
-
- memsize = 1;
- for (i = 0;i < 256;++i) {
- u = c->count[i] * 2;
- if (u > memsize)
- memsize = u;
- }
-
- memsize += c->numentries; /* no overflow possible up to now */
- u = (uint32) 0 - (uint32) 1;
- u /= sizeof(struct cdb_hp);
- if (memsize > u) {
- errno = ENOMEM;
- return -1;
- }
-
- c->split = (struct cdb_hp *) safe_emalloc(memsize, sizeof(struct cdb_hp), 0);
- if (!c->split)
- return -1;
-
- c->hash = c->split + c->numentries;
-
- u = 0;
- for (i = 0;i < 256;++i) {
- u += c->count[i]; /* bounded by numentries, so no overflow */
- c->start[i] = u;
- }
-
- for (x = c->head; x; x = x->next) {
- i = x->num;
- while (i--)
- c->split[--c->start[255 & x->hp[i].h]] = x->hp[i];
- }
-
- for (i = 0;i < 256;++i) {
- count = c->count[i];
-
- len = count + count; /* no overflow possible */
- uint32_pack(c->final + 8 * i,c->pos);
- uint32_pack(c->final + 8 * i + 4,len);
-
- for (u = 0;u < len;++u)
- c->hash[u].h = c->hash[u].p = 0;
-
- hp = c->split + c->start[i];
- for (u = 0;u < count;++u) {
- where = (hp->h >> 8) % len;
- while (c->hash[where].p)
- if (++where == len)
- where = 0;
- c->hash[where] = *hp++;
- }
-
- for (u = 0;u < len;++u) {
- uint32_pack(buf, c->hash[u].h);
- uint32_pack(buf + 4, c->hash[u].p);
- if (cdb_make_write(c, buf, 8 TSRMLS_CC) != 0)
- return -1;
- if (cdb_posplus(c, 8) == -1)
- return -1;
- }
- }
-
- if (c->split)
- efree(c->split);
-
- for (x = c->head; x; c->head = x) {
- x = x->next;
- efree(c->head);
- }
-
- if (php_stream_flush(c->fp) != 0)
- return -1;
- php_stream_rewind(c->fp);
- if (php_stream_tell(c->fp) != 0)
- return -1;
- if (cdb_make_write(c, c->final, sizeof(c->final) TSRMLS_CC) != 0)
- return -1;
- return php_stream_flush(c->fp);
-}
-/* }}} */
-
-/* {{{ cdb_make_version */
-char *cdb_make_version()
-{
- return "0.75, $Revision$";
-}
diff --git a/ext/dba/libcdb/cdb_make.h b/ext/dba/libcdb/cdb_make.h
deleted file mode 100644
index ea3f40d314..0000000000
--- a/ext/dba/libcdb/cdb_make.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
-
-#ifndef CDB_MAKE_H
-#define CDB_MAKE_H
-
-#include <stdio.h>
-#include "uint32.h"
-
-#define CDB_HPLIST 1000
-
-struct cdb_hp {
- uint32 h;
- uint32 p;
-};
-
-struct cdb_hplist {
- struct cdb_hp hp[CDB_HPLIST];
- struct cdb_hplist *next;
- int num;
-} ;
-
-struct cdb_make {
- /* char bspace[8192]; */
- char final[2048];
- uint32 count[256];
- uint32 start[256];
- struct cdb_hplist *head;
- struct cdb_hp *split; /* includes space for hash */
- struct cdb_hp *hash;
- uint32 numentries;
- /* buffer b; */
- uint32 pos;
- /* int fd; */
- php_stream * fp;
-};
-
-int cdb_make_start(struct cdb_make *, php_stream * TSRMLS_DC);
-int cdb_make_addbegin(struct cdb_make *, unsigned int, unsigned int TSRMLS_DC);
-int cdb_make_addend(struct cdb_make *, unsigned int, unsigned int, uint32 TSRMLS_DC);
-int cdb_make_add(struct cdb_make *, char *, unsigned int, char *, unsigned int TSRMLS_DC);
-int cdb_make_finish(struct cdb_make * TSRMLS_DC);
-char *cdb_make_version();
-
-#endif
diff --git a/ext/dba/libcdb/uint32.c b/ext/dba/libcdb/uint32.c
deleted file mode 100644
index 73b3067a30..0000000000
--- a/ext/dba/libcdb/uint32.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#include "uint32.h"
-
-/* {{{ uint32_pack */
-void uint32_pack(char *out, uint32 in)
-{
- out[0] = in&0xff; in>>=8;
- out[1] = in&0xff; in>>=8;
- out[2] = in&0xff; in>>=8;
- out[3] = in&0xff;
-}
-/* }}} */
-
-/* {{{ uint32_unpack */
-void uint32_unpack(const char *in, uint32 *out)
-{
- *out = (((uint32)(unsigned char)in[3])<<24) |
- (((uint32)(unsigned char)in[2])<<16) |
- (((uint32)(unsigned char)in[1])<<8) |
- (((uint32)(unsigned char)in[0]));
-}
-/* }}} */
diff --git a/ext/dba/libcdb/uint32.h b/ext/dba/libcdb/uint32.h
deleted file mode 100644
index 6783620ed3..0000000000
--- a/ext/dba/libcdb/uint32.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
-
-#ifndef UINT32_H
-#define UINT32_H
-
-#if SIZEOF_INT == 4
-/* Most 32-bit and 64-bit systems have 32-bit ints */
-typedef unsigned int uint32;
-#elif SIZEOF_LONG == 4
-/* 16-bit systems? */
-typedef unsigned long uint32;
-#else
-#error Need type which holds 32 bits
-#endif
-
-void uint32_pack(char *out, uint32 in);
-void uint32_unpack(const char *in, uint32 *out);
-
-#endif
diff --git a/ext/dba/libflatfile/flatfile.c b/ext/dba/libflatfile/flatfile.c
deleted file mode 100644
index 5a9074da6e..0000000000
--- a/ext/dba/libflatfile/flatfile.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- | based on ext/db/db.c by: |
- | Rasmus Lerdorf <rasmus@php.net> |
- | Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "safe_mode.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include "flatfile.h"
-
-#define FLATFILE_BLOCK_SIZE 1024
-
-/*
- * ret = -1 means that database was opened for read-only
- * ret = 0 success
- * ret = 1 key already exists - nothing done
- */
-
-/* {{{ flatfile_store
- */
-int flatfile_store(flatfile *dba, datum key_datum, datum value_datum, int mode TSRMLS_DC) {
- if (mode == FLATFILE_INSERT) {
- if (flatfile_findkey(dba, key_datum TSRMLS_CC)) {
- return 1;
- }
- php_stream_seek(dba->fp, 0L, SEEK_END);
- php_stream_printf(dba->fp TSRMLS_CC, "%d\n", key_datum.dsize);
- php_stream_flush(dba->fp);
- if (php_stream_write(dba->fp, key_datum.dptr, key_datum.dsize) < key_datum.dsize) {
- return -1;
- }
- php_stream_printf(dba->fp TSRMLS_CC, "%d\n", value_datum.dsize);
- php_stream_flush(dba->fp);
- if (php_stream_write(dba->fp, value_datum.dptr, value_datum.dsize) < value_datum.dsize) {
- return -1;
- }
- } else { /* FLATFILE_REPLACE */
- flatfile_delete(dba, key_datum TSRMLS_CC);
- php_stream_printf(dba->fp TSRMLS_CC, "%d\n", key_datum.dsize);
- php_stream_flush(dba->fp);
- if (php_stream_write(dba->fp, key_datum.dptr, key_datum.dsize) < key_datum.dsize) {
- return -1;
- }
- php_stream_printf(dba->fp TSRMLS_CC, "%d\n", value_datum.dsize);
- if (php_stream_write(dba->fp, value_datum.dptr, value_datum.dsize) < value_datum.dsize) {
- return -1;
- }
- }
-
- php_stream_flush(dba->fp);
- return 0;
-}
-/* }}} */
-
-/* {{{ flatfile_fetch
- */
-datum flatfile_fetch(flatfile *dba, datum key_datum TSRMLS_DC) {
- datum value_datum = {NULL, 0};
- char buf[16];
-
- if (flatfile_findkey(dba, key_datum TSRMLS_CC)) {
- if (php_stream_gets(dba->fp, buf, sizeof(buf))) {
- value_datum.dsize = atoi(buf);
- value_datum.dptr = safe_emalloc(value_datum.dsize, 1, 1);
- value_datum.dsize = php_stream_read(dba->fp, value_datum.dptr, value_datum.dsize);
- } else {
- value_datum.dptr = NULL;
- value_datum.dsize = 0;
- }
- }
- return value_datum;
-}
-/* }}} */
-
-/* {{{ flatfile_delete
- */
-int flatfile_delete(flatfile *dba, datum key_datum TSRMLS_DC) {
- char *key = key_datum.dptr;
- size_t size = key_datum.dsize;
- size_t buf_size = FLATFILE_BLOCK_SIZE;
- char *buf = emalloc(buf_size);
- size_t num;
- size_t pos;
-
- php_stream_rewind(dba->fp);
- while(!php_stream_eof(dba->fp)) {
- /* read in the length of the key name */
- if (!php_stream_gets(dba->fp, buf, 15)) {
- break;
- }
- num = atoi(buf);
- if (num >= buf_size) {
- buf_size = num + FLATFILE_BLOCK_SIZE;
- buf = erealloc(buf, buf_size);
- }
- pos = php_stream_tell(dba->fp);
-
- /* read in the key name */
- num = php_stream_read(dba->fp, buf, num);
- if (num < 0) {
- break;
- }
-
- if (size == num && !memcmp(buf, key, size)) {
- php_stream_seek(dba->fp, pos, SEEK_SET);
- php_stream_putc(dba->fp, 0);
- php_stream_flush(dba->fp);
- php_stream_seek(dba->fp, 0L, SEEK_END);
- efree(buf);
- return SUCCESS;
- }
-
- /* read in the length of the value */
- if (!php_stream_gets(dba->fp, buf, 15)) {
- break;
- }
- num = atoi(buf);
- if (num >= buf_size) {
- buf_size = num + FLATFILE_BLOCK_SIZE;
- buf = erealloc(buf, buf_size);
- }
- /* read in the value */
- num = php_stream_read(dba->fp, buf, num);
- if (num < 0) {
- break;
- }
- }
- efree(buf);
- return FAILURE;
-}
-/* }}} */
-
-/* {{{ flatfile_findkey
- */
-int flatfile_findkey(flatfile *dba, datum key_datum TSRMLS_DC) {
- size_t buf_size = FLATFILE_BLOCK_SIZE;
- char *buf = emalloc(buf_size);
- size_t num;
- int ret=0;
- void *key = key_datum.dptr;
- size_t size = key_datum.dsize;
-
- php_stream_rewind(dba->fp);
- while (!php_stream_eof(dba->fp)) {
- if (!php_stream_gets(dba->fp, buf, 15)) {
- break;
- }
- num = atoi(buf);
- if (num >= buf_size) {
- buf_size = num + FLATFILE_BLOCK_SIZE;
- buf = erealloc(buf, buf_size);
- }
- num = php_stream_read(dba->fp, buf, num);
- if (num < 0) {
- break;
- }
- if (size == num) {
- if (!memcmp(buf, key, size)) {
- ret = 1;
- break;
- }
- }
- if (!php_stream_gets(dba->fp, buf, 15)) {
- break;
- }
- num = atoi(buf);
- if (num >= buf_size) {
- buf_size = num + FLATFILE_BLOCK_SIZE;
- buf = erealloc(buf, buf_size);
- }
- num = php_stream_read(dba->fp, buf, num);
- if (num < 0) {
- break;
- }
- }
- efree(buf);
- return ret;
-}
-/* }}} */
-
-/* {{{ flatfile_firstkey
- */
-datum flatfile_firstkey(flatfile *dba TSRMLS_DC) {
- datum res;
- size_t num;
- size_t buf_size = FLATFILE_BLOCK_SIZE;
- char *buf = emalloc(buf_size);
-
- php_stream_rewind(dba->fp);
- while(!php_stream_eof(dba->fp)) {
- if (!php_stream_gets(dba->fp, buf, 15)) {
- break;
- }
- num = atoi(buf);
- if (num >= buf_size) {
- buf_size = num + FLATFILE_BLOCK_SIZE;
- buf = erealloc(buf, buf_size);
- }
- num = php_stream_read(dba->fp, buf, num);
- if (num < 0) {
- break;
- }
- if (*(buf) != 0) {
- dba->CurrentFlatFilePos = php_stream_tell(dba->fp);
- res.dptr = buf;
- res.dsize = num;
- return res;
- }
- if (!php_stream_gets(dba->fp, buf, 15)) {
- break;
- }
- num = atoi(buf);
- if (num >= buf_size) {
- buf_size = num + FLATFILE_BLOCK_SIZE;
- buf = erealloc(buf, buf_size);
- }
- num = php_stream_read(dba->fp, buf, num);
- if (num < 0) {
- break;
- }
- }
- efree(buf);
- res.dptr = NULL;
- res.dsize = 0;
- return res;
-}
-/* }}} */
-
-/* {{{ flatfile_nextkey
- */
-datum flatfile_nextkey(flatfile *dba TSRMLS_DC) {
- datum res;
- size_t num;
- size_t buf_size = FLATFILE_BLOCK_SIZE;
- char *buf = emalloc(buf_size);
-
- php_stream_seek(dba->fp, dba->CurrentFlatFilePos, SEEK_SET);
- while(!php_stream_eof(dba->fp)) {
- if (!php_stream_gets(dba->fp, buf, 15)) {
- break;
- }
- num = atoi(buf);
- if (num >= buf_size) {
- buf_size = num + FLATFILE_BLOCK_SIZE;
- buf = erealloc(buf, buf_size);
- }
- num = php_stream_read(dba->fp, buf, num);
- if (num < 0) {
- break;
- }
- if (!php_stream_gets(dba->fp, buf, 15)) {
- break;
- }
- num = atoi(buf);
- if (num >= buf_size) {
- buf_size = num + FLATFILE_BLOCK_SIZE;
- buf = erealloc(buf, buf_size);
- }
- num = php_stream_read(dba->fp, buf, num);
- if (num < 0) {
- break;
- }
- if (*(buf)!=0) {
- dba->CurrentFlatFilePos = php_stream_tell(dba->fp);
- res.dptr = buf;
- res.dsize = num;
- return res;
- }
- }
- efree(buf);
- res.dptr = NULL;
- res.dsize = 0;
- return res;
-}
-/* }}} */
-
-/* {{{ flatfile_version */
-char *flatfile_version()
-{
- return "1.0, $Revision$";
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dba/libflatfile/flatfile.h b/ext/dba/libflatfile/flatfile.h
deleted file mode 100644
index 74e1179e35..0000000000
--- a/ext/dba/libflatfile/flatfile.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_LIB_FLATFILE_H
-#define PHP_LIB_FLATFILE_H
-
-typedef struct {
- char *dptr;
- size_t dsize;
-} datum;
-
-typedef struct {
- char *lockfn;
- int lockfd;
- php_stream *fp;
- size_t CurrentFlatFilePos;
- datum nextkey;
-} flatfile;
-
-#define FLATFILE_INSERT 1
-#define FLATFILE_REPLACE 0
-
-int flatfile_store(flatfile *dba, datum key_datum, datum value_datum, int mode TSRMLS_DC);
-datum flatfile_fetch(flatfile *dba, datum key_datum TSRMLS_DC);
-int flatfile_delete(flatfile *dba, datum key_datum TSRMLS_DC);
-int flatfile_findkey(flatfile *dba, datum key_datum TSRMLS_DC);
-datum flatfile_firstkey(flatfile *dba TSRMLS_DC);
-datum flatfile_nextkey(flatfile *dba TSRMLS_DC);
-char *flatfile_version();
-
-#endif
diff --git a/ext/dba/libinifile/inifile.c b/ext/dba/libinifile/inifile.c
deleted file mode 100644
index 6e3d94dc4a..0000000000
--- a/ext/dba/libinifile/inifile.c
+++ /dev/null
@@ -1,598 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "safe_mode.h"
-#include "php_network.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include "inifile.h"
-
-/* ret = -1 means that database was opened for read-only
- * ret = 0 success
- * ret = 1 key already exists - nothing done
- */
-
-/* {{{ inifile_version */
-char *inifile_version()
-{
- return "1.0, $Revision$";
-}
-/* }}} */
-
-/* {{{ inifile_free_key */
-void inifile_key_free(key_type *key)
-{
- if (key->group) {
- efree(key->group);
- }
- if (key->name) {
- efree(key->name);
- }
- memset(key, 0, sizeof(key_type));
-}
-/* }}} */
-
-/* {{{ inifile_free_val */
-void inifile_val_free(val_type *val)
-{
- if (val->value) {
- efree(val->value);
- }
- memset(val, 0, sizeof(val_type));
-}
-/* }}} */
-
-/* {{{ inifile_free_val */
-void inifile_line_free(line_type *ln)
-{
- inifile_key_free(&ln->key);
- inifile_val_free(&ln->val);
- ln->pos = 0;
-}
-/* }}} */
-
-/* {{{ inifile_alloc */
-inifile * inifile_alloc(php_stream *fp, int readonly, int persistent TSRMLS_DC)
-{
- inifile *dba;
- int fd = 0;
-
- if (!readonly) {
- if (!php_stream_truncate_supported(fp)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't truncate this stream");
- return NULL;
- }
- if (SUCCESS != php_stream_cast(fp, PHP_STREAM_AS_FD, (void*)&fd, 1)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not cast stream");
- return NULL;
- }
- }
- dba = pemalloc(sizeof(inifile), persistent);
- memset(dba, 0, sizeof(inifile));
- dba->fp = fp;
- dba->fd = fd;
- dba->readonly = readonly;
- return dba;
-}
-/* }}} */
-
-/* {{{ inifile_free */
-void inifile_free(inifile *dba, int persistent)
-{
- if (dba) {
- inifile_line_free(&dba->curr);
- inifile_line_free(&dba->next);
- pefree(dba, persistent);
- }
-}
-/* }}} */
-
-/* {{{ inifile_key_split */
-key_type inifile_key_split(const char *group_name)
-{
- key_type key;
- char *name;
-
- if (group_name[0] == '[' && (name = strchr(group_name, ']')) != NULL) {
- key.group = estrndup(group_name+1, name - (group_name + 1));
- key.name = estrdup(name+1);
- } else {
- key.group = estrdup("");
- key.name = estrdup(group_name);
- }
- return key;
-}
-/* }}} */
-
-/* {{{ inifile_key_string */
-char * inifile_key_string(const key_type *key)
-{
- if (key->group && *key->group) {
- char *result;
- spprintf(&result, 0, "[%s]%s", key->group, key->name ? key->name : "");
- return result;
- } else if (key->name) {
- return estrdup(key->name);
- } else {
- return NULL;
- }
-}
-/* }}} */
-
-/* {{{ etrim */
-static char *etrim(const char *str)
-{
- char *val;
- size_t l;
-
- if (!str) {
- return NULL;
- }
- val = (char*)str;
- while (strchr(" \t\r\n", *val)) {
- val++;
- }
- l = strlen(val);
- while (l && (strchr(" \t\r\n", val[l-1]))) {
- l--;
- }
- return estrndup(val, l);
-}
-/* }}} */
-
-/* {{{ inifile_findkey
- */
-static int inifile_read(inifile *dba, line_type *ln TSRMLS_DC) {
- char *fline;
- char *pos;
-
- inifile_val_free(&ln->val);
- while ((fline = php_stream_gets(dba->fp, NULL, 0)) != NULL) {
- if (fline) {
- if (fline[0] == '[') {
- /* A value name cannot start with '['
- * So either we find a ']' or we found an error
- */
- pos = strchr(fline+1, ']');
- if (pos) {
- *pos = '\0';
- inifile_key_free(&ln->key);
- ln->key.group = etrim(fline+1);
- ln->key.name = estrdup("");
- ln->pos = php_stream_tell(dba->fp);
- efree(fline);
- return 1;
- } else {
- efree(fline);
- continue;
- }
- } else {
- pos = strchr(fline, '=');
- if (pos) {
- *pos = '\0';
- /* keep group or make empty if not existent */
- if (!ln->key.group) {
- ln->key.group = estrdup("");
- }
- if (ln->key.name) {
- efree(ln->key.name);
- }
- ln->key.name = etrim(fline);
- ln->val.value = etrim(pos+1);
- ln->pos = php_stream_tell(dba->fp);
- efree(fline);
- return 1;
- } else {
- /* simply ignore lines without '='
- * those should be comments
- */
- efree(fline);
- continue;
- }
- }
- }
- }
- inifile_line_free(ln);
- return 0;
-}
-/* }}} */
-
-/* {{{ inifile_key_cmp */
-/* 0 = EQUAL
- * 1 = GROUP-EQUAL,NAME-DIFFERENT
- * 2 = DIFFERENT
- */
-static int inifile_key_cmp(const key_type *k1, const key_type *k2 TSRMLS_DC)
-{
- assert(k1->group && k1->name && k2->group && k2->name);
-
- if (!strcasecmp(k1->group, k2->group)) {
- if (!strcasecmp(k1->name, k2->name)) {
- return 0;
- } else {
- return 1;
- }
- } else {
- return 2;
- }
-}
-/* }}} */
-
-/* {{{ inifile_fetch
- */
-val_type inifile_fetch(inifile *dba, const key_type *key, int skip TSRMLS_DC) {
- line_type ln = {{NULL,NULL},{NULL}};
- val_type val;
- int res, grp_eq = 0;
-
- if (skip == -1 && dba->next.key.group && dba->next.key.name && !inifile_key_cmp(&dba->next.key, key TSRMLS_CC)) {
- /* we got position already from last fetch */
- php_stream_seek(dba->fp, dba->next.pos, SEEK_SET);
- } else {
- /* specific instance or not same key -> restart search */
- /* the slow way: restart and seacrch */
- php_stream_rewind(dba->fp);
- inifile_line_free(&dba->next);
- }
- if (skip == -1) {
- skip = 0;
- }
- while(inifile_read(dba, &ln TSRMLS_CC)) {
- if (!(res=inifile_key_cmp(&ln.key, key TSRMLS_CC))) {
- if (!skip) {
- val.value = estrdup(ln.val.value ? ln.val.value : "");
- /* allow faster access by updating key read into next */
- inifile_line_free(&dba->next);
- dba->next = ln;
- dba->next.pos = php_stream_tell(dba->fp);
- return val;
- }
- skip--;
- } else if (res == 1) {
- grp_eq = 1;
- } else if (grp_eq) {
- /* we are leaving group now: that means we cannot find the key */
- break;
- }
- }
- inifile_line_free(&ln);
- dba->next.pos = php_stream_tell(dba->fp);
- return ln.val;
-}
-/* }}} */
-
-/* {{{ inifile_firstkey
- */
-int inifile_firstkey(inifile *dba TSRMLS_DC) {
- inifile_line_free(&dba->curr);
- dba->curr.pos = 0;
- return inifile_nextkey(dba TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ inifile_nextkey
- */
-int inifile_nextkey(inifile *dba TSRMLS_DC) {
- line_type ln = {{NULL,NULL},{NULL}};
-
- /*inifile_line_free(&dba->next); ??? */
- php_stream_seek(dba->fp, dba->curr.pos, SEEK_SET);
- ln.key.group = estrdup(dba->curr.key.group ? dba->curr.key.group : "");
- inifile_read(dba, &ln TSRMLS_CC);
- inifile_line_free(&dba->curr);
- dba->curr = ln;
- return ln.key.group || ln.key.name;
-}
-/* }}} */
-
-/* {{{ inifile_truncate
- */
-static int inifile_truncate(inifile *dba, size_t size TSRMLS_DC)
-{
- int res;
-
- if ((res=php_stream_truncate_set_size(dba->fp, size)) != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error in ftruncate: %d", res);
- return FAILURE;
- }
- php_stream_seek(dba->fp, size, SEEK_SET);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ inifile_find_group
- * if found pos_grp_start points to "[group_name]"
- */
-static int inifile_find_group(inifile *dba, const key_type *key, size_t *pos_grp_start TSRMLS_DC)
-{
- int ret = FAILURE;
-
- php_stream_flush(dba->fp);
- php_stream_seek(dba->fp, 0, SEEK_SET);
- inifile_line_free(&dba->curr);
- inifile_line_free(&dba->next);
-
- if (key->group && strlen(key->group)) {
- int res;
- line_type ln = {{NULL,NULL},{NULL}};
-
- res = 1;
- while(inifile_read(dba, &ln TSRMLS_CC)) {
- if ((res=inifile_key_cmp(&ln.key, key TSRMLS_CC)) < 2) {
- ret = SUCCESS;
- break;
- }
- *pos_grp_start = php_stream_tell(dba->fp);
- }
- inifile_line_free(&ln);
- } else {
- *pos_grp_start = 0;
- ret = SUCCESS;
- }
- if (ret == FAILURE) {
- *pos_grp_start = php_stream_tell(dba->fp);
- }
- return ret;
-}
-/* }}} */
-
-/* {{{ inifile_next_group
- * only valid after a call to inifile_find_group
- * if any next group is found pos_grp_start points to "[group_name]" or whitespace before that
- */
-static int inifile_next_group(inifile *dba, const key_type *key, size_t *pos_grp_start TSRMLS_DC)
-{
- int ret = FAILURE;
- line_type ln = {{NULL,NULL},{NULL}};
-
- *pos_grp_start = php_stream_tell(dba->fp);
- ln.key.group = estrdup(key->group);
- while(inifile_read(dba, &ln TSRMLS_CC)) {
- if (inifile_key_cmp(&ln.key, key TSRMLS_CC) == 2) {
- ret = SUCCESS;
- break;
- }
- *pos_grp_start = php_stream_tell(dba->fp);
- }
- inifile_line_free(&ln);
- return ret;
-}
-/* }}} */
-
-/* {{{ inifile_copy_to
- */
-static int inifile_copy_to(inifile *dba, size_t pos_start, size_t pos_end, inifile **ini_copy TSRMLS_DC)
-{
- php_stream *fp;
-
- if (pos_start == pos_end) {
- *ini_copy = NULL;
- return SUCCESS;
- }
- if ((fp = php_stream_temp_create(0, 64 * 1024)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create temporary stream");
- *ini_copy = NULL;
- return FAILURE;
- }
-
- if ((*ini_copy = inifile_alloc(fp, 1, 0 TSRMLS_CC)) == NULL) {
- /* writes error */
- return FAILURE;
- }
- php_stream_seek(dba->fp, pos_start, SEEK_SET);
- if (!php_stream_copy_to_stream(dba->fp, fp, pos_end - pos_start)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not copy group [%d - %d] to temporary stream", pos_start, pos_end);
- return FAILURE;
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ inifile_filter
- * copy from to dba while ignoring key name (group must equal)
- */
-static int inifile_filter(inifile *dba, inifile *from, const key_type *key TSRMLS_DC)
-{
- size_t pos_start = 0, pos_next = 0, pos_curr;
- int ret = SUCCESS;
- line_type ln = {{NULL,NULL},{NULL}};
-
- php_stream_seek(from->fp, 0, SEEK_SET);
- php_stream_seek(dba->fp, 0, SEEK_END);
- while(inifile_read(from, &ln TSRMLS_CC)) {
- switch(inifile_key_cmp(&ln.key, key TSRMLS_CC)) {
- case 0:
- pos_curr = php_stream_tell(from->fp);
- if (pos_start != pos_next) {
- php_stream_seek(from->fp, pos_start, SEEK_SET);
- if (!php_stream_copy_to_stream(from->fp, dba->fp, pos_next - pos_start)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not copy [%d - %d] from temporary stream", pos_next, pos_start);
- ret = FAILURE;
- }
- php_stream_seek(from->fp, pos_curr, SEEK_SET);
- }
- pos_next = pos_start = pos_curr;
- break;
- case 1:
- pos_next = php_stream_tell(from->fp);
- break;
- case 2:
- /* the function is meant to process only entries from same group */
- assert(0);
- break;
- }
- }
- if (pos_start != pos_next) {
- php_stream_seek(from->fp, pos_start, SEEK_SET);
- if (!php_stream_copy_to_stream(from->fp, dba->fp, pos_next - pos_start)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not copy [%d - %d] from temporary stream", pos_next, pos_start);
- ret = FAILURE;
- }
- }
- inifile_line_free(&ln);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ inifile_delete_replace_append
- */
-static int inifile_delete_replace_append(inifile *dba, const key_type *key, const val_type *value, int append TSRMLS_DC)
-{
- size_t pos_grp_start, pos_grp_next;
- inifile *ini_tmp = NULL;
- php_stream *fp_tmp = NULL;
- int ret;
-
- /* 1) Search group start
- * 2) Search next group
- * 3) If not append: Copy group to ini_tmp
- * 4) Open temp_stream and copy remainder
- * 5) Truncate stream
- * 6) If not append AND key.name given: Filtered copy back from ini_tmp
- * to stream. Otherwise the user wanted to delete the group.
- * 7) Append value if given
- * 8) Append temporary stream
- */
-
- assert(!append || (key->name && value)); /* missuse */
-
- /* 1 - 3 */
- inifile_find_group(dba, key, &pos_grp_start TSRMLS_CC);
- inifile_next_group(dba, key, &pos_grp_next TSRMLS_CC);
- if (append) {
- ret = SUCCESS;
- } else {
- ret = inifile_copy_to(dba, pos_grp_start, pos_grp_next, &ini_tmp TSRMLS_CC);
- }
-
- /* 4 */
- if (ret == SUCCESS) {
- fp_tmp = php_stream_temp_create(0, 64 * 1024);
- if (!fp_tmp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create temporary stream");
- ret = FAILURE;
- } else {
- php_stream_seek(dba->fp, 0, SEEK_END);
- if (pos_grp_next != php_stream_tell(dba->fp)) {
- php_stream_seek(dba->fp, pos_grp_next, SEEK_SET);
- if (!php_stream_copy_to_stream(dba->fp, fp_tmp, PHP_STREAM_COPY_ALL)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not copy remainder to temporary stream");
- ret = FAILURE;
- }
- }
- }
- }
-
- /* 5 */
- if (ret == SUCCESS) {
- ret = inifile_truncate(dba, append ? pos_grp_next : pos_grp_start TSRMLS_CC); /* writes error on fail */
- }
-
- if (ret == SUCCESS) {
- if (key->name && strlen(key->name)) {
- /* 6 */
- if (!append && ini_tmp) {
- ret = inifile_filter(dba, ini_tmp, key TSRMLS_CC);
- }
-
- /* 7 */
- /* important: do not query ret==SUCCESS again: inifile_filter might fail but
- * however next operation must be done.
- */
- if (value) {
- if (pos_grp_start == pos_grp_next && key->group && strlen(key->group)) {
- php_stream_printf(dba->fp TSRMLS_CC, "[%s]\n", key->group);
- }
- php_stream_printf(dba->fp TSRMLS_CC, "%s=%s\n", key->name, value->value ? value->value : "");
- }
- }
-
- /* 8 */
- /* important: do not query ret==SUCCESS again: inifile_filter might fail but
- * however next operation must be done.
- */
- if (fp_tmp && php_stream_tell(fp_tmp)) {
- php_stream_seek(fp_tmp, 0, SEEK_SET);
- php_stream_seek(dba->fp, 0, SEEK_END);
- if (!php_stream_copy_to_stream(fp_tmp, dba->fp, PHP_STREAM_COPY_ALL)) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not copy from temporary stream - ini file truncated");
- ret = FAILURE;
- }
- }
- }
-
- if (ini_tmp) {
- php_stream_close(ini_tmp->fp);
- inifile_free(ini_tmp, 0);
- }
- if (fp_tmp) {
- php_stream_close(fp_tmp);
- }
- php_stream_flush(dba->fp);
- php_stream_seek(dba->fp, 0, SEEK_SET);
-
- return ret;
-}
-/* }}} */
-
-/* {{{ inifile_delete
- */
-int inifile_delete(inifile *dba, const key_type *key TSRMLS_DC)
-{
- return inifile_delete_replace_append(dba, key, NULL, 0 TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ inifile_relace
- */
-int inifile_replace(inifile *dba, const key_type *key, const val_type *value TSRMLS_DC)
-{
- return inifile_delete_replace_append(dba, key, value, 0 TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ inifile_append
- */
-int inifile_append(inifile *dba, const key_type *key, const val_type *value TSRMLS_DC)
-{
- return inifile_delete_replace_append(dba, key, value, 1 TSRMLS_CC);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dba/libinifile/inifile.h b/ext/dba/libinifile/inifile.h
deleted file mode 100644
index f0c17c369c..0000000000
--- a/ext/dba/libinifile/inifile.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_LIB_INIFILE_H
-#define PHP_LIB_INIFILE_H
-
-typedef struct {
- char *group;
- char *name;
-} key_type;
-
-typedef struct {
- char *value;
-} val_type;
-
-typedef struct {
- key_type key;
- val_type val;
- size_t pos;
-} line_type;
-
-typedef struct {
- char *lockfn;
- int lockfd;
- php_stream *fp;
- int fd;
- int readonly;
- line_type curr;
- line_type next;
-} inifile;
-
-val_type inifile_fetch(inifile *dba, const key_type *key, int skip TSRMLS_DC);
-int inifile_firstkey(inifile *dba TSRMLS_DC);
-int inifile_nextkey(inifile *dba TSRMLS_DC);
-int inifile_delete(inifile *dba, const key_type *key TSRMLS_DC);
-int inifile_replace(inifile *dba, const key_type *key, const val_type *val TSRMLS_DC);
-int inifile_append(inifile *dba, const key_type *key, const val_type *val TSRMLS_DC);
-char *inifile_version();
-
-key_type inifile_key_split(const char *group_name);
-char * inifile_key_string(const key_type *key);
-
-void inifile_key_free(key_type *key);
-void inifile_val_free(val_type *val);
-void inifile_line_free(line_type *ln);
-
-inifile * inifile_alloc(php_stream *fp, int readonly, int persistent TSRMLS_DC);
-void inifile_free(inifile *dba, int persistent);
-
-#endif
diff --git a/ext/dba/php_cdb.h b/ext/dba/php_cdb.h
deleted file mode 100644
index a046f0796b..0000000000
--- a/ext/dba/php_cdb.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef PHP_CDB_H
-#define PHP_CDB_H
-
-#if DBA_CDB
-
-#include "php_dba.h"
-
-DBA_FUNCS(cdb);
-
-#endif
-
-#endif
diff --git a/ext/dba/php_db2.h b/ext/dba/php_db2.h
deleted file mode 100644
index 2a95223a85..0000000000
--- a/ext/dba/php_db2.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef PHP_DB2_H
-#define PHP_DB2_H
-
-#if DBA_DB2
-
-#include "php_dba.h"
-
-DBA_FUNCS(db2);
-
-#endif
-
-#endif
diff --git a/ext/dba/php_db3.h b/ext/dba/php_db3.h
deleted file mode 100644
index 58bb0b62a0..0000000000
--- a/ext/dba/php_db3.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef PHP_DB3_H
-#define PHP_DB3_H
-
-#if DBA_DB3
-
-#include "php_dba.h"
-
-DBA_FUNCS(db3);
-
-#endif
-
-#endif
diff --git a/ext/dba/php_db4.h b/ext/dba/php_db4.h
deleted file mode 100644
index fa814c3f5e..0000000000
--- a/ext/dba/php_db4.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef PHP_DB4_H
-#define PHP_DB4_H
-
-#if DBA_DB4
-
-#include "php_dba.h"
-
-DBA_FUNCS(db4);
-
-#endif
-
-#endif
diff --git a/ext/dba/php_dba.h b/ext/dba/php_dba.h
deleted file mode 100644
index 1133de6bc9..0000000000
--- a/ext/dba/php_dba.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_DBA_H
-#define PHP_DBA_H
-
-#if HAVE_DBA
-
-typedef enum {
- /* do not allow 0 here */
- DBA_READER = 1,
- DBA_WRITER,
- DBA_TRUNC,
- DBA_CREAT
-} dba_mode_t;
-
-typedef struct dba_lock {
- php_stream *fp;
- char *name;
- int mode; /* LOCK_EX,LOCK_SH */
-} dba_lock;
-
-typedef struct dba_info {
- /* public */
- void *dbf; /* ptr to private data or whatever */
- char *path;
- dba_mode_t mode;
- php_stream *fp; /* this is the database stream for builtin handlers */
- /* arg[cv] are only available when the dba_open handler is called! */
- int argc;
- zval ***argv;
- /* private */
- int flags; /* whether and how dba did locking and other flags*/
- struct dba_handler *hnd;
- dba_lock lock;
-} dba_info;
-
-#define DBA_LOCK_READER (0x0001)
-#define DBA_LOCK_WRITER (0x0002)
-#define DBA_LOCK_CREAT (0x0004)
-#define DBA_LOCK_TRUNC (0x0008)
-
-#define DBA_LOCK_EXT (0)
-#define DBA_LOCK_ALL (DBA_LOCK_READER|DBA_LOCK_WRITER|DBA_LOCK_CREAT|DBA_LOCK_TRUNC)
-#define DBA_LOCK_WCT (DBA_LOCK_WRITER|DBA_LOCK_CREAT|DBA_LOCK_TRUNC)
-
-#define DBA_STREAM_OPEN (0x0010)
-#define DBA_PERSISTENT (0x0020)
-
-extern zend_module_entry dba_module_entry;
-#define dba_module_ptr &dba_module_entry
-
-typedef struct dba_handler {
- char *name; /* handler name */
- int flags; /* whether and how dba does locking and other flags*/
- int (*open)(dba_info *, char **error TSRMLS_DC);
- void (*close)(dba_info * TSRMLS_DC);
- char* (*fetch)(dba_info *, char *, int, int, int * TSRMLS_DC);
- int (*update)(dba_info *, char *, int, char *, int, int TSRMLS_DC);
- int (*exists)(dba_info *, char *, int TSRMLS_DC);
- int (*delete)(dba_info *, char *, int TSRMLS_DC);
- char* (*firstkey)(dba_info *, int * TSRMLS_DC);
- char* (*nextkey)(dba_info *, int * TSRMLS_DC);
- int (*optimize)(dba_info * TSRMLS_DC);
- int (*sync)(dba_info * TSRMLS_DC);
- char* (*info)(struct dba_handler *hnd, dba_info * TSRMLS_DC);
- /* dba_info==NULL: Handler info, dba_info!=NULL: Database info */
-} dba_handler;
-
-/* common prototypes which must be supplied by modules */
-
-#define DBA_OPEN_FUNC(x) \
- int dba_open_##x(dba_info *info, char **error TSRMLS_DC)
-#define DBA_CLOSE_FUNC(x) \
- void dba_close_##x(dba_info *info TSRMLS_DC)
-#define DBA_FETCH_FUNC(x) \
- char *dba_fetch_##x(dba_info *info, char *key, int keylen, int skip, int *newlen TSRMLS_DC)
-#define DBA_UPDATE_FUNC(x) \
- int dba_update_##x(dba_info *info, char *key, int keylen, char *val, int vallen, int mode TSRMLS_DC)
-#define DBA_EXISTS_FUNC(x) \
- int dba_exists_##x(dba_info *info, char *key, int keylen TSRMLS_DC)
-#define DBA_DELETE_FUNC(x) \
- int dba_delete_##x(dba_info *info, char *key, int keylen TSRMLS_DC)
-#define DBA_FIRSTKEY_FUNC(x) \
- char *dba_firstkey_##x(dba_info *info, int *newlen TSRMLS_DC)
-#define DBA_NEXTKEY_FUNC(x) \
- char *dba_nextkey_##x(dba_info *info, int *newlen TSRMLS_DC)
-#define DBA_OPTIMIZE_FUNC(x) \
- int dba_optimize_##x(dba_info *info TSRMLS_DC)
-#define DBA_SYNC_FUNC(x) \
- int dba_sync_##x(dba_info *info TSRMLS_DC)
-#define DBA_INFO_FUNC(x) \
- char *dba_info_##x(dba_handler *hnd, dba_info *info TSRMLS_DC)
-
-#define DBA_FUNCS(x) \
- DBA_OPEN_FUNC(x); \
- DBA_CLOSE_FUNC(x); \
- DBA_FETCH_FUNC(x); \
- DBA_UPDATE_FUNC(x); \
- DBA_DELETE_FUNC(x); \
- DBA_EXISTS_FUNC(x); \
- DBA_FIRSTKEY_FUNC(x); \
- DBA_NEXTKEY_FUNC(x); \
- DBA_OPTIMIZE_FUNC(x); \
- DBA_SYNC_FUNC(x); \
- DBA_INFO_FUNC(x)
-
-#define VALLEN(p) Z_STRVAL_PP(p), Z_STRLEN_PP(p)
-
-PHP_FUNCTION(dba_open);
-PHP_FUNCTION(dba_popen);
-PHP_FUNCTION(dba_close);
-PHP_FUNCTION(dba_firstkey);
-PHP_FUNCTION(dba_nextkey);
-PHP_FUNCTION(dba_replace);
-PHP_FUNCTION(dba_insert);
-PHP_FUNCTION(dba_delete);
-PHP_FUNCTION(dba_exists);
-PHP_FUNCTION(dba_fetch);
-PHP_FUNCTION(dba_optimize);
-PHP_FUNCTION(dba_sync);
-PHP_FUNCTION(dba_handlers);
-PHP_FUNCTION(dba_list);
-
-#else
-#define dba_module_ptr NULL
-#endif
-
-#define phpext_dba_ptr dba_module_ptr
-
-#endif
diff --git a/ext/dba/php_dbm.h b/ext/dba/php_dbm.h
deleted file mode 100644
index 4c963d18ed..0000000000
--- a/ext/dba/php_dbm.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef PHP_DBM_H
-#define PHP_DBM_H
-
-#if DBA_DBM
-
-#include "php_dba.h"
-
-DBA_FUNCS(dbm);
-
-#endif
-
-#endif
diff --git a/ext/dba/php_flatfile.h b/ext/dba/php_flatfile.h
deleted file mode 100644
index afa9f6d5d3..0000000000
--- a/ext/dba/php_flatfile.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef PHP_FLATFILE_H
-#define PHP_FLATFILE_H
-
-#if DBA_FLATFILE
-
-#include "php_dba.h"
-
-DBA_FUNCS(flatfile);
-
-#endif
-
-#endif
diff --git a/ext/dba/php_gdbm.h b/ext/dba/php_gdbm.h
deleted file mode 100644
index 3068404cfe..0000000000
--- a/ext/dba/php_gdbm.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef PHP_GDBM_H
-#define PHP_GDBM_H
-
-#if DBA_GDBM
-
-#include "php_dba.h"
-
-DBA_FUNCS(gdbm);
-
-#endif
-
-#endif
diff --git a/ext/dba/php_inifile.h b/ext/dba/php_inifile.h
deleted file mode 100644
index 69444df3c6..0000000000
--- a/ext/dba/php_inifile.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef PHP_INIFILE_H
-#define PHP_INIFILE_H
-
-#if DBA_INIFILE
-
-#include "php_dba.h"
-
-DBA_FUNCS(inifile);
-
-#endif
-
-#endif
diff --git a/ext/dba/php_ndbm.h b/ext/dba/php_ndbm.h
deleted file mode 100644
index b1ebf15af3..0000000000
--- a/ext/dba/php_ndbm.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef PHP_NDBM_H
-#define PHP_NDBM_H
-
-#if DBA_NDBM
-
-#include "php_dba.h"
-
-DBA_FUNCS(ndbm);
-
-#endif
-
-#endif
diff --git a/ext/dba/tests/dba001.phpt b/ext/dba/tests/dba001.phpt
deleted file mode 100644
index 3d617fb2c2..0000000000
--- a/ext/dba/tests/dba001.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-DBA File Creation Test
---SKIPIF--
-<?php
- require_once('skipif.inc');
- die("info $HND handler used");
-?>
---FILE--
-<?php
- require_once('test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- echo "database file created\n";
- dba_close($db_file);
- } else {
- echo "$db_file does not exist\n";
- }
-?>
---EXPECTF--
-database handler: %s
-database file created \ No newline at end of file
diff --git a/ext/dba/tests/dba002.phpt b/ext/dba/tests/dba002.phpt
deleted file mode 100644
index 3f862e38c5..0000000000
--- a/ext/dba/tests/dba002.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-DBA Insert/Fetch Test
---SKIPIF--
-<?php
- require_once('skipif.inc');
- die("info $HND handler used");
-?>
---FILE--
-<?php
- require_once('test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("key1", "This is a test insert", $db_file);
- echo dba_fetch("key1", $db_file);
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
-?>
---EXPECTF--
-database handler: %s
-This is a test insert
diff --git a/ext/dba/tests/dba003.phpt b/ext/dba/tests/dba003.phpt
deleted file mode 100644
index 617ae91891..0000000000
--- a/ext/dba/tests/dba003.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-DBA Insert/Replace/Fetch Test
---SKIPIF--
-<?php
- require_once('skipif.inc');
- die("info $HND handler used");
-?>
---FILE--
-<?php
- require_once('test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("key1", "This is a test insert", $db_file);
- dba_replace("key1", "This is the replacement text", $db_file);
- $a = dba_fetch("key1", $db_file);
- dba_close($db_file);
- echo $a;
- } else {
- echo "Error creating database\n";
- }
-?>
---EXPECTF--
-database handler: %s
-This is the replacement text
diff --git a/ext/dba/tests/dba004.phpt b/ext/dba/tests/dba004.phpt
deleted file mode 100644
index 3b1f29c7dd..0000000000
--- a/ext/dba/tests/dba004.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-DBA Multiple Insert/Fetch Test
---SKIPIF--
-<?php
- require_once('skipif.inc');
- die("info $HND handler used");
-?>
---FILE--
-<?php
- require_once('test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("key1", "Content String 1", $db_file);
- dba_insert("key2", "Content String 2", $db_file);
- dba_insert("key3", "Third Content String", $db_file);
- dba_insert("key4", "Another Content String", $db_file);
- dba_insert("key5", "The last content string", $db_file);
- $a = dba_fetch("key4", $db_file);
- $b = dba_fetch("key2", $db_file);
- dba_close($db_file);
- echo "$a $b";
- } else {
- echo "Error creating database\n";
- }
-?>
---EXPECTF--
-database handler: %s
-Another Content String Content String 2
diff --git a/ext/dba/tests/dba005.phpt b/ext/dba/tests/dba005.phpt
deleted file mode 100644
index 5a933c48f9..0000000000
--- a/ext/dba/tests/dba005.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-DBA FirstKey/NextKey Loop Test With 5 Items
---SKIPIF--
-<?php
- require_once('skipif.inc');
- die("info $HND handler used");
-?>
---FILE--
-<?php
- require_once('test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("key1", "Content String 1", $db_file);
- dba_insert("key2", "Content String 2", $db_file);
- dba_insert("key3", "Third Content String", $db_file);
- dba_insert("key4", "Another Content String", $db_file);
- dba_insert("key5", "The last content string", $db_file);
- $a = dba_firstkey($db_file);
- $i=0;
- while($a) {
- $a = dba_nextkey($db_file);
- $i++;
- }
- echo $i;
- for ($i=1; $i<6; $i++) {
- echo dba_exists("key$i", $db_file) ? "Y" : "N";
- }
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
-?>
---EXPECTF--
-database handler: %s
-5YYYYY
diff --git a/ext/dba/tests/dba006.phpt b/ext/dba/tests/dba006.phpt
deleted file mode 100644
index efa36a5d07..0000000000
--- a/ext/dba/tests/dba006.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-DBA FirstKey/NextKey with 2 deletes
---SKIPIF--
-<?php
- require_once('skipif.inc');
- die("info $HND handler used");
-?>
---FILE--
-<?php
- require_once('test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("key1", "Content String 1", $db_file);
- dba_insert("key2", "Content String 2", $db_file);
- dba_insert("key3", "Third Content String", $db_file);
- dba_insert("key4", "Another Content String", $db_file);
- dba_insert("key5", "The last content string", $db_file);
- dba_delete("key3", $db_file);
- dba_delete("key1", $db_file);
- $a = dba_firstkey($db_file);
- $i=0;
- while($a) {
- $a = dba_nextkey($db_file);
- $i++;
- }
- echo $i;
- for ($i=1; $i<6; $i++) {
- echo dba_exists("key$i", $db_file) ? "Y" : "N";
- }
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
-?>
---EXPECTF--
-database handler: %s
-3NYNYY \ No newline at end of file
diff --git a/ext/dba/tests/dba007.phpt b/ext/dba/tests/dba007.phpt
deleted file mode 100644
index 0add3809aa..0000000000
--- a/ext/dba/tests/dba007.phpt
+++ /dev/null
@@ -1,45 +0,0 @@
---TEST--
-DBA Multiple File Creation Test
---SKIPIF--
-<?php
- require_once('skipif.inc');
- if (!function_exists('dba_list')) die('skip dba_list() not available');
- die("info $HND handler used");
-?>
---FILE--
-<?php
- require_once('test.inc');
- echo "database handler: $handler\n";
- $db_file1 = dirname(__FILE__).'/test1.dbm';
- $db_file2 = dirname(__FILE__).'/test2.dbm';
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- echo "database file created\n";
- } else {
- echo "$db_file does not exist\n";
- }
- if (($db_file1=dba_open($db_file1, "n", $handler))!==FALSE) {
- echo "database file created\n";
- } else {
- echo "$db_file does not exist\n";
- }
- if (($db_file2=dba_open($db_file2, "n", $handler))!==FALSE) {
- echo "database file created\n";
- } else {
- echo "$db_file does not exist\n";
- }
- var_dump(dba_list());
- dba_close($db_file);
-?>
---EXPECTF--
-database handler: %s
-database file created
-database file created
-database file created
-array(3) {
- [%d]=>
- string(%d) "%sext/dba/tests/test0.dbm"
- [%d]=>
- string(%d) "%sext/dba/tests/test1.dbm"
- [%d]=>
- string(%d) "%sext/dba/tests/test2.dbm"
-} \ No newline at end of file
diff --git a/ext/dba/tests/dba008.phpt b/ext/dba/tests/dba008.phpt
deleted file mode 100644
index 84a47ba083..0000000000
--- a/ext/dba/tests/dba008.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-DBA magic_quotes_runtime Test
---SKIPIF--
-<?php
- require_once('skipif.inc');
- die("info $HND handler used");
-?>
---FILE--
-<?php
- require_once('test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- ini_set('magic_quotes_runtime', 0);
- dba_insert("key1", '"', $db_file);
- var_dump(dba_fetch("key1", $db_file));
- ini_set('magic_quotes_runtime', 1);
- var_dump(dba_fetch("key1", $db_file));
- dba_replace("key1", '\"', $db_file);
- var_dump(dba_fetch("key1", $db_file));
- ini_set('magic_quotes_runtime', 0);
- var_dump(dba_fetch("key1", $db_file));
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
-?>
---EXPECTF--
-database handler: %s
-string(1) """
-string(2) "\""
-string(2) "\""
-string(1) """
diff --git a/ext/dba/tests/dba009.phpt b/ext/dba/tests/dba009.phpt
deleted file mode 100755
index 50a50c6bd5..0000000000
--- a/ext/dba/tests/dba009.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-DBA dba_popen Test
---SKIPIF--
-<?php
- require_once('skipif.inc');
- print("info $HND handler used");
-?>
---FILE--
-<?php
- require_once('test.inc');
- echo "database handler: $handler\n";
- if (($db=dba_popen($db_file, "n", $handler))!==FALSE) {
- echo "Opened\n";
- dba_insert("a", "Inserted", $db);
- echo dba_fetch("a", $db)."\n";
- dba_close($db);
- echo "Closed\n";
- } else {
- echo "Error creating database\n";
- }
- if (($db=dba_popen($db_file, "n", $handler))!==FALSE) {
- echo "Opened\n";
- dba_insert("a", "Inserted", $db);
- echo dba_fetch("a", $db)."\n";
- }
-?>
---EXPECTF--
-database handler: %s
-Opened
-Inserted
-Closed
-Opened
-Inserted
diff --git a/ext/dba/tests/dba_cdb.phpt b/ext/dba/tests/dba_cdb.phpt
deleted file mode 100644
index af64dae5a6..0000000000
--- a/ext/dba/tests/dba_cdb.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-DBA CDB handler test
---SKIPIF--
-<?php
- $handler = 'cdb';
- require_once('skipif.inc');
- die('info CDB does not support replace or delete');
-?>
---FILE--
-<?php
- $handler = 'cdb';
- require_once('test.inc');
- require_once('dba_handler.inc');
-?>
---EXPECT--
-database handler: cdb
-5YYYYY
-Content String 2
-array(5) {
- ["key1"]=>
- string(16) "Content String 1"
- ["key2"]=>
- string(16) "Content String 2"
- ["key3"]=>
- string(20) "Third Content String"
- ["key4"]=>
- string(22) "Another Content String"
- ["key5"]=>
- string(23) "The last content string"
-}
diff --git a/ext/dba/tests/dba_cdb_make.phpt b/ext/dba/tests/dba_cdb_make.phpt
deleted file mode 100644
index 77f764dbe0..0000000000
--- a/ext/dba/tests/dba_cdb_make.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-DBA CDB_MAKE handler test
---INI--
-magic_quotes_runtime=1
---SKIPIF--
-<?php
- $handler = 'cdb_make';
- require_once('skipif.inc');
- die('info CDB_MAKE does not support reading');
-?>
---FILE--
-<?php
- $handler = 'cdb_make';
- require_once('test.inc');
- echo "database handler: $handler\n";
- // print md5 checksum of test.cdb which is generated by cdb_make program
- var_dump(md5(implode('',file(dirname(__FILE__).'/test.cdb'))));
- if (($db_make=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("1", "1", $db_make);
- dba_insert("2", "2", $db_make);
- dba_insert("1", "3", $db_make);
- dba_insert("2", "1", $db_make);
- dba_insert("3", "3", $db_make);
- dba_insert("1", "2", $db_make);
- dba_insert("4", "4", $db_make);
-// dba_replace cdb_make doesn't know replace
- dba_close($db_make);
- // write md5 checksum of generated database file
- var_dump(md5(implode('',file($db_file))));
- // no need to test created database: this is done by dba_cdb_read.phpt
- } else {
- echo "Error creating database\n";
- }
-?>
---EXPECT--
-database handler: cdb_make
-string(32) "723d19f39c1b15b3b455dd64323148d1"
-string(32) "723d19f39c1b15b3b455dd64323148d1" \ No newline at end of file
diff --git a/ext/dba/tests/dba_cdb_read.phpt b/ext/dba/tests/dba_cdb_read.phpt
deleted file mode 100644
index a0fbe7bcca..0000000000
--- a/ext/dba/tests/dba_cdb_read.phpt
+++ /dev/null
@@ -1,65 +0,0 @@
---TEST--
-DBA CDB handler test (read only)
---SKIPIF--
-<?php
- $handler = 'cdb_make';
- require_once('skipif.inc');
-?>
---FILE--
-<?php
- echo "database handler: cdb\n";
- $handler = 'cdb';
- $db_file = dirname(__FILE__).'/test.cdb';
- if (($db_file=dba_open($db_file, "r", $handler))!==FALSE) {
- // read key sequence
- $a = dba_firstkey($db_file);
- $count= 0;
- $keys = $a;
- while($a) {
- $a = dba_nextkey($db_file);
- $keys .= $a;
- $count++;
- }
- // display number of entries and key existance
- echo $count;
- for ($i=1; $i<8; $i++) {
- echo dba_exists($i, $db_file) ? "Y" : "N";
- }
- echo "\n=";
- echo dba_fetch(1, $db_file);
- echo dba_fetch(2, $db_file);
- echo dba_fetch(3, $db_file);
- echo dba_fetch(4, $db_file);
- echo "\n#";
- echo dba_fetch(1, $db_file);
- echo dba_fetch(1, $db_file);
- echo dba_fetch(2, $db_file);
- echo dba_fetch(2, $db_file);
- echo "\n?".$keys;
- // with skip = 0 dba_fetch must fetch the first result
- echo "\n#";
- $skip = array();
- for ($i=0; $i < strlen($keys); $i++) {
- $key = substr($keys, $i, 1);
- $skip[$key] = 0;
- echo dba_fetch($key, $db_file);
- }
- echo "\n=";
- for ($i=0; $i < strlen($keys); $i++) {
- $key = substr($keys, $i, 1);
- echo dba_fetch($key, $skip[$key], $db_file);
- $skip[$key]++;
- }
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
-?>
---EXPECT--
-database handler: cdb
-7YYYYNNN
-=1234
-#1122
-?1212314
-#1212314
-=1231324 \ No newline at end of file
diff --git a/ext/dba/tests/dba_db2.phpt b/ext/dba/tests/dba_db2.phpt
deleted file mode 100644
index 2e93b785d3..0000000000
--- a/ext/dba/tests/dba_db2.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-DBA DB2 handler test
---SKIPIF--
-<?php
- $handler = 'db2';
- require_once('skipif.inc');
-?>
---FILE--
-<?php
- $handler = 'db2';
- require_once('test.inc');
- require_once('dba_handler.inc');
-?>
---EXPECT--
-database handler: db2
-3NYNYY
-Content String 2
-Content 2 replaced
-Read during write: not allowed
-Content 2 replaced 2nd time
-The 6th value
-array(3) {
- ["key number 6"]=>
- string(13) "The 6th value"
- ["key2"]=>
- string(27) "Content 2 replaced 2nd time"
- ["key5"]=>
- string(23) "The last content string"
-} \ No newline at end of file
diff --git a/ext/dba/tests/dba_db3.phpt b/ext/dba/tests/dba_db3.phpt
deleted file mode 100644
index aa389d5f26..0000000000
--- a/ext/dba/tests/dba_db3.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-DBA DB3 handler test
---SKIPIF--
-<?php
- $handler = 'db3';
- require_once('skipif.inc');
-?>
---FILE--
-<?php
- $handler = 'db3';
- require_once('test.inc');
- require_once('dba_handler.inc');
-?>
---EXPECT--
-database handler: db3
-3NYNYY
-Content String 2
-Content 2 replaced
-Read during write: not allowed
-Content 2 replaced 2nd time
-The 6th value
-array(3) {
- ["key number 6"]=>
- string(13) "The 6th value"
- ["key2"]=>
- string(27) "Content 2 replaced 2nd time"
- ["key5"]=>
- string(23) "The last content string"
-} \ No newline at end of file
diff --git a/ext/dba/tests/dba_db4.phpt b/ext/dba/tests/dba_db4.phpt
deleted file mode 100644
index fc5b3171f8..0000000000
--- a/ext/dba/tests/dba_db4.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-DBA DB4 handler test
---SKIPIF--
-<?php
- $handler = 'db4';
- require_once('skipif.inc');
-?>
---FILE--
-<?php
- $handler = 'db4';
- require_once('test.inc');
- require_once('dba_handler.inc');
-?>
---EXPECT--
-database handler: db4
-3NYNYY
-Content String 2
-Content 2 replaced
-Read during write: not allowed
-Content 2 replaced 2nd time
-The 6th value
-array(3) {
- ["key number 6"]=>
- string(13) "The 6th value"
- ["key2"]=>
- string(27) "Content 2 replaced 2nd time"
- ["key5"]=>
- string(23) "The last content string"
-}
diff --git a/ext/dba/tests/dba_dbm.phpt b/ext/dba/tests/dba_dbm.phpt
deleted file mode 100644
index e751cf60cf..0000000000
--- a/ext/dba/tests/dba_dbm.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-DBA DBM handler test
---SKIPIF--
-<?php
- $handler = 'dbm';
- require_once('skipif.inc');
-?>
---FILE--
-<?php
- $handler = 'dbm';
- require_once('test.inc');
- require_once('dba_handler.inc');
-?>
---EXPECT--
-database handler: dbm
-3NYNYY
-Content String 2
-Content 2 replaced
-Read during write: not allowed
-Content 2 replaced 2nd time
-The 6th value
-array(3) {
- ["key number 6"]=>
- string(13) "The 6th value"
- ["key2"]=>
- string(27) "Content 2 replaced 2nd time"
- ["key5"]=>
- string(23) "The last content string"
-}
diff --git a/ext/dba/tests/dba_flatfile.phpt b/ext/dba/tests/dba_flatfile.phpt
deleted file mode 100644
index 8e259cb965..0000000000
--- a/ext/dba/tests/dba_flatfile.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-DBA FlatFile handler test
---SKIPIF--
-<?php
- $handler = 'flatfile';
- require_once('skipif.inc');
-?>
---FILE--
-<?php
- $handler = 'flatfile';
- require_once('test.inc');
- require_once('dba_handler.inc');
-?>
---EXPECT--
-database handler: flatfile
-3NYNYY
-Content String 2
-Content 2 replaced
-Read during write: not allowed
-Content 2 replaced 2nd time
-The 6th value
-array(3) {
- ["key number 6"]=>
- string(13) "The 6th value"
- ["key2"]=>
- string(27) "Content 2 replaced 2nd time"
- ["key5"]=>
- string(23) "The last content string"
-} \ No newline at end of file
diff --git a/ext/dba/tests/dba_gdbm.phpt b/ext/dba/tests/dba_gdbm.phpt
deleted file mode 100644
index b5d3c19ccd..0000000000
--- a/ext/dba/tests/dba_gdbm.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-DBA GDBM handler test
---SKIPIF--
-<?php
- $handler = 'gdbm';
- require_once('skipif.inc');
-?>
---FILE--
-<?php
- $handler = 'gdbm';
- require_once('test.inc');
- $lock_flag = ''; // lock in library
- require_once('dba_handler.inc');
-
- // Read during write is system dependant. Important is that there is no deadlock
-?>
---EXPECTF--
-database handler: gdbm
-3NYNYY
-Content String 2
-Content 2 replaced
-Read during write:%sallowed
-Content 2 replaced 2nd time
-The 6th value
-array(3) {
- ["key number 6"]=>
- string(13) "The 6th value"
- ["key2"]=>
- string(27) "Content 2 replaced 2nd time"
- ["key5"]=>
- string(23) "The last content string"
-} \ No newline at end of file
diff --git a/ext/dba/tests/dba_handler.inc b/ext/dba/tests/dba_handler.inc
deleted file mode 100644
index b2e73d6237..0000000000
--- a/ext/dba/tests/dba_handler.inc
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
- echo "database handler: $handler\n";
- if (($db_file = dba_open($db_filename, 'n'.$lock_flag, $handler))!==FALSE) {
- dba_insert("key1", "Content String 1", $db_file);
- dba_insert("key2", "Content String 2", $db_file);
- dba_insert("key3", "Third Content String", $db_file);
- dba_insert("key4", "Another Content String", $db_file);
- dba_insert("key5", "The last content string", $db_file);
- if ($handler != 'cdb') {
- dba_delete("key3", $db_file);
- dba_delete("key1", $db_file);
- } else {
- dba_close($db_file);
- if (($db_file = dba_open($db_filename, 'r'.$lock_flag, $handler))===FALSE) {
- echo "Error reopening database\n";
- }
- }
- $a = dba_firstkey($db_file);
- $i=0;
- while($a) {
- $a = dba_nextkey($db_file);
- $i++;
- }
- echo $i;
- for ($i=1; $i<6; $i++) {
- echo dba_exists("key$i", $db_file) ? "Y" : "N";
- }
- echo "\n";
- echo dba_fetch("key2", $db_file)."\n";
- if ($handler != 'cdb') {
- dba_replace("key2", "Content 2 replaced", $db_file);
- echo dba_fetch("key2", $db_file)."\n";
- }
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
- if ($handler != 'cdb') {
- $db_writer = dba_open($db_filename, 'w'.$lock_flag, $handler);
- if (($dba_reader = @dba_open($db_filename, 'r'.$lock_flag.($lock_flag ? 't' : ''), $handler))===false) {
- echo "Read during write: not allowed\n";
- } else {
- echo "Read during write: allowed\n";
- }
- if ($db_writer!==FALSE) {
- dba_insert("key number 6", "The 6th value", $db_writer);
- @dba_insert("key number 6", "The 6th value inserted again would be an error", $db_writer);
- dba_replace("key2", "Content 2 replaced 2nd time", $db_writer);
- dba_delete("key4", $db_writer);
- echo dba_fetch("key2", $db_writer)."\n";
- echo dba_fetch("key number 6", $db_writer)."\n";
- dba_close($db_writer); // when the writer is open at least db3 would fail because of buffered io.
- } else {
- die("Error reopening database\n");
- }
- }
- if (($db_file = dba_open($db_filename, 'r'.$lock_flag, $handler))!==FALSE) {
- $key = dba_firstkey($db_file);
- $res = array();
- while($key) {
- $res[$key] = dba_fetch($key, $db_file);
- $key = dba_nextkey($db_file);
- }
- ksort($res);
- var_dump($res);
- dba_close($db_file);
- } else {
- echo "Error reading database\n";
- }
- if (!empty($dba_reader)) {
- dba_close($dba_reader);
- }
- if (($db_file = dba_popen($db_filename, 'r'.($handler!='gdbm'?'-':''), $handler))!==FALSE) {
- }
-?> \ No newline at end of file
diff --git a/ext/dba/tests/dba_inifile.phpt b/ext/dba/tests/dba_inifile.phpt
deleted file mode 100644
index 11ca19e3b6..0000000000
--- a/ext/dba/tests/dba_inifile.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-DBA INIFILE handler test
---SKIPIF--
-<?php
- $handler = 'inifile';
- require_once('skipif.inc');
-?>
---FILE--
-<?php
- $handler = 'inifile';
- require_once('test.inc');
- require_once('dba_handler.inc');
-?>
---EXPECT--
-database handler: inifile
-3NYNYY
-Content String 2
-Content 2 replaced
-Read during write: not allowed
-Content 2 replaced 2nd time
-The 6th value
-array(3) {
- ["key number 6"]=>
- string(13) "The 6th value"
- ["key2"]=>
- string(27) "Content 2 replaced 2nd time"
- ["key5"]=>
- string(23) "The last content string"
-} \ No newline at end of file
diff --git a/ext/dba/tests/dba_ndbm.phpt b/ext/dba/tests/dba_ndbm.phpt
deleted file mode 100644
index 537f025564..0000000000
--- a/ext/dba/tests/dba_ndbm.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-DBA NDBM handler test
---SKIPIF--
-<?php
- $handler = 'ndbm';
- require_once('skipif.inc');
-?>
---FILE--
-<?php
- $handler = 'ndbm';
- require_once('test.inc');
- require_once('dba_handler.inc');
-?>
---EXPECT--
-database handler: ndbm
-3NYNYY
-Content String 2
-Content 2 replaced
-Read during write: not allowed
-Content 2 replaced 2nd time
-The 6th value
-array(3) {
- ["key number 6"]=>
- string(13) "The 6th value"
- ["key2"]=>
- string(27) "Content 2 replaced 2nd time"
- ["key5"]=>
- string(23) "The last content string"
-} \ No newline at end of file
diff --git a/ext/dba/tests/skipif.inc b/ext/dba/tests/skipif.inc
deleted file mode 100644
index 1aa9b6a179..0000000000
--- a/ext/dba/tests/skipif.inc
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
- if (!extension_loaded('dba')) die('skip dba extension not available');
- if (!function_exists('dba_handlers')) die ('skip dba_handlers() not available');
- if (!sizeof(dba_handlers())) die('skip no handlers installed');
- if (!isset($handler)) {
- $handlers = dba_handlers();
- if (in_array('flatfile', $handlers)) {
- $handler = 'flatfile';
- } else {
- $handler = array_diff($handlers, array('cdb', 'cdb_make')); /* these can only read OR write */
- if (count($handler)==0) {
- die('skip no handler available that can be used for the test');
- }
- $handler = array_shift($handlers);
- }
- } else {
- if (!in_array($handler, dba_handlers())) {
- $HND = strtoupper($handler);
- die("skip $HND handler not available");
- }
- }
- $HND = strtoupper($handler);
-?>
diff --git a/ext/dba/tests/test.cdb b/ext/dba/tests/test.cdb
deleted file mode 100644
index 21529c6280..0000000000
--- a/ext/dba/tests/test.cdb
+++ /dev/null
Binary files differ
diff --git a/ext/dba/tests/test.inc b/ext/dba/tests/test.inc
deleted file mode 100644
index 04f954541c..0000000000
--- a/ext/dba/tests/test.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
- require_once('skipif.inc');
- $lock_flag = 'l';
- $db_filename = $db_file = dirname(__FILE__).'/test0.dbm';
- @unlink($db_filename);
- @unlink($db_filename.'.lck');
-?>
diff --git a/ext/dbase/CREDITS b/ext/dbase/CREDITS
deleted file mode 100644
index ea6adcaf41..0000000000
--- a/ext/dbase/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-dBase
-Jim Winstead
diff --git a/ext/dbase/config.m4 b/ext/dbase/config.m4
deleted file mode 100644
index d19c24c779..0000000000
--- a/ext/dbase/config.m4
+++ /dev/null
@@ -1,13 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_ARG_WITH(dbase,[],[enable_dbase=$withval])
-
-PHP_ARG_ENABLE(dbase,whether to enable dbase support,
-[ --enable-dbase Enable the bundled dbase library])
-
-if test "$PHP_DBASE" = "yes"; then
- AC_DEFINE(DBASE,1,[ ])
- PHP_NEW_EXTENSION(dbase, dbf_head.c dbf_rec.c dbf_misc.c dbf_ndx.c dbase.c, $ext_shared)
-fi
diff --git a/ext/dbase/dbase.c b/ext/dbase/dbase.c
deleted file mode 100644
index b82debfef2..0000000000
--- a/ext/dbase/dbase.c
+++ /dev/null
@@ -1,775 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "safe_mode.h"
-#include "fopen_wrappers.h"
-#include "php_globals.h"
-
-#include <stdlib.h>
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#if DBASE
-#include "php_dbase.h"
-#include "dbf.h"
-#if defined(THREAD_SAFE)
-DWORD DbaseTls;
-static int numthreads=0;
-void *dbase_mutex;
-
-typedef struct dbase_global_struct{
- int le_dbhead;
-}dbase_global_struct;
-
-#define DBase_GLOBAL(a) dbase_globals->a
-
-#define DBase_TLS_VARS \
- dbase_global_struct *dbase_globals; \
- dbase_globals=TlsGetValue(DbaseTls);
-
-#else
-static int le_dbhead;
-#define DBase_GLOBAL(a) a
-#define DBase_TLS_VARS
-#endif
-
-#include <fcntl.h>
-#include <errno.h>
-
-
-static void _close_dbase(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- dbhead_t *dbhead = (dbhead_t *)rsrc->ptr;
-
- close(dbhead->db_fd);
- free_dbf_head(dbhead);
-}
-
-
-PHP_MINIT_FUNCTION(dbase)
-{
-#if defined(THREAD_SAFE)
- dbase_global_struct *dbase_globals;
-#ifdef COMPILE_DL_DBASE
- CREATE_MUTEX(dbase_mutex, "DBase_TLS");
- SET_MUTEX(dbase_mutex);
- numthreads++;
- if (numthreads==1){
- if ((DbaseTls=TlsAlloc())==0xFFFFFFFF){
- FREE_MUTEX(dbase_mutex);
- return 0;
- }}
- FREE_MUTEX(dbase_mutex);
-#endif
- dbase_globals = (dbase_global_struct *) LocalAlloc(LPTR, sizeof(dbase_global_struct));
- TlsSetValue(DbaseTls, (void *) dbase_globals);
-#endif
- DBase_GLOBAL(le_dbhead) =
- zend_register_list_destructors_ex(_close_dbase, NULL, "dbase", module_number);
- return SUCCESS;
-}
-
-static PHP_MSHUTDOWN_FUNCTION(dbase)
-{
-#if defined(THREAD_SAFE)
- dbase_global_struct *dbase_globals;
- dbase_globals = TlsGetValue(DbaseTls);
- if (dbase_globals != 0)
- LocalFree((HLOCAL) dbase_globals);
-#ifdef COMPILE_DL_DBASE
- SET_MUTEX(dbase_mutex);
- numthreads--;
- if (!numthreads){
- if (!TlsFree(DbaseTls)){
- FREE_MUTEX(dbase_mutex);
- return 0;
- }}
- FREE_MUTEX(dbase_mutex);
-#endif
-#endif
- return SUCCESS;
-}
-
-/* {{{ proto int dbase_open(string name, int mode)
- Opens a dBase-format database file */
-PHP_FUNCTION(dbase_open)
-{
- zval **dbf_name, **options;
- dbhead_t *dbh;
- int handle;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &dbf_name, &options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(dbf_name);
- convert_to_long_ex(options);
-
- if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(dbf_name), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(Z_STRVAL_PP(dbf_name) TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- dbh = dbf_open(Z_STRVAL_PP(dbf_name), Z_LVAL_PP(options) TSRMLS_CC);
- if (dbh == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to open database %s", Z_STRVAL_PP(dbf_name));
- RETURN_FALSE;
- }
-
- handle = zend_list_insert(dbh, DBase_GLOBAL(le_dbhead));
- RETURN_LONG(handle);
-}
-/* }}} */
-
-/* {{{ proto bool dbase_close(int identifier)
- Closes an open dBase-format database file */
-PHP_FUNCTION(dbase_close)
-{
- zval **dbh_id;
- dbhead_t *dbh;
- int dbh_type;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &dbh_id) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(dbh_id);
- dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %d", Z_LVAL_PP(dbh_id));
- RETURN_FALSE;
- }
-
- zend_list_delete(Z_LVAL_PP(dbh_id));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int dbase_numrecords(int identifier)
- Returns the number of records in the database */
-PHP_FUNCTION(dbase_numrecords)
-{
- zval **dbh_id;
- dbhead_t *dbh;
- int dbh_type;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &dbh_id) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(dbh_id);
- dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %d", Z_LVAL_PP(dbh_id));
- RETURN_FALSE;
- }
-
- RETURN_LONG(dbh->db_records);
-}
-/* }}} */
-
-/* {{{ proto int dbase_numfields(int identifier)
- Returns the number of fields (columns) in the database */
-PHP_FUNCTION(dbase_numfields)
-{
- zval **dbh_id;
- dbhead_t *dbh;
- int dbh_type;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &dbh_id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(dbh_id);
- dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %d", Z_LVAL_PP(dbh_id));
- RETURN_FALSE;
- }
-
- RETURN_LONG(dbh->db_nfields);
-}
-/* }}} */
-
-/* {{{ proto bool dbase_pack(int identifier)
- Packs the database (deletes records marked for deletion) */
-PHP_FUNCTION(dbase_pack)
-{
- zval **dbh_id;
- dbhead_t *dbh;
- int dbh_type;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &dbh_id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(dbh_id);
- dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %d", Z_LVAL_PP(dbh_id));
- RETURN_FALSE;
- }
-
- pack_dbf(dbh);
- put_dbf_info(dbh);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool dbase_add_record(int identifier, array data)
- Adds a record to the database */
-PHP_FUNCTION(dbase_add_record)
-{
- zval **dbh_id, **fields, **field;
- dbhead_t *dbh;
- int dbh_type;
-
- int num_fields;
- dbfield_t *dbf, *cur_f;
- char *cp, *t_cp;
- int i;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &dbh_id, &fields) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(dbh_id);
- if (Z_TYPE_PP(fields) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array as second parameter");
- RETURN_FALSE;
- }
-
- dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %d", Z_LVAL_PP(dbh_id));
- RETURN_FALSE;
- }
-
- num_fields = zend_hash_num_elements(Z_ARRVAL_PP(fields));
-
- if (num_fields != dbh->db_nfields) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong number of fields specified");
- RETURN_FALSE;
- }
-
- cp = t_cp = (char *)emalloc(dbh->db_rlen + 1);
- *t_cp++ = VALID_RECORD;
-
- dbf = dbh->db_fields;
- for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) {
- zval tmp;
- if (zend_hash_index_find(Z_ARRVAL_PP(fields), i, (void **)&field) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unexpected error");
- efree(cp);
- RETURN_FALSE;
- }
-
- tmp = **field;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- sprintf(t_cp, cur_f->db_format, Z_STRVAL(tmp));
- zval_dtor(&tmp);
- t_cp += cur_f->db_flen;
- }
-
- dbh->db_records++;
- if (put_dbf_record(dbh, dbh->db_records, cp) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to put record at %ld", dbh->db_records);
- efree(cp);
- RETURN_FALSE;
- }
-
- put_dbf_info(dbh);
- efree(cp);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool dbase_replace_record(int identifier, array data, int recnum)
- Replaces a record to the database */
-PHP_FUNCTION(dbase_replace_record)
-{
- zval **dbh_id, **fields, **field, **recnum;
- dbhead_t *dbh;
- int dbh_type;
-
- int num_fields;
- dbfield_t *dbf, *cur_f;
- char *cp, *t_cp;
- int i;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &dbh_id, &fields, &recnum) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(dbh_id);
- convert_to_long_ex(recnum);
- if (Z_TYPE_PP(fields) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array as second parameter");
- RETURN_FALSE;
- }
-
- dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %d", Z_LVAL_PP(dbh_id));
- RETURN_FALSE;
- }
-
- num_fields = zend_hash_num_elements(Z_ARRVAL_PP(fields));
-
- if (num_fields != dbh->db_nfields) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong number of fields specified");
- RETURN_FALSE;
- }
-
- cp = t_cp = (char *)emalloc(dbh->db_rlen + 1);
- *t_cp++ = VALID_RECORD;
-
- dbf = dbh->db_fields;
- for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) {
- if (zend_hash_index_find(Z_ARRVAL_PP(fields), i, (void **)&field) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unexpected error");
- efree(cp);
- RETURN_FALSE;
- }
- convert_to_string_ex(field);
- sprintf(t_cp, cur_f->db_format, Z_STRVAL_PP(field));
- t_cp += cur_f->db_flen;
- }
-
- if (put_dbf_record(dbh, Z_LVAL_PP(recnum), cp) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to put record at %ld", dbh->db_records);
- efree(cp);
- RETURN_FALSE;
- }
-
- put_dbf_info(dbh);
- efree(cp);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool dbase_delete_record(int identifier, int record)
- Marks a record to be deleted */
-PHP_FUNCTION(dbase_delete_record)
-{
- zval **dbh_id, **record;
- dbhead_t *dbh;
- int dbh_type;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &dbh_id, &record) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(dbh_id);
- convert_to_long_ex(record);
-
- dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %d", Z_LVAL_PP(dbh_id));
- RETURN_FALSE;
- }
-
- if (del_dbf_record(dbh, Z_LVAL_PP(record)) < 0) {
- if (Z_LVAL_PP(record) > dbh->db_records) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "record %d out of bounds", Z_LVAL_PP(record));
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to delete record %d", Z_LVAL_PP(record));
- }
- RETURN_FALSE;
- }
-
- put_dbf_info(dbh);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ php_dbase_get_record
- */
-static void php_dbase_get_record(INTERNAL_FUNCTION_PARAMETERS, int assoc)
-{
- zval **dbh_id, **record;
- dbhead_t *dbh;
- int dbh_type;
- dbfield_t *dbf, *cur_f;
- char *data, *fnp, *str_value;
- size_t cursize = 0;
- long overflow_test;
- int errno_save;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &dbh_id, &record) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(dbh_id);
- convert_to_long_ex(record);
-
- dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %d", Z_LVAL_PP(dbh_id));
- RETURN_FALSE;
- }
-
- if ((data = get_dbf_record(dbh, Z_LVAL_PP(record))) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to read bad record %d", Z_LVAL_PP(record));
- RETURN_FALSE;
- }
-
- dbf = dbh->db_fields;
-
- array_init(return_value);
-
- fnp = NULL;
- for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) {
- /* get the value */
- str_value = (char *)emalloc(cur_f->db_flen + 1);
-
- if(cursize <= (unsigned)cur_f->db_flen) {
- cursize = cur_f->db_flen + 1;
- fnp = erealloc(fnp, cursize);
- }
- snprintf(str_value, cursize, cur_f->db_format, get_field_val(data, cur_f, fnp));
-
- /* now convert it to the right php internal type */
- switch (cur_f->db_type) {
- case 'C':
- case 'D':
- if (!assoc) {
- add_next_index_string(return_value, str_value, 1);
- } else {
- add_assoc_string(return_value, cur_f->db_fname, str_value, 1);
- }
- break;
- case 'I': /* FALLS THROUGH */
- case 'N':
- if (cur_f->db_fdc == 0) {
- /* Large integers in dbase can be larger than long */
- errno_save = errno;
- overflow_test = strtol(str_value, NULL, 10);
- if (errno == ERANGE) {
- /* If the integer is too large, keep it as string */
- if (!assoc) {
- add_next_index_string(return_value, str_value, 1);
- } else {
- add_assoc_string(return_value, cur_f->db_fname, str_value, 1);
- }
- } else {
- if (!assoc) {
- add_next_index_long(return_value, overflow_test);
- } else {
- add_assoc_long(return_value, cur_f->db_fname, overflow_test);
- }
- }
- errno = errno_save;
- } else {
- if (!assoc) {
- add_next_index_double(return_value, atof(str_value));
- } else {
- add_assoc_double(return_value, cur_f->db_fname, atof(str_value));
- }
- }
- break;
- case 'L': /* we used to FALL THROUGH, but now we check for T/Y and F/N
- and insert 1 or 0, respectively. db_fdc is the number of
- decimals, which we don't care about. 3/14/2001 LEW */
- if ((*str_value == 'T') || (*str_value == 'Y')) {
- if (!assoc) {
- add_next_index_long(return_value, strtol("1", NULL, 10));
- } else {
- add_assoc_long(return_value, cur_f->db_fname,strtol("1", NULL, 10));
- }
- } else {
- if ((*str_value == 'F') || (*str_value == 'N')) {
- if (!assoc) {
- add_next_index_long(return_value, strtol("0", NULL, 10));
- } else {
- add_assoc_long(return_value, cur_f->db_fname,strtol("0", NULL, 10));
- }
- } else {
- if (!assoc) {
- add_next_index_long(return_value, strtol(" ", NULL, 10));
- } else {
- add_assoc_long(return_value, cur_f->db_fname,strtol(" ", NULL, 10));
- }
- }
- }
- break;
- case 'M':
- /* this is a memo field. don't know how to deal with this yet */
- break;
- default:
- /* should deal with this in some way */
- break;
- }
- efree(str_value);
- }
-
- efree(fnp);
-
- /* mark whether this record was deleted */
- if (data[0] == '*') {
- add_assoc_long(return_value, "deleted", 1);
- } else {
- add_assoc_long(return_value, "deleted", 0);
- }
-
- free(data);
-}
-/* }}} */
-
-/* {{{ proto array dbase_get_record(int identifier, int record)
- Returns an array representing a record from the database */
-PHP_FUNCTION(dbase_get_record)
-{
- php_dbase_get_record(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* From Martin Kuba <makub@aida.inet.cz> */
-/* {{{ proto array dbase_get_record_with_names(int identifier, int record)
- Returns an associative array representing a record from the database */
-PHP_FUNCTION(dbase_get_record_with_names)
-{
- php_dbase_get_record(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto bool dbase_create(string filename, array fields)
- Creates a new dBase-format database file */
-PHP_FUNCTION(dbase_create)
-{
- zval **filename, **fields, **field, **value;
- int fd;
- dbhead_t *dbh;
-
- int num_fields;
- dbfield_t *dbf, *cur_f;
- int i, rlen, handle;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &filename, &fields) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- if (Z_TYPE_PP(fields) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array as second parameter");
- RETURN_FALSE;
- }
-
- if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if ((fd = VCWD_OPEN_MODE(Z_STRVAL_PP(filename), O_BINARY|O_RDWR|O_CREAT, 0644)) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create database (%d): %s", errno, strerror(errno));
- RETURN_FALSE;
- }
-
- num_fields = zend_hash_num_elements(Z_ARRVAL_PP(fields));
-
- /* have to use regular malloc() because this gets free()d by
- code in the dbase library */
- dbh = (dbhead_t *)malloc(sizeof(dbhead_t));
- dbf = (dbfield_t *)malloc(sizeof(dbfield_t) * num_fields);
- if (!dbh || !dbf) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate memory for header info");
- RETURN_FALSE;
- }
-
- /* initialize the header structure */
- dbh->db_fields = dbf;
- dbh->db_fd = fd;
- dbh->db_dbt = DBH_TYPE_NORMAL;
- strcpy(dbh->db_date, "19930818");
- dbh->db_records = 0;
- dbh->db_nfields = num_fields;
- dbh->db_hlen = sizeof(struct dbf_dhead) + 1 + num_fields * sizeof(struct dbf_dfield);
-
- rlen = 1;
- /**
- * Patch by greg@darkphoton.com
- **/
- /* make sure that the db_format entries for all fields are set to NULL to ensure we
- don't seg fault if there's an error and we need to call free_dbf_head() before all
- fields have been defined. */
- for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) {
- cur_f->db_format = NULL;
- }
- /**
- * end patch
- */
-
-
- for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) {
- /* look up the first field */
- if (zend_hash_index_find(Z_ARRVAL_PP(fields), i, (void **)&field) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to find field %d", i);
- free_dbf_head(dbh);
- RETURN_FALSE;
- }
-
- if (Z_TYPE_PP (field) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "second parameter must be array of arrays");
- free_dbf_head(dbh);
- RETURN_FALSE;
- }
-
- /* field name */
- if (zend_hash_index_find(Z_ARRVAL_PP(field), 0, (void **)&value) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expected field name as first element of list in field %d", i);
- free_dbf_head(dbh);
- RETURN_FALSE;
- }
- convert_to_string_ex(value);
- if (Z_STRLEN_PP(value) > 10 || Z_STRLEN_PP(value) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid field name '%s' (must be non-empty and less than or equal to 10 characters)", Z_STRVAL_PP(value));
- free_dbf_head(dbh);
- RETURN_FALSE;
- }
- copy_crimp(cur_f->db_fname, Z_STRVAL_PP(value), Z_STRLEN_PP(value));
-
- /* field type */
- if (zend_hash_index_find(Z_ARRVAL_PP (field), 1, (void **)&value) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expected field type as sececond element of list in field %d", i);
- RETURN_FALSE;
- }
- convert_to_string_ex(value);
- cur_f->db_type = toupper(*Z_STRVAL_PP(value));
-
- cur_f->db_fdc = 0;
-
- /* verify the field length */
- switch (cur_f->db_type) {
- case 'L':
- cur_f->db_flen = 1;
- break;
- case 'M':
- cur_f->db_flen = 10;
- dbh->db_dbt = DBH_TYPE_MEMO;
- /* should create the memo file here, probably */
- break;
- case 'D':
- cur_f->db_flen = 8;
- break;
- case 'N':
- case 'C':
- /* field length */
- if (zend_hash_index_find(Z_ARRVAL_PP (field), 2, (void **)&value) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expected field length as third element of list in field %d", i);
- free_dbf_head(dbh);
- RETURN_FALSE;
- }
- convert_to_long_ex(value);
- cur_f->db_flen = Z_LVAL_PP(value);
-
- if (cur_f->db_type == 'N') {
- if (zend_hash_index_find(Z_ARRVAL_PP (field), 3, (void **)&value) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expected field precision as fourth element of list in field %d", i);
- free_dbf_head(dbh);
- RETURN_FALSE;
- }
- convert_to_long_ex(value);
- cur_f->db_fdc = Z_LVAL_PP(value);
- }
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unknown field type '%c'", cur_f->db_type);
- }
- cur_f->db_foffset = rlen;
- rlen += cur_f->db_flen;
-
- cur_f->db_format = get_dbf_f_fmt(cur_f);
- }
-
- dbh->db_rlen = rlen;
- put_dbf_info(dbh);
-
- handle = zend_list_insert(dbh, DBase_GLOBAL(le_dbhead));
- RETURN_LONG(handle);
-}
-/* }}} */
-
-/* {{{ dbase_functions[]
- */
-function_entry dbase_functions[] = {
- PHP_FE(dbase_open, NULL)
- PHP_FE(dbase_create, NULL)
- PHP_FE(dbase_close, NULL)
- PHP_FE(dbase_numrecords, NULL)
- PHP_FE(dbase_numfields, NULL)
- PHP_FE(dbase_add_record, NULL)
- PHP_FE(dbase_replace_record, NULL)
- PHP_FE(dbase_get_record, NULL)
- PHP_FE(dbase_get_record_with_names, NULL)
- PHP_FE(dbase_delete_record, NULL)
- PHP_FE(dbase_pack, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry dbase_module_entry = {
- STANDARD_MODULE_HEADER,
- "dbase", dbase_functions, PHP_MINIT(dbase), PHP_MSHUTDOWN(dbase), NULL, NULL, NULL, NO_VERSION_YET, STANDARD_MODULE_PROPERTIES
-};
-
-
-#ifdef COMPILE_DL_DBASE
-ZEND_GET_MODULE(dbase)
-
-#if defined(PHP_WIN32) && defined(THREAD_SAFE)
-
-/*NOTE: You should have an odbc.def file where you
-export DllMain*/
-BOOL WINAPI DllMain(HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved)
-{
- return 1;
-}
-#endif
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dbase/dbase.dsp b/ext/dbase/dbase.dsp
deleted file mode 100644
index 63bb66dbcc..0000000000
--- a/ext/dbase/dbase.dsp
+++ /dev/null
@@ -1,151 +0,0 @@
-# Microsoft Developer Studio Project File - Name="dbase" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=dbase - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "dbase.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "dbase.mak" CFG="dbase - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "dbase - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dbase - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "dbase - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DBASE" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "DBASE_EXPORTS" /D "COMPILE_DL_DBASE" /D ZTS=1 /D HAVE_DBASE=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D DBASE=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dbase.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "dbase - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DBASE" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DBASE_EXPORTS" /D "COMPILE_DL_DBASE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBASE=1 /D DBASE=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_dbase.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "dbase - Win32 Release_TS"
-# Name "dbase - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\dbase.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_head.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_misc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_ndx.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_rec.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\dbf.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_head.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_misc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_ndx.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_rec.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_dbase.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/dbase/dbf.h b/ext/dbase/dbf.h
deleted file mode 100644
index c7ee8fde71..0000000000
--- a/ext/dbase/dbf.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 1991, 1992, 1993 Brad Eacker,
- * (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-
-/*
- * dbf header structure on disk (pc dbase III)
- *
- * Basic info taken from:
- * "File Formats for Popular PC Software"
- * Jeff Walden
- * (c) 1986 John Wiley & Sons, Inc.
- */
-
-#ifndef DBF_H_
-#define DBF_H_
-
-#include <stdlib.h>
-#include <string.h>
-#ifdef WIN32
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-/* So we can use O_BINARY on non-Win32 systems. */
-#if !defined(O_BINARY) && !defined(WIN32)
-#define O_BINARY (0)
-#endif
-
-struct dbf_dhead {
- char dbh_dbt; /* memo (dbt) file present */
- char dbh_date[3]; /* last update YY, MM, DD */
- char dbh_records[4]; /* number of records LE */
- char dbh_hlen[2]; /* header length LE */
- char dbh_rlen[2]; /* record length LE */
- char dbh_res[20]; /* padding */
-};
-#define DBH_DATE_YEAR 0 /* byte offset for year in dbh_date */
-#define DBH_DATE_MONTH 1
-#define DBH_DATE_DAY 2
-
-/*
- * field description on disk
- */
-
-#define DBF_NAMELEN 11
-
-struct dbf_dfield {
- char dbf_name[DBF_NAMELEN]; /* name of field */
- char dbf_type; /* type of field */
- char dbf_fda[4]; /* something for dbase III */
- char dbf_flen[2]; /* field length [and decimal if N] */
- char dbf_res[14]; /* padding */
-};
-
-struct db_field {
- char db_fname[DBF_NAMELEN+1]; /* 0 terminated */
- char db_type; /* type of field */
- int db_flen; /* length of field */
- int db_fdc; /* number of decimals in field */
-
- char *db_format; /* format for printing %s etc */
- int db_foffset; /* offset within record */
-};
-typedef struct db_field dbfield_t;
-
-struct db_head {
- int db_fd;
- unsigned char db_dbt; /* dbt present */
- char db_date[9]; /* date of last update in db format */
- long db_records; /* number of records */
- int db_hlen; /* header length */
- int db_rlen; /* record length */
-
- int db_nfields; /* number of fields */
- dbfield_t *db_fields; /* field info */
- char *db_name; /* name of dbf file */
- int db_cur_rec; /* current record */
-};
-typedef struct db_head dbhead_t;
-
-#define DBH_TYPE_NORMAL 0x03
-#define DBH_TYPE_MEMO 0x83
-
-#define VALID_RECORD ' '
-#define DELETED_RECORD '*'
-
-#include "dbf_head.h"
-#include "dbf_misc.h"
-#include "dbf_rec.h"
-
-#endif /* DBF_H_ */
diff --git a/ext/dbase/dbf_head.c b/ext/dbase/dbf_head.c
deleted file mode 100644
index 9ec1f40d6c..0000000000
--- a/ext/dbase/dbf_head.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Copyright (c) 1991, 1992, 1993 Brad Eacker,
- * (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "php.h"
-#include "dbf.h"
-
-void free_dbf_head(dbhead_t *dbh);
-int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf);
-
-/*
- * get the header info from the file
- * basic header info & field descriptions
- */
-dbhead_t *get_dbf_head(int fd)
-{
- dbhead_t *dbh;
- struct dbf_dhead dbhead;
- dbfield_t *dbf, *cur_f, *tdbf;
- int ret, nfields, offset, gf_retval;
-
- if ((dbh = (dbhead_t *)malloc(sizeof(dbhead_t))) == NULL)
- return NULL;
- if (lseek(fd, 0, 0) < 0)
- return NULL;
- if ((ret = read(fd, &dbhead, sizeof(dbhead))) < 0)
- return NULL;
-
- /* build in core info */
- dbh->db_fd = fd;
- dbh->db_dbt = dbhead.dbh_dbt;
- dbh->db_records = get_long(dbhead.dbh_records);
- dbh->db_hlen = get_short(dbhead.dbh_hlen);
- dbh->db_rlen = get_short(dbhead.dbh_rlen);
-
- db_set_date(dbh->db_date, dbhead.dbh_date[DBH_DATE_YEAR] + 1900,
- dbhead.dbh_date[DBH_DATE_MONTH],
- dbhead.dbh_date[DBH_DATE_DAY]);
-
- /* malloc enough memory for the maximum number of fields:
- 32 * 1024 = 32K dBase5 (for Win) seems to allow that many */
- tdbf = (dbfield_t *)malloc(sizeof(dbfield_t)*1024);
-
- offset = 1;
- nfields = 0;
- gf_retval = 0;
- for (cur_f = tdbf; gf_retval < 2 && nfields < 1024; cur_f++) {
- gf_retval = get_dbf_field(dbh, cur_f);
-
- if (gf_retval < 0) {
- free_dbf_head(dbh);
- return NULL;
- }
- if (gf_retval != 2 ) {
- cur_f->db_foffset = offset;
- offset += cur_f->db_flen;
- nfields++;
- }
- }
- dbh->db_nfields = nfields;
-
- /* malloc the right amount of space for records, copy and destroy old */
- dbf = (dbfield_t *)malloc(sizeof(dbfield_t)*nfields);
- memcpy(dbf, tdbf, sizeof(dbfield_t)*nfields);
- free(tdbf);
-
- dbh->db_fields = dbf;
-
- return dbh;
-}
-
-/*
- * free up the header info built above
- */
-void free_dbf_head(dbhead_t *dbh)
-{
- dbfield_t *dbf, *cur_f;
- int nfields;
-
- dbf = dbh->db_fields;
- nfields = dbh->db_nfields;
- for (cur_f = dbf; cur_f < &dbf[nfields]; cur_f++) {
- if (cur_f->db_format) {
- free(cur_f->db_format);
- }
- }
-
- free(dbf);
- free(dbh);
-}
-
-/*
- * put out the header info
- */
-int put_dbf_head(dbhead_t *dbh)
-{
- int fd = dbh->db_fd;
- struct dbf_dhead dbhead;
- int ret;
-
- memset (&dbhead, 0, sizeof(dbhead));
-
- /* build on disk info */
- dbhead.dbh_dbt = dbh->db_dbt;
- put_long(dbhead.dbh_records, dbh->db_records);
- put_short(dbhead.dbh_hlen, dbh->db_hlen);
- put_short(dbhead.dbh_rlen, dbh->db_rlen);
-
- /* put the date spec'd into the on disk header */
- dbhead.dbh_date[DBH_DATE_YEAR] =(char)(db_date_year(dbh->db_date) -
- 1900);
- dbhead.dbh_date[DBH_DATE_MONTH]=(char)(db_date_month(dbh->db_date));
- dbhead.dbh_date[DBH_DATE_DAY] =(char)(db_date_day(dbh->db_date));
-
- if (lseek(fd, 0, 0) < 0)
- return -1;
- if ((ret = write(fd, &dbhead, sizeof(dbhead))) < 0)
- return -1;
- return ret;
-}
-
-/*
- * get a field off the disk from the current file offset
- */
-int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
-{
- struct dbf_dfield dbfield;
- int ret;
-
- if ((ret = read(dbh->db_fd, &dbfield, sizeof(dbfield))) < 0) {
- return ret;
- }
-
- /* Check for the '0Dh' field terminator , if found return '2'
- which will tell the loop we are at the end of fields */
- if (dbfield.dbf_name[0]==0x0d) {
- return 2;
- }
-
- /* build the field name */
- copy_crimp(dbf->db_fname, dbfield.dbf_name, DBF_NAMELEN);
-
- dbf->db_type = dbfield.dbf_type;
- switch (dbf->db_type) {
- case 'N':
- dbf->db_flen = dbfield.dbf_flen[0];
- dbf->db_fdc = dbfield.dbf_flen[1];
- break;
- default:
- dbf->db_flen = get_short(dbfield.dbf_flen);
- break;
- }
-
- if ((dbf->db_format = get_dbf_f_fmt(dbf)) == NULL) {
- return 1;
- }
-
- return 0;
-}
-
-/*
- * put a field out on the disk at the current file offset
- */
-int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
-{
- struct dbf_dfield dbfield;
- char *scp, *dcp;
- int ret;
-
- memset (&dbfield, 0, sizeof(dbfield));
-
- /* build the on disk field info */
- scp = dbf->db_fname; dcp = dbfield.dbf_name;
-
- strncpy(dbfield.dbf_name, dbf->db_fname, DBF_NAMELEN);
-
- dbfield.dbf_type = dbf->db_type;
- switch (dbf->db_type) {
- case 'N':
- dbfield.dbf_flen[0] = dbf->db_flen;
- dbfield.dbf_flen[1] = dbf->db_fdc;
- break;
- default:
- put_short(dbfield.dbf_flen, dbf->db_flen);
- }
-
- /* now write it out to disk */
- if ((ret = write(dbh->db_fd, &dbfield, sizeof(dbfield))) < 0) {
- return ret;
- }
- return 1;
-}
-
-/*
- * put out all the info at the top of the file...
- */
-static char end_stuff[2] = {0x0d, 0};
-
-void put_dbf_info(dbhead_t *dbh)
-{
- dbfield_t *dbf;
- char *cp;
- int fcnt;
-
- if ((cp = db_cur_date(NULL))) {
- strncpy(dbh->db_date, cp, 8);
- free(cp);
- }
- put_dbf_head(dbh);
- dbf = dbh->db_fields;
- for (fcnt = dbh->db_nfields; fcnt > 0; fcnt--, dbf++)
- put_dbf_field(dbh, dbf);
- write(dbh->db_fd, end_stuff, 1);
-}
-
-char *get_dbf_f_fmt(dbfield_t *dbf)
-{
- char format[100];
-
- /* build the field format for printf */
- switch (dbf->db_type) {
- case 'C':
- sprintf(format, "%%-%ds", dbf->db_flen);
- break;
- case 'N':
- case 'L':
- case 'D':
- sprintf(format, "%%%ds", dbf->db_flen);
- break;
- case 'M':
- strcpy(format, "%s");
- break;
- }
- return (char *)strdup(format);
-}
-
-dbhead_t *dbf_open(char *dp, int o_flags TSRMLS_DC)
-{
- int fd;
- char *cp;
- dbhead_t *dbh;
-
- cp = dp;
- if ((fd = VCWD_OPEN(cp, o_flags|O_BINARY)) < 0) {
- cp = (char *)malloc(MAXPATHLEN); /* So where does this get free()'d? -RL */
- strncpy(cp, dp, MAXPATHLEN-5); strcat(cp, ".dbf");
- if ((fd = VCWD_OPEN(cp, o_flags)) < 0) {
- free(cp);
- perror("open");
- return NULL;
- }
- }
-
- if ((dbh = get_dbf_head(fd)) == 0) {
- fprintf(stderr, "Unable to get header\n");
- return NULL;
- }
- dbh->db_name = cp;
- dbh->db_cur_rec = 0;
-
- return dbh;
-}
-
-void dbf_head_info(dbhead_t *dbh)
-{
- int nfields;
- dbfield_t *dbf, *cur_f;
-
- nfields = dbh->db_nfields;
- printf("# fields: %d, record len: %d, total records %ld\n",
- nfields, dbh->db_rlen, dbh->db_records);
- dbf = dbh->db_fields;
- for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) {
- printf("# %s, %c, %d, %d\n", cur_f->db_fname,
- cur_f->db_type, cur_f->db_flen, cur_f->db_fdc);
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dbase/dbf_head.h b/ext/dbase/dbf_head.h
deleted file mode 100644
index 9a17a3a91f..0000000000
--- a/ext/dbase/dbf_head.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "php.h"
-
-extern dbhead_t *get_dbf_head(int fd);
-void free_dbf_head(dbhead_t *dbh);
-extern int put_dbf_head(dbhead_t *dbh);
-extern int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf);
-extern int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf);
-void put_dbf_info(dbhead_t *dbh);
-extern char *get_dbf_f_fmt(dbfield_t *dbf);
-extern dbhead_t *dbf_open(char *dp, int o_flags TSRMLS_DC);
-void dbf_head_info(dbhead_t *dbh);
diff --git a/ext/dbase/dbf_misc.c b/ext/dbase/dbf_misc.c
deleted file mode 100644
index ad17bd4e3f..0000000000
--- a/ext/dbase/dbf_misc.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 1991, 1992, 1993 Brad Eacker,
- * (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-
-#include "dbf_misc.h"
-
-#include "php_reentrancy.h"
-
-/*
- * routine to change little endian long to host long
- */
-long get_long(char *cp)
-{
- int ret;
- unsigned char *source = (unsigned char *)cp;
-
- ret = *source++;
- ret += ((*source++)<<8);
- ret += ((*source++)<<16);
- ret += ((*source++)<<24);
-
- return ret;
-}
-
-void put_long(char *cp, long lval)
-{
- *cp++ = lval & 0xff;
- *cp++ = (lval >> 8) & 0xff;
- *cp++ = (lval >> 16) & 0xff;
- *cp++ = (lval >> 24) & 0xff;
-}
-
-/*
- * routine to change little endian short to host short
- */
-int get_short(char *cp)
-{
- int ret;
- unsigned char *source = (unsigned char *)cp;
-
- ret = *source++;
- ret += ((*source++)<<8);
-
- return ret;
-}
-
-void put_short(char *cp, int sval)
-{
- *cp++ = sval & 0xff;
- *cp++ = (sval >> 8) & 0xff;
-}
-
-double get_double(char *cp)
-{
- double ret;
- unsigned char *dp = (unsigned char *)&ret;
-
- dp[7] = *cp++;
- dp[6] = *cp++;
- dp[5] = *cp++;
- dp[4] = *cp++;
- dp[3] = *cp++;
- dp[2] = *cp++;
- dp[1] = *cp++;
- dp[0] = *cp++;
-
- return ret;
-}
-
-void put_double(char *cp, double fval)
-{
- unsigned char *dp = (unsigned char *)&fval;
-
- cp[7] = *dp++;
- cp[6] = *dp++;
- cp[5] = *dp++;
- cp[4] = *dp++;
- cp[3] = *dp++;
- cp[2] = *dp++;
- cp[1] = *dp++;
- cp[0] = *dp++;
-}
-
-void copy_fill(char *dp, char *sp, int len)
-{
- while (*sp && len > 0) {
- *dp++ = *sp++;
- len--;
- }
- while (len-- > 0)
- *dp++ = ' ';
-}
-
-void copy_crimp(char *dp, char *sp, int len)
-{
- while (len-- > 0) {
- *dp++ = *sp++;
- }
- *dp = 0;
- for (dp-- ; *dp == ' '; dp--) {
- *dp = 0;
- }
-
-}
-
-void db_set_date(char *cp, int year, int month, int day)
-{
- if (month > 12)
- month = 0;
- if (day > 31)
- day = 0;
- sprintf(cp, "%d", year);
- cp[4] = month / 10 + '0';
- cp[5] = month % 10 + '0';
- cp[6] = day / 10 + '0';
- cp[7] = day % 10 + '0';
- cp[8] = 0;
-}
-
-int db_date_year(char *cp)
-{
- int year, i;
-
- for (year = 0, i = 0; i < 4; i++)
- year = year * 10 + (cp[i] - '0');
- return year;
-}
-
-int db_date_month(char *cp)
-{
- int month, i;
-
- for (month = 0, i = 4; i < 6; i++)
- month = month * 10 + (cp[i] - '0');
- return month;
-}
-
-int db_date_day(char *cp)
-{
- int day, i;
-
- for (day = 0, i = 6; i < 8; i++)
- day = day * 10 + (cp[i] - '0');
- return day;
-}
-
-#include <time.h>
-
-char *db_cur_date(char *cp)
-{
- struct tm *ctm, tmbuf;
- time_t c_time;
-
- c_time = time((time_t *)NULL);
- ctm = php_localtime_r(&c_time, &tmbuf);
- if (cp == NULL)
- cp = (char *)malloc(9);
-
- if (ctm == NULL || cp == NULL)
- return NULL;
-
- db_set_date(cp, ctm->tm_year + 1900, ctm->tm_mon + 1, ctm->tm_mday);
-
- return cp;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dbase/dbf_misc.h b/ext/dbase/dbf_misc.h
deleted file mode 100644
index 37fe8b0ea9..0000000000
--- a/ext/dbase/dbf_misc.h
+++ /dev/null
@@ -1,13 +0,0 @@
-void put_long(char *cp, long lval);
-extern long get_long(char *cp);
-extern int get_short(char *cp);
-void put_short(char *cp, int sval);
-void put_double(char *cp, double fval);
-extern double get_double(char *cp);
-void copy_fill(char *dp, char *sp, int len);
-void copy_crimp(char *dp, char *sp, int len);
-void db_set_date(char *cp, int year, int month, int day);
-extern int db_date_year(char *cp);
-extern int db_date_month(char *cp);
-extern int db_date_day(char *cp);
-extern char *db_cur_date(char *cp);
diff --git a/ext/dbase/dbf_ndx.c b/ext/dbase/dbf_ndx.c
deleted file mode 100644
index 121a0e81e2..0000000000
--- a/ext/dbase/dbf_ndx.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 1991, 1992, 1993 Brad Eacker,
- * (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "dbf.h"
-#include "dbf_ndx.h"
-
-/*
- * get the ndx header for this file
- */
-ndx_header_t *ndx_get_header(int fd)
-{
- dndx_header_t *dp;
- ndx_header_t *np;
-
- if ((dp = (dndx_header_t *)malloc(NDX_PAGE_SZ)) == NULL)
- return NULL;
- if ((np = (ndx_header_t *)malloc(sizeof(ndx_header_t))) == NULL) {
- free(dp);
- return NULL;
- }
- if ((lseek(fd, 0, 0) < 0) || (read(fd, dp, NDX_PAGE_SZ) < 0)) {
- free(dp); free(np);
- return NULL;
- }
- np->ndx_hpage = dp;
- np->ndx_fd = fd;
- np->ndx_start_pg = get_long(dp->dndx_st_pg);
- np->ndx_total_pgs = get_long(dp->dndx_tot_pg);
- np->ndx_key_len = get_short(dp->dndx_key_len);
- np->ndx_keys_ppg = get_short(dp->dndx_keys_ppg);
- np->ndx_key_type = get_short(dp->dndx_key_type);
- np->ndx_key_size = get_long(dp->dndx_size_key);
- np->ndx_key_name = dp->dndx_key_name;
- np->ndx_unique = dp->dndx_unique;
-
- np->ndx_fp = NULL;
-
- return np;
-}
-
-static ndx_page_t *ndx_get_page(ndx_header_t *hp, int pageno)
-{
- ndx_page_t *fp;
- dndx_page_t *dp;
- ndx_record_t *rp;
-
-#if PHP_DEBUG
- printf("getting page %d", pageno);
-#endif
- if ((fp = (ndx_page_t *)malloc(sizeof(ndx_page_t))) == NULL)
- return NULL;
- if ((dp = (dndx_page_t *)malloc(NDX_PAGE_SZ)) == NULL) {
- free(fp);
- return NULL;
- }
- if ((rp = (ndx_record_t *)malloc(sizeof(ndx_record_t) * hp->ndx_keys_ppg)) == NULL) {
- free(dp); free(fp);
- return NULL;
- }
- fp->ndxp_page_data = dp;
- if ((lseek(hp->ndx_fd, pageno * NDX_PAGE_SZ, 0) < 0) ||
- (read(hp->ndx_fd, dp, NDX_PAGE_SZ) < 0)) {
- free(fp); free(dp);
- return NULL;
- }
- fp->ndxp_parent = NULL;
- fp->ndxp_page_no = pageno;
- fp->ndxp_num_keys = get_long(dp->dndxp_num_keys);
- memset(rp, 0, sizeof(ndx_record_t) * hp->ndx_keys_ppg);
- fp->ndxp_records = rp;
- fp->ndxp_header_p = hp;
-#if PHP_DEBUG
- printf(", n_keys %ld\n", fp->ndxp_num_keys);
-#endif
- return fp;
-}
-
-/*
- * get the first entry for this ndx
- */
-static ndx_page_t *ndx_get_first_pg(ndx_header_t *hp)
-{
- ndx_page_t *fp;
-
- if (hp->ndx_fp)
- return hp->ndx_fp;
- if ((fp = ndx_get_page(hp, hp->ndx_start_pg))) {
- hp->ndx_fp = fp;
- }
- return fp;
-}
-
-static ndx_record_t *ndx_get_record(ndx_page_t *fp, int rec_no)
-{
- ndx_record_t *rp;
- ndx_header_t *hp = fp->ndxp_header_p;
- struct dndx_record *drp;
-
-#if PHP_DEBUG
- printf("page %ld, rec %d: ", fp->ndxp_page_no, rec_no);
-#endif
- if (rec_no >= fp->ndxp_num_keys)
- return NULL;
- rp = &(fp->ndxp_records[rec_no]);
- if (!rp->ndxr_page) {
- rp->ndxr_page = fp;
- drp = (dndx_record_t *)((char *)&fp->ndxp_page_data->dndx_rp
- + rec_no * hp->ndx_key_size);
- rp->ndxr_left = get_long(drp->dndx_left_pg);
- rp->ndxr_rec = get_long(drp->dndx_dbf_rec);
- rp->ndxr_key_data = &drp->dndx_key_data;
- rp->ndxr_p_nrec = rec_no;
- }
-#if PHP_DEBUG
- printf("left %ld, dbf_rec %ld, data '%s'\n", rp->ndxr_left,
- rp->ndxr_rec, rp->ndxr_key_data);
-#endif
- return rp;
-}
-
-static ndx_record_t *ndx_scan_down(ndx_header_t *hp, ndx_page_t *fp, int recno)
-{
- ndx_page_t *np;
- ndx_record_t *rp;
-
- while ((rp = ndx_get_record(fp, recno)) && (rp->ndxr_rec == 0)) {
- np = ndx_get_page(hp, rp->ndxr_left);
- np->ndxp_parent = fp;
- np->ndxp_par_rno = recno;
- fp = np;
- recno = 0;
- }
- return rp;
-}
-
-static ndx_record_t *ndx_scan_up(ndx_header_t *hp, ndx_page_t *fp, int recno)
-{
- ndx_record_t *rp;
-
- if (fp == NULL)
- rp = NULL;
- else if (recno < fp->ndxp_num_keys) {
- rp = ndx_scan_down(hp, fp, recno);
- } else {
- rp = ndx_scan_up(hp, fp->ndxp_parent, fp->ndxp_par_rno + 1);
- }
- return rp;
-}
-
-ndx_record_t *ndx_get_first_rec(ndx_header_t *hp)
-{
- ndx_page_t *fp;
- ndx_record_t *rp = NULL;
-
- if ((fp = ndx_get_first_pg(hp))) {
- fp->ndxp_last_key = 0;
- rp = ndx_scan_down(hp, fp, 0);
- }
- hp->ndx_cur_rec = rp;
- return rp;
-}
-
-ndx_record_t *ndx_get_next_rec(ndx_header_t *hp, ndx_record_t *rp)
-{
- ndx_page_t *fp;
- int rec_no;
-
- fp = rp->ndxr_page;
- rec_no = rp->ndxr_p_nrec + 1;
- if (rec_no < fp->ndxp_num_keys) {
- rp = ndx_scan_down(hp, fp, rec_no);
- } else {
- rp = ndx_scan_up(hp, fp->ndxp_parent, fp->ndxp_par_rno + 1);
- }
- return rp;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dbase/dbf_ndx.h b/ext/dbase/dbf_ndx.h
deleted file mode 100644
index 4bc3d29641..0000000000
--- a/ext/dbase/dbf_ndx.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 1993 Brad Eacker,
- * (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-
-/*
- * dbf .ndx header structure on disk and in memory
- *
- * Basic info taken from:
- * "Clipper Programming Guide, 3rd Edition, Version 5.01"
- * by Rick Spence
- */
-
-#ifndef DBF_NDX_H_
-#define DBF_NDX_H_
-
-#include "dbf.h"
-
-#define NDX_PAGE_SZ 512
-
-/* on disk ndx header */
-struct dndx_header {
- char dndx_st_pg[4]; /* starting page number */
- char dndx_tot_pg[4]; /* total number of pages */
- char dndx_filler1[4]; /* space */
- char dndx_key_len[2]; /* key length */
- char dndx_keys_ppg[2]; /* number of keys per page */
- char dndx_key_type[2]; /* key type */
- char dndx_size_key[4]; /* size of the key record */
- char dndx_filler2; /* space */
- char dndx_unique; /* whether or not done with unique */
- char dndx_key_name[488]; /* string defining the key */
-};
-typedef struct dndx_header dndx_header_t;
-
-/* in memory ndx header */
-struct ndx_header {
- long ndx_start_pg;
- long ndx_total_pgs;
- unsigned short ndx_key_len;
- unsigned short ndx_keys_ppg;
- unsigned short ndx_key_type;
- char ndx_unique;
- long ndx_key_size;
- char *ndx_key_name;
- int ndx_fd;
- struct ndx_page *ndx_fp;
- dndx_header_t *ndx_hpage;
- struct ndx_record *ndx_cur_rec;
-};
-typedef struct ndx_header ndx_header_t;
-
-/* these are the possible values in the key type field */
-#define NDX_CHAR_TYPE 00
-#define NDX_NUM_TYPE 01
-
-/* on disk key record */
-struct dndx_record {
- char dndx_left_pg[4]; /* number of left page */
- char dndx_dbf_rec[4]; /* dbf record number */
- char dndx_key_data; /* key data */
-};
-typedef struct dndx_record dndx_record_t;
-
-struct ndx_record {
- long ndxr_left;
- long ndxr_rec;
- char *ndxr_key_data;
- struct ndx_page *ndxr_page; /* page pointer to where we are from*/
- int ndxr_p_nrec; /* number of the record within page */
-};
-typedef struct ndx_record ndx_record_t;
-
-struct dndx_page {
- char dndxp_num_keys[4]; /* number of keys on this page */
- struct dndx_record dndx_rp;
-};
-typedef struct dndx_page dndx_page_t;
-
-struct ndx_page {
- long ndxp_page_no;
- long ndxp_num_keys;
- dndx_page_t *ndxp_page_data;
- ndx_header_t *ndxp_header_p;
- long ndxp_last_key;
- struct ndx_page *ndxp_parent; /* parent page */
- int ndxp_par_rno; /* record number within parent */
- struct ndx_record *ndxp_records;
-};
-typedef struct ndx_page ndx_page_t;
-
-extern ndx_header_t *ndx_get_header(int);
-
-extern ndx_record_t *ndx_get_first_rec(ndx_header_t *);
-extern ndx_record_t *ndx_get_next_rec(ndx_header_t *, ndx_record_t *);
-
-#endif /* DBF_NDX_H_ */
diff --git a/ext/dbase/dbf_rec.c b/ext/dbase/dbf_rec.c
deleted file mode 100644
index 928a2bfc0f..0000000000
--- a/ext/dbase/dbf_rec.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (c) 1993 Brad Eacker,
- * (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#include "ext/standard/flock_compat.h"
-
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "dbf.h"
-
-int get_piece(dbhead_t *dbh, long offset, char *cp, int len);
-int put_piece(dbhead_t *dbh, long offset, char *cp, int len);
-
-/*
- * get a record off the database
- */
-char *get_dbf_record(dbhead_t *dbh, long rec_num)
-{
- long offset;
- char *cp;
-
- if (rec_num > dbh->db_records) {
- return NULL;
- }
- if ((cp = (char *)malloc(dbh->db_rlen)) == NULL) {
- return NULL;
- }
-
- /* go to the correct spot on the file */
- offset = dbh->db_hlen + (rec_num - 1) * dbh->db_rlen;
- if (get_piece(dbh, offset, cp, dbh->db_rlen) != dbh->db_rlen) {
- free(cp);
- cp = NULL;
- }
- if (cp)
- dbh->db_cur_rec = rec_num;
- return cp;
-}
-
-int
-get_piece(dbhead_t *dbh, long offset, char *cp, int len)
-{
- /* go to the correct spot on the file */
- if ( lseek(dbh->db_fd, offset, 0) < 0 ) {
- return -1;
- }
-
- /* read the record into the allocated space */
- return read(dbh->db_fd, cp, len);
-}
-
-/*
- * put a record to the database
- */
-long put_dbf_record(dbhead_t *dbh, long rec_num, char *cp)
-{
- long offset;
-
- if (rec_num == 0) {
- rec_num = dbh->db_records;
- }
- if (rec_num > dbh->db_records) {
- return 0L;
- }
- /* go to the correct spot on the file */
- offset = dbh->db_hlen + (rec_num - 1) * dbh->db_rlen;
- if (put_piece(dbh, offset, cp, dbh->db_rlen) != dbh->db_rlen) {
- rec_num = -1;
- }
- return rec_num;
-}
-
-int put_piece(dbhead_t *dbh, long offset, char *cp, int len)
-{
- /* go to the correct spot on the file */
- if ( lseek(dbh->db_fd, offset, 0) < 0 ) {
- return -1;
- }
-
- /* write the record into the file */
- return write(dbh->db_fd, cp, len);
-}
-
-int del_dbf_record(dbhead_t *dbh, long rec_num)
-{
- int ret = 0;
- char *cp;
-
- if (rec_num > dbh->db_records)
- return -1;
- if ((cp = get_dbf_record(dbh, rec_num))) {
- *cp = DELETED_RECORD;
- ret = put_dbf_record(dbh, rec_num, cp);
- free(cp);
- }
- return ret;
-}
-
-void pack_dbf(dbhead_t *dbh)
-{
- long out_off, in_off;
- int rec_cnt, new_cnt;
- char *cp;
-
- if ((cp = (char *)malloc(dbh->db_rlen)) == NULL) {
- return;
- }
- in_off = out_off = dbh->db_hlen;
-
- new_cnt = 0;
- rec_cnt = dbh->db_records;
- while (rec_cnt > 0) {
- if (get_piece(dbh, in_off, cp, dbh->db_rlen) < 0)
- break;
-
- if (*cp != DELETED_RECORD) {
- /* write the record into the file */
- if (put_piece(dbh, out_off, cp, dbh->db_rlen) < 0)
- break;
- out_off += dbh->db_rlen;
- new_cnt++;
- }
- in_off += dbh->db_rlen;
- rec_cnt--;
- }
- free(cp);
-
- /* Try to truncate the file to the right size. */
- if (ftruncate(dbh->db_fd, out_off) != 0) {
- TSRMLS_FETCH();
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "dbase_pack() couldn't truncate the file to the right size. Some deleted records may still be left in there.");
- }
-
- if (rec_cnt == 0)
- dbh->db_records = new_cnt;
-}
-
-/* routine to get a field from a record */
-char *get_field_val(char *rp, dbfield_t *fldp, char *cp)
-{
- int flen = fldp->db_flen;
-
- if ( !cp )
- cp = (char *)malloc(flen + 1);
- if ( cp ) {
- strncpy(cp, &rp[fldp->db_foffset], flen);
- cp[flen] = 0;
- }
- return cp;
-}
-
-void put_field_val(char *rp, dbfield_t *fldp, char *cp)
-{
- strncpy(&rp[fldp->db_foffset], cp, fldp->db_flen);
-}
-
-/*
- * output a record
- */
-void out_rec(dbhead_t *dbh, dbfield_t *dbf, char *cp)
-{
- dbfield_t *cur_f;
- int nfields = dbh->db_nfields;
- char *fnp = (char *)malloc(dbh->db_rlen);
-
- printf("%c", *cp);
- for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) {
- printf(" ");
- printf(cur_f->db_format, get_field_val(cp, cur_f, fnp));
- }
- printf("\n");
- free(fnp);
-}
-
-/* check for record validity */
-int is_valid_rec(char *cp)
-{
- if (cp && (*cp == VALID_RECORD))
- return 1;
- else
- return 0;
-}
-
-/* get the next record */
-char *dbf_get_next(dbhead_t *dbh)
-{
- return get_dbf_record(dbh, dbh->db_cur_rec + 1);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dbase/dbf_rec.h b/ext/dbase/dbf_rec.h
deleted file mode 100644
index 6407c702f6..0000000000
--- a/ext/dbase/dbf_rec.h
+++ /dev/null
@@ -1,10 +0,0 @@
-extern char *get_dbf_record(dbhead_t *dbh, long rec_num);
-extern long put_dbf_record(dbhead_t *dbh, long rec_num, char *cp);
-extern int put_piece(dbhead_t *dbh, long offset, char *cp, int len);
-extern int del_dbf_record(dbhead_t *dbh, long rec_num);
-void pack_dbf(dbhead_t *dbh);
-extern char *get_field_val(char *rp, dbfield_t *fldp, char *cp);
-void put_field_val(char *rp, dbfield_t *fldp, char *cp);
-void out_rec(dbhead_t *dbh, dbfield_t *dbf, char *cp);
-extern int is_valid_rec(char *cp);
-extern char *dbf_get_next(dbhead_t *dbh);
diff --git a/ext/dbase/php_dbase.h b/ext/dbase/php_dbase.h
deleted file mode 100644
index 9187d41663..0000000000
--- a/ext/dbase/php_dbase.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_DBASE_H
-#define PHP_DBASE_H
-#if DBASE
-extern zend_module_entry dbase_module_entry;
-#define dbase_module_ptr &dbase_module_entry
-
-PHP_MINIT_FUNCTION(dbase);
-PHP_FUNCTION(dbase_open);
-PHP_FUNCTION(dbase_create);
-PHP_FUNCTION(dbase_close);
-PHP_FUNCTION(dbase_numrecords);
-PHP_FUNCTION(dbase_numfields);
-PHP_FUNCTION(dbase_add_record);
-PHP_FUNCTION(dbase_get_record);
-PHP_FUNCTION(dbase_delete_record);
-PHP_FUNCTION(dbase_pack);
-PHP_FUNCTION(dbase_get_record_with_names);
-#else
-#define dbase_module_ptr NULL
-#endif
-
-#define phpext_dbase_ptr dbase_module_ptr
-
-#endif /* PHP_DBASE_H */
diff --git a/ext/dbx/CREDITS b/ext/dbx/CREDITS
deleted file mode 100644
index efc04660a4..0000000000
--- a/ext/dbx/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-dbx (database abstraction)
-Marc Boeren, Rui Hirokawa, Frank M. Kromann
diff --git a/ext/dbx/INSTALL b/ext/dbx/INSTALL
deleted file mode 100644
index d98e33a42d..0000000000
--- a/ext/dbx/INSTALL
+++ /dev/null
@@ -1,25 +0,0 @@
-
-If you downloaded this separately, you can place the dbx folder
-in the php-source-folders under the ext/ folder. Be sure to
-use buildconf to rebuild the configure script.
-
-Linux:
-
-Compile php with the --enable-dbx switch
-
-Windows:
-
-This should set all includepaths to the right
-relative folders. Open the .dsp and compile. You could also
-add this project to the php_modules project.
-It generates a php_dbx.dll in your extensions folder, and you
-must enable it in your php.ini file.
-
-
-When you run phpinfo(), dbx-support should be visible in the
-resulting table.
-
-Good luck and enjoy!
-
-Marc Boeren
-march 16th, 2001
diff --git a/ext/dbx/config.m4 b/ext/dbx/config.m4
deleted file mode 100644
index 8c5dc11ba8..0000000000
--- a/ext/dbx/config.m4
+++ /dev/null
@@ -1,10 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(dbx,whether to enable dbx support,
-[ --enable-dbx Enable dbx])
-
-if test "$PHP_DBX" != "no"; then
- PHP_NEW_EXTENSION(dbx, dbx.c dbx_mysql.c dbx_odbc.c dbx_pgsql.c dbx_mssql.c dbx_fbsql.c dbx_oci8.c dbx_sybasect.c, $ext_shared)
-fi
diff --git a/ext/dbx/dbx.c b/ext/dbx/dbx.c
deleted file mode 100644
index b0e046c260..0000000000
--- a/ext/dbx/dbx.c
+++ /dev/null
@@ -1,882 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_dbx.h"
-#include "ext/standard/info.h"
-
-/* defines for supported databases */
-#define DBX_UNKNOWN 0
-#define DBX_MYSQL 1
-#define DBX_ODBC 2
-#define DBX_PGSQL 3
-#define DBX_MSSQL 4
-#define DBX_FBSQL 5
-#define DBX_OCI8 6
-#define DBX_SYBASECT 7
-/* includes for supported databases */
-#include "dbx.h"
-#include "dbx_mysql.h"
-#include "dbx_odbc.h"
-#include "dbx_pgsql.h"
-#include "dbx_mssql.h"
-#include "dbx_fbsql.h"
-#include "dbx_oci8.h"
-#include "dbx_sybasect.h"
-
-/* support routines */
-int module_exists(char *module_name)
-{
- zend_module_entry *zme;
- int r;
- r = zend_hash_find(&module_registry, module_name, strlen(module_name)+1, (void **) &zme);
- return r==0?1:0;
-}
-
-int module_identifier_exists(long module_identifier)
-{
- switch (module_identifier) {
- case DBX_MYSQL: return module_exists("mysql");
- case DBX_ODBC: return module_exists("odbc");
- case DBX_PGSQL: return module_exists("pgsql");
- case DBX_MSSQL: return module_exists("mssql");
- case DBX_FBSQL: return module_exists("fbsql");
- case DBX_OCI8: return module_exists("oci8");
- case DBX_SYBASECT: return module_exists("sybase_ct");
- }
- return 0;
-}
-
-int get_module_identifier(char *module_name)
-{
- if (!strcmp("mysql", module_name)) return DBX_MYSQL;
- if (!strcmp("odbc", module_name)) return DBX_ODBC;
- if (!strcmp("pgsql", module_name)) return DBX_PGSQL;
- if (!strcmp("mssql", module_name)) return DBX_MSSQL;
- if (!strcmp("fbsql", module_name)) return DBX_FBSQL;
- if (!strcmp("oci8", module_name)) return DBX_OCI8;
- if (!strcmp("sybase_ct", module_name)) return DBX_SYBASECT;
- return DBX_UNKNOWN;
-}
-
-int split_dbx_handle_object(zval **dbx_object, zval ***pdbx_handle, zval ***pdbx_module, zval ***pdbx_database TSRMLS_DC)
-{
- convert_to_object_ex(dbx_object);
- if (zend_hash_find(Z_OBJPROP_PP(dbx_object), "handle", 7, (void **) pdbx_handle)==FAILURE
- || zend_hash_find(Z_OBJPROP_PP(dbx_object), "module", 7, (void **) pdbx_module)==FAILURE
- || zend_hash_find(Z_OBJPROP_PP(dbx_object), "database", 9, (void **) pdbx_database)==FAILURE) {
- return 0;
- }
- return 1;
-}
-
-/* from dbx.h, to be used in support-files (dbx_mysql.c etc...) */
-void dbx_call_any_function(INTERNAL_FUNCTION_PARAMETERS, char *function_name, zval **returnvalue, int number_of_arguments, zval ***params)
-{
- zval *zval_function_name;
-
- MAKE_STD_ZVAL(zval_function_name);
- ZVAL_STRING(zval_function_name, function_name, 1);
- if (call_user_function_ex(EG(function_table), NULL, zval_function_name, returnvalue, number_of_arguments, params, 0, NULL TSRMLS_CC) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "function '%s' not found", Z_STRVAL_P(zval_function_name));
- }
- zval_dtor(zval_function_name); /* to free stringvalue memory */
- FREE_ZVAL(zval_function_name);
-}
-
-/* switch_dbx functions declarations
- * each must be supported in the dbx_module files as dbx_module_function,
- * e.g. switch_dbx_connect expects a dbx_mysql_connect in de dbx_mysql files
- * all params except the dbx_module param are passed on
- * each must return the expected zval *'s in the rv parameter, which are passed on unmodified
- * do NOT use the return_value parameter from INTERNAL_FUNCTION_PARAMETERS
- * you can additionally return 0 or 1 for failure or success which will also be returned by the switches
- */
-int switch_dbx_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module);
- /* returns connection handle as resource on success or 0 as long on failure */
-int switch_dbx_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module);
- /* returns persistent connection handle as resource on success or 0 as long on failure */
-int switch_dbx_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module);
- /* returns 1 as long on success or 0 as long on failure */
-int switch_dbx_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module);
- /* returns 1 as long or result identifier as resource on success or 0 as long on failure */
-int switch_dbx_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module);
- /* returns column-count as long on success or 0 as long on failure */
-int switch_dbx_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module);
- /* returns column-name as string on success or 0 as long on failure */
-int switch_dbx_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module);
- /* returns column-type as string on success or 0 as long on failure */
-int switch_dbx_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module);
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
-int switch_dbx_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module);
- /* returns string */
-int switch_dbx_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module);
- /* returns escaped string */
-
-/* Every user visible function must have an entry in dbx_functions[].
-*/
-function_entry dbx_functions[] = {
- ZEND_FE(dbx_connect, NULL)
- ZEND_FE(dbx_close, NULL)
- ZEND_FE(dbx_query, NULL)
- ZEND_FE(dbx_error, NULL)
- ZEND_FE(dbx_escape_string, NULL)
-
- ZEND_FE(dbx_sort, NULL)
- ZEND_FE(dbx_compare, NULL)
-
- {NULL, NULL, NULL} /* Must be the last line in dbx_functions[] */
-};
-
-zend_module_entry dbx_module_entry = {
- STANDARD_MODULE_HEADER,
- "dbx",
- dbx_functions,
- ZEND_MINIT(dbx),
- ZEND_MSHUTDOWN(dbx),
- NULL, /*ZEND_RINIT(dbx), Replace with NULL if there's nothing to do at request start */
- NULL, /*ZEND_RSHUTDOWN(dbx), Replace with NULL if there's nothing to do at request end */
- ZEND_MINFO(dbx),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_DBX
-ZEND_GET_MODULE(dbx)
-#endif
-
-ZEND_INI_BEGIN()
- ZEND_INI_ENTRY("dbx.colnames_case", "unchanged", ZEND_INI_SYSTEM, NULL)
-ZEND_INI_END()
-
-ZEND_MINIT_FUNCTION(dbx)
-{
- REGISTER_INI_ENTRIES();
-
- REGISTER_LONG_CONSTANT("DBX_MYSQL", DBX_MYSQL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_ODBC", DBX_ODBC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_PGSQL", DBX_PGSQL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_MSSQL", DBX_MSSQL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_FBSQL", DBX_FBSQL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_OCI8", DBX_OCI8, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_SYBASECT", DBX_SYBASECT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("DBX_PERSISTENT", DBX_PERSISTENT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("DBX_RESULT_INFO", DBX_RESULT_INFO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_RESULT_INDEX", DBX_RESULT_INDEX, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_RESULT_ASSOC", DBX_RESULT_ASSOC, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("DBX_COLNAMES_UNCHANGED", DBX_COLNAMES_UNCHANGED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_COLNAMES_UPPERCASE", DBX_COLNAMES_UPPERCASE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_COLNAMES_LOWERCASE", DBX_COLNAMES_LOWERCASE, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("DBX_CMP_NATIVE", DBX_CMP_NATIVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_CMP_TEXT", DBX_CMP_TEXT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_CMP_NUMBER", DBX_CMP_NUMBER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_CMP_ASC", DBX_CMP_ASC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_CMP_DESC", DBX_CMP_DESC, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-ZEND_MSHUTDOWN_FUNCTION(dbx)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-/* Remove if there's nothing to do at request start */
-/*ZEND_RINIT_FUNCTION(dbx)
-{ return SUCCESS;
-}*/
-
-/* Remove if there's nothing to do at request end */
-/*ZEND_RSHUTDOWN_FUNCTION(dbx)
-{ return SUCCESS;
-}*/
-
-ZEND_MINFO_FUNCTION(dbx)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "dbx support", "enabled");
- php_info_print_table_row(2, "dbx version", "1.0.0");
- php_info_print_table_row(2, "supported databases", "MySQL\nODBC\nPostgreSQL\nMicrosoft SQL Server\nFrontBase\nOracle 8 (oci8)\nSybase-CT");
- php_info_print_table_end();
- DISPLAY_INI_ENTRIES();
-}
-
-/*
-
- actual implementation of the dbx functions
-
-*/
-
-/* {{{ proto dbx_link_object dbx_connect(string module_name, string host, string db, string username, string password [, bool persistent])
- Returns a dbx_link_object on success and returns 0 on failure */
-ZEND_FUNCTION(dbx_connect)
-{
- int number_of_arguments=5;
- zval **arguments[6];
-
- int result;
- long module_identifier;
- zval *dbx_module;
- zval *db_name;
- zval *rv_dbx_handle;
- int persistent=0;
-
- if ( !(ZEND_NUM_ARGS()==number_of_arguments+1 || ZEND_NUM_ARGS()==number_of_arguments) || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (ZEND_NUM_ARGS()==number_of_arguments+1) {
- convert_to_long_ex(arguments[5]);
- if (Z_LVAL_PP(arguments[5])!=0) persistent=1;
- }
-
- if (Z_TYPE_PP(arguments[0]) == IS_LONG) {
- if (!module_identifier_exists(Z_LVAL_PP(arguments[0]))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "dbx: module '%ld' not loaded or not supported.", Z_LVAL_PP(arguments[0]));
- return;
- }
- module_identifier = Z_LVAL_PP(arguments[0]);
- } else {
- convert_to_string_ex(arguments[0]);
- if (!module_exists(Z_STRVAL_PP(arguments[0]))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "dbx: module '%s' not loaded.", Z_STRVAL_PP(arguments[0]));
- return;
- }
- module_identifier=get_module_identifier(Z_STRVAL_PP(arguments[0]));
- if (!module_identifier) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "dbx: unsupported module '%s'.", Z_STRVAL_PP(arguments[0]));
- return;
- }
- }
-
- MAKE_STD_ZVAL(dbx_module);
- ZVAL_LONG(dbx_module, module_identifier);
- MAKE_STD_ZVAL(rv_dbx_handle);
- ZVAL_LONG(rv_dbx_handle, 0);
- convert_to_string_ex(arguments[1]);
- convert_to_string_ex(arguments[2]);
- convert_to_string_ex(arguments[3]);
- convert_to_string_ex(arguments[4]);
- MAKE_STD_ZVAL(db_name);
- ZVAL_STRING(db_name, Z_STRVAL_PP(arguments[2]), 1);
- if (persistent) {
- result = switch_dbx_pconnect(&rv_dbx_handle, arguments[1], arguments[2], arguments[3], arguments[4], INTERNAL_FUNCTION_PARAM_PASSTHRU, &dbx_module);
- } else {
- result = switch_dbx_connect(&rv_dbx_handle, arguments[1], arguments[2], arguments[3], arguments[4], INTERNAL_FUNCTION_PARAM_PASSTHRU, &dbx_module);
- }
- if (!result) {
- FREE_ZVAL(dbx_module);
- zval_dtor(db_name); /* to free stringvalue memory */
- FREE_ZVAL(db_name);
- FREE_ZVAL(rv_dbx_handle);
- RETURN_LONG(0);
- }
-
- object_init(return_value);
-
- zend_hash_update(Z_OBJPROP_P(return_value), "handle", 7, (void *)&(rv_dbx_handle), sizeof(zval *), NULL);
- zend_hash_update(Z_OBJPROP_P(return_value), "module", 7, (void *)&(dbx_module), sizeof(zval *), NULL);
- zend_hash_update(Z_OBJPROP_P(return_value), "database", 9, (void *)&(db_name), sizeof(zval *), NULL);
-}
-/* }}} */
-
-/* {{{ proto bool dbx_close(dbx_link_object dbx_link)
- Returns success or failure
-*/
-ZEND_FUNCTION(dbx_close)
-{
- int number_of_arguments=1;
- zval **arguments[1];
-
- int result;
- zval **dbx_handle;
- zval **dbx_module;
- zval **dbx_database;
- zval *rv_success;
-
- if (ZEND_NUM_ARGS() !=number_of_arguments || zend_get_parameters_array_ex(number_of_arguments, arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!split_dbx_handle_object(arguments[0], &dbx_handle, &dbx_module, &dbx_database TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not a valid dbx_handle-object...");
- RETURN_LONG(0);
- }
-
- MAKE_STD_ZVAL(rv_success);
- ZVAL_LONG(rv_success, 0);
-
- result = switch_dbx_close(&rv_success, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
-
- result = (result && Z_LVAL_P(rv_success))?1:0;
- FREE_ZVAL(rv_success);
-
- RETURN_LONG(result?1:0);
-}
-/* }}} */
-
-/* {{{ proto dbx_result_object dbx_query(dbx_link_object dbx_link, string sql_statement [, long flags])
- Returns a dbx_link_object on success and returns 0 on failure */
-ZEND_FUNCTION(dbx_query)
-{
- int min_number_of_arguments=2;
- int number_of_arguments=3;
- zval **arguments[3];
-
- int result;
- zval **dbx_handle;
- zval **dbx_module;
- zval **dbx_database;
- zval *rv_result_handle;
- zval *rv_column_count;
- long col_index;
- long row_count;
- zval *info;
- long query_flags;
- long result_flags;
- zval *data;
- zval **row_ptr;
- zval **inforow_ptr;
- /* default values for colname-case */
- char * colnames_case = INI_STR("dbx.colnames_case");
- long colcase = DBX_COLNAMES_UNCHANGED;
- if (!strcmp(colnames_case, "uppercase")) {
- colcase = DBX_COLNAMES_UPPERCASE;
- }
- if (!strcmp(colnames_case, "lowercase")) {
- colcase = DBX_COLNAMES_LOWERCASE;
- }
-
- if (ZEND_NUM_ARGS()<min_number_of_arguments || ZEND_NUM_ARGS()>number_of_arguments || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!split_dbx_handle_object(arguments[0], &dbx_handle, &dbx_module, &dbx_database TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not a valid dbx_handle-object...");
- RETURN_LONG(0);
- }
- /* default values */
- result_flags = DBX_RESULT_INFO | DBX_RESULT_INDEX | DBX_RESULT_ASSOC;
- /* parameter overrides */
- if (ZEND_NUM_ARGS()>2) {
- convert_to_long_ex(arguments[2]);
- query_flags = Z_LVAL_PP(arguments[2]);
- /* fieldnames are needed for association! */
- result_flags = (query_flags & DBX_RESULT_INFO) | (query_flags & DBX_RESULT_INDEX) | (query_flags & DBX_RESULT_ASSOC);
- if (result_flags & DBX_RESULT_ASSOC) {
- result_flags |= DBX_RESULT_INFO;
- }
- if (!result_flags) result_flags = DBX_RESULT_INFO | DBX_RESULT_INDEX | DBX_RESULT_ASSOC;
- /* override ini-setting for colcase */
- if (query_flags & DBX_COLNAMES_UNCHANGED) {
- colcase = DBX_COLNAMES_UNCHANGED;
- }
- if (query_flags & DBX_COLNAMES_UPPERCASE) {
- colcase = DBX_COLNAMES_UPPERCASE;
- }
- if (query_flags & DBX_COLNAMES_LOWERCASE) {
- colcase = DBX_COLNAMES_LOWERCASE;
- }
- }
- MAKE_STD_ZVAL(rv_result_handle);
- ZVAL_LONG(rv_result_handle, 0);
- convert_to_string_ex(arguments[1]);
- result = switch_dbx_query(&rv_result_handle, dbx_handle, dbx_database, arguments[1], INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
- /* boolean return value means either failure for any query or success for queries that don't return anything */
- if (!result || (rv_result_handle && Z_TYPE_P(rv_result_handle)==IS_BOOL)) {
- result = (result && Z_LVAL_P(rv_result_handle))?1:0;
- FREE_ZVAL(rv_result_handle);
- RETURN_LONG(result?1:0);
- }
- /* if you get here, the query succeeded and returned results, so we'll return them
- * rv_result_handle holds a resource
- */
- /* init return_value as object (of rows) */
- object_init(return_value);
-
- /* add result_handle property to return_value */
- zend_hash_update(Z_OBJPROP_P(return_value), "handle", 7, (void *)&(rv_result_handle), sizeof(zval *), NULL);
- /* init info property as array and add to return_value as a property */
- if (result_flags & DBX_RESULT_INFO) {
- MAKE_STD_ZVAL(info);
- array_init(info);
- zend_hash_update(Z_OBJPROP_P(return_value), "info", 5, (void *)&(info), sizeof(zval *), NULL);
- }
- /* init data property as array and add to return_value as a property */
- MAKE_STD_ZVAL(data);
- array_init(data);
- zend_hash_update(Z_OBJPROP_P(return_value), "data", 5, (void *)&(data), sizeof(zval *), NULL);
- /* get columncount and add to returnvalue as property */
- MAKE_STD_ZVAL(rv_column_count);
- ZVAL_LONG(rv_column_count, 0);
- result = switch_dbx_getcolumncount(&rv_column_count, &rv_result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
- if (!result) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "get column_count failed...");
- FREE_ZVAL(rv_column_count);
- RETURN_LONG(0);
- }
- zend_hash_update(Z_OBJPROP_P(return_value), "cols", 5, (void *)&(rv_column_count), sizeof(zval *), NULL);
- /* fill the info array with columnnames and types (indexed and assoc) */
- if (result_flags & DBX_RESULT_INFO) {
- zval *info_row_name;
- zval *info_row_type;
- MAKE_STD_ZVAL(info_row_name);
- MAKE_STD_ZVAL(info_row_type);
- array_init(info_row_name);
- array_init(info_row_type);
- for (col_index=0; col_index<Z_LVAL_P(rv_column_count); ++col_index) {
- zval *rv_column_name;
- zval *rv_column_type;
- /* get name */
- MAKE_STD_ZVAL(rv_column_name);
- ZVAL_LONG(rv_column_name, 0);
- result = switch_dbx_getcolumnname(&rv_column_name, &rv_result_handle, col_index, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
- /* modify case if requested */
- if (colcase==DBX_COLNAMES_UPPERCASE) {
- php_strtoupper(Z_STRVAL_P(rv_column_name), Z_STRLEN_P(rv_column_name));
- }
- if (colcase==DBX_COLNAMES_LOWERCASE) {
- php_strtolower(Z_STRVAL_P(rv_column_name), Z_STRLEN_P(rv_column_name));
- }
- if (result) {
- zend_hash_index_update(Z_ARRVAL_P(info_row_name), col_index, (void *)&(rv_column_name), sizeof(zval *), NULL);
- } else {
- FREE_ZVAL(rv_column_name);
- }
- /* get type */
- MAKE_STD_ZVAL(rv_column_type);
- ZVAL_LONG(rv_column_type, 0);
- result = switch_dbx_getcolumntype(&rv_column_type, &rv_result_handle, col_index, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
- if (result) {
- zend_hash_index_update(Z_ARRVAL_P(info_row_type), col_index, (void *)&(rv_column_type), sizeof(zval *), NULL);
- } else {
- FREE_ZVAL(rv_column_type);
- }
- }
- zend_hash_update(Z_ARRVAL_P(info), "name", 5, (void *) &info_row_name, sizeof(zval *), (void **) &inforow_ptr);
- zend_hash_update(Z_ARRVAL_P(info), "type", 5, (void *) &info_row_type, sizeof(zval *), NULL);
- }
- /* fill each row array with fieldvalues (indexed (and assoc)) */
- row_count=0;
- result=1;
- while (result) {
- zval *rv_row;
- MAKE_STD_ZVAL(rv_row);
- ZVAL_LONG(rv_row, 0);
- result = switch_dbx_getrow(&rv_row, &rv_result_handle, row_count, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
- if (result) {
- zend_hash_index_update(Z_ARRVAL_P(data), row_count, (void *)&(rv_row), sizeof(zval *), (void **) &row_ptr);
- /* associate results with fieldnames */
- if (result_flags & DBX_RESULT_ASSOC) {
- zval **columnname_ptr, **actual_ptr;
- for (col_index=0; col_index<Z_LVAL_P(rv_column_count); ++col_index) {
- zend_hash_index_find(Z_ARRVAL_PP(inforow_ptr), col_index, (void **) &columnname_ptr);
- zend_hash_index_find(Z_ARRVAL_PP(row_ptr), col_index, (void **) &actual_ptr);
- (*actual_ptr)->refcount+=1;
- (*actual_ptr)->is_ref=1;
- zend_hash_update(Z_ARRVAL_PP(row_ptr), Z_STRVAL_PP(columnname_ptr), Z_STRLEN_PP(columnname_ptr) + 1, actual_ptr, sizeof(zval *), NULL);
- }
- }
- ++row_count;
- } else {
- FREE_ZVAL(rv_row);
- }
- }
- /* add row_count property */
- add_property_long(return_value, "rows", row_count);
-}
-/* }}} */
-
-/* {{{ proto void dbx_error(dbx_link_object dbx_link)
- Returns success or failure
-*/
-ZEND_FUNCTION(dbx_error)
-{
- int number_of_arguments=1;
- zval **arguments[1];
-
- int result;
- zval **dbx_handle;
- zval **dbx_module;
- zval **dbx_database;
- zval *rv_errormsg;
-
- if (ZEND_NUM_ARGS() !=number_of_arguments || zend_get_parameters_array_ex(number_of_arguments, arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!split_dbx_handle_object(arguments[0], &dbx_handle, &dbx_module, &dbx_database TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not a valid dbx_handle-object...");
- RETURN_LONG(0);
- }
-
- MAKE_STD_ZVAL(rv_errormsg);
- ZVAL_LONG(rv_errormsg, 0);
- result = switch_dbx_error(&rv_errormsg, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
- if (!result) {
- FREE_ZVAL(rv_errormsg);
- RETURN_STRING("", 1);
- }
- MOVE_RETURNED_TO_RV(&return_value, rv_errormsg);
-}
-/* }}} */
-
-/* {{{ proto string dbx_escape_string(dbx_link_object dbx_link, string sz)
- Returns escaped string or NULL on error
-*/
-ZEND_FUNCTION(dbx_escape_string)
-{
- int number_of_arguments=2;
- zval **arguments[2];
-
- int result;
- zval **dbx_handle;
- zval **dbx_module;
- zval **dbx_database;
- zval *rv;
-
- if (ZEND_NUM_ARGS() !=number_of_arguments || zend_get_parameters_array_ex(number_of_arguments, arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!split_dbx_handle_object(arguments[0], &dbx_handle, &dbx_module, &dbx_database TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not a valid dbx_handle-object...");
- RETURN_NULL();
- }
- convert_to_string_ex(arguments[1]);
-
- MAKE_STD_ZVAL(rv);
- ZVAL_LONG(rv, 0);
- result = switch_dbx_esc(&rv, dbx_handle, arguments[1], INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
- if (!result) { /* this will probably never happen */
- FREE_ZVAL(rv);
- RETURN_NULL();
- }
- MOVE_RETURNED_TO_RV(&return_value, rv);
-}
-/* }}} */
-
-/*
- * dbx functions that are database independent... like sorting result_objects!
- */
-
-/* {{{ proto int dbx_compare(array row_x, array row_y, string columnname [, int flags])
- Returns row_y[columnname] - row_x[columnname], converted to -1, 0 or 1 */
-ZEND_FUNCTION(dbx_compare)
-{
- int min_number_of_arguments=3;
- int max_number_of_arguments=4;
- int number_of_arguments=-1;
- long comparison_direction=DBX_CMP_ASC;
- long comparison_type=DBX_CMP_NATIVE;
- double dtemp;
- long ltemp;
- zval **arguments[4];
- zval **zv_a;
- zval **zv_b;
- int result=0;
- number_of_arguments=ZEND_NUM_ARGS();
- if (number_of_arguments<min_number_of_arguments || number_of_arguments>max_number_of_arguments || zend_get_parameters_array_ex(number_of_arguments, arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(arguments[0]) != IS_ARRAY
- || Z_TYPE_PP(arguments[1]) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong argument type for compare");
- RETURN_LONG(0);
- }
- convert_to_string_ex(arguments[2]); /* field name */
- comparison_type = DBX_CMP_NATIVE;
- comparison_direction = DBX_CMP_ASC;
- if (number_of_arguments>3) {
- convert_to_long_ex(arguments[3]); /* comparison type and direction*/
- /* direction */
- if (Z_LVAL_PP(arguments[3]) & DBX_CMP_DESC) {
- comparison_direction=DBX_CMP_DESC;
- }
- if (Z_LVAL_PP(arguments[3]) & DBX_CMP_ASC) {
- comparison_direction=DBX_CMP_ASC;
- }
- /* type */
- if (Z_LVAL_PP(arguments[3]) & DBX_CMP_NUMBER) {
- comparison_type=DBX_CMP_NUMBER;
- }
- if (Z_LVAL_PP(arguments[3]) & DBX_CMP_TEXT) {
- comparison_type=DBX_CMP_TEXT;
- }
- if (Z_LVAL_PP(arguments[3]) & DBX_CMP_NATIVE) {
- comparison_type=DBX_CMP_NATIVE;
- }
- }
-
- if (zend_hash_find(Z_ARRVAL_PP(arguments[0]), Z_STRVAL_PP(arguments[2]), Z_STRLEN_PP(arguments[2])+1, (void **) &zv_a)==FAILURE
- || zend_hash_find(Z_ARRVAL_PP(arguments[1]), Z_STRVAL_PP(arguments[2]), Z_STRLEN_PP(arguments[2])+1, (void **) &zv_b)==FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field '%s' not available in result-object", Z_STRVAL_PP(arguments[2]));
- RETURN_LONG(0);
- }
-
- switch (comparison_type) {
- case DBX_CMP_TEXT:
- convert_to_string_ex(zv_a);
- convert_to_string_ex(zv_b);
- break;
- case DBX_CMP_NUMBER:
- convert_to_double_ex(zv_a);
- convert_to_double_ex(zv_b);
- break;
- }
- switch (Z_TYPE_PP(zv_a)) {
- case IS_NULL:
- result=0;
- break;
- case IS_BOOL:
- case IS_LONG:
- case IS_CONSTANT:
- ltemp = Z_LVAL_PP(zv_a) - Z_LVAL_PP(zv_b);
- result = (ltemp==0?0: (ltemp>0?1:-1));
- break;
- case IS_DOUBLE:
- dtemp = (Z_DVAL_PP(zv_a) - Z_DVAL_PP(zv_b));
- result = (dtemp==0?0: (dtemp>0?1:-1));
- break;
- case IS_STRING:
- ltemp = strcmp(Z_STRVAL_PP(zv_a), Z_STRVAL_PP(zv_b));
- result = (ltemp==0?0: (ltemp>0?1:-1));
- break;
- default: result=0;
- }
-
- if (comparison_direction==DBX_CMP_DESC) RETURN_LONG(-result);
- RETURN_LONG(result);
-}
-/* }}} */
-
-/* {{{ proto int dbx_sort(object dbx_result, string compare_function_name)
- Returns 0 on failure, 1 on success */
-ZEND_FUNCTION(dbx_sort)
-{
- int number_of_arguments=2;
- zval **arguments[2];
- zval **zval_data;
- zval *returned_zval;
- if (ZEND_NUM_ARGS() !=number_of_arguments || zend_get_parameters_array_ex(number_of_arguments, arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(arguments[0]) != IS_OBJECT
- || Z_TYPE_PP(arguments[1]) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong argument type for sort");
- RETURN_LONG(0);
- }
-
- if (zend_hash_find(Z_OBJPROP_PP(arguments[0]), "data", 5, (void **) &zval_data)==FAILURE
- || Z_TYPE_PP(zval_data) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong argument type for sort");
- RETURN_LONG(0);
- }
-
- arguments[0] = zval_data;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "usort", &returned_zval, number_of_arguments, arguments);
- zval_ptr_dtor(&returned_zval);
-
- RETURN_LONG(1);
-}
-/* }}} */
-
-/***********************************/
-
-/*
- * switch_dbx functions
- */
-int switch_dbx_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module)
-{
- /* returns connection handle as resource on success or 0 as long on failure */
- switch (Z_LVAL_PP(dbx_module)) {
- case DBX_MYSQL: return dbx_mysql_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_FBSQL: return dbx_fbsql_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_OCI8: return dbx_oci8_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_SYBASECT: return dbx_sybasect_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not supported in this module");
- return 0;
-}
-
-int switch_dbx_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module)
-{
- /* returns persistent connection handle as resource on success or 0 as long on failure */
- switch (Z_LVAL_PP(dbx_module)) {
- case DBX_MYSQL: return dbx_mysql_pconnect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_pconnect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_pconnect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_pconnect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_FBSQL: return dbx_fbsql_pconnect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_OCI8: return dbx_oci8_pconnect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_SYBASECT: return dbx_sybasect_pconnect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not supported in this module");
- return 0;
-}
-
-int switch_dbx_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module)
-{
- /* returns 1 as long on success or 0 as long on failure */
- switch (Z_LVAL_PP(dbx_module)) {
- case DBX_MYSQL: return dbx_mysql_close(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_close(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_close(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_close(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_FBSQL: return dbx_fbsql_close(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_OCI8: return dbx_oci8_close(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_SYBASECT: return dbx_sybasect_close(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not supported in this module");
- return 0;
-}
-
-int switch_dbx_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module)
-{
- /* returns 1 as long or result identifier as resource on success or 0 as long on failure */
- switch (Z_LVAL_PP(dbx_module)) {
- case DBX_MYSQL: return dbx_mysql_query(rv, dbx_handle, db_name, sql_statement, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_query(rv, dbx_handle, db_name, sql_statement, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_query(rv, dbx_handle, db_name, sql_statement, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_query(rv, dbx_handle, db_name, sql_statement, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_FBSQL: return dbx_fbsql_query(rv, dbx_handle, db_name, sql_statement, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_OCI8: return dbx_oci8_query(rv, dbx_handle, db_name, sql_statement, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_SYBASECT: return dbx_sybasect_query(rv, dbx_handle, db_name, sql_statement, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not supported in this module");
- return 0;
-}
-
-int switch_dbx_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module)
-{
- /* returns column-count as long on success or 0 as long on failure */
- switch (Z_LVAL_PP(dbx_module)) {
- case DBX_MYSQL: return dbx_mysql_getcolumncount(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_getcolumncount(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_getcolumncount(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_getcolumncount(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_FBSQL: return dbx_fbsql_getcolumncount(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_OCI8: return dbx_oci8_getcolumncount(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_SYBASECT: return dbx_sybasect_getcolumncount(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not supported in this module");
- return 0;
-}
-
-int switch_dbx_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module)
-{
- /* returns column-name as string on success or 0 as long on failure */
- switch (Z_LVAL_PP(dbx_module)) {
- case DBX_MYSQL: return dbx_mysql_getcolumnname(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_getcolumnname(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_getcolumnname(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_getcolumnname(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_FBSQL: return dbx_fbsql_getcolumnname(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_OCI8: return dbx_oci8_getcolumnname(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_SYBASECT: return dbx_sybasect_getcolumnname(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not supported in this module");
- return 0;
-}
-
-int switch_dbx_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module)
-{
- /* returns column-type as string on success or 0 as long on failure */
- switch (Z_LVAL_PP(dbx_module)) {
- case DBX_MYSQL: return dbx_mysql_getcolumntype(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_getcolumntype(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_getcolumntype(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_getcolumntype(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_FBSQL: return dbx_fbsql_getcolumntype(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_OCI8: return dbx_oci8_getcolumntype(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_SYBASECT: return dbx_sybasect_getcolumntype(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not supported in this module");
- return 0;
-}
-
-int switch_dbx_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module)
-{
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
- switch (Z_LVAL_PP(dbx_module)) {
- case DBX_MYSQL: return dbx_mysql_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_FBSQL: return dbx_fbsql_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_OCI8: return dbx_oci8_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_SYBASECT: return dbx_sybasect_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not supported in this module");
- return 0;
-}
-
-int switch_dbx_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module)
-{
- /* returns string */
- switch (Z_LVAL_PP(dbx_module)) {
- case DBX_MYSQL: return dbx_mysql_error(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_error(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_error(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_error(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_FBSQL: return dbx_fbsql_error(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- /* case DBX_OCI8: return dbx_oci8_error(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU); */
- case DBX_SYBASECT: return dbx_sybasect_error(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not supported in this module");
- return 0;
-}
-
-int switch_dbx_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module)
-{
- /* returns escaped string */
- switch (Z_LVAL_PP(dbx_module)) {
- case DBX_MYSQL: return dbx_mysql_esc(rv, dbx_handle, string, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_esc(rv, dbx_handle, string, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_esc(rv, dbx_handle, string, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_esc(rv, dbx_handle, string, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_FBSQL: return dbx_fbsql_esc(rv, dbx_handle, string, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_OCI8: return dbx_oci8_esc(rv, dbx_handle, string, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_SYBASECT: return dbx_sybasect_esc(rv, dbx_handle, string, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not supported in this module");
- return 0;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx.dsp b/ext/dbx/dbx.dsp
deleted file mode 100644
index d4f5951490..0000000000
--- a/ext/dbx/dbx.dsp
+++ /dev/null
@@ -1,173 +0,0 @@
-# Microsoft Developer Studio Project File - Name="dbx" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=dbx - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "dbx.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "dbx.mak" CFG="dbx - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "dbx - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dbx - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "dbx - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_dbx" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "DBX_EXPORTS" /D "COMPILE_DL_DBX" /D ZTS=1 /D HAVE_LIBINTL=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dbx.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dbx.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "dbx - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_dbx" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DBX_EXPORTS" /D "COMPILE_DL_DBX" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LIBINTL=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"../../Debug_TS/php_dbx.dll" /libpath:"..\..\Debug_TS"
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"../../Debug_TS/php_dbx.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "dbx - Win32 Release_TS"
-# Name "dbx - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\dbx.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_fbsql.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_mssql.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_mysql.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_oci8.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_odbc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_pgsql.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_sybasect.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\dbx.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_fbsql.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_mssql.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_mysql.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_oci8.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_odbc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_pgsql.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_sybasect.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_dbx.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/dbx/dbx.h b/ext/dbx/dbx.h
deleted file mode 100644
index d79040e171..0000000000
--- a/ext/dbx/dbx.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_DBX_H
-#define ZEND_DBX_H
-
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/php_string.h"
-
-#define DBX_PERSISTENT (1<<0)
-
-#define DBX_RESULT_INFO (1<<0)
-#define DBX_RESULT_INDEX (1<<1)
-#define DBX_RESULT_ASSOC (1<<2)
-#define DBX_COLNAMES_UNCHANGED (1<<3)
-#define DBX_COLNAMES_UPPERCASE (1<<4)
-#define DBX_COLNAMES_LOWERCASE (1<<5)
-
-#define DBX_CMP_NATIVE (1<<0)
-#define DBX_CMP_TEXT (1<<1)
-#define DBX_CMP_NUMBER (1<<2)
-#define DBX_CMP_ASC (1<<3)
-#define DBX_CMP_DESC (1<<4)
-
-#define MOVE_RETURNED_TO_RV(rv, returned_zval) { **rv = *returned_zval; zval_copy_ctor(*rv); zval_ptr_dtor(&returned_zval); }
-
-void dbx_call_any_function(INTERNAL_FUNCTION_PARAMETERS, char *function_name, zval **returnvalue, int number_of_arguments, zval ***params);
-
-#endif /* ZEND_DBX_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_fbsql.c b/ext/dbx/dbx_fbsql.c
deleted file mode 100644
index 5e865e0257..0000000000
--- a/ext/dbx/dbx_fbsql.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- | Frank M. Kromann <frank@frontbase.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "dbx.h"
-#include "dbx_fbsql.h"
-
-#define FBSQL_ASSOC 1<<0
-#define FBSQL_NUM 1<<1
-
-int dbx_fbsql_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval **arguments[3];
- zval *returned_zval=NULL;
- zval *select_db_zval=NULL;
-
- arguments[0]=host;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_connect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
-
- number_of_arguments=2;
- arguments[0]=db;
- arguments[1]=&returned_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_select_db", &select_db_zval, number_of_arguments, arguments);
- if (!select_db_zval || (Z_TYPE_P(select_db_zval)==IS_BOOL && Z_LVAL_P(select_db_zval)==0) ) {
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- /* also close connection */
- number_of_arguments=1;
- arguments[0]=&returned_zval;
- zend_list_addref(Z_LVAL_P(returned_zval));
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_close", &select_db_zval, number_of_arguments, arguments);
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- zval_ptr_dtor(&returned_zval);
- return 0;
- }
- zval_ptr_dtor(&select_db_zval);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_fbsql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns persistent connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval **arguments[3];
- zval *returned_zval=NULL;
- zval *select_db_zval=NULL;
-
- arguments[0]=host;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_pconnect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
-
- number_of_arguments=2;
- arguments[0]=db;
- arguments[1]=&returned_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_select_db", &select_db_zval, number_of_arguments, arguments);
- if (!select_db_zval || (Z_TYPE_P(select_db_zval)==IS_BOOL && Z_LVAL_P(select_db_zval)==0) ) {
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- /* also close connection */
- number_of_arguments=1;
- arguments[0]=&returned_zval;
- zend_list_addref(Z_LVAL_P(returned_zval));
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_close", &select_db_zval, number_of_arguments, arguments);
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- zval_ptr_dtor(&returned_zval);
- return 0;
- }
- zval_ptr_dtor(&select_db_zval);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_fbsql_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns 1 as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_close", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_BOOL) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_fbsql_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval **arguments[3];
- zval *returned_zval=NULL;
-
- arguments[0]=db_name;
- arguments[1]=sql_statement;
- arguments[2]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_db_query", &returned_zval, number_of_arguments, arguments);
- /* fbsql_query returns a bool for success or failure, or a result_identifier for select statements */
- if (!returned_zval || (Z_TYPE_P(returned_zval)!=IS_BOOL && Z_TYPE_P(returned_zval)!=IS_RESOURCE)) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_fbsql_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-count as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_num_fields", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_LONG) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_fbsql_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-name as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_column_index;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_field_name", &returned_zval, number_of_arguments, arguments);
- /* fbsql_field_name returns a string */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_fbsql_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-type as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_column_index;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_field_type", &returned_zval, number_of_arguments, arguments);
- /* fbsql_field_name returns a string */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_fbsql_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_resulttype=NULL;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_resulttype);
- ZVAL_LONG(zval_resulttype, FBSQL_NUM);
- arguments[0]=result_handle;
- arguments[1]=&zval_resulttype;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_fetch_array", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_ARRAY) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_resulttype);
- return 0;
- }
- FREE_ZVAL(zval_resulttype);
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_fbsql_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns string */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- if (!dbx_handle) number_of_arguments=0;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_error", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_fbsql_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns escaped string */
- /* replace \ with \\ */
- /* ' with '' */
- char * str;
- int len;
- char * tmpstr;
- int tmplen;
-
- if (Z_STRLEN_PP(string) == 0) {
- ZVAL_EMPTY_STRING(*rv);
- return 1;
- }
- tmpstr = estrdup(Z_STRVAL_PP(string));
- tmplen = Z_STRLEN_PP(string);
- /* php_str_to_str uses a smart_str that allocates memory */
- /* this memory must be freed or passed on to rv */
- str = php_str_to_str(tmpstr, tmplen, "'", 1, "''", 2, &len);
- efree(tmpstr);
-
- ZVAL_STRINGL(*rv, str, len, 0);
-
- return 1;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_fbsql.h b/ext/dbx/dbx_fbsql.h
deleted file mode 100644
index 5d75ace96e..0000000000
--- a/ext/dbx/dbx_fbsql.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- | Frank M. Kromann <frank@frontbase.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_DBX_FBSQL_H
-#define ZEND_DBX_FBSQL_H
-
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-#include "php.h"
-
-int dbx_fbsql_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns connection handle as resource on success or 0 as long on failure */
-int dbx_fbsql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns persistent connection handle as resource on success or 0 as long on failure */
-int dbx_fbsql_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long on success or 0 as long on failure */
-int dbx_fbsql_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
-int dbx_fbsql_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-count as long on success or 0 as long on failure */
-int dbx_fbsql_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-name as string on success or 0 as long on failure */
-int dbx_fbsql_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-type as string on success or 0 as long on failure */
-int dbx_fbsql_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS);
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
-int dbx_fbsql_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns string */
-int dbx_fbsql_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS);
- /* returns escaped string */
-
-#endif /* ZEND_DBX_FBSQL_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_mssql.c b/ext/dbx/dbx_mssql.c
deleted file mode 100644
index 6bc0986351..0000000000
--- a/ext/dbx/dbx_mssql.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "dbx.h"
-#include "dbx_mssql.h"
-
-#define MSSQL_ASSOC 1<<0
-#define MSSQL_NUM 1<<1
-
-int dbx_mssql_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval **arguments[3];
- zval *returned_zval=NULL;
- zval *select_db_zval=NULL;
-
- arguments[0]=host;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_connect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
-
- number_of_arguments=2;
- arguments[0]=db;
- arguments[1]=&returned_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_select_db", &select_db_zval, number_of_arguments, arguments);
- if (!select_db_zval || (Z_TYPE_P(select_db_zval)==IS_BOOL && Z_LVAL_P(select_db_zval)==0) ) {
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- /* also close connection */
- number_of_arguments=1;
- arguments[0]=&returned_zval;
- zend_list_addref(Z_LVAL_P(returned_zval));
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_close", &select_db_zval, number_of_arguments, arguments);
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- zval_ptr_dtor(&returned_zval);
- return 0;
- }
- zval_ptr_dtor(&select_db_zval);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mssql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns persistent connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval **arguments[3];
- zval *returned_zval=NULL;
- zval *select_db_zval=NULL;
-
- arguments[0]=host;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_pconnect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
-
- number_of_arguments=2;
- arguments[0]=db;
- arguments[1]=&returned_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_select_db", &select_db_zval, number_of_arguments, arguments);
- if (!select_db_zval || (Z_TYPE_P(select_db_zval)==IS_BOOL && Z_LVAL_P(select_db_zval)==0) ) {
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- /* also close connection */
- number_of_arguments=1;
- arguments[0]=&returned_zval;
- zend_list_addref(Z_LVAL_P(returned_zval));
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_close", &select_db_zval, number_of_arguments, arguments);
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- zval_ptr_dtor(&returned_zval);
- return 0;
- }
- zval_ptr_dtor(&select_db_zval);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mssql_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns 1 as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_close", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_BOOL) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mssql_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *returned_zval=NULL;
- zval *select_db_zval=NULL;
-
- number_of_arguments=2;
- arguments[0]=db_name;
- arguments[1]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_select_db", &select_db_zval, number_of_arguments, arguments);
- zval_ptr_dtor(&select_db_zval);
-
- number_of_arguments=2;
- arguments[0]=sql_statement;
- arguments[1]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_query", &returned_zval, number_of_arguments, arguments);
- /* mssql_query returns a bool for success or failure, or a result_identifier for select statements */
- if (!returned_zval || (Z_TYPE_P(returned_zval)!=IS_BOOL && Z_TYPE_P(returned_zval)!=IS_RESOURCE)) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mssql_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-count as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_num_fields", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_LONG) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mssql_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-name as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_column_index;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_field_name", &returned_zval, number_of_arguments, arguments);
- /* mssql_field_name returns a string */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mssql_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-type as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_column_index;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_field_type", &returned_zval, number_of_arguments, arguments);
- /* mssql_field_name returns a string */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mssql_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_fetch_row", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_ARRAY) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mssql_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns string */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- if (!dbx_handle) number_of_arguments=0;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_get_last_message", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mssql_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns escaped string */
- /* replace ' with '' */
- char * str;
- int len;
- char * tmpstr;
- int tmplen;
-
- if (Z_STRLEN_PP(string) == 0) {
- ZVAL_EMPTY_STRING(*rv);
- return 1;
- }
- tmpstr = estrdup(Z_STRVAL_PP(string));
- tmplen = Z_STRLEN_PP(string);
- /* php_str_to_str uses a smart_str that allocates memory */
- /* this memory must be freed or passed on to rv */
- str = php_str_to_str(tmpstr, tmplen, "'", 1, "''", 2, &len);
- efree(tmpstr);
-
- ZVAL_STRINGL(*rv, str, len, 0);
-
- return 1;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_mssql.h b/ext/dbx/dbx_mssql.h
deleted file mode 100644
index d51df37f5b..0000000000
--- a/ext/dbx/dbx_mssql.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_DBX_MSSQL_H
-#define ZEND_DBX_MSSQL_H
-
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-#include "php.h"
-
-int dbx_mssql_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns connection handle as resource on success or 0 as long on failure */
-int dbx_mssql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns persistent connection handle as resource on success or 0 as long on failure */
-int dbx_mssql_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long on success or 0 as long on failure */
-int dbx_mssql_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
-int dbx_mssql_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-count as long on success or 0 as long on failure */
-int dbx_mssql_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-name as string on success or 0 as long on failure */
-int dbx_mssql_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-type as string on success or 0 as long on failure */
-int dbx_mssql_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS);
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
-int dbx_mssql_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns string */
-int dbx_mssql_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS);
- /* returns escaped string */
-
-#endif /* ZEND_DBX_MSSQL_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_mysql.c b/ext/dbx/dbx_mysql.c
deleted file mode 100644
index 753ce7b627..0000000000
--- a/ext/dbx/dbx_mysql.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "dbx.h"
-#include "dbx_mysql.h"
-
-#define MYSQL_ASSOC 1<<0
-#define MYSQL_NUM 1<<1
-
-int dbx_mysql_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval **arguments[3];
- zval *returned_zval=NULL;
- zval *select_db_zval=NULL;
-
- arguments[0]=host;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_connect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
-
- number_of_arguments=2;
- arguments[0]=db;
- arguments[1]=&returned_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_select_db", &select_db_zval, number_of_arguments, arguments);
- if (!select_db_zval || (Z_TYPE_P(select_db_zval)==IS_BOOL && Z_LVAL_P(select_db_zval)==0) ) {
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- /* also close connection */
- number_of_arguments=1;
- arguments[0]=&returned_zval;
- zend_list_addref(Z_LVAL_P(returned_zval));
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_close", &select_db_zval, number_of_arguments, arguments);
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- zval_ptr_dtor(&returned_zval);
- return 0;
- }
- zval_ptr_dtor(&select_db_zval);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mysql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns persistent connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval **arguments[3];
- zval *returned_zval=NULL;
- zval *select_db_zval=NULL;
-
- arguments[0]=host;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_pconnect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
-
- number_of_arguments=2;
- arguments[0]=db;
- arguments[1]=&returned_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_select_db", &select_db_zval, number_of_arguments, arguments);
- if (!select_db_zval || (Z_TYPE_P(select_db_zval)==IS_BOOL && Z_LVAL_P(select_db_zval)==0) ) {
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- /* also close connection */
- number_of_arguments=1;
- arguments[0]=&returned_zval;
- zend_list_addref(Z_LVAL_P(returned_zval));
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_close", &select_db_zval, number_of_arguments, arguments);
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- zval_ptr_dtor(&returned_zval);
- return 0;
- }
- zval_ptr_dtor(&select_db_zval);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mysql_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns 1 as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_close", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_BOOL) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mysql_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *returned_zval=NULL;
- zval *select_db_zval=NULL;
-
- number_of_arguments=2;
- arguments[0]=db_name;
- arguments[1]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_select_db", &select_db_zval, number_of_arguments, arguments);
- zval_ptr_dtor(&select_db_zval);
-
- number_of_arguments=2;
- arguments[0]=sql_statement;
- arguments[1]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_query", &returned_zval, number_of_arguments, arguments);
- /* mysql_query returns a bool for success or failure, or a result_identifier for select statements */
- if (!returned_zval || (Z_TYPE_P(returned_zval)!=IS_BOOL && Z_TYPE_P(returned_zval)!=IS_RESOURCE)) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mysql_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-count as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_num_fields", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_LONG) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mysql_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-name as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_column_index;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_field_name", &returned_zval, number_of_arguments, arguments);
- /* mysql_field_name returns a string */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mysql_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-type as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_column_index;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_field_type", &returned_zval, number_of_arguments, arguments);
- /* mysql_field_name returns a string */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mysql_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_resulttype=NULL;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_resulttype);
- ZVAL_LONG(zval_resulttype, MYSQL_NUM);
- arguments[0]=result_handle;
- arguments[1]=&zval_resulttype;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_fetch_array", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_ARRAY) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_resulttype);
- return 0;
- }
- FREE_ZVAL(zval_resulttype);
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mysql_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns string */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- if (!dbx_handle) number_of_arguments=0;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_error", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_mysql_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns escaped string */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *returned_zval=NULL;
- char * str;
- int len;
- char * tmpstr;
- int tmplen;
-
- if (Z_STRLEN_PP(string) == 0) {
- ZVAL_EMPTY_STRING(*rv);
- return 1;
- }
- arguments[0]=string;
- arguments[1]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_real_escape_string", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- /* mysql_real_escape_string failed, just do my own escaping then */
- /* replace \ with \\ */
- /* ' with '' */
-
- tmpstr = estrdup(Z_STRVAL_PP(string));
- tmplen = Z_STRLEN_PP(string);
- /* php_str_to_str uses a smart_str that allocates memory */
- /* this memory must be freed or passed on to rv */
- str = php_str_to_str(tmpstr, tmplen, "\\", 1, "\\\\", 2, &len);
- efree(tmpstr);
- tmpstr=str; tmplen=len;
- str = php_str_to_str(tmpstr, tmplen, "'", 1, "''", 2, &len);
- efree(tmpstr);
-
- ZVAL_STRINGL(*rv, str, len, 0);
- return 1;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_mysql.h b/ext/dbx/dbx_mysql.h
deleted file mode 100644
index 8ab3733db6..0000000000
--- a/ext/dbx/dbx_mysql.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_DBX_MYSQL_H
-#define ZEND_DBX_MYSQL_H
-
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-#include "php.h"
-
-int dbx_mysql_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns connection handle as resource on success or 0 as long on failure */
-int dbx_mysql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns persistent connection handle as resource on success or 0 as long on failure */
-int dbx_mysql_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long on success or 0 as long on failure */
-int dbx_mysql_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
-int dbx_mysql_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-count as long on success or 0 as long on failure */
-int dbx_mysql_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-name as string on success or 0 as long on failure */
-int dbx_mysql_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-type as string on success or 0 as long on failure */
-int dbx_mysql_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS);
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
-int dbx_mysql_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns string */
-int dbx_mysql_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS);
- /* returns escaped string */
-
-#endif /* ZEND_DBX_MYSQL_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_oci8.c b/ext/dbx/dbx_oci8.c
deleted file mode 100644
index 9e14b2d090..0000000000
--- a/ext/dbx/dbx_oci8.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "dbx.h"
-#include "dbx_oci8.h"
-
-#define OCI_ASSOC 1<<0
-#define OCI_NUM 1<<1
-#define OCI_RETURN_NULLS 1<<2
-#define OCI_RETURN_LOBS 1<<3
-
-int dbx_oci8_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval **arguments[3];
- zval *returned_zval=NULL;
-
- arguments[0]=username;
- arguments[1]=password;
- arguments[2]=db;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCILogon", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_oci8_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval **arguments[3];
- zval *returned_zval=NULL;
-
- arguments[0]=username;
- arguments[1]=password;
- arguments[2]=db;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIPLogon", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_oci8_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns 1 as long on success or 0 as long on failure */
- /* actually, ocilogoff officially does nothing, so what should I return? */
- /* I will just return NULL right now and change the test accordingly */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCILogOff", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_BOOL) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_oci8_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *returned_zval=NULL;
- zval *execute_zval=NULL;
- zval *statementtype_zval=NULL;
-
- arguments[0]=dbx_handle;
- arguments[1]=sql_statement;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIParse", &returned_zval, number_of_arguments, arguments);
- /* OCIParse returns a bool for failure, or a statement_identifier for valid sql_statements */
- if (!returned_zval || (Z_TYPE_P(returned_zval)!=IS_BOOL && Z_TYPE_P(returned_zval)!=IS_RESOURCE)) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- number_of_arguments=1;
- arguments[0]=&returned_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIExecute", &execute_zval, number_of_arguments, arguments);
- /* OCIExecute returns a bool for success or failure */
- if (!execute_zval || Z_TYPE_P(execute_zval)!=IS_BOOL || Z_BVAL_P(execute_zval)==0) {
- if (execute_zval) zval_ptr_dtor(&execute_zval);
- zval_ptr_dtor(&returned_zval);
- return 0;
- }
- number_of_arguments=1;
- arguments[0]=&returned_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIStatementType", &statementtype_zval, number_of_arguments, arguments);
- /* OCIStatementType returns a string. 'SELECT' means there are results */
- if (!statementtype_zval || Z_TYPE_P(statementtype_zval)!=IS_STRING) {
- if (statementtype_zval) zval_ptr_dtor(&statementtype_zval);
- if (execute_zval) zval_ptr_dtor(&execute_zval);
- zval_ptr_dtor(&returned_zval);
- return 0;
- }
-
- if (!zend_binary_strcmp(Z_STRVAL_P(statementtype_zval), Z_STRLEN_P(statementtype_zval), "SELECT", sizeof("SELECT")-sizeof(""))) {
- /* it is a select, so results are returned */
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- } else {
- /* it is not a select, so just return success */
- zval_ptr_dtor(&returned_zval);
- MAKE_STD_ZVAL(returned_zval);
- ZVAL_BOOL(returned_zval, 1);
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- }
- if (statementtype_zval) zval_ptr_dtor(&statementtype_zval);
- if (execute_zval) zval_ptr_dtor(&execute_zval);
-
- return 1;
-}
-
-int dbx_oci8_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-count as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCINumCols", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_LONG) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_oci8_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-name as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_column_index;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- /* dbx uses 0-based column-indices, oci8 uses 1-based indices... */
- ZVAL_LONG(zval_column_index, column_index+1);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIColumnName", &returned_zval, number_of_arguments, arguments);
- /* OCIColumnName returns a string */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_oci8_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-type as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_column_index;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- /* dbx uses 0-based column-indices, oci8 uses 1-based indices... */
- ZVAL_LONG(zval_column_index, column_index+1);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIColumnType", &returned_zval, number_of_arguments, arguments);
- /* OCIColumnType returns a string??? */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_oci8_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
- int number_of_arguments=3;
- zval **arguments[3];
- zval *zval_resulttype=NULL;
- zval *zval_returned_array=NULL;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_returned_array); /* no value needed, it will be overwritten anyway */
- ZVAL_EMPTY_STRING(zval_returned_array); /* there seems to be some weird mem-bug, so assigning a value anyway */
- MAKE_STD_ZVAL(zval_resulttype);
- ZVAL_LONG(zval_resulttype, OCI_NUM | OCI_RETURN_NULLS | OCI_RETURN_LOBS); /* no ASSOC, dbx handles that part */
- arguments[0]=result_handle;
- arguments[1]=&zval_returned_array;
- arguments[2]=&zval_resulttype;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIFetchInto", &returned_zval, number_of_arguments, arguments);
- /* OCIFetchInto returns the number of columns as an integer on success and FALSE */
- /* on failure. The actual array is passed back in arg[1] */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_LONG || Z_LVAL_P(returned_zval)==0) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_resulttype);
- FREE_ZVAL(zval_returned_array);
- return 0;
- }
- FREE_ZVAL(zval_resulttype);
- zval_ptr_dtor(&returned_zval);
- MOVE_RETURNED_TO_RV(rv, zval_returned_array);
- return 1;
-}
-
-int dbx_oci8_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns string */
- /* OCIError needs a statement handle most of the times, and I can only provide */
- /* a db-handle which is only needed some of the time. For now, I have disabled */
- /* the dbx_error for the oci8 extension */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
- zval *returned_message_zval=NULL;
- arguments[0]=dbx_handle;
- if (!dbx_handle) number_of_arguments=0;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIError", &returned_zval, number_of_arguments, arguments);
- /* OCIError should returns an assoc array containing code & message, dbx needs the message */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_ARRAY) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- /* get the messagestring here */
- if (zend_hash_find(Z_ARRVAL_P(returned_zval), "message", strlen("message")+1, (void **) &returned_message_zval)==FAILURE) {
- /* oops! no msg? */
- zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_message_zval);
- zval_ptr_dtor(&returned_zval);
- return 1;
-}
-
-int dbx_oci8_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns escaped string */
- /* replace ' with '' */
- char * str;
- int len;
- char * tmpstr;
- int tmplen;
-
- if (Z_STRLEN_PP(string) == 0) {
- ZVAL_EMPTY_STRING(*rv);
- return 1;
- }
- tmpstr = estrdup(Z_STRVAL_PP(string));
- tmplen = Z_STRLEN_PP(string);
- /* php_str_to_str uses a smart_str that allocates memory */
- /* this memory must be freed or passed on to rv */
- str = php_str_to_str(tmpstr, tmplen, "'", 1, "''", 2, &len);
- efree(tmpstr);
-
- ZVAL_STRINGL(*rv, str, len, 0);
-
- return 1;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_oci8.h b/ext/dbx/dbx_oci8.h
deleted file mode 100644
index e15730aad0..0000000000
--- a/ext/dbx/dbx_oci8.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_DBX_OCI8_H
-#define ZEND_DBX_OCI8_H
-
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-#include "php.h"
-
-int dbx_oci8_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns connection handle as resource on success or 0 as long on failure */
-int dbx_oci8_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns persistent connection handle as resource on success or 0 as long on failure */
-int dbx_oci8_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long on success or 0 as long on failure */
-int dbx_oci8_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
-int dbx_oci8_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-count as long on success or 0 as long on failure */
-int dbx_oci8_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-name as string on success or 0 as long on failure */
-int dbx_oci8_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-type as string on success or 0 as long on failure */
-int dbx_oci8_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS);
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
-int dbx_oci8_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns string */
-int dbx_oci8_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS);
- /* returns escaped string */
-
-#endif /* ZEND_DBX_OCI8_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_odbc.c b/ext/dbx/dbx_odbc.c
deleted file mode 100644
index 235ee1f123..0000000000
--- a/ext/dbx/dbx_odbc.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "dbx.h"
-#include "dbx_odbc.h"
-
-#define ODBC_ASSOC 1
-#define ODBC_NUM 2
-
-int dbx_odbc_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval **arguments[3];
- zval *returned_zval=NULL;
-
- arguments[0]=db;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_connect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_odbc_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval **arguments[3];
- zval *returned_zval=NULL;
-
- arguments[0]=db;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_pconnect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_odbc_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns 1 as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- int actual_resource_type;
- void *resource;
- resource = zend_list_find(Z_LVAL_PP(dbx_handle), &actual_resource_type);
- if (!resource) {
- return 0;
- }
-
- arguments[0]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_close", &returned_zval, number_of_arguments, arguments);
-
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_NULL) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- convert_to_long_ex(&returned_zval);
- Z_LVAL_P(returned_zval)=1;
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_odbc_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *queryresult_zval=NULL;
- zval *num_fields_zval=NULL;
-
- /* db_name is not used in this function */
- arguments[0]=dbx_handle;
- arguments[1]=sql_statement;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_exec", &queryresult_zval, number_of_arguments, arguments);
- /* odbc_query returns a bool for failure, or a result_identifier for success */
- if (!queryresult_zval || Z_TYPE_P(queryresult_zval)!=IS_RESOURCE) {
- if (queryresult_zval) zval_ptr_dtor(&queryresult_zval);
- return 0;
- }
- MAKE_STD_ZVAL(num_fields_zval);
- ZVAL_LONG(num_fields_zval, 0);
- if (!dbx_odbc_getcolumncount(&num_fields_zval, &queryresult_zval, INTERNAL_FUNCTION_PARAM_PASSTHRU)) {
- FREE_ZVAL(num_fields_zval);
- if (queryresult_zval) zval_ptr_dtor(&queryresult_zval);
- return 0;
- }
- if (Z_LVAL_P(num_fields_zval)==0) {
- Z_TYPE_PP(rv)=IS_BOOL;
- Z_LVAL_PP(rv)=1; /* success, but no data */
- FREE_ZVAL(num_fields_zval);
- if (queryresult_zval) zval_ptr_dtor(&queryresult_zval);
- return 1;
- }
- FREE_ZVAL(num_fields_zval);
- MOVE_RETURNED_TO_RV(rv, queryresult_zval);
- return 1;
-}
-
-int dbx_odbc_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-count as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_num_fields", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_LONG || Z_LVAL_P(returned_zval)<0) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_odbc_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-name as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_column_index;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index+1);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_field_name", &returned_zval, number_of_arguments, arguments);
- /* odbc_field_name returns a string */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_odbc_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-type as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_column_index;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index+1);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_field_type", &returned_zval, number_of_arguments, arguments);
- /* odbc_field_name returns a string */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_odbc_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
- int number_of_arguments;
- zval **arguments[2];
- zval *num_fields_zval=NULL;
- zval *fetch_row_result_zval=NULL;
- zval *field_result_zval=NULL;
- zval *field_index_zval;
- zval *returned_zval=NULL;
- long field_index;
- long field_count=-1;
-
- /* get # fields */
- MAKE_STD_ZVAL(num_fields_zval);
- ZVAL_LONG(num_fields_zval, 0);
- if (!dbx_odbc_getcolumncount(&num_fields_zval, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU)) {
- return 0;
- }
- field_count=Z_LVAL_P(num_fields_zval);
- FREE_ZVAL(num_fields_zval);
- /* fetch row */
- number_of_arguments=1;
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_fetch_row", &fetch_row_result_zval, number_of_arguments, arguments);
- if (!fetch_row_result_zval || Z_TYPE_P(fetch_row_result_zval)!=IS_BOOL) {
- if (fetch_row_result_zval) zval_ptr_dtor(&fetch_row_result_zval);
- return 0;
- }
- if (Z_LVAL_P(fetch_row_result_zval)==0) {
- Z_TYPE_PP(rv)=IS_LONG;
- Z_LVAL_PP(rv)=0; /* ok, no more rows */
- zval_ptr_dtor(&fetch_row_result_zval);
- return 0;
- }
- zval_ptr_dtor(&fetch_row_result_zval);
- /* fill array with field results... */
- MAKE_STD_ZVAL(returned_zval);
- array_init(returned_zval);
- MAKE_STD_ZVAL(field_index_zval);
- ZVAL_LONG(field_index_zval, 0);
- number_of_arguments=2;
- for (field_index=0; field_index<field_count; ++field_index) {
- ZVAL_LONG(field_index_zval, field_index+1);
- arguments[0]=result_handle;
- arguments[1]=&field_index_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_result", &field_result_zval, number_of_arguments, arguments);
- zend_hash_index_update(Z_ARRVAL_P(returned_zval), field_index, (void *)&(field_result_zval), sizeof(zval *), NULL);
- }
- FREE_ZVAL(field_index_zval);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_odbc_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns string */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- if (!dbx_handle) number_of_arguments=0;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_errormsg", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_odbc_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns escaped string */
- /* replace ' with '' */
- char * str;
- int len;
- char * tmpstr;
- int tmplen;
-
- if (Z_STRLEN_PP(string) == 0) {
- ZVAL_EMPTY_STRING(*rv);
- return 1;
- }
- tmpstr = estrdup(Z_STRVAL_PP(string));
- tmplen = Z_STRLEN_PP(string);
- /* php_str_to_str uses a smart_str that allocates memory */
- /* this memory must be freed or passed on to rv */
- str = php_str_to_str(tmpstr, tmplen, "'", 1, "''", 2, &len);
- efree(tmpstr);
-
- ZVAL_STRINGL(*rv, str, len, 0);
-
- return 1;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_odbc.h b/ext/dbx/dbx_odbc.h
deleted file mode 100644
index ab2de92495..0000000000
--- a/ext/dbx/dbx_odbc.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_DBX_ODBC_H
-#define ZEND_DBX_ODBC_H
-
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-#include "php.h"
-
-int dbx_odbc_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns connection handle as resource on success or 0 as long on failure */
-int dbx_odbc_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns persisten connection handle as resource on success or 0 as long on failure */
-int dbx_odbc_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long on success or 0 as long on failure */
-int dbx_odbc_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
-int dbx_odbc_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-count as long on success or 0 as long on failure */
-int dbx_odbc_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-name as string on success or 0 as long on failure */
-int dbx_odbc_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-type as string on success or 0 as long on failure */
-int dbx_odbc_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS);
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
-int dbx_odbc_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns string */
-int dbx_odbc_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS);
- /* returns escaped string */
-
-#endif /* ZEND_DBX_ODBC_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_pgsql.c b/ext/dbx/dbx_pgsql.c
deleted file mode 100644
index 61eb82a2f9..0000000000
--- a/ext/dbx/dbx_pgsql.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Rui Hirokawa <hirokawa@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "dbx.h"
-#include "php_dbx.h"
-#include "dbx_pgsql.h"
-#include <string.h>
-
-#define PGSQL_ASSOC 1<<0
-#define PGSQL_NUM 1<<1
-
-int dbx_pgsql_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns connection handle as resource on success or 0 as long on failure */
- int nargs=5;
- char *port="5432", *connstring=NULL;
- zval **args[5], *rarg = NULL;
- zval *conn_zval = NULL;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(conn_zval);
- ZVAL_LONG(conn_zval, 0);
-
- if (Z_STRLEN_PP(username)>0) {
- int len;
-
- len = Z_STRLEN_PP(host)+Z_STRLEN_PP(db)+strlen(port);
- len += Z_STRLEN_PP(username)+Z_STRLEN_PP(password)+45;
- connstring = (char *)emalloc(len+1);
- sprintf(connstring, "host='%s' port='%s' dbname='%s' user='%s' password='%s'",
- Z_STRVAL_PP(host), port, Z_STRVAL_PP(db),
- Z_STRVAL_PP(username), Z_STRVAL_PP(password));
- ZVAL_STRING(conn_zval, connstring, 0);
- args[0] = &conn_zval;
- nargs = 1;
- } else {
- int k;
-
- args[0] = host;
- for (k=1;k<4;k++){
- MAKE_STD_ZVAL(rarg);
- ZVAL_EMPTY_STRING(rarg);
- args[k] = &rarg;
- }
- args[4] = db;
- }
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_connect", &returned_zval, nargs, args);
- zval_dtor(conn_zval);
- FREE_ZVAL(conn_zval);
-
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_pgsql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns persistent connection handle as resource on success or 0 as long on failure */
- int nargs=5;
- char *port="5432", *connstring=NULL;
- zval **args[5], *rarg = NULL;
- zval *conn_zval = NULL;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(conn_zval);
- ZVAL_LONG(conn_zval, 0);
-
- if (Z_STRLEN_PP(username)>0) {
- int len;
-
- len = Z_STRLEN_PP(host)+Z_STRLEN_PP(db)+strlen(port);
- len += Z_STRLEN_PP(username)+Z_STRLEN_PP(password)+45;
- connstring = (char *)emalloc(len+1);
- sprintf(connstring, "host='%s' port='%s' dbname='%s' user='%s' password='%s'",
- Z_STRVAL_PP(host), port, Z_STRVAL_PP(db),
- Z_STRVAL_PP(username), Z_STRVAL_PP(password));
- ZVAL_STRING(conn_zval, connstring, 0);
- args[0] = &conn_zval;
- nargs = 1;
- } else {
- int k;
-
- args[0] = host;
- for (k=1;k<4;k++){
- MAKE_STD_ZVAL(rarg);
- ZVAL_EMPTY_STRING(rarg);
- args[k] = &rarg;
- }
- args[4] = db;
- }
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_pconnect", &returned_zval, nargs, args);
- zval_dtor(conn_zval);
- FREE_ZVAL(conn_zval);
-
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_pgsql_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns 1 as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_close", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_BOOL) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_pgsql_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns 1 as long or a result identifier as resource on success
- or 0 as long on failure */
- int nargs=2;
- zval **args[2];
- zval *returned_zval=NULL;
-
- /* db_name is not used in this function */
- args[0]=dbx_handle;
- args[1]=sql_statement;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_exec", &returned_zval, nargs, args);
- /* pg_query returns a bool for success or failure,
- or a result_identifier for select statements */
- if (!returned_zval || (Z_TYPE_P(returned_zval)!=IS_BOOL && Z_TYPE_P(returned_zval)!=IS_RESOURCE)) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_pgsql_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-count as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_numfields", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_LONG) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_pgsql_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-name as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_column_index;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_fieldname", &returned_zval, number_of_arguments, arguments);
- /* pg_fieldname returns a string */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_pgsql_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-type as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_column_index;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_fieldtype", &returned_zval, number_of_arguments, arguments);
- /* pg_fieldtype returns a string */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_pgsql_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=result_handle;
-
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_fetch_array", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_ARRAY) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_pgsql_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns string */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- if (!dbx_handle) number_of_arguments=0;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_errormessage", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_pgsql_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns escaped string */
- /* replace \ with \\ */
- /* ' with '' */
- char * str;
- int len;
- char * tmpstr;
- int tmplen;
-
- if (Z_STRLEN_PP(string) == 0) {
- ZVAL_EMPTY_STRING(*rv);
- return 1;
- }
- tmpstr = estrdup(Z_STRVAL_PP(string));
- tmplen = Z_STRLEN_PP(string);
- /* php_str_to_str uses a smart_str that allocates memory */
- /* this memory must be freed or passed on to rv */
- str = php_str_to_str(tmpstr, tmplen, "\\", 1, "\\\\", 2, &len);
- efree(tmpstr);
- tmpstr=str; tmplen=len;
- str = php_str_to_str(tmpstr, tmplen, "'", 1, "''", 2, &len);
- efree(tmpstr);
-
- ZVAL_STRINGL(*rv, str, len, 0);
- return 1;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_pgsql.h b/ext/dbx/dbx_pgsql.h
deleted file mode 100644
index b406874c47..0000000000
--- a/ext/dbx/dbx_pgsql.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Rui Hirokawa <hirokawa@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef ZEND_DBX_PGSQL_H
-#define ZEND_DBX_PGSQL_H
-
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-#include "php.h"
-
-int dbx_pgsql_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns connection handle as resource on success or 0 as long on failure */
-int dbx_pgsql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns persistent connection handle as resource on success or 0 as long on failure */
-int dbx_pgsql_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long on success or 0 as long on failure */
-int dbx_pgsql_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
-int dbx_pgsql_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-count as long on success or 0 as long on failure */
-int dbx_pgsql_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-name as string on success or 0 as long on failure */
-int dbx_pgsql_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-type as string on success or 0 as long on failure */
-int dbx_pgsql_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS);
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
-int dbx_pgsql_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns string */
-int dbx_pgsql_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS);
- /* returns escaped string */
-
-#endif /* ZEND_DBX_PGSQL_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_sybasect.c b/ext/dbx/dbx_sybasect.c
deleted file mode 100644
index 98113eb84c..0000000000
--- a/ext/dbx/dbx_sybasect.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "dbx.h"
-#include "dbx_sybasect.h"
-
-#define MYSQL_ASSOC 1<<0
-#define MYSQL_NUM 1<<1
-
-int dbx_sybasect_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval **arguments[3];
- zval *returned_zval=NULL;
- zval *select_db_zval=NULL;
-
- arguments[0]=host;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "sybase_connect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
-
- number_of_arguments=2;
- arguments[0]=db;
- arguments[1]=&returned_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "sybase_select_db", &select_db_zval, number_of_arguments, arguments);
- if (!select_db_zval || (Z_TYPE_P(select_db_zval)==IS_BOOL && Z_LVAL_P(select_db_zval)==0) ) {
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- /* also close connection */
- number_of_arguments=1;
- arguments[0]=&returned_zval;
- zend_list_addref(Z_LVAL_P(returned_zval));
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "sybase_close", &select_db_zval, number_of_arguments, arguments);
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- zval_ptr_dtor(&returned_zval);
- return 0;
- }
- zval_ptr_dtor(&select_db_zval);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_sybasect_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns persistent connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval **arguments[3];
- zval *returned_zval=NULL;
- zval *select_db_zval=NULL;
-
- arguments[0]=host;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "sybase_pconnect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
-
- number_of_arguments=2;
- arguments[0]=db;
- arguments[1]=&returned_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "sybase_select_db", &select_db_zval, number_of_arguments, arguments);
- if (!select_db_zval || (Z_TYPE_P(select_db_zval)==IS_BOOL && Z_LVAL_P(select_db_zval)==0) ) {
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- /* also close connection */
- number_of_arguments=1;
- arguments[0]=&returned_zval;
- zend_list_addref(Z_LVAL_P(returned_zval));
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "sybase_close", &select_db_zval, number_of_arguments, arguments);
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- zval_ptr_dtor(&returned_zval);
- return 0;
- }
- zval_ptr_dtor(&select_db_zval);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_sybasect_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns 1 as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "sybase_close", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_BOOL) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_sybasect_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *returned_zval=NULL;
- zval *select_db_zval=NULL;
-
- number_of_arguments=2;
- arguments[0]=db_name;
- arguments[1]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "sybase_select_db", &select_db_zval, number_of_arguments, arguments);
- zval_ptr_dtor(&select_db_zval);
-
- number_of_arguments=2;
- arguments[0]=sql_statement;
- arguments[1]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "sybase_query", &returned_zval, number_of_arguments, arguments);
- /* sybase_query returns a bool for success or failure, or a result_identifier for select statements */
- if (!returned_zval || (Z_TYPE_P(returned_zval)!=IS_BOOL && Z_TYPE_P(returned_zval)!=IS_RESOURCE)) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_sybasect_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-count as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "sybase_num_fields", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_LONG) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_sybasect_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-name as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_column_index;
- zval *returned_zval=NULL;
- zval **zv_name=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "sybase_fetch_field", &returned_zval, number_of_arguments, arguments);
- /* sybase_fetch_field returns an object */
- /* we need only the 'name' member here */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_OBJECT) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- if (zend_hash_find(Z_OBJPROP_P(returned_zval), "name", 5, (void **) &zv_name)==FAILURE) {
- zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
-
- **rv = **zv_name;
- zval_copy_ctor(*rv);
- zval_ptr_dtor(&returned_zval);
- zval_ptr_dtor(zv_name);
-
- FREE_ZVAL(zval_column_index);
-/* MOVE_RETURNED_TO_RV(rv, returned_zval); */
- return 1;
-}
-
-int dbx_sybasect_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns column-type as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval **arguments[2];
- zval *zval_column_index;
- zval *returned_zval=NULL;
- zval **zv_type=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "sybase_fetch_field", &returned_zval, number_of_arguments, arguments);
- /* sybase_fetch_field returns an object */
- /* we need only the 'type' member here */
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_OBJECT) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- if (zend_hash_find(Z_OBJPROP_P(returned_zval), "type", 5, (void **) &zv_type)==FAILURE) {
- zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
-
- **rv = **zv_type;
- zval_copy_ctor(*rv);
- zval_ptr_dtor(&returned_zval);
- zval_ptr_dtor(zv_type);
-
- FREE_ZVAL(zval_column_index);
-/* MOVE_RETURNED_TO_RV(rv, returned_zval); */
- return 1;
-}
-
-int dbx_sybasect_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "sybase_fetch_row", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_ARRAY) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_sybasect_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns string */
- int number_of_arguments=1;
- zval **arguments[1];
- zval *returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- if (!dbx_handle) number_of_arguments=0;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "sybase_get_last_message", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_sybasect_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS)
-{
- /* returns escaped string */
- /* replace ' with '' */
- char * str;
- int len;
- char * tmpstr;
- int tmplen;
-
- if (Z_STRLEN_PP(string) == 0) {
- ZVAL_EMPTY_STRING(*rv);
- return 1;
- }
- tmpstr = estrdup(Z_STRVAL_PP(string));
- tmplen = Z_STRLEN_PP(string);
- /* php_str_to_str uses a smart_str that allocates memory */
- /* this memory must be freed or passed on to rv */
- str = php_str_to_str(tmpstr, tmplen, "'", 1, "''", 2, &len);
- efree(tmpstr);
-
- ZVAL_STRINGL(*rv, str, len, 0);
-
- return 1;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_sybasect.h b/ext/dbx/dbx_sybasect.h
deleted file mode 100644
index 948090fc3f..0000000000
--- a/ext/dbx/dbx_sybasect.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_DBX_SYBASECT_H
-#define ZEND_DBX_SYBASECT_H
-
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-#include "php.h"
-
-int dbx_sybasect_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns connection handle as resource on success or 0 as long on failure */
-int dbx_sybasect_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns persistent connection handle as resource on success or 0 as long on failure */
-int dbx_sybasect_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long on success or 0 as long on failure */
-int dbx_sybasect_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
-int dbx_sybasect_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-count as long on success or 0 as long on failure */
-int dbx_sybasect_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-name as string on success or 0 as long on failure */
-int dbx_sybasect_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-type as string on success or 0 as long on failure */
-int dbx_sybasect_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS);
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
-int dbx_sybasect_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns string */
-int dbx_sybasect_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_PARAMETERS);
- /* returns escaped string */
-
-#endif /* ZEND_DBX_SYBASECT_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/howto_extend_dbx.html b/ext/dbx/howto_extend_dbx.html
deleted file mode 100644
index 12f9570602..0000000000
--- a/ext/dbx/howto_extend_dbx.html
+++ /dev/null
@@ -1,316 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
-<html>
-<head>
-<title>HOWTO extend dbx</title>
-
-</head>
-
-<body marginwidth="0" marginheight="0">
-<style type="text/css">
-<!--
-
-body, p, td, input, select, a, h1, h2, h3, h4, h5, h6, marquee, blink
- { font-family: Verdana,sans-serif; font-size: 10pt; color: #000000; }
-h1 { font-size: 16pt; font-weight: bold; }
-h2 { font-size: 14pt; font-weight: bold; }
-h3 { font-size: 12pt; font-weight: bold; }
-h4 { font-size: 10pt; font-weight: bold; }
-h5 { font-size: 8pt;}
-h6 { font-size: 6pt;}
-
-body { background-color: #F0F0F0; }
-a { color: #000088; }
-
-.title { font-size: 14pt; font-weight: bold; }
-.fn-title { font-size: 12pt; font-weight: bold; }
-.fn-phpversion { font-size: 10pt; font-weight: normal; }
-.fn-def { margin-top: 8px; margin-bottom: 8px; background-color: #99BBDD; }
-.fn-defname { font-weight: bold; }
-.fn-name { font-size: 12pt; font-weight: bold; }
-.fn-param { font-weight: bold; }
-.example { margin-top: 12px; font-weight: bold; }
-.text { margin: 8px; }
-.code { margin: 16px; font-family: Courier; background-color: #CCCCCC; }
-.bold { font-weight: bold; }
-
-.indent { margin-left: 16px; }
-.newpage { border-top: 2px solid #000088; margin-bottom: 8px; }
-.tab { margin-left: 16px; }
-
-
--->
-</style>
-
-
-
-
-
-<a name="top"></a>
-<div class="title">
-How-to code support for another database<br>
-</div>
-<div class="text">
-Every supported database module must be loaded by PHP before it can be used. Every supported database module must be added to the dbx-module before it can be used. Currently there is support for MySQL, PostgreSQL, Microsoft SQL Server, Frontbase, Sybase-CT, Oracle (oci8) and ODBC. It is not difficult to add support for more databases.<br>
-<br>
-The dbx module is found in de PHP ext/dbx folder. The support-code is found in the same folder <br>
-<br>
-To add support for module 'blabla' the following steps must be taken: <br>
-1. the dbx.c source file must be extended to recognize module 'blabla' and switch to the 'blabla' functions.<br>
-2. the files dbx_blabla.h and dbx_blabla.c must be created and edited to produce the required response.<br>
-3. add the files from step 2 to the project.<br>
-4. compile.<br>
-5. enjoy.<br>
-<br>
-You may need a bit of help for step 1 and 2. If you need help for step 3 or 4, you shouldn't try to attempt this probably :-). If you need help with step 5 you're in big trouble ;o)<br>
-Help for step 1 and 2 is given below, bold text in code indicate the important bits.<br>
-</div>
-<p>
-<a href="index.html">home</a><br>
-<div class="newpage"></div>
-
-<div class="fn-title"><a name="step1"></a>
-1. the dbx.c source file must be extended<br>
-</div>
-<div class="text">
-Define a module identifier and assign it a unique number. Include your header file here as well.<br>
-<pre class="code">
-// defines for supported databases
-#define DBX_UNKNOWN 0
-#define DBX_MYSQL 1
-#define DBX_ODBC 2
-<span class="bold">#define DBX_BLABLA 3</span>
-// includes for supported databases
-#include "dbx.h"
-#include "dbx_mysql.h"
-#include "dbx_odbc.h"
-<span class="bold">#include "dbx_blabla.h"</span>
-</pre>
-Add code to the module_identifier_exists function so DBX_BLABLA will be recognized:<br>
-<pre class="code">
-int module_identifier_exists(long module_identifier) {
- switch (module_identifier) {
- case DBX_MYSQL: return module_exists("mysql");
- case DBX_ODBC: return module_exists("odbc");
- <span class="bold">case DBX_BLABLA: return module_exists("blabla");</span>
- }
- return 0;
- }
-</pre>
-Add code to the get_module_identifier function so your extension will be recognized:<br>
-<pre class="code">
-int get_module_identifier(char * module_name) {
- if (!strcmp("mysql", module_name)) return DBX_MYSQL;
- if (!strcmp("odbc", module_name)) return DBX_ODBC;
- <span class="bold">if (!strcmp("blabla", module_name)) return DBX_BLABLA;</span>
- return DBX_UNKNOWN;
- }
-</pre>
-Add code for exposing the DBX_BLABLA constant to the world:<br>
-<pre class="code">
-ZEND_MINIT_FUNCTION(dbx)
-{
-/*/ REGISTER_INI_ENTRIES(); /*/
-
- REGISTER_LONG_CONSTANT("DBX_MYSQL", DBX_MYSQL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_ODBC", DBX_ODBC, CONST_CS | CONST_PERSISTENT);
- <span class="bold">REGISTER_LONG_CONSTANT("DBX_BLABLA", DBX_BLABLA CONST_CS | CONST_PERSISTENT);</span>
-
- [...]
-
- return SUCCESS;
- }
-</pre>
-Add code for inclusion in the phpinfo() function (optional, but recommended):<br>
-<pre class="code">
-ZEND_MINFO_FUNCTION(dbx)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "dbx support", "enabled");
- php_info_print_table_row(2, "dbx support for MySQL", "enabled");
- php_info_print_table_row(2, "dbx support for ODBC", "enabled");
- <span class="bold">php_info_print_table_row(2, "dbx support for BlaBla", "enabled");</span>
- php_info_print_table_end();
- DISPLAY_INI_ENTRIES();
-}
-</pre>
-Finally, for the implementation of all switch_dbx_XXXXX functions, copy a 'case'-line for every function that you support (should be all functions!). Here is an example for only the switch_dbx_connect function:<br>
-<pre class="code">
-int switch_dbx_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module) {
- // returns connection handle as resource on success or 0 as long on failure
- switch ((*dbx_module)-&gt;value.lval) {
- case DBX_MYSQL: return dbx_mysql_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- <span class="bold">case DBX_BLABLA: return dbx_blabla_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);</span>
- }
- zend_error(E_WARNING, "dbx_connect: not supported in this module");
- return 0;
- }
-</pre>
-This should be done for all switch_dbx_XXXXX functions. They are listed below:<br>
-<pre class="code">
-int <a href="#connect">switch_dbx_connect(...)</a>;
-int <a href="#pconnect">switch_dbx_pconnect(...)</a>;
-int <a href="#close">switch_dbx_close(...)</a>;
-int <a href="#query">switch_dbx_query(...)</a>;
-int <a href="#getcolumncount">switch_dbx_getcolumncount(...)</a>;
-int <a href="#getcolumnname">switch_dbx_getcolumnname(...)</a>;
-int <a href="#getcolumntype">switch_dbx_getcolumntype(...)</a>;
-int <a href="#getrow">switch_dbx_getrow(...)</a>;
-int <a href="#error">switch_dbx_error(...)</a>;
-</pre>
-This concludes the changes for the dbx.c file. All that is needed now is to actually code the dbx_blabla_connect and other functions, which we will see in the following step.<br>
-</div>
-<p>
-<a href="#top">top</a><br>
-<div class="newpage"></div>
-
-<div class="fn-title"><a name="step1"></a>
-2. the files dbx_blabla.h and dbx_blabla.c<br>
-</div>
-<div class="text">
-The dbx_blabla.h and dbx_blabla.c file are created in the folder /ext/dbx.<br>
-The easiest method is to just copy dbx_mysql.h en dbx_mysql.c, open both files, and do a search and replace ('blabla' for 'mysql' and 'BLABLA' for 'MYSQL'). Yes, case-sensitive.<br>
-For the .h file, that's all. <br>
-For the .c file, the fun has just started :-)<br>
-In the .c is the actual realization of the database abstraction, where a call to a standard function is translated into one or more database-specific calls. For mysql, a dbx_connect translates to a mysql_connect followed by a mysql_select_db. Refer to the dbx_mysql.c and dbx_odbc.c files regularly for examples!<br>
-In dbx.h one macro and one function are defined to make the calling of external module functions and returning of the results easier: dbx_call_any_function and MOVE_RETURNED_TO_RV.<br>
-<p>
- The details of what each of the functions do, what parameters they get, and what parameters they should return are discussed below. But first, the dbx_mysql_connect function is presented and explained, so you get an idea of how things work.<br>
-<pre class="code">
-int dbx_mysql_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS) {
- // returns connection handle as resource on success or 0 as long on
- // failure
- int number_of_arguments;
- zval **arguments[3];
- zval * returned_zval=NULL;
- zval * select_db_zval=NULL;
-
- number_of_arguments=3;
- arguments[0]=host;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, <span class="bold">"mysql_connect"</span>, &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval-&gt;type!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
-
- number_of_arguments=2;
- arguments[0]=db;
- arguments[1]=rv;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, <span class="bold">"mysql_select_db"</span>, &select_db_zval, number_of_arguments, arguments);
- zval_ptr_dtor(&select_db_zval);
-
- return 1;
- }
-</pre>
-First of all, all functions return 0 on failure and 1 on success. These values are used in the dbx-routines, they are never actually given back to the PHP-script writer that calls the dbx_connect function.<br>
-The actual value that is of interest to the caller is returned in the <span class="bold">rv</span> parameter. In this case it is a connection handle (or link identifier, in mysql-speak), that is also returned if the database selection doesn't succeed. <br>
-The parameters that are of interest to the function are located between the <span class="bold">rv</span> and <span class="bold">INTERNAL_FUNCTION_PARAMETERS</span> parameters, in this case it is a <span class="bold">host</span> name, a <span class="bold">db</span> name, a <span class="bold">username</span> and a <span class="bold">password</span>. These are the values that the user specifies if he calls dbx_connect(); These parameters are used in the calls to the mysql-database functions. The user actually also specifies a module-name, that decides which connect-function should be called. Here, he specified 'mysql'.<br>
-To actually call a mysql module function, you can use <span class="bold">dbx_call_any_function</span> where you specify the function name (it is used twice in dbx_mysql_connect, see <span class="bold">'mysql_connect'</span> and <span class="bold">'mysql_select_db'</span>, they are printed bold in the code). The value that is returned from the function will be stored in the next argument, a zval * (e.g. <span class="bold">returned_zval</span>) parameter that you must declare locally. To actually return such a parameter, use the <span class="bold">MOVE_RETURNED_TO_RV(rv, returned_zval)</span> macro, which copies the values to <span class="bold">rv</span> and frees anything that may be left in <span class="bold">returned_zval</span>. Parameters that must be passed to the mysql-function are stored in the <span class="bold">arguments</span> array, which must be large enough to hold all parameters to the function-call that requires the most parameters (in this case, mysql_connect expects 3 parameters, mysql_select_db expects two parameters, so the <span class="bold">arguments</span> array is defined 'zval **arguments[<span class="bold">3</span>]'). The <span class="bold">number_of_arguments</span> parameter is set to the actual number of arguments that the function-call requires. As you can see it is initialized to 3, for the first call to mysql_connect. Then it is set to 2, for the call to mysql_select_db. If you call a function that retrieves a value, and you don't return it with MOVE_RETURNED_TO_RV, then you must free the value using <span class="bold">zval_ptr_dtor</span>, as can be seen right after the call to mysql_select_db. This can also be seen directly after the call to mysql_connect, if somehow this function failed or didn't return a resource (on a successful connect mysql_connect returns a resource) the returned value is freed as well (and 0 is returned because the connection failed).<br>
-<p>
-OK, now the description of all functions that you should implement, and what is expected of them...<br>
-<a name="connect"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_connect</span>(zval **rv, zval **<span class="fn-param">host</span>, zval **<span class="fn-param">db</span>, zval **<span class="fn-param">username</span>, zval **<span class="fn-param">password</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on connect-failure and 1 on success
-// rv: connection handle as resource on success or nothing on failure
-</pre>
-dbx_blabla_connect creates a connection to a database on a specified host, using username and password for authentication. This may be done by connecting to a server and selecting a database (as mysql does), or connecting to a specific database directly (as in ODBC). <br>
-What must be returned (in <span class="bold">rv</span>) is the link identifier that is returned from the blabla_connect function, in it's native form so the end-user can use $db-&gt;handle to call other blabla_* functions that expect this parameter.<br>
-What must be returned from the function is a 1 on success and a 0 on failure. Remember that a failed database selection can still return a 1 because the connection succeeded!<br>
-The host (string) is the name of the machine the server is run on, but it may be empty if a database name is enough to establish a connection.<br>
-The db (string) is the name of the database to select, or, for e.g. ODBC, the identifier that is needed to actually select the database.<br>
-The username (string) and password (string) are used for authentication.<br>
-<a name="pconnect"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_pconnect</span>(zval **rv, zval **<span class="fn-param">host</span>, zval **<span class="fn-param">db</span>, zval **<span class="fn-param">username</span>, zval **<span class="fn-param">password</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on pconnect-failure and 1 on success
-// rv: persistent connection handle as resource on success or nothing
-// on failure
-</pre>
-dbx_blabla_pconnect is identical to dbx_blabla_connect except that it will create a persistent connection.<br>
-<a name="close"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_close</span>(zval **rv, zval **<span class="fn-param">dbx_handle</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on close-failure and 1 on success
-// rv: 1 as bool on success or nothing on failure
-</pre>
-dbx_blabla_close closes an open connection, whether it was created persistently or not.<br>
-What must be returned (in <span class="bold">rv</span>) is a boolean true that indicates when the connection was closed successfully. If it wasn't, no value is returned in <span class="bold">rv</span>.<br>
-What must be returned from the function is a 1 on success and a 0 on failure. Note that an unsuccessful close is still a succeeded function call.<br>
-The dbx_handle is the same value that you returned from dbx_blabla_connect or dbx_blabla_pconnect.<br>
-<a name="query"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_query</span>(zval **rv, zval **<span class="fn-param">dbx_handle</span>, zval **<span class="fn-param">sql_statement</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on query-failure and 1 on success
-// rv: 1 as bool or a result identifier as resource on success
-// or nothing on failure
-</pre>
-dbx_blabla_query executes an SQL statement over the connection.<br>
-What must be returned (in <span class="bold">rv</span>) is a nothing on failure, on success it must return either a boolean 1 for queries that don't return data (like INSERT INTO) or a native result-handle for queries that do return data (SELECT). The native result handle ($q-&gt;handle) can be used by the end-user to call other blabla_* functions that expect this parameter.<br>
-What must be returned from the function is a 1 on success and a 0 on failure. Note that a failed query execution can still return a 1 because the query function succeeded!<br>
-The dbx_handle is the same value that you returned from dbx_blabla_connect or dbx_blabla_pconnect.<br>
-The sql_statement (string) can have any value.<br>
-<a name="getcolumncount"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_getcolumncount</span>(zval **rv, zval **<span class="fn-param">result_handle</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on query-failure and 1 on success
-// returns column-count as long on success or nothing on failure
-</pre>
-dbx_blabla_getcolumncount gets the number of fields that the query-result contains.<br>
-What must be returned (in <span class="bold">rv</span>) is the number of fields as long from the query result specified by the result_handle.<br>
-What must be returned from the function is a 1 on success and a 0 on failure. <br>
-The result_handle is the same value that you returned from dbx_query.<br>
-<a name="getcolumnname"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_getcolumnname</span>(zval **rv, zval **<span class="fn-param">result_handle</span>, long <span class="fn-param">column_index</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on failure and 1 on success
-// returns column-name as string on success or nothing on failure
-</pre>
-dbx_blabla_getcolumnname gets the fieldname of the specified column.<br>
-What must be returned (in <span class="bold">rv</span>) is the fieldname as string of the given column.<br>
-What must be returned from the function is a 1 on success and a 0 on failure. <br>
-The result_handle is the same value that you returned from dbx_query.<br>
-The column_index is a long that ranges from 0 to the value you returned from dbx_blabla_getcolumncount minus 1 [0..columncount-1].<br>
-<a name="getcolumntype"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_getcolumntype</span>(zval **rv, zval **<span class="fn-param">result_handle</span>, long <span class="fn-param">column_index</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on failure and 1 on success
-// returns column-type as string on success or nothing on failure
-</pre>
-dbx_blabla_getcolumnname gets the field type of the specified column.<br>
-What must be returned (in <span class="bold">rv</span>) is the field type as string of the given column.<br>
-What must be returned from the function is a 1 on success and a 0 on failure. <br>
-The result_handle is the same value that you returned from dbx_query.<br>
-The column_index is a long that ranges from 0 to the value you returned from dbx_blabla_getcolumncount minus 1 [0..columncount-1].<br>
-<a name="getrow"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_getrow</span>(zval **rv, zval **<span class="fn-param">result_handle</span>, long <span class="fn-param">row_number</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on failure and 1 on success
-// returns array[0..columncount-1] as strings on success or 0 as long
-// on failure
-</pre>
-dbx_blabla_getrow gets the next row from the query-results.<br>
-In some cases (PostgreSQL) the rownumber is needed to actually fetch the row. This will be provided (it will be indexed starting at 0) by the dbx_query function. In other cases it is not needed and thus not used.<br>
-What must be returned (in <span class="bold">rv</span>) is an indexed array[0..columncount-1] of strings, containing the data from the row (for mysql this is easy since it already performs this way, for ODBC the array has to be constructed inside this function from a loop that fetches the data for each column).<br>
-What must be returned from the function is a 1 on success and a 0 on failure (function failed or there are no more rows available). <br>
-The result_handle is the same value that you returned from dbx_query.<br>
-<a name="error"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_error</span>(zval **rv, zval **<span class="fn-param">dbx_handle</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on failure and 1 on success
-// returns error message as string
-</pre>
-dbx_blabla_error gets the error message from the last database call.<br>
-What must be returned (in <span class="bold">rv</span>) is the error message as a string.<br>
-What must be returned from the function is a 1 on success and a 0 on failure. <br>
-The dbx_handle is the same value that you returned from dbx_blabla_connect or dbx_blabla_pconnect.<br>
-</div>
-<p>
-<a href="#top">top</a><br>
-<div class="newpage"></div>
-<p>
-<div class="text">
-For specifics or the finer details you can always refer to dbx_mysql.c and dbx_odbc.c to see everything in action. <br>
-More Zend API documentation can be found at <a href="http://www.zend.com/apidoc">http://www.zend.com/apidoc</a>.<br>
-This document can be found at <a href="http://www.guidance.nl/php/dbx">http://www.guidance.nl/php/dbx</a>.<br>
-</div>
-<p>
-<a href="#top">top</a><br>
-<div class="newpage"></div>
-
-</body>
-</html>
diff --git a/ext/dbx/php_dbx.h b/ext/dbx/php_dbx.h
deleted file mode 100644
index 4ca47c999a..0000000000
--- a/ext/dbx/php_dbx.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_PHP_DBX_H
-#define ZEND_PHP_DBX_H
-
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-extern zend_module_entry dbx_module_entry;
-#define phpext_dbx_ptr &dbx_module_entry
-
-#ifdef ZEND_WIN32
-#define ZEND_DBX_API __declspec(dllexport)
-#else
-#define ZEND_DBX_API
-#endif
-
-ZEND_MINIT_FUNCTION(dbx);
-ZEND_MSHUTDOWN_FUNCTION(dbx);
-/* ZEND_RINIT_FUNCTION(dbx); */
-/* ZEND_RSHUTDOWN_FUNCTION(dbx); */
-
-ZEND_MINFO_FUNCTION(dbx);
-
-ZEND_FUNCTION(dbx_connect);
-ZEND_FUNCTION(dbx_close);
-ZEND_FUNCTION(dbx_query);
-ZEND_FUNCTION(dbx_error);
-ZEND_FUNCTION(dbx_escape_string);
-
-ZEND_FUNCTION(dbx_sort);
-ZEND_FUNCTION(dbx_compare);
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-*/
-
-/*
-ZEND_BEGIN_MODULE_GLOBALS(dbx)
-ZEND_END_MODULE_GLOBALS(dbx)
-*/
-
-/* In every function that needs to use variables in php_dbx_globals,
- do call dbxLS_FETCH(); after declaring other variables used by
- that function, and always refer to them as dbxG(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define DBXG(v) TSRMG(dbx_globals_id, zend_dbx_globals *, v)
-#else
-#define DBXG(v) (dbx_globals.v)
-#endif
-
-#endif /* ZEND_PHP_DBX_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/tests/001.phpt b/ext/dbx/tests/001.phpt
deleted file mode 100644
index e8f30f7c1a..0000000000
--- a/ext/dbx/tests/001.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Check for dbx presence
---SKIPIF--
-<?php if (!extension_loaded("dbx")) print("skip"); ?>
---FILE--
-<?php
-print("dbx extension is available");
-?>
---EXPECT--
-dbx extension is available \ No newline at end of file
diff --git a/ext/dbx/tests/002.phpt b/ext/dbx/tests/002.phpt
deleted file mode 100644
index cf51901cb9..0000000000
--- a/ext/dbx/tests/002.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-DBX_CONSTANTS
---SKIPIF--
-<?php if (!extension_loaded("dbx")) print("skip"); ?>
---FILE--
-<?php
-if (DBX_MYSQL=="DBX_MYSQL") print('!DBX_MYSQL');
-if (DBX_ODBC=="DBX_ODBC") print('!DBX_ODBC');
-if (DBX_PGSQL=="DBX_PGSQL") print('!DBX_PGSQL');
-if (DBX_MSSQL=="DBX_MSSQL") print('!DBX_MSSQL');
-if (DBX_FBSQL=="DBX_FBSQL") print('!DBX_FBSQL');
-if (DBX_OCI8=="DBX_OCI8") print('!DBX_OCI8');
-if (DBX_SYBASECT=="DBX_SYBASECT") print('!DBX_SYBASECT');
-if (DBX_PERSISTENT=="DBX_PERSISTENT") print('!DBX_PERSISTENT');
-if (DBX_RESULT_INFO=="DBX_RESULT_INFO") print('!DBX_RESULT_INFO');
-if (DBX_RESULT_INDEX=="DBX_RESULT_INDEX") print('!DBX_RESULT_INDEX');
-if (DBX_RESULT_ASSOC=="DBX_RESULT_ASSOC") print('!DBX_RESULT_ASSOC');
-if (DBX_COLNAMES_UNCHANGED=="DBX_COLNAMES_UNCHANGED") print('!DBX_COLNAMES_UNCHANGED');
-if (DBX_COLNAMES_UPPERCASE=="DBX_COLNAMES_UPPERCASE") print('!DBX_COLNAMES_UPPERCASE');
-if (DBX_COLNAMES_LOWERCASE=="DBX_COLNAMES_LOWERCASE") print('!DBX_COLNAMES_LOWERCASE');
-if (DBX_CMP_NATIVE=="DBX_CMP_NATIVE") print('!DBX_CMP_NATIVE');
-if (DBX_CMP_TEXT=="DBX_CMP_TEXT") print('!DBX_CMP_TEXT');
-if (DBX_CMP_NUMBER=="DBX_CMP_NUMBER") print('!DBX_CMP_NUMBER');
-if (DBX_CMP_ASC=="DBX_CMP_ASC") print('!DBX_CMP_ASC');
-if (DBX_CMP_DESC=="DBX_CMP_DESC") print('!DBX_CMP_DESC');
-print('ok');
-?>
---EXPECT--
-ok \ No newline at end of file
diff --git a/ext/dbx/tests/003.phpt b/ext/dbx/tests/003.phpt
deleted file mode 100644
index 76fda4caf2..0000000000
--- a/ext/dbx/tests/003.phpt
+++ /dev/null
@@ -1,107 +0,0 @@
---TEST--
-dbx_connect
---SKIPIF--
-<?php
-include_once("skipif.inc");
-?>
---FILE--
-<?php
-include_once("dbx_test.p");
-$nonexisting_database="nonexisting_database";
-$nonexisting_username="nonexisting_username";
-$nonexisting_password="nonexisting_password";
-$dlo = dbx_connect($module_name, $host, $database, $username, $password);
-if ($dlo!=0) {
- print('connect using string ok'."\n");
- dbx_close($dlo);
- }
-$dlo = dbx_connect($module, $host, $database, $username, $password);
-if ($dlo!=0) {
- print('connect using constant ok'."\n");
- dbx_close($dlo);
- }
-$dlo = @dbx_connect($module, $host, $nonexisting_database, $username, $password);
-if ($dlo==0) {
- print('connect to non-existing database failed, so it\'s ok'."\n");
- }
-else {
- print_r($dlo);
- dbx_close($dlo);
- }
-$dlo = @dbx_connect($module, $host, $database, $nonexisting_username, $nonexisting_password);
-if ($dlo==0) {
- print('connect with false username/password combi failed, so it\'s ok'."\n");
- }
-else {
- print_r($dlo);
- dbx_close($dlo);
- }
-$dlo = dbx_connect($module_name, $host, $database, $username, $password, DBX_PERSISTENT);
-if ($dlo!=0) {
- print('persistent connect using string ok'."\n");
- dbx_close($dlo);
- }
-$dlo = dbx_connect($module, $host, $database, $username, $password, DBX_PERSISTENT);
-if ($dlo!=0) {
- print('persistent connect using constant ok'."\n");
- dbx_close($dlo);
- }
-$dlo = @dbx_connect($module, $host, $nonexisting_database, $username, $password, DBX_PERSISTENT);
-if ($dlo==0) {
- print('persistent connect to non-existing database failed, so it\'s ok'."\n");
- }
-else {
- print_r($dlo);
- dbx_close($dlo);
- }
-$dlo = @dbx_connect($module, $host, $database, $nonexisting_username, $nonexisting_password, DBX_PERSISTENT);
-if ($dlo==0) {
- print('persistent connect with false username/password combi failed, so it\'s ok'."\n");
- }
-else {
- print_r($dlo);
- dbx_close($dlo);
- }
-$dlo = @dbx_connect($module, $host, $database, $username, $password, DBX_PERSISTENT, "12many");
-if ($dlo==0) {
- print('too many parameters: connect failure works ok'."\n");
- }
-else {
- print_r($dlo);
- dbx_close($dlo);
- }
-$dlo = @dbx_connect($module, $host, $database, $username);
-if ($dlo==0) {
- print('too few parameters: connect failure works ok'."\n");
- }
-else {
- print_r($dlo);
- dbx_close($dlo);
- }
-$dlo1 = dbx_connect($module, $host, $database, $username, $password);
-$dlo2 = dbx_connect($module, $host, $database, $username, $password);
-if ($dlo1!=0 && $dlo2!=0) {
- print('multiple connects ok'."\n");
- dbx_close($dlo1);
- dbx_close($dlo2);
- }
-$dlo1 = dbx_connect($module, $host, $database, $username, $password);
-$dlo2 = @dbx_connect($module, $host, $nonexisting_database, $username, $password);
-if ($dlo1!=0 && $dlo2==0) {
- print('multiple connects (2nd fails on database-name) ok'."\n");
- dbx_close($dlo1);
- }
-?>
---EXPECT--
-connect using string ok
-connect using constant ok
-connect to non-existing database failed, so it's ok
-connect with false username/password combi failed, so it's ok
-persistent connect using string ok
-persistent connect using constant ok
-persistent connect to non-existing database failed, so it's ok
-persistent connect with false username/password combi failed, so it's ok
-too many parameters: connect failure works ok
-too few parameters: connect failure works ok
-multiple connects ok
-multiple connects (2nd fails on database-name) ok \ No newline at end of file
diff --git a/ext/dbx/tests/004.phpt b/ext/dbx/tests/004.phpt
deleted file mode 100644
index 404e7de3eb..0000000000
--- a/ext/dbx/tests/004.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-dbx_close
---SKIPIF--
-<?php
-include_once("skipif.inc");
-?>
---FILE--
-<?php
-include_once("dbx_test.p");
-$dlo = dbx_connect($module, $host, $database, $username, $password);
-if ($module===DBX_OCI8) { // close for oci8 always return NULL since it doesn't do anything
- print('close works ok'."\n");
- }
-else {
- if ($dlo!=0) {
- if (dbx_close($dlo)) {
- print('close works ok'."\n");
- }
- }
- }
-if (!@dbx_close($dlo)) {
- print('close failure works ok'."\n");
- }
-if (!@dbx_close($dlo, "12many")) {
- print('too many parameters: close failure works ok'."\n");
- }
-if (!@dbx_close()) {
- print('too few parameters: close failure works ok'."\n");
- }
-?>
---EXPECT--
-close works ok
-close failure works ok
-too many parameters: close failure works ok
-too few parameters: close failure works ok \ No newline at end of file
diff --git a/ext/dbx/tests/005.phpt b/ext/dbx/tests/005.phpt
deleted file mode 100644
index d12e1ca893..0000000000
--- a/ext/dbx/tests/005.phpt
+++ /dev/null
@@ -1,106 +0,0 @@
---TEST--
-dbx_query
---SKIPIF--
-<?php
-include_once("skipif.inc");
-?>
---INI--
-magic_quotes_runtime=0
---FILE--
-<?php
-include_once("dbx_test.p");
-$sql_statement = "select * from tbl order by id";
-$invalid_sql_statement = "invalid select * from tbl";
-$sql_select_statement = "select * from tbl where id=999999 and parentid=999999";
-$sql_insert_statement = "insert into tbl (id, parentid, description) values (999999, 999999, 'temporary_record')";
-$sql_update_statement = "update tbl set field2 = 'bla''bla\"bla' where id=999999 and parentid=999999";
-$sql_delete_statement = "delete from tbl where id=999999 and parentid=999999";
-$dlo = dbx_connect($module, $host, $database, $username, $password);
-if (!$dlo) {
- print('this won\'t work'."\n");
- }
-else {
- // especially for sybase I need to set the textsize to >64 k, as one of the test-fields
- // requires this (shouldn't this be a php.ini-entry??)
- if ($connection === DBX_SYBASECT) @dbx_query($dlo, "set textsize 100000");
- // select query
- if ($dro=dbx_query($dlo, $sql_statement)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".$dro->data[$i]['field1'].".".strlen($dro->data[$i]['field2'])."\n");
- }
- $dro->data[0]['id']='changed_value';
- print($dro->data[0][0]."\n");
- }
- // insert query
- if (dbx_query($dlo, $sql_insert_statement)) {
- print('insert-query: dbx_query works ok'."\n");
- if ($dro=dbx_query($dlo, $sql_select_statement)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".strlen($dro->data[$i]['field2'])."\n");
- }
- }
- }
- // update query
- if (dbx_query($dlo, $sql_update_statement)) {
- print('update-query: dbx_query works ok'."\n");
- if ($dro=dbx_query($dlo, $sql_select_statement)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".strlen($dro->data[$i]['field2'])."\n");
- }
- }
- }
- // delete query
- if (dbx_query($dlo, $sql_delete_statement)) {
- print('delete-query: dbx_query works ok'."\n");
- if ($dro=dbx_query($dlo, $sql_select_statement)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".strlen($dro->data[$i]['field2'])."\n");
- }
- }
- }
- // colnames_case flags
- if ($dro=dbx_query($dlo, $sql_statement, DBX_COLNAMES_LOWERCASE)) {
- print('column name lowercased: ');
- print($dro->info["name"][0].".".$dro->data[0]['id'].".".$dro->data[0]['description']."\n");
- }
- if ($dro=dbx_query($dlo, $sql_statement, DBX_COLNAMES_UPPERCASE)) {
- print('column name uppercased: ');
- print($dro->info["name"][0].".".$dro->data[0]['ID'].".".$dro->data[0]['DESCRIPTION']."\n");
- }
-
- // generate errors
- if (!@dbx_query(0, $sql_statement)) {
- print('wrong dbx_link_object: query failure works ok'."\n");
- }
- if (!@dbx_query($dlo, $invalid_sql_statement)) {
- print('wrong sql-statement: query failure works ok'."\n");
- }
- if (!@dbx_query($dlo, $sql_statement, DBX_RESULT_INDEX, "12many")) {
- print('too many parameters: query failure works ok'."\n");
- }
- if (!@dbx_query($dlo)) {
- print('too few parameters: query failure works ok'."\n");
- }
- dbx_close($dlo);
- }
-?>
---EXPECT--
-1.root.empty fields.0
-10.abc.field2 contains single quote.3
-20.cba.field2 contains double quote.3
-30.bac.field2 contains >4k text.4591
-40.100.field2 contains >64k text.70051
-50.20.empty fields.0
-60.20.empty fields.0
-changed_value
-insert-query: dbx_query works ok
-999999.temporary_record.0
-update-query: dbx_query works ok
-999999.temporary_record.11
-delete-query: dbx_query works ok
-column name lowercased: id.1.root
-column name uppercased: ID.1.root
-wrong dbx_link_object: query failure works ok
-wrong sql-statement: query failure works ok
-too many parameters: query failure works ok
-too few parameters: query failure works ok
diff --git a/ext/dbx/tests/006.phpt b/ext/dbx/tests/006.phpt
deleted file mode 100644
index 13b8b677f7..0000000000
--- a/ext/dbx/tests/006.phpt
+++ /dev/null
@@ -1,56 +0,0 @@
---TEST--
-dbx_error
---SKIPIF--
-<?php
-include_once("skipif.inc");
-?>
---FILE--
-<?php
-include_once("dbx_test.p");
-if ($module==DBX_ODBC || $module==DBX_OCI8) {
- // ODBC module doesn't have an error-message-function (yet?)
- // OCI8 module needs the query-handle instead of the db-handle (now what?)
- print('query generated an error: dbx_error works ok'."\n");
- print('query is valid: dbx_error works ok'."\n");
- print('wrong dbx_link_object: dbx_error failure works ok'."\n");
- print('too many parameters: dbx_error failure works ok'."\n");
- print('too few parameters: dbx_error failure works ok'."\n");
- }
-else {
-
-$sql_statement = "select * from tbl";
-$invalid_sql_statement = "invalid select * from tbl";
-$dlo = dbx_connect($module, $host, $database, $username, $password);
-if (!$dlo) {
- print('this won\'t work'."\n");
- }
-else {
- @dbx_query($dlo, "select nonexistingfield from tbl");
- if ((($module==DBX_MSSQL || $module==DBX_SYBASECT) && dbx_error($dlo)!="Changed database context to '".$database."'.".($module==DBX_SYBASECT?"\n":""))
- || strlen(dbx_error($dlo))) {
- print('query generated an error: dbx_error works ok'."\n");
- }
- dbx_query($dlo, "select description from tbl");
- if (!strlen(dbx_error($dlo)) || (($module==DBX_MSSQL || $module==DBX_SYBASECT) && dbx_error($dlo)=="Changed database context to '".$database."'.".($module==DBX_SYBASECT?"\n":""))) {
- print('query is valid: dbx_error works ok'."\n");
- }
- if (!@dbx_error(0)) {
- print('wrong dbx_link_object: dbx_error failure works ok'."\n");
- }
- if (!@dbx_error($dlo, "12many")) {
- print('too many parameters: dbx_error failure works ok'."\n");
- }
- if (!@dbx_error()) {
- print('too few parameters: dbx_error failure works ok'."\n");
- }
- dbx_close($dlo);
- }
-
- }
-?>
---EXPECT--
-query generated an error: dbx_error works ok
-query is valid: dbx_error works ok
-wrong dbx_link_object: dbx_error failure works ok
-too many parameters: dbx_error failure works ok
-too few parameters: dbx_error failure works ok
diff --git a/ext/dbx/tests/007.phpt b/ext/dbx/tests/007.phpt
deleted file mode 100644
index cc049782f7..0000000000
--- a/ext/dbx/tests/007.phpt
+++ /dev/null
@@ -1,74 +0,0 @@
---TEST--
-dbx_sort
---SKIPIF--
-<?php
-include_once("skipif.inc");
-?>
---FILE--
-<?php
-include_once("dbx_test.p");
-$sql_statement = "select id, description from tbl where parentid=1 order by id";
-$compare_function = "cmp";
-$invalid_compare_function = "invalid_cmp";
-$nonexisting_compare_function = "nonexisting_cmp";
-$dlo = dbx_connect($module, $host, $database, $username, $password);
-function invalid_cmp() {
- return "blabla";
- }
-function cmp($a, $b) {
- $rv = dbx_compare($a, $b, "description");
- if (!$rv) $rv = dbx_compare($a, $b, "id");
- return $rv;
- }
-if (!$dlo) {
- print('this won\'t work'."\n");
- }
-else {
- $dro = dbx_query($dlo, $sql_statement);
- if (!$dro) {
- print('this won\'t work'."\n");
- }
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- if (dbx_sort($dro, $compare_function)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- }
- if (!@dbx_sort(0, $compare_function)) {
- print('wrong dbx_result_object: dbx_sort failure works ok'."\n");
- }
- if (dbx_sort($dro, $nonexisting_compare_function)) {
- print('nonexisting compare function: dbx_sort will NOT complain'."\n");
- }
- if (dbx_sort($dro, $invalid_compare_function)) {
- print('invalid compare function: dbx_sort will NOT complain'."\n");
- }
- if (!@dbx_sort($dro, $compare_function, "12many")) {
- print('too many parameters: dbx_sort failure works ok'."\n");
- }
- if (!@dbx_sort($dro)) {
- print('too few parameters: dbx_sort failure works ok'."\n");
- }
- dbx_close($dlo);
- }
-?>
---EXPECT--
-10.abc
-20.cba
-30.bac
-40.100
-50.20
-60.20
-40.100
-50.20
-60.20
-10.abc
-30.bac
-20.cba
-wrong dbx_result_object: dbx_sort failure works ok
-nonexisting compare function: dbx_sort will NOT complain
-invalid compare function: dbx_sort will NOT complain
-too many parameters: dbx_sort failure works ok
-too few parameters: dbx_sort failure works ok \ No newline at end of file
diff --git a/ext/dbx/tests/008.phpt b/ext/dbx/tests/008.phpt
deleted file mode 100644
index 92533bba52..0000000000
--- a/ext/dbx/tests/008.phpt
+++ /dev/null
@@ -1,146 +0,0 @@
---TEST--
-dbx_compare
---SKIPIF--
-<?php
-include_once("skipif.inc");
-?>
---FILE--
-<?php
-include_once("dbx_test.p");
-$sql_statement = "select id, description from tbl where parentid=1 order by id";
-$compare_function_1 = "cmp_description_id";
-$compare_function_2 = "cmp_description_desc_id";
-$compare_function_3 = "cmp_description_id_desc";
-$compare_function_4 = "cmp_description_desc_id_desc";
-$compare_function_5 = "cmp_description_txt_id";
-$compare_function_6 = "cmp_description_number_id";
-$dlo = dbx_connect($module, $host, $database, $username, $password);
-function cmp_description_id($a, $b) {
- $rv = dbx_compare($a, $b, "description");
- if (!$rv) $rv = dbx_compare($a, $b, "id");
- return $rv;
- }
-function cmp_description_desc_id($a, $b) {
- $rv = dbx_compare($a, $b, "description", DBX_CMP_DESC);
- if (!$rv) $rv = dbx_compare($a, $b, "id");
- return $rv;
- }
-function cmp_description_id_desc($a, $b) {
- $rv = dbx_compare($a, $b, "description");
- if (!$rv) $rv = dbx_compare($a, $b, "id", DBX_CMP_DESC);
- return $rv;
- }
-function cmp_description_desc_id_desc($a, $b) {
- $rv = dbx_compare($a, $b, "description", DBX_CMP_DESC);
- if (!$rv) $rv = dbx_compare($a, $b, "id", DBX_CMP_DESC);
- return $rv;
- }
-function cmp_description_txt_id($a, $b) {
- $rv = dbx_compare($a, $b, "description", DBX_CMP_TEXT);
- if (!$rv) $rv = dbx_compare($a, $b, "id");
- return $rv;
- }
-function cmp_description_number_id($a, $b) {
- $rv = dbx_compare($a, $b, "description", DBX_CMP_NUMBER);
- if (!$rv) $rv = dbx_compare($a, $b, "id");
- return $rv;
- }
-if (!$dlo) {
- print('this won\'t work'."\n");
- }
-else {
- $dro = dbx_query($dlo, $sql_statement);
- if (!$dro) {
- print('this won\'t work'."\n");
- }
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- if (dbx_sort($dro, $compare_function_1)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- }
- if (dbx_sort($dro, $compare_function_2)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- }
- if (dbx_sort($dro, $compare_function_3)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- }
- if (dbx_sort($dro, $compare_function_4)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- }
- if (dbx_sort($dro, $compare_function_5)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- }
- if (dbx_sort($dro, $compare_function_6)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- }
- if (!@dbx_compare($a, $b, "fieldname")) {
- print('wrong parameters: dbx_compare failure works ok'."\n");
- }
- if (!@dbx_compare($a, $b, "fieldname", DBX_CMP_NATIVE, "12many")) {
- print('too many parameters: dbx_compare failure works ok'."\n");
- }
- if (!@dbx_compare($a, $b)) {
- print('too few parameters: dbx_compare failure works ok'."\n");
- }
- dbx_close($dlo);
- }
-?>
---EXPECT--
-10.abc
-20.cba
-30.bac
-40.100
-50.20
-60.20
-40.100
-50.20
-60.20
-10.abc
-30.bac
-20.cba
-20.cba
-30.bac
-10.abc
-50.20
-60.20
-40.100
-40.100
-60.20
-50.20
-10.abc
-30.bac
-20.cba
-20.cba
-30.bac
-10.abc
-60.20
-50.20
-40.100
-40.100
-50.20
-60.20
-10.abc
-30.bac
-20.cba
-10.0
-20.0
-30.0
-50.20
-60.20
-40.100
-wrong parameters: dbx_compare failure works ok
-too many parameters: dbx_compare failure works ok
-too few parameters: dbx_compare failure works ok \ No newline at end of file
diff --git a/ext/dbx/tests/009.phpt b/ext/dbx/tests/009.phpt
deleted file mode 100644
index f363de46b1..0000000000
--- a/ext/dbx/tests/009.phpt
+++ /dev/null
@@ -1,65 +0,0 @@
---TEST--
-dbx_escape_string
---SKIPIF--
-<?php
-include_once("skipif.inc");
-?>
---INI--
-magic_quotes_runtime=0
---FILE--
-<?php
-include_once("dbx_test.p");
-$sql_select_statement = "select * from tbl where id=999999 and parentid=999999";
-$sql_insert_statement = "insert into tbl (id, parentid, description) values (999999, 999999, 'temporary_record')";
-$sql_update_statement = "update tbl set field2 = '%s' where id=999999 and parentid=999999";
-$sql_delete_statement = "delete from tbl where id=999999 and parentid=999999";
-$dlo = dbx_connect($module, $host, $database, $username, $password);
-if (!$dlo) {
- print('this won\'t work'."\n");
- }
-else {
- // insert query
- dbx_query($dlo, $sql_insert_statement);
- // dbx_escape_string should make sure that an escaped string
- // is neatly passed through to the database, and on readout
- // it should be returned exactly the same as it went in
- function test_dbx_escape_string($txt)
- {
- $sql = sprintf($GLOBALS['sql_update_statement'], dbx_escape_string($GLOBALS['dlo'], $txt));
- if (dbx_query($GLOBALS['dlo'], $sql)) {
- if ($dro=dbx_query($GLOBALS['dlo'], $GLOBALS['sql_select_statement'])) {
- print(($dro->data[0]['field2']===$txt?'ok':'fail ('.$dro->data[0]['field2'].')').': '.$txt."\n");
- }
- }
- }
- test_dbx_escape_string('no special characters');
- test_dbx_escape_string('quote \' string');
- test_dbx_escape_string('doublequote " string');
- test_dbx_escape_string('backslash \\ string');
- test_dbx_escape_string('backslash and quote \\ \' string');
- test_dbx_escape_string('ampersand & string');
- // delete query
- dbx_query($dlo, $sql_delete_statement);
- // generate errors
- if (!@dbx_escape_string(0, "any_text")) {
- print('wrong dbx_link_object: escape_string failure works ok'."\n");
- }
- if (!@dbx_escape_string($dlo, "any_text", "12many")) {
- print('too many parameters: escape_string failure works ok'."\n");
- }
- if (!@dbx_escape_string($dlo)) {
- print('too few parameters: escape_string failure works ok'."\n");
- }
- dbx_close($dlo);
- }
-?>
---EXPECT--
-ok: no special characters
-ok: quote ' string
-ok: doublequote " string
-ok: backslash \ string
-ok: backslash and quote \ ' string
-ok: ampersand & string
-wrong dbx_link_object: escape_string failure works ok
-too many parameters: escape_string failure works ok
-too few parameters: escape_string failure works ok
diff --git a/ext/dbx/tests/dbx_test.p b/ext/dbx/tests/dbx_test.p
deleted file mode 100644
index 67f2546b24..0000000000
--- a/ext/dbx/tests/dbx_test.p
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-// set the $connection to match your test-database setup
-// (possibly change the rest of the settings too)
-// e.g. $connection = DBX_MYSQL;
-$connection = NULL;
-switch ($connection) {
- case DBX_MYSQL:
- $module=DBX_MYSQL;
- $host="";
- $database="dbx_test";
- $username="dbx_testuser";
- $password="dbx_testpassword";
- $module_name="mysql";
- break;
- case DBX_MSSQL:
- $module=DBX_MSSQL;
- $host="HOLLY";
- $database="dbx_test";
- $username="";
- $password="";
- $module_name="mssql";
- break;
- case DBX_ODBC:
- $module=DBX_ODBC;
- $host="localhost";
- $database="dbx_test_mysql"; // "dbx_test_access";
- $username="dbx_testuser";
- $password="dbx_testpassword";
- $module_name="odbc";
- break;
- case DBX_PGSQL:
- $module=DBX_PGSQL;
- $host="";
- $database="dbx_test";
- $username="dbx_testuser";
- $password="dbx_testpassword";
- $module_name="pgsql";
- break;
- case DBX_FBSQL:
- $module=DBX_FBSQL;
- $host="";
- $database="dbx_test";
- $username="dbx_testuser";
- $password="dbx_testpassword";
- $module_name="fbsql";
- break;
- case DBX_OCI8:
- $module=DBX_OCI8;
- $host="";
- $database="dbx_test";
- $username="dbx_testuser";
- $password="dbx_testpassword";
- $module_name="oci8";
- break;
- case DBX_SYBASECT:
- $module=DBX_SYBASECT;
- $host="threesyb";
- $database="dbx_test";
- $username="dbx_testuser";
- $password="dbx_testpassword";
- $module_name="sybase_ct";
- break;
- }
-
-?> \ No newline at end of file
diff --git a/ext/dbx/tests/dbx_test.pgsql.script b/ext/dbx/tests/dbx_test.pgsql.script
deleted file mode 100644
index 316349df92..0000000000
--- a/ext/dbx/tests/dbx_test.pgsql.script
+++ /dev/null
@@ -1,37 +0,0 @@
-create database dbx_test;
-\cdbx_test
-
-create table tbl (
- id int NOT NULL default 0,
- parentid int NOT NULL default 0,
- description varchar(255) NULL,
- field1 text NULL,
- field2 text NULL,
- field3 text NULL,
- field4 text NULL,
- field5 text NULL,
- creation_date int8 NULL,
- PRIMARY KEY (id)
-);
-
-create index parentid on tbl (parentid);
-create index description on tbl (description);
-create index creation_date on tbl (creation_date);
-
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (1, 0, 'root', 'empty fields', '', '', '', '', 20010605110724 );
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (10, 1, 'abc', 'field2 contains single quote', 'x''x', '', '', '', 20010605110724);
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (20, 1, 'cba', 'field2 contains double quote', 'x"x', '', '', '', 20010605110724);
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (30, 1, 'bac', 'field2 contains >4k text', 'asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl', '', '', '', 20010605110724);
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (40, 1, '100', 'field2 contains >64k text', 'asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl', '', '', '', 20010605110724);
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (50, 1, '20', 'empty fields', '', '', '', '', 20010605110724);
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (60, 1, '20', 'empty fields', '', '', '', '', 20010605110724);
-
-create user dbx_testuser with password 'dbx_testpassword';
-grant SELECT,INSERT,UPDATE,DELETE on tbl to dbx_testuser;
diff --git a/ext/dbx/tests/dbx_test.script b/ext/dbx/tests/dbx_test.script
deleted file mode 100644
index 1bad104fba..0000000000
--- a/ext/dbx/tests/dbx_test.script
+++ /dev/null
@@ -1,38 +0,0 @@
-
-create database if not exists dbx_test;
-use dbx_test;
-
-grant SELECT,INSERT,UPDATE,DELETE on dbx_test.* to dbx_testuser@localhost identified by 'dbx_testpassword';
-
-# info tables
-
-drop table if exists tbl;
-create table tbl (
- id int(10) NOT NULL default 0,
- parentid int(10) NOT NULL default 0,
- description varchar(255) NULL,
- field1 mediumtext NULL,
- field2 mediumtext NULL,
- field3 mediumtext NULL,
- field4 mediumtext NULL,
- field5 mediumtext NULL,
- creation_date timestamp NULL,
- PRIMARY KEY (id),
- KEY parentid (parentid),
- KEY description (description),
- KEY creation_date (creation_date)
- );
-
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (1, 0, 'root', 'empty fields', '', '', '', '', 20010605110724),
- (10, 1, 'abc', 'field2 contains single quote', 'x''x', '', '', '', 20010605110724),
- (20, 1, 'cba', 'field2 contains double quote', 'x"x', '', '', '', 20010605110724),
- (30, 1, 'bac', 'field2 contains >4k text',
- 'asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl',
- '', '', '', 20010605110724),
- (40, 1, '100', 'field2 contains >64k text',
- 'asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl',
- '', '', '', 20010605110724),
- (50, 1, '20', 'empty fields', '', '', '', '', 20010605110724),
- (60, 1, '20', 'empty fields', '', '', '', '', 20010605110724)
- ; \ No newline at end of file
diff --git a/ext/dbx/tests/skipif.inc b/ext/dbx/tests/skipif.inc
deleted file mode 100644
index 1dffdc6d22..0000000000
--- a/ext/dbx/tests/skipif.inc
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
- if (!extension_loaded("dbx")) die("skip");
- include_once("dbx_test.p");
- if ($connection===NULL) die("skip connection not specified");
- die("info using $module_name");
-?> \ No newline at end of file
diff --git a/ext/dio/EXPERIMENTAL b/ext/dio/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/dio/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/dio/config.m4 b/ext/dio/config.m4
deleted file mode 100644
index 59d24229e1..0000000000
--- a/ext/dio/config.m4
+++ /dev/null
@@ -1,10 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(dio, whether to enable direct I/O support,
-[ --enable-dio Enable direct I/O support])
-
-if test "$PHP_DIO" != "no"; then
- PHP_NEW_EXTENSION(dio, dio.c, $ext_shared)
-fi
diff --git a/ext/dio/dio.c b/ext/dio/dio.c
deleted file mode 100644
index 9e0ac7bd78..0000000000
--- a/ext/dio/dio.c
+++ /dev/null
@@ -1,591 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_dio.h"
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <termios.h>
-
-#define le_fd_name "Direct I/O File Descriptor"
-static int le_fd;
-
-function_entry dio_functions[] = {
- PHP_FE(dio_open, NULL)
- PHP_FE(dio_truncate, NULL)
- PHP_FE(dio_stat, NULL)
- PHP_FE(dio_seek, NULL)
- PHP_FE(dio_fcntl, NULL)
- PHP_FE(dio_read, NULL)
- PHP_FE(dio_write, NULL)
- PHP_FE(dio_close, NULL)
- PHP_FE(dio_tcsetattr, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry dio_module_entry = {
- STANDARD_MODULE_HEADER,
- "dio",
- dio_functions,
- PHP_MINIT(dio),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(dio),
- "0.1",
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_DIO
-ZEND_GET_MODULE(dio)
-#endif
-
-static void _dio_close_fd(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- php_fd_t *f = (php_fd_t *) rsrc->ptr;
- close(f->fd);
- free(f);
-}
-
-#define RDIOC(c) REGISTER_LONG_CONSTANT(#c, c, CONST_CS | CONST_PERSISTENT)
-#define DIO_UNDEF_CONST -1
-
-PHP_MINIT_FUNCTION(dio)
-{
- le_fd = zend_register_list_destructors_ex(_dio_close_fd, NULL, le_fd_name, module_number);
-
- RDIOC(O_RDONLY);
- RDIOC(O_WRONLY);
- RDIOC(O_RDWR);
- RDIOC(O_CREAT);
- RDIOC(O_EXCL);
- RDIOC(O_TRUNC);
- RDIOC(O_APPEND);
- RDIOC(O_NONBLOCK);
- RDIOC(O_NDELAY);
-#ifdef O_SYNC
- RDIOC(O_SYNC);
-#endif
-#ifdef O_ASYNC
- RDIOC(O_ASYNC);
-#endif
- RDIOC(O_NOCTTY);
- RDIOC(S_IRWXU);
- RDIOC(S_IRUSR);
- RDIOC(S_IWUSR);
- RDIOC(S_IXUSR);
- RDIOC(S_IRWXG);
- RDIOC(S_IRGRP);
- RDIOC(S_IWGRP);
- RDIOC(S_IXGRP);
- RDIOC(S_IRWXO);
- RDIOC(S_IROTH);
- RDIOC(S_IWOTH);
- RDIOC(S_IXOTH);
- RDIOC(F_DUPFD);
- RDIOC(F_GETFD);
- RDIOC(F_GETFL);
- RDIOC(F_SETFL);
- RDIOC(F_GETLK);
- RDIOC(F_SETLK);
- RDIOC(F_SETLKW);
- RDIOC(F_SETOWN);
- RDIOC(F_GETOWN);
- RDIOC(F_UNLCK);
- RDIOC(F_RDLCK);
- RDIOC(F_WRLCK);
-
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(dio)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "dio support", "enabled");
- php_info_print_table_end();
-}
-
-static void new_php_fd(php_fd_t **f, int fd)
-{
- *f = malloc(sizeof(php_fd_t));
- (*f)->fd = fd;
-}
-
-/* {{{ proto resource dio_open(string filename, int flags[, int mode])
- Open a new filename with specified permissions of flags and creation permissions of mode */
-PHP_FUNCTION(dio_open)
-{
- php_fd_t *f;
- char *file_name;
- int file_name_length;
- long flags;
- long mode = 0;
- int fd;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", &file_name, &file_name_length, &flags, &mode) == FAILURE) {
- return;
- }
-
- if (ZEND_NUM_ARGS() == 3) {
- fd = open(file_name, flags, mode);
- } else {
- fd = open(file_name, flags);
- }
-
- if (fd == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot open file %s with flags %d and permissions %d: %s", file_name, flags, mode, strerror(errno));
- RETURN_FALSE;
- }
-
- new_php_fd(&f, fd);
- ZEND_REGISTER_RESOURCE(return_value, f, le_fd);
-}
-/* }}} */
-
-/* {{{ proto string dio_read(resource fd[, int n])
- Read n bytes from fd and return them, if n is not specified, read 1k */
-PHP_FUNCTION(dio_read)
-{
- zval *r_fd;
- php_fd_t *f;
- char *data;
- long bytes = 1024;
- ssize_t res;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &r_fd, &bytes) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-
- data = emalloc(bytes + 1);
- res = read(f->fd, data, bytes);
- if (res <= 0) {
- efree(data);
- RETURN_NULL();
- }
-
- data = erealloc(data, res + 1);
- data[res] = 0;
-
- RETURN_STRINGL(data, res, 0);
-}
-/* }}} */
-
-/* {{{ proto int dio_write(resource fd, string data[, int len])
- Write data to fd with optional truncation at length */
-PHP_FUNCTION(dio_write)
-{
- zval *r_fd;
- php_fd_t *f;
- char *data;
- int data_len;
- long trunc_len = 0;
- ssize_t res;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &r_fd, &data, &data_len, &trunc_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-
- res = write(f->fd, data, trunc_len ? trunc_len : data_len);
- if (res == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot write data to file descriptor %d, %s", f->fd, strerror(errno));
- }
-
- RETURN_LONG(res);
-}
-/* }}} */
-
-/* {{{ proto bool dio_truncate(resource fd, int offset)
- Truncate file descriptor fd to offset bytes */
-PHP_FUNCTION(dio_truncate)
-{
- zval *r_fd;
- php_fd_t *f;
- long offset;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &r_fd, &offset) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-
- if (ftruncate(f->fd, offset) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "couldn't truncate %d to %d bytes: %s", f->fd, offset, strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#define ADD_FIELD(f, v) add_assoc_long_ex(return_value, (f), sizeof(f), v);
-
-/* {{{ proto array dio_stat(resource fd)
- Get stat information about the file descriptor fd */
-PHP_FUNCTION(dio_stat)
-{
- zval *r_fd;
- php_fd_t *f;
- struct stat s;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &r_fd) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-
- if (fstat(f->fd, &s) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot stat %d: %s", f->fd, strerror(errno));
- RETURN_FALSE;
- }
-
- array_init(return_value);
- ADD_FIELD("device", s.st_dev);
- ADD_FIELD("inode", s.st_ino);
- ADD_FIELD("mode", s.st_mode);
- ADD_FIELD("nlink", s.st_nlink);
- ADD_FIELD("uid", s.st_uid);
- ADD_FIELD("gid", s.st_gid);
- ADD_FIELD("device_type", s.st_rdev);
- ADD_FIELD("size", s.st_size);
- ADD_FIELD("block_size", s.st_blksize);
- ADD_FIELD("blocks", s.st_blocks);
- ADD_FIELD("atime", s.st_atime);
- ADD_FIELD("mtime", s.st_mtime);
- ADD_FIELD("ctime", s.st_ctime);
-}
-/* }}} */
-
-/* {{{ proto int dio_seek(resource fd, int pos, int whence)
- Seek to pos on fd from whence */
-PHP_FUNCTION(dio_seek)
-{
- zval *r_fd;
- php_fd_t *f;
- long offset;
- long whence = SEEK_SET;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &r_fd, &offset, &whence) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-
- RETURN_LONG(lseek(f->fd, offset, whence));
-}
-/* }}} */
-
-/* {{{ proto mixed dio_fcntl(resource fd, int cmd[, mixed arg])
- Perform a c library fcntl on fd */
-PHP_FUNCTION(dio_fcntl)
-{
- zval *r_fd;
- zval *arg = NULL;
- php_fd_t *f;
- long cmd;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &r_fd, &cmd, &arg) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-
- switch (cmd) {
- case F_SETLK:
- case F_SETLKW: {
- zval **element;
- struct flock lk = {0};
- HashTable *fh;
-
- if (!arg) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be array or int, none given");
- RETURN_FALSE;
- }
- if (Z_TYPE_P(arg) == IS_ARRAY) {
- fh = HASH_OF(arg);
- if (zend_hash_find(fh, "start", sizeof("start"), (void **) &element) == FAILURE) {
- lk.l_start = 0;
- } else {
- lk.l_start = Z_LVAL_PP(element);
- }
-
- if (zend_hash_find(fh, "length", sizeof("length"), (void **) &element) == FAILURE) {
- lk.l_len = 0;
- } else {
- lk.l_len = Z_LVAL_PP(element);
- }
-
- if (zend_hash_find(fh, "whence", sizeof("whence"), (void **) &element) == FAILURE) {
- lk.l_whence = 0;
- } else {
- lk.l_whence = Z_LVAL_PP(element);
- }
-
- if (zend_hash_find(fh, "type", sizeof("type"), (void **) &element) == FAILURE) {
- lk.l_type = 0;
- } else {
- lk.l_type = Z_LVAL_PP(element);
- }
- } else if (Z_TYPE_P(arg) == IS_LONG) {
- lk.l_start = 0;
- lk.l_len = 0;
- lk.l_whence = SEEK_SET;
- lk.l_type = Z_LVAL_P(arg);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be array or int, %s given", zend_zval_type_name(arg));
- RETURN_FALSE;
- }
-
- RETURN_LONG(fcntl(f->fd, cmd, &lk));
- break;
- }
- case F_GETLK: {
- struct flock lk = {0};
-
- fcntl(f->fd, cmd, &lk);
-
- array_init(return_value);
- add_assoc_long(return_value, "type", lk.l_type);
- add_assoc_long(return_value, "whence", lk.l_whence);
- add_assoc_long(return_value, "start", lk.l_start);
- add_assoc_long(return_value, "length", lk.l_len);
- add_assoc_long(return_value, "pid", lk.l_pid);
-
- break;
- }
- case F_DUPFD: {
- php_fd_t *new_f;
-
- if (!arg || Z_TYPE_P(arg) != IS_LONG) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be int");
- RETURN_FALSE;
- }
-
- new_php_fd(&new_f, fcntl(f->fd, cmd, Z_LVAL_P(arg)));
- ZEND_REGISTER_RESOURCE(return_value, new_f, le_fd);
- break;
- }
- default:
- if (!arg || Z_TYPE_P(arg) != IS_LONG) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be int");
- RETURN_FALSE;
- }
-
- RETURN_LONG(fcntl(f->fd, cmd, Z_LVAL_P(arg)));
- }
-}
-/* }}} */
-
-/* {{{ proto mixed dio_tcsetattr(resource fd, array args )
- Perform a c library tcsetattr on fd */
-PHP_FUNCTION(dio_tcsetattr)
-{
- zval *r_fd;
- zval *arg = NULL;
- php_fd_t *f;
- struct termios newtio;
- int Baud_Rate, Data_Bits=8, Stop_Bits=1, Parity=0;
- long BAUD,DATABITS,STOPBITS,PARITYON,PARITY;
- HashTable *fh;
- zval **element;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &r_fd, &arg) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-
- if (Z_TYPE_P(arg) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"tcsetattr, third argument should be an associative array");
- return;
- }
-
- fh = HASH_OF(arg);
-
- if (zend_hash_find(fh, "baud", sizeof("baud"), (void **) &element) == FAILURE) {
- Baud_Rate = 9600;
- } else {
- Baud_Rate = Z_LVAL_PP(element);
- }
-
- if (zend_hash_find(fh, "bits", sizeof("bits"), (void **) &element) == FAILURE) {
- Data_Bits = 8;
- } else {
- Data_Bits = Z_LVAL_PP(element);
- }
-
- if (zend_hash_find(fh, "stop", sizeof("stop"), (void **) &element) == FAILURE) {
- Stop_Bits = 1;
- } else {
- Stop_Bits = Z_LVAL_PP(element);
- }
-
- if (zend_hash_find(fh, "parity", sizeof("parity"), (void **) &element) == FAILURE) {
- Parity = 0;
- } else {
- Parity = Z_LVAL_PP(element);
- }
-
- /* assign to correct values... */
- switch (Baud_Rate) {
- case 38400:
- BAUD = B38400;
- break;
- case 19200:
- BAUD = B19200;
- break;
- case 9600:
- BAUD = B9600;
- break;
- case 4800:
- BAUD = B4800;
- break;
- case 2400:
- BAUD = B2400;
- break;
- case 1800:
- BAUD = B1800;
- break;
- case 1200:
- BAUD = B1200;
- break;
- case 600:
- BAUD = B600;
- break;
- case 300:
- BAUD = B300;
- break;
- case 200:
- BAUD = B200;
- break;
- case 150:
- BAUD = B150;
- break;
- case 134:
- BAUD = B134;
- break;
- case 110:
- BAUD = B110;
- break;
- case 75:
- BAUD = B75;
- break;
- case 50:
- BAUD = B50;
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid baud rate %d", Baud_Rate);
- RETURN_FALSE;
- }
- switch (Data_Bits) {
- case 8:
- DATABITS = CS8;
- break;
- case 7:
- DATABITS = CS7;
- break;
- case 6:
- DATABITS = CS6;
- break;
- case 5:
- DATABITS = CS5;
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data bits %d", Data_Bits);
- RETURN_FALSE;
- }
- switch (Stop_Bits) {
- case 1:
- STOPBITS = 0;
- break;
- case 2:
- STOPBITS = CSTOPB;
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop bits %d", Stop_Bits);
- RETURN_FALSE;
- }
-
- switch (Parity) {
- case 0:
- PARITYON = 0;
- PARITY = 0;
- break;
- case 1:
- PARITYON = PARENB;
- PARITY = PARODD;
- break;
- case 2:
- PARITYON = PARENB;
- PARITY = 0;
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity %d", Parity);
- RETURN_FALSE;
- }
-
- newtio.c_cflag = BAUD | CRTSCTS | DATABITS | STOPBITS | PARITYON | PARITY | CLOCAL | CREAD;
- newtio.c_iflag = IGNPAR;
- newtio.c_oflag = 0;
- newtio.c_lflag = 0; /* ICANON; */
- newtio.c_cc[VMIN] = 1;
- newtio.c_cc[VTIME] = 0;
- tcflush(f->fd, TCIFLUSH);
- tcsetattr(f->fd,TCSANOW,&newtio);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void dio_close(resource fd)
- Close the file descriptor given by fd */
-PHP_FUNCTION(dio_close)
-{
- zval *r_fd;
- php_fd_t *f;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &r_fd) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-
- zend_list_delete(Z_LVAL_P(r_fd));
-}
-/* }}} */
-
-/*
- * Local variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: sw=4 ts=4 noet
- */
diff --git a/ext/dio/php_dio.h b/ext/dio/php_dio.h
deleted file mode 100644
index ad8bcda13c..0000000000
--- a/ext/dio/php_dio.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_DIO_H
-#define PHP_DIO_H
-
-extern zend_module_entry dio_module_entry;
-#define phpext_dio_ptr &dio_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_DIO_API __declspec(dllexport)
-#else
-#define PHP_DIO_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-PHP_MINIT_FUNCTION(dio);
-PHP_MSHUTDOWN_FUNCTION(dio);
-PHP_RINIT_FUNCTION(dio);
-PHP_RSHUTDOWN_FUNCTION(dio);
-PHP_MINFO_FUNCTION(dio);
-
-PHP_FUNCTION(dio_open);
-PHP_FUNCTION(dio_truncate);
-PHP_FUNCTION(dio_stat);
-PHP_FUNCTION(dio_seek);
-PHP_FUNCTION(dio_read);
-PHP_FUNCTION(dio_write);
-PHP_FUNCTION(dio_fcntl);
-PHP_FUNCTION(dio_close);
-PHP_FUNCTION(dio_tcsetattr);
-
-typedef struct {
- int fd;
-} php_fd_t;
-
-#endif
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/dio/tests/001.phpt b/ext/dio/tests/001.phpt
deleted file mode 100644
index d527e1a961..0000000000
--- a/ext/dio/tests/001.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Check for dio presence
---SKIPIF--
-<?php if (!extension_loaded("dio")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "dio extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php4/tests/README for further information on
- writing regression tests
-*/
-?>
---EXPECT--
-dio extension is available \ No newline at end of file
diff --git a/ext/domxml/CREDITS b/ext/domxml/CREDITS
deleted file mode 100644
index cd360ea86e..0000000000
--- a/ext/domxml/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-domxml
-Uwe Steinmann, Christian Stocker
diff --git a/ext/domxml/EXPERIMENTAL b/ext/domxml/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/domxml/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/domxml/TODO b/ext/domxml/TODO
deleted file mode 100644
index 1237d1af76..0000000000
--- a/ext/domxml/TODO
+++ /dev/null
@@ -1,23 +0,0 @@
-1) Implement the following list entries and thier destructors:
- le_domxmlnotationp
-
-2) Use ZEND_FETCH_RESOURCE() macros instead of custom functions.
-3) Implement those classes we really want, kill all of the rest.
-4) Remove debug code (many calls to fprintf()).
-5) Make 1st arg always be the object. This is currently half-and-half, or so.
-6) Take a hard look at startup/shutdown code. This is really running slower than
- it ought to be.
-7) Fix the many, many memory leaks.
-8) Modify new_child to allow creation of attribute, cdata, dtd, etc nodes.
-9) implement schema support (libxml2 has it)
-10) implement scheme handlers (like in ext/xslt), should be possible with xmlRegisterInputCallbacks
-11) implement real sax support
- - input (building of dom-tree with sax-events) is almost finished
- - started with generating of sax-events from file/string (chregu)
- - generating sax-events from dom-tree is a more tricky one (see mailinglist of libxml2)
-12) error reporting for xslt methods
-13) (DONE long time ago) add possibility to use relative xpath queries
-14) implement $dom->free() for freeing documents from memory
-15) implement get_element_by_tagname_ns (and improve namespace support in general)
-
-
diff --git a/ext/domxml/config.m4 b/ext/domxml/config.m4
deleted file mode 100644
index 5124e4e21f..0000000000
--- a/ext/domxml/config.m4
+++ /dev/null
@@ -1,127 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(dom, for DOM support,
-[ --with-dom[=DIR] Include DOM support])
-
-if test "$PHP_DOM" != "no"; then
-
- if test "$PHP_BUNDLE_LIBXML" = "no"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(libxml2 required)
- fi
-
- AC_DEFINE(HAVE_DOMXML,1,[ ])
- PHP_NEW_EXTENSION(domxml, php_domxml.c, $ext_shared)
-fi
-
-AC_DEFUN(PHP_DOM_XSLT_CHECK_VERSION,[
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS=-I$DOMXSLT_DIR/include
- AC_MSG_CHECKING(for libxslt version)
- AC_EGREP_CPP(yes,[
-#include <libxslt/xsltconfig.h>
-#if LIBXSLT_VERSION >= 10018
- yes
-#endif
- ],[
- AC_MSG_RESULT(>= 1.0.18)
- ],[
- AC_MSG_ERROR(libxslt version 1.0.18 or greater required.)
- ])
- CPPFLAGS=$old_CPPFLAGS
-])
-
-AC_DEFUN(PHP_DOM_EXSLT_CHECK_VERSION,[
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS=-I$DOMEXSLT_DIR/include
- AC_MSG_CHECKING(for libexslt version)
- AC_EGREP_CPP(yes,[
-#include <libexslt/exsltconfig.h>
-#if LIBEXSLT_VERSION >= 600
- yes
-#endif
- ],[
- AC_MSG_RESULT(>= 1.0.3)
- ],[
- AC_MSG_ERROR(libxslt version 1.0.3 or greater required.)
- ])
- CPPFLAGS=$old_CPPFLAGS
-])
-
-PHP_ARG_WITH(dom-xslt, for DOM XSLT support,
-[ --with-dom-xslt[=DIR] DOMXML: Include DOM XSLT support (requires libxslt >= 1.0.18).
- DIR is the libxslt install directory.], no, no)
-
-PHP_ARG_WITH(dom-exslt, for DOM EXSLT support,
-[ --with-dom-exslt[=DIR] DOMXML: Include DOM EXSLT support (requires libxslt >= 1.0.18).
- DIR is the libexslt install directory.], no, no)
-
-if test "$PHP_DOM_XSLT" != "no"; then
-
- if test -r $PHP_DOM_XSLT/include/libxslt/transform.h; then
- DOMXSLT_DIR=$PHP_DOM_XSLT
- else
- for i in /usr/local /usr; do
- test -r $i/include/libxslt/transform.h && DOMXSLT_DIR=$i
- done
- fi
-
- if test -z "$DOMXSLT_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the libxslt >= 1.0.3 distribution)
- fi
-
- PHP_DOM_XSLT_CHECK_VERSION
-
- PHP_ADD_LIBRARY_WITH_PATH(xslt, $DOMXSLT_DIR/lib, DOMXML_SHARED_LIBADD)
-
- PHP_ADD_INCLUDE($DOMXSLT_DIR/include)
-
- if test "$PHP_DOM" = "no"; then
- AC_MSG_ERROR(DOMXSLT requires DOMXML. Use --with-dom)
- fi
-
- if test -f $DOMXSLT_DIR/lib/libxsltbreakpoint.a -o -f $DOMXSLT_DIR/lib/libxsltbreakpoint.$SHLIB_SUFFIX_NAME ; then
- PHP_ADD_LIBRARY_WITH_PATH(xsltbreakpoint, $DOMXSLT_DIR/lib, DOMXML_SHARED_LIBADD)
- fi
-
- AC_DEFINE(HAVE_DOMXSLT,1,[ ])
-
- PHP_SUBST(DOMXML_SHARED_LIBADD)
-fi
-
-if test "$PHP_DOM_EXSLT" != "no"; then
- if test "$PHP_DOM" = "no"; then
- AC_MSG_ERROR(DOMEXSLT requires DOMXML. Use --with-dom=<DIR>)
- fi
-
- if test "$PHP_DOM_XSLT" = "no"; then
- AC_MSG_ERROR(DOMEXSLT requires DOMXSLT. Use --with-dom-xslt=<DIR>)
- fi
-
- if test -r $PHP_DOM_EXSLT/include/libexslt/exslt.h; then
- DOMEXSLT_DIR=$PHP_DOM_EXSLT
- else
- for i in /usr/local /usr; do
- test -r $i/include/libexslt/exslt.h && DOMEXSLT_DIR=$i
- done
- fi
-
- if test -z "$DOMEXSLT_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the libxslt >= 1.0.3 distribution)
- fi
-
- PHP_DOM_EXSLT_CHECK_VERSION
-
- PHP_ADD_LIBRARY_WITH_PATH(exslt, $DOMEXSLT_DIR/lib, DOMXML_SHARED_LIBADD)
-
- PHP_ADD_INCLUDE($DOMEXSLT_DIR/include)
-
- AC_DEFINE(HAVE_DOMEXSLT,1,[ ])
-
- PHP_SUBST(DOMXML_SHARED_LIBADD)
-
-fi
diff --git a/ext/domxml/domxml.dsp b/ext/domxml/domxml.dsp
deleted file mode 100644
index 7abcd3cf4c..0000000000
--- a/ext/domxml/domxml.dsp
+++ /dev/null
@@ -1,114 +0,0 @@
-# Microsoft Developer Studio Project File - Name="domxml" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=domxml - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "domxml.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "domxml.mak" CFG="domxml - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "domxml - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "domxml - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "domxml - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DOMXML" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DOMXML_EXPORTS" /D "COMPILE_DL_DOMXML" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DOMXML=1 /D HAVE_DOMXSLT=1 /D LIBXML_STATIC=1 /D LIBXSLT_STATIC=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 wsock32.lib php4ts.lib libxml2_a.lib libxslt_a.lib iconv.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_domxml.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\bindlib_w32\Release" /libpath:"..\..\..\php_build\lib\libxslt"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "domxml - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "mssql-70" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DOMXML" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DOMXML_EXPORTS" /D "COMPILE_DL_DOMXML" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DOMXML=1 /D HAVE_DOMXSLT=1 /D LIBXML_STATIC=1 /D LIBXSLT_STATIC=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib libxml2_a.lib libxslt_a.lib iconv.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_domxml.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\bindlib_w32\Release" /libpath:"..\..\..\php_build\lib\libxslt"
-
-!ENDIF
-
-# Begin Target
-
-# Name "domxml - Win32 Release_TS"
-# Name "domxml - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_domxml.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_domxml.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c
deleted file mode 100644
index 01fc2ddfa7..0000000000
--- a/ext/domxml/php_domxml.c
+++ /dev/null
@@ -1,5661 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Uwe Steinmann <steinm@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* TODO
- * - Support Notation Nodes
- * */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/php_rand.h"
-#include "php_domxml.h"
-
-#if HAVE_DOMXML
-#include "ext/standard/info.h"
-#define PHP_XPATH 1
-#define PHP_XPTR 2
-
-/* General macros used by domxml */
-#define DOMXML_IS_TYPE(zval, ce) (zval && Z_TYPE_P(zval) == IS_OBJECT && Z_OBJCE_P(zval)->refcount == ce->refcount)
-
-#define DOMXML_DOMOBJ_NEW(zval, obj, ret) if (NULL == (zval = php_domobject_new(obj, ret, zval TSRMLS_CC))) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object"); \
- RETURN_FALSE; \
- }
-
-#define DOMXML_RET_ZVAL(zval) SEPARATE_ZVAL(&zval); \
- *return_value = *zval; \
- FREE_ZVAL(zval);
-
-#define DOMXML_RET_OBJ(zval, obj, ret) DOMXML_DOMOBJ_NEW(zval, obj, ret); \
- DOMXML_RET_ZVAL(zval);
-
-#define DOMXML_GET_THIS(zval) if (NULL == (zval = getThis())) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing"); \
- RETURN_FALSE; \
- }
-
-#define DOMXML_GET_OBJ(ret, zval, le) if (NULL == (ret = php_dom_get_object(zval, le, 0 TSRMLS_CC))) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot fetch DOM object"); \
- RETURN_FALSE; \
- }
-
-#define DOMXML_GET_THIS_OBJ(ret, zval, le) DOMXML_GET_THIS(zval); \
- DOMXML_GET_OBJ(ret, zval, le);
-
-#define DOMXML_NO_ARGS() if (ZEND_NUM_ARGS() != 0) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expects exactly 0 parameters, %d given", ZEND_NUM_ARGS()); \
- return; \
- }
-
-#define DOMXML_NOT_IMPLEMENTED() php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not yet implemented"); \
- return;
-
-/* WARNING: The number of parameters is actually the
- * number of passed variables to zend_parse_parameters(),
- * *NOT* the number of parameters expected by the PHP function. */
-#define DOMXML_PARAM_NONE(ret, zval, le) if (NULL == (zval = getThis())) { \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zval) == FAILURE) { \
- return; \
- } \
- } \
- DOMXML_GET_OBJ(ret, zval, le);
-
-#define DOMXML_PARAM_ONE(ret, zval, le, s, p1) if (NULL == (zval = getThis())) { \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o"s, &zval, p1) == FAILURE) { \
- return; \
- } \
- } else { \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, p1) == FAILURE) { \
- return; \
- } \
- } \
- DOMXML_GET_OBJ(ret, zval, le);
-
-#define DOMXML_PARAM_TWO(ret, zval, le, s, p1, p2) if (NULL == (zval = getThis())) { \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o"s, &zval, p1, p2) == FAILURE) { \
- return; \
- } \
- } else { \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, p1, p2) == FAILURE) { \
- return; \
- } \
- } \
- DOMXML_GET_OBJ(ret, zval, le);
-
-#define DOMXML_PARAM_THREE(ret, zval, le, s, p1, p2, p3) if (NULL == (zval = getThis())) { \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o"s, &zval, p1, p2, p3) == FAILURE) { \
- return; \
- } \
- } else { \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, p1, p2, p3) == FAILURE) { \
- return; \
- } \
- } \
- DOMXML_GET_OBJ(ret, zval, le);
-
-
-#define DOMXML_PARAM_FOUR(ret, zval, le, s, p1, p2, p3, p4) if (NULL == (zval = getThis())) { \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o"s, &zval, p1, p2, p3, p4) == FAILURE) { \
- return; \
- } \
- } else { \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, p1, p2, p3, p4) == FAILURE) { \
- return; \
- } \
- } \
- DOMXML_GET_OBJ(ret, zval, le);
-
-#define DOMXML_PARAM_SIX(ret, zval, le, s, p1, p2, p3, p4, p5, p6) if (NULL == (zval = getThis())) { \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o"s, &zval, p1, p2, p3, p4, p5, p6) == FAILURE) { \
- return; \
- } \
- } else { \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, p1, p2, p3, p4, p5, p6) == FAILURE) { \
- return; \
- } \
- } \
- DOMXML_GET_OBJ(ret, zval, le);
-
-#define DOMXML_LOAD_PARSING 0
-#define DOMXML_LOAD_VALIDATING 1
-#define DOMXML_LOAD_RECOVERING 2
-#define DOMXML_LOAD_SUBSTITUTE_ENTITIES 4
-#define DOMXML_LOAD_COMPLETE_ATTRS 8
-#define DOMXML_LOAD_DONT_KEEP_BLANKS 16
-static int le_domxmldocp;
-static int le_domxmldoctypep;
-static int le_domxmldtdp;
-static int le_domxmlnodep;
-static int le_domxmlelementp;
-static int le_domxmlattrp;
-static int le_domxmlcdatap;
-static int le_domxmltextp;
-static int le_domxmlpip;
-static int le_domxmldocumentfragmentp;
-static int le_domxmlcommentp;
-static int le_domxmlnotationp;
-static int le_domxmlparserp;
-
-/*static int le_domxmlentityp;*/
-static int le_domxmlentityrefp;
-/*static int le_domxmlnsp;*/
-
-#if HAVE_DOMXSLT
-static int le_domxsltstylesheetp;
-#endif
-static void domxml_error(void *ctx, const char *msg, ...);
-static void domxml_error_ext(void *ctx, const char *msg, ...);
-static void domxml_error_validate(void *ctx, const char *msg, ...);
-static xmlDocPtr php_dom_xmlSAXParse(xmlSAXHandlerPtr sax, const char *buffer, int size, int recovery, void *data);
-
-#if defined(LIBXML_XPATH_ENABLED)
-static int le_xpathctxp;
-static int le_xpathobjectp;
-#endif
-
-zend_class_entry *domxmldoc_class_entry;
-zend_class_entry *domxmldoctype_class_entry;
-zend_class_entry *domxmlelement_class_entry;
-zend_class_entry *domxmldtd_class_entry;
-zend_class_entry *domxmlnode_class_entry;
-zend_class_entry *domxmlattr_class_entry;
-zend_class_entry *domxmlcdata_class_entry;
-zend_class_entry *domxmltext_class_entry;
-zend_class_entry *domxmlpi_class_entry;
-zend_class_entry *domxmldocumentfragment_class_entry;
-zend_class_entry *domxmlcomment_class_entry;
-zend_class_entry *domxmlnotation_class_entry;
-zend_class_entry *domxmlentity_class_entry;
-zend_class_entry *domxmlentityref_class_entry;
-zend_class_entry *domxmlns_class_entry;
-zend_class_entry *domxmlparser_class_entry;
-#if defined(LIBXML_XPATH_ENABLED)
-zend_class_entry *xpathctx_class_entry;
-zend_class_entry *xpathobject_class_entry;
-#endif
-#if HAVE_DOMXSLT
-zend_class_entry *domxsltstylesheet_class_entry;
-#endif
-
-static int node_attributes(zval **attributes, xmlNode *nodep TSRMLS_DC);
-static int node_children(zval **children, xmlNode *nodep TSRMLS_DC);
-
-static unsigned char first_args_force_ref[] = { 1, BYREF_FORCE };
-static unsigned char second_args_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
-static unsigned char third_args_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-
-static zend_function_entry domxml_functions[] = {
- PHP_FE(domxml_version, NULL)
- PHP_FE(xmldoc, third_args_force_ref)
- PHP_FALIAS(domxml_open_mem, xmldoc, third_args_force_ref)
- PHP_FE(xmldocfile, third_args_force_ref)
- PHP_FALIAS(domxml_open_file, xmldocfile, third_args_force_ref)
-#if defined(LIBXML_HTML_ENABLED)
- PHP_FE(html_doc, NULL)
- PHP_FE(html_doc_file, NULL)
-#endif
- PHP_FE(domxml_xmltree, NULL)
- PHP_FALIAS(xmltree, domxml_xmltree, NULL)
- PHP_FE(domxml_substitute_entities_default, NULL)
- PHP_FE(domxml_doc_document_element, NULL)
- PHP_FE(domxml_doc_add_root, NULL)
- PHP_FE(domxml_doc_set_root, NULL)
- PHP_FE(domxml_dump_mem, NULL)
- PHP_FE(domxml_dump_mem_file, NULL)
- PHP_FE(domxml_dump_node, NULL)
-#if defined(LIBXML_HTML_ENABLED)
- PHP_FE(domxml_html_dump_mem, NULL)
-#endif
- PHP_FE(domxml_node_attributes, NULL)
- PHP_FE(domxml_elem_get_attribute, NULL)
- PHP_FE(domxml_elem_set_attribute, NULL)
- PHP_FE(domxml_node_children, NULL)
- PHP_FE(domxml_node_has_attributes, NULL)
- PHP_FE(domxml_node_new_child, NULL)
- PHP_FE(domxml_node, NULL)
- PHP_FE(domxml_node_unlink_node, NULL)
- PHP_FE(domxml_node_set_content, NULL)
- PHP_FE(domxml_node_get_content, NULL)
- PHP_FE(domxml_node_add_namespace, NULL)
- PHP_FE(domxml_node_set_namespace, NULL)
- PHP_FE(domxml_new_xmldoc, NULL)
- PHP_FALIAS(domxml_new_doc, domxml_new_xmldoc, NULL)
- PHP_FE(domxml_parser, NULL)
- PHP_FE(domxml_parser_add_chunk, NULL)
- PHP_FE(domxml_parser_end, NULL)
- PHP_FE(domxml_parser_start_element, NULL)
- PHP_FE(domxml_parser_end_element, NULL)
- PHP_FE(domxml_parser_comment, NULL)
- PHP_FE(domxml_parser_characters, NULL)
- PHP_FE(domxml_parser_entity_reference, NULL)
- PHP_FE(domxml_parser_processing_instruction, NULL)
- PHP_FE(domxml_parser_cdata_section, NULL)
- PHP_FE(domxml_parser_namespace_decl, NULL)
- PHP_FE(domxml_parser_start_document, NULL)
- PHP_FE(domxml_parser_end_document, NULL)
- PHP_FE(domxml_parser_get_document, NULL)
-
-#if defined(LIBXML_XPATH_ENABLED)
- PHP_FE(xpath_new_context, NULL)
- PHP_FE(xpath_eval, NULL)
- PHP_FE(xpath_eval_expression, NULL)
- PHP_FE(xpath_register_ns, NULL)
- PHP_FE(xpath_register_ns_auto, NULL)
- PHP_FE(domxml_doc_get_elements_by_tagname, NULL)
-#endif
-
- PHP_FE(domxml_doc_get_element_by_id, NULL)
-
-#if defined(LIBXML_XPTR_ENABLED)
- PHP_FE(xptr_new_context, NULL)
- PHP_FE(xptr_eval, NULL)
-#endif
-#if HAVE_DOMXSLT
- PHP_FE(domxml_xslt_version, NULL)
- PHP_FE(domxml_xslt_stylesheet, NULL)
- PHP_FE(domxml_xslt_stylesheet_doc, NULL)
- PHP_FE(domxml_xslt_stylesheet_file, NULL)
- PHP_FE(domxml_xslt_process, NULL)
- PHP_FE(domxml_xslt_result_dump_mem, NULL)
- PHP_FE(domxml_xslt_result_dump_file, NULL)
-#endif
-
- PHP_FALIAS(domxml_add_root, domxml_doc_add_root, NULL)
- PHP_FALIAS(domxml_doc_get_root, domxml_doc_document_element, NULL)
- PHP_FALIAS(domxml_root, domxml_doc_document_element, NULL)
- PHP_FALIAS(domxml_attributes, domxml_node_attributes, NULL)
- PHP_FALIAS(domxml_get_attribute, domxml_elem_get_attribute, NULL)
- PHP_FALIAS(domxml_getattr, domxml_elem_get_attribute, NULL)
- PHP_FALIAS(domxml_set_attribute, domxml_elem_set_attribute, NULL)
- PHP_FALIAS(domxml_setattr, domxml_elem_set_attribute, NULL)
- PHP_FALIAS(domxml_children, domxml_node_children, NULL)
- PHP_FALIAS(domxml_new_child, domxml_node_new_child, NULL)
- PHP_FALIAS(domxml_unlink_node, domxml_node_unlink_node, NULL)
- PHP_FALIAS(set_content, domxml_node_set_content, NULL)
- PHP_FALIAS(new_xmldoc, domxml_new_xmldoc, NULL)
- PHP_FALIAS(domxml_dumpmem, domxml_dump_mem, NULL)
- PHP_FE(domxml_doc_validate, second_args_force_ref)
- PHP_FE(domxml_doc_xinclude, NULL)
- {NULL, NULL, NULL}
-};
-
-
-static function_entry php_domxmldoc_class_functions[] = {
- PHP_FALIAS(domdocument, xmldoc, NULL)
- PHP_FALIAS(doctype, domxml_doc_doctype, NULL)
- PHP_FALIAS(implementation, domxml_doc_implementation, NULL)
- PHP_FALIAS(document_element, domxml_doc_document_element, NULL)
- PHP_FALIAS(create_element, domxml_doc_create_element, NULL)
- PHP_FALIAS(create_element_ns, domxml_doc_create_element_ns, NULL)
- PHP_FALIAS(create_text_node, domxml_doc_create_text_node, NULL)
- PHP_FALIAS(create_comment, domxml_doc_create_comment, NULL)
- PHP_FALIAS(create_attribute, domxml_doc_create_attribute, NULL)
- PHP_FALIAS(create_cdata_section, domxml_doc_create_cdata_section, NULL)
- PHP_FALIAS(create_entity_reference, domxml_doc_create_entity_reference, NULL)
- PHP_FALIAS(create_processing_instruction, domxml_doc_create_processing_instruction, NULL)
- PHP_FALIAS(create_document_fragment, domxml_doc_create_document_fragment, NULL)
- PHP_FALIAS(get_elements_by_tagname, domxml_doc_get_elements_by_tagname, NULL)
- PHP_FALIAS(get_element_by_id, domxml_doc_get_element_by_id, NULL)
- PHP_FALIAS(free, domxml_doc_free_doc, NULL)
- /* Everything below this comment is none DOM compliant */
- /* children is deprecated because it is inherited from DomNode */
-/* PHP_FALIAS(children, domxml_node_children, NULL) */
- PHP_FALIAS(add_root, domxml_doc_add_root, NULL)
- PHP_FALIAS(set_root, domxml_doc_set_root, NULL)
- PHP_FALIAS(get_root, domxml_doc_document_element, NULL)
- PHP_FALIAS(root, domxml_doc_document_element, NULL)
- PHP_FALIAS(imported_node, domxml_doc_imported_node, NULL)
- PHP_FALIAS(dtd, domxml_intdtd, NULL)
- PHP_FALIAS(ids, domxml_doc_ids, NULL)
- PHP_FALIAS(dumpmem, domxml_dump_mem, NULL)
- PHP_FALIAS(dump_mem, domxml_dump_mem, NULL)
- PHP_FALIAS(dump_mem_file, domxml_dump_mem_file, NULL)
- PHP_FALIAS(dump_file, domxml_dump_mem_file, NULL)
-#if defined(LIBXML_HTML_ENABLED)
- PHP_FALIAS(html_dump_mem, domxml_html_dump_mem, NULL)
-#endif
-#if defined(LIBXML_XPATH_ENABLED)
- PHP_FALIAS(xpath_init, xpath_init, NULL)
- PHP_FALIAS(xpath_new_context, xpath_new_context, NULL)
- PHP_FALIAS(xptr_new_context, xptr_new_context, NULL)
-#endif
- PHP_FALIAS(validate, domxml_doc_validate, first_args_force_ref)
- PHP_FALIAS(xinclude, domxml_doc_xinclude, NULL)
-
- {NULL, NULL, NULL}
-};
-
-static function_entry php_domxmlparser_class_functions[] = {
- PHP_FALIAS(add_chunk, domxml_parser_add_chunk, NULL)
- PHP_FALIAS(end, domxml_parser_end, NULL)
- PHP_FALIAS(set_keep_blanks, domxml_parser_set_keep_blanks, NULL)
- PHP_FALIAS(start_element, domxml_parser_start_element, NULL)
- PHP_FALIAS(end_element, domxml_parser_end_element, NULL)
- PHP_FALIAS(characters, domxml_parser_characters, NULL)
- PHP_FALIAS(entity_reference, domxml_parser_entity_reference, NULL)
- PHP_FALIAS(processing_instruction, domxml_parser_processing_instruction, NULL)
- PHP_FALIAS(cdata_section, domxml_parser_cdata_section, NULL)
- PHP_FALIAS(comment, domxml_parser_comment, NULL)
- PHP_FALIAS(namespace_decl, domxml_parser_namespace_decl, NULL)
- PHP_FALIAS(start_document, domxml_parser_start_document, NULL)
- PHP_FALIAS(end_document, domxml_parser_end_document, NULL)
- PHP_FALIAS(get_document, domxml_parser_get_document, NULL)
-
- {NULL, NULL, NULL}
-};
-
-static function_entry php_domxmldoctype_class_functions[] = {
- PHP_FALIAS(name, domxml_doctype_name, NULL)
- PHP_FALIAS(entities, domxml_doctype_entities, NULL)
- PHP_FALIAS(notations, domxml_doctype_notations, NULL)
- PHP_FALIAS(system_id, domxml_doctype_system_id, NULL)
- PHP_FALIAS(public_id, domxml_doctype_public_id, NULL)
-/*
- PHP_FALIAS(internal_subset, domxml_doctype_internal_subset, NULL)
-*/
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmldtd_class_functions[] = {
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlnode_class_functions[] = {
- PHP_FALIAS(domnode, domxml_node, NULL)
- PHP_FALIAS(node_name, domxml_node_name, NULL)
- PHP_FALIAS(node_type, domxml_node_type, NULL)
- PHP_FALIAS(node_value, domxml_node_value, NULL)
- PHP_FALIAS(first_child, domxml_node_first_child, NULL)
- PHP_FALIAS(last_child, domxml_node_last_child, NULL)
- PHP_FALIAS(children, domxml_node_children, NULL)
- PHP_FALIAS(child_nodes, domxml_node_children, NULL)
- PHP_FALIAS(previous_sibling, domxml_node_previous_sibling, NULL)
- PHP_FALIAS(next_sibling, domxml_node_next_sibling, NULL)
- PHP_FALIAS(has_child_nodes, domxml_node_has_child_nodes, NULL)
- PHP_FALIAS(parent, domxml_node_parent, NULL)
- PHP_FALIAS(parent_node, domxml_node_parent, NULL)
- PHP_FALIAS(insert_before, domxml_node_insert_before, NULL)
- PHP_FALIAS(append_child, domxml_node_append_child, NULL)
- PHP_FALIAS(remove_child, domxml_node_remove_child, NULL)
- PHP_FALIAS(replace_child, domxml_node_replace_child, NULL)
- PHP_FALIAS(owner_document, domxml_node_owner_document, NULL)
- PHP_FALIAS(new_child, domxml_node_new_child, NULL)
- PHP_FALIAS(attributes, domxml_node_attributes, NULL)
- PHP_FALIAS(has_attributes, domxml_node_has_attributes, NULL)
- PHP_FALIAS(prefix, domxml_node_prefix, NULL)
- PHP_FALIAS(namespace_uri, domxml_node_namespace_uri, NULL)
- PHP_FALIAS(clone_node, domxml_clone_node, NULL)
-/* Non DOM functions start here */
- PHP_FALIAS(add_namespace, domxml_node_add_namespace, NULL)
- PHP_FALIAS(set_namespace, domxml_node_set_namespace, NULL)
- PHP_FALIAS(add_child, domxml_node_append_child, NULL)
- PHP_FALIAS(append_sibling, domxml_node_append_sibling, NULL)
- PHP_FALIAS(node, domxml_node, NULL)
- PHP_FALIAS(unlink, domxml_node_unlink_node, NULL)
- PHP_FALIAS(unlink_node, domxml_node_unlink_node, NULL)
- PHP_FALIAS(replace_node, domxml_node_replace_node, NULL)
- PHP_FALIAS(set_content, domxml_node_set_content, NULL)
- PHP_FALIAS(get_content, domxml_node_get_content, NULL)
- PHP_FALIAS(text_concat, domxml_node_text_concat, NULL)
- PHP_FALIAS(set_name, domxml_node_set_name, NULL)
- PHP_FALIAS(get_path, domxml_node_get_path, NULL)
- PHP_FALIAS(is_blank_node, domxml_is_blank_node, NULL)
- PHP_FALIAS(dump_node, domxml_dump_node, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlelement_class_functions[] = {
- PHP_FALIAS(domelement, domxml_doc_create_element, NULL)
- PHP_FALIAS(name, domxml_elem_tagname, NULL)
- PHP_FALIAS(tagname, domxml_elem_tagname, NULL)
- PHP_FALIAS(get_attribute, domxml_elem_get_attribute, NULL)
- PHP_FALIAS(set_attribute, domxml_elem_set_attribute, NULL)
- PHP_FALIAS(remove_attribute, domxml_elem_remove_attribute, NULL)
- PHP_FALIAS(get_attribute_node, domxml_elem_get_attribute_node, NULL)
- PHP_FALIAS(set_attribute_node, domxml_elem_set_attribute_node, NULL)
-#if defined(LIBXML_XPATH_ENABLED)
- PHP_FALIAS(get_elements_by_tagname, domxml_elem_get_elements_by_tagname, NULL)
-#endif
- PHP_FALIAS(has_attribute, domxml_elem_has_attribute, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlcdata_class_functions[] = {
- PHP_FALIAS(domcdata, domxml_doc_create_cdata_section,NULL)
- PHP_FALIAS(length, domxml_cdata_length, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmltext_class_functions[] = {
- PHP_FALIAS(domtext, domxml_doc_create_text_node, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlcomment_class_functions[] = {
- PHP_FALIAS(domcomment, domxml_doc_create_comment, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlnotation_class_functions[] = {
- PHP_FALIAS(public_id, domxml_notation_public_id, NULL)
- PHP_FALIAS(system_id, domxml_notation_system_id, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlentityref_class_functions[] = {
- PHP_FALIAS(domentityreference, domxml_doc_create_entity_reference, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlentity_class_functions[] = {
-/*
- PHP_FALIAS(public_id, domxml_entity_public_id, NULL)
- PHP_FALIAS(system_id, domxml_entity_system_id, NULL)
- PHP_FALIAS(notation_name, domxml_entity_notation_name, NULL)
-*/
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlpi_class_functions[] = {
- PHP_FALIAS(domprocessinginstruction, domxml_doc_create_processing_instruction, NULL)
- PHP_FALIAS(target, domxml_pi_target, NULL)
- PHP_FALIAS(data, domxml_pi_data, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmldocumentfragment_class_functions[] = {
- PHP_FALIAS(open_mem, domxml_document_fragment_open_mem, NULL)
- {NULL, NULL, NULL}
-};
-
-#if defined(LIBXML_XPATH_ENABLED)
-static zend_function_entry php_xpathctx_class_functions[] = {
- PHP_FALIAS(xpath_eval, xpath_eval, NULL)
- PHP_FALIAS(xpath_eval_expression, xpath_eval_expression, NULL)
- PHP_FALIAS(xpath_register_ns, xpath_register_ns, NULL)
- PHP_FALIAS(xpath_register_ns_auto, xpath_register_ns_auto, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_xpathobject_class_functions[] = {
- {NULL, NULL, NULL}
-};
-#endif
-
-static zend_function_entry php_domxmlattr_class_functions[] = {
- PHP_FALIAS(domattribute, domxml_doc_create_attribute, NULL)
- /* DOM_XML Consistent calls */
- PHP_FALIAS(node_name, domxml_attr_name, NULL)
- PHP_FALIAS(node_value, domxml_attr_value, NULL)
- PHP_FALIAS(node_specified, domxml_attr_specified, NULL)
- /* W3C compliant calls */
- PHP_FALIAS(name, domxml_attr_name, NULL)
- PHP_FALIAS(value, domxml_attr_value, NULL)
- PHP_FALIAS(specified, domxml_attr_specified, NULL)
- PHP_FALIAS(set_value, domxml_attr_set_value, NULL)
-/*
- PHP_FALIAS(owner_element, domxml_attr_owner_element, NULL)
-*/
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlns_class_functions[] = {
- {NULL, NULL, NULL}
-};
-
-#if HAVE_DOMXSLT
-static zend_function_entry php_domxsltstylesheet_class_functions[] = {
-/* TODO: maybe some more methods? */
- PHP_FALIAS(process, domxml_xslt_process, NULL)
- PHP_FALIAS(result_dump_mem, domxml_xslt_result_dump_mem, NULL)
- PHP_FALIAS(result_dump_file, domxml_xslt_result_dump_file, NULL)
- {NULL, NULL, NULL}
-};
-#endif
-
-zend_module_entry domxml_module_entry = {
- STANDARD_MODULE_HEADER,
- "domxml",
- domxml_functions,
- PHP_MINIT(domxml),
- PHP_MSHUTDOWN(domxml),
- NULL,
- NULL,
- PHP_MINFO(domxml),
- DOMXML_API_VERSION, /* Extension versionnumber */
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_DOMXML
-ZEND_GET_MODULE(domxml)
-#endif
-
-static void dom_object_set_data(void *obj, zval *wrapper)
-{
-/*
- char tmp[20];
- sprintf(tmp, "%08X", obj);
- fprintf(stderr, "Adding %s to hash\n", tmp);
-*/
- ((xmlNodePtr) obj)->_private = wrapper;
-}
-
-static zval *dom_object_get_data(void *obj)
-{
-/* char tmp[20];
- sprintf(tmp, "%08X", obj);
- fprintf(stderr, "Trying getting %s from object ...", tmp);
- if (((xmlNodePtr) obj)->_private) {
- fprintf(stderr, " found\n");
- } else {
- fprintf(stderr, " not found\n");
- }
-*/
- return ((zval *) (((xmlNodePtr) obj)->_private));
-}
-
-static inline void node_wrapper_dtor(xmlNodePtr node)
-{
- zval *wrapper;
- int refcount = 0;
-
- /* FIXME: type check probably unnecessary here? */
- if (!node) { /* || Z_TYPE_P(node) == XML_DTD_NODE) */
- return;
- }
-
- wrapper = dom_object_get_data(node);
-
- if (wrapper != NULL ) {
- refcount = wrapper->refcount;
- zval_ptr_dtor(&wrapper);
-
- /* only set it to null, if refcount was 1 before, otherwise it has still needed references */
- if (refcount == 1) {
- dom_object_set_data(node, NULL);
- }
- }
-
-}
-
-
-/* This function should only be used when freeing nodes
- as dependant objects are destroyed */
-static inline void node_wrapper_free(xmlNodePtr node TSRMLS_DC)
-{
- zval *wrapper, **handle;
- int type, refcount = 0;
-
- if (!node) {
- return;
- }
-
- wrapper = dom_object_get_data(node);
- if (wrapper != NULL ) {
- /* All references need to be destroyed */
- if (zend_hash_index_find(Z_OBJPROP_P(wrapper), 0, (void **) &handle) == SUCCESS) {
- if (zend_list_find(Z_LVAL_PP(handle), &type)) {
- zend_list_delete(Z_LVAL_PP(handle));
- }
- } else {
- refcount = wrapper->refcount;
- zval_ptr_dtor(&wrapper);
-
- /* only set it to null, if refcount was 1 before, otherwise it has still needed references */
- if (refcount == 1) {
- dom_object_set_data(node, NULL);
- }
- }
- }
-
-}
-
-static inline void attr_list_wrapper_dtor(xmlAttrPtr attr)
-{
- while (attr != NULL) {
- /* Attribute nodes contain children which can be accessed */
- node_wrapper_dtor((xmlNodePtr) attr);
- attr = attr->next;
- }
-}
-
-/* destroyref is a bool indicating if all registered objects for nodes
- within the tree should be destroyed */
-static inline void node_list_wrapper_dtor(xmlNodePtr node, int destroyref TSRMLS_DC)
-{
- while (node != NULL) {
- node_list_wrapper_dtor(node->children, destroyref TSRMLS_CC);
- switch (node->type) {
- /* Skip property freeing for the following types */
- case XML_ATTRIBUTE_DECL:
- case XML_DTD_NODE:
- case XML_ENTITY_DECL:
- case XML_ATTRIBUTE_NODE:
- break;
- default:
- /* Attribute Nodes contain accessible children
- Call this function with the propert list
- attr_list_wrapper_dtor(node->properties); */
- node_list_wrapper_dtor((xmlNodePtr) node->properties, destroyref TSRMLS_CC);
- }
-
- if (destroyref == 1) {
- node_wrapper_free(node TSRMLS_CC);
- } else {
- node_wrapper_dtor(node);
- }
-
- node = node->next;
- }
-}
-
-/* Navigate through the tree and unlink nodes which are referenced by objects */
-static inline void node_list_unlink(xmlNodePtr node)
-{
- zval *wrapper;
-
- while (node != NULL) {
-
- wrapper = dom_object_get_data(node);
-
- if (wrapper != NULL ) {
- /* This node is referenced so no need to check children */
- xmlUnlinkNode(node);
- } else {
- node_list_unlink(node->children);
-
- switch (node->type) {
- /* Skip property freeing for the following types */
- case XML_ATTRIBUTE_DECL:
- case XML_DTD_NODE:
- case XML_ENTITY_DECL:
- case XML_ATTRIBUTE_NODE:
- break;
- default:
- node_list_unlink((xmlNodePtr) node->properties);
- }
- }
-
- node = node->next;
- }
-}
-
-static xmlNodeSetPtr php_get_elements_by_tagname(xmlNodePtr n, xmlChar* name, xmlNodeSet *rv )
-{
- xmlNodePtr cld = NULL;
- /* TODO
- Namespace support
- */
- if (n != NULL && name != NULL) {
- cld = n->children;
- while (cld != NULL) {
- if (xmlStrcmp( name, cld->name) == 0) {
- if (rv == NULL) {
- rv = xmlXPathNodeSetCreate(cld);
- } else {
- xmlXPathNodeSetAdd(rv, cld);
- }
- }
- rv = php_get_elements_by_tagname(cld, name, rv);
- cld = cld->next;
- }
- }
- return rv;
-}
-
-static void php_free_xml_doc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- xmlDoc *doc = (xmlDoc *) rsrc->ptr;
-
- if (doc) {
- node_list_wrapper_dtor(doc->children, 0 TSRMLS_CC);
- node_wrapper_dtor((xmlNodePtr) doc);
- xmlFreeDoc(doc);
- }
-}
-
-static void php_free_xml_node(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- xmlNodePtr node = (xmlNodePtr) rsrc->ptr;
-
- /* if node has no parent, it will not be freed by php_free_xml_doc, so do it here
- and for all children as well. */
- if (node->parent == NULL) {
- /* Attribute Nodes ccontain accessible children
- attr_list_wrapper_dtor(node->properties); */
- xmlSetTreeDoc(node, NULL);
- node_list_wrapper_dtor((xmlNodePtr) node->properties, 0 TSRMLS_CC);
- node_list_wrapper_dtor(node->children, 0 TSRMLS_CC);
- node_wrapper_dtor(node);
- xmlFreeNode(node);
- } else {
- node_wrapper_dtor(node);
- }
-}
-
-static void php_free_xml_attr(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- xmlNodePtr node = (xmlNodePtr) rsrc->ptr;
- if (node->parent == NULL) {
- /* Attribute Nodes contain accessible children */
- node_list_wrapper_dtor(node->children, 0 TSRMLS_CC);
- node_wrapper_dtor(node);
- xmlFreeProp((xmlAttrPtr) node);
- } else {
- node_wrapper_dtor(node);
- }
-}
-
-#if defined(LIBXML_XPATH_ENABLED)
-static void php_free_xpath_context(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- xmlXPathContextPtr ctx = (xmlXPathContextPtr) rsrc->ptr;
- if (ctx) {
- if (ctx->user) {
- zval *wrapper = ctx->user;
- zval_ptr_dtor(&wrapper);
- }
- xmlXPathFreeContext(ctx);
- }
-}
-#endif
-
-static void php_free_xml_parser(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- xmlParserCtxtPtr parser = (xmlParserCtxtPtr) rsrc->ptr;
-
- if (parser) {
- zval *wrapper = dom_object_get_data(parser);
- zval_ptr_dtor(&wrapper);
- xmlFreeParserCtxt(parser);
- }
-}
-
-
-#if HAVE_DOMXSLT
-static void xsltstylesheet_set_data(void *obj, zval *wrapper)
-{
- ((xsltStylesheetPtr) obj)->_private = wrapper;
-}
-
-static zval *xsltstylesheet_get_data(void *obj)
-{
- return ((zval *) (((xsltStylesheetPtr) obj)->_private));
-}
-
-static void php_free_xslt_stylesheet(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- xsltStylesheetPtr sheet = (xsltStylesheetPtr) rsrc->ptr;
- zval *wrapper;
- int refcount = 0;
-
- if (sheet) {
- wrapper = xsltstylesheet_get_data(sheet);
-
- if (wrapper != NULL ) {
- refcount = wrapper->refcount;
- zval_ptr_dtor(&wrapper);
-
- /* only set it to null, if refcount was 1 before, otherwise it has still needed references */
- if (refcount == 1) {
- xsltstylesheet_set_data(sheet, NULL);
- }
- }
- xsltFreeStylesheet(sheet);
- }
-}
-
-void *php_xsltstylesheet_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
-{
- void *obj;
- zval **handle;
- int type;
-
- if (NULL == wrapper) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "xsltstylesheet_get_object() invalid wrapper object passed");
- return NULL;
- }
-
- if (Z_TYPE_P(wrapper) != IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "wrapper is not an object");
- return NULL;
- }
-
- if (zend_hash_index_find(Z_OBJPROP_P(wrapper), 0, (void **) &handle) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing");
- return NULL;
- }
-
- obj = zend_list_find(Z_LVAL_PP(handle), &type);
- if (!obj || ((type != rsrc_type1) && (type != rsrc_type2))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing or of invalid type");
- return NULL;
- }
-
- return obj;
-}
-
-static void php_xsltstylesheet_set_object(zval *wrapper, void *obj, int rsrc_type TSRMLS_DC)
-{
- zval *handle, *addr;
-
- MAKE_STD_ZVAL(handle);
- Z_TYPE_P(handle) = IS_LONG;
- Z_LVAL_P(handle) = zend_list_insert(obj, rsrc_type);
-
- MAKE_STD_ZVAL(addr);
- Z_TYPE_P(addr) = IS_LONG;
- Z_LVAL_P(addr) = (int) obj;
-
- zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, &handle, sizeof(zval *), NULL);
- zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, &addr, sizeof(zval *), NULL);
- zval_add_ref(&wrapper);
- xsltstylesheet_set_data(obj, wrapper);
-}
-#endif /* HAVE_DOMXSLT */
-
-void *php_xpath_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
-{
- void *obj;
- zval **handle;
- int type;
-
- if (NULL == wrapper) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "php_xpath_get_object() invalid wrapper object passed");
- return NULL;
- }
-
- if (Z_TYPE_P(wrapper) != IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "wrapper is not an object");
- return NULL;
- }
-
- if (zend_hash_index_find(Z_OBJPROP_P(wrapper), 0, (void **) &handle) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing");
- return NULL;
- }
-
- obj = zend_list_find(Z_LVAL_PP(handle), &type);
- if (!obj || ((type != rsrc_type1) && (type != rsrc_type2))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing or of invalid type");
- return NULL;
- }
-
- return obj;
-}
-
-static zval *php_xpathobject_new(xmlXPathObjectPtr obj, int *found TSRMLS_DC)
-{
- zval *wrapper;
-
- MAKE_STD_ZVAL(wrapper);
- object_init_ex(wrapper, xpathobject_class_entry);
- return (wrapper);
-}
-
-void *php_xpath_get_context(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
-{
- void *obj;
- zval **handle;
- int type;
-
- if (NULL == wrapper) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "php_xpath_get_context() invalid wrapper object passed");
- return NULL;
- }
-
- if (Z_TYPE_P(wrapper) != IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "wrapper is not an object");
- return NULL;
- }
-
- if (zend_hash_index_find(Z_OBJPROP_P(wrapper), 0, (void **) &handle) ==
- FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing");
- return NULL;
- }
-
- obj = zend_list_find(Z_LVAL_PP(handle), &type);
- if (!obj || ((type != rsrc_type1) && (type != rsrc_type2))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing or of invalid type");
- return NULL;
- }
-
- return obj;
-}
-
-static void xpath_context_set_data(void *obj, zval *wrapper)
-{
-/*
- char tmp[20];
- sprintf(tmp, "%08X", obj);
- fprintf(stderr, "Adding %s to hash\n", tmp);
-*/
- ((xmlXPathContextPtr) obj)->user = (void *) wrapper;
-}
-
-static zval *xpath_context_get_data(void *obj)
-{
-/*
- char tmp[20];
- sprintf(tmp, "%08X", obj);
- fprintf(stderr, "Trying getting %s from hash ...", tmp);
- if (((xmlXPathContextPtr) obj)->user) {
- fprintf(stderr, " found\n");
- } else {
- fprintf(stderr, " not found\n");
- }
-*/
- return ((zval *) (((xmlXPathContextPtr) obj)->user));
-}
-
-static void php_xpath_set_context(zval *wrapper, void *obj, int rsrc_type TSRMLS_DC)
-{
- zval *handle, *addr;
-
- MAKE_STD_ZVAL(handle);
- Z_TYPE_P(handle) = IS_LONG;
- Z_LVAL_P(handle) = zend_list_insert(obj, rsrc_type);
-
- MAKE_STD_ZVAL(addr);
- Z_TYPE_P(addr) = IS_LONG;
- Z_LVAL_P(addr) = (int) obj;
-
- zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, &handle, sizeof(zval *), NULL);
- zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, &addr, sizeof(zval *), NULL);
- zval_add_ref(&wrapper);
- xpath_context_set_data(obj, wrapper);
-}
-
-static zval *php_xpathcontext_new(xmlXPathContextPtr obj, int *found TSRMLS_DC)
-{
- zval *wrapper;
- int rsrc_type;
-
- *found = 0;
-
- if (!obj) {
- MAKE_STD_ZVAL(wrapper);
- ZVAL_NULL(wrapper);
- return wrapper;
- }
-
- if ((wrapper = (zval *) xpath_context_get_data((void *) obj))) {
- zval_add_ref(&wrapper);
- *found = 1;
- return wrapper;
- }
-
- MAKE_STD_ZVAL(wrapper);
-/*
- fprintf(stderr, "Adding new XPath Context\n");
-*/
- object_init_ex(wrapper, xpathctx_class_entry);
- rsrc_type = le_xpathctxp;
- php_xpath_set_context(wrapper, (void *) obj, rsrc_type TSRMLS_CC);
-
- return (wrapper);
-}
-
-/* helper functions for xmlparser stuff */
-static void xmlparser_set_data(void *obj, zval *wrapper)
-{
- ((xmlParserCtxtPtr) obj)->_private = wrapper;
-}
-
-
-static void php_xmlparser_set_object(zval *wrapper, void *obj, int rsrc_type TSRMLS_DC)
-{
- zval *handle, *addr;
-
- MAKE_STD_ZVAL(handle);
- Z_TYPE_P(handle) = IS_LONG;
- Z_LVAL_P(handle) = zend_list_insert(obj, rsrc_type);
-
- MAKE_STD_ZVAL(addr);
- Z_TYPE_P(addr) = IS_LONG;
- Z_LVAL_P(addr) = (int) obj;
-
- zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, &handle, sizeof(zval *), NULL);
- zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, &addr, sizeof(zval *), NULL);
- zval_add_ref(&wrapper);
- xmlparser_set_data(obj, wrapper);
-}
-
-
-static zval *php_xmlparser_new(xmlParserCtxtPtr obj, int *found TSRMLS_DC)
-{
- zval *wrapper;
- int rsrc_type;
-
- *found = 0;
-
- if (!obj) {
- MAKE_STD_ZVAL(wrapper);
- ZVAL_NULL(wrapper);
- return wrapper;
- }
-
- MAKE_STD_ZVAL(wrapper);
- object_init_ex(wrapper, domxmlparser_class_entry);
- rsrc_type = le_domxmlparserp;
- php_xmlparser_set_object(wrapper, (void *) obj, rsrc_type TSRMLS_CC);
-
- return (wrapper);
-}
-
-/* {{{ php_xmlparser_make_params()
- Translates a PHP array to a xmlparser parameters array */
-static char **php_xmlparser_make_params(zval *idvars TSRMLS_DC)
-{
- HashTable *parht;
- int parsize;
- zval **value;
- char *expr, *string_key = NULL;
- ulong num_key;
- char **params = NULL;
- int i = 0;
-
- parht = HASH_OF(idvars);
- parsize = (2 * zend_hash_num_elements(parht) + 1) * sizeof(char *);
- params = (char **)emalloc(parsize);
- memset((char *)params, 0, parsize);
-
- for (zend_hash_internal_pointer_reset(parht);
- zend_hash_get_current_data(parht, (void **)&value) == SUCCESS;
- zend_hash_move_forward(parht)) {
-
- if (zend_hash_get_current_key(parht, &string_key, &num_key, 1) != HASH_KEY_IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument or parameter array");
- return NULL;
- } else {
- SEPARATE_ZVAL(value);
- convert_to_string_ex(value);
- expr = Z_STRVAL_PP(value);
-
- if (expr) {
- params[i++] = string_key;
- params[i++] = expr;
- }
- }
- }
-
- params[i++] = NULL;
-
- return params;
-}
-/* }}} */
-/* end parser stuff */
-
-void *php_dom_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
-{
- void *obj;
- zval **handle;
- int type;
-
- if (NULL == wrapper) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "php_dom_get_object() invalid wrapper object passed");
- return NULL;
- }
-
- if (Z_TYPE_P(wrapper) != IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "wrapper is not an object");
- return NULL;
- }
-
- if (zend_hash_index_find(Z_OBJPROP_P(wrapper), 0, (void **) &handle) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing");
- return NULL;
- }
-
- obj = zend_list_find(Z_LVAL_PP(handle), &type);
-
-/* The following test should be replaced with search in all parents */
- if (!obj) { /* || ((type != rsrc_type1) && (type != rsrc_type2))) { */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing or of invalid type");
- return NULL;
- }
-
- return obj;
-}
-
-
-static void php_dom_set_object(zval *wrapper, void *obj, int rsrc_type TSRMLS_DC)
-{
- zval *handle, *addr;
-
- MAKE_STD_ZVAL(handle);
- Z_TYPE_P(handle) = IS_LONG;
- Z_LVAL_P(handle) = zend_list_insert(obj, rsrc_type);
-
- MAKE_STD_ZVAL(addr);
- Z_TYPE_P(addr) = IS_LONG;
- Z_LVAL_P(addr) = (int) obj;
-
- zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, &handle, sizeof(zval *), NULL);
- zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, &addr, sizeof(zval *), NULL);
- zval_add_ref(&wrapper);
- dom_object_set_data(obj, wrapper);
-}
-
-PHPAPI zval *php_domobject_new(xmlNodePtr obj, int *found, zval *wrapper_in TSRMLS_DC)
-{
- zval *wrapper;
- char *content;
- int rsrc_type;
-
- *found = 0;
-
- if (!obj) {
- if (!wrapper_in) {
- MAKE_STD_ZVAL(wrapper);
- } else {
- wrapper = wrapper_in;
- }
- ZVAL_NULL(wrapper);
- return wrapper;
- }
-
- if ((wrapper = (zval *) dom_object_get_data((void *) obj))) {
- zval_add_ref(&wrapper);
- *found = 1;
- return wrapper;
- }
-
- if (!wrapper_in) {
- MAKE_STD_ZVAL(wrapper);
- } else {
- wrapper = wrapper_in;
- }
-
- switch (Z_TYPE_P(obj)) {
-
- case XML_ELEMENT_NODE: {
- xmlNodePtr nodep = obj;
- if (!wrapper_in) {
- object_init_ex(wrapper, domxmlelement_class_entry);
- }
- rsrc_type = le_domxmlelementp;
- add_property_long(wrapper, "type", Z_TYPE_P(nodep));
- add_property_stringl(wrapper, "tagname", (char *) nodep->name, strlen(nodep->name), 1);
- break;
- }
-
- case XML_TEXT_NODE: {
- xmlNodePtr nodep = obj;
- if (!wrapper_in) {
- object_init_ex(wrapper, domxmltext_class_entry);
- }
- rsrc_type = le_domxmltextp;
- content = xmlNodeGetContent(nodep);
- add_property_long(wrapper, "type", Z_TYPE_P(nodep));
- add_property_stringl(wrapper, "name", "#text", 5, 1);
- if (content) {
- add_property_stringl(wrapper, "content", (char *) content, strlen(content), 1);
- }
- xmlFree(content);
- break;
- }
-
- case XML_COMMENT_NODE: {
- xmlNodePtr nodep = obj;
- if (!wrapper_in) {
- object_init_ex(wrapper, domxmlcomment_class_entry);
- }
- rsrc_type = le_domxmlcommentp;
- content = xmlNodeGetContent(nodep);
- if (content) {
- add_property_long(wrapper, "type", Z_TYPE_P(nodep));
- add_property_stringl(wrapper, "name", "#comment", 8, 1);
- add_property_stringl(wrapper, "content", (char *) content, strlen(content), 1);
- xmlFree(content);
- }
- break;
- }
-
- case XML_PI_NODE: {
- xmlNodePtr nodep = obj;
- if (!wrapper_in) {
- object_init_ex(wrapper, domxmlpi_class_entry);
- }
- rsrc_type = le_domxmlpip;
- content = xmlNodeGetContent(nodep);
- add_property_stringl(wrapper, "name", (char *) nodep->name, strlen(nodep->name), 1);
- if (content) {
- add_property_stringl(wrapper, "value", (char *) content, strlen(content), 1);
- xmlFree(content);
- }
- break;
- }
-
- case XML_ENTITY_REF_NODE: {
- xmlNodePtr nodep = obj;
- if (!wrapper_in) {
- object_init_ex(wrapper, domxmlentityref_class_entry);
- }
- rsrc_type = le_domxmlentityrefp;
- add_property_stringl(wrapper, "name", (char *) nodep->name, strlen(nodep->name), 1);
- break;
- }
-
- case XML_ENTITY_DECL:
- case XML_ELEMENT_DECL: {
- xmlNodePtr nodep = obj;
- if (!wrapper_in) {
- object_init_ex(wrapper, domxmlnode_class_entry);
- }
- rsrc_type = le_domxmlnodep;
- add_property_long(wrapper, "type", Z_TYPE_P(nodep));
- add_property_stringl(wrapper, "name", (char *) nodep->name, strlen(nodep->name), 1);
- if (Z_TYPE_P(obj) == XML_ENTITY_REF_NODE) {
- content = xmlNodeGetContent(nodep);
- if (content) {
- add_property_stringl(wrapper, "content", (char *) content, strlen(content), 1);
- xmlFree(content);
- }
- }
- break;
- }
-
- case XML_ATTRIBUTE_NODE: {
- xmlAttrPtr attrp = (xmlAttrPtr) obj;
- if (!wrapper_in) {
- object_init_ex(wrapper, domxmlattr_class_entry);
- }
- rsrc_type = le_domxmlattrp;
- add_property_long(wrapper, "type", Z_TYPE_P(attrp));
- add_property_stringl(wrapper, "name", (char *) attrp->name, strlen(attrp->name), 1);
- content = xmlNodeGetContent((xmlNodePtr) attrp);
- if (content) {
- add_property_stringl(wrapper, "value", (char *) content, strlen(content), 1);
- xmlFree(content);
- }
- break;
- }
-
- case XML_DOCUMENT_NODE:
- case XML_HTML_DOCUMENT_NODE: {
- xmlDocPtr docp = (xmlDocPtr) obj;
- if (!wrapper_in) {
- object_init_ex(wrapper, domxmldoc_class_entry);
- }
- rsrc_type = le_domxmldocp;
- if (docp->name) {
- add_property_stringl(wrapper, "name", (char *) docp->name, strlen(docp->name), 1);
- } else {
- add_property_stringl(wrapper, "name", "#document", 9, 1);
- }
- if (docp->URL) {
- add_property_stringl(wrapper, "url", (char *) docp->URL, strlen(docp->URL), 1);
- } else {
- add_property_stringl(wrapper, "url", "", 0, 1);
- }
- if (docp->version) {
- add_property_stringl(wrapper, "version", (char *) docp->version, strlen(docp->version), 1);
- } else {
- add_property_stringl(wrapper, "version", "", 0, 1);
- }
- if (docp->encoding) {
- add_property_stringl(wrapper, "encoding", (char *) docp->encoding, strlen(docp->encoding), 1);
- }
- add_property_long(wrapper, "standalone", docp->standalone);
- add_property_long(wrapper, "type", Z_TYPE_P(docp));
- add_property_long(wrapper, "compression", docp->compression);
- add_property_long(wrapper, "charset", docp->charset);
- break;
- }
-
- case XML_DOCUMENT_FRAG_NODE:
- {
- xmlNodePtr nodep = obj;
- if(!wrapper_in)
- object_init_ex(wrapper, domxmldocumentfragment_class_entry);
- add_property_stringl(wrapper, "name", "#document-fragment", 18, 1);
- rsrc_type = le_domxmldocumentfragmentp;
- add_property_long(wrapper, "type", Z_TYPE_P(nodep));
- break;
- }
-
- /* FIXME: nodes of type XML_DTD_NODE used to be domxmldtd_class_entry.
- * but the DOM Standard doesn't have a DomDtd class. The DocumentType
- * class seems to be want we need and the libxml dtd functions are
- * very much like the methods of DocumentType. I wonder what exactly
- * is the difference between XML_DTD_NODE and XML_DOCUMENT_TYPE_NODE.
- * Something like
- * <!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd'
- * [ <!ENTITY sp \"spanish\">
- * ]>
- * is considered a DTD by libxml, but from the DOM perspective it
- * rather is a DocumentType
- */
- case XML_DTD_NODE:
- case XML_DOCUMENT_TYPE_NODE: {
- xmlDtdPtr dtd = (xmlDtdPtr) obj;
- if (!wrapper_in) {
- object_init_ex(wrapper, domxmldoctype_class_entry);
- }
-/* rsrc_type = le_domxmldtdp; */
- rsrc_type = le_domxmldoctypep;
-/* add_property_long(wrapper, "type", Z_TYPE_P(dtd)); */
- add_property_long(wrapper, "type", XML_DOCUMENT_TYPE_NODE);
- if (dtd->ExternalID) {
- add_property_string(wrapper, "publicId", (char *) dtd->ExternalID, 1);
- } else {
- add_property_string(wrapper, "publicId", "", 1);
- }
- if (dtd->SystemID) {
- add_property_string(wrapper, "systemId", (char *) dtd->SystemID, 1);
- } else {
- add_property_string(wrapper, "systemId", "", 1);
- }
- if (dtd->name) {
- add_property_string(wrapper, "name", (char *) dtd->name, 1);
- }
- break;
- }
-
- case XML_CDATA_SECTION_NODE: {
- xmlNodePtr nodep = obj;
- if (!wrapper_in) {
- object_init_ex(wrapper, domxmlcdata_class_entry);
- }
- rsrc_type = le_domxmlcdatap;
- content = xmlNodeGetContent(nodep);
- add_property_long(wrapper, "type", Z_TYPE_P(nodep));
- if (content) {
- add_property_stringl(wrapper, "content", (char *) content, strlen(content), 1);
- xmlFree(content);
- }
- break;
- }
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported node type: %d\n", Z_TYPE_P(obj));
- FREE_ZVAL(wrapper);
- return NULL;
- }
-
- php_dom_set_object(wrapper, (void *) obj, rsrc_type TSRMLS_CC);
- return (wrapper);
-}
-
-static void domxml_error(void *ctx, const char *msg, ...)
-{
- char buf[1024];
- va_list ap;
- TSRMLS_FETCH();
-
- va_start(ap, msg);
- vsnprintf(buf, 1024, msg, ap);
- va_end(ap);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", buf);
-}
-
-static void domxml_error_ext(void *ctx, const char *msg, ...)
-{
- xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlParserInputPtr input = NULL;
- char buf[1024];
- va_list ap;
- TSRMLS_FETCH();
-
- va_start(ap, msg);
- vsnprintf(buf, 1024, msg, ap);
- va_end(ap);
-
- if (ctxt != NULL && ctxt->_private != NULL) {
- zval *errormessages;
- MAKE_STD_ZVAL(errormessages);
-
- array_init(errormessages);
- add_assoc_string(errormessages,"errormessage",buf,1);
- input = ctxt->input;
- if (ctxt->name) {
- add_assoc_string(errormessages,"nodename",ctxt->name,1);
- }
- if (input != NULL) {
- add_assoc_long(errormessages,"line",input->line);
- add_assoc_long(errormessages,"col",input->col);
- if (input->filename != NULL) {
- add_assoc_string(errormessages,"directory",(char *) input->directory,1);
- add_assoc_string(errormessages,"file",(char *) input->filename,1);
- }
- }
- add_next_index_zval(ctxt->_private,errormessages);
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", buf);
-
-}
-
-static void domxml_error_validate(void *ctx, const char *msg, ...)
-{
- domxml_ErrorCtxt *ctxt ;
- char buf[1024];
- va_list ap;
- TSRMLS_FETCH();
-
- va_start(ap, msg);
- vsnprintf(buf, 1024, msg, ap);
- va_end(ap);
- ctxt = (domxml_ErrorCtxt*) ctx;
-
- if (ctxt != NULL && ctxt->errors != NULL) {
- zval *errormessages;
- MAKE_STD_ZVAL(errormessages);
- array_init(errormessages);
- if (ctxt->parser != NULL) {
- if (ctxt->parser->name) {
- add_assoc_string(errormessages,"nodename",ctxt->parser->name,1);
- }
-
- if (ctxt->parser->input != NULL) {
- add_assoc_long(errormessages,"line",ctxt->parser->input->line);
- add_assoc_long(errormessages,"col",ctxt->parser->input->col);
- if (ctxt->parser->input->filename != NULL) {
- add_assoc_string(errormessages,"directory",(char *) ctxt->parser->input->directory,1);
- add_assoc_string(errormessages,"file",(char *) ctxt->parser->input->filename,1);
- }
- }
- }
-
- if (ctxt->valid->node != NULL)
- {
- /*php_error_docref(NULL TSRMLS_CC, E_WARNING,"Nodename %s",(char *) ctxt->valid->name);
-
- node = *ctxt->node;*/
- }
- add_assoc_string(errormessages,"errormessage",buf,1);
- add_next_index_zval(ctxt->errors,errormessages);
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", buf);
-
-}
-
-xmlDocPtr php_dom_xmlSAXParse(xmlSAXHandlerPtr sax, const char *buffer, int size, int recovery, void *data)
-{
- xmlDocPtr ret;
- xmlParserCtxtPtr ctxt;
- domxml_ErrorCtxt errorCtxt;
- char *directory = NULL;
-
- xmlInitParser();
-
- /* if size == -1, we assume, it's a filename not a inmemory xml doc */
- if (size == -1) {
- ctxt = (xmlParserCtxt *) xmlCreateFileParserCtxt(buffer);
- } else {
- ctxt = (xmlParserCtxt *) xmlCreateMemoryParserCtxt((xmlChar *) buffer, size);
- }
-
- if (ctxt == NULL) {
- return(NULL);
- }
-
- if (sax != NULL) {
- if (ctxt->sax != NULL) {
- xmlFree(ctxt->sax);
- }
- ctxt->sax = sax;
- }
- if (data!=NULL) {
- ctxt->_private=data;
- }
-
- /* store directory name */
- if (size == -1) {
- if ((ctxt->directory == NULL) && (directory == NULL)) {
- directory = xmlParserGetDirectory(buffer);
- }
- if ((ctxt->directory == NULL) && (directory != NULL)) {
- ctxt->directory = (char *) xmlStrdup((xmlChar *) directory);
- }
- }
- errorCtxt.valid = &ctxt->vctxt;
- errorCtxt.errors = data;
- errorCtxt.parser = ctxt;
-
- ctxt->sax->error = domxml_error_ext;
- ctxt->sax->warning = domxml_error_ext;
- ctxt->vctxt.userData = (void *) &errorCtxt;
- ctxt->vctxt.error = (xmlValidityErrorFunc) domxml_error_validate;
- ctxt->vctxt.warning = (xmlValidityWarningFunc) domxml_error_validate;
-
- xmlParseDocument(ctxt);
-
- if ((ctxt->wellFormed) || recovery) {
- ret = ctxt->myDoc;
- } else {
- ret = NULL;
- xmlFreeDoc(ctxt->myDoc);
- ctxt->myDoc = NULL;
- }
-
- if (sax != NULL) {
- ctxt->sax = NULL;
- }
-
- xmlFreeParserCtxt(ctxt);
-
- return(ret);
-}
-
-PHP_MSHUTDOWN_FUNCTION(domxml)
-{
-#if HAVE_DOMXSLT
- xsltCleanupGlobals();
-#endif
- xmlCleanupParser();
-
-/* If you want do find memleaks in this module, compile libxml2 with --with-mem-debug and
- uncomment the following line, this will tell you the amount of not freed memory
- and the total used memory into apaches error_log */
-/* xmlMemoryDump();*/
-
- return SUCCESS;
-}
-
-PHP_MINIT_FUNCTION(domxml)
-{
- zend_class_entry ce;
-
- le_domxmlnodep = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domnode", module_number);
- le_domxmlcommentp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domcomment", module_number);
- le_domxmltextp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domtext", module_number);
- le_domxmlattrp = zend_register_list_destructors_ex(php_free_xml_attr, NULL, "domattribute", module_number);
- le_domxmlelementp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domelement", module_number);
- le_domxmldtdp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domdtd", module_number);
- le_domxmlcdatap = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domcdata", module_number);
- le_domxmlentityrefp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domentityref", module_number);
- le_domxmlpip = zend_register_list_destructors_ex(php_free_xml_node, NULL, "dompi", module_number);
- le_domxmldocumentfragmentp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domdocumentfragment", module_number);
- le_domxmlparserp = zend_register_list_destructors_ex(php_free_xml_parser, NULL, "domparser", module_number);
- le_domxmldoctypep = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domdocumenttype", module_number);
- le_domxmldocp = zend_register_list_destructors_ex(php_free_xml_doc, NULL, "domdocument", module_number);
- /* Freeing the document contains freeing the complete tree.
- Therefore nodes, attributes etc. may not be freed seperately.
- Moved to end of list to support loading via dl()
- */
- /* Not yet initialized le_*s */
- le_domxmlnotationp = -10003;
-
-#if defined(LIBXML_XPATH_ENABLED)
- le_xpathctxp = zend_register_list_destructors_ex(php_free_xpath_context, NULL, "xpathcontext", module_number);
- le_xpathobjectp = zend_register_list_destructors_ex(NULL, NULL, "xpathobject", module_number);
-#endif
-
-/* le_domxmlnsp = register_list_destructors(NULL, NULL); */
-
-#if HAVE_DOMXSLT
- le_domxsltstylesheetp = zend_register_list_destructors_ex(php_free_xslt_stylesheet, NULL, "xsltstylesheet", module_number);
-#endif
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "domnode", php_domxmlnode_class_functions, NULL, NULL, NULL);
- domxmlnode_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "domdocument", php_domxmldoc_class_functions, NULL, NULL, NULL);
- domxmldoc_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "domparser", php_domxmlparser_class_functions, NULL, NULL, NULL);
- domxmlparser_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "domdocumenttype", php_domxmldoctype_class_functions, NULL, NULL, NULL);
- domxmldoctype_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "dtd", php_domxmldtd_class_functions, NULL, NULL, NULL);
- domxmldtd_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "domelement", php_domxmlelement_class_functions, NULL, NULL, NULL);
- domxmlelement_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "domattribute", php_domxmlattr_class_functions, NULL, NULL, NULL);
- domxmlattr_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "domcdata", php_domxmlcdata_class_functions, NULL, NULL, NULL);
- domxmlcdata_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "domtext", php_domxmltext_class_functions, NULL, NULL, NULL);
- domxmltext_class_entry = zend_register_internal_class_ex(&ce, domxmlcdata_class_entry, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "domcomment", php_domxmlcomment_class_functions, NULL, NULL, NULL);
- domxmlcomment_class_entry = zend_register_internal_class_ex(&ce, domxmlcdata_class_entry, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "domprocessinginstruction", php_domxmlpi_class_functions, NULL, NULL, NULL);
- domxmlpi_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "domdocumentfragment", php_domxmldocumentfragment_class_functions, NULL, NULL, NULL);
- domxmldocumentfragment_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "domnotation", php_domxmlnotation_class_functions, NULL, NULL, NULL);
- domxmlnotation_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "domentity", php_domxmlentity_class_functions, NULL, NULL, NULL);
- domxmlentity_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "domentityreference", php_domxmlentityref_class_functions, NULL, NULL, NULL);
- domxmlentityref_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "domnamespace", php_domxmlns_class_functions, NULL, NULL, NULL);
- domxmlns_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL TSRMLS_CC);
-
-#if defined(LIBXML_XPATH_ENABLED)
- INIT_OVERLOADED_CLASS_ENTRY(ce, "XPathContext", php_xpathctx_class_functions, NULL, NULL, NULL);
- xpathctx_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL TSRMLS_CC);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "XPathObject", php_xpathobject_class_functions, NULL, NULL, NULL);
- xpathobject_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL TSRMLS_CC);
-#endif
-
-#if HAVE_DOMXSLT
- INIT_OVERLOADED_CLASS_ENTRY(ce, "XsltStylesheet", php_domxsltstylesheet_class_functions, NULL, NULL, NULL);
- domxsltstylesheet_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL TSRMLS_CC);
-#endif
-
- REGISTER_LONG_CONSTANT("XML_ELEMENT_NODE", XML_ELEMENT_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NODE", XML_ATTRIBUTE_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_TEXT_NODE", XML_TEXT_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_CDATA_SECTION_NODE", XML_CDATA_SECTION_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ENTITY_REF_NODE", XML_ENTITY_REF_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ENTITY_NODE", XML_ENTITY_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_PI_NODE", XML_PI_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_COMMENT_NODE", XML_COMMENT_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_DOCUMENT_NODE", XML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_DOCUMENT_TYPE_NODE", XML_DOCUMENT_TYPE_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_DOCUMENT_FRAG_NODE", XML_DOCUMENT_FRAG_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_NOTATION_NODE", XML_NOTATION_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_HTML_DOCUMENT_NODE", XML_HTML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_DTD_NODE", XML_DTD_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ELEMENT_DECL_NODE", XML_ELEMENT_DECL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_DECL_NODE", XML_ATTRIBUTE_DECL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ENTITY_DECL_NODE", XML_ENTITY_DECL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_NAMESPACE_DECL_NODE", XML_NAMESPACE_DECL, CONST_CS | CONST_PERSISTENT);
-#ifdef XML_GLOBAL_NAMESPACE
- REGISTER_LONG_CONSTANT("XML_GLOBAL_NAMESPACE", XML_GLOBAL_NAMESPACE, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_LONG_CONSTANT("XML_LOCAL_NAMESPACE", XML_LOCAL_NAMESPACE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_CDATA", XML_ATTRIBUTE_CDATA, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ID", XML_ATTRIBUTE_ID, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_IDREF", XML_ATTRIBUTE_IDREF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_IDREFS", XML_ATTRIBUTE_IDREFS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ENTITY", XML_ATTRIBUTE_ENTITIES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NMTOKEN", XML_ATTRIBUTE_NMTOKEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NMTOKENS", XML_ATTRIBUTE_NMTOKENS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ENUMERATION", XML_ATTRIBUTE_ENUMERATION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NOTATION", XML_ATTRIBUTE_NOTATION, CONST_CS | CONST_PERSISTENT);
-
-#if defined(LIBXML_XPATH_ENABLED)
- REGISTER_LONG_CONSTANT("XPATH_UNDEFINED", XPATH_UNDEFINED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_NODESET", XPATH_NODESET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_BOOLEAN", XPATH_BOOLEAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_NUMBER", XPATH_NUMBER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_STRING", XPATH_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_POINT", XPATH_POINT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_RANGE", XPATH_RANGE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_LOCATIONSET", XPATH_LOCATIONSET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_USERS", XPATH_USERS, CONST_CS | CONST_PERSISTENT);
-#endif
-
- REGISTER_LONG_CONSTANT("DOMXML_LOAD_PARSING", DOMXML_LOAD_PARSING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DOMXML_LOAD_VALIDATING", DOMXML_LOAD_VALIDATING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DOMXML_LOAD_RECOVERING", DOMXML_LOAD_RECOVERING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DOMXML_LOAD_SUBSTITUTE_ENTITIES", DOMXML_LOAD_SUBSTITUTE_ENTITIES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DOMXML_LOAD_COMPLETE_ATTRS",DOMXML_LOAD_COMPLETE_ATTRS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DOMXML_LOAD_DONT_KEEP_BLANKS",DOMXML_LOAD_DONT_KEEP_BLANKS, CONST_CS | CONST_PERSISTENT);
- xmlSetGenericErrorFunc(xmlGenericErrorContext, (xmlGenericErrorFunc)domxml_error);
-#if HAVE_DOMXSLT
- xsltSetGenericErrorFunc(xsltGenericErrorContext, (xmlGenericErrorFunc)domxml_error);
-#if HAVE_DOMEXSLT
- exsltRegisterAll();
-#endif
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto int domxml_test(int id)
- Unity function for testing */
-PHP_FUNCTION(domxml_test)
-{
- zval **id;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &id) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(id);
- RETURN_LONG(Z_LVAL_PP(id));
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION(domxml)
- */
-PHP_MINFO_FUNCTION(domxml)
-{
- /* don't know why that line was commented out in the previous version, so i left it (cmv) */
- php_info_print_table_start();
- php_info_print_table_row(2, "DOM/XML", "enabled");
- php_info_print_table_row(2, "DOM/XML API Version", DOMXML_API_VERSION);
-/* php_info_print_table_row(2, "libxml Version", LIBXML_DOTTED_VERSION); */
- php_info_print_table_row(2, "libxml Version", xmlParserVersion);
-#if defined(LIBXML_HTML_ENABLED)
- php_info_print_table_row(2, "HTML Support", "enabled");
-#endif
-#if defined(LIBXML_XPATH_ENABLED)
- php_info_print_table_row(2, "XPath Support", "enabled");
-#endif
-#if defined(LIBXML_XPTR_ENABLED)
- php_info_print_table_row(2, "XPointer Support", "enabled");
-#endif
-#if HAVE_DOMXSLT
- {
- char buffer[128];
- int major, minor, subminor;
-
- php_info_print_table_row(2, "DOM/XSLT", "enabled");
-/* php_info_print_table_row(2, "libxslt Version", LIBXSLT_DOTTED_VERSION); */
- major = xsltLibxsltVersion/10000;
- minor = (xsltLibxsltVersion - major * 10000) / 100;
- subminor = (xsltLibxsltVersion - major * 10000 - minor * 100);
- snprintf(buffer, 128, "%d.%d.%d", major, minor, subminor);
- php_info_print_table_row(2, "libxslt Version", buffer);
- major = xsltLibxmlVersion/10000;
- minor = (xsltLibxmlVersion - major * 10000) / 100;
- subminor = (xsltLibxmlVersion - major * 10000 - minor * 100);
- snprintf(buffer, 128, "%d.%d.%d", major, minor, subminor);
- php_info_print_table_row(2, "libxslt compiled against libxml Version", buffer);
- }
-#if HAVE_DOMEXSLT
- php_info_print_table_row(2, "DOM/EXSLT", "enabled");
- php_info_print_table_row(2, "libexslt Version", LIBEXSLT_DOTTED_VERSION);
-#endif
-#endif
-
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ Methods of Class DomAttribute */
-
-/* {{{ proto array domxml_attr_name(void)
- Returns list of attribute names
- Notice: domxml_node_name() does exactly the same for attribute-nodes,
- is this function here still needed, or would an alias be enough? */
-PHP_FUNCTION(domxml_attr_name)
-{
- zval *id;
- xmlAttrPtr attrp;
-
- DOMXML_GET_THIS_OBJ(attrp, id,le_domxmlattrp);
-
- DOMXML_NO_ARGS();
-
- RETURN_STRING((char *) (attrp->name), 1);
-}
-/* }}} */
-
-/* {{{ proto array domxml_attr_value(void)
- Returns list of attribute names */
-PHP_FUNCTION(domxml_attr_value)
-{
- zval *id;
- xmlAttrPtr attrp;
- xmlChar *content;
-
- DOMXML_GET_THIS_OBJ(attrp, id, le_domxmlattrp);
-
- DOMXML_NO_ARGS();
-
- /* RETURN_STRING((char *) xmlNodeGetContent((xmlNodePtr) attrp), 1); */
- if ((content = xmlNodeGetContent((xmlNodePtr) attrp)) != NULL) {
- RETVAL_STRING(content,1);
- } else {
- RETURN_EMPTY_STRING();
- }
- xmlFree(content);
-}
-/* }}} */
-
-/* {{{ proto bool domxml_attr_set_value(string content)
- Set value of attribute */
-PHP_FUNCTION(domxml_attr_set_value)
-{
- zval *id;
- xmlAttrPtr attrp;
- int content_len;
- char *content;
-
- DOMXML_PARAM_TWO(attrp, id, le_domxmlattrp, "s", &content, &content_len);
-
- /* If attribute has children unlink referenced nodes
- Spec indicates that content is to be overwritten and not appended
- xmlNodeSetContentLen will take care of removing and freeing the rest */
- if (attrp->children) {
- node_list_unlink(((xmlNodePtr) attrp) ->children);
- }
- xmlNodeSetContentLen((xmlNodePtr) attrp, content, content_len);
- RETURN_TRUE;
-
-}
-/* }}} */
-
-/* {{{ proto array domxml_attr_specified(void)
- Returns list of attribute names */
-PHP_FUNCTION(domxml_attr_specified)
-{
- zval *id;
- xmlAttrPtr attrp;
-
- DOMXML_NOT_IMPLEMENTED();
-
- id = getThis();
- attrp = php_dom_get_object(id, le_domxmlattrp, 0 TSRMLS_CC);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* End of Methods DomAttr }}} */
-
-
-/* {{{ Methods of Class DomProcessingInstruction */
-
-/* {{{ proto array domxml_pi_target(void)
- Returns target of pi */
-PHP_FUNCTION(domxml_pi_target)
-{
- zval *id;
- xmlNodePtr nodep;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlpip);
-
- DOMXML_NO_ARGS();
-
- RETURN_STRING((char *) nodep->name, 1);
-}
-/* }}} */
-
-/* {{{ proto array domxml_pi_data(void)
- Returns data of pi */
-PHP_FUNCTION(domxml_pi_data)
-{
- zval *id;
- xmlNodePtr nodep;
- xmlChar *content;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlpip);
-
- DOMXML_NO_ARGS();
-
- /* RETURN_STRING(xmlNodeGetContent(nodep), 1); */
- if ((content = xmlNodeGetContent(nodep)) != NULL) {
- RETVAL_STRING(content,1);
- } else {
- RETURN_EMPTY_STRING();
- }
- xmlFree(content);
-}
-/* }}} */
-
-/* End of Methods of DomProcessingInstruction }}} */
-
-
-/* {{{ Methods of Class DomCData */
-
-/* {{{ proto array domxml_cdata_length(void)
- Returns list of attribute names */
-PHP_FUNCTION(domxml_cdata_length)
-{
- zval *id;
- xmlNodePtr nodep;
-
- DOMXML_NOT_IMPLEMENTED();
-
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlcdatap, 0 TSRMLS_CC);
-
- RETURN_LONG(1);
-}
-/* }}} */
-
-/* End of Methods DomCDdata }}} */
-
-
-/* {{{ Methods of Class DomNode */
-
-/* {{{ proto object domxml_node(string name)
- Creates node */
-PHP_FUNCTION(domxml_node)
-{
- zval *rv = NULL;
- xmlNode *node;
- int ret, name_len;
- char *name;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
- return;
- }
-
- node = xmlNewNode(NULL, name);
- if (!node) {
- RETURN_FALSE;
- }
-
- if (DOMXML_IS_TYPE(getThis(), domxmlnode_class_entry)) {
- DOMXML_DOMOBJ_NEW(getThis(), node, &ret);
- } else {
- DOMXML_RET_OBJ(rv, node, &ret);
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_name(void)
- Returns name of node */
-PHP_FUNCTION(domxml_node_name)
-{
- zval *id;
- xmlNode *n;
- int fullQName = 0;
- const char *str = NULL;
-
- DOMXML_PARAM_ONE(n, id, le_domxmlnodep,"|b",&fullQName);
-
- switch (Z_TYPE_P(n)) {
- case XML_ELEMENT_NODE:
- if (fullQName && n->ns && n->ns->prefix) {
- /* there is maybe a better way of doing this...*/
- char *tmpstr;
- tmpstr = (char*) emalloc((strlen(n->ns->prefix)+strlen(n->name)) * sizeof(char)) ;
- sprintf(tmpstr,"%s:%s", (char*) n->ns->prefix, (char*) n->name);
- str = strdup(tmpstr);
- efree(tmpstr);
- } else {
- str = n->name;
- }
- break;
-
- case XML_TEXT_NODE:
- str = "#text";
- break;
-
- case XML_ATTRIBUTE_NODE:
- str = n->name;
- break;
-
- case XML_CDATA_SECTION_NODE:
- str = "#cdata-section";
- break;
-
- case XML_ENTITY_REF_NODE:
- str = n->name;
- break;
-
- case XML_ENTITY_NODE:
- str = NULL;
- break;
-
- case XML_PI_NODE:
- str = n->name;
- break;
-
- case XML_COMMENT_NODE:
- str = "#comment";
- break;
-
- case XML_DOCUMENT_NODE:
- str = "#document";
- break;
-
- case XML_DOCUMENT_FRAG_NODE:
- str = "#document-fragment";
- break;
-
- default:
- str = NULL;
- break;
- }
-
- if (str != NULL) {
- RETURN_STRING((char *) str, 1);
- } else {
- RETURN_EMPTY_STRING();
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_value(void)
- Returns name of value */
-PHP_FUNCTION(domxml_node_value)
-{
- zval *id;
- xmlNode *n;
- char *str = NULL;
-
- DOMXML_GET_THIS_OBJ(n, id, le_domxmlnodep);
-
- DOMXML_NO_ARGS();
-
- switch (Z_TYPE_P(n)) {
- case XML_TEXT_NODE:
- case XML_COMMENT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_PI_NODE:
- str = n->content;
- break;
- default:
- str = NULL;
- break;
- }
- if (str != NULL) {
- RETURN_STRING((char *) str, 1);
- } else {
- RETURN_EMPTY_STRING();
- }
-}
-/* }}} */
-
-/* {{{ proto bool domxml_is_blank_node(void)
- Returns true if node is blank */
-PHP_FUNCTION(domxml_is_blank_node)
-{
- zval *id;
- xmlNode *n;
-
- DOMXML_GET_THIS_OBJ(n, id, le_domxmlnodep);
-
- DOMXML_NO_ARGS();
-
- if (xmlIsBlankNode(n)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int domxml_node_type(void)
- Returns the type of the node */
-PHP_FUNCTION(domxml_node_type)
-{
- zval *id;
- xmlNode *node;
-
- DOMXML_GET_THIS_OBJ(node, id, le_domxmlnodep);
-
- DOMXML_NO_ARGS();
-
- RETURN_LONG(node->type);
-}
-/* }}} */
-
-/* {{{ proto object domxml_clone_node([bool deep])
- Clones a node */
-PHP_FUNCTION(domxml_clone_node)
-{
- zval *rv = NULL;
- zval *id;
- xmlNode *n, *node;
- int ret;
- long recursive = 0;
-
- DOMXML_GET_THIS_OBJ(n, id, le_domxmlnodep);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &recursive) == FAILURE) {
- return;
- }
-
- node = xmlCopyNode(n, recursive);
- if (!node) {
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, node, &ret);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_first_child(void)
- Returns first child from list of children */
-PHP_FUNCTION(domxml_node_first_child)
-{
- zval *id, *rv = NULL;
- xmlNode *nodep, *first;
- int ret;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- DOMXML_NO_ARGS();
-
- first = nodep->children;
- if (!first) {
- return;
- }
-
- DOMXML_RET_OBJ(rv, first, &ret);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_last_child(void)
- Returns last child from list of children */
-PHP_FUNCTION(domxml_node_last_child)
-{
- zval *id, *rv = NULL;
- xmlNode *nodep, *last;
- int ret;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- DOMXML_NO_ARGS();
-
- last = nodep->last;
- if (!last) {
- return;
- }
-
- DOMXML_RET_OBJ(rv, last, &ret);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_next_sibling(void)
- Returns next child from list of children */
-PHP_FUNCTION(domxml_node_next_sibling)
-{
- zval *id, *rv = NULL;
- xmlNode *nodep, *first;
- int ret;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- DOMXML_NO_ARGS();
-
- first = nodep->next;
- if (!first) {
- rv = NULL;
- return;
- }
-
- DOMXML_RET_OBJ(rv, first, &ret);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_previous_sibling(void)
- Returns previous child from list of children */
-PHP_FUNCTION(domxml_node_previous_sibling)
-{
- zval *id, *rv = NULL;
- xmlNode *nodep, *first;
- int ret;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- DOMXML_NO_ARGS();
-
- first = nodep->prev;
- if (!first) {
- rv = NULL;
- return;
- }
-
- DOMXML_RET_OBJ(rv, first, &ret);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_owner_document(void)
- Returns document this node belongs to */
-PHP_FUNCTION(domxml_node_owner_document)
-{
- zval *id, *rv = NULL;
- xmlNode *nodep;
- xmlDocPtr docp;
- int ret;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- DOMXML_NO_ARGS();
-
- docp = nodep->doc;
- if (!docp) {
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, (xmlNodePtr) docp, &ret);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_has_child_nodes(void)
- Returns true if node has children */
-PHP_FUNCTION(domxml_node_has_child_nodes)
-{
- zval *id;
- xmlNode *nodep;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- DOMXML_NO_ARGS();
-
- if (nodep->children) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_has_attributes(void)
- Returns true if node has attributes */
-PHP_FUNCTION(domxml_node_has_attributes)
-{
- zval *id;
- xmlNode *nodep;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- DOMXML_NO_ARGS();
-
- if (Z_TYPE_P(nodep) != XML_ELEMENT_NODE) {
- RETURN_FALSE;
- }
-
- if (nodep->properties) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string domxml_node_prefix(void)
- Returns namespace prefix of node */
-PHP_FUNCTION(domxml_node_prefix)
-{
- zval *id;
- xmlNode *nodep;
- xmlNsPtr ns;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- DOMXML_NO_ARGS();
-
- ns = nodep->ns;
- if (!ns) {
- RETURN_EMPTY_STRING();
- }
-
- if (ns->prefix) {
- RETURN_STRING((char *) (ns->prefix), 1);
- } else {
- RETURN_EMPTY_STRING();
- }
-}
-/* }}} */
-
-/* {{{ proto string domxml_node_namespace_uri(void)
- Returns namespace uri of node */
-PHP_FUNCTION(domxml_node_namespace_uri)
-{
- zval *id;
- xmlNode *nodep;
- xmlNsPtr ns;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- DOMXML_NO_ARGS();
-
- ns = nodep->ns;
- if (!ns) {
- /* return NULL if no ns is given...*/
- return;
- }
-
- if (ns->href) {
- RETURN_STRING((char *) (ns->href), 1);
- } else {
- RETURN_EMPTY_STRING();
- }
-}
-/* }}} */
-
-/* {{{ proto string domxml_node_get_path(void)
- Returns the path of the node in the document */
-PHP_FUNCTION(domxml_node_get_path)
-{
- zval *id;
- xmlNodePtr nodep;
- xmlChar *path;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- DOMXML_NO_ARGS();
-
- path = xmlGetNodePath(nodep);
- if (!path) {
- RETURN_FALSE;
- }
- RETVAL_STRING((char *)path, 1);
- xmlFree(path);
-}
-
-/* {{{ proto object domxml_node_parent(void)
- Returns parent of node */
-PHP_FUNCTION(domxml_node_parent)
-{
- zval *id, *rv = NULL;
- xmlNode *nodep, *last;
- int ret;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- DOMXML_NO_ARGS();
-
- last = nodep->parent;
- if (!last) {
- return;
- }
-
- DOMXML_RET_OBJ(rv, last, &ret);
-}
-/* }}} */
-
-/* {{{ proto array domxml_node_children(void)
- Returns list of children nodes */
-PHP_FUNCTION(domxml_node_children)
-{
- zval *id;
- xmlNode *nodep, *last;
- int ret;
-
- DOMXML_PARAM_NONE(nodep, id, le_domxmlnodep);
-
- /* Even if the nodep is a XML_DOCUMENT_NODE the type is at the
- same position.
- */
- if ((Z_TYPE_P(nodep) == XML_DOCUMENT_NODE) || (Z_TYPE_P(nodep) == XML_HTML_DOCUMENT_NODE)) {
- last = ((xmlDoc *) nodep)->children;
- } else {
- last = nodep->children;
- }
-
- array_init(return_value);
-
- if (last) {
- while (last) {
- zval *child;
- child = php_domobject_new(last, &ret, NULL TSRMLS_CC);
- add_next_index_zval(return_value, child);
- last = last->next;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto void domxml_node_unlink_node([object node])
- Deletes the node from tree, but not from memory*/
-PHP_FUNCTION(domxml_node_unlink_node)
-{
- zval *id;
- xmlNode *nodep;
-
- DOMXML_PARAM_NONE(nodep, id, le_domxmlnodep);
-
- xmlUnlinkNode(nodep);
- /* This causes a Segmentation Fault for some reason. Removing
- it allows the user to re-add the node at some other time, in
- addition to fixing the segfault. Node will be freed at
- shutdown. */
- /*xmlFreeNode(nodep);
- zval_dtor(id);*/ /* This is not enough because the children won't be deleted */
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_replace_node(object domnode)
- Replaces one node with another node */
-PHP_FUNCTION(domxml_node_replace_node)
-{
- zval *id, *rv = NULL, *node;
- xmlNodePtr repnode, nodep, old_repnode;
- int ret;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &node) == FAILURE) {
- return;
- }
-
- DOMXML_GET_OBJ(repnode, node, le_domxmlnodep);
-
- old_repnode = xmlReplaceNode(nodep, repnode);
-
- DOMXML_RET_OBJ(rv, old_repnode, &ret);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_append_child(object domnode)
- Adds node to list of children */
-PHP_FUNCTION(domxml_node_append_child)
-{
- zval *id, *rv = NULL, *node;
- xmlNodePtr child, parent, new_child = NULL;
- int ret;
-
- DOMXML_PARAM_ONE(parent, id, le_domxmlnodep, "o", &node);
-
- DOMXML_GET_OBJ(child, node, le_domxmlnodep);
-
- if (child->type == XML_ATTRIBUTE_NODE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't append attribute node");
- RETURN_FALSE;
- }
-
- /* XXX:ls */
- if (child == parent) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't append node to itself");
- RETURN_FALSE;
- }
-
- if (!(child->doc == NULL || child->doc == parent->doc)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't append node, which is in a different document than the parent node");
- RETURN_FALSE;
- }
-
- /* first unlink node, if child is already in the tree */
- if (child->doc == parent->doc && child->parent != NULL) {
- xmlUnlinkNode(child);
- }
-
- /*
- * The following code is from libxml2/tree.c and a fix for bug #20209
- * libxml does free textnodes, if there are adjacent TEXT nodes
- * This is bad behaviour for domxml, since then we have have reference
- * to undefined nodes. The idea here is, that we do this text comparison
- * by ourself and not free the nodes. and only if libxml2 won't do any harm
- * call the function from libxml2.
- * The code is exactly the same as in libxml2, only xmlFreeNode was taken away.
- */
-
- if (child->type == XML_TEXT_NODE) {
- if ((parent->type == XML_TEXT_NODE) &&
- (parent->content != NULL)) {
- xmlNodeAddContent(parent, child->content);
- new_child = parent;
- }
- if ((parent->last != NULL) && (parent->last->type == XML_TEXT_NODE) &&
- (parent->last->name == child->name)) {
- xmlNodeAddContent(parent->last, child->content);
- new_child = parent->last;
- }
- }
- /* end libxml2 code */
- if (child->type == XML_DOCUMENT_FRAG_NODE) {
- new_child = xmlAddChildList(parent, child->children);
- if (NULL != new_child) {
- /* the children are copied, not moved, but domstandard wants to move it
- therefore we delete the reference here */
- child->children = NULL;
- }
- } else if (NULL == new_child) {
- new_child = xmlAddChild(parent, child);
- }
-
- if (NULL == new_child) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't append node");
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, new_child, &ret);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_append_sibling(object domnode)
- Adds node to list of siblings */
-PHP_FUNCTION(domxml_node_append_sibling)
-{
- zval *id, *rv = NULL, *node;
- xmlNodePtr child, nodep, new_child;
- int ret;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &node) == FAILURE) {
- return;
- }
-
- DOMXML_GET_OBJ(child, node, le_domxmlnodep);
-
- if (child->type == XML_ATTRIBUTE_NODE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't append attribute node");
- RETURN_FALSE;
- }
-
- if (NULL == (new_child = xmlCopyNode(child, 1))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to clone node");
- RETURN_FALSE;
- }
-
- /* FIXME reverted xmlAddChildList; crashes */
- child = xmlAddSibling(nodep, new_child);
-
- if (NULL == child) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't append node");
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, child, &ret);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_insert_before(object newnode, object refnode)
- Adds node in list of nodes before given node */
-PHP_FUNCTION(domxml_node_insert_before)
-{
- zval *id, *rv = NULL, *node, *ref;
- xmlNodePtr child, new_child, parent, refp;
- int ret;
-
- DOMXML_PARAM_TWO(parent, id, le_domxmlnodep, "oo!", &node, &ref);
-
- DOMXML_GET_OBJ(child, node, le_domxmlnodep);
-
- new_child = NULL;
-
- if (ref != NULL) {
- DOMXML_GET_OBJ(refp, ref, le_domxmlnodep);
-
- /*
- * The following code is from libxml2/tree.c
- * libxml does free textnodes, if there are adjacent TEXT nodes
- * This is bad behaviour for domxml, since then we have have reference
- * to undefined nodes. The idea here is, that we do this text comparison
- * by ourself and not free the nodes. and only if libxml2 won't do any harm
- * call the function from libxml2.
- * The code is exactly the same as in libxml2, only xmlFreeNode was taken away.
- */
-
- if (child->type == XML_TEXT_NODE) {
- if (refp->type == XML_TEXT_NODE) {
- xmlChar *tmp;
-
- tmp = xmlStrdup(child->content);
- tmp = xmlStrcat(tmp, refp->content);
- xmlNodeSetContent(refp, tmp);
- xmlFree(tmp);
- new_child = refp;
- }
- if ((refp->prev != NULL) && (refp->prev->type == XML_TEXT_NODE)
- && (refp->name == refp->prev->name)) {
- xmlNodeAddContent(refp->prev, child->content);
- new_child = refp->prev;
- }
- }
-
- if (new_child == NULL) {
- new_child = xmlAddPrevSibling(refp, child);
- }
- } else {
-
- if (child->type == XML_DOCUMENT_FRAG_NODE) {
- new_child = xmlAddChildList(parent, child->children);
- if (NULL != new_child) {
- /* the children are copied, not moved, but domstandard wants to move it
- therefore we delete the reference here */
-
- child->children = NULL;
- }
- } else {
-
- /* first unlink node, if child is already a child of parent
- for some strange reason, this is needed
- */
-
- if (child->parent == parent){
- xmlUnlinkNode(child);
- }
-
- new_child = xmlAddChild(parent, child);
- }
- }
-
-
- if (NULL == new_child) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't add newnode as the previous sibling of refnode");
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, new_child, &ret);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_remove_child(object domnode)
- Removes node from list of children */
-PHP_FUNCTION(domxml_node_remove_child)
-{
- zval *id, *node;
- xmlNodePtr children, child, nodep;
- int ret;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &node) == FAILURE) {
- return;
- }
-
- DOMXML_GET_OBJ(child, node, le_domxmlnodep);
-
- children = nodep->children;
- if (!children) {
- RETURN_FALSE;
- }
-
- while (children) {
- if (children == child) {
- zval *rv = NULL;
- xmlUnlinkNode(child);
- DOMXML_RET_OBJ(rv, child, &ret);
- return;
- }
- children = children->next;
- }
- RETURN_FALSE
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_replace_child(object newnode, object oldnode)
- Replaces node in list of children */
-PHP_FUNCTION(domxml_node_replace_child)
-{
- zval *id, *newnode, *oldnode;
- xmlNodePtr children, newchild, oldchild, nodep;
- int foundoldchild = 0;
- int ret;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oo", &newnode, &oldnode) == FAILURE) {
- return;
- }
-
- DOMXML_GET_OBJ(newchild, newnode, le_domxmlnodep);
- DOMXML_GET_OBJ(oldchild, oldnode, le_domxmlnodep);
-
- children = nodep->children;
- if (!children) {
- RETURN_FALSE;
- }
-
- /* check for the old child and wether the new child is already a child */
- while (children) {
- if (children == oldchild) {
- foundoldchild = 1;
- }
- children = children->next;
- }
- /* if the child to replace is existent and the new child isn't already
- * a child, then do the replacement
- */
- if (foundoldchild) {
- zval *rv = NULL;
- xmlNodePtr node;
- node = xmlReplaceNode(oldchild, newchild);
- DOMXML_RET_OBJ(rv, oldchild, &ret);
- return;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool domxml_node_set_name(string name)
- Sets name of a node */
-PHP_FUNCTION(domxml_node_set_name)
-{
- zval *id;
- xmlNode *nodep;
- int name_len;
- char *name;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
- return;
- }
-
- xmlNodeSetName(nodep, name);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array domxml_node_attributes(void)
- Returns list of attributes of node */
-PHP_FUNCTION(domxml_node_attributes)
-{
- zval *id, *attrs;
- xmlNode *nodep;
- int ret;
-
- DOMXML_PARAM_NONE(nodep, id, le_domxmlnodep);
- ret = node_attributes(&attrs, nodep TSRMLS_CC);
- if ( ret == -1) {
- RETURN_NULL();
- }
-
- if ( ret > -1) {
- *return_value = *attrs;
- FREE_ZVAL(attrs);
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_new_child(string name, string content)
- Adds child node to parent node */
-PHP_FUNCTION(domxml_node_new_child)
-{
- zval *id, *rv = NULL;
- xmlNodePtr child, nodep;
- int ret, name_len, content_len;
- char *name, *content = NULL;
-
- DOMXML_PARAM_FOUR(nodep, id, le_domxmlnodep, "s|s", &name, &name_len, &content, &content_len);
-
- child = xmlNewChild(nodep, NULL, name, content);
-
- if (!child) {
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, child, &ret);
-}
-/* }}} */
-
-/* {{{ proto bool domxml_node_set_content(string content)
- Sets content of a node */
-PHP_FUNCTION(domxml_node_set_content)
-{
- zval *id;
- xmlNode *nodep;
- int content_len;
- char *content;
-
- DOMXML_PARAM_TWO(nodep, id, le_domxmlnodep, "s", &content, &content_len);
-
- /* FIXME: another gotcha. If node has children, calling
- * xmlNodeSetContent will remove the children -> we loose the zval's
- * To prevent crash, append content if children are set
- */
- if (nodep->children) {
- xmlNodeAddContentLen(nodep, content, content_len);
- } else {
- xmlNodeSetContentLen(nodep, content, content_len);
- }
-
- /* FIXME: Actually the property 'content' of the node has to be updated
- as well. Since 'content' should disappear sooner or later and being
- replaces by a function 'content()' I skip this for now
- */
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string domxml_node_get_content()
- Gets content of a node.
-
- "Read the value of a node, this can be either the text carried directly by
-this node if it's a TEXT node or the aggregate string of the values carried by
-this node child's (TEXT and ENTITY_REF). Entity references are substituted."
- */
-PHP_FUNCTION(domxml_node_get_content)
-{
- zval *id;
- xmlNode *nodep;
- xmlChar *mem;
-
- DOMXML_PARAM_NONE(nodep, id, le_domxmlnodep);
- mem = xmlNodeGetContent(nodep);
- if (!mem) {
- RETURN_FALSE;
- }
-
- RETVAL_STRING(mem,1);
- xmlFree(mem);
-}
-/* }}} */
-
-
-/* End of Methods DomNode }}} */
-
-
-/* {{{ Methods of Class DomNotation */
-
-/* {{{ proto string domxml_notation_public_id(void)
- Returns public id of notation node */
-PHP_FUNCTION(domxml_notation_public_id)
-{
- zval *id;
- xmlNotationPtr nodep;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnotationp);
-
- DOMXML_NO_ARGS();
-
- if (nodep->PublicID) {
- RETURN_STRING((char *) (nodep->PublicID), 1);
- } else {
- RETURN_EMPTY_STRING();
- }
-}
-/* }}} */
-
-/* {{{ proto string domxml_notation_system_id(void)
- Returns system ID of notation node */
-PHP_FUNCTION(domxml_notation_system_id)
-{
- zval *id;
- xmlNotationPtr nodep;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnotationp);
-
- DOMXML_NO_ARGS();
-
- if (nodep->SystemID) {
- RETURN_STRING((char *) (nodep->SystemID), 1);
- } else {
- RETURN_EMPTY_STRING();
- }
-}
-/* }}} */
-
-/* End of Methods DomNotation }}} */
-
-
-/* {{{ Methods of Class DomElement */
-
-/* {{{ proto object domxml_element(string name)
- Constructor of DomElement */
-PHP_FUNCTION(domxml_element)
-{
- zval *rv = NULL;
- xmlNode *node;
- int ret, name_len;
- char *name;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
- return;
- }
-
- node = xmlNewNode(NULL, name);
- if (!node) {
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, node, &ret);
-}
-
-/* }}} */
-
-/* {{{ proto string domxml_elem_tagname(void)
- Returns tag name of element node */
-PHP_FUNCTION(domxml_elem_tagname)
-{
- zval *id;
- xmlNode *nodep;
-
- DOMXML_NO_ARGS();
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlelementp);
-
- DOMXML_NO_ARGS();
-
- RETURN_STRING((char *) (nodep->name), 1);
-}
-/* }}} */
-
-/* {{{ proto string domxml_elem_get_attribute(string attrname)
- Returns value of given attribute */
-PHP_FUNCTION(domxml_elem_get_attribute)
-{
- zval *id;
- xmlNode *nodep;
- char *name, *value;
- int name_len;
-
- DOMXML_PARAM_TWO(nodep, id, le_domxmlelementp, "s", &name, &name_len);
-
- value = xmlGetProp(nodep, name);
- if (!value) {
- RETURN_EMPTY_STRING();
- } else {
- RETVAL_STRING(value, 1);
- xmlFree(value);
- }
-}
-/* }}} */
-
-/* {{{ proto bool domxml_elem_set_attribute(string attrname, string value)
- Sets value of given attribute */
-PHP_FUNCTION(domxml_elem_set_attribute)
-{
- zval *id, *rv = NULL;
- xmlNode *nodep;
- xmlAttr *attr;
- int ret, name_len, value_len;
- char *name, *value;
-
- DOMXML_PARAM_FOUR(nodep, id, le_domxmlelementp, "ss", &name, &name_len, &value, &value_len);
-
-
- /* If attribute exists, all children nodes are freed by setprop
- unlink referenced children */
- attr = xmlHasProp(nodep,name);
- if (attr != NULL) {
- node_list_unlink(attr->children);
- }
- attr = xmlSetProp(nodep, name, value);
- if (!attr) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such attribute '%s'", name);
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, (xmlNodePtr) attr, &ret);
-}
-/* }}} */
-
-/* {{{ proto string domxml_elem_remove_attribute(string attrname)
- Removes given attribute */
-PHP_FUNCTION(domxml_elem_remove_attribute)
-{
- zval *id;
- xmlNode *nodep;
- xmlAttr *attrp;
- int name_len;
- char *name;
-
- DOMXML_PARAM_TWO(nodep, id, le_domxmlelementp, "s", &name, &name_len);
- attrp = xmlHasProp(nodep,name);
- if (attrp == NULL) {
- RETURN_FALSE;
- }
-
- /* Check for registered nodes within attributes tree when attribute is not referenced
- Unlink dependant nodes and free attribute if not registered */
- if (dom_object_get_data((xmlNodePtr) attrp) == NULL) {
- node_list_unlink(attrp->children);
- xmlUnlinkNode((xmlNodePtr) attrp);
- xmlFreeProp(attrp);
- } else {
- xmlUnlinkNode((xmlNodePtr) attrp);
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string domxml_elem_get_attribute_node(string attrname)
- Returns value of given attribute */
-PHP_FUNCTION(domxml_elem_get_attribute_node)
-{
- zval *id, *rv = NULL;
- xmlNode *nodep;
- xmlAttr *attrp;
- int name_len, ret;
- char *name;
-
- DOMXML_PARAM_TWO(nodep, id, le_domxmlelementp, "s", &name, &name_len);
- attrp = xmlHasProp(nodep,name);
- if (attrp == NULL) {
- RETURN_FALSE;
- }
- DOMXML_RET_OBJ(rv, (xmlNodePtr) attrp, &ret);
-}
-/* }}} */
-
-/* {{{ proto bool domxml_elem_set_attribute_node(object attr)
- Sets value of given attribute */
-PHP_FUNCTION(domxml_elem_set_attribute_node)
-{
- zval *id, *node, *rv = NULL;
- xmlNode *nodep;
- xmlAttr *attrp, *newattrp, *existattrp;
- int ret;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &node) == FAILURE) {
- return;
- }
-
- DOMXML_GET_OBJ(attrp, node, le_domxmlnodep);
-
- if (attrp->type != XML_ATTRIBUTE_NODE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute node is required");
- RETURN_FALSE;
- }
-
- existattrp = xmlHasProp(nodep,attrp->name);
- if (existattrp != NULL) {
- /* Check for registered nodes within attributes tree when attribute is not referenced
- Unlink dependant nodes and free attribute if not registered */
- if (dom_object_get_data((xmlNodePtr) existattrp) == NULL) {
- node_list_unlink(existattrp->children);
- xmlUnlinkNode((xmlNodePtr) existattrp);
- xmlFreeProp(existattrp);
- } else {
- xmlUnlinkNode((xmlNodePtr) existattrp);
- }
- }
-
- /* xmlCopyProp does not add the copy to the element node.
- It does set the parent of the copy to the element node however */
- newattrp = xmlCopyProp(nodep, attrp);
- if (!newattrp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such attribute '%s'", attrp->name);
- RETURN_FALSE;
- } else {
- xmlAttr *prop;
- prop = nodep->properties;
- if (prop == NULL) {
- nodep->properties = newattrp;
- } else {
- while (prop->next != NULL) {
- prop = prop->next;
- }
- prop->next = newattrp;
- newattrp->prev = prop;
- }
- }
-
- DOMXML_RET_OBJ(rv, (xmlNodePtr) newattrp, &ret);
-}
-/* }}} */
-
-/* {{{ proto string domxml_elem_has_attribute(string attrname)
- Checks for existenz given attribute */
-PHP_FUNCTION(domxml_elem_has_attribute)
-{
- zval *id;
- xmlNode *nodep;
- char *name, *value;
- int name_len;
-
- DOMXML_PARAM_TWO(nodep, id, le_domxmlelementp, "s", &name, &name_len);
-
- value = xmlGetProp(nodep, name);
- if (!value) {
- RETURN_FALSE;
- } else {
- xmlFree(value);
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-#if defined(LIBXML_XPATH_ENABLED)
-/* {{{ proto string domxml_doc_get_elements_by_tagname(string tagname [,object xpathctx_handle] )
- Returns array with nodes with given tagname in document or empty array, if not found*/
-PHP_FUNCTION(domxml_doc_get_elements_by_tagname)
-{
- zval *id, *rv, *contextnode = NULL,*ctxpin = NULL;
- xmlXPathContextPtr ctxp;
- xmlDocPtr docp;
-
- xmlXPathObjectPtr xpathobjp;
- xmlNode *contextnodep;
- int name_len;
- int free_context = 0;
- char *str,*name;
-
- contextnode = NULL;
- contextnodep = NULL;
-
- DOMXML_PARAM_FOUR(docp, id, le_domxmldocp, "s|oo", &name, &name_len,&ctxpin,&contextnodep);
-
- /* if no xpath_context was submitted, create a new one */
- if (ctxpin == NULL) {
- ctxp = xmlXPathNewContext(docp);
- free_context = 1;
- } else {
- DOMXML_GET_OBJ(ctxp, ctxpin, le_xpathctxp);
- }
-
- if (contextnode) {
- DOMXML_GET_OBJ(contextnodep, contextnode, le_domxmlnodep);
- }
- ctxp->node = contextnodep;
- str = (char*) emalloc((name_len+3) * sizeof(char)) ;
- sprintf(str ,"//%s",name);
-
- xpathobjp = xmlXPathEval(str, ctxp);
- efree(str);
- ctxp->node = NULL;
- if (!xpathobjp) {
- RETURN_FALSE;
- }
- MAKE_STD_ZVAL(rv);
-
- array_init(rv);
-
- switch (Z_TYPE_P(xpathobjp)) {
-
- case XPATH_NODESET:
- {
- int i;
- xmlNodeSetPtr nodesetp;
-
- if (NULL == (nodesetp = xpathobjp->nodesetval)) {
- zval_dtor(rv);
- xmlXPathFreeObject (xpathobjp);
- if (free_context) {
- xmlXPathFreeContext(ctxp);
- }
- RETURN_FALSE;
- }
-
- for (i = 0; i < nodesetp->nodeNr; i++) {
- xmlNodePtr node = nodesetp->nodeTab[i];
- zval *child;
- int retnode;
-
- /* construct a node object */
- child = php_domobject_new(node, &retnode, NULL TSRMLS_CC);
- zend_hash_next_index_insert(Z_ARRVAL_P(rv), &child, sizeof(zval *), NULL);
- }
-
- break;
- }
- default:
- break;
- }
-
- xmlXPathFreeObject(xpathobjp);
- if (free_context) {
- xmlXPathFreeContext(ctxp);
- }
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-#endif
-
-typedef struct _idsIterator idsIterator;
-struct _idsIterator {
- xmlChar *elementId;
- xmlNode *element;
-};
-
-static void idsHashScanner(void *payload, void *data, xmlChar *name)
-{
- idsIterator *priv = (idsIterator *) data;
-
- if (priv->element == NULL && xmlStrEqual (name, priv->elementId)) {
- priv->element = ((xmlNode *)((xmlID *)payload)->attr)->parent;
- }
-}
-
-/* {{{ proto string domxml_doc_get_element_by_id(string id)
- Returns element for given id or false if not found */
-PHP_FUNCTION(domxml_doc_get_element_by_id)
-{
- zval *id, *rv = NULL;
- xmlDocPtr docp;
- idsIterator iter;
- xmlHashTable *ids = NULL;
- int retnode,idname_len;
- char *idname;
-
- DOMXML_PARAM_TWO(docp, id, le_domxmldocp, "s", &idname, &idname_len);
-
- ids = (xmlHashTable *) docp->ids;
- if (ids) {
- iter.elementId = (xmlChar *) idname;
- iter.element = NULL;
- xmlHashScan(ids, (void *)idsHashScanner, &iter);
- rv = php_domobject_new(iter.element, &retnode, NULL TSRMLS_CC);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string domxml_elem_get_elements_by_tagname(string tagname)
- Returns array with nodes with given tagname in element or empty array, if not found */
-PHP_FUNCTION(domxml_elem_get_elements_by_tagname)
-{
- zval *id,*rv;
- xmlNode *nodep;
- int name_len,i;
- char *name;
- xmlNodeSet *nodesetp = NULL;
-
- DOMXML_PARAM_TWO(nodep, id, le_domxmlelementp, "s", &name, &name_len);
-
- MAKE_STD_ZVAL(rv);
-
- array_init(rv);
-
- nodesetp = php_get_elements_by_tagname(nodep, name, NULL);
-
- if (nodesetp) {
- for (i = 0; i < nodesetp->nodeNr; i++) {
- xmlNodePtr node = nodesetp->nodeTab[i];
- zval *child;
- int retnode;
-
- child = php_domobject_new(node, &retnode, NULL TSRMLS_CC);
- zend_hash_next_index_insert(Z_ARRVAL_P(rv), &child, sizeof(zval *), NULL);
- }
- }
- xmlXPathFreeNodeSet(nodesetp);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
-}
-/* }}} */
-
-/* End of Methods DomElement }}} */
-
-
-/* {{{ Methods of Class DomDocumentType */
-
-/* {{{ proto array domxml_doctype_name(void)
- Returns name of DocumentType */
-PHP_FUNCTION(domxml_doctype_name)
-{
- zval *id;
- xmlDtdPtr attrp;
-
- DOMXML_NO_ARGS();
-
- DOMXML_GET_THIS_OBJ(attrp, id, le_domxmldoctypep);
-
- RETURN_STRING((char *) (attrp->name), 1);
-}
-/* }}} */
-
-/* {{{ proto array domxml_doctype_system_id(void)
- Returns system id of DocumentType */
-PHP_FUNCTION(domxml_doctype_system_id)
-{
- zval *id;
- xmlDtdPtr attrp;
-
- DOMXML_NO_ARGS();
-
- DOMXML_GET_THIS_OBJ(attrp, id, le_domxmldoctypep);
-
- if (attrp->SystemID) {
- RETURN_STRING((char *) (attrp->SystemID), 1);
- } else {
- RETURN_EMPTY_STRING();
- }
-}
-/* }}} */
-
-/* {{{ proto array domxml_doctype_public_id(void)
- Returns public id of DocumentType */
-PHP_FUNCTION(domxml_doctype_public_id)
-{
- zval *id;
- xmlDtdPtr attrp;
-
- DOMXML_NO_ARGS();
-
- DOMXML_GET_THIS_OBJ(attrp, id, le_domxmldoctypep);
-
- if (attrp->ExternalID) {
- RETURN_STRING((char *) (attrp->ExternalID), 1);
- } else {
- RETURN_EMPTY_STRING();
- }
-}
-/* }}} */
-
-/* {{{ proto array domxml_doctype_entities(void)
- Returns list of entities */
-PHP_FUNCTION(domxml_doctype_entities)
-{
- zval *id;
- xmlNode *last;
- xmlDtdPtr doctypep;
- int ret;
-
- DOMXML_NOT_IMPLEMENTED();
-
- DOMXML_PARAM_NONE(doctypep, id, le_domxmldoctypep);
-
- last = doctypep->entities;
- if (!last) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- while (last) {
- zval *child;
- child = php_domobject_new(last, &ret, NULL TSRMLS_CC);
- add_next_index_zval(return_value, child);
- last = last->next;
- }
-}
-/* }}} */
-
-/* {{{ proto array domxml_doctype_notations(void)
- Returns list of notations */
-PHP_FUNCTION(domxml_doctype_notations)
-{
- zval *id;
- xmlNode *last;
- xmlDtdPtr doctypep;
- int ret;
-
- DOMXML_NOT_IMPLEMENTED();
-
- DOMXML_PARAM_NONE(doctypep, id, le_domxmldoctypep);
-
- last = doctypep->notations;
- if (!last) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- while (last) {
- zval *child;
- child = php_domobject_new(last, &ret, NULL TSRMLS_CC);
- add_next_index_zval(return_value, child);
- last = last->next;
- }
-}
-/* }}} */
-
-/* End of Methods DomElementType }}} */
-
-
-/* {{{ Methods of Class DomDocument */
-
-/* {{{ proto object domxml_doc_doctype(void)
- Returns DomDocumentType */
-PHP_FUNCTION(domxml_doc_doctype)
-{
- zval *id, *rv = NULL;
- xmlDtdPtr dtd;
- xmlDocPtr docp;
- int ret;
-
- DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp);
-
- DOMXML_NO_ARGS();
-
- dtd = xmlGetIntSubset(docp);
- if (!dtd) {
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, (xmlNodePtr) dtd, &ret);
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_implementation(void)
- Returns DomeDOMImplementation */
-PHP_FUNCTION(domxml_doc_implementation)
-{
-/* zval *id;
- xmlDocPtr docp;*/
-
- DOMXML_NOT_IMPLEMENTED();
-
-/*
- DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp);
-
- rv = php_domobject_new(node, &ret TSRMLS_CC);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
-*/
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_document_element(int domnode)
- Returns root node of document */
-PHP_FUNCTION(domxml_doc_document_element)
-{
- zval *id, *rv = NULL;
- xmlDoc *docp;
- xmlNode *root;
- int ret;
-
- DOMXML_PARAM_NONE(docp, id, le_domxmldocp);
-
- root = xmlDocGetRootElement(docp);
- if (!root) {
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, root, &ret);
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_create_element(string name)
- Creates new element node */
-PHP_FUNCTION(domxml_doc_create_element)
-{
- zval *id, *rv = NULL;
- xmlNode *node;
- xmlDocPtr docp = NULL;
- int ret, name_len;
- char *name;
-
- if (!DOMXML_IS_TYPE(getThis(), domxmlelement_class_entry)) {
- DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp);
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
- return;
- }
-
- node = xmlNewNode(NULL, name);
- if (!node) {
- RETURN_FALSE;
- }
- node->doc = docp;
-
- if (DOMXML_IS_TYPE(getThis(), domxmlelement_class_entry)) {
- DOMXML_DOMOBJ_NEW(getThis(), node, &ret);
- } else {
- DOMXML_RET_OBJ(rv, node, &ret);
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_create_element_ns(string uri, string name [, string prefix])
- Creates new element node with a namespace */
-PHP_FUNCTION(domxml_doc_create_element_ns)
-{
- zval *id, *rv = NULL;
- xmlNode *node;
- xmlNs *nsptr;
- xmlDocPtr docp = NULL;
- int ret, name_len, uri_len, prefix_len=0;
- char *name, *uri, *prefix;
-
- DOMXML_PARAM_SIX(docp, id, le_domxmldocp, "ss|s", &uri, &uri_len, &name, &name_len, &prefix, &prefix_len);
-
- nsptr = xmlSearchNsByHref(docp, xmlDocGetRootElement(docp), (xmlChar*) uri);
- node = xmlNewNode(nsptr, name);
-
- if (!node) {
- RETURN_FALSE;
- }
- /* if no namespace with the same uri was found, we have to create a new one.
- * I do this here with "a" + a random number. this is not very sophisticated,
- * therefore if someone has a better idea in creating unique prefixes, here's your
- * chance (a0,a1, etc would be good enough, this is the way mozilla does it). I'm
- * to lazy right now to think of a better solution...
- */
- if (nsptr == NULL) {
- /* if there was a prefix provided, take that, otherwise generate a new one
- this is not w3c-like, since the have no option to provide a prefix, but
- i don't care :)
- */
- if (prefix_len == 0)
- {
- char prefixtmp[20];
- int random;
- random = (int) (10000.0*php_rand(TSRMLS_C)/(PHP_RAND_MAX));
- sprintf(prefixtmp, "a%d", random);
- prefix = prefixtmp;
- }
- nsptr = xmlNewNs(node, uri, prefix);
- xmlSetNs(node, nsptr);
- }
-
- node->doc = docp;
-
- if (DOMXML_IS_TYPE(getThis(), domxmlelement_class_entry)) {
- DOMXML_DOMOBJ_NEW(getThis(), node, &ret);
- } else {
- DOMXML_RET_OBJ(rv, node, &ret);
- }
-}
-/* }}} */
-
-/* {{{ proto bool domxml_node_add_namespace(string uri, string prefix)
- Adds a namespace declaration to a node */
-PHP_FUNCTION(domxml_node_add_namespace)
-{
- zval *id;
- xmlNode *nodep;
- xmlNs *nsptr;
- int prefix_len, uri_len;
- char *prefix, *uri;
-
- DOMXML_PARAM_FOUR(nodep, id, le_domxmldocp, "ss", &uri, &uri_len, &prefix, &prefix_len);
-
- if (NULL == (nsptr = xmlNewNs(nodep,uri,prefix))) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-
-}
-/* }}} */
-
-/* {{{ proto void domxml_node_set_namespace(string uri [, string prefix])
- Sets the namespace of a node */
-PHP_FUNCTION(domxml_node_set_namespace)
-{
- zval *id;
- xmlNode *nodep;
- xmlNs *nsptr;
- int prefix_len = 0, uri_len;
- char *prefix, *uri;
-
- DOMXML_PARAM_FOUR(nodep, id, le_domxmldocp, "s|s", &uri, &uri_len, &prefix, &prefix_len);
-
- /* if node is in a document, search for an already existing namespace */
- if (nodep->doc != NULL) {
- if (nodep->type == XML_ATTRIBUTE_NODE) {
- nsptr = xmlSearchNsByHref(nodep->doc, nodep->parent, (xmlChar*) uri);
- } else {
- nsptr = xmlSearchNsByHref(nodep->doc, nodep, (xmlChar*) uri);
- }
- } else {
- nsptr = NULL;
- }
-
- /* if no namespace decleration was found in the parents of the node, generate one */
- if (nsptr == NULL) {
- /* if there was a prefix provided, take that, otherwise generate a new one */
- if (prefix_len == 0) {
- char prefixtmp[20];
- int random;
- random = (int) (10000.0*php_rand(TSRMLS_C)/(PHP_RAND_MAX));
- sprintf(prefixtmp, "a%d", random);
- prefix = prefixtmp;
- }
- if (nodep->type == XML_ATTRIBUTE_NODE) {
- nsptr = xmlNewNs(nodep->parent, uri, prefix);
- } else {
- nsptr = xmlNewNs(nodep, uri, prefix);
- }
- }
-
- xmlSetNs(nodep, nsptr);
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_create_text_node(string content)
- Creates new text node */
-PHP_FUNCTION(domxml_doc_create_text_node)
-{
- zval *id, *rv = NULL;
- xmlNode *node;
- xmlDocPtr docp = NULL;
- int ret, content_len;
- char *content;
-
- if (!DOMXML_IS_TYPE(getThis(), domxmltext_class_entry)) {
- DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp);
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &content, &content_len) == FAILURE) {
- return;
- }
-
- node = xmlNewTextLen(content, content_len);
- if (!node) {
- RETURN_FALSE;
- }
- node->doc = docp;
-
- if (DOMXML_IS_TYPE(getThis(), domxmltext_class_entry)) {
- DOMXML_DOMOBJ_NEW(getThis(), node, &ret);
- } else {
- DOMXML_RET_OBJ(rv, node, &ret);
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_create_comment(string content)
- Creates new comment node */
-PHP_FUNCTION(domxml_doc_create_comment)
-{
- zval *id, *rv = NULL;
- xmlNode *node;
- xmlDocPtr docp = NULL;
- int ret, content_len;
- char *content;
-
- if (!DOMXML_IS_TYPE(getThis(), domxmlcomment_class_entry)) {
- DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp);
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &content, &content_len) == FAILURE) {
- return;
- }
-
- node = xmlNewComment(content);
- if (!node) {
- RETURN_FALSE;
- }
- node->doc = docp;
-
- if (DOMXML_IS_TYPE(getThis(), domxmlcomment_class_entry)) {
- DOMXML_DOMOBJ_NEW(getThis(), node, &ret);
- } else {
- DOMXML_RET_OBJ(rv, node, &ret);
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_create_attribute(string name, string value)
- Creates new attribute node */
-PHP_FUNCTION(domxml_doc_create_attribute)
-{
- zval *id, *rv = NULL;
- xmlAttrPtr node;
- xmlDocPtr docp = NULL;
- int ret, name_len, value_len;
- char *name, *value;
-
- if (!DOMXML_IS_TYPE(getThis(), domxmlattr_class_entry)) {
- DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp);
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &value, &value_len) == FAILURE) {
- return;
- }
-
- node = xmlNewProp(NULL, name, value);
- if (!node) {
- RETURN_FALSE;
- }
- node->doc = docp;
-
- if (DOMXML_IS_TYPE(getThis(), domxmlattr_class_entry)) {
- DOMXML_DOMOBJ_NEW(getThis(), (xmlNodePtr) node, &ret);
- } else {
- DOMXML_RET_OBJ(rv, (xmlNodePtr) node, &ret);
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_create_cdata_section(string content)
- Creates new cdata node */
-PHP_FUNCTION(domxml_doc_create_cdata_section)
-{
- zval *id, *rv = NULL;
- xmlNode *node;
- xmlDocPtr docp = NULL;
- int ret, content_len;
- char *content;
-
- if (!DOMXML_IS_TYPE(getThis(), domxmlcdata_class_entry)) {
- DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp);
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &content, &content_len) == FAILURE) {
- return;
- }
-
- node = xmlNewCDataBlock(docp, content, content_len);
- if (!node) {
- RETURN_FALSE;
- }
- node->doc = docp;
-
- if (DOMXML_IS_TYPE(getThis(), domxmlcdata_class_entry)) {
- DOMXML_DOMOBJ_NEW(getThis(), node, &ret);
- } else {
- DOMXML_RET_OBJ(rv, node, &ret);
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_create_entity_reference(string name)
- Creates new cdata node */
-PHP_FUNCTION(domxml_doc_create_entity_reference)
-{
- zval *id, *rv = NULL;
- xmlNode *node;
- xmlDocPtr docp = NULL;
- int ret, name_len;
- char *name;
-
- if (!DOMXML_IS_TYPE(getThis(), domxmlentityref_class_entry)) {
- DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp);
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
- return;
- }
- node = xmlNewReference(docp, name);
- if (!node) {
- RETURN_FALSE;
- }
- node->doc = docp;
-
- if (DOMXML_IS_TYPE(getThis(), domxmlentityref_class_entry)) {
- DOMXML_DOMOBJ_NEW(getThis(), node, &ret);
- } else {
- DOMXML_RET_OBJ(rv, node, &ret);
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_create_processing_instruction(string name)
- Creates new processing_instruction node */
-PHP_FUNCTION(domxml_doc_create_processing_instruction)
-{
- zval *id, *rv = NULL;
- xmlNode *node;
- xmlDocPtr docp = NULL;
- int ret, name_len, content_len;
- char *name, *content;
-
- if (!DOMXML_IS_TYPE(getThis(), domxmlpi_class_entry)) {
- DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp);
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
-
- node = xmlNewPI(name, content);
- if (!node) {
- RETURN_FALSE;
- }
- node->doc = docp;
-
- if (DOMXML_IS_TYPE(getThis(), domxmlpi_class_entry)) {
- DOMXML_DOMOBJ_NEW(getThis(), node, &ret);
- } else {
- DOMXML_RET_OBJ(rv, node, &ret);
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_create_document_fragement()
- Creates new document fragement node */
-PHP_FUNCTION(domxml_doc_create_document_fragment)
-{
- zval *id, *rv = NULL;
- xmlNode *node;
- xmlDocPtr docp = NULL;
- int ret;
-
- DOMXML_PARAM_NONE(docp, id, le_domxmldocumentfragmentp);
-
-
- node = xmlNewDocFragment (docp);
- if (!node) {
- RETURN_FALSE;
- }
- DOMXML_RET_OBJ(rv, node, &ret);
-}
-/* }}} */
-
-/* {{{ proto bool domxml_document_framgent_open_mem(string buf)
- Parses a string with a well-balanced XML-Fragment and appends it to the document-fragment */
-PHP_FUNCTION(domxml_document_fragment_open_mem)
-{
- zval *id;
- xmlNodePtr dfp = NULL, last = NULL;
- char *buf;
- int ret, buf_len;
- xmlNodePtr lst;
-
- DOMXML_PARAM_TWO(dfp, id, le_domxmldocumentfragmentp,"s",&buf, &buf_len);
-
- ret = xmlParseBalancedChunkMemory(dfp->doc, NULL, NULL, 0, (xmlChar *) buf, &lst);
- if (ret != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input string is not balanced (well-formed)");
- RETURN_FALSE;
- }
-
- last = xmlAddChildList(dfp, lst);
-
- if (last == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not add child list");
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-/* {{{ proto object domxml_doc_imported_node(object node, bool recursive)
- Creates new element node */
-PHP_FUNCTION(domxml_doc_imported_node)
-{
- zval *arg1, *id, *rv = NULL;
- xmlNodePtr node, srcnode;
- xmlDocPtr docp;
- int ret;
- long recursive = 0;
-
- DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp);
-
- /* FIXME: which object type to expect? */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|l", &arg1, &recursive) == FAILURE) {
- return;
- }
-
- DOMXML_GET_OBJ(srcnode, arg1, le_domxmlnodep);
-
- /* node = xmlCopyNode(srcnode, recursive); */
- node = xmlDocCopyNode(srcnode, docp, recursive);
- if (!node) {
- RETURN_FALSE;
- }
- /* No longer need handled by xmlDocCopyNode
- node->doc = docp;
- */
-
- DOMXML_RET_OBJ(rv, node, &ret);
-}
-/* }}} */
-
-/* {{{ proto object domxml_dtd(void)
- Returns DTD of document */
-PHP_FUNCTION(domxml_intdtd)
-{
- zval *id, *rv = NULL;
- xmlDoc *docp;
- xmlDtd *dtd;
- int ret;
-
- DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp);
-
- dtd = xmlGetIntSubset(docp);
- if (!dtd) {
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, (xmlNodePtr) dtd, &ret);
-}
-/* }}} */
-
-/* {{{ proto string domxml_dump_mem(object doc_handle [, int format][, encoding])
- Dumps document into string and optionally formats it */
-PHP_FUNCTION(domxml_dump_mem)
-{
- zval *id;
- xmlDoc *docp;
- xmlChar *mem;
- int format = 0;
- int size, keepblanks;
- int encoding_len = 0;
- char *encoding;
-
-
- DOMXML_PARAM_THREE(docp, id, le_domxmldocp, "|ls", &format, &encoding, &encoding_len);
- if (format) {
- keepblanks = xmlKeepBlanksDefault(0);
- if (encoding_len) {
- xmlDocDumpFormatMemoryEnc(docp, &mem, &size, encoding, format);
- } else {
- xmlDocDumpFormatMemory(docp, &mem, &size, format);
- }
- xmlKeepBlanksDefault(keepblanks);
- } else {
- if (encoding_len) {
- xmlDocDumpMemoryEnc(docp, &mem, &size, encoding);
- } else {
- xmlDocDumpMemory(docp, &mem, &size);
- }
- }
-
- if (!size) {
- RETURN_FALSE;
- }
- RETVAL_STRINGL(mem, size, 1);
- xmlFree(mem);
-}
-/* }}} */
-
-/* {{{ proto int domxml_dump_mem_file(string filename [, int compressmode [, int format]])
- Dumps document into file and uses compression if specified. Returns false on error, otherwise the length of the xml-document (uncompressed) */
-PHP_FUNCTION(domxml_dump_mem_file)
-{
- zval *id;
- xmlDoc *docp;
- int file_len, bytes, keepblanks;
- int format = 0;
- int compressmode = 0;
- char *file;
-
- DOMXML_PARAM_FOUR(docp, id, le_domxmldocp, "s|ll", &file, &file_len, &compressmode, &format);
-
- if ((PG(safe_mode) && (!php_checkuid(file, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(file TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- xmlSetCompressMode(compressmode);
-
- if (format) {
- keepblanks = xmlKeepBlanksDefault(0);
- bytes = xmlSaveFormatFile(file, docp, format);
- xmlKeepBlanksDefault(keepblanks);
- } else {
- bytes = xmlSaveFile(file, docp);
- }
-
- if (bytes == -1) {
- RETURN_FALSE;
- }
- RETURN_LONG(bytes);
-}
-/* }}} */
-
-/* {{{ proto string domxml_dump_node(object doc_handle, object node_handle [, int format [, int level]])
- Dumps node into string */
-PHP_FUNCTION(domxml_dump_node)
-{
- zval *id, *nodep;
- xmlDocPtr docp;
- xmlNodePtr elementp;
- xmlChar *mem ;
- xmlBufferPtr buf;
- int level = 0;
- int format = 0;
-
- DOMXML_PARAM_THREE(docp, id, le_domxmldocp, "o|ll", &nodep, &format, &level);
-
- DOMXML_GET_OBJ(elementp, nodep, le_domxmlnodep);
-
- if (Z_TYPE_P(elementp) == XML_DOCUMENT_NODE || Z_TYPE_P(elementp) == XML_HTML_DOCUMENT_NODE ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot dump element with a document node");
- RETURN_FALSE;
- }
-
- if (docp->type != XML_DOCUMENT_NODE && docp->type != XML_HTML_DOCUMENT_NODE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Object has to be a DomDocument Node");
- RETURN_FALSE;
- }
-
- buf = xmlBufferCreate();
- if (!buf) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not fetch buffer");
- RETURN_FALSE;
- }
-
- xmlNodeDump(buf, docp, elementp, level, format);
-
- mem = (xmlChar*) xmlBufferContent(buf);
-
- if (!mem) {
- xmlBufferFree(buf);
- RETURN_FALSE;
- }
- RETVAL_STRING(mem, 1);
-
- xmlBufferFree(buf);
-
-}
-/* }}} */
-
-/* {{{ idsHashScanner2(void *payload, void *data, xmlChar *name)
- */
-static void idsHashScanner2(void *payload, void *data, xmlChar *name)
-{
- zval *return_value = (zval *) data;
- zval *child;
- int ret;
- xmlNode *nodep;
-
- TSRMLS_FETCH();
-
- nodep = ((xmlNode *)((xmlID *)payload)->attr)->parent;
- child = php_domobject_new(nodep, &ret, NULL TSRMLS_CC);
- add_next_index_zval(return_value, child);
-}
-/* }}} */
-
-/* {{{ proto string domxml_doc_ids(object doc_handle)
- Returns array of ids */
-PHP_FUNCTION(domxml_doc_ids)
-{
- zval *id;
- xmlDoc *docp;
- xmlHashTable *ids = NULL;
-
- DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp);
-
- ids = docp->ids;
-
- if (ids) {
- array_init(return_value);
- xmlHashScan(ids, (void *)idsHashScanner2, return_value);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto object xmldoc(string xmldoc[, int mode[, array error]])
- Creates DOM object of XML document */
-PHP_FUNCTION(xmldoc)
-{
- zval *rv = NULL;
- xmlDoc *docp = NULL;
- int ret;
- char *buffer;
- int buffer_len;
- long mode = 0;
- int prevSubstValue;
- int oldvalue = xmlDoValidityCheckingDefaultValue;
- int oldvalue_keepblanks;
- int prevLoadExtDtdValue = xmlLoadExtDtdDefaultValue;
- zval *errors ;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz", &buffer, &buffer_len, &mode, &errors) == FAILURE) {
- return;
- }
-/* Either of the following line force validation */
-/* xmlLoadExtDtdDefaultValue = XML_DETECT_IDS; */
-/* xmlDoValidityCheckingDefaultValue = 1; */
- if (ZEND_NUM_ARGS() == 3 ) {
- zval_dtor(errors);
- array_init(errors);
- }
-
- if (mode & DOMXML_LOAD_DONT_KEEP_BLANKS) {
- oldvalue_keepblanks = xmlKeepBlanksDefault(0);
- } else {
- oldvalue_keepblanks = xmlKeepBlanksDefault(1);
- }
-
- if (mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES) {
- prevSubstValue = xmlSubstituteEntitiesDefault (1);
- } else {
- prevSubstValue = xmlSubstituteEntitiesDefault (0);
- }
-
- if (mode & DOMXML_LOAD_COMPLETE_ATTRS) {
- xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS;
- }
-
- switch (mode & (DOMXML_LOAD_PARSING | DOMXML_LOAD_VALIDATING | DOMXML_LOAD_RECOVERING)) {
- case DOMXML_LOAD_PARSING:
- xmlDoValidityCheckingDefaultValue = 0;
- if (ZEND_NUM_ARGS() == 3) {
- docp = php_dom_xmlSAXParse( NULL, (char *) buffer, buffer_len, 0 , errors);
- } else {
- docp = xmlParseDoc(buffer);
- }
- break;
- case DOMXML_LOAD_VALIDATING:
- xmlDoValidityCheckingDefaultValue = 1;
- if (ZEND_NUM_ARGS() == 3) {
- docp = php_dom_xmlSAXParse(NULL, (char *) buffer, buffer_len, 0, errors);
- } else {
- docp = xmlParseDoc(buffer);
- }
- break;
- case DOMXML_LOAD_RECOVERING:
- xmlDoValidityCheckingDefaultValue = 0;
- if (ZEND_NUM_ARGS() == 3) {
- docp = php_dom_xmlSAXParse(NULL, (char *) buffer, buffer_len, 1, errors);
- } else {
- docp = xmlRecoverDoc(buffer);
- }
- break;
- }
- xmlSubstituteEntitiesDefault (prevSubstValue);
- xmlDoValidityCheckingDefaultValue = oldvalue;
- xmlLoadExtDtdDefaultValue = prevLoadExtDtdValue;
- xmlKeepBlanksDefault(oldvalue_keepblanks);
-
- if (!docp) {
- RETURN_FALSE;
- }
-
-/* dtd = xmlGetIntSubset(docp);
- if (dtd) {
- xmlParseDTD(dtd->ExternalID, dtd->SystemID);
- }
-*/
-
- if (DOMXML_IS_TYPE(getThis(), domxmldoc_class_entry)) {
- DOMXML_DOMOBJ_NEW(getThis(), (xmlNodePtr) docp, &ret);
- } else {
- DOMXML_RET_OBJ(rv, (xmlNodePtr) docp, &ret);
- }
-}
-/* }}} */
-
-/* {{{ proto object xmldocfile(string filename[, int mode[, array error])
- Creates DOM object of XML document in file */
-PHP_FUNCTION(xmldocfile)
-{
- zval *rv = NULL;
- xmlDoc *docp = NULL;
- int ret, file_len;
- char *file;
- long mode = 0;
- int prevSubstValue;
- int oldvalue = xmlDoValidityCheckingDefaultValue;
- int oldvalue_keepblanks;
- zval *errors = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz", &file, &file_len, &mode, &errors) == FAILURE) {
- return;
- }
-
- if (ZEND_NUM_ARGS() == 3 ) {
- zval_dtor(errors);
- array_init(errors);
- }
-
- if (mode & DOMXML_LOAD_DONT_KEEP_BLANKS) {
- oldvalue_keepblanks = xmlKeepBlanksDefault(0);
- } else {
- oldvalue_keepblanks = xmlKeepBlanksDefault(1);
- }
-
- if (mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES) {
- prevSubstValue = xmlSubstituteEntitiesDefault (1);
- } else {
- prevSubstValue = xmlSubstituteEntitiesDefault (0);
- }
-
- if (mode & DOMXML_LOAD_COMPLETE_ATTRS) {
- xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS;
- }
-
- switch (mode & (DOMXML_LOAD_PARSING | DOMXML_LOAD_VALIDATING | DOMXML_LOAD_RECOVERING)) {
- case DOMXML_LOAD_PARSING:
- xmlDoValidityCheckingDefaultValue = 0;
- if (ZEND_NUM_ARGS() == 3) {
- docp = php_dom_xmlSAXParse( NULL, (char *) file, -1 , 0 , errors);
- } else {
- docp = xmlParseFile(file);
- }
- break;
- case DOMXML_LOAD_VALIDATING:
- xmlDoValidityCheckingDefaultValue = 1;
- if (ZEND_NUM_ARGS() == 3) {
- docp = php_dom_xmlSAXParse(NULL, (char *) file, -1, 0, errors);
- } else {
- docp = xmlParseFile(file);
- }
- break;
- case DOMXML_LOAD_RECOVERING:
- xmlDoValidityCheckingDefaultValue = 0;
- if (ZEND_NUM_ARGS() == 3) {
- docp = php_dom_xmlSAXParse(NULL, (char*) file, -1, 1, errors);
- } else {
- docp = xmlRecoverFile(file);
- }
- break;
- }
- xmlSubstituteEntitiesDefault (prevSubstValue);
- xmlDoValidityCheckingDefaultValue = oldvalue;
- xmlKeepBlanksDefault(oldvalue_keepblanks);
-
- if (!docp) {
- RETURN_FALSE;
- }
-
-
- if (DOMXML_IS_TYPE(getThis(), domxmldoc_class_entry)) {
- DOMXML_DOMOBJ_NEW(getThis(), (xmlNodePtr) docp, &ret);
- } else {
- DOMXML_RET_OBJ(rv, (xmlNodePtr) docp, &ret);
- }
-
-}
-/* }}} */
-
-#if defined(LIBXML_HTML_ENABLED)
-/* {{{ proto string domxml_html_dump_mem([int doc_handle])
- Dumps document into string as HTML */
-PHP_FUNCTION(domxml_html_dump_mem)
-{
- zval *id;
- xmlDoc *docp;
- xmlChar *mem;
- int size;
-
- DOMXML_PARAM_NONE(docp, id, le_domxmldocp);
-
- htmlDocDumpMemory(docp, &mem, &size);
- if (!size) {
- if (mem) {
- xmlFree(mem);
- }
- RETURN_FALSE;
- }
- RETVAL_STRINGL(mem, size, 1);
- xmlFree(mem);
-}
-/* }}} */
-
-/* {{{ proto object html_doc(string html_doc [, bool from_file])
- Creates DOM object of HTML document */
-PHP_FUNCTION(html_doc)
-{
- zval *rv = NULL;
- xmlDoc *docp;
- int ret;
- char *buffer;
- int buffer_len;
- zend_bool from_file = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &buffer, &buffer_len, &from_file) == FAILURE) {
- return;
- }
-
- if (from_file) {
- docp = htmlParseFile(buffer, NULL);
- } else {
- docp = htmlParseDoc(buffer, NULL);
- }
- if (!docp) {
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, (xmlNodePtr) docp, &ret);
-}
-/* }}} */
-
-/* {{{ proto object html_doc_file(string filename)
- Creates DOM object of HTML document in file */
-PHP_FUNCTION(html_doc_file)
-{
- zval *rv = NULL;
- xmlDoc *docp;
- int ret, file_len;
- char *file;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) {
- return;
- }
-
- docp = htmlParseFile(file, NULL);
- if (!docp) {
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, (xmlNodePtr) docp, &ret);
-
- add_property_resource(return_value, "doc", ret);
- if (docp->name) {
- add_property_stringl(return_value, "name", (char *) docp->name, strlen(docp->name), 1);
- }
- if (docp->URL) {
- add_property_stringl(return_value, "url", (char *) docp->URL, strlen(docp->URL), 1);
- }
- if (docp->version) {
- add_property_stringl(return_value, "version", (char *) docp->version, strlen(docp->version), 1);
- }
-/* add_property_stringl(return_value, "version", (char *) docp->version, strlen(docp->version), 1);*/
- if (docp->encoding) {
- add_property_stringl(return_value, "encoding", (char *) docp->encoding, strlen(docp->encoding), 1);
- }
- add_property_long(return_value, "standalone", docp->standalone);
- add_property_long(return_value, "type", Z_TYPE_P(docp));
- add_property_long(return_value, "compression", docp->compression);
- add_property_long(return_value, "charset", docp->charset);
- zend_list_addref(ret);
-}
-/* }}} */
-#endif /* defined(LIBXML_HTML_ENABLED) */
-
-/* {{{ proto bool domxml_substitute_entities_default(bool enable)
- Set and return the previous value for default entity support */
-PHP_FUNCTION(domxml_substitute_entities_default)
-{
- zend_bool enable;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &enable) == FAILURE) {
- return;
- }
-
- RETURN_BOOL(xmlSubstituteEntitiesDefault(enable));
-}
-/* }}} */
-
-/* {{{ proto bool domxml_node_text_concat(string content)
- Add string tocontent of a node */
-PHP_FUNCTION(domxml_node_text_concat)
-{
- zval *id;
- xmlNode *nodep;
- char *content;
- int content_len;
-
- DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &content, &content_len) == FAILURE) {
- return;
- }
-
- if (content_len) {
- xmlTextConcat(nodep, content, content_len);
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto object domxml_add_root(string name)
- Adds root node to document */
-PHP_FUNCTION(domxml_doc_add_root)
-{
- zval *id, *rv = NULL;
- xmlDoc *docp;
- xmlNode *nodep, *root;
- int ret, name_len;
- char *name;
-
- DOMXML_PARAM_TWO(docp, id, le_domxmldocp, "s", &name, &name_len);
-
- nodep = xmlNewDocNode(docp, NULL, name, NULL);
- if (!nodep) {
- RETURN_FALSE;
- }
-
- if ((root = xmlDocSetRootElement(docp, nodep)) != NULL) {
- /* Root node already unlinked from xmlDocSetRootElement */
- if (dom_object_get_data(root) == NULL) {
- node_list_unlink(root->children);
- node_list_unlink((xmlNodePtr) root->properties);
- xmlFreeNode(root);
- }
- }
-
- DOMXML_RET_OBJ(rv, nodep, &ret);
-}
-/* }}} */
-
-/* {{{ proto bool domxml_set_root(int domnode)
- Sets root node of document */
-PHP_FUNCTION(domxml_doc_set_root)
-{
- zval *id, *rv, *node;
- xmlDoc *docp;
- xmlNode *root;
-
- DOMXML_PARAM_TWO(docp, id, le_domxmldocp, "o", &node, &rv);
- DOMXML_GET_OBJ(root, node, le_domxmlnodep);
-
- if (!root) {
- RETURN_FALSE;
- }
-
- xmlDocSetRootElement(docp, root);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool domxml_doc_validate(array &error)
- Validates a DomDocument according to his DTD*/
-PHP_FUNCTION(domxml_doc_validate)
-{
- zval *id;
- xmlValidCtxt cvp;
- xmlDoc *docp;
- domxml_ErrorCtxt errorCtxt;
- zval *errors ;
- int oldvalue = xmlDoValidityCheckingDefaultValue;
-
- DOMXML_PARAM_ONE(docp, id, le_domxmldocp,"|z",&errors);
- errorCtxt.valid = &cvp;
-
- if (ZEND_NUM_ARGS() == 1) {
- zval_dtor(errors);
- array_init(errors);
- errorCtxt.errors = errors;
- } else {
- errorCtxt.errors = NULL;
- }
-
- errorCtxt.parser = NULL;
- xmlDoValidityCheckingDefaultValue = 1;
- cvp.userData = (void *) &errorCtxt;
- cvp.error = (xmlValidityErrorFunc) domxml_error_validate;
- cvp.warning = (xmlValidityWarningFunc) domxml_error_validate;
- if (docp->intSubset == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "No DTD given in XML-Document");
- }
-
- if (xmlValidateDocument(&cvp, docp)) {
- RETVAL_TRUE;
- } else {
- RETVAL_FALSE;
- }
-
- xmlDoValidityCheckingDefaultValue = oldvalue;
-}
-/* }}} */
-
-/* {{{ proto object domxml_new_xmldoc(string version)
- Creates new xmldoc */
-PHP_FUNCTION(domxml_new_xmldoc)
-{
- zval *rv = NULL;
- xmlDoc *docp;
- int ret, buf_len;
- char *buf;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) {
- return;
- }
-
- docp = xmlNewDoc(buf);
- if (!docp) {
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, (xmlNodePtr) docp, &ret);
-}
-/* }}} */
-
-/* {{{ proto bool domxml_doc_free_doc()
- Frees xmldoc and removed objects from hash */
-PHP_FUNCTION(domxml_doc_free_doc)
-{
- zval *doc;
- xmlNode *docp;
-
- DOMXML_GET_THIS_OBJ(docp, doc, le_domxmldocp);
-
- if (! (docp->type == XML_DOCUMENT_NODE || docp->type == XML_HTML_DOCUMENT_NODE) ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "DomDocument is required");
- RETURN_FALSE;
- }
-
- node_list_wrapper_dtor(docp->children, 1 TSRMLS_CC);
- node_list_wrapper_dtor((xmlNodePtr) docp->properties, 1 TSRMLS_CC);
- /* Attribute Nodes ccontain accessible children
- attr_list_wrapper_dtor(docp->properties); */
- node_wrapper_free(docp TSRMLS_CC);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto object domxml_parser([string buf[,string filename]])
- Creates new xmlparser */
-PHP_FUNCTION(domxml_parser)
-{
- zval *rv;
- xmlParserCtxtPtr parserp;
- int ret, buf_len = 0;
- char *buf = "";
- char *filename = NULL;
- int filename_len = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ss", &buf, &buf_len, &filename, &filename_len) == FAILURE) {
- return;
- }
-
- parserp = xmlCreatePushParserCtxt(NULL, NULL, buf, buf_len, filename);
- if (!parserp) {
- RETURN_FALSE;
- }
-/* parserp->loadsubset = XML_DETECT_IDS; */
-
- rv = php_xmlparser_new(parserp, &ret TSRMLS_CC);
- DOMXML_RET_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto bool domxml_parser_start_document()
- starts a document*/
-PHP_FUNCTION(domxml_parser_start_document)
-{
- zval *id;
- xmlParserCtxtPtr parserp;
-
- DOMXML_PARAM_NONE(parserp, id, le_domxmlparserp);
- startDocument(parserp);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool domxml_parser_end_document()
- ends a document */
-PHP_FUNCTION(domxml_parser_end_document)
-{
- zval *id;
- xmlParserCtxtPtr parserp;
-
- DOMXML_PARAM_NONE(parserp, id, le_domxmlparserp);
- endDocument(parserp);
-
-}
-/* }}} */
-
-/* {{{ proto bool domxml_parser_start_element(string tagname, array attributes)
- Starts an element and adds attributes*/
-PHP_FUNCTION(domxml_parser_start_element)
-{
- zval *id,*params = NULL;
- xmlParserCtxtPtr parserp;
- char *tagname;
- int tagname_len;
- char **atts = NULL;
-
- DOMXML_PARAM_THREE(parserp, id, le_domxmlparserp,"s|a", &tagname, &tagname_len, &params);
- if (params != NULL) {
- atts = php_xmlparser_make_params(params TSRMLS_CC);
- }
- if (parserp->myDoc == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Document was not started");
- RETURN_FALSE;
- }
- startElement(parserp, (xmlChar *) tagname, (const xmlChar **) atts);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool domxml_parser_end_element(string tagname)
- Ends an element */
-PHP_FUNCTION(domxml_parser_end_element)
-{
- zval *id;
- xmlParserCtxtPtr parserp;
- char *tagname;
- int tagname_len;
-
- DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &tagname, &tagname_len);
-
- if (parserp->myDoc == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Document was not started");
- RETURN_FALSE;
- }
-
- endElement(parserp, (xmlChar *) tagname);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool domxml_parser_comment(string comment)
- Adds a comment */
-PHP_FUNCTION(domxml_parser_comment)
-{
- zval *id;
- xmlParserCtxtPtr parserp;
- char *commentstring;
- int commentstring_len;
-
- DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &commentstring, &commentstring_len);
-
- if (parserp->myDoc == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Document was not started");
- RETURN_FALSE;
- }
-
- comment(parserp, (xmlChar *) commentstring);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool domxml_parser_cdata_section(string chunk)
- adds a cdata block */
-PHP_FUNCTION(domxml_parser_cdata_section)
-{
- zval *id;
- xmlParserCtxtPtr parserp;
- char *chunk;
- int chunk_len;
-
- DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &chunk, &chunk_len);
-
- if (parserp->myDoc == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Document was not started");
- RETURN_FALSE;
- }
-
- cdataBlock(parserp, (xmlChar *) chunk, chunk_len);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool domxml_parser_characters(string characters)
- Adds characters */
-PHP_FUNCTION(domxml_parser_characters)
-{
- zval *id;
- xmlParserCtxtPtr parserp;
- char *charactersstring;
- int characters_len;
-
- DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &charactersstring, &characters_len);
-
- if (parserp->myDoc == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Document was not started");
- RETURN_FALSE;
- }
-
- characters(parserp, (xmlChar *) charactersstring, characters_len);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool domxml_parser_entity_reference(string reference)
- Adds entity reference */
-PHP_FUNCTION(domxml_parser_entity_reference)
-{
- zval *id;
- xmlParserCtxtPtr parserp;
- char *referencestring;
- int reference_len;
-
- DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &referencestring, &reference_len);
-
- if (parserp->myDoc == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Document was not started");
- RETURN_FALSE;
- }
-
- reference(parserp, (xmlChar *) referencestring);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool domxml_parser_processing_instruction(string target, string data)
- Adds processing instruction */
-PHP_FUNCTION(domxml_parser_processing_instruction)
-{
- zval *id;
- xmlParserCtxtPtr parserp;
- char *data,*target;
- int data_len, target_len;
-
- DOMXML_PARAM_FOUR(parserp, id, le_domxmlparserp,"ss", &target, &target_len, &data, &data_len);
-
- if (parserp->myDoc == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Document was not started");
- RETURN_FALSE;
- }
-
- processingInstruction(parserp, (xmlChar *) target, (xmlChar *) data);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool domxml_parser_namespace_decl(string href, string prefix)
- Adds namespace declaration */
-PHP_FUNCTION(domxml_parser_namespace_decl)
-{
- zval *id;
- xmlParserCtxtPtr parserp;
- char *href,*prefix;
- int href_len, prefix_len;
-
- DOMXML_PARAM_FOUR(parserp, id, le_domxmlparserp,"ss", &href, &href_len, &prefix, &prefix_len);
-
- if (parserp->myDoc == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Document was not started");
- RETURN_FALSE;
- }
-
- namespaceDecl(parserp, (xmlChar *) href, (xmlChar *) prefix);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool domxml_parser_add_chunk(string chunk)
- adds xml-chunk to parser */
-PHP_FUNCTION(domxml_parser_add_chunk)
-{
- zval *id;
- xmlParserCtxtPtr parserp;
- char *chunk;
- int chunk_len, error;
-
- DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &chunk, &chunk_len);
- error = xmlParseChunk(parserp, chunk, chunk_len , 0);
- if (error != 0) {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto object domxml_parser_end([string chunk])
- Ends parsing and returns DomDocument*/
-PHP_FUNCTION(domxml_parser_end)
-{
- zval *id,*rv = NULL;
- xmlParserCtxtPtr parserp;
- char *chunk = NULL;
- int chunk_len = 0, error;
- int ret;
-
-
- DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"|s", &chunk, &chunk_len);
- error = xmlParseChunk(parserp, chunk, chunk_len, 1);
- if (error != 0) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error: %d", error);
- RETURN_FALSE;
- }
- if (parserp->myDoc != NULL) {
- DOMXML_RET_OBJ(rv, (xmlNodePtr) parserp->myDoc, &ret);
- } else {
- RETVAL_FALSE
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_parser_get_document()
- Returns DomDocument from parser */
-PHP_FUNCTION(domxml_parser_get_document)
-{
- zval *id,*rv = NULL;
- xmlParserCtxtPtr parserp;
- int ret;
-
- DOMXML_PARAM_NONE(parserp, id, le_domxmlparserp);
-
- if (parserp->myDoc != NULL) {
- DOMXML_RET_OBJ(rv, (xmlNodePtr) parserp->myDoc, &ret);
- } else {
- RETVAL_FALSE
- }
-}
-/* }}} */
-
-/* {{{ proto bool domxml_parser_set_keep_blanks(bool mode)
- Determines how to handle blanks */
-PHP_FUNCTION(domxml_parser_set_keep_blanks)
-{
- zval *id;
- xmlParserCtxtPtr parserp;
- zend_bool mode;
-
- DOMXML_PARAM_ONE(parserp, id, le_domxmlparserp, "b", &mode);
- parserp->keepBlanks = mode;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#ifdef newcode
-/* {{{ proto int node_namespace([int node])
- Returns list of namespaces */
-static int node_namespace(zval **attributes, xmlNode *nodep TSRMLS_DC)
-{
- xmlNs *ns;
-
- /* Get the children of the current node */
- ns = nodep->ns;
- if (!ns) {
- return -1;
- }
-
- /* create an php array for the children */
- MAKE_STD_ZVAL(*attributes);
- array_init(*attributes);
-
- while (ns) {
- zval *pattr;
- int ret;
-
- pattr = php_domobject_new((xmlNodePtr) ns, &ret, NULL TSRMLS_CC);
- SEPARATE_ZVAL(&pattr);
-
-/* if (!ret) { */
- if (ns->href) {
- add_property_stringl(pattr, "href", (char *) ns->href, strlen(ns->href), 1);
- }
- if (ns->prefix) {
- add_property_stringl(pattr, "prefix", (char *) ns->prefix, strlen(ns->prefix), 1);
- }
- add_property_long(pattr, "type", Z_TYPE_P(ns));
-/* } */
-
- zend_hash_next_index_insert(Z_ARRVAL_PP(attributes), &pattr, sizeof(zval *), NULL);
- ns = ns->next;
- }
- return 0;
-}
-/* }}} */
-#endif
-
-/* We don't have a type zval. **attributes is also very unusual. */
-
-/* {{{ proto int node_attributes(zval **attributes, int node)
- Returns list of children nodes */
-static int node_attributes(zval **attributes, xmlNode *nodep TSRMLS_DC)
-{
- xmlAttr *attr;
- int count = 0;
-
- /* Get the children of the current node */
- if (Z_TYPE_P(nodep) != XML_ELEMENT_NODE) {
- return -1;
- }
- attr = nodep->properties;
- if (!attr) {
- return -2;
- }
-
- /* create an php array for the children */
- MAKE_STD_ZVAL(*attributes);
- array_init(*attributes);
-
- while (attr) {
- zval *pattr;
- int ret;
- xmlChar *content;
-
- pattr = php_domobject_new((xmlNodePtr) attr, &ret, NULL TSRMLS_CC);
- /** XXX FIXME XXX */
-/* if (0 <= (n = node_children(&children, attr->children TSRMLS_CC))) {
- zend_hash_update(Z_OBJPROP_P(value), "children", sizeof("children"), (void *) &children, sizeof(zval *), NULL);
- }
-*/ add_property_string(pattr, "name", (char *) (attr->name), 1);
- content = xmlNodeGetContent((xmlNodePtr) attr);
- add_property_string(pattr, "value", content, 1);
- xmlFree(content);
- zend_hash_next_index_insert(Z_ARRVAL_PP(attributes), &pattr, sizeof(zval *), NULL);
- attr = attr->next;
- count++;
- }
- return count;
-}
-/* }}} */
-
-/* {{{ proto int node_children([int node])
- Returns list of children nodes */
-static int node_children(zval **children, xmlNode *nodep TSRMLS_DC)
-{
- zval *mchildren, *attributes;
- /* zval *namespace; */
- xmlNode *last;
- int count = 0;
-
- /* Get the children of the current node */
- last = nodep;
- if (!last) {
- return -1;
- }
-
- /* create an php array for the children */
- MAKE_STD_ZVAL(*children);
- array_init(*children);
-
- while (last) {
- zval *child;
- int ret;
-
- if (NULL != (child = php_domobject_new(last, &ret, NULL TSRMLS_CC))) {
- zend_hash_next_index_insert(Z_ARRVAL_PP(children), &child, sizeof(zval *), NULL);
-
- /* Get the namespace of the current node and add it as a property */
- /* XXX FIXME XXX */
-/*
- if (!node_namespace(&namespace, last)) {
- zend_hash_update(Z_OBJPROP_P(child), "namespace", sizeof("namespace"), (void *) &namespace, sizeof(zval *), NULL);
- }
-*/
-
- /* Get the attributes of the current node and add it as a property */
- if (node_attributes(&attributes, last TSRMLS_CC) >= 0) {
- zend_hash_update(Z_OBJPROP_P(child), "attributes", sizeof("attributes"), (void *) &attributes, sizeof(zval *), NULL);
- }
-
- /* Get recursively the children of the current node and add it as a property */
- if (node_children(&mchildren, last->children TSRMLS_CC) >= 0) {
- zend_hash_update(Z_OBJPROP_P(child), "children", sizeof("children"), (void *) &mchildren, sizeof(zval *), NULL);
- }
-
- count++;
- }
- last = last->next;
- }
- return count;
-}
-/* }}} */
-
-/* {{{ proto object domxml_xmltree(string xmltree)
- Creates a tree of PHP objects from an XML document */
-PHP_FUNCTION(domxml_xmltree)
-{
- zval *children, *rv = NULL;
- xmlDoc *docp;
- xmlNode *root;
- int ret, buf_len;
- char *buf;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) {
- return;
- }
-
- /* Create a new xml document */
- docp = xmlParseDoc(buf);
- if (!docp) {
- RETURN_FALSE;
- }
-
- /* get the root and add as a property to the document */
- root = docp->children;
- if (!root) {
- xmlFreeDoc(docp);
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, (xmlNodePtr) docp, &ret);
-
- /* The root itself maybe an array. Though you may not have two Elements
- as root, you may have a comment, pi and and element as root.
- Thanks to Paul DuBois for pointing me at this.
- */
- if (node_children(&children, root TSRMLS_CC) >= 0) {
- zend_hash_update(Z_OBJPROP_P(return_value), "children",sizeof("children"), (void *) &children, sizeof(zval *), NULL);
- }
-/* xmlFreeDoc(docp); */
-}
-/* }}} */
-
-#if defined(LIBXML_XPATH_ENABLED)
-/* {{{ proto bool xpath_init(void)
- Initializing XPath environment */
-PHP_FUNCTION(xpath_init)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- xmlXPathInit();
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ php_xpathptr_new_context()
- */
-static void php_xpathptr_new_context(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- zval *id, *rv;
- xmlXPathContextPtr ctx;
- xmlDocPtr docp;
- int ret;
-
- DOMXML_PARAM_NONE(docp, id, le_domxmldocp);
-
-#if defined(LIBXML_XPTR_ENABLED)
- if (mode == PHP_XPTR) {
- ctx = xmlXPtrNewContext(docp, NULL, NULL);
- } else
-#endif
- {
- ctx = xmlXPathNewContext(docp);
- }
-
- if (!ctx) {
- RETURN_FALSE;
- }
-
- rv = php_xpathcontext_new(ctx, &ret TSRMLS_CC);
- DOMXML_RET_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object xpath_new_context([int doc_handle])
- Creates new XPath context */
-PHP_FUNCTION(xpath_new_context)
-{
- php_xpathptr_new_context(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_XPATH);
-}
-/* }}} */
-
-/* {{{ proto object xptr_new_context([int doc_handle])
- Creates new XPath context */
-PHP_FUNCTION(xptr_new_context)
-{
- php_xpathptr_new_context(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_XPTR);
-}
-/* }}} */
-
-/* {{{ php_xpathptr_eval()
- */
-static void php_xpathptr_eval(INTERNAL_FUNCTION_PARAMETERS, int mode, int expr)
-{
- zval *id, *rv, *contextnode = NULL;
- xmlXPathContextPtr ctxp;
- xmlXPathObjectPtr xpathobjp;
- xmlNode *contextnodep;
- int ret, str_len;
- char *str;
- contextnode = NULL;
- contextnodep = NULL;
-
- if (NULL == (id = getThis())) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "os|o", &id, &str, &str_len, &contextnode) == FAILURE) {
- return;
- }
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|o", &str, &str_len, &contextnode) == FAILURE) {
- return;
- }
- }
-
- ctxp = php_xpath_get_context(id, le_xpathctxp, 0 TSRMLS_CC);
- if (!ctxp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot fetch XPATH context");
- RETURN_FALSE;
- }
-
- if (contextnode) {
- DOMXML_GET_OBJ(contextnodep, contextnode, le_domxmlnodep);
- }
- ctxp->node = contextnodep;
-
-#if defined(LIBXML_XPTR_ENABLED)
- if (mode == PHP_XPTR) {
- xpathobjp = xmlXPtrEval(BAD_CAST str, ctxp);
- } else {
-#endif
- if (expr) {
- xpathobjp = xmlXPathEvalExpression(str, ctxp);
- } else {
- xpathobjp = xmlXPathEval(str, ctxp);
- }
-#if defined(LIBXML_XPTR_ENABLED)
- }
-#endif
-
- ctxp->node = NULL;
- if (!xpathobjp) {
- RETURN_FALSE;
- }
-
- if (NULL == (rv = php_xpathobject_new(xpathobjp, &ret TSRMLS_CC))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required XPATH objcet");
- RETURN_FALSE;
- }
- SEPARATE_ZVAL(&rv);
-
- add_property_long(rv, "type", Z_TYPE_P(xpathobjp));
-
- switch (Z_TYPE_P(xpathobjp)) {
-
- case XPATH_UNDEFINED:
- break;
-
- case XPATH_NODESET: {
- int i;
- zval *arr;
- xmlNodeSetPtr nodesetp;
-
- MAKE_STD_ZVAL(arr);
- array_init(arr);
-
- if (NULL == (nodesetp = xpathobjp->nodesetval)) {
- zval_dtor(rv);
- RETURN_FALSE;
- }
-
- for (i = 0; i < nodesetp->nodeNr; i++) {
- xmlNodePtr node = nodesetp->nodeTab[i];
- zval *child;
- int retnode;
-
- /* construct a node object */
- child = php_domobject_new(node, &retnode, NULL TSRMLS_CC);
- zend_hash_next_index_insert(Z_ARRVAL_P(arr), &child, sizeof(zval *), NULL);
- }
- zend_hash_update(Z_OBJPROP_P(rv), "nodeset", sizeof("nodeset"), (void *) &arr, sizeof(zval *), NULL);
- break;
- }
-
- case XPATH_BOOLEAN:
- add_property_bool(rv, "value", xpathobjp->boolval);
- break;
-
- case XPATH_NUMBER:
- add_property_double(rv, "value", xpathobjp->floatval);
- break;
-
- case XPATH_STRING:
- add_property_string(rv, "value", xpathobjp->stringval, 1);
- break;
-
- case XPATH_POINT:
- break;
-
- case XPATH_RANGE:
- break;
-
- case XPATH_LOCATIONSET:
- break;
-
- case XPATH_USERS:
- break;
-
- case XPATH_XSLT_TREE:
- break;
- }
-
- xmlXPathFreeObject(xpathobjp);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object xpath_eval([object xpathctx_handle,] string str)
- Evaluates the XPath Location Path in the given string */
-PHP_FUNCTION(xpath_eval)
-{
- php_xpathptr_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_XPATH, 0);
-}
-/* }}} */
-
-/* {{{ proto object xpath_eval_expression([object xpathctx_handle,] string str)
- Evaluates the XPath expression in the given string */
-PHP_FUNCTION(xpath_eval_expression)
-{
- php_xpathptr_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_XPATH, 1);
-}
-/* }}} */
-
-/* {{{ proto bool xpath_register_ns([object xpathctx_handle,] string namespace_prefix, string namespace_uri)
- Registeres the given namespace in the passed XPath context */
-PHP_FUNCTION(xpath_register_ns)
-{
- int prefix_len, uri_len, result;
- xmlXPathContextPtr ctxp;
- char *prefix, *uri;
- zval *id;
-
- DOMXML_PARAM_FOUR(ctxp, id, le_xpathctxp, "ss", &prefix, &prefix_len, &uri, &uri_len);
-
- ctxp->node = NULL;
-
- #ifdef CHREGU_0
- /* this leads to memleaks... commenting it out, as it works for me without copying
- it. chregu */
- /*
- this is a hack - libxml2 doesn't copy the URI, it simply uses the string
- given in the parameter - which is normally deallocated after the function
- */
- uri_static = estrndup(uri, uri_len);
- result = xmlXPathRegisterNs(ctxp, prefix, uri_static);
- #endif
-
- result = xmlXPathRegisterNs(ctxp, prefix, uri);
-
- if (0 == result) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xpath_register_ns_auto([object xpathctx_handle,] [object contextnode])
- Registeres the given namespace in the passed XPath context */
-PHP_FUNCTION(xpath_register_ns_auto)
-{
- /* automatic namespace definitions registration.
- it's only done for the context node
- if you need namespaces defined in other nodes,
- you have to specify them explicitely with
- xpath_register_ns();
- */
-
- zval *contextnode = NULL, *id;
- xmlXPathContextPtr ctxp;
- xmlNodePtr contextnodep;
- xmlNsPtr *namespaces;
- int nsNr;
-
- DOMXML_PARAM_ONE(ctxp, id, le_xpathctxp, "|o", &contextnode);
-
- if (contextnode == NULL) {
- namespaces = xmlGetNsList(ctxp->doc, xmlDocGetRootElement(ctxp->doc));
- } else {
- DOMXML_GET_OBJ(contextnodep, contextnode, le_domxmlnodep);
- namespaces = xmlGetNsList(ctxp->doc, contextnodep);
- }
-
- nsNr = 0;
- if (namespaces != NULL) {
- while (namespaces[nsNr] != NULL) {
- xmlXPathRegisterNs(ctxp, namespaces[nsNr]->prefix, namespaces[nsNr]->href);
- nsNr++;
- }
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#endif /* defined(LIBXML_XPATH_ENABLED) */
-
-#if defined(LIBXML_XPTR_ENABLED)
-/* {{{ proto int xptr_eval([int xpathctx_handle,] string str)
- Evaluates the XPtr Location Path in the given string */
-PHP_FUNCTION(xptr_eval)
-{
- php_xpathptr_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_XPTR, 0);
-}
-/* }}} */
-#endif /* LIBXML_XPTR_ENABLED */
-
-/* {{{ proto string domxml_version(void)
- Get XML library version */
-PHP_FUNCTION(domxml_version)
-{
- RETURN_STRING((char *) xmlParserVersion,1);
-}
-/* }}} */
-
-/* {{{ proto int domxml_doc_xinclude()
- Substitutues xincludes in a DomDocument */
-PHP_FUNCTION(domxml_doc_xinclude)
-{
- zval *id;
- xmlDoc *docp;
- int err;
-
- DOMXML_PARAM_NONE(docp, id, le_domxmldocp);
-
- err = xmlXIncludeProcess (docp);
-
- if (err) {
- RETVAL_LONG(err);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-#if HAVE_DOMXSLT
-static zval *php_xsltstylesheet_new(xsltStylesheetPtr obj, int *found TSRMLS_DC)
-{
- zval *wrapper;
- int rsrc_type;
-
- *found = 0;
-
- if (!obj) {
- MAKE_STD_ZVAL(wrapper);
- ZVAL_NULL(wrapper);
- return wrapper;
- }
-
- if ((wrapper = (zval *) dom_object_get_data((void *) obj))) {
- zval_add_ref(&wrapper);
- *found = 1;
- return wrapper;
- }
-
- MAKE_STD_ZVAL(wrapper);
-
- object_init_ex(wrapper, domxsltstylesheet_class_entry);
- rsrc_type = le_domxsltstylesheetp;
- php_xsltstylesheet_set_object(wrapper, (void *) obj, rsrc_type TSRMLS_CC);
-
- return (wrapper);
-}
-
-/* {{{ proto object domxml_xslt_stylesheet(string xsltstylesheet)
- Creates XSLT Stylesheet object from string */
-PHP_FUNCTION(domxml_xslt_stylesheet)
-{
- zval *rv;
- xmlDocPtr docp;
- xsltStylesheetPtr sheetp;
- int ret;
- char *buffer;
- int buffer_len;
- int prevSubstValue, prevExtDtdValue;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buffer, &buffer_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- prevSubstValue = xmlSubstituteEntitiesDefault (1);
- prevExtDtdValue = xmlLoadExtDtdDefaultValue;
- xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
-
- docp = xmlParseDoc(buffer);
-
- xmlSubstituteEntitiesDefault (prevSubstValue);
- xmlLoadExtDtdDefaultValue = prevExtDtdValue;
-
- if (!docp) {
- RETURN_FALSE;
- }
-
- sheetp = xsltParseStylesheetDoc(docp);
-
- if (!sheetp) {
- xmlFreeDoc(docp);
- RETURN_FALSE;
- }
-
- rv = php_xsltstylesheet_new(sheetp, &ret TSRMLS_CC);
- DOMXML_RET_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_xslt_stylesheet_doc(object xmldoc)
- Creates XSLT Stylesheet object from DOM Document object */
-PHP_FUNCTION(domxml_xslt_stylesheet_doc)
-{
- zval *rv, *idxml;
- xmlDocPtr docp;
- xmlDocPtr newdocp;
- xsltStylesheetPtr sheetp;
- int ret;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &idxml) == FAILURE) {
- RETURN_FALSE;
- }
-
- DOMXML_GET_OBJ(docp, idxml, le_domxmldocp);
-
- newdocp = xmlCopyDoc(docp, 1);
-
- if (!newdocp) {
- RETURN_FALSE;
- }
-
- sheetp = xsltParseStylesheetDoc(newdocp);
-
- if (!sheetp) {
- xmlFreeDoc(newdocp);
- RETURN_FALSE;
- }
-
- rv = php_xsltstylesheet_new(sheetp, &ret TSRMLS_CC);
- DOMXML_RET_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_xslt_stylesheet_file(string filename)
- Creates XSLT Stylesheet object from file */
-PHP_FUNCTION(domxml_xslt_stylesheet_file)
-{
- zval *rv;
- xsltStylesheetPtr sheetp;
- int ret, file_len;
- char *file;
- int prevSubstValue, prevExtDtdValue;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- prevSubstValue = xmlSubstituteEntitiesDefault (1);
- prevExtDtdValue = xmlLoadExtDtdDefaultValue;
- xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
-
- sheetp = xsltParseStylesheetFile(file);
-
- xmlSubstituteEntitiesDefault (prevSubstValue);
- xmlLoadExtDtdDefaultValue = prevExtDtdValue;
-
- if (!sheetp) {
- RETURN_FALSE;
- }
-
- rv = php_xsltstylesheet_new(sheetp, &ret TSRMLS_CC);
- DOMXML_RET_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ php_domxslt_string_to_xpathexpr()
- Translates a string to a XPath Expression */
-static char *php_domxslt_string_to_xpathexpr(const char *str TSRMLS_DC)
-{
- const xmlChar *string = (const xmlChar *)str;
-
- xmlChar *value;
- int str_len;
-
- str_len = xmlStrlen(string) + 3;
-
- if (xmlStrchr(string, '"')) {
- if (xmlStrchr(string, '\'')) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create XPath expression (string contains both quote and double-quotes)");
- return NULL;
- }
- value = (xmlChar*) emalloc (str_len * sizeof(xmlChar) );
- snprintf(value, str_len, "'%s'", string);
- } else {
- value = (xmlChar*) emalloc (str_len * sizeof(xmlChar) );
- snprintf(value, str_len, "\"%s\"", string);
- }
-
- return (char *)value;
-}
-
-/* {{{ php_domxslt_make_params()
- Translates a PHP array to a libxslt parameters array */
-static char **php_domxslt_make_params(zval *idvars, int xpath_params TSRMLS_DC)
-{
- HashTable *parht;
- int parsize;
- zval **value;
- char *xpath_expr, *string_key = NULL;
- ulong num_key;
- char **params = NULL;
- int i = 0;
-
- parht = HASH_OF(idvars);
- parsize = (2 * zend_hash_num_elements(parht) + 1) * sizeof(char *);
- params = (char **)emalloc(parsize);
- memset((char *)params, 0, parsize);
-
- for (zend_hash_internal_pointer_reset(parht);
- zend_hash_get_current_data(parht, (void **)&value) == SUCCESS;
- zend_hash_move_forward(parht)) {
-
- if (zend_hash_get_current_key(parht, &string_key, &num_key, 1) != HASH_KEY_IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument or parameter array");
- return NULL;
- } else {
- SEPARATE_ZVAL(value);
- convert_to_string_ex(value);
-
- if (!xpath_params) {
- xpath_expr = php_domxslt_string_to_xpathexpr(Z_STRVAL_PP(value) TSRMLS_CC);
- } else {
- xpath_expr = Z_STRVAL_PP(value);
- }
-
- if (xpath_expr) {
- params[i++] = string_key;
- params[i++] = xpath_expr;
- }
- }
- }
-
- params[i++] = NULL;
-
- return params;
-}
-/* }}} */
-
-/* {{{ proto object domxml_xslt_process(object xslstylesheet, object xmldoc [, array xslt_parameters [, bool xpath_parameters [, string profileFilename]]])
- Perform an XSLT transformation */
-PHP_FUNCTION(domxml_xslt_process)
-{
-/* TODO:
- - test memory deallocation
- - test other stuff
- - check xsltsp->errors ???
-*/
- zval *rv = NULL, *idxsl, *idxml, *idparams = NULL;
- zend_bool xpath_params = 0;
- xsltStylesheetPtr xsltstp;
- xmlDocPtr xmldocp;
- xmlDocPtr docp;
- char **params = NULL;
- int ret;
- char *filename;
- int filename_len = 0;
-
- DOMXML_GET_THIS(idxsl);
-
- xsltstp = php_xsltstylesheet_get_object(idxsl, le_domxsltstylesheetp, 0 TSRMLS_CC);
- if (!xsltstp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing");
- RETURN_FALSE;
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|abs", &idxml, &idparams, &xpath_params, &filename, &filename_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- DOMXML_GET_OBJ(xmldocp, idxml, le_domxmldocp);
-
- if (idparams) {
- params = php_domxslt_make_params(idparams, xpath_params TSRMLS_CC);
- }
-
- if (filename_len) {
- FILE *f;
- f = fopen (filename,"w");
- docp = xsltProfileStylesheet(xsltstp, xmldocp, (const char**)params, f);
- fclose(f);
- } else {
- docp = xsltApplyStylesheet(xsltstp, xmldocp, (const char**)params);
- }
-
- if (params) {
- efree(params);
- }
-
- if (!docp) {
- RETURN_FALSE;
- }
-
- DOMXML_RET_OBJ(rv, (xmlNodePtr) docp, &ret);
-}
-/* }}} */
-
-/* {{{ proto string domxml_xslt_result_dump_mem(object xslstylesheet, object xmldoc)
- output XSLT result to memory */
-PHP_FUNCTION(domxml_xslt_result_dump_mem)
-{
- zval *idxsl, *idxml;
- xsltStylesheetPtr xsltstp;
- xmlDocPtr xmldocp;
- xmlChar *doc_txt_ptr;
- int doc_txt_len;
- int ret;
-
- DOMXML_GET_THIS(idxsl);
-
- xsltstp = php_xsltstylesheet_get_object(idxsl, le_domxsltstylesheetp, 0 TSRMLS_CC);
- if (!xsltstp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing");
- RETURN_FALSE;
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &idxml) == FAILURE) {
- RETURN_FALSE;
- }
-
- DOMXML_GET_OBJ(xmldocp, idxml, le_domxmldocp);
-
- ret = xsltSaveResultToString(&doc_txt_ptr, &doc_txt_len, xmldocp, xsltstp);
-
- if (ret < 0) {
- RETURN_FALSE;
- }
-
- if (doc_txt_ptr) {
- RETVAL_STRINGL(doc_txt_ptr, doc_txt_len, 1);
- xmlFree(doc_txt_ptr);
- } else {
- RETURN_EMPTY_STRING();
- }
-}
-/* }}} */
-
-/* {{{ proto int domxml_xslt_result_dump_file(object xslstylesheet, object xmldoc, string filename[, int compression])
- output XSLT result to File */
-PHP_FUNCTION(domxml_xslt_result_dump_file)
-{
- zval *idxsl, *idxml;
- xsltStylesheetPtr xsltstp;
- xmlDocPtr xmldocp;
- char *filename;
- int filename_len;
- int ret;
- long compression = 0;
-
- DOMXML_GET_THIS(idxsl);
-
- xsltstp = php_xsltstylesheet_get_object(idxsl, le_domxsltstylesheetp, 0 TSRMLS_CC);
- if (!xsltstp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing");
- RETURN_FALSE;
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "os|l", &idxml, &filename, &filename_len, &compression) == FAILURE) {
- RETURN_FALSE;
- }
- if ((PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- DOMXML_GET_OBJ(xmldocp, idxml, le_domxmldocp);
-
- ret = xsltSaveResultToFilename(filename, xmldocp, xsltstp, compression);
-
- if (ret < 0) {
- RETURN_FALSE;
- }
-
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto string domxml_xslt_version(void)
- Get XSLT library version */
-PHP_FUNCTION(domxml_xslt_version)
-{
- RETURN_LONG(xsltLibxsltVersion);
-}
-/* }}} */
-#endif /* HAVE_DOMXSLT */
-
-#endif /* HAVE_DOMXML */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/domxml/php_domxml.h b/ext/domxml/php_domxml.h
deleted file mode 100644
index b1b0cdb541..0000000000
--- a/ext/domxml/php_domxml.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Uwe Steinmann (Uwe.Steinmann@fernuni-hagen.de |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_DOMXML_H
-#define PHP_DOMXML_H
-
-#if HAVE_DOMXML
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-#include <libxml/tree.h>
-#include <libxml/xmlerror.h>
-#include <libxml/xinclude.h>
-#if defined(LIBXML_HTML_ENABLED)
-#include <libxml/HTMLparser.h>
-#include <libxml/HTMLtree.h>
-#endif
-#if defined(LIBXML_XPATH_ENABLED)
-#include <libxml/xpath.h>
-#include <libxml/xpathInternals.h>
-#endif
-#if defined(LIBXML_XPTR_ENABLED)
-#include <libxml/xpointer.h>
-#endif
-#if HAVE_DOMXSLT
-#include <libxslt/xsltconfig.h>
-#include <libxslt/xsltInternals.h>
-#include <libxslt/xsltutils.h>
-#include <libxslt/transform.h>
-#if HAVE_DOMEXSLT
-#include <libexslt/exslt.h>
-#include <libexslt/exsltconfig.h>
-#endif
-#endif
-
-/* DOMXML API_VERSION, please bump it up, if you change anything in the API
- therefore it's easier for the script-programmers to check, what's working how
- Can be checked with phpversion("domxml");
-*/
-#define DOMXML_API_VERSION "20030407"
-
-extern zend_module_entry domxml_module_entry;
-#define domxml_module_ptr &domxml_module_entry
-
-#ifdef PHP_WIN32
-#ifdef PHPAPI
-#undef PHPAPI
-#endif
-#ifdef DOMXML_EXPORTS
-#define PHPAPI __declspec(dllexport)
-#else
-#define PHPAPI __declspec(dllimport)
-#endif /* DOMXML_EXPORTS */
-#endif /* PHP_WIN32 */
-
-PHPAPI zval *php_domobject_new(xmlNodePtr obj, int *found, zval* in TSRMLS_DC);
-
-/* directory functions */
-PHP_MINIT_FUNCTION(domxml);
-PHP_MSHUTDOWN_FUNCTION(domxml);
-PHP_MINFO_FUNCTION(domxml);
-PHP_FUNCTION(domxml_version);
-PHP_FUNCTION(xmldoc);
-PHP_FUNCTION(xmldocfile);
-#if defined(LIBXML_HTML_ENABLED)
-PHP_FUNCTION(html_doc);
-PHP_FUNCTION(html_doc_file);
-#endif
-PHP_FUNCTION(domxml_xmltree);
-PHP_FUNCTION(domxml_new_xmldoc);
-PHP_FUNCTION(domxml_substitute_entities_default);
-
-/* Class Document methods */
-PHP_FUNCTION(domxml_doc_doctype);
-PHP_FUNCTION(domxml_doc_implementation);
-PHP_FUNCTION(domxml_doc_create_element);
-PHP_FUNCTION(domxml_doc_create_element_ns);
-PHP_FUNCTION(domxml_doc_create_text_node);
-PHP_FUNCTION(domxml_doc_create_comment);
-PHP_FUNCTION(domxml_doc_create_processing_instruction);
-PHP_FUNCTION(domxml_doc_create_document_fragment);
-PHP_FUNCTION(domxml_doc_create_attribute);
-PHP_FUNCTION(domxml_doc_create_cdata_section);
-PHP_FUNCTION(domxml_doc_create_entity_reference);
-PHP_FUNCTION(domxml_doc_imported_node);
-PHP_FUNCTION(domxml_doc_add_root);
-PHP_FUNCTION(domxml_doc_document_element);
-PHP_FUNCTION(domxml_doc_set_root);
-PHP_FUNCTION(domxml_intdtd);
-PHP_FUNCTION(domxml_doc_ids);
-PHP_FUNCTION(domxml_dump_mem);
-PHP_FUNCTION(domxml_dump_mem_file);
-PHP_FUNCTION(domxml_dump_node);
-PHP_FUNCTION(domxml_doc_validate);
-PHP_FUNCTION(domxml_doc_xinclude);
-PHP_FUNCTION(domxml_doc_free_doc);
-#if defined(LIBXML_HTML_ENABLED)
-PHP_FUNCTION(domxml_html_dump_mem);
-#endif
-
-/* Class DocumentType methods */
-PHP_FUNCTION(domxml_doctype_name);
-PHP_FUNCTION(domxml_doctype_entities);
-PHP_FUNCTION(domxml_doctype_notations);
-PHP_FUNCTION(domxml_doctype_public_id);
-PHP_FUNCTION(domxml_doctype_system_id);
-PHP_FUNCTION(domxml_doctype_internal_subset);
-
-/* Class Notation methods */
-PHP_FUNCTION(domxml_notation_public_id);
-PHP_FUNCTION(domxml_notation_system_id);
-
-/* Class Node methods */
-PHP_FUNCTION(domxml_node_attributes);
-PHP_FUNCTION(domxml_node_children);
-PHP_FUNCTION(domxml_node_first_child);
-PHP_FUNCTION(domxml_node_last_child);
-PHP_FUNCTION(domxml_node_next_sibling);
-PHP_FUNCTION(domxml_node_previous_sibling);
-PHP_FUNCTION(domxml_node_owner_document);
-PHP_FUNCTION(domxml_node_insert_before);
-PHP_FUNCTION(domxml_node_append_sibling);
-PHP_FUNCTION(domxml_node_append_child);
-PHP_FUNCTION(domxml_node_remove_child);
-PHP_FUNCTION(domxml_node_replace_child);
-PHP_FUNCTION(domxml_node_has_attributes);
-PHP_FUNCTION(domxml_node_has_child_nodes);
-PHP_FUNCTION(domxml_node_parent);
-PHP_FUNCTION(domxml_node_prefix);
-PHP_FUNCTION(domxml_node_namespace_uri);
-PHP_FUNCTION(domxml_node_add_namespace);
-PHP_FUNCTION(domxml_node_set_namespace);
-PHP_FUNCTION(domxml_node);
-PHP_FUNCTION(domxml_clone_node);
-PHP_FUNCTION(domxml_node_unlink_node);
-PHP_FUNCTION(domxml_node_replace_node);
-PHP_FUNCTION(domxml_node_new_child);
-PHP_FUNCTION(domxml_node_set_content);
-PHP_FUNCTION(domxml_node_get_content);
-PHP_FUNCTION(domxml_node_text_concat);
-PHP_FUNCTION(domxml_node_set_name);
-PHP_FUNCTION(domxml_node_get_path);
-PHP_FUNCTION(domxml_node_name);
-PHP_FUNCTION(domxml_node_type);
-PHP_FUNCTION(domxml_node_value);
-PHP_FUNCTION(domxml_is_blank_node);
-
-/* Class Attribute methods */
-PHP_FUNCTION(domxml_attr_name);
-PHP_FUNCTION(domxml_attr_value);
-PHP_FUNCTION(domxml_attr_specified);
-PHP_FUNCTION(domxml_attr_set_value);
-
-/* Class Element methods */
-PHP_FUNCTION(domxml_elem_tagname);
-PHP_FUNCTION(domxml_elem_get_attribute);
-PHP_FUNCTION(domxml_elem_set_attribute);
-PHP_FUNCTION(domxml_elem_remove_attribute);
-PHP_FUNCTION(domxml_elem_get_attribute_node);
-PHP_FUNCTION(domxml_elem_set_attribute_node);
-PHP_FUNCTION(domxml_elem_get_elements_by_tagname);
-PHP_FUNCTION(domxml_elem_has_attribute);
-/* Class CData methods */
-PHP_FUNCTION(domxml_cdata_length);
-
-/* Class Notation methods */
-PHP_FUNCTION(domxml_notation_public_id);
-PHP_FUNCTION(domxml_notation_system_id);
-
-/* Class Entity methods */
-PHP_FUNCTION(domxml_entity_public_id);
-PHP_FUNCTION(domxml_entity_system_id);
-PHP_FUNCTION(domxml_entity_notation_name);
-
-/* Class ProcessingInstructions methods*/
-PHP_FUNCTION(domxml_pi_target);
-PHP_FUNCTION(domxml_pi_data);
-
-/* Class DocumentFragment methods */
-PHP_FUNCTION(domxml_document_fragment_open_mem);
-
-/* Class Parser methods */
-PHP_FUNCTION(domxml_parser);
-PHP_FUNCTION(domxml_parser_add_chunk);
-PHP_FUNCTION(domxml_parser_end);
-PHP_FUNCTION(domxml_parser_set_keep_blanks);
-PHP_FUNCTION(domxml_parser_start_element);
-PHP_FUNCTION(domxml_parser_end_element);
-PHP_FUNCTION(domxml_parser_characters);
-PHP_FUNCTION(domxml_parser_entity_reference);
-PHP_FUNCTION(domxml_parser_comment);
-PHP_FUNCTION(domxml_parser_cdata_section);
-PHP_FUNCTION(domxml_parser_namespace_decl);
-PHP_FUNCTION(domxml_parser_processing_instruction);
-PHP_FUNCTION(domxml_parser_start_document);
-PHP_FUNCTION(domxml_parser_end_document);
-PHP_FUNCTION(domxml_parser_get_document);
-
-/* Class XPathContext methods */
-#if defined(LIBXML_XPATH_ENABLED)
-PHP_FUNCTION(xpath_init);
-PHP_FUNCTION(xpath_new_context);
-PHP_FUNCTION(xpath_eval);
-PHP_FUNCTION(xpath_eval_expression);
-PHP_FUNCTION(xpath_register_ns);
-PHP_FUNCTION(xpath_register_ns_auto);
-PHP_FUNCTION(domxml_doc_get_elements_by_tagname);
-PHP_FUNCTION(domxml_doc_get_element_by_id);
-#endif
-#if defined(LIBXML_XPTR_ENABLED)
-PHP_FUNCTION(xptr_new_context);
-PHP_FUNCTION(xptr_eval);
-#endif
-PHP_FUNCTION(domxml_test);
-
-/* DOMXSLT functions */
-#if HAVE_DOMXSLT
-PHP_FUNCTION(domxml_xslt_stylesheet);
-PHP_FUNCTION(domxml_xslt_stylesheet_doc);
-PHP_FUNCTION(domxml_xslt_stylesheet_file);
-PHP_FUNCTION(domxml_xslt_process);
-PHP_FUNCTION(domxml_xslt_result_dump_mem);
-PHP_FUNCTION(domxml_xslt_result_dump_file);
-PHP_FUNCTION(domxml_xslt_version);
-#endif
-typedef struct {
- zval *errors;
- xmlValidCtxtPtr valid;
- xmlParserCtxtPtr parser;
-} domxml_ErrorCtxt;
-#else
-#define domxml_module_ptr NULL
-
-#endif /* HAVE_DOMXML */
-#define phpext_domxml_ptr domxml_module_ptr
-
-#endif /* _PHP_DIR_H */
diff --git a/ext/domxml/tests/domxml001.phpt b/ext/domxml/tests/domxml001.phpt
deleted file mode 100644
index b4d27c796e..0000000000
--- a/ext/domxml/tests/domxml001.phpt
+++ /dev/null
@@ -1,273 +0,0 @@
---TEST--
-Test 1: Accessing single node
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require_once("domxml_test.inc");
-
-echo "Test 1: accessing single nodes from php\n";
-$dom = xmldoc($xmlstr);
-if(!$dom) {
- echo "Error while parsing the document\n";
- exit;
-}
-
-// children() of of document would result in a memleak
-//$children = $dom->children();
-//print_node_list($children);
-
-echo "--------- root\n";
-$rootnode = $dom->root();
-print_node($rootnode);
-
-echo "--------- children of root\n";
-$children = $rootnode->children();
-print_node_list($children);
-
-// The last node should be identical with the last entry in the children array
-echo "--------- last\n";
-$last = $rootnode->last_child();
-print_node($last);
-
-// The parent of this last node is the root again
-echo "--------- parent\n";
-$parent = $last->parent();
-print_node($parent);
-
-// The children of this parent are the same children as one above
-echo "--------- children of parent\n";
-$children = $parent->children();
-print_node_list($children);
-
-echo "--------- creating a new attribute\n";
-//This is worthless
-//$attr = $dom->create_attribute("src", "picture.gif");
-//print_r($attr);
-
-//$rootnode->set_attribute_node($attr); /* Not implemented */
-$attr = $rootnode->set_attribute("src", "picture.gif");
-$attr = $rootnode->get_attribute("src");
-print_r($attr);
-print "\n";
-
-echo "--------- Get Attribute Node\n";
-$attr = $rootnode->get_attribute_node("src");
-print_node($attr);
-
-echo "--------- Remove Attribute Node\n";
-$attr = $rootnode->remove_attribute("src");
-print "Removed " . $attr . " attributes.\n";
-
-echo "--------- attributes of rootnode\n";
-$attrs = $rootnode->attributes();
-print_node_list($attrs);
-
-echo "--------- children of an attribute\n";
-$children = $attrs[0]->children();
-print_node_list($children);
-
-echo "--------- Add child to root\n";
-$newchild = $rootnode->new_child("Silly", "Symphony");
-print_node($newchild);
-print $dom->dumpmem();
-print "\n";
-
-echo "--------- Find element by tagname\n";
-echo " Using dom\n";
-$children = $dom->get_elements_by_tagname("Silly");
-print_node_list($children);
-echo " Using elem\n";
-$children = $rootnode->get_elements_by_tagname("Silly");
-print_node_list($children);
-
-echo "--------- Unlink Node\n";
-print_node($children[0]);
-//domxml_node_unlink_node($children[0]);
-$children[0]->unlink_node();
-print_node_list($rootnode->children());
-print $dom->dumpmem();
-
-echo "--------- Find element by id\n";
-print ("Not implemented\n");
-
-echo "--------- Check various node_name return values\n";
-print ("Not needed\n");
-
-?>
---EXPECT--
-Test 1: accessing single nodes from php
---------- root
-Node Name: chapter
-Node Type: 1
-Num Children: 4
-
---------- children of root
-Node Name: title
-Node Type: 1
-Num Children: 1
-Node Content: Title
-
-Node Name: #text
-Node Type: 3
-Num Children: 0
-Node Content:
-
-
-Node Name: para
-Node Type: 1
-Num Children: 7
-
-Node Name: #text
-Node Type: 3
-Num Children: 0
-Node Content:
-
-
---------- last
-Node Name: #text
-Node Type: 3
-Num Children: 0
-Node Content:
-
-
---------- parent
-Node Name: chapter
-Node Type: 1
-Num Children: 4
-
---------- children of parent
-Node Name: title
-Node Type: 1
-Num Children: 1
-Node Content: Title
-
-Node Name: #text
-Node Type: 3
-Num Children: 0
-Node Content:
-
-
-Node Name: para
-Node Type: 1
-Num Children: 7
-
-Node Name: #text
-Node Type: 3
-Num Children: 0
-Node Content:
-
-
---------- creating a new attribute
-picture.gif
---------- Get Attribute Node
-Node Name: src
-Node Type: 2
-Num Children: 1
-Node Content: picture.gif
-
---------- Remove Attribute Node
-Removed 1 attributes.
---------- attributes of rootnode
-Node Name: language
-Node Type: 2
-Num Children: 1
-Node Content: en
-
---------- children of an attribute
-Node Name: #text
-Node Type: 3
-Num Children: 0
-Node Content: en
-
---------- Add child to root
-Node Name: Silly
-Node Type: 1
-Num Children: 1
-Node Content: Symphony
-
-<?xml version="1.0" standalone="yes"?>
-<!DOCTYPE chapter SYSTEM "/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd" [
-<!ENTITY sp "spanish">
-]>
-<!-- lsfj -->
-<chapter language="en"><title language="en">Title</title>
-<para language="ge">
-&sp;
-<!-- comment -->
-<informaltable language="&sp;kkk">
-<tgroup cols="3">
-<tbody>
-<row><entry>a1</entry><entry morerows="1">b1</entry><entry>c1</entry></row>
-<row><entry>a2</entry><entry>c2</entry></row>
-<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row>
-</tbody>
-</tgroup>
-</informaltable>
-</para>
-<Silly>Symphony</Silly></chapter>
-
---------- Find element by tagname
- Using dom
-Node Name: Silly
-Node Type: 1
-Num Children: 1
-Node Content: Symphony
-
- Using elem
-Node Name: Silly
-Node Type: 1
-Num Children: 1
-Node Content: Symphony
-
---------- Unlink Node
-Node Name: Silly
-Node Type: 1
-Num Children: 1
-Node Content: Symphony
-
-Node Name: title
-Node Type: 1
-Num Children: 1
-Node Content: Title
-
-Node Name: #text
-Node Type: 3
-Num Children: 0
-Node Content:
-
-
-Node Name: para
-Node Type: 1
-Num Children: 7
-
-Node Name: #text
-Node Type: 3
-Num Children: 0
-Node Content:
-
-
-<?xml version="1.0" standalone="yes"?>
-<!DOCTYPE chapter SYSTEM "/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd" [
-<!ENTITY sp "spanish">
-]>
-<!-- lsfj -->
-<chapter language="en"><title language="en">Title</title>
-<para language="ge">
-&sp;
-<!-- comment -->
-<informaltable language="&sp;kkk">
-<tgroup cols="3">
-<tbody>
-<row><entry>a1</entry><entry morerows="1">b1</entry><entry>c1</entry></row>
-<row><entry>a2</entry><entry>c2</entry></row>
-<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row>
-</tbody>
-</tgroup>
-</informaltable>
-</para>
-</chapter>
---------- Find element by id
-Not implemented
---------- Check various node_name return values
-Not needed
diff --git a/ext/domxml/tests/domxml002.phpt b/ext/domxml/tests/domxml002.phpt
deleted file mode 100644
index fa60f15e6d..0000000000
--- a/ext/domxml/tests/domxml002.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Test 2: Memleak in accessing children() of document.
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require_once("domxml_test.inc");
-
-$dom = xmldoc($xmlstr);
-if(!$dom) {
- die('Error while parsing the document');
-}
-
-$children = $dom->children();
-print_node_list($children);
-
-?>
---EXPECT--
-Node Name:
-Node Type: 14
-Num Children: 1
-Node Content:
-
-Node Name: #comment
-Node Type: 8
-Num Children: 0
-Node Content: lsfj
-
-Node Name: chapter
-Node Type: 1
-Num Children: 4
diff --git a/ext/domxml/tests/domxml_test.inc b/ext/domxml/tests/domxml_test.inc
deleted file mode 100644
index fa9b9e4baf..0000000000
--- a/ext/domxml/tests/domxml_test.inc
+++ /dev/null
@@ -1,42 +0,0 @@
-<?PHP
-$xmlstr = "<?xml version='1.0' standalone='yes'?>
-<!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd'
-[ <!ENTITY sp \"spanish\">
-]>
-<!-- lsfj -->
-<chapter language='en'><title language='en'>Title</title>
-<para language='ge'>
-&sp;
-<!-- comment -->
-<informaltable language='&sp;kkk'>
-<tgroup cols='3'>
-<tbody>
-<row><entry>a1</entry><entry morerows='1'>b1</entry><entry>c1</entry></row>
-<row><entry>a2</entry><entry>c2</entry></row>
-<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row>
-</tbody>
-</tgroup>
-</informaltable>
-</para>
-</chapter> ";
-
-function print_node($node)
-{
- print "Node Name: " . $node->node_name();
- print "\nNode Type: " . $node->node_type();
- print "\nNum Children: " . count($node->children());
- if(count($node->children()) <= 1){
- print "\nNode Content: " . $node->get_content();
- }
- print "\n\n";
-}
-
-function print_node_list($nodelist)
-{
- foreach($nodelist as $node)
- {
- print_node($node);
- }
-}
-
-?>
diff --git a/ext/domxml/tests/skipif.inc b/ext/domxml/tests/skipif.inc
deleted file mode 100644
index 8498b5b190..0000000000
--- a/ext/domxml/tests/skipif.inc
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
- if (!extension_loaded('domxml')) die('skip domxml extension not available');
-?>
diff --git a/ext/domxml/tests/xmldoc.phpt b/ext/domxml/tests/xmldoc.phpt
deleted file mode 100644
index 244f289c16..0000000000
--- a/ext/domxml/tests/xmldoc.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-xmldoc()
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require_once("domxml_test.inc");
-
-$dom = xmldoc($xmlstr);
-if(!$dom) {
- die('Error while parsing the document');
-}
-var_dump($dom);
-?>
---EXPECTF--
-object(domdocument)(9) {
- ["name"]=>
- string(9) "#document"
- ["url"]=>
- string(0) ""
- ["version"]=>
- string(3) "1.0"
- ["standalone"]=>
- int(1)
- ["type"]=>
- int(9)
- ["compression"]=>
- int(-1)
- ["charset"]=>
- int(1)
- [0]=>
- int(5)
- [1]=>
- int(%d)
-} \ No newline at end of file
diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c
deleted file mode 100644
index e76dee7c0d..0000000000
--- a/ext/ereg/ereg.c
+++ /dev/null
@@ -1,637 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Jim Winstead <jimw@php.net> |
- | Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "php.h"
-#include "php_string.h"
-#include "reg.h"
-#include "ext/standard/info.h"
-
-ZEND_DECLARE_MODULE_GLOBALS(reg)
-
-typedef struct {
- regex_t preg;
- int cflags;
-} reg_cache;
-
-/* {{{ _php_regcomp
- */
-static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
-{
- int r = 0;
- int patlen = strlen(pattern);
- reg_cache *rc = NULL;
- TSRMLS_FETCH();
-
- if(zend_hash_find(&REG(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == FAILURE ||
- rc->cflags != cflags) {
- r = regcomp(preg, pattern, cflags);
- if(!r) {
- reg_cache rcp;
-
- rcp.cflags = cflags;
- memcpy(&rcp.preg, preg, sizeof(*preg));
- zend_hash_update(&REG(ht_rc), (char *) pattern, patlen+1,
- (void *) &rcp, sizeof(rcp), NULL);
- }
- } else {
- memcpy(preg, &rc->preg, sizeof(*preg));
- }
-
- return r;
-}
-/* }}} */
-
-static void _free_reg_cache(reg_cache *rc)
-{
- regfree(&rc->preg);
-}
-
-#undef regfree
-#define regfree(a);
-#undef regcomp
-#define regcomp(a, b, c) _php_regcomp(a, b, c)
-
-static void php_reg_init_globals(zend_reg_globals *reg_globals TSRMLS_DC)
-{
- zend_hash_init(&reg_globals->ht_rc, 0, NULL, (void (*)(void *)) _free_reg_cache, 1);
-}
-
-static void php_reg_destroy_globals(zend_reg_globals *reg_globals TSRMLS_DC)
-{
- zend_hash_destroy(&reg_globals->ht_rc);
-}
-
-PHP_MINIT_FUNCTION(regex)
-{
- ZEND_INIT_MODULE_GLOBALS(reg, php_reg_init_globals, php_reg_destroy_globals);
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(regex)
-{
-#ifndef ZTS
- php_reg_destroy_globals(&reg_globals TSRMLS_CC);
-#endif
-
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(regex)
-{
-#if HSREGEX
- php_info_print_table_row(2, "Regex Library", "Bundled library enabled");
-#else
- php_info_print_table_row(2, "Regex Library", "System library enabled");
-#endif
-}
-
-
-/* {{{ php_reg_eprint
- * php_reg_eprint - convert error number to name
- */
-static void php_reg_eprint(int err, regex_t *re) {
- char *buf = NULL, *message = NULL;
- size_t len;
- size_t buf_len;
-
-#ifdef REG_ITOA
- /* get the length of the message */
- buf_len = regerror(REG_ITOA | err, re, NULL, 0);
- if (buf_len) {
- buf = (char *)emalloc(buf_len * sizeof(char));
- if (!buf) return; /* fail silently */
- /* finally, get the error message */
- regerror(REG_ITOA | err, re, buf, buf_len);
- }
-#else
- buf_len = 0;
-#endif
- len = regerror(err, re, NULL, 0);
- if (len) {
- TSRMLS_FETCH();
-
- message = (char *)emalloc((buf_len + len + 2) * sizeof(char));
- if (!message) {
- return; /* fail silently */
- }
- if (buf_len) {
- snprintf(message, buf_len, "%s: ", buf);
- buf_len += 1; /* so pointer math below works */
- }
- /* drop the message into place */
- regerror(err, re, message + buf_len, len);
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", message);
- }
-
- STR_FREE(buf);
- STR_FREE(message);
-}
-/* }}} */
-
-/* {{{ php_ereg
- */
-static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
-{
- pval **regex, /* Regular expression */
- **findin, /* String to apply expression to */
- **array = NULL; /* Optional register array */
- regex_t re;
- regmatch_t *subs;
- int err, match_len, string_len;
- uint i;
- int copts = 0;
- off_t start, end;
- char *buf = NULL;
- char *string = NULL;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 ||
- zend_get_parameters_ex(argc, &regex, &findin, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (icase)
- copts |= REG_ICASE;
-
- if (argc == 2)
- copts |= REG_NOSUB;
-
- /* compile the regular expression from the supplied regex */
- if (Z_TYPE_PP(regex) == IS_STRING) {
- err = regcomp(&re, Z_STRVAL_PP(regex), REG_EXTENDED | copts);
- } else {
- /* we convert numbers to integers and treat them as a string */
- if (Z_TYPE_PP(regex) == IS_DOUBLE)
- convert_to_long_ex(regex); /* get rid of decimal places */
- convert_to_string_ex(regex);
- /* don't bother doing an extended regex with just a number */
- err = regcomp(&re, Z_STRVAL_PP(regex), copts);
- }
-
- if (err) {
- php_reg_eprint(err, &re);
- RETURN_FALSE;
- }
-
- /* make a copy of the string we're looking in */
- convert_to_string_ex(findin);
- string = estrndup(Z_STRVAL_PP(findin), Z_STRLEN_PP(findin));
-
- /* allocate storage for (sub-)expression-matches */
- subs = (regmatch_t *)ecalloc(sizeof(regmatch_t),re.re_nsub+1);
-
- /* actually execute the regular expression */
- err = regexec(&re, string, re.re_nsub+1, subs, 0);
- if (err && err != REG_NOMATCH) {
- php_reg_eprint(err, &re);
- regfree(&re);
- efree(subs);
- RETURN_FALSE;
- }
- match_len = 1;
-
- if (array && err != REG_NOMATCH) {
- match_len = (int) (subs[0].rm_eo - subs[0].rm_so);
- string_len = Z_STRLEN_PP(findin) + 1;
-
- buf = emalloc(string_len);
-
- zval_dtor(*array); /* start with clean array */
- array_init(*array);
-
- for (i = 0; i <= re.re_nsub; i++) {
- start = subs[i].rm_so;
- end = subs[i].rm_eo;
- if (start != -1 && end > 0 && start < string_len && end < string_len && start < end) {
- add_index_stringl(*array, i, string+start, end-start, 1);
- } else {
- add_index_bool(*array, i, 0);
- }
- }
- efree(buf);
- }
-
- efree(subs);
- efree(string);
- if (err == REG_NOMATCH) {
- RETVAL_FALSE;
- } else {
- if (match_len == 0)
- match_len = 1;
- RETVAL_LONG(match_len);
- }
- regfree(&re);
-}
-/* }}} */
-
-/* {{{ proto int ereg(string pattern, string string [, array registers])
- Regular expression match */
-PHP_FUNCTION(ereg)
-{
- php_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int eregi(string pattern, string string [, array registers])
- Case-insensitive regular expression match */
-PHP_FUNCTION(eregi)
-{
- php_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ php_reg_replace
- * this is the meat and potatoes of regex replacement! */
-PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended)
-{
- regex_t re;
- regmatch_t *subs;
-
- char *buf, /* buf is where we build the replaced string */
- *nbuf, /* nbuf is used when we grow the buffer */
- *walkbuf; /* used to walk buf when replacing backrefs */
- const char *walk; /* used to walk replacement string for backrefs */
- int buf_len;
- int pos, tmp, string_len, new_l;
- int err, copts = 0;
-
- string_len = strlen(string);
-
- if (icase) {
- copts = REG_ICASE;
- }
- if (extended) {
- copts |= REG_EXTENDED;
- }
-
- err = regcomp(&re, pattern, copts);
- if (err) {
- php_reg_eprint(err, &re);
- return ((char *) -1);
- }
-
-
- /* allocate storage for (sub-)expression-matches */
- subs = (regmatch_t *)ecalloc(sizeof(regmatch_t),re.re_nsub+1);
-
- /* start with a buffer that is twice the size of the stringo
- we're doing replacements in */
- buf_len = 2 * string_len + 1;
- buf = emalloc(buf_len * sizeof(char));
-
- err = pos = 0;
- buf[0] = '\0';
- while (!err) {
- err = regexec(&re, &string[pos], re.re_nsub+1, subs, (pos ? REG_NOTBOL : 0));
-
- if (err && err != REG_NOMATCH) {
- php_reg_eprint(err, &re);
- efree(subs);
- efree(buf);
- regfree(&re);
- return ((char *) -1);
- }
-
- if (!err) {
- /* backref replacement is done in two passes:
- 1) find out how long the string will be, and allocate buf
- 2) copy the part before match, replacement and backrefs to buf
-
- Jaakko Hyvätti <Jaakko.Hyvatti@iki.fi>
- */
-
- new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
- walk = replace;
- while (*walk) {
- if ('\\' == *walk && isdigit((unsigned char)walk[1]) && ((unsigned char)walk[1]) - '0' <= re.re_nsub) {
- if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) {
- new_l += subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
- }
- walk += 2;
- } else {
- new_l++;
- walk++;
- }
- }
- if (new_l + 1 > buf_len) {
- buf_len = 1 + buf_len + 2 * new_l;
- nbuf = emalloc(buf_len);
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- tmp = strlen(buf);
- /* copy the part of the string before the match */
- strncat(buf, &string[pos], subs[0].rm_so);
-
- /* copy replacement and backrefs */
- walkbuf = &buf[tmp + subs[0].rm_so];
- walk = replace;
- while (*walk) {
- if ('\\' == *walk && isdigit(walk[1]) && walk[1] - '0' <= (int)re.re_nsub) {
- if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1
- /* this next case shouldn't happen. it does. */
- && subs[walk[1] - '0'].rm_so <= subs[walk[1] - '0'].rm_eo) {
-
- tmp = subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
- memcpy (walkbuf, &string[pos + subs[walk[1] - '0'].rm_so], tmp);
- walkbuf += tmp;
- }
- walk += 2;
- } else {
- *walkbuf++ = *walk++;
- }
- }
- *walkbuf = '\0';
-
- /* and get ready to keep looking for replacements */
- if (subs[0].rm_so == subs[0].rm_eo) {
- if (subs[0].rm_so + pos >= string_len) {
- break;
- }
- new_l = strlen (buf) + 1;
- if (new_l + 1 > buf_len) {
- buf_len = 1 + buf_len + 2 * new_l;
- nbuf = emalloc(buf_len * sizeof(char));
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- pos += subs[0].rm_eo + 1;
- buf [new_l-1] = string [pos-1];
- buf [new_l] = '\0';
- } else {
- pos += subs[0].rm_eo;
- }
- } else { /* REG_NOMATCH */
- new_l = strlen(buf) + strlen(&string[pos]);
- if (new_l + 1 > buf_len) {
- buf_len = new_l + 1; /* now we know exactly how long it is */
- nbuf = emalloc(buf_len * sizeof(char));
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- /* stick that last bit of string on our output */
- strcat(buf, &string[pos]);
- }
- }
-
- /* don't want to leak memory .. */
- efree(subs);
- regfree(&re);
-
- /* whew. */
- return (buf);
-}
-/* }}} */
-
-/* {{{ php_ereg_replace
- */
-static void php_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase)
-{
- pval **arg_pattern,
- **arg_replace,
- **arg_string;
- char *pattern;
- char *string;
- char *replace;
- char *ret;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &arg_pattern, &arg_replace, &arg_string) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(arg_pattern) == IS_STRING) {
- if (Z_STRVAL_PP(arg_pattern) && Z_STRLEN_PP(arg_pattern))
- pattern = estrndup(Z_STRVAL_PP(arg_pattern), Z_STRLEN_PP(arg_pattern));
- else
- pattern = empty_string;
- } else {
- convert_to_long_ex(arg_pattern);
- pattern = emalloc(2);
- pattern[0] = (char) Z_LVAL_PP(arg_pattern);
- pattern[1] = '\0';
- }
-
- if (Z_TYPE_PP(arg_replace) == IS_STRING) {
- if (Z_STRVAL_PP(arg_replace) && Z_STRLEN_PP(arg_replace))
- replace = estrndup(Z_STRVAL_PP(arg_replace), Z_STRLEN_PP(arg_replace));
- else
- replace = empty_string;
- } else {
- convert_to_long_ex(arg_replace);
- replace = emalloc(2);
- replace[0] = (char) Z_LVAL_PP(arg_replace);
- replace[1] = '\0';
- }
-
- convert_to_string_ex(arg_string);
- if (Z_STRVAL_PP(arg_string) && Z_STRLEN_PP(arg_string))
- string = estrndup(Z_STRVAL_PP(arg_string), Z_STRLEN_PP(arg_string));
- else
- string = empty_string;
-
- /* do the actual work */
- ret = php_reg_replace(pattern, replace, string, icase, 1);
- if (ret == (char *) -1) {
- RETVAL_FALSE;
- } else {
- RETVAL_STRING(ret, 1);
- STR_FREE(ret);
- }
-
- STR_FREE(string);
- STR_FREE(replace);
- STR_FREE(pattern);
-}
-/* }}} */
-
-/* {{{ proto string ereg_replace(string pattern, string replacement, string string)
- Replace regular expression */
-PHP_FUNCTION(ereg_replace)
-{
- php_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string eregi_replace(string pattern, string replacement, string string)
- Case insensitive replace regular expression */
-PHP_FUNCTION(eregi_replace)
-{
- php_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ php_split
- */
-static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase)
-{
- zval **spliton, **str, **arg_count = NULL;
- regex_t re;
- regmatch_t subs[1];
- char *strp, *endp;
- int err, size, count = -1, copts = 0;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 ||
- zend_get_parameters_ex(argc, &spliton, &str, &arg_count) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc > 2) {
- convert_to_long_ex(arg_count);
- count = Z_LVAL_PP(arg_count);
- }
-
- if (icase)
- copts = REG_ICASE;
-
- convert_to_string_ex(spliton);
- convert_to_string_ex(str);
-
- strp = Z_STRVAL_PP(str);
- endp = strp + Z_STRLEN_PP(str);
-
- err = regcomp(&re, Z_STRVAL_PP(spliton), REG_EXTENDED | copts);
- if (err) {
- php_reg_eprint(err, &re);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- /* churn through str, generating array entries as we go */
- while ((count == -1 || count > 1) && !(err = regexec(&re, strp, 1, subs, 0))) {
- if (subs[0].rm_so == 0 && subs[0].rm_eo) {
- /* match is at start of string, return empty string */
- add_next_index_stringl(return_value, empty_string, 0, 1);
- /* skip ahead the length of the regex match */
- strp += subs[0].rm_eo;
- } else if (subs[0].rm_so == 0 && subs[0].rm_eo == 0) {
- /* No more matches */
- regfree(&re);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Regular Expression to split()");
- zend_hash_destroy(Z_ARRVAL_P(return_value));
- efree(Z_ARRVAL_P(return_value));
- RETURN_FALSE;
- } else {
- /* On a real match */
-
- /* make a copy of the substring */
- size = subs[0].rm_so;
-
- /* add it to the array */
- add_next_index_stringl(return_value, strp, size, 1);
-
- /* point at our new starting point */
- strp = strp + subs[0].rm_eo;
- }
-
- /* if we're only looking for a certain number of points,
- stop looking once we hit it */
- if (count != -1) {
- count--;
- }
- }
-
- /* see if we encountered an error */
- if (err && err != REG_NOMATCH) {
- php_reg_eprint(err, &re);
- regfree(&re);
- zend_hash_destroy(Z_ARRVAL_P(return_value));
- efree(Z_ARRVAL_P(return_value));
- RETURN_FALSE;
- }
-
- /* otherwise we just have one last element to add to the array */
- size = endp - strp;
-
- add_next_index_stringl(return_value, strp, size, 1);
-
- regfree(&re);
-}
-/* }}} */
-
-/* {{{ proto array split(string pattern, string string [, int limit])
- Split string into array by regular expression */
-PHP_FUNCTION(split)
-{
- php_split(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto array spliti(string pattern, string string [, int limit])
- Split string into array by regular expression case-insensitive */
-
-PHP_FUNCTION(spliti)
-{
- php_split(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-
-/* }}} */
-
-/* {{{ proto string sql_regcase(string string)
- Make regular expression for case insensitive match */
-PHPAPI PHP_FUNCTION(sql_regcase)
-{
- zval **string;
- char *tmp;
- unsigned char c;
- register int i, j;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &string)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(string);
-
- tmp = emalloc((Z_STRLEN_PP(string) * 4) + 1);
-
- for (i = j = 0; i < Z_STRLEN_PP(string); i++) {
- c = (unsigned char) Z_STRVAL_PP(string)[i];
- if(isalpha(c)) {
- tmp[j++] = '[';
- tmp[j++] = toupper(c);
- tmp[j++] = tolower(c);
- tmp[j++] = ']';
- } else {
- tmp[j++] = c;
- }
- }
- tmp[j] = 0;
-
- RETVAL_STRINGL(tmp, j, 1);
- efree(tmp);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/ereg/php_ereg.h b/ext/ereg/php_ereg.h
deleted file mode 100644
index c2d9251c5f..0000000000
--- a/ext/ereg/php_ereg.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-
-/* $Id$ */
-
-#ifndef REG_H
-#define REG_H
-
-PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended);
-
-PHP_FUNCTION(ereg);
-PHP_FUNCTION(eregi);
-PHP_FUNCTION(eregi_replace);
-PHP_FUNCTION(ereg_replace);
-PHP_FUNCTION(split);
-PHP_FUNCTION(spliti);
-PHPAPI PHP_FUNCTION(sql_regcase);
-
-ZEND_BEGIN_MODULE_GLOBALS(reg)
- HashTable ht_rc;
-ZEND_END_MODULE_GLOBALS(reg)
-
-PHP_MINIT_FUNCTION(regex);
-PHP_MSHUTDOWN_FUNCTION(regex);
-PHP_MINFO_FUNCTION(regex);
-
-
-#ifdef ZTS
-#define REG(v) TSRMG(reg_globals_id, zend_reg_globals *, v)
-#else
-#define REG(v) (reg_globals.v)
-#endif
-
-#endif /* REG_H */
diff --git a/ext/ereg/php_regex.h b/ext/ereg/php_regex.h
deleted file mode 100644
index b573745797..0000000000
--- a/ext/ereg/php_regex.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_REGEX_H
-#define PHP_REGEX_H
-
-/*
- * REGEX means:
- * 0.. system regex
- * 1.. bundled regex
- */
-
-#if REGEX
-/* get aliases */
-#include "regex/regex_extra.h"
-#include "regex/regex.h"
-
-/* get rid of aliases */
-#define PHP_NO_ALIASES
-#include "regex/regex_extra.h"
-#undef PHP_NO_ALIASES
-
-#undef _PCREPOSIX_H
-#define _PCREPOSIX_H 1
-
-#ifndef _REGEX_H
-#define _REGEX_H 1 /* this should stop Apache from loading the system version of regex.h */
-#endif
-#ifndef _REGEX_H_
-#define _REGEX_H_ 1
-#endif
-#ifndef _RX_H
-#define _RX_H 1 /* Try defining these for Linux to */
-#endif
-#ifndef __REGEXP_LIBRARY_H__
-#define __REGEXP_LIBRARY_H__ 1 /* avoid Apache including regex.h */
-#endif
-#ifndef _H_REGEX
-#define _H_REGEX 1 /* This one is for AIX */
-#endif
-#elif REGEX == 0
-#include <regex.h>
-#ifndef _REGEX_H_
-#define _REGEX_H_ 1
-#endif
-#endif
-
-#endif /* PHP_REGEX_H */
diff --git a/ext/ereg/regex/COPYRIGHT b/ext/ereg/regex/COPYRIGHT
deleted file mode 100644
index d43362fbfc..0000000000
--- a/ext/ereg/regex/COPYRIGHT
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
-This software is not subject to any license of the American Telephone
-and Telegraph Company or of the Regents of the University of California.
-
-Permission is granted to anyone to use this software for any purpose on
-any computer system, and to alter it and redistribute it, subject
-to the following restrictions:
-
-1. The author is not responsible for the consequences of use of this
- software, no matter how awful, even if they arise from flaws in it.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. Since few users ever read sources,
- credits must appear in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software. Since few users
- ever read sources, credits must appear in the documentation.
-
-4. This notice may not be removed or altered.
diff --git a/ext/ereg/regex/README b/ext/ereg/regex/README
deleted file mode 100644
index cea9b67b66..0000000000
--- a/ext/ereg/regex/README
+++ /dev/null
@@ -1,32 +0,0 @@
-alpha3.4 release.
-Thu Mar 17 23:17:18 EST 1994
-henry@zoo.toronto.edu
-
-See WHATSNEW for change listing.
-
-installation notes:
---------
-Read the comments at the beginning of Makefile before running.
-
-Utils.h contains some things that just might have to be modified on
-some systems, as well as a nested include (ugh) of <assert.h>.
-
-The "fake" directory contains quick-and-dirty fakes for some header
-files and routines that old systems may not have. Note also that
--DUSEBCOPY will make utils.h substitute bcopy() for memmove().
-
-After that, "make r" will build regcomp.o, regexec.o, regfree.o,
-and regerror.o (the actual routines), bundle them together into a test
-program, and run regression tests on them. No output is good output.
-
-"make lib" builds just the .o files for the actual routines (when
-you're happy with testing and have adjusted CFLAGS for production),
-and puts them together into libregex.a. You can pick up either the
-library or *.o ("make lib" makes sure there are no other .o files left
-around to confuse things).
-
-Main.c, debug.c, split.c are used for regression testing but are not part
-of the RE routines themselves.
-
-Regex.h goes in /usr/include. All other .h files are internal only.
---------
diff --git a/ext/ereg/regex/WHATSNEW b/ext/ereg/regex/WHATSNEW
deleted file mode 100644
index 6e82e1dae0..0000000000
--- a/ext/ereg/regex/WHATSNEW
+++ /dev/null
@@ -1,92 +0,0 @@
-New in alpha3.4: The complex bug alluded to below has been fixed (in a
-slightly kludgey temporary way that may hurt efficiency a bit; this is
-another "get it out the door for 4.4" release). The tests at the end of
-the tests file have accordingly been uncommented. The primary sign of
-the bug was that something like a?b matching ab matched b rather than ab.
-(The bug was essentially specific to this exact situation, else it would
-have shown up earlier.)
-
-New in alpha3.3: The definition of word boundaries has been altered
-slightly, to more closely match the usual programming notion that "_"
-is an alphabetic. Stuff used for pre-ANSI systems is now in a subdir,
-and the makefile no longer alludes to it in mysterious ways. The
-makefile has generally been cleaned up some. Fixes have been made
-(again!) so that the regression test will run without -DREDEBUG, at
-the cost of weaker checking. A workaround for a bug in some folks'
-<assert.h> has been added. And some more things have been added to
-tests, including a couple right at the end which are commented out
-because the code currently flunks them (complex bug; fix coming).
-Plus the usual minor cleanup.
-
-New in alpha3.2: Assorted bits of cleanup and portability improvement
-(the development base is now a BSDI system using GCC instead of an ancient
-Sun system, and the newer compiler exposed some glitches). Fix for a
-serious bug that affected REs using many [] (including REG_ICASE REs
-because of the way they are implemented), *sometimes*, depending on
-memory-allocation patterns. The header-file prototypes no longer name
-the parameters, avoiding possible name conflicts. The possibility that
-some clot has defined CHAR_MIN as (say) `-128' instead of `(-128)' is
-now handled gracefully. "uchar" is no longer used as an internal type
-name (too many people have the same idea). Still the same old lousy
-performance, alas.
-
-New in alpha3.1: Basically nothing, this release is just a bookkeeping
-convenience. Stay tuned.
-
-New in alpha3.0: Performance is no better, alas, but some fixes have been
-made and some functionality has been added. (This is basically the "get
-it out the door in time for 4.4" release.) One bug fix: regfree() didn't
-free the main internal structure (how embarrassing). It is now possible
-to put NULs in either the RE or the target string, using (resp.) a new
-REG_PEND flag and the old REG_STARTEND flag. The REG_NOSPEC flag to
-regcomp() makes all characters ordinary, so you can match a literal
-string easily (this will become more useful when performance improves!).
-There are now primitives to match beginnings and ends of words, although
-the syntax is disgusting and so is the implementation. The REG_ATOI
-debugging interface has changed a bit. And there has been considerable
-internal cleanup of various kinds.
-
-New in alpha2.3: Split change list out of README, and moved flags notes
-into Makefile. Macro-ized the name of regex(7) in regex(3), since it has
-to change for 4.4BSD. Cleanup work in engine.c, and some new regression
-tests to catch tricky cases thereof.
-
-New in alpha2.2: Out-of-date manpages updated. Regerror() acquires two
-small extensions -- REG_ITOA and REG_ATOI -- which avoid debugging kludges
-in my own test program and might be useful to others for similar purposes.
-The regression test will now compile (and run) without REDEBUG. The
-BRE \$ bug is fixed. Most uses of "uchar" are gone; it's all chars now.
-Char/uchar parameters are now written int/unsigned, to avoid possible
-portability problems with unpromoted parameters. Some unsigned casts have
-been introduced to minimize portability problems with shifting into sign
-bits.
-
-New in alpha2.1: Lots of little stuff, cleanup and fixes. The one big
-thing is that regex.h is now generated, using mkh, rather than being
-supplied in the distribution; due to circularities in dependencies,
-you have to build regex.h explicitly by "make h". The two known bugs
-have been fixed (and the regression test now checks for them), as has a
-problem with assertions not being suppressed in the absence of REDEBUG.
-No performance work yet.
-
-New in alpha2: Backslash-anything is an ordinary character, not an
-error (except, of course, for the handful of backslashed metacharacters
-in BREs), which should reduce script breakage. The regression test
-checks *where* null strings are supposed to match, and has generally
-been tightened up somewhat. Small bug fixes in parameter passing (not
-harmful, but technically errors) and some other areas. Debugging
-invoked by defining REDEBUG rather than not defining NDEBUG.
-
-New in alpha+3: full prototyping for internal routines, using a little
-helper program, mkh, which extracts prototypes given in stylized comments.
-More minor cleanup. Buglet fix: it's CHAR_BIT, not CHAR_BITS. Simple
-pre-screening of input when a literal string is known to be part of the
-RE; this does wonders for performance.
-
-New in alpha+2: minor bits of cleanup. Notably, the number "32" for the
-word width isn't hardwired into regexec.c any more, the public header
-file prototypes the functions if __STDC__ is defined, and some small typos
-in the manpages have been fixed.
-
-New in alpha+1: improvements to the manual pages, and an important
-extension, the REG_STARTEND option to regexec().
diff --git a/ext/ereg/regex/cclass.h b/ext/ereg/regex/cclass.h
deleted file mode 100644
index 6227f810b7..0000000000
--- a/ext/ereg/regex/cclass.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* character-class table */
-static struct cclass {
- char *name;
- char *chars;
- char *multis;
-} cclasses[] = {
- {"alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", ""},
- {"alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
- ""},
- {"blank", " \t", ""},
- {"cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
-\25\26\27\30\31\32\33\34\35\36\37\177", ""},
- {"digit", "0123456789", ""},
- {"graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
- ""},
- {"lower", "abcdefghijklmnopqrstuvwxyz",
- ""},
- {"print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ",
- ""},
- {"punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
- ""},
- {"space", "\t\n\v\f\r ", ""},
- {"upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
- ""},
- {"xdigit", "0123456789ABCDEFabcdef",
- ""},
- {NULL, 0, ""}
-};
diff --git a/ext/ereg/regex/cname.h b/ext/ereg/regex/cname.h
deleted file mode 100644
index 670b273882..0000000000
--- a/ext/ereg/regex/cname.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* character-name table */
-static struct cname {
- char *name;
- char code;
-} cnames[] = {
- {"NUL", '\0'},
- {"SOH", '\001'},
- {"STX", '\002'},
- {"ETX", '\003'},
- {"EOT", '\004'},
- {"ENQ", '\005'},
- {"ACK", '\006'},
- {"BEL", '\007'},
- {"alert", '\007'},
- {"BS", '\010'},
- {"backspace", '\b'},
- {"HT", '\011'},
- {"tab", '\t'},
- {"LF", '\012'},
- {"newline", '\n'},
- {"VT", '\013'},
- {"vertical-tab", '\v'},
- {"FF", '\014'},
- {"form-feed", '\f'},
- {"CR", '\015'},
- {"carriage-return", '\r'},
- {"SO", '\016'},
- {"SI", '\017'},
- {"DLE", '\020'},
- {"DC1", '\021'},
- {"DC2", '\022'},
- {"DC3", '\023'},
- {"DC4", '\024'},
- {"NAK", '\025'},
- {"SYN", '\026'},
- {"ETB", '\027'},
- {"CAN", '\030'},
- {"EM", '\031'},
- {"SUB", '\032'},
- {"ESC", '\033'},
- {"IS4", '\034'},
- {"FS", '\034'},
- {"IS3", '\035'},
- {"GS", '\035'},
- {"IS2", '\036'},
- {"RS", '\036'},
- {"IS1", '\037'},
- {"US", '\037'},
- {"space", ' '},
- {"exclamation-mark", '!'},
- {"quotation-mark", '"'},
- {"number-sign", '#'},
- {"dollar-sign", '$'},
- {"percent-sign", '%'},
- {"ampersand", '&'},
- {"apostrophe", '\''},
- {"left-parenthesis", '('},
- {"right-parenthesis", ')'},
- {"asterisk", '*'},
- {"plus-sign", '+'},
- {"comma", ','},
- {"hyphen", '-'},
- {"hyphen-minus", '-'},
- {"period", '.'},
- {"full-stop", '.'},
- {"slash", '/'},
- {"solidus", '/'},
- {"zero", '0'},
- {"one", '1'},
- {"two", '2'},
- {"three", '3'},
- {"four", '4'},
- {"five", '5'},
- {"six", '6'},
- {"seven", '7'},
- {"eight", '8'},
- {"nine", '9'},
- {"colon", ':'},
- {"semicolon", ';'},
- {"less-than-sign", '<'},
- {"equals-sign", '='},
- {"greater-than-sign", '>'},
- {"question-mark", '?'},
- {"commercial-at", '@'},
- {"left-square-bracket", '['},
- {"backslash", '\\'},
- {"reverse-solidus", '\\'},
- {"right-square-bracket", ']'},
- {"circumflex", '^'},
- {"circumflex-accent", '^'},
- {"underscore", '_'},
- {"low-line", '_'},
- {"grave-accent", '`'},
- {"left-brace", '{'},
- {"left-curly-bracket", '{'},
- {"vertical-line", '|'},
- {"right-brace", '}'},
- {"right-curly-bracket", '}'},
- {"tilde", '~'},
- {"DEL", '\177'},
- {NULL, 0},
-};
diff --git a/ext/ereg/regex/debug.c b/ext/ereg/regex/debug.c
deleted file mode 100644
index c0feaeb169..0000000000
--- a/ext/ereg/regex/debug.c
+++ /dev/null
@@ -1,242 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-#include "debug.ih"
-
-/*
- - regprint - print a regexp for debugging
- == void regprint(regex_t *r, FILE *d);
- */
-void
-regprint(r, d)
-regex_t *r;
-FILE *d;
-{
- register struct re_guts *g = r->re_g;
- register int i;
- register int c;
- register int last;
- int nincat[NC];
-
- fprintf(d, "%ld states, %d categories", (long)g->nstates,
- g->ncategories);
- fprintf(d, ", first %ld last %ld", (long)g->firststate,
- (long)g->laststate);
- if (g->iflags&USEBOL)
- fprintf(d, ", USEBOL");
- if (g->iflags&USEEOL)
- fprintf(d, ", USEEOL");
- if (g->iflags&BAD)
- fprintf(d, ", BAD");
- if (g->nsub > 0)
- fprintf(d, ", nsub=%ld", (long)g->nsub);
- if (g->must != NULL)
- fprintf(d, ", must(%ld) `%*s'", (long)g->mlen, (int)g->mlen,
- g->must);
- if (g->backrefs)
- fprintf(d, ", backrefs");
- if (g->nplus > 0)
- fprintf(d, ", nplus %ld", (long)g->nplus);
- fprintf(d, "\n");
- s_print(g, d);
- for (i = 0; i < g->ncategories; i++) {
- nincat[i] = 0;
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (g->categories[c] == i)
- nincat[i]++;
- }
- fprintf(d, "cc0#%d", nincat[0]);
- for (i = 1; i < g->ncategories; i++)
- if (nincat[i] == 1) {
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (g->categories[c] == i)
- break;
- fprintf(d, ", %d=%s", i, regchar(c));
- }
- fprintf(d, "\n");
- for (i = 1; i < g->ncategories; i++)
- if (nincat[i] != 1) {
- fprintf(d, "cc%d\t", i);
- last = -1;
- for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */
- if (c <= CHAR_MAX && g->categories[c] == i) {
- if (last < 0) {
- fprintf(d, "%s", regchar(c));
- last = c;
- }
- } else {
- if (last >= 0) {
- if (last != c-1)
- fprintf(d, "-%s",
- regchar(c-1));
- last = -1;
- }
- }
- fprintf(d, "\n");
- }
-}
-
-/*
- - s_print - print the strip for debugging
- == static void s_print(register struct re_guts *g, FILE *d);
- */
-static void
-s_print(g, d)
-register struct re_guts *g;
-FILE *d;
-{
- register sop *s;
- register cset *cs;
- register int i;
- register int done = 0;
- register sop opnd;
- register int col = 0;
- register int last;
- register sopno offset = 2;
-# define GAP() { if (offset % 5 == 0) { \
- if (col > 40) { \
- fprintf(d, "\n\t"); \
- col = 0; \
- } else { \
- fprintf(d, " "); \
- col++; \
- } \
- } else \
- col++; \
- offset++; \
- }
-
- if (OP(g->strip[0]) != OEND)
- fprintf(d, "missing initial OEND!\n");
- for (s = &g->strip[1]; !done; s++) {
- opnd = OPND(*s);
- switch (OP(*s)) {
- case OEND:
- fprintf(d, "\n");
- done = 1;
- break;
- case OCHAR:
- if (strchr("\\|()^$.[+*?{}!<> ", (char)opnd) != NULL)
- fprintf(d, "\\%c", (char)opnd);
- else
- fprintf(d, "%s", regchar((char)opnd));
- break;
- case OBOL:
- fprintf(d, "^");
- break;
- case OEOL:
- fprintf(d, "$");
- break;
- case OBOW:
- fprintf(d, "\\{");
- break;
- case OEOW:
- fprintf(d, "\\}");
- break;
- case OANY:
- fprintf(d, ".");
- break;
- case OANYOF:
- fprintf(d, "[(%ld)", (long)opnd);
- cs = &g->sets[opnd];
- last = -1;
- for (i = 0; i < g->csetsize+1; i++) /* +1 flushes */
- if (CHIN(cs, i) && i < g->csetsize) {
- if (last < 0) {
- fprintf(d, "%s", regchar(i));
- last = i;
- }
- } else {
- if (last >= 0) {
- if (last != i-1)
- fprintf(d, "-%s",
- regchar(i-1));
- last = -1;
- }
- }
- fprintf(d, "]");
- break;
- case OBACK_:
- fprintf(d, "(\\<%ld>", (long)opnd);
- break;
- case O_BACK:
- fprintf(d, "<%ld>\\)", (long)opnd);
- break;
- case OPLUS_:
- fprintf(d, "(+");
- if (OP(*(s+opnd)) != O_PLUS)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_PLUS:
- if (OP(*(s-opnd)) != OPLUS_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "+)");
- break;
- case OQUEST_:
- fprintf(d, "(?");
- if (OP(*(s+opnd)) != O_QUEST)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_QUEST:
- if (OP(*(s-opnd)) != OQUEST_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "?)");
- break;
- case OLPAREN:
- fprintf(d, "((<%ld>", (long)opnd);
- break;
- case ORPAREN:
- fprintf(d, "<%ld>))", (long)opnd);
- break;
- case OCH_:
- fprintf(d, "<");
- if (OP(*(s+opnd)) != OOR2)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case OOR1:
- if (OP(*(s-opnd)) != OOR1 && OP(*(s-opnd)) != OCH_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "|");
- break;
- case OOR2:
- fprintf(d, "|");
- if (OP(*(s+opnd)) != OOR2 && OP(*(s+opnd)) != O_CH)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_CH:
- if (OP(*(s-opnd)) != OOR1)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, ">");
- break;
- default:
- fprintf(d, "!%ld(%ld)!", OP(*s), opnd);
- break;
- }
- if (!done)
- GAP();
- }
-}
-
-/*
- - regchar - make a character printable
- == static char *regchar(int ch);
- */
-static char * /* -> representation */
-regchar(ch)
-int ch;
-{
- static char buf[10];
-
- if (isprint(ch) || ch == ' ')
- sprintf(buf, "%c", ch);
- else
- sprintf(buf, "\\%o", ch);
- return(buf);
-}
diff --git a/ext/ereg/regex/debug.ih b/ext/ereg/regex/debug.ih
deleted file mode 100644
index 5f40ff7917..0000000000
--- a/ext/ereg/regex/debug.ih
+++ /dev/null
@@ -1,14 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === debug.c === */
-void regprint(regex_t *r, FILE *d);
-static void s_print(register struct re_guts *g, FILE *d);
-static char *regchar(int ch);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/ext/ereg/regex/engine.c b/ext/ereg/regex/engine.c
deleted file mode 100644
index 0b88dcf1ed..0000000000
--- a/ext/ereg/regex/engine.c
+++ /dev/null
@@ -1,1019 +0,0 @@
-/*
- * The matching engine and friends. This file is #included by regexec.c
- * after suitable #defines of a variety of macros used herein, so that
- * different state representations can be used without duplicating masses
- * of code.
- */
-
-#ifdef SNAMES
-#define matcher smatcher
-#define fast sfast
-#define slow sslow
-#define dissect sdissect
-#define backref sbackref
-#define step sstep
-#define print sprint
-#define at sat
-#define match smat
-#endif
-#ifdef LNAMES
-#define matcher lmatcher
-#define fast lfast
-#define slow lslow
-#define dissect ldissect
-#define backref lbackref
-#define step lstep
-#define print lprint
-#define at lat
-#define match lmat
-#endif
-
-/* another structure passed up and down to avoid zillions of parameters */
-struct match {
- struct re_guts *g;
- int eflags;
- regmatch_t *pmatch; /* [nsub+1] (0 element unused) */
- char *offp; /* offsets work from here */
- char *beginp; /* start of string -- virtual NUL precedes */
- char *endp; /* end of string -- virtual NUL here */
- char *coldp; /* can be no match starting before here */
- char **lastpos; /* [nplus+1] */
- STATEVARS;
- states st; /* current states */
- states fresh; /* states for a fresh start */
- states tmp; /* temporary */
- states empty; /* empty set of states */
-};
-
-#include "engine.ih"
-
-#ifdef REDEBUG
-#define SP(t, s, c) print(m, t, s, c, stdout)
-#define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2)
-#define NOTE(str) { if (m->eflags&REG_TRACE) printf("=%s\n", (str)); }
-#else
-#define SP(t, s, c) /* nothing */
-#define AT(t, p1, p2, s1, s2) /* nothing */
-#define NOTE(s) /* nothing */
-#endif
-
-/*
- - matcher - the actual matching engine
- == static int matcher(register struct re_guts *g, char *string, \
- == size_t nmatch, regmatch_t pmatch[], int eflags);
- */
-static int /* 0 success, REG_NOMATCH failure */
-matcher(g, string, nmatch, pmatch, eflags)
-register struct re_guts *g;
-char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
-{
- register char *endp;
- register size_t i;
- struct match mv;
- register struct match *m = &mv;
- register char *dp;
- const register sopno gf = g->firststate+1; /* +1 for OEND */
- const register sopno gl = g->laststate;
- char *start;
- char *stop;
-
- /* simplify the situation where possible */
- if (g->cflags&REG_NOSUB)
- nmatch = 0;
- if (eflags&REG_STARTEND) {
- start = string + pmatch[0].rm_so;
- stop = string + pmatch[0].rm_eo;
- } else {
- start = string;
- stop = start + strlen(start);
- }
- if (stop < start)
- return(REG_INVARG);
-
- /* prescreening; this does wonders for this rather slow code */
- if (g->must != NULL) {
- for (dp = start; dp < stop; dp++)
- if (*dp == g->must[0] && stop - dp >= g->mlen &&
- memcmp(dp, g->must, (size_t)g->mlen) == 0)
- break;
- if (dp == stop) /* we didn't find g->must */
- return(REG_NOMATCH);
- }
-
- /* match struct setup */
- m->g = g;
- m->eflags = eflags;
- m->pmatch = NULL;
- m->lastpos = NULL;
- m->offp = string;
- m->beginp = start;
- m->endp = stop;
- STATESETUP(m, 4);
- SETUP(m->st);
- SETUP(m->fresh);
- SETUP(m->tmp);
- SETUP(m->empty);
- CLEAR(m->empty);
-
- /* this loop does only one repetition except for backrefs */
- for (;;) {
- endp = fast(m, start, stop, gf, gl);
- if (endp == NULL) { /* a miss */
- STATETEARDOWN(m);
- return(REG_NOMATCH);
- }
- if (nmatch == 0 && !g->backrefs)
- break; /* no further info needed */
-
- /* where? */
- assert(m->coldp != NULL);
- for (;;) {
- NOTE("finding start");
- endp = slow(m, m->coldp, stop, gf, gl);
- if (endp != NULL)
- break;
- assert(m->coldp < m->endp);
- m->coldp++;
- }
- if (nmatch == 1 && !g->backrefs)
- break; /* no further info needed */
-
- /* oh my, he wants the subexpressions... */
- if (m->pmatch == NULL)
- m->pmatch = (regmatch_t *)malloc((m->g->nsub + 1) *
- sizeof(regmatch_t));
- if (m->pmatch == NULL) {
- STATETEARDOWN(m);
- return(REG_ESPACE);
- }
- for (i = 1; i <= m->g->nsub; i++)
- m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1;
- if (!g->backrefs && !(m->eflags&REG_BACKR)) {
- NOTE("dissecting");
- dp = dissect(m, m->coldp, endp, gf, gl);
- } else {
- if (g->nplus > 0 && m->lastpos == NULL)
- m->lastpos = (char **)malloc((g->nplus+1) *
- sizeof(char *));
- if (g->nplus > 0 && m->lastpos == NULL) {
- free(m->pmatch);
- STATETEARDOWN(m);
- return(REG_ESPACE);
- }
- NOTE("backref dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
- }
- if (dp != NULL)
- break;
-
- /* uh-oh... we couldn't find a subexpression-level match */
- assert(g->backrefs); /* must be back references doing it */
- assert(g->nplus == 0 || m->lastpos != NULL);
- for (;;) {
- if (dp != NULL || endp <= m->coldp)
- break; /* defeat */
- NOTE("backoff");
- endp = slow(m, m->coldp, endp-1, gf, gl);
- if (endp == NULL)
- break; /* defeat */
- /* try it on a shorter possibility */
-#ifndef NDEBUG
- for (i = 1; i <= m->g->nsub; i++) {
- assert(m->pmatch[i].rm_so == -1);
- assert(m->pmatch[i].rm_eo == -1);
- }
-#endif
- NOTE("backoff dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
- }
- assert(dp == NULL || dp == endp);
- if (dp != NULL) /* found a shorter one */
- break;
-
- /* despite initial appearances, there is no match here */
- NOTE("false alarm");
- start = m->coldp + 1; /* recycle starting later */
- assert(start <= stop);
- }
-
- /* fill in the details if requested */
- if (nmatch > 0) {
- pmatch[0].rm_so = m->coldp - m->offp;
- pmatch[0].rm_eo = endp - m->offp;
- }
- if (nmatch > 1) {
- assert(m->pmatch != NULL);
- for (i = 1; i < nmatch; i++)
- if (i <= m->g->nsub)
- pmatch[i] = m->pmatch[i];
- else {
- pmatch[i].rm_so = -1;
- pmatch[i].rm_eo = -1;
- }
- }
-
- if (m->pmatch != NULL)
- free((char *)m->pmatch);
- if (m->lastpos != NULL)
- free((char *)m->lastpos);
- STATETEARDOWN(m);
- return(0);
-}
-
-/*
- - dissect - figure out what matched what, no back references
- == static char *dissect(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* == stop (success) always */
-dissect(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register sopno es; /* end sop of current subRE */
- register char *sp; /* start of string matched by it */
- register char *stp; /* string matched by it cannot pass here */
- register char *rest; /* start of rest of string */
- register char *tail; /* string unmatched by rest of RE */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *sep; /* end of string matched by subsubRE */
- register char *oldssp; /* previous ssp */
- register char *dp;
-
- AT("diss", start, stop, startst, stopst);
- sp = start;
- for (ss = startst; ss < stopst; ss = es) {
- /* identify end of subRE */
- es = ss;
- switch (OP(m->g->strip[es])) {
- case OPLUS_:
- case OQUEST_:
- es += OPND(m->g->strip[es]);
- break;
- case OCH_:
- while (OP(m->g->strip[es]) != O_CH)
- es += OPND(m->g->strip[es]);
- break;
- }
- es++;
-
- /* figure out what it matched */
- switch (OP(m->g->strip[ss])) {
- case OEND:
- assert(nope);
- break;
- case OCHAR:
- sp++;
- break;
- case OBOL:
- case OEOL:
- case OBOW:
- case OEOW:
- break;
- case OANY:
- case OANYOF:
- sp++;
- break;
- case OBACK_:
- case O_BACK:
- assert(nope);
- break;
- /* cases where length of match is hard to find */
- case OQUEST_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- /* did innards match? */
- if (slow(m, sp, rest, ssub, esub) != NULL) {
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- } else /* no */
- assert(sp == rest);
- sp = rest;
- break;
- case OPLUS_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- ssp = sp;
- oldssp = ssp;
- for (;;) { /* find last match of innards */
- sep = slow(m, ssp, rest, ssub, esub);
- if (sep == NULL || sep == ssp)
- break; /* failed or matched null */
- oldssp = ssp; /* on to next try */
- ssp = sep;
- }
- if (sep == NULL) {
- /* last successful match */
- sep = ssp;
- ssp = oldssp;
- }
- assert(sep == rest); /* must exhaust substring */
- assert(slow(m, ssp, sep, ssub, esub) == rest);
- dp = dissect(m, ssp, sep, ssub, esub);
- assert(dp == sep);
- sp = rest;
- break;
- case OCH_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = ss + OPND(m->g->strip[ss]) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;) { /* find first matching branch */
- if (slow(m, sp, rest, ssub, esub) == rest)
- break; /* it matched all of it */
- /* that one missed, try next one */
- assert(OP(m->g->strip[esub]) == OOR1);
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- sp = rest;
- break;
- case O_PLUS:
- case O_QUEST:
- case OOR1:
- case OOR2:
- case O_CH:
- assert(nope);
- break;
- case OLPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_so = sp - m->offp;
- break;
- case ORPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_eo = sp - m->offp;
- break;
- default: /* uh oh */
- assert(nope);
- break;
- }
- }
-
- assert(sp == stop);
- return(sp);
-}
-
-/*
- - backref - figure out what matched what, figuring in back references
- == static char *backref(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst, sopno lev);
- */
-static char * /* == stop (success) or NULL (failure) */
-backref(m, start, stop, startst, stopst, lev)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-sopno lev; /* PLUS nesting level */
-{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register char *sp; /* start of string matched by it */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *dp;
- register size_t len;
- register int hard;
- register sop s;
- register regoff_t offsave;
- register cset *cs;
-
- AT("back", start, stop, startst, stopst);
- sp = start;
-
- /* get as far as we can with easy stuff */
- hard = 0;
- for (ss = startst; !hard && ss < stopst; ss++)
- switch (OP(s = m->g->strip[ss])) {
- case OCHAR:
- if (sp == stop || *sp++ != (char)OPND(s))
- return(NULL);
- break;
- case OANY:
- if (sp == stop)
- return(NULL);
- sp++;
- break;
- case OANYOF:
- cs = &m->g->sets[OPND(s)];
- if (sp == stop || !CHIN(cs, *sp++))
- return(NULL);
- break;
- case OBOL:
- if ( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OEOL:
- if ( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags&REG_NEWLINE)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OBOW:
- if (( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) ||
- (sp > m->beginp &&
- !ISWORD(*(sp-1))) ) &&
- (sp < m->endp && ISWORD(*sp)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OEOW:
- if (( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags&REG_NEWLINE)) ||
- (sp < m->endp && !ISWORD(*sp)) ) &&
- (sp > m->beginp && ISWORD(*(sp-1))) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case O_QUEST:
- break;
- case OOR1: /* matches null but needs to skip */
- ss++;
- s = m->g->strip[ss];
- do {
- assert(OP(s) == OOR2);
- ss += OPND(s);
- } while (OP(s = m->g->strip[ss]) != O_CH);
- /* note that the ss++ gets us past the O_CH */
- break;
- default: /* have to make a choice */
- hard = 1;
- break;
- }
- if (!hard) { /* that was it! */
- if (sp != stop)
- return(NULL);
- return(sp);
- }
- ss--; /* adjust for the for's final increment */
-
- /* the hard stuff */
- AT("hard", sp, stop, ss, stopst);
- s = m->g->strip[ss];
- switch (OP(s)) {
- case OBACK_: /* the vilest depths */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- if (m->pmatch[i].rm_eo == -1)
- return(NULL);
- assert(m->pmatch[i].rm_so != -1);
- len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so;
- assert(stop - m->beginp >= len);
- if (sp > stop - len)
- return(NULL); /* not enough left to match */
- ssp = m->offp + m->pmatch[i].rm_so;
- if (memcmp(sp, ssp, len) != 0)
- return(NULL);
- while (m->g->strip[ss] != SOP(O_BACK, i))
- ss++;
- return(backref(m, sp+len, stop, ss+1, stopst, lev));
- break;
- case OQUEST_: /* to null or not */
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp); /* not */
- return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev));
- break;
- case OPLUS_:
- assert(m->lastpos != NULL);
- assert(lev+1 <= m->g->nplus);
- m->lastpos[lev+1] = sp;
- return(backref(m, sp, stop, ss+1, stopst, lev+1));
- break;
- case O_PLUS:
- if (sp == m->lastpos[lev]) /* last pass matched null */
- return(backref(m, sp, stop, ss+1, stopst, lev-1));
- /* try another pass */
- m->lastpos[lev] = sp;
- dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev);
- if (dp == NULL)
- return(backref(m, sp, stop, ss+1, stopst, lev-1));
- else
- return(dp);
- break;
- case OCH_: /* find the right one, if any */
- ssub = ss + 1;
- esub = ss + OPND(s) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;) { /* find first matching branch */
- dp = backref(m, sp, stop, ssub, esub, lev);
- if (dp != NULL)
- return(dp);
- /* that one missed, try next one */
- if (OP(m->g->strip[esub]) == O_CH)
- return(NULL); /* there is none */
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- break;
- case OLPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_so;
- m->pmatch[i].rm_so = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp);
- m->pmatch[i].rm_so = offsave;
- return(NULL);
- break;
- case ORPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_eo;
- m->pmatch[i].rm_eo = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp);
- m->pmatch[i].rm_eo = offsave;
- return(NULL);
- break;
- default: /* uh oh */
- assert(nope);
- break;
- }
-
- /* "can't happen" */
- assert(nope);
- /* NOTREACHED */
- return((char *)NULL); /* dummy */
-}
-
-/*
- - fast - step through the string at top speed
- == static char *fast(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* where tentative match ended, or NULL */
-fast(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register states st = m->st;
- register states fresh = m->fresh;
- register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start-1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *coldp; /* last p after which no match was underway */
-
- CLEAR(st);
- SET1(st, startst);
- st = step(m->g, startst, stopst, st, NOTHING, st);
- ASSIGN(fresh, st);
- SP("start", st, *p);
- coldp = NULL;
- for (;;) {
- /* next character */
- lastc = c;
- c = (p == m->endp) ? OUT : *p;
- if (EQ(st, fresh))
- coldp = p;
-
- /* is there an EOL and/or BOL between lastc and c? */
- flagch = '\0';
- i = 0;
- if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
- (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
- flagch = BOL;
- i = m->g->nbol;
- }
- if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
- (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
- flagch = (flagch == BOL) ? BOLEOL : EOL;
- i += m->g->neol;
- }
- if (i != 0) {
- for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boleol", st, c);
- }
-
- /* how about a word boundary? */
- if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
- (c != OUT && ISWORD(c)) ) {
- flagch = BOW;
- }
- if ( (lastc != OUT && ISWORD(lastc)) &&
- (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
- flagch = EOW;
- }
- if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boweow", st, c);
- }
-
- /* are we done? */
- if (ISSET(st, stopst) || p == stop)
- break; /* NOTE BREAK OUT */
-
- /* no, we must deal with this character */
- ASSIGN(tmp, st);
- ASSIGN(st, fresh);
- assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
- SP("aft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
- }
-
- assert(coldp != NULL);
- m->coldp = coldp;
- if (ISSET(st, stopst))
- return(p+1);
- else
- return(NULL);
-}
-
-/*
- - slow - step through the string more deliberately
- == static char *slow(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* where it ended */
-slow(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register states st = m->st;
- register states empty = m->empty;
- register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start-1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *matchp; /* last p at which a match ended */
-
- AT("slow", start, stop, startst, stopst);
- CLEAR(st);
- SET1(st, startst);
- SP("sstart", st, *p);
- st = step(m->g, startst, stopst, st, NOTHING, st);
- matchp = NULL;
- for (;;) {
- /* next character */
- lastc = c;
- c = (p == m->endp) ? OUT : *p;
-
- /* is there an EOL and/or BOL between lastc and c? */
- flagch = '\0';
- i = 0;
- if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
- (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
- flagch = BOL;
- i = m->g->nbol;
- }
- if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
- (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
- flagch = (flagch == BOL) ? BOLEOL : EOL;
- i += m->g->neol;
- }
- if (i != 0) {
- for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("sboleol", st, c);
- }
-
- /* how about a word boundary? */
- if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
- (c != OUT && ISWORD(c)) ) {
- flagch = BOW;
- }
- if ( (lastc != OUT && ISWORD(lastc)) &&
- (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
- flagch = EOW;
- }
- if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("sboweow", st, c);
- }
-
- /* are we done? */
- if (ISSET(st, stopst))
- matchp = p;
- if (EQ(st, empty) || p == stop)
- break; /* NOTE BREAK OUT */
-
- /* no, we must deal with this character */
- ASSIGN(tmp, st);
- ASSIGN(st, empty);
- assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
- SP("saft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
- }
-
- return(matchp);
-}
-
-
-/*
- - step - map set of states reachable before char to set reachable after
- == static states step(register struct re_guts *g, sopno start, sopno stop, \
- == register states bef, int ch, register states aft);
- == #define BOL (OUT+1)
- == #define EOL (BOL+1)
- == #define BOLEOL (BOL+2)
- == #define NOTHING (BOL+3)
- == #define BOW (BOL+4)
- == #define EOW (BOL+5)
- == #define CODEMAX (BOL+5) // highest code used
- == #define NONCHAR(c) ((c) > CHAR_MAX)
- == #define NNONCHAR (CODEMAX-CHAR_MAX)
- */
-static states
-step(g, start, stop, bef, ch, aft)
-register struct re_guts *g;
-sopno start; /* start state within strip */
-sopno stop; /* state after stop state within strip */
-register states bef; /* states reachable before */
-int ch; /* character or NONCHAR code */
-register states aft; /* states already known reachable after */
-{
- register cset *cs;
- register sop s;
- register sopno pc;
- register onestate here; /* note, macros know this name */
- register sopno look;
- register long i;
-
- for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) {
- s = g->strip[pc];
- switch (OP(s)) {
- case OEND:
- assert(pc == stop-1);
- break;
- case OCHAR:
- /* only characters can match */
- assert(!NONCHAR(ch) || ch != (char)OPND(s));
- if (ch == (char)OPND(s))
- FWD(aft, bef, 1);
- break;
- case OBOL:
- if (ch == BOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OEOL:
- if (ch == EOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OBOW:
- if (ch == BOW)
- FWD(aft, bef, 1);
- break;
- case OEOW:
- if (ch == EOW)
- FWD(aft, bef, 1);
- break;
- case OANY:
- if (!NONCHAR(ch))
- FWD(aft, bef, 1);
- break;
- case OANYOF:
- cs = &g->sets[OPND(s)];
- if (!NONCHAR(ch) && CHIN(cs, ch))
- FWD(aft, bef, 1);
- break;
- case OBACK_: /* ignored here */
- case O_BACK:
- FWD(aft, aft, 1);
- break;
- case OPLUS_: /* forward, this is just an empty */
- FWD(aft, aft, 1);
- break;
- case O_PLUS: /* both forward and back */
- FWD(aft, aft, 1);
- i = ISSETBACK(aft, OPND(s));
- BACK(aft, aft, OPND(s));
- if (!i && ISSETBACK(aft, OPND(s))) {
- /* oho, must reconsider loop body */
- pc -= OPND(s) + 1;
- INIT(here, pc);
- }
- break;
- case OQUEST_: /* two branches, both forward */
- FWD(aft, aft, 1);
- FWD(aft, aft, OPND(s));
- break;
- case O_QUEST: /* just an empty */
- FWD(aft, aft, 1);
- break;
- case OLPAREN: /* not significant here */
- case ORPAREN:
- FWD(aft, aft, 1);
- break;
- case OCH_: /* mark the first two branches */
- FWD(aft, aft, 1);
- assert(OP(g->strip[pc+OPND(s)]) == OOR2);
- FWD(aft, aft, OPND(s));
- break;
- case OOR1: /* done a branch, find the O_CH */
- if (ISSTATEIN(aft, here)) {
- for (look = 1;
- OP(s = g->strip[pc+look]) != O_CH;
- look += OPND(s))
- assert(OP(s) == OOR2);
- FWD(aft, aft, look);
- }
- break;
- case OOR2: /* propagate OCH_'s marking */
- FWD(aft, aft, 1);
- if (OP(g->strip[pc+OPND(s)]) != O_CH) {
- assert(OP(g->strip[pc+OPND(s)]) == OOR2);
- FWD(aft, aft, OPND(s));
- }
- break;
- case O_CH: /* just empty */
- FWD(aft, aft, 1);
- break;
- default: /* ooooops... */
- assert(nope);
- break;
- }
- }
-
- return(aft);
-}
-
-#ifdef REDEBUG
-/*
- - print - print a set of states
- == #ifdef REDEBUG
- == static void print(struct match *m, char *caption, states st, \
- == int ch, FILE *d);
- == #endif
- */
-static void
-print(m, caption, st, ch, d)
-struct match *m;
-char *caption;
-states st;
-int ch;
-FILE *d;
-{
- register struct re_guts *g = m->g;
- register int i;
- register int first = 1;
-
- if (!(m->eflags&REG_TRACE))
- return;
-
- fprintf(d, "%s", caption);
- if (ch != '\0')
- fprintf(d, " %s", pchar(ch));
- for (i = 0; i < g->nstates; i++)
- if (ISSET(st, i)) {
- fprintf(d, "%s%d", (first) ? "\t" : ", ", i);
- first = 0;
- }
- fprintf(d, "\n");
-}
-
-/*
- - at - print current situation
- == #ifdef REDEBUG
- == static void at(struct match *m, char *title, char *start, char *stop, \
- == sopno startst, sopno stopst);
- == #endif
- */
-static void
-at(m, title, start, stop, startst, stopst)
-struct match *m;
-char *title;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- if (!(m->eflags&REG_TRACE))
- return;
-
- printf("%s %s-", title, pchar(*start));
- printf("%s ", pchar(*stop));
- printf("%ld-%ld\n", (long)startst, (long)stopst);
-}
-
-#ifndef PCHARDONE
-#define PCHARDONE /* never again */
-/*
- - pchar - make a character printable
- == #ifdef REDEBUG
- == static char *pchar(int ch);
- == #endif
- *
- * Is this identical to regchar() over in debug.c? Well, yes. But a
- * duplicate here avoids having a debugging-capable regexec.o tied to
- * a matching debug.o, and this is convenient. It all disappears in
- * the non-debug compilation anyway, so it doesn't matter much.
- */
-static char * /* -> representation */
-pchar(ch)
-int ch;
-{
- static char pbuf[10];
-
- if (isprint(ch) || ch == ' ')
- sprintf(pbuf, "%c", ch);
- else
- sprintf(pbuf, "\\%o", ch);
- return(pbuf);
-}
-#endif
-#endif
-
-#undef matcher
-#undef fast
-#undef slow
-#undef dissect
-#undef backref
-#undef step
-#undef print
-#undef at
-#undef match
diff --git a/ext/ereg/regex/engine.ih b/ext/ereg/regex/engine.ih
deleted file mode 100644
index cc98334e75..0000000000
--- a/ext/ereg/regex/engine.ih
+++ /dev/null
@@ -1,35 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === engine.c === */
-static int matcher(register struct re_guts *g, char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
-static char *dissect(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *backref(register struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev);
-static char *fast(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *slow(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static states step(register struct re_guts *g, sopno start, sopno stop, register states bef, int ch, register states aft);
-#define BOL (OUT+1)
-#define EOL (BOL+1)
-#define BOLEOL (BOL+2)
-#define NOTHING (BOL+3)
-#define BOW (BOL+4)
-#define EOW (BOL+5)
-#define CODEMAX (BOL+5) /* highest code used */
-#define NONCHAR(c) ((c) > CHAR_MAX)
-#define NNONCHAR (CODEMAX-CHAR_MAX)
-#ifdef REDEBUG
-static void print(struct match *m, char *caption, states st, int ch, FILE *d);
-#endif
-#ifdef REDEBUG
-static void at(struct match *m, char *title, char *start, char *stop, sopno startst, sopno stopst);
-#endif
-#ifdef REDEBUG
-static char *pchar(int ch);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/ext/ereg/regex/main.c b/ext/ereg/regex/main.c
deleted file mode 100644
index 657338a2c1..0000000000
--- a/ext/ereg/regex/main.c
+++ /dev/null
@@ -1,510 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <regex.h>
-#include <assert.h>
-#include <stdlib.h>
-
-#include "main.ih"
-
-char *progname;
-int debug = 0;
-int line = 0;
-int status = 0;
-
-int copts = REG_EXTENDED;
-int eopts = 0;
-regoff_t startoff = 0;
-regoff_t endoff = 0;
-
-
-extern int split();
-extern void regprint();
-
-/*
- - main - do the simple case, hand off to regress() for regression
- */
-int main(argc, argv)
-int argc;
-char *argv[];
-{
- regex_t re;
-# define NS 10
- regmatch_t subs[NS];
- char erbuf[100];
- int err;
- size_t len;
- int c;
- int errflg = 0;
- register int i;
- extern int optind;
- extern char *optarg;
-
- progname = argv[0];
-
- while ((c = getopt(argc, argv, "c:e:S:E:x")) != EOF)
- switch (c) {
- case 'c': /* compile options */
- copts = options('c', optarg);
- break;
- case 'e': /* execute options */
- eopts = options('e', optarg);
- break;
- case 'S': /* start offset */
- startoff = (regoff_t)atoi(optarg);
- break;
- case 'E': /* end offset */
- endoff = (regoff_t)atoi(optarg);
- break;
- case 'x': /* Debugging. */
- debug++;
- break;
- case '?':
- default:
- errflg++;
- break;
- }
- if (errflg) {
- fprintf(stderr, "usage: %s ", progname);
- fprintf(stderr, "[-c copt][-C][-d] [re]\n");
- exit(2);
- }
-
- if (optind >= argc) {
- regress(stdin);
- exit(status);
- }
-
- err = regcomp(&re, argv[optind++], copts);
- if (err) {
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "error %s, %d/%d `%s'\n",
- eprint(err), len, sizeof(erbuf), erbuf);
- exit(status);
- }
- regprint(&re, stdout);
-
- if (optind >= argc) {
- regfree(&re);
- exit(status);
- }
-
- if (eopts&REG_STARTEND) {
- subs[0].rm_so = startoff;
- subs[0].rm_eo = strlen(argv[optind]) - endoff;
- }
- err = regexec(&re, argv[optind], (size_t)NS, subs, eopts);
- if (err) {
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "error %s, %d/%d `%s'\n",
- eprint(err), len, sizeof(erbuf), erbuf);
- exit(status);
- }
- if (!(copts&REG_NOSUB)) {
- len = (int)(subs[0].rm_eo - subs[0].rm_so);
- if (subs[0].rm_so != -1) {
- if (len != 0)
- printf("match `%.*s'\n", (int)len,
- argv[optind] + subs[0].rm_so);
- else
- printf("match `'@%.1s\n",
- argv[optind] + subs[0].rm_so);
- }
- for (i = 1; i < NS; i++)
- if (subs[i].rm_so != -1)
- printf("(%d) `%.*s'\n", i,
- (int)(subs[i].rm_eo - subs[i].rm_so),
- argv[optind] + subs[i].rm_so);
- }
- exit(status);
-}
-
-/*
- - regress - main loop of regression test
- == void regress(FILE *in);
- */
-void
-regress(in)
-FILE *in;
-{
- char inbuf[1000];
-# define MAXF 10
- char *f[MAXF];
- int nf;
- int i;
- char erbuf[100];
- size_t ne;
- char *badpat = "invalid regular expression";
-# define SHORT 10
- char *bpname = "REG_BADPAT";
- regex_t re;
-
- while (fgets(inbuf, sizeof(inbuf), in) != NULL) {
- line++;
- if (inbuf[0] == '#' || inbuf[0] == '\n')
- continue; /* NOTE CONTINUE */
- inbuf[strlen(inbuf)-1] = '\0'; /* get rid of stupid \n */
- if (debug)
- fprintf(stdout, "%d:\n", line);
- nf = split(inbuf, f, MAXF, "\t\t");
- if (nf < 3) {
- fprintf(stderr, "bad input, line %d\n", line);
- exit(1);
- }
- for (i = 0; i < nf; i++)
- if (strcmp(f[i], "\"\"") == 0)
- f[i] = "";
- if (nf <= 3)
- f[3] = NULL;
- if (nf <= 4)
- f[4] = NULL;
- try(f[0], f[1], f[2], f[3], f[4], options('c', f[1]));
- if (opt('&', f[1])) /* try with either type of RE */
- try(f[0], f[1], f[2], f[3], f[4],
- options('c', f[1]) &~ REG_EXTENDED);
- }
-
- ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
- if (strcmp(erbuf, badpat) != 0 || ne != strlen(badpat)+1) {
- fprintf(stderr, "end: regerror() test gave `%s' not `%s'\n",
- erbuf, badpat);
- status = 1;
- }
- ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, (size_t)SHORT);
- if (strncmp(erbuf, badpat, SHORT-1) != 0 || erbuf[SHORT-1] != '\0' ||
- ne != strlen(badpat)+1) {
- fprintf(stderr, "end: regerror() short test gave `%s' not `%.*s'\n",
- erbuf, SHORT-1, badpat);
- status = 1;
- }
- ne = regerror(REG_ITOA|REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
- if (strcmp(erbuf, bpname) != 0 || ne != strlen(bpname)+1) {
- fprintf(stderr, "end: regerror() ITOA test gave `%s' not `%s'\n",
- erbuf, bpname);
- status = 1;
- }
- re.re_endp = bpname;
- ne = regerror(REG_ATOI, &re, erbuf, sizeof(erbuf));
- if (atoi(erbuf) != (int)REG_BADPAT) {
- fprintf(stderr, "end: regerror() ATOI test gave `%s' not `%ld'\n",
- erbuf, (long)REG_BADPAT);
- status = 1;
- } else if (ne != strlen(erbuf)+1) {
- fprintf(stderr, "end: regerror() ATOI test len(`%s') = %ld\n",
- erbuf, (long)REG_BADPAT);
- status = 1;
- }
-}
-
-/*
- - try - try it, and report on problems
- == void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
- */
-void
-try(f0, f1, f2, f3, f4, opts)
-char *f0;
-char *f1;
-char *f2;
-char *f3;
-char *f4;
-int opts; /* may not match f1 */
-{
- regex_t re;
-# define NSUBS 10
- regmatch_t subs[NSUBS];
-# define NSHOULD 15
- char *should[NSHOULD];
- int nshould;
- char erbuf[100];
- int err;
- int len;
- char *type = (opts & REG_EXTENDED) ? "ERE" : "BRE";
- register int i;
- char *grump;
- char f0copy[1000];
- char f2copy[1000];
-
- strcpy(f0copy, f0);
- re.re_endp = (opts&REG_PEND) ? f0copy + strlen(f0copy) : NULL;
- fixstr(f0copy);
- err = regcomp(&re, f0copy, opts);
- if (err != 0 && (!opt('C', f1) || err != efind(f2))) {
- /* unexpected error or wrong error */
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "%d: %s error %s, %d/%d `%s'\n",
- line, type, eprint(err), len,
- sizeof(erbuf), erbuf);
- status = 1;
- } else if (err == 0 && opt('C', f1)) {
- /* unexpected success */
- fprintf(stderr, "%d: %s should have given REG_%s\n",
- line, type, f2);
- status = 1;
- err = 1; /* so we won't try regexec */
- }
-
- if (err != 0) {
- regfree(&re);
- return;
- }
-
- strcpy(f2copy, f2);
- fixstr(f2copy);
-
- if (options('e', f1)&REG_STARTEND) {
- if (strchr(f2, '(') == NULL || strchr(f2, ')') == NULL)
- fprintf(stderr, "%d: bad STARTEND syntax\n", line);
- subs[0].rm_so = strchr(f2, '(') - f2 + 1;
- subs[0].rm_eo = strchr(f2, ')') - f2;
- }
- err = regexec(&re, f2copy, NSUBS, subs, options('e', f1));
-
- if (err != 0 && (f3 != NULL || err != REG_NOMATCH)) {
- /* unexpected error or wrong error */
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "%d: %s exec error %s, %d/%d `%s'\n",
- line, type, eprint(err), len,
- sizeof(erbuf), erbuf);
- status = 1;
- } else if (err != 0) {
- /* nothing more to check */
- } else if (f3 == NULL) {
- /* unexpected success */
- fprintf(stderr, "%d: %s exec should have failed\n",
- line, type);
- status = 1;
- err = 1; /* just on principle */
- } else if (opts&REG_NOSUB) {
- /* nothing more to check */
- } else if ((grump = check(f2, subs[0], f3)) != NULL) {
- fprintf(stderr, "%d: %s %s\n", line, type, grump);
- status = 1;
- err = 1;
- }
-
- if (err != 0 || f4 == NULL) {
- regfree(&re);
- return;
- }
-
- for (i = 1; i < NSHOULD; i++)
- should[i] = NULL;
- nshould = split(f4, should+1, NSHOULD-1, ",");
- if (nshould == 0) {
- nshould = 1;
- should[1] = "";
- }
- for (i = 1; i < NSUBS; i++) {
- grump = check(f2, subs[i], should[i]);
- if (grump != NULL) {
- fprintf(stderr, "%d: %s $%d %s\n", line,
- type, i, grump);
- status = 1;
- err = 1;
- }
- }
-
- regfree(&re);
-}
-
-/*
- - options - pick options out of a regression-test string
- == int options(int type, char *s);
- */
-int
-options(type, s)
-int type; /* 'c' compile, 'e' exec */
-char *s;
-{
- register char *p;
- register int o = (type == 'c') ? copts : eopts;
- register char *legal = (type == 'c') ? "bisnmp" : "^$#tl";
-
- for (p = s; *p != '\0'; p++)
- if (strchr(legal, *p) != NULL)
- switch (*p) {
- case 'b':
- o &= ~REG_EXTENDED;
- break;
- case 'i':
- o |= REG_ICASE;
- break;
- case 's':
- o |= REG_NOSUB;
- break;
- case 'n':
- o |= REG_NEWLINE;
- break;
- case 'm':
- o &= ~REG_EXTENDED;
- o |= REG_NOSPEC;
- break;
- case 'p':
- o |= REG_PEND;
- break;
- case '^':
- o |= REG_NOTBOL;
- break;
- case '$':
- o |= REG_NOTEOL;
- break;
- case '#':
- o |= REG_STARTEND;
- break;
- case 't': /* trace */
- o |= REG_TRACE;
- break;
- case 'l': /* force long representation */
- o |= REG_LARGE;
- break;
- case 'r': /* force backref use */
- o |= REG_BACKR;
- break;
- }
- return(o);
-}
-
-/*
- - opt - is a particular option in a regression string?
- == int opt(int c, char *s);
- */
-int /* predicate */
-opt(c, s)
-int c;
-char *s;
-{
- return(strchr(s, c) != NULL);
-}
-
-/*
- - fixstr - transform magic characters in strings
- == void fixstr(register char *p);
- */
-void
-fixstr(p)
-register char *p;
-{
- if (p == NULL)
- return;
-
- for (; *p != '\0'; p++)
- if (*p == 'N')
- *p = '\n';
- else if (*p == 'T')
- *p = '\t';
- else if (*p == 'S')
- *p = ' ';
- else if (*p == 'Z')
- *p = '\0';
-}
-
-/*
- - check - check a substring match
- == char *check(char *str, regmatch_t sub, char *should);
- */
-char * /* NULL or complaint */
-check(str, sub, should)
-char *str;
-regmatch_t sub;
-char *should;
-{
- register int len;
- register int shlen;
- register char *p;
- static char grump[500];
- register char *at = NULL;
-
- if (should != NULL && strcmp(should, "-") == 0)
- should = NULL;
- if (should != NULL && should[0] == '@') {
- at = should + 1;
- should = "";
- }
-
- /* check rm_so and rm_eo for consistency */
- if (sub.rm_so > sub.rm_eo || (sub.rm_so == -1 && sub.rm_eo != -1) ||
- (sub.rm_so != -1 && sub.rm_eo == -1) ||
- (sub.rm_so != -1 && sub.rm_so < 0) ||
- (sub.rm_eo != -1 && sub.rm_eo < 0) ) {
- sprintf(grump, "start %ld end %ld", (long)sub.rm_so,
- (long)sub.rm_eo);
- return(grump);
- }
-
- /* check for no match */
- if (sub.rm_so == -1 && should == NULL)
- return(NULL);
- if (sub.rm_so == -1)
- return("did not match");
-
- /* check for in range */
- if (sub.rm_eo > strlen(str)) {
- sprintf(grump, "start %ld end %ld, past end of string",
- (long)sub.rm_so, (long)sub.rm_eo);
- return(grump);
- }
-
- len = (int)(sub.rm_eo - sub.rm_so);
- shlen = (int)strlen(should);
- p = str + sub.rm_so;
-
- /* check for not supposed to match */
- if (should == NULL) {
- sprintf(grump, "matched `%.*s'", len, p);
- return(grump);
- }
-
- /* check for wrong match */
- if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) {
- sprintf(grump, "matched `%.*s' instead", len, p);
- return(grump);
- }
- if (shlen > 0)
- return(NULL);
-
- /* check null match in right place */
- if (at == NULL)
- return(NULL);
- shlen = strlen(at);
- if (shlen == 0)
- shlen = 1; /* force check for end-of-string */
- if (strncmp(p, at, shlen) != 0) {
- sprintf(grump, "matched null at `%.20s'", p);
- return(grump);
- }
- return(NULL);
-}
-
-/*
- - eprint - convert error number to name
- == static char *eprint(int err);
- */
-static char *
-eprint(err)
-int err;
-{
- static char epbuf[100];
- size_t len;
-
- len = regerror(REG_ITOA|err, (regex_t *)NULL, epbuf, sizeof(epbuf));
- assert(len <= sizeof(epbuf));
- return(epbuf);
-}
-
-/*
- - efind - convert error name to number
- == static int efind(char *name);
- */
-static int
-efind(name)
-char *name;
-{
- static char efbuf[100];
- regex_t re;
-
- sprintf(efbuf, "REG_%s", name);
- assert(strlen(efbuf) < sizeof(efbuf));
- re.re_endp = efbuf;
- (void) regerror(REG_ATOI, &re, efbuf, sizeof(efbuf));
- return(atoi(efbuf));
-}
diff --git a/ext/ereg/regex/main.ih b/ext/ereg/regex/main.ih
deleted file mode 100644
index 5a0118ac44..0000000000
--- a/ext/ereg/regex/main.ih
+++ /dev/null
@@ -1,19 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === main.c === */
-void regress(FILE *in);
-void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
-int options(int type, char *s);
-int opt(int c, char *s);
-void fixstr(register char *p);
-char *check(char *str, regmatch_t sub, char *should);
-static char *eprint(int err);
-static int efind(char *name);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/ext/ereg/regex/mkh b/ext/ereg/regex/mkh
deleted file mode 100644
index 252b246c7b..0000000000
--- a/ext/ereg/regex/mkh
+++ /dev/null
@@ -1,76 +0,0 @@
-#! /bin/sh
-# mkh - pull headers out of C source
-PATH=/bin:/usr/bin ; export PATH
-
-# egrep pattern to pick out marked lines
-egrep='^ =([ ]|$)'
-
-# Sed program to process marked lines into lines for the header file.
-# The markers have already been removed. Two things are done here: removal
-# of backslashed newlines, and some fudging of comments. The first is done
-# because -o needs to have prototypes on one line to strip them down.
-# Getting comments into the output is tricky; we turn C++-style // comments
-# into /* */ comments, after altering any existing */'s to avoid trouble.
-peel=' /\\$/N
- /\\\n[ ]*/s///g
- /\/\//s;\*/;* /;g
- /\/\//s;//\(.*\);/*\1 */;'
-
-for a
-do
- case "$a" in
- -o) # old (pre-function-prototype) compiler
- # add code to comment out argument lists
- peel="$peel
- "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1(/*\2*/);'
- shift
- ;;
- -b) # funny Berkeley __P macro
- peel="$peel
- "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1 __P((\2));'
- shift
- ;;
- -s) # compiler doesn't like `static foo();'
- # add code to get rid of the `static'
- peel="$peel
- "'/^static[ ][^\/]*[a-zA-Z0-9_)](.*)/s;static.;;'
- shift
- ;;
- -p) # private declarations
- egrep='^ ==([ ]|$)'
- shift
- ;;
- -i) # wrap in #ifndef, argument is name
- ifndef="$2"
- shift ; shift
- ;;
- *) break
- ;;
- esac
-done
-
-if test " $ifndef" != " "
-then
- echo "#ifndef $ifndef"
- echo "#define $ifndef /* never again */"
-fi
-echo "/* ========= begin header generated by $0 ========= */"
-echo '#ifdef __cplusplus'
-echo 'extern "C" {'
-echo '#endif'
-for f
-do
- echo
- echo "/* === $f === */"
- egrep "$egrep" $f | sed 's/^ ==*[ ]//;s/^ ==*$//' | sed "$peel"
- echo
-done
-echo '#ifdef __cplusplus'
-echo '}'
-echo '#endif'
-echo "/* ========= end header generated by $0 ========= */"
-if test " $ifndef" != " "
-then
- echo "#endif"
-fi
-exit 0
diff --git a/ext/ereg/regex/regcomp.c b/ext/ereg/regex/regcomp.c
deleted file mode 100644
index 0b939461bd..0000000000
--- a/ext/ereg/regex/regcomp.c
+++ /dev/null
@@ -1,1608 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-
-#define POSIX_MISTAKE
-
-#include "utils.h"
-#include "regex.h"
-#include "regex2.h"
-
-#include "cclass.h"
-#include "cname.h"
-
-/*
- * parse structure, passed up and down to avoid global variables and
- * other clumsinesses
- */
-struct parse {
- char *next; /* next character in RE */
- char *end; /* end of string (-> NUL normally) */
- int error; /* has an error been seen? */
- sop *strip; /* malloced strip */
- sopno ssize; /* malloced strip size (allocated) */
- sopno slen; /* malloced strip length (used) */
- int ncsalloc; /* number of csets allocated */
- struct re_guts *g;
-# define NPAREN 10 /* we need to remember () 1-9 for back refs */
- sopno pbegin[NPAREN]; /* -> ( ([0] unused) */
- sopno pend[NPAREN]; /* -> ) ([0] unused) */
-};
-
-#include "regcomp.ih"
-
-static char nuls[10]; /* place to point scanner in event of error */
-
-/*
- * macros for use with parse structure
- * BEWARE: these know that the parse structure is named `p' !!!
- */
-#define PEEK() (*p->next)
-#define PEEK2() (*(p->next+1))
-#define MORE() (p->next < p->end)
-#define MORE2() (p->next+1 < p->end)
-#define SEE(c) (MORE() && PEEK() == (c))
-#define SEETWO(a, b) (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b))
-#define EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0)
-#define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0)
-#define NEXT() (p->next++)
-#define NEXT2() (p->next += 2)
-#define NEXTn(n) (p->next += (n))
-#define GETNEXT() (*p->next++)
-#define SETERROR(e) seterr(p, (e))
-#define REQUIRE(co, e) (void) ((co) || SETERROR(e))
-#define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e))
-#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e))
-#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e))
-#define EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd))
-#define INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos)
-#define AHEAD(pos) dofwd(p, pos, HERE()-(pos))
-#define ASTERN(sop, pos) EMIT(sop, HERE()-pos)
-#define HERE() (p->slen)
-#define THERE() (p->slen - 1)
-#define THERETHERE() (p->slen - 2)
-#define DROP(n) (p->slen -= (n))
-
-#ifndef NDEBUG
-static int never = 0; /* for use in asserts; shuts lint up */
-#else
-#define never 0 /* some <assert.h>s have bugs too */
-#endif
-
-/*
- - regcomp - interface for parser and compilation
- = API_EXPORT(int) regcomp(regex_t *, const char *, int);
- = #define REG_BASIC 0000
- = #define REG_EXTENDED 0001
- = #define REG_ICASE 0002
- = #define REG_NOSUB 0004
- = #define REG_NEWLINE 0010
- = #define REG_NOSPEC 0020
- = #define REG_PEND 0040
- = #define REG_DUMP 0200
- */
-API_EXPORT(int) /* 0 success, otherwise REG_something */
-regcomp(preg, pattern, cflags)
-regex_t *preg;
-const char *pattern;
-int cflags;
-{
- struct parse pa;
- register struct re_guts *g;
- register struct parse *p = &pa;
- register int i;
- register size_t len;
-#ifdef REDEBUG
-# define GOODFLAGS(f) (f)
-#else
-# define GOODFLAGS(f) ((f)&~REG_DUMP)
-#endif
-
- cflags = GOODFLAGS(cflags);
- if ((cflags&REG_EXTENDED) && (cflags&REG_NOSPEC))
- return(REG_INVARG);
-
- if (cflags&REG_PEND) {
- if (preg->re_endp < pattern)
- return(REG_INVARG);
- len = preg->re_endp - pattern;
- } else
- len = strlen((char *)pattern);
-
- /* do the mallocs early so failure handling is easy */
- g = (struct re_guts *)malloc(sizeof(struct re_guts) +
- (NC-1)*sizeof(cat_t));
- if (g == NULL)
- return(REG_ESPACE);
- p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
- p->strip = (sop *)malloc(p->ssize * sizeof(sop));
- p->slen = 0;
- if (p->strip == NULL) {
- free((char *)g);
- return(REG_ESPACE);
- }
-
- /* set things up */
- p->g = g;
- p->next = (char *)pattern; /* convenience; we do not modify it */
- p->end = p->next + len;
- p->error = 0;
- p->ncsalloc = 0;
- for (i = 0; i < NPAREN; i++) {
- p->pbegin[i] = 0;
- p->pend[i] = 0;
- }
- g->csetsize = NC;
- g->sets = NULL;
- g->setbits = NULL;
- g->ncsets = 0;
- g->cflags = cflags;
- g->iflags = 0;
- g->nbol = 0;
- g->neol = 0;
- g->must = NULL;
- g->mlen = 0;
- g->nsub = 0;
- g->ncategories = 1; /* category 0 is "everything else" */
- g->categories = &g->catspace[-(CHAR_MIN)];
- (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t));
- g->backrefs = 0;
-
- /* do it */
- EMIT(OEND, 0);
- g->firststate = THERE();
- if (cflags&REG_EXTENDED)
- p_ere(p, OUT);
- else if (cflags&REG_NOSPEC)
- p_str(p);
- else
- p_bre(p, OUT, OUT);
- EMIT(OEND, 0);
- g->laststate = THERE();
-
- /* tidy up loose ends and fill things in */
- categorize(p, g);
- stripsnug(p, g);
- findmust(p, g);
- g->nplus = pluscount(p, g);
- g->magic = MAGIC2;
- preg->re_nsub = g->nsub;
- preg->re_g = g;
- preg->re_magic = MAGIC1;
-#ifndef REDEBUG
- /* not debugging, so can't rely on the assert() in regexec() */
- if (g->iflags&BAD)
- SETERROR(REG_ASSERT);
-#endif
-
- /* win or lose, we're done */
- if (p->error != 0) /* lose */
- regfree(preg);
- return(p->error);
-}
-
-/*
- - p_ere - ERE parser top level, concatenation and alternation
- == static void p_ere(register struct parse *p, int stop);
- */
-static void
-p_ere(p, stop)
-register struct parse *p;
-int stop; /* character this ERE should end at */
-{
- register char c;
- register sopno prevback = 0;
- register sopno prevfwd = 0;
- register sopno conc;
- register int first = 1; /* is this the first alternative? */
-
- for (;;) {
- /* do a bunch of concatenated expressions */
- conc = HERE();
- while (MORE() && (c = PEEK()) != '|' && c != stop)
- p_ere_exp(p);
- (void) REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */
-
- if (!EAT('|'))
- break; /* NOTE BREAK OUT */
-
- if (first) {
- INSERT(OCH_, conc); /* offset is wrong */
- prevfwd = conc;
- prevback = conc;
- first = 0;
- }
- ASTERN(OOR1, prevback);
- prevback = THERE();
- AHEAD(prevfwd); /* fix previous offset */
- prevfwd = HERE();
- EMIT(OOR2, 0); /* offset is very wrong */
- }
-
- if (!first) { /* tail-end fixups */
- AHEAD(prevfwd);
- ASTERN(O_CH, prevback);
- }
-
- assert(!MORE() || SEE(stop));
-}
-
-/*
- - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op
- == static void p_ere_exp(register struct parse *p);
- */
-static void
-p_ere_exp(p)
-register struct parse *p;
-{
- register char c;
- register sopno pos;
- register int count;
- register int count2;
- register sopno subno;
- int wascaret = 0;
-
- assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
-
- pos = HERE();
- switch (c) {
- case '(':
- REQUIRE(MORE(), REG_EPAREN);
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- if (!SEE(')'))
- p_ere(p, ')');
- if (subno < NPAREN) {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- MUSTEAT(')', REG_EPAREN);
- break;
-#ifndef POSIX_MISTAKE
- case ')': /* happens only if no current unmatched ( */
- /*
- * You may ask, why the ifndef? Because I didn't notice
- * this until slightly too late for 1003.2, and none of the
- * other 1003.2 regular-expression reviewers noticed it at
- * all. So an unmatched ) is legal POSIX, at least until
- * we can get it fixed.
- */
- SETERROR(REG_EPAREN);
- break;
-#endif
- case '^':
- EMIT(OBOL, 0);
- p->g->iflags |= USEBOL;
- p->g->nbol++;
- wascaret = 1;
- break;
- case '$':
- EMIT(OEOL, 0);
- p->g->iflags |= USEEOL;
- p->g->neol++;
- break;
- case '|':
- SETERROR(REG_EMPTY);
- break;
- case '*':
- case '+':
- case '?':
- SETERROR(REG_BADRPT);
- break;
- case '.':
- if (p->g->cflags&REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case '\\':
- REQUIRE(MORE(), REG_EESCAPE);
- c = GETNEXT();
- ordinary(p, c);
- break;
- case '{': /* okay as ordinary except if digit follows */
- REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, c);
- break;
- }
-
- if (!MORE())
- return;
- c = PEEK();
- /* we call { a repetition if followed by a digit */
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit(PEEK2())) ))
- return; /* no repetition, we're done */
- NEXT();
-
- REQUIRE(!wascaret, REG_BADRPT);
- switch (c) {
- case '*': /* implemented as +? */
- /* this case does not require the (y|) trick, noKLUDGE */
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- INSERT(OQUEST_, pos);
- ASTERN(O_QUEST, pos);
- break;
- case '+':
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- break;
- case '?':
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, pos); /* offset slightly wrong */
- ASTERN(OOR1, pos); /* this one's right */
- AHEAD(pos); /* fix the OCH_ */
- EMIT(OOR2, 0); /* offset very wrong... */
- AHEAD(THERE()); /* ...so fix it */
- ASTERN(O_CH, THERETHERE());
- break;
- case '{':
- count = p_count(p);
- if (EAT(',')) {
- if (isdigit(PEEK())) {
- count2 = p_count(p);
- REQUIRE(count <= count2, REG_BADBR);
- } else /* single number with comma */
- count2 = INFINITY;
- } else /* just a single number */
- count2 = count;
- repeat(p, pos, count, count2);
- if (!EAT('}')) { /* error heuristics */
- while (MORE() && PEEK() != '}')
- NEXT();
- REQUIRE(MORE(), REG_EBRACE);
- SETERROR(REG_BADBR);
- }
- break;
- }
-
- if (!MORE())
- return;
- c = PEEK();
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit(PEEK2())) ) )
- return;
- SETERROR(REG_BADRPT);
-}
-
-/*
- - p_str - string (no metacharacters) "parser"
- == static void p_str(register struct parse *p);
- */
-static void
-p_str(p)
-register struct parse *p;
-{
- REQUIRE(MORE(), REG_EMPTY);
- while (MORE())
- ordinary(p, GETNEXT());
-}
-
-/*
- - p_bre - BRE parser top level, anchoring and concatenation
- == static void p_bre(register struct parse *p, register int end1, \
- == register int end2);
- * Giving end1 as OUT essentially eliminates the end1/end2 check.
- *
- * This implementation is a bit of a kludge, in that a trailing $ is first
- * taken as an ordinary character and then revised to be an anchor. The
- * only undesirable side effect is that '$' gets included as a character
- * category in such cases. This is fairly harmless; not worth fixing.
- * The amount of lookahead needed to avoid this kludge is excessive.
- */
-static void
-p_bre(p, end1, end2)
-register struct parse *p;
-register int end1; /* first terminating character */
-register int end2; /* second terminating character */
-{
- register sopno start = HERE();
- register int first = 1; /* first subexpression? */
- register int wasdollar = 0;
-
- if (EAT('^')) {
- EMIT(OBOL, 0);
- p->g->iflags |= USEBOL;
- p->g->nbol++;
- }
- while (MORE() && !SEETWO(end1, end2)) {
- wasdollar = p_simp_re(p, first);
- first = 0;
- }
- if (wasdollar) { /* oops, that was a trailing anchor */
- DROP(1);
- EMIT(OEOL, 0);
- p->g->iflags |= USEEOL;
- p->g->neol++;
- }
-
- REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */
-}
-
-/*
- - p_simp_re - parse a simple RE, an atom possibly followed by a repetition
- == static int p_simp_re(register struct parse *p, int starordinary);
- */
-static int /* was the simple RE an unbackslashed $? */
-p_simp_re(p, starordinary)
-register struct parse *p;
-int starordinary; /* is a leading * an ordinary character? */
-{
- register int c;
- register int count;
- register int count2;
- register sopno pos;
- register int i;
- register sopno subno;
-# define BACKSL (1<<CHAR_BIT)
-
- pos = HERE(); /* repetion op, if any, covers from here */
-
- assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
- if (c == '\\') {
- REQUIRE(MORE(), REG_EESCAPE);
- c = BACKSL | (unsigned char)GETNEXT();
- }
- switch (c) {
- case '.':
- if (p->g->cflags&REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case BACKSL|'{':
- SETERROR(REG_BADRPT);
- break;
- case BACKSL|'(':
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- /* the MORE here is an error heuristic */
- if (MORE() && !SEETWO('\\', ')'))
- p_bre(p, '\\', ')');
- if (subno < NPAREN) {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
- break;
- case BACKSL|')': /* should not get here -- must be user */
- case BACKSL|'}':
- SETERROR(REG_EPAREN);
- break;
- case BACKSL|'1':
- case BACKSL|'2':
- case BACKSL|'3':
- case BACKSL|'4':
- case BACKSL|'5':
- case BACKSL|'6':
- case BACKSL|'7':
- case BACKSL|'8':
- case BACKSL|'9':
- i = (c&~BACKSL) - '0';
- assert(i < NPAREN);
- if (p->pend[i] != 0) {
- assert(i <= p->g->nsub);
- EMIT(OBACK_, i);
- assert(p->pbegin[i] != 0);
- assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
- assert(OP(p->strip[p->pend[i]]) == ORPAREN);
- (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
- EMIT(O_BACK, i);
- } else
- SETERROR(REG_ESUBREG);
- p->g->backrefs = 1;
- break;
- case '*':
- REQUIRE(starordinary, REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, (char)c); /* takes off BACKSL, if any */
- break;
- }
-
- if (EAT('*')) { /* implemented as +? */
- /* this case does not require the (y|) trick, noKLUDGE */
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- INSERT(OQUEST_, pos);
- ASTERN(O_QUEST, pos);
- } else if (EATTWO('\\', '{')) {
- count = p_count(p);
- if (EAT(',')) {
- if (MORE() && isdigit(PEEK())) {
- count2 = p_count(p);
- REQUIRE(count <= count2, REG_BADBR);
- } else /* single number with comma */
- count2 = INFINITY;
- } else /* just a single number */
- count2 = count;
- repeat(p, pos, count, count2);
- if (!EATTWO('\\', '}')) { /* error heuristics */
- while (MORE() && !SEETWO('\\', '}'))
- NEXT();
- REQUIRE(MORE(), REG_EBRACE);
- SETERROR(REG_BADBR);
- }
- } else if (c == (unsigned char)'$') /* $ (but not \$) ends it */
- return(1);
-
- return(0);
-}
-
-/*
- - p_count - parse a repetition count
- == static int p_count(register struct parse *p);
- */
-static int /* the value */
-p_count(p)
-register struct parse *p;
-{
- register int count = 0;
- register int ndigits = 0;
-
- while (MORE() && isdigit(PEEK()) && count <= DUPMAX) {
- count = count*10 + (GETNEXT() - '0');
- ndigits++;
- }
-
- REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
- return(count);
-}
-
-/*
- - p_bracket - parse a bracketed character list
- == static void p_bracket(register struct parse *p);
- *
- * Note a significant property of this code: if the allocset() did SETERROR,
- * no set operations are done.
- */
-static void
-p_bracket(p)
-register struct parse *p;
-{
- register cset *cs = allocset(p);
- register int invert = 0;
-
- /* Dept of Truly Sickening Special-Case Kludges */
- if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) {
- EMIT(OBOW, 0);
- NEXTn(6);
- return;
- }
- if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) {
- EMIT(OEOW, 0);
- NEXTn(6);
- return;
- }
-
- if (EAT('^'))
- invert++; /* make note to invert set at end */
- if (EAT(']'))
- CHadd(cs, ']');
- else if (EAT('-'))
- CHadd(cs, '-');
- while (MORE() && PEEK() != ']' && !SEETWO('-', ']'))
- p_b_term(p, cs);
- if (EAT('-'))
- CHadd(cs, '-');
- MUSTEAT(']', REG_EBRACK);
-
- if (p->error != 0) /* don't mess things up further */
- return;
-
- if (p->g->cflags&REG_ICASE) {
- register int i;
- register int ci;
-
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i) && isalpha(i)) {
- ci = othercase(i);
- if (ci != i)
- CHadd(cs, ci);
- }
- if (cs->multis != NULL)
- mccase(p, cs);
- }
- if (invert) {
- register int i;
-
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i))
- CHsub(cs, i);
- else
- CHadd(cs, i);
- if (p->g->cflags&REG_NEWLINE)
- CHsub(cs, '\n');
- if (cs->multis != NULL)
- mcinvert(p, cs);
- }
-
- assert(cs->multis == NULL); /* xxx */
-
- if (nch(p, cs) == 1) { /* optimize singleton sets */
- ordinary(p, firstch(p, cs));
- freeset(p, cs);
- } else
- EMIT(OANYOF, freezeset(p, cs));
-}
-
-/*
- - p_b_term - parse one term of a bracketed character list
- == static void p_b_term(register struct parse *p, register cset *cs);
- */
-static void
-p_b_term(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char c;
- register char start, finish;
- register int i;
-
- /* classify what we've got */
- switch ((MORE()) ? PEEK() : '\0') {
- case '[':
- c = (MORE2()) ? PEEK2() : '\0';
- break;
- case '-':
- SETERROR(REG_ERANGE);
- return; /* NOTE RETURN */
- break;
- default:
- c = '\0';
- break;
- }
-
- switch (c) {
- case ':': /* character class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECTYPE);
- p_b_cclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
- break;
- case '=': /* equivalence class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
- p_b_eclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
- break;
- default: /* symbol, ordinary character, or range */
-/* xxx revision needed for multichar stuff */
- start = p_b_symbol(p);
- if (SEE('-') && MORE2() && PEEK2() != ']') {
- /* range */
- NEXT();
- if (EAT('-'))
- finish = '-';
- else
- finish = p_b_symbol(p);
- } else
- finish = start;
-/* xxx what about signed chars here... */
- REQUIRE(start <= finish, REG_ERANGE);
- for (i = start; i <= finish; i++)
- CHadd(cs, i);
- break;
- }
-}
-
-/*
- - p_b_cclass - parse a character-class name and deal with it
- == static void p_b_cclass(register struct parse *p, register cset *cs);
- */
-static void
-p_b_cclass(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char *sp = p->next;
- register struct cclass *cp;
- register size_t len;
- register char *u;
- register char c;
-
- while (MORE() && isalpha(PEEK()))
- NEXT();
- len = p->next - sp;
- for (cp = cclasses; cp->name != NULL; cp++)
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
- break;
- if (cp->name == NULL) {
- /* oops, didn't find it */
- SETERROR(REG_ECTYPE);
- return;
- }
-
- u = cp->chars;
- while ((c = *u++) != '\0')
- CHadd(cs, c);
- for (u = cp->multis; *u != '\0'; u += strlen(u) + 1)
- MCadd(p, cs, u);
-}
-
-/*
- - p_b_eclass - parse an equivalence-class name and deal with it
- == static void p_b_eclass(register struct parse *p, register cset *cs);
- *
- * This implementation is incomplete. xxx
- */
-static void
-p_b_eclass(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char c;
-
- c = p_b_coll_elem(p, '=');
- CHadd(cs, c);
-}
-
-/*
- - p_b_symbol - parse a character or [..]ed multicharacter collating symbol
- == static char p_b_symbol(register struct parse *p);
- */
-static char /* value of symbol */
-p_b_symbol(p)
-register struct parse *p;
-{
- register char value;
-
- REQUIRE(MORE(), REG_EBRACK);
- if (!EATTWO('[', '.'))
- return(GETNEXT());
-
- /* collating symbol */
- value = p_b_coll_elem(p, '.');
- REQUIRE(EATTWO('.', ']'), REG_ECOLLATE);
- return(value);
-}
-
-/*
- - p_b_coll_elem - parse a collating-element name and look it up
- == static char p_b_coll_elem(register struct parse *p, int endc);
- */
-static char /* value of collating element */
-p_b_coll_elem(p, endc)
-register struct parse *p;
-int endc; /* name ended by endc,']' */
-{
- register char *sp = p->next;
- register struct cname *cp;
- register int len;
-
- while (MORE() && !SEETWO(endc, ']'))
- NEXT();
- if (!MORE()) {
- SETERROR(REG_EBRACK);
- return(0);
- }
- len = p->next - sp;
- for (cp = cnames; cp->name != NULL; cp++)
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
- return(cp->code); /* known name */
- if (len == 1)
- return(*sp); /* single character */
- SETERROR(REG_ECOLLATE); /* neither */
- return(0);
-}
-
-/*
- - othercase - return the case counterpart of an alphabetic
- == static char othercase(int ch);
- */
-static char /* if no counterpart, return ch */
-othercase(ch)
-int ch;
-{
- assert(isalpha(ch));
- if (isupper(ch))
- return(tolower(ch));
- else if (islower(ch))
- return(toupper(ch));
- else /* peculiar, but could happen */
- return(ch);
-}
-
-/*
- - bothcases - emit a dualcase version of a two-case character
- == static void bothcases(register struct parse *p, int ch);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-bothcases(p, ch)
-register struct parse *p;
-int ch;
-{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[3];
-
- assert(othercase(ch) != ch); /* p_bracket() would recurse */
- p->next = bracket;
- p->end = bracket+2;
- bracket[0] = ch;
- bracket[1] = ']';
- bracket[2] = '\0';
- p_bracket(p);
- assert(p->next == bracket+2);
- p->next = oldnext;
- p->end = oldend;
-}
-
-/*
- - ordinary - emit an ordinary character
- == static void ordinary(register struct parse *p, register int ch);
- */
-static void
-ordinary(p, ch)
-register struct parse *p;
-register int ch;
-{
- register cat_t *cap = p->g->categories;
-
- if ((p->g->cflags&REG_ICASE) && isalpha(ch) && othercase(ch) != ch)
- bothcases(p, ch);
- else {
- EMIT(OCHAR, (unsigned char)ch);
- if (cap[ch] == 0)
- cap[ch] = p->g->ncategories++;
- }
-}
-
-/*
- - nonnewline - emit REG_NEWLINE version of OANY
- == static void nonnewline(register struct parse *p);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-nonnewline(p)
-register struct parse *p;
-{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[4];
-
- p->next = bracket;
- p->end = bracket+3;
- bracket[0] = '^';
- bracket[1] = '\n';
- bracket[2] = ']';
- bracket[3] = '\0';
- p_bracket(p);
- assert(p->next == bracket+3);
- p->next = oldnext;
- p->end = oldend;
-}
-
-/*
- - repeat - generate code for a bounded repetition, recursively if needed
- == static void repeat(register struct parse *p, sopno start, int from, int to);
- */
-static void
-repeat(p, start, from, to)
-register struct parse *p;
-sopno start; /* operand from here to end of strip */
-int from; /* repeated from this number */
-int to; /* to this number of times (maybe INFINITY) */
-{
- register sopno finish = HERE();
-# define N 2
-# define INF 3
-# define REP(f, t) ((f)*8 + (t))
-# define MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N)
- register sopno copy;
-
- if (p->error != 0) /* head off possible runaway recursion */
- return;
-
- assert(from <= to);
-
- switch (REP(MAP(from), MAP(to))) {
- case REP(0, 0): /* must be user doing this */
- DROP(finish-start); /* drop the operand */
- break;
- case REP(0, 1): /* as x{1,1}? */
- case REP(0, N): /* as x{1,n}? */
- case REP(0, INF): /* as x{1,}? */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start); /* offset is wrong... */
- repeat(p, start+1, 1, to);
- ASTERN(OOR1, start);
- AHEAD(start); /* ... fix it */
- EMIT(OOR2, 0);
- AHEAD(THERE());
- ASTERN(O_CH, THERETHERE());
- break;
- case REP(1, 1): /* trivial case */
- /* done */
- break;
- case REP(1, N): /* as x?x{1,n-1} */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start);
- ASTERN(OOR1, start);
- AHEAD(start);
- EMIT(OOR2, 0); /* offset very wrong... */
- AHEAD(THERE()); /* ...so fix it */
- ASTERN(O_CH, THERETHERE());
- copy = dupl(p, start+1, finish+1);
- assert(copy == finish+4);
- repeat(p, copy, 1, to-1);
- break;
- case REP(1, INF): /* as x+ */
- INSERT(OPLUS_, start);
- ASTERN(O_PLUS, start);
- break;
- case REP(N, N): /* as xx{m-1,n-1} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to-1);
- break;
- case REP(N, INF): /* as xx{n-1,INF} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to);
- break;
- default: /* "can't happen" */
- SETERROR(REG_ASSERT); /* just in case */
- break;
- }
-}
-
-/*
- - seterr - set an error condition
- == static int seterr(register struct parse *p, int e);
- */
-static int /* useless but makes type checking happy */
-seterr(p, e)
-register struct parse *p;
-int e;
-{
- if (p->error == 0) /* keep earliest error condition */
- p->error = e;
- p->next = nuls; /* try to bring things to a halt */
- p->end = nuls;
- return(0); /* make the return value well-defined */
-}
-
-/*
- - allocset - allocate a set of characters for []
- == static cset *allocset(register struct parse *p);
- */
-static cset *
-allocset(p)
-register struct parse *p;
-{
- register int no = p->g->ncsets++;
- register size_t nc;
- register size_t nbytes;
- register cset *cs;
- register size_t css = (size_t)p->g->csetsize;
- register int i;
-
- if (no >= p->ncsalloc) { /* need another column of space */
- p->ncsalloc += CHAR_BIT;
- nc = p->ncsalloc;
- assert(nc % CHAR_BIT == 0);
- nbytes = nc / CHAR_BIT * css;
- if (p->g->sets == NULL)
- p->g->sets = (cset *)malloc(nc * sizeof(cset));
- else
- p->g->sets = (cset *)realloc((char *)p->g->sets,
- nc * sizeof(cset));
- if (p->g->setbits == NULL)
- p->g->setbits = (uch *)malloc(nbytes);
- else {
- p->g->setbits = (uch *)realloc((char *)p->g->setbits,
- nbytes);
- /* xxx this isn't right if setbits is now NULL */
- for (i = 0; i < no; i++)
- p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT);
- }
- if (p->g->sets != NULL && p->g->setbits != NULL)
- (void) memset((char *)p->g->setbits + (nbytes - css),
- 0, css);
- else {
- no = 0;
- SETERROR(REG_ESPACE);
- /* caller's responsibility not to do set ops */
- }
- }
-
- assert(p->g->sets != NULL); /* xxx */
- cs = &p->g->sets[no];
- cs->ptr = p->g->setbits + css*((no)/CHAR_BIT);
- cs->mask = 1 << ((no) % CHAR_BIT);
- cs->hash = 0;
- cs->smultis = 0;
- cs->multis = NULL;
-
- return(cs);
-}
-
-/*
- - freeset - free a now-unused set
- == static void freeset(register struct parse *p, register cset *cs);
- */
-static void
-freeset(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register size_t i;
- register cset *top = &p->g->sets[p->g->ncsets];
- register size_t css = (size_t)p->g->csetsize;
-
- for (i = 0; i < css; i++)
- CHsub(cs, i);
- if (cs == top-1) /* recover only the easy case */
- p->g->ncsets--;
-}
-
-/*
- - freezeset - final processing on a set of characters
- == static int freezeset(register struct parse *p, register cset *cs);
- *
- * The main task here is merging identical sets. This is usually a waste
- * of time (although the hash code minimizes the overhead), but can win
- * big if REG_ICASE is being used. REG_ICASE, by the way, is why the hash
- * is done using addition rather than xor -- all ASCII [aA] sets xor to
- * the same value!
- */
-static int /* set number */
-freezeset(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register uch h = cs->hash;
- register size_t i;
- register cset *top = &p->g->sets[p->g->ncsets];
- register cset *cs2;
- register size_t css = (size_t)p->g->csetsize;
-
- /* look for an earlier one which is the same */
- for (cs2 = &p->g->sets[0]; cs2 < top; cs2++)
- if (cs2->hash == h && cs2 != cs) {
- /* maybe */
- for (i = 0; i < css; i++)
- if (!!CHIN(cs2, i) != !!CHIN(cs, i))
- break; /* no */
- if (i == css)
- break; /* yes */
- }
-
- if (cs2 < top) { /* found one */
- freeset(p, cs);
- cs = cs2;
- }
-
- return((int)(cs - p->g->sets));
-}
-
-/*
- - firstch - return first character in a set (which must have at least one)
- == static int firstch(register struct parse *p, register cset *cs);
- */
-static int /* character; there is no "none" value */
-firstch(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register size_t i;
- register size_t css = (size_t)p->g->csetsize;
-
- for (i = 0; i < css; i++)
- if (CHIN(cs, i))
- return((char)i);
- assert(never);
- return(0); /* arbitrary */
-}
-
-/*
- - nch - number of characters in a set
- == static int nch(register struct parse *p, register cset *cs);
- */
-static int
-nch(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register size_t i;
- register size_t css = (size_t)p->g->csetsize;
- register int n = 0;
-
- for (i = 0; i < css; i++)
- if (CHIN(cs, i))
- n++;
- return(n);
-}
-
-/*
- - mcadd - add a collating element to a cset
- == static void mcadd(register struct parse *p, register cset *cs, \
- == register char *cp);
- */
-static void
-mcadd(p, cs, cp)
-register struct parse *p;
-register cset *cs;
-register char *cp;
-{
- register size_t oldend = cs->smultis;
-
- cs->smultis += strlen(cp) + 1;
- if (cs->multis == NULL)
- cs->multis = malloc(cs->smultis);
- else
- cs->multis = realloc(cs->multis, cs->smultis);
- if (cs->multis == NULL) {
- SETERROR(REG_ESPACE);
- return;
- }
-
- (void) strcpy(cs->multis + oldend - 1, cp);
- cs->multis[cs->smultis - 1] = '\0';
-}
-
-#if 0
-/*
- - mcsub - subtract a collating element from a cset
- == static void mcsub(register cset *cs, register char *cp);
- */
-static void
-mcsub(cs, cp)
-register cset *cs;
-register char *cp;
-{
- register char *fp = mcfind(cs, cp);
- register size_t len = strlen(fp);
-
- assert(fp != NULL);
- (void) memmove(fp, fp + len + 1,
- cs->smultis - (fp + len + 1 - cs->multis));
- cs->smultis -= len;
-
- if (cs->smultis == 0) {
- free(cs->multis);
- cs->multis = NULL;
- return;
- }
-
- cs->multis = realloc(cs->multis, cs->smultis);
- assert(cs->multis != NULL);
-}
-
-/*
- - mcin - is a collating element in a cset?
- == static int mcin(register cset *cs, register char *cp);
- */
-static int
-mcin(cs, cp)
-register cset *cs;
-register char *cp;
-{
- return(mcfind(cs, cp) != NULL);
-}
-
-
-/*
- - mcfind - find a collating element in a cset
- == static char *mcfind(register cset *cs, register char *cp);
- */
-static char *
-mcfind(cs, cp)
-register cset *cs;
-register char *cp;
-{
- register char *p;
-
- if (cs->multis == NULL)
- return(NULL);
- for (p = cs->multis; *p != '\0'; p += strlen(p) + 1)
- if (strcmp(cp, p) == 0)
- return(p);
- return(NULL);
-}
-#endif
-
-/*
- - mcinvert - invert the list of collating elements in a cset
- == static void mcinvert(register struct parse *p, register cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-static void
-mcinvert(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - mccase - add case counterparts of the list of collating elements in a cset
- == static void mccase(register struct parse *p, register cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-static void
-mccase(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - isinsets - is this character in any sets?
- == static int isinsets(register struct re_guts *g, int c);
- */
-static int /* predicate */
-isinsets(g, c)
-register struct re_guts *g;
-int c;
-{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
- register unsigned uc = (unsigned char)c;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc] != 0)
- return(1);
- return(0);
-}
-
-/*
- - samesets - are these two characters in exactly the same sets?
- == static int samesets(register struct re_guts *g, int c1, int c2);
- */
-static int /* predicate */
-samesets(g, c1, c2)
-register struct re_guts *g;
-int c1;
-int c2;
-{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
- register unsigned uc1 = (unsigned char)c1;
- register unsigned uc2 = (unsigned char)c2;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc1] != col[uc2])
- return(0);
- return(1);
-}
-
-/*
- - categorize - sort out character categories
- == static void categorize(struct parse *p, register struct re_guts *g);
- */
-static void
-categorize(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register cat_t *cats = g->categories;
- register int c;
- register int c2;
- register cat_t cat;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (cats[c] == 0 && isinsets(g, c)) {
- cat = g->ncategories++;
- cats[c] = cat;
- for (c2 = c+1; c2 <= CHAR_MAX; c2++)
- if (cats[c2] == 0 && samesets(g, c, c2))
- cats[c2] = cat;
- }
-}
-
-/*
- - dupl - emit a duplicate of a bunch of sops
- == static sopno dupl(register struct parse *p, sopno start, sopno finish);
- */
-static sopno /* start of duplicate */
-dupl(p, start, finish)
-register struct parse *p;
-sopno start; /* from here */
-sopno finish; /* to this less one */
-{
- register sopno ret = HERE();
- register sopno len = finish - start;
-
- assert(finish >= start);
- if (len == 0)
- return(ret);
- enlarge(p, p->ssize + len); /* this many unexpected additions */
- assert(p->ssize >= p->slen + len);
- (void) memcpy((char *)(p->strip + p->slen),
- (char *)(p->strip + start), (size_t)len*sizeof(sop));
- p->slen += len;
- return(ret);
-}
-
-/*
- - doemit - emit a strip operator
- == static void doemit(register struct parse *p, sop op, size_t opnd);
- *
- * It might seem better to implement this as a macro with a function as
- * hard-case backup, but it's just too big and messy unless there are
- * some changes to the data structures. Maybe later.
- */
-static void
-doemit(p, op, opnd)
-register struct parse *p;
-sop op;
-size_t opnd;
-{
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- /* deal with oversize operands ("can't happen", more or less) */
- assert(opnd < 1<<OPSHIFT);
-
- /* deal with undersized strip */
- if (p->slen >= p->ssize)
- enlarge(p, (p->ssize+1) / 2 * 3); /* +50% */
- assert(p->slen < p->ssize);
-
- /* finally, it's all reduced to the easy case */
- p->strip[p->slen++] = SOP(op, opnd);
-}
-
-/*
- - doinsert - insert a sop into the strip
- == static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos);
- */
-static void
-doinsert(p, op, opnd, pos)
-register struct parse *p;
-sop op;
-size_t opnd;
-sopno pos;
-{
- register sopno sn;
- register sop s;
- register int i;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- sn = HERE();
- EMIT(op, opnd); /* do checks, ensure space */
- assert(HERE() == sn+1);
- s = p->strip[sn];
-
- /* adjust paren pointers */
- assert(pos > 0);
- for (i = 1; i < NPAREN; i++) {
- if (p->pbegin[i] >= pos) {
- p->pbegin[i]++;
- }
- if (p->pend[i] >= pos) {
- p->pend[i]++;
- }
- }
-
- memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos],
- (HERE()-pos-1)*sizeof(sop));
- p->strip[pos] = s;
-}
-
-/*
- - dofwd - complete a forward reference
- == static void dofwd(register struct parse *p, sopno pos, sop value);
- */
-static void
-dofwd(p, pos, value)
-register struct parse *p;
-register sopno pos;
-sop value;
-{
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- assert(value < 1<<OPSHIFT);
- p->strip[pos] = OP(p->strip[pos]) | value;
-}
-
-/*
- - enlarge - enlarge the strip
- == static void enlarge(register struct parse *p, sopno size);
- */
-static void
-enlarge(p, size)
-register struct parse *p;
-register sopno size;
-{
- register sop *sp;
-
- if (p->ssize >= size)
- return;
-
- sp = (sop *)realloc(p->strip, size*sizeof(sop));
- if (sp == NULL) {
- SETERROR(REG_ESPACE);
- return;
- }
- p->strip = sp;
- p->ssize = size;
-}
-
-/*
- - stripsnug - compact the strip
- == static void stripsnug(register struct parse *p, register struct re_guts *g);
- */
-static void
-stripsnug(p, g)
-register struct parse *p;
-register struct re_guts *g;
-{
- g->nstates = p->slen;
- g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop));
- if (g->strip == NULL) {
- SETERROR(REG_ESPACE);
- g->strip = p->strip;
- }
-}
-
-/*
- - findmust - fill in must and mlen with longest mandatory literal string
- == static void findmust(register struct parse *p, register struct re_guts *g);
- *
- * This algorithm could do fancy things like analyzing the operands of |
- * for common subsequences. Someday. This code is simple and finds most
- * of the interesting cases.
- *
- * Note that must and mlen got initialized during setup.
- */
-static void
-findmust(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register sop *scan;
- sop *start = NULL;
- register sop *newstart = NULL;
- register sopno newlen;
- register sop s;
- register char *cp;
- register sopno i;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- /* find the longest OCHAR sequence in strip */
- newlen = 0;
- scan = g->strip + 1;
- do {
- s = *scan++;
- switch (OP(s)) {
- case OCHAR: /* sequence member */
- if (newlen == 0) /* new sequence */
- newstart = scan - 1;
- newlen++;
- break;
- case OPLUS_: /* things that don't break one */
- case OLPAREN:
- case ORPAREN:
- break;
- case OQUEST_: /* things that must be skipped */
- case OCH_:
- scan--;
- do {
- scan += OPND(s);
- s = *scan;
- /* assert() interferes w debug printouts */
- if (OP(s) != O_QUEST && OP(s) != O_CH &&
- OP(s) != OOR2) {
- g->iflags |= BAD;
- return;
- }
- } while (OP(s) != O_QUEST && OP(s) != O_CH);
- /* fallthrough */
- default: /* things that break a sequence */
- if (newlen > g->mlen) { /* ends one */
- start = newstart;
- g->mlen = newlen;
- }
- newlen = 0;
- break;
- }
- } while (OP(s) != OEND);
-
- if (g->mlen == 0) /* there isn't one */
- return;
-
- /* turn it into a character string */
- g->must = malloc((size_t)g->mlen + 1);
- if (g->must == NULL) { /* argh; just forget it */
- g->mlen = 0;
- return;
- }
- cp = g->must;
- scan = start;
- for (i = g->mlen; i > 0; i--) {
- while (OP(s = *scan++) != OCHAR)
- continue;
- assert(cp < g->must + g->mlen);
- *cp++ = (char)OPND(s);
- }
- assert(cp == g->must + g->mlen);
- *cp++ = '\0'; /* just on general principles */
-}
-
-/*
- - pluscount - count + nesting
- == static sopno pluscount(register struct parse *p, register struct re_guts *g);
- */
-static sopno /* nesting depth */
-pluscount(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register sop *scan;
- register sop s;
- register sopno plusnest = 0;
- register sopno maxnest = 0;
-
- if (p->error != 0)
- return(0); /* there may not be an OEND */
-
- scan = g->strip + 1;
- do {
- s = *scan++;
- switch (OP(s)) {
- case OPLUS_:
- plusnest++;
- break;
- case O_PLUS:
- if (plusnest > maxnest)
- maxnest = plusnest;
- plusnest--;
- break;
- }
- } while (OP(s) != OEND);
- if (plusnest != 0)
- g->iflags |= BAD;
- return(maxnest);
-}
diff --git a/ext/ereg/regex/regcomp.ih b/ext/ereg/regex/regcomp.ih
deleted file mode 100644
index 6efafebf60..0000000000
--- a/ext/ereg/regex/regcomp.ih
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regcomp.c === */
-static void p_ere(register struct parse *p, int stop);
-static void p_ere_exp(register struct parse *p);
-static void p_str(register struct parse *p);
-static void p_bre(register struct parse *p, register int end1, register int end2);
-static int p_simp_re(register struct parse *p, int starordinary);
-static int p_count(register struct parse *p);
-static void p_bracket(register struct parse *p);
-static void p_b_term(register struct parse *p, register cset *cs);
-static void p_b_cclass(register struct parse *p, register cset *cs);
-static void p_b_eclass(register struct parse *p, register cset *cs);
-static char p_b_symbol(register struct parse *p);
-static char p_b_coll_elem(register struct parse *p, int endc);
-static char othercase(int ch);
-static void bothcases(register struct parse *p, int ch);
-static void ordinary(register struct parse *p, register int ch);
-static void nonnewline(register struct parse *p);
-static void repeat(register struct parse *p, sopno start, int from, int to);
-static int seterr(register struct parse *p, int e);
-static cset *allocset(register struct parse *p);
-static void freeset(register struct parse *p, register cset *cs);
-static int freezeset(register struct parse *p, register cset *cs);
-static int firstch(register struct parse *p, register cset *cs);
-static int nch(register struct parse *p, register cset *cs);
-static void mcadd(register struct parse *p, register cset *cs, register char *cp);
-#if 0
-static void mcsub(register cset *cs, register char *cp);
-static int mcin(register cset *cs, register char *cp);
-static char *mcfind(register cset *cs, register char *cp);
-#endif
-static void mcinvert(register struct parse *p, register cset *cs);
-static void mccase(register struct parse *p, register cset *cs);
-static int isinsets(register struct re_guts *g, int c);
-static int samesets(register struct re_guts *g, int c1, int c2);
-static void categorize(struct parse *p, register struct re_guts *g);
-static sopno dupl(register struct parse *p, sopno start, sopno finish);
-static void doemit(register struct parse *p, sop op, size_t opnd);
-static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos);
-static void dofwd(register struct parse *p, sopno pos, sop value);
-static void enlarge(register struct parse *p, sopno size);
-static void stripsnug(register struct parse *p, register struct re_guts *g);
-static void findmust(register struct parse *p, register struct re_guts *g);
-static sopno pluscount(register struct parse *p, register struct re_guts *g);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/ext/ereg/regex/regerror.c b/ext/ereg/regex/regerror.c
deleted file mode 100644
index bf71e3a814..0000000000
--- a/ext/ereg/regex/regerror.c
+++ /dev/null
@@ -1,126 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regerror.ih"
-
-/*
- = #define REG_OKAY 0
- = #define REG_NOMATCH 1
- = #define REG_BADPAT 2
- = #define REG_ECOLLATE 3
- = #define REG_ECTYPE 4
- = #define REG_EESCAPE 5
- = #define REG_ESUBREG 6
- = #define REG_EBRACK 7
- = #define REG_EPAREN 8
- = #define REG_EBRACE 9
- = #define REG_BADBR 10
- = #define REG_ERANGE 11
- = #define REG_ESPACE 12
- = #define REG_BADRPT 13
- = #define REG_EMPTY 14
- = #define REG_ASSERT 15
- = #define REG_INVARG 16
- = #define REG_ATOI 255 // convert name to number (!)
- = #define REG_ITOA 0400 // convert number to name (!)
- */
-static struct rerr {
- int code;
- char *name;
- char *explain;
-} rerrs[] = {
- {REG_OKAY, "REG_OKAY", "no errors detected"},
- {REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match"},
- {REG_BADPAT, "REG_BADPAT", "invalid regular expression"},
- {REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element"},
- {REG_ECTYPE, "REG_ECTYPE", "invalid character class"},
- {REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)"},
- {REG_ESUBREG, "REG_ESUBREG", "invalid backreference number"},
- {REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced"},
- {REG_EPAREN, "REG_EPAREN", "parentheses not balanced"},
- {REG_EBRACE, "REG_EBRACE", "braces not balanced"},
- {REG_BADBR, "REG_BADBR", "invalid repetition count(s)"},
- {REG_ERANGE, "REG_ERANGE", "invalid character range"},
- {REG_ESPACE, "REG_ESPACE", "out of memory"},
- {REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid"},
- {REG_EMPTY, "REG_EMPTY", "empty (sub)expression"},
- {REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug"},
- {REG_INVARG, "REG_INVARG", "invalid argument to regex routine"},
- {-1, "", "*** unknown regexp error code ***"},
-};
-
-/*
- - regerror - the interface to error numbers
- = API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
- */
-/* ARGSUSED */
-API_EXPORT(size_t)
-regerror(errcode, preg, errbuf, errbuf_size)
-int errcode;
-const regex_t *preg;
-char *errbuf;
-size_t errbuf_size;
-{
- register struct rerr *r;
- register size_t len;
- register int target = errcode &~ REG_ITOA;
- register char *s;
- char convbuf[50];
-
- if (errcode == REG_ATOI)
- s = regatoi(preg, convbuf);
- else {
- for (r = rerrs; r->code >= 0; r++)
- if (r->code == target)
- break;
-
- if (errcode&REG_ITOA) {
- if (r->code >= 0)
- (void) strcpy(convbuf, r->name);
- else
- sprintf(convbuf, "REG_0x%x", target);
- assert(strlen(convbuf) < sizeof(convbuf));
- s = convbuf;
- } else
- s = r->explain;
- }
-
- len = strlen(s) + 1;
- if (errbuf_size > 0) {
- if (errbuf_size > len)
- (void) strcpy(errbuf, s);
- else {
- (void) strncpy(errbuf, s, errbuf_size-1);
- errbuf[errbuf_size-1] = '\0';
- }
- }
-
- return(len);
-}
-
-/*
- - regatoi - internal routine to implement REG_ATOI
- == static char *regatoi(const regex_t *preg, char *localbuf);
- */
-static char *
-regatoi(preg, localbuf)
-const regex_t *preg;
-char *localbuf;
-{
- register struct rerr *r;
-
- for (r = rerrs; r->code >= 0; r++)
- if (strcmp(r->name, preg->re_endp) == 0)
- break;
- if (r->code < 0)
- return("0");
-
- sprintf(localbuf, "%d", r->code);
- return(localbuf);
-}
diff --git a/ext/ereg/regex/regerror.ih b/ext/ereg/regex/regerror.ih
deleted file mode 100644
index 2cb668c24f..0000000000
--- a/ext/ereg/regex/regerror.ih
+++ /dev/null
@@ -1,12 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regerror.c === */
-static char *regatoi(const regex_t *preg, char *localbuf);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/ext/ereg/regex/regex.3 b/ext/ereg/regex/regex.3
deleted file mode 100644
index 100c8a7f71..0000000000
--- a/ext/ereg/regex/regex.3
+++ /dev/null
@@ -1,502 +0,0 @@
-.TH REGEX 3 "17 May 1993"
-.BY "Henry Spencer"
-.de ZR
-.\" one other place knows this name: the SEE ALSO section
-.IR regex (7) \\$1
-..
-.SH NAME
-regcomp, regexec, regerror, regfree \- regular-expression library
-.SH SYNOPSIS
-.ft B
-.\".na
-#include <sys/types.h>
-.br
-#include <regex.h>
-.HP 10
-int regcomp(regex_t\ *preg, const\ char\ *pattern, int\ cflags);
-.HP
-int\ regexec(const\ regex_t\ *preg, const\ char\ *string,
-size_t\ nmatch, regmatch_t\ pmatch[], int\ eflags);
-.HP
-size_t\ regerror(int\ errcode, const\ regex_t\ *preg,
-char\ *errbuf, size_t\ errbuf_size);
-.HP
-void\ regfree(regex_t\ *preg);
-.\".ad
-.ft
-.SH DESCRIPTION
-These routines implement POSIX 1003.2 regular expressions (``RE''s);
-see
-.ZR .
-.I Regcomp
-compiles an RE written as a string into an internal form,
-.I regexec
-matches that internal form against a string and reports results,
-.I regerror
-transforms error codes from either into human-readable messages,
-and
-.I regfree
-frees any dynamically-allocated storage used by the internal form
-of an RE.
-.PP
-The header
-.I <regex.h>
-declares two structure types,
-.I regex_t
-and
-.IR regmatch_t ,
-the former for compiled internal forms and the latter for match reporting.
-It also declares the four functions,
-a type
-.IR regoff_t ,
-and a number of constants with names starting with ``REG_''.
-.PP
-.I Regcomp
-compiles the regular expression contained in the
-.I pattern
-string,
-subject to the flags in
-.IR cflags ,
-and places the results in the
-.I regex_t
-structure pointed to by
-.IR preg .
-.I Cflags
-is the bitwise OR of zero or more of the following flags:
-.IP REG_EXTENDED \w'REG_EXTENDED'u+2n
-Compile modern (``extended'') REs,
-rather than the obsolete (``basic'') REs that
-are the default.
-.IP REG_BASIC
-This is a synonym for 0,
-provided as a counterpart to REG_EXTENDED to improve readability.
-.IP REG_NOSPEC
-Compile with recognition of all special characters turned off.
-All characters are thus considered ordinary,
-so the ``RE'' is a literal string.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-REG_EXTENDED and REG_NOSPEC may not be used
-in the same call to
-.IR regcomp .
-.IP REG_ICASE
-Compile for matching that ignores upper/lower case distinctions.
-See
-.ZR .
-.IP REG_NOSUB
-Compile for matching that need only report success or failure,
-not what was matched.
-.IP REG_NEWLINE
-Compile for newline-sensitive matching.
-By default, newline is a completely ordinary character with no special
-meaning in either REs or strings.
-With this flag,
-`[^' bracket expressions and `.' never match newline,
-a `^' anchor matches the null string after any newline in the string
-in addition to its normal function,
-and the `$' anchor matches the null string before any newline in the
-string in addition to its normal function.
-.IP REG_PEND
-The regular expression ends,
-not at the first NUL,
-but just before the character pointed to by the
-.I re_endp
-member of the structure pointed to by
-.IR preg .
-The
-.I re_endp
-member is of type
-.IR const\ char\ * .
-This flag permits inclusion of NULs in the RE;
-they are considered ordinary characters.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
-When successful,
-.I regcomp
-returns 0 and fills in the structure pointed to by
-.IR preg .
-One member of that structure
-(other than
-.IR re_endp )
-is publicized:
-.IR re_nsub ,
-of type
-.IR size_t ,
-contains the number of parenthesized subexpressions within the RE
-(except that the value of this member is undefined if the
-REG_NOSUB flag was used).
-If
-.I regcomp
-fails, it returns a non-zero error code;
-see DIAGNOSTICS.
-.PP
-.I Regexec
-matches the compiled RE pointed to by
-.I preg
-against the
-.IR string ,
-subject to the flags in
-.IR eflags ,
-and reports results using
-.IR nmatch ,
-.IR pmatch ,
-and the returned value.
-The RE must have been compiled by a previous invocation of
-.IR regcomp .
-The compiled form is not altered during execution of
-.IR regexec ,
-so a single compiled RE can be used simultaneously by multiple threads.
-.PP
-By default,
-the NUL-terminated string pointed to by
-.I string
-is considered to be the text of an entire line, minus any terminating
-newline.
-The
-.I eflags
-argument is the bitwise OR of zero or more of the following flags:
-.IP REG_NOTBOL \w'REG_STARTEND'u+2n
-The first character of
-the string
-is not the beginning of a line, so the `^' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_NOTEOL
-The NUL terminating
-the string
-does not end a line, so the `$' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_STARTEND
-The string is considered to start at
-\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_so\fR
-and to have a terminating NUL located at
-\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_eo\fR
-(there need not actually be a NUL at that location),
-regardless of the value of
-.IR nmatch .
-See below for the definition of
-.IR pmatch
-and
-.IR nmatch .
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-Note that a non-zero \fIrm_so\fR does not imply REG_NOTBOL;
-REG_STARTEND affects only the location of the string,
-not how it is matched.
-.PP
-See
-.ZR
-for a discussion of what is matched in situations where an RE or a
-portion thereof could match any of several substrings of
-.IR string .
-.PP
-Normally,
-.I regexec
-returns 0 for success and the non-zero code REG_NOMATCH for failure.
-Other non-zero error codes may be returned in exceptional situations;
-see DIAGNOSTICS.
-.PP
-If REG_NOSUB was specified in the compilation of the RE,
-or if
-.I nmatch
-is 0,
-.I regexec
-ignores the
-.I pmatch
-argument (but see below for the case where REG_STARTEND is specified).
-Otherwise,
-.I pmatch
-points to an array of
-.I nmatch
-structures of type
-.IR regmatch_t .
-Such a structure has at least the members
-.I rm_so
-and
-.IR rm_eo ,
-both of type
-.I regoff_t
-(a signed arithmetic type at least as large as an
-.I off_t
-and a
-.IR ssize_t ),
-containing respectively the offset of the first character of a substring
-and the offset of the first character after the end of the substring.
-Offsets are measured from the beginning of the
-.I string
-argument given to
-.IR regexec .
-An empty substring is denoted by equal offsets,
-both indicating the character following the empty substring.
-.PP
-The 0th member of the
-.I pmatch
-array is filled in to indicate what substring of
-.I string
-was matched by the entire RE.
-Remaining members report what substring was matched by parenthesized
-subexpressions within the RE;
-member
-.I i
-reports subexpression
-.IR i ,
-with subexpressions counted (starting at 1) by the order of their opening
-parentheses in the RE, left to right.
-Unused entries in the array\(emcorresponding either to subexpressions that
-did not participate in the match at all, or to subexpressions that do not
-exist in the RE (that is, \fIi\fR\ > \fIpreg\fR\->\fIre_nsub\fR)\(emhave both
-.I rm_so
-and
-.I rm_eo
-set to \-1.
-If a subexpression participated in the match several times,
-the reported substring is the last one it matched.
-(Note, as an example in particular, that when the RE `(b*)+' matches `bbb',
-the parenthesized subexpression matches each of the three `b's and then
-an infinite number of empty strings following the last `b',
-so the reported substring is one of the empties.)
-.PP
-If REG_STARTEND is specified,
-.I pmatch
-must point to at least one
-.I regmatch_t
-(even if
-.I nmatch
-is 0 or REG_NOSUB was specified),
-to hold the input offsets for REG_STARTEND.
-Use for output is still entirely controlled by
-.IR nmatch ;
-if
-.I nmatch
-is 0 or REG_NOSUB was specified,
-the value of
-.IR pmatch [0]
-will not be changed by a successful
-.IR regexec .
-.PP
-.I Regerror
-maps a non-zero
-.I errcode
-from either
-.I regcomp
-or
-.I regexec
-to a human-readable, printable message.
-If
-.I preg
-is non-NULL,
-the error code should have arisen from use of
-the
-.I regex_t
-pointed to by
-.IR preg ,
-and if the error code came from
-.IR regcomp ,
-it should have been the result from the most recent
-.I regcomp
-using that
-.IR regex_t .
-.RI ( Regerror
-may be able to supply a more detailed message using information
-from the
-.IR regex_t .)
-.I Regerror
-places the NUL-terminated message into the buffer pointed to by
-.IR errbuf ,
-limiting the length (including the NUL) to at most
-.I errbuf_size
-bytes.
-If the whole message won't fit,
-as much of it as will fit before the terminating NUL is supplied.
-In any case,
-the returned value is the size of buffer needed to hold the whole
-message (including terminating NUL).
-If
-.I errbuf_size
-is 0,
-.I errbuf
-is ignored but the return value is still correct.
-.PP
-If the
-.I errcode
-given to
-.I regerror
-is first ORed with REG_ITOA,
-the ``message'' that results is the printable name of the error code,
-e.g. ``REG_NOMATCH'',
-rather than an explanation thereof.
-If
-.I errcode
-is REG_ATOI,
-then
-.I preg
-shall be non-NULL and the
-.I re_endp
-member of the structure it points to
-must point to the printable name of an error code;
-in this case, the result in
-.I errbuf
-is the decimal digits of
-the numeric value of the error code
-(0 if the name is not recognized).
-REG_ITOA and REG_ATOI are intended primarily as debugging facilities;
-they are extensions,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-Be warned also that they are considered experimental and changes are possible.
-.PP
-.I Regfree
-frees any dynamically-allocated storage associated with the compiled RE
-pointed to by
-.IR preg .
-The remaining
-.I regex_t
-is no longer a valid compiled RE
-and the effect of supplying it to
-.I regexec
-or
-.I regerror
-is undefined.
-.PP
-None of these functions references global variables except for tables
-of constants;
-all are safe for use from multiple threads if the arguments are safe.
-.SH IMPLEMENTATION CHOICES
-There are a number of decisions that 1003.2 leaves up to the implementor,
-either by explicitly saying ``undefined'' or by virtue of them being
-forbidden by the RE grammar.
-This implementation treats them as follows.
-.PP
-See
-.ZR
-for a discussion of the definition of case-independent matching.
-.PP
-There is no particular limit on the length of REs,
-except insofar as memory is limited.
-Memory usage is approximately linear in RE size, and largely insensitive
-to RE complexity, except for bounded repetitions.
-See BUGS for one short RE using them
-that will run almost any system out of memory.
-.PP
-A backslashed character other than one specifically given a magic meaning
-by 1003.2 (such magic meanings occur only in obsolete [``basic''] REs)
-is taken as an ordinary character.
-.PP
-Any unmatched [ is a REG_EBRACK error.
-.PP
-Equivalence classes cannot begin or end bracket-expression ranges.
-The endpoint of one range cannot begin another.
-.PP
-RE_DUP_MAX, the limit on repetition counts in bounded repetitions, is 255.
-.PP
-A repetition operator (?, *, +, or bounds) cannot follow another
-repetition operator.
-A repetition operator cannot begin an expression or subexpression
-or follow `^' or `|'.
-.PP
-`|' cannot appear first or last in a (sub)expression or after another `|',
-i.e. an operand of `|' cannot be an empty subexpression.
-An empty parenthesized subexpression, `()', is legal and matches an
-empty (sub)string.
-An empty string is not a legal RE.
-.PP
-A `{' followed by a digit is considered the beginning of bounds for a
-bounded repetition, which must then follow the syntax for bounds.
-A `{' \fInot\fR followed by a digit is considered an ordinary character.
-.PP
-`^' and `$' beginning and ending subexpressions in obsolete (``basic'')
-REs are anchors, not ordinary characters.
-.SH SEE ALSO
-grep(1), regex(7)
-.PP
-POSIX 1003.2, sections 2.8 (Regular Expression Notation)
-and
-B.5 (C Binding for Regular Expression Matching).
-.SH DIAGNOSTICS
-Non-zero error codes from
-.I regcomp
-and
-.I regexec
-include the following:
-.PP
-.nf
-.ta \w'REG_ECOLLATE'u+3n
-REG_NOMATCH regexec() failed to match
-REG_BADPAT invalid regular expression
-REG_ECOLLATE invalid collating element
-REG_ECTYPE invalid character class
-REG_EESCAPE \e applied to unescapable character
-REG_ESUBREG invalid backreference number
-REG_EBRACK brackets [ ] not balanced
-REG_EPAREN parentheses ( ) not balanced
-REG_EBRACE braces { } not balanced
-REG_BADBR invalid repetition count(s) in { }
-REG_ERANGE invalid character range in [ ]
-REG_ESPACE ran out of memory
-REG_BADRPT ?, *, or + operand invalid
-REG_EMPTY empty (sub)expression
-REG_ASSERT ``can't happen''\(emyou found a bug
-REG_INVARG invalid argument, e.g. negative-length string
-.fi
-.SH HISTORY
-Written by Henry Spencer at University of Toronto,
-henry@zoo.toronto.edu.
-.SH BUGS
-This is an alpha release with known defects.
-Please report problems.
-.PP
-There is one known functionality bug.
-The implementation of internationalization is incomplete:
-the locale is always assumed to be the default one of 1003.2,
-and only the collating elements etc. of that locale are available.
-.PP
-The back-reference code is subtle and doubts linger about its correctness
-in complex cases.
-.PP
-.I Regexec
-performance is poor.
-This will improve with later releases.
-.I Nmatch
-exceeding 0 is expensive;
-.I nmatch
-exceeding 1 is worse.
-.I Regexec
-is largely insensitive to RE complexity \fIexcept\fR that back
-references are massively expensive.
-RE length does matter; in particular, there is a strong speed bonus
-for keeping RE length under about 30 characters,
-with most special characters counting roughly double.
-.PP
-.I Regcomp
-implements bounded repetitions by macro expansion,
-which is costly in time and space if counts are large
-or bounded repetitions are nested.
-An RE like, say,
-`((((a{1,100}){1,100}){1,100}){1,100}){1,100}'
-will (eventually) run almost any existing machine out of swap space.
-.PP
-There are suspected problems with response to obscure error conditions.
-Notably,
-certain kinds of internal overflow,
-produced only by truly enormous REs or by multiply nested bounded repetitions,
-are probably not handled well.
-.PP
-Due to a mistake in 1003.2, things like `a)b' are legal REs because `)' is
-a special character only in the presence of a previous unmatched `('.
-This can't be fixed until the spec is fixed.
-.PP
-The standard's definition of back references is vague.
-For example, does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?
-Until the standard is clarified,
-behavior in such cases should not be relied on.
-.PP
-The implementation of word-boundary matching is a bit of a kludge,
-and bugs may lurk in combinations of word-boundary matching and anchoring.
diff --git a/ext/ereg/regex/regex.7 b/ext/ereg/regex/regex.7
deleted file mode 100644
index d89012bda1..0000000000
--- a/ext/ereg/regex/regex.7
+++ /dev/null
@@ -1,233 +0,0 @@
-.TH REGEX 7 "7 Feb 1994"
-.BY "Henry Spencer"
-.SH NAME
-regex \- POSIX 1003.2 regular expressions
-.SH DESCRIPTION
-Regular expressions (``RE''s),
-as defined in POSIX 1003.2, come in two forms:
-modern REs (roughly those of
-.IR egrep ;
-1003.2 calls these ``extended'' REs)
-and obsolete REs (roughly those of
-.IR ed ;
-1003.2 ``basic'' REs).
-Obsolete REs mostly exist for backward compatibility in some old programs;
-they will be discussed at the end.
-1003.2 leaves some aspects of RE syntax and semantics open;
-`\(dg' marks decisions on these aspects that
-may not be fully portable to other 1003.2 implementations.
-.PP
-A (modern) RE is one\(dg or more non-empty\(dg \fIbranches\fR,
-separated by `|'.
-It matches anything that matches one of the branches.
-.PP
-A branch is one\(dg or more \fIpieces\fR, concatenated.
-It matches a match for the first, followed by a match for the second, etc.
-.PP
-A piece is an \fIatom\fR possibly followed
-by a single\(dg `*', `+', `?', or \fIbound\fR.
-An atom followed by `*' matches a sequence of 0 or more matches of the atom.
-An atom followed by `+' matches a sequence of 1 or more matches of the atom.
-An atom followed by `?' matches a sequence of 0 or 1 matches of the atom.
-.PP
-A \fIbound\fR is `{' followed by an unsigned decimal integer,
-possibly followed by `,'
-possibly followed by another unsigned decimal integer,
-always followed by `}'.
-The integers must lie between 0 and RE_DUP_MAX (255\(dg) inclusive,
-and if there are two of them, the first may not exceed the second.
-An atom followed by a bound containing one integer \fIi\fR
-and no comma matches
-a sequence of exactly \fIi\fR matches of the atom.
-An atom followed by a bound
-containing one integer \fIi\fR and a comma matches
-a sequence of \fIi\fR or more matches of the atom.
-An atom followed by a bound
-containing two integers \fIi\fR and \fIj\fR matches
-a sequence of \fIi\fR through \fIj\fR (inclusive) matches of the atom.
-.PP
-An atom is a regular expression enclosed in `()' (matching a match for the
-regular expression),
-an empty set of `()' (matching the null string)\(dg,
-a \fIbracket expression\fR (see below), `.'
-(matching any single character), `^' (matching the null string at the
-beginning of a line), `$' (matching the null string at the
-end of a line), a `\e' followed by one of the characters
-`^.[$()|*+?{\e'
-(matching that character taken as an ordinary character),
-a `\e' followed by any other character\(dg
-(matching that character taken as an ordinary character,
-as if the `\e' had not been present\(dg),
-or a single character with no other significance (matching that character).
-A `{' followed by a character other than a digit is an ordinary
-character, not the beginning of a bound\(dg.
-It is illegal to end an RE with `\e'.
-.PP
-A \fIbracket expression\fR is a list of characters enclosed in `[]'.
-It normally matches any single character from the list (but see below).
-If the list begins with `^',
-it matches any single character
-(but see below) \fInot\fR from the rest of the list.
-If two characters in the list are separated by `\-', this is shorthand
-for the full \fIrange\fR of characters between those two (inclusive) in the
-collating sequence,
-e.g. `[0-9]' in ASCII matches any decimal digit.
-It is illegal\(dg for two ranges to share an
-endpoint, e.g. `a-c-e'.
-Ranges are very collating-sequence-dependent,
-and portable programs should avoid relying on them.
-.PP
-To include a literal `]' in the list, make it the first character
-(following a possible `^').
-To include a literal `\-', make it the first or last character,
-or the second endpoint of a range.
-To use a literal `\-' as the first endpoint of a range,
-enclose it in `[.' and `.]' to make it a collating element (see below).
-With the exception of these and some combinations using `[' (see next
-paragraphs), all other special characters, including `\e', lose their
-special significance within a bracket expression.
-.PP
-Within a bracket expression, a collating element (a character,
-a multi-character sequence that collates as if it were a single character,
-or a collating-sequence name for either)
-enclosed in `[.' and `.]' stands for the
-sequence of characters of that collating element.
-The sequence is a single element of the bracket expression's list.
-A bracket expression containing a multi-character collating element
-can thus match more than one character,
-e.g. if the collating sequence includes a `ch' collating element,
-then the RE `[[.ch.]]*c' matches the first five characters
-of `chchcc'.
-.PP
-Within a bracket expression, a collating element enclosed in `[=' and
-`=]' is an equivalence class, standing for the sequences of characters
-of all collating elements equivalent to that one, including itself.
-(If there are no other equivalent collating elements,
-the treatment is as if the enclosing delimiters were `[.' and `.]'.)
-For example, if o and \o'o^' are the members of an equivalence class,
-then `[[=o=]]', `[[=\o'o^'=]]', and `[o\o'o^']' are all synonymous.
-An equivalence class may not\(dg be an endpoint
-of a range.
-.PP
-Within a bracket expression, the name of a \fIcharacter class\fR enclosed
-in `[:' and `:]' stands for the list of all characters belonging to that
-class.
-Standard character class names are:
-.PP
-.RS
-.nf
-.ta 3c 6c 9c
-alnum digit punct
-alpha graph space
-blank lower upper
-cntrl print xdigit
-.fi
-.RE
-.PP
-These stand for the character classes defined in
-.IR ctype (3).
-A locale may provide others.
-A character class may not be used as an endpoint of a range.
-.PP
-There are two special cases\(dg of bracket expressions:
-the bracket expressions `[[:<:]]' and `[[:>:]]' match the null string at
-the beginning and end of a word respectively.
-A word is defined as a sequence of
-word characters
-which is neither preceded nor followed by
-word characters.
-A word character is an
-.I alnum
-character (as defined by
-.IR ctype (3))
-or an underscore.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
-In the event that an RE could match more than one substring of a given
-string,
-the RE matches the one starting earliest in the string.
-If the RE could match more than one substring starting at that point,
-it matches the longest.
-Subexpressions also match the longest possible substrings, subject to
-the constraint that the whole match be as long as possible,
-with subexpressions starting earlier in the RE taking priority over
-ones starting later.
-Note that higher-level subexpressions thus take priority over
-their lower-level component subexpressions.
-.PP
-Match lengths are measured in characters, not collating elements.
-A null string is considered longer than no match at all.
-For example,
-`bb*' matches the three middle characters of `abbbc',
-`(wee|week)(knights|nights)' matches all ten characters of `weeknights',
-when `(.*).*' is matched against `abc' the parenthesized subexpression
-matches all three characters, and
-when `(a*)*' is matched against `bc' both the whole RE and the parenthesized
-subexpression match the null string.
-.PP
-If case-independent matching is specified,
-the effect is much as if all case distinctions had vanished from the
-alphabet.
-When an alphabetic that exists in multiple cases appears as an
-ordinary character outside a bracket expression, it is effectively
-transformed into a bracket expression containing both cases,
-e.g. `x' becomes `[xX]'.
-When it appears inside a bracket expression, all case counterparts
-of it are added to the bracket expression, so that (e.g.) `[x]'
-becomes `[xX]' and `[^x]' becomes `[^xX]'.
-.PP
-No particular limit is imposed on the length of REs\(dg.
-Programs intended to be portable should not employ REs longer
-than 256 bytes,
-as an implementation can refuse to accept such REs and remain
-POSIX-compliant.
-.PP
-Obsolete (``basic'') regular expressions differ in several respects.
-`|', `+', and `?' are ordinary characters and there is no equivalent
-for their functionality.
-The delimiters for bounds are `\e{' and `\e}',
-with `{' and `}' by themselves ordinary characters.
-The parentheses for nested subexpressions are `\e(' and `\e)',
-with `(' and `)' by themselves ordinary characters.
-`^' is an ordinary character except at the beginning of the
-RE or\(dg the beginning of a parenthesized subexpression,
-`$' is an ordinary character except at the end of the
-RE or\(dg the end of a parenthesized subexpression,
-and `*' is an ordinary character if it appears at the beginning of the
-RE or the beginning of a parenthesized subexpression
-(after a possible leading `^').
-Finally, there is one new type of atom, a \fIback reference\fR:
-`\e' followed by a non-zero decimal digit \fId\fR
-matches the same sequence of characters
-matched by the \fId\fRth parenthesized subexpression
-(numbering subexpressions by the positions of their opening parentheses,
-left to right),
-so that (e.g.) `\e([bc]\e)\e1' matches `bb' or `cc' but not `bc'.
-.SH SEE ALSO
-regex(3)
-.PP
-POSIX 1003.2, section 2.8 (Regular Expression Notation).
-.SH BUGS
-Having two kinds of REs is a botch.
-.PP
-The current 1003.2 spec says that `)' is an ordinary character in
-the absence of an unmatched `(';
-this was an unintentional result of a wording error,
-and change is likely.
-Avoid relying on it.
-.PP
-Back references are a dreadful botch,
-posing major problems for efficient implementations.
-They are also somewhat vaguely defined
-(does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?).
-Avoid using them.
-.PP
-1003.2's specification of case-independent matching is vague.
-The ``one case implies all cases'' definition given above
-is current consensus among implementors as to the right interpretation.
-.PP
-The syntax for word boundaries is incredibly ugly.
diff --git a/ext/ereg/regex/regex.dsp b/ext/ereg/regex/regex.dsp
deleted file mode 100644
index e8f1ad4299..0000000000
--- a/ext/ereg/regex/regex.dsp
+++ /dev/null
@@ -1,106 +0,0 @@
-# Microsoft Developer Studio Project File - Name="regex" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=regex - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "regex - Win32 Release"
-# Name "regex - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\regcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regexec.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regfree.c
-# End Source File
-# End Target
-# End Project
diff --git a/ext/ereg/regex/regex.dsw b/ext/ereg/regex/regex.dsw
deleted file mode 100644
index 7b7df8126c..0000000000
--- a/ext/ereg/regex/regex.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 5.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "regex"=.\regex.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ext/ereg/regex/regex.h b/ext/ereg/regex/regex.h
deleted file mode 100644
index b39c5e178c..0000000000
--- a/ext/ereg/regex/regex.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef _HSREGEX_H_
-#define _HSREGEX_H_
-#ifndef _HSREGEX_H
-#define _HSREGEX_H /* never again */
-/* ========= begin header generated by ././mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regex2.h === */
-#ifdef WIN32
-#define API_EXPORT(type) __declspec(dllexport) type __stdcall
-#else
-#define API_EXPORT(type) type
-#endif
-
-typedef off_t regoff_t;
-typedef struct {
- int re_magic;
- size_t re_nsub; /* number of parenthesized subexpressions */
- const char *re_endp; /* end pointer for REG_PEND */
- struct re_guts *re_g; /* none of your business :-) */
-} regex_t;
-typedef struct {
- regoff_t rm_so; /* start of match */
- regoff_t rm_eo; /* end of match */
-} regmatch_t;
-
-
-/* === regcomp.c === */
-API_EXPORT(int) regcomp(regex_t *, const char *, int);
-#define REG_BASIC 0000
-#define REG_EXTENDED 0001
-#define REG_ICASE 0002
-#define REG_NOSUB 0004
-#define REG_NEWLINE 0010
-#define REG_NOSPEC 0020
-#define REG_PEND 0040
-#define REG_DUMP 0200
-
-
-/* === regerror.c === */
-#define REG_OKAY 0
-#define REG_NOMATCH 1
-#define REG_BADPAT 2
-#define REG_ECOLLATE 3
-#define REG_ECTYPE 4
-#define REG_EESCAPE 5
-#define REG_ESUBREG 6
-#define REG_EBRACK 7
-#define REG_EPAREN 8
-#define REG_EBRACE 9
-#define REG_BADBR 10
-#define REG_ERANGE 11
-#define REG_ESPACE 12
-#define REG_BADRPT 13
-#define REG_EMPTY 14
-#define REG_ASSERT 15
-#define REG_INVARG 16
-#define REG_ATOI 255 /* convert name to number (!) */
-#define REG_ITOA 0400 /* convert number to name (!) */
-API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
-
-
-/* === regexec.c === */
-API_EXPORT(int) regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
-#define REG_NOTBOL 00001
-#define REG_NOTEOL 00002
-#define REG_STARTEND 00004
-#define REG_TRACE 00400 /* tracing of execution */
-#define REG_LARGE 01000 /* force large representation */
-#define REG_BACKR 02000 /* force use of backref code */
-
-
-/* === regfree.c === */
-API_EXPORT(void) regfree(regex_t *);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ././mkh ========= */
-#endif
-#endif
diff --git a/ext/ereg/regex/regex.mak b/ext/ereg/regex/regex.mak
deleted file mode 100644
index b87ded340b..0000000000
--- a/ext/ereg/regex/regex.mak
+++ /dev/null
@@ -1,304 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on regex.dsp
-!IF "$(CFG)" == ""
-CFG=regex - Win32 Release
-!MESSAGE No configuration specified. Defaulting to regex - Win32 Release.
-!ENDIF
-
-!IF "$(CFG)" != "regex - Win32 Release" && "$(CFG)" != "regex - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Release"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-CPP=cl.exe
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-# Begin Custom Macros
-OutDir=.\.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\regex.lib"
-
-!ELSE
-
-ALL : "$(OUTDIR)\regex.lib"
-
-!ENDIF
-
-CLEAN :
- -@erase "$(INTDIR)\regcomp.obj"
- -@erase "$(INTDIR)\regerror.obj"
- -@erase "$(INTDIR)\regexec.obj"
- -@erase "$(INTDIR)\regfree.obj"
- -@erase "$(INTDIR)\vc50.idb"
- -@erase "$(OUTDIR)\regex.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
- /Fp"$(INTDIR)\regex.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-CPP_OBJS=.\Release/
-CPP_SBRS=.
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\regex.bsc"
-BSC32_SBRS= \
-
-LIB32=link.exe -lib
-LIB32_FLAGS=/nologo /out:"$(OUTDIR)\regex.lib"
-LIB32_OBJS= \
- "$(INTDIR)\regcomp.obj" \
- "$(INTDIR)\regerror.obj" \
- "$(INTDIR)\regexec.obj" \
- "$(INTDIR)\regfree.obj"
-
-"$(OUTDIR)\regex.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
- $(LIB32) @<<
- $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-# Begin Custom Macros
-OutDir=.\.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\regex.lib" "$(OUTDIR)\regex.bsc"
-
-!ELSE
-
-ALL : "$(OUTDIR)\regex.lib" "$(OUTDIR)\regex.bsc"
-
-!ENDIF
-
-CLEAN :
- -@erase "$(INTDIR)\regcomp.obj"
- -@erase "$(INTDIR)\regcomp.sbr"
- -@erase "$(INTDIR)\regerror.obj"
- -@erase "$(INTDIR)\regerror.sbr"
- -@erase "$(INTDIR)\regexec.obj"
- -@erase "$(INTDIR)\regexec.sbr"
- -@erase "$(INTDIR)\regfree.obj"
- -@erase "$(INTDIR)\regfree.sbr"
- -@erase "$(INTDIR)\vc50.idb"
- -@erase "$(OUTDIR)\regex.bsc"
- -@erase "$(OUTDIR)\regex.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /MDd /W3 /GX /Z7 /Od /I "." /D "WIN32" /D "_DEBUG" /D\
- "_WINDOWS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\regex.pch" /YX /Fo"$(INTDIR)\\"\
- /Fd"$(INTDIR)\\" /FD /c
-CPP_OBJS=.\Debug/
-CPP_SBRS=.\Debug/
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\regex.bsc"
-BSC32_SBRS= \
- "$(INTDIR)\regcomp.sbr" \
- "$(INTDIR)\regerror.sbr" \
- "$(INTDIR)\regexec.sbr" \
- "$(INTDIR)\regfree.sbr"
-
-"$(OUTDIR)\regex.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
- $(BSC32) @<<
- $(BSC32_FLAGS) $(BSC32_SBRS)
-<<
-
-LIB32=link.exe -lib
-LIB32_FLAGS=/nologo /out:"$(OUTDIR)\regex.lib"
-LIB32_OBJS= \
- "$(INTDIR)\regcomp.obj" \
- "$(INTDIR)\regerror.obj" \
- "$(INTDIR)\regexec.obj" \
- "$(INTDIR)\regfree.obj"
-
-"$(OUTDIR)\regex.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
- $(LIB32) @<<
- $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
-<<
-
-!ENDIF
-
-.c{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-
-!IF "$(CFG)" == "regex - Win32 Release" || "$(CFG)" == "regex - Win32 Debug"
-SOURCE=.\regcomp.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGCO=\
- ".\cclass.h"\
- ".\cname.h"\
- ".\regcomp.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regcomp.obj" : $(SOURCE) $(DEP_CPP_REGCO) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGCO=\
- ".\cclass.h"\
- ".\cname.h"\
- ".\regcomp.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regcomp.obj" "$(INTDIR)\regcomp.sbr" : $(SOURCE) $(DEP_CPP_REGCO)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\regerror.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGER=\
- ".\regerror.ih"\
- ".\regex.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regerror.obj" : $(SOURCE) $(DEP_CPP_REGER) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGER=\
- ".\regerror.ih"\
- ".\regex.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regerror.obj" "$(INTDIR)\regerror.sbr" : $(SOURCE) $(DEP_CPP_REGER)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\regexec.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGEX=\
- ".\engine.c"\
- ".\engine.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regexec.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGEX=\
- ".\engine.c"\
- ".\engine.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regexec.obj" "$(INTDIR)\regexec.sbr" : $(SOURCE) $(DEP_CPP_REGEX)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\regfree.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGFR=\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regfree.obj" : $(SOURCE) $(DEP_CPP_REGFR) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGFR=\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regfree.obj" "$(INTDIR)\regfree.sbr" : $(SOURCE) $(DEP_CPP_REGFR)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\engine.c
-
-!ENDIF
-
diff --git a/ext/ereg/regex/regex2.h b/ext/ereg/regex/regex2.h
deleted file mode 100644
index 7cd39a59ae..0000000000
--- a/ext/ereg/regex/regex2.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * First, the stuff that ends up in the outside-world include file
- = #ifdef WIN32
- = #define API_EXPORT(type) __declspec(dllexport) type __stdcall
- = #else
- = #define API_EXPORT(type) type
- = #endif
- =
- = typedef off_t regoff_t;
- = typedef struct {
- = int re_magic;
- = size_t re_nsub; // number of parenthesized subexpressions
- = const char *re_endp; // end pointer for REG_PEND
- = struct re_guts *re_g; // none of your business :-)
- = } regex_t;
- = typedef struct {
- = regoff_t rm_so; // start of match
- = regoff_t rm_eo; // end of match
- = } regmatch_t;
- */
-/*
- * internals of regex_t
- */
-#define MAGIC1 ((('r'^0200)<<8) | 'e')
-
-/*
- * The internal representation is a *strip*, a sequence of
- * operators ending with an endmarker. (Some terminology etc. is a
- * historical relic of earlier versions which used multiple strips.)
- * Certain oddities in the representation are there to permit running
- * the machinery backwards; in particular, any deviation from sequential
- * flow must be marked at both its source and its destination. Some
- * fine points:
- *
- * - OPLUS_ and O_PLUS are *inside* the loop they create.
- * - OQUEST_ and O_QUEST are *outside* the bypass they create.
- * - OCH_ and O_CH are *outside* the multi-way branch they create, while
- * OOR1 and OOR2 are respectively the end and the beginning of one of
- * the branches. Note that there is an implicit OOR2 following OCH_
- * and an implicit OOR1 preceding O_CH.
- *
- * In state representations, an operator's bit is on to signify a state
- * immediately *preceding* "execution" of that operator.
- */
-typedef long sop; /* strip operator */
-typedef long sopno;
-#define OPRMASK 0x7c000000
-#define OPDMASK 0x03ffffff
-#define OPSHIFT (26)
-#define OP(n) ((n)&OPRMASK)
-#define OPND(n) ((n)&OPDMASK)
-#define SOP(op, opnd) ((op)|(opnd))
-/* operators meaning operand */
-/* (back, fwd are offsets) */
-#define OEND (1<<OPSHIFT) /* endmarker - */
-#define OCHAR (2<<OPSHIFT) /* character unsigned char */
-#define OBOL (3<<OPSHIFT) /* left anchor - */
-#define OEOL (4<<OPSHIFT) /* right anchor - */
-#define OANY (5<<OPSHIFT) /* . - */
-#define OANYOF (6<<OPSHIFT) /* [...] set number */
-#define OBACK_ (7<<OPSHIFT) /* begin \d paren number */
-#define O_BACK (8<<OPSHIFT) /* end \d paren number */
-#define OPLUS_ (9<<OPSHIFT) /* + prefix fwd to suffix */
-#define O_PLUS (10<<OPSHIFT) /* + suffix back to prefix */
-#define OQUEST_ (11<<OPSHIFT) /* ? prefix fwd to suffix */
-#define O_QUEST (12<<OPSHIFT) /* ? suffix back to prefix */
-#define OLPAREN (13<<OPSHIFT) /* ( fwd to ) */
-#define ORPAREN (14<<OPSHIFT) /* ) back to ( */
-#define OCH_ (15<<OPSHIFT) /* begin choice fwd to OOR2 */
-#define OOR1 (16<<OPSHIFT) /* | pt. 1 back to OOR1 or OCH_ */
-#define OOR2 (17<<OPSHIFT) /* | pt. 2 fwd to OOR2 or O_CH */
-#define O_CH (18<<OPSHIFT) /* end choice back to OOR1 */
-#define OBOW (19<<OPSHIFT) /* begin word - */
-#define OEOW (20<<OPSHIFT) /* end word - */
-
-/*
- * Structure for [] character-set representation. Character sets are
- * done as bit vectors, grouped 8 to a byte vector for compactness.
- * The individual set therefore has both a pointer to the byte vector
- * and a mask to pick out the relevant bit of each byte. A hash code
- * simplifies testing whether two sets could be identical.
- *
- * This will get trickier for multicharacter collating elements. As
- * preliminary hooks for dealing with such things, we also carry along
- * a string of multi-character elements, and decide the size of the
- * vectors at run time.
- */
-typedef struct {
- uch *ptr; /* -> uch [csetsize] */
- uch mask; /* bit within array */
- uch hash; /* hash code */
- size_t smultis;
- char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */
-} cset;
-/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
-#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c))
-#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c))
-#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask)
-#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */
-#define MCsub(p, cs, cp) mcsub(p, cs, cp)
-#define MCin(p, cs, cp) mcin(p, cs, cp)
-
-/* stuff for character categories */
-typedef unsigned char cat_t;
-
-/*
- * main compiled-expression structure
- */
-struct re_guts {
- int magic;
-# define MAGIC2 ((('R'^0200)<<8)|'E')
- sop *strip; /* malloced area for strip */
- int csetsize; /* number of bits in a cset vector */
- int ncsets; /* number of csets in use */
- cset *sets; /* -> cset [ncsets] */
- uch *setbits; /* -> uch[csetsize][ncsets/CHAR_BIT] */
- int cflags; /* copy of regcomp() cflags argument */
- sopno nstates; /* = number of sops */
- sopno firststate; /* the initial OEND (normally 0) */
- sopno laststate; /* the final OEND */
- int iflags; /* internal flags */
-# define USEBOL 01 /* used ^ */
-# define USEEOL 02 /* used $ */
-# define BAD 04 /* something wrong */
- int nbol; /* number of ^ used */
- int neol; /* number of $ used */
- int ncategories; /* how many character categories */
- cat_t *categories; /* ->catspace[-CHAR_MIN] */
- char *must; /* match must contain this string */
- int mlen; /* length of must */
- size_t nsub; /* copy of re_nsub */
- int backrefs; /* does it use back references? */
- sopno nplus; /* how deep does it nest +s? */
- /* catspace must be last */
- cat_t catspace[1]; /* actually [NC] */
-};
-
-/* misc utilities */
-#define OUT (CHAR_MAX+1) /* a non-character value */
-#define ISWORD(c) (isalnum(c) || (c) == '_')
diff --git a/ext/ereg/regex/regex_extra.h b/ext/ereg/regex/regex_extra.h
deleted file mode 100644
index d668f7613f..0000000000
--- a/ext/ereg/regex/regex_extra.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* do not frame this - we must be able to include this file multiple times */
-
-#undef regexec
-#undef regerror
-#undef regfree
-#undef regcomp
-
-#if (defined(REGEX) && REGEX == 1) || (!defined(REGEX))
-
-#ifndef PHP_WIN32
-
-#ifndef PHP_NO_ALIASES
-
-#define regexec php_regexec
-#define regerror php_regerror
-#define regfree php_regfree
-#define regcomp php_regcomp
-
-#endif
-
-#endif
-
-#endif
diff --git a/ext/ereg/regex/regexec.c b/ext/ereg/regex/regexec.c
deleted file mode 100644
index 7888d02368..0000000000
--- a/ext/ereg/regex/regexec.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * the outer shell of regexec()
- *
- * This file includes engine.c *twice*, after muchos fiddling with the
- * macros that code uses. This lets the same code operate on two different
- * representations for state sets.
- */
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <ctype.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-static int nope = 0; /* for use in asserts; shuts lint up */
-
-/* macros for manipulating states, small version */
-#define states unsigned
-#define states1 unsigned /* for later use in regexec() decision */
-#define CLEAR(v) ((v) = 0)
-#define SET0(v, n) ((v) &= ~((unsigned)1 << (n)))
-#define SET1(v, n) ((v) |= (unsigned)1 << (n))
-#define ISSET(v, n) ((v) & ((unsigned)1 << (n)))
-#define ASSIGN(d, s) ((d) = (s))
-#define EQ(a, b) ((a) == (b))
-#define STATEVARS int dummy /* dummy version */
-#define STATESETUP(m, n) /* nothing */
-#define STATETEARDOWN(m) /* nothing */
-#define SETUP(v) ((v) = 0)
-#define onestate unsigned
-#define INIT(o, n) ((o) = (unsigned)1 << (n))
-#define INC(o) ((o) <<= 1)
-#define ISSTATEIN(v, o) ((v) & (o))
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define FWD(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) << (n))
-#define BACK(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) >> (n))
-#define ISSETBACK(v, n) ((v) & ((unsigned)here >> (n)))
-/* function names */
-#define SNAMES /* engine.c looks after details */
-
-#include "engine.c"
-
-/* now undo things */
-#undef states
-#undef CLEAR
-#undef SET0
-#undef SET1
-#undef ISSET
-#undef ASSIGN
-#undef EQ
-#undef STATEVARS
-#undef STATESETUP
-#undef STATETEARDOWN
-#undef SETUP
-#undef onestate
-#undef INIT
-#undef INC
-#undef ISSTATEIN
-#undef FWD
-#undef BACK
-#undef ISSETBACK
-#undef SNAMES
-
-/* macros for manipulating states, large version */
-#define states char *
-#define CLEAR(v) memset(v, 0, m->g->nstates)
-#define SET0(v, n) ((v)[n] = 0)
-#define SET1(v, n) ((v)[n] = 1)
-#define ISSET(v, n) ((v)[n])
-#define ASSIGN(d, s) memcpy(d, s, m->g->nstates)
-#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
-#define STATEVARS int vn; char *space
-#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \
- if ((m)->space == NULL) return(REG_ESPACE); \
- (m)->vn = 0; }
-#define STATETEARDOWN(m) { free((m)->space); }
-#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
-#define onestate int
-#define INIT(o, n) ((o) = (n))
-#define INC(o) ((o)++)
-#define ISSTATEIN(v, o) ((v)[o])
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here])
-#define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here])
-#define ISSETBACK(v, n) ((v)[here - (n)])
-/* function names */
-#define LNAMES /* flag */
-
-#include "engine.c"
-
-/*
- - regexec - interface for matching
- = API_EXPORT(int) regexec(const regex_t *, const char *, size_t, \
- = regmatch_t [], int);
- = #define REG_NOTBOL 00001
- = #define REG_NOTEOL 00002
- = #define REG_STARTEND 00004
- = #define REG_TRACE 00400 // tracing of execution
- = #define REG_LARGE 01000 // force large representation
- = #define REG_BACKR 02000 // force use of backref code
- *
- * We put this here so we can exploit knowledge of the state representation
- * when choosing which matcher to call. Also, by this point the matchers
- * have been prototyped.
- */
-API_EXPORT(int) /* 0 success, REG_NOMATCH failure */
-regexec(preg, string, nmatch, pmatch, eflags)
-const regex_t *preg;
-const char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
-{
- register struct re_guts *g = preg->re_g;
-#ifdef REDEBUG
-# define GOODFLAGS(f) (f)
-#else
-# define GOODFLAGS(f) ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
-#endif
-
- if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
- return(REG_BADPAT);
- assert(!(g->iflags&BAD));
- if (g->iflags&BAD) /* backstop for no-debug case */
- return(REG_BADPAT);
- eflags = GOODFLAGS(eflags);
-
- if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))
- return(smatcher(g, (char *)string, nmatch, pmatch, eflags));
- else
- return(lmatcher(g, (char *)string, nmatch, pmatch, eflags));
-}
diff --git a/ext/ereg/regex/regfree.c b/ext/ereg/regex/regfree.c
deleted file mode 100644
index 9fd618a13b..0000000000
--- a/ext/ereg/regex/regfree.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-/*
- - regfree - free everything
- = API_EXPORT(void) regfree(regex_t *);
- */
-API_EXPORT(void)
-regfree(preg)
-regex_t *preg;
-{
- register struct re_guts *g;
-
- if (preg->re_magic != MAGIC1) /* oops */
- return; /* nice to complain, but hard */
-
- g = preg->re_g;
- if (g == NULL || g->magic != MAGIC2) /* oops again */
- return;
- preg->re_magic = 0; /* mark it invalid */
- g->magic = 0; /* mark it invalid */
-
- if (g->strip != NULL)
- free((char *)g->strip);
- if (g->sets != NULL)
- free((char *)g->sets);
- if (g->setbits != NULL)
- free((char *)g->setbits);
- if (g->must != NULL)
- free(g->must);
- free((char *)g);
-}
diff --git a/ext/ereg/regex/split.c b/ext/ereg/regex/split.c
deleted file mode 100644
index 188bdb775b..0000000000
--- a/ext/ereg/regex/split.c
+++ /dev/null
@@ -1,316 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-/*
- - split - divide a string into fields, like awk split()
- = int split(char *string, char *fields[], int nfields, char *sep);
- */
-int /* number of fields, including overflow */
-split(string, fields, nfields, sep)
-char *string;
-char *fields[]; /* list is not NULL-terminated */
-int nfields; /* number of entries available in fields[] */
-char *sep; /* "" white, "c" single char, "ab" [ab]+ */
-{
- register char *p = string;
- register char c; /* latest character */
- register char sepc = sep[0];
- register char sepc2;
- register int fn;
- register char **fp = fields;
- register char *sepp;
- register int trimtrail;
-
- /* white space */
- if (sepc == '\0') {
- while ((c = *p++) == ' ' || c == '\t')
- continue;
- p--;
- trimtrail = 1;
- sep = " \t"; /* note, code below knows this is 2 long */
- sepc = ' ';
- } else
- trimtrail = 0;
- sepc2 = sep[1]; /* now we can safely pick this up */
-
- /* catch empties */
- if (*p == '\0')
- return(0);
-
- /* single separator */
- if (sepc2 == '\0') {
- fn = nfields;
- for (;;) {
- *fp++ = p;
- fn--;
- if (fn == 0)
- break;
- while ((c = *p++) != sepc)
- if (c == '\0')
- return(nfields - fn);
- *(p-1) = '\0';
- }
- /* we have overflowed the fields vector -- just count them */
- fn = nfields;
- for (;;) {
- while ((c = *p++) != sepc)
- if (c == '\0')
- return(fn);
- fn++;
- }
- /* not reached */
- }
-
- /* two separators */
- if (sep[2] == '\0') {
- fn = nfields;
- for (;;) {
- *fp++ = p;
- fn--;
- while ((c = *p++) != sepc && c != sepc2)
- if (c == '\0') {
- if (trimtrail && **(fp-1) == '\0')
- fn++;
- return(nfields - fn);
- }
- if (fn == 0)
- break;
- *(p-1) = '\0';
- while ((c = *p++) == sepc || c == sepc2)
- continue;
- p--;
- }
- /* we have overflowed the fields vector -- just count them */
- fn = nfields;
- while (c != '\0') {
- while ((c = *p++) == sepc || c == sepc2)
- continue;
- p--;
- fn++;
- while ((c = *p++) != '\0' && c != sepc && c != sepc2)
- continue;
- }
- /* might have to trim trailing white space */
- if (trimtrail) {
- p--;
- while ((c = *--p) == sepc || c == sepc2)
- continue;
- p++;
- if (*p != '\0') {
- if (fn == nfields+1)
- *p = '\0';
- fn--;
- }
- }
- return(fn);
- }
-
- /* n separators */
- fn = 0;
- for (;;) {
- if (fn < nfields)
- *fp++ = p;
- fn++;
- for (;;) {
- c = *p++;
- if (c == '\0')
- return(fn);
- sepp = sep;
- while ((sepc = *sepp++) != '\0' && sepc != c)
- continue;
- if (sepc != '\0') /* it was a separator */
- break;
- }
- if (fn < nfields)
- *(p-1) = '\0';
- for (;;) {
- c = *p++;
- sepp = sep;
- while ((sepc = *sepp++) != '\0' && sepc != c)
- continue;
- if (sepc == '\0') /* it wasn't a separator */
- break;
- }
- p--;
- }
-
- /* not reached */
-}
-
-#ifdef TEST_SPLIT
-
-
-/*
- * test program
- * pgm runs regression
- * pgm sep splits stdin lines by sep
- * pgm str sep splits str by sep
- * pgm str sep n splits str by sep n times
- */
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- char buf[512];
- register int n;
-# define MNF 10
- char *fields[MNF];
-
- if (argc > 4)
- for (n = atoi(argv[3]); n > 0; n--) {
- (void) strcpy(buf, argv[1]);
- }
- else if (argc > 3)
- for (n = atoi(argv[3]); n > 0; n--) {
- (void) strcpy(buf, argv[1]);
- (void) split(buf, fields, MNF, argv[2]);
- }
- else if (argc > 2)
- dosplit(argv[1], argv[2]);
- else if (argc > 1)
- while (fgets(buf, sizeof(buf), stdin) != NULL) {
- buf[strlen(buf)-1] = '\0'; /* stomp newline */
- dosplit(buf, argv[1]);
- }
- else
- regress();
-
- exit(0);
-}
-
-dosplit(string, seps)
-char *string;
-char *seps;
-{
-# define NF 5
- char *fields[NF];
- register int nf;
-
- nf = split(string, fields, NF, seps);
- print(nf, NF, fields);
-}
-
-print(nf, nfp, fields)
-int nf;
-int nfp;
-char *fields[];
-{
- register int fn;
- register int bound;
-
- bound = (nf > nfp) ? nfp : nf;
- printf("%d:\t", nf);
- for (fn = 0; fn < bound; fn++)
- printf("\"%s\"%s", fields[fn], (fn+1 < nf) ? ", " : "\n");
-}
-
-#define RNF 5 /* some table entries know this */
-struct {
- char *str;
- char *seps;
- int nf;
- char *fi[RNF];
-} tests[] = {
- "", " ", 0, { "" },
- " ", " ", 2, { "", "" },
- "x", " ", 1, { "x" },
- "xy", " ", 1, { "xy" },
- "x y", " ", 2, { "x", "y" },
- "abc def g ", " ", 5, { "abc", "def", "", "g", "" },
- " a bcd", " ", 4, { "", "", "a", "bcd" },
- "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " ", 6, { "", "a", "b", "c", "d " },
-
- "", " _", 0, { "" },
- " ", " _", 2, { "", "" },
- "x", " _", 1, { "x" },
- "x y", " _", 2, { "x", "y" },
- "ab _ cd", " _", 2, { "ab", "cd" },
- " a_b c ", " _", 5, { "", "a", "b", "c", "" },
- "a b c_d e f", " _", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " _", 6, { "", "a", "b", "c", "d " },
-
- "", " _~", 0, { "" },
- " ", " _~", 2, { "", "" },
- "x", " _~", 1, { "x" },
- "x y", " _~", 2, { "x", "y" },
- "ab _~ cd", " _~", 2, { "ab", "cd" },
- " a_b c~", " _~", 5, { "", "a", "b", "c", "" },
- "a b_c d~e f", " _~", 6, { "a", "b", "c", "d", "e f" },
- "~a b c d ", " _~", 6, { "", "a", "b", "c", "d " },
-
- "", " _~-", 0, { "" },
- " ", " _~-", 2, { "", "" },
- "x", " _~-", 1, { "x" },
- "x y", " _~-", 2, { "x", "y" },
- "ab _~- cd", " _~-", 2, { "ab", "cd" },
- " a_b c~", " _~-", 5, { "", "a", "b", "c", "" },
- "a b_c-d~e f", " _~-", 6, { "a", "b", "c", "d", "e f" },
- "~a-b c d ", " _~-", 6, { "", "a", "b", "c", "d " },
-
- "", " ", 0, { "" },
- " ", " ", 2, { "", "" },
- "x", " ", 1, { "x" },
- "xy", " ", 1, { "xy" },
- "x y", " ", 2, { "x", "y" },
- "abc def g ", " ", 4, { "abc", "def", "g", "" },
- " a bcd", " ", 3, { "", "a", "bcd" },
- "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " ", 6, { "", "a", "b", "c", "d " },
-
- "", "", 0, { "" },
- " ", "", 0, { "" },
- "x", "", 1, { "x" },
- "xy", "", 1, { "xy" },
- "x y", "", 2, { "x", "y" },
- "abc def g ", "", 3, { "abc", "def", "g" },
- "\t a bcd", "", 2, { "a", "bcd" },
- " a \tb\t c ", "", 3, { "a", "b", "c" },
- "a b c d e ", "", 5, { "a", "b", "c", "d", "e" },
- "a b\tc d e f", "", 6, { "a", "b", "c", "d", "e f" },
- " a b c d e f ", "", 6, { "a", "b", "c", "d", "e f " },
-
- NULL, NULL, 0, { NULL },
-};
-
-regress()
-{
- char buf[512];
- register int n;
- char *fields[RNF+1];
- register int nf;
- register int i;
- register int printit;
- register char *f;
-
- for (n = 0; tests[n].str != NULL; n++) {
- (void) strcpy(buf, tests[n].str);
- fields[RNF] = NULL;
- nf = split(buf, fields, RNF, tests[n].seps);
- printit = 0;
- if (nf != tests[n].nf) {
- printf("split `%s' by `%s' gave %d fields, not %d\n",
- tests[n].str, tests[n].seps, nf, tests[n].nf);
- printit = 1;
- } else if (fields[RNF] != NULL) {
- printf("split() went beyond array end\n");
- printit = 1;
- } else {
- for (i = 0; i < nf && i < RNF; i++) {
- f = fields[i];
- if (f == NULL)
- f = "(NULL)";
- if (strcmp(f, tests[n].fi[i]) != 0) {
- printf("split `%s' by `%s', field %d is `%s', not `%s'\n",
- tests[n].str, tests[n].seps,
- i, fields[i], tests[n].fi[i]);
- printit = 1;
- }
- }
- }
- if (printit)
- print(nf, RNF, fields);
- }
-}
-#endif
diff --git a/ext/ereg/regex/tests b/ext/ereg/regex/tests
deleted file mode 100644
index c05846177f..0000000000
--- a/ext/ereg/regex/tests
+++ /dev/null
@@ -1,475 +0,0 @@
-# regular expression test set
-# Lines are at least three fields, separated by one or more tabs. "" stands
-# for an empty field. First field is an RE. Second field is flags. If
-# C flag given, regcomp() is expected to fail, and the third field is the
-# error name (minus the leading REG_).
-#
-# Otherwise it is expected to succeed, and the third field is the string to
-# try matching it against. If there is no fourth field, the match is
-# expected to fail. If there is a fourth field, it is the substring that
-# the RE is expected to match. If there is a fifth field, it is a comma-
-# separated list of what the subexpressions should match, with - indicating
-# no match for that one. In both the fourth and fifth fields, a (sub)field
-# starting with @ indicates that the (sub)expression is expected to match
-# a null string followed by the stuff after the @; this provides a way to
-# test where null strings match. The character `N' in REs and strings
-# is newline, `S' is space, `T' is tab, `Z' is NUL.
-#
-# The full list of flags:
-# - placeholder, does nothing
-# b RE is a BRE, not an ERE
-# & try it as both an ERE and a BRE
-# C regcomp() error expected, third field is error name
-# i REG_ICASE
-# m ("mundane") REG_NOSPEC
-# s REG_NOSUB (not really testable)
-# n REG_NEWLINE
-# ^ REG_NOTBOL
-# $ REG_NOTEOL
-# # REG_STARTEND (see below)
-# p REG_PEND
-#
-# For REG_STARTEND, the start/end offsets are those of the substring
-# enclosed in ().
-
-# basics
-a & a a
-abc & abc abc
-abc|de - abc abc
-a|b|c - abc a
-
-# parentheses and perversions thereof
-a(b)c - abc abc
-a\(b\)c b abc abc
-a( C EPAREN
-a( b a( a(
-a\( - a( a(
-a\( bC EPAREN
-a\(b bC EPAREN
-a(b C EPAREN
-a(b b a(b a(b
-# gag me with a right parenthesis -- 1003.2 goofed here (my fault, partly)
-a) - a) a)
-) - ) )
-# end gagging (in a just world, those *should* give EPAREN)
-a) b a) a)
-a\) bC EPAREN
-\) bC EPAREN
-a()b - ab ab
-a\(\)b b ab ab
-
-# anchoring and REG_NEWLINE
-^abc$ & abc abc
-a^b - a^b
-a^b b a^b a^b
-a$b - a$b
-a$b b a$b a$b
-^ & abc @abc
-$ & abc @
-^$ & "" @
-$^ - "" @
-\($\)\(^\) b "" @
-# stop retching, those are legitimate (although disgusting)
-^^ - "" @
-$$ - "" @
-b$ & abNc
-b$ &n abNc b
-^b$ & aNbNc
-^b$ &n aNbNc b
-^$ &n aNNb @Nb
-^$ n abc
-^$ n abcN @
-$^ n aNNb @Nb
-\($\)\(^\) bn aNNb @Nb
-^^ n^ aNNb @Nb
-$$ n aNNb @NN
-^a ^ a
-a$ $ a
-^a ^n aNb
-^b ^n aNb b
-a$ $n bNa
-b$ $n bNa b
-a*(^b$)c* - b b
-a*\(^b$\)c* b b b
-
-# certain syntax errors and non-errors
-| C EMPTY
-| b | |
-* C BADRPT
-* b * *
-+ C BADRPT
-? C BADRPT
-"" &C EMPTY
-() - abc @abc
-\(\) b abc @abc
-a||b C EMPTY
-|ab C EMPTY
-ab| C EMPTY
-(|a)b C EMPTY
-(a|)b C EMPTY
-(*a) C BADRPT
-(+a) C BADRPT
-(?a) C BADRPT
-({1}a) C BADRPT
-\(\{1\}a\) bC BADRPT
-(a|*b) C BADRPT
-(a|+b) C BADRPT
-(a|?b) C BADRPT
-(a|{1}b) C BADRPT
-^* C BADRPT
-^* b * *
-^+ C BADRPT
-^? C BADRPT
-^{1} C BADRPT
-^\{1\} bC BADRPT
-
-# metacharacters, backslashes
-a.c & abc abc
-a[bc]d & abd abd
-a\*c & a*c a*c
-a\\b & a\b a\b
-a\\\*b & a\*b a\*b
-a\bc & abc abc
-a\ &C EESCAPE
-a\\bc & a\bc a\bc
-\{ bC BADRPT
-a\[b & a[b a[b
-a[b &C EBRACK
-# trailing $ is a peculiar special case for the BRE code
-a$ & a a
-a$ & a$
-a\$ & a
-a\$ & a$ a$
-a\\$ & a
-a\\$ & a$
-a\\$ & a\$
-a\\$ & a\ a\
-
-# back references, ugh
-a\(b\)\2c bC ESUBREG
-a\(b\1\)c bC ESUBREG
-a\(b*\)c\1d b abbcbbd abbcbbd bb
-a\(b*\)c\1d b abbcbd
-a\(b*\)c\1d b abbcbbbd
-^\(.\)\1 b abc
-a\([bc]\)\1d b abcdabbd abbd b
-a\(\([bc]\)\2\)*d b abbccd abbccd
-a\(\([bc]\)\2\)*d b abbcbd
-# actually, this next one probably ought to fail, but the spec is unclear
-a\(\(b\)*\2\)*d b abbbd abbbd
-# here is a case that no NFA implementation does right
-\(ab*\)[ab]*\1 b ababaaa ababaaa a
-# check out normal matching in the presence of back refs
-\(a\)\1bcd b aabcd aabcd
-\(a\)\1bc*d b aabcd aabcd
-\(a\)\1bc*d b aabd aabd
-\(a\)\1bc*d b aabcccd aabcccd
-\(a\)\1bc*[ce]d b aabcccd aabcccd
-^\(a\)\1b\(c\)*cd$ b aabcccd aabcccd
-
-# ordinary repetitions
-ab*c & abc abc
-ab+c - abc abc
-ab?c - abc abc
-a\(*\)b b a*b a*b
-a\(**\)b b ab ab
-a\(***\)b bC BADRPT
-*a b *a *a
-**a b a a
-***a bC BADRPT
-
-# the dreaded bounded repetitions
-{ & { {
-{abc & {abc {abc
-{1 C BADRPT
-{1} C BADRPT
-a{b & a{b a{b
-a{1}b - ab ab
-a\{1\}b b ab ab
-a{1,}b - ab ab
-a\{1,\}b b ab ab
-a{1,2}b - aab aab
-a\{1,2\}b b aab aab
-a{1 C EBRACE
-a\{1 bC EBRACE
-a{1a C EBRACE
-a\{1a bC EBRACE
-a{1a} C BADBR
-a\{1a\} bC BADBR
-a{,2} - a{,2} a{,2}
-a\{,2\} bC BADBR
-a{,} - a{,} a{,}
-a\{,\} bC BADBR
-a{1,x} C BADBR
-a\{1,x\} bC BADBR
-a{1,x C EBRACE
-a\{1,x bC EBRACE
-a{300} C BADBR
-a\{300\} bC BADBR
-a{1,0} C BADBR
-a\{1,0\} bC BADBR
-ab{0,0}c - abcac ac
-ab\{0,0\}c b abcac ac
-ab{0,1}c - abcac abc
-ab\{0,1\}c b abcac abc
-ab{0,3}c - abbcac abbc
-ab\{0,3\}c b abbcac abbc
-ab{1,1}c - acabc abc
-ab\{1,1\}c b acabc abc
-ab{1,3}c - acabc abc
-ab\{1,3\}c b acabc abc
-ab{2,2}c - abcabbc abbc
-ab\{2,2\}c b abcabbc abbc
-ab{2,4}c - abcabbc abbc
-ab\{2,4\}c b abcabbc abbc
-((a{1,10}){1,10}){1,10} - a a a,a
-
-# multiple repetitions
-a** &C BADRPT
-a++ C BADRPT
-a?? C BADRPT
-a*+ C BADRPT
-a*? C BADRPT
-a+* C BADRPT
-a+? C BADRPT
-a?* C BADRPT
-a?+ C BADRPT
-a{1}{1} C BADRPT
-a*{1} C BADRPT
-a+{1} C BADRPT
-a?{1} C BADRPT
-a{1}* C BADRPT
-a{1}+ C BADRPT
-a{1}? C BADRPT
-a*{b} - a{b} a{b}
-a\{1\}\{1\} bC BADRPT
-a*\{1\} bC BADRPT
-a\{1\}* bC BADRPT
-
-# brackets, and numerous perversions thereof
-a[b]c & abc abc
-a[ab]c & abc abc
-a[^ab]c & adc adc
-a[]b]c & a]c a]c
-a[[b]c & a[c a[c
-a[-b]c & a-c a-c
-a[^]b]c & adc adc
-a[^-b]c & adc adc
-a[b-]c & a-c a-c
-a[b &C EBRACK
-a[] &C EBRACK
-a[1-3]c & a2c a2c
-a[3-1]c &C ERANGE
-a[1-3-5]c &C ERANGE
-a[[.-.]--]c & a-c a-c
-a[1- &C ERANGE
-a[[. &C EBRACK
-a[[.x &C EBRACK
-a[[.x. &C EBRACK
-a[[.x.] &C EBRACK
-a[[.x.]] & ax ax
-a[[.x,.]] &C ECOLLATE
-a[[.one.]]b & a1b a1b
-a[[.notdef.]]b &C ECOLLATE
-a[[.].]]b & a]b a]b
-a[[:alpha:]]c & abc abc
-a[[:notdef:]]c &C ECTYPE
-a[[: &C EBRACK
-a[[:alpha &C EBRACK
-a[[:alpha:] &C EBRACK
-a[[:alpha,:] &C ECTYPE
-a[[:]:]]b &C ECTYPE
-a[[:-:]]b &C ECTYPE
-a[[:alph:]] &C ECTYPE
-a[[:alphabet:]] &C ECTYPE
-[[:alnum:]]+ - -%@a0X- a0X
-[[:alpha:]]+ - -%@aX0- aX
-[[:blank:]]+ - aSSTb SST
-[[:cntrl:]]+ - aNTb NT
-[[:digit:]]+ - a019b 019
-[[:graph:]]+ - Sa%bS a%b
-[[:lower:]]+ - AabC ab
-[[:print:]]+ - NaSbN aSb
-[[:punct:]]+ - S%-&T %-&
-[[:space:]]+ - aSNTb SNT
-[[:upper:]]+ - aBCd BC
-[[:xdigit:]]+ - p0f3Cq 0f3C
-a[[=b=]]c & abc abc
-a[[= &C EBRACK
-a[[=b &C EBRACK
-a[[=b= &C EBRACK
-a[[=b=] &C EBRACK
-a[[=b,=]] &C ECOLLATE
-a[[=one=]]b & a1b a1b
-
-# complexities
-a(((b)))c - abc abc
-a(b|(c))d - abd abd
-a(b*|c)d - abbd abbd
-# just gotta have one DFA-buster, of course
-a[ab]{20} - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
-# and an inline expansion in case somebody gets tricky
-a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab] - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
-# and in case somebody just slips in an NFA...
-a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night) - aaaaabaaaabaaaabaaaabweeknights aaaaabaaaabaaaabaaaabweeknights
-# fish for anomalies as the number of states passes 32
-12345678901234567890123456789 - a12345678901234567890123456789b 12345678901234567890123456789
-123456789012345678901234567890 - a123456789012345678901234567890b 123456789012345678901234567890
-1234567890123456789012345678901 - a1234567890123456789012345678901b 1234567890123456789012345678901
-12345678901234567890123456789012 - a12345678901234567890123456789012b 12345678901234567890123456789012
-123456789012345678901234567890123 - a123456789012345678901234567890123b 123456789012345678901234567890123
-# and one really big one, beyond any plausible word width
-1234567890123456789012345678901234567890123456789012345678901234567890 - a1234567890123456789012345678901234567890123456789012345678901234567890b 1234567890123456789012345678901234567890123456789012345678901234567890
-# fish for problems as brackets go past 8
-[ab][cd][ef][gh][ij][kl][mn] - xacegikmoq acegikm
-[ab][cd][ef][gh][ij][kl][mn][op] - xacegikmoq acegikmo
-[ab][cd][ef][gh][ij][kl][mn][op][qr] - xacegikmoqy acegikmoq
-[ab][cd][ef][gh][ij][kl][mn][op][q] - xacegikmoqy acegikmoq
-
-# subtleties of matching
-abc & xabcy abc
-a\(b\)?c\1d b acd
-aBc i Abc Abc
-a[Bc]*d i abBCcd abBCcd
-0[[:upper:]]1 &i 0a1 0a1
-0[[:lower:]]1 &i 0A1 0A1
-a[^b]c &i abc
-a[^b]c &i aBc
-a[^b]c &i adc adc
-[a]b[c] - abc abc
-[a]b[a] - aba aba
-[abc]b[abc] - abc abc
-[abc]b[abd] - abd abd
-a(b?c)+d - accd accd
-(wee|week)(knights|night) - weeknights weeknights
-(we|wee|week|frob)(knights|night|day) - weeknights weeknights
-a[bc]d - xyzaaabcaababdacd abd
-a[ab]c - aaabc abc
-abc s abc abc
-a* & b @b
-
-# Let's have some fun -- try to match a C comment.
-# first the obvious, which looks okay at first glance...
-/\*.*\*/ - /*x*/ /*x*/
-# but...
-/\*.*\*/ - /*x*/y/*z*/ /*x*/y/*z*/
-# okay, we must not match */ inside; try to do that...
-/\*([^*]|\*[^/])*\*/ - /*x*/ /*x*/
-/\*([^*]|\*[^/])*\*/ - /*x*/y/*z*/ /*x*/
-# but...
-/\*([^*]|\*[^/])*\*/ - /*x**/y/*z*/ /*x**/y/*z*/
-# and a still fancier version, which does it right (I think)...
-/\*([^*]|\*+[^*/])*\*+/ - /*x*/ /*x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x*/y/*z*/ /*x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x**/y/*z*/ /*x**/
-/\*([^*]|\*+[^*/])*\*+/ - /*x****/y/*z*/ /*x****/
-/\*([^*]|\*+[^*/])*\*+/ - /*x**x*/y/*z*/ /*x**x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x***x/y/*z*/ /*x***x/y/*z*/
-
-# subexpressions
-a(b)(c)d - abcd abcd b,c
-a(((b)))c - abc abc b,b,b
-a(b|(c))d - abd abd b,-
-a(b*|c|e)d - abbd abbd bb
-a(b*|c|e)d - acd acd c
-a(b*|c|e)d - ad ad @d
-a(b?)c - abc abc b
-a(b?)c - ac ac @c
-a(b+)c - abc abc b
-a(b+)c - abbbc abbbc bbb
-a(b*)c - ac ac @c
-(a|ab)(bc([de]+)f|cde) - abcdef abcdef a,bcdef,de
-# the regression tester only asks for 9 subexpressions
-a(b)(c)(d)(e)(f)(g)(h)(i)(j)k - abcdefghijk abcdefghijk b,c,d,e,f,g,h,i,j
-a(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)l - abcdefghijkl abcdefghijkl b,c,d,e,f,g,h,i,j,k
-a([bc]?)c - abc abc b
-a([bc]?)c - ac ac @c
-a([bc]+)c - abc abc b
-a([bc]+)c - abcc abcc bc
-a([bc]+)bc - abcbc abcbc bc
-a(bb+|b)b - abb abb b
-a(bbb+|bb+|b)b - abb abb b
-a(bbb+|bb+|b)b - abbb abbb bb
-a(bbb+|bb+|b)bb - abbb abbb b
-(.*).* - abcdef abcdef abcdef
-(a*)* - bc @b @b
-
-# do we get the right subexpression when it is used more than once?
-a(b|c)*d - ad ad -
-a(b|c)*d - abcd abcd c
-a(b|c)+d - abd abd b
-a(b|c)+d - abcd abcd c
-a(b|c?)+d - ad ad @d
-a(b|c?)+d - abcd abcd @d
-a(b|c){0,0}d - ad ad -
-a(b|c){0,1}d - ad ad -
-a(b|c){0,1}d - abd abd b
-a(b|c){0,2}d - ad ad -
-a(b|c){0,2}d - abcd abcd c
-a(b|c){0,}d - ad ad -
-a(b|c){0,}d - abcd abcd c
-a(b|c){1,1}d - abd abd b
-a(b|c){1,1}d - acd acd c
-a(b|c){1,2}d - abd abd b
-a(b|c){1,2}d - abcd abcd c
-a(b|c){1,}d - abd abd b
-a(b|c){1,}d - abcd abcd c
-a(b|c){2,2}d - acbd acbd b
-a(b|c){2,2}d - abcd abcd c
-a(b|c){2,4}d - abcd abcd c
-a(b|c){2,4}d - abcbd abcbd b
-a(b|c){2,4}d - abcbcd abcbcd c
-a(b|c){2,}d - abcd abcd c
-a(b|c){2,}d - abcbd abcbd b
-a(b+|((c)*))+d - abd abd @d,@d,-
-a(b+|((c)*))+d - abcd abcd @d,@d,-
-
-# check out the STARTEND option
-[abc] &# a(b)c b
-[abc] &# a(d)c
-[abc] &# a(bc)d b
-[abc] &# a(dc)d c
-. &# a()c
-b.*c &# b(bc)c bc
-b.* &# b(bc)c bc
-.*c &# b(bc)c bc
-
-# plain strings, with the NOSPEC flag
-abc m abc abc
-abc m xabcy abc
-abc m xyz
-a*b m aba*b a*b
-a*b m ab
-"" mC EMPTY
-
-# cases involving NULs
-aZb & a a
-aZb &p a
-aZb &p# (aZb) aZb
-aZ*b &p# (ab) ab
-a.b &# (aZb) aZb
-a.* &# (aZb)c aZb
-
-# word boundaries (ick)
-[[:<:]]a & a a
-[[:<:]]a & ba
-[[:<:]]a & -a a
-a[[:>:]] & a a
-a[[:>:]] & ab
-a[[:>:]] & a- a
-[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc abc
-[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc-q abc
-[[:<:]]a.c[[:>:]] & axc-dayc-dazce-abc axc
-[[:<:]]b.c[[:>:]] & a_bxc-byc_d-bzc-q bzc
-[[:<:]].x..[[:>:]] & y_xa_-_xb_y-_xc_-axdc _xc_
-[[:<:]]a_b[[:>:]] & x_a_b
-
-# past problems, and suspected problems
-(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A]) - A1 A1
-abcdefghijklmnop i abcdefghijklmnop abcdefghijklmnop
-abcdefghijklmnopqrstuv i abcdefghijklmnopqrstuv abcdefghijklmnopqrstuv
-(ALAK)|(ALT[AB])|(CC[123]1)|(CM[123]1)|(GAMC)|(LC[23][EO ])|(SEM[1234])|(SL[ES][12])|(SLWW)|(SLF )|(SLDT)|(VWH[12])|(WH[34][EW])|(WP1[ESN]) - CC11 CC11
-CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a - CC11 CC11
-Char \([a-z0-9_]*\)\[.* b Char xyz[k Char xyz[k xyz
-a?b - ab ab
--\{0,1\}[0-9]*$ b -5 -5
diff --git a/ext/ereg/regex/utils.h b/ext/ereg/regex/utils.h
deleted file mode 100644
index cd4a96025f..0000000000
--- a/ext/ereg/regex/utils.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* utility definitions */
-
-#include "regex_extra.h"
-
-#ifdef _POSIX2_RE_DUP_MAX
-#define DUPMAX _POSIX2_RE_DUP_MAX
-#else
-#define DUPMAX 255
-#endif
-#define INFINITY (DUPMAX + 1)
-#define NC (CHAR_MAX - CHAR_MIN + 1)
-typedef unsigned char uch;
-
-/* switch off assertions (if not already off) if no REDEBUG */
-#ifndef REDEBUG
-#ifndef NDEBUG
-#define NDEBUG /* no assertions please */
-#endif
-#endif
-#include <assert.h>
-
-/* for old systems with bcopy() but no memmove() */
-#ifdef USEBCOPY
-#define memmove(d, s, c) bcopy(s, d, c)
-#endif
diff --git a/ext/ereg/tests/001.phpt b/ext/ereg/tests/001.phpt
deleted file mode 100644
index f63c252518..0000000000
--- a/ext/ereg/tests/001.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-RegReplace test 1
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","def",$a)?>
---EXPECT--
-abcdef
diff --git a/ext/ereg/tests/002.phpt b/ext/ereg/tests/002.phpt
deleted file mode 100644
index a9b7aaa00a..0000000000
--- a/ext/ereg/tests/002.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-RegReplace test 2
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","",$a)?>
---EXPECT--
-abc
diff --git a/ext/ereg/tests/003.phpt b/ext/ereg/tests/003.phpt
deleted file mode 100644
index edd9c05969..0000000000
--- a/ext/ereg/tests/003.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-ereg_replace single-quote test
---POST--
---GET--
---FILE--
-<?php $a="\\'test";
- echo ereg_replace("\\\\'","'",$a)
-?>
---EXPECT--
-'test
diff --git a/ext/ereg/tests/004.phpt b/ext/ereg/tests/004.phpt
deleted file mode 100644
index 1f60ff4900..0000000000
--- a/ext/ereg/tests/004.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-simple ereg test
---POST--
---GET--
---FILE--
-<?php $a="This is a nice and simple string";
- if (ereg(".*nice and simple.*",$a)) {
- echo "ok\n";
- }
- if (!ereg(".*doesn't exist.*",$a)) {
- echo "ok\n";
- }
-?>
---EXPECT--
-ok
-ok
diff --git a/ext/ereg/tests/005.phpt b/ext/ereg/tests/005.phpt
deleted file mode 100644
index 78c0a0912a..0000000000
--- a/ext/ereg/tests/005.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Test Regular expression register support in ereg
---POST--
---GET--
---FILE--
-<?php $a="This is a nice and simple string";
- echo ereg(".*(is).*(is).*",$a,$registers);
- echo "\n";
- echo $registers[0];
- echo "\n";
- echo $registers[1];
- echo "\n";
- echo $registers[2];
- echo "\n";
-?>
---EXPECT--
-32
-This is a nice and simple string
-is
-is
diff --git a/ext/ereg/tests/006.phpt b/ext/ereg/tests/006.phpt
deleted file mode 100644
index 50b6dbfd3a..0000000000
--- a/ext/ereg/tests/006.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Test ereg_replace of start-of-line
---POST--
---GET--
---FILE--
-<?php $a="This is a nice and simple string";
- echo ereg_replace("^This","That",$a);
-?>
---EXPECT--
-That is a nice and simple string
diff --git a/ext/ereg/tests/007.phpt b/ext/ereg/tests/007.phpt
deleted file mode 100644
index b2646f842f..0000000000
--- a/ext/ereg/tests/007.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Test empty result buffer in reg_replace
---POST--
---GET--
---FILE--
-<?php
- $a="abcd";
- $b=ereg_replace("abcd","",$a);
- echo "strlen(\$b)=".strlen($b);
-?>
---EXPECT--
-strlen($b)=0
diff --git a/ext/ereg/tests/008.phpt b/ext/ereg/tests/008.phpt
deleted file mode 100644
index db61d1ca07..0000000000
--- a/ext/ereg/tests/008.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Test back-references in regular expressions
---POST--
---GET--
---FILE--
-<?php
- echo ereg_replace("([a-z]*)([-=+|]*)([0-9]+)","\\3 \\1 \\2\n","abc+-|=123");
-?>
---EXPECT--
-123 abc +-|=
diff --git a/ext/ereg/tests/009.phpt b/ext/ereg/tests/009.phpt
deleted file mode 100644
index 4996ef4c97..0000000000
--- a/ext/ereg/tests/009.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Test split()
---POST--
---GET--
---FILE--
-<?php
- $a=split("[[:space:]]","this is a
-test");
- echo count($a) . "\n";
- for ($i = 0; $i < count($a); $i++) {
- echo $a[$i] . "\n";
- }
-?>
---EXPECT--
-4
-this
-is
-a
-test
diff --git a/ext/ereg/tests/010.phpt b/ext/ereg/tests/010.phpt
deleted file mode 100644
index 30d28fd02f..0000000000
--- a/ext/ereg/tests/010.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-Long back references
---POST--
---GET--
---FILE--
-<?php $a="abc122222222223";
- echo ereg_replace("1(2*)3","\\1def\\1",$a)?>
---EXPECT--
-abc2222222222def2222222222
diff --git a/ext/ereg/tests/011.phpt b/ext/ereg/tests/011.phpt
deleted file mode 100644
index 4eda774f58..0000000000
--- a/ext/ereg/tests/011.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-\0 back reference
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","def\\0ghi",$a)?>
---EXPECT--
-abcdef123ghi
diff --git a/ext/ereg/tests/012.phpt b/ext/ereg/tests/012.phpt
deleted file mode 100644
index d5342c7436..0000000000
--- a/ext/ereg/tests/012.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-nonexisting back reference
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123",'def\1ghi',$a)?>
---EXPECT--
-abcdef\1ghi
diff --git a/ext/ereg/tests/013.phpt b/ext/ereg/tests/013.phpt
deleted file mode 100644
index ec3329fa7c..0000000000
--- a/ext/ereg/tests/013.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-escapes in replace string
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","def\\g\\\\hi\\",$a)?>
---EXPECT--
-abcdef\g\\hi\
diff --git a/ext/ereg/tests/014.phpt b/ext/ereg/tests/014.phpt
deleted file mode 100644
index ec4d19ed0e..0000000000
--- a/ext/ereg/tests/014.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-backreferences not replaced recursively
---POST--
---GET--
---FILE--
-<?php $a="a\\2bxc";
- echo ereg_replace("a(.*)b(.*)c","\\1",$a)?>
---EXPECT--
-\2
diff --git a/ext/ereg/tests/015.phpt b/ext/ereg/tests/015.phpt
deleted file mode 100644
index 961a60fa76..0000000000
--- a/ext/ereg/tests/015.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-replace empty matches
---POST--
---GET--
---FILE--
-<?php echo ereg_replace("^","z","abc123")?>
---EXPECT--
-zabc123
diff --git a/ext/ereg/tests/016.phpt b/ext/ereg/tests/016.phpt
deleted file mode 100644
index a24816f182..0000000000
--- a/ext/ereg/tests/016.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-test backslash handling in regular expressions
---POST--
---GET--
---FILE--
-<?php echo ereg_replace('\?',"abc","?123?")?>
---EXPECT--
-abc123abc
diff --git a/ext/exif/CREDITS b/ext/exif/CREDITS
deleted file mode 100644
index 94de97e5b0..0000000000
--- a/ext/exif/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-EXIF
-Rasmus Lerdorf, Marcus Boerger
diff --git a/ext/exif/config.m4 b/ext/exif/config.m4
deleted file mode 100644
index a3ba9240df..0000000000
--- a/ext/exif/config.m4
+++ /dev/null
@@ -1,11 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(exif, whether to enable EXIF (metadata from images) support,
-[ --enable-exif Enable EXIF (metadata from images) support])
-
-if test "$PHP_EXIF" != "no"; then
- AC_DEFINE(HAVE_EXIF, 1, [Whether you want EXIF (metadata from images) support])
- PHP_NEW_EXTENSION(exif, exif.c, $ext_shared)
-fi
diff --git a/ext/exif/example.php b/ext/exif/example.php
deleted file mode 100644
index e34dc05f6d..0000000000
--- a/ext/exif/example.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-// (c) M.Boerger
-//
-// $Id$
-//
-?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional">
-<html>
-<head>
-<title>exif_read_data example</title>
-</head>
-<body>
-<?php
-$exif = exif_read_data ('tests/test1.jpg','IFD0');
-echo $exif===false ? "No header data found.<br>\n" : "Image contains headers<br>";
-$exif = exif_read_data ('tests/test2.jpg',0,true);
-foreach($exif as $key=>$section) {
- foreach($section as $name=>$val) {
- echo "$key.$name: $val<br>\n";
- }
-}
-?>
-</body>
-</html> \ No newline at end of file
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
deleted file mode 100644
index 13957bb304..0000000000
--- a/ext/exif/exif.c
+++ /dev/null
@@ -1,4021 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* ToDos
- *
- * See if example images from http://www.exif.org have illegal
- * thumbnail sizes or if code is corrupt.
- * Create/Update exif headers.
- * Create/Remove/Update image thumbnails.
- */
-
-/* Security
- *
- * At current time i do not see any security problems but a potential
- * attacker could generate an image with recursive ifd pointers...(Marcus)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/file.h"
-
-#if HAVE_EXIF
-
-/* When EXIF_DEBUG is defined the module generates a lot of debug messages
- * that help understanding what is going on. This can and should be used
- * while extending the module as it shows if you are at the right position.
- * You are always considered to have a copy of TIFF6.0 and EXIF2.10 standard.
- */
-#undef EXIF_DEBUG
-
-#undef EXIF_JPEG2000
-
-#include "php_exif.h"
-#include <math.h>
-#include "php_ini.h"
-#include "ext/standard/php_string.h"
-#include "ext/standard/php_image.h"
-#include "ext/standard/info.h"
-
-#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
-#define EXIF_USE_MBSTRING 1
-#else
-#define EXIF_USE_MBSTRING 0
-#endif
-
-#if EXIF_USE_MBSTRING
-#include "ext/mbstring/mbstring.h"
-#endif
-
-typedef unsigned char uchar;
-
-#ifndef safe_emalloc
-# define safe_emalloc(a,b,c) emalloc((a)*(b)+(c))
-#endif
-
-#ifndef TRUE
-# define TRUE 1
-# define FALSE 0
-#endif
-
-#ifndef max
-# define max(a,b) ((a)>(b) ? (a) : (b))
-#endif
-
-#define EFREE_IF(ptr) if (ptr) efree(ptr)
-
-static unsigned char exif_thumbnail_force_ref[] = {2, BYREF_NONE, BYREF_FORCE_REST};
-
-/* {{{ exif_functions[]
- */
-function_entry exif_functions[] = {
- PHP_FE(exif_read_data, NULL)
- PHP_FALIAS(read_exif_data, exif_read_data, NULL)
- PHP_FE(exif_tagname, NULL)
- PHP_FE(exif_thumbnail, exif_thumbnail_force_ref)
- PHP_FE(exif_imagetype, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-#define EXIF_VERSION "1.4 $Id$"
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(exif)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "EXIF Support", "enabled");
- php_info_print_table_row(2, "EXIF Version", EXIF_VERSION);
- php_info_print_table_row(2, "Supported EXIF Version", "0220");
- php_info_print_table_row(2, "Supported filetypes", "JPEG,TIFF");
- php_info_print_table_end();
-}
-/* }}} */
-
-ZEND_BEGIN_MODULE_GLOBALS(exif)
- char * encode_unicode;
- char * decode_unicode_be;
- char * decode_unicode_le;
- char * encode_jis;
- char * decode_jis_be;
- char * decode_jis_le;
-ZEND_END_MODULE_GLOBALS(exif)
-
-ZEND_DECLARE_MODULE_GLOBALS(exif)
-
-#ifdef ZTS
-#define EXIF_G(v) TSRMG(exif_globals_id, zend_exif_globals *, v)
-#else
-#define EXIF_G(v) (exif_globals.v)
-#endif
-
-/* {{{ PHP_INI
- */
-
-ZEND_API ZEND_INI_MH(OnUpdateEncode)
-{
-#if EXIF_USE_MBSTRING
- if (new_value && strlen(new_value) && !php_mb_check_encoding_list(new_value TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value);
- return FAILURE;
- }
-#endif
- return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
-}
-
-ZEND_API ZEND_INI_MH(OnUpdateDecode)
-{
-#if EXIF_USE_MBSTRING
- if (!php_mb_check_encoding_list(new_value TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value);
- return FAILURE;
- }
-#endif
- return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
-}
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("exif.encode_unicode", "ISO-8859-15", PHP_INI_ALL, OnUpdateEncode, encode_unicode, zend_exif_globals, exif_globals)
- STD_PHP_INI_ENTRY("exif.decode_unicode_motorola", "UCS-2BE", PHP_INI_ALL, OnUpdateDecode, decode_unicode_be, zend_exif_globals, exif_globals)
- STD_PHP_INI_ENTRY("exif.decode_unicode_intel", "UCS-2LE", PHP_INI_ALL, OnUpdateDecode, decode_unicode_le, zend_exif_globals, exif_globals)
- STD_PHP_INI_ENTRY("exif.encode_jis", "", PHP_INI_ALL, OnUpdateEncode, encode_jis, zend_exif_globals, exif_globals)
- STD_PHP_INI_ENTRY("exif.decode_jis_motorola", "JIS", PHP_INI_ALL, OnUpdateDecode, decode_jis_be, zend_exif_globals, exif_globals)
- STD_PHP_INI_ENTRY("exif.decode_jis_intel", "JIS", PHP_INI_ALL, OnUpdateDecode, decode_jis_le, zend_exif_globals, exif_globals)
-PHP_INI_END()
-/* }}} */
-
-/* {{{ php_extname_init_globals
- */
-static void php_exif_init_globals(zend_exif_globals *exif_globals)
-{
- exif_globals->encode_unicode = NULL;
- exif_globals->decode_unicode_be = NULL;
- exif_globals->decode_unicode_le = NULL;
- exif_globals->encode_jis = NULL;
- exif_globals->decode_jis_be = NULL;
- exif_globals->decode_jis_le = NULL;
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION(exif)
- Get the size of an image as 4-element array */
-PHP_MINIT_FUNCTION(exif)
-{
- ZEND_INIT_MODULE_GLOBALS(exif, php_exif_init_globals, NULL);
- REGISTER_INI_ENTRIES();
- REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", EXIF_USE_MBSTRING, CONST_CS | CONST_PERSISTENT);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(exif)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ exif_module_entry
- */
-zend_module_entry exif_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
- "exif",
- exif_functions,
- PHP_MINIT(exif),
- PHP_MSHUTDOWN(exif),
- NULL, NULL,
- PHP_MINFO(exif),
-#if ZEND_MODULE_API_NO >= 20010901
- EXIF_VERSION,
-#endif
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_EXIF
-ZEND_GET_MODULE(exif)
-#endif
-
-/* {{{ php_strnlen
- * get length of string if buffer if less than buffer size or buffer size */
-static size_t php_strnlen(char* str, size_t maxlen) {
- size_t len = 0;
-
- if (str && maxlen && *str) {
- do {
- len++;
- } while (--maxlen && *(++str));
- }
- return len;
-}
-/* }}} */
-
-/* {{{ error messages
-*/
-static const char * EXIF_ERROR_FILEEOF = "Unexpected end of file reached";
-static const char * EXIF_ERROR_CORRUPT = "File structure corrupted";
-static const char * EXIF_ERROR_THUMBEOF = "Thumbnail goes IFD boundary or end of file reached";
-static const char * EXIF_ERROR_FSREALLOC = "Illegal reallocating of undefined file section";
-
-#define EXIF_ERRLOG_FILEEOF php_error_docref(NULL TSRMLS_CC, E_WARNING, EXIF_ERROR_FILEEOF);
-#define EXIF_ERRLOG_CORRUPT php_error_docref(NULL TSRMLS_CC, E_WARNING, EXIF_ERROR_CORRUPT);
-#define EXIF_ERRLOG_THUMBEOF php_error_docref(NULL TSRMLS_CC, E_WARNING, EXIF_ERROR_THUMBEOF);
-#define EXIF_ERRLOG_FSREALLOC php_error_docref(NULL TSRMLS_CC, E_WARNING, EXIF_ERROR_FSREALLOC);
-/* }}} */
-
-/* {{{ format description defines
- Describes format descriptor
-*/
-static int php_tiff_bytes_per_format[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1};
-#define NUM_FORMATS 13
-
-#define TAG_FMT_BYTE 1
-#define TAG_FMT_STRING 2
-#define TAG_FMT_USHORT 3
-#define TAG_FMT_ULONG 4
-#define TAG_FMT_URATIONAL 5
-#define TAG_FMT_SBYTE 6
-#define TAG_FMT_UNDEFINED 7
-#define TAG_FMT_SSHORT 8
-#define TAG_FMT_SLONG 9
-#define TAG_FMT_SRATIONAL 10
-#define TAG_FMT_SINGLE 11
-#define TAG_FMT_DOUBLE 12
-#define TAG_FMT_IFD 13
-
-#ifdef EXIF_DEBUG
-static char *exif_get_tagformat(int format)
-{
- switch(format) {
- case TAG_FMT_BYTE: return "BYTE";
- case TAG_FMT_STRING: return "STRING";
- case TAG_FMT_USHORT: return "USHORT";
- case TAG_FMT_ULONG: return "ULONG";
- case TAG_FMT_URATIONAL: return "URATIONAL";
- case TAG_FMT_SBYTE: return "SBYTE";
- case TAG_FMT_UNDEFINED: return "UNDEFINED";
- case TAG_FMT_SSHORT: return "SSHORT";
- case TAG_FMT_SLONG: return "SLONG";
- case TAG_FMT_SRATIONAL: return "SRATIONAL";
- case TAG_FMT_SINGLE: return "SINGLE";
- case TAG_FMT_DOUBLE: return "DOUBLE";
- case TAG_FMT_IFD: return "IFD";
- }
- return "*Illegal";
-}
-#endif
-
-/* Describes tag values */
-#define TAG_GPS_VERSION_ID 0x0000
-#define TAG_GPS_LATITUDE_REF 0x0001
-#define TAG_GPS_LATITUDE 0x0002
-#define TAG_GPS_LONGITUDE_REF 0x0003
-#define TAG_GPS_LONGITUDE 0x0004
-#define TAG_GPS_ALTITUDE_REF 0x0005
-#define TAG_GPS_ALTITUDE 0x0006
-#define TAG_GPS_TIME_STAMP 0x0007
-#define TAG_GPS_SATELLITES 0x0008
-#define TAG_GPS_STATUS 0x0009
-#define TAG_GPS_MEASURE_MODE 0x000A
-#define TAG_GPS_DOP 0x000B
-#define TAG_GPS_SPEED_REF 0x000C
-#define TAG_GPS_SPEED 0x000D
-#define TAG_GPS_TRACK_REF 0x000E
-#define TAG_GPS_TRACK 0x000F
-#define TAG_GPS_IMG_DIRECTION_REF 0x0010
-#define TAG_GPS_IMG_DIRECTION 0x0011
-#define TAG_GPS_MAP_DATUM 0x0012
-#define TAG_GPS_DEST_LATITUDE_REF 0x0013
-#define TAG_GPS_DEST_LATITUDE 0x0014
-#define TAG_GPS_DEST_LONGITUDE_REF 0x0015
-#define TAG_GPS_DEST_LONGITUDE 0x0016
-#define TAG_GPS_DEST_BEARING_REF 0x0017
-#define TAG_GPS_DEST_BEARING 0x0018
-#define TAG_GPS_DEST_DISTANCE_REF 0x0019
-#define TAG_GPS_DEST_DISTANCE 0x001A
-#define TAG_GPS_PROCESSING_METHOD 0x001B
-#define TAG_GPS_AREA_INFORMATION 0x001C
-#define TAG_GPS_DATE_STAMP 0x001D
-#define TAG_GPS_DIFFERENTIAL 0x001E
-#define TAG_TIFF_COMMENT 0x00FE /* SHOUDLNT HAPPEN */
-#define TAG_NEW_SUBFILE 0x00FE /* New version of subfile tag */
-#define TAG_SUBFILE_TYPE 0x00FF /* Old version of subfile tag */
-#define TAG_IMAGEWIDTH 0x0100
-#define TAG_IMAGEHEIGHT 0x0101
-#define TAG_BITS_PER_SAMPLE 0x0102
-#define TAG_COMPRESSION 0x0103
-#define TAG_PHOTOMETRIC_INTERPRETATION 0x0106
-#define TAG_TRESHHOLDING 0x0107
-#define TAG_CELL_WIDTH 0x0108
-#define TAG_CELL_HEIGHT 0x0109
-#define TAG_FILL_ORDER 0x010A
-#define TAG_DOCUMENT_NAME 0x010D
-#define TAG_IMAGE_DESCRIPTION 0x010E
-#define TAG_MAKE 0x010F
-#define TAG_MODEL 0x0110
-#define TAG_STRIP_OFFSETS 0x0111
-#define TAG_ORIENTATION 0x0112
-#define TAG_SAMPLES_PER_PIXEL 0x0115
-#define TAG_ROWS_PER_STRIP 0x0116
-#define TAG_STRIP_BYTE_COUNTS 0x0117
-#define TAG_MIN_SAMPPLE_VALUE 0x0118
-#define TAG_MAX_SAMPLE_VALUE 0x0119
-#define TAG_X_RESOLUTION 0x011A
-#define TAG_Y_RESOLUTION 0x011B
-#define TAG_PLANAR_CONFIGURATION 0x011C
-#define TAG_PAGE_NAME 0x011D
-#define TAG_X_POSITION 0x011E
-#define TAG_Y_POSITION 0x011F
-#define TAG_FREE_OFFSETS 0x0120
-#define TAG_FREE_BYTE_COUNTS 0x0121
-#define TAG_GRAY_RESPONSE_UNIT 0x0122
-#define TAG_GRAY_RESPONSE_CURVE 0x0123
-#define TAG_RESOLUTION_UNIT 0x0128
-#define TAG_PAGE_NUMBER 0x0129
-#define TAG_TRANSFER_FUNCTION 0x012D
-#define TAG_SOFTWARE 0x0131
-#define TAG_DATETIME 0x0132
-#define TAG_ARTIST 0x013B
-#define TAG_HOST_COMPUTER 0x013C
-#define TAG_PREDICTOR 0x013D
-#define TAG_WHITE_POINT 0x013E
-#define TAG_PRIMARY_CHROMATICITIES 0x013F
-#define TAG_COLOR_MAP 0x0140
-#define TAG_HALFTONE_HINTS 0x0141
-#define TAG_TILE_WIDTH 0x0142
-#define TAG_TILE_LENGTH 0x0143
-#define TAG_TILE_OFFSETS 0x0144
-#define TAG_TILE_BYTE_COUNTS 0x0145
-#define TAG_SUB_IFD 0x014A
-#define TAG_INK_SETMPUTER 0x014C
-#define TAG_INK_NAMES 0x014D
-#define TAG_NUMBER_OF_INKS 0x014E
-#define TAG_DOT_RANGE 0x0150
-#define TAG_TARGET_PRINTER 0x0151
-#define TAG_EXTRA_SAMPLE 0x0152
-#define TAG_SAMPLE_FORMAT 0x0153
-#define TAG_S_MIN_SAMPLE_VALUE 0x0154
-#define TAG_S_MAX_SAMPLE_VALUE 0x0155
-#define TAG_TRANSFER_RANGE 0x0156
-#define TAG_JPEG_TABLES 0x015B
-#define TAG_JPEG_PROC 0x0200
-#define TAG_JPEG_INTERCHANGE_FORMAT 0x0201
-#define TAG_JPEG_INTERCHANGE_FORMAT_LEN 0x0202
-#define TAG_JPEG_RESTART_INTERVAL 0x0203
-#define TAG_JPEG_LOSSLESS_PREDICTOR 0x0205
-#define TAG_JPEG_POINT_TRANSFORMS 0x0206
-#define TAG_JPEG_Q_TABLES 0x0207
-#define TAG_JPEG_DC_TABLES 0x0208
-#define TAG_JPEG_AC_TABLES 0x0209
-#define TAG_YCC_COEFFICIENTS 0x0211
-#define TAG_YCC_SUB_SAMPLING 0x0212
-#define TAG_YCC_POSITIONING 0x0213
-#define TAG_REFERENCE_BLACK_WHITE 0x0214
-/* 0x0301 - 0x0302 */
-/* 0x0320 */
-/* 0x0343 */
-/* 0x5001 - 0x501B */
-/* 0x5021 - 0x503B */
-/* 0x5090 - 0x5091 */
-/* 0x5100 - 0x5101 */
-/* 0x5110 - 0x5113 */
-/* 0x80E3 - 0x80E6 */
-/* 0x828d - 0x828F */
-#define TAG_COPYRIGHT 0x8298
-#define TAG_EXPOSURETIME 0x829A
-#define TAG_FNUMBER 0x829D
-#define TAG_EXIF_IFD_POINTER 0x8769
-#define TAG_ICC_PROFILE 0x8773
-#define TAG_EXPOSURE_PROGRAM 0x8822
-#define TAG_SPECTRAL_SENSITY 0x8824
-#define TAG_GPS_IFD_POINTER 0x8825
-#define TAG_ISOSPEED 0x8827
-#define TAG_OPTOELECTRIC_CONVERSION_F 0x8828
-/* 0x8829 - 0x882b */
-#define TAG_EXIFVERSION 0x9000
-#define TAG_DATE_TIME_ORIGINAL 0x9003
-#define TAG_DATE_TIME_DIGITIZED 0x9004
-#define TAG_COMPONENT_CONFIG 0x9101
-#define TAG_COMPRESSED_BITS_PER_PIXEL 0x9102
-#define TAG_SHUTTERSPEED 0x9201
-#define TAG_APERTURE 0x9202
-#define TAG_BRIGHTNESS_VALUE 0x9203
-#define TAG_EXPOSURE_BIAS_VALUE 0x9204
-#define TAG_MAX_APERTURE 0x9205
-#define TAG_SUBJECT_DISTANCE 0x9206
-#define TAG_METRIC_MODULE 0x9207
-#define TAG_LIGHT_SOURCE 0x9208
-#define TAG_FLASH 0x9209
-#define TAG_FOCAL_LENGTH 0x920A
-/* 0x920B - 0x920D */
-/* 0x9211 - 0x9216 */
-#define TAG_SUBJECT_AREA 0x9214
-#define TAG_MAKER_NOTE 0x927C
-#define TAG_USERCOMMENT 0x9286
-#define TAG_SUB_SEC_TIME 0x9290
-#define TAG_SUB_SEC_TIME_ORIGINAL 0x9291
-#define TAG_SUB_SEC_TIME_DIGITIZED 0x9292
-/* 0x923F */
-/* 0x935C */
-#define TAG_XP_TITLE 0x9C9B
-#define TAG_XP_COMMENTS 0x9C9C
-#define TAG_XP_AUTHOR 0x9C9D
-#define TAG_XP_KEYWORDS 0x9C9E
-#define TAG_XP_SUBJECT 0x9C9F
-#define TAG_FLASH_PIX_VERSION 0xA000
-#define TAG_COLOR_SPACE 0xA001
-#define TAG_COMP_IMAGE_WIDTH 0xA002 /* compressed images only */
-#define TAG_COMP_IMAGE_HEIGHT 0xA003
-#define TAG_RELATED_SOUND_FILE 0xA004
-#define TAG_INTEROP_IFD_POINTER 0xA005 /* IFD pointer */
-#define TAG_FLASH_ENERGY 0xA20B
-#define TAG_SPATIAL_FREQUENCY_RESPONSE 0xA20C
-#define TAG_FOCALPLANE_X_RES 0xA20E
-#define TAG_FOCALPLANE_Y_RES 0xA20F
-#define TAG_FOCALPLANE_RESOLUTION_UNIT 0xA210
-#define TAG_SUBJECT_LOCATION 0xA214
-#define TAG_EXPOSURE_INDEX 0xA215
-#define TAG_SENSING_METHOD 0xA217
-#define TAG_FILE_SOURCE 0xA300
-#define TAG_SCENE_TYPE 0xA301
-#define TAG_CFA_PATTERN 0xA302
-#define TAG_CUSTOM_RENDERED 0xA401
-#define TAG_EXPOSURE_MODE 0xA402
-#define TAG_WHITE_BALANCE 0xA403
-#define TAG_DIGITAL_ZOOM_RATIO 0xA404
-#define TAG_FOCAL_LENGTH_IN_35_MM_FILM 0xA405
-#define TAG_SCENE_CAPTURE_TYPE 0xA406
-#define TAG_GAIN_CONTROL 0xA407
-#define TAG_CONTRAST 0xA408
-#define TAG_SATURATION 0xA409
-#define TAG_SHARPNESS 0xA40A
-#define TAG_DEVICE_SETTING_DESCRIPTION 0xA40B
-#define TAG_SUBJECT_DISTANCE_RANGE 0xA40C
-#define TAG_IMAGE_UNIQUE_ID 0xA420
-
-/* Olympus specific tags */
-#define TAG_OLYMPUS_SPECIALMODE 0x0200
-#define TAG_OLYMPUS_JPEGQUAL 0x0201
-#define TAG_OLYMPUS_MACRO 0x0202
-#define TAG_OLYMPUS_DIGIZOOM 0x0204
-#define TAG_OLYMPUS_SOFTWARERELEASE 0x0207
-#define TAG_OLYMPUS_PICTINFO 0x0208
-#define TAG_OLYMPUS_CAMERAID 0x0209
-/* end Olympus specific tags */
-
-/* Internal */
-#define TAG_NONE -1 /* note that -1 <> 0xFFFF */
-#define TAG_COMPUTED_VALUE -2
-#define TAG_END_OF_LIST 0xFFFD
-
-/* Values for TAG_PHOTOMETRIC_INTERPRETATION */
-#define PMI_BLACK_IS_ZERO 0
-#define PMI_WHITE_IS_ZERO 1
-#define PMI_RGB 2
-#define PMI_PALETTE_COLOR 3
-#define PMI_TRANSPARENCY_MASK 4
-#define PMI_SEPARATED 5
-#define PMI_YCBCR 6
-#define PMI_CIELAB 8
-
-/* }}} */
-
-/* {{{ TabTable[]
- */
-typedef const struct {
- unsigned short Tag;
- char *Desc;
-} tag_info_type;
-
-typedef tag_info_type tag_info_array[];
-typedef tag_info_type *tag_table_type;
-
-#define TAG_TABLE_END \
- {TAG_NONE, "No tag value"},\
- {TAG_COMPUTED_VALUE, "Computed value"},\
- {TAG_END_OF_LIST, ""} /* Important for exif_get_tagname() IF value != "" functionresult is != false */
-
-static tag_info_array tag_table_IFD = {
- { 0x000B, "ACDComment"},
- { 0x00FE, "NewSubFile"}, /* better name it 'ImageType' ? */
- { 0x00FF, "SubFile"},
- { 0x0100, "ImageWidth"},
- { 0x0101, "ImageLength"},
- { 0x0102, "BitsPerSample"},
- { 0x0103, "Compression"},
- { 0x0106, "PhotometricInterpretation"},
- { 0x010A, "FillOrder"},
- { 0x010D, "DocumentName"},
- { 0x010E, "ImageDescription"},
- { 0x010F, "Make"},
- { 0x0110, "Model"},
- { 0x0111, "StripOffsets"},
- { 0x0112, "Orientation"},
- { 0x0115, "SamplesPerPixel"},
- { 0x0116, "RowsPerStrip"},
- { 0x0117, "StripByteCounts"},
- { 0x0118, "MinSampleValue"},
- { 0x0119, "MaxSampleValue"},
- { 0x011A, "XResolution"},
- { 0x011B, "YResolution"},
- { 0x011C, "PlanarConfiguration"},
- { 0x011D, "PageName"},
- { 0x011E, "XPosition"},
- { 0x011F, "YPosition"},
- { 0x0120, "FreeOffsets"},
- { 0x0121, "FreeByteCounts"},
- { 0x0122, "GrayResponseUnit"},
- { 0x0123, "GrayResponseCurve"},
- { 0x0124, "T4Options"},
- { 0x0125, "T6Options"},
- { 0x0128, "ResolutionUnit"},
- { 0x0129, "PageNumber"},
- { 0x012D, "TransferFunction"},
- { 0x0131, "Software"},
- { 0x0132, "DateTime"},
- { 0x013B, "Artist"},
- { 0x013C, "HostComputer"},
- { 0x013D, "Predictor"},
- { 0x013E, "WhitePoint"},
- { 0x013F, "PrimaryChromaticities"},
- { 0x0140, "ColorMap"},
- { 0x0141, "HalfToneHints"},
- { 0x0142, "TileWidth"},
- { 0x0143, "TileLength"},
- { 0x0144, "TileOffsets"},
- { 0x0145, "TileByteCounts"},
- { 0x014A, "SubIFD"},
- { 0x014C, "InkSet"},
- { 0x014D, "InkNames"},
- { 0x014E, "NumberOfInks"},
- { 0x0150, "DotRange"},
- { 0x0151, "TargetPrinter"},
- { 0x0152, "ExtraSample"},
- { 0x0153, "SampleFormat"},
- { 0x0154, "SMinSampleValue"},
- { 0x0155, "SMaxSampleValue"},
- { 0x0156, "TransferRange"},
- { 0x0157, "ClipPath"},
- { 0x0158, "XClipPathUnits"},
- { 0x0159, "YClipPathUnits"},
- { 0x015A, "Indexed"},
- { 0x015B, "JPEGTables"},
- { 0x015F, "OPIProxy"},
- { 0x0200, "JPEGProc"},
- { 0x0201, "JPEGInterchangeFormat"},
- { 0x0202, "JPEGInterchangeFormatLength"},
- { 0x0203, "JPEGRestartInterval"},
- { 0x0205, "JPEGLosslessPredictors"},
- { 0x0206, "JPEGPointTransforms"},
- { 0x0207, "JPEGQTables"},
- { 0x0208, "JPEGDCTables"},
- { 0x0209, "JPEGACTables"},
- { 0x0211, "YCbCrCoefficients"},
- { 0x0212, "YCbCrSubSampling"},
- { 0x0213, "YCbCrPositioning"},
- { 0x0214, "ReferenceBlackWhite"},
- { 0x02BC, "ExtensibleMetadataPlatform"}, /* XAP: Extensible Authoring Publishing, obsoleted by XMP: Extensible Metadata Platform */
- { 0x0301, "Gamma"},
- { 0x0302, "ICCProfileDescriptor"},
- { 0x0303, "SRGBRenderingIntent"},
- { 0x0320, "ImageTitle"},
- { 0x5001, "ResolutionXUnit"},
- { 0x5002, "ResolutionYUnit"},
- { 0x5003, "ResolutionXLengthUnit"},
- { 0x5004, "ResolutionYLengthUnit"},
- { 0x5005, "PrintFlags"},
- { 0x5006, "PrintFlagsVersion"},
- { 0x5007, "PrintFlagsCrop"},
- { 0x5008, "PrintFlagsBleedWidth"},
- { 0x5009, "PrintFlagsBleedWidthScale"},
- { 0x500A, "HalftoneLPI"},
- { 0x500B, "HalftoneLPIUnit"},
- { 0x500C, "HalftoneDegree"},
- { 0x500D, "HalftoneShape"},
- { 0x500E, "HalftoneMisc"},
- { 0x500F, "HalftoneScreen"},
- { 0x5010, "JPEGQuality"},
- { 0x5011, "GridSize"},
- { 0x5012, "ThumbnailFormat"},
- { 0x5013, "ThumbnailWidth"},
- { 0x5014, "ThumbnailHeight"},
- { 0x5015, "ThumbnailColorDepth"},
- { 0x5016, "ThumbnailPlanes"},
- { 0x5017, "ThumbnailRawBytes"},
- { 0x5018, "ThumbnailSize"},
- { 0x5019, "ThumbnailCompressedSize"},
- { 0x501A, "ColorTransferFunction"},
- { 0x501B, "ThumbnailData"},
- { 0x5020, "ThumbnailImageWidth"},
- { 0x5021, "ThumbnailImageHeight"},
- { 0x5022, "ThumbnailBitsPerSample"},
- { 0x5023, "ThumbnailCompression"},
- { 0x5024, "ThumbnailPhotometricInterp"},
- { 0x5025, "ThumbnailImageDescription"},
- { 0x5026, "ThumbnailEquipMake"},
- { 0x5027, "ThumbnailEquipModel"},
- { 0x5028, "ThumbnailStripOffsets"},
- { 0x5029, "ThumbnailOrientation"},
- { 0x502A, "ThumbnailSamplesPerPixel"},
- { 0x502B, "ThumbnailRowsPerStrip"},
- { 0x502C, "ThumbnailStripBytesCount"},
- { 0x502D, "ThumbnailResolutionX"},
- { 0x502E, "ThumbnailResolutionY"},
- { 0x502F, "ThumbnailPlanarConfig"},
- { 0x5030, "ThumbnailResolutionUnit"},
- { 0x5031, "ThumbnailTransferFunction"},
- { 0x5032, "ThumbnailSoftwareUsed"},
- { 0x5033, "ThumbnailDateTime"},
- { 0x5034, "ThumbnailArtist"},
- { 0x5035, "ThumbnailWhitePoint"},
- { 0x5036, "ThumbnailPrimaryChromaticities"},
- { 0x5037, "ThumbnailYCbCrCoefficients"},
- { 0x5038, "ThumbnailYCbCrSubsampling"},
- { 0x5039, "ThumbnailYCbCrPositioning"},
- { 0x503A, "ThumbnailRefBlackWhite"},
- { 0x503B, "ThumbnailCopyRight"},
- { 0x5090, "LuminanceTable"},
- { 0x5091, "ChrominanceTable"},
- { 0x5100, "FrameDelay"},
- { 0x5101, "LoopCount"},
- { 0x5110, "PixelUnit"},
- { 0x5111, "PixelPerUnitX"},
- { 0x5112, "PixelPerUnitY"},
- { 0x5113, "PaletteHistogram"},
- { 0x1000, "RelatedImageFileFormat"},
- { 0x800D, "ImageID"},
- { 0x80E3, "Matteing"}, /* obsoleted by ExtraSamples */
- { 0x80E4, "DataType"}, /* obsoleted by SampleFormat */
- { 0x80E5, "ImageDepth"},
- { 0x80E6, "TileDepth"},
- { 0x828D, "CFARepeatPatternDim"},
- { 0x828E, "CFAPattern"},
- { 0x828F, "BatteryLevel"},
- { 0x8298, "Copyright"},
- { 0x829A, "ExposureTime"},
- { 0x829D, "FNumber"},
- { 0x83BB, "IPTC/NAA"},
- { 0x84E3, "IT8RasterPadding"},
- { 0x84E5, "IT8ColorTable"},
- { 0x8649, "ImageResourceInformation"}, /* PhotoShop */
- { 0x8769, "Exif_IFD_Pointer"},
- { 0x8773, "ICC_Profile"},
- { 0x8822, "ExposureProgram"},
- { 0x8824, "SpectralSensity"},
- { 0x8828, "OECF"},
- { 0x8825, "GPS_IFD_Pointer"},
- { 0x8827, "ISOSpeedRatings"},
- { 0x8828, "OECF"},
- { 0x9000, "ExifVersion"},
- { 0x9003, "DateTimeOriginal"},
- { 0x9004, "DateTimeDigitized"},
- { 0x9101, "ComponentsConfiguration"},
- { 0x9102, "CompressedBitsPerPixel"},
- { 0x9201, "ShutterSpeedValue"},
- { 0x9202, "ApertureValue"},
- { 0x9203, "BrightnessValue"},
- { 0x9204, "ExposureBiasValue"},
- { 0x9205, "MaxApertureValue"},
- { 0x9206, "SubjectDistance"},
- { 0x9207, "MeteringMode"},
- { 0x9208, "LightSource"},
- { 0x9209, "Flash"},
- { 0x920A, "FocalLength"},
- { 0x920B, "FlashEnergy"}, /* 0xA20B in JPEG */
- { 0x920C, "SpatialFrequencyResponse"}, /* 0xA20C - - */
- { 0x920D, "Noise"},
- { 0x920E, "FocalPlaneXResolution"}, /* 0xA20E - - */
- { 0x920F, "FocalPlaneYResolution"}, /* 0xA20F - - */
- { 0x9210, "FocalPlaneResolutionUnit"}, /* 0xA210 - - */
- { 0x9211, "ImageNumber"},
- { 0x9212, "SecurityClassification"},
- { 0x9213, "ImageHistory"},
- { 0x9214, "SubjectLocation"}, /* 0xA214 - - */
- { 0x9215, "ExposureIndex"}, /* 0xA215 - - */
- { 0x9216, "TIFF/EPStandardID"},
- { 0x9217, "SensingMethod"}, /* 0xA217 - - */
- { 0x923F, "StoNits"},
- { 0x927C, "MakerNote"},
- { 0x9286, "UserComment"},
- { 0x9290, "SubSecTime"},
- { 0x9291, "SubSecTimeOriginal"},
- { 0x9292, "SubSecTimeDigitized"},
- { 0x935C, "ImageSourceData"}, /* "Adobe Photoshop Document Data Block": 8BIM... */
- { 0x9c9b, "Title" }, /* Win XP specific, Unicode */
- { 0x9c9c, "Comments" }, /* Win XP specific, Unicode */
- { 0x9c9d, "Author" }, /* Win XP specific, Unicode */
- { 0x9c9e, "Keywords" }, /* Win XP specific, Unicode */
- { 0x9c9f, "Subject" }, /* Win XP specific, Unicode, not to be confused with SubjectDistance and SubjectLocation */
- { 0xA000, "FlashPixVersion"},
- { 0xA001, "ColorSpace"},
- { 0xA002, "ExifImageWidth"},
- { 0xA003, "ExifImageLength"},
- { 0xA004, "RelatedSoundFile"},
- { 0xA005, "InteroperabilityOffset"},
- { 0xA20B, "FlashEnergy"}, /* 0x920B in TIFF/EP */
- { 0xA20C, "SpatialFrequencyResponse"}, /* 0x920C - - */
- { 0xA20D, "Noise"},
- { 0xA20E, "FocalPlaneXResolution"}, /* 0x920E - - */
- { 0xA20F, "FocalPlaneYResolution"}, /* 0x920F - - */
- { 0xA210, "FocalPlaneResolutionUnit"}, /* 0x9210 - - */
- { 0xA211, "ImageNumber"},
- { 0xA212, "SecurityClassification"},
- { 0xA213, "ImageHistory"},
- { 0xA214, "SubjectLocation"}, /* 0x9214 - - */
- { 0xA215, "ExposureIndex"}, /* 0x9215 - - */
- { 0xA216, "TIFF/EPStandardID"},
- { 0xA217, "SensingMethod"}, /* 0x9217 - - */
- { 0xA300, "FileSource"},
- { 0xA301, "SceneType"},
- { 0xA302, "CFAPattern"},
- { 0xA401, "CustomRendered"},
- { 0xA402, "ExposureMode"},
- { 0xA403, "WhiteBalance"},
- { 0xA404, "DigitalZoomRatio"},
- { 0xA405, "FocalLengthIn35mmFilm"},
- { 0xA406, "SceneCaptureType"},
- { 0xA407, "GainControl"},
- { 0xA408, "Contrast"},
- { 0xA409, "Saturation"},
- { 0xA40A, "Sharpness"},
- { 0xA40B, "DeviceSettingDescription"},
- { 0xA40C, "SubjectDistanceRange"},
- { 0xA420, "ImageUniqueID"},
- TAG_TABLE_END
-} ;
-
-static tag_info_array tag_table_GPS = {
- { 0x0000, "GPSVersion"},
- { 0x0001, "GPSLatitudeRef"},
- { 0x0002, "GPSLatitude"},
- { 0x0003, "GPSLongitudeRef"},
- { 0x0004, "GPSLongitude"},
- { 0x0005, "GPSAltitudeRef"},
- { 0x0006, "GPSAltitude"},
- { 0x0007, "GPSTimeStamp"},
- { 0x0008, "GPSSatellites"},
- { 0x0009, "GPSStatus"},
- { 0x000A, "GPSMeasureMode"},
- { 0x000B, "GPSDOP"},
- { 0x000C, "GPSSpeedRef"},
- { 0x000D, "GPSSpeed"},
- { 0x000E, "GPSTrackRef"},
- { 0x000F, "GPSTrack"},
- { 0x0010, "GPSImgDirectionRef"},
- { 0x0011, "GPSImgDirection"},
- { 0x0012, "GPSMapDatum"},
- { 0x0013, "GPSDestLatitudeRef"},
- { 0x0014, "GPSDestLatitude"},
- { 0x0015, "GPSDestLongitudeRef"},
- { 0x0016, "GPSDestLongitude"},
- { 0x0017, "GPSDestBearingRef"},
- { 0x0018, "GPSDestBearing"},
- { 0x0019, "GPSDestDistanceRef"},
- { 0x001A, "GPSDestDistance"},
- { 0x001B, "GPSProcessingMode"},
- { 0x001C, "GPSAreaInformation"},
- { 0x001D, "GPSDateStamp"},
- { 0x001E, "GPSDifferential"},
- TAG_TABLE_END
-};
-
-static tag_info_array tag_table_IOP = {
- { 0x0001, "InterOperabilityIndex"}, /* should be 'R98' or 'THM' */
- { 0x0002, "InterOperabilityVersion"},
- { 0x1000, "RelatedFileFormat"},
- { 0x1001, "RelatedImageWidth"},
- { 0x1002, "RelatedImageHeight"},
- TAG_TABLE_END
-};
-
-static tag_info_array tag_table_VND_CANON = {
- { 0x0001, "ModeArray"}, /* guess */
- { 0x0004, "ImageInfo"}, /* guess */
- { 0x0006, "ImageType"},
- { 0x0007, "FirmwareVersion"},
- { 0x0008, "ImageNumber"},
- { 0x0009, "OwnerName"},
- { 0x000C, "Camera"},
- { 0x000F, "CustomFunctions"},
- TAG_TABLE_END
-};
-
-static tag_info_array tag_table_VND_CASIO = {
- { 0x0001, "RecordingMode"},
- { 0x0002, "Quality"},
- { 0x0003, "FocusingMode"},
- { 0x0004, "FlashMode"},
- { 0x0005, "FlashIntensity"},
- { 0x0006, "ObjectDistance"},
- { 0x0007, "WhiteBalance"},
- { 0x000A, "DigitalZoom"},
- { 0x000B, "Sharpness"},
- { 0x000C, "Contrast"},
- { 0x000D, "Saturation"},
- { 0x0014, "CCDSensitivity"},
- TAG_TABLE_END
-};
-
-static tag_info_array tag_table_VND_FUJI = {
- { 0x0000, "Version"},
- { 0x1000, "Quality"},
- { 0x1001, "Sharpness"},
- { 0x1002, "WhiteBalance"},
- { 0x1003, "Color"},
- { 0x1004, "Tone"},
- { 0x1010, "FlashMode"},
- { 0x1011, "FlashStrength"},
- { 0x1020, "Macro"},
- { 0x1021, "FocusMode"},
- { 0x1030, "SlowSync"},
- { 0x1031, "PictureMode"},
- { 0x1100, "ContTake"},
- { 0x1300, "BlurWarning"},
- { 0x1301, "FocusWarning"},
- { 0x1302, "AEWarning "},
- TAG_TABLE_END
-};
-
-static tag_info_array tag_table_VND_NIKON = {
- { 0x0003, "Quality"},
- { 0x0004, "ColorMode"},
- { 0x0005, "ImageAdjustment"},
- { 0x0006, "CCDSensitivity"},
- { 0x0007, "WhiteBalance"},
- { 0x0008, "Focus"},
- { 0x000a, "DigitalZoom"},
- { 0x000b, "Converter"},
- TAG_TABLE_END
-};
-
-static tag_info_array tag_table_VND_NIKON_990 = {
- { 0x0001, "Version"},
- { 0x0002, "ISOSetting"},
- { 0x0003, "ColorMode"},
- { 0x0004, "Quality"},
- { 0x0005, "WhiteBalance"},
- { 0x0006, "ImageSharpening"},
- { 0x0007, "FocusMode"},
- { 0x0008, "FlashSetting"},
- { 0x000F, "ISOSelection"},
- { 0x0080, "ImageAdjustment"},
- { 0x0082, "AuxiliaryLens"},
- { 0x0085, "ManualFocusDistance"},
- { 0x0086, "DigitalZoom"},
- { 0x0088, "AFFocusPosition"},
- { 0x0010, "DataDump"},
- TAG_TABLE_END
-};
-
-static tag_info_array tag_table_VND_OLYMPUS = {
- { 0x0200, "SpecialMode"},
- { 0x0201, "JPEGQuality"},
- { 0x0202, "Macro"},
- { 0x0204, "DigitalZoom"},
- { 0x0207, "SoftwareRelease"},
- { 0x0208, "PictureInfo"},
- { 0x0209, "CameraId"},
- { 0x0F00, "DataDump"},
- TAG_TABLE_END
-};
-
-typedef enum mn_byte_order_t {
- MN_ORDER_INTEL = 0,
- MN_ORDER_MOTOROLA = 1,
- MN_ORDER_NORMAL
-} mn_byte_order_t;
-
-typedef enum mn_offset_mode_t {
- MN_OFFSET_NORMAL,
- MN_OFFSET_MAKER,
- MN_OFFSET_GUESS
-} mn_offset_mode_t;
-
-typedef struct {
- tag_table_type tag_table;
- char * make;
- char * model;
- char * id_string;
- int id_string_len;
- int offset;
- mn_byte_order_t byte_order;
- mn_offset_mode_t offset_mode;
-} maker_note_type;
-
-static const maker_note_type maker_note_array[] = {
- { tag_table_VND_CANON, "Canon", NULL, NULL, 0, 0, MN_ORDER_INTEL, MN_OFFSET_GUESS},
-/* { tag_table_VND_CANON, "Canon", NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},*/
- { tag_table_VND_CASIO, "CASIO", NULL, NULL, 0, 0, MN_ORDER_MOTOROLA, MN_OFFSET_NORMAL},
- { tag_table_VND_FUJI, "FUJIFILM", NULL, "FUJIFILM\x0C\x00\x00\x00", 12, 12, MN_ORDER_INTEL, MN_OFFSET_MAKER},
- { tag_table_VND_NIKON, "NIKON", NULL, "Nikon\x00\x01\x00", 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
- { tag_table_VND_NIKON_990, "NIKON", NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
- { tag_table_VND_OLYMPUS, "OLYMPUS OPTICAL CO.,LTD", NULL, "OLYMP\x00\x01\x00", 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
-};
-/* }}} */
-
-/* {{{ exif_get_tagname
- Get headername for tag_num or NULL if not defined */
-static char * exif_get_tagname(int tag_num, char *ret, int len, tag_table_type tag_table TSRMLS_DC)
-{
- int i, t;
- char tmp[32];
-
- for (i=0;;i++) {
- if ((t=tag_table[i].Tag) == tag_num || t==TAG_END_OF_LIST) {
- if (t==TAG_END_OF_LIST) {
- break;
- }
- if (ret && len) {
- strncpy(ret, tag_table[i].Desc, abs(len));
- if (len<0) {
- len = -len;
- ret[len-1]='\0';
- for(i=strlen(ret);i<len;i++)ret[i]=' ';
- }
- ret[len-1]='\0';
- return ret;
- }
- return tag_table[i].Desc;
- }
- }
- if (ret && len) {
- snprintf(tmp, sizeof(tmp), "UndefinedTag:0x%04X", tag_num);
- strncpy(ret, tmp, abs(len));
- if (len<0) {
- len = -len;
- ret[len-1]='\0';
- for(i=strlen(ret);i<len;i++)ret[i]=' ';
- }
- ret[len-1]='\0';
- return ret;
- }
- return "";
-}
-/* }}} */
-
-/* {{{ exif_char_dump
- * Do not use! This is a debug function... */
-#ifdef EXIF_DEBUG
-static unsigned char* exif_char_dump(unsigned char * addr, int len, int offset)
-{
- static unsigned char buf[4096+1];
- static unsigned char tmp[20];
- int c, i, p=0, n = 5+31;
-
- p += sprintf(buf+p, "\nDump Len: %08X (%d)", len, len);
- if (len) {
- for(i=0; i<len+15 && p+n<=sizeof(buf); i++) {
- if (i%16==0) {
- p += sprintf(buf+p, "\n%08X: ", i+offset);
- }
- if (i<len) {
- c = *addr++;
- p += sprintf(buf+p, "%02X ", c);
- tmp[i%16] = c>=32 ? c : '.';
- tmp[(i%16)+1] = '\0';
- } else {
- p += sprintf(buf+p, " ");
- }
- if (i%16==15) {
- p += sprintf(buf+p, " %s", tmp);
- if (i>=len) {
- break;
- }
- }
- }
- }
- buf[sizeof(buf)-1] = '\0';
- return buf;
-}
-#endif
-/* }}} */
-
-/* {{{ php_jpg_get16
- Get 16 bits motorola order (always) for jpeg header stuff.
-*/
-static int php_jpg_get16(void *value)
-{
- return (((uchar *)value)[0] << 8) | ((uchar *)value)[1];
-}
-/* }}} */
-
-/* {{{ php_ifd_get16u
- * Convert a 16 bit unsigned value from file's native byte order */
-static int php_ifd_get16u(void *value, int motorola_intel)
-{
- if (motorola_intel) {
- return (((uchar *)value)[0] << 8) | ((uchar *)value)[1];
- } else {
- return (((uchar *)value)[1] << 8) | ((uchar *)value)[0];
- }
-}
-/* }}} */
-
-/* {{{ php_ifd_get16s
- * Convert a 16 bit signed value from file's native byte order */
-static signed short php_ifd_get16s(void *value, int motorola_intel)
-{
- return (signed short)php_ifd_get16u(value, motorola_intel);
-}
-/* }}} */
-
-/* {{{ php_ifd_get32s
- * Convert a 32 bit signed value from file's native byte order */
-static int php_ifd_get32s(void *value, int motorola_intel)
-{
- if (motorola_intel) {
- return (((char *)value)[0] << 24)
- | (((uchar *)value)[1] << 16)
- | (((uchar *)value)[2] << 8 )
- | (((uchar *)value)[3] );
- } else {
- return (((char *)value)[3] << 24)
- | (((uchar *)value)[2] << 16)
- | (((uchar *)value)[1] << 8 )
- | (((uchar *)value)[0] );
- }
-}
-/* }}} */
-
-/* {{{ php_ifd_get32u
- * Write 32 bit unsigned value to data */
-static unsigned php_ifd_get32u(void *value, int motorola_intel)
-{
- return (unsigned)php_ifd_get32s(value, motorola_intel) & 0xffffffff;
-}
-/* }}} */
-
-/* {{{ php_ifd_set16u
- * Write 16 bit unsigned value to data */
-static void php_ifd_set16u(char *data, unsigned int value, int motorola_intel)
-{
- if (motorola_intel) {
- data[0] = (value & 0xFF00) >> 8;
- data[1] = (value & 0x00FF);
- } else {
- data[1] = (value & 0xFF00) >> 8;
- data[0] = (value & 0x00FF);
- }
-}
-/* }}} */
-
-/* {{{ php_ifd_set32u
- * Convert a 32 bit unsigned value from file's native byte order */
-static void php_ifd_set32u(char *data, size_t value, int motorola_intel)
-{
- if (motorola_intel) {
- data[0] = (value & 0xFF000000) >> 24;
- data[1] = (value & 0x00FF0000) >> 16;
- data[2] = (value & 0x0000FF00) >> 8;
- data[3] = (value & 0x000000FF);
- } else {
- data[3] = (value & 0xFF000000) >> 24;
- data[2] = (value & 0x00FF0000) >> 16;
- data[1] = (value & 0x0000FF00) >> 8;
- data[0] = (value & 0x000000FF);
- }
-}
-/* }}} */
-
-/* {{{ exif_convert_any_format
- * Evaluate number, be it int, rational, or float from directory. */
-static double exif_convert_any_format(void *value, int format, int motorola_intel TSRMLS_DC)
-{
- int s_den;
- unsigned u_den;
-
- switch(format) {
- case TAG_FMT_SBYTE: return *(signed char *)value;
- case TAG_FMT_BYTE: return *(uchar *)value;
-
- case TAG_FMT_USHORT: return php_ifd_get16u(value, motorola_intel);
- case TAG_FMT_ULONG: return php_ifd_get32u(value, motorola_intel);
-
- case TAG_FMT_URATIONAL:
- u_den = php_ifd_get32u(4+(char *)value, motorola_intel);
- if (u_den == 0) {
- return 0;
- } else {
- return (double)php_ifd_get32u(value, motorola_intel) / u_den;
- }
-
- case TAG_FMT_SRATIONAL:
- s_den = php_ifd_get32s(4+(char *)value, motorola_intel);
- if (s_den == 0) {
- return 0;
- } else {
- return (double)php_ifd_get32s(value, motorola_intel) / s_den;
- }
-
- case TAG_FMT_SSHORT: return (signed short)php_ifd_get16u(value, motorola_intel);
- case TAG_FMT_SLONG: return php_ifd_get32s(value, motorola_intel);
-
- /* Not sure if this is correct (never seen float used in Exif format) */
- case TAG_FMT_SINGLE:
-#ifdef EXIF_DEBUG
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found value of type single");
-#endif
- return (double)*(float *)value;
- case TAG_FMT_DOUBLE:
-#ifdef EXIF_DEBUG
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found value of type double");
-#endif
- return *(double *)value;
- }
- return 0;
-}
-/* }}} */
-
-/* {{{ exif_convert_any_to_int
- * Evaluate number, be it int, rational, or float from directory. */
-static size_t exif_convert_any_to_int(void *value, int format, int motorola_intel TSRMLS_DC)
-{
- int s_den;
- unsigned u_den;
-
- switch(format) {
- case TAG_FMT_SBYTE: return *(signed char *)value;
- case TAG_FMT_BYTE: return *(uchar *)value;
-
- case TAG_FMT_USHORT: return php_ifd_get16u(value, motorola_intel);
- case TAG_FMT_ULONG: return php_ifd_get32u(value, motorola_intel);
-
- case TAG_FMT_URATIONAL:
- u_den = php_ifd_get32u(4+(char *)value, motorola_intel);
- if (u_den == 0) {
- return 0;
- } else {
- return php_ifd_get32u(value, motorola_intel) / u_den;
- }
-
- case TAG_FMT_SRATIONAL:
- s_den = php_ifd_get32s(4+(char *)value, motorola_intel);
- if (s_den == 0) {
- return 0;
- } else {
- return php_ifd_get32s(value, motorola_intel) / s_den;
- }
-
- case TAG_FMT_SSHORT: return php_ifd_get16u(value, motorola_intel);
- case TAG_FMT_SLONG: return php_ifd_get32s(value, motorola_intel);
-
- /* Not sure if this is correct (never seen float used in Exif format) */
- case TAG_FMT_SINGLE:
-#ifdef EXIF_DEBUG
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found value of type single");
-#endif
- return (size_t)*(float *)value;
- case TAG_FMT_DOUBLE:
-#ifdef EXIF_DEBUG
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found value of type double");
-#endif
- return (size_t)*(double *)value;
- }
- return 0;
-}
-/* }}} */
-
-/* {{{ struct image_info_value, image_info_list
-*/
-#ifndef WORD
-#define WORD unsigned short
-#endif
-#ifndef DWORD
-#define DWORD unsigned int
-#endif
-
-typedef struct {
- int num;
- int den;
-} signed_rational;
-
-typedef struct {
- unsigned int num;
- unsigned int den;
-} unsigned_rational;
-
-typedef union _image_info_value {
- char *s;
- unsigned u;
- int i;
- float f;
- double d;
- signed_rational sr;
- unsigned_rational ur;
- union _image_info_value *list;
-} image_info_value;
-
-typedef struct {
- WORD tag;
- WORD format;
- DWORD length;
- DWORD dummy; /* value ptr of tiff directory entry */
- char *name;
- image_info_value value;
-} image_info_data;
-
-typedef struct {
- int count;
- image_info_data *list;
-} image_info_list;
-/* }}} */
-
-/* {{{ exif_get_sectionname
- Returns the name of a section
-*/
-#define SECTION_FILE 0
-#define SECTION_COMPUTED 1
-#define SECTION_ANY_TAG 2
-#define SECTION_IFD0 3
-#define SECTION_THUMBNAIL 4
-#define SECTION_COMMENT 5
-#define SECTION_APP0 6
-#define SECTION_EXIF 7
-#define SECTION_FPIX 8
-#define SECTION_GPS 9
-#define SECTION_INTEROP 10
-#define SECTION_APP12 11
-#define SECTION_WINXP 12
-#define SECTION_MAKERNOTE 13
-#define SECTION_COUNT 14
-
-#define FOUND_FILE (1<<SECTION_FILE)
-#define FOUND_COMPUTED (1<<SECTION_COMPUTED)
-#define FOUND_ANY_TAG (1<<SECTION_ANY_TAG)
-#define FOUND_IFD0 (1<<SECTION_IFD0)
-#define FOUND_THUMBNAIL (1<<SECTION_THUMBNAIL)
-#define FOUND_COMMENT (1<<SECTION_COMMENT)
-#define FOUND_APP0 (1<<SECTION_APP0)
-#define FOUND_EXIF (1<<SECTION_EXIF)
-#define FOUND_FPIX (1<<SECTION_FPIX)
-#define FOUND_GPS (1<<SECTION_GPS)
-#define FOUND_INTEROP (1<<SECTION_INTEROP)
-#define FOUND_APP12 (1<<SECTION_APP12)
-#define FOUND_WINXP (1<<SECTION_WINXP)
-#define FOUND_MAKERNOTE (1<<SECTION_MAKERNOTE)
-
-static char *exif_get_sectionname(int section)
-{
- switch(section) {
- case SECTION_FILE: return "FILE";
- case SECTION_COMPUTED: return "COMPUTED";
- case SECTION_ANY_TAG: return "ANY_TAG";
- case SECTION_IFD0: return "IFD0";
- case SECTION_THUMBNAIL: return "THUMBNAIL";
- case SECTION_COMMENT: return "COMMENT";
- case SECTION_APP0: return "APP0";
- case SECTION_EXIF: return "EXIF";
- case SECTION_FPIX: return "FPIX";
- case SECTION_GPS: return "GPS";
- case SECTION_INTEROP: return "INTEROP";
- case SECTION_APP12: return "APP12";
- case SECTION_WINXP: return "WINXP";
- case SECTION_MAKERNOTE: return "MAKERNOTE";
- }
- return "";
-}
-
-static const tag_table_type exif_get_tag_table(int section)
-{
- switch(section) {
- case SECTION_FILE: return &tag_table_IFD[0];
- case SECTION_COMPUTED: return &tag_table_IFD[0];
- case SECTION_ANY_TAG: return &tag_table_IFD[0];
- case SECTION_IFD0: return &tag_table_IFD[0];
- case SECTION_THUMBNAIL: return &tag_table_IFD[0];
- case SECTION_COMMENT: return &tag_table_IFD[0];
- case SECTION_APP0: return &tag_table_IFD[0];
- case SECTION_EXIF: return &tag_table_IFD[0];
- case SECTION_FPIX: return &tag_table_IFD[0];
- case SECTION_GPS: return &tag_table_GPS[0];
- case SECTION_INTEROP: return &tag_table_IOP[0];
- case SECTION_APP12: return &tag_table_IFD[0];
- case SECTION_WINXP: return &tag_table_IFD[0];
- }
- return &tag_table_IFD[0];
-}
-/* }}} */
-
-/* {{{ exif_get_sectionlist
- Return list of sectionnames specified by sectionlist. Return value must be freed
-*/
-static char *exif_get_sectionlist(int sectionlist TSRMLS_DC)
-{
- int i, len=0;
- char *sections;
-
- for(i=0; i<SECTION_COUNT; i++) {
- len += strlen(exif_get_sectionname(i))+2;
- }
- sections = safe_emalloc(len, 1, 1);
- sections[0] = '\0';
- len = 0;
- for(i=0; i<SECTION_COUNT; i++) {
- if (sectionlist&(1<<i)) {
- sprintf(sections+len, "%s, ", exif_get_sectionname(i));
- len = strlen(sections);
- }
- }
- if (len>2)
- sections[len-2] = '\0';
- return sections;
-}
-/* }}} */
-
-/* {{{ struct image_info_type
- This structure stores Exif header image elements in a simple manner
- Used to store camera data as extracted from the various ways that it can be
- stored in a nexif header
-*/
-
-typedef struct {
- int type;
- size_t size;
- uchar *data;
-} file_section;
-
-typedef struct {
- int count;
- file_section *list;
-} file_section_list;
-
-typedef struct {
- image_filetype filetype;
- size_t width, height;
- size_t size;
- size_t offset;
- char *data;
-} thumbnail_data;
-
-typedef struct {
- char *value;
- size_t size;
- int tag;
-} xp_field_type;
-
-typedef struct {
- int count;
- xp_field_type *list;
-} xp_field_list;
-
-/* This structure is used to store a section of a Jpeg file. */
-typedef struct {
- php_stream *infile;
- char *FileName;
- time_t FileDateTime;
- size_t FileSize;
- image_filetype FileType;
- int Height, Width;
- int IsColor;
-
- char *make;
- char *model;
-
- float ApertureFNumber;
- float ExposureTime;
- double FocalplaneUnits;
- float CCDWidth;
- double FocalplaneXRes;
- size_t ExifImageWidth;
- float FocalLength;
- float Distance;
-
- int motorola_intel; /* 1 Motorola; 0 Intel */
-
- char *UserComment;
- int UserCommentLength;
- char *UserCommentEncoding;
- char *encode_unicode;
- char *decode_unicode_be;
- char *decode_unicode_le;
- char *encode_jis;
- char *decode_jis_be;
- char *decode_jis_le;
- char *Copyright;/* EXIF standard defines Copyright as "<Photographer> [ '\0' <Editor> ] ['\0']" */
- char *CopyrightPhotographer;
- char *CopyrightEditor;
-
- xp_field_list xp_fields;
-
- thumbnail_data Thumbnail;
- /* other */
- int sections_found; /* FOUND_<marker> */
- image_info_list info_list[SECTION_COUNT];
- /* for parsing */
- int read_thumbnail;
- int read_all;
- /* internal */
- file_section_list file;
-} image_info_type;
-/* }}} */
-
-/* {{{ exif_error_docref */
-static void exif_error_docref(const char *docref TSRMLS_DC, const image_info_type *ImageInfo, int type, const char *format, ...)
-{
- va_list args;
-
- va_start(args, format);
- php_verror(docref, ImageInfo->FileName?ImageInfo->FileName:"", type, format, args TSRMLS_CC);
- va_end(args);
-}
-/* }}} */
-
-/* {{{ jpeg_sof_info
- */
-typedef struct {
- int bits_per_sample;
- size_t width;
- size_t height;
- int num_components;
-} jpeg_sof_info;
-/* }}} */
-
-/* {{{ exif_file_sections_add
- Add a file_section to image_info
- returns the used block or -1. if size>0 and data == NULL buffer of size is allocated
-*/
-static int exif_file_sections_add(image_info_type *ImageInfo, int type, size_t size, uchar *data)
-{
- file_section *tmp;
- int count = ImageInfo->file.count;
-
- tmp = erealloc(ImageInfo->file.list, (count+1)*sizeof(file_section));
- ImageInfo->file.list = tmp;
- ImageInfo->file.list[count].type = 0xFFFF;
- ImageInfo->file.list[count].data = NULL;
- ImageInfo->file.list[count].size = 0;
- ImageInfo->file.count = count+1;
- if (!size) {
- data = NULL;
- } else if (data == NULL) {
- data = emalloc(size);
- }
- ImageInfo->file.list[count].type = type;
- ImageInfo->file.list[count].data = data;
- ImageInfo->file.list[count].size = size;
- return count;
-}
-/* }}} */
-
-/* {{{ exif_file_sections_realloc
- Reallocate a file section returns 0 on success and -1 on failure
-*/
-static int exif_file_sections_realloc(image_info_type *ImageInfo, int section_index, size_t size TSRMLS_DC)
-{
- void *tmp;
-
- /* This is not a malloc/realloc check. It is a plausibility check for the
- * function parameters (requirements engineering).
- */
- if (section_index >= ImageInfo->file.count) {
- EXIF_ERRLOG_FSREALLOC
- return -1;
- }
- tmp = erealloc(ImageInfo->file.list[section_index].data, size);
- ImageInfo->file.list[section_index].data = tmp;
- ImageInfo->file.list[section_index].size = size;
- return 0;
-}
-/* }}} */
-
-/* {{{ exif_file_section_free
- Discard all file_sections in ImageInfo
-*/
-static int exif_file_sections_free(image_info_type *ImageInfo)
-{
- int i;
-
- if (ImageInfo->file.count) {
- for (i=0; i<ImageInfo->file.count; i++) {
- EFREE_IF(ImageInfo->file.list[i].data);
- }
- }
- EFREE_IF(ImageInfo->file.list);
- ImageInfo->file.count = 0;
- return TRUE;
-}
-/* }}} */
-
-/* {{{ exif_iif_add_value
- Add a value to image_info
-*/
-static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value, int motorola_intel TSRMLS_DC)
-{
- size_t idex;
- void *vptr;
- image_info_value *info_value;
- image_info_data *info_data;
- image_info_data *list;
-
- if (length >= LONG_MAX) {
- return;
- }
-
- list = erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1)*sizeof(image_info_data));
- image_info->info_list[section_index].list = list;
-
- info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count];
- info_data->tag = tag;
- info_data->format = format;
- info_data->length = length;
- info_data->name = estrdup(name);
- info_value = &info_data->value;
-
- switch (format) {
- case TAG_FMT_STRING:
- if (value) {
- length = php_strnlen(value, length);
- if (PG(magic_quotes_runtime)) {
- info_value->s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
- } else {
- info_value->s = estrndup(value, length);
- }
- info_data->length = length;
- } else {
- info_data->length = 0;
- info_value->s = estrdup("");
- }
- break;
-
- default:
- /* Standard says more types possible but skip them...
- * but allow users to handle data if they know how to
- * So not return but use type UNDEFINED
- * return;
- */
- info_data->tag = TAG_FMT_UNDEFINED;/* otherwise not freed from memory */
- case TAG_FMT_SBYTE:
- case TAG_FMT_BYTE:
- /* in contrast to strings bytes do not need to allocate buffer for NULL if length==0 */
- if (!length)
- break;
- case TAG_FMT_UNDEFINED:
- if (value) {
- /* do not recompute length here */
- if (PG(magic_quotes_runtime)) {
- info_value->s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
- } else {
- info_value->s = estrndup(value, length);
- }
- info_data->length = length;
- } else {
- info_data->length = 0;
- info_value->s = estrdup("");
- }
- break;
-
- case TAG_FMT_USHORT:
- case TAG_FMT_ULONG:
- case TAG_FMT_URATIONAL:
- case TAG_FMT_SSHORT:
- case TAG_FMT_SLONG:
- case TAG_FMT_SRATIONAL:
- case TAG_FMT_SINGLE:
- case TAG_FMT_DOUBLE:
- if (length==0) {
- break;
- } else
- if (length>1) {
- info_value->list = safe_emalloc(length, sizeof(image_info_value), 0);
- } else {
- info_value = &info_data->value;
- }
- for (idex=0,vptr=value; idex<length; idex++,vptr=(char *) vptr + php_tiff_bytes_per_format[format]) {
- if (length>1) {
- info_value = &info_data->value.list[idex];
- }
- switch (format) {
- case TAG_FMT_USHORT:
- info_value->u = php_ifd_get16u(vptr, motorola_intel);
- break;
-
- case TAG_FMT_ULONG:
- info_value->u = php_ifd_get32u(vptr, motorola_intel);
- break;
-
- case TAG_FMT_URATIONAL:
- info_value->ur.num = php_ifd_get32u(vptr, motorola_intel);
- info_value->ur.den = php_ifd_get32u(4+(char *)vptr, motorola_intel);
- break;
-
- case TAG_FMT_SSHORT:
- info_value->i = php_ifd_get16s(vptr, motorola_intel);
- break;
-
- case TAG_FMT_SLONG:
- info_value->i = php_ifd_get32s(vptr, motorola_intel);
- break;
-
- case TAG_FMT_SRATIONAL:
- info_value->sr.num = php_ifd_get32u(vptr, motorola_intel);
- info_value->sr.den = php_ifd_get32u(4+(char *)vptr, motorola_intel);
- break;
-
- case TAG_FMT_SINGLE:
-#ifdef EXIF_DEBUG
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Found value of type single");
-#endif
- info_value->f = *(float *)value;
-
- case TAG_FMT_DOUBLE:
-#ifdef EXIF_DEBUG
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Found value of type double");
-#endif
- info_value->d = *(double *)value;
- break;
- }
- }
- }
- image_info->sections_found |= 1<<section_index;
- image_info->info_list[section_index].count++;
-}
-/* }}} */
-
-/* {{{ exif_iif_add_tag
- Add a tag from IFD to image_info
-*/
-static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value TSRMLS_DC)
-{
- exif_iif_add_value(image_info, section_index, name, tag, format, length, value, image_info->motorola_intel TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ exif_iif_add_int
- Add an int value to image_info
-*/
-static void exif_iif_add_int(image_info_type *image_info, int section_index, char *name, int value TSRMLS_DC)
-{
- image_info_data *info_data;
- image_info_data *list;
-
- list = erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1)*sizeof(image_info_data));
- image_info->info_list[section_index].list = list;
-
- info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count];
- info_data->tag = TAG_NONE;
- info_data->format = TAG_FMT_SLONG;
- info_data->length = 1;
- info_data->name = estrdup(name);
- info_data->value.i = value;
- image_info->sections_found |= 1<<section_index;
- image_info->info_list[section_index].count++;
-}
-/* }}} */
-
-/* {{{ exif_iif_add_str
- Add a string value to image_info MUST BE NUL TERMINATED
-*/
-static void exif_iif_add_str(image_info_type *image_info, int section_index, char *name, char *value TSRMLS_DC)
-{
- image_info_data *info_data;
- image_info_data *list;
-
- if (value) {
- list = erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1)*sizeof(image_info_data));
- image_info->info_list[section_index].list = list;
- info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count];
- info_data->tag = TAG_NONE;
- info_data->format = TAG_FMT_STRING;
- info_data->length = 1;
- info_data->name = estrdup(name);
- if (PG(magic_quotes_runtime)) {
- info_data->value.s = php_addslashes(value, strlen(value), NULL, 0 TSRMLS_CC);
- } else {
- info_data->value.s = estrdup(value);
- }
- image_info->sections_found |= 1<<section_index;
- image_info->info_list[section_index].count++;
- }
-}
-/* }}} */
-
-/* {{{ exif_iif_add_fmt
- Add a format string value to image_info MUST BE NUL TERMINATED
-*/
-static void exif_iif_add_fmt(image_info_type *image_info, int section_index, char *name TSRMLS_DC, char *value, ...)
-{
- char *tmp;
- va_list arglist;
-
- va_start(arglist, value);
- if (value) {
- vspprintf(&tmp, 0, value, arglist);
- exif_iif_add_str(image_info, section_index, name, tmp TSRMLS_CC);
- efree(tmp);
- }
- va_end(arglist);
-}
-/* }}} */
-
-/* {{{ exif_iif_add_str
- Add a string value to image_info MUST BE NUL TERMINATED
-*/
-static void exif_iif_add_buffer(image_info_type *image_info, int section_index, char *name, int length, char *value TSRMLS_DC)
-{
- image_info_data *info_data;
- image_info_data *list;
-
- if (value) {
- list = erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1)*sizeof(image_info_data));
- image_info->info_list[section_index].list = list;
- info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count];
- info_data->tag = TAG_NONE;
- info_data->format = TAG_FMT_UNDEFINED;
- info_data->length = length;
- info_data->name = estrdup(name);
- if (PG(magic_quotes_runtime)) {
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, image_info, E_NOTICE, "Adding %s as buffer%s", name, exif_char_dump(value, length, 0));
-#endif
- info_data->value.s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
- info_data->length = length;
- } else {
- info_data->value.s = safe_emalloc(length, 1, 1);
- memcpy(info_data->value.s, value, length);
- info_data->value.s[length] = 0;
- }
- image_info->sections_found |= 1<<section_index;
- image_info->info_list[section_index].count++;
- }
-}
-/* }}} */
-
-/* {{{ exif_iif_free
- Free memory allocated for image_info
-*/
-static void exif_iif_free(image_info_type *image_info, int section_index) {
- int i;
- void *f; /* faster */
-
- if (image_info->info_list[section_index].count) {
- for (i=0; i < image_info->info_list[section_index].count; i++) {
- if ((f=image_info->info_list[section_index].list[i].name) != NULL) {
- efree(f);
- }
- switch(image_info->info_list[section_index].list[i].format) {
- case TAG_FMT_SBYTE:
- case TAG_FMT_BYTE:
- /* in contrast to strings bytes do not need to allocate buffer for NULL if length==0 */
- if (image_info->info_list[section_index].list[i].length<1)
- break;
- default:
- case TAG_FMT_UNDEFINED:
- case TAG_FMT_STRING:
- if ((f=image_info->info_list[section_index].list[i].value.s) != NULL) {
- efree(f);
- }
- break;
-
- case TAG_FMT_USHORT:
- case TAG_FMT_ULONG:
- case TAG_FMT_URATIONAL:
- case TAG_FMT_SSHORT:
- case TAG_FMT_SLONG:
- case TAG_FMT_SRATIONAL:
- case TAG_FMT_SINGLE:
- case TAG_FMT_DOUBLE:
- /* nothing to do here */
- if (image_info->info_list[section_index].list[i].length > 1) {
- if ((f=image_info->info_list[section_index].list[i].value.list) != NULL) {
- efree(f);
- }
- }
- break;
- }
- }
- }
- EFREE_IF(image_info->info_list[section_index].list);
-}
-/* }}} */
-
-/* {{{ add_assoc_image_info
- * Add image_info to associative array value. */
-static void add_assoc_image_info(pval *value, int sub_array, image_info_type *image_info, int section_index TSRMLS_DC)
-{
- char buffer[64], *val, *name, uname[64];
- int i, ap, l, b, idx=0, done, unknown=0;
-#ifdef EXIF_DEBUG
- int info_tag;
-#endif
- image_info_value *info_value;
- image_info_data *info_data;
- pval *tmpi, *array = NULL;
-
-#ifdef EXIF_DEBUG
-/* php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Adding %d infos from section %s", image_info->info_list[section_index].count, exif_get_sectionname(section_index));*/
-#endif
- if (image_info->info_list[section_index].count) {
- if (sub_array) {
- MAKE_STD_ZVAL(tmpi);
- array_init(tmpi);
- } else {
- tmpi = value;
- }
-
- for(i=0; i<image_info->info_list[section_index].count; i++) {
- done = 0;
- info_data = &image_info->info_list[section_index].list[i];
-#ifdef EXIF_DEBUG
- info_tag = info_data->tag; /* conversion */
-#endif
- info_value = &info_data->value;
- if (!(name = info_data->name)) {
- snprintf(uname, sizeof(uname), "%d", unknown++);
- name = uname;
- }
-#ifdef EXIF_DEBUG
-/* php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Adding infos: tag(0x%04X,%12s,L=0x%04X): %s", info_tag, exif_get_tagname(info_tag, buffer, -12, exif_get_tag_table(section_index) TSRMLS_CC), info_data->length, info_data->format==TAG_FMT_STRING?(info_value&&info_value->s?info_value->s:"<no data>"):exif_get_tagformat(info_data->format));*/
-#endif
- if (info_data->length==0) {
- add_assoc_null(tmpi, name);
- } else {
- switch (info_data->format) {
- default:
- /* Standard says more types possible but skip them...
- * but allow users to handle data if they know how to
- * So not return but use type UNDEFINED
- * return;
- */
- case TAG_FMT_BYTE:
- case TAG_FMT_SBYTE:
- case TAG_FMT_UNDEFINED:
- if (!info_value->s) {
- add_assoc_stringl(tmpi, name, "", 0, 1);
- } else {
- add_assoc_stringl(tmpi, name, info_value->s, info_data->length, 1);
- }
- break;
-
- case TAG_FMT_STRING:
- if (!(val = info_value->s)) {
- val = "";
- }
- if (section_index==SECTION_COMMENT) {
- add_index_string(tmpi, idx++, val, 1);
- } else {
- add_assoc_string(tmpi, name, val, 1);
- }
- break;
-
- case TAG_FMT_URATIONAL:
- case TAG_FMT_SRATIONAL:
- /*case TAG_FMT_BYTE:
- case TAG_FMT_SBYTE:*/
- case TAG_FMT_USHORT:
- case TAG_FMT_SSHORT:
- case TAG_FMT_SINGLE:
- case TAG_FMT_DOUBLE:
- case TAG_FMT_ULONG:
- case TAG_FMT_SLONG:
- /* now the rest, first see if it becomes an array */
- if ((l = info_data->length) > 1) {
- array = NULL;
- MAKE_STD_ZVAL(array);
- array_init(array);
- }
- for(ap=0; ap<l; ap++) {
- if (l>1) {
- info_value = &info_data->value.list[ap];
- }
- switch (info_data->format) {
- case TAG_FMT_BYTE:
- if (l>1) {
- info_value = &info_data->value;
- for (b=0;b<l;b++) {
- add_index_long(array, b, (int)(info_value->s[b]));
- }
- break;
- }
- case TAG_FMT_USHORT:
- case TAG_FMT_ULONG:
- if (l==1) {
- add_assoc_long(tmpi, name, (int)info_value->u);
- } else {
- add_index_long(array, ap, (int)info_value->u);
- }
- break;
-
- case TAG_FMT_URATIONAL:
- snprintf(buffer, sizeof(buffer), "%i/%i", info_value->ur.num, info_value->ur.den);
- if (l==1) {
- add_assoc_string(tmpi, name, buffer, 1);
- } else {
- add_index_string(array, ap, buffer, 1);
- }
- break;
-
- case TAG_FMT_SBYTE:
- if (l>1) {
- info_value = &info_data->value;
- for (b=0;b<l;b++) {
- add_index_long(array, ap, (int)info_value->s[b]);
- }
- break;
- }
- case TAG_FMT_SSHORT:
- case TAG_FMT_SLONG:
- if (l==1) {
- add_assoc_long(tmpi, name, info_value->i);
- } else {
- add_index_long(array, ap, info_value->i);
- }
- break;
-
- case TAG_FMT_SRATIONAL:
- snprintf(buffer, sizeof(buffer), "%i/%i", info_value->sr.num, info_value->sr.den);
- if (l==1) {
- add_assoc_string(tmpi, name, buffer, 1);
- } else {
- add_index_string(array, ap, buffer, 1);
- }
- break;
-
- case TAG_FMT_SINGLE:
- if (l==1) {
- add_assoc_double(tmpi, name, info_value->f);
- } else {
- add_index_double(array, ap, info_value->f);
- }
- break;
-
- case TAG_FMT_DOUBLE:
- if (l==1) {
- add_assoc_double(tmpi, name, info_value->d);
- } else {
- add_index_double(array, ap, info_value->d);
- }
- break;
- }
- info_value = &info_data->value.list[ap];
- }
- if (l>1) {
- add_assoc_zval(tmpi, name, array);
- }
- break;
- }
- }
- }
- if (sub_array) {
- add_assoc_zval(value, exif_get_sectionname(section_index), tmpi);
- }
- }
-}
-/* }}} */
-
-/* {{{ Markers
- JPEG markers consist of one or more 0xFF bytes, followed by a marker
- code byte (which is not an FF). Here are the marker codes of interest
- in this program. (See jdmarker.c for a more complete list.)
-*/
-
-#define M_TEM 0x01 /* temp for arithmetic coding */
-#define M_RES 0x02 /* reserved */
-#define M_SOF0 0xC0 /* Start Of Frame N */
-#define M_SOF1 0xC1 /* N indicates which compression process */
-#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */
-#define M_SOF3 0xC3
-#define M_DHT 0xC4
-#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */
-#define M_SOF6 0xC6
-#define M_SOF7 0xC7
-#define M_JPEG 0x08 /* reserved for extensions */
-#define M_SOF9 0xC9
-#define M_SOF10 0xCA
-#define M_SOF11 0xCB
-#define M_DAC 0xCC /* arithmetic table */
-#define M_SOF13 0xCD
-#define M_SOF14 0xCE
-#define M_SOF15 0xCF
-#define M_RST0 0xD0 /* restart segment */
-#define M_RST1 0xD1
-#define M_RST2 0xD2
-#define M_RST3 0xD3
-#define M_RST4 0xD4
-#define M_RST5 0xD5
-#define M_RST6 0xD6
-#define M_RST7 0xD7
-#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */
-#define M_EOI 0xD9 /* End Of Image (end of datastream) */
-#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */
-#define M_DQT 0xDB
-#define M_DNL 0xDC
-#define M_DRI 0xDD
-#define M_DHP 0xDE
-#define M_EXP 0xDF
-#define M_APP0 0xE0 /* JPEG: 'JFIFF' AND (additional 'JFXX') */
-#define M_EXIF 0xE1 /* Exif Attribute Information */
-#define M_APP2 0xE2 /* Flash Pix Extension Data? */
-#define M_APP3 0xE3
-#define M_APP4 0xE4
-#define M_APP5 0xE5
-#define M_APP6 0xE6
-#define M_APP7 0xE7
-#define M_APP8 0xE8
-#define M_APP9 0xE9
-#define M_APP10 0xEA
-#define M_APP11 0xEB
-#define M_APP12 0xEC
-#define M_APP13 0xED /* IPTC International Press Telecommunications Council */
-#define M_APP14 0xEE /* Software, Copyright? */
-#define M_APP15 0xEF
-#define M_JPG0 0xF0
-#define M_JPG1 0xF1
-#define M_JPG2 0xF2
-#define M_JPG3 0xF3
-#define M_JPG4 0xF4
-#define M_JPG5 0xF5
-#define M_JPG6 0xF6
-#define M_JPG7 0xF7
-#define M_JPG8 0xF8
-#define M_JPG9 0xF9
-#define M_JPG10 0xFA
-#define M_JPG11 0xFB
-#define M_JPG12 0xFC
-#define M_JPG13 0xFD
-#define M_COM 0xFE /* COMment */
-
-#define M_PSEUDO 0x123 /* Extra value. */
-
-/* }}} */
-
-/* {{{ jpeg2000 markers
- */
-/* Markers x30 - x3F do not have a segment */
-/* Markers x00, x01, xFE, xC0 - xDF ISO/IEC 10918-1 -> M_<xx> */
-/* Markers xF0 - xF7 ISO/IEC 10918-3 */
-/* Markers xF7 - xF8 ISO/IEC 14495-1 */
-/* XY=Main/Tile-header:(R:required, N:not_allowed, O:optional, L:last_marker) */
-#define JC_SOC 0x4F /* NN, Start of codestream */
-#define JC_SIZ 0x51 /* RN, Image and tile size */
-#define JC_COD 0x52 /* RO, Codeing style defaulte */
-#define JC_COC 0x53 /* OO, Coding style component */
-#define JC_TLM 0x55 /* ON, Tile part length main header */
-#define JC_PLM 0x57 /* ON, Packet length main header */
-#define JC_PLT 0x58 /* NO, Packet length tile part header */
-#define JC_QCD 0x5C /* RO, Quantization default */
-#define JC_QCC 0x5D /* OO, Quantization component */
-#define JC_RGN 0x5E /* OO, Region of interest */
-#define JC_POD 0x5F /* OO, Progression order default */
-#define JC_PPM 0x60 /* ON, Packed packet headers main header */
-#define JC_PPT 0x61 /* NO, Packet packet headers tile part header */
-#define JC_CME 0x64 /* OO, Comment: "LL E <text>" E=0:binary, E=1:ascii */
-#define JC_SOT 0x90 /* NR, Start of tile */
-#define JC_SOP 0x91 /* NO, Start of packeter default */
-#define JC_EPH 0x92 /* NO, End of packet header */
-#define JC_SOD 0x93 /* NL, Start of data */
-#define JC_EOC 0xD9 /* NN, End of codestream */
-/* }}} */
-
-/* {{{ exif_process_COM
- Process a COM marker.
- We want to print out the marker contents as legible text;
- we must guard against random junk and varying newline representations.
-*/
-static void exif_process_COM (image_info_type *image_info, char *value, size_t length TSRMLS_DC)
-{
- exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2 TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ exif_process_CME
- Process a CME marker.
- We want to print out the marker contents as legible text;
- we must guard against random junk and varying newline representations.
-*/
-#ifdef EXIF_JPEG2000
-static void exif_process_CME (image_info_type *image_info, char *value, size_t length TSRMLS_DC)
-{
- if (length>3) {
- switch(value[2]) {
- case 0:
- exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, length, value TSRMLS_CC);
- break;
- case 1:
- exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length, value);
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Undefined JPEG2000 comment encoding");
- break;
- }
- } else {
- exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, 0, NULL);
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "JPEG2000 comment section to small");
- }
-}
-#endif
-/* }}} */
-
-/* {{{ exif_process_SOFn
- * Process a SOFn marker. This is useful for the image dimensions */
-static void exif_process_SOFn (uchar *Data, int marker, jpeg_sof_info *result)
-{
-/* 0xFF SOSn SectLen(2) Bits(1) Height(2) Width(2) Channels(1) 3*Channels (1) */
- result->bits_per_sample = Data[2];
- result->height = php_jpg_get16(Data+3);
- result->width = php_jpg_get16(Data+5);
- result->num_components = Data[7];
-
-/* switch (marker) {
- case M_SOF0: process = "Baseline"; break;
- case M_SOF1: process = "Extended sequential"; break;
- case M_SOF2: process = "Progressive"; break;
- case M_SOF3: process = "Lossless"; break;
- case M_SOF5: process = "Differential sequential"; break;
- case M_SOF6: process = "Differential progressive"; break;
- case M_SOF7: process = "Differential lossless"; break;
- case M_SOF9: process = "Extended sequential, arithmetic coding"; break;
- case M_SOF10: process = "Progressive, arithmetic coding"; break;
- case M_SOF11: process = "Lossless, arithmetic coding"; break;
- case M_SOF13: process = "Differential sequential, arithmetic coding"; break;
- case M_SOF14: process = "Differential progressive, arithmetic coding"; break;
- case M_SOF15: process = "Differential lossless, arithmetic coding"; break;
- default: process = "Unknown"; break;
- }*/
-}
-/* }}} */
-
-/* forward declarations */
-static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index TSRMLS_DC);
-static int exif_process_IFD_TAG( image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table TSRMLS_DC);
-
-/* {{{ exif_get_markername
- Get name of marker */
-#ifdef EXIF_DEBUG
-static char * exif_get_markername(int marker)
-{
- switch(marker) {
- case 0xC0: return "SOF0";
- case 0xC1: return "SOF1";
- case 0xC2: return "SOF2";
- case 0xC3: return "SOF3";
- case 0xC4: return "DHT";
- case 0xC5: return "SOF5";
- case 0xC6: return "SOF6";
- case 0xC7: return "SOF7";
- case 0xC9: return "SOF9";
- case 0xCA: return "SOF10";
- case 0xCB: return "SOF11";
- case 0xCD: return "SOF13";
- case 0xCE: return "SOF14";
- case 0xCF: return "SOF15";
- case 0xD8: return "SOI";
- case 0xD9: return "EOI";
- case 0xDA: return "SOS";
- case 0xDB: return "DQT";
- case 0xDC: return "DNL";
- case 0xDD: return "DRI";
- case 0xDE: return "DHP";
- case 0xDF: return "EXP";
- case 0xE0: return "APP0";
- case 0xE1: return "EXIF";
- case 0xE2: return "FPIX";
- case 0xE3: return "APP3";
- case 0xE4: return "APP4";
- case 0xE5: return "APP5";
- case 0xE6: return "APP6";
- case 0xE7: return "APP7";
- case 0xE8: return "APP8";
- case 0xE9: return "APP9";
- case 0xEA: return "APP10";
- case 0xEB: return "APP11";
- case 0xEC: return "APP12";
- case 0xED: return "APP13";
- case 0xEE: return "APP14";
- case 0xEF: return "APP15";
- case 0xF0: return "JPG0";
- case 0xFD: return "JPG13";
- case 0xFE: return "COM";
- case 0x01: return "TEM";
- }
- return "Unknown";
-}
-#endif
-/* }}} */
-
-/* {{{ proto string|false exif_tagname(index)
- Get headername for index or false if not defined */
-PHP_FUNCTION(exif_tagname)
-{
- pval **p_num;
- int tag, ac = ZEND_NUM_ARGS();
- char *szTemp;
-
- if ((ac < 1 || ac > 1) || zend_get_parameters_ex(ac, &p_num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(p_num);
- tag = Z_LVAL_PP(p_num);
- szTemp = exif_get_tagname(tag, NULL, 0, tag_table_IFD TSRMLS_CC);
- if (tag<0 || !szTemp || !szTemp[0]) {
- RETURN_BOOL(FALSE);
- } else {
- RETURN_STRING(szTemp, 1)
- }
-}
-/* }}} */
-
-/* {{{ exif_ifd_make_value
- * Create a value for an ifd from an info_data pointer */
-static void* exif_ifd_make_value(image_info_data *info_data, int motorola_intel TSRMLS_DC) {
- size_t byte_count;
- char *value_ptr, *data_ptr;
- size_t i;
-
- image_info_value *info_value;
-
- byte_count = php_tiff_bytes_per_format[info_data->format] * info_data->length;
- value_ptr = emalloc(max(byte_count, 4));
- memset(value_ptr, 0, 4);
- if (!info_data->length) {
- return value_ptr;
- }
- if (info_data->format == TAG_FMT_UNDEFINED || info_data->format == TAG_FMT_STRING
- || (byte_count>1 && (info_data->format == TAG_FMT_BYTE || info_data->format == TAG_FMT_SBYTE))
- ) {
- memmove(value_ptr, info_data->value.s, byte_count);
- return value_ptr;
- } else if (info_data->format == TAG_FMT_BYTE) {
- *value_ptr = info_data->value.u;
- return value_ptr;
- } else if (info_data->format == TAG_FMT_SBYTE) {
- *value_ptr = info_data->value.i;
- return value_ptr;
- } else {
- data_ptr = value_ptr;
- for(i=0; i<info_data->length; i++) {
- if (info_data->length==1) {
- info_value = &info_data->value;
- } else {
- info_value = &info_data->value.list[i];
- }
- switch(info_data->format) {
- case TAG_FMT_USHORT:
- php_ifd_set16u(data_ptr, info_value->u, motorola_intel);
- data_ptr += 2;
- break;
- case TAG_FMT_ULONG:
- php_ifd_set32u(data_ptr, info_value->u, motorola_intel);
- data_ptr += 4;
- break;
- case TAG_FMT_SSHORT:
- php_ifd_set16u(data_ptr, info_value->i, motorola_intel);
- data_ptr += 2;
- break;
- case TAG_FMT_SLONG:
- php_ifd_set32u(data_ptr, info_value->i, motorola_intel);
- data_ptr += 4;
- break;
- case TAG_FMT_URATIONAL:
- php_ifd_set32u(data_ptr, info_value->sr.num, motorola_intel);
- php_ifd_set32u(data_ptr+4, info_value->sr.den, motorola_intel);
- data_ptr += 8;
- break;
- case TAG_FMT_SRATIONAL:
- php_ifd_set32u(data_ptr, info_value->ur.num, motorola_intel);
- php_ifd_set32u(data_ptr+4, info_value->ur.den, motorola_intel);
- data_ptr += 8;
- break;
- case TAG_FMT_SINGLE:
- memmove(data_ptr, &info_data->value.f, byte_count);
- data_ptr += 4;
- break;
- case TAG_FMT_DOUBLE:
- memmove(data_ptr, &info_data->value.d, byte_count);
- data_ptr += 8;
- break;
- }
- }
- }
- return value_ptr;
-}
-/* }}} */
-
-/* {{{ exif_thumbnail_build
- * Check and build thumbnail */
-static void exif_thumbnail_build(image_info_type *ImageInfo TSRMLS_DC) {
- size_t new_size, new_move, new_value;
- char *new_data;
- void *value_ptr;
- int i, byte_count;
- image_info_list *info_list;
- image_info_data *info_data;
-#ifdef EXIF_DEBUG
- char tagname[64];
-#endif
-
- if (!ImageInfo->read_thumbnail || !ImageInfo->Thumbnail.offset || !ImageInfo->Thumbnail.size) {
- return; /* ignore this call */
- }
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "Thumbnail: filetype = %d", ImageInfo->Thumbnail.filetype);
-#endif
- switch(ImageInfo->Thumbnail.filetype) {
- default:
- case IMAGE_FILETYPE_JPEG:
- /* done */
- break;
- case IMAGE_FILETYPE_TIFF_II:
- case IMAGE_FILETYPE_TIFF_MM:
- info_list = &ImageInfo->info_list[SECTION_THUMBNAIL];
- new_size = 8 + 2 + info_list->count * 12 + 4;
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "Thumbnail: size of signature + directory(%d): 0x%02X", info_list->count, new_size);
-#endif
- new_value= new_size; /* offset for ifd values outside ifd directory */
- for (i=0; i<info_list->count; i++) {
- info_data = &info_list->list[i];
- byte_count = php_tiff_bytes_per_format[info_data->format] * info_data->length;
- if (byte_count > 4) {
- new_size += byte_count;
- }
- }
- new_move = new_size;
- new_data = erealloc(ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size+new_size);
- ImageInfo->Thumbnail.data = new_data;
- memmove(ImageInfo->Thumbnail.data + new_move, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size);
- ImageInfo->Thumbnail.size += new_size;
- /* fill in data */
- if (ImageInfo->motorola_intel) {
- memmove(new_data, "MM\x00\x2a\x00\x00\x00\x08", 8);
- } else {
- memmove(new_data, "II\x2a\x00\x08\x00\x00\x00", 8);
- }
- new_data += 8;
- php_ifd_set16u(new_data, info_list->count, ImageInfo->motorola_intel);
- new_data += 2;
- for (i=0; i<info_list->count; i++) {
- info_data = &info_list->list[i];
- byte_count = php_tiff_bytes_per_format[info_data->format] * info_data->length;
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "Thumbnail: process tag(x%04X=%s): %s%s (%d bytes)", info_data->tag, exif_get_tagname(info_data->tag, tagname, -12, tag_table_IFD TSRMLS_CC), (info_data->length>1)&&info_data->format!=TAG_FMT_UNDEFINED&&info_data->format!=TAG_FMT_STRING?"ARRAY OF ":"", exif_get_tagformat(info_data->format), byte_count);
-#endif
- if (info_data->tag==TAG_STRIP_OFFSETS || info_data->tag==TAG_JPEG_INTERCHANGE_FORMAT) {
- php_ifd_set16u(new_data + 0, info_data->tag, ImageInfo->motorola_intel);
- php_ifd_set16u(new_data + 2, TAG_FMT_ULONG, ImageInfo->motorola_intel);
- php_ifd_set32u(new_data + 4, 1, ImageInfo->motorola_intel);
- php_ifd_set32u(new_data + 8, new_move, ImageInfo->motorola_intel);
- } else {
- php_ifd_set16u(new_data + 0, info_data->tag, ImageInfo->motorola_intel);
- php_ifd_set16u(new_data + 2, info_data->format, ImageInfo->motorola_intel);
- php_ifd_set32u(new_data + 4, info_data->length, ImageInfo->motorola_intel);
- value_ptr = exif_ifd_make_value(info_data, ImageInfo->motorola_intel TSRMLS_CC);
- if (byte_count <= 4) {
- memmove(new_data+8, value_ptr, 4);
- } else {
- php_ifd_set32u(new_data+8, new_value, ImageInfo->motorola_intel);
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "Thumbnail: writing with value offset: 0x%04X + 0x%02X", new_value, byte_count);
-#endif
- memmove(ImageInfo->Thumbnail.data+new_value, value_ptr, byte_count);
- new_value += byte_count;
- }
- efree(value_ptr);
- }
- new_data += 12;
- }
- memset(new_data, 0, 4); /* next ifd pointer */
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "Thumbnail: created");
-#endif
- break;
- }
-}
-/* }}} */
-
-/* {{{ exif_thumbnail_extract
- * Grab the thumbnail, corrected */
-static void exif_thumbnail_extract(image_info_type *ImageInfo, char *offset, size_t length TSRMLS_DC) {
- if (ImageInfo->Thumbnail.data) {
- exif_error_docref("exif_read_data#error_mult_thumb" TSRMLS_CC, ImageInfo, E_WARNING, "multiple possible thumbnails");
- return; /* Should not happen */
- }
- if (!ImageInfo->read_thumbnail) {
- return; /* ignore this call */
- }
- /* according to exif2.1, the thumbnail is not supposed to be greater than 64K */
- if (ImageInfo->Thumbnail.size >= 65536
- || ImageInfo->Thumbnail.size <= 0
- || ImageInfo->Thumbnail.offset <= 0
- ) {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "illegal thumbnail size/offset");
- return;
- }
- /* Check to make sure we are not going to go past the ExifLength */
- if ((ImageInfo->Thumbnail.offset + ImageInfo->Thumbnail.size) > length) {
- EXIF_ERRLOG_THUMBEOF
- return;
- }
- ImageInfo->Thumbnail.data = estrndup(offset + ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
- exif_thumbnail_build(ImageInfo TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ exif_process_undefined
- * Copy a string/buffer in Exif header to a character string and return length of allocated buffer if any. */
-static int exif_process_undefined(char **result, char *value, size_t byte_count TSRMLS_DC) {
- /* we cannot use strlcpy - here the problem is that we have to copy NUL
- * chars up to byte_count, we also have to add a single NUL character to
- * force end of string.
- * estrndup does not return length
- */
- if (byte_count) {
- (*result) = estrndup(value, byte_count); /* NULL @ byte_count!!! */
- return byte_count+1;
- }
- return 0;
-}
-/* }}} */
-
-/* {{{ exif_process_string_raw
- * Copy a string in Exif header to a character string returns length of allocated buffer if any. */
-#if !EXIF_USE_MBSTRING
-static int exif_process_string_raw(char **result, char *value, size_t byte_count) {
- /* we cannot use strlcpy - here the problem is that we have to copy NUL
- * chars up to byte_count, we also have to add a single NUL character to
- * force end of string.
- */
- if (byte_count) {
- (*result) = safe_emalloc(byte_count, 1, 1);
- memcpy(*result, value, byte_count);
- (*result)[byte_count] = '\0';
- return byte_count+1;
- }
- return 0;
-}
-#endif
-/* }}} */
-
-/* {{{ exif_process_string
- * Copy a string in Exif header to a character string and return length of allocated buffer if any.
- * In contrast to exif_process_string this function does allways return a string buffer */
-static int exif_process_string(char **result, char *value, size_t byte_count TSRMLS_DC) {
- /* we cannot use strlcpy - here the problem is that we cannot use strlen to
- * determin length of string and we cannot use strlcpy with len=byte_count+1
- * because then we might get into an EXCEPTION if we exceed an allocated
- * memory page...so we use php_strnlen in conjunction with memcpy and add the NUL
- * char.
- * estrdup would sometimes allocate more memory and does not return length
- */
- if ((byte_count=php_strnlen(value, byte_count)) > 0) {
- return exif_process_undefined(result, value, byte_count TSRMLS_CC);
- }
- (*result) = estrndup("", 1); /* force empty string */
- return byte_count+1;
-}
-/* }}} */
-
-/* {{{ exif_process_user_comment
- * Process UserComment in IFD. */
-static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoPtr, char **pszEncoding, char *szValuePtr, int ByteCount TSRMLS_DC)
-{
- int a;
-
-#if EXIF_USE_MBSTRING
- char *decode;
- size_t len;;
-#endif
-
- *pszEncoding = NULL;
- /* Copy the comment */
- if (ByteCount>=8) {
- if (!memcmp(szValuePtr, "UNICODE\0", 8)) {
- *pszEncoding = estrdup((const char*)szValuePtr);
- szValuePtr = szValuePtr+8;
- ByteCount -= 8;
-#if EXIF_USE_MBSTRING
- /* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16)
- * since we have no encoding support for the BOM yet we skip that.
- */
- if (!memcmp(szValuePtr, "\xFE\xFF", 2)) {
- decode = "UCS-2BE";
- szValuePtr = szValuePtr+2;
- ByteCount -= 2;
- } else if (!memcmp(szValuePtr, "\xFF\xFE", 2)) {
- decode = "UCS-2LE";
- szValuePtr = szValuePtr+2;
- ByteCount -= 2;
- } else if (ImageInfo->motorola_intel) {
- decode = ImageInfo->decode_unicode_be;
- } else {
- decode = ImageInfo->decode_unicode_le;
- }
- *pszInfoPtr = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo->encode_unicode, decode, &len TSRMLS_CC);
- return len;
-#else
- return exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
-#endif
- } else
- if (!memcmp(szValuePtr, "ASCII\0\0\0", 8)) {
- *pszEncoding = estrdup((const char*)szValuePtr);
- szValuePtr = szValuePtr+8;
- ByteCount -= 8;
- } else
- if (!memcmp(szValuePtr, "JIS\0\0\0\0\0", 8)) {
- /* JIS should be tanslated to MB or we leave it to the user - leave it to the user */
- *pszEncoding = estrdup((const char*)szValuePtr);
- szValuePtr = szValuePtr+8;
- ByteCount -= 8;
-#if EXIF_USE_MBSTRING
- if (ImageInfo->motorola_intel) {
- *pszInfoPtr = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo->encode_jis, ImageInfo->decode_jis_be, &len TSRMLS_CC);
- } else {
- *pszInfoPtr = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo->encode_jis, ImageInfo->decode_jis_le, &len TSRMLS_CC);
- }
- return len;
-#else
- return exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
-#endif
- } else
- if (!memcmp(szValuePtr, "\0\0\0\0\0\0\0\0", 8)) {
- /* 8 NULL means undefined and should be ASCII... */
- *pszEncoding = estrdup("UNDEFINED");
- szValuePtr = szValuePtr+8;
- ByteCount -= 8;
- }
- }
-
- /* Olympus has this padded with trailing spaces. Remove these first. */
- if (ByteCount>0) {
- for (a=ByteCount-1;a && szValuePtr[a]==' ';a--) {
- (szValuePtr)[a] = '\0';
- }
- }
-
- /* normal text without encoding */
- exif_process_string(pszInfoPtr, szValuePtr, ByteCount TSRMLS_CC);
- return strlen(*pszInfoPtr);
-}
-/* }}} */
-
-/* {{{ exif_process_unicode
- * Process unicode field in IFD. */
-static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_field, int tag, char *szValuePtr, int ByteCount TSRMLS_DC)
-{
- xp_field->tag = tag;
-
- /* Copy the comment */
-#if EXIF_USE_MBSTRING
-/* What if MS supports big-endian with XP? */
-/* if (ImageInfo->motorola_intel) {
- xp_field->value = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo->encode_unicode, ImageInfo->decode_unicode_be, &xp_field->size TSRMLS_CC);
- } else {
- xp_field->value = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo->encode_unicode, ImageInfo->decode_unicode_le, &xp_field->size TSRMLS_CC);
- }*/
- xp_field->value = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo->encode_unicode, ImageInfo->decode_unicode_le, &xp_field->size TSRMLS_CC);
- return xp_field->size;
-#else
- xp_field->size = exif_process_string_raw(&xp_field->value, szValuePtr, ByteCount);
- return xp_field->size;
-#endif
-}
-/* }}} */
-
-/* {{{ exif_process_IFD_in_MAKERNOTE
- * Process nested IFDs directories in Maker Note. */
-static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * value_ptr, int value_len, char *offset_base, size_t IFDlength, size_t displacement TSRMLS_DC)
-{
- int de, i=0, section_index = SECTION_MAKERNOTE;
- int NumDirEntries, old_motorola_intel, offset_diff;
- const maker_note_type *maker_note;
- char *dir_start;
-
- for (i=0; i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) {
- if (i==sizeof(maker_note_array)/sizeof(maker_note_type))
- return FALSE;
- maker_note = maker_note_array+i;
-
- /*exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "check (%s,%s)", maker_note->make?maker_note->make:"", maker_note->model?maker_note->model:"");*/
- if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make)))
- continue;
- if (maker_note->model && (!ImageInfo->model || strcmp(maker_note->model, ImageInfo->model)))
- continue;
- if (maker_note->id_string && strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len))
- continue;
- break;
- }
-
- dir_start = value_ptr + maker_note->offset;
-
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "process %s @x%04X + 0x%04X=%d: %s", exif_get_sectionname(section_index), (int)dir_start-(int)offset_base+maker_note->offset+displacement, value_len, value_len, exif_char_dump(value_ptr, value_len, (int)dir_start-(int)offset_base+maker_note->offset+displacement));
-#endif
-
- ImageInfo->sections_found |= FOUND_MAKERNOTE;
-
- old_motorola_intel = ImageInfo->motorola_intel;
- switch (maker_note->byte_order) {
- case MN_ORDER_INTEL:
- ImageInfo->motorola_intel = 0;
- break;
- case MN_ORDER_MOTOROLA:
- ImageInfo->motorola_intel = 1;
- break;
- default:
- case MN_ORDER_NORMAL:
- break;
- }
-
- NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel);
-
- switch (maker_note->offset_mode) {
- case MN_OFFSET_MAKER:
- offset_base = value_ptr;
- break;
- case MN_OFFSET_GUESS:
- offset_diff = 2 + NumDirEntries*12 + 4 - php_ifd_get32u(dir_start+10, ImageInfo->motorola_intel);
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "Using automatic offset correction: 0x%04X", ((int)dir_start-(int)offset_base+maker_note->offset+displacement) + offset_diff);
-#endif
- offset_base = value_ptr + offset_diff;
- break;
- default:
- case MN_OFFSET_NORMAL:
- break;
- }
-
- if ((2+NumDirEntries*12) > value_len) {
- exif_error_docref("exif_read_data#error_ifd" TSRMLS_CC, ImageInfo, E_WARNING, "illegal IFD size: 2 + x%04X*12 = x%04X > x%04X", NumDirEntries, 2+NumDirEntries*12, value_len);
- return FALSE;
- }
-
- for (de=0;de<NumDirEntries;de++) {
- if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
- offset_base, IFDlength, displacement, section_index, 0, maker_note->tag_table TSRMLS_CC)) {
- return FALSE;
- }
- }
- ImageInfo->motorola_intel = old_motorola_intel;
-/* NextDirOffset (must be NULL) = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel);*/
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "subsection %s done", exif_get_sectionname(SECTION_MAKERNOTE));
-#endif
- return TRUE;
-}
-/* }}} */
-
-/* {{{ exif_process_IFD_TAG
- * Process one of the nested IFDs directories. */
-static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table TSRMLS_DC)
-{
- size_t length;
- int tag, format, components;
- char *value_ptr, tagname[64], cbuf[32], *outside=NULL;
- size_t byte_count, offset_val, fpos, fgot;
- xp_field_type *tmp_xp;
-
- tag = php_ifd_get16u(dir_entry, ImageInfo->motorola_intel);
- format = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel);
- components = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel);
-
- if (!format || format > NUM_FORMATS) {
- /* (-1) catches illegal zero case as unsigned underflows to positive large. */
- exif_error_docref("exif_read_data#error_ifd" TSRMLS_CC, ImageInfo, E_WARNING, "process tag(x%04X=%s): Illegal format code 0x%04X, suppose BYTE", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), format);
- format = TAG_FMT_BYTE;
- /*return TRUE;*/
- }
-
- byte_count = components * php_tiff_bytes_per_format[format];
-
- if (byte_count > 4) {
- offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel);
- /* If its bigger than 4 bytes, the dir entry contains an offset. */
- value_ptr = offset_base+offset_val;
- if (offset_val+byte_count > IFDlength || value_ptr < dir_entry) {
- /*
- // It is important to check for IMAGE_FILETYPE_TIFF
- // JPEG does not use absolute pointers instead its pointers are relative to the start
- // of the TIFF header in APP1 section.
- */
- if (offset_val<0 || offset_val+byte_count>ImageInfo->FileSize || (ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_II && ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_MM)) {
- if (value_ptr < dir_entry) {
- /* we can read this if offset_val > 0 */
- /* some files have their values in other parts of the file */
- exif_error_docref("exif_read_data#error_ifd" TSRMLS_CC, ImageInfo, E_WARNING, "process tag(x%04X=%s): Illegal pointer offset(x%04X < x%04X)", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), offset_val, dir_entry);
- } else {
- /* this is for sure not allowed */
- /* exception are IFD pointers */
- exif_error_docref("exif_read_data#error_ifd" TSRMLS_CC, ImageInfo, E_WARNING, "process tag(x%04X=%s): Illegal pointer offset(x%04X + x%04X = x%04X > x%04X)", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), offset_val, byte_count, offset_val+byte_count, IFDlength);
- }
- return TRUE;
- }
- if (byte_count>sizeof(cbuf)) {
- /* mark as outside range and get buffer */
- value_ptr = emalloc(byte_count);
- outside = value_ptr;
- } else {
- /*
- // in most cases we only access a small range so
- // it is faster to use a static buffer there
- // BUT it offers also the possibility to have
- // pointers read without the need to free them
- // explicitley before returning.
- */
- value_ptr = cbuf;
- }
-
- fpos = php_stream_tell(ImageInfo->infile);
- php_stream_seek(ImageInfo->infile, offset_val, SEEK_SET);
- fgot = php_stream_tell(ImageInfo->infile);
- if (fgot!=offset_val) {
- EFREE_IF(outside);
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "wrong file pointer: 0x%08X != 0x08X", fgot, offset_val);
- return FALSE;
- }
- fgot = php_stream_read(ImageInfo->infile, value_ptr, byte_count);
- php_stream_seek(ImageInfo->infile, fpos, SEEK_SET);
- if (fgot<byte_count) {
- EFREE_IF(outside);
- EXIF_ERRLOG_FILEEOF
- return FALSE;
- }
- }
- } else {
- /* 4 bytes or less and value is in the dir entry itself */
- value_ptr = dir_entry+8;
- offset_val= value_ptr-offset_base;
- }
-
- ImageInfo->sections_found |= FOUND_ANY_TAG;
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "process tag(x%04X=%s,@x%04X + x%04X(=%d)): %s%s", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), offset_val+displacement, byte_count, byte_count, (components>1)&&format!=TAG_FMT_UNDEFINED&&format!=TAG_FMT_STRING?"ARRAY OF ":"", format==TAG_FMT_STRING?(value_ptr?value_ptr:"<no data>"):exif_get_tagformat(format));
-#endif
- if (section_index==SECTION_THUMBNAIL) {
- if (!ImageInfo->Thumbnail.data) {
- switch(tag) {
- case TAG_IMAGEWIDTH:
- case TAG_COMP_IMAGE_WIDTH:
- ImageInfo->Thumbnail.width = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
- break;
-
- case TAG_IMAGEHEIGHT:
- case TAG_COMP_IMAGE_HEIGHT:
- ImageInfo->Thumbnail.height = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
- break;
-
- case TAG_STRIP_OFFSETS:
- case TAG_JPEG_INTERCHANGE_FORMAT:
- /* accept both formats */
- ImageInfo->Thumbnail.offset = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
- break;
-
- case TAG_STRIP_BYTE_COUNTS:
- if (ImageInfo->FileType == IMAGE_FILETYPE_TIFF_II || ImageInfo->FileType == IMAGE_FILETYPE_TIFF_MM) {
- ImageInfo->Thumbnail.filetype = ImageInfo->FileType;
- } else {
- /* motorola is easier to read */
- ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_TIFF_MM;
- }
- ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
- break;
-
- case TAG_JPEG_INTERCHANGE_FORMAT_LEN:
- if (ImageInfo->Thumbnail.filetype == IMAGE_FILETYPE_UNKNOWN) {
- ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_JPEG;
- ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
- }
- break;
- }
- }
- } else {
- if (section_index==SECTION_IFD0 || section_index==SECTION_EXIF)
- switch(tag) {
- case TAG_COPYRIGHT:
- /* check for "<photographer> NUL <editor> NUL" */
- if (byte_count>1 && (length=php_strnlen(value_ptr, byte_count)) > 0) {
- if (length<byte_count-1) {
- /* When there are any characters after the first NUL */
- ImageInfo->CopyrightPhotographer = estrdup(value_ptr);
- ImageInfo->CopyrightEditor = estrdup(value_ptr+length+1);
- spprintf(&ImageInfo->Copyright, 0, "%s, %s", value_ptr, value_ptr+length+1);
- /* format = TAG_FMT_UNDEFINED; this musn't be ASCII */
- /* but we are not supposed to change this */
- /* keep in mind that image_info does not store editor value */
- } else {
- ImageInfo->Copyright = estrdup(value_ptr);
- }
- }
- break;
-
- case TAG_USERCOMMENT:
- ImageInfo->UserCommentLength = exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), &(ImageInfo->UserCommentEncoding), value_ptr, byte_count TSRMLS_CC);
- break;
-
- case TAG_XP_TITLE:
- case TAG_XP_COMMENTS:
- case TAG_XP_AUTHOR:
- case TAG_XP_KEYWORDS:
- case TAG_XP_SUBJECT:
- tmp_xp = (xp_field_type*)erealloc(ImageInfo->xp_fields.list, sizeof(xp_field_type)*(ImageInfo->xp_fields.count+1));
- ImageInfo->sections_found |= FOUND_WINXP;
- ImageInfo->xp_fields.list = tmp_xp;
- ImageInfo->xp_fields.count++;
- exif_process_unicode(ImageInfo, &(ImageInfo->xp_fields.list[ImageInfo->xp_fields.count-1]), tag, value_ptr, byte_count TSRMLS_CC);
- break;
-
- case TAG_FNUMBER:
- /* Simplest way of expressing aperture, so I trust it the most.
- (overwrite previously computd value if there is one) */
- ImageInfo->ApertureFNumber = (float)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
- break;
-
- case TAG_APERTURE:
- case TAG_MAX_APERTURE:
- /* More relevant info always comes earlier, so only use this field if we don't
- have appropriate aperture information yet. */
- if (ImageInfo->ApertureFNumber == 0) {
- ImageInfo->ApertureFNumber
- = (float)exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)*log(2)*0.5);
- }
- break;
-
- case TAG_SHUTTERSPEED:
- /* More complicated way of expressing exposure time, so only use
- this value if we don't already have it from somewhere else.
- SHUTTERSPEED comes after EXPOSURE TIME
- */
- if (ImageInfo->ExposureTime == 0) {
- ImageInfo->ExposureTime
- = (float)(1/exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)*log(2)));
- }
- break;
- case TAG_EXPOSURETIME:
- ImageInfo->ExposureTime = -1;
- break;
-
- case TAG_COMP_IMAGE_WIDTH:
- ImageInfo->ExifImageWidth = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
- break;
-
- case TAG_FOCALPLANE_X_RES:
- ImageInfo->FocalplaneXRes = exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
- break;
-
- case TAG_SUBJECT_DISTANCE:
- /* Inidcates the distacne the autofocus camera is focused to.
- Tends to be less accurate as distance increases. */
- ImageInfo->Distance = (float)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
- break;
-
- case TAG_FOCALPLANE_RESOLUTION_UNIT:
- switch((int)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)) {
- case 1: ImageInfo->FocalplaneUnits = 25.4; break; /* inch */
- case 2:
- /* According to the information I was using, 2 measn meters.
- But looking at the Cannon powershot's files, inches is the only
- sensible value. */
- ImageInfo->FocalplaneUnits = 25.4;
- break;
-
- case 3: ImageInfo->FocalplaneUnits = 10; break; /* centimeter */
- case 4: ImageInfo->FocalplaneUnits = 1; break; /* milimeter */
- case 5: ImageInfo->FocalplaneUnits = .001; break; /* micrometer */
- }
- break;
-
- case TAG_SUB_IFD:
- if (format==TAG_FMT_IFD) {
- /* If this is called we are either in a TIFFs thumbnail or a JPEG where we cannot handle it */
- /* TIFF thumbnail: our data structure cannot store a thumbnail of a thumbnail */
- /* JPEG do we have the data area and what to do with it */
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "skip SUB IFD");
- }
- break;
-
- case TAG_MAKE:
- ImageInfo->make = estrdup(value_ptr);
- break;
- case TAG_MODEL:
- ImageInfo->model = estrdup(value_ptr);
- break;
-
- case TAG_MAKER_NOTE:
- exif_process_IFD_in_MAKERNOTE(ImageInfo, value_ptr, byte_count, offset_base, IFDlength, displacement TSRMLS_CC);
- break;
-
- case TAG_EXIF_IFD_POINTER:
- case TAG_GPS_IFD_POINTER:
- case TAG_INTEROP_IFD_POINTER:
- if (ReadNextIFD) {
- char *Subdir_start;
- int sub_section_index = 0;
- switch(tag) {
- case TAG_EXIF_IFD_POINTER:
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "found EXIF");
-#endif
- ImageInfo->sections_found |= FOUND_EXIF;
- sub_section_index = SECTION_EXIF;
- break;
- case TAG_GPS_IFD_POINTER:
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "found GPS");
-#endif
- ImageInfo->sections_found |= FOUND_GPS;
- sub_section_index = SECTION_GPS;
- break;
- case TAG_INTEROP_IFD_POINTER:
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "found INTEROPERABILITY");
-#endif
- ImageInfo->sections_found |= FOUND_INTEROP;
- sub_section_index = SECTION_INTEROP;
- break;
- }
- Subdir_start = offset_base + php_ifd_get32u(value_ptr, ImageInfo->motorola_intel);
- if (Subdir_start < offset_base || Subdir_start > offset_base+IFDlength) {
- exif_error_docref("exif_read_data#error_ifd" TSRMLS_CC, ImageInfo, E_WARNING, "Illegal IFD Pointer");
- return FALSE;
- }
- exif_process_IFD_in_JPEG(ImageInfo, Subdir_start, offset_base, IFDlength, displacement, sub_section_index TSRMLS_CC);
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "subsection %s done", exif_get_sectionname(sub_section_index));
-#endif
- }
- }
- }
- exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname), tag_table TSRMLS_CC), tag, format, components, value_ptr TSRMLS_CC);
- EFREE_IF(outside);
- return TRUE;
-}
-/* }}} */
-
-/* {{{ exif_process_IFD_in_JPEG
- * Process one of the nested IFDs directories. */
-static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index TSRMLS_DC)
-{
- int de;
- int NumDirEntries;
- int NextDirOffset;
-
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "process %s (x%04X(=%d))", exif_get_sectionname(section_index), IFDlength, IFDlength);
-#endif
-
- ImageInfo->sections_found |= FOUND_IFD0;
-
- NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel);
-
- if ((dir_start+2+NumDirEntries*12) > (offset_base+IFDlength)) {
- exif_error_docref("exif_read_data#error_ifd" TSRMLS_CC, ImageInfo, E_WARNING, "illegal IFD size: x%04X + 2 + x%04X*12 = x%04X > x%04X", (int)dir_start+2-(int)offset_base, NumDirEntries, (int)dir_start+2+NumDirEntries*12-(int)offset_base, IFDlength);
- return FALSE;
- }
-
- for (de=0;de<NumDirEntries;de++) {
- if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
- offset_base, IFDlength, displacement, section_index, 1, exif_get_tag_table(section_index) TSRMLS_CC)) {
- return FALSE;
- }
- }
- /*
- * Hack to make it process IDF1 I hope
- * There are 2 IDFs, the second one holds the keys (0x0201 and 0x0202) to the thumbnail
- */
- NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel);
- if (NextDirOffset) {
- /* the next line seems false but here IFDlength means length of all IFDs */
- if (offset_base + NextDirOffset < offset_base || offset_base + NextDirOffset > offset_base+IFDlength) {
- exif_error_docref("exif_read_data#error_ifd" TSRMLS_CC, ImageInfo, E_WARNING, "illegal IFD offset");
- return FALSE;
- }
- /* That is the IFD for the first thumbnail */
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "expect next IFD to be thumbnail");
-#endif
- if (exif_process_IFD_in_JPEG(ImageInfo, offset_base + NextDirOffset, offset_base, IFDlength, displacement, SECTION_THUMBNAIL TSRMLS_CC)) {
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "Thumbnail size: 0x%04X", ImageInfo->Thumbnail.size);
-#endif
- if (ImageInfo->Thumbnail.filetype != IMAGE_FILETYPE_UNKNOWN
- && ImageInfo->Thumbnail.size
- && ImageInfo->Thumbnail.offset
- && ImageInfo->read_thumbnail
- ) {
- exif_thumbnail_extract(ImageInfo, offset_base, IFDlength TSRMLS_CC);
- }
- return TRUE;
- } else {
- return FALSE;
- }
- }
- return TRUE;
-}
-/* }}} */
-
-/* {{{ exif_process_TIFF_in_JPEG
- Process a TIFF header in a JPEG file
-*/
-static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf, size_t length, size_t displacement TSRMLS_DC)
-{
- unsigned exif_value_2a, offset_of_ifd;
-
- /* set the thumbnail stuff to nothing so we can test to see if they get set up */
- if (memcmp(CharBuf, "II", 2) == 0) {
- ImageInfo->motorola_intel = 0;
- } else if (memcmp(CharBuf, "MM", 2) == 0) {
- ImageInfo->motorola_intel = 1;
- } else {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "invalid TIFF alignment marker");
- return;
- }
-
- /* Check the next two values for correctness. */
- exif_value_2a = php_ifd_get16u(CharBuf+2, ImageInfo->motorola_intel);
- offset_of_ifd = php_ifd_get32u(CharBuf+4, ImageInfo->motorola_intel);
- if ( exif_value_2a != 0x2a || offset_of_ifd < 0x08) {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "invalid TIFF start (1)");
- return;
- }
-
- ImageInfo->sections_found |= FOUND_IFD0;
- /* First directory starts at offset 8. Offsets starts at 0. */
- exif_process_IFD_in_JPEG(ImageInfo, CharBuf+offset_of_ifd, CharBuf, length/*-14*/, displacement, SECTION_IFD0 TSRMLS_CC);
-
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "process TIFF in JPEG done");
-#endif
-
- /* Compute the CCD width, in milimeters. */
- if (ImageInfo->FocalplaneXRes != 0) {
- ImageInfo->CCDWidth = (float)(ImageInfo->ExifImageWidth * ImageInfo->FocalplaneUnits / ImageInfo->FocalplaneXRes);
- }
-}
-/* }}} */
-
-/* {{{ exif_process_APP1
- Process an JPEG APP1 block marker
- Describes all the drivel that most digital cameras include...
-*/
-static void exif_process_APP1(image_info_type *ImageInfo, char *CharBuf, size_t length, size_t displacement TSRMLS_DC)
-{
- /* Check the APP1 for Exif Identifier Code */
- static const uchar ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00};
- if (memcmp(CharBuf+2, ExifHeader, 6)) {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "incorrect APP1 Exif Identifier Code");
- return;
- }
- exif_process_TIFF_in_JPEG(ImageInfo, CharBuf + 8, length - 8, displacement+8 TSRMLS_CC);
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "process APP1/EXIF done");
-#endif
-}
-/* }}} */
-
-/* {{{ exif_process_APP12
- Process an JPEG APP12 block marker used by OLYMPUS
-*/
-static void exif_process_APP12(image_info_type *ImageInfo, char *buffer, size_t length TSRMLS_DC)
-{
- size_t l1, l2=0;
-
- if ((l1 = php_strnlen(buffer+2, length-2)) > 0) {
- exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2 TSRMLS_CC);
- if (length > 2+l1+1) {
- l2 = php_strnlen(buffer+2+l1+1, length-2-l1+1);
- exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1 TSRMLS_CC);
- }
- }
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "process section APP12 with l1=%d, l2=%d done", l1, l2);
-#endif
-}
-/* }}} */
-
-/* {{{ exif_scan_JPEG_header
- * Parse the marker stream until SOS or EOI is seen; */
-static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC)
-{
- int section, sn;
- int marker = 0, last_marker = M_PSEUDO, comment_correction=1;
- int ll, lh;
- uchar *Data;
- size_t fpos, size, got, itemlen;
- jpeg_sof_info sof_info;
-
- for(section=0;;section++) {
-#ifdef EXIF_DEBUG
- fpos = php_stream_tell(ImageInfo->infile);
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "needing section %d @ 0x%08X", ImageInfo->file.count, fpos);
-#endif
-
- /* get marker byte, swallowing possible padding */
- /* some software does not count the length bytes of COM section */
- /* one company doing so is very much envolved in JPEG... so we accept too */
- if (last_marker==M_COM && comment_correction) {
- comment_correction = 2;
- }
- do {
- if ((marker = php_stream_getc(ImageInfo->infile)) == EOF) {
- EXIF_ERRLOG_CORRUPT
- return FALSE;
- }
- if (last_marker==M_COM && comment_correction>0) {
- if (marker!=0xFF) {
- marker = 0xff;
- comment_correction--;
- } else {
- last_marker = M_PSEUDO; /* stop skipping 0 for M_COM */
- }
- }
- } while (marker == 0xff);
- if (last_marker==M_COM && !comment_correction) {
- exif_error_docref("exif_read_data#error_mcom" TSRMLS_CC, ImageInfo, E_NOTICE, "Image has corrupt M_COM section: some software set wrong length information");
- }
- if (last_marker==M_COM && comment_correction)
- return M_EOI; /* ah illegal: char after COM section not 0xFF */
-
- fpos = php_stream_tell(ImageInfo->infile);
-
- if (marker == 0xff) {
- /* 0xff is legal padding, but if we get that many, something's wrong. */
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "too many padding bytes!");
- return FALSE;
- }
-
- /* Read the length of the section. */
- lh = php_stream_getc(ImageInfo->infile);
- ll = php_stream_getc(ImageInfo->infile);
-
- itemlen = (lh << 8) | ll;
-
- if (itemlen < 2) {
- EXIF_ERRLOG_CORRUPT
- return FALSE;
- }
-
- sn = exif_file_sections_add(ImageInfo, marker, itemlen+1, NULL);
- Data = ImageInfo->file.list[sn].data;
-
- /* Store first two pre-read bytes. */
- Data[0] = (uchar)lh;
- Data[1] = (uchar)ll;
-
- got = php_stream_read(ImageInfo->infile, Data+2, itemlen-2); /* Read the whole section. */
- if (got != itemlen-2) {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "error reading from file: got=x%04X(=%d) != itemlen-2=x%04X(=%d)", got, got, itemlen-2, itemlen-2);
- return FALSE;
- }
-
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "process section(x%02X=%s) @ x%04X + x%04X(=%d)", marker, exif_get_markername(marker), fpos, itemlen, itemlen);
-#endif
- switch(marker) {
- case M_SOS: /* stop before hitting compressed data */
- /* If reading entire image is requested, read the rest of the data. */
- if (ImageInfo->read_all) {
- /* Determine how much file is left. */
- fpos = php_stream_tell(ImageInfo->infile);
- size = ImageInfo->FileSize - fpos;
- sn = exif_file_sections_add(ImageInfo, M_PSEUDO, size, NULL);
- Data = ImageInfo->file.list[sn].data;
- got = php_stream_read(ImageInfo->infile, Data, size);
- if (got != size) {
- EXIF_ERRLOG_FILEEOF
- return FALSE;
- }
- }
- return TRUE;
-
- case M_EOI: /* in case it's a tables-only JPEG stream */
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "no image in jpeg!");
- return (ImageInfo->sections_found&(~FOUND_COMPUTED)) ? TRUE : FALSE;
-
- case M_COM: /* Comment section */
- exif_process_COM(ImageInfo, (char *)Data, itemlen TSRMLS_CC);
- break;
-
- case M_EXIF:
- if (!(ImageInfo->sections_found&FOUND_IFD0)) {
- /*ImageInfo->sections_found |= FOUND_EXIF;*/
- /* Seen files from some 'U-lead' software with Vivitar scanner
- that uses marker 31 later in the file (no clue what for!) */
- exif_process_APP1(ImageInfo, (char *)Data, itemlen, fpos TSRMLS_CC);
- }
- break;
-
- case M_APP12:
- exif_process_APP12(ImageInfo, (char *)Data, itemlen TSRMLS_CC);
- break;
-
-
- case M_SOF0:
- case M_SOF1:
- case M_SOF2:
- case M_SOF3:
- case M_SOF5:
- case M_SOF6:
- case M_SOF7:
- case M_SOF9:
- case M_SOF10:
- case M_SOF11:
- case M_SOF13:
- case M_SOF14:
- case M_SOF15:
- exif_process_SOFn(Data, marker, &sof_info);
- ImageInfo->Width = sof_info.width;
- ImageInfo->Height = sof_info.height;
- if (sof_info.num_components == 3) {
- ImageInfo->IsColor = 1;
- } else {
- ImageInfo->IsColor = 0;
- }
- break;
- default:
- /* skip any other marker silently. */
- break;
- }
-
- /* keep track of last marker */
- last_marker = marker;
- }
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "done");
-#endif
- return TRUE;
-}
-/* }}} */
-
-/* {{{ exif_scan_thumbnail
- * scan JPEG in thumbnail (memory) */
-static int exif_scan_thumbnail(image_info_type *ImageInfo TSRMLS_DC)
-{
- uchar c, *data = ImageInfo->Thumbnail.data;
- int n, marker;
- size_t length=2, pos=0;
- jpeg_sof_info sof_info;
-
- if (!data) {
- return FALSE; /* nothing to do here */
- }
- if (memcmp(data, "\xFF\xD8\xFF", 3)) {
- if (!ImageInfo->Thumbnail.width && !ImageInfo->Thumbnail.height) {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "Thumbnail is not a JPEG image");
- }
- return FALSE;
- }
- for (;;) {
- pos += length;
- if (pos>=ImageInfo->Thumbnail.size)
- return FALSE;
- c = data[pos++];
- if (pos>=ImageInfo->Thumbnail.size)
- return FALSE;
- if (c != 0xFF) {
- return FALSE;
- }
- n = 8;
- while ((c = data[pos++]) == 0xFF && n--) {
- if (pos+3>=ImageInfo->Thumbnail.size)
- return FALSE;
- /* +3 = pos++ of next check when reaching marker + 2 bytes for length */
- }
- if (c == 0xFF)
- return FALSE;
- marker = c;
- length = php_jpg_get16(data+pos);
- if (pos+length>=ImageInfo->Thumbnail.size) {
- return FALSE;
- }
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "Thumbnail: process section(x%02X=%s) @ x%04X + x%04X", marker, exif_get_markername(marker), pos, length);
-#endif
- switch (marker) {
- case M_SOF0:
- case M_SOF1:
- case M_SOF2:
- case M_SOF3:
- case M_SOF5:
- case M_SOF6:
- case M_SOF7:
- case M_SOF9:
- case M_SOF10:
- case M_SOF11:
- case M_SOF13:
- case M_SOF14:
- case M_SOF15:
- /* handle SOFn block */
- exif_process_SOFn(data+pos, marker, &sof_info);
- ImageInfo->Thumbnail.height = sof_info.height;
- ImageInfo->Thumbnail.width = sof_info.width;
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "Thumbnail: size: %d * %d", sof_info.width, sof_info.height);
-#endif
- return TRUE;
-
- case M_SOS:
- case M_EOI:
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "could not compute size of thumbnail");
- return FALSE;
- break;
-
- default:
- /* just skip */
- break;
- }
- }
-
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "could not compute size of thumbnail");
- return FALSE;
-}
-/* }}} */
-
-/* {{{ exif_process_IFD_in_TIFF
- * Parse the TIFF header; */
-static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offset, int section_index TSRMLS_DC)
-{
- int i, sn, num_entries, sub_section_index = 0;
- unsigned char *dir_entry;
- char tagname[64];
- size_t ifd_size, dir_size, entry_offset, next_offset, entry_length, entry_value=0, fgot;
- int entry_tag , entry_type;
- tag_table_type tag_table = exif_get_tag_table(section_index);
-
- if (ImageInfo->FileSize >= dir_offset+2) {
- sn = exif_file_sections_add(ImageInfo, M_PSEUDO, 2, NULL);
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, 2);
-#endif
- php_stream_seek(ImageInfo->infile, dir_offset, SEEK_SET); /* we do not know the order of sections */
- php_stream_read(ImageInfo->infile, ImageInfo->file.list[sn].data, 2);
- num_entries = php_ifd_get16u(ImageInfo->file.list[sn].data, ImageInfo->motorola_intel);
- dir_size = 2/*num dir entries*/ +12/*length of entry*/*num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/;
- if (ImageInfo->FileSize >= dir_offset+dir_size) {
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X), IFD entries(%d)", ImageInfo->FileSize, dir_offset+2, dir_size-2, num_entries);
-#endif
- if (exif_file_sections_realloc(ImageInfo, sn, dir_size TSRMLS_CC)) {
- return FALSE;
- }
- php_stream_read(ImageInfo->infile, ImageInfo->file.list[sn].data+2, dir_size-2);
- /*exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "Dump: %s", exif_char_dump(ImageInfo->file.list[sn].data, dir_size, 0));*/
- next_offset = php_ifd_get32u(ImageInfo->file.list[sn].data + dir_size - 4, ImageInfo->motorola_intel);
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "read from TIFF done, next offset x%04X", next_offset);
-#endif
- /* now we have the directory we can look how long it should be */
- ifd_size = dir_size;
- for(i=0;i<num_entries;i++) {
- dir_entry = ImageInfo->file.list[sn].data+2+i*12;
- entry_tag = php_ifd_get16u(dir_entry+0, ImageInfo->motorola_intel);
- entry_type = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel);
- if (entry_type > NUM_FORMATS) {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "read from TIFF: tag(0x%04X,%12s): Illegal format code 0x%04X, switching to BYTE", entry_tag, exif_get_tagname(entry_tag, tagname, -12, tag_table TSRMLS_CC), entry_type);
- /* Since this is repeated in exif_process_IFD_TAG make it a notice here */
- /* and make it a warning in the exif_process_IFD_TAG which is called */
- /* elsewhere. */
- entry_type = TAG_FMT_BYTE;
- /*The next line would break the image on writeback: */
- /* php_ifd_set16u(dir_entry+2, entry_type, ImageInfo->motorola_intel);*/
- }
- entry_length = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel) * php_tiff_bytes_per_format[entry_type];
- if (entry_length <= 4) {
- switch(entry_type) {
- case TAG_FMT_USHORT:
- entry_value = php_ifd_get16u(dir_entry+8, ImageInfo->motorola_intel);
- break;
- case TAG_FMT_SSHORT:
- entry_value = php_ifd_get16s(dir_entry+8, ImageInfo->motorola_intel);
- break;
- case TAG_FMT_ULONG:
- entry_value = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel);
- break;
- case TAG_FMT_SLONG:
- entry_value = php_ifd_get32s(dir_entry+8, ImageInfo->motorola_intel);
- break;
- }
- switch(entry_tag) {
- case TAG_IMAGEWIDTH:
- case TAG_COMP_IMAGE_WIDTH:
- ImageInfo->Width = entry_value;
- break;
- case TAG_IMAGEHEIGHT:
- case TAG_COMP_IMAGE_HEIGHT:
- ImageInfo->Height = entry_value;
- break;
- case TAG_PHOTOMETRIC_INTERPRETATION:
- switch (entry_value) {
- case PMI_BLACK_IS_ZERO:
- case PMI_WHITE_IS_ZERO:
- case PMI_TRANSPARENCY_MASK:
- ImageInfo->IsColor = 0;
- break;
- case PMI_RGB:
- case PMI_PALETTE_COLOR:
- case PMI_SEPARATED:
- case PMI_YCBCR:
- case PMI_CIELAB:
- ImageInfo->IsColor = 1;
- break;
- }
- break;
- }
- } else {
- entry_offset = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel);
- /* if entry needs expading ifd cache and entry is at end of current ifd cache. */
- /* otherwise there may be huge holes between two entries */
- if (entry_offset + entry_length > dir_offset + ifd_size
- && entry_offset == dir_offset + ifd_size) {
- ifd_size = entry_offset + entry_length - dir_offset;
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "resize struct: x%04X + x%04X - x%04X = x%04X", entry_offset, entry_length, dir_offset, ifd_size);
-#endif
- }
- }
- }
- if (ImageInfo->FileSize >= dir_offset + ImageInfo->file.list[sn].size) {
- if (ifd_size > dir_size) {
- if (dir_offset + ifd_size > ImageInfo->FileSize) {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "error in TIFF: filesize(x%04X) less than size of IFD(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, ifd_size);
- return FALSE;
- }
- if (exif_file_sections_realloc(ImageInfo, sn, ifd_size TSRMLS_CC)) {
- return FALSE;
- }
- /* read values not stored in directory itself */
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "read from TIFF: filesize(x%04X), IFD(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, ifd_size);
-#endif
- php_stream_read(ImageInfo->infile, ImageInfo->file.list[sn].data+dir_size, ifd_size-dir_size);
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "read from TIFF, done");
-#endif
- }
- /* now process the tags */
- for(i=0;i<num_entries;i++) {
- dir_entry = ImageInfo->file.list[sn].data+2+i*12;
- entry_tag = php_ifd_get16u(dir_entry+0, ImageInfo->motorola_intel);
- entry_type = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel);
- /*entry_length = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel);*/
- if (entry_tag == TAG_EXIF_IFD_POINTER ||
- entry_tag == TAG_INTEROP_IFD_POINTER ||
- entry_tag == TAG_GPS_IFD_POINTER ||
- entry_tag == TAG_SUB_IFD
- ) {
- switch(entry_tag) {
- case TAG_EXIF_IFD_POINTER:
- ImageInfo->sections_found |= FOUND_EXIF;
- sub_section_index = SECTION_EXIF;
- break;
- case TAG_GPS_IFD_POINTER:
- ImageInfo->sections_found |= FOUND_GPS;
- sub_section_index = SECTION_GPS;
- break;
- case TAG_INTEROP_IFD_POINTER:
- ImageInfo->sections_found |= FOUND_INTEROP;
- sub_section_index = SECTION_INTEROP;
- break;
- case TAG_SUB_IFD:
- ImageInfo->sections_found |= FOUND_THUMBNAIL;
- sub_section_index = SECTION_THUMBNAIL;
- break;
- }
- entry_offset = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel);
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "next IFD: %s @x%04X", exif_get_sectionname(sub_section_index), entry_offset);
-#endif
- exif_process_IFD_in_TIFF(ImageInfo, entry_offset, sub_section_index TSRMLS_CC);
- if (section_index!=SECTION_THUMBNAIL && entry_tag==TAG_SUB_IFD) {
- if (ImageInfo->Thumbnail.filetype != IMAGE_FILETYPE_UNKNOWN
- && ImageInfo->Thumbnail.size
- && ImageInfo->Thumbnail.offset
- && ImageInfo->read_thumbnail
- ) {
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "%s THUMBNAIL @0x%04X + 0x%04X", ImageInfo->Thumbnail.data ? "ignore" : "read", ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
-#endif
- if (!ImageInfo->Thumbnail.data) {
- ImageInfo->Thumbnail.data = emalloc(ImageInfo->Thumbnail.size);
- php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET);
- fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size);
- if (fgot < ImageInfo->Thumbnail.size) {
- EXIF_ERRLOG_THUMBEOF
- }
- exif_thumbnail_build(ImageInfo TSRMLS_CC);
- }
- }
- }
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "next IFD: %s done", exif_get_sectionname(sub_section_index));
-#endif
- } else {
- if (!exif_process_IFD_TAG(ImageInfo, dir_entry,
- ImageInfo->file.list[sn].data-dir_offset,
- ifd_size, 0, section_index, 0, tag_table TSRMLS_CC)) {
- return FALSE;
- }
- }
- }
- /* If we had a thumbnail in a SUB_IFD we have ANOTHER image in NEXT IFD */
- if (next_offset && section_index != SECTION_THUMBNAIL) {
- /* this should be a thumbnail IFD */
- /* the thumbnail itself is stored at Tag=StripOffsets */
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "read next IFD (THUMBNAIL) at x%04X", next_offset);
-#endif
- exif_process_IFD_in_TIFF(ImageInfo, next_offset, SECTION_THUMBNAIL TSRMLS_CC);
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "%s THUMBNAIL @0x%04X + 0x%04X", ImageInfo->Thumbnail.data ? "ignore" : "read", ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
-#endif
- if (!ImageInfo->Thumbnail.data && ImageInfo->Thumbnail.offset && ImageInfo->Thumbnail.size && ImageInfo->read_thumbnail) {
- ImageInfo->Thumbnail.data = emalloc(ImageInfo->Thumbnail.size);
- php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET);
- fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size);
- if (fgot < ImageInfo->Thumbnail.size) {
- EXIF_ERRLOG_THUMBEOF
- }
- exif_thumbnail_build(ImageInfo TSRMLS_CC);
- }
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "read next IFD (THUMBNAIL) done");
-#endif
- }
- return TRUE;
- } else {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "error in TIFF: filesize(x%04X) less than size of IFD(x%04X)", ImageInfo->FileSize, dir_offset+ImageInfo->file.list[sn].size);
- return FALSE;
- }
- } else {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "error in TIFF: filesize(x%04X) less than size of IFD dir(x%04X)", ImageInfo->FileSize, dir_offset+dir_size);
- return FALSE;
- }
- } else {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "error in TIFF: filesize(x%04X) less than start of IFD dir(x%04X)", ImageInfo->FileSize, dir_offset+2);
- return FALSE;
- }
-}
-/* }}} */
-
-/* {{{ exif_scan_FILE_header
- * Parse the marker stream until SOS or EOI is seen; */
-static int exif_scan_FILE_header(image_info_type *ImageInfo TSRMLS_DC)
-{
- unsigned char file_header[8];
- int ret = FALSE;
-
- ImageInfo->FileType = IMAGE_FILETYPE_UNKNOWN;
-
- if (ImageInfo->FileSize >= 2) {
- php_stream_seek(ImageInfo->infile, 0, SEEK_SET);
- php_stream_read(ImageInfo->infile, file_header, 2);
- if ((file_header[0]==0xff) && (file_header[1]==M_SOI)) {
- ImageInfo->FileType = IMAGE_FILETYPE_JPEG;
- if (exif_scan_JPEG_header(ImageInfo TSRMLS_CC)) {
- ret = TRUE;
- } else {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "invalid JPEG file");
- }
- } else if (ImageInfo->FileSize >= 8) {
- php_stream_read(ImageInfo->infile, file_header+2, 6);
- if (!memcmp(file_header, "II\x2A\x00", 4)) {
- ImageInfo->FileType = IMAGE_FILETYPE_TIFF_II;
- ImageInfo->motorola_intel = 0;
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "file has TIFF/II format");
-#endif
- ImageInfo->sections_found |= FOUND_IFD0;
- if (exif_process_IFD_in_TIFF(ImageInfo,
- php_ifd_get32u(file_header + 4, ImageInfo->motorola_intel),
- SECTION_IFD0 TSRMLS_CC)) {
- ret = TRUE;
- } else {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "invalid TIFF file");
- }
- }
- else
- if (!memcmp(file_header, "MM\x00\x2a", 4)) {
- ImageInfo->FileType = IMAGE_FILETYPE_TIFF_MM;
- ImageInfo->motorola_intel = 1;
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "file has TIFF/MM format");
-#endif
- ImageInfo->sections_found |= FOUND_IFD0;
- if (exif_process_IFD_in_TIFF(ImageInfo,
- php_ifd_get32u(file_header + 4, ImageInfo->motorola_intel),
- SECTION_IFD0 TSRMLS_CC)) {
- ret = TRUE;
- } else {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "invalid TIFF file");
- }
- } else {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "file not supported");
- return FALSE;
- }
- }
- } else {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "file to small (%d)", ImageInfo->FileSize);
- }
- return ret;
-}
-/* }}} */
-
-/* {{{ exif_discard_imageinfo
- Discard data scanned by exif_read_file.
-*/
-static int exif_discard_imageinfo(image_info_type *ImageInfo)
-{
- int i;
-
- EFREE_IF(ImageInfo->FileName);
- EFREE_IF(ImageInfo->UserComment);
- EFREE_IF(ImageInfo->UserCommentEncoding);
- EFREE_IF(ImageInfo->Copyright);
- EFREE_IF(ImageInfo->CopyrightPhotographer);
- EFREE_IF(ImageInfo->CopyrightEditor);
- EFREE_IF(ImageInfo->Thumbnail.data);
- EFREE_IF(ImageInfo->encode_unicode);
- EFREE_IF(ImageInfo->decode_unicode_be);
- EFREE_IF(ImageInfo->decode_unicode_le);
- EFREE_IF(ImageInfo->encode_jis);
- EFREE_IF(ImageInfo->decode_jis_be);
- EFREE_IF(ImageInfo->decode_jis_le);
- EFREE_IF(ImageInfo->make);
- EFREE_IF(ImageInfo->model);
- for (i=0; i<ImageInfo->xp_fields.count; i++) {
- EFREE_IF(ImageInfo->xp_fields.list[i].value);
- }
- EFREE_IF(ImageInfo->xp_fields.list);
- for (i=0; i<SECTION_COUNT; i++) {
- exif_iif_free(ImageInfo, i);
- }
- exif_file_sections_free(ImageInfo);
- memset(ImageInfo, 0, sizeof(*ImageInfo));
- return TRUE;
-}
-/* }}} */
-
-/* {{{ exif_read_file
- */
-static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_thumbnail, int read_all TSRMLS_DC)
-{
- int ret;
- struct stat st;
-
- /* Start with an empty image information structure. */
- memset(ImageInfo, 0, sizeof(*ImageInfo));
-
- ImageInfo->motorola_intel = -1; /* flag as unknown */
-
- ImageInfo->infile = php_stream_open_wrapper(FileName, "rb", STREAM_MUST_SEEK|IGNORE_PATH|ENFORCE_SAFE_MODE, NULL);
- if (!ImageInfo->infile) {
- exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "unable to open file");
- return FALSE;
- }
-
- php_basename(FileName, strlen(FileName), NULL, 0, &(ImageInfo->FileName), NULL);
- ImageInfo->read_thumbnail = read_thumbnail;
- ImageInfo->read_all = read_all;
- ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_UNKNOWN;
-
- ImageInfo->encode_unicode = estrdup(EXIF_G(encode_unicode));
- ImageInfo->decode_unicode_be = estrdup(EXIF_G(decode_unicode_be));
- ImageInfo->decode_unicode_le = estrdup(EXIF_G(decode_unicode_le));
- ImageInfo->encode_jis = estrdup(EXIF_G(encode_jis));
- ImageInfo->decode_jis_be = estrdup(EXIF_G(decode_jis_be));
- ImageInfo->decode_jis_le = estrdup(EXIF_G(decode_jis_le));
-
- if (php_stream_is(ImageInfo->infile, PHP_STREAM_IS_STDIO)) {
- if (VCWD_STAT(FileName, &st) >= 0) {
- /* Store file date/time. */
- ImageInfo->FileDateTime = st.st_mtime;
- ImageInfo->FileSize = st.st_size;
- /*exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "open stream is file: %d", ImageInfo->FileSize);*/
- }
- } else {
- if (!ImageInfo->FileSize) {
- php_stream_seek(ImageInfo->infile, 0, SEEK_END);
- ImageInfo->FileSize = php_stream_tell(ImageInfo->infile);
- php_stream_seek(ImageInfo->infile, 0, SEEK_SET);
- }
- }
-
- /* Scan the JPEG headers. */
- ret = exif_scan_FILE_header(ImageInfo TSRMLS_CC);
-
- php_stream_close(ImageInfo->infile);
- return ret;
-}
-/* }}} */
-
-/* {{{ proto array|false exif_read_data(string filename [, sections_needed [, sub_arrays[, read_thumbnail]]])
- Reads header data from the JPEG/TIFF image filename and optionally reads the internal thumbnails */
-PHP_FUNCTION(exif_read_data)
-{
- pval **p_name, **p_sections_needed, **p_sub_arrays, **p_read_thumbnail, **p_read_all;
- int i, ac = ZEND_NUM_ARGS(), ret, sections_needed=0, sub_arrays=0, read_thumbnail=0, read_all=0;
- image_info_type ImageInfo;
- char tmp[64], *sections_str, *s;
-
- memset(&ImageInfo, 0, sizeof(ImageInfo));
-
- if ((ac < 1 || ac > 4) || zend_get_parameters_ex(ac, &p_name, &p_sections_needed, &p_sub_arrays, &p_read_thumbnail, &p_read_all) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(p_name);
-
- if(ac >= 2) {
- convert_to_string_ex(p_sections_needed);
- sections_str = safe_emalloc(strlen(Z_STRVAL_PP(p_sections_needed)), 1, 3);
- sprintf(sections_str, ",%s,", Z_STRVAL_PP(p_sections_needed));
- /* sections_str DOES start with , and SPACES are NOT allowed in names */
- s = sections_str;
- while(*++s) {
- if(*s==' ') {
- *s = ',';
- }
- }
- for (i=0; i<SECTION_COUNT; i++) {
- sprintf(tmp, ",%s,", exif_get_sectionname(i));
- if (strstr(sections_str, tmp)) {
- sections_needed |= 1<<i;
- }
- }
- EFREE_IF(sections_str);
- /* now see what we need */
-#ifdef EXIF_DEBUG
- sections_str = exif_get_sectionlist(sections_needed TSRMLS_CC);
- if (!sections_str) {
- RETURN_FALSE;
- }
- exif_error_docref(NULL TSRMLS_CC, &ImageInfo, E_NOTICE, "sections needed: %s", sections_str[0] ? sections_str : "None");
- EFREE_IF(sections_str);
-#endif
- }
- if(ac >= 3) {
- convert_to_long_ex(p_sub_arrays);
- sub_arrays = Z_LVAL_PP(p_sub_arrays);
- }
- if(ac >= 4) {
- convert_to_long_ex(p_read_thumbnail);
- read_thumbnail = Z_LVAL_PP(p_read_thumbnail);
- }
- if(ac >= 5) {
- convert_to_long_ex(p_read_all);
- read_all = Z_LVAL_PP(p_read_all);
- }
- /* parameters 3,4 will be working in later versions.... */
- read_all = 0; /* just to make function work for 4.2 tree */
-
- ret = exif_read_file(&ImageInfo, Z_STRVAL_PP(p_name), read_thumbnail, read_all TSRMLS_CC);
-
- sections_str = exif_get_sectionlist(ImageInfo.sections_found TSRMLS_CC);
-
-#ifdef EXIF_DEBUG
- if (sections_str)
- exif_error_docref(NULL TSRMLS_CC, &ImageInfo, E_NOTICE, "sections found: %s", sections_str[0] ? sections_str : "None");
-#endif
-
- ImageInfo.sections_found |= FOUND_COMPUTED;/* do not inform about in debug*/
-
- if (ret==FALSE || (sections_needed && !(sections_needed&ImageInfo.sections_found)) || array_init(return_value) == FAILURE) {
- /* array_init must be checked at last! otherwise the array must be freed if a later test fails. */
- exif_discard_imageinfo(&ImageInfo);
- EFREE_IF(sections_str);
- RETURN_FALSE;
- }
-
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, &ImageInfo, E_NOTICE, "generate section FILE");
-#endif
-
- /* now we can add our information */
- exif_iif_add_str(&ImageInfo, SECTION_FILE, "FileName", ImageInfo.FileName TSRMLS_CC);
- exif_iif_add_int(&ImageInfo, SECTION_FILE, "FileDateTime", ImageInfo.FileDateTime TSRMLS_CC);
- exif_iif_add_int(&ImageInfo, SECTION_FILE, "FileSize", ImageInfo.FileSize TSRMLS_CC);
- exif_iif_add_int(&ImageInfo, SECTION_FILE, "FileType", ImageInfo.FileType TSRMLS_CC);
- exif_iif_add_str(&ImageInfo, SECTION_FILE, "MimeType", (char*)php_image_type_to_mime_type(ImageInfo.FileType) TSRMLS_CC);
- exif_iif_add_str(&ImageInfo, SECTION_FILE, "SectionsFound", sections_str ? sections_str : "NONE" TSRMLS_CC);
-
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, &ImageInfo, E_NOTICE, "generate section COMPUTED");
-#endif
-
- if (ImageInfo.Width>0 && ImageInfo.Height>0) {
- exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "html" TSRMLS_CC, "width=\"%d\" height=\"%d\"", ImageInfo.Width, ImageInfo.Height);
- exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Height", ImageInfo.Height TSRMLS_CC);
- exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Width", ImageInfo.Width TSRMLS_CC);
- }
- exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "IsColor", ImageInfo.IsColor TSRMLS_CC);
- if (ImageInfo.motorola_intel != -1) {
- exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "ByteOrderMotorola", ImageInfo.motorola_intel TSRMLS_CC);
- }
- if (ImageInfo.FocalLength) {
- exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocalLength" TSRMLS_CC, "%4.1fmm", ImageInfo.FocalLength);
- if(ImageInfo.CCDWidth) {
- exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "35mmFocalLength" TSRMLS_CC, "%dmm", (int)(ImageInfo.FocalLength/ImageInfo.CCDWidth*35+0.5));
- }
- }
- if(ImageInfo.CCDWidth) {
- exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "CCDWidth" TSRMLS_CC, "%dmm", (int)ImageInfo.CCDWidth);
- }
- if(ImageInfo.ExposureTime>0) {
- if(ImageInfo.ExposureTime <= 0.5) {
- exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime" TSRMLS_CC, "%0.3f s (1/%d)", ImageInfo.ExposureTime, (int)(0.5 + 1/ImageInfo.ExposureTime));
- } else {
- exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime" TSRMLS_CC, "%0.3f s", ImageInfo.ExposureTime);
- }
- }
- if(ImageInfo.ApertureFNumber) {
- exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ApertureFNumber" TSRMLS_CC, "f/%.1f", ImageInfo.ApertureFNumber);
- }
- if(ImageInfo.Distance) {
- if(ImageInfo.Distance<0) {
- exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "FocusDistance", "Infinite" TSRMLS_CC);
- } else {
- exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocusDistance" TSRMLS_CC, "%0.2fm", ImageInfo.Distance);
- }
- }
- if (ImageInfo.UserComment) {
- exif_iif_add_buffer(&ImageInfo, SECTION_COMPUTED, "UserComment", ImageInfo.UserCommentLength, ImageInfo.UserComment TSRMLS_CC);
- if (ImageInfo.UserCommentEncoding && strlen(ImageInfo.UserCommentEncoding)) {
- exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "UserCommentEncoding", ImageInfo.UserCommentEncoding TSRMLS_CC);
- }
- }
-
- exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright", ImageInfo.Copyright TSRMLS_CC);
- exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright.Photographer", ImageInfo.CopyrightPhotographer TSRMLS_CC);
- exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright.Editor", ImageInfo.CopyrightEditor TSRMLS_CC);
-
- for (i=0; i<ImageInfo.xp_fields.count; i++) {
- exif_iif_add_str(&ImageInfo, SECTION_WINXP, exif_get_tagname(ImageInfo.xp_fields.list[i].tag, NULL, 0, exif_get_tag_table(SECTION_WINXP) TSRMLS_CC), ImageInfo.xp_fields.list[i].value TSRMLS_CC);
- }
- if (ImageInfo.Thumbnail.size) {
- if (read_thumbnail) {
- /* not exif_iif_add_str : this is a buffer */
- exif_iif_add_tag(&ImageInfo, SECTION_THUMBNAIL, "THUMBNAIL", TAG_NONE, TAG_FMT_UNDEFINED, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.data TSRMLS_CC);
- }
- if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
- /* try to evaluate if thumbnail data is present */
- exif_scan_thumbnail(&ImageInfo TSRMLS_CC);
- }
- exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Thumbnail.FileType", ImageInfo.Thumbnail.filetype TSRMLS_CC);
- exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Thumbnail.MimeType", (char*)php_image_type_to_mime_type(ImageInfo.Thumbnail.filetype) TSRMLS_CC);
- }
- if (ImageInfo.Thumbnail.width && ImageInfo.Thumbnail.height) {
- exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Thumbnail.Height", ImageInfo.Thumbnail.height TSRMLS_CC);
- exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Thumbnail.Width", ImageInfo.Thumbnail.width TSRMLS_CC);
- }
- EFREE_IF(sections_str);
-
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, &ImageInfo, E_NOTICE, "adding image infos");
-#endif
-
- add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_FILE TSRMLS_CC);
- add_assoc_image_info(return_value, 1, &ImageInfo, SECTION_COMPUTED TSRMLS_CC);
- add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_ANY_TAG TSRMLS_CC);
- add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_IFD0 TSRMLS_CC);
- add_assoc_image_info(return_value, 1, &ImageInfo, SECTION_THUMBNAIL TSRMLS_CC);
- add_assoc_image_info(return_value, 1, &ImageInfo, SECTION_COMMENT TSRMLS_CC);
- add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_EXIF TSRMLS_CC);
- add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_GPS TSRMLS_CC);
- add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_INTEROP TSRMLS_CC);
- add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_FPIX TSRMLS_CC);
- add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_APP12 TSRMLS_CC);
- add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_WINXP TSRMLS_CC);
- add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_MAKERNOTE TSRMLS_CC);
-
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, &ImageInfo, E_NOTICE, "discarding info");
-#endif
-
- exif_discard_imageinfo(&ImageInfo);
-
-#ifdef EXIF_DEBUG
- php_error_docref1(NULL TSRMLS_CC, Z_STRVAL_PP(p_name), E_NOTICE, "done");
-#endif
-}
-/* }}} */
-
-/* {{{ proto string|false exif_thumbnail(string filename [, &width, &height [, &imagetype]])
- Reads the embedded thumbnail */
-PHP_FUNCTION(exif_thumbnail)
-{
- zval *p_width, *p_height, *p_imagetype;
- char *p_name;
- int p_name_len, ret, arg_c = ZEND_NUM_ARGS();
- image_info_type ImageInfo;
-
- memset(&ImageInfo, 0, sizeof(ImageInfo));
-
- if (arg_c!=1 && arg_c!=3 && arg_c!=4) {
- WRONG_PARAM_COUNT;
- }
-
- if (zend_parse_parameters(arg_c TSRMLS_CC, "s|z/z/z/", &p_name, &p_name_len, &p_width, &p_height, &p_imagetype) == FAILURE) {
- return;
- }
-
- ret = exif_read_file(&ImageInfo, p_name, 1, 0 TSRMLS_CC);
- if (ret==FALSE) {
- RETURN_FALSE;
- }
-
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, &ImageInfo, E_NOTICE, "Thumbnail data %d %d %d, %d x %d", ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.filetype, ImageInfo.Thumbnail.width, ImageInfo.Thumbnail.height);
-#endif
- if (!ImageInfo.Thumbnail.data || !ImageInfo.Thumbnail.size) {
- exif_discard_imageinfo(&ImageInfo);
- RETURN_FALSE;
- }
-
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, &ImageInfo, E_NOTICE, "returning thumbnail(%d)", ImageInfo.Thumbnail.size);
-#endif
-
- ZVAL_STRINGL(return_value, ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size, 1);
- if (arg_c >= 3) {
- if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
- exif_scan_thumbnail(&ImageInfo TSRMLS_CC);
- }
- zval_dtor(p_width);
- zval_dtor(p_height);
- ZVAL_LONG(p_width, ImageInfo.Thumbnail.width);
- ZVAL_LONG(p_height, ImageInfo.Thumbnail.height);
- }
- if (arg_c >= 4) {
- zval_dtor(p_imagetype);
- ZVAL_LONG(p_imagetype, ImageInfo.Thumbnail.filetype);
- }
-
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL TSRMLS_CC, &ImageInfo, E_NOTICE, "discarding info");
-#endif
-
- exif_discard_imageinfo(&ImageInfo);
-
-#ifdef EXIF_DEBUG
- php_error_docref1(NULL TSRMLS_CC, p_name, E_NOTICE, "done");
-#endif
-}
-/* }}} */
-
-/* {{{ proto int exif_imagetype(string imagefile)
- Get the type of an image */
-PHP_FUNCTION(exif_imagetype)
-{
- zval **arg1;
- php_stream * stream;
- int itype = 0;
-
- if (ZEND_NUM_ARGS() != 1)
- WRONG_PARAM_COUNT;
-
- if (zend_get_parameters_ex(1, &arg1) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(arg1);
- stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), "rb", IGNORE_PATH|ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
-
- if (stream == NULL) {
- RETURN_FALSE;
- }
-
- itype = php_getimagetype(stream, NULL TSRMLS_CC);
-
- php_stream_close(stream);
-
- if (itype == IMAGE_FILETYPE_UNKNOWN) {
- RETURN_FALSE;
- } else {
- ZVAL_LONG(return_value, itype);
- }
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/exif/exif.dsp b/ext/exif/exif.dsp
deleted file mode 100644
index 2c8bd86588..0000000000
--- a/ext/exif/exif.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="exif" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=exif - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "exif.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "exif.mak" CFG="exif - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "exif - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "exif - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "exif - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXIF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXIF_EXPORTS" /D "COMPILE_DL_EXIF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXIF=1 /D "LIBZEND_EXPORTS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_exif.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "exif - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXIF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXIF_EXPORTS" /D "COMPILE_DL_EXIF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXIF=1 /D "LIBZEND_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_exif.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "exif - Win32 Release_TS"
-# Name "exif - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\exif.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_exif.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/exif/php_exif.h b/ext/exif/php_exif.h
deleted file mode 100644
index ae4a1e78d9..0000000000
--- a/ext/exif/php_exif.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#if HAVE_EXIF
-extern zend_module_entry exif_module_entry;
-#define phpext_exif_ptr &exif_module_entry
-
-PHP_FUNCTION(exif_read_data);
-PHP_FUNCTION(exif_tagname);
-PHP_FUNCTION(exif_thumbnail);
-PHP_FUNCTION(exif_imagetype);
-#endif
diff --git a/ext/exif/test.php b/ext/exif/test.php
deleted file mode 100644
index 907b9ea080..0000000000
--- a/ext/exif/test.php
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
- include 'test.txt';
-?> \ No newline at end of file
diff --git a/ext/exif/test.txt b/ext/exif/test.txt
deleted file mode 100644
index 1c12b509e6..0000000000
--- a/ext/exif/test.txt
+++ /dev/null
@@ -1,365 +0,0 @@
-<?php
-
-/* Test script for PHP module ext/exif
- *
- * (c) Marcus Boerger, 2002
- *
- * $Id$
- *
- * Rename the file to test.php and read the instructions. If the
- * script cannot be executed or does not generate any output check
- * you error log. In most cases this would mean you found an error
- * if the rest of your php environment works fine.
- *
- * The original version of module exif has many errors and mostly
- * fails on executing this script.
- */
-
-$file = array_key_exists('thumbnail',$_REQUEST) ? $_REQUEST['thumbnail'] : '';
-//$file = '/t/temp/kodak-dc4800.tif';
-//$file = '/t/temp/canon-ixus.jpg';
-//$file = '/t/temp/test2.jpg';
-if ( $file) {
- $image = exif_thumbnail($file);
- if ( $image!==false) {
- @Header("content-type: image/jpeg");
- echo $image;
- } else {
- echo "<html><body><table>\n";
- echo "Thumbnail could not be extracted.\n";
- echo "</table></body></html>";
- }
- die();
-}
-
-if ( !defined('IMAGETYPE_GIF')) define('IMAGETYPE_GIF',1);
-if ( !defined('IMAGETYPE_JPEG')) define('IMAGETYPE_JPEG',2);
-if ( !defined('IMAGETYPE_TIFF_II')) define('IMAGETYPE_TIFF_II',7);
-if ( !defined('IMAGETYPE_TIFF_MM')) define('IMAGETYPE_TIFF_MM',8);
-
-$possible = array();
-
-/****************************************************************************/
-// message function is used for debugging purpose: just to se what happens
-function message($msg) {
- error_log($msg,0);
- echo "$msg\n";
-}
-
-function error_msg() {
- $ret = '<b style="color:green">O.K.</b>';
- if (array_key_exists('php_errormsg',$GLOBALS) && strlen($GLOBALS['php_errormsg'])) {
- $ret = '<b style="color:red">'.$GLOBALS['php_errormsg'].'</b>';
- $GLOBALS['php_errormsg'] = '';
- }
- return $ret;
-}
-
-/****************************************************************************/
-// private to function search_file()
-function _search_file($root,&$possible,$path='') {
- $sub = array();
- $cnt = 0;
- $type= false;
-
- //error_log("search_file($root,$path)",0);
- if ($dir = @opendir($root.$path.'/')) {
- while (($found = @readdir($dir)) !== false) {
- $type = @filetype($root.$path.'/'.$found);
- //error_log("search_file($root$path):$type=$found",0);
- switch( $type) {
- case 'file':
- $pos = strrpos($found,'.');
- if ( function_exists('exif_imagetype')) {
- $type = exif_imagetype($root.$path.'/'.$found);
- } else {
- if ( $pos!==false) {
- $type = GetImageSize($root.$path.'/'.$found);
- if ( is_array($type)) {
- $type = $type[2];
- } else {
- $type = false;
- }
- } else $type = false;
- }
- if ( $type!==false)
- {
- $possible[] = array('file'=>$root.$path.'/'.$found, 'type'=>$type);
- //error_log("search_file($root$path) add:$path/$found",0);
- if ( ($cnt=count($possible)) % 100 == 0) {
- error_log("exif test page - counting files: $cnt",0);
- }
- }
- break;
- case 'dir':
- if ( $found!='.' && $found!='..') {
- $sub[count($sub)] = $found;
- }
- break;
- }
- }
- @closedir($dir);
- foreach( $sub as $idx => $found) {
- _search_file($root,$possible,$path.'/'.$found);
- }
- }
-}
-
-/****************************************************************************/
-// function: search_file($file,$ext)
-//
-// Searches for $file in document tree. The path is ignored.
-//
-function search_file() {
- global $argc, $argv;
- $possible = array();
-
- if ( $argc > 1) {
- $path = $argv[1];
- } else if ( array_key_exists('SCRIPT_FILENAME',$_SERVER)) {
- $path = $_SERVER['SCRIPT_FILENAME'];
- //error_log("SCRIPT_FILENAME($path)",0);
- } else {
- $path = $argv[0];
- //error_log("argv($path)",0);
- }
- if ( ($p=strpos($path,'?')) !== false) $path = substr($path,0,$p);
- if ( ($p=strrpos($path,'/')) /*< strlen($path)-1*/) $path = substr($path,0,$p);
- error_log("exif test page - counting files in $path");
- _search_file($path,$possible);
- error_log("exif test page - counting files: ".count($possible)." done.",0);
- return $possible;
-}
-
-/****************************************************************************/
-// function: search_file($file,$ext)
-//
-// Searches for $file in document tree. The path is ignored.
-//
-function AddInfo($Name,$Value,$highlight=0) {
- if (is_array($Value)) $Value = 'Array: ('.join(',',$Value).')';
- $Value = nl2br($Value);
- if ( $highlight) {
- $Name = "<th>$Name</th>";
- } else {
- $Name = "<td>$Name</td>";
- }
- return "<tr>$Name<td>$Value&nbsp;</td></tr>\n";
-}
-
-$possible = search_file();
-
-$title = "PHP module exif test page";
-
-?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional">
-<html>
-<head>
-<title><?=$title ?></title>
-<style type="text/css">
-body {
- font-size: 12pt;
-}
-h1 {
- font-size: 20pt;
- font-weight:bold;
-}
-h2 {
- font-size: 16pt;
- font-weight:bold;
-}
-th {
- text-align: left;
-}
-ul {
- margin-bottom: 6pt;
-}
-</style>
-</head>
-<body>
-<h1><?=$title ?></h1>
-<h2>(c) Marcus B&ouml;rger, 2002</h2>
-</p>
-<p>
-Images taken from <a href="http://www.exif.org">www.exif.org</a>,
-<a href="http://marcus-boerger.de">marcus-boerger.de</a>
-all rights reserved by their authors and artists, see exif headers.
-The files can be downloaded <a href="http://marcus-boerger.de/php/ext/exif/test/">here</a>.
-To start the test you simple have to put all images into the same directory as this script.
-The test will work with all files in that directory and all subdirectories. To test private
-images just put them into that directory.
-</p>
-<p>
-Youmay take a look at the test <a href="http://marcus-boerger.de/php/ext/exif/test.txt">source here</a>.
-</p>
-<p>
-This test just prooves that some exif headers can be scanned.
-If all files produce a header in output the module might be o.k.
-</p>
-<p>
-What to look for in detail:
-</p>
-<ul>
-<li>kodak-dc4800-plus-acdsee.jpg
- <ul>
- <li>should provide a <b>long</b> comment 'by marcus b&ouml;rger&lt;%04i&gt;'*n</li>
- <li>this file returns an array but it also produces an errormessage because ACDSee destroys
- the integrity of IFD directory (size of directory and offsets of entries following any
- edited entry maybe wrong).
- </li>
- </ul>
-</li>
-<li>hp-photosmart.jpg
- <ul>
- <li>should provide a <b>two line</b> copyright notice</li>
- </ul>
-</li>
-<li>olympus-d320l
- <ul>
- <li>should provide an <b>APP12</b> infoset</li>
- </ul>
-</li>
-<li>unknown.jpg
- <ul>
- <li>should provide an <b>empty</b> comment, this is a comment section and not an IFD0, EXIF or GPS section</li>
- </ul>
-</li>
-<li>some images
- <ul>
- <li>have empty fields, that is the tag is present but no data is stored</li>
- </ul>
-</li>
-</ul>
-<h2>function exif_tagname</h2>
-<table border='1' cellspacing='0' cellpadding='3' summary="EXIF headernames">
-<?php
-if (function_exists('exif_tagname')) {
-?>
-<tr><td>ImageWidth</td><td><?=@exif_tagname(0x0100)?></td><td><?=error_msg()?></td></tr>
-<tr><td>JPEGProc</td><td><?=@exif_tagname(0x0200)?></td><td><?=error_msg()?></td></tr>
-<tr><td>SceneType</td><td><?=@exif_tagname(0xA301)?></td><td><?=error_msg()?></td></tr>
-<tr><td>false</td><td><?=@exif_tagname(0x0000)===false?'false':'value'?></td><td><?=error_msg()?></td></tr>
-<?php
-} else {
- echo "<tr><td>function exif_tagname is not supported</td></tr>\n";
-}
-?>
-</table>
-<br clear="all">
-<h2>function exif_read_data for <?=count($possible)?> images</h2>
-
-<?php
-$check_getimagesize = false;
-$check_exif_thumbnail = true;
-$check_exif_read_data = false;
-$fast_output = false;
-if (function_exists('exif_read_data')) {
- $num = 0;
- echo "<table border='1' cellspacing='0' cellpadding='3' summary='function results'>\n";
- $tab2 = "";//"<table border='1' cellspacing='0' cellpadding='3' summary='EXIF information'>\n";
- $types = array('','GIF','JPEG','PNG','SWF','PSD','BMP','TIFF_II','TIFF_MM','JPC','JP2','JPX','JB2');
- foreach($possible as $idx => $file) {
- $type = $file['type'];
- $file = $file['file'];
- if ( !((++$num)%100)) error_log("exif test page - checking files: $num",0);
- $error = '';
- $len = 2;
- $rows = 1
- + ($check_getimagesize ? 1 : 0)
- + ($check_exif_thumbnail ? 1 : 0)
- + ($check_exif_read_data ? 1 : 0);
- if ( !$fast_output) echo "<tr><td rowspan='$rows' valign='top'>$num</td><th colspan='2'>$file</th></tr>\n";
- if ($check_getimagesize) {
- $len++;
- $size = GetImageSize($file);
- $error = error_msg();// clear message
- if ( $size === false) {
- $error = '<b style="color:red">GetImageSize returned false</b><br>'.$error;
- $res_getimagesize = $error;
- } else {
- $res_getimagesize = '('.join($size,',').')';
- }
- if ( !$fast_output) echo AddInfo("GetImageSize",$error,1);
- }
- if ( $check_exif_thumbnail) {
- $len++;
- if ($type!=IMAGETYPE_JPEG) {// && $type!=IMAGETYPE_TIFF_II && $type!=IMAGETYPE_TIFF_MM) {
- $error = "<b style='color: green'>filetype not supported: $types[$type]</b>";
- $res_exif_thumbnail = $error;
- } else {
- $t_width = 0;
- $t_height = 0;
- $result = exif_thumbnail($file, $t_width, $t_height);
- $error = error_msg();// clear message
- if ( $result === false) {
- $error = '<b style="color:red">exif_thumbnail returned false</b><br>'.$error;
- if ( $t_width && $t_height) {
- $error = "<b style='color:green'>$t_width x $t_height</b><br>$error";
- }
- $res_exif_thumbnail = $error;
- } else {
- $res_exif_thumbnail = $t_width . " x " . $t_height;
- }
- }
- if ( !$fast_output) echo AddInfo("exif_thumbnail",$error,1);
- }
- if ($check_exif_read_data) {
- $len++;
- if ($type!=IMAGETYPE_JPEG && $type!=IMAGETYPE_TIFF_II && $type!=IMAGETYPE_TIFF_MM) {
- $res_exif_read_data = "<b style='color: green'>filetype not supported: $types[$type]</b>";
- if ( !$fast_output) echo AddInfo("exif_read_data",$res_exif_read_data);
- $res = '';
- } else {
- $image = exif_read_data($file,'COMMENT,IFD0,EXIF,APP12',true);
- $error = error_msg();// clear message
- if ( !$fast_output) echo AddInfo("exif_read_data",$error,1);
- $res = '';
- if ( $image === false) {
- $res_exif_read_data = "<b style='color:red'>exif_read_data returned false</b><br>$error";
- } else {
- $res_exif_read_data = $error;
- // ah no!$error = error_msg(); // force o.k.
- foreach($image as $Name => $Value) {
- if ( $Name!='Thumbnail') {
- if ( is_array($Value)) {
- $len++;
- $res .= AddInfo($Name,'Array('.count($Value).')');
- foreach( $Value as $idx => $Entry) {
- if ($idx==='Thumbnail') $Entry = '&lt;data&gt;';
- $len++;
- $res .= AddInfo($Name.':'.$idx,$Entry);
- }
- } else {
- $len++;
- $res .= AddInfo($Name,$Value);
- }
- }
- }
- }
- }
- }
- $tab2 .= "<tr><td rowspan='$len' valign='top'>$num</td></tr>\n";
- $tab2 .= "<tr><th colspan='2'>$file</th></tr>\n";
- if ($check_getimagesize) {
- $tab2 .= "<tr><th>GetImageSize</th><td>$res_getimagesize</td></tr>\n";
- }
- if ($check_exif_thumbnail) {
- $tab2 .= "<tr><th>exif_thumbnail</th><td>$res_exif_thumbnail</td></tr>\n";
- }
- if ($check_exif_read_data) {
- $tab2 .= "<tr><th>exif_read_data</th><td>$res_exif_read_data</td></tr>\n";
- $tab2 .= $res;
- }
- if ( $fast_output) {
- echo $tab2;
- $tab2 = '';
- }
- }
- error_log("exif test page - checking files: ".count($possible)." done.",0);
- echo $tab2;
- echo "</table>\n";
-} else {
- echo "<h1 style='color:red'>function exif_read_data is not supported</h1>\n";
-}
-?>
-</body>
-</html> \ No newline at end of file
diff --git a/ext/exif/tests/exif000.phpt b/ext/exif/tests/exif000.phpt
deleted file mode 100644
index eea16438cf..0000000000
--- a/ext/exif/tests/exif000.phpt
+++ /dev/null
@@ -1,57 +0,0 @@
---TEST--
-Check for exif_read_data default behaviour
---SKIPIF--
-<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
---INI--
-output_handler=
-zlib.output_compression=0
---FILE--
-<?php
-/*
- test1.jpg is a 1*1 image that does not contain any Exif/Comment information
- test2.jpg is the same image but contains Exif/Comment information and a
- copy of test1.jpg as a thumbnail.
-*/
-print_r(exif_read_data(dirname(__FILE__).'/test2.jpg'));
-?>
---EXPECTF--
-Array
-(
- [FileName] => test2.jpg
- [FileDateTime] => %d
- [FileSize] => 1240
- [FileType] => 2
- [MimeType] => image/jpeg
- [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, COMMENT
- [COMPUTED] => Array
- (
- [html] => width="1" height="1"
- [Height] => 1
- [Width] => 1
- [IsColor] => 1
- [ByteOrderMotorola] => 1
- [UserComment] => Exif test image.
- [UserCommentEncoding] => ASCII
- [Copyright] => Photo (c) M.Boerger, Edited by M.Boerger.
- [Copyright.Photographer] => Photo (c) M.Boerger
- [Copyright.Editor] => Edited by M.Boerger.
- [Thumbnail.FileType] => 2
- [Thumbnail.MimeType] => image/jpeg
- )
-
- [Copyright] => Photo (c) M.Boerger
- [UserComment] => ASCII
- [THUMBNAIL] => Array
- (
- [JPEGInterchangeFormat] => 134
- [JPEGInterchangeFormatLength] => 523
- )
-
- [COMMENT] => Array
- (
- [0] => Comment #1.
- [1] => Comment #2.
- [2] => Comment #3end
- )
-
-)
diff --git a/ext/exif/tests/exif001.phpt b/ext/exif/tests/exif001.phpt
deleted file mode 100644
index 8fac4286ca..0000000000
--- a/ext/exif/tests/exif001.phpt
+++ /dev/null
@@ -1,84 +0,0 @@
---TEST--
-Check for exif_read_data
---SKIPIF--
-<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
---INI--
-output_handler=
-zlib.output_compression=0
---FILE--
-<?php
-/*
- test1.jpg is a 1*1 image that does not contain any Exif/Comment information
- test2.jpg is the same image but contains Exif/Comment information and a
- copy of test1.jpg as a thumbnail.
-*/
-var_dump(exif_read_data(dirname(__FILE__).'/test2.jpg','',true,false));
-?>
---EXPECTF--
-array(5) {
- ["FILE"]=>
- array(6) {
- ["FileName"]=>
- string(9) "test2.jpg"
- ["FileDateTime"]=>
- int(%d)
- ["FileSize"]=>
- int(1240)
- ["FileType"]=>
- int(2)
- ["MimeType"]=>
- string(10) "image/jpeg"
- ["SectionsFound"]=>
- string(33) "ANY_TAG, IFD0, THUMBNAIL, COMMENT"
- }
- ["COMPUTED"]=>
- array(12) {
- ["html"]=>
- string(20) "width="1" height="1""
- ["Height"]=>
- int(1)
- ["Width"]=>
- int(1)
- ["IsColor"]=>
- int(1)
- ["ByteOrderMotorola"]=>
- int(1)
- ["UserComment"]=>
- string(16) "Exif test image."
- ["UserCommentEncoding"]=>
- string(5) "ASCII"
- ["Copyright"]=>
- string(41) "Photo (c) M.Boerger, Edited by M.Boerger."
- ["Copyright.Photographer"]=>
- string(19) "Photo (c) M.Boerger"
- ["Copyright.Editor"]=>
- string(20) "Edited by M.Boerger."
- ["Thumbnail.FileType"]=>
- int(2)
- ["Thumbnail.MimeType"]=>
- string(10) "image/jpeg"
- }
- ["IFD0"]=>
- array(2) {
- ["Copyright"]=>
- string(19) "Photo (c) M.Boerger"
- ["UserComment"]=>
- string(5) "ASCII"
- }
- ["THUMBNAIL"]=>
- array(2) {
- ["JPEGInterchangeFormat"]=>
- int(134)
- ["JPEGInterchangeFormatLength"]=>
- int(523)
- }
- ["COMMENT"]=>
- array(3) {
- [0]=>
- string(11) "Comment #1."
- [1]=>
- string(11) "Comment #2."
- [2]=>
- string(13) "Comment #3end"
- }
-} \ No newline at end of file
diff --git a/ext/exif/tests/exif002.phpt b/ext/exif/tests/exif002.phpt
deleted file mode 100644
index 1b1220c600..0000000000
--- a/ext/exif/tests/exif002.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Check for exif_thumbnail
---SKIPIF--
-<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
---INI--
-magic_quotes_runtime=0
-output_handler=
-zlib.output_compression=0
---FILE--
-<?php
-/*
- test1.jpg is a 1*1 image that does not contain any Exif/Comment information
- test2.jpg is the same image but contains Exif/Comment information and a
- copy of test1.jpg as a thumbnail.
-*/
-$infile = dirname(__FILE__).'/test1.jpg';
-echo md5_file($infile).'_'.filesize($infile);
-$thumb = exif_thumbnail(dirname(__FILE__).'/test2.jpg');
-echo " == ";
-echo md5($thumb).'_'.strlen($thumb);
-echo "\n";
-?>
---EXPECT--
-27bbfd9fc10e1e663d749f5225447905_523 == 27bbfd9fc10e1e663d749f5225447905_523
diff --git a/ext/exif/tests/exif003.phpt b/ext/exif/tests/exif003.phpt
deleted file mode 100644
index 20cb61ee17..0000000000
--- a/ext/exif/tests/exif003.phpt
+++ /dev/null
@@ -1,91 +0,0 @@
---TEST--
-Check for exif_read_data, Unicode user comment
---SKIPIF--
-<?php
- if (!extension_loaded('exif')) die('skip exif extension not available');
- if (!extension_loaded('mbstring')) die('skip mbstring extension not available');
- if (!defined("EXIF_USE_MBSTRING") || !EXIF_USE_MBSTRING) die ('skip mbstring loaded by dl');
-?>
---INI--
-output_handler=
-zlib.output_compression=0
-exif.decode_unicode_motorola=UCS-2BE
-exif.encode_unicode=ISO-8859-15
---FILE--
-<?php
-/*
- test1.jpg is a 1*1 image that does not contain any Exif/Comment information
- test2.jpg is the same image but contains Exif/Comment information and a
- copy of test1.jpg as a thumbnail.
- test3.jpg is the same as test2.jpg but with a UNICODE UserComment: &Auml;&Ouml;&&Uuml;&szlig;&auml;&ouml;&uuml;
-*/
-var_dump(exif_read_data(dirname(__FILE__).'/test3.jpg','',true,false));
-?>
---EXPECTF--
-array(5) {
- ["FILE"]=>
- array(6) {
- ["FileName"]=>
- string(9) "test3.jpg"
- ["FileDateTime"]=>
- int(%s)
- ["FileSize"]=>
- int(1240)
- ["FileType"]=>
- int(2)
- ["MimeType"]=>
- string(10) "image/jpeg"
- ["SectionsFound"]=>
- string(33) "ANY_TAG, IFD0, THUMBNAIL, COMMENT"
- }
- ["COMPUTED"]=>
- array(12) {
- ["html"]=>
- string(20) "width="1" height="1""
- ["Height"]=>
- int(1)
- ["Width"]=>
- int(1)
- ["IsColor"]=>
- int(1)
- ["ByteOrderMotorola"]=>
- int(1)
- ["UserComment"]=>
- string(7) "ÄÖÜßäöü"
- ["UserCommentEncoding"]=>
- string(7) "UNICODE"
- ["Copyright"]=>
- string(41) "Photo (c) M.Boerger, Edited by M.Boerger."
- ["Copyright.Photographer"]=>
- string(19) "Photo (c) M.Boerger"
- ["Copyright.Editor"]=>
- string(20) "Edited by M.Boerger."
- ["Thumbnail.FileType"]=>
- int(2)
- ["Thumbnail.MimeType"]=>
- string(10) "image/jpeg"
- }
- ["IFD0"]=>
- array(2) {
- ["Copyright"]=>
- string(19) "Photo (c) M.Boerger"
- ["UserComment"]=>
- string(7) "UNICODE"
- }
- ["THUMBNAIL"]=>
- array(2) {
- ["JPEGInterchangeFormat"]=>
- int(134)
- ["JPEGInterchangeFormatLength"]=>
- int(523)
- }
- ["COMMENT"]=>
- array(3) {
- [0]=>
- string(11) "Comment #1."
- [1]=>
- string(11) "Comment #2."
- [2]=>
- string(13) "Comment #3end"
- }
-} \ No newline at end of file
diff --git a/ext/exif/tests/exif004.phpt b/ext/exif/tests/exif004.phpt
deleted file mode 100644
index 229f49e145..0000000000
--- a/ext/exif/tests/exif004.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-Check for exif_read_data, Unicode WinXP tags
---SKIPIF--
-<?php
- if (!extension_loaded('exif')) die('skip exif extension not available');
- if (!extension_loaded('mbstring')) die('skip mbstring extension not available');
- if (!defined("EXIF_USE_MBSTRING") || !EXIF_USE_MBSTRING) die ('skip mbstring loaded by dl');
-?>
---INI--
-output_handler=
-zlib.output_compression=0
-exif.decode_unicode_intel=UCS-2LE
-exif.decode_unicode_motorola=UCS-2BE
-exif.encode_unicode=ISO-8859-1
---FILE--
-<?php
-/*
- test4.jpg is a 1*1 image that contains Exif tags written by WindowsXP
-*/
-$image = exif_read_data(dirname(__FILE__).'/test4.jpg','',true,false);
-echo var_dump($image['WINXP']);
-?>
---EXPECT--
-array(5) {
- ["Subject"]=>
- string(10) "Subject..."
- ["Keywords"]=>
- string(11) "Keywords..."
- ["Author"]=>
- string(9) "Rui Carmo"
- ["Comments"]=>
- string(29) "Comments
-Line2
-Line3
-Line4"
- ["Title"]=>
- string(8) "Title..."
-}
diff --git a/ext/exif/tests/exif005.phpt b/ext/exif/tests/exif005.phpt
deleted file mode 100644
index c1804e0b50..0000000000
--- a/ext/exif/tests/exif005.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Check for exif_read_data, unusual IFD start
---SKIPIF--
-<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
---INI--
-output_handler=
-zlib.output_compression=0
---FILE--
-<?php
-/* Do not change this test it is a REATME.TESTING example.
- * test5.jpg is a 1*1 image that contains an Exif section with ifd = 00000009h
- */
-$image = exif_read_data(dirname(__FILE__).'/test5.jpg','',true,false);
-var_dump($image['IFD0']);
-?>
---EXPECT--
-array(2) {
- ["ImageDescription"]=>
- string(11) "Ifd00000009"
- ["DateTime"]=>
- string(19) "2002:10:18 20:06:00"
-} \ No newline at end of file
diff --git a/ext/exif/tests/exif006.phpt b/ext/exif/tests/exif006.phpt
deleted file mode 100644
index bad74ee4fa..0000000000
--- a/ext/exif/tests/exif006.phpt
+++ /dev/null
@@ -1,89 +0,0 @@
---TEST--
-Check for exif_read_data, magic_quotes_runtime
---SKIPIF--
-<?php
- if (!extension_loaded('exif')) die('skip exif extension not available');
- if (version_compare(PHP_VERSION, "4.4.0-dev", "<")) die('skip PHP 4.4 required');
-?>
---INI--
-output_handler=
-zlib.output_compression=0
-magic_quotes_runtime=1
---FILE--
-<?php
-/*
- test1.jpg is a 1*1 image that does not contain any Exif/Comment information
- test2.jpg is the same image but contains Exif/Comment information and a
- copy of test1.jpg as a thumbnail.
- test6.jpg is the same as test2.jpg but with a UNICODE UserComment: &Auml;&Ouml;&&Uuml;&szlig;&auml;&ouml;&uuml;
-*/
-var_dump(exif_read_data(dirname(__FILE__).'/test6.jpg','',true,false));
-?>
---EXPECTF--
-array(5) {
- ["FILE"]=>
- array(6) {
- ["FileName"]=>
- string(9) "test6.jpg"
- ["FileDateTime"]=>
- int(%d)
- ["FileSize"]=>
- int(1240)
- ["FileType"]=>
- int(2)
- ["MimeType"]=>
- string(10) "image/jpeg"
- ["SectionsFound"]=>
- string(33) "ANY_TAG, IFD0, THUMBNAIL, COMMENT"
- }
- ["COMPUTED"]=>
- array(12) {
- ["html"]=>
- string(24) "width=\"1\" height=\"1\""
- ["Height"]=>
- int(1)
- ["Width"]=>
- int(1)
- ["IsColor"]=>
- int(1)
- ["ByteOrderMotorola"]=>
- int(1)
- ["UserComment"]=>
- string(16) "Hallo \'Du\'+da!"
- ["UserCommentEncoding"]=>
- string(5) "ASCII"
- ["Copyright"]=>
- string(45) "Photo \"M. Boerger\"., Edited \'M. Boerger\'."
- ["Copyright.Photographer"]=>
- string(21) "Photo \"M. Boerger\"."
- ["Copyright.Editor"]=>
- string(22) "Edited \'M. Boerger\'."
- ["Thumbnail.FileType"]=>
- int(2)
- ["Thumbnail.MimeType"]=>
- string(10) "image/jpeg"
- }
- ["IFD0"]=>
- array(2) {
- ["Copyright"]=>
- string(21) "Photo \"M. Boerger\"."
- ["UserComment"]=>
- string(5) "ASCII"
- }
- ["THUMBNAIL"]=>
- array(2) {
- ["JPEGInterchangeFormat"]=>
- int(134)
- ["JPEGInterchangeFormatLength"]=>
- int(523)
- }
- ["COMMENT"]=>
- array(3) {
- [0]=>
- string(13) "Comment \"1\""
- [1]=>
- string(13) "Comment \'2\'"
- [2]=>
- string(13) "Comment #3end"
- }
-}
diff --git a/ext/exif/tests/test1.jpg b/ext/exif/tests/test1.jpg
deleted file mode 100644
index 121decb65a..0000000000
--- a/ext/exif/tests/test1.jpg
+++ /dev/null
Binary files differ
diff --git a/ext/exif/tests/test2.jpg b/ext/exif/tests/test2.jpg
deleted file mode 100644
index f60ecded6f..0000000000
--- a/ext/exif/tests/test2.jpg
+++ /dev/null
Binary files differ
diff --git a/ext/exif/tests/test3.jpg b/ext/exif/tests/test3.jpg
deleted file mode 100644
index 7547a16630..0000000000
--- a/ext/exif/tests/test3.jpg
+++ /dev/null
Binary files differ
diff --git a/ext/exif/tests/test4.jpg b/ext/exif/tests/test4.jpg
deleted file mode 100644
index 8a23a7b658..0000000000
--- a/ext/exif/tests/test4.jpg
+++ /dev/null
Binary files differ
diff --git a/ext/exif/tests/test5.jpg b/ext/exif/tests/test5.jpg
deleted file mode 100644
index d03cac18a3..0000000000
--- a/ext/exif/tests/test5.jpg
+++ /dev/null
Binary files differ
diff --git a/ext/exif/tests/test6.jpg b/ext/exif/tests/test6.jpg
deleted file mode 100644
index 073cefdfe0..0000000000
--- a/ext/exif/tests/test6.jpg
+++ /dev/null
Binary files differ
diff --git a/ext/ext_skel b/ext/ext_skel
deleted file mode 100755
index 3abf341bdf..0000000000
--- a/ext/ext_skel
+++ /dev/null
@@ -1,284 +0,0 @@
-#!/bin/sh
-
-givup() {
- echo $*
- exit 1
-}
-
-usage() {
-echo "$0 --extname=module [--proto=file] [--stubs=file] [--xml[=file]]"
-echo " [--skel=dir] [--full-xml] [--no-help]"
-echo ""
-echo " --extname=module module is the name of your extension"
-echo " --proto=file file contains prototypes of functions to create"
-echo " --stubs=file generate only function stubs in file"
-echo " --xml generate xml documentation to be added to phpdoc-cvs"
-echo " --skel=dir path to the skeleton directory"
-echo " --full-xml generate xml documentation for a self-contained extension"
-echo " (not yet implemented)"
-echo " --no-help don't try to be nice and create comments in the code"
-echo " and helper functions to test if the module compiled"
-exit 1
-}
-
-if test $# = 0; then
- usage
-fi
-
-while test $# -gt 0; do
- case "$1" in
- -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- case $1 in
- --extname=?*)
- extname=$optarg
- EXTNAME=`echo $extname | tr "[:lower:]" "[:upper:]"`
- ;;
- --proto=?*)
- proto=$optarg
- ;;
- --stubs=*)
- stubs=yes
- stubfile=$optarg
- ;;
- --xml)
- xml="yes"
- ;;
- --xml=?*)
- xml=$optarg
- ;;
- --full-xml)
- full_xml="yes"
- ;;
- --no-help)
- no_help="yes"
- ;;
- --skel=?*)
- skel_dir=$optarg
- ;;
- *)
- usage
- ;;
- esac
- shift
-done
-
-if test -d "$extname" ; then
- givup "Directory $extname already exists."
-fi
-
-if test -z "$skel_dir"; then
- skel_dir="skeleton"
-fi
-
-## convert skel_dir to full path
-skel_dir=`cd $skel_dir && pwd`
-
-test -d $skel_dir || givup "directory $skel_dir does not exist or is not directory"
-
-if echo '\c' | grep -s c >/dev/null 2>&1
-then
- ECHO_N="echo -n"
- ECHO_C=""
-else
- ECHO_N="echo"
- ECHO_C='\c'
-fi
-
-if test -z "$stubs"; then
- echo "Creating directory $extname"
- stubfile=$extname"/function_stubs"
- mkdir $extname || givup "Cannot create directory $extname"
-fi
-
-if test -n "$proto"; then
- cat $proto | awk -v extname=$extname -v stubs=$stubs -v stubfile=$stubfile -v xml=$xml -v full_xml=$full_xml -v i_know_what_to_do_shut_up_i_dont_need_your_help_mode=$no_help -f $skel_dir/create_stubs
-fi
-
-if test -z "$stubs"; then
- cd $extname
- chmod 755 .
-
-$ECHO_N "Creating basic files:$ECHO_C"
-
-$ECHO_N " config.m4$ECHO_C"
-cat >config.m4 <<eof
-dnl \$Id\$
-dnl config.m4 for extension $extname
-
-dnl Comments in this file start with the string 'dnl'.
-dnl Remove where necessary. This file will not work
-dnl without editing.
-
-dnl If your extension references something external, use with:
-
-dnl PHP_ARG_WITH($extname, for $extname support,
-dnl Make sure that the comment is aligned:
-dnl [ --with-$extname Include $extname support])
-
-dnl Otherwise use enable:
-
-dnl PHP_ARG_ENABLE($extname, whether to enable $extname support,
-dnl Make sure that the comment is aligned:
-dnl [ --enable-$extname Enable $extname support])
-
-if test "\$PHP_$EXTNAME" != "no"; then
- dnl Write more examples of tests here...
-
- dnl # --with-$extname -> check with-path
- dnl SEARCH_PATH="/usr/local /usr" # you might want to change this
- dnl SEARCH_FOR="/include/$extname.h" # you most likely want to change this
- dnl if test -r \$PHP_$EXTNAME/\$SEARCH_FOR; then # path given as parameter
- dnl ${EXTNAME}_DIR=\$PHP_$EXTNAME
- dnl else # search default path list
- dnl AC_MSG_CHECKING([for $extname files in default path])
- dnl for i in \$SEARCH_PATH ; do
- dnl if test -r \$i/\$SEARCH_FOR; then
- dnl ${EXTNAME}_DIR=\$i
- dnl AC_MSG_RESULT(found in \$i)
- dnl fi
- dnl done
- dnl fi
- dnl
- dnl if test -z "\$${EXTNAME}_DIR"; then
- dnl AC_MSG_RESULT([not found])
- dnl AC_MSG_ERROR([Please reinstall the $extname distribution])
- dnl fi
-
- dnl # --with-$extname -> add include path
- dnl PHP_ADD_INCLUDE(\$${EXTNAME}_DIR/include)
-
- dnl # --with-$extname -> check for lib and symbol presence
- dnl LIBNAME=$extname # you may want to change this
- dnl LIBSYMBOL=$extname # you most likely want to change this
-
- dnl PHP_CHECK_LIBRARY(\$LIBNAME,\$LIBSYMBOL,
- dnl [
- dnl PHP_ADD_LIBRARY_WITH_PATH(\$LIBNAME, \$${EXTNAME}_DIR/lib, ${EXTNAME}_SHARED_LIBADD)
- dnl AC_DEFINE(HAVE_${EXTNAME}LIB,1,[ ])
- dnl ],[
- dnl AC_MSG_ERROR([wrong $extname lib version or lib not found])
- dnl ],[
- dnl -L\$${EXTNAME}_DIR/lib -lm -ldl
- dnl ])
- dnl
- dnl PHP_SUBST(${EXTNAME}_SHARED_LIBADD)
-
- PHP_NEW_EXTENSION($extname, $extname.c, \$ext_shared)
-fi
-eof
-
-
-$ECHO_N " .cvsignore$ECHO_C"
-cat >.cvsignore <<eof
-.deps
-*.lo
-*.la
-eof
-
-$ECHO_N " $extname.c$ECHO_C"
-echo "s/extname/$extname/g" > sedscript
-echo "s/EXTNAME/$EXTNAME/g" >> sedscript
-echo '/__function_entries_here__/r function_entries' >> sedscript
-echo '/__function_stubs_here__/r function_stubs' >> sedscript
-echo '/__header_here__/r ../../header' >> sedscript
-echo '/__footer_here__/r ../../footer' >> sedscript
-echo '/__function_entries_here__/D' >> sedscript
-echo '/__function_stubs_here__/D' >> sedscript
-echo '/__header_here__/D' >> sedscript
-echo '/__footer_here__/D' >> sedscript
-if [ ! -z "$no_help" ]; then
- echo "/confirm_$extname_compiled/D" >> sedscript
- echo '/Remove the following/,/^\*\//D' >> sedscript
- echo 's/[[:space:]]\/\*.\+\*\///' >> sedscript
- echo 's/^\/\*.*\*\/$//' >> sedscript
- echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D' >> sedscript
-fi
-
-sed -f sedscript < $skel_dir/skeleton.c > $extname.c
-
-
-$ECHO_N " php_$extname.h$ECHO_C"
-echo "s/extname/$extname/g" > sedscript
-echo "s/EXTNAME/$EXTNAME/g" >> sedscript
-echo '/__function_declarations_here__/r function_declarations' >> sedscript
-echo '/__header_here__/r ../../header' >> sedscript
-echo '/__footer_here__/r ../../footer' >> sedscript
-echo '/__function_declarations_here__/D' >> sedscript
-echo '/__header_here__/D' >> sedscript
-echo '/__footer_here__/D' >> sedscript
-if [ ! -z "$no_help" ]; then
- echo "/confirm_$extname_compiled/D" >> sedscript
- echo 's/[[:space:]]\/\*.\+\*\///' >> sedscript
- echo 's/^\/\*.*\*\/$//' >> sedscript
- echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D' >> sedscript
-fi
-sed -f sedscript <$skel_dir/php_skeleton.h > php_$extname.h
-
-$ECHO_N " CREDITS$ECHO_C"
-echo "s/extname/$extname/g" > sedscript
-sed -f sedscript <$skel_dir/CREDITS > CREDITS
-
-$ECHO_N " EXPERIMENTAL$ECHO_C"
-echo "s/extname/$extname/g" > sedscript
-sed -f sedscript <$skel_dir/EXPERIMENTAL > EXPERIMENTAL
-
-$ECHO_N " tests/001.phpt$ECHO_C"
-mkdir tests || givup "Cannot create tests directory"
-chmod 755 tests
-sed -f sedscript <$skel_dir/tests/001.phpt > tests/001.phpt
-
-if test -z "$stubs" && test -z "$no_help"; then
- $ECHO_N " $extname.php$ECHO_C"
- sed \
- -e "s/extname/$extname/g" \
- <$skel_dir/skeleton.php \
- > $extname.php
-fi
-
-rm sedscript
-
-if test -n "$proto"; then
- if test -z "$stubs"; then
- rm function_entries
- rm function_declarations
- rm function_stubs
- fi
- if test -f function_warning; then
- rm function_warning
- warning="
-NOTE! Because some arguments to functions were resources, the code generated
-cannot yet be compiled without editing. Please consider this to be step 4.5
-in the instructions above.
-"
- fi
-fi
-
-find . -type f | xargs chmod 644
-find . -type d | xargs chmod 755
-fi
-
-echo " [done]."
-
-if test -z "$no_help" && test -z "$stubs"; then
- cat <<eof
-
-To use your new extension, you will have to execute the following steps:
-
-1. $ cd ..
-2. $ vi ext/$extname/config.m4
-3. $ ./buildconf
-4. $ ./configure --[with|enable]-$extname
-5. $ make
-6. $ ./php -f ext/$extname/$extname.php
-7. $ vi ext/$extname/$extname.c
-8. $ make
-
-Repeat steps 3-6 until you are satisfied with ext/$extname/config.m4 and
-step 6 confirms that your module is compiled into PHP. Then, start writing
-code and repeat the last two steps as often as necessary.
-$warning
-eof
-fi
diff --git a/ext/ext_skel_win32.php b/ext/ext_skel_win32.php
deleted file mode 100644
index 5036ad21d8..0000000000
--- a/ext/ext_skel_win32.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/* $Id$ */
-
-if (php_sapi_name() != "cli") {
- echo "Please run this script using the CLI version of PHP\n";
- exit;
-}
-/*
- This script can be used on Win32 systems
-
- 1) Make sure you have CygWin installed
- 2) Adjust the $cygwin_path to match your installation
- 3) Change the environment cariable PATHEXT to include .PHP
- 4) run ext_skel --ext_name=...
- the first time you run this script you will be asked to
- associate it with a program. chooses the CLI version of php.
-*/
-
-$cygwin_path = 'c:\cygwin\bin';
-
-$path = getenv("PATH");
-putenv("PATH=$cygwin_path;$path");
-
-array_shift($argv);
-system("sh ext_skel " . implode(" ", $argv));
-
-$extname = "";
-$skel = "skeleton";
-foreach($argv as $arg) {
- if (strtolower(substr($arg, 0, 9)) == "--extname") {
- $extname = substr($arg, 10);
- }
- if (strtolower(substr($arg, 0, 6)) == "--skel") {
- $skel = substr($arg, 7);
- }
-}
-
-$fp = fopen("$skel/skeleton.dsp", "rb");
-if ($fp) {
- $dsp_file = fread($fp, filesize("$skel/skeleton.dsp"));
- fclose($fp);
-
- $dsp_file = str_replace("extname", $extname, $dsp_file);
- $dsp_file = str_replace("EXTNAME", strtoupper($extname), $dsp_file);
- $fp = fopen("$extname/$extname.dsp", "wb");
- if ($fp) {
- fwrite($fp, $dsp_file);
- fclose($fp);
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/fam/CREDITS b/ext/fam/CREDITS
deleted file mode 100644
index 60e3234a4c..0000000000
--- a/ext/fam/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-fam
-Sascha Schumann
diff --git a/ext/fam/config.m4 b/ext/fam/config.m4
deleted file mode 100644
index ebbd0e4db1..0000000000
--- a/ext/fam/config.m4
+++ /dev/null
@@ -1,56 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension fam
-
-dnl Comments in this file start with the string 'dnl'.
-dnl Remove where necessary. This file will not work
-dnl without editing.
-
-dnl If your extension references something external, use with:
-
-PHP_ARG_WITH(fam, for fam support,
-[ --with-fam Include fam support])
-
-if test "$PHP_FAM" != "no"; then
- dnl Write more examples of tests here...
-
- dnl # --with-fam -> check with-path
-SEARCH_PATH="/usr/local /usr" # you might want to change this
-SEARCH_FOR="/include/fam.h" # you most likely want to change this
-if test -r $PHP_FAM/$SEARCH_FOR; then # path given as parameter
- FAM_DIR=$PHP_FAM
-else # search default path list
- AC_MSG_CHECKING([for fam files in default path])
- for i in $SEARCH_PATH ; do
- if test -r $i/$SEARCH_FOR; then
- FAM_DIR=$i
- AC_MSG_RESULT(found in $i)
- fi
- done
-fi
-
-if test -z "$FAM_DIR"; then
- AC_MSG_RESULT([not found])
- AC_MSG_ERROR([Please reinstall the fam distribution])
-fi
-
-# --with-fam -> add include path
-PHP_ADD_INCLUDE($FAM_DIR/include)
-
-# --with-fam -> chech for lib and symbol presence
-LIBNAME=fam # you may want to change this
-LIBSYMBOL=FAMOpen # you most likely want to change this
-
-PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
-[
- PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $FAM_DIR/lib, FAM_SHARED_LIBADD)
- AC_DEFINE(HAVE_FAMLIB,1,[ ])
-],[
- AC_MSG_ERROR([wrong fam lib version or lib not found])
-],[
- -L$FAM_DIR/lib -lm -ldl
-])
-
-PHP_SUBST(FAM_SHARED_LIBADD)
-
- PHP_NEW_EXTENSION(fam, fam.c, $ext_shared)
-fi
diff --git a/ext/fam/fam.c b/ext/fam/fam.c
deleted file mode 100644
index f225dcc44e..0000000000
--- a/ext/fam/fam.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-
- $Id$
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_fam.h"
-
-#include <fam.h>
-
-/* If you declare any globals in php_fam.h uncomment this:
-ZEND_DECLARE_MODULE_GLOBALS(fam)
-*/
-
-/* True global resources - no need for thread safety here */
-static int le_fam, le_fam_r;
-
-/* {{{ fam_functions[]
- *
- * Every user visible function must have an entry in fam_functions[].
- */
-function_entry fam_functions[] = {
- PHP_FE(fam_open, NULL)
- PHP_FE(fam_close, NULL)
- PHP_FE(fam_monitor_directory, NULL)
- PHP_FE(fam_monitor_file, NULL)
- PHP_FE(fam_monitor_collection, NULL)
- PHP_FE(fam_suspend_monitor, NULL)
- PHP_FE(fam_resume_monitor, NULL)
- PHP_FE(fam_cancel_monitor, NULL)
- PHP_FE(fam_pending, NULL)
- PHP_FE(fam_next_event, NULL)
- {NULL, NULL, NULL} /* Must be the last line in fam_functions[] */
-};
-/* }}} */
-
-/* {{{ fam_module_entry
- */
-zend_module_entry fam_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
- "fam",
- fam_functions,
- PHP_MINIT(fam),
- PHP_MSHUTDOWN(fam),
- PHP_RINIT(fam), /* Replace with NULL if there's nothing to do at request start */
- PHP_RSHUTDOWN(fam), /* Replace with NULL if there's nothing to do at request end */
- PHP_MINFO(fam),
-#if ZEND_MODULE_API_NO >= 20010901
- "0.1", /* Replace with version number for your extension */
-#endif
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_FAM
-ZEND_GET_MODULE(fam)
-#endif
-
-/* {{{ PHP_INI
- */
-/* Remove comments and fill if you need to have entries in php.ini
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("fam.global_value", "42", PHP_INI_ALL, OnUpdateLong, global_value, zend_fam_globals, fam_globals)
- STD_PHP_INI_ENTRY("fam.global_string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_fam_globals, fam_globals)
-PHP_INI_END()
-*/
-/* }}} */
-
-/* {{{ php_fam_init_globals
- */
-/* Uncomment this function if you have INI entries
-static void php_fam_init_globals(zend_fam_globals *fam_globals)
-{
- fam_globals->global_value = 0;
- fam_globals->global_string = NULL;
-}
-*/
-/* }}} */
-
-static void rsrc_close_fam(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- FAMConnection *fc = (FAMConnection *) rsrc->ptr;
- FAMClose(fc);
- efree(fc);
-}
-
-static void rsrc_close_fam_r(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- /* No need to close */
- efree(rsrc->ptr);
-}
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(fam)
-{
- le_fam = zend_register_list_destructors_ex(rsrc_close_fam, NULL, "fam connections", module_number);
- le_fam_r = zend_register_list_destructors_ex(rsrc_close_fam_r, NULL, "fam requests", module_number);
- /* If you have INI entries, uncomment these lines
- ZEND_INIT_MODULE_GLOBALS(fam, php_fam_init_globals, NULL);
- REGISTER_INI_ENTRIES();
- */
-
-
- REGISTER_LONG_CONSTANT("FAMChanged", FAMChanged, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FAMDeleted", FAMDeleted, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FAMStartExecuting", FAMStartExecuting, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FAMStopExecuting", FAMStopExecuting, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FAMCreated", FAMCreated, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FAMMoved", FAMMoved, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FAMAcknowledge", FAMAcknowledge, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FAMExists", FAMExists, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FAMEndExist", FAMEndExist, CONST_PERSISTENT);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(fam)
-{
- /* uncomment this line if you have INI entries
- UNREGISTER_INI_ENTRIES();
- */
- return SUCCESS;
-}
-/* }}} */
-
-/* Remove if there's nothing to do at request start */
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(fam)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* Remove if there's nothing to do at request end */
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(fam)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(fam)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "fam support", "enabled");
- php_info_print_table_end();
-
- /* Remove comments if you have entries in php.ini
- DISPLAY_INI_ENTRIES();
- */
-}
-/* }}} */
-
-
-/* {{{ proto int fam_open([string appname])
- */
-PHP_FUNCTION(fam_open)
-{
- char *appname = NULL;
- int argc = ZEND_NUM_ARGS();
- int appname_len;
- FAMConnection *fc;
- int r;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "|s", &appname, &appname_len) == FAILURE)
- return;
-
- fc = emalloc(sizeof *fc);
- r = FAMOpen2(fc, appname);
-
- if (r < 0) {
- efree(fc);
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, fc, le_fam);
-}
-/* }}} */
-
-/* {{{ proto boolean fam_close(resource id)
- */
-PHP_FUNCTION(fam_close)
-{
- int argc = ZEND_NUM_ARGS();
- zval *id;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "r", &id) == FAILURE)
- return;
-
- zend_list_delete(Z_RESVAL_P(id));
-}
-/* }}} */
-
-/* {{{ proto int fam_monitor_directory(resource id, string dirname)
- */
-PHP_FUNCTION(fam_monitor_directory)
-{
- char *dirname = NULL;
- int argc = ZEND_NUM_ARGS();
- int dirname_len;
- zval *id;
- FAMRequest *fr;
- FAMConnection *fc;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "rs", &id, &dirname, &dirname_len) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(fc, FAMConnection *, &id, -1, "fam", le_fam);
- ZEND_VERIFY_RESOURCE(fc);
-
- fr = emalloc(sizeof *fr);
-
- if (FAMMonitorDirectory(fc, dirname, fr, NULL) < 0) {
- efree(fr);
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, fr, le_fam_r);
-}
-/* }}} */
-
-/* {{{ proto int fam_monitor_file(resource id, string filename)
- */
-PHP_FUNCTION(fam_monitor_file)
-{
- char *filename = NULL;
- int argc = ZEND_NUM_ARGS();
- int filename_len;
- zval *id;
- FAMRequest *fr;
- FAMConnection *fc;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "rs", &id, &filename, &filename_len) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(fc, FAMConnection *, &id, -1, "fam", le_fam);
- ZEND_VERIFY_RESOURCE(fc);
-
- fr = emalloc(sizeof *fr);
-
- if (FAMMonitorFile(fc, filename, fr, NULL) < 0) {
- efree(fr);
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, fr, le_fam_r);
-}
-/* }}} */
-
-/* {{{ proto int fam_monitor_collection(resource id, string dirname, int depth, string mask)
- */
-PHP_FUNCTION(fam_monitor_collection)
-{
- char *dirname = NULL;
- char *mask = NULL;
- int argc = ZEND_NUM_ARGS();
- int dirname_len;
- int mask_len;
- zval *id;
- long depth;
- FAMRequest *fr;
- FAMConnection *fc;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "rsls", &id, &dirname, &dirname_len, &depth, &mask, &mask_len) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(fc, FAMConnection *, &id, -1, "fam", le_fam);
- ZEND_VERIFY_RESOURCE(fc);
-
- fr = emalloc(sizeof *fr);
-
- if (FAMMonitorCollection(fc, dirname, fr, NULL, depth, mask) < 0) {
- efree(fr);
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, fr, le_fam_r);
-
-}
-/* }}} */
-
-/* {{{ proto boolean fam_suspend_monitor(resource id, resource monitor_id)
- */
-PHP_FUNCTION(fam_suspend_monitor)
-{
- int argc = ZEND_NUM_ARGS();
- zval *id;
- zval *monitor_id;
- FAMRequest *fr;
- FAMConnection *fc;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "rr", &id, &monitor_id) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(fc, FAMConnection *, &id, -1, "fam", le_fam);
- ZEND_VERIFY_RESOURCE(fc);
- ZEND_FETCH_RESOURCE(fr, FAMRequest *, &monitor_id, -1, "fam", le_fam_r);
- ZEND_VERIFY_RESOURCE(fr);
-
- if (FAMSuspendMonitor(fc, fr) < 0)
- RETURN_FALSE;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto boolean fam_resume_monitor(resource id, resource monitor_id)
- */
-PHP_FUNCTION(fam_resume_monitor)
-{
- int argc = ZEND_NUM_ARGS();
- zval *id;
- zval *monitor_id;
- FAMRequest *fr;
- FAMConnection *fc;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "rr", &id, &monitor_id) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(fc, FAMConnection *, &id, -1, "fam", le_fam);
- ZEND_VERIFY_RESOURCE(fc);
- ZEND_FETCH_RESOURCE(fr, FAMRequest *, &monitor_id, -1, "fam", le_fam_r);
- ZEND_VERIFY_RESOURCE(fr);
-
- if (FAMResumeMonitor(fc, fr) < 0)
- RETURN_FALSE;
- RETURN_TRUE;
-
-}
-/* }}} */
-
-/* {{{ proto boolean fam_cancel_monitor(resource id, resource monitor_id)
- */
-PHP_FUNCTION(fam_cancel_monitor)
-{
- int argc = ZEND_NUM_ARGS();
- zval *id;
- zval *monitor_id;
- FAMRequest *fr;
- FAMConnection *fc;
- int r;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "rr", &id, &monitor_id) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(fc, FAMConnection *, &id, -1, "fam", le_fam);
- ZEND_VERIFY_RESOURCE(fc);
- ZEND_FETCH_RESOURCE(fr, FAMRequest *, &monitor_id, -1, "fam", le_fam_r);
- ZEND_VERIFY_RESOURCE(fr);
-
- r = FAMCancelMonitor(fc, fr);
-
- zend_list_delete(Z_RESVAL_P(monitor_id));
-
- if (r < 0)
- RETURN_FALSE;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int fam_pending(resource id)
- */
-PHP_FUNCTION(fam_pending)
-{
- int argc = ZEND_NUM_ARGS();
- zval *id;
- FAMConnection *fc;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "r", &id) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(fc, FAMConnection *, &id, -1, "fam", le_fam);
- ZEND_VERIFY_RESOURCE(fc);
-
- RETVAL_LONG(FAMPending(fc));
-}
-/* }}} */
-
-/* {{{ proto array fam_next_event(resource id)
- */
-PHP_FUNCTION(fam_next_event)
-{
- int argc = ZEND_NUM_ARGS();
- zval *id;
- FAMConnection *fc;
- FAMEvent fe;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "r", &id) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(fc, FAMConnection *, &id, -1, "fam", le_fam);
- ZEND_VERIFY_RESOURCE(fc);
-
- if (FAMNextEvent(fc, &fe) < 0)
- RETURN_FALSE;
-
- array_init(return_value);
- if (fe.hostname)
- add_assoc_string(return_value, "hostname", fe.hostname, 1);
- add_assoc_string(return_value, "filename", fe.filename, 1);
- add_assoc_long(return_value, "code", fe.code);
-}
-/* }}} */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/fam/php_fam.h b/ext/fam/php_fam.h
deleted file mode 100644
index fbc30bd638..0000000000
--- a/ext/fam/php_fam.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-
- $Id$
-*/
-
-#ifndef PHP_FAM_H
-#define PHP_FAM_H
-
-extern zend_module_entry fam_module_entry;
-#define phpext_fam_ptr &fam_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_FAM_API __declspec(dllexport)
-#else
-#define PHP_FAM_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-PHP_MINIT_FUNCTION(fam);
-PHP_MSHUTDOWN_FUNCTION(fam);
-PHP_RINIT_FUNCTION(fam);
-PHP_RSHUTDOWN_FUNCTION(fam);
-PHP_MINFO_FUNCTION(fam);
-
-PHP_FUNCTION(fam_open);
-PHP_FUNCTION(fam_close);
-PHP_FUNCTION(fam_monitor_directory);
-PHP_FUNCTION(fam_monitor_file);
-PHP_FUNCTION(fam_monitor_collection);
-PHP_FUNCTION(fam_suspend_monitor);
-PHP_FUNCTION(fam_resume_monitor);
-PHP_FUNCTION(fam_cancel_monitor);
-PHP_FUNCTION(fam_pending);
-PHP_FUNCTION(fam_next_event);
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-
-ZEND_BEGIN_MODULE_GLOBALS(fam)
- int global_value;
- char *global_string;
-ZEND_END_MODULE_GLOBALS(fam)
-*/
-
-/* In every utility function you add that needs to use variables
- in php_fam_globals, call TSRM_FETCH(); after declaring other
- variables used by that function, or better yet, pass in TSRMLS_CC
- after the last function argument and declare your utility function
- with TSRMLS_DC after the last declared argument. Always refer to
- the globals in your function as FAM_G(variable). You are
- encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define FAM_G(v) TSRMG(fam_globals_id, zend_fam_globals *, v)
-#else
-#define FAM_G(v) (fam_globals.v)
-#endif
-
-#endif /* PHP_FAM_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/fbsql/CREDITS b/ext/fbsql/CREDITS
deleted file mode 100644
index 3500fdc89e..0000000000
--- a/ext/fbsql/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-FBSQL
-Frank M. Kromann
diff --git a/ext/fbsql/Readme_w32.txt b/ext/fbsql/Readme_w32.txt
deleted file mode 100644
index af8bfdc1e9..0000000000
--- a/ext/fbsql/Readme_w32.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-Rules for building FBSQL
-------------------------
-
-The fbsql project contains 2 configurations.
-
-To build this extension you must first download and
-install FrontBase. The default instalation path would
-be c:\usr\FrontBase. If you install it in another location
-you need to change the include path in the project before
-compiling.
-
-Start Visual Studio, load php_modules.dsw, select the fbsql projects,
-configuration and build it.
-
-Finaly copy php_fbsql.dll to your extension directory and enable it
-by adding the following line tp php.ini
-
-extension=php_fbsql.dll
-
-or by calling dl() in each script
-
-dl("php_fbsql.dll"); \ No newline at end of file
diff --git a/ext/fbsql/config.m4 b/ext/fbsql/config.m4
deleted file mode 100644
index 14360ce8b2..0000000000
--- a/ext/fbsql/config.m4
+++ /dev/null
@@ -1,43 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(fbsql, for FrontBase SQL92 (fbsql) support,
-[ --with-fbsql[=DIR] Include FrontBase support. DIR is the FrontBase base directory.])
-
-if test "$PHP_FBSQL" != "no"; then
-
- AC_DEFINE(HAVE_FBSQL, 1, [Whether you have FrontBase])
- PHP_NEW_EXTENSION(fbsql, php_fbsql.c, $ext_shared)
-
- FBSQL_INSTALLATION_DIR=""
- if test "$PHP_FBSQL" = "yes"; then
-
- for i in /Local/Library /usr /usr/local /opt /Library /usr/lib; do
- if test -f $i/FrontBase/include/FBCAccess/FBCAccess.h; then
- FBSQL_INSTALLATION_DIR=$i/FrontBase
- break
- fi
- done
-
- if test -z "$FBSQL_INSTALLATION_DIR"; then
- AC_MSG_ERROR(Cannot find FrontBase in known installation directories)
- fi
-
- elif test "$PHP_FBSQL" != "no"; then
-
- if test -f $PHP_FBSQL/include/FBCAccess/FBCAccess.h; then
- FBSQL_INSTALLATION_DIR=$PHP_FBSQL
- else
- AC_MSG_ERROR(Directory $PHP_FBSQL is not a FrontBase installation directory)
- fi
- fi
-
- if test ! -r "$FBSQL_INSTALLATION_DIR/lib/libFBCAccess.a"; then
- AC_MSG_ERROR(Could not find $FBSQL_INSTALLATION_DIR/lib/libFBCAccess.a)
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(FBCAccess, $FBSQL_INSTALLATION_DIR/lib, FBSQL_SHARED_LIBADD)
- PHP_ADD_INCLUDE($FBSQL_INSTALLATION_DIR/include)
- PHP_SUBST(FBSQL_SHARED_LIBADD)
-fi
diff --git a/ext/fbsql/fbsql.dsp b/ext/fbsql/fbsql.dsp
deleted file mode 100644
index 83054c511d..0000000000
--- a/ext/fbsql/fbsql.dsp
+++ /dev/null
@@ -1,171 +0,0 @@
-# Microsoft Developer Studio Project File - Name="fbsql" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=fbsql - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "fbsql.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "fbsql.mak" CFG="fbsql - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "fbsql - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "fbsql - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "fbsql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "fbsql - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "fbsql - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FBSQL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "\usr\FrontBase\Include" /D "NDEBUG" /D "FBSQL_EXPORTS" /D "COMPILE_DL_FBSQL_FBSQL" /D HAVE_FBSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WinNT" /D ZEND_DEBUG=0 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4nts.lib /nologo /dll /machine:I386 /out:"Release/php_fbsql.dll" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "fbsql - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FBSQL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "\usr\FrontBase\Include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "FBSQL_EXPORTS" /D "COMPILE_DL_FBSQL_FBSQL" /D HAVE_FBSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WinNT" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4nts_debug.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_fbsql.dll" /pdbtype:sept /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "fbsql - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FBSQL_EXPORTS" /D "COMPILE_DL_FBSQL" /D HAVE_FBSQL=1 /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "\usr\FrontBase\Include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "FBSQL_EXPORTS" /D "COMPILE_DL_FBSQL" /D HAVE_FBSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WinNT" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4ts_debug.lib FBCAccess.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"LIBC" /out:"..\..\Debug_TS/php_fbsql.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"\usr\FrontBase\lib"
-
-!ELSEIF "$(CFG)" == "fbsql - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FBSQL_EXPORTS" /D "COMPILE_DL_FBSQL" /D HAVE_FBSQL=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "\usr\FrontBase\Include" /D "NDEBUG" /D ZTS=1 /D ZEND_DEBUG=0 /D "FBSQL_EXPORTS" /D "COMPILE_DL_FBSQL" /D HAVE_FBSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WinNT" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib FBCAccess.lib wsock32.lib /nologo /dll /machine:I386 /nodefaultlib:"LIBC" /out:"..\..\Release_TS/php_fbsql.dll" /libpath:"..\..\Release_TS" /libpath:"\usr\FrontBase\lib" /libpath:"..\..\Release_TS_inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "fbsql - Win32 Release"
-# Name "fbsql - Win32 Debug"
-# Name "fbsql - Win32 Debug_TS"
-# Name "fbsql - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_fbsql.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_fbsql.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\Readme_w32.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/fbsql/php_fbsql.c b/ext/fbsql/php_fbsql.c
deleted file mode 100644
index 96cbdb3eac..0000000000
--- a/ext/fbsql/php_fbsql.c
+++ /dev/null
@@ -1,3536 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http:/*www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Frank M. Kromann <frank@frontbase.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* TODO:
- *
- * ? Safe mode implementation
- */
-
-/* SB's list:
- - API for a more natural FB connect semantic
- - Connect & set session
- - Autoreconnect when disconnected
- - Comments and cleanup
-
- BUGS
- - Select db with no arguments
- - Query with everything defaulted
-*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-
-#ifdef PHP_WIN32
-#include <winsock2.h>
-#else
-#include <php_config.h>
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#include <netdb.h>
-#include <netinet/in.h>
-#endif
-
-#include "php_ini.h"
-
-#define HAVE_FBSQL 1
-
-#if HAVE_FBSQL
-#include "php_fbsql.h"
-#include <signal.h>
-
-static int le_result, le_link, le_plink;
-
-struct PHPFBResult;
-typedef struct PHPFBResult PHPFBResult;
-
-struct PHPFBLink;
-typedef struct PHPFBLink PHPFBLink;
-
-/* The PHPFBLink structure represents a fbsql link. The lion is used for
- a connection to a machine, it may be persistent and is reference counted.
- The reason for refcounting is mostly to avoid to think, it work independent of
- any wierd and unforseen allocation deallocation order.
-
- The PHPFBDatabse structure implements to actual connection to a FrontBase server
- ot may be persistent is the link it is connected to is persistent, and refcounted
- for the same reasons as above.
-
- The PHPFBResult structure implements a result from the FrontBase server, and does all
- required buffereing from of results.
-
- In the PHP code the 3 above a data structures are referenced by means of integers in the
- range from 1 to som configurable maximum. You can put a limit to the number of links, databases
- and results. The integer identifications is implemented by insertion in the list, which is passed
- as an argument to all the functions, please note the list is polymorph.
-
- Database objects and link objects are all reused, base on the host name user name, host name database name
- user name. So connecting twice to the same database as the same user will return the same database id.
- We use the same coding for that as fbsql does, explioiting the underlying implementation of the lists.
-
- Persistent objects are put in the persistent list as well, but only by name, if you connect to a persistent object
- and it is not in the list it is simply added and get a new index, and refcounted. Tricky, tricky ...
-*/
-
-/* Some functions which should be exported from FBCAccess */
-
-void* fbaObjectAtIndex();
-void fbaRelease();
-unsigned int fbaCount();
-
-struct FBCAutoStartInfo {
- FBArray* infoLines;
-};
-
-
-
-struct PHPFBResult
-{
- PHPFBLink* link; /* The link for the result, may be NULL if no link */
- char* fetchHandle; /* The fetch handle, the id used by the server. */
- FBCMetaData* metaData; /* The metadata describing the result */
- FBCMetaData* ResultmetaData; /* The metadata describing the result */
- FBCRowHandler* rowHandler; /* The row handler, the Frontbase structure used for accessing rows in the result */
- unsigned int batchSize; /* The number of row to fetch when expanding the number of rows in the row handler */
- unsigned int rowCount; /* The number of rows in the results set. The number of row is not in */
- /* general known when the select is done, one typically needs to fetch all the row
- to figure out how many row you got. When the rowCount is unknown the value is
- 0x7ffffffff */
- int columnCount; /* Number of columns in the row set. */
- unsigned int rowIndex; /* The current row index. */
- int columnIndex; /* The current column index */
- void** row; /* The last row accessed */
- FBArray* array; /* The link may return a result set, the database list, we implement that by the */
- /* FBArray, just a list of strings. */
- FBCPList* list; /* The same special kind result just for property list from extract, schema info. */
- unsigned int selectResults; /* number of results in select */
- unsigned int currentResult; /* current result number */
- int lobMode; /* 0=Fetch data (default); 1=Fetch handle */
-};
-
-struct PHPFBLink
-{
- int persistent; /* persistent ? */
- char* hostName; /* Host name */
- char* userName; /* User name */
- char* userPassword; /* User password */
- char* databasePassword; /* Database password */
- char* databaseName; /* The name of the database */
- FBCExecHandler* execHandler; /* The exechandler, can be used for database operations */
- FBCDatabaseConnection* connection; /* The connection to the database */
- unsigned int affectedRows; /* Number of rows affected by the last SQL statement */
- long autoCommit; /* Enable or disable autoCommit */
- unsigned int errorNo; /* The latest error on the connection, 0 is ok. */
- char* errorText; /* The error text */
- unsigned int insert_id; /* The row index of the latest row inserted into the database */
-};
-
-#define FBSQL_ASSOC 1<<0
-#define FBSQL_NUM 1<<1
-#define FBSQL_BOTH (FBSQL_ASSOC|FBSQL_NUM)
-
-#define FBSQL_LOCK_DEFERRED 0
-#define FBSQL_LOCK_OPTIMISTIC 1
-#define FBSQL_LOCK_PESSIMISTIC 2 /* default */
-
-#define FBSQL_ISO_READ_UNCOMMITTED 0
-#define FBSQL_ISO_READ_COMMITTED 1
-#define FBSQL_ISO_REPEATABLE_READ 2
-#define FBSQL_ISO_SERIALIZABLE 3 /* default */
-#define FBSQL_ISO_VERSIONED 4
-
-#define FBSQL_LOB_DIRECT 0 /* default */
-#define FBSQL_LOB_HANDLE 1 /* default */
-
-
-/* {{{ fbsql_functions[]
- */
-function_entry fbsql_functions[] = {
- PHP_FE(fbsql_connect, NULL)
- PHP_FE(fbsql_pconnect, NULL)
- PHP_FE(fbsql_close, NULL)
- PHP_FE(fbsql_select_db, NULL)
- PHP_FE(fbsql_create_db, NULL)
- PHP_FE(fbsql_drop_db, NULL)
- PHP_FE(fbsql_start_db, NULL)
- PHP_FE(fbsql_stop_db, NULL)
- PHP_FE(fbsql_db_status, NULL)
- PHP_FE(fbsql_query, NULL)
- PHP_FE(fbsql_db_query, NULL)
- PHP_FE(fbsql_list_dbs, NULL)
- PHP_FE(fbsql_list_tables, NULL)
- PHP_FE(fbsql_list_fields, NULL)
- PHP_FE(fbsql_error, NULL)
- PHP_FE(fbsql_errno, NULL)
- PHP_FE(fbsql_affected_rows, NULL)
- PHP_FE(fbsql_insert_id, NULL)
- PHP_FE(fbsql_result, NULL)
- PHP_FE(fbsql_next_result, NULL)
- PHP_FE(fbsql_num_rows, NULL)
- PHP_FE(fbsql_num_fields, NULL)
- PHP_FE(fbsql_fetch_row, NULL)
- PHP_FE(fbsql_fetch_array, NULL)
- PHP_FE(fbsql_fetch_assoc, NULL)
- PHP_FE(fbsql_fetch_object, NULL)
- PHP_FE(fbsql_data_seek, NULL)
- PHP_FE(fbsql_fetch_lengths, NULL)
- PHP_FE(fbsql_fetch_field, NULL)
- PHP_FE(fbsql_field_seek, NULL)
- PHP_FE(fbsql_free_result, NULL)
- PHP_FE(fbsql_field_name, NULL)
- PHP_FE(fbsql_field_table, NULL)
- PHP_FE(fbsql_field_len, NULL)
- PHP_FE(fbsql_field_type, NULL)
- PHP_FE(fbsql_field_flags, NULL)
- PHP_FE(fbsql_table_name, NULL)
-
-/* Fontbase additions: */
- PHP_FE(fbsql_set_transaction, NULL)
- PHP_FE(fbsql_autocommit, NULL)
- PHP_FE(fbsql_commit, NULL)
- PHP_FE(fbsql_rollback, NULL)
-
- PHP_FE(fbsql_create_blob, NULL)
- PHP_FE(fbsql_create_clob, NULL)
- PHP_FE(fbsql_set_lob_mode, NULL)
- PHP_FE(fbsql_read_blob, NULL)
- PHP_FE(fbsql_read_clob, NULL)
- PHP_FE(fbsql_blob_size, NULL)
- PHP_FE(fbsql_clob_size, NULL)
-
- PHP_FE(fbsql_hostname, NULL)
- PHP_FE(fbsql_database, NULL)
- PHP_FE(fbsql_database_password, NULL)
- PHP_FE(fbsql_username, NULL)
- PHP_FE(fbsql_password, NULL)
- PHP_FE(fbsql_warnings, NULL)
-
- PHP_FE(fbsql_get_autostart_info, NULL)
-/* PHP_FE(fbsql_set_autostart_info, NULL) */
-
-/* Aliases: */
- PHP_FALIAS(fbsql, fbsql_db_query, NULL)
- PHP_FALIAS(fbsql_tablename, fbsql_table_name, NULL)
-
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry fbsql_module_entry = {
- STANDARD_MODULE_HEADER,
- "fbsql",
- fbsql_functions,
- PHP_MINIT(fbsql),
- PHP_MSHUTDOWN(fbsql),
- PHP_RINIT(fbsql),
- PHP_RSHUTDOWN(fbsql),
- PHP_MINFO(fbsql),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-ZEND_DECLARE_MODULE_GLOBALS(fbsql)
-
-#ifdef COMPILE_DL_FBSQL
-ZEND_GET_MODULE(fbsql)
-#endif
-
-#define CHECK_LINK(link) { \
- if (link==-1) { \
- if (FB_SQL_G(generateWarnings)) \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "A link to the server could not be established"); \
- RETURN_FALSE; \
- } \
-}
-
-static void phpfbReleaseResult (zend_rsrc_list_entry *rsrc TSRMLS_DC);
-static void phpfbReleaseLink (zend_rsrc_list_entry *rsrc TSRMLS_DC);
-static void phpfbReleasePLink (zend_rsrc_list_entry *rsrc TSRMLS_DC);
-
-static void phpfbReleaseResult(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- PHPFBResult* result = (PHPFBResult *)rsrc->ptr;
-
- if (result)
- {
- if (result->fetchHandle) {
- FBCMetaData *md = fbcdcCancelFetch(result->link->connection, result->fetchHandle);
- fbcmdRelease(md);
- }
- if (result->rowHandler) fbcrhRelease(result->rowHandler);
- if (result->ResultmetaData) fbcmdRelease(result->ResultmetaData);
- if (result->list) fbcplRelease(result->list);
- if (result->array) fbaRelease(result->array);
- efree(result);
- }
-}
-
-
-static void phpfbReleaseLink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- PHPFBLink* link = (PHPFBLink *)rsrc->ptr;
-
- if (link)
- {
- if (link->hostName) free(link->hostName);
- if (link->userName) free(link->userName);
- if (link->userPassword) free(link->userPassword);
- if (link->databasePassword) free(link->databasePassword);
- if (link->databaseName) free(link->databaseName);
- if (link->errorText) free(link->errorText);
- if (link->connection) {
- fbcdcClose(link->connection);
- fbcdcRelease(link->connection);
- }
- if (link->execHandler) fbcehRelease(link->execHandler);
- efree(link);
- FB_SQL_G(linkCount)--;
- }
-}
-
-static void phpfbReleasePLink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- PHPFBLink* link = (PHPFBLink *)rsrc->ptr;
-
- if (link)
- {
- if (link->hostName) free(link->hostName);
- if (link->userName) free(link->userName);
- if (link->userPassword) free(link->userPassword);
- if (link->databasePassword) free(link->databasePassword);
- if (link->databaseName) free(link->databaseName);
- if (link->errorText) free(link->errorText);
- if (link->connection) {
- fbcdcClose(link->connection);
- fbcdcRelease(link->connection);
- }
- if (link->execHandler) fbcehRelease(link->execHandler);
- free(link);
- FB_SQL_G(linkCount)--;
- FB_SQL_G(persistentCount)--;
- }
-}
-
-static void php_fbsql_set_default_link(int id TSRMLS_DC)
-{
- if (FB_SQL_G(linkIndex)!=-1) {
- zend_list_delete(FB_SQL_G(linkIndex));
- }
- FB_SQL_G(linkIndex) = id;
- zend_list_addref(id);
-}
-
-static int php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
-{
- if (FB_SQL_G(linkIndex)==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_fbsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
- }
- return FB_SQL_G(linkIndex);
-}
-
-
-static void phpfbQuery(INTERNAL_FUNCTION_PARAMETERS, char* sql, PHPFBLink* link);
-
-/* {{{ PHP_INI
- */
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN ("fbsql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong, allowPersistent, zend_fbsql_globals, fbsql_globals)
- STD_PHP_INI_BOOLEAN ("fbsql.generate_warnings", "0", PHP_INI_SYSTEM, OnUpdateLong, generateWarnings, zend_fbsql_globals, fbsql_globals)
- STD_PHP_INI_BOOLEAN ("fbsql.autocommit", "1", PHP_INI_SYSTEM, OnUpdateLong, autoCommit, zend_fbsql_globals, fbsql_globals)
- STD_PHP_INI_ENTRY_EX ("fbsql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong, maxPersistent, zend_fbsql_globals, fbsql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX ("fbsql.max_links", "128", PHP_INI_SYSTEM, OnUpdateLong, maxLinks, zend_fbsql_globals, fbsql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX ("fbsql.max_connections", "128", PHP_INI_SYSTEM, OnUpdateLong, maxConnections, zend_fbsql_globals, fbsql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX ("fbsql.max_results", "128", PHP_INI_SYSTEM, OnUpdateLong, maxResults, zend_fbsql_globals, fbsql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX ("fbsql.batchSize", "1000", PHP_INI_SYSTEM, OnUpdateLong, batchSize, zend_fbsql_globals, fbsql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY ("fbsql.default_host", NULL, PHP_INI_SYSTEM, OnUpdateString, hostName, zend_fbsql_globals, fbsql_globals)
- STD_PHP_INI_ENTRY ("fbsql.default_user", "_SYSTEM", PHP_INI_SYSTEM, OnUpdateString, userName, zend_fbsql_globals, fbsql_globals)
- STD_PHP_INI_ENTRY ("fbsql.default_password", "", PHP_INI_SYSTEM, OnUpdateString, userPassword, zend_fbsql_globals, fbsql_globals)
- STD_PHP_INI_ENTRY ("fbsql.default_database", "", PHP_INI_SYSTEM, OnUpdateString, databaseName, zend_fbsql_globals, fbsql_globals)
- STD_PHP_INI_ENTRY ("fbsql.default_database_password", "", PHP_INI_SYSTEM, OnUpdateString, databasePassword, zend_fbsql_globals, fbsql_globals)
-PHP_INI_END()
-/* }}} */
-
-static void php_fbsql_init_globals(zend_fbsql_globals *fbsql_globals)
-{
- fbsql_globals->persistentCount = 0;
-
- if (fbsql_globals->hostName==NULL)
- {
- char name[256];
- gethostname(name, sizeof(name));
- name[sizeof(name)-1] = 0;
- fbsql_globals->hostName = strdup(name);
- }
-
- fbsql_globals->persistentCount = 0;
- fbsql_globals->linkCount = 0;
-}
-
-PHP_MINIT_FUNCTION(fbsql)
-{
- ZEND_INIT_MODULE_GLOBALS(fbsql, php_fbsql_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
-
- fbcInitialize();
-
- le_result = zend_register_list_destructors_ex(phpfbReleaseResult, NULL, "fbsql result", module_number);
- le_link = zend_register_list_destructors_ex(phpfbReleaseLink, NULL, "fbsql link", module_number);
- le_plink = zend_register_list_destructors_ex(NULL, phpfbReleasePLink, "fbsql plink", module_number);
- Z_TYPE(fbsql_module_entry) = type;
-
- REGISTER_LONG_CONSTANT("FBSQL_ASSOC", FBSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_NUM", FBSQL_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_BOTH", FBSQL_BOTH, CONST_CS | CONST_PERSISTENT);
-
- /* Register Transaction constants */
- REGISTER_LONG_CONSTANT("FBSQL_LOCK_DEFERRED", FBSQL_LOCK_DEFERRED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_LOCK_OPTIMISTIC", FBSQL_LOCK_OPTIMISTIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_LOCK_PESSIMISTIC", FBSQL_LOCK_PESSIMISTIC, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("FBSQL_ISO_READ_UNCOMMITTED", FBSQL_ISO_READ_UNCOMMITTED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_ISO_READ_COMMITTED", FBSQL_ISO_READ_COMMITTED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_ISO_REPEATABLE_READ", FBSQL_ISO_REPEATABLE_READ, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_ISO_SERIALIZABLE", FBSQL_ISO_SERIALIZABLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_ISO_VERSIONED", FBSQL_ISO_VERSIONED, CONST_CS | CONST_PERSISTENT);
-
- /* Register Status constants */
- REGISTER_LONG_CONSTANT("FBSQL_UNKNOWN", FBUnknownStatus, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_STOPPED", FBStopped, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_STARTING", FBStarting, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_RUNNING", FBRunning, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_STOPPING", FBStopping, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_NOEXEC", FBNoExec, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("FBSQL_LOB_DIRECT", FBSQL_LOB_DIRECT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_LOB_HANDLE", FBSQL_LOB_HANDLE, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(fbsql)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(fbsql)
-{
- FB_SQL_G(linkIndex) = -1;
- FB_SQL_G(linkCount) = FB_SQL_G(persistentCount);
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(fbsql)
-{
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(fbsql)
-{
- char buf[32];
-
- php_info_print_table_start();
- php_info_print_table_header(2, "FrontBase support", "enabled");
-
- php_info_print_table_row(2, "Client API version", "2.24");
-
- if (FB_SQL_G(allowPersistent))
- {
- sprintf(buf, "%ld", FB_SQL_G(persistentCount));
- php_info_print_table_row(2, "Active Persistent Links", buf);
- }
-
- sprintf(buf, "%ld", FB_SQL_G(linkCount));
- php_info_print_table_row(2, "Active Links", buf);
-
-/*
- sprintf(buf, "%ld", FB_SQL_G(resultCount));
- php_info_print_table_row(2, "Active Results", buf);
-*/
-
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- PHPFBLink* phpLink;
- list_entry *lep;
- char name[1024];
- char *hostName = NULL, *userName = NULL, *userPassword = NULL;
- int argc = ZEND_NUM_ARGS(), create_new = 0;
- zval **argv[3];
-
- if ((argc < 0) || (argc > 3)) WRONG_PARAM_COUNT;
- if (zend_get_parameters_ex(argc, &argv[0], &argv[1], &argv[2])==FAILURE) RETURN_FALSE;
- if (argc >= 1)
- {
- convert_to_string_ex(argv[0]);
- hostName = Z_STRVAL_PP(argv[0]);
- }
- if (argc >= 2)
- {
- convert_to_string_ex(argv[1]);
- userName = Z_STRVAL_PP(argv[1]);
- }
- if (argc == 3)
- {
- convert_to_string_ex(argv[2]);
- userPassword = Z_STRVAL_PP(argv[2]);
- }
-
- if (hostName == NULL) hostName = FB_SQL_G(hostName);
- if (userName == NULL) userName = FB_SQL_G(userName);
- if (userPassword == NULL) userPassword = FB_SQL_G(userPassword);
-
- sprintf(name, "fbsql_%s_%s_%s", hostName, userName, userPassword);
-
- if (!FB_SQL_G(allowPersistent)) {
- persistent=0;
- }
- if (persistent) {
- if (zend_hash_find(&EG(persistent_list), name, strlen(name) + 1, (void **)&lep) == SUCCESS)
- {
- phpLink = (PHPFBLink*)lep->ptr;
- }
- else {
- list_entry le;
-
- if ((FB_SQL_G(maxLinks) != -1 && FB_SQL_G(linkCount) == FB_SQL_G(maxLinks)))
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "FrontBase link limit %d exceeded", FB_SQL_G(maxLinks));
- RETURN_FALSE;
- }
-
- if ((FB_SQL_G(maxPersistent) != -1 && FB_SQL_G(persistentCount) == FB_SQL_G(maxPersistent)))
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "FrontBase persistent link limit %d exceeded", FB_SQL_G(maxPersistent));
- RETURN_FALSE;
- }
-
- phpLink = malloc(sizeof(PHPFBLink));
- phpLink->persistent = persistent;
- phpLink->hostName = strdup(hostName);
- phpLink->userName = strdup(userName);
- phpLink->userPassword = strdup(userPassword);
- phpLink->databasePassword = strdup(FB_SQL_G(databasePassword));
- phpLink->databaseName = NULL;
- phpLink->execHandler = fbcehHandlerForHost(hostName, 128);
- phpLink->affectedRows = 0;
- phpLink->autoCommit = FB_SQL_G(autoCommit);
- phpLink->errorNo = 0;
- phpLink->errorText = NULL;
- phpLink->connection = NULL;
-
-
- le.ptr = phpLink;
- Z_TYPE(le) = le_plink;
- if (zend_hash_update(&EG(persistent_list), name, strlen(name) + 1, &le, sizeof(le), NULL)==FAILURE)
- {
- free(phpLink->hostName);
- free(phpLink->userName);
- free(phpLink->userPassword);
- free(phpLink->databasePassword);
- free(phpLink);
- RETURN_FALSE;
- }
- FB_SQL_G(linkCount)++;
- FB_SQL_G(persistentCount)++;
- }
- ZEND_REGISTER_RESOURCE(return_value, phpLink, le_plink);
- }
- else
- {
- list_entry le;
-
- if ((FB_SQL_G(maxLinks) != -1 && FB_SQL_G(linkCount) == FB_SQL_G(maxLinks)))
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "FrontBase link limit %d exceeded", FB_SQL_G(maxLinks));
- RETURN_FALSE;
- }
-
- if (zend_hash_find(&EG(regular_list), name, strlen(name) + 1, (void **)&lep) == SUCCESS)
- {
- int type, link;
- void *ptr;
-
- link = (int) lep->ptr;
- ptr = zend_list_find(link, &type); /* check if the link is still there */
- if (ptr && (type==le_link || type==le_plink)) {
- zend_list_addref(link);
- Z_LVAL_P(return_value) = link;
- php_fbsql_set_default_link(link TSRMLS_CC);
- Z_TYPE_P(return_value) = IS_RESOURCE;
- return;
- } else {
- zend_hash_del(&EG(regular_list), name, strlen(name) + 1);
- }
- phpLink = (PHPFBLink*)lep->ptr;
- }
-
- phpLink = emalloc(sizeof(PHPFBLink));
- phpLink->persistent = persistent;
- phpLink->hostName = strdup(hostName);
- phpLink->userName = strdup(userName);
- phpLink->userPassword = strdup(userPassword);
- phpLink->databasePassword = strdup(FB_SQL_G(databasePassword));
- phpLink->databaseName = NULL;
- phpLink->execHandler = fbcehHandlerForHost(hostName, 128);
- phpLink->affectedRows = 0;
- phpLink->autoCommit = FB_SQL_G(autoCommit);
- phpLink->errorNo = 0;
- phpLink->errorText = NULL;
- phpLink->connection = NULL;
-
- ZEND_REGISTER_RESOURCE(return_value, phpLink, le_link);
-
- le.ptr = (void *)Z_LVAL_P(return_value);
- Z_TYPE(le) = le_index_ptr;
- if (zend_hash_update(&EG(regular_list), name, strlen(name) + 1, &le, sizeof(le), NULL)==FAILURE)
- {
- free(phpLink->hostName);
- free(phpLink->userName);
- free(phpLink->userPassword);
- free(phpLink->databasePassword);
- efree(phpLink);
- RETURN_FALSE;
- }
- FB_SQL_G(linkCount)++;
- }
- php_fbsql_set_default_link(Z_LVAL_P(return_value) TSRMLS_CC);
-}
-
-int phpfbFetchRow(PHPFBResult* result, unsigned int row)
-{
- if (result->rowHandler == NULL)
- {
- void *rawData = fbcdcFetch(result->link->connection, result->batchSize, result->fetchHandle);
- if (rawData == NULL)
- result->rowCount = 0;
- else
- result->rowHandler = fbcrhInitWith(rawData, result->metaData);
- }
- for (;;)
- {
- void *rawData;
- if (row >= result->rowCount && result->rowCount != 0x7fffffff) return 0;
- if (fbcrhRowCount(result->rowHandler) > (unsigned int)row) return 1;
- rawData = fbcdcFetch(result->link->connection, result->batchSize, result->fetchHandle);
- if (!fbcrhAddBatch(result->rowHandler, rawData)) result->rowCount = fbcrhRowCount(result->rowHandler);
- }
-}
-
-
-/* {{{ proto resource fbsql_connect([string hostname [, string username [, string password]]])
- Create a connection to a database server */
-PHP_FUNCTION(fbsql_connect)
-{
- php_fbsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto resource fbsql_pconnect([string hostname [, string username [, string password]]])
- Create a persistant connection to a database server */
-PHP_FUNCTION(fbsql_pconnect)
-{
- php_fbsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int fbsql_close([resource link_identifier])
- Close a connection to a database server */
-PHP_FUNCTION(fbsql_close)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL;
- int id, i, nument, type;
- void *ptr;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- nument = zend_hash_next_free_element(&EG(regular_list));
- for (i = 1; i < nument; i++) {
- ptr = zend_list_find(i, &type);
- if (ptr && (type == le_result)) {
- PHPFBResult *result;
-
- result = (PHPFBResult *)ptr;
- if (result->link == phpLink) {
- zend_list_delete(i);
- }
- }
- }
-
- if (id==-1) { /* explicit resource number */
- zend_list_delete(Z_RESVAL_PP(fbsql_link_index));
- }
-
- if (id!=-1
- || (fbsql_link_index && Z_RESVAL_PP(fbsql_link_index)==FB_SQL_G(linkIndex))) {
- zend_list_delete(FB_SQL_G(linkIndex));
- FB_SQL_G(linkIndex) = -1;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-static int php_fbsql_select_db(char *databaseName, PHPFBLink *link TSRMLS_DC)
-{
- unsigned port;
- FBCDatabaseConnection* c;
- FBCMetaData* md;
-
- if (!link->databaseName || strcmp(link->databaseName, databaseName))
- {
- port = atoi(databaseName);
- if (port>0 && port<65535)
- c = fbcdcConnectToDatabaseUsingPort(link->hostName, port, link->databasePassword);
- else
- c = fbcdcConnectToDatabase(databaseName, link->hostName, link->databasePassword);
- if (c == NULL)
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", fbcdcClassErrorMessage());
- return 0;
- }
- md = fbcdcCreateSession(c, "PHP", link->userName, link->userPassword, link->userName);
- if (fbcmdErrorsFound(md))
- {
- FBCErrorMetaData* emd = fbcdcErrorMetaData(c, md);
- char* emg = fbcemdAllErrorMessages(emd);
- if (FB_SQL_G(generateWarnings))
- {
- if (emg)
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", emg);
- else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No message");
- }
- link->errorText = strdup(emg);
- link->errorNo = fbcemdErrorCodeAtIndex(emd, 0);;
- free(emg);
- fbcemdRelease(emd);
- fbcmdRelease(md);
- fbcdcClose(c);
- fbcdcRelease(c);
- return 0;
- }
- fbcmdRelease(md);
-
- if (c)
- {
- if (link->autoCommit)
- md = fbcdcExecuteDirectSQL(c, "SET COMMIT TRUE;");
- else
- md = fbcdcExecuteDirectSQL(c, "SET COMMIT FALSE;");
- fbcmdRelease(md);
- }
- fbcdcSetOutputCharacterSet(c, FBC_ISO8859_1);
- fbcdcSetInputCharacterSet(c, FBC_ISO8859_1);
-
- if (link->connection)
- {
- fbcdcClose(link->connection);
- fbcdcRelease(link->connection);
- }
- link->connection = c;
- if (link->databaseName) free(link->databaseName);
- link->databaseName = strdup(databaseName);
- }
- return 1;
-}
-
-void phpfbestrdup(const char * s, int* length, char** value)
-{
- int l = s?strlen(s):0;
- if (value)
- {
- char* r = emalloc(l+1);
- if (s)
- strcpy(r, s);
- else
- r[0] = 0;
- *value = r;
- }
- *length = l;
-}
-
-/* {{{ proto void fbsql_set_transaction(resource link_identifier, int locking, int isolation)
- Sets the transaction locking and isolation */
-PHP_FUNCTION(fbsql_set_transaction)
-{
- PHPFBLink* phpLink = NULL;
- FBCMetaData* md;
- zval **fbsql_link_index = NULL, **Locking = NULL, **Isolation = NULL;
- char strSQL[1024];
- char *strLocking[] = {"DEFERRED", "OPTIMISTIC", "PESSIMISTIC"};
- char *strIsolation[] = {"READ UNCOMMITTED", "READ NCOMMITTED", "REPEATABLE READ", "SERIALIZABLE", "VERSIONED"};
-
- switch (ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &fbsql_link_index, &Locking, &Isolation)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, -1, "FrontBase-Link", le_link, le_plink);
-
- sprintf(strSQL, "SET TRANSACTION LOCKING %s, ISOLATION %s;", strLocking[Z_LVAL_PP(Locking)], strIsolation[Z_LVAL_PP(Isolation)]);
-
- md = fbcdcExecuteDirectSQL(phpLink->connection, strSQL);
- fbcmdRelease(md);
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_autocommit(resource link_identifier [, bool OnOff])
- Turns on auto-commit */
-PHP_FUNCTION(fbsql_autocommit)
-{
- PHPFBLink* phpLink = NULL;
- FBCMetaData* md;
- zval **fbsql_link_index = NULL, **onoff = NULL;
- zend_bool OnOff;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_link_index, &onoff)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, -1, "FrontBase-Link", le_link, le_plink);
-
- if (onoff)
- {
- convert_to_boolean_ex(onoff);
- OnOff = Z_BVAL_PP(onoff);
- phpLink->autoCommit = OnOff;
- if (OnOff)
- md = fbcdcExecuteDirectSQL(phpLink->connection, "SET COMMIT TRUE;");
- else
- md = fbcdcExecuteDirectSQL(phpLink->connection, "SET COMMIT FALSE;");
- fbcmdRelease(md);
- }
- RETURN_BOOL(phpLink->autoCommit);
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_commit([resource link_identifier])
- Commit the transaction */
-PHP_FUNCTION(fbsql_commit)
-{
- PHPFBLink* phpLink = NULL;
- FBCMetaData* md;
- zval **fbsql_link_index = NULL;
- int id;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- md = fbcdcCommit(phpLink->connection);
-
- if (md) {
- fbcmdRelease(md);
- RETURN_TRUE;
- }
- else
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int fbsql_rollback([resource link_identifier])
- Rollback all statments since last commit */
-PHP_FUNCTION(fbsql_rollback)
-{
- PHPFBLink* phpLink = NULL;
- FBCMetaData* md;
- zval **fbsql_link_index = NULL;
- int id;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- md = fbcdcRollback(phpLink->connection);
-
- if (md) {
- fbcmdRelease(md);
- RETURN_TRUE;
- }
- else
- RETURN_FALSE;
-}
-/* }}} */
-
-
-static void php_fbsql_create_lob(INTERNAL_FUNCTION_PARAMETERS, int lob_type)
-{
- PHPFBLink* phpLink = NULL;
- FBCBlobHandle *lobHandle;
- zval **lob_data, **fbsql_link_index = NULL;
- int id;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &lob_data)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &lob_data, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(lob_data);
- switch (lob_type) {
- case 0 : /* BLOB */
- lobHandle = fbcdcWriteBLOB(phpLink->connection, Z_STRVAL_PP(lob_data), Z_STRLEN_PP(lob_data));
- break;
- case 1 : /* CLOB */
- lobHandle = fbcdcWriteCLOB(phpLink->connection, Z_STRVAL_PP(lob_data));
- break;
- }
- if (lobHandle) {
- RETURN_STRING(fbcbhDescription(lobHandle), 1);
- fbcbhRelease(lobHandle);
- }
- else
- RETURN_FALSE;
-}
-
-/* {{{ proto string fbsql_create_blob(string blob_data [, resource link_identifier])
- Create a BLOB in the database for use with an insert or update statement */
-PHP_FUNCTION(fbsql_create_blob)
-{
- php_fbsql_create_lob(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_create_clob(string clob_data [, resource link_identifier])
- Create a CLOB in the database for use with an insert or update statement */
-PHP_FUNCTION(fbsql_create_clob)
-{
- php_fbsql_create_lob(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_set_lob_mode(resource result, int lob_mode)
- Sets the mode for how LOB data re retreived (actual data or a handle) */
-PHP_FUNCTION(fbsql_set_lob_mode)
-{
-
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **lob_mode = NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &lob_mode)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(lob_mode);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- result->lobMode = Z_LVAL_PP(lob_mode);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-static void php_fbsql_read_lob(INTERNAL_FUNCTION_PARAMETERS, int lob_type)
-{
- PHPFBLink* phpLink = NULL;
- zval **lob_handle, **fbsql_link_index = NULL;
- int id;
- long length = 0;
- char* value = NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &lob_handle)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &lob_handle, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(lob_handle);
-
- if (Z_STRLEN_PP(lob_handle) != 27 || Z_STRVAL_PP(lob_handle)[0] != '@') {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The handle is invalid");
- RETURN_FALSE;
- }
-
- length = fbcbhBlobSize((FBCBlobHandle *)Z_STRVAL_PP(lob_handle));
- if (lob_type == 0)
- value = estrndup((char *)fbcdcReadBLOB(phpLink->connection, (FBCBlobHandle *)Z_STRVAL_PP(lob_handle)), length);
- else
- value = estrndup((char *)fbcdcReadCLOB(phpLink->connection, (FBCBlobHandle *)Z_STRVAL_PP(lob_handle)), length);
- if (value) {
- RETURN_STRINGL(value, length, 0);
- }
- else {
- RETURN_FALSE;
- }
-}
-
-/* {{{ proto string fbsql_read_blob(string blob_handle [, resource link_identifier])
- Read the BLOB data identified by blob_handle */
-PHP_FUNCTION(fbsql_read_blob)
-{
- php_fbsql_read_lob(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_read_clob(string clob_handle [, resource link_identifier])
- Read the CLOB data identified by clob_handle */
-PHP_FUNCTION(fbsql_read_clob)
-{
- php_fbsql_read_lob(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-static void php_fbsql_lob_size(INTERNAL_FUNCTION_PARAMETERS, int lob_type)
-{
- PHPFBLink* phpLink = NULL;
- zval **lob_handle, **fbsql_link_index = NULL;
- int id;
- char* value = NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &lob_handle)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &lob_handle, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(lob_handle);
-
- if (Z_STRLEN_PP(lob_handle) != 27 || Z_STRVAL_PP(lob_handle)[0] != '@') {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The handle is invalid");
- RETURN_FALSE;
- }
-
- RETURN_LONG(fbcbhBlobSize((FBCBlobHandle *)Z_STRVAL_PP(lob_handle)));
-}
-
-/* {{{ proto string fbsql_blob_size(string blob_handle [, resource link_identifier])
- Get the size of a BLOB identified by blob_handle */
-PHP_FUNCTION(fbsql_blob_size)
-{
- php_fbsql_lob_size(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_clob_size(string clob_handle [, resource link_identifier])
- Get the size of a CLOB identified by clob_handle */
-PHP_FUNCTION(fbsql_clob_size)
-{
- php_fbsql_lob_size(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_hostname(resource link_identifier [, string host_name])
- Get or set the host name used with a connection */
-PHP_FUNCTION(fbsql_hostname)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **host_name = NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_link_index, &host_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, -1, "FrontBase-Link", le_link, le_plink);
-
- if (host_name)
- {
- convert_to_string_ex(host_name);
- if (phpLink->hostName) free(phpLink->hostName);
- phpLink->hostName = strdup(Z_STRVAL_PP(host_name));
- }
- RETURN_STRING(phpLink->hostName, 1);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_database(resource link_identifier [, string database])
- Get or set the database name used with a connection */
-PHP_FUNCTION(fbsql_database)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **dbname = NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_link_index, &dbname)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, -1, "FrontBase-Link", le_link, le_plink);
-
- if (dbname)
- {
- convert_to_string_ex(dbname);
- if (phpLink->databaseName) free(phpLink->databaseName);
- phpLink->databaseName = strdup(Z_STRVAL_PP(dbname));
- }
- RETURN_STRING(phpLink->databaseName, 1);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_database_password(resource link_identifier [, string database_password])
- Get or set the databsae password used with a connection */
-PHP_FUNCTION(fbsql_database_password)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **db_password = NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_link_index, &db_password)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, -1, "FrontBase-Link", le_link, le_plink);
-
- if (db_password)
- {
- convert_to_string_ex(db_password);
- if (phpLink->databasePassword) free(phpLink->databasePassword);
- phpLink->databasePassword = strdup(Z_STRVAL_PP(db_password));
- }
- RETURN_STRING(phpLink->databasePassword, 1);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_username(resource link_identifier [, string username])
- Get or set the host user used with a connection */
-PHP_FUNCTION(fbsql_username)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **username = NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_link_index, &username)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, -1, "FrontBase-Link", le_link, le_plink);
-
- if (username)
- {
- convert_to_string_ex(username);
- if (phpLink->userName) free(phpLink->userName);
- phpLink->userName = strdup(Z_STRVAL_PP(username));
- }
- RETURN_STRING(phpLink->userName, 1);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_password(resource link_identifier [, string password])
- Get or set the user password used with a connection */
-PHP_FUNCTION(fbsql_password)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **password = NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_link_index, &password)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, -1, "FrontBase-Link", le_link, le_plink);
-
- if (password)
- {
- convert_to_string_ex(password);
- if (phpLink->userPassword) free(phpLink->userPassword);
- phpLink->userPassword = strdup(Z_STRVAL_PP(password));
- }
- RETURN_STRING(phpLink->userPassword, 1);
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_select_db([string database_name [, resource link_identifier]])
- Select the database to open */
-PHP_FUNCTION(fbsql_select_db)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **dbname;
- int id;
- char* name = NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- name = FB_SQL_G(databaseName);
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &dbname)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(dbname);
- name = Z_STRVAL_PP(dbname);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &dbname, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(dbname);
- name = Z_STRVAL_PP(dbname);
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- if (phpLink->execHandler == NULL)
- {
- int port = atoi(name);
- if (port == 0 || port > 64535) {
- if (FB_SQL_G(generateWarnings)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot connect to FBExec for database '%s'. (%s)", name, fbcehClassErrorMessage());
- }
- RETURN_FALSE;
- }
- }
-
- if (!php_fbsql_select_db(name, phpLink TSRMLS_CC)) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int fbsql_change_user(string user, string password [, string database [, resource link_identifier]])
- Change the user for a session */
-PHP_FUNCTION(fbsql_change_user)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **user, **password, **database;
- int id;
- char *name = NULL, *userName, *userPassword;
- char buffer[1024];
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- name = FB_SQL_G(databaseName);
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(2, &user, &password)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(3, &user, &password, &database)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(database);
- name = Z_STRVAL_PP(database);
- break;
- case 4:
- if (zend_get_parameters_ex(4, &user, &password, &database, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(database);
- name = Z_STRVAL_PP(database);
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(user);
- userName = Z_STRVAL_PP(user);
-
- convert_to_string_ex(password);
- userPassword = Z_STRVAL_PP(password);
-
- sprintf(buffer, "SET AUTHORIZATION %s;", userName);
-
- phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, buffer, phpLink);
- if (Z_LVAL_P(return_value))
- {
- free(phpLink->userName);
- phpLink->userName = strdup(userName);
- }
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_create_db(string database_name [, resource link_identifier])
- Create a new database on the server */
-PHP_FUNCTION(fbsql_create_db)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **database_name;
- int id;
- int i, status;
- char *databaseName;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &database_name, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(database_name);
- databaseName = Z_STRVAL_PP(database_name);
-
- status = fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName);
- if (status != FBUnknownStatus)
- {
- char* txt = "Unknown status";
- if (status == FBStopped ) txt = "stopped";
- else if (status == FBStarting) txt = "starting";
- else if (status == FBRunning ) txt = "running";
- else if (status == FBStopping) txt = "stopping";
- else if (status == FBNoExec ) txt = "no exec";
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create %s@%s, database is %s", databaseName, phpLink->hostName, txt);
- RETURN_FALSE;
- }
- if (!fbcehCreateDatabaseNamedWithOptions(phpLink->execHandler, databaseName, ""))
- {
- char* error = fbechErrorMessage(phpLink->execHandler);
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create %s@%s. %s", databaseName, phpLink->hostName, error);
- RETURN_FALSE;
- }
- for (i=0; i < 20; i++)
- {
-#ifdef PHP_WIN32
- Sleep(1000);
-#else
- sleep(1);
-#endif
- status = fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName);
- if (status == FBRunning) break;
- }
- if (status != FBRunning)
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Database %s@%s created -- status unknown", databaseName, phpLink->hostName);
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int fbsql_drop_db(string database_name [, resource link_identifier])
- Drop a database on the server */
-PHP_FUNCTION(fbsql_drop_db)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **database_name;
- int id;
- int i, status;
- char *databaseName;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &database_name, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(database_name);
- databaseName = Z_STRVAL_PP(database_name);
-
- status = fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName);
- if (status != FBStopped)
- {
- char* txt = "Unknown status";
- if (status == FBStopped ) txt = "stopped";
- else if (status == FBUnknownStatus) txt = "nonexisting";
- else if (status == FBStarting ) txt = "starting";
- else if (status == FBRunning ) txt = "running";
- else if (status == FBStopping ) txt = "stopping";
- else if (status == FBNoExec ) txt = "no exec";
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not drop %s@%s, database is %s", databaseName, phpLink->hostName, txt);
- RETURN_FALSE;
- }
-
- if (! fbcehDeleteDatabaseNamed (phpLink->execHandler, databaseName))
- {
- char* error = fbechErrorMessage(phpLink->execHandler);
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not drop %s@%s. %s", databaseName, phpLink->hostName, error);
- RETURN_FALSE;
- }
- for (i=0; i < 20; i++)
- {
-#ifdef PHP_WIN32
- Sleep(1000);
-#else
- sleep(1);
-#endif
- status = fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName);
- if (status == FBUnknownStatus) break;
- }
- if (status != FBUnknownStatus)
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Database %s@%s dropped -- status unknown", databaseName, phpLink->hostName);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_start_db(string database_name [, resource link_identifier])
- Start a database on the server */
-PHP_FUNCTION(fbsql_start_db)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **database_name;
- int id;
- int i, status;
- char *databaseName;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &database_name, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(database_name);
- databaseName = Z_STRVAL_PP(database_name);
-
- status = fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName);
- if ((status != FBStopped) && (status != FBRunning) && (status != FBStarting))
- {
- char* txt = "Unknown status";
- if (status == FBStopped ) txt = "stopped";
- else if (status == FBStarting) txt = "starting";
- else if (status == FBRunning ) txt = "running";
- else if (status == FBStopping) txt = "stopping";
- else if (status == FBNoExec ) txt = "no exec";
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not start %s@%s, as database is %s", databaseName, phpLink->hostName, txt);
- RETURN_FALSE;
- }
-
- if (status == FBStopped)
- {
- if (!fbcehStartDatabaseNamed (phpLink->execHandler, databaseName))
- {
- char* error = fbechErrorMessage(phpLink->execHandler);
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not start %s@%s. %s", databaseName, phpLink->hostName, error);
- RETURN_FALSE;
- }
- }
-
- for (i=0; i < 20; i++)
- {
-#ifdef PHP_WIN32
- Sleep(1000);
-#else
- sleep(1);
-#endif
- status = fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName);
- if (status == FBRunning) break;
- }
- if (status != FBRunning)
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Database %s@%s started -- status unknown", databaseName, phpLink->hostName);
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_stop_db(string database_name [, resource link_identifier])
- Stop a database on the server */
-PHP_FUNCTION(fbsql_stop_db)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **database_name;
- int id;
- int i, status;
- char *databaseName;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &database_name, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(database_name);
- databaseName = Z_STRVAL_PP(database_name);
-
- if (!php_fbsql_select_db(databaseName, phpLink TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
-/* printf("Stop db %x\n", phpDatabase->connection); */
- if (!fbcdcStopDatabase(phpLink->connection))
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot stop database %s@%s", databaseName, phpLink->hostName);
- RETURN_FALSE;
- }
-
- for (i=0; i < 20; i++)
- {
- status = fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName);
- if (status == FBStopped) break;
-#ifdef PHP_WIN32
- Sleep(1000);
-#else
- sleep(1);
-#endif
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int fbsql_db_status(string database_name [, resource link_identifier])
- Gets the status (Stopped, Starting, Running, Stopping) for a given database */
-PHP_FUNCTION(fbsql_db_status)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **database_name;
- int id;
- char *databaseName;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &database_name, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(database_name);
- databaseName = Z_STRVAL_PP(database_name);
-
- if (phpLink->execHandler) {
- RETURN_LONG(fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName));
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ mdOk
- */
-int mdOk(PHPFBLink* link, FBCMetaData* md, char* sql)
-{
- FBCDatabaseConnection* c = link->connection;
- int result = 1;
- TSRMLS_FETCH();
-
- link->errorNo = 0;
- if (link->errorText)
- {
- free(link->errorText);
- link->errorText = NULL;
- }
- if (md == NULL)
- {
- link->errorNo = 1;
- link->errorText = strdup("Connection to database server was lost");
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", link->errorText);
- result = 0;
- }
- else if (fbcmdErrorsFound(md))
- {
- FBCErrorMetaData* emd = fbcdcErrorMetaData(c, md);
- char* emg = fbcemdAllErrorMessages(emd);
- if (FB_SQL_G(generateWarnings))
- {
- if (emg)
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error in statement: '%s' %s", sql, emg);
- else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No message");
- }
- link->errorText = strdup(emg);
- link->errorNo = fbcemdErrorCodeAtIndex(emd, 0);;
- free(emg);
- fbcemdRelease(emd);
- result = 0;
- }
- return result;
-}
-/* }}} */
-
-static void phpfbQuery(INTERNAL_FUNCTION_PARAMETERS, char* sql, PHPFBLink* link)
-{
- PHPFBResult* result = NULL;
- FBCMetaData* md, *meta;
- char* tp;
- char* fh;
- unsigned int sR = 1, cR = 0;
-
- meta = fbcdcExecuteDirectSQL(link->connection, sql);
-
- if (!mdOk(link, meta, sql))
- {
- fbcmdRelease(meta);
- ZVAL_BOOL(return_value, 0)
- }
- else {
- if (fbcmdHasMetaDataArray(meta)) {
- sR = fbcmdMetaDataArrayCount(meta);
- md = (FBCMetaData*)fbcmdMetaDataAtIndex(meta, cR);
- }
- else
- md = meta;
-
- tp = fbcmdStatementType(md);
-
- if ((tp[0] == 'C') || (tp[0] == 'R'))
- {
- if (sR == 1 && md) fbcmdRelease(md);
- ZVAL_BOOL(return_value, 1)
- }
- else if ((fh = fbcmdFetchHandle(md)) || tp[0] == 'E' || (tp[0] == 'U' && fh))
- {
- result = emalloc(sizeof(PHPFBResult));
- result->link = link;
- result->fetchHandle = fh;
- result->ResultmetaData = meta;
- result->metaData = md;
- result->rowHandler = NULL;
- result->batchSize = FB_SQL_G(batchSize);
- result->rowCount = 0x7fffffff;
- result->columnCount = 0;
- result->rowIndex = 0;
- result->columnIndex = 0;
- result->row = NULL;
- result->array = NULL;
- result->list = NULL;
- result->selectResults = sR;
- result->currentResult = cR;
- result->lobMode = FBSQL_LOB_DIRECT;
-
- if (tp[0] != 'E')
- {
- result->columnCount = fbcmdColumnCount(md);
- result->fetchHandle = fh;
- result->batchSize = FB_SQL_G(batchSize);
- }
- else
- {
- char* r = fbcmdMessage(result->metaData);
- fbcrhConvertToOutputCharSet(fbcdcOutputCharacterSet(link->connection), (unsigned char *)r);
- if ((result->list = fbcplParse(r)))
- {
- result->rowCount = fbcplCount(result->list);
- result->columnCount = 7;
- }
- }
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
- }
- else if (tp[0] == 'I' || tp[0] == 'U')
- {
- if (tp[0] == 'I') link->insert_id = fbcmdRowIndex(md);
- if (sR == 1 && md) fbcmdRelease(md);
- ZVAL_BOOL(return_value, 1)
- }
- else if(tp[0] == 'A' || tp[0] == 'D')
- {
- if (sR == 1 && md) fbcmdRelease(md);
- ZVAL_BOOL(return_value, 1)
- }
- if (link) link->affectedRows = fbcmdRowCount(md);
- }
-}
-
-/* {{{ proto resource fbsql_query(string query [, resource link_identifier])
- Send one or more SQL statements to the server and execute them */
-PHP_FUNCTION(fbsql_query)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **query;
- int id;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &query)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &query, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(query);
-
- phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_STRVAL_PP(query), phpLink);
-}
-/* }}} */
-
-/* {{{ proto resource fbsql_db_query(string database_name, string query [, resource link_identifier])
- Send one or more SQL statements to a specified database on the server */
-PHP_FUNCTION(fbsql_db_query)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **dbname, **query;
- int id;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(2, &dbname, &query)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &dbname, &query, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(query);
- convert_to_string_ex(dbname);
-
- if (php_fbsql_select_db(Z_STRVAL_PP(dbname), phpLink TSRMLS_CC)) {
- phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_STRVAL_PP(query), phpLink);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto resource fbsql_list_dbs([resource link_identifier])
- Retreive a list of all databases on the server */
-PHP_FUNCTION(fbsql_list_dbs)
-{
- PHPFBResult* phpResult;
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL;
- int id;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- phpResult = emalloc(sizeof(PHPFBResult));
- phpResult->link = phpLink;
- phpResult->fetchHandle = NULL;
- phpResult->rowHandler = NULL;
- phpResult->ResultmetaData = NULL;
- phpResult->metaData = NULL;
- phpResult->batchSize = FB_SQL_G(batchSize);
- phpResult->columnCount = 1;
- phpResult->rowIndex = 0;
- phpResult->columnIndex = 0;
- phpResult->row = NULL;
- phpResult->array = fbcehAvailableDatabases(phpLink->execHandler);
- phpResult->rowCount = fbaCount(phpResult->array);
- phpResult->list = NULL;
-
- ZEND_REGISTER_RESOURCE(return_value, phpResult, le_result);
-}
-/* }}} */
-
-/* {{{ proto resource fbsql_list_tables(string database [, int link_identifier])
- Retreive a list of all tables from the specifoied database */
-PHP_FUNCTION(fbsql_list_tables)
-{
- char* sql = "select t0.\"table_name\"from information_schema.tables t0, information_schema.SCHEMATA t1 where t0.schema_pk = t1.schema_pk and t1.\"schema_name\" = current_schema order by \"table_name\";";
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **database_name;
- int id;
- char *databaseName;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &database_name, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(database_name);
- databaseName = Z_STRVAL_PP(database_name);
-
- if (databaseName == NULL) {
- php_fbsql_select_db(FB_SQL_G(databaseName), phpLink TSRMLS_CC);
- } else {
- php_fbsql_select_db(databaseName, phpLink TSRMLS_CC);
- }
-
- phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, sql, phpLink);
-}
-/* }}} */
-
-/* {{{ proto resource fbsql_list_fields(string database_name, string table_name [, resource link_identifier])
- Retrieve a list of all fields for the specified database.table */
-PHP_FUNCTION(fbsql_list_fields)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **database_name, **table_name;
- int id;
- char *databaseName, *tableName;
- char sql[1024];
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(2, &database_name, &table_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &database_name, &table_name, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(database_name);
- databaseName = Z_STRVAL_PP(database_name);
- convert_to_string_ex(table_name);
- tableName = Z_STRVAL_PP(table_name);
-
- if (!php_fbsql_select_db(databaseName, phpLink TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- sprintf(sql, "SELECT * FROM %s WHERE 1=0;", tableName);
-
- phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, sql, phpLink);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_error([resource link_identifier])
- Returns the last error string */
-PHP_FUNCTION(fbsql_error)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL;
- int id;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- if (phpLink->errorText == NULL) {
- RETURN_FALSE;
- }
- else {
- RETURN_STRING(phpLink->errorText, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto int fbsql_errno([resource link_identifier])
- Returns the last error code */
-PHP_FUNCTION(fbsql_errno)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL;
- int id;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- RETURN_LONG(phpLink->errorNo);
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_warnings([int flag])
- Enable or disable FrontBase warnings */
-PHP_FUNCTION(fbsql_warnings)
-{
- int argc = ZEND_NUM_ARGS();
- zval **argv[1];
-
- if ((argc < 0) || (argc > 1)) WRONG_PARAM_COUNT;
- if (zend_get_parameters_ex(argc, &argv[0])==FAILURE) RETURN_FALSE;
- if (argc >= 1)
- {
- convert_to_long_ex(argv[0]);
- FB_SQL_G(generateWarnings) = Z_LVAL_PP(argv[0]) != 0;
- }
- RETURN_BOOL(FB_SQL_G(generateWarnings));
-}
-/* }}} */
-
-/* {{{ proto int fbsql_affected_rows([resource link_identifier])
- Get the number of rows affected by the last statement */
-PHP_FUNCTION(fbsql_affected_rows)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL;
- int id;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- RETURN_LONG(phpLink->affectedRows);
-}
-/* }}} */
-
-/* {{{ proto int fbsql_insert_id([resource link_identifier])
- Get the internal index for the last insert statement */
-PHP_FUNCTION(fbsql_insert_id)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL;
- int id;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- RETURN_LONG(phpLink->insert_id);
-}
-/* }}} */
-
-/* {{{ phpSizeOfInt
- */
-int phpSizeOfInt (int i)
-{
- int s = 1;
- if (i < 0)
- {
- s++;
- i = -i;
- }
- while ((i = i / 10)) s++;
- return s;
-}
-/* }}} */
-
-void phpfbColumnAsString(PHPFBResult* result, int column, void* data , int* length, char** value TSRMLS_DC)
-{
- FBCMetaData* md = result->metaData;
- const FBCDatatypeMetaData* dtmd = fbcmdDatatypeMetaDataAtIndex(md, column);
- unsigned dtc = fbcdmdDatatypeCode(dtmd);
- switch (dtc)
- {
- case FB_Boolean:
- {
- unsigned char v = *((unsigned char*)(data));
- if (v == 255)
- phpfbestrdup("Unknown", length, value);
- else if (v == 0)
- phpfbestrdup("False", length, value);
- else
- phpfbestrdup("True", length, value);
- }
- break;
-
- case FB_PrimaryKey:
- case FB_Integer:
- {
- int v = *((int*)data);
- char b[128];
- sprintf(b, "%d", v);
- phpfbestrdup(b, length, value);
- }
- break;
-#ifdef FB_TinyInteger
- case FB_TinyInteger:
- {
- short int v = *((short int*)data);
- char b[128];
- sprintf(b, "%d", v);
- phpfbestrdup(b, length, value);
- }
- break;
-#endif
-#ifdef FB_LongInteger
- case FB_LongInteger:
- {
- FBLongInteger v = *((FBLongInteger*)data);
- char b[128];
-#ifdef PHP_WIN32
- sprintf(b, "%I64i", v);
-#else
- sprintf(b, "%ll", v);
-#endif
- phpfbestrdup(b, length, value);
- }
- break;
-#endif
- case FB_SmallInteger:
- {
- short v = *((short*)data);
- char b[128];
- sprintf(b, "%d", v);
- phpfbestrdup(b, length, value);
- }
- break;
-
- case FB_Float:
- case FB_Real:
- case FB_Double:
- case FB_Numeric:
- case FB_Decimal:
- {
- double v = *((double*)data);
- char b[128];
- sprintf(b, "%f", v);
- phpfbestrdup(b, length, value);
- }
- break;
-
- case FB_Character:
- case FB_VCharacter:
- {
- char* v = (char*)data;
- phpfbestrdup(v, length, value);
- }
- break;
-
- case FB_Bit:
- case FB_VBit:
- {
- const FBCColumnMetaData* clmd = fbcmdColumnMetaDataAtIndex(md, column);
- struct bitValue
- {
- unsigned int nBytes;
- unsigned char* bytes;
- };
- struct bitValue* ptr = data;
- unsigned nBits = ptr->nBytes * 8;
-
- if (dtc == FB_Bit) nBits = fbcdmdLength(fbccmdDatatype(clmd));
- if (nBits %8 == 0)
- {
- unsigned i;
- unsigned int l = nBits / 8;
- *length = l*2+3+1;
- if (value)
- {
- char* r = emalloc(l*2+3+1);
- r[0] = 'X';
- r[1] = '\'';
- for (i = 0; i < nBits / 8; i++)
- {
- char c[4];
- sprintf(c, "%02x", ptr->bytes[i]);
- r[i*2+2] = c[0];
- r[i*2+3] = c[1];
- }
- r[i*2+2] = '\'';
- r[i*2+3] = 0;
- *value = r;
- }
- }
- else
- {
- unsigned i;
- unsigned int l = nBits;
- *length = l*2+3+1;
- if (value)
- {
- char* r = emalloc(l*2+3+1);
- r[0] = 'B';
- r[1] = '\'';
- for (i = 0; i < nBits; i++)
- {
- int bit = 0;
- if (i/8 < ptr->nBytes) bit = ptr->bytes[i/8] & (1<<(7-(i%8)));
- r[i*2+2] = bit?'1':'0';
- }
- r[i*2+2] = '\'';
- r[i*2+3] = 0;
- *value = r;
- }
- }
- }
- break;
-
- case FB_Date:
- case FB_Time:
- case FB_TimeTZ:
- case FB_Timestamp:
- case FB_TimestampTZ:
- {
- char* v = (char*)data;
- phpfbestrdup(v, length, value);
- }
- break;
-
- case FB_YearMonth:
- {
- char b[128];
- int v = *((unsigned int*)data);
- sprintf(b, "%d", v);
- phpfbestrdup(b, length, value);
- }
- break;
-
- case FB_DayTime:
- {
- char b[128];
- double seconds = *((double*)data);
- sprintf(b, "%f", seconds);
- phpfbestrdup(b, length, value);
- }
- break;
-
- case FB_CLOB:
- case FB_BLOB:
- {
- if (*((unsigned char*) data) == '\1')
- { /* Direct */
- *length = ((FBCBlobDirect *)data)->blobSize;
- *value = estrndup((char *)((FBCBlobDirect *)data)->blobData, *length);
- }
- else
- {
- FBCBlobHandle *lobHandle;
- unsigned char *bytes = (unsigned char *)data;
- char *handle = (char *)(&bytes[1]);
- lobHandle = fbcbhInitWithHandle(handle);
- *length = fbcbhBlobSize(lobHandle);
-
- if (result->lobMode == FBSQL_LOB_HANDLE) {
- phpfbestrdup(fbcbhDescription(lobHandle), length, value);
- }
- else {
- if (dtc == FB_BLOB)
- *value = estrndup((char *)fbcdcReadBLOB(result->link->connection, lobHandle), *length);
- else
- *value = estrndup((char *)fbcdcReadCLOB(result->link->connection, lobHandle), *length);
- }
- fbcbhRelease(lobHandle);
- }
- }
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unimplemented type (%d)", dtc);
- break;
- }
-}
-
-/* {{{ phpfbSqlResult
- */
-void phpfbSqlResult(INTERNAL_FUNCTION_PARAMETERS, PHPFBResult* result, int rowIndex, int columnIndex)
-{
- void** row;
- if (result->list)
- {
- FBCPList* columns = (FBCPList*)fbcplValueForKey(result->list, "COLUMNS");
- FBCPList* column = (FBCPList*)fbcplValueAtIndex(columns, result->rowIndex);
- if (columnIndex == 0)
- { /* Name */
- FBCPList* name = (FBCPList*)fbcplValueForKey(column, "NAME");
- RETURN_STRING((char *)fbcplString((FBCPList*)name), 1);
- }
- else if (columnIndex == 2)
- { /* Length */
- FBCPList* name = (FBCPList*)fbcplValueForKey(column, "WIDTH");
- RETURN_STRING((char *)fbcplString((FBCPList*)name), 1);
- }
- else if (columnIndex == 1)
- { /* Type */
- FBCPList* name = (FBCPList*)fbcplValueForKey(column, "DATATYPE");
- RETURN_STRING((char *)fbcplString((FBCPList*)name), 1);
- }
- else if (columnIndex == 3)
- { /* Flags */
- RETURN_STRING("", 1);
- }
- else
- {
- RETURN_STRING("", 1);
- }
- }
- else if (result->array)
- { /* Special case for get dbs */
- RETURN_STRING(fbaObjectAtIndex(result->array, rowIndex), 1);
- }
- else if (!phpfbFetchRow(result, rowIndex))
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such row %d in result set %d", rowIndex, rowIndex);
- RETURN_FALSE;
- }
- else if (columnIndex >= result->columnCount)
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such column %d in result set %d", columnIndex, rowIndex);
- RETURN_FALSE;
- }
- else
- {
- row = fbcrhRowAtIndex(result->rowHandler, rowIndex);
- if (row == NULL)
- {
- RETURN_FALSE;
- }
- else if (row[columnIndex])
- {
- phpfbColumnAsString(result, columnIndex, row[columnIndex], &Z_STRLEN_P(return_value), &Z_STRVAL_P(return_value) TSRMLS_CC);
- Z_TYPE_P(return_value) = IS_STRING;
- }
- else
- {
- RETURN_NULL();
- }
- }
-}
-/* }}} */
-
-/* {{{ proto mixed fbsql_result(int result [, int row [, mixed field]])
- ??? */
-PHP_FUNCTION(fbsql_result)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **row = NULL, **field = NULL;
- int rowIndex;
- int columnIndex;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &row)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &fbsql_result_index, &row, &field)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- rowIndex = result->rowIndex;
- if (row)
- {
- convert_to_long_ex(row);
- rowIndex = Z_LVAL_PP(row);
- }
-
- columnIndex = result->columnIndex;
- if (field)
- {
- if ((Z_TYPE_PP(field) == IS_STRING) && (result->metaData))
- {
- for (columnIndex =0; columnIndex < result->columnCount; columnIndex ++)
- {
- const FBCColumnMetaData* cmd = fbcmdColumnMetaDataAtIndex(result->metaData, columnIndex);
- const char* lbl = fbccmdLabelName(cmd);
- if (strcmp((char*)lbl, Z_STRVAL_PP(field)) == 0) break;
- }
- if (columnIndex == result->columnCount) RETURN_FALSE;
- }
- else
- {
- convert_to_long_ex(field);
- columnIndex = Z_LVAL_PP(field);
- if (columnIndex < 0)
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal column index - %d", columnIndex);
- RETURN_FALSE;
- }
- }
- }
-
- phpfbSqlResult(INTERNAL_FUNCTION_PARAM_PASSTHRU, result, rowIndex, columnIndex);
-
- result->columnIndex++;
- if (result->columnIndex == result->columnCount)
- {
- result->rowIndex++;
- result->columnIndex = 0;
- }
-}
-/* }}} */
-
-/* {{{ proto int fbsql_next_result(int result)
- Switch to the next result if multiple results are available */
-PHP_FUNCTION(fbsql_next_result)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- result->currentResult++;
- if (result->currentResult < result->selectResults) {
- if (result->fetchHandle) {
- FBCMetaData *md = fbcdcCancelFetch(result->link->connection, result->fetchHandle);
- fbcmdRelease(md);
- }
- if (result->rowHandler) fbcrhRelease(result->rowHandler);
- result->metaData = (FBCMetaData*)fbcmdMetaDataAtIndex(result->ResultmetaData, result->currentResult);
- result->fetchHandle = fbcmdFetchHandle(result->metaData);
- result->rowHandler = NULL;
- result->batchSize = FB_SQL_G(batchSize);
- result->rowCount = 0x7fffffff;
- result->columnCount = fbcmdColumnCount(result->metaData);;
- result->rowIndex = 0;
- result->columnIndex = 0;
- result->row = NULL;
- result->array = NULL;
- result->list = NULL;
- if (result->link)
- result->link->affectedRows = fbcmdRowCount(result->metaData);
-
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int fbsql_num_rows(int result)
- Get number of rows */
-PHP_FUNCTION(fbsql_num_rows)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL;
- int rowCount;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- if (result->array)
- rowCount = result->rowCount;
- else {
- rowCount = fbcmdRowCount(result->metaData);
- if (rowCount == -1)
- {
- phpfbFetchRow(result, 0x7fffffff);
- rowCount = result->rowCount;
- }
- }
- RETURN_LONG(rowCount);
-}
-/* }}} */
-
-/* {{{ proto int fbsql_num_fields(int result)
- Get number of fields in the result set */
-PHP_FUNCTION(fbsql_num_fields)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- RETURN_LONG(result->columnCount);
-}
-/* }}} */
-
-/* {{{ proto array fbsql_fetch_row(resource result)
- Fetch a row of data. Returns an indexed array */
-PHP_FUNCTION(fbsql_fetch_row)
-{
- php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_NUM);
-}
-/* }}} */
-
-/* {{{ proto object fbsql_fetch_assoc(resource result)
- Detch a row of data. Returns an assoc array */
-PHP_FUNCTION(fbsql_fetch_assoc)
-{
- php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_ASSOC);
-}
-/* }}} */
-
-/* {{{ proto object fbsql_fetch_object(resource result [, int result_type])
- Fetch a row of data. Returns an object */
-PHP_FUNCTION(fbsql_fetch_object)
-{
- php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_ASSOC);
- if (Z_TYPE_P(return_value)==IS_ARRAY) {
- object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value));
- }
-}
-/* }}} */
-
-/* {{{ proto array fbsql_fetch_array(resource result [, int result_type])
- Fetches a result row as an array (associative, numeric or both)*/
-PHP_FUNCTION(fbsql_fetch_array)
-{
- php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_BOTH);
-}
-/* }}} */
-
-static void _parse_list(zval** return_value, FBCPList* list)
-{
- int count = fbcplCount(list);
- int i,j;
-
- for (i=0; i<count; i++)
- {
- char* key = (char*)fbcplKeyAtIndex(list, i);
- FBCPList* value = (FBCPList*)fbcplValueForKey(list, key);
- if (fbcplIsDictionary(value))
- {
- zval *value_array;
-
- MAKE_STD_ZVAL(value_array);
- array_init(value_array);
-
- _parse_list(&value_array, value);
- add_assoc_zval(*return_value, key, value_array);
- }
- else if (fbcplIsArray(value))
- {
- zval *value_array;
- int valcount = fbcplCount(value);
-
- MAKE_STD_ZVAL(value_array);
- array_init(value_array);
-
- for (j=0; j<valcount; j++)
- {
- FBCPList* arrayValue = (FBCPList*)fbcplValueAtIndex(value, j);
- if (fbcplIsString(arrayValue))
- add_index_string(value_array, j, (char*)fbcplString(arrayValue), 1);
- else {
- _parse_list(&value_array, arrayValue);
- }
- }
- add_assoc_zval(*return_value, key, value_array);
- }
- else if (fbcplIsString(value)) {
- add_assoc_string(*return_value, key, (char*)fbcplString(value), 1);
- }
- }
-}
-
-static void php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
-{
-
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **zresult_type = NULL;
- int rowIndex;
- int i;
- void **row;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &zresult_type)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(zresult_type);
- result_type = Z_LVAL_PP(zresult_type);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- rowIndex = result->rowIndex;
- if (((result_type & FBSQL_NUM) != FBSQL_NUM) && ((result_type & FBSQL_ASSOC) != FBSQL_ASSOC))
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal result type use FBSQL_NUM, FBSQL_ASSOC, or FBSQL_BOTH");
- RETURN_FALSE;
- }
- array_init(return_value);
- if (result->fetchHandle == NULL)
- {
- if (result->array == NULL && result->list == NULL)
- {
- RETURN_FALSE;
- }
- if (result->rowIndex >= result->rowCount)
- {
- RETURN_FALSE;
- }
- if (result->list) {
- char* key;
- FBCPList* value;
-
- value = (FBCPList*)fbcplValueAtIndex(result->list, result->rowIndex);
- key = (char*)fbcplKeyAtIndex(result->list, result->rowIndex);
-
- if (key && key[0] == 2)
- key = NULL;
-
- if (fbcplIsDictionary(value)) {
- zval *value_array;
-
- MAKE_STD_ZVAL(value_array);
- array_init(value_array);
-
- _parse_list(&value_array, value);
- if (result_type & FBSQL_NUM || key == NULL)
- {
- add_index_zval(return_value, 0, value_array);
- }
- if (result_type & FBSQL_ASSOC && key != NULL)
- {
- add_assoc_zval(return_value, key, value_array);
- }
- }
- else if (fbcplIsArray(value)) {
- zval *value_array;
- int valcount = fbcplCount(value);
- int j;
-
- MAKE_STD_ZVAL(value_array);
- array_init(value_array);
-
- for (j=0; j<valcount; j++)
- {
- FBCPList* arrayValue = (FBCPList*)fbcplValueAtIndex(value, j);
- if (fbcplIsString(arrayValue))
- add_index_string(value_array, j, (char*)fbcplString(arrayValue), 1);
- else {
- _parse_list(&value_array, arrayValue);
- }
- }
- if (result_type & FBSQL_NUM || key == NULL)
- {
- add_index_zval(return_value, 0, value_array);
- }
- if (result_type & FBSQL_ASSOC && key != NULL)
- {
- add_assoc_zval(return_value, key, value_array);
- }
- }
- else if (fbcplIsString(value)) {
- if (result_type & FBSQL_NUM)
- {
- add_index_string(return_value, 0, (char*)fbcplString(value), 1);
- }
- if (result_type & FBSQL_ASSOC)
- {
- add_assoc_string(return_value, key, (char*)fbcplString(value), 1);
- }
- }
- }
- else {
- if (result_type & FBSQL_NUM)
- {
- add_index_string(return_value, 0, estrdup(fbaObjectAtIndex(result->array, result->rowIndex)), 0);
- }
- if (result_type & FBSQL_ASSOC)
- {
- add_assoc_string(return_value, "Database", estrdup(fbaObjectAtIndex(result->array, result->rowIndex)), 0);
- }
- }
- }
- else {
- if (result->rowCount == 0) {
- RETURN_FALSE;
- }
- if (result->rowCount == 0x7fffffff)
- {
- if (!phpfbFetchRow(result, result->rowIndex)) {
- RETURN_FALSE;
- }
- }
- row = fbcrhRowAtIndex(result->rowHandler, rowIndex);
- if (row == NULL)
- {
- RETURN_FALSE;
- }
- for (i=0; i < result->columnCount; i++)
- {
- if (row[i])
- {
- char* value;
- unsigned int length;
- unsigned int c = 0;
- phpfbColumnAsString(result, i, row[i], &length, &value TSRMLS_CC);
- if (result_type & FBSQL_NUM)
- {
- add_index_stringl(return_value, i, value, length, c);
- c = 1;
- }
- if (result_type & FBSQL_ASSOC)
- {
- char* key = (char*)fbccmdLabelName(fbcmdColumnMetaDataAtIndex(result->metaData, i));
- add_assoc_stringl(return_value, key, value, length, c);
- }
- }
- else
- {
- if (result_type & FBSQL_NUM)
- {
- add_index_unset(return_value, i);
- }
- if (result_type & FBSQL_ASSOC)
- {
- char* key = (char*)fbccmdLabelName(fbcmdColumnMetaDataAtIndex(result->metaData, i));
- add_assoc_unset(return_value, key);
- }
- }
- }
- }
- result->rowIndex++;
- result->columnIndex = 0;
-}
-
-/* {{{ proto int fbsql_data_seek(int result, int row_number)
- Move the internal row counter to the specified row_number */
-PHP_FUNCTION(fbsql_data_seek)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **row_number = NULL;
- unsigned int rowIndex;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &row_number)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- convert_to_long_ex(row_number);
- rowIndex = Z_LVAL_PP(row_number);
-
- if (rowIndex < 0)
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal row_index (%d)", rowIndex);
- RETURN_FALSE;
- }
-
- if (result->rowCount == 0x7fffffff) phpfbFetchRow(result, rowIndex);
- if (rowIndex > result->rowCount) RETURN_FALSE;
- result->rowIndex = rowIndex;
- result->columnIndex = 0;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array fbsql_fetch_lengths(int result)
- Returns an array of the lengths of each column in the result set */
-PHP_FUNCTION(fbsql_fetch_lengths)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL;
- int i;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- if (result->row == NULL) RETURN_FALSE;
- array_init(return_value);
- for (i=0; i < result->columnCount; i++)
- {
- unsigned length = 0;
- if (result->row[i]) phpfbColumnAsString(result, i, result->row[i], &length, NULL TSRMLS_CC);
- add_index_long(return_value, i, length);
- }
-}
-/* }}} */
-
-/* {{{ proto object fbsql_fetch_field(int result [, int field_index])
- Get the field properties for a specified field_index */
-PHP_FUNCTION(fbsql_fetch_field)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **field_index = NULL;
- int column = -1;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &field_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- column = result->columnIndex;
- if (field_index)
- {
- convert_to_long_ex(field_index);
- column = Z_LVAL_PP(field_index);
- if (column < 0 || column >= result->columnCount)
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d no such column in result", column);
- RETURN_FALSE;
- }
- }
- object_init(return_value);
-
- add_property_string(return_value, "name", (char*)fbccmdLabelName(fbcmdColumnMetaDataAtIndex(result->metaData, column)), 1);
- add_property_string(return_value, "table", (char*)fbccmdTableName(fbcmdColumnMetaDataAtIndex(result->metaData, column)), 1);
- add_property_long(return_value, "max_length", fbcdmdLength(fbccmdDatatype(fbcmdColumnMetaDataAtIndex(result->metaData, column))));
- add_property_string(return_value, "type", (char*)fbcdmdDatatypeString(fbcmdDatatypeMetaDataAtIndex(result->metaData, column)), 1);
- add_property_long(return_value, "not_null", !fbccmdIsNullable(fbcmdColumnMetaDataAtIndex(result->metaData, column)));
-/* Remember to add the rest */
-/* add_property_long(return_value, "primary_key", IS_PRI_KEY(fbsql_field->flags)?1:0); */
-/* add_property_long(return_value, "multiple_key", (fbsql_field->flags&MULTIPLE_KEY_FLAG?1:0)); */
-/* add_property_long(return_value, "unique_key", (fbsql_field->flags&UNIQUE_KEY_FLAG?1:0)); */
-/* add_property_long(return_value, "numeric", IS_NUM(Z_TYPE_P(fbsql_field))?1:0); */
-/* add_property_long(return_value, "blob", IS_BLOB(fbsql_field->flags)?1:0); */
-/* add_property_long(return_value, "unsigned", (fbsql_field->flags&UNSIGNED_FLAG?1:0)); */
-/* add_property_long(return_value, "zerofill", (fbsql_field->flags&ZEROFILL_FLAG?1:0)); */
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_field_seek(int result [, int field_index])
- ??? */
-PHP_FUNCTION(fbsql_field_seek)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **field_index = NULL;
- int column = -1;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &field_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- column = result->columnIndex;
- if (field_index)
- {
- convert_to_long_ex(field_index);
- column = Z_LVAL_PP(field_index);
- if (column < 0 || column >= result->columnCount)
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d no such column in result", column);
- RETURN_FALSE;
- }
- }
-
- result->columnIndex = column;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string fbsql_field_name(int result [, int field_index])
- Get the column name for a specified field_index */
-PHP_FUNCTION(fbsql_field_name)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **field_index = NULL;
- int column = -1;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &field_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- column = result->columnIndex;
- if (field_index)
- {
- convert_to_long_ex(field_index);
- column = Z_LVAL_PP(field_index);
- if (column < 0 || column >= result->columnCount)
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d no such column in result", column);
- RETURN_FALSE;
- }
- }
- if (result->list)
- {
- phpfbSqlResult(INTERNAL_FUNCTION_PARAM_PASSTHRU, result, result->rowIndex, 0);
- }
- else if (result->metaData)
- {
- RETURN_STRING((char *)fbccmdLabelName(fbcmdColumnMetaDataAtIndex(result->metaData, column)), 1);
- result->columnIndex = column;
- }
-}
-/* }}} */
-
-/* {{{ proto string fbsql_field_table(int result [, int field_index])
- Get the table name for a specified field_index */
-PHP_FUNCTION(fbsql_field_table)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **field_index = NULL;
- int column = -1;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &field_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- column = result->columnIndex;
- if (field_index)
- {
- convert_to_long_ex(field_index);
- column = Z_LVAL_PP(field_index);
- if (column < 0 || column >= result->columnCount)
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d no such column in result", column);
- RETURN_FALSE;
- }
- }
- RETURN_STRING((char *)fbccmdTableName(fbcmdColumnMetaDataAtIndex(result->metaData, column)), 1);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_field_len(int result [, int field_index])
- Get the column length for a specified field_index */
-PHP_FUNCTION(fbsql_field_len)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **field_index = NULL;
- int column = -1;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &field_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- column = result->columnIndex;
- if (field_index)
- {
- convert_to_long_ex(field_index);
- column = Z_LVAL_PP(field_index);
- if (column < 0 || column >= result->columnCount)
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d no such column in result", column);
- RETURN_FALSE;
- }
- }
- if (result->list)
- {
- phpfbSqlResult(INTERNAL_FUNCTION_PARAM_PASSTHRU, result, result->rowIndex, 2);
- }
- else if (result->metaData)
- {
- RETURN_LONG(fbcdmdLength(fbccmdDatatype(fbcmdColumnMetaDataAtIndex(result->metaData, column))));
- }
- else
- {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string fbsql_field_type(int result [, int field_index])
- Get the field type for a specified field_index */
-PHP_FUNCTION(fbsql_field_type)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **field_index = NULL;
- int column = -1;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &field_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- column = result->columnIndex;
- if (field_index)
- {
- convert_to_long_ex(field_index);
- column = Z_LVAL_PP(field_index);
- if (column < 0 || column >= result->columnCount)
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d no such column in result", column);
- RETURN_FALSE;
- }
- }
- if (result->list)
- {
- phpfbSqlResult(INTERNAL_FUNCTION_PARAM_PASSTHRU, result, result->rowIndex, 1);
- }
- else if (result->metaData)
- {
- RETURN_STRING((char *)fbcdmdDatatypeString (fbcmdDatatypeMetaDataAtIndex(result->metaData, column)), 1);
- }
- else
- {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string fbsql_field_flags(int result [, int field_index])
- ??? */
-PHP_FUNCTION(fbsql_field_flags)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **field_index = NULL;
- int column = -1;
- char buf[512];
- int len;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &field_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- column = result->columnIndex;
- if (field_index)
- {
- convert_to_long_ex(field_index);
- column = Z_LVAL_PP(field_index);
- if (column < 0 || column >= result->columnCount)
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d no such column in result", column);
- RETURN_FALSE;
- }
- }
- strcpy(buf, "");
- if (!fbccmdIsNullable(fbcmdColumnMetaDataAtIndex(result->metaData, column))) {
- strcat(buf, "not_null ");
- }
-#if 0
- if (IS_PRI_KEY(fbsql_field->flags)) {
- strcat(buf, "primary_key ");
- }
- if (fbsql_field->flags&UNIQUE_KEY_FLAG) {
- strcat(buf, "unique_key ");
- }
- if (fbsql_field->flags&MULTIPLE_KEY_FLAG) {
- strcat(buf, "multiple_key ");
- }
- if (IS_BLOB(fbsql_field->flags)) {
- strcat(buf, "blob ");
- }
- if (fbsql_field->flags&UNSIGNED_FLAG) {
- strcat(buf, "unsigned ");
- }
- if (fbsql_field->flags&ZEROFILL_FLAG) {
- strcat(buf, "zerofill ");
- }
- if (fbsql_field->flags&BINARY_FLAG) {
- strcat(buf, "binary ");
- }
- if (fbsql_field->flags&ENUM_FLAG) {
- strcat(buf, "enum ");
- }
- if (fbsql_field->flags&AUTO_INCREMENT_FLAG) {
- strcat(buf, "auto_increment ");
- }
- if (fbsql_field->flags&TIMESTAMP_FLAG) {
- strcat(buf, "timestamp ");
- }
-#endif
- len = strlen(buf);
- /* remove trailing space, if present */
- if (len && buf[len-1] == ' ') {
- buf[len-1] = 0;
- len--;
- }
- RETURN_STRING(buf, 1);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_table_name(resource result, int index)
- Retreive the table name for index after a call to fbsql_list_tables() */
-PHP_FUNCTION(fbsql_table_name)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **table_index;
- unsigned index;
- char* value;
- unsigned int length;
- void** row;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &table_index)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(table_index);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- index = Z_LVAL_PP(table_index);
- if (index < 0)
- {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal index (%i)", index);
- RETURN_FALSE;
- }
-
- if (result->rowCount == 0x7fffffff) phpfbFetchRow(result, index);
- if (index > result->rowCount) RETURN_FALSE;
- result->rowIndex = index;
- result->columnIndex = 0;
-
- row = fbcrhRowAtIndex(result->rowHandler, index);
- phpfbColumnAsString(result, 0, row[0], &length, &value TSRMLS_CC);
- RETURN_STRINGL(value, length, 1);
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_free_result(resource result)
- free the memory used to store a result */
-PHP_FUNCTION(fbsql_free_result)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- zend_list_delete(Z_LVAL_PP(fbsql_result_index));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array fbsql_get_autostart_info([resource link_identifier])
- ??? */
-PHP_FUNCTION(fbsql_get_autostart_info)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL;
- int id;
- FBCAutoStartInfo* asInfo;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- if (phpLink->execHandler == NULL) {
- if (FB_SQL_G(generateWarnings))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No valid Exec handler available for this connection");
- RETURN_FALSE;
- }
- else {
- array_init(return_value);
- asInfo = fbcehGetAutoStartInfo(phpLink->execHandler);
- if (asInfo != NULL) {
- unsigned i;
-
- for (i=0; i<fbaCount(asInfo->infoLines); i++) {
- FBArray* infoLine = fbaObjectAtIndex(asInfo->infoLines, i);
-/*
- if (fbaCount(infoLine) == 2) {
- fbaObjectAtIndex(infoLine, 0);
- fbaObjectAtIndex(infoLine, 1);
- }
- else {
-*/
- add_index_string(return_value, i, fbaObjectAtIndex(infoLine, 0), 1);
-/* }
- */
-
- }
- }
- }
-}
-/* }}} */
-
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/fbsql/php_fbsql.h b/ext/fbsql/php_fbsql.h
deleted file mode 100644
index 1d910e2984..0000000000
--- a/ext/fbsql/php_fbsql.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Frank M. Kromann <frank@frontbase.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#define HAVE_FBSQL 1
-
-#ifndef _PHP_FBSQL_H
-#define _PHP_FBSQL_H
-
-#if COMPILE_DL_FBSQL
-#undef HAVE_FBSQL
-#define HAVE_FBSQL 1
-#endif
-#if HAVE_FBSQL
-
-extern zend_module_entry fbsql_module_entry;
-#define fbsql_module_ptr &fbsql_module_entry
-
-#include <FBCAccess/FBCAccess.h>
-
-PHP_MINIT_FUNCTION(fbsql);
-PHP_MSHUTDOWN_FUNCTION(fbsql);
-PHP_RINIT_FUNCTION(fbsql);
-PHP_RSHUTDOWN_FUNCTION(fbsql);
-PHP_MINFO_FUNCTION(fbsql);
-PHP_FUNCTION(fbsql_connect);
-PHP_FUNCTION(fbsql_pconnect);
-PHP_FUNCTION(fbsql_close);
-PHP_FUNCTION(fbsql_select_db);
-PHP_FUNCTION(fbsql_change_user);
-PHP_FUNCTION(fbsql_create_db);
-PHP_FUNCTION(fbsql_drop_db);
-PHP_FUNCTION(fbsql_start_db);
-PHP_FUNCTION(fbsql_stop_db);
-PHP_FUNCTION(fbsql_db_status);
-PHP_FUNCTION(fbsql_query);
-PHP_FUNCTION(fbsql_db_query);
-PHP_FUNCTION(fbsql_list_dbs);
-PHP_FUNCTION(fbsql_list_tables);
-PHP_FUNCTION(fbsql_list_fields);
-PHP_FUNCTION(fbsql_error);
-PHP_FUNCTION(fbsql_errno);
-PHP_FUNCTION(fbsql_affected_rows);
-PHP_FUNCTION(fbsql_insert_id);
-PHP_FUNCTION(fbsql_result);
-PHP_FUNCTION(fbsql_next_result);
-PHP_FUNCTION(fbsql_num_rows);
-PHP_FUNCTION(fbsql_num_fields);
-PHP_FUNCTION(fbsql_fetch_row);
-PHP_FUNCTION(fbsql_fetch_array);
-PHP_FUNCTION(fbsql_fetch_assoc);
-PHP_FUNCTION(fbsql_fetch_object);
-PHP_FUNCTION(fbsql_data_seek);
-PHP_FUNCTION(fbsql_fetch_lengths);
-PHP_FUNCTION(fbsql_fetch_field);
-PHP_FUNCTION(fbsql_field_seek);
-PHP_FUNCTION(fbsql_free_result);
-PHP_FUNCTION(fbsql_field_name);
-PHP_FUNCTION(fbsql_field_table);
-PHP_FUNCTION(fbsql_field_len);
-PHP_FUNCTION(fbsql_field_type);
-PHP_FUNCTION(fbsql_field_flags);
-PHP_FUNCTION(fbsql_table_name);
-
-PHP_FUNCTION(fbsql_set_transaction);
-PHP_FUNCTION(fbsql_autocommit);
-PHP_FUNCTION(fbsql_commit);
-PHP_FUNCTION(fbsql_rollback);
-
-PHP_FUNCTION(fbsql_create_blob);
-PHP_FUNCTION(fbsql_create_clob);
-PHP_FUNCTION(fbsql_set_lob_mode);
-PHP_FUNCTION(fbsql_read_blob);
-PHP_FUNCTION(fbsql_read_clob);
-PHP_FUNCTION(fbsql_blob_size);
-PHP_FUNCTION(fbsql_clob_size);
-
-PHP_FUNCTION(fbsql_hostname);
-PHP_FUNCTION(fbsql_database);
-PHP_FUNCTION(fbsql_database_password);
-PHP_FUNCTION(fbsql_username);
-PHP_FUNCTION(fbsql_password);
-PHP_FUNCTION(fbsql_warnings);
-
-PHP_FUNCTION(fbsql_get_autostart_info);
-/* PHP_FUNCTION(fbsql_set_autostart_info); */
-
-static void php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type);
-static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent);
-
-ZEND_BEGIN_MODULE_GLOBALS(fbsql)
- zend_bool allowPersistent;
- zend_bool generateWarnings;
- zend_bool autoCommit;
- long maxPersistent;
- long maxLinks;
- long maxConnections;
- long maxResults;
- long batchSize;
- char *hostName;
- char *databaseName;
- char *databasePassword;
- char *userName;
- char *userPassword;
- long persistentCount;
- long linkCount;
- long linkIndex;
-
-ZEND_END_MODULE_GLOBALS(fbsql)
-
-#ifdef ZTS
-# define FB_SQL_G(v) TSRMG(fbsql_globals_id, zend_fbsql_globals *, v)
-#else
-# define FB_SQL_G(v) (fbsql_globals.v)
-#endif
-
-/*#ifndef ZTS /* No need for external definitions */
-/*extern fbsql_module* phpfbModule; */
-/*#endif */
-
-#else /* HAVE_FBSQL */
-
-#define fbsql_module_ptr NULL
-#error not ok
-#endif /* HAVE_FBSQL */
-
-#define phpext_fbsql_ptr fbsql_module_ptr
-
-#endif /* _PHP_FBSQL_H */
diff --git a/ext/fdf/CREDITS b/ext/fdf/CREDITS
deleted file mode 100644
index 57c33cc4b3..0000000000
--- a/ext/fdf/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-FDF
-Uwe Steinmann
diff --git a/ext/fdf/config.m4 b/ext/fdf/config.m4
deleted file mode 100644
index 31d3e2d70f..0000000000
--- a/ext/fdf/config.m4
+++ /dev/null
@@ -1,73 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(fdftk, for FDF support,
-[ --with-fdftk[=DIR] Include FDF support.])
-
-if test "$PHP_FDFTK" != "no"; then
-
- case $host_os in
- aix*)
- libtype=aix
- ;;
- solaris* )
- libtype=solaris
- ;;
- linux*)
- libtype=linux
- ;;
- *)
- AC_MSG_ERROR([The fdf toolkit is not available for $host_os.])
- ;;
- esac
-
- if test "$PHP_FDFTK" = "yes"; then
- PHP_FDFTK="/usr /usr/local ../FDFToolkitForUNIX ext/fdf/FDFToolkitForUNIX ../fdftk ext/fdf/fdftk"
- fi
-
- for dir in $PHP_FDFTK; do
- for subdir in include HeadersAndLibraries/headers; do
- if test -r $dir/$subdir/FdfTk.h; then
- FDFTK_DIR=$dir
- FDFTK_H_DIR=$dir/$subdir
- break 2
- elif test -r $dir/$subdir/fdftk.h; then
- AC_DEFINE(HAVE_FDFTK_H_LOWER,1,[ ])
- FDFTK_DIR=$dir
- FDFTK_H_DIR=$dir/$subdir
- break 2
- fi
- done
- done
-
- if test -z "$FDFTK_DIR"; then
- AC_MSG_ERROR([FdfTk.h or fdftk.h not found. Please reinstall the fdf toolkit.])
- fi
-
- PHP_ADD_INCLUDE($FDFTK_H_DIR)
-
- FDFLIBRARY=""
- for file in fdftk FdfTk; do
- for dir in $FDFTK_DIR/lib $FDFTK_DIR/HeadersAndLibraries/$libtype/C; do
- if test -r $dir/lib$file.so; then
- PHP_CHECK_LIBRARY($file, FDFOpen, [FDFLIBRARY=$file], [], [-L$dir -lm])
- if test "$FDFLIBRARY"; then
- PHP_CHECK_LIBRARY($file, FDFGetFDFVersion, [AC_DEFINE(HAVE_FDFTK_5,1,[ ])], [], [-L$dir -lm])
- FDFTK_LIB_DIR=$dir
- break 2
- fi
- fi
- done
- done
-
- if test -z "$FDFLIBRARY"; then
- AC_MSG_ERROR(no usable fdf library found)
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH($FDFLIBRARY, $FDFTK_LIB_DIR, FDFTK_SHARED_LIBADD)
-
- PHP_NEW_EXTENSION(fdf, fdf.c, $ext_shared)
- PHP_SUBST(FDFTK_SHARED_LIBADD)
- AC_DEFINE(HAVE_FDFLIB,1,[ ])
-fi
diff --git a/ext/fdf/fdf.c b/ext/fdf/fdf.c
deleted file mode 100644
index 95e8698525..0000000000
--- a/ext/fdf/fdf.c
+++ /dev/null
@@ -1,1594 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de> |
- | Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* FdfTk lib 2.0 is a Complete C/C++ FDF Toolkit available from
- http://beta1.adobe.com/ada/acrosdk/forms.html. */
-
-/* Note that there is no code from the FdfTk lib in this file */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_open_temporary_file.h"
-
-#if HAVE_FDFLIB
-
-#include "SAPI.h"
-#include "ext/standard/info.h"
-#include "php_open_temporary_file.h"
-#include "php_variables.h"
-#include "php_fdf.h"
-
-static int le_fdf;
-
-SAPI_POST_HANDLER_FUNC(fdf_post_handler);
-
-/* {{{ fdf_functions[]
- */
-function_entry fdf_functions[] = {
- PHP_FE(fdf_add_template, NULL)
- PHP_FE(fdf_close, NULL)
- PHP_FE(fdf_create, NULL)
- PHP_FE(fdf_enum_values, NULL)
- PHP_FE(fdf_errno, NULL)
- PHP_FE(fdf_error, NULL)
- PHP_FE(fdf_get_ap, NULL)
- PHP_FE(fdf_get_encoding, NULL)
- PHP_FE(fdf_get_file, NULL)
- PHP_FE(fdf_get_flags, NULL)
- PHP_FE(fdf_get_opt, NULL)
- PHP_FE(fdf_get_status, NULL)
- PHP_FE(fdf_get_value, NULL)
- PHP_FE(fdf_get_version, NULL)
- PHP_FE(fdf_next_field_name, NULL)
- PHP_FE(fdf_open, NULL)
- PHP_FE(fdf_open_string, NULL)
- PHP_FE(fdf_remove_item, NULL)
- PHP_FE(fdf_save, NULL)
- PHP_FE(fdf_save_string, NULL)
- PHP_FE(fdf_set_ap, NULL)
- PHP_FE(fdf_set_encoding, NULL)
- PHP_FE(fdf_set_file, NULL)
- PHP_FE(fdf_set_flags, NULL)
- PHP_FE(fdf_set_javascript_action, NULL)
- PHP_FE(fdf_set_opt, NULL)
- PHP_FE(fdf_set_status, NULL)
- PHP_FE(fdf_set_submit_form_action, NULL)
- PHP_FE(fdf_set_value, NULL)
- PHP_FE(fdf_header, NULL)
-#ifdef HAVE_FDFTK_5
- PHP_FE(fdf_add_doc_javascript, NULL)
- PHP_FE(fdf_get_attachment, NULL)
- PHP_FE(fdf_set_on_import_javascript, NULL)
- PHP_FE(fdf_set_target_frame, NULL)
- PHP_FE(fdf_set_version, NULL)
-#endif
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry fdf_module_entry = {
- STANDARD_MODULE_HEADER,
- "fdf",
- fdf_functions,
- PHP_MINIT(fdf),
- PHP_MSHUTDOWN(fdf),
- PHP_RINIT(fdf),
- NULL,
- PHP_MINFO(fdf),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_FDF
-ZEND_GET_MODULE(fdf)
-#endif
-
-ZEND_DECLARE_MODULE_GLOBALS(fdf)
-
-#define FDF_SUCCESS do { FDF_G(error)=FDFErcOK; RETURN_TRUE;} while(0)
-#define FDF_FAILURE(err) do { FDF_G(error)=err; RETURN_FALSE;} while(0)
-
-static void phpi_FDFClose(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- FDFDoc fdf = (FDFDoc)rsrc->ptr;
-
- (void) FDFClose(fdf);
-}
-
-#define FDF_POST_CONTENT_TYPE "application/vnd.fdf"
-
-static sapi_post_entry php_fdf_post_entry = {
- FDF_POST_CONTENT_TYPE,
- sizeof(FDF_POST_CONTENT_TYPE)-1,
- sapi_read_standard_form_data,
- fdf_post_handler
-};
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(fdf)
-{
- le_fdf = zend_register_list_destructors_ex(phpi_FDFClose, NULL, "fdf", module_number);
-
- /* add handler for Acrobat FDF form post requests */
- sapi_register_post_entry(&php_fdf_post_entry);
-
-
- /* Constants used by fdf_set_opt() */
- REGISTER_LONG_CONSTANT("FDFValue", FDFValue, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFStatus", FDFStatus, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFFile", FDFFile, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFID", FDFID, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFFf", FDFFf, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFSetFf", FDFSetFf, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFClearFf", FDFClearFf, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFFlags", FDFFlags, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFSetF", FDFSetF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFClrF", FDFClrF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFAP", FDFAP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFAS", FDFAS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFAction", FDFAction, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFAA", FDFAA, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFAPRef", FDFAPRef, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFIF", FDFIF, CONST_CS | CONST_PERSISTENT);
-
- /* Constants used by fdf_set_javascript_action() */
- REGISTER_LONG_CONSTANT("FDFEnter", FDFEnter, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFExit", FDFExit, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFDown", FDFDown, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFUp", FDFUp, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFFormat", FDFFormat, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFValidate", FDFValidate, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFKeystroke", FDFKeystroke, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFCalculate", FDFCalculate, CONST_CS | CONST_PERSISTENT);
-
- /* Constants used by fdf_(set|get)_ap */
- REGISTER_LONG_CONSTANT("FDFNormalAP", 1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFRolloverAP", 2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFDownAP", 3, CONST_CS | CONST_PERSISTENT);
-
-#ifdef PHP_WIN32
- return SUCCESS;
-#else
- return (FDFInitialize() == FDFErcOK) ? SUCCESS : FAILURE;
-#endif
-}
-/* }}} */
-
-/* {{{ RINIT */
-PHP_RINIT_FUNCTION(fdf)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(fdf)
-{
- /* need to use a PHPAPI function here because it is external module in windows */
- php_info_print_table_start();
- php_info_print_table_row(2, "FDF Support", "enabled");
- php_info_print_table_row(2, "FdfTk Version", FDFGetVersion() );
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(fdf)
-{
- /* remove handler for Acrobat FDF form post requests */
- sapi_unregister_post_entry(&php_fdf_post_entry);
-
-#ifdef PHP_WIN32
- return SUCCESS;
-#else
- return (FDFFinalize() == FDFErcOK) ? SUCCESS : FAILURE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto resource fdf_open(string filename)
- Opens a new FDF document */
-PHP_FUNCTION(fdf_open)
-{
- zval **file;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(file);
-
- err = FDFOpen(Z_STRVAL_PP(file), 0, &fdf);
-
- if(err != FDFErcOK || !fdf) {
- if(err == FDFErcOK) err= FDFErcInternalError;
- FDF_FAILURE(err);
- }
-
- ZEND_REGISTER_RESOURCE(return_value, fdf, le_fdf);
-}
-/* }}} */
-
-/* {{{ proto resource fdf_open_string(string fdf_data)
- Opens a new FDF document from string */
-PHP_FUNCTION(fdf_open_string)
-{
- char *fdf_data;
- int fdf_data_len;
- FDFDoc fdf;
- FDFErc err;
- char *temp_filename;
- FILE *fp;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
- &fdf_data, &fdf_data_len)
- == FAILURE) {
- return;
- }
-
- fp = php_open_temporary_file(PG(upload_tmp_dir), "php", &temp_filename TSRMLS_CC);
- if(!fp) {
- RETURN_FALSE;
- }
- fwrite(fdf_data, fdf_data_len, 1, fp);
- fclose(fp);
-
- err = FDFOpen(temp_filename, 0, &fdf);
- unlink(temp_filename);
- efree(temp_filename);
-
- if(err != FDFErcOK || !fdf) {
- if(err == FDFErcOK) err= FDFErcInternalError;
- FDF_FAILURE(err);
- }
-
- ZEND_REGISTER_RESOURCE(return_value, fdf, le_fdf);
-}
-/* }}} */
-
-/* {{{ proto resource fdf_create(void)
- Creates a new FDF document */
-PHP_FUNCTION(fdf_create)
-{
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- err = FDFCreate(&fdf);
-
- if(err != FDFErcOK || !fdf) {
- if(err == FDFErcOK) err= FDFErcInternalError;
- FDF_FAILURE(err);
- }
-
- ZEND_REGISTER_RESOURCE(return_value, fdf, le_fdf);
-}
-/* }}} */
-
-/* {{{ proto bool fdf_close(resource fdfdoc)
- Closes the FDF document */
-PHP_FUNCTION(fdf_close)
-{
- zval **fdfp;
- FDFDoc fdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fdfp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
- zend_list_delete(Z_RESVAL_PP(fdfp));
-}
-/* }}} */
-
-/* {{{ proto string fdf_get_value(resource fdfdoc, string fieldname [, int which])
- Gets the value of a field as string */
-PHP_FUNCTION(fdf_get_value)
-{
- zval *r_fdf;
- char *fieldname;
- int fieldname_len;
- long which = -1;
- FDFDoc fdf;
- FDFErc err;
- ASInt32 nr, size = 256;
- char *buffer;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l",
- &r_fdf, &fieldname, &fieldname_len,
- &which)
- == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
-
- buffer = emalloc(size);
- if(which >= 0) {
-#if HAVE_FDFTK_5
- err = FDFGetNthValue(fdf, fieldname, which, buffer, size-2, &nr);
-#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "the optional 'which' parameter requires FDF toolkit 5.0 or above, it will be ignored for now");
- which = -1;
-#endif
- } else {
- err = FDFGetValue(fdf, fieldname, buffer, size-2, &nr);
- }
- if(err == FDFErcBufTooShort && nr > 0 ) {
- buffer = erealloc(buffer, nr+2);
- if(which >= 0) {
-#if HAVE_FDFTK_5
- err = FDFGetNthValue(fdf, fieldname, which, buffer, nr, &nr);
-#endif
- } else {
- err = FDFGetValue(fdf, fieldname, buffer, nr, &nr);
- }
-#if HAVE_FDFTK_5
- } else if((err == FDFErcValueIsArray) && (which == -1)) {
- array_init(return_value);
- which = 0;
- do {
- err = FDFGetNthValue(fdf, fieldname, which, buffer, size-2, &nr);
- if(err == FDFErcBufTooShort && nr > 0 ) {
- buffer = erealloc(buffer, nr+2);
- err = FDFGetNthValue(fdf, fieldname, which, buffer, nr, &nr);
- }
- if (err == FDFErcOK) {
- add_next_index_string(return_value, buffer, 1);
- }
- which++;
- } while (err == FDFErcOK);
- if(err == FDFErcNoValue) err = FDFErcOK;
- efree(buffer);
- buffer = NULL;
-#endif
- }
-
- if(err != FDFErcOK) {
- if(buffer) efree(buffer);
- FDF_FAILURE(err);
- }
-
- if(buffer) {
- RETVAL_STRING(buffer, 1);
- efree(buffer);
- }
-
- return;
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_value(resource fdfdoc, string fieldname, mixed value [, int isname])
- Sets the value of a field */
-PHP_FUNCTION(fdf_set_value)
-{
- zval **fdfp, **fieldname, **value, **dummy;
- FDFDoc fdf;
- FDFErc err;
-
- switch(ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &fdfp, &fieldname, &value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 4:
- if (zend_get_parameters_ex(4, &fdfp, &fieldname, &value, &dummy) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(fieldname);
-
- if (Z_TYPE_PP(value) == IS_ARRAY) {
-#ifdef HAVE_FDFTK_5
- ASInt32 nValues = zend_hash_num_elements(Z_ARRVAL_PP(value));
- char **newValues = ecalloc(nValues, sizeof(char *)), **next;
- HashPosition pos;
- zval **tmp;
-
- next = newValues;
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(value), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(value),
- (void **) &tmp,
- &pos) == SUCCESS) {
- convert_to_string_ex(tmp);
- *next++ = estrdup(Z_STRVAL_PP(tmp));
- zend_hash_move_forward_ex(Z_ARRVAL_PP(value), &pos);
- }
-
- err = FDFSetValues(fdf, Z_STRVAL_PP(fieldname), nValues, (const char **)newValues);
-
- for(next = newValues; nValues; nValues--) {
- efree(*next++);
- }
- efree(newValues);
-#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "setting array values is only possible with FDF toolkit 5.0 and above");
- RETURN_FALSE;
-#endif
- } else {
- convert_to_string_ex(value);
-
- err = FDFSetValue(fdf, Z_STRVAL_PP(fieldname), Z_STRVAL_PP(value), (ASBool)0 /*dummy*/);
- }
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
- FDF_SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto string fdf_next_field_name(resource fdfdoc [, string fieldname])
- Gets the name of the next field name or the first field name */
-PHP_FUNCTION(fdf_next_field_name)
-{
- zval **fdfp, **field;
- int argc=ZEND_NUM_ARGS();
- ASInt32 length=256, nr;
- char *buffer=NULL, *fieldname=NULL;
- FDFDoc fdf;
- FDFErc err;
-
- if (argc > 2 || argc < 1 || zend_get_parameters_ex(argc, &fdfp, &field) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- if(argc == 2) {
- convert_to_string_ex(field);
- fieldname = Z_STRVAL_PP(field);
- }
-
- buffer = emalloc(length);
- err = FDFNextFieldName(fdf, fieldname, buffer, length-1, &nr);
-
- if(err == FDFErcBufTooShort && nr > 0 ) {
- buffer = erealloc(buffer, nr+1);
- err = FDFNextFieldName(fdf, fieldname, buffer, length-1, &nr);
- }
-
- if(err != FDFErcOK) {
- efree(buffer);
- FDF_FAILURE(err);
- }
-
- RETVAL_STRING(buffer, 1);
- efree(buffer);
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_ap(resource fdfdoc, string fieldname, int face, string filename, int pagenr)
- Sets the appearence of a field */
-PHP_FUNCTION(fdf_set_ap)
-{
- zval **fdfp, **fieldname, **face, **filename, **pagenr;
- FDFDoc fdf;
- FDFErc err;
- FDFAppFace facenr;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &fdfp, &fieldname, &face, &filename, &pagenr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(fieldname);
- convert_to_long_ex(face);
- convert_to_string_ex(filename);
- convert_to_long_ex(pagenr);
-
- switch(Z_LVAL_PP(face)) {
- case 1:
- facenr = FDFNormalAP;
- break;
- case 2:
- facenr = FDFRolloverAP;
- break;
- case 3:
- facenr = FDFDownAP;
- break;
- default:
- facenr = FDFNormalAP;
- break;
- }
-
- err = FDFSetAP(fdf, Z_STRVAL_PP(fieldname), facenr, NULL, Z_STRVAL_PP(filename), (ASInt32) Z_LVAL_PP(pagenr));
-
- /* This should be made more intelligent, ie. use switch() with the
- possible errors this function can return. Or create global error handler function.
- */
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
-
- FDF_SUCCESS;
-
-}
-/* }}} */
-
-/* {{{ proto bool fdf_get_ap(resource fdfdoc, string fieldname, int face, string filename)
- Gets the appearance of a field and creates a PDF document out of it. */
-PHP_FUNCTION(fdf_get_ap) {
- zval *r_fdf;
- char *fieldname, *filename;
- int fieldname_len, filename_len;
- long face;
- FDFDoc fdf;
- FDFErc err;
- FDFAppFace facenr;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsls",
- &r_fdf, &fieldname, &fieldname_len,
- &face, &filename, &filename_len)
- == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
-
- switch(face) {
- case 1:
- facenr = FDFNormalAP;
- break;
- case 2:
- facenr = FDFRolloverAP;
- break;
- case 3:
- facenr = FDFDownAP;
- break;
- default:
- facenr = FDFNormalAP;
- break;
- }
-
- err = FDFGetAP(fdf, fieldname, facenr, filename);
-
- /* This should be made more intelligent, ie. use switch() with the
- possible errors this function can return. Or create global error handler function.
- */
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
-
- FDF_SUCCESS;
-
-
-}
-/* }}} */
-
-/* {{{ proto string fdf_get_encoding(resource fdf)
- Gets FDF file encoding scheme */
-PHP_FUNCTION(fdf_get_encoding) {
- zval *r_fdf;
- FDFDoc fdf;
- FDFErc err;
- char buffer[32];
- ASInt32 len;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r",
- &r_fdf) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
-
- err = FDFGetEncoding(fdf, buffer, 32, &len);
-
- /* This should be made more intelligent, ie. use switch() with the
- possible errors this function can return. Or create global error handler function.
- */
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
-
- FDF_G(error) = FDFErcOK;
- RETURN_STRINGL(buffer, (size_t)len, 1);
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_status(resource fdfdoc, string status)
- Sets the value of /Status key */
-PHP_FUNCTION(fdf_set_status)
-{
- zval **fdfp, **status;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fdfp, &status) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(status);
-
- err = FDFSetStatus(fdf, Z_STRVAL_PP(status));
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
-
- FDF_SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto string fdf_get_status(resource fdfdoc)
- Gets the value of /Status key */
-PHP_FUNCTION(fdf_get_status)
-{
- zval **fdfp;
- ASInt32 nr, size = 256;
- char *buf;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fdfp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- buf = emalloc(size);
- err = FDFGetStatus(fdf, buf, size-1, &nr);
-
- if(err == FDFErcBufTooShort && nr > 0 ) {
- buf = erealloc(buf, nr+1);
- err = FDFGetStatus(fdf, buf, size-1, &nr);
- }
-
- if(err != FDFErcOK) {
- efree(buf);
- FDF_FAILURE(err);
- }
-
- RETVAL_STRING(buf, 1);
- efree(buf);
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_file(resource fdfdoc, string filename [, string target_frame])
- Sets the value of /F key */
-PHP_FUNCTION(fdf_set_file)
-{
- zval *r_fdf;
- char *filename, *target_frame= NULL;
- int filename_len, target_frame_len;
- FDFDoc fdf;
- FDFErc err;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|s", &r_fdf,
- &filename, &filename_len,
- &target_frame, &target_frame_len)
- == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
-
- err = FDFSetFile(fdf, filename);
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
- if(target_frame) {
-#ifdef HAVE_FDFTK_5
- err = FDFSetTargetFrame(fdf, target_frame);
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
-#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "setting the target frame is only possible with FDF toolkit 5.0 and above, ignoring it for now");
-#endif
- }
-
- FDF_SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto string fdf_get_file(resource fdfdoc)
- Gets the value of /F key */
-PHP_FUNCTION(fdf_get_file)
-{
- zval **fdfp;
- ASInt32 nr, size = 256;
- char *buf;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fdfp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- buf = emalloc(size);
- err = FDFGetFile(fdf, buf, size-1, &nr);
-
- if(err == FDFErcBufTooShort && nr > 0 ) {
- buf = erealloc(buf, nr+1);
- err = FDFGetFile(fdf, buf, size-1, &nr);
- }
-
- if(err != FDFErcOK) {
- efree(buf);
- FDF_FAILURE(err);
- }
-
- RETVAL_STRING(buf, 1);
- efree(buf);
-}
-/* }}} */
-
-/* {{{ proto mixed fdf_save(resource fdfdoc [, string filename])
- Writes out the FDF file */
-PHP_FUNCTION(fdf_save)
-{
- zval *r_fdf;
- char *filename = NULL;
- int filename_len;
- FDFDoc fdf;
- FDFErc err;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|s", &r_fdf, &filename, &filename_len)
- == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
-
- if(filename) {
- err = FDFSave(fdf, filename);
- } else {
- FILE *fp;
- char *temp_filename;
-
- fp = php_open_temporary_file(PG(upload_tmp_dir), "php", &temp_filename TSRMLS_CC);
- if(!fp) {
- err = FDFErcFileSysErr;
- } else {
- fclose(fp);
- err = FDFSave(fdf, temp_filename);
-
- if(err == FDFErcOK) {
- php_stream *stream = php_stream_open_wrapper(temp_filename, "rb", 0, NULL);
- if (stream) {
- php_stream_passthru(stream);
- php_stream_close(stream);
- } else {
- err = FDFErcFileSysErr;
- }
- }
- }
- if(temp_filename) {
- unlink(temp_filename);
- efree(temp_filename);
- }
- }
-
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
-
- FDF_SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto mixed fdf_save_string(resource fdfdoc)
- Returns the FDF file as a string */
-PHP_FUNCTION(fdf_save_string)
-{
- zval *r_fdf;
- FDFDoc fdf;
- FDFErc err;
- FILE *fp;
- char *temp_filename = NULL;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &r_fdf)
- == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
-
- fp = php_open_temporary_file(PG(upload_tmp_dir), "php", &temp_filename TSRMLS_CC);
- if(!fp) {
- err = FDFErcFileSysErr;
- } else {
- fclose(fp);
- err = FDFSave(fdf, temp_filename);
-
- if(err == FDFErcOK) {
- fp = fopen(temp_filename, "rb");
- if (fp) {
- struct stat stat;
- char *buf;
-
- fstat(fileno(fp), &stat);
- buf = emalloc(stat.st_size +1);
- fread(buf, stat.st_size, 1, fp);
- buf[stat.st_size] = '\0';
- fclose(fp);
-
- unlink(temp_filename);
- efree(temp_filename);
- RETURN_STRINGL(buf, stat.st_size, 0);
- } else {
- err = FDFErcFileSysErr;
- }
- }
- }
-
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
-
- if(temp_filename) {
- unlink(temp_filename);
- efree(temp_filename);
- }
-
- return;
-}
-/* }}} */
-
-/* {{{ proto bool fdf_add_template(resource fdfdoc, int newpage, string filename, string template, int rename)
- Adds a template into the FDF document */
-PHP_FUNCTION(fdf_add_template)
-{
- zval **fdfp, **newpage, **filename, **template, **rename;
- FDFDoc fdf;
- FDFErc err;
- pdfFileSpecRec filespec;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &fdfp, &newpage, &filename, &template, &rename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_long_ex(newpage);
- convert_to_string_ex(filename);
- convert_to_string_ex(template);
- convert_to_long_ex(rename);
-
- filespec.FS = NULL;
- filespec.F = Z_STRVAL_PP(filename);
- filespec.Mac = NULL;
- filespec.DOS = NULL;
- filespec.Unix = NULL;
- filespec.ID[0] = NULL;
- filespec.ID[1] = NULL;
- filespec.bVolatile = false;
-
- err = FDFAddTemplate(fdf, (unsigned short)(Z_LVAL_PP(newpage)), &filespec, Z_STRVAL_PP(template), (unsigned short)(Z_LVAL_PP(rename)));
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
-
- FDF_SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_flags(resource fdfdoc, string fieldname, int whichflags, int newflags)
- Sets flags for a field in the FDF document */
-PHP_FUNCTION(fdf_set_flags)
-{
- zval **fdfp, **fieldname, **flags, **newflags;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &fdfp, &fieldname, &flags, &newflags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(fieldname);
- convert_to_long_ex(flags);
- convert_to_long_ex(newflags);
-
- err=FDFSetFlags(fdf, Z_STRVAL_PP(fieldname), Z_LVAL_PP(flags), Z_LVAL_PP(newflags));
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
-
- FDF_SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto int fdf_get_flags(resorce fdfdoc, string fieldname, int whichflags)
- Gets the flags of a field */
-PHP_FUNCTION(fdf_get_flags) {
- zval *r_fdf;
- char *fieldname;
- int fieldname_len;
- long whichflags;
- FDFDoc fdf;
- FDFErc err;
- ASUns32 flags;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsl",
- &r_fdf, &fieldname, &fieldname_len,
- &whichflags)
- == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
-
- err = FDFGetFlags(fdf, fieldname, (FDFItem)whichflags, &flags);
-
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
-
- RETURN_LONG((long)flags);
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_opt(resource fdfdoc, string fieldname, int element, string value, string name)
- Sets a value in the opt array for a field */
-PHP_FUNCTION(fdf_set_opt)
-{
- zval **fdfp, **fieldname, **element, **value, **name;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &fdfp, &fieldname, &element, &value, &name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(fieldname);
- convert_to_long_ex(element);
- convert_to_string_ex(value);
- convert_to_string_ex(name);
-
- err = FDFSetOpt(fdf, Z_STRVAL_PP(fieldname), Z_LVAL_PP(element), Z_STRVAL_PP(value), Z_STRVAL_PP(name));
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
- FDF_SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto mixed fdf_get_opt(resource fdfdof, string fieldname [, int element])
- Gets a value from the opt array of a field */
-PHP_FUNCTION(fdf_get_opt) {
- zval *r_fdf;
- char *fieldname;
- int fieldname_len;
- long element = -1;
- FDFDoc fdf;
- FDFErc err;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l",
- &r_fdf, &fieldname, &fieldname_len,
- &element)
- == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
-
- if(element == -1) {
- ASInt32 elements;
- err = FDFGetOpt(fdf, fieldname, (ASInt32)-1, NULL, NULL, 0, &elements);
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
- RETURN_LONG((long)elements);
- } else {
- ASInt32 bufSize, nRet;
- char *buf1, *buf2;
-
- bufSize = 1024;
- buf1 = emalloc(bufSize);
- buf2 = emalloc(bufSize);
-
- err = FDFGetOpt(fdf, fieldname, (ASInt32)element, buf1, buf2, bufSize, &nRet);
- if(err == FDFErcBufTooShort) {
- efree(buf1);
- efree(buf2);
- buf1 = emalloc(nRet);
- buf2 = emalloc(nRet);
- bufSize = nRet;
- err = FDFGetOpt(fdf, fieldname, (ASInt32)element, buf1, buf2, bufSize, &nRet);
- }
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
- array_init(return_value);
- add_next_index_stringl(return_value, buf1, strlen(buf1), 1);
- add_next_index_stringl(return_value, buf2, strlen(buf2), 1);
- efree(buf1);
- efree(buf2);
- }
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_submit_form_action(resource fdfdoc, string fieldname, int whichtrigger, string url, int flags)
- Sets the submit form action for a field */
-PHP_FUNCTION(fdf_set_submit_form_action)
-{
- zval **fdfp, **fieldname, **trigger, **url, **flags;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &fdfp, &fieldname, &trigger, &url, &flags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(fieldname);
- convert_to_long_ex(trigger);
- convert_to_string_ex(url);
- convert_to_long_ex(flags);
-
- err = FDFSetSubmitFormAction(fdf, Z_STRVAL_PP(fieldname), Z_LVAL_PP(trigger), Z_STRVAL_PP(url), Z_LVAL_PP(flags));
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
- FDF_SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_javascript_action(resource fdfdoc, string fieldname, int whichtrigger, string script)
- Sets the javascript action for a field */
-PHP_FUNCTION(fdf_set_javascript_action)
-{
- zval **fdfp, **fieldname, **trigger, **script;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &fdfp, &fieldname, &trigger, &script) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(fieldname);
- convert_to_long_ex(trigger);
- convert_to_string_ex(script);
-
- err = FDFSetJavaScriptAction(fdf, Z_STRVAL_PP(fieldname), Z_LVAL_PP(trigger), Z_STRVAL_PP(script));
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
- FDF_SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_encoding(resource fdf_document, string encoding)
- Sets FDF encoding (either "Shift-JIS" or "Unicode") */
-PHP_FUNCTION(fdf_set_encoding)
-{
- zval **fdfp, **enc;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fdfp, &enc) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(enc);
-
- err = FDFSetEncoding(fdf, Z_STRVAL_PP(enc));
-
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
- FDF_SUCCESS;
-}
-/* }}} */
-
-/* {{{ SAPI_POST_HANDLER_FUNC
- * SAPI post handler for FDF forms */
-SAPI_POST_HANDLER_FUNC(fdf_post_handler)
-{
- FILE *fp;
- FDFDoc theFDF;
- char *name=NULL, *value=NULL, *p, *data;
- int name_len=0, value_len=0;
- char *lastfieldname =NULL;
- char *filename = NULL;
- FDFErc err;
- ASInt32 nBytes;
- zval *array_ptr = (zval *) arg;
-
- fp=php_open_temporary_file(NULL, "fdfdata.", &filename TSRMLS_CC);
- if(!fp) {
- if(filename) efree(filename);
- return;
- }
- fwrite(SG(request_info).post_data, SG(request_info).post_data_length, 1, fp);
- fclose(fp);
-
- /* Set HTTP_FDF_DATA variable */
- data = estrndup(SG(request_info).post_data, SG(request_info).post_data_length);
- SET_VAR_STRINGL("HTTP_FDF_DATA", data, SG(request_info).post_data_length);
-
- err = FDFOpen(filename, 0, &theFDF);
-
- if(err==FDFErcOK){
- name = emalloc(name_len=256);
- value= emalloc(value_len=256);
- while (1) {
- err = FDFNextFieldName(theFDF, lastfieldname, name, name_len-1, &nBytes);
- if(err == FDFErcBufTooShort && nBytes >0 ) {
- name = erealloc(name, name_len=(nBytes+1));
- err = FDFNextFieldName(theFDF, lastfieldname, name, name_len-1, &nBytes);
- }
-
- if(err != FDFErcOK || nBytes == 0) break;
-
- if(lastfieldname) efree(lastfieldname);
- lastfieldname = estrdup(name);
-
- err = FDFGetValue(theFDF, name, NULL, 0, &nBytes);
- if(err != FDFErcOK && err != FDFErcNoValue ) break;
-
- if(value_len<nBytes+1) value = erealloc(value, value_len=(nBytes+1));
-
- if(nBytes>0) {
- err = FDFGetValue(theFDF, name, value, value_len-1, &nBytes);
- if(err == FDFErcOK && nBytes != 0) {
- for(p=value;*p;p++) if(*p=='\r') *p='\n';
- if(lastfieldname) efree(lastfieldname);
- lastfieldname = estrdup(name);
- php_register_variable(name, value, array_ptr TSRMLS_CC);
- }
- }
- }
-
- FDFClose(theFDF);
- VCWD_UNLINK((const char *)filename);
- efree(filename);
-
- if(name) efree(name);
- if(value) efree(value);
- if(lastfieldname) efree(lastfieldname);
- }
-}
-/* }}} */
-
-/* {{{ proto int fdf_errno(void)
- Gets error code for last operation */
-PHP_FUNCTION(fdf_errno) {
- RETURN_LONG((long)FDF_G(error));
-}
-/* }}} */
-
-/* {{{ proto string fdf_error([int errno])
- Gets error description for error code */
-PHP_FUNCTION(fdf_error) {
- FDFErc err;
- long p_err = -1;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &p_err)
- == FAILURE) {
- return;
- }
-
- err = (p_err >= 0) ? (FDFErc)p_err : FDF_G(error);
-
- switch(err) {
- case FDFErcOK:
- RETURN_STRING("no error", 1);
- case FDFErcInternalError:
- RETURN_STRING("An internal FDF Library error occurred", 1);
- case FDFErcBadParameter:
- RETURN_STRING("One or more of the parameters passed were invalid. ", 1);
- case FDFErcFileSysErr:
- RETURN_STRING("A file system error occurred or the file was not found", 1);
- case FDFErcBadFDF:
- RETURN_STRING("The FDF file being opened or parsed was invalid", 1);
- case FDFErcFieldNotFound:
- RETURN_STRING("The field whose name was passed in the parameter fieldName does not exist in the FDF file", 1);
- case FDFErcNoValue:
- RETURN_STRING("The field whose value was requested has no value", 1);
- case FDFErcEnumStopped:
- RETURN_STRING("Enumeration was stopped by FDFEnumValues by returning FALSE", 1);
- case FDFErcCantInsertField:
- RETURN_STRING("The field whose name was passed in the parameter fieldName cannot be inserted into the FDF file", 1);
- case FDFErcNoOption:
- RETURN_STRING("The requested element in a fields /Opt key does not exist, or the field has no /Opt key. ", 1);
- case FDFErcNoFlags:
- RETURN_STRING("The field has no /F or /Ff keys", 1);
- case FDFErcBadPDF:
- RETURN_STRING("The PDF file passed as the parameter to FDFSetAP was invalid, or did not contain the requested page ", 1);
- case FDFErcBufTooShort:
- RETURN_STRING("The buffer passed as a parameter was too short", 1);
- case FDFErcNoAP:
- RETURN_STRING("The field has no /AP key", 1);
- case FDFErcIncompatibleFDF:
- RETURN_STRING("An attempt to mix classic and template-based FDF files was made", 1);
-#ifdef HAVE_FDFTK_5
- case FDFErcNoAppendSaves:
- RETURN_STRING("The FDF does not include a /Difference key", 1);
- case FDFErcValueIsArray:
- RETURN_STRING("The value of this field is an array. Use FDFGetNthValue. ", 1);
- case FDFErcEmbeddedFDFs:
- RETURN_STRING("The FDF you passed as a parameter is a container for one or more FDFs embedded within it. Use FDFOpenFromEmbedded to gain access to each embedded FDF", 1);
- case FDFErcNoMoreFDFs:
- RETURN_STRING("Returned by FDFOpenFromEmbedded when parameter iWhich >= the number of embedded FDFs (including the case when the passed FDF does not contain any embedded FDFs)", 1);
- case FDFErcInvalidPassword:
- RETURN_STRING("Returned by FDFOpenFromEmbedded when the embedded FDF is encrypted, and you did not provide the correct password", 1);
-#endif
- case FDFErcLast:
- RETURN_STRING("Reserved for future use", 1);
- default:
- RETURN_STRING("unknown error", 1);
- }
-}
-/* }}} */
-
-/* {{{ proto string fdf_get_version([resource fdfdoc])
- Gets version number for FDF api or file */
-PHP_FUNCTION(fdf_get_version) {
- zval *r_fdf = NULL;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &r_fdf)
- == FAILURE) {
- return;
- }
-
- if(r_fdf) {
-#if HAVE_FDFTK_5
- const char *fdf_version;
- FDFDoc fdf;
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
- fdf_version = FDFGetFDFVersion(fdf);
- RETURN_STRING((char *)fdf_version, 1);
-#else
- RETURN_STRING("1.2",1);
-#endif
- } else {
- const char *api_version = FDFGetVersion();
- RETURN_STRING((char *)api_version, 1);
- }
-}
-/* }}} */
-
-#ifdef HAVE_FDFTK_5
-/* {{{ proto bool fdf_set_version(resourece fdfdoc, string version)
- Sets FDF version for a file*/
-PHP_FUNCTION(fdf_set_version) {
- zval *r_fdf;
- char *version;
- int version_len;
- FDFDoc fdf;
- FDFErc err;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &r_fdf, &version, &version_len)
- == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
-
- err = FDFSetFDFVersion(fdf, version);
-
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
- FDF_SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto bool fdf_add_doc_javascript(resource fdfdoc, string scriptname, string script)
- Add javascript code to the fdf file */
-PHP_FUNCTION(fdf_add_doc_javascript) {
- zval *r_fdf;
- char *name, *script;
- int name_len, script_len;
- FDFDoc fdf;
- FDFErc err;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &r_fdf,
- &name, &name_len,
- &script, &script_len
- )
- == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
-
- err = FDFAddDocJavaScript(fdf, name, script);
-
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
- FDF_SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_on_import_javascript(resource fdfdoc, string script [, bool before_data_import])
- Adds javascript code to be executed when Acrobat opens the FDF */
-PHP_FUNCTION(fdf_set_on_import_javascript) {
- zval *r_fdf;
- char *script;
- int script_len;
- zend_bool before;
- FDFDoc fdf;
- FDFErc err;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsb", &r_fdf,
- &script, &script_len, &before
- )
- == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
-
- err = FDFSetOnImportJavaScript(fdf, script, before);
-
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
- FDF_SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_target_frame(resource fdfdoc, string target)
- Sets target frame for form */
-PHP_FUNCTION(fdf_set_target_frame) {
- zval *r_fdf;
- char *target;
- int target_len;
- FDFDoc fdf;
- FDFErc err;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &r_fdf,
- &target, &target_len
- )
- == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
-
- err = FDFSetTargetFrame(fdf, target);
-
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
- FDF_SUCCESS;
-}
-/* }}} */
-#endif
-
-/* {{{ proto bool fdf_remove_item(resource fdfdoc, string fieldname, int item)
- Sets target frame for form */
-PHP_FUNCTION(fdf_remove_item) {
- zval *r_fdf;
- char *fieldname;
- int fieldname_len;
- long item;
- FDFDoc fdf;
- FDFErc err;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsl", &r_fdf,
- &fieldname, &fieldname_len,
- &item
- )
- == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
-
- err = FDFRemoveItem(fdf, *fieldname ? fieldname : NULL, item);
-
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
- FDF_SUCCESS;
-}
-/* }}} */
-
-#ifdef HAVE_FDFTK_5
-/* {{{ proto array fdf_get_attachment(resource fdfdoc, string fieldname, string savepath)
- Get attached uploaded file */
-PHP_FUNCTION(fdf_get_attachment) {
- zval *r_fdf;
- char *fieldname, *savepath;
- int fieldname_len, savepath_len;
- int is_dir=0;
- FDFDoc fdf;
- FDFErc err;
- char pathbuf[MAXPATHLEN], mimebuf[1024];
- struct stat statBuf;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &r_fdf,
- &fieldname, &fieldname_len,
- &savepath, &savepath_len
- )
- == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
-
- strncpy(pathbuf , savepath, MAXPATHLEN-1);
- pathbuf[MAXPATHLEN-1] = '\0';
-
- if(0 == stat(pathbuf, &statBuf)) {
- is_dir = S_ISDIR(statBuf.st_mode);
- }
-
- err = FDFExtractAttachment(fdf, fieldname, pathbuf, sizeof(pathbuf), is_dir, mimebuf, sizeof(mimebuf));
-
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
-
- array_init(return_value);
- add_assoc_string(return_value, "path", pathbuf, 1);
- add_assoc_string(return_value, "type", mimebuf, 1);
- stat(pathbuf, &statBuf);
- add_assoc_long(return_value, "size", statBuf.st_size);
-}
-/* }}} */
-#endif
-
-/* {{{ enum_values_callback */
-static ASBool enum_values_callback(char *name, char *value, void *userdata)
-{
- zval *retval_ptr, *z_name, *z_value, **args[3];
- long retval = 0;
- int numargs = 2;
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(z_name);
- ZVAL_STRING(z_name, name, 1);
- args[0] = &z_name;
-
- if (*value) { /* simple value */
- MAKE_STD_ZVAL(z_value);
- ZVAL_STRING(z_value, value, 1);
- args[1] = &z_value;
- } else { /* empty value *might* be an array */
- /* TODO: do it like fdf_get_value (or re-implement yourself?) */
- }
-
- if (userdata) {
- args[2] = (zval **) userdata;
- numargs++;
- }
-
- if (call_user_function_ex(EG(function_table),
- NULL,
- FDF_G(enum_callback),
- &retval_ptr,
- numargs, args,
- 0, NULL TSRMLS_CC) == SUCCESS
- && retval_ptr) {
-
- convert_to_long_ex(&retval_ptr);
- retval = Z_LVAL_P(retval_ptr);
- zval_ptr_dtor(&retval_ptr);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "callback failed");
- }
-
- zval_ptr_dtor(&z_name);
- zval_ptr_dtor(&z_value);
-
- return (ASBool)retval;
-}
-/* }}} */
-
-/* {{{ proto bool fdf_enum_values(resource fdfdoc, callback function [, mixed userdata])
- Call a user defined function for each document value */
-PHP_FUNCTION(fdf_enum_values) {
- zval *r_fdf;
- zval *callback;
- zval *userdata = NULL;
- FDFDoc fdf;
- FDFErc err;
- char *name;
- char namebuf[1024], valbuf[1024];
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|z", &r_fdf,
- &callback, &userdata
- )
- == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
-
- if (Z_TYPE_P(callback) != IS_ARRAY &&
- Z_TYPE_P(callback) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong syntax for function name");
- RETURN_FALSE;
- }
-
- convert_to_string_ex(&callback);
-
- if (!zend_is_callable(callback, 0, &name)) {
- php_error_docref1(NULL TSRMLS_CC, name, E_WARNING, "Second argument is expected to be a valid callback");
- efree(name);
- RETURN_FALSE;
- }
- efree(name);
- FDF_G(enum_callback) = callback;
- FDF_G(enum_fdf) = fdf;
-
- err = FDFEnumValues(fdf, enum_values_callback,
- namebuf, sizeof(namebuf),
- valbuf, sizeof(valbuf),
- userdata ? &userdata : NULL, 0);
-
- if(err != FDFErcOK) {
- FDF_FAILURE(err);
- }
- FDF_SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto void fdf_header(void)
- Set FDF specific HTTP headers */
-PHP_FUNCTION(fdf_header) {
- sapi_header_line ctr = {0};
-
- ctr.line = "Content-type: application/vnd.fdf";
- ctr.line_len = strlen(ctr.line);
- ctr.response_code = 200;
-
- sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/fdf/fdf.dsp b/ext/fdf/fdf.dsp
deleted file mode 100644
index 487ca42828..0000000000
--- a/ext/fdf/fdf.dsp
+++ /dev/null
@@ -1,114 +0,0 @@
-# Microsoft Developer Studio Project File - Name="fdf" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=fdf - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "fdf.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "fdf.mak" CFG="fdf - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "fdf - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "fdf - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "fdf - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FDF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_FDFLIB=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib fdftk.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_fdf.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "fdf - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "mssql-70" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FDF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_FDFLIB=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib fdftk.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_fdf.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "fdf - Win32 Release_TS"
-# Name "fdf - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\fdf.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_fdf.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/fdf/php_fdf.h b/ext/fdf/php_fdf.h
deleted file mode 100644
index 2efe7539ea..0000000000
--- a/ext/fdf/php_fdf.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_FDF_H
-#define PHP_FDF_H
-
-#if HAVE_FDFLIB
-#ifdef PHP_WIN32
-#else
-#define UNIX_DEV
-#endif
-
-#if HAVE_FDFTK_H_LOWER
-# include <fdftk.h>
-#else
-# include <FdfTk.h>
-#endif
-
-ZEND_BEGIN_MODULE_GLOBALS(fdf)
- FDFErc error;
- zval *enum_callback;
- FDFDoc enum_fdf;
-ZEND_END_MODULE_GLOBALS(fdf)
-
-#ifdef ZTS
-#define FDF_G(v) TSRMG(fdf_globals_id, zend_fdf_globals *, v)
-#else
-#define FDF_G(v) (fdf_globals.v)
-#endif
-
-
-extern zend_module_entry fdf_module_entry;
-#define fdf_module_ptr &fdf_module_entry
-
-PHP_MINIT_FUNCTION(fdf);
-PHP_MSHUTDOWN_FUNCTION(fdf);
-PHP_RINIT_FUNCTION(fdf);
-PHP_MINFO_FUNCTION(fdf);
-
-PHP_FUNCTION(fdf_open);
-PHP_FUNCTION(fdf_open_string);
-PHP_FUNCTION(fdf_close);
-PHP_FUNCTION(fdf_create);
-PHP_FUNCTION(fdf_save);
-PHP_FUNCTION(fdf_save_string);
-PHP_FUNCTION(fdf_get_value);
-PHP_FUNCTION(fdf_set_value);
-PHP_FUNCTION(fdf_next_field_name);
-PHP_FUNCTION(fdf_set_ap);
-PHP_FUNCTION(fdf_get_ap);
-PHP_FUNCTION(fdf_get_status);
-PHP_FUNCTION(fdf_set_status);
-PHP_FUNCTION(fdf_set_file);
-PHP_FUNCTION(fdf_get_file);
-PHP_FUNCTION(fdf_add_template);
-PHP_FUNCTION(fdf_set_flags);
-PHP_FUNCTION(fdf_get_flags);
-PHP_FUNCTION(fdf_set_opt);
-PHP_FUNCTION(fdf_get_opt);
-PHP_FUNCTION(fdf_set_submit_form_action);
-PHP_FUNCTION(fdf_set_javascript_action);
-PHP_FUNCTION(fdf_add_doc_javascript);
-PHP_FUNCTION(fdf_set_on_import_javascript);
-PHP_FUNCTION(fdf_set_encoding);
-PHP_FUNCTION(fdf_get_encoding);
-PHP_FUNCTION(fdf_set_version);
-PHP_FUNCTION(fdf_get_version);
-PHP_FUNCTION(fdf_set_target_frame);
-PHP_FUNCTION(fdf_errno);
-PHP_FUNCTION(fdf_error);
-PHP_FUNCTION(fdf_remove_item);
-PHP_FUNCTION(fdf_get_attachment);
-PHP_FUNCTION(fdf_enum_values);
-PHP_FUNCTION(fdf_header);
-#else
-#define fdf_module_ptr NULL
-#endif
-#define phpext_fdf_ptr fdf_module_ptr
-#endif /* PHP_FDF_H */
diff --git a/ext/filepro/CREDITS b/ext/filepro/CREDITS
deleted file mode 100644
index c272432c04..0000000000
--- a/ext/filepro/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-FilePro
-Chad Robinson
diff --git a/ext/filepro/config.m4 b/ext/filepro/config.m4
deleted file mode 100644
index 13f02c2125..0000000000
--- a/ext/filepro/config.m4
+++ /dev/null
@@ -1,13 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_ARG_WITH(filepro,[],[enable_filepro=$withval])
-
-PHP_ARG_ENABLE(filepro,whether to enable the bundled filePro support,
-[ --enable-filepro Enable the bundled read-only filePro support.])
-
-if test "$PHP_FILEPRO" = "yes"; then
- AC_DEFINE(HAVE_FILEPRO, 1, [ ])
- PHP_NEW_EXTENSION(filepro, filepro.c, $ext_shared)
-fi
diff --git a/ext/filepro/filepro.c b/ext/filepro/filepro.c
deleted file mode 100644
index 935f996c29..0000000000
--- a/ext/filepro/filepro.c
+++ /dev/null
@@ -1,570 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Chad Robinson <chadr@brttech.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- filePro 4.x support developed by Chad Robinson, chadr@brttech.com
- Contact Chad Robinson at BRT Technical Services Corp. for details.
- filePro is a registered trademark by Fiserv, Inc. This file contains
- no code or information that is not freely available from the filePro
- web site at http://www.fileproplus.com/
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "safe_mode.h"
-#include "fopen_wrappers.h"
-#include <string.h>
-#include <sys/param.h>
-#include <errno.h>
-#include "php_globals.h"
-
-#include "php_filepro.h"
-#if HAVE_FILEPRO
-
-typedef struct fp_field {
- char *name;
- char *format;
- int width;
- struct fp_field *next;
-} FP_FIELD;
-
-#ifdef THREAD_SAFE
-DWORD FPTls;
-static int numthreads=0;
-
-typedef struct fp_global_struct{
- char *fp_database;
- signed int fp_fcount;
- signed int fp_keysize;
- FP_FIELD *fp_fieldlist;
-}fp_global_struct;
-
-#define FP_GLOBAL(a) fp_globals->a
-
-#define FP_TLS_VARS \
- fp_global_struct *fp_globals; \
- fp_globals=TlsGetValue(FPTls);
-
-#else
-#define FP_GLOBAL(a) a
-#define FP_TLS_VARS
-static char *fp_database = NULL; /* Database directory */
-static signed int fp_fcount = -1; /* Column count */
-static signed int fp_keysize = -1; /* Size of key records */
-static FP_FIELD *fp_fieldlist = NULL; /* List of fields */
-#endif
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(filepro)
-{
-#ifdef THREAD_SAFE
- fp_global_struct *fp_globals;
-#ifdef COMPILE_DL_FILEPRO
- CREATE_MUTEX(fp_mutex,"FP_TLS");
- SET_MUTEX(fp_mutex);
- numthreads++;
- if (numthreads==1){
- if ((FPTls=TlsAlloc())==0xFFFFFFFF){
- FREE_MUTEX(fp_mutex);
- return 0;
- }}
- FREE_MUTEX(fp_mutex);
-#endif
- fp_globals = (fp_global_struct *) LocalAlloc(LPTR, sizeof(fp_global_struct));
- TlsSetValue(FPTls, (void *) fp_globals);
-#endif
- FP_GLOBAL(fp_database)=NULL;
- FP_GLOBAL(fp_fcount)=-1;
- FP_GLOBAL(fp_keysize)=-1;
- FP_GLOBAL(fp_fieldlist)=NULL;
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(filepro)
-{
-#ifdef THREAD_SAFE
- fp_global_struct *fp_globals;
- fp_globals = TlsGetValue(FPTls);
- if (fp_globals != 0)
- LocalFree((HLOCAL) fp_globals);
-#ifdef COMPILE_DL_FILEPRO
- SET_MUTEX(fp_mutex);
- numthreads--;
- if (!numthreads){
- if (!TlsFree(FPTls)){
- FREE_MUTEX(fp_mutex);
- return 0;
- }
- }
- FREE_MUTEX(fp_mutex);
-#endif
-#endif
- return SUCCESS;
-}
-/* }}} */
-
-function_entry filepro_functions[] = {
- PHP_FE(filepro, NULL)
- PHP_FE(filepro_rowcount, NULL)
- PHP_FE(filepro_fieldname, NULL)
- PHP_FE(filepro_fieldtype, NULL)
- PHP_FE(filepro_fieldwidth, NULL)
- PHP_FE(filepro_fieldcount, NULL)
- PHP_FE(filepro_retrieve, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry filepro_module_entry = {
- STANDARD_MODULE_HEADER,
- "filepro", filepro_functions, PHP_MINIT(filepro), PHP_MSHUTDOWN(filepro), NULL, NULL, NULL, NO_VERSION_YET, STANDARD_MODULE_PROPERTIES
-};
-
-
-#ifdef COMPILE_DL_FILEPRO
-ZEND_GET_MODULE(filepro)
-#if defined(PHP_WIN32) && defined(THREAD_SAFE)
-
-/*NOTE: You should have an odbc.def file where you
-export DllMain*/
-BOOL WINAPI DllMain(HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved)
-{
- switch( ul_reason_for_call ) {
- case DLL_PROCESS_ATTACH:
- if ((FPTls=TlsAlloc())==0xFFFFFFFF) {
- return 0;
- }
- break;
- case DLL_THREAD_ATTACH:
- break;
- case DLL_THREAD_DETACH:
- break;
- case DLL_PROCESS_DETACH:
- if (!TlsFree(FPTls)) {
- return 0;
- }
- break;
- }
- return 1;
-}
-#endif
-#endif
-
-/*
- * LONG filePro(STRING directory)
- *
- * Read and verify the map file. We store the field count and field info
- * internally, which means we become unstable if you modify the table while
- * a user is using it! We cannot lock anything since Web connections don't
- * provide the ability to later unlock what we locked. Be smart, be safe.
- */
-/* {{{ proto bool filepro(string directory)
- Read and verify the map file */
-PHP_FUNCTION(filepro)
-{
- zval **dir;
- FILE *fp;
- char workbuf[MAXPATHLEN];
- char readbuf[256];
- char *strtok_buf = NULL;
- int i;
- FP_FIELD *new_field, *tmp, *next;
- FP_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &dir) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(dir);
-
- /* free memory */
- if (FP_GLOBAL(fp_database) != NULL) {
- efree (FP_GLOBAL(fp_database));
- }
-
- /* free linked list of fields */
- tmp = FP_GLOBAL(fp_fieldlist);
- while (tmp != NULL) {
- next = tmp->next;
- efree(tmp);
- tmp = next;
- }
-
- /* init the global vars */
- FP_GLOBAL(fp_database) = NULL;
- FP_GLOBAL(fp_fieldlist) = NULL;
- FP_GLOBAL(fp_fcount) = -1;
- FP_GLOBAL(fp_keysize) = -1;
-
- snprintf(workbuf, sizeof(workbuf), "%s/map", Z_STRVAL_PP(dir));
-
- if (PG(safe_mode) && (!php_checkuid(workbuf, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(workbuf TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if (!(fp = VCWD_FOPEN(workbuf, "r"))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot open map: [%d] %s", errno, strerror(errno));
- RETURN_FALSE;
- }
- if (!fgets(readbuf, sizeof(readbuf), fp)) {
- fclose(fp);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot read map: [%d] %s", errno, strerror(errno));
- RETURN_FALSE;
- }
-
- /* Get the field count, assume the file is readable! */
- if (strcmp(php_strtok_r(readbuf, ":", &strtok_buf), "map")) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Map file corrupt or encrypted");
- RETURN_FALSE;
- }
- FP_GLOBAL(fp_keysize) = atoi(php_strtok_r(NULL, ":", &strtok_buf));
- php_strtok_r(NULL, ":", &strtok_buf);
- FP_GLOBAL(fp_fcount) = atoi(php_strtok_r(NULL, ":", &strtok_buf));
-
- /* Read in the fields themselves */
- for (i = 0; i < FP_GLOBAL(fp_fcount); i++) {
- if (!fgets(readbuf, sizeof(readbuf), fp)) {
- fclose(fp);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot read map: [%d] %s", errno, strerror(errno));
- RETURN_FALSE;
- }
- new_field = emalloc(sizeof(FP_FIELD));
- new_field->next = NULL;
- new_field->name = estrdup(php_strtok_r(readbuf, ":", &strtok_buf));
- new_field->width = atoi(php_strtok_r(NULL, ":", &strtok_buf));
- new_field->format = estrdup(php_strtok_r(NULL, ":", &strtok_buf));
-
- /* Store in forward-order to save time later */
- if (!FP_GLOBAL(fp_fieldlist)) {
- FP_GLOBAL(fp_fieldlist) = new_field;
- } else {
- for (tmp = FP_GLOBAL(fp_fieldlist); tmp; tmp = tmp->next) {
- if (!tmp->next) {
- tmp->next = new_field;
- tmp = new_field;
- }
- }
- }
- }
- fclose(fp);
-
- FP_GLOBAL(fp_database) = estrndup(Z_STRVAL_PP(dir), Z_STRLEN_PP(dir));
-
- RETVAL_TRUE;
-}
-/* }}} */
-
-
-/*
- * LONG filePro_rowcount(void)
- *
- * Count the used rows in the database. filePro just marks deleted records
- * as deleted; they are not removed. Since no counts are maintained we need
- * to go in and count records ourselves. <sigh>
- *
- * Errors return false, success returns the row count.
- */
-/* {{{ proto int filepro_rowcount(void)
- Find out how many rows are in a filePro database */
-PHP_FUNCTION(filepro_rowcount)
-{
- FILE *fp;
- char workbuf[MAXPATHLEN];
- char readbuf[256];
- int recsize = 0, records = 0;
- FP_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- if (!FP_GLOBAL(fp_database)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Must set database directory first!");
- RETURN_FALSE;
- }
-
- recsize = FP_GLOBAL(fp_keysize) + 19; /* 20 bytes system info -1 to save time later */
-
- /* Now read the records in, moving forward recsize-1 bytes each time */
- snprintf(workbuf, sizeof(workbuf), "%s/key", FP_GLOBAL(fp_database));
-
- if (PG(safe_mode) && (!php_checkuid(workbuf, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(workbuf TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if (!(fp = VCWD_FOPEN(workbuf, "r"))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot open key: [%d] %s", errno, strerror(errno));
- RETURN_FALSE;
- }
- while (!feof(fp)) {
- if (fread(readbuf, 1, 1, fp) == 1) {
- if (readbuf[0])
- records++;
- fseek(fp, recsize, SEEK_CUR);
- }
- }
- fclose(fp);
-
- RETVAL_LONG(records);
-}
-/* }}} */
-
-
-/*
- * STRING filePro_fieldname(LONG field_number)
- *
- * Errors return false, success returns the name of the field.
- */
-/* {{{ proto string filepro_fieldname(int fieldnumber)
- Gets the name of a field */
-PHP_FUNCTION(filepro_fieldname)
-{
- zval **fno;
- FP_FIELD *lp;
- int i;
- FP_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fno) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(fno);
-
- if (!FP_GLOBAL(fp_database)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Must set database directory first!");
- RETURN_FALSE;
- }
-
- for (i = 0, lp = FP_GLOBAL(fp_fieldlist); lp; lp = lp->next, i++) {
- if (i == Z_LVAL_PP(fno)) {
- RETURN_STRING(lp->name, 1);
- }
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate field number %d.", Z_LVAL_PP(fno));
-
- RETVAL_FALSE;
-}
-/* }}} */
-
-
-/*
- * STRING filePro_fieldtype(LONG field_number)
- *
- * Errors return false, success returns the type (edit) of the field
- */
-/* {{{ proto string filepro_fieldtype(int field_number)
- Gets the type of a field */
-PHP_FUNCTION(filepro_fieldtype)
-{
- zval **fno;
- FP_FIELD *lp;
- int i;
- FP_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fno) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(fno);
-
- if (!FP_GLOBAL(fp_database)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Must set database directory first!");
- RETURN_FALSE;
- }
-
- for (i = 0, lp = FP_GLOBAL(fp_fieldlist); lp; lp = lp->next, i++) {
- if (i == Z_LVAL_PP(fno)) {
- RETURN_STRING(lp->format, 1);
- }
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate field number %d.", Z_LVAL_PP(fno));
- RETVAL_FALSE;
-}
-/* }}} */
-
-
-/*
- * STRING filePro_fieldwidth(int field_number)
- *
- * Errors return false, success returns the character width of the field.
- */
-/* {{{ proto int filepro_fieldwidth(int field_number)
- Gets the width of a field */
-PHP_FUNCTION(filepro_fieldwidth)
-{
- zval **fno;
- FP_FIELD *lp;
- int i;
- FP_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fno) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(fno);
-
- if (!FP_GLOBAL(fp_database)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Must set database directory first!");
- RETURN_FALSE;
- }
-
- for (i = 0, lp = FP_GLOBAL(fp_fieldlist); lp; lp = lp->next, i++) {
- if (i == Z_LVAL_PP(fno)) {
- RETURN_LONG(lp->width);
- }
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate field number %d.", Z_LVAL_PP(fno));
- RETVAL_FALSE;
-}
-/* }}} */
-
-
-/*
- * LONG filePro_fieldcount(void)
- *
- * Errors return false, success returns the field count.
- */
-/* {{{ proto int filepro_fieldcount(void)
- Find out how many fields are in a filePro database */
-PHP_FUNCTION(filepro_fieldcount)
-{
- FP_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- if (!FP_GLOBAL(fp_database)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Must set database directory first!");
- RETURN_FALSE;
- }
-
- /* Read in the first line from the map file */
- RETVAL_LONG(FP_GLOBAL(fp_fcount));
-}
-/* }}} */
-
-
-/*
- * STRING filePro_retrieve(int row_number, int field_number)
- *
- * Errors return false, success returns the datum.
- */
-/* {{{ proto string filepro_retrieve(int row_number, int field_number)
- Retrieves data from a filePro database */
-PHP_FUNCTION(filepro_retrieve)
-{
- zval **rno, **fno;
- FP_FIELD *lp;
- FILE *fp;
- char workbuf[MAXPATHLEN];
- char *readbuf;
- int i, fnum, rnum;
- long offset;
- FP_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &rno, &fno) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (!FP_GLOBAL(fp_database)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Must set database directory first!");
- RETURN_FALSE;
- }
-
- convert_to_long_ex(rno);
- convert_to_long_ex(fno);
-
- fnum = Z_LVAL_PP(fno);
- rnum = Z_LVAL_PP(rno);
-
- if (rnum < 0 || fnum < 0 || fnum >= FP_GLOBAL(fp_fcount)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameters out of range");
- RETURN_FALSE;
- }
-
- offset = (rnum + 1) * (FP_GLOBAL(fp_keysize) + 20) + 20; /* Record location */
- for (i = 0, lp = FP_GLOBAL(fp_fieldlist); lp && i < fnum; lp = lp->next, i++) {
- offset += lp->width;
- }
- if (!lp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot locate field");
- RETURN_FALSE;
- }
-
- /* Now read the record in */
- snprintf(workbuf, sizeof(workbuf), "%s/key", FP_GLOBAL(fp_database));
-
- if (PG(safe_mode) && (!php_checkuid(workbuf, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(workbuf TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if (!(fp = VCWD_FOPEN(workbuf, "r"))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot open key: [%d] %s", errno, strerror(errno));
- fclose(fp);
- RETURN_FALSE;
- }
- fseek(fp, offset, SEEK_SET);
-
- readbuf = emalloc (lp->width+1);
- if (fread(readbuf, lp->width, 1, fp) != 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot read data: [%d] %s", errno, strerror(errno));
- efree(readbuf);
- fclose(fp);
- RETURN_FALSE;
- }
- readbuf[lp->width] = '\0';
- fclose(fp);
- RETURN_STRING(readbuf, 0);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/filepro/filepro.dsp b/ext/filepro/filepro.dsp
deleted file mode 100644
index 441b14e592..0000000000
--- a/ext/filepro/filepro.dsp
+++ /dev/null
@@ -1,109 +0,0 @@
-# Microsoft Developer Studio Project File - Name="filepro" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=filepro - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "filepro.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "filepro.mak" CFG="filepro - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "filepro - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "filepro - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "filepro - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FILEPRO" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FILEPRO_EXPORTS" /D "COMPILE_DL_FILEPRO" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_FILEPRO=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_filepro.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "filepro - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FILEPRO" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FILEPRO_EXPORTS" /D "COMPILE_DL_FILEPRO" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_FILEPRO=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_filepro.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "filepro - Win32 Release_TS"
-# Name "filepro - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\filepro.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_filepro.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/filepro/php_filepro.h b/ext/filepro/php_filepro.h
deleted file mode 100644
index 0f027ae711..0000000000
--- a/ext/filepro/php_filepro.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Chad Robinson <chadr@brttech.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- filePro 4.x support developed by Chad Robinson, chadr@brttech.com
- Contact Chad Robinson at BRT Technical Services Corp. for details.
- filePro is a registered trademark by Fiserv, Inc. This file contains
- no code or information that is not freely available from the filePro
- web site at http://www.fileproplus.com/
-*/
-
-#ifndef PHP_FILEPRO_H
-#define PHP_FILEPRO_H
-#if HAVE_FILEPRO
-extern zend_module_entry filepro_module_entry;
-#define phpext_filepro_ptr &filepro_module_entry
-
-PHP_FUNCTION(filepro);
-PHP_FUNCTION(filepro_rowcount);
-PHP_FUNCTION(filepro_fieldname);
-PHP_FUNCTION(filepro_fieldtype);
-PHP_FUNCTION(filepro_fieldwidth);
-PHP_FUNCTION(filepro_fieldcount);
-PHP_FUNCTION(filepro_retrieve);
-
-PHP_MINIT_FUNCTION(filepro);
-PHP_MSHUTDOWN_FUNCTION(filepro);
-#else
-#define phpext_filepro_ptr NULL
-#endif
-#endif /* PHP_FILEPRO_H */
diff --git a/ext/fribidi/tests/001.phpt b/ext/fribidi/tests/001.phpt
deleted file mode 100644
index 945cef44f6..0000000000
--- a/ext/fribidi/tests/001.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-fribidi_log2vis
---SKIPIF--
-<?php if (!extension_loaded("fribidi")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
- error_reporting (E_ALL ^ E_NOTICE);
- $a = fribidi_log2vis("THE dog 123 IS THE biggest", FRIBIDI_AUTO, FRIBIDI_CHARSET_CAP_RTL);
- $b = fribidi_log2vis("áìä 198 foo áìä BAR 12", FRIBIDI_RTL, FRIBIDI_CHARSET_8859_8);
- $c = fribidi_log2vis("Fri áéãé éààà bla 12% bla", FRIBIDI_AUTO, FRIBIDI_CHARSET_CP1255);
-
- $d = array($a, $b, $c);
- var_dump($d);
-?>
---EXPECT--
-array(3) {
- [0]=>
- string(26) "biggest EHT SI dog 123 EHT"
- [1]=>
- string(22) "BAR 12 äìá foo 198 äìá"
- [2]=>
- string(25) "Fri àààé éãéá bla 12% bla"
-}
diff --git a/ext/fribidi/tests/002.phpt b/ext/fribidi/tests/002.phpt
deleted file mode 100644
index 5e3c2f9ffc..0000000000
--- a/ext/fribidi/tests/002.phpt
+++ /dev/null
@@ -1,121 +0,0 @@
---TEST--
-FriBidi charsets
---SKIPIF--
-<?php if (!extension_loaded("fribidi")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
- error_reporting(E_ALL ^ E_NOTICE);
-
- echo FRIBIDI_CHARSET_8859_8."\n";
- echo FRIBIDI_CHARSET_8859_6."\n";
- echo FRIBIDI_CHARSET_UTF8."\n";
- echo FRIBIDI_CHARSET_CP1255."\n";
- echo FRIBIDI_CHARSET_CP1256."\n";
- echo FRIBIDI_CHARSET_ISIRI_3342."\n";
- echo FRIBIDI_CHARSET_CAP_RTL."\n";
-
- $charsets = fribidi_get_charsets();
- foreach ($charsets as $k => $charset) {
- print_r(fribidi_charset_info($k));
- }
-
-?>
---EXPECT--
-4
-3
-1
-5
-6
-7
-2
-Array
-(
- [name] => UTF-8
- [title] => UTF-8 (Unicode)
-)
-Array
-(
- [name] => CapRTL
- [title] => CapRTL (Test)
- [desc] => CapRTL is a character set for testing with the reference
-implementation, with explicit marks escape strings, and
-the property that contains all unicode character types in
-ASCII range 1-127.
-
-Warning: CapRTL character types are subject to change.
-
-CapRTL's character types:
-
- * 0x00 ^@ ON * 0x01 ^A ON * 0x02 ^B ON * 0x03 ^C ON
- * 0x04 ^D LTR * 0x05 ^E RTL * 0x06 ^F ON * 0x07 ^G ON
- * 0x08 ^H ON * 0x09 ^I ON * 0x0a ^J ON * 0x0b ^K ON
- * 0x0c ^L ON * 0x0d ^M BS * 0x0e ^N RLO * 0x0f ^O RLE
- * 0x10 ^P LRO * 0x11 ^Q LRE * 0x12 ^R PDF * 0x13 ^S WS
- * 0x14 ^T ON * 0x15 ^U ON * 0x16 ^V ON * 0x17 ^W ON
- * 0x18 ^X ON * 0x19 ^Y ON * 0x1a ^Z ON * 0x1b ^[ ON
- * 0x1c ^\ ON * 0x1d ^] ON * 0x1e ^^ ON * 0x1f ^_ ON
- * 0x20 WS * 0x21 ! ON * 0x22 " ON * 0x23 # ON
- * 0x24 $ ET * 0x25 % ON * 0x26 & ON * 0x27 ' ON
- * 0x28 ( ON * 0x29 ) ON * 0x2a * ON * 0x2b + ET
- * 0x2c , CS * 0x2d - ON * 0x2e . ES * 0x2f / ES
- * 0x30 0 EN * 0x31 1 EN * 0x32 2 EN * 0x33 3 EN
- * 0x34 4 EN * 0x35 5 EN * 0x36 6 AN * 0x37 7 AN
- * 0x38 8 AN * 0x39 9 AN * 0x3a : CS * 0x3b ; ON
- * 0x3c < ON * 0x3d = ON * 0x3e > ON * 0x3f ? ON
- * 0x40 @ RTL * 0x41 A AL * 0x42 B AL * 0x43 C AL
- * 0x44 D AL * 0x45 E AL * 0x46 F AL * 0x47 G RTL
- * 0x48 H RTL * 0x49 I RTL * 0x4a J RTL * 0x4b K RTL
- * 0x4c L RTL * 0x4d M RTL * 0x4e N RTL * 0x4f O RTL
- * 0x50 P RTL * 0x51 Q RTL * 0x52 R RTL * 0x53 S RTL
- * 0x54 T RTL * 0x55 U RTL * 0x56 V RTL * 0x57 W RTL
- * 0x58 X RTL * 0x59 Y RTL * 0x5a Z RTL * 0x5b [ ON
- * 0x5c \ BS * 0x5d ] ON * 0x5e ^ ON * 0x5f _ ON
- * 0x60 ` NSM * 0x61 a LTR * 0x62 b LTR * 0x63 c LTR
- * 0x64 d LTR * 0x65 e LTR * 0x66 f LTR * 0x67 g LTR
- * 0x68 h LTR * 0x69 i LTR * 0x6a j LTR * 0x6b k LTR
- * 0x6c l LTR * 0x6d m LTR * 0x6e n LTR * 0x6f o LTR
- * 0x70 p LTR * 0x71 q LTR * 0x72 r LTR * 0x73 s LTR
- * 0x74 t LTR * 0x75 u LTR * 0x76 v LTR * 0x77 w LTR
- * 0x78 x LTR * 0x79 y LTR * 0x7a z LTR * 0x7b { ON
- * 0x7c | SS * 0x7d } ON * 0x7e ~ WS * 0x7f ON
-
-Escape sequences:
- Character `_' is used to escape explicit marks. The list is:
- * _> LRM
- * _< RLM
- * _l LRE
- * _r RLE
- * _L LRO
- * _R RLO
- * _o PDF
- * __ `_' itself
-
-
-)
-Array
-(
- [name] => ISO8859-6
- [title] => ISO 8859-6 (Arabic)
-)
-Array
-(
- [name] => ISO8859-8
- [title] => ISO 8859-8 (Hebrew)
-)
-Array
-(
- [name] => CP1255
- [title] => CP1255 (Hebrew/Yiddish)
-)
-Array
-(
- [name] => CP1256
- [title] => CP1256 (MS-Arabic)
-)
-Array
-(
- [name] => ISIRI-3342
- [title] => ISIRI 3342 (Persian)
-)
diff --git a/ext/ftp/CREDITS b/ext/ftp/CREDITS
deleted file mode 100644
index bf0920ad80..0000000000
--- a/ext/ftp/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-FTP
-Stefan Esser, Andrew Skalski
diff --git a/ext/ftp/config.m4 b/ext/ftp/config.m4
deleted file mode 100644
index 3b5f3fd641..0000000000
--- a/ext/ftp/config.m4
+++ /dev/null
@@ -1,11 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(ftp,whether to enable FTP support,
-[ --enable-ftp Enable FTP support])
-
-if test "$PHP_FTP" = "yes"; then
- AC_DEFINE(HAVE_FTP,1,[Whether you want FTP support])
- PHP_NEW_EXTENSION(ftp, php_ftp.c ftp.c, $ext_shared)
-fi
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
deleted file mode 100644
index fa184aa4a3..0000000000
--- a/ext/ftp/ftp.c
+++ /dev/null
@@ -1,1914 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andrew Skalski <askalski@chek.com> |
- | Stefan Esser <sesser@php.net> (resume functions) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#if HAVE_FTP
-
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <fcntl.h>
-#include <string.h>
-#include <time.h>
-#ifdef PHP_WIN32
-#include <winsock2.h>
-#elif defined(NETWARE)
-#ifdef USE_WINSOCK /* Modified to use Winsock (NOVSOCK2.H), atleast for now */
-#include <novsock2.h>
-#else
-#ifdef NEW_LIBC
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#else
-#include <sys/socket.h>
-#endif
-#endif
-#else
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#endif
-#include <errno.h>
-
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-
-#if HAVE_OPENSSL_EXT
-#include <openssl/ssl.h>
-#endif
-
-#include "ftp.h"
-#include "ext/standard/fsock.h"
-
-/* Additional headers for NetWare */
-#if defined(NETWARE) && defined(NEW_LIBC) && !defined(USE_WINSOCK)
-#include <sys/select.h>
-#endif
-
-/* sends an ftp command, returns true on success, false on error.
- * it sends the string "cmd args\r\n" if args is non-null, or
- * "cmd\r\n" if args is null
- */
-static int ftp_putcmd( ftpbuf_t *ftp,
- const char *cmd,
- const char *args);
-
-/* wrapper around send/recv to handle timeouts */
-static int my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len);
-static int my_recv(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len);
-static int my_accept(ftpbuf_t *ftp, php_socket_t s, struct sockaddr *addr, socklen_t *addrlen);
-
-/* reads a line the socket , returns true on success, false on error */
-static int ftp_readline(ftpbuf_t *ftp);
-
-/* reads an ftp response, returns true on success, false on error */
-static int ftp_getresp(ftpbuf_t *ftp);
-
-/* sets the ftp transfer type */
-static int ftp_type(ftpbuf_t *ftp, ftptype_t type);
-
-/* opens up a data stream */
-static databuf_t* ftp_getdata(ftpbuf_t *ftp TSRMLS_DC);
-
-/* accepts the data connection, returns updated data buffer */
-static databuf_t* data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC);
-
-/* closes the data connection, returns NULL */
-static databuf_t* data_close(ftpbuf_t *ftp, databuf_t *data);
-
-/* generic file lister */
-static char** ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC);
-
-/* IP and port conversion box */
-union ipbox {
- unsigned long l[2];
- unsigned short s[4];
- unsigned char c[8];
-};
-
-/* {{{ ftp_open
- */
-ftpbuf_t*
-ftp_open(const char *host, short port, long timeout_sec TSRMLS_DC)
-{
- ftpbuf_t *ftp;
- socklen_t size;
- struct timeval tv;
-
-
- /* alloc the ftp structure */
- ftp = ecalloc(1, sizeof(*ftp));
-
- tv.tv_sec = timeout_sec;
- tv.tv_usec = 0;
-
- ftp->fd = php_network_connect_socket_to_host(host,
- (unsigned short) (port ? port : 21), SOCK_STREAM,
- 0, &tv, NULL, NULL TSRMLS_CC);
- if (ftp->fd == -1) {
- goto bail;
- }
-
- /* Default Settings */
- ftp->timeout_sec = timeout_sec;
- ftp->nb = 0;
-
- size = sizeof(ftp->localaddr);
- memset(&ftp->localaddr, 0, size);
- if (getsockname(ftp->fd, (struct sockaddr*) &ftp->localaddr, &size) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "getsockname failed: %s (%d)\n", strerror(errno), errno);
- goto bail;
- }
-
- if (!ftp_getresp(ftp) || ftp->resp != 220) {
- goto bail;
- }
-
- return ftp;
-
-bail:
- if (ftp->fd != -1) {
- closesocket(ftp->fd);
- }
- efree(ftp);
- return NULL;
-}
-/* }}} */
-
-/* {{{ ftp_close
- */
-ftpbuf_t*
-ftp_close(ftpbuf_t *ftp)
-{
- if (ftp == NULL) {
- return NULL;
- }
- if (ftp->data) {
- data_close(ftp, ftp->data);
- }
- if (ftp->fd != -1) {
-#if HAVE_OPENSSL_EXT
- if (ftp->ssl_active) {
- SSL_shutdown(ftp->ssl_handle);
- }
-#endif
- closesocket(ftp->fd);
- }
- ftp_gc(ftp);
- efree(ftp);
- return NULL;
-}
-/* }}} */
-
-/* {{{ ftp_gc
- */
-void
-ftp_gc(ftpbuf_t *ftp)
-{
- if (ftp == NULL) {
- return;
- }
- if (ftp->pwd) {
- efree(ftp->pwd);
- }
- if (ftp->syst) {
- efree(ftp->syst);
- }
-}
-/* }}} */
-
-/* {{{ ftp_quit
- */
-int
-ftp_quit(ftpbuf_t *ftp)
-{
- if (ftp == NULL) {
- return 0;
- }
-
- if (!ftp_putcmd(ftp, "QUIT", NULL)) {
- return 0;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 221) {
- return 0;
- }
-
- if (ftp->pwd) {
- efree(ftp->pwd);
- }
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_login
- */
-int
-ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
-{
-#if HAVE_OPENSSL_EXT
- SSL_CTX *ctx = NULL;
-#endif
- if (ftp == NULL) {
- return 0;
- }
-
-#if HAVE_OPENSSL_EXT
- if (ftp->use_ssl && !ftp->ssl_active) {
- if (!ftp_putcmd(ftp, "AUTH", "TLS")) {
- return 0;
- }
- if (!ftp_getresp(ftp)) {
- return 0;
- }
-
- if (ftp->resp != 234) {
- if (!ftp_putcmd(ftp, "AUTH", "SSL")) {
- return 0;
- }
- if (!ftp_getresp(ftp)) {
- return 0;
- }
-
- if (ftp->resp != 334) {
- ftp->use_ssl = 0;
- } else {
- ftp->old_ssl = 1;
- ftp->use_ssl_for_data = 1;
- }
- }
-
- /* now enable ssl if we still need to */
- if (ftp->use_ssl) {
- ctx = SSL_CTX_new(SSLv23_client_method());
- if (ctx == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to create the SSL context");
- return 0;
- }
-
- ftp->ssl_handle = SSL_new(ctx);
- if (ftp->ssl_handle == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to create the SSL handle");
- SSL_CTX_free(ctx);
- return 0;
- }
-
- SSL_set_fd(ftp->ssl_handle, ftp->fd);
-
- if (SSL_connect(ftp->ssl_handle) <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL/TLS handshake failed");
- SSL_shutdown(ftp->ssl_handle);
- return 0;
- }
-
- ftp->ssl_active = 1;
-
- if (!ftp->old_ssl) {
-
- /* set protection buffersize to zero */
- if (!ftp_putcmd(ftp, "PBSZ", "0")) {
- return 0;
- }
- if (!ftp_getresp(ftp)) {
- return 0;
- }
-
- /* enable data conn encryption */
- if (!ftp_putcmd(ftp, "PROT", "P")) {
- return 0;
- }
- if (!ftp_getresp(ftp)) {
- return 0;
- }
-
- ftp->use_ssl_for_data = (ftp->resp >= 200 && ftp->resp <=299);
- }
- }
- }
-#endif
-
- if (!ftp_putcmd(ftp, "USER", user)) {
- return 0;
- }
- if (!ftp_getresp(ftp)) {
- return 0;
- }
- if (ftp->resp == 230) {
- return 1;
- }
- if (ftp->resp != 331) {
- return 0;
- }
- if (!ftp_putcmd(ftp, "PASS", pass)) {
- return 0;
- }
- if (!ftp_getresp(ftp)) {
- return 0;
- }
- return (ftp->resp == 230);
-}
-/* }}} */
-
-/* {{{ ftp_reinit
- */
-int
-ftp_reinit(ftpbuf_t *ftp)
-{
- if (ftp == NULL) {
- return 0;
- }
-
- ftp_gc(ftp);
-
- ftp->nb = 0;
-
- if (!ftp_putcmd(ftp, "REIN", NULL)) {
- return 0;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 220) {
- return 0;
- }
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_syst
- */
-const char*
-ftp_syst(ftpbuf_t *ftp)
-{
- char *syst, *end;
-
- if (ftp == NULL) {
- return NULL;
- }
-
- /* default to cached value */
- if (ftp->syst) {
- return ftp->syst;
- }
- if (!ftp_putcmd(ftp, "SYST", NULL)) {
- return NULL;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 215) {
- return NULL;
- }
- syst = ftp->inbuf;
- if ((end = strchr(syst, ' '))) {
- *end = 0;
- }
- ftp->syst = estrdup(syst);
- if (end) {
- *end = ' ';
- }
- return ftp->syst;
-}
-/* }}} */
-
-/* {{{ ftp_pwd
- */
-const char*
-ftp_pwd(ftpbuf_t *ftp)
-{
- char *pwd, *end;
-
- if (ftp == NULL) {
- return NULL;
- }
-
- /* default to cached value */
- if (ftp->pwd) {
- return ftp->pwd;
- }
- if (!ftp_putcmd(ftp, "PWD", NULL)) {
- return NULL;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 257) {
- return NULL;
- }
- /* copy out the pwd from response */
- if ((pwd = strchr(ftp->inbuf, '"')) == NULL) {
- return NULL;
- }
- if ((end = strrchr(++pwd, '"')) == NULL) {
- return NULL;
- }
- *end = 0;
- ftp->pwd = estrdup(pwd);
- *end = '"';
-
- return ftp->pwd;
-}
-/* }}} */
-
-/* {{{ ftp_exec
- */
-int
-ftp_exec(ftpbuf_t *ftp, const char *cmd)
-{
- if (ftp == NULL) {
- return 0;
- }
- if (!ftp_putcmd(ftp, "SITE EXEC", cmd)) {
- return 0;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 200) {
- return 0;
- }
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_raw
- */
-void
-ftp_raw(ftpbuf_t *ftp, const char *cmd, zval *return_value)
-{
- if (ftp == NULL || cmd == NULL) {
- RETURN_NULL();
- }
- if (!ftp_putcmd(ftp, cmd, NULL)) {
- RETURN_NULL();
- }
- array_init(return_value);
- while (ftp_readline(ftp)) {
- add_next_index_string(return_value, ftp->inbuf, 1);
- if (isdigit(ftp->inbuf[0]) && isdigit(ftp->inbuf[1]) && isdigit(ftp->inbuf[2]) && ftp->inbuf[3] == ' ') {
- return;
- }
- }
-}
-/* }}} */
-
-/* {{{ ftp_chdir
- */
-int
-ftp_chdir(ftpbuf_t *ftp, const char *dir)
-{
- if (ftp == NULL) {
- return 0;
- }
-
- if (ftp->pwd) {
- efree(ftp->pwd);
- }
-
- if (!ftp_putcmd(ftp, "CWD", dir)) {
- return 0;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 250) {
- return 0;
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_cdup
- */
-int
-ftp_cdup(ftpbuf_t *ftp)
-{
- if (ftp == NULL) {
- return 0;
- }
-
- if (ftp->pwd) {
- efree(ftp->pwd);
- }
-
- if (!ftp_putcmd(ftp, "CDUP", NULL)) {
- return 0;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 250) {
- return 0;
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_mkdir
- */
-char*
-ftp_mkdir(ftpbuf_t *ftp, const char *dir)
-{
- char *mkd, *end;
-
- if (ftp == NULL) {
- return NULL;
- }
- if (!ftp_putcmd(ftp, "MKD", dir)) {
- return NULL;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 257) {
- return NULL;
- }
- /* copy out the dir from response */
- if ((mkd = strchr(ftp->inbuf, '"')) == NULL) {
- mkd = estrdup(dir);
- return mkd;
- }
- if ((end = strrchr(++mkd, '"')) == NULL) {
- return NULL;
- }
- *end = 0;
- mkd = estrdup(mkd);
- *end = '"';
-
- return mkd;
-}
-/* }}} */
-
-/* {{{ ftp_rmdir
- */
-int
-ftp_rmdir(ftpbuf_t *ftp, const char *dir)
-{
- if (ftp == NULL) {
- return 0;
- }
- if (!ftp_putcmd(ftp, "RMD", dir)) {
- return 0;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 250) {
- return 0;
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_chmod
- */
-int
-ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int filename_len)
-{
- char *buffer;
-
- if (ftp == NULL || filename_len <= 0) {
- return 0;
- }
-
- if (!(buffer = emalloc(32 + filename_len + 1))) {
- return 0;
- }
-
- sprintf(buffer, "CHMOD %o %s", mode, filename);
-
- if (!ftp_putcmd(ftp, "SITE", buffer)) {
- efree(buffer);
- return 0;
- }
-
- efree(buffer);
-
- if (!ftp_getresp(ftp) || ftp->resp != 200) {
- return 0;
- }
-
- return 1;
-}
-/* }}} */
-
-
-/* {{{ ftp_nlist
- */
-char**
-ftp_nlist(ftpbuf_t *ftp, const char *path TSRMLS_DC)
-{
- return ftp_genlist(ftp, "NLST", path TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ ftp_list
- */
-char**
-ftp_list(ftpbuf_t *ftp, const char *path, int recursive TSRMLS_DC)
-{
- return ftp_genlist(ftp, ((recursive) ? "LIST -R" : "LIST"), path TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ ftp_type
- */
-int
-ftp_type(ftpbuf_t *ftp, ftptype_t type)
-{
- char typechar[2] = "?";
-
- if (ftp == NULL) {
- return 0;
- }
- if (type == ftp->type) {
- return 1;
- }
- if (type == FTPTYPE_ASCII) {
- typechar[0] = 'A';
- } else if (type == FTPTYPE_IMAGE) {
- typechar[0] = 'I';
- } else {
- return 0;
- }
- if (!ftp_putcmd(ftp, "TYPE", typechar)) {
- return 0;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 200) {
- return 0;
- }
- ftp->type = type;
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_pasv
- */
-int
-ftp_pasv(ftpbuf_t *ftp, int pasv)
-{
- char *ptr;
- union ipbox ipbox;
- unsigned long b[6];
- socklen_t n;
- struct sockaddr *sa;
- struct sockaddr_in *sin;
-
- if (ftp == NULL) {
- return 0;
- }
- if (pasv && ftp->pasv == 2) {
- return 1;
- }
- ftp->pasv = 0;
- if (!pasv) {
- return 1;
- }
- n = sizeof(ftp->pasvaddr);
- memset(&ftp->pasvaddr, 0, n);
- sa = (struct sockaddr *) &ftp->pasvaddr;
-
-#ifdef HAVE_IPV6
- if (getpeername(ftp->fd, sa, &n) < 0) {
- return 0;
- }
- if (sa->sa_family == AF_INET6) {
- struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa;
- char *endptr, delimiter;
-
- /* try EPSV first */
- if (!ftp_putcmd(ftp, "EPSV", NULL)) {
- return 0;
- }
- if (!ftp_getresp(ftp)) {
- return 0;
- }
- if (ftp->resp == 229) {
- /* parse out the port */
- for (ptr = ftp->inbuf; *ptr && *ptr != '('; ptr++);
- if (!*ptr) {
- return 0;
- }
- delimiter = *++ptr;
- for (n = 0; *ptr && n < 3; ptr++) {
- if (*ptr == delimiter) {
- n++;
- }
- }
-
- sin6->sin6_port = htons((unsigned short) strtoul(ptr, &endptr, 10));
- if (ptr == endptr || *endptr != delimiter) {
- return 0;
- }
- ftp->pasv = 2;
- return 1;
- }
- }
-
- /* fall back to PASV */
-#endif
-
- if (!ftp_putcmd(ftp, "PASV", NULL)) {
- return 0;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 227) {
- return 0;
- }
- /* parse out the IP and port */
- for (ptr = ftp->inbuf; *ptr && !isdigit(*ptr); ptr++);
- n = sscanf(ptr, "%lu,%lu,%lu,%lu,%lu,%lu", &b[0], &b[1], &b[2], &b[3], &b[4], &b[5]);
- if (n != 6) {
- return 0;
- }
- for (n = 0; n < 6; n++) {
- ipbox.c[n] = (unsigned char) b[n];
- }
- sin = (struct sockaddr_in *) sa;
- sin->sin_family = AF_INET;
- sin->sin_addr.s_addr = ipbox.l[0];
- sin->sin_port = ipbox.s[2];
-
- ftp->pasv = 2;
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_get
- */
-int
-ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC)
-{
- databuf_t *data = NULL;
- char *ptr;
- int lastch;
- size_t rcvd;
- char arg[11];
-
- if (ftp == NULL) {
- return 0;
- }
- if (!ftp_type(ftp, type)) {
- goto bail;
- }
-
- if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) {
- goto bail;
- }
-
- ftp->data = data;
-
- if (resumepos > 0) {
- if (resumepos > 2147483647) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater then 2147483647 bytes.\n");
- goto bail;
- }
- sprintf(arg, "%u", resumepos);
- if (!ftp_putcmd(ftp, "REST", arg)) {
- goto bail;
- }
- if (!ftp_getresp(ftp) || (ftp->resp != 350)) {
- goto bail;
- }
- }
-
- if (!ftp_putcmd(ftp, "RETR", path)) {
- goto bail;
- }
- if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125)) {
- goto bail;
- }
-
- if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
- goto bail;
- }
-
- lastch = 0;
- while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) {
- if (rcvd == -1) {
- goto bail;
- }
-
- if (type == FTPTYPE_ASCII) {
- for (ptr = data->buf; rcvd; rcvd--, ptr++) {
- if (lastch == '\r' && *ptr != '\n')
- php_stream_putc(outstream, '\r');
- if (*ptr != '\r')
- php_stream_putc(outstream, *ptr);
- lastch = *ptr;
- }
- } else if (rcvd != php_stream_write(outstream, data->buf, rcvd)) {
- goto bail;
- }
- }
-
- if (type == FTPTYPE_ASCII && lastch == '\r') {
- php_stream_putc(outstream, '\r');
- }
-
- data = data_close(ftp, data);
- ftp->data = NULL;
-
- if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
- goto bail;
- }
-
- return 1;
-bail:
- data_close(ftp, data);
- ftp->data = NULL;
- return 0;
-}
-/* }}} */
-
-/* {{{ ftp_put
- */
-int
-ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC)
-{
- databuf_t *data = NULL;
- int size;
- char *ptr;
- int ch;
- char arg[11];
-
- if (ftp == NULL) {
- return 0;
- }
- if (!ftp_type(ftp, type)) {
- goto bail;
- }
- if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) {
- goto bail;
- }
- ftp->data = data;
-
- if (startpos > 0) {
- if (startpos > 2147483647) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater then 2147483647 bytes.\n");
- goto bail;
- }
- sprintf(arg, "%u", startpos);
- if (!ftp_putcmd(ftp, "REST", arg)) {
- goto bail;
- }
- if (!ftp_getresp(ftp) || (ftp->resp != 350)) {
- goto bail;
- }
- }
-
- if (!ftp_putcmd(ftp, "STOR", path)) {
- goto bail;
- }
- if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125)) {
- goto bail;
- }
- if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
- goto bail;
- }
-
- size = 0;
- ptr = data->buf;
- while (!php_stream_eof(instream) && (ch = php_stream_getc(instream))!=EOF) {
- /* flush if necessary */
- if (FTP_BUFSIZE - size < 2) {
- if (my_send(ftp, data->fd, data->buf, size) != size) {
- goto bail;
- }
- ptr = data->buf;
- size = 0;
- }
-
- if (ch == '\n' && type == FTPTYPE_ASCII) {
- *ptr++ = '\r';
- size++;
- }
-
- *ptr++ = ch;
- size++;
- }
-
- if (size && my_send(ftp, data->fd, data->buf, size) != size) {
- goto bail;
- }
- data = data_close(ftp, data);
-
- if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
- goto bail;
- }
- return 1;
-bail:
- data_close(ftp, data);
- return 0;
-}
-/* }}} */
-
-/* {{{ ftp_size
- */
-int
-ftp_size(ftpbuf_t *ftp, const char *path)
-{
- if (ftp == NULL) {
- return -1;
- }
- if (!ftp_type(ftp, FTPTYPE_IMAGE)) {
- return -1;
- }
- if (!ftp_putcmd(ftp, "SIZE", path)) {
- return -1;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 213) {
- return -1;
- }
- return atoi(ftp->inbuf);
-}
-/* }}} */
-
-/* {{{ ftp_mdtm
- */
-time_t
-ftp_mdtm(ftpbuf_t *ftp, const char *path)
-{
- time_t stamp;
- struct tm *gmt, tmbuf;
- struct tm tm;
- char *ptr;
- int n;
-
- if (ftp == NULL) {
- return -1;
- }
- if (!ftp_putcmd(ftp, "MDTM", path)) {
- return -1;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 213) {
- return -1;
- }
- /* parse out the timestamp */
- for (ptr = ftp->inbuf; *ptr && !isdigit(*ptr); ptr++);
- n = sscanf(ptr, "%4u%2u%2u%2u%2u%2u", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
- if (n != 6) {
- return -1;
- }
- tm.tm_year -= 1900;
- tm.tm_mon--;
- tm.tm_isdst = -1;
-
- /* figure out the GMT offset */
- stamp = time(NULL);
- gmt = php_gmtime_r(&stamp, &tmbuf);
- gmt->tm_isdst = -1;
-
- /* apply the GMT offset */
- tm.tm_sec += stamp - mktime(gmt);
- tm.tm_isdst = gmt->tm_isdst;
-
- stamp = mktime(&tm);
-
- return stamp;
-}
-/* }}} */
-
-/* {{{ ftp_delete
- */
-int
-ftp_delete(ftpbuf_t *ftp, const char *path)
-{
- if (ftp == NULL) {
- return 0;
- }
- if (!ftp_putcmd(ftp, "DELE", path)) {
- return 0;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 250) {
- return 0;
- }
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_rename
- */
-int
-ftp_rename(ftpbuf_t *ftp, const char *src, const char *dest)
-{
- if (ftp == NULL) {
- return 0;
- }
- if (!ftp_putcmd(ftp, "RNFR", src)) {
- return 0;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 350) {
- return 0;
- }
- if (!ftp_putcmd(ftp, "RNTO", dest)) {
- return 0;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 250) {
- return 0;
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_site
- */
-int
-ftp_site(ftpbuf_t *ftp, const char *cmd)
-{
- if (ftp == NULL) {
- return 0;
- }
- if (!ftp_putcmd(ftp, "SITE", cmd)) {
- return 0;
- }
- if (!ftp_getresp(ftp) || ftp->resp < 200 || ftp->resp >= 300) {
- return 0;
- }
-
- return 1;
-}
-/* }}} */
-
-/* static functions */
-
-/* {{{ ftp_putcmd
- */
-int
-ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args)
-{
- int size;
- char *data;
-
- /* build the output buffer */
- if (args && args[0]) {
- /* "cmd args\r\n\0" */
- if (strlen(cmd) + strlen(args) + 4 > FTP_BUFSIZE) {
- return 0;
- }
- size = sprintf(ftp->outbuf, "%s %s\r\n", cmd, args);
- } else {
- /* "cmd\r\n\0" */
- if (strlen(cmd) + 3 > FTP_BUFSIZE) {
- return 0;
- }
- size = sprintf(ftp->outbuf, "%s\r\n", cmd);
- }
-
- data = ftp->outbuf;
-
- if (my_send(ftp, ftp->fd, data, size) != size) {
- return 0;
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_readline
- */
-int
-ftp_readline(ftpbuf_t *ftp)
-{
- int size, rcvd;
- char *data, *eol;
-
- /* shift the extra to the front */
- size = FTP_BUFSIZE;
- rcvd = 0;
- if (ftp->extra) {
- memmove(ftp->inbuf, ftp->extra, ftp->extralen);
- rcvd = ftp->extralen;
- }
-
- data = ftp->inbuf;
-
- do {
- size -= rcvd;
- for (eol = data; rcvd; rcvd--, eol++) {
- if (*eol == '\r') {
- *eol = 0;
- ftp->extra = eol + 1;
- if (rcvd > 1 && *(eol + 1) == '\n') {
- ftp->extra++;
- rcvd--;
- }
- if ((ftp->extralen = --rcvd) == 0) {
- ftp->extra = NULL;
- }
- return 1;
- } else if (*eol == '\n') {
- *eol = 0;
- ftp->extra = eol + 1;
- if ((ftp->extralen = --rcvd) == 0) {
- ftp->extra = NULL;
- }
- return 1;
- }
- }
-
- data = eol;
- if ((rcvd = my_recv(ftp, ftp->fd, data, size)) < 1) {
- return 0;
- }
- } while (size);
-
- return 0;
-}
-/* }}} */
-
-/* {{{ ftp_getresp
- */
-int
-ftp_getresp(ftpbuf_t *ftp)
-{
- char *buf;
-
- if (ftp == NULL) {
- return 0;
- }
- buf = ftp->inbuf;
- ftp->resp = 0;
-
- while (1) {
-
- if (!ftp_readline(ftp)) {
- return 0;
- }
-
- /* Break out when the end-tag is found */
- if (isdigit(ftp->inbuf[0]) && isdigit(ftp->inbuf[1]) && isdigit(ftp->inbuf[2]) && ftp->inbuf[3] == ' ') {
- break;
- }
- }
-
- /* translate the tag */
- if (!isdigit(ftp->inbuf[0]) || !isdigit(ftp->inbuf[1]) || !isdigit(ftp->inbuf[2])) {
- return 0;
- }
-
- ftp->resp = 100 * (ftp->inbuf[0] - '0') + 10 * (ftp->inbuf[1] - '0') + (ftp->inbuf[2] - '0');
-
- memmove(ftp->inbuf, ftp->inbuf + 4, FTP_BUFSIZE - 4);
-
- if (ftp->extra) {
- ftp->extra -= 4;
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ my_send
- */
-int
-my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
-{
- fd_set write_set;
- struct timeval tv;
- int n, size, sent;
-
- size = len;
- while (size) {
- tv.tv_sec = ftp->timeout_sec;
- tv.tv_usec = 0;
-
- FD_ZERO(&write_set);
- FD_SET(s, &write_set);
-
- n = select(s + 1, NULL, &write_set, NULL, &tv);
-
- if (n < 1) {
-
-#if !defined(PHP_WIN32) && !(defined(NETWARE) && defined(USE_WINSOCK))
- if (n == 0) {
- errno = ETIMEDOUT;
- }
-#endif
- return -1;
- }
-
-#if HAVE_OPENSSL_EXT
- if (ftp->use_ssl && ftp->fd == s && ftp->ssl_active) {
- sent = SSL_write(ftp->ssl_handle, buf, size);
- } else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) {
- sent = SSL_write(ftp->data->ssl_handle, buf, size);
- } else {
-#endif
- sent = send(s, buf, size, 0);
-#if HAVE_OPENSSL_EXT
- }
-#endif
- if (sent == -1) {
- return -1;
- }
-
- buf = (char*) buf + sent;
- size -= sent;
- }
-
- return len;
-}
-/* }}} */
-
-/* {{{ my_recv
- */
-int
-my_recv(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
-{
- fd_set read_set;
- struct timeval tv;
- int n, nr_bytes;
-
- tv.tv_sec = ftp->timeout_sec;
- tv.tv_usec = 0;
-
- FD_ZERO(&read_set);
- FD_SET(s, &read_set);
-
- n = select(s + 1, &read_set, NULL, NULL, &tv);
- if (n < 1) {
-#if !defined(PHP_WIN32) && !(defined(NETWARE) && defined(USE_WINSOCK))
- if (n == 0) {
- errno = ETIMEDOUT;
- }
-#endif
- return -1;
- }
-
-#if HAVE_OPENSSL_EXT
- if (ftp->use_ssl && ftp->fd == s && ftp->ssl_active) {
- nr_bytes = SSL_read(ftp->ssl_handle, buf, len);
- } else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) {
- nr_bytes = SSL_read(ftp->data->ssl_handle, buf, len);
- } else {
-#endif
- nr_bytes = recv(s, buf, len, 0);
-#if HAVE_OPENSSL_EXT
- }
-#endif
- return (nr_bytes);
-}
-/* }}} */
-
-/* {{{ data_available
- */
-int
-data_available(ftpbuf_t *ftp, php_socket_t s)
-{
- fd_set read_set;
- struct timeval tv;
- int n;
-
- tv.tv_sec = 0;
- tv.tv_usec = 1;
-
- FD_ZERO(&read_set);
- FD_SET(s, &read_set);
- n = select(s + 1, &read_set, NULL, NULL, &tv);
- if (n < 1) {
-#if !defined(PHP_WIN32) && !(defined(NETWARE) && defined(USE_WINSOCK))
- if (n == 0) {
- errno = ETIMEDOUT;
- }
-#endif
- return 0;
- }
-
- return 1;
-}
-/* }}} */
-/* {{{ data_writeable
- */
-int
-data_writeable(ftpbuf_t *ftp, php_socket_t s)
-{
- fd_set write_set;
- struct timeval tv;
- int n;
-
- tv.tv_sec = 0;
- tv.tv_usec = 1;
-
- FD_ZERO(&write_set);
- FD_SET(s, &write_set);
- n = select(s + 1, NULL, &write_set, NULL, &tv);
- if (n < 1) {
-#ifndef PHP_WIN32
- if (n == 0) {
- errno = ETIMEDOUT;
- }
-#endif
- return 0;
- }
-
- return 1;
-}
-/* }}} */
-
-/* {{{ my_accept
- */
-int
-my_accept(ftpbuf_t *ftp, php_socket_t s, struct sockaddr *addr, socklen_t *addrlen)
-{
- fd_set accept_set;
- struct timeval tv;
- int n;
-
- tv.tv_sec = ftp->timeout_sec;
- tv.tv_usec = 0;
- FD_ZERO(&accept_set);
- FD_SET(s, &accept_set);
-
- n = select(s + 1, &accept_set, NULL, NULL, &tv);
- if (n < 1) {
-#if !defined(PHP_WIN32) && !(defined(NETWARE) && defined(USE_WINSOCK))
- if (n == 0) {
- errno = ETIMEDOUT;
- }
-#endif
- return -1;
- }
-
- return accept(s, addr, addrlen);
-}
-/* }}} */
-
-/* {{{ ftp_getdata
- */
-databuf_t*
-ftp_getdata(ftpbuf_t *ftp TSRMLS_DC)
-{
- int fd = -1;
- databuf_t *data;
- php_sockaddr_storage addr;
- struct sockaddr *sa;
- socklen_t size;
- union ipbox ipbox;
- char arg[sizeof("255, 255, 255, 255, 255, 255")];
- struct timeval tv;
-
-
- /* ask for a passive connection if we need one */
- if (ftp->pasv && !ftp_pasv(ftp, 1)) {
- return NULL;
- }
- /* alloc the data structure */
- data = ecalloc(1, sizeof(*data));
- data->listener = -1;
- data->fd = -1;
- data->type = ftp->type;
-
- sa = (struct sockaddr *) &ftp->localaddr;
- /* bind/listen */
- if ((fd = socket(sa->sa_family, SOCK_STREAM, 0)) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "socket() failed: %s (%d)\n", strerror(errno), errno);
- goto bail;
- }
-
- /* passive connection handler */
- if (ftp->pasv) {
- /* clear the ready status */
- ftp->pasv = 1;
-
- /* connect */
- /* Win 95/98 seems not to like size > sizeof(sockaddr_in) */
- size = php_sockaddr_size(&ftp->pasvaddr);
- tv.tv_sec = ftp->timeout_sec;
- tv.tv_usec = 0;
- if (php_connect_nonb(fd, (struct sockaddr*) &ftp->pasvaddr, size, &tv) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "php_connect_nonb() failed: %s (%d)\n", strerror(errno), errno);
- goto bail;
- }
-
- data->fd = fd;
-
- ftp->data = data;
- return data;
- }
-
-
- /* active (normal) connection */
-
- /* bind to a local address */
- php_any_addr(sa->sa_family, &addr, 0);
- size = php_sockaddr_size(&addr);
-
- if (bind(fd, (struct sockaddr*) &addr, size) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "bind() failed: %s (%d)\n", strerror(errno), errno);
- goto bail;
- }
-
- if (getsockname(fd, (struct sockaddr*) &addr, &size) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "getsockname() failed: %s (%d)\n", strerror(errno), errno);
- goto bail;
- }
-
- if (listen(fd, 5) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "listen() failed: %s (%d)\n", strerror(errno), errno);
- goto bail;
- }
-
- data->listener = fd;
-
-#ifdef HAVE_IPV6
- if (sa->sa_family == AF_INET6) {
- /* need to use EPRT */
- char eprtarg[INET6_ADDRSTRLEN + sizeof("|x||xxxxx|")];
- char out[INET6_ADDRSTRLEN];
- inet_ntop(AF_INET6, &((struct sockaddr_in6*) sa)->sin6_addr, out, sizeof(out));
- sprintf(eprtarg, "|2|%s|%hu|", out, ntohs(((struct sockaddr_in6 *) &addr)->sin6_port));
-
- if (!ftp_putcmd(ftp, "EPRT", eprtarg)) {
- goto bail;
- }
-
- if (!ftp_getresp(ftp) || ftp->resp != 200) {
- goto bail;
- }
-
- ftp->data = data;
- return data;
- }
-#endif
-
- /* send the PORT */
- ipbox.l[0] = ((struct sockaddr_in*) sa)->sin_addr.s_addr;
- ipbox.s[2] = ((struct sockaddr_in*) &addr)->sin_port;
- sprintf(arg, "%u,%u,%u,%u,%u,%u", ipbox.c[0], ipbox.c[1], ipbox.c[2], ipbox.c[3], ipbox.c[4], ipbox.c[5]);
-
- if (!ftp_putcmd(ftp, "PORT", arg)) {
- goto bail;
- }
- if (!ftp_getresp(ftp) || ftp->resp != 200) {
- goto bail;
- }
-
- ftp->data = data;
- return data;
-
-bail:
- if (fd != -1) {
- closesocket(fd);
- }
- efree(data);
- return NULL;
-}
-/* }}} */
-
-/* {{{ data_accept
- */
-databuf_t*
-data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC)
-{
- php_sockaddr_storage addr;
- socklen_t size;
-
-#if HAVE_OPENSSL_EXT
- SSL_CTX *ctx;
-#endif
-
- if (data->fd != -1) {
- goto data_accepted;
- }
- size = sizeof(addr);
- data->fd = my_accept(ftp, data->listener, (struct sockaddr*) &addr, &size);
- closesocket(data->listener);
- data->listener = -1;
-
- if (data->fd == -1) {
- efree(data);
- return NULL;
- }
-
-data_accepted:
-#if HAVE_OPENSSL_EXT
-
- /* now enable ssl if we need to */
- if (ftp->use_ssl && ftp->use_ssl_for_data) {
- ctx = SSL_CTX_new(SSLv23_client_method());
- if (ctx == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_accept: failed to create the SSL context");
- return 0;
- }
-
- data->ssl_handle = SSL_new(ctx);
- if (data->ssl_handle == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_accept: failed to create the SSL handle");
- SSL_CTX_free(ctx);
- return 0;
- }
-
-
- SSL_set_fd(data->ssl_handle, data->fd);
-
- if (ftp->old_ssl) {
- SSL_copy_session_id(data->ssl_handle, ftp->ssl_handle);
- }
-
- if (SSL_connect(data->ssl_handle) <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_accept: SSL/TLS handshake failed");
- SSL_shutdown(data->ssl_handle);
- return 0;
- }
-
- data->ssl_active = 1;
- }
-
-#endif
-
- return data;
-}
-/* }}} */
-
-/* {{{ data_close
- */
-databuf_t*
-data_close(ftpbuf_t *ftp, databuf_t *data)
-{
- if (data == NULL) {
- return NULL;
- }
- if (data->listener != -1) {
-#if HAVE_OPENSSL_EXT
- if (data->ssl_active) {
- SSL_shutdown(data->ssl_handle);
- data->ssl_active = 0;
- }
-#endif
- closesocket(data->listener);
- }
- if (data->fd != -1) {
-#if HAVE_OPENSSL_EXT
- if (data->ssl_active) {
- SSL_shutdown(data->ssl_handle);
- data->ssl_active = 0;
- }
-#endif
- closesocket(data->fd);
- }
- if (ftp) {
- ftp->data = NULL;
- }
- efree(data);
- return NULL;
-}
-/* }}} */
-
-/* {{{ ftp_genlist
- */
-char**
-ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
-{
- FILE *tmpfp = NULL;
- databuf_t *data = NULL;
- char *ptr;
- int ch, lastch;
- int size, rcvd;
- int lines;
- char **ret = NULL;
- char **entry;
- char *text;
-
-
- if ((tmpfp = tmpfile()) == NULL) {
- return NULL;
- }
-
- if (!ftp_type(ftp, FTPTYPE_ASCII)) {
- goto bail;
- }
-
- if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) {
- goto bail;
- }
- ftp->data = data;
-
- if (!ftp_putcmd(ftp, cmd, path)) {
- goto bail;
- }
- if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125)) {
- goto bail;
- }
-
- /* pull data buffer into tmpfile */
- if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
- goto bail;
- }
- size = 0;
- lines = 0;
- lastch = 0;
- while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) {
- if (rcvd == -1) {
- goto bail;
- }
-
- fwrite(data->buf, rcvd, 1, tmpfp);
-
- size += rcvd;
- for (ptr = data->buf; rcvd; rcvd--, ptr++) {
- if (*ptr == '\n' && lastch == '\r') {
- lines++;
- } else {
- size++;
- }
- lastch = *ptr;
- }
- }
-
- data = data_close(ftp, data);
-
- if (ferror(tmpfp)) {
- goto bail;
- }
-
- rewind(tmpfp);
-
- ret = emalloc((lines + 1) * sizeof(char**) + size * sizeof(char*));
-
- entry = ret;
- text = (char*) (ret + lines + 1);
- *entry = text;
- lastch = 0;
- while ((ch = getc(tmpfp)) != EOF) {
- if (ch == '\n' && lastch == '\r') {
- *(text - 1) = 0;
- *++entry = text;
- } else {
- *text++ = ch;
- }
- lastch = ch;
- }
- *entry = NULL;
-
- if (ferror(tmpfp)) {
- goto bail;
- }
- fclose(tmpfp);
-
- if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
- efree(ret);
- return NULL;
- }
-
- return ret;
-bail:
- if (data)
- data_close(ftp, data);
- fclose(tmpfp);
- if (ret)
- efree(ret);
- return NULL;
-}
-/* }}} */
-
-/* {{{ ftp_nb_get
- */
-int
-ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC)
-{
- databuf_t *data = NULL;
- char arg[11];
-
- if (ftp == NULL) {
- goto bail;
- }
-
- if (!ftp_type(ftp, type)) {
- goto bail;
- }
-
- if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) {
- goto bail;
- }
-
- if (resumepos>0) {
- /* We are working on an architecture that supports 64-bit integers
- * since php is 32 bit by design, we bail out with warning
- */
- if (resumepos > 2147483647) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater then 2147483648 bytes.\n");
- goto bail;
- }
- sprintf(arg, "%u", resumepos);
- if (!ftp_putcmd(ftp, "REST", arg)) {
- goto bail;
- }
- if (!ftp_getresp(ftp) || (ftp->resp != 350)) {
- goto bail;
- }
- }
-
- if (!ftp_putcmd(ftp, "RETR", path)) {
- goto bail;
- }
- if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125)) {
- goto bail;
- }
-
- if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
- goto bail;
- }
-
- ftp->data = data;
- ftp->stream = outstream;
- ftp->lastch = 0;
- ftp->nb = 1;
-
- return (ftp_nb_continue_read(ftp TSRMLS_CC));
-
-bail:
- data_close(ftp, data);
- return PHP_FTP_FAILED;
-}
-/* }}} */
-
-/* {{{ ftp_nb_continue_read
- */
-int
-ftp_nb_continue_read(ftpbuf_t *ftp TSRMLS_DC)
-{
- databuf_t *data = NULL;
- char *ptr;
- int lastch;
- size_t rcvd;
- ftptype_t type;
-
- data = ftp->data;
-
- /* check if there is already more data */
- if (!data_available(ftp, data->fd)) {
- return PHP_FTP_MOREDATA;
- }
-
- type = ftp->type;
-
- lastch = ftp->lastch;
- if ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) {
- if (rcvd == -1) {
- goto bail;
- }
-
- if (type == FTPTYPE_ASCII) {
- for (ptr = data->buf; rcvd; rcvd--, ptr++) {
- if (lastch == '\r' && *ptr != '\n') {
- php_stream_putc(ftp->stream, '\r');
- }
- if (*ptr != '\r') {
- php_stream_putc(ftp->stream, *ptr);
- }
- lastch = *ptr;
- }
- } else if (rcvd != php_stream_write(ftp->stream, data->buf, rcvd)) {
- goto bail;
- }
-
- ftp->lastch = lastch;
- return PHP_FTP_MOREDATA;
- }
-
- if (type == FTPTYPE_ASCII && lastch == '\r') {
- php_stream_putc(ftp->stream, '\r');
- }
-
- data = data_close(ftp, data);
-
- if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
- goto bail;
- }
-
- ftp->nb = 0;
- return PHP_FTP_FINISHED;
-bail:
- ftp->nb = 0;
- data_close(ftp, data);
- return PHP_FTP_FAILED;
-}
-/* }}} */
-
-/* {{{ ftp_nb_put
- */
-int
-ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC)
-{
- databuf_t *data = NULL;
- char arg[11];
-
- if (ftp == NULL) {
- return 0;
- }
- if (!ftp_type(ftp, type)) {
- goto bail;
- }
- if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) {
- goto bail;
- }
- if (startpos > 0) {
- if (startpos > 2147483647) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater then 2147483647 bytes.\n");
- goto bail;
- }
- sprintf(arg, "%u", startpos);
- if (!ftp_putcmd(ftp, "REST", arg)) {
- goto bail;
- }
- if (!ftp_getresp(ftp) || (ftp->resp != 350)) {
- goto bail;
- }
- }
-
- if (!ftp_putcmd(ftp, "STOR", path)) {
- goto bail;
- }
- if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125)) {
- goto bail;
- }
- if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
- goto bail;
- }
- ftp->data = data;
- ftp->stream = instream;
- ftp->lastch = 0;
- ftp->nb = 1;
-
- return (ftp_nb_continue_write(ftp TSRMLS_CC));
-
-bail:
- data_close(ftp, data);
- return PHP_FTP_FAILED;
-}
-/* }}} */
-
-
-/* {{{ ftp_nb_continue_write
- */
-int
-ftp_nb_continue_write(ftpbuf_t *ftp TSRMLS_DC)
-{
- int size;
- char *ptr;
- int ch;
-
- /* check if we can write more data */
- if (!data_writeable(ftp, ftp->data->fd)) {
- return PHP_FTP_MOREDATA;
- }
-
- size = 0;
- ptr = ftp->data->buf;
- while (!php_stream_eof(ftp->stream) && (ch = php_stream_getc(ftp->stream)) != EOF) {
-
- if (ch == '\n' && ftp->type == FTPTYPE_ASCII) {
- *ptr++ = '\r';
- size++;
- }
-
- *ptr++ = ch;
- size++;
-
- /* flush if necessary */
- if (FTP_BUFSIZE - size < 2) {
- if (my_send(ftp, ftp->data->fd, ftp->data->buf, size) != size) {
- goto bail;
- }
- return PHP_FTP_MOREDATA;
- }
- }
-
- if (size && my_send(ftp, ftp->data->fd, ftp->data->buf, size) != size) {
- goto bail;
- }
- ftp->data = data_close(ftp, ftp->data);
-
- if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
- goto bail;
- }
- ftp->nb = 0;
- return PHP_FTP_FINISHED;
-bail:
- data_close(ftp, ftp->data);
- ftp->nb = 0;
- return PHP_FTP_FAILED;
-}
-/* }}} */
-
-#endif /* HAVE_FTP */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h
deleted file mode 100644
index f934a989ee..0000000000
--- a/ext/ftp/ftp.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andrew Skalski <askalski@chek.com> |
- | Stefan Esser <sesser@php.net> (resume functions) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef FTP_H
-#define FTP_H
-
-#include "php_network.h"
-
-#include <stdio.h>
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-#define FTP_DEFAULT_TIMEOUT 90
-#define FTP_DEFAULT_AUTOSEEK 1
-#define PHP_FTP_FAILED 0
-#define PHP_FTP_FINISHED 1
-#define PHP_FTP_MOREDATA 2
-
-/* XXX this should be configurable at runtime XXX */
-#define FTP_BUFSIZE 4096
-
-typedef enum ftptype {
- FTPTYPE_ASCII,
- FTPTYPE_IMAGE
-} ftptype_t;
-
-typedef struct databuf
-{
- int listener; /* listener socket */
- php_socket_t fd; /* data connection */
- ftptype_t type; /* transfer type */
- char buf[FTP_BUFSIZE]; /* data buffer */
-#if HAVE_OPENSSL_EXT
- SSL *ssl_handle; /* ssl handle */
- int ssl_active; /* flag if ssl is active or not */
-#endif
-} databuf_t;
-
-typedef struct ftpbuf
-{
- php_socket_t fd; /* control connection */
- php_sockaddr_storage localaddr; /* local address */
- int resp; /* last response code */
- char inbuf[FTP_BUFSIZE]; /* last response text */
- char *extra; /* extra characters */
- int extralen; /* number of extra chars */
- char outbuf[FTP_BUFSIZE]; /* command output buffer */
- char *pwd; /* cached pwd */
- char *syst; /* cached system type */
- ftptype_t type; /* current transfer type */
- int pasv; /* 0=off; 1=pasv; 2=ready */
- php_sockaddr_storage pasvaddr; /* passive mode address */
- long timeout_sec; /* User configureable timeout (seconds) */
- int autoseek; /* User configureable autoseek flag */
-
- int nb; /* "nonblocking" transfer in progress */
- databuf_t *data; /* Data connection for "nonblocking" transfers */
- php_stream *stream; /* output stream for "nonblocking" transfers */
- int lastch; /* last char of previous call */
- int direction; /* recv = 0 / send = 1 */
- int closestream;/* close or not close stream */
-#if HAVE_OPENSSL_EXT
- int use_ssl; /* enable(1) or disable(0) ssl */
- int use_ssl_for_data; /* en/disable ssl for the dataconnection */
- int old_ssl; /* old mode = forced data encryption */
- SSL *ssl_handle; /* handle for control connection */
- int ssl_active; /* ssl active on control conn */
-#endif
-
-} ftpbuf_t;
-
-
-
-/* open a FTP connection, returns ftpbuf (NULL on error)
- * port is the ftp port in network byte order, or 0 for the default
- */
-ftpbuf_t* ftp_open(const char *host, short port, long timeout_sec TSRMLS_DC);
-
-/* quits from the ftp session (it still needs to be closed)
- * return true on success, false on error
- */
-int ftp_quit(ftpbuf_t *ftp);
-
-/* frees up any cached data held in the ftp buffer */
-void ftp_gc(ftpbuf_t *ftp);
-
-/* close the FTP connection and return NULL */
-ftpbuf_t* ftp_close(ftpbuf_t *ftp);
-
-/* logs into the FTP server, returns true on success, false on error */
-int ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC);
-
-/* reinitializes the connection, returns true on success, false on error */
-int ftp_reinit(ftpbuf_t *ftp);
-
-/* returns the remote system type (NULL on error) */
-const char* ftp_syst(ftpbuf_t *ftp);
-
-/* returns the present working directory (NULL on error) */
-const char* ftp_pwd(ftpbuf_t *ftp);
-
-/* exec a command [special features], return true on success, false on error */
-int ftp_exec(ftpbuf_t *ftp, const char *cmd);
-
-/* send a raw ftp command, return response as a hashtable, NULL on error */
-void ftp_raw(ftpbuf_t *ftp, const char *cmd, zval *return_value);
-
-/* changes directories, return true on success, false on error */
-int ftp_chdir(ftpbuf_t *ftp, const char *dir);
-
-/* changes to parent directory, return true on success, false on error */
-int ftp_cdup(ftpbuf_t *ftp);
-
-/* creates a directory, return the directory name on success, NULL on error.
- * the return value must be freed
- */
-char* ftp_mkdir(ftpbuf_t *ftp, const char *dir);
-
-/* removes a directory, return true on success, false on error */
-int ftp_rmdir(ftpbuf_t *ftp, const char *dir);
-
-/* Set permissions on a file */
-int ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int filename_len);
-
-/* returns a NULL-terminated array of filenames in the given path
- * or NULL on error. the return array must be freed (but don't
- * free the array elements)
- */
-char** ftp_nlist(ftpbuf_t *ftp, const char *path TSRMLS_DC);
-
-/* returns a NULL-terminated array of lines returned by the ftp
- * LIST command for the given path or NULL on error. the return
- * array must be freed (but don't
- * free the array elements)
- */
-char** ftp_list(ftpbuf_t *ftp, const char *path, int recursive TSRMLS_DC);
-
-/* switches passive mode on or off
- * returns true on success, false on error
- */
-int ftp_pasv(ftpbuf_t *ftp, int pasv);
-
-/* retrieves a file and saves its contents to outfp
- * returns true on success, false on error
- */
-int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC);
-
-/* stores the data from a file, socket, or process as a file on the remote server
- * returns true on success, false on error
- */
-int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC);
-
-/* returns the size of the given file, or -1 on error */
-int ftp_size(ftpbuf_t *ftp, const char *path);
-
-/* returns the last modified time of the given file, or -1 on error */
-time_t ftp_mdtm(ftpbuf_t *ftp, const char *path);
-
-/* renames a file on the server */
-int ftp_rename(ftpbuf_t *ftp, const char *src, const char *dest);
-
-/* deletes the file from the server */
-int ftp_delete(ftpbuf_t *ftp, const char *path);
-
-/* sends a SITE command to the server */
-int ftp_site(ftpbuf_t *ftp, const char *cmd);
-
-/* retrieves part of a file and saves its contents to outfp
- * returns true on success, false on error
- */
-int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC);
-
-/* stores the data from a file, socket, or process as a file on the remote server
- * returns true on success, false on error
- */
-int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC);
-
-/* continues a previous nb_(f)get command
- */
-int ftp_nb_continue_read(ftpbuf_t *ftp TSRMLS_DC);
-
-/* continues a previous nb_(f)put command
- */
-int ftp_nb_continue_write(ftpbuf_t *ftp TSRMLS_DC);
-
-
-#endif
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c
deleted file mode 100644
index e2f19a4b47..0000000000
--- a/ext/ftp/php_ftp.c
+++ /dev/null
@@ -1,1214 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andrew Skalski <askalski@chek.com> |
- | Stefan Esser <sesser@php.net> (resume functions) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#ifdef NETWARE
-#ifdef USE_WINSOCK
-#include <novsock2.h>
-#else
-#ifndef NEW_LIBC
-#include <sys/socket.h>
-#endif
-#endif
-#endif
-
-#if HAVE_OPENSSL_EXT
-#include <openssl/ssl.h>
-#endif
-
-#if HAVE_FTP
-
-#include "ext/standard/info.h"
-#include "ext/standard/file.h"
-
-#include "php_ftp.h"
-#include "ftp.h"
-
-static int le_ftpbuf;
-#define le_ftpbuf_name "FTP Buffer"
-
-function_entry php_ftp_functions[] = {
- PHP_FE(ftp_connect, NULL)
-#if HAVE_OPENSSL_EXT
- PHP_FE(ftp_ssl_connect, NULL)
-#endif
- PHP_FE(ftp_login, NULL)
- PHP_FE(ftp_pwd, NULL)
- PHP_FE(ftp_cdup, NULL)
- PHP_FE(ftp_chdir, NULL)
- PHP_FE(ftp_exec, NULL)
- PHP_FE(ftp_raw, NULL)
- PHP_FE(ftp_mkdir, NULL)
- PHP_FE(ftp_rmdir, NULL)
- PHP_FE(ftp_chmod, NULL)
- PHP_FE(ftp_nlist, NULL)
- PHP_FE(ftp_rawlist, NULL)
- PHP_FE(ftp_systype, NULL)
- PHP_FE(ftp_pasv, NULL)
- PHP_FE(ftp_get, NULL)
- PHP_FE(ftp_fget, NULL)
- PHP_FE(ftp_put, NULL)
- PHP_FE(ftp_fput, NULL)
- PHP_FE(ftp_size, NULL)
- PHP_FE(ftp_mdtm, NULL)
- PHP_FE(ftp_rename, NULL)
- PHP_FE(ftp_delete, NULL)
- PHP_FE(ftp_site, NULL)
- PHP_FE(ftp_close, NULL)
- PHP_FE(ftp_set_option, NULL)
- PHP_FE(ftp_get_option, NULL)
- PHP_FE(ftp_nb_fget, NULL)
- PHP_FE(ftp_nb_get, NULL)
- PHP_FE(ftp_nb_continue, NULL)
- PHP_FE(ftp_nb_put, NULL)
- PHP_FE(ftp_nb_fput, NULL)
- PHP_FALIAS(ftp_quit, ftp_close, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry php_ftp_module_entry = {
- STANDARD_MODULE_HEADER,
- "ftp",
- php_ftp_functions,
- PHP_MINIT(ftp),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(ftp),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_FTP
-ZEND_GET_MODULE(php_ftp)
-#endif
-
-static void ftp_destructor_ftpbuf(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- ftpbuf_t *ftp = (ftpbuf_t *)rsrc->ptr;
-
- ftp_close(ftp);
-}
-
-PHP_MINIT_FUNCTION(ftp)
-{
- le_ftpbuf = zend_register_list_destructors_ex(ftp_destructor_ftpbuf, NULL, le_ftpbuf_name, module_number);
- REGISTER_LONG_CONSTANT("FTP_ASCII", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("FTP_TEXT", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("FTP_BINARY", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("FTP_IMAGE", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("FTP_AUTORESUME", PHP_FTP_AUTORESUME, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("FTP_TIMEOUT_SEC", PHP_FTP_OPT_TIMEOUT_SEC, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("FTP_AUTOSEEK", PHP_FTP_OPT_AUTOSEEK, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("FTP_FAILED", PHP_FTP_FAILED, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("FTP_FINISHED", PHP_FTP_FINISHED, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("FTP_MOREDATA", PHP_FTP_MOREDATA, CONST_PERSISTENT | CONST_CS);
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(ftp)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "FTP support", "enabled");
- php_info_print_table_end();
-}
-
-#define XTYPE(xtype, mode) { \
- if (mode != FTPTYPE_ASCII && mode != FTPTYPE_IMAGE) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Mode must be FTP_ASCII or FTP_BINARY"); \
- RETURN_FALSE; \
- } \
- xtype = mode; \
- }
-
-
-/* {{{ proto resource ftp_connect(string host [, int port [, int timeout)]])
- Opens a FTP stream */
-PHP_FUNCTION(ftp_connect)
-{
- ftpbuf_t *ftp;
- char *host;
- int host_len;
- long port = 0;
- long timeout_sec = FTP_DEFAULT_TIMEOUT;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &host, &host_len, &port, &timeout_sec) == FAILURE) {
- return;
- }
-
- if (timeout_sec <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Timeout has to be greater than 0");
- RETURN_FALSE;
- }
-
- /* connect */
- if (!(ftp = ftp_open(host, (short)port, timeout_sec TSRMLS_CC))) {
- RETURN_FALSE;
- }
-
- /* autoseek for resuming */
- ftp->autoseek = FTP_DEFAULT_AUTOSEEK;
-#if HAVE_OPENSSL_EXT
- /* disable ssl */
- ftp->use_ssl = 0;
-#endif
-
- ZEND_REGISTER_RESOURCE(return_value, ftp, le_ftpbuf);
-}
-/* }}} */
-
-#if HAVE_OPENSSL_EXT
-/* {{{ proto resource ftp_ssl_connect(string host [, int port [, int timeout)]])
- Opens a FTP-SSL stream */
-PHP_FUNCTION(ftp_ssl_connect)
-{
- ftpbuf_t *ftp;
- char *host;
- int host_len;
- long port = 0;
- long timeout_sec = FTP_DEFAULT_TIMEOUT;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &host, &host_len, &port, &timeout_sec) == FAILURE) {
- return;
- }
-
- if (timeout_sec <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Timeout has to be greater than 0");
- RETURN_FALSE;
- }
-
- /* connect */
- if (!(ftp = ftp_open(host, (short)port, timeout_sec TSRMLS_CC))) {
- RETURN_FALSE;
- }
-
- /* autoseek for resuming */
- ftp->autoseek = FTP_DEFAULT_AUTOSEEK;
- /* enable ssl */
- ftp->use_ssl = 1;
-
- ZEND_REGISTER_RESOURCE(return_value, ftp, le_ftpbuf);
-}
-/* }}} */
-#endif
-
-/* {{{ proto bool ftp_login(resource stream, string username, string password)
- Logs into the FTP server */
-PHP_FUNCTION(ftp_login)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- char *user, *pass;
- int user_len, pass_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &z_ftp, &user, &user_len, &pass, &pass_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- /* log in */
- if (!ftp_login(ftp, user, pass TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string ftp_pwd(resource stream)
- Returns the present working directory */
-PHP_FUNCTION(ftp_pwd)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- const char *pwd;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ftp) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- if (!(pwd = ftp_pwd(ftp))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_STRING((char*) pwd, 1);
-}
-/* }}} */
-
-/* {{{ proto bool ftp_cdup(resource stream)
- Changes to the parent directory */
-PHP_FUNCTION(ftp_cdup)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ftp) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- if (!ftp_cdup(ftp)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ftp_chdir(resource stream, string directory)
- Changes directories */
-PHP_FUNCTION(ftp_chdir)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- char *dir;
- int dir_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &dir, &dir_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- /* change directories */
- if (!ftp_chdir(ftp, dir)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ftp_exec(resource stream, string command)
- Requests execution of a program on the FTP server */
-PHP_FUNCTION(ftp_exec)
-{
- pval *z_ftp;
- ftpbuf_t *ftp;
- char *cmd;
- int cmd_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &cmd, &cmd_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- /* execute serverside command */
- if (!ftp_exec(ftp, cmd)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array ftp_raw(resource stream, string command)
- Sends a literal command to the FTP server */
-PHP_FUNCTION(ftp_raw)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- char *cmd;
- int cmd_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &cmd, &cmd_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- /* execute arbitrary ftp command */
- ftp_raw(ftp, cmd, return_value);
-}
-/* }}} */
-
-/* {{{ proto string ftp_mkdir(resource stream, string directory)
- Creates a directory and returns the absolute path for the new directory or false on error */
-PHP_FUNCTION(ftp_mkdir)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- char *dir, *tmp;
- int dir_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &dir, &dir_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- /* create directorie */
- if (NULL == (tmp = ftp_mkdir(ftp, dir))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_STRING(tmp, 0);
-}
-/* }}} */
-
-/* {{{ proto bool ftp_rmdir(resource stream, string directory)
- Removes a directory */
-PHP_FUNCTION(ftp_rmdir)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- char *dir;
- int dir_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &dir, &dir_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- /* remove directorie */
- if (!ftp_rmdir(ftp, dir)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ftp_chmod(resource stream, int mode, string filename)
- Sets permissions on a file */
-PHP_FUNCTION(ftp_chmod)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- char *filename;
- int filename_len;
- long mode;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls", &z_ftp, &mode, &filename, &filename_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- if (!ftp_chmod(ftp, mode, filename, filename_len)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_LONG(mode);
-}
-/* }}} */
-
-/* {{{ proto array ftp_nlist(resource stream, string directory)
- Returns an array of filenames in the given directory */
-PHP_FUNCTION(ftp_nlist)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- char **nlist, **ptr, *dir;
- int dir_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &dir, &dir_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- /* get list of files */
- if (NULL == (nlist = ftp_nlist(ftp, dir TSRMLS_CC))) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- for (ptr = nlist; *ptr; ptr++) {
- add_next_index_string(return_value, *ptr, 1);
- }
- efree(nlist);
-}
-/* }}} */
-
-/* {{{ proto array ftp_rawlist(resource stream, string directory [, bool recursive])
- Returns a detailed listing of a directory as an array of output lines */
-PHP_FUNCTION(ftp_rawlist)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- char **llist, **ptr, *dir;
- int dir_len;
- zend_bool recursive = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|b", &z_ftp, &dir, &dir_len, &recursive) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- /* get raw directory listing */
- if (NULL == (llist = ftp_list(ftp, dir, recursive TSRMLS_CC))) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- for (ptr = llist; *ptr; ptr++) {
- add_next_index_string(return_value, *ptr, 1);
- }
- efree(llist);
-}
-/* }}} */
-
-/* {{{ proto string ftp_systype(resource stream)
- Returns the system type identifier */
-PHP_FUNCTION(ftp_systype)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- const char *syst;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ftp) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- if (NULL == (syst = ftp_syst(ftp))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_STRING((char*) syst, 1);
-}
-/* }}} */
-
-/* {{{ proto bool ftp_fget(resource stream, resource fp, string remote_file, int mode[, int resumepos])
- Retrieves a file from the FTP server and writes it to an open file */
-PHP_FUNCTION(ftp_fget)
-{
- zval *z_ftp, *z_file;
- ftpbuf_t *ftp;
- ftptype_t xtype;
- php_stream *stream;
- char *file;
- int file_len;
- long mode, resumepos=0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
- php_stream_from_zval(stream, &z_file);
- XTYPE(xtype, mode);
-
- /* ignore autoresume if autoseek is switched off */
- if (!ftp->autoseek && resumepos == PHP_FTP_AUTORESUME) {
- resumepos = 0;
- }
-
- if (ftp->autoseek && resumepos) {
- /* if autoresume is wanted seek to end */
- if (resumepos == PHP_FTP_AUTORESUME) {
- php_stream_seek(stream, 0, SEEK_END);
- resumepos = php_stream_tell(stream);
- } else {
- php_stream_seek(stream, resumepos, SEEK_SET);
- }
- }
-
- if (!ftp_get(ftp, stream, file, xtype, resumepos TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ftp_nb_fget(resource stream, resource fp, string remote_file, int mode[, int resumepos])
- Retrieves a file from the FTP server asynchronly and writes it to an open file */
-PHP_FUNCTION(ftp_nb_fget)
-{
- zval *z_ftp, *z_file;
- ftpbuf_t *ftp;
- ftptype_t xtype;
- php_stream *stream;
- char *file;
- int file_len, ret;
- long mode, resumepos=0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
- php_stream_from_zval(stream, &z_file);
- XTYPE(xtype, mode);
-
- /* ignore autoresume if autoseek is switched off */
- if (!ftp->autoseek && resumepos == PHP_FTP_AUTORESUME) {
- resumepos = 0;
- }
-
- if (ftp->autoseek && resumepos) {
- /* if autoresume is wanted seek to end */
- if (resumepos == PHP_FTP_AUTORESUME) {
- php_stream_seek(stream, 0, SEEK_END);
- resumepos = php_stream_tell(stream);
- } else {
- php_stream_seek(stream, resumepos, SEEK_SET);
- }
- }
-
- /* configuration */
- ftp->direction = 0; /* recv */
- ftp->closestream = 0; /* do not close */
-
- if ((ret = ftp_nb_get(ftp, stream, file, xtype, resumepos TSRMLS_CC)) == PHP_FTP_FAILED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_LONG(ret);
- }
-
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto bool ftp_pasv(resource stream, bool pasv)
- Turns passive mode on or off */
-PHP_FUNCTION(ftp_pasv)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- zend_bool pasv;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &z_ftp, &pasv) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- if (!ftp_pasv(ftp, pasv ? 1 : 0)) {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ftp_get(resource stream, string local_file, string remote_file, int mode[, int resume_pos])
- Retrieves a file from the FTP server and writes it to a local file */
-PHP_FUNCTION(ftp_get)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- ftptype_t xtype;
- php_stream *outstream;
- char *local, *remote;
- int local_len, remote_len;
- long mode, resumepos=0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
- XTYPE(xtype, mode);
-
- /* ignore autoresume if autoseek is switched off */
- if (!ftp->autoseek && resumepos == PHP_FTP_AUTORESUME) {
- resumepos = 0;
- }
-
- if (ftp->autoseek && resumepos) {
- outstream = php_stream_fopen(local, "rb+", NULL);
- if (outstream == NULL) {
- outstream = php_stream_fopen(local, "wb", NULL);
- }
- if (outstream != NULL) {
- /* if autoresume is wanted seek to end */
- if (resumepos == PHP_FTP_AUTORESUME) {
- php_stream_seek(outstream, 0, SEEK_END);
- resumepos = php_stream_tell(outstream);
- } else {
- php_stream_seek(outstream, resumepos, SEEK_SET);
- }
- }
- } else {
- outstream = php_stream_fopen(local, "wb", NULL);
- }
-
- if (outstream == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error opening %s", local);
- RETURN_FALSE;
- }
-
- if (!ftp_get(ftp, outstream, remote, xtype, resumepos TSRMLS_CC)) {
- php_stream_close(outstream);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- php_stream_close(outstream);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ftp_nb_get(resource stream, string local_file, string remote_file, int mode[, int resume_pos])
- Retrieves a file from the FTP server nbhronly and writes it to a local file */
-PHP_FUNCTION(ftp_nb_get)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- ftptype_t xtype;
- php_stream *outstream;
- char *local, *remote;
- int local_len, remote_len, ret;
- long mode, resumepos=0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
- XTYPE(xtype, mode);
-
- /* ignore autoresume if autoseek is switched off */
- if (!ftp->autoseek && resumepos == PHP_FTP_AUTORESUME) {
- resumepos = 0;
- }
-
- if (ftp->autoseek && resumepos) {
- outstream = php_stream_fopen(local, "rb+", NULL);
- if (outstream == NULL) {
- outstream = php_stream_fopen(local, "wb", NULL);
- }
- if (outstream != NULL) {
- /* if autoresume is wanted seek to end */
- if (resumepos == PHP_FTP_AUTORESUME) {
- php_stream_seek(outstream, 0, SEEK_END);
- resumepos = php_stream_tell(outstream);
- } else {
- php_stream_seek(outstream, resumepos, SEEK_SET);
- }
- }
- } else {
- outstream = php_stream_fopen(local, "wb", NULL);
- }
-
- if (outstream == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error opening %s", local);
- RETURN_FALSE;
- }
-
- /* configuration */
- ftp->direction = 0; /* recv */
- ftp->closestream = 1; /* do close */
-
- if ((ret = ftp_nb_get(ftp, outstream, remote, xtype, resumepos TSRMLS_CC)) == PHP_FTP_FAILED) {
- php_stream_close(outstream);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_LONG(PHP_FTP_FAILED);
- }
-
- if (ret == PHP_FTP_FINISHED) {
- php_stream_close(outstream);
- }
-
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto int ftp_nb_continue(resource stream)
- Continues retrieving/sending a file nbronously */
-PHP_FUNCTION(ftp_nb_continue)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- int ret;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ftp) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- if (!ftp->nb) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "no nbronous transfer to continue.");
- RETURN_LONG(PHP_FTP_FAILED);
- }
-
- if (ftp->direction) {
- ret=ftp_nb_continue_write(ftp TSRMLS_CC);
- } else {
- ret=ftp_nb_continue_read(ftp TSRMLS_CC);
- }
-
- if (ret != PHP_FTP_MOREDATA && ftp->closestream) {
- php_stream_close(ftp->stream);
- }
-
- if (ret == PHP_FTP_FAILED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- }
-
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto bool ftp_fput(resource stream, string remote_file, resource fp, int mode[, int startpos])
- Stores a file from an open file to the FTP server */
-PHP_FUNCTION(ftp_fput)
-{
- zval *z_ftp, *z_file;
- ftpbuf_t *ftp;
- ftptype_t xtype;
- int remote_len;
- long mode, startpos=0;
- php_stream *stream;
- char *remote;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrl|l", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
- php_stream_from_zval(stream, &z_file);
- XTYPE(xtype, mode);
-
- /* ignore autoresume if autoseek is switched off */
- if (!ftp->autoseek && startpos == PHP_FTP_AUTORESUME) {
- startpos = 0;
- }
-
- if (ftp->autoseek && startpos) {
- /* if autoresume is wanted ask for remote size */
- if (startpos == PHP_FTP_AUTORESUME) {
- startpos = ftp_size(ftp, remote);
- if (startpos < 0) {
- startpos = 0;
- }
- }
- if (startpos) {
- php_stream_seek(stream, startpos, SEEK_SET);
- }
- }
-
- if (!ftp_put(ftp, remote, stream, xtype, startpos TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ftp_nb_fput(resource stream, string remote_file, resource fp, int mode[, int startpos])
- Stores a file from an open file to the FTP server nbronly */
-PHP_FUNCTION(ftp_nb_fput)
-{
- zval *z_ftp, *z_file;
- ftpbuf_t *ftp;
- ftptype_t xtype;
- int remote_len, ret;
- long mode, startpos=0;
- php_stream *stream;
- char *remote;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrl|l", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
- php_stream_from_zval(stream, &z_file);
- XTYPE(xtype, mode);
-
- /* ignore autoresume if autoseek is switched off */
- if (!ftp->autoseek && startpos == PHP_FTP_AUTORESUME) {
- startpos = 0;
- }
-
- if (ftp->autoseek && startpos) {
- /* if autoresume is wanted ask for remote size */
- if (startpos == PHP_FTP_AUTORESUME) {
- startpos = ftp_size(ftp, remote);
- if (startpos < 0) {
- startpos = 0;
- }
- }
- if (startpos) {
- php_stream_seek(stream, startpos, SEEK_SET);
- }
- }
-
- /* configuration */
- ftp->direction = 1; /* send */
- ftp->closestream = 0; /* do not close */
-
- if (((ret = ftp_nb_put(ftp, remote, stream, xtype, startpos TSRMLS_CC)) == PHP_FTP_FAILED)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_LONG(ret);
- }
-
- RETURN_LONG(ret);
-}
-/* }}} */
-
-
-/* {{{ proto bool ftp_put(resource stream, string remote_file, string local_file, int mode[, int startpos])
- Stores a file on the FTP server */
-PHP_FUNCTION(ftp_put)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- ftptype_t xtype;
- char *remote, *local;
- int remote_len, local_len;
- long mode, startpos=0;
- php_stream *instream;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
- XTYPE(xtype, mode);
-
- if (!(instream = php_stream_fopen(local, "rb", NULL))) {
- RETURN_FALSE;
- }
-
- /* ignore autoresume if autoseek is switched off */
- if (!ftp->autoseek && startpos == PHP_FTP_AUTORESUME) {
- startpos = 0;
- }
-
- if (ftp->autoseek && startpos) {
- /* if autoresume is wanted ask for remote size */
- if (startpos == PHP_FTP_AUTORESUME) {
- startpos = ftp_size(ftp, remote);
- if (startpos < 0) {
- startpos = 0;
- }
- }
- if (startpos) {
- php_stream_seek(instream, startpos, SEEK_SET);
- }
- }
-
- if (!ftp_put(ftp, remote, instream, xtype, startpos TSRMLS_CC)) {
- php_stream_close(instream);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
- php_stream_close(instream);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto bool ftp_nb_put(resource stream, string remote_file, string local_file, int mode[, int startpos])
- Stores a file on the FTP server */
-PHP_FUNCTION(ftp_nb_put)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- ftptype_t xtype;
- char *remote, *local;
- int remote_len, local_len, ret;
- long mode, startpos=0;
- php_stream *instream;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
- XTYPE(xtype, mode);
-
- if (!(instream = php_stream_fopen(local, "rb", NULL))) {
- RETURN_FALSE;
- }
-
- /* ignore autoresume if autoseek is switched off */
- if (!ftp->autoseek && startpos == PHP_FTP_AUTORESUME) {
- startpos = 0;
- }
-
- if (ftp->autoseek && startpos) {
- /* if autoresume is wanted ask for remote size */
- if (startpos == PHP_FTP_AUTORESUME) {
- startpos = ftp_size(ftp, remote);
- if (startpos < 0) {
- startpos = 0;
- }
- }
- if (startpos) {
- php_stream_seek(instream, startpos, SEEK_SET);
- }
- }
-
- /* configuration */
- ftp->direction = 1; /* send */
- ftp->closestream = 1; /* do close */
-
- ret = ftp_nb_put(ftp, remote, instream, xtype, startpos TSRMLS_CC);
-
- if (ret != PHP_FTP_MOREDATA) {
- php_stream_close(instream);
- }
-
- if (ret == PHP_FTP_FAILED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- }
-
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto int ftp_size(resource stream, string filename)
- Returns the size of the file, or -1 on error */
-PHP_FUNCTION(ftp_size)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- char *file;
- int file_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &file, &file_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- /* get file size */
- RETURN_LONG(ftp_size(ftp, file));
-}
-/* }}} */
-
-/* {{{ proto int ftp_mdtm(resource stream, string filename)
- Returns the last modification time of the file, or -1 on error */
-PHP_FUNCTION(ftp_mdtm)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- char *file;
- int file_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &file, &file_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- /* get file mod time */
- RETURN_LONG(ftp_mdtm(ftp, file));
-}
-/* }}} */
-
-/* {{{ proto bool ftp_rename(resource stream, string src, string dest)
- Renames the given file to a new path */
-PHP_FUNCTION(ftp_rename)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- char *src, *dest;
- int src_len, dest_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &z_ftp, &src, &src_len, &dest, &dest_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- /* rename the file */
- if (!ftp_rename(ftp, src, dest)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ftp_delete(resource stream, string file)
- Deletes a file */
-PHP_FUNCTION(ftp_delete)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- char *file;
- int file_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &file, &file_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- /* delete the file */
- if (!ftp_delete(ftp, file)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ftp_site(resource stream, string cmd)
- Sends a SITE command to the server */
-PHP_FUNCTION(ftp_site)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
- char *cmd;
- int cmd_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &cmd, &cmd_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- /* send the site command */
- if (!ftp_site(ftp, cmd)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void ftp_close(resource stream)
- Closes the FTP stream */
-PHP_FUNCTION(ftp_close)
-{
- zval *z_ftp;
- ftpbuf_t *ftp;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ftp) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- ftp_quit(ftp);
-
- RETURN_BOOL(zend_list_delete(Z_LVAL_P(z_ftp)) == SUCCESS);
-}
-/* }}} */
-
-/* {{{ proto bool ftp_set_option(resource stream, int option, mixed value)
- Sets an FTP option */
-PHP_FUNCTION(ftp_set_option)
-{
- zval *z_ftp, *z_value;
- long option;
- ftpbuf_t *ftp;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &z_ftp, &option, &z_value) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- switch (option) {
- case PHP_FTP_OPT_TIMEOUT_SEC:
- if (Z_TYPE_P(z_value) != IS_LONG) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Option TIMEOUT_SEC expects value of type long, %s given",
- zend_zval_type_name(z_value));
- RETURN_FALSE;
- }
- if (Z_LVAL_P(z_value) <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Timeout has to be greater than 0");
- RETURN_FALSE;
- }
- ftp->timeout_sec = Z_LVAL_P(z_value);
- RETURN_TRUE;
- break;
- case PHP_FTP_OPT_AUTOSEEK:
- if (Z_TYPE_P(z_value) != IS_BOOL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Option AUTOSEEK expects value of type boolean, %s given",
- zend_zval_type_name(z_value));
- RETURN_FALSE;
- }
- ftp->autoseek = Z_LVAL_P(z_value);
- RETURN_TRUE;
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option '%d'", option);
- RETURN_FALSE;
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto mixed ftp_get_option(resource stream, int option)
- Gets an FTP option */
-PHP_FUNCTION(ftp_get_option)
-{
- zval *z_ftp;
- long option;
- ftpbuf_t *ftp;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &z_ftp, &option) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
-
- switch (option) {
- case PHP_FTP_OPT_TIMEOUT_SEC:
- RETURN_LONG(ftp->timeout_sec);
- break;
- case PHP_FTP_OPT_AUTOSEEK:
- RETURN_BOOL(ftp->autoseek);
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option '%d'", option);
- RETURN_FALSE;
- break;
- }
-}
-/* }}} */
-
-#endif /* HAVE_FTP */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/ftp/php_ftp.h b/ext/ftp/php_ftp.h
deleted file mode 100644
index 47e5ba1b34..0000000000
--- a/ext/ftp/php_ftp.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andrew Skalski <askalski@chek.com> |
- | Stefan Esser <sesser@php.net> (resume functions) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _INCLUDED_FTP_H
-#define _INCLUDED_FTP_H
-
-#if HAVE_FTP
-
-extern zend_module_entry php_ftp_module_entry;
-#define php_ftp_module_ptr &php_ftp_module_entry
-
-#define PHP_FTP_OPT_TIMEOUT_SEC 0
-#define PHP_FTP_OPT_AUTOSEEK 1
-#define PHP_FTP_AUTORESUME -1
-
-PHP_MINIT_FUNCTION(ftp);
-PHP_MINFO_FUNCTION(ftp);
-
-PHP_FUNCTION(ftp_connect);
-#if HAVE_OPENSSL_EXT
-PHP_FUNCTION(ftp_ssl_connect);
-#endif
-PHP_FUNCTION(ftp_login);
-PHP_FUNCTION(ftp_pwd);
-PHP_FUNCTION(ftp_cdup);
-PHP_FUNCTION(ftp_chdir);
-PHP_FUNCTION(ftp_exec);
-PHP_FUNCTION(ftp_raw);
-PHP_FUNCTION(ftp_mkdir);
-PHP_FUNCTION(ftp_rmdir);
-PHP_FUNCTION(ftp_chmod);
-PHP_FUNCTION(ftp_nlist);
-PHP_FUNCTION(ftp_rawlist);
-PHP_FUNCTION(ftp_systype);
-PHP_FUNCTION(ftp_pasv);
-PHP_FUNCTION(ftp_get);
-PHP_FUNCTION(ftp_fget);
-PHP_FUNCTION(ftp_put);
-PHP_FUNCTION(ftp_fput);
-PHP_FUNCTION(ftp_size);
-PHP_FUNCTION(ftp_mdtm);
-PHP_FUNCTION(ftp_rename);
-PHP_FUNCTION(ftp_delete);
-PHP_FUNCTION(ftp_site);
-PHP_FUNCTION(ftp_close);
-PHP_FUNCTION(ftp_set_option);
-PHP_FUNCTION(ftp_get_option);
-PHP_FUNCTION(ftp_nb_get);
-PHP_FUNCTION(ftp_nb_fget);
-PHP_FUNCTION(ftp_nb_put);
-PHP_FUNCTION(ftp_nb_fput);
-PHP_FUNCTION(ftp_nb_continue);
-
-#define phpext_ftp_ptr php_ftp_module_ptr
-
-#else
-#define php_ftp_module_ptr NULL
-#endif /* HAVE_FTP */
-
-#endif
diff --git a/ext/gd/CREDITS b/ext/gd/CREDITS
deleted file mode 100644
index a0b0833067..0000000000
--- a/ext/gd/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-GD imaging
-Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto, Ilia Alshanetsky, Pierre-Alain Joye
diff --git a/ext/gd/config.m4 b/ext/gd/config.m4
deleted file mode 100644
index 91c2d23a95..0000000000
--- a/ext/gd/config.m4
+++ /dev/null
@@ -1,414 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-dnl
-dnl Configure options
-dnl
-
-PHP_ARG_WITH(gd, for GD support,
-[ --with-gd[=DIR] Include GD support where DIR is GD install prefix.
- If DIR is not set, the bundled GD library will be used.])
-
-if test -z "$PHP_JPEG_DIR"; then
- PHP_ARG_WITH(jpeg-dir, for the location of libjpeg,
- [ --with-jpeg-dir[=DIR] GD: Set the path to libjpeg install prefix.], no, no)
-fi
-
-if test -z "$PHP_PNG_DIR"; then
- PHP_ARG_WITH(png-dir, for the location of libpng,
- [ --with-png-dir[=DIR] GD: Set the path to libpng install prefix.], no, no)
-fi
-
-if test -z "$PHP_ZLIB_DIR"; then
- PHP_ARG_WITH(zlib-dir, for the location of libz,
- [ --with-zlib-dir[=DIR] GD: Set the path to libz install prefix.], no, no)
-fi
-
-PHP_ARG_WITH(xpm-dir, for the location of libXpm,
-[ --with-xpm-dir[=DIR] GD: Set the path to libXpm install prefix.], no, no)
-
-PHP_ARG_WITH(ttf, for FreeType 1.x support,
-[ --with-ttf[=DIR] GD: Include FreeType 1.x support], no, no)
-
-PHP_ARG_WITH(freetype-dir, for FreeType 2,
-[ --with-freetype-dir[=DIR] GD: Set the path to FreeType 2 install prefix.], no, no)
-
-PHP_ARG_WITH(t1lib, for T1lib support,
-[ --with-t1lib[=DIR] GD: Include T1lib support. T1lib version >= 5.0.0 required], no, no)
-
-PHP_ARG_ENABLE(gd-native-ttf, whether to enable truetype string function in GD,
-[ --enable-gd-native-ttf GD: Enable TrueType string function.], no, no)
-
-PHP_ARG_ENABLE(gd-jis-conv, whether to enable JIS-mapped Japanese font support in GD,
-[ --enable-gd-jis-conv GD: Enable JIS-mapped Japanese font suppert.], no, no)
-
-dnl
-dnl Checks for the configure options
-dnl
-
-AC_DEFUN(PHP_GD_JPEG,[
- if test "$PHP_JPEG_DIR" != "no"; then
-
- for i in /usr /usr/local $PHP_JPEG_DIR; do
- test -f $i/lib/libjpeg.$SHLIB_SUFFIX_NAME -o -f $i/lib/libjpeg.a && GD_JPEG_DIR=$i
- done
-
- if test -z "$GD_JPEG_DIR"; then
- AC_MSG_ERROR([libjpeg.(a|so) not found.])
- fi
-
- PHP_CHECK_LIBRARY(jpeg,jpeg_read_header,
- [
- PHP_ADD_INCLUDE($GD_JPEG_DIR/include)
- PHP_ADD_LIBRARY_WITH_PATH(jpeg, $GD_JPEG_DIR/lib, GD_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR([Problem with libjpeg.(a|so). Please check config.log for more information.])
- ],[
- -L$GD_JPEG_DIR/lib
- ])
- else
- AC_MSG_RESULT([If configure fails try --with-jpeg-dir=<DIR>])
- fi
-])
-
-AC_DEFUN(PHP_GD_PNG,[
- if test "$PHP_PNG_DIR" != "no"; then
-
- for i in /usr /usr/local $PHP_PNG_DIR; do
- test -f $i/lib/libpng.$SHLIB_SUFFIX_NAME -o -f $i/lib/libpng.a && GD_PNG_DIR=$i
- done
-
- if test -z "$GD_PNG_DIR"; then
- AC_MSG_ERROR([libpng.(a|so) not found.])
- fi
-
- if test "$PHP_ZLIB_DIR" = "no"; then
- AC_MSG_ERROR([PNG support requires ZLIB. Use --with-zlib-dir=<DIR>])
- fi
-
- if test ! -f $GD_PNG_DIR/include/png.h; then
- AC_MSG_ERROR([png.h not found.])
- fi
-
- PHP_CHECK_LIBRARY(png,png_write_image,
- [
- PHP_ADD_INCLUDE($GD_PNG_DIR/include)
- PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/lib, GD_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(png, $GD_PNG_DIR/lib, GD_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR([Problem with libpng.(a|so) or libz.(a|so). Please check config.log for more information.])
- ],[
- -L$PHP_ZLIB_DIR/lib -lz -L$GD_PNG_DIR/lib
- ])
-
- else
- AC_MSG_RESULT([If configure fails try --with-png-dir=<DIR> and --with-zlib-dir=<DIR>])
- fi
-])
-
-AC_DEFUN(PHP_GD_XPM,[
- if test "$PHP_XPM_DIR" != "no"; then
-
- for i in /usr /usr/local /usr/X11R6 $PHP_XPM_DIR; do
- test -f $i/lib/libXpm.$SHLIB_SUFFIX_NAME -o -f $i/lib/libXpm.a && GD_XPM_DIR=$i
- done
-
- if test -z "$GD_XPM_DIR"; then
- AC_MSG_ERROR([libXpm.(a|so) not found.])
- fi
-
- for i in include include/X11; do
- test -f $GD_XPM_DIR/$i/xpm.h && GD_XPM_INC=$GD_XPM_DIR/include
- done
-
- if test -z "$GD_XPM_INC"; then
- AC_MSG_ERROR([xpm.h not found.])
- fi
-
- PHP_CHECK_LIBRARY(Xpm,XpmFreeXpmImage,
- [
- PHP_ADD_INCLUDE($GD_XPM_INC)
- PHP_ADD_LIBRARY_WITH_PATH(Xpm, $GD_XPM_DIR/lib, GD_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(X11, $GD_XPM_DIR/lib, GD_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR([Problem with libXpm.(a|so) or libX11.(a|so). Please check config.log for more information.])
- ],[
- -L$GD_XPM_DIR/lib -lX11
- ])
- else
- AC_MSG_RESULT(If configure fails try --with-xpm-dir=<DIR>)
- fi
-])
-
-AC_DEFUN(PHP_GD_FREETYPE1,[
- if test "$PHP_TTF" != "no"; then
- if test "$PHP_FREETYPE_DIR" = "no" -o "$PHP_FREETYPE_DIR" = ""; then
- if test -n "$PHP_TTF" ; then
- for i in /usr /usr/local $PHP_TTF; do
- if test -f "$i/include/freetype.h" ; then
- TTF_DIR=$i
- unset TTF_INC_DIR
- fi
- if test -f "$i/include/freetype/freetype.h"; then
- TTF_DIR=$i
- TTF_INC_DIR=$i/include/freetype
- fi
- if test -f "$i/include/freetype1/freetype/freetype.h"; then
- TTF_DIR=$i
- TTF_INC_DIR=$i/include/freetype1/freetype
- fi
- done
- fi
- if test -n "$TTF_DIR" ; then
- AC_DEFINE(HAVE_LIBTTF,1,[ ])
- PHP_ADD_LIBRARY_WITH_PATH(ttf, $TTF_DIR/lib, GD_SHARED_LIBADD)
- fi
- if test -z "$TTF_INC_DIR"; then
- TTF_INC_DIR=$TTF_DIR/include
- fi
- PHP_ADD_INCLUDE($TTF_INC_DIR)
- else
- AC_MSG_RESULT([no - FreeType 2.x is to be used instead])
- fi
- fi
-])
-
-AC_DEFUN(PHP_GD_FREETYPE2,[
- if test "$PHP_FREETYPE_DIR" != "no"; then
-
- for i in /usr /usr/local $PHP_FREETYPE_DIR; do
- if test -f "$i/include/freetype2/freetype/freetype.h"; then
- FREETYPE2_DIR=$i
- FREETYPE2_INC_DIR=$i/include/freetype2
- fi
- done
-
- if test -n "$FREETYPE2_DIR" ; then
- PHP_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE2_DIR/lib, GD_SHARED_LIBADD)
- PHP_ADD_INCLUDE($FREETYPE2_DIR/include)
- PHP_ADD_INCLUDE($FREETYPE2_INC_DIR)
- AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
- AC_DEFINE(HAVE_LIBFREETYPE,1,[ ])
- else
- AC_MSG_ERROR([freetype2 not found!])
- fi
- else
- AC_MSG_RESULT([If configure fails try --with-freetype-dir=<DIR>])
- fi
-])
-
-AC_DEFUN(PHP_GD_T1LIB,[
- if test "$PHP_T1LIB" != "no"; then
-
- for i in /usr /usr/local $PHP_T1LIB; do
- test -f "$i/include/t1lib.h" && GD_T1_DIR=$i
- done
-
- if test -z "$GD_T1_DIR"; then
- AC_MSG_ERROR([Your t1lib distribution is not installed correctly. Please reinstall it.])
- fi
-
- PHP_CHECK_LIBRARY(t1, T1_StrError,
- [
- AC_DEFINE(HAVE_LIBT1,1,[ ])
- PHP_ADD_INCLUDE($GD_T1_DIR/include)
- PHP_ADD_LIBRARY_WITH_PATH(t1, $GD_T1_DIR/lib, GD_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR([Problem with libt1.(a|so). Please check config.log for more information.])
- ],[
- -L$GD_T1_DIR/lib
- ])
- fi
-])
-
-AC_DEFUN(PHP_GD_TTSTR,[
- if test "$PHP_GD_NATIVE_TTF" = "yes"; then
- AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
- fi
-])
-
-AC_DEFUN(PHP_GD_JISX0208,[
- if test "$PHP_GD_JIS_CONV" = "yes"; then
- USE_GD_JIS_CONV=1
- fi
-])
-
-AC_DEFUN(PHP_GD_CHECK_VERSION,[
- PHP_CHECK_LIBRARY(gd, gdImageString16, [AC_DEFINE(HAVE_LIBGD13, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImagePaletteCopy, [AC_DEFINE(HAVE_LIBGD15, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageCreateFromGif, [AC_DEFINE(HAVE_GD_GIF_READ, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageGif, [AC_DEFINE(HAVE_GD_GIF_CREATE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageWBMP, [AC_DEFINE(HAVE_GD_WBMP, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageCreateFromJpeg, [AC_DEFINE(HAVE_GD_JPG, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageCreateFromXpm, [AC_DEFINE(HAVE_GD_XPM, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageCreateFromGd2, [AC_DEFINE(HAVE_GD_GD2, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageCreateTrueColor, [AC_DEFINE(HAVE_LIBGD20, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageSetTile, [AC_DEFINE(HAVE_GD_IMAGESETTILE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageEllipse, [AC_DEFINE(HAVE_GD_IMAGEELLIPSE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageSetBrush, [AC_DEFINE(HAVE_GD_IMAGESETBRUSH, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageStringTTF, [AC_DEFINE(HAVE_GD_STRINGTTF, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageStringFT, [AC_DEFINE(HAVE_GD_STRINGFT, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageStringFTEx, [AC_DEFINE(HAVE_GD_STRINGFTEX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageColorClosestHWB, [AC_DEFINE(HAVE_COLORCLOSESTHWB, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageColorResolve, [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageGifCtx, [AC_DEFINE(HAVE_GD_GIF_CTX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdCacheCreate, [AC_DEFINE(HAVE_GD_CACHE_CREATE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
-])
-
-dnl
-dnl Main GD configure
-dnl
-
-if test "$PHP_GD" = "yes"; then
- GD_MODULE_TYPE=builtin
- extra_sources="libgd/gd.c libgd/gd_gd.c libgd/gd_gd2.c libgd/gd_io.c libgd/gd_io_dp.c \
- libgd/gd_io_file.c libgd/gd_ss.c libgd/gd_io_ss.c libgd/gd_png.c libgd/gd_jpeg.c \
- libgd/gdxpm.c libgd/gdfontt.c libgd/gdfonts.c libgd/gdfontmb.c libgd/gdfontl.c \
- libgd/gdfontg.c libgd/gdtables.c libgd/gdft.c libgd/gdcache.c libgd/gdkanji.c \
- libgd/wbmp.c libgd/gd_wbmp.c libgd/gdhelpers.c libgd/gd_topal.c libgd/gd_gif_in.c \
- libgd/xbm.c"
-
-dnl check for fabsf and floorf which are available since C99
- AC_CHECK_FUNCS(fabsf floorf)
-
-dnl PNG is required by GD library
- test "$PHP_PNG_DIR" = "no" && PHP_PNG_DIR=yes
-
-dnl Various checks for GD features
- PHP_GD_TTSTR
- PHP_GD_JISX0208
- PHP_GD_JPEG
- PHP_GD_PNG
- PHP_GD_XPM
- PHP_GD_FREETYPE2
- PHP_GD_FREETYPE1
- PHP_GD_T1LIB
-
-dnl These are always available with bundled library
- AC_DEFINE(HAVE_LIBGD, 1, [ ])
- AC_DEFINE(HAVE_LIBGD13, 1, [ ])
- AC_DEFINE(HAVE_LIBGD15, 1, [ ])
- AC_DEFINE(HAVE_LIBGD20, 1, [ ])
- AC_DEFINE(HAVE_LIBGD204, 1, [ ])
- AC_DEFINE(HAVE_GD_IMAGESETTILE, 1, [ ])
- AC_DEFINE(HAVE_GD_IMAGESETBRUSH, 1, [ ])
- AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE, 1, [ ])
- AC_DEFINE(HAVE_COLORCLOSESTHWB, 1, [ ])
- AC_DEFINE(HAVE_GD_WBMP, 1, [ ])
- AC_DEFINE(HAVE_GD_GD2, 1, [ ])
- AC_DEFINE(HAVE_GD_PNG, 1, [ ])
- AC_DEFINE(HAVE_GD_XBM, 1, [ ])
- AC_DEFINE(HAVE_GD_BUNDLED, 1, [ ])
- AC_DEFINE(HAVE_GD_GIF_READ, 1, [ ])
-
-dnl Make sure the libgd/ is first in the include path
- GDLIB_CFLAGS="-DHAVE_LIBPNG"
-
-dnl Depending which libraries were included to PHP configure,
-dnl enable the support in bundled GD library
-
- if test -n "$GD_JPEG_DIR"; then
- AC_DEFINE(HAVE_GD_JPG, 1, [ ])
- GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBJPEG"
- fi
-
- if test -n "$GD_XPM_DIR"; then
- AC_DEFINE(HAVE_GD_XPM, 1, [ ])
- GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_XPM"
- fi
-
- if test -n "$FREETYPE2_DIR"; then
- AC_DEFINE(HAVE_GD_STRINGFT, 1, [ ])
- AC_DEFINE(HAVE_GD_STRINGFTEX, 1, [ ])
- GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBFREETYPE"
- fi
-
- if test -n "$TTF_DIR"; then
- GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBTTF"
- fi
-
- if test -n "$USE_GD_JIS_CONV"; then
- AC_DEFINE(USE_GD_JISX0208, 1, [ ])
- GDLIB_CFLAGS="$GDLIB_CFLAGS -DJISX0208"
- fi
-
-else
-
- if test "$PHP_GD" != "no"; then
- GD_MODULE_TYPE=external
- extra_sources="gdcache.c"
-
-dnl Various checks for GD features
- PHP_GD_TTSTR
- PHP_GD_JPEG
- PHP_GD_PNG
- PHP_GD_XPM
- PHP_GD_FREETYPE2
- PHP_GD_FREETYPE1
- PHP_GD_T1LIB
-
-dnl Header path
- for i in include/gd1.3 include/gd include gd1.3 gd ""; do
- test -f "$PHP_GD/$i/gd.h" && GD_INCLUDE="$PHP_GD/$i"
- done
-
-dnl Library path
- for i in lib/gd1.3 lib/gd lib gd1.3 gd ""; do
- test -f "$PHP_GD/$i/libgd.$SHLIB_SUFFIX_NAME" -o -f "$PHP_GD/$i/libgd.a" && GD_LIB="$PHP_GD/$i"
- done
-
- if test -n "$GD_INCLUDE" && test -n "$GD_LIB"; then
- PHP_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB, GD_SHARED_LIBADD)
- AC_DEFINE(HAVE_LIBGD,1,[ ])
- PHP_GD_CHECK_VERSION
- elif test -z "$GD_INCLUDE"; then
- AC_MSG_ERROR([Unable to find gd.h anywhere under $PHP_GD])
- else
- AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $PHP_GD])
- fi
-
- PHP_EXPAND_PATH($GD_INCLUDE, GD_INCLUDE)
-
- dnl
- dnl Check for gd 2.0.4 greater availability
- dnl
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS=-I$GD_INCLUDE
- AC_TRY_COMPILE([
-#include <gd.h>
-#include <stdlib.h>
- ], [
-gdIOCtx *ctx;
-ctx = malloc(sizeof(gdIOCtx));
-ctx->gd_free = 1;
- ], [
- AC_DEFINE(HAVE_LIBGD204, 1, [ ])
- ])
- CPPFLAGS=$old_CPPFLAGS
-
- fi
-fi
-
-dnl
-dnl Common for both builtin and external GD
-dnl
-if test "$PHP_GD" != "no"; then
- PHP_NEW_EXTENSION(gd, gd.c gdttf.c $extra_sources, $ext_shared,, \\$(GDLIB_CFLAGS))
-
- if test "$GD_MODULE_TYPE" = "builtin"; then
- GDLIB_CFLAGS="-I$ext_srcdir/libgd $GDLIB_CFLAGS"
- PHP_ADD_BUILD_DIR($ext_builddir/libgd)
- else
- GDLIB_CFLAGS="-I$GD_INCLUDE $GDLIB_CFLAGS"
- PHP_ADD_INCLUDE($GD_INCLUDE)
-
- PHP_CHECK_LIBRARY(gd, gdImageCreate, [], [
- AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])
- ], [ -L$GD_LIB $GD_SHARED_LIBADD ])
- fi
-
- PHP_SUBST(GDLIB_CFLAGS)
- PHP_SUBST(GD_SHARED_LIBADD)
-fi
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
deleted file mode 100644
index df06e051ca..0000000000
--- a/ext/gd/gd.c
+++ /dev/null
@@ -1,4229 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Stig Bakken <ssb@php.net> |
- | Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
- Cold Spring Harbor Labs. */
-
-/* Note that there is no code from the gd package in this file */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/head.h"
-#include <math.h>
-#include "SAPI.h"
-#include "php_gd.h"
-#include "ext/standard/info.h"
-
-#if HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef PHP_WIN32
-# include <io.h>
-# include <fcntl.h>
-#endif
-
-#if HAVE_LIBGD
-
-static int le_gd, le_gd_font;
-#if HAVE_LIBT1
-#include <t1lib.h>
-static int le_ps_font, le_ps_enc;
-static void php_free_ps_font(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-static void php_free_ps_enc(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-#endif
-
-#include <gd.h>
-#include <gdfontt.h> /* 1 Tiny font */
-#include <gdfonts.h> /* 2 Small font */
-#include <gdfontmb.h> /* 3 Medium bold font */
-#include <gdfontl.h> /* 4 Large font */
-#include <gdfontg.h> /* 5 Giant font */
-#ifdef HAVE_GD_WBMP
-#include "libgd/wbmp.h"
-#endif
-#ifdef ENABLE_GD_TTF
-# include "gdttf.h"
-#endif
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#ifdef ENABLE_GD_TTF
-static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int, int);
-#endif
-
-#if HAVE_LIBGD15
-/* it's >= 1.5, i.e. has IOCtx */
-#define USE_GD_IOCTX 1
-#else
-#undef USE_GD_IOCTX
-#endif
-
-#ifdef USE_GD_IOCTX
-#include "gd_ctx.c"
-#else
-#define gdImageCreateFromGdCtx NULL
-#define gdImageCreateFromGd2Ctx NULL
-#define gdImageCreateFromGd2partCtx NULL
-#define gdImageCreateFromGifCtx NULL
-#define gdImageCreateFromJpegCtx NULL
-#define gdImageCreateFromPngCtx NULL
-#define gdImageCreateFromWBMPCtx NULL
-typedef FILE gdIOCtx;
-#define CTX_PUTC(c, fp) fputc(c, fp)
-#endif
-
-#ifndef HAVE_GDIMAGECOLORRESOLVE
-extern int gdImageColorResolve(gdImagePtr, int, int, int);
-#endif
-
-#if HAVE_COLORCLOSESTHWB
-int gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b);
-#endif
-
-/* Section Filters Declarations */
-/* IMPORTANT NOTE FOR NEW FILTER
- * Do not forget to update:
- * IMAGE_FILTER_MAX: define the last filter index
- * IMAGE_FILTER_MAX_ARGS: define the biggest amout of arguments
- * image_filter array in PHP_FUNCTION(imagefilter)
- * */
-#if HAVE_GD_BUNDLED
-#define IMAGE_FILTER_NEGATE 0
-#define IMAGE_FILTER_GRAYSCALE 1
-#define IMAGE_FILTER_BRIGHTNESS 2
-#define IMAGE_FILTER_CONTRAST 3
-#define IMAGE_FILTER_COLORIZE 4
-#define IMAGE_FILTER_EDGEDETECT 5
-#define IMAGE_FILTER_EMBOSS 6
-#define IMAGE_FILTER_GAUSSIAN_BLUR 7
-#define IMAGE_FILTER_SELECTIVE_BLUR 8
-#define IMAGE_FILTER_MEAN_REMOVAL 9
-#define IMAGE_FILTER_SMOOTH 10
-#define IMAGE_FILTER_MAX 10
-#define IMAGE_FILTER_MAX_ARGS 5
-static void php_image_filter_negate(INTERNAL_FUNCTION_PARAMETERS);
-static void php_image_filter_grayscale(INTERNAL_FUNCTION_PARAMETERS);
-static void php_image_filter_brightness(INTERNAL_FUNCTION_PARAMETERS);
-static void php_image_filter_contrast(INTERNAL_FUNCTION_PARAMETERS);
-static void php_image_filter_colorize(INTERNAL_FUNCTION_PARAMETERS);
-static void php_image_filter_edgedetect(INTERNAL_FUNCTION_PARAMETERS);
-static void php_image_filter_emboss(INTERNAL_FUNCTION_PARAMETERS);
-static void php_image_filter_gaussian_blur(INTERNAL_FUNCTION_PARAMETERS);
-static void php_image_filter_selective_blur(INTERNAL_FUNCTION_PARAMETERS);
-static void php_image_filter_mean_removal(INTERNAL_FUNCTION_PARAMETERS);
-static void php_image_filter_smooth(INTERNAL_FUNCTION_PARAMETERS);
-#endif
-/* End Section filters declarations */
-static gdImagePtr _php_image_create_from_string (zval **Data, char *tn, gdImagePtr (*ioctx_func_p)() TSRMLS_DC);
-static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)());
-static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)());
-static int _php_image_type(char data[8]);
-static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type);
-static void _php_image_bw_convert(gdImagePtr im_org, gdIOCtx *out, int threshold);
-
-/* {{{ gd_functions[]
- */
-function_entry gd_functions[] = {
- PHP_FE(gd_info, NULL)
- PHP_FE(imagearc, NULL)
- PHP_FE(imageellipse, NULL)
- PHP_FE(imagechar, NULL)
- PHP_FE(imagecharup, NULL)
- PHP_FE(imagecolorat, NULL)
- PHP_FE(imagecolorallocate, NULL)
-#if HAVE_LIBGD15
- PHP_FE(imagepalettecopy, NULL)
- PHP_FE(imagecreatefromstring, NULL)
-#endif
- PHP_FE(imagecolorclosest, NULL)
-#if HAVE_COLORCLOSESTHWB
- PHP_FE(imagecolorclosesthwb, NULL)
-#endif
- PHP_FE(imagecolordeallocate, NULL)
- PHP_FE(imagecolorresolve, NULL)
- PHP_FE(imagecolorexact, NULL)
- PHP_FE(imagecolorset, NULL)
- PHP_FE(imagecolortransparent, NULL)
- PHP_FE(imagecolorstotal, NULL)
- PHP_FE(imagecolorsforindex, NULL)
- PHP_FE(imagecopy, NULL)
-#if HAVE_LIBGD15
- PHP_FE(imagecopymerge, NULL)
- PHP_FE(imagecopymergegray, NULL)
-#endif
- PHP_FE(imagecopyresized, NULL)
- PHP_FE(imagecreate, NULL)
-#if HAVE_LIBGD20
- PHP_FE(imagecreatetruecolor, NULL)
- PHP_FE(imageistruecolor, NULL)
- PHP_FE(imagetruecolortopalette, NULL)
- PHP_FE(imagesetthickness, NULL)
- PHP_FE(imagefilledarc, NULL)
- PHP_FE(imagefilledellipse, NULL)
- PHP_FE(imagealphablending, NULL)
- PHP_FE(imagesavealpha, NULL)
- PHP_FE(imagecolorallocatealpha, NULL)
- PHP_FE(imagecolorresolvealpha, NULL)
- PHP_FE(imagecolorclosestalpha, NULL)
- PHP_FE(imagecolorexactalpha, NULL)
- PHP_FE(imagecopyresampled, NULL)
-#endif
-
-#ifdef HAVE_GD_BUNDLED
- PHP_FE(imagerotate, NULL)
- PHP_FE(imageantialias, NULL)
-#endif
-
-#if HAVE_GD_IMAGESETTILE
- PHP_FE(imagesettile, NULL)
-#endif
-
-#if HAVE_GD_IMAGESETBRUSH
- PHP_FE(imagesetbrush, NULL)
-#endif
-
- PHP_FE(imagesetstyle, NULL)
-
-#ifdef HAVE_GD_PNG
- PHP_FE(imagecreatefrompng, NULL)
-#endif
-#ifdef HAVE_GD_GIF_READ
- PHP_FE(imagecreatefromgif, NULL)
-#endif
-#ifdef HAVE_GD_JPG
- PHP_FE(imagecreatefromjpeg, NULL)
-#endif
-#ifdef HAVE_GD_WBMP
- PHP_FE(imagecreatefromwbmp, NULL)
-#endif
-#ifdef HAVE_GD_XBM
- PHP_FE(imagecreatefromxbm, NULL)
-#endif
-#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
- PHP_FE(imagecreatefromxpm, NULL)
-#endif
- PHP_FE(imagecreatefromgd, NULL)
-#ifdef HAVE_GD_GD2
- PHP_FE(imagecreatefromgd2, NULL)
- PHP_FE(imagecreatefromgd2part, NULL)
-#endif
-#ifdef HAVE_GD_PNG
- PHP_FE(imagepng, NULL)
-#endif
-#ifdef HAVE_GD_GIF_CREATE
- PHP_FE(imagegif, NULL)
-#endif
-#ifdef HAVE_GD_JPG
- PHP_FE(imagejpeg, NULL)
-#endif
-#ifdef HAVE_GD_WBMP
- PHP_FE(imagewbmp, NULL)
-#endif
- PHP_FE(imagegd, NULL)
-#ifdef HAVE_GD_GD2
- PHP_FE(imagegd2, NULL)
-#endif
-
- PHP_FE(imagedestroy, NULL)
- PHP_FE(imagegammacorrect, NULL)
- PHP_FE(imagefill, NULL)
- PHP_FE(imagefilledpolygon, NULL)
- PHP_FE(imagefilledrectangle, NULL)
- PHP_FE(imagefilltoborder, NULL)
- PHP_FE(imagefontwidth, NULL)
- PHP_FE(imagefontheight, NULL)
- PHP_FE(imageinterlace, NULL)
- PHP_FE(imageline, NULL)
- PHP_FE(imageloadfont, NULL)
- PHP_FE(imagepolygon, NULL)
- PHP_FE(imagerectangle, NULL)
- PHP_FE(imagesetpixel, NULL)
- PHP_FE(imagestring, NULL)
- PHP_FE(imagestringup, NULL)
- PHP_FE(imagesx, NULL)
- PHP_FE(imagesy, NULL)
- PHP_FE(imagedashedline, NULL)
-
-#ifdef ENABLE_GD_TTF
- PHP_FE(imagettfbbox, NULL)
- PHP_FE(imagettftext, NULL)
-#if HAVE_LIBGD20 && HAVE_LIBFREETYPE && HAVE_GD_STRINGFTEX
- PHP_FE(imageftbbox, NULL)
- PHP_FE(imagefttext, NULL)
-#endif
-#endif
-
-#ifdef HAVE_LIBT1
- PHP_FE(imagepsloadfont, NULL)
- /*
- PHP_FE(imagepscopyfont, NULL)
- */
- PHP_FE(imagepsfreefont, NULL)
- PHP_FE(imagepsencodefont, NULL)
- PHP_FE(imagepsextendfont, NULL)
- PHP_FE(imagepsslantfont, NULL)
- PHP_FE(imagepstext, NULL)
- PHP_FE(imagepsbbox, NULL)
-#endif
- PHP_FE(imagetypes, NULL)
-
-#if defined(HAVE_GD_JPG) && defined(HAVE_GD_WBMP)
- PHP_FE(jpeg2wbmp, NULL)
-#endif
-#if defined(HAVE_GD_PNG) && defined(HAVE_GD_WBMP)
- PHP_FE(png2wbmp, NULL)
-#endif
-#ifdef HAVE_GD_WBMP
- PHP_FE(image2wbmp, NULL)
-#endif
-#if HAVE_GD_BUNDLED
- PHP_FE(imagelayereffect, NULL)
- PHP_FE(imagecolormatch, NULL)
-#endif
-/* gd filters */
-#ifdef HAVE_GD_BUNDLED
- PHP_FE(imagefilter, NULL)
-#endif
-
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry gd_module_entry = {
- STANDARD_MODULE_HEADER,
- "gd",
- gd_functions,
- PHP_MINIT(gd),
- NULL,
- NULL,
-#if HAVE_LIBGD20 && HAVE_GD_STRINGFT
- PHP_RSHUTDOWN(gd),
-#else
- NULL,
-#endif
- PHP_MINFO(gd),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_GD
-ZEND_GET_MODULE(gd)
-#endif
-
-/* {{{ php_free_gd_image
- */
-static void php_free_gd_image(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- gdImageDestroy((gdImagePtr) rsrc->ptr);
-}
-/* }}} */
-
-/* {{{ php_free_gd_font
- */
-static void php_free_gd_font(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- gdFontPtr fp = (gdFontPtr) rsrc->ptr;
-
- if (fp->data) {
- efree(fp->data);
- }
-
- efree(fp);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(gd)
-{
- le_gd = zend_register_list_destructors_ex(php_free_gd_image, NULL, "gd", module_number);
- le_gd_font = zend_register_list_destructors_ex(php_free_gd_font, NULL, "gd font", module_number);
-#if HAVE_LIBT1
- T1_SetBitmapPad(8);
- T1_InitLib(NO_LOGFILE | IGNORE_CONFIGFILE | IGNORE_FONTDATABASE);
- T1_SetLogLevel(T1LOG_DEBUG);
- le_ps_font = zend_register_list_destructors_ex(php_free_ps_font, NULL, "gd PS font", module_number);
- le_ps_enc = zend_register_list_destructors_ex(php_free_ps_enc, NULL, "gd PS encoding", module_number);
-#endif
-
- REGISTER_LONG_CONSTANT("IMG_GIF", 1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_JPG", 2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_JPEG", 2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_XPM", 16, CONST_CS | CONST_PERSISTENT);
-#ifdef gdTiled
- /* special colours for gd */
- REGISTER_LONG_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_COLOR_STYLED", gdStyled, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_COLOR_BRUSHED", gdBrushed, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_COLOR_STYLEDBRUSHED", gdStyledBrushed, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_COLOR_TRANSPARENT", gdTransparent, CONST_CS | CONST_PERSISTENT);
-#endif
-#if HAVE_LIBGD20
- /* for imagefilledarc */
- REGISTER_LONG_CONSTANT("IMG_ARC_ROUNDED", gdArc, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_ARC_PIE", gdPie, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_ARC_CHORD", gdChord, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_ARC_NOFILL", gdNoFill, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_ARC_EDGED", gdEdged, CONST_CS | CONST_PERSISTENT);
-#endif
-/* GD2 image format types */
-#ifdef GD2_FMT_RAW
- REGISTER_LONG_CONSTANT("IMG_GD2_RAW", GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef GD2_FMT_COMPRESSED
- REGISTER_LONG_CONSTANT("IMG_GD2_COMPRESSED", GD2_FMT_COMPRESSED, CONST_CS | CONST_PERSISTENT);
-#endif
-#if HAVE_GD_BUNDLED
- REGISTER_LONG_CONSTANT("IMG_EFFECT_REPLACE", gdEffectReplace, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_EFFECT_ALPHABLEND", gdEffectAlphaBlend, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_EFFECT_NORMAL", gdEffectNormal, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_EFFECT_OVERLAY", gdEffectOverlay, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("GD_BUNDLED", 1, CONST_CS | CONST_PERSISTENT);
- /* Section Filters */
- REGISTER_LONG_CONSTANT("IMG_FILTER_NEGATE", IMAGE_FILTER_NEGATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_FILTER_GRAYSCALE", IMAGE_FILTER_GRAYSCALE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_FILTER_BRIGHTNESS", IMAGE_FILTER_BRIGHTNESS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_FILTER_CONTRAST", IMAGE_FILTER_CONTRAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_FILTER_COLORIZE", IMAGE_FILTER_COLORIZE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_FILTER_EDGEDETECT", IMAGE_FILTER_EDGEDETECT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_FILTER_GAUSSIAN_BLUR", IMAGE_FILTER_GAUSSIAN_BLUR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_FILTER_SELECTIVE_BLUR", IMAGE_FILTER_SELECTIVE_BLUR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_FILTER_EMBOSS", IMAGE_FILTER_EMBOSS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_FILTER_MEAN_REMOVAL", IMAGE_FILTER_MEAN_REMOVAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_FILTER_SMOOTH", IMAGE_FILTER_SMOOTH, CONST_CS | CONST_PERSISTENT);
- /* End Section Filters */
-#else
- REGISTER_LONG_CONSTANT("GD_BUNDLED", 0, CONST_CS | CONST_PERSISTENT);
-#endif
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-#if HAVE_LIBGD20 && HAVE_GD_STRINGFT
-PHP_RSHUTDOWN_FUNCTION(gd)
-{
- gdFreeFontCache();
- return SUCCESS;
-}
-#endif
-/* }}} */
-
-#if HAVE_GD_BUNDLED
-#define PHP_GD_VERSION_STRING "bundled (2.0.12 compatible)"
-#elif HAVE_LIBGD20
-#define PHP_GD_VERSION_STRING "2.0 or higher"
-#elif HAVE_GDIMAGECOLORRESOLVE
-#define PHP_GD_VERSION_STRING "1.6.2 or higher"
-#elif HAVE_LIBGD13
-#define PHP_GD_VERSION_STRING "between 1.3 and 1.6.1"
-#else
-#define PHP_GD_VERSION_STRING "1.2"
-#endif
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(gd)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "GD Support", "enabled");
-
- /* need to use a PHPAPI function here because it is external module in windows */
-
- php_info_print_table_row(2, "GD Version", PHP_GD_VERSION_STRING);
-
-#ifdef ENABLE_GD_TTF
- php_info_print_table_row(2, "FreeType Support", "enabled");
-#if HAVE_LIBFREETYPE
- php_info_print_table_row(2, "FreeType Linkage", "with freetype");
-#elif HAVE_LIBTTF
- php_info_print_table_row(2, "FreeType Linkage", "with TTF library");
-#else
- php_info_print_table_row(2, "FreeType Linkage", "with unknown library");
-#endif
-#endif
-
-#ifdef HAVE_LIBT1
- php_info_print_table_row(2, "T1Lib Support", "enabled");
-#endif
-
-/* this next part is stupid ... if I knew better, I'd put them all on one row (cmv) */
-
-#ifdef HAVE_GD_GIF_READ
- php_info_print_table_row(2, "GIF Read Support", "enabled");
-#endif
-#ifdef HAVE_GD_GIF_CREATE
- php_info_print_table_row(2, "GIF Create Support", "enabled");
-#endif
-#ifdef HAVE_GD_JPG
- php_info_print_table_row(2, "JPG Support", "enabled");
-#endif
-#ifdef HAVE_GD_PNG
- php_info_print_table_row(2, "PNG Support", "enabled");
-#endif
-#ifdef HAVE_GD_WBMP
- php_info_print_table_row(2, "WBMP Support", "enabled");
-#endif
-#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
- php_info_print_table_row(2, "XPM Support", "enabled");
-#endif
-#ifdef HAVE_GD_XBM
- php_info_print_table_row(2, "XBM Support", "enabled");
-#endif
-#if defined(USE_GD_JISX0208) && defined(HAVE_GD_BUNDLED)
- php_info_print_table_row(2, "JIS-mapped Japanese Font Support", "enabled");
-#endif
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ proto array gd_info()
- */
-PHP_FUNCTION(gd_info)
-{
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- add_assoc_string(return_value, "GD Version", PHP_GD_VERSION_STRING, 1);
-
-#ifdef ENABLE_GD_TTF
- add_assoc_bool(return_value, "FreeType Support", 1);
-#if HAVE_LIBFREETYPE
- add_assoc_string(return_value, "FreeType Linkage", "with freetype", 1);
-#elif HAVE_LIBTTF
- add_assoc_string(return_value, "FreeType Linkage", "with TTF library", 1);
-#else
- add_assoc_string(return_value, "FreeType Linkage", "with unknown library", 1);
-#endif
-#else
- add_assoc_bool(return_value, "FreeType Support", 0);
-#endif
-
-#ifdef HAVE_LIBT1
- add_assoc_bool(return_value, "T1Lib Support", 1);
-#else
- add_assoc_bool(return_value, "T1Lib Support", 0);
-#endif
-#ifdef HAVE_GD_GIF_READ
- add_assoc_bool(return_value, "GIF Read Support", 1);
-#else
- add_assoc_bool(return_value, "GIF Read Support", 0);
-#endif
-#ifdef HAVE_GD_GIF_CREATE
- add_assoc_bool(return_value, "GIF Create Support", 1);
-#else
- add_assoc_bool(return_value, "GIF Create Support", 0);
-#endif
-#ifdef HAVE_GD_JPG
- add_assoc_bool(return_value, "JPG Support", 1);
-#else
- add_assoc_bool(return_value, "JPG Support", 0);
-#endif
-#ifdef HAVE_GD_PNG
- add_assoc_bool(return_value, "PNG Support", 1);
-#else
- add_assoc_bool(return_value, "PNG Support", 0);
-#endif
-#ifdef HAVE_GD_WBMP
- add_assoc_bool(return_value, "WBMP Support", 1);
-#else
- add_assoc_bool(return_value, "WBMP Support", 0);
-#endif
-#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
- add_assoc_bool(return_value, "XPM Support", 1);
-#else
- add_assoc_bool(return_value, "XPM Support", 0);
-#endif
-#ifdef HAVE_GD_XBM
- add_assoc_bool(return_value, "XBM Support", 1);
-#else
- add_assoc_bool(return_value, "XBM Support", 0);
-#endif
-#if defined(USE_GD_JISX0208) && defined(HAVE_GD_BUNDLED)
- add_assoc_bool(return_value, "JIS-mapped Japanese Font Support", 1);
-#else
- add_assoc_bool(return_value, "JIS-mapped Japanese Font Support", 0);
-#endif
-}
-/* }}} */
-
-/* Need this for cpdf. See also comment in file.c php3i_get_le_fp() */
-PHP_GD_API int phpi_get_le_gd(void)
-{
- return le_gd;
-}
-
-#ifndef HAVE_GDIMAGECOLORRESOLVE
-
-/* {{{ gdImageColorResolve
- */
-/********************************************************************/
-/* gdImageColorResolve is a replacement for the old fragment: */
-/* */
-/* if ((color=gdImageColorExact(im,R,G,B)) < 0) */
-/* if ((color=gdImageColorAllocate(im,R,G,B)) < 0) */
-/* color=gdImageColorClosest(im,R,G,B); */
-/* */
-/* in a single function */
-
-int gdImageColorResolve(gdImagePtr im, int r, int g, int b)
-{
- int c;
- int ct = -1;
- int op = -1;
- long rd, gd, bd, dist;
- long mindist = 3*255*255; /* init to max poss dist */
-
- for (c = 0; c < im->colorsTotal; c++) {
- if (im->open[c]) {
- op = c; /* Save open slot */
- continue; /* Color not in use */
- }
- rd = (long) (im->red [c] - r);
- gd = (long) (im->green[c] - g);
- bd = (long) (im->blue [c] - b);
- dist = rd * rd + gd * gd + bd * bd;
- if (dist < mindist) {
- if (dist == 0) {
- return c; /* Return exact match color */
- }
- mindist = dist;
- ct = c;
- }
- }
- /* no exact match. We now know closest, but first try to allocate exact */
- if (op == -1) {
- op = im->colorsTotal;
- if (op == gdMaxColors) { /* No room for more colors */
- return ct; /* Return closest available color */
- }
- im->colorsTotal++;
- }
- im->red [op] = r;
- im->green[op] = g;
- im->blue [op] = b;
- im->open [op] = 0;
- return op; /* Return newly allocated color */
-}
-/* }}} */
-
-#endif
-
-#define FLIPWORD(a) (((a & 0xff000000) >> 24) | ((a & 0x00ff0000) >> 8) | ((a & 0x0000ff00) << 8) | ((a & 0x000000ff) << 24))
-
-/* {{{ proto int imageloadfont(string filename)
- Load a new font */
-PHP_FUNCTION(imageloadfont)
-{
- zval **file;
- int hdr_size = sizeof(gdFont) - sizeof(char *);
- int ind, body_size, n = 0, b, i, body_size_check;
- gdFontPtr font;
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(file);
-
- stream = php_stream_open_wrapper(Z_STRVAL_PP(file), "rb", IGNORE_PATH | IGNORE_URL_WIN | REPORT_ERRORS, NULL);
- if (stream == NULL) {
- RETURN_FALSE;
- }
-
- /* Only supports a architecture-dependent binary dump format
- * at the moment.
- * The file format is like this on machines with 32-byte integers:
- *
- * byte 0-3: (int) number of characters in the font
- * byte 4-7: (int) value of first character in the font (often 32, space)
- * byte 8-11: (int) pixel width of each character
- * byte 12-15: (int) pixel height of each character
- * bytes 16-: (char) array with character data, one byte per pixel
- * in each character, for a total of
- * (nchars*width*height) bytes.
- */
- font = (gdFontPtr) emalloc(sizeof(gdFont));
- b = 0;
- while (b < hdr_size && (n = php_stream_read(stream, (char*)&font[b], hdr_size - b))) {
- b += n;
- }
-
- if (!n) {
- efree(font);
- if (php_stream_eof(stream)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "End of file while reading header");
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while reading header");
- }
- php_stream_close(stream);
- RETURN_FALSE;
- }
- i = php_stream_tell(stream);
- php_stream_seek(stream, 0, SEEK_END);
- body_size_check = php_stream_tell(stream) - hdr_size;
- php_stream_seek(stream, i, SEEK_SET);
-
- body_size = font->w * font->h * font->nchars;
- if (body_size != body_size_check) {
- font->w = FLIPWORD(font->w);
- font->h = FLIPWORD(font->h);
- font->nchars = FLIPWORD(font->nchars);
- body_size = font->w * font->h * font->nchars;
- }
-
- if (body_size != body_size_check) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error reading font");
- efree(font);
- RETURN_FALSE;
- }
-
- font->data = emalloc(body_size);
- b = 0;
- while (b < body_size && (n = php_stream_read(stream, &font->data[b], body_size - b))) {
- b += n;
- }
-
- if (!n) {
- efree(font->data);
- efree(font);
- if (php_stream_eof(stream)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "End of file while reading body");
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while reading body");
- }
- php_stream_close(stream);
- RETURN_FALSE;
- }
- php_stream_close(stream);
-
- /* Adding 5 to the font index so we will never have font indices
- * that overlap with the old fonts (with indices 1-5). The first
- * list index given out is always 1.
- */
- ind = 5 + zend_list_insert(font, le_gd_font);
-
- RETURN_LONG(ind);
-}
-/* }}} */
-
-/* {{{ proto void imagesetstyle(resource im, array styles)
- Set the line drawing styles for use with imageline and IMG_COLOR_STYLED. */
-PHP_FUNCTION(imagesetstyle)
-{
- zval **IM, **styles;
- gdImagePtr im;
- int * stylearr;
- int index;
- HashPosition pos;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &styles) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_array_ex(styles);
-
- /* copy the style values in the stylearr */
- stylearr = emalloc(sizeof(int) * zend_hash_num_elements(HASH_OF(*styles)));
-
- zend_hash_internal_pointer_reset_ex(HASH_OF(*styles), &pos);
-
- for (index = 0;; zend_hash_move_forward_ex(HASH_OF(*styles), &pos)) {
- zval ** item;
-
- if (zend_hash_get_current_data_ex(HASH_OF(*styles), (void **) &item, &pos) == FAILURE) {
- break;
- }
-
- convert_to_long_ex(item);
-
- stylearr[index++] = Z_LVAL_PP(item);
- }
-
- gdImageSetStyle(im, stylearr, index);
-
- efree(stylearr);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#if HAVE_LIBGD20
-/* {{{ proto int imagecreatetruecolor(int x_size, int y_size)
- Create a new true color image */
-PHP_FUNCTION(imagecreatetruecolor)
-{
- zval **x_size, **y_size;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x_size, &y_size) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(x_size);
- convert_to_long_ex(y_size);
-
- if (Z_LVAL_PP(x_size) <= 0 || Z_LVAL_PP(y_size) <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid image dimensions");
- RETURN_FALSE;
- }
-
- im = gdImageCreateTrueColor(Z_LVAL_PP(x_size), Z_LVAL_PP(y_size));
-
- ZEND_REGISTER_RESOURCE(return_value, im, le_gd);
-}
-/* }}} */
-
-/* {{{ proto int imageistruecolor(int im)
- return true if the image uses truecolor */
-PHP_FUNCTION(imageistruecolor)
-{
- zval **IM;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &IM) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- RETURN_BOOL(im->trueColor);
-}
-/* }}} */
-
-/* {{{ proto void imagetruecolortopalette(resource im, bool ditherFlag, int colorsWanted)
- Convert a true colour image to a palette based image with a number of colours, optionally using dithering. */
-PHP_FUNCTION(imagetruecolortopalette)
-{
- zval **IM, **dither, **ncolors;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &IM, &dither, &ncolors) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_boolean_ex(dither);
- convert_to_long_ex(ncolors);
-
- gdImageTrueColorToPalette(im, Z_LVAL_PP(dither), Z_LVAL_PP(ncolors));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#if HAVE_GD_BUNDLED
-/* {{{ proto void imagecolormatch(resource im1, resource im2)
- Makes the colors of the palette version of an image more closely match the true color version */
-PHP_FUNCTION(imagecolormatch)
-{
- zval **IM1, **IM2;
- gdImagePtr im1, im2;
- int result;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM1, &IM2 ) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im1, gdImagePtr, IM1, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(im2, gdImagePtr, IM2, -1, "Image", le_gd);
-
- result = gdImageColorMatch(im1, im2);
- switch (result) {
- case -1:
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Image1 must be TrueColor" );
- RETURN_FALSE;
- break;
- case -2:
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Image2 must be Palette" );
- RETURN_FALSE;
- break;
- case -3:
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Image1 and Image2 must be the same size" );
- RETURN_FALSE;
- break;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-/* {{{ proto void imagesetthickness(resource im, int thickness)
- Set line thickness for drawing lines, ellipses, rectangles, polygons etc. */
-PHP_FUNCTION(imagesetthickness)
-{
- zval **IM, **thick;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &thick) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- convert_to_long_ex(thick);
-
- gdImageSetThickness(im, Z_LVAL_PP(thick));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void imagefilledellipse(resource im, int cx, int cy, int w, int h, int color)
- Draw an ellipse */
-PHP_FUNCTION(imagefilledellipse)
-{
- zval **IM, **cx, **cy, **w, **h, **color;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &cx, &cy, &w, &h, &color) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(cx);
- convert_to_long_ex(cy);
- convert_to_long_ex(w);
- convert_to_long_ex(h);
- convert_to_long_ex(color);
-
- gdImageFilledEllipse(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), Z_LVAL_PP(color));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagefilledarc(int im, int cx, int cy, int w, int h, int s, int e, int col, int style)
- Draw a filled partial ellipse */
-PHP_FUNCTION(imagefilledarc)
-{
- zval **IM, **cx, **cy, **w, **h, **ST, **E, **col, **style;
- gdImagePtr im;
- int e, st;
-
- if (ZEND_NUM_ARGS() != 9 || zend_get_parameters_ex(9, &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(cx);
- convert_to_long_ex(cy);
- convert_to_long_ex(w);
- convert_to_long_ex(h);
- convert_to_long_ex(ST);
- convert_to_long_ex(E);
- convert_to_long_ex(col);
- convert_to_long_ex(style);
-
- e = Z_LVAL_PP(E);
- if (e < 0) {
- e %= 360;
- }
-
- st = Z_LVAL_PP(ST);
- if (st < 0) {
- st %= 360;
- }
-
- gdImageFilledArc(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), st, e, Z_LVAL_PP(col), Z_LVAL_PP(style));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void imagealphablending(resource im, bool on)
- Turn alpha blending mode on or off for the given image */
-PHP_FUNCTION(imagealphablending)
-{
- zval **IM, **blend;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &blend) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- convert_to_boolean_ex(blend);
-
- gdImageAlphaBlending(im, Z_LVAL_PP(blend));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#if HAVE_LIBGD20
-/* {{{ proto void imagesavealpha(resource im, bool on)
- Include alpha channel to a saved image */
-PHP_FUNCTION(imagesavealpha)
-{
- zval **IM, **save;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &save) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- convert_to_boolean_ex(save);
-
- gdImageSaveAlpha(im, Z_LVAL_PP(save));
-
- RETURN_TRUE;
-}
-#endif
-
-#if HAVE_GD_BUNDLED
-/* {{{ proto void imagelayereffect(resource im, int effect)
- Set the alpha blending flag to use the bundled libgd layering effects */
-PHP_FUNCTION(imagelayereffect)
-{
- zval **IM, **effect;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &effect) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- convert_to_long_ex(effect);
-
- gdImageAlphaBlending(im, Z_LVAL_PP(effect) );
-
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-/* {{{ proto int imagecolorallocatealpha(resource im, int red, int green, int blue, int alpha)
- Allocate a color with an alpha level. Works for true color and palette based images */
-PHP_FUNCTION(imagecolorallocatealpha)
-{
- zval *IM;
- int red, green, blue, alpha;
- gdImagePtr im;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zllll", &IM, &red, &green, &blue, &alpha) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
-
- RETURN_LONG(gdImageColorAllocateAlpha(im, red, green, blue, alpha));
-}
-/* }}} */
-
-/* {{{ proto int imagecolorresolvealpha(resource im, int red, int green, int blue, int alpha)
- Resolve/Allocate a colour with an alpha level. Works for true colour and palette based images */
-PHP_FUNCTION(imagecolorresolvealpha)
-{
- zval **IM, ** red, **green, **blue, **alpha;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &red, &green, &blue, &alpha) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
- convert_to_long_ex(alpha);
-
- RETURN_LONG(gdImageColorResolveAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue), Z_LVAL_PP(alpha)));
-}
-/* }}} */
-
-/* {{{ proto int imagecolorclosestalpha(resource im, int red, int green, int blue, int alpha)
- Find the closest matching colour with alpha transparency */
-PHP_FUNCTION(imagecolorclosestalpha)
-{
- zval **IM, ** red, **green, **blue, **alpha;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &red, &green, &blue, &alpha) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
- convert_to_long_ex(alpha);
-
- RETURN_LONG(gdImageColorClosestAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue), Z_LVAL_PP(alpha)));
-}
-/* }}} */
-
-/* {{{ proto int imagecolorexactalpha(resource im, int red, int green, int blue, int alpha)
- Find exact match for colour with transparency */
-PHP_FUNCTION(imagecolorexactalpha)
-{
- zval **IM, **red, **green, **blue, **alpha;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &red, &green, &blue, &alpha) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
- convert_to_long_ex(alpha);
-
- RETURN_LONG(gdImageColorExactAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue), Z_LVAL_PP(alpha)));
-}
-/* }}} */
-
-/* {{{ proto int imagecopyresampled(int dst_im, int src_im, int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h)
- Copy and resize part of an image using resampling to help ensure clarity */
-PHP_FUNCTION(imagecopyresampled)
-{
- zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY, **DW, **DH;
- gdImagePtr im_dst, im_src;
- int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX;
-
- if (ZEND_NUM_ARGS() != 10 || zend_get_parameters_ex(10, &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_dst, gdImagePtr, DIM, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
-
- convert_to_long_ex(SX);
- convert_to_long_ex(SY);
- convert_to_long_ex(SW);
- convert_to_long_ex(SH);
- convert_to_long_ex(DX);
- convert_to_long_ex(DY);
- convert_to_long_ex(DW);
- convert_to_long_ex(DH);
-
- srcX = Z_LVAL_PP(SX);
- srcY = Z_LVAL_PP(SY);
- srcH = Z_LVAL_PP(SH);
- srcW = Z_LVAL_PP(SW);
- dstX = Z_LVAL_PP(DX);
- dstY = Z_LVAL_PP(DY);
- dstH = Z_LVAL_PP(DH);
- dstW = Z_LVAL_PP(DW);
-
- gdImageCopyResampled(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
-
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-#ifdef HAVE_GD_BUNDLED
-/* {{{ proto int imagerotate(int src_im, float angle, int bgdcolor)
- Rotate an image using a custom angle */
-PHP_FUNCTION(imagerotate)
-{
- zval **SIM, **ANGLE, **BGDCOLOR;
- gdImagePtr im_dst, im_src;
- double degrees;
- long color;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &SIM, &ANGLE, &BGDCOLOR) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
-
- convert_to_long_ex(BGDCOLOR);
- color = Z_LVAL_PP(BGDCOLOR);
-
- convert_to_double_ex(ANGLE);
- degrees = Z_DVAL_PP(ANGLE);
- im_dst = gdImageRotate(im_src, degrees, color);
-
- if (im_dst != NULL) {
- ZEND_REGISTER_RESOURCE(return_value, im_dst, le_gd);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-#endif
-
-#if HAVE_GD_IMAGESETTILE
-/* {{{ proto int imagesettile(resource image, resource tile)
- Set the tile image to $tile when filling $image with the "IMG_COLOR_TILED" color */
-PHP_FUNCTION(imagesettile)
-{
- zval **IM, **TILE;
- gdImagePtr im, tile;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &TILE) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(tile, gdImagePtr, TILE, -1, "Image", le_gd);
-
- gdImageSetTile(im, tile);
-
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-#if HAVE_GD_IMAGESETBRUSH
-/* {{{ proto int imagesetbrush(resource image, resource brush)
- Set the brush image to $brush when filling $image with the "IMG_COLOR_BRUSHED" color */
-PHP_FUNCTION(imagesetbrush)
-{
- zval **IM, **TILE;
- gdImagePtr im, tile;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &TILE) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(tile, gdImagePtr, TILE, -1, "Image", le_gd);
-
- gdImageSetBrush(im, tile);
-
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-/* {{{ proto int imagecreate(int x_size, int y_size)
- Create a new image */
-PHP_FUNCTION(imagecreate)
-{
- zval **x_size, **y_size;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x_size, &y_size) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(x_size);
- convert_to_long_ex(y_size);
-
- if (Z_LVAL_PP(x_size) <= 0 || Z_LVAL_PP(y_size) <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid image dimensions");
- RETURN_FALSE;
- }
-
- im = gdImageCreate(Z_LVAL_PP(x_size), Z_LVAL_PP(y_size));
-
- ZEND_REGISTER_RESOURCE(return_value, im, le_gd);
-}
-/* }}} */
-
-/* {{{ proto int imagetypes(void)
- Return the types of images supported in a bitfield - 1=GIF, 2=JPEG, 4=PNG, 8=WBMP, 16=XPM */
-PHP_FUNCTION(imagetypes)
-{
- int ret=0;
-#ifdef HAVE_GD_GIF_CREATE
- ret = 1;
-#endif
-#ifdef HAVE_GD_JPG
- ret |= 2;
-#endif
-#ifdef HAVE_GD_PNG
- ret |= 4;
-#endif
-#ifdef HAVE_GD_WBMP
- ret |= 8;
-#endif
-#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
- ret |= 16;
-#endif
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ _php_image_type
- */
-static const char php_sig_gd2[3] = {'g', 'd', '2'};
-
-static int _php_image_type (char data[8])
-{
-#ifdef HAVE_LIBGD15
- /* Based on ext/standard/image.c */
-
- if (data == NULL) {
- return -1;
- }
-
- if (!memcmp(data, php_sig_gd2, 3)) {
- return PHP_GDIMG_TYPE_GD2;
- } else if (!memcmp(data, php_sig_jpg, 3)) {
- return PHP_GDIMG_TYPE_JPG;
- } else if (!memcmp(data, php_sig_png, 3)) {
- if (!memcmp(data, php_sig_png, 8)) {
- return PHP_GDIMG_TYPE_PNG;
- }
- } else if (!memcmp(data, php_sig_gif, 3)) {
- return PHP_GDIMG_TYPE_GIF;
- }
-#ifdef HAVE_GD_WBMP
- else {
- gdIOCtx *io_ctx;
- io_ctx = gdNewDynamicCtx(8, data);
- if (io_ctx) {
- if (getmbi((int(*)(void *)) gdGetC, io_ctx) == 0 && skipheader((int(*)(void *)) gdGetC, io_ctx) == 0 ) {
-#if HAVE_LIBGD204
- io_ctx->gd_free(io_ctx);
-#else
- io_ctx->free(io_ctx);
-#endif
- return PHP_GDIMG_TYPE_WBM;
- } else {
-#if HAVE_LIBGD204
- io_ctx->gd_free(io_ctx);
-#else
- io_ctx->free(io_ctx);
-#endif
- }
- }
- }
-#endif
- return -1;
-#endif
-}
-/* }}} */
-
-#ifdef HAVE_LIBGD15
-/* {{{ _php_image_create_from_string
- */
-gdImagePtr _php_image_create_from_string(zval **data, char *tn, gdImagePtr (*ioctx_func_p)() TSRMLS_DC)
-{
- gdImagePtr im;
- gdIOCtx *io_ctx;
-
- io_ctx = gdNewDynamicCtx (Z_STRLEN_PP(data), Z_STRVAL_PP(data));
-
- if (!io_ctx) {
- return NULL;
- }
-
- im = (*ioctx_func_p)(io_ctx);
- if (!im) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passed data is not in '%s' format", tn);
- return NULL;
- }
-
-#if HAVE_LIBGD204
- io_ctx->gd_free(io_ctx);
-#else
- io_ctx->free(io_ctx);
-#endif
-
- return im;
-}
-/* }}} */
-
-/* {{{ proto int imagecreatefromstring(string image)
- Create a new image from the image stream in the string */
-PHP_FUNCTION(imagecreatefromstring)
-{
- zval **data;
- gdImagePtr im;
- int imtype;
- char sig[8];
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &data) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(data);
- memcpy(sig, Z_STRVAL_PP(data), 8);
-
- imtype = _php_image_type(sig);
-
- switch (imtype) {
- case PHP_GDIMG_TYPE_JPG:
-#ifdef HAVE_GD_JPG
- im = _php_image_create_from_string(data, "JPEG", gdImageCreateFromJpegCtx TSRMLS_CC);
-#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No JPEG support in this PHP build");
- RETURN_FALSE;
-#endif
- break;
-
- case PHP_GDIMG_TYPE_PNG:
-#ifdef HAVE_GD_PNG
- im = _php_image_create_from_string(data, "PNG", gdImageCreateFromPngCtx TSRMLS_CC);
-#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No PNG support in this PHP build");
- RETURN_FALSE;
-#endif
- break;
-
- case PHP_GDIMG_TYPE_GIF:
-#ifdef HAVE_GD_GIF_READ
- im = _php_image_create_from_string(data, "GIF", gdImageCreateFromGifCtx TSRMLS_CC);
-#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No GIF support in this PHP build");
- RETURN_FALSE;
-#endif
- break;
-
- case PHP_GDIMG_TYPE_WBM:
-#ifdef HAVE_GD_WBMP
- im = _php_image_create_from_string(data, "WBMP", gdImageCreateFromWBMPCtx TSRMLS_CC);
-#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No WBMP support in this PHP build");
- RETURN_FALSE;
-#endif
- break;
-
- case PHP_GDIMG_TYPE_GD2:
-#ifdef HAVE_GD_GD2
- im = _php_image_create_from_string(data, "GD2", gdImageCreateFromGd2Ctx TSRMLS_CC);
-#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No GD2 support in this PHP build");
- RETURN_FALSE;
-#endif
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Data is not in a recognized format.");
- RETURN_FALSE;
- }
-
- if (!im) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't create GD Image Stream out of Data");
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, im, le_gd);
-}
-/* }}} */
-#endif
-
-/* {{{ _php_image_create_from
- */
-static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)())
-{
- zval **file, **srcx, **srcy, **width, **height;
- gdImagePtr im = NULL;
- char *fn=NULL;
- php_stream *stream;
- FILE * fp = NULL;
- int argc=ZEND_NUM_ARGS();
-
- if ((image_type == PHP_GDIMG_TYPE_GD2PART && argc != 5) ||
- (image_type != PHP_GDIMG_TYPE_GD2PART && argc != 1) ||
- zend_get_parameters_ex(argc, &file, &srcx, &srcy, &width, &height) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(file);
-
- if (argc == 5 && image_type == PHP_GDIMG_TYPE_GD2PART) {
- multi_convert_to_long_ex(4, srcx, srcy, width, height);
- }
-
- fn = Z_STRVAL_PP(file);
-
- stream = php_stream_open_wrapper(fn, "rb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
- if (stream == NULL) {
- RETURN_FALSE;
- }
-
-#ifndef USE_GD_IOCTX
- ioctx_func_p = NULL; /* don't allow sockets without IOCtx */
-#endif
-
- /* try and avoid allocating a FILE* if the stream is not naturally a FILE* */
- if (php_stream_is(stream, PHP_STREAM_IS_STDIO)) {
- if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void**)&fp, REPORT_ERRORS)) {
- goto out_err;
- }
- } else if (ioctx_func_p) {
-#ifdef USE_GD_IOCTX
- /* we can create an io context */
- gdIOCtx* io_ctx;
- size_t buff_size;
- char *buff;
-
- /* needs to be malloc (persistent) - GD will free() it later */
- buff_size = php_stream_copy_to_mem(stream, &buff, PHP_STREAM_COPY_ALL, 1);
-
- if (!buff_size) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot read image data");
- goto out_err;
- }
-
- io_ctx = gdNewDynamicCtx(buff_size, buff);
- if (!io_ctx) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot allocate GD IO context");
- goto out_err;
- }
-
- if (image_type == PHP_GDIMG_TYPE_GD2PART) {
- im = (*ioctx_func_p)(io_ctx, Z_LVAL_PP(srcx), Z_LVAL_PP(srcy), Z_LVAL_PP(width), Z_LVAL_PP(height));
- } else {
- im = (*ioctx_func_p)(io_ctx);
- }
-#if HAVE_LIBGD204
- io_ctx->gd_free(io_ctx);
-#else
- io_ctx->free(io_ctx);
-#endif
-
-#endif
- }
- else {
- /* try and force the stream to be FILE* */
- if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO | PHP_STREAM_CAST_TRY_HARD, (void **) &fp, REPORT_ERRORS)) {
- goto out_err;
- }
- }
-
- if (!im && fp) {
- switch (image_type) {
- case PHP_GDIMG_TYPE_GD2PART:
- im = (*func_p)(fp, Z_LVAL_PP(srcx), Z_LVAL_PP(srcy), Z_LVAL_PP(width), Z_LVAL_PP(height));
- break;
-#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
- case PHP_GDIMG_TYPE_XPM:
- im = gdImageCreateFromXpm(fn);
- break;
-#endif
- default:
- im = (*func_p)(fp);
- break;
- }
-
- fflush(fp);
- }
-
- if (im) {
- ZEND_REGISTER_RESOURCE(return_value, im, le_gd);
- php_stream_close(stream);
- return;
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "'%s' is not a valid %s file", fn, tn);
-out_err:
- php_stream_close(stream);
- RETURN_FALSE;
-
-}
-/* }}} */
-
-#ifdef HAVE_GD_GIF_READ
-/* {{{ proto int imagecreatefromgif(string filename)
- Create a new image from GIF file or URL */
-PHP_FUNCTION(imagecreatefromgif)
-{
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageCreateFromGif, gdImageCreateFromGifCtx);
-}
-/* }}} */
-#endif /* HAVE_GD_GIF_READ */
-
-#ifdef HAVE_GD_JPG
-/* {{{ proto int imagecreatefromjpeg(string filename)
- Create a new image from JPEG file or URL */
-PHP_FUNCTION(imagecreatefromjpeg)
-{
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG, "JPEG", gdImageCreateFromJpeg, gdImageCreateFromJpegCtx);
-}
-/* }}} */
-#endif /* HAVE_GD_JPG */
-
-#ifdef HAVE_GD_PNG
-/* {{{ proto int imagecreatefrompng(string filename)
- Create a new image from PNG file or URL */
-PHP_FUNCTION(imagecreatefrompng)
-{
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, "PNG", gdImageCreateFromPng, gdImageCreateFromPngCtx);
-}
-/* }}} */
-#endif /* HAVE_GD_PNG */
-
-#ifdef HAVE_GD_XBM
-/* {{{ proto int imagecreatefromxbm(string filename)
- Create a new image from XBM file or URL */
-PHP_FUNCTION(imagecreatefromxbm)
-{
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_XBM, "XBM", gdImageCreateFromXbm, NULL);
-}
-/* }}} */
-#endif /* HAVE_GD_XBM */
-
-#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
-/* {{{ proto int imagecreatefromxpm(string filename)
- Create a new image from XPM file or URL */
-PHP_FUNCTION(imagecreatefromxpm)
-{
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_XPM, "XPM", gdImageCreateFromXpm, NULL);
-}
-/* }}} */
-#endif
-
-#ifdef HAVE_GD_WBMP
-/* {{{ proto int imagecreatefromwbmp(string filename)
- Create a new image from WBMP file or URL */
-PHP_FUNCTION(imagecreatefromwbmp)
-{
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, "WBMP", gdImageCreateFromWBMP, gdImageCreateFromWBMPCtx);
-}
-/* }}} */
-#endif /* HAVE_GD_WBMP */
-
-/* {{{ proto int imagecreatefromgd(string filename)
- Create a new image from GD file or URL */
-PHP_FUNCTION(imagecreatefromgd)
-{
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD, "GD", gdImageCreateFromGd, gdImageCreateFromGdCtx);
-}
-/* }}} */
-
-#ifdef HAVE_GD_GD2
-/* {{{ proto int imagecreatefromgd2(string filename)
- Create a new image from GD2 file or URL */
-PHP_FUNCTION(imagecreatefromgd2)
-{
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD2, "GD2", gdImageCreateFromGd2, gdImageCreateFromGd2Ctx);
-}
-/* }}} */
-
-/* {{{ proto int imagecreatefromgd2part(string filename, int srcX, int srcY, int width, int height)
- Create a new image from a given part of GD2 file or URL */
-PHP_FUNCTION(imagecreatefromgd2part)
-{
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD2PART, "GD2", gdImageCreateFromGd2Part, gdImageCreateFromGd2PartCtx);
-}
-/* }}} */
-#endif /* HAVE_GD_GD2 */
-
-/* {{{ _php_image_output
- */
-static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)())
-{
- zval **imgind, **file, **quality, **type;
- gdImagePtr im;
- char *fn = NULL;
- FILE *fp;
- int argc = ZEND_NUM_ARGS();
- int q = -1, i, t = 1;
-
- /* The quality parameter for Wbmp stands for the threshold when called from image2wbmp() */
- /* When called from imagewbmp() the quality parameter stands for the foreground color. Default: black. */
- /* The quality parameter for gd2 stands for chunk size */
-
- if (argc < 1 || argc > 4 || zend_get_parameters_ex(argc, &imgind, &file, &quality, &type) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, imgind, -1, "Image", le_gd);
-
- if (argc > 1) {
- convert_to_string_ex(file);
- fn = Z_STRVAL_PP(file);
- if (argc == 3) {
- convert_to_long_ex(quality);
- q = Z_LVAL_PP(quality);
- }
- if (argc == 4) {
- convert_to_long_ex(type);
- t = Z_LVAL_PP(type);
- }
- }
-
- if ((argc == 2) || (argc > 2 && Z_STRLEN_PP(file))) {
- if (!fn || fn == empty_string || php_check_open_basedir(fn TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid filename '%s'", fn);
- RETURN_FALSE;
- }
-
- fp = VCWD_FOPEN(fn, "wb");
- if (!fp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open '%s' for writing", fn);
- RETURN_FALSE;
- }
-
- switch (image_type) {
- case PHP_GDIMG_CONVERT_WBM:
- if (q < 0 || q > 255) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
- }
- case PHP_GDIMG_TYPE_JPG:
- (*func_p)(im, fp, q);
- break;
- case PHP_GDIMG_TYPE_WBM:
- for (i = 0; i < gdImageColorsTotal(im); i++) {
- if (gdImageRed(im, i) == 0) break;
- }
- (*func_p)(im, i, fp);
- break;
-#if HAVE_LIBGD20
- case PHP_GDIMG_TYPE_GD:
- if (im->trueColor){
- gdImageTrueColorToPalette(im,1,256);
- }
- (*func_p)(im, fp);
- break;
-#endif
- default:
- if (q == -1) {
- q = 128;
- }
- (*func_p)(im, fp, q, t);
- break;
- }
- fflush(fp);
- fclose(fp);
- } else {
- int b;
- FILE *tmp;
- char buf[4096];
-
- tmp = tmpfile();
- if (tmp == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open temporary file");
- RETURN_FALSE;
- }
-
- switch (image_type) {
- case PHP_GDIMG_CONVERT_WBM:
- if (q < 0 || q > 255) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
- }
- case PHP_GDIMG_TYPE_JPG:
- (*func_p)(im, tmp, q);
- break;
- case PHP_GDIMG_TYPE_WBM:
- for (i = 0; i < gdImageColorsTotal(im); i++) {
- if (gdImageRed(im, i) == 0) {
- break;
- }
- }
- (*func_p)(im, q, tmp);
- break;
-#if HAVE_LIBGD20
- case PHP_GDIMG_TYPE_GD:
- if (im->trueColor) {
- gdImageTrueColorToPalette(im,1,256);
- }
- (*func_p)(im, tmp);
- break;
-#endif
- default:
- (*func_p)(im, tmp);
- break;
- }
-
- fseek(tmp, 0, SEEK_SET);
-
-#if APACHE && defined(CHARSET_EBCDIC)
- /* XXX this is unlikely to work any more thies@thieso.net */
-
- /* This is a binary file already: avoid EBCDIC->ASCII conversion */
- ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0);
-#endif
- while ((b = fread(buf, 1, sizeof(buf), tmp)) > 0) {
- php_write(buf, b TSRMLS_CC);
- }
-
- fclose(tmp);
- /* the temporary file is automatically deleted */
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-#ifdef HAVE_GD_GIF_CREATE
-/* {{{ proto int imagegif(int im [, string filename])
- Output GIF image to browser or file */
-PHP_FUNCTION(imagegif)
-{
-#ifdef HAVE_GD_GIF_CTX
- _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageGifCtx);
-#else
- _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageGif);
-#endif
-}
-/* }}} */
-#endif /* HAVE_GD_GIF_CREATE */
-
-#ifdef HAVE_GD_PNG
-/* {{{ proto int imagepng(int im [, string filename])
- Output PNG image to browser or file */
-PHP_FUNCTION(imagepng)
-{
-#ifdef USE_GD_IOCTX
- _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, "PNG", gdImagePngCtx);
-#else
- _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, "PNG", gdImagePng);
-#endif
-}
-/* }}} */
-#endif /* HAVE_GD_PNG */
-
-#ifdef HAVE_GD_JPG
-/* {{{ proto int imagejpeg(int im [, string filename [, int quality]])
- Output JPEG image to browser or file */
-PHP_FUNCTION(imagejpeg)
-{
-#ifdef USE_GD_IOCTX
- _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG, "JPEG", gdImageJpegCtx);
-#else
- _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG, "JPEG", gdImageJpeg);
-#endif
-}
-/* }}} */
-#endif /* HAVE_GD_JPG */
-
-#ifdef HAVE_GD_WBMP
-/* {{{ proto int imagewbmp(int im [, string filename, [, int foreground]])
- Output WBMP image to browser or file */
-PHP_FUNCTION(imagewbmp)
-{
-#ifdef USE_GD_IOCTX
- _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, "WBMP", gdImageWBMPCtx);
-#else
- _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, "WBMP", gdImageWBMP);
-#endif
-}
-/* }}} */
-#endif /* HAVE_GD_WBMP */
-
-/* {{{ proto int imagegd(int im [, string filename])
- Output GD image to browser or file */
-PHP_FUNCTION(imagegd)
-{
- _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD, "GD", gdImageGd);
-}
-/* }}} */
-
-#ifdef HAVE_GD_GD2
-/* {{{ proto int imagegd2(int im [, string filename, [, int chunk_size, [, int type]]])
- Output GD2 image to browser or file */
-PHP_FUNCTION(imagegd2)
-{
- _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD2, "GD2", gdImageGd2);
-}
-/* }}} */
-#endif /* HAVE_GD_GD2 */
-
-/* {{{ proto int imagedestroy(int im)
- Destroy an image */
-PHP_FUNCTION(imagedestroy)
-{
- zval **IM;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &IM) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- zend_list_delete(Z_LVAL_PP(IM));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto int imagecolorallocate(int im, int red, int green, int blue)
- Allocate a color for an image */
-PHP_FUNCTION(imagecolorallocate)
-{
- zval **IM, **red, **green, **blue;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
-
- RETURN_LONG(gdImageColorAllocate(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
-}
-/* }}} */
-
-#if HAVE_LIBGD15
-/* {{{ proto int imagepalettecopy(int dst, int src)
- Copy the palette from the src image onto the dst image */
-PHP_FUNCTION(imagepalettecopy)
-{
- zval **dstim, **srcim;
- gdImagePtr dst, src;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &dstim, &srcim) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(dst, gdImagePtr, dstim, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(src, gdImagePtr, srcim, -1, "Image", le_gd);
-
- gdImagePaletteCopy(dst, src);
-}
-/* }}} */
-#endif
-
-/* {{{ proto int imagecolorat(int im, int x, int y)
- Get the index of the color of a pixel */
-PHP_FUNCTION(imagecolorat)
-{
- zval **IM, **x, **y;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &IM, &x, &y) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x);
- convert_to_long_ex(y);
-
-#if HAVE_LIBGD20
- if (gdImageTrueColor(im)) {
- if (im->tpixels && gdImageBoundsSafe(im, Z_LVAL_PP(x), Z_LVAL_PP(y))) {
- RETURN_LONG(gdImageTrueColorPixel(im, Z_LVAL_PP(x), Z_LVAL_PP(y)));
- } else {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%ld,%ld is out of bounds", Z_LVAL_PP(x), Z_LVAL_PP(y));
- RETURN_FALSE;
- }
- } else {
-#endif
- if (im->pixels && gdImageBoundsSafe(im, Z_LVAL_PP(x), Z_LVAL_PP(y))) {
-#if HAVE_LIBGD13
- RETURN_LONG(im->pixels[Z_LVAL_PP(y)][Z_LVAL_PP(x)]);
-#else
- RETURN_LONG(im->pixels[Z_LVAL_PP(x)][Z_LVAL_PP(y)]);
-#endif
- } else {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%ld,%ld is out of bounds", Z_LVAL_PP(x), Z_LVAL_PP(y));
- RETURN_FALSE;
- }
-#if HAVE_LIBGD20
- }
-#endif
-}
-/* }}} */
-
-/* {{{ proto int imagecolorclosest(int im, int red, int green, int blue)
- Get the index of the closest color to the specified color */
-PHP_FUNCTION(imagecolorclosest)
-{
- zval **IM, **red, **green, **blue;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
-
- RETURN_LONG(gdImageColorClosest(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
-}
-/* }}} */
-
-#if HAVE_COLORCLOSESTHWB
-/* {{{ proto int imagecolorclosesthwb(int im, int red, int green, int blue)
- Get the index of the color which has the hue, white and blackness nearest to the given color */
-PHP_FUNCTION(imagecolorclosesthwb)
-{
- zval **IM, **red, **green, **blue;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
-
- RETURN_LONG(gdImageColorClosestHWB(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
-}
-/* }}} */
-#endif
-
-/* {{{ proto int imagecolordeallocate(int im, int index)
- De-allocate a color for an image */
-PHP_FUNCTION(imagecolordeallocate)
-{
- zval **IM, **index;
- int col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &index) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
-#if HAVE_LIBGD20
- /* We can return right away for a truecolor image as deallocating colours is meaningless here */
- if (gdImageTrueColor(im)) {
- RETURN_TRUE;
- }
-#endif
-
- convert_to_long_ex(index);
- col = Z_LVAL_PP(index);
-
- if (col >= 0 && col < gdImageColorsTotal(im)) {
- gdImageColorDeallocate(im, col);
- RETURN_TRUE;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Color index %d out of range", col);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int imagecolorresolve(int im, int red, int green, int blue)
- Get the index of the specified color or its closest possible alternative */
-PHP_FUNCTION(imagecolorresolve)
-{
- zval **IM, **red, **green, **blue;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
-
- RETURN_LONG(gdImageColorResolve(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
-}
-/* }}} */
-
-/* {{{ proto int imagecolorexact(int im, int red, int green, int blue)
- Get the index of the specified color */
-PHP_FUNCTION(imagecolorexact)
-{
- zval **IM, **red, **green, **blue;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
-
- RETURN_LONG(gdImageColorExact(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
-}
-/* }}} */
-
-/* {{{ proto int imagecolorset(int im, int col, int red, int green, int blue)
- Set the color for the specified palette index */
-PHP_FUNCTION(imagecolorset)
-{
- zval **IM, **color, **red, **green, **blue;
- int col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &color, &red, &green, &blue) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(color);
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
-
- col = Z_LVAL_PP(color);
-
- if (col >= 0 && col < gdImageColorsTotal(im)) {
- im->red[col] = Z_LVAL_PP(red);
- im->green[col] = Z_LVAL_PP(green);
- im->blue[col] = Z_LVAL_PP(blue);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array imagecolorsforindex(int im, int col)
- Get the colors for an index */
-PHP_FUNCTION(imagecolorsforindex)
-{
- zval **IM, **index;
- int col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &index) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(index);
- col = Z_LVAL_PP(index);
-#if HAVE_LIBGD20
- if ((col >= 0 && gdImageTrueColor(im)) || (!gdImageTrueColor(im) && col >= 0 && col < gdImageColorsTotal(im))) {
- array_init(return_value);
-
- add_assoc_long(return_value,"red", gdImageRed(im,col));
- add_assoc_long(return_value,"green", gdImageGreen(im,col));
- add_assoc_long(return_value,"blue", gdImageBlue(im,col));
- add_assoc_long(return_value,"alpha", gdImageAlpha(im,col));
- }
-#else
- if (col >= 0 && col < gdImageColorsTotal(im)) {
- array_init(return_value);
-
- add_assoc_long(return_value,"red", im->red[col]);
- add_assoc_long(return_value,"green", im->green[col]);
- add_assoc_long(return_value,"blue", im->blue[col]);
- }
-#endif
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Color index %d out of range", col);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int imagegammacorrect(int im, float inputgamma, float outputgamma)
- Apply a gamma correction to a GD image */
-PHP_FUNCTION(imagegammacorrect)
-{
- zval **IM, **inputgamma, **outputgamma;
- gdImagePtr im;
- int i;
- double input, output;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &IM, &inputgamma, &outputgamma) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_double_ex(inputgamma);
- convert_to_double_ex(outputgamma);
-
- input = Z_DVAL_PP(inputgamma);
- output = Z_DVAL_PP(outputgamma);
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
-#if HAVE_LIBGD20
- if (gdImageTrueColor(im)) {
- int x, y, c;
-
- for (y = 0; y < gdImageSY(im); y++) {
- for (x = 0; x < gdImageSX(im); x++) {
- c = gdImageGetPixel(im, x, y);
- gdImageSetPixel(im, x, y,
- gdTrueColor(
- (int) ((pow((pow((gdTrueColorGetRed(c) / 255.0), input)), 1.0 / output) * 255) + .5),
- (int) ((pow((pow((gdTrueColorGetGreen(c) / 255.0), input)), 1.0 / output) * 255) + .5),
- (int) ((pow((pow((gdTrueColorGetBlue(c) / 255.0), input)), 1.0 / output) * 255) + .5)
- )
- );
- }
- }
- RETURN_TRUE;
- }
-#endif
- for (i = 0; i < gdImageColorsTotal(im); i++) {
- im->red[i] = (int)((pow((pow((im->red[i] / 255.0), input)), 1.0 / output) * 255) + .5);
- im->green[i] = (int)((pow((pow((im->green[i] / 255.0), input)), 1.0 / output) * 255) + .5);
- im->blue[i] = (int)((pow((pow((im->blue[i] / 255.0), input)), 1.0 / output) * 255) + .5);
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagesetpixel(int im, int x, int y, int col)
- Set a single pixel */
-PHP_FUNCTION(imagesetpixel)
-{
- zval **IM, **x, **y, **col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &x, &y, &col) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x);
- convert_to_long_ex(y);
- convert_to_long_ex(col);
-
- gdImageSetPixel(im, Z_LVAL_PP(x), Z_LVAL_PP(y), Z_LVAL_PP(col));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imageline(int im, int x1, int y1, int x2, int y2, int col)
- Draw a line */
-PHP_FUNCTION(imageline)
-{
- zval **IM, **x1, **y1, **x2, **y2, **col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x1);
- convert_to_long_ex(y1);
- convert_to_long_ex(x2);
- convert_to_long_ex(y2);
- convert_to_long_ex(col);
-
-#ifdef HAVE_GD_BUNDLED
- if (im->antialias) {
- gdImageAALine(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2), Z_LVAL_PP(y2), Z_LVAL_PP(col));
- } else
-#endif
- {
- gdImageLine(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2), Z_LVAL_PP(y2), Z_LVAL_PP(col));
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagedashedline(int im, int x1, int y1, int x2, int y2, int col)
- Draw a dashed line */
-PHP_FUNCTION(imagedashedline)
-{
- zval **IM, **x1, **y1, **x2, **y2, **col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x1);
- convert_to_long_ex(y1);
- convert_to_long_ex(x2);
- convert_to_long_ex(y2);
- convert_to_long_ex(col);
-
- gdImageDashedLine(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2), Z_LVAL_PP(y2), Z_LVAL_PP(col));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagerectangle(int im, int x1, int y1, int x2, int y2, int col)
- Draw a rectangle */
-PHP_FUNCTION(imagerectangle)
-{
- zval **IM, **x1, **y1, **x2, **y2, **col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x1);
- convert_to_long_ex(y1);
- convert_to_long_ex(x2);
- convert_to_long_ex(y2);
- convert_to_long_ex(col);
-
- gdImageRectangle(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2), Z_LVAL_PP(y2), Z_LVAL_PP(col));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagefilledrectangle(int im, int x1, int y1, int x2, int y2, int col)
- Draw a filled rectangle */
-PHP_FUNCTION(imagefilledrectangle)
-{
- zval **IM, **x1, **y1, **x2, **y2, **col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x1);
- convert_to_long_ex(y1);
- convert_to_long_ex(x2);
- convert_to_long_ex(y2);
- convert_to_long_ex(col);
-
- gdImageFilledRectangle(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2), Z_LVAL_PP(y2), Z_LVAL_PP(col));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagearc(int im, int cx, int cy, int w, int h, int s, int e, int col)
- Draw a partial ellipse */
-PHP_FUNCTION(imagearc)
-{
- zval **IM, **cx, **cy, **w, **h, **ST, **E, **col;
- gdImagePtr im;
- int e, st;
-
- if (ZEND_NUM_ARGS() != 8 || zend_get_parameters_ex(8, &IM, &cx, &cy, &w, &h, &ST, &E, &col) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(cx);
- convert_to_long_ex(cy);
- convert_to_long_ex(w);
- convert_to_long_ex(h);
- convert_to_long_ex(ST);
- convert_to_long_ex(E);
- convert_to_long_ex(col);
-
- e = Z_LVAL_PP(E);
- if (e < 0) {
- e %= 360;
- }
-
- st = Z_LVAL_PP(ST);
- if (st < 0) {
- st %= 360;
- }
-
- gdImageArc(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), st, e, Z_LVAL_PP(col));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void imageellipse(resource im, int cx, int cy, int w, int h, int color)
- Draw an ellipse */
-PHP_FUNCTION(imageellipse)
-{
- zval **IM, **cx, **cy, **w, **h, **color;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &cx, &cy, &w, &h, &color) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(cx);
- convert_to_long_ex(cy);
- convert_to_long_ex(w);
- convert_to_long_ex(h);
- convert_to_long_ex(color);
-
-#ifdef HAVE_GD_IMAGEELLIPSE /* this function is missing from GD 2.0.1 */
- gdImageEllipse(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), Z_LVAL_PP(color));
-#else
- gdImageArc(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), 0, 360, Z_LVAL_PP(color));
-#endif
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagefilltoborder(int im, int x, int y, int border, int col)
- Flood fill to specific color */
-PHP_FUNCTION(imagefilltoborder)
-{
- zval **IM, **x, **y, **border, **col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &x, &y, &border, &col) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x);
- convert_to_long_ex(y);
- convert_to_long_ex(border);
- convert_to_long_ex(col);
-
- gdImageFillToBorder(im, Z_LVAL_PP(x), Z_LVAL_PP(y), Z_LVAL_PP(border), Z_LVAL_PP(col));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagefill(int im, int x, int y, int col)
- Flood fill */
-PHP_FUNCTION(imagefill)
-{
- zval **IM, **x, **y, **col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &x, &y, &col) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x);
- convert_to_long_ex(y);
- convert_to_long_ex(col);
-
- gdImageFill(im, Z_LVAL_PP(x), Z_LVAL_PP(y), Z_LVAL_PP(col));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagecolorstotal(int im)
- Find out the number of colors in an image's palette */
-PHP_FUNCTION(imagecolorstotal)
-{
- zval **IM;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &IM) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- RETURN_LONG(gdImageColorsTotal(im));
-}
-/* }}} */
-
-/* {{{ proto int imagecolortransparent(int im [, int col])
- Define a color as transparent */
-PHP_FUNCTION(imagecolortransparent)
-{
- zval **IM, **COL;
- gdImagePtr im;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &IM) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &IM, &COL) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_long_ex(COL);
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- if (ZEND_NUM_ARGS() > 1) {
- gdImageColorTransparent(im, Z_LVAL_PP(COL));
- }
-
- RETURN_LONG(gdImageGetTransparent(im));
-}
-/* }}} */
-
-/* {{{ proto int imageinterlace(int im [, int interlace])
- Enable or disable interlace */
-PHP_FUNCTION(imageinterlace)
-{
- zval **IM, **INT;
- gdImagePtr im;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &IM) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &IM, &INT) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_long_ex(INT);
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- if (ZEND_NUM_ARGS() > 1) {
- gdImageInterlace(im, Z_LVAL_PP(INT));
- }
-
- RETURN_LONG(gdImageGetInterlaced(im));
-}
-/* }}} */
-
-/* {{{ php_imagepolygon
- arg = 0 normal polygon
- arg = 1 filled polygon */
-/* im, points, num_points, col */
-static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled)
-{
- zval **IM, **POINTS, **NPOINTS, **COL;
- pval **var = NULL;
- gdImagePtr im;
- gdPointPtr points;
- int npoints, col, nelem, i;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &POINTS, &NPOINTS, &COL) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(NPOINTS);
- convert_to_long_ex(COL);
-
- npoints = Z_LVAL_PP(NPOINTS);
- col = Z_LVAL_PP(COL);
-
- if (Z_TYPE_PP(POINTS) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument to imagepolygon not an array");
- RETURN_FALSE;
- }
-
- nelem = zend_hash_num_elements(Z_ARRVAL_PP(POINTS));
- if (nelem < 6) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must have at least 3 points in your array");
- RETURN_FALSE;
- }
-
- if (nelem < npoints * 2) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to use %d points in array with only %d points", npoints, nelem/2);
- RETURN_FALSE;
- }
-
- points = (gdPointPtr) emalloc(npoints * sizeof(gdPoint));
-
- for (i = 0; i < npoints; i++) {
- if (zend_hash_index_find(Z_ARRVAL_PP(POINTS), (i * 2), (void **) &var) == SUCCESS) {
- SEPARATE_ZVAL((var));
- convert_to_long(*var);
- points[i].x = Z_LVAL_PP(var);
- }
- if (zend_hash_index_find(Z_ARRVAL_PP(POINTS), (i * 2) + 1, (void **) &var) == SUCCESS) {
- SEPARATE_ZVAL(var);
- convert_to_long(*var);
- points[i].y = Z_LVAL_PP(var);
- }
- }
-
- if (filled) {
- gdImageFilledPolygon(im, points, npoints, col);
- } else {
- gdImagePolygon(im, points, npoints, col);
- }
-
- efree(points);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagepolygon(int im, array point, int num_points, int col)
- Draw a polygon */
-PHP_FUNCTION(imagepolygon)
-{
- php_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int imagefilledpolygon(int im, array point, int num_points, int col)
- Draw a filled polygon */
-PHP_FUNCTION(imagefilledpolygon)
-{
- php_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ php_find_gd_font
- */
-static gdFontPtr php_find_gd_font(int size TSRMLS_DC)
-{
- gdFontPtr font;
- int ind_type;
-
- switch (size) {
- case 1:
- font = gdFontTiny;
- break;
- case 2:
- font = gdFontSmall;
- break;
- case 3:
- font = gdFontMediumBold;
- break;
- case 4:
- font = gdFontLarge;
- break;
- case 5:
- font = gdFontGiant;
- break;
- default:
- font = zend_list_find(size - 5, &ind_type);
- if (!font || ind_type != le_gd_font) {
- if (size < 1) {
- font = gdFontTiny;
- } else {
- font = gdFontGiant;
- }
- }
- break;
- }
-
- return font;
-}
-/* }}} */
-
-/* {{{ php_imagefontsize
- * arg = 0 ImageFontWidth
- * arg = 1 ImageFontHeight
- */
-static void php_imagefontsize(INTERNAL_FUNCTION_PARAMETERS, int arg)
-{
- zval **SIZE;
- gdFontPtr font;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &SIZE) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(SIZE);
-
- font = php_find_gd_font(Z_LVAL_PP(SIZE) TSRMLS_CC);
- RETURN_LONG(arg ? font->h : font->w);
-}
-/* }}} */
-
-/* {{{ proto int imagefontwidth(int font)
- Get font width */
-PHP_FUNCTION(imagefontwidth)
-{
- php_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int imagefontheight(int font)
- Get font height */
-PHP_FUNCTION(imagefontheight)
-{
- php_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ php_gdimagecharup
- * workaround for a bug in gd 1.2 */
-static void php_gdimagecharup(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
-{
- int cx, cy, px, py, fline;
- cx = 0;
- cy = 0;
-
- if ((c < f->offset) || (c >= (f->offset + f->nchars))) {
- return;
- }
-
- fline = (c - f->offset) * f->h * f->w;
- for (py = y; (py > (y - f->w)); py--) {
- for (px = x; (px < (x + f->h)); px++) {
- if (f->data[fline + cy * f->w + cx]) {
- gdImageSetPixel(im, px, py, color);
- }
- cy++;
- }
- cy = 0;
- cx++;
- }
-}
-/* }}} */
-
-/* {{{ php_imagechar
- * arg = 0 ImageChar
- * arg = 1 ImageCharUp
- * arg = 2 ImageString
- * arg = 3 ImageStringUp
- */
-static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- zval **IM, **SIZE, **X, **Y, **C, **COL;
- gdImagePtr im;
- int ch = 0, col, x, y, size, i, l = 0;
- unsigned char *str = NULL;
- gdFontPtr font;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &SIZE, &X, &Y, &C, &COL) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(SIZE);
- convert_to_long_ex(X);
- convert_to_long_ex(Y);
- convert_to_string_ex(C);
- convert_to_long_ex(COL);
-
- col = Z_LVAL_PP(COL);
-
- if (mode < 2) {
- ch = (int)((unsigned char)*(Z_STRVAL_PP(C)));
- } else {
- str = (unsigned char *) estrndup(Z_STRVAL_PP(C), Z_STRLEN_PP(C));
- l = strlen(str);
- }
-
- y = Z_LVAL_PP(Y);
- x = Z_LVAL_PP(X);
- size = Z_LVAL_PP(SIZE);
-
- font = php_find_gd_font(size TSRMLS_CC);
-
- switch (mode) {
- case 0:
- gdImageChar(im, font, x, y, ch, col);
- break;
- case 1:
- php_gdimagecharup(im, font, x, y, ch, col);
- break;
- case 2:
- for (i = 0; (i < l); i++) {
- gdImageChar(im, font, x, y, (int) ((unsigned char) str[i]), col);
- x += font->w;
- }
- break;
- case 3: {
- for (i = 0; (i < l); i++) {
- /* php_gdimagecharup(im, font, x, y, (int) str[i], col); */
- gdImageCharUp(im, font, x, y, (int) str[i], col);
- y -= font->w;
- }
- break;
- }
- }
- if (str) {
- efree(str);
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagechar(int im, int font, int x, int y, string c, int col)
- Draw a character */
-PHP_FUNCTION(imagechar)
-{
- php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int imagecharup(int im, int font, int x, int y, string c, int col)
- Draw a character rotated 90 degrees counter-clockwise */
-PHP_FUNCTION(imagecharup)
-{
- php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int imagestring(int im, int font, int x, int y, string str, int col)
- Draw a string horizontally */
-PHP_FUNCTION(imagestring)
-{
- php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);
-}
-/* }}} */
-
-/* {{{ proto int imagestringup(int im, int font, int x, int y, string str, int col)
- Draw a string vertically - rotated 90 degrees counter-clockwise */
-PHP_FUNCTION(imagestringup)
-{
- php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3);
-}
-/* }}} */
-
-/* {{{ proto int imagecopy(int dst_im, int src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h)
- Copy part of an image */
-PHP_FUNCTION(imagecopy)
-{
- zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY;
- gdImagePtr im_dst, im_src;
- int srcH, srcW, srcY, srcX, dstY, dstX;
-
- if (ZEND_NUM_ARGS() != 8 || zend_get_parameters_ex(8, &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(im_dst, gdImagePtr, DIM, -1, "Image", le_gd);
-
- convert_to_long_ex(SX);
- convert_to_long_ex(SY);
- convert_to_long_ex(SW);
- convert_to_long_ex(SH);
- convert_to_long_ex(DX);
- convert_to_long_ex(DY);
-
- srcX = Z_LVAL_PP(SX);
- srcY = Z_LVAL_PP(SY);
- srcH = Z_LVAL_PP(SH);
- srcW = Z_LVAL_PP(SW);
- dstX = Z_LVAL_PP(DX);
- dstY = Z_LVAL_PP(DY);
-
- gdImageCopy(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH);
- RETURN_TRUE;
-}
-/* }}} */
-
-#if HAVE_LIBGD15
-/* {{{ proto int imagecopymerge(int src_im, int dst_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h, int pct)
- Merge one part of an image with another */
-PHP_FUNCTION(imagecopymerge)
-{
- zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY, **PCT;
- gdImagePtr im_dst, im_src;
- int srcH, srcW, srcY, srcX, dstY, dstX, pct;
-
- if (ZEND_NUM_ARGS() != 9 || zend_get_parameters_ex(9, &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(im_dst, gdImagePtr, DIM, -1, "Image", le_gd);
-
- convert_to_long_ex(SX);
- convert_to_long_ex(SY);
- convert_to_long_ex(SW);
- convert_to_long_ex(SH);
- convert_to_long_ex(DX);
- convert_to_long_ex(DY);
- convert_to_long_ex(PCT);
-
- srcX = Z_LVAL_PP(SX);
- srcY = Z_LVAL_PP(SY);
- srcH = Z_LVAL_PP(SH);
- srcW = Z_LVAL_PP(SW);
- dstX = Z_LVAL_PP(DX);
- dstY = Z_LVAL_PP(DY);
- pct = Z_LVAL_PP(PCT);
-
- gdImageCopyMerge(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH, pct);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagecopymergegray(int src_im, int dst_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h, int pct)
- Merge one part of an image with another */
-PHP_FUNCTION(imagecopymergegray)
-{
- zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY, **PCT;
- gdImagePtr im_dst, im_src;
- int srcH, srcW, srcY, srcX, dstY, dstX, pct;
-
- if (ZEND_NUM_ARGS() != 9 || zend_get_parameters_ex(9, &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(im_dst, gdImagePtr, DIM, -1, "Image", le_gd);
-
- convert_to_long_ex(SX);
- convert_to_long_ex(SY);
- convert_to_long_ex(SW);
- convert_to_long_ex(SH);
- convert_to_long_ex(DX);
- convert_to_long_ex(DY);
- convert_to_long_ex(PCT);
-
- srcX = Z_LVAL_PP(SX);
- srcY = Z_LVAL_PP(SY);
- srcH = Z_LVAL_PP(SH);
- srcW = Z_LVAL_PP(SW);
- dstX = Z_LVAL_PP(DX);
- dstY = Z_LVAL_PP(DY);
- pct = Z_LVAL_PP(PCT);
-
- gdImageCopyMergeGray(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH, pct);
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-/* {{{ proto int imagecopyresized(int dst_im, int src_im, int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h)
- Copy and resize part of an image */
-PHP_FUNCTION(imagecopyresized)
-{
- zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY, **DW, **DH;
- gdImagePtr im_dst, im_src;
- int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX;
-
- if (ZEND_NUM_ARGS() != 10 || zend_get_parameters_ex(10, &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_dst, gdImagePtr, DIM, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
-
- convert_to_long_ex(SX);
- convert_to_long_ex(SY);
- convert_to_long_ex(SW);
- convert_to_long_ex(SH);
- convert_to_long_ex(DX);
- convert_to_long_ex(DY);
- convert_to_long_ex(DW);
- convert_to_long_ex(DH);
-
- srcX = Z_LVAL_PP(SX);
- srcY = Z_LVAL_PP(SY);
- srcH = Z_LVAL_PP(SH);
- srcW = Z_LVAL_PP(SW);
- dstX = Z_LVAL_PP(DX);
- dstY = Z_LVAL_PP(DY);
- dstH = Z_LVAL_PP(DH);
- dstW = Z_LVAL_PP(DW);
-
- if (dstW <= 0 || dstH <= 0 || srcW <= 0 || srcH <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid image dimensions");
- RETURN_FALSE;
- }
-
- gdImageCopyResized(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagesx(int im)
- Get image width */
-PHP_FUNCTION(imagesx)
-{
- zval **IM;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &IM) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- RETURN_LONG(gdImageSX(im));
-}
-/* }}} */
-
-/* {{{ proto int imagesy(int im)
- Get image height */
-PHP_FUNCTION(imagesy)
-{
- zval **IM;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &IM) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- RETURN_LONG(gdImageSY(im));
-}
-/* }}} */
-
-#ifdef ENABLE_GD_TTF
-#define TTFTEXT_DRAW 0
-#define TTFTEXT_BBOX 1
-#endif
-
-#ifdef ENABLE_GD_TTF
-
-#if HAVE_LIBGD20 && HAVE_LIBFREETYPE && HAVE_GD_STRINGFTEX
-/* {{{ proto array imageftbbox(int size, int angle, string font_file, string text[, array extrainfo])
- Give the bounding box of a text using fonts via freetype2 */
-PHP_FUNCTION(imageftbbox)
-{
- php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_BBOX, 1);
-}
-/* }}} */
-
-/* {{{ proto array imagefttext(int im, int size, int angle, int x, int y, int col, string font_file, string text, [array extrainfo])
- Write text to the image using fonts via freetype2 */
-PHP_FUNCTION(imagefttext)
-{
- php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW, 1);
-}
-/* }}} */
-#endif
-
-/* {{{ proto array imagettfbbox(int size, int angle, string font_file, string text)
- Give the bounding box of a text using TrueType fonts */
-PHP_FUNCTION(imagettfbbox)
-{
- php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_BBOX, 0);
-}
-/* }}} */
-
-/* {{{ proto array imagettftext(int im, int size, int angle, int x, int y, int col, string font_file, string text)
- Write text to the image using a TrueType font */
-PHP_FUNCTION(imagettftext)
-{
- php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW, 0);
-}
-/* }}} */
-
-/* {{{ php_imagettftext_common
- */
-static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int extended)
-{
- zval **IM, **PTSIZE, **ANGLE, **X, **Y, **C, **FONTNAME, **COL, **EXT = NULL;
- gdImagePtr im=NULL;
- int col, x, y, l=0, i, brect[8];
- double ptsize, angle;
- unsigned char *str = NULL, *fontname = NULL;
- char *error = NULL;
- int argc;
-#if HAVE_GD_STRINGFTEX
- gdFTStringExtra strex;
-#endif
-
-#if !HAVE_GD_STRINGFTEX
- assert(!extended);
-#endif
-
- argc = ZEND_NUM_ARGS();
-
- if (mode == TTFTEXT_BBOX) {
- if ((extended && argc != 5) || (!extended && argc != 4) ||
- zend_get_parameters_ex(argc, &PTSIZE, &ANGLE, &FONTNAME, &C, &EXT) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- } else {
- if ((extended && argc != 9) || (!extended && argc != 8) ||
- zend_get_parameters_ex(argc, &IM, &PTSIZE, &ANGLE, &X, &Y, &COL, &FONTNAME, &C, &EXT) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- }
-
- convert_to_double_ex(PTSIZE);
- convert_to_double_ex(ANGLE);
- convert_to_string_ex(FONTNAME);
- convert_to_string_ex(C);
-
- if (mode == TTFTEXT_BBOX) {
- im = NULL;
- col = x = y = -1;
- } else {
- convert_to_long_ex(X);
- convert_to_long_ex(Y);
- convert_to_long_ex(COL);
- col = Z_LVAL_PP(COL);
- y = Z_LVAL_PP(Y);
- x = Z_LVAL_PP(X);
-
-#if HAVE_GD_STRINGFTEX
- if (EXT) {
- /* parse extended info */
-
- HashPosition pos;
-
- convert_to_array_ex(EXT);
- memset(&strex, 0, sizeof(strex));
-
- /* walk the assoc array */
- zend_hash_internal_pointer_reset_ex(HASH_OF(*EXT), &pos);
- do {
- zval ** item;
- char * key;
-
- if (zend_hash_get_current_key_ex(HASH_OF(*EXT), &key, NULL, NULL, 0, &pos) == FAILURE) {
- continue;
- }
-
- if (zend_hash_get_current_data_ex(HASH_OF(*EXT), (void **) &item, &pos) == FAILURE) {
- continue;
- }
-
- if (strcmp("linespacing", key) == 0) {
- convert_to_double_ex(item);
- strex.flags |= gdFTEX_LINESPACE;
- strex.linespacing = Z_DVAL_PP(item);
- }
-
- } while (zend_hash_move_forward_ex(HASH_OF(*EXT), &pos) == SUCCESS);
- }
-#endif
-
- }
-
- ptsize = Z_DVAL_PP(PTSIZE);
- angle = Z_DVAL_PP(ANGLE) * (M_PI / 180); /* convert to radians */
-
- str = (unsigned char *) Z_STRVAL_PP(C);
- l = strlen(str);
-
-#ifdef VIRTUAL_DIR
- if (virtual_filepath(Z_STRVAL_PP(FONTNAME), (char **) &fontname TSRMLS_CC)) {
- fontname = (unsigned char *) Z_STRVAL_PP(FONTNAME);
- }
-#else
- fontname = (unsigned char *) Z_STRVAL_PP(FONTNAME);
-#endif
-
-#ifdef USE_GD_IMGSTRTTF
-# if HAVE_GD_STRINGFTEX
- if (extended) {
- error = gdImageStringFTEx(im, brect, col, fontname, ptsize, angle, x, y, str, &strex);
- }
- else
-# endif
-
-# if HAVE_GD_STRINGFT
- error = gdImageStringFT(im, brect, col, fontname, ptsize, angle, x, y, str);
-# elif HAVE_GD_STRINGTTF
- error = gdImageStringTTF(im, brect, col, fontname, ptsize, angle, x, y, str);
-# endif
-
-#else /* !USE_GD_IMGSTRTTF */
- error = gdttf(im, brect, col, fontname, ptsize, angle, x, y, str);
-#endif
-
- if (error) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", error);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- /* return array with the text's bounding box */
- for (i = 0; i < 8; i++) {
- add_next_index_long(return_value, brect[i]);
- }
-}
-/* }}} */
-#endif /* ENABLE_GD_TTF */
-
-#if HAVE_LIBT1
-
-/* {{{ php_free_ps_font
- */
-static void php_free_ps_font(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- int *font = (int *) rsrc->ptr;
-
- T1_DeleteFont(*font);
- efree(font);
-}
-/* }}} */
-
-/* {{{ php_free_ps_enc
- */
-static void php_free_ps_enc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- char **enc = (char **) rsrc->ptr;
-
- T1_DeleteEncoding(enc);
-}
-/* }}} */
-
-/* {{{ proto int imagepsloadfont(string pathname)
- Load a new font from specified file */
-PHP_FUNCTION(imagepsloadfont)
-{
- zval **file;
- int f_ind, *font;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(file);
-
- f_ind = T1_AddFont(Z_STRVAL_PP(file));
-
- if (f_ind < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "T1Lib Error: %s", T1_StrError(f_ind));
- }
-
- if (T1_LoadFont(f_ind)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't load the font");
- RETURN_FALSE;
- }
-
- font = (int *) emalloc(sizeof(int));
- *font = f_ind;
- ZEND_REGISTER_RESOURCE(return_value, font, le_ps_font);
-}
-/* }}} */
-
-/* {{{ proto int imagepscopyfont(int font_index)
- Make a copy of a font for purposes like extending or reenconding */
-/* The function in t1lib which this function uses seem to be buggy...
-PHP_FUNCTION(imagepscopyfont)
-{
- zval **fnt;
- int l_ind, type;
- gd_ps_font *nf_ind, *of_ind;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fnt) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(fnt);
-
- of_ind = zend_list_find(Z_LVAL_PP(fnt), &type);
-
- if (type != le_ps_font) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Type 1 font index", Z_LVAL_PP(fnt));
- RETURN_FALSE;
- }
-
- nf_ind = emalloc(sizeof(gd_ps_font));
- nf_ind->font_id = T1_CopyFont(of_ind->font_id);
-
- if (nf_ind->font_id < 0) {
- l_ind = nf_ind->font_id;
- efree(nf_ind);
- switch (l_ind) {
- case -1:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "FontID %d is not loaded in memory", l_ind);
- RETURN_FALSE;
- break;
- case -2:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to copy a logical font");
- RETURN_FALSE;
- break;
- case -3:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Memory allocation fault in t1lib");
- RETURN_FALSE;
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "An unknown error occurred in t1lib");
- RETURN_FALSE;
- break;
- }
- }
-
- nf_ind->extend = 1;
- l_ind = zend_list_insert(nf_ind, le_ps_font);
- RETURN_LONG(l_ind);
-}
-*/
-/* }}} */
-
-/* {{{ proto bool imagepsfreefont(int font_index)
- Free memory used by a font */
-PHP_FUNCTION(imagepsfreefont)
-{
- zval **fnt;
- int *f_ind;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fnt) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font);
-
- zend_list_delete(Z_LVAL_PP(fnt));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool imagepsencodefont(int font_index, string filename)
- To change a fonts character encoding vector */
-PHP_FUNCTION(imagepsencodefont)
-{
- zval **fnt, **enc;
- char **enc_vector;
- int *f_ind;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fnt, &enc) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(enc);
-
- ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font);
-
- if ((enc_vector = T1_LoadEncoding(Z_STRVAL_PP(enc))) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't load encoding vector from %s", Z_STRVAL_PP(enc));
- RETURN_FALSE;
- }
-
- T1_DeleteAllSizes(*f_ind);
- if (T1_ReencodeFont(*f_ind, enc_vector)) {
- T1_DeleteEncoding(enc_vector);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't reencode font");
- RETURN_FALSE;
- }
-
- zend_list_insert(enc_vector, le_ps_enc);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool imagepsextendfont(int font_index, float extend)
- Extend or or condense (if extend < 1) a font */
-PHP_FUNCTION(imagepsextendfont)
-{
- zval **fnt, **ext;
- int *f_ind;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fnt, &ext) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_double_ex(ext);
-
- ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font);
-
- T1_DeleteAllSizes(*f_ind);
-
- if (Z_DVAL_PP(ext) <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Second parameter %f out of range (must be > 0)", Z_DVAL_PP(ext));
- RETURN_FALSE;
- }
-
- if (T1_ExtendFont(*f_ind, Z_DVAL_PP(ext)) != 0) {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool imagepsslantfont(int font_index, float slant)
- Slant a font */
-PHP_FUNCTION(imagepsslantfont)
-{
- zval **fnt, **slt;
- int *f_ind;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fnt, &slt) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_double_ex(slt);
-
- ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font);
-
- if (T1_SlantFont(*f_ind, Z_DVAL_PP(slt)) != 0) {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array imagepstext(int image, string text, int font, int size, int xcoord, int ycoord [, int space, int tightness, float angle, int antialias])
- Rasterize a string over an image */
-PHP_FUNCTION(imagepstext)
-{
- zval *img, *fnt;
- int i, j;
- int _fg, _bg, x, y, size, space = 0, aa_steps = 4, width = 0;
- int *f_ind;
- int h_lines, v_lines, c_ind;
- int rd, gr, bl, fg_rd, fg_gr, fg_bl, bg_rd, bg_gr, bg_bl;
-#if HAVE_LIBGD20
- int fg_al, bg_al, al;
-#endif
- int aa[16];
- int amount_kern, add_width;
- double angle = 0.0, extend;
- unsigned long aa_greys[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
- gdImagePtr bg_img;
- GLYPH *str_img;
- T1_OUTLINE *char_path, *str_path;
- T1_TMATRIX *transform = NULL;
- char *str;
- int str_len;
- int argc = ZEND_NUM_ARGS();
-
- if (argc != 8 && argc != 12) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrlllll|lldl", &img, &str, &str_len, &fnt, &size, &_fg, &_bg, &x, &y, &space, &width, &angle, &aa_steps) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(bg_img, gdImagePtr, &img, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(f_ind, int *, &fnt, -1, "Type 1 font", le_ps_font);
-
- /* Ensure that the provided colors are valid */
-#if HAVE_LIBGD20
- if (_fg < 0 || (!gdImageTrueColor(bg_img) && _fg > gdImageColorsTotal(bg_img))) {
-#else
- if (_fg < 0 || _fg > gdImageColorsTotal(bg_img)) {
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Foreground color index %d out of range", _fg);
- RETURN_FALSE;
- }
-
-#if HAVE_LIBGD20
- if (_bg < 0 || (!gdImageTrueColor(bg_img) && _fg > gdImageColorsTotal(bg_img))) {
-#else
- if (_bg < 0 || _bg > gdImageColorsTotal(bg_img)) {
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Background color index %d out of range", _bg);
- RETURN_FALSE;
- }
-
- fg_rd = gdImageRed (bg_img, _fg);
- fg_gr = gdImageGreen(bg_img, _fg);
- fg_bl = gdImageBlue (bg_img, _fg);
-#if HAVE_LIBGD20
- fg_al = gdImageAlpha(bg_img, _fg);
-#endif
-
- bg_rd = gdImageRed (bg_img, _bg);
- bg_gr = gdImageGreen(bg_img, _bg);
- bg_bl = gdImageBlue (bg_img, _bg);
-#if HAVE_LIBGD20
- bg_al = gdImageAlpha(bg_img, _bg);
-#endif
-
- for (i = 0; i < aa_steps; i++) {
- rd = bg_rd + (double) (fg_rd - bg_rd) / aa_steps * (i + 1);
- gr = bg_gr + (double) (fg_gr - bg_gr) / aa_steps * (i + 1);
- bl = bg_bl + (double) (fg_bl - bg_bl) / aa_steps * (i + 1);
-#if HAVE_LIBGD20
- al = bg_al + (double) (fg_al - bg_al) / aa_steps * (i + 1);
- aa[i] = gdImageColorResolveAlpha(bg_img, rd, gr, bl, al);
-#else
- aa[i] = gdImageColorResolve(bg_img, rd, gr, bl);
-#endif
- }
-
- T1_AASetBitsPerPixel(8);
-
- switch (aa_steps) {
- case 4:
- T1_AASetGrayValues(0, 1, 2, 3, 4);
- T1_AASetLevel(T1_AA_LOW);
- break;
- case 16:
- T1_AAHSetGrayValues(aa_greys);
- T1_AASetLevel(T1_AA_HIGH);
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value %d as number of steps for antialiasing", aa_steps);
- RETURN_FALSE;
- }
-
- if (angle) {
- transform = T1_RotateMatrix(NULL, angle);
- }
-
- extend = T1_GetExtend(*f_ind);
- str_path = T1_GetCharOutline(*f_ind, str[0], size, transform);
-
- if (!str_path) {
- if (T1_errno) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "T1Lib Error: %s", T1_StrError(T1_errno));
- }
- RETURN_FALSE;
- }
-
- for (i = 1; i < str_len; i++) {
- amount_kern = (int) T1_GetKerning(*f_ind, str[i - 1], str[i]);
- amount_kern += str[i - 1] == ' ' ? space : 0;
- add_width = (int) (amount_kern + width) / extend;
-
- char_path = T1_GetMoveOutline(*f_ind, add_width, 0, 0, size, transform);
- str_path = T1_ConcatOutlines(str_path, char_path);
-
- char_path = T1_GetCharOutline(*f_ind, str[i], size, transform);
- str_path = T1_ConcatOutlines(str_path, char_path);
- }
- str_img = T1_AAFillOutline(str_path, 0);
-
- if (T1_errno) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "T1Lib Error: %s", T1_StrError(T1_errno));
- RETURN_FALSE;
- }
-
- h_lines = str_img->metrics.ascent - str_img->metrics.descent;
- v_lines = str_img->metrics.rightSideBearing - str_img->metrics.leftSideBearing;
-
- for (i = 0; i < v_lines; i++) {
- for (j = 0; j < h_lines; j++) {
- switch (str_img->bits[j * v_lines + i]) {
- case 0:
- break;
- default:
- c_ind = aa[str_img->bits[j * v_lines + i] - 1];
- gdImageSetPixel(bg_img, x + str_img->metrics.leftSideBearing + i, y - str_img->metrics.ascent + j, c_ind);
- break;
- }
- }
- }
-
- array_init(return_value);
-
- add_next_index_long(return_value, str_img->metrics.leftSideBearing);
- add_next_index_long(return_value, str_img->metrics.descent);
- add_next_index_long(return_value, str_img->metrics.rightSideBearing);
- add_next_index_long(return_value, str_img->metrics.ascent);
-}
-/* }}} */
-
-/* {{{ proto array imagepsbbox(string text, int font, int size [, int space, int tightness, int angle])
- Return the bounding box needed by a string if rasterized */
-PHP_FUNCTION(imagepsbbox)
-{
- zval **str, **fnt, **sz, **sp, **wd, **ang;
- int i, space, add_width = 0, char_width, amount_kern;
- int cur_x, cur_y, dx, dy;
- int x1, y1, x2, y2, x3, y3, x4, y4;
- int *f_ind;
- int per_char = 0;
- double angle, sin_a = 0, cos_a = 0;
- BBox char_bbox, str_bbox = {0, 0, 0, 0};
-
- switch (ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &str, &fnt, &sz) == FAILURE) {
- RETURN_FALSE;
- }
- space = 0;
- break;
- case 6:
- if (zend_get_parameters_ex(6, &str, &fnt, &sz, &sp, &wd, &ang) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(sp);
- convert_to_long_ex(wd);
- convert_to_double_ex(ang);
- space = Z_LVAL_PP(sp);
- add_width = Z_LVAL_PP(wd);
- angle = Z_DVAL_PP(ang) * M_PI / 180;
- sin_a = sin(angle);
- cos_a = cos(angle);
- per_char = add_width || angle ? 1 : 0;
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font);
-
- convert_to_string_ex(str);
- convert_to_long_ex(sz);
-
-#define max(a, b) (a > b ? a : b)
-#define min(a, b) (a < b ? a : b)
-#define new_x(a, b) (int) ((a) * cos_a - (b) * sin_a)
-#define new_y(a, b) (int) ((a) * sin_a + (b) * cos_a)
-
- if (per_char) {
- space += T1_GetCharWidth(*f_ind, ' ');
- cur_x = cur_y = 0;
-
- for (i = 0; i < Z_STRLEN_PP(str); i++) {
- if (Z_STRVAL_PP(str)[i] == ' ') {
- char_bbox.llx = char_bbox.lly = char_bbox.ury = 0;
- char_bbox.urx = char_width = space;
- } else {
- char_bbox = T1_GetCharBBox(*f_ind, Z_STRVAL_PP(str)[i]);
- char_width = T1_GetCharWidth(*f_ind, Z_STRVAL_PP(str)[i]);
- }
- amount_kern = i ? T1_GetKerning(*f_ind, Z_STRVAL_PP(str)[i - 1], Z_STRVAL_PP(str)[i]) : 0;
-
- /* Transfer character bounding box to right place */
- x1 = new_x(char_bbox.llx, char_bbox.lly) + cur_x;
- y1 = new_y(char_bbox.llx, char_bbox.lly) + cur_y;
- x2 = new_x(char_bbox.llx, char_bbox.ury) + cur_x;
- y2 = new_y(char_bbox.llx, char_bbox.ury) + cur_y;
- x3 = new_x(char_bbox.urx, char_bbox.ury) + cur_x;
- y3 = new_y(char_bbox.urx, char_bbox.ury) + cur_y;
- x4 = new_x(char_bbox.urx, char_bbox.lly) + cur_x;
- y4 = new_y(char_bbox.urx, char_bbox.lly) + cur_y;
-
- /* Find min & max values and compare them with current bounding box */
- str_bbox.llx = min(str_bbox.llx, min(x1, min(x2, min(x3, x4))));
- str_bbox.lly = min(str_bbox.lly, min(y1, min(y2, min(y3, y4))));
- str_bbox.urx = max(str_bbox.urx, max(x1, max(x2, max(x3, x4))));
- str_bbox.ury = max(str_bbox.ury, max(y1, max(y2, max(y3, y4))));
-
- /* Move to the next base point */
- dx = new_x(char_width + add_width + amount_kern, 0);
- dy = new_y(char_width + add_width + amount_kern, 0);
- cur_x += dx;
- cur_y += dy;
- /*
- printf("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", x1, y1, x2, y2, x3, y3, x4, y4, char_bbox.llx, char_bbox.lly, char_bbox.urx, char_bbox.ury, char_width, amount_kern, cur_x, cur_y, dx, dy);
- */
- }
-
- } else {
- str_bbox = T1_GetStringBBox(*f_ind, Z_STRVAL_PP(str), Z_STRLEN_PP(str), space, T1_KERNING);
- }
-
- if (T1_errno) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- /*
- printf("%d %d %d %d\n", str_bbox.llx, str_bbox.lly, str_bbox.urx, str_bbox.ury);
- */
- add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*Z_LVAL_PP(sz)/1000));
- add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*Z_LVAL_PP(sz)/1000));
- add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*Z_LVAL_PP(sz)/1000));
- add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*Z_LVAL_PP(sz)/1000));
-}
-/* }}} */
-#endif
-
-#ifdef HAVE_GD_WBMP
-/* {{{ proto int image2wbmp(int im [, string filename [, int threshold]])
- Output WBMP image to browser or file */
-PHP_FUNCTION(image2wbmp)
-{
- _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_CONVERT_WBM, "WBMP", _php_image_bw_convert);
-}
-/* }}} */
-#endif /* HAVE_GD_WBMP */
-
-#if defined(HAVE_GD_JPG) && defined(HAVE_GD_WBMP)
-/* {{{ proto void jpeg2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold)
- Convert JPEG image to WBMP image */
-PHP_FUNCTION(jpeg2wbmp)
-{
- _php_image_convert(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG);
-}
-/* }}} */
-#endif
-
-#if defined(HAVE_GD_PNG) && defined(HAVE_GD_WBMP)
-/* {{{ proto void png2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold)
- Convert PNG image to WBMP image */
-PHP_FUNCTION(png2wbmp)
-{
- _php_image_convert(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG);
-}
-/* }}} */
-#endif
-
-#ifdef HAVE_GD_WBMP
-/* {{{ _php_image_bw_convert
- * It converts a gd Image to bw using a threshold value */
-static void _php_image_bw_convert(gdImagePtr im_org, gdIOCtx *out, int threshold)
-{
- gdImagePtr im_dest;
- int white, black;
- int color, color_org, median;
- int dest_height = gdImageSY(im_org);
- int dest_width = gdImageSX(im_org);
- int x, y;
- TSRMLS_FETCH();
-
- im_dest = gdImageCreate(dest_width, dest_height);
- if (im_dest == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate temporary buffer");
- return;
- }
-
- white = gdImageColorAllocate(im_dest, 255, 255, 255);
- if (white == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate the colors for the destination buffer");
- return;
- }
-
- black = gdImageColorAllocate(im_dest, 0, 0, 0);
- if (black == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate the colors for the destination buffer");
- return;
- }
-
- for (y = 0; y < dest_height; y++) {
- for (x = 0; x < dest_width; x++) {
- color_org = gdImageGetPixel(im_org, x, y);
- median = (im_org->red[color_org] + im_org->green[color_org] + im_org->blue[color_org]) / 3;
- if (median < threshold) {
- color = black;
- } else {
- color = white;
- }
- gdImageSetPixel (im_dest, x, y, color);
- }
- }
-#ifdef USE_GD_IOCTX
- gdImageWBMPCtx (im_dest, black, out);
-#else
- gdImageWBMP (im_dest, black, out);
-#endif
-
-}
-/* }}} */
-
-/* {{{ _php_image_convert
- * _php_image_convert converts jpeg/png images to wbmp and resizes them as needed */
-static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
-{
- zval **f_org, **f_dest, **height, **width, **threshold;
- gdImagePtr im_org, im_dest, im_tmp;
- char *fn_org = NULL;
- char *fn_dest = NULL;
- FILE *org, *dest;
- int argc = ZEND_NUM_ARGS();
- int dest_height = -1;
- int dest_width = -1;
- int org_height, org_width;
- int white, black;
- int color, color_org, median;
- int int_threshold;
- int x, y;
- float x_ratio, y_ratio;
-
- if (argc != 5 || zend_get_parameters_ex(argc, &f_org, &f_dest, &height, &width, &threshold) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(f_org);
- convert_to_string_ex(f_dest);
- convert_to_long_ex(height);
- convert_to_long_ex(width);
- convert_to_long_ex(threshold);
-
- fn_org = Z_STRVAL_PP(f_org);
- fn_dest = Z_STRVAL_PP(f_dest);
- dest_height = Z_LVAL_PP(height);
- dest_width = Z_LVAL_PP(width);
- int_threshold = Z_LVAL_PP(threshold);
-
- /* Check threshold value */
- if (int_threshold < 0 || int_threshold > 8) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'", int_threshold);
- RETURN_FALSE;
- }
-
- /* Check origin file */
- if (!fn_org || fn_org == empty_string || php_check_open_basedir(fn_org TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid origin filename '%s'", fn_org);
- RETURN_FALSE;
- }
-
- /* Check destination file */
- if (!fn_dest || fn_dest == empty_string || php_check_open_basedir(fn_dest TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid destination filename '%s'", fn_dest);
- RETURN_FALSE;
- }
-
- /* Open origin file */
- org = VCWD_FOPEN(fn_org, "rb");
- if (!org) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open '%s' for reading", fn_org);
- RETURN_FALSE;
- }
-
- /* Open destination file */
- dest = VCWD_FOPEN(fn_dest, "wb");
- if (!dest) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open '%s' for writing", fn_dest);
- RETURN_FALSE;
- }
-
- switch (image_type) {
-#ifdef HAVE_GD_GIF_READ
- case PHP_GDIMG_TYPE_GIF:
- im_org = gdImageCreateFromGif(org);
- if (im_org == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open '%s' Not a valid GIF file", fn_dest);
- RETURN_FALSE;
- }
- break;
-#endif /* HAVE_GD_GIF_READ */
-
-#ifdef HAVE_GD_JPG
- case PHP_GDIMG_TYPE_JPG:
- im_org = gdImageCreateFromJpeg(org);
- if (im_org == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open '%s' Not a valid JPEG file", fn_dest);
- RETURN_FALSE;
- }
- break;
-#endif /* HAVE_GD_JPG */
-
-
-#ifdef HAVE_GD_PNG
- case PHP_GDIMG_TYPE_PNG:
- im_org = gdImageCreateFromPng(org);
- if (im_org == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open '%s' Not a valid PNG file", fn_dest);
- RETURN_FALSE;
- }
- break;
-#endif /* HAVE_GD_PNG */
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Format not supported");
- RETURN_FALSE;
- break;
- }
-
- org_width = gdImageSX (im_org);
- org_height = gdImageSY (im_org);
-
- x_ratio = (float) org_width / (float) dest_width;
- y_ratio = (float) org_height / (float) dest_height;
-
- if (x_ratio > 1 && y_ratio > 1) {
- if (y_ratio > x_ratio) {
- x_ratio = y_ratio;
- } else {
- y_ratio = x_ratio;
- }
- dest_width = (int) (org_width / x_ratio);
- dest_height = (int) (org_height / y_ratio);
- } else {
- x_ratio = (float) dest_width / (float) org_width;
- y_ratio = (float) dest_height / (float) org_height;
-
- if (y_ratio < x_ratio) {
- x_ratio = y_ratio;
- } else {
- y_ratio = x_ratio;
- }
- dest_width = (int) (org_width * x_ratio);
- dest_height = (int) (org_height * y_ratio);
- }
-
- im_tmp = gdImageCreate (dest_width, dest_height);
- if (im_tmp == NULL ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate temporary buffer");
- RETURN_FALSE;
- }
-
- gdImageCopyResized (im_tmp, im_org, 0, 0, 0, 0, dest_width, dest_height, org_width, org_height);
-
- gdImageDestroy(im_org);
-
- fclose(org);
-
- im_dest = gdImageCreate(dest_width, dest_height);
- if (im_dest == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate destination buffer");
- RETURN_FALSE;
- }
-
- white = gdImageColorAllocate(im_dest, 255, 255, 255);
- if (white == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate the colors for the destination buffer");
- RETURN_FALSE;
- }
-
- black = gdImageColorAllocate(im_dest, 0, 0, 0);
- if (black == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate the colors for the destination buffer");
- RETURN_FALSE;
- }
-
- int_threshold = int_threshold * 32;
-
- for (y = 0; y < dest_height; y++) {
- for (x = 0; x < dest_width; x++) {
- color_org = gdImageGetPixel (im_tmp, x, y);
- median = (im_tmp->red[color_org] + im_tmp->green[color_org] + im_tmp->blue[color_org]) / 3;
- if (median < int_threshold) {
- color = black;
- } else {
- color = white;
- }
- gdImageSetPixel (im_dest, x, y, color);
- }
- }
-
- gdImageDestroy (im_tmp );
-
- gdImageWBMP(im_dest, black , dest);
-
- fflush(dest);
- fclose(dest);
-
- gdImageDestroy(im_dest);
-
- RETURN_TRUE;
-}
-/* }}} */
-#endif /* HAVE_GD_WBMP */
-
-#endif /* HAVE_LIBGD */
-
-/* Section Filters */
-#ifdef HAVE_GD_BUNDLED
-
-static void php_image_filter_negate(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval **SIM;
- gdImagePtr im_src;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(1, &SIM) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
-
- if (im_src == NULL) {
- RETURN_FALSE;
- }
-
- if (gdImageNegate(im_src) == 1) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-
-static void php_image_filter_grayscale(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval **SIM;
- gdImagePtr im_src;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(1, &SIM) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
-
- if (im_src == NULL) {
- RETURN_FALSE;
- }
-
- if (gdImageGrayScale(im_src) == 1) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-
-static void php_image_filter_brightness(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval *SIM;
- gdImagePtr im_src;
- long brightness, tmp;
-
- if (ZEND_NUM_ARGS() != 3 || zend_parse_parameters(3 TSRMLS_CC, "zll", &SIM, &tmp, &brightness) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);
-
- if (im_src == NULL) {
- RETURN_FALSE;
- }
-
- if (gdImageBrightness(im_src, (int)brightness) == 1) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-
-static void php_image_filter_contrast(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval *SIM;
- gdImagePtr im_src;
- long contrast, tmp;
-
- if (ZEND_NUM_ARGS() != 3 || zend_parse_parameters(3 TSRMLS_CC, "rll", &SIM, &tmp, &contrast) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);
-
- if (im_src == NULL) {
- RETURN_FALSE;
- }
-
- if (gdImageBrightness(im_src, (int)contrast) == 1) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-
-static void php_image_filter_colorize(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval *SIM;
- gdImagePtr im_src;
- long r,g,b,tmp;
-
- if (ZEND_NUM_ARGS() != 5 || zend_parse_parameters(5 TSRMLS_CC, "rllll", &SIM, &tmp, &r, &g, &b) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);
-
- if (im_src == NULL) {
- RETURN_FALSE;
- }
-
- if (gdImageColor(im_src, (int) r, (int) g, (int) b) == 1) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-
-static void php_image_filter_edgedetect(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval **SIM;
- gdImagePtr im_src;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(1, &SIM) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
-
- if (im_src == NULL) {
- RETURN_FALSE;
- }
-
- if (gdImageEdgeDetectQuick(im_src) == 1) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-
-static void php_image_filter_emboss(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval **SIM;
- gdImagePtr im_src;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(1, &SIM) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
-
- if (im_src == NULL) {
- RETURN_FALSE;
- }
-
- if (gdImageEmboss(im_src) == 1) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-
-static void php_image_filter_gaussian_blur(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval **SIM;
- gdImagePtr im_src;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(1, &SIM) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
-
- if (im_src == NULL) {
- RETURN_FALSE;
- }
-
- if (gdImageGaussianBlur(im_src) == 1) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-
-static void php_image_filter_selective_blur(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval **SIM;
- gdImagePtr im_src;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(1, &SIM) == FAILURE){
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
-
- if (im_src==NULL) {
- RETURN_FALSE;
- }
-
- if (gdImageSelectiveBlur(im_src) == 1) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-
-static void php_image_filter_mean_removal(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval **SIM;
- gdImagePtr im_src;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(1, &SIM) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
-
- if (im_src == NULL) {
- RETURN_FALSE;
- }
-
- if (gdImageMeanRemoval(im_src) == 1) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-
-static void php_image_filter_smooth(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval *SIM;
- long tmp;
- gdImagePtr im_src;
- double weight;
-
- if (ZEND_NUM_ARGS() != 3 || zend_parse_parameters(3 TSRMLS_CC, "rld", &SIM, &tmp, &weight) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);
-
- if (im_src == NULL) {
- RETURN_FALSE;
- }
-
- if (gdImageSmooth(im_src, (float)weight)==1) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-
-/* {{{ proto int imagefilter(int src_im, int filtertype, [args] )
- Applies Filter an image using a custom angle */
-PHP_FUNCTION(imagefilter)
-{
- zval *tmp;
-
- typedef void (*image_filter)(INTERNAL_FUNCTION_PARAMETERS);
- long filtertype;
- image_filter filters[] =
- {
- php_image_filter_negate ,
- php_image_filter_grayscale,
- php_image_filter_brightness,
- php_image_filter_contrast,
- php_image_filter_colorize,
- php_image_filter_edgedetect,
- php_image_filter_emboss,
- php_image_filter_gaussian_blur,
- php_image_filter_selective_blur,
- php_image_filter_mean_removal,
- php_image_filter_smooth
- };
-
- if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 5 || zend_parse_parameters(2 TSRMLS_CC, "rl", &tmp, &filtertype) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (filtertype >= 0 && filtertype <= IMAGE_FILTER_MAX) {
- filters[filtertype](INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
-}
-/* }}} */
-/* End section: Filters */
-
-/* {{{ proto bool imageantialias(int im, bool on)
- Should antialiased functions used or not*/
-PHP_FUNCTION(imageantialias)
-{
- zval **IM, **alias;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &alias) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_boolean_ex(alias);
- gdImageAntialias(im, Z_LVAL_PP(alias));
-
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/gd/gd.dsp b/ext/gd/gd.dsp
deleted file mode 100644
index 1bec282d8f..0000000000
--- a/ext/gd/gd.dsp
+++ /dev/null
@@ -1,596 +0,0 @@
-# Microsoft Developer Studio Project File - Name="gd" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=gd - Win32 Release_TS GD2
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "gd.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "gd.mak" CFG="gd - Win32 Release_TS GD2"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "gd - Win32 Release_TS GD2" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "gd - Win32 Debug_TS GD2" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "gd___Win32_Release_TS_GD2_bundled"
-# PROP BASE Intermediate_Dir "gd___Win32_Release_TS_GD2_bundled"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=0 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts.lib libjpeg.lib libpng.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gd2.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php4ts.lib freetype2.lib libjpeg.lib libpng.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gd2.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "gd___Win32_Debug_TS_GD2_bundled"
-# PROP BASE Intermediate_Dir "gd___Win32_Debug_TS_GD2_bundled"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=1 /D "HAVE_LIBGD15" /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts_debug.lib libjpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_gd2.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php4ts_debug.lib libpng.lib zlib.lib libjpeg.lib freetype2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_gd2.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "gd - Win32 Release_TS GD2"
-# Name "gd - Win32 Debug_TS GD2"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\gd.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\gdttf.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\gdcache.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\gdttf.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_gd.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Group "libgd"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 1"
-
-# PROP Default_Filter "*.c"
-# Begin Source File
-
-SOURCE=.\libgd\gd.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd2copypal.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_arc_f_buggy.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_gd.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_gd2.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_gif_in.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_io.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_io_dp.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_io_file.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_io_ss.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_jpeg.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_png.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_ss.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_topal.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_wbmp.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdcache.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontg.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontl.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontmb.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfonts.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontt.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdft.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdhelpers.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdkanji.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdtables.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdxpm.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\wbmp.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\xbm.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files No. 1"
-
-# PROP Default_Filter "*.h"
-# Begin Source File
-
-SOURCE=.\libgd\gd.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_io.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdcache.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontg.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontl.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontmb.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfonts.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontt.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdhelpers.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\jisx0208.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\wbmp.h
-# End Source File
-# End Group
-# End Group
-# End Target
-# End Project
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
deleted file mode 100644
index 89853c1e60..0000000000
--- a/ext/gd/gd_ctx.c
+++ /dev/null
@@ -1,114 +0,0 @@
-#include "php_gd.h"
-
-
-#define CTX_PUTC(c,ctx) ctx->putC(ctx, c)
-
-static void _php_image_output_putc(struct gdIOCtx *ctx, int c)
-{
- TSRMLS_FETCH();
- php_write(&c, 1 TSRMLS_CC);
-}
-
-static int _php_image_output_putbuf(struct gdIOCtx *ctx, const void* buf, int l)
-{
- TSRMLS_FETCH();
- return php_write((void *)buf, l TSRMLS_CC);
-}
-
-static void _php_image_output_ctxfree(struct gdIOCtx *ctx)
-{
- if(ctx) {
- efree(ctx);
- }
-}
-
-static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)())
-{
- zval **imgind, **file, **quality;
- gdImagePtr im;
- char *fn = NULL;
- FILE *fp = NULL;
- int argc = ZEND_NUM_ARGS();
- int q = -1, i;
- gdIOCtx *ctx;
-
- /* The quality parameter for Wbmp stands for the threshold when called from image2wbmp() */
-
- if (argc < 1 || argc > 3 || zend_get_parameters_ex(argc, &imgind, &file, &quality) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, imgind, -1, "Image", phpi_get_le_gd());
-
- if (argc > 1) {
- convert_to_string_ex(file);
- fn = Z_STRVAL_PP(file);
- if (argc == 3) {
- convert_to_long_ex(quality);
- q = Z_LVAL_PP(quality);
- }
- }
-
- if ((argc == 2) || (argc > 2 && Z_STRLEN_PP(file))) {
- if (!fn || fn == empty_string || php_check_open_basedir(fn TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid filename '%s'", fn);
- RETURN_FALSE;
- }
-
- fp = VCWD_FOPEN(fn, "wb");
- if (!fp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open '%s' for writing", fn);
- RETURN_FALSE;
- }
-
- ctx = gdNewFileCtx(fp);
- } else {
- ctx = emalloc(sizeof(gdIOCtx));
- ctx->putC = _php_image_output_putc;
- ctx->putBuf = _php_image_output_putbuf;
-#if HAVE_LIBGD204
- ctx->gd_free = _php_image_output_ctxfree;
-#else
- ctx->free = _php_image_output_ctxfree;
-#endif
-
-#if APACHE && defined(CHARSET_EBCDIC)
- /* XXX this is unlikely to work any more thies@thieso.net */
- /* This is a binary file already: avoid EBCDIC->ASCII conversion */
- ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0);
-#endif
- }
-
- switch(image_type) {
- case PHP_GDIMG_CONVERT_WBM:
- if(q<0||q>255) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
- }
- case PHP_GDIMG_TYPE_JPG:
- (*func_p)(im, ctx, q);
- break;
- case PHP_GDIMG_TYPE_WBM:
- for(i=0; i < gdImageColorsTotal(im); i++) {
- if(gdImageRed(im, i) == 0) break;
- }
- (*func_p)(im, i, ctx);
- break;
- default:
- (*func_p)(im, ctx);
- break;
- }
-
-#if HAVE_LIBGD204
- ctx->gd_free(ctx);
-#else
- ctx->free(ctx);
-#endif
-
- if(fp) {
- fflush(fp);
- fclose(fp);
- }
-
- RETURN_TRUE;
-}
diff --git a/ext/gd/gdcache.c b/ext/gd/gdcache.c
deleted file mode 100644
index e3ff9b83ad..0000000000
--- a/ext/gd/gdcache.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * $Id$
- *
- * Caches of pointers to user structs in which the least-recently-used
- * element is replaced in the event of a cache miss after the cache has
- * reached a given size.
- *
- * John Ellson (ellson@lucent.com) Oct 31, 1997
- *
- * Test this with:
- * gcc -o gdcache -g -Wall -DTEST gdcache.c
- *
- * The cache is implemented by a singly-linked list of elements
- * each containing a pointer to a user struct that is being managed by
- * the cache.
- *
- * The head structure has a pointer to the most-recently-used
- * element, and elements are moved to this position in the list each
- * time they are used. The head also contains pointers to three
- * user defined functions:
- * - a function to test if a cached userdata matches some keydata
- * - a function to provide a new userdata struct to the cache
- * if there has been a cache miss.
- * - a function to release a userdata struct when it is
- * no longer being managed by the cache
- *
- * In the event of a cache miss the cache is allowed to grow up to
- * a specified maximum size. After the maximum size is reached then
- * the least-recently-used element is discarded to make room for the
- * new. The most-recently-returned value is always left at the
- * beginning of the list after retrieval.
- *
- * In the current implementation the cache is traversed by a linear
- * search from most-recent to least-recent. This linear search
- * probably limits the usefulness of this implementation to cache
- * sizes of a few tens of elements.
- */
-
-#include "php.h"
-
-/* This just seems unessacary */
-#if PHP_WIN32
-#define ENABLE_GD_TTF
-#else
-#include "php_config.h"
-#endif
-#if (HAVE_LIBTTF | HAVE_LIBFREETYPE) && !defined(HAVE_GD_CACHE_CREATE)
-
-#include "gdcache.h"
-
-/*********************************************************/
-/* implementation */
-/*********************************************************/
-
-
-/* create a new cache */
-gdCache_head_t *
-gdCacheCreate(
- int size,
- gdCacheTestFn_t gdCacheTest,
- gdCacheFetchFn_t gdCacheFetch,
- gdCacheReleaseFn_t gdCacheRelease )
-{
- gdCache_head_t *head;
-
- head = (gdCache_head_t *)pemalloc(sizeof(gdCache_head_t), 1);
- head->mru = NULL;
- head->size = size;
- head->gdCacheTest = gdCacheTest;
- head->gdCacheFetch = gdCacheFetch;
- head->gdCacheRelease = gdCacheRelease;
- return head;
-}
-
-void
-gdCacheDelete( gdCache_head_t *head )
-{
- gdCache_element_t *elem, *prev;
-
- elem = head->mru;
- while(elem) {
- (*(head->gdCacheRelease))(elem->userdata);
- prev = elem;
- elem = elem->next;
- pefree((char *)prev, 1);
- }
- pefree((char *)head, 1);
-}
-
-void *
-gdCacheGet( gdCache_head_t *head, void *keydata )
-{
- int i=0;
- gdCache_element_t *elem, *prev = NULL, *prevprev = NULL;
- void *userdata;
-
- elem = head->mru;
- while(elem) {
- if ((*(head->gdCacheTest))(elem->userdata, keydata)) {
- if (i) { /* if not already most-recently-used */
- /* relink to top of list */
- prev->next = elem->next;
- elem->next = head->mru;
- head->mru = elem;
- }
- return elem->userdata;
- }
- prevprev = prev;
- prev = elem;
- elem = elem->next;
- i++;
- }
- userdata = (*(head->gdCacheFetch))(&(head->error), keydata);
- if (! userdata) {
- /* if there was an error in the fetch then don't cache */
- return NULL;
- }
- if (i < head->size) { /* cache still growing - add new elem */
- elem = (gdCache_element_t *)pemalloc(sizeof(gdCache_element_t), 1);
- }
- else { /* cache full - replace least-recently-used */
- /* preveprev becomes new end of list */
- prevprev->next = NULL;
- elem = prev;
- (*(head->gdCacheRelease))(elem->userdata);
- }
- /* relink to top of list */
- elem->next = head->mru;
- head->mru = elem;
- elem->userdata = userdata;
- return userdata;
-}
-
-
-
-/*********************************************************/
-/* test stub */
-/*********************************************************/
-
-
-#ifdef GDCACHE_TEST
-
-#include <stdio.h>
-
-typedef struct {
- int key;
- int value;
-} key_value_t;
-
-static int
-cacheTest( void *map, void *key )
-{
- return (((key_value_t *)map)->key == *(int *)key);
-}
-
-static void *
-cacheFetch( char **error, void *key )
-{
- key_value_t *map;
-
- map = (key_value_t *)malloc(sizeof(key_value_t));
- map->key = *(int *)key;
- map->value = 3;
-
- *error = NULL;
- return (void *)map;
-}
-
-static void
-cacheRelease( void *map)
-{
- free( (char *)map );
-}
-
-int
-main(char *argv[], int argc)
-{
- gdCache_head_t *cacheTable;
- int elem, key;
-
- cacheTable = gdCacheCreate(3, cacheTest, cacheFetch, cacheRelease);
-
- key = 20;
- elem = *(int *)gdCacheGet(cacheTable, &key);
- key = 30;
- elem = *(int *)gdCacheGet(cacheTable, &key);
- key = 40;
- elem = *(int *)gdCacheGet(cacheTable, &key);
- key = 50;
- elem = *(int *)gdCacheGet(cacheTable, &key);
- key = 30;
- elem = *(int *)gdCacheGet(cacheTable, &key);
- key = 30;
- elem = *(int *)gdCacheGet(cacheTable, &key);
-
- gdCacheDelete(cacheTable);
-
- return 0;
-}
-
-#endif
-
-#endif /* ENABLE_GD_TTF */
diff --git a/ext/gd/gdcache.h b/ext/gd/gdcache.h
deleted file mode 100644
index 87ab305aba..0000000000
--- a/ext/gd/gdcache.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * $Id$
- *
- * Caches of pointers to user structs in which the least-recently-used
- * element is replaced in the event of a cache miss after the cache has
- * reached a given size.
- *
- * John Ellson (ellson@lucent.com) Oct 31, 1997
- *
- * Test this with:
- * gcc -o gdcache -g -Wall -DTEST gdcache.c
- *
- * The cache is implemented by a singly-linked list of elements
- * each containing a pointer to a user struct that is being managed by
- * the cache.
- *
- * The head structure has a pointer to the most-recently-used
- * element, and elements are moved to this position in the list each
- * time they are used. The head also contains pointers to three
- * user defined functions:
- * - a function to test if a cached userdata matches some keydata
- * - a function to provide a new userdata struct to the cache
- * if there has been a cache miss.
- * - a function to release a userdata struct when it is
- * no longer being managed by the cache
- *
- * In the event of a cache miss the cache is allowed to grow up to
- * a specified maximum size. After the maximum size is reached then
- * the least-recently-used element is discarded to make room for the
- * new. The most-recently-returned value is always left at the
- * beginning of the list after retrieval.
- *
- * In the current implementation the cache is traversed by a linear
- * search from most-recent to least-recent. This linear search
- * probably limits the usefulness of this implementation to cache
- * sizes of a few tens of elements.
- */
-
-/*********************************************************/
-/* header */
-/*********************************************************/
-
-#if (!defined(_OSD_POSIX) && !defined(__FreeBSD__)) && HAVE_MALLOC_H
-#include <malloc.h>
-#else
-#include <stdlib.h> /* BS2000/OSD defines malloc() & friends in stdlib.h */
-#endif
-#ifndef NULL
-#define NULL (void *)0
-#endif
-
-/* user defined function templates */
-typedef int (*gdCacheTestFn_t)(void *userdata, void *keydata);
-typedef void *(*gdCacheFetchFn_t)(char **error, void *keydata);
-typedef void (*gdCacheReleaseFn_t)(void *userdata);
-
-/* element structure */
-typedef struct gdCache_element_s gdCache_element_t;
-struct gdCache_element_s {
- gdCache_element_t *next;
- void *userdata;
-};
-
-/* head structure */
-typedef struct gdCache_head_s gdCache_head_t;
-struct gdCache_head_s {
- gdCache_element_t *mru;
- int size;
- char *error;
- gdCacheTestFn_t gdCacheTest;
- gdCacheFetchFn_t gdCacheFetch;
- gdCacheReleaseFn_t gdCacheRelease;
-};
-
-/* function templates */
-gdCache_head_t *
-gdCacheCreate(
- int size,
- gdCacheTestFn_t gdCacheTest,
- gdCacheFetchFn_t gdCacheFetch,
- gdCacheReleaseFn_t gdCacheRelease );
-
-void
-gdCacheDelete( gdCache_head_t *head );
-
-void *
-gdCacheGet( gdCache_head_t *head, void *keydata );
diff --git a/ext/gd/gdttf.c b/ext/gd/gdttf.c
deleted file mode 100644
index 4ff659cada..0000000000
--- a/ext/gd/gdttf.c
+++ /dev/null
@@ -1,879 +0,0 @@
-/* gd interface to freetype library */
-/* */
-/* John Ellson ellson@lucent.com */
-
-/* $Id$ */
-
-#include "php.h"
-
-#if PHP_WIN32
-#include "config.w32.h"
-#else
-#include "php_config.h"
-#endif
-#if HAVE_LIBTTF && !defined(USE_GD_IMGSTRTTF)
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <gd.h>
-#include "gdttf.h"
-#include "gdcache.h"
-#include <freetype.h>
-
-#ifndef HAVE_GDIMAGECOLORRESOLVE
-extern int gdImageColorResolve(gdImagePtr, int, int, int);
-#endif
-
-/* number of fonts cached before least recently used is replaced */
-#define FONTCACHESIZE 6
-
-/* number of character glyphs cached per font before
- least-recently-used is replaced */
-#define GLYPHCACHESIZE 120
-
-/* number of bitmaps cached per glyph before
- least-recently-used is replaced */
-#define BITMAPCACHESIZE 8
-
-/* number of antialias color lookups cached */
-#define TWEENCOLORCACHESIZE 32
-
-/* ptsize below which anti-aliasing is ineffective */
-#define MINANTIALIASPTSIZE 0
-
-/* display resolution - (Not really. This has to be 72 or hinting is wrong) */
-#define RESOLUTION 72
-
-/* Number of colors used for anti-aliasing */
-#undef NUMCOLORS
-#define NUMCOLORS 4
-
-/* Line separation as a factor of font height.
- No space between if LINESPACE = 1.00
- Line separation will be rounded up to next pixel row*/
-#define LINESPACE 1.05
-
-#ifndef TRUE
-#define FALSE 0
-#define TRUE !FALSE
-#endif
-
-#ifndef MAX
-#define MAX(a, b) ((a)>(b)?(a):(b))
-#endif
-#ifndef MIN
-#define MIN(a, b) ((a)<(b)?(a):(b))
-#endif
-
-typedef struct {
- char *fontname; /* key */
- double ptsize; /* key */
- double angle; /* key */
- double sin_a, cos_a;
- TT_Engine *engine;
- TT_Face face;
- TT_Face_Properties properties;
- TT_Instance instance;
- TT_CharMap char_map_Unicode;
- TT_CharMap char_map_Big5;
- TT_CharMap char_map_Roman;
- int have_char_map_Unicode;
- int have_char_map_Big5;
- int have_char_map_Roman;
- TT_Matrix matrix;
- TT_Instance_Metrics imetrics;
- gdCache_head_t *glyphCache;
-} font_t;
-
-typedef struct {
- char *fontname; /* key */
- double ptsize; /* key */
- double angle; /* key */
- TT_Engine *engine;
-} fontkey_t;
-
-typedef struct {
- int character; /* key */
- int hinting; /* key */
- TT_Glyph glyph;
- TT_Glyph_Metrics metrics;
- TT_Outline outline;
- TT_Pos oldx, oldy;
- TT_Raster_Map Bit;
- int gray_render;
- int xmin, xmax, ymin, ymax;
- gdCache_head_t *bitmapCache;
-} glyph_t;
-
-typedef struct {
- int character; /* key */
- int hinting; /* key */
- int gray_render;
- font_t *font;
-} glyphkey_t;
-
-typedef struct {
- int xoffset; /* key */
- int yoffset; /* key */
- char *bitmap;
-} bitmap_t;
-
-typedef struct {
- int xoffset; /* key */
- int yoffset; /* key */
- glyph_t *glyph;
-} bitmapkey_t;
-
-typedef struct {
- unsigned char pixel; /* key */
- unsigned char bgcolor; /* key */
- int fgcolor; /* key */ /* -ve means no antialias */
- gdImagePtr im; /* key */
- unsigned char tweencolor;
-} tweencolor_t;
-
-typedef struct {
- unsigned char pixel; /* key */
- unsigned char bgcolor; /* key */
- int fgcolor; /* key */ /* -ve means no antialias */
- gdImagePtr im; /* key */
-} tweencolorkey_t;
-
-/* forward declarations so that glyphCache can be initialized by font code */
-static int glyphTest ( void *element, void *key );
-static void *glyphFetch ( char **error, void *key );
-static void glyphRelease( void *element );
-
-/* forward declarations so that bitmapCache can be initialized by glyph code */
-static int bitmapTest ( void *element, void *key );
-static void *bitmapFetch ( char **error, void *key );
-static void bitmapRelease( void *element );
-
-/* local prototype */
-char *gdttfchar(gdImage *im, int fg, font_t *font, int x, int y, TT_F26Dot6 x1, TT_F26Dot6 y1, TT_F26Dot6 *advance, TT_BBox **bbox, char **next);
-
-
-
-/********************************************************************
- * gdTcl_UtfToUniChar is borrowed from ...
- */
-/*
- * tclUtf.c --
- *
- * Routines for manipulating UTF-8 strings.
- *
- * Copyright (c) 1997-1998 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * SCCS: @(#) tclUtf.c 1.25 98/01/28 18:02:43
- */
-
-/*
- *---------------------------------------------------------------------------
- *
- * gdTcl_UtfToUniChar --
- *
- * Extract the Tcl_UniChar represented by the UTF-8 string. Bad
- * UTF-8 sequences are converted to valid Tcl_UniChars and processing
- * continues. Equivalent to Plan 9 chartorune().
- *
- * The caller must ensure that the source buffer is long enough that
- * this routine does not run off the end and dereference non-existent
- * memory looking for trail bytes. If the source buffer is known to
- * be '\0' terminated, this cannot happen. Otherwise, the caller
- * should call Tcl_UtfCharComplete() before calling this routine to
- * ensure that enough bytes remain in the string.
- *
- * Results:
- * *chPtr is filled with the Tcl_UniChar, and the return value is the
- * number of bytes from the UTF-8 string that were consumed.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-#ifndef CHARSET_EBCDIC
-#define ASC(ch) (ch)
-#else /*CHARSET_EBCDIC*/
-#define ASC(ch) os_toascii[(unsigned char) (ch)]
-#endif /*CHARSET_EBCDIC*/
-
-#define Tcl_UniChar int
-#define TCL_UTF_MAX 3
-static int
-gdTcl_UtfToUniChar(char *str, Tcl_UniChar *chPtr)
-/* str is the UTF8 next character pointer */
-/* chPtr is the int for the result */
-{
- int byte;
-
- /* HTML4.0 entities in decimal form, e.g. &#197; */
- byte = *((unsigned char *) str);
- if (byte == '&') {
- int i, n=0;
-
- byte = *((unsigned char *) (str+1));
- if (byte == '#') {
- for (i = 2; i < 8; i++) {
- byte = *((unsigned char *) (str+i));
- if (byte >= '0' && byte <= '9') {
- n = (n * 10) + (byte - '0');
- }
- else
- break;
- }
- if (byte == ';') {
- *chPtr = (Tcl_UniChar) n;
- return ++i;
- }
- }
- }
-
- /*
- * Unroll 1 to 3 byte UTF-8 sequences, use loop to handle longer ones.
- */
-
- byte = ASC(*((unsigned char *) str));
- if (byte < 0xC0) {
- /*
- * Handles properly formed UTF-8 characters between 0x01 and 0x7F.
- * Also treats \0 and naked trail bytes 0x80 to 0xBF as valid
- * characters representing themselves.
- */
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
- } else if (byte < 0xE0) {
- if ((ASC(str[1]) & 0xC0) == 0x80) {
- /*
- * Two-byte-character lead-byte followed by a trail-byte.
- */
-
- *chPtr = (Tcl_UniChar) (((byte & 0x1F) << 6) | (ASC(str[1]) & 0x3F));
- return 2;
- }
- /*
- * A two-byte-character lead-byte not followed by trail-byte
- * represents itself.
- */
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
- } else if (byte < 0xF0) {
- if (((ASC(str[1]) & 0xC0) == 0x80) && ((ASC(str[2]) & 0xC0) == 0x80)) {
- /*
- * Three-byte-character lead byte followed by two trail bytes.
- */
-
- *chPtr = (Tcl_UniChar) (((byte & 0x0F) << 12)
- | ((ASC(str[1]) & 0x3F) << 6) | (ASC(str[2]) & 0x3F));
- return 3;
- }
- /*
- * A three-byte-character lead-byte not followed by two trail-bytes
- * represents itself.
- */
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
- }
-#if TCL_UTF_MAX > 3
- else {
- int ch, total, trail;
-
- total = totalBytes[byte];
- trail = total - 1;
- if (trail > 0) {
- ch = byte & (0x3F >> trail);
- do {
- str++;
- if ((ASC(*str) & 0xC0) != 0x80) {
- *chPtr = byte;
- return 1;
- }
- ch <<= 6;
- ch |= (ASC(*str) & 0x3F);
- trail--;
- } while (trail > 0);
- *chPtr = ch;
- return total;
- }
- }
-#endif
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
-}
-
-/********************************************************************/
-/* font cache functions */
-
-static int
-fontTest ( void *element, void *key )
-{
- font_t *a=(font_t *)element;
- fontkey_t *b=(fontkey_t *)key;
-
- return ( strcmp(a->fontname, b->fontname) == 0
- && a->ptsize == b->ptsize
- && a->angle == b->angle);
-}
-
-static void *
-fontFetch ( char **error, void *key )
-{
- TT_Error err;
- font_t *a;
- fontkey_t *b=(fontkey_t *)key;
- int i, n, map_found;
- short platform, encoding;
- TSRMLS_FETCH();
-
- a = (font_t *)pemalloc(sizeof(font_t), 1);
-#ifdef VIRTUAL_DIR
- /* a->fontname will be freed in fontRelease() later on */
- if (virtual_filepath(b->fontname, &a->fontname TSRMLS_CC)) {
- *error = "Could not find/open font";
- pefree(a, 1);
- return NULL;
- }
-#else
- a->fontname = (char *)pemalloc(strlen(b->fontname) + 1, 1);
- strcpy(a->fontname, b->fontname);
-#endif
- a->ptsize = b->ptsize;
- a->angle = b->angle;
- a->sin_a = sin(a->angle);
- a->cos_a = cos(a->angle);
- a->engine = b->engine;
- if ((err = TT_Open_Face(*b->engine, a->fontname, &a->face))) {
- if (err == TT_Err_Could_Not_Open_File) {
- *error = "Could not find/open font";
- }
- else {
- *error = "Could not read font";
- }
- pefree(a, 1);
- return NULL;
- }
- /* get face properties and allocate preload arrays */
- TT_Get_Face_Properties(a->face, &a->properties);
-
- /* create instance */
- if (TT_New_Instance(a->face, &a->instance)) {
- *error = "Could not create face instance";
- pefree(a, 1);
- return NULL;
- }
-
- if (TT_Set_Instance_Resolutions(a->instance, RESOLUTION, RESOLUTION)) {
- *error = "Could not set device resolutions";
- pefree(a, 1);
- return NULL;
- }
-
- if (TT_Set_Instance_CharSize(a->instance, (TT_F26Dot6)(a->ptsize*64))) {
- *error = "Could not set character size";
- pefree(a, 1);
- return NULL;
- }
-
- TT_Get_Instance_Metrics(a->instance, &a->imetrics);
-
- /* First, look for a Unicode charmap */
- n = TT_Get_CharMap_Count(a->face);
-
- for (i = 0; i < n; i++) {
- TT_Get_CharMap_ID(a->face, i, &platform, &encoding);
- if ((platform == 3 && encoding == 1) /* Windows Unicode */
- || (platform == 2 && encoding == 1)
- || (platform == 0)) { /* ?? Unicode */
- TT_Get_CharMap(a->face, i, &a->char_map_Unicode);
- a->have_char_map_Unicode = 1;
- map_found++;
- } else if (platform == 3 && encoding == 4) { /* Windows Big5 */
- TT_Get_CharMap(a->face, i, &a->char_map_Big5);
- a->have_char_map_Big5 = 1;
- map_found++;
- } else if (platform == 1 && encoding == 0) { /* Apple Roman */
- TT_Get_CharMap(a->face, i, &a->char_map_Roman);
- a->have_char_map_Roman = 1;
- map_found++;
- }
- }
-
- if (! map_found) {
- *error = "Unable to find a CharMap that I can handle";
- pefree(a, 1);
- return NULL;
- }
-
- a->matrix.xx = (TT_Fixed) (a->cos_a * (1<<16));
- a->matrix.yx = (TT_Fixed) (a->sin_a * (1<<16));
- a->matrix.xy = - a->matrix.yx;
- a->matrix.yy = a->matrix.xx;
-
- a->glyphCache = gdCacheCreate( GLYPHCACHESIZE,
- glyphTest, glyphFetch, glyphRelease);
-
- return (void *)a;
-}
-
-static void
-fontRelease( void *element )
-{
- font_t *a=(font_t *)element;
-
- gdCacheDelete(a->glyphCache);
- TT_Done_Instance(a->instance);
- TT_Close_Face(a->face);
- pefree(a->fontname, 1);
- pefree((char *)element, 1);
-}
-
-/********************************************************************/
-/* glyph cache functions */
-
-static int
-glyphTest ( void *element, void *key )
-{
- glyph_t *a=(glyph_t *)element;
- glyphkey_t *b=(glyphkey_t *)key;
-
- return (a->character == b->character
- && a->hinting == b->hinting
- && a->gray_render == b->gray_render);
-}
-
-static void *
-glyphFetch ( char **error, void *key )
-{
- glyph_t *a;
- glyphkey_t *b=(glyphkey_t *)key;
- short glyph_code;
- int flags, err;
- int crect[8], xmin, xmax, ymin, ymax;
- double cos_a, sin_a;
-
- a = (glyph_t *)pemalloc(sizeof(glyph_t), 1);
- a->character = b->character;
- a->hinting = b->hinting;
- a->gray_render = b->gray_render;
- a->oldx = a->oldy = 0;
-
- /* create glyph container */
- if ((TT_New_Glyph(b->font->face, &a->glyph))) {
- *error = "Could not create glyph container";
- pefree(a, 1);
- return NULL;
- }
-
- flags = TTLOAD_SCALE_GLYPH;
- if (a->hinting && b->font->angle == 0.0) {
- flags |= TTLOAD_HINT_GLYPH;
- }
- if (b->font->have_char_map_Unicode) {
- glyph_code = TT_Char_Index(b->font->char_map_Unicode, a->character);
- } else if (a->character < 161 && b->font->have_char_map_Roman) {
- glyph_code = TT_Char_Index(b->font->char_map_Roman, a->character);
- } else if ( b->font->have_char_map_Big5) {
- glyph_code = TT_Char_Index(b->font->char_map_Big5, a->character);
- }
- if ((err=TT_Load_Glyph(b->font->instance, a->glyph, glyph_code, flags))) {
- *error = "TT_Load_Glyph problem";
- pefree(a, 1);
- return NULL;
- }
-
- TT_Get_Glyph_Metrics(a->glyph, &a->metrics);
- if (b->font->angle != 0.0) {
- TT_Get_Glyph_Outline(a->glyph, &a->outline);
- TT_Transform_Outline(&a->outline, &b->font->matrix);
- }
-
- /* calculate bitmap size */
- xmin = a->metrics.bbox.xMin -64;
- ymin = a->metrics.bbox.yMin -64;
- xmax = a->metrics.bbox.xMax +64;
- ymax = a->metrics.bbox.yMax +64;
-
- cos_a = b->font->cos_a;
- sin_a = b->font->sin_a;
- crect[0] = (int)(xmin * cos_a - ymin * sin_a);
- crect[1] = (int)(xmin * sin_a + ymin * cos_a);
- crect[2] = (int)(xmax * cos_a - ymin * sin_a);
- crect[3] = (int)(xmax * sin_a + ymin * cos_a);
- crect[4] = (int)(xmax * cos_a - ymax * sin_a);
- crect[5] = (int)(xmax * sin_a + ymax * cos_a);
- crect[6] = (int)(xmin * cos_a - ymax * sin_a);
- crect[7] = (int)(xmin * sin_a + ymax * cos_a);
- a->xmin = MIN(MIN(crect[0], crect[2]), MIN(crect[4], crect[6]));
- a->xmax = MAX(MAX(crect[0], crect[2]), MAX(crect[4], crect[6]));
- a->ymin = MIN(MIN(crect[1], crect[3]), MIN(crect[5], crect[7]));
- a->ymax = MAX(MAX(crect[1], crect[3]), MAX(crect[5], crect[7]));
-
- /* allocate bitmap large enough for character */
- a->Bit.rows = (a->ymax - a->ymin + 32 + 64) / 64;
- a->Bit.width = (a->xmax - a->xmin + 32 + 64) / 64;
- a->Bit.flow = TT_Flow_Up;
- if (a->gray_render) {
- a->Bit.cols = a->Bit.width; /* 1 byte per pixel */
- }
- else {
- a->Bit.cols = (a->Bit.width + 7) / 8; /* 1 bit per pixel */
- }
- a->Bit.cols = (a->Bit.cols + 3) & ~3; /* pad to 32 bits */
- a->Bit.size = a->Bit.rows * a->Bit.cols; /* # of bytes in buffer */
- a->Bit.bitmap = NULL;
-
- a->bitmapCache = gdCacheCreate( BITMAPCACHESIZE,
- bitmapTest, bitmapFetch, bitmapRelease);
-
- return (void *)a;
-}
-
-static void
-glyphRelease( void *element )
-{
- glyph_t *a=(glyph_t *)element;
-
- gdCacheDelete(a->bitmapCache);
- TT_Done_Glyph( a->glyph );
- pefree ((char *)element, 1);
-}
-
-/********************************************************************/
-/* bitmap cache functions */
-
-static int
-bitmapTest ( void *element, void *key )
-{
- bitmap_t *a=(bitmap_t *)element;
- bitmapkey_t *b=(bitmapkey_t *)key;
-
- if (a->xoffset == b->xoffset && a->yoffset == b->yoffset) {
- b->glyph->Bit.bitmap = a->bitmap;
- return TRUE;
- }
- return FALSE;
-}
-
-static void *
-bitmapFetch ( char **error, void *key )
-{
- bitmap_t *a;
- bitmapkey_t *b=(bitmapkey_t *)key;
-
- a = (bitmap_t *)pemalloc(sizeof(bitmap_t), 1);
- a->xoffset = b->xoffset;
- a->yoffset = b->yoffset;
-
- b->glyph->Bit.bitmap = a->bitmap = (char *)pemalloc(b->glyph->Bit.size, 1);
- memset(a->bitmap, 0, b->glyph->Bit.size);
- /* render glyph */
- if (b->glyph->gray_render) {
- TT_Get_Glyph_Pixmap(b->glyph->glyph, &b->glyph->Bit,
- a->xoffset, a->yoffset);
- }
- else {
- TT_Get_Glyph_Bitmap(b->glyph->glyph, &b->glyph->Bit,
- a->xoffset, a->yoffset);
- }
- return (void *)a;
-}
-
-static void
-bitmapRelease( void *element )
-{
- bitmap_t *a=(bitmap_t *)element;
-
- pefree (a->bitmap, 1);
- pefree ((char *)element, 1);
-}
-
-/********************************************************************/
-/* tweencolor cache functions */
-
-static int
-tweenColorTest (void *element, void *key)
-{
- tweencolor_t *a=(tweencolor_t *)element;
- tweencolorkey_t *b=(tweencolorkey_t *)key;
-
- return (a->pixel == b->pixel
- && a->bgcolor == b->bgcolor
- && a->fgcolor == b->fgcolor
- && a->im == b->im);
-}
-
-static void *
-tweenColorFetch (char **error, void *key)
-{
- tweencolor_t *a;
- tweencolorkey_t *b=(tweencolorkey_t *)key;
- int pixel, npixel, bg, fg;
- gdImagePtr im;
-
- a = (tweencolor_t *)pemalloc(sizeof(tweencolor_t), 1);
- pixel = a->pixel = b->pixel;
- bg = a->bgcolor = b->bgcolor;
- fg = a->fgcolor = b->fgcolor;
- im = b->im;
-
- /* if fg is specified by a negative color idx, then don't antialias */
- if (fg <0) {
- a->tweencolor = -fg;
- } else {
- npixel = NUMCOLORS - pixel;
- a->tweencolor = gdImageColorResolve(im,
- (pixel * im->red [fg] + npixel * im->red [bg]) / NUMCOLORS,
- (pixel * im->green[fg] + npixel * im->green[bg]) / NUMCOLORS,
- (pixel * im->blue [fg] + npixel * im->blue [bg]) / NUMCOLORS);
- }
- *error = NULL;
- return (void *)a;
-}
-
-static void
-tweenColorRelease(void *element)
-{
- pefree((char *)element, 1);
-}
-
-/********************************************************************/
-/* gdttfchar - render one character onto a gd image */
-
-static int OneTime=0;
-static gdCache_head_t *tweenColorCache;
-
-char *
-gdttfchar(gdImage *im, int fg, font_t *font,
- int x, int y, /* string start pos in pixels */
- TT_F26Dot6 x1, TT_F26Dot6 y1, /* char start offset (*64) from x,y */
- TT_F26Dot6 *advance,
- TT_BBox **bbox,
- char **next)
-{
- int pc, ch, len;
- int row, col;
- int x2, y2; /* char start pos in pixels */
- int x3, y3; /* current pixel pos */
- unsigned char *pixel;
-
- glyph_t *glyph;
- glyphkey_t glyphkey;
- bitmapkey_t bitmapkey;
- tweencolor_t *tweencolor;
- tweencolorkey_t tweencolorkey;
-
- /****** set up tweenColorCache on first call ************/
- if (! OneTime) {
- tweenColorCache = gdCacheCreate(TWEENCOLORCACHESIZE,
- tweenColorTest, tweenColorFetch, tweenColorRelease);
- OneTime++;
- }
- /**************/
-
- if (font->have_char_map_Unicode) { /* use UTF-8 mapping from ASCII */
- len = gdTcl_UtfToUniChar(*next, &ch);
- *next += len;
- } else {
- /*
- * Big 5 mapping:
- * use "JIS-8 half-width katakana" coding from 8-bit characters. Ref:
- * ftp://ftp.ora.com/pub/examples/nutshell/ujip/doc/japan.inf-032092.sjs
- */
- ch = (**next) & 255; /* don't extend sign */
- (*next)++;
- if (ch >= 161 /* first code of JIS-8 pair */
- && **next) { /* don't advance past '\0' */
- ch = (ch * 256) + **next;
- (*next)++;
- }
- }
-
- glyphkey.character = ch;
- glyphkey.hinting = 1;
- /* if fg is specified by a negative color idx, then don't antialias */
- glyphkey.gray_render = ((font->ptsize < MINANTIALIASPTSIZE) || (fg <0))?FALSE:TRUE;
- glyphkey.font = font;
- glyph = (glyph_t *)gdCacheGet(font->glyphCache, &glyphkey);
- if (! glyph)
- return font->glyphCache->error;
-
- *bbox = &glyph->metrics.bbox;
- *advance = glyph->metrics.advance;
-
- /* if null *im, or invalid color, then assume user just wants brect */
- if (!im || fg > 255 || fg < -255)
- return (char *)NULL;
-
- /* render (via cache) a bitmap for the current fractional offset */
- bitmapkey.xoffset = ((x1+32) & 63) - 32 - ((glyph->xmin+32) & -64);
- bitmapkey.yoffset = ((y1+32) & 63) - 32 - ((glyph->ymin+32) & -64);
- bitmapkey.glyph = glyph;
- gdCacheGet(glyph->bitmapCache, &bitmapkey);
-
- /* copy to gif, mapping colors */
- x2 = x + (((glyph->xmin+32) & -64) + ((x1+32) & -64)) / 64;
- y2 = y - (((glyph->ymin+32) & -64) + ((y1+32) & -64)) / 64;
- tweencolorkey.fgcolor = fg;
- tweencolorkey.im = im;
- for (row = 0; row < glyph->Bit.rows; row++) {
- if (glyph->gray_render)
- pc = row * glyph->Bit.cols;
- else
- pc = row * glyph->Bit.cols * 8;
- y3 = y2 - row;
- if (y3 >= im->sy || y3 < 0) continue;
- for (col = 0; col < glyph->Bit.width; col++, pc++) {
- if (glyph->gray_render) {
- tweencolorkey.pixel =
- *((unsigned char *)(glyph->Bit.bitmap) + pc);
- } else {
- tweencolorkey.pixel =
- (((*((unsigned char *)(glyph->Bit.bitmap) + pc/8))
- <<(pc%8))&128)?4:0;
- }
- /* if not background */
- if (tweencolorkey.pixel > 0) {
- x3 = x2 + col;
- if (x3 >= im->sx || x3 < 0) continue;
-#if HAVE_LIBGD20
- if (im->trueColor) {
- pixel = &im->tpixels[y3][x3];
- } else
-#endif
- {
-#if HAVE_LIBGD13
- pixel = &im->pixels[y3][x3];
-#else
- pixel = &im->pixels[x3][y3];
-#endif
- }
- tweencolorkey.bgcolor = *pixel;
- tweencolor = (tweencolor_t *)gdCacheGet(
- tweenColorCache, &tweencolorkey);
- *pixel = tweencolor->tweencolor;
- }
- }
- }
- return (char *)NULL;
-}
-
-/********************************************************************/
-/* gdttf - render a utf8 string onto a gd image */
-
-char *
-gdttf(gdImage *im, int *brect, int fg, char *fontname,
- double ptsize, double angle, int x, int y, char *str)
-{
- TT_F26Dot6 ur_x=0, ur_y=0, ll_x=0, ll_y=0;
- TT_F26Dot6 advance_x, advance_y, advance, x1, y1;
- TT_BBox *bbox;
- double sin_a, cos_a;
- int i=0, ch;
- font_t *font;
- fontkey_t fontkey;
- char *error, *next;
-
- /****** initialize font engine on first call ************/
- static gdCache_head_t *fontCache;
- static TT_Engine engine;
-
- if (! fontCache) {
- if (TT_Init_FreeType(&engine)) {
- return "Failure to initialize font engine";
- }
- fontCache = gdCacheCreate( FONTCACHESIZE,
- fontTest, fontFetch, fontRelease);
- }
- /**************/
-
- /* get the font (via font cache) */
- fontkey.fontname = fontname;
- fontkey.ptsize = ptsize;
- fontkey.angle = angle;
- fontkey.engine = &engine;
- font = (font_t *)gdCacheGet(fontCache, &fontkey);
- if (! font) {
- return fontCache->error;
- }
- sin_a = font->sin_a;
- cos_a = font->cos_a;
- advance_x = advance_y = 0;
-
- next=str;
- while (*next) {
- ch = *next;
-
- /* carriage returns */
- if (ch == '\r') {
- advance_x = 0;
- next++;
- continue;
- }
- /* newlines */
- if (ch == '\n') {
- advance_y -= (TT_F26Dot6)(font->imetrics.y_ppem * LINESPACE * 64);
- advance_y = (advance_y-32) & -64; /* round to next pixel row */
- next++;
- continue;
- }
-
- x1 = (TT_F26Dot6)(advance_x * cos_a - advance_y * sin_a);
- y1 = (TT_F26Dot6)(advance_x * sin_a + advance_y * cos_a);
-
- if ((error=gdttfchar(im, fg, font, x, y, x1, y1, &advance, &bbox, &next)))
- return error;
-
- if (! i++) { /* if first character, init BB corner values */
- ll_x = bbox->xMin;
- ll_y = bbox->yMin;
- ur_x = bbox->xMax;
- ur_y = bbox->yMax;
- }
- else {
- if (! advance_x) ll_x = MIN(bbox->xMin, ll_x);
- ll_y = MIN(advance_y + bbox->yMin, ll_y);
- ur_x = MAX(advance_x + bbox->xMax, ur_x);
- if (! advance_y) ur_y = MAX(bbox->yMax, ur_y);
- }
- advance_x += advance;
- }
-
- /* rotate bounding rectangle */
- brect[0] = (int)(ll_x * cos_a - ll_y * sin_a);
- brect[1] = (int)(ll_x * sin_a + ll_y * cos_a);
- brect[2] = (int)(ur_x * cos_a - ll_y * sin_a);
- brect[3] = (int)(ur_x * sin_a + ll_y * cos_a);
- brect[4] = (int)(ur_x * cos_a - ur_y * sin_a);
- brect[5] = (int)(ur_x * sin_a + ur_y * cos_a);
- brect[6] = (int)(ll_x * cos_a - ur_y * sin_a);
- brect[7] = (int)(ll_x * sin_a + ur_y * cos_a);
-
- /* scale, round and offset brect */
- i = 0;
- while (i<8) {
- brect[i] = x + (brect[i] + 32) / 64;
- i++;
- brect[i] = y - (brect[i] + 32) / 64;
- i++;
- }
-
- return (char *)NULL;
-}
-
-#endif /* HAVE_LIBTTF */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/gd/gdttf.h b/ext/gd/gdttf.h
deleted file mode 100644
index 4f32129702..0000000000
--- a/ext/gd/gdttf.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* $Id$ */
-
-#ifdef _OSD_POSIX
-#ifndef APACHE
-#error On this EBCDIC platform, PHP is only supported as an Apache module.
-#else /*APACHE*/
-#ifndef CHARSET_EBCDIC
-#define CHARSET_EBCDIC /* this machine uses EBCDIC, not ASCII! */
-#endif
-#include "ebcdic.h"
-#endif /*APACHE*/
-#endif /*_OSD_POSIX*/
-
-char * gdttf(gdImage *im, int *brect, int fg, char *fontname,
- double ptsize, double angle, int x, int y, char *str);
-
diff --git a/ext/gd/libgd/README b/ext/gd/libgd/README
deleted file mode 100644
index c0333ef5c2..0000000000
--- a/ext/gd/libgd/README
+++ /dev/null
@@ -1,72 +0,0 @@
-This directory contains the GD library available from
-http://www.boutell.com/gd/
-
-The inclusion of this library with PHP is in response to the
-popularity of the GD extension and the GD library itself. We felt
-it would be worthwhile to make sure everyone had access to the
-features of GD and by bundling GD with PHP we have a known target to
-work against.
-
-In addition to the above, a number of motivated PHP hackers have
-expressed an interest in extending the functionality of the PHP-GD
-combination. By putting a version of GD into PHP CVS we have provided
-a sandbox for them to throw sand at each other in. Any and all
-improvements we make to the GD library will be contributed back to the
-original maintainers of this library at boutell.com.
-
-The following statement is from the original GD package:
-
- Credits and license terms
-
- In order to resolve any possible confusion regarding the authorship of
- gd, the following copyright statement covers all of the authors who
- have required such a statement. _If you are aware of any oversights in
- this copyright notice, please contact Thomas Boutell who will be
- pleased to correct them._
-
-COPYRIGHT STATEMENT FOLLOWS THIS LINE
-
- Portions copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
- by Cold Spring Harbor Laboratory. Funded under Grant P41-RR02188 by
- the National Institutes of Health.
-
- Portions copyright 1996, 1997, 1998, 1999, 2000, 2001 by
- Boutell.Com, Inc.
-
- Portions relating to GD2 format copyright 1999, 2000 Philip Warner.
-
- Portions relating to PNG copyright 1999, 2000 Greg Roelofs.
-
- Portions relating to libttf copyright 1999, 2000 John Ellson
- (ellson@lucent.com).
-
- Portions relating to JPEG and to color quantization copyright 2000,
- Doug Becker and copyright (C) 1994-1998, Thomas G. Lane. This
- software is based in part on the work of the Independent JPEG
- Group. See the file README-JPEG.TXT for more information.
-
- Portions relating to WBMP copyright 2000 Maurice Szmurlo and Johan
- Van den Brande.
-
- _Permission has been granted to copy, distribute and modify gd in
- any context without fee, including a commercial application,
- provided that this notice is present in user-accessible supporting
- documentation._
-
- This does not affect your ownership of the derived work itself, and
- the intent is to assure proper credit for the authors of gd, not to
- interfere with your productive use of gd. If you have questions,
- ask. "Derived works" includes all programs that utilize the
- library. Credit must be given in user-accessible documentation.
-
- _This software is provided "AS IS."_ The copyright holders disclaim
- all warranties, either express or implied, including but not
- limited to implied warranties of merchantability and fitness for a
- particular purpose, with respect to this code and accompanying
- documentation.
-
- Although their code does not appear in gd 2.0.1, the authors wish
- to thank David Koblas, David Rowley, and Hutchison Avenue Software
- Corporation for their prior contributions.
-
-END OF COPYRIGHT STATEMENT
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c
deleted file mode 100644
index f57e8b7920..0000000000
--- a/ext/gd/libgd/gd.c
+++ /dev/null
@@ -1,3673 +0,0 @@
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include "gd.h"
-#include "gdhelpers.h"
-
-#include "php.h"
-
-#ifdef _MSC_VER
-# if _MSC_VER >= 1300
-/* in MSVC.NET the these are available but only for __cplusplus and not _MSC_EXTENSIONS */
-# ifdef _MSC_EXTENSIONS
-# define HAVE_FABSF 1
-extern float fabsf(float x);
-# define HAVE_FLOORF 1
-extern float floorf(float x);
-# endif /*MSVC.NET */
-# endif /* MSC */
-#endif
-#ifndef HAVE_FABSF
-# define HAVE_FABSF 0
-#endif
-#ifndef HAVE_FLOORF
-# define HAVE_FLOORF 0
-#endif
-#if HAVE_FABSF == 0
-/* float fabsf(float x); */
-# define fabsf(x) ((float)(fabs(x)))
-#endif
-#if HAVE_FLOORF == 0
-/* float floorf(float x);*/
-#define floorf(x) ((float)(floor(x)))
-#endif
-
-#ifdef _OSD_POSIX /* BS2000 uses the EBCDIC char set instead of ASCII */
-#define CHARSET_EBCDIC
-#define __attribute__(any) /*nothing */
-#endif
-/*_OSD_POSIX*/
-
-#ifndef CHARSET_EBCDIC
-#define ASC(ch) ch
-#else /*CHARSET_EBCDIC */
-#define ASC(ch) gd_toascii[(unsigned char)ch]
-static const unsigned char gd_toascii[256] =
-{
-/*00 */ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f,
- 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................ */
-/*10 */ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97,
- 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /*................ */
-/*20 */ 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b,
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /*................ */
-/*30 */ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
- 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /*................ */
-/*40 */ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
- 0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* .........`.<(+| */
-/*50 */ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
- 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f, /*&.........!$*);. */
-/*60 */ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
- 0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
-/*-/........^,%_>?*/
-/*70 */ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
- 0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /*..........:#@'=" */
-/*80 */ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /*.abcdefghi...... */
-/*90 */ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
- 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /*.jklmnopqr...... */
-/*a0 */ 0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
- 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, /*..stuvwxyz...... */
-/*b0 */ 0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
- 0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7, /*...........[\].. */
-/*c0 */ 0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /*.ABCDEFGHI...... */
-/*d0 */ 0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
- 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff, /*.JKLMNOPQR...... */
-/*e0 */ 0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
- 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /*..STUVWXYZ...... */
-/*f0 */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e /*0123456789.{.}.~ */
-};
-#endif /*CHARSET_EBCDIC */
-
-/* 2.0.10: cast instead of floor() yields 35% performance improvement. Thanks to John Buckman. */
-#define floor_cast(exp) ((long) exp)
-
-extern int gdCosT[];
-extern int gdSinT[];
-
-static void gdImageBrushApply(gdImagePtr im, int x, int y);
-static void gdImageTileApply(gdImagePtr im, int x, int y);
-static void gdImageAntiAliasedApply(gdImagePtr im, int x, int y);
-static int gdFullAlphaBlend(int dst, int src);
-static int gdLayerOverlay(int dst, int src);
-static int gdAlphaBlendColor(int b1, int b2, int a1, int a2);
-static int gdAlphaOverlayColor(int src, int dst, int max);
-static int gdImageGetTrueColorPixel(gdImagePtr im, int x, int y);
-
-void php_gd_error_ex(int type, const char *format, ...)
-{
- va_list args;
-
- TSRMLS_FETCH();
-
- va_start(args, format);
- php_verror(NULL, "", type, format, args TSRMLS_CC);
- va_end(args);
-}
-
-void php_gd_error(const char *format, ...)
-{
- va_list args;
-
- TSRMLS_FETCH();
-
- va_start(args, format);
- php_verror(NULL, "", E_WARNING, format, args TSRMLS_CC);
- va_end(args);
-}
-
-gdImagePtr gdImageCreate (int sx, int sy)
-{
- int i;
- gdImagePtr im;
- im = (gdImage *) gdMalloc(sizeof(gdImage));
- memset(im, 0, sizeof(gdImage));
- /* Row-major ever since gd 1.3 */
- im->pixels = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy);
- im->AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy);
- im->polyInts = 0;
- im->polyAllocated = 0;
- im->brush = 0;
- im->tile = 0;
- im->style = 0;
- for (i = 0; i < sy; i++) {
- /* Row-major ever since gd 1.3 */
- im->pixels[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char));
- im->AA_opacity[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char));
- }
- im->sx = sx;
- im->sy = sy;
- im->colorsTotal = 0;
- im->transparent = (-1);
- im->interlace = 0;
- im->thick = 1;
- im->AA = 0;
- im->AA_polygon = 0;
- for (i = 0; i < gdMaxColors; i++) {
- im->open[i] = 1;
- im->red[i] = 0;
- im->green[i] = 0;
- im->blue[i] = 0;
- }
- im->trueColor = 0;
- im->tpixels = 0;
- im->cx1 = 0;
- im->cy1 = 0;
- im->cx2 = im->sx - 1;
- im->cy2 = im->sy - 1;
- return im;
-}
-
-gdImagePtr gdImageCreateTrueColor (int sx, int sy)
-{
- int i;
- gdImagePtr im;
- im = (gdImage *) gdMalloc(sizeof(gdImage));
- memset(im, 0, sizeof(gdImage));
- im->tpixels = (int **) gdMalloc(sizeof(int *) * sy);
- im->AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy);
- im->polyInts = 0;
- im->polyAllocated = 0;
- im->brush = 0;
- im->tile = 0;
- im->style = 0;
- for (i = 0; i < sy; i++) {
- im->tpixels[i] = (int *) gdCalloc(sx, sizeof(int));
- im->AA_opacity[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char));
- }
- im->sx = sx;
- im->sy = sy;
- im->transparent = (-1);
- im->interlace = 0;
- im->trueColor = 1;
- /* 2.0.2: alpha blending is now on by default, and saving of alpha is
- * off by default. This allows font antialiasing to work as expected
- * on the first try in JPEGs -- quite important -- and also allows
- * for smaller PNGs when saving of alpha channel is not really
- * desired, which it usually isn't!
- */
- im->saveAlphaFlag = 0;
- im->alphaBlendingFlag = 1;
- im->thick = 1;
- im->AA = 0;
- im->AA_polygon = 0;
- im->cx1 = 0;
- im->cy1 = 0;
- im->cx2 = im->sx - 1;
- im->cy2 = im->sy - 1;
- return im;
-}
-
-void gdImageDestroy (gdImagePtr im)
-{
- int i;
- if (im->pixels) {
- for (i = 0; i < im->sy; i++) {
- gdFree(im->pixels[i]);
- }
- gdFree(im->pixels);
- }
- if (im->tpixels) {
- for (i = 0; i < im->sy; i++) {
- gdFree(im->tpixels[i]);
- }
- gdFree(im->tpixels);
- }
- if (im->AA_opacity) {
- for (i = 0; i < im->sy; i++) {
- gdFree(im->AA_opacity[i]);
- }
- gdFree(im->AA_opacity);
- }
- if (im->polyInts) {
- gdFree(im->polyInts);
- }
- if (im->style) {
- gdFree(im->style);
- }
- gdFree(im);
-}
-
-int gdImageColorClosest (gdImagePtr im, int r, int g, int b)
-{
- return gdImageColorClosestAlpha (im, r, g, b, gdAlphaOpaque);
-}
-
-int gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a)
-{
- int i;
- long rd, gd, bd, ad;
- int ct = (-1);
- int first = 1;
- long mindist = 0;
-
- if (im->trueColor) {
- return gdTrueColorAlpha(r, g, b, a);
- }
- for (i = 0; i < im->colorsTotal; i++) {
- long dist;
- if (im->open[i]) {
- continue;
- }
- rd = im->red[i] - r;
- gd = im->green[i] - g;
- bd = im->blue[i] - b;
- /* gd 2.02: whoops, was - b (thanks to David Marwood) */
- ad = im->blue[i] - a;
- dist = rd * rd + gd * gd + bd * bd + ad * ad;
- if (first || (dist < mindist)) {
- mindist = dist;
- ct = i;
- first = 0;
- }
- }
- return ct;
-}
-
-/* This code is taken from http://www.acm.org/jgt/papers/SmithLyons96/hwb_rgb.html, an article
- * on colour conversion to/from RBG and HWB colour systems.
- * It has been modified to return the converted value as a * parameter.
- */
-
-#define RETURN_HWB(h, w, b) {HWB->H = h; HWB->W = w; HWB->B = b; return HWB;}
-#define RETURN_RGB(r, g, b) {RGB->R = r; RGB->G = g; RGB->B = b; return RGB;}
-#define HWB_UNDEFINED -1
-#define SETUP_RGB(s, r, g, b) {s.R = r/255.0f; s.G = g/255.0f; s.B = b/255.0f;}
-
-#ifndef MIN
-#define MIN(a,b) ((a)<(b)?(a):(b))
-#endif
-#define MIN3(a,b,c) ((a)<(b)?(MIN(a,c)):(MIN(b,c)))
-#ifndef MAX
-#define MAX(a,b) ((a)<(b)?(b):(a))
-#endif
-#define MAX3(a,b,c) ((a)<(b)?(MAX(b,c)):(MAX(a,c)))
-
-
-/*
- * Theoretically, hue 0 (pure red) is identical to hue 6 in these transforms. Pure
- * red always maps to 6 in this implementation. Therefore UNDEFINED can be
- * defined as 0 in situations where only unsigned numbers are desired.
- */
-typedef struct
-{
- float R, G, B;
-}
-RGBType;
-typedef struct
-{
- float H, W, B;
-}
-HWBType;
-
-static HWBType * RGB_to_HWB (RGBType RGB, HWBType * HWB)
-{
- /*
- * RGB are each on [0, 1]. W and B are returned on [0, 1] and H is
- * returned on [0, 6]. Exception: H is returned UNDEFINED if W == 1 - B.
- */
-
- float R = RGB.R, G = RGB.G, B = RGB.B, w, v, b, f;
- int i;
-
- w = MIN3 (R, G, B);
- v = MAX3 (R, G, B);
- b = 1 - v;
- if (v == w) {
- RETURN_HWB(HWB_UNDEFINED, w, b);
- }
- f = (R == w) ? G - B : ((G == w) ? B - R : R - G);
- i = (R == w) ? 3 : ((G == w) ? 5 : 1);
-
- RETURN_HWB(i - f / (v - w), w, b);
-}
-
-static float HWB_Diff (int r1, int g1, int b1, int r2, int g2, int b2)
-{
- RGBType RGB1, RGB2;
- HWBType HWB1, HWB2;
- float diff;
-
- SETUP_RGB(RGB1, r1, g1, b1);
- SETUP_RGB(RGB2, r2, g2, b2);
-
- RGB_to_HWB(RGB1, &HWB1);
- RGB_to_HWB(RGB2, &HWB2);
-
- /*
- * I made this bit up; it seems to produce OK results, and it is certainly
- * more visually correct than the current RGB metric. (PJW)
- */
-
- if ((HWB1.H == HWB_UNDEFINED) || (HWB2.H == HWB_UNDEFINED)) {
- diff = 0.0f; /* Undefined hues always match... */
- } else {
- diff = fabsf(HWB1.H - HWB2.H);
- if (diff > 3.0f) {
- diff = 6.0f - diff; /* Remember, it's a colour circle */
- }
- }
-
- diff = diff * diff + (HWB1.W - HWB2.W) * (HWB1.W - HWB2.W) + (HWB1.B - HWB2.B) * (HWB1.B - HWB2.B);
-
- return diff;
-}
-
-
-#if 0
-/*
- * This is not actually used, but is here for completeness, in case someone wants to
- * use the HWB stuff for anything else...
- */
-static RGBType * HWB_to_RGB (HWBType HWB, RGBType * RGB)
-{
- /*
- * H is given on [0, 6] or UNDEFINED. W and B are given on [0, 1].
- * RGB are each returned on [0, 1].
- */
-
- float h = HWB.H, w = HWB.W, b = HWB.B, v, n, f;
- int i;
-
- v = 1 - b;
- if (h == HWB_UNDEFINED) {
- RETURN_RGB(v, v, v);
- }
- i = floor(h);
- f = h - i;
- if (i & 1) {
- f = 1 - f; /* if i is odd */
- }
- n = w + f * (v - w); /* linear interpolation between w and v */
- switch (i) {
- case 6:
- case 0:
- RETURN_RGB(v, n, w);
- case 1:
- RETURN_RGB(n, v, w);
- case 2:
- RETURN_RGB(w, v, n);
- case 3:
- RETURN_RGB(w, n, v);
- case 4:
- RETURN_RGB(n, w, v);
- case 5:
- RETURN_RGB(v, w, n);
- }
-
- return RGB;
-}
-#endif
-
-int gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b)
-{
- int i;
- /* long rd, gd, bd; */
- int ct = (-1);
- int first = 1;
- float mindist = 0;
- if (im->trueColor) {
- return gdTrueColor(r, g, b);
- }
- for (i = 0; i < im->colorsTotal; i++) {
- float dist;
- if (im->open[i]) {
- continue;
- }
- dist = HWB_Diff(im->red[i], im->green[i], im->blue[i], r, g, b);
- if (first || (dist < mindist)) {
- mindist = dist;
- ct = i;
- first = 0;
- }
- }
- return ct;
-}
-
-int gdImageColorExact (gdImagePtr im, int r, int g, int b)
-{
- return gdImageColorExactAlpha (im, r, g, b, gdAlphaOpaque);
-}
-
-int gdImageColorExactAlpha (gdImagePtr im, int r, int g, int b, int a)
-{
- int i;
- if (im->trueColor) {
- return gdTrueColorAlpha(r, g, b, a);
- }
- for (i = 0; i < im->colorsTotal; i++) {
- if (im->open[i]) {
- continue;
- }
- if ((im->red[i] == r) && (im->green[i] == g) && (im->blue[i] == b) && (im->alpha[i] == a)) {
- return i;
- }
- }
- return -1;
-}
-
-int gdImageColorAllocate (gdImagePtr im, int r, int g, int b)
-{
- return gdImageColorAllocateAlpha (im, r, g, b, gdAlphaOpaque);
-}
-
-int gdImageColorAllocateAlpha (gdImagePtr im, int r, int g, int b, int a)
-{
- int i;
- int ct = (-1);
- if (im->trueColor) {
- return gdTrueColorAlpha(r, g, b, a);
- }
- for (i = 0; i < im->colorsTotal; i++) {
- if (im->open[i]) {
- ct = i;
- break;
- }
- }
- if (ct == (-1)) {
- ct = im->colorsTotal;
- if (ct == gdMaxColors) {
- return -1;
- }
- im->colorsTotal++;
- }
- im->red[ct] = r;
- im->green[ct] = g;
- im->blue[ct] = b;
- im->alpha[ct] = a;
- im->open[ct] = 0;
-
- return ct;
-}
-
-/*
- * gdImageColorResolve is an alternative for the code fragment:
- *
- * if ((color=gdImageColorExact(im,R,G,B)) < 0)
- * if ((color=gdImageColorAllocate(im,R,G,B)) < 0)
- * color=gdImageColorClosest(im,R,G,B);
- *
- * in a single function. Its advantage is that it is guaranteed to
- * return a color index in one search over the color table.
- */
-
-int gdImageColorResolve (gdImagePtr im, int r, int g, int b)
-{
- return gdImageColorResolveAlpha(im, r, g, b, gdAlphaOpaque);
-}
-
-int gdImageColorResolveAlpha (gdImagePtr im, int r, int g, int b, int a)
-{
- int c;
- int ct = -1;
- int op = -1;
- long rd, gd, bd, ad, dist;
- long mindist = 4 * 255 * 255; /* init to max poss dist */
- if (im->trueColor)
- {
- return gdTrueColorAlpha (r, g, b, a);
- }
-
- for (c = 0; c < im->colorsTotal; c++)
- {
- if (im->open[c])
- {
- op = c; /* Save open slot */
- continue; /* Color not in use */
- }
- if (c == im->transparent)
- {
- /* don't ever resolve to the color that has
- * been designated as the transparent color */
- continue;
- }
- rd = (long) (im->red[c] - r);
- gd = (long) (im->green[c] - g);
- bd = (long) (im->blue[c] - b);
- ad = (long) (im->alpha[c] - a);
- dist = rd * rd + gd * gd + bd * bd + ad * ad;
- if (dist < mindist)
- {
- if (dist == 0)
- {
- return c; /* Return exact match color */
- }
- mindist = dist;
- ct = c;
- }
- }
- /* no exact match. We now know closest, but first try to allocate exact */
- if (op == -1)
- {
- op = im->colorsTotal;
- if (op == gdMaxColors)
- { /* No room for more colors */
- return ct; /* Return closest available color */
- }
- im->colorsTotal++;
- }
- im->red[op] = r;
- im->green[op] = g;
- im->blue[op] = b;
- im->alpha[op] = a;
- im->open[op] = 0;
- return op; /* Return newly allocated color */
-}
-
-void gdImageColorDeallocate (gdImagePtr im, int color)
-{
- if (im->trueColor) {
- return;
- }
- /* Mark it open. */
- im->open[color] = 1;
-}
-
-void gdImageColorTransparent (gdImagePtr im, int color)
-{
- if (!im->trueColor) {
- if (im->transparent != -1) {
- im->alpha[im->transparent] = gdAlphaOpaque;
- }
- if (color > -1 && color<=gdMaxColors) {
- im->alpha[color] = gdAlphaTransparent;
- } else {
- return;
- }
- }
- im->transparent = color;
-}
-
-void gdImagePaletteCopy (gdImagePtr to, gdImagePtr from)
-{
- int i;
- int x, y, p;
- int xlate[256];
- if (to->trueColor || from->trueColor) {
- return;
- }
-
- for (i = 0; i < 256; i++) {
- xlate[i] = -1;
- }
-
- for (x = 0; x < to->sx; x++) {
- for (y = 0; y < to->sy; y++) {
- p = gdImageGetPixel(to, x, y);
- if (xlate[p] == -1) {
- /* This ought to use HWB, but we don't have an alpha-aware version of that yet. */
- xlate[p] = gdImageColorClosestAlpha (from, to->red[p], to->green[p], to->blue[p], to->alpha[p]);
- }
- gdImageSetPixel(to, x, y, xlate[p]);
- }
- }
-
- for (i = 0; i < from->colorsTotal; i++) {
- to->red[i] = from->red[i];
- to->blue[i] = from->blue[i];
- to->green[i] = from->green[i];
- to->alpha[i] = from->alpha[i];
- to->open[i] = 0;
- }
-
- for (i = from->colorsTotal; i < to->colorsTotal; i++) {
- to->open[i] = 1;
- }
-
- to->colorsTotal = from->colorsTotal;
-}
-
-/* 2.0.10: before the drawing routines, some code to clip points that are
- * outside the drawing window. Nick Atty (nick@canalplan.org.uk)
- *
- * This is the Sutherland Hodgman Algorithm, as implemented by
- * Duvanenko, Robbins and Gyurcsik - SH(DRG) for short. See Dr Dobb's
- * Journal, January 1996, pp107-110 and 116-117
- *
- * Given the end points of a line, and a bounding rectangle (which we
- * know to be from (0,0) to (SX,SY)), adjust the endpoints to be on
- * the edges of the rectangle if the line should be drawn at all,
- * otherwise return a failure code
- */
-
-/* this does "one-dimensional" clipping: note that the second time it
- * is called, all the x parameters refer to height and the y to width
- * - the comments ignore this (if you can understand it when it's
- * looking at the X parameters, it should become clear what happens on
- * the second call!) The code is simplified from that in the article,
- * as we know that gd images always start at (0,0)
- */
-
-static int clip_1d(int *x0, int *y0, int *x1, int *y1, int maxdim) {
- double m; /* gradient of line */
-
- if (*x0 < 0) { /* start of line is left of window */
- if(*x1 < 0) { /* as is the end, so the line never cuts the window */
- return 0;
- }
- m = (*y1 - *y0)/(double)(*x1 - *x0); /* calculate the slope of the line */
- /* adjust x0 to be on the left boundary (ie to be zero), and y0 to match */
- *y0 -= (int)(m * *x0);
- *x0 = 0;
- /* now, perhaps, adjust the far end of the line as well */
- if (*x1 > maxdim) {
- *y1 += (int)(m * (maxdim - *x1));
- *x1 = maxdim;
- }
- return 1;
- }
- if (*x0 > maxdim) { /* start of line is right of window - complement of above */
- if (*x1 > maxdim) { /* as is the end, so the line misses the window */
- return 0;
- }
- m = (*y1 - *y0)/(double)(*x1 - *x0); /* calculate the slope of the line */
- *y0 += (int)(m * (maxdim - *x0)); /* adjust so point is on the right boundary */
- *x0 = maxdim;
- /* now, perhaps, adjust the end of the line */
- if (*x1 < 0) {
- *y1 -= (int)(m * *x1);
- *x1 = 0;
- }
- return 1;
- }
- /* the final case - the start of the line is inside the window */
- if (*x1 > maxdim) { /* other end is outside to the right */
- m = (*y1 - *y0)/(double)(*x1 - *x0); /* calculate the slope of the line */
- *y1 += (int)(m * (maxdim - *x1));
- *x1 = maxdim;
- return 1;
- }
- if (*x1 < 0) { /* other end is outside to the left */
- m = (*y1 - *y0)/(double)(*x1 - *x0); /* calculate the slope of the line */
- *y1 -= (int)(m * *x1);
- *x1 = 0;
- return 1;
- }
- /* only get here if both points are inside the window */
- return 1;
-}
-
-void gdImageSetPixel (gdImagePtr im, int x, int y, int color)
-{
- int p;
- switch (color) {
- case gdStyled:
- if (!im->style) {
- /* Refuse to draw if no style is set. */
- return;
- } else {
- p = im->style[im->stylePos++];
- }
- if (p != gdTransparent) {
- gdImageSetPixel(im, x, y, p);
- }
- im->stylePos = im->stylePos % im->styleLength;
- break;
- case gdStyledBrushed:
- if (!im->style) {
- /* Refuse to draw if no style is set. */
- return;
- }
- p = im->style[im->stylePos++];
- if (p != gdTransparent && p != 0) {
- gdImageSetPixel(im, x, y, gdBrushed);
- }
- im->stylePos = im->stylePos % im->styleLength;
- break;
- case gdBrushed:
- gdImageBrushApply(im, x, y);
- break;
- case gdTiled:
- gdImageTileApply(im, x, y);
- break;
- case gdAntiAliased:
- gdImageAntiAliasedApply(im, x, y);
- break;
- default:
- if (gdImageBoundsSafe(im, x, y)) {
- if (im->trueColor) {
- switch (im->alphaBlendingFlag) {
- default:
- case gdEffectReplace:
- im->tpixels[y][x] = color;
- break;
- case gdEffectAlphaBlend:
- im->tpixels[y][x] = gdAlphaBlend(im->tpixels[y][x], color);
- break;
- case gdEffectNormal:
- im->tpixels[y][x] = gdFullAlphaBlend(im->tpixels[y][x], color);
- break;
- case gdEffectOverlay :
- im->tpixels[y][x] = gdLayerOverlay(im->tpixels[y][x], color);
- break;
- }
- } else {
- im->pixels[y][x] = color;
- }
- }
- break;
- }
-}
-
-static int gdImageGetTrueColorPixel (gdImagePtr im, int x, int y)
-{
- int p = gdImageGetPixel(im, x, y);
-
- if (!im->trueColor) {
- return gdTrueColorAlpha(im->red[p], im->green[p], im->blue[p], (im->transparent == p) ? gdAlphaTransparent : gdAlphaOpaque);
- } else {
- return p;
- }
-}
-
-static void gdImageBrushApply (gdImagePtr im, int x, int y)
-{
- int lx, ly;
- int hy, hx;
- int x1, y1, x2, y2;
- int srcx, srcy;
-
- if (!im->brush) {
- return;
- }
-
- hy = gdImageSY(im->brush) / 2;
- y1 = y - hy;
- y2 = y1 + gdImageSY(im->brush);
- hx = gdImageSX(im->brush) / 2;
- x1 = x - hx;
- x2 = x1 + gdImageSX(im->brush);
- srcy = 0;
-
- if (im->trueColor) {
- if (im->brush->trueColor) {
- for (ly = y1; ly < y2; ly++) {
- srcx = 0;
- for (lx = x1; (lx < x2); lx++) {
- int p;
- p = gdImageGetTrueColorPixel(im->brush, srcx, srcy);
- /* 2.0.9, Thomas Winzig: apply simple full transparency */
- if (p != gdImageGetTransparent(im->brush)) {
- gdImageSetPixel(im, lx, ly, p);
- }
- srcx++;
- }
- srcy++;
- }
- } else {
- /* 2.0.12: Brush palette, image truecolor (thanks to Thorben Kundinger for pointing out the issue) */
- for (ly = y1; ly < y2; ly++) {
- srcx = 0;
- for (lx = x1; lx < x2; lx++) {
- int p, tc;
- p = gdImageGetPixel(im->brush, srcx, srcy);
- tc = gdImageGetTrueColorPixel(im->brush, srcx, srcy);
- /* 2.0.9, Thomas Winzig: apply simple full transparency */
- if (p != gdImageGetTransparent(im->brush)) {
- gdImageSetPixel(im, lx, ly, tc);
- }
- srcx++;
- }
- srcy++;
- }
- }
- } else {
- for (ly = y1; ly < y2; ly++) {
- srcx = 0;
- for (lx = x1; lx < x2; lx++) {
- int p;
- p = gdImageGetPixel(im->brush, srcx, srcy);
- /* Allow for non-square brushes! */
- if (p != gdImageGetTransparent(im->brush)) {
- /* Truecolor brush. Very slow on a palette destination. */
- if (im->brush->trueColor) {
- gdImageSetPixel(im, lx, ly, gdImageColorResolveAlpha(im, gdTrueColorGetRed(p),
- gdTrueColorGetGreen(p),
- gdTrueColorGetBlue(p),
- gdTrueColorGetAlpha(p)));
- } else {
- gdImageSetPixel(im, lx, ly, im->brushColorMap[p]);
- }
- }
- srcx++;
- }
- srcy++;
- }
- }
-}
-
-static void gdImageTileApply (gdImagePtr im, int x, int y)
-{
- int srcx, srcy;
- int p;
- if (!im->tile) {
- return;
- }
- srcx = x % gdImageSX(im->tile);
- srcy = y % gdImageSY(im->tile);
- if (im->trueColor) {
- p = gdImageGetTrueColorPixel(im->tile, srcx, srcy);
- gdImageSetPixel(im, x, y, p);
- } else {
- p = gdImageGetPixel(im->tile, srcx, srcy);
- /* Allow for transparency */
- if (p != gdImageGetTransparent(im->tile)) {
- if (im->tile->trueColor) {
- /* Truecolor tile. Very slow on a palette destination. */
- gdImageSetPixel(im, x, y, gdImageColorResolveAlpha(im,
- gdTrueColorGetRed(p),
- gdTrueColorGetGreen(p),
- gdTrueColorGetBlue(p),
- gdTrueColorGetAlpha(p)));
- } else {
- gdImageSetPixel(im, x, y, im->tileColorMap[p]);
- }
- }
- }
-}
-
-static void gdImageAntiAliasedApply (gdImagePtr im, int px, int py)
-{
- float p_dist, p_alpha;
- unsigned char opacity;
-
- /*
- * Find the perpendicular distance from point C (px, py) to the line
- * segment AB that is being drawn. (Adapted from an algorithm from the
- * comp.graphics.algorithms FAQ.)
- */
-
- int LAC_2, LBC_2;
-
- int Ax_Cx = im->AAL_x1 - px;
- int Ay_Cy = im->AAL_y1 - py;
-
- int Bx_Cx = im->AAL_x2 - px;
- int By_Cy = im->AAL_y2 - py;
-
- /* Get the squares of the lengths of the segemnts AC and BC. */
- LAC_2 = (Ax_Cx * Ax_Cx) + (Ay_Cy * Ay_Cy);
- LBC_2 = (Bx_Cx * Bx_Cx) + (By_Cy * By_Cy);
-
- if (((im->AAL_LAB_2 + LAC_2) >= LBC_2) && ((im->AAL_LAB_2 + LBC_2) >= LAC_2)) {
- /* The two angles are acute. The point lies inside the portion of the
- * plane spanned by the line segment.
- */
- p_dist = fabs ((float) ((Ay_Cy * im->AAL_Bx_Ax) - (Ax_Cx * im->AAL_By_Ay)) / im->AAL_LAB);
- } else {
- /* The point is past an end of the line segment. It's length from the
- * segment is the shorter of the lengths from the endpoints, but call
- * the distance -1, so as not to compute the alpha nor draw the pixel.
- */
- p_dist = -1;
- }
-
- if ((p_dist >= 0) && (p_dist <= (float) (im->thick))) {
- p_alpha = pow (1.0 - (p_dist / 1.5), 2);
-
- if (p_alpha > 0) {
- if (p_alpha >= 1) {
- opacity = 255;
- } else {
- opacity = (unsigned char) (p_alpha * 255.0);
- }
- if (!im->AA_polygon || (im->AA_opacity[py][px] < opacity)) {
- im->AA_opacity[py][px] = opacity;
- }
- }
- }
-}
-
-
-int gdImageGetPixel (gdImagePtr im, int x, int y)
-{
- if (gdImageBoundsSafe(im, x, y)) {
- if (im->trueColor) {
- return im->tpixels[y][x];
- } else {
- return im->pixels[y][x];
- }
- } else {
- return 0;
- }
-}
-
-void gdImageAABlend (gdImagePtr im)
-{
- float p_alpha, old_alpha;
- int color = im->AA_color, color_red, color_green, color_blue;
- int old_color, old_red, old_green, old_blue;
- int p_color, p_red, p_green, p_blue;
- int px, py;
-
- color_red = gdImageRed(im, color);
- color_green = gdImageGreen(im, color);
- color_blue = gdImageBlue(im, color);
-
- /* Impose the anti-aliased drawing on the image. */
- for (py = 0; py < im->sy; py++) {
- for (px = 0; px < im->sx; px++) {
- if (im->AA_opacity[py][px] != 0) {
- old_color = gdImageGetPixel(im, px, py);
-
- if ((old_color != color) && ((old_color != im->AA_dont_blend) || (im->AA_opacity[py][px] == 255))) {
- /* Only blend with different colors that aren't the dont_blend color. */
- p_alpha = (float) (im->AA_opacity[py][px]) / 255.0;
- old_alpha = 1.0 - p_alpha;
-
- if (p_alpha >= 1.0) {
- p_color = color;
- } else {
- old_red = gdImageRed(im, old_color);
- old_green = gdImageGreen(im, old_color);
- old_blue = gdImageBlue(im, old_color);
-
- p_red = (int) (((float) color_red * p_alpha) + ((float) old_red * old_alpha));
- p_green = (int) (((float) color_green * p_alpha) + ((float) old_green * old_alpha));
- p_blue = (int) (((float) color_blue * p_alpha) + ((float) old_blue * old_alpha));
- p_color = gdImageColorResolve(im, p_red, p_green, p_blue);
- }
- gdImageSetPixel(im, px, py, p_color);
- }
- }
- }
- /* Clear the AA_opacity array behind us. */
- memset(im->AA_opacity[py], 0, im->sx);
- }
-}
-
-
-/* Bresenham as presented in Foley & Van Dam */
-void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
-{
- int dx, dy, incr1, incr2, d, x, y, xend, yend, xdirflag, ydirflag;
- int wid;
- int w, wstart;
- int thick = im->thick;
-
- /* 2.0.10: Nick Atty: clip to edges of drawing rectangle, return if no points need to be drawn */
- if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im))) {
- return;
- }
-
- /* gdAntiAliased passed as color: set anti-aliased line (AAL) global vars. */
- if (color == gdAntiAliased) {
- im->AAL_x1 = x1;
- im->AAL_y1 = y1;
- im->AAL_x2 = x2;
- im->AAL_y2 = y2;
-
- /* Compute what we can for point-to-line distance calculation later. */
- im->AAL_Bx_Ax = x2 - x1;
- im->AAL_By_Ay = y2 - y1;
- im->AAL_LAB_2 = (im->AAL_Bx_Ax * im->AAL_Bx_Ax) + (im->AAL_By_Ay * im->AAL_By_Ay);
- im->AAL_LAB = sqrt (im->AAL_LAB_2);
-
- /* For AA, we must draw pixels outside the width of the line. Keep in
- * mind that this will be curtailed by cos/sin of theta later.
- */
- thick += 4;
- }
-
- dx = abs(x2 - x1);
- dy = abs(y2 - y1);
- if (dy <= dx) {
- /* More-or-less horizontal. use wid for vertical stroke */
- /* Doug Claar: watch out for NaN in atan2 (2.0.5) */
- if ((dx == 0) && (dy == 0)) {
- wid = 1;
- } else {
- wid = (int)(thick * cos (atan2 (dy, dx)));
- if (wid == 0) {
- wid = 1;
- }
- }
- d = 2 * dy - dx;
- incr1 = 2 * dy;
- incr2 = 2 * (dy - dx);
- if (x1 > x2) {
- x = x2;
- y = y2;
- ydirflag = (-1);
- xend = x1;
- } else {
- x = x1;
- y = y1;
- ydirflag = 1;
- xend = x2;
- }
-
- /* Set up line thickness */
- wstart = y - wid / 2;
- for (w = wstart; w < wstart + wid; w++) {
- gdImageSetPixel(im, x, w, color);
- }
-
- if (((y2 - y1) * ydirflag) > 0) {
- while (x < xend) {
- x++;
- if (d < 0) {
- d += incr1;
- } else {
- y++;
- d += incr2;
- }
- wstart = y - wid / 2;
- for (w = wstart; w < wstart + wid; w++) {
- gdImageSetPixel (im, x, w, color);
- }
- }
- } else {
- while (x < xend) {
- x++;
- if (d < 0) {
- d += incr1;
- } else {
- y--;
- d += incr2;
- }
- wstart = y - wid / 2;
- for (w = wstart; w < wstart + wid; w++) {
- gdImageSetPixel (im, x, w, color);
- }
- }
- }
- } else {
- /* More-or-less vertical. use wid for horizontal stroke */
- /* 2.0.12: Michael Schwartz: divide rather than multiply;
- TBB: but watch out for /0! */
- double as = sin(atan2(dy, dx));
- if (as != 0) {
- if (!(wid = thick / as)) {
- wid = 1;
- }
- } else {
- wid = 1;
- }
-
- d = 2 * dx - dy;
- incr1 = 2 * dx;
- incr2 = 2 * (dx - dy);
- if (y1 > y2) {
- y = y2;
- x = x2;
- yend = y1;
- xdirflag = (-1);
- } else {
- y = y1;
- x = x1;
- yend = y2;
- xdirflag = 1;
- }
-
- /* Set up line thickness */
- wstart = x - wid / 2;
- for (w = wstart; w < wstart + wid; w++) {
- gdImageSetPixel (im, w, y, color);
- }
-
- if (((x2 - x1) * xdirflag) > 0) {
- while (y < yend) {
- y++;
- if (d < 0) {
- d += incr1;
- } else {
- x++;
- d += incr2;
- }
- wstart = x - wid / 2;
- for (w = wstart; w < wstart + wid; w++) {
- gdImageSetPixel (im, w, y, color);
- }
- }
- } else {
- while (y < yend) {
- y++;
- if (d < 0) {
- d += incr1;
- } else {
- x--;
- d += incr2;
- }
- wstart = x - wid / 2;
- for (w = wstart; w < wstart + wid; w++) {
- gdImageSetPixel (im, w, y, color);
- }
- }
- }
- }
-
- /* If this is the only line we are drawing, go ahead and blend. */
- if (color == gdAntiAliased && !im->AA_polygon) {
- gdImageAABlend(im);
- }
-}
-
-
-/*
- * Added on 2003/12 by Pierre-Alain Joye (pajoye@pearfr.org)
- * */
-#define BLEND_COLOR(a, nc, c, cc) \
-nc = (cc) + (((((c) - (cc)) * (a)) + ((((c) - (cc)) * (a)) >> 8) + 0x80) >> 8);
-
-inline static void gdImageSetAAPixelColor(gdImagePtr im, int x, int y, int color, int t)
-{
- int dr,dg,db,p,r,g,b;
- dr = gdTrueColorGetRed(color);
- dg = gdTrueColorGetGreen(color);
- db = gdTrueColorGetBlue(color);
-
- p = gdImageGetPixel(im,x,y);
- r = gdTrueColorGetRed(p);
- g = gdTrueColorGetGreen(p);
- b = gdTrueColorGetBlue(p);
-
- BLEND_COLOR(t, dr, r, dr);
- BLEND_COLOR(t, dg, g, dg);
- BLEND_COLOR(t, db, b, db);
- im->tpixels[y][x]=gdTrueColorAlpha(dr, dg, db, gdAlphaOpaque);
-}
-
-/*
- * Added on 2003/12 by Pierre-Alain Joye (pajoye@pearfr.org)
- **/
-void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col)
-{
- /* keep them as 32bits */
- long x, y, inc;
- long dx, dy,tmp;
-
- if (y1 < 0 && y2 < 0) {
- return;
- }
- if (y1 < 0) {
- x1 += (y1 * (x1 - x2)) / (y2 - y1);
- y1 = 0;
- }
- if (y2 < 0) {
- x2 += (y2 * (x1 - x2)) / (y2 - y1);
- y2 = 0;
- }
-
- /* bottom edge */
- if (y1 >= im->sy && y2 >= im->sy) {
- return;
- }
- if (y1 >= im->sy) {
- x1 -= ((im->sy - y1) * (x1 - x2)) / (y2 - y1);
- y1 = im->sy - 1;
- }
- if (y2 >= im->sy) {
- x2 -= ((im->sy - y2) * (x1 - x2)) / (y2 - y1);
- y2 = im->sy - 1;
- }
-
- /* left edge */
- if (x1 < 0 && x2 < 0) {
- return;
- }
- if (x1 < 0) {
- y1 += (x1 * (y1 - y2)) / (x2 - x1);
- x1 = 0;
- }
- if (x2 < 0) {
- y2 += (x2 * (y1 - y2)) / (x2 - x1);
- x2 = 0;
- }
- /* right edge */
- if (x1 >= im->sx && x2 >= im->sx) {
- return;
- }
- if (x1 >= im->sx) {
- y1 -= ((im->sx - x1) * (y1 - y2)) / (x2 - x1);
- x1 = im->sx - 1;
- }
- if (x2 >= im->sx) {
- y2 -= ((im->sx - x2) * (y1 - y2)) / (x2 - x1);
- x2 = im->sx - 1;
- }
-
- dx = x2 - x1;
- dy = y2 - y1;
-
- if (dx == 0 && dy == 0) {
- return;
- }
- if (abs(dx) > abs(dy)) {
- if (dx < 0) {
- tmp = x1;
- x1 = x2;
- x2 = tmp;
- tmp = y1;
- y1 = y2;
- y2 = tmp;
- dx = x2 - x1;
- dy = y2 - y1;
- }
- x = x1 << 16;
- y = y1 << 16;
- inc = (dy * 65536) / dx;
- while ((x >> 16) < x2) {
- gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (y >> 8) & 0xFF);
- gdImageSetAAPixelColor(im, x >> 16, (y >> 16) + 1,col, (~y >> 8) & 0xFF);
- x += (1 << 16);
- y += inc;
- }
- } else {
- if (dy < 0) {
- tmp = x1;
- x1 = x2;
- x2 = tmp;
- tmp = y1;
- y1 = y2;
- y2 = tmp;
- dx = x2 - x1;
- dy = y2 - y1;
- }
- x = x1 << 16;
- y = y1 << 16;
- inc = (dx * 65536) / dy;
- while ((y>>16) < y2) {
- gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (x >> 8) & 0xFF);
- gdImageSetAAPixelColor(im, (x >> 16) + 1, (y >> 16),col, (~x >> 8) & 0xFF);
- x += inc;
- y += (1<<16);
- }
- }
-}
-
-static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, int vert);
-
-void gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
-{
- int dx, dy, incr1, incr2, d, x, y, xend, yend, xdirflag, ydirflag;
- int dashStep = 0;
- int on = 1;
- int wid;
- int vert;
- int thick = im->thick;
-
- dx = abs(x2 - x1);
- dy = abs(y2 - y1);
- if (dy <= dx) {
- /* More-or-less horizontal. use wid for vertical stroke */
- /* 2.0.12: Michael Schwartz: divide rather than multiply;
- TBB: but watch out for /0! */
- double as = sin(atan2(dy, dx));
- if (as != 0) {
- wid = thick / as;
- } else {
- wid = 1;
- }
- wid = (int)(thick * sin(atan2(dy, dx)));
- vert = 1;
-
- d = 2 * dy - dx;
- incr1 = 2 * dy;
- incr2 = 2 * (dy - dx);
- if (x1 > x2) {
- x = x2;
- y = y2;
- ydirflag = (-1);
- xend = x1;
- } else {
- x = x1;
- y = y1;
- ydirflag = 1;
- xend = x2;
- }
- dashedSet(im, x, y, color, &on, &dashStep, wid, vert);
- if (((y2 - y1) * ydirflag) > 0) {
- while (x < xend) {
- x++;
- if (d < 0) {
- d += incr1;
- } else {
- y++;
- d += incr2;
- }
- dashedSet(im, x, y, color, &on, &dashStep, wid, vert);
- }
- } else {
- while (x < xend) {
- x++;
- if (d < 0) {
- d += incr1;
- } else {
- y--;
- d += incr2;
- }
- dashedSet(im, x, y, color, &on, &dashStep, wid, vert);
- }
- }
- } else {
- /* 2.0.12: Michael Schwartz: divide rather than multiply;
- TBB: but watch out for /0! */
- double as = sin (atan2 (dy, dx));
- if (as != 0) {
- wid = thick / as;
- } else {
- wid = 1;
- }
- vert = 0;
-
- d = 2 * dx - dy;
- incr1 = 2 * dx;
- incr2 = 2 * (dx - dy);
- if (y1 > y2) {
- y = y2;
- x = x2;
- yend = y1;
- xdirflag = (-1);
- } else {
- y = y1;
- x = x1;
- yend = y2;
- xdirflag = 1;
- }
- dashedSet(im, x, y, color, &on, &dashStep, wid, vert);
- if (((x2 - x1) * xdirflag) > 0) {
- while (y < yend) {
- y++;
- if (d < 0) {
- d += incr1;
- } else {
- x++;
- d += incr2;
- }
- dashedSet(im, x, y, color, &on, &dashStep, wid, vert);
- }
- } else {
- while (y < yend) {
- y++;
- if (d < 0) {
- d += incr1;
- } else {
- x--;
- d += incr2;
- }
- dashedSet(im, x, y, color, &on, &dashStep, wid, vert);
- }
- }
- }
-}
-
-static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, int vert)
-{
- int dashStep = *dashStepP;
- int on = *onP;
- int w, wstart;
-
- dashStep++;
- if (dashStep == gdDashSize) {
- dashStep = 0;
- on = !on;
- }
- if (on) {
- if (vert) {
- wstart = y - wid / 2;
- for (w = wstart; w < wstart + wid; w++) {
- gdImageSetPixel(im, x, w, color);
- }
- } else {
- wstart = x - wid / 2;
- for (w = wstart; w < wstart + wid; w++) {
- gdImageSetPixel(im, w, y, color);
- }
- }
- }
- *dashStepP = dashStep;
- *onP = on;
-}
-
-void gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
-{
- int cx, cy;
- int px, py;
- int fline;
- cx = 0;
- cy = 0;
-#ifdef CHARSET_EBCDIC
- c = ASC (c);
-#endif /*CHARSET_EBCDIC */
- if ((c < f->offset) || (c >= (f->offset + f->nchars))) {
- return;
- }
- fline = (c - f->offset) * f->h * f->w;
- for (py = y; (py < (y + f->h)); py++) {
- for (px = x; (px < (x + f->w)); px++) {
- if (f->data[fline + cy * f->w + cx]) {
- gdImageSetPixel(im, px, py, color);
- }
- cx++;
- }
- cx = 0;
- cy++;
- }
-}
-
-void gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
-{
- int cx, cy;
- int px, py;
- int fline;
- cx = 0;
- cy = 0;
-#ifdef CHARSET_EBCDIC
- c = ASC (c);
-#endif /*CHARSET_EBCDIC */
- if ((c < f->offset) || (c >= (f->offset + f->nchars))) {
- return;
- }
- fline = (c - f->offset) * f->h * f->w;
- for (py = y; py > (y - f->w); py--) {
- for (px = x; px < (x + f->h); px++) {
- if (f->data[fline + cy * f->w + cx]) {
- gdImageSetPixel(im, px, py, color);
- }
- cy++;
- }
- cy = 0;
- cx++;
- }
-}
-
-void gdImageString (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color)
-{
- int i;
- int l;
- l = strlen ((char *) s);
- for (i = 0; (i < l); i++) {
- gdImageChar(im, f, x, y, s[i], color);
- x += f->w;
- }
-}
-
-void gdImageStringUp (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color)
-{
- int i;
- int l;
- l = strlen ((char *) s);
- for (i = 0; (i < l); i++) {
- gdImageCharUp(im, f, x, y, s[i], color);
- y -= f->w;
- }
-}
-
-static int strlen16 (unsigned short *s);
-
-void gdImageString16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color)
-{
- int i;
- int l;
- l = strlen16(s);
- for (i = 0; (i < l); i++) {
- gdImageChar(im, f, x, y, s[i], color);
- x += f->w;
- }
-}
-
-void gdImageStringUp16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color)
-{
- int i;
- int l;
- l = strlen16(s);
- for (i = 0; i < l; i++) {
- gdImageCharUp(im, f, x, y, s[i], color);
- y -= f->w;
- }
-}
-
-static int strlen16 (unsigned short *s)
-{
- int len = 0;
- while (*s) {
- s++;
- len++;
- }
- return len;
-}
-
-#ifndef HAVE_LSQRT
-/* If you don't have a nice square root function for longs, you can use
- ** this hack
- */
-long lsqrt (long n)
-{
- long result = (long) sqrt ((double) n);
- return result;
-}
-#endif
-
-/* s and e are integers modulo 360 (degrees), with 0 degrees
- being the rightmost extreme and degrees changing clockwise.
- cx and cy are the center in pixels; w and h are the horizontal
- and vertical diameter in pixels. Nice interface, but slow.
- See gd_arc_f_buggy.c for a better version that doesn't
- seem to be bug-free yet. */
-
-void gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color)
-{
- if ((s % 360) == (e % 360)) {
- gdImageEllipse(im, cx, cy, w, h, color);
- } else {
- gdImageFilledArc(im, cx, cy, w, h, s, e, color, gdNoFill);
- }
-}
-
-void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int style)
-{
- gdPoint pts[3];
- int i;
- int lx = 0, ly = 0;
- int fx = 0, fy = 0;
-
- while (e < s) {
- e += 360;
- }
- for (i = s; i <= e; i++) {
- int x, y;
- x = ((long) gdCosT[i % 360] * (long) w / (2 * 1024)) + cx;
- y = ((long) gdSinT[i % 360] * (long) h / (2 * 1024)) + cy;
- if (i != s) {
- if (!(style & gdChord)) {
- if (style & gdNoFill) {
- gdImageLine(im, lx, ly, x, y, color);
- } else {
- /* This is expensive! */
- pts[0].x = lx;
- pts[0].y = ly;
- pts[1].x = x;
- pts[1].y = y;
- pts[2].x = cx;
- pts[2].y = cy;
- gdImageFilledPolygon(im, pts, 3, color);
- }
- }
- } else {
- fx = x;
- fy = y;
- }
- lx = x;
- ly = y;
- }
- if (style & gdChord) {
- if (style & gdNoFill) {
- if (style & gdEdged) {
- gdImageLine(im, cx, cy, lx, ly, color);
- gdImageLine(im, cx, cy, fx, fy, color);
- }
- gdImageLine(im, fx, fy, lx, ly, color);
- } else {
- pts[0].x = fx;
- pts[0].y = fy;
- pts[1].x = lx;
- pts[1].y = ly;
- pts[2].x = cx;
- pts[2].y = cy;
- gdImageFilledPolygon(im, pts, 3, color);
- }
- } else {
- if (style & gdNoFill) {
- if (style & gdEdged) {
- gdImageLine(im, cx, cy, lx, ly, color);
- gdImageLine(im, cx, cy, fx, fy, color);
- }
- }
- }
-}
-
-
-/**
- * Integer Ellipse functions (gdImageEllipse and gdImageFilledEllipse)
- * Function added by Pierre-Alain Joye 02/08/2003 (paj@pearfr.org)
- * See the ellipse function simplification for the equation
- * as well as the midpoint algorithm.
- */
-
-void gdImageEllipse(gdImagePtr im, int mx, int my, int w, int h, int c)
-{
- int x=0,mx1=0,mx2=0,my1=0,my2=0;
- long aq,bq,dx,dy,r,rx,ry,a,b;
-
- a=w>>1;
- b=h>>1;
- gdImageSetPixel(im,mx+a, my, c);
- gdImageSetPixel(im,mx-a, my, c);
- mx1 = mx-a;my1 = my;
- mx2 = mx+a;my2 = my;
-
- aq = a * a;
- bq = b * b;
- dx = aq << 1;
- dy = bq << 1;
- r = a * bq;
- rx = r << 1;
- ry = 0;
- x = a;
- while (x > 0){
- if (r > 0) {
- my1++;my2--;
- ry +=dx;
- r -=ry;
- }
- if (r <= 0){
- x--;
- mx1++;mx2--;
- rx -=dy;
- r +=rx;
- }
- gdImageSetPixel(im,mx1, my1, c);
- gdImageSetPixel(im,mx1, my2, c);
- gdImageSetPixel(im,mx2, my1, c);
- gdImageSetPixel(im,mx2, my2, c);
- }
-}
-
-void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c)
-{
- int x=0,mx1=0,mx2=0,my1=0,my2=0;
- long aq,bq,dx,dy,r,rx,ry,a,b;
- int i;
- int old_y1,old_y2;
-
- a=w>>1;
- b=h>>1;
-
- gdImageLine(im, mx-a, my, mx+a, my, c);
-
- mx1 = mx-a;my1 = my;
- mx2 = mx+a;my2 = my;
-
- aq = a * a;
- bq = b * b;
- dx = aq << 1;
- dy = bq << 1;
- r = a * bq;
- rx = r << 1;
- ry = 0;
- x = a;
- old_y2=-1;
- old_y1=-1;
- while (x > 0){
- if (r > 0) {
- my1++;my2--;
- ry +=dx;
- r -=ry;
- }
- if (r <= 0){
- x--;
- mx1++;mx2--;
- rx -=dy;
- r +=rx;
- }
- if(old_y2!=my2){
- for(i=mx1;i<=mx2;i++){
- gdImageSetPixel(im,i,my1,c);
- }
- }
- if(old_y2!=my2){
- for(i=mx1;i<=mx2;i++){
- gdImageSetPixel(im,i,my2,c);
- }
- }
- old_y2 = my2;
- old_y1 = my1;
- }
-}
-
-void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)
-{
- int lastBorder;
- /* Seek left */
- int leftLimit = -1, rightLimit;
- int i;
-
- if (border < 0) {
- /* Refuse to fill to a non-solid border */
- return;
- }
-
- if (x >= im->sx) {
- x = im->sx - 1;
- }
- if (y >= im->sy) {
- y = im->sy - 1;
- }
-
- for (i = x; i >= 0; i--) {
- if (gdImageGetPixel(im, i, y) == border) {
- break;
- }
- gdImageSetPixel(im, i, y, color);
- leftLimit = i;
- }
- if (leftLimit == -1) {
- return;
- }
- /* Seek right */
- rightLimit = x;
- for (i = (x + 1); i < im->sx; i++) {
- if (gdImageGetPixel(im, i, y) == border) {
- break;
- }
- gdImageSetPixel(im, i, y, color);
- rightLimit = i;
- }
- /* Look at lines above and below and start paints */
- /* Above */
- if (y > 0) {
- lastBorder = 1;
- for (i = leftLimit; i <= rightLimit; i++) {
- int c = gdImageGetPixel(im, i, y - 1);
- if (lastBorder) {
- if ((c != border) && (c != color)) {
- gdImageFillToBorder(im, i, y - 1, border, color);
- lastBorder = 0;
- }
- } else if ((c == border) || (c == color)) {
- lastBorder = 1;
- }
- }
- }
- /* Below */
- if (y < ((im->sy) - 1)) {
- lastBorder = 1;
- for (i = leftLimit; i <= rightLimit; i++) {
- int c = gdImageGetPixel(im, i, y + 1);
-
- if (lastBorder) {
- if ((c != border) && (c != color)) {
- gdImageFillToBorder(im, i, y + 1, border, color);
- lastBorder = 0;
- }
- } else if ((c == border) || (c == color)) {
- lastBorder = 1;
- }
- }
- }
-}
-
-void gdImageFill (gdImagePtr im, int x, int y, int color)
-{
- int lastBorder;
- int old;
- int leftLimit, rightLimit;
- int i;
-
- if (x >= im->sx) {
- x = im->sx - 1;
- }
-
- if (y >= im->sy) {
- y = im->sy - 1;
- }
-
- old = gdImageGetPixel(im, x, y);
- if (color == gdTiled) {
- /* Tile fill -- got to watch out! */
- int p, tileColor;
- int srcx, srcy;
- if (!im->tile) {
- return;
- }
- /* Refuse to flood-fill with a transparent pattern I can't do it without allocating another image */
- if (gdImageGetTransparent(im->tile) != (-1)) {
- return;
- }
- srcx = x % gdImageSX(im->tile);
- srcy = y % gdImageSY(im->tile);
- p = gdImageGetPixel(im->tile, srcx, srcy);
- if (im->trueColor) {
- tileColor = p;
- } else {
- if (im->tile->trueColor) {
- tileColor = gdImageColorResolveAlpha(im, gdTrueColorGetRed (p), gdTrueColorGetGreen (p), gdTrueColorGetBlue (p), gdTrueColorGetAlpha (p));
- } else {
- tileColor = im->tileColorMap[p];
- }
- }
- if (old == tileColor) {
- /* Nothing to be done */
- return;
- }
- } else {
- if (old == color) {
- /* Nothing to be done */
- return;
- }
- }
- /* Seek left */
- leftLimit = (-1);
- for (i = x; i >= 0; i--) {
- if (gdImageGetPixel(im, i, y) != old) {
- break;
- }
- gdImageSetPixel(im, i, y, color);
- leftLimit = i;
- }
- if (leftLimit == (-1)) {
- return;
- }
- /* Seek right */
- rightLimit = x;
- for (i = (x + 1); i < im->sx; i++) {
- if (gdImageGetPixel(im, i, y) != old) {
- break;
- }
- gdImageSetPixel(im, i, y, color);
- rightLimit = i;
- }
- /* Look at lines above and below and start paints */
- /* Above */
- if (y > 0) {
- lastBorder = 1;
- for (i = leftLimit; i <= rightLimit; i++) {
- int c;
- c = gdImageGetPixel(im, i, y - 1);
- if (lastBorder && c == old) {
- gdImageFill (im, i, y - 1, color);
- lastBorder = 0;
- } else if (c != old) {
- lastBorder = 1;
- }
- }
- }
- /* Below */
- if (y < (im->sy - 1)) {
- lastBorder = 1;
- for (i = leftLimit; i <= rightLimit; i++) {
- int c;
- c = gdImageGetPixel(im, i, y + 1);
- if (lastBorder && c == old) {
- gdImageFill(im, i, y + 1, color);
- lastBorder = 0;
- } else if (c != old) {
- lastBorder = 1;
- }
- }
- }
-}
-
-void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
-{
- int x1h = x1, x1v = x1, y1h = y1, y1v = y1, x2h = x2, x2v = x2, y2h = y2, y2v = y2;
- int thick = im->thick;
-
- if (thick > 1) {
- int half = thick / 2;
- int half1 = thick - half;
-
- if (y1 < y2) {
- y1v = y1h - half;
- y2v = y2h + half1 - 1;
- } else {
- y1v = y1h + half1 - 1;
- y2v = y2h - half;
- }
- }
-
- gdImageLine(im, x1h, y1h, x2h, y1h, color);
- gdImageLine(im, x1h, y2h, x2h, y2h, color);
- gdImageLine(im, x1v, y1v, x1v, y2v, color);
- gdImageLine(im, x2v, y1v, x2v, y2v, color);
-}
-
-void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
-{
- int x, y;
-
- /* Nick Atty: limit the points at the edge. Note that this also
- * nicely kills any plotting for rectangles completely outside the
- * window as it makes the tests in the for loops fail
- */
- if (x1 < 0) {
- x1 = 0;
- }
- if (x1 > gdImageSX(im)) {
- x1 = gdImageSX(im);
- }
- if(y1 < 0) {
- y1 = 0;
- }
- if (y1 > gdImageSY(im)) {
- y1 = gdImageSY(im);
- }
-
- for (y = y1; (y <= y2); y++) {
- for (x = x1; (x <= x2); x++) {
- gdImageSetPixel (im, x, y, color);
- }
- }
-}
-
-void gdImageCopy (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h)
-{
- int c;
- int x, y;
- int tox, toy;
- int i;
- int colorMap[gdMaxColors];
-
- if (dst->trueColor) {
- /* 2.0: much easier when the destination is truecolor. */
- /* 2.0.10: needs a transparent-index check that is still valid if
- * the source is not truecolor. Thanks to Frank Warmerdam.
- */
-
- if (src->trueColor) {
- for (y = 0; (y < h); y++) {
- for (x = 0; (x < w); x++) {
- int c = gdImageGetTrueColorPixel (src, srcX + x, srcY + y);
- gdImageSetPixel (dst, dstX + x, dstY + y, c);
- }
- }
- } else {
- /* source is palette based */
- for (y = 0; (y < h); y++) {
- for (x = 0; (x < w); x++) {
- int c = gdImageGetPixel (src, srcX + x, srcY + y);
- if (c != src->transparent) {
- gdImageSetPixel (dst, dstX + x, dstY + y, gdTrueColor(src->red[c], src->green[c], src->blue[c]));
- }
- }
- }
- }
- return;
- }
-
- /* Destination is palette based */
- if (src->trueColor) { /* But source is truecolor (Ouch!) */
- toy = dstY;
- for (y = srcY; (y < (srcY + h)); y++) {
- tox = dstX;
- for (x = srcX; x < (srcX + w); x++) {
- int nc;
- c = gdImageGetPixel (src, x, y);
-
- /* Get best match possible. */
- nc = gdImageColorResolveAlpha(dst, gdTrueColorGetRed(c), gdTrueColorGetGreen(c), gdTrueColorGetBlue(c), gdTrueColorGetAlpha(c));
-
- gdImageSetPixel(dst, tox, toy, nc);
- tox++;
- }
- toy++;
- }
- return;
- }
-
- /* Palette based to palette based */
- for (i = 0; i < gdMaxColors; i++) {
- colorMap[i] = (-1);
- }
- toy = dstY;
- for (y = srcY; y < (srcY + h); y++) {
- tox = dstX;
- for (x = srcX; x < (srcX + w); x++) {
- int nc;
- int mapTo;
- c = gdImageGetPixel (src, x, y);
- /* Added 7/24/95: support transparent copies */
- if (gdImageGetTransparent (src) == c) {
- tox++;
- continue;
- }
- /* Have we established a mapping for this color? */
- if (src->trueColor) {
- /* 2.05: remap to the palette available in the destination image. This is slow and
- * works badly, but it beats crashing! Thanks to Padhrig McCarthy.
- */
- mapTo = gdImageColorResolveAlpha (dst, gdTrueColorGetRed (c), gdTrueColorGetGreen (c), gdTrueColorGetBlue (c), gdTrueColorGetAlpha (c));
- } else if (colorMap[c] == (-1)) {
- /* If it's the same image, mapping is trivial */
- if (dst == src) {
- nc = c;
- } else {
- /* Get best match possible. This function never returns error. */
- nc = gdImageColorResolveAlpha (dst, src->red[c], src->green[c], src->blue[c], src->alpha[c]);
- }
- colorMap[c] = nc;
- mapTo = colorMap[c];
- } else {
- mapTo = colorMap[c];
- }
- gdImageSetPixel (dst, tox, toy, mapTo);
- tox++;
- }
- toy++;
- }
-}
-
-/* This function is a substitute for real alpha channel operations,
- so it doesn't pay attention to the alpha channel. */
-void gdImageCopyMerge (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h, int pct)
-{
- int c, dc;
- int x, y;
- int tox, toy;
- int ncR, ncG, ncB;
- toy = dstY;
-
- for (y = srcY; y < (srcY + h); y++) {
- tox = dstX;
- for (x = srcX; x < (srcX + w); x++) {
- int nc;
- c = gdImageGetPixel(src, x, y);
- /* Added 7/24/95: support transparent copies */
- if (gdImageGetTransparent(src) == c) {
- tox++;
- continue;
- }
- /*
- * If it's the same image, mapping is NOT trivial since we
- * merge with greyscale target, but if pct is 100, the grey
- * value is not used, so it becomes trivial. pjw 2.0.12.
- */
- if (dst == src && pct == 100) {
- nc = c;
- } else {
- dc = gdImageGetPixel(dst, tox, toy);
-
- ncR = (int)(gdImageRed (src, c) * (pct / 100.0f) + ((100 - pct) / 100.0f));
- ncG = (int)(gdImageGreen (src, c) * (pct / 100.0f) + ((100 - pct) / 100.0f));
- ncB = (int)(gdImageBlue (src, c) * (pct / 100.0f) + ((100 - pct) / 100.0f));
-
- /* Find a reasonable color */
- nc = gdImageColorResolve (dst, ncR, ncG, ncB);
- }
- gdImageSetPixel (dst, tox, toy, nc);
- tox++;
- }
- toy++;
- }
-}
-
-/* This function is a substitute for real alpha channel operations,
- so it doesn't pay attention to the alpha channel. */
-void gdImageCopyMergeGray (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h, int pct)
-{
- int c, dc;
- int x, y;
- int tox, toy;
- int ncR, ncG, ncB;
- float g;
- toy = dstY;
-
- for (y = srcY; (y < (srcY + h)); y++) {
- tox = dstX;
- for (x = srcX; (x < (srcX + w)); x++) {
- int nc;
- c = gdImageGetPixel (src, x, y);
- /* Added 7/24/95: support transparent copies */
- if (gdImageGetTransparent(src) == c) {
- tox++;
- continue;
- }
- /* If it's the same image, mapping is trivial */
- if (dst == src) {
- nc = c;
- } else {
- dc = gdImageGetPixel(dst, tox, toy);
- g = (0.29900f * gdImageRed(dst, dc)) + (0.58700f * gdImageGreen(dst, dc)) + (0.11400f * gdImageBlue(dst, dc));
-
- ncR = (int)(gdImageRed (src, c) * (pct / 100.0f) + gdImageRed(dst, dc) * g * ((100 - pct) / 100.0f));
- ncG = (int)(gdImageGreen (src, c) * (pct / 100.0f) + gdImageGreen(dst, dc) * g * ((100 - pct) / 100.0f));
- ncB = (int)(gdImageBlue (src, c) * (pct / 100.0f) + gdImageBlue(dst, dc) * g * ((100 - pct) / 100.0f));
-
- /* First look for an exact match */
- nc = gdImageColorExact(dst, ncR, ncG, ncB);
- if (nc == (-1)) {
- /* No, so try to allocate it */
- nc = gdImageColorAllocate(dst, ncR, ncG, ncB);
- /* If we're out of colors, go for the closest color */
- if (nc == (-1)) {
- nc = gdImageColorClosest(dst, ncR, ncG, ncB);
- }
- }
- }
- gdImageSetPixel(dst, tox, toy, nc);
- tox++;
- }
- toy++;
- }
-}
-
-void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH)
-{
- int c;
- int x, y;
- int tox, toy;
- int ydest;
- int i;
- int colorMap[gdMaxColors];
- /* Stretch vectors */
- int *stx, *sty;
- /* We only need to use floating point to determine the correct stretch vector for one line's worth. */
- double accum;
- stx = (int *) gdMalloc (sizeof (int) * srcW);
- sty = (int *) gdMalloc (sizeof (int) * srcH);
- accum = 0;
-
- for (i = 0; (i < srcW); i++) {
- int got;
- accum += (double) dstW / (double) srcW;
- got = (int) floor (accum);
- stx[i] = got;
- accum -= got;
- }
- accum = 0;
- for (i = 0; (i < srcH); i++) {
- int got;
- accum += (double) dstH / (double) srcH;
- got = (int) floor (accum);
- sty[i] = got;
- accum -= got;
- }
- for (i = 0; (i < gdMaxColors); i++) {
- colorMap[i] = (-1);
- }
- toy = dstY;
- for (y = srcY; (y < (srcY + srcH)); y++) {
- for (ydest = 0; (ydest < sty[y - srcY]); ydest++) {
- tox = dstX;
- for (x = srcX; (x < (srcX + srcW)); x++) {
- int nc = 0;
- int mapTo;
- if (!stx[x - srcX]) {
- continue;
- }
- if (dst->trueColor) {
- /* 2.0.9: Thorben Kundinger: Maybe the source image is not a truecolor image */
- if (!src->trueColor) {
- int tmp = gdImageGetPixel (src, x, y);
- mapTo = gdImageGetTrueColorPixel (src, x, y);
- if (gdImageGetTransparent (src) == tmp) {
- tox++;
- continue;
- }
- } else {
- /* TK: old code follows */
- mapTo = gdImageGetTrueColorPixel (src, x, y);
- /* Added 7/24/95: support transparent copies */
- if (gdImageGetTransparent (src) == mapTo) {
- tox++;
- continue;
- }
- }
- } else {
- c = gdImageGetPixel (src, x, y);
- /* Added 7/24/95: support transparent copies */
- if (gdImageGetTransparent (src) == c) {
- tox += stx[x - srcX];
- continue;
- }
- if (src->trueColor) {
- /* Remap to the palette available in the destination image. This is slow and works badly. */
- mapTo = gdImageColorResolveAlpha(dst, gdTrueColorGetRed(c),
- gdTrueColorGetGreen(c),
- gdTrueColorGetBlue(c),
- gdTrueColorGetAlpha (c));
- } else {
- /* Have we established a mapping for this color? */
- if (colorMap[c] == (-1)) {
- /* If it's the same image, mapping is trivial */
- if (dst == src) {
- nc = c;
- } else {
- /* Find or create the best match */
- /* 2.0.5: can't use gdTrueColorGetRed, etc with palette */
- nc = gdImageColorResolveAlpha(dst, gdImageRed(src, c),
- gdImageGreen(src, c),
- gdImageBlue(src, c),
- gdImageAlpha(src, c));
- }
- colorMap[c] = nc;
- }
- mapTo = colorMap[c];
- }
- }
- for (i = 0; (i < stx[x - srcX]); i++) {
- gdImageSetPixel (dst, tox, toy, mapTo);
- tox++;
- }
- }
- toy++;
- }
- }
- gdFree (stx);
- gdFree (sty);
-}
-
-/* When gd 1.x was first created, floating point was to be avoided.
- These days it is often faster than table lookups or integer
- arithmetic. The routine below is shamelessly, gloriously
- floating point. TBB */
-
-void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH)
-{
- int x, y;
- if (!dst->trueColor) {
- gdImageCopyResized (dst, src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
- return;
- }
- for (y = dstY; (y < dstY + dstH); y++) {
- for (x = dstX; (x < dstX + dstW); x++) {
- float sy1, sy2, sx1, sx2;
- float sx, sy;
- float spixels = 0.0f;
- float red = 0.0f, green = 0.0f, blue = 0.0f, alpha = 0.0f;
- float alpha_factor, alpha_sum = 0.0f, contrib_sum = 0.0f;
- sy1 = ((float)(y - dstY)) * (float)srcH / (float)dstH;
- sy2 = ((float)(y + 1 - dstY)) * (float) srcH / (float) dstH;
- sy = sy1;
- do {
- float yportion;
- if (floor_cast(sy) == floor_cast(sy1)) {
- yportion = 1.0f - (sy - floor_cast(sy));
- if (yportion > sy2 - sy1) {
- yportion = sy2 - sy1;
- }
- sy = floor_cast(sy);
- } else if (sy == floorf(sy2)) {
- yportion = sy2 - floor_cast(sy2);
- } else {
- yportion = 1.0f;
- }
- sx1 = ((float)(x - dstX)) * (float) srcW / dstW;
- sx2 = ((float)(x + 1 - dstX)) * (float) srcW / dstW;
- sx = sx1;
- do {
- float xportion;
- float pcontribution;
- int p;
- if (floorf(sx) == floor_cast(sx1)) {
- xportion = 1.0f - (sx - floor_cast(sx));
- if (xportion > sx2 - sx1) {
- xportion = sx2 - sx1;
- }
- sx = floor_cast(sx);
- } else if (sx == floorf(sx2)) {
- xportion = sx2 - floor_cast(sx2);
- } else {
- xportion = 1.0f;
- }
- pcontribution = xportion * yportion;
- p = gdImageGetTrueColorPixel(src, (int) sx + srcX, (int) sy + srcY);
-
- alpha_factor = ((gdAlphaMax - gdTrueColorGetAlpha(p))) * pcontribution;
- red += gdTrueColorGetRed (p) * alpha_factor;
- green += gdTrueColorGetGreen (p) * alpha_factor;
- blue += gdTrueColorGetBlue (p) * alpha_factor;
- alpha += gdTrueColorGetAlpha (p) * pcontribution;
- alpha_sum += alpha_factor;
- contrib_sum += pcontribution;
- spixels += xportion * yportion;
- sx += 1.0f;
- }
- while (sx < sx2);
-
- sy += 1.0f;
- }
-
- while (sy < sy2);
-
- if (spixels != 0.0f) {
- red /= spixels;
- green /= spixels;
- blue /= spixels;
- alpha /= spixels;
- }
- if ( alpha_sum != 0.0f) {
- if( contrib_sum != 0.0f) {
- alpha_sum /= contrib_sum;
- }
- red /= alpha_sum;
- green /= alpha_sum;
- blue /= alpha_sum;
- }
- /* Clamping to allow for rounding errors above */
- if (red > 255.0f) {
- red = 255.0f;
- }
- if (green > 255.0f) {
- green = 255.0f;
- }
- if (blue > 255.0f) {
- blue = 255.0f;
- }
- if (alpha > gdAlphaMax) {
- alpha = gdAlphaMax;
- }
- gdImageSetPixel(dst, x, y, gdTrueColorAlpha ((int) red, (int) green, (int) blue, (int) alpha));
- }
- }
-}
-
-
-/*
- * Rotate function Added on 2003/12
- * by Pierre-Alain Joye (pajoye@pearfr.org)
- **/
-/* Begin rotate function */
-#ifdef ROTATE_PI
-#undef ROTATE_PI
-#endif /* ROTATE_PI */
-
-#define ROTATE_DEG2RAD 3.1415926535897932384626433832795/180
-void gdImageSkewX (gdImagePtr dst, gdImagePtr src, int uRow, int iOffset, double dWeight, int clrBack)
-{
- typedef int (*FuncPtr)(gdImagePtr, int, int);
- int i, r, g, b, a;
- FuncPtr f;
-
- int pxlOldLeft, pxlLeft=0, pxlSrc;
-
- if (src->trueColor) {
- f = gdImageGetTrueColorPixel;
- } else {
- f = gdImageGetPixel;
- }
-
- for (i = 0; i < iOffset; i++) {
- gdImageSetPixel (dst, i, uRow, clrBack);
- }
-
- if (i < dst->sx) {
- gdImageSetPixel (dst, i, uRow, clrBack);
- }
-
- pxlOldLeft = clrBack;
-
- for (i = 0; i < src->sx; i++) {
- pxlSrc = f (src,i,uRow);
-
- r = (int)(gdImageRed(src,pxlSrc) * dWeight);
- g = (int)(gdImageGreen(src,pxlSrc) * dWeight);
- b = (int)(gdImageBlue(src,pxlSrc) * dWeight);
- a = (int)(gdImageAlpha(src,pxlSrc) * dWeight);
-
- pxlLeft = gdImageColorAllocateAlpha(src, r, g, b, a);
-
- if (pxlLeft == -1) {
- pxlLeft = gdImageColorClosestAlpha(src, r, g, b, a);
- }
-
- r = gdImageRed(src,pxlSrc) - (gdImageRed(src,pxlLeft) - gdImageRed(src,pxlOldLeft));
- g = gdImageGreen(src,pxlSrc) - (gdImageGreen(src,pxlLeft) - gdImageGreen(src,pxlOldLeft));
- b = gdImageBlue(src,pxlSrc) - (gdImageBlue(src,pxlLeft) - gdImageBlue(src,pxlOldLeft));
- a = gdImageAlpha(src,pxlSrc) - (gdImageAlpha(src,pxlLeft) - gdImageAlpha(src,pxlOldLeft));
-
- if (r>255) {
- r = 255;
- }
-
- if (g>255) {
- g = 255;
- }
-
- if(b>255) {
- b = 255;
- }
-
- if (a>127) {
- b = 127;
- }
-
- pxlSrc = gdImageColorAllocateAlpha(dst, r, g, b, a);
-
- if (pxlSrc == -1) {
- pxlSrc = gdImageColorClosestAlpha(dst, r, g, b, a);
- }
-
- if ((i + iOffset >= 0) && (i + iOffset < dst->sx)) {
- gdImageSetPixel (dst, i+iOffset, uRow, pxlSrc);
- }
-
- pxlOldLeft = pxlLeft;
- }
-
- i += iOffset;
-
- if (i < dst->sx) {
- gdImageSetPixel (dst, i, uRow, pxlLeft);
- }
-
- gdImageSetPixel (dst, iOffset, uRow, clrBack);
-
- i--;
-
- while (++i < dst->sx) {
- gdImageSetPixel (dst, i, uRow, clrBack);
- }
-}
-
-void gdImageSkewY (gdImagePtr dst, gdImagePtr src, int uCol, int iOffset, double dWeight, int clrBack)
-{
- typedef int (*FuncPtr)(gdImagePtr, int, int);
- int i, iYPos=0, r, g, b, a;
- FuncPtr f;
- int pxlOldLeft, pxlLeft=0, pxlSrc;
-
- if (src->trueColor) {
- f = gdImageGetTrueColorPixel;
- } else {
- f = gdImageGetPixel;
- }
-
- for (i = 0; i<iOffset; i++) {
- gdImageSetPixel (dst, uCol, i, clrBack);
- }
-
- pxlOldLeft = clrBack;
-
- for (i = 0; i < src->sy; i++) {
- pxlSrc = f (src, uCol, i);
- iYPos = i + iOffset;
-
- r = (int)(gdImageRed(src,pxlSrc) * dWeight);
- g = (int)(gdImageGreen(src,pxlSrc) * dWeight);
- b = (int)(gdImageBlue(src,pxlSrc) * dWeight);
- a = (int)(gdImageAlpha(src,pxlSrc) * dWeight);
-
- pxlLeft = gdImageColorAllocateAlpha(src, r, g, b, a);
-
- if (pxlLeft == -1) {
- pxlLeft = gdImageColorClosestAlpha(src, r, g, b, a);
- }
-
- r = gdImageRed(src,pxlSrc) - (gdImageRed(src,pxlLeft) - gdImageRed(src,pxlOldLeft));
- g = gdImageGreen(src,pxlSrc) - (gdImageGreen(src,pxlLeft) - gdImageGreen(src,pxlOldLeft));
- b = gdImageBlue(src,pxlSrc) - (gdImageBlue(src,pxlLeft) - gdImageBlue(src,pxlOldLeft));
- a = gdImageAlpha(src,pxlSrc) - (gdImageAlpha(src,pxlLeft) - gdImageAlpha(src,pxlOldLeft));
-
- if (r>255) {
- r = 255;
- }
-
- if (g>255) {
- g = 255;
- }
-
- if(b>255) {
- b = 255;
- }
-
- if (a>127) {
- b = 127;
- }
-
- pxlSrc = gdImageColorAllocateAlpha(dst, r, g, b, a);
-
- if (pxlSrc == -1) {
- pxlSrc = gdImageColorClosestAlpha(dst, r, g, b, a);
- }
-
- if ((iYPos >= 0) && (iYPos < dst->sy)) {
- gdImageSetPixel (dst, uCol, iYPos, pxlSrc);
- }
-
- pxlOldLeft = pxlLeft;
- }
-
- i = iYPos;
- if (i < dst->sy) {
- gdImageSetPixel (dst, uCol, i, pxlLeft);
- }
-
- i--;
- while (++i < dst->sy) {
- gdImageSetPixel (dst, uCol, i, clrBack);
- }
-}
-
-/* Rotates an image by 90 degrees (counter clockwise) */
-gdImagePtr gdImageRotate90 (gdImagePtr src)
-{
- int uY, uX;
- int c;
- gdImagePtr dst;
- typedef int (*FuncPtr)(gdImagePtr, int, int);
- FuncPtr f;
-
- if (src->trueColor) {
- dst = gdImageCreateTrueColor(src->sy, src->sx);
- f = gdImageGetTrueColorPixel;
- } else {
- dst = gdImageCreate (src->sy, src->sx);
- f = gdImageGetPixel;
- }
-
- if (dst != NULL) {
- gdImagePaletteCopy (dst, src);
-
- for (uY = 0; uY<src->sy; uY++) {
- for (uX = 0; uX<src->sx; uX++) {
- c = f (src, uX, uY);
- gdImageSetPixel(dst, uY, (dst->sy - uX - 1), c);
- }
- }
- }
-
- return dst;
-}
-
-/* Rotates an image by 180 degrees (counter clockwise) */
-gdImagePtr gdImageRotate180 (gdImagePtr src)
-{
- int uY, uX;
- int c;
- gdImagePtr dst;
- typedef int (*FuncPtr)(gdImagePtr, int, int);
- FuncPtr f;
-
- if (src->trueColor) {
- dst = gdImageCreateTrueColor ( src->sx,src->sy);
- f = gdImageGetTrueColorPixel;
- } else {
- dst = gdImageCreate (src->sx, src->sy);
- f = gdImageGetPixel;
- }
-
- if (dst != NULL) {
- gdImagePaletteCopy (dst, src);
-
- for (uY = 0; uY<src->sy; uY++) {
- for (uX = 0; uX<src->sx; uX++) {
- c = f (src, uX, uY);
- gdImageSetPixel(dst, (dst->sx - uX - 1), (dst->sy - uY - 1), c);
- }
- }
- }
-
- return dst;
-}
-
-/* Rotates an image by 270 degrees (counter clockwise) */
-gdImagePtr gdImageRotate270 ( gdImagePtr src )
-{
- int uY, uX;
- int c;
- gdImagePtr dst;
- typedef int (*FuncPtr)(gdImagePtr, int, int);
- FuncPtr f;
-
- if (src->trueColor) {
- dst = gdImageCreateTrueColor (src->sy, src->sx);
- f = gdImageGetTrueColorPixel;
- } else {
- dst = gdImageCreate (src->sy, src->sx);
- f = gdImageGetPixel;
- }
-
- if (dst != NULL) {
- gdImagePaletteCopy (dst, src);
-
- for (uY = 0; uY<src->sx; uY++) {
- for (uX = 0; uX<src->sx; uX++) {
- c = f (src, uX, uY);
- gdImageSetPixel(dst, (dst->sx - uY - 1), uX, c);
- }
- }
- }
-
- return dst;
-}
-
-gdImagePtr gdImageRotate45 (gdImagePtr src, double dAngle, int clrBack)
-{
- typedef int (*FuncPtr)(gdImagePtr, int, int);
- gdImagePtr dst1,dst2,dst3;
- FuncPtr f;
- double dRadAngle, dSinE, dTan, dShear;
- double dOffset; /* Variable skew offset */
- int u, iShear, newx, newy;
-
- /* See GEMS I for the algorithm details */
- dRadAngle = dAngle * ROTATE_DEG2RAD; /* Angle in radians */
- dSinE = sin (dRadAngle);
- dTan = tan (dRadAngle / 2.0);
-
- newx = (int)(src->sx + src->sy * fabs(dTan));
- newy = src->sy;
-
- /* 1st shear */
- if (src->trueColor) {
- dst1 = gdImageCreateTrueColor (newx, newy);
- f = gdImageGetTrueColorPixel;
- } else {
- dst1 = gdImageCreate (newx, newy);
- f = gdImageGetPixel;
- }
-
- /******* Perform 1st shear (horizontal) ******/
- if (dst1 == NULL) {
- return NULL;
- }
-
- if (dAngle == 0.0) {
- /* Returns copy of src */
- gdImageCopy (dst1, src,0,0,0,0,src->sx,src->sy);
- return dst1;
- }
-
- gdImagePaletteCopy (dst1, src);
- dRadAngle = dAngle * ROTATE_DEG2RAD; /* Angle in radians */
- dSinE = sin (dRadAngle);
- dTan = tan (dRadAngle / 2.0);
-
- for (u = 0; u < dst1->sy; u++) {
- if (dTan >= 0.0) {
- dShear = ((double)(u + 0.5)) * dTan;
- } else {
- dShear = ((double)(u - dst1->sy) + 0.5) * dTan;
- }
-
- iShear = (int)floor(dShear);
-
- gdImageSkewX(dst1, src, u, iShear, (dShear - iShear), clrBack);
- }
-
- /* 2nd shear */
- newx = dst1->sx;
-
- if (dSinE > 0.0) {
- dOffset = (src->sx ) * dSinE;
- } else {
- dOffset = -dSinE * (src->sx - newx);
- }
-
- newy = (int) ((double) src->sx * fabs( dSinE ) + (double) src->sy * cos (dRadAngle));
-
- if (src->trueColor) {
- dst2 = gdImageCreateTrueColor (newx, newy);
- f = gdImageGetTrueColorPixel;
- } else {
- dst2 = gdImageCreate (newx, newy);
- f = gdImageGetPixel;
- }
-
- if (dst2 == NULL) {
- gdImageDestroy(dst1);
- return NULL;
- }
-
- for (u = 0; u < dst2->sx; u++, dOffset -= dSinE) {
- iShear = (int)floor (dOffset);
- gdImageSkewY(dst2, dst1, u, iShear, (dOffset - iShear), clrBack);
- }
-
- /* 3rd shear */
- gdImageDestroy(dst1);
-
- newx = (int) ((double)src->sy * fabs (dSinE) + (double)src->sx * cos (dRadAngle)) + 1;
- newy = dst2->sy;
-
- if (src->trueColor) {
- dst3 = gdImageCreateTrueColor (newx, newy);
- f = gdImageGetTrueColorPixel;
- } else {
- dst3 = gdImageCreate (newx, newy);
- f = gdImageGetPixel;
- }
-
- if (dst3 == NULL) {
- gdImageDestroy(dst2);
- return NULL;
- }
- if (dSinE >= 0.0) {
- dOffset = (double)(src->sx - 1) * dSinE * -dTan;
- } else {
- dOffset = dTan * ((double)(src->sx - 1) * -dSinE + (double)(1 - newy));
- }
-
- for (u = 0; u < dst3->sy; u++, dOffset += dTan) {
- int iShear = (int)floor(dOffset);
- gdImageSkewX(dst3, dst2, u, iShear, (dOffset - iShear), clrBack);
- }
-
- gdImageDestroy(dst2);
-
- return dst3;
-}
-
-gdImagePtr gdImageRotate (gdImagePtr src, double dAngle, int clrBack)
-{
- gdImagePtr pMidImg;
- gdImagePtr rotatedImg;
-
- if (src == NULL) {
- return NULL;
- }
-
- while (dAngle >= 360.0) {
- dAngle -= 360.0;
- }
-
- while (dAngle < 0) {
- dAngle += 360.0;
- }
-
- if (dAngle == 90.00) {
- return gdImageRotate90(src);
- }
- if (dAngle == 180.00) {
- return gdImageRotate180(src);
- }
- if(dAngle == 270.00) {
- return gdImageRotate270 ( src);
- }
-
- if ((dAngle > 45.0) && (dAngle <= 135.0)) {
- pMidImg = gdImageRotate90 (src);
- dAngle -= 90.0;
- } else if ((dAngle > 135.0) && (dAngle <= 225.0)) {
- pMidImg = gdImageRotate180 (src);
- dAngle -= 180.0;
- } else if ((dAngle > 225.0) && (dAngle <= 315.0)) {
- pMidImg = gdImageRotate270 (src);
- dAngle -= 270.0;
- } else {
- return gdImageRotate45 (src, dAngle, clrBack);
- }
-
- if (pMidImg == NULL) {
- return NULL;
- }
-
- rotatedImg = gdImageRotate45 (pMidImg, dAngle, clrBack);
- gdImageDestroy(pMidImg);
-
- return rotatedImg;
-}
-/* End Rotate function */
-
-void gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c)
-{
- int i;
- int lx, ly;
- typedef void (*image_line)(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
- image_line draw_line;
-
- if (!n) {
- return;
- }
-
- /* Let it be known that we are drawing a polygon so that the opacity
- * mask doesn't get cleared after each line.
- */
- if (c == gdAntiAliased) {
- im->AA_polygon = 1;
- }
-
- if ( im->antialias) {
- draw_line = gdImageAALine;
- } else {
- draw_line = gdImageLine;
- }
- lx = p->x;
- ly = p->y;
- draw_line(im, lx, ly, p[n - 1].x, p[n - 1].y, c);
- for (i = 1; i < n; i++) {
- p++;
- draw_line(im, lx, ly, p->x, p->y, c);
- lx = p->x;
- ly = p->y;
- }
-
- if (c == gdAntiAliased) {
- im->AA_polygon = 0;
- gdImageAABlend(im);
- }
-}
-
-int gdCompareInt (const void *a, const void *b);
-
-/* THANKS to Kirsten Schulz for the polygon fixes! */
-
-/* The intersection finding technique of this code could be improved
- * by remembering the previous intertersection, and by using the slope.
- * That could help to adjust intersections to produce a nice
- * interior_extrema.
- */
-
-void gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c)
-{
- int i;
- int y;
- int miny, maxy;
- int x1, y1;
- int x2, y2;
- int ind1, ind2;
- int ints;
- int fill_color;
-
- if (!n) {
- return;
- }
-
- if (c == gdAntiAliased) {
- fill_color = im->AA_color;
- } else {
- fill_color = c;
- }
-
- if (!im->polyAllocated) {
- im->polyInts = (int *) gdMalloc(sizeof(int) * n);
- im->polyAllocated = n;
- }
- if (im->polyAllocated < n) {
- while (im->polyAllocated < n) {
- im->polyAllocated *= 2;
- }
- im->polyInts = (int *) gdRealloc(im->polyInts, sizeof(int) * im->polyAllocated);
- }
- miny = p[0].y;
- maxy = p[0].y;
- for (i = 1; i < n; i++) {
- if (p[i].y < miny) {
- miny = p[i].y;
- }
- if (p[i].y > maxy) {
- maxy = p[i].y;
- }
- }
- /* Fix in 1.3: count a vertex only once */
- for (y = miny; y <= maxy; y++) {
- /*1.4 int interLast = 0; */
- /* int dirLast = 0; */
- /* int interFirst = 1; */
- ints = 0;
- for (i = 0; i < n; i++) {
- if (!i) {
- ind1 = n - 1;
- ind2 = 0;
- } else {
- ind1 = i - 1;
- ind2 = i;
- }
- y1 = p[ind1].y;
- y2 = p[ind2].y;
- if (y1 < y2) {
- x1 = p[ind1].x;
- x2 = p[ind2].x;
- } else if (y1 > y2) {
- y2 = p[ind1].y;
- y1 = p[ind2].y;
- x2 = p[ind1].x;
- x1 = p[ind2].x;
- } else {
- continue;
- }
- /* Do the following math as float intermediately, and round to ensure
- * that Polygon and FilledPolygon for the same set of points have the
- * same footprint.
- */
- if (y >= y1 && y < y2) {
- im->polyInts[ints++] = (float) ((y - y1) * (x2 - x1)) / (float) (y2 - y1) + 0.5 + x1;
- } else if (y == maxy && y > y1 && y <= y2) {
- im->polyInts[ints++] = (float) ((y - y1) * (x2 - x1)) / (float) (y2 - y1) + 0.5 + x1;
- }
- }
- qsort(im->polyInts, ints, sizeof(int), gdCompareInt);
-
- for (i = 0; i < ints; i += 2) {
- gdImageLine(im, im->polyInts[i], y, im->polyInts[i + 1], y, fill_color);
- }
- }
-
- /* If we are drawing this AA, then redraw the border with AA lines. */
- if (c == gdAntiAliased) {
- gdImagePolygon(im, p, n, c);
- }
-}
-
-int gdCompareInt (const void *a, const void *b)
-{
- return (*(const int *) a) - (*(const int *) b);
-}
-
-void gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels)
-{
- if (im->style) {
- gdFree(im->style);
- }
- im->style = (int *) gdMalloc(sizeof(int) * noOfPixels);
- memcpy(im->style, style, sizeof(int) * noOfPixels);
- im->styleLength = noOfPixels;
- im->stylePos = 0;
-}
-
-void gdImageSetThickness (gdImagePtr im, int thickness)
-{
- im->thick = thickness;
-}
-
-void gdImageSetBrush (gdImagePtr im, gdImagePtr brush)
-{
- int i;
- im->brush = brush;
- if (!im->trueColor && !im->brush->trueColor) {
- for (i = 0; i < gdImageColorsTotal(brush); i++) {
- int index;
- index = gdImageColorResolveAlpha(im, gdImageRed(brush, i), gdImageGreen(brush, i), gdImageBlue(brush, i), gdImageAlpha(brush, i));
- im->brushColorMap[i] = index;
- }
- }
-}
-
-void gdImageSetTile (gdImagePtr im, gdImagePtr tile)
-{
- int i;
- im->tile = tile;
- if (!im->trueColor && !im->tile->trueColor) {
- for (i = 0; i < gdImageColorsTotal(tile); i++) {
- int index;
- index = gdImageColorResolveAlpha(im, gdImageRed(tile, i), gdImageGreen(tile, i), gdImageBlue(tile, i), gdImageAlpha(tile, i));
- im->tileColorMap[i] = index;
- }
- }
-}
-
-void gdImageSetAntiAliased (gdImagePtr im, int c)
-{
- im->AA = 1;
- im->AA_color = c;
- im->AA_dont_blend = -1;
-}
-
-void gdImageSetAntiAliasedDontBlend (gdImagePtr im, int c, int dont_blend)
-{
- im->AA = 1;
- im->AA_color = c;
- im->AA_dont_blend = dont_blend;
-}
-
-
-void gdImageInterlace (gdImagePtr im, int interlaceArg)
-{
- im->interlace = interlaceArg;
-}
-
-int gdImageCompare (gdImagePtr im1, gdImagePtr im2)
-{
- int x, y;
- int p1, p2;
- int cmpStatus = 0;
- int sx, sy;
-
- if (im1->interlace != im2->interlace) {
- cmpStatus |= GD_CMP_INTERLACE;
- }
-
- if (im1->transparent != im2->transparent) {
- cmpStatus |= GD_CMP_TRANSPARENT;
- }
-
- if (im1->trueColor != im2->trueColor) {
- cmpStatus |= GD_CMP_TRUECOLOR;
- }
-
- sx = im1->sx;
- if (im1->sx != im2->sx) {
- cmpStatus |= GD_CMP_SIZE_X + GD_CMP_IMAGE;
- if (im2->sx < im1->sx) {
- sx = im2->sx;
- }
- }
-
- sy = im1->sy;
- if (im1->sy != im2->sy) {
- cmpStatus |= GD_CMP_SIZE_Y + GD_CMP_IMAGE;
- if (im2->sy < im1->sy) {
- sy = im2->sy;
- }
- }
-
- if (im1->colorsTotal != im2->colorsTotal) {
- cmpStatus |= GD_CMP_NUM_COLORS;
- }
-
- for (y = 0; y < sy; y++) {
- for (x = 0; x < sx; x++) {
- p1 = im1->trueColor ? gdImageTrueColorPixel(im1, x, y) : gdImagePalettePixel(im1, x, y);
- p2 = im2->trueColor ? gdImageTrueColorPixel(im2, x, y) : gdImagePalettePixel(im2, x, y);
-
- if (gdImageRed(im1, p1) != gdImageRed(im2, p2)) {
- cmpStatus |= GD_CMP_COLOR + GD_CMP_IMAGE;
- break;
- }
- if (gdImageGreen(im1, p1) != gdImageGreen(im2, p2)) {
- cmpStatus |= GD_CMP_COLOR + GD_CMP_IMAGE;
- break;
- }
- if (gdImageBlue(im1, p1) != gdImageBlue(im2, p2)) {
- cmpStatus |= GD_CMP_COLOR + GD_CMP_IMAGE;
- break;
- }
-#if 0
- /* Soon we'll add alpha channel to palettes */
- if (gdImageAlpha(im1, p1) != gdImageAlpha(im2, p2)) {
- cmpStatus |= GD_CMP_COLOR + GD_CMP_IMAGE;
- break;
- }
-#endif
- }
- if (cmpStatus & GD_CMP_COLOR) {
- break;
- }
- }
-
- return cmpStatus;
-}
-
-int
-gdAlphaBlend (int dst, int src)
-{
- /* 2.0.12: TBB: alpha in the destination should be a
- * component of the result. Thanks to Frank Warmerdam for
- * pointing out the issue.
- */
- return ((((gdTrueColorGetAlpha (src) *
- gdTrueColorGetAlpha (dst)) / gdAlphaMax) << 24) +
- ((((gdAlphaTransparent - gdTrueColorGetAlpha (src)) *
- gdTrueColorGetRed (src) / gdAlphaMax) +
- (gdTrueColorGetAlpha (src) *
- gdTrueColorGetRed (dst)) / gdAlphaMax) << 16) +
- ((((gdAlphaTransparent - gdTrueColorGetAlpha (src)) *
- gdTrueColorGetGreen (src) / gdAlphaMax) +
- (gdTrueColorGetAlpha (src) *
- gdTrueColorGetGreen (dst)) / gdAlphaMax) << 8) +
- (((gdAlphaTransparent - gdTrueColorGetAlpha (src)) *
- gdTrueColorGetBlue (src) / gdAlphaMax) +
- (gdTrueColorGetAlpha (src) *
- gdTrueColorGetBlue (dst)) / gdAlphaMax));
-}
-
-void gdImageAlphaBlending (gdImagePtr im, int alphaBlendingArg)
-{
- im->alphaBlendingFlag = alphaBlendingArg;
-}
-
-void gdImageAntialias (gdImagePtr im, int antialias)
-{
- if (im->trueColor){
- im->antialias = antialias;
- }
-}
-
-void gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg)
-{
- im->saveAlphaFlag = saveAlphaArg;
-}
-
-static int gdFullAlphaBlend (int dst, int src)
-{
- int a1, a2;
- a1 = gdAlphaTransparent - gdTrueColorGetAlpha(src);
- a2 = gdAlphaTransparent - gdTrueColorGetAlpha(dst);
-
- return ( ((gdAlphaTransparent - ((a1+a2)-(a1*a2/gdAlphaMax))) << 24) +
- (gdAlphaBlendColor( gdTrueColorGetRed(src), gdTrueColorGetRed(dst), a1, a2 ) << 16) +
- (gdAlphaBlendColor( gdTrueColorGetGreen(src), gdTrueColorGetGreen(dst), a1, a2 ) << 8) +
- (gdAlphaBlendColor( gdTrueColorGetBlue(src), gdTrueColorGetBlue(dst), a1, a2 ))
- );
-}
-
-static int gdAlphaBlendColor( int b1, int b2, int a1, int a2 )
-{
- int c;
- int w;
-
- /* deal with special cases */
-
- if( (gdAlphaMax == a1) || (0 == a2) ) {
- /* the back pixel can't be seen */
- return b1;
- } else if(0 == a1) {
- /* the front pixel can't be seen */
- return b2;
- } else if(gdAlphaMax == a2) {
- /* the back pixel is opaque */
- return ( a1 * b1 + ( gdAlphaMax - a1 ) * b2 ) / gdAlphaMax;
- }
-
- /* the general case */
- w = ( a1 * ( gdAlphaMax - a2 ) / ( gdAlphaMax - a1 * a2 / gdAlphaMax ) * b1 + \
- a2 * ( gdAlphaMax - a1 ) / ( gdAlphaMax - a1 * a2 / gdAlphaMax ) * b2 ) / gdAlphaMax;
- c = (a2 * b2 + ( gdAlphaMax - a2 ) * w ) / gdAlphaMax;
- return ( a1 * b1 + ( gdAlphaMax - a1 ) * c ) / gdAlphaMax;
-}
-
-static int gdLayerOverlay (int dst, int src)
-{
- int a1, a2;
- a1 = gdAlphaMax - gdTrueColorGetAlpha(dst);
- a2 = gdAlphaMax - gdTrueColorGetAlpha(src);
- return ( ((gdAlphaMax - a1*a2/gdAlphaMax) << 24) +
- (gdAlphaOverlayColor( gdTrueColorGetRed(src), gdTrueColorGetRed(dst), gdRedMax ) << 16) +
- (gdAlphaOverlayColor( gdTrueColorGetGreen(src), gdTrueColorGetGreen(dst), gdGreenMax ) << 8) +
- (gdAlphaOverlayColor( gdTrueColorGetBlue(src), gdTrueColorGetBlue(dst), gdBlueMax ))
- );
-}
-
-static int gdAlphaOverlayColor (int src, int dst, int max )
-{
- /* this function implements the algorithm
- *
- * for dst[rgb] < 0.5,
- * c[rgb] = 2.src[rgb].dst[rgb]
- * and for dst[rgb] > 0.5,
- * c[rgb] = -2.src[rgb].dst[rgb] + 2.dst[rgb] + 2.src[rgb] - 1
- *
- */
-
- dst = dst << 1;
- if( dst > max ) {
- /* in the "light" zone */
- return dst + (src << 1) - (dst * src / max) - max;
- } else {
- /* in the "dark" zone */
- return dst * src / max;
- }
-}
-
-void gdImageSetClip (gdImagePtr im, int x1, int y1, int x2, int y2)
-{
- if (x1 < 0) {
- x1 = 0;
- }
- if (x1 >= im->sx) {
- x1 = im->sx - 1;
- }
- if (x2 < 0) {
- x2 = 0;
- }
- if (x2 >= im->sx) {
- x2 = im->sx - 1;
- }
- if (y1 < 0) {
- y1 = 0;
- }
- if (y1 >= im->sy) {
- y1 = im->sy - 1;
- }
- if (y2 < 0) {
- y2 = 0;
- }
- if (y2 >= im->sy) {
- y2 = im->sy - 1;
- }
- im->cx1 = x1;
- im->cy1 = y1;
- im->cx2 = x2;
- im->cy2 = y2;
-}
-
-void gdImageGetClip (gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P)
-{
- *x1P = im->cx1;
- *y1P = im->cy1;
- *x2P = im->cx2;
- *y2P = im->cy2;
-}
-
-
-/* Filters function added on 2003/12
- * by Pierre-Alain Joye (pajoye@pearfr.org)
- **/
-/* Begin filters function */
-#ifndef HAVE_GET_TRUE_COLOR
-#define GET_PIXEL_FUNCTION(src)(src->trueColor?gdImageGetTrueColorPixel:gdImageGetPixel)
-#endif
-
-/* invert src image */
-int gdImageNegate(gdImagePtr src)
-{
- int x, y;
- int r,g,b,a;
- int new_pxl, pxl;
- typedef int (*FuncPtr)(gdImagePtr, int, int);
- FuncPtr f;
-
- if (src==NULL) {
- return 0;
- }
-
- f = GET_PIXEL_FUNCTION(src);
-
- for (y=0; y<src->sy; ++y) {
- for (x=0; x<src->sx; ++x) {
- pxl = f (src, x, y);
- r = gdImageRed(src, pxl);
- g = gdImageGreen(src, pxl);
- b = gdImageBlue(src, pxl);
- a = gdImageAlpha(src, pxl);
-
- new_pxl = gdImageColorAllocateAlpha(src, 255-r, 255-g, 255-b, a);
- if (new_pxl == -1) {
- new_pxl = gdImageColorClosestAlpha(src, 255-r, 255-g, 255-b, a);
- }
- if ((y >= 0) && (y < src->sy)) {
- gdImageSetPixel (src, x, y, new_pxl);
- }
- }
- }
- return 1;
-}
-
-/* Convert the image src to a grayscale image */
-int gdImageGrayScale(gdImagePtr src)
-{
- int x, y;
- int r,g,b,a;
- int new_pxl, pxl;
- typedef int (*FuncPtr)(gdImagePtr, int, int);
- FuncPtr f;
- f = GET_PIXEL_FUNCTION(src);
-
- if (src==NULL) {
- return 0;
- }
-
- for (y=0; y<src->sy; ++y) {
- for (x=0; x<src->sx; ++x) {
- pxl = f (src, x, y);
- r = gdImageRed(src, pxl);
- g = gdImageGreen(src, pxl);
- b = gdImageBlue(src, pxl);
- a = gdImageAlpha(src, pxl);
- r = g = b = (int) (.299 * r + .587 * g + .114 * b);
-
- new_pxl = gdImageColorAllocateAlpha(src, r, g, b, a);
- if (new_pxl == -1) {
- new_pxl = gdImageColorClosestAlpha(src, r, g, b, a);
- }
- if ((y >= 0) && (y < src->sy)) {
- gdImageSetPixel (src, x, y, new_pxl);
- }
- }
- }
- return 1;
-}
-
-/* Set the brightness level <level> for the image src */
-int gdImageBrightness(gdImagePtr src, int brightness)
-{
- int x, y;
- int r,g,b,a;
- int new_pxl, pxl;
- typedef int (*FuncPtr)(gdImagePtr, int, int);
- FuncPtr f;
- f = GET_PIXEL_FUNCTION(src);
-
- if (src==NULL || (brightness < -255 || brightness>255)) {
- return 0;
- }
-
- if (brightness==0) {
- return 1;
- }
-
- for (y=0; y<src->sy; ++y) {
- for (x=0; x<src->sx; ++x) {
- pxl = f (src, x, y);
-
- r = gdImageRed(src, pxl);
- g = gdImageGreen(src, pxl);
- b = gdImageBlue(src, pxl);
- a = gdImageAlpha(src, pxl);
-
- r = r + brightness;
- g = g + brightness;
- b = b + brightness;
-
- r = (r > 255)? 255 : ((r < 0)? 0:r);
- g = (g > 255)? 255 : ((g < 0)? 0:g);
- b = (b > 255)? 255 : ((b < 0)? 0:b);
-
- new_pxl = gdImageColorAllocateAlpha(src, (int)r, (int)g, (int)b, a);
- if (new_pxl == -1) {
- new_pxl = gdImageColorClosestAlpha(src, (int)r, (int)g, (int)b, a);
- }
- if ((y >= 0) && (y < src->sy)) {
- gdImageSetPixel (src, x, y, new_pxl);
- }
- }
- }
- return 1;
-}
-
-
-int gdImageContrast(gdImagePtr src, double contrast)
-{
- int x, y;
- int r,g,b,a;
- double rf,gf,bf;
- int new_pxl, pxl;
- typedef int (*FuncPtr)(gdImagePtr, int, int);
-
- FuncPtr f;
- f = GET_PIXEL_FUNCTION(src);
-
- if (src==NULL) {
- return 0;
- }
-
- contrast = (double)(100.0-contrast)/100.0;
- contrast = contrast*contrast;
-
- for (y=0; y<src->sy; ++y) {
- for (x=0; x<src->sx; ++x) {
- pxl = f(src, x, y);
-
- r = gdImageRed(src, pxl);
- g = gdImageGreen(src, pxl);
- b = gdImageBlue(src, pxl);
- a = gdImageAlpha(src, pxl);
-
- rf = (double)r/255.0;
- rf = rf-0.5;
- rf = rf*contrast;
- rf = rf+0.5;
- rf = rf*255.0;
-
- bf = (double)b/255.0;
- bf = bf-0.5;
- bf = bf*contrast;
- bf = bf+0.5;
- bf = bf*255.0;
-
- gf = (double)g/255.0;
- gf = gf-0.5;
- gf = gf*contrast;
- gf = gf+0.5;
- gf = gf*255.0;
-
- rf = (rf > 255.0)? 255.0 : ((rf < 0.0)? 0.0:rf);
- gf = (gf > 255.0)? 255.0 : ((gf < 0.0)? 0.0:gf);
- bf = (bf > 255.0)? 255.0 : ((bf < 0.0)? 0.0:bf);
-
- new_pxl = gdImageColorAllocateAlpha(src, (int)rf, (int)gf, (int)bf, a);
- if (new_pxl == -1) {
- new_pxl = gdImageColorClosestAlpha(src, (int)rf, (int)gf, (int)bf, a);
- }
- if ((y >= 0) && (y < src->sy)) {
- gdImageSetPixel (src, x, y, new_pxl);
- }
- }
- }
- return 1;
-}
-
-
-int gdImageColor(gdImagePtr src, int red, int green, int blue)
-{
- int x, y;
- int r,g,b,a;
- int new_pxl, pxl;
- typedef int (*FuncPtr)(gdImagePtr, int, int);
- FuncPtr f;
-
- if (src==NULL || (red<-255||red>255) || (green<-255||green>255) || (blue<-255||blue>255)) {
- return 0;
- }
-
- f = GET_PIXEL_FUNCTION(src);
-
- for (y=0; y<src->sy; ++y) {
- for (x=0; x<src->sx; ++x) {
- pxl = f(src, x, y);
- r = gdImageRed(src, pxl);
- g = gdImageGreen(src, pxl);
- b = gdImageBlue(src, pxl);
- a = gdImageAlpha(src, pxl);
-
- r = r + red;
- g = g + green;
- b = b + blue;
-
- r = (r > 255)? 255 : ((r < 0)? 0:r);
- g = (g > 255)? 255 : ((g < 0)? 0:g);
- b = (b > 255)? 255 : ((b < 0)? 0:b);
-
- new_pxl = gdImageColorAllocateAlpha(src, (int)r, (int)g, (int)b, a);
- if (new_pxl == -1) {
- new_pxl = gdImageColorClosestAlpha(src, (int)r, (int)g, (int)b, a);
- }
- if ((y >= 0) && (y < src->sy)) {
- gdImageSetPixel (src, x, y, new_pxl);
- }
- }
- }
- return 1;
-}
-
-int gdImageConvolution(gdImagePtr src, float filter[3][3], float filter_div, float offset)
-{
- int x, y, i, j, new_a;
- float new_r, new_g, new_b;
- int new_pxl, pxl=0;
- gdImagePtr srcback;
- typedef int (*FuncPtr)(gdImagePtr, int, int);
- FuncPtr f;
-
- if (src==NULL) {
- return 0;
- }
-
- /* We need the orinal image with each safe neoghb. pixel */
- srcback = gdImageCreateTrueColor (src->sx, src->sy);
- gdImageCopy(srcback, src,0,0,0,0,src->sx,src->sy);
-
- if (srcback==NULL) {
- return 0;
- }
-
- f = GET_PIXEL_FUNCTION(src);
-
- for ( y=0; y<src->sy; y++) {
- for(x=0; x<src->sx; x++) {
- new_r = new_g = new_b = 0;
- new_a = gdImageAlpha(srcback, pxl);
-
- for (j=0; j<3; j++) {
- for (i=0; i<3; i++) {
- pxl = f(srcback, x-(3>>1)+i, y-(3>>1)+j);
- new_r += (float)gdImageRed(srcback, pxl) * filter[j][i];
- new_g += (float)gdImageGreen(srcback, pxl) * filter[j][i];
- new_b += (float)gdImageBlue(srcback, pxl) * filter[j][i];
- }
- }
-
- new_r = (new_r/filter_div)+offset;
- new_g = (new_g/filter_div)+offset;
- new_b = (new_b/filter_div)+offset;
-
- new_r = (new_r > 255.0f)? 255.0f : ((new_r < 0.0f)? 0.0f:new_r);
- new_g = (new_g > 255.0f)? 255.0f : ((new_g < 0.0f)? 0.0f:new_g);
- new_b = (new_b > 255.0f)? 255.0f : ((new_b < 0.0f)? 0.0f:new_b);
-
- new_pxl = gdImageColorAllocateAlpha(src, (int)new_r, (int)new_g, (int)new_b, new_a);
- if (new_pxl == -1) {
- new_pxl = gdImageColorClosestAlpha(src, (int)new_r, (int)new_g, (int)new_b, new_a);
- }
- if ((y >= 0) && (y < src->sy)) {
- gdImageSetPixel (src, x, y, new_pxl);
- }
- }
- }
- gdImageDestroy(srcback);
- return 1;
-}
-
-int gdImageSelectiveBlur( gdImagePtr src)
-{
- int x, y, i, j;
- float new_r, new_g, new_b;
- int new_pxl, cpxl, pxl, new_a=0;
- float flt_r [3][3];
- float flt_g [3][3];
- float flt_b [3][3];
- float flt_r_sum, flt_g_sum, flt_b_sum;
-
- gdImagePtr srcback;
- typedef int (*FuncPtr)(gdImagePtr, int, int);
- FuncPtr f;
-
- if (src==NULL) {
- return 0;
- }
-
- /* We need the orinal image with each safe neoghb. pixel */
- srcback = gdImageCreateTrueColor (src->sx, src->sy);
- gdImageCopy(srcback, src,0,0,0,0,src->sx,src->sy);
-
- if (srcback==NULL) {
- return 0;
- }
-
- f = GET_PIXEL_FUNCTION(src);
-
- for(y = 0; y<src->sy; y++) {
- for (x=0; x<src->sx; x++) {
- flt_r_sum = flt_g_sum = flt_b_sum = 0.0;
- cpxl = f(src, x, y);
-
- for (j=0; j<3; j++) {
- for (i=0; i<3; i++) {
- if ((j == 1) && (i == 1)) {
- flt_r[1][1] = flt_g[1][1] = flt_b[1][1] = 0.5;
- } else {
- pxl = f(src, x-(3>>1)+i, y-(3>>1)+j);
- new_a = gdImageAlpha(srcback, pxl);
-
- new_r = ((float)gdImageRed(srcback, cpxl)) - ((float)gdImageRed (srcback, pxl));
-
- if (new_r < 0.0f) {
- new_r = -new_r;
- }
- if (new_r != 0) {
- flt_r[j][i] = 1.0f/new_r;
- } else {
- flt_r[j][i] = 1.0f;
- }
-
- new_g = ((float)gdImageGreen(srcback, cpxl)) - ((float)gdImageGreen(srcback, pxl));
-
- if (new_g < 0.0f) {
- new_g = -new_g;
- }
- if (new_g != 0) {
- flt_g[j][i] = 1.0f/new_g;
- } else {
- flt_g[j][i] = 1.0f;
- }
-
- new_b = ((float)gdImageBlue(srcback, cpxl)) - ((float)gdImageBlue(srcback, pxl));
-
- if (new_b < 0.0f) {
- new_b = -new_b;
- }
- if (new_b != 0) {
- flt_b[j][i] = 1.0f/new_b;
- } else {
- flt_b[j][i] = 1.0f;
- }
- }
-
- flt_r_sum += flt_r[j][i];
- flt_g_sum += flt_g[j][i];
- flt_b_sum += flt_b [j][i];
- }
- }
-
- for (j=0; j<3; j++) {
- for (i=0; i<3; i++) {
- if (flt_r_sum != 0.0) {
- flt_r[j][i] /= flt_r_sum;
- }
- if (flt_g_sum != 0.0) {
- flt_g[j][i] /= flt_g_sum;
- }
- if (flt_b_sum != 0.0) {
- flt_b [j][i] /= flt_b_sum;
- }
- }
- }
-
- new_r = new_g = new_b = 0.0;
-
- for (j=0; j<3; j++) {
- for (i=0; i<3; i++) {
- pxl = f(src, x-(3>>1)+i, y-(3>>1)+j);
- new_r += (float)gdImageRed(srcback, pxl) * flt_r[j][i];
- new_g += (float)gdImageGreen(srcback, pxl) * flt_g[j][i];
- new_b += (float)gdImageBlue(srcback, pxl) * flt_b[j][i];
- }
- }
-
- new_r = (new_r > 255.0f)? 255.0f : ((new_r < 0.0f)? 0.0f:new_r);
- new_g = (new_g > 255.0f)? 255.0f : ((new_g < 0.0f)? 0.0f:new_g);
- new_b = (new_b > 255.0f)? 255.0f : ((new_b < 0.0f)? 0.0f:new_b);
- new_pxl = gdImageColorAllocateAlpha(src, (int)new_r, (int)new_g, (int)new_b, new_a);
- if (new_pxl == -1) {
- new_pxl = gdImageColorClosestAlpha(src, (int)new_r, (int)new_g, (int)new_b, new_a);
- }
- if ((y >= 0) && (y < src->sy)) {
- gdImageSetPixel (src, x, y, new_pxl);
- }
- }
- }
- gdImageDestroy(srcback);
- return 1;
-}
-
-int gdImageEdgeDetectQuick(gdImagePtr src)
-{
- float filter[3][3] = {{1.0,1.0,1.0},
- {0.0,0.0,0.0},
- {-1.0,-1.0,-1.0}};
-
- return gdImageConvolution(src, filter, 1, 127);
-}
-
-int gdImageGaussianBlur(gdImagePtr im)
-{
- float filter[3][3] = {{1.0,2.0,1.0},
- {2.0,4.0,2.0},
- {1.0,2.0,1.0}};
-
- return gdImageConvolution(im, filter, 16, 0);
-}
-
-int gdImageEmboss(gdImagePtr im)
-{
- float filter[3][3] = {{-1.0,0.0,-1.0},
- {0.0,4.0,0.0},
- {-1.0,0.0,-1.0}};
-
- return gdImageConvolution(im, filter, 1, 127);
-}
-
-int gdImageMeanRemoval(gdImagePtr im)
-{
- float filter[3][3] = {{-1.0,-1.0,-1.0},
- {-1.0,9.0,-1.0},
- {-1.0,-1.0,-1.0}};
-
- return gdImageConvolution(im, filter, 1, 0);
-}
-
-int gdImageSmooth(gdImagePtr im, float weight)
-{
- float filter[3][3] = {{1.0,1.0,1.0},
- {1.0,0.0,1.0},
- {1.0,1.0,1.0}};
-
- filter[1][1] = weight;
-
- return gdImageConvolution(im, filter, weight+8, 0);
-}
-/* End filters function */
diff --git a/ext/gd/libgd/gd.h b/ext/gd/libgd/gd.h
deleted file mode 100644
index 2f982916ed..0000000000
--- a/ext/gd/libgd/gd.h
+++ /dev/null
@@ -1,644 +0,0 @@
-#ifndef GD_H
-#define GD_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef WIN32
-/* default fontpath for unix systems */
-#define DEFAULT_FONTPATH "/usr/X11R6/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/truetype:/usr/X11R6/lib/X11/fonts/TTF:/usr/share/fonts/TrueType:/usr/share/fonts/truetype:/usr/openwin/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/Type1:."
-#define PATHSEPARATOR ":"
-#else
-/* default fontpath for windows systems */
-#define DEFAULT_FONTPATH "c:\\winnt\\fonts;."
-#define PATHSEPARATOR ";"
-#endif
-
-/* gd.h: declarations file for the graphic-draw module.
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation. This software is provided "AS IS." Thomas Boutell and
- * Boutell.Com, Inc. disclaim all warranties, either express or implied,
- * including but not limited to implied warranties of merchantability and
- * fitness for a particular purpose, with respect to this code and accompanying
- * documentation. */
-
-/* stdio is needed for file I/O. */
-#include <stdio.h>
-#include "gd_io.h"
-
-void php_gd_error_ex(int type, const char *format, ...);
-
-void php_gd_error(const char *format, ...);
-
-
-/* The maximum number of palette entries in palette-based images.
- In the wonderful new world of gd 2.0, you can of course have
- many more colors when using truecolor mode. */
-
-#define gdMaxColors 256
-
-/* Image type. See functions below; you will not need to change
- the elements directly. Use the provided macros to
- access sx, sy, the color table, and colorsTotal for
- read-only purposes. */
-
-/* If 'truecolor' is set true, the image is truecolor;
- pixels are represented by integers, which
- must be 32 bits wide or more.
-
- True colors are repsented as follows:
-
- ARGB
-
- Where 'A' (alpha channel) occupies only the
- LOWER 7 BITS of the MSB. This very small
- loss of alpha channel resolution allows gd 2.x
- to keep backwards compatibility by allowing
- signed integers to be used to represent colors,
- and negative numbers to represent special cases,
- just as in gd 1.x. */
-
-#define gdAlphaMax 127
-#define gdAlphaOpaque 0
-#define gdAlphaTransparent 127
-#define gdRedMax 255
-#define gdGreenMax 255
-#define gdBlueMax 255
-#define gdTrueColorGetAlpha(c) (((c) & 0x7F000000) >> 24)
-#define gdTrueColorGetRed(c) (((c) & 0xFF0000) >> 16)
-#define gdTrueColorGetGreen(c) (((c) & 0x00FF00) >> 8)
-#define gdTrueColorGetBlue(c) ((c) & 0x0000FF)
-#define gdEffectReplace 0
-#define gdEffectAlphaBlend 1
-#define gdEffectNormal 2
-#define gdEffectOverlay 3
-
-
-/* This function accepts truecolor pixel values only. The
- source color is composited with the destination color
- based on the alpha channel value of the source color.
- The resulting color is opaque. */
-
-int gdAlphaBlend(int dest, int src);
-
-typedef struct gdImageStruct {
- /* Palette-based image pixels */
- unsigned char ** pixels;
- int sx;
- int sy;
- /* These are valid in palette images only. See also
- 'alpha', which appears later in the structure to
- preserve binary backwards compatibility */
- int colorsTotal;
- int red[gdMaxColors];
- int green[gdMaxColors];
- int blue[gdMaxColors];
- int open[gdMaxColors];
- /* For backwards compatibility, this is set to the
- first palette entry with 100% transparency,
- and is also set and reset by the
- gdImageColorTransparent function. Newer
- applications can allocate palette entries
- with any desired level of transparency; however,
- bear in mind that many viewers, notably
- many web browsers, fail to implement
- full alpha channel for PNG and provide
- support for full opacity or transparency only. */
- int transparent;
- int *polyInts;
- int polyAllocated;
- struct gdImageStruct *brush;
- struct gdImageStruct *tile;
- int brushColorMap[gdMaxColors];
- int tileColorMap[gdMaxColors];
- int styleLength;
- int stylePos;
- int *style;
- int interlace;
- /* New in 2.0: thickness of line. Initialized to 1. */
- int thick;
- /* New in 2.0: alpha channel for palettes. Note that only
- Macintosh Internet Explorer and (possibly) Netscape 6
- really support multiple levels of transparency in
- palettes, to my knowledge, as of 2/15/01. Most
- common browsers will display 100% opaque and
- 100% transparent correctly, and do something
- unpredictable and/or undesirable for levels
- in between. TBB */
- int alpha[gdMaxColors];
- /* Truecolor flag and pixels. New 2.0 fields appear here at the
- end to minimize breakage of existing object code. */
- int trueColor;
- int ** tpixels;
- /* Should alpha channel be copied, or applied, each time a
- pixel is drawn? This applies to truecolor images only.
- No attempt is made to alpha-blend in palette images,
- even if semitransparent palette entries exist.
- To do that, build your image as a truecolor image,
- then quantize down to 8 bits. */
- int alphaBlendingFlag;
- /* Should antialias functions be used */
- int antialias;
- /* Should the alpha channel of the image be saved? This affects
- PNG at the moment; other future formats may also
- have that capability. JPEG doesn't. */
- int saveAlphaFlag;
-
-
- /* 2.0.12: anti-aliased globals */
- int AA;
- int AA_color;
- int AA_dont_blend;
- unsigned char **AA_opacity;
- int AA_polygon;
- /* Stored and pre-computed variables for determining the perpendicular
- * distance from a point to the anti-aliased line being drawn:
- */
- int AAL_x1;
- int AAL_y1;
- int AAL_x2;
- int AAL_y2;
- int AAL_Bx_Ax;
- int AAL_By_Ay;
- int AAL_LAB_2;
- float AAL_LAB;
-
- /* 2.0.12: simple clipping rectangle. These values must be checked for safety when set; please use gdImageSetClip */
- int cx1;
- int cy1;
- int cx2;
- int cy2;
-} gdImage;
-
-typedef gdImage * gdImagePtr;
-
-typedef struct {
- /* # of characters in font */
- int nchars;
- /* First character is numbered... (usually 32 = space) */
- int offset;
- /* Character width and height */
- int w;
- int h;
- /* Font data; array of characters, one row after another.
- Easily included in code, also easily loaded from
- data files. */
- char *data;
-} gdFont;
-
-/* Text functions take these. */
-typedef gdFont *gdFontPtr;
-
-/* For backwards compatibility only. Use gdImageSetStyle()
- for MUCH more flexible line drawing. Also see
- gdImageSetBrush(). */
-#define gdDashSize 4
-
-/* Special colors. */
-
-#define gdStyled (-2)
-#define gdBrushed (-3)
-#define gdStyledBrushed (-4)
-#define gdTiled (-5)
-
-/* NOT the same as the transparent color index.
- This is used in line styles only. */
-#define gdTransparent (-6)
-
-#define gdAntiAliased (-7)
-
-/* Functions to manipulate images. */
-
-/* Creates a palette-based image (up to 256 colors). */
-gdImagePtr gdImageCreate(int sx, int sy);
-
-/* An alternate name for the above (2.0). */
-#define gdImageCreatePalette gdImageCreate
-
-/* Creates a truecolor image (millions of colors). */
-gdImagePtr gdImageCreateTrueColor(int sx, int sy);
-
-/* Creates an image from various file types. These functions
- return a palette or truecolor image based on the
- nature of the file being loaded. Truecolor PNG
- stays truecolor; palette PNG stays palette-based;
- JPEG is always truecolor. */
-gdImagePtr gdImageCreateFromPng(FILE *fd);
-gdImagePtr gdImageCreateFromPngCtx(gdIOCtxPtr in);
-gdImagePtr gdImageCreateFromWBMP(FILE *inFile);
-gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtx *infile);
-gdImagePtr gdImageCreateFromJpeg(FILE *infile);
-gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile);
-
-/* A custom data source. */
-/* The source function must return -1 on error, otherwise the number
- of bytes fetched. 0 is EOF, not an error! */
-/* context will be passed to your source function. */
-
-typedef struct {
- int (*source) (void *context, char *buffer, int len);
- void *context;
-} gdSource, *gdSourcePtr;
-
-gdImagePtr gdImageCreateFromPngSource(gdSourcePtr in);
-
-gdImagePtr gdImageCreateFromGd(FILE *in);
-gdImagePtr gdImageCreateFromGdCtx(gdIOCtxPtr in);
-
-gdImagePtr gdImageCreateFromGd2(FILE *in);
-gdImagePtr gdImageCreateFromGd2Ctx(gdIOCtxPtr in);
-
-gdImagePtr gdImageCreateFromGd2Part(FILE *in, int srcx, int srcy, int w, int h);
-gdImagePtr gdImageCreateFromGd2PartCtx(gdIOCtxPtr in, int srcx, int srcy, int w, int h);
-
-gdImagePtr gdImageCreateFromXbm(FILE *fd);
-
-gdImagePtr gdImageCreateFromXpm (char *filename);
-
-void gdImageDestroy(gdImagePtr im);
-
-/* Replaces or blends with the background depending on the
- most recent call to gdImageAlphaBlending and the
- alpha channel value of 'color'; default is to overwrite.
- Tiling and line styling are also implemented
- here. All other gd drawing functions pass through this call,
- allowing for many useful effects. */
-
-void gdImageSetPixel(gdImagePtr im, int x, int y, int color);
-
-int gdImageGetPixel(gdImagePtr im, int x, int y);
-
-void gdImageAABlend(gdImagePtr im);
-
-void gdImageLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
-void gdImageAALine(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
-
-/* For backwards compatibility only. Use gdImageSetStyle()
- for much more flexible line drawing. */
-void gdImageDashedLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
-/* Corners specified (not width and height). Upper left first, lower right
- second. */
-void gdImageRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
-/* Solid bar. Upper left corner first, lower right corner second. */
-void gdImageFilledRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
-void gdImageSetClip(gdImagePtr im, int x1, int y1, int x2, int y2);
-void gdImageGetClip(gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P);
-void gdImageChar(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color);
-void gdImageCharUp(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color);
-void gdImageString(gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color);
-void gdImageStringUp(gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color);
-void gdImageString16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color);
-void gdImageStringUp16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color);
-
-/* clean up after using fonts in gdImageStringFT() */
-void gdFreeFontCache();
-
-/* Calls gdImageStringFT. Provided for backwards compatibility only. */
-char *gdImageStringTTF(gdImage *im, int *brect, int fg, char *fontlist,
- double ptsize, double angle, int x, int y, char *string);
-
-/* FreeType 2 text output */
-char *gdImageStringFT(gdImage *im, int *brect, int fg, char *fontlist,
- double ptsize, double angle, int x, int y, char *string);
-
-typedef struct {
- double linespacing; /* fine tune line spacing for '\n' */
- int flags; /* Logical OR of gdFTEX_ values */
- int charmap; /* TBB: 2.0.12: may be gdFTEX_Unicode,
- gdFTEX_Shift_JIS, or gdFTEX_Big5;
- when not specified, maps are searched
- for in the above order. */
-}
- gdFTStringExtra, *gdFTStringExtraPtr;
-
-#define gdFTEX_LINESPACE 1
-#define gdFTEX_CHARMAP 2
-
-/* These are NOT flags; set one in 'charmap' if you set the gdFTEX_CHARMAP bit in 'flags'. */
-#define gdFTEX_Unicode 0
-#define gdFTEX_Shift_JIS 1
-#define gdFTEX_Big5 2
-
-/* FreeType 2 text output with fine tuning */
-char *
-gdImageStringFTEx(gdImage * im, int *brect, int fg, char * fontlist,
- double ptsize, double angle, int x, int y, char * string,
- gdFTStringExtraPtr strex);
-
-
-/* Point type for use in polygon drawing. */
-typedef struct {
- int x, y;
-} gdPoint, *gdPointPtr;
-
-void gdImagePolygon(gdImagePtr im, gdPointPtr p, int n, int c);
-void gdImageFilledPolygon(gdImagePtr im, gdPointPtr p, int n, int c);
-
-/* These functions still work with truecolor images,
- for which they never return error. */
-int gdImageColorAllocate(gdImagePtr im, int r, int g, int b);
-/* gd 2.0: palette entries with non-opaque transparency are permitted. */
-int gdImageColorAllocateAlpha(gdImagePtr im, int r, int g, int b, int a);
-/* Assumes opaque is the preferred alpha channel value */
-int gdImageColorClosest(gdImagePtr im, int r, int g, int b);
-/* Closest match taking all four parameters into account.
- A slightly different color with the same transparency
- beats the exact same color with radically different
- transparency */
-int gdImageColorClosestAlpha(gdImagePtr im, int r, int g, int b, int a);
-/* An alternate method */
-int gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b);
-/* Returns exact, 100% opaque matches only */
-int gdImageColorExact(gdImagePtr im, int r, int g, int b);
-/* Returns an exact match only, including alpha */
-int gdImageColorExactAlpha(gdImagePtr im, int r, int g, int b, int a);
-/* Opaque only */
-int gdImageColorResolve(gdImagePtr im, int r, int g, int b);
-/* Based on gdImageColorExactAlpha and gdImageColorClosestAlpha */
-int gdImageColorResolveAlpha(gdImagePtr im, int r, int g, int b, int a);
-
-/* A simpler way to obtain an opaque truecolor value for drawing on a
- truecolor image. Not for use with palette images! */
-
-#define gdTrueColor(r, g, b) (((r) << 16) + \
- ((g) << 8) + \
- (b))
-
-/* Returns a truecolor value with an alpha channel component.
- gdAlphaMax (127, **NOT 255**) is transparent, 0 is completely
- opaque. */
-
-#define gdTrueColorAlpha(r, g, b, a) (((a) << 24) + \
- ((r) << 16) + \
- ((g) << 8) + \
- (b))
-
-void gdImageColorDeallocate(gdImagePtr im, int color);
-
-/* Converts a truecolor image to a palette-based image,
- using a high-quality two-pass quantization routine
- which attempts to preserve alpha channel information
- as well as R/G/B color information when creating
- a palette. If ditherFlag is set, the image will be
- dithered to approximate colors better, at the expense
- of some obvious "speckling." colorsWanted can be
- anything up to 256. If the original source image
- includes photographic information or anything that
- came out of a JPEG, 256 is strongly recommended.
-
- Better yet, don't use this function -- write real
- truecolor PNGs and JPEGs. The disk space gain of
- conversion to palette is not great (for small images
- it can be negative) and the quality loss is ugly. */
-
-void gdImageTrueColorToPalette(gdImagePtr im, int ditherFlag, int colorsWanted);
-
-/* An attempt at getting the results of gdImageTrueColorToPalette
- to look a bit more like the original (im1 is the original
- and im2 is the palette version */
-int gdImageColorMatch(gdImagePtr im1, gdImagePtr im2);
-
-/* Specifies a color index (if a palette image) or an
- RGB color (if a truecolor image) which should be
- considered 100% transparent. FOR TRUECOLOR IMAGES,
- THIS IS IGNORED IF AN ALPHA CHANNEL IS BEING
- SAVED. Use gdImageSaveAlpha(im, 0); to
- turn off the saving of a full alpha channel in
- a truecolor image. Note that gdImageColorTransparent
- is usually compatible with older browsers that
- do not understand full alpha channels well. TBB */
-void gdImageColorTransparent(gdImagePtr im, int color);
-
-void gdImagePaletteCopy(gdImagePtr dst, gdImagePtr src);
-void gdImagePng(gdImagePtr im, FILE *out);
-void gdImagePngCtx(gdImagePtr im, gdIOCtx *out);
-/* 2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all,
- * 1 is FASTEST but produces larger files, 9 provides the best
- * compression (smallest files) but takes a long time to compress, and
- * -1 selects the default compiled into the zlib library.
- */
-void gdImagePngEx(gdImagePtr im, FILE * out, int level);
-void gdImagePngCtxEx(gdImagePtr im, gdIOCtx * out, int level);
-
-void gdImageWBMP(gdImagePtr image, int fg, FILE *out);
-void gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out);
-
-/* Guaranteed to correctly free memory returned
- by the gdImage*Ptr functions */
-void gdFree(void *m);
-
-/* Best to free this memory with gdFree(), not free() */
-void *gdImageWBMPPtr(gdImagePtr im, int *size, int fg);
-
-/* 100 is highest quality (there is always a little loss with JPEG).
- 0 is lowest. 10 is about the lowest useful setting. */
-void gdImageJpeg(gdImagePtr im, FILE *out, int quality);
-void gdImageJpegCtx(gdImagePtr im, gdIOCtx *out, int quality);
-
-/* Best to free this memory with gdFree(), not free() */
-void *gdImageJpegPtr(gdImagePtr im, int *size, int quality);
-
-gdImagePtr gdImageCreateFromGif(FILE *fd);
-gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr in);
-gdImagePtr gdImageCreateFromGifSource(gdSourcePtr in);
-
-/* A custom data sink. For backwards compatibility. Use
- gdIOCtx instead. */
-/* The sink function must return -1 on error, otherwise the number
- of bytes written, which must be equal to len. */
-/* context will be passed to your sink function. */
-typedef struct {
- int (*sink) (void *context, const char *buffer, int len);
- void *context;
-} gdSink, *gdSinkPtr;
-
-void gdImagePngToSink(gdImagePtr im, gdSinkPtr out);
-
-void gdImageGd(gdImagePtr im, FILE *out);
-void gdImageGd2(gdImagePtr im, FILE *out, int cs, int fmt);
-
-/* Best to free this memory with gdFree(), not free() */
-void* gdImagePngPtr(gdImagePtr im, int *size);
-
-/* Best to free this memory with gdFree(), not free() */
-void* gdImageGdPtr(gdImagePtr im, int *size);
-void *gdImagePngPtrEx(gdImagePtr im, int *size, int level);
-
-/* Best to free this memory with gdFree(), not free() */
-void* gdImageGd2Ptr(gdImagePtr im, int cs, int fmt, int *size);
-
-void gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int c);
-
-/* Style is a bitwise OR ( | operator ) of these.
- gdArc and gdChord are mutually exclusive;
- gdChord just connects the starting and ending
- angles with a straight line, while gdArc produces
- a rounded edge. gdPie is a synonym for gdArc.
- gdNoFill indicates that the arc or chord should be
- outlined, not filled. gdEdged, used together with
- gdNoFill, indicates that the beginning and ending
- angles should be connected to the center; this is
- a good way to outline (rather than fill) a
- 'pie slice'. */
-#define gdArc 0
-#define gdPie gdArc
-#define gdChord 1
-#define gdNoFill 2
-#define gdEdged 4
-
-void gdImageFilledArc(gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int style);
-void gdImageArc(gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color);
-void gdImageFilledEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color);
-void gdImageFillToBorder(gdImagePtr im, int x, int y, int border, int color);
-void gdImageFill(gdImagePtr im, int x, int y, int color);
-void gdImageCopy(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h);
-void gdImageCopyMerge(gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
- int srcX, int srcY, int w, int h, int pct);
-void gdImageCopyMergeGray(gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
- int srcX, int srcY, int w, int h, int pct);
-
-/* Stretches or shrinks to fit, as needed. Does NOT attempt
- to average the entire set of source pixels that scale down onto the
- destination pixel. */
-void gdImageCopyResized(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH);
-
-/* gd 2.0: stretches or shrinks to fit, as needed. When called with a
- truecolor destination image, this function averages the
- entire set of source pixels that scale down onto the
- destination pixel, taking into account what portion of the
- destination pixel each source pixel represents. This is a
- floating point operation, but this is not a performance issue
- on modern hardware, except for some embedded devices. If the
- destination is a palette image, gdImageCopyResized is
- substituted automatically. */
-void gdImageCopyResampled(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH);
-
-gdImagePtr gdImageRotate90(gdImagePtr src);
-gdImagePtr gdImageRotate180(gdImagePtr src);
-gdImagePtr gdImageRotate270(gdImagePtr src);
-gdImagePtr gdImageRotate45(gdImagePtr src, double dAngle, int clrBack);
-gdImagePtr gdImageRotate (gdImagePtr src, double dAngle, int clrBack);
-
-void gdImageSetBrush(gdImagePtr im, gdImagePtr brush);
-void gdImageSetTile(gdImagePtr im, gdImagePtr tile);
-void gdImageSetAntiAliased(gdImagePtr im, int c);
-void gdImageSetAntiAliasedDontBlend(gdImagePtr im, int c, int dont_blend);
-void gdImageSetStyle(gdImagePtr im, int *style, int noOfPixels);
-/* Line thickness (defaults to 1). Affects lines, ellipses,
- rectangles, polygons and so forth. */
-void gdImageSetThickness(gdImagePtr im, int thickness);
-/* On or off (1 or 0) for all three of these. */
-void gdImageInterlace(gdImagePtr im, int interlaceArg);
-void gdImageAlphaBlending(gdImagePtr im, int alphaBlendingArg);
-void gdImageAntialias(gdImagePtr im, int antialias);
-void gdImageSaveAlpha(gdImagePtr im, int saveAlphaArg);
-
-/* Macros to access information about images. */
-
-/* Returns nonzero if the image is a truecolor image,
- zero for a palette image. */
-
-#define gdImageTrueColor(im) ((im)->trueColor)
-
-#define gdImageSX(im) ((im)->sx)
-#define gdImageSY(im) ((im)->sy)
-#define gdImageColorsTotal(im) ((im)->colorsTotal)
-#define gdImageRed(im, c) ((im)->trueColor ? gdTrueColorGetRed(c) : \
- (im)->red[(c)])
-#define gdImageGreen(im, c) ((im)->trueColor ? gdTrueColorGetGreen(c) : \
- (im)->green[(c)])
-#define gdImageBlue(im, c) ((im)->trueColor ? gdTrueColorGetBlue(c) : \
- (im)->blue[(c)])
-#define gdImageAlpha(im, c) ((im)->trueColor ? gdTrueColorGetAlpha(c) : \
- (im)->alpha[(c)])
-#define gdImageGetTransparent(im) ((im)->transparent)
-#define gdImageGetInterlaced(im) ((im)->interlace)
-
-/* These macros provide direct access to pixels in
- palette-based and truecolor images, respectively.
- If you use these macros, you must perform your own
- bounds checking. Use of the macro for the correct type
- of image is also your responsibility. */
-#define gdImagePalettePixel(im, x, y) (im)->pixels[(y)][(x)]
-#define gdImageTrueColorPixel(im, x, y) (im)->tpixels[(y)][(x)]
-
-/* I/O Support routines. */
-
-gdIOCtx* gdNewFileCtx(FILE*);
-gdIOCtx* gdNewDynamicCtx(int, void*);
-gdIOCtx* gdNewSSCtx(gdSourcePtr in, gdSinkPtr out);
-void* gdDPExtractData(struct gdIOCtx* ctx, int *size);
-
-#define GD2_CHUNKSIZE 128
-#define GD2_CHUNKSIZE_MIN 64
-#define GD2_CHUNKSIZE_MAX 4096
-
-#define GD2_VERS 2
-#define GD2_ID "gd2"
-#define GD2_FMT_RAW 1
-#define GD2_FMT_COMPRESSED 2
-
-
-/* filters section
- *
- * Negate the imag src, white becomes black,
- * The red, green, and blue intensities of an image are negated.
- * White becomes black, yellow becomes blue, etc.
- */
-int gdImageNegate(gdImagePtr src);
-
-/* Convert the image src to a grayscale image */
-int gdImageGrayScale(gdImagePtr src);
-
-/* Set the brightness level <brightness> for the image src */
-int gdImageBrightness(gdImagePtr src, int brightness);
-
-/* Set the contrast level <contrast> for the image <src> */
-int gdImageContrast(gdImagePtr src, double contrast);
-
-/* Simply adds or substracts respectively red, green or blue to a pixel */
-int gdImageColor(gdImagePtr src, int red, int green, int blue);
-
-/* Image convolution by a 3x3 custom matrix */
-int gdImageConvolution(gdImagePtr src, float ft[3][3], float filter_div, float offset);
-
-int gdImageEdgeDetectQuick(gdImagePtr src);
-
-int gdImageGaussianBlur(gdImagePtr im);
-
-int gdImageSelectiveBlur( gdImagePtr src);
-
-int gdImageEmboss(gdImagePtr im);
-
-int gdImageMeanRemoval(gdImagePtr im);
-
-int gdImageSmooth(gdImagePtr im, float weight);
-
-/* Image comparison definitions */
-int gdImageCompare(gdImagePtr im1, gdImagePtr im2);
-
-#define GD_CMP_IMAGE 1 /* Actual image IS different */
-#define GD_CMP_NUM_COLORS 2 /* Number of Colours in pallette differ */
-#define GD_CMP_COLOR 4 /* Image colours differ */
-#define GD_CMP_SIZE_X 8 /* Image width differs */
-#define GD_CMP_SIZE_Y 16 /* Image heights differ */
-#define GD_CMP_TRANSPARENT 32 /* Transparent colour */
-#define GD_CMP_BACKGROUND 64 /* Background colour */
-#define GD_CMP_INTERLACE 128 /* Interlaced setting */
-#define GD_CMP_TRUECOLOR 256 /* Truecolor vs palette differs */
-
-/* resolution affects ttf font rendering, particularly hinting */
-#define GD_RESOLUTION 96 /* pixels per inch */
-
-#ifdef __cplusplus
-}
-#endif
-
-/* 2.0.12: this now checks the clipping rectangle */
-#define gdImageBoundsSafe(im, x, y) (!((((y) < (im)->cy1) || ((y) > (im)->cy2)) || (((x) < (im)->cx1) || ((x) > (im)->cx2))))
-
-#endif /* GD_H */
diff --git a/ext/gd/libgd/gd2copypal.c b/ext/gd/libgd/gd2copypal.c
deleted file mode 100644
index ae9b559f17..0000000000
--- a/ext/gd/libgd/gd2copypal.c
+++ /dev/null
@@ -1,65 +0,0 @@
-
-#include <stdio.h>
-#include "gd.h"
-#include <stdlib.h>
-
-/* A short program which converts a .png file into a .gd file, for
- your convenience in creating images on the fly from a
- basis image that must be loaded quickly. The .gd format
- is not intended to be a general-purpose format. */
-
-int
-main (int argc, char **argv)
-{
- gdImagePtr im;
- gdImagePtr pal;
- FILE *in, *out;
- if (argc != 3)
- {
- fprintf (stderr, "Usage: gd2copypal palettefile.gd2 filename.gd2\n");
- exit (1);
- }
- in = fopen (argv[1], "rb");
- if (!in)
- {
- fprintf (stderr, "Palette file does not exist!\n");
- exit (1);
- }
- pal = gdImageCreateFromGd2 (in);
- fclose (in);
- if (!pal)
- {
- fprintf (stderr, "Palette is not in GD2 format!\n");
- exit (1);
- }
-
- in = fopen (argv[2], "rb");
- if (!in)
- {
- fprintf (stderr, "Input file does not exist!\n");
- exit (1);
- }
- im = gdImageCreateFromGd2 (in);
- fclose (in);
- if (!im)
- {
- fprintf (stderr, "Input is not in GD2 format!\n");
- exit (1);
- }
-
- gdImagePaletteCopy (im, pal);
-
- out = fopen (argv[2], "wb");
- if (!out)
- {
- fprintf (stderr, "Output file cannot be written to!\n");
- gdImageDestroy (im);
- exit (1);
- }
- gdImageGd2 (im, out, 128, 2);
- fclose (out);
- gdImageDestroy (pal);
- gdImageDestroy (im);
-
- return 0;
-}
diff --git a/ext/gd/libgd/gd2time.c b/ext/gd/libgd/gd2time.c
deleted file mode 100644
index 18e6c0c9e4..0000000000
--- a/ext/gd/libgd/gd2time.c
+++ /dev/null
@@ -1,60 +0,0 @@
-
-#include <stdio.h>
-#include <stdlib.h> /* for atoi */
-#include <time.h> /* For time */
-#include "gd.h"
-
-/* A short program which converts a .png file into a .gd file, for
- your convenience in creating images on the fly from a
- basis image that must be loaded quickly. The .gd format
- is not intended to be a general-purpose format. */
-
-int
-main (int argc, char **argv)
-{
- gdImagePtr im;
- FILE *in;
- int x, y, w, h;
- int c;
- int i;
- int t0;
-
- if (argc != 7)
- {
- fprintf (stderr, "Usage: gd2time filename.gd count x y w h\n");
- exit (1);
- }
-
- c = atoi (argv[2]);
- x = atoi (argv[3]);
- y = atoi (argv[4]);
- w = atoi (argv[5]);
- h = atoi (argv[6]);
-
- printf ("Extracting %d times from (%d, %d), size is %dx%d\n", c, x, y, w, h);
-
- t0 = time (0);
- for (i = 0; i < c; i++)
- {
- in = fopen (argv[1], "rb");
- if (!in)
- {
- fprintf (stderr, "Input file does not exist!\n");
- exit (1);
- }
-
- im = gdImageCreateFromGd2Part (in, x, y, w, h);
- fclose (in);
-
- if (!im)
- {
- fprintf (stderr, "Error reading source file!\n");
- exit (1);
- }
- gdImageDestroy (im);
- };
- t0 = time (0) - t0;
- printf ("%d seconds to extract (& destroy) %d times\n", t0, c);
-
- return 0;
-}
diff --git a/ext/gd/libgd/gd2topng.c b/ext/gd/libgd/gd2topng.c
deleted file mode 100644
index 6db5eb3003..0000000000
--- a/ext/gd/libgd/gd2topng.c
+++ /dev/null
@@ -1,49 +0,0 @@
-
-#include <stdio.h>
-#include "gd.h"
-
-/* A short program which converts a .png file into a .gd file, for
- your convenience in creating images on the fly from a
- basis image that must be loaded quickly. The .gd format
- is not intended to be a general-purpose format. */
-
-int
-main (int argc, char **argv)
-{
- gdImagePtr im;
- FILE *in, *out;
- if (argc != 3)
- {
- fprintf (stderr, "Usage: gd2topng filename.gd2 filename.png\n");
- exit (1);
- }
- in = fopen (argv[1], "rb");
- if (!in)
- {
- fprintf (stderr, "Input file does not exist!\n");
- exit (1);
- }
- im = gdImageCreateFromGd2 (in);
- fclose (in);
- if (!im)
- {
- fprintf (stderr, "Input is not in GD2 format!\n");
- exit (1);
- }
- out = fopen (argv[2], "wb");
- if (!out)
- {
- fprintf (stderr, "Output file cannot be written to!\n");
- gdImageDestroy (im);
- exit (1);
- }
-#ifdef HAVE_LIBPNG
- gdImagePng (im, out);
-#else
- fprintf(stderr, "No PNG library support available.\n");
-#endif
- fclose (out);
- gdImageDestroy (im);
-
- return 0;
-}
diff --git a/ext/gd/libgd/gd_arc_f_buggy.c b/ext/gd/libgd/gd_arc_f_buggy.c
deleted file mode 100644
index 7b8f819079..0000000000
--- a/ext/gd/libgd/gd_arc_f_buggy.c
+++ /dev/null
@@ -1,741 +0,0 @@
-/* This is potentially great stuff, but fails against the test
- program at the end. This would probably be much more
- efficent than the implementation currently in gd.c if the
- errors in the output were corrected. TBB */
-
-#if 0
-
-#include "gd.h"
-#include <math.h>
-
-/* Courtesy of F J Franklin. */
-
-static gdPoint gdArcClosest (int width, int height, int angle);
-
-void
-gdImageFilledEllipse (gdImagePtr im, int cx, int cy, int width, int height, int color)
-{
- gdImageFilledArc (im, cx, cy, width, height, 0, 360, color, gdChord);
-}
-
-void
-gdImageFilledArc (gdImagePtr im, int cx, int cy, int width, int height, int s, int e, int color, int style)
-{
- gdPoint pt[7];
- gdPoint axis_pt[4];
-
- int angle;
-
- int have_s = 0;
- int have_e = 0;
-
- int flip_x = 0;
- int flip_y = 0;
-
- int conquer = 0;
-
- int i;
-
- int a;
- int b;
-
- int x;
- int y;
-
- long s_sin = 0;
- long s_cos = 0;
- long e_sin = 0;
- long e_cos = 0;
-
- long w; /* a * 2 */
- long h; /* b * 2 */
-
- long x2; /* x * 2 */
- long y2; /* y * 2 */
- long lx2; /* x * 2 (line) */
- long ly2; /* y * 2 (line) */
-
- long ws; /* (a * 2)^2 */
- long hs; /* (b * 2)^2 */
-
- long whs; /* (a * 2)^2 * (b * 2)^2 */
-
- long g; /* decision variable */
- long lg; /* decision variable (line) */
-
- width = (width & 1) ? (width + 1) : (width);
- height = (height & 1) ? (height + 1) : (height);
-
- a = width / 2;
- b = height / 2;
-
- axis_pt[0].x = a;
- axis_pt[0].y = 0;
- axis_pt[1].x = 0;
- axis_pt[1].y = b;
- axis_pt[2].x = -a;
- axis_pt[2].y = 0;
- axis_pt[3].x = 0;
- axis_pt[3].y = -b;
-
- if (s == e)
- return;
-
- if ((e - s) >= 360)
- {
- s = 0;
- e = 0;
- }
-
- while (s < 0)
- s += 360;
- while (s >= 360)
- s -= 360;
- while (e < 0)
- e += 360;
- while (e >= 360)
- e -= 360;
-
- if (e <= s)
- e += 360;
-
- /* I'm assuming a chord-rule at the moment. Need to add origin to get a
- * pie-rule, but will need to set chord-rule before recursion...
- */
-
- for (i = 0; i < 4; i++)
- {
- if ((s < (i + 1) * 90) && (e > (i + 1) * 90))
- {
- gdImageFilledArc (im, cx, cy, width, height, s, (i + 1) * 90, color, gdChord);
- pt[0] = gdArcClosest (width, height, s);
- pt[0].x += cx;
- pt[0].y += cy;
- pt[1].x = cx + axis_pt[(i + 1) & 3].x;
- pt[1].y = cy + axis_pt[(i + 1) & 3].y;
- if (e <= (i + 2) * 90)
- {
- gdImageFilledArc (im, cx, cy, width, height, (i + 1) * 90, e, color, gdChord);
- pt[2] = gdArcClosest (width, height, e);
- pt[2].x += cx;
- pt[2].y += cy;
- if (style == gdChord)
- {
- gdImageFilledPolygon (im, pt, 3, color);
- gdImagePolygon (im, pt, 3, color);
- }
- else if (style == gdPie)
- {
- pt[3].x = cx;
- pt[3].y = cy;
- gdImageFilledPolygon (im, pt, 4, color);
- gdImagePolygon (im, pt, 4, color);
- }
- }
- else
- {
- gdImageFilledArc (im, cx, cy, width, height, (i + 1) * 90, (i + 2) * 90, color, gdChord);
- pt[2].x = cx + axis_pt[(i + 2) & 3].x;
- pt[2].y = cy + axis_pt[(i + 2) & 3].y;
- if (e <= (i + 3) * 90)
- {
- gdImageFilledArc (im, cx, cy, width, height, (i + 2) * 90, e, color, gdChord);
- pt[3] = gdArcClosest (width, height, e);
- pt[3].x += cx;
- pt[3].y += cy;
- if (style == gdChord)
- {
- gdImageFilledPolygon (im, pt, 4, color);
- gdImagePolygon (im, pt, 4, color);
- }
- else if (style == gdPie)
- {
- pt[4].x = cx;
- pt[4].y = cy;
- gdImageFilledPolygon (im, pt, 5, color);
- gdImagePolygon (im, pt, 5, color);
- }
- }
- else
- {
- gdImageFilledArc (im, cx, cy, width, height, (i + 2) * 90, (i + 3) * 90, color, gdChord);
- pt[3].x = cx + axis_pt[(i + 3) & 3].x;
- pt[3].y = cy + axis_pt[(i + 3) & 3].y;
- if (e <= (i + 4) * 90)
- {
- gdImageFilledArc (im, cx, cy, width, height, (i + 3) * 90, e, color, gdChord);
- pt[4] = gdArcClosest (width, height, e);
- pt[4].x += cx;
- pt[4].y += cy;
- if (style == gdChord)
- {
- gdImageFilledPolygon (im, pt, 5, color);
- gdImagePolygon (im, pt, 5, color);
- }
- else if (style == gdPie)
- {
- pt[5].x = cx;
- pt[5].y = cy;
- gdImageFilledPolygon (im, pt, 6, color);
- gdImagePolygon (im, pt, 6, color);
- }
- }
- else
- {
- gdImageFilledArc (im, cx, cy, width, height, (i + 3) * 90, (i + 4) * 90, color, gdChord);
- pt[4].x = cx + axis_pt[(i + 4) & 3].x;
- pt[4].y = cy + axis_pt[(i + 4) & 3].y;
-
- gdImageFilledArc (im, cx, cy, width, height, (i + 4) * 90, e, color, gdChord);
- pt[5] = gdArcClosest (width, height, e);
- pt[5].x += cx;
- pt[5].y += cy;
- if (style == gdChord)
- {
- gdImageFilledPolygon (im, pt, 6, color);
- gdImagePolygon (im, pt, 6, color);
- }
- else if (style == gdPie)
- {
- pt[6].x = cx;
- pt[6].y = cy;
- gdImageFilledPolygon (im, pt, 7, color);
- gdImagePolygon (im, pt, 7, color);
- }
- }
- }
- }
- return;
- }
- }
-
- /* At this point we have only arcs that lies within a quadrant -
- * map this to first quadrant...
- */
-
- if ((s >= 90) && (e <= 180))
- {
- angle = s;
- s = 180 - e;
- e = 180 - angle;
- flip_x = 1;
- }
- if ((s >= 180) && (e <= 270))
- {
- s = s - 180;
- e = e - 180;
- flip_x = 1;
- flip_y = 1;
- }
- if ((s >= 270) && (e <= 360))
- {
- angle = s;
- s = 360 - e;
- e = 360 - angle;
- flip_y = 1;
- }
-
- if (s == 0)
- {
- s_sin = 0;
- s_cos = (long) ((double) 32768);
- }
- else
- {
- s_sin = (long) ((double) 32768 * sin ((double) s * M_PI / (double) 180));
- s_cos = (long) ((double) 32768 * cos ((double) s * M_PI / (double) 180));
- }
- if (e == 0)
- {
- e_sin = (long) ((double) 32768);
- e_cos = 0;
- }
- else
- {
- e_sin = (long) ((double) 32768 * sin ((double) e * M_PI / (double) 180));
- e_cos = (long) ((double) 32768 * cos ((double) e * M_PI / (double) 180));
- }
-
- w = (long) width;
- h = (long) height;
-
- ws = w * w;
- hs = h * h;
-
- whs = 1;
- while ((ws > 32768) || (hs > 32768))
- {
- ws = (ws + 1) / 2; /* Unfortunate limitations on integers makes */
- hs = (hs + 1) / 2; /* drawing large ellipses problematic... */
- whs *= 2;
- }
- while ((ws * hs) > (0x04000000L / whs))
- {
- ws = (ws + 1) / 2;
- hs = (hs + 1) / 2;
- whs *= 2;
- }
- whs *= ws * hs;
-
- pt[0].x = w / 2;
- pt[0].y = 0;
-
- pt[2].x = 0;
- pt[2].y = h / 2;
-
- have_s = 0;
- have_e = 0;
-
- if (s == 0)
- have_s = 1;
- if (e == 90)
- have_e = 1;
-
- x2 = w;
- y2 = 0; /* Starting point is exactly on ellipse */
-
- g = x2 - 1;
- g = g * g * hs + 4 * ws - whs;
-
- while ((x2 * hs) > (y2 * ws)) /* Keep |tangent| > 1 */
- {
- y2 += 2;
- g += ws * 4 * (y2 + 1);
-
- if (g > 0) /* Need to drop */
- {
- x2 -= 2;
- g -= hs * 4 * x2;
- }
-
- if ((have_s == 0) && ((s_sin * x2) <= (y2 * s_cos)))
- {
- pt[0].x = (int) (x2 / 2);
- pt[0].y = (int) (y2 / 2);
- have_s = 1;
- }
-
- if ((have_e == 0) && ((e_sin * x2) <= (y2 * e_cos)))
- {
- pt[2].x = (int) (x2 / 2);
- pt[2].y = (int) (y2 / 2);
- have_e = 1;
- }
- }
- pt[1].x = (int) (x2 / 2);
- pt[1].y = (int) (y2 / 2);
-
- x2 = 0;
- y2 = h; /* Starting point is exactly on ellipse */
-
- g = y2 - 1;
- g = g * g * ws + 4 * hs - whs;
-
- while ((x2 * hs) < (y2 * ws))
- {
- x2 += 2;
- g += hs * 4 * (x2 + 1);
-
- if (g > 0) /* Need to drop */
- {
- y2 -= 2;
- g -= ws * 4 * y2;
- }
-
- if ((have_s == 0) && ((s_sin * x2) >= (y2 * s_cos)))
- {
- pt[0].x = (int) (x2 / 2);
- pt[0].y = (int) (y2 / 2);
- have_s = 1;
- }
-
- if ((have_e == 0) && ((e_sin * x2) >= (y2 * e_cos)))
- {
- pt[2].x = (int) (x2 / 2);
- pt[2].y = (int) (y2 / 2);
- have_e = 1;
- }
- }
-
- if ((have_s == 0) || (have_e == 0))
- return; /* Bizarre case */
-
- if (style == gdPie)
- {
- pt[3] = pt[0];
- pt[4] = pt[1];
- pt[5] = pt[2];
-
- pt[0].x = cx + (flip_x ? (-pt[0].x) : pt[0].x);
- pt[0].y = cy + (flip_y ? (-pt[0].y) : pt[0].y);
- pt[1].x = cx;
- pt[1].y = cy;
- pt[2].x = cx + (flip_x ? (-pt[2].x) : pt[2].x);
- pt[2].y = cy + (flip_y ? (-pt[2].y) : pt[2].y);
- gdImageFilledPolygon (im, pt, 3, color);
- gdImagePolygon (im, pt, 3, color);
-
- pt[0] = pt[3];
- pt[1] = pt[4];
- pt[2] = pt[5];
- }
-
- if (((s_cos * hs) > (s_sin * ws)) && ((e_cos * hs) < (e_sin * ws)))
- { /* the points are on different parts of the curve...
- * this is too tricky to try to handle, so divide and conquer:
- */
- pt[3] = pt[0];
- pt[4] = pt[1];
- pt[5] = pt[2];
-
- pt[0].x = cx + (flip_x ? (-pt[0].x) : pt[0].x);
- pt[0].y = cy + (flip_y ? (-pt[0].y) : pt[0].y);
- pt[1].x = cx + (flip_x ? (-pt[1].x) : pt[1].x);
- pt[1].y = cy + (flip_y ? (-pt[1].y) : pt[1].y);
- pt[2].x = cx + (flip_x ? (-pt[2].x) : pt[2].x);
- pt[2].y = cy + (flip_y ? (-pt[2].y) : pt[2].y);
- gdImageFilledPolygon (im, pt, 3, color);
- gdImagePolygon (im, pt, 3, color);
-
- pt[0] = pt[3];
- pt[2] = pt[4];
-
- conquer = 1;
- }
-
- if (conquer || (((s_cos * hs) > (s_sin * ws)) && ((e_cos * hs) > (e_sin * ws))))
- { /* This is the best bit... */
- /* steep line + ellipse */
- /* go up & left from pt[0] to pt[2] */
-
- x2 = w;
- y2 = 0; /* Starting point is exactly on ellipse */
-
- g = x2 - 1;
- g = g * g * hs + 4 * ws - whs;
-
- while ((x2 * hs) > (y2 * ws)) /* Keep |tangent| > 1 */
- {
- if ((s_sin * x2) <= (y2 * s_cos))
- break;
-
- y2 += 2;
- g += ws * 4 * (y2 + 1);
-
- if (g > 0) /* Need to drop */
- {
- x2 -= 2;
- g -= hs * 4 * x2;
- }
- }
-
- lx2 = x2;
- ly2 = y2;
-
- lg = lx2 * (pt[0].y - pt[2].y) - ly2 * (pt[0].x - pt[2].x);
- lg = (lx2 - 1) * (pt[0].y - pt[2].y) - (ly2 + 2) * (pt[0].x - pt[2].x) - lg;
-
- while (y2 < (2 * pt[2].y))
- {
- y2 += 2;
- g += ws * 4 * (y2 + 1);
-
- if (g > 0) /* Need to drop */
- {
- x2 -= 2;
- g -= hs * 4 * x2;
- }
-
- ly2 += 2;
- lg -= 2 * (pt[0].x - pt[2].x);
-
- if (lg < 0) /* Need to drop */
- {
- lx2 -= 2;
- lg -= 2 * (pt[0].y - pt[2].y);
- }
-
- y = (int) (y2 / 2);
- for (x = (int) (lx2 / 2); x <= (int) (x2 / 2); x++)
- {
- gdImageSetPixel (im, ((flip_x) ? (cx - x) : (cx + x)),
- ((flip_y) ? (cy - y) : (cy + y)), color);
- }
- }
- }
- if (conquer)
- {
- pt[0] = pt[4];
- pt[2] = pt[5];
- }
- if (conquer || (((s_cos * hs) < (s_sin * ws)) && ((e_cos * hs) < (e_sin * ws))))
- { /* This is the best bit... */
- /* gradual line + ellipse */
- /* go down & right from pt[2] to pt[0] */
-
- x2 = 0;
- y2 = h; /* Starting point is exactly on ellipse */
-
- g = y2 - 1;
- g = g * g * ws + 4 * hs - whs;
-
- while ((x2 * hs) < (y2 * ws))
- {
- x2 += 2;
- g += hs * 4 * (x2 + 1);
-
- if (g > 0) /* Need to drop */
- {
- y2 -= 2;
- g -= ws * 4 * y2;
- }
-
- if ((e_sin * x2) >= (y2 * e_cos))
- break;
- }
-
- lx2 = x2;
- ly2 = y2;
-
- lg = lx2 * (pt[0].y - pt[2].y) - ly2 * (pt[0].x - pt[2].x);
- lg = (lx2 + 2) * (pt[0].y - pt[2].y) - (ly2 - 1) * (pt[0].x - pt[2].x) - lg;
-
- while (x2 < (2 * pt[0].x))
- {
- x2 += 2;
- g += hs * 4 * (x2 + 1);
-
- if (g > 0) /* Need to drop */
- {
- y2 -= 2;
- g -= ws * 4 * y2;
- }
-
- lx2 += 2;
- lg += 2 * (pt[0].y - pt[2].y);
-
- if (lg < 0) /* Need to drop */
- {
- ly2 -= 2;
- lg += 2 * (pt[0].x - pt[2].x);
- }
-
- x = (int) (x2 / 2);
- for (y = (int) (ly2 / 2); y <= (int) (y2 / 2); y++)
- {
- gdImageSetPixel (im, ((flip_x) ? (cx - x) : (cx + x)),
- ((flip_y) ? (cy - y) : (cy + y)), color);
- }
- }
- }
-}
-
-static gdPoint
-gdArcClosest (int width, int height, int angle)
-{
- gdPoint pt;
-
- int flip_x = 0;
- int flip_y = 0;
-
- long a_sin = 0;
- long a_cos = 0;
-
- long w; /* a * 2 */
- long h; /* b * 2 */
-
- long x2; /* x * 2 */
- long y2; /* y * 2 */
-
- long ws; /* (a * 2)^2 */
- long hs; /* (b * 2)^2 */
-
- long whs; /* (a * 2)^2 * (b * 2)^2 */
-
- long g; /* decision variable */
-
- w = (long) ((width & 1) ? (width + 1) : (width));
- h = (long) ((height & 1) ? (height + 1) : (height));
-
- while (angle < 0)
- angle += 360;
- while (angle >= 360)
- angle -= 360;
-
- if (angle == 0)
- {
- pt.x = w / 2;
- pt.y = 0;
- return (pt);
- }
- if (angle == 90)
- {
- pt.x = 0;
- pt.y = h / 2;
- return (pt);
- }
- if (angle == 180)
- {
- pt.x = -w / 2;
- pt.y = 0;
- return (pt);
- }
- if (angle == 270)
- {
- pt.x = 0;
- pt.y = -h / 2;
- return (pt);
- }
-
- pt.x = 0;
- pt.y = 0;
-
- if ((angle > 90) && (angle < 180))
- {
- angle = 180 - angle;
- flip_x = 1;
- }
- if ((angle > 180) && (angle < 270))
- {
- angle = angle - 180;
- flip_x = 1;
- flip_y = 1;
- }
- if ((angle > 270) && (angle < 360))
- {
- angle = 360 - angle;
- flip_y = 1;
- }
-
- a_sin = (long) ((double) 32768 * sin ((double) angle * M_PI / (double) 180));
- a_cos = (long) ((double) 32768 * cos ((double) angle * M_PI / (double) 180));
-
- ws = w * w;
- hs = h * h;
-
- whs = 1;
- while ((ws > 32768) || (hs > 32768))
- {
- ws = (ws + 1) / 2; /* Unfortunate limitations on integers makes */
- hs = (hs + 1) / 2; /* drawing large ellipses problematic... */
- whs *= 2;
- }
- while ((ws * hs) > (0x04000000L / whs))
- {
- ws = (ws + 1) / 2;
- hs = (hs + 1) / 2;
- whs *= 2;
- }
- whs *= ws * hs;
-
- if ((a_cos * hs) > (a_sin * ws))
- {
- x2 = w;
- y2 = 0; /* Starting point is exactly on ellipse */
-
- g = x2 - 1;
- g = g * g * hs + 4 * ws - whs;
-
- while ((x2 * hs) > (y2 * ws)) /* Keep |tangent| > 1 */
- {
- y2 += 2;
- g += ws * 4 * (y2 + 1);
-
- if (g > 0) /* Need to drop */
- {
- x2 -= 2;
- g -= hs * 4 * x2;
- }
-
- if ((a_sin * x2) <= (y2 * a_cos))
- {
- pt.x = (int) (x2 / 2);
- pt.y = (int) (y2 / 2);
- break;
- }
- }
- }
- else
- {
- x2 = 0;
- y2 = h; /* Starting point is exactly on ellipse */
-
- g = y2 - 1;
- g = g * g * ws + 4 * hs - whs;
-
- while ((x2 * hs) < (y2 * ws))
- {
- x2 += 2;
- g += hs * 4 * (x2 + 1);
-
- if (g > 0) /* Need to drop */
- {
- y2 -= 2;
- g -= ws * 4 * y2;
- }
-
- if ((a_sin * x2) >= (y2 * a_cos))
- {
- pt.x = (int) (x2 / 2);
- pt.y = (int) (y2 / 2);
- break;
- }
- }
- }
-
- if (flip_x)
- pt.x = -pt.x;
- if (flip_y)
- pt.y = -pt.y;
-
- return (pt);
-}
-
-#include "gd.h"
-#include <string.h>
-#include <math.h>
-
-#define WIDTH 500
-#define HEIGHT 300
-
-int
-main (int argc, char *argv[])
-{
- gdImagePtr im = gdImageCreate (WIDTH, HEIGHT);
- int white = gdImageColorResolve (im, 0xFF, 0xFF, 0xFF), black = gdImageColorResolve (im, 0, 0, 0),
- red = gdImageColorResolve (im, 0xFF, 0xA0, 0xA0);
- FILE *out;
-
- /* filled arc - circle */
- gdImageFilledArc (im, WIDTH / 5, HEIGHT / 4, 200, 200, 45, 90, red, gdPie);
- gdImageArc (im, WIDTH / 5, HEIGHT / 4, 200, 200, 45, 90, black);
-
- /* filled arc - ellipse */
- gdImageFilledArc (im, WIDTH / 2, HEIGHT / 4, 200, 150, 45, 90, red, gdPie);
- gdImageArc (im, WIDTH / 2, HEIGHT / 4, 200, 150, 45, 90, black);
-
-
- /* reference lines */
- gdImageLine (im, 0, HEIGHT / 4, WIDTH, HEIGHT / 4, black);
- gdImageLine (im, WIDTH / 5, 0, WIDTH / 5, HEIGHT, black);
- gdImageLine (im, WIDTH / 2, 0, WIDTH / 2, HEIGHT, black);
- gdImageLine (im, WIDTH / 2, HEIGHT / 4, WIDTH / 2 + 300, HEIGHT / 4 + 300, black);
- gdImageLine (im, WIDTH / 5, HEIGHT / 4, WIDTH / 5 + 300, HEIGHT / 4 + 300, black);
-
- /* TBB: Write img to test/arctest.png */
- out = fopen ("test/arctest.png", "wb");
- if (!out)
- {
- php_gd_error("Can't create test/arctest.png\n");
- exit (1);
- }
- gdImagePng (im, out);
- fclose (out);
- php_gd_error("Test image written to test/arctest.png\n");
- /* Destroy it */
- gdImageDestroy (im);
-
- return 0;
-}
-
-#endif
diff --git a/ext/gd/libgd/gd_gd.c b/ext/gd/libgd/gd_gd.c
deleted file mode 100644
index e6ef7ff9c3..0000000000
--- a/ext/gd/libgd/gd_gd.c
+++ /dev/null
@@ -1,264 +0,0 @@
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include "gd.h"
-
-#define TRUE 1
-#define FALSE 0
-
-/* Exported functions: */
-extern void gdImageGd (gdImagePtr im, FILE * out);
-
-
-/* Use this for commenting out debug-print statements. */
-/* Just use the first '#define' to allow all the prints... */
-/*#define GD2_DBG(s) (s) */
-#define GD2_DBG(s)
-
-/* */
-/* Shared code to read color tables from gd file. */
-/* */
-int _gdGetColors (gdIOCtx * in, gdImagePtr im, int gd2xFlag)
-{
- int i;
- if (gd2xFlag) {
- int trueColorFlag;
- if (!gdGetByte(&trueColorFlag, in)) {
- goto fail1;
- }
- /* 2.0.12: detect bad truecolor .gd files created by pre-2.0.12.
- * Beginning in 2.0.12 truecolor is indicated by the initial 2-byte
- * signature.
- */
- if (trueColorFlag != im->trueColor) {
- goto fail1;
- }
- /* This should have been a word all along */
- if (!im->trueColor) {
- if (!gdGetWord(&im->colorsTotal, in)) {
- goto fail1;
- }
- }
- /* Int to accommodate truecolor single-color transparency */
- if (!gdGetInt(&im->transparent, in)) {
- goto fail1;
- }
- } else {
- if (!gdGetByte(&im->colorsTotal, in)) {
- goto fail1;
- }
- if (!gdGetWord(&im->transparent, in)) {
- goto fail1;
- }
- if (im->transparent == 257) {
- im->transparent = (-1);
- }
- }
-
- GD2_DBG(printf("Pallette had %d colours (T=%d)\n", im->colorsTotal, im->transparent));
-
- if (im->trueColor) {
- return TRUE;
- }
-
- for (i = 0; i < gdMaxColors; i++) {
- if (!gdGetByte(&im->red[i], in)) {
- goto fail1;
- }
- if (!gdGetByte(&im->green[i], in)) {
- goto fail1;
- }
- if (!gdGetByte(&im->blue[i], in)) {
- goto fail1;
- }
- if (gd2xFlag) {
- if (!gdGetByte(&im->alpha[i], in)) {
- goto fail1;
- }
- }
- }
-
- for (i = 0; i < im->colorsTotal; i++) {
- im->open[i] = 0;
- }
-
- return TRUE;
-fail1:
- return FALSE;
-}
-
-/* */
-/* Use the common basic header info to make the image object. */
-/* */
-static gdImagePtr _gdCreateFromFile (gdIOCtx * in, int *sx, int *sy)
-{
- gdImagePtr im;
- int gd2xFlag = 0;
- int trueColorFlag = 0;
-
- if (!gdGetWord(sx, in)) {
- goto fail1;
- }
- if (*sx == 65535 || *sx == 65534) {
- /* This is a gd 2.0 .gd file */
- gd2xFlag = 1;
- /* 2.0.12: 65534 signals a truecolor .gd file. There is a slight redundancy here but we can live with it. */
- if (*sx == 65534) {
- trueColorFlag = 1;
- }
- if (!gdGetWord(sx, in)) {
- goto fail1;
- }
- }
- if (!gdGetWord(sy, in)) {
- goto fail1;
- }
-
- GD2_DBG(printf("Image is %dx%d\n", *sx, *sy));
-
- if (trueColorFlag) {
- im = gdImageCreateTrueColor(*sx, *sy);
- } else {
- im = gdImageCreate(*sx, *sy);
- }
- if (!_gdGetColors(in, im, gd2xFlag)) {
- goto fail2;
- }
-
- return im;
-fail2:
- gdImageDestroy(im);
-fail1:
- return 0;
-}
-
-gdImagePtr gdImageCreateFromGd (FILE * inFile)
-{
- gdImagePtr im;
- gdIOCtx *in;
-
- in = gdNewFileCtx(inFile);
- im = gdImageCreateFromGdCtx(in);
-
- in->gd_free(in);
-
- return im;
-}
-
-gdImagePtr gdImageCreateFromGdCtx (gdIOCtxPtr in)
-{
- int sx, sy;
- int x, y;
- gdImagePtr im;
-
- /* Read the header */
- im = _gdCreateFromFile(in, &sx, &sy);
-
- if (im == NULL) {
- goto fail1;
- }
-
- /* Then the data... */
- /* 2.0.12: support truecolor properly in .gd as well as in .gd2. Problem reported by Andreas Pfaller. */
- if (im->trueColor) {
- for (y = 0; y < sy; y++) {
- for (x = 0; x < sx; x++) {
- int pix;
- if (!gdGetInt(&pix, in)) {
- goto fail2;
- }
- im->tpixels[y][x] = pix;
- }
- }
- } else {
- for (y = 0; y < sy; y++) {
- for (x = 0; x < sx; x++) {
- int ch;
- ch = gdGetC(in);
- if (ch == EOF) {
- goto fail2;
- }
- /* ROW-MAJOR IN GD 1.3 */
- im->pixels[y][x] = ch;
- }
- }
- }
-
- return im;
-
-fail2:
- gdImageDestroy (im);
-fail1:
- return 0;
-}
-
-void _gdPutColors (gdImagePtr im, gdIOCtx * out)
-{
- int i;
-
- gdPutC(im->trueColor, out);
- if (!im->trueColor) {
- gdPutWord(im->colorsTotal, out);
- }
- gdPutInt(im->transparent, out);
- if (!im->trueColor) {
- for (i = 0; i < gdMaxColors; i++) {
- gdPutC((unsigned char) im->red[i], out);
- gdPutC((unsigned char) im->green[i], out);
- gdPutC((unsigned char) im->blue[i], out);
- gdPutC((unsigned char) im->alpha[i], out);
- }
- }
-}
-
-static void _gdPutHeader (gdImagePtr im, gdIOCtx * out)
-{
- /* 65535 indicates this is a gd 2.x .gd file.
- * 2.0.12: 65534 indicates truecolor.
- */
- if (im->trueColor) {
- gdPutWord(65534, out);
- } else {
- gdPutWord(65535, out);
- }
- gdPutWord(im->sx, out);
- gdPutWord(im->sy, out);
-
- _gdPutColors(im, out);
-}
-
-static void _gdImageGd (gdImagePtr im, gdIOCtx * out)
-{
- int x, y;
-
- _gdPutHeader(im, out);
-
- for (y = 0; y < im->sy; y++) {
- for (x = 0; x < im->sx; x++) {
- /* ROW-MAJOR IN GD 1.3 */
- if (im->trueColor) {
- gdPutInt(im->tpixels[y][x], out);
- } else {
- gdPutC((unsigned char) im->pixels[y][x], out);
- }
- }
- }
-}
-
-void gdImageGd (gdImagePtr im, FILE * outFile)
-{
- gdIOCtx *out = gdNewFileCtx(outFile);
- _gdImageGd(im, out);
- out->gd_free(out);
-}
-
-void *gdImageGdPtr (gdImagePtr im, int *size)
-{
- void *rv;
- gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
- _gdImageGd(im, out);
- rv = gdDPExtractData(out, size);
- out->gd_free(out);
- return rv;
-}
diff --git a/ext/gd/libgd/gd_gd2.c b/ext/gd/libgd/gd_gd2.c
deleted file mode 100644
index 80fb2b8a96..0000000000
--- a/ext/gd/libgd/gd_gd2.c
+++ /dev/null
@@ -1,790 +0,0 @@
-/*
- * gd_gd2.c
- *
- * Implements the I/O and support for the GD2 format.
- *
- * Changing the definition of GD2_DBG (below) will cause copious messages
- * to be displayed while it processes requests.
- *
- * Designed, Written & Copyright 1999, Philip Warner.
- *
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include "gd.h"
-#include "gdhelpers.h"
-
-#include <zlib.h>
-
-#define TRUE 1
-#define FALSE 0
-
-/* 2.11: not part of the API, as the save routine can figure it out
- * from im->trueColor, and the load routine doesn't need to tell
- * the end user the saved format. NOTE: adding 2 is assumed
- * to result in the correct format value for truecolor!
-*/
-#define GD2_FMT_TRUECOLOR_RAW 3
-#define GD2_FMT_TRUECOLOR_COMPRESSED 4
-
-#define gd2_compressed(fmt) (((fmt) == GD2_FMT_COMPRESSED) || ((fmt) == GD2_FMT_TRUECOLOR_COMPRESSED))
-#define gd2_truecolor(fmt) (((fmt) == GD2_FMT_TRUECOLOR_RAW) || ((fmt) == GD2_FMT_TRUECOLOR_COMPRESSED))
-
-/* Use this for commenting out debug-print statements. */
-/* Just use the first '#define' to allow all the prints... */
-/* #define GD2_DBG(s) (s) */
-#define GD2_DBG(s)
-
-typedef struct
-{
- int offset;
- int size;
-} t_chunk_info;
-
-extern int _gdGetColors(gdIOCtx * in, gdImagePtr im, int gd2xFlag);
-extern void _gdPutColors(gdImagePtr im, gdIOCtx * out);
-
-/* */
-/* Read the extra info in the gd2 header. */
-/* */
-static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, int *fmt, int *ncx, int *ncy, t_chunk_info ** chunkIdx)
-{
- int i;
- int ch;
- char id[5];
- t_chunk_info *cidx;
- int sidx;
- int nc;
-
- GD2_DBG(php_gd_error("Reading gd2 header info\n"));
-
- for (i = 0; i < 4; i++) {
- ch = gdGetC(in);
- if (ch == EOF) {
- goto fail1;
- }
- id[i] = ch;
- }
- id[4] = 0;
-
- GD2_DBG(php_gd_error("Got file code: %s\n", id));
-
- /* Equiv. of 'magick'. */
- if (strcmp(id, GD2_ID) != 0) {
- GD2_DBG(php_gd_error("Not a valid gd2 file\n"));
- goto fail1;
- }
-
- /* Version */
- if (gdGetWord(vers, in) != 1) {
- goto fail1;
- }
- GD2_DBG(php_gd_error("Version: %d\n", *vers));
-
- if ((*vers != 1) && (*vers != 2)) {
- GD2_DBG(php_gd_error("Bad version: %d\n", *vers));
- goto fail1;
- }
-
- /* Image Size */
- if (!gdGetWord(sx, in)) {
- GD2_DBG(php_gd_error("Could not get x-size\n"));
- goto fail1;
- }
- if (!gdGetWord(sy, in)) {
- GD2_DBG(php_gd_error("Could not get y-size\n"));
- goto fail1;
- }
- GD2_DBG(php_gd_error("Image is %dx%d\n", *sx, *sy));
-
- /* Chunk Size (pixels, not bytes!) */
- if (gdGetWord(cs, in) != 1) {
- goto fail1;
- }
- GD2_DBG(php_gd_error("ChunkSize: %d\n", *cs));
-
- if ((*cs < GD2_CHUNKSIZE_MIN) || (*cs > GD2_CHUNKSIZE_MAX)) {
- GD2_DBG(php_gd_error("Bad chunk size: %d\n", *cs));
- goto fail1;
- }
-
- /* Data Format */
- if (gdGetWord(fmt, in) != 1) {
- goto fail1;
- }
- GD2_DBG(php_gd_error("Format: %d\n", *fmt));
-
- if ((*fmt != GD2_FMT_RAW) && (*fmt != GD2_FMT_COMPRESSED) && (*fmt != GD2_FMT_TRUECOLOR_RAW) && (*fmt != GD2_FMT_TRUECOLOR_COMPRESSED)) {
- GD2_DBG(php_gd_error("Bad data format: %d\n", *fmt));
- goto fail1;
- }
-
- /* # of chunks wide */
- if (gdGetWord(ncx, in) != 1) {
- goto fail1;
- }
- GD2_DBG(php_gd_error("%d Chunks Wide\n", *ncx));
-
- /* # of chunks high */
- if (gdGetWord(ncy, in) != 1) {
- goto fail1;
- }
- GD2_DBG(php_gd_error("%d Chunks vertically\n", *ncy));
-
- if (gd2_compressed(*fmt)) {
- nc = (*ncx) * (*ncy);
- GD2_DBG(php_gd_error("Reading %d chunk index entries\n", nc));
- sidx = sizeof(t_chunk_info) * nc;
- cidx = gdCalloc(sidx, 1);
- for (i = 0; i < nc; i++) {
- if (gdGetInt(&cidx[i].offset, in) != 1) {
- goto fail1;
- }
- if (gdGetInt(&cidx[i].size, in) != 1) {
- goto fail1;
- }
- }
- *chunkIdx = cidx;
- }
-
- GD2_DBG(php_gd_error("gd2 header complete\n"));
-
- return 1;
-
-fail1:
- return 0;
-}
-
-static gdImagePtr _gd2CreateFromFile (gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, int *fmt, int *ncx, int *ncy, t_chunk_info ** cidx)
-{
- gdImagePtr im;
-
- if (_gd2GetHeader (in, sx, sy, cs, vers, fmt, ncx, ncy, cidx) != 1) {
- GD2_DBG(php_gd_error("Bad GD2 header\n"));
- goto fail1;
- }
-
- if (gd2_truecolor(*fmt)) {
- im = gdImageCreateTrueColor(*sx, *sy);
- } else {
- im = gdImageCreate(*sx, *sy);
- }
- if (im == NULL) {
- GD2_DBG(php_gd_error("Could not create gdImage\n"));
- goto fail1;
- }
-
- if (!_gdGetColors(in, im, (*vers) == 2)) {
- GD2_DBG(php_gd_error("Could not read color palette\n"));
- goto fail2;
- }
- GD2_DBG(php_gd_error("Image palette completed: %d colours\n", im->colorsTotal));
-
- return im;
-
-fail2:
- gdImageDestroy(im);
- return 0;
-
-fail1:
- return 0;
-}
-
-static int _gd2ReadChunk (int offset, char *compBuf, int compSize, char *chunkBuf, uLongf * chunkLen, gdIOCtx * in)
-{
- int zerr;
-
- if (gdTell(in) != offset) {
- GD2_DBG(php_gd_error("Positioning in file to %d\n", offset));
- gdSeek(in, offset);
- } else {
- GD2_DBG(php_gd_error("Already Positioned in file to %d\n", offset));
- }
-
- /* Read and uncompress an entire chunk. */
- GD2_DBG(php_gd_error("Reading file\n"));
- if (gdGetBuf(compBuf, compSize, in) != compSize) {
- return FALSE;
- }
- GD2_DBG(php_gd_error("Got %d bytes. Uncompressing into buffer of %d bytes\n", compSize, (int)*chunkLen));
- zerr = uncompress((unsigned char *) chunkBuf, chunkLen, (unsigned char *) compBuf, compSize);
- if (zerr != Z_OK) {
- GD2_DBG(php_gd_error("Error %d from uncompress\n", zerr));
- return FALSE;
- }
- GD2_DBG(php_gd_error("Got chunk\n"));
-
- return TRUE;
-}
-
-gdImagePtr gdImageCreateFromGd2 (FILE * inFile)
-{
- gdIOCtx *in = gdNewFileCtx(inFile);
- gdImagePtr im;
-
- im = gdImageCreateFromGd2Ctx(in);
-
- in->gd_free(in);
-
- return im;
-}
-
-gdImagePtr gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
-{
- int sx, sy;
- int i;
- int ncx, ncy, nc, cs, cx, cy;
- int x, y, ylo, yhi, xlo, xhi;
- int vers, fmt;
- t_chunk_info *chunkIdx = NULL; /* So we can gdFree it with impunity. */
- unsigned char *chunkBuf = NULL; /* So we can gdFree it with impunity. */
- int chunkNum = 0;
- int chunkMax = 0;
- uLongf chunkLen;
- int chunkPos = 0;
- int compMax = 0;
- int bytesPerPixel;
- char *compBuf = NULL; /* So we can gdFree it with impunity. */
-
- gdImagePtr im;
-
- /* Get the header */
- if (!(im = _gd2CreateFromFile(in, &sx, &sy, &cs, &vers, &fmt, &ncx, &ncy, &chunkIdx))) {
- return 0;
- }
-
- bytesPerPixel = im->trueColor ? 4 : 1;
- nc = ncx * ncy;
-
- if (gd2_compressed(fmt)) {
- /* Find the maximum compressed chunk size. */
- compMax = 0;
- for (i = 0; (i < nc); i++) {
- if (chunkIdx[i].size > compMax) {
- compMax = chunkIdx[i].size;
- }
- }
- compMax++;
-
- /* Allocate buffers */
- chunkMax = cs * bytesPerPixel * cs;
- chunkBuf = gdCalloc(chunkMax, 1);
- compBuf = gdCalloc(compMax, 1);
-
- GD2_DBG(php_gd_error("Largest compressed chunk is %d bytes\n", compMax));
- }
-
- /* Read the data... */
- for (cy = 0; (cy < ncy); cy++) {
- for (cx = 0; (cx < ncx); cx++) {
- ylo = cy * cs;
- yhi = ylo + cs;
- if (yhi > im->sy) {
- yhi = im->sy;
- }
-
- GD2_DBG(php_gd_error("Processing Chunk %d (%d, %d), y from %d to %d\n", chunkNum, cx, cy, ylo, yhi));
-
- if (gd2_compressed(fmt)) {
- chunkLen = chunkMax;
-
- if (!_gd2ReadChunk(chunkIdx[chunkNum].offset, compBuf, chunkIdx[chunkNum].size, (char *) chunkBuf, &chunkLen, in)) {
- GD2_DBG(php_gd_error("Error reading comproessed chunk\n"));
- goto fail2;
- }
-
- chunkPos = 0;
- }
-
- for (y = ylo; (y < yhi); y++) {
- xlo = cx * cs;
- xhi = xlo + cs;
- if (xhi > im->sx) {
- xhi = im->sx;
- }
-
- if (!gd2_compressed(fmt)) {
- for (x = xlo; x < xhi; x++) {
- if (im->trueColor) {
- if (!gdGetInt(&im->tpixels[y][x], in)) {
- im->tpixels[y][x] = 0;
- }
- } else {
- int ch;
- if (!gdGetByte(&ch, in)) {
- ch = 0;
- }
- im->pixels[y][x] = ch;
- }
- }
- } else {
- for (x = xlo; x < xhi; x++) {
- if (im->trueColor) {
- /* 2.0.1: work around a gcc bug by being verbose. TBB */
- int a = chunkBuf[chunkPos++] << 24;
- int r = chunkBuf[chunkPos++] << 16;
- int g = chunkBuf[chunkPos++] << 8;
- int b = chunkBuf[chunkPos++];
- im->tpixels[y][x] = a + r + g + b;
- } else {
- im->pixels[y][x] = chunkBuf[chunkPos++];
- }
- }
- }
- }
- chunkNum++;
- }
- }
-
- GD2_DBG(php_gd_error("Freeing memory\n"));
-
- if (chunkBuf) {
- gdFree(chunkBuf);
- }
- if (compBuf) {
- gdFree(compBuf);
- }
- if (chunkIdx) {
- gdFree(chunkIdx);
- }
-
- GD2_DBG(php_gd_error("Done\n"));
-
- return im;
-
-fail2:
- gdImageDestroy(im);
- if (chunkBuf) {
- gdFree(chunkBuf);
- }
- if (compBuf) {
- gdFree(compBuf);
- }
- if (chunkIdx) {
- gdFree(chunkIdx);
- }
-
- return 0;
-}
-
-gdImagePtr gdImageCreateFromGd2Part (FILE * inFile, int srcx, int srcy, int w, int h)
-{
- gdImagePtr im;
- gdIOCtx *in = gdNewFileCtx(inFile);
-
- im = gdImageCreateFromGd2PartCtx(in, srcx, srcy, w, h);
-
- in->gd_free(in);
-
- return im;
-}
-
-gdImagePtr gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, int h)
-{
- int scx, scy, ecx, ecy, fsx, fsy;
- int nc, ncx, ncy, cs, cx, cy;
- int x, y, ylo, yhi, xlo, xhi;
- int dstart, dpos;
- int i;
- /* 2.0.12: unsigned is correct; fixes problems with color munging. Thanks to Steven Brown. */
- unsigned int ch;
- int vers, fmt;
- t_chunk_info *chunkIdx = NULL;
- unsigned char *chunkBuf = NULL;
- int chunkNum;
- int chunkMax = 0;
- uLongf chunkLen;
- int chunkPos = 0;
- int compMax;
- char *compBuf = NULL;
-
- gdImagePtr im;
-
- /* The next few lines are basically copied from gd2CreateFromFile
- * we change the file size, so don't want to use the code directly.
- * but we do need to know the file size.
- */
- if (_gd2GetHeader(in, &fsx, &fsy, &cs, &vers, &fmt, &ncx, &ncy, &chunkIdx) != 1) {
- goto fail1;
- }
-
- GD2_DBG(php_gd_error("File size is %dx%d\n", fsx, fsy));
-
- /* This is the difference - make a file based on size of chunks. */
- if (gd2_truecolor(fmt)) {
- im = gdImageCreateTrueColor(w, h);
- } else {
- im = gdImageCreate(w, h);
- }
- if (im == NULL) {
- goto fail1;
- }
-
- if (!_gdGetColors(in, im, vers == 2)) {
- goto fail2;
- }
- GD2_DBG(php_gd_error("Image palette completed: %d colours\n", im->colorsTotal));
-
- /* Process the header info */
- nc = ncx * ncy;
-
- if (gd2_compressed(fmt)) {
- /* Find the maximum compressed chunk size. */
- compMax = 0;
- for (i = 0; (i < nc); i++) {
- if (chunkIdx[i].size > compMax) {
- compMax = chunkIdx[i].size;
- }
- }
- compMax++;
-
- if (im->trueColor) {
- chunkMax = cs * cs * 4;
- } else {
- chunkMax = cs * cs;
- }
- chunkBuf = gdCalloc(chunkMax, 1);
- compBuf = gdCalloc(compMax, 1);
- }
-
- /* Work out start/end chunks */
- scx = srcx / cs;
- scy = srcy / cs;
- if (scx < 0) {
- scx = 0;
- }
- if (scy < 0) {
- scy = 0;
- }
-
- ecx = (srcx + w) / cs;
- ecy = (srcy + h) / cs;
- if (ecx >= ncx) {
- ecx = ncx - 1;
- }
- if (ecy >= ncy) {
- ecy = ncy - 1;
- }
-
- /* Remember file position of image data. */
- dstart = gdTell(in);
- GD2_DBG(php_gd_error("Data starts at %d\n", dstart));
-
- /* Loop through the chunks. */
- for (cy = scy; (cy <= ecy); cy++) {
- ylo = cy * cs;
- yhi = ylo + cs;
- if (yhi > fsy) {
- yhi = fsy;
- }
-
- for (cx = scx; cx <= ecx; cx++) {
-
- xlo = cx * cs;
- xhi = xlo + cs;
- if (xhi > fsx) {
- xhi = fsx;
- }
-
- GD2_DBG(php_gd_error("Processing Chunk (%d, %d), from %d to %d\n", cx, cy, ylo, yhi));
-
- if (!gd2_compressed(fmt)) {
- GD2_DBG(php_gd_error("Using raw format data\n"));
- if (im->trueColor) {
- dpos = (cy * (cs * fsx) * 4 + cx * cs * (yhi - ylo) * 4) + dstart;
- } else {
- dpos = cy * (cs * fsx) + cx * cs * (yhi - ylo) + dstart;
- }
-
- /* gd 2.0.11: gdSeek returns TRUE on success, not 0. Longstanding bug. 01/16/03 */
- if (!gdSeek(in, dpos)) {
- php_gd_error_ex(E_WARNING, "Error from seek: %d\n", errno);
- goto fail2;
- }
- GD2_DBG(php_gd_error("Reading (%d, %d) from position %d\n", cx, cy, dpos - dstart));
- } else {
- chunkNum = cx + cy * ncx;
-
- chunkLen = chunkMax;
- if (!_gd2ReadChunk (chunkIdx[chunkNum].offset, compBuf, chunkIdx[chunkNum].size, chunkBuf, &chunkLen, in)) {
- php_gd_error("Error reading comproessed chunk\n");
- goto fail2;
- }
- chunkPos = 0;
- GD2_DBG(php_gd_error("Reading (%d, %d) from chunk %d\n", cx, cy, chunkNum));
- }
-
- GD2_DBG(php_gd_error(" into (%d, %d) - (%d, %d)\n", xlo, ylo, xhi, yhi));
-
- for (y = ylo; (y < yhi); y++) {
- for (x = xlo; x < xhi; x++) {
- if (!gd2_compressed(fmt)) {
- if (im->trueColor) {
- if (!gdGetInt(&ch, in)) {
- ch = 0;
- }
- } else {
- ch = gdGetC(in);
- if (ch == EOF) {
- ch = 0;
- }
- }
- } else {
- if (im->trueColor) {
- ch = chunkBuf[chunkPos++];
- ch = (ch << 8) + chunkBuf[chunkPos++];
- ch = (ch << 8) + chunkBuf[chunkPos++];
- ch = (ch << 8) + chunkBuf[chunkPos++];
- } else {
- ch = chunkBuf[chunkPos++];
- }
- }
-
- /* Only use a point that is in the image. */
- if ((x >= srcx) && (x < (srcx + w)) && (x < fsx) && (x >= 0) && (y >= srcy) && (y < (srcy + h)) && (y < fsy) && (y >= 0)) {
- if (im->trueColor) {
- im->tpixels[y - srcy][x - srcx] = ch;
- } else {
- im->pixels[y - srcy][x - srcx] = ch;
- }
- }
- }
- }
- }
- }
-
- if (chunkBuf) {
- gdFree(chunkBuf);
- }
- if (compBuf) {
- gdFree(compBuf);
- }
- if (chunkIdx) {
- gdFree(chunkIdx);
- }
-
- return im;
-
-fail2:
- gdImageDestroy(im);
-fail1:
- if (chunkBuf) {
- gdFree(chunkBuf);
- }
- if (compBuf) {
- gdFree(compBuf);
- }
- if (chunkIdx) {
- gdFree(chunkIdx);
- }
-
- return 0;
-}
-
-static void _gd2PutHeader (gdImagePtr im, gdIOCtx * out, int cs, int fmt, int cx, int cy)
-{
- int i;
-
- /* Send the gd2 id, to verify file format. */
- for (i = 0; i < 4; i++) {
- gdPutC((unsigned char) (GD2_ID[i]), out);
- }
-
- /* We put the version info first, so future versions can easily change header info. */
-
- gdPutWord(GD2_VERS, out);
- gdPutWord(im->sx, out);
- gdPutWord(im->sy, out);
- gdPutWord(cs, out);
- gdPutWord(fmt, out);
- gdPutWord(cx, out);
- gdPutWord(cy, out);
-}
-
-static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
-{
- int ncx, ncy, cx, cy;
- int x, y, ylo, yhi, xlo, xhi;
- int chunkLen;
- int chunkNum = 0;
- char *chunkData = NULL; /* So we can gdFree it with impunity. */
- char *compData = NULL; /* So we can gdFree it with impunity. */
- uLongf compLen;
- int idxPos = 0;
- int idxSize;
- t_chunk_info *chunkIdx = NULL; /* So we can gdFree it with impunity. */
- int posSave;
- int bytesPerPixel = im->trueColor ? 4 : 1;
- int compMax = 0;
-
- /* Force fmt to a valid value since we don't return anything. */
- if ((fmt != GD2_FMT_RAW) && (fmt != GD2_FMT_COMPRESSED)) {
- fmt = im->trueColor ? GD2_FMT_TRUECOLOR_COMPRESSED : GD2_FMT_COMPRESSED;
- }
- if (im->trueColor) {
- fmt += 2;
- }
- /* Make sure chunk size is valid. These are arbitrary values; 64 because it seems
- * a little silly to expect performance improvements on a 64x64 bit scale, and
- * 4096 because we buffer one chunk, and a 16MB buffer seems a little large - it may be
- * OK for one user, but for another to read it, they require the buffer.
- */
- if (cs == 0) {
- cs = GD2_CHUNKSIZE;
- } else if (cs < GD2_CHUNKSIZE_MIN) {
- cs = GD2_CHUNKSIZE_MIN;
- } else if (cs > GD2_CHUNKSIZE_MAX) {
- cs = GD2_CHUNKSIZE_MAX;
- }
-
- /* Work out number of chunks. */
- ncx = im->sx / cs + 1;
- ncy = im->sy / cs + 1;
-
- /* Write the standard header. */
- _gd2PutHeader (im, out, cs, fmt, ncx, ncy);
-
- if (gd2_compressed(fmt)) {
- /* Work out size of buffer for compressed data, If CHUNKSIZE is large,
- * then these will be large!
- */
-
- /* The zlib notes say output buffer size should be (input size) * 1.01 * 12
- * - we'll use 1.02 to be paranoid.
- */
- compMax = (int)(cs * bytesPerPixel * cs * 1.02f) + 12;
-
- /* Allocate the buffers. */
- chunkData = gdCalloc(cs * bytesPerPixel * cs, 1);
- compData = gdCalloc(compMax, 1);
-
- /* Save the file position of chunk index, and allocate enough space for
- * each chunk_info block .
- */
- idxPos = gdTell(out);
- idxSize = ncx * ncy * sizeof(t_chunk_info);
- GD2_DBG(php_gd_error("Index size is %d\n", idxSize));
- gdSeek(out, idxPos + idxSize);
-
- chunkIdx = gdCalloc(idxSize * sizeof(t_chunk_info), 1);
- }
-
- _gdPutColors (im, out);
-
- GD2_DBG(php_gd_error("Size: %dx%d\n", im->sx, im->sy));
- GD2_DBG(php_gd_error("Chunks: %dx%d\n", ncx, ncy));
-
- for (cy = 0; (cy < ncy); cy++) {
- for (cx = 0; (cx < ncx); cx++) {
- ylo = cy * cs;
- yhi = ylo + cs;
- if (yhi > im->sy) {
- yhi = im->sy;
- }
-
- GD2_DBG(php_gd_error("Processing Chunk (%dx%d), y from %d to %d\n", cx, cy, ylo, yhi));
- chunkLen = 0;
- for (y = ylo; (y < yhi); y++) {
- GD2_DBG(php_gd_error("y=%d: ",y));
- xlo = cx * cs;
- xhi = xlo + cs;
- if (xhi > im->sx) {
- xhi = im->sx;
- }
-
- if (gd2_compressed(fmt)) {
- for (x = xlo; x < xhi; x++) {
- GD2_DBG(php_gd_error("%d...",x));
- if (im->trueColor) {
- int p = im->tpixels[y][x];
- chunkData[chunkLen++] = gdTrueColorGetAlpha(p);
- chunkData[chunkLen++] = gdTrueColorGetRed(p);
- chunkData[chunkLen++] = gdTrueColorGetGreen(p);
- chunkData[chunkLen++] = gdTrueColorGetBlue(p);
- } else {
- chunkData[chunkLen++] = im->pixels[y][x];
- }
- }
- } else {
- for (x = xlo; x < xhi; x++) {
- GD2_DBG(php_gd_error("%d, ",x));
-
- if (im->trueColor) {
- gdPutInt(im->tpixels[y][x], out);
- } else {
- gdPutC((unsigned char) im->pixels[y][x], out);
- }
- }
- }
- GD2_DBG(php_gd_error("y=%d done.\n",y));
- }
-
- if (gd2_compressed(fmt)) {
- compLen = compMax;
- if (compress((unsigned char *) &compData[0], &compLen, (unsigned char *) &chunkData[0], chunkLen) != Z_OK) {
- php_gd_error("Error from compressing\n");
- } else {
- chunkIdx[chunkNum].offset = gdTell(out);
- chunkIdx[chunkNum++].size = compLen;
- GD2_DBG(php_gd_error("Chunk %d size %d offset %d\n", chunkNum, chunkIdx[chunkNum - 1].size, chunkIdx[chunkNum - 1].offset));
-
- if (gdPutBuf (compData, compLen, out) <= 0) {
- /* Any alternate suggestions for handling this? */
- php_gd_error_ex(E_WARNING, "Error %d on write\n", errno);
- }
- }
- }
- }
- }
-
- if (gd2_compressed(fmt)) {
- /* Save the position, write the index, restore position (paranoia). */
- GD2_DBG(php_gd_error("Seeking %d to write index\n", idxPos));
- posSave = gdTell(out);
- gdSeek(out, idxPos);
- GD2_DBG(php_gd_error("Writing index\n"));
- for (x = 0; x < chunkNum; x++) {
- GD2_DBG(php_gd_error("Chunk %d size %d offset %d\n", x, chunkIdx[x].size, chunkIdx[x].offset));
- gdPutInt(chunkIdx[x].offset, out);
- gdPutInt(chunkIdx[x].size, out);
- }
- gdSeek(out, posSave);
- }
-
- GD2_DBG(php_gd_error("Freeing memory\n"));
- if (chunkData) {
- gdFree(chunkData);
- }
- if (compData) {
- gdFree(compData);
- }
- if (chunkIdx) {
- gdFree(chunkIdx);
- }
- GD2_DBG(php_gd_error("Done\n"));
-}
-
-void gdImageGd2 (gdImagePtr im, FILE * outFile, int cs, int fmt)
-{
- gdIOCtx *out = gdNewFileCtx(outFile);
-
- _gdImageGd2(im, out, cs, fmt);
-
- out->gd_free(out);
-}
-
-void *gdImageGd2Ptr (gdImagePtr im, int cs, int fmt, int *size)
-{
- void *rv;
- gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
-
- _gdImageGd2(im, out, cs, fmt);
- rv = gdDPExtractData(out, size);
- out->gd_free(out);
-
- return rv;
-}
diff --git a/ext/gd/libgd/gd_gif_in.c b/ext/gd/libgd/gd_gif_in.c
deleted file mode 100644
index df8cc2ec0e..0000000000
--- a/ext/gd/libgd/gd_gif_in.c
+++ /dev/null
@@ -1,580 +0,0 @@
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include "gd.h"
-
-#include "php.h"
-
-/* Used only when debugging GIF compression code */
-/* #define DEBUGGING_ENVARS */
-
-#ifdef DEBUGGING_ENVARS
-
-static int verbose_set = 0;
-static int verbose;
-#define VERBOSE (verbose_set?verbose:set_verbose())
-
-static int set_verbose(void)
-{
- verbose = !!getenv("GIF_VERBOSE");
- verbose_set = 1;
- return(verbose);
-}
-
-#else
-
-#define VERBOSE 0
-
-#endif
-
-
-#define MAXCOLORMAPSIZE 256
-
-#define TRUE 1
-#define FALSE 0
-
-#define CM_RED 0
-#define CM_GREEN 1
-#define CM_BLUE 2
-
-#define MAX_LWZ_BITS 12
-
-#define INTERLACE 0x40
-#define LOCALCOLORMAP 0x80
-#define BitSet(byte, bit) (((byte) & (bit)) == (bit))
-
-#define ReadOK(file,buffer,len) (gdGetBuf(buffer, len, file) != 0)
-
-#define LM_to_uint(a,b) (((b)<<8)|(a))
-
-/* We may eventually want to use this information, but def it out for now */
-#if 0
-static struct {
- unsigned int Width;
- unsigned int Height;
- unsigned char ColorMap[3][MAXCOLORMAPSIZE];
- unsigned int BitPixel;
- unsigned int ColorResolution;
- unsigned int Background;
- unsigned int AspectRatio;
-} GifScreen;
-#endif
-
-static struct {
- int transparent;
- int delayTime;
- int inputFlag;
- int disposal;
-} Gif89 = { -1, -1, -1, 0 };
-
-static int ReadColorMap (gdIOCtx *fd, int number, unsigned char (*buffer)[256]);
-static int DoExtension (gdIOCtx *fd, int label, int *Transparent);
-static int GetDataBlock (gdIOCtx *fd, unsigned char *buf);
-static int GetCode (gdIOCtx *fd, int code_size, int flag);
-static int LWZReadByte (gdIOCtx *fd, int flag, int input_code_size);
-
-static void ReadImage (gdImagePtr im, gdIOCtx *fd, int len, int height, unsigned char (*cmap)[256], int interlace); /*1.4//, int ignore); */
-
-int ZeroDataBlock;
-
-gdImagePtr gdImageCreateFromGifSource(gdSourcePtr inSource)
-{
- gdIOCtx *in = gdNewSSCtx(inSource, NULL);
- gdImagePtr im;
-
- im = gdImageCreateFromGifCtx(in);
-
- in->gd_free(in);
-
- return im;
-}
-
-gdImagePtr
-gdImageCreateFromGif(FILE *fdFile)
-{
- gdIOCtx *fd = gdNewFileCtx(fdFile);
- gdImagePtr im = 0;
-
- im = gdImageCreateFromGifCtx(fd);
-
- fd->gd_free(fd);
-
- return im;
-}
-
-gdImagePtr
-gdImageCreateFromGifCtx(gdIOCtxPtr fd)
-{
-/* 1.4 int imageNumber; */
- int BitPixel;
- int ColorResolution;
- int Background;
- int AspectRatio;
- int Transparent = (-1);
- unsigned char buf[16];
- unsigned char c;
- unsigned char ColorMap[3][MAXCOLORMAPSIZE];
- unsigned char localColorMap[3][MAXCOLORMAPSIZE];
- int imw, imh;
- int useGlobalColormap;
- int bitPixel;
- int i;
- /*1.4//int imageCount = 0; */
- char version[4];
-
- gdImagePtr im = 0;
- ZeroDataBlock = FALSE;
-
- /*1.4//imageNumber = 1; */
- if (! ReadOK(fd,buf,6)) {
- return 0;
- }
- if (strncmp((char *)buf,"GIF",3) != 0) {
- return 0;
- }
- strncpy(version, (char *)buf + 3, 3);
- version[3] = '\0';
-
- if ((strcmp(version, "87a") != 0) && (strcmp(version, "89a") != 0)) {
- return 0;
- }
- if (! ReadOK(fd,buf,7)) {
- return 0;
- }
- BitPixel = 2<<(buf[4]&0x07);
- ColorResolution = (int) (((buf[4]&0x70)>>3)+1);
- Background = buf[5];
- AspectRatio = buf[6];
-
- if (BitSet(buf[4], LOCALCOLORMAP)) { /* Global Colormap */
- if (ReadColorMap(fd, BitPixel, ColorMap)) {
- return 0;
- }
- }
- for (;;) {
- if (! ReadOK(fd,&c,1)) {
- return 0;
- }
- if (c == ';') { /* GIF terminator */
- goto terminated;
- }
-
- if (c == '!') { /* Extension */
- if (! ReadOK(fd,&c,1)) {
- return 0;
- }
- DoExtension(fd, c, &Transparent);
- continue;
- }
-
- if (c != ',') { /* Not a valid start character */
- continue;
- }
-
- /*1.4//++imageCount; */
-
- if (! ReadOK(fd,buf,9)) {
- return 0;
- }
-
- useGlobalColormap = ! BitSet(buf[8], LOCALCOLORMAP);
-
- bitPixel = 1<<((buf[8]&0x07)+1);
-
- imw = LM_to_uint(buf[4],buf[5]);
- imh = LM_to_uint(buf[6],buf[7]);
- if (!(im = gdImageCreate(imw, imh))) {
- return 0;
- }
- im->interlace = BitSet(buf[8], INTERLACE);
- if (! useGlobalColormap) {
- if (ReadColorMap(fd, bitPixel, localColorMap)) {
- return 0;
- }
- ReadImage(im, fd, imw, imh, localColorMap,
- BitSet(buf[8], INTERLACE));
- /*1.4//imageCount != imageNumber); */
- } else {
- ReadImage(im, fd, imw, imh,
- ColorMap,
- BitSet(buf[8], INTERLACE));
- /*1.4//imageCount != imageNumber); */
- }
- if (Transparent != (-1)) {
- gdImageColorTransparent(im, Transparent);
- }
- goto terminated;
- }
-
-terminated:
- /* Terminator before any image was declared! */
- if (!im) {
- return 0;
- }
- /* Check for open colors at the end, so
- we can reduce colorsTotal and ultimately
- BitsPerPixel */
- for (i=((im->colorsTotal-1)); (i>=0); i--) {
- if (im->open[i]) {
- im->colorsTotal--;
- } else {
- break;
- }
- }
- return im;
-}
-
-static int
-ReadColorMap(gdIOCtx *fd, int number, unsigned char (*buffer)[256])
-{
- int i;
- unsigned char rgb[3];
-
-
- for (i = 0; i < number; ++i) {
- if (! ReadOK(fd, rgb, sizeof(rgb))) {
- return TRUE;
- }
- buffer[CM_RED][i] = rgb[0] ;
- buffer[CM_GREEN][i] = rgb[1] ;
- buffer[CM_BLUE][i] = rgb[2] ;
- }
-
-
- return FALSE;
-}
-
-static int
-DoExtension(gdIOCtx *fd, int label, int *Transparent)
-{
- static unsigned char buf[256];
-
- switch (label) {
- case 0xf9: /* Graphic Control Extension */
- (void) GetDataBlock(fd, (unsigned char*) buf);
- Gif89.disposal = (buf[0] >> 2) & 0x7;
- Gif89.inputFlag = (buf[0] >> 1) & 0x1;
- Gif89.delayTime = LM_to_uint(buf[1],buf[2]);
- if ((buf[0] & 0x1) != 0)
- *Transparent = buf[3];
-
- while (GetDataBlock(fd, (unsigned char*) buf) != 0)
- ;
- return FALSE;
- default:
- break;
- }
- while (GetDataBlock(fd, (unsigned char*) buf) != 0)
- ;
-
- return FALSE;
-}
-
-static int
-GetDataBlock_(gdIOCtx *fd, unsigned char *buf)
-{
- unsigned char count;
-
- if (! ReadOK(fd,&count,1)) {
- return -1;
- }
-
- ZeroDataBlock = count == 0;
-
- if ((count != 0) && (! ReadOK(fd, buf, count))) {
- return -1;
- }
-
- return count;
-}
-
-static int
-GetDataBlock(gdIOCtx *fd, unsigned char *buf)
-{
- int rv;
- int i;
- char *tmp = NULL;
-
- rv = GetDataBlock_(fd,buf);
- if (VERBOSE) {
- if (rv > 0) {
- tmp = emalloc((3*sizeof(char)*rv) + 1);
- for (i=0;i<rv;i++) {
- sprintf(&tmp[3*sizeof(char)*i], " %02x", buf[i]);
- }
- } else {
- tmp = estrdup("");
- }
- php_gd_error_ex(E_NOTICE, "[GetDataBlock returning %d: %s]", rv, tmp);
- efree(tmp);
- }
- return(rv);
-}
-
-static int
-GetCode_(gdIOCtx *fd, int code_size, int flag)
-{
- static unsigned char buf[280];
- static int curbit, lastbit, done, last_byte;
- int i, j, ret;
- unsigned char count;
-
- if (flag) {
- curbit = 0;
- lastbit = 0;
- done = FALSE;
- return 0;
- }
-
- if ( (curbit+code_size) >= lastbit) {
- if (done) {
- if (curbit >= lastbit) {
- /* Oh well */
- }
- return -1;
- }
- buf[0] = buf[last_byte-2];
- buf[1] = buf[last_byte-1];
-
- if ((count = GetDataBlock(fd, &buf[2])) == 0)
- done = TRUE;
-
- last_byte = 2 + count;
- curbit = (curbit - lastbit) + 16;
- lastbit = (2+count)*8 ;
- }
-
- ret = 0;
- for (i = curbit, j = 0; j < code_size; ++i, ++j)
- ret |= ((buf[ i / 8 ] & (1 << (i % 8))) != 0) << j;
-
- curbit += code_size;
- return ret;
-}
-
-static int
-GetCode(gdIOCtx *fd, int code_size, int flag)
-{
- int rv;
-
- rv = GetCode_(fd,code_size,flag);
- if (VERBOSE) php_gd_error_ex(E_NOTICE, "[GetCode(,%d,%d) returning %d]\n",code_size,flag,rv);
- return(rv);
-}
-
-#define STACK_SIZE ((1<<(MAX_LWZ_BITS))*2)
-static int
-LWZReadByte_(gdIOCtx *fd, int flag, int input_code_size)
-{
- static int fresh = FALSE;
- int code, incode;
- static int code_size, set_code_size;
- static int max_code, max_code_size;
- static int firstcode, oldcode;
- static int clear_code, end_code;
- static int table[2][(1<< MAX_LWZ_BITS)];
- static int stack[STACK_SIZE], *sp;
- register int i;
-
- if (flag) {
- set_code_size = input_code_size;
- code_size = set_code_size+1;
- clear_code = 1 << set_code_size ;
- end_code = clear_code + 1;
- max_code_size = 2*clear_code;
- max_code = clear_code+2;
-
- GetCode(fd, 0, TRUE);
-
- fresh = TRUE;
-
- for (i = 0; i < clear_code; ++i) {
- table[0][i] = 0;
- table[1][i] = i;
- }
- for (; i < (1<<MAX_LWZ_BITS); ++i)
- table[0][i] = table[1][0] = 0;
-
- sp = stack;
-
- return 0;
- } else if (fresh) {
- fresh = FALSE;
- do {
- firstcode = oldcode =
- GetCode(fd, code_size, FALSE);
- } while (firstcode == clear_code);
- return firstcode;
- }
-
- if (sp > stack)
- return *--sp;
-
- while ((code = GetCode(fd, code_size, FALSE)) >= 0) {
- if (code == clear_code) {
- for (i = 0; i < clear_code; ++i) {
- table[0][i] = 0;
- table[1][i] = i;
- }
- for (; i < (1<<MAX_LWZ_BITS); ++i)
- table[0][i] = table[1][i] = 0;
- code_size = set_code_size+1;
- max_code_size = 2*clear_code;
- max_code = clear_code+2;
- sp = stack;
- firstcode = oldcode =
- GetCode(fd, code_size, FALSE);
- return firstcode;
- } else if (code == end_code) {
- int count;
- unsigned char buf[260];
-
- if (ZeroDataBlock)
- return -2;
-
- while ((count = GetDataBlock(fd, buf)) > 0)
- ;
-
- if (count != 0)
- return -2;
- }
-
- incode = code;
-
- if (sp == (stack + STACK_SIZE)) {
- /* Bad compressed data stream */
- return -1;
- }
-
- if (code >= max_code) {
- *sp++ = firstcode;
- code = oldcode;
- }
-
- while (code >= clear_code) {
- if (sp == (stack + STACK_SIZE)) {
- /* Bad compressed data stream */
- return -1;
- }
- *sp++ = table[1][code];
- if (code == table[0][code]) {
- /* Oh well */
- }
- code = table[0][code];
- }
-
- *sp++ = firstcode = table[1][code];
-
- if ((code = max_code) <(1<<MAX_LWZ_BITS)) {
- table[0][code] = oldcode;
- table[1][code] = firstcode;
- ++max_code;
- if ((max_code >= max_code_size) &&
- (max_code_size < (1<<MAX_LWZ_BITS))) {
- max_code_size *= 2;
- ++code_size;
- }
- }
-
- oldcode = incode;
-
- if (sp > stack)
- return *--sp;
- }
- return code;
-}
-
-static int
-LWZReadByte(gdIOCtx *fd, int flag, int input_code_size)
-{
- int rv;
-
- rv = LWZReadByte_(fd,flag,input_code_size);
- if (VERBOSE) php_gd_error_ex(E_NOTICE, "[LWZReadByte(,%d,%d) returning %d]\n",flag,input_code_size,rv);
- return(rv);
-}
-
-static void
-ReadImage(gdImagePtr im, gdIOCtx *fd, int len, int height, unsigned char (*cmap)[256], int interlace) /*1.4//, int ignore) */
-{
- unsigned char c;
- int v;
- int xpos = 0, ypos = 0, pass = 0;
- int i;
- /* Stash the color map into the image */
- for (i=0; (i<gdMaxColors); i++) {
- im->red[i] = cmap[CM_RED][i];
- im->green[i] = cmap[CM_GREEN][i];
- im->blue[i] = cmap[CM_BLUE][i];
- im->open[i] = 1;
- }
- /* Many (perhaps most) of these colors will remain marked open. */
- im->colorsTotal = gdMaxColors;
- /*
- ** Initialize the Compression routines
- */
- if (! ReadOK(fd,&c,1)) {
- return;
- }
- if (LWZReadByte(fd, TRUE, c) < 0) {
- return;
- }
-
- /*
- ** If this is an "uninteresting picture" ignore it.
- ** REMOVED For 1.4
- */
- /*if (ignore) { */
- /* while (LWZReadByte(fd, FALSE, c) >= 0) */
- /* ; */
- /* return; */
- /*} */
-
- while ((v = LWZReadByte(fd,FALSE,c)) >= 0 ) {
- /* This how we recognize which colors are actually used. */
- if (im->open[v]) {
- im->open[v] = 0;
- }
- gdImageSetPixel(im, xpos, ypos, v);
- ++xpos;
- if (xpos == len) {
- xpos = 0;
- if (interlace) {
- switch (pass) {
- case 0:
- case 1:
- ypos += 8; break;
- case 2:
- ypos += 4; break;
- case 3:
- ypos += 2; break;
- }
-
- if (ypos >= height) {
- ++pass;
- switch (pass) {
- case 1:
- ypos = 4; break;
- case 2:
- ypos = 2; break;
- case 3:
- ypos = 1; break;
- default:
- goto fini;
- }
- }
- } else {
- ++ypos;
- }
- }
- if (ypos >= height)
- break;
- }
-
-fini:
- if (LWZReadByte(fd,FALSE,c)>=0) {
- /* Ignore extra */
- }
-}
-
diff --git a/ext/gd/libgd/gd_io.c b/ext/gd/libgd/gd_io.c
deleted file mode 100644
index 9dbd1862a2..0000000000
--- a/ext/gd/libgd/gd_io.c
+++ /dev/null
@@ -1,146 +0,0 @@
-
-
-/*
- * io.c
- *
- * Implements the imple I/O 'helper' routines.
- *
- * Not really essential, but these routines were used extensively in GD,
- * so they were moved here. They also make IOCtx calls look better...
- *
- * Written (or, at least, moved) 1999, Philip Warner.
- *
- */
-
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include "gd.h"
-
-/* Use this for commenting out debug-print statements. */
-/* Just use the first '#define' to allow all the prints... */
-/*#define IO_DBG(s) (s) */
-#define IO_DBG(s)
-
-
-#define GD_IO_EOF_CHK(r) \
- if (r == EOF) { \
- return 0; \
- } \
-
-/*
- * Write out a word to the I/O context pointer
- */
-void Putword (int w, gdIOCtx * ctx)
-{
- unsigned char buf[2];
-
- buf[0] = w & 0xff;
- buf[1] = (w / 256) & 0xff;
- (ctx->putBuf) (ctx, (char *) buf, 2);
-}
-
-void Putchar (int c, gdIOCtx * ctx)
-{
- (ctx->putC) (ctx, c & 0xff);
-}
-
-void gdPutC (const unsigned char c, gdIOCtx * ctx)
-{
- (ctx->putC) (ctx, c);
-}
-
-void gdPutWord (int w, gdIOCtx * ctx)
-{
- IO_DBG (php_gd_error("Putting word...\n"));
- (ctx->putC) (ctx, (unsigned char) (w >> 8));
- (ctx->putC) (ctx, (unsigned char) (w & 0xFF));
- IO_DBG (php_gd_error("put.\n"));
-}
-
-void gdPutInt (int w, gdIOCtx * ctx)
-{
- IO_DBG (php_gd_error("Putting int...\n"));
- (ctx->putC) (ctx, (unsigned char) (w >> 24));
- (ctx->putC) (ctx, (unsigned char) ((w >> 16) & 0xFF));
- (ctx->putC) (ctx, (unsigned char) ((w >> 8) & 0xFF));
- (ctx->putC) (ctx, (unsigned char) (w & 0xFF));
- IO_DBG (php_gd_error("put.\n"));
-}
-
-int gdGetC (gdIOCtx * ctx)
-{
- return ((ctx->getC) (ctx));
-}
-
-int gdGetByte (int *result, gdIOCtx * ctx)
-{
- int r;
- r = (ctx->getC) (ctx);
- GD_IO_EOF_CHK(r);
- *result = r;
- return 1;
-}
-
-int gdGetWord (int *result, gdIOCtx * ctx)
-{
- int r;
- r = (ctx->getC) (ctx);
- GD_IO_EOF_CHK(r);
- *result = r << 8;
- r = (ctx->getC) (ctx);
- GD_IO_EOF_CHK(r);
- *result += r;
- return 1;
-}
-
-
-int gdGetInt (int *result, gdIOCtx * ctx)
-{
- int r;
- r = (ctx->getC) (ctx);
- GD_IO_EOF_CHK(r);
- *result = r << 24;
-
- r = (ctx->getC) (ctx);
- GD_IO_EOF_CHK(r);
- *result += r << 16;
-
- r = (ctx->getC) (ctx);
- if (r == EOF) {
- return 0;
- }
- *result += r << 8;
-
- r = (ctx->getC) (ctx);
- GD_IO_EOF_CHK(r);
- *result += r;
-
- return 1;
-}
-
-int gdPutBuf (const void *buf, int size, gdIOCtx * ctx)
-{
- IO_DBG (php_gd_error("Putting buf...\n"));
- return (ctx->putBuf) (ctx, buf, size);
- IO_DBG (php_gd_error("put.\n"));
-}
-
-int gdGetBuf (void *buf, int size, gdIOCtx * ctx)
-{
- return (ctx->getBuf) (ctx, buf, size);
-}
-
-int gdSeek (gdIOCtx * ctx, const int pos)
-{
- IO_DBG (php_gd_error("Seeking...\n"));
- return ((ctx->seek) (ctx, pos));
- IO_DBG (php_gd_error("Done.\n"));
-}
-
-long gdTell (gdIOCtx * ctx)
-{
- IO_DBG (php_gd_error("Telling...\n"));
- return ((ctx->tell) (ctx));
- IO_DBG (php_gd_error ("told.\n"));
-}
diff --git a/ext/gd/libgd/gd_io.h b/ext/gd/libgd/gd_io.h
deleted file mode 100644
index 20408e2415..0000000000
--- a/ext/gd/libgd/gd_io.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef GD_IO_H
-#define GD_IO_H 1
-
-#include <stdio.h>
-
-#ifdef VMS
-#define Putchar gdPutchar
-#endif
-
-typedef struct gdIOCtx {
- int (*getC)(struct gdIOCtx*);
- int (*getBuf)(struct gdIOCtx*, void*, int);
-
- void (*putC)(struct gdIOCtx*, int);
- int (*putBuf)(struct gdIOCtx*, const void*, int);
-
- int (*seek)(struct gdIOCtx*, const int);
- long (*tell)(struct gdIOCtx*);
-
- void (*gd_free)(struct gdIOCtx*);
-
-} gdIOCtx;
-
-typedef struct gdIOCtx *gdIOCtxPtr;
-
-void Putword(int w, gdIOCtx *ctx);
-void Putchar(int c, gdIOCtx *ctx);
-
-void gdPutC(const unsigned char c, gdIOCtx *ctx);
-int gdPutBuf(const void *, int, gdIOCtx*);
-void gdPutWord(int w, gdIOCtx *ctx);
-void gdPutInt(int w, gdIOCtx *ctx);
-
-int gdGetC(gdIOCtx *ctx);
-int gdGetBuf(void *, int, gdIOCtx*);
-int gdGetByte(int *result, gdIOCtx *ctx);
-int gdGetWord(int *result, gdIOCtx *ctx);
-int gdGetInt(int *result, gdIOCtx *ctx);
-
-int gdSeek(gdIOCtx *ctx, const int);
-long gdTell(gdIOCtx *ctx);
-
-#endif
diff --git a/ext/gd/libgd/gd_io_dp.c b/ext/gd/libgd/gd_io_dp.c
deleted file mode 100644
index 8872afa213..0000000000
--- a/ext/gd/libgd/gd_io_dp.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * io_dp.c
- *
- * Implements the dynamic pointer interface.
- *
- * Based on GD.pm code by Lincoln Stein for interfacing to libgd.
- * Added support for reading as well as support for 'tell' and 'seek'.
- *
- * As will all I/O modules, most functions are for local use only (called
- * via function pointers in the I/O context).
- *
- * gdDPExtractData is the exception to this: it will return the pointer to
- * the internal data, and reset the internal storage.
- *
- * Written/Modified 1999, Philip Warner.
- *
- */
-
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include "gd.h"
-#include "gdhelpers.h"
-
-#define TRUE 1
-#define FALSE 0
-
-/* this is used for creating images in main memory */
-typedef struct dpStruct
-{
- void *data;
- int logicalSize;
- int realSize;
- int dataGood;
- int pos;
-} dynamicPtr;
-
-typedef struct dpIOCtx
-{
- gdIOCtx ctx;
- dynamicPtr *dp;
-} dpIOCtx;
-
-typedef struct dpIOCtx *dpIOCtxPtr;
-
-/* these functions operate on in-memory dynamic pointers */
-static int allocDynamic (dynamicPtr * dp, int initialSize, void *data);
-static int appendDynamic (dynamicPtr * dp, const void *src, int size);
-static int gdReallocDynamic (dynamicPtr * dp, int required);
-static int trimDynamic (dynamicPtr * dp);
-static void gdFreeDynamicCtx (struct gdIOCtx *ctx);
-static dynamicPtr *newDynamic (int initialSize, void *data);
-
-static int dynamicPutbuf (struct gdIOCtx *, const void *, int);
-static void dynamicPutchar (struct gdIOCtx *, int a);
-
-static int dynamicGetbuf (gdIOCtxPtr ctx, void *buf, int len);
-static int dynamicGetchar (gdIOCtxPtr ctx);
-
-static int dynamicSeek (struct gdIOCtx *, const int);
-static long dynamicTell (struct gdIOCtx *);
-
-/* return data as a dynamic pointer */
-gdIOCtx * gdNewDynamicCtx (int initialSize, void *data)
-{
- dpIOCtx *ctx;
- dynamicPtr *dp;
-
- ctx = (dpIOCtx *) gdMalloc (sizeof (dpIOCtx));
-
- dp = newDynamic(initialSize, data);
-
- ctx->dp = dp;
-
- ctx->ctx.getC = dynamicGetchar;
- ctx->ctx.putC = dynamicPutchar;
-
- ctx->ctx.getBuf = dynamicGetbuf;
- ctx->ctx.putBuf = dynamicPutbuf;
-
- ctx->ctx.seek = dynamicSeek;
- ctx->ctx.tell = dynamicTell;
-
- ctx->ctx.gd_free = gdFreeDynamicCtx;
-
- return (gdIOCtx *) ctx;
-}
-
-void * gdDPExtractData (struct gdIOCtx *ctx, int *size)
-{
- dynamicPtr *dp;
- dpIOCtx *dctx;
- void *data;
-
- dctx = (dpIOCtx *) ctx;
- dp = dctx->dp;
-
- /* clean up the data block and return it */
- if (dp->dataGood) {
- trimDynamic (dp);
- *size = dp->logicalSize;
- data = dp->data;
- } else {
- *size = 0;
- data = NULL;
- if (dp->data != NULL) {
- gdFree(dp->data);
- }
- }
-
- dp->data = NULL;
- dp->realSize = 0;
- dp->logicalSize = 0;
-
- return data;
-}
-
-static void gdFreeDynamicCtx (struct gdIOCtx *ctx)
-{
- dynamicPtr *dp;
- dpIOCtx *dctx;
-
- dctx = (dpIOCtx *) ctx;
- dp = dctx->dp;
-
- gdFree(ctx);
-
- dp->realSize = 0;
- dp->logicalSize = 0;
-
- gdFree(dp);
-}
-
-static long dynamicTell (struct gdIOCtx *ctx)
-{
- dpIOCtx *dctx;
-
- dctx = (dpIOCtx *) ctx;
-
- return (dctx->dp->pos);
-}
-
-static int dynamicSeek (struct gdIOCtx *ctx, const int pos)
-{
- int bytesNeeded;
- dynamicPtr *dp;
- dpIOCtx *dctx;
-
- dctx = (dpIOCtx *) ctx;
- dp = dctx->dp;
-
- if (!dp->dataGood) {
- return FALSE;
- }
-
- bytesNeeded = pos;
- if (bytesNeeded > dp->realSize) {
- gdReallocDynamic (dp, dp->realSize * 2);
- }
-
- /* if we get here, we can be sure that we have enough bytes to copy safely */
-
- /* Extend the logical size if we seek beyond EOF. */
- if (pos > dp->logicalSize) {
- dp->logicalSize = pos;
- }
-
- dp->pos = pos;
-
- return TRUE;
-}
-
-/* return data as a dynamic pointer */
-static dynamicPtr * newDynamic (int initialSize, void *data)
-{
- dynamicPtr *dp;
- dp = (dynamicPtr *) gdMalloc (sizeof (dynamicPtr));
-
- allocDynamic (dp, initialSize, data);
-
- dp->pos = 0;
-
- return dp;
-}
-
-static int
-dynamicPutbuf (struct gdIOCtx *ctx, const void *buf, int size)
-{
- dpIOCtx *dctx;
- dctx = (dpIOCtx *) ctx;
-
- appendDynamic (dctx->dp, buf, size);
-
- if (dctx->dp->dataGood)
- {
- return size;
- }
- else
- {
- return -1;
- };
-
-}
-
-static void dynamicPutchar (struct gdIOCtx *ctx, int a)
-{
- unsigned char b;
- dpIOCtxPtr dctx;
-
- b = a;
- dctx = (dpIOCtxPtr) ctx;
-
- appendDynamic(dctx->dp, &b, 1);
-}
-
-static int dynamicGetbuf (gdIOCtxPtr ctx, void *buf, int len)
-{
- int rlen, remain;
- dpIOCtxPtr dctx;
- dynamicPtr *dp;
-
- dctx = (dpIOCtxPtr) ctx;
- dp = dctx->dp;
-
- remain = dp->logicalSize - dp->pos;
- if (remain >= len) {
- rlen = len;
- } else {
- if (remain == 0) {
- return EOF;
- }
- rlen = remain;
- }
-
- memcpy(buf, (void *) ((char *) dp->data + dp->pos), rlen);
- dp->pos += rlen;
-
- return rlen;
-}
-
-static int dynamicGetchar (gdIOCtxPtr ctx)
-{
- unsigned char b;
- int rv;
-
- rv = dynamicGetbuf (ctx, &b, 1);
- if (rv != 1) {
- return EOF;
- } else {
- return b; /* (b & 0xff); */
- }
-}
-
-/* *********************************************************************
-
- * InitDynamic - Return a dynamically resizable void*
- *
- * *********************************************************************
- */
-static int
-allocDynamic (dynamicPtr * dp, int initialSize, void *data)
-{
-
- if (data == NULL) {
- dp->logicalSize = 0;
- dp->dataGood = FALSE;
- dp->data = gdMalloc(initialSize);
- } else {
- dp->logicalSize = initialSize;
- dp->dataGood = TRUE;
- dp->data = data;
- }
-
- dp->realSize = initialSize;
- dp->dataGood = TRUE;
- dp->pos = 0;
-
- return TRUE;
-}
-
-/* append bytes to the end of a dynamic pointer */
-static int appendDynamic (dynamicPtr * dp, const void *src, int size)
-{
- int bytesNeeded;
- char *tmp;
-
- if (!dp->dataGood) {
- return FALSE;
- }
-
- /* bytesNeeded = dp->logicalSize + size; */
- bytesNeeded = dp->pos + size;
-
- if (bytesNeeded > dp->realSize) {
- gdReallocDynamic(dp, bytesNeeded * 2);
- }
-
- /* if we get here, we can be sure that we have enough bytes to copy safely */
- /*printf("Mem OK Size: %d, Pos: %d\n", dp->realSize, dp->pos); */
-
- tmp = (char *) dp->data;
- memcpy((void *) (tmp + (dp->pos)), src, size);
- dp->pos += size;
-
- if (dp->pos > dp->logicalSize) {
- dp->logicalSize = dp->pos;
- }
-
- return TRUE;
-}
-
-/* grow (or shrink) dynamic pointer */
-static int gdReallocDynamic (dynamicPtr * dp, int required)
-{
- void *newPtr;
-
- /* First try gdRealloc(). If that doesn't work, make a new memory block and copy. */
- if ((newPtr = gdRealloc(dp->data, required))) {
- dp->realSize = required;
- dp->data = newPtr;
- return TRUE;
- }
-
- /* create a new pointer */
- newPtr = gdMalloc(required);
-
- /* copy the old data into it */
- memcpy(newPtr, dp->data, dp->logicalSize);
- gdFree(dp->data);
- dp->data = newPtr;
-
- dp->realSize = required;
-
- return TRUE;
-}
-
-/* trim pointer so that its real and logical sizes match */
-static int trimDynamic (dynamicPtr * dp)
-{
- return gdReallocDynamic(dp, dp->logicalSize);
-}
diff --git a/ext/gd/libgd/gd_io_file.c b/ext/gd/libgd/gd_io_file.c
deleted file mode 100644
index 4544489890..0000000000
--- a/ext/gd/libgd/gd_io_file.c
+++ /dev/null
@@ -1,130 +0,0 @@
-
-/*
- * io_file.c
- *
- * Implements the file interface.
- *
- * As will all I/O modules, most functions are for local use only (called
- * via function pointers in the I/O context).
- *
- * Most functions are just 'wrappers' for standard file functions.
- *
- * Written/Modified 1999, Philip Warner.
- *
- */
-
-/* For platforms with incomplete ANSI defines. Fortunately,
- SEEK_SET is defined to be zero by the standard. */
-
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif /* SEEK_SET */
-
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include "gd.h"
-#include "gdhelpers.h"
-
-/* this is used for creating images in main memory */
-
-typedef struct fileIOCtx
-{
- gdIOCtx ctx;
- FILE *f;
-} fileIOCtx;
-
-struct fileIOCtx *fileIOCtxPtr;
-
-gdIOCtx *newFileCtx (FILE * f);
-
-static int fileGetbuf (gdIOCtx *, void *, int);
-static int filePutbuf (gdIOCtx *, const void *, int);
-static void filePutchar (gdIOCtx *, int);
-static int fileGetchar (gdIOCtx * ctx);
-
-static int fileSeek (struct gdIOCtx *, const int);
-static long fileTell (struct gdIOCtx *);
-static void gdFreeFileCtx (gdIOCtx * ctx);
-
-/* return data as a dynamic pointer */
-gdIOCtx * gdNewFileCtx (FILE * f)
-{
- fileIOCtx *ctx;
-
- ctx = (fileIOCtx *) gdMalloc(sizeof (fileIOCtx));
-
- ctx->f = f;
-
- ctx->ctx.getC = fileGetchar;
- ctx->ctx.putC = filePutchar;
-
- ctx->ctx.getBuf = fileGetbuf;
- ctx->ctx.putBuf = filePutbuf;
-
- ctx->ctx.tell = fileTell;
- ctx->ctx.seek = fileSeek;
-
- ctx->ctx.gd_free = gdFreeFileCtx;
-
- return (gdIOCtx *) ctx;
-}
-
-static void gdFreeFileCtx (gdIOCtx * ctx)
-{
- gdFree(ctx);
-}
-
-
-static int filePutbuf (gdIOCtx * ctx, const void *buf, int size)
-{
- fileIOCtx *fctx;
- fctx = (fileIOCtx *) ctx;
-
- return fwrite(buf, 1, size, fctx->f);
-
-}
-
-static int fileGetbuf (gdIOCtx * ctx, void *buf, int size)
-{
- fileIOCtx *fctx;
- fctx = (fileIOCtx *) ctx;
-
- return fread(buf, 1, size, fctx->f);
-}
-
-static void filePutchar (gdIOCtx * ctx, int a)
-{
- unsigned char b;
- fileIOCtx *fctx;
- fctx = (fileIOCtx *) ctx;
-
- b = a;
-
- putc (b, fctx->f);
-}
-
-static int fileGetchar (gdIOCtx * ctx)
-{
- fileIOCtx *fctx;
- fctx = (fileIOCtx *) ctx;
-
- return getc (fctx->f);
-}
-
-
-static int fileSeek (struct gdIOCtx *ctx, const int pos)
-{
- fileIOCtx *fctx;
- fctx = (fileIOCtx *) ctx;
-
- return (fseek (fctx->f, pos, SEEK_SET) == 0);
-}
-
-static long fileTell (struct gdIOCtx *ctx)
-{
- fileIOCtx *fctx;
- fctx = (fileIOCtx *) ctx;
-
- return ftell (fctx->f);
-}
diff --git a/ext/gd/libgd/gd_io_ss.c b/ext/gd/libgd/gd_io_ss.c
deleted file mode 100644
index 15ab18d9bb..0000000000
--- a/ext/gd/libgd/gd_io_ss.c
+++ /dev/null
@@ -1,138 +0,0 @@
-
-/*
- * io_ss.c
- *
- * Implements the Source/Sink interface.
- *
- * As will all I/O modules, most functions are for local use only (called
- * via function pointers in the I/O context).
- *
- * The Source/Sink model is the primary 'user' interface for alternate data
- * sources; the IOCtx interface is intended (at least in version 1.5) to be
- * used internally until it settles down a bit.
- *
- * This module just layers the Source/Sink interface on top of the IOCtx; no
- * support is provided for tell/seek, so GD2 writing is not possible, and
- * retrieving parts of GD2 files is also not possible.
- *
- * A new SS context does not need to be created with both a Source and a Sink.
- *
- * Written/Modified 1999, Philip Warner.
- *
- */
-
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include "gd.h"
-#include "gdhelpers.h"
-
-/* this is used for creating images in main memory */
-
-typedef struct ssIOCtx
-{
- gdIOCtx ctx;
- gdSourcePtr src;
- gdSinkPtr snk;
-} ssIOCtx;
-
-typedef struct ssIOCtx *ssIOCtxPtr;
-
-gdIOCtx *gdNewSSCtx (gdSourcePtr src, gdSinkPtr snk);
-
-static int sourceGetbuf (gdIOCtx *, void *, int);
-static int sourceGetchar (gdIOCtx * ctx);
-static int sinkPutbuf (gdIOCtx * ctx, const void *buf, int size);
-static void sinkPutchar (gdIOCtx * ctx, int a);
-static void gdFreeSsCtx (gdIOCtx * ctx);
-
-/* return data as a dynamic pointer */
-gdIOCtx * gdNewSSCtx (gdSourcePtr src, gdSinkPtr snk)
-{
- ssIOCtxPtr ctx;
-
- ctx = (ssIOCtxPtr) gdMalloc (sizeof (ssIOCtx));
-
- ctx->src = src;
- ctx->snk = snk;
-
- ctx->ctx.getC = sourceGetchar;
- ctx->ctx.getBuf = sourceGetbuf;
-
- ctx->ctx.putC = sinkPutchar;
- ctx->ctx.putBuf = sinkPutbuf;
-
- ctx->ctx.tell = NULL;
- ctx->ctx.seek = NULL;
-
- ctx->ctx.gd_free = gdFreeSsCtx;
-
- return (gdIOCtx *) ctx;
-}
-
-static void gdFreeSsCtx (gdIOCtx * ctx)
-{
- gdFree(ctx);
-}
-
-
-static int sourceGetbuf (gdIOCtx * ctx, void *buf, int size)
-{
- ssIOCtx *lctx;
- int res;
-
- lctx = (ssIOCtx *) ctx;
-
- res = ((lctx->src->source) (lctx->src->context, buf, size));
-
- /*
- * Translate the return values from the Source object:
- * 0 is EOF, -1 is error
- */
-
- if (res == 0) {
- return EOF;
- } else if (res < 0) {
- return 0;
- } else {
- return res;
- }
-}
-
-static int sourceGetchar (gdIOCtx * ctx)
-{
- int res;
- unsigned char buf;
-
- res = sourceGetbuf (ctx, &buf, 1);
-
- if (res == 1) {
- return buf;
- } else {
- return EOF;
- }
-}
-
-static int sinkPutbuf (gdIOCtx * ctx, const void *buf, int size)
-{
- ssIOCtxPtr lctx;
- int res;
-
- lctx = (ssIOCtx *) ctx;
-
- res = (lctx->snk->sink) (lctx->snk->context, buf, size);
-
- if (res <= 0) {
- return 0;
- } else {
- return res;
- }
-}
-
-static void sinkPutchar (gdIOCtx * ctx, int a)
-{
- unsigned char b;
-
- b = a;
- sinkPutbuf (ctx, &b, 1);
-}
diff --git a/ext/gd/libgd/gd_jpeg.c b/ext/gd/libgd/gd_jpeg.c
deleted file mode 100644
index 8fe30108f8..0000000000
--- a/ext/gd/libgd/gd_jpeg.c
+++ /dev/null
@@ -1,690 +0,0 @@
-/*
- * gd_jpeg.c: Read and write JPEG (JFIF) format image files using the
- * gd graphics library (http://www.boutell.com/gd/).
- *
- * This software is based in part on the work of the Independent JPEG
- * Group. For more information on the IJG JPEG software (and JPEG
- * documentation, etc.), see ftp://ftp.uu.net/graphics/jpeg/.
- *
- * NOTE: IJG 12-bit JSAMPLE (BITS_IN_JSAMPLE == 12) mode is not
- * supported at all on read in gd 2.0, and is not supported on write
- * except for palette images, which is sort of pointless (TBB). Even that
- * has never been tested according to DB.
- *
- * Copyright 2000 Doug Becker, mailto:thebeckers@home.com
- *
- * Modification 4/18/00 TBB: JPEG_DEBUG rather than just DEBUG,
- * so VC++ builds don't spew to standard output, causing
- * major CGI brain damage
- *
- * 2.0.10: more efficient gdImageCreateFromJpegCtx, thanks to
- * Christian Aberger
- */
-
-#if PHP_WIN32 && !defined(ssize_t)
-typedef int ssize_t;
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <setjmp.h>
-#include <limits.h>
-#include <string.h>
-
-#include "gd.h"
-/* TBB: move this up so include files are not brought in */
-/* JCE: arrange HAVE_LIBJPEG so that it can be set in gd.h */
-#ifdef HAVE_LIBJPEG
-#include "gdhelpers.h"
-#undef HAVE_STDLIB_H
-
-/* 1.8.1: remove dependency on jinclude.h */
-#include "jpeglib.h"
-#include "jerror.h"
-
-static const char *const GD_JPEG_VERSION = "1.0";
-
-typedef struct _jmpbuf_wrapper
-{
- jmp_buf jmpbuf;
-} jmpbuf_wrapper;
-
-/* Called by the IJG JPEG library upon encountering a fatal error */
-static void fatal_jpeg_error (j_common_ptr cinfo)
-{
- jmpbuf_wrapper *jmpbufw;
-
- php_gd_error("gd-jpeg: JPEG library reports unrecoverable error: ");
- (*cinfo->err->output_message) (cinfo);
-
- jmpbufw = (jmpbuf_wrapper *) cinfo->client_data;
- jpeg_destroy (cinfo);
-
- if (jmpbufw != 0) {
- longjmp (jmpbufw->jmpbuf, 1);
- php_gd_error_ex(E_ERROR, "gd-jpeg: EXTREMELY fatal error: longjmp returned control; terminating");
- } else {
- php_gd_error_ex(E_ERROR, "gd-jpeg: EXTREMELY fatal error: jmpbuf unrecoverable; terminating");
- }
-
- exit (99);
-}
-
-/*
- * Write IM to OUTFILE as a JFIF-formatted JPEG image, using quality
- * QUALITY. If QUALITY is in the range 0-100, increasing values
- * represent higher quality but also larger image size. If QUALITY is
- * negative, the IJG JPEG library's default quality is used (which
- * should be near optimal for many applications). See the IJG JPEG
- * library documentation for more details.
- */
-
-void gdImageJpeg (gdImagePtr im, FILE * outFile, int quality)
-{
- gdIOCtx *out = gdNewFileCtx (outFile);
- gdImageJpegCtx (im, out, quality);
- out->gd_free (out);
-}
-
-void *gdImageJpegPtr (gdImagePtr im, int *size, int quality)
-{
- void *rv;
- gdIOCtx *out = gdNewDynamicCtx (2048, NULL);
- gdImageJpegCtx (im, out, quality);
- rv = gdDPExtractData (out, size);
- out->gd_free (out);
-
- return rv;
-}
-
-void jpeg_gdIOCtx_dest (j_compress_ptr cinfo, gdIOCtx * outfile);
-
-void gdImageJpegCtx (gdImagePtr im, gdIOCtx * outfile, int quality)
-{
- struct jpeg_compress_struct cinfo;
- struct jpeg_error_mgr jerr;
- int i, j, jidx;
- /* volatile so we can gdFree it on return from longjmp */
- volatile JSAMPROW row = 0;
- JSAMPROW rowptr[1];
- jmpbuf_wrapper jmpbufw;
- JDIMENSION nlines;
- char comment[255];
-
- memset (&cinfo, 0, sizeof (cinfo));
- memset (&jerr, 0, sizeof (jerr));
-
- cinfo.err = jpeg_std_error (&jerr);
- cinfo.client_data = &jmpbufw;
- if (setjmp (jmpbufw.jmpbuf) != 0) {
- /* we're here courtesy of longjmp */
- if (row) {
- gdFree (row);
- }
- return;
- }
-
- cinfo.err->error_exit = fatal_jpeg_error;
-
- jpeg_create_compress (&cinfo);
-
- cinfo.image_width = im->sx;
- cinfo.image_height = im->sy;
- cinfo.input_components = 3; /* # of color components per pixel */
- cinfo.in_color_space = JCS_RGB; /* colorspace of input image */
- jpeg_set_defaults (&cinfo);
- if (quality >= 0) {
- jpeg_set_quality (&cinfo, quality, TRUE);
- }
-
- /* If user requests interlace, translate that to progressive JPEG */
- if (gdImageGetInterlaced (im)) {
- jpeg_simple_progression (&cinfo);
- }
-
- jpeg_gdIOCtx_dest (&cinfo, outfile);
-
- row = (JSAMPROW) gdCalloc (1, cinfo.image_width * cinfo.input_components * sizeof (JSAMPLE));
- rowptr[0] = row;
-
- jpeg_start_compress (&cinfo, TRUE);
-
- if (quality >= 0) {
- snprintf(comment, sizeof(comment)-1, "CREATOR: gd-jpeg v%s (using IJG JPEG v%d), quality = %d\n", GD_JPEG_VERSION, JPEG_LIB_VERSION, quality);
- } else {
- snprintf(comment, sizeof(comment)-1, "CREATOR: gd-jpeg v%s (using IJG JPEG v%d), default quality\n", GD_JPEG_VERSION, JPEG_LIB_VERSION);
- }
- jpeg_write_marker (&cinfo, JPEG_COM, (unsigned char *) comment, (unsigned int) strlen (comment));
- if (im->trueColor) {
-
-#if BITS_IN_JSAMPLE == 12
- php_gd_error("gd-jpeg: error: jpeg library was compiled for 12-bit precision. This is mostly useless, because JPEGs on the web are 8-bit and such versions of the jpeg library won't read or write them. GD doesn't support these unusual images. Edit your jmorecfg.h file to specify the correct precision and completely 'make clean' and 'make install' libjpeg again. Sorry");
- goto error;
-#endif /* BITS_IN_JSAMPLE == 12 */
-
- for (i = 0; i < im->sy; i++) {
- for (jidx = 0, j = 0; j < im->sx; j++) {
- int val = im->tpixels[i][j];
-
- row[jidx++] = gdTrueColorGetRed (val);
- row[jidx++] = gdTrueColorGetGreen (val);
- row[jidx++] = gdTrueColorGetBlue (val);
- }
-
- nlines = jpeg_write_scanlines (&cinfo, rowptr, 1);
- if (nlines != 1) {
- php_gd_error_ex(E_WARNING, "gd_jpeg: warning: jpeg_write_scanlines returns %u -- expected 1\n", nlines);
- }
- }
- } else {
- for (i = 0; i < im->sy; i++) {
- for (jidx = 0, j = 0; j < im->sx; j++) {
- int idx = im->pixels[i][j];
-
- /* NB: Although gd RGB values are ints, their max value is
- * 255 (see the documentation for gdImageColorAllocate())
- * -- perfect for 8-bit JPEG encoding (which is the norm)
- */
-#if BITS_IN_JSAMPLE == 8
- row[jidx++] = im->red[idx];
- row[jidx++] = im->green[idx];
- row[jidx++] = im->blue[idx];
-#elif BITS_IN_JSAMPLE == 12
- row[jidx++] = im->red[idx] << 4;
- row[jidx++] = im->green[idx] << 4;
- row[jidx++] = im->blue[idx] << 4;
-#else
-#error IJG JPEG library BITS_IN_JSAMPLE value must be 8 or 12
-#endif
- }
-
- nlines = jpeg_write_scanlines (&cinfo, rowptr, 1);
- if (nlines != 1) {
- php_gd_error_ex(E_WARNING, "gd_jpeg: warning: jpeg_write_scanlines returns %u -- expected 1\n", nlines);
- }
- }
- }
-
- jpeg_finish_compress (&cinfo);
- jpeg_destroy_compress (&cinfo);
- gdFree (row);
-}
-
-gdImagePtr gdImageCreateFromJpeg (FILE * inFile)
-{
- gdImagePtr im;
- gdIOCtx *in = gdNewFileCtx(inFile);
- im = gdImageCreateFromJpegCtx(in);
- in->gd_free (in);
-
- return im;
-}
-
-void jpeg_gdIOCtx_src (j_decompress_ptr cinfo, gdIOCtx * infile);
-
-/*
- * Create a gd-format image from the JPEG-format INFILE. Returns the
- * image, or NULL upon error.
- */
-gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
-{
- struct jpeg_decompress_struct cinfo;
- struct jpeg_error_mgr jerr;
- jmpbuf_wrapper jmpbufw;
- /* volatile so we can gdFree them after longjmp */
- volatile JSAMPROW row = 0;
- volatile gdImagePtr im = 0;
- JSAMPROW rowptr[1];
- unsigned int i, j;
- int retval;
- JDIMENSION nrows;
-
- memset (&cinfo, 0, sizeof (cinfo));
- memset (&jerr, 0, sizeof (jerr));
-
- cinfo.err = jpeg_std_error (&jerr);
- cinfo.client_data = &jmpbufw;
- if (setjmp (jmpbufw.jmpbuf) != 0) {
- /* we're here courtesy of longjmp */
- if (row) {
- gdFree (row);
- }
- if (im) {
- gdImageDestroy (im);
- }
- return 0;
- }
-
- cinfo.err->error_exit = fatal_jpeg_error;
-
- jpeg_create_decompress (&cinfo);
-
- jpeg_gdIOCtx_src (&cinfo, infile);
-
- retval = jpeg_read_header (&cinfo, TRUE);
- if (retval != JPEG_HEADER_OK) {
- php_gd_error_ex(E_WARNING, "gd-jpeg: warning: jpeg_read_header returned %d, expected %d", retval, JPEG_HEADER_OK);
- }
-
- if (cinfo.image_height > INT_MAX) {
- php_gd_error_ex(E_WARNING, "gd-jpeg: warning: JPEG image height (%u) is greater than INT_MAX (%d) (and thus greater than gd can handle)", cinfo.image_height, INT_MAX);
- }
-
- if (cinfo.image_width > INT_MAX) {
- php_gd_error_ex(E_WARNING, "gd-jpeg: warning: JPEG image width (%u) is greater than INT_MAX (%d) (and thus greater than gd can handle)", cinfo.image_width, INT_MAX);
- }
-
- im = gdImageCreateTrueColor ((int) cinfo.image_width, (int) cinfo.image_height);
- if (im == 0) {
- php_gd_error("gd-jpeg error: cannot allocate gdImage struct");
- goto error;
- }
-
- /* Force the image into RGB colorspace, but don't reduce the number of colors anymore (GD 2.0) */
- cinfo.out_color_space = JCS_RGB;
-
- if (jpeg_start_decompress (&cinfo) != TRUE) {
- php_gd_error("gd-jpeg: warning: jpeg_start_decompress reports suspended data source");
- }
-
- /* REMOVED by TBB 2/12/01. This field of the structure is
- * documented as private, and sure enough it's gone in the
- * latest libjpeg, replaced by something else. Unfortunately
- * there is still no right way to find out if the file was
- * progressive or not; just declare your intent before you
- * write one by calling gdImageInterlace(im, 1) yourself.
- * After all, we're not really supposed to rework JPEGs and
- * write them out again anyway. Lossy compression, remember?
- */
-#if 0
- gdImageInterlace (im, cinfo.progressive_mode != 0);
-#endif
-
- if (cinfo.output_components != 3) {
- php_gd_error_ex(E_WARNING, "gd-jpeg: error: JPEG color quantization request resulted in output_components == %d (expected 3)", cinfo.output_components);
- goto error;
- }
-
-#if BITS_IN_JSAMPLE == 12
- php_gd_error("gd-jpeg: error: jpeg library was compiled for 12-bit precision. This is mostly useless, because JPEGs on the web are 8-bit and such versions of the jpeg library won't read or write them. GD doesn't support these unusual images. Edit your jmorecfg.h file to specify the correct precision and completely 'make clean' and 'make install' libjpeg again. Sorry.");
- goto error;
-#endif /* BITS_IN_JSAMPLE == 12 */
-
- row = gdCalloc (cinfo.output_width * 3, sizeof (JSAMPLE));
- rowptr[0] = row;
-
- for (i = 0; i < cinfo.output_height; i++) {
- register JSAMPROW currow = row;
- register int *tpix = im->tpixels[i];
- nrows = jpeg_read_scanlines (&cinfo, rowptr, 1);
- if (nrows != 1) {
- php_gd_error_ex(E_WARNING, "gd-jpeg: error: jpeg_read_scanlines returns %u, expected 1", nrows);
- goto error;
- }
- for (j = 0; j < cinfo.output_width; j++, currow += 3, tpix++) {
- *tpix = gdTrueColor (currow[0], currow[1], currow[2]);
- }
- }
-
- if (jpeg_finish_decompress (&cinfo) != TRUE) {
- php_gd_error("gd-jpeg: warning: jpeg_finish_decompress reports suspended data source");
- }
-
- jpeg_destroy_decompress (&cinfo);
- gdFree (row);
-
- return im;
-
-error:
- jpeg_destroy_decompress (&cinfo);
- if (row) {
- gdFree (row);
- }
- if (im) {
- gdImageDestroy (im);
- }
- return 0;
-}
-
-/*
-
- * gdIOCtx JPEG data sources and sinks, T. Boutell
- * almost a simple global replace from T. Lane's stdio versions.
- *
- */
-
-/* Different versions of libjpeg use either 'jboolean' or 'boolean', and
- some platforms define 'boolean', and so forth. Deal with this
- madness by typedeffing 'safeboolean' to 'boolean' if HAVE_BOOLEAN
- is already set, because this is the test that libjpeg uses.
- Otherwise, typedef it to int, because that's what libjpeg does
- if HAVE_BOOLEAN is not defined. -TBB */
-
-#ifdef HAVE_BOOLEAN
-typedef boolean safeboolean;
-#else
-typedef int safeboolean;
-#endif /* HAVE_BOOLEAN */
-
-/* Expanded data source object for gdIOCtx input */
-
-typedef struct
-{
- struct jpeg_source_mgr pub; /* public fields */
-
- gdIOCtx *infile; /* source stream */
- unsigned char *buffer; /* start of buffer */
- safeboolean start_of_file; /* have we gotten any data yet? */
-} my_source_mgr;
-
-typedef my_source_mgr *my_src_ptr;
-
-#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */
-
-/*
- * Initialize source --- called by jpeg_read_header
- * before any data is actually read.
- */
-
-void init_source (j_decompress_ptr cinfo)
-{
- my_src_ptr src = (my_src_ptr) cinfo->src;
-
- /* We reset the empty-input-file flag for each image,
- * but we don't clear the input buffer.
- * This is correct behavior for reading a series of images from one source.
- */
- src->start_of_file = TRUE;
-}
-
-
-/*
- * Fill the input buffer --- called whenever buffer is emptied.
- *
- * In typical applications, this should read fresh data into the buffer
- * (ignoring the current state of next_input_byte & bytes_in_buffer),
- * reset the pointer & count to the start of the buffer, and return TRUE
- * indicating that the buffer has been reloaded. It is not necessary to
- * fill the buffer entirely, only to obtain at least one more byte.
- *
- * There is no such thing as an EOF return. If the end of the file has been
- * reached, the routine has a choice of ERREXIT() or inserting fake data into
- * the buffer. In most cases, generating a warning message and inserting a
- * fake EOI marker is the best course of action --- this will allow the
- * decompressor to output however much of the image is there. However,
- * the resulting error message is misleading if the real problem is an empty
- * input file, so we handle that case specially.
- *
- * In applications that need to be able to suspend compression due to input
- * not being available yet, a FALSE return indicates that no more data can be
- * obtained right now, but more may be forthcoming later. In this situation,
- * the decompressor will return to its caller (with an indication of the
- * number of scanlines it has read, if any). The application should resume
- * decompression after it has loaded more data into the input buffer. Note
- * that there are substantial restrictions on the use of suspension --- see
- * the documentation.
- *
- * When suspending, the decompressor will back up to a convenient restart point
- * (typically the start of the current MCU). next_input_byte & bytes_in_buffer
- * indicate where the restart point will be if the current call returns FALSE.
- * Data beyond this point must be rescanned after resumption, so move it to
- * the front of the buffer rather than discarding it.
- */
-
-#define END_JPEG_SEQUENCE "\r\n[*]--:END JPEG:--[*]\r\n"
-
-safeboolean fill_input_buffer (j_decompress_ptr cinfo)
-{
- my_src_ptr src = (my_src_ptr) cinfo->src;
- /* 2.0.12: signed size. Thanks to Geert Jansen */
- ssize_t nbytes = 0;
-
- /* ssize_t got; */
- /* char *s; */
- memset(src->buffer, 0, INPUT_BUF_SIZE);
-
- while (nbytes < INPUT_BUF_SIZE) {
- int got = gdGetBuf(src->buffer + nbytes, INPUT_BUF_SIZE - nbytes, src->infile);
-
- if (got == EOF || got == 0) {
- /* EOF or error. If we got any data, don't worry about it. If we didn't, then this is unexpected. */
- if (!nbytes) {
- nbytes = -1;
- }
- break;
- }
- nbytes += got;
- }
-
- if (nbytes <= 0) {
- if (src->start_of_file) { /* Treat empty input file as fatal error */
- ERREXIT (cinfo, JERR_INPUT_EMPTY);
- }
- WARNMS (cinfo, JWRN_JPEG_EOF);
- /* Insert a fake EOI marker */
- src->buffer[0] = (unsigned char) 0xFF;
- src->buffer[1] = (unsigned char) JPEG_EOI;
- nbytes = 2;
- }
-
- src->pub.next_input_byte = src->buffer;
- src->pub.bytes_in_buffer = nbytes;
- src->start_of_file = FALSE;
-
- return TRUE;
-}
-
-
-/*
- * Skip data --- used to skip over a potentially large amount of
- * uninteresting data (such as an APPn marker).
- *
- * Writers of suspendable-input applications must note that skip_input_data
- * is not granted the right to give a suspension return. If the skip extends
- * beyond the data currently in the buffer, the buffer can be marked empty so
- * that the next read will cause a fill_input_buffer call that can suspend.
- * Arranging for additional bytes to be discarded before reloading the input
- * buffer is the application writer's problem.
- */
-
-void skip_input_data (j_decompress_ptr cinfo, long num_bytes)
-{
- my_src_ptr src = (my_src_ptr) cinfo->src;
-
- /* Just a dumb implementation for now. Not clear that being smart is worth
- * any trouble anyway --- large skips are infrequent.
- */
- if (num_bytes > 0) {
- while (num_bytes > (long) src->pub.bytes_in_buffer) {
- num_bytes -= (long) src->pub.bytes_in_buffer;
- (void) fill_input_buffer (cinfo);
- /* note we assume that fill_input_buffer will never return FALSE,
- * so suspension need not be handled.
- */
- }
- src->pub.next_input_byte += (size_t) num_bytes;
- src->pub.bytes_in_buffer -= (size_t) num_bytes;
- }
-}
-
-
-/*
- * An additional method that can be provided by data source modules is the
- * resync_to_restart method for error recovery in the presence of RST markers.
- * For the moment, this source module just uses the default resync method
- * provided by the JPEG library. That method assumes that no backtracking
- * is possible.
- */
-
-
-/*
- * Terminate source --- called by jpeg_finish_decompress
- * after all data has been read. Often a no-op.
- *
- * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
- * application must deal with any cleanup that should happen even
- * for error exit.
- */
-
-void term_source (j_decompress_ptr cinfo)
-{
-#if 0
- * never used */
- my_src_ptr src = (my_src_ptr) cinfo->src;
-#endif
-}
-
-
-/*
- * Prepare for input from a gdIOCtx stream.
- * The caller must have already opened the stream, and is responsible
- * for closing it after finishing decompression.
- */
-
-void jpeg_gdIOCtx_src (j_decompress_ptr cinfo, gdIOCtx * infile)
-{
- my_src_ptr src;
-
- /* The source object and input buffer are made permanent so that a series
- * of JPEG images can be read from the same file by calling jpeg_gdIOCtx_src
- * only before the first one. (If we discarded the buffer at the end of
- * one image, we'd likely lose the start of the next one.)
- * This makes it unsafe to use this manager and a different source
- * manager serially with the same JPEG object. Caveat programmer.
- */
- if (cinfo->src == NULL) { /* first time for this JPEG object? */
- cinfo->src = (struct jpeg_source_mgr *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof (my_source_mgr));
- src = (my_src_ptr) cinfo->src;
- src->buffer = (unsigned char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, INPUT_BUF_SIZE * sizeof (unsigned char));
-
- }
-
- src = (my_src_ptr) cinfo->src;
- src->pub.init_source = init_source;
- src->pub.fill_input_buffer = fill_input_buffer;
- src->pub.skip_input_data = skip_input_data;
- src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
- src->pub.term_source = term_source;
- src->infile = infile;
- src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
- src->pub.next_input_byte = NULL; /* until buffer loaded */
-}
-
-/* Expanded data destination object for stdio output */
-
-typedef struct
-{
- struct jpeg_destination_mgr pub; /* public fields */
- gdIOCtx *outfile; /* target stream */
- unsigned char *buffer; /* start of buffer */
-} my_destination_mgr;
-
-typedef my_destination_mgr *my_dest_ptr;
-
-#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */
-
-/*
- * Initialize destination --- called by jpeg_start_compress
- * before any data is actually written.
- */
-
-void init_destination (j_compress_ptr cinfo)
-{
- my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
-
- /* Allocate the output buffer --- it will be released when done with image */
- dest->buffer = (unsigned char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, OUTPUT_BUF_SIZE * sizeof (unsigned char));
-
- dest->pub.next_output_byte = dest->buffer;
- dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
-}
-
-
-/*
- * Empty the output buffer --- called whenever buffer fills up.
- *
- * In typical applications, this should write the entire output buffer
- * (ignoring the current state of next_output_byte & free_in_buffer),
- * reset the pointer & count to the start of the buffer, and return TRUE
- * indicating that the buffer has been dumped.
- *
- * In applications that need to be able to suspend compression due to output
- * overrun, a FALSE return indicates that the buffer cannot be emptied now.
- * In this situation, the compressor will return to its caller (possibly with
- * an indication that it has not accepted all the supplied scanlines). The
- * application should resume compression after it has made more room in the
- * output buffer. Note that there are substantial restrictions on the use of
- * suspension --- see the documentation.
- *
- * When suspending, the compressor will back up to a convenient restart point
- * (typically the start of the current MCU). next_output_byte & free_in_buffer
- * indicate where the restart point will be if the current call returns FALSE.
- * Data beyond this point will be regenerated after resumption, so do not
- * write it out when emptying the buffer externally.
- */
-
-safeboolean empty_output_buffer (j_compress_ptr cinfo)
-{
- my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
-
- if (gdPutBuf (dest->buffer, OUTPUT_BUF_SIZE, dest->outfile) != (size_t) OUTPUT_BUF_SIZE) {
- ERREXIT (cinfo, JERR_FILE_WRITE);
- }
-
- dest->pub.next_output_byte = dest->buffer;
- dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
-
- return TRUE;
-}
-
-
-/*
- * Terminate destination --- called by jpeg_finish_compress
- * after all data has been written. Usually needs to flush buffer.
- *
- * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
- * application must deal with any cleanup that should happen even
- * for error exit.
- */
-
-void term_destination (j_compress_ptr cinfo)
-{
- my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
- size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer;
-
- /* Write any data remaining in the buffer */
- if (datacount > 0 && ((size_t)gdPutBuf (dest->buffer, datacount, dest->outfile) != datacount)) {
- ERREXIT (cinfo, JERR_FILE_WRITE);
- }
-}
-
-
-/*
- * Prepare for output to a stdio stream.
- * The caller must have already opened the stream, and is responsible
- * for closing it after finishing compression.
- */
-
-void jpeg_gdIOCtx_dest (j_compress_ptr cinfo, gdIOCtx * outfile)
-{
- my_dest_ptr dest;
-
- /* The destination object is made permanent so that multiple JPEG images
- * can be written to the same file without re-executing jpeg_stdio_dest.
- * This makes it dangerous to use this manager and a different destination
- * manager serially with the same JPEG object, because their private object
- * sizes may be different. Caveat programmer.
- */
- if (cinfo->dest == NULL) { /* first time for this JPEG object? */
- cinfo->dest = (struct jpeg_destination_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof (my_destination_mgr));
- }
-
- dest = (my_dest_ptr) cinfo->dest;
- dest->pub.init_destination = init_destination;
- dest->pub.empty_output_buffer = empty_output_buffer;
- dest->pub.term_destination = term_destination;
- dest->outfile = outfile;
-}
-
-#endif /* HAVE_JPEG */
diff --git a/ext/gd/libgd/gd_png.c b/ext/gd/libgd/gd_png.c
deleted file mode 100644
index c1b147e0f0..0000000000
--- a/ext/gd/libgd/gd_png.c
+++ /dev/null
@@ -1,687 +0,0 @@
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include "gd.h"
-
-/* JCE: Arrange HAVE_LIBPNG so that it can be set in gd.h */
-#ifdef HAVE_LIBPNG
-
-#include "png.h" /* includes zlib.h and setjmp.h */
-#include "gdhelpers.h"
-
-#define TRUE 1
-#define FALSE 0
-
-/*---------------------------------------------------------------------------
-
- gd_png.c Copyright 1999 Greg Roelofs and Thomas Boutell
-
- The routines in this file, gdImagePng*() and gdImageCreateFromPng*(),
- are drop-in replacements for gdImageGif*() and gdImageCreateFromGif*(),
- except that these functions are noisier in the case of errors (comment
- out all fprintf() statements to disable that).
-
- GD 2.0 supports RGBA truecolor and will read and write truecolor PNGs.
- GD 2.0 supports 8 bits of color resolution per channel and
- 7 bits of alpha channel resolution. Images with more than 8 bits
- per channel are reduced to 8 bits. Images with an alpha channel are
- only able to resolve down to '1/128th opaque' instead of '1/256th',
- and this conversion is also automatic. I very much doubt you can see it.
- Both tRNS and true alpha are supported.
-
- Gamma is ignored, and there is no support for text annotations.
-
- Last updated: 9 February 2001
-
- ---------------------------------------------------------------------------*/
-
-#ifndef PNG_SETJMP_NOT_SUPPORTED
-typedef struct _jmpbuf_wrapper
-{
- jmp_buf jmpbuf;
-} jmpbuf_wrapper;
-
-static jmpbuf_wrapper gdPngJmpbufStruct;
-
-static void gdPngErrorHandler (png_structp png_ptr, png_const_charp msg)
-{
- jmpbuf_wrapper *jmpbuf_ptr;
-
- /* This function, aside from the extra step of retrieving the "error
- * pointer" (below) and the fact that it exists within the application
- * rather than within libpng, is essentially identical to libpng's
- * default error handler. The second point is critical: since both
- * setjmp() and longjmp() are called from the same code, they are
- * guaranteed to have compatible notions of how big a jmp_buf is,
- * regardless of whether _BSD_SOURCE or anything else has (or has not)
- * been defined.
- */
-
- php_gd_error_ex(E_ERROR, "gd-png: fatal libpng error: %s\n", msg);
-
- jmpbuf_ptr = png_get_error_ptr (png_ptr);
- if (jmpbuf_ptr == NULL) { /* we are completely hosed now */
- php_gd_error_ex(E_ERROR, "gd-png: EXTREMELY fatal error: jmpbuf unrecoverable; terminating.\n");
- }
-
- longjmp (jmpbuf_ptr->jmpbuf, 1);
-}
-#endif
-
-static void gdPngReadData (png_structp png_ptr, png_bytep data, png_size_t length)
-{
- gdGetBuf(data, length, (gdIOCtx *) png_get_io_ptr(png_ptr));
-}
-
-static void gdPngWriteData (png_structp png_ptr, png_bytep data, png_size_t length)
-{
- gdPutBuf (data, length, (gdIOCtx *) png_get_io_ptr(png_ptr));
-}
-
-static void gdPngFlushData (png_structp png_ptr)
-{
-}
-
-gdImagePtr gdImageCreateFromPng (FILE * inFile)
-{
- gdImagePtr im;
- gdIOCtx *in = gdNewFileCtx(inFile);
- im = gdImageCreateFromPngCtx(in);
- in->gd_free(in);
-
- return im;
-}
-
-
-/* This routine is based in part on the Chapter 13 demo code in "PNG: The
- * Definitive Guide" (http://www.cdrom.com/pub/png/pngbook.html).
- */
-gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile)
-{
- png_byte sig[8];
- png_structp png_ptr;
- png_infop info_ptr;
- png_uint_32 width, height, rowbytes, w, h;
- int bit_depth, color_type, interlace_type;
- int num_palette, num_trans;
- png_colorp palette;
- png_color_16p trans_gray_rgb;
- png_color_16p trans_color_rgb;
- png_bytep trans;
- png_bytep image_data = NULL;
- png_bytepp row_pointers = NULL;
- gdImagePtr im = NULL;
- int i, j, *open = NULL;
- volatile int transparent = -1;
- volatile int palette_allocated = FALSE;
-
- /* Make sure the signature can't match by dumb luck -- TBB */
- /* GRR: isn't sizeof(infile) equal to the size of the pointer? */
- memset (infile, 0, sizeof(infile));
-
- /* first do a quick check that the file really is a PNG image; could
- * have used slightly more general png_sig_cmp() function instead
- */
- gdGetBuf(sig, 8, infile);
- if (!png_check_sig (sig, 8)) { /* bad signature */
- return NULL;
- }
-
-#ifndef PNG_SETJMP_NOT_SUPPORTED
- png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, &gdPngJmpbufStruct, gdPngErrorHandler, NULL);
-#else
- png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
-#endif
- if (png_ptr == NULL) {
- php_gd_error("gd-png error: cannot allocate libpng main struct\n");
- return NULL;
- }
-
- info_ptr = png_create_info_struct(png_ptr);
- if (info_ptr == NULL) {
- php_gd_error("gd-png error: cannot allocate libpng info struct\n");
- png_destroy_read_struct (&png_ptr, NULL, NULL);
-
- return NULL;
- }
-
- /* we could create a second info struct here (end_info), but it's only
- * useful if we want to keep pre- and post-IDAT chunk info separated
- * (mainly for PNG-aware image editors and converters)
- */
-
- /* setjmp() must be called in every non-callback function that calls a
- * PNG-reading libpng function
- */
-#ifndef PNG_SETJMP_NOT_SUPPORTED
- if (setjmp(gdPngJmpbufStruct.jmpbuf)) {
- php_gd_error("gd-png error: setjmp returns error condition\n");
- png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-
- return NULL;
- }
-#endif
-
- png_set_sig_bytes(png_ptr, 8); /* we already read the 8 signature bytes */
-
- png_set_read_fn(png_ptr, (void *) infile, gdPngReadData);
- png_read_info(png_ptr, info_ptr); /* read all PNG info up to image data */
-
- png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL);
- if ((color_type == PNG_COLOR_TYPE_RGB) || (color_type == PNG_COLOR_TYPE_RGB_ALPHA)) {
- im = gdImageCreateTrueColor((int) width, (int) height);
- } else {
- im = gdImageCreate((int) width, (int) height);
- }
- if (im == NULL) {
- php_gd_error("gd-png error: cannot allocate gdImage struct\n");
- png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
- gdFree(image_data);
- gdFree(row_pointers);
-
- return NULL;
- }
-
- if (bit_depth == 16) {
- png_set_strip_16(png_ptr);
- } else if (bit_depth < 8) {
- png_set_packing (png_ptr); /* expand to 1 byte per pixel */
- }
-
- switch (color_type) {
- case PNG_COLOR_TYPE_PALETTE:
- png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette);
-#ifdef DEBUG
- php_gd_error("gd-png color_type is palette, colors: %d\n", num_palette);
-#endif /* DEBUG */
- if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) {
- /* gd 2.0: we support this rather thoroughly now. Grab the
- * first fully transparent entry, if any, as the value of
- * the simple-transparency index, mostly for backwards
- * binary compatibility. The alpha channel is where it's
- * really at these days.
- */
- int firstZero = 1;
- png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL);
- for (i = 0; i < num_trans; ++i) {
- im->alpha[i] = gdAlphaMax - (trans[i] >> 1);
- if ((trans[i] == 0) && (firstZero)) {
- transparent = i;
- firstZero = 0;
- }
- }
- }
- break;
- case PNG_COLOR_TYPE_GRAY:
- case PNG_COLOR_TYPE_GRAY_ALPHA:
- /* create a fake palette and check for single-shade transparency */
- if ((palette = (png_colorp) gdMalloc (256 * sizeof (png_color))) == NULL) {
- php_gd_error("gd-png error: cannot allocate gray palette\n");
- png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-
- return NULL;
- }
- palette_allocated = TRUE;
- if (bit_depth < 8) {
- num_palette = 1 << bit_depth;
- for (i = 0; i < 256; ++i) {
- j = (255 * i) / (num_palette - 1);
- palette[i].red = palette[i].green = palette[i].blue = j;
- }
- } else {
- num_palette = 256;
- for (i = 0; i < 256; ++i) {
- palette[i].red = palette[i].green = palette[i].blue = i;
- }
- }
- if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
- png_get_tRNS(png_ptr, info_ptr, NULL, NULL, &trans_gray_rgb);
- if (bit_depth == 16) { /* png_set_strip_16() not yet in effect */
- transparent = trans_gray_rgb->gray >> 8;
- } else {
- transparent = trans_gray_rgb->gray;
- }
- /* Note slight error in 16-bit case: up to 256 16-bit shades
- * may get mapped to a single 8-bit shade, and only one of them
- * is supposed to be transparent. IOW, both opaque pixels and
- * transparent pixels will be mapped into the transparent entry.
- * There is no particularly good way around this in the case
- * that all 256 8-bit shades are used, but one could write some
- * custom 16-bit code to handle the case where there are gdFree
- * palette entries. This error will be extremely rare in
- * general, though. (Quite possibly there is only one such
- * image in existence.)
- */
- }
- break;
-
- case PNG_COLOR_TYPE_RGB:
- case PNG_COLOR_TYPE_RGB_ALPHA:
- /* gd 2.0: we now support truecolor. See the comment above
- * for a rare situation in which the transparent pixel may not
- * work properly with 16-bit channels.
- */
- if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
- png_get_tRNS(png_ptr, info_ptr, NULL, NULL, &trans_color_rgb);
- if (bit_depth == 16) { /* png_set_strip_16() not yet in effect */
- transparent = gdTrueColor(trans_color_rgb->red >> 8,
- trans_color_rgb->green >> 8,
- trans_color_rgb->blue >> 8);
- } else {
- transparent = gdTrueColor(trans_color_rgb->red,
- trans_color_rgb->green,
- trans_color_rgb->blue);
- }
- }
- break;
- }
-
- png_read_update_info(png_ptr, info_ptr);
-
- /* allocate space for the PNG image data */
- rowbytes = png_get_rowbytes(png_ptr, info_ptr);
- image_data = (png_bytep) gdMalloc (rowbytes * height);
-
- row_pointers = (png_bytepp) gdMalloc (height * sizeof (png_bytep));
-
- /* set the individual row_pointers to point at the correct offsets */
- for (h = 0; h < height; ++h) {
- row_pointers[h] = image_data + h * rowbytes;
- }
-
- png_read_image(png_ptr, row_pointers); /* read whole image... */
- png_read_end(png_ptr, NULL); /* ...done! */
-
- if (!im->trueColor) {
- im->colorsTotal = num_palette;
- /* load the palette and mark all entries "open" (unused) for now */
- open = im->open;
- for (i = 0; i < num_palette; ++i) {
- im->red[i] = palette[i].red;
- im->green[i] = palette[i].green;
- im->blue[i] = palette[i].blue;
- open[i] = 1;
- }
- for (i = num_palette; i < gdMaxColors; ++i) {
- open[i] = 1;
- }
- }
- /* 2.0.12: Slaven Rezic: palette images are not the only images
- * with a simple transparent color setting.
- */
- im->transparent = transparent;
- im->interlace = (interlace_type == PNG_INTERLACE_ADAM7);
-
- /* can't nuke structs until done with palette */
- png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
- switch (color_type) {
- case PNG_COLOR_TYPE_RGB:
- for (h = 0; h < height; h++) {
- int boffset = 0;
- for (w = 0; w < width; w++) {
- register png_byte r = row_pointers[h][boffset++];
- register png_byte g = row_pointers[h][boffset++];
- register png_byte b = row_pointers[h][boffset++];
- im->tpixels[h][w] = gdTrueColor (r, g, b);
- }
- }
- break;
-
- case PNG_COLOR_TYPE_RGB_ALPHA:
- for (h = 0; h < height; h++) {
- int boffset = 0;
- for (w = 0; w < width; w++) {
- register png_byte r = row_pointers[h][boffset++];
- register png_byte g = row_pointers[h][boffset++];
- register png_byte b = row_pointers[h][boffset++];
-
- /* gd has only 7 bits of alpha channel resolution, and
- * 127 is transparent, 0 opaque. A moment of convenience,
- * a lifetime of compatibility.
- */
-
- register png_byte a = gdAlphaMax - (row_pointers[h][boffset++] >> 1);
- im->tpixels[h][w] = gdTrueColorAlpha(r, g, b, a);
- }
- }
- break;
-
- default:
- /* Palette image, or something coerced to be one */
- for (h = 0; h < height; ++h) {
- for (w = 0; w < width; ++w) {
- register png_byte idx = row_pointers[h][w];
- im->pixels[h][w] = idx;
- open[idx] = 0;
- }
- }
- }
-#ifdef DEBUG
- if (!im->trueColor) {
- for (i = num_palette; i < gdMaxColors; ++i) {
- if (!open[i]) {
- php_gd_error("gd-png warning: image data references out-of-range color index (%d)\n", i);
- }
- }
- }
-#endif
-
- if (palette_allocated) {
- gdFree(palette);
- }
- gdFree(image_data);
- gdFree(row_pointers);
-
- return im;
-}
-
-void gdImagePngEx (gdImagePtr im, FILE * outFile, int level)
-{
- gdIOCtx *out = gdNewFileCtx(outFile);
- gdImagePngCtxEx(im, out, level);
- out->gd_free(out);
-}
-
-void gdImagePng (gdImagePtr im, FILE * outFile)
-{
- gdIOCtx *out = gdNewFileCtx(outFile);
- gdImagePngCtxEx(im, out, -1);
- out->gd_free(out);
-}
-
-void * gdImagePngPtr (gdImagePtr im, int *size)
-{
- void *rv;
- gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
- gdImagePngCtxEx(im, out, -1);
- rv = gdDPExtractData(out, size);
- out->gd_free(out);
-
- return rv;
-}
-
-void * gdImagePngPtrEx (gdImagePtr im, int *size, int level)
-{
- void *rv;
- gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
- gdImagePngCtxEx(im, out, level);
- rv = gdDPExtractData(out, size);
- out->gd_free(out);
- return rv;
-}
-
-void gdImagePngCtx (gdImagePtr im, gdIOCtx * outfile)
-{
- gdImagePngCtxEx(im, outfile, -1);
-}
-
-/* This routine is based in part on code from Dale Lutz (Safe Software Inc.)
- * and in part on demo code from Chapter 15 of "PNG: The Definitive Guide"
- * (http://www.cdrom.com/pub/png/pngbook.html).
- */
-void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level)
-{
- int i, j, bit_depth = 0, interlace_type;
- int width = im->sx;
- int height = im->sy;
- int colors = im->colorsTotal;
- int *open = im->open;
- int mapping[gdMaxColors]; /* mapping[gd_index] == png_index */
- png_byte trans_values[256];
- png_color_16 trans_rgb_value;
- png_color palette[gdMaxColors];
- png_structp png_ptr;
- png_infop info_ptr;
- volatile int transparent = im->transparent;
- volatile int remap = FALSE;
-
-#ifndef PNG_SETJMP_NOT_SUPPORTED
- png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, &gdPngJmpbufStruct, gdPngErrorHandler, NULL);
-#else
- png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
-#endif
- if (png_ptr == NULL) {
- php_gd_error("gd-png error: cannot allocate libpng main struct\n");
- return;
- }
-
- info_ptr = png_create_info_struct(png_ptr);
- if (info_ptr == NULL) {
- php_gd_error("gd-png error: cannot allocate libpng info struct\n");
- png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
-
- return;
- }
-
-#ifndef PNG_SETJMP_NOT_SUPPORTED
- if (setjmp (gdPngJmpbufStruct.jmpbuf)) {
- php_gd_error("gd-png error: setjmp returns error condition\n");
- png_destroy_write_struct (&png_ptr, &info_ptr);
-
- return;
- }
-#endif
-
- png_set_write_fn(png_ptr, (void *) outfile, gdPngWriteData, gdPngFlushData);
-
- /* This is best for palette images, and libpng defaults to it for
- * palette images anyway, so we don't need to do it explicitly.
- * What to ideally do for truecolor images depends, alas, on the image.
- * gd is intentionally imperfect and doesn't spend a lot of time
- * fussing with such things.
- */
-
- /* png_set_filter(png_ptr, 0, PNG_FILTER_NONE); */
-
- /* 2.0.12: this is finally a parameter */
- png_set_compression_level(png_ptr, level);
-
- /* can set this to a smaller value without compromising compression if all
- * image data is 16K or less; will save some decoder memory [min == 8]
- */
-
- /* png_set_compression_window_bits(png_ptr, 15); */
-
- if (!im->trueColor) {
- if (transparent >= im->colorsTotal || (transparent >= 0 && open[transparent])) {
- transparent = -1;
- }
-
- for (i = 0; i < gdMaxColors; ++i) {
- mapping[i] = -1;
- }
-
- /* count actual number of colors used (colorsTotal == high-water mark) */
- colors = 0;
- for (i = 0; i < im->colorsTotal; ++i) {
- if (!open[i]) {
- mapping[i] = colors;
- ++colors;
- }
- }
- if (colors < im->colorsTotal) {
- remap = TRUE;
- }
- if (colors <= 2) {
- bit_depth = 1;
- } else if (colors <= 4) {
- bit_depth = 2;
- } else if (colors <= 16) {
- bit_depth = 4;
- } else {
- bit_depth = 8;
- }
- }
-
- interlace_type = im->interlace ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE;
-
- if (im->trueColor) {
- if (im->saveAlphaFlag) {
- png_set_IHDR(png_ptr, info_ptr, width, height, 8, PNG_COLOR_TYPE_RGB_ALPHA, interlace_type,
- PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
- } else {
- png_set_IHDR(png_ptr, info_ptr, width, height, 8, PNG_COLOR_TYPE_RGB, interlace_type,
- PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
- }
- } else {
- png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_PALETTE, interlace_type,
- PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
- }
-
- if (im->trueColor && !im->saveAlphaFlag && (transparent >= 0)) {
- /* 2.0.9: fixed by Thomas Winzig */
- trans_rgb_value.red = gdTrueColorGetRed (im->transparent);
- trans_rgb_value.green = gdTrueColorGetGreen (im->transparent);
- trans_rgb_value.blue = gdTrueColorGetBlue (im->transparent);
- png_set_tRNS(png_ptr, info_ptr, 0, 0, &trans_rgb_value);
- }
-
- if (!im->trueColor) {
- /* Oy veh. Remap the PNG palette to put the entries with interesting alpha channel
- * values first. This minimizes the size of the tRNS chunk and thus the size
- * of the PNG file as a whole.
- */
-
- int tc = 0;
- int i;
- int j;
- int k;
-
- for (i = 0; (i < im->colorsTotal); i++) {
- if ((!im->open[i]) && (im->alpha[i] != gdAlphaOpaque)) {
- tc++;
- }
- }
- if (tc) {
-#if 0
- for (i = 0; (i < im->colorsTotal); i++) {
- trans_values[i] = 255 - ((im->alpha[i] << 1) + (im->alpha[i] >> 6));
- }
- png_set_tRNS (png_ptr, info_ptr, trans_values, 256, NULL);
-#endif
- if (!remap) {
- remap = TRUE;
- }
-
- /* (Semi-)transparent indexes come up from the bottom of the list of real colors; opaque
- * indexes come down from the top
- */
- j = 0;
- k = colors - 1;
-
- for (i = 0; i < im->colorsTotal; i++) {
- if (!im->open[i]) {
- if (im->alpha[i] != gdAlphaOpaque) {
- /* Andrew Hull: >> 6, not >> 7! (gd 2.0.5) */
- trans_values[j] = 255 - ((im->alpha[i] << 1) + (im->alpha[i] >> 6));
- mapping[i] = j++;
- } else {
- mapping[i] = k--;
- }
- }
- }
- png_set_tRNS(png_ptr, info_ptr, trans_values, tc, NULL);
- }
- }
-
- /* convert palette to libpng layout */
- if (!im->trueColor) {
- if (remap) {
- for (i = 0; i < im->colorsTotal; ++i) {
- if (mapping[i] < 0) {
- continue;
- }
-
- palette[mapping[i]].red = im->red[i];
- palette[mapping[i]].green = im->green[i];
- palette[mapping[i]].blue = im->blue[i];
- }
- } else {
- for (i = 0; i < colors; ++i) {
- palette[i].red = im->red[i];
- palette[i].green = im->green[i];
- palette[i].blue = im->blue[i];
- }
- }
- png_set_PLTE(png_ptr, info_ptr, palette, colors);
- }
-
- /* write out the PNG header info (everything up to first IDAT) */
- png_write_info(png_ptr, info_ptr);
-
- /* make sure < 8-bit images are packed into pixels as tightly as possible */
- png_set_packing(png_ptr);
-
- /* This code allocates a set of row buffers and copies the gd image data
- * into them only in the case that remapping is necessary; in gd 1.3 and
- * later, the im->pixels array is laid out identically to libpng's row
- * pointers and can be passed to png_write_image() function directly.
- * The remapping case could be accomplished with less memory for non-
- * interlaced images, but interlacing causes some serious complications.
- */
-
- if (im->trueColor) {
- int channels = im->saveAlphaFlag ? 4 : 3;
- /* Our little 7-bit alpha channel trick costs us a bit here. */
- png_bytep *row_pointers;
- row_pointers = gdMalloc(sizeof (png_bytep) * height);
- for (j = 0; j < height; ++j) {
- int bo = 0;
- row_pointers[j] = (png_bytep) gdMalloc(width * channels);
- for (i = 0; i < width; ++i) {
- unsigned char a;
- row_pointers[j][bo++] = gdTrueColorGetRed(im->tpixels[j][i]);
- row_pointers[j][bo++] = gdTrueColorGetGreen(im->tpixels[j][i]);
- row_pointers[j][bo++] = gdTrueColorGetBlue(im->tpixels[j][i]);
- if (im->saveAlphaFlag) {
- /* convert the 7-bit alpha channel to an 8-bit alpha channel.
- * We do a little bit-flipping magic, repeating the MSB
- * as the LSB, to ensure that 0 maps to 0 and
- * 127 maps to 255. We also have to invert to match
- * PNG's convention in which 255 is opaque.
- */
- a = gdTrueColorGetAlpha(im->tpixels[j][i]);
- /* Andrew Hull: >> 6, not >> 7! (gd 2.0.5) */
- row_pointers[j][bo++] = 255 - ((a << 1) + (a >> 6));
- }
- }
- }
-
- png_write_image(png_ptr, row_pointers);
- png_write_end(png_ptr, info_ptr);
-
- for (j = 0; j < height; ++j) {
- gdFree(row_pointers[j]);
- }
-
- gdFree(row_pointers);
- } else {
- if (remap) {
- png_bytep *row_pointers;
- row_pointers = gdMalloc(sizeof (png_bytep) * height);
- for (j = 0; j < height; ++j) {
- row_pointers[j] = (png_bytep) gdMalloc(width);
- for (i = 0; i < width; ++i) {
- row_pointers[j][i] = mapping[im->pixels[j][i]];
- }
- }
-
- png_write_image(png_ptr, row_pointers);
- png_write_end(png_ptr, info_ptr);
-
- for (j = 0; j < height; ++j) {
- gdFree(row_pointers[j]);
- }
-
- gdFree(row_pointers);
- } else {
- png_write_image(png_ptr, im->pixels);
- png_write_end(png_ptr, info_ptr);
- }
- }
- /* 1.6.3: maybe we should give that memory BACK! TBB */
- png_destroy_write_struct(&png_ptr, &info_ptr);
-}
-
-#endif /* HAVE_LIBPNG */
diff --git a/ext/gd/libgd/gd_ss.c b/ext/gd/libgd/gd_ss.c
deleted file mode 100644
index 78f91df9c9..0000000000
--- a/ext/gd/libgd/gd_ss.c
+++ /dev/null
@@ -1,49 +0,0 @@
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include "gd.h"
-
-#define TRUE 1
-#define FALSE 0
-
-/* Exported functions: */
-extern void gdImagePngToSink (gdImagePtr im, gdSinkPtr out);
-extern gdImagePtr gdImageCreateFromPngSource (gdSourcePtr inSource);
-
-/* Use this for commenting out debug-print statements. */
-/* Just use the first '#define' to allow all the prints... */
-/*#define GD_SS_DBG(s) (s) */
-#define GD_SS_DBG(s)
-
-#ifdef HAVE_LIBPNG
-void gdImagePngToSink (gdImagePtr im, gdSinkPtr outSink)
-{
- gdIOCtx *out = gdNewSSCtx(NULL, outSink);
- gdImagePngCtx(im, out);
- out->gd_free(out);
-}
-
-gdImagePtr gdImageCreateFromPngSource (gdSourcePtr inSource)
-{
- gdIOCtx *in = gdNewSSCtx(inSource, NULL);
- gdImagePtr im;
-
- im = gdImageCreateFromPngCtx(in);
-
- in->gd_free(in);
-
- return im;
-}
-#else /* no HAVE_LIBPNG */
-void gdImagePngToSink (gdImagePtr im, gdSinkPtr outSink)
-{
- php_gd_error("PNG support is not available\n");
-}
-gdImagePtr gdImageCreateFromPngSource (gdSourcePtr inSource)
-{
- php_gd_error("PNG support is not available\n");
- return NULL;
-}
-#endif /* HAVE_LIBPNG */
-
diff --git a/ext/gd/libgd/gd_topal.c b/ext/gd/libgd/gd_topal.c
deleted file mode 100644
index 77fb4139b2..0000000000
--- a/ext/gd/libgd/gd_topal.c
+++ /dev/null
@@ -1,1919 +0,0 @@
-/* 2.0.12: a new adaptation from the same original, this time
- * by Barend Gahrels. My attempt to incorporate alpha channel
- * into the result worked poorly and degraded the quality of
- * palette conversion even when the source contained no
- * alpha channel data. This version does not attempt to produce
- * an output file with transparency in some of the palette
- * indexes, which, in practice, doesn't look so hot anyway. TBB
- */
-
-/*
- * gd_topal, adapted from jquant2.c
- *
- * Copyright (C) 1991-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains 2-pass color quantization (color mapping) routines.
- * These routines provide selection of a custom color map for an image,
- * followed by mapping of the image to that color map, with optional
- * Floyd-Steinberg dithering.
- * It is also possible to use just the second pass to map to an arbitrary
- * externally-given color map.
- *
- * Note: ordered dithering is not supported, since there isn't any fast
- * way to compute intercolor distances; it's unclear that ordered dither's
- * fundamental assumptions even hold with an irregularly spaced color map.
- */
-
-#ifdef ORIGINAL_LIB_JPEG
-
-#define JPEG_INTERNALS
-
-#include "jinclude.h"
-#include "jpeglib.h"
-
-#else
-
-/*
- * THOMAS BOUTELL & BAREND GEHRELS, february 2003
- * adapted the code to work within gd rather than within libjpeg.
- * If it is not working, it's not Thomas G. Lane's fault.
- */
-
-/*
- * SETTING THIS ONE CAUSES STRIPED IMAGE
- * to be done: solve this
- * #define ORIGINAL_LIB_JPEG_REVERSE_ODD_ROWS
- */
-
-#include "gd.h"
-#include "gdhelpers.h"
-#include <string.h>
-#include <stdlib.h>
-
-/* (Re)define some defines known by libjpeg */
-#define QUANT_2PASS_SUPPORTED
-
-#define RGB_RED 0
-#define RGB_GREEN 1
-#define RGB_BLUE 2
-
-#define JSAMPLE unsigned char
-#define MAXJSAMPLE (gdMaxColors-1)
-#define BITS_IN_JSAMPLE 8
-
-#define JSAMPROW int*
-#define JDIMENSION int
-
-#define METHODDEF(type) static type
-#define LOCAL(type) static type
-
-
-/* We assume that right shift corresponds to signed division by 2 with
- * rounding towards minus infinity. This is correct for typical "arithmetic
- * shift" instructions that shift in copies of the sign bit. But some
- * C compilers implement >> with an unsigned shift. For these machines you
- * must define RIGHT_SHIFT_IS_UNSIGNED.
- * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
- * It is only applied with constant shift counts. SHIFT_TEMPS must be
- * included in the variables of any routine using RIGHT_SHIFT.
- */
-
-#ifdef RIGHT_SHIFT_IS_UNSIGNED
-#define SHIFT_TEMPS INT32 shift_temp;
-#define RIGHT_SHIFT(x,shft) \
- ((shift_temp = (x)) < 0 ? \
- (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
- (shift_temp >> (shft)))
-#else
-#define SHIFT_TEMPS
-#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
-#endif
-
-
-#define range_limit(x) { if(x<0) x=0; if (x>255) x=255; }
-
-
-#ifndef INT16
-#define INT16 short
-#endif
-
-#ifndef UINT16
-#define UINT16 unsigned short
-#endif
-
-#ifndef INT32
-#define INT32 int
-#endif
-
-#ifndef FAR
-#define FAR
-#endif
-
-#ifndef boolean
-#define boolean int
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#define input_buf (im->tpixels)
-#define output_buf (im->pixels)
-
-#endif
-
-#ifdef QUANT_2PASS_SUPPORTED
-
-
-/*
- * This module implements the well-known Heckbert paradigm for color
- * quantization. Most of the ideas used here can be traced back to
- * Heckbert's seminal paper
- * Heckbert, Paul. "Color Image Quantization for Frame Buffer Display",
- * Proc. SIGGRAPH '82, Computer Graphics v.16 #3 (July 1982), pp 297-304.
- *
- * In the first pass over the image, we accumulate a histogram showing the
- * usage count of each possible color. To keep the histogram to a reasonable
- * size, we reduce the precision of the input; typical practice is to retain
- * 5 or 6 bits per color, so that 8 or 4 different input values are counted
- * in the same histogram cell.
- *
- * Next, the color-selection step begins with a box representing the whole
- * color space, and repeatedly splits the "largest" remaining box until we
- * have as many boxes as desired colors. Then the mean color in each
- * remaining box becomes one of the possible output colors.
- *
- * The second pass over the image maps each input pixel to the closest output
- * color (optionally after applying a Floyd-Steinberg dithering correction).
- * This mapping is logically trivial, but making it go fast enough requires
- * considerable care.
- *
- * Heckbert-style quantizers vary a good deal in their policies for choosing
- * the "largest" box and deciding where to cut it. The particular policies
- * used here have proved out well in experimental comparisons, but better ones
- * may yet be found.
- *
- * In earlier versions of the IJG code, this module quantized in YCbCr color
- * space, processing the raw upsampled data without a color conversion step.
- * This allowed the color conversion math to be done only once per colormap
- * entry, not once per pixel. However, that optimization precluded other
- * useful optimizations (such as merging color conversion with upsampling)
- * and it also interfered with desired capabilities such as quantizing to an
- * externally-supplied colormap. We have therefore abandoned that approach.
- * The present code works in the post-conversion color space, typically RGB.
- *
- * To improve the visual quality of the results, we actually work in scaled
- * RGB space, giving G distances more weight than R, and R in turn more than
- * B. To do everything in integer math, we must use integer scale factors.
- * The 2/3/1 scale factors used here correspond loosely to the relative
- * weights of the colors in the NTSC grayscale equation.
- * If you want to use this code to quantize a non-RGB color space, you'll
- * probably need to change these scale factors.
- */
-
-#define R_SCALE 2 /* scale R distances by this much */
-#define G_SCALE 3 /* scale G distances by this much */
-#define B_SCALE 1 /* and B by this much */
-
-/* Relabel R/G/B as components 0/1/2, respecting the RGB ordering defined
- * in jmorecfg.h. As the code stands, it will do the right thing for R,G,B
- * and B,G,R orders. If you define some other weird order in jmorecfg.h,
- * you'll get compile errors until you extend this logic. In that case
- * you'll probably want to tweak the histogram sizes too.
- */
-
-#if RGB_RED == 0
-#define C0_SCALE R_SCALE
-#endif
-#if RGB_BLUE == 0
-#define C0_SCALE B_SCALE
-#endif
-#if RGB_GREEN == 1
-#define C1_SCALE G_SCALE
-#endif
-#if RGB_RED == 2
-#define C2_SCALE R_SCALE
-#endif
-#if RGB_BLUE == 2
-#define C2_SCALE B_SCALE
-#endif
-
-
-/*
- * First we have the histogram data structure and routines for creating it.
- *
- * The number of bits of precision can be adjusted by changing these symbols.
- * We recommend keeping 6 bits for G and 5 each for R and B.
- * If you have plenty of memory and cycles, 6 bits all around gives marginally
- * better results; if you are short of memory, 5 bits all around will save
- * some space but degrade the results.
- * To maintain a fully accurate histogram, we'd need to allocate a "long"
- * (preferably unsigned long) for each cell. In practice this is overkill;
- * we can get by with 16 bits per cell. Few of the cell counts will overflow,
- * and clamping those that do overflow to the maximum value will give close-
- * enough results. This reduces the recommended histogram size from 256Kb
- * to 128Kb, which is a useful savings on PC-class machines.
- * (In the second pass the histogram space is re-used for pixel mapping data;
- * in that capacity, each cell must be able to store zero to the number of
- * desired colors. 16 bits/cell is plenty for that too.)
- * Since the JPEG code is intended to run in small memory model on 80x86
- * machines, we can't just allocate the histogram in one chunk. Instead
- * of a true 3-D array, we use a row of pointers to 2-D arrays. Each
- * pointer corresponds to a C0 value (typically 2^5 = 32 pointers) and
- * each 2-D array has 2^6*2^5 = 2048 or 2^6*2^6 = 4096 entries. Note that
- * on 80x86 machines, the pointer row is in near memory but the actual
- * arrays are in far memory (same arrangement as we use for image arrays).
- */
-
-#define MAXNUMCOLORS (MAXJSAMPLE+1) /* maximum size of colormap */
-
-/* These will do the right thing for either R,G,B or B,G,R color order,
- * but you may not like the results for other color orders.
- */
-#define HIST_C0_BITS 5 /* bits of precision in R/B histogram */
-#define HIST_C1_BITS 6 /* bits of precision in G histogram */
-#define HIST_C2_BITS 5 /* bits of precision in B/R histogram */
-
-/* Number of elements along histogram axes. */
-#define HIST_C0_ELEMS (1<<HIST_C0_BITS)
-#define HIST_C1_ELEMS (1<<HIST_C1_BITS)
-#define HIST_C2_ELEMS (1<<HIST_C2_BITS)
-
-/* These are the amounts to shift an input value to get a histogram index. */
-#define C0_SHIFT (BITS_IN_JSAMPLE-HIST_C0_BITS)
-#define C1_SHIFT (BITS_IN_JSAMPLE-HIST_C1_BITS)
-#define C2_SHIFT (BITS_IN_JSAMPLE-HIST_C2_BITS)
-
-
-typedef UINT16 histcell; /* histogram cell; prefer an unsigned type */
-
-typedef histcell FAR *histptr; /* for pointers to histogram cells */
-
-typedef histcell hist1d[HIST_C2_ELEMS]; /* typedefs for the array */
-typedef hist1d FAR *hist2d; /* type for the 2nd-level pointers */
-typedef hist2d *hist3d; /* type for top-level pointer */
-
-
-/* Declarations for Floyd-Steinberg dithering.
- *
- * Errors are accumulated into the array fserrors[], at a resolution of
- * 1/16th of a pixel count. The error at a given pixel is propagated
- * to its not-yet-processed neighbors using the standard F-S fractions,
- * ... (here) 7/16
- * 3/16 5/16 1/16
- * We work left-to-right on even rows, right-to-left on odd rows.
- *
- * We can get away with a single array (holding one row's worth of errors)
- * by using it to store the current row's errors at pixel columns not yet
- * processed, but the next row's errors at columns already processed. We
- * need only a few extra variables to hold the errors immediately around the
- * current column. (If we are lucky, those variables are in registers, but
- * even if not, they're probably cheaper to access than array elements are.)
- *
- * The fserrors[] array has (#columns + 2) entries; the extra entry at
- * each end saves us from special-casing the first and last pixels.
- * Each entry is three values long, one value for each color component.
- *
- * Note: on a wide image, we might not have enough room in a PC's near data
- * segment to hold the error array; so it is allocated with alloc_large.
- */
-
-#if BITS_IN_JSAMPLE == 8
-typedef INT16 FSERROR; /* 16 bits should be enough */
-typedef int LOCFSERROR; /* use 'int' for calculation temps */
-#else
-typedef INT32 FSERROR; /* may need more than 16 bits */
-typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */
-#endif
-
-typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */
-
-/* Private subobject */
-
-typedef struct
-{
-#ifdef ORIGINAL_LIB_JPEG
- struct jpeg_color_quantizer pub; /* public fields */
-
- /* Space for the eventually created colormap is stashed here */
- JSAMPARRAY sv_colormap; /* colormap allocated at init time */
- int desired; /* desired # of colors = size of colormap */
- boolean needs_zeroed; /* TRUE if next pass must zero histogram */
-#endif
-
- /* Variables for accumulating image statistics */
- hist3d histogram; /* pointer to the histogram */
-
-
- /* Variables for Floyd-Steinberg dithering */
- FSERRPTR fserrors; /* accumulated errors */
-
- boolean on_odd_row; /* flag to remember which row we are on */
- int *error_limiter; /* table for clamping the applied error */
-#ifndef ORIGINAL_LIB_JPEG
- int *error_limiter_storage; /* gdMalloc'd storage for the above */
-#endif
-} my_cquantizer;
-
-typedef my_cquantizer *my_cquantize_ptr;
-
-
-/*
- * Prescan some rows of pixels.
- * In this module the prescan simply updates the histogram, which has been
- * initialized to zeroes by start_pass.
- * An output_buf parameter is required by the method signature, but no data
- * is actually output (in fact the buffer controller is probably passing a
- * NULL pointer).
- */
-
-METHODDEF (void)
-#ifndef ORIGINAL_LIB_JPEG
-prescan_quantize (gdImagePtr im, my_cquantize_ptr cquantize)
-{
-#else
-prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
-{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
-#endif
- register JSAMPROW ptr;
- register histptr histp;
- register hist3d histogram = cquantize->histogram;
- int row;
- JDIMENSION col;
-#ifdef ORIGINAL_LIB_JPEG
- JDIMENSION width = cinfo->output_width;
-#else
- int width = im->sx;
- int num_rows = im->sy;
-#endif
-
- for (row = 0; row < num_rows; row++) {
- ptr = input_buf[row];
- for (col = width; col > 0; col--) {
-#ifdef ORIGINAL_LIB_JPEG
- int r = GETJSAMPLE(ptr[0]) >> C0_SHIFT;
- int g = GETJSAMPLE(ptr[1]) >> C1_SHIFT;
- int b = GETJSAMPLE(ptr[2]) >> C2_SHIFT;
-#else
- int r = gdTrueColorGetRed(*ptr) >> C0_SHIFT;
- int g = gdTrueColorGetGreen(*ptr) >> C1_SHIFT;
- int b = gdTrueColorGetBlue(*ptr) >> C2_SHIFT;
- /* 2.0.12: Steven Brown: support a single totally transparent color in the original. */
- if ((im->transparent >= 0) && (*ptr == im->transparent)) {
- ptr++;
- continue;
- }
-#endif
- /* get pixel value and index into the histogram */
- histp = &histogram[r][g][b];
- /* increment, check for overflow and undo increment if so. */
- if (++(*histp) == 0) {
- (*histp)--;
- }
-#ifdef ORIGINAL_LIB_JPEG
- ptr += 3;
-#else
- ptr++;
-#endif
- }
- }
-}
-
-/*
- * Next we have the really interesting routines: selection of a colormap
- * given the completed histogram.
- * These routines work with a list of "boxes", each representing a rectangular
- * subset of the input color space (to histogram precision).
- */
-
-typedef struct
-{
- /* The bounds of the box (inclusive); expressed as histogram indexes */
- int c0min, c0max;
- int c1min, c1max;
- int c2min, c2max;
- /* The volume (actually 2-norm) of the box */
- INT32 volume;
- /* The number of nonzero histogram cells within this box */
- long colorcount;
-} box;
-
-typedef box *boxptr;
-
-LOCAL (boxptr) find_biggest_color_pop (boxptr boxlist, int numboxes)
-/* Find the splittable box with the largest color population */
-/* Returns NULL if no splittable boxes remain */
-{
- register boxptr boxp;
- register int i;
- register long maxc = 0;
- boxptr which = NULL;
-
- for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) {
- if (boxp->colorcount > maxc && boxp->volume > 0) {
- which = boxp;
- maxc = boxp->colorcount;
- }
- }
-
- return which;
-}
-
-
-LOCAL (boxptr) find_biggest_volume (boxptr boxlist, int numboxes)
-/* Find the splittable box with the largest (scaled) volume */
-/* Returns NULL if no splittable boxes remain */
-{
- register boxptr boxp;
- register int i;
- register INT32 maxv = 0;
- boxptr which = NULL;
-
- for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) {
- if (boxp->volume > maxv) {
- which = boxp;
- maxv = boxp->volume;
- }
- }
-
- return which;
-}
-
-
-LOCAL (void)
-#ifndef ORIGINAL_LIB_JPEG
- update_box (gdImagePtr im, my_cquantize_ptr cquantize, boxptr boxp)
-{
-#else
- update_box (j_decompress_ptr cinfo, boxptr boxp)
-/* Shrink the min/max bounds of a box to enclose only nonzero elements, */
-/* and recompute its volume and population */
-{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
-#endif
- hist3d histogram = cquantize->histogram;
- histptr histp;
- int c0, c1, c2;
- int c0min, c0max, c1min, c1max, c2min, c2max;
- INT32 dist0, dist1, dist2;
- long ccount;
-
- c0min = boxp->c0min;
- c0max = boxp->c0max;
- c1min = boxp->c1min;
- c1max = boxp->c1max;
- c2min = boxp->c2min;
- c2max = boxp->c2max;
-
- if (c0max > c0min) {
- for (c0 = c0min; c0 <= c0max; c0++) {
- for (c1 = c1min; c1 <= c1max; c1++) {
- histp = &histogram[c0][c1][c2min];
- for (c2 = c2min; c2 <= c2max; c2++) {
- if (*histp++ != 0) {
- boxp->c0min = c0min = c0;
- goto have_c0min;
- }
- }
- }
- }
- }
-have_c0min:
- if (c0max > c0min) {
- for (c0 = c0max; c0 >= c0min; c0--) {
- for (c1 = c1min; c1 <= c1max; c1++) {
- histp = &histogram[c0][c1][c2min];
- for (c2 = c2min; c2 <= c2max; c2++) {
- if (*histp++ != 0) {
- boxp->c0max = c0max = c0;
- goto have_c0max;
- }
- }
- }
- }
- }
-have_c0max:
- if (c1max > c1min) {
- for (c1 = c1min; c1 <= c1max; c1++) {
- for (c0 = c0min; c0 <= c0max; c0++) {
- histp = &histogram[c0][c1][c2min];
- for (c2 = c2min; c2 <= c2max; c2++) {
- if (*histp++ != 0) {
- boxp->c1min = c1min = c1;
- goto have_c1min;
- }
- }
- }
- }
- }
-have_c1min:
- if (c1max > c1min) {
- for (c1 = c1max; c1 >= c1min; c1--) {
- for (c0 = c0min; c0 <= c0max; c0++) {
- histp = &histogram[c0][c1][c2min];
- for (c2 = c2min; c2 <= c2max; c2++) {
- if (*histp++ != 0) {
- boxp->c1max = c1max = c1;
- goto have_c1max;
- }
- }
- }
- }
- }
-have_c1max:
- if (c2max > c2min) {
- for (c2 = c2min; c2 <= c2max; c2++) {
- for (c0 = c0min; c0 <= c0max; c0++) {
- histp = &histogram[c0][c1min][c2];
- for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) {
- if (*histp != 0) {
- boxp->c2min = c2min = c2;
- goto have_c2min;
- }
- }
- }
- }
- }
-have_c2min:
- if (c2max > c2min) {
- for (c2 = c2max; c2 >= c2min; c2--) {
- for (c0 = c0min; c0 <= c0max; c0++) {
- histp = &histogram[c0][c1min][c2];
- for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) {
- if (*histp != 0) {
- boxp->c2max = c2max = c2;
- goto have_c2max;
- }
- }
- }
- }
- }
-have_c2max:
-
- /* Update box volume.
- * We use 2-norm rather than real volume here; this biases the method
- * against making long narrow boxes, and it has the side benefit that
- * a box is splittable iff norm > 0.
- * Since the differences are expressed in histogram-cell units,
- * we have to shift back to JSAMPLE units to get consistent distances;
- * after which, we scale according to the selected distance scale factors.
- */
- dist0 = ((c0max - c0min) << C0_SHIFT) * C0_SCALE;
- dist1 = ((c1max - c1min) << C1_SHIFT) * C1_SCALE;
- dist2 = ((c2max - c2min) << C2_SHIFT) * C2_SCALE;
- boxp->volume = dist0 * dist0 + dist1 * dist1 + dist2 * dist2;
-
- /* Now scan remaining volume of box and compute population */
- ccount = 0;
- for (c0 = c0min; c0 <= c0max; c0++) {
- for (c1 = c1min; c1 <= c1max; c1++) {
- histp = &histogram[c0][c1][c2min];
- for (c2 = c2min; c2 <= c2max; c2++, histp++) {
- if (*histp != 0) {
- ccount++;
- }
- }
- }
- }
- boxp->colorcount = ccount;
-}
-
-
-LOCAL (int)
-#ifdef ORIGINAL_LIB_JPEG
-median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, int desired_colors)
-#else
-median_cut (gdImagePtr im, my_cquantize_ptr cquantize, boxptr boxlist, int numboxes, int desired_colors)
-#endif
-/* Repeatedly select and split the largest box until we have enough boxes */
-{
- int n, lb;
- int c0, c1, c2, cmax;
- register boxptr b1, b2;
-
- while (numboxes < desired_colors) {
- /* Select box to split.
- * Current algorithm: by population for first half, then by volume.
- */
- if (numboxes * 2 <= desired_colors) {
- b1 = find_biggest_color_pop(boxlist, numboxes);
- } else {
- b1 = find_biggest_volume(boxlist, numboxes);
- }
- if (b1 == NULL) { /* no splittable boxes left! */
- break;
- }
- b2 = &boxlist[numboxes]; /* where new box will go */
- /* Copy the color bounds to the new box. */
- b2->c0max = b1->c0max;
- b2->c1max = b1->c1max;
- b2->c2max = b1->c2max;
- b2->c0min = b1->c0min;
- b2->c1min = b1->c1min;
- b2->c2min = b1->c2min;
- /* Choose which axis to split the box on.
- * Current algorithm: longest scaled axis.
- * See notes in update_box about scaling distances.
- */
- c0 = ((b1->c0max - b1->c0min) << C0_SHIFT) * C0_SCALE;
- c1 = ((b1->c1max - b1->c1min) << C1_SHIFT) * C1_SCALE;
- c2 = ((b1->c2max - b1->c2min) << C2_SHIFT) * C2_SCALE;
- /* We want to break any ties in favor of green, then red, blue last.
- * This code does the right thing for R,G,B or B,G,R color orders only.
- */
-#if RGB_RED == 0
- cmax = c1;
- n = 1;
- if (c0 > cmax) {
- cmax = c0;
- n = 0;
- }
- if (c2 > cmax) {
- n = 2;
- }
-#else
- cmax = c1;
- n = 1;
- if (c2 > cmax) {
- cmax = c2;
- n = 2;
- }
- if (c0 > cmax) {
- n = 0;
- }
-#endif
- /* Choose split point along selected axis, and update box bounds.
- * Current algorithm: split at halfway point.
- * (Since the box has been shrunk to minimum volume,
- * any split will produce two nonempty subboxes.)
- * Note that lb value is max for lower box, so must be < old max.
- */
- switch (n) {
- case 0:
- lb = (b1->c0max + b1->c0min) / 2;
- b1->c0max = lb;
- b2->c0min = lb + 1;
- break;
- case 1:
- lb = (b1->c1max + b1->c1min) / 2;
- b1->c1max = lb;
- b2->c1min = lb + 1;
- break;
- case 2:
- lb = (b1->c2max + b1->c2min) / 2;
- b1->c2max = lb;
- b2->c2min = lb + 1;
- break;
- }
- /* Update stats for boxes */
-#ifdef ORIGINAL_LIB_JPEG
- update_box(cinfo, b1);
- update_box(cinfo, b2);
-#else
- update_box(im, cquantize, b1);
- update_box(im, cquantize, b2);
-#endif
- numboxes++;
- }
-
- return numboxes;
-}
-
-
-LOCAL (void)
-#ifndef ORIGINAL_LIB_JPEG
- compute_color (gdImagePtr im, my_cquantize_ptr cquantize, boxptr boxp, int icolor)
-{
-#else
- compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor)
-/* Compute representative color for a box, put it in colormap[icolor] */
-{
- /* Current algorithm: mean weighted by pixels (not colors) */
- /* Note it is important to get the rounding correct! */
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
-#endif
- hist3d histogram = cquantize->histogram;
- histptr histp;
- int c0, c1, c2;
- int c0min, c0max, c1min, c1max, c2min, c2max;
- long count;
- long total = 0;
- long c0total = 0;
- long c1total = 0;
- long c2total = 0;
-
- c0min = boxp->c0min;
- c0max = boxp->c0max;
- c1min = boxp->c1min;
- c1max = boxp->c1max;
- c2min = boxp->c2min;
- c2max = boxp->c2max;
-
- for (c0 = c0min; c0 <= c0max; c0++) {
- for (c1 = c1min; c1 <= c1max; c1++) {
- histp = &histogram[c0][c1][c2min];
- for (c2 = c2min; c2 <= c2max; c2++) {
- if ((count = *histp++) != 0) {
- total += count;
- c0total += ((c0 << C0_SHIFT) + ((1 << C0_SHIFT) >> 1)) * count;
- c1total += ((c1 << C1_SHIFT) + ((1 << C1_SHIFT) >> 1)) * count;
- c2total += ((c2 << C2_SHIFT) + ((1 << C2_SHIFT) >> 1)) * count;
- }
- }
- }
- }
-
-#ifdef ORIGINAL_LIB_JPEG
- cinfo->colormap[0][icolor] = (JSAMPLE) ((c0total + (total >> 1)) / total);
- cinfo->colormap[1][icolor] = (JSAMPLE) ((c1total + (total >> 1)) / total);
- cinfo->colormap[2][icolor] = (JSAMPLE) ((c2total + (total >> 1)) / total);
-#else
- im->red[icolor] = (int) ((c0total + (total >> 1)) / total);
- im->green[icolor] = (int) ((c1total + (total >> 1)) / total);
- im->blue[icolor] = (int) ((c2total + (total >> 1)) / total);
-#endif
-}
-
-
-LOCAL (void)
-#ifdef ORIGINAL_LIB_JPEG
-select_colors (j_decompress_ptr cinfo, int desired_colors)
-#else
-select_colors (gdImagePtr im, my_cquantize_ptr cquantize, int desired_colors)
-#endif
-/* Master routine for color selection */
-{
- boxptr boxlist;
- int numboxes;
- int i;
-
- /* Allocate workspace for box list */
-#ifdef ORIGINAL_LIB_JPEG
- boxlist = (boxptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, desired_colors * SIZEOF (box));
-#else
- boxlist = (boxptr) gdMalloc (desired_colors * sizeof (box));
-#endif
- /* Initialize one box containing whole space */
- numboxes = 1;
- boxlist[0].c0min = 0;
- boxlist[0].c0max = MAXJSAMPLE >> C0_SHIFT;
- boxlist[0].c1min = 0;
- boxlist[0].c1max = MAXJSAMPLE >> C1_SHIFT;
- boxlist[0].c2min = 0;
- boxlist[0].c2max = MAXJSAMPLE >> C2_SHIFT;
-#ifdef ORIGINAL_LIB_JPEG
- /* Shrink it to actually-used volume and set its statistics */
- update_box(cinfo, &boxlist[0]);
- /* Perform median-cut to produce final box list */
- numboxes = median_cut(cinfo, boxlist, numboxes, desired_colors);
- /* Compute the representative color for each box, fill colormap */
- for (i = 0; i < numboxes; i++) {
- compute_color(cinfo, &boxlist[i], i);
- }
- cinfo->actual_number_of_colors = numboxes;
- TRACEMS1(cinfo, 1, JTRC_QUANT_SELECTED, numboxes);
-#else
- /* Shrink it to actually-used volume and set its statistics */
- update_box(im, cquantize, &boxlist[0]);
- /* Perform median-cut to produce final box list */
- numboxes = median_cut(im, cquantize, boxlist, numboxes, desired_colors);
- /* Compute the representative color for each box, fill colormap */
- for (i = 0; i < numboxes; i++) {
- compute_color(im, cquantize, &boxlist[i], i);
- }
- im->colorsTotal = numboxes;
-
- /* If we had a pure transparency color, add it as the last palette entry.
- * Skip incrementing the color count so that the dither / matching phase
- * won't use it on pixels that shouldn't have been transparent. We'll
- * increment it after all that finishes.
- */
- if (im->transparent >= 0) {
- /* Save the transparent color. */
- im->red[im->colorsTotal] = gdTrueColorGetRed(im->transparent);
- im->green[im->colorsTotal] = gdTrueColorGetGreen(im->transparent);
- im->blue[im->colorsTotal] = gdTrueColorGetBlue(im->transparent);
- im->alpha[im->colorsTotal] = gdAlphaTransparent;
- im->open[im->colorsTotal] = 0;
- }
-
- gdFree(boxlist);
-#endif
-}
-
-
-/*
- * These routines are concerned with the time-critical task of mapping input
- * colors to the nearest color in the selected colormap.
- *
- * We re-use the histogram space as an "inverse color map", essentially a
- * cache for the results of nearest-color searches. All colors within a
- * histogram cell will be mapped to the same colormap entry, namely the one
- * closest to the cell's center. This may not be quite the closest entry to
- * the actual input color, but it's almost as good. A zero in the cache
- * indicates we haven't found the nearest color for that cell yet; the array
- * is cleared to zeroes before starting the mapping pass. When we find the
- * nearest color for a cell, its colormap index plus one is recorded in the
- * cache for future use. The pass2 scanning routines call fill_inverse_cmap
- * when they need to use an unfilled entry in the cache.
- *
- * Our method of efficiently finding nearest colors is based on the "locally
- * sorted search" idea described by Heckbert and on the incremental distance
- * calculation described by Spencer W. Thomas in chapter III.1 of Graphics
- * Gems II (James Arvo, ed. Academic Press, 1991). Thomas points out that
- * the distances from a given colormap entry to each cell of the histogram can
- * be computed quickly using an incremental method: the differences between
- * distances to adjacent cells themselves differ by a constant. This allows a
- * fairly fast implementation of the "brute force" approach of computing the
- * distance from every colormap entry to every histogram cell. Unfortunately,
- * it needs a work array to hold the best-distance-so-far for each histogram
- * cell (because the inner loop has to be over cells, not colormap entries).
- * The work array elements have to be INT32s, so the work array would need
- * 256Kb at our recommended precision. This is not feasible in DOS machines.
- *
- * To get around these problems, we apply Thomas' method to compute the
- * nearest colors for only the cells within a small subbox of the histogram.
- * The work array need be only as big as the subbox, so the memory usage
- * problem is solved. Furthermore, we need not fill subboxes that are never
- * referenced in pass2; many images use only part of the color gamut, so a
- * fair amount of work is saved. An additional advantage of this
- * approach is that we can apply Heckbert's locality criterion to quickly
- * eliminate colormap entries that are far away from the subbox; typically
- * three-fourths of the colormap entries are rejected by Heckbert's criterion,
- * and we need not compute their distances to individual cells in the subbox.
- * The speed of this approach is heavily influenced by the subbox size: too
- * small means too much overhead, too big loses because Heckbert's criterion
- * can't eliminate as many colormap entries. Empirically the best subbox
- * size seems to be about 1/512th of the histogram (1/8th in each direction).
- *
- * Thomas' article also describes a refined method which is asymptotically
- * faster than the brute-force method, but it is also far more complex and
- * cannot efficiently be applied to small subboxes. It is therefore not
- * useful for programs intended to be portable to DOS machines. On machines
- * with plenty of memory, filling the whole histogram in one shot with Thomas'
- * refined method might be faster than the present code --- but then again,
- * it might not be any faster, and it's certainly more complicated.
- */
-
-
-/* log2(histogram cells in update box) for each axis; this can be adjusted */
-#define BOX_C0_LOG (HIST_C0_BITS-3)
-#define BOX_C1_LOG (HIST_C1_BITS-3)
-#define BOX_C2_LOG (HIST_C2_BITS-3)
-
-#define BOX_C0_ELEMS (1<<BOX_C0_LOG) /* # of hist cells in update box */
-#define BOX_C1_ELEMS (1<<BOX_C1_LOG)
-#define BOX_C2_ELEMS (1<<BOX_C2_LOG)
-
-#define BOX_C0_SHIFT (C0_SHIFT + BOX_C0_LOG)
-#define BOX_C1_SHIFT (C1_SHIFT + BOX_C1_LOG)
-#define BOX_C2_SHIFT (C2_SHIFT + BOX_C2_LOG)
-
-
-/*
- * The next three routines implement inverse colormap filling. They could
- * all be folded into one big routine, but splitting them up this way saves
- * some stack space (the mindist[] and bestdist[] arrays need not coexist)
- * and may allow some compilers to produce better code by registerizing more
- * inner-loop variables.
- */
-
-LOCAL (int)
-find_nearby_colors (
-#ifdef ORIGINAL_LIB_JPEG
- j_decompress_ptr cinfo,
-#else
- gdImagePtr im, my_cquantize_ptr cquantize,
-#endif
- int minc0, int minc1, int minc2, JSAMPLE colorlist[])
-/* Locate the colormap entries close enough to an update box to be candidates
- * for the nearest entry to some cell(s) in the update box. The update box
- * is specified by the center coordinates of its first cell. The number of
- * candidate colormap entries is returned, and their colormap indexes are
- * placed in colorlist[].
- * This routine uses Heckbert's "locally sorted search" criterion to select
- * the colors that need further consideration.
- */
-{
-#ifdef ORIGINAL_LIB_JPEG
- int numcolors = cinfo->actual_number_of_colors;
-#else
- int numcolors = im->colorsTotal;
-#endif
- int maxc0, maxc1, maxc2;
- int centerc0, centerc1, centerc2;
- int i, x, ncolors;
- INT32 minmaxdist, min_dist, max_dist, tdist;
- INT32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */
-
- /* Compute true coordinates of update box's upper corner and center.
- * Actually we compute the coordinates of the center of the upper-corner
- * histogram cell, which are the upper bounds of the volume we care about.
- * Note that since ">>" rounds down, the "center" values may be closer to
- * min than to max; hence comparisons to them must be "<=", not "<".
- */
- maxc0 = minc0 + ((1 << BOX_C0_SHIFT) - (1 << C0_SHIFT));
- centerc0 = (minc0 + maxc0) >> 1;
- maxc1 = minc1 + ((1 << BOX_C1_SHIFT) - (1 << C1_SHIFT));
- centerc1 = (minc1 + maxc1) >> 1;
- maxc2 = minc2 + ((1 << BOX_C2_SHIFT) - (1 << C2_SHIFT));
- centerc2 = (minc2 + maxc2) >> 1;
-
- /* For each color in colormap, find:
- * 1. its minimum squared-distance to any point in the update box
- * (zero if color is within update box);
- * 2. its maximum squared-distance to any point in the update box.
- * Both of these can be found by considering only the corners of the box.
- * We save the minimum distance for each color in mindist[];
- * only the smallest maximum distance is of interest.
- */
- minmaxdist = 0x7FFFFFFFL;
-
- for (i = 0; i < numcolors; i++) {
- /* We compute the squared-c0-distance term, then add in the other two. */
-#ifdef ORIGINAL_LIB_JPEG
- x = GETJSAMPLE(cinfo->colormap[0][i]);
-#else
- x = im->red[i];
-#endif
- if (x < minc0) {
- tdist = (x - minc0) * C0_SCALE;
- min_dist = tdist * tdist;
- tdist = (x - maxc0) * C0_SCALE;
- max_dist = tdist * tdist;
- } else if (x > maxc0) {
- tdist = (x - maxc0) * C0_SCALE;
- min_dist = tdist * tdist;
- tdist = (x - minc0) * C0_SCALE;
- max_dist = tdist * tdist;
- } else {
- /* within cell range so no contribution to min_dist */
- min_dist = 0;
- if (x <= centerc0) {
- tdist = (x - maxc0) * C0_SCALE;
- max_dist = tdist * tdist;
- } else {
- tdist = (x - minc0) * C0_SCALE;
- max_dist = tdist * tdist;
- }
- }
-
-#ifdef ORIGINAL_LIB_JPEG
- x = GETJSAMPLE(cinfo->colormap[1][i]);
-#else
- x = im->green[i];
-#endif
- if (x < minc1) {
- tdist = (x - minc1) * C1_SCALE;
- min_dist += tdist * tdist;
- tdist = (x - maxc1) * C1_SCALE;
- max_dist += tdist * tdist;
- } else if (x > maxc1) {
- tdist = (x - maxc1) * C1_SCALE;
- min_dist += tdist * tdist;
- tdist = (x - minc1) * C1_SCALE;
- max_dist += tdist * tdist;
- } else {
- /* within cell range so no contribution to min_dist */
- if (x <= centerc1) {
- tdist = (x - maxc1) * C1_SCALE;
- max_dist += tdist * tdist;
- } else {
- tdist = (x - minc1) * C1_SCALE;
- max_dist += tdist * tdist;
- }
- }
-
-#ifdef ORIGINAL_LIB_JPEG
- x = GETJSAMPLE (cinfo->colormap[2][i]);
-#else
- x = im->blue[i];
-#endif
- if (x < minc2) {
- tdist = (x - minc2) * C2_SCALE;
- min_dist += tdist * tdist;
- tdist = (x - maxc2) * C2_SCALE;
- max_dist += tdist * tdist;
- } else if (x > maxc2) {
- tdist = (x - maxc2) * C2_SCALE;
- min_dist += tdist * tdist;
- tdist = (x - minc2) * C2_SCALE;
- max_dist += tdist * tdist;
- } else {
- /* within cell range so no contribution to min_dist */
- if (x <= centerc2) {
- tdist = (x - maxc2) * C2_SCALE;
- max_dist += tdist * tdist;
- } else {
- tdist = (x - minc2) * C2_SCALE;
- max_dist += tdist * tdist;
- }
- }
-
- mindist[i] = min_dist; /* save away the results */
- if (max_dist < minmaxdist)
- minmaxdist = max_dist;
- }
-
- /* Now we know that no cell in the update box is more than minmaxdist
- * away from some colormap entry. Therefore, only colors that are
- * within minmaxdist of some part of the box need be considered.
- */
- ncolors = 0;
- for (i = 0; i < numcolors; i++) {
- if (mindist[i] <= minmaxdist) {
- colorlist[ncolors++] = (JSAMPLE) i;
- }
- }
- return ncolors;
-}
-
-
-LOCAL (void) find_best_colors (
-#ifdef ORIGINAL_LIB_JPEG
- j_decompress_ptr cinfo,
-#else
- gdImagePtr im, my_cquantize_ptr cquantize,
-#endif
- int minc0, int minc1, int minc2,
- int numcolors, JSAMPLE colorlist[],
- JSAMPLE bestcolor[])
-/* Find the closest colormap entry for each cell in the update box,
- * given the list of candidate colors prepared by find_nearby_colors.
- * Return the indexes of the closest entries in the bestcolor[] array.
- * This routine uses Thomas' incremental distance calculation method to
- * find the distance from a colormap entry to successive cells in the box.
- */
-{
- int ic0, ic1, ic2;
- int i, icolor;
- register INT32 *bptr; /* pointer into bestdist[] array */
- JSAMPLE *cptr; /* pointer into bestcolor[] array */
- INT32 dist0, dist1; /* initial distance values */
- register INT32 dist2; /* current distance in inner loop */
- INT32 xx0, xx1; /* distance increments */
- register INT32 xx2;
- INT32 inc0, inc1, inc2; /* initial values for increments */
- /* This array holds the distance to the nearest-so-far color for each cell */
- INT32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS];
-
- /* Initialize best-distance for each cell of the update box */
- bptr = bestdist;
- for (i = BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS - 1; i >= 0; i--) {
- *bptr++ = 0x7FFFFFFFL;
- }
-
- /* For each color selected by find_nearby_colors,
- * compute its distance to the center of each cell in the box.
- * If that's less than best-so-far, update best distance and color number.
- */
-
- /* Nominal steps between cell centers ("x" in Thomas article) */
-#define STEP_C0 ((1 << C0_SHIFT) * C0_SCALE)
-#define STEP_C1 ((1 << C1_SHIFT) * C1_SCALE)
-#define STEP_C2 ((1 << C2_SHIFT) * C2_SCALE)
-
- for (i = 0; i < numcolors; i++) {
- int r, g, b;
-#ifdef ORIGINAL_LIB_JPEG
- icolor = GETJSAMPLE(colorlist[i]);
- r = GETJSAMPLE(cinfo->colormap[0][icolor]);
- g = GETJSAMPLE(cinfo->colormap[1][icolor]);
- b = GETJSAMPLE(cinfo->colormap[2][icolor]);
-#else
- icolor = colorlist[i];
- r = im->red[icolor];
- g = im->green[icolor];
- b = im->blue[icolor];
-#endif
-
- /* Compute (square of) distance from minc0/c1/c2 to this color */
- inc0 = (minc0 - r) * C0_SCALE;
- dist0 = inc0 * inc0;
- inc1 = (minc1 - g) * C1_SCALE;
- dist0 += inc1 * inc1;
- inc2 = (minc2 - b) * C2_SCALE;
- dist0 += inc2 * inc2;
- /* Form the initial difference increments */
- inc0 = inc0 * (2 * STEP_C0) + STEP_C0 * STEP_C0;
- inc1 = inc1 * (2 * STEP_C1) + STEP_C1 * STEP_C1;
- inc2 = inc2 * (2 * STEP_C2) + STEP_C2 * STEP_C2;
- /* Now loop over all cells in box, updating distance per Thomas method */
- bptr = bestdist;
- cptr = bestcolor;
- xx0 = inc0;
- for (ic0 = BOX_C0_ELEMS - 1; ic0 >= 0; ic0--) {
- dist1 = dist0;
- xx1 = inc1;
- for (ic1 = BOX_C1_ELEMS - 1; ic1 >= 0; ic1--) {
- dist2 = dist1;
- xx2 = inc2;
- for (ic2 = BOX_C2_ELEMS - 1; ic2 >= 0; ic2--) {
- if (dist2 < *bptr) {
- *bptr = dist2;
- *cptr = (JSAMPLE) icolor;
- }
- dist2 += xx2;
- xx2 += 2 * STEP_C2 * STEP_C2;
- bptr++;
- cptr++;
- }
- dist1 += xx1;
- xx1 += 2 * STEP_C1 * STEP_C1;
- }
- dist0 += xx0;
- xx0 += 2 * STEP_C0 * STEP_C0;
- }
- }
-}
-
-
-LOCAL (void)
-fill_inverse_cmap (
-#ifdef ORIGINAL_LIB_JPEG
- j_decompress_ptr cinfo,
-#else
- gdImagePtr im, my_cquantize_ptr cquantize,
-#endif
- int c0, int c1, int c2)
-/* Fill the inverse-colormap entries in the update box that contains */
-/* histogram cell c0/c1/c2. (Only that one cell MUST be filled, but */
-/* we can fill as many others as we wish.) */
-{
-#ifdef ORIGINAL_LIB_JPEG
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
-#endif
- hist3d histogram = cquantize->histogram;
- int minc0, minc1, minc2; /* lower left corner of update box */
- int ic0, ic1, ic2;
- register JSAMPLE *cptr; /* pointer into bestcolor[] array */
- register histptr cachep; /* pointer into main cache array */
- /* This array lists the candidate colormap indexes. */
- JSAMPLE colorlist[MAXNUMCOLORS];
- int numcolors; /* number of candidate colors */
- /* This array holds the actually closest colormap index for each cell. */
- JSAMPLE bestcolor[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS];
-
- /* Convert cell coordinates to update box ID */
- c0 >>= BOX_C0_LOG;
- c1 >>= BOX_C1_LOG;
- c2 >>= BOX_C2_LOG;
-
- /* Compute true coordinates of update box's origin corner.
- * Actually we compute the coordinates of the center of the corner
- * histogram cell, which are the lower bounds of the volume we care about.
- */
- minc0 = (c0 << BOX_C0_SHIFT) + ((1 << C0_SHIFT) >> 1);
- minc1 = (c1 << BOX_C1_SHIFT) + ((1 << C1_SHIFT) >> 1);
- minc2 = (c2 << BOX_C2_SHIFT) + ((1 << C2_SHIFT) >> 1);
-
- /* Determine which colormap entries are close enough to be candidates
- * for the nearest entry to some cell in the update box.
- */
-#ifdef ORIGINAL_LIB_JPEG
- numcolors = find_nearby_colors(cinfo, minc0, minc1, minc2, colorlist);
-
- /* Determine the actually nearest colors. */
- find_best_colors(cinfo, minc0, minc1, minc2, numcolors, colorlist, bestcolor);
-#else
- numcolors = find_nearby_colors(im, cquantize, minc0, minc1, minc2, colorlist);
- find_best_colors(im, cquantize, minc0, minc1, minc2, numcolors, colorlist, bestcolor);
-#endif
-
- /* Save the best color numbers (plus 1) in the main cache array */
- c0 <<= BOX_C0_LOG; /* convert ID back to base cell indexes */
- c1 <<= BOX_C1_LOG;
- c2 <<= BOX_C2_LOG;
- cptr = bestcolor;
- for (ic0 = 0; ic0 < BOX_C0_ELEMS; ic0++) {
- for (ic1 = 0; ic1 < BOX_C1_ELEMS; ic1++) {
- cachep = &histogram[c0 + ic0][c1 + ic1][c2];
- for (ic2 = 0; ic2 < BOX_C2_ELEMS; ic2++) {
-#ifdef ORIGINAL_LIB_JPEG
- *cachep++ = (histcell) (GETJSAMPLE (*cptr++) + 1);
-#else
- *cachep++ = (histcell) ((*cptr++) + 1);
-#endif
- }
- }
- }
-}
-
-
-/*
- * Map some rows of pixels to the output colormapped representation.
- */
-
-METHODDEF (void)
-#ifndef ORIGINAL_LIB_JPEG
-pass2_no_dither (gdImagePtr im, my_cquantize_ptr cquantize)
-{
- register int *inptr;
- register unsigned char *outptr;
- int width = im->sx;
- int num_rows = im->sy;
-#else
-pass2_no_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
-/* This version performs no dithering */
-{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
- register JSAMPROW inptr, outptr;
- JDIMENSION width = cinfo->output_width;
-#endif
- hist3d histogram = cquantize->histogram;
- register int c0, c1, c2;
- int row;
- JDIMENSION col;
- register histptr cachep;
-
-
- for (row = 0; row < num_rows; row++) {
- inptr = input_buf[row];
- outptr = output_buf[row];
- for (col = width; col > 0; col--){
- /* get pixel value and index into the cache */
- int r, g, b;
-#ifdef ORIGINAL_LIB_JPEG
- r = GETJSAMPLE(*inptr++);
- g = GETJSAMPLE(*inptr++);
- b = GETJSAMPLE(*inptr++);
-#else
- r = gdTrueColorGetRed(*inptr);
- g = gdTrueColorGetGreen(*inptr);
- b = gdTrueColorGetBlue(*inptr++);
-
- /* If the pixel is transparent, we assign it the palette index that
- * will later be added at the end of the palette as the transparent
- * index.
- */
- if ((im->transparent >= 0) && (im->transparent == *inptr)) {
- *outptr++ = im->colorsTotal;
- continue;
- }
-#endif
- c0 = r >> C0_SHIFT;
- c1 = g >> C1_SHIFT;
- c2 = b >> C2_SHIFT;
- cachep = &histogram[c0][c1][c2];
- /* If we have not seen this color before, find nearest colormap entry
- * and update the cache
- */
- if (*cachep == 0) {
-#ifdef ORIGINAL_LIB_JPEG
- fill_inverse_cmap(cinfo, c0, c1, c2);
-#else
- fill_inverse_cmap(im, cquantize, c0, c1, c2);
-#endif
- }
- /* Now emit the colormap index for this cell */
-#ifdef ORIGINAL_LIB_JPEG
- *outptr++ = (JSAMPLE) (*cachep - 1);
-#else
- *outptr++ = (*cachep - 1);
-#endif
- }
- }
-}
-
-
-METHODDEF (void)
-#ifndef ORIGINAL_LIB_JPEG
-pass2_fs_dither (gdImagePtr im, my_cquantize_ptr cquantize)
-{
-#else
-pass2_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
-/* This version performs Floyd-Steinberg dithering */
-{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
- JSAMPROW inptr; /* => current input pixel */
-#endif
- hist3d histogram = cquantize->histogram;
- register LOCFSERROR cur0, cur1, cur2; /* current error or pixel value */
- LOCFSERROR belowerr0, belowerr1, belowerr2; /* error for pixel below cur */
- LOCFSERROR bpreverr0, bpreverr1, bpreverr2; /* error for below/prev col */
- register FSERRPTR errorptr; /* => fserrors[] at column before current */
- histptr cachep;
- int dir; /* +1 or -1 depending on direction */
- int dir3; /* 3*dir, for advancing inptr & errorptr */
- int row;
- JDIMENSION col;
-#ifdef ORIGINAL_LIB_JPEG
- JSAMPROW outptr; /* => current output pixel */
- JDIMENSION width = cinfo->output_width;
- JSAMPLE *range_limit = cinfo->sample_range_limit;
- JSAMPROW colormap0 = cinfo->colormap[0];
- JSAMPROW colormap1 = cinfo->colormap[1];
- JSAMPROW colormap2 = cinfo->colormap[2];
-#else
- int *inptr; /* => current input pixel */
- unsigned char *outptr; /* => current output pixel */
- int width = im->sx;
- int num_rows = im->sy;
- int *colormap0 = im->red;
- int *colormap1 = im->green;
- int *colormap2 = im->blue;
-#endif
- int *error_limit = cquantize->error_limiter;
-
-
- SHIFT_TEMPS for (row = 0; row < num_rows; row++) {
- inptr = input_buf[row];
- outptr = output_buf[row];
- if (cquantize->on_odd_row) {
- /* work right to left in this row */
- inptr += (width - 1) * 3; /* so point to rightmost pixel */
- outptr += width - 1;
- dir = -1;
- dir3 = -3;
- errorptr = cquantize->fserrors + (width + 1) * 3; /* => entry after last column */
-#ifdef ORIGINAL_LIB_JPEG_REVERSE_ODD_ROWS
- cquantize->on_odd_row = FALSE; /* flip for next time */
-#endif
- } else {
- /* work left to right in this row */
- dir = 1;
- dir3 = 3;
- errorptr = cquantize->fserrors; /* => entry before first real column */
-#ifdef ORIGINAL_LIB_JPEG_REVERSE_ODD_ROWS
- cquantize->on_odd_row = TRUE; /* flip for next time */
-#endif
- }
- /* Preset error values: no error propagated to first pixel from left */
- cur0 = cur1 = cur2 = 0;
- /* and no error propagated to row below yet */
- belowerr0 = belowerr1 = belowerr2 = 0;
- bpreverr0 = bpreverr1 = bpreverr2 = 0;
-
- for (col = width; col > 0; col--) {
- /* If this pixel is transparent, we want to assign it to the special
- * transparency color index past the end of the palette rather than
- * go through matching / dithering. */
- if ((im->transparent >= 0) && (*inptr == im->transparent)) {
- *outptr = im->colorsTotal;
- errorptr[0] = 0;
- errorptr[1] = 0;
- errorptr[2] = 0;
- errorptr[3] = 0;
- inptr += dir;
- outptr += dir;
- errorptr += dir3;
- continue;
- }
- /* curN holds the error propagated from the previous pixel on the
- * current line. Add the error propagated from the previous line
- * to form the complete error correction term for this pixel, and
- * round the error term (which is expressed * 16) to an integer.
- * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct
- * for either sign of the error value.
- * Note: errorptr points to *previous* column's array entry.
- */
- cur0 = RIGHT_SHIFT (cur0 + errorptr[dir3 + 0] + 8, 4);
- cur1 = RIGHT_SHIFT (cur1 + errorptr[dir3 + 1] + 8, 4);
- cur2 = RIGHT_SHIFT (cur2 + errorptr[dir3 + 2] + 8, 4);
- /* Limit the error using transfer function set by init_error_limit.
- * See comments with init_error_limit for rationale.
- */
- cur0 = error_limit[cur0];
- cur1 = error_limit[cur1];
- cur2 = error_limit[cur2];
- /* Form pixel value + error, and range-limit to 0..MAXJSAMPLE.
- * The maximum error is +- MAXJSAMPLE (or less with error limiting);
- * this sets the required size of the range_limit array.
- */
-#ifdef ORIGINAL_LIB_JPEG
- cur0 += GETJSAMPLE (inptr[0]);
- cur1 += GETJSAMPLE (inptr[1]);
- cur2 += GETJSAMPLE (inptr[2]);
- cur0 = GETJSAMPLE (range_limit[cur0]);
- cur1 = GETJSAMPLE (range_limit[cur1]);
- cur2 = GETJSAMPLE (range_limit[cur2]);
-#else
- cur0 += gdTrueColorGetRed (*inptr);
- cur1 += gdTrueColorGetGreen (*inptr);
- cur2 += gdTrueColorGetBlue (*inptr);
- range_limit (cur0);
- range_limit (cur1);
- range_limit (cur2);
-#endif
-
- /* Index into the cache with adjusted pixel value */
- cachep = &histogram[cur0 >> C0_SHIFT][cur1 >> C1_SHIFT][cur2 >> C2_SHIFT];
- /* If we have not seen this color before, find nearest colormap */
- /* entry and update the cache */
- if (*cachep == 0) {
-#ifdef ORIGINAL_LIB_JPEG
- fill_inverse_cmap(cinfo, cur0 >> C0_SHIFT, cur1 >> C1_SHIFT, cur2 >> C2_SHIFT);
-#else
- fill_inverse_cmap(im, cquantize, cur0 >> C0_SHIFT, cur1 >> C1_SHIFT, cur2 >> C2_SHIFT);
-#endif
- }
- /* Now emit the colormap index for this cell */
- {
- register int pixcode = *cachep - 1;
- *outptr = (JSAMPLE) pixcode;
- /* Compute representation error for this pixel */
-#define GETJSAMPLE
- cur0 -= GETJSAMPLE(colormap0[pixcode]);
- cur1 -= GETJSAMPLE(colormap1[pixcode]);
- cur2 -= GETJSAMPLE(colormap2[pixcode]);
-#undef GETJSAMPLE
- }
- /* Compute error fractions to be propagated to adjacent pixels.
- * Add these into the running sums, and simultaneously shift the
- * next-line error sums left by 1 column.
- */
- {
- register LOCFSERROR bnexterr, delta;
-
- bnexterr = cur0; /* Process component 0 */
- delta = cur0 * 2;
- cur0 += delta; /* form error * 3 */
- errorptr[0] = (FSERROR) (bpreverr0 + cur0);
- cur0 += delta; /* form error * 5 */
- bpreverr0 = belowerr0 + cur0;
- belowerr0 = bnexterr;
- cur0 += delta; /* form error * 7 */
- bnexterr = cur1; /* Process component 1 */
- delta = cur1 * 2;
- cur1 += delta; /* form error * 3 */
- errorptr[1] = (FSERROR) (bpreverr1 + cur1);
- cur1 += delta; /* form error * 5 */
- bpreverr1 = belowerr1 + cur1;
- belowerr1 = bnexterr;
- cur1 += delta; /* form error * 7 */
- bnexterr = cur2; /* Process component 2 */
- delta = cur2 * 2;
- cur2 += delta; /* form error * 3 */
- errorptr[2] = (FSERROR) (bpreverr2 + cur2);
- cur2 += delta; /* form error * 5 */
- bpreverr2 = belowerr2 + cur2;
- belowerr2 = bnexterr;
- cur2 += delta; /* form error * 7 */
- }
- /* At this point curN contains the 7/16 error value to be propagated
- * to the next pixel on the current line, and all the errors for the
- * next line have been shifted over. We are therefore ready to move on.
- */
-#ifdef ORIGINAL_LIB_JPEG
- inptr += dir3; /* Advance pixel pointers to next column */
-#else
- inptr += dir; /* Advance pixel pointers to next column */
-#endif
- outptr += dir;
- errorptr += dir3; /* advance errorptr to current column */
- }
- /* Post-loop cleanup: we must unload the final error values into the
- * final fserrors[] entry. Note we need not unload belowerrN because
- * it is for the dummy column before or after the actual array.
- */
- errorptr[0] = (FSERROR) bpreverr0; /* unload prev errs into array */
- errorptr[1] = (FSERROR) bpreverr1;
- errorptr[2] = (FSERROR) bpreverr2;
- }
-}
-
-
-/*
- * Initialize the error-limiting transfer function (lookup table).
- * The raw F-S error computation can potentially compute error values of up to
- * +- MAXJSAMPLE. But we want the maximum correction applied to a pixel to be
- * much less, otherwise obviously wrong pixels will be created. (Typical
- * effects include weird fringes at color-area boundaries, isolated bright
- * pixels in a dark area, etc.) The standard advice for avoiding this problem
- * is to ensure that the "corners" of the color cube are allocated as output
- * colors; then repeated errors in the same direction cannot cause cascading
- * error buildup. However, that only prevents the error from getting
- * completely out of hand; Aaron Giles reports that error limiting improves
- * the results even with corner colors allocated.
- * A simple clamping of the error values to about +- MAXJSAMPLE/8 works pretty
- * well, but the smoother transfer function used below is even better. Thanks
- * to Aaron Giles for this idea.
- */
-
-LOCAL (void)
-#ifdef ORIGINAL_LIB_JPEG
-init_error_limit (j_decompress_ptr cinfo)
-#else
-init_error_limit (gdImagePtr im, my_cquantize_ptr cquantize)
-#endif
-/* Allocate and fill in the error_limiter table */
-{
- int *table;
- int in, out;
-#ifdef ORIGINAL_LIB_JPEG
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
- table = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE * 2 + 1) * SIZEOF (int));
-#else
- cquantize->error_limiter_storage = (int *) gdMalloc ((MAXJSAMPLE * 2 + 1) * sizeof (int));
- if (!cquantize->error_limiter_storage) {
- return;
- }
- table = cquantize->error_limiter_storage;
-#endif
-
- table += MAXJSAMPLE; /* so can index -MAXJSAMPLE .. +MAXJSAMPLE */
- cquantize->error_limiter = table;
-
-#define STEPSIZE ((MAXJSAMPLE+1)/16)
- /* Map errors 1:1 up to +- MAXJSAMPLE/16 */
- out = 0;
- for (in = 0; in < STEPSIZE; in++, out++){
- table[in] = out;
- table[-in] = -out;
- }
- /* Map errors 1:2 up to +- 3*MAXJSAMPLE/16 */
- for (; in < STEPSIZE * 3; in++, out += (in & 1) ? 0 : 1) {
- table[in] = out;
- table[-in] = -out;
- }
- /* Clamp the rest to final out value (which is (MAXJSAMPLE+1)/8) */
- for (; in <= MAXJSAMPLE; in++) {
- table[in] = out;
- table[-in] = -out;
- }
-#undef STEPSIZE
-}
-
-
-/*
- * Finish up at the end of each pass.
- */
-
-#ifdef ORIGINAL_LIB_JPEG
-METHODDEF (void) finish_pass1 (j_decompress_ptr cinfo)
-{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
-
- /* Select the representative colors and fill in cinfo->colormap */
- cinfo->colormap = cquantize->sv_colormap;
- select_colors (cinfo, cquantize->desired);
- /* Force next pass to zero the color index table */
- cquantize->needs_zeroed = TRUE;
-}
-
-
-METHODDEF (void) finish_pass2 (j_decompress_ptr cinfo)
-{
- /* no work */
-}
-
-/*
- * Initialize for each processing pass.
- */
-
-METHODDEF (void) start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
-{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
- hist3d histogram = cquantize->histogram;
- int i;
-
- /* Only F-S dithering or no dithering is supported. */
- /* If user asks for ordered dither, give him F-S. */
- if (cinfo->dither_mode != JDITHER_NONE) {
- cinfo->dither_mode = JDITHER_FS;
- }
-
- if (is_pre_scan){
- /* Set up method pointers */
- cquantize->pub.color_quantize = prescan_quantize;
- cquantize->pub.finish_pass = finish_pass1;
- cquantize->needs_zeroed = TRUE; /* Always zero histogram */
- } else {
- /* Set up method pointers */
- if (cinfo->dither_mode == JDITHER_FS) {
- cquantize->pub.color_quantize = pass2_fs_dither;
- } else {
- cquantize->pub.color_quantize = pass2_no_dither;
- }
- cquantize->pub.finish_pass = finish_pass2;
-
- /* Make sure color count is acceptable */
- i = cinfo->actual_number_of_colors;
- if (i < 1) {
- ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 1);
- }
- if (i > MAXNUMCOLORS) {
- ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);
- }
-
- if (cinfo->dither_mode == JDITHER_FS) {
- size_t arraysize = (size_t) ((cinfo->output_width + 2) * (3 * SIZEOF (FSERROR)));
- /* Allocate Floyd-Steinberg workspace if we didn't already. */
- if (cquantize->fserrors == NULL) {
- cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize);
- }
- /* Initialize the propagated errors to zero. */
- jzero_far((void FAR *) cquantize->fserrors, arraysize);
- /* Make the error-limit table if we didn't already. */
- if (cquantize->error_limiter == NULL) {
- init_error_limit(cinfo);
- }
- cquantize->on_odd_row = FALSE;
- }
-
- }
- /* Zero the histogram or inverse color map, if necessary */
- if (cquantize->needs_zeroed) {
- for (i = 0; i < HIST_C0_ELEMS; i++) {
- jzero_far((void FAR *) histogram[i], HIST_C1_ELEMS * HIST_C2_ELEMS * SIZEOF (histcell));
- }
- cquantize->needs_zeroed = FALSE;
- }
-}
-
-
-/*
- * Switch to a new external colormap between output passes.
- */
-
-METHODDEF (void) new_color_map_2_quant (j_decompress_ptr cinfo)
-{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
-
- /* Reset the inverse color map */
- cquantize->needs_zeroed = TRUE;
-}
-#else
-static void zeroHistogram (hist3d histogram)
-{
- int i;
- /* Zero the histogram or inverse color map */
- for (i = 0; i < HIST_C0_ELEMS; i++) {
- memset (histogram[i], 0, HIST_C1_ELEMS * HIST_C2_ELEMS * sizeof (histcell));
- }
-}
-#endif
-
-/*
- * Module initialization routine for 2-pass color quantization.
- */
-
-#ifdef ORIGINAL_LIB_JPEG
-GLOBAL (void)
-jinit_2pass_quantizer (j_decompress_ptr cinfo)
-#else
-void
-gdImageTrueColorToPalette (gdImagePtr im, int dither, int colorsWanted)
-#endif
-{
- my_cquantize_ptr cquantize = NULL;
- int i;
-
-#ifndef ORIGINAL_LIB_JPEG
- /* Allocate the JPEG palette-storage */
- size_t arraysize;
- int maxColors = gdMaxColors;
- if (!im->trueColor) {
- /* Nothing to do! */
- return;
- }
-
- /* If we have a transparent color (the alphaless mode of transparency), we
- * must reserve a palette entry for it at the end of the palette. */
- if (im->transparent >= 0){
- maxColors--;
- }
- if (colorsWanted > maxColors) {
- colorsWanted = maxColors;
- }
- im->pixels = gdCalloc(sizeof (unsigned char *), im->sy);
- for (i = 0; (i < im->sy); i++) {
- im->pixels[i] = gdCalloc(sizeof (unsigned char *), im->sx);
- }
-#endif
-
-#ifdef ORIGINAL_LIB_JPEG
- cquantize = (my_cquantize_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF (my_cquantizer));
- cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize;
- cquantize->pub.start_pass = start_pass_2_quant;
- cquantize->pub.new_color_map = new_color_map_2_quant;
- /* Make sure jdmaster didn't give me a case I can't handle */
- if (cinfo->out_color_components != 3) {
- ERREXIT (cinfo, JERR_NOTIMPL);
- }
-#else
- cquantize = (my_cquantize_ptr) gdCalloc(sizeof (my_cquantizer), 1);
-#endif
- cquantize->fserrors = NULL; /* flag optional arrays not allocated */
- cquantize->error_limiter = NULL;
-
- /* Allocate the histogram/inverse colormap storage */
-#ifdef ORIGINAL_LIB_JPEG
- cquantize->histogram = (hist3d) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * SIZEOF (hist2d));
- for (i = 0; i < HIST_C0_ELEMS; i++) {
- cquantize->histogram[i] = (hist2d) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, HIST_C1_ELEMS * HIST_C2_ELEMS * SIZEOF (histcell));
- }
- cquantize->needs_zeroed = TRUE; /* histogram is garbage now */
-#else
- cquantize->histogram = (hist3d) gdMalloc (HIST_C0_ELEMS * sizeof (hist2d));
- for (i = 0; i < HIST_C0_ELEMS; i++) {
- cquantize->histogram[i] = (hist2d) gdMalloc(HIST_C1_ELEMS * HIST_C2_ELEMS * sizeof (histcell));
- }
-#endif
-
-#ifdef ORIGINAL_LIB_JPEG
- /* Allocate storage for the completed colormap, if required.
- * We do this now since it is FAR storage and may affect
- * the memory manager's space calculations.
- */
- if (cinfo->enable_2pass_quant) {
- /* Make sure color count is acceptable */
- int desired = cinfo->desired_number_of_colors;
- /* Lower bound on # of colors ... somewhat arbitrary as long as > 0 */
- if (desired < 8) {
- ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 8);
- }
- /* Make sure colormap indexes can be represented by JSAMPLEs */
- if (desired > MAXNUMCOLORS) {
- ERREXIT1 (cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);
- }
- cquantize->sv_colormap = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) desired, (JDIMENSION) 3);
- cquantize->desired = desired;
- } else {
- cquantize->sv_colormap = NULL;
- }
-
- /* Only F-S dithering or no dithering is supported. */
- /* If user asks for ordered dither, give him F-S. */
- if (cinfo->dither_mode != JDITHER_NONE) {
- cinfo->dither_mode = JDITHER_FS;
- }
-
- /* Allocate Floyd-Steinberg workspace if necessary.
- * This isn't really needed until pass 2, but again it is FAR storage.
- * Although we will cope with a later change in dither_mode,
- * we do not promise to honor max_memory_to_use if dither_mode changes.
- */
- if (cinfo->dither_mode == JDITHER_FS) {
- cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, (size_t) ((cinfo->output_width + 2) * (3 * SIZEOF (FSERROR))));
- /* Might as well create the error-limiting table too. */
- init_error_limit(cinfo);
- }
-#else
-
- cquantize->fserrors = (FSERRPTR) gdMalloc(3 * sizeof (FSERROR));
- init_error_limit (im, cquantize);
- arraysize = (size_t) ((im->sx + 2) * (3 * sizeof (FSERROR)));
- gdFree(cquantize->fserrors);
- /* Allocate Floyd-Steinberg workspace. */
- cquantize->fserrors = gdCalloc(arraysize, 1);
- cquantize->on_odd_row = FALSE;
-
- /* Do the work! */
- zeroHistogram(cquantize->histogram);
- prescan_quantize(im, cquantize);
- /* TBB 2.0.5: pass colorsWanted, not 256! */
- select_colors(im, cquantize, colorsWanted);
- zeroHistogram(cquantize->histogram);
- if (dither) {
- pass2_fs_dither(im, cquantize);
- } else {
- pass2_no_dither(im, cquantize);
- }
-#if 0 /* 2.0.12; we no longer attempt full alpha in palettes */
- if (cquantize->transparentIsPresent) {
- int mt = -1;
- int mtIndex = -1;
- for (i = 0; (i < im->colorsTotal); i++) {
- if (im->alpha[i] > mt) {
- mtIndex = i;
- mt = im->alpha[i];
- }
- }
- for (i = 0; (i < im->colorsTotal); i++) {
- if (im->alpha[i] == mt) {
- im->alpha[i] = gdAlphaTransparent;
- }
- }
- }
- if (cquantize->opaqueIsPresent) {
- int mo = 128;
- int moIndex = -1;
- for (i = 0; (i < im->colorsTotal); i++) {
- if (im->alpha[i] < mo) {
- moIndex = i;
- mo = im->alpha[i];
- }
- }
- for (i = 0; (i < im->colorsTotal); i++) {
- if (im->alpha[i] == mo) {
- im->alpha[i] = gdAlphaOpaque;
- }
- }
- }
-#endif
-
- /* If we had a 'transparent' color, increment the color count so it's
- * officially in the palette and convert the transparent variable to point to
- * an index rather than a color (Its data already exists and transparent
- * pixels have already been mapped to it by this point, it is done late as to
- * avoid color matching / dithering with it). */
- if (im->transparent >= 0) {
- im->transparent = im->colorsTotal;
- im->colorsTotal++;
- }
-
- /* Success! Get rid of the truecolor image data. */
- im->trueColor = 0;
- /* Junk the truecolor pixels */
- for (i = 0; i < im->sy; i++) {
- gdFree(im->tpixels[i]);
- }
- gdFree(im->tpixels);
- im->tpixels = 0;
- /* Tediously free stuff. */
-
- if (im->trueColor) {
- /* On failure only */
- for (i = 0; i < im->sy; i++) {
- if (im->pixels[i]) {
- gdFree (im->pixels[i]);
- }
- }
- if (im->pixels) {
- gdFree (im->pixels);
- }
- im->pixels = 0;
- }
-
- for (i = 0; i < HIST_C0_ELEMS; i++) {
- if (cquantize->histogram[i]) {
- gdFree(cquantize->histogram[i]);
- }
- }
- if (cquantize->histogram) {
- gdFree(cquantize->histogram);
- }
- if (cquantize->fserrors) {
- gdFree(cquantize->fserrors);
- }
- if (cquantize->error_limiter_storage) {
- gdFree(cquantize->error_limiter_storage);
- }
- if (cquantize) {
- gdFree(cquantize);
- }
-#endif
-}
-
-/* bring the palette colors in im2 to be closer to im1
- *
- */
-int gdImageColorMatch (gdImagePtr im1, gdImagePtr im2)
-{
- unsigned long *buf; /* stores our calculations */
- unsigned long *bp; /* buf ptr */
- int color, rgb;
- int x,y;
- int count;
-
- if( !im1->trueColor ) {
- return -1; /* im1 must be True Color */
- }
- if( im2->trueColor ) {
- return -2; /* im2 must be indexed */
- }
- if( (im1->sx != im2->sx) || (im1->sy != im2->sy) ) {
- return -3; /* the images are meant to be the same dimensions */
- }
-
- buf = (unsigned long *)gdMalloc( sizeof(unsigned long) * 5 * im2->colorsTotal );
- memset( buf, 0, sizeof(unsigned long) * 5 * im2->colorsTotal );
-
- for (x=0; x<im1->sx; x++) {
- for( y=0; y<im1->sy; y++ ) {
- color = im2->pixels[y][x];
- rgb = im1->tpixels[y][x];
- bp = buf + (color * 5);
- (*(bp++))++;
- *(bp++) += gdTrueColorGetRed(rgb);
- *(bp++) += gdTrueColorGetGreen(rgb);
- *(bp++) += gdTrueColorGetBlue(rgb);
- *(bp++) += gdTrueColorGetAlpha(rgb);
- }
- }
- bp = buf;
- for (color=0; color<im2->colorsTotal; color++) {
- count = *(bp++);
- if( count > 0 ) {
- im2->red[color] = *(bp++) / count;
- im2->green[color] = *(bp++) / count;
- im2->blue[color] = *(bp++) / count;
- im2->alpha[color] = *(bp++) / count;
- } else {
- bp += 4;
- }
- }
- gdFree(buf);
- return 0;
-}
-
-
-#endif
diff --git a/ext/gd/libgd/gd_wbmp.c b/ext/gd/libgd/gd_wbmp.c
deleted file mode 100644
index 7307d6f9e9..0000000000
--- a/ext/gd/libgd/gd_wbmp.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- WBMP: Wireless Bitmap Type 0: B/W, Uncompressed Bitmap
- Specification of the WBMP format can be found in the file:
- SPEC-WAESpec-19990524.pdf
- You can download the WAP specification on: http://www.wapforum.com/
-
- gd_wbmp.c
-
- Copyright (C) Johan Van den Brande (johan@vandenbrande.com)
-
- Fixed: gdImageWBMPPtr, gdImageWBMP
-
- Recoded: gdImageWBMPCtx for use with my wbmp library
- (wbmp library included, but you can find the latest distribution
- at http://www.vandenbrande.com/wbmp)
-
- Implemented: gdImageCreateFromWBMPCtx, gdImageCreateFromWBMP
-
- ---------------------------------------------------------------------------
-
- Parts of this code are from Maurice Smurlo.
-
-
- ** Copyright (C) Maurice Szmurlo --- T-SIT --- January 2000
- ** (Maurice.Szmurlo@info.unicaen.fr)
-
- ** Permission to use, copy, modify, and distribute this software and its
- ** documentation for any purpose and without fee is hereby granted, provided
- ** that the above copyright notice appear in all copies and that both that
- ** copyright notice and this permission notice appear in supporting
- ** documentation. This software is provided "as is" without express or
- ** implied warranty.
-
- ---------------------------------------------------------------------------
- Parts od this code are inspired by 'pbmtowbmp.c' and 'wbmptopbm.c' by
- Terje Sannum <terje@looplab.com>.
- **
- ** Permission to use, copy, modify, and distribute this software and its
- ** documentation for any purpose and without fee is hereby granted, provided
- ** that the above copyright notice appear in all copies and that both that
- ** copyright notice and this permission notice appear in supporting
- ** documentation. This software is provided "as is" without express or
- ** implied warranty.
- **
- ---------------------------------------------------------------------------
-
- Todo:
-
- gdCreateFromWBMP function for reading WBMP files
-
- ----------------------------------------------------------------------------
- */
-
-#include <gd.h>
-#include <gdfonts.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <limits.h>
-
-#include "wbmp.h"
-
-
-/* gd_putout
- ** ---------
- ** Wrapper around gdPutC for use with writewbmp
- **
- */
-void gd_putout (int i, void *out)
-{
- gdPutC(i, (gdIOCtx *) out);
-}
-
-
-/* gd_getin
- ** --------
- ** Wrapper around gdGetC for use with readwbmp
- **
- */
-int gd_getin (void *in)
-{
- return (gdGetC((gdIOCtx *) in));
-}
-
-
-/* gdImageWBMPCtx
- ** --------------
- ** Write the image as a wbmp file
- ** Parameters are:
- ** image: gd image structure;
- ** fg: the index of the foreground color. any other value will be
- ** considered as background and will not be written
- ** out: the stream where to write
- */
-void gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out)
-{
- int x, y, pos;
- Wbmp *wbmp;
-
- /* create the WBMP */
- if ((wbmp = createwbmp (gdImageSX (image), gdImageSY (image), WBMP_WHITE)) == NULL) {
- php_gd_error("Could not create WBMP\n");
- }
-
- /* fill up the WBMP structure */
- pos = 0;
- for (y = 0; y < gdImageSY(image); y++) {
- for (x = 0; x < gdImageSX(image); x++) {
- if (gdImageGetPixel (image, x, y) == fg) {
- wbmp->bitmap[pos] = WBMP_BLACK;
- }
- pos++;
- }
- }
-
- /* write the WBMP to a gd file descriptor */
- if (writewbmp (wbmp, &gd_putout, out)) {
- php_gd_error("Could not save WBMP\n");
- }
- /* des submitted this bugfix: gdFree the memory. */
- freewbmp(wbmp);
-}
-
-/* gdImageCreateFromWBMPCtx
- ** ------------------------
- ** Create a gdImage from a WBMP file input from an gdIOCtx
- */
-gdImagePtr gdImageCreateFromWBMPCtx (gdIOCtx * infile)
-{
- /* FILE *wbmp_file; */
- Wbmp *wbmp;
- gdImagePtr im = NULL;
- int black, white;
- int col, row, pos;
-
- if (readwbmp (&gd_getin, infile, &wbmp)) {
- return NULL;
- }
-
- if (!(im = gdImageCreate (wbmp->width, wbmp->height))) {
- freewbmp (wbmp);
- return NULL;
- }
-
- /* create the background color */
- white = gdImageColorAllocate(im, 255, 255, 255);
- /* create foreground color */
- black = gdImageColorAllocate(im, 0, 0, 0);
-
- /* fill in image (in a wbmp 1 = white/ 0 = black) */
- pos = 0;
- for (row = 0; row < wbmp->height; row++) {
- for (col = 0; col < wbmp->width; col++) {
- if (wbmp->bitmap[pos++] == WBMP_WHITE) {
- gdImageSetPixel(im, col, row, white);
- } else {
- gdImageSetPixel(im, col, row, black);
- }
- }
- }
-
- freewbmp(wbmp);
-
- return im;
-}
-
-/* gdImageCreateFromWBMP
- ** ---------------------
- */
-gdImagePtr gdImageCreateFromWBMP (FILE * inFile)
-{
- gdImagePtr im;
- gdIOCtx *in = gdNewFileCtx(inFile);
- im = gdImageCreateFromWBMPCtx(in);
- in->gd_free(in);
-
- return im;
-}
-
-/* gdImageWBMP
- ** -----------
- */
-void gdImageWBMP (gdImagePtr im, int fg, FILE * outFile)
-{
- gdIOCtx *out = gdNewFileCtx(outFile);
- gdImageWBMPCtx(im, fg, out);
- out->gd_free(out);
-}
-
-/* gdImageWBMPPtr
- ** --------------
- */
-void * gdImageWBMPPtr (gdImagePtr im, int *size, int fg)
-{
- void *rv;
- gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
- gdImageWBMPCtx(im, fg, out);
- rv = gdDPExtractData(out, size);
- out->gd_free(out);
-
- return rv;
-}
diff --git a/ext/gd/libgd/gdcache.c b/ext/gd/libgd/gdcache.c
deleted file mode 100644
index e2219c0cbd..0000000000
--- a/ext/gd/libgd/gdcache.c
+++ /dev/null
@@ -1,214 +0,0 @@
-#include "gd.h"
-#include "gdhelpers.h"
-
-#ifdef HAVE_LIBTTF
-#define NEED_CACHE 1
-#else
-#ifdef HAVE_LIBFREETYPE
-#define NEED_CACHE 1
-#endif
-#endif
-
-#ifdef NEED_CACHE
-
-/*
- * gdcache.c
- *
- * Caches of pointers to user structs in which the least-recently-used
- * element is replaced in the event of a cache miss after the cache has
- * reached a given size.
- *
- * John Ellson (ellson@graphviz.org) Oct 31, 1997
- *
- * Test this with:
- * gcc -o gdcache -g -Wall -DTEST gdcache.c
- *
- * The cache is implemented by a singly-linked list of elements
- * each containing a pointer to a user struct that is being managed by
- * the cache.
- *
- * The head structure has a pointer to the most-recently-used
- * element, and elements are moved to this position in the list each
- * time they are used. The head also contains pointers to three
- * user defined functions:
- * - a function to test if a cached userdata matches some keydata
- * - a function to provide a new userdata struct to the cache
- * if there has been a cache miss.
- * - a function to release a userdata struct when it is
- * no longer being managed by the cache
- *
- * In the event of a cache miss the cache is allowed to grow up to
- * a specified maximum size. After the maximum size is reached then
- * the least-recently-used element is discarded to make room for the
- * new. The most-recently-returned value is always left at the
- * beginning of the list after retrieval.
- *
- * In the current implementation the cache is traversed by a linear
- * search from most-recent to least-recent. This linear search
- * probably limits the usefulness of this implementation to cache
- * sizes of a few tens of elements.
- */
-
-#include "gdcache.h"
-
-/*********************************************************/
-/* implementation */
-/*********************************************************/
-
-
-/* create a new cache */
-gdCache_head_t *
-gdCacheCreate (
- int size,
- gdCacheTestFn_t gdCacheTest,
- gdCacheFetchFn_t gdCacheFetch,
- gdCacheReleaseFn_t gdCacheRelease)
-{
- gdCache_head_t *head;
-
- head = (gdCache_head_t *) gdPMalloc(sizeof (gdCache_head_t));
- head->mru = NULL;
- head->size = size;
- head->gdCacheTest = gdCacheTest;
- head->gdCacheFetch = gdCacheFetch;
- head->gdCacheRelease = gdCacheRelease;
- return head;
-}
-
-void
-gdCacheDelete (gdCache_head_t * head)
-{
- gdCache_element_t *elem, *prev;
-
- elem = head->mru;
- while (elem)
- {
- (*(head->gdCacheRelease)) (elem->userdata);
- prev = elem;
- elem = elem->next;
- gdPFree ((char *) prev);
- }
- gdPFree ((char *) head);
-}
-
-void *
-gdCacheGet (gdCache_head_t * head, void *keydata)
-{
- int i = 0;
- gdCache_element_t *elem, *prev = NULL, *prevprev = NULL;
- void *userdata;
-
- elem = head->mru;
- while (elem)
- {
- if ((*(head->gdCacheTest)) (elem->userdata, keydata))
- {
- if (i)
- { /* if not already most-recently-used */
- /* relink to top of list */
- prev->next = elem->next;
- elem->next = head->mru;
- head->mru = elem;
- }
- return elem->userdata;
- }
- prevprev = prev;
- prev = elem;
- elem = elem->next;
- i++;
- }
- userdata = (*(head->gdCacheFetch)) (&(head->error), keydata);
- if (!userdata)
- {
- /* if there was an error in the fetch then don't cache */
- return NULL;
- }
- if (i < head->size)
- { /* cache still growing - add new elem */
- elem = (gdCache_element_t *) gdPMalloc(sizeof (gdCache_element_t));
- }
- else
- { /* cache full - replace least-recently-used */
- /* preveprev becomes new end of list */
- prevprev->next = NULL;
- elem = prev;
- (*(head->gdCacheRelease)) (elem->userdata);
- }
- /* relink to top of list */
- elem->next = head->mru;
- head->mru = elem;
- elem->userdata = userdata;
- return userdata;
-}
-
-
-
-/*********************************************************/
-/* test stub */
-/*********************************************************/
-
-
-#ifdef TEST
-
-#include <stdio.h>
-
-typedef struct
-{
- int key;
- int value;
-}
-key_value_t;
-
-static int
-cacheTest (void *map, void *key)
-{
- return (((key_value_t *) map)->key == *(int *) key);
-}
-
-static void *
-cacheFetch (char **error, void *key)
-{
- key_value_t *map;
-
- map = (key_value_t *) gdMalloc (sizeof (key_value_t));
- map->key = *(int *) key;
- map->value = 3;
-
- *error = NULL;
- return (void *) map;
-}
-
-static void
-cacheRelease (void *map)
-{
- gdFree ((char *) map);
-}
-
-int
-main (char *argv[], int argc)
-{
- gdCache_head_t *cacheTable;
- int elem, key;
-
- cacheTable = gdCacheCreate (3, cacheTest, cacheFetch, cacheRelease);
-
- key = 20;
- elem = *(int *) gdCacheGet (cacheTable, &key);
- key = 30;
- elem = *(int *) gdCacheGet (cacheTable, &key);
- key = 40;
- elem = *(int *) gdCacheGet (cacheTable, &key);
- key = 50;
- elem = *(int *) gdCacheGet (cacheTable, &key);
- key = 30;
- elem = *(int *) gdCacheGet (cacheTable, &key);
- key = 30;
- elem = *(int *) gdCacheGet (cacheTable, &key);
-
- gdCacheDelete (cacheTable);
-
- return 0;
-}
-
-#endif /* TEST */
-#endif /* HAVE_LIBTTF */
diff --git a/ext/gd/libgd/gdcache.h b/ext/gd/libgd/gdcache.h
deleted file mode 100644
index 45d037475d..0000000000
--- a/ext/gd/libgd/gdcache.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * gdcache.h
- *
- * Caches of pointers to user structs in which the least-recently-used
- * element is replaced in the event of a cache miss after the cache has
- * reached a given size.
- *
- * John Ellson (ellson@graphviz.org) Oct 31, 1997
- *
- * Test this with:
- * gcc -o gdcache -g -Wall -DTEST gdcache.c
- *
- * The cache is implemented by a singly-linked list of elements
- * each containing a pointer to a user struct that is being managed by
- * the cache.
- *
- * The head structure has a pointer to the most-recently-used
- * element, and elements are moved to this position in the list each
- * time they are used. The head also contains pointers to three
- * user defined functions:
- * - a function to test if a cached userdata matches some keydata
- * - a function to provide a new userdata struct to the cache
- * if there has been a cache miss.
- * - a function to release a userdata struct when it is
- * no longer being managed by the cache
- *
- * In the event of a cache miss the cache is allowed to grow up to
- * a specified maximum size. After the maximum size is reached then
- * the least-recently-used element is discarded to make room for the
- * new. The most-recently-returned value is always left at the
- * beginning of the list after retrieval.
- *
- * In the current implementation the cache is traversed by a linear
- * search from most-recent to least-recent. This linear search
- * probably limits the usefulness of this implementation to cache
- * sizes of a few tens of elements.
- */
-
-/*********************************************************/
-/* header */
-/*********************************************************/
-
-#include <stdlib.h>
-#ifdef HAVE_MALLOC_H
- #include <malloc.h>
-#endif
-#ifndef NULL
-#define NULL (void *)0
-#endif
-
-/* user defined function templates */
-typedef int (*gdCacheTestFn_t)(void *userdata, void *keydata);
-typedef void *(*gdCacheFetchFn_t)(char **error, void *keydata);
-typedef void (*gdCacheReleaseFn_t)(void *userdata);
-
-/* element structure */
-typedef struct gdCache_element_s gdCache_element_t;
-struct gdCache_element_s {
- gdCache_element_t *next;
- void *userdata;
-};
-
-/* head structure */
-typedef struct gdCache_head_s gdCache_head_t;
-struct gdCache_head_s {
- gdCache_element_t *mru;
- int size;
- char *error;
- gdCacheTestFn_t gdCacheTest;
- gdCacheFetchFn_t gdCacheFetch;
- gdCacheReleaseFn_t gdCacheRelease;
-};
-
-/* function templates */
-gdCache_head_t *
-gdCacheCreate(
- int size,
- gdCacheTestFn_t gdCacheTest,
- gdCacheFetchFn_t gdCacheFetch,
- gdCacheReleaseFn_t gdCacheRelease );
-
-void
-gdCacheDelete( gdCache_head_t *head );
-
-void *
-gdCacheGet( gdCache_head_t *head, void *keydata );
diff --git a/ext/gd/libgd/gddemo.c b/ext/gd/libgd/gddemo.c
deleted file mode 100644
index a5ceeb53b8..0000000000
--- a/ext/gd/libgd/gddemo.c
+++ /dev/null
@@ -1,118 +0,0 @@
-#include <stdio.h>
-#include "gd.h"
-#include "gdfontg.h"
-#include "gdfonts.h"
-
-int
-main (void)
-{
- /* Input and output files */
- FILE *in;
- FILE *out;
-
- /* Input and output images */
- gdImagePtr im_in = 0, im_out = 0;
-
- /* Brush image */
- gdImagePtr brush;
-
- /* Color indexes */
- int white;
- int blue;
- int red;
- int green;
-
- /* Points for polygon */
- gdPoint points[3];
-
- /* Create output image, 256 by 256 pixels, true color. */
- im_out = gdImageCreateTrueColor (256, 256);
- /* First color allocated is background. */
- white = gdImageColorAllocate (im_out, 255, 255, 255);
-
- /* Set transparent color. */
- gdImageColorTransparent (im_out, white);
-
- /* Try to load demoin.png and paste part of it into the
- output image. */
- in = fopen ("demoin.png", "rb");
- if (!in)
- {
- fprintf (stderr, "Can't load source image; this demo\n");
- fprintf (stderr, "is much more impressive if demoin.png\n");
- fprintf (stderr, "is available.\n");
- im_in = 0;
- }
- else
- {
- im_in = gdImageCreateFromPng (in);
- fclose (in);
- /* Now copy, and magnify as we do so */
- gdImageCopyResized (im_out, im_in,
- 32, 32, 0, 0, 192, 192, 255, 255);
- }
- red = gdImageColorAllocate (im_out, 255, 0, 0);
- green = gdImageColorAllocate (im_out, 0, 255, 0);
- blue = gdImageColorAllocate (im_out, 0, 0, 255);
- /* Rectangle */
- gdImageLine (im_out, 16, 16, 240, 16, green);
- gdImageLine (im_out, 240, 16, 240, 240, green);
- gdImageLine (im_out, 240, 240, 16, 240, green);
- gdImageLine (im_out, 16, 240, 16, 16, green);
- /* Circle */
- gdImageArc (im_out, 128, 128, 60, 20, 0, 720, blue);
- /* Arc */
- gdImageArc (im_out, 128, 128, 40, 40, 90, 270, blue);
- /* Flood fill: doesn't do much on a continuously
- variable tone jpeg original. */
- gdImageFill (im_out, 8, 8, blue);
- /* Polygon */
- points[0].x = 64;
- points[0].y = 0;
- points[1].x = 0;
- points[1].y = 128;
- points[2].x = 128;
- points[2].y = 128;
- gdImageFilledPolygon (im_out, points, 3, green);
- /* Brush. A fairly wild example also involving a line style! */
- if (im_in)
- {
- int style[8];
- brush = gdImageCreateTrueColor (16, 16);
- gdImageCopyResized (brush, im_in,
- 0, 0, 0, 0,
- gdImageSX (brush), gdImageSY (brush),
- gdImageSX (im_in), gdImageSY (im_in));
- gdImageSetBrush (im_out, brush);
- /* With a style, so they won't overprint each other.
- Normally, they would, yielding a fat-brush effect. */
- style[0] = 0;
- style[1] = 0;
- style[2] = 0;
- style[3] = 0;
- style[4] = 0;
- style[5] = 0;
- style[6] = 0;
- style[7] = 1;
- gdImageSetStyle (im_out, style, 8);
- /* Draw the styled, brushed line */
- gdImageLine (im_out, 0, 255, 255, 0, gdStyledBrushed);
- }
- /* Text */
- gdImageString (im_out, gdFontGiant, 32, 32,
- (unsigned char *) "hi", red);
- gdImageStringUp (im_out, gdFontSmall, 64, 64,
- (unsigned char *) "hi", red);
- /* Make output image interlaced (progressive, in the case of JPEG) */
- gdImageInterlace (im_out, 1);
- out = fopen ("demoout.png", "wb");
- /* Write PNG */
- gdImagePng (im_out, out);
- fclose (out);
- gdImageDestroy (im_out);
- if (im_in)
- {
- gdImageDestroy (im_in);
- }
- return 0;
-}
diff --git a/ext/gd/libgd/gdfontg.c b/ext/gd/libgd/gdfontg.c
deleted file mode 100644
index fd0c1e0929..0000000000
--- a/ext/gd/libgd/gdfontg.c
+++ /dev/null
@@ -1,4384 +0,0 @@
-
-
-/*
- This is a header file for gd font, generated using
- bdftogd version 0.51 by Jan Pazdziora, adelton@fi.muni.cz
- from bdf font
- -Misc-Fixed-Bold-R-Normal-Sans-15-140-75-75-C-90-ISO8859-2
- at Mon Jan 26 14:45:58 1998.
- The original bdf was holding following copyright:
- "Libor Skarvada, libor@informatics.muni.cz"
- */
-
-
-#include "gdfontg.h"
-
-char gdFontGiantData[] =
-{
-/* Char 0 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 1 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 2 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 1, 0, 1, 0,
-
-/* Char 3 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 4 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 5 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 6 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 7 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 8 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 9 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 10 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 11 */
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 12 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
-
-/* Char 13 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
-
-/* Char 14 */
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 15 */
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
-
-/* Char 16 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 17 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 18 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 19 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 20 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 21 */
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
-
-/* Char 22 */
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
-
-/* Char 23 */
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 24 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
-
-/* Char 25 */
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
-
-/* Char 26 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 27 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 28 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 29 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 30 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0, 0,
- 1, 0, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 31 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 32 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 33 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 34 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 35 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 36 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 37 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 38 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0, 1, 0,
- 1, 1, 0, 0, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 39 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 40 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 41 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 42 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 43 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 44 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 45 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 46 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 47 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 48 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 49 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 50 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 51 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 52 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 53 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 1, 0, 0, 0,
- 1, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 54 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 1, 0, 0, 0,
- 1, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 55 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 56 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 57 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 58 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 59 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 60 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 61 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 62 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 63 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 64 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 65 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 66 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 67 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 68 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 69 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 70 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 71 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 72 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 73 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 74 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 75 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 76 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 77 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 0, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 78 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 79 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 80 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 81 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 82 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 83 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 84 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 85 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 86 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 87 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 0, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 88 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 89 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 90 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 91 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 92 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 93 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 94 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 95 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 96 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 97 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 98 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 1, 0, 0, 0,
- 1, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 99 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 100 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 101 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 102 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 103 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
-
-/* Char 104 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 1, 0, 0, 0,
- 1, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 105 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 106 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0, 0,
-
-/* Char 107 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 108 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 109 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 110 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 1, 0, 0, 0,
- 1, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 111 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 112 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 1, 0, 0, 0,
- 1, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 113 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
-
-/* Char 114 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 115 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 116 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 117 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 118 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 119 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 120 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 121 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 1, 0,
- 1, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
-
-/* Char 122 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 123 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 124 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 125 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 126 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 127 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 128 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 129 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 130 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 131 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 132 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 133 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 134 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 135 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 136 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 137 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 138 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 139 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 140 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 141 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 142 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 143 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 144 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 145 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 146 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 147 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 148 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 149 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 150 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 151 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 152 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 153 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 154 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 155 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 156 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 157 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 158 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 159 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 160 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 161 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
-
-/* Char 162 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 163 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 164 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 165 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 166 */
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 167 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 168 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 169 */
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 170 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0, 0, 0,
-
-/* Char 171 */
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 172 */
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 173 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 174 */
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 175 */
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 176 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 177 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 1,
-
-/* Char 178 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
-
-/* Char 179 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 1, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 180 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 181 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 182 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 183 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 184 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
-
-/* Char 185 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 186 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0, 0, 0,
-
-/* Char 187 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 188 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 189 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 190 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 191 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 192 */
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 193 */
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 194 */
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 195 */
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 196 */
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 197 */
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 198 */
- 0, 0, 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 199 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
-
-/* Char 200 */
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 201 */
- 0, 0, 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 202 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 1, 0,
-
-/* Char 203 */
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 204 */
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 205 */
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 206 */
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 207 */
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 208 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 209 */
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 210 */
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 211 */
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 212 */
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 213 */
- 0, 0, 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 214 */
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 215 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 216 */
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 217 */
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 218 */
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 219 */
- 0, 0, 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 220 */
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 221 */
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 222 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
-
-/* Char 223 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 224 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 225 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 226 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 227 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 228 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 229 */
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 230 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 231 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
-
-/* Char 232 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 233 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 234 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 1, 0,
-
-/* Char 235 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 236 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 237 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 238 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 239 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 1, 1,
- 0, 0, 0, 0, 0, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 240 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 241 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 1, 0, 0, 0,
- 1, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 242 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 1, 0, 0, 0,
- 1, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 243 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 244 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 245 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 246 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 247 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 248 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 249 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 250 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 251 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 252 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 253 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 1, 0,
- 1, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0,
-
-/* Char 254 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0, 0,
-
-/* Char 255 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-
-};
-
-gdFont gdFontGiantRep =
-{
- 256,
- 0,
- 9,
- 15,
- gdFontGiantData
-};
-
-gdFontPtr gdFontGiant = &gdFontGiantRep;
-
-/* This file has not been truncated. */
diff --git a/ext/gd/libgd/gdfontg.h b/ext/gd/libgd/gdfontg.h
deleted file mode 100644
index a70f266d63..0000000000
--- a/ext/gd/libgd/gdfontg.h
+++ /dev/null
@@ -1,29 +0,0 @@
-
-#ifndef _GDFONTG_H_
-#define _GDFONTG_H_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- This is a header file for gd font, generated using
- bdftogd version 0.51 by Jan Pazdziora, adelton@fi.muni.cz
- from bdf font
- -Misc-Fixed-Bold-R-Normal-Sans-15-140-75-75-C-90-ISO8859-2
- at Mon Jan 26 14:45:58 1998.
- The original bdf was holding following copyright:
- "Libor Skarvada, libor@informatics.muni.cz"
- */
-
-
-#include "gd.h"
-
-extern gdFontPtr gdFontGiant;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/ext/gd/libgd/gdfontl.c b/ext/gd/libgd/gdfontl.c
deleted file mode 100644
index e5d65d8fa8..0000000000
--- a/ext/gd/libgd/gdfontl.c
+++ /dev/null
@@ -1,4641 +0,0 @@
-
-
-/*
- This is a header file for gd font, generated using
- bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz
- from bdf font
- -misc-fixed-medium-r-normal--16-140-75-75-c-80-iso8859-2
- at Tue Jan 6 19:39:27 1998.
-
- The original bdf was holding following copyright:
- "Libor Skarvada, libor@informatics.muni.cz"
- */
-
-
-#include "gdfontl.h"
-
-char gdFontLargeData[] =
-{
-/* Char 0 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 1 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 2 */
- 1, 0, 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 1, 0, 1,
-
-/* Char 3 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0, 0, 0,
- 1, 0, 0, 0, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0,
- 1, 0, 0, 0, 1, 0, 0, 0,
- 1, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 4 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 5 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0, 1, 0,
- 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 6 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 7 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 8 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 9 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0, 0, 0,
- 1, 1, 0, 0, 1, 0, 0, 0,
- 1, 0, 1, 0, 1, 0, 0, 0,
- 1, 0, 0, 1, 1, 0, 0, 0,
- 1, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 10 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0, 0, 0,
- 1, 0, 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 11 */
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 12 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
-
-/* Char 13 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 1,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
-
-/* Char 14 */
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 15 */
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
-
-/* Char 16 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 17 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 18 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 19 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 20 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 21 */
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 1,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
-
-/* Char 22 */
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
-
-/* Char 23 */
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 24 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
-
-/* Char 25 */
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
-
-/* Char 26 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 27 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 28 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 1, 0, 1, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 29 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 30 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 1, 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 31 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 32 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 33 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 34 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 35 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 36 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 37 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 1, 0, 1, 0, 0,
- 0, 1, 1, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 1, 1, 0, 0,
- 0, 1, 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 38 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0, 1, 0,
- 1, 0, 0, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 39 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 40 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 41 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 42 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 43 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 44 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 45 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 46 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 47 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 48 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 49 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 50 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 51 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 52 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 53 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 54 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 55 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 56 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 57 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 58 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 59 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 60 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 61 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 62 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 63 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 64 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 65 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 66 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 67 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 68 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 69 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 70 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 71 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 72 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 73 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 74 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 75 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 76 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 77 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 1, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 78 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 1, 0, 1, 0,
- 0, 1, 0, 0, 1, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 79 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 80 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 81 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 1, 0, 1, 0,
- 0, 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 82 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 83 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 84 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 85 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 86 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 87 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 88 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 89 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 90 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 91 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 92 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 93 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 94 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 95 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 96 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 97 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 98 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 99 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 100 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 101 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 102 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 103 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
-
-/* Char 104 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 105 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 106 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
-
-/* Char 107 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 108 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 109 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 110 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 111 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 112 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
-
-/* Char 113 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
-
-/* Char 114 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 115 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 116 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 117 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 118 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 119 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 120 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 121 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
-
-/* Char 122 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 123 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 124 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 125 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 126 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 127 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 128 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 129 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 130 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 131 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 132 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 133 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 134 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 135 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 136 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 137 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 138 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 139 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 140 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 141 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 142 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 143 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 144 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 145 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 146 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 147 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 148 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 149 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 150 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 151 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 152 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 153 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 154 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 155 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 156 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 157 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 158 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 159 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 160 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 161 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0,
-
-/* Char 162 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 163 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 164 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 165 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 166 */
- 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 167 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 168 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 169 */
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 170 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
-
-/* Char 171 */
- 0, 0, 1, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 172 */
- 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 173 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 174 */
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 175 */
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 176 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 177 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0,
-
-/* Char 178 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 0,
-
-/* Char 179 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 180 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 181 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 182 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 183 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 184 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
-
-/* Char 185 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 186 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
-
-/* Char 187 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 188 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 189 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 190 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 191 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 192 */
- 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 193 */
- 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 194 */
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 195 */
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 196 */
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 197 */
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 198 */
- 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 199 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
-
-/* Char 200 */
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 201 */
- 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 202 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0,
-
-/* Char 203 */
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 204 */
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 205 */
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 206 */
- 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 207 */
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 208 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 209 */
- 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 1, 0, 1, 0,
- 0, 1, 0, 0, 1, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 210 */
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 1, 0, 1, 0,
- 0, 1, 0, 0, 1, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 211 */
- 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 212 */
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 213 */
- 0, 0, 0, 1, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 214 */
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 215 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 216 */
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 217 */
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 218 */
- 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 219 */
- 0, 0, 0, 1, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 220 */
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 221 */
- 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 222 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
-
-/* Char 223 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 1, 1, 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 224 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 225 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 226 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 227 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 228 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 229 */
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 230 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 231 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
-
-/* Char 232 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 233 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 234 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0,
-
-/* Char 235 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 236 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 237 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 238 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 239 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 1,
- 0, 0, 0, 0, 0, 1, 0, 1,
- 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 240 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 241 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 242 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 243 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 244 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 245 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 1,
- 0, 0, 0, 1, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 246 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 247 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 248 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 249 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 250 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 251 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 1,
- 0, 0, 0, 1, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 252 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 253 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0, 0,
-
-/* Char 254 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0,
-
-/* Char 255 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
-
-};
-
-gdFont gdFontLargeRep =
-{
- 256,
- 0,
- 8,
- 16,
- gdFontLargeData
-};
-
-gdFontPtr gdFontLarge = &gdFontLargeRep;
-
-/* This file has not been truncated. */
diff --git a/ext/gd/libgd/gdfontl.h b/ext/gd/libgd/gdfontl.h
deleted file mode 100644
index d79f4771fd..0000000000
--- a/ext/gd/libgd/gdfontl.h
+++ /dev/null
@@ -1,30 +0,0 @@
-
-#ifndef _GDFONTL_H_
-#define _GDFONTL_H_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- This is a header file for gd font, generated using
- bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz
- from bdf font
- -misc-fixed-medium-r-normal--16-140-75-75-c-80-iso8859-2
- at Tue Jan 6 19:39:27 1998.
-
- The original bdf was holding following copyright:
- "Libor Skarvada, libor@informatics.muni.cz"
- */
-
-
-#include "gd.h"
-
-extern gdFontPtr gdFontLarge;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/ext/gd/libgd/gdfontmb.c b/ext/gd/libgd/gdfontmb.c
deleted file mode 100644
index 7a4f3b68ed..0000000000
--- a/ext/gd/libgd/gdfontmb.c
+++ /dev/null
@@ -1,3871 +0,0 @@
-
-
-/*
- This is a header file for gd font, generated using
- bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz
- from bdf font
- -misc-fixed-bold-r-normal-sans-13-94-100-100-c-70-iso8859-2
- at Thu Jan 8 13:54:57 1998.
- No copyright info was found in the original bdf.
- */
-
-
-#include "gdfontmb.h"
-
-char gdFontMediumBoldData[] =
-{
-/* Char 0 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 1 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 2 */
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 3 */
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 4 */
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 5 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 1, 0,
- 0, 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 6 */
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 7 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 8 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 9 */
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 10 */
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 11 */
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 12 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
-
-/* Char 13 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1,
- 0, 0, 1, 1, 1, 1, 1,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
-
-/* Char 14 */
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1,
- 0, 0, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 15 */
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
-
-/* Char 16 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 17 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 18 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 19 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 20 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 21 */
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1,
- 0, 0, 1, 1, 1, 1, 1,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
-
-/* Char 22 */
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
-
-/* Char 23 */
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 24 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
-
-/* Char 25 */
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
-
-/* Char 26 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 27 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 28 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 29 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 30 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 1, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 31 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 32 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 33 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 34 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 35 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 1, 0, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 1, 0, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 36 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 0, 1, 1, 0, 1, 0,
- 1, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 1, 0,
- 1, 0, 1, 1, 0, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 37 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0, 1, 0,
- 1, 0, 1, 0, 1, 1, 0,
- 1, 1, 1, 0, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 0, 1, 1, 1, 0,
- 1, 1, 0, 1, 0, 1, 0,
- 1, 0, 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 38 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 1, 0, 1, 0,
- 1, 1, 0, 1, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 0, 1, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 39 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 40 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 41 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 42 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 43 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 44 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 45 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 46 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 47 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 48 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 1, 0,
- 1, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 49 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 1, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 50 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 51 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 52 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 1, 1, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 53 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 54 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 55 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 56 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 57 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 58 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 59 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 60 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 61 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 62 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 63 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 64 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 1, 0,
- 1, 0, 1, 1, 1, 1, 0,
- 1, 0, 1, 0, 1, 1, 0,
- 1, 0, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 65 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 66 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 67 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 68 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 69 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 70 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 71 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 72 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 73 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 74 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 75 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 76 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 77 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 78 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 1, 1, 0,
- 1, 1, 1, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 1, 1, 1, 0,
- 1, 1, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 79 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 80 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 81 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 82 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 83 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 84 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 85 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 86 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 87 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 88 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 89 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 90 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 91 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 92 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 93 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 94 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 95 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 96 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 97 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 98 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 99 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 100 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 101 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 102 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 103 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
-
-/* Char 104 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 105 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 106 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
-
-/* Char 107 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 108 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 109 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 110 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 111 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 112 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
-
-/* Char 113 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
-
-/* Char 114 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 115 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 116 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 117 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 118 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 119 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 120 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 121 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
-
-/* Char 122 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 123 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 124 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 125 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 126 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 127 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 128 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 129 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 130 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 131 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 132 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 133 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 134 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 135 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 136 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 137 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 138 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 139 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 140 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 141 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 142 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 143 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 144 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 145 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 146 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 147 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 148 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 149 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 150 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 151 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 152 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 153 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 154 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 155 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 156 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 157 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 158 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 159 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 160 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 161 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
-
-/* Char 162 */
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 163 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 164 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 1, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 165 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 166 */
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 167 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 168 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 169 */
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 170 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
-
-/* Char 171 */
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 172 */
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 173 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 174 */
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 175 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 176 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 177 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
-
-/* Char 178 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
-
-/* Char 179 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 1, 0,
- 0, 0, 1, 1, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 1, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 180 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 181 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 1, 1, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 182 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 183 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 184 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
-
-/* Char 185 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 186 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
-
-/* Char 187 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 188 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 189 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 190 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 191 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 192 */
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 193 */
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 194 */
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 195 */
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 196 */
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 197 */
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 198 */
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 199 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
-
-/* Char 200 */
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 201 */
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 202 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
-
-/* Char 203 */
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 204 */
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 205 */
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 206 */
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 207 */
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 208 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 209 */
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 1, 1, 0,
- 1, 1, 1, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 1, 1, 1, 0,
- 1, 1, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 210 */
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 1, 1, 0,
- 1, 1, 1, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 1, 1, 1, 0,
- 1, 1, 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 211 */
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 212 */
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 213 */
- 0, 1, 1, 0, 0, 1, 1,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 214 */
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 215 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 216 */
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 217 */
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 218 */
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 219 */
- 0, 1, 1, 0, 0, 1, 1,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 220 */
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 221 */
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 222 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
-
-/* Char 223 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 1, 1, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 224 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 225 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 226 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 227 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 228 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 229 */
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 230 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 231 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
-
-/* Char 232 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 233 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 234 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0,
-
-/* Char 235 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 236 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 237 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 238 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 239 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1,
- 0, 0, 0, 1, 1, 0, 1,
- 0, 0, 0, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 1, 1, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 240 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 1, 1, 1,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 241 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 242 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 243 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 244 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 245 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 246 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 247 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 248 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 249 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 250 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 251 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 1, 1,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 252 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-/* Char 253 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 1, 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 1, 1, 0, 0,
-
-/* Char 254 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0,
-
-/* Char 255 */
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-
-
-};
-
-gdFont gdFontMediumBoldRep =
-{
- 256,
- 0,
- 7,
- 13,
- gdFontMediumBoldData
-};
-
-gdFontPtr gdFontMediumBold = &gdFontMediumBoldRep;
-
-/* This file has not been truncated. */
diff --git a/ext/gd/libgd/gdfontmb.h b/ext/gd/libgd/gdfontmb.h
deleted file mode 100644
index 0b3fbae113..0000000000
--- a/ext/gd/libgd/gdfontmb.h
+++ /dev/null
@@ -1,28 +0,0 @@
-
-#ifndef _GDFONTMB_H_
-#define _GDFONTMB_H_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- This is a header file for gd font, generated using
- bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz
- from bdf font
- -misc-fixed-bold-r-normal-sans-13-94-100-100-c-70-iso8859-2
- at Thu Jan 8 13:54:57 1998.
- No copyright info was found in the original bdf.
- */
-
-
-#include "gd.h"
-
-extern gdFontPtr gdFontMediumBold;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/ext/gd/libgd/gdfonts.c b/ext/gd/libgd/gdfonts.c
deleted file mode 100644
index eec0a3d71e..0000000000
--- a/ext/gd/libgd/gdfonts.c
+++ /dev/null
@@ -1,3871 +0,0 @@
-
-
-/*
- This is a header file for gd font, generated using
- bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz
- from bdf font
- -misc-fixed-medium-r-semicondensed-sans-12-116-75-75-c-60-iso8859-2
- at Thu Jan 8 14:13:20 1998.
- No copyright info was found in the original bdf.
- */
-
-
-#include "gdfonts.h"
-
-char gdFontSmallData[] =
-{
-/* Char 0 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 1 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 2 */
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1, 0,
-
-/* Char 3 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 1, 1, 1, 0, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 4 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 1, 1, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 5 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 6 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 7 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 8 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 9 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 10 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 11 */
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 12 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
-
-/* Char 13 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
-
-/* Char 14 */
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 15 */
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
-
-/* Char 16 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 17 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 18 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 19 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 20 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 21 */
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 1, 1, 1,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
-
-/* Char 22 */
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 1, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
-
-/* Char 23 */
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 24 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
-
-/* Char 25 */
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
-
-/* Char 26 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 27 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 28 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 29 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 30 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 1, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 31 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 32 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 33 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 34 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 35 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 36 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 1, 0,
- 1, 0, 1, 0, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 1, 0,
- 1, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 37 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 38 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 1, 0, 0, 1, 1, 0,
- 1, 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 39 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 40 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 41 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 42 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 1, 0, 1, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 43 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 44 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 45 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 46 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 47 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 48 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 49 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 50 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 51 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 52 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 53 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 54 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 55 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 56 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 57 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 58 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 59 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 60 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 61 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 62 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 63 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 64 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 65 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 66 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 67 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 68 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 69 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 70 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 71 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 72 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 73 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 74 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 75 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 1, 1, 1, 0, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 76 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 77 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 0, 1, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 78 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 79 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 80 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 81 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 82 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 83 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 84 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 85 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 86 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 87 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 88 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 89 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 90 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 91 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 92 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 93 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 94 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 95 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 96 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 97 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 98 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 99 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 100 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 101 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 102 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 103 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
-
-/* Char 104 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 105 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 106 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 0, 0,
-
-/* Char 107 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 108 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 109 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 0, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 110 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 111 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 112 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
-
-/* Char 113 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 0,
-
-/* Char 114 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 115 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 116 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 117 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 118 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 119 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 120 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 121 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 1, 1, 1, 0, 0, 0,
-
-/* Char 122 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 123 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 124 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 125 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 126 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 127 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 128 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 129 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 130 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 131 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 132 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 133 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 134 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 135 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 136 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 137 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 138 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 139 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 140 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 141 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 142 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 143 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 144 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 145 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 146 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 147 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 148 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 149 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 150 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 151 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 152 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 153 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 154 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 155 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 156 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 157 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 158 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 159 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 160 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 161 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 1,
-
-/* Char 162 */
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 163 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 164 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 165 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 166 */
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 167 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 168 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 169 */
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 170 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
-
-/* Char 171 */
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 172 */
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 173 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 174 */
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 175 */
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 176 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 177 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 1,
-
-/* Char 178 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
-
-/* Char 179 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 180 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 181 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1,
- 0, 1, 1, 0, 0, 1,
- 0, 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 182 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 183 */
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 184 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 0, 0,
-
-/* Char 185 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 186 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
-
-/* Char 187 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 188 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 189 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 1,
- 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 190 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 191 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 192 */
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 193 */
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 194 */
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 195 */
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 196 */
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 197 */
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 198 */
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 199 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 0, 0,
-
-/* Char 200 */
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 201 */
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 202 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
-
-/* Char 203 */
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 204 */
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 205 */
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 206 */
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 207 */
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 208 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 1, 0,
- 1, 1, 1, 0, 1, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 1, 0,
- 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 209 */
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 210 */
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 211 */
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 212 */
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 213 */
- 0, 0, 1, 0, 0, 1,
- 0, 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 214 */
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 215 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 216 */
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 1, 0, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 217 */
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 218 */
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 219 */
- 0, 0, 1, 0, 0, 1,
- 0, 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 220 */
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 221 */
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 222 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
-
-/* Char 223 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 224 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 225 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 226 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 227 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 228 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 229 */
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 230 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 231 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 0, 0,
-
-/* Char 232 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 233 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 234 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
-
-/* Char 235 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 236 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 237 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 238 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 239 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1,
- 0, 0, 0, 0, 0, 1,
- 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 1, 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 1, 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 240 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 1, 1,
- 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 241 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 242 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 243 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 244 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 245 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 246 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 247 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 248 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 249 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 250 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 251 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 252 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-/* Char 253 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0,
- 1, 1, 1, 0, 0, 0,
-
-/* Char 254 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 1, 0,
- 0, 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0,
-
-/* Char 255 */
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
-
-};
-
-gdFont gdFontSmallRep =
-{
- 256,
- 0,
- 6,
- 13,
- gdFontSmallData
-};
-
-gdFontPtr gdFontSmall = &gdFontSmallRep;
-
-/* This file has not been truncated. */
diff --git a/ext/gd/libgd/gdfonts.h b/ext/gd/libgd/gdfonts.h
deleted file mode 100644
index 3882bd2318..0000000000
--- a/ext/gd/libgd/gdfonts.h
+++ /dev/null
@@ -1,28 +0,0 @@
-
-#ifndef _GDFONTS_H_
-#define _GDFONTS_H_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- This is a header file for gd font, generated using
- bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz
- from bdf font
- -misc-fixed-medium-r-semicondensed-sans-12-116-75-75-c-60-iso8859-2
- at Thu Jan 8 14:13:20 1998.
- No copyright info was found in the original bdf.
- */
-
-
-#include "gd.h"
-
-extern gdFontPtr gdFontSmall;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/ext/gd/libgd/gdfontt.c b/ext/gd/libgd/gdfontt.c
deleted file mode 100644
index 9d0b73cf23..0000000000
--- a/ext/gd/libgd/gdfontt.c
+++ /dev/null
@@ -1,2592 +0,0 @@
-
-
-/*
- This is a header file for gd font, generated using
- bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz
- from bdf font
- -Misc-Fixed-Medium-R-Normal--8-80-75-75-C-50-ISO8859-2
- at Thu Jan 8 13:49:54 1998.
- The original bdf was holding following copyright:
- "Libor Skarvada, libor@informatics.muni.cz"
- */
-
-
-#include "gdfontt.h"
-
-char gdFontTinyData[] =
-{
-/* Char 0 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 1 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 1, 1, 1, 1,
- 0, 1, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 2 */
- 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 0,
- 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 0,
-
-/* Char 3 */
- 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 1, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 1, 1, 1,
- 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0,
-
-/* Char 4 */
- 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 0, 0, 0,
- 1, 0, 1, 1, 1,
- 1, 0, 1, 0, 0,
- 0, 0, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
-
-/* Char 5 */
- 0, 1, 1, 0, 0,
- 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0,
- 0, 0, 1, 0, 1,
- 0, 0, 1, 1, 0,
- 0, 0, 1, 0, 1,
-
-/* Char 6 */
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 1,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 0,
- 0, 0, 1, 0, 0,
-
-/* Char 7 */
- 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 8 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 9 */
- 1, 0, 0, 1, 0,
- 1, 1, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 1,
-
-/* Char 10 */
- 1, 0, 1, 0, 0,
- 1, 0, 1, 0, 0,
- 1, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 1, 1, 1,
- 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0,
-
-/* Char 11 */
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 12 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
-
-/* Char 13 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
-
-/* Char 14 */
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 1,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 15 */
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 1, 1, 1, 1, 1,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
-
-/* Char 16 */
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 17 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 18 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 19 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 20 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 21 */
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 1, 1,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
-
-/* Char 22 */
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
-
-/* Char 23 */
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 24 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
-
-/* Char 25 */
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
-
-/* Char 26 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 27 */
- 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 28 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1,
- 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 29 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0,
- 1, 1, 1, 1, 1,
- 0, 0, 1, 0, 0,
- 1, 1, 1, 1, 1,
- 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 30 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 1,
- 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 1,
- 1, 0, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 31 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 32 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 33 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 34 */
- 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 35 */
- 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 1, 1, 1, 1, 1,
- 0, 1, 0, 1, 0,
- 1, 1, 1, 1, 1,
- 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 36 */
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 1, 0, 1,
- 0, 1, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 37 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1,
- 1, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 1, 1,
- 1, 0, 0, 1, 1,
- 0, 0, 0, 0, 0,
-
-/* Char 38 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 1,
- 0, 0, 0, 0, 0,
-
-/* Char 39 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 40 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 41 */
- 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 42 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 43 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 1, 1, 1, 1, 1,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 44 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 45 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 46 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 47 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1,
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 48 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 49 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 50 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 51 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 52 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 1, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 53 */
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 54 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 1, 0, 0,
- 1, 1, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 55 */
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 56 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 57 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 58 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 59 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0,
- 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
-
-/* Char 60 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 61 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 62 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 63 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 64 */
- 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 1,
- 1, 0, 0, 1, 1,
- 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1,
- 1, 0, 0, 1, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 1, 1, 0,
-
-/* Char 65 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 66 */
- 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 67 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 68 */
- 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 69 */
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 70 */
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 71 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 72 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 73 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 74 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 75 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 0, 0,
- 1, 1, 0, 0, 0,
- 1, 0, 1, 0, 0,
- 1, 0, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 76 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 77 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 78 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 0, 1, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 1, 1, 0,
- 1, 0, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 79 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 80 */
- 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 81 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 0,
-
-/* Char 82 */
- 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 83 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 84 */
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 85 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 86 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 87 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 1, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 88 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 89 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1,
- 1, 0, 0, 0, 1,
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 90 */
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 91 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 92 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1,
- 0, 0, 0, 0, 0,
-
-/* Char 93 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 94 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 95 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1,
-
-/* Char 96 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 97 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 98 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 99 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 100 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 101 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 1, 1, 0,
- 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 102 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 1, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 103 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
-
-/* Char 104 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 105 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 106 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
-
-/* Char 107 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 108 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 109 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 0,
- 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1,
- 1, 0, 0, 0, 1,
- 0, 0, 0, 0, 0,
-
-/* Char 110 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 1, 0, 0,
- 1, 1, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 111 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 112 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
-
-/* Char 113 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0,
-
-/* Char 114 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 1, 0, 0,
- 1, 1, 0, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 115 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 116 */
- 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 117 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 118 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 119 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1,
- 1, 0, 1, 0, 1,
- 1, 0, 1, 0, 1,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 120 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 121 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
-
-/* Char 122 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 123 */
- 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 1, 1, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 124 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 125 */
- 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 126 */
- 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 127 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 128 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 129 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 130 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 131 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 132 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 133 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 134 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 135 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 136 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 137 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 138 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 139 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 140 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 141 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 142 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 143 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 144 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 145 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 146 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 147 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 148 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 149 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 150 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 151 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 152 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 153 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 154 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 155 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 156 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 157 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 158 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 159 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 160 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 161 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 0, 0, 1, 1,
-
-/* Char 162 */
- 1, 0, 0, 0, 1,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 163 */
- 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 1,
- 0, 0, 0, 0, 0,
-
-/* Char 164 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1,
- 0, 1, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 0, 1,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 165 */
- 0, 0, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 166 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 167 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0,
- 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
-
-/* Char 168 */
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 169 */
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 170 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0,
-
-/* Char 171 */
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 1, 1, 1, 1, 1,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 172 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 173 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 174 */
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 175 */
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 176 */
- 0, 0, 1, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 177 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 1, 1,
-
-/* Char 178 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 1, 1,
-
-/* Char 179 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 180 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 181 */
- 0, 0, 0, 1, 1,
- 1, 1, 0, 0, 1,
- 0, 1, 0, 1, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 182 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 183 */
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 184 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
-
-/* Char 185 */
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 186 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 1, 0, 0, 0,
- 0, 0, 1, 1, 0,
- 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0,
-
-/* Char 187 */
- 0, 0, 0, 1, 1,
- 0, 1, 0, 0, 1,
- 0, 1, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 188 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 189 */
- 0, 1, 0, 0, 1,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 190 */
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 191 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 192 */
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 193 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 194 */
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 195 */
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 196 */
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 197 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 198 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 199 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 1, 1, 0, 0, 0,
-
-/* Char 200 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 201 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 202 */
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 1,
-
-/* Char 203 */
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 204 */
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 205 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 206 */
- 0, 0, 1, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 207 */
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 208 */
- 0, 0, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 0, 1, 0, 1, 0,
- 1, 1, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 1, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 209 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 0, 1, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 210 */
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 0, 1, 0,
- 1, 1, 1, 1, 0,
- 1, 0, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 211 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 212 */
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 213 */
- 0, 1, 0, 0, 1,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 214 */
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 215 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 216 */
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 217 */
- 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 218 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 219 */
- 0, 1, 0, 0, 1,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 220 */
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 221 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 1,
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 222 */
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0,
-
-/* Char 223 */
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 1, 0, 1, 0,
- 1, 0, 1, 0, 0,
- 1, 0, 0, 0, 0,
-
-/* Char 224 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 1, 0, 0,
- 1, 1, 0, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 225 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 226 */
- 0, 0, 1, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 227 */
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 228 */
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 229 */
- 0, 0, 0, 0, 1,
- 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 230 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 231 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 1, 1, 0, 0,
-
-/* Char 232 */
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 233 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 1, 1, 0,
- 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 234 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 1, 1, 0,
- 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 1, 1,
-
-/* Char 235 */
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 1, 1, 0,
- 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 236 */
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 1, 1, 0,
- 1, 1, 0, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 237 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 238 */
- 0, 0, 1, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 239 */
- 0, 0, 0, 1, 1,
- 0, 0, 1, 0, 1,
- 0, 0, 1, 0, 1,
- 0, 1, 1, 0, 0,
- 1, 0, 1, 0, 0,
- 1, 0, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 240 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 1, 1,
- 0, 0, 0, 1, 0,
- 0, 1, 1, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 241 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 1, 0, 0,
- 1, 1, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 242 */
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 1, 0, 0,
- 1, 1, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 243 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 244 */
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 245 */
- 0, 1, 0, 0, 1,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 246 */
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 247 */
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 248 */
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 1, 0, 0,
- 1, 1, 0, 1, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 249 */
- 0, 1, 1, 0, 0,
- 0, 1, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 250 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 251 */
- 0, 1, 0, 0, 1,
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 252 */
- 1, 0, 0, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 1, 1, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0,
-
-/* Char 253 */
- 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0,
- 1, 0, 0, 1, 0,
- 0, 1, 1, 1, 0,
- 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0,
-
-/* Char 254 */
- 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 0, 0,
- 1, 1, 1, 0, 0,
- 0, 1, 0, 0, 0,
- 0, 1, 0, 1, 0,
- 0, 0, 1, 0, 0,
- 0, 1, 1, 0, 0,
-
-/* Char 255 */
- 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-
-
-};
-
-gdFont gdFontTinyRep =
-{
- 256,
- 0,
- 5,
- 8,
- gdFontTinyData
-};
-
-gdFontPtr gdFontTiny = &gdFontTinyRep;
-
-/* This file has not been truncated. */
diff --git a/ext/gd/libgd/gdfontt.h b/ext/gd/libgd/gdfontt.h
deleted file mode 100644
index 181ce5c5f0..0000000000
--- a/ext/gd/libgd/gdfontt.h
+++ /dev/null
@@ -1,29 +0,0 @@
-
-#ifndef _GDFONTT_H_
-#define _GDFONTT_H_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- This is a header file for gd font, generated using
- bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz
- from bdf font
- -Misc-Fixed-Medium-R-Normal--8-80-75-75-C-50-ISO8859-2
- at Thu Jan 8 13:49:54 1998.
- The original bdf was holding following copyright:
- "Libor Skarvada, libor@informatics.muni.cz"
- */
-
-
-#include "gd.h"
-
-extern gdFontPtr gdFontTiny;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c
deleted file mode 100644
index c31e6e5867..0000000000
--- a/ext/gd/libgd/gdft.c
+++ /dev/null
@@ -1,1093 +0,0 @@
-
-/********************************************/
-/* gd interface to freetype library */
-/* */
-/* John Ellson ellson@graphviz.org */
-/********************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "gd.h"
-#include "gdhelpers.h"
-
-#ifndef MSWIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#define R_OK 04 /* Needed in Windows */
-#endif
-
-#ifdef WIN32
-#define access _access
-#ifndef R_OK
-#define R_OK 2
-#endif
-#endif
-
-/* number of antialised colors for indexed bitmaps */
-/* overwrite Windows GDI define in case of windows build */
-#ifdef NUMCOLORS
-#undef NUMCOLORS
-#endif
-#define NUMCOLORS 8
-
-char *
-gdImageStringTTF (gdImage * im, int *brect, int fg, char *fontlist,
- double ptsize, double angle, int x, int y, char *string)
-{
- /* 2.0.6: valid return */
- return gdImageStringFT (im, brect, fg, fontlist, ptsize,
- angle, x, y, string);
-}
-
-#ifndef HAVE_LIBFREETYPE
-char *
-gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist,
- double ptsize, double angle, int x, int y, char *string,
- gdFTStringExtraPtr strex)
-{
- return "libgd was not built with FreeType font support\n";
-}
-
-char *
-gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
- double ptsize, double angle, int x, int y, char *string)
-{
- return "libgd was not built with FreeType font support\n";
-}
-#else
-
-#include "gdcache.h"
-#include "freetype/freetype.h"
-#include "freetype/ftglyph.h"
-
-/* number of fonts cached before least recently used is replaced */
-#define FONTCACHESIZE 6
-
-/* number of antialias color lookups cached */
-#define TWEENCOLORCACHESIZE 32
-
-/*
- * Line separation as a factor of font height.
- * No space between if LINESPACE = 1.00
- * Line separation will be rounded up to next pixel row.
- */
-#define LINESPACE 1.05
-
-/*
- * The character (space) used to separate alternate fonts in the
- * fontlist parameter to gdImageStringFT.
- */
-#define LISTSEPARATOR " "
-
-/*
- * DEFAULT_FONTPATH and PATHSEPARATOR are host type dependent and
- * are normally set by configure in config.h. These are just
- * some last resort values that might match some Un*x system
- * if building this version of gd separate from graphviz.
- */
-#ifndef DEFAULT_FONTPATH
-#define DEFAULT_FONTPATH "/usr/share/fonts/truetype"
-#endif
-#ifndef PATHSEPARATOR
-#define PATHSEPARATOR ":"
-#endif
-
-#ifndef TRUE
-#define FALSE 0
-#define TRUE !FALSE
-#endif
-
-#ifndef MAX
-#define MAX(a,b) ((a)>(b)?(a):(b))
-#endif
-
-#ifndef MIN
-#define MIN(a,b) ((a)<(b)?(a):(b))
-#endif
-
-typedef struct
-{
- char *fontlist; /* key */
- FT_Library *library;
- FT_Face face;
- FT_Bool have_char_map_unicode, have_char_map_big5, have_char_map_sjis,
- have_char_map_apple_roman;
- gdCache_head_t *glyphCache;
-}
-font_t;
-
-typedef struct
- {
- char *fontlist; /* key */
- FT_Library *library;
- }
-fontkey_t;
-
-typedef struct
- {
- int pixel; /* key */
- int bgcolor; /* key */
- int fgcolor; /* key *//* -ve means no antialias */
- gdImagePtr im; /* key */
- int tweencolor;
- }
-tweencolor_t;
-
-typedef struct
- {
- int pixel; /* key */
- int bgcolor; /* key */
- int fgcolor; /* key *//* -ve means no antialias */
- gdImagePtr im; /* key */
- }
-tweencolorkey_t;
-
-/********************************************************************
- * gdTcl_UtfToUniChar is borrowed from Tcl ...
- */
-/*
- * tclUtf.c --
- *
- * Routines for manipulating UTF-8 strings.
- *
- * Copyright (c) 1997-1998 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * SCCS: @(#) tclUtf.c 1.25 98/01/28 18:02:43
- */
-
-/*
- *---------------------------------------------------------------------------
- *
- * gdTcl_UtfToUniChar --
- *
- * Extract the Tcl_UniChar represented by the UTF-8 string. Bad
- * UTF-8 sequences are converted to valid Tcl_UniChars and processing
- * continues. Equivalent to Plan 9 chartorune().
- *
- * The caller must ensure that the source buffer is long enough that
- * this routine does not run off the end and dereference non-existent
- * memory looking for trail bytes. If the source buffer is known to
- * be '\0' terminated, this cannot happen. Otherwise, the caller
- * should call Tcl_UtfCharComplete() before calling this routine to
- * ensure that enough bytes remain in the string.
- *
- * Results:
- * *chPtr is filled with the Tcl_UniChar, and the return value is the
- * number of bytes from the UTF-8 string that were consumed.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-#ifdef JISX0208
-#include "jisx0208.h"
-#endif
-
-#define Tcl_UniChar int
-#define TCL_UTF_MAX 3
-static int
-gdTcl_UtfToUniChar (char *str, Tcl_UniChar * chPtr)
-/* str is the UTF8 next character pointer */
-/* chPtr is the int for the result */
-{
- int byte;
-
- /* HTML4.0 entities in decimal form, e.g. &#197; */
- byte = *((unsigned char *) str);
- if (byte == '&')
- {
- int i, n = 0;
-
- byte = *((unsigned char *) (str + 1));
- if (byte == '#')
- {
- for (i = 2; i < 8; i++)
- {
- byte = *((unsigned char *) (str + i));
- if (byte >= '0' && byte <= '9')
- {
- n = (n * 10) + (byte - '0');
- }
- else
- break;
- }
- if (byte == ';')
- {
- *chPtr = (Tcl_UniChar) n;
- return ++i;
- }
- }
- }
-
- /*
- * Unroll 1 to 3 byte UTF-8 sequences, use loop to handle longer ones.
- */
-
- byte = *((unsigned char *) str);
-#ifdef JISX0208
- if (0xA1 <= byte && byte <= 0xFE)
- {
- int ku, ten;
-
- ku = (byte & 0x7F) - 0x20;
- ten = (str[1] & 0x7F) - 0x20;
- if ((ku < 1 || ku > 92) || (ten < 1 || ten > 94))
- {
- *chPtr = (Tcl_UniChar) byte;
- return 1;
- }
-
- *chPtr = (Tcl_UniChar) UnicodeTbl[ku - 1][ten - 1];
- return 2;
- }
- else
-#endif /* JISX0208 */
- if (byte < 0xC0)
- {
- /*
- * Handles properly formed UTF-8 characters between
- * 0x01 and 0x7F. Also treats \0 and naked trail
- * bytes 0x80 to 0xBF as valid characters representing
- * themselves.
- */
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
- }
- else if (byte < 0xE0)
- {
- if ((str[1] & 0xC0) == 0x80)
- {
- /*
- * Two-byte-character lead-byte followed
- * by a trail-byte.
- */
-
- *chPtr = (Tcl_UniChar) (((byte & 0x1F) << 6)
- | (str[1] & 0x3F));
- return 2;
- }
- /*
- * A two-byte-character lead-byte not followed by trail-byte
- * represents itself.
- */
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
- }
- else if (byte < 0xF0)
- {
- if (((str[1] & 0xC0) == 0x80) && ((str[2] & 0xC0) == 0x80))
- {
- /*
- * Three-byte-character lead byte followed by
- * two trail bytes.
- */
-
- *chPtr = (Tcl_UniChar) (((byte & 0x0F) << 12)
- | ((str[1] & 0x3F) << 6) | (str[2] & 0x3F));
- return 3;
- }
- /*
- * A three-byte-character lead-byte not followed by
- * two trail-bytes represents itself.
- */
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
- }
-#if TCL_UTF_MAX > 3
- else
- {
- int ch, total, trail;
-
- total = totalBytes[byte];
- trail = total - 1;
- if (trail > 0)
- {
- ch = byte & (0x3F >> trail);
- do
- {
- str++;
- if ((*str & 0xC0) != 0x80)
- {
- *chPtr = byte;
- return 1;
- }
- ch <<= 6;
- ch |= (*str & 0x3F);
- trail--;
- }
- while (trail > 0);
- *chPtr = ch;
- return total;
- }
- }
-#endif
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
-}
-
-/********************************************************************/
-/* font cache functions */
-
-static int
-fontTest (void *element, void *key)
-{
- font_t *a = (font_t *) element;
- fontkey_t *b = (fontkey_t *) key;
-
- return (strcmp (a->fontlist, b->fontlist) == 0);
-}
-
-static void *fontFetch (char **error, void *key)
-{
- font_t *a;
- fontkey_t *b = (fontkey_t *) key;
- int n;
- int font_found = 0;
- unsigned short platform, encoding;
- char *fontsearchpath, *fontlist;
- char *fullname = NULL;
- char *name, *path=NULL, *dir;
- char *strtok_ptr;
- FT_Error err;
- FT_CharMap found = 0;
- FT_CharMap charmap;
-
- a = (font_t *) gdPMalloc(sizeof(font_t));
- a->fontlist = gdPEstrdup(b->fontlist);
- a->library = b->library;
-
- /*
- * Search the pathlist for any of a list of font names.
- */
- fontsearchpath = getenv ("GDFONTPATH");
- if (!fontsearchpath) {
- fontsearchpath = DEFAULT_FONTPATH;
- }
- fontlist = gdEstrdup(a->fontlist);
-
- /*
- * Must use gd_strtok_r else pointer corrupted by strtok in nested loop.
- */
- for (name = gd_strtok_r (fontlist, LISTSEPARATOR, &strtok_ptr); name; name = gd_strtok_r (0, LISTSEPARATOR, &strtok_ptr)) {
- /* make a fresh copy each time - strtok corrupts it. */
- path = gdEstrdup (fontsearchpath);
-
- /*
- * Allocate an oversized buffer that is guaranteed to be
- * big enough for all paths to be tested.
- */
- fullname = gdRealloc (fullname, strlen (fontsearchpath) + strlen (name) + 6);
-
- /* if name is an absolute filename then test directly */
- if (*name == '/' || (name[0] != 0 && name[1] == ':' && (name[2] == '/' || name[2] == '\\'))) {
- sprintf(fullname, "%s", name);
- if (access(fullname, R_OK) == 0) {
- font_found++;
- break;
- }
- }
- for (dir = strtok (path, PATHSEPARATOR); dir; dir = strtok (0, PATHSEPARATOR)) {
- sprintf(fullname, "%s/%s", dir, name);
- if (access (fullname, R_OK) == 0) {
- font_found++;
- break;
- }
- sprintf(fullname, "%s/%s.ttf", dir, name);
- if (access (fullname, R_OK) == 0) {
- font_found++;
- break;
- }
- sprintf(fullname, "%s/%s.pfa", dir, name);
- if (access(fullname, R_OK) == 0) {
- font_found++;
- break;
- }
- sprintf (fullname, "%s/%s.pfb", dir, name);
- if (access(fullname, R_OK) == 0) {
- font_found++;
- break;
- }
- }
- gdFree(path);
- path = NULL;
- if (font_found) {
- break;
- }
- }
-
- if (path) {
- gdFree(path);
- }
-
- gdFree(fontlist);
-
- if (!font_found) {
- gdPFree(a->fontlist);
- gdPFree(a);
- if (fullname) {
- gdFree(fullname);
- }
- *error = "Could not find/open font";
- return NULL;
- }
-
- err = FT_New_Face (*b->library, fullname, 0, &a->face);
- if (err) {
- gdPFree(a->fontlist);
- gdPFree(a);
- if (fullname) {
- gdFree(fullname);
- }
- *error = "Could not read font";
- return NULL;
- }
- gdFree(fullname);
-
- /* FIXME - This mapping stuff is imcomplete - where is the spec? */
-
- a->have_char_map_unicode = 0;
- a->have_char_map_big5 = 0;
- a->have_char_map_sjis = 0;
- a->have_char_map_apple_roman = 0;
- for (n = 0; n < a->face->num_charmaps; n++) {
- charmap = a->face->charmaps[n];
- platform = charmap->platform_id;
- encoding = charmap->encoding_id;
- if ((platform == 3 && encoding == 1) /* Windows Unicode */
- || (platform == 3 && encoding == 0) /* Windows Symbol */
- || (platform == 2 && encoding == 1) /* ISO Unicode */
- || (platform == 0))
- { /* Apple Unicode */
- a->have_char_map_unicode = 1;
- found = charmap;
- } else if (platform == 3 && encoding == 4) { /* Windows Big5 */
- a->have_char_map_big5 = 1;
- found = charmap;
- } else if (platform == 3 && encoding == 2) { /* Windows Sjis */
- a->have_char_map_sjis = 1;
- found = charmap;
- } else if ((platform == 1 && encoding == 0) /* Apple Roman */
- || (platform == 2 && encoding == 0))
- { /* ISO ASCII */
- a->have_char_map_apple_roman = 1;
- found = charmap;
- }
- }
- if (!found) {
- gdPFree(a->fontlist);
- gdPFree(a);
- *error = "Unable to find a CharMap that I can handle";
- return NULL;
- }
-
- /* 2.0.5: we should actually return this */
- a->face->charmap = found;
- return (void *) a;
-}
-
-static void fontRelease (void *element)
-{
- font_t *a = (font_t *) element;
-
- FT_Done_Face (a->face);
- gdPFree(a->fontlist);
- gdPFree((char *) element);
-}
-
-/********************************************************************/
-/* tweencolor cache functions */
-
-static int
-tweenColorTest (void *element, void *key)
-{
- tweencolor_t *a = (tweencolor_t *) element;
- tweencolorkey_t *b = (tweencolorkey_t *) key;
-
- return (a->pixel == b->pixel
- && a->bgcolor == b->bgcolor
- && a->fgcolor == b->fgcolor
- && a->im == b->im);
-}
-
-/*
- * Computes a color in im's color table that is part way between
- * the background and foreground colors proportional to the gray
- * pixel value in the range 0-NUMCOLORS. The fg and bg colors must already
- * be in the color table for palette images. For truecolor images the
- * returned value simply has an alpha component and gdImageAlphaBlend
- * does the work so that text can be alpha blended across a complex
- * background (TBB; and for real in 2.0.2).
- */
-static void *
-tweenColorFetch (char **error, void *key)
-{
- tweencolor_t *a;
- tweencolorkey_t *b = (tweencolorkey_t *) key;
- int pixel, npixel, bg, fg;
- gdImagePtr im;
-
- a = (tweencolor_t *) gdMalloc (sizeof (tweencolor_t));
- pixel = a->pixel = b->pixel;
- bg = a->bgcolor = b->bgcolor;
- fg = a->fgcolor = b->fgcolor;
- im = b->im;
-
- /* if fg is specified by a negative color idx, then don't antialias */
- if (fg < 0)
- {
- if ((pixel + pixel) >= NUMCOLORS)
- a->tweencolor = -fg;
- else
- a->tweencolor = bg;
- }
- else
- {
- npixel = NUMCOLORS - pixel;
- if (im->trueColor)
- {
- /* 2.0.1: use gdImageSetPixel to do the alpha blending work,
- or to just store the alpha level. All we have to do here
- is incorporate our knowledge of the percentage of this
- pixel that is really "lit" by pushing the alpha value
- up toward transparency in edge regions. */
- a->tweencolor = gdTrueColorAlpha (
- gdTrueColorGetRed (fg),
- gdTrueColorGetGreen (fg),
- gdTrueColorGetBlue (fg),
- gdAlphaMax - (gdTrueColorGetAlpha (fg) * pixel / NUMCOLORS));
- }
- else
- {
- a->tweencolor = gdImageColorResolve (im,
- (pixel * im->red[fg] + npixel * im->red[bg]) / NUMCOLORS,
- (pixel * im->green[fg] + npixel * im->green[bg]) / NUMCOLORS,
- (pixel * im->blue[fg] + npixel * im->blue[bg]) / NUMCOLORS);
- }
- }
- return (void *) a;
-}
-
-static void
-tweenColorRelease (void *element)
-{
- gdFree ((char *) element);
-}
-
-/* draw_bitmap - transfers glyph bitmap to GD image */
-static char *
-gdft_draw_bitmap (gdCache_head_t *tc_cache, gdImage * im, int fg, FT_Bitmap bitmap, int pen_x, int pen_y)
-{
- unsigned char *pixel = NULL;
- int *tpixel = NULL;
- int x, y, row, col, pc, pcr;
-
- tweencolor_t *tc_elem;
- tweencolorkey_t tc_key;
-
- /* copy to image, mapping colors */
- tc_key.fgcolor = fg;
- tc_key.im = im;
- /* Truecolor version; does not require the cache */
- if (im->trueColor)
- {
- for (row = 0; row < bitmap.rows; row++)
- {
- pc = row * bitmap.pitch;
- pcr = pc;
- y = pen_y + row;
- /* clip if out of bounds */
- if (y >= im->sy || y < 0)
- continue;
- for (col = 0; col < bitmap.width; col++, pc++)
- {
- int level;
- if (bitmap.pixel_mode == ft_pixel_mode_grays)
- {
- /*
- * Scale to 128 levels of alpha for gd use.
- * alpha 0 is opacity, so be sure to invert at the end
- */
- level = (bitmap.buffer[pc] * gdAlphaMax /
- (bitmap.num_grays - 1));
- }
- else if (bitmap.pixel_mode == ft_pixel_mode_mono)
- {
- /* 2.0.5: mode_mono fix from Giuliano Pochini */
- level = ((bitmap.buffer[(col>>3)+pcr]) & (1<<(~col&0x07)))
- ? gdAlphaTransparent :
- gdAlphaOpaque;
- }
- else
- {
- return "Unsupported ft_pixel_mode";
- }
- if ((fg >= 0) && (im->trueColor)) {
- /* Consider alpha in the foreground color itself to be an
- upper bound on how opaque things get, when truecolor is
- available. Without truecolor this results in far too many
- color indexes. */
- level = level * (gdAlphaMax - gdTrueColorGetAlpha(fg)) / gdAlphaMax;
- }
- level = gdAlphaMax - level;
- x = pen_x + col;
- /* clip if out of bounds */
- if (x >= im->sx || x < 0)
- continue;
- /* get pixel location in gd buffer */
- tpixel = &im->tpixels[y][x];
- if (fg < 0) {
- if (level < (gdAlphaMax / 2)) {
- *tpixel = -fg;
- }
- } else {
- if (im->alphaBlendingFlag) {
- *tpixel = gdAlphaBlend(*tpixel, (level << 24) + (fg & 0xFFFFFF));
- } else {
- *tpixel = (level << 24) + (fg & 0xFFFFFF);
- }
- }
- }
- }
- return (char *) NULL;
- }
- /* Non-truecolor case, restored to its more or less original form */
- for (row = 0; row < bitmap.rows; row++)
- {
- int pcr;
- pc = row * bitmap.pitch;
- pcr = pc;
- if(bitmap.pixel_mode==ft_pixel_mode_mono)
- pc *= 8; /* pc is measured in bits for monochrome images */
-
- y = pen_y + row;
-
- /* clip if out of bounds */
- if (y >= im->sy || y < 0)
- continue;
-
- for (col = 0; col < bitmap.width; col++, pc++)
- {
- if (bitmap.pixel_mode == ft_pixel_mode_grays)
- {
- /*
- * Round to NUMCOLORS levels of antialiasing for
- * index color images since only 256 colors are
- * available.
- */
- tc_key.pixel = ((bitmap.buffer[pc] * NUMCOLORS)
- + bitmap.num_grays / 2)
- / (bitmap.num_grays - 1);
- }
- else if (bitmap.pixel_mode == ft_pixel_mode_mono)
- {
- tc_key.pixel = ((bitmap.buffer[pc / 8]
- << (pc % 8)) & 128) ? NUMCOLORS : 0;
- /* 2.0.5: mode_mono fix from Giuliano Pochini */
- tc_key.pixel = ((bitmap.buffer[(col>>3)+pcr]) & (1<<(~col&0x07)))
- ? NUMCOLORS : 0;
- }
- else
- {
- return "Unsupported ft_pixel_mode";
- }
- if (tc_key.pixel > 0) /* if not background */
- {
- x = pen_x + col;
-
- /* clip if out of bounds */
- if (x >= im->sx || x < 0)
- continue;
- /* get pixel location in gd buffer */
- pixel = &im->pixels[y][x];
- if (tc_key.pixel == NUMCOLORS)
- {
- /* use fg color directly. gd 2.0.2: watch out for
- negative indexes (thanks to David Marwood). */
- *pixel = (fg < 0) ? -fg : fg;
- }
- else
- {
- /* find antialised color */
-
- tc_key.bgcolor = *pixel;
- tc_elem = (tweencolor_t *) gdCacheGet (
- tc_cache, &tc_key);
- *pixel = tc_elem->tweencolor;
- }
- }
- }
- }
- return (char *) NULL;
-}
-
-static int
-gdroundupdown (FT_F26Dot6 v1, int updown)
-{
- return (!updown)
- ? (v1 < 0 ? ((v1 - 63) >> 6) : v1 >> 6)
- : (v1 > 0 ? ((v1 + 63) >> 6) : v1 >> 6);
-}
-
-extern int any2eucjp (char *, char *, unsigned int);
-
-/* Persistent font cache until explicitly cleared */
-/* Fonts can be used across multiple images */
-static gdCache_head_t *fontCache = NULL;
-static FT_Library library;
-
-void
-gdFreeFontCache()
-{
- if (fontCache)
- {
- gdCacheDelete(fontCache);
- fontCache = NULL;
- FT_Done_FreeType(library);
- }
-}
-
-/********************************************************************/
-/* gdImageStringFT - render a utf8 string onto a gd image */
-
-char *
-gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
- double ptsize, double angle, int x, int y, char *string)
-{
- return gdImageStringFTEx(im, brect, fg, fontlist,
- ptsize, angle, x, y, string, 0);
-}
-
-char *
-gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y, char *string, gdFTStringExtraPtr strex)
-{
- FT_BBox bbox, glyph_bbox;
- FT_Matrix matrix;
- FT_Vector pen, delta, penf;
- FT_Face face;
- FT_Glyph image;
- FT_GlyphSlot slot;
- FT_Bool use_kerning;
- FT_UInt glyph_index, previous;
- double sin_a = sin (angle);
- double cos_a = cos (angle);
- int len, i = 0, ch;
- int x1 = 0, y1 = 0;
- font_t *font;
- fontkey_t fontkey;
- char *next;
- char *tmpstr = NULL;
- int render = (im && (im->trueColor || (fg <= 255 && fg >= -255)));
- FT_BitmapGlyph bm;
- int render_mode = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT;
- int m, mfound;
- /* Now tuneable thanks to Wez Furlong */
- double linespace = LINESPACE;
- /* 2.0.6: put this declaration with the other declarations! */
- /*
- * make a new tweenColorCache on every call
- * because caching colormappings between calls
- * is not safe. If the im-pointer points to a
- * brand new image, the cache gives out bogus
- * colorindexes. -- 27.06.2001 <krisku@arrak.fi>
- */
- gdCache_head_t *tc_cache;
-
- if (strex && ((strex->flags & gdFTEX_LINESPACE) == gdFTEX_LINESPACE)) {
- linespace = strex->linespacing;
- }
- tc_cache = gdCacheCreate(TWEENCOLORCACHESIZE, tweenColorTest, tweenColorFetch, tweenColorRelease);
-
- /***** initialize font library and font cache on first call ******/
-
- if (!fontCache) {
- if (FT_Init_FreeType (&library)) {
- gdCacheDelete( tc_cache );
- return "Failure to initialize font library";
- }
- fontCache = gdCacheCreate(FONTCACHESIZE, fontTest, fontFetch, fontRelease);
- }
- /*****/
-
- /* get the font (via font cache) */
- fontkey.fontlist = fontlist;
- fontkey.library = &library;
- font = (font_t *) gdCacheGet (fontCache, &fontkey);
- if (!font) {
- gdCacheDelete(tc_cache);
- return fontCache->error;
- }
- face = font->face; /* shortcut */
- slot = face->glyph; /* shortcut */
-
- if (FT_Set_Char_Size (face, 0, (FT_F26Dot6) (ptsize * 64), GD_RESOLUTION, GD_RESOLUTION)) {
- gdCacheDelete(tc_cache);
- return "Could not set character size";
- }
-
- matrix.xx = (FT_Fixed) (cos_a * (1 << 16));
- matrix.yx = (FT_Fixed) (sin_a * (1 << 16));
- matrix.xy = -matrix.yx;
- matrix.yy = matrix.xx;
-
- penf.x = penf.y = 0; /* running position of non-rotated string */
- pen.x = pen.y = 0; /* running position of rotated string */
- bbox.xMin = bbox.xMax = bbox.yMin = bbox.yMax = 0;
-
- use_kerning = FT_HAS_KERNING (face);
- previous = 0;
- if (fg < 0) {
- render_mode |= FT_LOAD_MONOCHROME;
- }
- /* 2.0.12: allow explicit specification of the preferred map;
- * but we still fall back if it is not available.
- */
- m = gdFTEX_Unicode;
- if (strex && (strex->flags & gdFTEX_CHARMAP)) {
- m = strex->charmap;
- }
- /* Try all three types of maps, but start with the specified one */
- mfound = 0;
- for (i = 0; i < 3; i++) {
- switch (m) {
- case gdFTEX_Unicode:
- if (font->have_char_map_unicode) {
- mfound = 1;
- }
- break;
- case gdFTEX_Shift_JIS:
- if (font->have_char_map_sjis) {
- mfound = 1;
- }
- break;
- case gdFTEX_Big5:
- /* This was the 'else' case, we can't really 'detect' it */
- mfound = 1;
- break;
- }
- if (mfound) {
- break;
- }
- m++;
- m %= 3;
- }
- if (!mfound) {
- /* No character set found! */
- return "No character set found";
- }
-
-#ifndef JISX0208
- if (!font->have_char_map_sjis) {
- next = string;
- } else
-#endif
- tmpstr = (char *) gdMalloc(BUFSIZ);
-
- while (*next) {
- ch = *next;
-
- /* carriage returns */
- if (ch == '\r') {
- penf.x = 0;
- x1 = (int)(penf.x * cos_a - penf.y * sin_a + 32) / 64;
- y1 = (int)(penf.x * sin_a + penf.y * cos_a + 32) / 64;
- pen.x = pen.y = 0;
- previous = 0; /* clear kerning flag */
- next++;
- continue;
- }
- /* newlines */
- if (ch == '\n') {
- penf.y -= (long)(face->size->metrics.height * linespace);
- penf.y = (penf.y - 32) & -64; /* round to next pixel row */
- x1 = (int)(penf.x * cos_a - penf.y * sin_a + 32) / 64;
- y1 = (int)(penf.x * sin_a + penf.y * cos_a + 32) / 64;
- pen.x = pen.y = 0;
- previous = 0; /* clear kerning flag */
- next++;
- continue;
- }
- switch (m) {
- case gdFTEX_Unicode:
- if (font->have_char_map_unicode) {
- /* use UTF-8 mapping from ASCII */
- len = gdTcl_UtfToUniChar(next, &ch);
- next += len;
- }
- break;
- case gdFTEX_Shift_JIS:
- if (font->have_char_map_sjis) {
- unsigned char c;
- int jiscode;
- c = *next;
- if (0xA1 <= c && c <= 0xFE) {
- next++;
- jiscode = 0x100 * (c & 0x7F) + ((*next) & 0x7F);
-
- ch = (jiscode >> 8) & 0xFF;
- jiscode &= 0xFF;
-
- if (ch & 1) {
- jiscode += 0x40 - 0x21;
- } else {
- jiscode += 0x9E - 0x21;
- }
-
- if (jiscode >= 0x7F) {
- jiscode++;
- }
- ch = (ch - 0x21) / 2 + 0x81;
- if (ch >= 0xA0) {
- ch += 0x40;
- }
-
- ch = (ch << 8) + jiscode;
- } else {
- ch = c & 0xFF; /* don't extend sign */
- }
- next++;
- }
- break;
- case gdFTEX_Big5: {
- /*
- * Big 5 mapping:
- * use "JIS-8 half-width katakana" coding from 8-bit characters. Ref:
- * ftp://ftp.ora.com/pub/examples/nutshell/ujip/doc/japan.inf-032092.sjs
- */
- ch = (*next) & 0xFF; /* don't extend sign */
- next++;
- if (ch >= 161 /* first code of JIS-8 pair */
- && *next) { /* don't advance past '\0' */
- /* TBB: Fix from Kwok Wah On: & 255 needed */
- ch = (ch * 256) + ((*next) & 255);
- next++;
- }
- }
- break;
- }
-
- /* set rotation transform */
- FT_Set_Transform(face, &matrix, NULL);
- /* Convert character code to glyph index */
- glyph_index = FT_Get_Char_Index(face, ch);
-
- /* retrieve kerning distance and move pen position */
- if (use_kerning && previous && glyph_index) {
- FT_Get_Kerning(face, previous, glyph_index, ft_kerning_default, &delta);
- pen.x += delta.x;
- penf.x += delta.x;
- }
-
- /* load glyph image into the slot (erase previous one) */
- if (FT_Load_Glyph(face, glyph_index, render_mode)) {
- if (tmpstr) {
- gdFree(tmpstr);
- }
- gdCacheDelete(tc_cache);
- return "Problem loading glyph";
- }
-
- /* transform glyph image */
- FT_Get_Glyph(slot, &image);
- if (brect) { /* only if need brect */
- FT_Glyph_Get_CBox(image, ft_glyph_bbox_gridfit, &glyph_bbox);
- glyph_bbox.xMin += penf.x;
- glyph_bbox.yMin += penf.y;
- glyph_bbox.xMax += penf.x;
- glyph_bbox.yMax += penf.y;
- if (ch == ' ') { /* special case for trailing space */
- glyph_bbox.xMax += slot->metrics.horiAdvance;
- }
- if (!i) { /* if first character, init BB corner values */
- bbox.xMin = glyph_bbox.xMin;
- bbox.yMin = glyph_bbox.yMin;
- bbox.xMax = glyph_bbox.xMax;
- bbox.yMax = glyph_bbox.yMax;
- } else {
- if (bbox.xMin > glyph_bbox.xMin) {
- bbox.xMin = glyph_bbox.xMin;
- }
- if (bbox.yMin > glyph_bbox.yMin) {
- bbox.yMin = glyph_bbox.yMin;
- }
- if (bbox.xMax < glyph_bbox.xMax) {
- bbox.xMax = glyph_bbox.xMax;
- }
- if (bbox.yMax < glyph_bbox.yMax) {
- bbox.yMax = glyph_bbox.yMax;
- }
- }
- i++;
- }
-
- if (render) {
- if (image->format != ft_glyph_format_bitmap && FT_Glyph_To_Bitmap(&image, ft_render_mode_normal, 0, 1)) {
- if (tmpstr) {
- gdFree(tmpstr);
- }
- gdCacheDelete(tc_cache);
- return "Problem rendering glyph";
- }
-
- /* now, draw to our target surface */
- bm = (FT_BitmapGlyph) image;
- gdft_draw_bitmap(tc_cache, im, fg, bm->bitmap, x + x1 + ((pen.x + 31) >> 6) + bm->left, y - y1 + ((pen.y + 31) >> 6) - bm->top);
- }
-
- /* record current glyph index for kerning */
- previous = glyph_index;
-
- /* increment pen position */
- pen.x += image->advance.x >> 10;
- pen.y -= image->advance.y >> 10;
-
- penf.x += slot->metrics.horiAdvance;
-
- FT_Done_Glyph(image);
- }
-
- if (brect) { /* only if need brect */
- /* For perfect rounding, must get sin(a + pi/4) and sin(a - pi/4). */
- double d1 = sin (angle + 0.78539816339744830962);
- double d2 = sin (angle - 0.78539816339744830962);
-
- /* rotate bounding rectangle */
- brect[0] = (int) (bbox.xMin * cos_a - bbox.yMin * sin_a);
- brect[1] = (int) (bbox.xMin * sin_a + bbox.yMin * cos_a);
- brect[2] = (int) (bbox.xMax * cos_a - bbox.yMin * sin_a);
- brect[3] = (int) (bbox.xMax * sin_a + bbox.yMin * cos_a);
- brect[4] = (int) (bbox.xMax * cos_a - bbox.yMax * sin_a);
- brect[5] = (int) (bbox.xMax * sin_a + bbox.yMax * cos_a);
- brect[6] = (int) (bbox.xMin * cos_a - bbox.yMax * sin_a);
- brect[7] = (int) (bbox.xMin * sin_a + bbox.yMax * cos_a);
-
- /* scale, round and offset brect */
- brect[0] = x + gdroundupdown(brect[0], d2 > 0);
- brect[1] = y - gdroundupdown(brect[1], d1 < 0);
- brect[2] = x + gdroundupdown(brect[2], d1 > 0);
- brect[3] = y - gdroundupdown(brect[3], d2 > 0);
- brect[4] = x + gdroundupdown(brect[4], d2 < 0);
- brect[5] = y - gdroundupdown(brect[5], d1 > 0);
- brect[6] = x + gdroundupdown(brect[6], d1 < 0);
- brect[7] = y - gdroundupdown(brect[7], d2 < 0);
- }
-
- if (tmpstr) {
- gdFree(tmpstr);
- }
- gdCacheDelete(tc_cache);
- return (char *) NULL;
-}
-
-#endif /* HAVE_LIBFREETYPE */
diff --git a/ext/gd/libgd/gdhelpers.c b/ext/gd/libgd/gdhelpers.c
deleted file mode 100644
index ae2428dfcd..0000000000
--- a/ext/gd/libgd/gdhelpers.c
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gd.h"
-#include "gdhelpers.h"
-#include <stdlib.h>
-#include <string.h>
-
-/* TBB: gd_strtok_r is not portable; provide an implementation */
-
-#define SEP_TEST (separators[*((unsigned char *) s)])
-
-char *
-gd_strtok_r (char *s, char *sep, char **state)
-{
- char separators[256];
- char *start;
- char *result = 0;
- memset (separators, 0, sizeof (separators));
- while (*sep)
- {
- separators[*((unsigned char *) sep)] = 1;
- sep++;
- }
- if (!s)
- {
- /* Pick up where we left off */
- s = *state;
- }
- start = s;
- /* 1. EOS */
- if (!(*s))
- {
- *state = s;
- return 0;
- }
- /* 2. Leading separators, if any */
- if (SEP_TEST)
- {
- do
- {
- s++;
- }
- while (SEP_TEST);
- /* 2a. EOS after separators only */
- if (!(*s))
- {
- *state = s;
- return 0;
- }
- }
- /* 3. A token */
- result = s;
- do
- {
- /* 3a. Token at end of string */
- if (!(*s))
- {
- *state = s;
- return result;
- }
- s++;
- }
- while (!SEP_TEST);
- /* 4. Terminate token and skip trailing separators */
- *s = '\0';
- do
- {
- s++;
- }
- while (SEP_TEST);
- /* 5. Return token */
- *state = s;
- return result;
-}
diff --git a/ext/gd/libgd/gdhelpers.h b/ext/gd/libgd/gdhelpers.h
deleted file mode 100644
index 2544e88060..0000000000
--- a/ext/gd/libgd/gdhelpers.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef GDHELPERS_H
-#define GDHELPERS_H 1
-
-#include <sys/types.h>
-#include "php.h"
-
-/* TBB: strtok_r is not universal; provide an implementation of it. */
-
-extern char *gd_strtok_r(char *s, char *sep, char **state);
-
-/* These functions wrap memory management. gdFree is
- in gd.h, where callers can utilize it to correctly
- free memory allocated by these functions with the
- right version of free(). */
-#define gdCalloc(nmemb, size) ecalloc(nmemb, size)
-#define gdMalloc(size) emalloc(size)
-#define gdRealloc(ptr, size) erealloc(ptr, size)
-#define gdEstrdup(ptr) estrdup(ptr)
-#define gdFree(ptr) efree(ptr)
-#define gdPMalloc(ptr) pemalloc(ptr, 1)
-#define gdPFree(ptr) pefree(ptr, 1)
-#define gdPEstrdup(ptr) pestrdup(ptr, 1)
-
-#endif /* GDHELPERS_H */
-
diff --git a/ext/gd/libgd/gdkanji.c b/ext/gd/libgd/gdkanji.c
deleted file mode 100644
index ad839c8bb3..0000000000
--- a/ext/gd/libgd/gdkanji.c
+++ /dev/null
@@ -1,627 +0,0 @@
-
-/* gdkanji.c (Kanji code converter) */
-/* written by Masahito Yamaga (ma@yama-ga.com) */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "gd.h"
-#include "gdhelpers.h"
-
-#include <stdarg.h>
-#if defined(HAVE_ICONV_H) || defined(HAVE_ICONV)
-#include <iconv.h>
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-#endif
-
-#if defined(HAVE_ICONV_H) && !defined(HAVE_ICONV)
-#define HAVE_ICONV 1
-#endif
-
-#define LIBNAME "any2eucjp()"
-
-#if defined(__MSC__) || defined(__BORLANDC__) || defined(__TURBOC__) || defined(_Windows) || defined(MSDOS)
-#ifndef SJISPRE
-#define SJISPRE 1
-#endif
-#endif
-
-#ifdef TRUE
-#undef TRUE
-#endif
-#ifdef FALSE
-#undef FALSE
-#endif
-
-#define TRUE 1
-#define FALSE 0
-
-#define NEW 1
-#define OLD 2
-#define ESCI 3
-#define NEC 4
-#define EUC 5
-#define SJIS 6
-#define EUCORSJIS 7
-#define ASCII 8
-
-#define NEWJISSTR "JIS7"
-#define OLDJISSTR "jis"
-#define EUCSTR "eucJP"
-#define SJISSTR "SJIS"
-
-#define ESC 27
-#define SS2 142
-
-static void
-debug (const char *format,...)
-{
-#ifdef DEBUG
- va_list args;
-
- va_start (args, format);
- fprintf (stdout, "%s: ", LIBNAME);
- vfprintf (stdout, format, args);
- fprintf (stdout, "\n");
- va_end (args);
-#endif
-}
-
-static void
-error (const char *format,...)
-{
- va_list args;
- char *tmp;
- TSRMLS_FETCH();
-
- va_start(args, format);
- vspprintf(&tmp, 0, format, args);
- va_end(args);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: %s", LIBNAME, tmp);
- efree(tmp);
-}
-
-/* DetectKanjiCode() derived from DetectCodeType() by Ken Lunde. */
-
-static int
-DetectKanjiCode (unsigned char *str)
-{
- static int whatcode = ASCII;
- int oldcode = ASCII;
- int c, i;
- char *lang = NULL;
-
- c = '\1';
- i = 0;
-
- if (whatcode != EUCORSJIS && whatcode != ASCII)
- {
- oldcode = whatcode;
- whatcode = ASCII;
- }
-
- while ((whatcode == EUCORSJIS || whatcode == ASCII) && c != '\0')
- {
- if ((c = str[i++]) != '\0')
- {
- if (c == ESC)
- {
- c = str[i++];
- if (c == '$')
- {
- c = str[i++];
- if (c == 'B')
- whatcode = NEW;
- else if (c == '@')
- whatcode = OLD;
- }
- else if (c == '(')
- {
- c = str[i++];
- if (c == 'I')
- whatcode = ESCI;
- }
- else if (c == 'K')
- whatcode = NEC;
- }
- else if ((c >= 129 && c <= 141) || (c >= 143 && c <= 159))
- whatcode = SJIS;
- else if (c == SS2)
- {
- c = str[i++];
- if ((c >= 64 && c <= 126) || (c >= 128 && c <= 160) || (c >= 224 && c <= 252))
- whatcode = SJIS;
- else if (c >= 161 && c <= 223)
- whatcode = EUCORSJIS;
- }
- else if (c >= 161 && c <= 223)
- {
- c = str[i++];
- if (c >= 240 && c <= 254)
- whatcode = EUC;
- else if (c >= 161 && c <= 223)
- whatcode = EUCORSJIS;
- else if (c >= 224 && c <= 239)
- {
- whatcode = EUCORSJIS;
- while (c >= 64 && c != '\0' && whatcode == EUCORSJIS)
- {
- if (c >= 129)
- {
- if (c <= 141 || (c >= 143 && c <= 159))
- whatcode = SJIS;
- else if (c >= 253 && c <= 254)
- whatcode = EUC;
- }
- c = str[i++];
- }
- }
- else if (c <= 159)
- whatcode = SJIS;
- }
- else if (c >= 240 && c <= 254)
- whatcode = EUC;
- else if (c >= 224 && c <= 239)
- {
- c = str[i++];
- if ((c >= 64 && c <= 126) || (c >= 128 && c <= 160))
- whatcode = SJIS;
- else if (c >= 253 && c <= 254)
- whatcode = EUC;
- else if (c >= 161 && c <= 252)
- whatcode = EUCORSJIS;
- }
- }
- }
-
-#ifdef DEBUG
- if (whatcode == ASCII)
- debug ("Kanji code not included.");
- else if (whatcode == EUCORSJIS)
- debug ("Kanji code not detected.");
- else
- debug ("Kanji code detected at %d byte.", i);
-#endif
-
- if (whatcode == EUCORSJIS && oldcode != ASCII)
- whatcode = oldcode;
-
- if (whatcode == EUCORSJIS)
- {
- if (getenv ("LC_ALL"))
- lang = getenv ("LC_ALL");
- else if (getenv ("LC_CTYPE"))
- lang = getenv ("LC_CTYPE");
- else if (getenv ("LANG"))
- lang = getenv ("LANG");
-
- if (lang)
- {
- if (strcmp (lang, "ja_JP.SJIS") == 0 ||
-#ifdef hpux
- strcmp (lang, "japanese") == 0 ||
-#endif
- strcmp (lang, "ja_JP.mscode") == 0 ||
- strcmp (lang, "ja_JP.PCK") == 0)
- whatcode = SJIS;
- else if (strncmp (lang, "ja", 2) == 0)
-#ifdef SJISPRE
- whatcode = SJIS;
-#else
- whatcode = EUC;
-#endif
- }
- }
-
- if (whatcode == EUCORSJIS)
-#ifdef SJISPRE
- whatcode = SJIS;
-#else
- whatcode = EUC;
-#endif
-
- return whatcode;
-}
-
-/* SJIStoJIS() is sjis2jis() by Ken Lunde. */
-
-static void
-SJIStoJIS (int *p1, int *p2)
-{
- register unsigned char c1 = *p1;
- register unsigned char c2 = *p2;
- register int adjust = c2 < 159;
- register int rowOffset = c1 < 160 ? 112 : 176;
- register int cellOffset = adjust ? (31 + (c2 > 127)) : 126;
-
- *p1 = ((c1 - rowOffset) << 1) - adjust;
- *p2 -= cellOffset;
-}
-
-/* han2zen() was derived from han2zen() written by Ken Lunde. */
-
-#define IS_DAKU(c) ((c >= 182 && c <= 196) || (c >= 202 && c <= 206) || (c == 179))
-#define IS_HANDAKU(c) (c >= 202 && c <= 206)
-
-static void
-han2zen (int *p1, int *p2)
-{
- int c = *p1;
- int daku = FALSE;
- int handaku = FALSE;
- int mtable[][2] =
- {
- {129, 66},
- {129, 117},
- {129, 118},
- {129, 65},
- {129, 69},
- {131, 146},
- {131, 64},
- {131, 66},
- {131, 68},
- {131, 70},
- {131, 72},
- {131, 131},
- {131, 133},
- {131, 135},
- {131, 98},
- {129, 91},
- {131, 65},
- {131, 67},
- {131, 69},
- {131, 71},
- {131, 73},
- {131, 74},
- {131, 76},
- {131, 78},
- {131, 80},
- {131, 82},
- {131, 84},
- {131, 86},
- {131, 88},
- {131, 90},
- {131, 92},
- {131, 94},
- {131, 96},
- {131, 99},
- {131, 101},
- {131, 103},
- {131, 105},
- {131, 106},
- {131, 107},
- {131, 108},
- {131, 109},
- {131, 110},
- {131, 113},
- {131, 116},
- {131, 119},
- {131, 122},
- {131, 125},
- {131, 126},
- {131, 128},
- {131, 129},
- {131, 130},
- {131, 132},
- {131, 134},
- {131, 136},
- {131, 137},
- {131, 138},
- {131, 139},
- {131, 140},
- {131, 141},
- {131, 143},
- {131, 147},
- {129, 74},
- {129, 75}
- };
-
- if (*p2 == 222 && IS_DAKU (*p1))
- daku = TRUE; /* Daku-ten */
- else if (*p2 == 223 && IS_HANDAKU (*p1))
- handaku = TRUE; /* Han-daku-ten */
-
- *p1 = mtable[c - 161][0];
- *p2 = mtable[c - 161][1];
-
- if (daku)
- {
- if ((*p2 >= 74 && *p2 <= 103) || (*p2 >= 110 && *p2 <= 122))
- (*p2)++;
- else if (*p2 == 131 && *p2 == 69)
- *p2 = 148;
- }
- else if (handaku && *p2 >= 110 && *p2 <= 122)
- (*p2) += 2;
-}
-
-/* Recast strcpy to handle unsigned chars used below. */
-#define ustrcpy(A,B) (strcpy((char*)(A),(const char*)(B)))
-
-static void
-do_convert (unsigned char *to, unsigned char *from, const char *code)
-{
-#ifdef HAVE_ICONV
- iconv_t cd;
- size_t from_len, to_len;
-
- if ((cd = iconv_open (EUCSTR, code)) == (iconv_t) - 1)
- {
- error ("iconv_open() error");
-#ifdef HAVE_ERRNO_H
- if (errno == EINVAL)
- error ("invalid code specification: \"%s\" or \"%s\"",
- EUCSTR, code);
-#endif
- strcpy ((char *) to, (const char *) from);
- return;
- }
-
- from_len = strlen ((const char *) from) + 1;
- to_len = BUFSIZ;
-
- if ((int) iconv(cd, (char **) &from, &from_len, (char **) &to, &to_len) == -1)
- {
-#ifdef HAVE_ERRNO_H
- if (errno == EINVAL)
- error ("invalid end of input string");
- else if (errno == EILSEQ)
- error ("invalid code in input string");
- else if (errno == E2BIG)
- error ("output buffer overflow at do_convert()");
- else
-#endif
- error ("something happen");
- strcpy ((char *) to, (const char *) from);
- return;
- }
-
- if (iconv_close (cd) != 0)
- {
- error ("iconv_close() error");
- }
-#else
- int p1, p2, i, j;
- int jisx0208 = FALSE;
- int hankaku = FALSE;
-
- j = 0;
- if (strcmp (code, NEWJISSTR) == 0 || strcmp (code, OLDJISSTR) == 0)
- {
- for (i = 0; from[i] != '\0' && j < BUFSIZ; i++)
- {
- if (from[i] == ESC)
- {
- i++;
- if (from[i] == '$')
- {
- jisx0208 = TRUE;
- hankaku = FALSE;
- i++;
- }
- else if (from[i] == '(')
- {
- jisx0208 = FALSE;
- i++;
- if (from[i] == 'I') /* Hankaku Kana */
- hankaku = TRUE;
- else
- hankaku = FALSE;
- }
- }
- else
- {
- if (jisx0208)
- to[j++] = from[i] + 128;
- else if (hankaku)
- {
- to[j++] = SS2;
- to[j++] = from[i] + 128;
- }
- else
- to[j++] = from[i];
- }
- }
- }
- else if (strcmp (code, SJISSTR) == 0)
- {
- for (i = 0; from[i] != '\0' && j < BUFSIZ; i++)
- {
- p1 = from[i];
- if (p1 < 127)
- to[j++] = p1;
- else if ((p1 >= 161) && (p1 <= 223))
- { /* Hankaku Kana */
- to[j++] = SS2;
- to[j++] = p1;
- }
- else
- {
- p2 = from[++i];
- SJIStoJIS (&p1, &p2);
- to[j++] = p1 + 128;
- to[j++] = p2 + 128;
- }
- }
- }
- else
- {
- error ("invalid code specification: \"%s\"", code);
- return;
- }
-
- if (j >= BUFSIZ)
- {
- error ("output buffer overflow at do_convert()");
- ustrcpy (to, from);
- }
- else
- to[j] = '\0';
-#endif /* HAVE_ICONV */
-}
-
-static int
-do_check_and_conv (unsigned char *to, unsigned char *from)
-{
- static unsigned char tmp[BUFSIZ];
- int p1, p2, i, j;
- int kanji = TRUE;
-
- switch (DetectKanjiCode (from))
- {
- case NEW:
- debug ("Kanji code is New JIS.");
- do_convert (tmp, from, NEWJISSTR);
- break;
- case OLD:
- debug ("Kanji code is Old JIS.");
- do_convert (tmp, from, OLDJISSTR);
- break;
- case ESCI:
- debug ("This string includes Hankaku-Kana (jisx0201) escape sequence [ESC] + ( + I.");
- do_convert (tmp, from, NEWJISSTR);
- break;
- case NEC:
- debug ("Kanji code is NEC Kanji.");
- error ("cannot convert NEC Kanji.");
- ustrcpy (tmp, from);
- kanji = FALSE;
- break;
- case EUC:
- debug ("Kanji code is EUC.");
- ustrcpy (tmp, from);
- break;
- case SJIS:
- debug ("Kanji code is SJIS.");
- do_convert (tmp, from, SJISSTR);
- break;
- case EUCORSJIS:
- debug ("Kanji code is EUC or SJIS.");
- ustrcpy (tmp, from);
- kanji = FALSE;
- break;
- case ASCII:
- debug ("This is ASCII string.");
- ustrcpy (tmp, from);
- kanji = FALSE;
- break;
- default:
- debug ("This string includes unknown code.");
- ustrcpy (tmp, from);
- kanji = FALSE;
- break;
- }
-
- /* Hankaku Kana ---> Zenkaku Kana */
- if (kanji)
- {
- j = 0;
- for (i = 0; tmp[i] != '\0' && j < BUFSIZ; i++)
- {
- if (tmp[i] == SS2)
- {
- p1 = tmp[++i];
- if (tmp[i + 1] == SS2)
- {
- p2 = tmp[i + 2];
- if (p2 == 222 || p2 == 223)
- i += 2;
- else
- p2 = 0;
- }
- else
- p2 = 0;
- han2zen (&p1, &p2);
- SJIStoJIS (&p1, &p2);
- to[j++] = p1 + 128;
- to[j++] = p2 + 128;
- }
- else
- to[j++] = tmp[i];
- }
-
- if (j >= BUFSIZ)
- {
- error ("output buffer overflow at Hankaku --> Zenkaku");
- ustrcpy (to, tmp);
- }
- else
- to[j] = '\0';
- }
- else
- ustrcpy (to, tmp);
-
- return kanji;
-}
-
-int
-any2eucjp (unsigned char *dest, unsigned char *src, unsigned int dest_max)
-{
- static unsigned char tmp_dest[BUFSIZ];
- int ret;
-
- if (strlen ((const char *) src) >= BUFSIZ)
- {
- error ("input string too large");
- return -1;
- }
- if (dest_max > BUFSIZ)
- {
- error ("invalid maximum size of destination\nit should be less than %d.", BUFSIZ);
- return -1;
- }
- ret = do_check_and_conv (tmp_dest, src);
- if (strlen ((const char *) tmp_dest) >= dest_max)
- {
- error ("output buffer overflow");
- ustrcpy (dest, src);
- return -1;
- }
- ustrcpy (dest, tmp_dest);
- return ret;
-}
-
-#if 0
-unsigned int
-strwidth (unsigned char *s)
-{
- unsigned char *t;
- unsigned int i;
-
- t = (unsigned char *) gdMalloc (BUFSIZ);
- any2eucjp (t, s, BUFSIZ);
- i = strlen (t);
- gdFree (t);
- return i;
-}
-
-#ifdef DEBUG
-int
-main ()
-{
- unsigned char input[BUFSIZ];
- unsigned char *output;
- unsigned char *str;
- int c, i = 0;
-
- while ((c = fgetc (stdin)) != '\n' && i < BUFSIZ)
- input[i++] = c;
- input[i] = '\0';
-
- printf ("input : %d bytes\n", strlen ((const char *) input));
- printf ("output: %d bytes\n", strwidth (input));
-
- output = (unsigned char *) gdMalloc (BUFSIZ);
- any2eucjp (output, input, BUFSIZ);
- str = output;
- while (*str != '\0')
- putchar (*(str++));
- putchar ('\n');
- gdFree (output);
-
- return 0;
-}
-#endif
-#endif
diff --git a/ext/gd/libgd/gdparttopng.c b/ext/gd/libgd/gdparttopng.c
deleted file mode 100644
index 677a0b5710..0000000000
--- a/ext/gd/libgd/gdparttopng.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h> /* For atoi */
-#include "gd.h"
-
-/* A short program which converts a .png file into a .gd file, for
- your convenience in creating images on the fly from a
- basis image that must be loaded quickly. The .gd format
- is not intended to be a general-purpose format. */
-
-int
-main (int argc, char **argv)
-{
- gdImagePtr im;
- FILE *in, *out;
- int x, y, w, h;
-
- if (argc != 7)
- {
- fprintf (stderr, "Usage: gdparttopng filename.gd filename.png x y w h\n");
- exit (1);
- }
- in = fopen (argv[1], "rb");
- if (!in)
- {
- fprintf (stderr, "Input file does not exist!\n");
- exit (1);
- }
-
- x = atoi (argv[3]);
- y = atoi (argv[4]);
- w = atoi (argv[5]);
- h = atoi (argv[6]);
-
- printf ("Extracting from (%d, %d), size is %dx%d\n", x, y, w, h);
-
- im = gdImageCreateFromGd2Part (in, x, y, w, h);
- fclose (in);
- if (!im)
- {
- fprintf (stderr, "Input is not in PNG format!\n");
- exit (1);
- }
- out = fopen (argv[2], "wb");
- if (!out)
- {
- fprintf (stderr, "Output file cannot be written to!\n");
- gdImageDestroy (im);
- exit (1);
- }
-#ifdef HAVE_LIBPNG
- gdImagePng (im, out);
-#else
- fprintf(stderr, "No PNG library support.\n");
-#endif
- fclose (out);
- gdImageDestroy (im);
-
- return 0;
-}
diff --git a/ext/gd/libgd/gdtables.c b/ext/gd/libgd/gdtables.c
deleted file mode 100644
index 0e6e29718a..0000000000
--- a/ext/gd/libgd/gdtables.c
+++ /dev/null
@@ -1,728 +0,0 @@
-
-int gdCosT[] =
-{
- 1024,
- 1023,
- 1023,
- 1022,
- 1021,
- 1020,
- 1018,
- 1016,
- 1014,
- 1011,
- 1008,
- 1005,
- 1001,
- 997,
- 993,
- 989,
- 984,
- 979,
- 973,
- 968,
- 962,
- 955,
- 949,
- 942,
- 935,
- 928,
- 920,
- 912,
- 904,
- 895,
- 886,
- 877,
- 868,
- 858,
- 848,
- 838,
- 828,
- 817,
- 806,
- 795,
- 784,
- 772,
- 760,
- 748,
- 736,
- 724,
- 711,
- 698,
- 685,
- 671,
- 658,
- 644,
- 630,
- 616,
- 601,
- 587,
- 572,
- 557,
- 542,
- 527,
- 512,
- 496,
- 480,
- 464,
- 448,
- 432,
- 416,
- 400,
- 383,
- 366,
- 350,
- 333,
- 316,
- 299,
- 282,
- 265,
- 247,
- 230,
- 212,
- 195,
- 177,
- 160,
- 142,
- 124,
- 107,
- 89,
- 71,
- 53,
- 35,
- 17,
- 0,
- -17,
- -35,
- -53,
- -71,
- -89,
- -107,
- -124,
- -142,
- -160,
- -177,
- -195,
- -212,
- -230,
- -247,
- -265,
- -282,
- -299,
- -316,
- -333,
- -350,
- -366,
- -383,
- -400,
- -416,
- -432,
- -448,
- -464,
- -480,
- -496,
- -512,
- -527,
- -542,
- -557,
- -572,
- -587,
- -601,
- -616,
- -630,
- -644,
- -658,
- -671,
- -685,
- -698,
- -711,
- -724,
- -736,
- -748,
- -760,
- -772,
- -784,
- -795,
- -806,
- -817,
- -828,
- -838,
- -848,
- -858,
- -868,
- -877,
- -886,
- -895,
- -904,
- -912,
- -920,
- -928,
- -935,
- -942,
- -949,
- -955,
- -962,
- -968,
- -973,
- -979,
- -984,
- -989,
- -993,
- -997,
- -1001,
- -1005,
- -1008,
- -1011,
- -1014,
- -1016,
- -1018,
- -1020,
- -1021,
- -1022,
- -1023,
- -1023,
- -1024,
- -1023,
- -1023,
- -1022,
- -1021,
- -1020,
- -1018,
- -1016,
- -1014,
- -1011,
- -1008,
- -1005,
- -1001,
- -997,
- -993,
- -989,
- -984,
- -979,
- -973,
- -968,
- -962,
- -955,
- -949,
- -942,
- -935,
- -928,
- -920,
- -912,
- -904,
- -895,
- -886,
- -877,
- -868,
- -858,
- -848,
- -838,
- -828,
- -817,
- -806,
- -795,
- -784,
- -772,
- -760,
- -748,
- -736,
- -724,
- -711,
- -698,
- -685,
- -671,
- -658,
- -644,
- -630,
- -616,
- -601,
- -587,
- -572,
- -557,
- -542,
- -527,
- -512,
- -496,
- -480,
- -464,
- -448,
- -432,
- -416,
- -400,
- -383,
- -366,
- -350,
- -333,
- -316,
- -299,
- -282,
- -265,
- -247,
- -230,
- -212,
- -195,
- -177,
- -160,
- -142,
- -124,
- -107,
- -89,
- -71,
- -53,
- -35,
- -17,
- 0,
- 17,
- 35,
- 53,
- 71,
- 89,
- 107,
- 124,
- 142,
- 160,
- 177,
- 195,
- 212,
- 230,
- 247,
- 265,
- 282,
- 299,
- 316,
- 333,
- 350,
- 366,
- 383,
- 400,
- 416,
- 432,
- 448,
- 464,
- 480,
- 496,
- 512,
- 527,
- 542,
- 557,
- 572,
- 587,
- 601,
- 616,
- 630,
- 644,
- 658,
- 671,
- 685,
- 698,
- 711,
- 724,
- 736,
- 748,
- 760,
- 772,
- 784,
- 795,
- 806,
- 817,
- 828,
- 838,
- 848,
- 858,
- 868,
- 877,
- 886,
- 895,
- 904,
- 912,
- 920,
- 928,
- 935,
- 942,
- 949,
- 955,
- 962,
- 968,
- 973,
- 979,
- 984,
- 989,
- 993,
- 997,
- 1001,
- 1005,
- 1008,
- 1011,
- 1014,
- 1016,
- 1018,
- 1020,
- 1021,
- 1022,
- 1023,
- 1023
-};
-
-int gdSinT[] =
-{
- 0,
- 17,
- 35,
- 53,
- 71,
- 89,
- 107,
- 124,
- 142,
- 160,
- 177,
- 195,
- 212,
- 230,
- 247,
- 265,
- 282,
- 299,
- 316,
- 333,
- 350,
- 366,
- 383,
- 400,
- 416,
- 432,
- 448,
- 464,
- 480,
- 496,
- 512,
- 527,
- 542,
- 557,
- 572,
- 587,
- 601,
- 616,
- 630,
- 644,
- 658,
- 671,
- 685,
- 698,
- 711,
- 724,
- 736,
- 748,
- 760,
- 772,
- 784,
- 795,
- 806,
- 817,
- 828,
- 838,
- 848,
- 858,
- 868,
- 877,
- 886,
- 895,
- 904,
- 912,
- 920,
- 928,
- 935,
- 942,
- 949,
- 955,
- 962,
- 968,
- 973,
- 979,
- 984,
- 989,
- 993,
- 997,
- 1001,
- 1005,
- 1008,
- 1011,
- 1014,
- 1016,
- 1018,
- 1020,
- 1021,
- 1022,
- 1023,
- 1023,
- 1024,
- 1023,
- 1023,
- 1022,
- 1021,
- 1020,
- 1018,
- 1016,
- 1014,
- 1011,
- 1008,
- 1005,
- 1001,
- 997,
- 993,
- 989,
- 984,
- 979,
- 973,
- 968,
- 962,
- 955,
- 949,
- 942,
- 935,
- 928,
- 920,
- 912,
- 904,
- 895,
- 886,
- 877,
- 868,
- 858,
- 848,
- 838,
- 828,
- 817,
- 806,
- 795,
- 784,
- 772,
- 760,
- 748,
- 736,
- 724,
- 711,
- 698,
- 685,
- 671,
- 658,
- 644,
- 630,
- 616,
- 601,
- 587,
- 572,
- 557,
- 542,
- 527,
- 512,
- 496,
- 480,
- 464,
- 448,
- 432,
- 416,
- 400,
- 383,
- 366,
- 350,
- 333,
- 316,
- 299,
- 282,
- 265,
- 247,
- 230,
- 212,
- 195,
- 177,
- 160,
- 142,
- 124,
- 107,
- 89,
- 71,
- 53,
- 35,
- 17,
- 0,
- -17,
- -35,
- -53,
- -71,
- -89,
- -107,
- -124,
- -142,
- -160,
- -177,
- -195,
- -212,
- -230,
- -247,
- -265,
- -282,
- -299,
- -316,
- -333,
- -350,
- -366,
- -383,
- -400,
- -416,
- -432,
- -448,
- -464,
- -480,
- -496,
- -512,
- -527,
- -542,
- -557,
- -572,
- -587,
- -601,
- -616,
- -630,
- -644,
- -658,
- -671,
- -685,
- -698,
- -711,
- -724,
- -736,
- -748,
- -760,
- -772,
- -784,
- -795,
- -806,
- -817,
- -828,
- -838,
- -848,
- -858,
- -868,
- -877,
- -886,
- -895,
- -904,
- -912,
- -920,
- -928,
- -935,
- -942,
- -949,
- -955,
- -962,
- -968,
- -973,
- -979,
- -984,
- -989,
- -993,
- -997,
- -1001,
- -1005,
- -1008,
- -1011,
- -1014,
- -1016,
- -1018,
- -1020,
- -1021,
- -1022,
- -1023,
- -1023,
- -1024,
- -1023,
- -1023,
- -1022,
- -1021,
- -1020,
- -1018,
- -1016,
- -1014,
- -1011,
- -1008,
- -1005,
- -1001,
- -997,
- -993,
- -989,
- -984,
- -979,
- -973,
- -968,
- -962,
- -955,
- -949,
- -942,
- -935,
- -928,
- -920,
- -912,
- -904,
- -895,
- -886,
- -877,
- -868,
- -858,
- -848,
- -838,
- -828,
- -817,
- -806,
- -795,
- -784,
- -772,
- -760,
- -748,
- -736,
- -724,
- -711,
- -698,
- -685,
- -671,
- -658,
- -644,
- -630,
- -616,
- -601,
- -587,
- -572,
- -557,
- -542,
- -527,
- -512,
- -496,
- -480,
- -464,
- -448,
- -432,
- -416,
- -400,
- -383,
- -366,
- -350,
- -333,
- -316,
- -299,
- -282,
- -265,
- -247,
- -230,
- -212,
- -195,
- -177,
- -160,
- -142,
- -124,
- -107,
- -89,
- -71,
- -53,
- -35,
- -17
-};
diff --git a/ext/gd/libgd/gdtest.c b/ext/gd/libgd/gdtest.c
deleted file mode 100644
index f4300bb3fd..0000000000
--- a/ext/gd/libgd/gdtest.c
+++ /dev/null
@@ -1,409 +0,0 @@
-#include <stdio.h>
-#ifdef _WIN32
-#include <process.h>
-int
-unlink (const char *filename)
-{
- return _unlink (filename);
-}
-#else
-#include <unistd.h> /* for getpid(), unlink() */
-#endif
-#include "gd.h"
-
-void CompareImages (char *msg, gdImagePtr im1, gdImagePtr im2);
-
-static int freadWrapper (void *context, char *buf, int len);
-static int fwriteWrapper (void *context, const char *buffer, int len);
-
-int
-main (int argc, char **argv)
-{
- gdImagePtr im, ref, im2, im3;
- FILE *in, *out;
- void *iptr;
- int sz;
- gdIOCtxPtr ctx;
- char of[256];
- int colRed, colBlu;
- gdSource imgsrc;
- gdSink imgsnk;
- int foreground;
- int i;
- if (argc != 2)
- {
- fprintf (stderr, "Usage: gdtest filename.png\n");
- exit (1);
- }
- in = fopen (argv[1], "rb");
- if (!in)
- {
- fprintf (stderr, "Input file does not exist!\n");
- exit (1);
- }
- im = gdImageCreateFromPng (in);
-
- rewind (in);
- ref = gdImageCreateFromPng (in);
-
- fclose (in);
-
- printf ("Reference File has %d Palette entries\n", ref->colorsTotal);
-
- CompareImages ("Initial Versions", ref, im);
-
-
- /* */
- /* Send to PNG File then Ptr */
- /* */
- sprintf (of, "%s.png", argv[1]);
- out = fopen (of, "wb");
- gdImagePng (im, out);
- fclose (out);
-
- in = fopen (of, "rb");
- if (!in)
- {
- fprintf (stderr, "PNG Output file does not exist!\n");
- exit (1);
- }
- im2 = gdImageCreateFromPng (in);
- fclose (in);
-
- CompareImages ("GD->PNG File->GD", ref, im2);
-
- unlink (of);
- gdImageDestroy (im2);
-
- iptr = gdImagePngPtr (im, &sz);
- ctx = gdNewDynamicCtx (sz, iptr);
- im2 = gdImageCreateFromPngCtx (ctx);
-
- CompareImages ("GD->PNG ptr->GD", ref, im2);
-
- gdImageDestroy (im2);
- ctx->gd_free (ctx);
-
-
- /* */
- /* Send to GD2 File then Ptr */
- /* */
- sprintf (of, "%s.gd2", argv[1]);
- out = fopen (of, "wb");
- gdImageGd2 (im, out, 128, 2);
- fclose (out);
-
- in = fopen (of, "rb");
- if (!in)
- {
- fprintf (stderr, "GD2 Output file does not exist!\n");
- exit (1);
- }
- im2 = gdImageCreateFromGd2 (in);
- fclose (in);
-
- CompareImages ("GD->GD2 File->GD", ref, im2);
-
- unlink (of);
- gdImageDestroy (im2);
-
- iptr = gdImageGd2Ptr (im, 128, 2, &sz);
- /*printf("Got ptr %d (size %d)\n",iptr, sz); */
- ctx = gdNewDynamicCtx (sz, iptr);
- /*printf("Got ctx %d\n",ctx); */
- im2 = gdImageCreateFromGd2Ctx (ctx);
- /*printf("Got img2 %d\n",im2); */
-
- CompareImages ("GD->GD2 ptr->GD", ref, im2);
-
- gdImageDestroy (im2);
- ctx->gd_free (ctx);
-
-
- /* */
- /* Send to GD File then Ptr */
- /* */
- sprintf (of, "%s.gd", argv[1]);
- out = fopen (of, "wb");
- gdImageGd (im, out);
- fclose (out);
-
- in = fopen (of, "rb");
- if (!in)
- {
- fprintf (stderr, "GD Output file does not exist!\n");
- exit (1);
- }
- im2 = gdImageCreateFromGd (in);
- fclose (in);
-
- CompareImages ("GD->GD File->GD", ref, im2);
-
- unlink (of);
- gdImageDestroy (im2);
-
- iptr = gdImageGdPtr (im, &sz);
- /*printf("Got ptr %d (size %d)\n",iptr, sz); */
- ctx = gdNewDynamicCtx (sz, iptr);
- /*printf("Got ctx %d\n",ctx); */
- im2 = gdImageCreateFromGdCtx (ctx);
- /*printf("Got img2 %d\n",im2); */
-
- CompareImages ("GD->GD ptr->GD", ref, im2);
-
- gdImageDestroy (im2);
- ctx->gd_free (ctx);
-
- /*
- ** Test gdImageCreateFromPngSource'
- * */
-
- in = fopen (argv[1], "rb");
-
- imgsrc.source = freadWrapper;
- imgsrc.context = in;
- im2 = gdImageCreateFromPngSource (&imgsrc);
- fclose (in);
-
- if (im2 == NULL)
- {
- printf ("GD Source: ERROR Null returned by gdImageCreateFromPngSource\n");
- }
- else
- {
- CompareImages ("GD Source", ref, im2);
- gdImageDestroy (im2);
- };
-
-
- /*
- ** Test gdImagePngToSink'
- * */
-
- sprintf (of, "%s.snk", argv[1]);
- out = fopen (of, "wb");
- imgsnk.sink = fwriteWrapper;
- imgsnk.context = out;
- gdImagePngToSink (im, &imgsnk);
- fclose (out);
- in = fopen (of, "rb");
- if (!in)
- {
- fprintf (stderr, "GD Sink: ERROR - GD Sink Output file does not exist!\n");
- }
- else
- {
- im2 = gdImageCreateFromPng (in);
- fclose (in);
-
- CompareImages ("GD Sink", ref, im2);
- gdImageDestroy (im2);
- };
-
- unlink (of);
-
- /* */
- /* Test Extraction */
- /* */
- in = fopen ("test/gdtest_200_300_150_100.png", "rb");
- if (!in)
- {
- fprintf (stderr, "gdtest_200_300_150_100.png does not exist!\n");
- exit (1);
- }
- im2 = gdImageCreateFromPng (in);
- fclose (in);
-
-
- in = fopen ("test/gdtest.gd2", "rb");
- if (!in)
- {
- fprintf (stderr, "gdtest.gd2 does not exist!\n");
- exit (1);
- }
- im3 = gdImageCreateFromGd2Part (in, 200, 300, 150, 100);
- fclose (in);
-
- CompareImages ("GD2Part (gdtest_200_300_150_100.png, gdtest.gd2(part))", im2, im3);
-
- gdImageDestroy (im2);
- gdImageDestroy (im3);
-
- /* */
- /* Copy Blend */
- /* */
- in = fopen ("test/gdtest.png", "rb");
- if (!in)
- {
- fprintf (stderr, "gdtest.png does not exist!\n");
- exit (1);
- }
- im2 = gdImageCreateFromPng (in);
- fclose (in);
-
- im3 = gdImageCreate (100, 60);
- colRed = gdImageColorAllocate (im3, 255, 0, 0);
- colBlu = gdImageColorAllocate (im3, 0, 0, 255);
- gdImageFilledRectangle (im3, 0, 0, 49, 30, colRed);
- gdImageFilledRectangle (im3, 50, 30, 99, 59, colBlu);
-
- gdImageCopyMerge (im2, im3, 150, 200, 10, 10, 90, 50, 50);
- gdImageCopyMerge (im2, im3, 180, 70, 10, 10, 90, 50, 50);
-
- gdImageCopyMergeGray (im2, im3, 250, 160, 10, 10, 90, 50, 50);
- gdImageCopyMergeGray (im2, im3, 80, 70, 10, 10, 90, 50, 50);
-
- gdImageDestroy (im3);
-
- in = fopen ("test/gdtest_merge.png", "rb");
- if (!in)
- {
- fprintf (stderr, "gdtest_merge.png does not exist!\n");
- exit (1);
- }
- im3 = gdImageCreateFromPng (in);
- fclose (in);
-
- printf ("[Merged Image has %d colours]\n", im2->colorsTotal);
- CompareImages ("Merged (gdtest.png, gdtest_merge.png)", im2, im3);
-
- gdImageDestroy (im2);
- gdImageDestroy (im3);
-
-#ifdef HAVE_JPEG
- out = fopen ("test/gdtest.jpg", "wb");
- if (!out)
- {
- fprintf (stderr, "Can't create file test/gdtest.jpg.\n");
- exit (1);
- }
- gdImageJpeg (im, out, -1);
- fclose (out);
- in = fopen ("test/gdtest.jpg", "rb");
- if (!in)
- {
- fprintf (stderr, "Can't open file test/gdtest.jpg.\n");
- exit (1);
- }
- im2 = gdImageCreateFromJpeg (in);
- fclose (in);
- if (!im2)
- {
- fprintf (stderr, "gdImageCreateFromJpeg failed.\n");
- exit (1);
- }
- gdImageDestroy (im2);
- printf ("Created test/gdtest.jpg successfully. Compare this image\n"
- "to the input image manually. Some difference must be\n"
- "expected as JPEG is a lossy file format.\n");
-#endif /* HAVE_JPEG */
- /* Assume the color closest to black is the foreground
- color for the B&W wbmp image. */
- fprintf (stderr, "NOTE: the WBMP output image will NOT match the original unless the original\n"
- "is also black and white. This is OK!\n");
- foreground = gdImageColorClosest (im, 0, 0, 0);
- fprintf (stderr, "Foreground index is %d\n", foreground);
- if (foreground == -1)
- {
- fprintf (stderr, "Source image has no colors, skipping wbmp test.\n");
- }
- else
- {
- out = fopen ("test/gdtest.wbmp", "wb");
- if (!out)
- {
- fprintf (stderr, "Can't create file test/gdtest.wbmp.\n");
- exit (1);
- }
- gdImageWBMP (im, foreground, out);
- fclose (out);
- in = fopen ("test/gdtest.wbmp", "rb");
- if (!in)
- {
- fprintf (stderr, "Can't open file test/gdtest.wbmp.\n");
- exit (1);
- }
- im2 = gdImageCreateFromWBMP (in);
- fprintf (stderr, "WBMP has %d colors\n", gdImageColorsTotal (im2));
- fprintf (stderr, "WBMP colors are:\n");
- for (i = 0; (i < gdImageColorsTotal (im2)); i++)
- {
- fprintf (stderr, "%02X%02X%02X\n",
- gdImageRed (im2, i),
- gdImageGreen (im2, i),
- gdImageBlue (im2, i));
- }
- fclose (in);
- if (!im2)
- {
- fprintf (stderr, "gdImageCreateFromWBMP failed.\n");
- exit (1);
- }
- CompareImages ("WBMP test (gdtest.png, gdtest.wbmp)", ref, im2);
- out = fopen ("test/gdtest_wbmp_to_png.png", "wb");
- if (!out)
- {
- fprintf (stderr, "Can't create file test/gdtest_wbmp_to_png.png.\n");
- exit (1);
- }
- gdImagePng (im2, out);
- fclose (out);
- gdImageDestroy (im2);
- }
- gdImageDestroy (im);
- gdImageDestroy (ref);
-
- return 0;
-}
-
-void
-CompareImages (char *msg, gdImagePtr im1, gdImagePtr im2)
-{
- int cmpRes;
-
- cmpRes = gdImageCompare (im1, im2);
-
- if (cmpRes & GD_CMP_IMAGE)
- {
- printf ("%%%s: ERROR images differ: BAD\n", msg);
- }
- else if (cmpRes != 0)
- {
- printf ("%%%s: WARNING images differ: WARNING - Probably OK\n", msg);
- }
- else
- {
- printf ("%%%s: OK\n", msg);
- return;
- }
-
- if (cmpRes & (GD_CMP_SIZE_X + GD_CMP_SIZE_Y))
- {
- printf ("-%s: INFO image sizes differ\n", msg);
- }
-
- if (cmpRes & GD_CMP_NUM_COLORS)
- {
- printf ("-%s: INFO number of pallette entries differ %d Vs. %d\n", msg,
- im1->colorsTotal, im2->colorsTotal);
- }
-
- if (cmpRes & GD_CMP_COLOR)
- {
- printf ("-%s: INFO actual colours of pixels differ\n", msg);
- }
-}
-
-
-static int
-freadWrapper (void *context, char *buf, int len)
-{
- int got = fread (buf, 1, len, (FILE *) context);
- return got;
-}
-
-static int
-fwriteWrapper (void *context, const char *buffer, int len)
-{
- return fwrite (buffer, 1, len, (FILE *) context);
-}
diff --git a/ext/gd/libgd/gdtestft.c b/ext/gd/libgd/gdtestft.c
deleted file mode 100644
index 1bd0dfc515..0000000000
--- a/ext/gd/libgd/gdtestft.c
+++ /dev/null
@@ -1,108 +0,0 @@
-
-#include "gd.h"
-#include <string.h>
-
-#define PI 3.141592
-#define DEG2RAD(x) ((x)*PI/180.)
-
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-
-#define MAX4(x,y,z,w) \
- ((MAX((x),(y))) > (MAX((z),(w))) ? (MAX((x),(y))) : (MAX((z),(w))))
-#define MIN4(x,y,z,w) \
- ((MIN((x),(y))) < (MIN((z),(w))) ? (MIN((x),(y))) : (MIN((z),(w))))
-
-#define MAXX(x) MAX4(x[0],x[2],x[4],x[6])
-#define MINX(x) MIN4(x[0],x[2],x[4],x[6])
-#define MAXY(x) MAX4(x[1],x[3],x[5],x[7])
-#define MINY(x) MIN4(x[1],x[3],x[5],x[7])
-
-int
-main (int argc, char *argv[])
-{
-#ifndef HAVE_LIBFREETYPE
- fprintf (stderr, "gd was not compiled with HAVE_LIBFREETYPE defined.\n");
- fprintf (stderr, "Install the FreeType library, including the\n");
- fprintf (stderr, "header files. Then edit the gd Makefile, type\n");
- fprintf (stderr, "make clean, and type make again.\n");
- return 1;
-#else
- gdImagePtr im;
- int black;
- int white;
- int brect[8];
- int x, y;
- char *err;
- FILE *out;
-#ifdef JISX0208
- char *s = "Hello. ‚±‚ñ‚É‚¿‚Í Qyjpqg,"; /* String to draw. */
-#else
- char *s = "Hello. Qyjpqg,"; /* String to draw. */
-#endif
-
- double sz = 40.;
-
-#if 0
- double angle = 0.;
-#else
- double angle = DEG2RAD (-90);
-#endif
-
-#ifdef JISX0208
- char *f = "/usr/openwin/lib/locale/ja/X11/fonts/TT/HG-MinchoL.ttf"; /* UNICODE */
- /* char *f = "/usr/local/lib/fonts/truetype/DynaFont/dfpop1.ttf"; *//* SJIS */
-#else
- char *f = "times"; /* TrueType font */
-#endif
-
- /* obtain brect so that we can size the image */
- err = gdImageStringFT ((gdImagePtr) NULL, &brect[0], 0, f, sz, angle, 0, 0, s);
- if (err)
- {
- fprintf (stderr, "%s", err);
- return 1;
- }
-
- /* create an image just big enough for the string */
- x = MAXX (brect) - MINX (brect) + 6;
- y = MAXY (brect) - MINY (brect) + 6;
-#if 0
- im = gdImageCreate (500, 500);
-#else
- /* gd 2.0: true color images can use freetype too */
- im = gdImageCreateTrueColor (x, y);
-#endif
-
- /* Background color. gd 2.0: fill the image with it; truecolor
- images have a black background otherwise. */
- white = gdImageColorResolve (im, 255, 255, 255);
- gdImageFilledRectangle (im, 0, 0, x, y, white);
- black = gdImageColorResolve (im, 0, 0, 0);
-
- /* render the string, offset origin to center string */
- x = 0 - MINX (brect) + 3;
- y = 0 - MINY (brect) + 3;
-
- err = gdImageStringFT (im, NULL, black, f, sz, angle, x, y, s);
- if (err)
- {
- fprintf (stderr, "%s", err);
- return 1;
- }
- /* TBB: Write img to test/fttest.png */
- out = fopen ("test/fttest.png", "wb");
- if (!out)
- {
- fprintf (stderr, "Can't create test/fttest.png\n");
- exit (1);
- }
- gdImagePng (im, out);
- fclose (out);
- fprintf (stderr, "Test image written to test/fttest.png\n");
- /* Destroy it */
- gdImageDestroy (im);
-
- return 0;
-#endif /* HAVE_FREETYPE */
-}
diff --git a/ext/gd/libgd/gdtopng.c b/ext/gd/libgd/gdtopng.c
deleted file mode 100644
index 9de34990ab..0000000000
--- a/ext/gd/libgd/gdtopng.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <stdio.h>
-#include "gd.h"
-
-/* A short program which converts a .png file into a .gd file, for
- your convenience in creating images on the fly from a
- basis image that must be loaded quickly. The .gd format
- is not intended to be a general-purpose format. */
-
-int
-main (int argc, char **argv)
-{
- gdImagePtr im;
- FILE *in, *out;
- if (argc != 3)
- {
- fprintf (stderr, "Usage: gdtopng filename.gd filename.png\n");
- exit (1);
- }
- in = fopen (argv[1], "rb");
- if (!in)
- {
- fprintf (stderr, "Input file does not exist!\n");
- exit (1);
- }
- im = gdImageCreateFromGd (in);
- fclose (in);
- if (!im)
- {
- fprintf (stderr, "Input is not in PNG format!\n");
- exit (1);
- }
- out = fopen (argv[2], "wb");
- if (!out)
- {
- fprintf (stderr, "Output file cannot be written to!\n");
- gdImageDestroy (im);
- exit (1);
- }
- gdImagePng (im, out);
- fclose (out);
- gdImageDestroy (im);
-
- return 0;
-}
diff --git a/ext/gd/libgd/gdxpm.c b/ext/gd/libgd/gdxpm.c
deleted file mode 100644
index bc9ff4dad7..0000000000
--- a/ext/gd/libgd/gdxpm.c
+++ /dev/null
@@ -1,139 +0,0 @@
-
-/*
- add ability to load xpm files to gd, requires the xpm
- library.
- Caolan.McNamara@ul.ie
- http://www.csn.ul.ie/~caolan
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "gd.h"
-#include "gdhelpers.h"
-
-#ifdef HAVE_XPM
-
-#include <X11/xpm.h>
-
-gdImagePtr gdImageCreateFromXpm (char *filename)
-{
- XpmInfo info;
- XpmImage image;
- int i, j, k, number;
- char buf[5];
- gdImagePtr im = 0;
- char *apixel;
- int *pointer;
- int red = 0, green = 0, blue = 0;
- int *colors;
- int ret;
-
- ret = XpmReadFileToXpmImage(filename, &image, &info);
- if (ret != XpmSuccess) {
- return 0;
- }
-
- if (!(im = gdImageCreate(image.width, image.height))) {
- return 0;
- }
-
- number = image.ncolors;
- colors = (int *) gdMalloc (sizeof (int) * number);
- for (i = 0; i < number; i++) {
- switch (strlen (image.colorTable[i].c_color)) {
- case 4:
- buf[1] = '\0';
- buf[0] = image.colorTable[i].c_color[1];
- red = strtol(buf, NULL, 16);
-
- buf[0] = image.colorTable[i].c_color[3];
- green = strtol(buf, NULL, 16);
-
- buf[0] = image.colorTable[i].c_color[5];
- blue = strtol(buf, NULL, 16);
- break;
-
- case 7:
- buf[2] = '\0';
- buf[0] = image.colorTable[i].c_color[1];
- buf[1] = image.colorTable[i].c_color[2];
- red = strtol(buf, NULL, 16);
-
- buf[0] = image.colorTable[i].c_color[3];
- buf[1] = image.colorTable[i].c_color[4];
- green = strtol(buf, NULL, 16);
-
- buf[0] = image.colorTable[i].c_color[5];
- buf[1] = image.colorTable[i].c_color[6];
- blue = strtol(buf, NULL, 16);
- break;
-
- case 10:
- buf[3] = '\0';
- buf[0] = image.colorTable[i].c_color[1];
- buf[1] = image.colorTable[i].c_color[2];
- buf[2] = image.colorTable[i].c_color[3];
- red = strtol(buf, NULL, 16);
- red /= 64;
-
- buf[0] = image.colorTable[i].c_color[4];
- buf[1] = image.colorTable[i].c_color[5];
- buf[2] = image.colorTable[i].c_color[6];
- green = strtol(buf, NULL, 16);
- green /= 64;
-
- buf[0] = image.colorTable[i].c_color[7];
- buf[1] = image.colorTable[i].c_color[8];
- buf[2] = image.colorTable[i].c_color[9];
- blue = strtol(buf, NULL, 16);
- blue /= 64;
- break;
-
- case 13:
- buf[4] = '\0';
- buf[0] = image.colorTable[i].c_color[1];
- buf[1] = image.colorTable[i].c_color[2];
- buf[2] = image.colorTable[i].c_color[3];
- buf[3] = image.colorTable[i].c_color[4];
- red = strtol(buf, NULL, 16);
- red /= 256;
-
- buf[0] = image.colorTable[i].c_color[5];
- buf[1] = image.colorTable[i].c_color[6];
- buf[2] = image.colorTable[i].c_color[7];
- buf[3] = image.colorTable[i].c_color[8];
- green = strtol(buf, NULL, 16);
- green /= 256;
-
- buf[0] = image.colorTable[i].c_color[9];
- buf[1] = image.colorTable[i].c_color[10];
- buf[2] = image.colorTable[i].c_color[11];
- buf[3] = image.colorTable[i].c_color[12];
- blue = strtol(buf, NULL, 16);
- blue /= 256;
- break;
- }
-
-
- colors[i] = gdImageColorResolve(im, red, green, blue);
- if (colors[i] == -1) {
- php_gd_error("ARRRGH\n");
- }
- }
-
- apixel = (char *) gdMalloc(image.cpp + 1);
- apixel[image.cpp] = '\0';
-
- pointer = (int *) image.data;
- for (i = 0; i < image.height; i++) {
- for (j = 0; j < image.width; j++) {
- k = *pointer++;
- gdImageSetPixel(im, j, i, colors[k]);
- }
- }
-
- gdFree(apixel);
- gdFree(colors);
- return im;
-}
-#endif
diff --git a/ext/gd/libgd/jisx0208.h b/ext/gd/libgd/jisx0208.h
deleted file mode 100644
index f8a8b510fa..0000000000
--- a/ext/gd/libgd/jisx0208.h
+++ /dev/null
@@ -1,1205 +0,0 @@
-#ifndef JISX0208_H
-#define JISX0208_H
-/* This file was derived from "src/VF_Ftype.c" in VFlib2-2.24.2
- by Dr. Kakugawa */
-
-/* JIS -> Unicode mapping table */
-static unsigned short UnicodeTbl[][94] = {
-{ /* category 01 */
-0x0000, 0x3001, 0x3002, 0xFF0C, 0xFF0E, 0x30FB, 0xFF1A, 0xFF1B,
-0xFF1F, 0xFF01, 0x309B, 0x309C, 0x00B4, 0xFF40, 0x00A8, 0xFF3E,
-0xFFE3, 0xFF3F, 0x30FD, 0x30FE, 0x309D, 0x309E, 0x3003, 0x4EDD,
-0x3005, 0x3006, 0x3007, 0x30FC, 0x2015, 0x2010, 0xFF0F, 0xFF3C,
-0xFF5E, 0x2225, 0xFF5C, 0x2026, 0x2025, 0x2018, 0x2019, 0x201C,
-0x201D, 0xFF08, 0xFF09, 0x3014, 0x3015, 0xFF3B, 0xFF3D, 0xFF5B,
-0xFF5D, 0x3008, 0x3009, 0x300A, 0x300B, 0x300C, 0x300D, 0x300E,
-0x300F, 0x3010, 0x3011, 0xFF0B, 0xFF0D, 0x00B1, 0x00D7, 0x00F7,
-0xFF1D, 0x2260, 0xFF1C, 0xFF1E, 0x2266, 0x2267, 0x221E, 0x2234,
-0x2642, 0x2640, 0x00B0, 0x2032, 0x2033, 0x2103, 0xFFE5, 0xFF04,
-0xFFE0, 0xFFE1, 0xFF05, 0xFF03, 0xFF06, 0xFF0A, 0xFF20, 0x00A7,
-0x2606, 0x2605, 0x25CB, 0x25CF, 0x25CE, 0x25C7},
-{ /* category 02 */
-0x25C6, 0x25A1, 0x25A0, 0x25B3, 0x25B2, 0x25BD, 0x25BC, 0x203B,
-0x3012, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x2208, 0x220B, 0x2286, 0x2287, 0x2282, 0x2283, 0x222A,
-0x2229, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x2227, 0x2228, 0xFFE2, 0x21D2, 0x21D4, 0x2200, 0x2203,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x2220, 0x22A5, 0x2312, 0x2202, 0x2207,
-0x2261, 0x2252, 0x226A, 0x226B, 0x221A, 0x223D, 0x221D, 0x2235,
-0x222B, 0x222C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x212B, 0x2030, 0x266F, 0x266D, 0x266A, 0x2020, 0x2021, /**/
-0x00B6, 0x0000, 0x0000, 0x0000, 0x0000, 0x25EF},
-{ /* category 03 */
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFF10,
-0xFF11, 0xFF12, 0xFF13, 0xFF14, 0xFF15, 0xFF16, 0xFF17, 0xFF18,
-0xFF19, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0xFF21, 0xFF22, 0xFF23, 0xFF24, 0xFF25, 0xFF26, 0xFF27, 0xFF28,
-0xFF29, 0xFF2A, 0xFF2B, 0xFF2C, 0xFF2D, 0xFF2E, 0xFF2F, 0xFF30,
-0xFF31, 0xFF32, 0xFF33, 0xFF34, 0xFF35, 0xFF36, 0xFF37, 0xFF38,
-0xFF39, 0xFF3A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0xFF41, 0xFF42, 0xFF43, 0xFF44, 0xFF45, 0xFF46, 0xFF47, 0xFF48,
-0xFF49, 0xFF4A, 0xFF4B, 0xFF4C, 0xFF4D, 0xFF4E, 0xFF4F, 0xFF50,
-0xFF51, 0xFF52, 0xFF53, 0xFF54, 0xFF55, 0xFF56, 0xFF57, 0xFF58,
-0xFF59, 0xFF5A, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 04 */
-0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048,
-0x3049, 0x304A, 0x304B, 0x304C, 0x304D, 0x304E, 0x304F, 0x3050,
-0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058,
-0x3059, 0x305A, 0x305B, 0x305C, 0x305D, 0x305E, 0x305F, 0x3060,
-0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068,
-0x3069, 0x306A, 0x306B, 0x306C, 0x306D, 0x306E, 0x306F, 0x3070,
-0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078,
-0x3079, 0x307A, 0x307B, 0x307C, 0x307D, 0x307E, 0x307F, 0x3080,
-0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088,
-0x3089, 0x308A, 0x308B, 0x308C, 0x308D, 0x308E, 0x308F, 0x3090,
-0x3091, 0x3092, 0x3093, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 05 */
-0x30A1, 0x30A2, 0x30A3, 0x30A4, 0x30A5, 0x30A6, 0x30A7, 0x30A8,
-0x30A9, 0x30AA, 0x30AB, 0x30AC, 0x30AD, 0x30AE, 0x30AF, 0x30B0,
-0x30B1, 0x30B2, 0x30B3, 0x30B4, 0x30B5, 0x30B6, 0x30B7, 0x30B8,
-0x30B9, 0x30BA, 0x30BB, 0x30BC, 0x30BD, 0x30BE, 0x30BF, 0x30C0,
-0x30C1, 0x30C2, 0x30C3, 0x30C4, 0x30C5, 0x30C6, 0x30C7, 0x30C8,
-0x30C9, 0x30CA, 0x30CB, 0x30CC, 0x30CD, 0x30CE, 0x30CF, 0x30D0,
-0x30D1, 0x30D2, 0x30D3, 0x30D4, 0x30D5, 0x30D6, 0x30D7, 0x30D8,
-0x30D9, 0x30DA, 0x30DB, 0x30DC, 0x30DD, 0x30DE, 0x30DF, 0x30E0,
-0x30E1, 0x30E2, 0x30E3, 0x30E4, 0x30E5, 0x30E6, 0x30E7, 0x30E8,
-0x30E9, 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EE, 0x30EF, 0x30F0,
-0x30F1, 0x30F2, 0x30F3, 0x30F4, 0x30F5, 0x30F6, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 06 */
-0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398,
-0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0,
-0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8,
-0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0,
-0x03C1, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 07 */
-0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, 0x0416,
-0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E,
-0x041F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426,
-0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E,
-0x042F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436,
-0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E,
-0x043F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446,
-0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E,
-0x044F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 08 */
-0x2500, 0x2502, 0x250C, 0x2510, 0x2518, 0x2514, 0x251C, 0x252C,
-0x2524, 0x2534, 0x253C, 0x2501, 0x2503, 0x250F, 0x2513, 0x251B,
-0x2517, 0x2523, 0x2533, 0x252B, 0x253B, 0x254B, 0x2520, 0x252F,
-0x2528, 0x2537, 0x253F, 0x251D, 0x2530, 0x2525, 0x2538, 0x2542,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 09 */
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 10 */
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 11 */
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 12 */
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 13 */
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 14 */
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 15 */
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 16 */
-0x4E9C, 0x5516, 0x5A03, 0x963F, 0x54C0, 0x611B, 0x6328, 0x59F6,
-0x9022, 0x8475, 0x831C, 0x7A50, 0x60AA, 0x63E1, 0x6E25, 0x65ED,
-0x8466, 0x82A6, 0x9BF5, 0x6893, 0x5727, 0x65A1, 0x6271, 0x5B9B,
-0x59D0, 0x867B, 0x98F4, 0x7D62, 0x7DBE, 0x9B8E, 0x6216, 0x7C9F,
-0x88B7, 0x5B89, 0x5EB5, 0x6309, 0x6697, 0x6848, 0x95C7, 0x978D,
-0x674F, 0x4EE5, 0x4F0A, 0x4F4D, 0x4F9D, 0x5049, 0x56F2, 0x5937,
-0x59D4, 0x5A01, 0x5C09, 0x60DF, 0x610F, 0x6170, 0x6613, 0x6905,
-0x70BA, 0x754F, 0x7570, 0x79FB, 0x7DAD, 0x7DEF, 0x80C3, 0x840E,
-0x8863, 0x8B02, 0x9055, 0x907A, 0x533B, 0x4E95, 0x4EA5, 0x57DF,
-0x80B2, 0x90C1, 0x78EF, 0x4E00, 0x58F1, 0x6EA2, 0x9038, 0x7A32,
-0x8328, 0x828B, 0x9C2F, 0x5141, 0x5370, 0x54BD, 0x54E1, 0x56E0,
-0x59FB, 0x5F15, 0x98F2, 0x6DEB, 0x80E4, 0x852D},
-{ /* category 17 */
-0x9662, 0x9670, 0x96A0, 0x97FB, 0x540B, 0x53F3, 0x5B87, 0x70CF,
-0x7FBD, 0x8FC2, 0x96E8, 0x536F, 0x9D5C, 0x7ABA, 0x4E11, 0x7893,
-0x81FC, 0x6E26, 0x5618, 0x5504, 0x6B1D, 0x851A, 0x9C3B, 0x59E5,
-0x53A9, 0x6D66, 0x74DC, 0x958F, 0x5642, 0x4E91, 0x904B, 0x96F2,
-0x834F, 0x990C, 0x53E1, 0x55B6, 0x5B30, 0x5F71, 0x6620, 0x66F3,
-0x6804, 0x6C38, 0x6CF3, 0x6D29, 0x745B, 0x76C8, 0x7A4E, 0x9834,
-0x82F1, 0x885B, 0x8A60, 0x92ED, 0x6DB2, 0x75AB, 0x76CA, 0x99C5,
-0x60A6, 0x8B01, 0x8D8A, 0x95B2, 0x698E, 0x53AD, 0x5186, 0x5712,
-0x5830, 0x5944, 0x5BB4, 0x5EF6, 0x6028, 0x63A9, 0x63F4, 0x6CBF,
-0x6F14, 0x708E, 0x7114, 0x7159, 0x71D5, 0x733F, 0x7E01, 0x8276,
-0x82D1, 0x8597, 0x9060, 0x925B, 0x9D1B, 0x5869, 0x65BC, 0x6C5A,
-0x7525, 0x51F9, 0x592E, 0x5965, 0x5F80, 0x5FDC},
-{ /* category 18 */
-0x62BC, 0x65FA, 0x6A2A, 0x6B27, 0x6BB4, 0x738B, 0x7FC1, 0x8956,
-0x9D2C, 0x9D0E, 0x9EC4, 0x5CA1, 0x6C96, 0x837B, 0x5104, 0x5C4B,
-0x61B6, 0x81C6, 0x6876, 0x7261, 0x4E59, 0x4FFA, 0x5378, 0x6069,
-0x6E29, 0x7A4F, 0x97F3, 0x4E0B, 0x5316, 0x4EEE, 0x4F55, 0x4F3D,
-0x4FA1, 0x4F73, 0x52A0, 0x53EF, 0x5609, 0x590F, 0x5AC1, 0x5BB6,
-0x5BE1, 0x79D1, 0x6687, 0x679C, 0x67B6, 0x6B4C, 0x6CB3, 0x706B,
-0x73C2, 0x798D, 0x79BE, 0x7A3C, 0x7B87, 0x82B1, 0x82DB, 0x8304,
-0x8377, 0x83EF, 0x83D3, 0x8766, 0x8AB2, 0x5629, 0x8CA8, 0x8FE6,
-0x904E, 0x971E, 0x868A, 0x4FC4, 0x5CE8, 0x6211, 0x7259, 0x753B,
-0x81E5, 0x82BD, 0x86FE, 0x8CC0, 0x96C5, 0x9913, 0x99D5, 0x4ECB,
-0x4F1A, 0x89E3, 0x56DE, 0x584A, 0x58CA, 0x5EFB, 0x5FEB, 0x602A,
-0x6094, 0x6062, 0x61D0, 0x6212, 0x62D0, 0x6539},
-{ /* category 19 */
-0x9B41, 0x6666, 0x68B0, 0x6D77, 0x7070, 0x754C, 0x7686, 0x7D75,
-0x82A5, 0x87F9, 0x958B, 0x968E, 0x8C9D, 0x51F1, 0x52BE, 0x5916,
-0x54B3, 0x5BB3, 0x5D16, 0x6168, 0x6982, 0x6DAF, 0x788D, 0x84CB,
-0x8857, 0x8A72, 0x93A7, 0x9AB8, 0x6D6C, 0x99A8, 0x86D9, 0x57A3,
-0x67FF, 0x86CE, 0x920E, 0x5283, 0x5687, 0x5404, 0x5ED3, 0x62E1,
-0x64B9, 0x683C, 0x6838, 0x6BBB, 0x7372, 0x78BA, 0x7A6B, 0x899A,
-0x89D2, 0x8D6B, 0x8F03, 0x90ED, 0x95A3, 0x9694, 0x9769, 0x5B66,
-0x5CB3, 0x697D, 0x984D, 0x984E, 0x639B, 0x7B20, 0x6A2B, 0x6A7F,
-0x68B6, 0x9C0D, 0x6F5F, 0x5272, 0x559D, 0x6070, 0x62EC, 0x6D3B,
-0x6E07, 0x6ED1, 0x845B, 0x8910, 0x8F44, 0x4E14, 0x9C39, 0x53F6,
-0x691B, 0x6A3A, 0x9784, 0x682A, 0x515C, 0x7AC3, 0x84B2, 0x91DC,
-0x938C, 0x565B, 0x9D28, 0x6822, 0x8305, 0x8431},
-{ /* category 20 */
-0x7CA5, 0x5208, 0x82C5, 0x74E6, 0x4E7E, 0x4F83, 0x51A0, 0x5BD2,
-0x520A, 0x52D8, 0x52E7, 0x5DFB, 0x559A, 0x582A, 0x59E6, 0x5B8C,
-0x5B98, 0x5BDB, 0x5E72, 0x5E79, 0x60A3, 0x611F, 0x6163, 0x61BE,
-0x63DB, 0x6562, 0x67D1, 0x6853, 0x68FA, 0x6B3E, 0x6B53, 0x6C57,
-0x6F22, 0x6F97, 0x6F45, 0x74B0, 0x7518, 0x76E3, 0x770B, 0x7AFF,
-0x7BA1, 0x7C21, 0x7DE9, 0x7F36, 0x7FF0, 0x809D, 0x8266, 0x839E,
-0x89B3, 0x8ACC, 0x8CAB, 0x9084, 0x9451, 0x9593, 0x9591, 0x95A2,
-0x9665, 0x97D3, 0x9928, 0x8218, 0x4E38, 0x542B, 0x5CB8, 0x5DCC,
-0x73A9, 0x764C, 0x773C, 0x5CA9, 0x7FEB, 0x8D0B, 0x96C1, 0x9811,
-0x9854, 0x9858, 0x4F01, 0x4F0E, 0x5371, 0x559C, 0x5668, 0x57FA,
-0x5947, 0x5B09, 0x5BC4, 0x5C90, 0x5E0C, 0x5E7E, 0x5FCC, 0x63EE,
-0x673A, 0x65D7, 0x65E2, 0x671F, 0x68CB, 0x68C4},
-{ /* category 21 */
-0x6A5F, 0x5E30, 0x6BC5, 0x6C17, 0x6C7D, 0x757F, 0x7948, 0x5B63,
-0x7A00, 0x7D00, 0x5FBD, 0x898F, 0x8A18, 0x8CB4, 0x8D77, 0x8ECC,
-0x8F1D, 0x98E2, 0x9A0E, 0x9B3C, 0x4E80, 0x507D, 0x5100, 0x5993,
-0x5B9C, 0x622F, 0x6280, 0x64EC, 0x6B3A, 0x72A0, 0x7591, 0x7947,
-0x7FA9, 0x87FB, 0x8ABC, 0x8B70, 0x63AC, 0x83CA, 0x97A0, 0x5409,
-0x5403, 0x55AB, 0x6854, 0x6A58, 0x8A70, 0x7827, 0x6775, 0x9ECD,
-0x5374, 0x5BA2, 0x811A, 0x8650, 0x9006, 0x4E18, 0x4E45, 0x4EC7,
-0x4F11, 0x53CA, 0x5438, 0x5BAE, 0x5F13, 0x6025, 0x6551, 0x673D,
-0x6C42, 0x6C72, 0x6CE3, 0x7078, 0x7403, 0x7A76, 0x7AAE, 0x7B08,
-0x7D1A, 0x7CFE, 0x7D66, 0x65E7, 0x725B, 0x53BB, 0x5C45, 0x5DE8,
-0x62D2, 0x62E0, 0x6319, 0x6E20, 0x865A, 0x8A31, 0x8DDD, 0x92F8,
-0x6F01, 0x79A6, 0x9B5A, 0x4EA8, 0x4EAB, 0x4EAC},
-{ /* category 22 */
-0x4F9B, 0x4FA0, 0x50D1, 0x5147, 0x7AF6, 0x5171, 0x51F6, 0x5354,
-0x5321, 0x537F, 0x53EB, 0x55AC, 0x5883, 0x5CE1, 0x5F37, 0x5F4A,
-0x602F, 0x6050, 0x606D, 0x631F, 0x6559, 0x6A4B, 0x6CC1, 0x72C2,
-0x72ED, 0x77EF, 0x80F8, 0x8105, 0x8208, 0x854E, 0x90F7, 0x93E1,
-0x97FF, 0x9957, 0x9A5A, 0x4EF0, 0x51DD, 0x5C2D, 0x6681, 0x696D,
-0x5C40, 0x66F2, 0x6975, 0x7389, 0x6850, 0x7C81, 0x50C5, 0x52E4,
-0x5747, 0x5DFE, 0x9326, 0x65A4, 0x6B23, 0x6B3D, 0x7434, 0x7981,
-0x79BD, 0x7B4B, 0x7DCA, 0x82B9, 0x83CC, 0x887F, 0x895F, 0x8B39,
-0x8FD1, 0x91D1, 0x541F, 0x9280, 0x4E5D, 0x5036, 0x53E5, 0x533A,
-0x72D7, 0x7396, 0x77E9, 0x82E6, 0x8EAF, 0x99C6, 0x99C8, 0x99D2,
-0x5177, 0x611A, 0x865E, 0x55B0, 0x7A7A, 0x5076, 0x5BD3, 0x9047,
-0x9685, 0x4E32, 0x6ADB, 0x91E7, 0x5C51, 0x5C48},
-{ /* category 23 */
-0x6398, 0x7A9F, 0x6C93, 0x9774, 0x8F61, 0x7AAA, 0x718A, 0x9688,
-0x7C82, 0x6817, 0x7E70, 0x6851, 0x936C, 0x52F2, 0x541B, 0x85AB,
-0x8A13, 0x7FA4, 0x8ECD, 0x90E1, 0x5366, 0x8888, 0x7941, 0x4FC2,
-0x50BE, 0x5211, 0x5144, 0x5553, 0x572D, 0x73EA, 0x578B, 0x5951,
-0x5F62, 0x5F84, 0x6075, 0x6176, 0x6167, 0x61A9, 0x63B2, 0x643A,
-0x656C, 0x666F, 0x6842, 0x6E13, 0x7566, 0x7A3D, 0x7CFB, 0x7D4C,
-0x7D99, 0x7E4B, 0x7F6B, 0x830E, 0x834A, 0x86CD, 0x8A08, 0x8A63,
-0x8B66, 0x8EFD, 0x981A, 0x9D8F, 0x82B8, 0x8FCE, 0x9BE8, 0x5287,
-0x621F, 0x6483, 0x6FC0, 0x9699, 0x6841, 0x5091, 0x6B20, 0x6C7A,
-0x6F54, 0x7A74, 0x7D50, 0x8840, 0x8A23, 0x6708, 0x4EF6, 0x5039,
-0x5026, 0x5065, 0x517C, 0x5238, 0x5263, 0x55A7, 0x570F, 0x5805,
-0x5ACC, 0x5EFA, 0x61B2, 0x61F8, 0x62F3, 0x6372},
-{ /* category 24 */
-0x691C, 0x6A29, 0x727D, 0x72AC, 0x732E, 0x7814, 0x786F, 0x7D79,
-0x770C, 0x80A9, 0x898B, 0x8B19, 0x8CE2, 0x8ED2, 0x9063, 0x9375,
-0x967A, 0x9855, 0x9A13, 0x9E78, 0x5143, 0x539F, 0x53B3, 0x5E7B,
-0x5F26, 0x6E1B, 0x6E90, 0x7384, 0x73FE, 0x7D43, 0x8237, 0x8A00,
-0x8AFA, 0x9650, 0x4E4E, 0x500B, 0x53E4, 0x547C, 0x56FA, 0x59D1,
-0x5B64, 0x5DF1, 0x5EAB, 0x5F27, 0x6238, 0x6545, 0x67AF, 0x6E56,
-0x72D0, 0x7CCA, 0x88B4, 0x80A1, 0x80E1, 0x83F0, 0x864E, 0x8A87,
-0x8DE8, 0x9237, 0x96C7, 0x9867, 0x9F13, 0x4E94, 0x4E92, 0x4F0D,
-0x5348, 0x5449, 0x543E, 0x5A2F, 0x5F8C, 0x5FA1, 0x609F, 0x68A7,
-0x6A8E, 0x745A, 0x7881, 0x8A9E, 0x8AA4, 0x8B77, 0x9190, 0x4E5E,
-0x9BC9, 0x4EA4, 0x4F7C, 0x4FAF, 0x5019, 0x5016, 0x5149, 0x516C,
-0x529F, 0x52B9, 0x52FE, 0x539A, 0x53E3, 0x5411},
-{ /* category 25 */
-0x540E, 0x5589, 0x5751, 0x57A2, 0x597D, 0x5B54, 0x5B5D, 0x5B8F,
-0x5DE5, 0x5DE7, 0x5DF7, 0x5E78, 0x5E83, 0x5E9A, 0x5EB7, 0x5F18,
-0x6052, 0x614C, 0x6297, 0x62D8, 0x63A7, 0x653B, 0x6602, 0x6643,
-0x66F4, 0x676D, 0x6821, 0x6897, 0x69CB, 0x6C5F, 0x6D2A, 0x6D69,
-0x6E2F, 0x6E9D, 0x7532, 0x7687, 0x786C, 0x7A3F, 0x7CE0, 0x7D05,
-0x7D18, 0x7D5E, 0x7DB1, 0x8015, 0x8003, 0x80AF, 0x80B1, 0x8154,
-0x818F, 0x822A, 0x8352, 0x884C, 0x8861, 0x8B1B, 0x8CA2, 0x8CFC,
-0x90CA, 0x9175, 0x9271, 0x783F, 0x92FC, 0x95A4, 0x964D, 0x9805,
-0x9999, 0x9AD8, 0x9D3B, 0x525B, 0x52AB, 0x53F7, 0x5408, 0x58D5,
-0x62F7, 0x6FE0, 0x8C6A, 0x8F5F, 0x9EB9, 0x514B, 0x523B, 0x544A,
-0x56FD, 0x7A40, 0x9177, 0x9D60, 0x9ED2, 0x7344, 0x6F09, 0x8170,
-0x7511, 0x5FFD, 0x60DA, 0x9AA8, 0x72DB, 0x8FBC},
-{ /* category 26 */
-0x6B64, 0x9803, 0x4ECA, 0x56F0, 0x5764, 0x58BE, 0x5A5A, 0x6068,
-0x61C7, 0x660F, 0x6606, 0x6839, 0x68B1, 0x6DF7, 0x75D5, 0x7D3A,
-0x826E, 0x9B42, 0x4E9B, 0x4F50, 0x53C9, 0x5506, 0x5D6F, 0x5DE6,
-0x5DEE, 0x67FB, 0x6C99, 0x7473, 0x7802, 0x8A50, 0x9396, 0x88DF,
-0x5750, 0x5EA7, 0x632B, 0x50B5, 0x50AC, 0x518D, 0x6700, 0x54C9,
-0x585E, 0x59BB, 0x5BB0, 0x5F69, 0x624D, 0x63A1, 0x683D, 0x6B73,
-0x6E08, 0x707D, 0x91C7, 0x7280, 0x7815, 0x7826, 0x796D, 0x658E,
-0x7D30, 0x83DC, 0x88C1, 0x8F09, 0x969B, 0x5264, 0x5728, 0x6750,
-0x7F6A, 0x8CA1, 0x51B4, 0x5742, 0x962A, 0x583A, 0x698A, 0x80B4,
-0x54B2, 0x5D0E, 0x57FC, 0x7895, 0x9DFA, 0x4F5C, 0x524A, 0x548B,
-0x643E, 0x6628, 0x6714, 0x67F5, 0x7A84, 0x7B56, 0x7D22, 0x932F,
-0x685C, 0x9BAD, 0x7B39, 0x5319, 0x518A, 0x5237},
-{ /* category 27 */
-0x5BDF, 0x62F6, 0x64AE, 0x64E6, 0x672D, 0x6BBA, 0x85A9, 0x96D1,
-0x7690, 0x9BD6, 0x634C, 0x9306, 0x9BAB, 0x76BF, 0x6652, 0x4E09,
-0x5098, 0x53C2, 0x5C71, 0x60E8, 0x6492, 0x6563, 0x685F, 0x71E6,
-0x73CA, 0x7523, 0x7B97, 0x7E82, 0x8695, 0x8B83, 0x8CDB, 0x9178,
-0x9910, 0x65AC, 0x66AB, 0x6B8B, 0x4ED5, 0x4ED4, 0x4F3A, 0x4F7F,
-0x523A, 0x53F8, 0x53F2, 0x55E3, 0x56DB, 0x58EB, 0x59CB, 0x59C9,
-0x59FF, 0x5B50, 0x5C4D, 0x5E02, 0x5E2B, 0x5FD7, 0x601D, 0x6307,
-0x652F, 0x5B5C, 0x65AF, 0x65BD, 0x65E8, 0x679D, 0x6B62, 0x6B7B,
-0x6C0F, 0x7345, 0x7949, 0x79C1, 0x7CF8, 0x7D19, 0x7D2B, 0x80A2,
-0x8102, 0x81F3, 0x8996, 0x8A5E, 0x8A69, 0x8A66, 0x8A8C, 0x8AEE,
-0x8CC7, 0x8CDC, 0x96CC, 0x98FC, 0x6B6F, 0x4E8B, 0x4F3C, 0x4F8D,
-0x5150, 0x5B57, 0x5BFA, 0x6148, 0x6301, 0x6642},
-{ /* category 28 */
-0x6B21, 0x6ECB, 0x6CBB, 0x723E, 0x74BD, 0x75D4, 0x78C1, 0x793A,
-0x800C, 0x8033, 0x81EA, 0x8494, 0x8F9E, 0x6C50, 0x9E7F, 0x5F0F,
-0x8B58, 0x9D2B, 0x7AFA, 0x8EF8, 0x5B8D, 0x96EB, 0x4E03, 0x53F1,
-0x57F7, 0x5931, 0x5AC9, 0x5BA4, 0x6089, 0x6E7F, 0x6F06, 0x75BE,
-0x8CEA, 0x5B9F, 0x8500, 0x7BE0, 0x5072, 0x67F4, 0x829D, 0x5C61,
-0x854A, 0x7E1E, 0x820E, 0x5199, 0x5C04, 0x6368, 0x8D66, 0x659C,
-0x716E, 0x793E, 0x7D17, 0x8005, 0x8B1D, 0x8ECA, 0x906E, 0x86C7,
-0x90AA, 0x501F, 0x52FA, 0x5C3A, 0x6753, 0x707C, 0x7235, 0x914C,
-0x91C8, 0x932B, 0x82E5, 0x5BC2, 0x5F31, 0x60F9, 0x4E3B, 0x53D6,
-0x5B88, 0x624B, 0x6731, 0x6B8A, 0x72E9, 0x73E0, 0x7A2E, 0x816B,
-0x8DA3, 0x9152, 0x9996, 0x5112, 0x53D7, 0x546A, 0x5BFF, 0x6388,
-0x6A39, 0x7DAC, 0x9700, 0x56DA, 0x53CE, 0x5468},
-{ /* category 29 */
-0x5B97, 0x5C31, 0x5DDE, 0x4FEE, 0x6101, 0x62FE, 0x6D32, 0x79C0,
-0x79CB, 0x7D42, 0x7E4D, 0x7FD2, 0x81ED, 0x821F, 0x8490, 0x8846,
-0x8972, 0x8B90, 0x8E74, 0x8F2F, 0x9031, 0x914B, 0x916C, 0x96C6,
-0x919C, 0x4EC0, 0x4F4F, 0x5145, 0x5341, 0x5F93, 0x620E, 0x67D4,
-0x6C41, 0x6E0B, 0x7363, 0x7E26, 0x91CD, 0x9283, 0x53D4, 0x5919,
-0x5BBF, 0x6DD1, 0x795D, 0x7E2E, 0x7C9B, 0x587E, 0x719F, 0x51FA,
-0x8853, 0x8FF0, 0x4FCA, 0x5CFB, 0x6625, 0x77AC, 0x7AE3, 0x821C,
-0x99FF, 0x51C6, 0x5FAA, 0x65EC, 0x696F, 0x6B89, 0x6DF3, 0x6E96,
-0x6F64, 0x76FE, 0x7D14, 0x5DE1, 0x9075, 0x9187, 0x9806, 0x51E6,
-0x521D, 0x6240, 0x6691, 0x66D9, 0x6E1A, 0x5EB6, 0x7DD2, 0x7F72,
-0x66F8, 0x85AF, 0x85F7, 0x8AF8, 0x52A9, 0x53D9, 0x5973, 0x5E8F,
-0x5F90, 0x6055, 0x92E4, 0x9664, 0x50B7, 0x511F},
-{ /* category 30 */
-0x52DD, 0x5320, 0x5347, 0x53EC, 0x54E8, 0x5546, 0x5531, 0x5617,
-0x5968, 0x59BE, 0x5A3C, 0x5BB5, 0x5C06, 0x5C0F, 0x5C11, 0x5C1A,
-0x5E84, 0x5E8A, 0x5EE0, 0x5F70, 0x627F, 0x6284, 0x62DB, 0x638C,
-0x6377, 0x6607, 0x660C, 0x662D, 0x6676, 0x677E, 0x68A2, 0x6A1F,
-0x6A35, 0x6CBC, 0x6D88, 0x6E09, 0x6E58, 0x713C, 0x7126, 0x7167,
-0x75C7, 0x7701, 0x785D, 0x7901, 0x7965, 0x79F0, 0x7AE0, 0x7B11,
-0x7CA7, 0x7D39, 0x8096, 0x83D6, 0x848B, 0x8549, 0x885D, 0x88F3,
-0x8A1F, 0x8A3C, 0x8A54, 0x8A73, 0x8C61, 0x8CDE, 0x91A4, 0x9266,
-0x937E, 0x9418, 0x969C, 0x9798, 0x4E0A, 0x4E08, 0x4E1E, 0x4E57,
-0x5197, 0x5270, 0x57CE, 0x5834, 0x58CC, 0x5B22, 0x5E38, 0x60C5,
-0x64FE, 0x6761, 0x6756, 0x6D44, 0x72B6, 0x7573, 0x7A63, 0x84B8,
-0x8B72, 0x91B8, 0x9320, 0x5631, 0x57F4, 0x98FE},
-{ /* category 31 */
-0x62ED, 0x690D, 0x6B96, 0x71ED, 0x7E54, 0x8077, 0x8272, 0x89E6,
-0x98DF, 0x8755, 0x8FB1, 0x5C3B, 0x4F38, 0x4FE1, 0x4FB5, 0x5507,
-0x5A20, 0x5BDD, 0x5BE9, 0x5FC3, 0x614E, 0x632F, 0x65B0, 0x664B,
-0x68EE, 0x699B, 0x6D78, 0x6DF1, 0x7533, 0x75B9, 0x771F, 0x795E,
-0x79E6, 0x7D33, 0x81E3, 0x82AF, 0x85AA, 0x89AA, 0x8A3A, 0x8EAB,
-0x8F9B, 0x9032, 0x91DD, 0x9707, 0x4EBA, 0x4EC1, 0x5203, 0x5875,
-0x58EC, 0x5C0B, 0x751A, 0x5C3D, 0x814E, 0x8A0A, 0x8FC5, 0x9663,
-0x976D, 0x7B25, 0x8ACF, 0x9808, 0x9162, 0x56F3, 0x53A8, 0x9017,
-0x5439, 0x5782, 0x5E25, 0x63A8, 0x6C34, 0x708A, 0x7761, 0x7C8B,
-0x7FE0, 0x8870, 0x9042, 0x9154, 0x9310, 0x9318, 0x968F, 0x745E,
-0x9AC4, 0x5D07, 0x5D69, 0x6570, 0x67A2, 0x8DA8, 0x96DB, 0x636E,
-0x6749, 0x6919, 0x83C5, 0x9817, 0x96C0, 0x88FE},
-{ /* category 32 */
-0x6F84, 0x647A, 0x5BF8, 0x4E16, 0x702C, 0x755D, 0x662F, 0x51C4,
-0x5236, 0x52E2, 0x59D3, 0x5F81, 0x6027, 0x6210, 0x653F, 0x6574,
-0x661F, 0x6674, 0x68F2, 0x6816, 0x6B63, 0x6E05, 0x7272, 0x751F,
-0x76DB, 0x7CBE, 0x8056, 0x58F0, 0x88FD, 0x897F, 0x8AA0, 0x8A93,
-0x8ACB, 0x901D, 0x9192, 0x9752, 0x9759, 0x6589, 0x7A0E, 0x8106,
-0x96BB, 0x5E2D, 0x60DC, 0x621A, 0x65A5, 0x6614, 0x6790, 0x77F3,
-0x7A4D, 0x7C4D, 0x7E3E, 0x810A, 0x8CAC, 0x8D64, 0x8DE1, 0x8E5F,
-0x78A9, 0x5207, 0x62D9, 0x63A5, 0x6442, 0x6298, 0x8A2D, 0x7A83,
-0x7BC0, 0x8AAC, 0x96EA, 0x7D76, 0x820C, 0x8749, 0x4ED9, 0x5148,
-0x5343, 0x5360, 0x5BA3, 0x5C02, 0x5C16, 0x5DDD, 0x6226, 0x6247,
-0x64B0, 0x6813, 0x6834, 0x6CC9, 0x6D45, 0x6D17, 0x67D3, 0x6F5C,
-0x714E, 0x717D, 0x65CB, 0x7A7F, 0x7BAD, 0x7DDA},
-{ /* category 33 */
-0x7E4A, 0x7FA8, 0x817A, 0x821B, 0x8239, 0x85A6, 0x8A6E, 0x8CCE,
-0x8DF5, 0x9078, 0x9077, 0x92AD, 0x9291, 0x9583, 0x9BAE, 0x524D,
-0x5584, 0x6F38, 0x7136, 0x5168, 0x7985, 0x7E55, 0x81B3, 0x7CCE,
-0x564C, 0x5851, 0x5CA8, 0x63AA, 0x66FE, 0x66FD, 0x695A, 0x72D9,
-0x758F, 0x758E, 0x790E, 0x7956, 0x79DF, 0x7C97, 0x7D20, 0x7D44,
-0x8607, 0x8A34, 0x963B, 0x9061, 0x9F20, 0x50E7, 0x5275, 0x53CC,
-0x53E2, 0x5009, 0x55AA, 0x58EE, 0x594F, 0x723D, 0x5B8B, 0x5C64,
-0x531D, 0x60E3, 0x60F3, 0x635C, 0x6383, 0x633F, 0x63BB, 0x64CD,
-0x65E9, 0x66F9, 0x5DE3, 0x69CD, 0x69FD, 0x6F15, 0x71E5, 0x4E89,
-0x75E9, 0x76F8, 0x7A93, 0x7CDF, 0x7DCF, 0x7D9C, 0x8061, 0x8349,
-0x8358, 0x846C, 0x84BC, 0x85FB, 0x88C5, 0x8D70, 0x9001, 0x906D,
-0x9397, 0x971C, 0x9A12, 0x50CF, 0x5897, 0x618E},
-{ /* category 34 */
-0x81D3, 0x8535, 0x8D08, 0x9020, 0x4FC3, 0x5074, 0x5247, 0x5373,
-0x606F, 0x6349, 0x675F, 0x6E2C, 0x8DB3, 0x901F, 0x4FD7, 0x5C5E,
-0x8CCA, 0x65CF, 0x7D9A, 0x5352, 0x8896, 0x5176, 0x63C3, 0x5B58,
-0x5B6B, 0x5C0A, 0x640D, 0x6751, 0x905C, 0x4ED6, 0x591A, 0x592A,
-0x6C70, 0x8A51, 0x553E, 0x5815, 0x59A5, 0x60F0, 0x6253, 0x67C1,
-0x8235, 0x6955, 0x9640, 0x99C4, 0x9A28, 0x4F53, 0x5806, 0x5BFE,
-0x8010, 0x5CB1, 0x5E2F, 0x5F85, 0x6020, 0x614B, 0x6234, 0x66FF,
-0x6CF0, 0x6EDE, 0x80CE, 0x817F, 0x82D4, 0x888B, 0x8CB8, 0x9000,
-0x902E, 0x968A, 0x9EDB, 0x9BDB, 0x4EE3, 0x53F0, 0x5927, 0x7B2C,
-0x918D, 0x984C, 0x9DF9, 0x6EDD, 0x7027, 0x5353, 0x5544, 0x5B85,
-0x6258, 0x629E, 0x62D3, 0x6CA2, 0x6FEF, 0x7422, 0x8A17, 0x9438,
-0x6FC1, 0x8AFE, 0x8338, 0x51E7, 0x86F8, 0x53EA},
-{ /* category 35 */
-0x53E9, 0x4F46, 0x9054, 0x8FB0, 0x596A, 0x8131, 0x5DFD, 0x7AEA,
-0x8FBF, 0x68DA, 0x8C37, 0x72F8, 0x9C48, 0x6A3D, 0x8AB0, 0x4E39,
-0x5358, 0x5606, 0x5766, 0x62C5, 0x63A2, 0x65E6, 0x6B4E, 0x6DE1,
-0x6E5B, 0x70AD, 0x77ED, 0x7AEF, 0x7BAA, 0x7DBB, 0x803D, 0x80C6,
-0x86CB, 0x8A95, 0x935B, 0x56E3, 0x58C7, 0x5F3E, 0x65AD, 0x6696,
-0x6A80, 0x6BB5, 0x7537, 0x8AC7, 0x5024, 0x77E5, 0x5730, 0x5F1B,
-0x6065, 0x667A, 0x6C60, 0x75F4, 0x7A1A, 0x7F6E, 0x81F4, 0x8718,
-0x9045, 0x99B3, 0x7BC9, 0x755C, 0x7AF9, 0x7B51, 0x84C4, 0x9010,
-0x79E9, 0x7A92, 0x8336, 0x5AE1, 0x7740, 0x4E2D, 0x4EF2, 0x5B99,
-0x5FE0, 0x62BD, 0x663C, 0x67F1, 0x6CE8, 0x866B, 0x8877, 0x8A3B,
-0x914E, 0x92F3, 0x99D0, 0x6A17, 0x7026, 0x732A, 0x82E7, 0x8457,
-0x8CAF, 0x4E01, 0x5146, 0x51CB, 0x558B, 0x5BF5},
-{ /* category 36 */
-0x5E16, 0x5E33, 0x5E81, 0x5F14, 0x5F35, 0x5F6B, 0x5FB4, 0x61F2,
-0x6311, 0x66A2, 0x671D, 0x6F6E, 0x7252, 0x753A, 0x773A, 0x8074,
-0x8139, 0x8178, 0x8776, 0x8ABF, 0x8ADC, 0x8D85, 0x8DF3, 0x929A,
-0x9577, 0x9802, 0x9CE5, 0x52C5, 0x6357, 0x76F4, 0x6715, 0x6C88,
-0x73CD, 0x8CC3, 0x93AE, 0x9673, 0x6D25, 0x589C, 0x690E, 0x69CC,
-0x8FFD, 0x939A, 0x75DB, 0x901A, 0x585A, 0x6802, 0x63B4, 0x69FB,
-0x4F43, 0x6F2C, 0x67D8, 0x8FBB, 0x8526, 0x7DB4, 0x9354, 0x693F,
-0x6F70, 0x576A, 0x58F7, 0x5B2C, 0x7D2C, 0x722A, 0x540A, 0x91E3,
-0x9DB4, 0x4EAD, 0x4F4E, 0x505C, 0x5075, 0x5243, 0x8C9E, 0x5448,
-0x5824, 0x5B9A, 0x5E1D, 0x5E95, 0x5EAD, 0x5EF7, 0x5F1F, 0x608C,
-0x62B5, 0x633A, 0x63D0, 0x68AF, 0x6C40, 0x7887, 0x798E, 0x7A0B,
-0x7DE0, 0x8247, 0x8A02, 0x8AE6, 0x8E44, 0x9013},
-{ /* category 37 */
-0x90B8, 0x912D, 0x91D8, 0x9F0E, 0x6CE5, 0x6458, 0x64E2, 0x6575,
-0x6EF4, 0x7684, 0x7B1B, 0x9069, 0x93D1, 0x6EBA, 0x54F2, 0x5FB9,
-0x64A4, 0x8F4D, 0x8FED, 0x9244, 0x5178, 0x586B, 0x5929, 0x5C55,
-0x5E97, 0x6DFB, 0x7E8F, 0x751C, 0x8CBC, 0x8EE2, 0x985B, 0x70B9,
-0x4F1D, 0x6BBF, 0x6FB1, 0x7530, 0x96FB, 0x514E, 0x5410, 0x5835,
-0x5857, 0x59AC, 0x5C60, 0x5F92, 0x6597, 0x675C, 0x6E21, 0x767B,
-0x83DF, 0x8CED, 0x9014, 0x90FD, 0x934D, 0x7825, 0x783A, 0x52AA,
-0x5EA6, 0x571F, 0x5974, 0x6012, 0x5012, 0x515A, 0x51AC, 0x51CD,
-0x5200, 0x5510, 0x5854, 0x5858, 0x5957, 0x5B95, 0x5CF6, 0x5D8B,
-0x60BC, 0x6295, 0x642D, 0x6771, 0x6843, 0x68BC, 0x68DF, 0x76D7,
-0x6DD8, 0x6E6F, 0x6D9B, 0x706F, 0x71C8, 0x5F53, 0x75D8, 0x7977,
-0x7B49, 0x7B54, 0x7B52, 0x7CD6, 0x7D71, 0x5230},
-{ /* category 38 */
-0x8463, 0x8569, 0x85E4, 0x8A0E, 0x8B04, 0x8C46, 0x8E0F, 0x9003,
-0x900F, 0x9419, 0x9676, 0x982D, 0x9A30, 0x95D8, 0x50CD, 0x52D5,
-0x540C, 0x5802, 0x5C0E, 0x61A7, 0x649E, 0x6D1E, 0x77B3, 0x7AE5,
-0x80F4, 0x8404, 0x9053, 0x9285, 0x5CE0, 0x9D07, 0x533F, 0x5F97,
-0x5FB3, 0x6D9C, 0x7279, 0x7763, 0x79BF, 0x7BE4, 0x6BD2, 0x72EC,
-0x8AAD, 0x6803, 0x6A61, 0x51F8, 0x7A81, 0x6934, 0x5C4A, 0x9CF6,
-0x82EB, 0x5BC5, 0x9149, 0x701E, 0x5678, 0x5C6F, 0x60C7, 0x6566,
-0x6C8C, 0x8C5A, 0x9041, 0x9813, 0x5451, 0x66C7, 0x920D, 0x5948,
-0x90A3, 0x5185, 0x4E4D, 0x51EA, 0x8599, 0x8B0E, 0x7058, 0x637A,
-0x934B, 0x6962, 0x99B4, 0x7E04, 0x7577, 0x5357, 0x6960, 0x8EDF,
-0x96E3, 0x6C5D, 0x4E8C, 0x5C3C, 0x5F10, 0x8FE9, 0x5302, 0x8CD1,
-0x8089, 0x8679, 0x5EFF, 0x65E5, 0x4E73, 0x5165},
-{ /* category 39 */
-0x5982, 0x5C3F, 0x97EE, 0x4EFB, 0x598A, 0x5FCD, 0x8A8D, 0x6FE1,
-0x79B0, 0x7962, 0x5BE7, 0x8471, 0x732B, 0x71B1, 0x5E74, 0x5FF5,
-0x637B, 0x649A, 0x71C3, 0x7C98, 0x4E43, 0x5EFC, 0x4E4B, 0x57DC,
-0x56A2, 0x60A9, 0x6FC3, 0x7D0D, 0x80FD, 0x8133, 0x81BF, 0x8FB2,
-0x8997, 0x86A4, 0x5DF4, 0x628A, 0x64AD, 0x8987, 0x6777, 0x6CE2,
-0x6D3E, 0x7436, 0x7834, 0x5A46, 0x7F75, 0x82AD, 0x99AC, 0x4FF3,
-0x5EC3, 0x62DD, 0x6392, 0x6557, 0x676F, 0x76C3, 0x724C, 0x80CC,
-0x80BA, 0x8F29, 0x914D, 0x500D, 0x57F9, 0x5A92, 0x6885, 0x6973,
-0x7164, 0x72FD, 0x8CB7, 0x58F2, 0x8CE0, 0x966A, 0x9019, 0x877F,
-0x79E4, 0x77E7, 0x8429, 0x4F2F, 0x5265, 0x535A, 0x62CD, 0x67CF,
-0x6CCA, 0x767D, 0x7B94, 0x7C95, 0x8236, 0x8584, 0x8FEB, 0x66DD,
-0x6F20, 0x7206, 0x7E1B, 0x83AB, 0x99C1, 0x9EA6},
-{ /* category 40 */
-0x51FD, 0x7BB1, 0x7872, 0x7BB8, 0x8087, 0x7B48, 0x6AE8, 0x5E61,
-0x808C, 0x7551, 0x7560, 0x516B, 0x9262, 0x6E8C, 0x767A, 0x9197,
-0x9AEA, 0x4F10, 0x7F70, 0x629C, 0x7B4F, 0x95A5, 0x9CE9, 0x567A,
-0x5859, 0x86E4, 0x96BC, 0x4F34, 0x5224, 0x534A, 0x53CD, 0x53DB,
-0x5E06, 0x642C, 0x6591, 0x677F, 0x6C3E, 0x6C4E, 0x7248, 0x72AF,
-0x73ED, 0x7554, 0x7E41, 0x822C, 0x85E9, 0x8CA9, 0x7BC4, 0x91C6,
-0x7169, 0x9812, 0x98EF, 0x633D, 0x6669, 0x756A, 0x76E4, 0x78D0,
-0x8543, 0x86EE, 0x532A, 0x5351, 0x5426, 0x5983, 0x5E87, 0x5F7C,
-0x60B2, 0x6249, 0x6279, 0x62AB, 0x6590, 0x6BD4, 0x6CCC, 0x75B2,
-0x76AE, 0x7891, 0x79D8, 0x7DCB, 0x7F77, 0x80A5, 0x88AB, 0x8AB9,
-0x8CBB, 0x907F, 0x975E, 0x98DB, 0x6A0B, 0x7C38, 0x5099, 0x5C3E,
-0x5FAE, 0x6787, 0x6BD8, 0x7435, 0x7709, 0x7F8E},
-{ /* category 41 */
-0x9F3B, 0x67CA, 0x7A17, 0x5339, 0x758B, 0x9AED, 0x5F66, 0x819D,
-0x83F1, 0x8098, 0x5F3C, 0x5FC5, 0x7562, 0x7B46, 0x903C, 0x6867,
-0x59EB, 0x5A9B, 0x7D10, 0x767E, 0x8B2C, 0x4FF5, 0x5F6A, 0x6A19,
-0x6C37, 0x6F02, 0x74E2, 0x7968, 0x8868, 0x8A55, 0x8C79, 0x5EDF,
-0x63CF, 0x75C5, 0x79D2, 0x82D7, 0x9328, 0x92F2, 0x849C, 0x86ED,
-0x9C2D, 0x54C1, 0x5F6C, 0x658C, 0x6D5C, 0x7015, 0x8CA7, 0x8CD3,
-0x983B, 0x654F, 0x74F6, 0x4E0D, 0x4ED8, 0x57E0, 0x592B, 0x5A66,
-0x5BCC, 0x51A8, 0x5E03, 0x5E9C, 0x6016, 0x6276, 0x6577, 0x65A7,
-0x666E, 0x6D6E, 0x7236, 0x7B26, 0x8150, 0x819A, 0x8299, 0x8B5C,
-0x8CA0, 0x8CE6, 0x8D74, 0x961C, 0x9644, 0x4FAE, 0x64AB, 0x6B66,
-0x821E, 0x8461, 0x856A, 0x90E8, 0x5C01, 0x6953, 0x98A8, 0x847A,
-0x8557, 0x4F0F, 0x526F, 0x5FA9, 0x5E45, 0x670D},
-{ /* category 42 */
-0x798F, 0x8179, 0x8907, 0x8986, 0x6DF5, 0x5F17, 0x6255, 0x6CB8,
-0x4ECF, 0x7269, 0x9B92, 0x5206, 0x543B, 0x5674, 0x58B3, 0x61A4,
-0x626E, 0x711A, 0x596E, 0x7C89, 0x7CDE, 0x7D1B, 0x96F0, 0x6587,
-0x805E, 0x4E19, 0x4F75, 0x5175, 0x5840, 0x5E63, 0x5E73, 0x5F0A,
-0x67C4, 0x4E26, 0x853D, 0x9589, 0x965B, 0x7C73, 0x9801, 0x50FB,
-0x58C1, 0x7656, 0x78A7, 0x5225, 0x77A5, 0x8511, 0x7B86, 0x504F,
-0x5909, 0x7247, 0x7BC7, 0x7DE8, 0x8FBA, 0x8FD4, 0x904D, 0x4FBF,
-0x52C9, 0x5A29, 0x5F01, 0x97AD, 0x4FDD, 0x8217, 0x92EA, 0x5703,
-0x6355, 0x6B69, 0x752B, 0x88DC, 0x8F14, 0x7A42, 0x52DF, 0x5893,
-0x6155, 0x620A, 0x66AE, 0x6BCD, 0x7C3F, 0x83E9, 0x5023, 0x4FF8,
-0x5305, 0x5446, 0x5831, 0x5949, 0x5B9D, 0x5CF0, 0x5CEF, 0x5D29,
-0x5E96, 0x62B1, 0x6367, 0x653E, 0x65B9, 0x670B},
-{ /* category 43 */
-0x6CD5, 0x6CE1, 0x70F9, 0x7832, 0x7E2B, 0x80DE, 0x82B3, 0x840C,
-0x84EC, 0x8702, 0x8912, 0x8A2A, 0x8C4A, 0x90A6, 0x92D2, 0x98FD,
-0x9CF3, 0x9D6C, 0x4E4F, 0x4EA1, 0x508D, 0x5256, 0x574A, 0x59A8,
-0x5E3D, 0x5FD8, 0x5FD9, 0x623F, 0x66B4, 0x671B, 0x67D0, 0x68D2,
-0x5192, 0x7D21, 0x80AA, 0x81A8, 0x8B00, 0x8C8C, 0x8CBF, 0x927E,
-0x9632, 0x5420, 0x982C, 0x5317, 0x50D5, 0x535C, 0x58A8, 0x64B2,
-0x6734, 0x7267, 0x7766, 0x7A46, 0x91E6, 0x52C3, 0x6CA1, 0x6B86,
-0x5800, 0x5E4C, 0x5954, 0x672C, 0x7FFB, 0x51E1, 0x76C6, 0x6469,
-0x78E8, 0x9B54, 0x9EBB, 0x57CB, 0x59B9, 0x6627, 0x679A, 0x6BCE,
-0x54E9, 0x69D9, 0x5E55, 0x819C, 0x6795, 0x9BAA, 0x67FE, 0x9C52,
-0x685D, 0x4EA6, 0x4FE3, 0x53C8, 0x62B9, 0x672B, 0x6CAB, 0x8FC4,
-0x4FAD, 0x7E6D, 0x9EBF, 0x4E07, 0x6162, 0x6E80},
-{ /* category 44 */
-0x6F2B, 0x8513, 0x5473, 0x672A, 0x9B45, 0x5DF3, 0x7B95, 0x5CAC,
-0x5BC6, 0x871C, 0x6E4A, 0x84D1, 0x7A14, 0x8108, 0x5999, 0x7C8D,
-0x6C11, 0x7720, 0x52D9, 0x5922, 0x7121, 0x725F, 0x77DB, 0x9727,
-0x9D61, 0x690B, 0x5A7F, 0x5A18, 0x51A5, 0x540D, 0x547D, 0x660E,
-0x76DF, 0x8FF7, 0x9298, 0x9CF4, 0x59EA, 0x725D, 0x6EC5, 0x514D,
-0x68C9, 0x7DBF, 0x7DEC, 0x9762, 0x9EBA, 0x6478, 0x6A21, 0x8302,
-0x5984, 0x5B5F, 0x6BDB, 0x731B, 0x76F2, 0x7DB2, 0x8017, 0x8499,
-0x5132, 0x6728, 0x9ED9, 0x76EE, 0x6762, 0x52FF, 0x9905, 0x5C24,
-0x623B, 0x7C7E, 0x8CB0, 0x554F, 0x60B6, 0x7D0B, 0x9580, 0x5301,
-0x4E5F, 0x51B6, 0x591C, 0x723A, 0x8036, 0x91CE, 0x5F25, 0x77E2,
-0x5384, 0x5F79, 0x7D04, 0x85AC, 0x8A33, 0x8E8D, 0x9756, 0x67F3,
-0x85AE, 0x9453, 0x6109, 0x6108, 0x6CB9, 0x7652},
-{ /* category 45 */
-0x8AED, 0x8F38, 0x552F, 0x4F51, 0x512A, 0x52C7, 0x53CB, 0x5BA5,
-0x5E7D, 0x60A0, 0x6182, 0x63D6, 0x6709, 0x67DA, 0x6E67, 0x6D8C,
-0x7336, 0x7337, 0x7531, 0x7950, 0x88D5, 0x8A98, 0x904A, 0x9091,
-0x90F5, 0x96C4, 0x878D, 0x5915, 0x4E88, 0x4F59, 0x4E0E, 0x8A89,
-0x8F3F, 0x9810, 0x50AD, 0x5E7C, 0x5996, 0x5BB9, 0x5EB8, 0x63DA,
-0x63FA, 0x64C1, 0x66DC, 0x694A, 0x69D8, 0x6D0B, 0x6EB6, 0x7194,
-0x7528, 0x7AAF, 0x7F8A, 0x8000, 0x8449, 0x84C9, 0x8981, 0x8B21,
-0x8E0A, 0x9065, 0x967D, 0x990A, 0x617E, 0x6291, 0x6B32, 0x6C83,
-0x6D74, 0x7FCC, 0x7FFC, 0x6DC0, 0x7F85, 0x87BA, 0x88F8, 0x6765,
-0x83B1, 0x983C, 0x96F7, 0x6D1B, 0x7D61, 0x843D, 0x916A, 0x4E71,
-0x5375, 0x5D50, 0x6B04, 0x6FEB, 0x85CD, 0x862D, 0x89A7, 0x5229,
-0x540F, 0x5C65, 0x674E, 0x68A8, 0x7406, 0x7483},
-{ /* category 46 */
-0x75E2, 0x88CF, 0x88E1, 0x91CC, 0x96E2, 0x9678, 0x5F8B, 0x7387,
-0x7ACB, 0x844E, 0x63A0, 0x7565, 0x5289, 0x6D41, 0x6E9C, 0x7409,
-0x7559, 0x786B, 0x7C92, 0x9686, 0x7ADC, 0x9F8D, 0x4FB6, 0x616E,
-0x65C5, 0x865C, 0x4E86, 0x4EAE, 0x50DA, 0x4E21, 0x51CC, 0x5BEE,
-0x6599, 0x6881, 0x6DBC, 0x731F, 0x7642, 0x77AD, 0x7A1C, 0x7CE7,
-0x826F, 0x8AD2, 0x907C, 0x91CF, 0x9675, 0x9818, 0x529B, 0x7DD1,
-0x502B, 0x5398, 0x6797, 0x6DCB, 0x71D0, 0x7433, 0x81E8, 0x8F2A,
-0x96A3, 0x9C57, 0x9E9F, 0x7460, 0x5841, 0x6D99, 0x7D2F, 0x985E,
-0x4EE4, 0x4F36, 0x4F8B, 0x51B7, 0x52B1, 0x5DBA, 0x601C, 0x73B2,
-0x793C, 0x82D3, 0x9234, 0x96B7, 0x96F6, 0x970A, 0x9E97, 0x9F62,
-0x66A6, 0x6B74, 0x5217, 0x52A3, 0x70C8, 0x88C2, 0x5EC9, 0x604B,
-0x6190, 0x6F23, 0x7149, 0x7C3E, 0x7DF4, 0x806F},
-{ /* category 47 */
-0x84EE, 0x9023, 0x932C, 0x5442, 0x9B6F, 0x6AD3, 0x7089, 0x8CC2,
-0x8DEF, 0x9732, 0x52B4, 0x5A41, 0x5ECA, 0x5F04, 0x6717, 0x697C,
-0x6994, 0x6D6A, 0x6F0F, 0x7262, 0x72FC, 0x7BED, 0x8001, 0x807E,
-0x874B, 0x90CE, 0x516D, 0x9E93, 0x7984, 0x808B, 0x9332, 0x8AD6,
-0x502D, 0x548C, 0x8A71, 0x6B6A, 0x8CC4, 0x8107, 0x60D1, 0x67A0,
-0x9DF2, 0x4E99, 0x4E98, 0x9C10, 0x8A6B, 0x85C1, 0x8568, 0x6900,
-0x6E7E, 0x7897, 0x8155, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 48 */
-0x5F0C, 0x4E10, 0x4E15, 0x4E2A, 0x4E31, 0x4E36, 0x4E3C, 0x4E3F,
-0x4E42, 0x4E56, 0x4E58, 0x4E82, 0x4E85, 0x8C6B, 0x4E8A, 0x8212,
-0x5F0D, 0x4E8E, 0x4E9E, 0x4E9F, 0x4EA0, 0x4EA2, 0x4EB0, 0x4EB3,
-0x4EB6, 0x4ECE, 0x4ECD, 0x4EC4, 0x4EC6, 0x4EC2, 0x4ED7, 0x4EDE,
-0x4EED, 0x4EDF, 0x4EF7, 0x4F09, 0x4F5A, 0x4F30, 0x4F5B, 0x4F5D,
-0x4F57, 0x4F47, 0x4F76, 0x4F88, 0x4F8F, 0x4F98, 0x4F7B, 0x4F69,
-0x4F70, 0x4F91, 0x4F6F, 0x4F86, 0x4F96, 0x5118, 0x4FD4, 0x4FDF,
-0x4FCE, 0x4FD8, 0x4FDB, 0x4FD1, 0x4FDA, 0x4FD0, 0x4FE4, 0x4FE5,
-0x501A, 0x5028, 0x5014, 0x502A, 0x5025, 0x5005, 0x4F1C, 0x4FF6,
-0x5021, 0x5029, 0x502C, 0x4FFE, 0x4FEF, 0x5011, 0x5006, 0x5043,
-0x5047, 0x6703, 0x5055, 0x5050, 0x5048, 0x505A, 0x5056, 0x506C,
-0x5078, 0x5080, 0x509A, 0x5085, 0x50B4, 0x50B2},
-{ /* category 49 */
-0x50C9, 0x50CA, 0x50B3, 0x50C2, 0x50D6, 0x50DE, 0x50E5, 0x50ED,
-0x50E3, 0x50EE, 0x50F9, 0x50F5, 0x5109, 0x5101, 0x5102, 0x5116,
-0x5115, 0x5114, 0x511A, 0x5121, 0x513A, 0x5137, 0x513C, 0x513B,
-0x513F, 0x5140, 0x5152, 0x514C, 0x5154, 0x5162, 0x7AF8, 0x5169,
-0x516A, 0x516E, 0x5180, 0x5182, 0x56D8, 0x518C, 0x5189, 0x518F,
-0x5191, 0x5193, 0x5195, 0x5196, 0x51A4, 0x51A6, 0x51A2, 0x51A9,
-0x51AA, 0x51AB, 0x51B3, 0x51B1, 0x51B2, 0x51B0, 0x51B5, 0x51BD,
-0x51C5, 0x51C9, 0x51DB, 0x51E0, 0x8655, 0x51E9, 0x51ED, 0x51F0,
-0x51F5, 0x51FE, 0x5204, 0x520B, 0x5214, 0x520E, 0x5227, 0x522A,
-0x522E, 0x5233, 0x5239, 0x524F, 0x5244, 0x524B, 0x524C, 0x525E,
-0x5254, 0x526A, 0x5274, 0x5269, 0x5273, 0x527F, 0x527D, 0x528D,
-0x5294, 0x5292, 0x5271, 0x5288, 0x5291, 0x8FA8},
-{ /* category 50 */
-0x8FA7, 0x52AC, 0x52AD, 0x52BC, 0x52B5, 0x52C1, 0x52CD, 0x52D7,
-0x52DE, 0x52E3, 0x52E6, 0x98ED, 0x52E0, 0x52F3, 0x52F5, 0x52F8,
-0x52F9, 0x5306, 0x5308, 0x7538, 0x530D, 0x5310, 0x530F, 0x5315,
-0x531A, 0x5323, 0x532F, 0x5331, 0x5333, 0x5338, 0x5340, 0x5346,
-0x5345, 0x4E17, 0x5349, 0x534D, 0x51D6, 0x535E, 0x5369, 0x536E,
-0x5918, 0x537B, 0x5377, 0x5382, 0x5396, 0x53A0, 0x53A6, 0x53A5,
-0x53AE, 0x53B0, 0x53B6, 0x53C3, 0x7C12, 0x96D9, 0x53DF, 0x66FC,
-0x71EE, 0x53EE, 0x53E8, 0x53ED, 0x53FA, 0x5401, 0x543D, 0x5440,
-0x542C, 0x542D, 0x543C, 0x542E, 0x5436, 0x5429, 0x541D, 0x544E,
-0x548F, 0x5475, 0x548E, 0x545F, 0x5471, 0x5477, 0x5470, 0x5492,
-0x547B, 0x5480, 0x5476, 0x5484, 0x5490, 0x5486, 0x54C7, 0x54A2,
-0x54B8, 0x54A5, 0x54AC, 0x54C4, 0x54C8, 0x54A8},
-{ /* category 51 */
-0x54AB, 0x54C2, 0x54A4, 0x54BE, 0x54BC, 0x54D8, 0x54E5, 0x54E6,
-0x550F, 0x5514, 0x54FD, 0x54EE, 0x54ED, 0x54FA, 0x54E2, 0x5539,
-0x5540, 0x5563, 0x554C, 0x552E, 0x555C, 0x5545, 0x5556, 0x5557,
-0x5538, 0x5533, 0x555D, 0x5599, 0x5580, 0x54AF, 0x558A, 0x559F,
-0x557B, 0x557E, 0x5598, 0x559E, 0x55AE, 0x557C, 0x5583, 0x55A9,
-0x5587, 0x55A8, 0x55DA, 0x55C5, 0x55DF, 0x55C4, 0x55DC, 0x55E4,
-0x55D4, 0x5614, 0x55F7, 0x5616, 0x55FE, 0x55FD, 0x561B, 0x55F9,
-0x564E, 0x5650, 0x71DF, 0x5634, 0x5636, 0x5632, 0x5638, 0x566B,
-0x5664, 0x562F, 0x566C, 0x566A, 0x5686, 0x5680, 0x568A, 0x56A0,
-0x5694, 0x568F, 0x56A5, 0x56AE, 0x56B6, 0x56B4, 0x56C2, 0x56BC,
-0x56C1, 0x56C3, 0x56C0, 0x56C8, 0x56CE, 0x56D1, 0x56D3, 0x56D7,
-0x56EE, 0x56F9, 0x5700, 0x56FF, 0x5704, 0x5709},
-{ /* category 52 */
-0x5708, 0x570B, 0x570D, 0x5713, 0x5718, 0x5716, 0x55C7, 0x571C,
-0x5726, 0x5737, 0x5738, 0x574E, 0x573B, 0x5740, 0x574F, 0x5769,
-0x57C0, 0x5788, 0x5761, 0x577F, 0x5789, 0x5793, 0x57A0, 0x57B3,
-0x57A4, 0x57AA, 0x57B0, 0x57C3, 0x57C6, 0x57D4, 0x57D2, 0x57D3,
-0x580A, 0x57D6, 0x57E3, 0x580B, 0x5819, 0x581D, 0x5872, 0x5821,
-0x5862, 0x584B, 0x5870, 0x6BC0, 0x5852, 0x583D, 0x5879, 0x5885,
-0x58B9, 0x589F, 0x58AB, 0x58BA, 0x58DE, 0x58BB, 0x58B8, 0x58AE,
-0x58C5, 0x58D3, 0x58D1, 0x58D7, 0x58D9, 0x58D8, 0x58E5, 0x58DC,
-0x58E4, 0x58DF, 0x58EF, 0x58FA, 0x58F9, 0x58FB, 0x58FC, 0x58FD,
-0x5902, 0x590A, 0x5910, 0x591B, 0x68A6, 0x5925, 0x592C, 0x592D,
-0x5932, 0x5938, 0x593E, 0x7AD2, 0x5955, 0x5950, 0x594E, 0x595A,
-0x5958, 0x5962, 0x5960, 0x5967, 0x596C, 0x5969},
-{ /* category 53 */
-0x5978, 0x5981, 0x599D, 0x4F5E, 0x4FAB, 0x59A3, 0x59B2, 0x59C6,
-0x59E8, 0x59DC, 0x598D, 0x59D9, 0x59DA, 0x5A25, 0x5A1F, 0x5A11,
-0x5A1C, 0x5A09, 0x5A1A, 0x5A40, 0x5A6C, 0x5A49, 0x5A35, 0x5A36,
-0x5A62, 0x5A6A, 0x5A9A, 0x5ABC, 0x5ABE, 0x5ACB, 0x5AC2, 0x5ABD,
-0x5AE3, 0x5AD7, 0x5AE6, 0x5AE9, 0x5AD6, 0x5AFA, 0x5AFB, 0x5B0C,
-0x5B0B, 0x5B16, 0x5B32, 0x5AD0, 0x5B2A, 0x5B36, 0x5B3E, 0x5B43,
-0x5B45, 0x5B40, 0x5B51, 0x5B55, 0x5B5A, 0x5B5B, 0x5B65, 0x5B69,
-0x5B70, 0x5B73, 0x5B75, 0x5B78, 0x6588, 0x5B7A, 0x5B80, 0x5B83,
-0x5BA6, 0x5BB8, 0x5BC3, 0x5BC7, 0x5BC9, 0x5BD4, 0x5BD0, 0x5BE4,
-0x5BE6, 0x5BE2, 0x5BDE, 0x5BE5, 0x5BEB, 0x5BF0, 0x5BF6, 0x5BF3,
-0x5C05, 0x5C07, 0x5C08, 0x5C0D, 0x5C13, 0x5C20, 0x5C22, 0x5C28,
-0x5C38, 0x5C39, 0x5C41, 0x5C46, 0x5C4E, 0x5C53},
-{ /* category 54 */
-0x5C50, 0x5C4F, 0x5B71, 0x5C6C, 0x5C6E, 0x4E62, 0x5C76, 0x5C79,
-0x5C8C, 0x5C91, 0x5C94, 0x599B, 0x5CAB, 0x5CBB, 0x5CB6, 0x5CBC,
-0x5CB7, 0x5CC5, 0x5CBE, 0x5CC7, 0x5CD9, 0x5CE9, 0x5CFD, 0x5CFA,
-0x5CED, 0x5D8C, 0x5CEA, 0x5D0B, 0x5D15, 0x5D17, 0x5D5C, 0x5D1F,
-0x5D1B, 0x5D11, 0x5D14, 0x5D22, 0x5D1A, 0x5D19, 0x5D18, 0x5D4C,
-0x5D52, 0x5D4E, 0x5D4B, 0x5D6C, 0x5D73, 0x5D76, 0x5D87, 0x5D84,
-0x5D82, 0x5DA2, 0x5D9D, 0x5DAC, 0x5DAE, 0x5DBD, 0x5D90, 0x5DB7,
-0x5DBC, 0x5DC9, 0x5DCD, 0x5DD3, 0x5DD2, 0x5DD6, 0x5DDB, 0x5DEB,
-0x5DF2, 0x5DF5, 0x5E0B, 0x5E1A, 0x5E19, 0x5E11, 0x5E1B, 0x5E36,
-0x5E37, 0x5E44, 0x5E43, 0x5E40, 0x5E4E, 0x5E57, 0x5E54, 0x5E5F,
-0x5E62, 0x5E64, 0x5E47, 0x5E75, 0x5E76, 0x5E7A, 0x9EBC, 0x5E7F,
-0x5EA0, 0x5EC1, 0x5EC2, 0x5EC8, 0x5ED0, 0x5ECF},
-{ /* category 55 */
-0x5ED6, 0x5EE3, 0x5EDD, 0x5EDA, 0x5EDB, 0x5EE2, 0x5EE1, 0x5EE8,
-0x5EE9, 0x5EEC, 0x5EF1, 0x5EF3, 0x5EF0, 0x5EF4, 0x5EF8, 0x5EFE,
-0x5F03, 0x5F09, 0x5F5D, 0x5F5C, 0x5F0B, 0x5F11, 0x5F16, 0x5F29,
-0x5F2D, 0x5F38, 0x5F41, 0x5F48, 0x5F4C, 0x5F4E, 0x5F2F, 0x5F51,
-0x5F56, 0x5F57, 0x5F59, 0x5F61, 0x5F6D, 0x5F73, 0x5F77, 0x5F83,
-0x5F82, 0x5F7F, 0x5F8A, 0x5F88, 0x5F91, 0x5F87, 0x5F9E, 0x5F99,
-0x5F98, 0x5FA0, 0x5FA8, 0x5FAD, 0x5FBC, 0x5FD6, 0x5FFB, 0x5FE4,
-0x5FF8, 0x5FF1, 0x5FDD, 0x60B3, 0x5FFF, 0x6021, 0x6060, 0x6019,
-0x6010, 0x6029, 0x600E, 0x6031, 0x601B, 0x6015, 0x602B, 0x6026,
-0x600F, 0x603A, 0x605A, 0x6041, 0x606A, 0x6077, 0x605F, 0x604A,
-0x6046, 0x604D, 0x6063, 0x6043, 0x6064, 0x6042, 0x606C, 0x606B,
-0x6059, 0x6081, 0x608D, 0x60E7, 0x6083, 0x609A},
-{ /* category 56 */
-0x6084, 0x609B, 0x6096, 0x6097, 0x6092, 0x60A7, 0x608B, 0x60E1,
-0x60B8, 0x60E0, 0x60D3, 0x60B4, 0x5FF0, 0x60BD, 0x60C6, 0x60B5,
-0x60D8, 0x614D, 0x6115, 0x6106, 0x60F6, 0x60F7, 0x6100, 0x60F4,
-0x60FA, 0x6103, 0x6121, 0x60FB, 0x60F1, 0x610D, 0x610E, 0x6147,
-0x613E, 0x6128, 0x6127, 0x614A, 0x613F, 0x613C, 0x612C, 0x6134,
-0x613D, 0x6142, 0x6144, 0x6173, 0x6177, 0x6158, 0x6159, 0x615A,
-0x616B, 0x6174, 0x616F, 0x6165, 0x6171, 0x615F, 0x615D, 0x6153,
-0x6175, 0x6199, 0x6196, 0x6187, 0x61AC, 0x6194, 0x619A, 0x618A,
-0x6191, 0x61AB, 0x61AE, 0x61CC, 0x61CA, 0x61C9, 0x61F7, 0x61C8,
-0x61C3, 0x61C6, 0x61BA, 0x61CB, 0x7F79, 0x61CD, 0x61E6, 0x61E3,
-0x61F6, 0x61FA, 0x61F4, 0x61FF, 0x61FD, 0x61FC, 0x61FE, 0x6200,
-0x6208, 0x6209, 0x620D, 0x620C, 0x6214, 0x621B},
-{ /* category 57 */
-0x621E, 0x6221, 0x622A, 0x622E, 0x6230, 0x6232, 0x6233, 0x6241,
-0x624E, 0x625E, 0x6263, 0x625B, 0x6260, 0x6268, 0x627C, 0x6282,
-0x6289, 0x627E, 0x6292, 0x6293, 0x6296, 0x62D4, 0x6283, 0x6294,
-0x62D7, 0x62D1, 0x62BB, 0x62CF, 0x62FF, 0x62C6, 0x64D4, 0x62C8,
-0x62DC, 0x62CC, 0x62CA, 0x62C2, 0x62C7, 0x629B, 0x62C9, 0x630C,
-0x62EE, 0x62F1, 0x6327, 0x6302, 0x6308, 0x62EF, 0x62F5, 0x6350,
-0x633E, 0x634D, 0x641C, 0x634F, 0x6396, 0x638E, 0x6380, 0x63AB,
-0x6376, 0x63A3, 0x638F, 0x6389, 0x639F, 0x63B5, 0x636B, 0x6369,
-0x63BE, 0x63E9, 0x63C0, 0x63C6, 0x63E3, 0x63C9, 0x63D2, 0x63F6,
-0x63C4, 0x6416, 0x6434, 0x6406, 0x6413, 0x6426, 0x6436, 0x651D,
-0x6417, 0x6428, 0x640F, 0x6467, 0x646F, 0x6476, 0x644E, 0x652A,
-0x6495, 0x6493, 0x64A5, 0x64A9, 0x6488, 0x64BC},
-{ /* category 58 */
-0x64DA, 0x64D2, 0x64C5, 0x64C7, 0x64BB, 0x64D8, 0x64C2, 0x64F1,
-0x64E7, 0x8209, 0x64E0, 0x64E1, 0x62AC, 0x64E3, 0x64EF, 0x652C,
-0x64F6, 0x64F4, 0x64F2, 0x64FA, 0x6500, 0x64FD, 0x6518, 0x651C,
-0x6505, 0x6524, 0x6523, 0x652B, 0x6534, 0x6535, 0x6537, 0x6536,
-0x6538, 0x754B, 0x6548, 0x6556, 0x6555, 0x654D, 0x6558, 0x655E,
-0x655D, 0x6572, 0x6578, 0x6582, 0x6583, 0x8B8A, 0x659B, 0x659F,
-0x65AB, 0x65B7, 0x65C3, 0x65C6, 0x65C1, 0x65C4, 0x65CC, 0x65D2,
-0x65DB, 0x65D9, 0x65E0, 0x65E1, 0x65F1, 0x6772, 0x660A, 0x6603,
-0x65FB, 0x6773, 0x6635, 0x6636, 0x6634, 0x661C, 0x664F, 0x6644,
-0x6649, 0x6641, 0x665E, 0x665D, 0x6664, 0x6667, 0x6668, 0x665F,
-0x6662, 0x6670, 0x6683, 0x6688, 0x668E, 0x6689, 0x6684, 0x6698,
-0x669D, 0x66C1, 0x66B9, 0x66C9, 0x66BE, 0x66BC},
-{ /* category 59 */
-0x66C4, 0x66B8, 0x66D6, 0x66DA, 0x66E0, 0x663F, 0x66E6, 0x66E9,
-0x66F0, 0x66F5, 0x66F7, 0x670F, 0x6716, 0x671E, 0x6726, 0x6727,
-0x9738, 0x672E, 0x673F, 0x6736, 0x6741, 0x6738, 0x6737, 0x6746,
-0x675E, 0x6760, 0x6759, 0x6763, 0x6764, 0x6789, 0x6770, 0x67A9,
-0x677C, 0x676A, 0x678C, 0x678B, 0x67A6, 0x67A1, 0x6785, 0x67B7,
-0x67EF, 0x67B4, 0x67EC, 0x67B3, 0x67E9, 0x67B8, 0x67E4, 0x67DE,
-0x67DD, 0x67E2, 0x67EE, 0x67B9, 0x67CE, 0x67C6, 0x67E7, 0x6A9C,
-0x681E, 0x6846, 0x6829, 0x6840, 0x684D, 0x6832, 0x684E, 0x68B3,
-0x682B, 0x6859, 0x6863, 0x6877, 0x687F, 0x689F, 0x688F, 0x68AD,
-0x6894, 0x689D, 0x689B, 0x6883, 0x6AAE, 0x68B9, 0x6874, 0x68B5,
-0x68A0, 0x68BA, 0x690F, 0x688D, 0x687E, 0x6901, 0x68CA, 0x6908,
-0x68D8, 0x6922, 0x6926, 0x68E1, 0x690C, 0x68CD},
-{ /* category 60 */
-0x68D4, 0x68E7, 0x68D5, 0x6936, 0x6912, 0x6904, 0x68D7, 0x68E3,
-0x6925, 0x68F9, 0x68E0, 0x68EF, 0x6928, 0x692A, 0x691A, 0x6923,
-0x6921, 0x68C6, 0x6979, 0x6977, 0x695C, 0x6978, 0x696B, 0x6954,
-0x697E, 0x696E, 0x6939, 0x6974, 0x693D, 0x6959, 0x6930, 0x6961,
-0x695E, 0x695D, 0x6981, 0x696A, 0x69B2, 0x69AE, 0x69D0, 0x69BF,
-0x69C1, 0x69D3, 0x69BE, 0x69CE, 0x5BE8, 0x69CA, 0x69DD, 0x69BB,
-0x69C3, 0x69A7, 0x6A2E, 0x6991, 0x69A0, 0x699C, 0x6995, 0x69B4,
-0x69DE, 0x69E8, 0x6A02, 0x6A1B, 0x69FF, 0x6B0A, 0x69F9, 0x69F2,
-0x69E7, 0x6A05, 0x69B1, 0x6A1E, 0x69ED, 0x6A14, 0x69EB, 0x6A0A,
-0x6A12, 0x6AC1, 0x6A23, 0x6A13, 0x6A44, 0x6A0C, 0x6A72, 0x6A36,
-0x6A78, 0x6A47, 0x6A62, 0x6A59, 0x6A66, 0x6A48, 0x6A38, 0x6A22,
-0x6A90, 0x6A8D, 0x6AA0, 0x6A84, 0x6AA2, 0x6AA3},
-{ /* category 61 */
-0x6A97, 0x8617, 0x6ABB, 0x6AC3, 0x6AC2, 0x6AB8, 0x6AB3, 0x6AAC,
-0x6ADE, 0x6AD1, 0x6ADF, 0x6AAA, 0x6ADA, 0x6AEA, 0x6AFB, 0x6B05,
-0x8616, 0x6AFA, 0x6B12, 0x6B16, 0x9B31, 0x6B1F, 0x6B38, 0x6B37,
-0x76DC, 0x6B39, 0x98EE, 0x6B47, 0x6B43, 0x6B49, 0x6B50, 0x6B59,
-0x6B54, 0x6B5B, 0x6B5F, 0x6B61, 0x6B78, 0x6B79, 0x6B7F, 0x6B80,
-0x6B84, 0x6B83, 0x6B8D, 0x6B98, 0x6B95, 0x6B9E, 0x6BA4, 0x6BAA,
-0x6BAB, 0x6BAF, 0x6BB2, 0x6BB1, 0x6BB3, 0x6BB7, 0x6BBC, 0x6BC6,
-0x6BCB, 0x6BD3, 0x6BDF, 0x6BEC, 0x6BEB, 0x6BF3, 0x6BEF, 0x9EBE,
-0x6C08, 0x6C13, 0x6C14, 0x6C1B, 0x6C24, 0x6C23, 0x6C5E, 0x6C55,
-0x6C62, 0x6C6A, 0x6C82, 0x6C8D, 0x6C9A, 0x6C81, 0x6C9B, 0x6C7E,
-0x6C68, 0x6C73, 0x6C92, 0x6C90, 0x6CC4, 0x6CF1, 0x6CD3, 0x6CBD,
-0x6CD7, 0x6CC5, 0x6CDD, 0x6CAE, 0x6CB1, 0x6CBE},
-{ /* category 62 */
-0x6CBA, 0x6CDB, 0x6CEF, 0x6CD9, 0x6CEA, 0x6D1F, 0x884D, 0x6D36,
-0x6D2B, 0x6D3D, 0x6D38, 0x6D19, 0x6D35, 0x6D33, 0x6D12, 0x6D0C,
-0x6D63, 0x6D93, 0x6D64, 0x6D5A, 0x6D79, 0x6D59, 0x6D8E, 0x6D95,
-0x6FE4, 0x6D85, 0x6DF9, 0x6E15, 0x6E0A, 0x6DB5, 0x6DC7, 0x6DE6,
-0x6DB8, 0x6DC6, 0x6DEC, 0x6DDE, 0x6DCC, 0x6DE8, 0x6DD2, 0x6DC5,
-0x6DFA, 0x6DD9, 0x6DE4, 0x6DD5, 0x6DEA, 0x6DEE, 0x6E2D, 0x6E6E,
-0x6E2E, 0x6E19, 0x6E72, 0x6E5F, 0x6E3E, 0x6E23, 0x6E6B, 0x6E2B,
-0x6E76, 0x6E4D, 0x6E1F, 0x6E43, 0x6E3A, 0x6E4E, 0x6E24, 0x6EFF,
-0x6E1D, 0x6E38, 0x6E82, 0x6EAA, 0x6E98, 0x6EC9, 0x6EB7, 0x6ED3,
-0x6EBD, 0x6EAF, 0x6EC4, 0x6EB2, 0x6ED4, 0x6ED5, 0x6E8F, 0x6EA5,
-0x6EC2, 0x6E9F, 0x6F41, 0x6F11, 0x704C, 0x6EEC, 0x6EF8, 0x6EFE,
-0x6F3F, 0x6EF2, 0x6F31, 0x6EEF, 0x6F32, 0x6ECC},
-{ /* category 63 */
-0x6F3E, 0x6F13, 0x6EF7, 0x6F86, 0x6F7A, 0x6F78, 0x6F81, 0x6F80,
-0x6F6F, 0x6F5B, 0x6FF3, 0x6F6D, 0x6F82, 0x6F7C, 0x6F58, 0x6F8E,
-0x6F91, 0x6FC2, 0x6F66, 0x6FB3, 0x6FA3, 0x6FA1, 0x6FA4, 0x6FB9,
-0x6FC6, 0x6FAA, 0x6FDF, 0x6FD5, 0x6FEC, 0x6FD4, 0x6FD8, 0x6FF1,
-0x6FEE, 0x6FDB, 0x7009, 0x700B, 0x6FFA, 0x7011, 0x7001, 0x700F,
-0x6FFE, 0x701B, 0x701A, 0x6F74, 0x701D, 0x7018, 0x701F, 0x7030,
-0x703E, 0x7032, 0x7051, 0x7063, 0x7099, 0x7092, 0x70AF, 0x70F1,
-0x70AC, 0x70B8, 0x70B3, 0x70AE, 0x70DF, 0x70CB, 0x70DD, 0x70D9,
-0x7109, 0x70FD, 0x711C, 0x7119, 0x7165, 0x7155, 0x7188, 0x7166,
-0x7162, 0x714C, 0x7156, 0x716C, 0x718F, 0x71FB, 0x7184, 0x7195,
-0x71A8, 0x71AC, 0x71D7, 0x71B9, 0x71BE, 0x71D2, 0x71C9, 0x71D4,
-0x71CE, 0x71E0, 0x71EC, 0x71E7, 0x71F5, 0x71FC},
-{ /* category 64 */
-0x71F9, 0x71FF, 0x720D, 0x7210, 0x721B, 0x7228, 0x722D, 0x722C,
-0x7230, 0x7232, 0x723B, 0x723C, 0x723F, 0x7240, 0x7246, 0x724B,
-0x7258, 0x7274, 0x727E, 0x7282, 0x7281, 0x7287, 0x7292, 0x7296,
-0x72A2, 0x72A7, 0x72B9, 0x72B2, 0x72C3, 0x72C6, 0x72C4, 0x72CE,
-0x72D2, 0x72E2, 0x72E0, 0x72E1, 0x72F9, 0x72F7, 0x500F, 0x7317,
-0x730A, 0x731C, 0x7316, 0x731D, 0x7334, 0x732F, 0x7329, 0x7325,
-0x733E, 0x734E, 0x734F, 0x9ED8, 0x7357, 0x736A, 0x7368, 0x7370,
-0x7378, 0x7375, 0x737B, 0x737A, 0x73C8, 0x73B3, 0x73CE, 0x73BB,
-0x73C0, 0x73E5, 0x73EE, 0x73DE, 0x74A2, 0x7405, 0x746F, 0x7425,
-0x73F8, 0x7432, 0x743A, 0x7455, 0x743F, 0x745F, 0x7459, 0x7441,
-0x745C, 0x7469, 0x7470, 0x7463, 0x746A, 0x7476, 0x747E, 0x748B,
-0x749E, 0x74A7, 0x74CA, 0x74CF, 0x74D4, 0x73F1},
-{ /* category 65 */
-0x74E0, 0x74E3, 0x74E7, 0x74E9, 0x74EE, 0x74F2, 0x74F0, 0x74F1,
-0x74F8, 0x74F7, 0x7504, 0x7503, 0x7505, 0x750C, 0x750E, 0x750D,
-0x7515, 0x7513, 0x751E, 0x7526, 0x752C, 0x753C, 0x7544, 0x754D,
-0x754A, 0x7549, 0x755B, 0x7546, 0x755A, 0x7569, 0x7564, 0x7567,
-0x756B, 0x756D, 0x7578, 0x7576, 0x7586, 0x7587, 0x7574, 0x758A,
-0x7589, 0x7582, 0x7594, 0x759A, 0x759D, 0x75A5, 0x75A3, 0x75C2,
-0x75B3, 0x75C3, 0x75B5, 0x75BD, 0x75B8, 0x75BC, 0x75B1, 0x75CD,
-0x75CA, 0x75D2, 0x75D9, 0x75E3, 0x75DE, 0x75FE, 0x75FF, 0x75FC,
-0x7601, 0x75F0, 0x75FA, 0x75F2, 0x75F3, 0x760B, 0x760D, 0x7609,
-0x761F, 0x7627, 0x7620, 0x7621, 0x7622, 0x7624, 0x7634, 0x7630,
-0x763B, 0x7647, 0x7648, 0x7646, 0x765C, 0x7658, 0x7661, 0x7662,
-0x7668, 0x7669, 0x766A, 0x7667, 0x766C, 0x7670},
-{ /* category 66 */
-0x7672, 0x7676, 0x7678, 0x767C, 0x7680, 0x7683, 0x7688, 0x768B,
-0x768E, 0x7696, 0x7693, 0x7699, 0x769A, 0x76B0, 0x76B4, 0x76B8,
-0x76B9, 0x76BA, 0x76C2, 0x76CD, 0x76D6, 0x76D2, 0x76DE, 0x76E1,
-0x76E5, 0x76E7, 0x76EA, 0x862F, 0x76FB, 0x7708, 0x7707, 0x7704,
-0x7729, 0x7724, 0x771E, 0x7725, 0x7726, 0x771B, 0x7737, 0x7738,
-0x7747, 0x775A, 0x7768, 0x776B, 0x775B, 0x7765, 0x777F, 0x777E,
-0x7779, 0x778E, 0x778B, 0x7791, 0x77A0, 0x779E, 0x77B0, 0x77B6,
-0x77B9, 0x77BF, 0x77BC, 0x77BD, 0x77BB, 0x77C7, 0x77CD, 0x77D7,
-0x77DA, 0x77DC, 0x77E3, 0x77EE, 0x77FC, 0x780C, 0x7812, 0x7926,
-0x7820, 0x792A, 0x7845, 0x788E, 0x7874, 0x7886, 0x787C, 0x789A,
-0x788C, 0x78A3, 0x78B5, 0x78AA, 0x78AF, 0x78D1, 0x78C6, 0x78CB,
-0x78D4, 0x78BE, 0x78BC, 0x78C5, 0x78CA, 0x78EC},
-{ /* category 67 */
-0x78E7, 0x78DA, 0x78FD, 0x78F4, 0x7907, 0x7912, 0x7911, 0x7919,
-0x792C, 0x792B, 0x7940, 0x7960, 0x7957, 0x795F, 0x795A, 0x7955,
-0x7953, 0x797A, 0x797F, 0x798A, 0x799D, 0x79A7, 0x9F4B, 0x79AA,
-0x79AE, 0x79B3, 0x79B9, 0x79BA, 0x79C9, 0x79D5, 0x79E7, 0x79EC,
-0x79E1, 0x79E3, 0x7A08, 0x7A0D, 0x7A18, 0x7A19, 0x7A20, 0x7A1F,
-0x7980, 0x7A31, 0x7A3B, 0x7A3E, 0x7A37, 0x7A43, 0x7A57, 0x7A49,
-0x7A61, 0x7A62, 0x7A69, 0x9F9D, 0x7A70, 0x7A79, 0x7A7D, 0x7A88,
-0x7A97, 0x7A95, 0x7A98, 0x7A96, 0x7AA9, 0x7AC8, 0x7AB0, 0x7AB6,
-0x7AC5, 0x7AC4, 0x7ABF, 0x9083, 0x7AC7, 0x7ACA, 0x7ACD, 0x7ACF,
-0x7AD5, 0x7AD3, 0x7AD9, 0x7ADA, 0x7ADD, 0x7AE1, 0x7AE2, 0x7AE6,
-0x7AED, 0x7AF0, 0x7B02, 0x7B0F, 0x7B0A, 0x7B06, 0x7B33, 0x7B18,
-0x7B19, 0x7B1E, 0x7B35, 0x7B28, 0x7B36, 0x7B50},
-{ /* category 68 */
-0x7B7A, 0x7B04, 0x7B4D, 0x7B0B, 0x7B4C, 0x7B45, 0x7B75, 0x7B65,
-0x7B74, 0x7B67, 0x7B70, 0x7B71, 0x7B6C, 0x7B6E, 0x7B9D, 0x7B98,
-0x7B9F, 0x7B8D, 0x7B9C, 0x7B9A, 0x7B8B, 0x7B92, 0x7B8F, 0x7B5D,
-0x7B99, 0x7BCB, 0x7BC1, 0x7BCC, 0x7BCF, 0x7BB4, 0x7BC6, 0x7BDD,
-0x7BE9, 0x7C11, 0x7C14, 0x7BE6, 0x7BE5, 0x7C60, 0x7C00, 0x7C07,
-0x7C13, 0x7BF3, 0x7BF7, 0x7C17, 0x7C0D, 0x7BF6, 0x7C23, 0x7C27,
-0x7C2A, 0x7C1F, 0x7C37, 0x7C2B, 0x7C3D, 0x7C4C, 0x7C43, 0x7C54,
-0x7C4F, 0x7C40, 0x7C50, 0x7C58, 0x7C5F, 0x7C64, 0x7C56, 0x7C65,
-0x7C6C, 0x7C75, 0x7C83, 0x7C90, 0x7CA4, 0x7CAD, 0x7CA2, 0x7CAB,
-0x7CA1, 0x7CA8, 0x7CB3, 0x7CB2, 0x7CB1, 0x7CAE, 0x7CB9, 0x7CBD,
-0x7CC0, 0x7CC5, 0x7CC2, 0x7CD8, 0x7CD2, 0x7CDC, 0x7CE2, 0x9B3B,
-0x7CEF, 0x7CF2, 0x7CF4, 0x7CF6, 0x7CFA, 0x7D06},
-{ /* category 69 */
-0x7D02, 0x7D1C, 0x7D15, 0x7D0A, 0x7D45, 0x7D4B, 0x7D2E, 0x7D32,
-0x7D3F, 0x7D35, 0x7D46, 0x7D73, 0x7D56, 0x7D4E, 0x7D72, 0x7D68,
-0x7D6E, 0x7D4F, 0x7D63, 0x7D93, 0x7D89, 0x7D5B, 0x7D8F, 0x7D7D,
-0x7D9B, 0x7DBA, 0x7DAE, 0x7DA3, 0x7DB5, 0x7DC7, 0x7DBD, 0x7DAB,
-0x7E3D, 0x7DA2, 0x7DAF, 0x7DDC, 0x7DB8, 0x7D9F, 0x7DB0, 0x7DD8,
-0x7DDD, 0x7DE4, 0x7DDE, 0x7DFB, 0x7DF2, 0x7DE1, 0x7E05, 0x7E0A,
-0x7E23, 0x7E21, 0x7E12, 0x7E31, 0x7E1F, 0x7E09, 0x7E0B, 0x7E22,
-0x7E46, 0x7E66, 0x7E3B, 0x7E35, 0x7E39, 0x7E43, 0x7E37, 0x7E32,
-0x7E3A, 0x7E67, 0x7E5D, 0x7E56, 0x7E5E, 0x7E59, 0x7E5A, 0x7E79,
-0x7E6A, 0x7E69, 0x7E7C, 0x7E7B, 0x7E83, 0x7DD5, 0x7E7D, 0x8FAE,
-0x7E7F, 0x7E88, 0x7E89, 0x7E8C, 0x7E92, 0x7E90, 0x7E93, 0x7E94,
-0x7E96, 0x7E8E, 0x7E9B, 0x7E9C, 0x7F38, 0x7F3A},
-{ /* category 70 */
-0x7F45, 0x7F4C, 0x7F4D, 0x7F4E, 0x7F50, 0x7F51, 0x7F55, 0x7F54,
-0x7F58, 0x7F5F, 0x7F60, 0x7F68, 0x7F69, 0x7F67, 0x7F78, 0x7F82,
-0x7F86, 0x7F83, 0x7F88, 0x7F87, 0x7F8C, 0x7F94, 0x7F9E, 0x7F9D,
-0x7F9A, 0x7FA3, 0x7FAF, 0x7FB2, 0x7FB9, 0x7FAE, 0x7FB6, 0x7FB8,
-0x8B71, 0x7FC5, 0x7FC6, 0x7FCA, 0x7FD5, 0x7FD4, 0x7FE1, 0x7FE6,
-0x7FE9, 0x7FF3, 0x7FF9, 0x98DC, 0x8006, 0x8004, 0x800B, 0x8012,
-0x8018, 0x8019, 0x801C, 0x8021, 0x8028, 0x803F, 0x803B, 0x804A,
-0x8046, 0x8052, 0x8058, 0x805A, 0x805F, 0x8062, 0x8068, 0x8073,
-0x8072, 0x8070, 0x8076, 0x8079, 0x807D, 0x807F, 0x8084, 0x8086,
-0x8085, 0x809B, 0x8093, 0x809A, 0x80AD, 0x5190, 0x80AC, 0x80DB,
-0x80E5, 0x80D9, 0x80DD, 0x80C4, 0x80DA, 0x80D6, 0x8109, 0x80EF,
-0x80F1, 0x811B, 0x8129, 0x8123, 0x812F, 0x814B},
-{ /* category 71 */
-0x968B, 0x8146, 0x813E, 0x8153, 0x8151, 0x80FC, 0x8171, 0x816E,
-0x8165, 0x8166, 0x8174, 0x8183, 0x8188, 0x818A, 0x8180, 0x8182,
-0x81A0, 0x8195, 0x81A4, 0x81A3, 0x815F, 0x8193, 0x81A9, 0x81B0,
-0x81B5, 0x81BE, 0x81B8, 0x81BD, 0x81C0, 0x81C2, 0x81BA, 0x81C9,
-0x81CD, 0x81D1, 0x81D9, 0x81D8, 0x81C8, 0x81DA, 0x81DF, 0x81E0,
-0x81E7, 0x81FA, 0x81FB, 0x81FE, 0x8201, 0x8202, 0x8205, 0x8207,
-0x820A, 0x820D, 0x8210, 0x8216, 0x8229, 0x822B, 0x8238, 0x8233,
-0x8240, 0x8259, 0x8258, 0x825D, 0x825A, 0x825F, 0x8264, 0x8262,
-0x8268, 0x826A, 0x826B, 0x822E, 0x8271, 0x8277, 0x8278, 0x827E,
-0x828D, 0x8292, 0x82AB, 0x829F, 0x82BB, 0x82AC, 0x82E1, 0x82E3,
-0x82DF, 0x82D2, 0x82F4, 0x82F3, 0x82FA, 0x8393, 0x8303, 0x82FB,
-0x82F9, 0x82DE, 0x8306, 0x82DC, 0x8309, 0x82D9},
-{ /* category 72 */
-0x8335, 0x8334, 0x8316, 0x8332, 0x8331, 0x8340, 0x8339, 0x8350,
-0x8345, 0x832F, 0x832B, 0x8317, 0x8318, 0x8385, 0x839A, 0x83AA,
-0x839F, 0x83A2, 0x8396, 0x8323, 0x838E, 0x8387, 0x838A, 0x837C,
-0x83B5, 0x8373, 0x8375, 0x83A0, 0x8389, 0x83A8, 0x83F4, 0x8413,
-0x83EB, 0x83CE, 0x83FD, 0x8403, 0x83D8, 0x840B, 0x83C1, 0x83F7,
-0x8407, 0x83E0, 0x83F2, 0x840D, 0x8422, 0x8420, 0x83BD, 0x8438,
-0x8506, 0x83FB, 0x846D, 0x842A, 0x843C, 0x855A, 0x8484, 0x8477,
-0x846B, 0x84AD, 0x846E, 0x8482, 0x8469, 0x8446, 0x842C, 0x846F,
-0x8479, 0x8435, 0x84CA, 0x8462, 0x84B9, 0x84BF, 0x849F, 0x84D9,
-0x84CD, 0x84BB, 0x84DA, 0x84D0, 0x84C1, 0x84C6, 0x84D6, 0x84A1,
-0x8521, 0x84FF, 0x84F4, 0x8517, 0x8518, 0x852C, 0x851F, 0x8515,
-0x8514, 0x84FC, 0x8540, 0x8563, 0x8558, 0x8548},
-{ /* category 73 */
-0x8541, 0x8602, 0x854B, 0x8555, 0x8580, 0x85A4, 0x8588, 0x8591,
-0x858A, 0x85A8, 0x856D, 0x8594, 0x859B, 0x85EA, 0x8587, 0x859C,
-0x8577, 0x857E, 0x8590, 0x85C9, 0x85BA, 0x85CF, 0x85B9, 0x85D0,
-0x85D5, 0x85DD, 0x85E5, 0x85DC, 0x85F9, 0x860A, 0x8613, 0x860B,
-0x85FE, 0x85FA, 0x8606, 0x8622, 0x861A, 0x8630, 0x863F, 0x864D,
-0x4E55, 0x8654, 0x865F, 0x8667, 0x8671, 0x8693, 0x86A3, 0x86A9,
-0x86AA, 0x868B, 0x868C, 0x86B6, 0x86AF, 0x86C4, 0x86C6, 0x86B0,
-0x86C9, 0x8823, 0x86AB, 0x86D4, 0x86DE, 0x86E9, 0x86EC, 0x86DF,
-0x86DB, 0x86EF, 0x8712, 0x8706, 0x8708, 0x8700, 0x8703, 0x86FB,
-0x8711, 0x8709, 0x870D, 0x86F9, 0x870A, 0x8734, 0x873F, 0x8737,
-0x873B, 0x8725, 0x8729, 0x871A, 0x8760, 0x875F, 0x8778, 0x874C,
-0x874E, 0x8774, 0x8757, 0x8768, 0x876E, 0x8759},
-{ /* category 74 */
-0x8753, 0x8763, 0x876A, 0x8805, 0x87A2, 0x879F, 0x8782, 0x87AF,
-0x87CB, 0x87BD, 0x87C0, 0x87D0, 0x96D6, 0x87AB, 0x87C4, 0x87B3,
-0x87C7, 0x87C6, 0x87BB, 0x87EF, 0x87F2, 0x87E0, 0x880F, 0x880D,
-0x87FE, 0x87F6, 0x87F7, 0x880E, 0x87D2, 0x8811, 0x8816, 0x8815,
-0x8822, 0x8821, 0x8831, 0x8836, 0x8839, 0x8827, 0x883B, 0x8844,
-0x8842, 0x8852, 0x8859, 0x885E, 0x8862, 0x886B, 0x8881, 0x887E,
-0x889E, 0x8875, 0x887D, 0x88B5, 0x8872, 0x8882, 0x8897, 0x8892,
-0x88AE, 0x8899, 0x88A2, 0x888D, 0x88A4, 0x88B0, 0x88BF, 0x88B1,
-0x88C3, 0x88C4, 0x88D4, 0x88D8, 0x88D9, 0x88DD, 0x88F9, 0x8902,
-0x88FC, 0x88F4, 0x88E8, 0x88F2, 0x8904, 0x890C, 0x890A, 0x8913,
-0x8943, 0x891E, 0x8925, 0x892A, 0x892B, 0x8941, 0x8944, 0x893B,
-0x8936, 0x8938, 0x894C, 0x891D, 0x8960, 0x895E},
-{ /* category 75 */
-0x8966, 0x8964, 0x896D, 0x896A, 0x896F, 0x8974, 0x8977, 0x897E,
-0x8983, 0x8988, 0x898A, 0x8993, 0x8998, 0x89A1, 0x89A9, 0x89A6,
-0x89AC, 0x89AF, 0x89B2, 0x89BA, 0x89BD, 0x89BF, 0x89C0, 0x89DA,
-0x89DC, 0x89DD, 0x89E7, 0x89F4, 0x89F8, 0x8A03, 0x8A16, 0x8A10,
-0x8A0C, 0x8A1B, 0x8A1D, 0x8A25, 0x8A36, 0x8A41, 0x8A5B, 0x8A52,
-0x8A46, 0x8A48, 0x8A7C, 0x8A6D, 0x8A6C, 0x8A62, 0x8A85, 0x8A82,
-0x8A84, 0x8AA8, 0x8AA1, 0x8A91, 0x8AA5, 0x8AA6, 0x8A9A, 0x8AA3,
-0x8AC4, 0x8ACD, 0x8AC2, 0x8ADA, 0x8AEB, 0x8AF3, 0x8AE7, 0x8AE4,
-0x8AF1, 0x8B14, 0x8AE0, 0x8AE2, 0x8AF7, 0x8ADE, 0x8ADB, 0x8B0C,
-0x8B07, 0x8B1A, 0x8AE1, 0x8B16, 0x8B10, 0x8B17, 0x8B20, 0x8B33,
-0x97AB, 0x8B26, 0x8B2B, 0x8B3E, 0x8B28, 0x8B41, 0x8B4C, 0x8B4F,
-0x8B4E, 0x8B49, 0x8B56, 0x8B5B, 0x8B5A, 0x8B6B},
-{ /* category 76 */
-0x8B5F, 0x8B6C, 0x8B6F, 0x8B74, 0x8B7D, 0x8B80, 0x8B8C, 0x8B8E,
-0x8B92, 0x8B93, 0x8B96, 0x8B99, 0x8B9A, 0x8C3A, 0x8C41, 0x8C3F,
-0x8C48, 0x8C4C, 0x8C4E, 0x8C50, 0x8C55, 0x8C62, 0x8C6C, 0x8C78,
-0x8C7A, 0x8C82, 0x8C89, 0x8C85, 0x8C8A, 0x8C8D, 0x8C8E, 0x8C94,
-0x8C7C, 0x8C98, 0x621D, 0x8CAD, 0x8CAA, 0x8CBD, 0x8CB2, 0x8CB3,
-0x8CAE, 0x8CB6, 0x8CC8, 0x8CC1, 0x8CE4, 0x8CE3, 0x8CDA, 0x8CFD,
-0x8CFA, 0x8CFB, 0x8D04, 0x8D05, 0x8D0A, 0x8D07, 0x8D0F, 0x8D0D,
-0x8D10, 0x9F4E, 0x8D13, 0x8CCD, 0x8D14, 0x8D16, 0x8D67, 0x8D6D,
-0x8D71, 0x8D73, 0x8D81, 0x8D99, 0x8DC2, 0x8DBE, 0x8DBA, 0x8DCF,
-0x8DDA, 0x8DD6, 0x8DCC, 0x8DDB, 0x8DCB, 0x8DEA, 0x8DEB, 0x8DDF,
-0x8DE3, 0x8DFC, 0x8E08, 0x8E09, 0x8DFF, 0x8E1D, 0x8E1E, 0x8E10,
-0x8E1F, 0x8E42, 0x8E35, 0x8E30, 0x8E34, 0x8E4A},
-{ /* category 77 */
-0x8E47, 0x8E49, 0x8E4C, 0x8E50, 0x8E48, 0x8E59, 0x8E64, 0x8E60,
-0x8E2A, 0x8E63, 0x8E55, 0x8E76, 0x8E72, 0x8E7C, 0x8E81, 0x8E87,
-0x8E85, 0x8E84, 0x8E8B, 0x8E8A, 0x8E93, 0x8E91, 0x8E94, 0x8E99,
-0x8EAA, 0x8EA1, 0x8EAC, 0x8EB0, 0x8EC6, 0x8EB1, 0x8EBE, 0x8EC5,
-0x8EC8, 0x8ECB, 0x8EDB, 0x8EE3, 0x8EFC, 0x8EFB, 0x8EEB, 0x8EFE,
-0x8F0A, 0x8F05, 0x8F15, 0x8F12, 0x8F19, 0x8F13, 0x8F1C, 0x8F1F,
-0x8F1B, 0x8F0C, 0x8F26, 0x8F33, 0x8F3B, 0x8F39, 0x8F45, 0x8F42,
-0x8F3E, 0x8F4C, 0x8F49, 0x8F46, 0x8F4E, 0x8F57, 0x8F5C, 0x8F62,
-0x8F63, 0x8F64, 0x8F9C, 0x8F9F, 0x8FA3, 0x8FAD, 0x8FAF, 0x8FB7,
-0x8FDA, 0x8FE5, 0x8FE2, 0x8FEA, 0x8FEF, 0x9087, 0x8FF4, 0x9005,
-0x8FF9, 0x8FFA, 0x9011, 0x9015, 0x9021, 0x900D, 0x901E, 0x9016,
-0x900B, 0x9027, 0x9036, 0x9035, 0x9039, 0x8FF8},
-{ /* category 78 */
-0x904F, 0x9050, 0x9051, 0x9052, 0x900E, 0x9049, 0x903E, 0x9056,
-0x9058, 0x905E, 0x9068, 0x906F, 0x9076, 0x96A8, 0x9072, 0x9082,
-0x907D, 0x9081, 0x9080, 0x908A, 0x9089, 0x908F, 0x90A8, 0x90AF,
-0x90B1, 0x90B5, 0x90E2, 0x90E4, 0x6248, 0x90DB, 0x9102, 0x9112,
-0x9119, 0x9132, 0x9130, 0x914A, 0x9156, 0x9158, 0x9163, 0x9165,
-0x9169, 0x9173, 0x9172, 0x918B, 0x9189, 0x9182, 0x91A2, 0x91AB,
-0x91AF, 0x91AA, 0x91B5, 0x91B4, 0x91BA, 0x91C0, 0x91C1, 0x91C9,
-0x91CB, 0x91D0, 0x91D6, 0x91DF, 0x91E1, 0x91DB, 0x91FC, 0x91F5,
-0x91F6, 0x921E, 0x91FF, 0x9214, 0x922C, 0x9215, 0x9211, 0x925E,
-0x9257, 0x9245, 0x9249, 0x9264, 0x9248, 0x9295, 0x923F, 0x924B,
-0x9250, 0x929C, 0x9296, 0x9293, 0x929B, 0x925A, 0x92CF, 0x92B9,
-0x92B7, 0x92E9, 0x930F, 0x92FA, 0x9344, 0x932E},
-{ /* category 79 */
-0x9319, 0x9322, 0x931A, 0x9323, 0x933A, 0x9335, 0x933B, 0x935C,
-0x9360, 0x937C, 0x936E, 0x9356, 0x93B0, 0x93AC, 0x93AD, 0x9394,
-0x93B9, 0x93D6, 0x93D7, 0x93E8, 0x93E5, 0x93D8, 0x93C3, 0x93DD,
-0x93D0, 0x93C8, 0x93E4, 0x941A, 0x9414, 0x9413, 0x9403, 0x9407,
-0x9410, 0x9436, 0x942B, 0x9435, 0x9421, 0x943A, 0x9441, 0x9452,
-0x9444, 0x945B, 0x9460, 0x9462, 0x945E, 0x946A, 0x9229, 0x9470,
-0x9475, 0x9477, 0x947D, 0x945A, 0x947C, 0x947E, 0x9481, 0x947F,
-0x9582, 0x9587, 0x958A, 0x9594, 0x9596, 0x9598, 0x9599, 0x95A0,
-0x95A8, 0x95A7, 0x95AD, 0x95BC, 0x95BB, 0x95B9, 0x95BE, 0x95CA,
-0x6FF6, 0x95C3, 0x95CD, 0x95CC, 0x95D5, 0x95D4, 0x95D6, 0x95DC,
-0x95E1, 0x95E5, 0x95E2, 0x9621, 0x9628, 0x962E, 0x962F, 0x9642,
-0x964C, 0x964F, 0x964B, 0x9677, 0x965C, 0x965E},
-{ /* category 80 */
-0x965D, 0x965F, 0x9666, 0x9672, 0x966C, 0x968D, 0x9698, 0x9695,
-0x9697, 0x96AA, 0x96A7, 0x96B1, 0x96B2, 0x96B0, 0x96B4, 0x96B6,
-0x96B8, 0x96B9, 0x96CE, 0x96CB, 0x96C9, 0x96CD, 0x894D, 0x96DC,
-0x970D, 0x96D5, 0x96F9, 0x9704, 0x9706, 0x9708, 0x9713, 0x970E,
-0x9711, 0x970F, 0x9716, 0x9719, 0x9724, 0x972A, 0x9730, 0x9739,
-0x973D, 0x973E, 0x9744, 0x9746, 0x9748, 0x9742, 0x9749, 0x975C,
-0x9760, 0x9764, 0x9766, 0x9768, 0x52D2, 0x976B, 0x9771, 0x9779,
-0x9785, 0x977C, 0x9781, 0x977A, 0x9786, 0x978B, 0x978F, 0x9790,
-0x979C, 0x97A8, 0x97A6, 0x97A3, 0x97B3, 0x97B4, 0x97C3, 0x97C6,
-0x97C8, 0x97CB, 0x97DC, 0x97ED, 0x9F4F, 0x97F2, 0x7ADF, 0x97F6,
-0x97F5, 0x980F, 0x980C, 0x9838, 0x9824, 0x9821, 0x9837, 0x983D,
-0x9846, 0x984F, 0x984B, 0x986B, 0x986F, 0x9870},
-{ /* category 81 */
-0x9871, 0x9874, 0x9873, 0x98AA, 0x98AF, 0x98B1, 0x98B6, 0x98C4,
-0x98C3, 0x98C6, 0x98E9, 0x98EB, 0x9903, 0x9909, 0x9912, 0x9914,
-0x9918, 0x9921, 0x991D, 0x991E, 0x9924, 0x9920, 0x992C, 0x992E,
-0x993D, 0x993E, 0x9942, 0x9949, 0x9945, 0x9950, 0x994B, 0x9951,
-0x9952, 0x994C, 0x9955, 0x9997, 0x9998, 0x99A5, 0x99AD, 0x99AE,
-0x99BC, 0x99DF, 0x99DB, 0x99DD, 0x99D8, 0x99D1, 0x99ED, 0x99EE,
-0x99F1, 0x99F2, 0x99FB, 0x99F8, 0x9A01, 0x9A0F, 0x9A05, 0x99E2,
-0x9A19, 0x9A2B, 0x9A37, 0x9A45, 0x9A42, 0x9A40, 0x9A43, 0x9A3E,
-0x9A55, 0x9A4D, 0x9A5B, 0x9A57, 0x9A5F, 0x9A62, 0x9A65, 0x9A64,
-0x9A69, 0x9A6B, 0x9A6A, 0x9AAD, 0x9AB0, 0x9ABC, 0x9AC0, 0x9ACF,
-0x9AD1, 0x9AD3, 0x9AD4, 0x9ADE, 0x9ADF, 0x9AE2, 0x9AE3, 0x9AE6,
-0x9AEF, 0x9AEB, 0x9AEE, 0x9AF4, 0x9AF1, 0x9AF7},
-{ /* category 82 */
-0x9AFB, 0x9B06, 0x9B18, 0x9B1A, 0x9B1F, 0x9B22, 0x9B23, 0x9B25,
-0x9B27, 0x9B28, 0x9B29, 0x9B2A, 0x9B2E, 0x9B2F, 0x9B32, 0x9B44,
-0x9B43, 0x9B4F, 0x9B4D, 0x9B4E, 0x9B51, 0x9B58, 0x9B74, 0x9B93,
-0x9B83, 0x9B91, 0x9B96, 0x9B97, 0x9B9F, 0x9BA0, 0x9BA8, 0x9BB4,
-0x9BC0, 0x9BCA, 0x9BB9, 0x9BC6, 0x9BCF, 0x9BD1, 0x9BD2, 0x9BE3,
-0x9BE2, 0x9BE4, 0x9BD4, 0x9BE1, 0x9C3A, 0x9BF2, 0x9BF1, 0x9BF0,
-0x9C15, 0x9C14, 0x9C09, 0x9C13, 0x9C0C, 0x9C06, 0x9C08, 0x9C12,
-0x9C0A, 0x9C04, 0x9C2E, 0x9C1B, 0x9C25, 0x9C24, 0x9C21, 0x9C30,
-0x9C47, 0x9C32, 0x9C46, 0x9C3E, 0x9C5A, 0x9C60, 0x9C67, 0x9C76,
-0x9C78, 0x9CE7, 0x9CEC, 0x9CF0, 0x9D09, 0x9D08, 0x9CEB, 0x9D03,
-0x9D06, 0x9D2A, 0x9D26, 0x9DAF, 0x9D23, 0x9D1F, 0x9D44, 0x9D15,
-0x9D12, 0x9D41, 0x9D3F, 0x9D3E, 0x9D46, 0x9D48},
-{ /* category 83 */
-0x9D5D, 0x9D5E, 0x9D64, 0x9D51, 0x9D50, 0x9D59, 0x9D72, 0x9D89,
-0x9D87, 0x9DAB, 0x9D6F, 0x9D7A, 0x9D9A, 0x9DA4, 0x9DA9, 0x9DB2,
-0x9DC4, 0x9DC1, 0x9DBB, 0x9DB8, 0x9DBA, 0x9DC6, 0x9DCF, 0x9DC2,
-0x9DD9, 0x9DD3, 0x9DF8, 0x9DE6, 0x9DED, 0x9DEF, 0x9DFD, 0x9E1A,
-0x9E1B, 0x9E1E, 0x9E75, 0x9E79, 0x9E7D, 0x9E81, 0x9E88, 0x9E8B,
-0x9E8C, 0x9E92, 0x9E95, 0x9E91, 0x9E9D, 0x9EA5, 0x9EA9, 0x9EB8,
-0x9EAA, 0x9EAD, 0x9761, 0x9ECC, 0x9ECE, 0x9ECF, 0x9ED0, 0x9ED4,
-0x9EDC, 0x9EDE, 0x9EDD, 0x9EE0, 0x9EE5, 0x9EE8, 0x9EEF, 0x9EF4,
-0x9EF6, 0x9EF7, 0x9EF9, 0x9EFB, 0x9EFC, 0x9EFD, 0x9F07, 0x9F08,
-0x76B7, 0x9F15, 0x9F21, 0x9F2C, 0x9F3E, 0x9F4A, 0x9F52, 0x9F54,
-0x9F63, 0x9F5F, 0x9F60, 0x9F61, 0x9F66, 0x9F67, 0x9F6C, 0x9F6A,
-0x9F77, 0x9F72, 0x9F76, 0x9F95, 0x9F9C, 0x9FA0},
-{ /* category 84 */
-0x582F, 0x69C7, 0x9059, 0x7464, 0x51DC, 0x7199, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 85 */
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 86 */
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 87 */
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 88 */
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
-{ /* category 89 */
-0x7E8A, 0x891C, 0x9348, 0x9288, 0x84DC, 0x4FC9, 0x70BB, 0x6631,
-0x68C8, 0x92F9, 0x66FB, 0x5F45, 0x4E28, 0x4EE1, 0x4EFC, 0x4F00,
-0x4F03, 0x4F39, 0x4F56, 0x4F92, 0x4F8A, 0x4F9A, 0x4F94, 0x4FCD,
-0x5040, 0x5022, 0x4FFF, 0x501E, 0x5046, 0x5070, 0x5042, 0x5094,
-0x50F4, 0x50D8, 0x514A, 0x5164, 0x519D, 0x51BE, 0x51EC, 0x5215,
-0x529C, 0x52A6, 0x52C0, 0x52DB, 0x5300, 0x5307, 0x5324, 0x5372,
-0x5393, 0x53B2, 0x53DD, 0xFA0E, 0x549C, 0x548A, 0x54A9, 0x54FF,
-0x5586, 0x5759, 0x5765, 0x57AC, 0x57C8, 0x57C7, 0xFA0F, 0xFA10,
-0x589E, 0x58B2, 0x590B, 0x5953, 0x595B, 0x595D, 0x5963, 0x59A4,
-0x59BA, 0x5B56, 0x5BC0, 0x752F, 0x5BD8, 0x5BEC, 0x5C1E, 0x5CA6,
-0x5CBA, 0x5CF5, 0x5D27, 0x5D53, 0xFA11, 0x5D42, 0x5D6D, 0x5DB8,
-0x5DB9, 0x5DD0, 0x5F21, 0x5F34, 0x5F67, 0x5FB7},
-{ /* category 90 */
-0x5FDE, 0x605D, 0x6085, 0x608A, 0x60DE, 0x60D5, 0x6120, 0x60F2,
-0x6111, 0x6137, 0x6130, 0x6198, 0x6213, 0x62A6, 0x63F5, 0x6460,
-0x649D, 0x64CE, 0x654E, 0x6600, 0x6615, 0x663B, 0x6609, 0x662E,
-0x661E, 0x6624, 0x6665, 0x6657, 0x6659, 0xFA12, 0x6673, 0x6699,
-0x66A0, 0x66B2, 0x66BF, 0x66FA, 0x670E, 0xF929, 0x6766, 0x67BB,
-0x6852, 0x67C0, 0x6801, 0x6844, 0x68CF, 0xFA13, 0x6968, 0xFA14,
-0x6998, 0x69E2, 0x6A30, 0x6A6B, 0x6A46, 0x6A73, 0x6A7E, 0x6AE2,
-0x6AE4, 0x6BD6, 0x6C3F, 0x6C5C, 0x6C86, 0x6C6F, 0x6CDA, 0x6D04,
-0x6D87, 0x6D6F, 0x6D96, 0x6DAC, 0x6DCF, 0x6DF8, 0x6DF2, 0x6DFC,
-0x6E39, 0x6E5C, 0x6E27, 0x6E3C, 0x6EBF, 0x6F88, 0x6FB5, 0x6FF5,
-0x7005, 0x7007, 0x7028, 0x7085, 0x70AB, 0x710F, 0x7104, 0x715C,
-0x7146, 0x7147, 0xFA15, 0x71C1, 0x71FE, 0x72B1},
-{ /* category 91 */
-0x72BE, 0x7324, 0xFA16, 0x7377, 0x73BD, 0x73C9, 0x73D6, 0x73E3,
-0x73D2, 0x7407, 0x73F5, 0x7426, 0x742A, 0x7429, 0x742E, 0x7462,
-0x7489, 0x749F, 0x7501, 0x756F, 0x7682, 0x769C, 0x769E, 0x769B,
-0x76A6, 0xFA17, 0x7746, 0x52AF, 0x7821, 0x784E, 0x7864, 0x787A,
-0x7930, 0xFA18, 0xFA19, 0xFA1A, 0x7994, 0xFA1B, 0x799B, 0x7AD1,
-0x7AE7, 0xFA1C, 0x7AEB, 0x7B9E, 0xFA1D, 0x7D48, 0x7D5C, 0x7DB7,
-0x7DA0, 0x7DD6, 0x7E52, 0x7F47, 0x7FA1, 0xFA1E, 0x8301, 0x8362,
-0x837F, 0x83C7, 0x83F6, 0x8448, 0x84B4, 0x8553, 0x8559, 0x856B,
-0xFA1F, 0x85B0, 0xFA20, 0xFA21, 0x8807, 0x88F5, 0x8A12, 0x8A37,
-0x8A79, 0x8AA7, 0x8ABE, 0x8ADF, 0xFA22, 0x8AF6, 0x8B53, 0x8B7F,
-0x8CF0, 0x8CF4, 0x8D12, 0x8D76, 0xFA23, 0x8ECF, 0xFA24, 0xFA25,
-0x9067, 0x90DE, 0xFA26, 0x9115, 0x9127, 0x91DA},
-{ /* category 92 */
-0x91D7, 0x91DE, 0x91ED, 0x91EE, 0x91E4, 0x91E5, 0x9206, 0x9210,
-0x920A, 0x923A, 0x9240, 0x923C, 0x924E, 0x9259, 0x9251, 0x9239,
-0x9267, 0x92A7, 0x9277, 0x9278, 0x92E7, 0x92D7, 0x92D9, 0x92D0,
-0xFA27, 0x92D5, 0x92E0, 0x92D3, 0x9325, 0x9321, 0x92FB, 0xFA28,
-0x931E, 0x92FF, 0x931D, 0x9302, 0x9370, 0x9357, 0x93A4, 0x93C6,
-0x93DE, 0x93F8, 0x9431, 0x9445, 0x9448, 0x9592, 0xF9DC, 0xFA29,
-0x969D, 0x96AF, 0x9733, 0x973B, 0x9743, 0x974D, 0x974F, 0x9751,
-0x9755, 0x9857, 0x9865, 0xFA2A, 0xFA2B, 0x9927, 0xFA2C, 0x999E,
-0x9A4E, 0x9AD9, 0x9ADC, 0x9B75, 0x9B72, 0x9B8F, 0x9BB1, 0x9BBB,
-0x9C00, 0x9D70, 0x9D6B, 0xFA2D, 0x9E19, 0x9ED1, 0x0000, 0x0000,
-0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177,
-0x2178, 0x2179, 0xFFE2, 0xFFE4, 0xFF07, 0xFF02}};
-
-#endif /* JISX0208_H */
diff --git a/ext/gd/libgd/mathmake.c b/ext/gd/libgd/mathmake.c
deleted file mode 100644
index 3950c4b09c..0000000000
--- a/ext/gd/libgd/mathmake.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <stdio.h>
-#include <math.h>
-
-#define scale 1024
-
-int basis[91];
-int cost[360];
-
-main (void)
-{
- int i;
- printf ("#define costScale %d\n", scale);
- printf ("int cost[] = {\n ");
- for (i = 0; (i <= 90); i++)
- {
- basis[i] = cos ((double) i * .0174532925) * scale;
- }
- for (i = 0; (i < 90); i++)
- {
- printf ("%d,\n ", cost[i] = basis[i]);
- }
- for (i = 90; (i < 180); i++)
- {
- printf ("%d,\n ", cost[i] = -basis[180 - i]);
- }
- for (i = 180; (i < 270); i++)
- {
- printf ("%d,\n ", cost[i] = -basis[i - 180]);
- }
- for (i = 270; (i < 359); i++)
- {
- printf ("%d,\n ", cost[i] = basis[360 - i]);
- }
- printf ("%d\n", cost[359] = basis[1]);
- printf ("};\n");
- printf ("#define sintScale %d\n", scale);
- printf ("int sint[] = {\n ");
- for (i = 0; (i < 360); i++)
- {
- int val;
- val = cost[(i + 270) % 360];
- if (i != 359)
- {
- printf ("%d,\n ", val);
- }
- else
- {
- printf ("%d\n", val);
- }
- }
- printf ("};\n");
-}
diff --git a/ext/gd/libgd/pngtogd.c b/ext/gd/libgd/pngtogd.c
deleted file mode 100644
index b663b170b7..0000000000
--- a/ext/gd/libgd/pngtogd.c
+++ /dev/null
@@ -1,45 +0,0 @@
-
-#include <stdio.h>
-#include "gd.h"
-
-/* A short program which converts a .png file into a .gd file, for
- your convenience in creating images on the fly from a
- basis image that must be loaded quickly. The .gd format
- is not intended to be a general-purpose format. */
-
-int
-main (int argc, char **argv)
-{
- gdImagePtr im;
- FILE *in, *out;
- if (argc != 3)
- {
- fprintf (stderr, "Usage: pngtogd filename.png filename.gd\n");
- exit (1);
- }
- in = fopen (argv[1], "rb");
- if (!in)
- {
- fprintf (stderr, "Input file does not exist!\n");
- exit (1);
- }
- im = gdImageCreateFromPng (in);
- fclose (in);
- if (!im)
- {
- fprintf (stderr, "Input is not in PNG format!\n");
- exit (1);
- }
- out = fopen (argv[2], "wb");
- if (!out)
- {
- fprintf (stderr, "Output file cannot be written to!\n");
- gdImageDestroy (im);
- exit (1);
- }
- gdImageGd (im, out);
- fclose (out);
- gdImageDestroy (im);
-
- return 0;
-}
diff --git a/ext/gd/libgd/pngtogd2.c b/ext/gd/libgd/pngtogd2.c
deleted file mode 100644
index c8b1d843af..0000000000
--- a/ext/gd/libgd/pngtogd2.c
+++ /dev/null
@@ -1,52 +0,0 @@
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "gd.h"
-
-/* A short program which converts a .png file into a .gd file, for
- your convenience in creating images on the fly from a
- basis image that must be loaded quickly. The .gd format
- is not intended to be a general-purpose format. */
-
-int
-main (int argc, char **argv)
-{
- gdImagePtr im;
- FILE *in, *out;
- int cs, fmt;
-
- if (argc != 5)
- {
- fprintf (stderr, "Usage: pngtogd2 filename.png filename.gd2 cs fmt\n");
- fprintf (stderr, " where cs is the chunk size\n");
- fprintf (stderr, " fmt is 1 for raw, 2 for compressed\n");
- exit (1);
- }
- in = fopen (argv[1], "rb");
- if (!in)
- {
- fprintf (stderr, "Input file does not exist!\n");
- exit (1);
- }
- im = gdImageCreateFromPng (in);
- fclose (in);
- if (!im)
- {
- fprintf (stderr, "Input is not in PNG format!\n");
- exit (1);
- }
- out = fopen (argv[2], "wb");
- if (!out)
- {
- fprintf (stderr, "Output file cannot be written to!\n");
- gdImageDestroy (im);
- exit (1);
- }
- cs = atoi (argv[3]);
- fmt = atoi (argv[4]);
- gdImageGd2 (im, out, cs, fmt);
- fclose (out);
- gdImageDestroy (im);
-
- return 0;
-}
diff --git a/ext/gd/libgd/testac.c b/ext/gd/libgd/testac.c
deleted file mode 100644
index 55a5434d21..0000000000
--- a/ext/gd/libgd/testac.c
+++ /dev/null
@@ -1,129 +0,0 @@
-
-#include <stdio.h>
-#include "gd.h"
-
-/* If palette is true, we convert from truecolor to palette at the end,
- to test gdImageTrueColorToPalette and see file size/
- quality tradeoffs. */
-
-void testDrawing (
- gdImagePtr im_in,
- double scale,
- int blending,
- int palette,
- char *filename);
-
-int
-main (int argc, char *argv[])
-{
- /* Input and output files */
- FILE *in;
- FILE *out;
-
- /* Input image */
- gdImagePtr im_in = 0;
-
- /* Colors */
- int lightBlue;
-
- if (argc != 2)
- {
- fprintf (stderr, "Usage: testac filename.png\n");
- exit (1);
- }
- /* Load original PNG, which should contain alpha channel
- information. We will use it in two ways: preserving it
- literally, for use with compatible browsers, and
- compositing it ourselves against a background of our
- choosing (alpha blending). We'll change its size
- and try creating palette versions of it. */
- in = fopen (argv[1], "rb");
- if (!in)
- {
- fprintf (stderr, "Can't load %s.\n", argv[1]);
- exit (1);
- }
- else
- {
- im_in = gdImageCreateFromPng (in);
- fclose (in);
- }
- testDrawing (im_in, 1.0, 0, 0, "noblending-fullsize-truecolor.png");
- testDrawing (im_in, 1.0, 1, 0, "blending-fullsize-truecolor.png");
- testDrawing (im_in, 0.5, 0, 0, "noblending-halfsize-truecolor.png");
- testDrawing (im_in, 0.5, 1, 0, "blending-halfsize-truecolor.png");
- testDrawing (im_in, 2.0, 0, 0, "noblending-doublesize-truecolor.png");
- testDrawing (im_in, 2.0, 1, 0, "blending-doublesize-truecolor.png");
- testDrawing (im_in, 1.0, 0, 1, "noblending-fullsize-palette.png");
- testDrawing (im_in, 1.0, 1, 1, "blending-fullsize-palette.png");
- testDrawing (im_in, 0.5, 0, 1, "noblending-halfsize-palette.png");
- testDrawing (im_in, 0.5, 1, 1, "blending-halfsize-palette.png");
- testDrawing (im_in, 2.0, 0, 1, "noblending-doublesize-palette.png");
- testDrawing (im_in, 2.0, 1, 1, "blending-doublesize-palette.png");
- gdImageDestroy (im_in);
- return 0;
-}
-
-/* If palette is true, we convert from truecolor to palette at the end,
- to test gdImageTrueColorToPalette and see file size/
- quality tradeoffs. */
-void
-testDrawing (
- gdImagePtr im_in,
- double scale,
- int blending,
- int palette,
- char *filename)
-{
- gdImagePtr im_out;
- FILE *out;
- /* Create output image. */
- im_out = gdImageCreateTrueColor ((int) (gdImageSX (im_in) * scale),
- (int) (gdImageSY (im_in) * scale));
- /*
- Request alpha blending. This causes future
- drawing operations to perform alpha channel blending
- with the background, resulting in an opaque image.
- Without this call, pixels in the foreground color are
- copied literally, *including* the alpha channel value,
- resulting in an output image which is potentially
- not opaque. This flag can be set and cleared as often
- as desired. */
- gdImageAlphaBlending (im_out, blending);
-
- /* Flood with light blue. */
- gdImageFill (im_out, (int) (gdImageSX (im_in) * scale / 2),
- (int) (gdImageSY (im_in) * scale / 2),
- gdTrueColor (192, 192, 255));
- /* Copy the source image. Alpha blending should result in
- compositing against red. With blending turned off, the
- browser or viewer will composite against its preferred
- background, or, if it does not support an alpha channel,
- we will see the original colors for the pixels that
- ought to be transparent or semitransparent. */
- gdImageCopyResampled (im_out, im_in,
- 0, 0,
- 0, 0,
- (int) (gdImageSX (im_in) * scale), (int) (gdImageSY (im_in) * scale),
- gdImageSX (im_in), gdImageSY (im_in));
- /* Write PNG */
- out = fopen (filename, "wb");
-
- /* If this image is the result of alpha channel blending,
- it will not contain an interesting alpha channel itself.
- Save a little file size by not saving the alpha channel.
- Otherwise the file would typically be slightly larger. */
- gdImageSaveAlpha (im_out, !blending);
-
- /* If requested, convert from truecolor to palette. */
- if (palette)
- {
- /* Dithering, 256 colors. */
- gdImageTrueColorToPalette (im_out, 1, 256);
- }
-
- gdImagePng (im_out, out);
- fclose (out);
-
- gdImageDestroy (im_out);
-}
diff --git a/ext/gd/libgd/wbmp.c b/ext/gd/libgd/wbmp.c
deleted file mode 100644
index 039d80f00c..0000000000
--- a/ext/gd/libgd/wbmp.c
+++ /dev/null
@@ -1,369 +0,0 @@
-
-/* WBMP
- ** ----
- ** WBMP Level 0: B/W, Uncompressed
- ** This implements the WBMP format as specified in WAPSpec 1.1 and 1.2.
- ** It does not support ExtHeaders as defined in the spec. The spec states
- ** that a WAP client does not need to implement ExtHeaders.
- **
- ** (c) 2000 Johan Van den Brande <johan@vandenbrande.com>
- */
-
-
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "wbmp.h"
-#include "gd.h"
-#include "gdhelpers.h"
-
-#ifdef NOTDEF
-#define __TEST /* Compile with main function */
-#define __DEBUG /* Extra verbose when with __TEST */
-#define __WRITE /* readwbmp and writewbmp(stdout) */
-#define __VIEW /* view the wbmp on stdout */
-#endif
-
-/* getmbi
- ** ------
- ** Get a multibyte integer from a generic getin function
- ** 'getin' can be getc, with in = NULL
- ** you can find getin as a function just above the main function
- ** This way you gain a lot of flexibilty about how this package
- ** reads a wbmp file.
- */
-int
-getmbi (int (*getin) (void *in), void *in)
-{
- int i, mbi = 0;
-
- do
- {
- i = getin (in);
- if (i < 0)
- return (-1);
- mbi = (mbi << 7) | (i & 0x7f);
- }
- while (i & 0x80);
-
- return (mbi);
-}
-
-
-/* putmbi
- ** ------
- ** Put a multibyte intgerer in some kind of output stream
- ** I work here with a function pointer, to make it as generic
- ** as possible. Look at this function as an iterator on the
- ** mbi integers it spits out.
- **
- */
-void
-putmbi (int i, void (*putout) (int c, void *out), void *out)
-{
- int cnt, l, accu;
-
- /* Get number of septets */
- cnt = 0;
- accu = 0;
- while (accu != i)
- accu += i & 0x7f << 7 * cnt++;
-
- /* Produce the multibyte output */
- for (l = cnt - 1; l > 0; l--)
- putout (0x80 | (i & 0x7f << 7 * l) >> 7 * l, out);
-
- putout (i & 0x7f, out);
-
-}
-
-
-
-/* skipheader
- ** ----------
- ** Skips the ExtHeader. Not needed for the moment
- **
- */
-int
-skipheader (int (*getin) (void *in), void *in)
-{
- int i;
-
- do
- {
- i = getin (in);
- if (i < 0)
- return (-1);
- }
- while (i & 0x80);
-
- return (0);
-}
-
-/* create wbmp
- ** -----------
- ** create an empty wbmp
- **
- */
-Wbmp *
-createwbmp (int width, int height, int color)
-{
- int i;
-
- Wbmp *wbmp;
- if ((wbmp = (Wbmp *) gdMalloc (sizeof (Wbmp))) == NULL)
- return (NULL);
-
- if ((wbmp->bitmap = (int *) gdMalloc (sizeof (int) * width * height)) == NULL)
- {
- gdFree (wbmp);
- return (NULL);
- }
-
- wbmp->width = width;
- wbmp->height = height;
-
- for (i = 0; i < width * height; wbmp->bitmap[i++] = color);
-
- return (wbmp);
-}
-
-
-
-/* readwbmp
- ** -------
- ** Actually reads the WBMP format from an open file descriptor
- ** It goes along by returning a pointer to a WBMP struct.
- **
- */
-int
-readwbmp (int (*getin) (void *in), void *in, Wbmp ** return_wbmp)
-{
- int row, col, byte, pel, pos;
- Wbmp *wbmp;
-
- if ((wbmp = (Wbmp *) gdMalloc (sizeof (Wbmp))) == NULL)
- return (-1);
-
- wbmp->type = getin (in);
- if (wbmp->type != 0)
- {
- gdFree (wbmp);
- return (-1);
- }
-
- if (skipheader (getin, in))
- return (-1);
-
-
- wbmp->width = getmbi (getin, in);
- if (wbmp->width == -1)
- {
- gdFree (wbmp);
- return (-1);
- }
-
- wbmp->height = getmbi (getin, in);
- if (wbmp->height == -1)
- {
- gdFree (wbmp);
- return (-1);
- }
-
-#ifdef __DEBUG
- printf ("W: %d, H: %d\n", wbmp->width, wbmp->height);
-#endif
-
- if ((wbmp->bitmap = (int *) gdMalloc (sizeof (int) * wbmp->width * wbmp->height)) == NULL)
- {
- gdFree (wbmp);
- return (-1);
- }
-
-#ifdef __DEBUG
- printf ("DATA CONSTRUCTED\n");
-#endif
-
- pos = 0;
- for (row = 0; row < wbmp->height; row++)
- {
- for (col = 0; col < wbmp->width;)
- {
- byte = getin (in);
-
- for (pel = 7; pel >= 0; pel--)
- {
- if (col++ < wbmp->width)
- {
- if (byte & 1 << pel)
- {
- wbmp->bitmap[pos] = WBMP_WHITE;
- }
- else
- {
- wbmp->bitmap[pos] = WBMP_BLACK;
- }
- pos++;
- }
- }
- }
- }
-
- *return_wbmp = wbmp;
-
- return (0);
-}
-
-
-/* writewbmp
- ** ---------
- ** Write a wbmp to a file descriptor
- **
- ** Why not just giving a filedescriptor to this function?
- ** Well, the incentive to write this function was the complete
- ** integration in gd library from www.boutell.com. They use
- ** their own io functions, so the passing of a function seemed to be
- ** a logic(?) decision ...
- **
- */
-int
-writewbmp (Wbmp * wbmp, void (*putout) (int c, void *out), void *out)
-{
- int row, col;
- int bitpos, octet;
-
- /* Generate the header */
- putout (0, out); /* WBMP Type 0: B/W, Uncompressed bitmap */
- putout (0, out); /* FixHeaderField */
-
-
-
- /* Size of the image */
- putmbi (wbmp->width, putout, out); /* width */
- putmbi (wbmp->height, putout, out); /* height */
-
-
- /* Image data */
- for (row = 0; row < wbmp->height; row++)
- {
- bitpos = 8;
- octet = 0;
- for (col = 0; col < wbmp->width; col++)
- {
- octet |= ((wbmp->bitmap[row * wbmp->width + col] == 1) ? WBMP_WHITE : WBMP_BLACK) << --bitpos;
- if (bitpos == 0)
- {
- bitpos = 8;
- putout (octet, out);
- octet = 0;
- }
- }
- if (bitpos != 8)
- putout (octet, out);
-
- }
- return (0);
-
-}
-
-
-/* freewbmp
- ** --------
- ** gdFrees up memory occupied by a WBMP structure
- **
- */
-void
-freewbmp (Wbmp * wbmp)
-{
- gdFree (wbmp->bitmap);
- gdFree (wbmp);
-}
-
-
-/* printwbmp
- ** ---------
- ** print a WBMP to stdout for visualisation
- **
- */
-void
-printwbmp (Wbmp * wbmp)
-{
- int row, col;
- for (row = 0; row < wbmp->height; row++)
- {
- for (col = 0; col < wbmp->width; col++)
- {
- if (wbmp->bitmap[wbmp->width * row + col] == WBMP_BLACK)
- {
- putchar ('#');
- }
- else
- {
- putchar (' ');
- }
- }
- putchar ('\n');
- }
-}
-
-#ifdef __TEST
-
-/* putout to file descriptor
- ** -------------------------
- */
-int
-putout (int c, void *out)
-{
- return (putc (c, (FILE *) out));
-}
-
-/* getin from file descriptor
- ** --------------------------
- */
-int
-getin (void *in)
-{
- return (getc ((FILE *) in));
-}
-
-
-/* Main function
- ** -------------
- **
- */
-int
-main (int argc, char *argv[])
-{
- FILE *wbmp_file;
- Wbmp *wbmp;
-
- wbmp_file = fopen (argv[1], "rb");
- if (wbmp_file)
- {
- readwbmp (&getin, wbmp_file, &wbmp);
-
-#ifdef __VIEW
-
-#ifdef __DEBUG
- printf ("\nVIEWING IMAGE\n");
-#endif
-
- printwbmp (wbmp);
-#endif
-
-#ifdef __WRITE
-
-#ifdef __DEBUG
- printf ("\nDUMPING WBMP to STDOUT\n");
-#endif
-
- writewbmp (wbmp, &putout, stdout);
-#endif
-
- freewbmp (wbmp);
- fclose (wbmp_file);
- }
-}
-#endif
diff --git a/ext/gd/libgd/wbmp.h b/ext/gd/libgd/wbmp.h
deleted file mode 100644
index 2f61b0a095..0000000000
--- a/ext/gd/libgd/wbmp.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* WBMP
-** ----
-** WBMP Level 0: B/W, Uncompressed
-** This implements the WBMP format as specified in WAPSpec 1.1 and 1.2.
-** It does not support ExtHeaders as defined in the spec. The spec states
-** that a WAP client does not need to implement ExtHeaders.
-**
-** (c) 2000 Johan Van den Brande <johan@vandenbrande.com>
-**
-** Header file
-*/
-#ifndef __WBMP_H
-#define __WBMP_H 1
-
-
-/* WBMP struct
-** -----------
-** A Wireless bitmap structure
-**
-*/
-
-typedef struct Wbmp_
-{
- int type; /* type of the wbmp */
- int width; /* width of the image */
- int height; /* height of the image */
- int *bitmap; /* pointer to data: 0 = WHITE , 1 = BLACK */
-} Wbmp;
-
-#define WBMP_WHITE 1
-#define WBMP_BLACK 0
-
-
-/* Proto's
-** -------
-**
-*/
-void putmbi( int i, void (*putout)(int c, void *out), void *out);
-int getmbi ( int (*getin)(void *in), void *in );
-int skipheader( int (*getin)(void *in), void *in );
-Wbmp *createwbmp( int width, int height, int color );
-int readwbmp( int (*getin)(void *in), void *in, Wbmp **wbmp );
-int writewbmp( Wbmp *wbmp, void (*putout)( int c, void *out), void *out);
-void freewbmp( Wbmp *wbmp );
-void printwbmp( Wbmp *wbmp );
-
-#endif
diff --git a/ext/gd/libgd/webpng.c b/ext/gd/libgd/webpng.c
deleted file mode 100644
index f3c35e306f..0000000000
--- a/ext/gd/libgd/webpng.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/* Bring in the gd library functions */
-#include "gd.h"
-
-/* Bring in standard I/O and string manipulation functions */
-#include <stdio.h>
-#include <stdlib.h> /* for atoi() */
-#include <string.h>
-
-#ifdef _WIN32
-#include <process.h>
-int
-getpid ()
-{
- return _getpid ();
-}
-#else
-#include <unistd.h> /* for getpid(), unlink() */
-#endif
-int
-main (int argc, char **argv)
-{
- FILE *in;
- FILE *out;
- char outFn[20];
- int useStdinStdout = 0;
-
- /* Declare our image pointer */
- gdImagePtr im = 0;
- int i;
- /* We'll clear 'no' once we know the user has made a
- reasonable request. */
- int no = 1;
- /* We'll set 'write' once we know the user's request
- requires that the image be written back to disk. */
- int write = 0;
- /* C programs always get at least one argument; we want at
- least one more (the image), more in practice. */
- if (argc < 2 || !strcmp (argv[1], "--help"))
- {
- no = 1;
- goto usage;
- }
-
- /* The last argument should be the image. Open the file. */
- if (strcmp ("-", argv[argc - 1]) == 0)
- { /* - is synonymous with STDIN */
- useStdinStdout = 1;
- in = stdin;
- }
- else
- {
- in = fopen (argv[argc - 1], "rb");
- }
- if (!in)
- {
- fprintf (stderr,
- "Error: can't open file %s.\n", argv[argc - 1]);
- exit (1);
- }
- /* Now load the image. */
- im = gdImageCreateFromPng (in);
- fclose (in);
- /* If the load failed, it must not be a PNG file. */
- if (!im)
- {
- fprintf (stderr,
- "Error: %s is not a valid PNG file.\n", argv[argc - 1]);
- exit (1);
- }
- /* Consider each argument in turn. */
- for (i = 1; (i < (argc - 1)); i++)
- {
- /* -i turns on and off interlacing. */
- if (!strcmp (argv[i], "--help"))
- {
- /* Every program should use this for help! :) */
- no = 1;
- goto usage;
- }
- else if (!strcmp (argv[i], "-i"))
- {
- if (i == (argc - 2))
- {
- fprintf (stderr,
- "Error: -i specified without y or n.\n");
- no = 1;
- goto usage;
- }
- if (!strcmp (argv[i + 1], "y"))
- {
- /* Set interlace. */
- gdImageInterlace (im, 1);
- }
- else if (!strcmp (argv[i + 1], "n"))
- {
- /* Clear interlace. */
- gdImageInterlace (im, 0);
- }
- else
- {
- fprintf (stderr,
- "Error: -i specified without y or n.\n");
- no = 1;
- goto usage;
- }
- i++;
- no = 0;
- write = 1;
- }
- else if (!strcmp (argv[i], "-t"))
- {
- /* Set transparent index (or none). */
- int index;
- if (i == (argc - 2))
- {
- fprintf (stderr,
- "Error: -t specified without a color table index.\n");
- no = 1;
- goto usage;
- }
- if (!strcmp (argv[i + 1], "none"))
- {
- /* -1 means not transparent. */
- gdImageColorTransparent (im, -1);
- }
- else
- {
- /* OK, get an integer and set the index. */
- index = atoi (argv[i + 1]);
- gdImageColorTransparent (im, index);
- }
- i++;
- write = 1;
- no = 0;
- }
- else if (!strcmp (argv[i], "-l"))
- {
- /* List the colors in the color table. */
- int j;
- if (!im->trueColor)
- {
- /* Tabs used below. */
- printf ("Index Red Green Blue Alpha\n");
- for (j = 0; (j < gdImageColorsTotal (im)); j++)
- {
- /* Use access macros to learn colors. */
- printf ("%d %d %d %d %d\n",
- j,
- gdImageRed (im, j),
- gdImageGreen (im, j),
- gdImageBlue (im, j),
- gdImageAlpha (im, j));
- }
- }
- else
- {
- printf ("Truecolor image, no palette entries to list.\n");
- }
- no = 0;
- }
- else if (!strcmp (argv[i], "-d"))
- {
- /* Output dimensions, etc. */
- int t;
- printf ("Width: %d Height: %d Colors: %d\n",
- gdImageSX (im), gdImageSY (im),
- gdImageColorsTotal (im));
- t = gdImageGetTransparent (im);
- if (t != (-1))
- {
- printf ("First 100%% transparent index: %d\n", t);
- }
- else
- {
- /* -1 means the image is not transparent. */
- printf ("First 100%% transparent index: none\n");
- }
- if (gdImageGetInterlaced (im))
- {
- printf ("Interlaced: yes\n");
- }
- else
- {
- printf ("Interlaced: no\n");
- }
- no = 0;
- }
- else if (!strcmp(argv[i], "-a"))
- {
- int maxx, maxy, x, y, alpha, pix, nalpha = 0;
-
- maxx = gdImageSX(im);
- maxy = gdImageSY(im);
-
- printf("alpha channel information:\n");
-
- if (im->trueColor) {
- for (y = 0; y < maxy; y++) {
- for (x = 0; x < maxx; x++) {
- pix = gdImageGetPixel(im, x, y);
- alpha = gdTrueColorGetAlpha(pix);
-
- if (alpha > gdAlphaOpaque) {
- /* Use access macros to learn colors. */
- printf ("%d %d %d %d\n",
- gdTrueColorGetRed(pix),
- gdTrueColorGetGreen(pix),
- gdTrueColorGetBlue(pix),
- alpha);
- nalpha++;
- }
-
- }
- }
- }
- else
- printf("NOT a true color image\n");
- no = 0;
- printf("%d alpha channels\n", nalpha);
-
- }
- else
- {
- fprintf (stderr, "Unknown argument: %s\n", argv[i]);
- break;
- }
- }
-usage:
- if (no)
- {
- /* If the command failed, output an explanation. */
- fprintf (stderr,
- "Usage: webpng [-i y|n ] [-l] [-t index|none ] [-d] pngname.png\n"
-
- " -i [y|n] Turns on/off interlace\n"
- " -l Prints the table of color indexes\n"
- " -t [index] Set the transparent color to the specified index (0-255 or \"none\")\n"
- " -d Reports the dimensions and other characteristics of the image.\n"
- " -a Prints all alpha channels that are not 100%% opaque.\n"
- "\n"
- "If you specify '-' as the input file, stdin/stdout will be used input/output.\n"
- );
- }
- if (write)
- {
- if (useStdinStdout)
- {
- out = stdout;
- }
- else
- {
- /* Open a temporary file. */
-
- /* "temp.tmp" is not good temporary filename. */
- sprintf (outFn, "webpng.tmp%d", getpid ());
- out = fopen (outFn, "wb");
-
- if (!out)
- {
- fprintf (stderr,
- "Unable to write to %s -- exiting\n", outFn);
- exit (1);
- }
- }
-
- /* Write the new PNG. */
- gdImagePng (im, out);
-
- if (!useStdinStdout)
- {
- fclose (out);
- /* Erase the old PNG. */
- unlink (argv[argc - 1]);
- /* Rename the new to the old. */
- if (rename (outFn, argv[argc - 1]) != 0)
- {
- perror ("rename");
- exit (1);
- }
- }
- }
- /* Delete the image from memory. */
- if (im)
- {
- gdImageDestroy (im);
- }
- /* All's well that ends well. */
- return 0;
-}
diff --git a/ext/gd/libgd/xbm.c b/ext/gd/libgd/xbm.c
deleted file mode 100644
index c730c3666d..0000000000
--- a/ext/gd/libgd/xbm.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include "gd.h"
-#include "gdhelpers.h"
-
-#include "php.h"
-
-#define MAX_XBM_LINE_SIZE 255
-
-gdImagePtr
-gdImageCreateFromXbm (FILE * fd)
-{
- char fline[MAX_XBM_LINE_SIZE];
- char iname[MAX_XBM_LINE_SIZE];
- char *type;
- int value;
- unsigned int width = 0, height = 0;
- int fail = 0;
- int max_bit = 0;
-
- gdImagePtr im;
- int bytes = 0, i;
- int bit, x = 0, y = 0;
- int ch;
- char h[8];
- unsigned int b;
-
- rewind(fd);
- while (fgets(fline, MAX_XBM_LINE_SIZE, fd)) {
- fline[MAX_XBM_LINE_SIZE-1] = '\0';
- if (strlen(fline) == MAX_XBM_LINE_SIZE-1) {
- return 0;
- }
- if (sscanf(fline, "#define %s %d", iname, &value) == 2) {
- if (!(type = strrchr(iname, '_'))) {
- type = iname;
- } else {
- type++;
- }
-
- if (!strcmp("width", type)) {
- width = (unsigned int) value;
- }
- if (!strcmp("height", type)) {
- height = (unsigned int) value;
- }
- } else {
- if ( sscanf(fline, "static unsigned char %s = {", iname) == 1
- || sscanf(fline, "static char %s = {", iname) == 1)
- {
- max_bit = 128;
- } else if (sscanf(fline, "static unsigned short %s = {", iname) == 1
- || sscanf(fline, "static short %s = {", iname) == 1)
- {
- max_bit = 32768;
- }
- if (max_bit) {
- bytes = (width * height / 8) + 1;
- if (!bytes) {
- return 0;
- }
- if (!(type = strrchr(iname, '_'))) {
- type = iname;
- } else {
- type++;
- }
- if (!strcmp("bits[]", type)) {
- break;
- }
- }
- }
- }
- if (!bytes || !max_bit) {
- return 0;
- }
-
- im = gdImageCreate(width, height);
- gdImageColorAllocate(im, 255, 255, 255);
- gdImageColorAllocate(im, 0, 0, 0);
- h[2] = '\0';
- h[4] = '\0';
- for (i = 0; i < bytes; i++) {
- while (1) {
- if ((ch=getc(fd)) == EOF) {
- fail = 1;
- break;
- }
- if (ch == 'x') {
- break;
- }
- }
- if (fail) {
- break;
- }
- /* Get hex value */
- if ((ch=getc(fd)) == EOF) {
- break;
- }
- h[0] = ch;
- if ((ch=getc(fd)) == EOF) {
- break;
- }
- h[1] = ch;
- if (max_bit == 32768) {
- if ((ch=getc(fd)) == EOF) {
- break;
- }
- h[2] = ch;
- if ((ch=getc(fd)) == EOF) {
- break;
- }
- h[3] = ch;
- }
- sscanf(h, "%x", &b);
- for (bit = 1; bit <= max_bit; bit = bit << 1) {
- gdImageSetPixel(im, x++, y, (b & bit) ? 1 : 0);
- if (x == im->sx) {
- x = 0;
- y++;
- if (y == im->sy) {
- return im;
- }
- break;
- }
- }
- }
-
- php_gd_error("EOF before image was complete\n");
- gdImageDestroy(im);
- return 0;
-}
diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h
deleted file mode 100644
index d89c18c553..0000000000
--- a/ext/gd/php_gd.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Stig Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_GD_H
-#define PHP_GD_H
-
-#define HAVE_GDIMAGECREATEFROMPNG 1
-
-#if HAVE_LIBTTF|HAVE_LIBFREETYPE
-#define ENABLE_GD_TTF
-#endif
-
-#if HAVE_LIBGD
-
-#define PHP_GDIMG_TYPE_GIF 1
-#define PHP_GDIMG_TYPE_PNG 2
-#define PHP_GDIMG_TYPE_JPG 3
-#define PHP_GDIMG_TYPE_WBM 4
-#define PHP_GDIMG_TYPE_XBM 5
-#define PHP_GDIMG_TYPE_XPM 6
-#define PHP_GDIMG_CONVERT_WBM 7
-#define PHP_GDIMG_TYPE_GD 8
-#define PHP_GDIMG_TYPE_GD2 9
-#define PHP_GDIMG_TYPE_GD2PART 10
-
-#ifdef PHP_WIN32
-#define PHP_GD_API __declspec(dllexport)
-#else
-#define PHP_GD_API
-#endif
-
-PHPAPI extern const char php_sig_gif[3];
-PHPAPI extern const char php_sig_jpg[3];
-PHPAPI extern const char php_sig_png[3];
-
-extern zend_module_entry gd_module_entry;
-#define phpext_gd_ptr &gd_module_entry
-
-/* gd.c functions */
-PHP_MINFO_FUNCTION(gd);
-PHP_MINIT_FUNCTION(gd);
-PHP_MSHUTDOWN_FUNCTION(gd);
-#if HAVE_LIBGD20 && HAVE_GD_STRINGFT
-PHP_RSHUTDOWN_FUNCTION(gd);
-#endif
-
-PHP_FUNCTION(gd_info);
-PHP_FUNCTION(imagearc);
-PHP_FUNCTION(imageellipse);
-PHP_FUNCTION(imagechar);
-PHP_FUNCTION(imagecharup);
-PHP_FUNCTION(imageistruecolor);
-PHP_FUNCTION(imagecolorallocate);
-PHP_FUNCTION(imagepalettecopy);
-PHP_FUNCTION(imagecolorat);
-PHP_FUNCTION(imagecolorclosest);
-PHP_FUNCTION(imagecolorclosesthwb);
-PHP_FUNCTION(imagecolordeallocate);
-PHP_FUNCTION(imagecolorresolve);
-PHP_FUNCTION(imagecolorexact);
-PHP_FUNCTION(imagecolorset);
-PHP_FUNCTION(imagecolorstotal);
-PHP_FUNCTION(imagecolorsforindex);
-PHP_FUNCTION(imagecolortransparent);
-PHP_FUNCTION(imagecopy);
-PHP_FUNCTION(imagecopymerge);
-PHP_FUNCTION(imagecopyresized);
-PHP_FUNCTION(imagetypes);
-PHP_FUNCTION(imagecreate);
-PHP_FUNCTION(imageftbbox);
-PHP_FUNCTION(imagefttext);
-
-#ifdef HAVE_LIBGD20
-PHP_FUNCTION(imagecreatetruecolor);
-PHP_FUNCTION(imagetruecolortopalette);
-PHP_FUNCTION(imagesetthickness);
-PHP_FUNCTION(imagefilledellipse);
-PHP_FUNCTION(imagefilledarc);
-PHP_FUNCTION(imagealphablending);
-PHP_FUNCTION(imagesavealpha);
-PHP_FUNCTION(imagecolorallocatealpha);
-PHP_FUNCTION(imagecolorresolvealpha);
-PHP_FUNCTION(imagecolorclosestalpha);
-PHP_FUNCTION(imagecolorexactalpha);
-PHP_FUNCTION(imagecopyresampled);
-#endif
-
-#ifdef HAVE_GD_BUNDLED
-PHP_FUNCTION(imagerotate);
-PHP_FUNCTION(imageantialias);
-#endif
-
-PHP_FUNCTION(imagesetthickness);
-PHP_FUNCTION(imagecopymergegray);
-PHP_FUNCTION(imagesetbrush);
-PHP_FUNCTION(imagesettile);
-PHP_FUNCTION(imagesetstyle);
-
-PHP_FUNCTION(imagecreatefromstring);
-PHP_FUNCTION(imagecreatefromgif);
-PHP_FUNCTION(imagecreatefromjpeg);
-PHP_FUNCTION(imagecreatefromxbm);
-PHP_FUNCTION(imagecreatefrompng);
-PHP_FUNCTION(imagecreatefromwbmp);
-PHP_FUNCTION(imagecreatefromgd);
-PHP_FUNCTION(imagecreatefromgd2);
-PHP_FUNCTION(imagecreatefromgd2part);
-#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
-PHP_FUNCTION(imagecreatefromxpm);
-#endif
-
-PHP_FUNCTION(imagegammacorrect);
-PHP_FUNCTION(imagedestroy);
-PHP_FUNCTION(imagefill);
-PHP_FUNCTION(imagefilledpolygon);
-PHP_FUNCTION(imagefilledrectangle);
-PHP_FUNCTION(imagefilltoborder);
-PHP_FUNCTION(imagefontwidth);
-PHP_FUNCTION(imagefontheight);
-
-PHP_FUNCTION(imagegif );
-PHP_FUNCTION(imagejpeg );
-PHP_FUNCTION(imagepng);
-PHP_FUNCTION(imagewbmp);
-PHP_FUNCTION(imagegd);
-PHP_FUNCTION(imagegd2);
-
-PHP_FUNCTION(imageinterlace);
-PHP_FUNCTION(imageline);
-PHP_FUNCTION(imageloadfont);
-PHP_FUNCTION(imagepolygon);
-PHP_FUNCTION(imagerectangle);
-PHP_FUNCTION(imagesetpixel);
-PHP_FUNCTION(imagestring);
-PHP_FUNCTION(imagestringup);
-PHP_FUNCTION(imagesx);
-PHP_FUNCTION(imagesy);
-PHP_FUNCTION(imagedashedline);
-PHP_FUNCTION(imagettfbbox);
-PHP_FUNCTION(imagettftext);
-PHP_FUNCTION(imagepsloadfont);
-/*
-PHP_FUNCTION(imagepscopyfont);
-*/
-PHP_FUNCTION(imagepsfreefont);
-PHP_FUNCTION(imagepsencodefont);
-PHP_FUNCTION(imagepsextendfont);
-PHP_FUNCTION(imagepsslantfont);
-PHP_FUNCTION(imagepstext);
-PHP_FUNCTION(imagepsbbox);
-
-PHP_FUNCTION(jpeg2wbmp);
-PHP_FUNCTION(png2wbmp);
-PHP_FUNCTION(image2wbmp);
-
-#if HAVE_GD_BUNDLED
-PHP_FUNCTION(imagelayereffect);
-PHP_FUNCTION(imagecolormatch);
-PHP_FUNCTION(imagefilter);
-#endif
-
-PHP_GD_API int phpi_get_le_gd(void);
-
-#else
-
-#define phpext_gd_ptr NULL
-
-#endif
-
-#endif /* PHP_GD_H */
diff --git a/ext/gd/tests/bug19366.phpt b/ext/gd/tests/bug19366.phpt
deleted file mode 100644
index 5e4d7285b3..0000000000
--- a/ext/gd/tests/bug19366.phpt
+++ /dev/null
@@ -1,50 +0,0 @@
---TEST--
-gdimagefill() function (Bug #19366 (fixed in bundled libgd))
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available\n");
- if (!GD_BUNDLED) die('skip external GD libraries always fail');
-?>
---FILE--
-<?php
-echo "Alive\n";
-$width = 50;
-$height = 100;
-$ImHandle = imagecreate($width,$height);
-echo "Alive\n";
-//Define colors
-$MyBlue = imagecolorAllocate($ImHandle, 0, 0, 255);
-$MyRed = imagecolorAllocate($ImHandle, 255, 0, 0);
-$MyWhite = imagecolorAllocate($ImHandle, 255, 255, 255);
-$MyBlack = imagecolorAllocate($ImHandle, 0, 0, 0);
-echo "Alive\n";
-//Draw
-ImageFill($ImHandle,0,0,$MyBlack);
-ImageLine($ImHandle,20,20,180,20,$MyWhite);
-ImageLine($ImHandle,20,20,20,70,$MyBlue);
-ImageLine($ImHandle,20,70,180,70,$MyRed);
-ImageLine($ImHandle,180,20,180,45,$MyWhite);
-ImageLine($ImHandle,180,70,180,45,$MyRed);
-ImageLine($ImHandle,20,20,100,45,$MyBlue);
-ImageLine($ImHandle,20,70,100,45,$MyBlue);
-ImageLine($ImHandle,100,45,180,45,$MyRed);
-ImageFill($ImHandle,21,45,$MyBlue);
-ImageFill($ImHandle,100,69,$MyRed);
-ImageFill($ImHandle,100,21,$MyWhite);
-ImageString($ImHandle,4,40,75,"Czech Republic",$MyWhite);
-echo "Alive\n";
-// Send to browser
-Header("Content-type: image/PNG");
-//ImagePNG($ImHandle);
-echo "Alive\n";
-//Free resources
-imagedestroy($ImHandle);
-echo "Alive\n";
-?>
---EXPECT--
-Alive
-Alive
-Alive
-Alive
-Alive
-Alive
diff --git a/ext/gd/tests/bug22544.phpt b/ext/gd/tests/bug22544.phpt
deleted file mode 100644
index 961432e661..0000000000
--- a/ext/gd/tests/bug22544.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-Bug #22544 (TrueColor transparency in PNG images).
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
- die("skip gd extension not available\n");
- }
- if (!GD_BUNDLED) {
- die('skip external GD libraries may fail');
- }
-?>
---FILE--
-<?php
- $dest = dirname(realpath(__FILE__)) . 'bug22544.png';
- @unlink($dest);
- $image = imageCreateTruecolor(640, 100);
- $transparent = imageColorAllocate($image, 0, 0, 0);
- $red = imageColorAllocate($image, 255, 50, 50);
- imageColorTransparent($image, $transparent);
- imageFilledRectangle($image, 0, 0, 640-1, 100-1, $transparent);
- imagePng($image, $dest);
- echo md5_file($dest) . "\n";
- @unlink($dest);
-?>
---EXPECT--
-10a57d09a2c63fad87b85b38d6b258d6
diff --git a/ext/gd/tests/conv_test.gif b/ext/gd/tests/conv_test.gif
deleted file mode 100644
index 40aa4331cc..0000000000
--- a/ext/gd/tests/conv_test.gif
+++ /dev/null
Binary files differ
diff --git a/ext/gd/tests/conv_test.jpeg b/ext/gd/tests/conv_test.jpeg
deleted file mode 100644
index 7283d1a475..0000000000
--- a/ext/gd/tests/conv_test.jpeg
+++ /dev/null
Binary files differ
diff --git a/ext/gd/tests/conv_test.png b/ext/gd/tests/conv_test.png
deleted file mode 100644
index f8c12dfd06..0000000000
--- a/ext/gd/tests/conv_test.png
+++ /dev/null
Binary files differ
diff --git a/ext/gd/tests/conv_test.xbm b/ext/gd/tests/conv_test.xbm
deleted file mode 100644
index 85cbe366ec..0000000000
--- a/ext/gd/tests/conv_test.xbm
+++ /dev/null
@@ -1,4 +0,0 @@
-#define conv_test.xbm_width 16
-#define conv_test.xbm_height 5
-static unsigned char conv_test.xbm_bits[] = {
- 0x4c, 0x0d, 0x54, 0x15, 0xcc, 0x0d, 0x44, 0x05, 0x44, 0x05}; \ No newline at end of file
diff --git a/ext/gd/tests/conv_test.xpm b/ext/gd/tests/conv_test.xpm
deleted file mode 100644
index b1126c1ba7..0000000000
--- a/ext/gd/tests/conv_test.xpm
+++ /dev/null
@@ -1,1588 +0,0 @@
-/* XPM */
-static char * conv_test_xpm[] = {
-"50 50 1535 2",
-" c None",
-". c #F81010",
-"+ c #F71112",
-"@ c #F51314",
-"# c #F31517",
-"$ c #F01619",
-"% c #EE181C",
-"& c #EC191E",
-"* c #E91B21",
-"= c #E71D24",
-"- c #E41E26",
-"; c #E22028",
-"> c #E0212B",
-", c #DE232D",
-"' c #DB2430",
-") c #D92632",
-"! c #D62835",
-"~ c #D42938",
-"{ c #D22B3A",
-"] c #CF2C3D",
-"^ c #CD2E3F",
-"/ c #CB2F41",
-"( c #C93144",
-"_ c #C63346",
-": c #C43449",
-"< c #C1364C",
-"[ c #BF374E",
-"} c #BD3951",
-"| c #BB3B53",
-"1 c #B83C55",
-"2 c #B63E58",
-"3 c #B43F5A",
-"4 c #B1415D",
-"5 c #AF4360",
-"6 c #AC4462",
-"7 c #AA4665",
-"8 c #A84767",
-"9 c #A6496A",
-"0 c #A34A6C",
-"a c #A14C6E",
-"b c #9F4D71",
-"c c #9C4F74",
-"d c #9A5176",
-"e c #975279",
-"f c #95547B",
-"g c #93557E",
-"h c #F71212",
-"i c #F51315",
-"j c #F21517",
-"k c #F0161A",
-"l c #EB191E",
-"m c #E22029",
-"n c #DD232E",
-"o c #D92633",
-"p c #D42A38",
-"q c #CF2D3D",
-"r c #CD2F3F",
-"s c #CB3142",
-"t c #C83244",
-"u c #C63347",
-"v c #C43549",
-"w c #BF384E",
-"x c #BA3B53",
-"y c #B83C56",
-"z c #B33F5B",
-"A c #A5496A",
-"B c #A14C6F",
-"C c #9E4E71",
-"D c #93567E",
-"E c #905780",
-"F c #F41315",
-"G c #EB191F",
-"H c #E61D24",
-"I c #DB2530",
-"J c #D92733",
-"K c #D62936",
-"L c #D22C3A",
-"M c #D02E3D",
-"N c #CD303F",
-"O c #C93344",
-"P c #C73447",
-"Q c #C53649",
-"R c #C2384C",
-"S c #C0394F",
-"T c #BD3A51",
-"U c #BB3C53",
-"V c #B83D56",
-"W c #B63F58",
-"X c #B3405B",
-"Y c #AE4360",
-"Z c #AC4463",
-"` c #A74767",
-" . c #A34B6C",
-".. c #995177",
-"+. c #975379",
-"@. c #95547C",
-"#. c #8E5983",
-"$. c #F71213",
-"%. c #ED181C",
-"&. c #EB1A1F",
-"*. c #E91B22",
-"=. c #E41E27",
-"-. c #DF222C",
-";. c #DB2630",
-">. c #D82833",
-",. c #D42B38",
-"'. c #D22D3B",
-"). c #D02F3D",
-"!. c #CE3040",
-"~. c #CB3242",
-"{. c #C93444",
-"]. c #C73547",
-"^. c #C53749",
-"/. c #C03A4F",
-"(. c #BE3B51",
-"_. c #BB3D54",
-":. c #B93E56",
-"<. c #B64059",
-"[. c #B4415B",
-"}. c #B2425D",
-"|. c #AF4460",
-"1. c #AC4563",
-"2. c #A74868",
-"3. c #A34B6D",
-"4. c #A04C6F",
-"5. c #9E4E72",
-"6. c #9C5074",
-"7. c #92567E",
-"8. c #905781",
-"9. c #8B5B86",
-"0. c #F61213",
-"a. c #F21518",
-"b. c #F0171A",
-"c. c #ED181D",
-"d. c #E81B22",
-"e. c #E41F27",
-"f. c #E12029",
-"g. c #DD242E",
-"h. c #DB2631",
-"i. c #D62A36",
-"j. c #D42C38",
-"k. c #D22E3B",
-"l. c #D0303D",
-"m. c #CD3140",
-"n. c #CB3342",
-"o. c #C93545",
-"p. c #C73647",
-"q. c #C5384A",
-"r. c #C3394C",
-"s. c #C03B4F",
-"t. c #BE3D51",
-"u. c #BC3E54",
-"v. c #BA3F56",
-"w. c #B74159",
-"x. c #B5425B",
-"y. c #B2435E",
-"z. c #B04560",
-"A. c #AD4663",
-"B. c #AA4765",
-"C. c #A84868",
-"D. c #9B5075",
-"E. c #94547C",
-"F. c #905881",
-"G. c #895C88",
-"H. c #F81111",
-"I. c #F41415",
-"J. c #EF171A",
-"K. c #E81C22",
-"L. c #E61D25",
-"M. c #DA2731",
-"N. c #D92933",
-"O. c #D42D39",
-"P. c #D0303E",
-"Q. c #CD3240",
-"R. c #C33A4D",
-"S. c #BE3D52",
-"T. c #B94056",
-"U. c #B04561",
-"V. c #AE4763",
-"W. c #AB4866",
-"X. c #A94A68",
-"Y. c #A64B6B",
-"Z. c #A34C6D",
-"`. c #A14D6F",
-" + c #97537A",
-".+ c #94557C",
-"++ c #92567F",
-"@+ c #8D5983",
-"#+ c #865E8B",
-"$+ c #F41416",
-"%+ c #F11518",
-"&+ c #EF171B",
-"*+ c #E31F27",
-"=+ c #E1202A",
-"-+ c #DF232C",
-";+ c #DC252F",
-">+ c #D62B36",
-",+ c #D22F3B",
-"'+ c #CF303E",
-")+ c #CB3343",
-"!+ c #C73648",
-"~+ c #C23A4D",
-"{+ c #BB3E54",
-"]+ c #B94057",
-"^+ c #B5425C",
-"/+ c #B2445E",
-"(+ c #AC4866",
-"_+ c #AA4A68",
-":+ c #A74C6B",
-"<+ c #A44D6D",
-"[+ c #A24E70",
-"}+ c #9F4F72",
-"|+ c #9C5075",
-"1+ c #995277",
-"2+ c #96537A",
-"3+ c #8D5984",
-"4+ c #895C89",
-"5+ c #84608E",
-"6+ c #ED191D",
-"7+ c #EA1A20",
-"8+ c #E1212A",
-"9+ c #D92934",
-"0+ c #C83545",
-"a+ c #B74259",
-"b+ c #B4425C",
-"c+ c #AE4764",
-"d+ c #AC4966",
-"e+ c #A54D6D",
-"f+ c #A34F70",
-"g+ c #A05072",
-"h+ c #9D5275",
-"i+ c #9A5378",
-"j+ c #97547A",
-"k+ c #8F5881",
-"l+ c #885D89",
-"m+ c #865E8C",
-"n+ c #816191",
-"o+ c #F11618",
-"p+ c #EC191D",
-"q+ c #E81C23",
-"r+ c #E51E25",
-"s+ c #E31F28",
-"t+ c #D92A34",
-"u+ c #D62C37",
-"v+ c #D12F3C",
-"w+ c #CD3241",
-"x+ c #CA3343",
-"y+ c #C73748",
-"z+ c #C03B50",
-"A+ c #BD3D52",
-"B+ c #BB3F55",
-"C+ c #B6425A",
-"D+ c #B4435C",
-"E+ c #AF4661",
-"F+ c #AD4764",
-"G+ c #A94A69",
-"H+ c #A54D6E",
-"I+ c #9E5275",
-"J+ c #9B5478",
-"K+ c #99557A",
-"L+ c #96567D",
-"M+ c #93577F",
-"N+ c #905882",
-"O+ c #8D5A84",
-"P+ c #8B5B87",
-"Q+ c #83608E",
-"R+ c #816291",
-"S+ c #7F6393",
-"T+ c #E71C23",
-"U+ c #DC262F",
-"V+ c #DA2832",
-"W+ c #D82A34",
-"X+ c #D32D39",
-"Y+ c #CA3443",
-"Z+ c #C83546",
-"`+ c #C4394B",
-" @ c #C23B4E",
-".@ c #C03D51",
-"+@ c #BE3F54",
-"@@ c #BC4157",
-"#@ c #BA435A",
-"$@ c #B7445C",
-"%@ c #B5455F",
-"&@ c #B24661",
-"*@ c #B04763",
-"=@ c #AE4865",
-"-@ c #A24F70",
-";@ c #A05173",
-">@ c #97577D",
-",@ c #94587F",
-"'@ c #915982",
-")@ c #8E5B84",
-"!@ c #865F8C",
-"~@ c #7C6596",
-"{@ c #E51E26",
-"]@ c #E0212A",
-"^@ c #D32D3A",
-"/@ c #CF313E",
-"(@ c #CC3241",
-"_@ c #C63749",
-":@ c #C43A4D",
-"<@ c #C23D50",
-"[@ c #C03F53",
-"}@ c #BE4157",
-"|@ c #BC4359",
-"1@ c #BA455C",
-"2@ c #B8465F",
-"3@ c #B64861",
-"4@ c #B44964",
-"5@ c #B14A66",
-"6@ c #AF4B68",
-"7@ c #AD4C6A",
-"8@ c #AA4D6B",
-"9@ c #A74E6D",
-"0@ c #A54E6E",
-"a@ c #9D5276",
-"b@ c #99567B",
-"c@ c #96577D",
-"d@ c #945980",
-"e@ c #925A82",
-"f@ c #8F5C84",
-"g@ c #8C5C87",
-"h@ c #895E89",
-"i@ c #83608F",
-"j@ c #7E6394",
-"k@ c #7A6698",
-"l@ c #EA1B20",
-"m@ c #E21F28",
-"n@ c #DC2530",
-"o@ c #D52C37",
-"p@ c #D32E3A",
-"q@ c #CE313F",
-"r@ c #CA3444",
-"s@ c #C83646",
-"t@ c #C6394A",
-"u@ c #C53B4E",
-"v@ c #C33E52",
-"w@ c #C14155",
-"x@ c #BF4358",
-"y@ c #BD455C",
-"z@ c #BB475F",
-"A@ c #B94961",
-"B@ c #B74B64",
-"C@ c #B54C66",
-"D@ c #B34D68",
-"E@ c #B04F6B",
-"F@ c #AE4F6C",
-"G@ c #AC506E",
-"H@ c #A95170",
-"I@ c #A65272",
-"J@ c #A35273",
-"K@ c #A05274",
-"L@ c #9D5376",
-"M@ c #905C85",
-"N@ c #8E5E87",
-"O@ c #8A5F8A",
-"P@ c #87608C",
-"Q@ c #84618F",
-"R@ c #7E6494",
-"S@ c #7A6799",
-"T@ c #77689B",
-"U@ c #D92832",
-"V@ c #D82A35",
-"W@ c #C83647",
-"X@ c #C6394B",
-"Y@ c #C53D4F",
-"Z@ c #C33F53",
-"`@ c #C14257",
-" # c #C0445A",
-".# c #BE475D",
-"+# c #BC4961",
-"@# c #BA4B63",
-"## c #B84D66",
-"$# c #B64F69",
-"%# c #B4506B",
-"&# c #B2526D",
-"*# c #AF536F",
-"=# c #AD5471",
-"-# c #AB5473",
-";# c #A85574",
-"># c #A55576",
-",# c #A25678",
-"'# c #9F5679",
-")# c #9C567A",
-"!# c #925B82",
-"~# c #8C5F8A",
-"{# c #88618D",
-"]# c #86628F",
-"^# c #826392",
-"/# c #7F6494",
-"(# c #796799",
-"_# c #756A9E",
-":# c #D72A35",
-"<# c #D52C38",
-"[# c #CC3342",
-"}# c #C83747",
-"|# c #C63A4B",
-"1# c #C53D50",
-"2# c #C34054",
-"3# c #C24358",
-"4# c #C0455B",
-"5# c #BE485F",
-"6# c #BC4B62",
-"7# c #BB4D65",
-"8# c #B94F68",
-"9# c #B7516B",
-"0# c #B5536E",
-"a# c #B35470",
-"b# c #B05672",
-"c# c #AE5774",
-"d# c #AD5876",
-"e# c #AA5878",
-"f# c #A75979",
-"g# c #A4597A",
-"h# c #A15A7C",
-"i# c #9E5A7D",
-"j# c #9B5A7E",
-"k# c #975A80",
-"l# c #945A81",
-"m# c #915B83",
-"n# c #8B5F8A",
-"o# c #89618D",
-"p# c #86638F",
-"q# c #846492",
-"r# c #806594",
-"s# c #7D6697",
-"t# c #77689C",
-"u# c #726CA1",
-"v# c #C63A4C",
-"w# c #C34154",
-"x# c #C0465C",
-"y# c #BE4960",
-"z# c #BD4C64",
-"A# c #BB4F67",
-"B# c #BA516A",
-"C# c #B8536D",
-"D# c #B65570",
-"E# c #B45772",
-"F# c #B25975",
-"G# c #B05A77",
-"H# c #AD5B79",
-"I# c #AC5C7B",
-"J# c #A95C7C",
-"K# c #A65D7E",
-"L# c #A35D7F",
-"M# c #A05D80",
-"N# c #9D5D81",
-"O# c #9A5D82",
-"P# c #965D83",
-"Q# c #935D85",
-"R# c #905D86",
-"S# c #8D5E88",
-"T# c #826694",
-"U# c #7E6797",
-"V# c #7B6899",
-"W# c #78699C",
-"X# c #706DA3",
-"Y# c #DF212B",
-"Z# c #D62935",
-"`# c #C43D50",
-" $ c #C34155",
-".$ c #C14459",
-"+$ c #C0475D",
-"@$ c #BF4A61",
-"#$ c #BD4D65",
-"$$ c #BC5068",
-"%$ c #BA536C",
-"&$ c #BA5870",
-"*$ c #B95C75",
-"=$ c #B85E79",
-"-$ c #B6607B",
-";$ c #B4617D",
-">$ c #B2627F",
-",$ c #B06380",
-"'$ c #AD6280",
-")$ c #A96080",
-"!$ c #A56082",
-"~$ c #A26183",
-"{$ c #9F6184",
-"]$ c #9C6185",
-"^$ c #996186",
-"/$ c #956187",
-"($ c #926088",
-"_$ c #8F6089",
-":$ c #8B608B",
-"<$ c #866390",
-"[$ c #826695",
-"}$ c #7F6897",
-"|$ c #7D6999",
-"1$ c #796A9C",
-"2$ c #766B9E",
-"3$ c #6F6EA4",
-"4$ c #6D6FA6",
-"5$ c #DB2531",
-"6$ c #D82733",
-"7$ c #CE3140",
-"8$ c #C93445",
-"9$ c #C5394B",
-"0$ c #C14359",
-"a$ c #BF4B61",
-"b$ c #BD4E66",
-"c$ c #BC5169",
-"d$ c #BC566D",
-"e$ c #BC5B74",
-"f$ c #B95C77",
-"g$ c #B85D78",
-"h$ c #B65F79",
-"i$ c #B4617C",
-"j$ c #B2627E",
-"k$ c #AE6483",
-"l$ c #AC6686",
-"m$ c #AB6888",
-"n$ c #A76787",
-"o$ c #A26487",
-"p$ c #9E6488",
-"q$ c #9B6489",
-"r$ c #98648A",
-"s$ c #94648B",
-"t$ c #91638C",
-"u$ c #8D638D",
-"v$ c #8A638E",
-"w$ c #846592",
-"x$ c #816695",
-"y$ c #7D699A",
-"z$ c #7A6B9C",
-"A$ c #776C9F",
-"B$ c #746DA1",
-"C$ c #706EA4",
-"D$ c #6B71A9",
-"E$ c #DA2531",
-"F$ c #D82633",
-"G$ c #C43C4F",
-"H$ c #C24054",
-"I$ c #C14358",
-"J$ c #BE4A61",
-"K$ c #BC516A",
-"L$ c #BD586F",
-"M$ c #BB5B76",
-"N$ c #BA5C76",
-"O$ c #B95F78",
-"P$ c #B8617B",
-"Q$ c #B6637E",
-"R$ c #B56580",
-"S$ c #B36783",
-"T$ c #B16885",
-"U$ c #AF6986",
-"V$ c #AC6988",
-"W$ c #A96989",
-"X$ c #A66A8D",
-"Y$ c #A56B8D",
-"Z$ c #9E688C",
-"`$ c #9A678D",
-" % c #96678E",
-".% c #93678F",
-"+% c #906690",
-"@% c #8C6691",
-"#% c #886692",
-"$% c #846593",
-"%% c #786C9F",
-"&% c #756EA2",
-"*% c #726FA4",
-"=% c #6E6FA7",
-"-% c #6872AB",
-";% c #D62836",
-">% c #D32B39",
-",% c #D02F3E",
-"'% c #C33B4E",
-")% c #C23F53",
-"!% c #C04358",
-"~% c #BF465C",
-"{% c #BA5D76",
-"]% c #B96079",
-"^% c #B9637D",
-"/% c #B96680",
-"(% c #B96883",
-"_% c #B86A86",
-":% c #B66C88",
-"<% c #B46D8A",
-"[% c #B06D8B",
-"}% c #AD6D8C",
-"|% c #AA6D8D",
-"1% c #A66D8E",
-"2% c #A26D91",
-"3% c #A06E92",
-"4% c #996A91",
-"5% c #956A91",
-"6% c #926992",
-"7% c #8F6993",
-"8% c #8B6994",
-"9% c #876895",
-"0% c #826896",
-"a% c #7F6898",
-"b% c #7C699A",
-"c% c #7A6B9D",
-"d% c #786D9F",
-"e% c #766EA2",
-"f% c #7370A4",
-"g% c #7070A7",
-"h% c #6C71A9",
-"i% c #6873AC",
-"j% c #6674AE",
-"k% c #D32A39",
-"l% c #D12D3B",
-"m% c #CF2F3E",
-"n% c #C13E52",
-"o% c #C04256",
-"p% c #BE455B",
-"q% c #BD4960",
-"r% c #BC4D65",
-"s% c #BB5069",
-"t% c #BB566E",
-"u% c #BA6079",
-"v% c #BA647E",
-"w% c #BB6882",
-"x% c #BD6B86",
-"y% c #BD6E89",
-"z% c #BE708C",
-"A% c #BC718E",
-"B% c #B9728F",
-"C% c #B57290",
-"D% c #B07191",
-"E% c #AC7191",
-"F% c #A67092",
-"G% c #A26F93",
-"H% c #9E7096",
-"I% c #9B7095",
-"J% c #946D95",
-"K% c #916C96",
-"L% c #8D6C96",
-"M% c #896B97",
-"N% c #856B98",
-"O% c #816A99",
-"P% c #7D6A9B",
-"Q% c #766FA2",
-"R% c #7470A4",
-"S% c #7172A7",
-"T% c #6E72A9",
-"U% c #6A73AC",
-"V% c #6376B1",
-"W% c #D02C3B",
-"X% c #CF2E3E",
-"Y% c #C03C50",
-"Z% c #BF4055",
-"`% c #BE445A",
-" & c #BC485F",
-".& c #BB4C63",
-"+& c #BA4F68",
-"@& c #BA536D",
-"#& c #BB5C75",
-"$& c #B95C76",
-"%& c #B9607A",
-"&& c #BC6882",
-"*& c #BF6C87",
-"=& c #C1708B",
-"-& c #C5778F",
-";& c #C97D92",
-">& c #C77F94",
-",& c #C27C95",
-"'& c #BB7896",
-")& c #B47696",
-"!& c #AE7596",
-"~& c #A87496",
-"{& c #A27396",
-"]& c #9D7297",
-"^& c #9B739A",
-"/& c #947098",
-"(& c #906F99",
-"_& c #8C6E9A",
-":& c #886E9B",
-"<& c #836D9B",
-"[& c #7F6D9C",
-"}& c #7B6C9D",
-"|& c #776D9F",
-"1& c #7470A5",
-"2& c #6F73AA",
-"3& c #6C74AC",
-"4& c #6875AE",
-"5& c #6476B1",
-"6& c #6178B3",
-"7& c #D02C3C",
-"8& c #CE2E3E",
-"9& c #CC3041",
-"0& c #C4384A",
-"a& c #BD4259",
-"b& c #BB465E",
-"c& c #BA4A62",
-"d& c #B94E67",
-"e& c #B8526B",
-"f& c #B95870",
-"g& c #B95D78",
-"h& c #B85F79",
-"i& c #C3738C",
-"j& c #CD8091",
-"k& c #D18695",
-"l& c #D18998",
-"m& c #D08A9B",
-"n& c #CE8A9B",
-"o& c #C9879B",
-"p& c #BB7D9B",
-"q& c #B1799A",
-"r& c #AA779A",
-"s& c #A37699",
-"t& c #9C759A",
-"u& c #98749C",
-"v& c #95759C",
-"w& c #8E719C",
-"x& c #8A709D",
-"y& c #86709E",
-"z& c #826F9F",
-"A& c #7D6FA0",
-"B& c #796FA1",
-"C& c #7370A5",
-"D& c #6C75AC",
-"E& c #6A76AF",
-"F& c #6677B1",
-"G& c #6278B4",
-"H& c #5E79B6",
-"I& c #CE2D3E",
-"J& c #CA3243",
-"K& c #C83446",
-"L& c #C4384B",
-"M& c #BF3C50",
-"N& c #BB4157",
-"O& c #BA445C",
-"P& c #B94861",
-"Q& c #B84C65",
-"R& c #B7506A",
-"S& c #B7546F",
-"T& c #B85D76",
-"U& c #B65E79",
-"V& c #B7627C",
-"W& c #B96681",
-"X& c #BC6B86",
-"Y& c #C1718B",
-"Z& c #D28897",
-"`& c #D991A0",
-" * c #DE98A9",
-".* c #DE9AAB",
-"+* c #D895A6",
-"@* c #CE8EA1",
-"#* c #C88A9F",
-"$* c #B57E9E",
-"%* c #AC7A9D",
-"&* c #A3789D",
-"** c #9C779D",
-"=* c #96769E",
-"-* c #9578A1",
-";* c #8D739F",
-">* c #8873A0",
-",* c #8472A0",
-"'* c #8072A2",
-")* c #7B71A3",
-"!* c #7771A4",
-"~* c #6F74AA",
-"{* c #6A77AF",
-"]* c #6778B1",
-"^* c #6379B4",
-"/* c #607AB7",
-"(* c #5C7BB9",
-"_* c #C93143",
-":* c #C63648",
-"<* c #BD3D53",
-"[* c #B9425A",
-"}* c #B74A63",
-"|* c #B64E68",
-"1* c #B5526D",
-"2* c #B55672",
-"3* c #B75F7A",
-"4* c #B5607B",
-"5* c #B6647F",
-"6* c #B86984",
-"7* c #C5788F",
-"8* c #E4A1B2",
-"9* c #ECB7C4",
-"0* c #ECBAC7",
-"a* c #E4A8BA",
-"b* c #D898AB",
-"c* c #CB8EA3",
-"d* c #BC86A2",
-"e* c #AD7DA1",
-"f* c #A47BA0",
-"g* c #9B79A0",
-"h* c #9578A0",
-"i* c #9379A4",
-"j* c #8C76A2",
-"k* c #8675A3",
-"l* c #8274A3",
-"m* c #7E73A4",
-"n* c #7973A5",
-"o* c #7573A6",
-"p* c #7172A8",
-"q* c #6E74AA",
-"r* c #6C75AD",
-"s* c #6878B2",
-"t* c #6579B4",
-"u* c #617BB7",
-"v* c #5D7BB9",
-"w* c #597DBC",
-"x* c #C73346",
-"y* c #C3384B",
-"z* c #C23A4E",
-"A* c #BA3F55",
-"B* c #B84158",
-"C* c #B7445D",
-"D* c #B64862",
-"E* c #B35874",
-"F* c #B5617C",
-"G* c #B3627D",
-"H* c #B46682",
-"I* c #B76B87",
-"J* c #BD708C",
-"K* c #C87E93",
-"L* c #D18999",
-"M* c #F9E0E6",
-"N* c #FAE6EB",
-"O* c #EEC2CE",
-"P* c #DDA1B5",
-"Q* c #CC91A8",
-"R* c #C18BA5",
-"S* c #AE7FA3",
-"T* c #A37DA2",
-"U* c #9A7BA2",
-"V* c #937AA3",
-"W* c #917BA6",
-"X* c #8B78A4",
-"Y* c #8476A5",
-"Z* c #8076A6",
-"`* c #7C75A7",
-" = c #7775A8",
-".= c #7375A9",
-"+= c #6778B2",
-"@= c #657AB4",
-"#= c #627BB7",
-"$= c #5F7CB9",
-"%= c #5B7DBC",
-"&= c #577EBE",
-"*= c #C3374B",
-"== c #C13A4E",
-"-= c #BF3C51",
-";= c #BD3E53",
-">= c #B6425B",
-",= c #B4465F",
-"'= c #B34A64",
-")= c #B24E69",
-"!= c #B2526E",
-"~= c #B15672",
-"{= c #B15A77",
-"]= c #B3627F",
-"^= c #B16380",
-"/= c #B26784",
-"(= c #B66D89",
-"_= c #BB728F",
-":= c #C77F95",
-"<= c #D08B9B",
-"[= c #FBEBF0",
-"}= c #EEC6D1",
-"|= c #DDA2B7",
-"1= c #CC93AA",
-"2= c #BF8CA7",
-"3= c #AC81A6",
-"4= c #A17FA5",
-"5= c #987DA5",
-"6= c #927BA5",
-"7= c #8F7CA8",
-"8= c #8879A7",
-"9= c #8278A8",
-"0= c #7E78A9",
-"a= c #7977AA",
-"b= c #7576AB",
-"c= c #7176AC",
-"d= c #6C76AD",
-"e= c #6977AF",
-"f= c #6779B2",
-"g= c #627CB7",
-"h= c #607DBA",
-"i= c #5C7EBC",
-"j= c #587FBF",
-"k= c #5580C1",
-"l= c #C2364B",
-"m= c #C0394E",
-"n= c #BF3B51",
-"o= c #BC3E53",
-"p= c #B3435D",
-"q= c #B24762",
-"r= c #B14B66",
-"s= c #AF5370",
-"t= c #AE5775",
-"u= c #AE5B79",
-"v= c #B16381",
-"w= c #AF6482",
-"x= c #B06986",
-"y= c #B36D8B",
-"z= c #B87290",
-"A= c #C17D96",
-"B= c #CE8A9C",
-"C= c #D895A7",
-"D= c #E5AFC2",
-"E= c #D79DB2",
-"F= c #C891AA",
-"G= c #BA8AA8",
-"H= c #A981A7",
-"I= c #9F80A7",
-"J= c #967EA7",
-"K= c #907DA8",
-"L= c #8D7EAB",
-"M= c #857AA9",
-"N= c #8079AA",
-"O= c #7B79AB",
-"P= c #7778AC",
-"Q= c #7378AD",
-"R= c #6E78AE",
-"S= c #6A77B0",
-"T= c #657AB5",
-"U= c #607EBA",
-"V= c #5D7EBC",
-"W= c #5A80BF",
-"X= c #5681C1",
-"Y= c #5282C4",
-"Z= c #BC3D53",
-"`= c #B14560",
-" - c #AF4864",
-".- c #AE4C69",
-"+- c #AE506D",
-"@- c #AD5472",
-"#- c #AD5877",
-"$- c #AD6585",
-"%- c #AD6988",
-"&- c #AF6E8C",
-"*- c #B37391",
-"=- c #BA7896",
-"-- c #C8889C",
-";- c #CE8EA2",
-">- c #DDA3B7",
-",- c #CC95AC",
-"'- c #C390AA",
-")- c #AF84A9",
-"!- c #A481A8",
-"~- c #9A80A8",
-"{- c #937FA9",
-"]- c #8D7DAA",
-"^- c #8B7FAD",
-"/- c #827BAB",
-"(- c #7D7BAC",
-"_- c #787AAD",
-":- c #757AAE",
-"<- c #7079B0",
-"[- c #6C79B1",
-"}- c #647AB5",
-"|- c #627CB8",
-"1- c #5D7FBD",
-"2- c #5B80BF",
-"3- c #5781C1",
-"4- c #5382C4",
-"5- c #5083C6",
-"6- c #BC3A51",
-"7- c #BB3C54",
-"8- c #BA3E56",
-"9- c #B74158",
-"0- c #AE4662",
-"a- c #AD4966",
-"b- c #AC4E6B",
-"c- c #AC5270",
-"d- c #AB5574",
-"e- c #AA5979",
-"f- c #AA5D7D",
-"g- c #AB6482",
-"h- c #AB6788",
-"i- c #AB6A89",
-"j- c #AC6E8E",
-"k- c #AF7292",
-"l- c #B37797",
-"m- c #BA7E9C",
-"n- c #C78AA0",
-"o- c #CB8EA4",
-"p- c #CC92A8",
-"q- c #C892AA",
-"r- c #B387AA",
-"s- c #A882AA",
-"t- c #9E81AA",
-"u- c #9580AA",
-"v- c #8F7FAA",
-"w- c #8A7EAC",
-"x- c #8880AD",
-"y- c #7E7CAD",
-"z- c #7A7CAE",
-"A- c #767BB0",
-"B- c #727BB1",
-"C- c #6D7BB2",
-"D- c #697BB3",
-"E- c #647BB5",
-"F- c #5F7EBA",
-"G- c #5B81BF",
-"H- c #5882C2",
-"I- c #5583C4",
-"J- c #5184C7",
-"K- c #4D85C9",
-"L- c #BC3951",
-"M- c #BA3B54",
-"N- c #B74059",
-"O- c #B3435E",
-"P- c #AE4663",
-"Q- c #AC4865",
-"R- c #AB4B68",
-"S- c #AA4F6D",
-"T- c #A95372",
-"U- c #A85676",
-"V- c #A75A7B",
-"W- c #A75E7F",
-"X- c #A76283",
-"Y- c #A96A8A",
-"Z- c #A76A8B",
-"`- c #A86E8F",
-" ; c #AA7293",
-".; c #AD7697",
-"+; c #B07A9B",
-"@; c #B57F9F",
-"#; c #BC87A3",
-"$; c #C08BA5",
-"%; c #BA8AA9",
-"&; c #A782AA",
-"*; c #9F81AA",
-"=; c #9781AB",
-"-; c #9180AB",
-";; c #8B80AC",
-">; c #8981AF",
-",; c #827EAE",
-"'; c #7B7DAF",
-"); c #777DB0",
-"!; c #737CB2",
-"~; c #6F7CB3",
-"{; c #6A7CB4",
-"]; c #667CB6",
-"^; c #5D80BD",
-"/; c #5982C2",
-"(; c #5683C4",
-"_; c #5284C7",
-":; c #4E85C9",
-"<; c #4A87CC",
-"[; c #B73D56",
-"}; c #B63F59",
-"|; c #B4425B",
-"1; c #A84C6B",
-"2; c #A7506F",
-"3; c #A65373",
-"4; c #A55778",
-"5; c #A45B7C",
-"6; c #A45E80",
-"7; c #A36285",
-"8; c #A56889",
-"9; c #A56B8F",
-"0; c #A46E90",
-"a; c #A57193",
-"b; c #A77597",
-"c; c #A9789B",
-"d; c #AB7B9F",
-"e; c #AD7EA2",
-"f; c #AD80A4",
-"g; c #AC81A7",
-"h; c #A981A8",
-"i; c #A481A9",
-"j; c #9D81AA",
-"k; c #9281AC",
-"l; c #8C80AD",
-"m; c #8880AF",
-"n; c #8681B0",
-"o; c #7C7EB0",
-"p; c #787EB1",
-"q; c #747EB2",
-"r; c #707DB4",
-"s; c #6C7DB5",
-"t; c #677DB7",
-"u; c #627DB8",
-"v; c #5F7EBB",
-"w; c #5B81C0",
-"x; c #5385C7",
-"y; c #4F86C9",
-"z; c #4B87CC",
-"A; c #4789CF",
-"B; c #B73D57",
-"C; c #B53E59",
-"D; c #B3415C",
-"E; c #B1435E",
-"F; c #A45071",
-"G; c #A35475",
-"H; c #A25879",
-"I; c #A15B7E",
-"J; c #A05F82",
-"K; c #A06286",
-"L; c #9F668A",
-"M; c #A26D8F",
-"N; c #A06E93",
-"O; c #A07195",
-"P; c #A07498",
-"Q; c #A1779B",
-"R; c #A2799E",
-"S; c #A37CA1",
-"T; c #A27EA4",
-"U; c #A17FA6",
-"V; c #9E80A8",
-"W; c #9981A9",
-"X; c #9181AC",
-"Y; c #8782B1",
-"Z; c #7E7FB1",
-"`; c #797FB2",
-" > c #757FB3",
-".> c #717EB5",
-"+> c #6D7EB6",
-"@> c #687EB7",
-"#> c #647EB9",
-"$> c #5783C5",
-"%> c #5485C7",
-"&> c #5087CA",
-"*> c #4C87CC",
-"=> c #4889CF",
-"-> c #458AD1",
-";> c #B53F59",
-">> c #B2405C",
-",> c #B0425E",
-"'> c #AF4461",
-")> c #A15173",
-"!> c #A05577",
-"~> c #9F587B",
-"{> c #9E5C7F",
-"]> c #9D5F83",
-"^> c #9D6387",
-"/> c #9C668B",
-"(> c #9C698F",
-"_> c #9E7094",
-":> c #9C7198",
-"<> c #9B7399",
-"[> c #9B769C",
-"}> c #9B789F",
-"|> c #9A7AA1",
-"1> c #997CA4",
-"2> c #977DA6",
-"3> c #957FA8",
-"4> c #927FAA",
-"5> c #8F80AB",
-"6> c #8B80AD",
-"7> c #8880B0",
-"8> c #8682B1",
-"9> c #7E80B1",
-"0> c #767FB4",
-"a> c #727FB5",
-"b> c #6D7FB6",
-"c> c #697FB8",
-"d> c #647FBA",
-"e> c #607FBB",
-"f> c #5C80BD",
-"g> c #5784C5",
-"h> c #5187CA",
-"i> c #4D88CC",
-"j> c #4989CF",
-"k> c #458BD2",
-"l> c #428CD4",
-"m> c #AE4461",
-"n> c #AC4663",
-"o> c #9C5579",
-"p> c #9C597D",
-"q> c #9B5C81",
-"r> c #9A5F85",
-"s> c #996389",
-"t> c #98668C",
-"u> c #976990",
-"v> c #976C93",
-"w> c #997197",
-"x> c #99759C",
-"y> c #96759E",
-"z> c #9577A0",
-"A> c #9379A2",
-"B> c #917CA7",
-"C> c #8F7DA9",
-"D> c #8C7EAA",
-"E> c #897FAD",
-"F> c #8881B0",
-"G> c #8582B1",
-"H> c #7D7FB1",
-"I> c #797FB3",
-"J> c #757FB4",
-"K> c #6E80B7",
-"L> c #6A7FB8",
-"M> c #6580BA",
-"N> c #6180BC",
-"O> c #5D80BE",
-"P> c #5982C3",
-"Q> c #5684C5",
-"R> c #5485C8",
-"S> c #4E88CC",
-"T> c #4A8ACF",
-"U> c #468BD2",
-"V> c #408ED7",
-"W> c #B0425F",
-"X> c #AD4361",
-"Y> c #AB4564",
-"Z> c #A94766",
-"`> c #A84969",
-" , c #A64C6B",
-"., c #99567A",
-"+, c #98597E",
-"@, c #975C82",
-"#, c #966086",
-"$, c #95638A",
-"%, c #94668E",
-"&, c #946991",
-"*, c #936C94",
-"=, c #926E98",
-"-, c #92719A",
-";, c #94769E",
-">, c #9479A2",
-",, c #927AA5",
-"', c #8E7DAA",
-"), c #8C7FAC",
-"!, c #8A80AE",
-"~, c #8780AE",
-"{, c #817FAF",
-"], c #7C7EB1",
-"^, c #787FB2",
-"/, c #727FB6",
-"(, c #6A80B9",
-"_, c #6680BA",
-":, c #5882C3",
-"<, c #5287CA",
-"[, c #4E88CD",
-"}, c #4B8ACF",
-"|, c #478BD2",
-"1, c #438CD4",
-"2, c #3D8FD9",
-"3, c #AD4461",
-"4, c #A74969",
-"5, c #A54B6B",
-"6, c #A44D6E",
-"7, c #955980",
-"8, c #945D84",
-"9, c #936087",
-"0, c #92638B",
-"a, c #91668F",
-"b, c #906992",
-"c, c #906C96",
-"d, c #8F6E99",
-"e, c #8D709C",
-"f, c #8C739E",
-"g, c #8B75A1",
-"h, c #8A77A4",
-"i, c #8979A6",
-"j, c #877AA8",
-"k, c #847BAB",
-"l, c #807CAD",
-"m, c #7D7DAF",
-"n, c #7A7EB1",
-"o, c #777EB2",
-"p, c #717FB5",
-"q, c #6D80B7",
-"r, c #6580BB",
-"s, c #6181BC",
-"t, c #5D81BE",
-"u, c #5A81C1",
-"v, c #4F89CD",
-"w, c #4B8AD0",
-"x, c #488BD2",
-"y, c #438CD5",
-"z, c #3D90D9",
-"A, c #3B91DC",
-"B, c #A64969",
-"C, c #A44A6C",
-"D, c #A24C6E",
-"E, c #A14E71",
-"F, c #9F5173",
-"G, c #905D85",
-"H, c #906089",
-"I, c #8F638C",
-"J, c #8E6690",
-"K, c #8D6893",
-"L, c #8C6B97",
-"M, c #8A6E9A",
-"N, c #89709D",
-"O, c #8872A0",
-"P, c #8674A2",
-"Q, c #8278A7",
-"R, c #8079A9",
-"S, c #7E7BAC",
-"T, c #7B7CAE",
-"U, c #797DB0",
-"V, c #767EB2",
-"W, c #747EB4",
-"X, c #707FB6",
-"Y, c #6980B9",
-"Z, c #5684C6",
-"`, c #5386C8",
-" ' c #5187CB",
-".' c #4C8AD0",
-"+' c #488CD2",
-"@' c #448DD5",
-"#' c #3D90DA",
-"$' c #3B91DD",
-"%' c #9E5073",
-"&' c #9C5276",
-"*' c #98567B",
-"=' c #8C608A",
-"-' c #8B638E",
-";' c #8A6691",
-">' c #896894",
-",' c #876B98",
-"'' c #866D9B",
-")' c #85709E",
-"!' c #8372A1",
-"~' c #7E77A8",
-"{' c #7C79AB",
-"]' c #797AAD",
-"^' c #777BAF",
-"/' c #757CB1",
-"(' c #727DB3",
-"_' c #6F7EB5",
-":' c #6C7FB7",
-"<' c #6880B9",
-"[' c #6181BD",
-"}' c #5883C3",
-"|' c #4C8BD0",
-"1' c #488CD3",
-"2' c #458DD5",
-"3' c #418ED7",
-"4' c #9C4F73",
-"5' c #9B5176",
-"6' c #995378",
-"7' c #98557B",
-"8' c #96577E",
-"9' c #925B83",
-"0' c #89618C",
-"a' c #87638F",
-"b' c #866692",
-"c' c #846896",
-"d' c #836B99",
-"e' c #826D9C",
-"f' c #806F9F",
-"g' c #7F72A2",
-"h' c #7D73A4",
-"i' c #7B75A7",
-"j' c #737BB1",
-"k' c #707CB3",
-"l' c #6D7DB5",
-"m' c #6A7EB7",
-"n' c #677FB8",
-"o' c #6380BB",
-"p' c #6080BD",
-"q' c #5C81BF",
-"r' c #5883C4",
-"s' c #5584C6",
-"t' c #498CD3",
-"u' c #458ED5",
-"v' c #418ED8",
-"w' c #985279",
-"x' c #96547B",
-"y' c #95577E",
-"z' c #935980",
-"A' c #8E5E88",
-"B' c #806897",
-"C' c #7F6A9A",
-"D' c #7D6D9D",
-"E' c #7C6FA0",
-"F' c #7A71A3",
-"G' c #7873A6",
-"H' c #7577AB",
-"I' c #717AB0",
-"J' c #6E7BB2",
-"K' c #6B7CB4",
-"L' c #697DB6",
-"M' c #657EB8",
-"N' c #627FBA",
-"O' c #5F80BC",
-"P' c #5386C9",
-"Q' c #5188CB",
-"R' c #4E89CE",
-"S' c #418FD8",
-"T' c #3E90DA",
-"U' c #925880",
-"V' c #905A83",
-"W' c #8F5C85",
-"X' c #8B608A",
-"Y' c #7B6B9C",
-"Z' c #796D9F",
-"`' c #776FA1",
-" ) c #7671A4",
-".) c #7573A7",
-"+) c #7375AA",
-"@) c #6E78AF",
-"#) c #647DB8",
-"$) c #5E7FBD",
-"%) c #5A81C2",
-"&) c #5783C4",
-"*) c #5585C6",
-"=) c #5088CB",
-"-) c #4C8BD1",
-";) c #498DD3",
-">) c #458ED6",
-",) c #8D5B86",
-"') c #8B5D88",
-")) c #766EA1",
-"!) c #756FA3",
-"~) c #7271A6",
-"{) c #7073A9",
-"]) c #6E75AB",
-"^) c #6C76AE",
-"/) c #6978B0",
-"() c #6779B3",
-"_) c #5585C7",
-":) c #5088CC",
-"<) c #4B8BD1",
-"[) c #488DD3",
-"}) c #3E90DB",
-"|) c #8A5C88",
-"1) c #885E8B",
-"2) c #86608D",
-"3) c #856290",
-"4) c #836492",
-"5) c #6D74AB",
-"6) c #6B76AE",
-"7) c #6679B3",
-"8) c #5286C9",
-"9) c #875E8B",
-"0) c #855F8D",
-"a) c #836290",
-"b) c #826493",
-"c) c #806595",
-"d) c #7E6898",
-"e) c #7271A7",
-"f) c #6F73A9",
-"g) c #6D75AC",
-"h) c #6878B1",
-"i) c #4D8ACE",
-"j) c #4A8BD1",
-"k) c #478DD4",
-"l) c #448ED6",
-"m) c #418FD9",
-"n) c #3D91DB",
-"o) c #826190",
-"p) c #806393",
-"q) c #7E6595",
-"r) c #7C6798",
-"s) c #7B699A",
-"t) c #796A9D",
-"u) c #647BB6",
-"v) c #617CB8",
-"w) c #4F88CC",
-"x) c #4D8ACF",
-"y) c #438ED6",
-"z) c #408FD9",
-"A) c #7D6595",
-"B) c #79689A",
-"C) c #776A9D",
-"D) c #766C9F",
-"E) c #746DA2",
-"F) c #7071A7",
-"G) c #6E73AA",
-"H) c #6A76AE",
-"I) c #617DB8",
-"J) c #5C80BE",
-"K) c #4C8ACF",
-"L) c #498BD2",
-"M) c #468DD4",
-"N) c #438ED7",
-"O) c #3F8FD9",
-"P) c #3C91DB",
-"Q) c #91567F",
-"R) c #8F5882",
-"S) c #816190",
-"T) c #7D6596",
-"U) c #78689B",
-"V) c #76699D",
-"W) c #746BA0",
-"X) c #726CA2",
-"Y) c #706FA4",
-"Z) c #6E71A7",
-"`) c #6D72AA",
-" ! c #6B74AC",
-".! c #6976AF",
-"+! c #6777B1",
-"@! c #637BB6",
-"#! c #5E7EBB",
-"$! c #5C7FBE",
-"%! c #5A81C0",
-"&! c #5584C5",
-"*! c #5385C8",
-"=! c #4D88CD",
-"-! c #458CD4",
-";! c #3C91DC",
-">! c #8A5B87",
-",! c #75699D",
-"'! c #736BA0",
-")! c #716DA2",
-"!! c #6F6EA5",
-"~! c #6C70A7",
-"{! c #6B71AA",
-"]! c #6973AC",
-"^! c #6775AF",
-"/! c #6577B1",
-"(! c #617AB6",
-"_! c #5D7EBB",
-":! c #5B7FBE",
-"<! c #5981C0",
-"[! c #5682C3",
-"}! c #5484C5",
-"|! c #5185C8",
-"1! c #4F87CA",
-"2! c #4C88CD",
-"3! c #3E90D9",
-"4! c #8C5A84",
-"5! c #7A6699",
-"6! c #756A9D",
-"7! c #6E6EA5",
-"8! c #6C70A8",
-"9! c #6972AA",
-"0! c #6773AD",
-"a! c #6575AF",
-"b! c #6178B4",
-"c! c #5F79B6",
-"d! c #597EBE",
-"e! c #5780C1",
-"f! c #5482C3",
-"g! c #5283C6",
-"h! c #5085C8",
-"i! c #4D86CA",
-"j! c #4B88CD",
-"k! c #428DD5",
-"l! c #8A5C87",
-"m! c #885D8A",
-"n! c #855F8C",
-"o! c #6276B2",
-"p! c #6078B4",
-"q! c #5E7AB7",
-"r! c #5282C3",
-"s! c #4E85C8",
-"t! c #4C86CB",
-"u! c #4988CD",
-"v! c #4789D0",
-"w! c #448BD2",
-"x! c #3F8ED7",
-". . . . . . + @ # $ % & * = - ; > , ' ) ! ~ { ] ^ / ( _ : < [ } | 1 2 3 4 5 6 7 8 9 0 a b c d e f g ",
-". . . . . h i j k % l * = - m > n ' o ! p { q r s t u v < w } x y 2 z 4 5 6 7 8 A 0 B C c d e f D E ",
-". . . . h F j k % G * H - m > n I J K p L M N s O P Q R S T U V W X 4 Y Z 7 ` A .B C c ..+.@.D E #.",
-". . . $.F j k %.&.*.H =.m -.n ;.>.K ,.'.).!.~.{.].^.R /.(._.:.<.[.}.|.1.7 2.A 3.4.5.6...+.@.7.8.#.9.",
-". . 0.F a.b.c.&.d.H e.f.-.g.h.>.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.A.B.C.A 3.4.5.D...+.E.7.F.#.9.G.",
-"H.0.I.a.J.c.&.K.L.e.f.-.g.M.N.i.O.k.P.Q.n.o.p.q.R.s.S.u.T.w.x.y.U.V.W.X.Y.Z.`.5.D... +.+++F.@+9.G.#+",
-"0.$+%+&+c.&.K.L.*+=+-+;+M.N.>+O.,+'+Q.)+o.!+q.~+s.S.{+]+w.^+/+U.V.(+_+:+<+[+}+|+1+2+.+++F.3+9.4+#+5+",
-"$+%+&+6+7+K.L.*+8+-+;+M.9+>+O.,+'+Q.)+0+!+q.~+s.S.{+]+a+b+/+U.c+d+_+:+e+f+g+h+i+j+.+++k+3+9.l+m+5+n+",
-"o+&+p+7+q+r+s+8+, ;+M.t+u+O.v+'+w+x+0+y+q.~+z+A+B+]+C+D+/+E+F+d+G+:+H+f+g+I+J+K+L+M+N+O+P+l+m+Q+R+S+",
-"&+& 7+T+r+s+8+, U+V+W+u+X+v+'+w+Y+Z+y+`+ @.@+@@@#@$@%@&@*@=@d+G+:+H+-@;@h+J+K+>@,@'@)@P+l+!@Q+R+S+~@",
-"& 7+T+{@s+]@, ;+V+W+u+^@v+/@(@Y+Z+_@:@<@[@}@|@1@2@3@4@5@6@7@8@9@0@-@;@a@J+b@c@d@e@f@g@h@!@i@R+j@~@k@",
-"l@T+{@m@> , n@V+W+o@p@v+q@(@r@s@t@u@v@w@x@y@z@A@B@C@D@E@F@G@H@I@J@K@L@J+b@c@d@e@M@N@O@P@Q@R+R@~@S@T@",
-"T+{@; > , I U@V@o@p@v+q@(@r@W@X@Y@Z@`@ #.#+#@###$#%#&#*#=#-#;#>#,#'#)#b@c@d@!#M@N@~#{#]#^#/#~@(#T@_#",
-"- m > , I U@:#<#p@).q@[#r@}#|#1#2#3#4#5#6#7#8#9#0#a#b#c#d#e#f#g#h#i#j#k#l#m#M@N@n#o#p#q#r#s#(#t#_#u#",
-"m > n I J :#<#p@l.q@[#{.W@v#1#w#3#x#y#z#A#B#C#D#E#F#G#H#I#J#K#L#M#N#O#P#Q#R#S#n#o#p#q#T#U#V#W#_#u#X#",
-"Y#n I J Z#<#k.l.q@n.{.W@v#`# $.$+$@$#$$$%$&$*$=$-$;$>$,$'$)$!$~${$]$^$/$($_$:${#<$q#[$}$|$1$2$u#3$4$",
-"n 5$6$Z#,.k.l.7$n.8$p.9$`#w#0$+$a$b$c$d$e$f$g$h$i$j$,$k$l$m$n$o$p$q$r$s$t$u$v$<$w$x$}$y$z$A$B$C$4$D$",
-"E$F$K ,.'.l.m.n.o.p.q.G$H$I$+$J$b$K$L$M$N$O$P$Q$R$S$T$U$V$W$X$Y$Z$`$ %.%+%@%#%$%x$}$y$z$%%&%*%=%D$-%",
-"6$;%>%'.,%Q.)+o.p.q.'%)%!%~%J$#$c$L$M${%]%^%/%(%_%:%<%[%}%|%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f%g%h%i%j%",
-";%k%l%m%m.)+o.!+q.R.n%o%p%q%r%s%t%M${%u%v%w%x%y%z%A%B%C%D%E%F%G%H%I%J%K%L%M%N%O%P%c%d%Q%R%S%T%U%j%V%",
-"k%W%X%m.)+0+!+q.~+Y%Z%`% &.&+&@&#&$&%&v%&&*&=&-&;&>&,&'&)&!&~&{&]&^&/&(&_&:&<&[&}&|&Q%1&S%2&3&4&5&6&",
-"7&8&9&x+Z+y+0&~+z++@a&b&c&d&e&f&g&h&^%w%*&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z&A&B&Q%C&S%2&D&E&F&G&H&",
-"I&9&J&K&y+L&~+M&A+N&O&P&Q&R&S&T&U&V&W&X&Y&j&Z&`& *.*+*@*#*$*%*&***=*-*;*>*,*'*)*!*1&S%~*D&{*]*^*/*(*",
-"/ _*K&:*L&~+M&<*B+[*2@}*|*1*2*3*4*5*6*y%7*k&`&8*9*0*a*b*c*d*e*f*g*h*i*j*k*l*m*n*o*p*q*r*{*s*t*u*v*w*",
-"( x*Q y*z*M&<*A*B*C*D*C@%#a#E*F*G*H*I*J*K*L* *9*M*N*O*P*Q*R*S*T*U*V*W*X*Y*Z*`* =.=~*r*{*+=@=#=$=%=&=",
-"_ v *===-=;=A*B*>=,='=)=!=~={=]=^=/=(=_=:=<=.*0*N*[=}=|=1=2=3=4=5=6=7=8=9=0=a=b=c=d=e=f=@=g=h=i=j=k=",
-": l=m=n=o=v.B*>=p=q=r=E@s=t=u=v=w=x=y=z=A=B=C=a*O*}=D=E=F=G=H=I=J=K=L=M=N=O=P=Q=R=S=f=T=g=U=V=W=X=Y=",
-"< w (.Z=v.B*x.p=`= -.-+-@-#-I#w=$-%-&-*-=---;-b*P*>-E=,-'-)-!-~-{-]-^-/-(-_-:-<-[-f=}-|-U=1-2-3-4-5-",
-"w 6-7-8-9-x.p=`=0-a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-1=q-'-r-s-t-u-v-w-x-y-z-A-B-C-D-E-|-F-1-G-H-I-J-K-",
-"L-M-:.N-x.O-z.P-Q-R-S-T-U-V-W-X-Y-Z-`- ;.;+;@;#;$;2=%;)-&;*;=;-;;;>;,;';);!;~;{;];|-F-^;G-/;(;_;:;<;",
-"M-[;};|;O-z.P-(+_+1;2;3;4;5;6;7;8;9;0;a;b;c;d;e;f;g;h;i;j;=;k;l;m;n;o;p;q;r;s;t;u;v;^;w;/;(;x;y;z;A;",
-"B;C;D;E;z.V.(+_+1;e+F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;u-X;l;m;Y;Z;`; >.>+>@>#>v;^;w;/;$>%>&>*>=>->",
-";>>>,>'>V.d+_+:+e+f+)>!>~>{>]>^>/>(>_>:><>[>}>|>1>2>3>4>5>6>7>8>9>`;0>a>b>c>d>e>f>w;/;g>%>h>i>j>k>l>",
-">>,>m>n>W.G+:+e+f+g+I+o>p>q>r>s>t>u>v>w>x>y>z>A>6=B>C>D>E>F>G>H>I>J>a>K>L>M>N>O>w;P>Q>R>h>S>T>U>l>V>",
-"W>X>Y>Z>`> ,H+-@;@I+J+.,+,@,#,$,%,&,*,=,-,;,>,,,7=',),!,~,{,],^,J>/,K>(,_,N>O>w;:,Q>R><,[,},|,1,V>2,",
-"3,Y>8 4,5,6,-@;@I+J+b@c@7,8,9,0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,J>p,q,(,r,s,t,u,:,Q>R>h>v,w,x,y,V>z,A,",
-"Y>8 B,C,D,E,F,h+J+b@c@d@e@G,H,I,J,K,L,M,N,O,P,Y*Q,R,S,T,U,V,W,X,q,Y,r,s,t,u,:,Z,`, 'v,.'+'@'V>#'A,$'",
-"8 B,0 a b %'&'J+*'c@d@e@M@N@='-';'>',''')'!'l*Z*~'{']'^'/'('_':'<'r,['t,u,}'Z,`, 'v,|'1'2'3'#'A,$'$'",
-"9 0 a b 4'5'6'7'8'd@9'M@N@n#0'a'b'c'd'e'f'g'h'i'a=P=:-j'k'l'm'n'o'p'q'u,r's'`, 'v,|'t'u'v'#'A,$'$'$'",
-"0 B C c d w'x'y'z'm#M@A'n#o#a'q#T#B'C'D'E'F'G' =H'Q=I'J'K'L'M'N'O'q'u,r's'P'Q'R'|'t'u'S'T'$'$'$'$'$'",
-"B C c d e @.D U'V'W'S#X'o#p#q#T#}$|$Y'Z'`' ).)+)c=@)[-D-];#)U=$)G-%)&)*)P'=)R'-);)>)S'T'$'$'$'$'$'$'",
-"5.c d +.@.7.8.#.,)')O@{#p#w$x$}$y$Y'%%))!)~){)])^)/)()E-g=F-1-G-/;&)_)P':)R'<)[)>)S'})$'$'$'$'$'$'$'",
-"6...+.@.7.F.#.9.|)1)2)3)4)x$}$y$z$%%))R%~){)5)6)/)7)E-|-F-^;G-/;&)_)8):)R'<)[)>)S'})$'$'$'$'$'$'$'$'",
-"..+..+++F.@+9.G.9)0)a)b)c)d)b%z$d%))R%e)f)g)6)h)7)E-|-v;^;w;/;$>_)8):)i)j)k)l)m)n)$'$'$'$'$'$'$'$'$'",
-"+..+++F.3+9.4+#+5+o)p)q)r)s)t)A$&%R%S%f)g)6)h)7)u)v)v;^;w;/;$>%><,w)x)j)k)y)z)n)$'$'$'$'$'$'$'$'$'$'",
-".+++k+3+9.l+#+5+o)S+A)k@B)C)D)E)*%F)G)g)H)h)7)u)I)v;J)w;/;Q>%>h>w)K)L)M)N)O)P)$'$'$'$'$'$'$'$'$'$'$'",
-"Q)R)O+P+l+#+5+S)S+T)k@U)V)W)X)Y)Z)`) !.!+!t*@!v)#!$!%!:,&!*!&>=!},x,-!3'O);!$'$'$'$'$'$'$'$'$'$'$'$'",
-"R)O+>!l+m+Q+R+S+~@k@U),!'!)!!!~!{!]!^!/!^*(!$=_!:!<![!}!|!1!2!j>U>1,3'3!;!$'$'$'$'$'$'$'$'$'$'$'$'$'",
-"4!>!l+!@Q+R+j@~@5!U)6!'!)!7!8!9!0!a!V%b!c!v*%=d!e!f!g!h!i!j!=>k>k!V>#'A,$'$'$'$'$'$'$'$'$'$'$'$'$'$'",
-"l!m!n!Q+R+R@~@S@T@_#'!X#7!8!9!0!a!o!p!q!(*w*&=k=r!5-s!t!u!v!w!k!x!#'A,$'$'$'$'$'$'$'$'$'$'$'$'$'$'$'"};
diff --git a/ext/gd/tests/gif2gd.phpt b/ext/gd/tests/gif2gd.phpt
deleted file mode 100644
index 3eee211871..0000000000
--- a/ext/gd/tests/gif2gd.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-gif --> gd1/gd2 conversion test
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
- die("skip gd extension not avaliable.");
- }
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
- if (!function_exists("imagecreatefromgif")) {
- die("skip gif read support unavailable");
- }
-?>
---FILE--
-<?php
- $cwd = dirname(__FILE__);
-
- echo "GIF to GD1 conversion: ";
- echo imagegd(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test.gd1") ? 'ok' : 'failed';
- echo "\n";
-
- echo "GIF to GD2 conversion: ";
- echo imagegd2(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test.gd2") ? 'ok' : 'failed';
- echo "\n";
-
- @unlink($cwd . "/test.gd1");
- @unlink($cwd . "/test.gd2");
-?>
---EXPECT--
-GIF to GD1 conversion: ok
-GIF to GD2 conversion: ok
diff --git a/ext/gd/tests/gif2jpg.phpt b/ext/gd/tests/gif2jpg.phpt
deleted file mode 100644
index 38a0493ff9..0000000000
--- a/ext/gd/tests/gif2jpg.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-gif --> jpeg conversion test
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
- die("skip gd extension not avaliable.");
- }
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
- if (!function_exists("imagejpeg")) {
- die("skip jpeg support unavailable");
- }
- if (!function_exists("imagecreatefromgif")) {
- die("skip gif read support unavailable");
- }
-?>
---FILE--
-<?php
- $cwd = dirname(__FILE__);
-
- echo "GIF to JPEG conversion: ";
- echo imagejpeg(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.jpeg") ? 'ok' : 'failed';
- echo "\n";
-
- @unlink($cwd . "/test_gif.jpeg");
-?>
---EXPECT--
-GIF to JPEG conversion: ok
diff --git a/ext/gd/tests/gif2png.phpt b/ext/gd/tests/gif2png.phpt
deleted file mode 100644
index 70ddc37937..0000000000
--- a/ext/gd/tests/gif2png.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-gif --> png conversion test
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
- die("skip gd extension not avaliable.");
- }
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
- if (!function_exists("imagepng")) {
- die("skip png support unavailable");
- }
- if (!function_exists("imagecreatefromgif")) {
- die("skip gif read support unavailable");
- }
-?>
---FILE--
-<?php
- $cwd = dirname(__FILE__);
-
- echo "GIF to PNG conversion: ";
- echo imagepng(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.png") ? 'ok' : 'failed';
- echo "\n";
-
- @unlink($cwd . "/test_gif.png");
-?>
---EXPECT--
-GIF to PNG conversion: ok
diff --git a/ext/gd/tests/imagefilter.phpt b/ext/gd/tests/imagefilter.phpt
deleted file mode 100644
index 3b97657a0d..0000000000
--- a/ext/gd/tests/imagefilter.phpt
+++ /dev/null
@@ -1,89 +0,0 @@
---TEST--
-imagefilter() function test
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
- die("skip gd extension not avaliable.");
- }
- if (!GD_BUNDLED) {
- die("skip this test requires bundled gd library.");
- }
-?>
---FILE--
-<?php
-$no_arg_filters = array(
- "IMG_FILTER_NEGATE",
- "IMG_FILTER_GRAYSCALE",
- "IMG_FILTER_EDGEDETECT",
- "IMG_FILTER_GAUSSIAN_BLUR",
- "IMG_FILTER_SELECTIVE_BLUR",
- "IMG_FILTER_EMBOSS",
- "IMG_FILTER_MEAN_REMOVAL"
-);
-
-$SAVE_DIR = dirname(__FILE__);
-$SOURCE_IMG = $SAVE_DIR . "/test.png";
-
- foreach ($no_arg_filters as $filt) {
- $im = imagecreatefrompng($SOURCE_IMG);
- if (imagefilter($im, constant($filt))) {
- imagepng($im, $SAVE_DIR. $filt. ".png");
- echo "$filt success\n";
- @unlink($SAVE_DIR. $filt. ".png");
- } else {
- echo "$filt failed\n";
- }
- }
-
- $im = imagecreatefrompng($SOURCE_IMG);
-
- if (imagefilter($im, IMG_FILTER_SMOOTH, -1924.124)) {
- imagepng($im, $SAVE_DIR . "IMG_FILTER_SMOOTH.png");
- echo "IMG_FILTER_SMOOTH success\n";
- @unlink($SAVE_DIR . "IMG_FILTER_SMOOTH.png");
- } else {
- echo "IMG_FILTER_SMOOTH failed\n";
- }
-
- $im = imagecreatefrompng($SOURCE_IMG);
-
- if (imagefilter($im, IMG_FILTER_COLORIZE, -127.12, -127.98, 127)) {
- imagepng($im, $SAVE_DIR . "IMG_FILTER_COLORIZE.png");
- echo "IMG_FILTER_COLORIZE success\n";
- unlink($SAVE_DIR . "IMG_FILTER_COLORIZE.png");
- } else {
- echo "IMG_FILTER_COLORIZE failed\n";
- }
-
- $im = imagecreatefrompng($SOURCE_IMG);
-
- if (imagefilter($im, IMG_FILTER_CONTRAST, -90)) {
- imagepng($im, $SAVE_DIR . "IMG_FILTER_CONTRAST.png");
- echo "IMG_FILTER_CONTRAST success\n";
- unlink($SAVE_DIR . "IMG_FILTER_CONTRAST.png");
- } else {
- echo "IMG_FILTER_CONTRAST failed\n";
- }
-
- $im = imagecreatefrompng($SOURCE_IMG);
-
- if (imagefilter($im, IMG_FILTER_BRIGHTNESS, 98)) {
- imagepng($im, $SAVE_DIR . "IMG_FILTER_BRIGHTNESS.png");
- echo "IMG_FILTER_BRIGHTNESS success\n";
- unlink($SAVE_DIR . "IMG_FILTER_BRIGHTNESS.png");
- } else {
- echo "IMG_FILTER_BRIGHTNESS failed\n";
- }
-?>
---EXPECT--
-IMG_FILTER_NEGATE success
-IMG_FILTER_GRAYSCALE success
-IMG_FILTER_EDGEDETECT success
-IMG_FILTER_GAUSSIAN_BLUR success
-IMG_FILTER_SELECTIVE_BLUR success
-IMG_FILTER_EMBOSS success
-IMG_FILTER_MEAN_REMOVAL success
-IMG_FILTER_SMOOTH success
-IMG_FILTER_COLORIZE success
-IMG_FILTER_CONTRAST success
-IMG_FILTER_BRIGHTNESS success
diff --git a/ext/gd/tests/imagefttext.phpt b/ext/gd/tests/imagefttext.phpt
deleted file mode 100644
index ca62d60d43..0000000000
--- a/ext/gd/tests/imagefttext.phpt
+++ /dev/null
@@ -1,52 +0,0 @@
---TEST--
-imagefttext() function test
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
- die("skip gd extension not avaliable.");
- }
- if (!function_exists("imagefttext")) {
- die("skip imagefttext() not available.");
- }
-?>
---FILE--
-<?php
- $cwd = dirname(__FILE__);
- $fontfile_8859 = "$cwd/test8859.ttf";
-
- function testrun($im, $fontfile) {
- $sx = imagesx($im);
- $sy = imagesy($im);
-
- $colour_w = imagecolorallocate($im, 255, 255, 255);
- $colour_b = imagecolorallocate($im, 0, 0, 0);
-
- imagefilledrectangle($im, 0, 0, $sx - 1, $sy - 1, $colour_b);
- imagefttext($im, $sy * 0.75, 0, 0, $sy - 1, $colour_w, $fontfile, "A", array());
-
- $cnt = 0;
- for ($y = 0; $y < $sy; ++$y) {
- for ($x = 0; $x < $sx; ++$x) {
- if (imagecolorat($im, $x, $y) == $colour_b) {
- ++$cnt;
- }
- }
- }
-
- // imagecolordeallocate($im, $colour_w);
- // imagecolordeallocate($im, $colour_b);
-
- return ($cnt < ($sx * $sy));
- }
-
- $im = imagecreate(256, 256);
- var_dump(testrun($im, $fontfile_8859));
- imagedestroy($im);
-
- $im = imagecreatetruecolor(256, 256);
- var_dump(testrun($im, $fontfile_8859));
- imagedestroy($im);
-?>
---EXPECT--
-bool(true)
-bool(true)
diff --git a/ext/gd/tests/jpeg2png.phpt b/ext/gd/tests/jpeg2png.phpt
deleted file mode 100644
index e345a51abd..0000000000
--- a/ext/gd/tests/jpeg2png.phpt
+++ /dev/null
@@ -1,47 +0,0 @@
---TEST--
-jpeg <--> png conversion test
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
- die("skip gd extension not avaliable.");
- }
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
- if (!function_exists("imagecreatefrompng") || !function_exists("imagepng")) {
- die("skip png support unavailable");
- }
- if (!function_exists("imagecreatefromjpeg") || !function_exists("imagejpeg")) {
- die("skip jpeg support unavailable");
- }
-?>
---FILE--
-<?php
- $cwd = dirname(__FILE__);
-
- echo "PNG to JPEG conversion: ";
- echo imagejpeg(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_jpeg.jpeg") ? 'ok' : 'failed';
- echo "\n";
-
- echo "Generated JPEG to PNG conversion: ";
- echo imagepng(imagecreatefromjpeg($cwd . "/test_jpeg.jpeg"), $cwd . "/test_jpng.png") ? 'ok' : 'failed';
- echo "\n";
-
- echo "JPEG to PNG conversion: ";
- echo imagepng(imagecreatefromjpeg($cwd . "/conv_test.jpeg"), $cwd . "/test_png.png") ? 'ok' : 'failed';
- echo "\n";
-
- echo "Generated PNG to JPEG conversion: ";
- echo imagejpeg(imagecreatefrompng($cwd . "/test_png.png"), $cwd . "/test_pjpeg.jpeg") ? 'ok' : 'failed';
- echo "\n";
-
- @unlink($cwd . "/test_jpeg.jpeg");
- @unlink($cwd . "/test_jpng.png");
- @unlink($cwd . "/test_png.png");
- @unlink($cwd . "/test_pjpeg.jpeg");
-?>
---EXPECT--
-PNG to JPEG conversion: ok
-Generated JPEG to PNG conversion: ok
-JPEG to PNG conversion: ok
-Generated PNG to JPEG conversion: ok
diff --git a/ext/gd/tests/jpg2gd.phpt b/ext/gd/tests/jpg2gd.phpt
deleted file mode 100644
index c1da986f21..0000000000
--- a/ext/gd/tests/jpg2gd.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-jpeg <--> gd1/gd2 conversion test
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
- die("skip gd extension not avaliable.");
- }
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
- if (!function_exists("imagecreatefromjpeg") || !function_exists("imagejpeg")) {
- die("skip jpeg support unavailable");
- }
-?>
---FILE--
-<?php
- $cwd = dirname(__FILE__);
-
- echo "JPEG to GD1 conversion: ";
- echo imagegd(imagecreatefromjpeg($cwd . "/conv_test.jpeg"), $cwd . "/test.gd1") ? 'ok' : 'failed';
- echo "\n";
-
- echo "JPEG to GD2 conversion: ";
- echo imagegd2(imagecreatefromjpeg($cwd . "/conv_test.jpeg"), $cwd . "/test.gd2") ? 'ok' : 'failed';
- echo "\n";
-
- echo "GD1 to JPEG conversion: ";
- echo imagejpeg(imagecreatefromgd($cwd . "/test.gd1"), $cwd . "/test_gd1.jpeg") ? 'ok' : 'failed';
- echo "\n";
-
- echo "GD2 to JPEG conversion: ";
- echo imagejpeg(imagecreatefromgd2($cwd . "/test.gd2"), $cwd . "/test_gd2.jpeg") ? 'ok' : 'failed';
- echo "\n";
-
- @unlink($cwd . "/test.gd1");
- @unlink($cwd . "/test.gd2");
- @unlink($cwd . "/test_gd1.jpeg");
- @unlink($cwd . "/test_gd2.jpeg");
-?>
---EXPECT--
-JPEG to GD1 conversion: ok
-JPEG to GD2 conversion: ok
-GD1 to JPEG conversion: ok
-GD2 to JPEG conversion: ok
diff --git a/ext/gd/tests/png2gd.phpt b/ext/gd/tests/png2gd.phpt
deleted file mode 100644
index 9a25c5a7bc..0000000000
--- a/ext/gd/tests/png2gd.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-png <--> gd1/gd2 conversion test
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
- die("skip gd extension not avaliable.");
- }
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
- if (!function_exists("imagecreatefrompng") || !function_exists("imagepng")) {
- die("skip png support unavailable");
- }
-?>
---FILE--
-<?php
- $cwd = dirname(__FILE__);
-
- echo "PNG to GD1 conversion: ";
- echo imagegd(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test.gd1") ? 'ok' : 'failed';
- echo "\n";
-
- echo "PNG to GD2 conversion: ";
- echo imagegd2(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test.gd2") ? 'ok' : 'failed';
- echo "\n";
-
- echo "GD1 to PNG conversion: ";
- echo imagepng(imagecreatefromgd($cwd . "/test.gd1"), $cwd . "/test_gd1.png") ? 'ok' : 'failed';
- echo "\n";
-
- echo "GD2 to PNG conversion: ";
- echo imagepng(imagecreatefromgd2($cwd . "/test.gd2"), $cwd . "/test_gd2.png") ? 'ok' : 'failed';
- echo "\n";
-
- @unlink($cwd . "/test.gd1");
- @unlink($cwd . "/test.gd2");
- @unlink($cwd . "/test_gd1.png");
- @unlink($cwd . "/test_gd2.png");
-?>
---EXPECT--
-PNG to GD1 conversion: ok
-PNG to GD2 conversion: ok
-GD1 to PNG conversion: ok
-GD2 to PNG conversion: ok
diff --git a/ext/gd/tests/test.png b/ext/gd/tests/test.png
deleted file mode 100644
index 27c5d46444..0000000000
--- a/ext/gd/tests/test.png
+++ /dev/null
Binary files differ
diff --git a/ext/gd/tests/test8859.ttf b/ext/gd/tests/test8859.ttf
deleted file mode 100644
index dff237cd29..0000000000
--- a/ext/gd/tests/test8859.ttf
+++ /dev/null
Binary files differ
diff --git a/ext/gd/tests/xbm2png.phpt b/ext/gd/tests/xbm2png.phpt
deleted file mode 100644
index 5c51226093..0000000000
--- a/ext/gd/tests/xbm2png.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-xbm --> png conversion test
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
- die("skip gd extension not avaliable.");
- }
- if (!function_exists("imagepng")) {
- die("skip png support unavailable");
- }
- if (!function_exists("imagecreatefromxbm")) {
- die("skip xbm read support unavailable");
- }
-?>
---FILE--
-<?php
- $cwd = dirname(__FILE__);
-
- echo "XBM to PNG conversion: ";
- echo imagepng(imagecreatefromxbm($cwd . "/conv_test.xbm"), $cwd . "/test_xbm.png") ? 'ok' : 'failed';
- echo "\n";
-
- @unlink($cwd . "/test_xbm.png");
-?>
---EXPECT--
-XBM to PNG conversion: ok
diff --git a/ext/gd/tests/xpm2gd.phpt b/ext/gd/tests/xpm2gd.phpt
deleted file mode 100644
index 617d634e6a..0000000000
--- a/ext/gd/tests/xpm2gd.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-xpm --> gd1/gd2 conversion test
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
- die("skip gd extension not avaliable.");
- }
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
- if (!function_exists("imagecreatefromxpm")) {
- die("skip xpm read support unavailable");
- }
-?>
---FILE--
-<?php
- $cwd = dirname(__FILE__);
-
- echo "XPM to GD1 conversion: ";
- echo imagegd(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test.gd1") ? 'ok' : 'failed';
- echo "\n";
-
- echo "XPM to GD2 conversion: ";
- echo imagegd2(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test.gd2") ? 'ok' : 'failed';
- echo "\n";
-
- @unlink($cwd . "/test.gd1");
- @unlink($cwd . "/test.gd2");
-?>
---EXPECT--
-XPM to GD1 conversion: ok
-XPM to GD2 conversion: ok
diff --git a/ext/gd/tests/xpm2jpg.phpt b/ext/gd/tests/xpm2jpg.phpt
deleted file mode 100644
index 462d42680a..0000000000
--- a/ext/gd/tests/xpm2jpg.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-xpm --> jpeg conversion test
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
- die("skip gd extension not avaliable.");
- }
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
- if (!function_exists("imagejpeg")) {
- die("skip jpeg support unavailable");
- }
- if (!function_exists("imagecreatefromxpm")) {
- die("skip xpm read support unavailable");
- }
-?>
---FILE--
-<?php
- $cwd = dirname(__FILE__);
-
- echo "XPM to JPEG conversion: ";
- echo imagejpeg(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.jpeg") ? 'ok' : 'failed';
- echo "\n";
-
- @unlink($cwd . "/test_xpm.jpeg");
-?>
---EXPECT--
-XPM to JPEG conversion: ok
diff --git a/ext/gd/tests/xpm2png.phpt b/ext/gd/tests/xpm2png.phpt
deleted file mode 100644
index ff8d403333..0000000000
--- a/ext/gd/tests/xpm2png.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-xpm --> png conversion test
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
- die("skip gd extension not avaliable.");
- }
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
- if (!function_exists("imagepng")) {
- die("skip png support unavailable");
- }
- if (!function_exists("imagecreatefromxpm")) {
- die("skip xpm read support unavailable");
- }
-?>
---FILE--
-<?php
- $cwd = dirname(__FILE__);
-
- echo "XPM to PNG conversion: ";
- echo imagepng(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.png") ? 'ok' : 'failed';
- echo "\n";
-
- @unlink($cwd . "/test_xpm.png");
-?>
---EXPECT--
-XPM to PNG conversion: ok
diff --git a/ext/gettext/CREDITS b/ext/gettext/CREDITS
deleted file mode 100644
index acaebd7fae..0000000000
--- a/ext/gettext/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-GetText
-Alex Plotnick
diff --git a/ext/gettext/config.m4 b/ext/gettext/config.m4
deleted file mode 100644
index f4a6fc34e9..0000000000
--- a/ext/gettext/config.m4
+++ /dev/null
@@ -1,52 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(gettext,for GNU gettext support,
-[ --with-gettext[=DIR] Include GNU gettext support.])
-
-if test "$PHP_GETTEXT" != "no"; then
- for i in /usr /usr/local $PHP_GETTEXT; do
- if test -r $i/include/libintl.h; then
- GETTEXT_DIR=$i
- fi
- done
-
- if test -z "$GETTEXT_DIR"; then
- AC_MSG_ERROR(Cannot locate header file libintl.h)
- fi
-
- GETTEXT_LIBDIR=$GETTEXT_DIR/lib
- GETTEXT_INCDIR=$GETTEXT_DIR/include
-
- O_LDFLAGS=$LDFLAGS
- LDFLAGS="$LDFLAGS -L$GETTEXT_LIBDIR"
- AC_CHECK_LIB(intl, bindtextdomain, [
- GETTEXT_LIBS=intl
- GETTEXT_CHECK_IN_LIB=intl
- ],
- AC_CHECK_LIB(c, bindtextdomain, [
- GETTEXT_LIBS=
- GETTEXT_CHECK_IN_LIB=c
- ],[
- AC_MSG_ERROR(Unable to find required gettext library)
- ])
- )
- LDFLAGS=$O_LDFLAGS
-
- AC_DEFINE(HAVE_LIBINTL,1,[ ])
- PHP_NEW_EXTENSION(gettext, gettext.c, $ext_shared)
- PHP_SUBST(GETTEXT_SHARED_LIBADD)
-
- if test -n "$GETTEXT_LIBS"; then
- PHP_ADD_LIBRARY_WITH_PATH($GETTEXT_LIBS, $GETTEXT_LIBDIR, GETTEXT_SHARED_LIBADD)
- fi
-
- PHP_ADD_INCLUDE($GETTEXT_INCDIR)
-
- AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, ngettext, [AC_DEFINE(HAVE_NGETTEXT, 1, [ ])])
- AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, dngettext, [AC_DEFINE(HAVE_DNGETTEXT, 1, [ ])])
- AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, dcngettext, [AC_DEFINE(HAVE_DCNGETTEXT, 1, [ ])])
- AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, bind_textdomain_codeset, [AC_DEFINE(HAVE_BIND_TEXTDOMAIN_CODESET, 1, [ ])])
-
-fi
diff --git a/ext/gettext/gettext.c b/ext/gettext/gettext.c
deleted file mode 100644
index 4b41a57d4b..0000000000
--- a/ext/gettext/gettext.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Alex Plotnick <alex@wgate.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdio.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_gettext.h"
-
-#if HAVE_LIBINTL
-
-#include <libintl.h>
-#include "ext/standard/info.h"
-
-/* {{{ php_gettext_functions[]
- */
-function_entry php_gettext_functions[] = {
- PHP_FE(textdomain, NULL)
- PHP_FE(gettext, NULL)
- PHP_FALIAS(_, gettext, NULL)
- PHP_FE(dgettext, NULL)
- PHP_FE(dcgettext, NULL)
- PHP_FE(bindtextdomain, NULL)
-#if HAVE_NGETTEXT
- PHP_FE(ngettext, NULL)
-#endif
-#if HAVE_DNGETTEXT
- PHP_FE(dngettext, NULL)
-#endif
-#if HAVE_DCNGETTEXT
- PHP_FE(dcngettext, NULL)
-#endif
-#if HAVE_BIND_TEXTDOMAIN_CODESET
- PHP_FE(bind_textdomain_codeset, NULL)
-#endif
-
-
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry php_gettext_module_entry = {
- STANDARD_MODULE_HEADER,
- "gettext",
- php_gettext_functions,
- NULL,
- NULL,
- NULL,
- NULL,
- PHP_MINFO(gettext),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_GETTEXT
-ZEND_GET_MODULE(php_gettext)
-#endif
-
-PHP_MINFO_FUNCTION(gettext)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "GetText Support", "enabled");
- php_info_print_table_end();
-}
-
-/* {{{ proto string textdomain(string domain)
- Set the textdomain to "domain". Returns the current domain */
-PHP_FUNCTION(textdomain)
-{
- zval **domain;
- char *domain_name, *retval;
- char *val;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &domain) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(domain);
-
- val = Z_STRVAL_PP(domain);
- if (strcmp(val, "") && strcmp(val, "0")) {
- domain_name = val;
- } else {
- domain_name = NULL;
- }
-
- retval = textdomain(domain_name);
-
- RETURN_STRING(retval, 1);
-}
-/* }}} */
-
-/* {{{ proto string gettext(string msgid)
- Return the translation of msgid for the current domain, or msgid unaltered if a translation does not exist */
-PHP_FUNCTION(gettext)
-{
- zval **msgid;
- char *msgstr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &msgid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(msgid);
-
- msgstr = gettext(Z_STRVAL_PP(msgid));
-
- RETURN_STRING(msgstr, 1);
-}
-/* }}} */
-
-/* {{{ proto string dgettext(string domain_name, string msgid)
- Return the translation of msgid for domain_name, or msgid unaltered if a translation does not exist */
-PHP_FUNCTION(dgettext)
-{
- zval **domain_name, **msgid;
- char *msgstr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &domain_name, &msgid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(domain_name);
- convert_to_string_ex(msgid);
-
- msgstr = dgettext(Z_STRVAL_PP(domain_name), Z_STRVAL_PP(msgid));
-
- RETURN_STRING(msgstr, 1);
-}
-/* }}} */
-
-/* {{{ proto string dcgettext(string domain_name, string msgid, long category)
- Return the translation of msgid for domain_name and category, or msgid unaltered if a translation does not exist */
-PHP_FUNCTION(dcgettext)
-{
- zval **domain_name, **msgid, **category;
- char *msgstr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &domain_name, &msgid, &category) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(domain_name);
- convert_to_string_ex(msgid);
- convert_to_long_ex(category);
-
- msgstr = dcgettext(Z_STRVAL_PP(domain_name), Z_STRVAL_PP(msgid), Z_LVAL_PP(category));
-
- RETURN_STRING(msgstr, 1);
-}
-/* }}} */
-
-/* {{{ proto string bindtextdomain(string domain_name, string dir)
- Bind to the text domain domain_name, looking for translations in dir. Returns the current domain */
-PHP_FUNCTION(bindtextdomain)
-{
- zval **domain_name, **dir;
- char *retval, dir_name[MAXPATHLEN];
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &domain_name, &dir) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(domain_name);
- convert_to_string_ex(dir);
-
- if (Z_STRVAL_PP(domain_name)[0] == '\0') {
- php_error(E_WARNING, "The first parameter of bindtextdomain must not be empty");
- RETURN_FALSE;
- }
-
- if (Z_STRVAL_PP(dir)[0] != '\0' && strcmp(Z_STRVAL_PP(dir), "0")) {
- VCWD_REALPATH(Z_STRVAL_PP(dir), dir_name);
- } else {
- VCWD_GETCWD(dir_name, MAXPATHLEN);
- }
-
- retval = bindtextdomain(Z_STRVAL_PP(domain_name), dir_name);
-
- RETURN_STRING(retval, 1);
-}
-/* }}} */
-
-#if HAVE_NGETTEXT
-/* {{{ proto string ngettext(string MSGID1, string MSGID2, int N)
- Plural version of gettext() */
-PHP_FUNCTION(ngettext)
-{
- zval **msgid1, **msgid2, **count;
- char *msgstr;
-
- RETVAL_FALSE;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &msgid1, &msgid2, &count) == FAILURE) {
- WRONG_PARAM_COUNT;
- } else {
- convert_to_string_ex(msgid1);
- convert_to_string_ex(msgid2);
- convert_to_long_ex(count);
-
- msgstr = ngettext(Z_STRVAL_PP(msgid1), Z_STRVAL_PP(msgid2), Z_LVAL_PP(count));
- if (msgstr) {
- RETVAL_STRING (msgstr, 1);
- }
- }
-}
-/* }}} */
-#endif
-
-#if HAVE_DNGETTEXT
-/* {{{ proto string dngettext (string domain, string msgid1, string msgid2, int count)
- Plural version of dgettext() */
-PHP_FUNCTION(dngettext)
-{
- zval **domain, **msgid1, **msgid2, **count;
-
- RETVAL_FALSE;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &domain, &msgid1, &msgid2, &count) == FAILURE) {
- WRONG_PARAM_COUNT;
- } else {
- char *msgstr;
-
- convert_to_string_ex(domain);
- convert_to_string_ex(msgid1);
- convert_to_string_ex(msgid2);
- convert_to_long_ex(count);
-
- msgstr = dngettext(Z_STRVAL_PP(domain), Z_STRVAL_PP(msgid1), Z_STRVAL_PP(msgid2), Z_LVAL_PP(count));
- if (msgstr) {
- RETVAL_STRING(msgstr, 1);
- }
- }
-}
-/* }}} */
-#endif
-
-#if HAVE_DCNGETTEXT
-/* {{{ proto string dcngettext (string domain, string msgid1, string msgid2, int n, int category)
- Plural version of dcgettext() */
-PHP_FUNCTION(dcngettext)
-{
- zval **domain, **msgid1, **msgid2, **count, **category;
-
- RETVAL_FALSE;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(4, &domain, &msgid1, &msgid2, &count, &category) == FAILURE) {
- WRONG_PARAM_COUNT;
- } else {
- char* msgstr = NULL;
-
- convert_to_string_ex(domain);
- convert_to_string_ex(msgid1);
- convert_to_string_ex(msgid2);
- convert_to_long_ex(count);
- convert_to_long_ex(category);
-
- msgstr = dcngettext(Z_STRVAL_PP(domain), Z_STRVAL_PP(msgid1), Z_STRVAL_PP(msgid2), Z_LVAL_PP(count), Z_LVAL_PP(category));
-
- if (msgstr) {
- RETVAL_STRING(msgstr, 1);
- }
- }
-}
-/* }}} */
-#endif
-
-#if HAVE_BIND_TEXTDOMAIN_CODESET
-
-/* {{{ proto string bind_textdomain_codeset (string domain, string codeset)
- Specify the character encoding in which the messages from the DOMAIN message catalog will be returned. */
-PHP_FUNCTION(bind_textdomain_codeset)
-{
- zval **domain, **codeset;
- char *retval;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &domain, &codeset) == FAILURE) {
- WRONG_PARAM_COUNT;
- } else {
- convert_to_string_ex(domain);
- convert_to_string_ex(codeset);
-
- retval = bind_textdomain_codeset(Z_STRVAL_PP(domain), Z_STRVAL_PP(codeset));
-
- if (!retval) {
- RETURN_FALSE;
- }
- RETURN_STRING(retval, 1);
- }
-}
-/* }}} */
-#endif
-
-
-#endif /* HAVE_LIBINTL */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
-
diff --git a/ext/gettext/gettext.dsp b/ext/gettext/gettext.dsp
deleted file mode 100644
index 96017828d2..0000000000
--- a/ext/gettext/gettext.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="gettext" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=gettext - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "gettext.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "gettext.mak" CFG="gettext - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "gettext - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "gettext - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "gettext - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_GETTEXT" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GETTEXT_EXPORTS" /D "COMPILE_DL_GETTEXT" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LIBINTL=1 /D HAVE_BIND_TEXTDOMAIN_CODESET=1 /D HAVE_NGETTEXT=1 /D HAVE_DNGETTEXT=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gettext.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 php4ts.lib libintl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gettext.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "gettext - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_GETTEXT" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D HAVE_NGETTEXT=1 /D HAVE_DNGETTEXT=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GETTEXT_EXPORTS" /D "COMPILE_DL_GETTEXT" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LIBINTL=1 /D HAVE_BIND_TEXTDOMAIN_CODESET=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"../../Debug_TS/php_gettext.dll" /libpath:"..\..\Debug_TS"
-# ADD LINK32 php4ts_debug.lib libintl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"../../Debug_TS/php_gettext.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "gettext - Win32 Release_TS"
-# Name "gettext - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\gettext.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_gettext.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/gettext/php_gettext.h b/ext/gettext/php_gettext.h
deleted file mode 100644
index 54028003be..0000000000
--- a/ext/gettext/php_gettext.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Alex Plotnick <alex@wgate.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_GETTEXT_H
-#define PHP_GETTEXT_H
-
-#if HAVE_LIBINTL
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-extern zend_module_entry php_gettext_module_entry;
-#define gettext_module_ptr &php_gettext_module_entry
-
-PHP_MINFO_FUNCTION(gettext);
-
-PHP_FUNCTION(textdomain);
-PHP_FUNCTION(gettext);
-PHP_FUNCTION(dgettext);
-PHP_FUNCTION(dcgettext);
-PHP_FUNCTION(bindtextdomain);
-#if HAVE_NGETTEXT
-PHP_FUNCTION(ngettext);
-#endif
-#if HAVE_DNGETTEXT
-PHP_FUNCTION(dngettext);
-#endif
-#if HAVE_DCNGETTEXT
-PHP_FUNCTION(dcngettext);
-#endif
-#if HAVE_BIND_TEXTDOMAIN_CODESET
-PHP_FUNCTION(bind_textdomain_codeset);
-#endif
-
-#else
-#define gettext_module_ptr NULL
-#endif /* HAVE_LIBINTL */
-
-#define phpext_gettext_ptr gettext_module_ptr
-
-#endif /* PHP_GETTEXT_H */
diff --git a/ext/gmp/CREDITS b/ext/gmp/CREDITS
deleted file mode 100644
index 7e0346dc24..0000000000
--- a/ext/gmp/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-GNU GMP support
-Stanislav Malyshev
diff --git a/ext/gmp/README b/ext/gmp/README
deleted file mode 100644
index e142e2e031..0000000000
--- a/ext/gmp/README
+++ /dev/null
@@ -1,5 +0,0 @@
-Arbitrary length number support with GNU MP library.
-Please see the PGP manual for more documentation.
-See also GNU MP home page at http://www.swox.com/gmp/.
-GNU MP library is available under the tems of GNU LGPL
-license. Please see http://www.swox.com/gmp/lgpl.html
diff --git a/ext/gmp/TODO b/ext/gmp/TODO
deleted file mode 100644
index 81098a9cc1..0000000000
--- a/ext/gmp/TODO
+++ /dev/null
@@ -1,22 +0,0 @@
-mpz_mul_2exp
-mpz_[ft]div_[qr]_2exp
-
-V 3:
-mpz_nextprime
-mpz_addmul
-mpz_root
-mpz_perfect_power_p
-mpz_lcm
-mpz_si_kronecker
-mpz_kronecker_si
-mpz_remove
-mpz_bin_ui
-mpz_fib_ui
-mpz_cmpabs
-mpz_xor
-mpz_tstbit
-mpz_urandom[bm]
-mpz_fits_slong_p
-mpz_mul_si
-mpz_odd_p
-mpz_even_p
diff --git a/ext/gmp/config.m4 b/ext/gmp/config.m4
deleted file mode 100644
index f996ae978f..0000000000
--- a/ext/gmp/config.m4
+++ /dev/null
@@ -1,25 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(gmp, for GNU MP support,
-[ --with-gmp Include GNU MP support])
-
-if test "$PHP_GMP" != "no"; then
-
- for i in /usr/local /usr $PHP_GMP; do
- if test -f $i/include/gmp.h; then
- GMP_DIR=$i
- fi
- done
-
- if test -z "$GMP_DIR"; then
- AC_MSG_ERROR(Unable to locate gmp.h)
- fi
- PHP_ADD_INCLUDE($GMP_DIR/include)
-
- PHP_NEW_EXTENSION(gmp, gmp.c, $ext_shared)
- AC_DEFINE(HAVE_GMP, 1, [ ])
- PHP_SUBST(GMP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(gmp, $GMP_DIR/lib, GMP_SHARED_LIBADD)
-fi
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
deleted file mode 100644
index 21b3380775..0000000000
--- a/ext/gmp/gmp.c
+++ /dev/null
@@ -1,1253 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stanislav Malyshev <stas@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_gmp.h"
-#include "ext/standard/info.h"
-
-#if HAVE_GMP
-
-#include <gmp.h>
-/* If you declare any globals in php_gmp.h uncomment this:
-ZEND_DECLARE_MODULE_GLOBALS(gmp)
-*/
-
-/* True global resources - no need for thread safety here */
-static int le_gmp;
-
-static unsigned char first_of_two_force_ref[] = { 2, BYREF_FORCE, BYREF_NONE };
-
-/* {{{ gmp_functions[]
- */
-function_entry gmp_functions[] = {
- ZEND_FE(gmp_init, NULL)
- ZEND_FE(gmp_intval, NULL)
- ZEND_FE(gmp_strval, NULL)
- ZEND_FE(gmp_add, NULL)
- ZEND_FE(gmp_sub, NULL)
- ZEND_FE(gmp_mul, NULL)
- ZEND_FE(gmp_div_qr, NULL)
- ZEND_FE(gmp_div_q, NULL)
- ZEND_FE(gmp_div_r, NULL)
- ZEND_FALIAS(gmp_div, gmp_div_q, NULL)
- ZEND_FE(gmp_mod, NULL)
- ZEND_FE(gmp_divexact, NULL)
- ZEND_FE(gmp_neg, NULL)
- ZEND_FE(gmp_abs, NULL)
- ZEND_FE(gmp_fact, NULL)
- ZEND_FE(gmp_sqrt, NULL)
- ZEND_FE(gmp_sqrtrem, NULL)
- ZEND_FE(gmp_pow, NULL)
- ZEND_FE(gmp_powm, NULL)
- ZEND_FE(gmp_perfect_square, NULL)
- ZEND_FE(gmp_prob_prime, NULL)
- ZEND_FE(gmp_gcd, NULL)
- ZEND_FE(gmp_gcdext, NULL)
- ZEND_FE(gmp_invert, NULL)
- ZEND_FE(gmp_jacobi, NULL)
- ZEND_FE(gmp_legendre, NULL)
- ZEND_FE(gmp_cmp, NULL)
- ZEND_FE(gmp_sign, NULL)
- ZEND_FE(gmp_random, NULL)
- ZEND_FE(gmp_and, NULL)
- ZEND_FE(gmp_or, NULL)
- ZEND_FE(gmp_com, NULL)
- ZEND_FE(gmp_xor, NULL)
- ZEND_FE(gmp_setbit, first_of_two_force_ref)
- ZEND_FE(gmp_clrbit, first_of_two_force_ref)
- ZEND_FE(gmp_scan0, NULL)
- ZEND_FE(gmp_scan1, NULL)
- ZEND_FE(gmp_popcount, NULL)
- ZEND_FE(gmp_hamdist, NULL)
- {NULL, NULL, NULL} /* Must be the last line in gmp_functions[] */
-};
-/* }}} */
-
-/* {{{ gmp_module_entry
- */
-zend_module_entry gmp_module_entry = {
- STANDARD_MODULE_HEADER,
- "gmp",
- gmp_functions,
- ZEND_MODULE_STARTUP_N(gmp),
- ZEND_MODULE_SHUTDOWN_N(gmp),
- NULL,
- NULL,
- ZEND_MODULE_INFO_N(gmp),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_GMP
-ZEND_GET_MODULE(gmp)
-#endif
-
-static void _php_gmpnum_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-
-#define GMP_RESOURCE_NAME "GMP integer"
-
-#define GMP_ROUND_ZERO 0
-#define GMP_ROUND_PLUSINF 1
-#define GMP_ROUND_MINUSINF 2
-
-/* {{{ gmp_emalloc
- */
-static void *gmp_emalloc(size_t size)
-{
- return emalloc(size);
-}
-/* }}} */
-
-/* {{{ gmp_erealloc
- */
-static void *gmp_erealloc(void *ptr, size_t old_size, size_t new_size)
-{
- return erealloc(ptr, new_size);
-}
-/* }}} */
-
-/* {{{ gmp_efree
- */
-static void gmp_efree(void *ptr, size_t size)
-{
- efree(ptr);
-}
-/* }}} */
-
-/* {{{ ZEND_MINIT_FUNCTION
- */
-ZEND_MODULE_STARTUP_D(gmp)
-{
- le_gmp = zend_register_list_destructors_ex(_php_gmpnum_free, NULL, GMP_RESOURCE_NAME, module_number);
- REGISTER_LONG_CONSTANT("GMP_ROUND_ZERO", GMP_ROUND_ZERO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("GMP_ROUND_PLUSINF", GMP_ROUND_PLUSINF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("GMP_ROUND_MINUSINF", GMP_ROUND_MINUSINF, CONST_CS | CONST_PERSISTENT);
-
- mp_set_memory_functions(gmp_emalloc, gmp_erealloc, gmp_efree);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ ZEND_MSHUTDOWN_FUNCTION
- */
-ZEND_MODULE_SHUTDOWN_D(gmp)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ ZEND_MINFO_FUNCTION
- */
-ZEND_MODULE_INFO_D(gmp)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "gmp support", "enabled");
- php_info_print_table_end();
-
- /* Remove comments if you have entries in php.ini
- DISPLAY_INI_ENTRIES();
- */
-}
-/* }}} */
-
-/* Fetch zval to be GMP number.
- Initially, zval can be also number or string */
-#define FETCH_GMP_ZVAL(gmpnumber, zval) \
-if(Z_TYPE_PP(zval) == IS_RESOURCE) { \
- ZEND_FETCH_RESOURCE(gmpnumber, mpz_t *, zval, -1, GMP_RESOURCE_NAME, le_gmp);\
-} else {\
- if(convert_to_gmp(&gmpnumber, zval, 0 TSRMLS_CC) == FAILURE) {\
- RETURN_FALSE;\
- }\
- ZEND_REGISTER_RESOURCE(NULL, gmpnumber, le_gmp);\
-}
-
-/* create a new initialized GMP number */
-#define INIT_GMP_NUM(gmpnumber) { gmpnumber=emalloc(sizeof(mpz_t)); mpz_init(*gmpnumber); }
-#define FREE_GMP_NUM(gmpnumber) { mpz_clear(*gmpnumber); efree(gmpnumber); }
-
-/* {{{ convert_to_gmp
- * Convert zval to be gmp number */
-static int convert_to_gmp(mpz_t * *gmpnumber, zval **val, int base TSRMLS_DC)
-{
- int ret = 0;
- int skip_lead = 0;
-
- *gmpnumber = emalloc(sizeof(mpz_t));
- switch(Z_TYPE_PP(val)) {
- case IS_LONG:
- case IS_BOOL:
- case IS_CONSTANT:
- {
- convert_to_long_ex(val);
- mpz_init_set_si(**gmpnumber, Z_LVAL_PP(val));
- }
- break;
- case IS_STRING:
- {
- char *numstr = Z_STRVAL_PP(val);
-
- if (Z_STRLEN_PP(val) > 2) {
- if (numstr[0] == '0') {
- if (numstr[1] == 'x' || numstr[1] == 'X') {
- base = 16;
- skip_lead = 1;
- } else if (base != 16 && (numstr[1] == 'b' || numstr[1] == 'B')) {
- base = 2;
- skip_lead = 1;
- }
- }
- }
- ret = mpz_init_set_str(**gmpnumber, (skip_lead ? &numstr[2] : numstr), base);
- }
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unable to convert variable to GMP - wrong type");
- efree(*gmpnumber);
- return FAILURE;
- }
-
- if (ret) {
- FREE_GMP_NUM(*gmpnumber);
- return FAILURE;
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ typedefs
- */
-typedef void (*gmp_unary_op_t)(mpz_ptr, mpz_srcptr);
-typedef int (*gmp_unary_opl_t)(mpz_srcptr);
-
-typedef void (*gmp_unary_ui_op_t)(mpz_ptr, unsigned long);
-
-typedef void (*gmp_binary_op_t)(mpz_ptr, mpz_srcptr, mpz_srcptr);
-typedef int (*gmp_binary_opl_t)(mpz_srcptr, mpz_srcptr);
-
-typedef unsigned long (*gmp_binary_ui_op_t)(mpz_ptr, mpz_srcptr, unsigned long);
-typedef void (*gmp_binary_op2_t)(mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
-typedef unsigned long (*gmp_binary_ui_op2_t)(mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long);
-/* }}} */
-
-#define gmp_zval_binary_ui_op(r, a, b, o, u) gmp_zval_binary_ui_op_ex(r, a, b, o, u, 0 TSRMLS_CC)
-#define gmp_zval_binary_ui_op2(r, a, b, o, u) gmp_zval_binary_ui_op2_ex(r, a, b, o, u, 0 TSRMLS_CC)
-
-#define gmp_binary_ui_op(op, uop) _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAM_PASSTHRU, op, uop)
-#define gmp_binary_op(op) _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAM_PASSTHRU, op, NULL)
-#define gmp_binary_opl(op) _gmp_binary_opl(INTERNAL_FUNCTION_PARAM_PASSTHRU, op)
-
-/* Unary operations */
-#define gmp_unary_op(op) _gmp_unary_op(INTERNAL_FUNCTION_PARAM_PASSTHRU, op)
-#define gmp_unary_opl(op) _gmp_unary_opl(INTERNAL_FUNCTION_PARAM_PASSTHRU, op)
-#define gmp_unary_ui_op(op) _gmp_unary_ui_op(INTERNAL_FUNCTION_PARAM_PASSTHRU, op)
-
-/* {{{ gmp_zval_binary_ui_op_ex
- Execute GMP binary operation.
- May return GMP resource or long if operation allows this
-*/
-static inline void gmp_zval_binary_ui_op_ex(zval *return_value, zval **a_arg, zval **b_arg, gmp_binary_op_t gmp_op, gmp_binary_ui_op_t gmp_ui_op, int allow_ui_return TSRMLS_DC)
-{
- mpz_t *gmpnum_a, *gmpnum_b, *gmpnum_result;
- unsigned long long_result=0;
- int use_ui=0;
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- if(gmp_ui_op && Z_TYPE_PP(b_arg) == IS_LONG && Z_LVAL_PP(b_arg) >= 0) {
- use_ui=1;
- } else {
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
- }
-
- INIT_GMP_NUM(gmpnum_result);
- if(use_ui && gmp_ui_op) {
- if(allow_ui_return) {
- long_result = gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned long)Z_LVAL_PP(b_arg));
- } else {
- gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned long)Z_LVAL_PP(b_arg));
- }
- } else {
- gmp_op(*gmpnum_result, *gmpnum_a, *gmpnum_b);
- }
-
- if(use_ui && allow_ui_return) {
- FREE_GMP_NUM(gmpnum_result);
- RETURN_LONG((long)long_result);
- } else {
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
- }
-}
-/* }}} */
-
-/* {{{ gmp_zval_binary_ui_op2_ex
- Execute GMP binary operation which returns 2 values.
- May return GMP resources or longs if operation allows this.
-*/
-static inline void gmp_zval_binary_ui_op2_ex(zval *return_value, zval **a_arg, zval **b_arg, gmp_binary_op2_t gmp_op, gmp_binary_ui_op2_t gmp_ui_op, int allow_ui_return TSRMLS_DC)
-{
- mpz_t *gmpnum_a, *gmpnum_b, *gmpnum_result1, *gmpnum_result2;
- zval r;
- int use_ui=0;
- unsigned long long_result;
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- if(gmp_ui_op && Z_TYPE_PP(b_arg) == IS_LONG && Z_LVAL_PP(b_arg) >= 0) {
- /* use _ui function */
- use_ui=1;
- } else {
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
- }
-
- INIT_GMP_NUM(gmpnum_result1);
- INIT_GMP_NUM(gmpnum_result2);
-
- if(use_ui && gmp_ui_op) {
- if(allow_ui_return) {
- long_result = gmp_ui_op(*gmpnum_result1, *gmpnum_result2, *gmpnum_a, (unsigned long)Z_LVAL_PP(b_arg));
- } else {
- gmp_ui_op(*gmpnum_result1, *gmpnum_result2, *gmpnum_a, (unsigned long)Z_LVAL_PP(b_arg));
- }
- } else {
- gmp_op(*gmpnum_result1, *gmpnum_result2, *gmpnum_a, *gmpnum_b);
- }
-
- array_init(return_value);
- ZEND_REGISTER_RESOURCE(&r, gmpnum_result1, le_gmp);
- add_index_resource(return_value, 0, Z_LVAL(r));
- if(use_ui && allow_ui_return) {
- mpz_clear(*gmpnum_result2);
- add_index_long(return_value, 1, long_result);
- } else {
- ZEND_REGISTER_RESOURCE(&r, gmpnum_result2, le_gmp);
- add_index_resource(return_value, 1, Z_LVAL(r));
- }
-}
-/* }}} */
-
-/* {{{ _gmp_binary_ui_op
- */
-static inline void _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_op_t gmp_op, gmp_binary_ui_op_t gmp_ui_op) {
- zval **a_arg, **b_arg;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- gmp_zval_binary_ui_op(return_value, a_arg, b_arg, gmp_op, gmp_ui_op);
-}
-/* }}} */
-
-/* Unary operations */
-
-/* {{{ gmp_zval_unary_op
- */
-static inline void gmp_zval_unary_op(zval *return_value, zval **a_arg, gmp_unary_op_t gmp_op TSRMLS_DC)
-{
- mpz_t *gmpnum_a, *gmpnum_result;
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
-
- INIT_GMP_NUM(gmpnum_result);
- gmp_op(*gmpnum_result, *gmpnum_a);
-
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
-}
-/* }}} */
-
-/* {{{ gmp_zval_unary_ui_op
- */
-static inline void gmp_zval_unary_ui_op(zval *return_value, zval **a_arg, gmp_unary_ui_op_t gmp_op) {
- mpz_t *gmpnum_result;
-
- convert_to_long_ex(a_arg);
-
- INIT_GMP_NUM(gmpnum_result);
- gmp_op(*gmpnum_result, Z_LVAL_PP(a_arg));
-
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
-}
-/* }}} */
-
-/* {{{ _gmp_unary_ui_op
- Execute GMP unary operation.
-*/
-static inline void _gmp_unary_ui_op(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_ui_op_t gmp_op) {
- zval **a_arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- gmp_zval_unary_ui_op(return_value, a_arg, gmp_op);
-}
-/* }}} */
-
-/* {{{ _gmp_unary_op
- */
-static inline void _gmp_unary_op(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_op_t gmp_op) {
- zval **a_arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- gmp_zval_unary_op(return_value, a_arg, gmp_op TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ _gmp_unary_opl
- */
-static inline void _gmp_unary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_opl_t gmp_op) {
- zval **a_arg;
- mpz_t *gmpnum_a;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
-
- RETURN_LONG(gmp_op(*gmpnum_a));
-}
-/* }}} */
-
-/* {{{ _gmp_binary_opl
- */
-static inline void _gmp_binary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_opl_t gmp_op) {
- zval **a_arg, **b_arg;
- mpz_t *gmpnum_a, *gmpnum_b;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- FETCH_GMP_ZVAL(gmpnum_b, a_arg);
-
- RETURN_LONG(gmp_op(*gmpnum_a, *gmpnum_b));
-}
-/* }}} */
-
-/* {{{ proto resource gmp_init(mixed number [, int base])
- Initializes GMP number */
-ZEND_FUNCTION(gmp_init)
-{
- zval **number_arg, **base_arg;
- mpz_t * gmpnumber;
- int argc;
- int base=0;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &number_arg, &base_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if (argc==2) {
- convert_to_long_ex(base_arg);
- base = Z_LVAL_PP(base_arg);
- if(base < 2 || base > 36) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad base for conversion: %d (should be between 2 and 36)", base);
- RETURN_FALSE;
- }
- }
-
- if(convert_to_gmp(&gmpnumber, number_arg, base TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
-
- /* Write your own code here to handle argument number. */
- ZEND_REGISTER_RESOURCE(return_value, gmpnumber, le_gmp);
-}
-/* }}} */
-
-/* {{{ proto int gmp_intval(resource gmpnumber)
- Gets signed long value of GMP number */
-ZEND_FUNCTION(gmp_intval)
-{
- zval **gmpnumber_arg;
- mpz_t * gmpnum;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &gmpnumber_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(Z_TYPE_PP(gmpnumber_arg) == IS_RESOURCE) {
- ZEND_FETCH_RESOURCE(gmpnum, mpz_t *, gmpnumber_arg, -1, GMP_RESOURCE_NAME, le_gmp);
- RETVAL_LONG(mpz_get_si(*gmpnum));
- } else {
- convert_to_long_ex(gmpnumber_arg);
- RETVAL_LONG(Z_LVAL_PP(gmpnumber_arg));
- }
-}
-/* }}} */
-
-/* {{{ proto string gmp_strval(resource gmpnumber [, int base])
- Gets string representation of GMP number */
-ZEND_FUNCTION(gmp_strval)
-{
- zval **gmpnumber_arg, **base_arg;
- int base=10, num_len, argc;
- mpz_t * gmpnum;
- char *out_string;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &gmpnumber_arg, &base_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum, gmpnumber_arg);
-
- switch (argc) {
- case 2:
- convert_to_long_ex(base_arg);
- base = Z_LVAL_PP(base_arg);
- break;
- case 1:
- base = 10;
- break;
- }
-
- if(base < 2 || base > 36) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad base for conversion: %d", base);
- RETURN_FALSE;
- }
-
- num_len = mpz_sizeinbase(*gmpnum, base);
- out_string = emalloc(num_len+2);
- if(mpz_sgn(*gmpnum) < 0) {
- num_len++;
- }
- mpz_get_str(out_string, base, *gmpnum);
-
- /*
- From GMP documentation for mpz_sizeinbase():
- The returned value will be exact or 1 too big. If base is a power of
- 2, the returned value will always be exact.
-
- So let's check to see if we already have a \0 byte...
- */
-
- if (out_string[num_len-1] == '\0')
- num_len--;
- else
- out_string[num_len] = '\0';
-
- RETVAL_STRINGL(out_string, num_len, 0);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_add(resource a, resource b)
- Add a and b */
-ZEND_FUNCTION(gmp_add)
-{
- gmp_binary_ui_op(mpz_add, (gmp_binary_ui_op_t)mpz_add_ui);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_sub(resource a, resource b)
- Subtract b from a */
-ZEND_FUNCTION(gmp_sub)
-{
- gmp_binary_ui_op(mpz_sub, (gmp_binary_ui_op_t)mpz_sub_ui);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_mul(resource a, resource b)
- Multiply a and b */
-ZEND_FUNCTION(gmp_mul)
-{
- gmp_binary_ui_op(mpz_mul, (gmp_binary_ui_op_t)mpz_mul_ui);
-}
-/* }}} */
-
-/* {{{ proto array gmp_div_qr(resource a, resource b [, int round])
- Divide a by b, returns quotient and reminder */
-ZEND_FUNCTION(gmp_div_qr)
-{
- zval **a_arg, **b_arg, **round_arg;
- int round=GMP_ROUND_ZERO, argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &a_arg, &b_arg, &round_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- switch (argc) {
- case 3:
- convert_to_long_ex(round_arg);
- round = Z_LVAL_PP(round_arg);
- break;
- case 2:
- round = GMP_ROUND_ZERO;
- break;
- }
-
- switch(round) {
- case GMP_ROUND_ZERO:
- gmp_zval_binary_ui_op2(return_value, a_arg, b_arg, mpz_tdiv_qr, (gmp_binary_ui_op2_t)mpz_tdiv_qr_ui);
- break;
- case GMP_ROUND_PLUSINF:
- gmp_zval_binary_ui_op2(return_value, a_arg, b_arg, mpz_cdiv_qr, (gmp_binary_ui_op2_t)mpz_cdiv_qr_ui);
- break;
- case GMP_ROUND_MINUSINF:
- gmp_zval_binary_ui_op2(return_value, a_arg, b_arg, mpz_fdiv_qr, (gmp_binary_ui_op2_t)mpz_fdiv_qr_ui);
- break;
- }
-
-}
-/* }}} */
-
-/* {{{ proto resource gmp_div_r(resource a, resource b [, int round])
- Divide a by b, returns reminder only */
-ZEND_FUNCTION(gmp_div_r)
-{
- zval **a_arg, **b_arg, **round_arg;
- int round=GMP_ROUND_ZERO, argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &a_arg, &b_arg, &round_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- switch (argc) {
- case 3:
- convert_to_long_ex(round_arg);
- round = Z_LVAL_PP(round_arg);
- break;
- case 2:
- round = GMP_ROUND_ZERO;
- break;
- }
-
- switch(round) {
- case GMP_ROUND_ZERO:
- gmp_zval_binary_ui_op_ex(return_value, a_arg, b_arg, mpz_tdiv_r, (gmp_binary_ui_op_t)mpz_tdiv_r_ui, 1 TSRMLS_CC);
- break;
- case GMP_ROUND_PLUSINF:
- gmp_zval_binary_ui_op_ex(return_value, a_arg, b_arg, mpz_cdiv_r, (gmp_binary_ui_op_t)mpz_cdiv_r_ui, 1 TSRMLS_CC);
- break;
- case GMP_ROUND_MINUSINF:
- gmp_zval_binary_ui_op_ex(return_value, a_arg, b_arg, mpz_fdiv_r, (gmp_binary_ui_op_t)mpz_fdiv_r_ui, 1 TSRMLS_CC);
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto resource gmp_div_q(resource a, resource b [, int round])
- Divide a by b, returns quotient only */
-ZEND_FUNCTION(gmp_div_q)
-{
- zval **a_arg, **b_arg, **round_arg;
- int round=GMP_ROUND_ZERO, argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &a_arg, &b_arg, &round_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- switch (argc) {
- case 3:
- convert_to_long_ex(round_arg);
- round = Z_LVAL_PP(round_arg);
- break;
- case 2:
- round = GMP_ROUND_ZERO;
- break;
- }
-
- switch(round) {
- case GMP_ROUND_ZERO:
- gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_tdiv_q, (gmp_binary_ui_op_t)mpz_tdiv_q_ui);
- break;
- case GMP_ROUND_PLUSINF:
- gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_cdiv_q, (gmp_binary_ui_op_t)mpz_cdiv_q_ui);
- break;
- case GMP_ROUND_MINUSINF:
- gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_fdiv_q, (gmp_binary_ui_op_t)mpz_fdiv_q_ui);
- break;
- }
-
-}
-/* }}} */
-
-/* {{{ proto resource gmp_mod(resource a, resource b)
- Computes a modulo b */
-ZEND_FUNCTION(gmp_mod)
-{
- zval **a_arg, **b_arg;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- gmp_zval_binary_ui_op_ex(return_value, a_arg, b_arg, mpz_mod, (gmp_binary_ui_op_t)mpz_mod_ui, 1 TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_divexact(resource a, resource b)
- Divide a by b using exact division algorithm */
-ZEND_FUNCTION(gmp_divexact)
-{
- gmp_binary_op(mpz_divexact);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_neg(resource a)
- Negates a number */
-ZEND_FUNCTION(gmp_neg)
-{
- gmp_unary_op(mpz_neg);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_abs(resource a)
- Calculates absolute value */
-ZEND_FUNCTION(gmp_abs)
-{
- gmp_unary_op(mpz_abs);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_fact(int a)
- Calculates factorial function */
-ZEND_FUNCTION(gmp_fact)
-{
- gmp_unary_ui_op(mpz_fac_ui);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_pow(resource base, int exp)
- Raise base to power exp */
-ZEND_FUNCTION(gmp_pow)
-{
- zval **base_arg, **exp_arg;
- mpz_t *gmpnum_result, *gmpnum_base;
- int use_ui=0;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &base_arg, &exp_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(Z_TYPE_PP(base_arg) == IS_LONG && Z_LVAL_PP(base_arg) >= 0) {
- use_ui=1;
- } else {
- FETCH_GMP_ZVAL(gmpnum_base, base_arg);
- }
-
- convert_to_long_ex(exp_arg);
-
- if(Z_LVAL_PP(exp_arg) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Negative exponent not supported");
- RETURN_FALSE;
- }
-
- INIT_GMP_NUM(gmpnum_result);
- if(use_ui) {
- mpz_ui_pow_ui(*gmpnum_result, Z_LVAL_PP(base_arg), Z_LVAL_PP(exp_arg));
- } else {
- mpz_pow_ui(*gmpnum_result, *gmpnum_base, Z_LVAL_PP(exp_arg));
- }
-
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_powm(resource base, resource exp, resource mod)
- Raise base to power exp and take result modulo mod */
-ZEND_FUNCTION(gmp_powm)
-{
- zval **base_arg, **exp_arg, **mod_arg;
- mpz_t *gmpnum_base, *gmpnum_exp, *gmpnum_mod, *gmpnum_result;
- int use_ui=0;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &base_arg, &exp_arg, &mod_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_base, base_arg);
- if(Z_TYPE_PP(exp_arg) == IS_LONG && Z_LVAL_PP(exp_arg) >= 0) {
- use_ui=1;
- } else {
- FETCH_GMP_ZVAL(gmpnum_exp, exp_arg);
- }
- FETCH_GMP_ZVAL(gmpnum_mod, mod_arg);
-
- INIT_GMP_NUM(gmpnum_result);
- if(use_ui) {
- mpz_powm_ui(*gmpnum_result, *gmpnum_base, (unsigned long)Z_LVAL_PP(exp_arg), *gmpnum_mod);
- } else {
- mpz_powm(*gmpnum_result, *gmpnum_base, *gmpnum_exp, *gmpnum_mod);
- }
-
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
-
-}
-/* }}} */
-
-/* {{{ proto resource gmp_sqrt(resource a)
- Takes integer part of square root of a */
-ZEND_FUNCTION(gmp_sqrt)
-{
- gmp_unary_op(mpz_sqrt);
-}
-/* }}} */
-
-/* {{{ proto array gmp_sqrtrem(resource a)
- Square root with remainder */
-ZEND_FUNCTION(gmp_sqrtrem)
-{
- zval **a_arg;
- mpz_t *gmpnum_a, *gmpnum_result1, *gmpnum_result2;
- zval r;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
-
- INIT_GMP_NUM(gmpnum_result1);
- INIT_GMP_NUM(gmpnum_result2);
-
- mpz_sqrtrem(*gmpnum_result1, *gmpnum_result2, *gmpnum_a);
-
- array_init(return_value);
- ZEND_REGISTER_RESOURCE(&r, gmpnum_result1, le_gmp);
- add_index_resource(return_value, 0, Z_LVAL(r));
- ZEND_REGISTER_RESOURCE(&r, gmpnum_result2, le_gmp);
- add_index_resource(return_value, 1, Z_LVAL(r));
-}
-/* }}} */
-
-/* {{{ proto bool gmp_perfect_square(resource a)
- Checks if a is an exact square */
-ZEND_FUNCTION(gmp_perfect_square)
-{
- zval **a_arg;
- mpz_t *gmpnum_a;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
-
- RETURN_BOOL((mpz_perfect_square_p(*gmpnum_a)!=0));
-}
-/* }}} */
-
-/* {{{ proto int gmp_prob_prime(resource a[, int reps])
- Checks if a is "probably prime" */
-ZEND_FUNCTION(gmp_prob_prime)
-{
- zval **gmpnumber_arg, **reps_arg;
- mpz_t *gmpnum_a;
- int argc, reps=10;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &gmpnumber_arg, &reps_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, gmpnumber_arg);
-
- switch (argc) {
- case 2:
- convert_to_long_ex(reps_arg);
- reps = Z_LVAL_PP(reps_arg);
- break;
- case 1:
- reps = 10;
- break;
- }
-
- RETURN_LONG(mpz_probab_prime_p(*gmpnum_a, reps));
-}
-/* }}} */
-
-/* {{{ proto resource gmp_gcd(resource a, resource b)
- Computes greatest common denominator (gcd) of a and b */
-ZEND_FUNCTION(gmp_gcd)
-{
- zval **a_arg, **b_arg;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- gmp_zval_binary_ui_op_ex(return_value, a_arg, b_arg, mpz_gcd, (gmp_binary_ui_op_t)mpz_gcd_ui, 1 TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto array gmp_gcdext(resource a, resource b)
- Computes G, S, and T, such that AS + BT = G = `gcd' (A, B) */
-ZEND_FUNCTION(gmp_gcdext)
-{
- zval **a_arg, **b_arg;
- mpz_t *gmpnum_a, *gmpnum_b, *gmpnum_t, *gmpnum_s, *gmpnum_g;
- zval r;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
-
- INIT_GMP_NUM(gmpnum_g);
- INIT_GMP_NUM(gmpnum_s);
- INIT_GMP_NUM(gmpnum_t);
-
- mpz_gcdext(*gmpnum_g, *gmpnum_s, *gmpnum_t, *gmpnum_a, *gmpnum_b);
-
- array_init(return_value);
-
- ZEND_REGISTER_RESOURCE(&r, gmpnum_g, le_gmp);
- add_assoc_resource(return_value, "g", Z_LVAL(r));
- ZEND_REGISTER_RESOURCE(&r, gmpnum_s, le_gmp);
- add_assoc_resource(return_value, "s", Z_LVAL(r));
- ZEND_REGISTER_RESOURCE(&r, gmpnum_t, le_gmp);
- add_assoc_resource(return_value, "t", Z_LVAL(r));
-}
-/* }}} */
-
-/* {{{ proto resource gmp_invert(resource a, resource b)
- Computes the inverse of a modulo b */
-ZEND_FUNCTION(gmp_invert)
-{
- zval **a_arg, **b_arg;
- mpz_t *gmpnum_a, *gmpnum_b, *gmpnum_result;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
-
- INIT_GMP_NUM(gmpnum_result);
- if(mpz_invert(*gmpnum_result, *gmpnum_a, *gmpnum_b)) {
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
- } else {
- FREE_GMP_NUM(gmpnum_result);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int gmp_jacobi(resource a, resource b)
- Computes Jacobi symbol */
-ZEND_FUNCTION(gmp_jacobi)
-{
- gmp_binary_opl(mpz_jacobi);
-}
-/* }}} */
-
-/* {{{ proto int gmp_legendre(resource a, resource b)
- Computes Legendre symbol */
-ZEND_FUNCTION(gmp_legendre)
-{
- gmp_binary_opl(mpz_legendre);
-}
-/* }}} */
-
-/* {{{ proto int gmp_cmp(resource a, resource b)
- Compares two numbers */
-ZEND_FUNCTION(gmp_cmp)
-{
- zval **a_arg, **b_arg;
- mpz_t *gmpnum_a, *gmpnum_b;
- int use_si=0, res;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
-
- if(Z_TYPE_PP(b_arg) == IS_LONG) {
- use_si=1;
- } else {
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
- }
-
- if(use_si) {
- res = mpz_cmp_si(*gmpnum_a, Z_LVAL_PP(b_arg));
- } else {
- res = mpz_cmp(*gmpnum_a, *gmpnum_b);
- }
-
- RETURN_LONG(res);
-}
-/* }}} */
-
-/* {{{ proto int gmp_sign(resource a)
- Gets the sign of the number */
-ZEND_FUNCTION(gmp_sign)
-{
- zval **a_arg;
- mpz_t *gmpnum_a;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
-
- RETURN_LONG(mpz_sgn(*gmpnum_a));
-}
-/* }}} */
-
-/* {{{ proto resource gmp_random([int limiter])
- Gets random number */
-ZEND_FUNCTION(gmp_random)
-{
- zval **limiter_arg;
- int limiter, argc;
- mpz_t *gmpnum_result;
-
- argc = ZEND_NUM_ARGS();
-
- if (argc < 0 || argc > 1 || zend_get_parameters_ex(1, &limiter_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(argc) {
- convert_to_long_ex(limiter_arg);
- limiter = Z_LVAL_PP(limiter_arg);
- } else {
- limiter = 20;
- }
-
- INIT_GMP_NUM(gmpnum_result);
- mpz_random(*gmpnum_result, limiter);
-
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_and(resource a, resource b)
- Calculates logical AND of a and b */
-ZEND_FUNCTION(gmp_and)
-{
- gmp_binary_op(mpz_and);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_or(resource a, resource b)
- Calculates logical OR of a and b */
-ZEND_FUNCTION(gmp_or)
-{
- gmp_binary_op(mpz_ior);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_com(resource a)
- Calculates one's complement of a */
-ZEND_FUNCTION(gmp_com)
-{
- gmp_unary_op(mpz_com);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_xor(resource a, resource b)
- Calculates logical exclusive OR of a and b */
-ZEND_FUNCTION(gmp_xor)
-{
- /* use formula: a^b = (a|b)&^(a&b) */
- zval **a_arg, **b_arg;
- mpz_t *gmpnum_a, *gmpnum_b, *gmpnum_result, *gmpnum_t;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
-
- INIT_GMP_NUM(gmpnum_result);
- INIT_GMP_NUM(gmpnum_t);
-
- mpz_and(*gmpnum_t, *gmpnum_a, *gmpnum_b);
- mpz_com(*gmpnum_t, *gmpnum_t);
-
- mpz_ior(*gmpnum_result, *gmpnum_a, *gmpnum_b);
- mpz_and(*gmpnum_result, *gmpnum_result, *gmpnum_t);
-
- FREE_GMP_NUM(gmpnum_t);
-
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
-}
-/* }}} */
-
-/* {{{ proto void gmp_setbit(resource &a, int index[, bool set_clear])
- Sets or clear bit in a */
-ZEND_FUNCTION(gmp_setbit)
-{
- zval **a_arg, **ind_arg, **set_c_arg;
- int argc, index, set=1;
- mpz_t *gmpnum_a;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &a_arg, &ind_arg, &set_c_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(gmpnum_a, mpz_t *, a_arg, -1, GMP_RESOURCE_NAME, le_gmp);
-
- convert_to_long_ex(ind_arg);
- index = Z_LVAL_PP(ind_arg);
-
- switch (argc) {
- case 3:
- convert_to_long_ex(set_c_arg);
- set = Z_LVAL_PP(set_c_arg);
- break;
- case 2:
- set = 1;
- break;
- }
-
- if(set) {
- mpz_setbit(*gmpnum_a, index);
- } else {
- mpz_clrbit(*gmpnum_a, index);
- }
-}
-/* }}} */
-
-/* {{{ proto void gmp_clrbit(resource &a, int index)
- Clears bit in a */
-ZEND_FUNCTION(gmp_clrbit)
-{
- zval **a_arg, **ind_arg;
- int index;
- mpz_t *gmpnum_a;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &ind_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(gmpnum_a, mpz_t *, a_arg, -1, GMP_RESOURCE_NAME, le_gmp);
-
- convert_to_long_ex(ind_arg);
- index = Z_LVAL_PP(ind_arg);
-
- mpz_clrbit(*gmpnum_a, index);
-}
-/* }}} */
-
-/* {{{ proto int gmp_popcount(resource a)
- Calculates the population count of a */
-ZEND_FUNCTION(gmp_popcount)
-{
- zval **a_arg;
- mpz_t *gmpnum_a;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
-
- RETURN_LONG(mpz_popcount(*gmpnum_a));
-}
-/* }}} */
-
-/* {{{ proto int gmp_hamdist(resource a, resource b)
- Calculates hamming distance between a and b */
-ZEND_FUNCTION(gmp_hamdist)
-{
- zval **a_arg, **b_arg;
- mpz_t *gmpnum_a, *gmpnum_b;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(1, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
-
- RETURN_LONG(mpz_hamdist(*gmpnum_a, *gmpnum_b));
-}
-/* }}} */
-
-/* {{{ proto int gmp_scan0(resource a, int start)
- Finds first zero bit */
-ZEND_FUNCTION(gmp_scan0)
-{
- zval **a_arg, **start_arg;
- mpz_t *gmpnum_a;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &start_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- convert_to_long_ex(start_arg);
-
- RETURN_LONG(mpz_scan0(*gmpnum_a, Z_LVAL_PP(start_arg)));
-}
-/* }}} */
-
-/* {{{ proto int gmp_scan1(resource a, int start)
- Finds first non-zero bit */
-ZEND_FUNCTION(gmp_scan1)
-{
- zval **a_arg, **start_arg;
- mpz_t *gmpnum_a;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &start_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- convert_to_long_ex(start_arg);
-
- RETURN_LONG(mpz_scan1(*gmpnum_a, Z_LVAL_PP(start_arg)));
-}
-/* }}} */
-
-/* {{{ _php_gmpnum_free
- */
-static void _php_gmpnum_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- mpz_t *gmpnum = (mpz_t *)rsrc->ptr;
-
- FREE_GMP_NUM(gmpnum);
-}
-/* }}} */
-
-#endif /* HAVE_GMP */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/gmp/php_gmp.h b/ext/gmp/php_gmp.h
deleted file mode 100644
index c6fdb3b6e1..0000000000
--- a/ext/gmp/php_gmp.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stanislav Malyshev <stas@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_GMP_H
-#define PHP_GMP_H
-
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined.
-*/
-#if HAVE_GMP
-
-extern zend_module_entry gmp_module_entry;
-#define phpext_gmp_ptr &gmp_module_entry
-
-#ifdef ZEND_WIN32
-#define GMP_API __declspec(dllexport)
-#else
-#define GMP_API
-#endif
-
-ZEND_MODULE_STARTUP_D(gmp);
-ZEND_MODULE_SHUTDOWN_D(gmp);
-ZEND_MODULE_INFO_D(gmp);
-
-ZEND_FUNCTION(gmp_init);
-ZEND_FUNCTION(gmp_intval);
-ZEND_FUNCTION(gmp_strval);
-ZEND_FUNCTION(gmp_add);
-ZEND_FUNCTION(gmp_sub);
-ZEND_FUNCTION(gmp_mul);
-ZEND_FUNCTION(gmp_div_qr);
-ZEND_FUNCTION(gmp_div_q);
-ZEND_FUNCTION(gmp_div_r);
-ZEND_FUNCTION(gmp_mod);
-ZEND_FUNCTION(gmp_divexact);
-ZEND_FUNCTION(gmp_neg);
-ZEND_FUNCTION(gmp_abs);
-ZEND_FUNCTION(gmp_fact);
-ZEND_FUNCTION(gmp_sqrt);
-ZEND_FUNCTION(gmp_pow);
-ZEND_FUNCTION(gmp_powm);
-ZEND_FUNCTION(gmp_sqrtrem);
-ZEND_FUNCTION(gmp_perfect_square);
-ZEND_FUNCTION(gmp_prob_prime);
-ZEND_FUNCTION(gmp_gcd);
-ZEND_FUNCTION(gmp_gcdext);
-ZEND_FUNCTION(gmp_invert);
-ZEND_FUNCTION(gmp_jacobi);
-ZEND_FUNCTION(gmp_legendre);
-ZEND_FUNCTION(gmp_cmp);
-ZEND_FUNCTION(gmp_sign);
-ZEND_FUNCTION(gmp_and);
-ZEND_FUNCTION(gmp_or);
-ZEND_FUNCTION(gmp_com);
-ZEND_FUNCTION(gmp_xor);
-ZEND_FUNCTION(gmp_random);
-ZEND_FUNCTION(gmp_setbit);
-ZEND_FUNCTION(gmp_clrbit);
-ZEND_FUNCTION(gmp_scan0);
-ZEND_FUNCTION(gmp_scan1);
-ZEND_FUNCTION(gmp_popcount);
-ZEND_FUNCTION(gmp_hamdist);
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-
-ZEND_BEGIN_MODULE_GLOBALS(gmp)
- int global_variable;
-ZEND_END_MODULE_GLOBALS(gmp)
-*/
-
-/* In every function that needs to use variables in php_gmp_globals,
- do call GMPLS_FETCH(); after declaring other variables used by
- that function, and always refer to them as GMPG(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define GMPG(v) TSRMG(gmp_globals_id, php_gmp_globals *, v)
-#else
-#define GMPG(v) (gmp_globals.v)
-#endif
-
-#else
-
-#define phpext_gmp_ptr NULL
-
-#endif
-
-#endif /* PHP_GMP_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/gmp/tests/001.phpt b/ext/gmp/tests/001.phpt
deleted file mode 100644
index a2f520d527..0000000000
--- a/ext/gmp/tests/001.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Check for gmp presence
---SKIPIF--
-<?php if (!extension_loaded("gmp")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "gmp extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php4/tests/README for further information on
- writing regression tests
-*/
-?>
---EXPECT--
-gmp extension is available \ No newline at end of file
diff --git a/ext/gmp/tests/002.phpt b/ext/gmp/tests/002.phpt
deleted file mode 100644
index 4e33b6111d..0000000000
--- a/ext/gmp/tests/002.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-GMP functionality test - factorial
---SKIPIF--
-<?php if (!extension_loaded("gmp")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-function fact($x) {
- if($x <= 1)
- return 1;
- else
- return gmp_mul($x,fact($x-1));
-}
-
-print gmp_strval(fact(1000))."\n";
-?>
---EXPECT--
-402387260077093773543702433923003985719374864210714632543799910429938512398629020592044208486969404800479988610197196058631666872994808558901323829669944590997424504087073759918823627727188732519779505950995276120874975462497043601418278094646496291056393887437886487337119181045825783647849977012476632889835955735432513185323958463075557409114262417474349347553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871348312025478589320767169132448426236131412508780208000261683151027341827977704784635868170164365024153691398281264810213092761244896359928705114964975419909342221566832572080821333186116811553615836546984046708975602900950537616475847728421889679646244945160765353408198901385442487984959953319101723355556602139450399736280750137837615307127761926849034352625200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616762179168909779911903754031274622289988005195444414282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490222221765904339901886018566526485061799702356193897017860040811889729918311021171229845901641921068884387121855646124960798722908519296819372388642614839657382291123125024186649353143970137428531926649875337218940694281434118520158014123344828015051399694290153483077644569099073152433278288269864602789864321139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640182154399457156805941872748998094254742173582401063677404595741785160829230135358081840096996372524230560855903700624271243416909004153690105933983835777939410970027753472000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
diff --git a/ext/gmp/tests/003.phpt b/ext/gmp/tests/003.phpt
deleted file mode 100644
index 0a302573ee..0000000000
--- a/ext/gmp/tests/003.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-Check for number base recognition
---SKIPIF--
-<?php if (!extension_loaded("gmp")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
- /* Binary */
- $test[] = gmp_init("0b10011010010");
- $test[] = gmp_init("0b10011010010", 2);
- $test[] = gmp_init("10011010010");
- $test[] = gmp_init("10011010010", 2);
-
- /* Octal */
- $test[] = gmp_init("02322");
- $test[] = gmp_init("02322", 8);
- $test[] = gmp_init("2322");
- $test[] = gmp_init("2322", 8);
-
- /* Decimal */
- $test[] = gmp_init("1234");
- $test[] = gmp_init("1234", 10);
-
- /* Hexidecimal */
- $test[] = gmp_init("0x4d2");
- $test[] = gmp_init("0x4d2", 16);
- $test[] = gmp_init("4d2");
- $test[] = gmp_init("4d2", 16);
-
- for ($i = 0; $i < count($test); $i++) {
- printf("%s\n", gmp_strval($test[$i]));
- }
-?>
---EXPECT--
-1234
-1234
-10011010010
-1234
-1234
-1234
-2322
-1234
-1234
-1234
-1234
-1234
-0
-1234
diff --git a/ext/hwapi/CREDITS b/ext/hwapi/CREDITS
deleted file mode 100644
index 8416199c54..0000000000
--- a/ext/hwapi/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-HwAPI
-Uwe Steinmann
diff --git a/ext/hwapi/config.m4 b/ext/hwapi/config.m4
deleted file mode 100644
index af8069fd21..0000000000
--- a/ext/hwapi/config.m4
+++ /dev/null
@@ -1,35 +0,0 @@
-dnl $Id$
-
-PHP_ARG_WITH(hwapi, for hwapi support,
-[ --with-hwapi[=DIR] Include official Hyperwave API support])
-
-if test "$PHP_HWAPI" != "no"; then
- if test -r $PHP_HWAPI/include/sdk/api/object.h; then
- HWAPI_DIR=$PHP_HWAPI
- else
- AC_MSG_CHECKING(for HWAPI in default path)
- for i in /usr/local /usr; do
- if test -r $i/include/hwapi/sdk/api/object.h; then
- HWAPI_DIR=$i
- AC_MSG_RESULT(found in $i)
- fi
- done
- fi
-
- if test -z "$HWAPI_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please install the hwapi >= 1.0.0 distribution)
- fi
-
- PHP_ADD_INCLUDE($HWAPI_DIR/include/hwapi)
- PHP_SUBST(HWAPI_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(hwapi, $HWAPI_DIR/lib, HWAPI_SHARED_LIBADD)
- AC_DEFINE(HAVE_HWAPI,1,[ ])
-
- PHP_REQUIRE_CXX
- PHP_NEW_EXTENSION(hwapi, hwapi.cpp, $ext_shared)
- PHP_ADD_LIBRARY(hwapi)
- PHP_ADD_LIBRARY(pthread)
- PHP_ADD_LIBRARY(stdc++)
- PHP_ADD_INCLUDE($HWAPI_DIR/include)
-fi
diff --git a/ext/hwapi/hwapi.cpp b/ext/hwapi/hwapi.cpp
deleted file mode 100644
index aae3b152a4..0000000000
--- a/ext/hwapi/hwapi.cpp
+++ /dev/null
@@ -1,5031 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Uwe Steinmann |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdlib.h>
-#include <errno.h>
-
-extern "C"
-{
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/head.h"
-#include "ext/standard/info.h"
-#if 0
-#include "ext/standard/php_standard.h"
-#include "fopen-wrappers.h"
-#endif
-#include "SAPI.h"
-}
-
-#ifdef PHP_WIN32
-#include <winsock.h>
-#endif
-#ifdef HAVE_MMAP
-#include <sys/mman.h>
-#endif
-
-#if HAVE_HWAPI
-
-static int le_hwapip;
-static int le_hwapi_objectp;
-static int le_hwapi_attributep;
-static int le_hwapi_errorp;
-static int le_hwapi_contentp;
-static int le_hwapi_reasonp;
-
-static zend_class_entry *hw_api_class_entry_ptr;
-static zend_class_entry *hw_api_object_class_entry_ptr;
-static zend_class_entry *hw_api_attribute_class_entry_ptr;
-static zend_class_entry *hw_api_error_class_entry_ptr;
-static zend_class_entry *hw_api_content_class_entry_ptr;
-static zend_class_entry *hw_api_reason_class_entry_ptr;
-
-#include "php_ini.h"
-#include "php_hwapi.h"
-
-//#ifdef __cplusplus
-//extern "C" {
-#include <sdk/api/api.h>
-#include <sdk/hgcsp/apihgcsp.h>
-//}
-//#endif
-
-function_entry hwapi_functions[] = {
- PHP_FE(hwapi_dummy, NULL)
- PHP_FE(hwapi_init, NULL)
- PHP_FE(hwapi_hgcsp, NULL)
- PHP_FE(hwapi_object, NULL)
- PHP_FE(hwapi_children, NULL)
- PHP_FE(hwapi_parents, NULL)
- PHP_FE(hwapi_find, NULL)
- PHP_FE(hwapi_identify, NULL)
- PHP_FE(hwapi_remove, NULL)
- PHP_FE(hwapi_content, NULL)
- PHP_FE(hwapi_copy, NULL)
- PHP_FE(hwapi_link, NULL)
- PHP_FE(hwapi_move, NULL)
- PHP_FE(hwapi_lock, NULL)
- PHP_FE(hwapi_unlock, NULL)
- PHP_FE(hwapi_replace, NULL)
- PHP_FE(hwapi_object_new, NULL)
- PHP_FE(hwapi_object_count, NULL)
- PHP_FE(hwapi_object_title, NULL)
- PHP_FE(hwapi_object_attreditable, NULL)
- PHP_FE(hwapi_object_assign, NULL)
- PHP_FE(hwapi_object_attribute, NULL)
- PHP_FE(hwapi_object_insert, NULL)
- PHP_FE(hwapi_object_remove, NULL)
- PHP_FE(hwapi_object_value, NULL)
- PHP_FE(hwapi_attribute_new, NULL)
- PHP_FE(hwapi_attribute_key, NULL)
- PHP_FE(hwapi_attribute_value, NULL)
- PHP_FE(hwapi_attribute_values, NULL)
- PHP_FE(hwapi_attribute_langdepvalue, NULL)
- PHP_FE(hwapi_content_new, NULL)
- {NULL, NULL, NULL}
-};
-
-static function_entry php_hw_api_functions[] = {
- {"hgcsp", PHP_FN(hwapi_hgcsp), NULL},
- {"object", PHP_FN(hwapi_object), NULL},
- {"children", PHP_FN(hwapi_children), NULL},
- {"mychildren", PHP_FN(hwapi_mychildren), NULL},
- {"parents", PHP_FN(hwapi_parents), NULL},
- {"find", PHP_FN(hwapi_find), NULL},
- {"identify", PHP_FN(hwapi_identify), NULL},
- {"remove", PHP_FN(hwapi_remove), NULL},
- {"content", PHP_FN(hwapi_content), NULL},
- {"copy", PHP_FN(hwapi_copy), NULL},
- {"link", PHP_FN(hwapi_link), NULL},
- {"move", PHP_FN(hwapi_move), NULL},
- {"lock", PHP_FN(hwapi_lock), NULL},
- {"unlock", PHP_FN(hwapi_unlock), NULL},
- {"replace", PHP_FN(hwapi_replace), NULL},
- {"insert", PHP_FN(hwapi_insert), NULL},
- {"insertdocument", PHP_FN(hwapi_insertdocument), NULL},
- {"insertcollection", PHP_FN(hwapi_insertcollection), NULL},
- {"srcanchors", PHP_FN(hwapi_srcanchors), NULL},
- {"dstanchors", PHP_FN(hwapi_dstanchors), NULL},
- {"objectbyanchor", PHP_FN(hwapi_objectbyanchor), NULL},
- {"dstofsrcanchor", PHP_FN(hwapi_dstofsrcanchor), NULL},
- {"srcsofdst", PHP_FN(hwapi_srcsofdst), NULL},
- {"checkin", PHP_FN(hwapi_checkin), NULL},
- {"checkout", PHP_FN(hwapi_checkout), NULL},
- {"setcommittedversion", PHP_FN(hwapi_setcommittedversion), NULL},
- {"revert", PHP_FN(hwapi_revert), NULL},
- {"history", PHP_FN(hwapi_history), NULL},
- {"removeversion", PHP_FN(hwapi_removeversion), NULL},
- {"freeversion", PHP_FN(hwapi_freeversion), NULL},
- {"configurationhistory", PHP_FN(hwapi_configurationhistory), NULL},
- {"saveconfiguration", PHP_FN(hwapi_saveconfiguration), NULL},
- {"restoreconfiguration", PHP_FN(hwapi_restoreconfiguration), NULL},
- {"removeconfiguration", PHP_FN(hwapi_removeconfiguration), NULL},
- {"mergeconfiguration", PHP_FN(hwapi_mergeconfiguration), NULL},
- {"user", PHP_FN(hwapi_user), NULL},
- {"userlist", PHP_FN(hwapi_userlist), NULL},
- {"hwstat", PHP_FN(hwapi_hwstat), NULL},
- {"dcstat", PHP_FN(hwapi_dcstat), NULL},
- {"dbstat", PHP_FN(hwapi_dbstat), NULL},
- {"ftstat", PHP_FN(hwapi_ftstat), NULL},
- {"info", PHP_FN(hwapi_info), NULL},
- {NULL, NULL, NULL}
-};
-
-static function_entry php_hw_api_object_functions[] = {
- {"hw_api_object", PHP_FN(hwapi_object_new), NULL},
- {"count", PHP_FN(hwapi_object_count), NULL},
- {"title", PHP_FN(hwapi_object_title), NULL},
- {"attributeeditable", PHP_FN(hwapi_object_attreditable), NULL},
- {"assign", PHP_FN(hwapi_object_assign), NULL},
- {"attribute", PHP_FN(hwapi_object_attribute), NULL},
- {"insert", PHP_FN(hwapi_object_insert), NULL},
- {"remove", PHP_FN(hwapi_object_remove), NULL},
- {"value", PHP_FN(hwapi_object_value), NULL},
- {NULL, NULL, NULL}
-};
-
-static function_entry php_hw_api_attribute_functions[] = {
- {"hw_api_attribute", PHP_FN(hwapi_attribute_new), NULL},
- {"key", PHP_FN(hwapi_attribute_key), NULL},
- {"value", PHP_FN(hwapi_attribute_value), NULL},
- {"values", PHP_FN(hwapi_attribute_values), NULL},
- {"langdepvalue", PHP_FN(hwapi_attribute_langdepvalue), NULL},
- {NULL, NULL, NULL}
-};
-
-static function_entry php_hw_api_error_functions[] = {
- {"count", PHP_FN(hwapi_error_count), NULL},
- {"reason", PHP_FN(hwapi_error_reason), NULL},
- {NULL, NULL, NULL}
-};
-
-static function_entry php_hw_api_content_functions[] = {
- {"hw_api_content", PHP_FN(hwapi_content_new), NULL},
- {"read", PHP_FN(hwapi_content_read), NULL},
- {"mimetype", PHP_FN(hwapi_content_mimetype), NULL},
- {NULL, NULL, NULL}
-};
-
-static function_entry php_hw_api_reason_functions[] = {
- {"type", PHP_FN(hwapi_reason_type), NULL},
- {"description", PHP_FN(hwapi_reason_description), NULL},
- {NULL, NULL, NULL}
-};
-
-void hw_api_class_startup();
-void hw_api_object_class_startup();
-void hw_api_attribute_class_startup();
-void hw_api_error_class_startup();
-void hw_api_content_class_startup();
-void hw_api_reason_class_startup();
-static zval *php_hwapi_object_new(void *obj, int rsrc_type);
-
-zend_module_entry hwapi_module_entry = {
- STANDARD_MODULE_HEADER,
- "hwapi",
- hwapi_functions,
- PHP_MINIT(hwapi),
- PHP_MSHUTDOWN(hwapi),
- PHP_RINIT(hwapi),
- NULL,
- PHP_MINFO(hwapi),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef ZTS
-int hwapi_globals_id;
-#else
-PHP_HWAPI_API zend_hwapi_globals hwapi_globals;
-#endif
-
-#ifdef COMPILE_DL_HWAPI
-ZEND_GET_MODULE(hwapi)
-#endif
-
-static void print_reason(const HW_API_Reason& reason) {
- HW_API_String str_type;
- switch(reason.type()) {
- case HW_API_Reason::HW_API_ERROR:
- str_type = "Error";
- break;
- case HW_API_Reason::HW_API_WARNING:
- str_type = "Warning";
- break;
- case HW_API_Reason::HW_API_MESSAGE:
- str_type = "Message";
- break;
- }
- fprintf(stderr, "%s: %s\n", str_type.string(), reason.description("en").string());
-}
-
-static void print_error(const HW_API_Error& error) {
- for (int i=0; i < error.count(); i++) {
- HW_API_Reason reason;
- error.reason(i, reason);
- print_reason(reason);
- }
-}
-
-static void print_object(const HW_API_Object& object) {
- fprintf(stderr, "%s\n", object.title("en").string());
- for (int i=0; i < object.count(); i++) {
- HW_API_Attribute attrib;
- object.attribute(i, attrib);
- fprintf(stderr, "%s=%s\n", attrib.key().string(), attrib.value().string());
- }
-}
-
-static void php_hwapi_init_globals(zend_hwapi_globals *hwapi_globals) {
-}
-
-static void php_free_hwapi(zend_rsrc_list_entry *rsrc) {
- HW_API *obj;
-
- obj = (HW_API *) (rsrc->ptr);
- delete obj;
-}
-
-static void php_free_hwapi_object(zend_rsrc_list_entry *rsrc) {
- HW_API_Object *obj;
-
- obj = (HW_API_Object *) (rsrc->ptr);
- delete obj;
-}
-
-static void php_free_hwapi_attribute(zend_rsrc_list_entry *rsrc) {
- HW_API_Attribute *obj;
-
- obj = (HW_API_Attribute *) (rsrc->ptr);
- if(obj)
- delete obj;
-}
-
-static void php_free_hwapi_error(zend_rsrc_list_entry *rsrc) {
- HW_API_Error *obj;
-
- obj = (HW_API_Error *) (rsrc->ptr);
- if(obj)
- delete obj;
-}
-
-static void php_free_hwapi_content(zend_rsrc_list_entry *rsrc) {
- HW_API_Content *obj;
-
- obj = (HW_API_Content *) (rsrc->ptr);
- if(obj)
- delete obj;
-}
-
-static void php_free_hwapi_reason(zend_rsrc_list_entry *rsrc) {
- HW_API_Reason *obj;
-
- obj = (HW_API_Reason *) (rsrc->ptr);
- if(obj)
- delete obj;
-}
-
-static void print_hwapi_stringarray(const HW_API_StringArray& strings) {
- for(int i=0; i<strings.count(); i++) {
- HW_API_String str;
- strings.string(i, str);
- fprintf(stderr, "%s\n", str.string());
- }
-}
-
-static int stringArray2indexArray(pval **return_value, HW_API_StringArray *values) {
- array_init(*return_value);
- for (int i=0; i<values->count(); i++) {
- HW_API_String str;
- values->string(i, str);
- str.string();
- add_next_index_string(*return_value, (char *) str.string(), 1);
- }
- return 1;
-}
-
-static int objectArray2indexArray(pval **return_value, HW_API_ObjectArray *objarr) {
- array_init(*return_value);
-
- for(int i=0; i<objarr->count(); i++) {
- zval *child;
- HW_API_Object obj, *objp;
- objarr->object(i, obj);
- objp = new HW_API_Object(obj);
- child = php_hwapi_object_new(objp, le_hwapi_objectp);
- add_next_index_zval(*return_value, child);
- }
- return 1;
-}
-
-static void *php_hwapi_get_object(zval *wrapper, int rsrc_type1) {
- void *obj;
- zval **handle;
- int type;
-
- if (Z_TYPE_P(wrapper) != IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Wrapper is not an object");
- }
- if (zend_hash_find(Z_OBJPROP_P(wrapper), "this", sizeof("this"), (void **)&handle) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Underlying object missing");
- }
-
- obj = zend_list_find(Z_LVAL_PP(handle), &type);
- if (!obj || (type != rsrc_type1)) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Underlying object missing or of invalid type");
- }
- return obj;
-}
-
-static zval *php_hwapi_object_new(void *obj, int rsrc_type) {
- zval *wrapper, *handle;
- int ret;
-
- MAKE_STD_ZVAL(wrapper);
- if (!obj) {
- ZVAL_NULL(wrapper);
- return wrapper;
- }
-
- /* construct an object with some methods */
- if(rsrc_type == le_hwapi_attributep)
- object_init_ex(wrapper, hw_api_attribute_class_entry_ptr);
- else if(rsrc_type == le_hwapi_objectp)
- object_init_ex(wrapper, hw_api_object_class_entry_ptr);
- else if(rsrc_type == le_hwapip)
- object_init_ex(wrapper, hw_api_class_entry_ptr);
- else if(rsrc_type == le_hwapi_errorp)
- object_init_ex(wrapper, hw_api_error_class_entry_ptr);
- else if(rsrc_type == le_hwapi_contentp)
- object_init_ex(wrapper, hw_api_content_class_entry_ptr);
- else if(rsrc_type == le_hwapi_reasonp)
- object_init_ex(wrapper, hw_api_reason_class_entry_ptr);
-
- MAKE_STD_ZVAL(handle);
- ZEND_REGISTER_RESOURCE(handle, obj, rsrc_type);
- zend_hash_update(Z_OBJPROP_P(wrapper), "this", sizeof("this"), &handle, sizeof(zval *), NULL);
- return(wrapper);
-}
-
-static HW_API_StringArray *make_HW_API_StringArray(HashTable *lht) {
- int count, j;
- HW_API_StringArray *sarr;
-
- sarr = new HW_API_StringArray();
-
- count = zend_hash_num_elements(lht);
- zend_hash_internal_pointer_reset(lht);
- for(j=0; j<count; j++) {
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- switch((*keydata)->type) {
- case IS_STRING:
- sarr->insert((HW_API_String) (*keydata)->value.str.val);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return sarr;
-}
-
-static HW_API_object_In *make_HW_API_object_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_object_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_object_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "version"))
- in->setVersion((*keydata)->value.str.val);
- break;
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_children_In *make_HW_API_children_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_children_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_children_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "objectQuery"))
- in->setObjectQuery((*keydata)->value.str.val);
- break;
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_parents_In *make_HW_API_parents_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_parents_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_parents_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "objectQuery"))
- in->setObjectQuery((*keydata)->value.str.val);
- break;
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_find_In *make_HW_API_find_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_find_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_find_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "keyQuery"))
- in->setKeyQuery((*keydata)->value.str.val);
- else if(!strcmp(key, "objectQuery"))
- in->setObjectQuery((*keydata)->value.str.val);
- else if(!strcmp(key, "fullTextQuery"))
- in->setFullTextQuery((*keydata)->value.str.val);
- break;
- case IS_LONG:
- if(!strcmp(key, "startIndex"))
- in->setStartIndex((*keydata)->value.lval);
- else if(!strcmp(key, "numberOfObjectsToGet"))
- in->setNumberOfObjectsToGet((*keydata)->value.lval);
- else if(!strcmp(key, "exactMatchLimit"))
- in->setExactMatchLimit((*keydata)->value.lval);
- break;
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- } else if(!strcmp(key, "languages")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setLanguages(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- } else if(!strcmp(key, "scope")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setScope(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- }
-
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_identify_In *make_HW_API_identify_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_identify_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_identify_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "username"))
- in->setUsername((*keydata)->value.str.val);
- else if(!strcmp(key, "password"))
- in->setPassword((*keydata)->value.str.val);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_remove_In *make_HW_API_remove_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_remove_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_remove_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "parentIdentifier"))
- in->setParentIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "objectQuery"))
- in->setObjectQuery((*keydata)->value.str.val);
- break;
- case IS_LONG:
- if(!strcmp(key, "mode"))
- in->setMode((*keydata)->value.lval);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_content_In *make_HW_API_content_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_content_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_content_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- break;
- case IS_LONG:
- if(!strcmp(key, "mode"))
- in->setMode((*keydata)->value.lval);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_copy_In *make_HW_API_copy_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_copy_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_copy_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "destinationParentIdentifier"))
- in->setDestinationParentIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- break;
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_link_In *make_HW_API_link_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_link_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_link_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "destinationParentIdentifier"))
- in->setDestinationParentIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_move_In *make_HW_API_move_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_move_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_move_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "destinationParentIdentifier"))
- in->setDestinationParentIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "sourceParentIdentifier"))
- in->setSourceParentIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_lock_In *make_HW_API_lock_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_lock_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_lock_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectQuery"))
- in->setObjectQuery((*keydata)->value.str.val);
- else if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- break;
- case IS_LONG:
- if(!strcmp(key, "mode"))
- in->setMode((*keydata)->value.lval);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_unlock_In *make_HW_API_unlock_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_unlock_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_unlock_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectQuery"))
- in->setObjectQuery((*keydata)->value.str.val);
- else if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- break;
- case IS_LONG:
- if(!strcmp(key, "mode"))
- in->setMode((*keydata)->value.lval);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_replace_In *make_HW_API_replace_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_replace_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_replace_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- break;
- case IS_OBJECT: {
- zend_class_entry *ce;
- ce = zend_get_class_entry(*keydata);
- if(!strcmp(key, "object")) {
-// if(!((*keydata)->value.obj.ce->name, "hw_api_object")) {
- if(!strcmp(ce->name, "hw_api_object")) {
- HW_API_Object *obj;
- obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
- in->setObject(*obj);
- }
- } else if(!strcmp(key, "parameters")) {
- if(!strcmp(ce->name, "hw_api_object")) {
- HW_API_Object *obj;
- obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
- in->setParameters(*obj);
- }
- } else if(!strcmp(key, "content")) {
- if(!strcmp(ce->name, "hw_api_content")) {
- HW_API_Content *obj;
- obj = (HW_API_Content *) php_hwapi_get_object(*keydata, le_hwapi_contentp);
- in->setContent(*obj);
- }
- }
- /* FIXME: HW_API_Object and HW_API_Content needs to be handelt */
- break;
- }
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- }
- break;
- }
- case IS_LONG:
- if(!strcmp(key, "mode"))
- in->setMode((*keydata)->value.lval);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_insert_In *make_HW_API_insert_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_insert_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_insert_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_OBJECT: {
- zend_class_entry *ce;
- ce = zend_get_class_entry(*keydata);
- if(!strcmp(key, "object")) {
- if(!strcmp(ce->name, "hw_api_object")) {
- HW_API_Object *obj;
- obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
- in->setObject(*obj);
- }
- } else if(!strcmp(key, "parameters")) {
- if(!strcmp(ce->name, "hw_api_object")) {
- HW_API_Object *obj;
- obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
- in->setParameters(*obj);
- }
- } else if(!strcmp(key, "content")) {
- if(!strcmp(ce->name, "hw_api_content")) {
- HW_API_Content *obj;
- obj = (HW_API_Content *) php_hwapi_get_object(*keydata, le_hwapi_contentp);
- in->setContent(*obj);
- }
- }
- /* FIXME: HW_API_Object and HW_API_Content needs to be handelt */
- break;
- }
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- }
- break;
- }
- case IS_LONG:
- if(!strcmp(key, "mode"))
- in->setMode((*keydata)->value.lval);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_insertDocument_In *make_HW_API_insertDocument_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_insertDocument_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_insertDocument_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_OBJECT: {
- zend_class_entry *ce;
- ce = zend_get_class_entry(*keydata);
- if(!strcmp(key, "object")) {
- if(!strcmp(ce->name, "hw_api_object")) {
- HW_API_Object *obj;
- obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
- in->setObject(*obj);
- }
- } else if(!strcmp(key, "parameters")) {
- if(!strcmp(ce->name, "hw_api_object")) {
- HW_API_Object *obj;
- obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
- in->setParameters(*obj);
- }
- } else if(!strcmp(key, "content")) {
- if(!strcmp(ce->name, "hw_api_content")) {
- HW_API_Content *obj;
- obj = (HW_API_Content *) php_hwapi_get_object(*keydata, le_hwapi_contentp);
- in->setContent(*obj);
- }
- }
- /* FIXME: HW_API_Object and HW_API_Content needs to be handelt */
- break;
- }
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- }
- break;
- }
- case IS_LONG:
- if(!strcmp(key, "mode"))
- in->setMode((*keydata)->value.lval);
- break;
- case IS_STRING:
- if(!strcmp(key, "parentIdentifier"))
- in->setParentIdentifier((*keydata)->value.str.val);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_insertCollection_In *make_HW_API_insertCollection_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_insertCollection_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_insertCollection_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "parentIdentifier"))
- in->setParentIdentifier((*keydata)->value.str.val);
- break;
- case IS_OBJECT: {
- zend_class_entry *ce;
- ce = zend_get_class_entry(*keydata);
- if(!strcmp(key, "object")) {
- if(!strcmp(ce->name, "hw_api_object")) {
- HW_API_Object *obj;
- obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
- in->setObject(*obj);
- }
- } else if(!strcmp(key, "parameters")) {
- if(!strcmp(ce->name, "hw_api_object")) {
- HW_API_Object *obj;
- obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
- in->setParameters(*obj);
- }
- }
- /* FIXME: HW_API_Object and HW_API_Content needs to be handelt */
- break;
- }
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_insertAnchor_In *make_HW_API_insertAnchor_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_insertAnchor_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_insertAnchor_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "documentIdentifier"))
- in->setDocumentIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "destinationIdentifier"))
- in->setDestinationIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "hint"))
- in->setHint((*keydata)->value.str.val);
- break;
- case IS_OBJECT: {
- zend_class_entry *ce;
- ce = zend_get_class_entry(*keydata);
- if(!strcmp(key, "object")) {
- if(!strcmp(ce->name, "hw_api_object")) {
- HW_API_Object *obj;
- obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
- in->setObject(*obj);
- }
- } else if(!strcmp(key, "parameters")) {
- if(!strcmp(ce->name, "hw_api_object")) {
- HW_API_Object *obj;
- obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
- in->setParameters(*obj);
- }
- }
- /* FIXME: HW_API_Object and HW_API_Content needs to be handelt */
- break;
- }
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_srcAnchors_In *make_HW_API_srcAnchors_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_srcAnchors_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_srcAnchors_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "objectQuery"))
- in->setObjectQuery((*keydata)->value.str.val);
- break;
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_dstAnchors_In *make_HW_API_dstAnchors_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_dstAnchors_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_dstAnchors_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "objectQuery"))
- in->setObjectQuery((*keydata)->value.str.val);
- break;
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_dstOfSrcAnchor_In *make_HW_API_dstOfSrcAnchor_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_dstOfSrcAnchor_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_dstOfSrcAnchor_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- break;
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_objectByAnchor_In *make_HW_API_objectByAnchor_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_objectByAnchor_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_objectByAnchor_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- break;
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_srcsOfDst_In *make_HW_API_srcsOfDst_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_srcsOfDst_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_srcsOfDst_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "objectQuery"))
- in->setObjectQuery((*keydata)->value.str.val);
- break;
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly by freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_checkIn_In *make_HW_API_checkIn_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_checkIn_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_checkIn_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "objectQuery"))
- in->setObjectQuery((*keydata)->value.str.val);
- else if(!strcmp(key, "version"))
- in->setVersion((*keydata)->value.str.val);
- else if(!strcmp(key, "comment"))
- in->setComment((*keydata)->value.str.val);
- break;
- case IS_LONG:
- if(!strcmp(key, "mode"))
- in->setMode((*keydata)->value.lval);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_checkOut_In *make_HW_API_checkOut_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_checkOut_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_checkOut_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "objectQuery"))
- in->setObjectQuery((*keydata)->value.str.val);
- else if(!strcmp(key, "version"))
- in->setVersion((*keydata)->value.str.val);
- break;
- case IS_LONG:
- if(!strcmp(key, "mode"))
- in->setMode((*keydata)->value.lval);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_setCommittedVersion_In *make_HW_API_setCommittedVersion_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_setCommittedVersion_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_setCommittedVersion_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "version"))
- in->setVersion((*keydata)->value.str.val);
- break;
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly be freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_revert_In *make_HW_API_revert_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_revert_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_revert_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "objectQuery"))
- in->setObjectQuery((*keydata)->value.str.val);
- else if(!strcmp(key, "version"))
- in->setVersion((*keydata)->value.str.val);
- break;
- case IS_LONG:
- if(!strcmp(key, "mode"))
- in->setMode((*keydata)->value.lval);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_history_In *make_HW_API_history(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_history_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_history_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
-/* else if(!strcmp(key, "objectQuery"))
- in->objectQuery((*keydata)->value.str.val);*/
- break;
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly be freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_removeVersion_In *make_HW_API_removeVersion_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_removeVersion_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_removeVersion_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "version"))
- in->setVersion((*keydata)->value.str.val);
- break;
- case IS_LONG:
- if(!strcmp(key, "mode"))
- in->setMode((*keydata)->value.lval);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_freeVersion_In *make_HW_API_freeVersion_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_freeVersion_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_freeVersion_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "version"))
- in->setVersion((*keydata)->value.str.val);
- break;
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly be freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_configurationHistory_In *make_HW_API_configurationHistory_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_configurationHistory_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_configurationHistory_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_saveConfiguration_In *make_HW_API_saveConfiguration_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_saveConfiguration_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_saveConfiguration_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "version"))
- in->setVersion((*keydata)->value.str.val);
- else if(!strcmp(key, "comment"))
- in->setComment((*keydata)->value.str.val);
- break;
- case IS_LONG:
- if(!strcmp(key, "mode"))
- in->setMode((*keydata)->value.lval);
- break;
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly be freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_restoreConfiguration_In *make_HW_API_restoreConfiguration_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_restoreConfiguration_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_restoreConfiguration_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "version"))
- in->setVersion((*keydata)->value.str.val);
- break;
- case IS_LONG:
- if(!strcmp(key, "mode"))
- in->setMode((*keydata)->value.lval);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_removeConfiguration_In *make_HW_API_removeConfiguration_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_removeConfiguration_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_removeConfiguration_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "version"))
- in->setVersion((*keydata)->value.str.val);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_mergeConfiguration_In *make_HW_API_mergeConfiguration_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_mergeConfiguration_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_mergeConfiguration_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_STRING:
- if(!strcmp(key, "objectIdentifier"))
- in->setObjectIdentifier((*keydata)->value.str.val);
- else if(!strcmp(key, "version"))
- in->setVersion((*keydata)->value.str.val);
- break;
- case IS_LONG:
- if(!strcmp(key, "mode"))
- in->setMode((*keydata)->value.lval);
- break;
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_user_In *make_HW_API_user_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_user_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_user_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly be freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_userlist_In *make_HW_API_userlist_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_userlist_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_userlist_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly be freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_hwStat_In *make_HW_API_hwStat_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_hwStat_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_hwStat_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly be freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_dcStat_In *make_HW_API_dcStat_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_dcStat_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_dcStat_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly be freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_dbStat_In *make_HW_API_dbStat_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_dbStat_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_dbStat_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly be freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_ftStat_In *make_HW_API_ftStat_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_ftStat_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_ftStat_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly be freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-static HW_API_info_In *make_HW_API_info_In(zval *arg1) {
- int count, i;
- HashTable *lht;
- HW_API_info_In *in;
-
- lht = arg1->value.ht;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- return NULL;
- }
-
- in = new HW_API_info_In();
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- ulong ind;
- char *key;
- zval **keydata;
- zend_hash_get_current_data(lht, (void **) &keydata);
- zend_hash_get_current_key(lht, &key, &ind, 0);
- switch((*keydata)->type) {
- case IS_ARRAY: {
- HW_API_StringArray *sarr;
-
- if(!strcmp(key, "attributeSelector")) {
- sarr = make_HW_API_StringArray((*keydata)->value.ht);
- in->setAttributeSelector(*sarr);
- /* FIXME: sarr can be propperly be freed now */
- }
- break;
- }
- }
- zend_hash_move_forward(lht);
- }
- return(in);
-}
-
-PHP_INI_BEGIN()
-// STD_PHP_INI_ENTRY("hwapi.allow_persistent", "0", PHP_INI_SYSTEM, OnUpdateLong, allow_persistent, zend_hwapi_globals, hwapi_globals)
-PHP_INI_END()
-
-PHP_MINIT_FUNCTION(hwapi) {
- ZEND_INIT_MODULE_GLOBALS(hwapi, php_hwapi_init_globals, NULL);
-
- le_hwapip = zend_register_list_destructors_ex(php_free_hwapi, NULL, "hw_api", module_number);
- le_hwapi_attributep = zend_register_list_destructors_ex(php_free_hwapi_attribute, NULL, "hw_api_attribute", module_number);
- le_hwapi_objectp = zend_register_list_destructors_ex(php_free_hwapi_object, NULL, "hw_api_object", module_number);
- le_hwapi_errorp = zend_register_list_destructors_ex(php_free_hwapi_error, NULL, "hw_api_error", module_number);
- le_hwapi_contentp = zend_register_list_destructors_ex(php_free_hwapi_content, NULL, "hw_api_content", module_number);
- le_hwapi_reasonp = zend_register_list_destructors_ex(php_free_hwapi_reason, NULL, "hw_api_reason", module_number);
- hw_api_class_startup();
- hw_api_object_class_startup();
- hw_api_attribute_class_startup();
- hw_api_error_class_startup();
- hw_api_content_class_startup();
- hw_api_reason_class_startup();
-
- REGISTER_LONG_CONSTANT("HW_API_REMOVE_NORMAL", HW_API_remove_In::NORMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_REMOVE_PHYSICAL", HW_API_remove_In::PHYSICAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_REMOVE_REMOVELINKS", HW_API_remove_In::REMOVELINKS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_REMOVE_NONRECURSIVE", HW_API_remove_In::NONRECURSIVE, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("HW_API_REPLACE_NORMAL", HW_API_replace_In::NORMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_REPLACE_FORCE_VERSION_CONTROL", HW_API_replace_In::FORCE_VERSION_CONTROL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_REPLACE_AUTOMATIC_CHECKOUT", HW_API_replace_In::AUTOMATIC_CHECKOUT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_REPLACE_AUTOMATIC_CHECKIN", HW_API_replace_In::AUTOMATIC_CHECKIN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_REPLACE_PLAIN", HW_API_replace_In::PLAIN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_REPLACE_REVERT_IF_NOT_CHANGED", HW_API_replace_In::REVERT_IF_NOT_CHANGED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_REPLACE_KEEP_TIME_MODIFIED", HW_API_replace_In::KEEP_TIME_MODIFIED, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("HW_API_INSERT_NORMAL", HW_API_insert_In::NORMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_INSERT_FORCE_VERSION_CONTROL", HW_API_insert_In::FORCE_VERSION_CONTROL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_INSERT_AUTOMATIC_CHECKOUT", HW_API_insert_In::AUTOMATIC_CHECKOUT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_INSERT_PLAIN", HW_API_insert_In::PLAIN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_INSERT_KEEP_TIME_MODIFIED", HW_API_insert_In::KEEP_TIME_MODIFIED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_INSERT_DELAY_INDEXING", HW_API_insert_In::DELAY_INDEXING, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("HW_API_LOCK_NORMAL", HW_API_lock_In::NORMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_LOCK_RECURSIVE", HW_API_lock_In::RECURSIVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_LOCK_SESSION", HW_API_lock_In::SESSION, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("HW_API_CONTENT_ALLLINKS", HW_API_content_In::ALLLINKS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_CONTENT_REACHABLELINKS", HW_API_content_In::REACHABLELINKS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_CONTENT_PLAIN", HW_API_content_In::PLAIN, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("HW_API_REASON_ERROR", HW_API_Reason::HW_API_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_REASON_WARNING", HW_API_Reason::HW_API_WARNING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_API_REASON_MESSAGE", HW_API_Reason::HW_API_MESSAGE, CONST_CS | CONST_PERSISTENT);
-
- /* Make sure there are at least default values, though the MessageFilePath
- * is bogus. If it isn't set at all the web server dies.
- */
- HW_API_init_In initargs;
- initargs.setArgv0("PHP HWAPI");
- initargs.setMessageFilePath("");
- HW_API::init(initargs);
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(hwapi) {
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(hwapi) {
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(hwapi) {
- php_info_print_table_start();
- php_info_print_table_row(2, "Hyperwave API Support", "enabled");
- php_info_print_table_end();
-}
-
-/* {{{ proto string hwapi_dummy(int link, int id, int msgid)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_dummy) {
- pval **arg1, **arg2, **arg3;
- int link, id, type, msgid;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void hwapi_init(string hostname, int port)
- Hyperwave initialisation */
-PHP_FUNCTION(hwapi_init) {
- zval **argv[2], *id;
- HW_API_init_In initargs;
- HW_API_init_Out out;
- int ret;
- HW_API_HGCSP *db;
- zval *rv;
- int argc = ZEND_NUM_ARGS();
-
- if (((argc < 1) || (argc > 2)) || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- id = getThis();
-
- convert_to_string_ex(argv[0]);
- initargs.setArgv0("PHP HWAPI");
- initargs.setMessageFilePath(Z_STRVAL_PP(argv[0]));
- if(argc == 2) {
- convert_to_string_ex(argv[1]);
- initargs.setWhatString(Z_STRVAL_PP(argv[1])) ;
- }
- if(id) {
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
- if(!db) {
- RETURN_FALSE;
- }
- out = db->init(initargs);
- } else {
- out = HW_API::init(initargs);
- }
-
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string hwapi_hgcsp(string hostname, int port)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_hgcsp) {
- zval **argv[2];
- HW_API_HGCSP *db;
- zval *rv;
- int argc = ZEND_NUM_ARGS();
-
- if (((argc < 1) || (argc > 2)) || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(argv[0]);
- if(argc == 2) {
- convert_to_long_ex(argv[1]);
- db = new HW_API_HGCSP(Z_STRVAL_PP(argv[0]), Z_LVAL_PP(argv[1]));
- } else {
- db = new HW_API_HGCSP(Z_STRVAL_PP(argv[0]));
- }
-
- rv = php_hwapi_object_new((HW_API_HGCSP *) db, le_hwapip);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
-// ret = zend_list_insert(db, le_hwapip);
-
- /* construct an object with some methods */
-// object_init_ex(return_value, hw_api_class_entry_ptr);
-// add_property_resource(return_value, "this", ret);
-}
-/* }}} */
-
-/* {{{ proto object hwapi_object(array object_in)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_object) {
- pval **arg1, *rv, *id;
- HW_API_Object *newobj;
- HW_API_object_In *in;
- HW_API_object_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_object_In(*arg1);
-
- out = db->object(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- }
-
- //Frage: Diese Zeile erzeugt erst mit dem Konstruktor von HW_API_Object
- //eine Kopie und danach durch das assign. Wie kann man das verhindern.
- newobj = new HW_API_Object();
- *newobj = out.object();
-// newobj = new HW_API_Object(out.object());
-
- rv = php_hwapi_object_new(newobj, le_hwapi_objectp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_mychildren(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_mychildren) {
- zval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_children_In *in;
- HW_API_children_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = new HW_API_children_In();
- in->setObjectIdentifier(Z_STRVAL_PP(arg1));
- out = db->children(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- objarr = (HW_API_ObjectArray) out.objects();
- }
-
- array_init(return_value);
-
- for(i=0; i<objarr.count(); i++) {
- zval *child;
- HW_API_Object obj, *objp;
- objarr.object(i, obj);
- objp = new HW_API_Object(obj);
- child = php_hwapi_object_new(objp, le_hwapi_objectp);
- add_next_index_zval(return_value, child);
- }
- return;
- for(i=0; i<objarr.count(); i++) {
- HW_API_Object obj;
- HW_API_Attribute attr;
- objarr.object(i, obj);
- obj.attribute("GOid", attr);
- add_next_index_string(return_value, (char *) attr.value().string(), 1);
- }
-}
-/* }}} */
-
-/* {{{ proto string hwapi_children(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_children) {
- zval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_children_In *in;
- HW_API_children_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_children_In(*arg1);
-
- out = db->children(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- objarr = (HW_API_ObjectArray) out.objects();
- }
-
- objectArray2indexArray(&return_value, &objarr);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_parents(string hostname, int port)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_parents) {
- zval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_parents_In *in;
- HW_API_parents_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_parents_In(*arg1);
-
- out = db->parents(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- objarr = (HW_API_ObjectArray) out.objects();
- }
-
- objectArray2indexArray(&return_value, &objarr);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_find(array parameters)
- Finds objects */
-PHP_FUNCTION(hwapi_find) {
- zval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_find_In *in;
- HW_API_find_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_find_In(*arg1);
-
- out = db->find(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- }
- objarr = (HW_API_ObjectArray) out.objects();
-
- /* FIXME: No a good idea to return just the objects. There is actually
- * more to return. Changing this to an object of type hw_api_find_out would
- * mean to change hw_api_parents() and hw_api_children() as well. */
- array_init(return_value);
-
- /* FIXME: More than just the list of objects is returned by find() */
- if(0 == objectArray2indexArray(&rv, &objarr)) {
- RETURN_FALSE;
- }
- zend_hash_add(return_value->value.ht, "objects", 8, &rv, sizeof(zval *), NULL);
- add_assoc_long(return_value, "endIndex", out.endIndex());
- add_assoc_bool(return_value, "haveMore", out.haveMore() ? true : false);
- add_assoc_long(return_value, "numberOfThingsFound", out.numberOfThingsFound());
-}
-/* }}} */
-
-/* {{{ proto string hwapi_identify(string hostname, int port)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_identify) {
- pval **arg1, *id, *rv;
- HW_API_identify_In *in;
- HW_API_identify_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_identify_In(*arg1);
-
- out = db->identify(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- }
-
- printf("hwapi_identify\n");
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string hwapi_remove(array parameters)
- Remove an object */
-PHP_FUNCTION(hwapi_remove) {
- pval **arg1, *id, *rv;
- HW_API_remove_In *in;
- HW_API_remove_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_remove_In(*arg1);
-
- out = db->remove(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- }
-
- printf("hwapi_remove\n");
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string hwapi_content(string hostname, int port)
- Retrieve content of object */
-PHP_FUNCTION(hwapi_content) {
- pval **arg1, *id, *rv;
- HW_API_content_In *in;
- HW_API_content_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_content_In(*arg1);
-
- out = db->content(*in);
- delete in;
- if (!out.error().error()) {
- HW_API_Content *content = new HW_API_Content(out.content());
- rv = php_hwapi_object_new(content, le_hwapi_contentp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_copy(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_copy) {
- pval **arg1, *id, *rv;
- HW_API_copy_In *in;
- HW_API_copy_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_copy_In(*arg1);
-
- out = db->copy(*in);
- delete in;
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new((HW_API_Object*) object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
- printf("hwapi_copy\n");
-}
-/* }}} */
-
-/* {{{ proto string hwapi_link(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_link) {
- pval **arg1, *id, *rv;
- HW_API_link_In *in;
- HW_API_link_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_link_In(*arg1);
-
- out = db->link(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- }
-
- printf("hwapi_link\n");
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string hwapi_move(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_move) {
- pval **arg1, *id, *rv;
- HW_API_move_In *in;
- HW_API_move_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_move_In(*arg1);
-
- out = db->move(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- }
-
- printf("hwapi_move\n");
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string hwapi_lock(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_lock) {
- pval **arg1, *id, *rv;
- HW_API_lock_In *in;
- HW_API_lock_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_lock_In(*arg1);
-
- out = db->lock(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- }
-
- printf("hwapi_lock\n");
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string hwapi_unlock(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_unlock) {
- pval **arg1, *id, *rv;
- HW_API_unlock_In *in;
- HW_API_unlock_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_unlock_In(*arg1);
-
- out = db->unlock(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- }
-
- printf("hwapi_unlock\n");
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string hwapi_replace(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_replace) {
- pval **arg1, *id, *rv;
- HW_API_replace_In *in;
- HW_API_replace_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_replace_In(*arg1);
-
- out = db->replace(*in);
- delete in;
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_insert(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_insert) {
- pval **arg1, *id, *rv;
- HW_API_insert_In *in;
- HW_API_insert_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_insert_In(*arg1);
-
- out = db->insert(*in);
- delete in;
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_insertdocument(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_insertdocument) {
- pval **arg1, *id, *rv;
- HW_API_insertDocument_In *in;
- HW_API_insertDocument_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_insertDocument_In(*arg1);
-
- out = db->insertDocument(*in);
- delete in;
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
- printf("hwapi_insertdocument\n");
-}
-/* }}} */
-
-/* {{{ proto string hwapi_insertcollection(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_insertcollection) {
- pval **arg1, *id, *rv;
- HW_API_insertCollection_In *in;
- HW_API_insertCollection_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_insertCollection_In(*arg1);
-
- out = db->insertCollection(*in);
- delete in;
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new((HW_API_Error *) &err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
- printf("hwapi_insertcollection\n");
-}
-/* }}} */
-
-/* {{{ proto string hwapi_insertanchor(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_insertanchor) {
- pval **arg1, *id, *rv;
- HW_API_insertAnchor_In *in;
- HW_API_insertAnchor_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_insertAnchor_In(*arg1);
-
- out = db->insertAnchor(*in);
- delete in;
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
- printf("hwapi_insertanchor\n");
-}
-/* }}} */
-
-/* {{{ proto string hwapi_srcanchors(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_srcanchors) {
- pval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_srcAnchors_In *in;
- HW_API_srcAnchors_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_srcAnchors_In(*arg1);
-
- out = db->srcAnchors(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- objarr = (HW_API_ObjectArray) out.objects();
- }
-
- objectArray2indexArray(&return_value, &objarr);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_dstanchors(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_dstanchors) {
- pval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_dstAnchors_In *in;
- HW_API_dstAnchors_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_dstAnchors_In(*arg1);
-
- out = db->dstAnchors(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- objarr = (HW_API_ObjectArray) out.objects();
- }
-
- objectArray2indexArray(&return_value, &objarr);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_objectbyanchor(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_objectbyanchor) {
- pval **arg1, *id, *rv;
- HW_API_objectByAnchor_In *in;
- HW_API_objectByAnchor_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_objectByAnchor_In(*arg1);
- /* FIXME: return value of any make_HW_API_xxx function should be checked
- * for NULL
- */
-
- out = db->objectByAnchor(*in);
- delete in;
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
- printf("hwapi_objectbyanchor\n");
-}
-/* }}} */
-
-/* {{{ proto string hwapi_dstofsrcanchor(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_dstofsrcanchor) {
- pval **arg1, *id, *rv;
- HW_API_dstOfSrcAnchor_In *in;
- HW_API_dstOfSrcAnchor_Out out;
- HW_API_HGCSP *db;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_dstOfSrcAnchor_In(*arg1);
-
- out = db->dstOfSrcAnchor(*in);
- delete in;
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
- printf("hwapi_dstofsrcanchor\n");
-}
-/* }}} */
-
-/* {{{ proto string hwapi_srcsofdst(array parameters)
- Hyperwave dummy function */
-PHP_FUNCTION(hwapi_srcsofdst) {
- pval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_srcsOfDst_In *in;
- HW_API_srcsOfDst_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_srcsOfDst_In(*arg1);
-
- out = db->srcsOfDst(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- objarr = (HW_API_ObjectArray) out.objects();
- }
-
- objectArray2indexArray(&return_value, &objarr);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_checkin(array parameters)
- Checking in a document */
-PHP_FUNCTION(hwapi_checkin) {
- pval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_checkIn_In *in;
- HW_API_checkIn_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_checkIn_In(*arg1);
-
- out = db->checkIn(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- RETURN_TRUE;
- }
-
- printf("hwapi_checkin\n");
-}
-/* }}} */
-
-/* {{{ proto string hwapi_checkout(array parameters)
- Checking out a document */
-PHP_FUNCTION(hwapi_checkout) {
- pval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_checkOut_In *in;
- HW_API_checkOut_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_checkOut_In(*arg1);
-
- out = db->checkOut(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- RETURN_TRUE;
- }
-
- printf("hwapi_checkout\n");
-}
-/* }}} */
-
-/* {{{ proto string hwapi_setcommittedversion(array parameters)
- setcommittedversion */
-PHP_FUNCTION(hwapi_setcommittedversion) {
- pval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_setCommittedVersion_In *in;
- HW_API_setCommittedVersion_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_setCommittedVersion_In(*arg1);
-
- out = db->setCommittedVersion(*in);
- delete in;
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
- printf("hwapi_setcommittedversion\n");
-}
-/* }}} */
-
-/* {{{ proto string hwapi_revert(array parameters)
- Reverting to a former document */
-PHP_FUNCTION(hwapi_revert) {
- pval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_revert_In *in;
- HW_API_revert_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_revert_In(*arg1);
-
- out = db->revert(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- RETURN_TRUE;
- }
-
- printf("hwapi_revert\n");
-}
-/* }}} */
-
-/* {{{ proto string hwapi_history(array parameters)
- history */
-PHP_FUNCTION(hwapi_history) {
- pval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_history_In *in;
- HW_API_history_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_history(*arg1);
-
- out = db->history(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- objarr = (HW_API_ObjectArray) out.objects();
- }
-
- objectArray2indexArray(&return_value, &objarr);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_removeversion(array parameters)
- Reverting to a former document */
-PHP_FUNCTION(hwapi_removeversion) {
- pval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_removeVersion_In *in;
- HW_API_removeVersion_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_removeVersion_In(*arg1);
-
- out = db->removeVersion(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- RETURN_TRUE;
- }
-
- printf("hwapi_removeversion\n");
-}
-/* }}} */
-
-/* {{{ proto object hwapi_freeversion(array parameters)
- freeversion */
-PHP_FUNCTION(hwapi_freeversion) {
- pval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_freeVersion_In *in;
- HW_API_freeVersion_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_freeVersion_In(*arg1);
-
- out = db->freeVersion(*in);
- delete in;
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
- printf("hwapi_freeversion\n");
-}
-/* }}} */
-
-/* {{{ proto array hwapi_configurationhistory(array parameters)
- Returns configuration history of object */
-PHP_FUNCTION(hwapi_configurationhistory) {
- zval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_configurationHistory_In *in;
- HW_API_configurationHistory_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_configurationHistory_In(*arg1);
-
- out = db->configurationHistory(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- objarr = (HW_API_ObjectArray) out.objects();
- }
-
- objectArray2indexArray(&return_value, &objarr);
-}
-/* }}} */
-
-/* {{{ proto object hwapi_saveconfiguration(array parameters)
- Save configuration for an object */
-PHP_FUNCTION(hwapi_saveconfiguration) {
- pval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_saveConfiguration_In *in;
- HW_API_saveConfiguration_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_saveConfiguration_In(*arg1);
-
- out = db->saveConfiguration(*in);
- delete in;
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
- printf("hwapi_saveconfiguration\n");
-}
-/* }}} */
-
-/* {{{ proto object hwapi_restoreconfiguration(array parameters)
- Restore configuration for an object */
-PHP_FUNCTION(hwapi_restoreconfiguration) {
- pval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_restoreConfiguration_In *in;
- HW_API_restoreConfiguration_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_restoreConfiguration_In(*arg1);
-
- out = db->restoreConfiguration(*in);
- delete in;
- if (!out.error().error()) {
- RETURN_STRING((char *) (out.progressIdentifier().string()), 1);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
- printf("hwapi_restoreconfiguration\n");
-}
-/* }}} */
-
-/* {{{ proto object hwapi_mergeconfiguration(array parameters)
- Merge configuration for an object */
-PHP_FUNCTION(hwapi_mergeconfiguration) {
- pval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_mergeConfiguration_In *in;
- HW_API_mergeConfiguration_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_mergeConfiguration_In(*arg1);
-
- out = db->mergeConfiguration(*in);
- delete in;
- if (!out.error().error()) {
- RETURN_STRING((char *) (out.progressIdentifier().string()), 1);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
- printf("hwapi_mergeconfiguration\n");
-}
-/* }}} */
-
-/* {{{ proto object hwapi_removeconfiguration(array parameters)
- Removes configuration */
-PHP_FUNCTION(hwapi_removeconfiguration) {
- pval **arg1, *id, *rv;
- HW_API_ObjectArray objarr;
- HW_API_removeConfiguration_In *in;
- HW_API_removeConfiguration_Out out;
- HW_API_HGCSP *db;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- in = make_HW_API_removeConfiguration_In(*arg1);
-
- out = db->removeConfiguration(*in);
- delete in;
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- RETURN_TRUE;
- }
-
- printf("hwapi_removeconfiguration\n");
-}
-/* }}} */
-
-/* {{{ proto string hwapi_user(array parameters)
- Returns information about user */
-PHP_FUNCTION(hwapi_user) {
- pval **arg1, *id, *rv;
- HW_API_user_In *in;
- HW_API_user_Out out;
- HW_API_HGCSP *db;
- int argc;
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- argc = ZEND_NUM_ARGS();
- switch(argc) {
- case 0:
- out = db->user(HW_API_user_In());
- break;
- case 1:
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
- in = make_HW_API_user_In(*arg1);
- if(NULL == in)
- out = db->user(HW_API_user_In());
- else
- out = db->user(*in);
- delete in;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
-}
-/* }}} */
-
-/* {{{ proto string hwapi_userlist(array parameters)
- Returns list of login in users */
-PHP_FUNCTION(hwapi_userlist) {
- zval **arg1, *id, *rv;
- HW_API_userlist_In *in;
- HW_API_userlist_Out out;
- HW_API_ObjectArray objarr;
- HW_API_HGCSP *db;
- int i;
- int argc;
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- argc = ZEND_NUM_ARGS();
- switch(argc) {
- case 0:
- out = db->userlist(HW_API_userlist_In());
- break;
- case 1:
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
- in = make_HW_API_userlist_In(*arg1);
- if(NULL == in)
- out = db->userlist(HW_API_userlist_In());
- else
- out = db->userlist(*in);
- delete in;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- if (out.error().error()) {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- objarr = (HW_API_ObjectArray) out.objects();
- }
-
- objectArray2indexArray(&return_value, &objarr);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_hwstat(array parameters)
- Returns information about hgserver */
-PHP_FUNCTION(hwapi_hwstat) {
- pval **arg1, *id, *rv;
- HW_API_hwStat_In *in;
- HW_API_hwStat_Out out;
- HW_API_HGCSP *db;
- int argc;
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- argc = ZEND_NUM_ARGS();
- switch(argc) {
- case 0:
- out = db->hwStat(HW_API_hwStat_In());
- break;
- case 1:
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
- in = make_HW_API_hwStat_In(*arg1);
- if(NULL == in)
- out = db->hwStat(HW_API_hwStat_In());
- else
- out = db->hwStat(*in);
- delete in;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_dcstat(array parameters)
- Returns information about hgserver */
-PHP_FUNCTION(hwapi_dcstat) {
- pval **arg1, *id, *rv;
- HW_API_dcStat_In *in;
- HW_API_dcStat_Out out;
- HW_API_HGCSP *db;
- int argc;
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- argc = ZEND_NUM_ARGS();
- switch(argc) {
- case 0:
- out = db->dcStat(HW_API_dcStat_In());
- break;
- case 1:
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
- in = make_HW_API_dcStat_In(*arg1);
- if(NULL == in)
- out = db->dcStat(HW_API_dcStat_In());
- else
- out = db->dcStat(*in);
- delete in;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_dbstat(array parameters)
- Returns information about hgserver */
-PHP_FUNCTION(hwapi_dbstat) {
- pval **arg1, *id, *rv;
- HW_API_dbStat_In *in;
- HW_API_dbStat_Out out;
- HW_API_HGCSP *db;
- int argc;
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- argc = ZEND_NUM_ARGS();
- switch(argc) {
- case 0:
- out = db->dbStat(HW_API_dbStat_In());
- break;
- case 1:
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
- in = make_HW_API_dbStat_In(*arg1);
- if(NULL == in)
- out = db->dbStat(HW_API_dbStat_In());
- else
- out = db->dbStat(*in);
- delete in;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_ftstat(array parameters)
- Returns information about ftserver */
-PHP_FUNCTION(hwapi_ftstat) {
- pval **arg1, *id, *rv;
- HW_API_ftStat_In *in;
- HW_API_ftStat_Out out;
- HW_API_HGCSP *db;
- int argc;
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- argc = ZEND_NUM_ARGS();
- switch(argc) {
- case 0:
- out = db->ftStat(HW_API_ftStat_In());
- break;
- case 1:
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
- in = make_HW_API_ftStat_In(*arg1);
- if(NULL == in)
- out = db->ftStat(HW_API_ftStat_In());
- else
- out = db->ftStat(*in);
- delete in;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- if (!out.error().error()) {
- HW_API_Object *object = new HW_API_Object(out.object());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_info(array parameters)
- Returns information about server */
-PHP_FUNCTION(hwapi_info) {
- pval **arg1, *id, *rv, *rv1, *rv2, *rv3;
- HW_API_info_In *in;
- HW_API_info_Out out;
- HW_API_HGCSP *db;
- int argc;
-
- id = getThis();
- db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
-
- if(!db) {
- RETURN_FALSE;
- }
-
- argc = ZEND_NUM_ARGS();
- switch(argc) {
- case 0:
- out = db->info(HW_API_info_In());
- break;
- case 1:
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
- in = make_HW_API_info_In(*arg1);
- if(NULL == in)
- out = db->info(HW_API_info_In());
- else
- out = db->info(*in);
- delete in;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- if (!out.error().error()) {
- HW_API_StringArray languages, customidx, systemidx;
- array_init(return_value);
- HW_API_Object *object = new HW_API_Object(out.typeInfo());
- rv = php_hwapi_object_new(object, le_hwapi_objectp);
- zend_hash_add(return_value->value.ht, "typeInfo", 9, &rv, sizeof(zval *), NULL);
- languages = out.languages();
- MAKE_STD_ZVAL(rv1);
- if(0 == stringArray2indexArray(&rv1, &languages))
- RETURN_FALSE;
- zend_hash_add(return_value->value.ht, "languages", 10, &rv1, sizeof(zval *), NULL);
- customidx = out.customIdx();
- MAKE_STD_ZVAL(rv2);
- if(0 == stringArray2indexArray(&rv2, &customidx))
- RETURN_FALSE;
- zend_hash_add(return_value->value.ht, "customIdx", 10, &rv2, sizeof(zval *), NULL);
- systemidx = out.systemIdx();
- MAKE_STD_ZVAL(rv3);
- if(0 == stringArray2indexArray(&rv3, &systemidx))
- RETURN_FALSE;
- zend_hash_add(return_value->value.ht, "systemIdx", 10, &rv3, sizeof(zval *), NULL);
- } else {
- HW_API_Error *err = new HW_API_Error(out.error());
- rv = php_hwapi_object_new(err, le_hwapi_errorp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- }
-}
-/* }}} */
-
-/* {{{ proto string hwapi_object_new()
- Creates new HW_API_Object */
-PHP_FUNCTION(hwapi_object_new) {
- pval **arg1, **arg2, *rv;
- HW_API_Object *obj;
- const HW_API_Object *srcobj;
- int ret;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- obj = new HW_API_Object();
- break;
- case 1:
- if (zend_get_parameters_ex(1, &arg1) == FAILURE)
- WRONG_PARAM_COUNT;
- srcobj = (const HW_API_Object *) php_hwapi_get_object(*arg1, le_hwapi_objectp);
- obj = new HW_API_Object(*srcobj);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- rv = php_hwapi_object_new(obj, le_hwapi_objectp);
-//zend_print_pval_r(rv, 0);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_object_count()
- Counts number of attributes of an HW_API_Object */
-PHP_FUNCTION(hwapi_object_count) {
- zval *id, **tmp;
- HW_API_Object *objp;
- int value;
-
- id = getThis();
- objp = (HW_API_Object *) php_hwapi_get_object(id, le_hwapi_objectp);
-
- if(!objp) {
- RETURN_FALSE;
- }
- value = objp->count();
-
- RETURN_LONG(value);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_object_title(string language)
- Returns title of HW_API_Object for given language */
-PHP_FUNCTION(hwapi_object_title) {
- zval **arg1, *id, **tmp;
- HW_API_Object *objp;
- char *value;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = getThis();
- objp = (HW_API_Object *) php_hwapi_get_object(id, le_hwapi_objectp);
-
- convert_to_string_ex(arg1);
-
- // Warning: It is import to duplicate the string before RETURN.
- // If that is not done the HW_API_String destructor will be called
- // before RETURN_STRING can duplicate the string.
- value = (char *) estrdup(objp->title(Z_STRVAL_PP(arg1)).string());
-
- RETURN_STRING(value, 0);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_object_attreditable(int attr, string username, bool is_system)
- Hyperwave object_attreditable function */
-PHP_FUNCTION(hwapi_object_attreditable) {
- zval *id, **arg1, **arg2, **arg3;
- HW_API_Object *objp;
- HW_API_Attribute *attrp;
- bool value;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = getThis();
- objp = (HW_API_Object *) php_hwapi_get_object(id, le_hwapi_objectp);
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- switch(Z_TYPE_PP(arg1)) {
- case IS_STRING:
- convert_to_string_ex(arg1);
- value = objp->attributeEditable((char *) Z_STRVAL_PP(arg1), (char *) Z_STRVAL_PP(arg2), (bool) Z_LVAL_PP(arg3));
- break;
- case IS_OBJECT:
- attrp = (HW_API_Attribute *) php_hwapi_get_object(*arg1, le_hwapi_attributep);
- value = objp->attributeEditable(*attrp, (char *) Z_STRVAL_PP(arg2), (bool) Z_LVAL_PP(arg3));
- break;
- }
- if(value) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto object hwapi_object_assign(int object)
- Hyperwave object_assign function */
-PHP_FUNCTION(hwapi_object_assign) {
- zval *id, **arg1, **arg2;
-
- printf("hwapi_object_assign\n");
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string hwapi_object_attribute(int index, object &attribute)
- Hyperwave object_attribute function */
-PHP_FUNCTION(hwapi_object_attribute) {
- zval **arg1, *id, *rv;
- HW_API_Attribute *attrp, attr;
- HW_API_Object *objp;
- int error;
-
- if ((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- id = getThis();
- objp = (HW_API_Object *) php_hwapi_get_object(id, le_hwapi_objectp);
- if(!objp) {
- RETURN_FALSE;
- }
-
- switch(Z_TYPE_PP(arg1)) {
- case IS_LONG:
- error = objp->attribute(Z_LVAL_PP(arg1), attr);
- break;
- case IS_STRING:
- error = objp->attribute(HW_API_String(Z_STRVAL_PP(arg1)), attr);
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "HW_API_Object::attribute() needs string or long as parameter");
- RETURN_FALSE;
- }
-
- if(error) {
- attrp = new HW_API_Attribute(attr);
- rv = php_hwapi_object_new(attrp, le_hwapi_attributep);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string hwapi_object_insert(object attr)
- Inserts new HW_API_Attribute into HW_API_Object */
-PHP_FUNCTION(hwapi_object_insert) {
- zval **arg1, *id;
- HW_API_Object *objp;
- HW_API_Attribute *attrp;
- char *value;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &arg1) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
- id = getThis();
- objp = (HW_API_Object *) php_hwapi_get_object(id, le_hwapi_objectp);
- if(!objp) {
- RETURN_FALSE;
- }
- attrp = (HW_API_Attribute *) php_hwapi_get_object(*arg1, le_hwapi_attributep);
-
- objp->insert(*attrp);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string hwapi_object_remove(string name)
- Removes HW_API_Attribute with given name from HW_API_Object */
-PHP_FUNCTION(hwapi_object_remove) {
- zval **arg1, *id, **tmp;
- HW_API_Object *objp;
- int error;
-
- if ((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- id = getThis();
- objp = (HW_API_Object *) php_hwapi_get_object(id, le_hwapi_objectp);
- if(!objp) {
- RETURN_FALSE;
- }
-
- error = objp->remove(Z_STRVAL_PP(arg1));
-
- if(!error) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string hwapi_object_value(string name)
- Returns attribute value of given attribute */
-PHP_FUNCTION(hwapi_object_value) {
- zval **arg1, *id;
- HW_API_Object *objp;
- HW_API_Attribute *attrp;
- HW_API_String value;
- int error;
-
- if ((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- id = getThis();
- objp = (HW_API_Object *) php_hwapi_get_object(id, le_hwapi_objectp);
- if(!objp) {
- RETURN_FALSE;
- }
-
- error = objp->value((HW_API_String) Z_STRVAL_PP(arg1), value);
-
- printf("hwapi_object_value\n");
- if(error) {
- char *str = (char *) estrdup(value.string());
- RETURN_STRING(str, 0);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string hwapi_attribute_new([string name][, string value])
- Creates new HW_API_Attribute */
-PHP_FUNCTION(hwapi_attribute_new) {
- zval *rv, **arg1, **arg2;
- HW_API_Attribute *attrp;
- int ret;
-
- /* FIXME: I'm not sure if the constructor of HW_API_Attribute takes normal C-Strings
- * or if it has to be HW_API_String. Currently C-Strings are passed.
- */
- switch(ZEND_NUM_ARGS()) {
- case 0:
- break;
- attrp = new HW_API_Attribute();
- case 1:
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- attrp = new HW_API_Attribute(Z_STRVAL_PP(arg1));
- break;
- case 2: //* FIXME: Second Parameter can be string or array of strings
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- switch((*arg2)->type) {
- case IS_ARRAY: {
- HashTable *lht = (*arg2)->value.ht;
- int i, count;
- HW_API_StringArray values;
- if(NULL == lht)
- RETURN_FALSE;
-
- if(0 == (count = zend_hash_num_elements(lht))) {
- attrp = new HW_API_Attribute(Z_STRVAL_PP(arg1));
- break;
- }
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- zval *keydata, **keydataptr;
- zend_hash_get_current_data(lht, (void **) &keydataptr);
- /* FIXME: just hope this doesn't do any harm. Maybe convert_to_string
- * changes the type of the array element */
- convert_to_string_ex(keydataptr);
- keydata = *keydataptr;
- values.insert(keydata->value.str.val);
- zend_hash_move_forward(lht);
- }
- attrp = new HW_API_Attribute(Z_STRVAL_PP(arg1), values);
- break;
- }
- default:
- convert_to_string_ex(arg2);
- attrp = new HW_API_Attribute(Z_STRVAL_PP(arg1), Z_STRVAL_PP(arg2));
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- rv = php_hwapi_object_new(attrp, le_hwapi_attributep);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
- printf("hwapi_attribute_new\n");
-}
-/* }}} */
-
-/* {{{ proto string hwapi_attribute_key()
- Returns key of an hwapi_attribute */
-PHP_FUNCTION(hwapi_attribute_key) {
- zval *id;
- HW_API_Attribute *attrp;
- char *value;
-
- id = getThis();
- attrp = (HW_API_Attribute *) php_hwapi_get_object(id, le_hwapi_attributep);
-
- // Warning: It is import to duplicate the string before RETURN.
- // If that is not done the HW_API_String destructor will be called
- // before RETURN_STRING can duplicate the string.
- value = (char *) estrdup((attrp->key()).string());
-
- RETURN_STRING(value, 0);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_attribute_value()
- Returns value of hw_api_attribute */
-PHP_FUNCTION(hwapi_attribute_value) {
- zval *id;
- HW_API_Attribute *attrp;
- char *value;
-
- id = getThis();
- attrp = (HW_API_Attribute *) php_hwapi_get_object(id, le_hwapi_attributep);
-
- // Warning: It is import to duplicate the string before RETURN.
- // If that is not done the HW_API_String destructor will be called
- // before RETURN_STRING can duplicate the string.
- value = (char *) estrdup(attrp->value().string());
-
- RETURN_STRING(value, 0);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_attribute_values()
- Returns all values of an attribute as an array */
-PHP_FUNCTION(hwapi_attribute_values) {
- zval *id, **tmp;
- HW_API_Attribute *attrp;
- HW_API_StringArray values;
-
- id = getThis();
- attrp = (HW_API_Attribute *) php_hwapi_get_object(id, le_hwapi_attributep);
-
- values = attrp->values();
- if(0 == stringArray2indexArray(&return_value, &values))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string hwapi_attribute_langdepvalue(string language)
- Returns value of attribute with givenn language */
-PHP_FUNCTION(hwapi_attribute_langdepvalue) {
- zval **arg1, *id, **tmp;
- HW_API_Attribute *attrp;
- char *value;
-
- if((ZEND_NUM_ARGS() != 1) || (zend_get_parameters_ex(1, &arg1) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
-
- id = getThis();
- attrp = (HW_API_Attribute *) php_hwapi_get_object(id, le_hwapi_attributep);
-
- value = (char *) attrp->langDepValue((*arg1)->value.str.val).string();
- printf("hwapi_attribute_langdepvalue\n");
- RETURN_STRING(value, 1);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_content_new([string name][, string value])
- Creates new HW_API_Content */
-PHP_FUNCTION(hwapi_content_new) {
- zval *rv, **arg1, **arg2, **arg3;
- HW_API_Content *contp;
- int ret;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- contp = new HW_API_Content();
- break;
- case 1:
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch((*arg1)->type) {
- case IS_OBJECT:
- break;
- default:
- convert_to_string_ex(arg1);
- contp = new HW_API_Content(Z_STRVAL_PP(arg1));
- }
- break;
- case 2: //First Parameter is long, second the file name
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_string_ex(arg2);
- contp = new HW_API_Content(HW_API_Content::File, Z_STRVAL_PP(arg2));
- break;
- case 3: //First Parameter is long or string, second and third is string
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch((*arg1)->type) {
- case IS_LONG:
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- contp = new HW_API_Content(HW_API_Content::File, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
- break;
- default:
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- contp = new HW_API_Content(Z_STRVAL_PP(arg1), Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- rv = php_hwapi_object_new(contp, le_hwapi_contentp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_content_read(string buffer, int length)
- Reads length bytes from content */
-PHP_FUNCTION(hwapi_content_read) {
- zval **arg1, **arg2, *id, **tmp;
- HW_API_Content *contentp;
- char *value;
- int len;
-
- if((ZEND_NUM_ARGS() != 2) || (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg2);
-
- id = getThis();
- contentp = (HW_API_Content *) php_hwapi_get_object(id, le_hwapi_contentp);
-
- zval_dtor(*arg1);
- Z_TYPE_PP(arg1) = IS_STRING;
- /* FIXME: Need to finish the new zval */
- value = (char *) emalloc(Z_LVAL_PP(arg2)+1);
-
- Z_STRVAL_PP(arg1) = value;
- len = contentp->read(value, Z_LVAL_PP(arg2));
- value[len] = '\0';
- Z_STRLEN_PP(arg1) = len;
-
- RETURN_LONG(len);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_content_mimetype()
- Returns MimeType of document */
-PHP_FUNCTION(hwapi_content_mimetype) {
- zval *id;
- HW_API_Content *contentp;
- HW_API_String hwstr;
-
- id = getThis();
- contentp = (HW_API_Content *) php_hwapi_get_object(id, le_hwapi_contentp);
-
- hwstr = contentp->mimetype();
-
- RETURN_STRING((char *) hwstr.string(), 1);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_error_count()
- Counts number of reasons of an HW_API_Error */
-PHP_FUNCTION(hwapi_error_count) {
- zval *id, **tmp;
- HW_API_Error *objp;
- int value;
-
- id = getThis();
- objp = (HW_API_Error *) php_hwapi_get_object(id, le_hwapi_errorp);
-
- if(!objp) {
- RETURN_FALSE;
- }
- value = objp->count();
-
- RETURN_LONG(value);
-}
-/* }}} */
-
-/* {{{ proto string hwapi_error_reason(int index)
- Returns a reason of an HW_API_Error */
-PHP_FUNCTION(hwapi_error_reason) {
- zval **arg1, *id, **tmp;
- HW_API_Error *objp;
- HW_API_Reason reason;
- bool error;
-
- if((ZEND_NUM_ARGS() != 1) || (zend_get_parameters_ex(1, &arg1) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
-
- id = getThis();
- objp = (HW_API_Error *) php_hwapi_get_object(id, le_hwapi_errorp);
-
- if(!objp) {
- RETURN_FALSE;
- }
- if(!objp->error())
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This is not an error");
-
- error = objp->reason(Z_LVAL_PP(arg1), reason);
- if(error) {
- zval *rv;
- HW_API_Reason *reasonp = new HW_API_Reason(reason);
- rv = php_hwapi_object_new(reasonp, le_hwapi_reasonp);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string hwapi_reason_type()
- Returns the type of HW_API_Reason */
-PHP_FUNCTION(hwapi_reason_type) {
- zval **arg1, *id, **tmp;
- HW_API_Reason *objp;
-
- id = getThis();
- objp = (HW_API_Reason *) php_hwapi_get_object(id, le_hwapi_reasonp);
-
- if(!objp) {
- RETURN_FALSE;
- }
- RETURN_LONG((long) (objp->type()));
-}
-/* }}} */
-
-/* {{{ proto string hwapi_reason_description(string language)
- Returns description of HW_API_Reason */
-PHP_FUNCTION(hwapi_reason_description) {
- zval **arg1, *id, **tmp;
- HW_API_Reason *objp;
- HW_API_String desc;
-
- if((ZEND_NUM_ARGS() != 1) || (zend_get_parameters_ex(1, &arg1) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
-
- id = getThis();
- objp = (HW_API_Reason *) php_hwapi_get_object(id, le_hwapi_reasonp);
-
- if(!objp) {
- RETURN_FALSE;
- }
- desc = objp->description((HW_API_String) (Z_STRVAL_PP(arg1)));
- RETURN_STRING((char *) desc.string(), 1);
-}
-/* }}} */
-
-/* hw_api_class_get_property(zend_property_reference *property_reference) {{{
- *
- */
-pval hw_api_class_get_property(zend_property_reference *property_reference) {
- pval result;
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
-
-
- printf("Reading a property from a HW_API object:\n");
-
- for (element=property_reference->elements_list->head; element; element=element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch (Z_TYPE_P(overloaded_property)) {
- case OE_IS_ARRAY:
- printf("Array offset: ");
- break;
- case OE_IS_OBJECT:
- printf("Object property: ");
- break;
- }
- switch (Z_TYPE(overloaded_property->element)) {
- case IS_LONG:
- printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
- break;
- case IS_STRING:
- printf("'%s'\n", Z_STRVAL(overloaded_property->element));
- break;
- }
- pval_destructor(&overloaded_property->element);
- }
-
- Z_STRVAL(result) = estrndup("testing", 7);
- Z_STRLEN(result) = 7;
- Z_TYPE(result) = IS_STRING;
- return result;
-}
-/* }}} */
-
-/* hw_api_class_set_property(zend_property_reference *property_reference, pval *value) {{{
- */
-int hw_api_class_set_property(zend_property_reference *property_reference, pval *value) {
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
-
- printf("Writing to a property from a HW_API object:\n");
- printf("Writing '");
- zend_print_variable(value);
- printf("'\n");
-
- for (element=property_reference->elements_list->head; element; element=element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch (Z_TYPE_P(overloaded_property)) {
- case OE_IS_ARRAY:
- printf("Array offset: ");
- break;
- case OE_IS_OBJECT:
- printf("Object property: ");
- break;
- }
- switch (Z_TYPE(overloaded_property->element)) {
- case IS_LONG:
- printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
- break;
- case IS_STRING:
- printf("'%s'\n", Z_STRVAL(overloaded_property->element));
- break;
- }
- pval_destructor(&overloaded_property->element);
- }
-
- return 0;
-}
-/* }}} */
-
-/* hw_api_class_startup() {{{
- */
-void hw_api_class_startup() {
- zend_class_entry ce;
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "HW_API", php_hw_api_functions,
- NULL,
- NULL,
- NULL);
-
- hw_api_class_entry_ptr = zend_register_internal_class_ex(&ce, NULL, NULL);
-}
-/* }}} */
-
-/* hw_api_object_class_get_property(zend_property_reference *property_reference) {{{
- */
-pval hw_api_object_class_get_property(zend_property_reference *property_reference) {
- pval result;
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
-
-
- printf("Reading a property from a HW_API_Object object:\n");
-
- for (element=property_reference->elements_list->head; element; element=element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch (Z_TYPE_P(overloaded_property)) {
- case OE_IS_ARRAY:
- printf("Array offset: ");
- break;
- case OE_IS_OBJECT:
- printf("Object property: ");
- break;
- }
- switch (Z_TYPE(overloaded_property->element)) {
- case IS_LONG:
- printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
- break;
- case IS_STRING:
- printf("'%s'\n", Z_STRVAL(overloaded_property->element));
- break;
- }
- pval_destructor(&overloaded_property->element);
- }
-
- Z_STRVAL(result) = estrndup("testing", 7);
- Z_STRLEN(result) = 7;
- Z_TYPE(result) = IS_STRING;
- return result;
-}
-/* }}} */
-
-/* hw_api_object_class_set_property(zend_property_reference *property_reference, pval *value) {{{
- */
-int hw_api_object_class_set_property(zend_property_reference *property_reference, pval *value) {
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
-
- printf("Writing to a property from a HW_API_Object object:\n");
- printf("Writing '");
- zend_print_variable(value);
- printf("'\n");
-
- for (element=property_reference->elements_list->head; element; element=element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch (Z_TYPE_P(overloaded_property)) {
- case OE_IS_ARRAY:
- printf("Array offset: ");
- break;
- case OE_IS_OBJECT:
- printf("Object property: ");
- break;
- }
- switch (Z_TYPE(overloaded_property->element)) {
- case IS_LONG:
- printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
- break;
- case IS_STRING:
- printf("'%s'\n", Z_STRVAL(overloaded_property->element));
- break;
- }
- pval_destructor(&overloaded_property->element);
- }
-
- return 0;
-}
-/* }}} */
-
-/* {{{ hw_api_object_class_startup()
- */
-void hw_api_object_class_startup() {
- zend_class_entry ce;
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "hw_api_object", php_hw_api_object_functions,
- NULL,
- NULL,
- NULL);
-
- hw_api_object_class_entry_ptr = zend_register_internal_class_ex(&ce, NULL, NULL);
-}
-/* }}} */
-
-/* hw_api_attribute_class_get_property(zend_property_reference *property_reference) {{{
- */
-pval hw_api_attribute_class_get_property(zend_property_reference *property_reference) {
- pval result;
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
-
- printf("Reading a property from a HW_API_Attribute object:\n");
-
- for (element=property_reference->elements_list->head; element; element=element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch (Z_TYPE_P(overloaded_property)) {
- case OE_IS_ARRAY:
- printf("Array offset: ");
- break;
- case OE_IS_OBJECT:
- printf("Object property: ");
- break;
- }
- switch (Z_TYPE(overloaded_property->element)) {
- case IS_LONG:
- printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
- break;
- case IS_STRING:
- printf("'%s'\n", Z_STRVAL(overloaded_property->element));
- break;
- }
- pval_destructor(&overloaded_property->element);
- }
-
- Z_STRVAL(result) = estrndup("testing", 7);
- Z_STRLEN(result) = 7;
- Z_TYPE(result) = IS_STRING;
- return result;
-}
-/* }}} */
-
-/* hw_api_attribute_class_set_property(zend_property_reference *property_reference, pval *value) {{{
- */
-int hw_api_attribute_class_set_property(zend_property_reference *property_reference, pval *value) {
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
-
- printf("Writing to a property from a HW_API_Attribute object:\n");
- printf("Writing '");
- zend_print_variable(value);
- printf("'\n");
-
- for (element=property_reference->elements_list->head; element; element=element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch (Z_TYPE_P(overloaded_property)) {
- case OE_IS_ARRAY:
- printf("Array offset: ");
- break;
- case OE_IS_OBJECT:
- printf("Object property: ");
- break;
- }
- switch (Z_TYPE(overloaded_property->element)) {
- case IS_LONG:
- printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
- break;
- case IS_STRING:
- printf("'%s'\n", Z_STRVAL(overloaded_property->element));
- break;
- }
- pval_destructor(&overloaded_property->element);
- }
-
- return 0;
-}
-/* }}} */
-
-/* hw_api_attribute_class_startup() {{{
- */
-void hw_api_attribute_class_startup() {
- zend_class_entry hw_api_attribute_class_entry;
-
- INIT_OVERLOADED_CLASS_ENTRY(hw_api_attribute_class_entry, "HW_API_Attribute", php_hw_api_attribute_functions,
- NULL,
- NULL,
- NULL);
-
- hw_api_attribute_class_entry_ptr = zend_register_internal_class(&hw_api_attribute_class_entry);
-}
-/* }}} */
-
-/* hw_api_error_class_startup() {{{
- */
-void hw_api_error_class_startup() {
- zend_class_entry hw_api_error_class_entry;
-
- INIT_OVERLOADED_CLASS_ENTRY(hw_api_error_class_entry, "HW_API_Error", php_hw_api_error_functions,
- NULL,
- NULL,
- NULL);
-
- hw_api_error_class_entry_ptr = zend_register_internal_class(&hw_api_error_class_entry);
-}
-/* }}} */
-
-/* hw_api_content_class_startup() {{{
- */
-void hw_api_content_class_startup() {
- zend_class_entry hw_api_content_class_entry;
-
- INIT_OVERLOADED_CLASS_ENTRY(hw_api_content_class_entry, "HW_API_Content", php_hw_api_content_functions,
- NULL,
- NULL,
- NULL);
-
- hw_api_content_class_entry_ptr = zend_register_internal_class(&hw_api_content_class_entry);
-}
-/* }}} */
-
-/* hw_api_reason_class_startup() {{{
- */
-void hw_api_reason_class_startup() {
- zend_class_entry hw_api_reason_class_entry;
-
- INIT_OVERLOADED_CLASS_ENTRY(hw_api_reason_class_entry, "HW_API_Reason", php_hw_api_reason_functions,
- NULL,
- NULL,
- NULL);
-
- hw_api_reason_class_entry_ptr = zend_register_internal_class(&hw_api_reason_class_entry);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/hwapi/php_hwapi.h b/ext/hwapi/php_hwapi.h
deleted file mode 100644
index 7b7c08626a..0000000000
--- a/ext/hwapi/php_hwapi.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_HWAPI_H
-#define PHP_HWAPI_H
-
-#ifdef PHP_WIN32
-#define PHP_HWAPI_API __declspec(dllexport)
-#else
-#define PHP_HWAPI_API
-#endif
-
-#if HAVE_HWAPI
-#ifndef DLEXPORT
-#define DLEXPORT
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-extern zend_module_entry hwapi_module_entry;
-#define hwapi_module_ptr &hwapi_module_entry
-
-typedef struct {
- long default_link;
- long default_port;
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
- int le_socketp, le_psocketp, le_document;
-} zend_hwapi_globals;
-
-#ifdef ZTS
-# define HwApiSLS_D zend_hwapi_globals *hwapi_globals
-# define HwApiSLS_DC , HwApiSLS_D
-# define HwApiSLS_C hwapi_globals
-# define HwApiSLS_CC , HwApiSLS_C
-# define HwApiSG(v) (hwapi_globals->v)
-# define HwApiSLS_FETCH() zend_hwapi_globals *hwapi_globals = ts_resource(hwapi_globals_id)
-#else
-# define HwApiSLS_D
-# define HwApiSLS_DC
-# define HwApiSLS_C
-# define HwApiSLS_CC
-# define HwApiSG(v) (hwapi_globals.v)
-# define HwApiSLS_FETCH()
-extern PHP_HWAPI_API zend_hwapi_globals hwapi_globals;
-#endif
-
-extern PHP_MINIT_FUNCTION(hwapi);
-extern PHP_MSHUTDOWN_FUNCTION(hwapi);
-extern PHP_RINIT_FUNCTION(hwapi);
-PHP_MINFO_FUNCTION(hwapi);
-
-/* HW_API */
-PHP_FUNCTION(hwapi_dummy);
-PHP_FUNCTION(hwapi_init);
-PHP_FUNCTION(hwapi_hgcsp);
-PHP_FUNCTION(hwapi_object);
-PHP_FUNCTION(hwapi_children);
-PHP_FUNCTION(hwapi_mychildren);
-PHP_FUNCTION(hwapi_parents);
-PHP_FUNCTION(hwapi_find);
-PHP_FUNCTION(hwapi_identify);
-PHP_FUNCTION(hwapi_remove);
-PHP_FUNCTION(hwapi_content);
-PHP_FUNCTION(hwapi_copy);
-PHP_FUNCTION(hwapi_link);
-PHP_FUNCTION(hwapi_move);
-PHP_FUNCTION(hwapi_lock);
-PHP_FUNCTION(hwapi_unlock);
-PHP_FUNCTION(hwapi_replace);
-PHP_FUNCTION(hwapi_insert);
-PHP_FUNCTION(hwapi_insertdocument);
-PHP_FUNCTION(hwapi_insertcollection);
-
-PHP_FUNCTION(hwapi_srcanchors);
-PHP_FUNCTION(hwapi_dstanchors);
-PHP_FUNCTION(hwapi_objectbyanchor);
-PHP_FUNCTION(hwapi_dstofsrcanchor);
-PHP_FUNCTION(hwapi_srcsofdst);
-
-PHP_FUNCTION(hwapi_checkin);
-PHP_FUNCTION(hwapi_checkout);
-PHP_FUNCTION(hwapi_setcommittedversion);
-PHP_FUNCTION(hwapi_revert);
-PHP_FUNCTION(hwapi_history);
-PHP_FUNCTION(hwapi_removeversion);
-PHP_FUNCTION(hwapi_freeversion);
-
-PHP_FUNCTION(hwapi_configurationhistory);
-PHP_FUNCTION(hwapi_saveconfiguration);
-PHP_FUNCTION(hwapi_restoreconfiguration);
-PHP_FUNCTION(hwapi_mergeconfiguration);
-PHP_FUNCTION(hwapi_removeconfiguration);
-
-PHP_FUNCTION(hwapi_user);
-PHP_FUNCTION(hwapi_userlist);
-PHP_FUNCTION(hwapi_hwstat);
-PHP_FUNCTION(hwapi_dcstat);
-PHP_FUNCTION(hwapi_dbstat);
-PHP_FUNCTION(hwapi_ftstat);
-PHP_FUNCTION(hwapi_info);
-
-/* HW_Object */
-PHP_FUNCTION(hwapi_object_new);
-PHP_FUNCTION(hwapi_object_count);
-PHP_FUNCTION(hwapi_object_title);
-PHP_FUNCTION(hwapi_object_attreditable);
-PHP_FUNCTION(hwapi_object_assign);
-PHP_FUNCTION(hwapi_object_attribute);
-PHP_FUNCTION(hwapi_object_insert);
-PHP_FUNCTION(hwapi_object_remove);
-PHP_FUNCTION(hwapi_object_value);
-
-/* HW_Attribute */
-PHP_FUNCTION(hwapi_attribute_new);
-PHP_FUNCTION(hwapi_attribute_key);
-PHP_FUNCTION(hwapi_attribute_value);
-PHP_FUNCTION(hwapi_attribute_values);
-PHP_FUNCTION(hwapi_attribute_langdepvalue);
-
-/* HW_Content */
-PHP_FUNCTION(hwapi_content_new);
-PHP_FUNCTION(hwapi_content_read);
-PHP_FUNCTION(hwapi_content_mimetype);
-
-/* HW_Error */
-PHP_FUNCTION(hwapi_error_count);
-PHP_FUNCTION(hwapi_error_reason);
-
-/* HW_Reason */
-PHP_FUNCTION(hwapi_reason_type);
-PHP_FUNCTION(hwapi_reason_description);
-
-#else
-#define hwapi_module_ptr NULL
-#endif /* HAVE_HWAPI */
-#define phpext_hwapi_ptr hwapi_module_ptr
-#endif /* PHP_HWAPI_H */
-
diff --git a/ext/hyperwave/CREDITS b/ext/hyperwave/CREDITS
deleted file mode 100644
index b01b16907f..0000000000
--- a/ext/hyperwave/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-HyperWave
-Uwe Steinmann
diff --git a/ext/hyperwave/config.m4 b/ext/hyperwave/config.m4
deleted file mode 100644
index 9e5a31cc6d..0000000000
--- a/ext/hyperwave/config.m4
+++ /dev/null
@@ -1,20 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_MSG_CHECKING(for Hyperwave support)
-AC_ARG_WITH(hyperwave,
-[ --with-hyperwave Include Hyperwave support],
-[
- if test "$withval" != "no"; then
- AC_DEFINE(HYPERWAVE,1,[ ])
- AC_MSG_RESULT(yes)
- PHP_NEW_EXTENSION(hyperwave, hw.c hg_comm.c)
- else
- AC_DEFINE(HYPERWAVE,0,[ ])
- AC_MSG_RESULT(no)
- fi
-],[
- AC_DEFINE(HYPERWAVE,0,[ ])
- AC_MSG_RESULT(no)
-])
diff --git a/ext/hyperwave/debug.h b/ext/hyperwave/debug.h
deleted file mode 100644
index 5b72dbb194..0000000000
--- a/ext/hyperwave/debug.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/****************************************************************************
-*
-* Copyright (C) 1991 Kendall Bennett.
-* All rights reserved.
-*
-* Filename: $RCSfile$
-* Version: $Revision$
-*
-* Language: ANSI C
-* Environment: any
-*
-* Description: General header file for portable code.
-*
-* $Id$
-*
-* Revision History:
-* -----------------
-*
-* $Log$
-* Revision 1.2 2000/07/02 23:46:41 sas
-* Change header protection macros to conform to standard.
-*
-* Draft 3 of IEEE 1003.1 200x, "2.2 The Compilation Environment"
-*
-* All identifiers that begin with an underscore and either an uppercase
-* letter or another underscore are always reserved for any use by the
-* implementation.
-*
-* Revision 1.1 1999/04/21 23:37:47 ssb
-* moved db
-*
-* Revision 1.1.1.1 1999/04/07 21:03:29 zeev
-* PHP 4.0
-*
-* Revision 1.1.1.1 1999/03/17 04:29:10 andi
-* PHP4
-*
-* Revision 1.1.1.1 1998/12/21 07:56:22 andi
-* Trying to start the zend CVS tree
-*
-* Revision 1.1 1998/08/12 09:29:16 steinm
-* First version of Hyperwave module.
-*
-* Revision 1.6 92/03/15 12:51:48 kjb
-* Added MK_FP macro and ushort typedef.
-*
-* Revision 1.5 91/10/28 03:17:33 kjb
-* Ported to the Iris.
-*
-* Revision 1.4 91/09/26 15:29:02 kjb
-* Added stuff for the SGI Iris 4D.
-*
-* Revision 1.3 91/09/26 10:07:04 kjb
-* Added general typedef stuff.
-*
-* Revision 1.2 91/09/03 18:19:14 ROOT_DOS
-* Added a few defines that are supplied by <dir.h> for UNIX compatibility.
-*
-* Revision 1.1 91/08/16 13:19:06 ROOT_DOS
-* Initial revision
-*
-****************************************************************************/
-
-#ifndef DEBUG_H
-#define DEBUG_H
-
-#ifdef DEBUG
-# define D(x) x
-#else
-# define D(x)
-#endif
-
-#define PRIVATE static
-#define PUBLIC
-
-#ifdef __MSDOS__ /* Compiling for MSDOS */
-# define MS(x) x
-# define UX(x)
-# define IR(x)
-# define _8086 /* We know we have an 8086 type processor */
-#if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
-# define LDATA
-# define NULL 0L
-#else
-# define NULL 0
-#endif
-#else __MSDOS__
-#ifdef __IRIS4D__ /* Compiling for the SGI Iris 4D */
-# define MS(x)
-# define UX(x) x /* The Iris is a UNIX machine */
-# define IR(x) x
-# define O_BINARY 0 /* no binary input mode in UNIX open() */
-# define MAXFILE 255 /* These are defined in <dir.h>, but */
-# define MAXDIR 255 /* on UNIX machines, we just define */
-# define MAXPATH 255 /* them all to be the same size */
-# define far /* Near and far do not exist under */
-# define near /* UNIX or the Iris. */
-# define NULL ((void *)0)
-#else __IRIS4D__ /* Assume UNIX compilation */
-# define MS(x)
-# define UX(x) x
-# define IR(x)
-# define O_BINARY 0 /* no binary input mode in UNIX open() */
-# define MAXFILE 255 /* These are defined in <dir.h>, but */
-# define MAXDIR 255 /* on UNIX machines, we just define */
-# define MAXPATH 255 /* them all to be the same size */
-# define far /* Near and far do not exist under */
-# define near /* UNIX or the Iris. */
-# ifndef NULL
-# define NULL ((void *)0)
-# endif
-#endif __IRIS4D__
-#endif __MSDOS__
-
-/****************************************************************************
-*
-* SEG(p) Evaluates to the segment portion of an 8086 address.
-* OFF(p) Evaluates to the offset portion of an 8086 address.
-* FP(s,o) Creates a far pointer given a segment offset pair.
-* PHYS(p) Evaluates to a long holding a physical address
-*
-****************************************************************************/
-
-#ifdef _8086
-# define SEG(p) ( ((unsigned *)&(void far *)(p))[1] )
-# define OFF(p) ( (unsigned)(p) )
-# define FP(s,o) ( (void far *)( ((unsigned long)s << 16) + \
- (unsigned long)o ))
-# define PHYS(p) ( (unsigned long)OFF(p) + \
- ((unsigned long)SEG(p) << 4))
-#else
-# define PHYS(p) (p)
-#endif _8086
-
-/****************************************************************************
-*
-* NUMELE(array) Evaluates to the array size in elements
-* LASTELE(array) Evaluates to a pointer to the last element
-* INBOUNDS(array,p) Evaluates to true if p points into the array
-* RANGE(a,b,c) Evaluates to true if a <= b <= c
-* max(a,b) Evaluates to a or b, whichever is larger
-* min(a,b) Evaluates to a or b, whichever is smaller
-* ABS(a) Evaluates to the absolute value of a
-* NBITS(type) Returns the number of bits in a variable of the
-* indicated type
-* MAXINT Evaluates to the value of the largest signed integer
-*
-****************************************************************************/
-
-#define NUMELE(a) (sizeof(a)/sizeof(*(a)))
-#define LASTELE(a) ((a) + (NUMELE(a)-1))
-#ifdef LDATA
-#define TOOHIGH(a, p) ((long)PHYS(p) - (long)PHYS(a) > (long)(NUMELE(a)-1))
-#define TOOLOW(a, p) ((long)PHYS(p) - (long)PHYS(a) < 0)
-#else
-#define TOOHIGH(a, p) ((long)(p) - (long)(a) > (long)(NUMELE(a)-1))
-#define TOOLOW(a, p) ((long)(p) - (long)(a) < 0)
-#endif
-#define INBOUNDS(a, p) ( ! (TOOHIGH(a, p) || TOOLOW(a, p)) )
-
-#define _IS(t, x) (((t)1 << (x)) != 0) /* Evaluates true if the width of */
- /* variable of type t is < x. */
- /* The != 0 assures that the */
- /* answer is 1 or 0 */
-
-#define NBITS(t) (4 * (1 + _IS(t, 4) + _IS(t, 8) + _IS(t, 12) + _IS(t, 16) \
- + _IS(t, 20) + _IS(t, 24) + _IS(t, 28) + _IS(t, 32)))
-
-#define MAXINT (((unsigned)~0) >> 1)
-
-#ifndef MAX
-# define MAX(a, b) ( ((a) > (b)) ? (a) : (b))
-#endif
-#ifndef MIN
-# define MIN(a, b) ( ((a) < (b)) ? (a) : (b))
-#endif
-#ifndef ABS
-# define ABS(a) ((a) >= 0 ? (a) : -(a))
-#endif
-
-#define RANGE(a, b, c) ( (a) <= (b) && (b) <= (c) )
-
-/* General typedefs */
-
-#ifndef __GENDEFS
-#define __GENDEFS
-typedef void *ptr;
-typedef void near *nearptr;
-typedef void far *farptr;
-/*typedef unsigned char uchar;
-typedef unsigned short ushort;
-typedef unsigned int uint;
-typedef unsigned long ulong;*/
-typedef int bool;
-#endif __GENDEFS
-
-/* Boolean truth values */
-
-#define false 0
-#define true 1
-#define FALSE 0
-#define TRUE 1
-#define NO 0
-#define YES 1
-
-#endif /* DEBUG_H */
diff --git a/ext/hyperwave/hg_comm.c b/ext/hyperwave/hg_comm.c
deleted file mode 100644
index 5aaae3dcfd..0000000000
--- a/ext/hyperwave/hg_comm.c
+++ /dev/null
@@ -1,5841 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* #define HW_DEBUG */
-
-#include <stdlib.h>
-#include "php.h"
-#include "php_globals.h"
-#include "SAPI.h"
-
-#if HYPERWAVE
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#ifdef PHP_WIN32
-# include <winsock2.h>
-# define EWOULDBLOCK WSAEWOULDBLOCK
-# define ETIMEDOUT WSAETIMEDOUT
-# define bcopy memcpy
-# define bzero(a, b) memset(a, 0, b)
-#else
-# include <sys/socket.h>
-# include <netinet/in.h>
-# include <netdb.h>
-# include <unistd.h>
-# include <sys/param.h>
-# include <arpa/inet.h>
-#endif
-#include <fcntl.h>
-#include <errno.h>
-#include "hg_comm.h"
-#include "ext/standard/head.h"
-
-/* Defining hw_optimize does optimize the send_objectbyidquery() function.
- Instead of getting the complete return message including the objectrecords
- with recv_hg_msg(), only the header of the return message is fetched.
- The object records itself are fetched as they are needed straight from
- the socket. This method requires less memory and is twice as fast because
- reading from the net seems to be a bottleneck which has less impact if
- the processing of the data is done in parallel.
-*/
-#define hw_optimize
-
-/* Define hw_less_server_stress does reduce the stress on the hw server, by
- using send_objectbyidquery() instead of send_getobject() multiple times.
- send_objectbyidquery() gets a bunch of object records with one message.
- This also reduced the number of lines in the servers log files.
- Unfortunately this is not faster unless hw_optimize is defined, because
- getting object records with multiple send_getobject() is already optimized.
- First all request messages for each object are send and the the answers
- are read. This gives the server the possibility to answer request already
- while more request are comming in.
-*/
-#define hw_less_server_stress
-
-static int set_nonblocking(int fd);
-/* static int set_blocking(int fd); */
-
-static int hg_read_exact(int sockfd, char *buf, int size);
-/* static int hg_read(int sockfd, char *buf, int size); */
-static int hg_write(int sockfd, char *buf, int size);
-
-static int send_hg_msg(int sockfd, hg_msg *msg, int length);
-static void build_msg_header(hg_msg *msg, int length, int version_msgid, int msg_type);
-static char *build_msg_int(char *buf, int val);
-static char *build_msg_str(char *buf, char *str);
-static int swap(int val);
-
-
-int version = HW_VERSION;
-/* F_DISTRIBUTED has the effect that all object ids are
- virtual. This means whenever an object is requested a
- new id is generated for this session. Wavemaster and
- Harmony set this flag. How do I know? tcpdump tells
- a lot if the output is investigated. The bit is also
- need to allow access on other server through the local
- server. The hw_mapid() function won't work unless you
- set F_DISTRIBUTED */
-/* int version = HW_VERSION | F_DISTRIBUTED; */
-/* int version = HW_VERSION | F_DISTRIBUTED | F_COMPRESSED; */
-static int msgid = 1;
-static int sock_flags = -1;
-static int non_blocking = 0;
-static int swap_on = 0;
-static int rtimeout = 40;
-static int wtimeout = 40;
-static int lowerror = 0;
-
-/***********************************************************************
-* Function fnInsStr() *
-* *
-* Insert string in string at position. The old string will be freed *
-* with efree!!! The new string is allocated with malloc. *
-* Parameter: string *str: string in which insstr is to be inserted *
-* int pos: Position where string is to inserted (0=first) *
-* string *insstr: string to be inserted *
-* Return: pointer to new string or NULL. If NULL is returned the *
-* memory for the old string has not been freed. *
-***********************************************************************/
-char *fnInsStr(char *str, int pos, char *insstr)
-{
- char *newstr, *ptr;
-
- if((str == NULL) || (insstr == NULL))
- return NULL;
- if(pos > (int)strlen(str))
- return NULL;
-
- if(insstr[0] == '\0')
- return str;
-
- if(NULL == (newstr = malloc(strlen(str) + strlen(insstr) + 1))) {
- lowerror = LE_MALLOC;
- return NULL;
- }
-
- ptr = newstr;
- memcpy(newstr, str, pos);
- ptr += pos;
- strcpy(ptr, insstr);
- ptr += strlen(insstr);
- strcpy(ptr, str+pos);
-
- free(str);
- return newstr;
-}
-
-/***********************************************************************
-* Function fnAddAnchor() *
-* *
-* Inserts new anchor into anchor list. *
-* Parameter: DLIST pList: Anchor list *
-* int objectID: object ID of Anchor *
-* int start: start position *
-* int end: end position *
-* Return: Pointer to new anchor, NULL if error *
-***********************************************************************/
-#ifdef newlist
-ANCHOR *fnAddAnchor(zend_llist *pAnchorList,
- int objectID,
- int start, int end)
-#else
-ANCHOR *fnAddAnchor(DLIST *pAnchorList,
- int objectID,
- int start, int end)
-#endif
-{
- ANCHOR *cur_ptr;
-
-#ifdef newlist
- ANCHOR **ptr;
- if(NULL == (cur_ptr = (ANCHOR *) emalloc(sizeof(ANCHOR))))
- return NULL;
-#else
- if((cur_ptr = (ANCHOR *) dlst_newnode(sizeof(ANCHOR))) == NULL) {
- return NULL;
- }
-#endif
-
- memset(cur_ptr, 0, sizeof(ANCHOR));
- cur_ptr->start = start;
- cur_ptr->end = end;
- cur_ptr->id = objectID;
- cur_ptr->destdocname = NULL;
- cur_ptr->nameanchor = NULL;
- cur_ptr->link = NULL;
- cur_ptr->tagattr = NULL;
- cur_ptr->htmlattr = NULL;
- cur_ptr->codebase = NULL;
- cur_ptr->code = NULL;
- cur_ptr->keyword = NULL;
- cur_ptr->fragment = NULL;
-
-#ifdef newlist
- zend_llist_prepend_element(pAnchorList, &cur_ptr);
- ptr = (ANCHOR **) zend_llist_get_first(pAnchorList);
-#else
- dlst_insertafter(pAnchorList, cur_ptr, PHP_DLST_HEAD(pAnchorList));
-#endif
-
- return(cur_ptr);
-}
-
-/***********************************************************************
-* Function fnDeleteAnchor() *
-* *
-* Inserts new anchor into anchor list. *
-* Parameter: ptr: pointer to node *
-* Return: void *
-***********************************************************************/
-#ifdef newlist
-void fnDeleteAnchor(void *ptr1)
-#else
-void fnDeleteAnchor(ANCHOR *ptr)
-#endif
-{
-#ifdef newlist
- ANCHOR **ptr2, *ptr;
- ptr2 = (ANCHOR **) ptr1;
- ptr = *ptr2;
-#endif
-
- if(ptr->destdocname) efree(ptr->destdocname);
- if(ptr->nameanchor) efree(ptr->nameanchor);
- if(ptr->link) efree(ptr->link);
- if(ptr->tagattr) efree(ptr->tagattr);
- if(ptr->htmlattr) efree(ptr->htmlattr);
- if(ptr->codebase) efree(ptr->codebase);
- if(ptr->code) efree(ptr->code);
- if(ptr->keyword) efree(ptr->keyword);
- if(ptr->fragment) efree(ptr->fragment);
-
-#ifdef newlist
- efree(ptr);
-#else
- dlst_freenode(ptr);
-#endif
-}
-
-/***********************************************************************
-* Function fnListAnchor() *
-* *
-* Lists all anchors in anchor list. *
-* Parameter: ptr: pointer to list *
-* Return: void *
-***********************************************************************/
-#ifdef newlist
-void fnListAnchor(zend_llist *pAnchorList)
-#else
-void fnListAnchor(DLIST *pAnchorList)
-#endif
-{
-#ifdef newlist
- ANCHOR *cur_ptr, **ptr;
- ptr = (ANCHOR **) zend_llist_get_last(pAnchorList);
- if(ptr)
- cur_ptr = *ptr;
- while(ptr) {
- fprintf(stderr, "0x%X->0x%X ", (int) ptr, (int) cur_ptr);
-#else
- ANCHOR *cur_ptr;
- cur_ptr = (ANCHOR *) dlst_last(pAnchorList);
- while(cur_ptr) {
- fprintf(stderr, "0x%X ", (int) cur_ptr);
-#endif
-
- fprintf(stderr, "%d, %d, %s, %s, %s, %s %s\n", cur_ptr->start,
- cur_ptr->end,
- cur_ptr->tanchor == 1 ? "src" : "dest",
- cur_ptr->destdocname,
- cur_ptr->nameanchor,
- cur_ptr->link,
- cur_ptr->tagattr);
-#ifdef newlist
- ptr = (ANCHOR **) zend_llist_get_prev(pAnchorList);
- if(ptr)
- cur_ptr = *ptr;
-#else
- cur_ptr = (ANCHOR *) dlst_prev(cur_ptr);
-#endif
- }
-}
-
-/***********************************************************************
-* Function fnCmpAnchors() *
-* *
-* Compares to Anchors by its start position *
-* Parameter: ANCHOR a1: First Anchor *
-* ANCHOR a2: Second Anchor *
-* Return: As strcmp *
-***********************************************************************/
-#ifdef newlist
-int fnCmpAnchors(const void *e1, const void *e2 TSRMLS_DC)
-{
- ANCHOR *a1, **aa1, *a2, **aa2;
- zend_llist_element **ee1, **ee2;
- ee1 = (zend_llist_element **) e1;
- ee2 = (zend_llist_element **) e2;
- aa1 = (ANCHOR **) (*ee1)->data;
- aa2 = (ANCHOR **) (*ee2)->data;
- a1 = *aa1;
- a2 = *aa2;
-#else
-int fnCmpAnchors(ANCHOR *a1, ANCHOR *a2 TSRMLS_DC)
-{
-#endif
- if(a1->start < a2->start)
- return -1;
- if(a1->start == a2->start) {
- /* It's importent to check this case as well, because a link with
- a bigger end has to be inserted first.
- */
- if(a1->end < a2->end)
- return -1;
- /* If both start and end are equal (yes, it is possible)
- we will Src Anchor before a Dest anchor. There has been
- a case where an IMG was surrounded by a NAME which was
- surrounded by a HREF. In such a case the HREF doesn't
- work.
- */
- if(a1->end == a2->end) {
- if(a1->tanchor > a2->tanchor)
- return -1;
- }
- }
-
- return 1;
-}
-
-/***********************************************************************
-* Function fnCreateAnchorList() *
-* Uses either docofanchorrec or reldestrec to create a list of anchors *
-* depending on anchormode *
-* *
-* Returns a list of Anchors converted from an object record *
-* Parameter: int objectID: the object for which the list is created *
-* char **anchors: object records of anchors *
-* char **docofanchorrec: Name of destination absolut *
-* char **reldestrec: Name of destination relativ to current *
-* object *
-* int ancount: number of anchors *
-* int anchormode: 0 = use absolut dest, else rel. dest *
-* Return: List of Anchors, NULL if error *
-***********************************************************************/
-#ifdef newlist
-zend_llist *fnCreateAnchorList(hw_objectID objID, char **anchors, char **docofanchorrec, char **reldestrec, int ancount, int anchormode)
-#else
-DLIST *fnCreateAnchorList(hw_objectID objID, char **anchors, char **docofanchorrec, char **reldestrec, int ancount, int anchormode)
-#endif
-{
- int start, end, i, destid, anchordestid, objectID;
- ANCHOR *cur_ptr = NULL;
-#ifdef newlist
- zend_llist *pAnchorList;
- pAnchorList = (zend_llist *) emalloc(sizeof(zend_llist));
- zend_llist_init(pAnchorList, sizeof(char *), fnDeleteAnchor, 0);
-#else
- DLIST *pAnchorList = dlst_init();
-#endif
-
- for(i=ancount-1; i>=0; i--) {
- char *object = NULL;
- char *docofanchorptr = NULL;
- char *reldestptr = NULL;
- char *str, *str1, link[200];
-
- if(NULL != anchors[i]) {
- object = anchors[i];
- docofanchorptr = docofanchorrec[i];
- if(reldestrec) /* FIXME reldestrec may only be NULL if anchormode != 0 */
- reldestptr = reldestrec[i];
-
- /* Determine Position. Doesn't matter if Src or Dest
- The Position field should always be there. Though there
- are case in which the position has no meaning, e.g. if
- a document is annotated and the annotation text doesn't
- contain a link of type annotation,
- In such a case the Position has the value 'invisible' */
- str = strstr(object, "Position");
- str += 9;
- if(((int) str != 9) && (0 != strncmp(str, "invisible", 9))) {
- sscanf(str, "0x%X 0x%X", &start, &end);
-
- /* Determine ObjectID */
- objectID = 0;
- if(NULL != (str = strstr(object, "ObjectID"))) {
- str += 9;
- sscanf(str, "0x%X", &objectID);
- }
-
- cur_ptr = fnAddAnchor(pAnchorList, objectID, start, end);
-
- /* Determine Type of Anchor */
- str = strstr(object, "TAnchor");
- str += 8;
- if(*str == 'S') {
- char destdocname[200];
- char nameanchor[200];
- cur_ptr->tanchor = 1;
-
- cur_ptr->destdocname = NULL;
- if(NULL != (str = strstr(object, "Dest"))) {
- char *tempptr;
-
- /* No need to care about the value of Dest, because we take the info
- from docofanchorptr.
- Since the anchor has a destination there are two possibilities.
- 1. The destination is an anchor or
- 2. or the destination is a document already.
- In both cases docofanchorptr has the proper info because GETDOCBYANCHOR
- is such a nice message.
- */
- switch(anchormode) {
- case 0:
- tempptr = docofanchorptr;
- break;
- default:
- tempptr = reldestptr;
- }
- if(NULL != tempptr) {
- destid = 0;
- if(NULL != (str = strstr(tempptr, "ObjectID="))) {
- str += 9;
- sscanf(str, "0x%X", &destid);
- }
- /* This is basically for NAME tags. There is no need
- to add the destname if it is the document itself.
- */
-/* if(destid == objID) {
- cur_ptr->destdocname = NULL;
- } else { */
- /* It's always nice to deal with names, so let's first check
- for a name. If there is none we take the ObjectID.
- */
- if(NULL != (str = strstr(tempptr, "Name="))) {
- str += 5;
- } else if(NULL != (str = strstr(tempptr, "ObjectID="))) {
- str += 9;
- }
- if(sscanf(str, "%s\n", destdocname)) {
- cur_ptr->destdocname = estrdup(destdocname);
- }
-/* } */
- }
- }
-
- /* Get the Id of the anchor destination and the document id that belongs
- to that anchor. We need that soon in order to determine if the anchor
- points to a document or a dest anchor in a document.
- */
- anchordestid = 0;
- if(NULL != (str = strstr(object, "Dest="))) {
- str += 5;
- sscanf(str, "0x%X", &anchordestid);
- }
-
- /* if anchordestid != destid then the destination is an anchor in a document whose
- name (objectID) is already in destdocname. We will have to extend the link
- by '#...'
- */
- cur_ptr->nameanchor = NULL;
- if(anchordestid != destid) {
- if(NULL != (str = strstr(object, "Dest="))) {
- str += 5;
- if(sscanf(str, "%s\n", nameanchor))
- cur_ptr->nameanchor = estrdup(nameanchor);
- }
- }
-
- if(!cur_ptr->destdocname) {
- cur_ptr->link = NULL;
- if(NULL != (str = strstr(object, "Hint=URL:"))) {
- str += 9;
- if(sscanf(str, "%s\n", link))
- cur_ptr->link = estrdup(link);
- } else if(NULL != (str = strstr(object, "Hint="))) {
- str += 5;
- if(sscanf(str, "%s\n", link))
- cur_ptr->link = estrdup(link);
- }
- }
-
- cur_ptr->fragment = NULL;
- if(NULL != (str = strstr(object, "Fragment="))) {
- str += 9;
- if(sscanf(str, "%s\n", link))
- cur_ptr->fragment = estrdup(link);
- }
-
- {
- char *htmlattr, *str2;
- int offset;
- str1 = object;
- htmlattr = emalloc(strlen(object)); /* alloc mem big enough for htmlattr */
- htmlattr[0] = '\0';
- offset = 0;
- while(NULL != (str = strstr(str1, "HtmlAttr="))) {
- str += 9;
- str1 = str;
- while((*str1 != '\n') && (*str1 != '\0'))
- str1++;
- /* Find the '=' in the HTML attr and make sure it is part of the
- attr and not somewhere in the objrec. */
- if((NULL != (str2 = strchr(str, '='))) && (str2 < str1)) {
- str2++;
- strncpy(&htmlattr[offset], str, str2 - str);
- offset = offset + (str2 - str);
- htmlattr[offset++] = '"';
- strncpy(&htmlattr[offset], str2, str1 - str2);
- offset = offset + (str1 - str2);
- htmlattr[offset++] = '"';
- htmlattr[offset++] = ' ';
- htmlattr[offset] = '\0';
- }
- }
- if(offset){
- /* remove last space */
- htmlattr[offset-1] = '\0';
- cur_ptr->htmlattr = estrdup(htmlattr);
- }
- efree(htmlattr);
- }
-
- if(NULL != (str = strstr(object, "LinkType="))) {
- str += 9;
- if(strncmp(str, "background", 10) == 0)
- cur_ptr->linktype=HW_BACKGROUND_LINK;
- else
- if(strncmp(str, "intagnodel", 10) == 0) { /* New type introduced by Uwe Steinmann 16.03.2001 */
- cur_ptr->linktype=HW_INTAGNODEL_LINK;
- cur_ptr->tagattr = NULL;
- if(NULL != (str = strstr(object, "TagAttr="))) {
- str += 8;
- str1 = str;
- while((*str1 != '\n') && (*str1 != '\0'))
- str1++;
- cur_ptr->tagattr = emalloc(str1 - str + 1);
- memcpy(cur_ptr->tagattr, str, str1 - str);
- cur_ptr->tagattr[str1 - str] = '\0';
- }
- } else
- if(strncmp(str, "intag", 5) == 0) {
- cur_ptr->linktype=HW_INTAG_LINK;
- cur_ptr->tagattr = NULL;
- if(NULL != (str = strstr(object, "TagAttr="))) {
- str += 8;
- str1 = str;
- while((*str1 != '\n') && (*str1 != '\0'))
- str1++;
- cur_ptr->tagattr = emalloc(str1 - str + 1);
- memcpy(cur_ptr->tagattr, str, str1 - str);
- cur_ptr->tagattr[str1 - str] = '\0';
- }
- } else
- if(strncmp(str, "applet", 6) == 0) {
- cur_ptr->linktype=HW_APPLET_LINK;
- cur_ptr->codebase = NULL;
- if(NULL != (str = strstr(object, "CodeBase="))) {
- str += 9;
- str1 = str;
- while((*str1 != '\n') && (*str1 != '\0'))
- str1++;
- cur_ptr->codebase = emalloc(str1 - str + 1);
- memcpy(cur_ptr->codebase, str, str1 - str);
- cur_ptr->codebase[str1 - str] = '\0';
- }
- cur_ptr->code = NULL;
- if(NULL != (str = strstr(object, "Code="))) {
- str += 5;
- str1 = str;
- while((*str1 != '\n') && (*str1 != '\0'))
- str1++;
- cur_ptr->code = emalloc(str1 - str + 1);
- memcpy(cur_ptr->code, str, str1 - str);
- cur_ptr->code[str1 - str] = '\0';
- }
- } else
- cur_ptr->linktype=HW_DEFAULT_LINK;
- } else
- cur_ptr->linktype=HW_DEFAULT_LINK;
-
- } else { /* Destination Anchor */
- char nameanchor[200];
-
- cur_ptr->tanchor = 2;
- cur_ptr->link = NULL;
-
- /* Here is the only additional info for the name attribute */
- cur_ptr->nameanchor = NULL;
- if(NULL != (str = strstr(object, "ObjectID="))) {
- str += 9;
- if(sscanf(str, "%s\n", nameanchor))
- cur_ptr->nameanchor = estrdup(nameanchor);
- }
-
- cur_ptr->keyword = NULL;
- if(NULL != (str = strstr(object, "Keyword="))) {
- str += 8;
- if(sscanf(str, "%s\n", nameanchor))
- cur_ptr->keyword = estrdup(nameanchor);
- }
-
- }
-
- }
- /* free memory even if it is an invisible anchor */
- efree(anchors[i]);
- if(docofanchorrec[i]) efree(docofanchorrec[i]);
- if(reldestrec)
- if(reldestrec[i]) efree(reldestrec[i]);
- }
- }
- return pAnchorList;
-}
-
-/***********************************************************************
-* Function fnInsAnchorsIntoText() *
-* *
-* Returns the text document with all anchors inserted form list *
-* Parameter: char *text: text without anchors *
-* DList *pAnchorList: list of anchors *
-* Return: Text with anchors *
-***********************************************************************/
-#define BUFFERLEN 200
-#ifdef newlist
-char *fnInsAnchorsIntoText(char *text, zend_llist *pAnchorList, char **bodytag, char **urlprefix) {
- ANCHOR **ptr;
-#else
-char *fnInsAnchorsIntoText(char *text, DLIST *pAnchorList, char **bodytag, char **urlprefix) {
-#endif
- ANCHOR *cur_ptr;
- char bgstr[BUFFERLEN], istr[BUFFERLEN];
- char **scriptname;
- char *newtext;
- int offset = 0;
- int laststart=0;
- char emptystring[BUFFERLEN];
- int i;
- TSRMLS_FETCH();
-
- emptystring[0] = '\0';
-
-/* The following is very tricky and depends on how rewriting is setup on your webserver.
- If you skip the scriptname in the url you will have to map each hyperwave name
- to http://<hwname>. This may not always be a good idea. The best solution is
- probably to provide a prefix for such
- a case which is an optional parameter to hw_gettext() or hw_pipedocument().
- FIXME: Currently, the variable SCRIPT_NAME is empty thouht SCRIPT_URL is
- not. In our case this is OK, since as mentioned above it is better to have no
- SCRIPT_NAME than to have if rewriting is on.
-*/
- if(urlprefix) {
- scriptname = urlprefix;
- } else {
- zval **script_name;
- scriptname = emalloc(5*sizeof(char *));
- if (zend_hash_find(&EG(symbol_table), "SCRIPT_NAME", sizeof("SCRIPT_NAME"), (void **) &script_name)==FAILURE)
- for(i=0; i<5; i++)
- scriptname[i] = &emptystring;
- else {
- convert_to_string_ex(script_name);
- for(i=0; i<5; i++)
- scriptname[i] = Z_STRVAL_PP(script_name);
- }
-
-#if 0
-#if APACHE
- {
- int j;
- array_header *arr = table_elts(((request_rec *) SG(server_context))->subprocess_env);
- table_entry *elts = (table_entry *)arr->elts;
-
- for (j=0; j < arr->nelts; j++) {
- if((0 == strcmp(elts[j].key, "SCRIPT_NAME")) ||
- (0 == strcmp(elts[j].key, "SCRIPT_URL")))
- break;
- }
- scriptname = elts[j].val;
- }
-#else
- scriptname = getenv("SCRIPT_FILENAME");
-#endif
-#endif
- }
-
- newtext = text;
- bgstr[0] = '\0';
-#ifdef newlist
- zend_llist_sort(pAnchorList, fnCmpAnchors TSRMLS_CC);
- ptr = (ANCHOR **) zend_llist_get_last(pAnchorList);
- if(ptr)
- cur_ptr = *ptr;
- while(NULL != ptr) {
-#else
- dlst_mergesort(pAnchorList, fnCmpAnchors);
- cur_ptr = (ANCHOR *) dlst_last(pAnchorList);
- while(NULL != cur_ptr) {
-#endif
-
- istr[0] = '\0';
- if(cur_ptr->tanchor == 1) { /* Src Anchor */
- if(laststart >= cur_ptr->end)
- offset = 0;
- if((cur_ptr->link != NULL) && (cur_ptr->link[0] != '\0')) {
- /* The link is only set if the Link points to an external document */
- switch(cur_ptr->linktype) {
- case HW_BACKGROUND_LINK:
- snprintf(istr, BUFFERLEN, " background='%s'", cur_ptr->link);
- break;
- case HW_INTAG_LINK:
- snprintf(istr, BUFFERLEN, " %s='%s'", cur_ptr->tagattr, cur_ptr->link);
- offset -= 4; /* because there is no closing tag </A> */
-/* laststart = cur_ptr->start; */
- break;
- case HW_INTAGNODEL_LINK:
- snprintf(istr, BUFFERLEN, "%s", cur_ptr->link);
- offset -= 4; /* because there is no closing tag </A> */
-/* laststart = cur_ptr->start; */
- break;
- case HW_APPLET_LINK:
- if(cur_ptr->codebase)
- snprintf(istr, BUFFERLEN, " CODEBASE='%s' CODE='%s'", cur_ptr->codebase, cur_ptr->code);
- else
- snprintf(istr, BUFFERLEN, " CODEBASE='/' CODE='%s'", cur_ptr->code);
- break;
- default:
- newtext = fnInsStr(newtext, cur_ptr->end+offset, "</A>");
- if(cur_ptr->fragment)
- snprintf(istr, BUFFERLEN, "<A HREF='%s#%s'", cur_ptr->link, cur_ptr->fragment);
- else
- snprintf(istr, BUFFERLEN, "<A HREF='%s'", cur_ptr->link);
- if(cur_ptr->htmlattr) {
- strncat(istr, " ", BUFFERLEN - 1 - strlen(istr));
- strncat(istr, cur_ptr->htmlattr, BUFFERLEN - 1 - strlen(istr));
- }
- strncat(istr, ">", BUFFERLEN - 1 - strlen(istr));
- }
- } else {
- switch(cur_ptr->linktype) {
- case HW_BACKGROUND_LINK:
- if(NULL != cur_ptr->destdocname) {
- snprintf(istr, BUFFERLEN, " background='%s/%s'", scriptname[HW_BACKGROUND_LINK], cur_ptr->destdocname);
- } else
- istr[0] = '\0';
- break;
- case HW_INTAG_LINK:
- if(cur_ptr->fragment)
- snprintf(istr, BUFFERLEN, " %s='#%s'", cur_ptr->tagattr, cur_ptr->fragment);
- else
- snprintf(istr, BUFFERLEN, " %s='%s/%s'", cur_ptr->tagattr, scriptname[HW_INTAG_LINK], cur_ptr->destdocname);
- offset -= 4; /* because there is no closing tag </A> */
- break;
- case HW_INTAGNODEL_LINK:
- snprintf(istr, BUFFERLEN, "%s", cur_ptr->destdocname);
- offset -= 4; /* because there is no closing tag </A> */
- break;
- case HW_APPLET_LINK:
- if(cur_ptr->codebase)
-/* snprintf(istr, BUFFERLEN, " CODEBASE='%s%s' CODE='%s'", scriptname == NULL ? "" : scriptname, cur_ptr->codebase, cur_ptr->code); */
- snprintf(istr, BUFFERLEN, " CODEBASE='%s%s' CODE='%s'", scriptname[HW_APPLET_LINK], cur_ptr->codebase, cur_ptr->code);
- else
- snprintf(istr, BUFFERLEN, " CODEBASE='/' CODE='%s'", cur_ptr->code);
- break;
- default:
- newtext = fnInsStr(newtext, cur_ptr->end+offset, "</A>");
-
- if(cur_ptr->nameanchor)
- snprintf(istr, BUFFERLEN, "<A HREF='%s/%s#%s'", scriptname[HW_DEFAULT_LINK], cur_ptr->destdocname, cur_ptr->nameanchor);
- else if(cur_ptr->fragment)
- snprintf(istr, BUFFERLEN, "<A HREF=\"%s/%s#%s\"", scriptname[HW_DEFAULT_LINK], cur_ptr->destdocname, cur_ptr->fragment);
- else
- snprintf(istr, BUFFERLEN, "<A HREF='%s/%s'", scriptname[HW_DEFAULT_LINK], cur_ptr->destdocname);
-
- if(cur_ptr->htmlattr) {
- strncat(istr, " ", BUFFERLEN - 1 - strlen(istr));
- strncat(istr, cur_ptr->htmlattr, BUFFERLEN - 1 - strlen(istr));
- }
- strncat(istr, ">", BUFFERLEN - 1 - strlen(istr));
- }
- }
- } else {
- if(laststart >= cur_ptr->end)
- offset = 0;
- newtext = fnInsStr(newtext, cur_ptr->end+offset, "</a>");
-
- /* If we have a keyword, we assume we had a fragment which has been used
- instead of the destdocname
- */
- if(cur_ptr->keyword)
- snprintf(istr, BUFFERLEN, "<A NAME='%s'>", cur_ptr->keyword);
- else if(cur_ptr->nameanchor)
- snprintf(istr, BUFFERLEN, "<A NAME='%s'>", cur_ptr->nameanchor);
- }
- newtext = fnInsStr(newtext, cur_ptr->start, istr);
- /* In case there are several TAGS nested, we accumulate the offset
- You wonder what the 4 means? It's the length of </A> */
- offset += strlen(istr) + 4;
- laststart = cur_ptr->start;
-#ifdef newlist
- ptr = (ANCHOR **) zend_llist_get_prev(pAnchorList);
- if(ptr)
- cur_ptr = *ptr;
-#else
- cur_ptr = (ANCHOR *) dlst_prev(cur_ptr);
-#endif
- }
- snprintf(istr, BUFFERLEN, "<BODY %s>", bgstr);
- *bodytag = estrdup(istr);
-/* if(scriptname != urlprefix) efree(scriptname); */
- if(scriptname != NULL) efree(scriptname);
- return(newtext);
-}
-#undef BUFFERLEN
-
-/***********************************************************************
-* Function fnAttributeValue() *
-* *
-* Returns the value of an attribute *
-* Parameter: char *object: object record *
-* char *attrname: attribute name *
-* Return: char*: attribute value, NULL if name not found *
-***********************************************************************/
-char *fnAttributeValue(char *object, char *attrname)
-{
- char *str, *str1, *attrvalue;
- int len;
-
- str = strstr(object, attrname);
- if(NULL == str)
- return(NULL);
- str += strlen(attrname);
- str++;
- str1 = str;
- while((*str1 != '\0') && (*str1 != '\n'))
- str1++;
- len = str1 - str;
- if(NULL == (attrvalue = emalloc(len+1))) {
- lowerror = LE_MALLOC;
- return NULL;
- }
- memcpy(attrvalue, str, len);
- attrvalue[len] = '\0';
- return(attrvalue);
-}
-
-/***********************************************************************
-* Function fnAttributeCompare() *
-* *
-* Checks if an attribute in an objrec has a certain value *
-* Parameter: char *object: object record *
-* char *attrname: attribute name *
-* char *value: value of attribute *
-* Return: char*: as strcmp *
-***********************************************************************/
-int fnAttributeCompare(char *object, char *attrname, char *value)
-{
- char *str, *str1;
- int len;
-
- if((NULL == object) || (NULL == attrname) || (NULL == value))
- return -2;
-
- /* Find the attribute Name and make sure it is followed by
- a '=' sign and preceded by a '\n';
- */
- str = strstr(object, attrname);
- if((NULL == str) ||
- (str[strlen(attrname)] != '=') ||
- (str[-1] != '\n')) {
- return(-2);
- }
- str += strlen(attrname); /* skip the attribute name */
- str++; /* skip the equal sign */
-
- /* Search for end of attribute value */
- str1 = str;
- while((*str1 != '\0') && (*str1 != '\n'))
- str1++;
- len = str1 - str;
- return(strncmp(str, value, len));
-}
-
-/*********************************************************************
-* Function fnCOpenDataCon() *
-* *
-* Opens data connection on client side. This function is called *
-* right after the client has requested any data from the server *
-* Parameter: int sockfd: socket of control connection *
-* int *port: port of control und data connection *
-* Return : sockfd on success, <0 if error *
-*********************************************************************/
-static int fnCOpenDataCon(int sockfd, int *port)
- {
- int fd;
- struct sockaddr_in serv_addr;
- int len;
- int option = 1;
-
-/* len = sizeof(com_addr);
- if(getsockname(sockfd, (struct sockaddr *) &com_addr, &len) < 0)
- {
- return(-1);
- }
-
- *port = htons(com_addr.sin_port); */
-
- /*
- ** Open a TCP socket (an Internet stream socket)
- */
- if((fd = socket(AF_INET, SOCK_STREAM, 0)) == SOCK_ERR)
- {
- return(-1);
- }
-
- /*
- ** Make sure that address may be reused
- */
-#if defined(SUN) || defined(PHP_WIN32)
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&option, sizeof(option));
-#else
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option));
-#endif
-
- /*
- ** Open connection aktiv
- ** Let bind() select a port number
- */
- bzero((char *) &serv_addr, sizeof(serv_addr));
- if(bind(fd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0)
- {
- return(-1);
- }
-
- /*
- ** Get the port number bind selected
- */
- len = sizeof (serv_addr);
- if(getsockname(fd, (struct sockaddr *)&serv_addr, &len) < 0)
- {
- return(-1);
- }
- *port = ntohs(serv_addr.sin_port);
-
- listen(fd, 5);
-
- return(fd);
- }
-
-/*======================================================================
- *
- * Read/write routines with timeout detection.
- *
- * Usage: write_to(fd, buffer, n, timeout)
- * read_to(fd, buffer, n, timeout)
- *
- * David Chavez
- * Engineering Services & Software
- * 7841 New Salem Street
- * San Diego, CA 92126
- * USA
- *
- * dec@essw.com
- *
- *====================================================================*/
-#ifdef PHP_WIN32
-#include <time.h>
-#else
-#include <sys/fcntl.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#endif
-#include <errno.h>
-#include <signal.h>
-
-#ifndef PHP_WIN32
-static sigset_t newmask, oldmask, zeromask;
-#endif
-
-static int set_noblock(int fd)
-{
-#ifdef PHP_WIN32
- u_long argp=1;
-
- return ioctlsocket (fd, FIONBIO , &argp);
-#else
-
- sigemptyset(&zeromask);
- sigemptyset(&newmask);
- sigaddset(&newmask, SIGHUP);
- sigaddset(&newmask, SIGUSR1);
- sigaddset(&newmask, SIGUSR2);
- if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0) return -1;
-
- return fcntl(fd, F_SETFL, O_NONBLOCK | O_NDELAY /* | FNBIO*/);
-#endif
-}
-
-int write_to(int fd, void *buffer, int n, int timeout)
-{
- int nrem, nw=0;
- char *bptr;
- int error=0;
-#if defined(SYSV) || defined(PHP_WIN32)
- int width = 20;
-#else
- int width = getdtablesize();
-#endif
- fd_set writefds;
- struct timeval select_timeout;
-
- select_timeout.tv_sec = timeout;
-#ifdef PHP_WIN32
- select_timeout.tv_usec = 0;
-#else /* is this just a typo? */
- select_timeout.tv_usec = 0.;
-#endif
-
- /* Set fd to non-blocking */
-
- if (set_noblock(fd) != 0) return -1;
-
- /* Write to fd until no more can be written */
-
- FD_ZERO(&writefds);
-
- FD_SET((unsigned int)fd, &writefds);
-
- for( nrem = n, bptr = buffer; nrem;)
- {
- if(( error = select(width,
- (fd_set *) 0,
- &writefds,
- (fd_set *) 0,
- &select_timeout)) <= 0 && errno != EINTR) break;
-
- if(errno != EINTR && ( nw = write(fd, bptr, nrem)) <= 0) {
- /*
- * check for error number - and keep trying to
- * write
- */
- if(errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR)
- {
- continue;
- }
- else
- {
- error = nw;
- break;
- }
- } else {
- nrem -= nw;
- bptr += nw;
- }
- }
-#ifndef PHP_WIN32
- if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) return -1;
-#endif
- if( ! error ) {
- errno = ETIMEDOUT;
- return(-2);
- } else if (error < 0) {
- return(error);
- } else {
- return(n);
- }
-}
-
-int read_to(int fd, char *buffer, int n, int timeout)
- {
- int nrem, nread, nr=0;
- char *bptr;
- int error=0;
-
-#if defined(SYSV) || defined(PHP_WIN32)
- int width = 20;
-#else
- int width = getdtablesize();
-#endif
- fd_set readfds;
- struct timeval select_timeout;
-
- select_timeout.tv_sec = timeout;
-#ifdef PHP_WIN32
- select_timeout.tv_usec = 0;
-#else
- select_timeout.tv_usec = 0.;
-#endif
-
- /* Set fd to non-blocking */
-
- if (set_noblock(fd) != 0) return -1;
-
- FD_ZERO(&readfds);
-
- FD_SET((unsigned int)fd, &readfds);
-
- for( nrem = n, bptr = buffer, nread = 0; nrem;)
- {
- if(( error = select(width,
- &readfds,
- (fd_set *) 0,
- (fd_set *) 0,
- &select_timeout)) <= 0 && errno != EINTR) break;
-
- if(errno != EINTR && (nr = read (fd, bptr, nrem)) < 0)
- {
- /*
- * check for error number - and keep trying to
- * read
- */
- if(errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR)
- {
- continue;
- }
- else
- {
- error = nr;
- break;
- }
- }
- else if(nr == 0)
- {
- break;
- }
- else
- {
- nread += nr;
- bptr += nr;
- nrem -= nr;
- }
- }
-
-#ifndef PHP_WIN32
- if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) return -1;
-#endif
- if( ! error )
- {
- errno = ETIMEDOUT;
- return(-2);
- }
- else if ( error < 0)
- {
- return(-1);
- }
- else
- {
- return(nread);
- }
- }
-
-void set_swap(int do_swap)
-{
- swap_on = do_swap;
-}
-
-/***********************************************************************
-* Function open_hg_connection() *
-* *
-***********************************************************************/
-int open_hg_connection(char *server_name, int port)
-{
- int sockfd;
- int option = 1;
- struct sockaddr_in server_addr;
- struct hostent *hp;
-
- if ( NULL == server_name )
- return(-1);
-
- if ( (hp = gethostbyname(server_name)) == NULL ) {
- return(-2);
- }
-
- bzero((char *)&server_addr, sizeof(server_addr));
- server_addr.sin_family = AF_INET;
- if ( port != 0 )
- server_addr.sin_port = htons(port);
- else
- server_addr.sin_port = htons(HG_SERVER_PORT);
-/* bcopy(hp->h_addr, (char *) &server_addr.sin_addr, hp->h_length); */
- server_addr.sin_addr = *(struct in_addr *) hp->h_addr;
-
- if ( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) == SOCK_ERR ) {
- return(-3);
- }
-
-#if defined(SUN) || defined(PHP_WIN32)
- setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&option, sizeof(option));
-#else
- setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option));
-#endif /* SUN */
-
- if (connect(sockfd, (struct sockaddr *) &server_addr, sizeof(server_addr)) < 0) {
- HWSOCK_FCLOSE(sockfd);
- return(-4);
- }
-
-#ifndef PHP_WIN32
- if ( (sock_flags = fcntl(sockfd, F_GETFL, 0)) == -1 )
-#endif
-
- if ( set_nonblocking(sockfd) == -1 ) {
- HWSOCK_FCLOSE(sockfd);
- return(-5);
- }
-
- return(sockfd);
-}
-
-
-/***********************************************************************
-* Function initialize_hg_connection() *
-* *
-***********************************************************************/
-int initialize_hg_connection(int sockfd, int *do_swap, int *version, char **userdata, char **server_string, char *username, char *password)
-{
- char buf, c;
- char *tmp;
- hg_msg *ready_msg, *retmsg, msg;
- int i = 0x01;
- int length;
-
- *do_swap = 0;
- buf = 'T';
- if ( hg_write(sockfd, &buf, 1) == -1 ) {
- return(-2);
- }
-
- if ( hg_read_exact(sockfd, &buf, 1) == -1 ) {
- return(-3);
- }
- if ( buf == 'F' ) {
- return(-4);
- }
- if ( buf != 'T' ) {
- return(-5);
- }
-
- buf = c = ( *(char *)&i ) ? 'l' : 'B';
- if ( hg_write(sockfd, &buf, 1) == -1 ) {
- return(-6);
- }
- if ( hg_read_exact(sockfd, &buf, 1) == -1 ) {
- return(-7);
- }
- if ( c != buf ) {
- swap_on = 1;
- *do_swap = 1;
- } else {
- swap_on = 0;
- *do_swap = 0;
- }
-
- if ( send_ready(sockfd) == -1) {
- return(-8);
- }
-
- /* Receive return from Ready message */
- if ( (ready_msg = recv_ready(sockfd)) == NULL ) {
- return(-9);
- }
-
- if ((ready_msg->version_msgid & F_VERSION) < HW_VERSION)
- return(-8);
- *version = ready_msg->version_msgid;
- *server_string = strdup(ready_msg->buf+4);
- efree(ready_msg->buf);
- efree(ready_msg);
-
- /* If we have a username and password then do the identification. */
- if((NULL != username) && (NULL != password)) {
- length = HEADER_LENGTH + sizeof(int) + strlen(username) + 1 + strlen(password) + 1;
-
- build_msg_header(&msg, length, msgid++, IDENTIFY_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, 0);
- tmp = build_msg_str(tmp, username);
- tmp = build_msg_str(tmp, password);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-10);
- }
- efree(msg.buf);
- }
-
- if((NULL != username) && (NULL != password)) {
- /* Receive return form identify message */
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-11);
-
- *userdata = retmsg->buf;
- efree(retmsg);
- }
-
- return(0);
-}
-
-
-static int set_nonblocking(int fd)
-{
-#ifdef PHP_WIN32
- unsigned int argp=0;
-
-/* if ( sock_flags == -1 )
- getsockopt (fd, SOL_SOCKET, optname, optval, optlen);
-*/ if(ioctlsocket (fd, FIONBIO , &argp) == -1)
- return(-1);
-#else
- if ( sock_flags == -1 )
- sock_flags = fcntl(fd, F_GETFL, 0);
- if ( fcntl(fd, F_SETFL, O_NONBLOCK) == -1 )
- return(-1);
-#endif
- non_blocking = 1;
- return(0);
-}
-
-
-/*
-static int set_blocking(int fd)
-{
-#ifdef PHP_WIN32
- unsigned int argp=1;
-
- if(ioctlsocket (fd, FIONBIO , &argp) == -1)
- return(-1);
-#else
- if ( fcntl(fd, F_SETFL, sock_flags) == -1 )
- return(-1);
-#endif
- return(0);
-}
-*/
-
-static int hg_read_exact(int sockfd, char *buf, int size)
-{
- int len = 0;
-
- len = read_to(sockfd, (void *) buf, size, rtimeout);
- if ( len < 0 )
- return -1;
- return(len);
-}
-
-/*
-static int hg_read(int sockfd, char *buf, int size)
-{
- int try = 0;
- int len = 0;
-
- if ( !non_blocking )
- set_nonblocking(sockfd);
- while ( len == 0 ) {
- len = recv(sockfd, (void *) buf, size, 0);
- if ( len == -1 ) {
- if ( (errno == EAGAIN) || (errno == EWOULDBLOCK) ) {
- if ( ++try > 5 )
- return(-1);
- php_sleep(1);
- }
- else return(-1);
- }
- }
- return(len);
-}
-*/
-
-static int hg_write(int sockfd, char *buf, int size)
-{
- int try = 0;
- int len = 0;
-
- if ( !non_blocking )
- set_nonblocking(sockfd);
- while ( size > 0 ) {
- len = send(sockfd, (void *) buf, size, 0);
- if ( len == -1 ) {
- if ( (errno == EAGAIN) || (errno == EWOULDBLOCK) ) {
- if ( ++try > 5 )
- return(-1);
- php_sleep(1);
- }
- else return(-1);
- }
- else {
- size -= len;
- buf += len;
- try = 0;
- }
- }
- return(0);
-}
-
-hg_msg *recv_hg_msg_head(int sockfd)
-{
- hg_msg *msg;
-
- if ( (msg = (hg_msg *)emalloc(sizeof(hg_msg))) == NULL ) {
- lowerror = LE_MALLOC;
- return(NULL);
- }
-
- if ( hg_read_exact(sockfd, (char *)&(msg->length), 4) == -1 ) {
- efree(msg);
- return(NULL);
- }
-
- if ( hg_read_exact(sockfd, (char *)&(msg->version_msgid), 4) == -1 ) {
- efree(msg);
- return(NULL);
- }
-
- if ( hg_read_exact(sockfd, (char *)&(msg->msg_type), 4) == -1 ) {
- efree(msg);
- return(NULL);
- }
-
-#ifdef HW_DEBUG
- php_printf("<b> Recv msg: </b>type = %d -- id = %d<br />\n", msg->msg_type, msg->version_msgid);
-#endif
- return(msg);
-}
-
-
-hg_msg *recv_hg_msg(int sockfd)
-{
- hg_msg *msg;
-
- if ( (msg = (hg_msg *)emalloc(sizeof(hg_msg))) == NULL ) {
-/* php_printf("recv_hg_msg"); */
- lowerror = LE_MALLOC;
- return(NULL);
- }
-
- if ( hg_read_exact(sockfd, (char *)&(msg->length), 4) == -1 ) {
-/* php_printf("recv_hg_msg: hg_read (1) returned -1\n"); */
- efree(msg);
- return(NULL);
- }
-
- if ( hg_read_exact(sockfd, (char *)&(msg->version_msgid), 4) == -1 ) {
-/* php_printf("recv_hg_msg: hg_read (2) returned -1\n"); */
- efree(msg);
- return(NULL);
- }
-
- if ( hg_read_exact(sockfd, (char *)&(msg->msg_type), 4) == -1 ) {
-/* php_printf("recv_hg_msg: hg_read (3) returned -1\n"); */
- efree(msg);
- return(NULL);
- }
-
- if ( msg->length > HEADER_LENGTH ) {
- if ( (msg->buf = (char *) emalloc(msg->length-HEADER_LENGTH)) == NULL ) {
-/* php_printf("recv_hg_msg"); */
- lowerror = LE_MALLOC;
- efree(msg);
- return(NULL);
- }
- if ( hg_read_exact(sockfd, msg->buf, msg->length-HEADER_LENGTH) == -1 ) {
-/* php_printf("recv_hg_msg: hg_read (4) returned -1\n"); */
- efree(msg->buf);
- efree(msg);
- return(NULL);
- }
- }
- else
- msg->buf = NULL;
-
-#ifdef HW_DEBUG
- php_printf("<b> Recv msg: </b>type = %d -- id = %d<br />\n", msg->msg_type, msg->version_msgid);
-#endif
- return(msg);
-}
-
-
-hg_msg *recv_ready(int sockfd)
-{
- hg_msg *ready_msg;
-
- if ( (ready_msg = recv_hg_msg(sockfd)) == NULL ) {
-/* php_printf("recv_ready: recv_hg_msg returned NULL\n"); */
- return(NULL);
- }
- if ( ready_msg->msg_type != READY_MESSAGE ) {
-/* php_printf("recv_ready: recv_hg_msg returned wrong message: %d, %d \n", ready_msg->length, ready_msg->msg_type); */
- efree(ready_msg);
- return(NULL);
- }
-
- return(ready_msg);
-}
-
-
-hg_msg *recv_command(int sockfd)
-{
- hg_msg *comm_msg;
-
- if ( (comm_msg = recv_hg_msg(sockfd)) == NULL ) {
-/* fprintf(stderr, "recv_command: recv_hg_msg returned NULL\n"); */
- return(NULL);
- }
- if ( comm_msg->msg_type != COMMAND_MESSAGE ) {
-/* fprintf(stderr, "recv_command: recv_hg_msg returned wrong message\n"); */
- return(NULL);
- }
-
- return(comm_msg);
-}
-
-int send_dummy(int sockfd, hw_objectID objectID, int msgid, char **attributes)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, msgid);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- *attributes = NULL;
- return(-1);
- }
-
- if(0 == (int) *(retmsg->buf)) {
- *attributes = estrdup(retmsg->buf+sizeof(int));
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- error = *((int *) retmsg->buf);
- *attributes = NULL;
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- return(0);
-}
-
-static int bh_send_deleteobject(int sockfd, hw_objectID objectID) {
- hg_msg msg;
- int length;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, DELETEOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
-
- return(msgid-1);
-}
-
-static int uh_send_deleteobject(int sockfd) {
- hg_msg *retmsg;
- int error;
-
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- if(NULL == retmsg->buf) {
- efree(retmsg);
- return -1;
- }
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return(error);
-}
-
-int send_deleteobject(int sockfd, hw_objectID objectID)
-{
- if(0 > bh_send_deleteobject(sockfd, objectID))
- return -1;
- return(uh_send_deleteobject(sockfd));
-}
-
-static int bh_send_changeobject(int sockfd, hw_objectID objectID, char *mod) {
- hg_msg msg;
- int length;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID) + strlen(mod) + 1;
-
- build_msg_header(&msg, length, msgid++, CHANGEOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- tmp = build_msg_str(tmp, mod);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
-
- return(msgid-1);
-}
-
-static int uh_send_changeobject(int sockfd) {
- hg_msg *retmsg;
- int error;
-
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return(error);
-}
-
-int send_changeobject(int sockfd, hw_objectID objectID, char *modification)
-{
- if(0 > bh_send_changeobject(sockfd, objectID, modification))
- return -1;
- return(uh_send_changeobject(sockfd));
-}
-
-int send_groupchangeobject(int sockfd, hw_objectID objectID, char *modification)
-{
- hw_objectID *childIDs;
- int count, i, error;
-
- if(0 == (error = send_lock(sockfd, objectID))) {
- send_changeobject(sockfd, objectID, modification);
- send_unlock(sockfd, objectID);
- }/* else
- fprintf(stderr, "Could not lock 0x%X (error = %d)\n", objectID, error); */
-
- if(0 == send_children(sockfd, objectID, &childIDs, &count)) {
-/* fprintf(stderr, "Changing Children of 0x%X\n", objectID); */
- for(i=0; i<count; i++)
- if(0 > send_groupchangeobject(sockfd, childIDs[i], modification))
-/* fprintf(stderr, "Cannot change 0x%X\n", objectID) */;
- if(childIDs)
- efree(childIDs);
- }/* else
- fprintf(stderr, "No Children of 0x%X\n", objectID); */
- return(0);
-}
-
-static int bh_send_getobject(int sockfd, hw_objectID objectID) {
- hg_msg msg;
- int length;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
-
- return(msgid-1);
-}
-
-static int uh_send_getobject(int sockfd, char **attributes) {
- hg_msg *retmsg;
- int error;
-
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- *attributes = NULL;
- return(-1);
- }
-
- if(0 == (int) *(retmsg->buf)) {
- *attributes = estrdup(retmsg->buf+sizeof(int));
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- error = *((int *) retmsg->buf);
- *attributes = NULL;
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- return(0);
-}
-
-int send_getobject(int sockfd, hw_objectID objectID, char **attributes)
-{
- if(0 > bh_send_getobject(sockfd, objectID))
- return -1;
- return(uh_send_getobject(sockfd, attributes));
-}
-
-int send_getandlock(int sockfd, hw_objectID objectID, char **attributes)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETANDLOCK_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- *attributes = NULL;
- return(-1);
- }
-
- if(0 == (error = (int) *(retmsg->buf))) {
- *attributes = estrdup(retmsg->buf+sizeof(int));
- } else {
- *attributes = NULL;
- }
-
- efree(retmsg->buf);
- efree(retmsg);
- return error;
-}
-
-int send_lock(int sockfd, hw_objectID objectID)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETANDLOCK_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- error = *((int *) retmsg->buf);
-
- efree(retmsg->buf);
- efree(retmsg);
- return error;
-}
-
-int send_insertobject(int sockfd, char *objrec, char *parms, hw_objectID *objectID)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr;
-
- length = HEADER_LENGTH + strlen(objrec) + 1 + strlen(parms) + 1;
-
- build_msg_header(&msg, length, msgid++, INSERTOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, objrec);
- tmp = build_msg_str(tmp, parms);
-/*fprintf(stderr, "objrec = %s, parms = %s\n", objrec, parms); */
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- *objectID = 0;
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(0 == (error = *ptr)) {
- ptr++;
- *objectID = *ptr;
- } else {
- *objectID = 0;
- }
- efree(retmsg->buf);
- efree(retmsg);
- return error;
-}
-
-int send_unlock(int sockfd, hw_objectID objectID)
-{
- hg_msg msg;
- int length;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, UNLOCK_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- return 0;
-}
-
-int send_incollections(int sockfd, int retcol, int cobjids, hw_objectID *objectIDs, int ccollids, hw_objectID *collIDs, int *count, hw_objectID **retIDs)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, *ptr1, i;
-
- length = HEADER_LENGTH + sizeof(hw_objectID) + (cobjids + ccollids) * sizeof(hw_objectID) + 2 * sizeof(int);
-
- build_msg_header(&msg, length, msgid++, INCOLLECTIONS_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-3);
- }
-
- tmp = build_msg_int(msg.buf, retcol);
- tmp = build_msg_int(tmp, cobjids);
- for(i=0; i<cobjids; i++)
- tmp = build_msg_int(tmp, objectIDs[i]);
- tmp = build_msg_int(tmp, ccollids);
- for(i=0; i<ccollids; i++)
- tmp = build_msg_int(tmp, collIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if(retmsg == NULL) {
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr;
- ptr++;
- if(NULL != (*retIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *retIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- if(retmsg->buf) efree(retmsg->buf);
- if(retmsg) efree(retmsg);
- return error;
- }
- return(0);
-}
-
-
-int send_inscoll(int sockfd, hw_objectID objectID, char *objrec, hw_objectID *new_objectID)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr;
-
- length = HEADER_LENGTH + sizeof(hw_objectID) + strlen(objrec) + 1;
-
- build_msg_header(&msg, length, msgid++, INSCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-3);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- tmp = build_msg_str(tmp, objrec);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if(retmsg == NULL) {
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(0 != (error = *ptr)) {
- efree(retmsg->buf);
- efree(retmsg);
- *new_objectID = 0;
- return error;
- }
-
- ptr++;
- *new_objectID = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- return 0;
-}
-
-int send_insdoc(int sockfd, hw_objectID objectID, char *objrec, char *text, hw_objectID *new_objectID)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr;
-
- length = HEADER_LENGTH + sizeof(hw_objectID) + strlen(objrec) + 1;
- if(text) {
- length += strlen(text);
- length++;
- }
-
- build_msg_header(&msg, length, msgid++, INSDOC_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-3);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- tmp = build_msg_str(tmp, objrec);
- if(text)
- tmp = build_msg_str(tmp, text);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if(retmsg == NULL) {
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(0 != (error = *ptr)) {
- efree(retmsg->buf);
- efree(retmsg);
- *new_objectID = 0;
- return error;
- }
-
- ptr++;
- *new_objectID = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- return 0;
-}
-
-int send_getdestforanchorsobj(int sockfd, char **anchorrec, char ***destrec, int count);
-int send_getreldestforanchorsobj(int sockfd, char **anchorrec, char ***reldestrec, int count, int rootID, int thisID);
-
-int send_gettext(int sockfd, hw_objectID objectID, int mode, int rootid, char **objattr, char **bodytag, char **text, int *count, char *urlprefix)
-{
- hg_msg msg, *retmsg;
- int length, *ptr, ancount, error;
- char *tmp, *attributes, *documenttype;
- char **anchors;
- int i;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if(retmsg == NULL) {
- attributes = NULL;
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(*ptr == 0) {
- attributes = estrdup(retmsg->buf+sizeof(int));
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- error = *ptr;
- attributes = NULL;
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- length = HEADER_LENGTH + strlen(attributes) + 1;
- build_msg_header(&msg, length, msgid++, GETTEXT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, attributes);
-
- documenttype = fnAttributeValue(attributes, "DocumentType");
- *objattr = strdup(attributes);
- efree(attributes);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if (retmsg == NULL) {
- *text = NULL;
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(*ptr == 0) {
- ptr++;
- *count = retmsg->length-HEADER_LENGTH-sizeof(int);
- if(NULL != (*text = malloc(*count + 1))) {
- memcpy(*text, retmsg->buf+sizeof(int), *count);
-/* *text[*count] = 0; */
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- *text = NULL;
- return(error);
- }
- efree(retmsg->buf);
- efree(retmsg);
-
- if((documenttype != NULL) && (strcmp(documenttype, "Image") != 0)) {
- if(send_getanchorsobj(sockfd, objectID, &anchors, &ancount) == 0) {
- char **destrec, **reldestrec;
-#ifdef newlist
- zend_llist *pAnchorList;
-#else
- DLIST *pAnchorList;
-#endif
-
- /* Get dest as relative and absolut path */
- send_getdestforanchorsobj(sockfd, anchors, &destrec, ancount);
- send_getreldestforanchorsobj(sockfd, anchors, &reldestrec, ancount, rootid, objectID);
- pAnchorList = fnCreateAnchorList(objectID, anchors, destrec, reldestrec, ancount, mode);
-
- /* Free only the array, the objrecs has been freed in fnCreateAnchorList() */
- if(anchors) efree(anchors);
- if(destrec) efree(destrec);
- if(reldestrec) efree(reldestrec);
-
- if(pAnchorList != NULL) {
- char *newtext;
- char *body = NULL;
- char **prefixarray;
-
- prefixarray = emalloc(5*sizeof(char *));
- for(i=0; i<5; i++)
- prefixarray[i] = urlprefix;
-
- newtext = fnInsAnchorsIntoText(*text, pAnchorList, &body, prefixarray);
-
- efree(prefixarray);
-#ifdef newlist
- zend_llist_destroy(pAnchorList);
- efree(pAnchorList);
-#else
- dlst_kill(pAnchorList, fnDeleteAnchor);
-#endif
- *bodytag = strdup(body);
- if(body) efree(body);
- *text = newtext;
- *count = strlen(newtext);
- }
- }
- }
-
- if(documenttype) efree(documenttype);
- return(0);
-}
-
-int send_insertanchors(char **text, int *count, char **anchors, char **destrec, int ancount, char **urlprefix, char **bodytag) {
- char **reldestrec = NULL;
- int mode = 0;
- hw_objectID objectID = 0;
-#ifdef newlist
- zend_llist *pAnchorList = NULL;
-#else
- DLIST *pAnchorList = NULL;
-#endif
- pAnchorList = fnCreateAnchorList(objectID, anchors, destrec, reldestrec, ancount, mode);
-
- /* Free only the array, the objrecs has been freed in fnCreateAnchorList() */
- if(anchors) efree(anchors);
- if(destrec) efree(destrec);
- if(reldestrec) efree(reldestrec);
-
- if(pAnchorList != NULL) {
- char *newtext;
- char *body = NULL;
-
- newtext = fnInsAnchorsIntoText(*text, pAnchorList, &body, urlprefix);
-
-#ifdef newlist
- zend_llist_destroy(pAnchorList);
- efree(pAnchorList);
-#else
- dlst_kill(pAnchorList, fnDeleteAnchor);
-#endif
- *bodytag = strdup(body);
- if(body) efree(body);
- *text = newtext;
- *count = strlen(newtext);
- }
- return 0;
-}
-
-int send_edittext(int sockfd, char *objattr, char *text)
-{
- hg_msg msg, *retmsg;
- int length, *ptr, error;
- char *tmp, *path, *objid;
- hw_objectID objectID;
-
- objid = fnAttributeValue(objattr, "ObjectID");
- if(objid == NULL)
- return(-1);
- if(!sscanf(objid, "0x%x", &objectID))
- return(-2);
-
- path = fnAttributeValue(objattr, "Path");
- if(path == NULL)
- return(-3);
-
- length = HEADER_LENGTH + sizeof(hw_objectID) + strlen(path) + 1 + 1 + strlen(text) + 1;
- build_msg_header(&msg, length, msgid++, EDITTEXT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-4);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- tmp = build_msg_str(tmp, path);
- tmp = build_msg_str(tmp, "");
- tmp = build_msg_str(tmp, text);
-
- if(path) efree(path);
- if(objid) efree(objid);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-5);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if (retmsg == NULL) {
- *text = '\0';
- return(-6);
- }
-
- ptr = (int *) retmsg->buf;
- error = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- return(error);
-}
-
-int send_getcgi(int sockfd, hw_objectID objectID, char *cgi_env_str, char **objattr, char **text, int *count)
-{
- hg_msg msg, *retmsg;
- int length, *ptr, error, new_attr_len;
- char *tmp, *attributes, *new_attr;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if(retmsg == NULL) {
- attributes = NULL;
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(*ptr == 0) {
- attributes = estrdup(retmsg->buf+sizeof(int));
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- error = *ptr;
- attributes = NULL;
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- new_attr_len = strlen(attributes) + strlen(cgi_env_str) + 2;
- new_attr = malloc(new_attr_len);
- strcpy(new_attr, attributes);
- strcat(new_attr, cgi_env_str);
- length = HEADER_LENGTH + strlen(new_attr) + 1 + sizeof(int);
- build_msg_header(&msg, length, msgid++, GETCGI_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, new_attr);
- tmp = build_msg_int(tmp, 0);
-
- *objattr = strdup(attributes);
- efree(attributes);
- free(new_attr);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if (retmsg == NULL) {
- *text = NULL;
- return(-1);
- }
-
- /* Attention: It looks like the documentation is not quite right.
- According to the docs the buffer starts with an integer which
- is followed by the output of the cgi script. This seems not to
- be true. There is another integer right after the error.
- The output of the cgi script is also preceded by the 'Content-type'
- header. */
- ptr = (int *) retmsg->buf;
- if(*ptr++ == 1024) {
- *count = *ptr++;
- if(NULL != (*text = malloc(*count + 1))) {
- memcpy(*text, ptr, *count);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *ptr + 1024; /* move errors to >2024 */
- efree(retmsg->buf);
- efree(retmsg);
- *text = NULL;
- return(error);
- }
- efree(retmsg->buf);
- efree(retmsg);
-
- return(0);
-}
-
-int send_getremote(int sockfd, hw_objectID objectID, char **objattr, char **text, int *count)
-{
- hg_msg msg, *retmsg;
- int length, *ptr, error;
- char *tmp, *attributes;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if(retmsg == NULL) {
- attributes = NULL;
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(*ptr == 0) {
- attributes = estrdup(retmsg->buf+sizeof(int));
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- error = *ptr;
- attributes = NULL;
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- length = HEADER_LENGTH + strlen(attributes) + 1 + sizeof(int);
- build_msg_header(&msg, length, msgid++, GETREMOTE_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, attributes);
- tmp = build_msg_int(tmp, 0);
-
- *objattr = strdup(attributes);
- efree(attributes);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if (retmsg == NULL) {
- *text = NULL;
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(*ptr == 1024) {
- *count = retmsg->length-HEADER_LENGTH-sizeof(int)-sizeof(int);
- if(NULL != (*text = malloc(*count + 1))) {
- memcpy(*text, ptr+2, *count);
-/* *text[*count] = 0; */
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *ptr + 1024; /* move errors to >2024 */
- efree(retmsg->buf);
- efree(retmsg);
- *text = NULL;
- return(error);
- }
- efree(retmsg->buf);
- efree(retmsg);
-
- return(0);
-}
-
-int send_getremotechildren(int sockfd, char *attributes, char **text, int **childIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, *ptr, *ptr1, error;
- char *tmp;
-
-/* length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if(retmsg == NULL) {
- attributes = NULL;
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(*ptr == 0) {
- attributes = estrdup(retmsg->buf+sizeof(int));
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- error = *ptr;
- attributes = NULL;
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-*/
- length = HEADER_LENGTH + strlen(attributes) + 1 + sizeof(int);
- build_msg_header(&msg, length, msgid++, GETREMOTECHILDREN_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, attributes);
- tmp = build_msg_int(tmp, 0);
-
-/* efree(attributes); */
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if (retmsg == NULL) {
- *childIDs = NULL;
- return(-1);
- }
- ptr = (int *) retmsg->buf;
- if(*ptr++ == 1024) {
- int i, remlen, sum;
- *count = *ptr;
- ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- sum = 0;
- for(i=0; i<*count; ptr++, i++) {
- ptr1[i] = *ptr;
- sum += *ptr;
- }
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- remlen = retmsg->length - HEADER_LENGTH - *count * sizeof(int) - 2 * sizeof(int);
-/*ptr1[i-1] = remlen; */
-/*ptr1[i-2] = sum; */
-/*ptr1[i-3] = *count; */
- if(NULL != (*text = emalloc(remlen + 1))) {
- memcpy(*text, ptr, remlen);
- } else {
- efree(childIDs);
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- *childIDs = NULL;
- *text = NULL;
- return error;
- }
- return(0);
-}
-
-int send_mvcpdocscollscoll(int sockfd, hw_objectID *objectIDs, int count, int from, int dest, int cpmv, int doccoll)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
-
- if(count <= 0)
- return 0;
-
- /* HEADER_LENGTH + cpmv + from + dest + count + nr of obj */
- length = HEADER_LENGTH + sizeof(hw_objectID) + sizeof(hw_objectID) + sizeof(hw_objectID) + sizeof(hw_objectID) + count * sizeof(hw_objectID);
-
- switch(doccoll) {
- case DOCUMENT:
- build_msg_header(&msg, length, msgid++, MVCPDOCSCOLL_MESSAGE);
- break;
- case COLLECTION:
- build_msg_header(&msg, length, msgid++, MVCPCOLLSCOLL_MESSAGE);
- break;
- }
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, cpmv);
- tmp = build_msg_int(tmp, from);
- tmp = build_msg_int(tmp, dest);
- tmp = build_msg_int(tmp, count);
- for(i=0; i<count;i++)
- tmp = build_msg_int(tmp, objectIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return(error);
-}
-
-int send_docbyanchor(int sockfd, hw_objectID objectID, hw_objectID *anchorID)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETDOCBYANCHOR_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- error = *ptr++;
- if(error == 0) {
- *anchorID = *ptr;
- } else {
- *anchorID = 0;
- }
- efree(retmsg->buf);
- efree(retmsg);
- return error;
-}
-
-int send_docbyanchorobj(int sockfd, hw_objectID objectID, char **objrec)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, anchorID;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETDOCBYANCHOR_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- error = *ptr++;
- if(error == 0) {
- anchorID = *ptr;
- } else {
- anchorID = 0;
- }
- efree(retmsg->buf);
- efree(retmsg);
-
- if(0 > bh_send_getobject(sockfd, anchorID))
- return -1;
- return(uh_send_getobject(sockfd, objrec));
-}
-
-int send_children(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- int *ptr, *ptr1;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, CHILDREN_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if (-1 == send_hg_msg(sockfd, &msg, length)) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-3);
- }
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- return(0);
-}
-
-int send_childrenobj(int sockfd, hw_objectID objectID, char ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- int *childIDs = NULL;
- int *ptr;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, CHILDREN_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- for(i=0; i<*count; ptr++, i++)
- childIDs[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each child collection the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- efree(childIDs);
- return -2;
- }
- efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- efree(childIDs);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(childIDs);
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getchildcoll(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, i, *ptr1;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETCHILDCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- return(0);
-}
-
-int send_getchildcollobj(int sockfd, hw_objectID objectID, char ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- int *childIDs = NULL;
- int *ptr;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETCHILDCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- for(i=0; i<*count; ptr++, i++)
- childIDs[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each child collection the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- efree(childIDs);
- return -2;
- }
- efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- efree(childIDs);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(childIDs);
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getchilddoccoll(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETCHILDDOCCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- } else {
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- int *ptr, i, *ptr1;
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
- }
- }
-
- return(0);
-
-}
-
-int send_getchilddoccollobj(int sockfd, hw_objectID objectID, hw_objrec ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *childIDs = NULL;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETCHILDDOCCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
-
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- int *ptr, i;
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg->buf) efree(retmsg->buf);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- for(i=0; i<*count; ptr++, i++)
- childIDs[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
- }
-
- /* Now get for each child collection the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- efree(childIDs);
- return -2;
- }
- efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- }
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getanchors(int sockfd, hw_objectID objectID, int **anchorIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, i, *ptr1;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETANCHORS_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
-
- if (NULL == (retmsg = recv_hg_msg(sockfd)))
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (*anchorIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *anchorIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- return(0);
-}
-
-int send_getanchorsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, i, *ptr1;
- int *anchorIDs = NULL;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, 50, GETANCHORS_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
-
- if (NULL == (retmsg = recv_hg_msg(sockfd)))
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (anchorIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = anchorIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each anchor the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, anchorIDs, count, NULL, childrec)) {
- efree(anchorIDs);
- return -2;
- }
- efree(anchorIDs);
-#else
- for(i=0; i<*count; i++) {
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, anchorIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, anchorIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- }
- if(anchorIDs) efree(anchorIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getdestforanchorsobj(int sockfd, char **anchorrec, char ***destrec, int count)
-{
- int i;
- char *objptr, **destptr;
- char *str;
- int objectID;
-
- if(NULL == (destptr = (char **) emalloc(count * sizeof(hw_objrec *)))) {
- lowerror = LE_MALLOC;
- return -1;
- }
-
- /* Now get for each anchor the object record of its destination */
- for(i=0; i<count; i++) {
- /* if you retrieve the anchors you sometimes get more than actually accessible.
- */
- if((NULL != anchorrec[i]) && (NULL != (str = fnAttributeValue(anchorrec[i], "Dest")))) {
- sscanf(str, "0x%x", &objectID);
- efree(str);
-
- /* Using send_docbyanchorobj() makes sense because the Destination can
- be both, an anchor or a document. If it is a document you get the
- objectrecord of that document. If it is an anchor the function
- graps the document which belongs to the anchor
- and you get also the objectrecord of that document.
- */
- if(0 > send_docbyanchorobj(sockfd, objectID, &objptr)) {
- efree(destptr);
- return -1;
- }
- destptr[i] = objptr;
- /* if we can't get the object rec of the dest, than this document
- is probably not accessible for us. For later functions simply
- set anchorrec[i] to NULL */
- if(destptr[i] == NULL) {
- if(anchorrec[i]) efree(anchorrec[i]);
- anchorrec[i] = NULL;
- }
- } else {
- destptr[i] = NULL;
- }
- }
- *destrec = destptr;
-
- return(0);
-}
-
-int send_getreldestforanchorsobj(int sockfd, char **anchorrec, char ***reldestrec, int count, int rootID, int thisID)
-{
- int i;
- char *docofanchorptr, **reldestptr;
- char *str;
- int destobjectID;
-
- if(NULL == (reldestptr = (char **) emalloc(count * sizeof(char *)))) {
- lowerror = LE_MALLOC;
- return -1;
- }
-
- /* Now get for each anchor the object record of its destination */
- for(i=0; i<count; i++) {
- /* if you retrieve the anchors you sometimes get more than actually accessible.
- */
- if((NULL != anchorrec[i]) && (NULL != (str = fnAttributeValue(anchorrec[i], "Dest")))) {
- sscanf(str, "0x%x", &destobjectID);
- efree(str);
-
- /* See note in send_getdestforanchorsobj() at same position in source code */
- if(0 > send_docbyanchorobj(sockfd, destobjectID, &docofanchorptr)) {
- efree(reldestptr);
- return -1;
- }
-
- reldestptr[i] = docofanchorptr;
- /* if we can't get the object rec of the dest, than this document
- is probably not accessible for us. For later functions simply
- set anchorrec[i] to NULL */
- if(reldestptr[i] == NULL) {
- if(anchorrec[i]) efree(anchorrec[i]);
- anchorrec[i] = NULL;
- } else {
- int j, *retthisIDs, *retdestIDs, equaltill, mincount, countthis, countdest, destdocid;
- char destdocname[200];
- char anchorstr[300];
- char temp[200];
- char *strptr;
-
- if(NULL != (str = strstr(docofanchorptr, "Name="))) {
- str += 5;
- sscanf(str, "%s\n", destdocname);
- }
- if(NULL != (str = strstr(docofanchorptr, "ObjectID="))) {
- str += 9;
- sscanf(str, "0x%X", &destdocid);
- }
-
- send_incollections(sockfd, 1, 1, &thisID, 1, &rootID, &countthis, &retthisIDs);
- send_incollections(sockfd, 1, 1, &destdocid, 1, &rootID, &countdest, &retdestIDs);
-
-/*
-fprintf(stderr, "%d: ", thisID);
-for(k=0; k<countthis; k++)
- fprintf(stderr, "%d, ", retthisIDs[k]);
-fprintf(stderr, "\n");
-fprintf(stderr, "%d: ", destdocid);
-for(k=0; k<countdest; k++)
- fprintf(stderr, "%d: %d, ", destdocid, retdestIDs[k]);
-fprintf(stderr, "\n");
-*/
-
- mincount = (countthis < countdest) ? countthis : countdest;
- for(j=0; (j<mincount) && (retthisIDs[j]==retdestIDs[j]); j++)
- ;
- equaltill = j;
- strcpy(anchorstr, "Name=");
- for(j=equaltill; j<countthis; j++)
- strcat(anchorstr, "../");
- strcat(anchorstr, "./");
- for(j=equaltill; j<countdest; j++) {
- char *temprec, tempname[100];
- send_getobject(sockfd, retdestIDs[j], &temprec);
- if(NULL != (str = strstr(temprec, "Name="))) {
- str += 5;
- sscanf(str, "%s\n", tempname);
- } else if(NULL != (str = strstr(temprec, "ObjectID="))) {
- str += 9;
- sscanf(str, "%s\n", tempname);
- }
-
- sprintf(temp, "%s", tempname);
- strptr = temp;
- while(*strptr != '\0') {
- if(*strptr == '/')
- *strptr = '_';
- strptr++;
- }
-/* fprintf(stderr, "Adding '%s' to '%s'\n", temp, anchorstr); */
- strcat(anchorstr, temp);
- strcat(anchorstr, "/");
-/* fprintf(stderr, "Is now '%s'\n", anchorstr); */
- efree(temprec);
- }
- /* if the anchor destination is a collection it may not be added anymore. */
- if(destdocid != retdestIDs[countdest-1]) {
- strptr = destdocname;
- while(*strptr != '\0') {
- if(*strptr == '/')
- *strptr = '_';
- strptr++;
- }
- strcat(anchorstr, destdocname);
- } else {
- strcat(anchorstr, "index.html");
- }
- strcat(anchorstr, "\n");
- sprintf(temp, "ObjectID=0x%x", destdocid);
- strcat(anchorstr, temp);
-/* fprintf(stderr, "%s\n", anchorstr); */
- efree(retthisIDs);
- efree(retdestIDs);
- efree(reldestptr[i]);
- reldestptr[i] = estrdup(anchorstr);
- }
- } else {
- reldestptr[i] = NULL;
- }
- }
- *reldestrec = reldestptr;
-
- return(0);
-}
-
-int fn_findpath(int sockfd, int *retIDs, int count, int id) {
- int *pathIDs;
- int *parentIDs, pcount, pid;
- int u, j, i;
-
- if(NULL == (pathIDs = emalloc(count * sizeof(int)))) {
- lowerror = LE_MALLOC;
- return -1;
- }
- u = count-1;
- pid = id;
- pcount = 1;
- /* FIXME but parentIDs is not set at this point, why checking it? */
- while((u >= 0) && (pcount != 0) && (parentIDs != NULL) && (pid != 0)) {
-/*fprintf(stderr, "Get parents for %d\n", pid); */
- if(0 != send_getparents(sockfd, pid, &parentIDs, &pcount)) {
- efree(pathIDs);
- return -1;
- }
- pid = 0;
- for(i=0; i<pcount; i++) {
- for(j=0; j<count; j++) {
- if(parentIDs[i] == retIDs[j]) {
- pathIDs[u--] = retIDs[j];
- pid = retIDs[j];
- }
- }
- }
- if(pid == 0)
- fprintf(stderr, "parent not found in list\n");
- if(parentIDs) efree(parentIDs);
- }
-/*fprintf(stderr, "sorted path: "); */
- for(i=0; i<count; i++) {
- retIDs[i] = pathIDs[i];
-/*fprintf(stderr, "%d, ", retIDs[i]); */
- }
-/*fprintf(stderr, "\n"); */
- efree(pathIDs);
- return 0;
-}
-
-/********************************************************************
-* function getrellink() *
-* *
-* Returns the link to point from document with ID sourceID to *
-* document with id destID. *
-********************************************************************/
-int getrellink(int sockfd, int rootID, int thisID, int destID, char **reldeststr) {
- int i, j, k, *retthisIDs, *retdestIDs, equaltill, count, mincount, countthis, countdest;
- char anchorstr[300];
- char temp[200];
- char *strptr;
-
- send_incollections(sockfd, 1, 1, &thisID, 1, &rootID, &countthis, &retthisIDs);
- send_incollections(sockfd, 1, 1, &destID, 1, &rootID, &countdest, &retdestIDs);
-
-
-fprintf(stderr, "%d: ", thisID);
-for(k=0; k<countthis; k++)
- fprintf(stderr, "%d, ", retthisIDs[k]);
-fprintf(stderr, "\n");
-fprintf(stderr, "%d: ", destID);
-for(k=0; k<countdest; k++)
- fprintf(stderr, "%d, ", retdestIDs[k]);
-fprintf(stderr, "\n");
-
- /*
- ** The message incollections returned a list of collections
- ** in which the destID or thisID is contained. Unfortunately
- ** this list ist not the path for the destID or thisID, but
- ** a sorted list of collection IDs. If for example you are
- ** looking for an ID 20 which has a path 1 -> 5 -> 4 -> 20
- ** (this means: 20 is child of 4, 4 is child of 5, 5 is child
- ** of 1) it will return 1, 4, 5 instead of 1, 5, 4
- ** Consequently, we have to create the correct path, by checking
- ** for the parents and identifying it in the list.
- ** But there is another problem. If the id for which the list of
- ** of collection is generated is a colletion itself, it will
- ** show up in the list as well. In order to make the algorithmn
- ** work proberly it has to be the last member of the list.
- */
- for(i=0; i<countdest; i++)
- if(retdestIDs[i] == destID) {
- retdestIDs[i] = retdestIDs[countdest-1];
- retdestIDs[countdest-1] = destID;
- }
- count = (retdestIDs[countdest-1] == destID) ? countdest-1 : countdest;
- if(0 != fn_findpath(sockfd, retdestIDs, count, destID)) {
- efree(retthisIDs);
- efree(retdestIDs);
- return -1;
- }
- for(i=0; i<countthis; i++)
- if(retthisIDs[i] == thisID) {
- retthisIDs[i] = retthisIDs[countthis-1];
- retthisIDs[countthis-1] = thisID;
- }
- count = (retthisIDs[countthis-1] == thisID) ? countthis-1 : countthis;
- if(0 != fn_findpath(sockfd, retthisIDs, count, thisID)) {
- efree(retthisIDs);
- efree(retdestIDs);
- return -1;
- }
-
- mincount = (countthis < countdest) ? countthis : countdest;
-fprintf(stderr, "mincount = %d\n", mincount);
- for(j=0; (j<mincount) && (retthisIDs[j]==retdestIDs[j]); j++)
- ;
- equaltill = j;
-fprintf(stderr, "first unequal = %d\n", j);
- strcpy(anchorstr, "");
- for(j=equaltill; j<countthis; j++)
- strcat(anchorstr, "../");
- strcat(anchorstr, "./");
- for(j=equaltill; j<countdest; j++) {
- char *temprec, *str, tempname[100];
- if(0 == send_getobject(sockfd, retdestIDs[j], &temprec)) {
- if(NULL != (str = strstr(temprec, "Name="))) {
- str += 5;
- sscanf(str, "%s\n", tempname);
- } else if(NULL != (str = strstr(temprec, "ObjectID="))) {
- str += 9;
- sscanf(str, "%s\n", tempname);
- }
-
- sprintf(temp, "%s", tempname);
- strptr = temp;
- while(*strptr != '\0') {
- if(*strptr == '/')
- *strptr = '_';
- strptr++;
- }
-fprintf(stderr, "Adding '%s' (%d) to '%s'\n", temp, retdestIDs[j], anchorstr);
- strcat(anchorstr, temp);
- strcat(anchorstr, "/");
-fprintf(stderr, "Is now '%s'\n", anchorstr);
- efree(temprec);
- } else {
- strcat(anchorstr, "No access/");
- }
- }
- /* if the anchor destination is a collection it may not be added anymore. */
- if(destID != retdestIDs[countdest-1]) {
- char destdocname[100], *str;
- send_getobject(sockfd, destID, &str);
- if(NULL != (strptr = strstr(str, "Name="))) {
- strptr += 5;
- sscanf(strptr, "%s\n", destdocname);
- }
- strptr = destdocname;
- while(*strptr != '\0') {
- if(*strptr == '/')
- *strptr = '_';
- strptr++;
- }
- strcat(anchorstr, destdocname);
- efree(str);
- } else {
-/* strcat(anchorstr, "index.html"); */
- }
-/*fprintf(stderr, "%s\n", anchorstr); */
- efree(retthisIDs);
- efree(retdestIDs);
- *reldeststr = estrdup(anchorstr);
- return 0;
-}
-
-int send_identify(int sockfd, char *name, char *passwd, char **userdata) {
- hg_msg msg, *retmsg;
- int length;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(int) + strlen(name) + 1 + strlen(passwd) + 1;
-
- build_msg_header(&msg, length, msgid++, IDENTIFY_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, 0);
- tmp = build_msg_str(tmp, name);
- tmp = build_msg_str(tmp, passwd);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- *userdata = (char *) retmsg->buf;
- efree(retmsg);
-
- return(0);
-}
-
-int send_objectbyidquery(int sockfd, hw_objectID *IDs, int *count, char *query, char ***objrecs)
-{
- hg_msg msg, *retmsg;
- int length;
- char *tmp, *str;
- int *ptr, i;
- int *offsets, *childIDs;
- char **childrec;
-
- if(*count <= 0) {
- *objrecs = emalloc(0);
- return(0);
- }
- length = HEADER_LENGTH + sizeof(int) + sizeof(int) + *count * sizeof(hw_objectID);
- if(query)
- length = length + strlen(query) + 1;
-
- build_msg_header(&msg, length, msgid++, OBJECTBYIDQUERY_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, 1);
- tmp = build_msg_int(tmp, *count);
- for(i=0; i<*count; i++)
- tmp = build_msg_int(tmp, IDs[i]);
- if(query)
- tmp = build_msg_str(tmp, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
-
-#ifdef hw_optimize
- {
- int hg_error;
- int c, allc;
-
- allc = 0;
- retmsg = recv_hg_msg_head(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- /* read error field */
- if ( (c = hg_read_exact(sockfd, (char *) &hg_error, 4)) == -1 ) {
- if(retmsg) efree(retmsg);
- return(-2);
- }
- allc += c;
-
- if(hg_error) {
- if(retmsg) efree(retmsg);
- return(-3);
- }
-
- /* read count field */
- if ( (c = hg_read_exact(sockfd, (char *) count, 4)) == -1 ) {
- if(retmsg) efree(retmsg);
- return(-2);
- }
- allc += c;
-
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- if((c = hg_read_exact(sockfd, (char *) childIDs, *count * sizeof(hw_objectID))) == -1) {
- efree(childIDs);
- if(retmsg) efree(retmsg);
- return(-3);
- }
- } else {
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-4);
- }
- allc += c;
-
- if(NULL != (offsets = emalloc(*count * sizeof(int)))) {
- if((c = hg_read_exact(sockfd, (char *) offsets, *count * sizeof(int))) == -1) {
- efree(childIDs);
- efree(offsets);
- if(retmsg) efree(retmsg);
- return(-5);
- }
- } else {
- efree(retmsg);
- efree(childIDs);
- lowerror = LE_MALLOC;
- return(-6);
- }
- allc += c;
-
- str = (char *)ptr;
- if(NULL == (childrec = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- efree(offsets);
- efree(childIDs);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- for(i=0; i<*count; i++) {
- char *ptr;
- childrec[i] = emalloc(offsets[i] + 1);
- ptr = childrec[i];
- c = hg_read_exact(sockfd, (char *) ptr, offsets[i]);
- ptr[c] = '\0';
- allc += c;
- }
- /* Reading the trailing '\0' */
- c = hg_read_exact(sockfd, (char *) &hg_error, 1);
- *objrecs = childrec;
- }
- }
-#else
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ != 0) {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- *count = *ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- if(NULL != (offsets = emalloc(*count * sizeof(int)))) {
- ptr1 = offsets;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- efree(childIDs);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- str = (char *)ptr;
- if(NULL == (childrec = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- efree(offsets);
- efree(childIDs);
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- for(i=0; i<*count; i++) {
- char *ptr;
- childrec[i] = emalloc(offsets[i] + 1);
- ptr = childrec[i];
- memcpy(ptr, str, offsets[i]);
- ptr[offsets[i]] = '\0';
- str += offsets[i];
- }
- *objrecs = childrec;
- }
-
- efree(retmsg->buf);
-#endif
-
- efree(retmsg);
- efree(childIDs);
- efree(offsets);
- return(0);
-}
-
-int send_getobjbyquery(int sockfd, char *query, int maxhits, hw_objectID **childIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, i, *ptr1;
-
- length = HEADER_LENGTH + strlen(query) + 1;
-
- build_msg_header(&msg, length, msgid++, GETOBJBYQUERY_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
- return(0);
-}
-
-int send_getobjbyqueryobj(int sockfd, char *query, int maxhits, char ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- int *childIDs = NULL;
- int *ptr, *ptr1;
-
- length = HEADER_LENGTH + strlen(query) + 1;
-
- build_msg_header(&msg, length, msgid++, GETOBJBYQUERY_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-3);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -4;
- }
- if(*ptr++ == 0) {
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-5);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each child collection the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- efree(childIDs);
- return -2;
- }
- efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- efree(childIDs);
- lowerror = LE_MALLOC;
- return(-6);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- efree(childIDs);
- return(-7);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-8);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getobjbyquerycoll(int sockfd, hw_objectID collID, char *query, int maxhits, hw_objectID **childIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, i, *ptr1;
-
- length = HEADER_LENGTH + strlen(query) + 1 + sizeof(int) + sizeof(collID);
-
- build_msg_header(&msg, length, msgid++, GETOBJBYQUERYCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, 1);
- tmp = build_msg_int(tmp, collID);
- tmp = build_msg_str(tmp, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
- return(0);
-}
-
-int send_getobjbyquerycollobj(int sockfd, hw_objectID collID, char *query, int maxhits, char ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- hw_objectID *childIDs = NULL;
- int *ptr, *ptr1;
-
- length = HEADER_LENGTH + strlen(query) + 1 + sizeof(int) + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETOBJBYQUERYCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, 1);
- tmp = build_msg_int(tmp, collID);
- tmp = build_msg_str(tmp, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return -1;
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each child collection the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- if(childIDs) efree(childIDs);
- return -2;
- }
- if(childIDs) efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- efree(childIDs);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- efree(childIDs);
- return(-1);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getobjbyftquery(int sockfd, char *query, int maxhits, hw_objectID **childIDs, float **weights, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, i, *ptr1;
- float *ptr2;
-
- length = HEADER_LENGTH + strlen(query) + 1;
-
- build_msg_header(&msg, length, msgid++, GETOBJBYFTQUERY_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- char *cptr, tmp[20];
- float weight;
- int j;
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- if(NULL != (*weights = emalloc(*count * sizeof(float)))) {
- ptr2 = *weights;
- for(i=0; i<*count; i++) {
- ptr1[i] = *ptr++; /* Object id */
- cptr = (char *) ptr;
- j = 0;
- while(*cptr != ' ') {
- tmp[j++] = *cptr++;
- }
- cptr++; /* Skip space after weight */
- tmp[j] = '\0';
- sscanf(tmp, "%f", &weight);
- ptr2[i] = weight;
- ptr = (int *) cptr;
- ptr++; /* Skip 0-Integer after weight string */
- }
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(*childIDs);
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
- return(0);
-}
-
-int send_getobjbyftqueryobj(int sockfd, char *query, int maxhits, char ***childrec, float **weights, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- int *childIDs = NULL;
- int *ptr, *ptr1;
- float *ptr2;
-
- length = HEADER_LENGTH + strlen(query) + 1;
-
- build_msg_header(&msg, length, msgid++, GETOBJBYFTQUERY_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-3);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -4;
- }
- if(*ptr++ == 0) {
- char *cptr, tmp[20];
- float weight;
- int j;
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = childIDs;
- if(NULL != (*weights = emalloc(*count * sizeof(float)))) {
- ptr2 = *weights;
- for(i=0; i<*count; i++) {
- ptr1[i] = *ptr++; /* Object id */
- cptr = (char *) ptr;
- j = 0;
- while(*cptr != ' ') {
- tmp[j++] = *cptr++;
- }
- cptr++; /* Skip space after weight */
- tmp[j] = '\0';
- sscanf(tmp, "%f", &weight);
- ptr2[i] = weight;
- ptr = (int *) cptr;
- ptr++; /* Skip 0-Integer after weight string */
- }
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(childIDs);
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-5);
- }
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-5);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each child collection the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- efree(childIDs);
- efree(*weights);
- return -2;
- }
- efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- efree(childIDs);
- efree(*weights);
- lowerror = LE_MALLOC;
- return(-6);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- efree(childIDs);
- efree(*weights);
- return(-7);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-8);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getobjbyftquerycoll(int sockfd, hw_objectID collID, char *query, int maxhits, hw_objectID **childIDs, float **weights, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, i, *ptr1;
- float *ptr2;
-
- length = HEADER_LENGTH + strlen(query) + 1 + sizeof(int) + sizeof(collID);
-
- build_msg_header(&msg, length, msgid++, GETOBJBYFTQUERYCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, 1);
- tmp = build_msg_int(tmp, collID);
- tmp = build_msg_str(tmp, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- char *cptr, tmp[20];
- float weight;
- int j;
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- if(NULL != (*weights = emalloc(*count * sizeof(float)))) {
- ptr2 = *weights;
- for(i=0; i<*count; i++) {
- ptr1[i] = *ptr++; /* Object id */
- cptr = (char *) ptr;
- j = 0;
- while(*cptr != ' ') {
- tmp[j++] = *cptr++;
- }
- cptr++; /* Skip space after weight */
- tmp[j] = '\0';
- sscanf(tmp, "%f", &weight);
- ptr2[i] = weight;
- ptr = (int *) cptr;
- ptr++; /* Skip 0-Integer after weight string */
- }
- } else {
- efree(*childIDs);
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
- return(0);
-}
-
-int send_getobjbyftquerycollobj(int sockfd, hw_objectID collID, char *query, int maxhits, char ***childrec, float **weights, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- hw_objectID *childIDs = NULL;
- int *ptr, *ptr1;
- float *ptr2;
-
- length = HEADER_LENGTH + strlen(query) + 1 + sizeof(int) + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETOBJBYFTQUERYCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, 1);
- tmp = build_msg_int(tmp, collID);
- tmp = build_msg_str(tmp, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return -1;
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- char *cptr, tmp[20];
- float weight;
- int j;
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = childIDs;
- if(NULL != (*weights = emalloc(*count * sizeof(float)))) {
- ptr2 = *weights;
- for(i=0; i<*count; i++) {
- ptr1[i] = *ptr++; /* Object id */
- cptr = (char *) ptr;
- j = 0;
- while(*cptr != ' ') {
- tmp[j++] = *cptr++;
- }
- cptr++; /* Skip space after weight */
- tmp[j] = '\0';
- sscanf(tmp, "%f", &weight);
- ptr2[i] = weight;
- ptr = (int *) cptr;
- ptr++; /* Skip 0-Integer after weight string */
- }
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(childIDs);
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each child collection the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- if(childIDs) efree(childIDs);
- if(*weights) efree(weights);
- return -2;
- }
- if(childIDs) efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- efree(childIDs);
- efree(*weights);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- efree(childIDs);
- efree(*weights);
- return(-1);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getparents(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- int *ptr, *ptr1;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETPARENT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if (-1 == send_hg_msg(sockfd, &msg, length)) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-3);
- }
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- return(0);
-}
-
-int send_getparentsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- hw_objectID *childIDs = NULL;
- int *ptr;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETPARENT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if (-1 == send_hg_msg(sockfd, &msg, length)) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- for(i=0; i<*count; ptr++, i++)
- childIDs[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each parent the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- efree(childIDs);
- return -2;
- }
- efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_pipedocument(int sockfd, char *host, hw_objectID objectID, int mode, int rootid, char **objattr, char **bodytag, char **text, int *count, char **urlprefix)
-{
- hg_msg msg, *retmsg;
- int length, len;
- char *tmp, header[80], *head_ptr, *sizestr;
- struct sockaddr_in serv_addr;
- struct hostent *hostptr;
- char *hostip = NULL;
- char *attributes = NULL;
- char *documenttype;
- char **anchors;
- int newfd, fd, port, size, error, ancount;
- int *ptr;
-
- if(-1 == (fd = fnCOpenDataCon(sockfd, &port))) {
- /* not set yet efree(msg.buf); */
- return(-1);
- }
-
- /*
- ** Get information about host
- */
- if(host) {
- if((hostptr = gethostbyname(host)) == NULL) {
- HWSOCK_FCLOSE(fd);
- return(-2);
- }
- } else {
- HWSOCK_FCLOSE(fd);
- return(-2);
- }
-
- switch(hostptr->h_addrtype) {
- struct in_addr *ptr1;
- case AF_INET:
- ptr1 = (struct in_addr *) hostptr->h_addr_list[0];
- hostip = inet_ntoa(*ptr1);
- break;
- default:
- HWSOCK_FCLOSE(fd);
- return(-3);
- break;
- }
-
- /* Bottom half of send_getobject */
- if(0 > bh_send_getobject(sockfd, objectID)) {
- HWSOCK_FCLOSE(fd);
- return -4;
- }
-
- /* Upper half of send_getobject */
- if(0 > (error = uh_send_getobject(sockfd, &attributes))) {
- HWSOCK_FCLOSE(fd);
- return error;
- }
-
- length = HEADER_LENGTH + sizeof(hw_objectID) + sizeof(int) + strlen(hostip) + 1 + strlen("Refno=0x12345678") + 1;
- build_msg_header(&msg, length, msgid++, PIPEDOCUMENT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- if(attributes) efree(attributes);
- lowerror = LE_MALLOC;
- return(-5);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- tmp = build_msg_int(tmp, port);
- tmp = build_msg_str(tmp, hostip);
- tmp = build_msg_str(tmp, "Refno=0x12345678");
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- if(attributes) efree(attributes);
- efree(msg.buf);
- HWSOCK_FCLOSE(fd);
- return(-6);
- }
- efree(msg.buf);
-
- /* Just check if the command was understood */
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- if(attributes) efree(attributes);
- HWSOCK_FCLOSE(fd);
- return(-7);
- }
-
- ptr = (int *) retmsg->buf;
- if((ptr == NULL) || (*ptr != 0)) {
- error = *ptr;
- if(retmsg->buf) efree(retmsg->buf);
- efree(retmsg);
- if(attributes) efree(attributes);
- HWSOCK_FCLOSE(fd);
- return(error);
- }
-
- efree(retmsg->buf);
- efree(retmsg);
-
- /* passively open the data connection. The HG server is probably
- already waiting for us.
- */
- len = sizeof(serv_addr);
- if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) {
-/* php_printf("client: can't open data connection to server\n"); */
- if(attributes) efree(attributes);
- HWSOCK_FCLOSE(fd);
- return(-8);
- } else {
- HWSOCK_FCLOSE(fd);
- }
-
- /* First of all read the header */
- head_ptr = header;
- while((read_to(newfd, head_ptr, 1, rtimeout) == 1) && (*head_ptr != '\0')) {
- head_ptr++;
- }
-
- /* Let's see how big the document is and read it into var text */
- sizestr = strstr(header, "sz=");
- if(sizestr) {
- sizestr += 3;
- sscanf(sizestr, "%d\n", &size);
- *count = size;
- if((size != 0) && (NULL != (*text = malloc(size+1)))) {
- read_to(newfd, *text, size, rtimeout);
- (*text)[size] = '\0';
- }
- } else {
- *text = NULL;
- }
-
- /* close the data connection */
- HWSOCK_FCLOSE(newfd);
-
- documenttype = fnAttributeValue(attributes, "DocumentType");
-
- /* Make a copy with strdup (not estrdup), because we want to
- keep the attributes in hw_document struct.
- */
- *objattr = strdup(attributes);
- efree(attributes);
-
- if((documenttype != NULL) && (!strcmp(documenttype, "text") != 0)) {
- if(send_getanchorsobj(sockfd, objectID, &anchors, &ancount) == 0) {
- char **destrec, **reldestrec;
-#ifdef newlist
- zend_llist *pAnchorList = NULL;
-#else
- DLIST *pAnchorList = NULL;
-#endif
-
- /* Get dest as relative and absolut path */
- send_getdestforanchorsobj(sockfd, anchors, &destrec, ancount);
- send_getreldestforanchorsobj(sockfd, anchors, &reldestrec, ancount, rootid, objectID);
- pAnchorList = fnCreateAnchorList(objectID, anchors, destrec, reldestrec, ancount, mode);
- /* Free only the array, the objrecs has been freed in fnCreateAnchorList() */
- if(anchors) efree(anchors);
- if(destrec) efree(destrec);
- if(reldestrec) efree(reldestrec);
-
- if(pAnchorList != NULL) {
- char *newtext;
- char *body = NULL;
-
- newtext = fnInsAnchorsIntoText(*text, pAnchorList, &body, urlprefix);
-#ifdef newlist
- zend_llist_destroy(pAnchorList);
- efree(pAnchorList);
-#else
- dlst_kill(pAnchorList, fnDeleteAnchor);
-#endif
- *bodytag = strdup(body);
- if(body) efree(body);
- *text = newtext;
- *count = strlen(newtext);
- }
- }
- } else {
- *bodytag = NULL;
- }
-
- if(documenttype) efree(documenttype);
- return(0);
-}
-
-int send_pipecgi(int sockfd, char *host, hw_objectID objectID, char *cgi_env_str, char **objattr, char **text, int *count)
-{
- hg_msg msg, *retmsg;
- int length, len, new_attr_len;
- char *tmp, header[80], *head_ptr, *sizestr;
- struct sockaddr_in serv_addr;
- struct hostent *hostptr;
- char *hostip = NULL;
- char *attributes = NULL;
- char *documenttype, *new_attr;
- int newfd, fd, port, size, error;
- int *ptr;
-
- if(-1 == (fd = fnCOpenDataCon(sockfd, &port))) {
- /* not set yet? efree(msg.buf); */
- return(-1);
- }
-
- /*
- ** Get information about host
- */
- if(host) {
- if((hostptr = gethostbyname(host)) == NULL) {
- HWSOCK_FCLOSE(fd);
- return(-1);
- }
- } else {
- HWSOCK_FCLOSE(fd);
- return(-1);
- }
-
- switch(hostptr->h_addrtype) {
- struct in_addr *ptr1;
- case AF_INET:
- ptr1 = (struct in_addr *) hostptr->h_addr_list[0];
- hostip = inet_ntoa(*ptr1);
- break;
- default:
-/* php_printf(stderr, "unknown address type\n"); */
- break;
- }
-
- /* Bottom half of send_getobject */
- if(0 > bh_send_getobject(sockfd, objectID)) {
- HWSOCK_FCLOSE(fd);
- return -1;
- }
-
- /* Upper half of send_getobject */
- if(0 > (error = uh_send_getobject(sockfd, &attributes))) {
- HWSOCK_FCLOSE(fd);
- return error;
- }
-
- new_attr_len = strlen(attributes) + strlen(cgi_env_str) + 2;
- new_attr = malloc(new_attr_len);
- strcpy(new_attr, attributes);
- strcat(new_attr, cgi_env_str);
- length = HEADER_LENGTH + strlen(new_attr) + 1 + sizeof(int) + strlen(hostip) + 1 + sizeof(int) + sizeof(int);
- build_msg_header(&msg, length, msgid++, PIPECGI_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- if(attributes) efree(attributes);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, hostip);
- tmp = build_msg_int(tmp, port);
- tmp = build_msg_str(tmp, new_attr);
- tmp = build_msg_int(tmp, 1);
- tmp = build_msg_int(tmp, 0x12345678);
- free(new_attr);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- if(attributes) efree(attributes);
- efree(msg.buf);
- HWSOCK_FCLOSE(fd);
- return(-1);
- }
- efree(msg.buf);
-
- /* Just check if the command was understood */
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- if(attributes) efree(attributes);
- HWSOCK_FCLOSE(fd);
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if((ptr == NULL) || (*ptr != 0)) {
- if(retmsg->buf) efree(retmsg->buf);
- efree(retmsg);
- if(attributes) efree(attributes);
- HWSOCK_FCLOSE(fd);
- return(-1);
- }
-
- efree(retmsg->buf);
- efree(retmsg);
-
- /* passively open the data connection. The HG server is probably
- already waiting for us.
- */
- len = sizeof(serv_addr);
- if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) {
- if(attributes) efree(attributes);
- HWSOCK_FCLOSE(fd);
- return(-1);
- } else {
- HWSOCK_FCLOSE(fd);
- }
-
- /* First of all read the header */
- head_ptr = header;
- while((read_to(newfd, head_ptr, 1, rtimeout) == 1) && (*head_ptr != '\0')) {
- head_ptr++;
- }
-
- /* Let's see how big the document is and read it into var text */
- sizestr = strstr(header, "sz=");
- if(sizestr) {
- sizestr += 3;
- sscanf(sizestr, "%d\n", &size);
- *count = size;
- if((size != 0) && (NULL != (*text = malloc(size+1)))) {
- read_to(newfd, *text, size, rtimeout);
- }
- } else {
- *text = NULL;
- }
-
- /* close the data connection */
- HWSOCK_FCLOSE(newfd);
-
- documenttype = fnAttributeValue(attributes, "DocumentType");
-
- /* Make a copy with strdup (not estrdup), because we want to
- keep the attributes in hw_document struct.
- */
- *objattr = strdup(attributes);
- efree(attributes);
-
- if(documenttype) efree(documenttype);
- return(0);
-}
-
-int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectRec, char *text, int count, hw_objectID *objectID)
-{
- hg_msg msg, *retmsg;
- int length, len;
- char *tmp, header[80], parms[30], *head_ptr;
- struct sockaddr_in serv_addr;
- struct hostent *hostptr;
- char *hostip = NULL;
- int newfd, fd, port, error;
- int *ptr;
-
- /* First of all we have to insert the document record */
- sprintf(parms, "Parent=0x%x", parentID);
- length = HEADER_LENGTH + strlen(objectRec) + 1 + strlen(parms) + 1;
-
- build_msg_header(&msg, length, msgid++, INSERTOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, objectRec);
- tmp = build_msg_str(tmp, parms);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-3);
- }
-
- ptr = (int *) retmsg->buf;
- if(0 == (error = *ptr)) {
- ptr++;
- *objectID = *ptr;
- } else {
- if(retmsg->buf) efree(retmsg->buf);
- efree(retmsg);
- return(error);
- }
-
- efree(retmsg->buf);
- efree(retmsg);
-
- /*
- ** Get information about host
- */
- if(host) {
- if((hostptr = gethostbyname(host)) == NULL) {
- /* close(fd); fd is not set yet */
- return(-4);
- }
- } else {
- /* close(fd); fd is not set yet */
- return(-5);
- }
-
- switch(hostptr->h_addrtype) {
- struct in_addr *ptr1;
- case AF_INET:
- ptr1 = (struct in_addr *) hostptr->h_addr_list[0];
- hostip = inet_ntoa(*ptr1);
- break;
- default:
-/* fprintf(stderr, "unknown address type\n"); */
- break;
- }
-
- if(-1 == (fd = fnCOpenDataCon(sockfd, &port))) {
- efree(msg.buf);
- return(-6);
- }
-
- /* Start building the PUTDOCUMENT message. I works even if
- the Refno is skipped. I guess the path can be omitted too. */
- length = HEADER_LENGTH + sizeof(hw_objectID) + sizeof(int) + strlen(hostip) + 1 + strlen("Hyperwave") + 1+ strlen("Refno=0x12345678") + 1;
-
- build_msg_header(&msg, length, msgid++, PUTDOCUMENT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-7);
- }
-
- tmp = build_msg_int(msg.buf, *objectID);
- tmp = build_msg_int(tmp, port);
- tmp = build_msg_str(tmp, hostip);
- tmp = build_msg_str(tmp, "Hyperwave");
- tmp = build_msg_str(tmp, "Refno=0x12345678");
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- HWSOCK_FCLOSE(fd);
- return(-8);
- }
- efree(msg.buf);
-
- /* passively open the data connection. The HG server is probably
- already waiting for us.
- */
- len = sizeof(serv_addr);
- if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) {
- HWSOCK_FCLOSE(fd);
- return(-9);
- } else {
- HWSOCK_FCLOSE(fd);
- }
-
- /* First of all write the header. According to the documentation
- there should be a header first. Well, after some investigation
- with tcpdump I found out, that Harmony and wavemaster don't
- sent it. The also do not sent the Refno in the PUTDOCUMENT msg.
- Anyway, we sent both. */
- head_ptr = header;
- sprintf(header, "HGHDR\nsz=%d\nref=12345678\n", count);
- len = strlen(header) + 1;
- if(len != write_to(newfd, header, len, wtimeout)) {
- HWSOCK_FCLOSE(newfd);
- return(-10);
- }
-
- /* And now the document */
- if(count != write_to(newfd, text, count, wtimeout)) {
- HWSOCK_FCLOSE(newfd);
- return(-11);
- }
-
- /* The data connection has to be close before the return
- msg can be read. The server will not sent it before. */
- HWSOCK_FCLOSE(newfd);
-
- /* Just check if the command was understood */
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- HWSOCK_FCLOSE(fd);
- return(-12);
- }
-
- ptr = (int *) retmsg->buf;
- if((ptr == NULL) || (*ptr != 0)) {
- if(retmsg->buf) efree(retmsg->buf);
- efree(retmsg);
- HWSOCK_FCLOSE(fd);
- return(-13);
- }
-
- efree(retmsg->buf);
- efree(retmsg);
-
- return(0);
-}
-
-int send_getsrcbydest(int sockfd, hw_objectID objectID, char ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- int *childIDs = NULL;
- char **objptr;
- int *ptr, *ptr1;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETSRCBYDEST_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr;
- ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each source the object record */
- for(i=0; i<*count; i++) {
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- efree(childIDs);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(childIDs);
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-
- return(0);
-}
-
-int send_mapid(int sockfd, int servid, hw_objectID id, int *virtid)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr;
-
- length = HEADER_LENGTH + 2 * sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, HG_MAPID);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, servid);
- tmp = build_msg_int(tmp, id);
-
- if (-1 == send_hg_msg(sockfd, &msg, length)) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-3);
- }
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *virtid = *ptr;
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- return(0);
-}
-
-#define BUFFERLEN 200
-char *get_hw_info(hw_connection *conn) {
- char temp[BUFFERLEN];
- int len;
- struct sockaddr_in serv_addr;
-
- len = sizeof (serv_addr);
- if(getsockname(conn->socket, (struct sockaddr *)&serv_addr, &len) < 0)
- return(NULL);
-
- snprintf(temp, BUFFERLEN, "%s, %s, %d, %s, %d, %d", conn->server_string, conn->hostname,
- conn->version, conn->username,
- serv_addr.sin_port, conn->swap_on);
- return(estrdup(temp));
-}
-#undef BUFFERLEN
-
-static int send_hg_msg(int sockfd, hg_msg *msg, int length)
-{
- char *buf, *tmp;
-
-#ifdef HW_DEBUG
- php_printf("<b>Sending msg: </b>type = %d -- id = %d<br />\n", msg->msg_type, msg->version_msgid);
-#endif
- if ( length < HEADER_LENGTH ) {
-/* fprintf(stderr, "send_hg_msg: bad msg\n"); */
- return(-1);
- }
-
- if ( (tmp = buf = (char *)emalloc(length)) == NULL ) {
-/* perror("send_hg_msg"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- memcpy(tmp, (char *) &(msg->length), 4);
- tmp += 4;
- memcpy(tmp, (char *) &(msg->version_msgid), 4);
- tmp += 4;
- memcpy(tmp, (char *) &(msg->msg_type), 4);
- if ( msg->length > HEADER_LENGTH ) {
- tmp += 4;
- memcpy(tmp, msg->buf, length-HEADER_LENGTH);
- }
-
- if ( hg_write(sockfd, buf, length) == -1 ) {
- efree(buf);
- return(-1);
- }
-
- efree(buf);
- return(0);
-}
-
-
-int send_ready(int sockfd)
-{
- hg_msg ready_msg;
-
- build_msg_header(&ready_msg, HEADER_LENGTH, version, READY_MESSAGE);
- ready_msg.buf = NULL;
-
- if ( send_hg_msg(sockfd, &ready_msg, HEADER_LENGTH) == -1 ) {
- return(-1);
- }
-
- return(0);
-}
-
-
-int send_command(int sockfd, int command, char **answer)
-{
- hg_msg comm_msg, *retmsg;
- char *comm_str, *tmp;
- int respond = 1;
- int length;
-
- if ( command == STAT_COMMAND )
- comm_str = STAT_COMMAND_STR;
- else
- comm_str = WHO_COMMAND_STR;
- length = HEADER_LENGTH + sizeof(respond) + strlen(comm_str) + 1;
-
- build_msg_header(&comm_msg, length, msgid++, COMMAND_MESSAGE);
-
- if ( (comm_msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
-
- tmp = build_msg_int(comm_msg.buf, respond);
- tmp = build_msg_str(tmp, comm_str);
-
-
- if ( send_hg_msg(sockfd, &comm_msg, length) == -1 ) {
- efree(comm_msg.buf);
- return(-1);
- }
- efree(comm_msg.buf);
-
- /* Just check if the command was understood */
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- *answer = retmsg->buf;
- efree(retmsg);
-
- return(0);
-}
-
-
-static void build_msg_header(hg_msg *msg, int length, int version_msgid, int msg_type)
-{
- if ( swap_on ) {
- msg->length = swap(length);
- msg->version_msgid = swap(version_msgid);
- msg->msg_type = swap(msg_type);
- }
- else {
- msg->length = length;
- msg->version_msgid = version_msgid;
- msg->msg_type = msg_type;
- }
-}
-
-
-static char *build_msg_int(char *buf, int val) {
- int tmp;
-
-#ifdef HW_DEBUG
- php_printf(" Added int to header: <b>%d</b><br />\n", val);
-#endif
- tmp = swap_on ? swap(val) : val;
- memcpy(buf, (char *)&tmp, 4);
-
- return(buf+4);
-}
-
-
-static char *build_msg_str(char *buf, char *str)
-{
- int len = strlen(str)+1;
-
-#ifdef HW_DEBUG
- php_printf(" Added str to header: <b>%s</b> (%d)<br />\n", str, strlen(str));
-#endif
-
- memcpy(buf, str, len);
-
- return(buf+len);
-}
-
-
-static int swap(int val)
-{
- int tmp;
-
- ((char*)&tmp)[0] = ((char*)&val)[3];
- ((char*)&tmp)[1] = ((char*)&val)[2];
- ((char*)&tmp)[2] = ((char*)&val)[1];
- ((char*)&tmp)[3] = ((char*)&val)[0];
-
- return(tmp);
-}
-
-
-void close_hg_connection(int sockfd)
-{
- shutdown(sockfd, 2);
- HWSOCK_FCLOSE(sockfd);
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * End:
- */
-
diff --git a/ext/hyperwave/hg_comm.h b/ext/hyperwave/hg_comm.h
deleted file mode 100644
index bad54010e9..0000000000
--- a/ext/hyperwave/hg_comm.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef HG_COMM_H
-#define HG_COMM_H
-
-#if HYPERWAVE
-
-#define newlist
-
-#include "hw_error.h"
-#ifdef newlist
-#else
-#include "dlist.h"
-#endif
-#define HG_SERVER_PORT 418
-
-#define F_DISTRIBUTED 0x80000000
-#define F_COMPRESSED 0x40000000
-#define F_VERSION 0x00003fff
-#define HW_VERSION 717L /* 7.17 */
-
-#define HEADER_LENGTH 12
-
-#define STAT_COMMAND_STR "stat"
-#define WHO_COMMAND_STR "who"
-#define STAT_COMMAND 1
-#define WHO_COMMAND 2
-
-#define GETDOCBYANCHOR_MESSAGE 2
-#define GETCHILDCOLL_MESSAGE 3
-#define GETPARENT_MESSAGE 4
-#define GETCHILDDOCCOLL_MESSAGE 5
-#define GETOBJECT_MESSAGE 7
-#define GETANCHORS_MESSAGE 8
-#define GETOBJBYQUERY_MESSAGE 9
-#define GETOBJBYQUERYCOLL_MESSAGE 10
-#define OBJECTBYIDQUERY_MESSAGE 11
-#define GETTEXT_MESSAGE 12
-#define INSDOC_MESSAGE 14
-#define INSCOLL_MESSAGE 17
-#define GETSRCBYDEST_MESSAGE 19
-#define MVCPDOCSCOLL_MESSAGE 22
-#define MVCPCOLLSCOLL_MESSAGE 23
-#define IDENTIFY_MESSAGE 24
-#define READY_MESSAGE 25
-#define COMMAND_MESSAGE 26
-#define CHANGEOBJECT_MESSAGE 27
-#define EDITTEXT_MESSAGE 28
-#define GETANDLOCK_MESSAGE 29
-#define UNLOCK_MESSAGE 30
-#define INCOLLECTIONS_MESSAGE 31
-#define INSERTOBJECT_MESSAGE 32
-#define GETOBJBYFTQUERY_MESSAGE 34
-#define GETOBJBYFTQUERYCOLL_MESSAGE 35
-#define PIPEDOCUMENT_MESSAGE 36
-#define DELETEOBJECT_MESSAGE 37
-#define PUTDOCUMENT_MESSAGE 38
-#define GETREMOTE_MESSAGE 39
-#define GETREMOTECHILDREN_MESSAGE 40
-#define HG_MAPID 43
-#define CHILDREN_MESSAGE 44
-#define GETCGI_MESSAGE 45
-#define PIPECGI_MESSAGE 46
-
-#define HW_DEFAULT_LINK 0
-#define HW_IMAGE_LINK 1
-#define HW_BACKGROUND_LINK 2
-#define HW_INTAG_LINK 3
-#define HW_APPLET_LINK 4
-#define HW_INTAGNODEL_LINK 5
-
-#define COPY 0
-#define MOVE 1
-#define DOCUMENT 0
-#define COLLECTION 1
-
-
-#ifdef PHP_WIN32
-# define SOCK_ERR INVALID_SOCKET
-# define SOCK_CONN_ERR SOCKET_ERROR
-# define HWSOCK_FCLOSE(s) closesocket(s)
-#else
-# define SOCK_ERR -1
-# define SOCK_CONN_ERR -1
-# define HWSOCK_FCLOSE(s) close(s)
-#endif
-
-
-/* Low error messages */
-#define LE_MALLOC -1
-
-typedef struct {
- int id; /* object ID of anchor */
- int tanchor; /* Type of anchor. Can be 1=Src, 2=Dest */
- int start; /* start of anchor */
- int end; /* end of anchor */
- char *nameanchor; /* name tag attribute of destination document */
- /* if anchor is of type Src the following are used as well */
- char *destdocname; /* name of destination document */
- char *link; /* url for external destination */
- int linktype; /* type of link. see above */
- char *tagattr; /* more attributes of tag, like Border=0 */
- char *htmlattr; /* */
- char *codebase; /* codebase of applet */
- char *code; /* code of applet */
- char *fragment; /* name link of Src */
-
- /* if anchor is of type Dest the following are used as well */
- char *keyword; /* name link of Dest */
- } ANCHOR;
-
-typedef struct {
- int length;
- int version_msgid;
- int msg_type;
- char *buf;
-} hg_msg;
-
-typedef struct {
- int socket;
- int swap_on;
- int version;
- char *server_string;
- char *hostname;
- char *username;
- int lasterror;
- int linkroot;
-} hw_connection;
-
-typedef int hw_objectID;
-typedef char hw_objrec;
-typedef float hw_float;
-
-#ifdef newlist
-void fnDeleteAnchor(void *ptr1);
-void fnListAnchor(zend_llist *pAnchorList);
-zend_llist *fnCreateAnchorList(hw_objectID objID, char **anchors, char **docofanchorrec, char **reldestrec, int ancount, int anchormode);
-char *fnInsAnchorsIntoText(char *text, zend_llist *pAnchorList, char **bodytag, char **urlprefix);
-int fnCmpAnchors(const void *e1, const void *e2 TSRMLS_DC);
-ANCHOR *fnAddAnchor(zend_llist *pAnchorList, int objectID, int start, int end);
-#else
-void fnDeleteAnchor(ANCHOR *ptr);
-void fnListAnchor(DLIST *pAnchorList);
-DLIST *fnCreateAnchorList(hw_objectID objID, char **anchors, char **docofanchorrec, char **reldestrec, int ancount, int anchormode);
-char *fnInsAnchorsIntoText(char *text, DLIST *pAnchorList, char **bodytag, char **urlprefix);
-int fnCmpAnchors(ANCHOR *a1, ANCHOR *a2 TSRMLS_DC);
-ANCHOR *fnAddAnchor(DLIST *pAnchorList, int objectID, int start, int end);
-#endif
-extern void set_swap(int do_swap);
-extern int open_hg_connection(char *server_name, int port);
-extern void close_hg_connection(int sockfd);
-extern int initialize_hg_connection(int sockfd, int *do_swap, int *version, char **userdata, char **server_string, char *username, char *password);
-
-extern int send_ready(int sockfd);
-extern int send_command(int sockfd, int command, char **answer);
-
-extern hg_msg *recv_hg_msg(int sockfd);
-extern hg_msg *recv_ready(int sockfd);
-extern hg_msg *recv_command(int sockfd);
-
-extern char *fnInsStr(char *str, int pos, char *insstr);
-extern int fnAttributeCompare(char *object, char *attrname, char *value);
-extern char *fnAttributeValue(char *object, char *attrname);
-extern int getrellink(int sockfd, int rootID, int thisID, int destID, char **reldesstr);
-
-extern int send_deleteobject(int sockfd, hw_objectID objectID);
-extern int send_changeobject(int sockfd, hw_objectID objectID, char *mod);
-extern int send_groupchangeobject(int sockfd, hw_objectID objectID, char *mod);
-extern int send_getobject(int sockfd, hw_objectID objectID, char **attributes);
-extern int send_getandlock(int sockfd, hw_objectID objectID, char **attributes);
-extern int send_lock(int sockfd, hw_objectID objectID);
-extern int send_unlock(int sockfd, hw_objectID objectID);
-extern int send_gettext(int sockfd, hw_objectID objectID, int mode, int rootid, char **objattr, char **bodytag, char **text, int *count, char *urlprefix);
-extern int send_edittext(int sockfd, char *objattr, char *text);
-extern int send_getcgi(int sockfd, hw_objectID objectID, char *cgi_env_str, char **objattr, char **text, int *count);
-extern int send_getremote(int sockfd, hw_objectID objectID, char **objattr, char **text, int *count);
-extern int send_getremotechildren(int sockfd, char *attributes, char **text, int **childIDs, int *count);
-extern int send_docbyanchor(int sockfd, hw_objectID objectID, hw_objectID *anchorID);
-extern int send_docbyanchorobj(int sockfd, hw_objectID objectID, char **objrec);
-extern int send_mvcpdocscollscoll(int sockfd, hw_objectID *objectIDs, int count, int from, int dest, int cpmv, int docscoll);
-extern int send_childrenobj(int sockfd, hw_objectID objectID, char ***childrec, int *count);
-extern int send_getchildcoll(int sockfd, int objectID, hw_objectID **childIDs, int *count);
-extern int send_getchildcollobj(int sockfd, hw_objectID objectID, hw_objrec ***childrec, int *count);
-extern int send_getchilddoccoll(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count);
-extern int send_getchilddoccollobj(int sockfd, hw_objectID objectID, hw_objrec ***childrec, int *count);
-extern int send_getanchors(int sockfd, hw_objectID objectID, hw_objectID **anchorIDs, int *count);
-extern int send_getanchorsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count);
-extern int send_objectbyidquery(int sockfd, hw_objectID *IDs, int *count, char *query, char ***objrecs);
-extern int send_getobjbyquery(int sockfd, char *query, int maxhits, hw_objectID **childIDs, int *count);
-extern int send_getobjbyqueryobj(int sockfd, char *query, int maxhits, char ***childrec, int *count);
-extern int send_getobjbyquerycoll(int sockfd, hw_objectID collID, char *query, int maxhits, hw_objectID **childIDs, int *count);
-extern int send_getobjbyquerycollobj(int sockfd, hw_objectID collID, char *query, int maxhits, char ***childrec, int *count);
-extern int send_getobjbyftquery(int sockfd, char *query, int maxhits, hw_objectID **childIDs, float **weights, int *count);
-extern int send_getobjbyftqueryobj(int sockfd, char *query, int maxhits, char ***childrec, float **weights, int *count);
-extern int send_getobjbyftquerycoll(int sockfd, hw_objectID collID, char *query, int maxhits, hw_objectID **childIDs, float **weight, int *count);
-extern int send_getobjbyftquerycollobj(int sockfd, hw_objectID collID, char *query, int maxhits, char ***childrec, float **weight, int *count);
-extern int send_identify(int sockfd, char *name, char *passwd, char **userdata);
-extern int send_getparents(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count);
-extern int send_children(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count);
-extern int send_getparentsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count);
-extern int send_pipedocument(int sockfd, char *hostname, hw_objectID objectID, int mode, int rootid, char** objattr, char **bodytag, char **text, int *count, char **urlprefix);
-extern int send_pipecgi(int sockfd, char *host, hw_objectID objectID, char *cgi_env_str, char **objattr, char **text, int *count);
-extern int send_putdocument(int sockfd, char *hostname, hw_objectID parentID, char *objectRec, char *text, int count, hw_objectID *objectID);
-extern int send_inscoll(int sockfd, hw_objectID objectID, char *objrec, hw_objectID *new_objectID);
-extern int send_insertobject(int sockfd, char *objrec, char *parms, hw_objectID *objectID);
-extern int send_insdoc(int sockfd, hw_objectID objectID, char *objrec, char *text, hw_objectID *new_objectID);
-extern int send_incollections(int sockfd, int retcol, int cobjids, hw_objectID *objectIDs, int ccollids, hw_objectID *collIDs, int *count, hw_objectID **retIDs);
-extern int send_getsrcbydest(int sockfd, hw_objectID objid, char ***childrec, int *count);
-extern int send_mapid(int sockfd, int servid, hw_objectID id, int *virtid);
-extern int send_dummy(int sockfd, hw_objectID objectID, int msgid, char **attributes);
-extern int send_insertanchors(char **text, int *count, char **anchors, char **destrec, int ancount, char **urlprefix, char **bodytag);
-extern char *get_hw_info(hw_connection *conn);
-
-#define send_mvcpdocscoll(sockfd, objectIDs, count, from, dest, mvcp) \
- send_mvcpdocscollscoll(sockfd, objectIDs, count, from, dest, mvcp, DOCUMENT)
-#define send_mvcpcollscoll(sockfd, objectIDs, count, from, dest, mvcp) \
- send_mvcpdocscollscoll(sockfd, objectIDs, count, from, dest, mvcp, COLLECTION)
-
-#endif
-#endif
diff --git a/ext/hyperwave/hw.c b/ext/hyperwave/hw.c
deleted file mode 100644
index d57e00b931..0000000000
--- a/ext/hyperwave/hw.c
+++ /dev/null
@@ -1,4081 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdlib.h>
-#include <errno.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/head.h"
-#include "ext/standard/info.h"
-#include "fopen_wrappers.h"
-#include "SAPI.h"
-
-#ifdef PHP_WIN32
-#include <winsock2.h>
-#endif
-
-#if HYPERWAVE
-
-#include "php_ini.h"
-#include "php_hyperwave.h"
-
-static int le_socketp, le_psocketp, le_document;
-
-/*hw_module php_hw_module;*/
-
-#define HW_ATTR_NONE 1
-#define HW_ATTR_LANG 2
-#define HW_ATTR_NR 3
-
-function_entry hw_functions[] = {
- PHP_FE(hw_connect, NULL)
- PHP_FE(hw_pconnect, NULL)
- PHP_FE(hw_close, NULL)
- PHP_FE(hw_root, NULL)
- PHP_FE(hw_info, NULL)
- PHP_FE(hw_connection_info, NULL)
- PHP_FE(hw_error, NULL)
- PHP_FE(hw_errormsg, NULL)
- PHP_FE(hw_getparentsobj, NULL)
- PHP_FE(hw_getparents, NULL)
- PHP_FE(hw_children, NULL)
- PHP_FE(hw_childrenobj, NULL)
- PHP_FE(hw_getchildcoll, NULL)
- PHP_FE(hw_getchildcollobj, NULL)
- PHP_FE(hw_getobject, NULL)
- PHP_FE(hw_getandlock, NULL)
- PHP_FE(hw_unlock, NULL)
- PHP_FE(hw_gettext, NULL)
- PHP_FE(hw_edittext, NULL)
- PHP_FE(hw_getcgi, NULL)
- PHP_FE(hw_getremote, NULL)
- PHP_FE(hw_getremotechildren, NULL)
- PHP_FE(hw_pipedocument, NULL)
- PHP_FE(hw_pipecgi, NULL)
- PHP_FE(hw_insertdocument, NULL)
- PHP_FE(hw_mv, NULL)
- PHP_FE(hw_cp, NULL)
- PHP_FE(hw_deleteobject, NULL)
- PHP_FE(hw_changeobject, NULL)
- PHP_FE(hw_modifyobject, NULL)
- PHP_FE(hw_docbyanchor, NULL)
- PHP_FE(hw_docbyanchorobj, NULL)
- PHP_FE(hw_getobjectbyquery, NULL)
- PHP_FE(hw_getobjectbyqueryobj, NULL)
- PHP_FE(hw_getobjectbyquerycoll, NULL)
- PHP_FE(hw_getobjectbyquerycollobj, NULL)
- PHP_FE(hw_getobjectbyftquery, NULL)
- PHP_FE(hw_getobjectbyftqueryobj, NULL)
- PHP_FE(hw_getobjectbyftquerycoll, NULL)
- PHP_FE(hw_getobjectbyftquerycollobj, NULL)
- PHP_FE(hw_getchilddoccoll, NULL)
- PHP_FE(hw_getchilddoccollobj, NULL)
- PHP_FE(hw_getanchors, NULL)
- PHP_FE(hw_getanchorsobj, NULL)
- PHP_FE(hw_getusername, NULL)
- PHP_FE(hw_setlinkroot, NULL)
- PHP_FE(hw_identify, NULL)
- PHP_FE(hw_free_document, NULL)
- PHP_FE(hw_new_document, NULL)
- PHP_FE(hw_new_document_from_file, NULL)
- PHP_FE(hw_output_document, NULL)
- PHP_FE(hw_document_size, NULL)
- PHP_FE(hw_document_attributes, NULL)
- PHP_FE(hw_document_bodytag, NULL)
- PHP_FE(hw_document_content, NULL)
- PHP_FE(hw_document_setcontent, NULL)
- PHP_FE(hw_objrec2array, NULL)
- PHP_FE(hw_array2objrec, NULL)
- PHP_FE(hw_incollections, NULL)
- PHP_FE(hw_inscoll, NULL)
- PHP_FE(hw_insertobject, NULL)
- PHP_FE(hw_insdoc, NULL)
- PHP_FE(hw_getsrcbydestobj, NULL)
- PHP_FE(hw_insertanchors, NULL)
- PHP_FE(hw_getrellink, NULL)
- PHP_FE(hw_who, NULL)
- PHP_FE(hw_stat, NULL)
- PHP_FE(hw_mapid, NULL)
- PHP_FE(hw_dummy, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry hw_module_entry = {
- STANDARD_MODULE_HEADER,
- "hyperwave", hw_functions, PHP_MINIT(hw), PHP_MSHUTDOWN(hw), NULL, NULL, PHP_MINFO(hw), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES
-};
-
-/*
-#ifdef ZTS
-int hw_globals_id;
-#else
-PHP_HW_API php_hw_globals hw_globals;
-#endif
-*/
-
-ZEND_DECLARE_MODULE_GLOBALS(hw)
-
-#ifdef COMPILE_DL_HYPERWAVE
-ZEND_GET_MODULE(hw)
-#endif
-
-#define HW_FETCH_LINK(hw_zval) \
- convert_to_long_ex(hw_zval); \
- link = Z_LVAL_PP(hw_zval); \
- ptr = (hw_connection *) zend_list_find(link, &type); \
- if(!ptr || (type != le_socketp && type != le_psocketp)) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find file identifier %d", link); \
- RETURN_FALSE; \
- }
-
-#define HW_FETCH_ID(hw_zval) \
- convert_to_long_ex(hw_zval); \
- id = Z_LVAL_PP(hw_zval); \
- ptr = (hw_document *) zend_list_find(id, &type); \
- if(!ptr || (type != le_document)) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find file identifier %d", id); \
- RETURN_FALSE; \
- }
-
-void print_msg(hg_msg *msg, char *str, int txt);
-
-void _close_hw_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- hw_connection *conn = (hw_connection *)rsrc->ptr;
-
- if(conn->hostname)
- free(conn->hostname);
- if(conn->username)
- free(conn->username);
- close(conn->socket);
- free(conn);
- HwSG(num_links)--;
-}
-
-void _close_hw_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- hw_connection *conn = (hw_connection *)rsrc->ptr;
-
- if(conn->hostname)
- free(conn->hostname);
- if(conn->username)
- free(conn->username);
- close(conn->socket);
- free(conn);
- HwSG(num_links)--;
- HwSG(num_persistent)--;
-}
-
-void _free_hw_document(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- hw_document *doc = (hw_document *)rsrc->ptr;
- if(doc->data)
- free(doc->data);
- if(doc->attributes)
- free(doc->attributes);
- if(doc->bodytag)
- free(doc->bodytag);
- free(doc);
-}
-
-static void php_hw_init_globals(zend_hw_globals *hw_globals)
-{
- hw_globals->num_persistent = 0;
-}
-
-static PHP_INI_MH(OnHyperwavePort)
-{
- if (new_value==NULL) {
- HwSG(default_port) = HG_SERVER_PORT;
- } else {
- HwSG(default_port) = atoi(new_value);
- }
- return SUCCESS;
-}
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("hyperwave.allow_persistent", "0", PHP_INI_SYSTEM, OnUpdateLong, allow_persistent, zend_hw_globals, hw_globals)
- PHP_INI_ENTRY("hyperwave.default_port", "418", PHP_INI_ALL, OnHyperwavePort)
-PHP_INI_END()
-
-PHP_MINIT_FUNCTION(hw)
-{
- ZEND_INIT_MODULE_GLOBALS(hw, php_hw_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
- le_socketp = zend_register_list_destructors_ex(_close_hw_link, NULL, "hyperwave link", module_number);
- le_psocketp = zend_register_list_destructors_ex(NULL, _close_hw_plink, "hyperwave link persistent", module_number);
- le_document = zend_register_list_destructors_ex(_free_hw_document, NULL, "hyperwave document", module_number);
- Z_TYPE(hw_module_entry) = type;
-
- REGISTER_LONG_CONSTANT("HW_ATTR_LANG", HW_ATTR_LANG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_ATTR_NR", HW_ATTR_NR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_ATTR_NONE", HW_ATTR_NONE, CONST_CS | CONST_PERSISTENT);
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(hw)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-/* {{{ make_return_objrec
- * creates an array in return value and frees all memory
- * Also adds as an assoc. array at the end of the return array with
- * statistics.
- */
-int make_return_objrec(pval **return_value, char **objrecs, int count)
-{
- zval *stat_arr;
- int i;
- int hidden, collhead, fullcollhead, total;
- int collheadnr, fullcollheadnr;
-
- array_init(*return_value);
-
- hidden = collhead = fullcollhead = total = 0;
- collheadnr = fullcollheadnr = -1;
- for(i=0; i<count; i++) {
- /* Fill the array with entries. No need to free objrecs[i], since
- * it is not duplicated in add_next_index_string().
- */
- if(NULL != objrecs[i]) {
- if(0 == fnAttributeCompare(objrecs[i], "PresentationHints", "Hidden"))
- hidden++;
- if(0 == fnAttributeCompare(objrecs[i], "PresentationHints", "CollectionHead")) {
- collhead++;
- collheadnr = total;
- }
- if(0 == fnAttributeCompare(objrecs[i], "PresentationHints", "FullCollectionHead")) {
- fullcollhead++;
- fullcollheadnr = total;
- }
- total++;
- add_next_index_string(*return_value, objrecs[i], 0);
- }
- }
- efree(objrecs);
-
- /* Array for statistics */
- MAKE_STD_ZVAL(stat_arr);
- array_init(stat_arr);
-
- add_assoc_long(stat_arr, "Hidden", hidden);
- add_assoc_long(stat_arr, "CollectionHead", collhead);
- add_assoc_long(stat_arr, "FullCollectionHead", fullcollhead);
- add_assoc_long(stat_arr, "Total", total);
- add_assoc_long(stat_arr, "CollectionHeadNr", collheadnr);
- add_assoc_long(stat_arr, "FullCollectionHeadNr", fullcollheadnr);
-
- /* Add the stat array */
- zend_hash_next_index_insert(Z_ARRVAL_PP(return_value), &stat_arr, sizeof(zval), NULL);
-
- return 0;
-}
-/* }}} */
-
-/* {{{ make2_return_array_from_objrec
-** creates an array return value from object record
-*/
-int make2_return_array_from_objrec(pval **return_value, char *objrec, zval *sarr) {
- char *attrname, *str, *temp, language[3];
- zval *spec_arr;
- char *strtok_buf = NULL;
-
- /* Create an array with an entry containing specs for each attribute
- and fill in the specs for Title, Description, Keyword, Group.
- If an array is passed as the last argument use it instead.
- */
- if(NULL != sarr) {
- spec_arr = sarr;
- } else {
- MAKE_STD_ZVAL(spec_arr);
- array_init(spec_arr);
- add_assoc_long(spec_arr, "Title", HW_ATTR_LANG);
- add_assoc_long(spec_arr, "Description", HW_ATTR_LANG);
- add_assoc_long(spec_arr, "Keyword", HW_ATTR_LANG);
- add_assoc_long(spec_arr, "Group", HW_ATTR_NONE);
- add_assoc_long(spec_arr, "HtmlAttr", HW_ATTR_NONE);
- add_assoc_long(spec_arr, "Parent", HW_ATTR_NONE);
- add_assoc_long(spec_arr, "SQLStmt", HW_ATTR_NR);
- }
-
- array_init(*return_value);
-
- /* Loop through the attributes of object record and check
- if the attribute has a specification. If it has the value
- is added to array in spec record. If not it is added straight
- to the return_value array.
- */
- temp = estrdup(objrec);
- attrname = php_strtok_r(temp, "\n", &strtok_buf);
- while(attrname != NULL) {
- zval *data, **dataptr;
- long spec;
- str = attrname;
-
- /* Check if a specification is available.
- If it isn't available then insert the attribute as
- a string into the return array
- */
- while((*str != '=') && (*str != '\0'))
- str++;
- *str = '\0';
- str++;
- if(zend_hash_find(Z_ARRVAL_P(spec_arr), attrname, strlen(attrname)+1, (void **) &dataptr) == FAILURE) {
- add_assoc_string(*return_value, attrname, str, 1);
- } else {
- zval *newarr;
- data = *dataptr;
- spec = Z_LVAL_P(data);
-
- if(zend_hash_find(Z_ARRVAL_PP(return_value), attrname, strlen(attrname)+1, (void **) &dataptr) == FAILURE) {
- MAKE_STD_ZVAL(newarr);
- array_init(newarr);
- zend_hash_add(Z_ARRVAL_PP(return_value), attrname, strlen(attrname)+1, &newarr, sizeof(zval *), NULL);
- } else {
- newarr = *dataptr;
- }
-
- switch(spec) {
- case HW_ATTR_LANG:
- if(str[2] == ':') {
- str[2] = '\0';
- strcpy(language, str);
- str += 3;
- } else
- strcpy(language, "xx");
-
- add_assoc_string(newarr, language, str, 1);
- break;
- case HW_ATTR_NR:
- if(str[1] == ':') {
- str[1] = '\0';
- strcpy(language, str);
- str += 2;
- } else
- strcpy(language, "x");
-
- add_assoc_string(newarr, language, str, 1);
- break;
- case HW_ATTR_NONE:
- add_next_index_string(newarr, str, 1);
- break;
- }
- }
-
- attrname = php_strtok_r(NULL, "\n", &strtok_buf);
- }
- if(NULL == sarr){
-/*
- spec_arr->refcount--;
- zend_hash_destroy(Z_ARRVAL_P(spec_arr));
- efree(Z_ARRVAL_P(spec_arr));
-*/
- zval_dtor(spec_arr);
- efree(spec_arr);
- }
- efree(temp);
-
- return(0);
-}
-/* }}} */
-
-/* {{{ make_return_array_from_objrec
- */
-int make_return_array_from_objrec(pval **return_value, char *objrec) {
- char *attrname, *str, *temp, language[3], *title;
- int iTitle, iDesc, iKeyword, iGroup;
- zval *title_arr;
- zval *desc_arr;
- zval *keyword_arr;
- zval *group_arr;
- int hasTitle = 0;
- int hasDescription = 0;
- int hasKeyword = 0;
- int hasGroup = 0;
- char *strtok_buf;
-
- MAKE_STD_ZVAL(title_arr);
- MAKE_STD_ZVAL(desc_arr);
- MAKE_STD_ZVAL(keyword_arr);
- MAKE_STD_ZVAL(group_arr);
-
- array_init(*return_value);
-
- /* Fill Array of titles, descriptions and keywords */
- temp = estrdup(objrec);
- attrname = php_strtok_r(temp, "\n", &strtok_buf);
- while(attrname != NULL) {
- str = attrname;
- iTitle = 0;
- iDesc = 0;
- iKeyword = 0;
- iGroup = 0;
- if(0 == strncmp(attrname, "Title=", 6)) {
- if (hasTitle == 0) {
- return -1;
- }
- array_init(title_arr);
- hasTitle = 1;
- str += 6;
- iTitle = 1;
- } else if(0 == strncmp(attrname, "Description=", 12)) {
- if (hasDescription == 0) {
- return -1;
- }
- array_init(desc_arr);
- hasDescription = 1;
- str += 12;
- iDesc = 1;
- } else if(0 == strncmp(attrname, "Keyword=", 8)) {
- if (hasKeyword == 0) {
- return -1;
- }
- array_init(keyword_arr);
- hasKeyword = 1;
- str += 8;
- iKeyword = 1;
- } else if(0 == strncmp(attrname, "Group=", 6)) {
- if (hasGroup == 0) {
- return -1;
- }
- array_init(group_arr);
- hasGroup = 1;
- str += 6;
- iGroup = 1;
- }
- if(iTitle || iDesc || iKeyword) { /* Poor error check if end of string */
- if(str[2] == ':') {
- str[2] = '\0';
- strcpy(language, str);
- str += 3;
- } else
- strcpy(language, "xx");
-
- title = str;
- if(iTitle)
- add_assoc_string(title_arr, language, title, 1);
- else if(iDesc)
- add_assoc_string(desc_arr, language, title, 1);
- else if(iKeyword)
- add_assoc_string(keyword_arr, language, title, 1);
- } else if(iGroup) {
- if(iGroup)
- add_next_index_string(group_arr, str, 1);
- }
- attrname = php_strtok_r(NULL, "\n", &strtok_buf);
- }
- efree(temp);
-
- /* Add the title array, if we have one */
- if(hasTitle) {
- zend_hash_update(Z_ARRVAL_PP(return_value), "Title", 6, &title_arr, sizeof(zval *), NULL);
-
- } else {
- efree(title_arr);
- }
-
-
- if(hasDescription) {
- /* Add the description array, if we have one */
- zend_hash_update(Z_ARRVAL_PP(return_value), "Description", 12, &desc_arr, sizeof(zval *), NULL);
-
- } else {
- efree(desc_arr);
- }
-
- if(hasKeyword) {
- /* Add the keyword array, if we have one */
- zend_hash_update(Z_ARRVAL_PP(return_value), "Keyword", 8, &keyword_arr, sizeof(zval *), NULL);
-
- } else {
- efree(keyword_arr);
- }
-
- if(hasGroup) {
- /* Add the Group array, if we have one */
- zend_hash_update(Z_ARRVAL_PP(return_value), "Group", 6, &group_arr, sizeof(zval *), NULL);
-
- } else {
- efree(group_arr);
- }
-
- /* All other attributes. Make a another copy first */
- temp = estrdup(objrec);
- attrname = php_strtok_r(temp, "\n", &strtok_buf);
- while(attrname != NULL) {
- str = attrname;
- /* We don't want to insert titles, descr., keywords a second time */
- if((0 != strncmp(attrname, "Title=", 6)) &&
- (0 != strncmp(attrname, "Description=", 12)) &&
- (0 != strncmp(attrname, "Group=", 6)) &&
- (0 != strncmp(attrname, "Keyword=", 8))) {
- while((*str != '=') && (*str != '\0'))
- str++;
- *str = '\0';
- str++;
- add_assoc_string(*return_value, attrname, str, 1);
- }
- attrname = php_strtok_r(NULL, "\n", &strtok_buf);
- }
- efree(temp);
-
- return(0);
-}
-/* }}} */
-
-#define BUFFERLEN 1024
-/* {{{ make_objrec_from_array
- */
-static char * make_objrec_from_array(HashTable *lht, char delim) {
- int i, count, keytype;
- ulong idx;
- uint length;
- char *key, str[BUFFERLEN], *objrec = NULL;
- zval *keydata, **keydataptr;
-
- if(NULL == lht)
- return NULL;
-
- if(0 == (count = zend_hash_num_elements(lht)))
- return NULL;
-
- if(delim == 0)
- delim = '=';
-
- zend_hash_internal_pointer_reset(lht);
- objrec = malloc(1);
- *objrec = '\0';
- for(i=0; i<count; i++) {
- keytype = zend_hash_get_current_key_ex(lht, &key, &length, &idx, 0, NULL);
-/* if(HASH_KEY_IS_STRING == keytype) { */
- zend_hash_get_current_data(lht, (void **) &keydataptr);
- keydata = *keydataptr;
- switch(Z_TYPE_P(keydata)) {
- case IS_STRING:
- if(HASH_KEY_IS_STRING == keytype)
- snprintf(str, BUFFERLEN, "%s%c%s\n", key, delim, Z_STRVAL_P(keydata));
- else if(HASH_KEY_IS_LONG == keytype)
- snprintf(str, BUFFERLEN, "%ld%c%s\n", idx, delim, Z_STRVAL_P(keydata));
- else
- snprintf(str, BUFFERLEN, "%s\n", Z_STRVAL_P(keydata));
- break;
- case IS_LONG:
- if(HASH_KEY_IS_STRING == keytype)
- snprintf(str, BUFFERLEN, "%s%c0x%lX\n", key, delim, Z_LVAL_P(keydata));
- else if(HASH_KEY_IS_LONG == keytype)
- snprintf(str, BUFFERLEN, "%ld%c%s\n", idx, delim, Z_STRVAL_P(keydata));
- else
- snprintf(str, BUFFERLEN, "0x%lX\n", Z_LVAL_P(keydata));
- break;
- case IS_ARRAY: {
- int i, len, keylen, count;
- char *strarr, *ptr, *ptr1;
- count = zend_hash_num_elements(Z_ARRVAL_P(keydata));
- if(count > 0) {
- strarr = make_objrec_from_array(Z_ARRVAL_P(keydata), ':');
- len = strlen(strarr) - 1;
- keylen = strlen(key);
- if(NULL == (ptr = malloc(len + 1 + count*(keylen+1)))) {
- free(objrec);
- return(NULL);
- }
- ptr1 = ptr;
- *ptr1 = '\0';
- strcpy(ptr1, key);
- ptr1 += keylen;
- *ptr1++ = '=';
- for(i=0; i<len; i++) {
- *ptr1++ = strarr[i];
- if(strarr[i] == '\n') {
- strcpy(ptr1, key);
- ptr1 += keylen;
- *ptr1++ = '=';
- }/* else if(strarr[i] == '=')
- ptr1[-1] = ':'; */
- }
- *ptr1++ = '\n';
- *ptr1 = '\0';
- strlcpy(str, ptr, sizeof(str));
- }
- break;
- }
- }
- objrec = realloc(objrec, strlen(objrec)+strlen(str)+1);
- strcat(objrec, str);
-/* } */
- zend_hash_move_forward(lht);
- }
- return objrec;
-}
-/* }}} */
-#undef BUFFERLEN
-
-/* {{{ make_ints_from_array
- */
-static int * make_ints_from_array(HashTable *lht) {
- int i, count;
- int *objids = NULL;
- zval **keydata;
-
- if(NULL == lht)
- return NULL;
-
- if(0 == (count = zend_hash_num_elements(lht)))
- return NULL;
-
- zend_hash_internal_pointer_reset(lht);
- if(NULL == (objids = emalloc(count*sizeof(int))))
- return NULL;
- for(i=0; i<count; i++) {
- zend_hash_get_current_data(lht, (void **) &keydata);
- switch(Z_TYPE_PP(keydata)) {
- case IS_LONG:
- objids[i] = Z_LVAL_PP(keydata);
- break;
- default:
- objids[i] = 0;
- }
- zend_hash_move_forward(lht);
- }
- return objids;
-}
-/* }}} */
-
-/* {{{ make_strs_from_array
- */
-static char **make_strs_from_array(HashTable *arrht) {
- char **carr = NULL;
- char **ptr;
- zval *data, **dataptr;
-
- zend_hash_internal_pointer_reset(arrht);
- if(NULL == (carr = emalloc(zend_hash_num_elements(arrht) * sizeof(char *))))
- return(NULL);
- ptr = carr;
-
- /* Iterate through hash */
- while(zend_hash_get_current_data(arrht, (void **) &dataptr) == SUCCESS) {
- data = *dataptr;
- switch(Z_TYPE_P(data)) {
- case IS_STRING:
- *ptr = estrdup(Z_STRVAL_P(data));
-/*fprintf(stderr, "carr[] = %s\n", *ptr); */
- break;
- default:
- *ptr = NULL;
- }
- ptr++;
-
- zend_hash_move_forward(arrht);
- }
- return(carr);
-}
-/* }}} */
-
-#define BUFFERLEN 30
-/* {{{ php_hw_do_connect
- */
-static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- zval **argv[4];
- int argc;
- int sockfd;
- int port = 0;
- char *host = NULL;
- char *userdata = NULL;
- char *server_string = NULL;
- char *username = NULL;
- char *password = NULL;
- char *hashed_details;
- char *str = NULL;
- char buffer[BUFFERLEN];
- int hashed_details_length;
- hw_connection *ptr;
- int do_swap;
- int version = 0;
-
- argc = ZEND_NUM_ARGS();
- switch(argc) {
- case 2:
- case 4:
- if (zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- /* Host: */
- convert_to_string_ex(argv[0]);
- host = (char *) estrndup(Z_STRVAL_PP(argv[0]), Z_STRLEN_PP(argv[0]));
-
- /* Port: */
- convert_to_long_ex(argv[1]);
- port = Z_LVAL_PP(argv[1]);
-
- /* Username and Password */
- if(argc > 2) {
- /* Username */
- convert_to_string_ex(argv[2]);
- username = (char *) estrndup(Z_STRVAL_PP(argv[2]), Z_STRLEN_PP(argv[2]));
- /* Password */
- convert_to_string_ex(argv[3]);
- password = (char *) estrndup(Z_STRVAL_PP(argv[3]), Z_STRLEN_PP(argv[3]));
- }
-
- /* Create identifier string for connection */
- snprintf(buffer, BUFFERLEN, "%d", port);
- hashed_details_length = strlen(host)+strlen(buffer)+8;
- if(NULL == (hashed_details = (char *) emalloc(hashed_details_length+1))) {
- if(host) efree(host);
- if(password) efree(password);
- if(username) efree(username);
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not get memory for connection details");
- RETURN_FALSE;
- }
- sprintf(hashed_details, "hw_%s_%d", host, port);
-
- if (persistent) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) {
- list_entry new_le;
-
- if (HwSG(max_links)!=-1 && HwSG(num_links)>=HwSG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Too many open links (%d)", HwSG(num_links));
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (HwSG(max_persistent!=-1) && HwSG(num_persistent)>=HwSG(max_persistent)) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Too many open persistent links (%d)", HwSG(num_persistent));
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if ( (sockfd = open_hg_connection(host, port)) < 0 ) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not open connection to %s, Port: %d (retval=%d, errno=%d)", host, port, sockfd, errno);
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if(NULL == (ptr = malloc(sizeof(hw_connection)))) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not get memory for connection structure");
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if(0 != (ptr->lasterror = initialize_hg_connection(sockfd, &do_swap, &version, &userdata, &server_string, username, password))) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not initalize hyperwave connection");
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- if(userdata) efree(userdata);
- if(server_string) free(server_string);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if(username) efree(username);
- if(password) efree(password);
-
- ptr->version = version;
- ptr->server_string = server_string;
- ptr->socket = sockfd;
- ptr->swap_on = do_swap;
- ptr->linkroot = 0;
- ptr->hostname = strdup(host);
- ptr->username = strdup("anonymous");
-
- new_le.ptr = (void *) ptr;
- Z_TYPE(new_le) = le_psocketp;
-
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not hash table with connection details");
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- if(server_string) free(server_string);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- HwSG(num_links)++;
- HwSG(num_persistent)++;
- } else {
- /*php_printf("Found already open connection\n"); */
- if (Z_TYPE_P(le) != le_psocketp) {
- RETURN_FALSE;
- }
- ptr = le->ptr;
- }
-
- Z_LVAL_P(return_value) = zend_list_insert(ptr, le_psocketp);
- Z_TYPE_P(return_value) = IS_RESOURCE;
-
- } else {
- list_entry *index_ptr, new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual hyperwave link sits.
- * if it doesn't, open a new hyperwave link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length+1, (void **) &index_ptr)==SUCCESS) {
- int type, link;
- void *ptr;
-
- if (Z_TYPE_P(index_ptr) != le_index_ptr) {
- RETURN_FALSE;
- }
- link = (int) index_ptr->ptr;
- ptr = (hw_connection *) zend_list_find(link, &type); /* check if the link is still there */
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- Z_LVAL_P(return_value) = HwSG(default_link) = link;
- Z_TYPE_P(return_value) = IS_LONG;
- efree(hashed_details);
- if(username) efree(username);
- if(password) efree(password);
- if(host) efree(host);
- return;
- } else {
- zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length+1);
- }
- }
-
- if ( (sockfd = open_hg_connection(host, port)) < 0 ) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not open connection to %s, Port: %d (retval=%d", host, port, sockfd);
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if(NULL == (ptr = malloc(sizeof(hw_connection)))) {
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if(0 != (ptr->lasterror = initialize_hg_connection(sockfd, &do_swap, &version, &userdata, &server_string, username, password))) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not initalize hyperwave connection");
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- if(userdata) efree(userdata);
- if(server_string) free(server_string);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if(username) efree(username);
- if(password) efree(password);
-
- ptr->version = version;
- ptr->server_string = server_string;
- ptr->socket = sockfd;
- ptr->swap_on = do_swap;
- ptr->linkroot = 0;
- ptr->hostname = strdup(host);
- ptr->username = strdup("anonymous");
-
- Z_LVAL_P(return_value) = zend_list_insert(ptr, le_socketp);
- Z_TYPE_P(return_value) = IS_RESOURCE;
-
- new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
- Z_TYPE(new_index_ptr) = le_index_ptr;
- if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1, (void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not update connection details in hash table");
- if(host) efree(host);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- }
-
- efree(hashed_details);
- if(host) efree(host);
- HwSG(default_link)=Z_LVAL_P(return_value);
-
- /* At this point we have a working connection. If userdata was given
- we are also indentified.
- If there is no userdata because hw_connect was called without username
- and password, we don't evaluate userdata.
- */
- if(NULL == userdata)
- return;
-
- if(ptr->username) free(ptr->username);
- str = userdata;
- while((*str != 0) && (*str != ' '))
- str++;
- if(*str != '\0')
- ptr->username = strdup(++str);
- else
- ptr->username = NULL;
- efree(userdata);
-}
-/* }}} */
-#undef BUFFERLEN
-
-/* Start of user level functions */
-/* ***************************** */
-/* {{{ proto int hw_connect(string host, int port [string username [, string password]])
- Connect to the Hyperwave server */
-PHP_FUNCTION(hw_connect)
-{
- php_hw_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int hw_pconnect(string host, int port [, string username [, string password]])
- Connect to the Hyperwave server persistent */
-PHP_FUNCTION(hw_pconnect)
-{
- php_hw_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto void hw_close(int link)
- Close connection to Hyperwave server */
-PHP_FUNCTION(hw_close)
-{
- zval **arg1;
- int link, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- zend_list_delete(link);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void hw_info(int link)
- Outputs info string */
-PHP_FUNCTION(hw_info)
-{
- pval **arg1;
- int link, type;
- hw_connection *ptr;
- char *str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- if(NULL != (str = get_hw_info(ptr))) {
- /*
- php_printf("%s\n", str);
- efree(str);
- */
- Z_STRLEN_P(return_value) = strlen(str);
- Z_STRVAL_P(return_value) = str;
- Z_TYPE_P(return_value) = IS_STRING;
- return;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int hw_error(int link)
- Returns last error number */
-PHP_FUNCTION(hw_error)
-{
- pval **arg1;
- int link, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- RETURN_LONG(ptr->lasterror);
-}
-/* }}} */
-
-/* {{{ proto string hw_errormsg(int link)
- Returns last error message */
-PHP_FUNCTION(hw_errormsg)
-{
- pval **arg1;
- int link, type;
- hw_connection *ptr;
- char errstr[100];
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
-
- switch (ptr->lasterror) {
- case 0:
- sprintf(errstr, "No error");
- break;
- case NOACCESS:
- sprintf(errstr, "Access denied");
- break;
- case NODOCS:
- sprintf(errstr, "No documents");
- break;
- case NONAME:
- sprintf(errstr, "No collection name");
- break;
- case NODOC:
- sprintf(errstr, "Object is not a document");
- break;
- case NOOBJ:
- sprintf(errstr, "No object received");
- break;
- case NOCOLLS:
- sprintf(errstr, "No collections received");
- break;
- case DBSTUBNG:
- sprintf(errstr, "Connection to low-level database failed");
- break;
- case NOTFOUND:
- sprintf(errstr, "Object not found");
- break;
- case EXIST:
- sprintf(errstr, "Collection already exists");
- break;
- case FATHERDEL:
- sprintf(errstr, "parent collection disappeared");
- break;
- case FATHNOCOLL:
- sprintf(errstr, "parent collection not a collection");
- break;
- case NOTEMPTY:
- sprintf(errstr, "Collection not empty");
- break;
- case DESTNOCOLL:
- sprintf(errstr, "Destination not a collection");
- break;
- case SRCEQDEST:
- sprintf(errstr, "Source equals destination");
- break;
- case REQPEND:
- sprintf(errstr, "Request pending");
- break;
- case TIMEOUT:
- sprintf(errstr, "Timeout");
- break;
- case NAMENOTUNIQUE:
- sprintf(errstr, "Name not unique");
- break;
- case WRITESTOPPED:
- sprintf(errstr, "Database now read-only; try again later");
- break;
- case LOCKED:
- sprintf(errstr, "Object locked; try again later");
- break;
- case CHANGEBASEFLD:
- sprintf(errstr, "Change of base-attribute");
- break;
- case NOTREMOVED:
- sprintf(errstr, "Attribute not removed");
- break;
- case FLDEXISTS:
- sprintf(errstr, "Attribute exists");
- break;
- case CMDSYNTAX:
- sprintf(errstr, "Syntax error in command");
- break;
- case NOLANGUAGE:
- sprintf(errstr, "No or unknown language specified");
- break;
- case WRGTYPE:
- sprintf(errstr, "Wrong type in object");
- break;
- case WRGVERSION:
- sprintf(errstr, "Client version too old");
- break;
- case CONNECTION:
- sprintf(errstr, "No connection to other server");
- break;
- case SYNC:
- sprintf(errstr, "Synchronization error");
- break;
- case NOPATH:
- sprintf(errstr, "No path entry");
- break;
- case WRGPATH:
- sprintf(errstr, "Wrong path entry");
- break;
- case PASSWD:
- sprintf(errstr, "Wrong password (server-to-server server authentication)");
- break;
- case LC_NO_MORE_USERS:
- sprintf(errstr, "No more users for license");
- break;
- case LC_NO_MORE_DOCS:
- sprintf(errstr, "No more documents for this session and license");
- break;
- case RSERV_NRESP:
- sprintf(errstr, "Remote server not responding");
- break;
- case Q_OVERFLOW:
- sprintf(errstr, "Query overflow");
- break;
- case USR_BREAK:
- sprintf(errstr, "Break by user");
- break;
- case N_IMPL:
- sprintf(errstr, "Not implemented");
- break;
- case WRG_VALUE:
- sprintf(errstr, "Wrong value");
- break;
- case INSUFF_FUNDS:
- sprintf(errstr, "Insufficient funds");
- break;
- case REORG:
- sprintf(errstr, "Reorganization in progress");
- break;
- case USER_LIMIT:
- sprintf(errstr, "Limit of simultaneous users reached");
- break;
- case FTCONNECT:
- sprintf(errstr, "No connection to fulltext server");
- break;
- case FTTIMEOUT:
- sprintf(errstr, "Connection timed out");
- break;
- case FTINDEX:
- sprintf(errstr, "Something wrong with fulltext index");
- break;
- case FTSYNTAX:
- sprintf(errstr, "Query syntax error");
- break;
- case REQUESTPENDING:
- sprintf(errstr, "Request pending");
- break;
- case NOCONNECTION:
- sprintf(errstr, "No connection to document server");
- break;
- case WRONGVERSION:
- sprintf(errstr, "Wrong protocol version");
- break;
- case NOTINITIALIZED:
- sprintf(errstr, "Not initialized");
- break;
- case BADREQUEST:
- sprintf(errstr, "Bad request");
- break;
- case BADLRN:
- sprintf(errstr, "Bad document number");
- break;
- case OPENSTORE_WRITE:
- sprintf(errstr, "Cannot write to local store");
- break;
- case OPENSTORE_READ:
- sprintf(errstr, "Cannot read from local store");
- break;
- case READSTORE:
- sprintf(errstr, "Store read error");
- break;
- case WRITESTORE:
- sprintf(errstr, "Write error");
- break;
- case CLOSESTORE:
- sprintf(errstr, "Close error");
- break;
- case BADPATH:
- sprintf(errstr, "Bad path");
- break;
- case NOPATHDC:
- sprintf(errstr, "No path");
- break;
- case OPENFILE:
- sprintf(errstr, "Cannot open file");
- break;
- case READFILE:
- sprintf(errstr, "Cannot read from file // same");
- break;
- case WRITEFILE:
- sprintf(errstr, "Cannot write to file");
- break;
- case CONNECTCLIENT:
- sprintf(errstr, "Could not connect to client");
- break;
- case ACCEPT:
- sprintf(errstr, "Could not accept connection");
- break;
- case READSOCKET:
- sprintf(errstr, "Could not read from socket");
- break;
- case WRITESOCKET:
- sprintf(errstr, "Could not write to socket");
- break;
- case TOOMUCHDATA:
- sprintf(errstr, "Received too much data");
- break;
- case TOOFEWDATA:
- sprintf(errstr, "Received too few data // ...");
- break;
- case NOTIMPLEMENTED:
- sprintf(errstr, "Not implemented");
- break;
- case USERBREAK:
- sprintf(errstr, "User break");
- break;
- case INTERNAL:
- sprintf(errstr, "Internal error");
- break;
- case INVALIDOBJECT:
- sprintf(errstr, "Invalid object");
- break;
- case JOBTIMEOUT:
- sprintf(errstr, "Job timed out");
- break;
- case OPENPORT:
- sprintf(errstr, "Cannot open port // ... for several resons");
- break;
- case NODATA:
- sprintf(errstr, "Received no data");
- break;
- case NOPORT:
- sprintf(errstr, "No port to handle this request");
- break;
- case NOTCACHED:
- sprintf(errstr, "Document not cached");
- break;
- case BADCACHETYPE:
- sprintf(errstr, "Bad cache type");
- break;
- case OPENCACHE_WRITE:
- sprintf(errstr, "Cannot write to cache");
- break;
- case OPENCACHE_READ:
- sprintf(errstr, "Cannot read from cache // same");
- break;
- case NOSOURCE:
- sprintf(errstr, "Do not know what to read");
- break;
- case CLOSECACHE:
- sprintf(errstr, "Could not insert into cache");
- break;
- case CONNECTREMOTE:
- sprintf(errstr, "Could not connect to remote server");
- break;
- case LOCKREFUSED:
- sprintf(errstr, "Lock refused // could not lock the stores");
- break;
- default:
- sprintf(errstr, "Unknown error: %d", ptr->lasterror);
- }
- RETURN_STRING(errstr, 1);
-}
-/* }}} */
-
-/* {{{ proto int hw_root(void)
- Returns object id of root collection */
-PHP_FUNCTION(hw_root)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- Z_LVAL_P(return_value) = 0;
- Z_TYPE_P(return_value) = IS_LONG;
-}
-/* }}} */
-
-/* {{{ php_hw_command
- */
-char *php_hw_command(INTERNAL_FUNCTION_PARAMETERS, int comm) {
- pval **arg1;
- int link, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- return NULL;
- }
- convert_to_long_ex(arg1);
- link = Z_LVAL_PP(arg1);
- ptr = (hw_connection *) zend_list_find(link, &type);
- if(!ptr || (type != le_socketp && type != le_psocketp)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find file identifier %d", link);
- return NULL;
- }
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- if (0 != (ptr->lasterror = send_command(ptr->socket, comm, &object))) {
- return NULL;
- }
- return object;
- }
- return NULL;
-}
-/* }}} */
-
-/* {{{ proto string hw_stat(int link)
- Returns status string */
-PHP_FUNCTION(hw_stat)
-{
- char *object;
-
- object = php_hw_command(INTERNAL_FUNCTION_PARAM_PASSTHRU, STAT_COMMAND);
- if(object == NULL)
- RETURN_FALSE;
-
- Z_STRVAL_P(return_value) = object;
- Z_STRLEN_P(return_value) = strlen(object);
- Z_TYPE_P(return_value) = IS_STRING;
-}
-/* }}} */
-
-/* {{{ proto array hw_who(int link)
- Returns names and info of users loged in */
-PHP_FUNCTION(hw_who)
-{
- zval *user_arr;
- char *object, *ptr, *temp, *attrname;
- int i;
- char *strtok_buf;
-
- object = php_hw_command(INTERNAL_FUNCTION_PARAM_PASSTHRU, WHO_COMMAND);
- if(object == NULL)
- RETURN_FALSE;
-
- ptr = object;
-
-php_printf("%s\n", ptr);
- /* Skip first two lines, they just contain:
- Users in Database
-
- */
- while((*ptr != '\0') && (*ptr != '\n'))
- ptr++;
- while((*ptr != '\0') && (*ptr != '\n'))
- ptr++;
- if(*ptr == '\0') {
- efree(object);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- temp = estrdup(ptr);
- attrname = php_strtok_r(temp, "\n", &strtok_buf);
- i = 0;
- while(attrname != NULL) {
- char *name;
-
- ALLOC_ZVAL(user_arr);
- array_init(user_arr);
-
- ptr = attrname;
- if(*ptr++ == '*')
- add_assoc_long(user_arr, "self", 1);
- else
- add_assoc_long(user_arr, "self", 0);
-
- ptr++;
- name = ptr;
- while((*ptr != '\0') && (*ptr != ' '))
- ptr++;
- *ptr = '\0';
- add_assoc_string(user_arr, "id", name, 1);
-
- ptr++;
- name = ptr;
- while((*ptr != '\0') && (*ptr != ' '))
- ptr++;
- *ptr = '\0';
- add_assoc_string(user_arr, "name", name, 1);
-
- ptr++;
- while((*ptr != '\0') && (*ptr == ' '))
- ptr++;
-
- name = ptr;
- while((*ptr != '\0') && (*ptr != ' '))
- ptr++;
- *ptr = '\0';
- add_assoc_string(user_arr, "system", name, 1);
-
- ptr++;
- while((*ptr != '\0') && (*ptr == ' '))
- ptr++;
-
- name = ptr;
- while((*ptr != '\0') && (*ptr != ' '))
- ptr++;
- *ptr = '\0';
- add_assoc_string(user_arr, "onSinceDate", name, 1);
-
- ptr++;
- while((*ptr != '\0') && (*ptr == ' '))
- ptr++;
-
- name = ptr;
- while((*ptr != '\0') && (*ptr != ' '))
- ptr++;
- *ptr = '\0';
- add_assoc_string(user_arr, "onSinceTime", name, 1);
-
- ptr++;
- while((*ptr != '\0') && (*ptr == ' '))
- ptr++;
-
- name = ptr;
- while((*ptr != '\0') && (*ptr != ' '))
- ptr++;
- *ptr = '\0';
- add_assoc_string(user_arr, "TotalTime", name, 1);
-
- /* Add the user array */
- zend_hash_index_update(Z_ARRVAL_P(return_value), i++, &user_arr, sizeof(pval), NULL);
-
- attrname = php_strtok_r(NULL, "\n", &strtok_buf);
- }
- efree(temp);
- efree(object);
-
-}
-/* }}} */
-
-/* {{{ proto string hw_dummy(int link, int id, int msgid)
- Hyperwave dummy function */
-PHP_FUNCTION(hw_dummy)
-{
- pval **arg1, **arg2, **arg3;
- int link, id, type, msgid;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
- id=Z_LVAL_PP(arg2);
- msgid=Z_LVAL_PP(arg3);
- HW_FETCH_LINK(arg1);
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- if (0 != (ptr->lasterror = send_dummy(ptr->socket, id, msgid, &object)))
- RETURN_FALSE;
-
-php_printf("%s", object);
- Z_STRVAL_P(return_value) = object;
- Z_STRLEN_P(return_value) = strlen(object);
- Z_TYPE_P(return_value) = IS_STRING;
- }
-}
-/* }}} */
-
-/* {{{ proto string hw_getobject(int link, int objid [, string query])
- Returns object record */
-PHP_FUNCTION(hw_getobject)
-{
- pval **argv[3];
- int argc, link, id, type, multi;
- char *query;
- hw_connection *ptr;
-
- argc = ZEND_NUM_ARGS();
- if(argc < 2 || argc > 3)
- WRONG_PARAM_COUNT;
- if (zend_get_parameters_array_ex(argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- HW_FETCH_LINK(argv[0]);
- if(Z_TYPE_PP(argv[1]) == IS_ARRAY) {
- multi = 1;
- convert_to_array_ex(argv[1]);
- } else {
- multi = 0;
- convert_to_long_ex(argv[1]);
- }
-
- if(argc == 3) {
- convert_to_string_ex(argv[2]);
- query = Z_STRVAL_PP(argv[2]);
- } else
- query = NULL;
-
- set_swap(ptr->swap_on);
- if(multi) {
- char **objects = NULL;
- int count, *ids, i;
- HashTable *lht;
- zval **keydata;
-
- lht = Z_ARRVAL_PP(argv[1]);
- if(0 == (count = zend_hash_num_elements(lht))) {
- RETURN_FALSE;
- }
- ids = emalloc(count * sizeof(hw_objectID));
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- zend_hash_get_current_data(lht, (void **) &keydata);
- switch(Z_TYPE_PP(keydata)) {
- case IS_LONG:
- ids[i] = Z_LVAL_PP(keydata);
- break;
- default:
- ids[i] = Z_LVAL_PP(keydata);
- }
- zend_hash_move_forward(lht);
- }
-
- if (0 != (ptr->lasterror = send_objectbyidquery(ptr->socket, ids, &count, query, &objects))) {
- efree(ids);
- RETURN_FALSE;
- }
- efree(ids);
- array_init(return_value);
-
- for(i=0; i<count; i++) {
- add_index_string(return_value, i, objects[i], 0);
- }
- efree(objects);
-
- } else {
- char *object = NULL;
- id=Z_LVAL_PP(argv[1]);
- if (0 != (ptr->lasterror = send_getobject(ptr->socket, id, &object)))
- RETURN_FALSE;
-
- RETURN_STRING(object, 0);
- }
-}
-/* }}} */
-
-/* {{{ proto int hw_insertobject(int link, string objrec, string parms)
- Inserts an object */
-PHP_FUNCTION(hw_insertobject)
-{
- zval **arg1, **arg2, **arg3;
- int link, type;
- char *objrec, *parms;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- objrec=Z_STRVAL_PP(arg2);
- parms=Z_STRVAL_PP(arg3);
-
- set_swap(ptr->swap_on);
- {
- int objid;
- if (0 != (ptr->lasterror = send_insertobject(ptr->socket, objrec, parms, &objid)))
- RETURN_FALSE;
-
- RETURN_LONG(objid);
- }
-}
-/* }}} */
-
-/* {{{ proto string hw_getandlock(int link, int objid)
- Returns object record and locks object */
-PHP_FUNCTION(hw_getandlock)
-{
- zval **arg1, **arg2;
- int link, id, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- if (0 != (ptr->lasterror = send_getandlock(ptr->socket, id, &object)))
- RETURN_FALSE;
-
- RETURN_STRING(object, 0);
- }
-}
-/* }}} */
-
-/* {{{ proto void hw_unlock(int link, int objid)
- Unlocks object */
-PHP_FUNCTION(hw_unlock)
-{
- zval **arg1, **arg2;
- int link, id, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_unlock(ptr->socket, id)))
- RETURN_FALSE;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void hw_deleteobject(int link, int objid)
- Deletes object */
-PHP_FUNCTION(hw_deleteobject)
-{
- zval **arg1, **arg2;
- int link, id, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_deleteobject(ptr->socket, id)))
- RETURN_FALSE;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void hw_changeobject(int link, int objid, array attributes)
- Changes attributes of an object (obsolete) */
-#define BUFFERLEN 200
-PHP_FUNCTION(hw_changeobject)
-{
- zval **arg1, **arg2, **arg3;
- int link, id, type, i;
- hw_connection *ptr;
- char *modification, *oldobjrec, buf[BUFFERLEN];
- HashTable *newobjarr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2); /* object ID */
- convert_to_array_ex(arg3); /* Array with new attributes */
- id=Z_LVAL_PP(arg2);
- newobjarr=Z_ARRVAL_PP(arg3);
-
- /* get the old object record */
- if(0 != (ptr->lasterror = send_getandlock(ptr->socket, id, &oldobjrec)))
- RETURN_FALSE;
-
- zend_hash_internal_pointer_reset(newobjarr);
- modification = strdup("");
- for(i=0; i<zend_hash_num_elements(newobjarr); i++) {
- char *key, *str, *str1, newattribute[BUFFERLEN];
- pval *data, **dataptr;
- int j, noinsert=1;
- ulong ind;
-
- zend_hash_get_current_key(newobjarr, &key, &ind, 0);
- zend_hash_get_current_data(newobjarr, (void *) &dataptr);
- data = *dataptr;
- switch(Z_TYPE_P(data)) {
- case IS_STRING:
- if(strlen(Z_STRVAL_P(data)) == 0)
- snprintf(newattribute, BUFFERLEN, "rem %s", key);
- else
- snprintf(newattribute, BUFFERLEN, "add %s=%s", key, Z_STRVAL_P(data));
- noinsert = 0;
- break;
- default:
- newattribute[0] = '\0';
- }
- if(!noinsert) {
- modification = fnInsStr(modification, 0, "\\");
- modification = fnInsStr(modification, 0, newattribute);
-/* modification = fnInsStr(modification, 0, "add "); */
-
- /* Retrieve the old attribute from object record */
- if(NULL != (str = strstr(oldobjrec, key))) {
- str1 = str;
- j = 0;
- while((str1 != NULL) && (*str1 != '\n') && (j < BUFFERLEN-1)) {
- buf[j++] = *str1++;
- }
- buf[j] = '\0';
- modification = fnInsStr(modification, 0, "\\");
- modification = fnInsStr(modification, 0, buf);
- modification = fnInsStr(modification, 0, "rem ");
- }
- }
- zend_hash_move_forward(newobjarr);
- }
- efree(oldobjrec);
-
- set_swap(ptr->swap_on);
- modification[strlen(modification)-1] = '\0';
- if (0 != (ptr->lasterror = send_changeobject(ptr->socket, id, modification))) {
- free(modification);
- send_unlock(ptr->socket, id);
- RETURN_FALSE;
- }
- free(modification);
- if (0 != (ptr->lasterror = send_unlock(ptr->socket, id))) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-#undef BUFFERLEN
-/* }}} */
-
-/* {{{ proto void hw_modifyobject(int link, int objid, array remattributes, array addattributes [, int mode])
- Modifies attributes of an object */
-#define BUFFERLEN 200
-PHP_FUNCTION(hw_modifyobject)
-{
- zval **argv[5];
- int argc;
- int link, id, type, i, mode;
- hw_connection *ptr;
- char *modification;
- HashTable *remobjarr, *addobjarr;
-
- argc = ZEND_NUM_ARGS();
- if((argc > 5) || (argc < 4))
- WRONG_PARAM_COUNT;
-
- if (zend_get_parameters_array_ex(argc, argv) == FAILURE)
- if(argc < 4) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(argv[0]);
- convert_to_long_ex(argv[1]); /* object ID */
- convert_to_array_ex(argv[2]); /* Array with attributes to remove */
- convert_to_array_ex(argv[3]); /* Array with attributes to add */
- if(argc == 5) {
- convert_to_long_ex(argv[4]);
- mode = Z_LVAL_PP(argv[4]);
- } else
- mode = 0;
- id=Z_LVAL_PP(argv[1]);
- remobjarr=Z_ARRVAL_PP(argv[2]);
- addobjarr=Z_ARRVAL_PP(argv[3]);
-
- modification = strdup("");
- if(addobjarr != NULL) {
- zend_hash_internal_pointer_reset(addobjarr);
- for(i=0; i<zend_hash_num_elements(addobjarr); i++) {
- char *key, addattribute[BUFFERLEN];
- zval *data, **dataptr;
- int noinsert=1;
- ulong ind;
-
- zend_hash_get_current_key(addobjarr, &key, &ind, 0);
- zend_hash_get_current_data(addobjarr, (void *) &dataptr);
- data = *dataptr;
- switch(Z_TYPE_P(data)) {
- case IS_STRING:
- if(strlen(Z_STRVAL_P(data)) > 0) {
- snprintf(addattribute, BUFFERLEN, "add %s=%s", key, Z_STRVAL_P(data));
-/* fprintf(stderr, "add: %s\n", addattribute); */
- noinsert = 0;
- }
- break;
- case IS_ARRAY: {
- int i, len, keylen, count;
- char *strarr, *ptr, *ptr1;
- count = zend_hash_num_elements(Z_ARRVAL_P(data));
- if(count > 0) {
- strarr = make_objrec_from_array(Z_ARRVAL_P(data), ':');
- len = strlen(strarr) - 1;
- keylen = strlen(key);
- if(NULL == (ptr = malloc(len + 1 + count*(keylen+1+4)))) {
- if(modification)
- free(modification);
- RETURN_FALSE;
- }
- ptr1 = ptr;
- *ptr1 = '\0';
- strcpy(ptr1, "add ");
- ptr1 += 4;
- strcpy(ptr1, key);
- ptr1 += keylen;
- *ptr1++ = '=';
- for(i=0; i<len; i++) {
- *ptr1++ = strarr[i];
- if(strarr[i] == '\n') {
- ptr1[-1] = '\\';
- strcpy(ptr1, "add ");
- ptr1 += 4;
- strcpy(ptr1, key);
- ptr1 += keylen;
- *ptr1++ = '=';
- } /* else if(strarr[i] == '=')
- ptr1[-1] = ':'; */
- }
- *ptr1 = '\0';
- strlcpy(addattribute, ptr, sizeof(addattribute));
- noinsert = 0;
- }
- break;
- }
- }
- if(!noinsert) {
- modification = fnInsStr(modification, 0, "\\");
- modification = fnInsStr(modification, 0, addattribute);
- }
- zend_hash_move_forward(addobjarr);
- }
- }
-
- if(remobjarr != NULL) {
- int nr;
- zend_hash_internal_pointer_reset(remobjarr);
- nr = zend_hash_num_elements(remobjarr);
- for(i=0; i<nr; i++) {
- char *key, remattribute[BUFFERLEN];
- zval *data, **dataptr;
- int noinsert=1;
- ulong ind;
-
- zend_hash_get_current_key(remobjarr, &key, &ind, 0);
- zend_hash_get_current_data(remobjarr, (void *) &dataptr);
- data = *dataptr;
- switch(Z_TYPE_P(data)) {
- case IS_STRING:
- if(strlen(Z_STRVAL_P(data)) > 0) {
- snprintf(remattribute, BUFFERLEN, "rem %s=%s", key, Z_STRVAL_P(data));
- noinsert = 0;
- } else {
- snprintf(remattribute, BUFFERLEN, "rem %s", key);
- noinsert = 0;
- }
- break;
- case IS_ARRAY: {
- int i, len, keylen, count;
- char *strarr, *ptr, *ptr1;
- count = zend_hash_num_elements(Z_ARRVAL_P(data));
- if(count > 0) {
- strarr = make_objrec_from_array(Z_ARRVAL_P(data), ':');
- len = strlen(strarr) - 1;
- keylen = strlen(key);
- if(NULL == (ptr = malloc(len + 1 + count*(keylen+1+4)))) {
- if(modification)
- free(modification);
- RETURN_FALSE;
- }
- ptr1 = ptr;
- *ptr1 = '\0';
- strcpy(ptr1, "rem ");
- ptr1 += 4;
- strcpy(ptr1, key);
- ptr1 += keylen;
- *ptr1++ = '=';
- for(i=0; i<len; i++) {
- *ptr1++ = strarr[i];
- if(strarr[i] == '\n') {
- ptr1[-1] = '\\';
- strcpy(ptr1, "rem ");
- ptr1 += 4;
- strcpy(ptr1, key);
- ptr1 += keylen;
- *ptr1++ = '=';
- } /* else if(strarr[i] == '=')
- ptr1[-1] = ':'; */
- }
- *ptr1++ = '\n';
- *ptr1 = '\0';
- strlcpy(remattribute, ptr, sizeof(remattribute));
- noinsert = 0;
- }
- break;
- }
- }
- if(!noinsert) {
- modification = fnInsStr(modification, 0, "\\");
- modification = fnInsStr(modification, 0, remattribute);
- }
- zend_hash_move_forward(remobjarr);
- }
- }
-
- set_swap(ptr->swap_on);
- modification[strlen(modification)-1] = '\0';
- if(strlen(modification) == 0) {
- ptr->lasterror = 0;
- free(modification);
- RETURN_TRUE;
- }
-/* fprintf(stderr, "modifyobject: %s\n", modification); */
- switch(mode) {
- case 0:
- if (0 == (ptr->lasterror = send_lock(ptr->socket, id))) {
- if (0 == (ptr->lasterror = send_changeobject(ptr->socket, id, modification))) {
- if (0 != (ptr->lasterror = send_unlock(ptr->socket, id))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Aiii, Changeobject failed and couldn't unlock object (id = 0x%X)", id);
- free(modification);
- RETURN_FALSE;
- }
- free(modification);
- RETURN_FALSE;
- } else {
- send_unlock(ptr->socket, id);
- free(modification);
- RETURN_FALSE;
- }
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not lock object (id = 0x%X)", id);
- free(modification);
- RETURN_FALSE;
- }
- break;
- case 1:
-/* WARNING: send_groupchangobject() only works right, if each attribute
- can be modified. Doing a changeobject recursively often tries to
- modify objects which cannot be modified e.g. because an attribute cannot
- be removed. In such a case no further modification on that object is done.
- Doing a 'rem Rights\add Rights=R:a' will fail completely if the attribute
- Rights is not there already. The object locking is done in send_groupchangeobject();
-*/
- if (0 != (ptr->lasterror = send_groupchangeobject(ptr->socket, id, modification))) {
- free(modification);
- RETURN_FALSE;
- }
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Mode must be 0 or 1 (recursive)");
- }
- free(modification);
- RETURN_TRUE;
-}
-#undef BUFFERLEN
-/* }}} */
-
-/* {{{ php_hw_mvcp
- */
-void php_hw_mvcp(INTERNAL_FUNCTION_PARAMETERS, int mvcp) {
- zval **arg1, **arg2, **arg3, **arg4;
- int link, type, dest=0, from=0, count;
- HashTable *src_arr;
- hw_connection *ptr;
- int collIDcount, docIDcount, i, *docIDs, *collIDs;
-
- switch(mvcp) {
- case MOVE: /* Move also has fromID */
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case COPY:
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- }
- HW_FETCH_LINK(arg1);
- convert_to_array_ex(arg2);
- convert_to_long_ex(arg3);
- link=Z_LVAL_PP(arg1);
- src_arr=Z_ARRVAL_PP(arg2);
- switch(mvcp) {
- case MOVE: /* Move also has fromID, which is arg3 --> arg4 becomes destID */
- convert_to_long_ex(arg4);
- from=Z_LVAL_PP(arg3);
- dest=Z_LVAL_PP(arg4);
- break;
- case COPY: /* No fromID for Copy needed --> arg3 is destID */
- dest=Z_LVAL_PP(arg3);
- from = 0;
- break;
- }
-
- set_swap(ptr->swap_on);
-
- count = zend_hash_num_elements(src_arr);
- if(NULL == (collIDs = emalloc(count * sizeof(int)))) {
- RETURN_FALSE;
- }
-
- if(NULL == (docIDs = emalloc(count * sizeof(int)))) {
- efree(collIDs);
- RETURN_FALSE;
- }
-
- collIDcount = docIDcount = 0;
- zend_hash_internal_pointer_reset(src_arr);
- for(i=0; i<count; i++) {
- char *objrec;
- zval *keydata, **keydataptr;
- zend_hash_get_current_data(src_arr, (void **) &keydataptr);
- keydata = *keydataptr;
- if(Z_TYPE_P(keydata) == IS_LONG) {
- if(0 != (ptr->lasterror = send_getobject(ptr->socket, Z_LVAL_P(keydata), &objrec))) {
- efree(collIDs);
- efree(docIDs);
- RETURN_FALSE;
- }
- if(0 == fnAttributeCompare(objrec, "DocumentType", "collection"))
- collIDs[collIDcount++] = Z_LVAL_P(keydata);
- else
- docIDs[docIDcount++] = Z_LVAL_P(keydata);
- efree(objrec);
- }
- zend_hash_move_forward(src_arr);
- }
-
- if (0 != (ptr->lasterror = send_mvcpdocscoll(ptr->socket, docIDs, docIDcount, from, dest, mvcp))) {
- efree(collIDs);
- efree(docIDs);
- RETURN_FALSE;
- }
-
- if (0 != (ptr->lasterror = send_mvcpcollscoll(ptr->socket, collIDs, collIDcount, from, dest, mvcp))) {
- efree(collIDs);
- efree(docIDs);
- RETURN_FALSE;
- }
-
- efree(collIDs);
- efree(docIDs);
-
- RETURN_LONG(docIDcount + collIDcount);
-}
-/* }}} */
-
-/* {{{ proto void hw_mv(int link, array objrec, int from, int dest)
- Moves object */
-PHP_FUNCTION(hw_mv)
-{
- php_hw_mvcp(INTERNAL_FUNCTION_PARAM_PASSTHRU, MOVE);
-}
-/* }}} */
-
-/* {{{ proto void hw_cp(int link, array objrec, int dest)
- Copies object */
-PHP_FUNCTION(hw_cp)
-{
- php_hw_mvcp(INTERNAL_FUNCTION_PARAM_PASSTHRU, COPY);
-}
-/* }}} */
-
-/* {{{ proto hwdoc hw_gettext(int link, int objid [, int rootid])
- Returns text document. Links are relative to rootid if given */
-PHP_FUNCTION(hw_gettext)
-{
- zval **argv[3];
- int argc, link, id, type, mode;
- int rootid = 0;
- char *urlprefix;
- hw_document *doc;
- hw_connection *ptr;
-
- argc = ZEND_NUM_ARGS();
- if(argc > 3 || argc < 2 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- HW_FETCH_LINK(argv[0]);
- convert_to_long_ex(argv[1]);
- mode = 0;
- urlprefix = NULL;
- if(argc == 3) {
- switch(Z_TYPE_PP(argv[2])) {
- case IS_LONG:
- convert_to_long_ex(argv[2]);
- rootid = Z_LVAL_PP(argv[2]);
- mode = 1;
- break;
- case IS_STRING:
- convert_to_string_ex(argv[2]);
- urlprefix = Z_STRVAL_PP(argv[2]);
- break;
- }
- }
- id=Z_LVAL_PP(argv[1]);
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- char *attributes = NULL;
- char *bodytag = NULL;
- int count;
- /* !!!! memory for object and attributes is allocated with malloc !!!! */
- if (0 != (ptr->lasterror = send_gettext(ptr->socket, id, mode, rootid, &attributes, &bodytag, &object, &count, urlprefix)))
- RETURN_FALSE;
- doc = malloc(sizeof(hw_document));
- doc->data = object;
- doc->attributes = attributes;
- doc->bodytag = bodytag;
- doc->size = count;
- Z_LVAL_P(return_value) = zend_list_insert(doc, le_document);
- Z_TYPE_P(return_value) = IS_LONG;
- }
-}
-/* }}} */
-
-/* {{{ proto void hw_edittext(int link, hwdoc doc)
- Modifies text document */
-PHP_FUNCTION(hw_edittext)
-{
- zval **arg1, **arg2;
- int link, doc, type;
- hw_connection *ptr;
- hw_document *docptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
-
- doc=Z_LVAL_PP(arg2);
- docptr = zend_list_find(doc, &type);
-
- if(!docptr || (type!=le_document)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find document identifier %d", doc);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- if (0 != (ptr->lasterror = send_edittext(ptr->socket, docptr->attributes, docptr->data))) {
- RETURN_FALSE;
- }
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto hwdoc hw_getcgi(int link, int objid)
- Returns the output of a CGI script */
-#define BUFFERLEN 1000
-/* FIX ME: The buffer cgi_env_str should be allocated dynamically */
-PHP_FUNCTION(hw_getcgi)
-{
- zval **arg1, **arg2;
- int link, id, type;
- hw_document *doc;
- hw_connection *ptr;
- char cgi_env_str[BUFFERLEN];
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- char *attributes = NULL;
- int count;
-
- /* Here is another undocument function of Hyperwave.
- If you call a cgi script with getcgi-message, you will
- have to provide the complete cgi enviroment, since it is
- only known to the webserver (or wavemaster). This is done
- by extending the object record with the following incomplete
- string. It should contain any enviroment variable a cgi script
- requires.
- */
-#ifdef PHP_WIN32
- snprintf(cgi_env_str, BUFFERLEN, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
- getenv("REQUEST_METHOD"),
- getenv("PATH_INFO"),
- getenv("QUERY_STRING"));
-#else
- snprintf(cgi_env_str, BUFFERLEN, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
- SG(request_info).request_method,
- SG(request_info).request_uri,
- SG(request_info).query_string);
-#endif
- /* !!!! memory for object and attributes is allocated with malloc !!!! */
- if (0 != (ptr->lasterror = send_getcgi(ptr->socket, id, cgi_env_str, &attributes, &object, &count)))
- RETURN_FALSE;
- doc = malloc(sizeof(hw_document));
- doc->data = object;
- doc->attributes = attributes;
- doc->bodytag = NULL;
- doc->size = count;
- Z_LVAL_P(return_value) = zend_list_insert(doc, le_document);
- Z_TYPE_P(return_value) = IS_LONG;
- }
-}
-#undef BUFFERLEN
-/* }}} */
-
-/* {{{ proto int hw_getremote(int link, int objid)
- Returns the content of a remote document */
-PHP_FUNCTION(hw_getremote)
-{
- zval **arg1, **arg2;
- int link, id, type;
- hw_document *doc;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- char *attributes = NULL;
- int count;
- /* !!!! memory for object and attributes is allocated with malloc !!!! */
- if (0 != (ptr->lasterror = send_getremote(ptr->socket, id, &attributes, &object, &count)))
- RETURN_FALSE;
- doc = malloc(sizeof(hw_document));
- doc->data = object;
- doc->attributes = attributes;
- doc->bodytag = NULL;
- doc->size = count;
- Z_LVAL_P(return_value) = zend_list_insert(doc, le_document);
- Z_TYPE_P(return_value) = IS_LONG;
- }
-}
-/* }}} */
-
-/* {{{ proto [array|int] hw_getremotechildren(int link, string objrec)
- Returns the remote document or an array of object records */
-PHP_FUNCTION(hw_getremotechildren)
-{
- zval **arg1, **arg2;
- int link, type, i;
- hw_connection *ptr;
- char *objrec;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_string_ex(arg2);
- objrec=Z_STRVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- {
- int count, *offsets;
- char *remainder, *ptr1;
- if (0 != (ptr->lasterror = send_getremotechildren(ptr->socket, objrec, &remainder, &offsets, &count)))
- RETURN_FALSE;
-
-/*
-for(i=0;i<count;i++)
- php_printf("offset[%d] = %d--\n", i, offsets[i]);
-php_printf("count = %d, remainder = <HR>%s---<HR>", count, remainder);
-*/
- /* The remainder depends on the number of returned objects and
- whether the MimeType of the object to retrieve is set. If
- the MimeType is set the result will start with the
- HTTP header 'Content-type: mimetype', otherwise it will be
- a list of object records and therefore starts with
- 'ObjectID=0'. In the first case the offset and count are somewhat
- strange. Quite often count had a value of 6 which appears to be
- meaningless, but if you sum up the offsets you get the length
- of the remainder which is the lenght of the document.
- The document must have been chopped up into 6 pieces, each ending
- with 'ServerId=0xYYYYYYYY'.
- In the second case the offset contains the lenght of
- each object record; count contains the number of object records.
- Even if a remote object has children
- (several sql statements) but the MimeType is set, it will
- return a document in the format of MimeType. On the other
- hand a remote object does not have any children but just
- returns a docuement will not be shown unless the MimeType
- is set. It returns the pure object record of the object without
- the SQLStatement attribute. Quite senseless.
- Though, this behavior depends on how the hgi gateway in Hyperwave
- is implemented.
- */
- if(strncmp(remainder, "ObjectID=0 ", 10)) {
- hw_document *doc;
- char *ptr;
- int i, j, len;
- /* For some reason there is always the string
- 'SeverId=0xYYYYYYYY' at the end, so we cut it off.
- The document may as well be divided into several pieces
- and each of them has the ServerId at the end.
- The following will put the pieces back together and
- strip the ServerId. count contains the number of pieces.
- */
- for(i=0, len=0; i<count; i++)
- len += offsets[i]-18;
-/*fprintf(stderr, "len = %d\n", len); */
- doc = malloc(sizeof(hw_document));
- doc->data = malloc(len+1);
- ptr = doc->data;
- for(i=0, j=0; i<count; i++) {
- memcpy((char *)ptr, (char *)&remainder[j], offsets[i]-18);
-/*fprintf(stderr, "rem = %s\n", &remainder[j]); */
- j += offsets[i];
- ptr += offsets[i] - 18;
- }
- *ptr = '\0';
- doc->attributes = strdup(objrec);
- doc->bodytag = NULL;
- doc->size = strlen(doc->data);
- Z_LVAL_P(return_value) = zend_list_insert(doc, le_document);
- Z_TYPE_P(return_value) = IS_LONG;
- } else {
- array_init(return_value);
-
- ptr1 = remainder;
- for(i=0; i<count; i++) {
- *(ptr1+offsets[i]-1) = '\0';
- add_index_string(return_value, i, ptr1, 1);
- ptr1 += offsets[i];
- }
- }
-
- efree(offsets);
- efree(remainder);
- }
-}
-/* }}} */
-
-/* {{{ proto void hw_setlinkroot(int link, int rootid)
- Set the id to which links are calculated */
-PHP_FUNCTION(hw_setlinkroot)
-{
- zval **arg1, **arg2;
- int link, type, rootid;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- rootid = Z_LVAL_PP(arg2);
-
- ptr->linkroot = rootid;
- RETURN_LONG(rootid);
-}
-/* }}} */
-
-/* {{{ proto hwdoc hw_pipedocument(int link, int objid [, array urlprefixes])
- Returns document with links inserted. Optionally a array with five urlprefixes may be passed, which will be inserted for the different types of anchors. This should be a named array with the following keys: HW_DEFAULT_LINK, HW_IMAGE_LINK, HW_BACKGROUND_LINK, HW_INTAG_LINK, and HW_APPLET_LINK */
-PHP_FUNCTION(hw_pipedocument)
-{
- zval **arg1, **arg2, **arg3;
- int i, link, id, type, argc, mode;
- int rootid = 0;
- HashTable *prefixarray;
- char **urlprefix;
- hw_connection *ptr;
- hw_document *doc;
-#if APACHE
- server_rec *serv = ((request_rec *) SG(server_context))->server;
-#endif
-
- argc = ZEND_NUM_ARGS();
- switch(argc)
- {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
-
- id=Z_LVAL_PP(arg2);
-
- /* check for the array with urlprefixes */
- if(argc == 3) {
- convert_to_array_ex(arg3);
- prefixarray =Z_ARRVAL_PP(arg3);
- if((prefixarray == NULL) || (zend_hash_num_elements(prefixarray) != 5)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must provide 5 urlprefixes (you have provided %d)", zend_hash_num_elements(prefixarray));
- RETURN_FALSE;
- }
-
- urlprefix = emalloc(5*sizeof(char *));
- zend_hash_internal_pointer_reset(prefixarray);
- for(i=0; i<5; i++) {
- char *key;
- zval *data, **dataptr;
- ulong ind;
-
- zend_hash_get_current_key(prefixarray, &key, &ind, 0);
- zend_hash_get_current_data(prefixarray, (void *) &dataptr);
- data = *dataptr;
- if (Z_TYPE_P(data) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s must be a String", key);
- RETURN_FALSE;
- } else if ( strcmp(key, "HW_DEFAULT_LINK") == 0 ) {
- urlprefix[HW_DEFAULT_LINK] = Z_STRVAL_P(data);
- } else if ( strcmp(key, "HW_IMAGE_LINK") == 0 ) {
- urlprefix[HW_IMAGE_LINK] = Z_STRVAL_P(data);
- } else if ( strcmp(key, "HW_BACKGROUND_LINK") == 0 ) {
- urlprefix[HW_BACKGROUND_LINK] = Z_STRVAL_P(data);
- } else if ( strcmp(key, "HW_INTAG_LINK") == 0 ) {
- urlprefix[HW_INTAG_LINK] = Z_STRVAL_P(data);
- } else if ( strcmp(key, "HW_APPLET_LINK") == 0 ) {
- urlprefix[HW_APPLET_LINK] = Z_STRVAL_P(data);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a valid urlprefix", key);
- RETURN_FALSE;
- }
- zend_hash_move_forward(prefixarray);
- }
- } else {
- urlprefix = NULL;
- }
-
- mode = 0;
- if(ptr->linkroot > 0)
- mode = 1;
- rootid = ptr->linkroot;
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- char *attributes = NULL;
- char *bodytag = NULL;
- int count;
- /* !!!! memory for object, bodytag and attributes is allocated with malloc !!!! */
- if (0 != (ptr->lasterror = send_pipedocument(ptr->socket,
-#if APACHE
- serv->server_hostname,
-#else
- getenv("HOSTNAME"),
-#endif
- id, mode, rootid, &attributes, &bodytag, &object, &count, urlprefix)))
- RETURN_FALSE;
-
- if(urlprefix) efree(urlprefix);
-
- doc = malloc(sizeof(hw_document));
- doc->data = object;
- doc->attributes = attributes;
- doc->bodytag = bodytag;
- doc->size = count;
-/* fprintf(stderr, "size = %d\n", count); */
- Z_LVAL_P(return_value) = zend_list_insert(doc, le_document);
- Z_TYPE_P(return_value) = IS_LONG;
- }
-}
-/* }}} */
-
-/* {{{ proto hwdoc hw_pipedocument(int link, int objid)
- Returns document */
-PHP_FUNCTION(hw_oldpipedocument)
-{
- zval **argv[3];
- int link, id, type, argc, mode;
- int rootid = 0;
- hw_connection *ptr;
- hw_document *doc;
-#if APACHE
- server_rec *serv = ((request_rec *) SG(server_context))->server;
-#endif
-
- argc = ZEND_NUM_ARGS();
- if(argc != 2 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- HW_FETCH_LINK(argv[0]);
- convert_to_long_ex(argv[1]);
-/* if(argc == 3) {
- convert_to_long_ex(argv[2]);
- rootid = Z_LVAL_PP(argv[2]);
- if(rootid != 0)
- mode = 1;
- }
-*/
- id=Z_LVAL_PP(argv[1]);
-
- mode = 0;
- if(ptr->linkroot > 0)
- mode = 1;
- rootid = ptr->linkroot;
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- char *attributes = NULL;
- char *bodytag = NULL;
- int count;
- /* !!!! memory for object, bodytag and attributes is allocated with malloc !!!! */
- if (0 != (ptr->lasterror = send_pipedocument(ptr->socket,
-#if APACHE
- serv->server_hostname,
-#else
- getenv("HOSTNAME"),
-#endif
- id, mode, rootid, &attributes, &bodytag, &object, &count, NULL)))
- RETURN_FALSE;
-
- doc = malloc(sizeof(hw_document));
- doc->data = object;
- doc->attributes = attributes;
- doc->bodytag = bodytag;
- doc->size = count;
-/* fprintf(stderr, "size = %d\n", count); */
- Z_LVAL_P(return_value) = zend_list_insert(doc, le_document);
- Z_TYPE_P(return_value) = IS_LONG;
- }
-}
-/* }}} */
-
-/* {{{ proto hwdoc hw_pipecgi(int link, int objid)
- Returns output of CGI script */
-#define BUFFERLEN 1000
-/* FIX ME: The buffer cgi_env_str should be allocated dynamically */
-PHP_FUNCTION(hw_pipecgi)
-{
- zval **arg1, **arg2;
- int link, id, type;
- hw_connection *ptr;
- hw_document *doc;
- char cgi_env_str[1000];
-#if APACHE
- server_rec *serv = ((request_rec *) SG(server_context))->server;
-#endif
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- char *attributes = NULL;
- int count;
-
-#ifdef PHP_WIN32
- snprintf(cgi_env_str, BUFFERLEN, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
- getenv("REQUEST_METHOD"),
- getenv("PATH_INFO"),
- getenv("QUERY_STRING"));
-#else
- snprintf(cgi_env_str, BUFFERLEN, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
- SG(request_info).request_method,
- SG(request_info).request_uri,
- SG(request_info).query_string);
-#endif
- /* !!!! memory for object, bodytag and attributes is allocated with malloc !!!! */
- if (0 != (ptr->lasterror = send_pipecgi(ptr->socket,
-#if APACHE
- serv->server_hostname,
-#else
- getenv("HOSTNAME"),
-#endif
- id, cgi_env_str, &attributes, &object, &count)))
- RETURN_FALSE;
-
- doc = malloc(sizeof(hw_document));
- doc->data = object;
- doc->attributes = attributes;
- doc->bodytag = NULL;
- doc->size = count;
- Z_LVAL_P(return_value) = zend_list_insert(doc, le_document);
- Z_TYPE_P(return_value) = IS_LONG;
- }
-}
-#undef BUFFERLEN
-/* }}} */
-
-/* {{{ proto void hw_insertdocument(int link, int parentid, hwdoc doc)
- Insert new document */
-PHP_FUNCTION(hw_insertdocument)
-{
- zval **arg1, **arg2, **arg3;
- int link, id, doc, type;
- hw_connection *ptr;
- hw_document *docptr;
- hw_objectID objid;
-#if APACHE
- server_rec *serv = ((request_rec *) SG(server_context))->server;
-#endif
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
- id=Z_LVAL_PP(arg2);
-
- doc=Z_LVAL_PP(arg3);
- docptr = zend_list_find(doc, &type);
- if(!docptr || (type!=le_document)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find document identifier %d", doc);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- if (0 != (ptr->lasterror = send_putdocument(ptr->socket,
-#if APACHE
- serv->server_hostname,
-#else
- getenv("HOSTNAME"),
-#endif
- id, docptr->attributes, docptr->data, docptr->size, &objid))) {
- RETURN_FALSE;
- }
- }
- RETURN_LONG(objid);
-}
-/* }}} */
-
-/* {{{ proto hwdoc hw_new_document(string objrec, string data, int size)
- Create a new document */
-PHP_FUNCTION(hw_new_document)
-{
- zval **arg1, **arg2, **arg3;
- char *ptr;
- hw_document *doc;
-
- if (ZEND_NUM_ARGS() != 3 || (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
-
- doc = malloc(sizeof(hw_document));
- if(NULL == doc)
- RETURN_FALSE;
- doc->data = malloc(Z_LVAL_PP(arg3)+1);
- if(NULL == doc->data) {
- free(doc);
- RETURN_FALSE;
- }
- memcpy(doc->data, Z_STRVAL_PP(arg2), Z_LVAL_PP(arg3));
- ptr = doc->data;
- ptr[Z_LVAL_PP(arg3)] = '\0';
- doc->attributes = strdup(Z_STRVAL_PP(arg1));
- doc->bodytag = NULL;
- doc->size = Z_LVAL_PP(arg3);
- Z_LVAL_P(return_value) = zend_list_insert(doc, le_document);
- Z_TYPE_P(return_value) = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto hwdoc hw_new_document_from_file(string objrec, string filename)
- Create a new document from a file */
-PHP_FUNCTION(hw_new_document_from_file)
-{
- pval **arg1, **arg2;
- char *ptr;
- php_stream *stream;
- int use_include_path=0;
- hw_document *doc;
-
- if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
-
- stream = php_stream_open_wrapper(Z_STRVAL_PP(arg2), "r", use_include_path|ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
-
- if (stream == NULL) {
- RETURN_FALSE;
- }
-
- doc = malloc(sizeof(hw_document));
- if(NULL == doc)
- RETURN_FALSE;
-
- doc->size = php_stream_copy_to_mem(stream, &doc->data, PHP_STREAM_COPY_ALL, 1);
-
- php_stream_close(stream);
-
- /* I'm not sure if it is necessary to add a '\0'. It depends on whether
- * PHP-Strings has to be null terminated. doc->size doesn't count the
- * '\0'.
- */
- doc->data = realloc(doc->data, doc->size+1);
- ptr = doc->data;
- ptr[doc->size] = '\0';
- doc->attributes = strdup(Z_STRVAL_PP(arg1));
- doc->bodytag = NULL;
- Z_LVAL_P(return_value) = zend_list_insert(doc, le_document);
- Z_TYPE_P(return_value) = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto void hw_free_document(hwdoc doc)
- Frees memory of document */
-PHP_FUNCTION(hw_free_document)
-{
- zval **arg1;
- int id, type;
- hw_document *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_ID(arg1);
- zend_list_delete(id);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void hw_outputdocument(hwdoc doc)
- An alias for hw_output_document */
-/* }}} */
-
-/* {{{ proto void hw_output_document(hwdoc doc)
- Prints document */
-PHP_FUNCTION(hw_output_document)
-{
- zval **arg1;
- int id, type;
- hw_document *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_ID(arg1);
-
- php_write(ptr->data, ptr->size TSRMLS_CC);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string hw_documentbodytag(hwdoc doc [, string prefix])
- An alias for hw_document_bodytag */
-/* }}} */
-
-/* {{{ proto string hw_document_bodytag(hwdoc doc [, string prefix])
- Return bodytag prefixed by prefix */
-PHP_FUNCTION(hw_document_bodytag)
-{
- zval **argv[2];
- int id, type, argc;
- hw_document *ptr;
- char *temp, *str = NULL;
-
- argc = ZEND_NUM_ARGS();
- if(argc > 2 || argc < 1 || (zend_get_parameters_array_ex(argc, argv) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- HW_FETCH_ID(argv[0]);
-
- if(argc == 2) {
- convert_to_string_ex(argv[1]);
- str=Z_STRVAL_PP(argv[1]);
- }
-
- if(str != NULL) {
- temp = emalloc(Z_STRLEN_PP(argv[1]) + strlen(ptr->bodytag) + 2);
- strcpy(temp, ptr->bodytag);
- strcpy(temp+strlen(ptr->bodytag)-1, str);
- strcpy(temp+strlen(ptr->bodytag)-1+Z_STRLEN_PP(argv[1]), ">\n");
- RETURN_STRING(temp, 0);
- } else {
-/* fprintf(stderr, "hw_document_bodytag: %s (%s)\n", ptr->bodytag, ptr->attributes); */
- if(ptr->bodytag) {
- RETURN_STRING(ptr->bodytag, 1);
- } else {
- RETURN_EMPTY_STRING();
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string hw_document_content(hwdoc doc)
- Returns content of document */
-PHP_FUNCTION(hw_document_content)
-{
- zval **arg1;
- int id, type;
- hw_document *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &arg1) == FAILURE)) {
- RETURN_FALSE;
- }
-
- HW_FETCH_ID(arg1);
-
- RETURN_STRINGL(ptr->data, ptr->size, 1);
-}
-/* }}} */
-
-/* {{{ proto int hw_document_setcontent(hwdoc doc, string content)
- Sets/replaces content of document */
-PHP_FUNCTION(hw_document_setcontent)
-{
- zval **arg1, **arg2;
- int id, type;
- hw_document *ptr;
- char *str;
-
- if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- HW_FETCH_ID(arg1);
- convert_to_string_ex(arg2);
-
- str = ptr->data;
- if(NULL != (ptr->data = strdup(Z_STRVAL_PP(arg2)))) {
- ptr->size = strlen(ptr->data);
- free(str);
- RETURN_TRUE;
- } else {
- ptr->data = str;
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int hw_documentsize(hwdoc doc)
- An alias for hw_document_size */
-/* }}} */
-
-/* {{{ proto int hw_document_size(hwdoc doc)
- Returns size of document */
-PHP_FUNCTION(hw_document_size)
-{
- zval **arg1;
- int id, type;
- hw_document *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_ID(arg1);
-
- RETURN_LONG(ptr->size);
-}
-/* }}} */
-
-/* {{{ proto string hw_documentattributes(hwdoc doc)
- An alias for hw_document_attributes */
-/* }}} */
-
-/* {{{ proto string hw_document_attributes(hwdoc doc)
- Returns object record of document */
-PHP_FUNCTION(hw_document_attributes)
-{
- zval **arg1;
- int id, type;
- hw_document *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_ID(arg1);
-
- RETURN_STRING(ptr->attributes, 1);
-/* make_return_array_from_objrec(&return_value, ptr->attributes); */
-}
-/* }}} */
-
-/* {{{ proto array hw_getparentsobj(int link, int objid)
- Returns array of parent object records */
-PHP_FUNCTION(hw_getparentsobj)
-{
- zval **arg1, **arg2;
- int link, id, type;
- int count;
- char **childObjRecs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
-
- if (0 != (ptr->lasterror = send_getparentsobj(ptr->socket, id, &childObjRecs, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array hw_getparents(int link, int objid)
- Returns array of parent object ids */
-PHP_FUNCTION(hw_getparents)
-{
- zval **arg1, **arg2;
- int link, id, type;
- int count;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- {
- int *childIDs = NULL;
- int i;
-
- if (0 != (ptr->lasterror = send_getparents(ptr->socket, id, &childIDs, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- for(i=0; i<count; i++) {
- add_index_long(return_value, i, childIDs[i]);
- }
- efree(childIDs);
- }
-
-}
-/* }}} */
-
-/* {{{ proto array hw_children(int link, int objid)
- Returns array of children object ids */
-PHP_FUNCTION(hw_children)
-{
- zval **arg1, **arg2;
- int link, id, type;
- int count;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- {
- int *childIDs = NULL;
- int i;
-
- if (0 != (ptr->lasterror = send_children(ptr->socket, id, &childIDs, &count))){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- for(i=0; i<count; i++) {
- add_index_long(return_value, i, childIDs[i]);
- }
- efree(childIDs);
- }
-
-}
-/* }}} */
-
-/* {{{ proto array hw_childrenobj(int link, int objid)
- Returns array of children object records */
-PHP_FUNCTION(hw_childrenobj)
-{
- pval **arg1, **arg2;
- int link, id, type;
- int count;
- char **childObjRecs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
-
- if (0 != (ptr->lasterror = send_childrenobj(ptr->socket, id, &childObjRecs, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array hw_getchildcoll(int link, int objid)
- Returns array of child collection object ids */
-PHP_FUNCTION(hw_getchildcoll)
-{
- pval **arg1, **arg2;
- int link, id, type;
- int count;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- {
- int *childIDs = NULL;
- int i;
-
- if (0 != (ptr->lasterror = send_getchildcoll(ptr->socket, id, &childIDs, &count))){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- for(i=0; i<count; i++) {
- add_index_long(return_value, i, childIDs[i]);
- }
- efree(childIDs);
- }
-
-}
-/* }}} */
-
-/* {{{ proto array hw_getchildcollobj(int link, int objid)
- Returns array of child collection object records */
-PHP_FUNCTION(hw_getchildcollobj)
-{
- pval **arg1, **arg2;
- int link, id, type;
- int count;
- char **childObjRecs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
-
- if (0 != (ptr->lasterror = send_getchildcollobj(ptr->socket, id, &childObjRecs, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int hw_docbyanchor(int link, int anchorid)
- Returns objid of document belonging to anchorid */
-PHP_FUNCTION(hw_docbyanchor)
-{
- pval **arg1, **arg2;
- int link, id, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- {
- int objectID;
- if (0 != (ptr->lasterror = send_docbyanchor(ptr->socket, id, &objectID)))
- RETURN_FALSE;
-
- RETURN_LONG(objectID);
- }
-}
-/* }}} */
-
-/* {{{ proto array hw_docbyanchorobj(int link, int anchorid)
- Returns object record of document belonging to anchorid */
-PHP_FUNCTION(hw_docbyanchorobj)
-{
- pval **arg1, **arg2;
- int link, id, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- if (0 != (ptr->lasterror = send_docbyanchorobj(ptr->socket, id, &object)))
- RETURN_FALSE;
-
- RETURN_STRING(object, 0);
- /*
- make_return_array_from_objrec(&return_value, object);
- efree(object);
- */
- }
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyquery(int link, string query, int maxhits)
- Search for query and return maxhits objids */
-PHP_FUNCTION(hw_getobjectbyquery)
-{
- pval **arg1, **arg2, **arg3;
- int link, type, maxhits;
- char *query;
- int count, i;
- int *childIDs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- query=Z_STRVAL_PP(arg2);
- maxhits=Z_LVAL_PP(arg3);
- if (maxhits < 0) maxhits=0x7FFFFFFF;
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyquery(ptr->socket, query, maxhits, &childIDs, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- for(i=0; i<count; i++)
- add_index_long(return_value, i, childIDs[i]);
- efree(childIDs);
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyqueryobj(int link, string query, int maxhits)
- Search for query and return maxhits object records */
-PHP_FUNCTION(hw_getobjectbyqueryobj)
-{
- pval **arg1, **arg2, **arg3;
- int link, type, maxhits;
- char *query;
- int count;
- char **childObjRecs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- query=Z_STRVAL_PP(arg2);
- maxhits=Z_LVAL_PP(arg3);
- if (maxhits < 0) maxhits=0x7FFFFFFF;
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyqueryobj(ptr->socket, query, maxhits, &childObjRecs, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyquerycoll(int link, int collid, string query, int maxhits)
- Search for query in collection and return maxhits objids */
-PHP_FUNCTION(hw_getobjectbyquerycoll)
-{
- pval **arg1, **arg2, **arg3, **arg4;
- int link, id, type, maxhits;
- char *query;
- int count, i;
- hw_connection *ptr;
- int *childIDs = NULL;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- id=Z_LVAL_PP(arg2);
- query=Z_STRVAL_PP(arg3);
- maxhits=Z_LVAL_PP(arg4);
- if (maxhits < 0) maxhits=0x7FFFFFFF;
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyquerycoll(ptr->socket, id, query, maxhits, &childIDs, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- for(i=0; i<count; i++)
- add_index_long(return_value, i, childIDs[i]);
- efree(childIDs);
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyquerycollobj(int link, int collid, string query, int maxhits)
- Search for query in collection and return maxhits object records */
-PHP_FUNCTION(hw_getobjectbyquerycollobj)
-{
- pval **arg1, **arg2, **arg3, **arg4;
- int link, id, type, maxhits;
- char *query;
- int count;
- hw_connection *ptr;
- char **childObjRecs = NULL;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- id=Z_LVAL_PP(arg2);
- query=Z_STRVAL_PP(arg3);
- maxhits=Z_LVAL_PP(arg4);
- if (maxhits < 0) maxhits=0x7FFFFFFF;
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyquerycollobj(ptr->socket, id, query, maxhits, &childObjRecs, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyftquery(int link, string query, int maxhits)
- Search for query as fulltext and return maxhits objids */
-PHP_FUNCTION(hw_getobjectbyftquery)
-{
- pval **arg1, **arg2, **arg3;
- int link, type, maxhits;
- char *query;
- int count, i;
- int *childIDs = NULL;
- float *weights;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- query=Z_STRVAL_PP(arg2);
- maxhits=Z_LVAL_PP(arg3);
- if (maxhits < 0) maxhits=0x7FFFFFFF;
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyftquery(ptr->socket, query, maxhits, &childIDs, &weights, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- array_init(return_value) ;
-
- for(i=0; i<count; i++)
- add_index_long(return_value, i, childIDs[i]);
- efree(childIDs);
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyftqueryobj(int link, string query, int maxhits)
- Search for query as fulltext and return maxhits object records */
-PHP_FUNCTION(hw_getobjectbyftqueryobj)
-{
- pval **arg1, **arg2, **arg3;
- int link, type, maxhits;
- char *query;
- int count;
- char **childObjRecs = NULL;
- float *weights;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- query=Z_STRVAL_PP(arg2);
- maxhits=Z_LVAL_PP(arg3);
- if (maxhits < 0) maxhits=0x7FFFFFFF;
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyftqueryobj(ptr->socket, query, maxhits, &childObjRecs, &weights, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyftquerycoll(int link, int collid, string query, int maxhits)
- Search for fulltext query in collection and return maxhits objids */
-PHP_FUNCTION(hw_getobjectbyftquerycoll)
-{
- pval **arg1, **arg2, **arg3, **arg4;
- int link, id, type, maxhits;
- char *query;
- int count, i;
- hw_connection *ptr;
- int *childIDs = NULL;
- float *weights;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- id=Z_LVAL_PP(arg2);
- query=Z_STRVAL_PP(arg3);
- maxhits=Z_LVAL_PP(arg4);
- if (maxhits < 0) maxhits=0x7FFFFFFF;
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyftquerycoll(ptr->socket, id, query, maxhits, &childIDs, &weights, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- for(i=0; i<count; i++)
- add_index_long(return_value, i, childIDs[i]);
- efree(childIDs);
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyftquerycollobj(int link, int collid, string query, int maxhits)
- Search for fulltext query in collection and return maxhits object records */
-PHP_FUNCTION(hw_getobjectbyftquerycollobj)
-{
- pval **arg1, **arg2, **arg3, **arg4;
- int link, id, type, maxhits;
- char *query;
- int count;
- hw_connection *ptr;
- char **childObjRecs = NULL;
- float *weights;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- id=Z_LVAL_PP(arg2);
- query=Z_STRVAL_PP(arg3);
- maxhits=Z_LVAL_PP(arg4);
- if (maxhits < 0) maxhits=0x7FFFFFFF;
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyftquerycollobj(ptr->socket, id, query, maxhits, &childObjRecs, &weights, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array hw_getchilddoccoll(int link, int objid)
- Returns all children ids which are documents */
-PHP_FUNCTION(hw_getchilddoccoll)
-{
- pval **arg1, **arg2;
- int link, id, type;
- int count, i;
- int *childIDs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getchilddoccoll(ptr->socket, id, &childIDs, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- for(i=0; i<count; i++)
- add_index_long(return_value, i, childIDs[i]);
- efree(childIDs);
-}
-/* }}} */
-
-/* {{{ proto array hw_getchilddoccollobj(int link, int objid)
- Returns all children object records which are documents */
-PHP_FUNCTION(hw_getchilddoccollobj)
-{
- pval **arg1, **arg2;
- int link, id, type;
- int count;
- char **childObjRecs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getchilddoccollobj(ptr->socket, id, &childObjRecs, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-
-}
-/* }}} */
-
-/* {{{ proto array hw_getanchors(int link, int objid)
- Return all anchors of object */
-PHP_FUNCTION(hw_getanchors)
-{
- pval **arg1, **arg2;
- int link, id, type;
- int count, i;
- int *anchorIDs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getanchors(ptr->socket, id, &anchorIDs, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- for(i=0; i<count; i++)
- add_index_long(return_value, i, anchorIDs[i]);
- efree(anchorIDs);
-}
-/* }}} */
-
-/* {{{ proto array hw_getanchorsobj(int link, int objid)
- Return all object records of anchors of object */
-PHP_FUNCTION(hw_getanchorsobj)
-{
- pval **arg1, **arg2;
- int link, id, type;
- int count;
- char **anchorObjRecs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getanchorsobj(ptr->socket, id, &anchorObjRecs, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, anchorObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string hw_getusername(int link)
- Returns the current user name */
-PHP_FUNCTION(hw_getusername)
-{
- pval **arg1;
- int link, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
-
- Z_STRVAL_P(return_value) = estrdup(ptr->username);
- Z_STRLEN_P(return_value) = strlen(ptr->username);
- Z_TYPE_P(return_value) = IS_STRING;
-}
-/* }}} */
-
-/* {{{ proto void hw_identify(int link, string username, string password)
- Identifies at Hyperwave server */
-PHP_FUNCTION(hw_identify)
-{
- pval **arg1, **arg2, **arg3;
- int link, type;
- char *name, *passwd, *userdata;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- name=Z_STRVAL_PP(arg2);
- passwd=Z_STRVAL_PP(arg3);
-
- set_swap(ptr->swap_on);
- {
- char *str;
-
- if (0 != (ptr->lasterror = send_identify(ptr->socket, name, passwd, &userdata))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d\n", ptr->lasterror);
- if(ptr->username) free(ptr->username);
- ptr->username = NULL;
- RETURN_FALSE;
- }
-
- Z_STRVAL_P(return_value) = userdata;
- Z_STRLEN_P(return_value) = strlen(userdata);
- Z_TYPE_P(return_value) = IS_STRING;
- if(ptr->username) free(ptr->username);
- str = userdata;
- while((*str != 0) && (*str != ' '))
- str++;
- if(*str != '\0')
- ptr->username = strdup(++str);
- else
- ptr->username = NULL;
- }
-}
-/* }}} */
-
-/* {{{ proto array hw_objrec2array(string objrec, [array format])
- Returns object array of object record */
-PHP_FUNCTION(hw_objrec2array)
-{
- zval **arg1, **arg2;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if(zend_get_parameters_ex(1, &arg1) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_string_ex(arg1);
- make2_return_array_from_objrec(&return_value, Z_STRVAL_PP(arg1), NULL);
- break;
- case 2:
- if(zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_array_ex(arg2);
- convert_to_string_ex(arg1);
- make2_return_array_from_objrec(&return_value, Z_STRVAL_PP(arg1), *arg2);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-/* {{{ proto string hw_array2objrec(array objarr)
- Returns object record of object array */
-PHP_FUNCTION(hw_array2objrec)
-{
- pval **arg1;
- char *objrec, *retobj;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
- objrec = make_objrec_from_array(Z_ARRVAL_PP(arg1), '=');
- if(objrec) {
- retobj = estrdup(objrec);
- free(objrec);
- RETURN_STRING(retobj, 0);
- } else
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array hw_incollections(int link, array objids, array collids, int para)
- Returns object ids which are in collections */
-PHP_FUNCTION(hw_incollections)
-{
- pval **arg1, **arg2, **arg3, **arg4;
- int type, link, i;
- hw_connection *ptr;
- int cobjids, ccollids, *objectIDs, *collIDs, cretids, *retIDs, retcoll;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_array_ex(arg2);
- convert_to_array_ex(arg3);
- convert_to_long_ex(arg4);
- retcoll=Z_LVAL_PP(arg4);
-
- cobjids = zend_hash_num_elements(Z_ARRVAL_PP(arg2));
- if(NULL == (objectIDs = make_ints_from_array(Z_ARRVAL_PP(arg2)))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create Int Array from Array");
- RETURN_FALSE;
- }
-
- ccollids = zend_hash_num_elements(Z_ARRVAL_PP(arg3));
- if(NULL == (collIDs = make_ints_from_array(Z_ARRVAL_PP(arg3)))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create Int Array from Array");
- efree(objectIDs);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_incollections(ptr->socket, retcoll,
- cobjids, objectIDs,
- ccollids, collIDs,
- &cretids, &retIDs))) {
- if(objectIDs) efree(objectIDs);
- if(collIDs) efree(collIDs);
- RETURN_FALSE;
- }
-
- if(objectIDs) efree(objectIDs);
- if(collIDs) efree(collIDs);
-
- array_init(return_value);
-
- for(i=0; i<cretids; i++)
- add_index_long(return_value, i, retIDs[i]);
- efree(retIDs);
-
-}
-/* }}} */
-
-/* {{{ proto void hw_inscoll(int link, int parentid, array objarr)
- Inserts collection */
-PHP_FUNCTION(hw_inscoll)
-{
- pval **arg1, **arg2, **arg3;
- char *objrec;
- int id, newid, type, link;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- convert_to_array_ex(arg3);
- id=Z_LVAL_PP(arg2);
-
- if(NULL == (objrec = make_objrec_from_array(Z_ARRVAL_PP(arg3), '='))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create Object Record from Array");
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_inscoll(ptr->socket, id, objrec, &newid))) {
- if(objrec) free(objrec);
- RETURN_FALSE;
- }
-
- if(objrec) free(objrec);
- RETURN_LONG(newid);
-}
-/* }}} */
-
-/* {{{ proto void hw_insdoc(int link, int parentid, string objrec [, string text])
- Inserts document */
-PHP_FUNCTION(hw_insdoc)
-{
- zval **argv[4];
- char *objrec, *text;
- int id, newid, type, link, argc;
- hw_connection *ptr;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 3) || (argc > 4))
- WRONG_PARAM_COUNT;
-
- if (zend_get_parameters_array_ex(argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- HW_FETCH_LINK(argv[0]);
- convert_to_long_ex(argv[1]);
- convert_to_string_ex(argv[2]);
- if(argc == 4) {
- convert_to_string_ex(argv[3]);
- text = Z_STRVAL_PP(argv[3]);
- } else {
- text = NULL;
- }
- id = Z_LVAL_PP(argv[1]);
-
- set_swap(ptr->swap_on);
- objrec = Z_STRVAL_PP(argv[2]);
- if (0 != (ptr->lasterror = send_insdoc(ptr->socket, id, objrec, text, &newid))) {
- RETURN_FALSE;
- }
-
- RETURN_LONG(newid);
-}
-/* }}} */
-
-/* {{{ proto int hw_getsrcbydestobj(int link, int destid)
- Returns object id of source docuent by destination anchor */
-PHP_FUNCTION(hw_getsrcbydestobj)
-{
- pval **arg1, **arg2;
- int link, type, id;
- int count;
- char **childObjRecs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- id=Z_LVAL_PP(arg2);
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getsrcbydest(ptr->socket, id, &childObjRecs, &count))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int hw_mapid(int link, int serverid, int destid)
- Returns virtual object id of document on remote Hyperwave server */
-PHP_FUNCTION(hw_mapid)
-{
- pval **arg1, **arg2, **arg3;
- int link, type, servid, id, virtid;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
- servid=Z_LVAL_PP(arg2);
- id=Z_LVAL_PP(arg3);
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_mapid(ptr->socket, servid, id, &virtid))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d", ptr->lasterror);
- RETURN_FALSE;
- }
- RETURN_LONG(virtid);
-}
-/* }}} */
-
-/* {{{ proto string hw_getrellink(int link, int rootid, int sourceid, int destid)
- Get link from source to dest relative to rootid */
-PHP_FUNCTION(hw_getrellink)
-{
- pval **arg1, **arg2, **arg3, **arg4;
- int link, type;
- int rootid, destid, sourceid;
- char *anchorstr;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
- convert_to_long_ex(arg4);
- rootid=Z_LVAL_PP(arg2);
- sourceid=Z_LVAL_PP(arg3);
- destid=Z_LVAL_PP(arg4);
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = getrellink(ptr->socket, rootid, sourceid, destid, &anchorstr))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d", ptr->lasterror);
- RETURN_FALSE;
- }
-
- RETURN_STRING(anchorstr, 0);
-}
-/* }}} */
-
-/* {{{ proto string hw_insertanchors(int hwdoc, array anchorecs, array dest [, array urlprefixes])
- Inserts only anchors into text */
-PHP_FUNCTION(hw_insertanchors)
-{
- pval **arg1, **arg2, **arg3, **arg4;
- hw_document *hwdoc;
- int type, docid, error, argc, count;
- char **anchorrecs;
- char **dest;
- char **urlprefix;
- char *bodytag = NULL;
- HashTable *arrht;
- HashTable *prefixarray;
-
- argc = ZEND_NUM_ARGS();
- switch(argc)
- {
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg1);
- convert_to_array_ex(arg2);
- convert_to_array_ex(arg3);
- docid=Z_LVAL_PP(arg1);
- hwdoc = zend_list_find(docid, &type);
- if(!hwdoc || (type!=le_document)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find file identifier %d", docid);
- RETURN_FALSE;
- }
-
- /* check for the array with urlprefixes */
- if(argc == 4) {
- int i;
- convert_to_array_ex(arg4);
- prefixarray =Z_ARRVAL_PP(arg4);
- if((prefixarray == NULL) || (zend_hash_num_elements(prefixarray) != 5)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must provide 5 urlprefixes (you have provided %d)", zend_hash_num_elements(prefixarray));
- RETURN_FALSE;
- }
-
- urlprefix = emalloc(5*sizeof(char *));
- zend_hash_internal_pointer_reset(prefixarray);
- for(i=0; i<5; i++) {
- char *key;
- zval *data, **dataptr;
- ulong ind;
-
- zend_hash_get_current_key(prefixarray, &key, &ind, 0);
- zend_hash_get_current_data(prefixarray, (void *) &dataptr);
- data = *dataptr;
- if (Z_TYPE_P(data) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s must be a String", key);
- RETURN_FALSE;
- } else if ( strcmp(key, "HW_DEFAULT_LINK") == 0 ) {
- urlprefix[HW_DEFAULT_LINK] = Z_STRVAL_P(data);
- } else if ( strcmp(key, "HW_IMAGE_LINK") == 0 ) {
- urlprefix[HW_IMAGE_LINK] = Z_STRVAL_P(data);
- } else if ( strcmp(key, "HW_BACKGROUND_LINK") == 0 ) {
- urlprefix[HW_BACKGROUND_LINK] = Z_STRVAL_P(data);
- } else if ( strcmp(key, "HW_INTAG_LINK") == 0 ) {
- urlprefix[HW_INTAG_LINK] = Z_STRVAL_P(data);
- } else if ( strcmp(key, "HW_APPLET_LINK") == 0 ) {
- urlprefix[HW_APPLET_LINK] = Z_STRVAL_P(data);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a valid urlprefix", key);
- RETURN_FALSE;
- }
- zend_hash_move_forward(prefixarray);
- }
- } else {
- urlprefix = NULL;
- }
-
- if(zend_hash_num_elements(Z_ARRVAL_PP(arg2)) != zend_hash_num_elements(Z_ARRVAL_PP(arg3))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unequal number of elements in arrays");
- RETURN_FALSE;
- }
-
- /* Turn PHP-Array of strings into C-Array of strings */
- arrht = Z_ARRVAL_PP(arg2);
- anchorrecs = make_strs_from_array(arrht);
- arrht = Z_ARRVAL_PP(arg3);
- dest = make_strs_from_array(arrht);
-
- if (0 != (error = send_insertanchors(&(hwdoc->data), &count, anchorrecs, dest, zend_hash_num_elements(arrht), urlprefix, &bodytag))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Command returned %d", error);
- RETURN_FALSE;
- }
-/*fprintf(stderr, "in hw_insertanchors: %s\n", hwdoc->attributes); */
- hwdoc->size = count;
- if(hwdoc->bodytag) free (hwdoc->bodytag);
- hwdoc->bodytag = bodytag;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-
-PHP_MINFO_FUNCTION(hw)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Hyperwave Support", "enabled");
- php_info_print_table_row(2, "HG-CSP Version", "7.17");
- php_info_print_table_end();
- DISPLAY_INI_ENTRIES();
-}
-
-/* {{{ proto void hw_connection_info(int link)
- Prints information about the connection to Hyperwave server */
-PHP_FUNCTION(hw_connection_info)
-{
- pval **arg1;
- hw_connection *ptr;
- int link, type;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- HW_FETCH_LINK(arg1);
-
- php_printf("Hyperwave Info:\nhost=%s,\nserver string=%s\nversion=%d\nswap=%d\n", ptr->hostname, ptr->server_string, ptr->version, ptr->swap_on);
-}
-/* }}} */
-
-void print_msg(hg_msg *msg, char *str, int txt)
-{
- char *ptr;
- int i;
-
- fprintf(stdout, "\nprint_msg: >>%s<<\n", str);
- fprintf(stdout, "print_msg: length = %d\n", msg->length);
- fprintf(stdout, "print_msg: msgid = %d\n", msg->version_msgid);
- fprintf(stdout, "print_msg: msg_type = %d\n", msg->msg_type);
- if ( msg->length > HEADER_LENGTH ) {
- ptr = msg->buf;
- for ( i = 0; i < msg->length-HEADER_LENGTH; i++ ) {
- if ( *ptr == '\n' )
- fprintf(stdout, "%c", *ptr++);
- else if ( iscntrl(*ptr) )
- {fprintf(stdout, "."); ptr++;}
- else
- fprintf(stdout, "%c", *ptr++);
- }
- }
- fprintf(stdout, "\n\n");
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/hyperwave/hw_error.h b/ext/hyperwave/hw_error.h
deleted file mode 100644
index 41a9831084..0000000000
--- a/ext/hyperwave/hw_error.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef HW_ERROR_H
-#define HW_ERROR_H
-
-#if HYPERWAVE
-
-#define NOACCESS 1 /* Access denied */
-#define NODOCS 2 /* No documents */
-#define NONAME 3 /* No collection name */
-#define NODOC 4 /* Object is not a document */
-#define NOOBJ 5 /* No object received */
-#define NOCOLLS 6 /* No collections received */
-#define DBSTUBNG 7 /* Connection to low-level database failed */
-#define NOTFOUND 8 /* Object not found */
-#define EXIST 9 /* Collection already exists */
-#define FATHERDEL 10 /* parent collection disappeared */
-#define FATHNOCOLL 11 /* parent collection not a collection */
-#define NOTEMPTY 12 /* Collection not empty */
-#define DESTNOCOLL 13 /* Destination not a collection */
-#define SRCEQDEST 14 /* Source equals destination */
-#define REQPEND 15 /* Request pending */
-#define TIMEOUT 16 /* Timeout */
-#define NAMENOTUNIQUE 17 /* Name not unique */
-#define WRITESTOPPED 18 /* Database now read-only; try again later */
-#define LOCKED 19 /* Object locked; try again later */
-#define CHANGEBASEFLD 20 /* Change of base-attribute */
-#define NOTREMOVED 21 /* Attribute not removed */
-#define FLDEXISTS 22 /* Attribute exists */
-#define CMDSYNTAX 23 /* Syntax error in command */
-#define NOLANGUAGE 24 /* No or unknown language specified */
-#define WRGTYPE 25 /* Wrong type in object */
-#define WRGVERSION 26 /* Client version too old */
-#define CONNECTION 27 /* No connection to other server */
-#define SYNC 28 /* Synchronization error */
-#define NOPATH 29 /* No path entry */
-#define WRGPATH 30 /* Wrong path entry */
-#define PASSWD 31 /* Wrong password (server-to-server server authentication) */
-#define LC_NO_MORE_USERS 32 /* No more users for license */
-#define LC_NO_MORE_DOCS 33 /* No more documents for this session and license */
-#define RSERV_NRESP 34 /* Remote server not responding */
-#define Q_OVERFLOW 35 /* Query overflow */
-#define USR_BREAK 36 /* Break by user */
-#define N_IMPL 37 /* Not implemented */
-#define WRG_VALUE 38 /* Wrong value */
-#define INSUFF_FUNDS 39 /* Insufficient funds */
-#define REORG 40 /* Reorganization in progress */
-#define USER_LIMIT 41 /* Limit of simultaneous users reached */
-#define FTCONNECT 513 /* No connection to fulltext server */
-#define FTTIMEOUT 514 /* Connection timed out */
-#define FTINDEX 515 /* Something wrong with fulltext index */
-#define FTSYNTAX 516 /* Query syntax error */
-#define REQUESTPENDING 1025 /* Request pending */
-#define NOCONNECTION 1026 /* No connection to document server */
-#define WRONGVERSION 1027 /* Wrong protocol version */
-#define NOTINITIALIZED 1028 /* Not initialized */
-#define BADREQUEST 1029 /* Bad request */
-#define BADLRN 1030 /* Bad document number */
-#define OPENSTORE_WRITE 1031 /* Cannot write to local store */
-#define OPENSTORE_READ 1032 /* Cannot read from local store */
-#define READSTORE 1033 /* Store read error */
-#define WRITESTORE 1034 /* Write error */
-#define CLOSESTORE 1035 /* Close error */
-#define BADPATH 1036 /* Bad path */
-#define NOPATHDC 1037 /* No path */
-#define OPENFILE 1038 /* Cannot open file */
-#define READFILE 1039 /* Cannot read from file // same */
-#define WRITEFILE 1040 /* Cannot write to file */
-#define CONNECTCLIENT 1041 /* Could not connect to client */
-#define ACCEPT 1042 /* Could not accept connection */
-#define READSOCKET 1043 /* Could not read from socket */
-#define WRITESOCKET 1044 /* Could not write to socket */
-#define TOOMUCHDATA 1046 /* Received too much data */
-#define TOOFEWDATA 1047 /* Received too few data // ... */
-#define NOTIMPLEMENTED 1049 /* Not implemented */
-#define USERBREAK 1050 /* User break */
-#define INTERNAL 1051 /* Internal error */
-#define INVALIDOBJECT 1052 /* Invalid object */
-#define JOBTIMEOUT 1053 /* Job timed out */
-#define OPENPORT 1054 /* Cannot open port // ... for several resons */
-#define NODATA 1055 /* Received no data */
-#define NOPORT 1056 /* No port to handle this request */
-#define NOTCACHED 1057 /* Document not cached */
-#define BADCACHETYPE 1058 /* Bad cache type */
-#define OPENCACHE_WRITE 1059 /* Cannot write to cache */
-#define OPENCACHE_READ 1060 /* Cannot read from cache // same */
-#define NOSOURCE 1061 /* Do not know what to read */
-#define CLOSECACHE 1062 /* Could not insert into cache */
-#define CONNECTREMOTE 1063 /* Could not connect to remote server */
-#define LOCKREFUSED 1064 /* Lock refused // could not lock the stores */
-
-#endif
-#endif
diff --git a/ext/hyperwave/hyperwave.dsp b/ext/hyperwave/hyperwave.dsp
deleted file mode 100644
index 1ca7e52439..0000000000
--- a/ext/hyperwave/hyperwave.dsp
+++ /dev/null
@@ -1,120 +0,0 @@
-# Microsoft Developer Studio Project File - Name="hyperwave" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=hyperwave - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "hyperwave.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "hyperwave.mak" CFG="hyperwave - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "hyperwave - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "hyperwave - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "hyperwave - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HYPERWAVE_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_HYPERWAVE" /D ZTS=1 /D HYPERWAVE=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_hyperwave.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "hyperwave - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HYPERWAVE_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_HYPERWAVE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HYPERWAVE=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_hyperwave.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "hyperwave - Win32 Release_TS"
-# Name "hyperwave - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\hg_comm.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\hw.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\hg_comm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\hw_error.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_hyperwave.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/hyperwave/php_hyperwave.h b/ext/hyperwave/php_hyperwave.h
deleted file mode 100644
index 04602635bc..0000000000
--- a/ext/hyperwave/php_hyperwave.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_HYPERWAVE_H
-#define PHP_HYPERWAVE_H
-
-#ifdef PHP_WIN32
-#define PHP_HW_API __declspec(dllexport)
-#else
-#define PHP_HW_API
-#endif
-
-#if HYPERWAVE
-#ifndef DLEXPORT
-#define DLEXPORT
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-#include "hg_comm.h"
-
-extern zend_module_entry hw_module_entry;
-#define hw_module_ptr &hw_module_entry
-
-typedef struct {
- long default_link;
- long default_port;
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
-} zend_hw_globals;
-
-#ifdef ZTS
-# define HwSG(v) TSRMG(hw_globals_id, zend_hw_globals *, v)
-#else
-# define HwSG(v) (hw_globals.v)
-extern PHP_HW_API zend_hw_globals hw_globals;
-#endif
-
-/*extern hw_module php_hw_module;*/
-
-typedef struct {
- int size;
- char *data;
- char *attributes;
- char *bodytag;
-} hw_document;
-
-PHP_MINIT_FUNCTION(hw);
-PHP_MSHUTDOWN_FUNCTION(hw);
-PHP_MINFO_FUNCTION(hw);
-
-PHP_FUNCTION(hw_connect);
-PHP_FUNCTION(hw_pconnect);
-PHP_FUNCTION(hw_close);
-PHP_FUNCTION(hw_root);
-PHP_FUNCTION(hw_info);
-PHP_FUNCTION(hw_error);
-PHP_FUNCTION(hw_errormsg);
-PHP_FUNCTION(hw_mv);
-PHP_FUNCTION(hw_cp);
-PHP_FUNCTION(hw_deleteobject);
-PHP_FUNCTION(hw_changeobject);
-PHP_FUNCTION(hw_modifyobject);
-PHP_FUNCTION(hw_getparents);
-PHP_FUNCTION(hw_getparentsobj);
-PHP_FUNCTION(hw_children);
-PHP_FUNCTION(hw_childrenobj);
-PHP_FUNCTION(hw_getchildcoll);
-PHP_FUNCTION(hw_getchildcollobj);
-PHP_FUNCTION(hw_getobject);
-PHP_FUNCTION(hw_getandlock);
-PHP_FUNCTION(hw_unlock);
-PHP_FUNCTION(hw_gettext);
-PHP_FUNCTION(hw_edittext);
-PHP_FUNCTION(hw_getcgi);
-PHP_FUNCTION(hw_getremote);
-PHP_FUNCTION(hw_getremotechildren);
-PHP_FUNCTION(hw_pipedocument);
-PHP_FUNCTION(hw_pipecgi);
-PHP_FUNCTION(hw_insertdocument);
-PHP_FUNCTION(hw_docbyanchorobj);
-PHP_FUNCTION(hw_docbyanchor);
-PHP_FUNCTION(hw_getobjectbyquery);
-PHP_FUNCTION(hw_getobjectbyqueryobj);
-PHP_FUNCTION(hw_getobjectbyquerycoll);
-PHP_FUNCTION(hw_getobjectbyquerycollobj);
-PHP_FUNCTION(hw_getobjectbyftquery);
-PHP_FUNCTION(hw_getobjectbyftqueryobj);
-PHP_FUNCTION(hw_getobjectbyftquerycoll);
-PHP_FUNCTION(hw_getobjectbyftquerycollobj);
-PHP_FUNCTION(hw_getchilddoccoll);
-PHP_FUNCTION(hw_getchilddoccollobj);
-PHP_FUNCTION(hw_getanchors);
-PHP_FUNCTION(hw_getanchorsobj);
-PHP_FUNCTION(hw_getusername);
-PHP_FUNCTION(hw_setlinkroot);
-PHP_FUNCTION(hw_inscoll);
-PHP_FUNCTION(hw_incollections);
-PHP_FUNCTION(hw_insertobject);
-PHP_FUNCTION(hw_insdoc);
-PHP_FUNCTION(hw_identify);
-PHP_FUNCTION(hw_free_document);
-PHP_FUNCTION(hw_new_document);
-PHP_FUNCTION(hw_new_document_from_file);
-PHP_FUNCTION(hw_output_document);
-PHP_FUNCTION(hw_document_size);
-PHP_FUNCTION(hw_document_attributes);
-PHP_FUNCTION(hw_document_bodytag);
-PHP_FUNCTION(hw_document_content);
-PHP_FUNCTION(hw_document_setcontent);
-PHP_FUNCTION(hw_objrec2array);
-PHP_FUNCTION(hw_array2objrec);
-PHP_FUNCTION(hw_connection_info);
-PHP_FUNCTION(hw_getsrcbydestobj);
-PHP_FUNCTION(hw_insertanchors);
-PHP_FUNCTION(hw_getrellink);
-PHP_FUNCTION(hw_dummy);
-PHP_FUNCTION(hw_who);
-PHP_FUNCTION(hw_stat);
-PHP_FUNCTION(hw_mapid);
-
-#else
-#define hw_module_ptr NULL
-#endif /* HYPERWAVE */
-#define phpext_hyperwave_ptr hw_module_ptr
-#endif /* PHP_HYPERWAVE_H */
-
diff --git a/ext/iconv/CREDITS b/ext/iconv/CREDITS
deleted file mode 100644
index 70d3825ac3..0000000000
--- a/ext/iconv/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Iconv
-Rui Hirokawa, Stig Bakken, Moriyoshi Koizumi
diff --git a/ext/iconv/config.m4 b/ext/iconv/config.m4
deleted file mode 100644
index 37f82eb479..0000000000
--- a/ext/iconv/config.m4
+++ /dev/null
@@ -1,118 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(iconv, for iconv support,
-[ --with-iconv[=DIR] Include iconv support])
-
-if test "$PHP_ICONV" != "no"; then
-
- PHP_SETUP_ICONV(ICONV_SHARED_LIBADD, [
- iconv_avail="yes";
- ],[
- iconv_avail="no";
- ])
-
- if test "$iconv_avail" != "no"; then
- iconv_cflags_save="$CFLAGS"
- CFLAGS="$CFLAGS $INCLUDES"
- AC_MSG_CHECKING([if iconv supports errno])
- AC_TRY_RUN([
-#define LIBICONV_PLUG
-#include <iconv.h>
-#include <errno.h>
-#if defined(_LIBICONV_H)
-#define icv_open(a, b) libiconv_open(a, b)
-#define icv_close(a) libiconv_close(a)
-#define icv(a, b, c, d, e) libiconv(a, b, c, d, e)
-#else
-#define icv_open(a, b) iconv_open(a, b)
-#define icv_close(a) iconv_close(a)
-#define icv(a, b, c, d, e) iconv(a, b, c, d, e)
-#endif
-
-int main() {
- iconv_t cd;
- cd = icv_open( "*blahblah*", "*blahblah*" );
- if( cd == (iconv_t)(-1) ) {
- if( errno == EINVAL ) {
- return 0;
- } else {
- return 1;
- }
- }
- icv_close( cd );
- return 2;
-}
- ],[
- AC_MSG_RESULT(yes)
- PHP_DEFINE([ICONV_SUPPORTS_ERRNO],1)
- AC_DEFINE([ICONV_SUPPORTS_ERRNO],1,[Whether iconv supports error no or not])
- ],[
- AC_MSG_RESULT(no)
- PHP_DEFINE([ICONV_SUPPORTS_ERRNO],0)
- AC_DEFINE([ICONV_SUPPORTS_ERRNO],0,[Whether iconv supports error no or not])
- ])
-
- if test -z "$iconv_lib_name"; then
- AC_MSG_CHECKING([if iconv is glibc's])
- AC_TRY_LINK([#include <gnu/libc-version.h>],[gnu_get_libc_version();],
- [
- AC_MSG_RESULT(yes)
- iconv_impl_name="glibc"
- ],[
- AC_MSG_RESULT(no)
- ])
- else
- case "$iconv_lib_name" in
- iconv [)]
- AC_MSG_CHECKING([if iconv is Konstantin Chugeuv's])
- AC_TRY_LINK([#include <iconv.h>],[iconv_ccs_init(NULL, NULL);],
- [
- AC_MSG_RESULT(yes)
- iconv_impl_name="bsd"
- ],[
- AC_MSG_RESULT(no)
- iconv_impl_name="gnu_libiconv"
- ])
- ;;
-
- giconv [)]
- iconv_impl_name="gnu_libiconv"
- ;;
-
- biconv [)]
- iconv_impl_name="bsd"
- ;;
- esac
- fi
-
- case "$iconv_impl_name" in
- gnu_libiconv [)]
- PHP_DEFINE([PHP_ICONV_IMPL],[\"libiconv\"])
- AC_DEFINE([PHP_ICONV_IMPL],["libiconv"],[Which iconv implementation to use])
- ;;
-
- bsd [)]
- PHP_DEFINE([HAVE_BSD_ICONV],1)
- AC_DEFINE([HAVE_BSD_ICONV],1,[Konstantin Chugeuv's iconv implementation])
- PHP_DEFINE([PHP_ICONV_IMPL],[\"BSD iconv\"])
- AC_DEFINE([PHP_ICONV_IMPL],["BSD iconv"],[Which iconv implementation to use])
- ;;
-
- glibc [)]
- PHP_DEFINE([HAVE_GLIBC_ICONV],1)
- AC_DEFINE([HAVE_GLIBC_ICONV],1,[glibc's iconv implementation])
- PHP_DEFINE([PHP_ICONV_IMPL],[\"glibc\"])
- AC_DEFINE([PHP_ICONV_IMPL],["glibc"],[Which iconv implementation to use])
- ;;
- esac
-
- CFLAGS="$iconv_cflags_save"
-
- PHP_NEW_EXTENSION(iconv, iconv.c, $ext_shared)
- PHP_SUBST(ICONV_SHARED_LIBADD)
- else
- AC_MSG_ERROR(Please reinstall the iconv library.)
- fi
-fi
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
deleted file mode 100644
index 1d83c3fd16..0000000000
--- a/ext/iconv/iconv.c
+++ /dev/null
@@ -1,1841 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rui Hirokawa <rui_hirokawa@ybb.ne.jp> |
- | Stig Bakken <ssb@php.net> |
- | Moriyoshi Koizumi <moriyoshi@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-#include "main/php_output.h"
-#include "SAPI.h"
-#include "php_ini.h"
-
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
-#include <errno.h>
-
-#include "php_iconv.h"
-
-#ifdef HAVE_ICONV
-
-#ifdef HAVE_GICONV_H
-#include <giconv.h>
-#else
-#include <iconv.h>
-#endif
-
-#ifdef HAVE_GLIBC_ICONV
-#include <gnu/libc-version.h>
-#endif
-
-#include "ext/standard/php_smart_str.h"
-#include "ext/standard/base64.h"
-#include "ext/standard/quot_print.h"
-
-#ifdef HAVE_LIBICONV
-#define LIBICONV_PLUG
-#define icv_open(a, b) libiconv_open(a, b)
-#define icv_close(a) libiconv_close(a)
-#define icv(a, b, c, d, e) libiconv(a, b, c, d, e)
-#else
-#define icv_open(a, b) iconv_open(a, b)
-#define icv_close(a) iconv_close(a)
-#define icv(a, b, c, d, e) iconv(a, (char **) b, c, d, e)
-#endif
-
-#define _php_iconv_memequal(a, b, c) \
- ((c) == sizeof(unsigned long) ? *((unsigned long *)(a)) == *((unsigned long *)(b)) : ((c) == sizeof(unsigned int) ? *((unsigned int *)(a)) == *((unsigned int *)(b)) : memcmp(a, b, c) == 0))
-
-/* {{{ iconv_functions[]
- */
-function_entry iconv_functions[] = {
- PHP_NAMED_FE(iconv,php_if_iconv, NULL)
- PHP_FE(ob_iconv_handler, NULL)
- PHP_FE(iconv_get_encoding, NULL)
- PHP_FE(iconv_set_encoding, NULL)
- PHP_FE(iconv_strlen, NULL)
- PHP_FE(iconv_substr, NULL)
- PHP_FE(iconv_strpos, NULL)
- PHP_FE(iconv_strrpos, NULL)
- PHP_FE(iconv_mime_encode, NULL)
- PHP_FE(iconv_mime_decode, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ iconv_module_entry
- */
-zend_module_entry iconv_module_entry = {
- STANDARD_MODULE_HEADER,
- "iconv",
- iconv_functions,
- PHP_MINIT(miconv),
- PHP_MSHUTDOWN(miconv),
- NULL,
- NULL,
- PHP_MINFO(miconv),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-ZEND_DECLARE_MODULE_GLOBALS(iconv)
-
-#ifdef COMPILE_DL_ICONV
-ZEND_GET_MODULE(iconv)
-#endif
-
-/* {{{ typedef enum php_iconv_err_t */
-typedef enum _php_iconv_err_t {
- PHP_ICONV_ERR_SUCCESS = SUCCESS,
- PHP_ICONV_ERR_CONVERTER = 1,
- PHP_ICONV_ERR_WRONG_CHARSET = 2,
- PHP_ICONV_ERR_TOO_BIG = 3,
- PHP_ICONV_ERR_ILLEGAL_SEQ = 4,
- PHP_ICONV_ERR_ILLEGAL_CHAR = 5,
- PHP_ICONV_ERR_UNKNOWN = 6,
- PHP_ICONV_ERR_MALFORMED = 7
-} php_iconv_err_t;
-/* }}} */
-
-/* {{{ typedef enum php_iconv_enc_scheme_t */
-typedef enum _php_iconv_enc_scheme_t {
- PHP_ICONV_ENC_SCHEME_BASE64,
- PHP_ICONV_ENC_SCHEME_QPRINT
-} php_iconv_enc_scheme_t;
-/* }}} */
-
-/* {{{ prototypes */
-static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l, iconv_t cd);
-static php_iconv_err_t _php_iconv_appendc(smart_str *d, const char c, iconv_t cd);
-
-static php_iconv_err_t php_iconv_string(const char * in_p, size_t in_len, char **out, size_t *out_len, const char *out_charset, const char *in_charset);
-
-static void _php_iconv_show_error(php_iconv_err_t err, const char *out_charset, const char *in_charset TSRMLS_DC);
-
-static php_iconv_err_t _php_iconv_strlen(unsigned int *pretval, const char *str, size_t nbytes, const char *enc);
-
-static php_iconv_err_t _php_iconv_substr(smart_str *pretval, const char *str, size_t nbytes, int offset, int len, const char *enc);
-
-static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, const char *haystk, size_t haystk_nbytes, const char *ndl, size_t ndl_nbytes, int offset, const char *enc);
-
-static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, unsigned int max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc);
-
-static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *str, size_t str_nbytes, const char *enc);
-/* }}} */
-
-/* {{{ static globals */
-static char _generic_superset_name[] = "UCS-4LE";
-#define GENERIC_SUPERSET_NAME _generic_superset_name
-#define GENERIC_SUPERSET_NBYTES 4
-/* }}} */
-
-/* {{{ PHP_INI
- */
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("iconv.input_encoding", ICONV_INPUT_ENCODING, PHP_INI_ALL, OnUpdateString, input_encoding, zend_iconv_globals, iconv_globals)
- STD_PHP_INI_ENTRY("iconv.output_encoding", ICONV_OUTPUT_ENCODING, PHP_INI_ALL, OnUpdateString, output_encoding, zend_iconv_globals, iconv_globals)
- STD_PHP_INI_ENTRY("iconv.internal_encoding", ICONV_INTERNAL_ENCODING, PHP_INI_ALL, OnUpdateString, internal_encoding, zend_iconv_globals, iconv_globals)
-PHP_INI_END()
-/* }}} */
-
-/* {{{ php_iconv_init_globals */
-static void php_iconv_init_globals(zend_iconv_globals *iconv_globals)
-{
- iconv_globals->input_encoding = NULL;
- iconv_globals->output_encoding = NULL;
- iconv_globals->internal_encoding = NULL;
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION */
-PHP_MINIT_FUNCTION(miconv)
-{
- char *version = "unknown";
-
- ZEND_INIT_MODULE_GLOBALS(iconv, php_iconv_init_globals, NULL);
- REGISTER_INI_ENTRIES();
-
-#if HAVE_LIBICONV
- {
- static char buf[16];
- snprintf(buf, sizeof(buf), "%d.%d",
- ((_libiconv_version >> 8) & 0x0f), (_libiconv_version & 0x0f));
- version = buf;
- }
-#elif HAVE_GLIBC_ICONV
- version = (char *)gnu_get_libc_version();
-#endif
-
-#ifdef PHP_ICONV_IMPL
- REGISTER_STRING_CONSTANT("ICONV_IMPL", PHP_ICONV_IMPL, CONST_CS | CONST_PERSISTENT);
-#elif HAVE_LIBICONV
- REGISTER_STRING_CONSTANT("ICONV_IMPL", "libiconv", CONST_CS | CONST_PERSISTENT);
-#else
- REGISTER_STRING_CONSTANT("ICONV_IMPL", "unknown", CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_STRING_CONSTANT("ICONV_VERSION", version, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION */
-PHP_MSHUTDOWN_FUNCTION(miconv)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION */
-PHP_MINFO_FUNCTION(miconv)
-{
- zval iconv_impl, iconv_ver;
-
- zend_get_constant("ICONV_IMPL", sizeof("ICONV_IMPL")-1, &iconv_impl TSRMLS_CC);
- zend_get_constant("ICONV_VERSION", sizeof("ICONV_VERSION")-1, &iconv_ver TSRMLS_CC);
-
- php_info_print_table_start();
- php_info_print_table_row(2, "iconv support", "enabled");
- php_info_print_table_row(2, "iconv implementation", Z_STRVAL(iconv_impl));
- php_info_print_table_row(2, "iconv library version", Z_STRVAL(iconv_ver));
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-
- zval_dtor(&iconv_impl);
- zval_dtor(&iconv_ver);
-}
-/* }}} */
-
-/* {{{ _php_iconv_appendl() */
-static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l, iconv_t cd)
-{
- const char *in_p = s;
- size_t in_left = l;
- char *out_p;
- size_t out_left = 0;
- size_t buf_growth = 128;
-#if !ICONV_SUPPORTS_ERRNO
- size_t prev_in_left = in_left;
-#endif
-
- if (in_p != NULL) {
- while (in_left > 0) {
- out_left = buf_growth - out_left;
- {
- size_t newlen;
- smart_str_alloc((d), out_left, 0);
- }
-
- out_p = (d)->c + (d)->len;
-
- if (icv(cd, &in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
-#if ICONV_SUPPORTS_ERRNO
- switch (errno) {
- case EINVAL:
- return PHP_ICONV_ERR_ILLEGAL_CHAR;
-
- case EILSEQ:
- return PHP_ICONV_ERR_ILLEGAL_SEQ;
-
- case E2BIG:
- break;
-
- default:
- return PHP_ICONV_ERR_UNKNOWN;
- }
-#else
- if (prev_in_left == in_left) {
- return PHP_ICONV_ERR_UNKNOWN;
- }
-#endif
- }
-#if !ICONV_SUPPORTS_ERRNO
- prev_in_left = in_left;
-#endif
- (d)->len += (buf_growth - out_left);
- buf_growth <<= 1;
- }
- } else {
- for (;;) {
- out_left = buf_growth - out_left;
- {
- size_t newlen;
- smart_str_alloc((d), out_left, 0);
- }
-
- out_p = (d)->c + (d)->len;
-
- if (icv(cd, NULL, NULL, (char **) &out_p, &out_left) == (size_t)0) {
- (d)->len += (buf_growth - out_left);
- break;
- } else {
-#if ICONV_SUPPORTS_ERRNO
- if (errno != E2BIG) {
- return PHP_ICONV_ERR_UNKNOWN;
- }
-#else
- if (out_left != 0) {
- return PHP_ICONV_ERR_UNKNOWN;
- }
-#endif
- }
- (d)->len += (buf_growth - out_left);
- buf_growth <<= 1;
- }
- }
- return PHP_ICONV_ERR_SUCCESS;
-}
-/* }}} */
-
-/* {{{ _php_iconv_appendc() */
-static php_iconv_err_t _php_iconv_appendc(smart_str *d, const char c, iconv_t cd)
-{
- return _php_iconv_appendl(d, &c, 1, cd);
-}
-/* }}} */
-
-/* {{{ php_iconv_string()
- */
-php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
- char **out, size_t *out_len,
- const char *out_charset, const char *in_charset)
-{
-#if !ICONV_SUPPORTS_ERRNO
- unsigned int in_size, out_size, out_left;
- char *out_buffer, *out_p;
- iconv_t cd;
- size_t result;
- typedef unsigned int ucs4_t;
-
- *out = NULL;
- *out_len = 0;
-
- /*
- This is not the right way to get output size...
- This is not space efficient for large text.
- This is also problem for encoding like UTF-7/UTF-8/ISO-2022 which
- a single char can be more than 4 bytes.
- I added 15 extra bytes for safety. <yohgaki@php.net>
- */
- out_size = in_len * sizeof(ucs4_t) + 15;
- out_left = out_size;
-
- in_size = in_len;
-
- cd = icv_open(out_charset, in_charset);
-
- if (cd == (iconv_t)(-1)) {
- return PHP_ICONV_ERR_UNKNOWN;
- }
-
- out_buffer = (char *) emalloc(out_size + 1);
- out_p = out_buffer;
-
- result = icv(cd, (const char **) &in_p, &in_size, (char **)
- &out_p, &out_left);
-
- if (result == (size_t)(-1)) {
- efree(out_buffer);
- return PHP_ICONV_ERR_UNKNOWN;
- }
-
- if (out_left < 8) {
- out_buffer = (char *) erealloc(out_buffer, out_size + 8);
- }
-
- /* flush the shift-out sequences */
- result = icv(cd, NULL, NULL, &out_p, &out_left);
-
- if (result == (size_t)(-1)) {
- efree(out_buffer);
- return PHP_ICONV_ERR_UNKNOWN;
- }
-
- *out_len = out_size - out_left;
- out_buffer[*out_len] = '\0';
- *out = out_buffer;
-
- icv_close(cd);
-
- return PHP_ICONV_ERR_SUCCESS;
-
-#else
- /*
- iconv supports errno. Handle it better way.
- */
- iconv_t cd;
- size_t in_left, out_size, out_left;
- char *out_p, *out_buf, *tmp_buf;
- size_t bsz, result = 0;
- php_iconv_err_t retval = PHP_ICONV_ERR_SUCCESS;
-
- *out = NULL;
- *out_len = 0;
-
- cd = icv_open(out_charset, in_charset);
-
- if (cd == (iconv_t)(-1)) {
- if (errno == EINVAL) {
- return PHP_ICONV_ERR_WRONG_CHARSET;
- } else {
- return PHP_ICONV_ERR_CONVERTER;
- }
- }
- in_left= in_len;
- out_left = in_len + 32; /* Avoid realloc() most cases */
- out_size = 0;
- bsz = out_left;
- out_buf = (char *) emalloc(bsz+1);
- out_p = out_buf;
-
- while (in_left > 0) {
- result = icv(cd, (const char **) &in_p, &in_left, (char **) &out_p, &out_left);
- out_size = bsz - out_left;
- if (result == (size_t)(-1)) {
- if (errno == E2BIG && in_left > 0) {
- /* converted string is longer than out buffer */
- bsz += in_len;
-
- tmp_buf = (char*) erealloc(out_buf, bsz+1);
- out_p = out_buf = tmp_buf;
- out_p += out_size;
- out_left = bsz - out_size;
- continue;
- }
- }
- break;
- }
-
- if (result != (size_t)(-1)) {
- /* flush the shift-out sequences */
- for (;;) {
- result = icv(cd, NULL, NULL, (char **) &out_p, &out_left);
- out_size = bsz - out_left;
-
- if (result != (size_t)(-1)) {
- break;
- }
-
- if (errno == E2BIG) {
- bsz += 16;
- tmp_buf = (char *) erealloc(out_buf, bsz);
-
- out_p = out_buf = tmp_buf;
- out_p += out_size;
- out_left = bsz - out_size;
- } else {
- break;
- }
- }
- }
-
- icv_close(cd);
-
- if (result == (size_t)(-1)) {
- switch (errno) {
- case EINVAL:
- retval = PHP_ICONV_ERR_ILLEGAL_CHAR;
- break;
-
- case EILSEQ:
- retval = PHP_ICONV_ERR_ILLEGAL_SEQ;
- break;
-
- case E2BIG:
- /* should not happen */
- retval = PHP_ICONV_ERR_TOO_BIG;
- break;
-
- default:
- /* other error */
- retval = PHP_ICONV_ERR_UNKNOWN;
- efree(out_buf);
- return PHP_ICONV_ERR_UNKNOWN;
- }
- }
- *out_p = '\0';
- *out = out_buf;
- *out_len = out_size;
- return retval;
-#endif
-}
-/* }}} */
-
-/* {{{ _php_iconv_strlen() */
-static php_iconv_err_t _php_iconv_strlen(unsigned int *pretval, const char *str, size_t nbytes, const char *enc)
-{
- char buf[GENERIC_SUPERSET_NBYTES*2];
-
- php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;
-
- iconv_t cd;
-
- const char *in_p;
- size_t in_left;
-
- char *out_p;
- size_t out_left;
-
- unsigned int cnt;
-
- *pretval = (unsigned int)-1;
-
- cd = icv_open(GENERIC_SUPERSET_NAME, enc);
-
- if (cd == (iconv_t)(-1)) {
-#if ICONV_SUPPORTS_ERRNO
- if (errno == EINVAL) {
- return PHP_ICONV_ERR_WRONG_CHARSET;
- } else {
- return PHP_ICONV_ERR_CONVERTER;
- }
-#else
- return PHP_ICONV_ERR_UNKNOWN;
-#endif
- }
-
- out_left = 0;
-
- for (in_p = str, in_left = nbytes, cnt = 0; in_left > 0; cnt+=2) {
- size_t prev_in_left;
- out_p = buf;
- out_left = sizeof(buf);
-
- prev_in_left = in_left;
-
- if (icv(cd, &in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
- if (prev_in_left == in_left) {
- break;
- }
- }
- }
-
- if (out_left > 0) {
- cnt -= out_left / GENERIC_SUPERSET_NBYTES;
- }
-
-#if ICONV_SUPPORTS_ERRNO
- switch (errno) {
- case EINVAL:
- err = PHP_ICONV_ERR_ILLEGAL_CHAR;
- break;
-
- case EILSEQ:
- err = PHP_ICONV_ERR_ILLEGAL_SEQ;
- break;
-
- case E2BIG:
- *pretval = cnt;
- break;
-
- default:
- err = PHP_ICONV_ERR_UNKNOWN;
- break;
- }
-#else
- *pretval = cnt;
-#endif
-
- icv_close(cd);
-
- return err;
-}
-
-/* }}} */
-
-/* {{{ _php_iconv_substr() */
-static php_iconv_err_t _php_iconv_substr(smart_str *pretval,
- const char *str, size_t nbytes, int offset, int len, const char *enc)
-{
- char buf[GENERIC_SUPERSET_NBYTES];
-
- php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;
-
- iconv_t cd1, cd2;
-
- const char *in_p;
- size_t in_left;
-
- char *out_p;
- size_t out_left;
-
- unsigned int cnt;
-
- /* normalize the offset and the length */
- if (offset < 0 || len < 0) {
- unsigned int total_len;
- err = _php_iconv_strlen(&total_len, str, nbytes, enc);
- if (err != PHP_ICONV_ERR_SUCCESS) {
- return err;
- }
- if (offset < 0) {
- if ((offset += total_len) < 0) {
- offset = 0;
- }
- }
- if (len < 0) {
- if ((len += (total_len - offset)) < 0) {
- len = 0;
- }
- }
- }
-
- cd1 = icv_open(GENERIC_SUPERSET_NAME, enc);
-
- if (cd1 == (iconv_t)(-1)) {
-#if ICONV_SUPPORTS_ERRNO
- if (errno == EINVAL) {
- return PHP_ICONV_ERR_WRONG_CHARSET;
- } else {
- return PHP_ICONV_ERR_CONVERTER;
- }
-#else
- return PHP_ICONV_ERR_UNKNOWN;
-#endif
- }
-
- cd2 = NULL;
-
- for (in_p = str, in_left = nbytes, cnt = 0; in_left > 0 && len > 0; ++cnt) {
- size_t prev_in_left;
- out_p = buf;
- out_left = sizeof(buf);
-
- prev_in_left = in_left;
-
- if (icv(cd1, &in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
- if (prev_in_left == in_left) {
- break;
- }
- }
-
- if (cnt >= (unsigned int)offset) {
- if (cd2 == NULL) {
- cd2 = icv_open(enc, GENERIC_SUPERSET_NAME);
-
- if (cd2 == (iconv_t)(-1)) {
- cd2 = NULL;
-#if ICONV_SUPPORTS_ERRNO
- if (errno == EINVAL) {
- err = PHP_ICONV_ERR_WRONG_CHARSET;
- } else {
- err = PHP_ICONV_ERR_CONVERTER;
- }
-#else
- err = PHP_ICONV_ERR_UNKNOWN;
-#endif
- break;
- }
- }
-
- _php_iconv_appendl(pretval, buf, sizeof(buf), cd2);
- --len;
- }
-
- }
-
-#if ICONV_SUPPORTS_ERRNO
- switch (errno) {
- case EINVAL:
- err = PHP_ICONV_ERR_ILLEGAL_CHAR;
- break;
-
- case EILSEQ:
- err = PHP_ICONV_ERR_ILLEGAL_SEQ;
- break;
-
- case E2BIG:
- break;
-
- default:
- err = PHP_ICONV_ERR_UNKNOWN;
- break;
- }
-#endif
- if (err == PHP_ICONV_ERR_SUCCESS) {
- if (cd2 != NULL) {
- _php_iconv_appendl(pretval, NULL, 0, cd2);
- }
- smart_str_0(pretval);
- }
-
- if (cd1 != NULL) {
- icv_close(cd1);
- }
-
- if (cd2 != NULL) {
- icv_close(cd2);
- }
- return err;
-}
-
-/* }}} */
-
-/* {{{ _php_iconv_strpos() */
-static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval,
- const char *haystk, size_t haystk_nbytes,
- const char *ndl, size_t ndl_nbytes,
- int offset, const char *enc)
-{
- char buf[GENERIC_SUPERSET_NBYTES];
-
- php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;
-
- iconv_t cd;
-
- const char *in_p;
- size_t in_left;
-
- char *out_p;
- size_t out_left;
-
- unsigned int cnt;
-
- char *ndl_buf;
- const char *ndl_buf_p;
- size_t ndl_buf_len, ndl_buf_left;
-
- unsigned int match_ofs;
-
- *pretval = (unsigned int)-1;
-
- err = php_iconv_string(ndl, ndl_nbytes,
- &ndl_buf, &ndl_buf_len, GENERIC_SUPERSET_NAME, enc);
-
- if (err != PHP_ICONV_ERR_SUCCESS) {
- if (ndl_buf != NULL) {
- efree(ndl_buf);
- }
- return err;
- }
-
- cd = icv_open(GENERIC_SUPERSET_NAME, enc);
-
- if (cd == (iconv_t)(-1)) {
-#if ICONV_SUPPORTS_ERRNO
- if (errno == EINVAL) {
- return PHP_ICONV_ERR_WRONG_CHARSET;
- } else {
- return PHP_ICONV_ERR_CONVERTER;
- }
-#else
- return PHP_ICONV_ERR_UNKNOWN;
-#endif
- }
-
- ndl_buf_p = ndl_buf;
- ndl_buf_left = ndl_buf_len;
- match_ofs = (unsigned int)-1;
-
- for (in_p = haystk, in_left = haystk_nbytes, cnt = 0; in_left > 0; ++cnt) {
- size_t prev_in_left;
- out_p = buf;
- out_left = sizeof(buf);
-
- prev_in_left = in_left;
-
- if (icv(cd, &in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
- if (prev_in_left == in_left) {
-#if ICONV_SUPPORTS_ERRNO
- switch (errno) {
- case EINVAL:
- err = PHP_ICONV_ERR_ILLEGAL_CHAR;
- break;
-
- case EILSEQ:
- err = PHP_ICONV_ERR_ILLEGAL_SEQ;
- break;
-
- case E2BIG:
- break;
-
- default:
- err = PHP_ICONV_ERR_UNKNOWN;
- break;
- }
-#endif
- break;
- }
- }
- if (offset >= 0) {
- if (cnt >= (unsigned int)offset) {
- if (_php_iconv_memequal(buf, ndl_buf_p, sizeof(buf))) {
- if (match_ofs == (unsigned int)-1) {
- match_ofs = cnt;
- }
- ndl_buf_p += GENERIC_SUPERSET_NBYTES;
- ndl_buf_left -= GENERIC_SUPERSET_NBYTES;
- if (ndl_buf_left == 0) {
- *pretval = match_ofs;
- break;
- }
- } else {
- unsigned int i, j, lim;
-
- i = 0;
- j = GENERIC_SUPERSET_NBYTES;
- lim = (unsigned int)(ndl_buf_p - ndl_buf);
-
- while (j < lim) {
- if (_php_iconv_memequal(&ndl_buf[j], &ndl_buf[i],
- GENERIC_SUPERSET_NBYTES)) {
- i += GENERIC_SUPERSET_NBYTES;
- } else {
- j -= i;
- i = 0;
- }
- j += GENERIC_SUPERSET_NBYTES;
- }
-
- if (!_php_iconv_memequal(buf, &ndl_buf[i], sizeof(buf))) {
- i = 0;
- }
-
- if (i == 0) {
- match_ofs = (unsigned int)-1;
- } else {
- match_ofs += (lim - i) / GENERIC_SUPERSET_NBYTES;
- i += GENERIC_SUPERSET_NBYTES;
- }
- ndl_buf_p = &ndl_buf[i];
- ndl_buf_left = ndl_buf_len - i;
- }
- }
- } else {
- if (_php_iconv_memequal(buf, ndl_buf_p, sizeof(buf))) {
- if (match_ofs == (unsigned int)-1) {
- match_ofs = cnt;
- }
- ndl_buf_p += GENERIC_SUPERSET_NBYTES;
- ndl_buf_left -= GENERIC_SUPERSET_NBYTES;
- if (ndl_buf_left == 0) {
- *pretval = match_ofs;
- ndl_buf_p = ndl_buf;
- ndl_buf_left = ndl_buf_len;
- match_ofs = -1;
- }
- } else {
- unsigned int i, j, lim;
-
- i = 0;
- j = GENERIC_SUPERSET_NBYTES;
- lim = (unsigned int)(ndl_buf_p - ndl_buf);
-
- while (j < lim) {
- if (_php_iconv_memequal(&ndl_buf[j], &ndl_buf[i],
- GENERIC_SUPERSET_NBYTES)) {
- i += GENERIC_SUPERSET_NBYTES;
- } else {
- j -= i;
- i = 0;
- }
- j += GENERIC_SUPERSET_NBYTES;
- }
-
- if (!_php_iconv_memequal(buf, &ndl_buf[i], sizeof(buf))) {
- i = 0;
- }
-
- if (i == 0) {
- match_ofs = (unsigned int)-1;
- } else {
- match_ofs += (lim - i) / GENERIC_SUPERSET_NBYTES;
- i += GENERIC_SUPERSET_NBYTES;
- }
- ndl_buf_p = &ndl_buf[i];
- ndl_buf_left = ndl_buf_len - i;
- }
- }
- }
-
- if (ndl_buf) {
- efree(ndl_buf);
- }
-
- icv_close(cd);
-
- return err;
-}
-/* }}} */
-
-/* {{{ _php_iconv_mime_encode() */
-static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, unsigned int max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc)
-{
- php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;
- iconv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1);
- unsigned int char_cnt = 0;
- size_t out_charset_len;
- size_t lfchars_len;
- char *buf = NULL;
- char *encoded = NULL;
- size_t encoded_len;
- const char *in_p;
- size_t in_left;
- char *out_p;
- size_t out_left;
-
- out_charset_len = strlen(out_charset);
- lfchars_len = strlen(lfchars);
-
- if ((fname_nbytes + 2) >= max_line_len
- || (out_charset_len + 12) >= max_line_len) {
- /* field name is too long */
- err = PHP_ICONV_ERR_TOO_BIG;
- goto out;
- }
-
- cd_pl = icv_open("ASCII", enc);
- if (cd_pl == (iconv_t)(-1)) {
-#if ICONV_SUPPORTS_ERRNO
- if (errno == EINVAL) {
- err = PHP_ICONV_ERR_WRONG_CHARSET;
- } else {
- err = PHP_ICONV_ERR_CONVERTER;
- }
-#else
- err = PHP_ICONV_ERR_UNKNOWN;
-#endif
- goto out;
- }
-
- cd = icv_open(out_charset, enc);
- if (cd == (iconv_t)(-1)) {
-#if ICONV_SUPPORTS_ERRNO
- if (errno == EINVAL) {
- err = PHP_ICONV_ERR_WRONG_CHARSET;
- } else {
- err = PHP_ICONV_ERR_CONVERTER;
- }
-#else
- err = PHP_ICONV_ERR_UNKNOWN;
-#endif
- goto out;
- }
-
- buf = emalloc(max_line_len + 5);
-
- char_cnt = max_line_len;
-
- _php_iconv_appendl(pretval, fname, fname_nbytes, cd_pl);
- char_cnt -= fname_nbytes;
- smart_str_appendl(pretval, ": ", sizeof(": ") - 1);
- char_cnt -= 2;
-
- in_p = fval;
- in_left = fval_nbytes;
-
- do {
- size_t prev_in_left;
- size_t out_size;
-
- if (char_cnt < (out_charset_len + 12)) {
- /* lfchars must be encoded in ASCII here*/
- smart_str_appendl(pretval, lfchars, lfchars_len);
- smart_str_appendc(pretval, ' ');
- char_cnt = max_line_len - 1;
- }
-
- smart_str_appendl(pretval, "=?", sizeof("=?") - 1);
- char_cnt -= 2;
- smart_str_appendl(pretval, out_charset, out_charset_len);
- char_cnt -= out_charset_len;
- smart_str_appendc(pretval, '?');
- char_cnt --;
-
- switch (enc_scheme) {
- case PHP_ICONV_ENC_SCHEME_BASE64: {
- size_t ini_in_left;
- const char *ini_in_p;
- size_t out_reserved = 4;
-
- smart_str_appendc(pretval, 'B');
- char_cnt--;
- smart_str_appendc(pretval, '?');
- char_cnt--;
-
- prev_in_left = ini_in_left = in_left;
- ini_in_p = in_p;
-
- out_size = (char_cnt - 2) / 4 * 3;
-
- for (;;) {
- out_p = buf;
-
- if (out_size <= out_reserved) {
- err = PHP_ICONV_ERR_TOO_BIG;
- goto out;
- }
-
- out_left = out_size - out_reserved;
-
- if (icv(cd, &in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
-#if ICONV_SUPPORTS_ERRNO
- switch (errno) {
- case EINVAL:
- err = PHP_ICONV_ERR_ILLEGAL_CHAR;
- goto out;
-
- case EILSEQ:
- err = PHP_ICONV_ERR_ILLEGAL_SEQ;
- goto out;
-
- case E2BIG:
- if (prev_in_left == in_left) {
- err = PHP_ICONV_ERR_TOO_BIG;
- goto out;
- }
- break;
-
- default:
- err = PHP_ICONV_ERR_UNKNOWN;
- goto out;
- }
-#else
- if (prev_in_left == in_left) {
- err = PHP_ICONV_ERR_UNKNOWN;
- goto out;
- }
-#endif
- }
-
- out_left += out_reserved;
-
- if (icv(cd, NULL, NULL, (char **) &out_p, &out_left) == (size_t)-1) {
-#if ICONV_SUPPORTS_ERRNO
- if (errno != E2BIG) {
- err = PHP_ICONV_ERR_UNKNOWN;
- goto out;
- }
-#else
- if (out_left != 0) {
- err = PHP_ICONV_ERR_UNKNOWN;
- goto out;
- }
-#endif
- } else {
- break;
- }
-
- if (icv(cd, NULL, NULL, NULL, NULL) == (size_t)-1) {
- err = PHP_ICONV_ERR_UNKNOWN;
- goto out;
- }
-
- out_reserved += 4;
- in_left = ini_in_left;
- in_p = ini_in_p;
- }
-
- prev_in_left = in_left;
-
- encoded = php_base64_encode(buf, (int)(out_size - out_left), &encoded_len);
- if (char_cnt < encoded_len) {
- /* something went wrong! */
- err = PHP_ICONV_ERR_UNKNOWN;
- goto out;
- }
-
- smart_str_appendl(pretval, encoded, encoded_len);
- char_cnt -= encoded_len;
- smart_str_appendl(pretval, "?=", sizeof("?=") - 1);
- char_cnt -= 2;
-
- efree(encoded);
- encoded = NULL;
- } break; /* case PHP_ICONV_ENC_SCHEME_BASE64: */
-
- case PHP_ICONV_ENC_SCHEME_QPRINT: {
- smart_str_appendc(pretval, 'Q');
- char_cnt--;
- smart_str_appendc(pretval, '?');
- char_cnt--;
-
- prev_in_left = in_left;
-
- while (in_left > 0) {
- out_p = buf;
- out_left = out_size = 1;
-
- if (icv(cd, &in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
-#if ICONV_SUPPORTS_ERRNO
- switch (errno) {
- case EINVAL:
- err = PHP_ICONV_ERR_ILLEGAL_CHAR;
- goto out;
-
- case EILSEQ:
- err = PHP_ICONV_ERR_ILLEGAL_SEQ;
- goto out;
-
- case E2BIG:
- break;
-
- default:
- err = PHP_ICONV_ERR_UNKNOWN;
- goto out;
- }
-#else
- if (prev_in_left == in_left) {
- err = PHP_ICONV_ERR_UNKNOWN;
- goto out;
- }
-#endif
- }
-
- if (out_size > out_left) {
- if ((buf[0] >= 33 && buf[0] <= 60) ||
- (buf[0] >= 62 && buf[0] <= 126)) {
-
- if (char_cnt >= 1 + 2) {
- smart_str_appendc(pretval, buf[0]);
- char_cnt--;
- } else {
- in_p -= (prev_in_left - in_left);
- in_left = prev_in_left;
-
- break;
- }
- } else {
- if (char_cnt >= 3 + 2) {
- static char qp_digits[] = "0123456789ABCDEF";
- smart_str_appendc(pretval, '=');
- smart_str_appendc(pretval, qp_digits[(buf[0] >> 4) & 0x0f]);
- smart_str_appendc(pretval, qp_digits[(buf[0] & 0x0f)]);
- char_cnt -= 3;
- } else {
- in_p -= (prev_in_left - in_left);
- in_left = prev_in_left;
-
- break;
- }
- }
- }
- prev_in_left = in_left;
- }
-
- smart_str_appendl(pretval, "?=", sizeof("?=") - 1);
- char_cnt -= 2;
-
- if (icv(cd, NULL, NULL, NULL, NULL) == (size_t)-1) {
- err = PHP_ICONV_ERR_UNKNOWN;
- goto out;
- }
-
- } break; /* case PHP_ICONV_ENC_SCHEME_QPRINT: */
- }
- } while (in_left > 0);
-
- smart_str_0(pretval);
-
-out:
- if (cd != (iconv_t)(-1)) {
- icv_close(cd);
- }
- if (cd_pl != (iconv_t)(-1)) {
- icv_close(cd_pl);
- }
- if (encoded != NULL) {
- efree(encoded);
- }
- if (buf != NULL) {
- efree(buf);
- }
- return err;
-}
-/* }}} */
-
-/* {{{ _php_iconv_mime_decode() */
-static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *str, size_t str_nbytes, const char *enc)
-{
- php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;
-
- iconv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1);
-
- const char *p1;
- size_t str_left;
- unsigned int scan_stat = 0;
- const char *csname = NULL;
- size_t csname_len;
- const char *encoded_text = NULL;
- size_t encoded_text_len;
-
- php_iconv_enc_scheme_t enc_scheme;
-
- cd_pl = icv_open(enc, "ASCII");
-
- if (cd_pl == (iconv_t)(-1)) {
-#if ICONV_SUPPORTS_ERRNO
- if (errno == EINVAL) {
- err = PHP_ICONV_ERR_WRONG_CHARSET;
- } else {
- err = PHP_ICONV_ERR_CONVERTER;
- }
-#else
- err = PHP_ICONV_ERR_UNKNOWN;
-#endif
- goto out;
- }
-
- p1 = str;
- for (str_left = str_nbytes; str_left > 0; str_left--, p1++) {
-
- switch (scan_stat) {
- case 0:
- switch (*p1) {
- case '\r':
- scan_stat = 7;
- break;
-
- case '\n':
- scan_stat = 8;
- break;
-
- case '=':
- scan_stat = 1;
- break;
-
- default:
- _php_iconv_appendc(pretval, *p1, cd_pl);
- }
- break;
-
- case 1:
- if (*p1 != '?') {
- err = PHP_ICONV_ERR_MALFORMED;
- goto out;
- }
- csname = p1 + 1;
- scan_stat = 2;
- break;
-
- case 2: /* charset name */
- switch (*p1) {
- case '?':
- scan_stat = 3;
- break;
-
- case '*':
- scan_stat = 10;
- break;
- }
- if (scan_stat != 2) {
- char tmpbuf[80];
-
- if (csname == NULL) {
- err = PHP_ICONV_ERR_MALFORMED;
- goto out;
- }
-
- csname_len = (size_t)(p1 - csname);
-
- if (csname_len > sizeof(tmpbuf) - 1) {
- err = PHP_ICONV_ERR_MALFORMED;
- goto out;
- }
-
- memcpy(tmpbuf, csname, csname_len);
- tmpbuf[csname_len] = '\0';
-
- if (cd != (iconv_t)(-1)) {
- icv_close(cd);
- }
-
- cd = icv_open(enc, tmpbuf);
-
- if (cd == (iconv_t)(-1)) {
-#if ICONV_SUPPORTS_ERRNO
- if (errno == EINVAL) {
- err = PHP_ICONV_ERR_WRONG_CHARSET;
- } else {
- err = PHP_ICONV_ERR_CONVERTER;
- }
-#else
- err = PHP_ICONV_ERR_UNKNOWN;
-#endif
- goto out;
- }
- }
- break;
-
- case 3:
- switch (*p1) {
- case 'B':
- enc_scheme = PHP_ICONV_ENC_SCHEME_BASE64;
- break;
-
- case 'Q':
- enc_scheme = PHP_ICONV_ENC_SCHEME_QPRINT;
- break;
-
- default:
- err = PHP_ICONV_ERR_MALFORMED;
- goto out;
- }
- scan_stat = 4;
- break;
-
- case 4:
- if (*p1 != '?') {
- err = PHP_ICONV_ERR_MALFORMED;
- goto out;
- }
- encoded_text = p1 + 1;
- scan_stat = 5;
- break;
-
- case 5:
- if (*p1 == '?') {
- char *decoded_text;
- size_t decoded_text_len;
-
- if (encoded_text == NULL) {
- err = PHP_ICONV_ERR_MALFORMED;
- goto out;
- }
-
- encoded_text_len = (size_t)(p1 - encoded_text);
- switch (enc_scheme) {
- case PHP_ICONV_ENC_SCHEME_BASE64:
- decoded_text = (char *)php_base64_decode((unsigned char*)encoded_text, (int)encoded_text_len, &decoded_text_len);
- break;
-
- case PHP_ICONV_ENC_SCHEME_QPRINT:
- decoded_text = (char *)php_quot_print_decode((unsigned char*)encoded_text, (int)encoded_text_len, &decoded_text_len);
- break;
- }
-
- if (decoded_text == NULL) {
- err = PHP_ICONV_ERR_UNKNOWN;
- goto out;
- }
-
- err = _php_iconv_appendl(pretval, decoded_text, decoded_text_len, cd);
- efree(decoded_text);
- if (err != PHP_ICONV_ERR_SUCCESS) {
- goto out;
- }
- scan_stat = 6;
- }
- break;
-
- case 6:
- if (*p1 != '=') {
- err = PHP_ICONV_ERR_MALFORMED;
- goto out;
- }
- scan_stat = 0;
- break;
-
- case 7:
- if (*p1 == '\n') {
- scan_stat = 8;
- } else {
- /* bare CR */
- _php_iconv_appendc(pretval, '\r', cd_pl);
- _php_iconv_appendc(pretval, *p1, cd_pl);
- }
- break;
-
- case 8:
- if (*p1 != ' ' && *p1 != '\t') {
- err = PHP_ICONV_ERR_MALFORMED;
- goto out;
- }
- scan_stat = 9;
- break;
-
- case 9:
- if (*p1 == '=') {
- scan_stat = 1;
- } else if (*p1 != ' ' && *p1 != '\t') {
- err = PHP_ICONV_ERR_MALFORMED;
- goto out;
- }
- break;
-
- case 10: /* language spec */
- if (*p1 == '?') {
- scan_stat = 3;
- }
- break;
- }
- }
-
- if (scan_stat != 0) {
- err = PHP_ICONV_ERR_MALFORMED;
- goto out;
- }
-
- if (cd != (iconv_t)(-1)) {
- if ((err = _php_iconv_appendl(pretval, NULL, 0, cd)) != PHP_ICONV_ERR_SUCCESS) {
- goto out;
- }
- }
- smart_str_0(pretval);
-out:
- if (cd != (iconv_t)(-1)) {
- icv_close(cd);
- }
- if (cd_pl != (iconv_t)(-1)) {
- icv_close(cd_pl);
- }
- return err;
-}
-/* }}} */
-
-/* {{{ php_iconv_show_error() */
-static void _php_iconv_show_error(php_iconv_err_t err, const char *out_charset, const char *in_charset TSRMLS_DC)
-{
- switch (err) {
- case PHP_ICONV_ERR_SUCCESS:
- break;
-
- case PHP_ICONV_ERR_CONVERTER:
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot open converter");
- break;
-
- case PHP_ICONV_ERR_WRONG_CHARSET:
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong charset, cannot convert from `%s' to `%s'",
- in_charset, out_charset);
- break;
-
- case PHP_ICONV_ERR_ILLEGAL_CHAR:
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected incomplete character in input string");
- break;
-
- case PHP_ICONV_ERR_ILLEGAL_SEQ:
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected illegal character in input string");
- break;
-
- case PHP_ICONV_ERR_TOO_BIG:
- /* should not happen */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Run out buffer");
- break;
-
- default:
- /* other error */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown error (%d)", errno);
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto int iconv_strlen(string str [, string charset])
- Returns the character count of str */
-PHP_FUNCTION(iconv_strlen)
-{
- char *charset;
- int charset_len;
- char *str;
- int str_len;
-
- php_iconv_err_t err;
-
- unsigned int retval;
-
- charset = ICONVG(internal_encoding);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s",
- &str, &str_len, &charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- err = _php_iconv_strlen(&retval, str, str_len, charset);
- _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC);
- if (err == PHP_ICONV_ERR_SUCCESS) {
- RETVAL_LONG(retval);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string iconv_substr(string str, int offset, [int length, string charset])
- Returns specified part of a string */
-PHP_FUNCTION(iconv_substr)
-{
- char *charset;
- int charset_len;
- char *str;
- int str_len;
- long offset, length;
- zval *len_z = NULL;
-
- php_iconv_err_t err;
-
- smart_str retval = {0};
-
- charset = ICONVG(internal_encoding);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|zs",
- &str, &str_len, &offset, &len_z,
- &charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (len_z == NULL) {
- length = str_len;
- } else {
- convert_to_long_ex(&len_z);
- length = Z_LVAL_P(len_z);
- }
-
- err = _php_iconv_substr(&retval, str, str_len, offset, length, charset);
- _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC);
-
- if (err == PHP_ICONV_ERR_SUCCESS && str != NULL) {
- if (retval.c != NULL) {
- RETVAL_STRINGL(retval.c, retval.len, 0);
- } else {
- RETVAL_EMPTY_STRING();
- }
- } else {
- smart_str_free(&retval);
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string iconv_strpos(string haystack, string needle, int offset [, string charset])
- Finds position of first occurrence of needle within part of haystack beginning with offset */
-PHP_FUNCTION(iconv_strpos)
-{
- char *charset;
- int charset_len;
- char *haystk;
- int haystk_len;
- char *ndl;
- int ndl_len;
- long offset;
-
- php_iconv_err_t err;
-
- unsigned int retval;
-
- offset = 0;
- charset = ICONVG(internal_encoding);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls",
- &haystk, &haystk_len, &ndl, &ndl_len,
- &offset, &charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (offset < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string.");
- RETURN_FALSE;
- }
-
- err = _php_iconv_strpos(&retval, haystk, haystk_len, ndl, ndl_len,
- offset, charset);
- _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC);
-
- if (err == PHP_ICONV_ERR_SUCCESS && retval != (unsigned int)-1) {
- RETVAL_LONG((long)retval);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string iconv_strrpos(string haystack, string needle [, string charset])
- Finds position of last occurrence of needle within part of haystack beginning with offset */
-PHP_FUNCTION(iconv_strrpos)
-{
- char *charset;
- int charset_len;
- char *haystk;
- int haystk_len;
- char *ndl;
- int ndl_len;
-
- php_iconv_err_t err;
-
- unsigned int retval;
-
- charset = ICONVG(internal_encoding);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|s",
- &haystk, &haystk_len, &ndl, &ndl_len,
- &charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- err = _php_iconv_strpos(&retval, haystk, haystk_len, ndl, ndl_len,
- -1, charset);
- _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC);
-
- if (err == PHP_ICONV_ERR_SUCCESS && retval != (unsigned int)-1) {
- RETVAL_LONG((long)retval);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string iconv_mime_encode(string field_name, string field_value, string scheme, string out_charset [, string in_charset, int line_len, string lfchars])
- Composes a mime header field with field_name and field_value in a specified scheme */
-PHP_FUNCTION(iconv_mime_encode)
-{
- char *field_name;
- int field_name_len;
- char *field_value;
- int field_value_len;
- char *scheme;
- int scheme_len;
- char *in_charset;
- int in_charset_len;
- char *out_charset;
- int out_charset_len;
- long line_len = 76;
- char *lfchars = "\r\n";
- int lfchars_len = sizeof("\r\n")-1;
-
- php_iconv_enc_scheme_t scheme_id = PHP_ICONV_ENC_SCHEME_BASE64;
-
- smart_str retval = {0};
-
- php_iconv_err_t err;
-
- in_charset = ICONVG(internal_encoding);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssss|sls",
- &field_name, &field_name_len, &field_value, &field_value_len,
- &scheme, &scheme_len, &out_charset, &out_charset_len,
- &in_charset, &in_charset_len, &line_len, &lfchars, &lfchars_len) == FAILURE) {
-
- RETURN_FALSE;
- }
-
- if (scheme_len > 0) {
- switch (scheme[0]) {
- case 'B': case 'b':
- scheme_id = PHP_ICONV_ENC_SCHEME_BASE64;
- break;
-
- case 'Q': case 'q':
- scheme_id = PHP_ICONV_ENC_SCHEME_QPRINT;
- break;
- }
- }
-
- err = _php_iconv_mime_encode(&retval, field_name, field_name_len,
- field_value, field_value_len, line_len, lfchars, scheme_id,
- out_charset, in_charset);
- _php_iconv_show_error(err, out_charset, in_charset TSRMLS_CC);
-
- if (err == PHP_ICONV_ERR_SUCCESS) {
- if (retval.c != NULL) {
- RETVAL_STRINGL(retval.c, retval.len, 0);
- } else {
- RETVAL_EMPTY_STRING();
- }
- } else {
- smart_str_free(&retval);
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string iconv_mime_decode(string encoded_string [, string charset])
- Decodes a mime header field */
-PHP_FUNCTION(iconv_mime_decode)
-{
- char *encoded_str;
- int encoded_str_len;
- char *charset;
- int charset_len;
-
- smart_str retval = {0};
-
- php_iconv_err_t err;
-
- charset = ICONVG(internal_encoding);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s",
- &encoded_str, &encoded_str_len, &charset, &charset_len) == FAILURE) {
-
- RETURN_FALSE;
- }
-
- err = _php_iconv_mime_decode(&retval, encoded_str, encoded_str_len, charset);
- _php_iconv_show_error(err, charset, "???" TSRMLS_CC);
-
- if (err == PHP_ICONV_ERR_SUCCESS) {
- if (retval.c != NULL) {
- RETVAL_STRINGL(retval.c, retval.len, 0);
- } else {
- RETVAL_EMPTY_STRING();
- }
- } else {
- smart_str_free(&retval);
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string iconv(string in_charset, string out_charset, string str)
- Returns str converted to the out_charset character set */
-PHP_NAMED_FUNCTION(php_if_iconv)
-{
- char *in_charset, *out_charset, *in_buffer, *out_buffer;
- size_t out_len;
- int in_charset_len, out_charset_len, in_buffer_len;
- php_iconv_err_t err;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss",
- &in_charset, &in_charset_len, &out_charset, &out_charset_len, &in_buffer, &in_buffer_len) == FAILURE)
- return;
-
- err = php_iconv_string(in_buffer, (size_t)in_buffer_len,
- &out_buffer, &out_len, out_charset, in_charset);
- _php_iconv_show_error(err, out_charset, in_charset TSRMLS_CC);
- if (out_buffer != NULL) {
- RETVAL_STRINGL(out_buffer, out_len, 0);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string ob_iconv_handler(string contents, int status)
- Returns str in output buffer converted to the iconv.output_encoding character set */
-PHP_FUNCTION(ob_iconv_handler)
-{
- char *out_buffer, *content_type, *mimetype = NULL, *s;
- zval *zv_string;
- unsigned int out_len;
- int mimetype_alloced = 0;
- long status;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &zv_string, &status) == FAILURE)
- return;
-
- convert_to_string_ex(&zv_string);
-
- if (SG(sapi_headers).mimetype &&
- strncasecmp(SG(sapi_headers).mimetype, "text/", 5) == 0) {
- if ((s = strchr(SG(sapi_headers).mimetype,';')) == NULL){
- mimetype = SG(sapi_headers).mimetype;
- } else {
- mimetype = estrndup(SG(sapi_headers).mimetype, s-SG(sapi_headers).mimetype);
- mimetype_alloced = 1;
- }
- } else if (SG(sapi_headers).send_default_content_type) {
- mimetype =(SG(default_mimetype) ? SG(default_mimetype) : SAPI_DEFAULT_MIMETYPE);
- }
- if (mimetype != NULL) {
- php_iconv_err_t err = php_iconv_string(Z_STRVAL_P(zv_string),
- Z_STRLEN_P(zv_string), &out_buffer, &out_len,
- ICONVG(output_encoding), ICONVG(internal_encoding));
- _php_iconv_show_error(err, ICONVG(output_encoding), ICONVG(internal_encoding) TSRMLS_CC);
- if (out_buffer != NULL) {
- spprintf(&content_type, 0, "Content-Type:%s; charset=%s", mimetype, ICONVG(output_encoding));
- if (content_type && sapi_add_header(content_type, strlen(content_type), 0) != FAILURE) {
- SG(sapi_headers).send_default_content_type = 0;
- }
- RETURN_STRINGL(out_buffer, out_len, 0);
- }
- if (mimetype_alloced) {
- efree(mimetype);
- }
- }
-
- zval_dtor(return_value);
- *return_value = *zv_string;
- zval_copy_ctor(return_value);
-}
-/* }}} */
-
-/* {{{ proto bool iconv_set_encoding(string type, string charset)
- Sets internal encoding and output encoding for ob_iconv_handler() */
-PHP_FUNCTION(iconv_set_encoding)
-{
- char *type, *charset;
- int type_len, charset_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &type, &type_len, &charset, &charset_len) == FAILURE)
- return;
-
- if(!strcasecmp("input_encoding", type)) {
- retval = zend_alter_ini_entry("iconv.input_encoding", sizeof("iconv.input_encoding"), charset, charset_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- } else if(!strcasecmp("output_encoding", type)) {
- retval = zend_alter_ini_entry("iconv.output_encoding", sizeof("iconv.output_encoding"), charset, charset_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- } else if(!strcasecmp("internal_encoding", type)) {
- retval = zend_alter_ini_entry("iconv.internal_encoding", sizeof("iconv.internal_encoding"), charset, charset_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- } else {
- RETURN_FALSE;
- }
-
- if (retval == SUCCESS) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array iconv_get_encoding([string type])
- Get internal encoding and output encoding for ob_iconv_handler() */
-PHP_FUNCTION(iconv_get_encoding)
-{
- char *type = "all";
- int type_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &type, &type_len) == FAILURE)
- return;
-
- if (!strcasecmp("all", type)) {
- array_init(return_value);
- add_assoc_string(return_value, "input_encoding", ICONVG(input_encoding), 1);
- add_assoc_string(return_value, "output_encoding", ICONVG(output_encoding), 1);
- add_assoc_string(return_value, "internal_encoding", ICONVG(internal_encoding), 1);
- } else if (!strcasecmp("input_encoding", type)) {
- RETVAL_STRING(ICONVG(input_encoding), 1);
- } else if (!strcasecmp("output_encoding", type)) {
- RETVAL_STRING(ICONVG(output_encoding), 1);
- } else if (!strcasecmp("internal_encoding", type)) {
- RETVAL_STRING(ICONVG(internal_encoding), 1);
- } else {
- RETURN_FALSE;
- }
-
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/iconv/iconv.dsp b/ext/iconv/iconv.dsp
deleted file mode 100644
index 946fa2dfb9..0000000000
--- a/ext/iconv/iconv.dsp
+++ /dev/null
@@ -1,107 +0,0 @@
-# Microsoft Developer Studio Project File - Name="iconv" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=iconv - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "iconv.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "iconv.mak" CFG="iconv - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "iconv - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "iconv - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "iconv - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ICONV_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /I "..\..\..\php_build\iconv\include" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_ICONV" /D "HAVE_ICONV" /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZTS=1 /D "ICONV_SUPPORTS_ERRNO" /D "HAVE_LIBICONV" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib iconv-1.3.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_iconv.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\iconv\lib"
-
-!ELSEIF "$(CFG)" == "iconv - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ICONV_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /I "..\..\..\php_build\iconv\include" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_ICONV" /D "ZEND_WIN32" /D "PHP_WIN32" /D "HAVE_ICONV" /D ZTS=1 /D "HAVE_LIBICONV" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib iconv-1.3.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_iconv.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\iconv\lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "iconv - Win32 Release_TS"
-# Name "iconv - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\iconv.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_iconv.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/iconv/php_iconv.h b/ext/iconv/php_iconv.h
deleted file mode 100644
index 93a28662ae..0000000000
--- a/ext/iconv/php_iconv.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rui Hirokawa <rui_hirokawa@ybb.ne.jp> |
- | Stig Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_ICONV_H
-#define PHP_ICONV_H
-
-#ifdef PHP_WIN32
-#define PHP_ICONV_API __declspec(dllexport)
-#else
-#define PHP_ICONV_API
-#endif
-
-#ifdef PHP_ATOM_INC
-#include "php_have_iconv.h"
-#include "php_have_libiconv.h"
-#endif
-
-
-#ifdef HAVE_ICONV
-extern zend_module_entry iconv_module_entry;
-#define iconv_module_ptr &iconv_module_entry
-
-PHP_MINIT_FUNCTION(miconv);
-PHP_MSHUTDOWN_FUNCTION(miconv);
-PHP_MINFO_FUNCTION(miconv);
-
-PHP_NAMED_FUNCTION(php_if_iconv);
-PHP_FUNCTION(ob_iconv_handler);
-PHP_FUNCTION(iconv_get_encoding);
-PHP_FUNCTION(iconv_set_encoding);
-PHP_FUNCTION(iconv_strlen);
-PHP_FUNCTION(iconv_substr);
-PHP_FUNCTION(iconv_strpos);
-PHP_FUNCTION(iconv_strrpos);
-PHP_FUNCTION(iconv_mime_encode);
-PHP_FUNCTION(iconv_mime_decode);
-
-ZEND_BEGIN_MODULE_GLOBALS(iconv)
- char *input_encoding;
- char *internal_encoding;
- char *output_encoding;
-ZEND_END_MODULE_GLOBALS(iconv)
-
-#ifdef ZTS
-#define ICONVG(v) TSRMG(iconv_globals_id, zend_iconv_globals *, v)
-#else
-#define ICONVG(v) (iconv_globals.v)
-#endif
-
-#define ICONV_INPUT_ENCODING "ISO-8859-1"
-#define ICONV_OUTPUT_ENCODING "ISO-8859-1"
-#define ICONV_INTERNAL_ENCODING "ISO-8859-1"
-
-#else
-
-#define iconv_module_ptr NULL
-
-#endif /* HAVE_ICONV */
-
-#define phpext_iconv_ptr iconv_module_ptr
-
-#endif /* PHP_ICONV_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/iconv/tests/Quotes.UTF-8 b/ext/iconv/tests/Quotes.UTF-8
deleted file mode 100644
index 3d48ee970a..0000000000
--- a/ext/iconv/tests/Quotes.UTF-8
+++ /dev/null
@@ -1,4 +0,0 @@
-“Helloâ€
-‘Hello’
-„Helloâ€
-‚Hello’
diff --git a/ext/iconv/tests/bug16069.phpt b/ext/iconv/tests/bug16069.phpt
deleted file mode 100644
index 0d58defe3c..0000000000
--- a/ext/iconv/tests/bug16069.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Bug #16069
---SKIPIF--
-<?php
-/* include( 'skipif.inc' ); */
-if (@iconv('CP932', 'EUC-JP//TRANSLIT', "\x87\x6d")=='') {
- die("skip CP932 translit not available\n");
-}
-?>
---INI--
-error_reporting=2039
---FILE--
-<?php
-/* include('test.inc'); */
-/* charset=CP932, KOI8-R */
-$str = "\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d";
-print iconv( "CP932", "EUC-JP//TRANSLIT", $str );
-$str = "(\x9c\xe4\x9c)";
-print iconv( "KOI8-R", "EUC-JP//TRANSLIT", $str );
-?>
---EXPECT--
-¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë¥ß¥ê¥Ð¡¼¥ë(¡ë§¥¡ë)
diff --git a/ext/iconv/tests/eucjp2iso2022jp.phpt b/ext/iconv/tests/eucjp2iso2022jp.phpt
deleted file mode 100644
index 13dab43d4c..0000000000
--- a/ext/iconv/tests/eucjp2iso2022jp.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-EUC-JP to ISO-2022-JP
---SKIPIF--
-<?php /* include('skipif.inc'); */ ?>
---INI--
-error_reporting=2039
---FILE--
-<?php
-/* include('test.inc'); */
-/* charset=EUC-JP */
-
-function hexdump($str) {
- $len = strlen($str);
- for ($i = 0; $i < $len; ++$i) {
- printf("%02x", ord($str{$i}));
- }
- print "\n";
-}
-
-$str = str_repeat("ÆüËܸì¥Æ¥­¥¹¥È¤È English text", 30);
-$str .= "ÆüËܸì";
-
-echo hexdump(iconv("EUC-JP", "ISO-2022-JP", $str));
-?>
---EXPECT--
-1b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c2546252d2539254824481b284220456e676c69736820746578741b2442467c4b5c386c1b2842
-
diff --git a/ext/iconv/tests/eucjp2sjis.phpt b/ext/iconv/tests/eucjp2sjis.phpt
deleted file mode 100644
index c1cac62e85..0000000000
--- a/ext/iconv/tests/eucjp2sjis.phpt
+++ /dev/null
@@ -1,58 +0,0 @@
---TEST--
-EUC-JP to SJIS
---SKIPIF--
-<?php /* include('skipif.inc'); */ ?>
---INI--
-error_reporting=2039
---FILE--
-<?php
-/* include('test.inc'); */
-/* charset=EUC-JP */
-
-$str = "
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-";
-
-$str = iconv("EUC-JP", "SJIS", $str);
-$str = base64_encode($str);
-echo $str."\n";
-
-?>
---EXPECT--
-CpP6lnuM6oNlg0yDWINngsZFbmdsaXNoIFRleHQKk/qWe4zqg2WDTINYg2eCxkVuZ2xpc2ggVGV4dAqT+pZ7jOqDZYNMg1iDZ4LGRW5nbGlzaCBUZXh0CpP6lnuM6oNlg0yDWINngsZFbmdsaXNoIFRleHQKk/qWe4zqg2WDTINYg2eCxkVuZ2xpc2ggVGV4dAqT+pZ7jOqDZYNMg1iDZ4LGRW5nbGlzaCBUZXh0CpP6lnuM6oNlg0yDWINngsZFbmdsaXNoIFRleHQKk/qWe4zqg2WDTINYg2eCxkVuZ2xpc2ggVGV4dAqT+pZ7jOqDZYNMg1iDZ4LGRW5nbGlzaCBUZXh0CpP6lnuM6oNlg0yDWINngsZFbmdsaXNoIFRleHQKk/qWe4zqg2WDTINYg2eCxkVuZ2xpc2ggVGV4dAqT+pZ7jOqDZYNMg1iDZ4LGRW5nbGlzaCBUZXh0CpP6lnuM6oNlg0yDWINngsZFbmdsaXNoIFRleHQKk/qWe4zqg2WDTINYg2eCxkVuZ2xpc2ggVGV4dAqT+pZ7jOqDZYNMg1iDZ4LGRW5nbGlzaCBUZXh0CpP6lnuM6oNlg0yDWINngsZFbmdsaXNoIFRleHQKk/qWe4zqg2WDTINYg2eCxkVuZ2xpc2ggVGV4dAqT+pZ7jOqDZYNMg1iDZ4LGRW5nbGlzaCBUZXh0CpP6lnuM6oNlg0yDWINngsZFbmdsaXNoIFRleHQKk/qWe4zqg2WDTINYg2eCxkVuZ2xpc2ggVGV4dAqT+pZ7jOqDZYNMg1iDZ4LGRW5nbGlzaCBUZXh0CpP6lnuM6oNlg0yDWINngsZFbmdsaXNoIFRleHQKk/qWe4zqg2WDTINYg2eCxkVuZ2xpc2ggVGV4dAqT+pZ7jOqDZYNMg1iDZ4LGRW5nbGlzaCBUZXh0CpP6lnuM6oNlg0yDWINngsZFbmdsaXNoIFRleHQKk/qWe4zqg2WDTINYg2eCxkVuZ2xpc2ggVGV4dAqT+pZ7jOqDZYNMg1iDZ4LGRW5nbGlzaCBUZXh0CpP6lnuM6oNlg0yDWINngsZFbmdsaXNoIFRleHQKk/qWe4zqg2WDTINYg2eCxkVuZ2xpc2ggVGV4dAqT+pZ7jOqDZYNMg1iDZ4LGRW5nbGlzaCBUZXh0CpP6lnuM6oNlg0yDWINngsZFbmdsaXNoIFRleHQKk/qWe4zqg2WDTINYg2eCxkVuZ2xpc2ggVGV4dAqT+pZ7jOqDZYNMg1iDZ4LGRW5nbGlzaCBUZXh0CpP6lnuM6oNlg0yDWINngsZFbmdsaXNoIFRleHQKk/qWe4zqg2WDTINYg2eCxkVuZ2xpc2ggVGV4dAqT+pZ7jOqDZYNMg1iDZ4LGRW5nbGlzaCBUZXh0Cg==
-
diff --git a/ext/iconv/tests/eucjp2utf8.phpt b/ext/iconv/tests/eucjp2utf8.phpt
deleted file mode 100644
index 2100385cd6..0000000000
--- a/ext/iconv/tests/eucjp2utf8.phpt
+++ /dev/null
@@ -1,58 +0,0 @@
---TEST--
-EUC-JP to UTF8
---SKIPIF--
-<?php /* include('skipif.inc'); */ ?>
---INI--
-error_reporting=2039
---FILE--
-<?php
-/* include('test.inc'); */
-/* charset=EUC-JP */
-
-$str = "
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-ÆüËܸì¥Æ¥­¥¹¥È¤ÈEnglish Text
-";
-
-$str = iconv("EUC-JP", "UTF-8", $str); /* libiconv(1.8) doesn't know "UTF8" but "UTF-8". */
-$str = base64_encode($str);
-echo $str."\n";
-
-?>
---EXPECT--
-CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0Cg==
-
diff --git a/ext/iconv/tests/iconv001.phpt b/ext/iconv/tests/iconv001.phpt
deleted file mode 100644
index d2c1f3ed60..0000000000
--- a/ext/iconv/tests/iconv001.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-iconv() test 1
---SKIPIF--
-<?php /* include('skipif.inc'); */ ?>
---INI--
-error_reporting=2039
---FILE--
-<?php
-/* include('test.inc'); */
-echo "iconv extension is available\n";
-$test = "æøå";
-var_dump("ISO-8859-1: $test");
-var_dump("UTF-8: ".iconv( "ISO-8859-1", "UTF-8", $test ) );
-?>
---EXPECT--
-iconv extension is available
-string(15) "ISO-8859-1: æøå"
-string(13) "UTF-8: æøå"
diff --git a/ext/iconv/tests/iconv002.phpt b/ext/iconv/tests/iconv002.phpt
deleted file mode 100644
index 8aded58866..0000000000
--- a/ext/iconv/tests/iconv002.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-iconv() test 2 (UCS4BE to ASCII)
---SKIPIF--
-<?php
-/* include('skipif.inc'); */
-if (@iconv("ascii","UCS-4LE", "abcd") == '') {
- die("skip conversion to UCS-4LE not supported");
-}
-?>
---INI--
-error_reporting=2039
---FILE--
-<?php
-/* include('test.inc'); */
-/*
-Expected output:
-&#97;&#98;&#99;&#100;
-abcd
-*/
-
- $s = unpack("V*", iconv("ascii","UCS-4LE", "abcd"));
- foreach($s as $c) { print "&#$c;"; } print "\n";
-
- $s = pack("NNNN", 97, 98, 99, 100);
- $q = iconv("UCS-4BE", "ascii", $s);
- print $q; print "\n";
-?>
---EXPECT--
-&#97;&#98;&#99;&#100;
-abcd
diff --git a/ext/iconv/tests/iconv003.phpt b/ext/iconv/tests/iconv003.phpt
deleted file mode 100644
index 9fcfe4b0cd..0000000000
--- a/ext/iconv/tests/iconv003.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-iconv() test 3
---FILE--
-<?php
-for ($i = 0; $i < 3; ++$i) {
- if (@iconv('blah', 'blah', 'blah') != '') {
- die("failed\n");
- }
-}
-echo "success\n";
-?>
---EXPECT--
-success
diff --git a/ext/iconv/tests/iconv_mime_decode.phpt b/ext/iconv/tests/iconv_mime_decode.phpt
deleted file mode 100644
index 32682c8d10..0000000000
--- a/ext/iconv/tests/iconv_mime_decode.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-iconv_mime_decode() (quoted-printable)
---SKIPIF--
-<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
---INI--
-iconv.internal_charset=iso-8859-1
---FILE--
-<?php
-$header = <<< HERE
-Subject: =?ISO-8859-1?Q?Pr=FCfung?=
- =?ISO-8859-1*de_DE?Q?=20Pr=FCfung?=
- =?ISO-8859-2?Q?k=F9=D4=F1=D3let?=
-HERE;
-$result = iconv_mime_decode($header, "UTF-8");
-printf("(%d) \"%s\"\n", iconv_strlen($result, "UTF-8"), $result);
---EXPECT--
-(33) "Subject: Prüfung Prüfung kůÔńÓlet"
diff --git a/ext/iconv/tests/iconv_mime_encode.phpt b/ext/iconv/tests/iconv_mime_encode.phpt
deleted file mode 100644
index 1c58640200..0000000000
--- a/ext/iconv/tests/iconv_mime_encode.phpt
+++ /dev/null
@@ -1,393 +0,0 @@
---TEST--
-iconv_mime_encode()
---SKIPIF--
-<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
---INI--
-iconv.internal_charset=iso-8859-1
---FILE--
-<?php
-function my_error_handler($errno, $errmsg, $filename, $linenum, $vars)
-{
- echo "$errno: $errmsg\n";
-}
-set_error_handler('my_error_handler');
-for ($line_len= 0; $line_len < 80; ++$line_len) {
- print "-------- line length=$line_len\n";
- $result = iconv_mime_encode("From", "¥µ¥ó¥×¥ëʸ»úÎó¥µ¥ó¥×¥ëʸ»úÎóÆüËܸì¥Æ¥­¥¹¥È", "B", "ISO-2022-JP", "EUC-JP", $line_len, "\n");
- var_dump($result);
- if ($result !== false) {
- list($max) = rsort(array_map("strlen", explode("\n", $result)));
- print "-------- ";
- var_dump(($max <= $line_len));
- } else {
- print "-------- \n";
- }
-}
-?>
---EXPECTF--
--------- line length=0
-2: %s
-bool(false)
---------
--------- line length=1
-2: %s
-bool(false)
---------
--------- line length=2
-2: %s
-bool(false)
---------
--------- line length=3
-2: %s
-bool(false)
---------
--------- line length=4
-2: %s
-bool(false)
---------
--------- line length=5
-2: %s
-bool(false)
---------
--------- line length=6
-2: %s
-bool(false)
---------
--------- line length=7
-2: %s
-bool(false)
---------
--------- line length=8
-2: %s
-bool(false)
---------
--------- line length=9
-2: %s
-bool(false)
---------
--------- line length=10
-2: %s
-bool(false)
---------
--------- line length=11
-2: %s
-bool(false)
---------
--------- line length=12
-2: %s
-bool(false)
---------
--------- line length=13
-2: %s
-bool(false)
---------
--------- line length=14
-2: %s
-bool(false)
---------
--------- line length=15
-2: %s
-bool(false)
---------
--------- line length=16
-2: %s
-bool(false)
---------
--------- line length=17
-2: %s
-bool(false)
---------
--------- line length=18
-2: %s
-bool(false)
---------
--------- line length=19
-2: %s
-bool(false)
---------
--------- line length=20
-2: %s
-bool(false)
---------
--------- line length=21
-2: %s
-bool(false)
---------
--------- line length=22
-2: %s
-bool(false)
---------
--------- line length=23
-2: %s
-bool(false)
---------
--------- line length=24
-2: %s
-bool(false)
---------
--------- line length=25
-2: %s
-bool(false)
---------
--------- line length=26
-2: %s
-bool(false)
---------
--------- line length=27
-2: %s
-bool(false)
---------
--------- line length=28
-2: %s
-bool(false)
---------
--------- line length=29
-2: %s
-bool(false)
---------
--------- line length=30
-2: %s
-bool(false)
---------
--------- line length=31
-2: %s
-bool(false)
---------
--------- line length=32
-2: %s
-bool(false)
---------
--------- line length=33
-2: %s
-bool(false)
---------
--------- line length=34
-2: %s
-bool(false)
---------
--------- line length=35
-2: %s
-bool(false)
---------
--------- line length=36
-string(216) "From: =?ISO-2022-JP?B?GyRCJTUbKEI=?=
- =?ISO-2022-JP?B?JXMlVyVrSjgbKEI=?=
- =?ISO-2022-JP?B?O3pOcyU1JXMbKEI=?=
- =?ISO-2022-JP?B?JVcla0o4O3obKEI=?=
- =?ISO-2022-JP?B?TnNGfEtcOGwbKEI=?=
- =?ISO-2022-JP?B?JUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=37
-string(216) "From: =?ISO-2022-JP?B?GyRCJTUbKEI=?=
- =?ISO-2022-JP?B?JXMlVyVrSjgbKEI=?=
- =?ISO-2022-JP?B?O3pOcyU1JXMbKEI=?=
- =?ISO-2022-JP?B?JVcla0o4O3obKEI=?=
- =?ISO-2022-JP?B?TnNGfEtcOGwbKEI=?=
- =?ISO-2022-JP?B?JUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=38
-string(216) "From: =?ISO-2022-JP?B?GyRCJTUbKEI=?=
- =?ISO-2022-JP?B?JXMlVyVrSjgbKEI=?=
- =?ISO-2022-JP?B?O3pOcyU1JXMbKEI=?=
- =?ISO-2022-JP?B?JVcla0o4O3obKEI=?=
- =?ISO-2022-JP?B?TnNGfEtcOGwbKEI=?=
- =?ISO-2022-JP?B?JUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=39
-string(196) "From: =?ISO-2022-JP?B?GyRCJTUbKEI=?=
- =?ISO-2022-JP?B?JXMlVyVrSjg7ehsoQg==?=
- =?ISO-2022-JP?B?TnMlNSVzJVclaxsoQg==?=
- =?ISO-2022-JP?B?Sjg7ek5zRnxLXBsoQg==?=
- =?ISO-2022-JP?B?OGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=40
-string(196) "From: =?ISO-2022-JP?B?GyRCJTUlcxsoQg==?=
- =?ISO-2022-JP?B?JVcla0o4O3pOcxsoQg==?=
- =?ISO-2022-JP?B?JTUlcyVXJWtKOBsoQg==?=
- =?ISO-2022-JP?B?O3pOc0Z8S1w4bBsoQg==?=
- =?ISO-2022-JP?B?JUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=41
-string(196) "From: =?ISO-2022-JP?B?GyRCJTUlcxsoQg==?=
- =?ISO-2022-JP?B?JVcla0o4O3pOcxsoQg==?=
- =?ISO-2022-JP?B?JTUlcyVXJWtKOBsoQg==?=
- =?ISO-2022-JP?B?O3pOc0Z8S1w4bBsoQg==?=
- =?ISO-2022-JP?B?JUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=42
-string(196) "From: =?ISO-2022-JP?B?GyRCJTUlcxsoQg==?=
- =?ISO-2022-JP?B?JVcla0o4O3pOcxsoQg==?=
- =?ISO-2022-JP?B?JTUlcyVXJWtKOBsoQg==?=
- =?ISO-2022-JP?B?O3pOc0Z8S1w4bBsoQg==?=
- =?ISO-2022-JP?B?JUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=43
-string(168) "From: =?ISO-2022-JP?B?GyRCJTUlcxsoQg==?=
- =?ISO-2022-JP?B?JVcla0o4O3pOcyU1JXMbKEI=?=
- =?ISO-2022-JP?B?JVcla0o4O3pOc0Z8S1wbKEI=?=
- =?ISO-2022-JP?B?OGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=44
-string(164) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWsbKEI=?=
- =?ISO-2022-JP?B?Sjg7ek5zJTUlcyVXJWsbKEI=?=
- =?ISO-2022-JP?B?Sjg7ek5zRnxLXDhsJUYbKEI=?=
- =?ISO-2022-JP?B?JS0lOSVIGyhC?="
--------- bool(true)
--------- line length=45
-string(164) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWsbKEI=?=
- =?ISO-2022-JP?B?Sjg7ek5zJTUlcyVXJWsbKEI=?=
- =?ISO-2022-JP?B?Sjg7ek5zRnxLXDhsJUYbKEI=?=
- =?ISO-2022-JP?B?JS0lOSVIGyhC?="
--------- bool(true)
--------- line length=46
-string(164) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWsbKEI=?=
- =?ISO-2022-JP?B?Sjg7ek5zJTUlcyVXJWsbKEI=?=
- =?ISO-2022-JP?B?Sjg7ek5zRnxLXDhsJUYbKEI=?=
- =?ISO-2022-JP?B?JS0lOSVIGyhC?="
--------- bool(true)
--------- line length=47
-string(168) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWsbKEI=?=
- =?ISO-2022-JP?B?Sjg7ek5zJTUlcyVXJWtKOBsoQg==?=
- =?ISO-2022-JP?B?O3pOc0Z8S1w4bCVGJS0lORsoQg==?=
- =?ISO-2022-JP?B?JUgbKEI=?="
--------- bool(true)
--------- line length=48
-string(144) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKOBsoQg==?=
- =?ISO-2022-JP?B?O3pOcyU1JXMlVyVrSjg7ehsoQg==?=
- =?ISO-2022-JP?B?TnNGfEtcOGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=49
-string(144) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKOBsoQg==?=
- =?ISO-2022-JP?B?O3pOcyU1JXMlVyVrSjg7ehsoQg==?=
- =?ISO-2022-JP?B?TnNGfEtcOGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=50
-string(144) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKOBsoQg==?=
- =?ISO-2022-JP?B?O3pOcyU1JXMlVyVrSjg7ehsoQg==?=
- =?ISO-2022-JP?B?TnNGfEtcOGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=51
-string(140) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKOBsoQg==?=
- =?ISO-2022-JP?B?O3pOcyU1JXMlVyVrSjg7ek5zRnwbKEI=?=
- =?ISO-2022-JP?B?S1w4bCVGJS0lOSVIGyhC?="
--------- bool(true)
--------- line length=52
-string(140) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMbKEI=?=
- =?ISO-2022-JP?B?JTUlcyVXJWtKODt6TnNGfEtcOGwbKEI=?=
- =?ISO-2022-JP?B?JUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=53
-string(140) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMbKEI=?=
- =?ISO-2022-JP?B?JTUlcyVXJWtKODt6TnNGfEtcOGwbKEI=?=
- =?ISO-2022-JP?B?JUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=54
-string(140) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMbKEI=?=
- =?ISO-2022-JP?B?JTUlcyVXJWtKODt6TnNGfEtcOGwbKEI=?=
- =?ISO-2022-JP?B?JUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=55
-string(140) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMbKEI=?=
- =?ISO-2022-JP?B?JTUlcyVXJWtKODt6TnNGfEtcOGwlRhsoQg==?=
- =?ISO-2022-JP?B?JS0lOSVIGyhC?="
--------- bool(true)
--------- line length=56
-string(144) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNRsoQg==?=
- =?ISO-2022-JP?B?JXMlVyVrSjg7ek5zRnxLXDhsJUYlLRsoQg==?=
- =?ISO-2022-JP?B?JTklSBsoQg==?="
--------- bool(true)
--------- line length=57
-string(144) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNRsoQg==?=
- =?ISO-2022-JP?B?JXMlVyVrSjg7ek5zRnxLXDhsJUYlLRsoQg==?=
- =?ISO-2022-JP?B?JTklSBsoQg==?="
--------- bool(true)
--------- line length=58
-string(144) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNRsoQg==?=
- =?ISO-2022-JP?B?JXMlVyVrSjg7ek5zRnxLXDhsJUYlLRsoQg==?=
- =?ISO-2022-JP?B?JTklSBsoQg==?="
--------- bool(true)
--------- line length=59
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNRsoQg==?=
- =?ISO-2022-JP?B?JXMlVyVrSjg7ek5zRnxLXDhsJUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=60
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcbKEI=?=
- =?ISO-2022-JP?B?JWtKODt6TnNGfEtcOGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=61
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcbKEI=?=
- =?ISO-2022-JP?B?JWtKODt6TnNGfEtcOGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=62
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcbKEI=?=
- =?ISO-2022-JP?B?JWtKODt6TnNGfEtcOGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=63
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcbKEI=?=
- =?ISO-2022-JP?B?JWtKODt6TnNGfEtcOGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=64
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVclaxsoQg==?=
- =?ISO-2022-JP?B?Sjg7ek5zRnxLXDhsJUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=65
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVclaxsoQg==?=
- =?ISO-2022-JP?B?Sjg7ek5zRnxLXDhsJUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=66
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVclaxsoQg==?=
- =?ISO-2022-JP?B?Sjg7ek5zRnxLXDhsJUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=67
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVclaxsoQg==?=
- =?ISO-2022-JP?B?Sjg7ek5zRnxLXDhsJUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=68
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3obKEI=?=
- =?ISO-2022-JP?B?TnNGfEtcOGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=69
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3obKEI=?=
- =?ISO-2022-JP?B?TnNGfEtcOGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=70
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3obKEI=?=
- =?ISO-2022-JP?B?TnNGfEtcOGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=71
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3obKEI=?=
- =?ISO-2022-JP?B?TnNGfEtcOGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=72
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOcxsoQg==?=
- =?ISO-2022-JP?B?RnxLXDhsJUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=73
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOcxsoQg==?=
- =?ISO-2022-JP?B?RnxLXDhsJUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=74
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOcxsoQg==?=
- =?ISO-2022-JP?B?RnxLXDhsJUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=75
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOcxsoQg==?=
- =?ISO-2022-JP?B?RnxLXDhsJUYlLSU5JUgbKEI=?="
--------- bool(true)
--------- line length=76
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOc0Z8S1wbKEI=?=
- =?ISO-2022-JP?B?OGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=77
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOc0Z8S1wbKEI=?=
- =?ISO-2022-JP?B?OGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=78
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOc0Z8S1wbKEI=?=
- =?ISO-2022-JP?B?OGwlRiUtJTklSBsoQg==?="
--------- bool(true)
--------- line length=79
-string(116) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOc0Z8S1wbKEI=?=
- =?ISO-2022-JP?B?OGwlRiUtJTklSBsoQg==?="
--------- bool(true)
-
diff --git a/ext/iconv/tests/iconv_strlen.phpt b/ext/iconv/tests/iconv_strlen.phpt
deleted file mode 100644
index 2c815f4f31..0000000000
--- a/ext/iconv/tests/iconv_strlen.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-iconv_strlen()
---SKIPIF--
-<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
---FILE--
-<?php
-function foo($str, $charset) {
- var_dump(strlen($str));
- var_dump(iconv_strlen($str, $charset));
-}
-
-foo("abc", "ASCII");
-foo("ÆüËܸì EUC-JP", "EUC-JP");
-?>
---EXPECT--
-int(3)
-int(3)
-int(13)
-int(10)
diff --git a/ext/iconv/tests/iconv_strpos.phpt b/ext/iconv/tests/iconv_strpos.phpt
deleted file mode 100644
index ccf4ea74a7..0000000000
--- a/ext/iconv/tests/iconv_strpos.phpt
+++ /dev/null
@@ -1,52 +0,0 @@
---TEST--
-iconv_strpos()
---SKIPIF--
-<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
---INI--
-iconv.internal_charset=ISO-8859-1
---FILE--
-<?php
-function my_error_handler($errno, $errmsg, $filename, $linenum, $vars)
-{
- echo "$errno: $errmsg\n";
-}
-set_error_handler('my_error_handler');
-function foo($haystk, $needle, $offset, $to_charset = false, $from_charset = false)
-{
- if ($from_charset !== false) {
- $haystk = iconv($from_charset, $to_charset, $haystk);
- }
- var_dump(strpos($haystk, $needle, $offset));
- if ($to_charset !== false) {
- var_dump(iconv_strpos($haystk, $needle, $offset, $to_charset));
- } else {
- var_dump(iconv_strpos($haystk, $needle, $offset));
- }
-}
-foo("abecdbcdabef", "bcd", -1);
-foo("abecdbcdabef", "bcd", 100000);
-foo("abcabcabcdabcababcdabc", "bcd", 0);
-foo("abcabcabcdabcababcdabc", "bcd", 10);
-foo(str_repeat("abcab", 60)."abcdb".str_repeat("adabc", 60), "abcd", 0);
-foo(str_repeat("¤¢¤¤¤¦¤¨¤ª", 30)."¤¤¤¦¤ª¤¨¤¢".str_repeat("¤¢¤¤¤¨¤ª¤¦", 30), "¤¦¤ª", 0, "EUC-JP");
-$str = str_repeat("¤¢¤¤¤¦¤¨¤ª", 60).'$'.str_repeat("¤¢¤¤¤¨¤ª¤¦", 60);
-foo($str, '$', 0, "ISO-2022-JP", "EUC-JP");
-?>
---EXPECTF--
-2: %s
-bool(false)
-2: %s
-bool(false)
-2: %s
-bool(false)
-bool(false)
-int(7)
-int(7)
-int(16)
-int(16)
-int(300)
-int(300)
-int(302)
-int(151)
-int(1)
-int(300)
diff --git a/ext/iconv/tests/iconv_strrpos.phpt b/ext/iconv/tests/iconv_strrpos.phpt
deleted file mode 100644
index f150f88422..0000000000
--- a/ext/iconv/tests/iconv_strrpos.phpt
+++ /dev/null
@@ -1,56 +0,0 @@
---TEST--
-iconv_strrpos()
---SKIPIF--
-<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
---INI--
-iconv.internal_charset=ISO-8859-1
---FILE--
-<?php
-function my_error_handler($errno, $errmsg, $filename, $linenum, $vars)
-{
- echo "$errno: $errmsg\n";
-}
-set_error_handler('my_error_handler');
-function foo($haystk, $needle, $to_charset = false, $from_charset = false)
-{
- if ($from_charset !== false) {
- $haystk = iconv($from_charset, $to_charset, $haystk);
- }
- if ($to_charset !== false) {
- var_dump(iconv_strlen($haystk, $to_charset));
- var_dump(iconv_strrpos($haystk, $needle, $to_charset));
- } else {
- var_dump(iconv_strlen($haystk));
- var_dump(iconv_strrpos($haystk, $needle));
- }
-}
-foo("abecdbcdabcdef", "bcd");
-foo(str_repeat("abcab", 60)."abcdb".str_repeat("adabc", 60), "abcd");
-foo(str_repeat("¤¢¤¤¤¦¤¨¤ª", 30)."¤¤¤¦¤ª¤¨¤¢".str_repeat("¤¢¤¤¤¨¤ª¤¦", 30), "¤¦¤ª", "EUC-JP");
-
-for ($i = 0; $i <=6; ++$i) {
- $str = str_repeat("¤¢¤¤¤¦¤¨¤ª", 60).str_repeat('$', $i).str_repeat("¤¢¤¤¤¨¤ª¤¦", 60);
- foo($str, '$', "ISO-2022-JP", "EUC-JP");
-}
-?>
---EXPECT--
-int(14)
-int(9)
-int(605)
-int(300)
-int(305)
-int(151)
-int(600)
-bool(false)
-int(601)
-int(300)
-int(602)
-int(301)
-int(603)
-int(302)
-int(604)
-int(303)
-int(605)
-int(304)
-int(606)
-int(305)
diff --git a/ext/iconv/tests/iconv_substr.phpt b/ext/iconv/tests/iconv_substr.phpt
deleted file mode 100644
index efa746e6de..0000000000
--- a/ext/iconv/tests/iconv_substr.phpt
+++ /dev/null
@@ -1,59 +0,0 @@
---TEST--
-iconv_substr()
---SKIPIF--
-<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
---INI--
-iconv.internal_charset=ISO-8859-1
---FILE--
-<?php
-function hexdump($str) {
- $len = strlen($str);
- for ($i = 0; $i < $len; ++$i) {
- printf("%02x", ord($str{$i}));
- }
- print "\n";
-}
-
-function foo($str, $offset, $len, $charset) {
- hexdump(substr($str, $offset, $len));
- hexdump(iconv_substr($str, $offset, $len, $charset));
-}
-
-function bar($str, $offset, $len = false) {
- if (is_bool($len)) {
- var_dump(substr($str, $offset));
- var_dump(iconv_substr($str, $offset));
- } else {
- var_dump(substr($str, $offset, $len));
- var_dump(iconv_substr($str, $offset, $len));
- }
-}
-
-foo("abcdefghijklmnopqrstuvwxyz", 5, 7, "ASCII");
-foo("¤¢¤¤¤¦¤¨¤ª¤«¤­¤¯¤±¤³¤µ¤·¤¹", 5, 7, "EUC-JP");
-bar("This is a test", 100000);
-bar("This is a test", 0, 100000);
-bar("This is a test", -3);
-bar("This is a test", 0, -9);
-bar("This is a test", 0, -100000);
-bar("This is a test", -9, -100000);
-var_dump(iconv("ISO-2022-JP", "EUC-JP", iconv_substr(iconv("EUC-JP", "ISO-2022-JP", "¤³¤ó¤Ë¤Á¤Ï ISO-2022-JP"), 3, 8, "ISO-2022-JP")));
-?>
---EXPECT--
-666768696a6b6c
-666768696a6b6c
-a6a4a8a4aaa4ab
-a4aba4ada4afa4b1a4b3a4b5a4b7
-bool(false)
-string(0) ""
-string(14) "This is a test"
-string(14) "This is a test"
-string(3) "est"
-string(3) "est"
-string(5) "This "
-string(5) "This "
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-string(10) "¤Á¤Ï ISO-2"
diff --git a/ext/iconv/tests/ob_iconv_handler.phpt b/ext/iconv/tests/ob_iconv_handler.phpt
deleted file mode 100644
index f26f87e97c..0000000000
--- a/ext/iconv/tests/ob_iconv_handler.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-ob_iconv_handler()
---SKIPIF--
-<?php /* include('skipif.inc'); */ ?>
---INI--
-error_reporting=2039
---FILE--
-<?php
-/* include('test.inc'); */
-iconv_set_encoding('internal_encoding', 'EUC-JP');
-iconv_set_encoding('output_encoding', 'Shift_JIS');
-ob_start('ob_iconv_handler');
-print "¤¢¤¤¤¦¤¨¤ª";
-ob_end_flush();
-?>
---EXPECT--
-‚ ‚¢‚¤‚¦‚¨
diff --git a/ext/iconv/tests/skipif.inc b/ext/iconv/tests/skipif.inc
deleted file mode 100644
index 6f7bbf2b86..0000000000
--- a/ext/iconv/tests/skipif.inc
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-// This script prints "skip" if condition does not meet.
-
-// Do not dl load extension
-//if (!extension_loaded("iconv") && ini_get("enable_dl")) {
-// $dlext = (substr(PHP_OS, 0, 3) == "WIN") ? ".dll" : ".so";
-// @dl("iconv$dlext");
-//}
-if (!extension_loaded("iconv")) {
- die("skip iconv extension not available\n");
-}
-?> \ No newline at end of file
diff --git a/ext/iconv/tests/test.inc b/ext/iconv/tests/test.inc
deleted file mode 100644
index 78f180462f..0000000000
--- a/ext/iconv/tests/test.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-// Do not dl load extension
-//if (!extension_loaded("iconv") && ini_get("enable_dl")) {
-// $dlext = (substr(PHP_OS, 0, 3) == "WIN") ? ".dll" : ".so";
-// @dl("iconv$dlext");
-//}
-?> \ No newline at end of file
diff --git a/ext/iconv/tests/translit-failure.phpt b/ext/iconv/tests/translit-failure.phpt
deleted file mode 100644
index d0fbf5c86a..0000000000
--- a/ext/iconv/tests/translit-failure.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Translit failure
---SKIPIF--
-<?php
-/* include('skipif.inc'); */
-( ICONV_IMPL != "libiconv" ) and die("skip ICONV_IMPL != \"libiconv\"");
-?>
---INI--
-error_reporting=2039
---FILE--
-<?php
-/* include('test.inc'); */
-// Should be ok.
-// Content from file is from libiconv testkit. Tested both
-// with a string as an implode, no difference.
-// if at some point internal encoding changes, set correct one
-// in INI section or use file 'TranslitFail1.ISO-8859-1'.
-
-set_time_limit(5);
-/*
- * The bug (fixed in libiconv 1.8) was confirmed that iconv goes into an
- * infinite loop when ASCII//TRANSLIT is performed. We should stop it in
- * some time.
- */
-
-$test = 'Écrit par %s.';
-
-if (!@iconv("ISO-8859-1", "ASCII//TRANSLIT", $test)) {
- echo 'wrong is right';
-}
-?>
---EXPECT--
-wrong is right
diff --git a/ext/iconv/tests/translit-utf8.phpt b/ext/iconv/tests/translit-utf8.phpt
deleted file mode 100644
index 10f9605bb1..0000000000
--- a/ext/iconv/tests/translit-utf8.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-Translit UTF-8 quotes
---SKIPIF--
-<?php
-/* include('skipif.inc'); */
-( ICONV_IMPL != "libiconv" ) and die("skip ICONV_IMPL != \"libiconv\"");
-?>
---INI--
-magic_quotes_runtime=0
-error_reporting=2047
---FILE--
-<?php // vim600: syn=php
-/* include('test.inc'); */
-//error_reporting(E_ALL);
-$utf = implode('', file('ext/iconv/tests/Quotes.UTF-8'));
-
-print(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $utf));
-print(iconv("UTF-8", "ASCII//TRANSLIT", $utf));
-?>
---EXPECT--
-"Hello"
-`Hello´
-"Hello"
-`Hello´
-"Hello"
-'Hello'
-"Hello"
-'Hello'
diff --git a/ext/imap/CREDITS b/ext/imap/CREDITS
deleted file mode 100644
index 2d19ecd24a..0000000000
--- a/ext/imap/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-IMAP
-Rex Logan, Mark Musone, Brian Wang, Kaj-Michael Lang, Antoni Pamies Olive, Rasmus Lerdorf, Andrew Skalski, Chuck Hagenbuch, Daniel R Kalowsky
diff --git a/ext/imap/IMAP_Win32_HOWTO.txt b/ext/imap/IMAP_Win32_HOWTO.txt
deleted file mode 100644
index 5fbd859a6d..0000000000
--- a/ext/imap/IMAP_Win32_HOWTO.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-Rules for building IMAP
------------------------
-
-Note 1: You *must* use NT's cmd.exe for this job; 4NT.exe will NOT work properly.
-Note 2: During the entire build process, you can ignore warnings about
- inconsistent DLL linkage.
-
-- Open IMAP under php_build. Rename this directory to 'IMAP'.
-- Change to the IMAP directory.
-- Edit .\src\osdep\nt\makefile.nt:
- Search for '/MT', and change it to '/MD'. If you're compiling in DEBUG mode,
- use '/MDd' instead.
- Search for 'ERASE'. Comment out the line that contains the ERASE command.
-- Run 'nmake nt'
-
----Begin Win2K only---
-- At some point, the build will fail. Rerun 'nmake nt'.
-- After a while, the build will fail again, failing to find auths.c.
-- Change directory to 'c-client'
-- Create an a file named auths.c, that includes the following line:
- #include "auth_md5.c"
-- Run 'nmake -f makefile.nt'
----End Win2K only---
-
-At this point (even if the last build apparently failed), you should have the
-client library ready (cclient.lib).
-
-Start Visual Studio, load php_modules.dsw, select the IMAP projects, and build
-it.
-
-
- \ No newline at end of file
diff --git a/ext/imap/config.m4 b/ext/imap/config.m4
deleted file mode 100644
index f992ab8ec3..0000000000
--- a/ext/imap/config.m4
+++ /dev/null
@@ -1,208 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_DEFUN(IMAP_INC_CHK,[if test -r "$i$1/c-client.h"; then
- AC_DEFINE(HAVE_IMAP2000, 1, [ ])
- IMAP_DIR=$i
- IMAP_INC_DIR=$i$1
- elif test -r "$i$1/rfc822.h"; then
- IMAP_DIR=$i;
- IMAP_INC_DIR=$i$1
-])
-
-AC_DEFUN(IMAP_LIB_CHK,[
- str="$IMAP_DIR/$1/lib$lib.*"
- for i in `echo $str`; do
- if test -r $i; then
- IMAP_LIBDIR=$IMAP_DIR/$1
- break 2
- fi
- done
-])
-
-dnl PHP_IMAP_TEST_BUILD(function, action-if-ok, action-if-not-ok [, extra-libs])
-AC_DEFUN(PHP_IMAP_TEST_BUILD, [
- old_LIBS=$LIBS
- LIBS="$4 $LIBS"
- AC_TRY_RUN([
- void mm_log(void){}
- void mm_dlog(void){}
- void mm_flags(void){}
- void mm_fatal(void){}
- void mm_critical(void){}
- void mm_nocritical(void){}
- void mm_notify(void){}
- void mm_login(void){}
- void mm_diskerror(void){}
- void mm_status(void){}
- void mm_lsub(void){}
- void mm_list(void){}
- void mm_exists(void){}
- void mm_searched(void){}
- void mm_expunged(void){}
- char $1();
- int main() {
- $1();
- return 0;
- }
- ], [
- LIBS=$old_LIBS
- $2
- ],[
- LIBS=$old_LIBS
- $3
- ])
-])
-
-AC_DEFUN(PHP_IMAP_KRB_CHK, [
- AC_ARG_WITH(kerberos,
- [ --with-kerberos[=DIR] IMAP: Include Kerberos support. DIR is the Kerberos install dir.],[
- PHP_KERBEROS=$withval
- ],[
- PHP_KERBEROS=no
- ])
-
- if test "$PHP_KERBEROS" != "no"; then
-
- if test "$PHP_KERBEROS" = "yes"; then
- SEARCH_PATHS="/usr/kerberos /usr/local /usr"
- else
- SEARCH_PATHS=$PHP_KERBEROS
- fi
-
- for i in $SEARCH_PATHS; do
- if test -f $i/lib/libkrb5.a || test -f $i/lib/libkrb5.$SHLIB_SUFFIX_NAME; then
- PHP_KERBEROS_DIR=$i
- break
- fi
- done
-
- if test -z "$PHP_KERBEROS_DIR"; then
- AC_MSG_ERROR([Kerberos libraries not found.
-
- Check the path given to --with-kerberos (if no path is given, searches in /usr/kerberos, /usr/local and /usr )
- ])
- fi
- AC_DEFINE(HAVE_IMAP_KRB,1,[ ])
- PHP_ADD_LIBPATH($PHP_KERBEROS_DIR/lib, IMAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY(gssapi_krb5, 1, IMAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY(krb5, 1, IMAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY(k5crypto, 1, IMAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY(com_err, 1, IMAP_SHARED_LIBADD)
- PHP_ADD_INCLUDE($PHP_KERBEROS_DIR/include)
- else
- AC_EGREP_HEADER(auth_gss, $IMAP_INC_DIR/linkage.h, [
- AC_MSG_ERROR([This c-client library is built with Kerberos support.
-
- Add --with-kerberos to your configure line. Check config.log for details.
- ])
- ])
- fi
-
-])
-
-AC_DEFUN(PHP_IMAP_SSL_CHK, [
- AC_ARG_WITH(imap-ssl,
- [ --with-imap-ssl=<DIR> IMAP: Include SSL support. DIR is the OpenSSL install dir.],[
- PHP_IMAP_SSL=$withval
- ],[
- PHP_IMAP_SSL=no
- ])
-
- if test "$PHP_IMAP_SSL" = "yes"; then
- PHP_IMAP_SSL=/usr
- fi
-
- AC_MSG_CHECKING([whether SSL libraries are needed for c-client])
-
- if test "$PHP_IMAP_SSL" != "no"; then
- AC_MSG_RESULT([$PHP_IMAP_SSL/lib])
- AC_DEFINE(HAVE_IMAP_SSL,1,[ ])
- PHP_ADD_LIBRARY_DEFER(ssl, 1, IMAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_DEFER(crypto, 1, IMAP_SHARED_LIBADD)
- PHP_ADD_LIBPATH($PHP_IMAP_SSL/lib, IMAP_SHARED_LIBADD)
- else
- AC_MSG_RESULT(no)
- fi
-])
-
-
-PHP_ARG_WITH(imap,for IMAP support,
-[ --with-imap[=DIR] Include IMAP support. DIR is the c-client install prefix.])
-
-if test "$PHP_IMAP" != "no"; then
-
- PHP_SUBST(IMAP_SHARED_LIBADD)
- PHP_NEW_EXTENSION(imap, php_imap.c, $ext_shared)
- AC_DEFINE(HAVE_IMAP,1,[ ])
-
- for i in /usr/local /usr $PHP_IMAP; do
- IMAP_INC_CHK()
- el[]IMAP_INC_CHK(/include/c-client)
- el[]IMAP_INC_CHK(/include/imap)
- el[]IMAP_INC_CHK(/include)
- el[]IMAP_INC_CHK(/imap)
- el[]IMAP_INC_CHK(/c-client)
- fi
- done
-
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS=-I$IMAP_INC_DIR
- AC_EGREP_CPP(this_is_true, [
-#include "imap4r1.h"
-#if defined(IMAPSSLPORT)
- this_is_true
-#endif
- ],[
- AC_DEFINE(HAVE_IMAP2001, 1, [ ])
- ],[])
- CPPFLAGS=$old_CPPFLAGS
-
- AC_CHECK_LIB(pam, pam_start)
- AC_CHECK_LIB(crypt, crypt)
-
- PHP_EXPAND_PATH($IMAP_DIR, IMAP_DIR)
-
- if test -z "$IMAP_DIR"; then
- AC_MSG_ERROR(Cannot find rfc822.h. Please check your IMAP installation.)
- fi
-
- if test -r "$IMAP_DIR/c-client/c-client.a"; then
- ln -s "$IMAP_DIR/c-client/c-client.a" "$IMAP_DIR/c-client/libc-client.a" >/dev/null 2>&1
- elif test -r "$IMAP_DIR/lib/c-client.a"; then
- ln -s "$IMAP_DIR/lib/c-client.a" "$IMAP_DIR/lib/libc-client.a" >/dev/null 2>&1
- fi
-
- for lib in c-client4 c-client imap; do
- IMAP_LIB=$lib
- IMAP_LIB_CHK(lib)
- IMAP_LIB_CHK(c-client)
- done
-
- if test -z "$IMAP_LIBDIR"; then
- AC_MSG_ERROR(Cannot find imap library (libc-client.a). Please check your IMAP installation.)
- fi
-
- PHP_ADD_INCLUDE($IMAP_INC_DIR)
- PHP_ADD_LIBRARY_DEFER($IMAP_LIB,, IMAP_SHARED_LIBADD)
- PHP_ADD_LIBPATH($IMAP_LIBDIR, IMAP_SHARED_LIBADD)
- PHP_IMAP_KRB_CHK
- PHP_IMAP_SSL_CHK
-
- dnl Test the build in the end
- TST_LIBS="$DLIBS $IMAP_SHARED_LIBADD"
-
- dnl Check if auth_gss exists
- PHP_IMAP_TEST_BUILD(auth_gssapi_valid, [
- AC_DEFINE(HAVE_IMAP_AUTH_GSS, 1, [ ])
- ], [], $TST_LIBS)
-
- AC_MSG_CHECKING(whether IMAP works)
- PHP_IMAP_TEST_BUILD(mail_newbody, [
- AC_MSG_RESULT(yes)
- ], [
- AC_MSG_RESULT(no)
- AC_MSG_ERROR([build test failed. Please check the config.log for details.])
- ], $TST_LIBS)
-fi
diff --git a/ext/imap/imap.dsp b/ext/imap/imap.dsp
deleted file mode 100644
index 08cc00e551..0000000000
--- a/ext/imap/imap.dsp
+++ /dev/null
@@ -1,176 +0,0 @@
-# Microsoft Developer Studio Project File - Name="imap" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=imap - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "imap.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "imap.mak" CFG="imap - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "imap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "imap - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "imap - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "imap - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "imap - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\IMAP\c-client" /I "..\..\TSRM" /D "NDEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4nts.lib wsock32.lib winmm.lib cclient.lib /nologo /dll /machine:I386 /out:"Release/php_imap.dll" /libpath:"..\..\Release" /libpath:"..\..\..\php_build\IMAP\C-Client"
-
-!ELSEIF "$(CFG)" == "imap - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\IMAP\c-client" /I "..\..\TSRM" /D "_DEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4nts_debug.lib wsock32.lib winmm.lib cclient.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_imap.dll" /pdbtype:sept /libpath:"..\..\Debug" /libpath:"..\..\..\php_build\IMAP\C-Client"
-
-!ELSEIF "$(CFG)" == "imap - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "ZTS" /D "_DEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib wsock32.lib winmm.lib cclient.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_imap.dll" /pdbtype:sept /libpath:"..\..\..\\" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "imap - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\imap\c-client" /D "ZTS" /D "NDEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /D HAVE_IMAP2001=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib wsock32.lib winmm.lib cclient.lib Secur32.lib CertIdl.Lib /nologo /dll /machine:I386 /nodefaultlib:"LIBCMT" /out:"..\..\Release_TS/php_imap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\imap"
-# SUBTRACT LINK32 /nodefaultlib
-
-!ENDIF
-
-# Begin Target
-
-# Name "imap - Win32 Release"
-# Name "imap - Win32 Debug"
-# Name "imap - Win32 Debug_TS"
-# Name "imap - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_imap.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\win32\sendmail.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_imap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\win32\sendmail.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\IMAP_Win32_HOWTO.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/imap/imap.h b/ext/imap/imap.h
deleted file mode 100644
index 914d128316..0000000000
--- a/ext/imap/imap.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef _INCLUDED_IMAP_H
-#define _INCLUDED_IMAP_H
-
-#if COMPILE_DL
-#undef HAVE_IMAP
-#define HAVE_IMAP 1
-#endif
-
-#if HAVE_IMAP
-
-#ifndef PHP_WIN32
-#include "build-defs.h"
-#endif
-
-/* Functions accessable to PHP */
-extern zend_module_entry imap_module_entry;
-#define imap_module_ptr &imap_module_entry
-
-extern PHP_MINIT_FUNCTION(imap);
-extern PHP_RINIT_FUNCTION(imap);
-extern PHP_RSHUTDOWN_FUNCTION(imap);
-PHP_MINFO_FUNCTION(imap);
-PHP_FUNCTION(imap_open);
-PHP_FUNCTION(imap_popen);
-PHP_FUNCTION(imap_reopen);
-PHP_FUNCTION(imap_num_msg);
-PHP_FUNCTION(imap_num_recent);
-PHP_FUNCTION(imap_headers);
-PHP_FUNCTION(imap_headerinfo);
-PHP_FUNCTION(imap_rfc822_parse_headers);
-PHP_FUNCTION(imap_body);
-PHP_FUNCTION(imap_fetchstructure);
-PHP_FUNCTION(imap_fetchbody);
-PHP_FUNCTION(imap_expunge);
-PHP_FUNCTION(imap_delete);
-PHP_FUNCTION(imap_undelete);
-PHP_FUNCTION(imap_check);
-PHP_FUNCTION(imap_close);
-PHP_FUNCTION(imap_mail_copy);
-PHP_FUNCTION(imap_mail_move);
-PHP_FUNCTION(imap_createmailbox);
-PHP_FUNCTION(imap_renamemailbox);
-PHP_FUNCTION(imap_deletemailbox);
-PHP_FUNCTION(imap_listmailbox);
-PHP_FUNCTION(imap_scanmailbox);
-PHP_FUNCTION(imap_subscribe);
-PHP_FUNCTION(imap_unsubscribe);
-PHP_FUNCTION(imap_append);
-PHP_FUNCTION(imap_ping);
-PHP_FUNCTION(imap_base64);
-PHP_FUNCTION(imap_qprint);
-PHP_FUNCTION(imap_8bit);
-PHP_FUNCTION(imap_binary);
-PHP_FUNCTION(imap_mailboxmsginfo);
-PHP_FUNCTION(imap_rfc822_write_address);
-PHP_FUNCTION(imap_rfc822_parse_adrlist);
-PHP_FUNCTION(imap_setflag_full);
-PHP_FUNCTION(imap_clearflag_full);
-PHP_FUNCTION(imap_sort);
-PHP_FUNCTION(imap_fetchheader);
-PHP_FUNCTION(imap_fetchtext);
-PHP_FUNCTION(imap_uid);
-PHP_FUNCTION(imap_msgno);
-PHP_FUNCTION(imap_list);
-PHP_FUNCTION(imap_list_full);
-PHP_FUNCTION(imap_listscan);
-PHP_FUNCTION(imap_lsub);
-PHP_FUNCTION(imap_lsub_full);
-PHP_FUNCTION(imap_create);
-PHP_FUNCTION(imap_rename);
-PHP_FUNCTION(imap_status);
-PHP_FUNCTION(imap_bodystruct);
-PHP_FUNCTION(imap_fetch_overview);
-PHP_FUNCTION(imap_mail_compose);
-PHP_FUNCTION(imap_alerts);
-PHP_FUNCTION(imap_errors);
-PHP_FUNCTION(imap_last_error);
-PHP_FUNCTION(imap_mail);
-PHP_FUNCTION(imap_search);
-PHP_FUNCTION(imap_utf8);
-PHP_FUNCTION(imap_utf7_decode);
-PHP_FUNCTION(imap_utf7_encode);
-PHP_FUNCTION(imap_mime_header_decode);
-#else
-#define imap_module_ptr NULL
-#endif /* HAVE_IMAP */
-
-#endif
-
-
-
-
-
-
-#define phpext_imap_ptr imap_module_ptr
-
-
-
-
-
-
-
-
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
deleted file mode 100644
index 25d79ad2d8..0000000000
--- a/ext/imap/php_imap.c
+++ /dev/null
@@ -1,4196 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rex Logan <veebert@dimensional.com> |
- | Mark Musone <musone@afterfive.com> |
- | Brian Wang <brian@vividnet.com> |
- | Kaj-Michael Lang <milang@tal.org> |
- | Antoni Pamies Olive <toni@readysoft.net> |
- | Rasmus Lerdorf <rasmus@php.net> |
- | Chuck Hagenbuch <chuck@horde.org> |
- | Andrew Skalski <askalski@chekinc.com> |
- | Hartmut Holzgraefe <hholzgra@php.net> |
- | Jani Taskinen <sniper@iki.fi> |
- | Daniel R. Kalowsky <kalowsky@php.net> |
- | PHP 4.0 updates: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#define IMAP41
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/php_string.h"
-#include "ext/standard/info.h"
-
-#ifdef ERROR
-#undef ERROR
-#endif
-#include "php_imap.h"
-
-#include <time.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <signal.h>
-
-#ifdef PHP_WIN32
-#include <winsock2.h>
-#include <stdlib.h>
-#include "win32/sendmail.h"
-MAILSTREAM DEFAULTPROTO;
-#endif
-
-#define CRLF "\015\012"
-#define PHP_EXPUNGE 32768
-#define PHP_IMAP_ADDRESS_SIZE_BUF 10
-
-static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC);
-static void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC);
-static void _php_imap_parse_address(ADDRESS *addresslist, char **fulladdress, zval *paddress TSRMLS_DC);
-static int _php_imap_address_size(ADDRESS *addresslist);
-
-/* These function declarations are missing from the IMAP header files... */
-void rfc822_date(char *date);
-char *cpystr(const char *str);
-char *cpytxt(SIZEDTEXT *dst, char *text, unsigned long size);
-long utf8_mime2text(SIZEDTEXT *src, SIZEDTEXT *dst);
-unsigned long find_rightmost_bit(unsigned long *valptr);
-void fs_give(void **block);
-void *fs_get(size_t size);
-
-
-/* {{{ imap_functions[]
- */
-function_entry imap_functions[] = {
- PHP_FE(imap_open, NULL)
- PHP_FE(imap_reopen, NULL)
- PHP_FE(imap_close, NULL)
- PHP_FE(imap_num_msg, NULL)
- PHP_FE(imap_num_recent, NULL)
- PHP_FE(imap_headers, NULL)
- PHP_FE(imap_headerinfo, NULL)
- PHP_FE(imap_rfc822_parse_headers, NULL)
- PHP_FE(imap_rfc822_write_address, NULL)
- PHP_FE(imap_rfc822_parse_adrlist, NULL)
- PHP_FE(imap_body, NULL)
- PHP_FE(imap_bodystruct, NULL)
- PHP_FE(imap_fetchbody, NULL)
- PHP_FE(imap_fetchheader, NULL)
- PHP_FE(imap_fetchstructure, NULL)
- PHP_FE(imap_expunge, NULL)
- PHP_FE(imap_delete, NULL)
- PHP_FE(imap_undelete, NULL)
- PHP_FE(imap_check, NULL)
- PHP_FE(imap_mail_copy, NULL)
- PHP_FE(imap_mail_move, NULL)
- PHP_FE(imap_mail_compose, NULL)
- PHP_FE(imap_createmailbox, NULL)
- PHP_FE(imap_renamemailbox, NULL)
- PHP_FE(imap_deletemailbox, NULL)
- PHP_FE(imap_subscribe, NULL)
- PHP_FE(imap_unsubscribe, NULL)
- PHP_FE(imap_append, NULL)
- PHP_FE(imap_ping, NULL)
- PHP_FE(imap_base64, NULL)
- PHP_FE(imap_qprint, NULL)
- PHP_FE(imap_8bit, NULL)
- PHP_FE(imap_binary, NULL)
- PHP_FE(imap_utf8, NULL)
- PHP_FE(imap_status, NULL)
- PHP_FE(imap_mailboxmsginfo, NULL)
- PHP_FE(imap_setflag_full, NULL)
- PHP_FE(imap_clearflag_full, NULL)
- PHP_FE(imap_sort, NULL)
- PHP_FE(imap_uid, NULL)
- PHP_FE(imap_msgno, NULL)
- PHP_FE(imap_list, NULL)
- PHP_FE(imap_lsub, NULL)
- PHP_FE(imap_fetch_overview, NULL)
- PHP_FE(imap_alerts, NULL)
- PHP_FE(imap_errors, NULL)
- PHP_FE(imap_last_error, NULL)
- PHP_FE(imap_search, NULL)
- PHP_FE(imap_utf7_decode, NULL)
- PHP_FE(imap_utf7_encode, NULL)
- PHP_FE(imap_mime_header_decode, NULL)
- PHP_FE(imap_thread, NULL)
-
-#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
- PHP_FE(imap_get_quota, NULL)
- PHP_FE(imap_get_quotaroot, NULL)
- PHP_FE(imap_set_quota, NULL)
- PHP_FE(imap_setacl, NULL)
-#endif
-
- PHP_FE(imap_mail, NULL)
-
- PHP_FALIAS(imap_header, imap_headerinfo, NULL)
- PHP_FALIAS(imap_listmailbox, imap_list, NULL)
- PHP_FALIAS(imap_getmailboxes, imap_list_full, NULL)
- PHP_FALIAS(imap_scanmailbox, imap_listscan, NULL)
- PHP_FALIAS(imap_listsubscribed, imap_lsub, NULL)
- PHP_FALIAS(imap_getsubscribed, imap_lsub_full, NULL)
- PHP_FALIAS(imap_fetchtext, imap_body, NULL)
- PHP_FALIAS(imap_scan, imap_listscan, NULL)
- PHP_FALIAS(imap_create, imap_createmailbox, NULL)
- PHP_FALIAS(imap_rename, imap_renamemailbox, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ imap_module_entry
- */
-zend_module_entry imap_module_entry = {
- STANDARD_MODULE_HEADER,
- "imap",
- imap_functions,
- PHP_MINIT(imap),
- NULL,
- PHP_RINIT(imap),
- PHP_RSHUTDOWN(imap),
- PHP_MINFO(imap),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-ZEND_DECLARE_MODULE_GLOBALS(imap)
-
-#ifdef COMPILE_DL_IMAP
-ZEND_GET_MODULE(imap)
-#endif
-
-/* True globals, no need for thread safety */
-static int le_imap;
-
-/* {{{ mail_close_it
- */
-static void mail_close_it(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- pils *imap_le_struct = (pils *)rsrc->ptr;
-
- mail_close_full(imap_le_struct->imap_stream, imap_le_struct->flags);
-
- if (IMAPG(imap_user)) {
- efree(IMAPG(imap_user));
- IMAPG(imap_user) = 0;
- }
- if (IMAPG(imap_password)) {
- efree(IMAPG(imap_password));
- IMAPG(imap_password) = 0;
- }
-
- efree(imap_le_struct);
-}
-/* }}} */
-
-/* {{{ add_assoc_object
- */
-static int add_assoc_object(zval *arg, char *key, zval *tmp TSRMLS_DC)
-{
- HashTable *symtable;
-
- if (Z_TYPE_P(arg) == IS_OBJECT) {
- symtable = Z_OBJPROP_P(arg);
- } else {
- symtable = Z_ARRVAL_P(arg);
- }
- return zend_hash_update(symtable, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
-}
-/* }}} */
-
-/* {{{ add_next_index_object
- */
-static inline int add_next_index_object(zval *arg, zval *tmp TSRMLS_DC)
-{
- HashTable *symtable;
-
- if (Z_TYPE_P(arg) == IS_OBJECT) {
- symtable = Z_OBJPROP_P(arg);
- } else {
- symtable = Z_ARRVAL_P(arg);
- }
-
- return zend_hash_next_index_insert(symtable, (void *) &tmp, sizeof(zval *), NULL);
-}
-/* }}} */
-
-/* {{{ mail_newfolderobjectlist
- *
- * Mail instantiate FOBJECTLIST
- * Returns: new FOBJECTLIST list
- * Author: CJH
- */
-FOBJECTLIST *mail_newfolderobjectlist(void)
-{
- return (FOBJECTLIST *) memset(fs_get(sizeof(FOBJECTLIST)), 0, sizeof(FOBJECTLIST));
-}
-/* }}} */
-
-/* {{{ mail_free_foblist
- *
- * Mail garbage collect FOBJECTLIST
- * Accepts: pointer to FOBJECTLIST pointer
- * Author: CJH
- */
-void mail_free_foblist(FOBJECTLIST **foblist, FOBJECTLIST **tail)
-{
- FOBJECTLIST *cur, *next;
-
- for (cur=*foblist, next=cur->next; cur; cur=next) {
- next = cur->next;
-
- if(cur->text.data)
- fs_give((void **)&(cur->text.data));
-
- fs_give((void **)&cur);
- }
-
- *tail = NIL;
- *foblist = NIL;
-}
-/* }}} */
-
-/* {{{ mail_newerrorlist
- *
- * Mail instantiate ERRORLIST
- * Returns: new ERRORLIST list
- * Author: CJH
- */
-ERRORLIST *mail_newerrorlist(void)
-{
- return (ERRORLIST *) memset(fs_get(sizeof(ERRORLIST)), 0, sizeof(ERRORLIST));
-}
-/* }}} */
-
-/* {{{ mail_free_errorlist
- *
- * Mail garbage collect FOBJECTLIST
- * Accepts: pointer to FOBJECTLIST pointer
- * Author: CJH
- */
-void mail_free_errorlist(ERRORLIST **errlist)
-{
- if (*errlist) { /* only free if exists */
- if ((*errlist)->text.data) {
- fs_give((void **) &(*errlist)->text.data);
- }
- mail_free_errorlist (&(*errlist)->next);
- fs_give((void **) errlist); /* return string to free storage */
- }
-}
-/* }}} */
-
-/* {{{ mail_newmessagelist
- *
- * Mail instantiate MESSAGELIST
- * Returns: new MESSAGELIST list
- * Author: CJH
- */
-MESSAGELIST *mail_newmessagelist(void)
-{
- return (MESSAGELIST *) memset(fs_get(sizeof(MESSAGELIST)), 0, sizeof(MESSAGELIST));
-}
-/* }}} */
-
-/* {{{ mail_free_messagelist
- *
- * Mail garbage collect MESSAGELIST
- * Accepts: pointer to MESSAGELIST pointer
- * Author: CJH
- */
-void mail_free_messagelist(MESSAGELIST **msglist, MESSAGELIST **tail)
-{
- MESSAGELIST *cur, *next;
-
- for (cur = *msglist, next = cur->next; cur; cur = next) {
- next = cur->next;
- fs_give((void **)&cur);
- }
-
- *tail = NIL;
- *msglist = NIL;
-}
-/* }}} */
-
-#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
-/* {{{ mail_getquota
- *
- * Mail GET_QUOTA callback
- * Called via the mail_parameter function in c-client:src/c-client/mail.c
- * Author DRK
- */
-void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist)
-{
- zval *t_map, *return_value;
- TSRMLS_FETCH();
-
- return_value = *IMAPG(quota_return);
-
-/* put parsing code here */
- for(; qlist; qlist = qlist->next) {
- MAKE_STD_ZVAL(t_map);
- array_init(t_map);
- if (strncmp(qlist->name, "STORAGE", 7) == 0)
- {
- /* this is to add backwards compatibility */
- add_assoc_long_ex(return_value, "usage", sizeof("usage"), qlist->usage);
- add_assoc_long_ex(return_value, "limit", sizeof("limit"), qlist->limit);
- }
-
- add_assoc_long_ex(t_map, "usage", sizeof("usage"), qlist->usage);
- add_assoc_long_ex(t_map, "limit", sizeof("limit"), qlist->limit);
- add_assoc_zval_ex(return_value, qlist->name, strlen(qlist->name)+1, t_map);
- }
-}
-/* }}} */
-#endif
-
-
-/* {{{ php_imap_init_globals
- */
-static void php_imap_init_globals(zend_imap_globals *imap_globals)
-{
- imap_globals->imap_user = NIL;
- imap_globals->imap_password = NIL;
-
- imap_globals->imap_alertstack = NIL;
- imap_globals->imap_errorstack = NIL;
-
- imap_globals->imap_folders = NIL;
- imap_globals->imap_folders_tail = NIL;
- imap_globals->imap_sfolders = NIL;
- imap_globals->imap_sfolders_tail = NIL;
- imap_globals->imap_messages = NIL;
- imap_globals->imap_messages_tail = NIL;
- imap_globals->imap_folder_objects = NIL;
- imap_globals->imap_folder_objects_tail = NIL;
- imap_globals->imap_sfolder_objects = NIL;
- imap_globals->imap_sfolder_objects_tail = NIL;
-
- imap_globals->folderlist_style = FLIST_ARRAY;
-#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
- imap_globals->quota_return = NULL;
-#endif
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(imap)
-{
- unsigned long sa_all = SA_MESSAGES | SA_RECENT | SA_UNSEEN | SA_UIDNEXT | SA_UIDVALIDITY;
-
- ZEND_INIT_MODULE_GLOBALS(imap, php_imap_init_globals, NULL)
-
-#ifndef PHP_WIN32
- mail_link(&unixdriver); /* link in the unix driver */
- mail_link(&mhdriver); /* link in the mh driver */
- /* mail_link(&mxdriver); */ /* According to c-client docs (internal.txt) this shouldn't be used. */
- mail_link(&mmdfdriver); /* link in the mmdf driver */
- mail_link(&newsdriver); /* link in the news driver */
- mail_link(&philedriver); /* link in the phile driver */
-#endif
- mail_link(&imapdriver); /* link in the imap driver */
- mail_link(&nntpdriver); /* link in the nntp driver */
- mail_link(&pop3driver); /* link in the pop3 driver */
- mail_link(&mbxdriver); /* link in the mbx driver */
- mail_link(&tenexdriver); /* link in the tenex driver */
- mail_link(&mtxdriver); /* link in the mtx driver */
- mail_link(&dummydriver); /* link in the dummy driver */
-
-#ifndef PHP_WIN32
- auth_link(&auth_log); /* link in the log authenticator */
- auth_link(&auth_md5); /* link in the cram-md5 authenticator */
-#if HAVE_IMAP_KRB && defined(HAVE_IMAP_AUTH_GSS)
- auth_link(&auth_gss); /* link in the gss authenticator */
-#endif
-
-#ifdef HAVE_IMAP_SSL
- ssl_onceonlyinit ();
-#endif
-#endif
-
- /* lets allow NIL */
- REGISTER_LONG_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS);
-
-
- /* Open Options */
-
- REGISTER_LONG_CONSTANT("OP_DEBUG", OP_DEBUG, CONST_PERSISTENT | CONST_CS);
- /* debug protocol negotiations */
- REGISTER_LONG_CONSTANT("OP_READONLY", OP_READONLY, CONST_PERSISTENT | CONST_CS);
- /* read-only open */
- REGISTER_LONG_CONSTANT("OP_ANONYMOUS", OP_ANONYMOUS, CONST_PERSISTENT | CONST_CS);
- /* anonymous open of newsgroup */
- REGISTER_LONG_CONSTANT("OP_SHORTCACHE", OP_SHORTCACHE, CONST_PERSISTENT | CONST_CS);
- /* short (elt-only) caching */
- REGISTER_LONG_CONSTANT("OP_SILENT", OP_SILENT, CONST_PERSISTENT | CONST_CS);
- /* don't pass up events (internal use) */
- REGISTER_LONG_CONSTANT("OP_PROTOTYPE", OP_PROTOTYPE, CONST_PERSISTENT | CONST_CS);
- /* return driver prototype */
- REGISTER_LONG_CONSTANT("OP_HALFOPEN", OP_HALFOPEN, CONST_PERSISTENT | CONST_CS);
- /* half-open (IMAP connect but no select) */
- REGISTER_LONG_CONSTANT("OP_EXPUNGE", OP_EXPUNGE, CONST_PERSISTENT | CONST_CS);
- /* silently expunge recycle stream */
- REGISTER_LONG_CONSTANT("OP_SECURE", OP_SECURE, CONST_PERSISTENT | CONST_CS);
- /* don't do non-secure authentication */
-
- /*
- PHP re-assigns CL_EXPUNGE a custom value that can be used as part of the imap_open() bitfield
- because it seems like a good idea to be able to indicate that the mailbox should be
- automatically expunged during imap_open in case the script get interrupted and it doesn't get
- to the imap_close() where this option is normally placed. If the c-client library adds other
- options and the value for this one conflicts, simply make PHP_EXPUNGE higher at the top of
- this file
- */
- REGISTER_LONG_CONSTANT("CL_EXPUNGE", PHP_EXPUNGE, CONST_PERSISTENT | CONST_CS);
- /* expunge silently */
-
-
- /* Fetch options */
-
- REGISTER_LONG_CONSTANT("FT_UID", FT_UID, CONST_PERSISTENT | CONST_CS);
- /* argument is a UID */
- REGISTER_LONG_CONSTANT("FT_PEEK", FT_PEEK, CONST_PERSISTENT | CONST_CS);
- /* peek at data */
- REGISTER_LONG_CONSTANT("FT_NOT", FT_NOT, CONST_PERSISTENT | CONST_CS);
- /* NOT flag for header lines fetch */
- REGISTER_LONG_CONSTANT("FT_INTERNAL", FT_INTERNAL, CONST_PERSISTENT | CONST_CS);
- /* text can be internal strings */
- REGISTER_LONG_CONSTANT("FT_PREFETCHTEXT", FT_PREFETCHTEXT, CONST_PERSISTENT | CONST_CS);
- /* IMAP prefetch text when fetching header */
-
-
- /* Flagging options */
-
- REGISTER_LONG_CONSTANT("ST_UID", ST_UID, CONST_PERSISTENT | CONST_CS);
- /* argument is a UID sequence */
- REGISTER_LONG_CONSTANT("ST_SILENT", ST_SILENT, CONST_PERSISTENT | CONST_CS);
- /* don't return results */
- REGISTER_LONG_CONSTANT("ST_SET", ST_SET, CONST_PERSISTENT | CONST_CS);
- /* set vs. clear */
-
-
- /* Copy options */
-
- REGISTER_LONG_CONSTANT("CP_UID", CP_UID, CONST_PERSISTENT | CONST_CS);
- /* argument is a UID sequence */
- REGISTER_LONG_CONSTANT("CP_MOVE", CP_MOVE, CONST_PERSISTENT | CONST_CS);
- /* delete from source after copying */
-
-
- /* Search/sort options */
-
- REGISTER_LONG_CONSTANT("SE_UID", SE_UID, CONST_PERSISTENT | CONST_CS);
- /* return UID */
- REGISTER_LONG_CONSTANT("SE_FREE", SE_FREE, CONST_PERSISTENT | CONST_CS);
- /* free search program after finished */
- REGISTER_LONG_CONSTANT("SE_NOPREFETCH", SE_NOPREFETCH, CONST_PERSISTENT | CONST_CS);
- /* no search prefetching */
- REGISTER_LONG_CONSTANT("SO_FREE", SO_FREE, CONST_PERSISTENT | CONST_CS);
- /* free sort program after finished */
- REGISTER_LONG_CONSTANT("SO_NOSERVER", SO_NOSERVER, CONST_PERSISTENT | CONST_CS);
- /* don't do server-based sort */
-
-
- /* Status options */
-
- REGISTER_LONG_CONSTANT("SA_MESSAGES", SA_MESSAGES , CONST_PERSISTENT | CONST_CS);
- /* number of messages */
- REGISTER_LONG_CONSTANT("SA_RECENT", SA_RECENT, CONST_PERSISTENT | CONST_CS);
- /* number of recent messages */
- REGISTER_LONG_CONSTANT("SA_UNSEEN", SA_UNSEEN , CONST_PERSISTENT | CONST_CS);
- /* number of unseen messages */
- REGISTER_LONG_CONSTANT("SA_UIDNEXT", SA_UIDNEXT, CONST_PERSISTENT | CONST_CS);
- /* next UID to be assigned */
- REGISTER_LONG_CONSTANT("SA_UIDVALIDITY", SA_UIDVALIDITY , CONST_PERSISTENT | CONST_CS);
- /* UID validity value */
- REGISTER_LONG_CONSTANT("SA_ALL", sa_all, CONST_PERSISTENT | CONST_CS);
- /* get all status information */
-
-
- /* Bits for mm_list() and mm_lsub() */
-
- REGISTER_LONG_CONSTANT("LATT_NOINFERIORS", LATT_NOINFERIORS , CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("LATT_NOSELECT", LATT_NOSELECT, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("LATT_MARKED", LATT_MARKED, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("LATT_UNMARKED", LATT_UNMARKED , CONST_PERSISTENT | CONST_CS);
-
-
- /* Sort functions */
-
- REGISTER_LONG_CONSTANT("SORTDATE", SORTDATE , CONST_PERSISTENT | CONST_CS);
- /* date */
- REGISTER_LONG_CONSTANT("SORTARRIVAL", SORTARRIVAL , CONST_PERSISTENT | CONST_CS);
- /* arrival date */
- REGISTER_LONG_CONSTANT("SORTFROM", SORTFROM , CONST_PERSISTENT | CONST_CS);
- /* from */
- REGISTER_LONG_CONSTANT("SORTSUBJECT", SORTSUBJECT , CONST_PERSISTENT | CONST_CS);
- /* subject */
- REGISTER_LONG_CONSTANT("SORTTO", SORTTO , CONST_PERSISTENT | CONST_CS);
- /* to */
- REGISTER_LONG_CONSTANT("SORTCC", SORTCC , CONST_PERSISTENT | CONST_CS);
- /* cc */
- REGISTER_LONG_CONSTANT("SORTSIZE", SORTSIZE , CONST_PERSISTENT | CONST_CS);
- /* size */
-
- REGISTER_LONG_CONSTANT("TYPETEXT", TYPETEXT , CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("TYPEMULTIPART", TYPEMULTIPART , CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("TYPEMESSAGE", TYPEMESSAGE , CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("TYPEAPPLICATION", TYPEAPPLICATION , CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("TYPEAUDIO", TYPEAUDIO , CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("TYPEIMAGE", TYPEIMAGE , CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("TYPEVIDEO", TYPEVIDEO , CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("TYPEOTHER", TYPEOTHER , CONST_PERSISTENT | CONST_CS);
- /*
- TYPETEXT unformatted text
- TYPEMULTIPART multiple part
- TYPEMESSAGE encapsulated message
- TYPEAPPLICATION application data
- TYPEAUDIO audio
- TYPEIMAGE static image (GIF, JPEG, etc.)
- TYPEVIDEO video
- TYPEOTHER unknown
- */
-
- REGISTER_LONG_CONSTANT("ENC7BIT", ENC7BIT , CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("ENC8BIT", ENC8BIT , CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("ENCBINARY", ENCBINARY , CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("ENCBASE64", ENCBASE64, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("ENCQUOTEDPRINTABLE", ENCQUOTEDPRINTABLE , CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("ENCOTHER", ENCOTHER , CONST_PERSISTENT | CONST_CS);
- /*
- ENC7BIT 7 bit SMTP semantic data
- ENC8BIT 8 bit SMTP semantic data
- ENCBINARY 8 bit binary data
- ENCBASE64 base-64 encoded data
- ENCQUOTEDPRINTABLE human-readable 8-as-7 bit data
- ENCOTHER unknown
- */
-
- le_imap = zend_register_list_destructors_ex(mail_close_it, NULL, "imap", module_number);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(imap)
-{
- IMAPG(imap_errorstack) = NIL;
- IMAPG(imap_alertstack) = NIL;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(imap)
-{
- ERRORLIST *ecur = NIL;
- STRINGLIST *acur = NIL;
-
- if (IMAPG(imap_errorstack) != NIL) {
- /* output any remaining errors at their original error level */
- if (EG(error_reporting) & E_NOTICE) {
- ecur = IMAPG(imap_errorstack);
- while (ecur != NIL) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s (errflg=%d)", ecur->LTEXT, ecur->errflg);
- ecur = ecur->next;
- }
- }
- mail_free_errorlist(&IMAPG(imap_errorstack));
- }
-
- if (IMAPG(imap_alertstack) != NIL) {
- /* output any remaining alerts at E_NOTICE level */
- if (EG(error_reporting) & E_NOTICE) {
- acur = IMAPG(imap_alertstack);
- while (acur != NIL) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", acur->LTEXT);
- acur = acur->next;
- }
- }
- mail_free_stringlist(&IMAPG(imap_alertstack));
- IMAPG(imap_alertstack) = NIL;
- }
- return SUCCESS;
-}
-/* }}} */
-
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(imap)
-{
- php_info_print_table_start();
-#if HAVE_IMAP2001
- php_info_print_table_row(2, "IMAP c-Client Version", "2001");
-#elif HAVE_IMAP2000
- php_info_print_table_row(2, "IMAP c-Client Version", "2000");
-#elif defined(IMAP41)
- php_info_print_table_row(2, "IMAP c-Client Version", "4.1");
-#else
- php_info_print_table_row(2, "IMAP c-Client Version", "4.0");
-#endif
-#if HAVE_IMAP_SSL
- php_info_print_table_row(2, "SSL Support", "enabled");
-#endif
-#if HAVE_IMAP_KRB
- php_info_print_table_row(2, "Kerberos Support", "enabled");
-#endif
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ imap_do_open
- */
-static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- zval **mailbox, **user, **passwd, **options;
- MAILSTREAM *imap_stream;
- pils *imap_le_struct;
- long flags=NIL;
- long cl_flags=NIL;
- int myargc = ZEND_NUM_ARGS();
-
- if (myargc < 3 || myargc > 4 || zend_get_parameters_ex(myargc, &mailbox, &user, &passwd, &options) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(mailbox);
- convert_to_string_ex(user);
- convert_to_string_ex(passwd);
- if (myargc ==4) {
- convert_to_long_ex(options);
- flags = Z_LVAL_PP(options);
- if (flags & PHP_EXPUNGE) {
- cl_flags = CL_EXPUNGE;
- flags ^= PHP_EXPUNGE;
- }
- }
-
- if (IMAPG(imap_user)) {
- efree(IMAPG(imap_user));
- }
-
- if (IMAPG(imap_password)) {
- efree(IMAPG(imap_password));
- }
-
- IMAPG(imap_user) = estrndup(Z_STRVAL_PP(user), Z_STRLEN_PP(user));
- IMAPG(imap_password) = estrndup(Z_STRVAL_PP(passwd), Z_STRLEN_PP(passwd));
-
- imap_stream = mail_open(NIL, Z_STRVAL_PP(mailbox), flags);
-
- if (imap_stream == NIL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't open stream %s", Z_STRVAL_PP(mailbox));
- efree(IMAPG(imap_user)); IMAPG(imap_user) = 0;
- efree(IMAPG(imap_password)); IMAPG(imap_password) = 0;
- RETURN_FALSE;
- }
-
- imap_le_struct = emalloc(sizeof(pils));
- imap_le_struct->imap_stream = imap_stream;
- imap_le_struct->flags = cl_flags;
-
- ZEND_REGISTER_RESOURCE(return_value, imap_le_struct, le_imap);
-}
-/* }}} */
-
-/* {{{ proto resource imap_open(string mailbox, string user, string password [, int options])
- Open an IMAP stream to a mailbox */
-PHP_FUNCTION(imap_open)
-{
- php_imap_do_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto bool imap_reopen(resource stream_id, string mailbox [, int options])
- Reopen an IMAP stream to a new mailbox */
-PHP_FUNCTION(imap_reopen)
-{
- zval **streamind, **mailbox, **options;
- pils *imap_le_struct;
- MAILSTREAM *imap_stream;
- long flags=NIL;
- long cl_flags=NIL;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &mailbox, &options) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(mailbox);
-
- if (myargc == 3) {
- convert_to_long_ex(options);
- flags = Z_LVAL_PP(options);
- if (flags & PHP_EXPUNGE) {
- cl_flags = CL_EXPUNGE;
- flags ^= PHP_EXPUNGE;
- }
- imap_le_struct->flags = cl_flags;
- }
- imap_stream = mail_open(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox), flags);
- if (imap_stream == NIL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't re-open stream");
- RETURN_FALSE;
- }
- imap_le_struct->imap_stream = imap_stream;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool imap_append(resource stream_id, string folder, string message [, string options])
- Append a new message to a specified mailbox */
-PHP_FUNCTION(imap_append)
-{
- zval **streamind, **folder, **message, **flags;
- pils *imap_le_struct;
- STRING st;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc < 3 || myargc > 4 || zend_get_parameters_ex(myargc, &streamind, &folder, &message, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(folder);
- convert_to_string_ex(message);
-
- if (myargc == 4) {
- convert_to_string_ex(flags);
- }
-
- INIT (&st, mail_string, (void *) Z_STRVAL_PP(message), Z_STRLEN_PP(message));
-
- if (mail_append_full(imap_le_struct->imap_stream, Z_STRVAL_PP(folder), myargc==4 ? Z_STRVAL_PP(flags) : NIL, NIL, &st)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int imap_num_msg(resource stream_id)
- Gives the number of messages in the current mailbox */
-PHP_FUNCTION(imap_num_msg)
-{
- zval **streamind;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- RETURN_LONG(imap_le_struct->imap_stream->nmsgs);
-}
-/* }}} */
-
-/* {{{ proto bool imap_ping(resource stream_id)
- Check if the IMAP stream is still active */
-PHP_FUNCTION(imap_ping)
-{
- zval **streamind;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- RETURN_BOOL(mail_ping(imap_le_struct->imap_stream));
-}
-/* }}} */
-
-/* {{{ proto int imap_num_recent(resource stream_id)
- Gives the number of recent messages in current mailbox */
-PHP_FUNCTION(imap_num_recent)
-{
- zval **streamind;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- RETURN_LONG(imap_le_struct->imap_stream->recent);
-}
-/* }}} */
-
-#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
-/* {{{ proto array imap_get_quota(resource stream_id, string qroot)
- Returns the quota set to the mailbox account qroot */
-PHP_FUNCTION(imap_get_quota)
-{
- zval **streamind, **qroot;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &qroot) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(qroot);
-
- array_init(return_value);
- IMAPG(quota_return) = &return_value;
-
- /* set the callback for the GET_QUOTA function */
- mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota);
- if(!imap_getquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "c-client imap_getquota failed");
- zval_dtor(return_value);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array imap_get_quotaroot(resource stream_id, string mbox)
- Returns the quota set to the mailbox account mbox */
-PHP_FUNCTION(imap_get_quotaroot)
-{
- zval **streamind, **mbox;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &mbox) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(mbox);
-
- array_init(return_value);
- IMAPG(quota_return) = &return_value;
-
- /* set the callback for the GET_QUOTAROOT function */
- mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota);
- if(!imap_getquotaroot(imap_le_struct->imap_stream, Z_STRVAL_PP(mbox))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "c-client imap_getquotaroot failed");
- zval_dtor(return_value);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool imap_set_quota(resource stream_id, string qroot, int mailbox_size)
- Will set the quota for qroot mailbox */
-PHP_FUNCTION(imap_set_quota)
-{
- zval **streamind, **qroot, **mailbox_size;
- pils *imap_le_struct;
- STRINGLIST limits;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &streamind, &qroot, &mailbox_size) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(qroot);
- convert_to_long_ex(mailbox_size);
-
- limits.text.data = "STORAGE";
- limits.text.size = Z_LVAL_PP(mailbox_size);
- limits.next = NIL;
-
- RETURN_BOOL(imap_setquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot), &limits));
-}
-/* }}} */
-
-/* {{{ proto bool imap_setacl(resource stream_id, string mailbox, string id, string rights)
- Sets the ACL for a given mailbox */
-PHP_FUNCTION(imap_setacl)
-{
- zval **streamind, **mailbox, **id, **rights;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &streamind, &mailbox, &id, &rights) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(mailbox);
- convert_to_string_ex(rights);
-
- RETURN_BOOL(imap_setacl(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox), Z_STRVAL_PP(id), Z_STRVAL_PP(rights)));
-}
-/* }}} */
-
-#endif /* HAVE_IMAP2000 || HAVE_IMAP2001 */
-
-
-/* {{{ proto bool imap_expunge(resource stream_id)
- Permanently delete all messages marked for deletion */
-PHP_FUNCTION(imap_expunge)
-{
- zval **streamind;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- mail_expunge (imap_le_struct->imap_stream);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool imap_close(resource stream_id [, int options])
- Close an IMAP stream */
-PHP_FUNCTION(imap_close)
-{
- zval **options, **streamind=NULL;
- pils *imap_le_struct=NULL;
- long flags = NIL;
- int myargcount=ZEND_NUM_ARGS();
-
- if (myargcount < 1 || myargcount > 2 || zend_get_parameters_ex(myargcount, &streamind, &options) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- if (myargcount == 2) {
- convert_to_long_ex(options);
- flags = Z_LVAL_PP(options);
- /* Do the translation from PHP's internal PHP_EXPUNGE define to c-client's CL_EXPUNGE */
- if (flags & PHP_EXPUNGE) {
- flags ^= PHP_EXPUNGE;
- flags |= CL_EXPUNGE;
- }
- imap_le_struct->flags = flags;
- }
-
- zend_list_delete(Z_RESVAL_PP(streamind));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array imap_headers(resource stream_id)
- Returns headers for all messages in a mailbox */
-PHP_FUNCTION(imap_headers)
-{
- zval **streamind;
- pils *imap_le_struct;
- unsigned long i;
- char *t;
- unsigned int msgno;
- char tmp[MAILTMPLEN];
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- /* Initialize return array */
- array_init(return_value);
-
- for (msgno = 1; msgno <= imap_le_struct->imap_stream->nmsgs; msgno++) {
- MESSAGECACHE * cache = mail_elt (imap_le_struct->imap_stream, msgno);
- mail_fetchstructure(imap_le_struct->imap_stream, msgno, NIL);
- tmp[0] = cache->recent ? (cache->seen ? 'R': 'N') : ' ';
- tmp[1] = (cache->recent | cache->seen) ? ' ' : 'U';
- tmp[2] = cache->flagged ? 'F' : ' ';
- tmp[3] = cache->answered ? 'A' : ' ';
- tmp[4] = cache->deleted ? 'D' : ' ';
- tmp[5] = cache->draft ? 'X' : ' ';
- sprintf(tmp + 6, "%4ld) ", cache->msgno);
- mail_date(tmp+11, cache);
- tmp[22] = ' ';
- tmp[23] = '\0';
- mail_fetchfrom(tmp+23, imap_le_struct->imap_stream, msgno, (long)20);
- strcat(tmp, " ");
- if ((i = cache->user_flags)) {
- strcat(tmp, "{");
- while (i) {
- strcat(tmp, imap_le_struct->imap_stream->user_flags[find_rightmost_bit (&i)]);
- if (i) strcat(tmp, " ");
- }
- strcat(tmp, "} ");
- }
- mail_fetchsubject(t = tmp + strlen(tmp), imap_le_struct->imap_stream, msgno, (long)25);
- sprintf(t += strlen(t), " (%ld chars)", cache->rfc822_size);
- add_next_index_string(return_value, tmp, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto string imap_body(resource stream_id, int msg_no [, int options])
- Read the message body */
-PHP_FUNCTION(imap_body)
-{
- zval **streamind, **msgno, **flags;
- pils *imap_le_struct;
- int msgindex, myargc=ZEND_NUM_ARGS();
-
- if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &msgno, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_long_ex(msgno);
- if (myargc == 3) {
- convert_to_long_ex(flags);
- }
-
- if ((myargc == 3) && (Z_LVAL_PP(flags) & FT_UID)) {
- /* This should be cached; if it causes an extra RTT to the
- IMAP server, then that's the price we pay for making
- sure we don't crash. */
- msgindex = mail_msgno(imap_le_struct->imap_stream, Z_LVAL_PP(msgno));
- } else {
- msgindex = Z_LVAL_PP(msgno);
- }
- if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message number");
- RETURN_FALSE;
- }
-
- RETVAL_STRING(mail_fetchtext_full (imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, myargc==3 ? Z_LVAL_PP(flags) : NIL), 1);
-}
-/* }}} */
-
-/* {{{ proto bool imap_mail_copy(resource stream_id, int msg_no, string mailbox [, int options])
- Copy specified message to a mailbox */
-PHP_FUNCTION(imap_mail_copy)
-{
- zval **streamind, **seq, **folder, **options;
- pils *imap_le_struct;
- int myargcount = ZEND_NUM_ARGS();
-
- if (myargcount > 4 || myargcount < 3 || zend_get_parameters_ex(myargcount, &streamind, &seq, &folder, &options) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(seq);
- convert_to_string_ex(folder);
- if (myargcount == 4) {
- convert_to_long_ex(options);
- }
-
- if (mail_copy_full(imap_le_struct->imap_stream, Z_STRVAL_PP(seq), Z_STRVAL_PP(folder), myargcount==4 ? Z_LVAL_PP(options) : NIL)==T) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool imap_mail_move(resource stream_id, int msg_no, string mailbox [, int options])
- Move specified message to a mailbox */
-PHP_FUNCTION(imap_mail_move)
-{
- zval **streamind, **seq, **folder, **options;
- pils *imap_le_struct;
- int myargcount = ZEND_NUM_ARGS();
-
- if (myargcount > 4 || myargcount < 3 || zend_get_parameters_ex(myargcount, &streamind, &seq, &folder, &options) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(seq);
- convert_to_string_ex(folder);
- if (myargcount == 4) {
- convert_to_long_ex(options);
- }
-
- if (mail_copy_full(imap_le_struct->imap_stream, Z_STRVAL_PP(seq), Z_STRVAL_PP(folder), myargcount == 4 ? (Z_LVAL_PP(options) | CP_MOVE) : CP_MOVE) == T) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool imap_createmailbox(resource stream_id, string mailbox)
- Create a new mailbox */
-PHP_FUNCTION(imap_createmailbox)
-{
- zval **streamind, **folder;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &folder) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(folder);
-
- if (mail_create(imap_le_struct->imap_stream, Z_STRVAL_PP(folder)) == T) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool imap_renamemailbox(resource stream_id, string old_name, string new_name)
- Rename a mailbox */
-PHP_FUNCTION(imap_renamemailbox)
-{
- zval **streamind, **old_mailbox, **new_mailbox;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &streamind, &old_mailbox, &new_mailbox) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(old_mailbox);
- convert_to_string_ex(new_mailbox);
-
- if (mail_rename(imap_le_struct->imap_stream, Z_STRVAL_PP(old_mailbox), Z_STRVAL_PP(new_mailbox))==T) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool imap_deletemailbox(resource stream_id, string mailbox)
- Delete a mailbox */
-PHP_FUNCTION(imap_deletemailbox)
-{
- zval **streamind, **folder;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &folder) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(folder);
-
- if (mail_delete(imap_le_struct->imap_stream, Z_STRVAL_PP(folder))==T) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array imap_list(resource stream_id, string ref, string pattern)
- Read the list of mailboxes */
-PHP_FUNCTION(imap_list)
-{
- zval **streamind, **ref, **pat;
- pils *imap_le_struct;
- STRINGLIST *cur=NIL;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &streamind, &ref, &pat) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(ref);
- convert_to_string_ex(pat);
-
- /* set flag for normal, old mailbox list */
- IMAPG(folderlist_style) = FLIST_ARRAY;
-
- IMAPG(imap_folders) = IMAPG(imap_folders_tail) = NIL;
- mail_list(imap_le_struct->imap_stream, Z_STRVAL_PP(ref), Z_STRVAL_PP(pat));
- if (IMAPG(imap_folders) == NIL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- cur=IMAPG(imap_folders);
- while (cur != NIL) {
- add_next_index_string(return_value, cur->LTEXT, 1);
- cur=cur->next;
- }
- mail_free_stringlist (&IMAPG(imap_folders));
- IMAPG(imap_folders) = IMAPG(imap_folders_tail) = NIL;
-}
-
-/* }}} */
-
-/* {{{ proto array imap_getmailboxes(resource stream_id, string ref, string pattern)
- Reads the list of mailboxes and returns a full array of objects containing name, attributes, and delimiter */
-/* Author: CJH */
-PHP_FUNCTION(imap_list_full)
-{
- zval **streamind, **ref, **pat, *mboxob;
- pils *imap_le_struct;
- FOBJECTLIST *cur=NIL;
- char *delim=NIL;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &streamind, &ref, &pat) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(ref);
- convert_to_string_ex(pat);
-
- /* set flag for new, improved array of objects mailbox list */
- IMAPG(folderlist_style) = FLIST_OBJECT;
-
- IMAPG(imap_folder_objects) = IMAPG(imap_folder_objects_tail) = NIL;
- mail_list(imap_le_struct->imap_stream, Z_STRVAL_PP(ref), Z_STRVAL_PP(pat));
- if (IMAPG(imap_folder_objects) == NIL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- delim = emalloc(2 * sizeof(char));
- cur=IMAPG(imap_folder_objects);
- while (cur != NIL) {
- MAKE_STD_ZVAL(mboxob);
- object_init(mboxob);
- add_property_string(mboxob, "name", cur->LTEXT, 1);
- add_property_long(mboxob, "attributes", cur->attributes);
-#ifdef IMAP41
- delim[0] = (char)cur->delimiter;
- delim[1] = 0;
- add_property_string(mboxob, "delimiter", delim, 1);
-#else
- add_property_string(mboxob, "delimiter", cur->delimiter, 1);
-#endif
- add_next_index_object(return_value, mboxob TSRMLS_CC);
- cur=cur->next;
- }
- mail_free_foblist(&IMAPG(imap_folder_objects), &IMAPG(imap_folder_objects_tail));
- efree(delim);
- IMAPG(folderlist_style) = FLIST_ARRAY; /* reset to default */
-}
-/* }}} */
-
-/* {{{ proto array imap_scan(resource stream_id, string ref, string pattern, string content)
- Read list of mailboxes containing a certain string */
-PHP_FUNCTION(imap_listscan)
-{
- zval **streamind, **ref, **pat, **content;
- pils *imap_le_struct;
- STRINGLIST *cur=NIL;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &streamind, &ref, &pat, &content) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(ref);
- convert_to_string_ex(pat);
- convert_to_string_ex(content);
-
- IMAPG(imap_folders) = NIL;
- mail_scan(imap_le_struct->imap_stream, Z_STRVAL_PP(ref), Z_STRVAL_PP(pat), Z_STRVAL_PP(content));
- if (IMAPG(imap_folders) == NIL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- cur=IMAPG(imap_folders);
- while (cur != NIL) {
- add_next_index_string(return_value, cur->LTEXT, 1);
- cur=cur->next;
- }
- mail_free_stringlist (&IMAPG(imap_folders));
- IMAPG(imap_folders) = IMAPG(imap_folders_tail) = NIL;
-}
-
-/* }}} */
-
-/* {{{ proto object imap_check(resource stream_id)
- Get mailbox properties */
-PHP_FUNCTION(imap_check)
-{
- zval **streamind;
- pils *imap_le_struct;
- char date[100];
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- if (mail_ping (imap_le_struct->imap_stream) == NIL) {
- RETURN_FALSE;
- }
-
- if (imap_le_struct->imap_stream && imap_le_struct->imap_stream->mailbox) {
- rfc822_date(date);
- object_init(return_value);
- add_property_string(return_value, "Date", date, 1);
- add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name, 1);
- add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox, 1);
- add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs);
- add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool imap_delete(resource stream_id, int msg_no [, int options])
- Mark a message for deletion */
-PHP_FUNCTION(imap_delete)
-{
- zval **streamind, **sequence, **flags;
- pils *imap_le_struct;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &sequence, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(sequence);
- if (myargc == 3) {
- convert_to_long_ex(flags);
- }
-
- mail_setflag_full(imap_le_struct->imap_stream, Z_STRVAL_PP(sequence), "\\DELETED", myargc==3 ? Z_LVAL_PP(flags) : NIL);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool imap_undelete(resource stream_id, int msg_no)
- Remove the delete flag from a message */
-PHP_FUNCTION(imap_undelete)
-{
- zval **streamind, **sequence, **flags;
- pils *imap_le_struct;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &sequence, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(sequence);
- if (myargc == 3) {
- convert_to_long_ex(flags);
- }
-
- mail_clearflag_full(imap_le_struct->imap_stream, Z_STRVAL_PP(sequence), "\\DELETED", myargc==3 ? Z_LVAL_PP(flags) : NIL);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto object imap_headerinfo(resource stream_id, int msg_no [, int from_length [, int subject_length [, string default_host]]])
- Read the headers of the message */
-PHP_FUNCTION(imap_headerinfo)
-{
- zval **streamind, **msgno, **fromlength, **subjectlength, **defaulthost;
- pils *imap_le_struct;
- MESSAGECACHE *cache;
- ENVELOPE *en;
- char dummy[2000], fulladdress[MAILTMPLEN];
- int myargc = ZEND_NUM_ARGS();
-
- if (myargc < 2 || myargc > 5 || zend_get_parameters_ex(myargc, &streamind, &msgno, &fromlength, &subjectlength, &defaulthost) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_long_ex(msgno);
- if (myargc >= 3) {
- convert_to_long_ex(fromlength);
- } else {
- fromlength = 0x00;
- }
- if (myargc >= 4) {
- convert_to_long_ex(subjectlength);
- } else {
- subjectlength = 0x00;
- }
- if (myargc == 5) {
- convert_to_string_ex(defaulthost);
- }
-
- if (!Z_LVAL_PP(msgno) || Z_LVAL_PP(msgno) < 1 || (unsigned) Z_LVAL_PP(msgno) > imap_le_struct->imap_stream->nmsgs) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message number");
- RETURN_FALSE;
- }
-
- if (mail_fetchstructure(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL)) {
- cache = mail_elt(imap_le_struct->imap_stream, Z_LVAL_PP(msgno));
- } else {
- RETURN_FALSE;
- }
-
- en = mail_fetchenvelope(imap_le_struct->imap_stream, Z_LVAL_PP(msgno));
-
- /* call a function to parse all the text, so that we can use the
- same function to parse text from other sources */
- _php_make_header_object(return_value, en TSRMLS_CC);
-
- /* now run through properties that are only going to be returned
- from a server, not text headers */
- add_property_string(return_value, "Recent", cache->recent ? (cache->seen ? "R": "N") : " ", 1);
- add_property_string(return_value, "Unseen", (cache->recent | cache->seen) ? " " : "U", 1);
- add_property_string(return_value, "Flagged", cache->flagged ? "F" : " ", 1);
- add_property_string(return_value, "Answered", cache->answered ? "A" : " ", 1);
- add_property_string(return_value, "Deleted", cache->deleted ? "D" : " ", 1);
- add_property_string(return_value, "Draft", cache->draft ? "X" : " ", 1);
-
- sprintf(dummy, "%4ld", cache->msgno);
- add_property_string(return_value, "Msgno", dummy, 1);
-
- mail_date(dummy, cache);
- add_property_string(return_value, "MailDate", dummy, 1);
-
- sprintf(dummy, "%ld", cache->rfc822_size);
- add_property_string(return_value, "Size", dummy, 1);
-
- add_property_long(return_value, "udate", mail_longdate(cache));
-
- if (en->from && fromlength) {
- fulladdress[0] = 0x00;
- mail_fetchfrom(fulladdress, imap_le_struct->imap_stream, Z_LVAL_PP(msgno), Z_LVAL_PP(fromlength));
- add_property_string(return_value, "fetchfrom", fulladdress, 1);
- }
- if (en->subject && subjectlength) {
- fulladdress[0] = 0x00;
- mail_fetchsubject(fulladdress, imap_le_struct->imap_stream, Z_LVAL_PP(msgno), Z_LVAL_PP(subjectlength));
- add_property_string(return_value, "fetchsubject", fulladdress, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto object imap_rfc822_parse_headers(string headers [, string default_host])
- Parse a set of mail headers contained in a string, and return an object similar to imap_headerinfo() */
-PHP_FUNCTION(imap_rfc822_parse_headers)
-{
- zval **headers, **defaulthost;
- ENVELOPE *en;
- int myargc = ZEND_NUM_ARGS();
-
- if (myargc < 1 || myargc > 2 || zend_get_parameters_ex(myargc, &headers, &defaulthost) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(headers);
- if (myargc == 2) {
- convert_to_string_ex(defaulthost);
- }
-
- if (myargc == 2) {
- rfc822_parse_msg(&en, NULL, Z_STRVAL_PP(headers), Z_STRLEN_PP(headers), NULL, Z_STRVAL_PP(defaulthost), NIL);
- } else {
- rfc822_parse_msg(&en, NULL, Z_STRVAL_PP(headers), Z_STRLEN_PP(headers), NULL, "UNKNOWN", NIL);
- }
-
- /* call a function to parse all the text, so that we can use the
- same function no matter where the headers are from */
- _php_make_header_object(return_value, en TSRMLS_CC);
- mail_free_envelope(&en);
-}
-/* }}} */
-
-
-/* KMLANG */
-/* {{{ proto array imap_lsub(resource stream_id, string ref, string pattern)
- Return a list of subscribed mailboxes */
-PHP_FUNCTION(imap_lsub)
-{
- zval **streamind, **ref, **pat;
- pils *imap_le_struct;
- STRINGLIST *cur=NIL;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &streamind, &ref, &pat) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(ref);
- convert_to_string_ex(pat);
-
- /* set flag for normal, old mailbox list */
- IMAPG(folderlist_style) = FLIST_ARRAY;
-
- IMAPG(imap_sfolders) = NIL;
- mail_lsub(imap_le_struct->imap_stream, Z_STRVAL_PP(ref), Z_STRVAL_PP(pat));
- if (IMAPG(imap_sfolders) == NIL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- cur=IMAPG(imap_sfolders);
- while (cur != NIL) {
- add_next_index_string(return_value, cur->LTEXT, 1);
- cur=cur->next;
- }
- mail_free_stringlist (&IMAPG(imap_sfolders));
- IMAPG(imap_sfolders) = IMAPG(imap_sfolders_tail) = NIL;
-}
-/* }}} */
-
-/* {{{ proto array imap_getsubscribed(resource stream_id, string ref, string pattern)
- Return a list of subscribed mailboxes, in the same format as imap_getmailboxes() */
-/* Author: CJH */
-PHP_FUNCTION(imap_lsub_full)
-{
- zval **streamind, **ref, **pat, *mboxob;
- pils *imap_le_struct;
- FOBJECTLIST *cur=NIL;
- char *delim=NIL;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &streamind, &ref, &pat) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(ref);
- convert_to_string_ex(pat);
-
- delim = emalloc(2 * sizeof(char));
-
- /* set flag for new, improved array of objects list */
- IMAPG(folderlist_style) = FLIST_OBJECT;
-
- IMAPG(imap_sfolder_objects) = IMAPG(imap_sfolder_objects_tail) = NIL;
- mail_lsub(imap_le_struct->imap_stream, Z_STRVAL_PP(ref), Z_STRVAL_PP(pat));
- if (IMAPG(imap_sfolder_objects) == NIL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- cur=IMAPG(imap_sfolder_objects);
- while (cur != NIL) {
- MAKE_STD_ZVAL(mboxob);
- object_init(mboxob);
- add_property_string(mboxob, "name", cur->LTEXT, 1);
- add_property_long(mboxob, "attributes", cur->attributes);
-#ifdef IMAP41
- delim[0] = (char)cur->delimiter;
- delim[1] = 0;
- add_property_string(mboxob, "delimiter", delim, 1);
-#else
- add_property_string(mboxob, "delimiter", cur->delimiter, 1);
-#endif
- add_next_index_object(return_value, mboxob TSRMLS_CC);
- cur=cur->next;
- }
- mail_free_foblist (&IMAPG(imap_sfolder_objects), &IMAPG(imap_sfolder_objects_tail));
- efree(delim);
- IMAPG(folderlist_style) = FLIST_ARRAY; /* reset to default */
-}
-/* }}} */
-
-/* {{{ proto bool imap_subscribe(resource stream_id, string mailbox)
- Subscribe to a mailbox */
-PHP_FUNCTION(imap_subscribe)
-{
- zval **streamind, **folder;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &folder) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(folder);
-
- if (mail_subscribe(imap_le_struct->imap_stream, Z_STRVAL_PP(folder))==T) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool imap_unsubscribe(resource stream_id, string mailbox)
- Unsubscribe from a mailbox */
-PHP_FUNCTION(imap_unsubscribe)
-{
- zval **streamind, **folder;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &folder) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(folder);
-
- if (mail_unsubscribe(imap_le_struct->imap_stream, Z_STRVAL_PP(folder))==T) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto object imap_fetchstructure(resource stream_id, int msg_no [, int options])
- Read the full structure of a message */
-PHP_FUNCTION(imap_fetchstructure)
-{
- zval **streamind, **msgno, **flags;
- pils *imap_le_struct;
- BODY *body;
- int msgindex, myargc=ZEND_NUM_ARGS();
-
- if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &msgno, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_long_ex(msgno);
- if (Z_LVAL_PP(msgno) < 1) {
- RETURN_FALSE;
- }
- if (myargc == 3) {
- convert_to_long_ex(flags);
- }
-
- object_init(return_value);
-
- if ((myargc == 3) && (Z_LVAL_PP(flags) & FT_UID)) {
- /* This should be cached; if it causes an extra RTT to the
- IMAP server, then that's the price we pay for making
- sure we don't crash. */
- msgindex = mail_msgno(imap_le_struct->imap_stream, Z_LVAL_PP(msgno));
- } else {
- msgindex = Z_LVAL_PP(msgno);
- }
- if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message number");
- RETURN_FALSE;
- }
-
- mail_fetchstructure_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), &body , myargc == 3 ? Z_LVAL_PP(flags) : NIL);
-
- if (!body) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No body information available");
- RETURN_FALSE;
- }
-
- _php_imap_add_body(return_value, body TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto string imap_fetchbody(resource stream_id, int msg_no, int section [, int options])
- Get a specific body section */
-PHP_FUNCTION(imap_fetchbody)
-{
- zval **streamind, **msgno, **sec, **flags;
- pils *imap_le_struct;
- char *body;
- unsigned long len;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc < 3 || myargc > 4 || zend_get_parameters_ex(myargc, &streamind, &msgno, &sec, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_long_ex(msgno);
- convert_to_string_ex(sec);
- if (myargc == 4) {
- convert_to_long_ex(flags);
- }
-
- body = mail_fetchbody_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), Z_STRVAL_PP(sec), &len, myargc==4 ? Z_LVAL_PP(flags) : NIL);
-
- if (!body) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No body information available");
- RETURN_FALSE;
- }
- RETVAL_STRINGL(body, len, 1);
-}
-
-/* }}} */
-
-/* {{{ proto string imap_base64(string text)
- Decode BASE64 encoded text */
-PHP_FUNCTION(imap_base64)
-{
- zval **text;
- char *decode;
- unsigned long newlength;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &text) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(text);
-
- decode = (char *) rfc822_base64((unsigned char *) Z_STRVAL_PP(text), Z_STRLEN_PP(text), &newlength);
-
- if (decode == NULL) {
- RETURN_FALSE;
- }
-
- RETVAL_STRINGL(decode, newlength, 1);
- fs_give((void**) &decode);
-}
-/* }}} */
-
-/* {{{ proto string imap_qprint(string text)
- Convert a quoted-printable string to an 8-bit string */
-PHP_FUNCTION(imap_qprint)
-{
- zval **text;
- char *decode;
- unsigned long newlength;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &text) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(text);
-
- decode = (char *) rfc822_qprint((unsigned char *) Z_STRVAL_PP(text), Z_STRLEN_PP(text), &newlength);
-
- if (decode == NULL) {
- RETURN_FALSE;
- }
-
- RETVAL_STRINGL(decode, newlength, 1);
- fs_give((void**) &decode);
-}
-/* }}} */
-
-/* {{{ proto string imap_8bit(string text)
- Convert an 8-bit string to a quoted-printable string */
-PHP_FUNCTION(imap_8bit)
-{
- zval **text;
- char *decode;
- unsigned long newlength;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &text) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(text);
-
- decode = (char *) rfc822_8bit((unsigned char *) Z_STRVAL_PP(text), Z_STRLEN_PP(text), &newlength);
-
- if (decode == NULL) {
- RETURN_FALSE;
- }
-
- RETVAL_STRINGL(decode, newlength, 1);
- fs_give((void**) &decode);
-}
-/* }}} */
-
-/* {{{ proto string imap_binary(string text)
- Convert an 8bit string to a base64 string */
-PHP_FUNCTION(imap_binary)
-{
- zval **text;
- char *decode;
- unsigned long newlength;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &text) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(text);
-
- decode = rfc822_binary(Z_STRVAL_PP(text), Z_STRLEN_PP(text), &newlength);
-
- if (decode == NULL) {
- RETURN_FALSE;
- }
-
- RETVAL_STRINGL(decode, newlength, 1);
- fs_give((void**) &decode);
-}
-/* }}} */
-
-/* {{{ proto object imap_mailboxmsginfo(resource stream_id)
- Returns info about the current mailbox */
-PHP_FUNCTION(imap_mailboxmsginfo)
-{
- zval **streamind;
- pils *imap_le_struct;
- char date[100];
- unsigned int msgno, unreadmsg, deletedmsg, msize;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- /* Initialize return object */
- object_init(return_value);
-
- unreadmsg = 0;
- deletedmsg = 0;
- msize = 0;
-
- for (msgno = 1; msgno <= imap_le_struct->imap_stream->nmsgs; msgno++) {
- MESSAGECACHE * cache = mail_elt (imap_le_struct->imap_stream, msgno);
- mail_fetchstructure (imap_le_struct->imap_stream, msgno, NIL);
-
- if (!cache->seen || cache->recent) {
- unreadmsg++;
- }
-
- if (cache->deleted) {
- deletedmsg++;
- }
- msize = msize + cache->rfc822_size;
- }
- add_property_long(return_value, "Unread", unreadmsg);
- add_property_long(return_value, "Deleted", deletedmsg);
- add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs);
- add_property_long(return_value, "Size", msize);
- rfc822_date(date);
- add_property_string(return_value, "Date", date, 1);
- add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name, 1);
- add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox, 1);
- add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent);
-}
-/* }}} */
-
-/* {{{ proto string imap_rfc822_write_address(string mailbox, string host, string personal)
- Returns a properly formatted email address given the mailbox, host, and personal info */
-PHP_FUNCTION(imap_rfc822_write_address)
-{
- zval **mailbox, **host, **personal;
- ADDRESS *addr;
- char string[MAILTMPLEN];
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &mailbox, &host, &personal) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(mailbox);
- convert_to_string_ex(host);
- convert_to_string_ex(personal);
-
- addr=mail_newaddr();
-
- if (mailbox) {
- addr->mailbox = cpystr(Z_STRVAL_PP(mailbox));
- }
-
- if (host) {
- addr->host = cpystr(Z_STRVAL_PP(host));
- }
-
- if (personal) {
- addr->personal = cpystr(Z_STRVAL_PP(personal));
- }
-
- addr->next=NIL;
- addr->error=NIL;
- addr->adl=NIL;
-
- string[0]='\0';
- rfc822_write_address(string, addr);
- RETVAL_STRING(string, 1);
-}
-/* }}} */
-
-/* {{{ proto array imap_rfc822_parse_adrlist(string address_string, string default_host)
- Parses an address string */
-PHP_FUNCTION(imap_rfc822_parse_adrlist)
-{
- zval **str, **defaulthost, *tovals;
- ADDRESS *addresstmp;
- ENVELOPE *env;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &str, &defaulthost) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- SEPARATE_ZVAL(str);
- convert_to_string_ex(str);
- convert_to_string_ex(defaulthost);
-
- env = mail_newenvelope();
-
- rfc822_parse_adrlist(&env->to, Z_STRVAL_PP(str), Z_STRVAL_PP(defaulthost));
-
- array_init(return_value);
-
- addresstmp = env->to;
-
- if (addresstmp) do {
- MAKE_STD_ZVAL(tovals);
- object_init(tovals);
- if (addresstmp->mailbox) {
- add_property_string(tovals, "mailbox", addresstmp->mailbox, 1);
- }
- if (addresstmp->host) {
- add_property_string(tovals, "host", addresstmp->host, 1);
- }
- if (addresstmp->personal) {
- add_property_string(tovals, "personal", addresstmp->personal, 1);
- }
- if (addresstmp->adl) {
- add_property_string(tovals, "adl", addresstmp->adl, 1);
- }
- add_next_index_object(return_value, tovals TSRMLS_CC);
- } while ((addresstmp = addresstmp->next));
-}
-/* }}} */
-
-/* {{{ proto string imap_utf8(string mime_encoded_text)
- Convert a mime-encoded text to UTF-8 */
-PHP_FUNCTION(imap_utf8)
-{
- zval **str;
- SIZEDTEXT src, dest;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(str);
-
- src.data = NULL;
- src.size = 0;
- dest.data = NULL;
- dest.size = 0;
-
- cpytxt(&src, Z_STRVAL_PP(str), Z_STRLEN_PP(str));
- utf8_mime2text(&src, &dest);
- RETURN_STRINGL(dest.data, strlen(dest.data), 1);
-}
-/* }}} */
-
-
-/* {{{ macros for the modified utf7 conversion functions
- *
- * author: Andrew Skalski <askalski@chek.com>
- */
-
-/* tests `c' and returns true if it is a special character */
-#define SPECIAL(c) ((c) <= 0x1f || (c) >= 0x7f)
-
-/* validate a modified-base64 character */
-#define B64CHAR(c) (isalnum(c) || (c) == '+' || (c) == ',')
-
-/* map the low 64 bits of `n' to the modified-base64 characters */
-#define B64(n) ("ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
- "abcdefghijklmnopqrstuvwxyz0123456789+,"[(n) & 0x3f])
-
-/* map the modified-base64 character `c' to its 64 bit value */
-#define UNB64(c) ((c) == '+' ? 62 : (c) == ',' ? 63 : (c) >= 'a' ? \
- (c) - 71 : (c) >= 'A' ? (c) - 65 : (c) + 4)
-/* }}} */
-
-/* {{{ proto string imap_utf7_decode(string buf)
- Decode a modified UTF-7 string */
-PHP_FUNCTION(imap_utf7_decode)
-{
- /* author: Andrew Skalski <askalski@chek.com> */
- zval **arg;
- const unsigned char *in, *inp, *endp;
- unsigned char *out, *outp;
- unsigned char c;
- int inlen, outlen;
- enum {
- ST_NORMAL, /* printable text */
- ST_DECODE0, /* encoded text rotation... */
- ST_DECODE1,
- ST_DECODE2,
- ST_DECODE3
- } state;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_writable_string_ex(arg); /* Is this string really modified? */
-
- in = (const unsigned char *) Z_STRVAL_PP(arg);
- inlen = Z_STRLEN_PP(arg);
-
- /* validate and compute length of output string */
- outlen = 0;
- state = ST_NORMAL;
- for (endp = (inp = in) + inlen; inp < endp; inp++) {
- if (state == ST_NORMAL) {
- /* process printable character */
- if (SPECIAL(*inp)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid modified UTF-7 character: `%c'", *inp);
- RETURN_FALSE;
- } else if (*inp != '&') {
- outlen++;
- } else if (inp + 1 == endp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unexpected end of string");
- RETURN_FALSE;
- } else if (inp[1] != '-') {
- state = ST_DECODE0;
- } else {
- outlen++;
- inp++;
- }
- } else if (*inp == '-') {
- /* return to NORMAL mode */
- if (state == ST_DECODE1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Stray modified base64 character: `%c'", *--inp);
- RETURN_FALSE;
- }
- state = ST_NORMAL;
- } else if (!B64CHAR(*inp)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid modified base64 character: `%c'", *inp);
- RETURN_FALSE;
- } else {
- switch (state) {
- case ST_DECODE3:
- outlen++;
- state = ST_DECODE0;
- break;
- case ST_DECODE2:
- case ST_DECODE1:
- outlen++;
- case ST_DECODE0:
- state++;
- case ST_NORMAL:
- break;
- }
- }
- }
-
- /* enforce end state */
- if (state != ST_NORMAL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unexpected end of string");
- RETURN_FALSE;
- }
-
- /* allocate output buffer */
- out = emalloc(outlen + 1);
-
- /* decode input string */
- outp = out;
- state = ST_NORMAL;
- for (endp = (inp = in) + inlen; inp < endp; inp++) {
- if (state == ST_NORMAL) {
- if (*inp == '&' && inp[1] != '-') {
- state = ST_DECODE0;
- }
- else if ((*outp++ = *inp) == '&') {
- inp++;
- }
- }
- else if (*inp == '-') {
- state = ST_NORMAL;
- }
- else {
- /* decode input character */
- switch (state) {
- case ST_DECODE0:
- *outp = UNB64(*inp) << 2;
- state = ST_DECODE1;
- break;
- case ST_DECODE1:
- outp[1] = UNB64(*inp);
- c = outp[1] >> 4;
- *outp++ |= c;
- *outp <<= 4;
- state = ST_DECODE2;
- break;
- case ST_DECODE2:
- outp[1] = UNB64(*inp);
- c = outp[1] >> 2;
- *outp++ |= c;
- *outp <<= 6;
- state = ST_DECODE3;
- break;
- case ST_DECODE3:
- *outp++ |= UNB64(*inp);
- state = ST_DECODE0;
- case ST_NORMAL:
- break;
- }
- }
- }
-
- *outp = 0;
-
-#if PHP_DEBUG
- /* warn if we computed outlen incorrectly */
- if (outp - out != outlen) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "outp - out [%d] != outlen [%d]", outp - out, outlen);
- }
-#endif
-
- RETURN_STRINGL(out, outlen, 0);
-}
-/* }}} */
-
-/* {{{ proto string imap_utf7_encode(string buf)
- Encode a string in modified UTF-7 */
-PHP_FUNCTION(imap_utf7_encode)
-{
- /* author: Andrew Skalski <askalski@chek.com> */
- zval **arg;
- const unsigned char *in, *inp, *endp;
- unsigned char *out, *outp;
- unsigned char c;
- int inlen, outlen;
- enum {
- ST_NORMAL, /* printable text */
- ST_ENCODE0, /* encoded text rotation... */
- ST_ENCODE1,
- ST_ENCODE2
- } state;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(arg);
-
- in = (const unsigned char *) Z_STRVAL_PP(arg);
- inlen = Z_STRLEN_PP(arg);
-
- /* compute the length of the result string */
- outlen = 0;
- state = ST_NORMAL;
- endp = (inp = in) + inlen;
- while (inp < endp) {
- if (state == ST_NORMAL) {
- if (SPECIAL(*inp)) {
- state = ST_ENCODE0;
- outlen++;
- } else if (*inp++ == '&') {
- outlen++;
- }
- outlen++;
- } else if (!SPECIAL(*inp)) {
- state = ST_NORMAL;
- } else {
- /* ST_ENCODE0 -> ST_ENCODE1 - two chars
- * ST_ENCODE1 -> ST_ENCODE2 - one char
- * ST_ENCODE2 -> ST_ENCODE0 - one char
- */
- if (state == ST_ENCODE2) {
- state = ST_ENCODE0;
- }
- else if (state++ == ST_ENCODE0) {
- outlen++;
- }
- outlen++;
- inp++;
- }
- }
-
- /* allocate output buffer */
- out = emalloc(outlen + 1);
-
- /* encode input string */
- outp = out;
- state = ST_NORMAL;
- endp = (inp = in) + inlen;
- while (inp < endp || state != ST_NORMAL) {
- if (state == ST_NORMAL) {
- if (SPECIAL(*inp)) {
- /* begin encoding */
- *outp++ = '&';
- state = ST_ENCODE0;
- } else if ((*outp++ = *inp++) == '&') {
- *outp++ = '-';
- }
- } else if (inp == endp || !SPECIAL(*inp)) {
- /* flush overflow and terminate region */
- if (state != ST_ENCODE0) {
- c = B64(*outp);
- *outp++ = c;
- }
- *outp++ = '-';
- state = ST_NORMAL;
- } else {
- /* encode input character */
- switch (state) {
- case ST_ENCODE0:
- *outp++ = B64(*inp >> 2);
- *outp = *inp++ << 4;
- state = ST_ENCODE1;
- break;
- case ST_ENCODE1:
- c = B64(*outp | *inp >> 4);
- *outp++ = c;
- *outp = *inp++ << 2;
- state = ST_ENCODE2;
- break;
- case ST_ENCODE2:
- c = B64(*outp | *inp >> 6);
- *outp++ = c;
- *outp++ = B64(*inp++);
- state = ST_ENCODE0;
- case ST_NORMAL:
- break;
- }
- }
- }
-
- *outp = 0;
-
-#if PHP_DEBUG
- /* warn if we computed outlen incorrectly */
- if (outp - out != outlen) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "outp - out [%d] != outlen [%d]", outp - out, outlen);
- }
-#endif
-
- RETURN_STRINGL(out, outlen, 0);
-}
-/* }}} */
-
-#undef SPECIAL
-#undef B64CHAR
-#undef B64
-#undef UNB64
-
-/* {{{ proto bool imap_setflag_full(resource stream_id, string sequence, string flag [, int options])
- Sets flags on messages */
-PHP_FUNCTION(imap_setflag_full)
-{
- zval **streamind, **sequence, **flag, **flags;
- pils *imap_le_struct;
- int myargc = ZEND_NUM_ARGS();
-
- if (myargc < 3 || myargc > 4 || zend_get_parameters_ex(myargc, &streamind, &sequence, &flag, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(sequence);
- convert_to_string_ex(flag);
- if (myargc==4) {
- convert_to_long_ex(flags);
- }
-
- mail_setflag_full(imap_le_struct->imap_stream, Z_STRVAL_PP(sequence), Z_STRVAL_PP(flag), myargc==4 ? Z_LVAL_PP(flags) : NIL);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool imap_clearflag_full(resource stream_id, string sequence, string flag [, int options])
- Clears flags on messages */
-PHP_FUNCTION(imap_clearflag_full)
-{
- zval **streamind, **sequence, **flag, **flags;
- pils *imap_le_struct;
- int myargc = ZEND_NUM_ARGS();
-
- if (myargc < 3 || myargc > 4 || zend_get_parameters_ex(myargc, &streamind, &sequence, &flag, &flags) ==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(sequence);
- convert_to_string_ex(flag);
- if (myargc==4) {
- convert_to_long_ex(flags);
- }
-
- mail_clearflag_full(imap_le_struct->imap_stream, Z_STRVAL_PP(sequence), Z_STRVAL_PP(flag), myargc==4 ? Z_LVAL_PP(flags) : NIL);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array imap_sort(resource stream_id, int criteria, int reverse [, int options [, string search_criteria]])
- Sort an array of message headers, optionally including only messages that meet specified criteria. */
-PHP_FUNCTION(imap_sort)
-{
- zval **streamind, **pgm, **rev, **flags, **criteria;
- pils *imap_le_struct;
- unsigned long *slst, *sl;
- char *search_criteria;
- SORTPGM *mypgm=NIL;
- SEARCHPGM *spg=NIL;
- int myargc = ZEND_NUM_ARGS();
-
- if (myargc < 3 || myargc > 5 || zend_get_parameters_ex(myargc, &streamind, &pgm, &rev, &flags, &criteria) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_long_ex(rev);
- convert_to_long_ex(pgm);
- if (Z_LVAL_PP(pgm) > SORTSIZE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized sort criteria");
- RETURN_FALSE;
- }
- if (myargc >= 4) {
- convert_to_long_ex(flags);
- }
- if (myargc == 5) {
- search_criteria = estrndup(Z_STRVAL_PP(criteria), Z_STRLEN_PP(criteria));
- spg = mail_criteria(search_criteria);
- efree(search_criteria);
- } else {
- spg = mail_newsearchpgm();
- }
-
- mypgm = mail_newsortpgm();
- mypgm->reverse = Z_LVAL_PP(rev);
- mypgm->function = (short) Z_LVAL_PP(pgm);
- mypgm->next = NIL;
-
- slst = mail_sort(imap_le_struct->imap_stream, NIL, spg, mypgm, myargc >= 4 ? Z_LVAL_PP(flags) : NIL);
-
- if (spg) {
- mail_free_searchpgm(&spg);
- }
-
- array_init(return_value);
- if (slst != NIL && slst != 0) {
- for (sl = slst; *sl; sl++) {
- add_next_index_long(return_value, *sl);
- }
- fs_give ((void **) &slst);
- }
-}
-/* }}} */
-
-/* {{{ proto string imap_fetchheader(resource stream_id, int msg_no [, int options])
- Get the full unfiltered header for a message */
-PHP_FUNCTION(imap_fetchheader)
-{
- zval **streamind, **msgno, **flags;
- pils *imap_le_struct;
- int msgindex, myargc = ZEND_NUM_ARGS();
-
- if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &msgno, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_long_ex(msgno);
- if (myargc == 3) {
- convert_to_long_ex(flags);
- }
-
- if ((myargc == 3) && (Z_LVAL_PP(flags) & FT_UID)) {
- /* This should be cached; if it causes an extra RTT to the
- IMAP server, then that's the price we pay for making sure
- we don't crash. */
- msgindex = mail_msgno(imap_le_struct->imap_stream, Z_LVAL_PP(msgno));
- } else {
- msgindex = Z_LVAL_PP(msgno);
- }
-
- if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message number");
- RETURN_FALSE;
- }
-
- RETVAL_STRING(mail_fetchheader_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, NIL, (myargc == 3 ? Z_LVAL_PP(flags) : NIL)), 1);
-}
-/* }}} */
-
-/* {{{ proto int imap_uid(resource stream_id, int msg_no)
- Get the unique message id associated with a standard sequential message number */
-PHP_FUNCTION(imap_uid)
-{
- zval **streamind, **msgno;
- pils *imap_le_struct;
- int msgindex;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &msgno) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_long_ex(msgno);
-
- msgindex = Z_LVAL_PP(msgno);
- if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message number");
- RETURN_FALSE;
- }
-
- RETURN_LONG(mail_uid(imap_le_struct->imap_stream, Z_LVAL_PP(msgno)));
-}
-/* }}} */
-
-/* {{{ proto int imap_msgno(resource stream_id, int unique_msg_id)
- Get the sequence number associated with a UID */
-PHP_FUNCTION(imap_msgno)
-{
- zval **streamind, **msgno;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &msgno) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_long_ex(msgno);
-
- RETURN_LONG(mail_msgno(imap_le_struct->imap_stream, Z_LVAL_PP(msgno)));
-}
-/* }}} */
-
-/* {{{ proto object imap_status(resource stream_id, string mailbox, int options)
- Get status info from a mailbox */
-PHP_FUNCTION(imap_status)
-{
- zval **streamind, **mbx, **flags;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &streamind, &mbx, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(mbx);
- convert_to_long_ex(flags);
-
- object_init(return_value);
-
- if (mail_status(imap_le_struct->imap_stream, Z_STRVAL_PP(mbx), Z_LVAL_PP(flags))) {
- add_property_long(return_value, "flags", IMAPG(status_flags));
- if (IMAPG(status_flags) & SA_MESSAGES) {
- add_property_long(return_value, "messages", IMAPG(status_messages));
- }
- if (IMAPG(status_flags) & SA_RECENT) {
- add_property_long(return_value, "recent", IMAPG(status_recent));
- }
- if (IMAPG(status_flags) & SA_UNSEEN) {
- add_property_long(return_value, "unseen", IMAPG(status_unseen));
- }
- if (IMAPG(status_flags) & SA_UIDNEXT) {
- add_property_long(return_value, "uidnext", IMAPG(status_uidnext));
- }
- if (IMAPG(status_flags) & SA_UIDVALIDITY) {
- add_property_long(return_value, "uidvalidity", IMAPG(status_uidvalidity));
- }
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto object imap_bodystruct(resource stream_id, int msg_no, int section)
- Read the structure of a specified body section of a specific message */
-PHP_FUNCTION(imap_bodystruct)
-{
- zval **streamind, **msg, **section;
- pils *imap_le_struct;
- zval *parametres, *param, *dparametres, *dparam;
- PARAMETER *par, *dpar;
- BODY *body;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &streamind, &msg, &section) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_long_ex(msg);
- convert_to_string_ex(section);
-
- if (!Z_LVAL_PP(msg) || Z_LVAL_PP(msg) < 1 || (unsigned) Z_LVAL_PP(msg) > imap_le_struct->imap_stream->nmsgs) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message number");
- RETURN_FALSE;
- }
-
- object_init(return_value);
-
- body=mail_body(imap_le_struct->imap_stream, Z_LVAL_PP(msg), Z_STRVAL_PP(section));
- if (body->type <= TYPEMAX) {
- add_property_long(return_value, "type", body->type);
- }
- if (body->encoding <= ENCMAX) {
- add_property_long(return_value, "encoding", body->encoding);
- }
-
- if (body->subtype) {
- add_property_long(return_value, "ifsubtype", 1);
- add_property_string(return_value, "subtype", body->subtype, 1);
- } else {
- add_property_long(return_value, "ifsubtype", 0);
- }
-
- if (body->description) {
- add_property_long(return_value, "ifdescription", 1);
- add_property_string(return_value, "description", body->description, 1);
- } else {
- add_property_long(return_value, "ifdescription", 0);
- }
- if (body->id) {
- add_property_long(return_value, "ifid", 1);
- add_property_string(return_value, "id", body->id, 1);
- } else {
- add_property_long(return_value, "ifid", 0);
- }
-
-
- if (body->size.lines) {
- add_property_long(return_value, "lines", body->size.lines);
- }
- if (body->size.bytes) {
- add_property_long(return_value, "bytes", body->size.bytes);
- }
-#ifdef IMAP41
- if (body->disposition.type) {
- add_property_long(return_value, "ifdisposition", 1);
- add_property_string(return_value, "disposition", body->disposition.type, 1);
- } else {
- add_property_long(return_value, "ifdisposition", 0);
- }
-
- if (body->disposition.parameter) {
- dpar = body->disposition.parameter;
- add_property_long(return_value, "ifdparameters", 1);
- MAKE_STD_ZVAL(dparametres);
- array_init(dparametres);
- do {
- MAKE_STD_ZVAL(dparam);
- object_init(dparam);
- add_property_string(dparam, "attribute", dpar->attribute, 1);
- add_property_string(dparam, "value", dpar->value, 1);
- add_next_index_object(dparametres, dparam TSRMLS_CC);
- } while ((dpar = dpar->next));
- add_assoc_object(return_value, "dparameters", dparametres TSRMLS_CC);
- } else {
- add_property_long(return_value, "ifdparameters", 0);
- }
-#endif
-
- if ((par = body->parameter)) {
- add_property_long(return_value, "ifparameters", 1);
-
- MAKE_STD_ZVAL(parametres);
- array_init(parametres);
- do {
- MAKE_STD_ZVAL(param);
- object_init(param);
- if (par->attribute) {
- add_property_string(param, "attribute", par->attribute, 1);
- }
- if (par->value) {
- add_property_string(param, "value", par->value, 1);
- }
-
- add_next_index_object(parametres, param TSRMLS_CC);
- } while ((par = par->next));
- } else {
- MAKE_STD_ZVAL(parametres);
- object_init(parametres);
- add_property_long(return_value, "ifparameters", 0);
- }
- add_assoc_object(return_value, "parameters", parametres TSRMLS_CC);
-}
-
-/* }}} */
-
-/* {{{ proto array imap_fetch_overview(resource stream_id, int msg_no [, int options])
- Read an overview of the information in the headers of the given message sequence */
-PHP_FUNCTION(imap_fetch_overview)
-{
- zval **streamind, **sequence, **pflags;
- pils *imap_le_struct;
- zval *myoverview;
- char address[MAILTMPLEN];
- long status, flags=0L;
- int myargc = ZEND_NUM_ARGS();
-
- if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &sequence, &pflags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(sequence);
- if(myargc == 3) {
- convert_to_long_ex(pflags);
- flags = Z_LVAL_PP(pflags);
- }
-
- array_init(return_value);
-
- status = (flags & FT_UID)
- ? mail_uid_sequence (imap_le_struct->imap_stream, Z_STRVAL_PP(sequence))
- : mail_sequence (imap_le_struct->imap_stream, Z_STRVAL_PP(sequence));
-
- if (status) {
- MESSAGECACHE *elt;
- ENVELOPE *env;
- unsigned long i;
-
- for (i = 1; i <= imap_le_struct->imap_stream->nmsgs; i++) {
- if (((elt = mail_elt (imap_le_struct->imap_stream, i))->sequence) &&
- (env = mail_fetch_structure (imap_le_struct->imap_stream, i, NIL, NIL))) {
- MAKE_STD_ZVAL(myoverview);
- object_init(myoverview);
- if (env->subject) {
- add_property_string(myoverview, "subject", env->subject, 1);
- }
- if (env->from) {
- env->from->next=NULL;
- address[0] = '\0';
- rfc822_write_address(address, env->from);
- add_property_string(myoverview, "from", address, 1);
- }
- if (env->to) {
- env->to->next = NULL;
- address[0] = '\0';
- rfc822_write_address(address, env->to);
- add_property_string(myoverview, "to", address, 1);
- }
- if (env->date) {
- add_property_string(myoverview, "date", env->date, 1);
- }
- if (env->message_id) {
- add_property_string(myoverview, "message_id", env->message_id, 1);
- }
- if (env->references) {
- add_property_string(myoverview, "references", env->references, 1);
- }
- if (env->in_reply_to) {
- add_property_string(myoverview, "in_reply_to", env->in_reply_to, 1);
- }
- add_property_long(myoverview, "size", elt->rfc822_size);
- add_property_long(myoverview, "uid", mail_uid(imap_le_struct->imap_stream, i));
- add_property_long(myoverview, "msgno", i);
- add_property_long(myoverview, "recent", elt->recent);
- add_property_long(myoverview, "flagged", elt->flagged);
- add_property_long(myoverview, "answered", elt->answered);
- add_property_long(myoverview, "deleted", elt->deleted);
- add_property_long(myoverview, "seen", elt->seen);
- add_property_long(myoverview, "draft", elt->draft);
- add_next_index_object(return_value, myoverview TSRMLS_CC);
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string imap_mail_compose(array envelope, array body)
- Create a MIME message based on given envelope and body sections */
-PHP_FUNCTION(imap_mail_compose)
-{
- zval **envelope, **body;
- char *key;
- zval **data, **pvalue, **disp_data, **env_data;
- ulong ind;
- char *cookie = NIL;
- ENVELOPE *env;
- BODY *bod=NULL, *topbod=NULL;
- PART *mypart=NULL, *toppart=NULL, *part;
- PARAMETER *param, *disp_param = NULL, *custom_headers_param = NULL, *tmp_param = NULL;
- char tmp[8 * MAILTMPLEN], *mystring=NULL, *t=NULL, *tempstring=NULL;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &envelope, &body) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (Z_TYPE_PP(envelope) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected Array as envelope parameter");
- RETURN_FALSE;
- }
-
- if (Z_TYPE_PP(body) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected Array as body parameter");
- RETURN_FALSE;
- }
-
- env = mail_newenvelope();
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "remail", sizeof("remail"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- env->remail=cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "return_path", sizeof("return_path"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue)
- rfc822_parse_adrlist(&env->return_path, Z_STRVAL_PP(pvalue), "NO HOST");
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "date", sizeof("date"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- env->date=cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "from", sizeof("from"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- rfc822_parse_adrlist (&env->from, Z_STRVAL_PP(pvalue), "NO HOST");
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "reply_to", sizeof("reply_to"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- rfc822_parse_adrlist (&env->reply_to, Z_STRVAL_PP(pvalue), "NO HOST");
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "in_reply_to", sizeof("in_reply_to"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- env->in_reply_to=cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "subject", sizeof("subject"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- env->subject=cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "to", sizeof("to"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- rfc822_parse_adrlist (&env->to, Z_STRVAL_PP(pvalue), "NO HOST");
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "cc", sizeof("cc"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- rfc822_parse_adrlist (&env->cc, Z_STRVAL_PP(pvalue), "NO HOST");
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "bcc", sizeof("bcc"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- rfc822_parse_adrlist (&env->bcc, Z_STRVAL_PP(pvalue), "NO HOST");
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "message_id", sizeof("message_id"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- env->message_id=cpystr(Z_STRVAL_PP(pvalue));
- }
-
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "custom_headers", sizeof("custom_headers"), (void **) &pvalue)== SUCCESS) {
- if (Z_TYPE_PP(pvalue) == IS_ARRAY) {
- custom_headers_param = tmp_param = NULL;
- while (zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &env_data) == SUCCESS) {
- custom_headers_param = mail_newbody_parameter();
- convert_to_string_ex(env_data);
- custom_headers_param->value = (char *) fs_get(Z_STRLEN_PP(env_data) + 1);
- memcpy(custom_headers_param->value, Z_STRVAL_PP(env_data), Z_STRLEN_PP(env_data) + 1);
- zend_hash_move_forward(Z_ARRVAL_PP(pvalue));
- custom_headers_param->next = tmp_param;
- tmp_param = custom_headers_param;
- }
- }
- }
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(body));
- if (zend_hash_get_current_data(Z_ARRVAL_PP(body), (void **) &data) != SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "body parameter cannot be empty");
- RETURN_FALSE;
- }
- zend_hash_get_current_key(Z_ARRVAL_PP(body), &key, &ind, 0); /* FIXME: is this necessary? we're not using key/ind */
-
- if (Z_TYPE_PP(data) == IS_ARRAY) {
- bod = mail_newbody();
- topbod = bod;
-
- if (zend_hash_find(Z_ARRVAL_PP(data), "type", sizeof("type"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->type = (short) Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "encoding", sizeof("encoding"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->encoding = (short) Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "charset", sizeof("charset"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- tmp_param = mail_newbody_parameter();
- tmp_param->value = cpystr(Z_STRVAL_PP(pvalue));
- tmp_param->attribute = "CHARSET";
- tmp_param->next = bod->parameter;
- bod->parameter = tmp_param;
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "type.parameters", sizeof("type.parameters"), (void **) &pvalue)== SUCCESS) {
- if(Z_TYPE_PP(pvalue) == IS_ARRAY) {
- disp_param = tmp_param = NULL;
- while (zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &disp_data) == SUCCESS) {
- disp_param = mail_newbody_parameter();
- zend_hash_get_current_key(Z_ARRVAL_PP(pvalue), &key, &ind, 0);
- disp_param->attribute = key;
- convert_to_string_ex(disp_data);
- disp_param->value = (char *) fs_get(Z_STRLEN_PP(disp_data) + 1);
- memcpy(disp_param->value, Z_STRVAL_PP(disp_data), Z_STRLEN_PP(disp_data) + 1);
- zend_hash_move_forward(Z_ARRVAL_PP(pvalue));
- disp_param->next = tmp_param;
- tmp_param = disp_param;
- }
- bod->parameter = disp_param;
- }
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "subtype", sizeof("subtype"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->subtype = cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "id", sizeof("id"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->id = cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "description", sizeof("description"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->description = cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "disposition.type", sizeof("disposition.type"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->disposition.type = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1);
- memcpy(bod->disposition.type, Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "disposition", sizeof("disposition"), (void **) &pvalue)== SUCCESS) {
- if (Z_TYPE_PP(pvalue) == IS_ARRAY) {
- disp_param = tmp_param = NULL;
- while (zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &disp_data) == SUCCESS) {
- disp_param = mail_newbody_parameter();
- zend_hash_get_current_key(Z_ARRVAL_PP(pvalue), &key, &ind, 0);
- disp_param->attribute = key;
- convert_to_string_ex(disp_data);
- disp_param->value = (char *) fs_get(Z_STRLEN_PP(disp_data) + 1);
- memcpy(disp_param->value, Z_STRVAL_PP(disp_data), Z_STRLEN_PP(disp_data) + 1);
- zend_hash_move_forward(Z_ARRVAL_PP(pvalue));
- disp_param->next = tmp_param;
- tmp_param = disp_param;
- }
- bod->disposition.parameter = disp_param;
- }
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "contents.data", sizeof("contents.data"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->contents.text.data = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1);
- memcpy(bod->contents.text.data, Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1);
- bod->contents.text.size = Z_STRLEN_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "lines", sizeof("lines"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->size.lines = Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "bytes", sizeof("bytes"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->size.bytes = Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "md5", sizeof("md5"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->md5 = cpystr(Z_STRVAL_PP(pvalue));
- }
- }
-
- zend_hash_move_forward(Z_ARRVAL_PP(body));
-
- while (zend_hash_get_current_data(Z_ARRVAL_PP(body), (void **) &data) == SUCCESS) {
- zend_hash_get_current_key(Z_ARRVAL_PP(body), &key, &ind, 0); /* FIXME: Is this necessary? We're not using key/ind */
- if (Z_TYPE_PP(data) == IS_ARRAY) {
- if (!toppart) {
- bod->nested.part = mail_newbody_part();
- mypart = bod->nested.part;
- toppart = mypart;
- bod=&mypart->body;
- } else {
- mypart->next = mail_newbody_part();
- mypart = mypart->next;
- bod = &mypart->body;
- }
-
- if (zend_hash_find(Z_ARRVAL_PP(data), "type", sizeof("type"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->type = (short) Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "encoding", sizeof("encoding"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->encoding = (short) Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "charset", sizeof("charset"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- tmp_param = mail_newbody_parameter();
- tmp_param->value = cpystr(Z_STRVAL_PP(pvalue));
- tmp_param->attribute = "CHARSET";
- tmp_param->next = bod->parameter;
- bod->parameter = tmp_param;
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "type.parameters", sizeof("type.parameters"), (void **) &pvalue)== SUCCESS) {
- if(Z_TYPE_PP(pvalue) == IS_ARRAY) {
- disp_param = tmp_param = NULL;
- while (zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &disp_data) == SUCCESS) {
- disp_param = mail_newbody_parameter();
- zend_hash_get_current_key(Z_ARRVAL_PP(pvalue), &key, &ind, 0);
- disp_param->attribute = key;
- convert_to_string_ex(disp_data);
- disp_param->value = (char *) fs_get(Z_STRLEN_PP(disp_data) + 1);
- memcpy(disp_param->value, Z_STRVAL_PP(disp_data), Z_STRLEN_PP(disp_data) + 1);
- zend_hash_move_forward(Z_ARRVAL_PP(pvalue));
- disp_param->next = tmp_param;
- tmp_param = disp_param;
- }
- bod->parameter = disp_param;
- }
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "subtype", sizeof("subtype"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->subtype = cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "id", sizeof("id"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->id = cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "description", sizeof("description"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->description = cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "disposition.type", sizeof("disposition.type"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->disposition.type = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1);
- memcpy(bod->disposition.type, Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "disposition", sizeof("disposition"), (void **) &pvalue)== SUCCESS) {
- if (Z_TYPE_PP(pvalue) == IS_ARRAY) {
- disp_param = tmp_param = NULL;
- while (zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &disp_data) == SUCCESS) {
- disp_param = mail_newbody_parameter();
- zend_hash_get_current_key(Z_ARRVAL_PP(pvalue), &key, &ind, 0);
- disp_param->attribute = key;
- convert_to_string_ex(disp_data);
- disp_param->value = (char *) fs_get(Z_STRLEN_PP(disp_data) + 1);
- memcpy(disp_param->value, Z_STRVAL_PP(disp_data), Z_STRLEN_PP(disp_data) + 1);
- zend_hash_move_forward(Z_ARRVAL_PP(pvalue));
- disp_param->next = tmp_param;
- tmp_param = disp_param;
- }
- bod->disposition.parameter = disp_param;
- }
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "contents.data", sizeof("contents.data"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->contents.text.data = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1);
- memcpy(bod->contents.text.data, Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue) + 1);
- bod->contents.text.size = Z_STRLEN_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "lines", sizeof("lines"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->size.lines = Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "bytes", sizeof("bytes"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->size.bytes = Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "md5", sizeof("md5"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->md5 = cpystr(Z_STRVAL_PP(pvalue));
- }
-
- zend_hash_move_forward(Z_ARRVAL_PP(body));
- }
- }
-
- rfc822_encode_body_7bit(env, topbod);
- rfc822_header (tmp, env, topbod);
-
- /* add custom envelope headers */
- if (custom_headers_param) {
- /* remove last CRLF from tmp */
- tmp[strlen(tmp) - 2] = '\0';
- tempstring = emalloc(strlen(tmp) + 1);
- strcpy(tempstring, tmp);
- do {
- tempstring = erealloc(tempstring, strlen(tempstring) + strlen(custom_headers_param->value) + strlen(CRLF) + 1);
- sprintf(tempstring, "%s%s%s", tempstring, custom_headers_param->value, CRLF);
- } while ((custom_headers_param = custom_headers_param->next));
-
- mystring = emalloc(strlen(tempstring) + strlen(CRLF) + 1);
- sprintf(mystring, "%s%s", tempstring, CRLF);
- efree(tempstring);
- } else {
- mystring = emalloc(strlen(tmp) + 1);
- strcpy(mystring, tmp);
- }
-
- bod = topbod;
-
- if (bod && bod->type == TYPEMULTIPART) {
-
- /* first body part */
- part = bod->nested.part;
-
- /* find cookie */
- for (param = bod->parameter; param && !cookie; param = param->next) {
- if (!strcmp (param->attribute, "BOUNDARY")) {
- cookie = param->value;
- }
- }
-
- /* yucky default */
- if (!cookie) {
- cookie = "-";
- }
-
- /* for each part */
- do {
- /* build cookie */
- sprintf (t=tmp, "--%s%s", cookie, CRLF);
-
- /* append mini-header */
- rfc822_write_body_header(&t, &part->body);
-
- /* write terminating blank line */
- strcat (t, CRLF);
-
- /* output cookie, mini-header, and contents */
- tempstring=emalloc(strlen(mystring)+strlen(tmp)+1);
- strcpy(tempstring, mystring);
- efree(mystring);
- mystring=tempstring;
- strcat(mystring, tmp);
-
- bod=&part->body;
-
- tempstring=emalloc(strlen(bod->contents.text.data)+strlen(CRLF)+strlen(mystring)+1);
- strcpy(tempstring, mystring);
- efree(mystring);
- mystring=tempstring;
- sprintf(mystring, "%s%s%s", mystring, bod->contents.text.data, CRLF);
-
- } while ((part = part->next)); /* until done */
-
- /* output trailing cookie */
- sprintf(tmp, "--%s--", cookie);
- tempstring=emalloc(strlen(tmp)+strlen(CRLF)+strlen(mystring)+1);
- strcpy(tempstring, mystring);
- efree(mystring);
- mystring=tempstring;
- sprintf(mystring, "%s%s%s", mystring, tmp, CRLF);
-
- } else if (bod) {
-
- tempstring=emalloc(strlen(bod->contents.text.data)+strlen(CRLF)+strlen(mystring)+1);
- strcpy(tempstring, mystring);
- efree(mystring);
- mystring=tempstring;
- sprintf(mystring, "%s%s%s", mystring, bod->contents.text.data, CRLF);
-
- } else {
- efree(mystring);
- RETURN_FALSE;
- }
-
- RETVAL_STRINGL(mystring, strlen(mystring), 1);
- efree(tempstring);
-}
-/* }}} */
-
-
-/* {{{ _php_imap_mail
- */
-int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *cc, char *bcc, char* rpath TSRMLS_DC)
-{
-#ifdef PHP_WIN32
- int tsm_err;
-#else
- FILE *sendmail;
- int ret;
-#endif
-
-#ifdef PHP_WIN32
- char *tempMailTo;
- char *tsm_errmsg = NULL;
- ADDRESS *addr;
- char *bufferTo = NULL, *bufferCc = NULL, *bufferBcc = NULL, *bufferHeader = NULL;
- int offset, bufferLen = 0;;
-
- if (headers) {
- bufferLen += strlen(headers);
- }
- if (to) {
- bufferLen += strlen(to) + 6;
- }
- if (cc) {
- bufferLen += strlen(cc) + 6;
- }
-
- bufferHeader = (char *)emalloc(bufferLen);
- memset(bufferHeader, 0, bufferLen);
- if (to && *to) {
- strcat(bufferHeader, "To: ");
- strcat(bufferHeader, to);
- strcat(bufferHeader, "\r\n");
- tempMailTo = estrdup(to);
- bufferTo = (char *)emalloc(strlen(to));
- offset = 0;
- addr = NULL;
- rfc822_parse_adrlist(&addr, tempMailTo, NULL);
- while (addr) {
- if (strcmp(addr->host, ERRHOST) == 0)
- return (BAD_MSG_DESTINATION);
- else {
- offset += sprintf(bufferTo + offset, "%s@%s,", addr->mailbox, addr->host);
- }
- addr = addr->next;
- }
- efree(tempMailTo);
- if (offset>0) {
- bufferTo[offset-1] = 0;
- }
- }
-
- if (cc && *cc) {
- strcat(bufferHeader, "Cc: ");
- strcat(bufferHeader, cc);
- strcat(bufferHeader, "\r\n");
- tempMailTo = estrdup(cc);
- bufferCc = (char *)emalloc(strlen(cc));
- offset = 0;
- addr = NULL;
- rfc822_parse_adrlist(&addr, tempMailTo, NULL);
- while (addr) {
- if (strcmp(addr->host, ERRHOST) == 0)
- return (BAD_MSG_DESTINATION);
- else {
- offset += sprintf(bufferCc + offset, "%s@%s,", addr->mailbox, addr->host);
- }
- addr = addr->next;
- }
- efree(tempMailTo);
- if (offset>0) {
- bufferCc[offset-1] = 0;
- }
- }
-
- if (bcc && *bcc) {
- tempMailTo = estrdup(bcc);
- bufferBcc = (char *)emalloc(strlen(bcc));
- offset = 0;
- addr = NULL;
- rfc822_parse_adrlist(&addr, tempMailTo, NULL);
- while (addr) {
- if (strcmp(addr->host, ERRHOST) == 0)
- return (BAD_MSG_DESTINATION);
- else {
- offset += sprintf(bufferBcc + offset, "%s@%s,", addr->mailbox, addr->host);
- }
- addr = addr->next;
- }
- efree(tempMailTo);
- if (offset>0) {
- bufferBcc[offset-1] = 0;
- }
- }
-
- if (headers && *headers) {
- strcat(bufferHeader, headers);
- }
-
- if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, bufferHeader, subject, bufferTo, message, bufferCc, bufferBcc, rpath) != SUCCESS) {
- if (tsm_errmsg) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", tsm_errmsg);
- efree(tsm_errmsg);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", GetSMErrorText(tsm_err));
- }
- return 0;
- }
- if (bufferTo) {
- efree(bufferTo);
- }
- if (bufferCc) {
- efree(bufferCc);
- }
- if (bufferBcc) {
- efree(bufferBcc);
- }
- if (bufferHeader) {
- efree(bufferHeader);
- }
-#else
- if (!INI_STR("sendmail_path")) {
- return 0;
- }
- sendmail = popen(INI_STR("sendmail_path"), "w");
- if (sendmail) {
- if (rpath && rpath[0]) fprintf(sendmail, "From: %s\n", rpath);
- fprintf(sendmail, "To: %s\n", to);
- if (cc && cc[0]) fprintf(sendmail, "Cc: %s\n", cc);
- if (bcc && bcc[0]) fprintf(sendmail, "Bcc: %s\n", bcc);
- fprintf(sendmail, "Subject: %s\n", subject);
- if (headers != NULL) {
- fprintf(sendmail, "%s\n", headers);
- }
- fprintf(sendmail, "\n%s\n", message);
- ret = pclose(sendmail);
- if (ret == -1) {
- return 0;
- } else {
- return 1;
- }
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute mail delivery program");
- return 0;
- }
-#endif
- return 1;
-}
-/* }}} */
-
-/* {{{ proto int imap_mail(string to, string subject, string message [, string additional_headers [, string cc [, string bcc [, string rpath]]]])
- Send an email message */
-PHP_FUNCTION(imap_mail)
-{
- zval **argv[7];
- char *to=NULL, *message=NULL, *headers=NULL, *subject=NULL, *cc=NULL, *bcc=NULL, *rpath=NULL;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 3 || argc > 7 || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- /* To: */
- convert_to_string_ex(argv[0]);
- if (Z_STRVAL_PP(argv[0])) {
- to = Z_STRVAL_PP(argv[0]);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No to field in mail command");
- RETURN_FALSE;
- }
-
- /* Subject: */
- convert_to_string_ex(argv[1]);
- if (Z_STRVAL_PP(argv[1])) {
- subject = Z_STRVAL_PP(argv[1]);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No subject field in mail command");
- RETURN_FALSE;
- }
-
- /* message body */
- convert_to_string_ex(argv[2]);
- if (Z_STRVAL_PP(argv[2])) {
- message = Z_STRVAL_PP(argv[2]);
- } else {
- /* this is not really an error, so it is allowed. */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No message string in mail command");
- message = NULL;
- }
-
- /* other headers */
- if (argc > 3) {
- convert_to_string_ex(argv[3]);
- headers = Z_STRVAL_PP(argv[3]);
- }
-
- /* cc */
- if (argc > 4) {
- convert_to_string_ex(argv[4]);
- cc = Z_STRVAL_PP(argv[4]);
- }
-
- /* bcc */
- if (argc > 5) {
- convert_to_string_ex(argv[5]);
- bcc = Z_STRVAL_PP(argv[5]);
- }
-
- /* rpath */
- if (argc > 6) {
- convert_to_string_ex(argv[6]);
- rpath = Z_STRVAL_PP(argv[6]);
- }
-
- if (_php_imap_mail(to, subject, message, headers, cc, bcc, rpath TSRMLS_CC)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array imap_search(resource stream_id, string criteria [, int options])
- Return a list of messages matching the given criteria */
-PHP_FUNCTION(imap_search)
-{
- zval **streamind, **criteria, **search_flags;
- pils *imap_le_struct;
- long flags;
- char *search_criteria;
- MESSAGELIST *cur;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &streamind, &criteria, &search_flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- convert_to_string_ex(criteria);
- search_criteria = estrndup(Z_STRVAL_PP(criteria), Z_STRLEN_PP(criteria));
-
- if (argc == 2) {
- flags = SE_FREE;
- } else {
- convert_to_long_ex(search_flags);
- flags = Z_LVAL_PP(search_flags);
- }
-
- IMAPG(imap_messages) = IMAPG(imap_messages_tail) = NIL;
- mail_search_full(imap_le_struct->imap_stream, NIL, mail_criteria(search_criteria), flags);
- if (IMAPG(imap_messages) == NIL) {
- efree(search_criteria);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- cur = IMAPG(imap_messages);
- while (cur != NIL) {
- add_next_index_long(return_value, cur->msgid);
- cur = cur->next;
- }
- mail_free_messagelist(&IMAPG(imap_messages), &IMAPG(imap_messages_tail));
- efree(search_criteria);
-}
-/* }}} */
-
-/* {{{ proto array imap_alerts(void)
- Returns an array of all IMAP alerts that have been generated since the last page load or since the last imap_alerts() call, whichever came last. The alert stack is cleared after imap_alerts() is called. */
-/* Author: CJH */
-PHP_FUNCTION(imap_alerts)
-{
- STRINGLIST *cur=NIL;
-
- if (ZEND_NUM_ARGS() > 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (IMAPG(imap_alertstack) == NIL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- cur = IMAPG(imap_alertstack);
- while (cur != NIL) {
- add_next_index_string(return_value, cur->LTEXT, 1);
- cur = cur->next;
- }
- mail_free_stringlist(&IMAPG(imap_alertstack));
- IMAPG(imap_alertstack) = NIL;
-}
-/* }}} */
-
-/* {{{ proto array imap_errors(void)
- Returns an array of all IMAP errors generated since the last page load, or since the last imap_errors() call, whichever came last. The error stack is cleared after imap_errors() is called. */
-/* Author: CJH */
-PHP_FUNCTION(imap_errors)
-{
- ERRORLIST *cur=NIL;
-
- if (ZEND_NUM_ARGS() > 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (IMAPG(imap_errorstack) == NIL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- cur = IMAPG(imap_errorstack);
- while (cur != NIL) {
- add_next_index_string(return_value, cur->LTEXT, 1);
- cur = cur->next;
- }
- mail_free_errorlist(&IMAPG(imap_errorstack));
- IMAPG(imap_errorstack) = NIL;
-}
-/* }}} */
-
-/* {{{ proto string imap_last_error(void)
- Returns the last error that was generated by an IMAP function. The error stack is NOT cleared after this call. */
-/* Author: CJH */
-PHP_FUNCTION(imap_last_error)
-{
- ERRORLIST *cur=NIL;
-
- if (ZEND_NUM_ARGS() > 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (IMAPG(imap_errorstack) == NIL) {
- RETURN_FALSE;
- }
-
- cur = IMAPG(imap_errorstack);
- while (cur != NIL) {
- if (cur->next == NIL) {
- RETURN_STRING(cur->LTEXT, 1);
- }
- cur = cur->next;
- }
-}
-/* }}} */
-
-/* {{{ proto array imap_mime_header_decode(string str)
- Decode mime header element in accordance with RFC 2047 and return array of objects containing 'charset' encoding and decoded 'text' */
-PHP_FUNCTION(imap_mime_header_decode)
-{
- /* Author: Ted Parnefors <ted@mtv.se> */
- zval **str, *myobject;
- char *string, *charset, encoding, *text, *decode;
- long charset_token, encoding_token, end_token, end, offset=0, i;
- unsigned long newlength;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(str);
-
- array_init(return_value);
-
- string = Z_STRVAL_PP(str);
- end = Z_STRLEN_PP(str);
-
- charset = (char *) emalloc((end + 1) * 2);
- text = &charset[end + 1];
- while (offset < end) { /* Reached end of the string? */
- if ((charset_token = (long)php_memnstr(&string[offset], "=?", 2, string + end))) { /* Is there anything encoded in the string? */
- charset_token -= (long)string;
- if (offset != charset_token) { /* Is there anything before the encoded data? */
- /* Retrieve unencoded data that is found before encoded data */
- memcpy(text, &string[offset], charset_token-offset);
- text[charset_token - offset] = 0x00;
- MAKE_STD_ZVAL(myobject);
- object_init(myobject);
- add_property_string(myobject, "charset", "default", 1);
- add_property_string(myobject, "text", text, 1);
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), (void *)&myobject, sizeof(zval *), NULL);
- }
- if ((encoding_token = (long)php_memnstr(&string[charset_token+2], "?", 1, string+end))) { /* Find token for encoding */
- encoding_token -= (long)string;
- if ((end_token = (long)php_memnstr(&string[encoding_token+3], "?=", 2, string+end))) { /* Find token for end of encoded data */
- end_token -= (long)string;
- memcpy(charset, &string[charset_token + 2], encoding_token - (charset_token + 2)); /* Extract charset encoding */
- charset[encoding_token-(charset_token + 2)] = 0x00;
- encoding=string[encoding_token + 1]; /* Extract encoding from string */
- memcpy(text, &string[encoding_token + 3], end_token - (encoding_token + 3)); /* Extract text */
- text[end_token - (encoding_token + 3)] = 0x00;
- decode = text;
- if (encoding == 'q' || encoding == 'Q') { /* Decode 'q' encoded data */
- for(i=0; text[i] != 0x00; i++) if (text[i] == '_') text[i] = ' '; /* Replace all *_' with space. */
- decode = (char *)rfc822_qprint((unsigned char *) text, strlen(text), &newlength);
- } else if (encoding == 'b' || encoding == 'B') {
- decode = (char *)rfc822_base64((unsigned char *) text, strlen(text), &newlength); /* Decode 'B' encoded data */
- }
- if (decode == NULL) {
- efree(charset);
- zval_dtor(return_value);
- RETURN_FALSE;
- }
- MAKE_STD_ZVAL(myobject);
- object_init(myobject);
- add_property_string(myobject, "charset", charset, 1);
- add_property_string(myobject, "text", decode, 1);
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), (void *)&myobject, sizeof(zval *), NULL);
- fs_give((void**)&decode);
-
- offset = end_token+2;
- for (i = 0; (string[offset + i] == ' ') || (string[offset + i] == 0x0a) || (string[offset + i] == 0x0d); i++);
- if ((string[offset + i] == '=') && (string[offset + i + 1] == '?') && (offset + i < end)) {
- offset += i;
- }
- continue; /*/ Iterate the loop again please. */
- }
- }
- } else {
- /* Just some tweaking to optimize the code, and get the end statements work in a general manner.
- * If we end up here we didn't find a position for "charset_token",
- * so we need to set it to the start of the yet unextracted data.
- */
- charset_token = offset;
- }
- /* Return the rest of the data as unencoded, as it was either unencoded or was missing separators
- which rendered the the remainder of the string impossible for us to decode. */
- memcpy(text, &string[charset_token], end - charset_token); /* Extract unencoded text from string */
- text[end - charset_token] = 0x00;
- MAKE_STD_ZVAL(myobject);
- object_init(myobject);
- add_property_string(myobject, "charset", "default", 1);
- add_property_string(myobject, "text", text, 1);
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), (void *)&myobject, sizeof(zval *), NULL);
-
- offset = end; /* We have reached the end of the string. */
- }
- efree(charset);
-}
-/* }}} */
-
-/* {{{ _php_rfc822_len
- * Calculate string length based on imap's rfc822_cat function.
- */
-static int _php_rfc822_len(char *str)
-{
- int len;
- char *p;
-
- if (!str || !*str) {
- return 0;
- }
-
- /* strings with special characters will need to be quoted, as a safety measure we
- * add 2 bytes for the quotes just in case.
- */
- len = strlen(str) + 2;
- p = str;
- /* rfc822_cat() will escape all " and \ characters, therefor we need to increase
- * our buffer length to account for these characters.
- */
- while ((p = strpbrk(p, "\\\""))) {
- p++;
- len++;
- }
-
- return len;
-}
-/* }}} */
-
-/* Support Functions */
-/* {{{ _php_imap_get_address_size
- */
-static int _php_imap_address_size (ADDRESS *addresslist)
-{
- ADDRESS *tmp;
- int ret=0, num_ent=0;
-
- tmp = addresslist;
-
- if (tmp) do {
- ret += _php_rfc822_len(tmp->personal);
- ret += _php_rfc822_len(tmp->adl);
- ret += _php_rfc822_len(tmp->mailbox);
- ret += _php_rfc822_len(tmp->host);
- num_ent++;
- } while ((tmp = tmp->next));
-
- /*
- * rfc822_write_address_full() needs some extra space for '<>,', etc.
- * for this perpouse we allocate additional PHP_IMAP_ADDRESS_SIZE_BUF bytes
- * by default this buffer is 10 bytes long
- */
- ret += (ret) ? num_ent*PHP_IMAP_ADDRESS_SIZE_BUF : 0;
-
- return ret;
-}
-
-/* }}} */
-
-
-/* {{{ _php_imap_parse_address
- */
-static void _php_imap_parse_address (ADDRESS *addresslist, char **fulladdress, zval *paddress TSRMLS_DC)
-{
- ADDRESS *addresstmp;
- zval *tmpvals;
- char *tmpstr;
- int len=0;
-
- addresstmp = addresslist;
-
- if ((len = _php_imap_address_size(addresstmp))) {
- tmpstr = (char *) malloc (len);
- tmpstr[0] = '\0';
- rfc822_write_address(tmpstr, addresstmp);
- *fulladdress = tmpstr;
- } else {
- *fulladdress = NULL;
- }
-
- addresstmp = addresslist;
- do {
- MAKE_STD_ZVAL(tmpvals);
- object_init(tmpvals);
- if (addresstmp->personal) add_property_string(tmpvals, "personal", addresstmp->personal, 1);
- if (addresstmp->adl) add_property_string(tmpvals, "adl", addresstmp->adl, 1);
- if (addresstmp->mailbox) add_property_string(tmpvals, "mailbox", addresstmp->mailbox, 1);
- if (addresstmp->host) add_property_string(tmpvals, "host", addresstmp->host, 1);
- add_next_index_object(paddress, tmpvals TSRMLS_CC);
- } while ((addresstmp = addresstmp->next));
-}
-/* }}} */
-
-/* {{{ _php_make_header_object
- */
-static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC)
-{
- zval *paddress;
- char *fulladdress=NULL;
-
- object_init(myzvalue);
-
- if (en->remail) add_property_string(myzvalue, "remail", en->remail, 1);
- if (en->date) add_property_string(myzvalue, "date", en->date, 1);
- if (en->date) add_property_string(myzvalue, "Date", en->date, 1);
- if (en->subject) add_property_string(myzvalue, "subject", en->subject, 1);
- if (en->subject) add_property_string(myzvalue, "Subject", en->subject, 1);
- if (en->in_reply_to) add_property_string(myzvalue, "in_reply_to", en->in_reply_to, 1);
- if (en->message_id) add_property_string(myzvalue, "message_id", en->message_id, 1);
- if (en->newsgroups) add_property_string(myzvalue, "newsgroups", en->newsgroups, 1);
- if (en->followup_to) add_property_string(myzvalue, "followup_to", en->followup_to, 1);
- if (en->references) add_property_string(myzvalue, "references", en->references, 1);
-
- if (en->to) {
- MAKE_STD_ZVAL(paddress);
- array_init(paddress);
- _php_imap_parse_address(en->to, &fulladdress, paddress TSRMLS_CC);
- if (fulladdress) {
- add_property_string(myzvalue, "toaddress", fulladdress, 1);
- free(fulladdress);
- }
- add_assoc_object(myzvalue, "to", paddress TSRMLS_CC);
- }
-
- if (en->from) {
- MAKE_STD_ZVAL(paddress);
- array_init(paddress);
- _php_imap_parse_address(en->from, &fulladdress, paddress TSRMLS_CC);
- if (fulladdress) {
- add_property_string(myzvalue, "fromaddress", fulladdress, 1);
- free(fulladdress);
- }
- add_assoc_object(myzvalue, "from", paddress TSRMLS_CC);
- }
-
- if (en->cc) {
- MAKE_STD_ZVAL(paddress);
- array_init(paddress);
- _php_imap_parse_address(en->cc, &fulladdress, paddress TSRMLS_CC);
- if (fulladdress) {
- add_property_string(myzvalue, "ccaddress", fulladdress, 1);
- free(fulladdress);
- }
- add_assoc_object(myzvalue, "cc", paddress TSRMLS_CC);
- }
-
- if (en->bcc) {
- MAKE_STD_ZVAL(paddress);
- array_init(paddress);
- _php_imap_parse_address(en->bcc, &fulladdress, paddress TSRMLS_CC);
- if (fulladdress) {
- add_property_string(myzvalue, "bccaddress", fulladdress, 1);
- free(fulladdress);
- }
- add_assoc_object(myzvalue, "bcc", paddress TSRMLS_CC);
- }
-
- if (en->reply_to) {
- MAKE_STD_ZVAL(paddress);
- array_init(paddress);
- _php_imap_parse_address(en->reply_to, &fulladdress, paddress TSRMLS_CC);
- if (fulladdress) {
- add_property_string(myzvalue, "reply_toaddress", fulladdress, 1);
- free(fulladdress);
- }
- add_assoc_object(myzvalue, "reply_to", paddress TSRMLS_CC);
- }
-
- if (en->sender) {
- MAKE_STD_ZVAL(paddress);
- array_init(paddress);
- _php_imap_parse_address(en->sender, &fulladdress, paddress TSRMLS_CC);
- if (fulladdress) {
- add_property_string(myzvalue, "senderaddress", fulladdress, 1);
- free(fulladdress);
- }
- add_assoc_object(myzvalue, "sender", paddress TSRMLS_CC);
- }
-
- if (en->return_path) {
- MAKE_STD_ZVAL(paddress);
- array_init(paddress);
- _php_imap_parse_address(en->return_path, &fulladdress, paddress TSRMLS_CC);
- if (fulladdress) {
- add_property_string(myzvalue, "return_pathaddress", fulladdress, 1);
- free(fulladdress);
- }
- add_assoc_object(myzvalue, "return_path", paddress TSRMLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ _php_imap_add_body
- */
-void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC)
-{
- zval *parametres, *param, *dparametres, *dparam;
- PARAMETER *par, *dpar;
- PART *part;
-
- if (body->type <= TYPEMAX) {
- add_property_long(arg, "type", body->type);
- }
-
- if (body->encoding <= ENCMAX) {
- add_property_long(arg, "encoding", body->encoding);
- }
-
- if (body->subtype) {
- add_property_long(arg, "ifsubtype", 1);
- add_property_string(arg, "subtype", body->subtype, 1);
- } else {
- add_property_long(arg, "ifsubtype", 0);
- }
-
- if (body->description) {
- add_property_long(arg, "ifdescription", 1);
- add_property_string(arg, "description", body->description, 1);
- } else {
- add_property_long(arg, "ifdescription", 0);
- }
-
- if (body->id) {
- add_property_long(arg, "ifid", 1);
- add_property_string(arg, "id", body->id, 1);
- } else {
- add_property_long(arg, "ifid", 0);
- }
-
- if (body->size.lines) {
- add_property_long(arg, "lines", body->size.lines);
- }
-
- if (body->size.bytes) {
- add_property_long(arg, "bytes", body->size.bytes);
- }
-
-#ifdef IMAP41
- if (body->disposition.type) {
- add_property_long(arg, "ifdisposition", 1);
- add_property_string(arg, "disposition", body->disposition.type, 1);
- } else {
- add_property_long(arg, "ifdisposition", 0);
- }
-
- if (body->disposition.parameter) {
- dpar = body->disposition.parameter;
- add_property_long(arg, "ifdparameters", 1);
- MAKE_STD_ZVAL(dparametres);
- array_init(dparametres);
- do {
- MAKE_STD_ZVAL(dparam);
- object_init(dparam);
- add_property_string(dparam, "attribute", dpar->attribute, 1);
- add_property_string(dparam, "value", dpar->value, 1);
- add_next_index_object(dparametres, dparam TSRMLS_CC);
- } while ((dpar = dpar->next));
- add_assoc_object(arg, "dparameters", dparametres TSRMLS_CC);
- } else {
- add_property_long(arg, "ifdparameters", 0);
- }
-#endif
-
- if ((par = body->parameter)) {
- add_property_long(arg, "ifparameters", 1);
-
- MAKE_STD_ZVAL(parametres);
- array_init(parametres);
- do {
- MAKE_STD_ZVAL(param);
- object_init(param);
- if (par->attribute) {
- add_property_string(param, "attribute", par->attribute, 1);
- }
- if (par->value) {
- add_property_string(param, "value", par->value, 1);
- }
-
- add_next_index_object(parametres, param TSRMLS_CC);
- } while ((par = par->next));
- } else {
- MAKE_STD_ZVAL(parametres);
- object_init(parametres);
- add_property_long(arg, "ifparameters", 0);
- }
- add_assoc_object(arg, "parameters", parametres TSRMLS_CC);
-
- /* multipart message ? */
- if (body->type == TYPEMULTIPART) {
- MAKE_STD_ZVAL(parametres);
- array_init(parametres);
- for (part = body->CONTENT_PART; part; part = part->next) {
- MAKE_STD_ZVAL(param);
- object_init(param);
- _php_imap_add_body(param, &part->body TSRMLS_CC);
- add_next_index_object(parametres, param TSRMLS_CC);
- }
- add_assoc_object(arg, "parts", parametres TSRMLS_CC);
- }
-
- /* encapsulated message ? */
- if ((body->type == TYPEMESSAGE) && (!strcasecmp(body->subtype, "rfc822"))) {
- body = body->CONTENT_MSG_BODY;
- MAKE_STD_ZVAL(parametres);
- array_init(parametres);
- MAKE_STD_ZVAL(param);
- object_init(param);
- _php_imap_add_body(param, body TSRMLS_CC);
- add_next_index_object(parametres, param TSRMLS_CC);
- add_assoc_object(arg, "parts", parametres TSRMLS_CC);
- }
-}
-/* }}} */
-
-
-/* imap_thread, stealing this from header cclient -rjs3 */
-/* {{{ build_thread_tree_helper
- */
-static void build_thread_tree_helper(THREADNODE *cur, zval *tree, long *numNodes, char *buf)
-{
- unsigned long thisNode = *numNodes;
-
- /* define "#.num" */
- snprintf(buf, 25, "%ld.num", thisNode);
-
- add_assoc_long(tree, buf, cur->num);
-
- snprintf(buf, 25, "%ld.next", thisNode);
- if(cur->next) {
- (*numNodes)++;
- add_assoc_long(tree, buf, *numNodes);
- build_thread_tree_helper(cur->next, tree, numNodes, buf);
- } else { /* "null pointer" */
- add_assoc_long(tree, buf, 0);
- }
-
- snprintf(buf, 25, "%ld.branch", thisNode);
- if(cur->branch) {
- (*numNodes)++;
- add_assoc_long(tree, buf, *numNodes);
- build_thread_tree_helper(cur->branch, tree, numNodes, buf);
- } else { /* "null pointer" */
- add_assoc_long(tree, buf, 0);
- }
-}
-/* }}} */
-
-/* {{{ build_thread_tree
- */
-static int build_thread_tree(THREADNODE *top, zval **tree)
-{
- long numNodes = 0;
- char buf[25];
-
- array_init(*tree);
-
- build_thread_tree_helper(top, *tree, &numNodes, buf);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto array imap_thread(resource stream_id [, int options])
- Return threaded by REFERENCES tree */
-PHP_FUNCTION (imap_thread)
-{
- zval **streamind, **search_flags;
- pils *imap_le_struct;
- long flags;
- char criteria[] = "ALL";
- THREADNODE *top;
- int argc = ZEND_NUM_ARGS();
-
- if ( argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &streamind, &search_flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
-
- if (argc == 1) {
- flags = SE_FREE;
- } else {
- convert_to_long_ex(search_flags);
- flags = Z_LVAL_PP(search_flags);
- }
-
- top = mail_thread(imap_le_struct->imap_stream, "REFERENCES", NIL, mail_criteria(criteria), flags);
-
- if(top == NIL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function returned an empty tree");
- RETURN_FALSE;
- }
-
- /* Populate our return value data structure here. */
- if(build_thread_tree(top, &return_value) == FAILURE) {
- mail_free_threadnode(&top);
- RETURN_FALSE;
- }
- mail_free_threadnode(&top);
-}
-/* }}} */
-
-
-/* {{{ Interfaces to C-client
- */
-void mm_searched(MAILSTREAM *stream, unsigned long number)
-{
- MESSAGELIST *cur = NIL;
- TSRMLS_FETCH();
-
- if (IMAPG(imap_messages) == NIL) {
- IMAPG(imap_messages) = mail_newmessagelist();
- IMAPG(imap_messages)->msgid = number;
- IMAPG(imap_messages)->next = NIL;
- IMAPG(imap_messages_tail) = IMAPG(imap_messages);
- } else {
- cur = IMAPG(imap_messages_tail);
- cur->next = mail_newmessagelist();
- cur = cur->next;
- cur->msgid = number;
- cur->next = NIL;
- IMAPG(imap_messages_tail) = cur;
- }
-}
-
-void mm_exists(MAILSTREAM *stream, unsigned long number)
-{
-}
-
-void mm_expunged(MAILSTREAM *stream, unsigned long number)
-{
-}
-
-void mm_flags(MAILSTREAM *stream, unsigned long number)
-{
-}
-
-/* Author: CJH */
-void mm_notify(MAILSTREAM *stream, char *str, long errflg)
-{
- STRINGLIST *cur = NIL;
- TSRMLS_FETCH();
-
- if (strncmp(str, "[ALERT] ", 8) == 0) {
- if (IMAPG(imap_alertstack) == NIL) {
- IMAPG(imap_alertstack) = mail_newstringlist();
- IMAPG(imap_alertstack)->LSIZE = strlen(IMAPG(imap_alertstack)->LTEXT = cpystr(str));
- IMAPG(imap_alertstack)->next = NIL;
- } else {
- cur = IMAPG(imap_alertstack);
- while (cur->next != NIL) {
- cur = cur->next;
- }
- cur->next = mail_newstringlist ();
- cur = cur->next;
- cur->LSIZE = strlen(cur->LTEXT = cpystr(str));
- cur->next = NIL;
- }
- }
-}
-
-void mm_list(MAILSTREAM *stream, DTYPE delimiter, char *mailbox, long attributes)
-{
- STRINGLIST *cur=NIL;
- FOBJECTLIST *ocur=NIL;
- TSRMLS_FETCH();
-
- if (IMAPG(folderlist_style) == FLIST_OBJECT) {
- /* build up a the new array of objects */
- /* Author: CJH */
- if (IMAPG(imap_folder_objects) == NIL) {
- IMAPG(imap_folder_objects) = mail_newfolderobjectlist();
- IMAPG(imap_folder_objects)->LSIZE=strlen(IMAPG(imap_folder_objects)->LTEXT=cpystr(mailbox));
- IMAPG(imap_folder_objects)->delimiter = delimiter;
- IMAPG(imap_folder_objects)->attributes = attributes;
- IMAPG(imap_folder_objects)->next = NIL;
- IMAPG(imap_folder_objects_tail) = IMAPG(imap_folder_objects);
- } else {
- ocur=IMAPG(imap_folder_objects_tail);
- ocur->next=mail_newfolderobjectlist();
- ocur=ocur->next;
- ocur->LSIZE = strlen(ocur->LTEXT = cpystr(mailbox));
- ocur->delimiter = delimiter;
- ocur->attributes = attributes;
- ocur->next = NIL;
- IMAPG(imap_folder_objects_tail) = ocur;
- }
-
- } else {
- /* build the old IMAPG(imap_folders) variable to allow old imap_listmailbox() to work */
- if (!(attributes & LATT_NOSELECT)) {
- if (IMAPG(imap_folders) == NIL) {
- IMAPG(imap_folders)=mail_newstringlist();
- IMAPG(imap_folders)->LSIZE=strlen(IMAPG(imap_folders)->LTEXT=cpystr(mailbox));
- IMAPG(imap_folders)->next=NIL;
- IMAPG(imap_folders_tail) = IMAPG(imap_folders);
- } else {
- cur=IMAPG(imap_folders_tail);
- cur->next=mail_newstringlist ();
- cur=cur->next;
- cur->LSIZE = strlen (cur->LTEXT = cpystr (mailbox));
- cur->next = NIL;
- IMAPG(imap_folders_tail) = cur;
- }
- }
- }
-}
-
-void mm_lsub(MAILSTREAM *stream, DTYPE delimiter, char *mailbox, long attributes)
-{
- STRINGLIST *cur=NIL;
- FOBJECTLIST *ocur=NIL;
- TSRMLS_FETCH();
-
- if (IMAPG(folderlist_style) == FLIST_OBJECT) {
- /* build the array of objects */
- /* Author: CJH */
- if (IMAPG(imap_sfolder_objects) == NIL) {
- IMAPG(imap_sfolder_objects) = mail_newfolderobjectlist();
- IMAPG(imap_sfolder_objects)->LSIZE=strlen(IMAPG(imap_sfolder_objects)->LTEXT=cpystr(mailbox));
- IMAPG(imap_sfolder_objects)->delimiter = delimiter;
- IMAPG(imap_sfolder_objects)->attributes = attributes;
- IMAPG(imap_sfolder_objects)->next = NIL;
- IMAPG(imap_sfolder_objects_tail) = IMAPG(imap_sfolder_objects);
- } else {
- ocur=IMAPG(imap_sfolder_objects_tail);
- ocur->next=mail_newfolderobjectlist();
- ocur=ocur->next;
- ocur->LSIZE=strlen(ocur->LTEXT = cpystr(mailbox));
- ocur->delimiter = delimiter;
- ocur->attributes = attributes;
- ocur->next = NIL;
- IMAPG(imap_sfolder_objects_tail) = ocur;
- }
- } else {
- /* build the old simple array for imap_listsubscribed() */
- if (IMAPG(imap_sfolders) == NIL) {
- IMAPG(imap_sfolders)=mail_newstringlist();
- IMAPG(imap_sfolders)->LSIZE=strlen(IMAPG(imap_sfolders)->LTEXT=cpystr(mailbox));
- IMAPG(imap_sfolders)->next=NIL;
- IMAPG(imap_sfolders_tail) = IMAPG(imap_sfolders);
- } else {
- cur=IMAPG(imap_sfolders_tail);
- cur->next=mail_newstringlist ();
- cur=cur->next;
- cur->LSIZE = strlen (cur->LTEXT = cpystr (mailbox));
- cur->next = NIL;
- IMAPG(imap_sfolders_tail) = cur;
- }
- }
-}
-
-void mm_status(MAILSTREAM *stream, char *mailbox, MAILSTATUS *status)
-{
- TSRMLS_FETCH();
-
- IMAPG(status_flags)=status->flags;
- if (IMAPG(status_flags) & SA_MESSAGES) {
- IMAPG(status_messages)=status->messages;
- }
- if (IMAPG(status_flags) & SA_RECENT) {
- IMAPG(status_recent)=status->recent;
- }
- if (IMAPG(status_flags) & SA_UNSEEN) {
- IMAPG(status_unseen)=status->unseen;
- }
- if (IMAPG(status_flags) & SA_UIDNEXT) {
- IMAPG(status_uidnext)=status->uidnext;
- }
- if (IMAPG(status_flags) & SA_UIDVALIDITY) {
- IMAPG(status_uidvalidity)=status->uidvalidity;
- }
-}
-
-void mm_log(char *str, long errflg)
-{
- ERRORLIST *cur = NIL;
- TSRMLS_FETCH();
-
- /* Author: CJH */
- if (errflg != NIL) { /* CJH: maybe put these into a more comprehensive log for debugging purposes? */
- if (IMAPG(imap_errorstack) == NIL) {
- IMAPG(imap_errorstack) = mail_newerrorlist();
- IMAPG(imap_errorstack)->LSIZE = strlen(IMAPG(imap_errorstack)->LTEXT = cpystr(str));
- IMAPG(imap_errorstack)->errflg = errflg;
- IMAPG(imap_errorstack)->next = NIL;
- } else {
- cur = IMAPG(imap_errorstack);
- while (cur->next != NIL) {
- cur = cur->next;
- }
- cur->next = mail_newerrorlist();
- cur = cur->next;
- cur->LSIZE = strlen(cur->LTEXT = cpystr(str));
- cur->errflg = errflg;
- cur->next = NIL;
- }
- }
-}
-
-void mm_dlog(char *str)
-{
- /* CJH: this is for debugging; it might be useful to allow setting
- the stream to debug mode and capturing this somewhere - syslog?
- php debugger? */
-}
-
-void mm_login(NETMBX *mb, char *user, char *pwd, long trial)
-{
- TSRMLS_FETCH();
-
- if (*mb->user) {
- strlcpy (user, mb->user, MAILTMPLEN);
- } else {
- strlcpy (user, IMAPG(imap_user), MAILTMPLEN);
- }
- strlcpy (pwd, IMAPG(imap_password), MAILTMPLEN);
-}
-
-void mm_critical(MAILSTREAM *stream)
-{
-}
-
-void mm_nocritical(MAILSTREAM *stream)
-{
-}
-
-long mm_diskerror(MAILSTREAM *stream, long errcode, long serious)
-{
- return 1;
-}
-
-void mm_fatal(char *str)
-{
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/imap/php_imap.h b/ext/imap/php_imap.h
deleted file mode 100644
index abfb87c4b8..0000000000
--- a/ext/imap/php_imap.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rex Logan <veebert@dimensional.com> |
- | Mark Musone <musone@afterfive.com> |
- | Brian Wang <brian@vividnet.com> |
- | Kaj-Michael Lang <milang@tal.org> |
- | Antoni Pamies Olive <toni@readysoft.net> |
- | Rasmus Lerdorf <rasmus@php.net> |
- | Chuck Hagenbuch <chuck@horde.org> |
- | Andrew Skalski <askalski@chekinc.com> |
- | Hartmut Holzgraefe <hholzgra@php.net> |
- | Jani Taskinen <sniper@iki.fi> |
- | Daniel R. Kalowsky <kalowsky@php.net> |
- | PHP 4.0 updates: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_IMAP_H
-#define PHP_IMAP_H
-
-#if HAVE_IMAP
-
-#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
- /* these are used for quota support */
-# include "c-client.h" /* includes mail.h and rfc822.h */
-# include "imap4r1.h" /* location of c-client quota functions */
-#else
-# include "mail.h"
-# include "rfc822.h"
-#endif
-
-extern zend_module_entry imap_module_entry;
-#define imap_module_ptr &imap_module_entry
-
-
-/* Data types */
-
-#ifdef IMAP41
-#define LSIZE text.size
-#define LTEXT text.data
-#define DTYPE int
-#define CONTENT_PART nested.part
-#define CONTENT_MSG_BODY nested.msg->body
-#define IMAPVER "Imap 4R1"
-#else
-#define LSIZE size
-#define LTEXT text
-#define DTYPE char
-#define CONTENT_PART contents.part
-#define CONTENT_MSG_BODY contents.msg.body
-#define IMAPVER "Imap 4"
-#endif
-
-
-/* Determines how mm_list() and mm_lsub() are to return their results. */
-typedef enum {
- FLIST_ARRAY,
- FLIST_OBJECT
-} folderlist_style_t;
-
-typedef struct php_imap_le_struct {
- MAILSTREAM *imap_stream;
- long flags;
-} pils;
-
-typedef struct php_imap_mailbox_struct {
- SIZEDTEXT text;
- DTYPE delimiter;
- long attributes;
- struct php_imap_mailbox_struct *next;
-} FOBJECTLIST;
-
-typedef struct php_imap_error_struct {
- SIZEDTEXT text;
- long errflg;
- struct php_imap_error_struct *next;
-} ERRORLIST;
-
-typedef struct _php_imap_message_struct {
- unsigned long msgid;
- struct _php_imap_message_struct *next;
-} MESSAGELIST;
-
-
-/* Functions */
-
-PHP_MINIT_FUNCTION(imap);
-PHP_RINIT_FUNCTION(imap);
-PHP_RSHUTDOWN_FUNCTION(imap);
-PHP_MINFO_FUNCTION(imap);
-
-PHP_FUNCTION(imap_open);
-PHP_FUNCTION(imap_popen);
-PHP_FUNCTION(imap_reopen);
-PHP_FUNCTION(imap_num_msg);
-PHP_FUNCTION(imap_num_recent);
-PHP_FUNCTION(imap_headers);
-PHP_FUNCTION(imap_headerinfo);
-PHP_FUNCTION(imap_rfc822_parse_headers);
-PHP_FUNCTION(imap_body);
-PHP_FUNCTION(imap_fetchstructure);
-PHP_FUNCTION(imap_fetchbody);
-PHP_FUNCTION(imap_expunge);
-PHP_FUNCTION(imap_delete);
-PHP_FUNCTION(imap_undelete);
-PHP_FUNCTION(imap_check);
-PHP_FUNCTION(imap_close);
-PHP_FUNCTION(imap_mail_copy);
-PHP_FUNCTION(imap_mail_move);
-PHP_FUNCTION(imap_createmailbox);
-PHP_FUNCTION(imap_renamemailbox);
-PHP_FUNCTION(imap_deletemailbox);
-PHP_FUNCTION(imap_listmailbox);
-PHP_FUNCTION(imap_scanmailbox);
-PHP_FUNCTION(imap_subscribe);
-PHP_FUNCTION(imap_unsubscribe);
-PHP_FUNCTION(imap_append);
-PHP_FUNCTION(imap_ping);
-PHP_FUNCTION(imap_base64);
-PHP_FUNCTION(imap_qprint);
-PHP_FUNCTION(imap_8bit);
-PHP_FUNCTION(imap_binary);
-PHP_FUNCTION(imap_mailboxmsginfo);
-PHP_FUNCTION(imap_rfc822_write_address);
-PHP_FUNCTION(imap_rfc822_parse_adrlist);
-PHP_FUNCTION(imap_setflag_full);
-PHP_FUNCTION(imap_clearflag_full);
-PHP_FUNCTION(imap_sort);
-PHP_FUNCTION(imap_fetchheader);
-PHP_FUNCTION(imap_fetchtext);
-PHP_FUNCTION(imap_uid);
-PHP_FUNCTION(imap_msgno);
-PHP_FUNCTION(imap_list);
-PHP_FUNCTION(imap_list_full);
-PHP_FUNCTION(imap_listscan);
-PHP_FUNCTION(imap_lsub);
-PHP_FUNCTION(imap_lsub_full);
-PHP_FUNCTION(imap_create);
-PHP_FUNCTION(imap_rename);
-PHP_FUNCTION(imap_status);
-PHP_FUNCTION(imap_bodystruct);
-PHP_FUNCTION(imap_fetch_overview);
-PHP_FUNCTION(imap_mail_compose);
-PHP_FUNCTION(imap_alerts);
-PHP_FUNCTION(imap_errors);
-PHP_FUNCTION(imap_last_error);
-PHP_FUNCTION(imap_mail);
-PHP_FUNCTION(imap_search);
-PHP_FUNCTION(imap_utf8);
-PHP_FUNCTION(imap_utf7_decode);
-PHP_FUNCTION(imap_utf7_encode);
-PHP_FUNCTION(imap_mime_header_decode);
-PHP_FUNCTION(imap_thread);
-
-#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
-PHP_FUNCTION(imap_get_quota);
-PHP_FUNCTION(imap_get_quotaroot);
-PHP_FUNCTION(imap_set_quota);
-PHP_FUNCTION(imap_setacl);
-#endif
-
-
-ZEND_BEGIN_MODULE_GLOBALS(imap)
- char *imap_user;
- char *imap_password;
-
- STRINGLIST *imap_alertstack;
- ERRORLIST *imap_errorstack;
-
- STRINGLIST *imap_folders;
- STRINGLIST *imap_folders_tail;
- STRINGLIST *imap_sfolders;
- STRINGLIST *imap_sfolders_tail;
- MESSAGELIST *imap_messages;
- MESSAGELIST *imap_messages_tail;
- FOBJECTLIST *imap_folder_objects;
- FOBJECTLIST *imap_folder_objects_tail;
- FOBJECTLIST *imap_sfolder_objects;
- FOBJECTLIST *imap_sfolder_objects_tail;
-
- folderlist_style_t folderlist_style;
- long status_flags;
- unsigned long status_messages;
- unsigned long status_recent;
- unsigned long status_unseen;
- unsigned long status_uidnext;
- unsigned long status_uidvalidity;
-#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
- zval **quota_return;
-#endif
-ZEND_END_MODULE_GLOBALS(imap)
-
-#ifdef ZTS
-# define IMAPG(v) TSRMG(imap_globals_id, zend_imap_globals *, v)
-#else
-# define IMAPG(v) (imap_globals.v)
-#endif
-
-#else
-
-#define imap_module_ptr NULL
-
-#endif
-
-#define phpext_imap_ptr imap_module_ptr
-
-#endif /* PHP_IMAP_H */
diff --git a/ext/informix/CREDITS b/ext/informix/CREDITS
deleted file mode 100644
index b98418479b..0000000000
--- a/ext/informix/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Informix
-Danny Heijl, Christian Cartus, Corne' Cornelius
diff --git a/ext/informix/Makefile.frag b/ext/informix/Makefile.frag
deleted file mode 100644
index e95934fc3f..0000000000
--- a/ext/informix/Makefile.frag
+++ /dev/null
@@ -1,10 +0,0 @@
-
-$(srcdir)/ifx.c: $(srcdir)/ifx.ec $(builddir)/libphpifx.a
- (if test -d $(INFORMIXDIR); then \
- THREADLIB=POSIX $(INFORMIXDIR)/bin/esql -e $(IFX_ESQL_FLAGS) $(srcdir)/ifx.ec; mv ifx.c $@; \
- else \
- touch $@; \
- fi)
-
-$(builddir)/libphpifx.a:
- $(LIBTOOL) --mode=link $(CC) $(IFX_LIBOBJS) -o $@
diff --git a/ext/informix/config.m4 b/ext/informix/config.m4
deleted file mode 100644
index 1e892fd908..0000000000
--- a/ext/informix/config.m4
+++ /dev/null
@@ -1,96 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(informix,for Informix support,
-[ --with-informix[=DIR] Include Informix support. DIR is the Informix base
- install directory, defaults to ${INFORMIXDIR:-nothing}.])
-
-if test "$PHP_INFORMIX" != "no"; then
-
- if test "$INFORMIXDIR" = ""; then
- AC_MSG_ERROR([INFORMIXDIR environment variable is not set.])
- fi
-
- if test "$PHP_INFORMIX" = "yes"; then
- IFX_INCLUDE=-I$INFORMIXDIR/incl/esql
- PHP_ADD_LIBPATH($INFORMIXDIR/lib, INFORMIX_SHARED_LIBADD)
- PHP_ADD_LIBPATH($INFORMIXDIR/lib/esql, INFORMIX_SHARED_LIBADD)
- else
- if test "$PHP_INFORMIX" != "$INFORMIXDIR"; then
- AC_MSG_ERROR([Specified Informix base install directory is different than your INFORMIXDIR environment variable.])
- fi
- IFX_INCLUDE=-I$PHP_INFORMIX/incl/esql
- PHP_ADD_LIBPATH($PHP_INFORMIX/lib, INFORMIX_SHARED_LIBADD)
- PHP_ADD_LIBPATH($PHP_INFORMIX/lib/esql, INFORMIX_SHARED_LIBADD)
- fi
-
- dnl Check if thread safety flags are needed
- if test "$enable_experimental_zts" = "yes"; then
- IFX_ESQL_FLAGS="-thread"
- CPPFLAGS="$CPPFLAGS -DIFX_THREAD"
- else
- IFX_ESQL_FLAGS=""
- fi
-
- IFX_LIBS=`THREADLIB=POSIX $INFORMIXDIR/bin/esql $IFX_ESQL_FLAGS -libs`
- IFX_LIBS=`echo $IFX_LIBS | sed -e 's/Libraries to be used://g' -e 's/esql: error -55923: No source or object file\.//g'`
- dnl Seems to get rid of newlines.
- dnl According to Perls DBD-Informix, might contain these strings.
-
- case "$host_alias" in
- *aix*)
- CPPFLAGS="$CPPFLAGS -D__H_LOCALEDEF";;
- esac
-
- AC_MSG_CHECKING([Informix version])
- IFX_VERSION=[`$INFORMIXDIR/bin/esql -V | grep "ESQL Version" | sed -ne '1 s/\(.*\)ESQL Version \([0-9]*\)\.\([0-9]*\).*/\2\3/p'`]
- AC_MSG_RESULT($IFX_VERSION)
- AC_DEFINE_UNQUOTED(IFX_VERSION, $IFX_VERSION, [ ])
-
- if test $IFX_VERSION -ge "900"; then
- AC_DEFINE(HAVE_IFX_IUS,1,[ ])
- IFX_ESQL_FLAGS="$IFX_ESQL_FLAGS -EDHAVE_IFX_IUS"
- else
- IFX_ESQL_FLAGS="$IFX_ESQL_FLAGS -EUHAVE_IFX_IUS"
- fi
-
- PHP_NEW_EXTENSION(informix, ifx.c, $ext_shared,, $IFX_INCLUDE)
- PHP_ADD_MAKEFILE_FRAGMENT
-
- for i in $IFX_LIBS; do
- case "$i" in
- *.o)
- IFX_LIBOBJS="$IFX_LIBOBJS $i"
- PHP_ADD_LIBPATH($ext_builddir, INFORMIX_SHARED_LIBADD)
- PHP_ADD_LIBRARY_DEFER(phpifx, 1, INFORMIX_SHARED_LIBADD)
- ;;
- -lm)
- ;;
- -lc)
- ;;
- -l*)
- lib=`echo $i | cut -c 3-`
- PHP_ADD_LIBRARY_DEFER($lib, 1, INFORMIX_SHARED_LIBADD)
- ;;
- *.a)
- case "`uname -s 2>/dev/null`" in
- UnixWare | SCO_SV | UNIX_SV)
- DLIBS="$DLIBS $i"
- ;;
- *)
- ac_dir="`echo $i|sed 's#[^/]*$##;s#\/$##'`"
- ac_lib="`echo $i|sed 's#^/.*/lib##g;s#\.a##g'`"
- DLIBS="$DLIBS -L$ac_dir -l$ac_lib"
- ;;
- esac
- ;;
- esac
- done
-
- PHP_SUBST(INFORMIX_SHARED_LIBADD)
- PHP_SUBST(INFORMIXDIR)
- PHP_SUBST(IFX_LIBOBJS)
- PHP_SUBST(IFX_ESQL_FLAGS)
- AC_DEFINE(HAVE_IFX,1,[ ])
-fi
diff --git a/ext/informix/ifx.dsp b/ext/informix/ifx.dsp
deleted file mode 100644
index 34d8922c03..0000000000
--- a/ext/informix/ifx.dsp
+++ /dev/null
@@ -1,134 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ifx" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ifx - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ifx.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ifx.mak" CFG="ifx - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ifx - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ifx - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ifx - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /D HAVE_IFX=1 /D HAVE_IUS=1 /D "ZTS" /D ZEND_WIN32=1 /D PHP_WIN32=1 /D IFX_VERSION=921 /D COMPILE_DL_INFORMIX=1 /D ZEND_DEBUG=0 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 isqlt09a.lib php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"..\..\Release_TS/php_ifx.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ifx - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "ifx___W0"
-# PROP BASE Intermediate_Dir "ifx___W0"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /D HAVE_IFX=1 /D HAVE_IUS=1 /D "ZTS" /D ZEND_WIN32=1 /D PHP_WIN32=1 /D IFX_VERSION=921 /D COMPILE_DL_INFORMIX=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-# ADD BASE RSC /l 0x406 /d "_DEBUG"
-# ADD RSC /l 0x406 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 isqlt09a.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug_TS/php_ifx.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "ifx - Win32 Release_TS"
-# Name "ifx - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ifx.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ifx.ec
-
-!IF "$(CFG)" == "ifx - Win32 Release_TS"
-
-# Begin Custom Build
-InputPath=.\ifx.ec
-
-".\ifx.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- esql.exe -dcmdl -p -G -subsystem:windows -thread -I..\.. ifx.ec
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ifx - Win32 Debug_TS"
-
-# Begin Custom Build
-InputPath=.\ifx.ec
-
-".\ifx.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- esql.exe -dcmdl -p -G -subsystem:windows -thread -I..\.. ifx.ec
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_informix.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/informix/ifx.ec b/ext/informix/ifx.ec
deleted file mode 100644
index 016358e479..0000000000
--- a/ext/informix/ifx.ec
+++ /dev/null
@@ -1,4597 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Danny Heijl <Danny.Heijl@cevi.be> : initial cut (ODS 7.2x) |
- | PHP4 port |
- | Christian Cartus <chc@idgruppe.de> : blobs, and IUS 9 |
- | Jouni Ahto <jouni.ahto@exdec.fi> : configuration stuff |
- | Corne' Cornelius <cornec@reach.co.za> : input descriptors |
- | Based on the MySQL code by: Zeev Suraski <zeev@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* -------------------------------------------------------------------
- * if you want a function reference : "grep '^\*\*' ifx.ec" will give
- * you a very short one
- * -------------------------------------------------------------------
-*/
-
-/* TODO:
- *
- * ? Safe mode implementation
- */
-
-/* prevent mod_ssl.h's header file from being included. */
-#define AP_HOOK_H
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/php_standard.h"
-#include "php_open_temporary_file.h"
-#include "php_informix.h"
-#include "php_informix_includes.h"
-#include "php_globals.h"
-#include "php_ini.h"
-
-#ifdef PHP_WIN32
-#include <winsock.h>
-#endif
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#if HAVE_NETDB_H
-#include <netdb.h>
-#endif
-
-#if HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-#if HAVE_IFX
-
-/* local function prototypes */
-static void php_ifx_set_default_link(int id TSRMLS_DC);
-static long php_intifx_getType(long id, HashTable *list TSRMLS_DC);
-static long php_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list TSRMLS_DC);
-static long php_intifx_init_blob(loc_t *blob, long mode, long new TSRMLS_DC);
-static long php_intifx_init_blob_inmem(loc_t *blob, long new TSRMLS_DC);
-static long php_intifx_init_blob_infile(loc_t *blob, long new TSRMLS_DC);
-static void php_intifx_release_blob(loc_t *blob TSRMLS_DC);
-static long php_intifx_free_blob(long id, HashTable *list TSRMLS_DC);
-static long php_intifx_get_blob(long bid, HashTable *list, char** content TSRMLS_DC);
-static long php_intifx_update_blob(long bid, char* param, long len, HashTable *list TSRMLS_DC);
-static loc_t *php_intifx_get_blobloc(long bid, HashTable *list TSRMLS_DC);
-static char* php_intifx_create_tmpfile(TSRMLS_D);
-static long php_intifx_copy_blob(long bid, HashTable *list TSRMLS_DC);
-static long php_intifx_alloc_ibind(IFX_RES *Ifx_Result, int items TSRMLS_DC);
-static long php_intifx_preparse(char *statement TSRMLS_DC);
-static long php_intifx_count_descriptors(char *p_statemid TSRMLS_DC);
-static char* php_intifx_null(TSRMLS_D);
-static long php_intifx_create_char(char* param, long len, HashTable *list TSRMLS_DC);
-static long php_intifx_free_char(long id, HashTable *list TSRMLS_DC);
-static long php_intifx_update_char(long bid, char* param, long len, HashTable *list TSRMLS_DC);
-static long php_intifx_get_char(long bid, HashTable *list, char** content TSRMLS_DC);
-#if HAVE_IFX_IUS
-static long php_intifxus_create_slob(long create_mode, HashTable *list TSRMLS_DC);
-static long php_intifxus_free_slob(long bid, HashTable *list TSRMLS_DC);
-static long php_intifxus_close_slob(long bid, HashTable *list TSRMLS_DC);
-static long php_intifxus_open_slob(long bid, long create_mode, HashTable *list TSRMLS_DC);
-static long php_intifxus_new_slob(HashTable *list TSRMLS_DC);
-static ifx_lo_t *php_intifxus_get_slobloc(long bid, HashTable *list TSRMLS_DC);
-#endif
-
-/* 7.10 on (at least) AIX is missing this */
-#ifndef CLIENT_SQLI_VER
-#define CLIENT_SQLI_VER IFX_VERSION
-#endif
-
-#define TYPE_BLBYTE 0
-#define TYPE_BLTEXT 1
-#define TYPE_SLOB 2
-#define TYPE_CHAR 3
-
-#define BLMODE_INMEM 0
-#define BLMODE_INFILE 1
-
-#define IFX_SCROLL 1
-#define IFX_HOLD 2
-
-EXEC SQL include locator;
-EXEC SQL include sqltypes;
-EXEC SQL include sqlstype;
-
-#include <errno.h>
-
-typedef char IFX[128];
-#define SAFE_STRING(s) ((s) ? (s) : "")
-#define PHP_IFX_CHECK_CONNECTION(ifx) \
- { \
- if (ifx_check() < 0) { \
- IFXG(sv_sqlcode) = SQLCODE; \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Set connection %s fails (%s)", ifx, ifx_error(ifx)); \
- RETURN_FALSE; \
- } \
- }
-
-function_entry ifx_functions[] = {
- PHP_FE(ifx_connect, NULL)
- PHP_FE(ifx_pconnect, NULL)
- PHP_FE(ifx_close, NULL)
- PHP_FE(ifx_query, NULL)
- PHP_FE(ifx_prepare, NULL)
- PHP_FE(ifx_do, NULL)
- PHP_FE(ifx_error, NULL)
- PHP_FE(ifx_errormsg, NULL)
- PHP_FE(ifx_affected_rows, NULL)
- PHP_FE(ifx_num_rows, NULL)
- PHP_FE(ifx_num_fields, NULL)
- PHP_FE(ifx_fetch_row, NULL)
- PHP_FE(ifx_free_result, NULL)
- PHP_FE(ifx_htmltbl_result, NULL)
- PHP_FE(ifx_fieldtypes, NULL)
- PHP_FE(ifx_fieldproperties, NULL)
- PHP_FE(ifx_getsqlca, NULL)
-
- PHP_FE(ifx_create_blob, NULL)
- PHP_FE(ifx_free_blob, NULL)
- PHP_FE(ifx_get_blob, NULL)
- PHP_FE(ifx_update_blob, NULL)
- PHP_FE(ifx_copy_blob, NULL)
- PHP_FE(ifx_textasvarchar, NULL)
- PHP_FE(ifx_byteasvarchar, NULL)
- PHP_FE(ifx_nullformat, NULL)
- PHP_FE(ifx_blobinfile_mode, NULL)
-
- PHP_FE(ifx_create_char, NULL)
- PHP_FE(ifx_free_char, NULL)
- PHP_FE(ifx_get_char, NULL)
- PHP_FE(ifx_update_char, NULL)
-
-$ifdef HAVE_IFX_IUS;
- PHP_FE(ifxus_create_slob, NULL)
- PHP_FE(ifxus_close_slob, NULL)
- PHP_FE(ifxus_open_slob, NULL)
- PHP_FE(ifxus_free_slob, NULL)
- PHP_FE(ifxus_read_slob, NULL)
- PHP_FE(ifxus_write_slob, NULL)
- PHP_FE(ifxus_seek_slob, NULL)
- PHP_FE(ifxus_tell_slob, NULL)
-$endif;
-
- {NULL,NULL,NULL}
-};
-
-zend_module_entry ifx_module_entry = {
- STANDARD_MODULE_HEADER,
- "informix",
- ifx_functions,
- PHP_MINIT(ifx),
- PHP_MSHUTDOWN(ifx),
- PHP_RINIT(ifx),
- NULL,
- PHP_MINFO(ifx),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-ZEND_DECLARE_MODULE_GLOBALS(ifx)
-
-#ifdef COMPILE_DL_INFORMIX
-ZEND_GET_MODULE(ifx)
-#endif
-
-/* True globals, no need for thread safety */
-static int le_link, le_plink, le_result, le_idresult;
-
-#define DUP 1
-
-EXEC SQL DEFINE IFX_SUCCESS 0;
-EXEC SQL DEFINE IFX_WARNING 1;
-EXEC SQL DEFINE IFX_ERROR -1;
-EXEC SQL DEFINE IFX_NODATA 100;
-
-static int ifx_check()
-{
- int _ifx_check;
-
- _ifx_check = IFX_ERROR;
-
- if (SQLSTATE[0] == '0') {
- switch (SQLSTATE[1]) {
- case '0':
- _ifx_check = IFX_SUCCESS;
- break;
- case '1':
- _ifx_check = IFX_WARNING;
- break;
- case '2':
- _ifx_check = IFX_NODATA;
- break;
- default :
- _ifx_check = IFX_ERROR;
- break;
- }
- }
- return _ifx_check;
-}
-
-static char *ifx_error(ifx)
-EXEC SQL BEGIN DECLARE SECTION;
- PARAMETER char *ifx;
-EXEC SQL END DECLARE SECTION;
-{
- char *ifx_err_msg;
- char c;
- int errorcode;
- TSRMLS_FETCH();
-
- if (IFXG(sv_sqlcode) == 0) {
- errorcode = SQLCODE;
- } else {
- errorcode = IFXG(sv_sqlcode);
- }
-
- switch (ifx_check()) {
- case IFX_SUCCESS:
- c = ' ';
- break;
- case IFX_WARNING:
- c = 'W';
- break;
- case IFX_ERROR:
- c = 'E';
- break;
- case IFX_NODATA:
- c = 'N';
- break;
- default:
- c = '?';
- break;
- }
-
- ifx_err_msg = emalloc(64);
- sprintf(ifx_err_msg, "%c [SQLSTATE=%c%c %c%c%c SQLCODE=%d]",
- c,
- SQLSTATE[0],
- SQLSTATE[1],
- SQLSTATE[2],
- SQLSTATE[3],
- SQLSTATE[4],
- errorcode
- );
-
- return(ifx_err_msg);
-}
-
-static void _close_ifx_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
-EXEC SQL BEGIN DECLARE SECTION;
- char *link;
-EXEC SQL END DECLARE SECTION;
-
- link=(char *)rsrc->ptr;
-
- EXEC SQL SET CONNECTION :link;
- if (ifx_check() >= 0) {
- EXEC SQL close database;
- EXEC SQL DISCONNECT CURRENT;
- }
- efree(link);
- IFXG(num_links)--;
-}
-
-static void _close_ifx_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
-EXEC SQL BEGIN DECLARE SECTION;
- char *link;
-EXEC SQL END DECLARE SECTION;
-
- link = (char *)rsrc->ptr;
-
- EXEC SQL SET CONNECTION :link;
- if (ifx_check() >= 0) {
- EXEC SQL close database;
- EXEC SQL DISCONNECT CURRENT;
- }
- free(link);
- IFXG(num_persistent)--;
- IFXG(num_links)--;
-}
-
-static void ifx_free_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- IFX_RES *Ifx_Result = (IFX_RES *)rsrc->ptr;
- efree(Ifx_Result);
-}
-
-static void ifx_free_blob(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- IFX_IDRES *Ifx_blob = (IFX_IDRES *)rsrc->ptr;
-
- php_intifx_release_blob(&Ifx_blob->BLOB.blob_data TSRMLS_CC);
- efree(Ifx_blob);
-}
-
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("ifx.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong, allow_persistent, zend_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY_EX("ifx.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_persistent, zend_ifx_globals, ifx_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("ifx.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_links, zend_ifx_globals, ifx_globals, display_link_numbers)
- STD_PHP_INI_ENTRY("ifx.default_host", NULL, PHP_INI_SYSTEM, OnUpdateString, default_host, zend_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY("ifx.default_user", NULL, PHP_INI_SYSTEM, OnUpdateString, default_user, zend_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY("ifx.default_password", NULL, PHP_INI_SYSTEM, OnUpdateString, default_password, zend_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY("ifx.blobinfile", "1", PHP_INI_ALL, OnUpdateLong, blobinfile, zend_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY("ifx.textasvarchar", "0", PHP_INI_ALL, OnUpdateLong, textasvarchar, zend_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY("ifx.byteasvarchar", "0", PHP_INI_ALL, OnUpdateLong, byteasvarchar, zend_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY("ifx.charasvarchar", "0", PHP_INI_ALL, OnUpdateLong, charasvarchar, zend_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY("ifx.nullformat", "0", PHP_INI_ALL, OnUpdateLong, nullformat, zend_ifx_globals, ifx_globals)
-PHP_INI_END()
-
-static void php_ifx_init_globals(zend_ifx_globals *ifx_globals)
-{
- ifx_globals->num_persistent = 0;
- ifx_globals->nullvalue[0] = 0;
- strcpy(ifx_globals->nullstring, "NULL");
- ifx_globals->num_persistent = 0;
- ifx_globals->sv_sqlcode = 0;
-}
-
-PHP_MINIT_FUNCTION(ifx)
-{
- ZEND_INIT_MODULE_GLOBALS(ifx, php_ifx_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
-
- le_result = zend_register_list_destructors_ex(ifx_free_result, NULL, "informix result", module_number);
- le_idresult = zend_register_list_destructors_ex(ifx_free_blob, NULL, "informix id result", module_number);
- le_link = zend_register_list_destructors_ex(_close_ifx_link, NULL, "informix link", module_number);
- le_plink = zend_register_list_destructors_ex(NULL, _close_ifx_plink, "informix persistent link", module_number);
- ifx_module_entry.type = type;
-
- REGISTER_LONG_CONSTANT("IFX_SCROLL", IFX_SCROLL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IFX_HOLD", IFX_HOLD, CONST_CS | CONST_PERSISTENT);
-$ifdef HAVE_IFX_IUS;
- REGISTER_LONG_CONSTANT("IFX_LO_RDONLY", LO_RDONLY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IFX_LO_WRONLY", LO_WRONLY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IFX_LO_APPEND", LO_APPEND, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IFX_LO_RDWR", LO_RDWR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IFX_LO_BUFFER", LO_BUFFER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IFX_LO_NOBUFFER", LO_NOBUFFER, CONST_CS | CONST_PERSISTENT);
-$endif;
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(ifx)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(ifx)
-{
- IFXG(default_link) = -1;
- IFXG(num_links) = IFXG(num_persistent);
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(ifx)
-{
- char buf[32];
-
- php_info_print_table_start();
- php_info_print_table_header(2, "Informix support", "enabled");
- sprintf(buf, "%ld", IFXG(num_persistent));
- php_info_print_table_row(2, "Active Persistent links", buf);
- sprintf(buf, "%ld", IFXG(num_links));
- php_info_print_table_row(2, "Active links", buf);
- sprintf(buf, "%02.2f", (double)(IFX_VERSION/100.0));
- php_info_print_table_row(2, "ESQL/C Version", buf);
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-static void php_ifx_set_default_link(int id TSRMLS_DC)
-{
- if (IFXG(default_link) != -1) {
- zend_list_delete(IFXG(default_link));
- }
- IFXG(default_link) = id;
- zend_list_addref(id);
-}
-
-/* ----------------------------------------------------------------------
-** int ifx_(p)connect(string database, string userid, string password)
-**
-** connects to $database (db@server syntax) using $userid and $password
-**
-** returns a connection id on success or FALSE one error
-** ----------------------------------------------------------------------
-*/
-
-static void php_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- char *hashed_details;
- int hashed_details_length;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *user,*passwd,*host;
- char *ifx;
-EXEC SQL END DECLARE SECTION;
-
- if (PG(sql_safe_mode)) {
- if (ZEND_NUM_ARGS() > 0) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "SQL safe mode in effect - ignoring host/user/password information");
- }
- host = passwd = NULL;
- user = php_get_current_user();
- hashed_details_length = strlen(user) + 3 + 3;
- hashed_details = (char *) emalloc(hashed_details_length + 1);
- sprintf(hashed_details, "ifx__%s_", user);
- } else {
- int host_len = 0, user_len = 0, passwd_len = 0;
- host = user = passwd = NULL;
-
- /* set default values if any are avaliable */
- if (IFXG(default_host)) {
- host = IFXG(default_host);
- host_len = strlen(host);
- }
- if (IFXG(default_user)) {
- user = IFXG(default_user);
- user_len = strlen(IFXG(default_user));
- }
- if (IFXG(default_password)) {
- passwd = IFXG(default_password);
- passwd_len = strlen(IFXG(default_password));
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sss", &host, &host_len, &user, &user_len, &passwd, &passwd_len) == FAILURE) {
- return;
- }
-
- hashed_details_length = sizeof("ifx___") - 1 + host_len + user_len + passwd_len;
- hashed_details = (char *) emalloc(hashed_details_length + 1);
- sprintf(hashed_details, "ifx_%s_%s_%s", SAFE_STRING(host), SAFE_STRING(user), SAFE_STRING(passwd));
- }
-
- IFXG(sv_sqlcode) = 0;
-
- if (!IFXG(allow_persistent)) {
- persistent = 0;
- }
-
- if (persistent) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length + 1, (void **) &le) == FAILURE) { /* we don't */
- list_entry new_le;
-
- if (IFXG(max_links) != -1 && IFXG(num_links) >= IFXG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)", IFXG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (IFXG(max_persistent) != -1 && IFXG(num_persistent) >= IFXG(max_persistent)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%d)", IFXG(num_persistent));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* create the link */
- ifx = (char *) malloc(sizeof(IFX));
- IFXG(connectionid)++;
- sprintf(ifx, "%s%x", SAFE_STRING(user), IFXG(connectionid));
-
- EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION;
-
- if (ifx_check() == IFX_ERROR) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ifx_error(ifx));
- free(ifx);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* hash it up */
- new_le.type = le_plink;
- new_le.ptr = ifx;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length + 1, (void *) &new_le, sizeof(list_entry), NULL) == FAILURE) {
- free(ifx);
- efree(hashed_details);
- RETURN_FALSE;
- }
- IFXG(num_persistent)++;
- IFXG(num_links)++;
- } else { /* we do */
- if (le->type != le_plink) {
- RETURN_FALSE;
- }
- /* ensure that the link did not die */
- ifx = le->ptr;
- EXEC SQL SET CONNECTION :ifx;
- if (ifx_check() == IFX_ERROR) { /* the link died */
- ifx = le->ptr; /* reconnect silently */
- EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION;
-
- if (ifx_check() == IFX_ERROR) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Link to server lost, unable to reconnect (%s)", ifx_error(ifx));
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length + 1);
- efree(hashed_details);
- RETURN_FALSE;
- }
- }
- ifx = le->ptr;
- }
- ZEND_REGISTER_RESOURCE(return_value, ifx, le_plink);
- } else { /* non persistent */
- list_entry *index_ptr,new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual ifx link sits.
- * if it doesn't, open a new ifx link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length + 1, (void **) &index_ptr) == SUCCESS)
- {
- int type,link;
- void *ptr;
-
- if (index_ptr->type != le_index_ptr) {
- RETURN_FALSE;
- }
- link = (int) index_ptr->ptr;
- ptr = zend_list_find(link, &type); /* check if the link is still there */
- if (ptr && (type == le_link || type == le_plink)) {
- /* ensure that the link is not closed */
- ifx = ptr;
- EXEC SQL SET CONNECTION :ifx;
- if (ifx_check() == IFX_ERROR) {
- /* the link is closed */
- ifx = ptr; /* reconnect silently */
- EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION;
-
- if (ifx_check() == IFX_ERROR) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect (%s)", ifx_error(ifx));
- zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length + 1);
- efree(hashed_details);
- RETURN_FALSE;
- }
- }
- zend_list_addref(link);
- return_value->value.lval = link;
- php_ifx_set_default_link(link TSRMLS_CC);
- return_value->type = IS_RESOURCE;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length + 1);
- }
- }
- if (IFXG(max_links) != -1 && IFXG(num_links) >= IFXG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)", IFXG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- ifx = (char *) emalloc(sizeof(IFX));
- IFXG(connectionid)++;
- sprintf(ifx, "connec%x", IFXG(connectionid));
-
- EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION;
-
- if (ifx_check() == IFX_ERROR) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ifx_error(ifx));
- efree(hashed_details);
- efree(ifx);
- RETURN_FALSE;
- }
-
- /* add it to the list */
- ZEND_REGISTER_RESOURCE(return_value, ifx, le_link);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) return_value->value.lval;
- new_index_ptr.type = le_index_ptr;
- if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length + 1, (void *) &new_index_ptr, sizeof(list_entry), NULL) == FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- IFXG(num_links)++;
- }
- efree(hashed_details);
- php_ifx_set_default_link(return_value->value.lval TSRMLS_CC);
-}
-
-/* {{{ proto int ifx_connect([string database [, string userid [, string password]]])
- Connects to database using userid/password, returns connection id */
-PHP_FUNCTION(ifx_connect)
-{
- php_ifx_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-/* }}} */
-
-/* {{{ proto int ifx_pconnect([string database [, string userid [, string password]]])
- Connects to database using userid/password, returns connection id */
-PHP_FUNCTION(ifx_pconnect)
-{
- php_ifx_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** int ifx_close(int connid)
-**
-** closes connection connid
-** always returns TRUE
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_close([int connid])
- Close informix connection */
-PHP_FUNCTION(ifx_close)
-{
- zval **ifx_link = NULL;
- int id;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx;
-EXEC SQL END DECLARE SECTION;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = IFXG(default_link);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &ifx_link) == FAILURE) {
- RETURN_FALSE;
- }
- id=-1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- ZEND_FETCH_RESOURCE2(ifx, char *, ifx_link, id, "Informix link", le_link, le_plink);
-
- if (id == -1) { /* explicit resource number */
- zend_list_delete(Z_RESVAL_PP(ifx_link));
- }
-
- if (id != -1 || (ifx_link && Z_RESVAL_PP(ifx_link) == IFXG(default_link))) {
- zend_list_delete(IFXG(default_link));
- IFXG(default_link) = -1;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** int ifx_query(string query, int connid
-** [, int cursortype] [, array blobidarray])
-** cursortype and blobidarray are optional
-**
-** executes query query on connection connid
-** for select queries a cursor is declared and opened
-** non-select queries are "execute immediate"
-** select queries accept an optional cursortype param:
-** IFX_SCROLL, IFX_HOLD (or'ed mask)
-** non-select queries accept an optional "blobarryid" parameter
-** blobsupport: mark the blob-column(s) with ? in the insert/update query
-** and add a blob-id-array-functionparameter
-** select queries return "blob-ids" for blob columns
-** except if text/byteasvarchar is set
-** example: ifx_query("insert into catalog (stock_num, manu_code,
-** cat_descr,cat_picture) values(1,'HRO',?,?)",$cid,$bidarray);
-**
-** returns a "result id" on success or FALSE on error
-** also sets "affected_rows for retrieval by ifx_affected_rows()
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_query(string query, int connid [, int cursortype] [, array idarray])
- Perform a query on a given connection */
-PHP_FUNCTION(ifx_query)
-{
- zval **query, **ifx_link, **cursortype, **dummy;
- int id=-1;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char cursorid[32]; /* query cursor id */
- char statemid[32]; /* statement id */
- char descrpid[32]; /* descriptor id */
- char i_descrpid[32]; /* input descriptor binding */
- char *statement; /* query text */
- int fieldcount; /* field count */
- int i; /* field index */
- short fieldtype;
- loc_t *locator=NULL;
- int loc_t_type=CLOCATORTYPE; /* WORKAROUND:TYPE=CLOCATORTYPE doesn't work, */
- int sqlchar_type=SQLCHAR; /* don't ask me, why. */
- char *char_tmp;
- long len;
- int indicator;
- int desc_count;
-$ifdef HAVE_IFX_IUS;
- fixed binary 'blob' ifx_lo_t *slocator;
-$endif;
-EXEC SQL END DECLARE SECTION;
-
- int locind;
- int ctype;
- int affected_rows;
- long sqlerrd[6];
- int e;
- int query_type;
- int cursoryproc;
- int argc=ZEND_NUM_ARGS();
- long ifx_type;
- int num_params;
-
- if (argc < 2 || zend_get_parameters_ex(argc, &query, &ifx_link, &dummy, &dummy) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(ifx, char *, ifx_link, id, "Informix link", le_link, le_plink);
-
- IFXG(sv_sqlcode) = 0;
- affected_rows = -1; /* invalid */
-
- convert_to_string_ex(query);
- statement = Z_STRVAL_PP(query);
-
- IFXG(cursorid)++;
- sprintf(statemid, "statem%x", IFXG(cursorid));
- sprintf(cursorid, "cursor%x", IFXG(cursorid));
- sprintf(descrpid, "descrp%x", IFXG(cursorid));
- sprintf(i_descrpid, "i_descrp%x", IFXG(cursorid));
-
- EXEC SQL set connection :ifx;
- PHP_IFX_CHECK_CONNECTION(ifx);
-
- EXEC SQL PREPARE :statemid FROM :statement;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Prepare fails (%s)", ifx_error(ifx));
- RETURN_FALSE;
- }
-
- affected_rows = sqlca.sqlerrd[0]; /* save estimated affected rows */
- for (e = 0; e < 6; e++) sqlerrd[e] = sqlca.sqlerrd[e];
-
- num_params = php_intifx_preparse(statement TSRMLS_CC);
-
- Ifx_Result = (IFX_RES *) emalloc(sizeof(IFX_RES));
- if (Ifx_Result == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Out of memory allocating IFX_RES");
- EXEC SQL free :statemid;
- RETURN_FALSE;
- }
-
- /* initialize result data structure */
- Ifx_Result->rowid = 0;
- strcpy(Ifx_Result->connecid, ifx);
- strcpy(Ifx_Result->cursorid, cursorid);
- strcpy(Ifx_Result->descrpid, descrpid);
- strcpy(Ifx_Result->i_descrpid, i_descrpid);
- strcpy(Ifx_Result->statemid, statemid);
- Ifx_Result->numcols = 0;
- Ifx_Result->numicols = 0;
-
- for (i = 0; i < MAX_RESID; ++i) {
- Ifx_Result->res_id[i] = -1;
- }
-
- if (!php_intifx_alloc_ibind(Ifx_Result, num_params TSRMLS_CC)) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate i_desciptor <%s> fails (%s)", i_descrpid, ifx_error(ifx));
- RETURN_FALSE;
- }
-
- desc_count = php_intifx_count_descriptors(statemid TSRMLS_CC);
- if (desc_count == 0) {
- desc_count = 1;
- }
-
- EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX :desc_count;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate desciptor <%s> fails (%s)", descrpid, ifx_error(ifx));
- EXEC SQL free :statemid;
- RETURN_FALSE;
- }
-
- EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Describe fails (%s)", ifx_error(ifx));
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- RETURN_FALSE;
- }
-
- query_type = sqlca.sqlcode;
-
- cursoryproc = 0;
- if (query_type == SQ_EXECPROC) {
- EXEC SQL GET DESCRIPTOR :descrpid :i = COUNT;
- if (i > 0) {
- cursoryproc = 1;
- }
- }
-
- Ifx_Result->iscursory = -1; /* prevent ifx_do */
- Ifx_Result->paramquery = 0;
-
- if ((query_type != 0) && (!cursoryproc)) { /* NO RESULT SET */
- /* ##
- ## NONSELECT-STATEMENT
- ##
- */
- zval **pblobidarr, **tmp;
-
- /* We don't need this descriptor anymore, NONSELECT-STATEMENT */
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
-
- Ifx_Result->iscursory = 0;
-
- if (argc > 3) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 3) {
-
- if (Ifx_Result->numicols <= 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No placeholders (?) in Statement, but blob array param supplied");
- RETURN_FALSE;
- }
-
- if (zend_get_parameters_ex(3, &dummy, &dummy, &pblobidarr) == FAILURE) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't get blob array param");
- RETURN_FALSE;
- }
- if (Z_TYPE_PP(pblobidarr) != IS_ARRAY) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Blob-parameter is not an array");
- RETURN_FALSE;
- }
-
- zend_hash_internal_pointer_reset((*pblobidarr)->value.ht);
- for (i = 1; i <= Ifx_Result->numicols && (zend_hash_get_current_data((*pblobidarr)->value.ht, (void **) &tmp) == SUCCESS); ++i) {
- convert_to_long(*tmp);
-
- ifx_type = php_intifx_getType((int)(*tmp)->value.lval, &EG(regular_list) TSRMLS_CC);
- switch (ifx_type) {
- case TYPE_BLTEXT:
- case TYPE_BLBYTE:
- locator = php_intifx_get_blobloc((int)((*tmp)->value.lval), &EG(regular_list) TSRMLS_CC);
- if (locator == NULL) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an Informix blob-result index", (int)((*tmp)->value.lval));
- RETURN_FALSE;
- }
- if (locator->loc_loctype == LOCFNAME) {
- locator->loc_oflags=LOC_RONLY;
- }
- EXEC SQL SET DESCRIPTOR :i_descrpid VALUE :i DATA = :*locator, TYPE = :loc_t_type;
- break;
-
- case TYPE_CHAR:
- len = php_intifx_get_char((int) ((*tmp)->value.lval), &EG(regular_list), &char_tmp TSRMLS_CC);
- indicator = 0;
- if (char_tmp == NULL || len < 0) {
- indicator = -1;
- }
- len++;
-
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i
- DATA= :char_tmp,
- LENGTH= :len,
- INDICATOR= :indicator,
- TYPE= :sqlchar_type;
- break;
- }
-
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails : %s", ifx_error(ifx));
- RETURN_FALSE;
- }
-
- zend_hash_move_forward((*pblobidarr)->value.ht);
- }
- Ifx_Result->paramquery=1;
-
- if (i - 1 != Ifx_Result->numicols) {
- EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails : number of created blobs doesn't match placeholders (?)");
- RETURN_FALSE;
- }
- EXEC SQL EXECUTE :statemid USING SQL DESCRIPTOR :i_descrpid;
- } else {
- EXEC SQL EXECUTE :statemid;
- }
-
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- if (Ifx_Result->numicols > 0) {
- EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
- }
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails : %s", ifx_error(ifx));
- RETURN_FALSE;
- }
- Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
- for (e = 0; e < 6; e++) {
- Ifx_Result->sqlerrd[e] = sqlca.sqlerrd[e];
- }
- } else {
- /* ##
- ## SELECT-STATEMENT
- ##
- */
-
- ctype = 0; /* preset */
-
- switch(argc) {
- case 2:
- break;
- case 3:
- if (zend_get_parameters_ex(3, &dummy, &dummy, &cursortype) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(cursortype);
- ctype = Z_LVAL_PP(cursortype);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- Ifx_Result->affected_rows = affected_rows; /* saved estimated from prepare */
- for (e = 0; e < 6; e++) {
- Ifx_Result->sqlerrd[e] = sqlerrd[e];
- }
-
- EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not get descriptor %s (%s)", descrpid, ifx_error(ifx));
- RETURN_FALSE;
- }
-
- Ifx_Result->numcols = fieldcount;
- Ifx_Result->isscroll = Ifx_Result->ishold = 0;
-
- if (ctype & IFX_SCROLL) {
- Ifx_Result->isscroll = 1;
- }
- if (ctype & IFX_HOLD) {
- Ifx_Result->ishold = 1;
- }
-
- /*
- * ifx_do() part
- */
-
- if (Ifx_Result->isscroll) {
- if (Ifx_Result->ishold) {
- EXEC SQL DECLARE :cursorid SCROLL CURSOR WITH HOLD FOR :statemid;
- } else {
- EXEC SQL DECLARE :cursorid SCROLL CURSOR FOR :statemid;
- }
- } else {
- if (Ifx_Result->ishold) {
- EXEC SQL DECLARE :cursorid CURSOR WITH HOLD FOR :statemid;
- } else {
- EXEC SQL DECLARE :cursorid CURSOR FOR :statemid;
- }
- }
-
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Declare cursor fails (%s)", ifx_error(ifx));
- RETURN_FALSE;
- }
-
- EXEC SQL OPEN :cursorid;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- EXEC SQL free :cursorid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Open cursor fails (%s)", ifx_error(ifx));
- RETURN_FALSE;
- }
-
- /* check for text/blob columns */
- locind = 0;
- for (i = 1; i <= fieldcount; ++i) {
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldtype = TYPE;
- if ((fieldtype == SQLTEXT) || (fieldtype == SQLBYTES)
-$ifdef HAVE_IFX_IUS;
- || (fieldtype == SQLUDTFIXED)
-$endif;
- ) {
- int bid = 0;
- if (fieldtype == SQLTEXT) {
- if (IFXG(blobinfile) == 0) {
- bid = php_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM, "", -1, &EG(regular_list) TSRMLS_CC);
- locator = php_intifx_get_blobloc(bid, &EG(regular_list) TSRMLS_CC);
- } else {
- bid = php_intifx_create_blob(TYPE_BLTEXT,BLMODE_INFILE, "",-1, &EG(regular_list) TSRMLS_CC);
- locator = php_intifx_get_blobloc(bid, &EG(regular_list) TSRMLS_CC);
- }
-
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
- } else if (fieldtype == SQLBYTES) {
- if (IFXG(blobinfile) == 0) {
- bid = php_intifx_create_blob(TYPE_BLBYTE, BLMODE_INMEM, "", -1, &EG(regular_list) TSRMLS_CC);
- locator = php_intifx_get_blobloc(bid, &EG(regular_list) TSRMLS_CC);
- } else {
- bid = php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INFILE, "", -1, &EG(regular_list) TSRMLS_CC);
- locator = php_intifx_get_blobloc(bid, &EG(regular_list) TSRMLS_CC);
- }
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
- }
-
- php_intifx_release_blob(locator TSRMLS_CC);
-$ifdef HAVE_IFX_IUS;
- if (fieldtype == SQLUDTFIXED) {
- bid = php_intifxus_new_slob(&EG(regular_list) TSRMLS_CC);
- slocator = php_intifxus_get_slobloc(bid, &EG(regular_list) TSRMLS_CC);
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*slocator;
- }
-$endif;
- Ifx_Result->res_id[locind]=bid;
- ++locind;
- }
- }
- }
- ZEND_REGISTER_RESOURCE(return_value, Ifx_Result, le_result);
-}
-/* }}} */
-
-
-/* ----------------------------------------------------------------------
-** int ifx_prepare(string query, int connid,
-** [, int cursortype] [, array blobidarry])
-**
-** $hold, $scroll are optional and valid only for select queries
-** $blobidarray is optional, an array of blob id's
-**
-** prepares query $query on connection $connid
-** select queries accept an optional cursortype param: IFX_SCROLL, IFX_HOLD (or'ed mask)
-** blobsupport: mark the blob-column with ? and add a blob-id-functionparameter
-** example: ifx_query("insert into catalog (stock_num, manu_code ,cat_descr,
-** cat_picture) values(1,'HRO',?,?)",$cid,$bid1,$bid2);
-**
-** returns a "result id" on success or FALSE on error
-** also sets "affected_rows for retrieval by ifx_affected_rows
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_prepare(string query, int connid [, int cursortype] [, array idarray])
- Prepare a query on a given connection */
-PHP_FUNCTION(ifx_prepare)
-{
- zval **query, **ifx_link, **cursortype, **dummy;
- int id=-1;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char cursorid[32]; /* query cursor id */
- char statemid[32]; /* statement id */
- char descrpid[32]; /* descriptor id */
- char i_descrpid[32]; /* input descriptor binding */
- char *statement; /* query text */
- int fieldcount; /* field count */
- int i; /* field index */
- loc_t *locator;
- int loc_t_type=CLOCATORTYPE; /* WORKAROUND: TYPE=CLOCATORTYPE doesn't work, */
- int sqlchar_type=SQLCHAR; /* don't ask me, why. */
- char *char_tmp;
- long len;
- int indicator;
- long sqlerrd[6];
- int e;
- int desc_count;
-EXEC SQL END DECLARE SECTION;
- int ctype;
- int affected_rows;
- int query_type;
- int cursoryproc;
- int argc=ZEND_NUM_ARGS();
- long ifx_type;
- int num_params;
-
- if (argc < 2 || zend_get_parameters_ex(argc, &query, &ifx_link, &dummy, &dummy) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(ifx, char *, ifx_link, id, "Informix link", le_link, le_plink);
-
- IFXG(sv_sqlcode) = 0;
- affected_rows = -1; /* invalid */
-
- convert_to_string_ex(query);
- statement = Z_STRVAL_PP(query);
-
- IFXG(cursorid)++;
- sprintf(statemid, "statem%x", IFXG(cursorid));
- sprintf(cursorid, "cursor%x", IFXG(cursorid));
- sprintf(descrpid, "descrp%x", IFXG(cursorid));
- sprintf(i_descrpid, "i_descrp%x", IFXG(cursorid));
-
- EXEC SQL set connection :ifx;
- PHP_IFX_CHECK_CONNECTION(ifx);
-
- EXEC SQL PREPARE :statemid FROM :statement;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Prepare fails (%s)", ifx_error(ifx));
- RETURN_FALSE;
- }
-
- affected_rows = sqlca.sqlerrd[0]; /* save estimated affected rows */
- for (e = 0; e < 6; e++) {
- sqlerrd[e] = sqlca.sqlerrd[e];
- }
- num_params = php_intifx_preparse(statement TSRMLS_CC);
-
- Ifx_Result = (IFX_RES *) emalloc(sizeof(IFX_RES));
- if (Ifx_Result == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Out of memory allocating IFX_RES");
- EXEC SQL free :statemid;
- RETURN_FALSE;
- }
-
- /* initialize result data structure */
-
- Ifx_Result->rowid = 0;
- strcpy(Ifx_Result->connecid, ifx);
- strcpy(Ifx_Result->cursorid, cursorid);
- strcpy(Ifx_Result->descrpid, descrpid);
- strcpy(Ifx_Result->i_descrpid, i_descrpid);
- strcpy(Ifx_Result->statemid, statemid);
- Ifx_Result->numcols = 0;
- Ifx_Result->numicols = 0;
-
- for (i = 0; i < MAX_RESID; ++i) {
- Ifx_Result->res_id[i] = -1;
- }
-
- if (!php_intifx_alloc_ibind(Ifx_Result, num_params TSRMLS_CC)) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate i_desciptor <%s> fails (%s)", i_descrpid, ifx_error(ifx));
- RETURN_FALSE;
- }
-
- desc_count = php_intifx_count_descriptors(statemid TSRMLS_CC);
- if (desc_count == 0) {
- desc_count = 1;
- }
-
- EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX :desc_count;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate desciptor <%s> fails (%s)", descrpid, ifx_error(ifx));
- EXEC SQL free :statemid;
- RETURN_FALSE;
- }
-
- EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Describe fails (%s)", ifx_error(ifx));
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- RETURN_FALSE;
- }
-
- query_type = sqlca.sqlcode;
-
- cursoryproc = 0;
- if (query_type == SQ_EXECPROC) {
- EXEC SQL GET DESCRIPTOR :descrpid :i = COUNT;
- if (i > 0) {
- cursoryproc = 1;
- }
- }
-
- Ifx_Result->iscursory = -1; /* prevent ifx_do */
- Ifx_Result->paramquery=0;
-
- if ((query_type != 0) && (!cursoryproc)) { /* NO RESULT SET */
- /* ##
- ## NONSELECT-STATEMENT
- ##
- */
- zval **pblobidarr, **tmp;
-
- /* We don't need this descriptor anymore, NONSELECT-STATEMENT */
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
-
- Ifx_Result->iscursory = 0;
-
- if (argc > 3) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 3) {
- Ifx_Result->paramquery = 1;
-
- if (Ifx_Result->numicols <= 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No placeholders (?) in Statement, but blob array param supplied");
- RETURN_FALSE;
- }
-
- if (zend_get_parameters_ex(3, &dummy, &dummy, &pblobidarr) == FAILURE) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't get blob array param");
- RETURN_FALSE;
- }
-
- if ((*pblobidarr)->type != IS_ARRAY) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Blob-parameter not an array");
- RETURN_FALSE;
- }
-
- zend_hash_internal_pointer_reset((*pblobidarr)->value.ht);
- for (i = 1; i <= num_params && (zend_hash_get_current_data((*pblobidarr)->value.ht, (void **) &tmp) == SUCCESS); ++i) {
- convert_to_long(*tmp);
-
- ifx_type = php_intifx_getType((int)(*tmp)->value.lval, &EG(regular_list) TSRMLS_CC);
- switch (ifx_type) {
- case TYPE_BLTEXT:
- case TYPE_BLBYTE:
- locator = php_intifx_get_blobloc((int)((*tmp)->value.lval), &EG(regular_list) TSRMLS_CC);
- if (locator == NULL) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix blob-result index", (int)((*tmp)->value.lval));
- RETURN_FALSE;
- }
- if (locator->loc_loctype == LOCFNAME) {
- locator->loc_oflags=LOC_RONLY;
- }
- EXEC SQL SET DESCRIPTOR :i_descrpid VALUE :i DATA = :*locator, TYPE = :loc_t_type;
- break;
- case TYPE_CHAR:
- len = php_intifx_get_char((int)((*tmp)->value.lval), &EG(regular_list), &char_tmp TSRMLS_CC);
-
- indicator = 0;
- if (char_tmp == NULL || len < 0) {
- indicator = -1;
- }
- len++;
-
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i
- DATA= :char_tmp,
- LENGTH= :len,
- INDICATOR= :indicator,
- TYPE= :sqlchar_type;
- break;
- }
-
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Prepare fails : %s", ifx_error(ifx));
- RETURN_FALSE;
- }
-
- zend_hash_move_forward((*pblobidarr)->value.ht);
- }
-
- if (i - 1 != Ifx_Result->numicols) {
- EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Prepare fails : number of created blobs doesn't match placeholders (?)");
- RETURN_FALSE;
- }
-
- }
-
- Ifx_Result->affected_rows = affected_rows; /* saved estimated from prepare */
- for (e = 0; e < 6; e++) {
- Ifx_Result->sqlerrd[e] = sqlerrd[e];
- }
-
- } else {
- /* ##
- ## SELECT-STATEMENT
- ##
- */
- ctype = 0; /* preset */
-
- switch (argc) {
- case 2:
- break;
- case 3:
- if (zend_get_parameters_ex(3, &dummy, &dummy, &cursortype) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(cursortype);
- ctype = Z_LVAL_PP(cursortype);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- Ifx_Result->iscursory = 1;
-
- Ifx_Result->affected_rows = affected_rows; /* saved estimated from prepare */
- for (e = 0; e < 6; e++) {
- Ifx_Result->sqlerrd[e] = sqlerrd[e];
- }
-
- EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not get descriptor %s (%s)", descrpid, ifx_error(ifx));
- RETURN_FALSE;
- }
- Ifx_Result->numcols = fieldcount;
- Ifx_Result->isscroll = Ifx_Result->ishold = 0;
-
- if (ctype & IFX_SCROLL) {
- Ifx_Result->isscroll = 1;
- }
- if (ctype & IFX_HOLD) {
- Ifx_Result->ishold = 1;
- }
- }
-
- ZEND_REGISTER_RESOURCE(return_value, Ifx_Result, le_result);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** int ifx_do(int resultid)
-**
-** executes a previously prepared query or opens a cursor for it
-**
-** returns TRUE on success, false on error
-** does NOT free $resultid on error !!!
-**
-** also sets (real) affected_rows for non-select statements
-** for retrieval by ifx_affected_rows
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_do(int resultid)
- Executes a previously prepared query or opens a cursor for it */
-PHP_FUNCTION(ifx_do)
-{
- zval **result;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char *cursorid; /* query cursor id */
- char *statemid; /* statement id */
- char *descrpid; /* descriptor id */
- char *i_descrpid; /* descriptor id */
- int fieldcount; /* field count */
- int i; /* field index */
- short fieldtype;
- loc_t *locator=NULL;
- int e;
-$ifdef HAVE_IFX_IUS;
- fixed binary 'blob' ifx_lo_t *slocator;
-$endif;
-EXEC SQL END DECLARE SECTION;
-
- int locind;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &result) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
-
- IFXG(sv_sqlcode) = 0;
-
- ifx = Ifx_Result->connecid;
- cursorid = Ifx_Result->cursorid;
- statemid = Ifx_Result->statemid;
- descrpid = Ifx_Result->descrpid;
- i_descrpid = Ifx_Result->i_descrpid;
- fieldcount = Ifx_Result->numcols;
-
- EXEC SQL set connection :ifx;
- PHP_IFX_CHECK_CONNECTION(ifx);
-
- if (Ifx_Result->iscursory < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Resultindex %d is not a prepared query", Z_LVAL_PP(result));
- RETURN_FALSE;
- }
-
- if (Ifx_Result->iscursory == 0) { /* execute immediate */
- if (Ifx_Result->paramquery != 0) {
- EXEC SQL EXECUTE :statemid USING SQL DESCRIPTOR :i_descrpid;
- } else {
- EXEC SQL EXECUTE :statemid;
- }
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails: %s", ifx_error(ifx));
- RETURN_FALSE;
- }
- Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
- for (e = 0; e < 6; e++) {
- Ifx_Result->sqlerrd[e] = sqlca.sqlerrd[e];
- }
- } else { /* open cursor */
- if (Ifx_Result->isscroll) {
- if (Ifx_Result->ishold) {
- EXEC SQL DECLARE :cursorid SCROLL CURSOR WITH HOLD FOR :statemid;
- } else {
- EXEC SQL DECLARE :cursorid SCROLL CURSOR FOR :statemid;
- }
- } else {
- if (Ifx_Result->ishold) {
- EXEC SQL DECLARE :cursorid CURSOR WITH HOLD FOR :statemid;
- } else {
- EXEC SQL DECLARE :cursorid CURSOR FOR :statemid;
- }
- }
-
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Declare cursor fails (%s)", ifx_error(ifx));
- RETURN_FALSE;
- }
-
- EXEC SQL OPEN :cursorid;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Open cursor fails (%s)", ifx_error(ifx));
- RETURN_FALSE;
- }
-
- /* check for text/blob columns */
- locind = 0;
- for (i = 1; i <= fieldcount; ++i) {
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldtype = TYPE;
- if ((fieldtype == SQLTEXT) || (fieldtype == SQLBYTES)
-$ifdef HAVE_IFX_IUS;
- || (fieldtype == SQLUDTFIXED)
-$endif;
- ) {
-
- int bid = 0;
- if (fieldtype == SQLTEXT) {
- if (IFXG(blobinfile) == 0) {
- bid = php_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM, "", -1, &EG(regular_list) TSRMLS_CC);
- locator = php_intifx_get_blobloc(bid, &EG(regular_list) TSRMLS_CC);
- } else {
- bid = php_intifx_create_blob(TYPE_BLTEXT,BLMODE_INFILE, "", -1, &EG(regular_list) TSRMLS_CC);
- locator = php_intifx_get_blobloc(bid, &EG(regular_list) TSRMLS_CC);
- }
-
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
- }
- else if (fieldtype == SQLBYTES) {
- if (IFXG(blobinfile) == 0) {
- bid = php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INMEM, "", -1, &EG(regular_list) TSRMLS_CC);
- locator = php_intifx_get_blobloc(bid, &EG(regular_list) TSRMLS_CC);
- } else {
- bid = php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INFILE, "", -1, &EG(regular_list) TSRMLS_CC);
- locator = php_intifx_get_blobloc(bid, &EG(regular_list) TSRMLS_CC);
- locator->loc_oflags = LOC_WONLY;
- }
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
- }
-
- php_intifx_release_blob(locator TSRMLS_CC);
-$ifdef HAVE_IFX_IUS;
- if (fieldtype == SQLUDTFIXED) {
- bid = php_intifxus_new_slob(&EG(regular_list) TSRMLS_CC);
- slocator = php_intifxus_get_slobloc(bid, &EG(regular_list) TSRMLS_CC);
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*slocator;
- }
-$endif;
- Ifx_Result->res_id[locind] = bid;
- ++locind;
- }
- }
- } /* end open cursor */
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** string ifx_error([int connection_id]);
-**
-** returns the Informix error codes (SQLSTATE & SQLCODE)
-**
-** connection id is not checked, but remains for compatibility
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto string ifx_error([int connection_id])
- Returns the Informix error codes (SQLSTATE & SQLCODE) */
-PHP_FUNCTION(ifx_error)
-{
- zval **ifx_link;
- int id;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = IFXG(default_link);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &ifx_link) == FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- RETURN_STRING(ifx_error(0), 0); /* ifx_error returns emalloced string */
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** string ifx_errormsg([int errorcode])
-**
-** returns the Informix errormessage associated with
-** the most recent Informix error if SQLCODE is nonzero, or,
-** when the optional "errocode" param is present, the errormessage
-** corresponding to "errorcode".
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto string ifx_errormsg([int errorcode])
- Returns the Informix errormessage associated with */
-PHP_FUNCTION(ifx_errormsg)
-{
- zval **errcode;
- int ifx_errorcode;
- int msglen, maxmsglen;
- char *ifx_errmsg;
- char * returnmsg;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- if (IFXG(sv_sqlcode) == 0) {
- ifx_errorcode = SQLCODE;
- } else {
- ifx_errorcode = IFXG(sv_sqlcode);
- }
- break;
- case 1:
- if (zend_get_parameters_ex(1, &errcode) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(errcode);
- ifx_errorcode = Z_LVAL_PP(errcode);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- maxmsglen = 255;
- msglen = maxmsglen; /* Some bug fix, rgetlmsg doesnt always set the value */
- ifx_errmsg = (char *)emalloc(maxmsglen + 1);
- if (ifx_errorcode != 0) {
- rgetlmsg(ifx_errorcode, ifx_errmsg, maxmsglen, &msglen);
- if (msglen > maxmsglen) {
- maxmsglen = msglen;
- ifx_errmsg = (char *)erealloc(ifx_errmsg, maxmsglen + 1);
- rgetlmsg(ifx_errorcode, ifx_errmsg, maxmsglen, &msglen);
- }
- } else {
- ifx_errmsg[0] = 0;
- }
-
- returnmsg = (char *) emalloc(strlen(ifx_errmsg) + 128);
- sprintf(returnmsg, ifx_errmsg, sqlca.sqlerrm);
- efree(ifx_errmsg);
- RETURN_STRING(returnmsg,0);
-}
-/* }}} */
-
-/* --------------------------------------------------------------
-** int ifx_affected_rows(int resultid)
-**
-** returns the number of rows affected by query $resultid
-**
-** for selects : estimated number of rows (sqlerrd[0])
-** for insert/update/delete : real number (sqlerrd[2])
-** ---------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_affected_rows(int resultid)
- Returns the number of rows affected by query identified by resultid */
-PHP_FUNCTION(ifx_affected_rows)
-{
- zval **result;
- IFX_RES *Ifx_Result;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &result)) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- IFXG(sv_sqlcode) = 0;
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
- RETURN_LONG(Ifx_Result->affected_rows);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** array ifx_fetch_row(int resultid [, mixed $position])
-**
-** fetches the next row, or if using a scroll cursor, and position
-** is present, the row as given in position, into an associative
-** array with the fieldnames as key
-**
-** returns FALSE on error
-**
-** position can be : "FIRST", "NEXT", "LAST", "PREVIOUS", "CURRENT"
-** or an absolute row number
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto array ifx_fetch_row(int resultid [, mixed position])
- Fetches the next row or <position> row if using a scroll cursor */
-PHP_FUNCTION(ifx_fetch_row)
-{
- zval **result, **position;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char *cursorid; /* query cursor id */
- char *statemid; /* statement id */
- char *descrpid; /* descriptor id */
- int fieldcount; /* field count */
- int i; /* an index */
- char fieldname[64]; /* fieldname */
- short fieldtype; /* field type */
- int fieldleng; /* field length */
-$ifdef HAVE_IFX_IUS;
- ifx_int8_t int8_var;
- lvarchar *lvar_tmp;
-$endif;
- short indicator;
- int int_data;
- char *char_data;
- long date_data;
- interval intvl_data = {0};
- datetime dt_data = {0};
- decimal dec_data = {0};
- short short_data;
- loc_t *locator_b;
-$ifdef HAVE_IFX_IUS;
- fixed binary 'blob' ifx_lo_t *slocator;
-$endif;
- float float_data;
- double double_data;
- int fetch_row;
-EXEC SQL END DECLARE SECTION;
-
- int num_fields;
- int locind,bid,bid_b;
- char string_data[256];
- long long_data;
- char *p;
- char *fetch_pos;
- char *nullstr;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &result) == FAILURE) {
- RETURN_FALSE;
- }
- fetch_pos = NULL;
- fetch_row = 0;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &result, &position) == FAILURE) {
- RETURN_FALSE;
- }
- if (Z_TYPE_PP(position) != IS_STRING) {
- fetch_pos = NULL;
- fetch_row = Z_LVAL_PP(position);
- } else {
- fetch_pos = Z_STRVAL_PP(position);
- fetch_row = 0;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
-
- nullstr = php_intifx_null(TSRMLS_C);
- IFXG(sv_sqlcode) = 0;
-
- if (strcmp(Ifx_Result->cursorid, "") == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a select cursor!");
- RETURN_FALSE;
- }
-
- ifx = Ifx_Result->connecid;
- cursorid = Ifx_Result->cursorid;
- statemid = Ifx_Result->statemid;
- descrpid = Ifx_Result->descrpid;
- fieldcount = Ifx_Result->numcols;
-
- EXEC SQL set connection :ifx;
- PHP_IFX_CHECK_CONNECTION(ifx);
-
- locind = 0;
- for (i = 1; i <= Ifx_Result->numcols; i++) {
-
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldtype = TYPE;
- if (fieldtype == SQLBYTES || fieldtype == SQLTEXT) {
-
- bid_b = Ifx_Result->res_id[locind];
-
- if ((locator_b = php_intifx_get_blobloc(bid_b, &EG(regular_list) TSRMLS_CC)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cant get BLOB from Result Set!");
- RETURN_FALSE;
- }
-
- locind++;
-
- if (IFXG(blobinfile) == 0) {
- php_intifx_init_blob(locator_b, BLMODE_INMEM, 1 TSRMLS_CC);
- } else {
- php_intifx_init_blob(locator_b, BLMODE_INFILE, 1 TSRMLS_CC);
- }
-
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator_b;
-
- }
- }
-
- if (!Ifx_Result->isscroll) {
- EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid;
- } else {
- if (fetch_pos == NULL) {
- if (fetch_row != 0) {
- EXEC SQL FETCH ABSOLUTE :fetch_row :cursorid USING SQL DESCRIPTOR :descrpid;
- } else {
- EXEC SQL FETCH NEXT :cursorid USING SQL DESCRIPTOR :descrpid;
- }
- } else {
- if (!strcasecmp(fetch_pos, "NEXT")) {
- EXEC SQL FETCH NEXT :cursorid USING SQL DESCRIPTOR :descrpid;
- } else if (!strcasecmp(fetch_pos, "PREVIOUS")) {
- EXEC SQL FETCH PREVIOUS :cursorid USING SQL DESCRIPTOR :descrpid;
- } else if (!strcasecmp(fetch_pos, "FIRST")) {
- EXEC SQL FETCH FIRST :cursorid USING SQL DESCRIPTOR :descrpid;
- } else if (!strcasecmp(fetch_pos, "LAST")) {
- EXEC SQL FETCH LAST :cursorid USING SQL DESCRIPTOR :descrpid;
- } else if (!strcasecmp(fetch_pos, "CURRENT")) {
- EXEC SQL FETCH CURRENT :cursorid USING SQL DESCRIPTOR :descrpid;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid positioning arg on fetch");
- }
- }
- }
-
- if (SQLCODE != -451) {
- switch (ifx_check()) {
- case IFX_ERROR:
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch row on cursor %s (%s)", ifx_error(ifx), cursorid);
- RETURN_FALSE;
- break;
- case IFX_NODATA:
- RETURN_FALSE;
- break;
- default:
- break;
- }
- }
- Ifx_Result->rowid++;
-
- array_init(return_value);
- num_fields = fieldcount;
-
- locind = 0;
- for (i = 1; i <= num_fields; i++) {
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i
- :fieldtype = TYPE,
- :fieldname = NAME,
- :fieldleng = LENGTH,
- :indicator = INDICATOR;
-
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
- RETURN_FALSE;
- }
-
- p = fieldname; /* rtrim fieldname */
- while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p;
- *p = 0;
- if (strcmp("(expression)", fieldname) == 0) { /* stored proc */
- sprintf(fieldname, "[Expr_%d]", i);
- }
-
- if (indicator == -1) { /* NULL */
- if ((IFXG(textasvarchar) == 0 && fieldtype == SQLTEXT) ||
- (IFXG(byteasvarchar) == 0 && fieldtype == SQLBYTES)) {
- bid_b = Ifx_Result->res_id[locind];
- /* call php_intifx_get_blobloc() to reset locator_b */
- locator_b = php_intifx_get_blobloc(bid_b, &EG(regular_list) TSRMLS_CC);
- bid = php_intifx_copy_blob(bid_b, &EG(regular_list) TSRMLS_CC);
- php_intifx_update_blob(bid,nullstr, strlen(nullstr), &EG(regular_list) TSRMLS_CC);
- add_assoc_long(return_value, fieldname, bid);
- ++locind;
- php_intifx_release_blob(locator_b TSRMLS_CC);
- continue;
- }
- if ((fieldtype == SQLTEXT) || (fieldtype == SQLBYTES)
-$ifdef HAVE_IFX_IUS;
- || (fieldtype == SQLUDTFIXED)
-$endif;
- ) {
- /* call php_intifx_get_blobloc() to reset locator_b */
- bid_b = Ifx_Result->res_id[locind];
- locator_b = php_intifx_get_blobloc(bid_b, &EG(regular_list) TSRMLS_CC);
- ++locind;
- php_intifx_release_blob(locator_b TSRMLS_CC);
- }
- add_assoc_string(return_value, fieldname, nullstr, DUP);
- continue;
- } /* NULL */
-
- switch (fieldtype) {
- case SQLSERIAL:
- case SQLINT:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :int_data = DATA;
- long_data = int_data;
- sprintf(string_data, "%ld", long_data);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLSMINT:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :short_data = DATA;
- long_data = short_data;
- sprintf(string_data, "%ld", long_data);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLDECIMAL:
- case SQLMONEY:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :dec_data = DATA;
- memset(string_data, 0x20, 64);
- dectoasc(&dec_data, string_data, 63, -1);
- for (p = string_data; *p != ' '; ++p) ;
- *p = 0;
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLSMFLOAT:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :float_data = DATA;
- double_data = float_data;
- sprintf(string_data, "%17.17g", double_data);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLFLOAT:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :double_data = DATA;
- sprintf(string_data, "%17.17g", double_data);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLDATE:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :date_data = DATA;
- rdatestr(date_data, string_data);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLDTIME:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :dt_data = DATA;
- dttoasc(&dt_data, string_data);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLINTERVAL:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :intvl_data = DATA;
- intoasc(&intvl_data, string_data);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
-$ifdef HAVE_IFX_IUS;
- case SQLSERIAL8:
- case SQLINT8:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :int8_var = DATA;
- memset(string_data, ' ', sizeof(string_data));
- ifx_int8toasc(&int8_var, string_data, 200);
- p = string_data; /* rtrim string_data */
- while ((*p != ' ') && (p < &string_data[sizeof(string_data) - 1])) ++p;
- *p = 0;
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLLVARCHAR:
- ifx_var_flag(&lvar_tmp, 1);
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :lvar_tmp = DATA;
- fieldleng = ifx_var_getlen(&lvar_tmp);
- if (fieldleng > 2) { /* fix by Alex Shepherd */
- fieldleng -= 2;
- }
- if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
- memcpy(char_data, ifx_var_getdata(&lvar_tmp), fieldleng);
- ifx_var_dealloc(&lvar_tmp);
- add_assoc_stringl(return_value, fieldname, char_data, fieldleng, 0);
- break;
- case SQLBOOL:
-$endif;
- case SQLVCHAR:
- case SQLNVCHAR:
- case SQLCHAR:
- case SQLNCHAR:
- if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :char_data = DATA;
- if (IFXG(charasvarchar) != 0 && (fieldtype == SQLCHAR || fieldtype == SQLNCHAR)) {
- ldchar(char_data, fieldleng, char_data);
- }
- add_assoc_string(return_value, fieldname, char_data, DUP);
- efree(char_data);
- char_data = NULL;
- break;
-$ifdef HAVE_IFX_IUS;
- case SQLUDTFIXED:
- bid_b = Ifx_Result->res_id[locind];
- add_assoc_long(return_value, fieldname,bid_b);
- bid = php_intifxus_new_slob(&EG(regular_list) TSRMLS_CC);
- slocator = php_intifxus_get_slobloc(bid, &EG(regular_list) TSRMLS_CC);
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*slocator;
- Ifx_Result->res_id[locind] = bid;
- ++locind;
- break;
-$endif;
- case SQLBYTES:
- case SQLTEXT:
- bid_b = Ifx_Result->res_id[locind];
- locator_b = php_intifx_get_blobloc(bid_b, &EG(regular_list) TSRMLS_CC);
- ++locind;
-
- if (IFXG(blobinfile) == 0) {
- php_intifx_init_blob(locator_b, BLMODE_INMEM, 0 TSRMLS_CC);
- } else {
- php_intifx_init_blob(locator_b, BLMODE_INFILE, 0 TSRMLS_CC);
- }
-
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :*locator_b = DATA;
-
- /* work around for ESQL/C bug with NULL values and BLOBS */
- if ((locator_b->loc_status < 0) && (locator_b->loc_bufsize == 0)){
- locator_b->loc_indicator = -1;
- }
-
- /* normal check for NULL values */
- if (locator_b->loc_indicator == -1) {
- if ((IFXG(textasvarchar) == 0 && fieldtype == SQLTEXT) ||
- (IFXG(byteasvarchar) == 0 && fieldtype == SQLBYTES)
- ) {
- bid = php_intifx_copy_blob(bid_b, &EG(regular_list) TSRMLS_CC);
- php_intifx_update_blob(bid,nullstr, strlen(nullstr), &EG(regular_list) TSRMLS_CC);
- add_assoc_long(return_value, fieldname, bid);
- php_intifx_release_blob(locator_b TSRMLS_CC);
- break;
- }
- if ((fieldtype == SQLTEXT) || (fieldtype == SQLBYTES)
-$ifdef HAVE_IFX_IUS;
- || (fieldtype == SQLUDTFIXED)
-$endif;
- ) {
- add_assoc_string(return_value, fieldname, nullstr, DUP);
- php_intifx_release_blob(locator_b TSRMLS_CC);
- break;
- }
- }
-
- if (locator_b->loc_status < 0) { /* blob too large */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No memory (%d bytes) for blob", locator_b->loc_bufsize);
- RETURN_FALSE;
- }
-
- /* return blob as VARCHAR ? */
- /* note that in case of "blobinfile" */
- /* you get the file name */
- /* a new one for every row ! */
- if ((IFXG(textasvarchar) != 0 && fieldtype == SQLTEXT) ||
- (IFXG(byteasvarchar) != 0 && fieldtype == SQLBYTES)
- ) {
- char *content;
- long lg;
-
- lg = php_intifx_get_blob(bid_b, &EG(regular_list), &content TSRMLS_CC);
- if (content == NULL || lg < 0) {
- add_assoc_string(return_value, fieldname, nullstr, DUP);
- } else {
- add_assoc_stringl(return_value, fieldname, content, lg, DUP);
- }
-
- php_intifx_release_blob(locator_b TSRMLS_CC);
- break;
- }
-
- /* copy blob */
- bid = php_intifx_copy_blob(bid_b, &EG(regular_list) TSRMLS_CC);
-
- /* no, return as blob id */
- add_assoc_long(return_value, fieldname, bid);
- php_intifx_release_blob(locator_b TSRMLS_CC);
- break;
-
- default:
- sprintf(string_data, "ESQL/C : %s : unsupported field type[%d]", fieldname, fieldleng);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- }
- continue;
- }
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** int ifx_htmltbl_result(int resultid [, string htmltableoptions])
-**
-** formats all rows of the resultid query into a html table
-** the optional second argument is a string of <table> tag options
-**
-** returns the number of rows printed or FALSE on error
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_htmltbl_result(int resultid [, string htmltableoptions])
- Formats all rows of the resultid query into a html table */
-PHP_FUNCTION(ifx_htmltbl_result)
-{
- zval **result, **arg2;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char *cursorid; /* query cursor id */
- char *statemid; /* statement id */
- char *descrpid; /* descriptor id */
- int fieldcount; /* field count */
- int i; /* an index */
- char fieldname[64]; /* fieldname */
- short fieldtype; /* field type */
- int fieldleng; /* field length */
-$ifdef HAVE_IFX_IUS;
- ifx_int8_t int8_var;
- lvarchar *lvar_tmp;
-$endif;
- short indicator;
- int int_data;
- char *char_data = NULL;
- long date_data;
- interval intvl_data = {0};
- datetime dt_data = {0};
- decimal dec_data = {0};
- short short_data;
- float float_data;
- double double_data;
- loc_t *locator_b;
-EXEC SQL END DECLARE SECTION;
-
- char *content;
- char *copy_content;
- long lg;
- char *nullstr;
- int num_fields;
- char string_data[256];
- long long_data;
- char *p;
- int locind,bid_b;
- char *table_options;
- int moredata;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &result) == FAILURE) {
- RETURN_FALSE;
- }
- table_options = NULL;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &result, &arg2) == FAILURE) {
- RETURN_FALSE;
- }
- table_options = (*arg2)->value.str.val;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
-
- if (strcmp(Ifx_Result->cursorid, "") == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a select cursor!");
- RETURN_FALSE;
- }
-
- ifx = Ifx_Result->connecid;
- cursorid = Ifx_Result->cursorid;
- statemid = Ifx_Result->statemid;
- descrpid = Ifx_Result->descrpid;
- fieldcount = Ifx_Result->numcols;
-
- EXEC SQL set connection :ifx;
- PHP_IFX_CHECK_CONNECTION(ifx);
-
- /* try to fetch the first row */
- EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid;
- switch (ifx_check()) {
- case IFX_ERROR:
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_error(ifx), cursorid);
- RETURN_FALSE;
- break;
- case IFX_NODATA:
- moredata = 0;
- break;
- default:
- Ifx_Result->rowid = moredata = 1;
- break;
- }
-
- if (!moredata) {
- php_printf("<h2>No rows found</h2>\n");
- RETURN_LONG(0);
- }
- num_fields = fieldcount;
- nullstr = php_intifx_null(TSRMLS_C);
-
- /* start table tag */
- if (table_options == NULL) {
- php_printf("<table><tr>");
- } else {
- php_printf("<table %s><tr>", table_options);
- }
-
- /* table headings */
- for (i = 1; i <= num_fields; i++) {
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
- RETURN_FALSE;
- }
-
- p = fieldname; /* Capitalize and rtrim fieldname */
- *p = toupper(*p);
- while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p;
- *p = 0;
- if (strcmp("(expression)", fieldname) == 0) { /* stored proc */
- sprintf(fieldname, "[Expr_%d]", i);
- }
- php_printf("<th>%s</th>", fieldname);
- }
- php_printf("</tr>\n");
-
- /* start spitting out rows untill none left */
- while (moredata) {
- php_printf("<tr>");
- locind = 0;
- for (i = 1; i <= num_fields; i++) {
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i
- :fieldtype = TYPE,
- :fieldleng = LENGTH,
- :indicator = INDICATOR;
-
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
- RETURN_FALSE;
- }
-
- if (indicator == -1) { /* NULL */
- if (fieldtype == SQLTEXT || fieldtype == SQLBYTES) {
- ++locind;
- }
- php_printf("<td>%s</td>", nullstr);
- continue;
- }
-
- switch (fieldtype) {
- case SQLSERIAL:
- case SQLINT:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :int_data = DATA;
- long_data = int_data;
- sprintf(string_data, "%ld", long_data);
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLSMINT:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :short_data = DATA;
- long_data = short_data;
- sprintf(string_data, "%ld", long_data);
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLDECIMAL:
- case SQLMONEY:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :dec_data = DATA;
- memset(string_data, 0x20, 64);
- dectoasc(&dec_data, string_data, 63, -1);
- for (p = string_data; *p != ' '; ++p) ;
- *p = 0;
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLSMFLOAT:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :float_data = DATA;
- double_data = float_data;
- sprintf(string_data, "%17.17g", double_data);
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLFLOAT:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :double_data = DATA;
- sprintf(string_data, "%17.17g", double_data);
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLDATE:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :date_data = DATA;
- rdatestr(date_data, string_data);
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLDTIME:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :dt_data = DATA;
- dttoasc(&dt_data, string_data);
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLINTERVAL:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :intvl_data = DATA;
- intoasc(&intvl_data, string_data);
- php_printf("<td>%s</td>", string_data);
- break;
-$ifdef HAVE_IFX_IUS;
- case SQLSERIAL8:
- case SQLINT8:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :int8_var = DATA;
- memset(string_data, ' ', sizeof(string_data));
- ifx_int8toasc(&int8_var, string_data, 200);
- p = string_data; /* rtrim string_data */
- while ((*p != ' ') && (p < &string_data[sizeof(string_data) - 1])) ++p;
- *p = 0;
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLLVARCHAR:
- ifx_var_flag(&lvar_tmp, 1);
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :lvar_tmp = DATA;
- fieldleng = ifx_var_getlen(&lvar_tmp);
- if (fieldleng > 2) { /* fix by Alex Shepherd */
- fieldleng -= 2;
- }
- if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
- memcpy(char_data, ifx_var_getdata(&lvar_tmp), fieldleng);
- ifx_var_dealloc(&lvar_tmp);
- add_assoc_stringl(return_value, fieldname, char_data, fieldleng, 0);
- break;
- case SQLBOOL:
-$endif;
- case SQLCHAR:
- case SQLVCHAR:
- case SQLNCHAR:
- case SQLNVCHAR:
- if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :char_data = DATA;
- if (IFXG(charasvarchar) != 0 && (fieldtype == SQLCHAR || fieldtype == SQLNCHAR)) {
- ldchar(char_data, fieldleng, char_data);
- }
- php_printf("<td>%s</td>", char_data);
- efree(char_data);
- char_data = NULL;
- break;
- case SQLTEXT :
- /* treated always as a long VARCHAR here */
- /* if blobinbfile, too bad */
- bid_b = Ifx_Result->res_id[locind];
- ++locind;
- locator_b = php_intifx_get_blobloc(bid_b, &EG(regular_list) TSRMLS_CC);
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :*locator_b = DATA;
-
- /* work around for ESQL/C bug with NULL values and BLOBS */
- if ((locator_b->loc_status < 0) && (locator_b->loc_bufsize == 0)){
- locator_b->loc_indicator = -1;
- }
-
- /* normal check for NULL values */
- if (locator_b->loc_indicator == -1) {
- if ((fieldtype == SQLTEXT) || (fieldtype == SQLBYTES)
-$ifdef HAVE_IFX_IUS;
- || (fieldtype == SQLUDTFIXED)
-$endif;
- ) {
- php_printf("<td>%s</td>", nullstr);
- break;
- }
- }
- if (locator_b->loc_status < 0) { /* blob too large */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not enough memory (%d bytes) for blob", locator_b->loc_bufsize);
- RETURN_FALSE;
- }
-
- /* get blob contents */
- lg = php_intifx_get_blob(bid_b, &EG(regular_list), &content TSRMLS_CC);
-
- if (content == NULL || lg < 0) {
- php_printf("<td>%s</td>", nullstr);
- } else {
- /* need an extra byte for string terminator */
- copy_content = emalloc(lg + 1);
- if (copy_content == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not enough memory for TEXT column");
- RETURN_FALSE;
- }
- memcpy(copy_content, content, lg);
- copy_content[lg] = 0;
- php_printf("<td>%s</td>", copy_content);
- efree(copy_content);
- }
- break;
-
- case SQLBYTES :
- ++locind;
- php_printf("<td>(BYTE)</td>");
- break;
- default :
- sprintf(string_data, "ESQL/C: %s : unsupported field type[%d]", fieldname, fieldleng);
- php_printf("<td>%s</td>", string_data);
- break;
- }
- continue;
- }
- php_printf("</tr>\n");
-
- /* fetch next row */
- EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid;
- switch (ifx_check()) {
- case IFX_ERROR:
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_error(ifx), cursorid);
- RETURN_FALSE;
- break;
- case IFX_NODATA:
- moredata = 0;
- break;
- default:
- break;
- } /* switch() */
- Ifx_Result->rowid++;
- } /* endwhile (moredata); */
- php_printf("</table>\n");
- RETURN_LONG(Ifx_Result->rowid);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** array ifx_fieldtypes(int resultid)
-**
-** returns an associative array with fieldnames as key
-** and SQL fieldtypes as data for query $resultid
-**
-** returns FALSE on error
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto array ifx_fieldtypes(int resultid)
- Returns an associative array with fieldnames as key for query <resultid> */
-PHP_FUNCTION(ifx_fieldtypes)
-{
- zval **result;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char *cursorid; /* query cursor id */
- char *statemid; /* statement id */
- char *descrpid; /* descriptor id */
- int fieldcount; /* field count */
- int i; /* an index */
- char fieldname[64]; /* fieldname */
- short fieldtype; /* field type */
- char *char_data = NULL;
-EXEC SQL END DECLARE SECTION;
- int num_fields;
- char *p;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
-
- if (strcmp(Ifx_Result->cursorid, "") == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a select cursor!");
- RETURN_FALSE;
- }
-
- ifx = Ifx_Result->connecid;
- cursorid = Ifx_Result->cursorid;
- statemid = Ifx_Result->statemid;
- descrpid = Ifx_Result->descrpid;
- fieldcount = Ifx_Result->numcols;
-
- EXEC SQL set connection :ifx;
- PHP_IFX_CHECK_CONNECTION(ifx);
-
- array_init(return_value);
- num_fields = fieldcount;
- for (i = 1; i <= num_fields; i++) {
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME, :fieldtype = TYPE;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
- RETURN_FALSE;
- }
-
- p = fieldname; /* rtrim fieldname */
- while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p;
- *p = 0;
- if (strcmp("(expression)", fieldname) == 0) { /* stored proc */
- sprintf(fieldname, "[Expr_%d]", i);
- }
-
- switch (fieldtype) {
- case SQLSERIAL:
- char_data = "SQLSERIAL";
- break;
- case SQLINT:
- char_data = "SQLINT";
- break;
- case SQLSMINT:
- char_data = "SQLSMINT";
- break;
- case SQLDECIMAL:
- char_data = "SQLDECIMAL";
- break;
- case SQLMONEY:
- char_data = "SQLMONEY";
- break;
- case SQLSMFLOAT:
- char_data = "SQLSMFLOAT";
- break;
- case SQLFLOAT:
- char_data = "SQLFLOAT";
- break;
- case SQLDATE:
- char_data = "SQLDATE";
- break;
- case SQLDTIME:
- char_data = "SQLDTIME";
- break;
- case SQLINTERVAL:
- char_data = "SQLINTERVAL";
- break;
- case SQLCHAR:
- char_data = "SQLCHAR";
- break;
- case SQLVCHAR:
- char_data = "SQLVCHAR";
- break;
- case SQLNCHAR:
- char_data = "SQLNCHAR";
- break;
- case SQLNVCHAR:
- char_data = "SQLNVCHAR";
- break;
- case SQLTEXT:
- char_data = "SQLTEXT";
- break;
- case SQLBYTES:
- char_data = "SQLBYTES";
- break;
-$ifdef HAVE_IFX_IUS;
- case SQLUDTFIXED:
- char_data = "SQLUDTFIXED";
- break;
- case SQLBOOL:
- char_data = "SQLBOOL";
- break;
- case SQLINT8:
- char_data = "SQLINT8";
- break;
- case SQLSERIAL8:
- char_data = "SQLSERIAL8";
- break;
- case SQLLVARCHAR:
- char_data = "SQLLVARCHAR";
- break;
-$endif;
- default:
- char_data = emalloc(20);
- sprintf(char_data, "ESQL/C : %i", fieldtype);
- break;
- } /* switch (fieldtype) */
-
- add_assoc_string(return_value, fieldname, char_data, DUP);
- } /* for() */
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** array ifx_fieldproperties(int resultid)
-**
-** returns an associative array with fieldnames as key
-** and SQL fieldproperties as data for query $resultid
-**
-** properties are encoded as : "SQLTYPE;length;precision;scale;ISNULLABLE"
-** where SQLTYPE = the Informix type like "SQLVCHAR" etc...
-** ISNULLABLE = "Y" or "N"
-**
-** returns FALSE on error
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto array ifx_fieldproperties(int resultid)
- Returns an associative for query <resultid> array with fieldnames as key */
-PHP_FUNCTION(ifx_fieldproperties)
-{
- zval **result;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char *cursorid; /* query cursor id */
- char *statemid; /* statement id */
- char *descrpid; /* descriptor id */
- int fieldcount; /* field count */
- int i; /* an index */
- char fieldname[64]; /* fieldname */
- short fieldtype; /* field type */
- char *char_data = NULL;
- int size;
- int precision;
- int scale;
- int isnullable;
-EXEC SQL END DECLARE SECTION;
- int num_fields;
- char string_data[256];
- char *p;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
-
- if (strcmp(Ifx_Result->cursorid, "") == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a select cursor!");
- RETURN_FALSE;
- }
-
- ifx = Ifx_Result->connecid;
- cursorid = Ifx_Result->cursorid;
- statemid = Ifx_Result->statemid;
- descrpid = Ifx_Result->descrpid;
- fieldcount = Ifx_Result->numcols;
-
- EXEC SQL set connection :ifx;
- PHP_IFX_CHECK_CONNECTION(ifx);
-
- array_init(return_value);
- num_fields = fieldcount;
-
- for (i = 1; i <= num_fields; i++) {
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME,
- :fieldtype = TYPE,
- :size = LENGTH,
- :precision = PRECISION,
- :scale = SCALE,
- :isnullable = NULLABLE;
-
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
- RETURN_FALSE;
- }
-
- p = fieldname; /* rtrim fieldname */
- while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p;
- *p = 0;
- if (strcmp("(expression)", fieldname) == 0) { /* stored proc */
- sprintf(fieldname, "[Expr_%d]", i);
- }
-
- switch (fieldtype) {
- case SQLSERIAL:
- char_data = "SQLSERIAL";
- break;
- case SQLINT:
- char_data = "SQLINT";
- break;
- case SQLSMINT:
- char_data = "SQLSMINT";
- break;
- case SQLDECIMAL:
- char_data = "SQLDECIMAL";
- break;
- case SQLMONEY:
- char_data = "SQLMONEY";
- break;
- case SQLSMFLOAT:
- char_data = "SQLSMFLOAT";
- break;
- case SQLFLOAT:
- char_data = "SQLFLOAT";
- break;
- case SQLDATE:
- char_data = "SQLDATE";
- break;
- case SQLDTIME:
- char_data = "SQLDTIME";
- break;
- case SQLINTERVAL:
- char_data = "SQLINTERVAL";
- break;
- case SQLCHAR:
- char_data = "SQLCHAR";
- break;
- case SQLVCHAR:
- char_data = "SQLVCHAR";
- break;
- case SQLTEXT:
- char_data = "SQLTEXT";
- break;
- case SQLBYTES:
- char_data = "SQLBYTES";
- break;
- case SQLNCHAR:
- char_data = "SQLNCHAR";
- break;
- case SQLNVCHAR:
- char_data = "SQLNVCHAR";
- break;
-$ifdef HAVE_IFX_IUS;
- case SQLUDTFIXED:
- char_data = "SQLUDTFIXED";
- break;
- case SQLBOOL:
- char_data = "SQLBOOL";
- break;
- case SQLINT8:
- char_data = "SQLINT8";
- break;
- case SQLSERIAL8:
- char_data = "SQLSERIAL8";
- break;
- case SQLLVARCHAR:
- char_data = "SQLLVARCHAR";
- break;
-$endif;
- default:
- char_data = emalloc(20);
- sprintf(char_data, "ESQL/C : %i", fieldtype);
- break;
- } /* switch (fieldtype) */
-
- sprintf(string_data, "%s;%d;%d;%d;%c", char_data, size, precision, scale, (isnullable ? 'Y' : 'N'));
- add_assoc_string(return_value, fieldname, string_data, DUP);
- } /* for() */
-}
-/* }}} */
-
-/* --------------------------------------------------------------
-** int ifx_num_rows(int resultid)
-**
-** returns the number of rows already fetched for query resultid
-**
-** ---------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_num_rows(int resultid)
- Returns the number of rows already fetched for query identified by resultid */
-PHP_FUNCTION(ifx_num_rows)
-{
- zval **result;
- IFX_RES *Ifx_Result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
-
- RETURN_LONG(Ifx_Result->rowid);
-}
-/* }}} */
-
-/* --------------------------------------------------------------
-** int ifx_getsqlca(int resultid)
-**
-** returns the sqlerrd[] fields of the sqlca struct for query resultid
-** following the prepare (select) or execute immediate (insert/update/execute procedure)
-**
-** ---------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_getsqlca(int resultid)
- Returns the sqlerrd[] fields of the sqlca struct for query resultid */
-PHP_FUNCTION(ifx_getsqlca)
-{
- zval **result;
- IFX_RES *Ifx_Result;
- char fieldname[16];
- int e;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
-
- /* create pseudo-row array to return */
- array_init(return_value);
-
- /* fill array with 6 fields sqlerrd0 .. sqlerrd5 */
- /* each ESQLC call saves these sqlca values */
- for (e = 0; e < 6; e++) {
- sprintf(fieldname, "sqlerrd%d", e);
- add_assoc_long(return_value, fieldname, Ifx_Result->sqlerrd[e]);
- }
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** int ifx_num_fields(int resultid)
-**
-** returns the number of columns in query resultid
-** or FALSE on error
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_num_fields(int resultid)
- Returns the number of columns in query resultid */
-PHP_FUNCTION(ifx_num_fields)
-{
- zval **result;
- IFX_RES *Ifx_Result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
-
- RETURN_LONG(Ifx_Result->numcols);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** int ifx_free_result(int resultid)
-**
-** releases resources for query associated with resultid
-**
-** returns FALSE on error
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_free_result(int resultid)
- Releases resources for query associated with resultid */
-PHP_FUNCTION(ifx_free_result)
-{
- zval **result;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char *cursorid; /* query cursor id */
- char *statemid; /* statement id */
- char *descrpid; /* descriptor id */
-EXEC SQL END DECLARE SECTION;
-
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- IFXG(sv_sqlcode = 0);
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
-
- for (i = 0; i < MAX_RESID; ++i) {
- if (Ifx_Result->res_id[i] > 0) {
- zend_list_delete(Ifx_Result->res_id[i]);
- Ifx_Result->res_id[i] = -1;
- }
- }
-
- ifx = Ifx_Result->connecid;
- cursorid = Ifx_Result->cursorid;
- statemid = Ifx_Result->statemid;
- descrpid = Ifx_Result->descrpid;
-
- EXEC SQL set connection :ifx;
- PHP_IFX_CHECK_CONNECTION(ifx);
-
- EXEC SQL free :statemid;
- if (strlen(cursorid) != 0) {
- EXEC SQL CLOSE :cursorid;
- EXEC SQL FREE :cursorid;
- }
-
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
-
- zend_list_delete(Z_RESVAL_PP(result));
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php_intifx_getType(long id, HashTable *list)
- *
- * returns the type of an id-object
- * bid: Id of object
- * list: internal hashlist of php
- *
- * return -1 on error otherwise the type: TYPE_BLTEXT, TYPE_BLBYTE, TYPE_SLOB
- * ----------------------------------------------------------------------
-*/
-static long php_intifx_getType(long id, HashTable *list TSRMLS_DC)
-{
- IFX_IDRES *Ifx_res;
- int type;
-
- Ifx_res = (IFX_IDRES *) zend_list_find(id, &type);
- if (type != le_idresult) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix id-result index", id);
- return -1;
- }
- return Ifx_res->type;
-}
-
-/* ----------------------------------------------------------------------
-** int ifx_create_blob(int type, int mode, string param)
-**
-** creates a blob-object
-** type: 1=TEXT, 0=BYTE
-** mode: blob-object holds 0=the content in memory, 1=content in file
-** param: if mode=0: pointer to the content
-** mode=1: pointer to the filestring
-** return false on error otherwise the new Blob-Object-id
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_create_blob(int type, int mode, string param)
- Creates a blob-object */
-PHP_FUNCTION(ifx_create_blob)
-{
- zval **pmode, **pparam,**ptype;
- long id;
- long mode,type;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &ptype, &pmode, &pparam) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(pmode);
- convert_to_string_ex(pparam);
- convert_to_long_ex(ptype);
-
- type = Z_LVAL_PP(ptype);
- if (type != 0) {
- type = TYPE_BLTEXT;
- }
-
- mode = Z_LVAL_PP(pmode);
- if (mode != 0) {
- mode=BLMODE_INFILE;
- }
-
- id = php_intifx_create_blob(type, mode, Z_STRVAL_PP(pparam), Z_STRLEN_PP(pparam), &EG(regular_list) TSRMLS_CC);
-
- if (id < 0) {
- RETURN_FALSE;
- }
- RETURN_LONG(id);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list TSRMLS_DC)
- *
- * creates an blob-object for the PHP Resource list
- * type: 1=TEXT, 0=BYTE
- * mode: blob-object holds 0=the content in momory, 1=content in file
- * param: if mode=0: pointer to the content
- * mode=1: pointer to the filestring
- * len: length of param
- * list: internal hashlist of php
- * return -1 on error otherwise the new Blob-Object-id
- * ----------------------------------------------------------------------
-*/
-static long php_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list TSRMLS_DC)
-{
- IFX_IDRES *Ifx_blob;
-
- Ifx_blob=emalloc(sizeof(IFX_IDRES));
- if (Ifx_blob == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create blob-resource");
- return -1;
- }
-
- memset(Ifx_blob, 0, sizeof(IFX_IDRES));
-
- if (type == 0 ) {
- Ifx_blob->type = TYPE_BLBYTE;
- } else {
- Ifx_blob->type = TYPE_BLTEXT;
- }
- Ifx_blob->BLOB.mode = (int) mode;
-
- if (php_intifx_init_blob(&Ifx_blob->BLOB.blob_data, mode, 1 TSRMLS_CC) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create blob-resource");
- return -1;
- }
-
- if (mode == BLMODE_INMEM) {
- if (len >= 0) {
- char *content = emalloc(len);
- if (content == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create blob-resource");
- return -1;
- }
- memcpy(content,param,len);
- Ifx_blob->BLOB.blob_data.loc_buffer = content;
- Ifx_blob->BLOB.blob_data.loc_bufsize = len;
- Ifx_blob->BLOB.blob_data.loc_size = len;
- Ifx_blob->BLOB.blob_data.loc_oflags = 0;
- }
- } else {
-
- if (*param && param != "") {
-
- char *filename;
-
- if (Ifx_blob->BLOB.blob_data.loc_fname != NULL) {
- unlink(Ifx_blob->BLOB.blob_data.loc_fname);
- efree(Ifx_blob->BLOB.blob_data.loc_fname);
- }
- if ((filename = emalloc(len + 1)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create blob-resource");
- return -1;
- }
- memcpy(filename, param, len);
- filename[len] = 0;
- Ifx_blob->BLOB.blob_data.loc_fname = filename;
- Ifx_blob->BLOB.blob_data.loc_size = -1;
- }
- }
-
- return zend_list_insert(Ifx_blob,le_idresult);
-}
-
-static long php_intifx_init_blob(loc_t *blob, long mode, long new TSRMLS_DC)
-{
- if (new) {
- memset(blob, 0, sizeof(loc_t));
- }
-
- blob->loc_status = 0;
- blob->loc_type = SQLTEXT;
- blob->loc_xfercount = 0;
- blob->loc_indicator = 0;
-
- if (mode == BLMODE_INMEM) {
- return php_intifx_init_blob_inmem(blob, new TSRMLS_CC);
- } else {
- return php_intifx_init_blob_infile(blob, new TSRMLS_CC);
- }
-
- return 1;
-}
-
-static long php_intifx_init_blob_inmem(loc_t *blob, long new TSRMLS_DC)
-{
- blob->loc_loctype = LOCMEMORY;
-
- if (new) {
- blob->loc_buffer = NULL;
- blob->loc_bufsize = -1;
- blob->loc_size = 0;
- }
-
- blob->loc_mflags = 0;
- blob->loc_oflags = 0;
-
- return 1;
-}
-
-static long php_intifx_init_blob_infile(loc_t *blob, long new TSRMLS_DC)
-{
- char *filename;
-
- if (new) {
-
- filename = php_intifx_create_tmpfile(TSRMLS_C);
-
- if (filename == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create blob-resource");
- return -1;
- }
-
- blob->loc_fname = filename;
- blob->loc_size = 0;
- blob->loc_fd = -1;
- }
-
- return 1;
-}
-
-static void php_intifx_release_blob(loc_t *blob TSRMLS_DC)
-{
-
-#if IFX_VERSION < 724 /* this Informix memory leak is fixed from 7.24 on */
- /* according to the current PERL DBD::Informix */
- /* and otherwise I get segmenation violations with 7.30 */
-
- /* Not set to NULL, so function will free resources */
-#else
- /* Set to NULL so php_intifx_release_blob() doens't try to free stuff it shouldn't */
-
- if (blob->loc_loctype == LOCMEMORY) {
- blob->loc_buffer = NULL;
- }
-#endif
-
- switch (blob->loc_loctype) {
-
- case LOCMEMORY:
- if (blob->loc_buffer != NULL) {
- efree(blob->loc_buffer);
- blob->loc_buffer = NULL;
- }
- break;
-
- case LOCFNAME:
- if (blob->loc_fd >= 0) {
- close(blob->loc_fd);
- }
- blob->loc_fd = -1;
-
- if (blob->loc_fname != NULL) {
- unlink(blob->loc_fname);
- efree(blob->loc_fname);
- blob->loc_fname = NULL;
- }
- break;
-
- case LOCFILE:
- case LOCUSER:
- default:
- break;
- }
-}
-
-
-/* ----------------------------------------------------------------------
-** int ifx_copy_blob(int bid)
-**
-** duplicates the given blob-object
-** bid: Id of Blobobject
-**
-** return false on error otherwise the new Blob-Object-id
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_copy_blob(int bid)
- Duplicates the given blob-object */
-PHP_FUNCTION(ifx_copy_blob)
-{
- zval **pbid;
- long newid;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pbid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pbid);
-
- newid = php_intifx_copy_blob(Z_LVAL_PP(pbid), &EG(regular_list) TSRMLS_CC);
-
- if (newid < 0) {
- RETURN_FALSE;
- }
- RETURN_LONG(newid);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php_intifx_copy_blob(long bid, HashTable *list)
- *
- * duplicates the given blob-object in the PHP resource list
- * bid: Id of Blobobject
- * list: internal hashlist of php
- *
- * return -1 on error otherwise the new Blob-Object-id
- * ----------------------------------------------------------------------
-*/
-static long php_intifx_copy_blob(long bid, HashTable *list TSRMLS_DC)
-{
- IFX_IDRES *Ifx_blob, *Ifx_blob_orig;
- loc_t *locator, *locator_orig;
- int type;
-
- Ifx_blob_orig = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult || !(Ifx_blob_orig->type == TYPE_BLBYTE || Ifx_blob_orig->type == TYPE_BLTEXT)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix blob-result index", bid);
- return -1;
- }
-
- Ifx_blob = emalloc(sizeof(IFX_IDRES));
- if (Ifx_blob == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create blob-resource");
- return -1;
- }
-
- memset(Ifx_blob, 0, sizeof(IFX_IDRES));
-
- Ifx_blob->type = Ifx_blob_orig->type;
- Ifx_blob->BLOB.mode = Ifx_blob_orig->BLOB.mode;
-
- locator = &(Ifx_blob->BLOB.blob_data);
- locator_orig = &(Ifx_blob_orig->BLOB.blob_data);
-
- if (php_intifx_init_blob(locator, Ifx_blob->BLOB.mode, 1 TSRMLS_CC) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create blob-resource");
- return -1;
- }
-
- if (Ifx_blob->BLOB.mode == BLMODE_INMEM) {
- char *content;
- if (locator_orig->loc_bufsize >= 0 && locator_orig->loc_buffer != NULL) {
- if ((content = emalloc(locator_orig->loc_size)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create blob-resource");
- return -1;
- }
- memcpy(content,locator_orig->loc_buffer, locator_orig->loc_bufsize);
- locator->loc_buffer = content;
- locator->loc_bufsize = locator_orig->loc_bufsize;
- locator->loc_size = locator_orig->loc_size;
- }
- } else { /* BLMODE_INFILE */
-
- if (locator_orig->loc_size) {
- php_copy_file(locator_orig->loc_fname, locator->loc_fname TSRMLS_CC);
- }
-
- }
-
- return zend_list_insert(Ifx_blob, le_idresult);
-}
-
-/* ----------------------------------------------------------------------
-** int ifx_free_blob(int bid)
-**
-** deletes the blob-object
-** bid: Id of Blobobject
-** return false on error otherwise true
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_free_blob(int bid)
- Deletes the blob-object */
-PHP_FUNCTION(ifx_free_blob)
-{
- zval **pid;
- long ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pid);
-
- ret = php_intifx_free_blob(Z_LVAL_PP(pid), &EG(regular_list) TSRMLS_CC);
- if (ret < 0) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php_intifx_free_blob(long bid, HashTable *list)
- *
- * deletes the blob-object from the PHP Resource List
- * bid: Id of Blobobject
- * list: internal hashlist of php
- *
- * return -1 on error otherwise 0
- * FREES BYTE-MEMORY WITH EFREE()
- * ----------------------------------------------------------------------
-*/
-static long php_intifx_free_blob(long bid, HashTable *list TSRMLS_DC)
-{
- IFX_IDRES *Ifx_blob;
- int type;
-
- Ifx_blob = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult && !(Ifx_blob->type == TYPE_BLTEXT || Ifx_blob->type == TYPE_BLBYTE)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix blob-result index", bid);
- return -1;
- }
-
- if (!(Ifx_blob->type == TYPE_BLTEXT || Ifx_blob->type == TYPE_BLBYTE)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix BYTE or TEXT type", bid);
- return -1;
- }
-
- zend_list_delete(bid);
-
- return 0;
-}
-
-/* ----------------------------------------------------------------------
-** string ifx_get_blob(int bid)
-**
-** returns the content of the blob-object
-** bid: Id of Blobobject
-** return the content
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto string ifx_get_blob(int bid)
- Returns the content of the blob-object */
-PHP_FUNCTION(ifx_get_blob)
-{
- zval **pbid;
- char *content;
- long len;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pbid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pbid);
-
- len = php_intifx_get_blob(Z_LVAL_PP(pbid), &EG(regular_list), &content TSRMLS_CC);
- if (content == NULL || len < 0) {
- RETURN_STRING(php_intifx_null(TSRMLS_C), 1);
- }
- RETURN_STRINGL(content, len, 1);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php_intifx_get_blob(long bid, HashTable *list, char** content)
- *
- * returns the content of the blob-object
- * bid: Id of Blobobject
- * list: internal hashlist of php
- *
- * return -1 on error
- * returns the pointer to the content in char** content and the amount of content in bytes
- * ----------------------------------------------------------------------
-*/
-static long php_intifx_get_blob(long bid, HashTable *list, char** content TSRMLS_DC)
-{
- IFX_IDRES *Ifx_blob;
- int type;
-
- Ifx_blob = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult && !(Ifx_blob->type == TYPE_BLTEXT || Ifx_blob->type == TYPE_BLBYTE)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix blob-result index", bid);
- return -1;
- }
-
- if (Ifx_blob->BLOB.mode == BLMODE_INMEM) {
- *content = Ifx_blob->BLOB.blob_data.loc_buffer;
- return Ifx_blob->BLOB.blob_data.loc_size;
- }
- *content = Ifx_blob->BLOB.blob_data.loc_fname;
- return strlen(Ifx_blob->BLOB.blob_data.loc_fname);
-}
-
-/* ----------------------------------------------------------------------
- * internal function
- * loc_t *php_intifx_get_blobloc(long bid, HashTable *list TSRMLS_DC)
- *
- * returns the blob-locator-structur
- * bid: Id of Blobobject
- * list: internal hashlist of php
- * return NULL on error or the pointer to the locator-structur
- * ----------------------------------------------------------------------
-*/
-static loc_t *php_intifx_get_blobloc(long bid, HashTable *list TSRMLS_DC)
-{
- IFX_IDRES *Ifx_blob;
- int type;
-
- Ifx_blob = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult && !(Ifx_blob->type == TYPE_BLTEXT || Ifx_blob->type == TYPE_BLBYTE)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix blob-result index", bid);
- return NULL;
- }
- return &(Ifx_blob->BLOB.blob_data);
-}
-
-
-/* ----------------------------------------------------------------------
-** int update_blob(int bid, string content)
-**
-** updates the content of the blob-object
-** bid: Id of Blobobject
-** content: string of new data
-** return false on error otherwise true
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_update_blob(int bid, string content)
- Updates the content of the blob-object */
-PHP_FUNCTION(ifx_update_blob)
-{
- zval **pbid, **pparam;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pbid, &pparam) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pbid);
- convert_to_string_ex(pparam);
-
- if (php_intifx_update_blob(Z_LVAL_PP(pbid), Z_STRVAL_PP(pparam), Z_STRLEN_PP(pparam), &EG(regular_list) TSRMLS_CC) < 0) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php_intifx_update_blob(long bid, char* param, long len, HashTable *list)
- *
- * updates the content of the blob-object
- * bid: Id of Blobobject
- * param: string of new data
- * len: length of string
- * list: internal hashlist of php
- * return nothing
- * ----------------------------------------------------------------------
-*/
-static long php_intifx_update_blob(long bid, char* param, long len, HashTable *list TSRMLS_DC)
-{
- IFX_IDRES *Ifx_blob;
- int type;
-
- Ifx_blob = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult && !(Ifx_blob->type == TYPE_BLTEXT || Ifx_blob->type == TYPE_BLBYTE)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix blob-result index", bid);
- return -1;
- }
-
- if (Ifx_blob->BLOB.mode == BLMODE_INMEM) {
- char *content;
-
- if (Ifx_blob->BLOB.blob_data.loc_buffer != NULL) {
- efree(Ifx_blob->BLOB.blob_data.loc_buffer);
- }
- if (len >= 0) {
- if ((content = emalloc(len)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create blob-resource");
- return -1;
- }
- memcpy(content, param, len);
- Ifx_blob->BLOB.blob_data.loc_buffer = content;
- Ifx_blob->BLOB.blob_data.loc_bufsize = len;
- Ifx_blob->BLOB.blob_data.loc_size = len;
- } else {
- Ifx_blob->BLOB.blob_data.loc_buffer = NULL;
- Ifx_blob->BLOB.blob_data.loc_bufsize = -1;
- Ifx_blob->BLOB.blob_data.loc_size = -1;
- }
- Ifx_blob->BLOB.blob_data.loc_mflags = 0;
- Ifx_blob->BLOB.blob_data.loc_oflags = 0;
- } else {
- char *filename;
-
- if (Ifx_blob->BLOB.blob_data.loc_fname != NULL) {
- efree(Ifx_blob->BLOB.blob_data.loc_fname);
- }
- if ((filename = emalloc(len + 1)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create blob-resource");
- return -1;
- }
- memcpy(filename, param, len);
- filename[len] = 0;
- Ifx_blob->BLOB.blob_data.loc_fname = filename;
- Ifx_blob->BLOB.blob_data.loc_size = -1;
- }
- return 0;
-}
-
-/*-------------------------------------------------
- * internal function
- *
- * php_intifx_create_tmpfile(TSRMLS_D)
- * creates a temporary file to store a blob in
- *-------------------------------------------------
-*/
-static char* php_intifx_create_tmpfile(TSRMLS_D)
-{
- char filename[10];
- char *blobdir;
- char *retval;
- char *opened_path;
- FILE *fp;
-
- if ((blobdir = getenv("php_blobdir")) == NULL) {
- blobdir = ".";
- }
-
- sprintf(filename, "blb");
-
- if ((fp = php_open_temporary_file(blobdir, filename, &opened_path TSRMLS_CC))) {
- fclose(fp);
- retval = estrndup(opened_path, strlen(opened_path));
- efree(opened_path);
- } else {
- retval = NULL;
- }
- return retval;
-}
-
-/* ----------------------------------------------------------------------
- * int php_intifx_alloc_ibind(IFX_RES *Ifx_Result, int items TSRMLS_DC)
- *
- * Allocates descriptors for input parameters
- * return 0 for error. 1 for ok
- * ----------------------------------------------------------------------
-*/
-static long php_intifx_alloc_ibind(IFX_RES *Ifx_Result, int items TSRMLS_DC)
-{
- EXEC SQL BEGIN DECLARE SECTION;
- char *i_bind = Ifx_Result->i_descrpid;
- int bind_size = items;
- EXEC SQL END DECLARE SECTION;
-
- if (items > Ifx_Result->numicols) {
-
- if (Ifx_Result->numicols > 0) {
- EXEC SQL DEALLOCATE DESCRIPTOR :i_bind;
- if (ifx_check() < 0) {
- return 0;
- }
- }
-
- EXEC SQL ALLOCATE DESCRIPTOR :i_bind WITH MAX :bind_size;
- if (ifx_check() < 0) {
- return 0;
- }
-
- Ifx_Result->numicols = items;
- }
-
- return 1;
-}
-
-/* ----------------------------------------------------------------------
- * int php_intifx_preparse(char *statement TSRMLS_DC)
- *
- * Count the placeholders (?) parameters in the statement
- * return -1 for error. 0 or number of question marks
- *
- * Thanks to DBD-Informix
- *
- * ----------------------------------------------------------------------
-*/
-static long php_intifx_preparse(char *statement TSRMLS_DC)
-{
- char end_quote = '\0';
- char *src;
- char *dst;
- int idx = 0;
- int style = 0;
- int laststyle = 0;
- char ch;
-
- src = statement;
- dst = statement;
-
- while ((ch = *src++) != '\0') {
- if (ch == end_quote) {
- end_quote = '\0';
- } else if (end_quote != '\0') {
- *dst++ = ch;
- continue;
- } else if (ch == '\'' || ch == '\"') {
- end_quote = ch;
- } else if (ch == '{') {
- end_quote = '}';
- } else if (ch == '-' && *src == '-') {
- end_quote = '\n';
- }
-
- if (ch == '?') {
- /* X/Open standard */
- *dst++ = '?';
- idx++;
- style = 3;
- } else {
- /* Perhaps ':=' PL/SQL construct or dbase:table in Informix */
- /* Or it could be :2 or :22 as part of a DATETIME/INTERVAL */
- *dst++ = ch;
- continue;
- }
-
- if (laststyle && style != laststyle) {
- return -1;
- }
- laststyle = style;
- }
-
- *dst = '\0';
- return(idx);
-}
-
-/* ----------------------------------------------------------------------
- * int php_intifx_count_descriptors(char *p_statemid TSRMLS_DC)
- *
- * count the number of descriptors allocated for a certain statement
- * return 384 or number of descriptors
- * ----------------------------------------------------------------------
-*/
-static long php_intifx_count_descriptors(char *p_statemid TSRMLS_DC)
-{
- EXEC SQL BEGIN DECLARE SECTION;
- char *statemid = p_statemid;
- EXEC SQL END DECLARE SECTION;
-
- struct sqlda *s_da;
- int ret = 384;
-
- EXEC SQL DESCRIBE :statemid INTO s_da;
-
- if (ifx_check() >= 0) {
-
- ret = s_da->sqld;
-
- /*
- * Thanks to DBD-Informix
- */
-
-#if (ESQLC_VERSION >= 720 || (ESQLC_VERSION >= 501 && ESQLC_VERSION < 600))
- SqlFreeMem(s_da, SQLDA_FREE);
- } else {
- free(s_da);
-#endif
- }
-
- return ret;
-}
-
-/* ----------------------------------------------------------------------
-** void ifx_blobinfile_mode(int mode)
-**
-** sets the default blob-mode for all select-queries
-** mode=0: save Byte-Blobs in momory
-** mode=1: save Byte-Blobs in a file
-** return nothing
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto void ifx_blobinfile_mode(int mode)
- Sets the default blob-mode for all select-queries */
-PHP_FUNCTION(ifx_blobinfile_mode)
-{
- zval **pmode;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pmode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pmode);
-
- IFXG(blobinfile) = Z_LVAL_PP(pmode);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** void ifx_textasvarchar(int mode)
-**
-** sets the default text-mode for all select-queries
-** mode=0: select returns a blob-id
-** mode=1: select returns a varchar with text-content
-** return nothing
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto void ifx_textasvarchar(int mode)
- Sets the default text-mode for all select-queries */
-PHP_FUNCTION(ifx_textasvarchar)
-{
- zval **pmode;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pmode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pmode);
-
- IFXG(textasvarchar) = Z_LVAL_PP(pmode);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** void ifx_byteasvarchar(int mode)
-**
-** sets the default byte-mode for all select-queries
-** mode=0: select returns a blob-id
-** mode=1: select returns a varchar with byte-content
-** return nothing
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto void ifx_byteasvarchar(int mode)
- Sets the default byte-mode for all select-queries */
-PHP_FUNCTION(ifx_byteasvarchar)
-{
- zval **pmode;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pmode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pmode);
-
- IFXG(byteasvarchar) = Z_LVAL_PP(pmode);
- RETURN_TRUE;
-}
-
-/* ----------------------------------------------------------------------
-** void ifx_nullformat(int mode)
-**
-** sets the default return value of a NULL-value on a fetch-row
-** mode=0: return ""
-** mode=1: return "NULL"
-** return nothing
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto void ifx_nullformat(int mode)
- Sets the default return value of a NULL-value on a fetch-row */
-PHP_FUNCTION(ifx_nullformat)
-{
- zval **pmode;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pmode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pmode);
-
- IFXG(nullformat) = Z_LVAL_PP(pmode);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * void php_intifx_null()
- *
- * return the NULL-string depending on .nullformat
- * return "" or "NULL"
- * ----------------------------------------------------------------------
-*/
-static char* php_intifx_null(TSRMLS_D)
-{
- char* tmp;
-
- if (IFXG(nullformat) == 0) {
- tmp = IFXG(nullvalue);
- } else {
- tmp = IFXG(nullstring);
- }
- return tmp;
-}
-
-/* ----------------------------------------------------------------------
-** int ifx_create_char(string param)
-**
-** creates an char-object
-** param: content
-** return false on error otherwise the new char-Object-id
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_create_char(string param)
- Creates a char-object */
-PHP_FUNCTION(ifx_create_char)
-{
- zval **pparam;
- long id;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pparam) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(pparam);
-
- id = php_intifx_create_char(Z_STRVAL_PP(pparam), Z_STRLEN_PP(pparam), &EG(regular_list) TSRMLS_CC);
-
- if (id < 0) {
- RETURN_FALSE;
- }
- RETURN_LONG(id);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php_intifx_create_char(char* param, long len, HashTable *list TSRMLS_DC)
- *
- * creates an char-object
- * param: content
- * len: length of param
- * list: internal hashlist of php
- * return -1 on error otherwise the new char-Object-id
- * ----------------------------------------------------------------------
-*/
-static long php_intifx_create_char(char* param, long len, HashTable *list TSRMLS_DC)
-{
- IFX_IDRES *Ifx_char;
-
- Ifx_char = emalloc(sizeof(IFX_IDRES));
- if (Ifx_char == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create char-resource");
- return -1;
- }
-
- Ifx_char->type = TYPE_CHAR;
-
- if (param == NULL || len < 0) {
- Ifx_char->CHAR.char_data = NULL;
- Ifx_char->CHAR.len = 0;
- } else {
- Ifx_char->CHAR.char_data = emalloc(len + 1);
- if (Ifx_char->CHAR.char_data == NULL) {
- efree(Ifx_char);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create char-resource");
- return -1;
- }
- memcpy(Ifx_char->CHAR.char_data, param,len);
- Ifx_char->CHAR.char_data[len] = 0;
- Ifx_char->CHAR.len = len;
- }
- return zend_list_insert(Ifx_char, le_idresult);
-}
-
-/* ----------------------------------------------------------------------
-** string ifx_get_char(int bid)
-**
-** returns the content of the char-object
-** bid: Id of charobject
-** return the content
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto string ifx_get_char(int bid)
- Returns the content of the char-object */
-PHP_FUNCTION(ifx_get_char)
-{
- zval **pbid;
- char *content;
- long len;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pbid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pbid);
-
- len = php_intifx_get_char(Z_LVAL_PP(pbid), &EG(regular_list), &content TSRMLS_CC);
- if (content == NULL || len < 0) {
- RETURN_STRING("", 1);
- }
- RETURN_STRINGL(content, len, 1);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php_intifx_get_char(long bid, HashTable *list, char** content)
- *
- * returns the content of the char-object
- * bid: Id of charobject
- * list: internal hashlist of php
- *
- * return -1 on error
- * returns the pointer to the content in char** content and the amount of content in bytes
- * ----------------------------------------------------------------------
-*/
-
-static long php_intifx_get_char(long bid, HashTable *list, char** content TSRMLS_DC)
-{
- IFX_IDRES *Ifx_char;
- int type;
-
- Ifx_char = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult && !(Ifx_char->type == TYPE_CHAR)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix char-result index", bid);
- return -1;
- }
-
- *content = Ifx_char->CHAR.char_data;
- return Ifx_char->CHAR.len;
-}
-
-/* ----------------------------------------------------------------------
-** int ifx_free_char(int bid)
-**
-** deletes the char-object
-** bid: Id of charobject
-** return false on error otherwise true
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_free_char(int bid)
- Deletes the char-object */
-PHP_FUNCTION(ifx_free_char)
-{
- zval **pid;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pid);
-
- if (php_intifx_free_char(Z_LVAL_PP(pid), &EG(regular_list) TSRMLS_CC) < 0) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php_intifx_free_char(long bid, HashTable *list TSRMLS_DC)
- *
- * deletes the char-object
- * bid: Id of Charobject
- * list: internal hashlist of php
- *
- * return -1 on error otherwise 0
- * ----------------------------------------------------------------------
-*/
-static long php_intifx_free_char(long bid, HashTable *list TSRMLS_DC)
-{
- IFX_IDRES *Ifx_char;
- int type;
-
- Ifx_char = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult && !(Ifx_char->type == TYPE_CHAR)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix char-result index", bid);
- return -1;
- }
-
- if (Ifx_char->CHAR.char_data != NULL) {
- efree(Ifx_char->CHAR.char_data);
- }
- zend_list_delete(bid);
- efree(Ifx_char);
- return 0;
-}
-
-/* ----------------------------------------------------------------------
-** int ifx_update_char(int bid, string content)
-**
-** updates the content of the char-object
-** bid: Id of charobject
-** content: string of new data
-** return false on error otherwise true
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_update_char(int bid, string content)
- Updates the content of the char-object */
-PHP_FUNCTION(ifx_update_char)
-{
- zval **pbid, **pparam;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pbid, &pparam) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pbid);
- convert_to_string_ex(pparam);
-
- if (php_intifx_update_char(Z_LVAL_PP(pbid), Z_STRVAL_PP(pparam), Z_STRLEN_PP(pparam), &EG(regular_list) TSRMLS_CC) < 0) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php_intifx_update_char(long bid, char* param, long len, HashTable *list)
- *
- * updates the content of the char-object
- * bid: Id of charobject
- * param: string of new data
- * len: length of string
- * list: internal hashlist of php
- * return nothing
- * ----------------------------------------------------------------------
-*/
-static long php_intifx_update_char(long bid, char* param, long len, HashTable *list TSRMLS_DC)
-{
- IFX_IDRES *Ifx_char;
- int type;
-
- Ifx_char = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult && !(Ifx_char->type == TYPE_CHAR)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix char-result index", bid);
- return -1;
- }
-
- if (Ifx_char->CHAR.char_data != NULL) {
- efree(Ifx_char->CHAR.char_data);
- }
- Ifx_char->CHAR.char_data = NULL;
- Ifx_char->CHAR.len = 0;
-
- if (param == NULL || len < 0) {
- Ifx_char->CHAR.char_data = NULL;
- Ifx_char->CHAR.len = 0;
- } else {
- Ifx_char->CHAR.char_data = emalloc(len + 1);
- if (Ifx_char->CHAR.char_data == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create char-resource");
- return -1;
- }
- memcpy(Ifx_char->CHAR.char_data, param,len);
- Ifx_char->CHAR.char_data[len] = 0;
- Ifx_char->CHAR.len = len;
- }
- return 0;
-}
-
-$ifdef HAVE_IFX_IUS;
-
-/* ----------------------------------------------------------------------
-** int ifxus_create_slob(int mode)
-**
-** creates an slob-object and opens it
-** mode: 1=LO_RDONLY, 2=LO_WRONLY, 4=LO_APPEND, 8=LO_RDWR, 16=LO_BUFFER, 32=LO_NOBUFFER -> or-mask
-** return false on error otherwise the new Slob-Object-id
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_create_slob(int mode)
- Creates a slob-object and opens it */
-PHP_FUNCTION(ifxus_create_slob)
-{
- zval **pmode;
- long id;
- long mode, create_mode;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pmode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(pmode);
- mode = Z_LVAL_PP(pmode);
-
- create_mode = 0;
- if ((mode & 1) != 0) {
- create_mode |= LO_RDONLY;
- }
- if ((mode & 2) != 0) {
- create_mode |= LO_WRONLY;
- }
- if ((mode & 4) != 0) {
- create_mode |= LO_APPEND;
- }
- if ((mode & 8) != 0) {
- create_mode |= LO_RDWR;
- }
- if ((mode & 16) != 0) {
- create_mode |= LO_BUFFER;
- }
- if ((mode & 32) != 0) {
- create_mode |= LO_NOBUFFER;
- }
-
- id = php_intifxus_create_slob(create_mode, &EG(regular_list) TSRMLS_CC);
-
- if (id < 0) {
- RETURN_FALSE;
- }
- RETURN_LONG(id);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php_intifx_create_slob(long create_mode, HashTable *list TSRMLS_DC)
- *
- * creates an slob-object and opens it
- * mode: 1=LO_RDONLY, 2=LO_WRONLY, 4=LO_APPEND, 8=LO_RDWR, 16=LO_BUFFER, 32=LO_NOBUFFER -> or-mask
- * list: internal hashlist of php
- * return -1 on error otherwise the new Blob-Object-id
- * ----------------------------------------------------------------------
-*/
-static long php_intifxus_create_slob(long create_mode, HashTable *list TSRMLS_DC)
-{
- IFX_IDRES *Ifx_slob;
- int errcode;
-
- Ifx_slob = emalloc(sizeof(IFX_IDRES));
- if (Ifx_slob == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create slob-resource");
- return -1;
- }
-
- errcode = ifx_lo_def_create_spec(&(Ifx_slob->SLOB.createspec));
- if (errcode < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create slob-resource: %d", errcode);
- return -1;
- }
-
- Ifx_slob->type = TYPE_SLOB;
- Ifx_slob->SLOB.lofd = ifx_lo_create(Ifx_slob->SLOB.createspec, create_mode, &(Ifx_slob->SLOB.slob_data), &errcode);
- if (errcode < 0 || Ifx_slob->SLOB.lofd < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create slob-resource: %d", errcode);
- return -1;
- }
- return zend_list_insert(Ifx_slob, le_idresult);
-}
-
-/* ----------------------------------------------------------------------
-** int ifxus_free_slob(int bid)
-**
-** deletes the slob-object
-** bid: Id of Slobobject
-** return false on error otherwise true
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_free_slob(int bid)
- Deletes the slob-object */
-PHP_FUNCTION(ifxus_free_slob)
-{
- zval **pid;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pid);
-
- if (php_intifxus_free_slob(Z_LVAL_PP(pid), &EG(regular_list) TSRMLS_CC) < 0) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php_intifxus_free_slob(long bid, HashTable *list)
- *
- * deletes the slob-object
- * bid: Id of Slobobject
- * list: internal hashlist of php
- *
- * return -1 on error otherwise 0
- * ----------------------------------------------------------------------
-*/
-static long php_intifxus_free_slob(long bid, HashTable *list TSRMLS_DC)
-{
- IFX_IDRES *Ifx_slob;
- int type;
-
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult || Ifx_slob->type != TYPE_SLOB) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix slob-result index", bid);
- return -1;
- }
-
- if (php_intifxus_close_slob(bid, &EG(regular_list) TSRMLS_CC) < 0) {
- return -1;
- }
-
- if (Ifx_slob->SLOB.createspec != NULL) {
- ifx_lo_spec_free(Ifx_slob->SLOB.createspec);
- Ifx_slob->SLOB.createspec = NULL;
- }
- efree(Ifx_slob);
- zend_list_delete(bid);
- return 0;
-}
-
-/* ----------------------------------------------------------------------
-** int ifxus_close_slob(int bid)
-**
-** deletes the slob-object
-** bid: Id of Slobobject
-** return false on error otherwise true
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_close_slob(int bid)
- Deletes the slob-object */
-PHP_FUNCTION(ifxus_close_slob)
-{
- zval **pid;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pid);
-
- if (php_intifxus_close_slob(Z_LVAL_PP(pid), &EG(regular_list) TSRMLS_CC) < 0) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php_intifxus_close_slob(long bid, HashTable *list)
- *
- * deletes the slob-object
- * bid: Id of Slobobject
- * list: internal hashlist of php
- *
- * return -1 on error otherwise 0
- * ----------------------------------------------------------------------
-*/
-static long php_intifxus_close_slob(long bid, HashTable *list TSRMLS_DC)
-{
- IFX_IDRES *Ifx_slob;
- int type;
-
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult || Ifx_slob->type != TYPE_SLOB) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix slob-result index", bid);
- return -1;
- }
-
- if (Ifx_slob->SLOB.lofd < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Slob-resource already closed");
- return -1;
- }
-
- if (ifx_lo_close(Ifx_slob->SLOB.lofd) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't close slob-resource");
- return -1;
- }
- Ifx_slob->SLOB.lofd = -1;
- return 0;
-}
-
-/* ----------------------------------------------------------------------
-** int ifxus_open_slob(long bid, int mode)
-**
-** opens an slob-object
-** bid: existing slob-id
-** mode: 1=LO_RDONLY, 2=LO_WRONLY, 4=LO_APPEND, 8=LO_RDWR, 16=LO_BUFFER, 32=LO_NOBUFFER -> or-mask
-** return false on error otherwise the new Slob-Object-id
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_open_slob(long bid, int mode)
- Opens an slob-object */
-PHP_FUNCTION(ifxus_open_slob)
-{
- zval **pbid, **pmode;
- long mode,create_mode;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(1, &pbid, &pmode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pmode);
- convert_to_long_ex(pbid);
-
- mode = Z_LVAL_PP(pmode);
- create_mode = 0;
- if ((mode & 1) != 0) {
- create_mode|=LO_RDONLY;
- }
- if ((mode & 2) != 0) {
- create_mode|=LO_WRONLY;
- }
- if ((mode & 4) != 0) {
- create_mode|=LO_APPEND;
- }
- if ((mode & 8) != 0) {
- create_mode|=LO_RDWR;
- }
- if ((mode & 16) != 0) {
- create_mode|=LO_BUFFER;
- }
- if ((mode & 32) != 0) {
- create_mode|=LO_NOBUFFER;
- }
-
- RETURN_LONG(php_intifxus_open_slob(Z_LVAL_PP(pbid), create_mode, &EG(regular_list) TSRMLS_CC));
-}
-/* }}} */
-
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php_intifxus_open_slob(long bid,long create_mode, HashTable *list)
- *
- * opens an slob-object
- * mode: 1=LO_RDONLY, 2=LO_WRONLY, 4=LO_APPEND, 8=LO_RDWR, 16=LO_BUFFER, 32=LO_NOBUFFER -> or-mask
- * list: internal hashlist of php
- * return -1 on error otherwise the new Blob-Object-id
- * ----------------------------------------------------------------------
-*/
-static long php_intifxus_open_slob(long bid, long create_mode, HashTable *list TSRMLS_DC)
-{
- IFX_IDRES *Ifx_slob;
- int errcode;
- int type;
-
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult || Ifx_slob->type != TYPE_SLOB) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix slob-result index", bid);
- return -1;
- }
-
- if (Ifx_slob->SLOB.lofd > 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Slob-resource already open");
- return -1;
- }
-
- Ifx_slob->SLOB.lofd = ifx_lo_open(&(Ifx_slob->SLOB.slob_data), create_mode, &errcode);
- if (errcode < 0 || Ifx_slob->SLOB.lofd < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't open slob-resource: %d", errcode);
- return -1;
- }
- return 0;
-}
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php_intifxus_new_slob(HashTable *list TSRMLS_DC)
- *
- * creates an slob-object but don't open it
- * list: internal hashlist of php
- * return -1 on error otherwise the new slob-Object-id
- * ----------------------------------------------------------------------
-*/
-static long php_intifxus_new_slob(HashTable *list TSRMLS_DC)
-{
- IFX_IDRES *Ifx_slob;
-
- Ifx_slob = emalloc(sizeof(IFX_IDRES));
- if (Ifx_slob == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create slob-resource");
- return -1;
- }
-
- Ifx_slob->type = TYPE_SLOB;
- Ifx_slob->SLOB.lofd = -1;
- Ifx_slob->SLOB.createspec = NULL;
- return zend_list_insert(Ifx_slob, le_idresult);
-}
-
-/* ----------------------------------------------------------------------
- * internal function
- * ifx_lo_t *php_intifxus_get_slobloc(long bid, HashTable *list)
- *
- * retuens the ifx_lo_t-structure of a slob-object
- * list: internal hashlist of php
- * return -1 on error otherwise the new Blob-Object-id
- * ----------------------------------------------------------------------
-*/
-static ifx_lo_t *php_intifxus_get_slobloc(long bid, HashTable *list TSRMLS_DC)
-{
- IFX_IDRES *Ifx_slob;
- int type;
-
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult || Ifx_slob->type != TYPE_SLOB) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix slob-result index", bid);
- return NULL;
- }
- return &(Ifx_slob->SLOB.slob_data);
-}
-
-/* ----------------------------------------------------------------------
-** int ifxus_tell_slob(long bid)
-**
-** returns the current file or seek position of an open slob-object
-** bid: existing slob-id
-** return false on error otherwise the seek-position
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_tell_slob(long bid)
- Returns the current file or seek position of an open slob-object */
-PHP_FUNCTION(ifxus_tell_slob)
-{
- zval **pbid;
- long bid;
- IFX_IDRES *Ifx_slob;
- ifx_int8_t akt_seek_pos;
- int type;
- long lakt_seek_pos;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pbid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pbid);
- bid = Z_LVAL_PP(pbid);
-
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult || Ifx_slob->type != TYPE_SLOB) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix slob-result index", bid);
- RETURN_FALSE;
- }
-
- if (ifx_lo_tell(Ifx_slob->SLOB.lofd, &akt_seek_pos) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't perform tell-operation");
- RETURN_FALSE;
- }
-
- if (ifx_int8tolong(&akt_seek_pos, &lakt_seek_pos) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Seek-position to large for long");
- RETURN_FALSE;
- }
- RETURN_LONG(lakt_seek_pos);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** int ifxus_seek_slob(long bid, int mode, long offset)
-**
-** sets the current file or seek position of an open slob-object
-** bid: existing slob-id
-** mode: 0=LO_SEEK_SET, 1=LO_SEEK_CUR, 2=LO_SEEK_END
-** offset: byte-offset
-** return false on error otherwise the seek-position
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_seek_slob(long bid, int mode, long offset)
- Sets the current file or seek position of an open slob-object */
-PHP_FUNCTION(ifxus_seek_slob)
-{
- zval **pbid, **pmode, **poffset;
- long bid,lakt_seek_pos;
- IFX_IDRES *Ifx_slob;
- ifx_int8_t akt_seek_pos, offset;
- int type, mode;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &pbid, &pmode, &poffset) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pbid);
- convert_to_long_ex(pmode);
- convert_to_long_ex(poffset);
-
- bid = Z_LVAL_PP(pbid);
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult || Ifx_slob->type != TYPE_SLOB) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix slob-result index", bid);
- RETURN_FALSE;
- }
-
- mode = LO_SEEK_SET;
- if (Z_LVAL_PP(pmode) == 1) {
- mode = LO_SEEK_CUR;
- }
- if (Z_LVAL_PP(pmode) == 2) {
- mode = LO_SEEK_END;
- }
-
- ifx_int8cvlong(Z_LVAL_PP(poffset), &offset);
- if (ifx_lo_seek(Ifx_slob->SLOB.lofd, &offset, mode, &akt_seek_pos) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't perform seek-operation");
- RETURN_FALSE;
- }
-
- if (ifx_int8tolong(&akt_seek_pos, &lakt_seek_pos) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Seek-position to large for long");
- RETURN_FALSE;
- }
- RETURN_LONG(lakt_seek_pos);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** int ifxus_read_slob(long bid, long nbytes)
-**
-** reads nbytes of the slob-object
-** bid: existing slob-id
-** nbytes: bytes zu read
-** return false on error otherwise the string
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_read_slob(long bid, long nbytes)
- Reads nbytes of the slob-object */
-PHP_FUNCTION(ifxus_read_slob)
-{
- zval **pbid, **pnbytes;
- long bid, nbytes;
- IFX_IDRES *Ifx_slob;
- int errcode, type;
- char *buffer;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pbid, &pnbytes) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pbid);
- convert_to_long_ex(pnbytes);
-
- bid = Z_LVAL_PP(pbid);
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult || Ifx_slob->type != TYPE_SLOB) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix slob-result index", bid);
- RETURN_FALSE;
- }
-
- nbytes = Z_LVAL_PP(pnbytes);
- buffer = emalloc(nbytes);
-
- if (ifx_lo_read(Ifx_slob->SLOB.lofd, buffer, nbytes, &errcode) < 0) {
- efree(buffer);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error reading slob: %d", errcode);
- RETURN_FALSE;
- }
- RETURN_STRINGL(buffer, nbytes, 0);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** int ifxus_write_slob(long bid, string content)
-**
-** writes a string into the slob-object
-** bid: existing slob-id
-** content: content to write
-** return false on error otherwise bytes written
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_write_slob(long bid, string content)
- Writes a string into the slob-object */
-PHP_FUNCTION(ifxus_write_slob)
-{
- zval **pbid, **pcontent;
- long bid, nbytes;
- IFX_IDRES *Ifx_slob;
- int errcode, type;
- char *buffer;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pbid, &pcontent) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pbid);
- convert_to_string_ex(pcontent);
-
- bid = Z_LVAL_PP(pbid);
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid, &type);
- if (type != le_idresult || Ifx_slob->type != TYPE_SLOB) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Informix slob-result index", bid);
- RETURN_FALSE;
- }
-
- buffer = Z_STRVAL_PP(pcontent);
- nbytes = Z_STRLEN_PP(pcontent);
-
- if (nbytes <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "String has no content");
- RETURN_FALSE;
- }
-
- if ((nbytes = ifx_lo_write(Ifx_slob->SLOB.lofd, buffer, nbytes, &errcode)) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error writing slob: %d", errcode);
- RETURN_FALSE;
- }
-
- RETURN_LONG(nbytes);
-}
-/* }}} */
-
-$endif;
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/informix/php_informix.h b/ext/informix/php_informix.h
deleted file mode 100644
index 0899af2b91..0000000000
--- a/ext/informix/php_informix.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Danny Heijl <Danny.Heijl@cevi.be>, initial cut (ODS 7) |
- | Christian Cartus <chc@idgruppe.de>, blobs, and IUS 9 |
- | Jouni Ahto <jouni.ahto@exdec.fi>, configuration stuff |
- | Corne' Cornelius <cornec@reach.co.za>, input descriptors |
- | based on mysql code by: Zeev Suraski <zeev@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_INFORMIX_H
-#define PHP_INFORMIX_H
-
-#ifdef PHP_WIN32
-#define PHP_IFX_API __declspec(dllexport)
-#else
-#define PHP_IFX_API
-#endif
-
-#if HAVE_IFX /* with Informix */
-
-#ifndef DLEXPORT
-#define DLEXPORT
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-extern zend_module_entry ifx_module_entry;
-#define ifx_module_ptr &ifx_module_entry
-
-/* user functions */
-PHP_MINIT_FUNCTION(ifx);
-PHP_RINIT_FUNCTION(ifx);
-PHP_MSHUTDOWN_FUNCTION(ifx);
-PHP_MINFO_FUNCTION(ifx);
-/* functions common to all Informix versions */
-PHP_FUNCTION(ifx_connect);
-PHP_FUNCTION(ifx_pconnect);
-PHP_FUNCTION(ifx_close);
-PHP_FUNCTION(ifx_query);
-PHP_FUNCTION(ifx_prepare);
-PHP_FUNCTION(ifx_do);
-PHP_FUNCTION(ifx_error);
-PHP_FUNCTION(ifx_errormsg);
-PHP_FUNCTION(ifx_affected_rows);
-PHP_FUNCTION(ifx_num_rows);
-PHP_FUNCTION(ifx_num_fields);
-PHP_FUNCTION(ifx_fetch_row);
-PHP_FUNCTION(ifx_free_result);
-PHP_FUNCTION(ifx_htmltbl_result);
-PHP_FUNCTION(ifx_fieldtypes);
-PHP_FUNCTION(ifx_fieldproperties);
-PHP_FUNCTION(ifx_getsqlca);
-/* BLOB related stuff, IDS & IUS only */
-PHP_FUNCTION(ifx_create_blob);
-PHP_FUNCTION(ifx_free_blob) ;
-PHP_FUNCTION(ifx_get_blob);
-PHP_FUNCTION(ifx_update_blob);
-PHP_FUNCTION(ifx_blobinfile_mode);
-PHP_FUNCTION(ifx_copy_blob);
-PHP_FUNCTION(ifx_textasvarchar);
-PHP_FUNCTION(ifx_byteasvarchar);
-PHP_FUNCTION(ifx_nullformat);
-PHP_FUNCTION(ifx_create_char);
-PHP_FUNCTION(ifx_free_char) ;
-PHP_FUNCTION(ifx_update_char);
-PHP_FUNCTION(ifx_get_char);
-
-/* SLOB, CLOB : IUS only functions */
-#if HAVE_IFX_IUS
-PHP_FUNCTION(ifxus_create_slob);
-PHP_FUNCTION(ifxus_free_slob) ;
-PHP_FUNCTION(ifxus_close_slob) ;
-PHP_FUNCTION(ifxus_open_slob) ;
-PHP_FUNCTION(ifxus_read_slob);
-PHP_FUNCTION(ifxus_write_slob);
-PHP_FUNCTION(ifxus_seek_slob);
-PHP_FUNCTION(ifxus_tell_slob);
-#endif
-
-ZEND_BEGIN_MODULE_GLOBALS(ifx)
- long default_link;
- long num_links, num_persistent;
- long max_links, max_persistent;
- long allow_persistent;
- char *default_host, *default_user, *default_password;
- int connectionid;
- int cursorid;
- int sv_sqlcode; /* saved informix SQLCODE value */
- long blobinfile; /* 0=save in memory, 1=save in file */
- long textasvarchar; /* 0=as id, 1=as varchar */
- long byteasvarchar; /* 0=as id, 1=as varchar */
- long charasvarchar; /* 0=don't strip trailing blanks, 1=strip */
- long nullformat; /* 0=NULL as "", 1= NULL as "NULL" */
- char nullvalue[1]; /* "" */
- char nullstring[5]; /* "NULL" */
-ZEND_END_MODULE_GLOBALS(ifx)
-
-#ifdef ZTS
-# define IFXG(v) TSRMG(ifx_globals_id, zend_ifx_globals *, v)
-#else
-# define IFXG(v) (ifx_globals.v)
-#endif
-
-#else /* not HAVE_IFX */
-#define ifx_module_ptr NULL
-#endif
-#define phpext_informix_ptr ifx_module_ptr
-#endif /* PHP_INFORMIX_H */
diff --git a/ext/informix/php_informix_includes.h b/ext/informix/php_informix_includes.h
deleted file mode 100644
index 001fbdecba..0000000000
--- a/ext/informix/php_informix_includes.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Danny Heijl <Danny.Heijl@cevi.be>, initial cut (ODS 7) |
- | Christian Cartus <chc@idgruppe.de>, blobs, and IUS 9 |
- | Jouni Ahto <jouni.ahto@exdec.fi>, configuration stuff |
- | Corne' Cornelius <cornec@reach.co.za>, input descriptors |
- | based on mysql code by: Zeev Suraski <zeev@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_INFORMIX_INCLUDES_H
-#define PHP_INFORMIX_INCLUDES_H
-
-#if HAVE_IFX /* with Informix */
-
-#undef TYPEMAX
-#undef CHAR
-
-#include "locator.h"
-#include "sqltypes.h"
-
-#define MAX_RESID 64
-#define BLOBINFILE 0 /* 0=in memory, 1=in file */
-
-/* query result set data */
-typedef struct ifx_res {
- char connecid[32];
- char cursorid[32];
- char descrpid[32];
- char i_descrpid[32];
- char statemid[32];
- int isscroll;
- int ishold;
- int iscursory;
- int paramquery;
- int numcols;
- int numicols;
- int rowid;
- int affected_rows;
- long sqlerrd[6];
- int res_id[MAX_RESID];
-} IFX_RES;
-
-typedef struct _IFX_IDRES {
- int type;
- union {
- struct {
- int mode;
- loc_t blob_data;
- } BLOBRES;
-
- struct {
- char *char_data;
- int len;
- } CHARRES;
-
-#if HAVE_IFX_IUS
- struct {
- ifx_lo_t slob_data;
- ifx_lo_create_spec_t *createspec;
- int lofd;
- } SLOBRES;
-#endif
- } DATARES;
-} IFX_IDRES;
-
-#define BLOB DATARES.BLOBRES
-#define CHAR DATARES.CHARRES
-
-#if HAVE_IFX_IUS
-#define SLOB DATARES.SLOBRES
-#endif
-
-#endif /* HAVE_IFX */
-
-#endif /* PHP_INFORMIX_INCLUDES_H */
diff --git a/ext/ingres_ii/CREDITS b/ext/ingres_ii/CREDITS
deleted file mode 100644
index f23fb1d63f..0000000000
--- a/ext/ingres_ii/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Ingres II
-David Hénot
diff --git a/ext/ingres_ii/EXPERIMENTAL b/ext/ingres_ii/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/ingres_ii/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/ingres_ii/README b/ext/ingres_ii/README
deleted file mode 100644
index d16d152c09..0000000000
--- a/ext/ingres_ii/README
+++ /dev/null
@@ -1,13 +0,0 @@
-Ingres II extension for PHP 4.0
-===============================
-
-This extension provides access to Ingres II servers from PHP 4.0.
-It is still in development and has been only quickly tested on
-Linux (Mandrake 5.3 for Intel), so you should avoid using it with
-critical data.
-
-To enable the extension just add --with-ingres to your ./configure
-line. If the Ingres files are not found, use --with-ingres=DIR instead
-to specify your Ingres installation directory.
-
-Please report suggestions to henot@php.net.
diff --git a/ext/ingres_ii/config.m4 b/ext/ingres_ii/config.m4
deleted file mode 100644
index abfce6bf8b..0000000000
--- a/ext/ingres_ii/config.m4
+++ /dev/null
@@ -1,35 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(ingres, for Ingres II support,
-[ --with-ingres[=DIR] Include Ingres II support. DIR is the Ingres
- base directory (default $II_SYSTEM/ingres)])
-
-if test "$PHP_INGRES" != "no"; then
- AC_DEFINE(HAVE_II, 1, [Whether you have Ingres II])
- PHP_NEW_EXTENSION(ingres_ii, ii.c, $ext_shared)
- PHP_SUBST(II_SHARED_LIBADD)
-
- if test "$PHP_INGRES" = "yes"; then
- II_DIR=$II_SYSTEM/ingres
- else
- II_DIR=$PHP_INGRES
- fi
-
- if test -r $II_DIR/files/iiapi.h; then
- II_INC_DIR=$II_DIR/files
- else
- AC_MSG_ERROR(Cannot find iiapi.h under $II_DIR/files)
- fi
-
- if test -r $II_DIR/lib/libiiapi.a; then
- II_LIB_DIR=$II_DIR/lib
- else
- AC_MSG_ERROR(Cannot find libiiapi.a under $II_DIR/lib)
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(iiapi, $II_LIB_DIR, II_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ingres, $II_LIB_DIR, II_SHARED_LIBADD)
- PHP_ADD_INCLUDE($II_INC_DIR)
-fi
diff --git a/ext/ingres_ii/ii.c b/ext/ingres_ii/ii.c
deleted file mode 100644
index bdcf23bbf4..0000000000
--- a/ext/ingres_ii/ii.c
+++ /dev/null
@@ -1,1544 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Contributed by ECL IP'S Software & Services |
- | http://www.eclips-software.com |
- | mailto://idev@eclips-software.com |
- | Author: David Hénot <henot@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_ii.h"
-#include "ii.h"
-#include "ext/standard/php_string.h"
-
-#if HAVE_II
-
-ZEND_DECLARE_MODULE_GLOBALS(ii)
-
-/* True globals, no need for thread safety */
-static int le_ii_link, le_ii_plink;
-
-#define SAFE_STRING(s) ((s)?(s):"")
-
-/* Every user visible function must have an entry in ii_functions[].
-*/
-function_entry ii_functions[] = {
- PHP_FE(ingres_connect, NULL)
- PHP_FE(ingres_pconnect, NULL)
- PHP_FE(ingres_close, NULL)
- PHP_FE(ingres_query, NULL)
- PHP_FE(ingres_num_rows, NULL)
- PHP_FE(ingres_num_fields, NULL)
- PHP_FE(ingres_field_name, NULL)
- PHP_FE(ingres_field_type, NULL)
- PHP_FE(ingres_field_nullable, NULL)
- PHP_FE(ingres_field_length, NULL)
- PHP_FE(ingres_field_precision, NULL)
- PHP_FE(ingres_field_scale, NULL)
- PHP_FE(ingres_fetch_array, NULL)
- PHP_FE(ingres_fetch_row, NULL)
- PHP_FE(ingres_fetch_object, NULL)
- PHP_FE(ingres_rollback, NULL)
- PHP_FE(ingres_commit, NULL)
- PHP_FE(ingres_autocommit, NULL)
- {NULL, NULL, NULL} /* Must be the last line in ii_functions[] */
-};
-
-zend_module_entry ingres_ii_module_entry = {
- STANDARD_MODULE_HEADER,
- "ingres_ii",
- ii_functions,
- PHP_MINIT(ii),
- PHP_MSHUTDOWN(ii),
- PHP_RINIT(ii),
- PHP_RSHUTDOWN(ii),
- PHP_MINFO(ii),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_INGRES_II
-ZEND_GET_MODULE(ingres_ii)
-#endif
-
-/* php.ini entries
-*/
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("ingres.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong, allow_persistent, zend_ii_globals, ii_globals)
- STD_PHP_INI_ENTRY_EX("ingres.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_persistent, zend_ii_globals, ii_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("ingres.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_links, zend_ii_globals, ii_globals, display_link_numbers)
- STD_PHP_INI_ENTRY("ingres.default_database", NULL, PHP_INI_ALL, OnUpdateString, default_database, zend_ii_globals, ii_globals)
- STD_PHP_INI_ENTRY("ingres.default_user", NULL, PHP_INI_ALL, OnUpdateString, default_user, zend_ii_globals, ii_globals)
- STD_PHP_INI_ENTRY("ingres.default_password", NULL, PHP_INI_ALL, OnUpdateString, default_password, zend_ii_globals, ii_globals)
-PHP_INI_END()
-
-/* closes statement in given link
-*/
-static int _close_statement(II_LINK *link)
-{
- IIAPI_CLOSEPARM closeParm;
-
- closeParm.cl_genParm.gp_callback = NULL;
- closeParm.cl_genParm.gp_closure = NULL;
- closeParm.cl_stmtHandle = link->stmtHandle;
-
- IIapi_close(&closeParm);
- ii_sync(&(closeParm.cl_genParm));
-
- if (ii_success(&(closeParm.cl_genParm)) == II_FAIL) {
- return 1;
- }
-
- link->stmtHandle = NULL;
- link->fieldCount = 0;
- link->descriptor = NULL;
- return 0;
-}
-
-/* rolls back transaction in given link
- after closing the active transaction (if any)
-*/
-static int _rollback_transaction(II_LINK *link TSRMLS_DC)
-{
- IIAPI_ROLLBACKPARM rollbackParm;
-
- if (link->stmtHandle && _close_statement(link)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to close statement !!");
- return 1;
- }
-
- rollbackParm.rb_genParm.gp_callback = NULL;
- rollbackParm.rb_genParm.gp_closure = NULL;
- rollbackParm.rb_tranHandle = link->tranHandle;
- rollbackParm.rb_savePointHandle = NULL;
-
- IIapi_rollback(&rollbackParm);
- ii_sync(&(rollbackParm.rb_genParm));
-
- if (ii_success(&(rollbackParm.rb_genParm)) == II_FAIL) {
- return 1;
- }
-
- link->tranHandle = NULL;
- return 0;
-}
-
-static void _close_ii_link(II_LINK *link TSRMLS_DC)
-{
- IIAPI_DISCONNPARM disconnParm;
-
- if (link->tranHandle && _rollback_transaction(link TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to rollback transaction !!");
- }
-
- disconnParm.dc_genParm.gp_callback = NULL;
- disconnParm.dc_genParm.gp_closure = NULL;
- disconnParm.dc_connHandle = link->connHandle;
-
- IIapi_disconnect(&disconnParm);
-
- free(link);
-
- IIG(num_links)--;
-}
-
-/* closes the given link, actually disconnecting from server
- and releasing associated resources after rolling back the
- active transaction (if any)
-*/
-static void php_close_ii_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- II_LINK *link = (II_LINK *) rsrc->ptr;
-
- _close_ii_link(link TSRMLS_CC);
-}
-
-/* closes the given persistent link, see _close_ii_link
-*/
-static void _close_ii_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- II_LINK *link = (II_LINK *) rsrc->ptr;
-
- _close_ii_link(link TSRMLS_CC);
- IIG(num_persistent)--;
-}
-
-/* cleans up the given persistent link.
- used when the request ends to 'refresh' the link for use
- by the next request
-*/
-static void _ai_clean_ii_plink(II_LINK *link TSRMLS_DC)
-{
- int ai_error = 0;
- IIAPI_DISCONNPARM disconnParm;
- IIAPI_AUTOPARM autoParm;
-
- /* if link as always been marked as broken do nothing */
- /* This because we call this function directly from close function */
- /* And it's called in the end of request */
- if (link->connHandle == NULL) {
- return;
- }
-
- if (link->stmtHandle && _close_statement(link)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to close statement !!");
- ai_error = 1;
- }
-
- if (link->autocommit) {
- autoParm.ac_genParm.gp_callback = NULL;
- autoParm.ac_genParm.gp_closure = NULL;
- autoParm.ac_connHandle = link->connHandle;
- autoParm.ac_tranHandle = link->tranHandle;
-
- IIapi_autocommit(&autoParm);
- ii_sync(&(autoParm.ac_genParm));
-
- if (ii_success(&(autoParm.ac_genParm)) == II_FAIL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to disable autocommit");
- }
-
- link->autocommit = 0;
- link->tranHandle = NULL;
- }
-
- if (link->tranHandle && _rollback_transaction(link TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to rollback transaction !!");
- }
-
- /* Assume link is broken, close it, and mark it as broken with conn Handle NULL */
- if (ai_error) {
- disconnParm.dc_genParm.gp_callback = NULL;
- disconnParm.dc_genParm.gp_closure = NULL;
- disconnParm.dc_connHandle = link->connHandle;
-
- IIapi_disconnect(&disconnParm);
- link->connHandle = NULL;
- }
-}
-
-static void _clean_ii_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- II_LINK *link = (II_LINK *)rsrc->ptr;
- _ai_clean_ii_plink(link TSRMLS_CC);
-}
-
-/* sets the default link
-*/
-static void php_ii_set_default_link(int id TSRMLS_DC)
-{
- if (IIG(default_link) != -1) {
- zend_list_delete(IIG(default_link));
- }
- IIG(default_link) = id;
- zend_list_addref(id);
-}
-
-/* gets the default link
- if none has been set, tries to open a new one with default
- parameters
-*/
-static int php_ii_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
-{
- if (IIG(default_link) == -1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_ii_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
- }
- return IIG(default_link);
-}
-
-static void php_ii_globals_init(zend_ii_globals *ii_globals)
-{
- ii_globals->num_persistent = 0;
-}
-
-/* Module initialization
-*/
-PHP_MINIT_FUNCTION(ii)
-{
- IIAPI_INITPARM initParm;
-
- ZEND_INIT_MODULE_GLOBALS(ii, php_ii_globals_init, NULL);
- REGISTER_INI_ENTRIES();
-
- le_ii_link = zend_register_list_destructors_ex(php_close_ii_link, NULL, "ingres", module_number);
- le_ii_plink = zend_register_list_destructors_ex(_clean_ii_plink, _close_ii_plink, "ingres persistent", module_number);
-
- /* Constants registration */
- REGISTER_LONG_CONSTANT("INGRES_ASSOC", II_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INGRES_NUM", II_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INGRES_BOTH", II_BOTH, CONST_CS | CONST_PERSISTENT);
-
- /* Ingres api initialization */
- initParm.in_timeout = -1; /* timeout in ms, -1 = no timeout */
- initParm.in_version = IIAPI_VERSION_1; /* api version used */
-
- IIapi_initialize(&initParm);
- if (initParm.in_status == IIAPI_ST_SUCCESS) {
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-/* Module shutdown
-*/
-PHP_MSHUTDOWN_FUNCTION(ii)
-{
- IIAPI_TERMPARM termParm;
-
- UNREGISTER_INI_ENTRIES();
-
- /* Ingres api termination */
- IIapi_terminate(&termParm);
- if (termParm.tm_status == IIAPI_ST_SUCCESS) {
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-/* New request initialization
-*/
-PHP_RINIT_FUNCTION(ii)
-{
- IIG(default_link) = -1;
- IIG(num_links) = IIG(num_persistent);
- return SUCCESS;
-}
-
-/* End of request
-*/
-PHP_RSHUTDOWN_FUNCTION(ii)
-{
- if (IIG(default_link) != -1) {
- zend_list_delete(IIG(default_link));
- IIG(default_link) = -1;
- }
- return SUCCESS;
-}
-
-/* Informations reported to phpinfo()
-*/
-PHP_MINFO_FUNCTION(ii)
-{
- char buf[32];
-
- php_info_print_table_start();
- php_info_print_table_header(2, "Ingres II Support", "enabled");
- sprintf(buf, "%ld", IIG(num_persistent));
- php_info_print_table_row(2, "Active Persistent Links", buf);
- sprintf(buf, "%ld", IIG(num_links));
- php_info_print_table_row(2, "Active Links", buf);
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-/* Waits for completion of the last Ingres api call
- used because of the asynchronous design of this api
-*/
-static int ii_sync(IIAPI_GENPARM *genParm)
-{
- static IIAPI_WAITPARM waitParm = {
- -1, /* no timeout, we don't want asynchronous queries */
- 0 /* wt_status (output) */
- };
-
- while (genParm->gp_completed == FALSE) {
- IIapi_wait(&waitParm);
- }
-
- if (waitParm.wt_status != IIAPI_ST_SUCCESS) {
- TSRMLS_FETCH();
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unexpected failure of IIapi_wait()");
- return 0;
- }
- return 1;
-}
-
-/* Handles errors from Ingres api
-*/
-static int ii_success(IIAPI_GENPARM *genParm)
-{
- switch (genParm->gp_status) {
-
- case IIAPI_ST_SUCCESS:
- return II_OK;
-
- case IIAPI_ST_NO_DATA:
- return II_NO_DATA;
-
- default:
- if (genParm->gp_errorHandle == NULL) { /* no error message available */
- TSRMLS_FETCH();
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Server or API error - no error message available");
- } else {
- IIAPI_GETEINFOPARM getEInfoParm;
- TSRMLS_FETCH();
-
- getEInfoParm.ge_errorHandle = genParm->gp_errorHandle;
- IIapi_getErrorInfo(&getEInfoParm);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Server or API error : %s", getEInfoParm.ge_message);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: SQLSTATE : %s", getEInfoParm.ge_SQLSTATE);
- }
- return II_FAIL;
- }
-}
-
-/* Actually handles connection creation, either persistent or not
-*/
-static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- zval **database, **username, **password;
- char *db, *user, *pass;
- int argc;
- char *hashed_details;
- int hashed_details_length;
- IIAPI_CONNPARM connParm;
- II_LINK *link;
-
- /* Setting db, user and pass according to sql_safe_mode, parameters and/or default values */
- argc = ZEND_NUM_ARGS();
-
- if (PG(sql_safe_mode)) { /* sql_safe_mode */
-
- if (argc > 0) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "SQL safe mode in effect - ignoring host/user/password information");
- }
-
- db = pass = NULL;
- user = php_get_current_user();
- hashed_details_length = strlen(user) + sizeof("ingres___") - 1;
- hashed_details = (char *) emalloc(hashed_details_length + 1);
- sprintf(hashed_details, "Ingres__%s_", user);
-
- } else { /* non-sql_safe_mode */
-
- db = IIG(default_database);
- user = IIG(default_user);
- pass = IIG(default_password);
-
- if (argc > 3 || zend_get_parameters_ex(argc, &database, &username, &password) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (argc) {
-
- case 3:
- convert_to_string_ex(password);
- pass = Z_STRVAL_PP(password);
- /* Fall-through. */
-
- case 2:
- convert_to_string_ex(username);
- user = Z_STRVAL_PP(username);
- /* Fall-through. */
-
- case 1:
- convert_to_string_ex(database);
- db = Z_STRVAL_PP(database);
- /* Fall-through. */
-
- case 0:
- break;
- }
-
- hashed_details_length = sizeof("ingres___") - 1 +
- strlen(SAFE_STRING(db)) +
- strlen(SAFE_STRING(user)) +
- strlen(SAFE_STRING(pass));
-
- hashed_details = (char *) emalloc(hashed_details_length + 1);
- sprintf(hashed_details, "Ingres_%s_%s_%s", SAFE_STRING(db), SAFE_STRING(user), SAFE_STRING(pass));
- }
-
- /* if asked for unauthorized persistency, issue a warning
- and go for a non-persistent link */
- if (persistent && !IIG(allow_persistent)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Persistent links disabled !");
- persistent = 0;
- }
-
- if (persistent) {
- list_entry *le;
-
- /* is this link already in the persistent list ? */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length + 1, (void **) &le) == FAILURE) { /* no, new persistent connection */
- list_entry new_le;
-
- if (IIG(max_links) != -1 && IIG(num_links) >= IIG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Too many open links (%d)", IIG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (IIG(max_persistent) != -1 && IIG(num_persistent) >= IIG(max_persistent)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Too many open persistent links (%d)", IIG(num_persistent));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* create the link */
- connParm.co_genParm.gp_callback = NULL;
- connParm.co_genParm.gp_closure = NULL;
- connParm.co_target = db;
- connParm.co_username = user;
- connParm.co_password = pass;
- connParm.co_timeout = -1; /* -1 is no timeout */
- connParm.co_connHandle = NULL;
- connParm.co_tranHandle = NULL;
-
- IIapi_connect(&connParm);
-
- if (!ii_sync(&(connParm.co_genParm)) || ii_success(&(connParm.co_genParm)) == II_FAIL) {
- efree(hashed_details);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to connect to database (%s)", db);
- RETURN_FALSE;
- }
-
- link = (II_LINK *) malloc(sizeof(II_LINK));
- link->connHandle = connParm.co_connHandle;
- link->tranHandle = NULL;
- link->stmtHandle = NULL;
- link->fieldCount = 0;
- link->descriptor = NULL;
- link->autocommit = 0;
-
- /* hash it up */
- Z_TYPE(new_le) = le_ii_plink;
- new_le.ptr = link;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length + 1, (void *) &new_le, sizeof(list_entry), NULL) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to hash (%s)", hashed_details);
- free(link);
- efree(hashed_details);
- RETURN_FALSE;
- }
- IIG(num_persistent)++;
- IIG(num_links)++;
-
- } else { /* already open persistent connection */
-
- if (Z_TYPE_P(le) != le_ii_plink) {
- RETURN_FALSE;
- }
- /* here we should ensure that the link did not die */
- /* unable to figure out the right way to do this */
- /* maybe does the api handle the reconnection transparently ? */
- link = (II_LINK *) le->ptr;
-
- /* Unfortunetaly NO !!!*/
- /* Ingres api doesn't reconnect */
- /* Have to reconnect if cleaning function has flagged link as broken */
- if (link->connHandle == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Ingres II: Broken link (%s),reconnect", db);
-
- /* Recreate the link */
- connParm.co_genParm.gp_callback = NULL;
- connParm.co_genParm.gp_closure = NULL;
- connParm.co_target = db;
- connParm.co_username = user;
- connParm.co_password = pass;
- connParm.co_timeout = -1; /* no timeout */
- connParm.co_connHandle = NULL;
- connParm.co_tranHandle = NULL;
-
- IIapi_connect(&connParm);
-
- if (!ii_sync(&(connParm.co_genParm)) || ii_success(&(connParm.co_genParm)) == II_FAIL) {
- efree(hashed_details);
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Ingres II: Unable to connect to database (%s)", db);
- RETURN_FALSE;
- }
-
- link->connHandle = connParm.co_connHandle;
- link->tranHandle = NULL;
- link->stmtHandle = NULL;
- link->fieldCount = 0;
- link->descriptor = NULL;
- link->autocommit = 0;
- }
- }
-
- ZEND_REGISTER_RESOURCE(return_value, link, le_ii_plink);
-
- } else { /* non persistent */
- list_entry *index_ptr, new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual link sits.
- * if it doesn't, open a new link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length + 1, (void **) &index_ptr) == SUCCESS) {
- int type;
- void *ptr;
-
- if (Z_TYPE_P(index_ptr) != le_index_ptr) {
- RETURN_FALSE;
- }
- link = (II_LINK *) index_ptr->ptr;
- ptr = zend_list_find((int) link, &type); /* check if the link is still there */
- if (ptr && (type == le_ii_link || type == le_ii_plink)) {
- zend_list_addref((int) link);
- Z_LVAL_P(return_value) = (int) link;
-
- php_ii_set_default_link((int) link TSRMLS_CC);
-
- Z_TYPE_P(return_value) = IS_RESOURCE;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length + 1);
- }
- }
- if (IIG(max_links) != -1 && IIG(num_links) >= IIG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Too many open links (%d)", IIG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* create the link */
- connParm.co_genParm.gp_callback = NULL;
- connParm.co_genParm.gp_closure = NULL;
- connParm.co_target = db;
- connParm.co_username = user;
- connParm.co_password = pass;
- connParm.co_timeout = -1; /* -1 is no timeout */
- connParm.co_connHandle = NULL;
- connParm.co_tranHandle = NULL;
-
- IIapi_connect(&connParm);
-
- if (!ii_sync(&(connParm.co_genParm)) || ii_success(&(connParm.co_genParm)) == II_FAIL) {
- efree(hashed_details);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to connect to database (%s)", db);
- RETURN_FALSE;
- }
-
- link = (II_LINK *) malloc(sizeof(II_LINK));
- link->connHandle = connParm.co_connHandle;
- link->tranHandle = NULL;
- link->stmtHandle = NULL;
- link->fieldCount = 0;
- link->descriptor = NULL;
- link->autocommit = 0;
-
- /* add it to the list */
- ZEND_REGISTER_RESOURCE(return_value, link, le_ii_link);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
- Z_TYPE(new_index_ptr) = le_index_ptr;
- if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length + 1, (void *) &new_index_ptr, sizeof(list_entry), NULL) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to hash (%s)", hashed_details);
- free(link);
- efree(hashed_details);
- RETURN_FALSE;
- }
- IIG(num_links)++;
- }
-
- efree(hashed_details);
- php_ii_set_default_link(Z_LVAL_P(return_value) TSRMLS_CC);
-}
-
-/* {{{ proto resource ingres_connect([string database [, string username [, string password]]])
- Open a connection to an Ingres II database the syntax of database is [node_id::]dbname[/svr_class] */
-PHP_FUNCTION(ingres_connect)
-{
- php_ii_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto resource ingres_pconnect([string database [, string username [, string password]]])
- Open a persistent connection to an Ingres II database the syntax of database is [node_id::]dbname[/svr_class] */
-PHP_FUNCTION(ingres_pconnect)
-{
- php_ii_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto bool ingres_close([resource link])
- Close an Ingres II database connection */
-PHP_FUNCTION(ingres_close)
-{
- zval **link = NULL;
- int link_id = -1;
- II_LINK *ii_link;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- link_id = IIG(default_link);
- break;
-
- case 1:
- if (zend_get_parameters_ex(1, &link) == FAILURE) {
- RETURN_FALSE;
- }
- link_id = -1;
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- /* Call the clean function synchronously here */
- /* Otherwise we have to wait for request shutdown */
- /* This way we can reuse the link in the same script */
- _ai_clean_ii_plink(ii_link TSRMLS_CC);
-
- if (link_id == -1) { /* explicit resource number */
- zend_list_delete(Z_RESVAL_PP(link));
- }
-
- if (link_id != -1 || (link && Z_RESVAL_PP(link) == IIG(default_link))) {
- zend_list_delete(IIG(default_link));
- IIG(default_link) = -1;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ingres_query(string query [, resource link])
- Send a SQL query to Ingres II */
-/* This should go into the documentation */
-/* Unsupported query types:
- - close
- - commit
- - connect
- - disconnect
- - get dbevent
- - prepare to commit
- - rollback
- - savepoint
- - set autocommit
- - <all cursor related queries>
- (look for dedicated functions instead) */
-PHP_FUNCTION(ingres_query)
-{
- zval **query, **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
- IIAPI_QUERYPARM queryParm;
- IIAPI_GETDESCRPARM getDescrParm;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &query, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc < 2) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- convert_to_string_ex(query);
-
- /* if there's already an active statement, close it */
- if (ii_link->stmtHandle && _close_statement(ii_link)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to close statement !!");
- RETURN_FALSE;
- }
-
- /* send the query */
- queryParm.qy_genParm.gp_callback = NULL;
- queryParm.qy_genParm.gp_closure = NULL;
- queryParm.qy_connHandle = ii_link->connHandle;
- queryParm.qy_tranHandle = ii_link->tranHandle;
- queryParm.qy_stmtHandle = NULL;
- queryParm.qy_queryType = IIAPI_QT_QUERY;
- queryParm.qy_parameters = FALSE;
- queryParm.qy_queryText = Z_STRVAL_PP(query);
-
- IIapi_query(&queryParm);
- ii_sync(&(queryParm.qy_genParm));
-
- if (ii_success(&(queryParm.qy_genParm)) == II_FAIL) {
- RETURN_FALSE;
- }
-
- /* store transaction and statement handles */
- ii_link->tranHandle = queryParm.qy_tranHandle;
- ii_link->stmtHandle = queryParm.qy_stmtHandle;
-
- /* get description of results */
- getDescrParm.gd_genParm.gp_callback = NULL;
- getDescrParm.gd_genParm.gp_closure = NULL;
- getDescrParm.gd_stmtHandle = ii_link->stmtHandle;
-
- IIapi_getDescriptor(&getDescrParm);
- ii_sync(&(getDescrParm.gd_genParm));
-
- if (ii_success(&(getDescrParm.gd_genParm)) == II_FAIL) {
- RETURN_FALSE;
- }
-
- /* store the results */
- ii_link->fieldCount = getDescrParm.gd_descriptorCount;
- ii_link->descriptor = getDescrParm.gd_descriptor;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ingres_num_rows([resource link])
- Return the number of rows affected/returned by the last query */
-
-/* Warning : don't call ingres_num_rows() before ingres_fetch_xx(),
- or ingres_fetch_xx() wouldn't find any data */
-PHP_FUNCTION(ingres_num_rows)
-{
- zval **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
- IIAPI_GETQINFOPARM getQInfoParm;
-
- argc = ZEND_NUM_ARGS();
- if (argc > 1 || zend_get_parameters_ex(argc, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc < 1) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- /* get number of affected rows */
- getQInfoParm.gq_genParm.gp_callback = NULL;
- getQInfoParm.gq_genParm.gp_closure = NULL;
- getQInfoParm.gq_stmtHandle = ii_link->stmtHandle;
-
- IIapi_getQueryInfo(&getQInfoParm);
- ii_sync(&(getQInfoParm.gq_genParm));
-
- if (ii_success(&(getQInfoParm.gq_genParm)) == II_FAIL) {
- RETURN_FALSE;
- }
-
- /* return the result */
- if (getQInfoParm.gq_mask & IIAPI_GQ_ROW_COUNT) {
- RETURN_LONG(getQInfoParm.gq_rowCount);
- } else {
- RETURN_LONG(0);
- }
-}
-/* }}} */
-
-/* {{{ proto int ingres_num_fields([resource link])
- Return the number of fields returned by the last query */
-PHP_FUNCTION(ingres_num_fields)
-{
- zval **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
-
- argc = ZEND_NUM_ARGS();
- if (argc > 1 || zend_get_parameters_ex(argc, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc < 1) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- RETURN_LONG(ii_link->fieldCount);
-}
-/* }}} */
-
-#define II_FIELD_INFO_NAME 1
-#define II_FIELD_INFO_TYPE 2
-#define II_FIELD_INFO_NULLABLE 3
-#define II_FIELD_INFO_LENGTH 4
-#define II_FIELD_INFO_PRECISION 5
-#define II_FIELD_INFO_SCALE 6
-
-/* Return information about a field in a query result
-*/
-static void php_ii_field_info(INTERNAL_FUNCTION_PARAMETERS, int info_type)
-{
- zval **idx, **link;
- int argc;
- int link_id = -1;
- char *name, *fun_name;
- int index;
- II_LINK *ii_link;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &idx, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc < 2) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- convert_to_long_ex(idx);
- index = Z_LVAL_PP(idx);
-
- if (index < 1 || index > ii_link->fieldCount) {
- switch (info_type) {
-
- case II_FIELD_INFO_NAME:
- fun_name = "ii_field_name";
- break;
-
- case II_FIELD_INFO_TYPE:
- fun_name = "ii_field_type";
- break;
-
- case II_FIELD_INFO_NULLABLE:
- fun_name = "ii_field_nullable";
- break;
-
- case II_FIELD_INFO_LENGTH:
- fun_name = "ii_field_length";
- break;
-
- case II_FIELD_INFO_PRECISION:
- fun_name = "ii_field_precision";
- break;
-
- case II_FIELD_INFO_SCALE:
- fun_name = "ii_field_scale";
- break;
-
- default:
- fun_name = "foobar";
- break;
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: %s() called with wrong index (%d)", fun_name, index);
- RETURN_FALSE;
- }
-
- switch (info_type) {
-
- case II_FIELD_INFO_NAME:
- name = php_ii_field_name(ii_link, index TSRMLS_CC);
- if (name == NULL) {
- RETURN_FALSE;
- }
- RETURN_STRING(name, 1);
- break;
-
- case II_FIELD_INFO_TYPE:
- switch ((ii_link->descriptor[index - 1]).ds_dataType) {
-
- case IIAPI_BYTE_TYPE:
- RETURN_STRING("IIAPI_BYTE_TYPE", 1);
-
- case IIAPI_CHA_TYPE:
- RETURN_STRING("IIAPI_CHA_TYPE", 1);
-
- case IIAPI_CHR_TYPE:
- RETURN_STRING("IIAPI_CHR_TYPE", 1);
-
- case IIAPI_DEC_TYPE:
- RETURN_STRING("IIAPI_DEC_TYPE", 1);
-
- case IIAPI_DTE_TYPE:
- RETURN_STRING("IIAPI_DTE_TYPE", 1);
-
- case IIAPI_FLT_TYPE:
- RETURN_STRING("IIAPI_FLT_TYPE", 1);
-
- case IIAPI_INT_TYPE:
- RETURN_STRING("IIAPI_INT_TYPE", 1);
-
- case IIAPI_LOGKEY_TYPE:
- RETURN_STRING("IIAPI_LOGKEY_TYPE", 1);
-
- case IIAPI_LBYTE_TYPE:
- RETURN_STRING("IIAPI_LBYTE_TYPE", 1);
-
- case IIAPI_LVCH_TYPE:
- RETURN_STRING("IIAPI_LVCH_TYPE", 1);
-
- case IIAPI_MNY_TYPE:
- RETURN_STRING("IIAPI_MNY_TYPE", 1);
-
- case IIAPI_TABKEY_TYPE:
- RETURN_STRING("IIAPI_TABKEY_TYPE", 1);
-
- case IIAPI_TXT_TYPE:
- RETURN_STRING("IIAPI_TXT_TYPE", 1);
-
- case IIAPI_VBYTE_TYPE:
- RETURN_STRING("IIAPI_VBYTE_TYPE", 1);
-
- case IIAPI_VCH_TYPE:
- RETURN_STRING("IIAPI_VCH_TYPE", 1);
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unknown Ingres data type");
- RETURN_FALSE;
- break;
- }
- break;
-
- case II_FIELD_INFO_NULLABLE:
- if ((ii_link->descriptor[index - 1]).ds_nullable) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
- break;
-
- case II_FIELD_INFO_LENGTH:
- RETURN_LONG((ii_link->descriptor[index - 1]).ds_length);
- break;
-
- case II_FIELD_INFO_PRECISION:
- RETURN_LONG((ii_link->descriptor[index - 1]).ds_precision);
- break;
-
- case II_FIELD_INFO_SCALE:
- RETURN_LONG((ii_link->descriptor[index - 1]).ds_scale);
- break;
-
- default:
- RETURN_FALSE;
- }
-}
-
-/* Return the name of a field in a query result
-*/
-static char *php_ii_field_name(II_LINK *ii_link, int index TSRMLS_DC)
-{
- if (index < 1 || index > ii_link->fieldCount) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: php_ii_field_name() called with wrong index (%d)", index);
- return NULL;
- }
-
- return (ii_link->descriptor[index - 1]).ds_columnName;
-}
-
-/* {{{ proto string ingres_field_name(int index [, resource link])
- Return the name of a field in a query result index must be >0 and <= ingres_num_fields() */
-PHP_FUNCTION(ingres_field_name)
-{
- php_ii_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, II_FIELD_INFO_NAME);
-}
-/* }}} */
-
-/* {{{ proto string ingres_field_type(int index [, resource link])
- Return the type of a field in a query result index must be >0 and <= ingres_num_fields() */
-PHP_FUNCTION(ingres_field_type)
-{
- php_ii_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, II_FIELD_INFO_TYPE);
-}
-/* }}} */
-
-/* {{{ proto string ingres_field_nullable(int index [, resource link])
- Return true if the field is nullable and false otherwise index must be >0 and <= ingres_num_fields() */
-PHP_FUNCTION(ingres_field_nullable)
-{
- php_ii_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, II_FIELD_INFO_NULLABLE);
-}
-/* }}} */
-
-/* {{{ proto string ingres_field_length(int index [, resource link])
- Return the length of a field in a query result index must be >0 and <= ingres_num_fields() */
-PHP_FUNCTION(ingres_field_length)
-{
- php_ii_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, II_FIELD_INFO_LENGTH);
-}
-/* }}} */
-
-/* {{{ proto string ingres_field_precision(int index [, resource link])
- Return the precision of a field in a query result index must be >0 and <= ingres_num_fields() */
-PHP_FUNCTION(ingres_field_precision)
-{
- php_ii_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, II_FIELD_INFO_PRECISION);
-}
-/* }}} */
-
-/* {{{ proto string ingres_field_scale(int index [, resource link])
- Return the scale of a field in a query result index must be >0 and <= ingres_num_fields() */
-PHP_FUNCTION(ingres_field_scale)
-{
- php_ii_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, II_FIELD_INFO_SCALE);
-}
-/* }}} */
-
-
-/* Convert complex Ingres data types to php-usable ones
-*/
-#define IIAPI_CONVERT(destType, destSize, precision) {\
- convertParm.cv_srcDesc.ds_dataType = (ii_link->descriptor[i+k-2]).ds_dataType;\
- convertParm.cv_srcDesc.ds_nullable = (ii_link->descriptor[i+k-2]).ds_nullable;\
- convertParm.cv_srcDesc.ds_length = (ii_link->descriptor[i+k-2]).ds_length;\
- convertParm.cv_srcDesc.ds_precision = (ii_link->descriptor[i+k-2]).ds_precision;\
- convertParm.cv_srcDesc.ds_scale = (ii_link->descriptor[i+k-2]).ds_scale;\
- convertParm.cv_srcDesc.ds_columnType = (ii_link->descriptor[i+k-2]).ds_columnType;\
- convertParm.cv_srcDesc.ds_columnName = (ii_link->descriptor[i+k-2]).ds_columnName;\
- convertParm.cv_srcValue.dv_null = columnData[k-1].dv_null;\
- convertParm.cv_srcValue.dv_length = columnData[k-1].dv_length;\
- convertParm.cv_srcValue.dv_value = columnData[k-1].dv_value;\
- convertParm.cv_dstDesc.ds_dataType = destType;\
- convertParm.cv_dstDesc.ds_nullable = FALSE;\
- convertParm.cv_dstDesc.ds_length = destSize;\
- convertParm.cv_dstDesc.ds_precision = precision;\
- convertParm.cv_dstDesc.ds_scale = 0;\
- convertParm.cv_dstDesc.ds_columnType = IIAPI_COL_TUPLE;\
- convertParm.cv_dstDesc.ds_columnName = NULL;\
- convertParm.cv_dstValue.dv_null = FALSE;\
- convertParm.cv_dstValue.dv_length = convertParm.cv_dstDesc.ds_length;\
- convertParm.cv_dstValue.dv_value = emalloc(convertParm.cv_dstDesc.ds_length+1);\
-\
- IIapi_convertData(&convertParm);\
-\
- if(ii_success(&(getColParm.gc_genParm))!=II_OK) {\
- RETURN_FALSE;\
- }\
-\
- columnData[k-1].dv_length = convertParm.cv_dstValue.dv_length;\
- columnData[k-1].dv_value = convertParm.cv_dstValue.dv_value;\
- efree(convertParm.cv_srcValue.dv_value);\
-}
-
-
-/* Fetch a row of result
-*/
-static void php_ii_fetch(INTERNAL_FUNCTION_PARAMETERS, II_LINK *ii_link, int result_type)
-{
- IIAPI_GETCOLPARM getColParm;
- IIAPI_DATAVALUE *columnData;
- IIAPI_CONVERTPARM convertParm;
- int i, j, k;
- int more;
- double value_double = 0;
- long value_long = 0;
- char *value_char_p;
- int len, should_copy, correct_length;
-
- /* array initialization */
- array_init(return_value);
-
- /* going through all fields */
- for (i = 1; i <= ii_link->fieldCount;) {
- j = 1;
-
- /* as long as there are no long byte or long varchar fields,
- Ingres is able to fetch many fields at a time, so try to find
- these types and stop if they're found.
- variable j will get number of fields to fetch */
- if ((ii_link->descriptor[i]).ds_dataType != IIAPI_LBYTE_TYPE &&
- (ii_link->descriptor[i]).ds_dataType != IIAPI_LVCH_TYPE) {
- while ( (ii_link->descriptor[i + j - 1]).ds_dataType != IIAPI_LBYTE_TYPE &&
- (ii_link->descriptor[i + j - 1]).ds_dataType != IIAPI_LVCH_TYPE &&
- i + j <= ii_link->fieldCount) {
- j++;
- }
- }
-
- /* allocate memory for j fields */
- columnData = (IIAPI_DATAVALUE *) emalloc(j * sizeof(IIAPI_DATAVALUE));
- for (k = 1; k <= j; k++) {
- columnData[k - 1].dv_value = (II_PTR) emalloc((ii_link->descriptor[i + k - 2]).ds_length);
- }
-
- more = 1; /* this is for multi segment LBYTE and LVCH elements */
-
- while (more) {
- getColParm.gc_genParm.gp_callback = NULL;
- getColParm.gc_genParm.gp_closure = NULL;
- getColParm.gc_rowCount = 1;
- getColParm.gc_columnCount = j;
- getColParm.gc_columnData = columnData;
- getColParm.gc_stmtHandle = ii_link->stmtHandle;
- getColParm.gc_moreSegments = 0;
-
- IIapi_getColumns(&getColParm);
- ii_sync(&(getColParm.gc_genParm));
-
- if (ii_success(&(getColParm.gc_genParm)) != II_OK) {
- RETURN_FALSE;
- }
-
- more = getColParm.gc_moreSegments;
-
- if (more) { /* more segments of LBYTE or LVCH element to come */
-
- /* Multi segment LBYTE and LVCH elements not supported yet */
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Ingres II: Multi segment LBYTE and LVCH elements not supported yet");
-
- } else {
-
- for (k = 1; k <= j; k++) {
- if (columnData[k - 1].dv_null) { /* NULL value ? */
-
- if (result_type & II_NUM) {
- add_index_null(return_value, i + k - 1);
- }
- if (result_type & II_ASSOC) {
- add_assoc_null(return_value, php_ii_field_name(ii_link, i + k - 1 TSRMLS_CC));
- }
-
- } else { /* non NULL value */
- correct_length = 0;
-
- switch ((ii_link->descriptor[i + k - 2]).ds_dataType) {
-
- case IIAPI_DEC_TYPE: /* decimal (fixed point number) */
- case IIAPI_MNY_TYPE: /* money */
- /* convert to floating point number */
- IIAPI_CONVERT(IIAPI_FLT_TYPE, sizeof(II_FLOAT8), 53);
- /* NO break */
-
- case IIAPI_FLT_TYPE: /* floating point number */
- switch (columnData[k - 1].dv_length) {
-
- case 4:
- value_double = (double) *((II_FLOAT4 *) columnData[k - 1].dv_value);
- break;
-
- case 8:
- value_double = (double) *((II_FLOAT8 *) columnData[k - 1].dv_value);
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Invalid size for IIAPI_FLT_TYPE data (%d)", columnData[k - 1].dv_length);
- break;
- }
-
- if (result_type & II_NUM) {
- add_index_double(return_value, i + k - 1, value_double);
- }
-
- if (result_type & II_ASSOC) {
- add_assoc_double(return_value, php_ii_field_name(ii_link, i + k - 1 TSRMLS_CC), value_double);
- }
- break;
-
- case IIAPI_INT_TYPE: /* integer */
- switch (columnData[k - 1].dv_length) {
-
- case 1:
- value_long = (long) *((II_INT1 *) columnData[k - 1].dv_value);
- break;
-
- case 2:
- value_long = (long) *((II_INT2 *) columnData[k - 1].dv_value);
- break;
-
- case 4:
- value_long = (long) *((II_INT4 *) columnData[k - 1].dv_value);
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Invalid size for IIAPI_INT_TYPE data (%d)", columnData[k - 1].dv_length);
- break;
- }
-
- if (result_type & II_NUM) {
- add_index_long(return_value, i + k - 1, value_long);
- }
-
- if (result_type & II_ASSOC) {
- add_assoc_long(return_value, php_ii_field_name(ii_link, i + k - 1 TSRMLS_CC), value_long);
- }
- break;
-
- case IIAPI_TXT_TYPE: /* variable length character string */
- case IIAPI_VBYTE_TYPE: /* variable length binary string */
- case IIAPI_VCH_TYPE: /* variable length character string */
- /* real length is stored in first 2 bytes of data, so adjust
- length variable and data pointer */
- columnData[k - 1].dv_length = *((II_INT2 *) columnData[k - 1].dv_value);
- ((II_INT2 *) columnData[k - 1].dv_value)++;
- correct_length = 1;
- /* NO break */
-
- case IIAPI_BYTE_TYPE: /* fixed length binary string */
- case IIAPI_CHA_TYPE: /* fixed length character string */
- case IIAPI_CHR_TYPE: /* fixed length character string */
- case IIAPI_LOGKEY_TYPE: /* value unique to database */
- case IIAPI_TABKEY_TYPE: /* value unique to table */
- case IIAPI_DTE_TYPE: /* date */
- /* eventualy convert date to string */
- if ((ii_link->descriptor[i + k - 2]).
- ds_dataType == IIAPI_DTE_TYPE) {
- IIAPI_CONVERT(IIAPI_CHA_TYPE, 32, 0);
- }
-
- /* use php_addslashes if asked to */
- if (PG(magic_quotes_runtime)) {
- value_char_p = php_addslashes((char *) columnData[k - 1].dv_value, columnData[k - 1].dv_length, &len, 0 TSRMLS_CC);
- should_copy = 0;
- } else {
- value_char_p = (char *) columnData[k - 1].dv_value;
- len = columnData[k - 1].dv_length;
- should_copy = 1;
- }
-
- if (result_type & II_NUM) {
- add_index_stringl(return_value, i + k - 1, value_char_p, len, should_copy);
- }
-
- if (result_type & II_ASSOC) {
- add_assoc_stringl(return_value, php_ii_field_name(ii_link, i + k - 1 TSRMLS_CC), value_char_p, len, should_copy);
- }
-
- /* eventualy restore data pointer state for
- variable length data types */
- if (correct_length) {
- ((II_INT2 *) columnData[k - 1].dv_value)--;
- }
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Invalid SQL data type in fetched field (%d -- length : %d)", (ii_link->descriptor[i + k - 2]).ds_dataType, columnData[k - 1].dv_length);
- break;
- }
- }
- }
- }
- }
-
- /* free the memory buffers */
- for (k = 1; k <= j; k++) {
- efree(columnData[k - 1].dv_value);
- }
- efree(columnData);
-
- /* increase field pointer by number of fetched fields */
- i += j;
- }
-}
-
-/* {{{ proto array ingres_fetch_array([int result_type [, resource link]])
- Fetch a row of result into an array result_type can be II_NUM for enumerated array, II_ASSOC for associative array, or II_BOTH (default) */
-PHP_FUNCTION(ingres_fetch_array)
-{
- zval **result_type, **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
-
- argc = ZEND_NUM_ARGS();
- if (argc > 2 || zend_get_parameters_ex(argc, &result_type, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc != 2) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
-
- if (argc != 0) {
- convert_to_long_ex(result_type);
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- php_ii_fetch(INTERNAL_FUNCTION_PARAM_PASSTHRU, ii_link, (argc == 0 ? II_BOTH : Z_LVAL_PP(result_type)));
-}
-/* }}} */
-
-/* {{{ proto array ingres_fetch_row([resource link])
- Fetch a row of result into an enumerated array */
-PHP_FUNCTION(ingres_fetch_row)
-{
- zval **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
-
- argc = ZEND_NUM_ARGS();
- if (argc > 1 || zend_get_parameters_ex(argc, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc != 1) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- php_ii_fetch(INTERNAL_FUNCTION_PARAM_PASSTHRU, ii_link, II_NUM);
-}
-/* }}} */
-
-/* {{{ proto array ingres_fetch_object([int result_type [, resource link]])
- Fetch a row of result into an object result_type can be II_NUM for enumerated object, II_ASSOC for associative object, or II_BOTH (default) */
-PHP_FUNCTION(ingres_fetch_object)
-{
- zval **result_type, **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
-
- argc = ZEND_NUM_ARGS();
- if (argc > 2 || zend_get_parameters_ex(argc, &result_type, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc != 2) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
-
- if (argc != 0) {
- convert_to_long_ex(result_type);
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- php_ii_fetch(INTERNAL_FUNCTION_PARAM_PASSTHRU, ii_link, (argc == 0 ? II_BOTH : Z_LVAL_PP(result_type)));
-
- if (Z_TYPE_P(return_value) == IS_ARRAY) {
- convert_to_object(return_value);
- }
-}
-/* }}} */
-
-/* {{{ proto bool ingres_rollback([resource link])
- Roll back a transaction */
-PHP_FUNCTION(ingres_rollback)
-{
- zval **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
-
- argc = ZEND_NUM_ARGS();
- if (argc > 1 || (argc && zend_get_parameters_ex(argc, &link) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 0) {
- link_id = IIG(default_link);
- }
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- if (_rollback_transaction(ii_link TSRMLS_CC)) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ingres_commit([resource link])
- Commit a transaction */
-PHP_FUNCTION(ingres_commit)
-{
- zval **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
- IIAPI_COMMITPARM commitParm;
-
- argc = ZEND_NUM_ARGS();
- if (argc > 1 || (argc && zend_get_parameters_ex(argc, &link) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 0) {
- link_id = IIG(default_link);
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- if (ii_link->stmtHandle && _close_statement(ii_link)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to close statement !!");
- RETURN_FALSE;
- }
-
- commitParm.cm_genParm.gp_callback = NULL;
- commitParm.cm_genParm.gp_closure = NULL;
- commitParm.cm_tranHandle = ii_link->tranHandle;
-
- IIapi_commit(&commitParm);
- ii_sync(&(commitParm.cm_genParm));
-
- if (ii_success(&(commitParm.cm_genParm)) == II_FAIL) {
- RETURN_FALSE;
- }
-
- ii_link->tranHandle = NULL;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ingres_autocommit([resource link])
- Switch autocommit on or off */
-PHP_FUNCTION(ingres_autocommit)
-{
- zval **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
- IIAPI_AUTOPARM autoParm;
-
- argc = ZEND_NUM_ARGS();
- if (argc > 1 || (argc && zend_get_parameters_ex(argc, &link) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 0) {
- link_id = IIG(default_link);
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- autoParm.ac_genParm.gp_callback = NULL;
- autoParm.ac_genParm.gp_closure = NULL;
- autoParm.ac_connHandle = ii_link->connHandle;
- autoParm.ac_tranHandle = ii_link->tranHandle;
-
- IIapi_autocommit(&autoParm);
- ii_sync(&(autoParm.ac_genParm));
-
- if (ii_success(&(autoParm.ac_genParm)) == II_FAIL) {
- RETURN_FALSE;
- }
-
- ii_link->autocommit = (ii_link->autocommit ? 0 : 1);
- ii_link->tranHandle = autoParm.ac_tranHandle;
- RETURN_TRUE;
-}
-/* }}} */
-
-#endif /* HAVE_II */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/ingres_ii/ii.h b/ext/ingres_ii/ii.h
deleted file mode 100644
index 0ca02b2853..0000000000
--- a/ext/ingres_ii/ii.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Contributed by ECL IP'S Software & Services |
- | http://www.eclips-software.com |
- | mailto://idev@eclips-software.com |
- | Author: David Hénot <henot@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef II_H
-#define II_H
-
-#if HAVE_II
-#include "php_ii.h"
-#include "iiapi.h"
-
-typedef struct _II_LINK {
- int autocommit;
- II_PTR connHandle;
- II_PTR tranHandle;
- II_PTR stmtHandle;
- II_LONG fieldCount;
- IIAPI_DESCRIPTOR *descriptor;
-} II_LINK;
-
-static int ii_sync(IIAPI_GENPARM *genParm);
-static int ii_success(IIAPI_GENPARM *genParm);
-#define II_FAIL 0
-#define II_OK 1
-#define II_NO_DATA 2
-static int _close_statement(II_LINK *link);
-static int _rollback_transaction(II_LINK *link TSRMLS_DC);
-static void _close_ii_link(II_LINK *link TSRMLS_DC);
-static void _close_ii_plink(zend_rsrc_list_entry *link TSRMLS_DC);
-static int php_ii_get_default_link(INTERNAL_FUNCTION_PARAMETERS);
-static void php_ii_set_default_link(int id TSRMLS_DC);
-static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent);
-static char *php_ii_field_name(II_LINK *ii_link, int index TSRMLS_DC);
-static void php_ii_field_info(INTERNAL_FUNCTION_PARAMETERS, int info_type);
-static void php_ii_fetch(INTERNAL_FUNCTION_PARAMETERS, II_LINK *ii_link, int result_type);
-
-#endif /* HAVE_II */
-#endif /* II_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/ingres_ii/ingres.dsp b/ext/ingres_ii/ingres.dsp
deleted file mode 100644
index c3815ac63a..0000000000
--- a/ext/ingres_ii/ingres.dsp
+++ /dev/null
@@ -1,111 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ingres" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ingres - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ingres.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ingres.mak" CFG="ingres - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ingres - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ingres - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ingres - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INGRES_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_INGRES_II" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_II=1 /D ZTS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib oiapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ingres.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ingres - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INGRES_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_INGRES_II" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_II=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib oiapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ingres.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "ingres - Win32 Release_TS"
-# Name "ingres - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ii.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\ii.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_ii.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/ingres_ii/php_ii.h b/ext/ingres_ii/php_ii.h
deleted file mode 100644
index 2c0acb51e9..0000000000
--- a/ext/ingres_ii/php_ii.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Contributed by ECL IP'S Software & Services |
- | http://www.eclips-software.com |
- | mailto://idev@eclips-software.com |
- | Author: David Hénot <henot@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_II_H
-#define PHP_II_H
-
-#if HAVE_II
-
-extern zend_module_entry ingres_ii_module_entry;
-#define phpext_ingres_ii_ptr &ingres_ii_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_II_API __declspec(dllexport)
-#else
-#define PHP_II_API
-#endif
-
-PHP_MINIT_FUNCTION(ii);
-PHP_MSHUTDOWN_FUNCTION(ii);
-PHP_RINIT_FUNCTION(ii);
-PHP_RSHUTDOWN_FUNCTION(ii);
-PHP_MINFO_FUNCTION(ii);
-
-PHP_FUNCTION(ingres_connect);
-PHP_FUNCTION(ingres_pconnect);
-PHP_FUNCTION(ingres_close);
-PHP_FUNCTION(ingres_query);
-PHP_FUNCTION(ingres_num_rows);
-PHP_FUNCTION(ingres_num_fields);
-PHP_FUNCTION(ingres_field_name);
-PHP_FUNCTION(ingres_field_type);
-PHP_FUNCTION(ingres_field_nullable);
-PHP_FUNCTION(ingres_field_length);
-PHP_FUNCTION(ingres_field_precision);
-PHP_FUNCTION(ingres_field_scale);
-PHP_FUNCTION(ingres_fetch_array);
-PHP_FUNCTION(ingres_fetch_row);
-PHP_FUNCTION(ingres_fetch_object);
-PHP_FUNCTION(ingres_rollback);
-PHP_FUNCTION(ingres_commit);
-PHP_FUNCTION(ingres_autocommit);
-
-ZEND_BEGIN_MODULE_GLOBALS(ii)
- long allow_persistent;
- long max_persistent;
- long max_links;
- char *default_database;
- char *default_user;
- char *default_password;
-
- long num_persistent;
- long num_links;
- long default_link;
-ZEND_END_MODULE_GLOBALS(ii)
-
-#define II_ASSOC (1<<0)
-#define II_NUM (1<<1)
-#define II_BOTH (II_ASSOC|II_NUM)
-
-#ifdef ZTS
-#define IIG(v) TSRMG(ii_globals_id, zend_ii_globals *, v)
-#else
-#define IIG(v) (ii_globals.v)
-#endif
-
-#else
-
-#define phpext_ii_ptr NULL
-
-#endif
-
-#endif /* PHP_II_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/interbase/CREDITS b/ext/interbase/CREDITS
deleted file mode 100644
index 2decd031dd..0000000000
--- a/ext/interbase/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-InterBase
-Jouni Ahto, Andrew Avdeev
diff --git a/ext/interbase/config.m4 b/ext/interbase/config.m4
deleted file mode 100644
index 654924ac23..0000000000
--- a/ext/interbase/config.m4
+++ /dev/null
@@ -1,39 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(interbase,for InterBase support,
-[ --with-interbase[=DIR] Include InterBase support. DIR is the InterBase base
- install directory, defaults to /usr/interbase])
-
-if test "$PHP_INTERBASE" != "no"; then
- if test "$PHP_INTERBASE" = "yes"; then
- IBASE_INCDIR=/usr/interbase/include
- IBASE_LIBDIR=/usr/interbase/lib
- else
- IBASE_INCDIR=$PHP_INTERBASE/include
- IBASE_LIBDIR=$PHP_INTERBASE/lib
- fi
-
- PHP_CHECK_LIBRARY(gds, isc_detach_database,
- [
- IBASE_LIBNAME=gds
- ], [
- PHP_CHECK_LIBRARY(ib_util, isc_detach_database,
- [
- IBASE_LIBNAME=ib_util
- ], [
- AC_MSG_ERROR([libgds or libib_util not found! Check config.log for more information.])
- ], [
- -L$IBASE_LIBDIR
- ])
- ], [
- -L$IBASE_LIBDIR
- ])
-
- PHP_ADD_LIBRARY_WITH_PATH($IBASE_LIBNAME, $IBASE_LIBDIR, INTERBASE_SHARED_LIBADD)
- PHP_ADD_INCLUDE($IBASE_INCDIR)
- AC_DEFINE(HAVE_IBASE,1,[ ])
- PHP_NEW_EXTENSION(interbase, interbase.c, $ext_shared)
- PHP_SUBST(INTERBASE_SHARED_LIBADD)
-fi
diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c
deleted file mode 100644
index d77a126478..0000000000
--- a/ext/interbase/interbase.c
+++ /dev/null
@@ -1,3130 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jouni Ahto <jouni.ahto@exdec.fi> |
- | Andrew Avdeev <andy@rsc.mv.ru> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-
-/* TODO: Arrays, roles?
-A lot... */
-
-/*
- Changes:
- 2001-05-31: Jeremy Bettis <jeremy@deadbeef.com>
- - If a blob handle was expected and something else was
- received create a blob and add the value to it.
- - If the incoming argument to a bind parameter is NULL
- then store a NULL in the database.
- - More verbose date errors.
- 1999-09-21: Ivo Panacek <ivop@regionet.cz>
- - added COMPILE_DL section
- - more verbose php_info_ibase function
- mostly stolen from pgsql.c for now
- 1999-10-05: Ivo Panacek <ivop@regionet.cz>
- - safe rinit/rfinish: check for NULL so
- rfinish could be called repeatedly
- emalloc & co. replaced with malloc & co.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/php_standard.h"
-#include "php_globals.h"
-#include "php_interbase.h"
-
-#if HAVE_IBASE
-#include <ibase.h>
-#include <time.h>
-#include "ext/standard/fsock.h"
-#include "ext/standard/info.h"
-
-#ifdef SQL_INT64
-#include <math.h>
-#endif
-
-#ifndef SQL_DIALECT_CURRENT
-#define SQL_DIALECT_CURRENT 1
-#endif
-
-/*
-#define IBDEBUG(a) php_printf("::: %s (%d)\n", a, __LINE__);
-*/
-#define IBDEBUG(a)
-
-#define SAFE_STRING(s) ((s)?(s):"")
-
-/* {{{ extension definition structures */
-function_entry ibase_functions[] = {
- PHP_FE(ibase_connect, NULL)
- PHP_FE(ibase_pconnect, NULL)
- PHP_FE(ibase_close, NULL)
- PHP_FE(ibase_query, NULL)
- PHP_FE(ibase_fetch_row, NULL)
- PHP_FE(ibase_fetch_assoc, NULL)
- PHP_FE(ibase_fetch_object, NULL)
- PHP_FE(ibase_free_result, NULL)
- PHP_FE(ibase_prepare, NULL)
- PHP_FE(ibase_execute, NULL)
- PHP_FE(ibase_free_query, NULL)
-#if HAVE_STRFTIME
- PHP_FE(ibase_timefmt, NULL)
-#endif
-
- PHP_FE(ibase_num_fields, NULL)
- PHP_FE(ibase_field_info, NULL)
-
- PHP_FE(ibase_trans, NULL)
- PHP_FE(ibase_commit, NULL)
- PHP_FE(ibase_rollback, NULL)
-
- PHP_FE(ibase_blob_info, NULL)
- PHP_FE(ibase_blob_create, NULL)
- PHP_FE(ibase_blob_add, NULL)
- PHP_FE(ibase_blob_cancel, NULL)
- PHP_FE(ibase_blob_close, NULL)
- PHP_FE(ibase_blob_open, NULL)
- PHP_FE(ibase_blob_get, NULL)
- PHP_FE(ibase_blob_echo, NULL)
- PHP_FE(ibase_blob_import, NULL)
- PHP_FE(ibase_errmsg, NULL)
-
-#ifdef SQL_DIALECT_V6
- PHP_FE(ibase_add_user, NULL)
- PHP_FE(ibase_modify_user, NULL)
- PHP_FE(ibase_delete_user, NULL)
-#endif
- {NULL, NULL, NULL}
-};
-
-zend_module_entry ibase_module_entry = {
- STANDARD_MODULE_HEADER,
- "interbase",
- ibase_functions,
- PHP_MINIT(ibase),
- PHP_MSHUTDOWN(ibase),
- PHP_RINIT(ibase),
- PHP_RSHUTDOWN(ibase),
- PHP_MINFO(ibase),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_INTERBASE
-ZEND_GET_MODULE(ibase)
-#define DL_MALLOC(size) malloc(size)
-#define DL_STRDUP(str) strdup(str)
-#define DL_FREE(ptr) free(ptr)
-#else
-#define DL_MALLOC(size) emalloc(size)
-#define DL_STRDUP(str) estrdup(str)
-#define DL_FREE(ptr) efree(ptr)
-#endif
-
-/* True globals, no need for thread safety */
-static int le_blob, le_link, le_plink, le_result, le_query, le_trans;
-
-ZEND_DECLARE_MODULE_GLOBALS(ibase)
-
-/* }}} */
-
-/* {{{ internal macros, functions and structures */
-
-#define IB_STATUS (IBG(status))
-
-/* Fill ib_link and trans_n with the correct database link and transaction slot number.
- */
-static void get_link_trans(INTERNAL_FUNCTION_PARAMETERS, zval **link_id, ibase_db_link **ib_link, int *trans_n, int *trans_id)
-{
- int type;
- void *resource = NULL;
- ibase_tr_link *ib_trans;
-
- IBDEBUG("Transaction or database link?");
- if ((resource = zend_list_find(Z_LVAL_PP(link_id), &type))) {
- IBDEBUG("Found in list");
- if (type == le_trans) {
- /* Transaction resource. Fetch it, database link resource
- is stored in ib_trans->link_rsrc. */
- IBDEBUG("Type is le_trans");
- *trans_id = (Z_LVAL_PP(link_id));
- ZEND_FETCH_RESOURCE(ib_trans, ibase_tr_link *, link_id, -1, "InterBase transaction", le_trans);
- *trans_n = ib_trans->trans_num;
- ZEND_FETCH_RESOURCE2(resource, ibase_db_link *, NULL, ib_trans->link_rsrc, "InterBase link", le_link, le_plink);
- } else {
- IBDEBUG("Type is le_[p]link");
- /* Database link resource, use default transaction (=0). */
- *trans_n = 0;
- ZEND_FETCH_RESOURCE2(resource, ibase_db_link *, link_id, -1, "InterBase link", le_link, le_plink);
- }
- }
- *ib_link = resource;
-}
-
-#define RESET_ERRMSG { IBG(errmsg)[0] = '\0';}
-#define TEST_ERRMSG ( IBG(errmsg)[0] != '\0')
-
-/* sql variables union
- * used for convert and binding input variables
- */
-typedef struct {
- union {
- short sval;
- float fval;
- ISC_QUAD qval;
-#ifdef ISC_TIMESTAMP
- ISC_TIMESTAMP tsval;
- ISC_DATE dtval;
- ISC_TIME tmval;
-#endif
- } val;
- short sqlind;
-} BIND_BUF;
-
-/* get blob identifier from argument
- * on empty unset argument ib_blob set to NULL
- */
-#define GET_BLOB_ID_ARG(blob_arg, ib_blob)\
-{\
- if (Z_TYPE_P(blob_arg) == IS_STRING && Z_STRLEN_P(blob_arg) == 0) {\
- ib_blob = NULL;\
- } else if (Z_TYPE_P(blob_arg) != IS_STRING\
- || Z_STRLEN_P(blob_arg) != sizeof(ibase_blob_handle)\
- || ((ibase_blob_handle *)(Z_STRVAL_P(blob_arg)))->bl_handle != 0) {\
- _php_ibase_module_error("Invalid blob id");\
- RETURN_FALSE;\
- } else {\
- ib_blob = (ibase_blob_handle *)Z_STRVAL_P(blob_arg);\
- }\
-}
-
-/* get blob handle from argument
- * note: blob already open when handle active
- */
-#define GET_BLOB_HANDLE_ARG(blob_arg, blob_ptr) \
-{ \
- int type; \
- convert_to_long_ex(blob_arg); \
- blob_ptr = (ibase_blob_handle *) zend_list_find(Z_LVAL_PP(blob_arg), &type); \
- if (type!=le_blob) { \
- _php_ibase_module_error("%d is not blob handle", Z_LVAL_PP(blob_arg)); \
- RETURN_FALSE; \
- } \
-}
-
-/* blob information struct
- */
-typedef struct {
- ISC_LONG max_segment; /* Length of longest segment */
- ISC_LONG num_segments; /* Total number of segments */
- ISC_LONG total_length; /* Total length of blob */
- int bl_stream; /* blob is stream ? */
-} IBASE_BLOBINFO;
-
-/* }}} */
-
-/* error handling ---------------------------- */
-
-/* {{{ proto string ibase_errmsg(void)
- Return error message */
-PHP_FUNCTION(ibase_errmsg)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- if (IBG(errmsg[0])) {
- RETURN_STRING(IBG(errmsg), 1);
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ _php_ibase_error(TSRMLS_D)
- print interbase error and save it for ibase_errmsg() */
-static void _php_ibase_error(TSRMLS_D)
-{
- char *s;
- ISC_STATUS *statusp;
-
- s = IBG(errmsg);
- statusp = IB_STATUS;
-
- while ((s - IBG(errmsg)) < MAX_ERRMSG - (IBASE_MSGSIZE + 2) && isc_interprete(s, &statusp)) {
- strcat(IBG(errmsg), " ");
- s = IBG(errmsg) + strlen(IBG(errmsg));
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", IBG(errmsg));
-}
-/* }}} */
-
-/* {{{ _php_ibase_module_error()
- print php interbase module error and save it for ibase_errmsg() */
-static void _php_ibase_module_error(char *msg, ...)
-{
- va_list ap;
- TSRMLS_FETCH();
-
- va_start(ap, msg);
- /* vsnprintf NUL terminates the buf and writes at most n-1 chars+NUL */
- vsnprintf(IBG(errmsg), MAX_ERRMSG, msg, ap);
- va_end(ap);
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", IBG(errmsg));
-}
-/* }}} */
-
-
-/* destructors ---------------------- */
-
-/* {{{ _php_ibase_free_xsqlda() (not actual destructor)
- */
-static void _php_ibase_free_xsqlda(XSQLDA *sqlda)
-{
- int i;
- XSQLVAR *var;
-
- IBDEBUG("Free XSQLDA?");
- if (sqlda) {
- IBDEBUG("Freeing XSQLDA...");
- var = sqlda->sqlvar;
- for (i = 0; i < sqlda->sqld; i++, var++) {
- efree(var->sqldata);
- if (var->sqlind) {
- efree(var->sqlind);
- }
- }
- efree(sqlda);
- }
-}
-/* }}} */
-
-/* {{{ _php_ibase_commit_link()
- */
-static void _php_ibase_commit_link(ibase_db_link *link TSRMLS_DC)
-{
- int i;
-
- IBDEBUG("Checking transactions to close...");
- if (link->trans[0] != NULL) { /* commit default */
- IBDEBUG("Committing default transaction...");
- if (isc_commit_transaction(IB_STATUS, &link->trans[0])) {
- _php_ibase_error(TSRMLS_C);
- }
- link->trans[0] = NULL;
- }
- for (i = 1; i < IBASE_TRANS_ON_LINK; i++) {
- if (link->trans[i] != NULL) {
- IBDEBUG("Rolling back other transactions...");
- if (isc_rollback_transaction(IB_STATUS, &link->trans[i])) {
- _php_ibase_error(TSRMLS_C);
- }
- link->trans[i] = NULL;
- }
- }
-}
-/* }}} */
-
-static void php_ibase_commit_link_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- ibase_db_link *link = (ibase_db_link *) rsrc->ptr;
-
- _php_ibase_commit_link(link TSRMLS_CC);
-}
-
-/* {{{ _php_ibase_close_link()
- */
-static void _php_ibase_close_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- ibase_db_link *link = (ibase_db_link *) rsrc->ptr;
-
- _php_ibase_commit_link(link TSRMLS_CC);
- IBDEBUG("Closing normal link...");
- isc_detach_database(IB_STATUS, &link->link);
- IBG(num_links)--;
- efree(link);
-}
-/* }}} */
-
-/* {{{ _php_ibase_close_plink()
- */
-static void _php_ibase_close_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- ibase_db_link *link = (ibase_db_link *) rsrc->ptr;
-
- _php_ibase_commit_link(link TSRMLS_CC);
- IBDEBUG("Closing permanent link...");
- isc_detach_database(IB_STATUS, &link->link);
- IBG(num_persistent)--;
- IBG(num_links)--;
- free(link);
-}
-/* }}} */
-
-/* {{{ _php_ibase_free_result()
- */
-static void _php_ibase_free_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- ibase_result *ib_result = (ibase_result *) rsrc->ptr;
-
- IBDEBUG("Freeing result by dtor...");
- if (ib_result) {
- _php_ibase_free_xsqlda(ib_result->out_sqlda);
- if (ib_result->drop_stmt && ib_result->stmt) {
- IBDEBUG("Dropping statement handle (free_result dtor)...");
- isc_dsql_free_statement(IB_STATUS, &ib_result->stmt, DSQL_drop);
- } else {
- /* Shouldn't be here unless query was select and had parameter
- placeholders, in which case ibase_execute handles this???
- (Testing seems to confirm the decision was a right one.)
- */
- IBDEBUG("Closing statement handle...");
- /*
- if (isc_dsql_free_statement(IB_STATUS, &ib_result->stmt, DSQL_close)) {
- _php_ibase_error();
- }
- */
- }
- if (ib_result->out_array) {
- efree(ib_result->out_array);
- }
- efree(ib_result);
- }
-}
-/* }}} */
-
-/* {{{ _php_ibase_free_query() */
-static void _php_ibase_free_query(ibase_query *ib_query TSRMLS_DC)
-{
- IBDEBUG("Freeing query...");
- if (ib_query) {
- if (ib_query->in_sqlda) {
- efree(ib_query->in_sqlda);
- }
- if (ib_query->out_sqlda) {
- efree(ib_query->out_sqlda);
- }
- if (ib_query->stmt) {
- IBDEBUG("Dropping statement handle (free_query)...");
- if (isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_drop)) {
- _php_ibase_error(TSRMLS_C);
- }
- }
- if (ib_query->in_array) {
- efree(ib_query->in_array);
- }
- if (ib_query->out_array) {
- efree(ib_query->out_array);
- }
- efree(ib_query);
- }
-}
-/* }}} */
-
-/* {{{ php_ibase_free_query_rsrc() */
-static void php_ibase_free_query_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- ibase_query *ib_query = (ibase_query *)rsrc->ptr;
-
- IBDEBUG("Freeing query by dtor...");
- if (ib_query) {
- if (ib_query->in_sqlda) {
- efree(ib_query->in_sqlda);
- }
- if (ib_query->out_sqlda) {
- efree(ib_query->out_sqlda);
- }
- if (ib_query->stmt) {
- IBDEBUG("Dropping statement handle (free_query dtor)...");
- isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_drop);
- }
- if (ib_query->in_array) {
- efree(ib_query->in_array);
- }
- if (ib_query->out_array) {
- efree(ib_query->out_array);
- }
- efree(ib_query);
- }
-}
-/* }}} */
-
-/* {{{ _php_ibase_free_blob() */
-static void _php_ibase_free_blob(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- ibase_blob_handle *ib_blob = (ibase_blob_handle *)rsrc->ptr;
-
- if (ib_blob->bl_handle != NULL) { /* blob open*/
- if (isc_cancel_blob(IB_STATUS, &ib_blob->bl_handle)) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "You can lose data. Close any blob after reading of writing it. Use ibase_blob_close() before calling ibase_close()");
- }
- }
- efree(ib_blob);
-}
-/* }}} */
-
-/* {{{ _php_ibase_free_trans() */
-static void _php_ibase_free_trans(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- ibase_tr_link *ib_trans = (ibase_tr_link *)rsrc->ptr;
- ibase_db_link *ib_link;
- int type;
- void *ptr;
-
- ptr = zend_list_find(ib_trans->link_rsrc, &type); /* check if the link is still there */
- if (ptr && (type == le_link || type == le_plink)) {
- ib_link = (ibase_db_link *) zend_fetch_resource(NULL TSRMLS_CC, ib_trans->link_rsrc, "InterBase link", NULL, 2, le_link, le_plink);
-
- if (ib_link) {
- if (ib_link->trans[ib_trans->trans_num] != NULL) {
- IBDEBUG("Rolling back unhandled transaction...");
- if (isc_rollback_transaction(IB_STATUS, &ib_link->trans[ib_trans->trans_num])) {
- _php_ibase_error(TSRMLS_C);
- }
- ib_link->trans[ib_trans->trans_num] = NULL;
- }
- }
- }
- efree(ib_trans);
-}
-/* }}} */
-
-/* {{{ startup, shutdown and info functions */
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("ibase.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong, allow_persistent, zend_ibase_globals, ibase_globals)
- STD_PHP_INI_ENTRY_EX("ibase.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_persistent, zend_ibase_globals, ibase_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("ibase.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_links, zend_ibase_globals, ibase_globals, display_link_numbers)
- STD_PHP_INI_ENTRY("ibase.default_user", NULL, PHP_INI_ALL, OnUpdateString, default_user, zend_ibase_globals, ibase_globals)
- STD_PHP_INI_ENTRY("ibase.default_password", NULL, PHP_INI_ALL, OnUpdateString, default_password, zend_ibase_globals, ibase_globals)
- STD_PHP_INI_ENTRY("ibase.timestampformat", "%m/%d/%Y %H:%M:%S", PHP_INI_ALL, OnUpdateString, cfg_timestampformat, zend_ibase_globals, ibase_globals)
- STD_PHP_INI_ENTRY("ibase.dateformat", "%m/%d/%Y", PHP_INI_ALL, OnUpdateString, cfg_dateformat, zend_ibase_globals, ibase_globals)
- STD_PHP_INI_ENTRY("ibase.timeformat", "%H:%M:%S", PHP_INI_ALL, OnUpdateString, cfg_timeformat, zend_ibase_globals, ibase_globals)
-PHP_INI_END()
-
-static void php_ibase_init_globals(zend_ibase_globals *ibase_globals)
-{
- ibase_globals->timestampformat = NULL;
- ibase_globals->dateformat = NULL;
- ibase_globals->timeformat = NULL;
- ibase_globals->errmsg = NULL;
- ibase_globals->num_persistent = 0;
-}
-
-PHP_MINIT_FUNCTION(ibase)
-{
- ZEND_INIT_MODULE_GLOBALS(ibase, php_ibase_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
-
- le_result = zend_register_list_destructors_ex(_php_ibase_free_result, NULL, "interbase result", module_number);
- le_query = zend_register_list_destructors_ex(php_ibase_free_query_rsrc, NULL, "interbase query", module_number);
- le_blob = zend_register_list_destructors_ex(_php_ibase_free_blob, NULL, "interbase blob", module_number);
- le_link = zend_register_list_destructors_ex(_php_ibase_close_link, NULL, "interbase link", module_number);
- le_plink = zend_register_list_destructors_ex(php_ibase_commit_link_rsrc, _php_ibase_close_plink, "interbase link persistent", module_number);
- le_trans = zend_register_list_destructors_ex(_php_ibase_free_trans, NULL, "interbase transaction", module_number);
-
- REGISTER_LONG_CONSTANT("IBASE_DEFAULT", PHP_IBASE_DEFAULT, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_TEXT", PHP_IBASE_TEXT, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_UNIXTIME", PHP_IBASE_UNIXTIME, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_READ", PHP_IBASE_READ, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_COMMITTED", PHP_IBASE_COMMITTED, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_CONSISTENCY", PHP_IBASE_CONSISTENCY, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_NOWAIT", PHP_IBASE_NOWAIT, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_TIMESTAMP", PHP_IBASE_TIMESTAMP, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_DATE", PHP_IBASE_DATE, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_TIME", PHP_IBASE_TIME, CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(ibase)
-{
- IBG(default_link)= -1;
- IBG(num_links) = IBG(num_persistent);
-
- if (IBG(timestampformat)) {
- DL_FREE(IBG(timestampformat));
- }
- IBG(timestampformat) = DL_STRDUP(IBG(cfg_timestampformat));
-
- if (IBG(dateformat)) {
- DL_FREE(IBG(dateformat));
- }
- IBG(dateformat) = DL_STRDUP(IBG(cfg_dateformat));
-
- if (IBG(timeformat)) {
- DL_FREE(IBG(timeformat));
- }
- IBG(timeformat) = DL_STRDUP(IBG(cfg_timeformat));
-
- if (IBG(errmsg)) {
- DL_FREE(IBG(errmsg));
- }
- IBG(errmsg) = DL_MALLOC(sizeof(char)*MAX_ERRMSG+1);
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(ibase)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(ibase)
-{
- if (IBG(timestampformat)) {
- DL_FREE(IBG(timestampformat));
- }
- IBG(timestampformat) = NULL;
-
- if (IBG(dateformat)) {
- DL_FREE(IBG(dateformat));
- }
- IBG(dateformat) = NULL;
-
- if (IBG(timeformat)) {
- DL_FREE(IBG(timeformat));
- }
- IBG(timeformat) = NULL;
-
- if (IBG(errmsg)) {
- DL_FREE(IBG(errmsg));
- }
- IBG(errmsg) = NULL;
-
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(ibase)
-{
- char tmp[32];
-
- php_info_print_table_start();
- php_info_print_table_row(2, "Interbase Support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision$");
-#ifdef COMPILE_DL_INTERBASE
- php_info_print_table_row(2, "Dynamic Module", "yes");
-#endif
- php_info_print_table_row(2, "Allow Persistent Links", (IBG(allow_persistent) ? "Yes" : "No"));
-
- if (IBG(max_persistent) == -1) {
- snprintf(tmp, 31, "%ld/unlimited", IBG(num_persistent));
- } else {
- snprintf(tmp, 31, "%ld/%ld", IBG(num_persistent), IBG(max_persistent));
- }
- tmp[31] = 0;
- php_info_print_table_row(2, "Persistent Links", tmp);
-
- if (IBG(max_links) == -1) {
- snprintf(tmp, 31, "%ld/unlimited", IBG(num_links));
- } else {
- snprintf(tmp, 31, "%ld/%ld", IBG(num_links), IBG(max_links));
- }
- tmp[31] = 0;
- php_info_print_table_row(2, "Total Links", tmp);
-
- php_info_print_table_row(2, "Timestamp Format", IBG(timestampformat));
- php_info_print_table_row(2, "Date Format", IBG(dateformat));
- php_info_print_table_row(2, "Time Format", IBG(timeformat));
-
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ _php_ibase_attach_db() */
-static int _php_ibase_attach_db(char *server, char *uname, char *passwd, char *charset, int buffers, char *role, isc_db_handle *db TSRMLS_DC)
-{
- char dpb_buffer[256], *dpb, *p;
- int dpb_length, len;
-
- dpb = dpb_buffer;
-
- *dpb++ = isc_dpb_version1;
-
- if (uname != NULL && (len = strlen(uname))) {
- *dpb++ = isc_dpb_user_name;
- *dpb++ = len;
- for (p = uname; *p;) {
- *dpb++ = *p++;
- }
- }
-
- if (passwd != NULL && (len = strlen(passwd))) {
- *dpb++ = isc_dpb_password;
- *dpb++ = strlen(passwd);
- for (p = passwd; *p;) {
- *dpb++ = *p++;
- }
- }
-
- if (charset != NULL && (len = strlen(charset))) {
- *dpb++ = isc_dpb_lc_ctype;
- *dpb++ = strlen(charset);
- for (p = charset; *p;) {
- *dpb++ = *p++;
- }
- }
-
- if (buffers) {
- *dpb++ = isc_dpb_num_buffers;
- *dpb++ = 1;
- *dpb++ = buffers;
- }
-
-#ifdef isc_dpb_sql_role_name
- if (role != NULL && (len = strlen(role))) {
- *dpb++ = isc_dpb_sql_role_name;
- *dpb++ = strlen(role);
- for (p = role; *p;) {
- *dpb++ = *p++;
- }
- }
-#endif
-
- dpb_length = dpb - dpb_buffer;
-
- if (isc_attach_database(IB_STATUS, (short) strlen(server), server, db, (short) dpb_length, dpb_buffer)) {
- _php_ibase_error(TSRMLS_C);
- return FAILURE;
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ _php_ibase_connect() */
-static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- zval ***args;
- char *ib_server = NULL, *ib_uname, *ib_passwd, *ib_charset = NULL, *ib_buffers = NULL, *ib_dialect = NULL, *ib_role = NULL;
- int i, ib_uname_len, ib_passwd_len;
- isc_db_handle db_handle = NULL;
- char *hashed_details;
- int hashed_details_length = 0;
- ibase_db_link *ib_link = NULL;
-
- RESET_ERRMSG;
-
- ib_uname = IBG(default_user);
- ib_passwd = IBG(default_password);
- ib_uname_len = ib_uname ? strlen(ib_uname) : 0;
- ib_passwd_len = ib_passwd ? strlen(ib_passwd) : 0;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 7) {
- WRONG_PARAM_COUNT;
- }
-
- args = (zval ***) emalloc(sizeof(zval **) * ZEND_NUM_ARGS());
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- switch (ZEND_NUM_ARGS()) {
- case 7:
- convert_to_string_ex(args[6]);
- ib_role = Z_STRVAL_PP(args[6]);
- hashed_details_length += Z_STRLEN_PP(args[6]);
- /* fallout */
- case 6:
- convert_to_string_ex(args[5]);
- ib_dialect = Z_STRVAL_PP(args[5]);
- hashed_details_length += Z_STRLEN_PP(args[5]);
- /* fallout */
- case 5:
- convert_to_string_ex(args[4]);
- ib_buffers = Z_STRVAL_PP(args[4]);
- hashed_details_length += Z_STRLEN_PP(args[4]);
- /* fallout */
- case 4:
- convert_to_string_ex(args[3]);
- ib_charset = Z_STRVAL_PP(args[3]);
- hashed_details_length += Z_STRLEN_PP(args[3]);
- /* fallout */
- case 3:
- convert_to_string_ex(args[2]);
- ib_passwd = Z_STRVAL_PP(args[2]);
- hashed_details_length += Z_STRLEN_PP(args[2]);
- /* fallout */
- case 2:
- convert_to_string_ex(args[1]);
- ib_uname = Z_STRVAL_PP(args[1]);
- hashed_details_length += Z_STRLEN_PP(args[1]);
- /* fallout */
- case 1:
- convert_to_string_ex(args[0]);
- ib_server = Z_STRVAL_PP(args[0]);
- hashed_details_length += Z_STRLEN_PP(args[0]);
- } /* case */
-
- efree(args);
-
- hashed_details = (char *) emalloc(hashed_details_length + strlen("ibase_%s_%s_%s_%s_%s_%s_%s") + 1);
- sprintf(hashed_details, "ibase_%s_%s_%s_%s_%s_%s_%s", SAFE_STRING(ib_server), SAFE_STRING(ib_uname), SAFE_STRING(ib_passwd), SAFE_STRING(ib_charset), SAFE_STRING(ib_buffers), SAFE_STRING(ib_dialect), SAFE_STRING(ib_role));
-
- if (persistent) {
- list_entry *le;
- int open_new_connection = 1;
-
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length + 1, (void **) &le) != FAILURE) {
- char tmp_1[] = {isc_info_base_level, isc_info_end};
- char tmp_2[8]; /* Enough? Hope so... */
-
- if (Z_TYPE_P(le) != le_plink) {
- RETURN_FALSE;
- }
- /* Check if connection has timed out */
- ib_link = (ibase_db_link *) le->ptr;
- if (!isc_database_info(IB_STATUS, &ib_link->link, sizeof(tmp_1), tmp_1, sizeof(tmp_2), tmp_2)) {
- open_new_connection = 0;
- }
- }
-
- /* There was no previous connection to use or it has timed out */
- if (open_new_connection) {
- list_entry new_le;
-
- if ((IBG(max_links) != -1) && (IBG(num_links) >= IBG(max_links))) {
- _php_ibase_module_error("Too many open links (%d)", IBG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- if ((IBG(max_persistent) != -1) && (IBG(num_persistent) >= IBG(max_persistent))) {
- _php_ibase_module_error("Too many open persistent links (%d)", IBG(num_persistent));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* create the ib_link */
-
- if (_php_ibase_attach_db(ib_server, ib_uname, ib_passwd, ib_charset,
- (ib_buffers ? strtoul(ib_buffers, NULL, 0) : 0),
- ib_role, &db_handle TSRMLS_CC) == FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- ib_link = (ibase_db_link *) malloc(sizeof(ibase_db_link));
- ib_link->link = db_handle;
- ib_link->dialect = (ib_dialect ? (unsigned short) strtoul(ib_dialect, NULL, 10) : SQL_DIALECT_CURRENT);
-
- for (i = 0; i < IBASE_TRANS_ON_LINK; i++) {
- ib_link->trans[i] = NULL;
- }
-
- /* hash it up */
- Z_TYPE(new_le) = le_plink;
- new_le.ptr = ib_link;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length + 1, (void *) &new_le, sizeof(list_entry), NULL) == FAILURE) {
- efree(hashed_details);
- free(ib_link);
- RETURN_FALSE;
- }
- IBG(num_links)++;
- IBG(num_persistent)++;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, ib_link, le_plink);
-
- } else {
- list_entry *index_ptr, new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual ib_link sits.
- * if it doesn't, open a new ib_link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length + 1, (void **) &index_ptr) == SUCCESS) {
- int type, xlink;
- void *ptr;
- if (Z_TYPE_P(index_ptr) != le_index_ptr) {
- RETURN_FALSE;
- }
- xlink = (int) index_ptr->ptr;
- ptr = zend_list_find(xlink, &type); /* check if the xlink is still there */
- if (ptr && (type == le_link || type == le_plink)) {
- zend_list_addref(xlink);
- Z_LVAL_P(return_value) = xlink;
- Z_TYPE_P(return_value) = IS_RESOURCE;
- IBG(default_link) = Z_LVAL_P(return_value);
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length + 1);
- }
- }
- if ((IBG(max_links) != -1) && (IBG(num_links) >= IBG(max_links))) {
- _php_ibase_module_error("Too many open links (%d)", IBG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- /* create the ib_link */
-
- if (_php_ibase_attach_db(ib_server, ib_uname, ib_passwd, ib_charset,
- (ib_buffers ? strtoul(ib_buffers, NULL, 0) : 0),
- ib_role, &db_handle TSRMLS_CC) == FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- ib_link = (ibase_db_link *) emalloc(sizeof(ibase_db_link));
- ib_link->link = db_handle;
- ib_link->dialect = (ib_dialect ? (unsigned short) strtoul(ib_dialect, NULL, 10) : SQL_DIALECT_CURRENT);
-
- for (i = 0; i < IBASE_TRANS_ON_LINK; i++) {
- ib_link->trans[i] = NULL;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, ib_link, le_link);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
- Z_TYPE(new_index_ptr) = le_index_ptr;
- if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length + 1, (void *) &new_index_ptr, sizeof(list_entry), NULL) == FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- IBG(num_links)++;
- }
- efree(hashed_details);
- zend_list_addref(Z_LVAL_P(return_value));
- IBG(default_link) = Z_LVAL_P(return_value);
-}
-/* }}} */
-
-/* {{{ proto int ibase_connect(string database [, string username [, string password [, string charset [, int buffers [, int dialect [, string role]]]]]])
- Open a connection to an InterBase database */
-PHP_FUNCTION(ibase_connect)
-{
- _php_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int ibase_pconnect(string database [, string username [, string password [, string charset [, int buffers [, int dialect [, string role]]]]]])
- Open a persistent connection to an InterBase database */
-PHP_FUNCTION(ibase_pconnect)
-{
- _php_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int ibase_close([int link_identifier])
- Close an InterBase connection */
-PHP_FUNCTION(ibase_close)
-{
- zval **link_arg;
- ibase_db_link *ib_link;
- int link_id;
-
- RESET_ERRMSG;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- link_id = IBG(default_link);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &link_arg) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(link_arg);
- link_id = Z_LVAL_PP(link_arg);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, "InterBase link", le_link, le_plink);
- zend_list_delete(link_id);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ _php_ibase_alloc_array() */
-static int _php_ibase_alloc_array(ibase_array **ib_arrayp, int *array_cntp, XSQLDA *sqlda, isc_db_handle link, isc_tr_handle trans TSRMLS_DC)
-{
-#define IB_ARRAY (*ib_arrayp)
-
- int i, dim, ar_cnt, ar_length;
- XSQLVAR *var;
-
- IB_ARRAY = NULL;
-
- ar_cnt = 0; /* find arrays */
- var = sqlda->sqlvar;
- for (i = 0; i < sqlda->sqld; i++, var++) {
- if ((var->sqltype & ~1) == SQL_ARRAY) {
- ar_cnt++;
- }
- }
-
- if (ar_cnt) { /* have arrays ? */
- *array_cntp = ar_cnt;
- IB_ARRAY = emalloc(sizeof(ibase_array)*ar_cnt);
- ar_cnt = 0;
- var = sqlda->sqlvar;
- for (i = 0; i < sqlda->sqld; i++, var++) {
- if ((var->sqltype & ~1) == SQL_ARRAY) {
-
- ISC_ARRAY_DESC *ar_desc = &IB_ARRAY[ar_cnt].ar_desc;
-
- if (isc_array_lookup_bounds(IB_STATUS, &link, &trans, var->relname, var->sqlname, ar_desc)) {
- _php_ibase_error(TSRMLS_C);
- efree(IB_ARRAY);
- IB_ARRAY = NULL;
- return FAILURE;
- }
-
- switch (ar_desc->array_desc_dtype) {
- case blr_text:
- case blr_text2:
- IB_ARRAY[ar_cnt].el_type = SQL_TEXT;
- IB_ARRAY[ar_cnt].el_size = ar_desc->array_desc_length + 1;
- break;
- case blr_short:
- IB_ARRAY[ar_cnt].el_type = SQL_SHORT;
- IB_ARRAY[ar_cnt].el_size = sizeof(short);
- break;
- case blr_long:
- IB_ARRAY[ar_cnt].el_type = SQL_LONG;
- IB_ARRAY[ar_cnt].el_size = sizeof(long);
- break;
- case blr_float:
- IB_ARRAY[ar_cnt].el_type = SQL_FLOAT;
- IB_ARRAY[ar_cnt].el_size = sizeof(float);
- break;
- case blr_double:
- IB_ARRAY[ar_cnt].el_type = SQL_DOUBLE;
- IB_ARRAY[ar_cnt].el_size = sizeof(double);
- break;
- case blr_date:
- IB_ARRAY[ar_cnt].el_type = SQL_DATE;
- IB_ARRAY[ar_cnt].el_size = sizeof(ISC_QUAD);
- break;
- case blr_varying:
- case blr_varying2: /* changed to SQL_TEXT ? */
- /* sql_type = SQL_VARYING; Why? FIXME: ??? */
- IB_ARRAY[ar_cnt].el_type = SQL_TEXT;
- IB_ARRAY[ar_cnt].el_size = ar_desc->array_desc_length + sizeof(short);
- break;
- default:
- _php_ibase_module_error("Unexpected array type %d in relation '%s' column '%s'", ar_desc->array_desc_dtype, var->relname, var->sqlname);
- efree(IB_ARRAY);
- IB_ARRAY = NULL;
- return FAILURE;
- } /* switch array_desc_type */
-
- ar_length = 0; /* calculate elements count */
- for (dim = 0; dim < ar_desc->array_desc_dimensions; dim++) {
- ar_length += 1 + ar_desc->array_desc_bounds[dim].array_bound_upper - ar_desc->array_desc_bounds[dim].array_bound_lower;
- }
- IB_ARRAY[ar_cnt].ar_size = IB_ARRAY[ar_cnt].el_size * ar_length;
-
- ar_cnt++;
-
- } /* if SQL_ARRAY */
- } /* for column */
- } /* if array_cnt */
-
- return SUCCESS;
-#undef IB_ARRAY
-}
-/* }}} */
-
-/* {{{ _php_ibase_alloc_query() */
-/* allocate and prepare query */
-static int _php_ibase_alloc_query(ibase_query **ib_queryp, isc_db_handle link, isc_tr_handle trans, char *query, unsigned short dialect TSRMLS_DC)
-{
-#define IB_QUERY (*ib_queryp)
-
- IB_QUERY = emalloc(sizeof(ibase_query));
- IB_QUERY->link = link;
- IB_QUERY->trans = trans;
- IB_QUERY->stmt = NULL;
- IB_QUERY->out_sqlda = NULL;
- IB_QUERY->in_sqlda = NULL;
- IB_QUERY->in_array = NULL;
- IB_QUERY->in_array_cnt = 0;
- IB_QUERY->out_array = NULL;
- IB_QUERY->out_array_cnt = 0;
- IB_QUERY->dialect = dialect;
-
- if (isc_dsql_allocate_statement(IB_STATUS, &link, &IB_QUERY->stmt)) {
- _php_ibase_error(TSRMLS_C);
- goto _php_ibase_alloc_query_error;
- }
-
- IB_QUERY->out_sqlda = (XSQLDA *) emalloc(XSQLDA_LENGTH(0));
- IB_QUERY->out_sqlda->sqln = 0;
- IB_QUERY->out_sqlda->version = SQLDA_VERSION1;
-
- if (isc_dsql_prepare(IB_STATUS, &IB_QUERY->trans, &IB_QUERY->stmt, 0, query, dialect, IB_QUERY->out_sqlda)) {
- _php_ibase_error(TSRMLS_C);
- goto _php_ibase_alloc_query_error;
- }
-
- /* not enough output variables ? */
- if (IB_QUERY->out_sqlda->sqld > IB_QUERY->out_sqlda->sqln) {
- IB_QUERY->out_sqlda = erealloc(IB_QUERY->out_sqlda, XSQLDA_LENGTH(IB_QUERY->out_sqlda->sqld));
- IB_QUERY->out_sqlda->sqln = IB_QUERY->out_sqlda->sqld;
- IB_QUERY->out_sqlda->version = SQLDA_VERSION1;
- if (isc_dsql_describe(IB_STATUS, &IB_QUERY->stmt, SQLDA_VERSION1, IB_QUERY->out_sqlda)) {
- _php_ibase_error(TSRMLS_C);
- goto _php_ibase_alloc_query_error;
- }
- }
-
- /* maybe have input placeholders? */
- IB_QUERY->in_sqlda = emalloc(XSQLDA_LENGTH(0));
- IB_QUERY->in_sqlda->sqln = 0;
- IB_QUERY->in_sqlda->version = SQLDA_VERSION1;
- if (isc_dsql_describe_bind(IB_STATUS, &IB_QUERY->stmt, SQLDA_VERSION1, IB_QUERY->in_sqlda)) {
- _php_ibase_error(TSRMLS_C);
- goto _php_ibase_alloc_query_error;
- }
-
- /* not enough input variables ? */
- if (IB_QUERY->in_sqlda->sqln < IB_QUERY->in_sqlda->sqld) {
- IB_QUERY->in_sqlda = erealloc(IB_QUERY->in_sqlda, XSQLDA_LENGTH(IB_QUERY->in_sqlda->sqld));
- IB_QUERY->in_sqlda->sqln = IB_QUERY->in_sqlda->sqld;
- IB_QUERY->in_sqlda->version = SQLDA_VERSION1;
- if (isc_dsql_describe_bind(IB_STATUS, &IB_QUERY->stmt, SQLDA_VERSION1, IB_QUERY->in_sqlda)) {
- _php_ibase_error(TSRMLS_C);
- goto _php_ibase_alloc_query_error;
- }
- }
-
- /* allocate arrays... */
- if (_php_ibase_alloc_array(&IB_QUERY->in_array, &IB_QUERY->in_array_cnt, IB_QUERY->in_sqlda, link, trans TSRMLS_CC) == FAILURE) {
- goto _php_ibase_alloc_query_error; /* error report already done */
- }
-
- if (_php_ibase_alloc_array(&IB_QUERY->out_array, &IB_QUERY->out_array_cnt, IB_QUERY->out_sqlda, link, trans TSRMLS_CC) == FAILURE) {
- goto _php_ibase_alloc_query_error;
- }
-
- /* no, haven't placeholders at all */
- if (IB_QUERY->in_sqlda->sqld == 0) {
- efree(IB_QUERY->in_sqlda);
- IB_QUERY->in_sqlda = NULL;
- }
-
- if (IB_QUERY->out_sqlda->sqld == 0) {
- efree(IB_QUERY->out_sqlda);
- IB_QUERY->out_sqlda = NULL;
- }
-
- return SUCCESS;
-
-_php_ibase_alloc_query_error:
-
- if (IB_QUERY->out_sqlda) {
- efree(IB_QUERY->out_sqlda);
- }
- if (IB_QUERY->in_sqlda) {
- efree(IB_QUERY->in_sqlda);
- }
- if (IB_QUERY->out_array) {
- efree(IB_QUERY->out_array);
- }
- efree(IB_QUERY);
- IB_QUERY = NULL;
-
- return FAILURE;
-#undef IB_QUERY
-}
-/* }}} */
-
-/* {{{ _php_ibase_bind()
- Bind parameter placeholders in a previously prepared query */
-static int _php_ibase_bind(XSQLDA *sqlda, zval **b_vars, BIND_BUF *buf, ibase_query *ib_query TSRMLS_DC)
-{
- XSQLVAR *var;
- zval *b_var;
- int i;
-
- var = sqlda->sqlvar;
- for (i = 0; i < sqlda->sqld; var++, i++) { /* binded vars */
-
- buf[i].sqlind = 0;
- var->sqlind = &buf[i].sqlind;
- b_var = b_vars[i];
-
- if (Z_TYPE_P(b_var) == IS_NULL) {
- static char nothing[64];
- static short null_flag = -1;
- var->sqldata = nothing;
- var->sqltype |= 1;
- var->sqlind = &null_flag;
- if (var->sqllen > 64) {
- var->sqllen = 64;
- }
- } else
-
- switch (var->sqltype & ~1) {
- case SQL_TEXT: /* direct to variable */
- case SQL_VARYING:
- convert_to_string(b_var);
- var->sqldata = (void ISC_FAR *) Z_STRVAL_P(b_var);
- var->sqllen = Z_STRLEN_P(b_var);
- var->sqltype = SQL_TEXT + (var->sqltype & 1);
- break;
- case SQL_SHORT:
- convert_to_long(b_var);
- if (Z_LVAL_P(b_var) > SHRT_MAX || Z_LVAL_P(b_var) < SHRT_MIN) {
- _php_ibase_module_error("Field %*s overflow", var->aliasname_length, var->aliasname);
- return FAILURE;
- }
- buf[i].val.sval = (short) Z_LVAL_P(b_var);
- var->sqldata = (void ISC_FAR *) (&buf[i].val.sval);
- break;
- case SQL_LONG:
- if (var->sqlscale < 0) {
- /*
- DECIMAL or NUMERIC field stored internally as scaled integer.
- Coerce it to string and let InterBase's internal routines
- handle it.
- */
- convert_to_string(b_var);
- var->sqldata = (void ISC_FAR *) Z_STRVAL_P(b_var);
- var->sqllen = Z_STRLEN_P(b_var);
- var->sqltype = SQL_TEXT;
- } else {
- convert_to_long(b_var);
- var->sqldata = (void ISC_FAR *) (&Z_LVAL_P(b_var));
- }
- break;
- case SQL_FLOAT:
- convert_to_double(b_var);
- buf[i].val.fval = (float) Z_DVAL_P(b_var);
- var->sqldata = (void ISC_FAR *) (&buf[i].val.fval);
- break;
- case SQL_DOUBLE: /* direct to variable */
- convert_to_double(b_var);
- var->sqldata = (void ISC_FAR *) (&Z_DVAL_P(b_var));
- break;
-#ifdef SQL_INT64
- case SQL_INT64:
- /*
- Just let InterBase's internal routines handle it.
- Besides, it might even have originally been a string
- to avoid rounding errors...
- */
- convert_to_string(b_var);
- var->sqldata = (void ISC_FAR *) Z_STRVAL_P(b_var);
- var->sqllen = Z_STRLEN_P(b_var);
- var->sqltype = SQL_TEXT;
- break;
-#endif
-#ifndef SQL_TIMESTAMP
- case SQL_DATE:
-#else
- case SQL_TIMESTAMP:
- case SQL_TYPE_DATE:
- case SQL_TYPE_TIME:
-#endif
-#ifndef HAVE_STRPTIME
-#ifndef SQL_TIMESTAMP
- /* Parsing doesn't seem to happen with older versions... */
- {
- struct tm t;
- int n;
-
- t.tm_year = t.tm_mon = t.tm_mday = t.tm_hour = t.tm_min = t.tm_sec = 0;
-
- convert_to_string(b_var);
-
- n = sscanf(Z_STRVAL_P(b_var), "%d%*[/]%d%*[/]%d %d%*[:]%d%*[:]%d", &t.tm_mon, &t.tm_mday, &t.tm_year, &t.tm_hour, &t.tm_min, &t.tm_sec);
-
- if (n != 3 && n != 6) {
- _php_ibase_module_error("Invalid date/time format: Expected 3 or 6 fields, got %d. Use format m/d/Y H:i:s. You gave '%s'", n, Z_STRVAL_P(b_var));
- return FAILURE;
- }
- t.tm_year -= 1900;
- t.tm_mon--;
- isc_encode_date(&t, &buf[i].val.qval);
- var->sqldata = (void ISC_FAR *) (&buf[i].val.qval);
- }
-#else
- /*
- Once again, InterBase's internal parsing routines
- seems to be a good solution... Might change this on
- platforms that have strptime()? Code is there and works,
- but the functions existence is not yet tested...
- ask Sascha?
- */
- convert_to_string(b_var);
- var->sqldata = (void ISC_FAR *) Z_STRVAL_P(b_var);
- var->sqllen = Z_STRLEN_P(b_var);
- var->sqltype = SQL_TEXT;
-#endif
-#else
- {
- struct tm t;
-
- convert_to_string(b_var);
-#ifndef SQL_TIMESTAMP
- strptime(Z_STRVAL_P(b_var), IBG(timestampformat), &t);
- isc_encode_date(&t, &buf[i].val.qval);
- var->sqldata = (void ISC_FAR *) (&buf[i].val.qval);
-#else
- switch (var->sqltype & ~1) {
- case SQL_TIMESTAMP:
- strptime(Z_STRVAL_P(b_var), IBG(timestampformat), &t);
- isc_encode_timestamp(&t, &buf[i].val.tsval);
- var->sqldata = (void ISC_FAR *) (&buf[i].val.tsval);
- break;
- case SQL_TYPE_DATE:
- strptime(Z_STRVAL_P(b_var), IBG(dateformat), &t);
- isc_encode_sql_date(&t, &buf[i].val.dtval);
- var->sqldata = (void ISC_FAR *) (&buf[i].val.dtval);
- break;
- case SQL_TYPE_TIME:
- strptime(Z_STRVAL_P(b_var), IBG(timeformat), &t);
- isc_encode_sql_time(&t, &buf[i].val.tmval);
- var->sqldata = (void ISC_FAR *) (&buf[i].val.tmval);
- break;
- }
-#endif
- }
-#endif
- break;
- case SQL_BLOB:
- {
- ibase_blob_handle *ib_blob_id;
- if (Z_TYPE_P(b_var) != IS_STRING || Z_STRLEN_P(b_var) != sizeof(ibase_blob_handle) ||
- ((ibase_blob_handle *)(Z_STRVAL_P(b_var)))->bl_handle != 0) {
- ibase_blob_handle *ib_blob;
-
- ib_blob = (ibase_blob_handle *) emalloc(sizeof(ibase_blob_handle));
- ib_blob->trans_handle = ib_query->trans;
- ib_blob->link = ib_query->link;
- ib_blob->bl_handle = NULL;
- if (isc_create_blob(IB_STATUS, &ib_blob->link, &ib_blob->trans_handle, &ib_blob->bl_handle, &ib_blob->bl_qd)) {
- efree(ib_blob);
- _php_ibase_error(TSRMLS_C);
- return FAILURE;
- }
- convert_to_string(b_var);
- if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, (unsigned short) Z_STRLEN_P(b_var), Z_STRVAL_P(b_var))) {
- _php_ibase_error(TSRMLS_C);
- return FAILURE;
- }
- if (isc_close_blob(IB_STATUS, &ib_blob->bl_handle)) {
- _php_ibase_error(TSRMLS_C);
- return FAILURE;
- }
- ib_blob_id = ib_blob;
- var->sqldata = (void ISC_FAR *) &ib_blob_id->bl_qd;
-/*
- _php_ibase_module_error("Invalid blob id string");
- return FAILURE;
-*/
- } else {
- ib_blob_id = (ibase_blob_handle *) Z_STRVAL_P(b_var);
-
- var->sqldata = (void ISC_FAR *) &ib_blob_id->bl_qd;
- }
- }
- break;
- case SQL_ARRAY:
- _php_ibase_module_error("Binding arrays not supported yet");
- return FAILURE;
- break;
- } /* switch */
- } /* for */
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ _php_ibase_alloc_xsqlda() */
-static void _php_ibase_alloc_xsqlda(XSQLDA *sqlda)
-{
- int i;
- XSQLVAR *var = sqlda->sqlvar;
-
- for (i = 0; i < sqlda->sqld; i++, var++) {
- switch (var->sqltype & ~1) {
- case SQL_TEXT:
- var->sqldata = emalloc(sizeof(char) * (var->sqllen));
- break;
- case SQL_VARYING:
- var->sqldata = emalloc(sizeof(char) * (var->sqllen + sizeof(short)));
- break;
- case SQL_SHORT:
- var->sqldata = emalloc(sizeof(short));
- break;
- case SQL_LONG:
- var->sqldata = emalloc(sizeof(long));
- break;
- case SQL_FLOAT:
- var->sqldata = emalloc(sizeof(float));
- break;
- case SQL_DOUBLE:
- var->sqldata = emalloc(sizeof(double));
- break;
-#ifdef SQL_INT64
- case SQL_INT64:
- var->sqldata = emalloc(sizeof(ISC_INT64));
- break;
-#endif
-#ifdef SQL_TIMESTAMP
- case SQL_TIMESTAMP:
- var->sqldata = emalloc(sizeof(ISC_TIMESTAMP));
- break;
- case SQL_TYPE_DATE:
- var->sqldata = emalloc(sizeof(ISC_DATE));
- break;
- case SQL_TYPE_TIME:
- var->sqldata = emalloc(sizeof(ISC_TIME));
- break;
-#else
- case SQL_DATE:
-#endif
- case SQL_BLOB:
- case SQL_ARRAY:
- var->sqldata = emalloc(sizeof(ISC_QUAD));
- break;
- } /* switch */
-
- if (var->sqltype & 1) { /* sql NULL flag */
- var->sqlind = emalloc(sizeof(short));
- } else {
- var->sqlind = NULL;
- }
- } /* for */
-}
-/* }}} */
-
-/* {{{ _php_ibase_exec() */
-static int _php_ibase_exec(ibase_result **ib_resultp, ibase_query *ib_query, int argc, zval **args TSRMLS_DC)
-{
-#define IB_RESULT (*ib_resultp)
- XSQLDA *in_sqlda = NULL, *out_sqlda = NULL;
- BIND_BUF *bind_buf = NULL;
- int rv = FAILURE;
-
- IB_RESULT = NULL;
-
- /* allocate sqlda and output buffers */
- if (ib_query->out_sqlda) { /* output variables in select, select for update */
- IBDEBUG("Query wants XSQLDA for output");
- IB_RESULT = emalloc(sizeof(ibase_result));
- IB_RESULT->link = ib_query->link;
- IB_RESULT->trans = ib_query->trans;
- IB_RESULT->stmt = ib_query->stmt;
- IB_RESULT->drop_stmt = 0; /* when free result close but not drop!*/
-
- out_sqlda = IB_RESULT->out_sqlda = emalloc(XSQLDA_LENGTH(ib_query->out_sqlda->sqld));
- memcpy(out_sqlda, ib_query->out_sqlda, XSQLDA_LENGTH(ib_query->out_sqlda->sqld));
- _php_ibase_alloc_xsqlda(out_sqlda);
-
- if (ib_query->out_array) {
- IB_RESULT->out_array = emalloc(sizeof(ibase_array) * ib_query->out_array_cnt);
- memcpy(IB_RESULT->out_array, ib_query->out_array, sizeof(ibase_array) * ib_query->out_array_cnt);
- } else {
- IB_RESULT->out_array = NULL;
- }
- }
-
- if (ib_query->in_sqlda) { /* has placeholders */
- IBDEBUG("Query wants XSQLDA for input");
- if (ib_query->in_sqlda->sqld != argc) {
- _php_ibase_module_error("Placeholders (%d) and variables (%d) mismatch", ib_query->in_sqlda->sqld, argc);
- goto _php_ibase_exec_error; /* yes mommy, goto! */
- }
- in_sqlda = emalloc(XSQLDA_LENGTH(ib_query->in_sqlda->sqld));
- memcpy(in_sqlda, ib_query->in_sqlda, XSQLDA_LENGTH(ib_query->in_sqlda->sqld));
- bind_buf = emalloc(sizeof(BIND_BUF) * ib_query->in_sqlda->sqld);
- if (_php_ibase_bind(in_sqlda, args, bind_buf, ib_query TSRMLS_CC) == FAILURE) {
- IBDEBUG("Could not bind input XSQLDA");
- goto _php_ibase_exec_error;
- }
- }
-
- if (isc_dsql_execute(IB_STATUS, &ib_query->trans, &ib_query->stmt, ib_query->dialect, in_sqlda)) {
- IBDEBUG("Could not execute query");
- _php_ibase_error(TSRMLS_C);
- goto _php_ibase_exec_error;
- }
-
- rv = SUCCESS;
-
-_php_ibase_exec_error: /* I'm a bad boy... */
-
- if (in_sqlda) {
- efree(in_sqlda);
- }
- if (bind_buf)
- efree(bind_buf);
-
- if (rv == FAILURE) {
- if (IB_RESULT) {
- efree(IB_RESULT);
- IB_RESULT = NULL;
- }
- if (out_sqlda) {
- _php_ibase_free_xsqlda(out_sqlda);
- }
- }
-
- return rv;
-#undef IB_RESULT
-}
-/* }}} */
-
-/* {{{ proto int ibase_trans([int trans_args [, int link_identifier]])
- Start transaction */
-PHP_FUNCTION(ibase_trans)
-{
- zval ***args;
- char tpb[20], *tpbp = NULL;
- long trans_argl = 0;
- int tpb_len = 0, argn, link_id, trans_n = 0, i;
- ibase_db_link *ib_link;
- ibase_tr_link *ib_trans;
-
- RESET_ERRMSG;
-
- link_id = IBG(default_link);
-
- /* TODO: multi-databases trans */
- argn = ZEND_NUM_ARGS();
- if (argn < 0 || argn > 20) {
- WRONG_PARAM_COUNT;
- }
-
- if (argn) {
- args = (zval ***) emalloc(sizeof(zval **) * argn);
- if (zend_get_parameters_array_ex(argn, args) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- /* Handle all database links, although we don't support multibase
- transactions yet, so only the last one is will be used. */
- for (i = argn-1; i > 0 && Z_TYPE_PP(args[i]) == IS_RESOURCE; i--) {
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, args[i], -1, "InterBase link", le_link, le_plink);
- link_id = Z_LVAL_PP(args[i]);
- }
-
- /* First argument is transaction parameters */
- convert_to_long_ex(args[0]);
- trans_argl = Z_LVAL_PP(args[0]);
-
- efree(args);
- }
-
- if (argn < 2) {
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, link_id, "InterBase link", le_link, le_plink);
- }
-
- if (trans_argl) {
- tpb[tpb_len++] = isc_tpb_version3;
- tpbp = tpb;
- /* access mode */
- if (trans_argl & PHP_IBASE_READ) { /* READ ONLY TRANSACTION */
- tpb[tpb_len++] = isc_tpb_read;
- } else {
- tpb[tpb_len++] = isc_tpb_write;
- }
- /* isolation level */
- if (trans_argl & PHP_IBASE_COMMITTED) {
- tpb[tpb_len++] = isc_tpb_read_committed;
- } else if (trans_argl & PHP_IBASE_CONSISTENCY) {
- tpb[tpb_len++] = isc_tpb_consistency;
- } else {
- tpb[tpb_len++] = isc_tpb_concurrency;
- }
-
- /* lock resolution */
- if (trans_argl & PHP_IBASE_NOWAIT) {
- tpb[tpb_len++] = isc_tpb_nowait;
- } else {
- tpb[tpb_len++] = isc_tpb_wait;
- }
- }
-
- /* find empty transaction slot */
- for (trans_n = 0; trans_n < IBASE_TRANS_ON_LINK && ib_link->trans[trans_n]; trans_n++);
- if (trans_n == IBASE_TRANS_ON_LINK) {
- _php_ibase_module_error("Too many transactions on link");
- RETURN_FALSE;
- }
-
- if (isc_start_transaction(IB_STATUS, &ib_link->trans[trans_n], 1, &ib_link->link, tpb_len, tpbp)) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
-
- ib_trans = (ibase_tr_link *) emalloc(sizeof(ibase_tr_link));
- ib_trans->trans_num = trans_n;
- ib_trans->link_rsrc = link_id;
- ZEND_REGISTER_RESOURCE(return_value, ib_trans, le_trans);
-}
-/* }}} */
-
-/* {{{ _php_ibase_def_trans() */
-/* open default transaction */
-static int _php_ibase_def_trans(ibase_db_link * ib_link, int trans_n TSRMLS_DC)
-{
- if (ib_link == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database link");
- return FAILURE;
- }
-
- if (trans_n == 0 && ib_link->trans[0] == NULL) {
- if (isc_start_transaction(IB_STATUS, &ib_link->trans[0], 1, &ib_link->link, 0, NULL)) {
- _php_ibase_error(TSRMLS_C);
- return FAILURE;
- }
- }
- return SUCCESS;
-}
-/*}}}*/
-
-/* {{{ _php_ibase_trans_end() */
-#define COMMIT 1
-#define ROLLBACK 0
-static void _php_ibase_trans_end(INTERNAL_FUNCTION_PARAMETERS, int commit)
-{
- zval **link_trans_arg = NULL;
- int link_id = 0, trans_n = 0, trans_id = 0;
- ibase_db_link *ib_link;
-
- RESET_ERRMSG;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- link_id = IBG(default_link);
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_trans_arg, link_id, "InterBase link", le_link, le_plink);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &link_trans_arg) == FAILURE) {
- RETURN_FALSE;
- }
- get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, link_trans_arg, &ib_link, &trans_n, &trans_id);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (ib_link == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database link");
- RETURN_FALSE;
- }
-
- if (ib_link->trans[trans_n] == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to commit or rollback an already handled transaction");
- RETURN_FALSE;
- }
-
- if (commit) {
- if (isc_commit_transaction(IB_STATUS, &ib_link->trans[trans_n])) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
- } else {
- if (isc_rollback_transaction(IB_STATUS, &ib_link->trans[trans_n])) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
- }
- ib_link->trans[trans_n] = NULL;
-
- /* Don't try to destroy imnplicitly opened transaction from list... */
- if (trans_id) {
- zend_list_delete(trans_id);
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ibase_commit([int link_identifier [, int trans_number]])
- Commit transaction */
-PHP_FUNCTION(ibase_commit)
-{
- _php_ibase_trans_end(INTERNAL_FUNCTION_PARAM_PASSTHRU, COMMIT);
-}
-/* }}} */
-
-/* {{{ proto int ibase_rollback([int link_identifier [, int trans_number]])
- Roolback transaction */
-PHP_FUNCTION(ibase_rollback)
-{
- _php_ibase_trans_end(INTERNAL_FUNCTION_PARAM_PASSTHRU, ROLLBACK);
-}
-/* }}} */
-
-/* {{{ proto int ibase_query([int link_identifier [, string query [, int bind_args]]])
- Execute a query */
-PHP_FUNCTION(ibase_query)
-{
- zval ***args, **bind_args = NULL, **dummy = NULL;
- int i, link_id = 0, trans_n = 0, bind_n = 0, trans_id = 0;
- char *query;
- ibase_db_link *ib_link;
- ibase_query *ib_query;
- ibase_result *ib_result;
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS() < 1) {
- WRONG_PARAM_COUNT;
- }
-
- args = (zval ***) emalloc(sizeof(zval **) * ZEND_NUM_ARGS());
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- i = 0;
- if (Z_TYPE_PP(args[i]) == IS_RESOURCE) { /* link or transaction argument */
- get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, args[i], &ib_link, &trans_n, &trans_id);
- i++; /* next arg */
- } else {
- link_id = IBG(default_link);
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, dummy, link_id, "InterBase link", le_link, le_plink);
- }
-
- if (Z_TYPE_PP(args[i]) == IS_STRING) { /* query argument */
- convert_to_string_ex(args[i]);
- query = Z_STRVAL_PP(args[i]);
- i++; /* next arg */
- } else {
- _php_ibase_module_error("Query argument missed");
- efree(args);
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() > i) { /* have variables to bind */
- /* XXX Remove or fix??? Variable placeholders and binding makes
- absolutely no sense if not using a prepared SQL statement.
- */
- bind_n = ZEND_NUM_ARGS() - i;
- bind_args = args[i];
- }
-
- /* open default transaction */
- if (_php_ibase_def_trans(ib_link, trans_n TSRMLS_CC) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- if (_php_ibase_alloc_query(&ib_query, ib_link->link, ib_link->trans[trans_n], query, ib_link->dialect TSRMLS_CC) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- if (_php_ibase_exec(&ib_result, ib_query, bind_n, bind_args TSRMLS_CC) == FAILURE) {
- _php_ibase_free_query(ib_query TSRMLS_CC);
- efree(args);
- RETURN_FALSE;
- }
-
- efree(args);
-
- if (ib_result) { /* select statement */
- ib_result->drop_stmt = 1; /* drop stmt when free result */
- ib_query->stmt = NULL; /* keep stmt when free query */
- _php_ibase_free_query(ib_query TSRMLS_CC);
- ZEND_REGISTER_RESOURCE(return_value, ib_result, le_result);
- } else {
- _php_ibase_free_query(ib_query TSRMLS_CC);
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ _php_ibase_var_zval() */
-static int _php_ibase_var_zval(zval *val, void *data, int type, int len, int scale, int flag TSRMLS_DC)
-{
- char string_data[255];
-
- switch (type & ~1) {
- case SQL_VARYING:
- len = ((IBASE_VCHAR *) data)->var_len;
- data = ((IBASE_VCHAR *) data)->var_str;
- /* fallout */
- case SQL_TEXT:
- Z_STRVAL_P(val) = (char *) emalloc(sizeof(char) * (len + 1));
- memcpy(Z_STRVAL_P(val), data, len);
- Z_STRVAL_P(val)[len] = '\0';
- if (PG(magic_quotes_runtime)) {
- Z_STRVAL_P(val) = php_addslashes(Z_STRVAL_P(val), len, &len, 1 TSRMLS_CC);
- }
- Z_TYPE_P(val) = IS_STRING;
- Z_STRLEN_P(val) = len;
- break;
- case SQL_LONG:
- if (scale) {
- int j, f = 1;
- float n = (float) *(long *) (data);
-
- for (j = 0; j < -scale; j++) {
- f *= 10;
- }
- Z_TYPE_P(val) = IS_STRING;
- Z_STRLEN_P(val) = sprintf(string_data, "%.*f", -scale, n / f);
- Z_STRVAL_P(val) = estrdup(string_data);
- } else {
- Z_TYPE_P(val) = IS_LONG;
- Z_LVAL_P(val) = *(long *) (data);
- }
- break;
- case SQL_SHORT:
- Z_TYPE_P(val) = IS_LONG;
- Z_LVAL_P(val) = *(short *) (data);
- break;
- case SQL_FLOAT:
- Z_TYPE_P(val) = IS_DOUBLE;
- Z_DVAL_P(val) = *(float *) (data);
- break;
- case SQL_DOUBLE:
- if (scale) {
- Z_TYPE_P(val) = IS_STRING;
- Z_STRLEN_P(val) = sprintf(string_data, "%.*f", -scale, *(double *) data);
- Z_STRVAL_P(val) = estrdup(string_data);
- } else {
- Z_TYPE_P(val) = IS_DOUBLE;
- Z_DVAL_P(val) = *(double *) data;
- }
- break;
-#ifdef SQL_INT64
- case SQL_INT64:
- Z_TYPE_P(val) = IS_STRING;
-
- if (scale) {
- int j, f = 1;
- double number = (double) ((ISC_INT64) (*((ISC_INT64 *) data)));
- char dt[20];
- for (j = 0; j < -scale; j++) {
- f *= 10;
- }
- sprintf(dt, "%%0.%df", -scale);
- Z_STRLEN_P(val) = sprintf (string_data, dt, number / f);
- } else {
- Z_STRLEN_P(val) =sprintf (string_data, "%.0" ISC_INT64_FORMAT "d",
- (ISC_INT64) *(ISC_INT64 *) data);
- }
-
- Z_STRVAL_P(val) = estrdup(string_data);
- break;
-#endif
-#ifndef SQL_TIMESTAMP
- case SQL_DATE:
-#else
- case SQL_TIMESTAMP:
- case SQL_TYPE_DATE:
- case SQL_TYPE_TIME:
-#endif
- {
- struct tm t;
- char *format = NULL;
- long timestamp = -1;
-
-#ifndef SQL_TIMESTAMP
- isc_decode_date((ISC_QUAD *) data, &t);
- format = IBG(timestampformat);
-#else
- switch (type & ~1) {
- case SQL_TIMESTAMP:
- isc_decode_timestamp((ISC_TIMESTAMP *) data, &t);
- format = IBG(timestampformat);
- break;
- case SQL_TYPE_DATE:
- isc_decode_sql_date((ISC_DATE *) data, &t);
- format = IBG(dateformat);
- break;
- case SQL_TYPE_TIME:
- isc_decode_sql_time((ISC_TIME *) data, &t);
- format = IBG(timeformat);
- break;
- }
-#endif
- /*
- XXX - Might have to remove this later - seems that isc_decode_date()
- always sets tm_isdst to 0, sometimes incorrectly (InterBase 6 bug?)
- */
- t.tm_isdst = -1;
- timestamp = mktime(&t);
-#if HAVE_TM_ZONE
- t.tm_zone = tzname[0];
-#endif
- if (flag & PHP_IBASE_UNIXTIME) {
- Z_TYPE_P(val) = IS_LONG;
- Z_LVAL_P(val) = timestamp;
- } else {
- Z_TYPE_P(val) = IS_STRING;
-#if HAVE_STRFTIME
- Z_STRLEN_P(val) = strftime(string_data, sizeof(string_data), format, &t);
-#else
- /* FIXME */
- if (!t.tm_hour && !t.tm_min && !t.tm_sec) {
- Z_STRLEN_P(val) = sprintf(string_data, "%02d/%02d/%4d", t.tm_mon + 1, t.tm_mday, t.tm_year + 1900);
- } else {
- Z_STRLEN_P(val) = sprintf(string_data, "%02d/%02d/%4d %02d:%02d:%02d", t.tm_mon+1, t.tm_mday, t.tm_year + 1900, t.tm_hour, t.tm_min, t.tm_sec);
- }
-#endif
- Z_STRVAL_P(val) = estrdup(string_data);
- break;
- }
- }
- default:
- return FAILURE;
- } /* switch (type) */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ _php_ibase_arr_zval() */
-/* create multidimension array - resursion function
- * (*datap) argument changed
- */
-static int _php_ibase_arr_zval(zval *ar_zval, char **datap, ibase_array *ib_array, int dim, int flag TSRMLS_DC)
-{
- zval tmp;
- int i, dim_len, l_bound, u_bound;
-
- if (dim > 16) { /* InterBase limit */
- _php_ibase_module_error("Too many dimensions");
- return FAILURE;
- }
-
- u_bound = ib_array->ar_desc.array_desc_bounds[dim].array_bound_upper;
- l_bound = ib_array->ar_desc.array_desc_bounds[dim].array_bound_lower;
- dim_len = 1 + u_bound - l_bound;
-
- if (dim < ib_array->ar_desc.array_desc_dimensions - 1) { /* array again */
- for (i = 0; i < dim_len; i++) {
- /* recursion here */
- if (_php_ibase_arr_zval(ar_zval, datap, ib_array, dim + 1, flag TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
- }
- } else { /* data at last */
-
- array_init(ar_zval);
-
- for (i = 0; i < dim_len; i++) {
- if (_php_ibase_var_zval(&tmp, *datap,
- ib_array->el_type,
- ib_array->ar_desc.array_desc_length,
- ib_array->ar_desc.array_desc_scale,
- flag TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
- /* FIXME ??? */
- zend_hash_index_update(Z_ARRVAL_P(ar_zval), l_bound + i, (void *) &tmp, sizeof(zval), NULL);
- *datap += ib_array->el_size;
- }
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ _php_ibase_fetch_hash() */
-
-#define FETCH_ROW 2
-#define FETCH_ARRAY 4
-
-static void _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type)
-{
- zval **result_arg, **flag_arg;
- long flag = 0;
- int i, arr_cnt;
- ibase_result *ib_result;
- XSQLVAR *var;
-
- RESET_ERRMSG;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (ZEND_NUM_ARGS() == 1 && zend_get_parameters_ex(1, &result_arg) == FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (ZEND_NUM_ARGS() == 2 && zend_get_parameters_ex(2, &result_arg, &flag_arg) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(flag_arg);
- flag = Z_LVAL_PP(flag_arg);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, "InterBase result", le_result);
-
- if (ib_result->out_sqlda == NULL) {
- _php_ibase_module_error("Trying to fetch results from a non-select query");
- RETURN_FALSE;
- }
-
- if (isc_dsql_fetch(IB_STATUS, &ib_result->stmt, 1, ib_result->out_sqlda) == 100L) {
- RETURN_FALSE; /* end of cursor */
- }
-
- if (IB_STATUS[0] && IB_STATUS[1]) { /* error in fetch */
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- arr_cnt = 0;
- var = ib_result->out_sqlda->sqlvar;
- for (i = 0; i < ib_result->out_sqlda->sqld; i++, var++) {
- if (((var->sqltype & 1) == 0) || *var->sqlind != -1) {
- zval *tmp;
- tmp = emalloc(sizeof(zval));
- switch (var->sqltype & ~1) {
- case SQL_VARYING:
- case SQL_TEXT:
- case SQL_SHORT:
- case SQL_LONG:
- case SQL_FLOAT:
- case SQL_DOUBLE:
-#ifdef SQL_INT64
- case SQL_INT64:
-#endif
-#ifndef SQL_TIMESTAMP
- case SQL_DATE:
-#else
- case SQL_TIMESTAMP:
- case SQL_TYPE_DATE:
- case SQL_TYPE_TIME:
-#endif
- _php_ibase_var_zval(tmp, var->sqldata, var->sqltype, var->sqllen, var->sqlscale, flag TSRMLS_CC);
- break;
- case SQL_BLOB:
- if (flag & PHP_IBASE_TEXT) { /* text ? */
- int stat;
- isc_blob_handle bl_handle = NULL;
- ISC_LONG max_len = 0, cur_len = 0;
- char bl_items[1], *bl_data, bl_info[20], *p;
-
- if (isc_open_blob(IB_STATUS, &ib_result->link, &ib_result->trans, &bl_handle, (ISC_QUAD ISC_FAR *) var->sqldata)) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
-
- bl_items[0] = isc_info_blob_total_length;
- if (isc_blob_info(IB_STATUS, &bl_handle, sizeof(bl_items), bl_items, sizeof(bl_info), bl_info)) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
-
- /* find total length of blob's data */
- for (p = bl_info; *p != isc_info_end && p < bl_info + sizeof(bl_info);) {
- unsigned short item_len, item = *p++;
-
- item_len = (short) isc_vax_integer(p, 2);
- p += 2;
- if (item == isc_info_blob_total_length) {
- max_len = isc_vax_integer(p, item_len);
- }
- p += item_len;
- }
-
- bl_data = emalloc(max_len+1);
-
- for (cur_len = stat = 0; stat == 0 && cur_len < max_len;) {
- unsigned short seg_len;
- unsigned short max_seg = (unsigned short) (max_len - cur_len > USHRT_MAX ? USHRT_MAX : max_len-cur_len);
-
- stat = isc_get_segment(IB_STATUS, &bl_handle, &seg_len, max_seg, &bl_data[cur_len]);
- cur_len += seg_len;
- if (cur_len > max_len) { /* never! */
- efree(bl_data);
- _php_ibase_module_error("PHP module internal error");
- RETURN_FALSE;
- }
- }
-
- if (IB_STATUS[0] && IB_STATUS[1] && (IB_STATUS[1] != isc_segstr_eof)) {
- efree(bl_data);
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
- bl_data[cur_len] = '\0';
- if (isc_close_blob(IB_STATUS, &bl_handle)) {
- efree(bl_data);
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
- Z_TYPE_P(tmp) = IS_STRING;
- Z_STRLEN_P(tmp) = cur_len;
- Z_STRVAL_P(tmp) = estrndup(bl_data, cur_len);
- efree(bl_data);
-
- } else { /* blob id only */
- ISC_QUAD *bl_qd = (ISC_QUAD ISC_FAR *) var->sqldata;
- ibase_blob_handle *ib_blob_id;
-
- ib_blob_id = (ibase_blob_handle *) emalloc(sizeof(ibase_blob_handle));
-
- ib_blob_id->link = ib_result->link;
- ib_blob_id->trans_handle = ib_result->trans;
- ib_blob_id->bl_qd.gds_quad_high = bl_qd->gds_quad_high;
- ib_blob_id->bl_qd.gds_quad_low = bl_qd->gds_quad_low;
- ib_blob_id->bl_handle = NULL;
-
- Z_TYPE_P(tmp) = IS_STRING;
- Z_STRLEN_P(tmp) = sizeof(ibase_blob_handle);
- Z_STRVAL_P(tmp) = estrndup((char *) ib_blob_id, sizeof(ibase_blob_handle));
- efree(ib_blob_id);
- }
- break;
- case SQL_ARRAY: {
- ISC_QUAD ar_qd = *(ISC_QUAD ISC_FAR *) var->sqldata;
- ibase_array *ib_array = &ib_result->out_array[arr_cnt];
- void *ar_data;
- char *tmp_ptr;
-
- ar_data = emalloc(ib_array->ar_size);
-
- if (isc_array_get_slice(IB_STATUS, &ib_result->link, &ib_result->trans, &ar_qd, &ib_array->ar_desc, ar_data, &ib_array->ar_size)) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
-
- tmp_ptr = ar_data; /* avoid changes in _arr_zval */
- if (_php_ibase_arr_zval(tmp, &tmp_ptr, ib_array, 0, flag TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
- efree(ar_data);
- }
- break;
- default:
- break;
- } /* switch */
-
- if (fetch_type & FETCH_ROW) {
- switch (Z_TYPE_P(tmp)) {
- case IS_STRING:
- add_index_stringl(return_value, i, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), 0);
- break;
- case IS_LONG:
- add_index_long(return_value, i, Z_LVAL_P(tmp));
- break;
- case IS_DOUBLE:
- add_index_double(return_value, i, Z_DVAL_P(tmp));
- break;
- }
- } else {
- switch (Z_TYPE_P(tmp)) {
- case IS_STRING:
- add_assoc_stringl(return_value, var->aliasname, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), 0);
- break;
- case IS_LONG:
- add_assoc_long(return_value, var->aliasname, Z_LVAL_P(tmp));
- break;
- case IS_DOUBLE:
- add_assoc_double(return_value, var->aliasname, Z_DVAL_P(tmp));
- break;
- }
- }
- efree(tmp);
- } else {
- if (fetch_type & FETCH_ROW) {
- add_index_null(return_value, i);
- } else {
- add_assoc_null(return_value, var->aliasname);
- }
- }
- if ((var->sqltype & ~1) == SQL_ARRAY) {
- arr_cnt++;
- }
- } /* for field */
-}
-/* }}} */
-
-/* {{{ proto array ibase_fetch_row(int result [, int blob_flag])
- Fetch a row from the results of a query */
-PHP_FUNCTION(ibase_fetch_row)
-{
- _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FETCH_ROW);
-}
-/* }}} */
-
-/* {{{ proto array ibase_fetch_assoc(int result [, int blob_flag])
- Fetch a row from the results of a query */
-PHP_FUNCTION(ibase_fetch_assoc)
-{
- _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FETCH_ARRAY);
-}
-/* }}} */
-
-/* {{{ proto object ibase_fetch_object(int result [, int blob_flag])
- Fetch a object from the results of a query */
-PHP_FUNCTION(ibase_fetch_object)
-{
- _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FETCH_ARRAY);
-
- if (Z_TYPE_P(return_value) == IS_ARRAY) {
- object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value));
- }
-}
-/* }}} */
-
-/* {{{ proto int ibase_free_result(int result)
- Free the memory used by a result */
-PHP_FUNCTION(ibase_free_result)
-{
- zval **result_arg;
- ibase_result *ib_result;
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, "InterBase result", le_result);
- zend_list_delete(Z_LVAL_PP(result_arg));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ibase_prepare([int link_identifier, ] string query)
- Prepare a query for later execution */
-PHP_FUNCTION(ibase_prepare)
-{
- zval **link_arg, **query_arg;
- int link_id, trans_n = 0, trans_id = 0;
- ibase_db_link *ib_link;
- ibase_query *ib_query;
- char *query;
-
- RESET_ERRMSG;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &query_arg) == FAILURE) {
- RETURN_FALSE;
- }
- link_id = IBG(default_link);
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, link_id, "InterBase link", le_link, le_plink);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &link_arg, &query_arg) == FAILURE) {
- RETURN_FALSE;
- }
- get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, link_arg, &ib_link, &trans_n, &trans_id);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string_ex(query_arg);
- query = Z_STRVAL_PP(query_arg);
-
- /* open default transaction */
- if (_php_ibase_def_trans(ib_link, trans_n TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (_php_ibase_alloc_query(&ib_query, ib_link->link, ib_link->trans[trans_n], query, ib_link->dialect TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
- ib_query->cursor_open = 0;
-
- zend_list_addref(link_id);
-
- ZEND_REGISTER_RESOURCE(return_value, ib_query, le_query);
-}
-/* }}} */
-
-/* {{{ proto int ibase_execute(int query [, int bind_args [, int ...]])
- Execute a previously prepared query */
-PHP_FUNCTION(ibase_execute)
-{
- zval ***args, **bind_args = NULL;
- ibase_query *ib_query;
- ibase_result *ib_result;
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS() < 1) {
- WRONG_PARAM_COUNT;
- }
-
- args = (zval ***) emalloc(ZEND_NUM_ARGS() * sizeof(zval **));
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(ib_query, ibase_query *, args[0], -1, "InterBase query", le_query);
-
- if (ZEND_NUM_ARGS() > 1) { /* have variables to bind */
- bind_args = args[1];
- }
-
- /* Have we used this cursor before and it's still open? */
- if (ib_query->cursor_open) {
- IBDEBUG("Implicitly closing a cursor");
- if (isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_close)) {
- efree(args);
- _php_ibase_error(TSRMLS_C);
- }
- }
-
- if (_php_ibase_exec(&ib_result, ib_query, ZEND_NUM_ARGS() - 1, bind_args TSRMLS_CC) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- efree(args);
-
- if (ib_result) { /* select statement */
- ib_query->cursor_open = 1;
- ZEND_REGISTER_RESOURCE(return_value, ib_result, le_result);
- } else {
- ib_query->cursor_open = 0;
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto int ibase_free_query(int query)
- Free memory used by a query */
-PHP_FUNCTION(ibase_free_query)
-{
- zval **query_arg;
- ibase_query *ib_query;
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &query_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ib_query, ibase_query *, query_arg, -1, "InterBase query", le_query);
- zend_list_delete(Z_LVAL_PP(query_arg));
- RETURN_TRUE;
-}
-/* }}} */
-
-#if HAVE_STRFTIME
-/* {{{ proto int ibase_timefmt(string format)
- Sets the format of timestamp, date and time columns returned from queries */
-PHP_FUNCTION(ibase_timefmt)
-{
- zval ***args;
- char *fmt = NULL;
- int type = PHP_IBASE_TIMESTAMP;
-
- RESET_ERRMSG; /* ??? */
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2) {
- WRONG_PARAM_COUNT;
- }
-
- args = (zval ***) emalloc(sizeof(zval **) * ZEND_NUM_ARGS());
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- convert_to_long_ex(args[1]);
- type = Z_LVAL_PP(args[1]);
- case 1:
- convert_to_string_ex(args[0]);
- fmt = Z_STRVAL_PP(args[0]);
- }
-
- switch (type) {
- case PHP_IBASE_TIMESTAMP:
- if (IBG(timestampformat)) {
- DL_FREE(IBG(timestampformat));
- }
- IBG(timestampformat) = DL_STRDUP(fmt);
- break;
- case PHP_IBASE_DATE:
- if (IBG(dateformat)) {
- DL_FREE(IBG(dateformat));
- }
- IBG(dateformat) = DL_STRDUP(fmt);
- break;
- case PHP_IBASE_TIME:
- if (IBG(timeformat)) {
- DL_FREE(IBG(timeformat));
- }
- IBG(timeformat) = DL_STRDUP(fmt);
- break;
- }
-
- efree(args);
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-/* {{{ proto int ibase_num_fields(int result)
- Get the number of fields in result */
-PHP_FUNCTION(ibase_num_fields)
-{
- zval **result;
- ibase_result *ib_result;
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result, -1, "InterBase result", le_result);
-
- if (ib_result->out_sqlda == NULL) {
- _php_ibase_module_error("Trying to get the number of fields from a non-select query");
- RETURN_FALSE;
- }
-
- RETURN_LONG(ib_result->out_sqlda->sqld);
-}
-/* }}} */
-
-/* {{{ proto array ibase_field_info(int result, int field_number)
- Get information about a field */
-PHP_FUNCTION(ibase_field_info)
-{
- zval *ret_val;
- zval **result_arg, **field_arg;
- ibase_result *ib_result;
- char buf[30], *s;
- int len;
- XSQLVAR *var;
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &result_arg, &field_arg)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, "InterBase result", le_result);
-
- if (ib_result->out_sqlda == NULL) {
- _php_ibase_module_error("Trying to get field info from a non-select query");
- RETURN_FALSE;
- }
-
- convert_to_long_ex(field_arg);
-
- if (Z_LVAL_PP(field_arg) < 0 || Z_LVAL_PP(field_arg) >= ib_result->out_sqlda->sqld) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- var = ib_result->out_sqlda->sqlvar + Z_LVAL_PP(field_arg);
-
- add_get_index_stringl(return_value, 0, var->sqlname, var->sqlname_length, (void **) &ret_val, 1);
- add_assoc_stringl(return_value, "name", var->sqlname, var->sqlname_length, 1);
-
- add_get_index_stringl(return_value, 1, var->aliasname, var->aliasname_length, (void **) &ret_val, 1);
- add_assoc_stringl(return_value, "alias", var->aliasname, var->aliasname_length, 1);
-
- add_get_index_stringl(return_value, 2, var->relname, var->relname_length, (void **) &ret_val, 1);
- add_assoc_stringl(return_value, "relation", var->relname, var->relname_length, 1);
-
- len = sprintf(buf, "%d", var->sqllen);
- add_get_index_stringl(return_value, 3, buf, len, (void **) &ret_val, 1);
- add_assoc_stringl(return_value, "length", buf, len, 1);
-
- switch (var->sqltype & ~1) {
- case SQL_TEXT: s = "TEXT"; break;
- case SQL_VARYING: s = "VARYING"; break;
- case SQL_SHORT: s = "SHORT"; break;
- case SQL_LONG: s = "LONG"; break;
- case SQL_FLOAT: s = "FLOAT"; break;
- case SQL_DOUBLE: s = "DOUBLE"; break;
- case SQL_D_FLOAT: s = "D_FLOAT"; break;
-#ifdef SQL_INT64
- case SQL_INT64: s = "INT64"; break;
-#endif
-#ifdef SQL_TIMESTAMP
- case SQL_TIMESTAMP: s = "TIMESTAMP"; break;
- case SQL_TYPE_DATE: s = "DATE"; break;
- case SQL_TYPE_TIME: s = "TIME"; break;
-#else
- case SQL_DATE: s = "DATE"; break;
-#endif
- case SQL_BLOB: s = "BLOB"; break;
- case SQL_ARRAY: s = "ARRAY"; break;
- case SQL_QUAD: s = "QUAD"; break;
- default:
- sprintf(buf, "unknown (%d)", var->sqltype & ~1);
- s = buf;
- break;
- }
- add_get_index_stringl(return_value, 4, s, strlen(s), (void **) &ret_val, 1);
- add_assoc_stringl(return_value, "type", s, strlen(s), 1);
-}
-/* }}} */
-
-/* blobs ----------------------------------- */
-
-/* {{{ _php_ibase_blob_info(isc_blob_handle bl_handle, IBASE_BLOBINFO *bl_info) */
-static int _php_ibase_blob_info(isc_blob_handle bl_handle, IBASE_BLOBINFO *bl_info TSRMLS_DC)
-{
- static char bl_items[] = {
- isc_info_blob_num_segments,
- isc_info_blob_max_segment,
- isc_info_blob_total_length,
- isc_info_blob_type
- };
-
- char bl_inf[sizeof(long)*8], *p;
-
- bl_info->max_segment = 0;
- bl_info->num_segments = 0;
- bl_info->total_length = 0;
- bl_info->bl_stream = 0;
-
- if (isc_blob_info(IB_STATUS, &bl_handle, sizeof(bl_items), bl_items, sizeof(bl_inf), bl_inf)) {
- _php_ibase_error(TSRMLS_C);
- return FAILURE;
- }
-
- for (p = bl_inf; *p != isc_info_end && p < bl_inf + sizeof(bl_inf);) {
- unsigned short item_len;
- int item = *p++;
-
- item_len = (short) isc_vax_integer(p, 2);
- p += 2;
- switch (item) {
- case isc_info_blob_num_segments:
- bl_info->num_segments = isc_vax_integer(p, item_len);
- break;
- case isc_info_blob_max_segment:
- bl_info->max_segment = isc_vax_integer(p, item_len);
- break;
- case isc_info_blob_total_length:
- bl_info->total_length = isc_vax_integer(p, item_len);
- break;
- case isc_info_blob_type:
- bl_info->bl_stream = isc_vax_integer(p, item_len);
- break;
- case isc_info_end:
- break;
- case isc_info_truncated:
- case isc_info_error: /* hmm. don't think so...*/
- _php_ibase_module_error("PHP module internal error");
- return FAILURE;
- } /* switch */
- p += item_len;
- } /* for */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto int ibase_blob_create([int link_identifier])
- Create blob for adding data */
-PHP_FUNCTION(ibase_blob_create)
-{
- zval **link_arg;
- int trans_n = 0, trans_id = 0, link_id;
- ibase_db_link *ib_link;
- ibase_blob_handle *ib_blob;
-
- RESET_ERRMSG;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- link_id = IBG(default_link);
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, link_id, "InterBase link", le_link, le_plink);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &link_arg) == FAILURE) {
- RETURN_FALSE;
- }
- get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, link_arg, &ib_link, &trans_n, &trans_id);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- /* open default transaction */
- if (_php_ibase_def_trans(ib_link, trans_n TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
-
- ib_blob = (ibase_blob_handle *) emalloc(sizeof(ibase_blob_handle));
- ib_blob->trans_handle = ib_link->trans[trans_n];
- ib_blob->link = ib_link->link;
- ib_blob->bl_handle = NULL;
-
- if (isc_create_blob(IB_STATUS, &ib_blob->link, &ib_blob->trans_handle, &ib_blob->bl_handle, &ib_blob->bl_qd)) {
- efree(ib_blob);
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
-
- RETURN_LONG(zend_list_insert(ib_blob, le_blob));
-}
-/* }}} */
-
-/* {{{ proto int ibase_blob_open(string blob_id)
- Open blob for retriving data parts */
-PHP_FUNCTION(ibase_blob_open)
-{
- zval **blob_arg;
- ibase_blob_handle *ib_blob, *ib_blob_id;
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &blob_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ib_blob = (ibase_blob_handle *) emalloc(sizeof(ibase_blob_handle));
-
- GET_BLOB_ID_ARG(*blob_arg, ib_blob_id);
-
- if (ib_blob_id == NULL) { /* blob IS NULL or argument unset */
- RETURN_FALSE;
- }
-
- ib_blob->link = ib_blob_id->link;
- ib_blob->trans_handle = ib_blob_id->trans_handle;
- ib_blob->bl_qd.gds_quad_high = ib_blob_id->bl_qd.gds_quad_high;
- ib_blob->bl_qd.gds_quad_low = ib_blob_id->bl_qd.gds_quad_low;
- ib_blob->bl_handle = NULL;
- if (isc_open_blob(IB_STATUS, &ib_blob->link, &ib_blob->trans_handle, &ib_blob->bl_handle, &ib_blob->bl_qd)) {
- efree(ib_blob);
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
-
- RETURN_LONG(zend_list_insert(ib_blob, le_blob));
-}
-/* }}} */
-
-/* {{{ proto int ibase_blob_add(int blob_id, string data)
- Add data into created blob */
-PHP_FUNCTION(ibase_blob_add)
-{
- zval **blob_arg, **string_arg;
- ibase_blob_handle *ib_blob;
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &blob_arg, &string_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- GET_BLOB_HANDLE_ARG(blob_arg, ib_blob);
-
- convert_to_string_ex(string_arg);
-
- if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, (unsigned short) Z_STRLEN_PP(string_arg), Z_STRVAL_PP(string_arg))) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string ibase_blob_get(int blob_id, int len)
- Get len bytes data from open blob */
-PHP_FUNCTION(ibase_blob_get)
-{
- zval **blob_arg, **len_arg;
- int stat;
- char *bl_data;
- unsigned short max_len = 0, cur_len, seg_len;
- ibase_blob_handle *ib_blob;
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &blob_arg, &len_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(len_arg);
- max_len = (unsigned short) Z_LVAL_PP(len_arg);
-
- GET_BLOB_HANDLE_ARG(blob_arg, ib_blob);
-
- if (ib_blob->bl_qd.gds_quad_high || ib_blob->bl_qd.gds_quad_low) { /*not null ?*/
-
- bl_data = emalloc(max_len + 1);
-
- for (cur_len = stat = 0; stat == 0;) {
- stat = isc_get_segment(IB_STATUS, &ib_blob->bl_handle, &seg_len, (unsigned short) (max_len-cur_len), &bl_data[cur_len]);
- cur_len += seg_len;
- if (cur_len > max_len) { /* never!*/
- efree(bl_data);
- _php_ibase_module_error("PHP module internal error");
- RETURN_FALSE;
- }
- }
-
- bl_data[cur_len] = '\0';
- if (IB_STATUS[0] && (IB_STATUS[1] != isc_segstr_eof && IB_STATUS[1] != isc_segment)) {
- efree(bl_data);
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
- RETURN_STRINGL(bl_data, cur_len, 0);
- } else { /* null blob */
- RETURN_STRING("", 1); /* empty string */
- }
-}
-/* }}} */
-
-#define BLOB_CLOSE 1
-#define BLOB_CANCEL 2
-
-/* {{{ _php_ibase_blob_end() */
-/* Close or Cancel created or Close open blob */
-static void _php_ibase_blob_end(INTERNAL_FUNCTION_PARAMETERS, int bl_end)
-{
- zval **blob_arg;
- ibase_blob_handle *ib_blob;
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &blob_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- GET_BLOB_HANDLE_ARG(blob_arg, ib_blob);
-
- if (bl_end == BLOB_CLOSE) { /* return id here */
- if (ib_blob->bl_qd.gds_quad_high || ib_blob->bl_qd.gds_quad_low) { /*not null ?*/
- if (isc_close_blob(IB_STATUS, &ib_blob->bl_handle)) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
- }
- ib_blob->bl_handle = NULL;
- RETVAL_STRINGL((char *) ib_blob, sizeof(ibase_blob_handle), 1);
- zend_list_delete(Z_LVAL_PP(blob_arg));
- } else { /* discard created blob */
- if (isc_cancel_blob(IB_STATUS, &ib_blob->bl_handle)) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
- ib_blob->bl_handle = NULL;
- zend_list_delete(Z_LVAL_PP(blob_arg));
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto int ibase_blob_close(int blob_id)
- Close blob */
-PHP_FUNCTION(ibase_blob_close)
-{
- _php_ibase_blob_end(INTERNAL_FUNCTION_PARAM_PASSTHRU, BLOB_CLOSE);
-}
-/* }}} */
-
-/* {{{ proto int ibase_blob_cancel(int blob_id)
- Cancel creating blob */
-PHP_FUNCTION(ibase_blob_cancel)
-{
- _php_ibase_blob_end(INTERNAL_FUNCTION_PARAM_PASSTHRU, BLOB_CANCEL);
-}
-/* }}} */
-
-/* {{{ proto object ibase_blob_info(string blob_id_str)
- Return blob length and other useful info */
-PHP_FUNCTION(ibase_blob_info)
-{
- zval **blob_arg, **result_var;
- ibase_blob_handle *ib_blob_id;
- IBASE_BLOBINFO bl_info;
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &blob_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- GET_BLOB_ID_ARG(*blob_arg, ib_blob_id);
-
- array_init(return_value);
-
- if (ib_blob_id->bl_qd.gds_quad_high || ib_blob_id->bl_qd.gds_quad_low) { /* not null ? */
- if (isc_open_blob(IB_STATUS, &ib_blob_id->link, &ib_blob_id->trans_handle, &ib_blob_id->bl_handle, &ib_blob_id->bl_qd)) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
-
- if (_php_ibase_blob_info(ib_blob_id->bl_handle, &bl_info)) {
- RETURN_FALSE;
- }
- if (isc_close_blob(IB_STATUS, &ib_blob_id->bl_handle)) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
- ib_blob_id->bl_handle = NULL;
- } else { /* null blob, all values to zero */
- bl_info.max_segment = 0;
- bl_info.num_segments = 0;
- bl_info.total_length = 0;
- bl_info.bl_stream = 0;
- }
-
- /* FIXME */
- add_get_index_long(return_value, 0, bl_info.total_length, (void **) &result_var);
- /*
- zend_hash_pointer_update(Z_ARRVAL_P(return_value), "length", sizeof("length"), result_var);
- */
-
- add_get_index_long(return_value, 1, bl_info.num_segments, (void **) &result_var);
- /*
- zend_hash_pointer_update(Z_ARRVAL_P(return_value), "numseg", sizeof("numseg"), result_var);
- */
-
- add_get_index_long(return_value, 2, bl_info.max_segment, (void **) &result_var);
- /*
- zend_hash_pointer_update(Z_ARRVAL_P(return_value), "maxseg", sizeof("maxseg"), result_var);
- */
-
- add_get_index_long(return_value, 3, bl_info.bl_stream, (void **) &result_var);
- /*
- zend_hash_pointer_update(Z_ARRVAL_P(return_value), "stream", sizeof("stream"), result_var);
- */
-
- add_get_index_long(return_value, 4, (!ib_blob_id->bl_qd.gds_quad_high && !ib_blob_id->bl_qd.gds_quad_low), (void **) &result_var);
- /*
- zend_hash_pointer_update(Z_ARRVAL_P(return_value), "isnull", sizeof("isnull"), result_var);
- */
-}
-/* }}} */
-
-/* {{{ proto int ibase_blob_echo(string blob_id_str)
- Output blob contents to browser */
-PHP_FUNCTION(ibase_blob_echo)
-{
- zval **blob_arg;
- char bl_data[IBASE_BLOB_SEG];
- unsigned short seg_len;
- ibase_blob_handle *ib_blob_id;
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &blob_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- GET_BLOB_ID_ARG(*blob_arg, ib_blob_id);
-
- if (ib_blob_id) { /* not null? */
-
- if (isc_open_blob(IB_STATUS, &ib_blob_id->link, &ib_blob_id->trans_handle, &ib_blob_id->bl_handle, &ib_blob_id->bl_qd)) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
-
- while (!isc_get_segment(IB_STATUS, &ib_blob_id->bl_handle, &seg_len, sizeof(bl_data), bl_data) || IB_STATUS[1] == isc_segment) {
- PHPWRITE(bl_data, seg_len);
- }
-
- if (IB_STATUS[0] && (IB_STATUS[1] != isc_segstr_eof)) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
-
- if (isc_close_blob(IB_STATUS, &ib_blob_id->bl_handle)) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
- ib_blob_id->bl_handle = NULL;
- } /* not null ? */
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string ibase_blob_import([link_identifier, ] int file_id)
- Create blob, copy file in it, and close it */
-PHP_FUNCTION(ibase_blob_import)
-{
- zval **link_arg, **file_arg;
- int trans_n = 0, link_id = 0, trans_id = 0, size;
- unsigned short b;
- ibase_blob_handle ib_blob;
- ibase_db_link *ib_link;
- char bl_data[IBASE_BLOB_SEG]; /* FIXME? blob_seg_size parameter? */
- php_stream *stream;
-
- RESET_ERRMSG;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &file_arg) == FAILURE) {
- RETURN_FALSE;
- }
- link_id = IBG(default_link);
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, link_id, "InterBase link", le_link, le_plink);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &link_arg, &file_arg) == FAILURE) {
- RETURN_FALSE;
- }
- get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, link_arg, &ib_link, &trans_n, &trans_id);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- /* open default transaction */
- if (_php_ibase_def_trans(ib_link, trans_n TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
-
- php_stream_from_zval(stream, file_arg);
-
- ib_blob.link = ib_link->link;
- ib_blob.trans_handle = ib_link->trans[trans_n];
- ib_blob.bl_handle = NULL;
- ib_blob.bl_qd.gds_quad_high = 0;
- ib_blob.bl_qd.gds_quad_low = 0;
-
- if (isc_create_blob(IB_STATUS, &ib_blob.link, &ib_blob.trans_handle, &ib_blob.bl_handle, &ib_blob.bl_qd)) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
-
- size = 0;
-
- while ((b = php_stream_read(stream, bl_data, sizeof(bl_data))) > 0) {
- if (isc_put_segment(IB_STATUS, &ib_blob.bl_handle, b, bl_data)) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
- size += b;
- }
-
- if (isc_close_blob(IB_STATUS, &ib_blob.bl_handle)) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- }
-
- ib_blob.bl_handle = NULL;
- RETVAL_STRINGL((char *) &ib_blob, sizeof(ibase_blob_handle), 1);
-}
-/* }}} */
-
-#ifdef SQL_DIALECT_V6
-/* {{{ _php_ibase_user() */
-static void _php_ibase_user(INTERNAL_FUNCTION_PARAMETERS, int operation)
-{
- zval **args[8];
- char *ib_server, *dba_user_name, *dba_password, *user_name, *user_password = NULL;
- char *first_name = NULL, *middle_name = NULL, *last_name = NULL;
- char service_name_buffer[128], *service_name = service_name_buffer;
- char spb_buffer[128], *spb = spb_buffer;
- unsigned short spb_length;
- isc_svc_handle service_handle = NULL;
-
- RESET_ERRMSG;
-
- switch (operation) {
- case isc_action_svc_add_user:
- case isc_action_svc_modify_user:
- /* 5 to 8 parameters for ADD or MODIFY operation */
- if (ZEND_NUM_ARGS() < 5 || ZEND_NUM_ARGS() > 8) {
- WRONG_PARAM_COUNT;
- }
- break;
-
- case isc_action_svc_delete_user:
- /* 4 parameters for DELETE operation */
- if (ZEND_NUM_ARGS() != 4) {
- WRONG_PARAM_COUNT;
- }
- }
-
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- RETURN_FALSE;
- }
-
- switch (ZEND_NUM_ARGS()) {
- case 8:
- convert_to_string_ex(args[7]);
- last_name = Z_STRVAL_PP(args[7]);
- /* fallout */
- case 7:
- convert_to_string_ex(args[6]);
- middle_name = Z_STRVAL_PP(args[6]);
- /* fallout */
- case 6:
- convert_to_string_ex(args[5]);
- first_name = Z_STRVAL_PP(args[5]);
- /* fallout */
- }
-
- if (operation != isc_action_svc_delete_user) {
- /* Parameter not available for DELETE operation */
- convert_to_string_ex(args[4]);
- user_password = Z_STRVAL_PP(args[4]);
- }
-
- convert_to_string_ex(args[3]);
- user_name = Z_STRVAL_PP(args[3]);
-
- convert_to_string_ex(args[2]);
- dba_password = Z_STRVAL_PP(args[2]);
-
- convert_to_string_ex(args[1]);
- dba_user_name = Z_STRVAL_PP(args[1]);
-
- convert_to_string_ex(args[0]);
- ib_server = Z_STRVAL_PP(args[0]);
-
-/*
- zend_printf("server : %s<br>", ib_server);
- zend_printf("admin : %s<br>", dba_user_name);
- zend_printf("admin pwd: %s<br>", dba_password);
- zend_printf("user : %s<br>", user_name);
- zend_printf("user pwd : %s<br>", user_password);
- zend_printf("fname : %s<br>", first_name);
- zend_printf("mname : %s<br>", middle_name);
- zend_printf("lname : %s<br>", last_name);
-*/
-
- /* Build buffer for isc_service_attach() */
- *spb++ = isc_spb_version;
- *spb++ = isc_spb_current_version;
- *spb++ = isc_spb_user_name;
- *spb++ = strlen(dba_user_name);
- strcpy(spb, dba_user_name);
- spb += strlen(dba_user_name);
- *spb++ = isc_spb_password;
- *spb++ = strlen(dba_password);
- strcpy(spb, dba_password);
- spb += strlen(dba_password);
- spb_length = spb - spb_buffer;
-
- /* Attach to the Service Manager */
- sprintf(service_name, "%s:service_mgr", ib_server);
- if (isc_service_attach(IB_STATUS, 0, service_name, &service_handle, spb_length, spb_buffer)) {
- _php_ibase_error(TSRMLS_C);
- RETURN_FALSE;
- } else {
- char request[128], *x, *p = request;
-
- /* Identify cluster (here, isc_action_svc_*_user) */
- *p++ = operation;
-
- /* Argument for username */
- *p++ = isc_spb_sec_username;
- ADD_SPB_LENGTH(p, strlen(user_name));
- for (x = user_name ; *x;) *p++ = *x++;
-
- /* Argument for password */
- if (user_password) {
- *p++ = isc_spb_sec_password;
- ADD_SPB_LENGTH(p, strlen(user_password));
- for (x = user_password ; *x;) *p++ = *x++;
- }
-
- /* Argument for first name */
- if (first_name) {
- *p++ = isc_spb_sec_firstname;
- ADD_SPB_LENGTH(p, strlen(first_name));
- for (x = first_name ; *x;) *p++ = *x++;
- }
-
- /* Argument for middle name */
- if (middle_name) {
- *p++ = isc_spb_sec_middlename;
- ADD_SPB_LENGTH(p, strlen(middle_name));
- for (x = middle_name ; *x;) *p++ = *x++;
- }
-
- /* Argument for last name */
- if (last_name) {
- *p++ = isc_spb_sec_lastname;
- ADD_SPB_LENGTH(p, strlen(last_name));
- for (x = last_name ; *x;) *p++ = *x++;
- }
-
- /* Let's go update: start Service Manager */
- if (isc_service_start(IB_STATUS, &service_handle, NULL, (unsigned short) (p - request), request)) {
- _php_ibase_error(TSRMLS_C);
- isc_service_detach(IB_STATUS, &service_handle);
- RETURN_FALSE;
- } else {
- /* Detach from Service Manager */
- isc_service_detach(IB_STATUS, &service_handle);
- }
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ibase_add_user(string server, string dba_user_name, string dba_password, string user_name, string password [, string first_name [, string middle_name [, string last_name]]])
- Add an user to security database (only for IB6 or later) */
-PHP_FUNCTION(ibase_add_user)
-{
- _php_ibase_user(INTERNAL_FUNCTION_PARAM_PASSTHRU, isc_action_svc_add_user);
-}
-/* }}} */
-
-/* {{{ proto int ibase_modify_user(string server, string dba_user_name, string dba_password, string user_name, string password [, string first_name [, string middle_name [, string last_name]]])
- Modify an user in security database (only for IB6 or later) */
-PHP_FUNCTION(ibase_modify_user)
-{
- _php_ibase_user(INTERNAL_FUNCTION_PARAM_PASSTHRU, isc_action_svc_modify_user);
-}
-/* }}} */
-
-/* {{{ proto int ibase_delete_user(string server, string dba_user_name, string dba_password, string username)
- Delete an user from security database (only for IB6 or later) */
-PHP_FUNCTION(ibase_delete_user)
-{
- _php_ibase_user(INTERNAL_FUNCTION_PARAM_PASSTHRU, isc_action_svc_delete_user);
-}
-/* }}} */
-#endif /* SQL_DIALECT_V6 */
-
-#endif /* HAVE_IBASE */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/interbase/interbase.dsp b/ext/interbase/interbase.dsp
deleted file mode 100644
index 0ded651ccc..0000000000
--- a/ext/interbase/interbase.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="interbase" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=interbase - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "interbase.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "interbase.mak" CFG="interbase - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "interbase - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "interbase - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "interbase - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\Interbase SDK\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\Interbase SDK\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_IBASE=1 /D "COMPILE_DL_INTERBASE" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ib_util_ms.lib gds32_ms.lib php4ts_debug.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib gds32_ms.lib php4ts_debug.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_interbase.dll" /pdbtype:sept /libpath:"..\..\..\php_build\Interbase SDK\lib_ms" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "interbase - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\Interbase SDK\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_IBASE=1 /D ZEND_DEBUG=0 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\Interbase SDK\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_IBASE=1 /D "COMPILE_DL_INTERBASE" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ib_util_ms.lib gds32_ms.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib gds32_ms.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_interbase.dll" /libpath:"..\..\..\php_build\Interbase SDK\lib_ms" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "interbase - Win32 Debug_TS"
-# Name "interbase - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\interbase.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_interbase.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/interbase/php_interbase.h b/ext/interbase/php_interbase.h
deleted file mode 100644
index 72c942e9a9..0000000000
--- a/ext/interbase/php_interbase.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jouni Ahto <jouni.ahto@exdec.fi> |
- | Andrew Avdeev <andy@simgts.mv.ru> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_INTERBASE_H
-#define PHP_INTERBASE_H
-
-#if HAVE_IBASE
-#include <ibase.h>
-
-extern zend_module_entry ibase_module_entry;
-#define phpext_interbase_ptr &ibase_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_IBASE_API __declspec(dllexport)
-#ifndef ISC_INT64_FORMAT
- #define ISC_INT64_FORMAT "I64"
-#endif
-#else
-#define PHP_IBASE_API
-#ifndef ISC_INT64_FORMAT
- #define ISC_INT64_FORMAT "ll"
-#endif
-#endif
-
-PHP_MINIT_FUNCTION(ibase);
-PHP_RINIT_FUNCTION(ibase);
-PHP_MSHUTDOWN_FUNCTION(ibase);
-PHP_RSHUTDOWN_FUNCTION(ibase);
-PHP_MINFO_FUNCTION(ibase);
-
-PHP_FUNCTION(ibase_connect);
-PHP_FUNCTION(ibase_pconnect);
-PHP_FUNCTION(ibase_close);
-PHP_FUNCTION(ibase_query);
-PHP_FUNCTION(ibase_fetch_row);
-PHP_FUNCTION(ibase_fetch_assoc);
-PHP_FUNCTION(ibase_fetch_object);
-PHP_FUNCTION(ibase_free_result);
-PHP_FUNCTION(ibase_prepare);
-PHP_FUNCTION(ibase_execute);
-PHP_FUNCTION(ibase_free_query);
-#if HAVE_STRFTIME
-PHP_FUNCTION(ibase_timefmt);
-#endif
-
-PHP_FUNCTION(ibase_num_fields);
-PHP_FUNCTION(ibase_field_info);
-
-PHP_FUNCTION(ibase_trans);
-PHP_FUNCTION(ibase_commit);
-PHP_FUNCTION(ibase_rollback);
-
-PHP_FUNCTION(ibase_blob_create);
-PHP_FUNCTION(ibase_blob_add);
-PHP_FUNCTION(ibase_blob_cancel);
-PHP_FUNCTION(ibase_blob_open);
-PHP_FUNCTION(ibase_blob_get);
-PHP_FUNCTION(ibase_blob_close);
-PHP_FUNCTION(ibase_blob_echo);
-PHP_FUNCTION(ibase_blob_info);
-PHP_FUNCTION(ibase_blob_import);
-#ifdef SQL_DIALECT_V6
-PHP_FUNCTION(ibase_add_user);
-PHP_FUNCTION(ibase_modify_user);
-PHP_FUNCTION(ibase_delete_user);
-#endif
-PHP_FUNCTION(ibase_errmsg);
-
-#define IBASE_MSGSIZE 256
-#define MAX_ERRMSG (IBASE_MSGSIZE*2)
-#define IBASE_TRANS_ON_LINK 10
-#define IBASE_BLOB_SEG 4096
-
-ZEND_BEGIN_MODULE_GLOBALS(ibase)
- ISC_STATUS status[20];
- long default_link;
- long num_links, num_persistent;
- long max_links, max_persistent;
- long allow_persistent;
- char *default_user, *default_password;
- char *timestampformat;
- char *cfg_timestampformat;
- char *dateformat;
- char *cfg_dateformat;
- char *timeformat;
- char *cfg_timeformat;
- char *errmsg;
-ZEND_END_MODULE_GLOBALS(ibase)
-
-typedef struct {
- isc_tr_handle trans[IBASE_TRANS_ON_LINK];
- isc_db_handle link;
- unsigned short dialect;
-} ibase_db_link;
-
-typedef struct {
- int trans_num;
- int link_rsrc;
-} ibase_tr_link;
-
-typedef struct {
- ISC_ARRAY_DESC ar_desc;
- int el_type, /* sqltype kinda SQL_TEXT, ...*/
- el_size; /* element size in bytes */
- ISC_LONG ISC_FAR ar_size; /* all array size in bytes */
-} ibase_array;
-
-typedef struct {
- isc_tr_handle trans_handle;
- isc_db_handle link;
- ISC_QUAD bl_qd;
- isc_blob_handle bl_handle;
-} ibase_blob_handle;
-
-typedef struct {
- isc_db_handle link; /* db link for this result */
- isc_tr_handle trans;
- isc_stmt_handle stmt;
- int drop_stmt;
- XSQLDA *in_sqlda, *out_sqlda;
- ibase_array *in_array, *out_array;
- int in_array_cnt, out_array_cnt;
- unsigned short dialect;
- int cursor_open;
-} ibase_query;
-
-typedef struct {
- isc_db_handle link; /* db link for this result */
- isc_tr_handle trans;
- isc_stmt_handle stmt;
- int drop_stmt;
- XSQLDA *out_sqlda;
- ibase_array *out_array;
-} ibase_result;
-
-typedef struct _php_ibase_varchar {
- short var_len;
- char var_str[1];
-} IBASE_VCHAR;
-
-/* extern ibase_module php_ibase_module; */
-
-enum php_interbase_option {
- PHP_IBASE_DEFAULT = 0,
- PHP_IBASE_TEXT = 1,
- PHP_IBASE_UNIXTIME = 2,
- PHP_IBASE_READ = 4,
- PHP_IBASE_COMMITTED = 8,
- PHP_IBASE_CONSISTENCY = 16,
- PHP_IBASE_NOWAIT = 32,
- PHP_IBASE_TIMESTAMP = 64,
- PHP_IBASE_DATE = 128,
- PHP_IBASE_TIME = 256
-};
-
-#ifdef ZTS
-#define IBG(v) TSRMG(ibase_globals_id, zend_ibase_globals *, v)
-#else
-#define IBG(v) (ibase_globals.v)
-#endif
-
-#else
-
-#define phpext_interbase_ptr NULL
-
-#endif /* HAVE_IBASE */
-
-#endif /* PHP_INTERBASE_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/interbase/tests/002.phpt b/ext/interbase/tests/002.phpt
deleted file mode 100644
index 94f2fbdb97..0000000000
--- a/ext/interbase/tests/002.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-InterBase: connect, close and pconnect
---SKIPIF--
-<?php include("skipif.inc"); ?>
---POST--
---GET--
---FILE--
-<?php /* $Id$ */
-
- require("interbase.inc");
-
- $test_base = dirname(__FILE__)."/ibase_test.tmp";
-
- ibase_connect($test_base);
- out_table("test1");
- ibase_close();
-
- $con = ibase_connect($test_base);
- $pcon1 = ibase_pconnect($test_base);
- $pcon2 = ibase_pconnect($test_base);
- ibase_close($con);
- ibase_close($pcon1);
-
- out_table("test1");
-
- ibase_close($pcon2);
-?>
---EXPECT--
---- test1 ---
-1 test table created with isql
----
---- test1 ---
-1 test table created with isql
----
diff --git a/ext/interbase/tests/003.phpt b/ext/interbase/tests/003.phpt
deleted file mode 100644
index dbd1cec92b..0000000000
--- a/ext/interbase/tests/003.phpt
+++ /dev/null
@@ -1,87 +0,0 @@
---TEST--
-InterBase: misc sql types (may take a while)
---SKIPIF--
-<?php include("skipif.inc"); ?>
---POST--
---GET--
---FILE--
-<?php
-
- require("interbase.inc");
-
- ibase_connect($test_base);
-
- ibase_query(
- "create table test3 (
- iter integer,
- v_char char(1000),
- v_date timestamp,
- v_decimal decimal(12,3),
- v_double double precision,
- v_float float,
- v_integer integer,
- v_numeric numeric(4,2),
- v_smallint smallint,
- v_varchar varchar(10000)
- )");
- ibase_commit();
-
- /* if timefmt is not supported, suppress error here */
- @ibase_timefmt("%m/%d/%Y %H:%M:%S");
-
- for($iter = 0; $iter < 10; $iter++){
- /* prepare data */
- $v_char = rand_str(1000);
- $v_date = rand_datetime();
- $v_decimal = rand_number(12,3);
- $v_double = rand_number(18);
- $v_float = rand_number(7);
- $v_integer = rand_number(9,0);
- $v_numeric = rand_number(4,2);
- $v_smallint = rand_number(5) % 32767;
- $v_varchar = rand_str(10000);
-
- ibase_query(
- "insert into test3 (iter, v_char,v_date,v_decimal,v_double,v_float,v_integer,v_numeric,v_smallint,v_varchar)
- values ($iter, '$v_char','$v_date',$v_decimal,$v_double,$v_float,$v_integer,$v_numeric,$v_smallint,'$v_varchar')");
- $sel = ibase_query("select * from test3 where iter = $iter");
- $sel = ibase_query("select * from test3 where iter = $iter");
- $row = ibase_fetch_object($sel);
- if(substr($row->V_CHAR,0,strlen($v_char)) != $v_char){
- echo " CHAR fail:\n";
- echo " in: $v_char\n";
- echo " out: $row->V_CHAR\n";
- }
- if($row->V_DATE != $v_date){
- echo " DATE fail\n";
- echo " in: $v_date\n";
- echo " out: $row->V_DATE\n";
- }
- if($row->V_DECIMAL != $v_decimal){
- echo " DECIMAL fail\n";
- echo " in: $v_decimal\n";
- echo " out: $row->V_DECIMAL\n";
- }
- if(abs($row->V_DOUBLE - $v_double) > abs($v_double / 1E15)){
- echo " DOUBLE fail\n";
- echo " in: $v_double\n";
- echo " out: $row->V_DOUBLE\n";
- }
- if(abs($row->V_FLOAT - $v_float) > abs($v_float / 1E7)){
- echo " FLOAT fail\n";
- echo " in: $v_float\n";
- echo " out: $row->V_FLOAT\n";
- }
- if($row->V_INTEGER != $v_integer){
- echo " INTEGER fail\n";
- echo " in: $v_integer\n";
- echo " out: $row->V_INTEGER\n";
- }
- ibase_free_result($sel);
- } /* for($iter) */
-
- ibase_close();
- echo "end of test\n";
-?>
---EXPECT--
-end of test
diff --git a/ext/interbase/tests/004.phpt b/ext/interbase/tests/004.phpt
deleted file mode 100644
index 1ed6415324..0000000000
--- a/ext/interbase/tests/004.phpt
+++ /dev/null
@@ -1,177 +0,0 @@
---TEST--
-InterBase: BLOB test
---SKIPIF--
-<?php include("skipif.inc"); ?>
---POST--
---GET--
---FILE--
-<?php
-
- require("interbase.inc");
-
- ibase_connect($test_base);
-
- ibase_query(
- "create table test4 (
- v_integer integer,
- v_blob blob)");
- ibase_commit();
-
- /* create 10k blob file */
- $blob_str = rand_binstr(10*1024);
-
- $name = tempnam(dirname(__FILE__),"blob.tmp");
- $ftmp = fopen($name,"w");
- fwrite($ftmp,$blob_str);
- fclose($ftmp);
-
- echo "import blob 1\n";
- $ftmp = fopen($name,"r");
- $bl_s = ibase_blob_import($ftmp);
- ibase_query("insert into test4 (v_integer, v_blob) values (1, ?)", $bl_s);
-
- echo "test blob 1\n";
- $q = ibase_query("select v_blob from test4 where v_integer = 1");
- $row = ibase_fetch_object($q);
- $bl_h = ibase_blob_open($row->V_BLOB);
-
- $blob = '';
- while($piece = ibase_blob_get($bl_h, rand() % 1024))
- $blob .= $piece;
- if($blob != $blob_str)
- echo " BLOB 1 fail\n";
- ibase_blob_close($bl_h);
- ibase_free_result($q);
- unset($blob);
-
- echo "create blob 2\n";
-
- $bl_h = ibase_blob_create();
- $ftmp = fopen($name,"r");
- while($piece = fread($ftmp, rand() % 1024)){
- ibase_blob_add($bl_h, $piece);
- }
- fclose($ftmp);
- $bl_s = ibase_blob_close($bl_h);
- ibase_query("insert into test4 (v_integer, v_blob) values (2, ?)", $bl_s);
-
- echo "test blob 2\n";
-
- $q = ibase_query("select v_blob from test4 where v_integer = 2");
- $row = ibase_fetch_object($q);
- $bl_h = ibase_blob_open($row->V_BLOB);
- $blob = '';
- while($piece = ibase_blob_get($bl_h, rand() % 1024))
- $blob .= $piece;
- if($blob != $blob_str)
- echo " BLOB 2 fail\n";
- ibase_blob_close($bl_h);
- ibase_free_result($q);
- unset($blob);
-
-
- echo "create blob 3\n";
-
- $bl_h = ibase_blob_create();
-
- ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
- ibase_blob_add($bl_h, "| PHP HTML Embedded Scripting Language Version 3.0 |\n");
- ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
- ibase_blob_add($bl_h, "| Copyright (c) 1997-2000 PHP Development Team (See Credits file) |\n");
- ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
- ibase_blob_add($bl_h, "| This program is free software; you can redistribute it and/or modify |\n");
- ibase_blob_add($bl_h, "| it under the terms of one of the following licenses: |\n");
- ibase_blob_add($bl_h, "| |\n");
- ibase_blob_add($bl_h, "| A) the GNU General Public License as published by the Free Software |\n");
- ibase_blob_add($bl_h, "| Foundation; either version 2 of the License, or (at your option) |\n");
- ibase_blob_add($bl_h, "| any later version. |\n");
- ibase_blob_add($bl_h, "| |\n");
- ibase_blob_add($bl_h, "| B) the PHP License as published by the PHP Development Team and |\n");
- ibase_blob_add($bl_h, "| included in the distribution in the file: LICENSE |\n");
- ibase_blob_add($bl_h, "| |\n");
- ibase_blob_add($bl_h, "| This program is distributed in the hope that it will be useful, |\n");
- ibase_blob_add($bl_h, "| but WITHOUT ANY WARRANTY; without even the implied warranty of |\n");
- ibase_blob_add($bl_h, "| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |\n");
- ibase_blob_add($bl_h, "| GNU General Public License for more details. |\n");
- ibase_blob_add($bl_h, "| |\n");
- ibase_blob_add($bl_h, "| You should have received a copy of both licenses referred to here. |\n");
- ibase_blob_add($bl_h, "| If you did not, or have any questions about PHP licensing, please |\n");
- ibase_blob_add($bl_h, "| contact core@php.net. |\n");
- ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
- $bl_s = ibase_blob_close($bl_h);
- ibase_query("insert into test4 (v_integer, v_blob) values (3, ?)", $bl_s);
-
- echo "echo blob 3\n";
-
- $q = ibase_query("select v_blob from test4 where v_integer = 3");
- $row = ibase_fetch_object($q);
- ibase_blob_echo($row->V_BLOB);
- ibase_free_result($q);
-
- echo "fetch blob 3\n";
- $q = ibase_query("select v_blob from test4 where v_integer = 3");
- $row = ibase_fetch_object($q,IBASE_TEXT);
- echo $row->V_BLOB;
- ibase_free_result($q);
-
- ibase_close();
- unlink($name);
- echo "end of test\n";
-?>
---EXPECT--
-import blob 1
-test blob 1
-create blob 2
-test blob 2
-create blob 3
-echo blob 3
-+----------------------------------------------------------------------+
-| PHP HTML Embedded Scripting Language Version 3.0 |
-+----------------------------------------------------------------------+
-| Copyright (c) 1997-2000 PHP Development Team (See Credits file) |
-+----------------------------------------------------------------------+
-| This program is free software; you can redistribute it and/or modify |
-| it under the terms of one of the following licenses: |
-| |
-| A) the GNU General Public License as published by the Free Software |
-| Foundation; either version 2 of the License, or (at your option) |
-| any later version. |
-| |
-| B) the PHP License as published by the PHP Development Team and |
-| included in the distribution in the file: LICENSE |
-| |
-| This program is distributed in the hope that it will be useful, |
-| but WITHOUT ANY WARRANTY; without even the implied warranty of |
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
-| GNU General Public License for more details. |
-| |
-| You should have received a copy of both licenses referred to here. |
-| If you did not, or have any questions about PHP licensing, please |
-| contact core@php.net. |
-+----------------------------------------------------------------------+
-fetch blob 3
-+----------------------------------------------------------------------+
-| PHP HTML Embedded Scripting Language Version 3.0 |
-+----------------------------------------------------------------------+
-| Copyright (c) 1997-2000 PHP Development Team (See Credits file) |
-+----------------------------------------------------------------------+
-| This program is free software; you can redistribute it and/or modify |
-| it under the terms of one of the following licenses: |
-| |
-| A) the GNU General Public License as published by the Free Software |
-| Foundation; either version 2 of the License, or (at your option) |
-| any later version. |
-| |
-| B) the PHP License as published by the PHP Development Team and |
-| included in the distribution in the file: LICENSE |
-| |
-| This program is distributed in the hope that it will be useful, |
-| but WITHOUT ANY WARRANTY; without even the implied warranty of |
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
-| GNU General Public License for more details. |
-| |
-| You should have received a copy of both licenses referred to here. |
-| If you did not, or have any questions about PHP licensing, please |
-| contact core@php.net. |
-+----------------------------------------------------------------------+
-end of test
diff --git a/ext/interbase/tests/005.phpt b/ext/interbase/tests/005.phpt
deleted file mode 100644
index cf86ca5c8a..0000000000
--- a/ext/interbase/tests/005.phpt
+++ /dev/null
@@ -1,271 +0,0 @@
---TEST--
-InterBase: transactions
---SKIPIF--
-<?php include("skipif.inc"); ?>
---POST--
---GET--
---FILE--
-<?php
-
- require("interbase.inc");
-
- ibase_connect($test_base);
-
- @ibase_query("create table test5 (i integer)");
- @ibase_query("delete from test5");
- ibase_close();
-
-
- echo "default transaction:\n";
-
-/*
-Difference between default and other transactions:
-default commited when you call ibase_close().
-Other transaction doing rollback.
-
-If you not open default transaction with
-ibase_trans, default transaction open
-when you call ibase_query(), ibase_prepare(),
-ibase_blob_create(), ibase_blob_import() first time.
-*/
-
-/*
-simple default transaction test without ibase_trans()
-*/
-
- ibase_connect($test_base);
-
- echo "empty table\n";
-
- /* out_table call ibase_query()
- and ibase_query() start default transaction */
- out_table("test5");
-
- /* in default transaction context */
- ibase_query("insert into test5 (i) values (1)");
-
- echo "one row\n";
- out_table("test5");
-
- ibase_rollback(); /* default rolled */
-
- echo "after rollback table empty again\n";
- out_table("test5"); /* started new default transaction */
-
- ibase_query("insert into test5 (i) values (2)");
-
- ibase_close(); /* commit here! */
-
- ibase_connect($test_base);
-
- echo "one row\n";
- out_table("test5");
- ibase_close();
-
-/*
-default transaction on default link
-First open transaction on link will be default.
-$tr_def_l1 may be ommited. All queryes without link and trans
-parameters run in this context
-*/
-
- $link_def = ibase_connect($test_base);
-
- $tr_def_l1 = ibase_trans(IBASE_READ); /* here transaction start */
-
- /* all default */
- $res = ibase_query("select * from test5");
-
- echo "one row\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- /* specify transaction context... */
- $res = ibase_query($tr_def_l1, "select * from test5");
-
- echo "one row... again.\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- /* specify default transaction on link */
- $res = ibase_query($link_def, "select * from test5");
-
- echo "one row.\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- ibase_rollback($link_def); /* just for example */
-
- ibase_close();
-
-/*
-three transaction on default link
-*/
- ibase_connect($test_base);
-
- $tr_1 = ibase_trans(); /* this default transaction also */
- $tr_2 = ibase_trans(IBASE_READ);
- $tr_3 = ibase_trans(IBASE_READ+IBASE_COMMITTED);
-
- $res = ibase_query("select * from test5");
-
- echo "one row\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- /* insert in first transaction context... */
- /* as default */
- ibase_query("insert into test5 (i) values (3)");
- /* specify context */
- ibase_query($tr_1, "insert into test5 (i) values (4)");
-
- $res = ibase_query("select * from test5");
-
- echo "three rows\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- $res = ibase_query($tr_1, "select * from test5");
-
- echo "three rows again\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- ibase_commit($tr_1);
-
- $res = ibase_query($tr_2, "select * from test5");
-
- echo "one row in second transaction\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- $res = ibase_query($tr_3, "select * from test5");
-
- echo "three rows in third transaction\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- ibase_close();
-/*
-transactions on second link
-*/
- $link_1 = ibase_pconnect($test_base);
- $link_2 = ibase_pconnect($test_base);
-
- $tr_1 = ibase_trans(IBASE_DEFAULT, $link_2); /* this default transaction also */
- $tr_2 = ibase_trans(IBASE_COMMITTED, $link_2);
-
- $res = ibase_query($tr_1, "select * from test5");
-
- echo "three rows\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- ibase_query($tr_1, "insert into test5 (i) values (5)");
-
- $res = ibase_query($tr_1, "select * from test5");
-
- echo "four rows\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- ibase_commit($tr_1);
-
- $res = ibase_query($tr_2, "select * from test5");
-
- echo "four rows again\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- ibase_close($link_1);
- ibase_close($link_2);
-
- echo "end of test\n";
-?>
---EXPECT--
-default transaction:
-empty table
---- test5 ---
----
-one row
---- test5 ---
-1
----
-after rollback table empty again
---- test5 ---
----
-one row
---- test5 ---
-2
----
-one row
---- test5 ---
-2
----
-one row... again.
---- test5 ---
-2
----
-one row.
---- test5 ---
-2
----
-one row
---- test5 ---
-2
----
-three rows
---- test5 ---
-2
-3
-4
----
-three rows again
---- test5 ---
-2
-3
-4
----
-one row in second transaction
---- test5 ---
-2
----
-three rows in third transaction
---- test5 ---
-2
-3
-4
----
-three rows
---- test5 ---
-2
-3
-4
----
-four rows
---- test5 ---
-2
-3
-4
-5
----
-four rows again
---- test5 ---
-2
-3
-4
-5
----
-end of test
-
diff --git a/ext/interbase/tests/006.phpt b/ext/interbase/tests/006.phpt
deleted file mode 100644
index 8a47986134..0000000000
--- a/ext/interbase/tests/006.phpt
+++ /dev/null
@@ -1,224 +0,0 @@
---TEST--
-InterBase: binding (may take a while)
---SKIPIF--
-<?php include("skipif.inc"); ?>
---POST--
---GET--
---FILE--
-<?php
-
- require("interbase.inc");
-
- ibase_connect($test_base);
-
- ibase_query(
- "create table test6 (
- iter integer,
- v_char char(1000),
- v_date timestamp,
- v_decimal decimal(12,3),
- v_double double precision,
- v_float float,
- v_integer integer,
- v_numeric numeric(4,2),
- v_smallint smallint,
- v_varchar varchar(10000)
- )");
- ibase_commit();
-
- /* if timefmt not supported, hide error */
- @ibase_timefmt("%m/%d/%Y %H:%M:%S");
-
- echo "insert\n";
-
- for($iter = 0; $iter < 3; $iter++){
- /* prepare data */
- $v_char = rand_str(1000);
- $v_date = rand_datetime();
- $v_decimal = rand_number(12,3);
- $v_double = rand_number(20);
- $v_float = rand_number(7);
- $v_integer = rand_number(9,0);
- $v_numeric = rand_number(4,2);
- $v_smallint = rand_number(5) % 32767;
- $v_varchar = rand_str(10000);
-
- ibase_query("insert into test6
- (iter,v_char,v_date,v_decimal,v_double,v_float,
- v_integer,v_numeric,v_smallint,v_varchar)
- values (?,?,?,?,?,?,?,?,?,?)",
- $iter, $v_char, $v_date, $v_decimal, $v_double, $v_float,
- $v_integer, $v_numeric, $v_smallint, $v_varchar);
- $sel = ibase_query("select * from test6 where iter = $iter");
-
- $row = ibase_fetch_object($sel);
- if(substr($row->V_CHAR,0,strlen($v_char)) != $v_char){
- echo " CHAR fail:\n";
- echo " in: $v_char\n";
- echo " out: $row->V_CHAR\n";
- }
- if($row->V_DATE != $v_date){
- echo " DATE fail\n";
- echo " in: $v_date\n";
- echo " out: $row->V_DATE\n";
- }
- if($row->V_DECIMAL != $v_decimal){
- echo " DECIMAL fail\n";
- echo " in: $v_decimal\n";
- echo " out: $row->V_DECIMAL\n";
- }
- if(abs($row->V_DOUBLE - $v_double) > abs($v_double / 1E15)){
- echo " DOUBLE fail\n";
- echo " in: $v_double\n";
- echo " out: $row->V_DOUBLE\n";
- }
- if(abs($row->V_FLOAT - $v_float) > abs($v_float / 1E7)){
- echo " FLOAT fail\n";
- echo " in: $v_float\n";
- echo " out: $row->V_FLOAT\n";
- }
- if($row->V_INTEGER != $v_integer){
- echo " INTEGER fail\n";
- echo " in: $v_integer\n";
- echo " out: $row->V_INTEGER\n";
- }
- ibase_free_result($sel);
- }/* for($iter)*/
-
- echo "select\n";
- for($iter = 0; $iter < 3; $iter++){
- /* prepare data */
- $v_char = rand_str(1000);
- $v_date = rand_datetime();
- $v_decimal = rand_number(12,3);
- $v_double = rand_number(20);
- $v_float = rand_number(7);
- $v_integer = rand_number(9,0);
- $v_numeric = rand_number(4,2);
- $v_smallint = rand_number(5) % 32767;
- $v_varchar = rand_str(10000);
-
- /* clear table*/
- ibase_query("delete from test6");
-
- /* make one record */
- ibase_query("insert into test6
- (iter, v_char,v_date,v_decimal,
- v_integer,v_numeric,v_smallint,v_varchar)
- values (666, '$v_char','$v_date',$v_decimal, $v_integer,
- $v_numeric, $v_smallint, '$v_varchar')");
-
- /* test all types */
- if(!($sel = ibase_query(
- "select iter from test6 where v_char = ?", $v_char)))
- echo "CHAR fail\n";
- ibase_free_result($sel);
- if(!($sel = ibase_query(
- "select iter from test6 where v_date = ?", $v_date)))
- echo "DATE fail\n";
- ibase_free_result($sel);
- if(!($sel = ibase_query(
- "select iter from test6 where v_decimal = ?", $v_decimal)))
- echo "DECIMAL fail\n";
- ibase_free_result($sel);
- if(!($sel = ibase_query(
- "select iter from test6 where v_integer = ?", $v_integer)))
- echo "INTEGER fail\n";
- ibase_free_result($sel);
- if(!($sel = ibase_query(
- "select iter from test6 where v_numeric = ?", $v_numeric)))
- echo "NUMERIC fail\n";
- ibase_free_result($sel);
- if(!($sel = ibase_query(
- "select iter from test6 where v_smallint = ?", $v_smallint)))
- echo "SMALLINT fail\n";
- ibase_free_result($sel);
- if(!($sel = ibase_query(
- "select iter from test6 where v_varchar = ?", $v_varchar)))
- echo "VARCHAR fail\n";
- ibase_free_result($sel);
-
- }/*for iter*/
-
- echo "prepare and exec insert\n";
-
- /* prepare table */
- ibase_query("delete from test6");
-
- /* prepare query */
- $query = ibase_prepare(
- "insert into test6 (v_integer) values (?)");
-
- for($i = 0; $i < 10; $i++)
- ibase_execute($query, $i);
-
- out_table("test6");
-
- ibase_free_query($query);
-
-
- echo "prepare and exec select\n";
-
- /* prepare query */
- $query = ibase_prepare("select * from test6
- where v_integer between ? and ?");
-
- $low_border = 2;
- $high_border = 6;
-
- $res = ibase_execute($query, $low_border, $high_border);
- out_result($res, "test6");
- ibase_free_result($res);
-
- $low_border = 0;
- $high_border = 4;
- $res = ibase_execute($query, $low_border, $high_border);
- out_result($res, "test6");
- ibase_free_result($res);
-
- $res = ibase_execute($query, "5", 7.5);
- out_result($res, "test6");
- ibase_free_result($res);
-
- ibase_free_query($query);
- ibase_close();
- echo "end of test\n";
-?>
---EXPECT--
-insert
-select
-prepare and exec insert
---- test6 ---
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
----
-prepare and exec select
---- test6 ---
- 2
- 3
- 4
- 5
- 6
----
---- test6 ---
- 0
- 1
- 2
- 3
- 4
----
---- test6 ---
- 5
- 6
- 7
----
-end of test
-
diff --git a/ext/interbase/tests/interbase.inc b/ext/interbase/tests/interbase.inc
deleted file mode 100755
index df708deca2..0000000000
--- a/ext/interbase/tests/interbase.inc
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-
-/* $Id$ */
-/* used in tests */
-
-srand((double)microtime()*1000000);
-
-$test_base = dirname(__FILE__)."/ibase_test.tmp";
-@unlink($test_base);
-
-$name = tempnam(dirname(__FILE__), "CREATEDB");
-$ftmp = fopen($name,"w");
-fwrite($ftmp,
-"
- create database \"$test_base\";
- create table test1 (i integer, c varchar(100));
- commit;
- insert into test1(i, c) values(1, 'test table created with isql');
- exit;
-"
-);
-fclose($ftmp);
-
-/* set the correct binary */
-if (is_executable('isql')) {
- $cmd = 'isql';
-} else {
- $cmd = '/opt/interbase/bin/isql';
-}
-
-exec("$cmd -i $name 2>&1");
-@unlink($name);
-
-
-function out_table($table_name)
-{
- echo "--- $table_name ---\n";
- $res = ibase_query("select * from $table_name");
- $f = ibase_num_fields($res);
- while ($r = ibase_fetch_row($res)){
- for($i = 0; $i < $f; $i++)
- echo "$r[$i]\t";
- echo "\n";
- }
- ibase_free_result($res);
- echo "---\n";
-}
-
-function out_result($result, $table_name = "")
-{
- echo "--- $table_name ---\n";
- $f = ibase_num_fields($result);
- while ($r = ibase_fetch_row($result)){
- for($i = 0; $i < $f; $i++)
- echo "$r[$i]\t";
- echo "\n";
- }
- echo "---\n";
-}
-
-/* M/D/Y H:M:S */
-function rand_datetime()
-{
- return sprintf("%02d/%02d/%4d %02d:%02d:%02d",
- rand()%12+1, rand()%28+1, rand()%100+1910,
- rand()%24, rand()%60, rand()%60);
-}
-
-/* random binary string */
-function rand_binstr($max_len)
-{
- $len = rand() % $max_len;
- $s = "";
- while($len--)
- $s .= sprintf("%c", rand() % 256);
- return $s;
-}
-
-function rand_str($max_len)
-{
- $len = rand() % $max_len;
- $s = "";
- while($len--)
- $s .= sprintf("%c", rand() % 26 + 65);;
- return $s;
-}
-
-function rand_number($len , $prec = -1, $sign = 1)
-{
- if($prec == -1){
- $n = substr(rand() . rand(), 0, rand() % $len + 1);
- if(strlen($n) < $len)
- $n .= "." . substr(rand(), 0, rand() % ($len - strlen($n)) + 1);
- }elseif ($prec == 0){
- $n = substr(rand() . rand(), 0, rand() % $len + 1);
- }else{
- $n = substr(rand() . rand(), 0, rand() % ($len - $prec) + 1);
- $n .= "." . substr(rand(), 0, $prec);
- }
- if($sign && (rand() % 3 == 0))
- $n = "-" .$n;
- return $n;
-}
-
-?>
diff --git a/ext/interbase/tests/skipif.inc b/ext/interbase/tests/skipif.inc
deleted file mode 100755
index 4f0395c60b..0000000000
--- a/ext/interbase/tests/skipif.inc
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-/* $Id$ */
-/* used in tests */
-
-if (!extension_loaded("interbase")) print "skip";
-if (!is_executable("isql") && !is_executable("/opt/interbase/bin/isql")) print "skip";
-
-?>
diff --git a/ext/ldap/CREDITS b/ext/ldap/CREDITS
deleted file mode 100644
index 5dc3d01974..0000000000
--- a/ext/ldap/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-LDAP
-Amitay Isaacs, Eric Warnke, Rasmus Lerdorf, Gerrit Thomson, Stig Venaas
diff --git a/ext/ldap/LDAP_Win32_HOWTO.txt b/ext/ldap/LDAP_Win32_HOWTO.txt
deleted file mode 100644
index ae085de86b..0000000000
--- a/ext/ldap/LDAP_Win32_HOWTO.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-Rules for building LDAP
------------------------
-
-Note 1: During the entire build process, you can ignore warnings about
- inconsistent DLL linkage.
-
-
-- Open LDAP under php_build. Rename this directory to 'OpenLDAP'.
-- Rename OpenLDAP\include\portable.h.nt to OpenLDAP\include\portable.h
-- Rename OpenLDAP\include\ldapconfig.h.nt to OpenLDAP\include\ldapconfig.h
-- Launch Visual Studio with OpenLDAP\libraries\libldap\libldap.dsw
-- Enter Project->Settings.
- Select the C/C++ tab, and select 'Code Generation' in the Category box.
- For 'Win32 Debug', change the runtime library to 'Debug Multithreaded DLL'
- For 'Win32 Release', change the runtime library to 'Multithreaded DLL'
- Select the Preprocessor tab, select 'All Configurations'.
- Add '..\..\..\..\php4\regex' to the 'Additional include directories' list.
- Add 'HAVE_MKTEMP' to the 'Preprocessor definitions' list.
-- Compile (you can compile both Debug and Release versions).
-
-
-- Launch Visual Studio with OpenLDAP\libraries\liblber\liblber.dsw
-- Enter Project->Settings.
- Select the C/C++ tab, and select 'Code Generation' in the Category box.
- For 'Win32 Debug', change the runtime library to 'Debug Multithreaded DLL'
- For 'Win32 Release', change the runtime library to 'Multithreaded DLL'
- Select the Preprocessor tab, select 'All Configurations'.
- Add 'HAVE_MKTEMP' to the 'Preprocessor definitions' list.
-- Compile (you can compile both Debug and Release versions).
-
-
-Start Visual Studio, load php_modules.dsw, select the LDAP project, and build
-it.
diff --git a/ext/ldap/config.m4 b/ext/ldap/config.m4
deleted file mode 100644
index dc76f446da..0000000000
--- a/ext/ldap/config.m4
+++ /dev/null
@@ -1,125 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_DEFUN(PHP_LDAP_CHECKS, [
- if test -f $1/include/ldap.h; then
- LDAP_DIR=$1
- LDAP_INCDIR=$1/include
- LDAP_LIBDIR=$1/lib
- elif test -f $1/include/umich-ldap/ldap.h; then
- LDAP_DIR=$1
- LDAP_INCDIR=$1/include/umich-ldap
- LDAP_LIBDIR=$1/lib
- elif test -f $1/ldap/public/ldap.h; then
- LDAP_DIR=$1
- LDAP_INCDIR=$1/ldap/public
- LDAP_LIBDIR=$1/lib
- fi
-])
-
-PHP_ARG_WITH(ldap,for LDAP support,
-[ --with-ldap[=DIR] Include LDAP support.])
-
-if test "$PHP_LDAP" != "no"; then
-
- PHP_NEW_EXTENSION(ldap, ldap.c, $ext_shared)
-
- if test "$PHP_LDAP" = "yes"; then
- for i in /usr/local /usr; do
- PHP_LDAP_CHECKS($i)
- done
- else
- PHP_LDAP_CHECKS($PHP_LDAP)
- fi
-
- if test -z "$LDAP_DIR"; then
- AC_MSG_ERROR(Cannot find ldap.h)
- fi
-
- dnl The Linux version of the SDK need -lpthread
- dnl I have tested Solaris, and it doesn't, but others may. Add
- dnl these here if necessary. -RL
- dnl Is this really necessary? -Troels Arvin
-
- if test `uname` = "Linux"; then
- LDAP_PTHREAD=pthread
- else
- LDAP_PTHREAD=
- fi
-
- if test -f $LDAP_LIBDIR/liblber.a -o -f $LDAP_LIBDIR/liblber.$SHLIB_SUFFIX_NAME; then
- PHP_ADD_LIBRARY_WITH_PATH(lber, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ldap, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
-
- elif test -f $LDAP_LIBDIR/libldap.$SHLIB_SUFFIX_NAME.3 -o -f $LDAP_LIBDIR/libldap.3.dylib; then
- PHP_ADD_LIBRARY_WITH_PATH(ldap, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
-
- elif test -f $LDAP_LIBDIR/libssldap50.$SHLIB_SUFFIX_NAME; then
- if test -n "$LDAP_PTHREAD"; then
- PHP_ADD_LIBRARY($LDAP_PTHREAD)
- fi
- PHP_ADD_LIBRARY_WITH_PATH(nspr4, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(plc4, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(plds4, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ssldap50, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ldap50, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(prldap50, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ssl3, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- AC_DEFINE(HAVE_NSLDAP,1,[ ])
-
- elif test -f $LDAP_LIBDIR/libldapssl41.$SHLIB_SUFFIX_NAME; then
- if test -n "$LDAP_PTHREAD"; then
- PHP_ADD_LIBRARY($LDAP_PTHREAD)
- fi
- PHP_ADD_LIBRARY_WITH_PATH(nspr3, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(plc3, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(plds3, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ldapssl41, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- AC_DEFINE(HAVE_NSLDAP,1,[ ])
-
- elif test -f $LDAP_LIBDIR/libldapssl30.$SHLIB_SUFFIX_NAME; then
- if test -n "$LDAP_PTHREAD"; then
- PHP_ADD_LIBRARY($LDAP_PTHREAD)
- fi
- PHP_ADD_LIBRARY_WITH_PATH(ldapssl30, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- AC_DEFINE(HAVE_NSLDAP,1,[ ])
-
- elif test -f $LDAP_LIBDIR/libldap30.$SHLIB_SUFFIX_NAME; then
- if test -n "$LDAP_PTHREAD"; then
- PHP_ADD_LIBRARY($LDAP_PTHREAD)
- fi
- PHP_ADD_LIBRARY_WITH_PATH(ldap30, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- AC_DEFINE(HAVE_NSLDAP,1,[ ])
-
- elif test -f $LDAP_LIBDIR/libumich_ldap.$SHLIB_SUFFIX_NAME; then
- PHP_ADD_LIBRARY_WITH_PATH(umich_lber, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(umich_ldap, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
-
- elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME; then
- PHP_ADD_LIBRARY_WITH_PATH(clntsh, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- AC_DEFINE(HAVE_ORALDAP,1,[ ])
-
- else
- AC_MSG_ERROR(Cannot find ldap libraries in $LDAP_LIBDIR.)
- fi
-
- PHP_ADD_INCLUDE($LDAP_INCDIR)
- PHP_SUBST(LDAP_SHARED_LIBADD)
- AC_DEFINE(HAVE_LDAP,1,[ ])
-
- dnl Check for 3 arg ldap_set_rebind_proc
- _SAVE_CPPFLAGS=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS -I$LDAP_INCDIR"
- AC_CACHE_CHECK([for 3 arg ldap_set_rebind_proc], ac_cv_3arg_setrebindproc,
- [AC_TRY_COMPILE([#include <ldap.h>], [ldap_set_rebind_proc(0,0,0)],
- ac_cv_3arg_setrebindproc=yes, ac_cv_3arg_setrebindproc=no)])
- if test "$ac_cv_3arg_setrebindproc" = yes; then
- AC_DEFINE(HAVE_3ARG_SETREBINDPROC,1,[Whether 3 arg set_rebind_proc()])
- fi
- CPPFLAGS=$_SAVE_CPPFLAGS
-
- dnl Solaris 2.8 claims to be 2004 API, but doesn't have
- dnl ldap_parse_reference() nor ldap_start_tls_s()
- AC_CHECK_FUNCS([ldap_parse_reference ldap_start_tls_s])
-fi
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
deleted file mode 100644
index 8529013cbf..0000000000
--- a/ext/ldap/ldap.c
+++ /dev/null
@@ -1,2133 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Amitay Isaacs <amitay@w-o-i.com> |
- | Eric Warnke <ericw@albany.edu> |
- | Rasmus Lerdorf <rasmus@php.net> |
- | Gerrit Thomson <334647@swin.edu.au> |
- | Jani Taskinen <sniper@iki.fi> |
- | Stig Venaas <venaas@uninett.no> |
- | PHP 4.0 updates: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-#define IS_EXT_MODULE
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-/* Additional headers for NetWare */
-#if defined(NETWARE) && (NEW_LIBC)
-#include <sys/select.h>
-#include <sys/timeval.h>
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-
-#include <stddef.h>
-
-#include "ext/standard/dl.h"
-#include "php_ldap.h"
-
-#ifdef PHP_WIN32
-#include <string.h>
-#if HAVE_NSLDAP
-#include <winsock2.h>
-#endif
-#define strdup _strdup
-#undef WINDOWS
-#undef strcasecmp
-#undef strncasecmp
-#define WINSOCK 1
-#define __STDC__ 1
-#endif
-
-#include "ext/standard/php_string.h"
-#include "ext/standard/info.h"
-
-typedef struct {
- LDAP *link;
-#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
- zval *rebindproc;
-#endif
-} ldap_linkdata;
-
-typedef struct {
- LDAPMessage *data;
- int id;
-} ldap_resultentry;
-
-ZEND_DECLARE_MODULE_GLOBALS(ldap)
-
-static unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-static unsigned char arg3to6of6_force_ref[] = { 6, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE };
-
-static int le_link, le_result, le_result_entry, le_ber_entry;
-
-/*
- This is just a small subset of the functionality provided by the LDAP library. All the
- operations are synchronous. Referrals are not handled automatically.
-*/
-/* {{{ ldap_functions[]
- */
-function_entry ldap_functions[] = {
- PHP_FE(ldap_connect, NULL)
- PHP_FALIAS(ldap_close, ldap_unbind, NULL)
- PHP_FE(ldap_bind, NULL)
- PHP_FE(ldap_unbind, NULL)
- PHP_FE(ldap_read, NULL)
- PHP_FE(ldap_list, NULL)
- PHP_FE(ldap_search, NULL)
- PHP_FE(ldap_free_result, NULL)
- PHP_FE(ldap_count_entries, NULL)
- PHP_FE(ldap_first_entry, NULL)
- PHP_FE(ldap_next_entry, NULL)
- PHP_FE(ldap_get_entries, NULL)
- PHP_FE(ldap_first_attribute, third_argument_force_ref)
- PHP_FE(ldap_next_attribute, third_argument_force_ref)
- PHP_FE(ldap_get_attributes, NULL)
- PHP_FE(ldap_get_values, NULL)
- PHP_FE(ldap_get_values_len, NULL)
- PHP_FE(ldap_get_dn, NULL)
- PHP_FE(ldap_explode_dn, NULL)
- PHP_FE(ldap_dn2ufn, NULL)
- PHP_FE(ldap_add, NULL)
- PHP_FE(ldap_delete, NULL)
- PHP_FALIAS(ldap_modify, ldap_mod_replace, NULL)
-
-/* additional functions for attribute based modifications, Gerrit Thomson */
- PHP_FE(ldap_mod_add, NULL)
- PHP_FE(ldap_mod_replace, NULL)
- PHP_FE(ldap_mod_del, NULL)
-/* end gjt mod */
-
- PHP_FE(ldap_errno, NULL)
- PHP_FE(ldap_err2str, NULL)
- PHP_FE(ldap_error, NULL)
- PHP_FE(ldap_compare, NULL)
- PHP_FE(ldap_sort, NULL)
-
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP
- PHP_FE(ldap_get_option, third_argument_force_ref)
- PHP_FE(ldap_set_option, NULL)
- PHP_FE(ldap_parse_result, arg3to6of6_force_ref)
- PHP_FE(ldap_first_reference, NULL)
- PHP_FE(ldap_next_reference, NULL)
-#ifdef HAVE_LDAP_PARSE_REFERENCE
- PHP_FE(ldap_parse_reference, third_argument_force_ref)
-#endif
- PHP_FE(ldap_rename, NULL)
-#ifdef HAVE_LDAP_START_TLS_S
- PHP_FE(ldap_start_tls, NULL)
-#endif
-#endif
-
-#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
- PHP_FE(ldap_set_rebind_proc, NULL)
-#endif
-
-#ifdef STR_TRANSLATION
- PHP_FE(ldap_t61_to_8859, NULL)
- PHP_FE(ldap_8859_to_t61, NULL)
-#endif
-
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry ldap_module_entry = {
- STANDARD_MODULE_HEADER,
- "ldap",
- ldap_functions,
- PHP_MINIT(ldap),
- PHP_MSHUTDOWN(ldap),
- NULL,
- NULL,
- PHP_MINFO(ldap),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-
-#ifdef COMPILE_DL_LDAP
-ZEND_GET_MODULE(ldap)
-#endif
-
-
-static void _close_ldap_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- ldap_linkdata *ld = (ldap_linkdata *)rsrc->ptr;
-
- ldap_unbind_s(ld->link);
-#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
- if (ld->rebindproc != NULL) {
- zval_dtor(ld->rebindproc);
- FREE_ZVAL(ld->rebindproc);
- }
-#endif
- efree(ld);
- LDAPG(num_links)--;
-}
-
-
-static void _free_ldap_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- LDAPMessage *result = (LDAPMessage *)rsrc->ptr;
- ldap_msgfree(result);
-}
-
-static void _free_ldap_result_entry(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- ldap_resultentry *entry = (ldap_resultentry *)rsrc->ptr;
- zend_list_delete(entry->id);
- efree(entry);
-}
-
-/* {{{ PHP_INI_BEGIN
- */
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY_EX("ldap.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_links, zend_ldap_globals, ldap_globals, display_link_numbers)
-PHP_INI_END()
-/* }}} */
-
-/* {{{ php_ldap_init_globals
- */
-static void php_ldap_init_globals(zend_ldap_globals *ldap_globals)
-{
- ldap_globals->num_links = 0;
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(ldap)
-{
- ZEND_INIT_MODULE_GLOBALS(ldap, php_ldap_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
-
- /* Constants to be used with deref-parameter in php_ldap_do_search() */
- REGISTER_LONG_CONSTANT("LDAP_DEREF_NEVER", LDAP_DEREF_NEVER, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("LDAP_DEREF_SEARCHING", LDAP_DEREF_SEARCHING, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, CONST_PERSISTENT | CONST_CS);
-
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP
- /* LDAP options */
- REGISTER_LONG_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("LDAP_OPT_TIMELIMIT", LDAP_OPT_TIMELIMIT, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("LDAP_OPT_REFERRALS", LDAP_OPT_REFERRALS, CONST_PERSISTENT | CONST_CS);
-#ifdef LDAP_OPT_RESTART
- REGISTER_LONG_CONSTANT("LDAP_OPT_RESTART", LDAP_OPT_RESTART, CONST_PERSISTENT | CONST_CS);
-#endif
- REGISTER_LONG_CONSTANT("LDAP_OPT_HOST_NAME", LDAP_OPT_HOST_NAME, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_STRING", LDAP_OPT_ERROR_STRING, CONST_PERSISTENT | CONST_CS);
-#ifdef LDAP_OPT_MATCHED_DN
- REGISTER_LONG_CONSTANT("LDAP_OPT_MATCHED_DN", LDAP_OPT_MATCHED_DN, CONST_PERSISTENT | CONST_CS);
-#endif
- REGISTER_LONG_CONSTANT("LDAP_OPT_SERVER_CONTROLS", LDAP_OPT_SERVER_CONTROLS, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("LDAP_OPT_CLIENT_CONTROLS", LDAP_OPT_CLIENT_CONTROLS, CONST_PERSISTENT | CONST_CS);
-#endif
-#ifdef LDAP_OPT_DEBUG_LEVEL
- REGISTER_LONG_CONSTANT("LDAP_OPT_DEBUG_LEVEL", LDAP_OPT_DEBUG_LEVEL, CONST_PERSISTENT | CONST_CS);
-#endif
-
-#ifdef ORALDAP
- REGISTER_LONG_CONSTANT("GSLC_SSL_NO_AUTH", GSLC_SSL_NO_AUTH, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("GSLC_SSL_ONEWAY_AUTH", GSLC_SSL_ONEWAY_AUTH, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS);
-#endif
-
- le_result = zend_register_list_destructors_ex(_free_ldap_result, NULL, "ldap result", module_number);
- le_link = zend_register_list_destructors_ex(_close_ldap_link, NULL, "ldap link", module_number);
- le_result_entry = zend_register_list_destructors_ex(_free_ldap_result_entry, NULL, "ldap result entry", module_number);
- le_ber_entry = zend_register_list_destructors_ex(NULL, NULL, "ldap ber entry", module_number);
-
- Z_TYPE(ldap_module_entry) = type;
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(ldap)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(ldap)
-{
- char tmp[32];
-#if HAVE_NSLDAP
- LDAPVersion ver;
- double SDKVersion;
-#endif
-
- php_info_print_table_start();
- php_info_print_table_row(2, "LDAP Support", "enabled" );
- php_info_print_table_row(2, "RCS Version", "$Id$" );
-
- if (LDAPG(max_links) == -1) {
- snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links));
- } else {
- snprintf(tmp, 31, "%ld/%ld", LDAPG(num_links), LDAPG(max_links));
- }
- tmp[31] = '\0';
- php_info_print_table_row(2, "Total Links", tmp);
-
-#ifdef LDAP_API_VERSION
- snprintf(tmp, 31, "%d", LDAP_API_VERSION);
- tmp[31] = '\0';
- php_info_print_table_row(2, "API Version", tmp);
-#endif
-
-#ifdef LDAP_VENDOR_NAME
- php_info_print_table_row(2, "Vendor Name", LDAP_VENDOR_NAME);
-#endif
-
-#ifdef LDAP_VENDOR_VERSION
- snprintf(tmp, 31, "%d", LDAP_VENDOR_VERSION);
- tmp[31] = '\0';
- php_info_print_table_row(2, "Vendor Version", tmp);
-#endif
-
-#if HAVE_NSLDAP
- SDKVersion = ldap_version( &ver );
- snprintf(tmp, 31, "%f", SDKVersion/100.0 );
- tmp[31] = '\0';
- php_info_print_table_row(2, "SDK Version", tmp );
-
- snprintf(tmp, 31, "%f", ver.protocol_version/100.0 );
- tmp[31] = '\0';
- php_info_print_table_row(2, "Highest LDAP Protocol Supported", tmp );
-
- snprintf(tmp, 31, "%f", ver.SSL_version/100.0 );
- tmp[31] = '\0';
- php_info_print_table_row(2, "SSL Level Supported", tmp );
-
- if ( ver.security_level != LDAP_SECURITY_NONE ) {
- snprintf(tmp, 31, "%d", ver.security_level );
- tmp[31] = '\0';
- } else {
- strcpy(tmp, "SSL not enabled" );
- }
- php_info_print_table_row(2, "Level of Encryption", tmp );
-#endif
-
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ proto resource ldap_connect([string host [, int port]])
- Connect to an LDAP server */
-PHP_FUNCTION(ldap_connect)
-{
- char *host = NULL;
- int hostlen;
- long port = 389; /* Default port */
-#ifdef HAVE_ORALDAP
- char *wallet, *walletpasswd;
- int walletlen, walletpasswdlen;
- long authmode;
- int ssl=0;
-#endif
- ldap_linkdata *ld;
- LDAP *ldap;
-
-#ifdef HAVE_ORALDAP
- if (ZEND_NUM_ARGS() == 3 || ZEND_NUM_ARGS() == 4) {
- WRONG_PARAM_COUNT;
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|slssl", &host, &hostlen, &port, &wallet, &walletlen, &walletpasswd, &walletpasswdlen, &authmode) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() == 5 ) {
- ssl = 1;
- }
-#else
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sl", &host, &hostlen, &port) == FAILURE) {
- RETURN_FALSE;
- }
-#endif
-
- if (LDAPG(max_links) != -1 && LDAPG(num_links) >= LDAPG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)", LDAPG(num_links));
- RETURN_FALSE;
- }
-
- ld = ecalloc(1, sizeof(ldap_linkdata));
- if (ld == NULL) {
- RETURN_FALSE;
- }
-
-#ifdef LDAP_API_FEATURE_X_OPENLDAP
- if (host != NULL && strchr(host, '/')) {
- int rc;
-
- rc = ldap_initialize(&ldap, host);
- if (rc != LDAP_SUCCESS) {
- efree(ld);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create session handle: %s", ldap_err2string(rc));
- RETURN_FALSE;
- }
- } else {
- ldap = ldap_init(host, port);
- }
-#else
- ldap = ldap_open(host, port);
-#endif
-
- if ( ldap == NULL ) {
- efree(ld);
- RETURN_FALSE;
- } else {
-#ifdef HAVE_ORALDAP
- if (ssl) {
- if (ldap_init_SSL(&ldap->ld_sb, wallet, walletpasswd, authmode)) {
- efree(ld);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL init failed");
- RETURN_FALSE;
- }
- }
-#endif
- LDAPG(num_links)++;
- ld->link = ldap;
- ZEND_REGISTER_RESOURCE(return_value, ld, le_link);
- }
-
-}
-/* }}} */
-
-/* {{{ _get_lderrno
- */
-static int _get_lderrno(LDAP *ldap)
-{
-#if !HAVE_NSLDAP
-#if LDAP_API_VERSION > 2000
- int lderr;
-
- /* New versions of OpenLDAP do it this way */
- ldap_get_option(ldap, LDAP_OPT_ERROR_NUMBER, &lderr);
- return lderr;
-#else
- return ldap->ld_errno;
-#endif
-#else
- return ldap_get_lderrno(ldap, NULL, NULL);
-#endif
-}
-/* }}} */
-
-/* {{{ proto bool ldap_bind(resource link [, string dn, string password])
- Bind to LDAP directory */
-PHP_FUNCTION(ldap_bind)
-{
- zval *link;
- char *ldap_bind_dn = NULL, *ldap_bind_pw = NULL;
- int ldap_bind_dnlen, ldap_bind_pwlen;
- ldap_linkdata *ld;
- int rc;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ss", &link, &ldap_bind_dn, &ldap_bind_dnlen, &ldap_bind_pw, &ldap_bind_pwlen) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
-
- if ((rc = ldap_bind_s(ld->link, ldap_bind_dn, ldap_bind_pw, LDAP_AUTH_SIMPLE)) != LDAP_SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to bind to server: %s", ldap_err2string(rc));
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool ldap_unbind(resource link)
- Unbind from LDAP directory */
-PHP_FUNCTION(ldap_unbind)
-{
- zval *link;
- ldap_linkdata *ld;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &link) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
-
- zend_list_delete(Z_LVAL_P(link));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ php_set_opts
- */
-static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref)
-{
- /* sizelimit */
- if (sizelimit > -1) {
-#if ( LDAP_API_VERSION >= 2004 ) || HAVE_NSLDAP
- ldap_set_option(ldap, LDAP_OPT_SIZELIMIT, &sizelimit);
-#else
- ldap->ld_sizelimit = sizelimit;
-#endif
- }
-
- /* timelimit */
- if (timelimit > -1) {
-#if ( LDAP_API_VERSION >= 2004 ) || HAVE_NSLDAP
- ldap_set_option(ldap, LDAP_OPT_TIMELIMIT, &timelimit);
-#else
- ldap->ld_timelimit = timelimit;
-#endif
- }
-
- /* deref */
- if (deref > -1) {
-#if ( LDAP_API_VERSION >= 2004 ) || HAVE_NSLDAP
- ldap_set_option(ldap, LDAP_OPT_DEREF, &deref);
-#else
- ldap->ld_deref = deref;
-#endif
- }
-}
-/* }}} */
-
-/* {{{ php_ldap_do_search
- */
-static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
-{
- pval **link, **base_dn, **filter, **attrs, **attr, **attrsonly, **sizelimit, **timelimit, **deref;
- char *ldap_base_dn = NULL;
- char *ldap_filter = NULL;
- char **ldap_attrs = NULL;
- ldap_linkdata *ld;
- LDAPMessage *ldap_res;
- int ldap_attrsonly = 0;
- int ldap_sizelimit = -1;
- int ldap_timelimit = -1;
- int ldap_deref = -1;
- int num_attribs = 0;
- int i, errno;
- int myargcount = ZEND_NUM_ARGS();
-
- if (myargcount < 3 || myargcount > 8 || zend_get_parameters_ex(myargcount, &link, &base_dn, &filter, &attrs, &attrsonly, &sizelimit, &timelimit, &deref) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* Reverse -> fall through */
- switch(myargcount) {
- case 8 :
- convert_to_long_ex(deref);
- ldap_deref = Z_LVAL_PP(deref);
-
- case 7 :
- convert_to_long_ex(timelimit);
- ldap_timelimit = Z_LVAL_PP(timelimit);
-
- case 6 :
- convert_to_long_ex(sizelimit);
- ldap_sizelimit = Z_LVAL_PP(sizelimit);
-
- case 5 :
- convert_to_long_ex(attrsonly);
- ldap_attrsonly = Z_LVAL_PP(attrsonly);
-
- case 4 :
- if (Z_TYPE_PP(attrs) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected Array as last element");
- RETURN_FALSE;
- }
-
- num_attribs = zend_hash_num_elements(Z_ARRVAL_PP(attrs));
- if ((ldap_attrs = safe_emalloc((num_attribs+1), sizeof(char *), 0)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not allocate memory");
- RETURN_FALSE;
- }
-
- for(i=0; i<num_attribs; i++) {
- if(zend_hash_index_find(Z_ARRVAL_PP(attrs), i, (void **) &attr) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array initialization wrong");
- efree(ldap_attrs);
- RETURN_FALSE;
- }
-
- SEPARATE_ZVAL(attr);
- convert_to_string_ex(attr);
- ldap_attrs[i] = Z_STRVAL_PP(attr);
- }
- ldap_attrs[num_attribs] = NULL;
-
- case 3 :
- /* parallel search? */
- if (Z_TYPE_PP(link) != IS_ARRAY) {
- convert_to_string_ex(filter);
- ldap_filter = Z_STRVAL_PP(filter);
- convert_to_string_ex(base_dn);
- ldap_base_dn = Z_STRVAL_PP(base_dn);
- }
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- /* parallel search? */
- if (Z_TYPE_PP(link) == IS_ARRAY) {
- int i, nlinks, nbases, nfilters, *rcs;
- ldap_linkdata **lds;
- zval **entry, *resource;
-
- nlinks = zend_hash_num_elements(Z_ARRVAL_PP(link));
- if (nlinks == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No links in link array");
- if (ldap_attrs != NULL) {
- efree(ldap_attrs);
- }
- RETURN_FALSE;
- }
-
- if (Z_TYPE_PP(base_dn) == IS_ARRAY) {
- nbases = zend_hash_num_elements(Z_ARRVAL_PP(base_dn));
- if (nbases != nlinks) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Base must either be a string, or an array with the same number of elements as the links array");
- if (ldap_attrs != NULL) {
- efree(ldap_attrs);
- }
- RETURN_FALSE;
- }
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(base_dn));
- } else {
- nbases = 0; /* this means string, not array */
- convert_to_string_ex(base_dn);
- ldap_base_dn = Z_STRLEN_PP(base_dn) < 1 ? NULL : Z_STRVAL_PP(base_dn);
- }
-
- if (Z_TYPE_PP(filter) == IS_ARRAY) {
- nfilters = zend_hash_num_elements(Z_ARRVAL_PP(filter));
- if (nfilters != nlinks) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Filter must either be a string, or an array with the same number of elements as the links array");
- if (ldap_attrs != NULL) {
- efree(ldap_attrs);
- }
- RETURN_FALSE;
- }
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(filter));
- } else {
- nfilters = 0; /* this means string, not array */
- convert_to_string_ex(filter);
- ldap_filter = Z_STRVAL_PP(filter);
- }
-
- lds = safe_emalloc(nlinks, sizeof(ldap_linkdata), 0);
- rcs = safe_emalloc(nlinks, sizeof(*rcs), 0);
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(link));
- for (i=0; i<nlinks; i++) {
- zend_hash_get_current_data(Z_ARRVAL_PP(link), (void **)&entry);
-
- ld = (ldap_linkdata *) zend_fetch_resource(entry TSRMLS_CC, -1, "ldap link", NULL, 1, le_link);
- if (ld == NULL) {
- efree(lds);
- efree(rcs);
- if (ldap_attrs != NULL) {
- efree(ldap_attrs);
- }
- RETURN_FALSE;
- }
- if (nbases != 0) { /* base_dn an array? */
- zend_hash_get_current_data(Z_ARRVAL_PP(base_dn), (void **)&entry);
- zend_hash_move_forward(Z_ARRVAL_PP(base_dn));
- convert_to_string_ex(entry);
- ldap_base_dn = Z_STRLEN_PP(entry) < 1 ? NULL : Z_STRVAL_PP(entry);
- }
- if (nfilters != 0) { /* filter an array? */
- zend_hash_get_current_data(Z_ARRVAL_PP(filter), (void **)&entry);
- zend_hash_move_forward(Z_ARRVAL_PP(filter));
- convert_to_string_ex(entry);
- ldap_filter = Z_STRVAL_PP(entry);
- }
-
- php_set_opts(ld->link, ldap_sizelimit, ldap_timelimit, ldap_deref);
-
- /* Run the actual search */
- rcs[i] = ldap_search(ld->link, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly);
- lds[i] = ld;
- zend_hash_move_forward(Z_ARRVAL_PP(link));
- }
-
- if (ldap_attrs != NULL) {
- efree(ldap_attrs);
- }
-
- array_init(return_value);
-
- /* Collect results from the searches */
- for (i=0; i<nlinks; i++) {
- MAKE_STD_ZVAL(resource);
- if (rcs[i] != -1) {
- rcs[i] = ldap_result(lds[i]->link, LDAP_RES_ANY, 1 /* LDAP_MSG_ALL */, NULL, &ldap_res);
- }
- if (rcs[i] != -1) {
- ZEND_REGISTER_RESOURCE(resource, ldap_res, le_result);
- add_next_index_zval(return_value, resource);
- } else {
- add_next_index_bool(return_value, 0);
- }
- }
- efree(lds);
- efree(rcs);
- return;
- }
-
- /* fix to make null base_dn's work */
- if ( strlen(ldap_base_dn) < 1 ) {
- ldap_base_dn = NULL;
- }
-
- ld = (ldap_linkdata *) zend_fetch_resource(link TSRMLS_CC, -1, "ldap link", NULL, 1, le_link);
- if (ld == NULL) {
- if (ldap_attrs != NULL) {
- efree(ldap_attrs);
- }
- RETURN_FALSE;
- }
-
- php_set_opts(ld->link, ldap_sizelimit, ldap_timelimit, ldap_deref);
-
- /* Run the actual search */
- errno = ldap_search_s(ld->link, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly, &ldap_res);
-
- if (ldap_attrs != NULL) {
- efree(ldap_attrs);
- }
-
- if (errno != LDAP_SUCCESS
- && errno != LDAP_SIZELIMIT_EXCEEDED
-#ifdef LDAP_ADMINLIMIT_EXCEEDED
- && errno != LDAP_ADMINLIMIT_EXCEEDED
-#endif
-#ifdef LDAP_REFERRAL
- && errno != LDAP_REFERRAL
-#endif
- ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Search: %s", ldap_err2string(errno));
- RETVAL_FALSE;
- } else {
- if (errno == LDAP_SIZELIMIT_EXCEEDED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Partial search results returned: Sizelimit exceeded.");
- }
-#ifdef LDAP_ADMINLIMIT_EXCEEDED
- else if (errno == LDAP_ADMINLIMIT_EXCEEDED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Partial search results returned: Adminlimit exceeded.");
- }
-#endif
-
- ZEND_REGISTER_RESOURCE(return_value, ldap_res, le_result);
- }
-}
-/* }}} */
-
-/* {{{ proto resource ldap_read(resource link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref]]]]])
- Read an entry */
-PHP_FUNCTION(ldap_read)
-{
- php_ldap_do_search(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_SCOPE_BASE);
-}
-/* }}} */
-
-/* {{{ proto resource ldap_list(resource link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref]]]]])
- Single-level search */
-PHP_FUNCTION(ldap_list)
-{
- php_ldap_do_search(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_SCOPE_ONELEVEL);
-}
-/* }}} */
-
-/* {{{ proto resource ldap_search(resource link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref]]]]])
- Search LDAP tree under base_dn */
-PHP_FUNCTION(ldap_search)
-{
- php_ldap_do_search(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_SCOPE_SUBTREE);
-}
-/* }}} */
-
-/* {{{ proto bool ldap_free_result(resource result)
- Free result memory */
-PHP_FUNCTION(ldap_free_result)
-{
- pval **result;
- LDAPMessage *ldap_result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result);
-
- zend_list_delete(Z_LVAL_PP(result)); /* Delete list entry and call registered destructor function */
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ldap_count_entries(resource link, resource result)
- Count the number of entries in a search result */
-PHP_FUNCTION(ldap_count_entries)
-{
- pval **link, **result;
- ldap_linkdata *ld;
- LDAPMessage *ldap_result;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result);
-
- RETURN_LONG(ldap_count_entries(ld->link, ldap_result));
-}
-/* }}} */
-
-/* {{{ proto resource ldap_first_entry(resource link, resource result)
- Return first result id */
-PHP_FUNCTION(ldap_first_entry)
-{
- pval **link, **result;
- ldap_linkdata *ld;
- ldap_resultentry *resultentry;
- LDAPMessage *ldap_result, *entry;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result);
-
- if ((entry = ldap_first_entry(ld->link, ldap_result)) == NULL) {
- RETVAL_FALSE;
- } else {
- resultentry = emalloc(sizeof(ldap_resultentry));
- ZEND_REGISTER_RESOURCE(return_value, resultentry, le_result_entry);
- resultentry->id = Z_LVAL_PP(result);
- zend_list_addref(resultentry->id);
- resultentry->data = entry;
- }
-}
-/* }}} */
-
-/* {{{ proto resource ldap_next_entry(resource link, resource result_entry)
- Get next result entry */
-PHP_FUNCTION(ldap_next_entry)
-{
- pval **link, **result_entry;
- ldap_linkdata *ld;
- ldap_resultentry *resultentry, *resultentry_next;
- LDAPMessage *entry_next;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result_entry) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(resultentry, ldap_resultentry *, result_entry, -1, "ldap result entry", le_result_entry);
-
- if ((entry_next = ldap_next_entry(ld->link, resultentry->data)) == NULL) {
- RETVAL_FALSE;
- } else {
- resultentry_next = emalloc(sizeof(ldap_resultentry));
- ZEND_REGISTER_RESOURCE(return_value, resultentry_next, le_result_entry);
- resultentry_next->id = resultentry->id;
- zend_list_addref(resultentry->id);
- resultentry_next->data = entry_next;
- }
-}
-/* }}} */
-
-/* {{{ proto array ldap_get_entries(resource link, resource result)
- Get all result entries */
-PHP_FUNCTION(ldap_get_entries)
-{
- pval **link, **result;
- LDAPMessage *ldap_result, *ldap_result_entry;
- pval *tmp1, *tmp2;
- ldap_linkdata *ld;
- LDAP *ldap;
- int num_entries, num_attrib, num_values, i;
- BerElement *ber;
- char *attribute;
- size_t attr_len;
- char **ldap_value;
- char *dn;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result);
-
- ldap = ld->link;
- num_entries = ldap_count_entries(ldap, ldap_result);
-
- array_init(return_value);
- add_assoc_long(return_value, "count", num_entries);
-
- if (num_entries == 0) return;
- num_entries = 0;
-
- ldap_result_entry = ldap_first_entry(ldap, ldap_result);
- if (ldap_result_entry == NULL) RETURN_FALSE;
-
- while(ldap_result_entry != NULL) {
-
- MAKE_STD_ZVAL(tmp1);
- array_init(tmp1);
-
- num_attrib = 0;
- attribute = ldap_first_attribute(ldap, ldap_result_entry, &ber);
-
- while (attribute != NULL) {
- ldap_value = ldap_get_values(ldap, ldap_result_entry, attribute);
- num_values = ldap_count_values(ldap_value);
-
- MAKE_STD_ZVAL(tmp2);
- array_init(tmp2);
- add_assoc_long(tmp2, "count", num_values);
- for(i=0; i < num_values; i++) {
- add_index_string(tmp2, i, ldap_value[i], 1);
- }
- ldap_value_free(ldap_value);
-
- attr_len = strlen(attribute);
- zend_hash_update(Z_ARRVAL_P(tmp1), php_strtolower(attribute, attr_len), attr_len+1, (void *) &tmp2, sizeof(pval *), NULL);
- add_index_string(tmp1, num_attrib, attribute, 1);
-
- num_attrib++;
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
- ldap_memfree(attribute);
-#endif
- attribute = ldap_next_attribute(ldap, ldap_result_entry, ber);
- }
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
- if (ber != NULL)
- ber_free(ber, 0);
-#endif
-
- add_assoc_long(tmp1, "count", num_attrib);
- dn = ldap_get_dn(ldap, ldap_result_entry);
- add_assoc_string(tmp1, "dn", dn, 1);
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
- ldap_memfree(dn);
-#else
- free(dn);
-#endif
-
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_entries, (void *) &tmp1, sizeof(pval *), NULL);
-
- num_entries++;
- ldap_result_entry = ldap_next_entry(ldap, ldap_result_entry);
- }
-
- add_assoc_long(return_value, "count", num_entries);
-
-}
-/* }}} */
-
-/* {{{ proto string ldap_first_attribute(resource link, resource result_entry, int ber)
- Return first attribute */
-PHP_FUNCTION(ldap_first_attribute)
-{
- pval **link, **result_entry, **berp;
- ldap_linkdata *ld;
- ldap_resultentry *resultentry;
- BerElement *ber;
- char *attribute;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link, &result_entry, &berp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(resultentry, ldap_resultentry *, result_entry, -1, "ldap result entry", le_result_entry);
-
- if ((attribute = ldap_first_attribute(ld->link, resultentry->data, &ber)) == NULL) {
- RETURN_FALSE;
- } else {
- ZEND_REGISTER_RESOURCE(*berp, ber, le_ber_entry);
-
- RETVAL_STRING(attribute, 1);
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
- ldap_memfree(attribute);
-#endif
- }
-}
-/* }}} */
-
-/* {{{ proto string ldap_next_attribute(resource link, resource result_entry, resource ber)
- Get the next attribute in result */
-PHP_FUNCTION(ldap_next_attribute)
-{
- pval **link, **result_entry, **berp;
- ldap_linkdata *ld;
- ldap_resultentry *resultentry;
- BerElement *ber;
- char *attribute;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link, &result_entry, &berp) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(resultentry, ldap_resultentry *, result_entry, -1, "ldap result entry", le_result_entry);
- ZEND_FETCH_RESOURCE(ber, BerElement *, berp, -1, "ldap ber entry", le_ber_entry);
-
- if ((attribute = ldap_next_attribute(ld->link, resultentry->data, ber)) == NULL) {
- RETURN_FALSE;
- } else {
- ZEND_REGISTER_RESOURCE(*berp, ber, le_ber_entry);
-
- RETVAL_STRING(attribute, 1);
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
- ldap_memfree(attribute);
-#endif
- }
-}
-/* }}} */
-
-/* {{{ proto array ldap_get_attributes(resource link, resource result_entry)
- Get attributes from a search result entry */
-PHP_FUNCTION(ldap_get_attributes)
-{
- pval **link, **result_entry;
- pval *tmp;
- ldap_linkdata *ld;
- ldap_resultentry *resultentry;
- char *attribute;
- char **ldap_value;
- int i, num_values, num_attrib;
- BerElement *ber;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result_entry) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(resultentry, ldap_resultentry *, result_entry, -1, "ldap result entry", le_result_entry);
-
- array_init(return_value);
- num_attrib = 0;
-
- attribute = ldap_first_attribute(ld->link, resultentry->data, &ber);
- while (attribute != NULL) {
- ldap_value = ldap_get_values(ld->link, resultentry->data, attribute);
- num_values = ldap_count_values(ldap_value);
-
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
- add_assoc_long(tmp, "count", num_values);
- for(i=0; i<num_values; i++) {
- add_index_string(tmp, i, ldap_value[i], 1);
- }
- ldap_value_free(ldap_value);
-
- zend_hash_update(Z_ARRVAL_P(return_value), attribute, strlen(attribute)+1, (void *) &tmp, sizeof(pval *), NULL);
- add_index_string(return_value, num_attrib, attribute, 1);
-
- num_attrib++;
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
- ldap_memfree(attribute);
-#endif
- attribute = ldap_next_attribute(ld->link, resultentry->data, ber);
- }
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
- if (ber != NULL)
- ber_free(ber, 0);
-#endif
-
- add_assoc_long(return_value, "count", num_attrib);
-}
-/* }}} */
-
-/* {{{ proto array ldap_get_values(resource link, resource result_entry, string attribute)
- Get all values from a result entry */
-PHP_FUNCTION(ldap_get_values)
-{
- pval **link, **result_entry, **attr;
- ldap_linkdata *ld;
- ldap_resultentry *resultentry;
- char *attribute;
- char **ldap_value;
- int i, num_values;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link, &result_entry, &attr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(resultentry, ldap_resultentry *, result_entry, -1, "ldap result entry", le_result_entry);
-
- convert_to_string_ex(attr);
- attribute = Z_STRVAL_PP(attr);
-
- if ((ldap_value = ldap_get_values(ld->link, resultentry->data, attribute)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot get the value(s) of attribute %s", ldap_err2string(_get_lderrno(ld->link)));
- RETURN_FALSE;
- }
-
- num_values = ldap_count_values(ldap_value);
-
- array_init(return_value);
-
- for(i=0; i<num_values; i++) {
- add_next_index_string(return_value, ldap_value[i], 1);
- }
-
- add_assoc_long(return_value, "count", num_values);
- ldap_value_free(ldap_value);
-
-}
-/* }}} */
-
-/* {{{ proto array ldap_get_values_len(resource link, resource result_entry, string attribute)
- Get all values with lengths from a result entry */
-PHP_FUNCTION(ldap_get_values_len)
-{
- pval **link, **result_entry, **attr;
- ldap_linkdata *ld;
- ldap_resultentry *resultentry;
- char* attribute;
- struct berval **ldap_value_len;
- int i, num_values;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link, &result_entry, &attr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(resultentry, ldap_resultentry *, result_entry, -1, "ldap result entry", le_result_entry);
-
- convert_to_string_ex(attr);
- attribute = Z_STRVAL_PP(attr);
-
- if ((ldap_value_len = ldap_get_values_len(ld->link, resultentry->data, attribute)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot get the value(s) of attribute %s", ldap_err2string(_get_lderrno(ld->link)));
- RETURN_FALSE;
- }
-
- num_values = ldap_count_values_len(ldap_value_len);
- array_init(return_value);
-
- for (i=0; i<num_values; i++) {
- add_next_index_stringl(return_value, ldap_value_len[i]->bv_val, ldap_value_len[i]->bv_len, 1);
- }
-
- add_assoc_long(return_value, "count", num_values);
- ldap_value_free_len(ldap_value_len);
-
-}
-/* }}} */
-
-/* {{{ proto string ldap_get_dn(resource link, resource result_entry)
- Get the DN of a result entry */
-PHP_FUNCTION(ldap_get_dn)
-{
- pval **link, **result_entry;
- ldap_linkdata *ld;
- ldap_resultentry *resultentry;
- char *text;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result_entry) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(resultentry, ldap_resultentry *, result_entry, -1, "ldap result entry", le_result_entry);
-
- text = ldap_get_dn(ld->link, resultentry->data);
- if ( text != NULL ) {
- RETVAL_STRING(text, 1);
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
- ldap_memfree(text);
-#else
- free(text);
-#endif
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array ldap_explode_dn(string dn, int with_attrib)
- Splits DN into its component parts */
-PHP_FUNCTION(ldap_explode_dn)
-{
- pval **dn, **with_attrib;
- char **ldap_value;
- int i, count;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &dn, &with_attrib) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(dn);
- convert_to_long_ex(with_attrib);
-
- ldap_value = ldap_explode_dn(Z_STRVAL_PP(dn), Z_LVAL_PP(with_attrib));
-
- i=0;
- while(ldap_value[i] != NULL) i++;
- count = i;
-
- array_init(return_value);
-
- add_assoc_long(return_value, "count", count);
- for(i=0; i<count; i++) {
- add_index_string(return_value, i, ldap_value[i], 1);
- }
-
- ldap_value_free(ldap_value);
-}
-/* }}} */
-
-/* {{{ proto string ldap_dn2ufn(string dn)
- Convert DN to User Friendly Naming format */
-PHP_FUNCTION(ldap_dn2ufn)
-{
- pval **dn;
- char *ufn;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &dn)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(dn);
-
- ufn = ldap_dn2ufn(Z_STRVAL_PP(dn));
-
- if (ufn !=NULL) {
- RETVAL_STRING(ufn, 1);
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
- ldap_memfree(ufn);
-#endif
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* added to fix use of ldap_modify_add for doing an ldap_add, gerrit thomson. */
-#define PHP_LD_FULL_ADD 0xff
-/* {{{ php_ldap_do_modify
- */
-static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
-{
- pval **link, **dn, **entry, **value, **ivalue;
- ldap_linkdata *ld;
- char *ldap_dn;
- LDAPMod **ldap_mods;
- int i, j, num_attribs, num_values;
- int *num_berval;
- char *attribute;
- ulong index;
- int is_full_add=0; /* flag for full add operation so ldap_mod_add can be put back into oper, gerrit THomson */
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link, &dn, &entry) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(entry) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected Array as the last element");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
-
- convert_to_string_ex(dn);
- ldap_dn = Z_STRVAL_PP(dn);
-
- num_attribs = zend_hash_num_elements(Z_ARRVAL_PP(entry));
- ldap_mods = safe_emalloc((num_attribs+1), sizeof(LDAPMod *), 0);
- num_berval = safe_emalloc(num_attribs, sizeof(int), 0);
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(entry));
-
- /* added by gerrit thomson to fix ldap_add using ldap_mod_add */
- if ( oper == PHP_LD_FULL_ADD ) {
- oper = LDAP_MOD_ADD;
- is_full_add = 1;
- }
- /* end additional , gerrit thomson */
-
- for(i=0; i<num_attribs; i++) {
- ldap_mods[i] = emalloc(sizeof(LDAPMod));
- ldap_mods[i]->mod_op = oper | LDAP_MOD_BVALUES;
-
- if (zend_hash_get_current_key(Z_ARRVAL_PP(entry), &attribute, &index, 0) == HASH_KEY_IS_STRING) {
- ldap_mods[i]->mod_type = estrdup(attribute);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown attribute in the data");
- /* Free allocated memory */
- while (i >= 0) {
- efree(ldap_mods[i--]);
- }
- efree(num_berval);
- efree(ldap_mods);
- RETURN_FALSE;
- }
-
- zend_hash_get_current_data(Z_ARRVAL_PP(entry), (void **)&value);
-
- if (Z_TYPE_PP(value) != IS_ARRAY) {
- num_values = 1;
- } else {
- num_values = zend_hash_num_elements(Z_ARRVAL_PP(value));
- }
-
- num_berval[i] = num_values;
- ldap_mods[i]->mod_bvalues = safe_emalloc((num_values + 1), sizeof(struct berval *), 0);
-
-/* allow for arrays with one element, no allowance for arrays with none but probably not required, gerrit thomson. */
- if ((num_values == 1) && (Z_TYPE_PP(value) != IS_ARRAY)) {
- convert_to_string_ex(value);
- ldap_mods[i]->mod_bvalues[0] = (struct berval *) emalloc (sizeof(struct berval));
- ldap_mods[i]->mod_bvalues[0]->bv_len = Z_STRLEN_PP(value);
- ldap_mods[i]->mod_bvalues[0]->bv_val = Z_STRVAL_PP(value);
- } else {
- for(j=0; j < num_values; j++) {
- if (zend_hash_index_find(Z_ARRVAL_PP(value), j, (void **) &ivalue) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Value array must have consecutive indices 0, 1, ...");
- num_berval[i] = j;
- num_attribs = i + 1;
- RETVAL_FALSE;
- goto errexit;
- }
- convert_to_string_ex(ivalue);
- ldap_mods[i]->mod_bvalues[j] = (struct berval *) emalloc (sizeof(struct berval));
- ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRLEN_PP(ivalue);
- ldap_mods[i]->mod_bvalues[j]->bv_val = Z_STRVAL_PP(ivalue);
- }
- }
- ldap_mods[i]->mod_bvalues[num_values] = NULL;
- zend_hash_move_forward(Z_ARRVAL_PP(entry));
- }
- ldap_mods[num_attribs] = NULL;
-
-/* check flag to see if do_mod was called to perform full add , gerrit thomson */
- if (is_full_add == 1) {
- if ((i = ldap_add_s(ld->link, ldap_dn, ldap_mods)) != LDAP_SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Add: %s", ldap_err2string(i));
- RETVAL_FALSE;
- } else RETVAL_TRUE;
- } else {
- if ((i = ldap_modify_s(ld->link, ldap_dn, ldap_mods)) != LDAP_SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Modify: %s", ldap_err2string(i));
- RETVAL_FALSE;
- } else RETVAL_TRUE;
- }
-
-errexit:
- for(i=0; i < num_attribs; i++) {
- efree(ldap_mods[i]->mod_type);
- for(j=0; j<num_berval[i]; j++) {
- efree(ldap_mods[i]->mod_bvalues[j]);
- }
- efree(ldap_mods[i]->mod_bvalues);
- efree(ldap_mods[i]);
- }
- efree(num_berval);
- efree(ldap_mods);
-
- return;
-}
-/* }}} */
-
-/* {{{ proto bool ldap_add(resource link, string dn, array entry)
- Add entries to LDAP directory */
-PHP_FUNCTION(ldap_add)
-{
- /* use a newly define parameter into the do_modify so ldap_mod_add can be used the way it is supposed to be used , Gerrit THomson */
- php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_LD_FULL_ADD);
-}
-/* }}} */
-
-/* three functions for attribute base modifications, gerrit Thomson */
-
-/* {{{ proto bool ldap_mod_replace(resource link, string dn, array entry)
- Replace attribute values with new ones */
-PHP_FUNCTION(ldap_mod_replace)
-{
- php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_REPLACE);
-}
-/* }}} */
-
-/* {{{ proto bool ldap_mod_add(resource link, string dn, array entry)
- Add attribute values to current */
-PHP_FUNCTION(ldap_mod_add)
-{
- php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_ADD);
-}
-/* }}} */
-
-/* {{{ proto bool ldap_mod_del(resource link, string dn, array entry)
- Delete attribute values */
-PHP_FUNCTION(ldap_mod_del)
-{
- php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_DELETE);
-}
-/* }}} */
-
-/* {{{ proto bool ldap_delete(resource link, string dn)
- Delete an entry from a directory */
-PHP_FUNCTION(ldap_delete)
-{
- pval **link, **dn;
- ldap_linkdata *ld;
- char *ldap_dn;
- int rc;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &dn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
-
- convert_to_string_ex(dn);
- ldap_dn = Z_STRVAL_PP(dn);
-
- if ((rc = ldap_delete_s(ld->link, ldap_dn)) != LDAP_SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Delete: %s", ldap_err2string(rc));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ldap_errno(resource link)
- Get the current ldap error number */
-PHP_FUNCTION(ldap_errno)
-{
- pval **link;
- ldap_linkdata *ld;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ht, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
-
- RETURN_LONG( _get_lderrno(ld->link) );
-}
-/* }}} */
-
-/* {{{ proto string ldap_err2str(int errno)
- Convert error number to error string */
-PHP_FUNCTION(ldap_err2str)
-{
- zval **perrno;
-
- if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ht, &perrno) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(perrno);
- RETURN_STRING(ldap_err2string(Z_LVAL_PP(perrno)), 1);
-}
-/* }}} */
-
-/* {{{ proto string ldap_error(resource link)
- Get the current ldap error string */
-PHP_FUNCTION(ldap_error)
-{
- pval **link;
- ldap_linkdata *ld;
- int ld_errno;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ht, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
-
- ld_errno = _get_lderrno(ld->link);
-
- RETURN_STRING(ldap_err2string(ld_errno), 1);
-}
-/* }}} */
-
-/* {{{ proto bool ldap_compare(resource link, string dn, string attr, string value)
- Determine if an entry has a specific value for one of its attributes */
-PHP_FUNCTION(ldap_compare)
-{
- pval **link, **dn, **attr, **value;
- char *ldap_dn, *ldap_attr, *ldap_value;
- ldap_linkdata *ld;
- int errno;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &link, &dn, &attr, &value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
-
- convert_to_string_ex(dn);
- convert_to_string_ex(attr);
- convert_to_string_ex(value);
-
- ldap_dn = Z_STRVAL_PP(dn);
- ldap_attr = Z_STRVAL_PP(attr);
- ldap_value = Z_STRVAL_PP(value);
-
- errno = ldap_compare_s(ld->link, ldap_dn, ldap_attr, ldap_value);
-
- switch(errno) {
- case LDAP_COMPARE_TRUE :
- RETURN_TRUE;
- break;
-
- case LDAP_COMPARE_FALSE :
- RETURN_FALSE;
- break;
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Compare: %s", ldap_err2string(errno));
- RETURN_LONG(-1);
-
-}
-/* }}} */
-
-/* {{{ proto bool ldap_sort(resource link, resource result, string sortfilter)
- Sort LDAP result entries */
-PHP_FUNCTION(ldap_sort)
-{
- zval *link, *result;
- ldap_linkdata *ld;
- char *sortfilter;
- int sflen;
- zend_rsrc_list_entry *le;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrs", &link, &result, &sortfilter, &sflen) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
-
- if (zend_hash_index_find(&EG(regular_list), Z_LVAL_P(result), (void **) &le) == FAILURE || le->type != le_result) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Supplied resource is not a valid ldap result resource");
- RETURN_FALSE;
- }
-
- if (ldap_sort_entries(ld->link, (LDAPMessage **) &le->ptr, sflen ? sortfilter : NULL, strcmp) != LDAP_SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ldap_err2string(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP
-/* {{{ proto bool ldap_get_option(resource link, int option, mixed retval)
- Get the current value of various session-wide parameters */
-PHP_FUNCTION(ldap_get_option)
-{
- pval **link, **option, **retval;
- ldap_linkdata *ld;
- int opt;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &link, &option, &retval) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
-
- convert_to_long_ex(option);
- opt = Z_LVAL_PP(option);
-
- switch(opt) {
- /* options with int value */
- case LDAP_OPT_DEREF:
- case LDAP_OPT_SIZELIMIT:
- case LDAP_OPT_TIMELIMIT:
- case LDAP_OPT_PROTOCOL_VERSION:
- case LDAP_OPT_ERROR_NUMBER:
- case LDAP_OPT_REFERRALS:
-#ifdef LDAP_OPT_RESTART
- case LDAP_OPT_RESTART:
-#endif
- {
- int val;
- if (ldap_get_option(ld->link, opt, &val)) {
- RETURN_FALSE;
- }
- zval_dtor(*retval);
- ZVAL_LONG(*retval, val);
- } break;
- /* options with string value */
- case LDAP_OPT_HOST_NAME:
- case LDAP_OPT_ERROR_STRING:
-#ifdef LDAP_OPT_MATCHED_DN
- case LDAP_OPT_MATCHED_DN:
-#endif
- {
- char *val;
- if (ldap_get_option(ld->link, opt, &val)) {
- RETURN_FALSE;
- }
- zval_dtor(*retval);
- ZVAL_STRING(*retval, val, 1);
- ldap_memfree(val);
- } break;
-/* options not implemented
- case LDAP_OPT_SERVER_CONTROLS:
- case LDAP_OPT_CLIENT_CONTROLS:
- case LDAP_OPT_API_INFO:
- case LDAP_OPT_API_FEATURE_INFO:
-*/
- default:
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ldap_set_option(resource link, int option, mixed newval)
- Set the value of various session-wide parameters */
-PHP_FUNCTION(ldap_set_option)
-{
- pval **link, **option, **newval;
- ldap_linkdata *ld;
- LDAP *ldap;
- int opt;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &link, &option, &newval) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(link) == IS_NULL) {
- ldap = NULL;
- } else {
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- ldap = ld->link;
- }
-
- convert_to_long_ex(option);
- opt = Z_LVAL_PP(option);
-
- switch(opt) {
- /* options with int value */
- case LDAP_OPT_DEREF:
- case LDAP_OPT_SIZELIMIT:
- case LDAP_OPT_TIMELIMIT:
- case LDAP_OPT_PROTOCOL_VERSION:
- case LDAP_OPT_ERROR_NUMBER:
-#ifdef LDAP_OPT_DEBUG_LEVEL
- case LDAP_OPT_DEBUG_LEVEL:
-#endif
- {
- int val;
- convert_to_long_ex(newval);
- val = Z_LVAL_PP(newval);
- if (ldap_set_option(ldap, opt, &val)) {
- RETURN_FALSE;
- }
- } break;
- /* options with string value */
- case LDAP_OPT_HOST_NAME:
- case LDAP_OPT_ERROR_STRING:
-#ifdef LDAP_OPT_MATCHED_DN
- case LDAP_OPT_MATCHED_DN:
-#endif
- {
- char *val;
- convert_to_string_ex(newval);
- val = Z_STRVAL_PP(newval);
- if (ldap_set_option(ldap, opt, val)) {
- RETURN_FALSE;
- }
- } break;
- /* options with boolean value */
- case LDAP_OPT_REFERRALS:
-#ifdef LDAP_OPT_RESTART
- case LDAP_OPT_RESTART:
-#endif
- {
- void *val;
- convert_to_boolean_ex(newval);
- val = Z_LVAL_PP(newval)
- ? LDAP_OPT_ON : LDAP_OPT_OFF;
- if (ldap_set_option(ldap, opt, val)) {
- RETURN_FALSE;
- }
- } break;
- /* options with control list value */
- case LDAP_OPT_SERVER_CONTROLS:
- case LDAP_OPT_CLIENT_CONTROLS:
- {
- LDAPControl *ctrl, **ctrls, **ctrlp;
- zval **ctrlval, **val;
- int ncontrols;
- char error=0;
-
- if ((Z_TYPE_PP(newval) != IS_ARRAY) || !(ncontrols = zend_hash_num_elements(Z_ARRVAL_PP(newval)))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected non-empty array value for this option");
- RETURN_FALSE;
- }
- ctrls = safe_emalloc((1 + ncontrols), sizeof(*ctrls), 0);
- *ctrls = NULL;
- ctrlp = ctrls;
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(newval));
- while (zend_hash_get_current_data(Z_ARRVAL_PP(newval), (void**)&ctrlval) == SUCCESS) {
- if (Z_TYPE_PP(ctrlval) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The array value must contain only arrays, where each array is a control");
- error = 1;
- break;
- }
- if (zend_hash_find(Z_ARRVAL_PP(ctrlval), "oid", sizeof("oid"), (void **) &val) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Control must have an oid key");
- error = 1;
- break;
- }
- ctrl = *ctrlp = emalloc(sizeof(**ctrlp));
- convert_to_string_ex(val);
- ctrl->ldctl_oid = Z_STRVAL_PP(val);
- if (zend_hash_find(Z_ARRVAL_PP(ctrlval), "value", sizeof("value"), (void **) &val) == SUCCESS) {
- convert_to_string_ex(val);
- ctrl->ldctl_value.bv_val = Z_STRVAL_PP(val);
- ctrl->ldctl_value.bv_len = Z_STRLEN_PP(val);
- } else {
- ctrl->ldctl_value.bv_val = NULL;
- ctrl->ldctl_value.bv_len = 0;
- }
- if (zend_hash_find(Z_ARRVAL_PP(ctrlval), "iscritical", sizeof("iscritical"), (void **) &val) == SUCCESS) {
- convert_to_boolean_ex(val);
- ctrl->ldctl_iscritical = Z_BVAL_PP(val);
- } else {
- ctrl->ldctl_iscritical = 0;
- }
-
- ++ctrlp;
- *ctrlp = NULL;
- zend_hash_move_forward(Z_ARRVAL_PP(newval));
- }
- if (!error) {
- error = ldap_set_option(ldap, opt, ctrls);
- }
- ctrlp = ctrls;
- while ( *ctrlp ) {
- efree(*ctrlp);
- ctrlp++;
- }
- efree(ctrls);
- if (error) {
- RETURN_FALSE;
- }
- } break;
- default:
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ldap_parse_result(resource link, resource result, int errcode, string matcheddn, string errmsg, array referrals)
- Extract information from result */
-PHP_FUNCTION(ldap_parse_result)
-{
- pval **link, **result, **errcode, **matcheddn, **errmsg, **referrals;
- ldap_linkdata *ld;
- LDAPMessage *ldap_result;
- char **lreferrals, **refp;
- char *lmatcheddn, *lerrmsg;
- int rc, lerrcode, myargcount = ZEND_NUM_ARGS();
-
- if (myargcount < 3 || myargcount > 6 || zend_get_parameters_ex(myargcount, &link, &result, &errcode, &matcheddn, &errmsg, &referrals) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result);
-
- rc = ldap_parse_result( ld->link, ldap_result, &lerrcode,
- myargcount > 3 ? &lmatcheddn : NULL,
- myargcount > 4 ? &lerrmsg : NULL,
- myargcount > 5 ? &lreferrals : NULL,
- NULL /* &serverctrls */,
- 0 );
- if (rc != LDAP_SUCCESS ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to parse result: %s", ldap_err2string(rc));
- RETURN_FALSE;
- }
-
- zval_dtor(*errcode);
- ZVAL_LONG(*errcode, lerrcode);
-
- /* Reverse -> fall through */
- switch(myargcount) {
- case 6 :
- zval_dtor(*referrals);
- array_init(*referrals);
- if (lreferrals != NULL) {
- refp = lreferrals;
- while (*refp) {
- add_next_index_string(*referrals, *refp, 1);
- refp++;
- }
- ldap_value_free(lreferrals);
- }
- case 5 :
- zval_dtor(*errmsg);
- if (lerrmsg == NULL) {
- ZVAL_EMPTY_STRING(*errmsg);
- } else {
- ZVAL_STRING(*errmsg, lerrmsg, 1);
- ldap_memfree(lerrmsg);
- }
- case 4 :
- zval_dtor(*matcheddn);
- if (lmatcheddn == NULL) {
- ZVAL_EMPTY_STRING(*matcheddn);
- } else {
- ZVAL_STRING(*matcheddn, lmatcheddn, 1);
- ldap_memfree(lmatcheddn);
- }
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto resource ldap_first_reference(resource link, resource result)
- Return first reference */
-PHP_FUNCTION(ldap_first_reference)
-{
- pval **link, **result;
- ldap_linkdata *ld;
- ldap_resultentry *resultentry;
- LDAPMessage *ldap_result, *entry;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result);
-
- if ((entry = ldap_first_reference(ld->link, ldap_result)) == NULL) {
- RETVAL_FALSE;
- } else {
- resultentry = emalloc(sizeof(ldap_resultentry));
- ZEND_REGISTER_RESOURCE(return_value, resultentry, le_result_entry);
- resultentry->id = Z_LVAL_PP(result);
- zend_list_addref(resultentry->id);
- resultentry->data = entry;
- }
-}
-/* }}} */
-
-/* {{{ proto resource ldap_next_reference(resource link, resource reference_entry)
- Get next reference */
-PHP_FUNCTION(ldap_next_reference)
-{
- pval **link, **result_entry;
- ldap_linkdata *ld;
- ldap_resultentry *resultentry, *resultentry_next;
- LDAPMessage *entry_next;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result_entry) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(resultentry, ldap_resultentry *, result_entry, -1, "ldap result entry", le_result_entry);
-
- if ((entry_next = ldap_next_reference(ld->link, resultentry->data)) == NULL) {
- RETVAL_FALSE;
- } else {
- resultentry_next = emalloc(sizeof(ldap_resultentry));
- ZEND_REGISTER_RESOURCE(return_value, resultentry_next, le_result_entry);
- resultentry_next->id = resultentry->id;
- zend_list_addref(resultentry->id);
- resultentry_next->data = entry_next;
- }
-}
-/* }}} */
-
-#ifdef HAVE_LDAP_PARSE_REFERENCE
-/* {{{ proto bool ldap_parse_reference(resource link, resource reference_entry, array referrals)
- Extract information from reference entry */
-PHP_FUNCTION(ldap_parse_reference)
-{
- pval **link, **result_entry, **referrals;
- ldap_linkdata *ld;
- ldap_resultentry *resultentry;
- char **lreferrals, **refp;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link, &result_entry, &referrals) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(resultentry, ldap_resultentry *, result_entry, -1, "ldap result entry", le_result_entry);
-
- if (ldap_parse_reference(ld->link, resultentry->data, &lreferrals, NULL /* &serverctrls */, 0) != LDAP_SUCCESS) {
- RETURN_FALSE;
- }
-
- zval_dtor(*referrals);
- array_init(*referrals);
- if (lreferrals != NULL) {
- refp = lreferrals;
- while (*refp) {
- add_next_index_string(*referrals, *refp, 1);
- refp++;
- }
- ldap_value_free(lreferrals);
- }
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-/* {{{ proto bool ldap_rename(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn);
- Modify the name of an entry */
-PHP_FUNCTION(ldap_rename)
-{
- pval **link, **dn, **newrdn, **newparent, **deleteoldrdn;
- ldap_linkdata *ld;
- int rc;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &link, &dn, &newrdn, &newparent, &deleteoldrdn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
-
- convert_to_string_ex(dn);
- convert_to_string_ex(newrdn);
- convert_to_string_ex(newparent);
- convert_to_boolean_ex(deleteoldrdn);
-
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP
- rc = ldap_rename_s(ld->link, Z_STRVAL_PP(dn), Z_STRVAL_PP(newrdn), Z_STRVAL_PP(newparent), Z_BVAL_PP(deleteoldrdn), NULL, NULL);
-#else
- if (Z_STRLEN_PP(newparent) != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You are using old LDAP API, newparent must be the empty string, can only modify RDN");
- RETURN_FALSE;
- }
-/* could support old APIs but need check for ldap_modrdn2()/ldap_modrdn() */
- rc = ldap_modrdn2_s(ld->link, Z_STRVAL_PP(dn), Z_STRVAL_PP(newrdn), Z_BVAL_PP(deleteoldrdn));
-#endif
-
- if (rc == LDAP_SUCCESS) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-#ifdef HAVE_LDAP_START_TLS_S
-/* {{{ proto bool ldap_start_tls(resource link)
- Start TLS */
-PHP_FUNCTION(ldap_start_tls)
-{
- pval **link;
- ldap_linkdata *ld;
- int rc;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
-
- if ((rc = ldap_start_tls_s(ld->link, NULL, NULL)) != LDAP_SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unable to start TLS: %s", ldap_err2string(rc));
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-#endif
-#endif /* ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP */
-
-
-#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
-int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgid, void *params) {
- ldap_linkdata *ld;
- int retval;
- zval *cb_url;
- zval **cb_args[2];
- zval *cb_retval;
- zval *cb_link = (zval *) params;
- TSRMLS_FETCH();
-
- ld = (ldap_linkdata *) zend_fetch_resource(&cb_link TSRMLS_CC, -1, "ldap link", NULL, 1, le_link);
-
- /* link exists and callback set? */
- if (ld == NULL || ld->rebindproc == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Link not found or no callback set");
- return LDAP_OTHER;
- }
-
- /* callback */
- MAKE_STD_ZVAL(cb_url);
- ZVAL_STRING(cb_url, estrdup(url), 0);
- cb_args[0] = &cb_link;
- cb_args[1] = &cb_url;
- if (call_user_function_ex(EG(function_table), NULL, ld->rebindproc, &cb_retval, 2, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) {
- convert_to_long_ex(&cb_retval);
- retval = Z_LVAL_P(cb_retval);
- zval_ptr_dtor(&cb_retval);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "rebind_proc PHP callback failed");
- retval = LDAP_OTHER;
- }
- zval_dtor(cb_url);
- FREE_ZVAL(cb_url);
- return retval;
-}
-
-
-/* {{{ proto bool ldap_set_rebind_proc(resource link, string callback)
- Set a callback function to do re-binds on referral chasing. */
-PHP_FUNCTION(ldap_set_rebind_proc)
-{
- zval *link, *callback;
- ldap_linkdata *ld;
- char *callback_name;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &link, &callback) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
-
- if (Z_TYPE_P(callback) == IS_STRING && Z_STRLEN_P(callback) == 0) {
- /* unregister rebind procedure */
- if (ld->rebindproc != NULL) {
- zval_dtor(ld->rebindproc);
- ld->rebindproc = NULL;
- ldap_set_rebind_proc(ld->link, NULL, NULL);
- }
- RETURN_TRUE;
- }
-
- /* callable? */
- if (!zend_is_callable(callback, 0, &callback_name)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Two arguments expected for '%s' to be a valid callback", callback_name);
- efree(callback_name);
- RETURN_FALSE;
- }
- efree(callback_name);
-
- /* register rebind procedure */
- if (ld->rebindproc == NULL) {
- ldap_set_rebind_proc(ld->link, _ldap_rebind_proc, (void *) link);
- } else {
- zval_dtor(ld->rebindproc);
- }
-
- ALLOC_ZVAL(ld->rebindproc);
- *ld->rebindproc = *callback;
- zval_copy_ctor(ld->rebindproc);
- RETURN_TRUE;
-}
-#endif
-
-
-#ifdef STR_TRANSLATION
-/* {{{ php_ldap_do_translate
- */
-static void php_ldap_do_translate(INTERNAL_FUNCTION_PARAMETERS, int way)
-{
- zval **value;
- char *ldap_buf;
- unsigned long ldap_len;
- int result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(value);
- ldap_buf = Z_STRVAL_PP(value);
- ldap_len = Z_STRLEN_PP(value);
-
- if(ldap_len == 0) {
- RETURN_FALSE;
- }
-
- if(way == 1) {
- result = ldap_8859_to_t61(&ldap_buf, &ldap_len, 0);
- } else {
- result = ldap_t61_to_8859(&ldap_buf, &ldap_len, 0);
- }
-
- if (result == LDAP_SUCCESS) {
- RETVAL_STRINGL(ldap_buf, ldap_len, 1);
- free(ldap_buf);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Conversion from iso-8859-1 to t61 failed: %s", ldap_err2string(result));
- RETVAL_FALSE;
- }
-
- return;
-}
-/* }}} */
-
-/* {{{ proto string ldap_t61_to_8859(string value)
- Translate t61 characters to 8859 characters */
-PHP_FUNCTION(ldap_t61_to_8859)
-{
- php_ldap_do_translate(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string ldap_8859_to_t61(string value)
- Translate 8859 characters to t61 characters */
-PHP_FUNCTION(ldap_8859_to_t61)
-{
- php_ldap_do_translate(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/ldap/ldap.dsp b/ext/ldap/ldap.dsp
deleted file mode 100644
index 1bb536619b..0000000000
--- a/ext/ldap/ldap.dsp
+++ /dev/null
@@ -1,288 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ldap" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ldap - Win32 Debug_TS_SSL
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ldap.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ldap.mak" CFG="ldap - Win32 Debug_TS_SSL"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ldap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Release_TS SASL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Debug_TS SASL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Release_TS_SSL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Debug_TS_SSL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ldap - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "COMPILE_DL_LDAP_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4nts.lib /nologo /dll /machine:I386 /out:"Release/php_ldap.dll" /libpath:"..\..\Release" /libpath:"..\..\..\php_build\openldap\libraries\Release"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "COMPILE_DL_LDAP_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 oldap32.lib olber32.lib php4nts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\openldap\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D ZEND_DEBUG=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib php4nts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\openldap\libraries\Debug" /libpath:"..\..\Debug"
-# ADD LINK32 oldap32.lib olber32.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\openldap\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D ZEND_DEBUG=0 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ldap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\openldap\libraries\Release" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Release_TS SASL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "ldap___Win32_Release_TS_SASL"
-# PROP BASE Intermediate_Dir "ldap___Win32_Release_TS_SASL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_SASL"
-# PROP Intermediate_Dir "Release_TS_SASL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ldap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\openldap\libraries\Release" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 oldap32.lib olber32.lib libsasl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ldap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\openldap\libraries\Release" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Debug_TS SASL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "ldap___Win32_Debug_TS_SASL"
-# PROP BASE Intermediate_Dir "ldap___Win32_Debug_TS_SASL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS_SASL"
-# PROP Intermediate_Dir "Debug_TS_SASL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"Debug_TS/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-# ADD LINK32 oldap32.lib olber32.lib libsasl.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Release_TS_SSL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "ldap___Win32_Release_TS_SSL"
-# PROP BASE Intermediate_Dir "ldap___Win32_Release_TS_SSL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_SSL"
-# PROP Intermediate_Dir "Release_TS_SSL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ldap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\openldap\libraries\Release" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 php4ts.lib oldap32.lib olber32.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ldap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\openldap\libraries\Release" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Debug_TS_SSL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "ldap___Win32_Debug_TS_SSL"
-# PROP BASE Intermediate_Dir "ldap___Win32_Debug_TS_SSL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS_SSL"
-# PROP Intermediate_Dir "Debug_TS_SSL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-# ADD LINK32 php4ts_debug.lib oldap32.lib olber32.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-
-!ENDIF
-
-# Begin Target
-
-# Name "ldap - Win32 Release"
-# Name "ldap - Win32 Debug"
-# Name "ldap - Win32 Debug_TS"
-# Name "ldap - Win32 Release_TS"
-# Name "ldap - Win32 Release_TS SASL"
-# Name "ldap - Win32 Debug_TS SASL"
-# Name "ldap - Win32 Release_TS_SSL"
-# Name "ldap - Win32 Debug_TS_SSL"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ldap.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_ldap.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\LDAP_Win32_HOWTO.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/ldap/ldap.mak b/ext/ldap/ldap.mak
deleted file mode 100644
index 6f0d1dbb0e..0000000000
--- a/ext/ldap/ldap.mak
+++ /dev/null
@@ -1,173 +0,0 @@
-# Temporarily here -- later may go into some batch file
-# which will set this as an environment variable
-PROJECT_ROOT = ..\..
-
-# Module details
-MODULE_NAME = php_ldap
-MODULE_DESC = "PHP 4.3 - LDAP Extension"
-VMAJ = 3
-VMIN = 0
-VREV = 0
-
-#include the common settings
-include $(PROJECT_ROOT)/netware/common.mif
-
-# Extensions of all input and output files
-.SUFFIXES:
-.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d
-
-# Source files
-C_SRC = ldap.c \
- start.c
-
-CPP_SRC_NODIR = $(notdir $(CPP_SRC))
-C_SRC_NODIR = $(notdir $(C_SRC))
-SRC_DIR = $(dir $(CPP_SRC) $(C_SRC))
-
-# Library files
-LIBRARY =
-
-# Destination directories and files
-OBJ_DIR = $(BUILD)
-FINAL_DIR = $(BUILD)
-MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map
-OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.obj) $(C_SRC_NODIR:.c=.obj))
-DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.d) $(C_SRC_NODIR:.c=.d))
-
-# Binary file
-ifndef BINARY
- BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm
-endif
-
-# Compile flags
-C_FLAGS += -c -maxerrors 25 -msgstyle gcc
-C_FLAGS += -wchar_t on -bool on
-C_FLAGS += -processor Pentium
-C_FLAGS += -nostdinc -nosyspath
-C_FLAGS += -relax_pointers # To remove type-casting errors
-C_FLAGS += -DNETWARE -DZTS
-C_FLAGS += -DNEW_LIBC
-C_FLAGS += -DCOMPILE_DL_LDAP
-C_FLAGS += -I. -I- -I$(PROJECT_ROOT) -I$(PROJECT_ROOT)/main
-C_FLAGS += -I$(PROJECT_ROOT)/ext/standard -I$(PROJECT_ROOT)/netware
-C_FLAGS += -I$(PROJECT_ROOT)/zend -I$(PROJECT_ROOT)/tsrm
-C_FLAGS += -I$(SDK_DIR)/include -I$(MWCIncludes)
-C_FLAGS += -I$(LDAP_DIR)/inc
-C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include
-
-ifndef STACK_SIZE
-STACK_SIZE=8192
-endif
-
-# Extra stuff based on debug / release builds
-ifeq '$(BUILD)' 'debug'
- SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym
- C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -sym internal -DDEBUGGING -DDKFBPON
- C_FLAGS += -exc cw -DZEND_DEBUG=1
- LD_FLAGS += -sym on -sym codeview4 -osym $(SYM_FILE)
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib
-else
- C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off
- C_FLAGS += -opt intrinsics
- C_FLAGS += -opt level=4 -DZEND_DEBUG=0
- LD_FLAGS += -sym off
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
-endif
-
-# Dependencies
-MODULE = LibC \
- ldapsdk \
- phplib
-IMPORT = @$(SDK_DIR)/imports/libc.imp \
- @$(SDK_DIR)/imports/ws2nlm.imp \
- @$(MPK_DIR)/import/mpkOrg.imp \
- @$(LDAP_DIR)/lib/nlm/Ldapsdk.imp \
- @$(PROJECT_ROOT)/netware/phplib.imp
-EXPORT = ($(MODULE_NAME)) get_module
-API = OutputToScreen
-
-
-# Virtual paths
-vpath %.cpp .
-vpath %.c . ..\..\netware
-vpath %.obj $(OBJ_DIR)
-
-
-all: prebuild project
-
-.PHONY: all
-
-prebuild:
- @if not exist $(OBJ_DIR) md $(OBJ_DIR)
-
-project: $(BINARY)
- @echo Build complete.
-
-$(OBJ_DIR)/%.d: %.cpp
- @echo Building Dependencies for $(<F)
- @$(CC) -M $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.d: %.c
- @echo Building Dependencies for $(<F)
- @$(CC) -M $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.obj: %.cpp
- @echo Compiling $?...
- @$(CC) $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.obj: %.c
- @echo Compiling $?...
- @$(CC) $< $(C_FLAGS) -o $@
-
-
-$(BINARY): $(OBJECTS)
- @echo Import $(IMPORT) > $(basename $@).def
-ifdef API
- @echo Import $(API) >> $(basename $@).def
-endif
- @echo Module $(MODULE) >> $(basename $@).def
-ifdef EXPORT
- @echo Export $(EXPORT) >> $(basename $@).def
-endif
- @echo AutoUnload >> $(basename $@).def
-ifeq '$(BUILD)' 'debug'
- @echo Debug >> $(basename $@).def
-endif
- @echo Flag_On 0x00000008 >> $(basename $@).def
- @echo Start _LibCPrelude >> $(basename $@).def
- @echo Exit _LibCPostlude >> $(basename $@).def
-
- $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc
- @echo xdcdata $(basename $@).xdc >> $(basename $@).def
-
- @echo Linking $@...
- @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link
- @echo $(LIBRARY) $(OBJECTS) >> $(basename $@).link
-
- @$(LINK) @$(basename $@).link
-
-
-.PHONY: clean
-clean: cleanobj cleanbin
-
-.PHONY: cleand
-cleand:
- @echo Deleting all dependency files...
- -@del "$(OBJ_DIR)\*.d"
-
-.PHONY: cleanobj
-cleanobj:
- @echo Deleting all object files...
- -@del "$(OBJ_DIR)\*.obj"
-
-.PHONY: cleanbin
-cleanbin:
- @echo Deleting binary files...
- -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm"
- @echo Deleting MAP, DEF files, etc....
- -@del "$(FINAL_DIR)\$(MODULE_NAME).map"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).def"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).link"
-ifeq '$(BUILD)' 'debug'
- -@del $(FINAL_DIR)\$(MODULE_NAME).sym
-endif
diff --git a/ext/ldap/php_ldap.h b/ext/ldap/php_ldap.h
deleted file mode 100644
index 99bb9b7217..0000000000
--- a/ext/ldap/php_ldap.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Amitay Isaacs <amitay@w-o-i.com> |
- | Eric Warnke <ericw@albany.edu> |
- | Jani Taskinen <sniper@iki.fi> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_LDAP_H
-#define PHP_LDAP_H
-
-#ifndef HAVE_ORALDAP
-#include <lber.h>
-#endif
-#include <ldap.h>
-
-extern zend_module_entry ldap_module_entry;
-#define ldap_module_ptr &ldap_module_entry
-
-/* LDAP functions */
-PHP_MINIT_FUNCTION(ldap);
-PHP_MSHUTDOWN_FUNCTION(ldap);
-
-PHP_MINFO_FUNCTION(ldap);
-
-PHP_FUNCTION(ldap_connect);
-
-PHP_FUNCTION(ldap_bind);
-PHP_FUNCTION(ldap_unbind);
-
-PHP_FUNCTION(ldap_read);
-PHP_FUNCTION(ldap_list);
-PHP_FUNCTION(ldap_search);
-
-PHP_FUNCTION(ldap_free_result);
-PHP_FUNCTION(ldap_count_entries);
-
-PHP_FUNCTION(ldap_first_entry);
-PHP_FUNCTION(ldap_next_entry);
-PHP_FUNCTION(ldap_get_entries);
-PHP_FUNCTION(ldap_first_attribute);
-PHP_FUNCTION(ldap_next_attribute);
-PHP_FUNCTION(ldap_get_attributes);
-
-PHP_FUNCTION(ldap_get_values);
-PHP_FUNCTION(ldap_get_values_len);
-
-PHP_FUNCTION(ber_free);
-PHP_FUNCTION(ldap_get_dn);
-PHP_FUNCTION(ldap_explode_dn);
-PHP_FUNCTION(ldap_dn2ufn);
-
-PHP_FUNCTION(ldap_add);
-PHP_FUNCTION(ldap_delete);
-
-PHP_FUNCTION(ldap_mod_add);
-PHP_FUNCTION(ldap_mod_replace);
-PHP_FUNCTION(ldap_mod_del);
-
-PHP_FUNCTION(ldap_errno);
-PHP_FUNCTION(ldap_err2str);
-PHP_FUNCTION(ldap_error);
-
-PHP_FUNCTION(ldap_compare);
-
-PHP_FUNCTION(ldap_sort);
-
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP
-PHP_FUNCTION(ldap_get_option);
-PHP_FUNCTION(ldap_set_option);
-PHP_FUNCTION(ldap_parse_result);
-PHP_FUNCTION(ldap_first_reference);
-PHP_FUNCTION(ldap_next_reference);
-PHP_FUNCTION(ldap_parse_reference);
-PHP_FUNCTION(ldap_rename);
-#endif
-
-#if LDAP_API_VERSION > 2000
-PHP_FUNCTION(ldap_start_tls);
-#endif
-
-#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
-PHP_FUNCTION(ldap_set_rebind_proc);
-#endif
-
-#ifdef STR_TRANSLATION
-PHP_FUNCTION(ldap_t61_to_8859);
-PHP_FUNCTION(ldap_8859_to_t61);
-#endif
-
-ZEND_BEGIN_MODULE_GLOBALS(ldap)
- long num_links;
- long max_links;
-ZEND_END_MODULE_GLOBALS(ldap)
-
-#ifdef ZTS
-# define LDAPG(v) TSRMG(ldap_globals_id, zend_ldap_globals *, v)
-#else
-# define LDAPG(v) (ldap_globals.v)
-#endif
-
-
-#define phpext_ldap_ptr ldap_module_ptr
-
-#endif /* PHP_LDAP_H */
diff --git a/ext/mbstring/CREDITS b/ext/mbstring/CREDITS
deleted file mode 100644
index d03463b3d2..0000000000
--- a/ext/mbstring/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Multibyte String Functions
-Tsukada Takuya, Rui Hirokawa
diff --git a/ext/mbstring/README b/ext/mbstring/README
deleted file mode 100644
index 338aa79fcd..0000000000
--- a/ext/mbstring/README
+++ /dev/null
@@ -1,17 +0,0 @@
-!!Caution: DO NOT ADD/CHANGE MBSTRING CODE!!
-
-New mbstring is under development, anyone who would like
-add new feature/change behavior should access to development
-source.
-
-http://cvs.sourceforge.jp/cgi-bin/viewcvs.cgi/php-i18n/
-
-All changes made after 2002/5/19 are subject to be
-removed.
-
-You are warned in php-dev and php-cvs lists many times
-already. If you are curious, search archive for details.
-
-Thank you.
-
-
diff --git a/ext/mbstring/README_PHP3-i18n-ja b/ext/mbstring/README_PHP3-i18n-ja
deleted file mode 100644
index cac00b82a1..0000000000
--- a/ext/mbstring/README_PHP3-i18n-ja
+++ /dev/null
@@ -1,774 +0,0 @@
-==========================================
- README for I18N Package
-==========================================
-
-o Name and location of package
-
-Name: php-3.0.18-i18n-ja-2
-Location: http://www.happysize.co.jp/techie/php-ja-jp/
- ftp://ftp.happysize.co.jp/php-ja-jp/
- http://php.vdomains.org/
- ftp://ftp.vdomains.org/pub/php-ja-jp/
- http://php.jpnnet.com/
-
-Currently, this I18N version of PHP only adds Japanese support to base
-PHP. It allows you to use Japanese in scripts, as well as conversion
-between various Japanese encodings. It will work perfectly fine with
-ASCII with i18n option enabled. (note: executable is bit larger due
-to UNICODE table). The basic design aproach is to allow for other
-languages to be added in the future. Developers are encourage to join
-us!
-
-For more information on Japanese encodings, please refer to the
-section "Additional Notes."
-
-
-o What is this package?
-
-This package allows you to handle multiple Japanese encodings (SJIS, EUC,
-UTF-8, JIS) in PHP. If you find any bugs in this package, please report
-them to the appropriate mailing list. For now, the PHP-jp mailing list
-is the best place for this.
-
-PHP-jp ML mailto:PHP-jp@sidecar.ics.es.osaka-u.ac.jp
- http://sidecar.ics.es.osaka-u.ac.jp/php-jp/
- (discussions are in Japanese)
-
-
-o Who should use this
-
-Due to lack of documentation, it's not intended for beginners. If
-something goes wrong, be prepared to fix it on your own.
-
-
-o Warranty and Copyright
-
-There is no warranty with this package. Use it at your own risk.
-
-Please refer to the source code for the copyrights. In general, each
-program's copyright is owned by the programmer. Unless you obey the
-copyright holders restrictions, you are not allowed to use it in any
-form.
-
-
-o Redistribution
-
-As described in the source code, this package and the components are
-allowed to be redistributed with certain restrictions.
-
-Due to this package being still in beta, please try to redistribute
-it as an entire package. Please try not to distribute it as a form
-of patch. Because we would prefer to have this package distributed
-as one single package (not patch of patch of patch), avoid releasing
-any patch to this package.
-
-
-o Who made this
-
-A team of volunteers, PHP3 Internationalization, has been contributing
-their free time producing it. Although we are not related to the core
-PHP programmers, we are hoping to have our modifications merged into the
-core distribution in the near future. Thus, we did not call this a
-"Japanese Patch" (or distribution). Our final goal is to have true
-i18nized PHP!
-
-For anyone interested in this project, please drop us a line.
-
-Contact Address:
- phpj-dev@kage.net
- (Discussions are in Japanese, but feel free to write us in English)
-
-Webpage (English and Japanese):
- http://php.jpnnet.com/
-
-Project Outline (Japanese):
- http://www.happysize.co.jp/techie/php-ja-jp/spec.htm
-
-Developers:
- Hironori Sato <satoh@jpnnet.com>
- Shigeru Kanemoto <sgk@happysize.co.jp>
- Tsukada Takuya <tsukada@fminn.nagano.nagano.jp>
- U. Kenkichi <kenkichi@axes.co.jp>
- Tateyama <tateyan@amy.hi-ho.ne.jp>
- Other gracious contributors
-
-
-o Future plans
-
-- fulfilling what's written in outline
-- support for other languages other than Japanese
-- make the character conversion as a library (?)
-- more testing
-
-
-o Special Thanks to
-
-PHP Japanese webpage maintainer, Hirokawa-san
- http://www.cityfujisawa.ne.jp/%7Elouis/apps/phpfi/
-PHP-JP ML's Yamamoto-san
- http://sidecar.ics.es.osaka-u.ac.jp/php-jp/
-Previous jp-patch developers
-
-
-
-==========================================
- Advantages of using I18N package
-==========================================
-
-- allows you to use various character encodings for script files and
- http output
-- distinguish character encoding in POST/GET/COOKIE
-- proper mail output using JIS as body and MIME/Base64/JIS subject
-- if http output's Content-Type is text/html, it will set proper charset
-- stable character encoding conversion
-- multibyte regex
-
-
-
-==========================================
- Installation
-==========================================
-
-o Summary
-
-Add --enable-i18n option when running configure. For your own setup,
-add any other appropriate options as well.
-
-Don't forget to copy php3.ini-dist to desired location.
-(ex. /usr/local/lib/php3.ini)
-
-If you have already installed PHP3, copy all the entries in php3.ini-dist
-which start with "i18n.xxxx" to php3.ini.
-
-
-o configure option
- --enable-i18n
- include i18n features
-
- --enable-mbregex
- include multibyte regex library
- (without i18n enabled, mbregex functions will not function)
-
-
-o creating cgi version
-
- % tar xvzf php-3.0.18-i18n-ja-2.tar.gz
- % cd php-3.0.18-i18n-ja-2
- % ./configure --enable-i18n --enable-mbregex
- % make
-
-
-o creating Apache version (regular module)
-
- % tar xvzf php-3.0.18-i18n-ja-2.tar.gz
- % tar xvzf apache_1.3.x.tar.gz
- % cd apache_1.3.x
- % ./configure
- % cd ../php-3.0.18-i18n-ja-2
- % ./configure --with-apache=../apache_1.3.x --enable-i18n --enable-mbregex
- % make
- % make install
- % cd ../apache_1.3.x
- % ./configure --activate-module=src/modules/php3/libphp3.a
- % make
- % make install
-
-
-o creating Apache DSO version
-
- create DSO capable Apache first
- % tar xvzf apache_1.3.x.tar.gz
- % cd apache-1.3.x
- % ./configure --enable-shared=max
- % make
- % make install
-
- now create php3
- % cd php-3.0.18-i18n-ja-2
- % ./configure --with-apxs=/usr/local/apache/bin/apxs --enable-i18n \
- --enable-mbregex
- % make
- % make install
-
-
-==========================================
- Additional Notes
-==========================================
-
-o Multibyte regex library
-
-From beta4, we have included the multibyte (mb) regex library which comes with
-Ruby. With this addition, you can now use regex in EUC, SJIS and UTF-8
-encoding. To avoid any conflicts with HSREGEX included with Apache,
-each function name has been changed. Therefore, mb regex functions are
-named differently from the original ereg functions in PHP. The character
-encoding used in mb regex is configured in i18n.internal_encoding.
-
-
-o Binary Output
-
-If http output encoding is set to other than 'pass', conversion of encoding
-from internal encoding to http output is done automatically. Thus,
-if you prefer to spit out anything in raw binary format, your data
-may be corrupted. In such event, set http_output to 'pass'.
-
-ex.
- <?
- i18n_http_output("pass");
- ...
- echo $the_binary_data_string;
- ?>
-
-
-o Content-Type
-
-Depending on the setting of http_output, PHP will output the proper charset.
-ex. Content-Type: text/html; charset="..."
-
-Be aware of following:
-
-- If you set Content-Type header using header() function, that will
- override the automatic addition of charset.
-- Be cautious when you set i18n_http_output, since if any output is
- made prior to this, proper header may have been sent out to the
- client already.
-
-
-o In the event of trouble
-
-If you find any bugs or trouble, please contact us at the above address.
-It may help us to track the problem if you send us the script as well.
-
-If you encounter any memory related error such as segmentation violation,
-add --enable-debug when you run configure. This will give you more
-detail information on where error has occurred. The error is stored
-in the server log or regular http output in CGI mode.
-
-
-o About Japanese encodings
-
-Due to historical reason, there are multiple character encodings used
-for Japanese. The most common encodings are: SJIS, EUC, JIS, and UTF-8.
-Here are (very) brief description of them:
-
-EUC
- commonly used in UNIX environment
- 8bit-8bit combo
- always >=0x80
-
-SJIS
- commonly used in Mac or PCs
- similar to EUC
- mostly 8bit-8bit (some 8bit-7bit)
- mostly >=0x80
- there are some halfwidth (size of ASCII) multibytes
-
-JIS
- commonly used in 7bit environment (nntp and smtp)
- starts with escaping char, \033 and a few more characters
-
-UTF-8
- 16bit+ encoding
- defines many languages existing in this world
- see http://www.unicode.org/ for more detail
-
-Because of having all these character encodings, PHP needs to translate
-between these encodings on the fly. Also, the addition of the mb regex
-library allows you to handle mb strings without fear of getting mb char
-chopped in half.
-
-Since Japanese is not the only language with multiple encodings, we
-encourage other developers to modify our code to suit your needs. We
-definitely need people to work with Korean, Chinese (both traditional
-and simplified), and Russian. Let us know if you are interested in
-this project!
-
-
-
-==========================================
- php3.ini setting
-==========================================
-
-The following init options will allow you to change the default settings.
-Define these settings in the global section of php3.ini.
-
-All keywords are case-insensitive.
-
-o Encoding naming
-
- For each encoding, there are three names: standarized, alias, MIME
-
- - UTF-8
- standard: UTF-8
- alias: N/A
- mime: UTF-8
-
- - ASCII
- standard: ASCII
- alias: N/A
- mime: US-ASCII
-
- - Japanese EUC
- standard: EUC-JP
- alias: EUC, EUC_JP, eucJP, x-euc-jp
- mime: EUC-JP
-
- - Shift JIS
- standard: SJIS
- alias: x-sjis, MS_Kanji
- mime: Shift_JIS
-
- - JIS
- standard: JIS
- alias: N/A
- mime: ISO-2022-JP
-
- - Quoted-Printable
- standard: Quoted-Printable
- alias: qprint
- mime: N/A
-
- - BASE64
- standard: BASE64
- alias: N/A
- mime: N/A
-
- - no conversion
- standard: pass
- alias: none
- mime: N/A
-
- - auto encoding detection
- standard: auto
- alias: unknown
- mime: N/A
-
- * N/A - Not Applicapable
-
-o i18n.http_output - default http output encoding
-
- i18n.http_output = EUC-JP|SJIS|JIS|UTF-8|pass
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
- pass: no conversion
-
- The default is pass (internal encoding is used)
- It can be re-configured on the fly using i18n_http_output().
-
-
-o i18n.internal_encoding - internal encoding
-
- i18n.internal_encoding = EUC-JP|SJIS|UTF-8
- EUC-JP : EUC
- SJIS: SJIS
- UTF-8: UTF-8
-
- The default is EUC-JP.
-
- PHP parser is designed based on using ISO-8859-1. For other
- encodings, following conditions have to be satisfied in order
- to use them:
- - per byte encoding
- - single byte charactor in range of 00h-7fh which is compatible
- with ASCII
- - multibyte without 00h-7fh
- In case of Japanese, EUC-JP and UTF-8 are the only encoding that
- meets this criteria.
-
- If i18n.internal_encoding and i18n.http_output differs, conversion
- takes place at the time of output. If you convert any data within
- PHP scripts to URL encoding, BASE64 or Quoted-Printable, encoding
- stays as defined in i18n.internal_encoding. Thus, if you would
- prefer to encode in compliance with i18n.http_output, you need
- to manually convert encoding.
-
- ex. $str = urlencode( i18n_convert($str, i18n_http_output()) );
-
- Encoding such as ISO-2022-** and HZ encoding which uses escape
- sequences can not be used as internal encoding. If used, they
- result in following errors:
- - parser pukes funky error
- - magic_quotes_*** breaks encoding (SJIS may have similar problem)
- - string manipulation and regex will malfunction
-
-
-o i18n.script_encoding - script encoding
-
- i18n.script_encoding = auto|EUC-JP|SJIS|JIS|UTF-8
- auto: automatic
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
-
- The default is auto.
- The script's encoding is converted to i18n.internal_encoding before
- entering the script parser.
-
- Be aware that auto detection may fail under some conditions.
- For best auto detection, add multibyte charactor at begining of
- script.
-
-
-o i18n.http_input - handling of http input (GET/POST/COOKIE)
-
- i18n.http_input = pass|auto
- auto: auto conversion
- pass: no conversion
-
- The default is auto.
- If set to pass, no conversion will take place.
- If set to auto, it will automatically detect the encoding. If
- detection is successful, it will convert to the proper internal
- encoding. If not, it will assume the input as defined in
- i18n.http_input_default.
-
-o i18n.http_input_default - default http input encoding
-
- i18n.http_input_default = pass|EUC-JP|SJIS|JIS|UTF-8
- pass: no conversion
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
-
- The default is pass.
- This option is only effective as long as i18n.http_input is set to
- auto. If the auto detection fails, this encoding is used as an
- assumption to convert the http input to the internal encoding.
- If set to pass, no conversion will take place.
-
-o sample settings
-
- 1) For most flexibility, we recommend using following example.
- i18n.http_output = SJIS
- i18n.internal_encoding = EUC-JP
- i18n.script_encoding = auto
- i18n.http_input = auto
- i18n.http_input_default = SJIS
-
- 2) To avoid unexpected encoding problems, try these:
-
- i18n.http_output = pass
- i18n.internal_encoding = EUC-JP
- i18n.script_encoding = pass
- i18n.http_input = pass
- i18n.http_input_default = pass
-
-
-
-==========================================
- PHP functions
-==========================================
-
-The following describes the additional PHP functions.
-
-All keywords are case-insensitive.
-
-o i18n_http_output(encoding)
-o encoding = i18n_http_output()
-
- This will set the http output encoding. Any output following this
- function will be controlled by this function. If no argument is given,
- the current http output encode setting is returned.
-
- encodings
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
- pass: no conversion
-
- NONE is not allowed
-
-
-o encoding = i18n_internal_encoding()
-
- Returns the current internal encoding as a string.
-
- internal encoding
- EUC-JP : EUC
- SJIS: SJIS
- UTF-8: UTF-8
-
-
-o encoding = i18n_http_input()
-
- Returns http input encoding.
-
- encodings
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
- pass: no conversion (only if i18n.http_input is set to pass)
-
-
-o string = i18n_convert(string, encoding)
- string = i18n_convert(string, encoding, pre-conversion-encoding)
-
- Returns converted string in desired encoding. If
- pre-conversion-encoding is not defined, the given
- string is assumed to be in internal encoding.
-
- encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
- pass: no conversion
-
- pre-conversion-encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
- pass: no conversion
- auto: auto detection
-
-
-o encoding = i18n_discover_encoding(string)
-
- Encoding of the given string is returned (as a string).
-
- encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
- ASCII: ASCII (only 09h, 0Ah, 0Dh, 20h-7Eh)
- pass: unable to determine (text is too short to determine)
- unknown: unknown or possible error
-
-
-o int = mbstrlen(string)
-o int = mbstrlen(string, encoding)
-
- Returns character length of a given string. If no encoding is defined,
- the encoding of string is assumed to be the internal encoding.
-
- encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
- auto: automatic
-
-
-o int = mbstrpos(string1, string2)
-o int = mbstrpos(string1, string2, start)
-o int = mbstrpos(string1, string2, start, encoding)
-
- Same as strpos. If no encoding is defined, the encoding of string
- is assumed to be the internal encoding.
-
- encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
-
-
-o int = mbstrrpos(string1, string2)
-o int = mbstrrpos(string1, string2, encoding)
-
- Same as strrpos. If no encoding is defined, the encoding of string
- is assumed to be the internal encoding.
-
- encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
-
-
-o string = mbsubstr(string, position)
-o string = mbsubstr(string, position, length)
-o string = mbsubstr(string, position, length, encoding)
-
- Same as substr. If no encoding is defined, the encoding of string
- is assumed to be the internal encoding.
-
- encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
-
-
-o string = mbstrcut(string, position)
-o string = mbstrcut(string, position, length)
-o string = mbstrcut(string, position, length, encoding)
-
- Same as subcut. If position is the 2nd byte of a mb character, it will cut
- from the first byte of that character. It will cut the string without
- chopping a single byte from a mb character. In another words, if you
- set length to 5, you will only get two mb characters. If no encoding
- is defined, the encoding of string is assumed to be the internal encoding.
-
- encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
-
-
-o string = i18n_mime_header_encode(string)
- MIME encode the string in the format of =?ISO-2022-JP?B?[string]?=.
-
-
-o string = i18n_mime_header_decode(string)
- MIME decodes the string.
-
-
-o string = i18n_ja_jp_hantozen(string)
-o string = i18n_ja_jp_hantozen(string, option)
-o string = i18n_ja_jp_hantozen(string, option, encoding)
-
- Conversion between full width character and halfwidth character.
-
- option
- The following options are allowed. The default is "KV".
- Acronym: FW = fullwidth, HW = halfwidth
-
- "r" : FW alphabet -> HW alphabet
-
- "R" : HW alphabet -> FW alphabet
-
- "n" : FW number -> HW number
-
- "N" : HW number -> FW number
-
- "a" : FW alpha numeric (21h-7Eh) -> HW alpha numeric
-
- "A" : HW alpha numeric (21h-7Eh) -> FW alpha numeric
-
- "k" : FW katakana -> HW katakana
-
- "K" : HW katakana -> FW katakana
-
- "h" : FW hiragana -> HW hiragana
-
- "H" : HW hiragana -> FW katakana
-
- "c" : FW katakana -> FW hiragana
-
- "C" : FW hiragana -> FW katakana
-
- "V" : merge dakuon character. only works with "K" and "H" option
-
- encoding
- If no encoding is defined, the encoding of string is assumed to be
- the internal encoding.
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
-
-
-int = mbereg(regex_pattern, string, string)
-int = mberegi(regex_pattern, string, string)
- mb version of ereg() and eregi()
-
-
-string = mbereg_replace(regex_pattern, string, string)
-string = mberegi_replace(regex_pattern, string, string)
- mb version of ereg_replace() and eregi_replace()
-
-
-string_array = mbsplit(regex, string, limit)
- mb version of split()
-
-
-
-==========================================
- FAQ
-==========================================
-
-Here, we have gathered some commonly asked questions on PHP-jp mailing
-list.
-
-o To use Japanese in GET method
-
-If you need to assign Japanese text in GET method with argument, such as;
-xxxx.php?data=<Japanese text>, use urlencode function in PHP. If not,
-text may not be passed onto action php properly.
-
-ex: <a href="hoge.php?data=<? echo urlencode($data) ?>">Link</a>
-
-
-o When passing data via GET/POST/COOKIE, \ character sneaks in
-
-When using SJIS as internal encoding, or passed-on data includes '"\,
-PHP automatically inserts escaping character, \. Set magic_quotes_gpc
-in php3.ini from On to Off. An alternative work around to this problem
-is to use StripSlashes().
-
-If $quote_str is in SJIS and you would like to extract Japanese text,
-use ereg_replace as follows:
-
-ereg_replace(sprintf("([%c-%c%c-%c]\\\\)\\\\",0x81,0x9f,0xe0,0xfc),
- "\\1",$quote_str);
-
-This will effectively extract Japanese text out of $quote_str.
-
-
-o Sometimes, encoding detection fails
-
-If i18n_http_input() returns 'pass', it's likely that PHP failed to
-detect whether it's SJIS or EUC. In such case, use <input type=hidden
-value="some Japanese text"> to properly detect the incoming text's
-encoding.
-
-
-
-==========================================
- Japanese Manual
-==========================================
-Translated manual done by "PHP Japanese Manual Project" :
-
-http://www.php.net/manual/ja/manual.php
-
-Starting 3.0.18-i18n-ja, we have removed doc-jp from tarball package.
-
-
-==========================================
- Change Logs
-==========================================
-
-o 2000-10-28, Rui Hirokawa <hirokawa@php.net>
-
-This patch is derived from php-3.0.15-i18n-ja as well as php-3.0.16 by
-Kuwamura applied to original php-3.0.18. It also includes following fixes:
-
-1) allows you to set charset in mail().
-2) fixed mbregex definitions to avoid conflicts with system regex
-3) php3.ini-dist now uses PASS for http_output instead of SJIS
-
-o 2000-11-24, Hironori Sato <satoh@yyplanet.com>
-
-Applied above patched and added detection for gdImageStringTTF in configure.
-Following setups are known to work:
-
-gd-1.3-6, gd-devel-1.3-6, freetype-1.3.1-5, freetype-devel-1.3.1-5
- ImageTTFText($im,$size,$angle,$x1,$y1,$color,"/path/to/font.ttf",
- i18n_convert("ÆüËܸì", "UTF-8"));
- ImageGif($im);
-
-gd-1.7.3-1k1, gd-devel-1.7.3-1k1, freetype-1.3.1-5, freetype-devel-1.3.1-5
- ImageTTFText($im,$size,$angle,$x1,$y1,$color,"/path/to/font.ttf","ÆüËܸì");
- ImagePng($im);
- * i18n_internal_encoding = EUC Ëô¤Ï SJIS
-
-For any gd libraries before 1.6.2, you need to use i18n_convert. For
-gd-1.5.2/3, upgrade to anything above 1.7 to use ImageTTFText without
-using i18n_convert. As long as you have internal_encoding set to EUC or
-SJIS, ImageTTFText should work without mojibake. Again, make sure you
-have i18n_http_output("pass") before calling ImageGif, ImagePng, ImageJpeg!
-
-o 2000-12-09, Rui Hirokawa <hirokawa@php.net>
-
-Fixed mail() which was causing segmentation fault when header was null.
-
diff --git a/ext/mbstring/config.m4 b/ext/mbstring/config.m4
deleted file mode 100644
index af99d893e1..0000000000
--- a/ext/mbstring/config.m4
+++ /dev/null
@@ -1,42 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(mbstring, whether to enable multibyte string support,
-[ --enable-mbstring Enable multibyte string support])
-
-if test "$PHP_MBSTRING" != "no"; then
- AC_DEFINE(HAVE_MBSTRING,1,[whether to have multibyte string support])
-
- if test "$PHP_MBSTRING" != "no" -o "$PHP_MBSTRING" = "ja"; then
- AC_DEFINE(HAVE_MBSTR_JA,1,[whether to have japanese support])
- fi
- if test "$PHP_MBSTRING" = "cn"; then
- AC_DEFINE(HAVE_MBSTR_CN,1,[whether to have simplified chinese support])
- fi
- if test "$PHP_MBSTRING" = "tw"; then
- AC_DEFINE(HAVE_MBSTR_TW,1,[whether to have traditional chinese support])
- fi
- if test "$PHP_MBSTRING" = "kr"; then
- AC_DEFINE(HAVE_MBSTR_KR,1,[whether to have korean support])
- fi
- if test "$PHP_MBSTRING" = "ru"; then
- AC_DEFINE(HAVE_MBSTR_RU,1,[whether to have russian support])
- fi
- if test "$PHP_MBSTRING" = "all"; then
- AC_DEFINE(HAVE_MBSTR_JA,1,[whether to have japanese support])
- AC_DEFINE(HAVE_MBSTR_CN,1,[whether to have simplified chinese support])
- AC_DEFINE(HAVE_MBSTR_TW,1,[whether to have traditional chinese support])
- AC_DEFINE(HAVE_MBSTR_KR,1,[whether to have korean support])
- AC_DEFINE(HAVE_MBSTR_RU,1,[whether to have russian support])
- fi
-
- PHP_NEW_EXTENSION(mbstring, mbfilter_ja.c mbfilter_cn.c mbfilter_tw.c mbfilter_kr.c mbfilter_ru.c mbfilter.c mbstring.c mbregex.c php_mbregex.c html_entities.c php_unicode.c mb_gpc.c, $ext_shared)
-fi
-
-PHP_ARG_ENABLE(mbregex, whether to enable multibyte regex support,
-[ --disable-mbregex Disable multibyte regex support], yes, no)
-
-if test "$PHP_MBREGEX" != "no" -a "$PHP_MBSTRING" != "no"; then
- AC_DEFINE(HAVE_MBREGEX, 1, [whether to have multibyte regex support])
-fi
diff --git a/ext/mbstring/cp932_table.h b/ext/mbstring/cp932_table.h
deleted file mode 100644
index 7f3d6d9735..0000000000
--- a/ext/mbstring/cp932_table.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * cp932 table
- */
-static const unsigned short cp932ext3_eucjp_table[] = {
- /* ku 115 */
- 0xF3F3,0xF3F4,0xF3F5,0xF3F6,0xF3F7,0xF3F8,0xF3F9,0xF3FA,
- 0xF3FB,0xF3FC,0xF3FD,0xF3FE,0xF4A1,0xF4A2,0xF4A3,0xF4A4,
- 0xF4A5,0xF4A6,0xF4A7,0xF4A8,0x224C,0xA2C3,0xF4A9,0xF4AA,
- 0xF4AB,0xF4AC,0xF4AD,0x2268,0xD4E3,0xDCDF,0xE4E9,0xE3F8,
- 0xD9A1,0xB1BB,0xF4AE,0xC2AD,0xC3FC,0xE4D0,0xC2BF,0xBCF4,
- 0xB0A9,0xB0C8,0xF4AF,0xB0D2,0xB0D4,0xB0E3,0xB0EE,0xB1A7,
- 0xB1A3,0xB1AC,0xB1A9,0xB1BE,0xB1DF,0xB1D8,0xB1C8,0xB1D7,
- 0xB1E3,0xB1F4,0xB1E1,0xB2A3,0xF4B0,0xB2BB,0xB2E6,0xB2ED,
- 0xB2F5,0xB2FC,0xF4B1,0xB3B5,0xB3D8,0xB3DB,0xB3E5,0xB3EE,
- 0xB3FB,0xF4B2,0xF4B3,0xB4C0,0xB4C7,0xB4D0,0xB4DE,0xF4B4,
- 0xB5AA,0xF4B5,0xB5AF,0xB5C4,0xB5E8,0xF4B6,0xB7C2,0xB7E4,
- 0xB7E8,0xB7E7,0xF4B7,0xF4B8,0xF4B9,0xB8CE,
-
- /* ku 116 */
- 0xB8E1,0xB8F5,0xB8F7,0xB8F8,0xB8FC,0xB9AF,0xB9B7,0xBABE,
- 0xBADB,0xCDAA,0xBAE1,0xF4BA,0xBAEB,0xBBB3,0xBBB8,0xF4BB,
- 0xBBCA,0xF4BC,0xF4BD,0xBBD0,0xBBDE,0xBBF4,0xBBF5,0xBBF9,
- 0xBCE4,0xBCED,0xBCFE,0xF4BE,0xBDC2,0xBDE7,0xF4BF,0xBDF0,
- 0xBEB0,0xBEAC,0xF4C0,0xBEB3,0xBEBD,0xBECD,0xBEC9,0xBEE4,
- 0xBFA8,0xBFC9,0xC0C4,0xC0E4,0xC0F4,0xC1A6,0xF4C1,0xC1F5,
- 0xC1FC,0xF4C2,0xC1F8,0xC2AB,0xC2A1,0xC2A5,0xF4C3,0xC2B8,
- 0xC2BA,0xF4C4,0xC2C4,0xC2D2,0xC2D7,0xC2DB,0xC2DE,0xC2ED,
- 0xC2F0,0xF4C5,0xC3A1,0xC3B5,0xC3C9,0xC3B9,0xF4C6,0xC3D8,
- 0xC3FE,0xF4C7,0xC4CC,0xF4C8,0xC4D9,0xC4EA,0xC4FD,0xF4C9,
- 0xC5A7,0xC5B5,0xC5B6,0xF4CA,0xC5D5,0xC6B8,0xC6D7,0xC6E0,
- 0xC6EA,0xC6E3,0xC7A1,0xC7AB,0xC7C7,0xC7C3,
-
- /* ku 117 */
- 0xC7CB,0xC7CF,0xC7D9,0xF4CB,0xF4CC,0xC7E6,0xC7EE,0xC7FC,
- 0xC7EB,0xC7F0,0xC8B1,0xC8E5,0xC8F8,0xC9A6,0xC9AB,0xC9AD,
- 0xF4CD,0xC9CA,0xC9D3,0xC9E9,0xC9E3,0xC9FC,0xC9F4,0xC9F5,
- 0xF4CE,0xCAB3,0xCABD,0xCAEF,0xCAF1,0xCBAE,0xF4CF,0xCBCA,
- 0xCBE6,0xCBEA,0xCBF0,0xCBF4,0xCBEE,0xCCA5,0xCBF9,0xCCAB,
- 0xCCAE,0xCCAD,0xCCB2,0xCCC2,0xCCD0,0xCCD9,0xF4D0,0xCDBB,
- 0xF4D1,0xCEBB,0xF4D2,0xCEBA,0xCEC3,0xF4D3,0xCEF2,0xB3DD,
- 0xCFD5,0xCFE2,0xCFE9,0xCFED,0xF4D4,0xF4D5,0xF4D6,0xF4D7,
- 0xD0E5,0xF4D8,0xD0E9,0xD1E8,0xF4D9,0xF4DA,0xD1EC,0xD2BB,
- 0xF4DB,0xD3E1,0xD3E8,0xD4A7,0xF4DC,0xF4DD,0xD4D4,0xD4F2,
- 0xD5AE,0xF4DE,0xD7DE,0xF4DF,0xD8A2,0xD8B7,0xD8C1,0xD8D1,
- 0xD8F4,0xD9C6,0xD9C8,0xD9D1,0xF4E0,0xF4E1,
-
- /* ku 118 */
- 0xF4E2,0xF4E3,0xF4E4,0xDCD3,0xDDC8,0xDDD4,0xDDEA,0xDDFA,
- 0xDEA4,0xDEB0,0xF4E5,0xDEB5,0xDECB,0xF4E6,0xDFB9,0xF4E7,
- 0xDFC3,0xF4E8,0xF4E9,0xE0D9,0xF4EA,0xF4EB,0xE1E2,0xF4EC,
- 0xF4ED,0xF4EE,0xE2C7,0xE3A8,0xE3A6,0xE3A9,0xE3AF,0xE3B0,
- 0xE3AA,0xE3AB,0xE3BC,0xE3C1,0xE3BF,0xE3D5,0xE3D8,0xE3D6,
- 0xE3DF,0xE3E3,0xE3E1,0xE3D4,0xE3E9,0xE4A6,0xE3F1,0xE3F2,
- 0xE4CB,0xE4C1,0xE4C3,0xE4BE,0xF4EF,0xE4C0,0xE4C7,0xE4BF,
- 0xE4E0,0xE4DE,0xE4D1,0xF4F0,0xE4DC,0xE4D2,0xE4DB,0xE4D4,
- 0xE4FA,0xE4EF,0xE5B3,0xE5BF,0xE5C9,0xE5D0,0xE5E2,0xE5EA,
- 0xE5EB,0xF4F1,0xF4F2,0xF4F3,0xE6E8,0xE6EF,0xE7AC,0xF4F4,
- 0xE7AE,0xF4F5,0xE7B1,0xF4F6,0xE7B2,0xE8B1,0xE8B6,0xF4F7,
- 0xF4F8,0xE8DD,0xF4F9,0xF4FA,0xE9D1,0xF4FB,
-
- /* ku 119 */
- 0xE9ED,0xEACD,0xF4FC,0xEADB,0xEAE6,0xEAEA,0xEBA5,0xEBFB,
- 0xEBFA,0xF4FD,0xECD6,0xF4FE
-};
-
-static const int cp932ext3_eucjp_table_size = (sizeof (cp932ext3_eucjp_table) / sizeof (unsigned short));
diff --git a/ext/mbstring/html_entities.c b/ext/mbstring/html_entities.c
deleted file mode 100644
index 2d5206ce15..0000000000
--- a/ext/mbstring/html_entities.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-
-#include <stdlib.h>
-#include "mbfilter.h"
-
-const mbfl_html_entity mbfl_html_entity_list[] = { /*
- {"quot", 34}, DO NOT CONVERT THESE AUTOMATICALLY
- {"amp", 38},
- {"lt", 60},
- {"gt", 62}, */
- {"nbsp", 160},
- {"iexcl", 161},
- {"cent", 162},
- {"pound", 163},
- {"curren", 164},
- {"yen", 165},
- {"brvbar", 166},
- {"sect", 167},
- {"uml", 168},
- {"copy", 169},
- {"ordf", 170},
- {"laquo", 171},
- {"not", 172},
- {"shy", 173},
- {"reg", 174},
- {"macr", 175},
- {"deg", 176},
- {"plusmn", 177},
- {"sup2", 178},
- {"sup3", 179},
- {"acute", 180},
- {"micro", 181},
- {"para", 182},
- {"middot", 183},
- {"cedil", 184},
- {"sup1", 185},
- {"ordm", 186},
- {"raquo", 187},
- {"frac14", 188},
- {"frac12", 189},
- {"frac34", 190},
- {"iquest", 191},
- {"Agrave", 192},
- {"Aacute", 193},
- {"Acirc", 194},
- {"Atilde", 195},
- {"Auml", 196},
- {"Aring", 197},
- {"AElig", 198},
- {"Ccedil", 199},
- {"Egrave", 200},
- {"Eacute", 201},
- {"Ecirc", 202},
- {"Euml", 203},
- {"Igrave", 204},
- {"Iacute", 205},
- {"Icirc", 206},
- {"Iuml", 207},
- {"ETH", 208},
- {"Ntilde", 209},
- {"Ograve", 210},
- {"Oacute", 211},
- {"Ocirc", 212},
- {"Otilde", 213},
- {"Ouml", 214},
- {"times", 215},
- {"Oslash", 216},
- {"Ugrave", 217},
- {"Uacute", 218},
- {"Ucirc", 219},
- {"Uuml", 220},
- {"Yacute", 221},
- {"THORN", 222},
- {"szlig", 223},
- {"agrave", 224},
- {"aacute", 225},
- {"acirc", 226},
- {"atilde", 227},
- {"auml", 228},
- {"aring", 229},
- {"aelig", 230},
- {"ccedil", 231},
- {"egrave", 232},
- {"eacute", 233},
- {"ecirc", 234},
- {"euml", 235},
- {"igrave", 236},
- {"iacute", 237},
- {"icirc", 238},
- {"iuml", 239},
- {"eth", 240},
- {"ntilde", 241},
- {"ograve", 242},
- {"oacute", 243},
- {"ocirc", 244},
- {"otilde", 245},
- {"ouml", 246},
- {"divide", 247},
- {"oslash", 248},
- {"ugrave", 249},
- {"uacute", 250},
- {"ucirc", 251},
- {"uuml", 252},
- {"yacute", 253},
- {"thorn", 254},
- {"yuml", 255},
- {"OElig", 338},
- {"oelig", 339},
- {"Scaron", 352},
- {"scaron", 353},
- {"Yuml", 376},
- {"fnof", 402},
- {"circ", 710},
- {"tilde", 732},
- {"Alpha", 913},
- {"Beta", 914},
- {"Gamma", 915},
- {"Delta", 916},
- {"Epsilon", 917},
- {"Zeta", 918},
- {"Eta", 919},
- {"Theta", 920},
- {"Iota", 921},
- {"Kappa", 922},
- {"Lambda", 923},
- {"Mu", 924},
- {"Nu", 925},
- {"Xi", 926},
- {"Omicron", 927},
- {"Pi", 928},
- {"Rho", 929},
- {"Sigma", 931},
- {"Tau", 932},
- {"Upsilon", 933},
- {"Phi", 934},
- {"Chi", 935},
- {"Psi", 936},
- {"Omega", 937},
- {"beta", 946},
- {"gamma", 947},
- {"delta", 948},
- {"epsilon", 949},
- {"zeta", 950},
- {"eta", 951},
- {"theta", 952},
- {"iota", 953},
- {"kappa", 954},
- {"lambda", 955},
- {"mu", 956},
- {"nu", 957},
- {"xi", 958},
- {"omicron", 959},
- {"pi", 960},
- {"rho", 961},
- {"sigmaf", 962},
- {"sigma", 963},
- {"tau", 964},
- {"upsilon", 965},
- {"phi", 966},
- {"chi", 967},
- {"psi", 968},
- {"omega", 969},
- {"thetasym", 977},
- {"upsih", 978},
- {"piv", 982},
- {"ensp", 8194},
- {"emsp", 8195},
- {"thinsp", 8201},
- {"zwnj", 8204},
- {"zwj", 8205},
- {"lrm", 8206},
- {"rlm", 8207},
- {"ndash", 8211},
- {"mdash", 8212},
- {"lsquo", 8216},
- {"rsquo", 8217},
- {"sbquo", 8218},
- {"ldquo", 8220},
- {"rdquo", 8221},
- {"bdquo", 8222},
- {"dagger", 8224},
- {"Dagger", 8225},
- {"bull", 8226},
- {"hellip", 8230},
- {"permil", 8240},
- {"prime", 8242},
- {"Prime", 8243},
- {"lsaquo", 8249},
- {"rsaquo", 8250},
- {"oline", 8254},
- {"frasl", 8260},
- {"euro", 8364},
- {"weierp", 8472},
- {"image", 8465},
- {"real", 8476},
- {"trade", 8482},
- {"alefsym", 8501},
- {"larr", 8592},
- {"uarr", 8593},
- {"rarr", 8594},
- {"darr", 8595},
- {"harr", 8596},
- {"crarr", 8629},
- {"lArr", 8656},
- {"uArr", 8657},
- {"rArr", 8658},
- {"dArr", 8659},
- {"hArr", 8660},
- {"forall", 8704},
- {"part", 8706},
- {"exist", 8707},
- {"empty", 8709},
- {"nabla", 8711},
- {"isin", 8712},
- {"notin", 8713},
- {"ni", 8715},
- {"prod", 8719},
- {"sum", 8721},
- {"minus", 8722},
- {"lowast", 8727},
- {"radic", 8730},
- {"prop", 8733},
- {"infin", 8734},
- {"ang", 8736},
- {"and", 8743},
- {"or", 8744},
- {"cap", 8745},
- {"cup", 8746},
- {"int", 8747},
- {"there4", 8756},
- {"sim", 8764},
- {"cong", 8773},
- {"asymp", 8776},
- {"ne", 8800},
- {"equiv", 8801},
- {"le", 8804},
- {"ge", 8805},
- {"sub", 8834},
- {"sup", 8835},
- {"nsub", 8836},
- {"sube", 8838},
- {"supe", 8839},
- {"oplus", 8853},
- {"otimes", 8855},
- {"perp", 8869},
- {"sdot", 8901},
- {"lceil", 8968},
- {"rceil", 8969},
- {"lfloor", 8970},
- {"rfloor", 8971},
- {"lang", 9001},
- {"rang", 9002},
- {"loz", 9674},
- {"spades", 9824},
- {"clubs", 9827},
- {"hearts", 9829},
- {"diams", 9830},
- {NULL, -1} /* mark end of table */
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c
deleted file mode 100644
index 74402ebbfd..0000000000
--- a/ext/mbstring/mb_gpc.c
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rui Hirokawa <hirokawa@php.net> |
- | Moriyoshi Koizumi <moriyoshi@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* {{{ includes */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_variables.h"
-#include "mbstring.h"
-#include "ext/standard/php_string.h"
-#include "ext/standard/php_mail.h"
-#include "ext/standard/url.h"
-#include "main/php_output.h"
-#include "ext/standard/info.h"
-
-#include "php_variables.h"
-#include "php_globals.h"
-#include "rfc1867.h"
-#include "php_content_types.h"
-#include "SAPI.h"
-#include "TSRM.h"
-
-#include "mb_gpc.h"
-/* }}} */
-
-#if HAVE_MBSTRING
-
-ZEND_EXTERN_MODULE_GLOBALS(mbstring)
-
-/* {{{ static sapi_post_entry mbstr_post_entries[] */
-static sapi_post_entry mbstr_post_entries[] = {
- { DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_mb_post_handler },
- { MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, NULL, rfc1867_post_handler },
- { NULL, 0, NULL, NULL }
-};
-/* }}} */
-
-/* {{{ static sapi_post_entry php_post_entries[] */
-static sapi_post_entry php_post_entries[] = {
- { DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_std_post_handler },
- { MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, NULL, rfc1867_post_handler },
- { NULL, 0, NULL, NULL }
-};
-/* }}} */
-
-/* {{{ int _php_mb_enable_encoding_translation(int flag) */
-int _php_mb_enable_encoding_translation(int flag)
-{
- if (flag) {
- sapi_unregister_post_entry(php_post_entries);
- sapi_register_post_entries(mbstr_post_entries);
- sapi_register_treat_data(mbstr_treat_data);
- } else {
- sapi_unregister_post_entry(mbstr_post_entries);
- sapi_register_post_entries(php_post_entries);
- sapi_register_treat_data(php_default_treat_data);
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ MBSTRING_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data)
- * http input processing */
-MBSTRING_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data)
-{
- char *res = NULL, *separator=NULL;
- const char *c_var;
- pval *array_ptr;
- int free_buffer=0;
-
- switch (arg) {
- case PARSE_POST:
- case PARSE_GET:
- case PARSE_COOKIE:
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- switch (arg) {
- case PARSE_POST:
- PG(http_globals)[TRACK_VARS_POST] = array_ptr;
- break;
- case PARSE_GET:
- PG(http_globals)[TRACK_VARS_GET] = array_ptr;
- break;
- case PARSE_COOKIE:
- PG(http_globals)[TRACK_VARS_COOKIE] = array_ptr;
- break;
- }
- break;
- default:
- array_ptr=destArray;
- break;
- }
-
- if (arg==PARSE_POST) {
- sapi_handle_post(array_ptr TSRMLS_CC);
- return;
- }
-
- if (arg == PARSE_GET) { /* GET data */
- c_var = SG(request_info).query_string;
- if (c_var && *c_var) {
- res = (char *) estrdup(c_var);
- free_buffer = 1;
- } else {
- free_buffer = 0;
- }
- } else if (arg == PARSE_COOKIE) { /* Cookie data */
- c_var = SG(request_info).cookie_data;
- if (c_var && *c_var) {
- res = (char *) estrdup(c_var);
- free_buffer = 1;
- } else {
- free_buffer = 0;
- }
- } else if (arg == PARSE_STRING) { /* String data */
- res = str;
- free_buffer = 1;
- }
-
- if (!res) {
- return;
- }
-
- switch (arg) {
- case PARSE_POST:
- case PARSE_GET:
- case PARSE_STRING:
- separator = (char *) estrdup(PG(arg_separator).input);
- break;
- case PARSE_COOKIE:
- separator = ";\0";
- break;
- }
-
- switch(arg) {
- case PARSE_POST:
- MBSTRG(http_input_identify_post) = mbfl_no_encoding_invalid;
- break;
- case PARSE_GET:
- MBSTRG(http_input_identify_get) = mbfl_no_encoding_invalid;
- break;
- case PARSE_COOKIE:
- MBSTRG(http_input_identify_cookie) = mbfl_no_encoding_invalid;
- break;
- case PARSE_STRING:
- MBSTRG(http_input_identify_string) = mbfl_no_encoding_invalid;
- break;
- }
-
- _php_mb_encoding_handler_ex(arg, array_ptr, res, separator, 0, 0 TSRMLS_CC);
-
- if (MBSTRG(http_input_identify) != mbfl_no_encoding_invalid) {
- switch(arg){
- case PARSE_POST:
- MBSTRG(http_input_identify_post) = MBSTRG(http_input_identify);
- break;
- case PARSE_GET:
- MBSTRG(http_input_identify_get) = MBSTRG(http_input_identify);
- break;
- case PARSE_COOKIE:
- MBSTRG(http_input_identify_cookie) = MBSTRG(http_input_identify);
- break;
- case PARSE_STRING:
- MBSTRG(http_input_identify_string) = MBSTRG(http_input_identify);
- break;
- }
- }
-
- if (arg != PARSE_COOKIE) {
- efree(separator);
- }
-
- if (free_buffer) {
- efree(res);
- }
-}
-/* }}} */
-
-/* {{{ int _php_mb_encoding_handler_ex() */
-int _php_mb_encoding_handler_ex(int data_type, zval *arg, char *res, char *separator, int force_register_globals, int report_errors TSRMLS_DC)
-{
- char *var, *val, *s1, *s2;
- char *strtok_buf = NULL, **val_list = NULL;
- zval *array_ptr = (zval *) arg;
- int n, num, val_len, *len_list = NULL, *elist, elistsz;
- enum mbfl_no_encoding from_encoding, to_encoding;
- mbfl_string string, resvar, resval;
- mbfl_encoding_detector *identd = NULL;
- mbfl_buffer_converter *convd = NULL;
- int prev_rg_state = 0;
- int retval = 0;
-
- mbfl_string_init_set(&string, MBSTRG(current_language), MBSTRG(current_internal_encoding));
- mbfl_string_init_set(&resvar, MBSTRG(current_language), MBSTRG(current_internal_encoding));
- mbfl_string_init_set(&resval, MBSTRG(current_language), MBSTRG(current_internal_encoding));
-
- /* register_globals stuff
- * XXX: this feature is going to be deprecated? */
-
- if (force_register_globals) {
- prev_rg_state = PG(register_globals);
- PG(register_globals) = 1;
- }
-
- if (!res || *res == '\0') {
- goto out;
- }
-
- /* count the variables(separators) contained in the "res".
- * separator may contain multiple separator chars.
- * separaror chars are set in php.ini (arg_separator.input)
- */
- num = 1;
- for (s1=res; *s1 != '\0'; s1++) {
- for (s2=separator; *s2 != '\0'; s2++) {
- if (*s1 == *s2) {
- num++;
- }
- }
- }
- num *= 2; /* need space for variable name and value */
-
- val_list = (char **)ecalloc(num, sizeof(char *));
- len_list = (int *)ecalloc(num, sizeof(int));
-
- /* split and decode the query */
- n = 0;
- strtok_buf = NULL;
- var = php_strtok_r(res, separator, &strtok_buf);
- while (var) {
- val = strchr(var, '=');
- if (val) { /* have a value */
- len_list[n] = php_url_decode(var, val-var);
- val_list[n] = var;
- n++;
-
- *val++ = '\0';
- val_list[n] = val;
- len_list[n] = php_url_decode(val, strlen(val));
- } else {
- len_list[n] = php_url_decode(var, strlen(var));
- val_list[n] = var;
- n++;
-
- val_list[n] = "";
- len_list[n] = 0;
- }
- n++;
- var = php_strtok_r(NULL, separator, &strtok_buf);
- }
- num = n; /* make sure to process initilized vars only */
-
- /* initialize converter */
- to_encoding = MBSTRG(current_internal_encoding);
- elist = MBSTRG(http_input_list);
- elistsz = MBSTRG(http_input_list_size);
- if (elistsz <= 0) {
- from_encoding = mbfl_no_encoding_pass;
- } else if (elistsz == 1) {
- from_encoding = *elist;
- } else {
- /* auto detect */
- from_encoding = mbfl_no_encoding_invalid;
- identd = mbfl_encoding_detector_new(elist, elistsz TSRMLS_CC);
- if (identd) {
- n = 0;
- while (n < num) {
- string.val = (unsigned char *)val_list[n];
- string.len = len_list[n];
- if (mbfl_encoding_detector_feed(identd, &string TSRMLS_CC)) {
- break;
- }
- n++;
- }
- from_encoding = mbfl_encoding_detector_judge(identd TSRMLS_CC);
- mbfl_encoding_detector_delete(identd TSRMLS_CC);
- }
- if (from_encoding == mbfl_no_encoding_invalid) {
- if (report_errors) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to detect encoding");
- }
- from_encoding = mbfl_no_encoding_pass;
- }
- }
-
- convd = NULL;
- if (from_encoding != mbfl_no_encoding_pass) {
- convd = mbfl_buffer_converter_new(from_encoding, to_encoding, 0 TSRMLS_CC);
- if (convd != NULL) {
- mbfl_buffer_converter_illegal_mode(convd, MBSTRG(current_filter_illegal_mode) TSRMLS_CC);
- mbfl_buffer_converter_illegal_substchar(convd, MBSTRG(current_filter_illegal_substchar) TSRMLS_CC);
- } else {
- if (report_errors) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create converter");
- }
- goto out;
- }
- }
-
- /* convert encoding */
- string.no_encoding = from_encoding;
-
- n = 0;
- while (n < num) {
- string.val = (unsigned char *)val_list[n];
- string.len = len_list[n];
- if (convd != NULL && mbfl_buffer_converter_feed_result(convd, &string, &resvar TSRMLS_CC) != NULL) {
- var = (char *)resvar.val;
- } else {
- var = val_list[n];
- }
- n++;
- string.val = val_list[n];
- string.len = len_list[n];
- if (convd != NULL && mbfl_buffer_converter_feed_result(convd, &string, &resval TSRMLS_CC) != NULL) {
- val = resval.val;
- val_len = resval.len;
- } else {
- val = val_list[n];
- val_len = len_list[n];
- }
- n++;
- val_len = sapi_module.input_filter(data_type, var, &val, val_len TSRMLS_CC);
- /* add variable to symbol table */
- php_register_variable_safe(var, val, val_len, array_ptr TSRMLS_CC);
- if (convd != NULL){
- mbfl_string_clear(&resvar);
- mbfl_string_clear(&resval);
- }
- }
-
- MBSTRG(http_input_identify) = from_encoding;
- retval = 1;
-
-out:
- /* register_global stuff */
- if (force_register_globals) {
- PG(register_globals) = prev_rg_state;
- }
-
- if (convd != NULL) {
- mbfl_buffer_converter_delete(convd TSRMLS_CC);
- }
- if (val_list != NULL) {
- efree((void *)val_list);
- }
- if (len_list != NULL) {
- efree((void *)len_list);
- }
-
- return retval;
-}
-/* }}} */
-
-/* {{{ SAPI_POST_HANDLER_FUNC(php_mb_post_handler) */
-SAPI_POST_HANDLER_FUNC(php_mb_post_handler)
-{
- MBSTRG(http_input_identify_post) = mbfl_no_encoding_invalid;
-
- _php_mb_encoding_handler_ex(PARSE_POST, arg, SG(request_info).post_data, "&", 0, 0 TSRMLS_CC);
-
- if (MBSTRG(http_input_identify) != mbfl_no_encoding_invalid) {
- MBSTRG(http_input_identify_post) = MBSTRG(http_input_identify);
- }
-}
-/* }}} */
-
-#endif /* HAVE_MBSTRING */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
-
diff --git a/ext/mbstring/mb_gpc.h b/ext/mbstring/mb_gpc.h
deleted file mode 100644
index c8a847cb21..0000000000
--- a/ext/mbstring/mb_gpc.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rui Hirokawa <hirokawa@php.net> |
- | Moriyoshi Koizumi <moriyoshi@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* {{{ includes */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-/* }}} */
-
-#if HAVE_MBSTRING
-/* {{{ prototypes */
-SAPI_POST_HANDLER_FUNC(php_mb_post_handler);
-MBSTRING_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data);
-
-int _php_mb_enable_encoding_translation(int flag);
-int _php_mb_encoding_handler_ex(int data_type, zval *arg, char *res, char *separator, int force_register_globals, int report_errors TSRMLS_DC);
-/* }}} */
-#endif /* HAVE_MBSTRING */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/mbstring/mbfilter.c b/ext/mbstring/mbfilter.c
deleted file mode 100644
index a9e441f655..0000000000
--- a/ext/mbstring/mbfilter.c
+++ /dev/null
@@ -1,9677 +0,0 @@
-/*
- * charset=UTF-8
- * vim600: encoding=utf-8
- */
-
-/*
- * "streamable kanji code filter and converter"
- *
- * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved.
- *
- * This software is released under the GNU Lesser General Public License.
- * (Version 2.1, February 1999)
- * Please read the following detail of the licence (in japanese).
- *
- * ◆使用許諾æ¡ä»¶â—†
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•ã‚Œã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ
- * ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã«é–¢
- * ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ
- * ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利
- * ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用
- * ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’「GNU Lesser General Public License (Version 2.1, February
- * 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser
- * General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢
- * ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚
- *
- * 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã
- * ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“ã‚Œã¾ã§Library General
- * Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚
- * http://www.gnu.org/ --- GNUウェブサイト
- * http://www.gnu.org/copyleft/lesser.html --- ライセンス文é¢
- * ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。
- *
- * ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプロジェクトã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§
- * ã¯ã‚ã‚Šã¾ã›ã‚“。
- *
- * â—†ä¿è¨¼å†…容◆
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€æœŸå¾…ã•ã‚ŒãŸå‹•ä½œãƒ»æ©Ÿèƒ½ãƒ»æ€§èƒ½ã‚’æŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨­è¨ˆã•ã‚Œ
- * 開発ã•ã‚Œã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚ã‚Šã¾ã›ã‚“。ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€Œã“
- * ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•ã‚Œã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定ã®
- * 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•ã‚‰ã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•ã‚ŒãŸã‚Šæš—é»™ã«ç¤ºã•ã‚Œã¦ã„
- * ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åŠ¹ã§ã™ã€‚ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã—ãŸçµæžœãªã„ã—使
- * 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æ害
- * ã€ãƒ‡ãƒ¼ã‚¿ã®æ失ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æ害ã«ã¤ã„ã¦ã¯ã€ãã®æ害ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€…
- * ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è­¦å‘Šã•ã‚Œã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æ害ã®è³ 
- * å„ŸãŠã‚ˆã³è£œå¡«ã‚’è¡Œã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ»
- * 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚
- *
- * ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—†
- *
- * 〒102-0073
- * æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F
- * æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ
- * Phone: 03-3512-3655, Fax: 03-3512-3656
- * Email: sales@happysize.co.jp
- * Web: http://happysize.com/
- *
- * ◆著者◆
- *
- * 金本 茂 <sgk@happysize.co.jp>
- *
- * ◆履歴◆
- *
- * 1998/11/10 sgk implementation in C++
- * 1999/4/25 sgk Cã§æ›¸ããªãŠã—。
- * 1999/4/26 sgk 入力フィルタを実装。漢字コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’追加。
- * 1999/6/?? Unicodeサãƒãƒ¼ãƒˆã€‚
- * 1999/6/22 sgk ライセンスをLGPLã«å¤‰æ›´ã€‚
- *
- */
-
-/*
- * Unicode support
- *
- * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team.
- * All rights reserved.
- *
- */
-
-/* $Id$ */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-
-#ifdef HAVE_MBSTRING
-
-#include <stdlib.h>
-#include "mbfilter.h"
-
-#if defined(HAVE_MBSTR_JA)
-#include "mbfilter_ja.h"
-#endif
-#if defined(HAVE_MBSTR_CN)
-#include "mbfilter_cn.h"
-#endif
-#if defined(HAVE_MBSTR_TW)
-#include "mbfilter_tw.h"
-#endif
-#if defined(HAVE_MBSTR_KR)
-#include "mbfilter_kr.h"
-#endif
-#if defined(HAVE_MBSTR_KR)
-#include "mbfilter_ru.h"
-#endif
-
-#include "zend.h"
-
-#ifdef PHP_WIN32
-#include "win95nt.h"
-#endif
-
-#define mbfl_malloc emalloc
-#define mbfl_realloc erealloc
-#define mbfl_calloc ecalloc
-#define mbfl_free efree
-
-#define mbfl_pmalloc malloc
-#define mbfl_prealloc realloc
-#define mbfl_pfree free
-
-#include "unicode_table.h"
-
-/* language structure */
-static const mbfl_language mbfl_language_neutral = {
- mbfl_no_language_neutral,
- "neutral",
- "neutral",
- NULL,
- mbfl_no_encoding_utf8,
- mbfl_no_encoding_base64,
- mbfl_no_encoding_base64
-};
-
-static const char *mbfl_language_uni_aliases[] = {"universal", NULL};
-
-static const mbfl_language mbfl_language_uni = {
- mbfl_no_language_uni,
- "uni",
- "uni",
- (const char *(*)[])&mbfl_language_uni_aliases,
- mbfl_no_encoding_utf8,
- mbfl_no_encoding_base64,
- mbfl_no_encoding_base64
-};
-
-static const mbfl_language mbfl_language_japanese = {
- mbfl_no_language_japanese,
- "Japanese",
- "ja",
- NULL,
- mbfl_no_encoding_2022jp,
- mbfl_no_encoding_base64,
- mbfl_no_encoding_7bit
-};
-
-static const mbfl_language mbfl_language_korean = {
- mbfl_no_language_korean,
- "Korean",
- "ko",
- NULL,
- mbfl_no_encoding_2022kr,
- mbfl_no_encoding_base64,
- mbfl_no_encoding_7bit
-};
-
-static const mbfl_language mbfl_language_english = {
- mbfl_no_language_english,
- "English",
- "en",
- NULL,
- mbfl_no_encoding_8859_1,
- mbfl_no_encoding_qprint,
- mbfl_no_encoding_8bit
-};
-
-static const char *mbfl_language_german_aliases[] = {"Deutsch", NULL};
-
-static const mbfl_language mbfl_language_german = {
- mbfl_no_language_german,
- "German",
- "de",
- (const char *(*)[])&mbfl_language_german_aliases,
- mbfl_no_encoding_8859_15,
- mbfl_no_encoding_qprint,
- mbfl_no_encoding_8bit
-};
-
-static mbfl_language mbfl_language_simplified_chinese = {
- mbfl_no_language_simplified_chinese,
- "Simplified Chinese",
- "zh-cn",
- NULL,
- mbfl_no_encoding_hz,
- mbfl_no_encoding_base64,
- mbfl_no_encoding_7bit
-};
-
-static mbfl_language mbfl_language_traditional_chinese = {
- mbfl_no_language_traditional_chinese,
- "Traditional Chinese",
- "zh-tw",
- NULL,
- mbfl_no_encoding_big5,
- mbfl_no_encoding_base64,
- mbfl_no_encoding_8bit
-};
-
-static mbfl_language mbfl_language_russian = {
- mbfl_no_language_russian,
- "Russian",
- "ru",
- NULL,
- mbfl_no_encoding_koi8r,
- mbfl_no_encoding_qprint,
- mbfl_no_encoding_8bit
-};
-
-static const mbfl_language *mbfl_language_ptr_table[] = {
- &mbfl_language_uni,
- &mbfl_language_japanese,
- &mbfl_language_korean,
- &mbfl_language_simplified_chinese,
- &mbfl_language_traditional_chinese,
- &mbfl_language_english,
- &mbfl_language_german,
- &mbfl_language_russian,
- &mbfl_language_neutral,
- NULL
-};
-
-
-/* encoding byte width table */
-static const unsigned char mblen_table_utf8[] = {
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1
-};
-
-static const unsigned char mblen_table_eucjp[] = { /* 0xA1-0xFE */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
-};
-
-static const unsigned char mblen_table_sjis[] = { /* 0x80-0x9f,0xE0-0xFF */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
-};
-
-
-static const unsigned char mblen_table_euccn[] = { /* 0xA1-0xFE */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
-};
-
-static const unsigned char mblen_table_cp936[] = { /* 0x81-0xFE */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
-};
-
-static const unsigned char mblen_table_euctw[] = { /* 0xA1-0xFE */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
-};
-
-static const unsigned char mblen_table_big5[] = { /* 0x81-0xFE */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
-};
-
-
-static const unsigned char mblen_table_euckr[] = { /* 0xA1-0xFE */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
-};
-
-static const unsigned char mblen_table_uhc[] = { /* 0x81-0xFE */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
-};
-
-static const unsigned char mblen_table_html[] = { /* 0x00, 0x80 - 0xFF, only valid for numeric entities */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
-};
-
-/* encoding structure */
-static const char *mbfl_encoding_pass_aliases[] = {"none", NULL};
-
-static const mbfl_encoding mbfl_encoding_pass = {
- mbfl_no_encoding_pass,
- "pass",
- NULL,
- (const char *(*)[])&mbfl_encoding_pass_aliases,
- NULL,
- 0
-};
-
-static const char *mbfl_encoding_auto_aliases[] = {"unknown", NULL};
-
-static const mbfl_encoding mbfl_encoding_auto = {
- mbfl_no_encoding_auto,
- "auto",
- NULL,
- (const char *(*)[])&mbfl_encoding_auto_aliases,
- NULL,
- 0
-};
-
-static const mbfl_encoding mbfl_encoding_wchar = {
- mbfl_no_encoding_wchar,
- "wchar",
- NULL,
- NULL,
- NULL,
- MBFL_ENCTYPE_WCS4BE
-};
-
-static const mbfl_encoding mbfl_encoding_byte2be = {
- mbfl_no_encoding_byte2be,
- "byte2be",
- NULL,
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const mbfl_encoding mbfl_encoding_byte2le = {
- mbfl_no_encoding_byte2le,
- "byte2le",
- NULL,
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const mbfl_encoding mbfl_encoding_byte4be = {
- mbfl_no_encoding_byte4be,
- "byte4be",
- NULL,
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const mbfl_encoding mbfl_encoding_byte4le = {
- mbfl_no_encoding_byte4le,
- "byte4le",
- NULL,
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const mbfl_encoding mbfl_encoding_base64 = {
- mbfl_no_encoding_base64,
- "BASE64",
- "BASE64",
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const mbfl_encoding mbfl_encoding_uuencode = {
- mbfl_no_encoding_uuencode,
- "UUENCODE",
- "x-uuencode",
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_html_ent_aliases[] = {"HTML", "html", NULL};
-
-static const mbfl_encoding mbfl_encoding_html_ent = {
- mbfl_no_encoding_html_ent,
- "HTML-ENTITIES",
- "US-ASCII",
- (const char *(*)[])&mbfl_encoding_html_ent_aliases,
- NULL, /* mblen_table_html, Do not use table instead calulate length based on entities actually used */
- MBFL_ENCTYPE_HTML_ENT
-};
-
-static const char *mbfl_encoding_qprint_aliases[] = {"qprint", NULL};
-
-static const mbfl_encoding mbfl_encoding_qprint = {
- mbfl_no_encoding_qprint,
- "Quoted-Printable",
- "Quoted-Printable",
- (const char *(*)[])&mbfl_encoding_qprint_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const mbfl_encoding mbfl_encoding_7bit = {
- mbfl_no_encoding_7bit,
- "7bit",
- "7bit",
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const mbfl_encoding mbfl_encoding_8bit = {
- mbfl_no_encoding_8bit,
- "8bit",
- "8bit",
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_ucs2_aliases[] = {"ISO-10646-UCS-2", "UCS2" , "UNICODE", NULL};
-
-static const mbfl_encoding mbfl_encoding_ucs2 = {
- mbfl_no_encoding_ucs2,
- "UCS-2",
- "UCS-2",
- (const char *(*)[])&mbfl_encoding_ucs2_aliases,
- NULL,
- MBFL_ENCTYPE_WCS2BE
-};
-
-static const mbfl_encoding mbfl_encoding_ucs2be = {
- mbfl_no_encoding_ucs2be,
- "UCS-2BE",
- "UCS-2BE",
- NULL,
- NULL,
- MBFL_ENCTYPE_WCS2BE
-};
-
-static const mbfl_encoding mbfl_encoding_ucs2le = {
- mbfl_no_encoding_ucs2le,
- "UCS-2LE",
- "UCS-2LE",
- NULL,
- NULL,
- MBFL_ENCTYPE_WCS2LE
-};
-
-static const char *mbfl_encoding_ucs4_aliases[] = {"ISO-10646-UCS-4", "UCS4", NULL};
-
-static const mbfl_encoding mbfl_encoding_ucs4 = {
- mbfl_no_encoding_ucs4,
- "UCS-4",
- "UCS-4",
- (const char *(*)[])&mbfl_encoding_ucs4_aliases,
- NULL,
- MBFL_ENCTYPE_WCS4BE
-};
-
-static const mbfl_encoding mbfl_encoding_ucs4be = {
- mbfl_no_encoding_ucs4be,
- "UCS-4BE",
- "UCS-4BE",
- NULL,
- NULL,
- MBFL_ENCTYPE_WCS4BE
-};
-
-static const mbfl_encoding mbfl_encoding_ucs4le = {
- mbfl_no_encoding_ucs4le,
- "UCS-4LE",
- "UCS-4LE",
- NULL,
- NULL,
- MBFL_ENCTYPE_WCS4LE
-};
-
-static const char *mbfl_encoding_utf32_aliases[] = {"utf32", NULL};
-
-static const mbfl_encoding mbfl_encoding_utf32 = {
- mbfl_no_encoding_utf32,
- "UTF-32",
- "UTF-32",
- (const char *(*)[])&mbfl_encoding_utf32_aliases,
- NULL,
- MBFL_ENCTYPE_WCS4BE
-};
-
-static const mbfl_encoding mbfl_encoding_utf32be = {
- mbfl_no_encoding_utf32be,
- "UTF-32BE",
- "UTF-32BE",
- NULL,
- NULL,
- MBFL_ENCTYPE_WCS4BE
-};
-
-static const mbfl_encoding mbfl_encoding_utf32le = {
- mbfl_no_encoding_utf32le,
- "UTF-32LE",
- "UTF-32LE",
- NULL,
- NULL,
- MBFL_ENCTYPE_WCS4LE
-};
-
-static const char *mbfl_encoding_utf16_aliases[] = {"utf16", NULL};
-
-static const mbfl_encoding mbfl_encoding_utf16 = {
- mbfl_no_encoding_utf16,
- "UTF-16",
- "UTF-16",
- (const char *(*)[])&mbfl_encoding_utf16_aliases,
- NULL,
- MBFL_ENCTYPE_MWC2BE
-};
-
-static const mbfl_encoding mbfl_encoding_utf16be = {
- mbfl_no_encoding_utf16be,
- "UTF-16BE",
- "UTF-16BE",
- NULL,
- NULL,
- MBFL_ENCTYPE_MWC2BE
-};
-
-static const mbfl_encoding mbfl_encoding_utf16le = {
- mbfl_no_encoding_utf16le,
- "UTF-16LE",
- "UTF-16LE",
- NULL,
- NULL,
- MBFL_ENCTYPE_MWC2LE
-};
-
-static const char *mbfl_encoding_utf8_aliases[] = {"utf8", NULL};
-
-static const mbfl_encoding mbfl_encoding_utf8 = {
- mbfl_no_encoding_utf8,
- "UTF-8",
- "UTF-8",
- (const char *(*)[])&mbfl_encoding_utf8_aliases,
- mblen_table_utf8,
- MBFL_ENCTYPE_MBCS
-};
-
-static const char *mbfl_encoding_utf7_aliases[] = {"utf7", NULL};
-
-static const mbfl_encoding mbfl_encoding_utf7 = {
- mbfl_no_encoding_utf7,
- "UTF-7",
- "UTF-7",
- (const char *(*)[])&mbfl_encoding_utf7_aliases,
- NULL,
- MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
-};
-
-static const mbfl_encoding mbfl_encoding_utf7imap = {
- mbfl_no_encoding_utf7imap,
- "UTF7-IMAP",
- NULL,
- NULL,
- NULL,
- MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
-};
-
-
-static const char *mbfl_encoding_ascii_aliases[] = {"ANSI_X3.4-1968", "iso-ir-6", "ANSI_X3.4-1986", "ISO_646.irv:1991", "US-ASCII", "ISO646-US", "us", "IBM367", "cp367", "csASCII", NULL};
-
-static const mbfl_encoding mbfl_encoding_ascii = {
- mbfl_no_encoding_ascii,
- "ASCII",
- "US-ASCII", /* preferred MIME name */
- (const char *(*)[])&mbfl_encoding_ascii_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-#if defined(HAVE_MBSTR_JA)
-static const char *mbfl_encoding_euc_jp_aliases[] = {"EUC", "EUC_JP", "eucJP", "x-euc-jp", NULL};
-
-static const mbfl_encoding mbfl_encoding_euc_jp = {
- mbfl_no_encoding_euc_jp,
- "EUC-JP",
- "EUC-JP",
- (const char *(*)[])&mbfl_encoding_euc_jp_aliases,
- mblen_table_eucjp,
- MBFL_ENCTYPE_MBCS
-};
-
-static const char *mbfl_encoding_sjis_aliases[] = {"x-sjis", "SHIFT-JIS", NULL};
-
-static const mbfl_encoding mbfl_encoding_sjis = {
- mbfl_no_encoding_sjis,
- "SJIS",
- "Shift_JIS",
- (const char *(*)[])&mbfl_encoding_sjis_aliases,
- mblen_table_sjis,
- MBFL_ENCTYPE_MBCS
-};
-
-static const char *mbfl_encoding_eucjp_win_aliases[] = {"eucJP-open", NULL};
-
-static const mbfl_encoding mbfl_encoding_eucjp_win = {
- mbfl_no_encoding_eucjp_win,
- "eucJP-win",
- "EUC-JP",
- (const char *(*)[])&mbfl_encoding_eucjp_win_aliases,
- mblen_table_eucjp,
- MBFL_ENCTYPE_MBCS
-};
-
-static const char *mbfl_encoding_sjis_win_aliases[] = {"SJIS-open", "MS_Kanji", "Windows-31J", "CP932", NULL};
-
-static const mbfl_encoding mbfl_encoding_sjis_win = {
- mbfl_no_encoding_sjis_win,
- "SJIS-win",
- "Shift_JIS",
- (const char *(*)[])&mbfl_encoding_sjis_win_aliases,
- mblen_table_sjis,
- MBFL_ENCTYPE_MBCS
-};
-
-static const mbfl_encoding mbfl_encoding_jis = {
- mbfl_no_encoding_jis,
- "JIS",
- "ISO-2022-JP",
- NULL,
- NULL,
- MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
-};
-
-static const mbfl_encoding mbfl_encoding_2022jp = {
- mbfl_no_encoding_2022jp,
- "ISO-2022-JP",
- "ISO-2022-JP",
- NULL,
- NULL,
- MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
-};
-#endif /* HAVE_MBSTR_JA */
-
-
-#if defined(HAVE_MBSTR_CN)
-static const char *mbfl_encoding_euc_cn_aliases[] = {"CN-GB", "EUC_CN", "eucCN", "x-euc-cn", "gb2312", NULL};
-
-static mbfl_encoding mbfl_encoding_euc_cn = {
- mbfl_no_encoding_euc_cn,
- "EUC-CN",
- "CN-GB",
- (const char *(*)[])&mbfl_encoding_euc_cn_aliases,
- mblen_table_euccn,
- MBFL_ENCTYPE_MBCS
-};
-
-static const char *mbfl_encoding_cp936_aliases[] = {"CP-936", NULL};
-
-static mbfl_encoding mbfl_encoding_cp936 = {
- mbfl_no_encoding_cp936,
- "CP936",
- "CP936",
- (const char *(*)[])&mbfl_encoding_cp936_aliases,
- mblen_table_cp936,
- MBFL_ENCTYPE_MBCS
-};
-
-static mbfl_encoding mbfl_encoding_hz = {
- mbfl_no_encoding_hz,
- "HZ",
- "HZ-GB-2312",
- NULL,
- NULL,
- MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
-};
-
-#endif /* HAVE_MBSTR_CN */
-
-#if defined(HAVE_MBSTR_TW)
-static const char *mbfl_encoding_euc_tw_aliases[] = {"EUC_TW", "eucTW", "x-euc-tw", NULL};
-
-static mbfl_encoding mbfl_encoding_euc_tw = {
- mbfl_no_encoding_euc_tw,
- "EUC-TW",
- "EUC-TW",
- (const char *(*)[])&mbfl_encoding_euc_tw_aliases,
- mblen_table_euctw,
- MBFL_ENCTYPE_MBCS
-};
-
-static const char *mbfl_encoding_big5_aliases[] = {"CN-BIG5", "BIG-FIVE", "BIGFIVE", "CP950", NULL};
-
-static mbfl_encoding mbfl_encoding_big5 = {
- mbfl_no_encoding_big5,
- "BIG-5",
- "BIG5",
- (const char *(*)[])&mbfl_encoding_big5_aliases,
- mblen_table_big5,
- MBFL_ENCTYPE_MBCS
-};
-
-#endif /* HAVE_MBSTR_TW */
-
-#if defined(HAVE_MBSTR_KR)
-static const char *mbfl_encoding_euc_kr_aliases[] = {"EUC_KR", "eucKR", "x-euc-kr", NULL};
-
-static const mbfl_encoding mbfl_encoding_euc_kr = {
- mbfl_no_encoding_euc_kr,
- "EUC-KR",
- "EUC-KR",
- (const char *(*)[])&mbfl_encoding_euc_kr_aliases,
- mblen_table_euckr,
- MBFL_ENCTYPE_MBCS
-};
-
-static const char *mbfl_encoding_uhc_aliases[] = {"CP949", NULL};
-
-static const mbfl_encoding mbfl_encoding_uhc = {
- mbfl_no_encoding_uhc,
- "UHC",
- "UHC",
- (const char *(*)[])&mbfl_encoding_uhc_aliases,
- mblen_table_uhc,
- MBFL_ENCTYPE_MBCS
-};
-
-static const mbfl_encoding mbfl_encoding_2022kr = {
- mbfl_no_encoding_2022kr,
- "ISO-2022-KR",
- "ISO-2022-KR",
- NULL,
- NULL,
- MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
-};
-
-#endif /* HAVE_MBSTR_KR */
-
-static const char *mbfl_encoding_cp1252_aliases[] = {"cp1252", NULL};
-
-static const mbfl_encoding mbfl_encoding_cp1252 = {
- mbfl_no_encoding_cp1252,
- "Windows-1252",
- "Windows-1252",
- (const char *(*)[])&mbfl_encoding_cp1252_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_1_aliases[] = {"ISO_8859-1", "latin1", NULL};
-
-static const mbfl_encoding mbfl_encoding_8859_1 = {
- mbfl_no_encoding_8859_1,
- "ISO-8859-1",
- "ISO-8859-1",
- (const char *(*)[])&mbfl_encoding_8859_1_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_2_aliases[] = {"ISO_8859-2", "latin2", NULL};
-
-static const mbfl_encoding mbfl_encoding_8859_2 = {
- mbfl_no_encoding_8859_2,
- "ISO-8859-2",
- "ISO-8859-2",
- (const char *(*)[])&mbfl_encoding_8859_2_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_3_aliases[] = {"ISO_8859-3", "latin3", NULL};
-
-static const mbfl_encoding mbfl_encoding_8859_3 = {
- mbfl_no_encoding_8859_3,
- "ISO-8859-3",
- "ISO-8859-3",
- (const char *(*)[])&mbfl_encoding_8859_3_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_4_aliases[] = {"ISO_8859-4", "latin4", NULL};
-
-static const mbfl_encoding mbfl_encoding_8859_4 = {
- mbfl_no_encoding_8859_4,
- "ISO-8859-4",
- "ISO-8859-4",
- (const char *(*)[])&mbfl_encoding_8859_4_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_5_aliases[] = {"ISO_8859-5", "cyrillic", NULL};
-
-static const mbfl_encoding mbfl_encoding_8859_5 = {
- mbfl_no_encoding_8859_5,
- "ISO-8859-5",
- "ISO-8859-5",
- (const char *(*)[])&mbfl_encoding_8859_5_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_6_aliases[] = {"ISO_8859-6", "arabic", NULL};
-
-static const mbfl_encoding mbfl_encoding_8859_6 = {
- mbfl_no_encoding_8859_6,
- "ISO-8859-6",
- "ISO-8859-6",
- (const char *(*)[])&mbfl_encoding_8859_6_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_7_aliases[] = {"ISO_8859-7", "greek", NULL};
-
-static const mbfl_encoding mbfl_encoding_8859_7 = {
- mbfl_no_encoding_8859_7,
- "ISO-8859-7",
- "ISO-8859-7",
- (const char *(*)[])&mbfl_encoding_8859_7_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_8_aliases[] = {"ISO_8859-8", "hebrew", NULL};
-
-static const mbfl_encoding mbfl_encoding_8859_8 = {
- mbfl_no_encoding_8859_8,
- "ISO-8859-8",
- "ISO-8859-8",
- (const char *(*)[])&mbfl_encoding_8859_8_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_9_aliases[] = {"ISO_8859-9", "latin5", NULL};
-
-static const mbfl_encoding mbfl_encoding_8859_9 = {
- mbfl_no_encoding_8859_9,
- "ISO-8859-9",
- "ISO-8859-9",
- (const char *(*)[])&mbfl_encoding_8859_9_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_10_aliases[] = {"ISO_8859-10", "latin6", NULL};
-
-static const mbfl_encoding mbfl_encoding_8859_10 = {
- mbfl_no_encoding_8859_10,
- "ISO-8859-10",
- "ISO-8859-10",
- (const char *(*)[])&mbfl_encoding_8859_10_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_13_aliases[] = {"ISO_8859-13", NULL};
-
-static const mbfl_encoding mbfl_encoding_8859_13 = {
- mbfl_no_encoding_8859_13,
- "ISO-8859-13",
- "ISO-8859-13",
- (const char *(*)[])&mbfl_encoding_8859_13_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_14_aliases[] = {"ISO_8859-14", "latin8", NULL};
-
-static const mbfl_encoding mbfl_encoding_8859_14 = {
- mbfl_no_encoding_8859_14,
- "ISO-8859-14",
- "ISO-8859-14",
- (const char *(*)[])&mbfl_encoding_8859_14_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_15_aliases[] = {"ISO_8859-15", NULL};
-
-static const mbfl_encoding mbfl_encoding_8859_15 = {
- mbfl_no_encoding_8859_15,
- "ISO-8859-15",
- "ISO-8859-15",
- (const char *(*)[])&mbfl_encoding_8859_15_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-#if defined(HAVE_MBSTR_RU)
-static const char *mbfl_encoding_cp1251_aliases[] = {"CP1251", "CP-1251", "WINDOWS-1251", NULL};
-
-static const mbfl_encoding mbfl_encoding_cp1251 = {
- mbfl_no_encoding_cp1251,
- "Windows-1251",
- "Windows-1251",
- (const char *(*)[])&mbfl_encoding_cp1251_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_cp866_aliases[] = {"CP866", "CP-866", "IBM-866", NULL};
-
-static const mbfl_encoding mbfl_encoding_cp866 = {
- mbfl_no_encoding_cp866,
- "CP866",
- "CP866",
- (const char *(*)[])&mbfl_encoding_cp866_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_koi8r_aliases[] = {"KOI8-R", "KOI8R", NULL};
-
-static const mbfl_encoding mbfl_encoding_koi8r = {
- mbfl_no_encoding_koi8r,
- "KOI8-R",
- "KOI8-R",
- (const char *(*)[])&mbfl_encoding_koi8r_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-#endif
-
-static const mbfl_encoding *mbfl_encoding_ptr_list[] = {
- &mbfl_encoding_pass,
- &mbfl_encoding_auto,
- &mbfl_encoding_wchar,
- &mbfl_encoding_byte2be,
- &mbfl_encoding_byte2le,
- &mbfl_encoding_byte4be,
- &mbfl_encoding_byte4le,
- &mbfl_encoding_base64,
- &mbfl_encoding_uuencode,
- &mbfl_encoding_html_ent,
- &mbfl_encoding_qprint,
- &mbfl_encoding_7bit,
- &mbfl_encoding_8bit,
- &mbfl_encoding_ucs4,
- &mbfl_encoding_ucs4be,
- &mbfl_encoding_ucs4le,
- &mbfl_encoding_ucs2,
- &mbfl_encoding_ucs2be,
- &mbfl_encoding_ucs2le,
- &mbfl_encoding_utf32,
- &mbfl_encoding_utf32be,
- &mbfl_encoding_utf32le,
- &mbfl_encoding_utf16,
- &mbfl_encoding_utf16be,
- &mbfl_encoding_utf16le,
- &mbfl_encoding_utf8,
- &mbfl_encoding_utf7,
- &mbfl_encoding_utf7imap,
- &mbfl_encoding_ascii,
-#if defined(HAVE_MBSTR_JA)
- &mbfl_encoding_euc_jp,
- &mbfl_encoding_sjis,
- &mbfl_encoding_eucjp_win,
- &mbfl_encoding_sjis_win,
- &mbfl_encoding_jis,
- &mbfl_encoding_2022jp,
-#endif
- &mbfl_encoding_cp1252,
- &mbfl_encoding_8859_1,
- &mbfl_encoding_8859_2,
- &mbfl_encoding_8859_3,
- &mbfl_encoding_8859_4,
- &mbfl_encoding_8859_5,
- &mbfl_encoding_8859_6,
- &mbfl_encoding_8859_7,
- &mbfl_encoding_8859_8,
- &mbfl_encoding_8859_9,
- &mbfl_encoding_8859_10,
- &mbfl_encoding_8859_13,
- &mbfl_encoding_8859_14,
- &mbfl_encoding_8859_15,
-#if defined(HAVE_MBSTR_CN)
- &mbfl_encoding_euc_cn,
- &mbfl_encoding_cp936,
- &mbfl_encoding_hz,
-#endif
-#if defined(HAVE_MBSTR_TW)
- &mbfl_encoding_euc_tw,
- &mbfl_encoding_big5,
-#endif
-#if defined(HAVE_MBSTR_KR)
- &mbfl_encoding_euc_kr,
- &mbfl_encoding_uhc,
- &mbfl_encoding_2022kr,
-#endif
-#if defined(HAVE_MBSTR_RU)
- &mbfl_encoding_cp1251,
- &mbfl_encoding_cp866,
- &mbfl_encoding_koi8r,
-#endif
- NULL
-};
-
-/* hex character table "0123456789ABCDEF" */
-static char mbfl_hexchar_table[] = {
- 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46
-};
-
-/* forward */
-static void mbfl_filt_conv_common_ctor(mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_common_flush(mbfl_convert_filter *filter TSRMLS_DC);
-static void mbfl_filt_conv_common_dtor(mbfl_convert_filter *filter TSRMLS_DC);
-
-static int mbfl_filt_conv_pass(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_byte2be(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_byte2be_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_byte2le(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_byte2le_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_byte4be(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_byte4be_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_byte4le(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_byte4le_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_any_7bit(int c, mbfl_convert_filter *filter TSRMLS_DC);
-
-static int mbfl_filt_conv_base64enc(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_base64enc_flush(mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_base64dec(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_base64dec_flush(mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_uudec(int c, mbfl_convert_filter *filter TSRMLS_DC);
-
-static void mbfl_filt_conv_html_dec_ctor(mbfl_convert_filter *filter TSRMLS_DC);
-static void mbfl_filt_conv_html_dec_dtor(mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_html_enc(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_html_enc_flush(mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_html_dec(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_html_dec_flush(mbfl_convert_filter *filter TSRMLS_DC);
-
-static int mbfl_filt_conv_qprintenc(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_qprintenc_flush(mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_qprintdec(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_qprintdec_flush(mbfl_convert_filter *filter TSRMLS_DC);
-
-static int mbfl_filt_conv_ucs4_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_ucs4be(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_ucs4le(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_ucs2_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_ucs2be(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_ucs2le(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_utf16_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_utf16be_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_utf16be(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_utf16le_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_utf16le(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_utf8(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_utf7_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_utf7(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_utf7_flush(mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_utf7imap_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_utf7imap(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_utf7imap_flush(mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_ascii(int c, mbfl_convert_filter *filter TSRMLS_DC);
-
-static int mbfl_filt_conv_wchar_cp1252(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_cp1252_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_8859_1(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_8859_2_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_8859_2(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_8859_3_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_8859_3(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_8859_4_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_8859_4(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_8859_5_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_8859_5(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_8859_6_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_8859_6(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_8859_7_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_8859_7(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_8859_8_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_8859_8(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_8859_9_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_8859_9(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_8859_10_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_8859_10(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_8859_13_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_8859_13(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_8859_14_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_8859_14(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_8859_15_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-static int mbfl_filt_conv_wchar_8859_15(int c, mbfl_convert_filter *filter TSRMLS_DC);
-
-static void mbfl_filt_ident_common_ctor(mbfl_identify_filter *filter TSRMLS_DC);
-static void mbfl_filt_ident_common_dtor(mbfl_identify_filter *filter TSRMLS_DC);
-static void mbfl_filt_ident_false_ctor(mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_utf8(int c, mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_utf7(int c, mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_ascii(int c, mbfl_identify_filter *filter TSRMLS_DC);
-#if defined(HAVE_MBSTR_JA)
-static int mbfl_filt_ident_eucjp(int c, mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_sjis(int c, mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_sjiswin(int c, mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_jis(int c, mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_2022jp(int c, mbfl_identify_filter *filter TSRMLS_DC);
-#endif /* HAVE_MBSTR_JA */
-
-#if defined(HAVE_MBSTR_CN)
-static int mbfl_filt_ident_euccn(int c, mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_cp936(int c, mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_hz(int c, mbfl_identify_filter *filter TSRMLS_DC);
-#endif /* HAVE_MBSTR_CN */
-
-#if defined(HAVE_MBSTR_TW)
-static int mbfl_filt_ident_euctw(int c, mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_big5(int c, mbfl_identify_filter *filter TSRMLS_DC);
-#endif /* HAVE_MBSTR_TW */
-
-#if defined(HAVE_MBSTR_KR)
-static int mbfl_filt_ident_euckr(int c, mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_uhc(int c, mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_2022kr(int c, mbfl_identify_filter *filter TSRMLS_DC);
-#endif /* HAVE_MBSTR_KR */
-
-#if defined(HAVE_MBSTR_RU)
-static int mbfl_filt_ident_cp1251(int c, mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_cp866(int c, mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_koi8r(int c, mbfl_identify_filter *filter TSRMLS_DC);
-#endif /* HAVE_MBSTR_RU */
-
-static int mbfl_filt_ident_cp1252(int c, mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_false(int c, mbfl_identify_filter *filter TSRMLS_DC);
-static int mbfl_filt_ident_true(int c, mbfl_identify_filter *filter TSRMLS_DC);
-
-/* convert filter function table */
-static const struct mbfl_convert_vtbl vtbl_pass = {
- mbfl_no_encoding_pass,
- mbfl_no_encoding_pass,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_pass,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_byte2be_wchar = {
- mbfl_no_encoding_byte2be,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte2be_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_byte2be = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_byte2be,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_byte2be,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_byte2le_wchar = {
- mbfl_no_encoding_byte2le,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte2le_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_byte2le = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_byte2le,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_byte2le,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_byte4be_wchar = {
- mbfl_no_encoding_byte4be,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte4be_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_byte4be = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_byte4be,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_byte4be,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_byte4le_wchar = {
- mbfl_no_encoding_byte4le,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte4le_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_byte4le = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_byte4le,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_byte4le,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_8bit_b64 = {
- mbfl_no_encoding_8bit,
- mbfl_no_encoding_base64,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_base64enc,
- mbfl_filt_conv_base64enc_flush };
-
-static const struct mbfl_convert_vtbl vtbl_b64_8bit = {
- mbfl_no_encoding_base64,
- mbfl_no_encoding_8bit,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_base64dec,
- mbfl_filt_conv_base64dec_flush };
-
-static const struct mbfl_convert_vtbl vtbl_uuencode_8bit = {
- mbfl_no_encoding_uuencode,
- mbfl_no_encoding_8bit,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_uudec,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_html = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_html_ent,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_html_enc,
- mbfl_filt_conv_html_enc_flush };
-
-static const struct mbfl_convert_vtbl vtbl_html_wchar = {
- mbfl_no_encoding_html_ent,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_html_dec_ctor,
- mbfl_filt_conv_html_dec_dtor,
- mbfl_filt_conv_html_dec,
- mbfl_filt_conv_html_dec_flush };
-
-static const struct mbfl_convert_vtbl vtbl_8bit_qprint = {
- mbfl_no_encoding_8bit,
- mbfl_no_encoding_qprint,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_qprintenc,
- mbfl_filt_conv_qprintenc_flush };
-
-static const struct mbfl_convert_vtbl vtbl_qprint_8bit = {
- mbfl_no_encoding_qprint,
- mbfl_no_encoding_8bit,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_qprintdec,
- mbfl_filt_conv_qprintdec_flush };
-
-static const struct mbfl_convert_vtbl vtbl_8bit_7bit = {
- mbfl_no_encoding_8bit,
- mbfl_no_encoding_7bit,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_any_7bit,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_7bit_8bit = {
- mbfl_no_encoding_7bit,
- mbfl_no_encoding_8bit,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_pass,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_ucs4_wchar = {
- mbfl_no_encoding_ucs4,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_ucs4_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_ucs4 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_ucs4,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs4be,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_ucs4be_wchar = {
- mbfl_no_encoding_ucs4be,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte4be_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_ucs4be = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_ucs4be,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs4be,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_ucs4le_wchar = {
- mbfl_no_encoding_ucs4le,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte4le_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_ucs4le = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_ucs4le,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs4le,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_ucs2_wchar = {
- mbfl_no_encoding_ucs2,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_ucs2_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_ucs2 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_ucs2,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs2be,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_ucs2be_wchar = {
- mbfl_no_encoding_ucs2be,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte2be_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_ucs2be = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_ucs2be,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs2be,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_ucs2le_wchar = {
- mbfl_no_encoding_ucs2le,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte2le_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_ucs2le = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_ucs2le,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs2le,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_utf32_wchar = {
- mbfl_no_encoding_utf32,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_ucs4_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_utf32 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf32,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs4be,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_utf32be_wchar = {
- mbfl_no_encoding_utf32be,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte4be_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_utf32be = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf32be,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs4be,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_utf32le_wchar = {
- mbfl_no_encoding_utf32le,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte4le_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_utf32le = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf32le,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs4le,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_utf16_wchar = {
- mbfl_no_encoding_utf16,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_utf16_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_utf16 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf16,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_utf16be,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_utf16be_wchar = {
- mbfl_no_encoding_utf16be,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_utf16be_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_utf16be = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf16be,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_utf16be,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_utf16le_wchar = {
- mbfl_no_encoding_utf16le,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_utf16le_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_utf16le = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf16le,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_utf16le,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_utf8_wchar = {
- mbfl_no_encoding_utf8,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_utf8_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf8,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_utf8,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_utf7_wchar = {
- mbfl_no_encoding_utf7,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_utf7_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_utf7 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf7,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_utf7,
- mbfl_filt_conv_wchar_utf7_flush };
-
-static const struct mbfl_convert_vtbl vtbl_utf7imap_wchar = {
- mbfl_no_encoding_utf7imap,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_utf7imap_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_utf7imap = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf7imap,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_utf7imap,
- mbfl_filt_conv_wchar_utf7imap_flush };
-
-static const struct mbfl_convert_vtbl vtbl_ascii_wchar = {
- mbfl_no_encoding_ascii,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_pass,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_ascii = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_ascii,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ascii,
- mbfl_filt_conv_common_flush };
-
-#if defined(HAVE_MBSTR_JA)
-static const struct mbfl_convert_vtbl vtbl_eucjp_wchar = {
- mbfl_no_encoding_euc_jp,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_eucjp_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_eucjp = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_euc_jp,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_eucjp,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_sjis_wchar = {
- mbfl_no_encoding_sjis,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_sjis_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_sjis = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_sjis,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_sjis,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_jis_wchar = {
- mbfl_no_encoding_jis,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_jis_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_jis = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_jis,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_jis,
- mbfl_filt_conv_any_jis_flush };
-
-static const struct mbfl_convert_vtbl vtbl_2022jp_wchar = {
- mbfl_no_encoding_2022jp,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_jis_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_2022jp = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_2022jp,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_2022jp,
- mbfl_filt_conv_any_jis_flush };
-
-static const struct mbfl_convert_vtbl vtbl_eucjpwin_wchar = {
- mbfl_no_encoding_eucjp_win,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_eucjpwin_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_eucjpwin = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_eucjp_win,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_eucjpwin,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_sjiswin_wchar = {
- mbfl_no_encoding_sjis_win,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_sjiswin_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_sjiswin = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_sjis_win,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_sjiswin,
- mbfl_filt_conv_common_flush };
-#endif /* HAVE_MBSTR_JA */
-
-#if defined(HAVE_MBSTR_CN)
-static const struct mbfl_convert_vtbl vtbl_euccn_wchar = {
- mbfl_no_encoding_euc_cn,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_euccn_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_euccn = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_euc_cn,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_euccn,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_cp936_wchar = {
- mbfl_no_encoding_cp936,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_cp936_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_cp936 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_cp936,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_cp936,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_hz_wchar = {
- mbfl_no_encoding_hz,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_hz_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_hz = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_hz,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_hz,
- mbfl_filt_conv_any_hz_flush };
-
-#endif /* HAVE_MBSTR_CN */
-
-#if defined(HAVE_MBSTR_TW)
-static const struct mbfl_convert_vtbl vtbl_euctw_wchar = {
- mbfl_no_encoding_euc_tw,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_euctw_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_euctw = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_euc_tw,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_euctw,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_big5_wchar = {
- mbfl_no_encoding_big5,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_big5_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_big5 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_big5,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_big5,
- mbfl_filt_conv_common_flush };
-#endif /* HAVE_MBSTR_TW */
-
-#if defined(HAVE_MBSTR_KR)
-static const struct mbfl_convert_vtbl vtbl_euckr_wchar = {
- mbfl_no_encoding_euc_kr,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_euckr_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_euckr = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_euc_kr,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_euckr,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_uhc_wchar = {
- mbfl_no_encoding_uhc,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_uhc_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_uhc = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_uhc,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_uhc,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_2022kr = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_2022kr,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_2022kr,
- mbfl_filt_conv_any_2022kr_flush };
-
-static const struct mbfl_convert_vtbl vtbl_2022kr_wchar = {
- mbfl_no_encoding_2022kr,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_2022kr_wchar,
- mbfl_filt_conv_common_flush };
-#endif /* HAVE_MBSTR_KR */
-
-#if defined(HAVE_MBSTR_RU)
-static const struct mbfl_convert_vtbl vtbl_wchar_cp1251 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_cp1251,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_cp1251,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_cp1251_wchar = {
- mbfl_no_encoding_cp1251,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_cp1251_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_cp866 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_cp866,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_cp866,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_cp866_wchar = {
- mbfl_no_encoding_cp866,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_cp866_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_koi8r = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_koi8r,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_koi8r,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_koi8r_wchar = {
- mbfl_no_encoding_koi8r,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_koi8r_wchar,
- mbfl_filt_conv_common_flush };
-#endif /* HAVE_MBSTR_RU */
-
-static const struct mbfl_convert_vtbl vtbl_cp1252_wchar = {
- mbfl_no_encoding_cp1252,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_cp1252_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_cp1252 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_cp1252,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_cp1252,
- mbfl_filt_conv_common_flush };
-
-
-static const struct mbfl_convert_vtbl vtbl_8859_1_wchar = {
- mbfl_no_encoding_8859_1,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_pass,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_8859_1 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_1,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_1,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_8859_2_wchar = {
- mbfl_no_encoding_8859_2,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_2_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_8859_2 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_2,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_2,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_8859_3_wchar = {
- mbfl_no_encoding_8859_3,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_3_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_8859_3 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_3,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_3,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_8859_4_wchar = {
- mbfl_no_encoding_8859_4,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_4_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_8859_4 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_4,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_4,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_8859_5_wchar = {
- mbfl_no_encoding_8859_5,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_5_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_8859_5 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_5,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_5,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_8859_6_wchar = {
- mbfl_no_encoding_8859_6,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_6_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_8859_6 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_6,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_6,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_8859_7_wchar = {
- mbfl_no_encoding_8859_7,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_7_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_8859_7 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_7,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_7,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_8859_8_wchar = {
- mbfl_no_encoding_8859_8,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_8_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_8859_8 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_8,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_8,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_8859_9_wchar = {
- mbfl_no_encoding_8859_9,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_9_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_8859_9 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_9,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_9,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_8859_10_wchar = {
- mbfl_no_encoding_8859_10,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_10_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_8859_10 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_10,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_10,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_8859_13_wchar = {
- mbfl_no_encoding_8859_13,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_13_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_8859_13 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_13,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_13,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_8859_14_wchar = {
- mbfl_no_encoding_8859_14,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_14_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_8859_14 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_14,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_14,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_8859_15_wchar = {
- mbfl_no_encoding_8859_15,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_15_wchar,
- mbfl_filt_conv_common_flush };
-
-static const struct mbfl_convert_vtbl vtbl_wchar_8859_15 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_15,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_15,
- mbfl_filt_conv_common_flush };
-
-
-static const struct mbfl_convert_vtbl *mbfl_convert_filter_list[] = {
- &vtbl_utf8_wchar,
- &vtbl_wchar_utf8,
-#if defined(HAVE_MBSTR_JA)
- &vtbl_eucjp_wchar,
- &vtbl_wchar_eucjp,
- &vtbl_sjis_wchar,
- &vtbl_wchar_sjis,
- &vtbl_jis_wchar,
- &vtbl_wchar_jis,
- &vtbl_2022jp_wchar,
- &vtbl_wchar_2022jp,
- &vtbl_eucjpwin_wchar,
- &vtbl_wchar_eucjpwin,
- &vtbl_sjiswin_wchar,
- &vtbl_wchar_sjiswin,
-#endif
-#if defined(HAVE_MBSTR_CN)
- &vtbl_euccn_wchar,
- &vtbl_wchar_euccn,
- &vtbl_cp936_wchar,
- &vtbl_wchar_cp936,
- &vtbl_hz_wchar,
- &vtbl_wchar_hz,
-#endif
-#if defined(HAVE_MBSTR_TW)
- &vtbl_euctw_wchar,
- &vtbl_wchar_euctw,
- &vtbl_big5_wchar,
- &vtbl_wchar_big5,
-#endif
-#if defined(HAVE_MBSTR_KR)
- &vtbl_euckr_wchar,
- &vtbl_wchar_euckr,
- &vtbl_uhc_wchar,
- &vtbl_wchar_uhc,
- &vtbl_2022kr_wchar,
- &vtbl_wchar_2022kr,
-#endif
-#if defined(HAVE_MBSTR_RU)
- &vtbl_cp1251_wchar,
- &vtbl_wchar_cp1251,
- &vtbl_cp866_wchar,
- &vtbl_wchar_cp866,
- &vtbl_koi8r_wchar,
- &vtbl_wchar_koi8r,
-#endif
- &vtbl_cp1252_wchar,
- &vtbl_wchar_cp1252,
- &vtbl_ascii_wchar,
- &vtbl_wchar_ascii,
- &vtbl_8859_1_wchar,
- &vtbl_wchar_8859_1,
- &vtbl_8859_2_wchar,
- &vtbl_wchar_8859_2,
- &vtbl_8859_3_wchar,
- &vtbl_wchar_8859_3,
- &vtbl_8859_4_wchar,
- &vtbl_wchar_8859_4,
- &vtbl_8859_5_wchar,
- &vtbl_wchar_8859_5,
- &vtbl_8859_6_wchar,
- &vtbl_wchar_8859_6,
- &vtbl_8859_7_wchar,
- &vtbl_wchar_8859_7,
- &vtbl_8859_8_wchar,
- &vtbl_wchar_8859_8,
- &vtbl_8859_9_wchar,
- &vtbl_wchar_8859_9,
- &vtbl_8859_10_wchar,
- &vtbl_wchar_8859_10,
- &vtbl_8859_13_wchar,
- &vtbl_wchar_8859_13,
- &vtbl_8859_14_wchar,
- &vtbl_wchar_8859_14,
- &vtbl_8859_15_wchar,
- &vtbl_wchar_8859_15,
- &vtbl_8bit_b64,
- &vtbl_b64_8bit,
- &vtbl_uuencode_8bit,
- &vtbl_wchar_html,
- &vtbl_html_wchar,
- &vtbl_8bit_qprint,
- &vtbl_qprint_8bit,
- &vtbl_8bit_7bit,
- &vtbl_7bit_8bit,
- &vtbl_utf7_wchar,
- &vtbl_wchar_utf7,
- &vtbl_utf7imap_wchar,
- &vtbl_wchar_utf7imap,
- &vtbl_utf16_wchar,
- &vtbl_wchar_utf16,
- &vtbl_utf16be_wchar,
- &vtbl_wchar_utf16be,
- &vtbl_utf16le_wchar,
- &vtbl_wchar_utf16le,
- &vtbl_utf32_wchar,
- &vtbl_wchar_utf32,
- &vtbl_utf32be_wchar,
- &vtbl_wchar_utf32be,
- &vtbl_utf32le_wchar,
- &vtbl_wchar_utf32le,
- &vtbl_ucs4_wchar,
- &vtbl_wchar_ucs4,
- &vtbl_ucs4be_wchar,
- &vtbl_wchar_ucs4be,
- &vtbl_ucs4le_wchar,
- &vtbl_wchar_ucs4le,
- &vtbl_ucs2_wchar,
- &vtbl_wchar_ucs2,
- &vtbl_ucs2be_wchar,
- &vtbl_wchar_ucs2be,
- &vtbl_ucs2le_wchar,
- &vtbl_wchar_ucs2le,
- &vtbl_byte4be_wchar,
- &vtbl_wchar_byte4be,
- &vtbl_byte4le_wchar,
- &vtbl_wchar_byte4le,
- &vtbl_byte2be_wchar,
- &vtbl_wchar_byte2be,
- &vtbl_byte2le_wchar,
- &vtbl_wchar_byte2le,
- &vtbl_pass,
- NULL
-};
-
-
-/* identify filter function table */
-static const struct mbfl_identify_vtbl vtbl_identify_ascii = {
- mbfl_no_encoding_ascii,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_ascii };
-
-static const struct mbfl_identify_vtbl vtbl_identify_utf8 = {
- mbfl_no_encoding_utf8,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_utf8 };
-
-static const struct mbfl_identify_vtbl vtbl_identify_utf7 = {
- mbfl_no_encoding_utf7,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_utf7 };
-
-#if defined(HAVE_MBSTR_JA)
-static const struct mbfl_identify_vtbl vtbl_identify_eucjp = {
- mbfl_no_encoding_euc_jp,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_eucjp };
-
-static const struct mbfl_identify_vtbl vtbl_identify_eucjpwin = {
- mbfl_no_encoding_eucjp_win,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_eucjp };
-
-static const struct mbfl_identify_vtbl vtbl_identify_sjis = {
- mbfl_no_encoding_sjis,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_sjis };
-
-static const struct mbfl_identify_vtbl vtbl_identify_sjiswin = {
- mbfl_no_encoding_sjis_win,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_sjiswin };
-
-static const struct mbfl_identify_vtbl vtbl_identify_jis = {
- mbfl_no_encoding_jis,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_jis };
-
-static const struct mbfl_identify_vtbl vtbl_identify_2022jp = {
- mbfl_no_encoding_2022jp,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_2022jp };
-#endif /* HAVE_MBSTR_JA */
-
-#if defined(HAVE_MBSTR_CN)
-static struct mbfl_identify_vtbl vtbl_identify_euccn = {
- mbfl_no_encoding_euc_cn,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_euccn };
-
-static struct mbfl_identify_vtbl vtbl_identify_cp936 = {
- mbfl_no_encoding_cp936,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_cp936 };
-
-static struct mbfl_identify_vtbl vtbl_identify_hz = {
- mbfl_no_encoding_hz,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_hz };
-
-#endif /* HAVE_MBSTR_CN */
-
-#if defined(HAVE_MBSTR_TW)
-static struct mbfl_identify_vtbl vtbl_identify_euctw = {
- mbfl_no_encoding_euc_tw,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_euctw };
-
-static struct mbfl_identify_vtbl vtbl_identify_big5 = {
- mbfl_no_encoding_big5,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_big5 };
-#endif /* HAVE_MBSTR_TW */
-
-#if defined(HAVE_MBSTR_KR)
-static struct mbfl_identify_vtbl vtbl_identify_euckr = {
- mbfl_no_encoding_euc_kr,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_euckr };
-
-static struct mbfl_identify_vtbl vtbl_identify_uhc = {
- mbfl_no_encoding_uhc,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_uhc };
-
-static struct mbfl_identify_vtbl vtbl_identify_2022kr = {
- mbfl_no_encoding_2022kr,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_2022kr };
-
-#endif /* HAVE_MBSTR_KR */
-
-#if defined(HAVE_MBSTR_RU)
-static struct mbfl_identify_vtbl vtbl_identify_cp1251 = {
- mbfl_no_encoding_cp1251,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_cp1251 };
-
-static struct mbfl_identify_vtbl vtbl_identify_cp866 = {
- mbfl_no_encoding_cp866,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_cp866 };
-
-static struct mbfl_identify_vtbl vtbl_identify_koi8r = {
- mbfl_no_encoding_koi8r,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_koi8r };
-#endif /* HAVE_MBSTR_RU */
-
-static const struct mbfl_identify_vtbl vtbl_identify_cp1252 = {
- mbfl_no_encoding_cp1252,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_cp1252 };
-
-static const struct mbfl_identify_vtbl vtbl_identify_8859_1 = {
- mbfl_no_encoding_8859_1,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static const struct mbfl_identify_vtbl vtbl_identify_8859_2 = {
- mbfl_no_encoding_8859_2,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static const struct mbfl_identify_vtbl vtbl_identify_8859_3 = {
- mbfl_no_encoding_8859_3,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static const struct mbfl_identify_vtbl vtbl_identify_8859_4 = {
- mbfl_no_encoding_8859_4,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static const struct mbfl_identify_vtbl vtbl_identify_8859_5 = {
- mbfl_no_encoding_8859_5,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static const struct mbfl_identify_vtbl vtbl_identify_8859_6 = {
- mbfl_no_encoding_8859_6,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static const struct mbfl_identify_vtbl vtbl_identify_8859_7 = {
- mbfl_no_encoding_8859_7,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static const struct mbfl_identify_vtbl vtbl_identify_8859_8 = {
- mbfl_no_encoding_8859_8,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static const struct mbfl_identify_vtbl vtbl_identify_8859_9 = {
- mbfl_no_encoding_8859_9,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static const struct mbfl_identify_vtbl vtbl_identify_8859_10 = {
- mbfl_no_encoding_8859_10,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static const struct mbfl_identify_vtbl vtbl_identify_8859_13 = {
- mbfl_no_encoding_8859_13,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static const struct mbfl_identify_vtbl vtbl_identify_8859_14 = {
- mbfl_no_encoding_8859_14,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static const struct mbfl_identify_vtbl vtbl_identify_8859_15 = {
- mbfl_no_encoding_8859_15,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static const struct mbfl_identify_vtbl vtbl_identify_false = {
- mbfl_no_encoding_pass,
- mbfl_filt_ident_false_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_false };
-
-static const struct mbfl_identify_vtbl *mbfl_identify_filter_list[] = {
- &vtbl_identify_utf8,
- &vtbl_identify_utf7,
- &vtbl_identify_ascii,
-#if defined(HAVE_MBSTR_JA)
- &vtbl_identify_eucjp,
- &vtbl_identify_sjis,
- &vtbl_identify_eucjpwin,
- &vtbl_identify_sjiswin,
- &vtbl_identify_jis,
- &vtbl_identify_2022jp,
-#endif
-#if defined(HAVE_MBSTR_CN)
- &vtbl_identify_euccn,
- &vtbl_identify_cp936,
- &vtbl_identify_hz,
-#endif
-#if defined(HAVE_MBSTR_TW)
- &vtbl_identify_euctw,
- &vtbl_identify_big5,
-#endif
-#if defined(HAVE_MBSTR_KR)
- &vtbl_identify_euckr,
- &vtbl_identify_uhc,
- &vtbl_identify_2022kr,
-#endif
-#if defined(HAVE_MBSTR_RU)
- &vtbl_identify_cp1251,
- &vtbl_identify_cp866,
- &vtbl_identify_koi8r,
-#endif
- &vtbl_identify_cp1252,
- &vtbl_identify_8859_1,
- &vtbl_identify_8859_2,
- &vtbl_identify_8859_3,
- &vtbl_identify_8859_4,
- &vtbl_identify_8859_5,
- &vtbl_identify_8859_6,
- &vtbl_identify_8859_7,
- &vtbl_identify_8859_8,
- &vtbl_identify_8859_9,
- &vtbl_identify_8859_10,
- &vtbl_identify_8859_13,
- &vtbl_identify_8859_14,
- &vtbl_identify_8859_15,
- &vtbl_identify_false,
- NULL
-};
-
-
-/* language resolver */
-const mbfl_language *
-mbfl_name2language(const char *name)
-{
- const mbfl_language *language;
- int i, j;
-
- if (name == NULL) {
- return NULL;
- }
-
- i = 0;
- while ((language = mbfl_language_ptr_table[i++]) != NULL){
- if (strcasecmp(language->name, name) == 0) {
- return language;
- }
- }
-
- i = 0;
- while ((language = mbfl_language_ptr_table[i++]) != NULL){
- if (strcasecmp(language->short_name, name) == 0) {
- return language;
- }
- }
-
- /* serch aliases */
- i = 0;
- while ((language = mbfl_language_ptr_table[i++]) != NULL) {
- if (language->aliases != NULL) {
- j = 0;
- while ((*language->aliases)[j] != NULL) {
- if (strcasecmp((*language->aliases)[j], name) == 0) {
- return language;
- }
- j++;
- }
- }
- }
-
- return NULL;
-}
-
-const mbfl_language *
-mbfl_no2language(enum mbfl_no_language no_language)
-{
- const mbfl_language *language;
- int i;
-
- i = 0;
- while ((language = mbfl_language_ptr_table[i++]) != NULL){
- if (language->no_language == no_language) {
- return language;
- }
- }
-
- return NULL;
-}
-
-enum mbfl_no_language
-mbfl_name2no_language(const char *name)
-{
- const mbfl_language *language;
-
- language = mbfl_name2language(name);
- if (language == NULL) {
- return mbfl_no_language_invalid;
- } else {
- return language->no_language;
- }
-}
-
-const char *
-mbfl_no_language2name(enum mbfl_no_language no_language)
-{
- const mbfl_language *language;
-
- language = mbfl_no2language(no_language);
- if (language == NULL) {
- return "";
- } else {
- return language->name;
- }
-}
-
-
-
-/* encoding resolver */
-const mbfl_encoding *
-mbfl_name2encoding(const char *name)
-{
- const mbfl_encoding *encoding;
- int i, j;
-
- if (name == NULL) {
- return NULL;
- }
-
- i = 0;
- while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL){
- if (strcasecmp(encoding->name, name) == 0) {
- return encoding;
- }
- }
-
- /* serch MIME charset name */
- i = 0;
- while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) {
- if (encoding->mime_name != NULL) {
- if (strcasecmp(encoding->mime_name, name) == 0) {
- return encoding;
- }
- }
- }
-
- /* serch aliases */
- i = 0;
- while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) {
- if (encoding->aliases != NULL) {
- j = 0;
- while ((*encoding->aliases)[j] != NULL) {
- if (strcasecmp((*encoding->aliases)[j], name) == 0) {
- return encoding;
- }
- j++;
- }
- }
- }
-
- return NULL;
-}
-
-const mbfl_encoding *
-mbfl_no2encoding(enum mbfl_no_encoding no_encoding)
-{
- const mbfl_encoding *encoding;
- int i;
-
- i = 0;
- while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL){
- if (encoding->no_encoding == no_encoding) {
- return encoding;
- }
- }
-
- return NULL;
-}
-
-enum mbfl_no_encoding
-mbfl_name2no_encoding(const char *name)
-{
- const mbfl_encoding *encoding;
-
- encoding = mbfl_name2encoding(name);
- if (encoding == NULL) {
- return mbfl_no_encoding_invalid;
- } else {
- return encoding->no_encoding;
- }
-}
-
-const char *
-mbfl_no_encoding2name(enum mbfl_no_encoding no_encoding)
-{
- const mbfl_encoding *encoding;
-
- encoding = mbfl_no2encoding(no_encoding);
- if (encoding == NULL) {
- return "";
- } else {
- return encoding->name;
- }
-}
-
-const char *
-mbfl_no2preferred_mime_name(enum mbfl_no_encoding no_encoding)
-{
- const mbfl_encoding *encoding;
-
- encoding = mbfl_no2encoding(no_encoding);
- if (encoding != NULL && encoding->mime_name != NULL && encoding->mime_name[0] != '\0') {
- return encoding->mime_name;
- } else {
- return NULL;
- }
-}
-
-int
-mbfl_is_support_encoding(const char *name)
-{
- const mbfl_encoding *encoding;
-
- encoding = mbfl_name2encoding(name);
- if (encoding == NULL) {
- return 0;
- } else {
- return 1;
- }
-}
-
-
-
-/*
- * memory device output functions
- */
-void
-mbfl_memory_device_init(mbfl_memory_device *device, int initsz, int allocsz TSRMLS_DC)
-{
- if (device) {
- device->length = 0;
- device->buffer = (unsigned char *)0;
- if (initsz > 0) {
- device->buffer = (unsigned char *)mbfl_malloc(initsz*sizeof(unsigned char));
- if (device->buffer != NULL) {
- device->length = initsz;
- }
- }
- device->pos= 0;
- if (allocsz > MBFL_MEMORY_DEVICE_ALLOC_SIZE) {
- device->allocsz = allocsz;
- } else {
- device->allocsz = MBFL_MEMORY_DEVICE_ALLOC_SIZE;
- }
- }
-}
-
-void
-mbfl_memory_device_realloc(mbfl_memory_device *device, int initsz, int allocsz TSRMLS_DC)
-{
- unsigned char *tmp;
-
- if (device) {
- if (initsz > device->length) {
- tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, initsz*sizeof(unsigned char));
- if (tmp != NULL) {
- device->buffer = tmp;
- device->length = initsz;
- }
- }
- if (allocsz > MBFL_MEMORY_DEVICE_ALLOC_SIZE) {
- device->allocsz = allocsz;
- } else {
- device->allocsz = MBFL_MEMORY_DEVICE_ALLOC_SIZE;
- }
- }
-}
-
-void
-mbfl_memory_device_clear(mbfl_memory_device *device TSRMLS_DC)
-{
- if (device) {
- if (device->buffer) {
- mbfl_free(device->buffer);
- }
- device->buffer = (unsigned char *)0;
- device->length = 0;
- device->pos = 0;
- }
-}
-
-void
-mbfl_memory_device_reset(mbfl_memory_device *device TSRMLS_DC)
-{
- if (device) {
- device->pos = 0;
- }
-}
-
-void
-mbfl_memory_device_unput(mbfl_memory_device *device TSRMLS_DC)
-{
- if (device->pos > 0) {
- device->pos--;
- }
-}
-
-mbfl_string *
-mbfl_memory_device_result(mbfl_memory_device *device, mbfl_string *result TSRMLS_DC)
-{
- if (device && result) {
- result->len = device->pos;
- mbfl_memory_device_output4('\0', device TSRMLS_CC);
- result->val = device->buffer;
- device->buffer = (unsigned char *)0;
- device->length = 0;
- device->pos= 0;
- if (result->val == NULL) {
- result->len = 0;
- result = NULL;
- }
- } else {
- result = NULL;
- }
-
- return result;
-}
-
-int
-mbfl_memory_device_output(int c, void *data TSRMLS_DC)
-{
- mbfl_memory_device *device = (mbfl_memory_device *)data;
-
- if (device->pos >= device->length) {
- /* reallocate buffer */
- int newlen;
- unsigned char *tmp;
-
- newlen = device->length + device->allocsz;
- tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
- if (tmp == NULL) {
- return -1;
- }
- device->length = newlen;
- device->buffer = tmp;
- }
-
- device->buffer[device->pos++] = (unsigned char)c;
- return c;
-}
-
-int
-mbfl_memory_device_output2(int c, void *data TSRMLS_DC)
-{
- mbfl_memory_device *device = (mbfl_memory_device *)data;
-
- if ((device->pos + 2) >= device->length) {
- /* reallocate buffer */
- int newlen;
- unsigned char *tmp;
-
- newlen = device->length + device->allocsz;
- tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
- if (tmp == NULL) {
- return -1;
- }
- device->length = newlen;
- device->buffer = tmp;
- }
-
- device->buffer[device->pos++] = (unsigned char)((c >> 8) & 0xff);
- device->buffer[device->pos++] = (unsigned char)(c & 0xff);
-
- return c;
-}
-
-int
-mbfl_memory_device_output4(int c, void* data TSRMLS_DC)
-{
- mbfl_memory_device *device = (mbfl_memory_device *)data;
-
- if ((device->pos + 4) >= device->length) {
- /* reallocate buffer */
- int newlen;
- unsigned char *tmp;
-
- newlen = device->length + device->allocsz;
- tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
- if (tmp == NULL) {
- return -1;
- }
- device->length = newlen;
- device->buffer = tmp;
- }
-
- device->buffer[device->pos++] = (unsigned char)((c >> 24) & 0xff);
- device->buffer[device->pos++] = (unsigned char)((c >> 16) & 0xff);
- device->buffer[device->pos++] = (unsigned char)((c >> 8) & 0xff);
- device->buffer[device->pos++] = (unsigned char)(c & 0xff);
-
- return c;
-}
-
-int
-mbfl_memory_device_strcat(mbfl_memory_device *device, const char *psrc TSRMLS_DC)
-{
- int len;
- unsigned char *w;
- const unsigned char *p;
-
- len = 0;
- p = (const unsigned char *)psrc;
- while (*p) {
- p++;
- len++;
- }
-
- if ((device->pos + len) >= device->length) {
- /* reallocate buffer */
- int newlen = device->length + (len + MBFL_MEMORY_DEVICE_ALLOC_SIZE)*sizeof(unsigned char);
- unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
- if (tmp == NULL) {
- return -1;
- }
- device->length = newlen;
- device->buffer = tmp;
- }
-
- p = (const unsigned char *)psrc;
- w = &device->buffer[device->pos];
- device->pos += len;
- while (len > 0) {
- *w++ = *p++;
- len--;
- }
-
- return len;
-}
-
-int
-mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, int len TSRMLS_DC)
-{
- unsigned char *w;
-
- if ((device->pos + len) >= device->length) {
- /* reallocate buffer */
- int newlen = device->length + len + MBFL_MEMORY_DEVICE_ALLOC_SIZE;
- unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
- if (tmp == NULL) {
- return -1;
- }
- device->length = newlen;
- device->buffer = tmp;
- }
-
- w = &device->buffer[device->pos];
- device->pos += len;
- while (len > 0) {
- *w++ = *psrc++;
- len--;
- }
-
- return len;
-}
-
-int
-mbfl_memory_device_devcat(mbfl_memory_device *dest, mbfl_memory_device *src TSRMLS_DC)
-{
- int n;
- unsigned char *p, *w;
-
- if ((dest->pos + src->pos) >= dest->length) {
- /* reallocate buffer */
- int newlen = dest->length + src->pos + MBFL_MEMORY_DEVICE_ALLOC_SIZE;
- unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)dest->buffer, newlen*sizeof(unsigned char));
- if (tmp == NULL) {
- return -1;
- }
- dest->length = newlen;
- dest->buffer = tmp;
- }
-
- p = src->buffer;
- w = &dest->buffer[dest->pos];
- n = src->pos;
- dest->pos += n;
- while (n > 0) {
- *w++ = *p++;
- n--;
- }
-
- return n;
-}
-
-void
-mbfl_wchar_device_init(mbfl_wchar_device *device TSRMLS_DC)
-{
- if (device) {
- device->buffer = (unsigned int *)0;
- device->length = 0;
- device->pos= 0;
- device->allocsz = MBFL_MEMORY_DEVICE_ALLOC_SIZE;
- }
-}
-
-void
-mbfl_wchar_device_clear(mbfl_wchar_device *device TSRMLS_DC)
-{
- if (device) {
- if (device->buffer) {
- mbfl_free(device->buffer);
- }
- device->buffer = (unsigned int*)0;
- device->length = 0;
- device->pos = 0;
- }
-}
-
-int
-mbfl_wchar_device_output(int c, void *data TSRMLS_DC)
-{
- mbfl_wchar_device *device = (mbfl_wchar_device *)data;
-
- if (device->pos >= device->length) {
- /* reallocate buffer */
- int newlen;
- unsigned int *tmp;
-
- newlen = device->length + device->allocsz;
- tmp = (unsigned int *)mbfl_realloc((void *)device->buffer, newlen*sizeof(int));
- if (tmp == NULL) {
- return -1;
- }
- device->length = newlen;
- device->buffer = tmp;
- }
-
- device->buffer[device->pos++] = c;
-
- return c;
-}
-
-
-/*
- * string object
- */
-void
-mbfl_string_init(mbfl_string *string)
-{
- if (string) {
- string->no_language = mbfl_no_language_uni;
- string->no_encoding = mbfl_no_encoding_pass;
- string->val = (unsigned char*)0;
- string->len = 0;
- }
-}
-
-void
-mbfl_string_init_set(mbfl_string *string, enum mbfl_no_language no_language, enum mbfl_no_encoding no_encoding)
-{
- if (string) {
- string->no_language = no_language;
- string->no_encoding = no_encoding;
- string->val = (unsigned char*)0;
- string->len = 0;
- }
-}
-
-void
-mbfl_string_clear(mbfl_string *string)
-{
- if (string) {
- if (string->val != (unsigned char*)0) {
- mbfl_free(string->val);
- }
- string->val = (unsigned char*)0;
- string->len = 0;
- }
-}
-
-
-
-/*
- * encoding filter
- */
-#define CK(statement) do { if ((statement) < 0) return (-1); } while (0)
-
-/*
- * commonly used constructor and destructor
- */
-static void
-mbfl_filt_conv_common_ctor(mbfl_convert_filter *filter TSRMLS_DC)
-{
- filter->status = 0;
- filter->cache = 0;
-}
-
-static int
-mbfl_filt_conv_common_flush(mbfl_convert_filter *filter TSRMLS_DC)
-{
- filter->status = 0;
- filter->cache = 0;
- return 0;
-}
-
-static void
-mbfl_filt_conv_common_dtor(mbfl_convert_filter *filter TSRMLS_DC)
-{
- filter->status = 0;
- filter->cache = 0;
-}
-
-static int
-mbfl_filt_conv_pass(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- return (*filter->output_function)(c, filter->data TSRMLS_CC);
-}
-
-static int
-mbfl_filt_conv_any_7bit(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- if (c >= 0 && c < 0x80) {
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- }
- return c;
-}
-
-static int
-mbfl_filt_conv_byte2be_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int n;
-
- if (filter->status == 0) {
- filter->status = 1;
- n = (c & 0xff) << 8;
- filter->cache = n;
- } else {
- filter->status = 0;
- n = (c & 0xff) | filter->cache;
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- }
- return c;
-}
-
-static int
-mbfl_filt_conv_wchar_byte2be(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC));
- return c;
-}
-
-static int
-mbfl_filt_conv_byte2le_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int n;
-
- if (filter->status == 0) {
- filter->status = 1;
- n = c & 0xff;
- filter->cache = n;
- } else {
- filter->status = 0;
- n = ((c & 0xff) << 8) | filter->cache;
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- }
- return c;
-}
-
-static int
-mbfl_filt_conv_wchar_byte2le(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC));
- return c;
-}
-
-static int
-mbfl_filt_conv_byte4be_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int n;
-
- if (filter->status == 0) {
- filter->status = 1;
- n = (c & 0xff) << 24;
- filter->cache = n;
- } else if (filter->status == 1) {
- filter->status = 2;
- n = (c & 0xff) << 16;
- filter->cache |= n;
- } else if (filter->status == 2) {
- filter->status = 3;
- n = (c & 0xff) << 8;
- filter->cache |= n;
- } else {
- filter->status = 0;
- n = (c & 0xff) | filter->cache;
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- }
- return c;
-}
-
-static int
-mbfl_filt_conv_wchar_byte4be(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- CK((*filter->output_function)((c >> 24) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c >> 16) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC));
- return c;
-}
-
-static int
-mbfl_filt_conv_byte4le_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int n;
-
- if (filter->status == 0) {
- filter->status = 1;
- n = (c & 0xff);
- filter->cache = n;
- } else if (filter->status == 1) {
- filter->status = 2;
- n = (c & 0xff) << 8;
- filter->cache |= n;
- } else if (filter->status == 2) {
- filter->status = 3;
- n = (c & 0xff) << 16;
- filter->cache |= n;
- } else {
- filter->status = 0;
- n = ((c & 0xff) << 24) | filter->cache;
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- }
- return c;
-}
-
-static int
-mbfl_filt_conv_wchar_byte4le(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c >> 16) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c >> 24) & 0xff, filter->data TSRMLS_CC));
- return c;
-}
-
-
-/* uuencode => any */
-#define UUDEC(c) (char)(((c)-' ')&077)
-static const char * uuenc_begin_text = "begin ";
-enum { uudec_state_ground=0, uudec_state_inbegin,
- uudec_state_until_newline,
- uudec_state_size, uudec_state_a, uudec_state_b, uudec_state_c, uudec_state_d,
- uudec_state_skip_newline};
-static int
-mbfl_filt_conv_uudec(int c, mbfl_convert_filter * filter TSRMLS_DC)
-{
- int n;
-
- switch(filter->status) {
- case uudec_state_ground:
- /* looking for "begin 0666 filename\n" line */
- if (filter->cache == 0 && c == 'b')
- {
- filter->status = uudec_state_inbegin;
- filter->cache = 1; /* move to 'e' */
- }
- else if (c == '\n')
- filter->cache = 0;
- else
- filter->cache++;
- break;
- case uudec_state_inbegin:
- if (uuenc_begin_text[filter->cache++] != c) {
- /* doesn't match pattern */
- filter->status = uudec_state_ground;
- break;
- }
- if (filter->cache == 5)
- {
- /* thats good enough - wait for a newline */
- filter->status = uudec_state_until_newline;
- filter->cache = 0;
- }
- break;
- case uudec_state_until_newline:
- if (c == '\n')
- filter->status = uudec_state_size;
- break;
- case uudec_state_size:
- /* get "size" byte */
- n = UUDEC(c);
- filter->cache = n << 24;
- filter->status = uudec_state_a;
- break;
- case uudec_state_a:
- /* get "a" byte */
- n = UUDEC(c);
- filter->cache |= (n << 16);
- filter->status = uudec_state_b;
- break;
- case uudec_state_b:
- /* get "b" byte */
- n = UUDEC(c);
- filter->cache |= (n << 8);
- filter->status = uudec_state_c;
- break;
- case uudec_state_c:
- /* get "c" byte */
- n = UUDEC(c);
- filter->cache |= n;
- filter->status = uudec_state_d;
- break;
- case uudec_state_d:
- /* get "d" byte */
- {
- int A, B, C, D = UUDEC(c);
- A = (filter->cache >> 16) & 0xff;
- B = (filter->cache >> 8) & 0xff;
- C = (filter->cache) & 0xff;
- n = (filter->cache >> 24) & 0xff;
- if (n-- > 0)
- CK((*filter->output_function)( (A << 2) | (B >> 4), filter->data TSRMLS_CC));
- if (n-- > 0)
- CK((*filter->output_function)( (B << 4) | (C >> 2), filter->data TSRMLS_CC));
- if (n-- > 0)
- CK((*filter->output_function)( (C << 6) | D, filter->data TSRMLS_CC));
- filter->cache = n << 24;
-
- if (n == 0)
- filter->status = uudec_state_skip_newline; /* skip next byte (newline) */
- else
- filter->status = uudec_state_a; /* go back to fetch "A" byte */
- }
- break;
- case uudec_state_skip_newline:
- /* skip newline */
- filter->status = uudec_state_size;
- }
- return c;
-}
-
-/*
- * any => BASE64
- */
-static const unsigned char mbfl_base64_table[] =
-{
- /* 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', */
- 0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,
- /* 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', */
- 0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,
- /* 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', */
- 0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,
- /* 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', */
- 0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,
- /* '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '\0' */
- 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x2b,0x2f,0x00
-};
-
-#define MBFL_BASE64_STS_MIME_HEADER 0x1000000
-
-static int
-mbfl_filt_conv_base64enc(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int n;
-
- n = (filter->status & 0xff);
- if (n == 0) {
- filter->status++;
- filter->cache = (c & 0xff) << 16;
- } else if (n == 1) {
- filter->status++;
- filter->cache |= (c & 0xff) << 8;
- } else {
- filter->status &= ~0xff;
- if ((filter->status & MBFL_BASE64_STS_MIME_HEADER) == 0) {
- n = (filter->status & 0xff00) >> 8;
- if (n > 72) {
- CK((*filter->output_function)(0x0d, filter->data TSRMLS_CC)); /* CR */
- CK((*filter->output_function)(0x0a, filter->data TSRMLS_CC)); /* LF */
- filter->status &= ~0xff00;
- }
- filter->status += 0x400;
- }
- n = filter->cache | (c & 0xff);
- CK((*filter->output_function)(mbfl_base64_table[(n >> 18) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[(n >> 12) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[(n >> 6) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[n & 0x3f], filter->data TSRMLS_CC));
- }
-
- return c;
-}
-
-static int
-mbfl_filt_conv_base64enc_flush(mbfl_convert_filter *filter TSRMLS_DC)
-{
- int status, cache, len;
-
- status = filter->status & 0xff;
- cache = filter->cache;
- len = (filter->status & 0xff00) >> 8;
- filter->status &= ~0xffff;
- filter->cache = 0;
- /* flush fragments */
- if (status >= 1) {
- if ((filter->status & MBFL_BASE64_STS_MIME_HEADER) == 0) {
- if (len > 72){
- CK((*filter->output_function)(0x0d, filter->data TSRMLS_CC)); /* CR */
- CK((*filter->output_function)(0x0a, filter->data TSRMLS_CC)); /* LF */
- }
- }
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 18) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 12) & 0x3f], filter->data TSRMLS_CC));
- if (status == 1) {
- CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */
- CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */
- } else {
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 6) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */
- }
- }
- return 0;
-}
-
-/*
- * BASE64 => any
- */
-static int
-mbfl_filt_conv_base64dec(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int n;
-
- if (c == 0x0d || c == 0x0a || c == 0x20 || c == 0x09 || c == 0x3d) { /* CR or LF or SPACE or HTAB or '=' */
- return c;
- }
-
- n = 0;
- if (c >= 0x41 && c <= 0x5a) { /* A - Z */
- n = c - 65;
- } else if (c >= 0x61 && c <= 0x7a) { /* a - z */
- n = c - 71;
- } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */
- n = c + 4;
- } else if (c == 0x2b) { /* '+' */
- n = 62;
- } else if (c == 0x2f) { /* '/' */
- n = 63;
- }
- n &= 0x3f;
-
- switch (filter->status) {
- case 0:
- filter->status = 1;
- filter->cache = n << 18;
- break;
- case 1:
- filter->status = 2;
- filter->cache |= n << 12;
- break;
- case 2:
- filter->status = 3;
- filter->cache |= n << 6;
- break;
- default:
- filter->status = 0;
- n |= filter->cache;
- CK((*filter->output_function)((n >> 16) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((n >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(n & 0xff, filter->data TSRMLS_CC));
- break;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_conv_base64dec_flush(mbfl_convert_filter *filter TSRMLS_DC)
-{
- int status, cache;
-
- status = filter->status;
- cache = filter->cache;
- filter->status = 0;
- filter->cache = 0;
- /* flush fragments */
- if (status >= 2) {
- CK((*filter->output_function)((cache >> 16) & 0xff, filter->data TSRMLS_CC));
- if (status >= 3) {
- CK((*filter->output_function)((cache >> 8) & 0xff, filter->data TSRMLS_CC));
- }
- }
- return 0;
-}
-
-/*
- * any => HTML
- */
-static int
-mbfl_filt_conv_html_enc(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int tmp[10];
- int i = 0, p = 0, e;
- unsigned int uc;
-
- if (c<256 && mblen_table_html[c]==1) {
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- /*php_error_docref("ref.mbstring" TSRMLS_CC, E_NOTICE, "mbfl_filt_conv_html_enc(0x%08X = %d)", c, c);*/
- CK((*filter->output_function)('&', filter->data TSRMLS_CC));
- while (1) {
- e = mbfl_html_entity_list[i].code;
- if (c < e || e == -1) {
- break;
- }
- if (c == e) {
- while(mbfl_html_entity_list[i].name[p]) {
- CK((*filter->output_function)((int)mbfl_html_entity_list[i].name[p++], filter->data TSRMLS_CC));
- }
- break;
- }
- i++;
- }
- i=0;
- if (!p) {
- CK((*filter->output_function)('#', filter->data TSRMLS_CC));
- uc = (unsigned int)c;
- do {
- tmp[i++] = '0'+uc%10;
- uc /= 10;
- } while (uc);
- do {
- CK((*filter->output_function)(tmp[--i], filter->data TSRMLS_CC));
- } while (i);
- }
- CK((*filter->output_function)(';', filter->data TSRMLS_CC));
- }
- return c;
-}
-
-static int
-mbfl_filt_conv_html_enc_flush(mbfl_convert_filter *filter TSRMLS_DC)
-{
- filter->status = 0;
- filter->cache = 0;
- return 0;
-}
-
-/*
- * HTML => any
- */
-#define html_enc_buffer_size 16
-static const char html_entity_chars[] = "#0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
-static void
-mbfl_filt_conv_html_dec_ctor(mbfl_convert_filter *filter TSRMLS_DC)
-{
- filter->status = 0;
- filter->cache = (int)mbfl_malloc(html_enc_buffer_size+1);
-}
-
-static void
-mbfl_filt_conv_html_dec_dtor(mbfl_convert_filter *filter TSRMLS_DC)
-{
- filter->status = 0;
- if (filter->cache)
- {
- mbfl_free((void*)filter->cache);
- }
- filter->cache = 0;
-}
-
-static int
-mbfl_filt_conv_html_dec(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int pos, ent = 0;
- const mbfl_html_entity *entity;
- char *buffer = (char*)filter->cache;
-
- if (!filter->status)
- {
- if (c == '&' )
- {
- filter->status = 1;
- buffer[0] = '&';
- }
- else
- {
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- }
- }
- else
- {
- if (c == ';')
- {
- buffer[filter->status] = 0;
- if (buffer[1]=='#')
- {
- /* numeric entity */
- for (pos=2; pos<filter->status; pos++)
- ent = ent*10 + (buffer[pos] - '0');
- CK((*filter->output_function)(ent, filter->data TSRMLS_CC));
- filter->status = 0;
- /*php_error_docref("ref.mbstring" TSRMLS_CC, E_NOTICE, "mbstring decoded '%s'=%d", buffer, ent);*/
- }
- else
- {
- /* named entity */
- entity = mbfl_html_entity_list;
- while (entity->name)
- {
- if (!strcmp(buffer+1, entity->name))
- {
- ent = entity->code;
- break;
- }
- entity++;
- }
- if (ent)
- {
- /* decoded */
- CK((*filter->output_function)(ent, filter->data TSRMLS_CC));
- filter->status = 0;
- /*php_error_docref("ref.mbstring" TSRMLS_CC, E_NOTICE,"mbstring decoded '%s'=%d", buffer, ent);*/
- }
- else
- {
- /* failure */
- buffer[filter->status++] = ';';
- buffer[filter->status] = 0;
- php_error_docref("ref.mbstring" TSRMLS_CC, E_WARNING, "mbstring cannot decode '%s'", buffer);
- mbfl_filt_conv_html_dec_flush(filter TSRMLS_CC);
- }
- }
- }
- else
- {
- /* add character */
- buffer[filter->status++] = c;
- /* add character and check */
- if (!strchr(html_entity_chars, c) || filter->status+1==html_enc_buffer_size || (c=='#' && filter->status>2))
- {
- /* illegal character or end of buffer */
- if (c=='&')
- filter->status--;
- buffer[filter->status] = 0;
- php_error_docref("ref.mbstring" TSRMLS_CC, E_WARNING, "mbstring cannot decode '%s'", buffer);
- mbfl_filt_conv_html_dec_flush(filter TSRMLS_CC);
- if (c=='&')
- {
- filter->status = 1;
- buffer[0] = '&';
- }
- }
- }
- }
- return c;
-}
-
-static int
-mbfl_filt_conv_html_dec_flush(mbfl_convert_filter *filter TSRMLS_DC)
-{
- int status, pos = 0;
- char *buffer;
-
- buffer = (char*)filter->cache;
- status = filter->status;
- /* flush fragments */
- while (status--)
- {
- CK((*filter->output_function)(buffer[pos++], filter->data TSRMLS_CC));
- }
- filter->status = 0;
- /*filter->buffer = 0; of cause NOT*/
- return 0;
-}
-
-/*
- * any => Quoted-Printable
- */
-#define MBFL_QPRINT_STS_MIME_HEADER 0x1000000
-
-static int
-mbfl_filt_conv_qprintenc(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- switch (filter->status & 0xff) {
- case 0:
- filter->cache = c;
- filter->status++;
- break;
- default:
- s = filter->cache;
- filter->cache = c;
- n = (filter->status & 0xff00) >> 8;
-
- if (s == 0) { /* null */
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- filter->status &= ~0xff00;
- break;
- }
-
- if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0) {
- if (s == 0x0a || (s == 0x0d && c != 0x0a)) { /* line feed */
- CK((*filter->output_function)(0x0d, filter->data TSRMLS_CC)); /* CR */
- CK((*filter->output_function)(0x0a, filter->data TSRMLS_CC)); /* LF */
- filter->status &= ~0xff00;
- break;
- } else if (s == 0x0d) {
- break;
- }
- }
-
- if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0 && n >= 72) { /* soft line feed */
- CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */
- CK((*filter->output_function)(0x0d, filter->data TSRMLS_CC)); /* CR */
- CK((*filter->output_function)(0x0a, filter->data TSRMLS_CC)); /* LF */
- filter->status &= ~0xff00;
- }
-
- if (s <= 0 || s >= 0x80 || s == 0x3d /* not ASCII or '=' */
- || ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) != 0 &&
- (mbfl_charprop_table[s] & MBFL_CHP_MMHQENC) != 0)) {
- /* hex-octet */
- CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */
- n = (s >> 4) & 0xf;
- if (n < 10) {
- n += 48; /* '0' */
- } else {
- n += 55; /* 'A' - 10 */
- }
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- n = s & 0xf;
- if (n < 10) {
- n += 48;
- } else {
- n += 55;
- }
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0) {
- filter->status += 0x300;
- }
- } else {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0) {
- filter->status += 0x100;
- }
- }
- break;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_conv_qprintenc_flush(mbfl_convert_filter *filter TSRMLS_DC)
-{
- /* flush filter cache */
- (*filter->filter_function)('\0', filter TSRMLS_CC);
- filter->status &= ~0xffff;
- filter->cache = 0;
- return 0;
-}
-
-/*
- * Quoted-Printable => any
- */
-static int
-mbfl_filt_conv_qprintdec(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int n;
-
- switch (filter->status) {
- case 1:
- if ((c >= 0x30 && c <= 0x39) || (c >= 0x41 && c <= 0x46)) { /* 0 - 9 or A - F */
- filter->cache = c;
- filter->status = 2;
- } else if (c == 0x0d) { /* soft line feed */
- filter->status = 3;
- } else if (c == 0x0a) { /* soft line feed */
- filter->status = 0;
- } else {
- CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- filter->status = 0;
- }
- break;
- case 2:
- n = filter->cache;
- if (n >= 0x30 && n <= 0x39) { /* '0' - '9' */
- n -= 48; /* 48 = '0' */
- } else {
- n -= 55; /* 55 = 'A' - 10 */
- }
- n <<= 4;
- if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */
- n += (c - 48);
- } else if (c >= 0x41 && c <= 0x46) { /* 'A' - 'F' */
- n += (c - 55);
- } else {
- CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */
- CK((*filter->output_function)(filter->cache, filter->data TSRMLS_CC));
- n = c;
- }
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- filter->status = 0;
- break;
- case 3:
- if (c != 0x0a) { /* LF */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- }
- filter->status = 0;
- break;
- default:
- if (c == 0x3d) { /* '=' */
- filter->status = 1;
- } else {
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- }
- break;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_conv_qprintdec_flush(mbfl_convert_filter *filter TSRMLS_DC)
-{
- int status, cache;
-
- status = filter->status;
- cache = filter->cache;
- filter->status = 0;
- filter->cache = 0;
- /* flush fragments */
- if (status == 1) {
- CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */
- } else if (status == 2) {
- CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */
- CK((*filter->output_function)(cache, filter->data TSRMLS_CC));
- }
-
- return 0;
-}
-
-
-/*
- * UCS-4 => wchar
- */
-static int
-mbfl_filt_conv_ucs4_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int n, endian;
-
- endian = filter->status & 0xff00;
- switch (filter->status & 0xff) {
- case 0:
- if (endian) {
- n = c & 0xff;
- } else {
- n = (c & 0xff) << 24;
- }
- filter->cache = n;
- filter->status++;
- break;
- case 1:
- if (endian) {
- n = (c & 0xff) << 8;
- } else {
- n = (c & 0xff) << 16;
- }
- filter->cache |= n;
- filter->status++;
- break;
- case 2:
- if (endian) {
- n = (c & 0xff) << 16;
- } else {
- n = (c & 0xff) << 8;
- }
- filter->cache |= n;
- filter->status++;
- break;
- default:
- if (endian) {
- n = (c & 0xff) << 24;
- } else {
- n = c & 0xff;
- }
- n |= filter->cache;
- if ((n & 0xffff) == 0 && ((n >> 16) & 0xffff) == 0xfffe) {
- if (endian) {
- filter->status = 0; /* big-endian */
- } else {
- filter->status = 0x100; /* little-endian */
- }
- CK((*filter->output_function)(0xfeff, filter->data TSRMLS_CC));
- } else {
- filter->status &= ~0xff;
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- }
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => UCS-4BE
- */
-static int
-mbfl_filt_conv_wchar_ucs4be(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- if (c >= 0 && c < MBFL_WCSGROUP_UCS4MAX) {
- CK((*filter->output_function)((c >> 24) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c >> 16) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * wchar => UCS-4LE
- */
-static int
-mbfl_filt_conv_wchar_ucs4le(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- if (c >= 0 && c < MBFL_WCSGROUP_UCS4MAX) {
- CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c >> 16) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c >> 24) & 0xff, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * UCS-2 => wchar
- */
-static int
-mbfl_filt_conv_ucs2_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int n, endian;
-
- endian = filter->status & 0xff00;
- switch (filter->status & 0xff) {
- case 0:
- if (endian) {
- n = c & 0xff;
- } else {
- n = (c & 0xff) << 8;
- }
- filter->cache = n;
- filter->status++;
- break;
- default:
- if (endian) {
- n = (c & 0xff) << 8;
- } else {
- n = c & 0xff;
- }
- n |= filter->cache;
- if (n == 0xfffe) {
- if (endian) {
- filter->status = 0; /* big-endian */
- } else {
- filter->status = 0x100; /* little-endian */
- }
- CK((*filter->output_function)(0xfeff, filter->data TSRMLS_CC));
- } else {
- filter->status &= ~0xff;
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- }
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => UCS-2BE
- */
-static int
-mbfl_filt_conv_wchar_ucs2be(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) {
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * wchar => UCS-2LE
- */
-static int
-mbfl_filt_conv_wchar_ucs2le(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) {
- CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-
-/*
- * UTF-16 => wchar
- */
-static int
-mbfl_filt_conv_utf16_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int n, endian;
-
- endian = filter->status & 0xff00;
- switch (filter->status & 0xff) {
- case 0:
- if (endian) {
- n = c & 0xff;
- } else {
- n = (c & 0xff) << 8;
- }
- filter->cache |= n;
- filter->status++;
- break;
- default:
- if (endian) {
- n = (c & 0xff) << 8;
- } else {
- n = c & 0xff;
- }
- n |= filter->cache & 0xffff;
- filter->status &= ~0xff;
- if (n == 0xfffe) {
- if (endian) {
- filter->status = 0; /* big-endian */
- } else {
- filter->status = 0x100; /* little-endian */
- }
- CK((*filter->output_function)(0xfeff, filter->data TSRMLS_CC));
- } else if (n >= 0xd800 && n < 0xdc00) {
- filter->cache = ((n & 0x3ff) << 16) + 0x400000;
- } else if (n >= 0xdc00 && n < 0xe000) {
- n &= 0x3ff;
- n |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = 0;
- if (n >= MBFL_WCSPLANE_SUPMIN && n < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- } else { /* illegal character */
- n &= MBFL_WCSGROUP_MASK;
- n |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- }
- } else {
- filter->cache = 0;
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- }
- break;
- }
-
- return c;
-}
-
-/*
- * UTF-16BE => wchar
- */
-static int
-mbfl_filt_conv_utf16be_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int n;
-
- switch (filter->status) {
- case 0:
- filter->status = 1;
- n = (c & 0xff) << 8;
- filter->cache |= n;
- break;
- default:
- filter->status = 0;
- n = (filter->cache & 0xff00) | (c & 0xff);
- if (n >= 0xd800 && n < 0xdc00) {
- filter->cache = ((n & 0x3ff) << 16) + 0x400000;
- } else if (n >= 0xdc00 && n < 0xe000) {
- n &= 0x3ff;
- n |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = 0;
- if (n >= MBFL_WCSPLANE_SUPMIN && n < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- } else { /* illegal character */
- n &= MBFL_WCSGROUP_MASK;
- n |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- }
- } else {
- filter->cache = 0;
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- }
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => UTF-16BE
- */
-static int
-mbfl_filt_conv_wchar_utf16be(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int n;
-
- if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) {
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC));
- } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) {
- n = ((c >> 10) - 0x40) | 0xd800;
- CK((*filter->output_function)((n >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(n & 0xff, filter->data TSRMLS_CC));
- n = (c & 0x3ff) | 0xdc00;
- CK((*filter->output_function)((n >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(n & 0xff, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * UTF-16LE => wchar
- */
-static int
-mbfl_filt_conv_utf16le_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int n;
-
- switch (filter->status) {
- case 0:
- filter->status = 1;
- n = c & 0xff;
- filter->cache |= n;
- break;
- default:
- filter->status = 0;
- n = (filter->cache & 0xff) | ((c & 0xff) << 8);
- if (n >= 0xd800 && n < 0xdc00) {
- filter->cache = ((n & 0x3ff) << 16) + 0x400000;
- } else if (n >= 0xdc00 && n < 0xe000) {
- n &= 0x3ff;
- n |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = 0;
- if (n >= MBFL_WCSPLANE_SUPMIN && n < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- } else { /* illegal character */
- n &= MBFL_WCSGROUP_MASK;
- n |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- }
- } else {
- filter->cache = 0;
- CK((*filter->output_function)(n, filter->data TSRMLS_CC));
- }
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => UTF-16LE
- */
-static int
-mbfl_filt_conv_wchar_utf16le(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int n;
-
- if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) {
- CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC));
- } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) {
- n = ((c >> 10) - 0x40) | 0xd800;
- CK((*filter->output_function)(n & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((n >> 8) & 0xff, filter->data TSRMLS_CC));
- n = (c & 0x3ff) | 0xdc00;
- CK((*filter->output_function)(n & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((n >> 8) & 0xff, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-
-/*
- * UTF-8 => wchar
- */
-static int
-mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c < 0x80) {
- if (c >= 0) {
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- }
- filter->status = 0;
- } else if (c < 0xc0) {
- switch (filter->status & 0xff) {
- case 0x10: /* 2byte code 2nd char */
- case 0x21: /* 3byte code 3rd char */
- case 0x32: /* 4byte code 4th char */
- case 0x43: /* 5byte code 5th char */
- case 0x54: /* 6byte code 6th char */
- filter->status = 0;
- s = filter->cache | (c & 0x3f);
- if (s >= 0x80) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- break;
- case 0x20: /* 3byte code 2nd char */
- case 0x31: /* 4byte code 3rd char */
- case 0x42: /* 5byte code 4th char */
- case 0x53: /* 6byte code 5th char */
- filter->cache |= ((c & 0x3f) << 6);
- filter->status++;
- break;
- case 0x30: /* 4byte code 2nd char */
- case 0x41: /* 5byte code 3rd char */
- case 0x52: /* 6byte code 4th char */
- filter->cache |= ((c & 0x3f) << 12);
- filter->status++;
- break;
- case 0x40: /* 5byte code 2nd char */
- case 0x51: /* 6byte code 3rd char */
- filter->cache |= ((c & 0x3f) << 18);
- filter->status++;
- break;
- case 0x50: /* 6byte code 2nd char */
- filter->cache |= ((c & 0x3f) << 24);
- filter->status++;
- break;
- default:
- filter->status = 0;
- break;
- }
- } else if (c < 0xe0) { /* 2byte code first char */
- filter->status = 0x10;
- filter->cache = (c & 0x1f) << 6;
- } else if (c < 0xf0) { /* 3byte code first char */
- filter->status = 0x20;
- filter->cache = (c & 0xf) << 12;
- } else if (c < 0xf8) { /* 4byte code first char */
- filter->status = 0x30;
- filter->cache = (c & 0x7) << 18;
- } else if (c < 0xfc) { /* 5byte code first char */
- filter->status = 0x40;
- filter->cache = (c & 0x3) << 24;
- } else if (c < 0xfe) { /* 6 byte code first char */
- filter->status = 0x50;
- filter->cache = (c & 0x1) << 30;
- } else {
- filter->status = 0;
- filter->cache = 0;
- }
-
- return c;
-}
-
-/*
- * wchar => UTF-8
- */
-static int
-mbfl_filt_conv_wchar_utf8(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- if (c >= 0 && c < MBFL_WCSGROUP_UCS4MAX) {
- if (c < 0x80) {
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else if (c < 0x800) {
- CK((*filter->output_function)(((c >> 6) & 0x1f) | 0xc0, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data TSRMLS_CC));
- } else if (c < 0x10000) {
- CK((*filter->output_function)(((c >> 12) & 0x0f) | 0xe0, filter->data TSRMLS_CC));
- CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data TSRMLS_CC));
- } else if (c < 0x200000) {
- CK((*filter->output_function)(((c >> 18) & 0x07) | 0xf0, filter->data TSRMLS_CC));
- CK((*filter->output_function)(((c >> 12) & 0x3f) | 0x80, filter->data TSRMLS_CC));
- CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data TSRMLS_CC));
- } else if (c < 0x4000000) {
- CK((*filter->output_function)(((c >> 24) & 0x03) | 0xf8, filter->data TSRMLS_CC));
- CK((*filter->output_function)(((c >> 18) & 0x3f) | 0x80, filter->data TSRMLS_CC));
- CK((*filter->output_function)(((c >> 12) & 0x3f) | 0x80, filter->data TSRMLS_CC));
- CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data TSRMLS_CC));
- } else {
- CK((*filter->output_function)(((c >> 30) & 0x01) | 0xfc, filter->data TSRMLS_CC));
- CK((*filter->output_function)(((c >> 24) & 0x3f) | 0x80, filter->data TSRMLS_CC));
- CK((*filter->output_function)(((c >> 18) & 0x3f) | 0x80, filter->data TSRMLS_CC));
- CK((*filter->output_function)(((c >> 12) & 0x3f) | 0x80, filter->data TSRMLS_CC));
- CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data TSRMLS_CC));
- CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data TSRMLS_CC));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-
-/*
- * UTF-7 => wchar
- */
-static int
-mbfl_filt_conv_utf7_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- n = -1;
- if (filter->status != 0) { /* Modified Base64 */
- if (c >= 0x41 && c <= 0x5a) { /* A - Z */
- n = c - 65;
- } else if (c >= 0x61 && c <= 0x7a) { /* a - z */
- n = c - 71;
- } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */
- n = c + 4;
- } else if (c == 0x2b) { /* '+' */
- n = 62;
- } else if (c == 0x2f) { /* '/' */
- n = 63;
- }
- if (n < 0 || n > 63) {
- if (c == 0x2d) {
- if (filter->status == 1) { /* "+-" -> "+" */
- CK((*filter->output_function)(0x2b, filter->data TSRMLS_CC));
- }
- } else if (c >= 0 && c < 0x80) { /* ASCII exclude '-' */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else { /* illegal character */
- s = c & MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- filter->cache = 0;
- filter->status = 0;
- return c;
- }
- }
-
- switch (filter->status) {
- /* directly encoded characters */
- case 0:
- if (c == 0x2b) { /* '+' shift character */
- filter->status = 1;
- } else if (c >= 0 && c < 0x80) { /* ASCII */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else { /* illegal character */
- s = c & MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- break;
-
- /* decode Modified Base64 */
- case 1:
- case 2:
- filter->cache |= n << 10;
- filter->status = 3;
- break;
- case 3:
- filter->cache |= n << 4;
- filter->status = 4;
- break;
- case 4:
- s = ((n >> 2) & 0xf) | (filter->cache & 0xffff);
- n = (n & 0x3) << 14;
- filter->status = 5;
- if (s >= 0xd800 && s < 0xdc00) {
- s = (((s & 0x3ff) << 16) + 0x400000) | n;
- filter->cache = s;
- } else if (s >= 0xdc00 && s < 0xe000) {
- s &= 0x3ff;
- s |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = n;
- if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else { /* illegal character */
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- } else {
- filter->cache = n;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- break;
-
- case 5:
- filter->cache |= n << 8;
- filter->status = 6;
- break;
- case 6:
- filter->cache |= n << 2;
- filter->status = 7;
- break;
- case 7:
- s = ((n >> 4) & 0x3) | (filter->cache & 0xffff);
- n = (n & 0xf) << 12;
- filter->status = 8;
- if (s >= 0xd800 && s < 0xdc00) {
- s = (((s & 0x3ff) << 16) + 0x400000) | n;
- filter->cache = s;
- } else if (s >= 0xdc00 && s < 0xe000) {
- s &= 0x3ff;
- s |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = n;
- if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else { /* illegal character */
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- } else {
- filter->cache = n;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- break;
-
- case 8:
- filter->cache |= n << 6;
- filter->status = 9;
- break;
- case 9:
- s = n | (filter->cache & 0xffff);
- filter->status = 2;
- if (s >= 0xd800 && s < 0xdc00) {
- s = (((s & 0x3ff) << 16) + 0x400000);
- filter->cache = s;
- } else if (s >= 0xdc00 && s < 0xe000) {
- s &= 0x3ff;
- s |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = 0;
- if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else { /* illegal character */
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- } else {
- filter->cache = 0;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => UTF-7
- */
-static int
-mbfl_filt_conv_wchar_utf7(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- n = 0;
- if (c >= 0 && c < 0x80) { /* ASCII */
- if (c >= 0x41 && c <= 0x5a) { /* A - Z */
- n = 1;
- } else if (c >= 0x61 && c <= 0x7a) { /* a - z */
- n = 1;
- } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */
- n = 1;
- } else if (c == '\0') { /* '\0' */
- n = 1;
- } else if (c == 0x2f) { /* '/' */
- n = 1;
- } else if (c == 0x2d) { /* '-' */
- n = 1;
- } else if (c == 0x20) { /* SPACE */
- n = 2;
- } else if (c == 0x09) { /* HTAB */
- n = 2;
- } else if (c == 0x0d) { /* CR */
- n = 2;
- } else if (c == 0x0a) { /* LF */
- n = 2;
- } else if (c == 0x27) { /* "'" */
- n = 2;
- } else if (c == 0x28) { /* '(' */
- n = 2;
- } else if (c == 0x29) { /* ')' */
- n = 2;
- } else if (c == 0x2c) { /* ',' */
- n = 2;
- } else if (c == 0x2e) { /* '.' */
- n = 2;
- } else if (c == 0x3a) { /* ':' */
- n = 2;
- } else if (c == 0x3f) { /* '?' */
- n = 2;
- }
- } else if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) {
- ;
- } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) {
- s = ((c >> 10) - 0x40) | 0xd800;
- CK((*filter->filter_function)(s, filter TSRMLS_CC));
- s = (c & 0x3ff) | 0xdc00;
- CK((*filter->filter_function)(s, filter TSRMLS_CC));
- return c;
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- return c;
- }
-
- switch (filter->status) {
- case 0:
- if (n != 0) { /* directly encode characters */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else { /* Modified Base64 */
- CK((*filter->output_function)(0x2b, filter->data TSRMLS_CC)); /* '+' */
- filter->status++;
- filter->cache = c;
- }
- break;
-
- /* encode Modified Base64 */
- case 1:
- s = filter->cache;
- CK((*filter->output_function)(mbfl_base64_table[(s >> 10) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[(s >> 4) & 0x3f], filter->data TSRMLS_CC));
- if (n != 0) {
- CK((*filter->output_function)(mbfl_base64_table[(s << 2) & 0x3c], filter->data TSRMLS_CC));
- if (n == 1) {
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- }
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- filter->status = 0;
- } else {
- filter->status++;
- filter->cache = ((s & 0xf) << 16) | c;
- }
- break;
-
- case 2:
- s = filter->cache;
- CK((*filter->output_function)(mbfl_base64_table[(s >> 14) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[(s >> 8) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[(s >> 2) & 0x3f], filter->data TSRMLS_CC));
- if (n != 0) {
- CK((*filter->output_function)(mbfl_base64_table[(s << 4) & 0x30], filter->data TSRMLS_CC));
- if (n == 1) {
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- }
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- filter->status = 0;
- } else {
- filter->status++;
- filter->cache = ((s & 0x3) << 16) | c;
- }
- break;
-
- case 3:
- s = filter->cache;
- CK((*filter->output_function)(mbfl_base64_table[(s >> 12) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[(s >> 6) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[s & 0x3f], filter->data TSRMLS_CC));
- if (n != 0) {
- if (n == 1) {
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- }
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- filter->status = 0;
- } else {
- filter->status = 1;
- filter->cache = c;
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-
-}
-
-static int
-mbfl_filt_conv_wchar_utf7_flush(mbfl_convert_filter *filter TSRMLS_DC)
-{
- int status, cache;
-
- status = filter->status;
- cache = filter->cache;
- filter->status = 0;
- filter->cache = 0;
- /* flush fragments */
- switch (status) {
- case 1:
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 10) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 4) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[(cache << 2) & 0x3c], filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- break;
-
- case 2:
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 14) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 8) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 2) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[(cache << 4) & 0x30], filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- break;
-
- case 3:
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 12) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 6) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_base64_table[cache & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- break;
- }
- return 0;
-}
-
-
-/*
- * UTF7-IMAP => wchar
- */
-static int
-mbfl_filt_conv_utf7imap_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- n = -1;
- if (filter->status != 0) { /* Modified Base64 */
- if (c >= 0x41 && c <= 0x5a) { /* A - Z */
- n = c - 65;
- } else if (c >= 0x61 && c <= 0x7a) { /* a - z */
- n = c - 71;
- } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */
- n = c + 4;
- } else if (c == 0x2b) { /* '+' */
- n = 62;
- } else if (c == 0x2c) { /* ',' */
- n = 63;
- }
- if (n < 0 || n > 63) {
- if (c == 0x2d) {
- if (filter->status == 1) { /* "&-" -> "&" */
- CK((*filter->output_function)(0x26, filter->data TSRMLS_CC));
- }
- } else if (c >= 0 && c < 0x80) { /* ASCII exclude '-' */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else { /* illegal character */
- s = c & MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- filter->cache = 0;
- filter->status = 0;
- return c;
- }
- }
-
- switch (filter->status) {
- /* directly encoded characters */
- case 0:
- if (c == 0x26) { /* '&' shift character */
- filter->status++;
- } else if (c >= 0 && c < 0x80) { /* ASCII */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else { /* illegal character */
- s = c & MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- break;
-
- /* decode Modified Base64 */
- case 1:
- case 2:
- filter->cache |= n << 10;
- filter->status = 3;
- break;
- case 3:
- filter->cache |= n << 4;
- filter->status = 4;
- break;
- case 4:
- s = ((n >> 2) & 0xf) | (filter->cache & 0xffff);
- n = (n & 0x3) << 14;
- filter->status = 5;
- if (s >= 0xd800 && s < 0xdc00) {
- s = (((s & 0x3ff) << 16) + 0x400000) | n;
- filter->cache = s;
- } else if (s >= 0xdc00 && s < 0xe000) {
- s &= 0x3ff;
- s |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = n;
- if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else { /* illegal character */
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- } else {
- filter->cache = n;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- break;
-
- case 5:
- filter->cache |= n << 8;
- filter->status = 6;
- break;
- case 6:
- filter->cache |= n << 2;
- filter->status = 7;
- break;
- case 7:
- s = ((n >> 4) & 0x3) | (filter->cache & 0xffff);
- n = (n & 0xf) << 12;
- filter->status = 8;
- if (s >= 0xd800 && s < 0xdc00) {
- s = (((s & 0x3ff) << 16) + 0x400000) | n;
- filter->cache = s;
- } else if (s >= 0xdc00 && s < 0xe000) {
- s &= 0x3ff;
- s |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = n;
- if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else { /* illegal character */
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- } else {
- filter->cache = n;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- break;
-
- case 8:
- filter->cache |= n << 6;
- filter->status = 9;
- break;
- case 9:
- s = n | (filter->cache & 0xffff);
- filter->status = 2;
- if (s >= 0xd800 && s < 0xdc00) {
- s = (((s & 0x3ff) << 16) + 0x400000);
- filter->cache = s;
- } else if (s >= 0xdc00 && s < 0xe000) {
- s &= 0x3ff;
- s |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = 0;
- if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else { /* illegal character */
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- } else {
- filter->cache = 0;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-static const unsigned char mbfl_utf7imap_base64_table[] =
-{
- /* 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', */
- 0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,
- /* 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', */
- 0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,
- /* 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', */
- 0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,
- /* 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', */
- 0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,
- /* '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', ',', '\0' */
- 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x2b,0x2c,0x00
-};
-
-/*
- * wchar => UTF7-IMAP
- */
-static int
-mbfl_filt_conv_wchar_utf7imap(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int n, s;
-
- n = 0;
- if (c == 0x26) {
- n = 1;
- } else if ((c >= 0x20 && c <= 0x7e) || c == 0) {
- n = 2;
- } else if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) {
- ;
- } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) {
- s = ((c >> 10) - 0x40) | 0xd800;
- CK((*filter->filter_function)(s, filter TSRMLS_CC));
- s = (c & 0x3ff) | 0xdc00;
- CK((*filter->filter_function)(s, filter TSRMLS_CC));
- return c;
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- return c;
- }
-
- switch (filter->status) {
- case 0:
- if (n != 0) { /* directly encode characters */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- if (n == 1) {
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- }
- } else { /* Modified Base64 */
- CK((*filter->output_function)(0x26, filter->data TSRMLS_CC)); /* '&' */
- filter->status = 1;
- filter->cache = c;
- }
- break;
-
- /* encode Modified Base64 */
- case 1:
- s = filter->cache;
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 10) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 4) & 0x3f], filter->data TSRMLS_CC));
- if (n != 0) {
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s << 2) & 0x3c], filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- if (n == 1) {
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- }
- filter->status = 0;
- } else {
- filter->status = 2;
- filter->cache = ((s & 0xf) << 16) | c;
- }
- break;
-
- case 2:
- s = filter->cache;
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 14) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 8) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 2) & 0x3f], filter->data TSRMLS_CC));
- if (n != 0) {
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s << 4) & 0x30], filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- if (n == 1) {
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- }
- filter->status = 0;
- } else {
- filter->status = 3;
- filter->cache = ((s & 0x3) << 16) | c;
- }
- break;
-
- case 3:
- s = filter->cache;
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 12) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 6) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[s & 0x3f], filter->data TSRMLS_CC));
- if (n != 0) {
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- if (n == 1) {
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- }
- filter->status = 0;
- } else {
- filter->status = 1;
- filter->cache = c;
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-
-}
-
-static int
-mbfl_filt_conv_wchar_utf7imap_flush(mbfl_convert_filter *filter TSRMLS_DC)
-{
- int status, cache;
-
- status = filter->status;
- cache = filter->cache;
- filter->status = 0;
- filter->cache = 0;
- /* flush fragments */
- switch (status) {
- case 1:
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 10) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 4) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache << 2) & 0x3c], filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- break;
-
- case 2:
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 14) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 8) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 2) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache << 4) & 0x30], filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- break;
-
- case 3:
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 12) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 6) & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[cache & 0x3f], filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */
- break;
- }
- return 0;
-}
-
-
-/*
- * wchar => ASCII
- */
-static int
-mbfl_filt_conv_wchar_ascii(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- if (c >= 0 && c < 0x80) {
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * wchar => cp1252
- */
-static int
-mbfl_filt_conv_wchar_cp1252(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s=-1, n;
-
- if (c >= 0x100) {
- /* look it up from the cp1252 table */
- s = -1;
- n = 31;
- while (n >= 0) {
- if (c == cp1252_ucs_table[n] && c != 0xfffe) {
- s = 0x80 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_1)
- {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
- else if (c >= 0 && c < 0x100) {
- s = c;
- }
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
- return c;
-}
-
-/*
- * cp1252 => wchar
- */
-static int
-mbfl_filt_conv_cp1252_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0x80 && c < 0xa0) {
- s = cp1252_ucs_table[c - 0x80];
- } else {
- s = c;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-1
- */
-static int
-mbfl_filt_conv_wchar_8859_1(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- if (c >= 0 && c < 0x100) {
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-2 => wchar
- */
-static int
-mbfl_filt_conv_8859_2_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_2_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_2;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-2
- */
-static int
-mbfl_filt_conv_wchar_8859_2(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_2_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_2) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-3 => wchar
- */
-static int
-mbfl_filt_conv_8859_3_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_3_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_3;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-3
- */
-static int
-mbfl_filt_conv_wchar_8859_3(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_3_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_3) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-4 => wchar
- */
-static int
-mbfl_filt_conv_8859_4_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_4_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_4;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-4
- */
-static int
-mbfl_filt_conv_wchar_8859_4(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_4_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_4) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-5 => wchar
- */
-static int
-mbfl_filt_conv_8859_5_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_5_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_5;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-5
- */
-static int
-mbfl_filt_conv_wchar_8859_5(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_5_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_5) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-6 => wchar
- */
-static int
-mbfl_filt_conv_8859_6_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_6_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_6;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-6
- */
-static int
-mbfl_filt_conv_wchar_8859_6(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_6_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_6) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-7 => wchar
- */
-static int
-mbfl_filt_conv_8859_7_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_7_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_7;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-7
- */
-static int
-mbfl_filt_conv_wchar_8859_7(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_7_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_7) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-8 => wchar
- */
-static int
-mbfl_filt_conv_8859_8_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_8_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_8;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-8
- */
-static int
-mbfl_filt_conv_wchar_8859_8(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_8_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_8) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-9 => wchar
- */
-static int
-mbfl_filt_conv_8859_9_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_9_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_9;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-9
- */
-static int
-mbfl_filt_conv_wchar_8859_9(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_9_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_9) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-10 => wchar
- */
-static int
-mbfl_filt_conv_8859_10_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_10_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_10;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-10
- */
-static int
-mbfl_filt_conv_wchar_8859_10(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_10_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_10) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-13 => wchar
- */
-static int
-mbfl_filt_conv_8859_13_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_13_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_13;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-13
- */
-static int
-mbfl_filt_conv_wchar_8859_13(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_13_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_13) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-14 => wchar
- */
-static int
-mbfl_filt_conv_8859_14_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_14_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_14;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-14
- */
-static int
-mbfl_filt_conv_wchar_8859_14(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_14_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_14) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-15 => wchar
- */
-static int
-mbfl_filt_conv_8859_15_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_15_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_15;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-15
- */
-static int
-mbfl_filt_conv_wchar_8859_15(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_15_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_15) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-
-
-/*
- *
- * identify filter functions
- *
- */
-
-static void
-mbfl_filt_ident_common_ctor(mbfl_identify_filter *filter TSRMLS_DC)
-{
- filter->status = 0;
- filter->flag = 0;
-}
-
-static void
-mbfl_filt_ident_common_dtor(mbfl_identify_filter *filter TSRMLS_DC)
-{
- filter->status = 0;
-}
-
-static int
-mbfl_filt_ident_ascii(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- if (c >= 0x20 && c < 0x80) {
- ;
- } else if (c == 0x0d || c == 0x0a || c == 0x09 || c == 0) { /* CR or LF or HTAB or null */
- ;
- } else {
- filter->flag = 1;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_utf8(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- if (c < 0x80) {
- if (c < 0) {
- filter->flag = 1; /* bad */
- } else if (c != 0 && filter->status) {
- filter->flag = 1; /* bad */
- }
- filter->status = 0;
- } else if (c < 0xc0) {
- switch (filter->status) {
- case 0x20: /* 3 byte code 2nd char */
- case 0x30: /* 4 byte code 2nd char */
- case 0x31: /* 4 byte code 3rd char */
- case 0x40: /* 5 byte code 2nd char */
- case 0x41: /* 5 byte code 3rd char */
- case 0x42: /* 5 byte code 4th char */
- case 0x50: /* 6 byte code 2nd char */
- case 0x51: /* 6 byte code 3rd char */
- case 0x52: /* 6 byte code 4th char */
- case 0x53: /* 6 byte code 5th char */
- filter->status++;
- break;
- case 0x10: /* 2 byte code 2nd char */
- case 0x21: /* 3 byte code 3rd char */
- case 0x32: /* 4 byte code 4th char */
- case 0x43: /* 5 byte code 5th char */
- case 0x54: /* 6 byte code 6th char */
- filter->status = 0;
- break;
- default:
- filter->flag = 1; /* bad */
- filter->status = 0;
- break;
- }
- } else {
- if (filter->status) {
- filter->flag = 1; /* bad */
- }
- filter->status = 0;
- if (c < 0xe0) { /* 2 byte code first char */
- filter->status = 0x10;
- } else if (c < 0xf0) { /* 3 byte code 1st char */
- filter->status = 0x20;
- } else if (c < 0xf8) { /* 4 byte code 1st char */
- filter->status = 0x30;
- } else if (c < 0xfc) { /* 5 byte code 1st char */
- filter->status = 0x40;
- } else if (c < 0xfe) { /* 6 byte code 1st char */
- filter->status = 0x50;
- } else {
- filter->flag = 1; /* bad */
- }
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_utf7(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- int n;
-
- switch (filter->status) {
- /* directly encoded characters */
- case 0:
- if (c == 0x2b) { /* '+' shift character */
- filter->status++;
- } else if (c == 0x5c || c == 0x7e || c < 0 || c > 0x7f) { /* illegal character */
- filter->flag = 1; /* bad */
- }
- break;
-
- /* Modified Base64 */
- case 1:
- case 2:
- n = 0;
- if (c >= 0x41 && c <= 0x5a) { /* A - Z */
- n = 1;
- } else if (c >= 0x61 && c <= 0x7a) { /* a - z */
- n = 1;
- } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */
- n = 1;
- } else if (c == 0x2b) { /* '+' */
- n = 1;
- } else if (c == 0x2f) { /* '/' */
- n = 1;
- }
- if (n <= 0) {
- if (filter->status == 1 && c != 0x2d) {
- filter->flag = 1; /* bad */
- } else if (c < 0 || c > 0x7f) {
- filter->flag = 1; /* bad */
- }
- filter->status = 0;
- } else {
- filter->status = 2;
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-#if defined(HAVE_MBSTR_JA)
-static int
-mbfl_filt_ident_eucjp(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- switch (filter->status) {
- case 0: /* latin */
- if (c >= 0 && c < 0x80) { /* ok */
- ;
- } else if (c > 0xa0 && c < 0xff) { /* kanji first char */
- filter->status = 1;
- } else if (c == 0x8e) { /* kana first char */
- filter->status = 2;
- } else if (c == 0x8f) { /* X 0212 first char */
- filter->status = 3;
- } else { /* bad */
- filter->flag = 1;
- }
- break;
-
- case 1: /* got first half */
- if (c < 0xa1 || c > 0xfe) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- break;
-
- case 2: /* got 0x8e */
- if (c < 0xa1 || c > 0xdf) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- break;
-
- case 3: /* got 0x8f */
- if (c < 0xa1 || c > 0xfe) { /* bad */
- filter->flag = 1;
- }
- filter->status++;
- break;
- case 4: /* got 0x8f */
- if (c < 0xa1 || c > 0xfe) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_sjis(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- if (filter->status) { /* kanji second char */
- if (c < 0x40 || c > 0xfc || c == 0x7f) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- } else if (c >= 0 && c < 0x80) { /* latin ok */
- ;
- } else if (c > 0xa0 && c < 0xe0) { /* kana ok */
- ;
- } else if (c > 0x80 && c < 0xf0 && c != 0xa0) { /* kanji first char */
- filter->status = 1;
- } else { /* bad */
- filter->flag = 1;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_sjiswin(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- if (filter->status) { /* kanji second char */
- if (c < 0x40 || c > 0xfc || c == 0x7f) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- } else if (c >= 0 && c < 0x80) { /* latin ok */
- ;
- } else if (c > 0xa0 && c < 0xe0) { /* kana ok */
- ;
- } else if (c > 0x80 && c < 0xfd && c != 0xa0) { /* kanji first char */
- filter->status = 1;
- } else { /* bad */
- filter->flag = 1;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_jis(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
-retry:
- switch (filter->status & 0xf) {
-/* case 0x00: ASCII */
-/* case 0x10: X 0201 latin */
-/* case 0x20: X 0201 kana */
-/* case 0x80: X 0208 */
-/* case 0x90: X 0212 */
- case 0:
- if (c == 0x1b) {
- filter->status += 2;
- } else if (c == 0x0e) { /* "kana in" */
- filter->status = 0x20;
- } else if (c == 0x0f) { /* "kana out" */
- filter->status = 0;
- } else if ((filter->status == 0x80 || filter->status == 0x90) && c > 0x20 && c < 0x7f) { /* kanji first char */
- filter->status += 1;
- } else if (c >= 0 && c < 0x80) { /* latin, CTLs */
- ;
- } else {
- filter->flag = 1; /* bad */
- }
- break;
-
-/* case 0x81: X 0208 second char */
-/* case 0x91: X 0212 second char */
- case 1:
- filter->status &= ~0xf;
- if (c == 0x1b) {
- goto retry;
- } else if (c < 0x21 || c > 0x7e) { /* bad */
- filter->flag = 1;
- }
- break;
-
- /* ESC */
- case 2:
- if (c == 0x24) { /* '$' */
- filter->status++;
- } else if (c == 0x28) { /* '(' */
- filter->status += 3;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- /* ESC $ */
- case 3:
- if (c == 0x40 || c == 0x42) { /* '@' or 'B' */
- filter->status = 0x80;
- } else if (c == 0x28) { /* '(' */
- filter->status++;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- /* ESC $ ( */
- case 4:
- if (c == 0x40 || c == 0x42) { /* '@' or 'B' */
- filter->status = 0x80;
- } else if (c == 0x44) { /* 'D' */
- filter->status = 0x90;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- /* ESC ( */
- case 5:
- if (c == 0x42 || c == 0x48) { /* 'B' or 'H' */
- filter->status = 0;
- } else if (c == 0x4a) { /* 'J' */
- filter->status = 0x10;
- } else if (c == 0x49) { /* 'I' */
- filter->status = 0x20;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-#endif /* HAVE_MBSTR_JA */
-
-#if defined(HAVE_MBSTR_CN)
-static int
-mbfl_filt_ident_euccn(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- switch (filter->status) {
- case 0: /* latin */
- if (c >= 0 && c < 0x80) { /* ok */
- ;
- } else if (c > 0xa0 && c < 0xff) { /* DBCS lead byte */
- filter->status = 1;
- } else { /* bad */
- filter->flag = 1;
- }
- break;
-
- case 1: /* got lead byte */
- if (c < 0xa1 || c > 0xfe) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_cp936(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- if (filter->status) { /* kanji second char */
- if (c < 0x40 || c > 0xfe || c == 0x7f) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- } else if (c >= 0 && c < 0x80) { /* latin ok */
- ;
- } else if (c > 0x80 && c < 0xff) { /* DBCS lead byte */
- filter->status = 1;
- } else { /* bad */
- filter->flag = 1;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_hz(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- switch (filter->status & 0xf) {
-/* case 0x00: ASCII */
-/* case 0x10: GB2312 */
- case 0:
- if (c == 0x7e) {
- filter->status += 2;
- } else if (filter->status == 0x10 && c > 0x20 && c < 0x7f) { /* DBCS first char */
- filter->status += 1;
- } else if (c >= 0 && c < 0x80) { /* latin, CTLs */
- ;
- } else {
- filter->flag = 1; /* bad */
- }
- break;
-
-/* case 0x11: GB2312 second char */
- case 1:
- filter->status &= ~0xf;
- if (c < 0x21 || c > 0x7e) { /* bad */
- filter->flag = 1;
- }
- break;
-
- case 2:
- if (c == 0x7d) { /* '}' */
- filter->status = 0;
- } else if (c == 0x7b) { /* '{' */
- filter->status = 0x10;
- } else if (c == 0x7e) { /* '~' */
- filter->status = 0;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-#endif /* HAVE_MBSTR_CN */
-
-#if defined(HAVE_MBSTR_TW)
-static int
-mbfl_filt_ident_euctw(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- switch (filter->status) {
- case 0: /* latin */
- if (c >= 0 && c < 0x80) { /* ok */
- ;
- } else if (c > 0xa0 && c < 0xff) { /* DBCS lead byte */
- filter->status = 1;
- } else if (c == 0x8e) { /* DBCS lead byte */
- filter->status = 2;
- } else { /* bad */
- filter->flag = 1;
- }
- break;
-
- case 1: /* got lead byte */
- if (c < 0xa1 || c > 0xfe) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- break;
-
- case 2: /* got lead byte */
- if (c >= 0xa1 && c < 0xaf) { /* ok */
- filter->status = 3;
- } else {
- filter->flag = 1; /* bad */
- }
- break;
-
- case 3: /* got lead byte */
- if (c < 0xa1 || c > 0xfe) { /* bad */
- filter->flag = 1;
- }
- filter->status = 4;
- break;
-
- case 4: /* got lead byte */
- if (c < 0xa1 || c > 0xfe) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_big5(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- if (filter->status) { /* kanji second char */
- if (c < 0x40 || (c > 0x7e && c < 0xa1) ||c > 0xfe) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- } else if (c >= 0 && c < 0x80) { /* latin ok */
- ;
- } else if (c > 0xa0 && c < 0xff) { /* DBCS lead byte */
- filter->status = 1;
- } else { /* bad */
- filter->flag = 1;
- }
-
- return c;
-}
-
-#endif /* HAVE_MBSTR_TW */
-
-#if defined(HAVE_MBSTR_KR)
-static int
-mbfl_filt_ident_euckr(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- switch (filter->status) {
- case 0: /* latin */
- if (c >= 0 && c < 0x80) { /* ok */
- ;
- } else if (c > 0xa0 && c < 0xff) { /* DBCS lead byte */
- filter->status = 1;
- } else { /* bad */
- filter->flag = 1;
- }
- break;
-
- case 1: /* got lead byte */
- if (c < 0xa1 || c > 0xfe) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_uhc(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- switch (filter->status) {
- case 0: /* latin */
- if (c >= 0 && c < 0x80) { /* ok */
- ;
- } else if (c >= 0x81 && c <= 0xa0) { /* dbcs first char */
- filter->status= 1;
- } else if (c >= 0xa1 && c <= 0xc6) { /* dbcs first char */
- filter->status= 2;
- } else if (c >= 0xc7 && c <= 0xfe) { /* dbcs first char */
- filter->status= 3;
- } else { /* bad */
- filter->flag = 1;
- }
-
- case 1:
- case 2:
- if (c < 0x41 || (c > 0x5a && c < 0x61)
- || (c > 0x7a && c < 0x81) || c > 0xfe) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- break;
-
- case 3:
- if (c < 0xa1 || c > 0xfe) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_2022kr(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
-retry:
- switch (filter->status & 0xf) {
-/* case 0x00: ASCII */
-/* case 0x10: KSC5601 mode */
-/* case 0x20: KSC5601 DBCS */
-/* case 0x40: KSC5601 SBCS */
- case 0:
- if (!(filter->status & 0x10)) {
- if (c == 0x1b)
- filter->status += 2;
- } else if (filter->status == 0x20 && c > 0x20 && c < 0x7f) { /* kanji first char */
- filter->status += 1;
- } else if (c >= 0 && c < 0x80) { /* latin, CTLs */
- ;
- } else {
- filter->flag = 1; /* bad */
- }
- break;
-
-/* case 0x21: KSC5601 second char */
- case 1:
- filter->status &= ~0xf;
- if (c < 0x21 || c > 0x7e) { /* bad */
- filter->flag = 1;
- }
- break;
-
- /* ESC */
- case 2:
- if (c == 0x24) { /* '$' */
- filter->status++;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- /* ESC $ */
- case 3:
- if (c == 0x29) { /* ')' */
- filter->status++;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- /* ESC $) */
- case 5:
- if (c == 0x43) { /* 'C' */
- filter->status = 0x10;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-#endif /* HAVE_MBSTR_KR */
-
-
-/* We only distinguish the MS extensions to ISO-8859-1.
- * Actually, this is pretty much a NO-OP, since the identification
- * system doesn't allow us to discriminate between a positive match,
- * a possible match and a definite non-match.
- * The problem here is that cp1252 looks like SJIS for certain chars.
- * */
-static int
-mbfl_filt_ident_cp1252(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- if (c >= 0x80 && c < 0xa0)
- filter->flag = 0;
- else
- filter->flag = 1; /* not it */
- return c;
-}
-
-#if defined(HAVE_MBSTR_RU)
-/* all of this is so ugly now! */
-static int
-mbfl_filt_ident_cp1251(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- if (c >= 0x80 && c < 0xff)
- filter->flag = 0;
- else
- filter->flag = 1; /* not it */
- return c;
-}
-
-static int
-mbfl_filt_ident_cp866(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- if (c >= 0x80 && c < 0xff)
- filter->flag = 0;
- else
- filter->flag = 1; /* not it */
- return c;
-}
-
-static int
-mbfl_filt_ident_koi8r(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- if (c >= 0x80 && c < 0xff)
- filter->flag = 0;
- else
- filter->flag = 1; /* not it */
- return c;
-}
-#endif /* HAVE_MBSTR_RU */
-
-static int
-mbfl_filt_ident_2022jp(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
-retry:
- switch (filter->status & 0xf) {
-/* case 0x00: ASCII */
-/* case 0x10: X 0201 latin */
-/* case 0x80: X 0208 */
- case 0:
- if (c == 0x1b) {
- filter->status += 2;
- } else if (filter->status == 0x80 && c > 0x20 && c < 0x7f) { /* kanji first char */
- filter->status += 1;
- } else if (c >= 0 && c < 0x80) { /* latin, CTLs */
- ;
- } else {
- filter->flag = 1; /* bad */
- }
- break;
-
-/* case 0x81: X 0208 second char */
- case 1:
- if (c == 0x1b) {
- filter->status++;
- } else {
- filter->status &= ~0xf;
- if (c < 0x21 || c > 0x7e) { /* bad */
- filter->flag = 1;
- }
- }
- break;
-
- /* ESC */
- case 2:
- if (c == 0x24) { /* '$' */
- filter->status++;
- } else if (c == 0x28) { /* '(' */
- filter->status += 3;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- /* ESC $ */
- case 3:
- if (c == 0x40 || c == 0x42) { /* '@' or 'B' */
- filter->status = 0x80;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- /* ESC ( */
- case 5:
- if (c == 0x42) { /* 'B' */
- filter->status = 0;
- } else if (c == 0x4a) { /* 'J' */
- filter->status = 0x10;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-static void
-mbfl_filt_ident_false_ctor(mbfl_identify_filter *filter TSRMLS_DC)
-{
- filter->status = 0;
- filter->flag = 1;
-}
-
-static int
-mbfl_filt_ident_false(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- filter->flag = 1; /* bad */
- return c;
-}
-
-static int
-mbfl_filt_ident_true(int c, mbfl_identify_filter *filter TSRMLS_DC)
-{
- return c;
-}
-
-
-
-/*
- * convert filter
- */
-
-/* setup filter function table */
-static void
-mbfl_convert_filter_set_vtbl(mbfl_convert_filter *filter, const struct mbfl_convert_vtbl *vtbl)
-{
- if (filter && vtbl) {
- filter->filter_ctor = vtbl->filter_ctor;
- filter->filter_dtor = vtbl->filter_dtor;
- filter->filter_function = vtbl->filter_function;
- filter->filter_flush = vtbl->filter_flush;
- }
-}
-
-
-static const struct mbfl_convert_vtbl *
-mbfl_convert_filter_get_vtbl(enum mbfl_no_encoding from, enum mbfl_no_encoding to)
-{
- const struct mbfl_convert_vtbl *vtbl;
- int i;
-
- if (to == mbfl_no_encoding_base64 ||
- to == mbfl_no_encoding_qprint ||
- to == mbfl_no_encoding_7bit) {
- from = mbfl_no_encoding_8bit;
- } else if (from == mbfl_no_encoding_base64 ||
- from == mbfl_no_encoding_qprint ||
- from == mbfl_no_encoding_uuencode) {
- to = mbfl_no_encoding_8bit;
- }
-
- i = 0;
- while ((vtbl = mbfl_convert_filter_list[i++]) != NULL){
- if (vtbl->from == from && vtbl->to == to) {
- return vtbl;
- }
- }
-
- return NULL;
-}
-
-
-static void
-mbfl_convert_filter_select_vtbl(mbfl_convert_filter *filter)
-{
- const struct mbfl_convert_vtbl *vtbl;
-
- vtbl = mbfl_convert_filter_get_vtbl(filter->from->no_encoding, filter->to->no_encoding);
- if (vtbl == NULL) {
- vtbl = &vtbl_pass;
- }
- mbfl_convert_filter_set_vtbl(filter, vtbl);
-}
-
-
-/* filter pipe */
-static int
-mbfl_filter_output_pipe(int c, void* data TSRMLS_DC)
-{
- mbfl_convert_filter *filter = (mbfl_convert_filter*)data;
- return (*filter->filter_function)(c, filter TSRMLS_CC);
-}
-
-
-/* null output */
-static int
-mbfl_filter_output_null(int c, void* data TSRMLS_DC)
-{
- return c;
-}
-
-
-mbfl_convert_filter *
-mbfl_convert_filter_new(
- enum mbfl_no_encoding from,
- enum mbfl_no_encoding to,
- int (*output_function)(int, void* TSRMLS_DC),
- int (*flush_function)(void* TSRMLS_DC),
- void* data TSRMLS_DC)
-{
- mbfl_convert_filter * filter;
-
- /* allocate */
- filter = (mbfl_convert_filter *)mbfl_malloc(sizeof(mbfl_convert_filter));
- if (filter == NULL) {
- return NULL;
- }
-
- /* encoding structure */
- filter->from = mbfl_no2encoding(from);
- filter->to = mbfl_no2encoding(to);
- if (filter->from == NULL) {
- filter->from = &mbfl_encoding_pass;
- }
- if (filter->to == NULL) {
- filter->to = &mbfl_encoding_pass;
- }
-
- if (output_function != NULL) {
- filter->output_function = output_function;
- } else {
- filter->output_function = mbfl_filter_output_null;
- }
- filter->flush_function = flush_function;
- filter->data = data;
- filter->illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- filter->illegal_substchar = 0x3f; /* '?' */
-
- /* setup the function table */
- mbfl_convert_filter_select_vtbl(filter);
-
- /* constructor */
- (*filter->filter_ctor)(filter TSRMLS_CC);
-
- return filter;
-}
-
-void
-mbfl_convert_filter_delete(mbfl_convert_filter *filter TSRMLS_DC)
-{
- if (filter) {
- (*filter->filter_dtor)(filter TSRMLS_CC);
- mbfl_free((void*)filter);
- }
-}
-
-int
-mbfl_convert_filter_feed(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- return (*filter->filter_function)(c, filter TSRMLS_CC);
-}
-
-int
-mbfl_convert_filter_flush(mbfl_convert_filter *filter TSRMLS_DC)
-{
- (*filter->filter_flush)(filter TSRMLS_CC);
- return (filter->flush_function ? (*filter->flush_function)(filter->data TSRMLS_CC) : 0);
-}
-
-void
-mbfl_convert_filter_reset(
- mbfl_convert_filter *filter,
- enum mbfl_no_encoding from,
- enum mbfl_no_encoding to TSRMLS_DC)
-{
- /* destruct old filter */
- (*filter->filter_dtor)(filter TSRMLS_CC);
-
- /* resset filter member */
- filter->from = mbfl_no2encoding(from);
- filter->to = mbfl_no2encoding(to);
-
- /* set the vtbl */
- mbfl_convert_filter_select_vtbl(filter);
-
- /* construct new filter */
- (*filter->filter_ctor)(filter TSRMLS_CC);
-}
-
-void
-mbfl_convert_filter_copy(
- mbfl_convert_filter *src,
- mbfl_convert_filter *dist TSRMLS_DC)
-{
- dist->filter_ctor = src->filter_ctor;
- dist->filter_dtor = src->filter_dtor;
- dist->filter_function = src->filter_function;
- dist->filter_flush = src->filter_flush;
- dist->output_function = src->output_function;
- dist->flush_function = src->flush_function;
- dist->data = src->data;
- dist->status = src->status;
- dist->cache = src->cache;
- dist->from = src->from;
- dist->to = src->to;
- dist->illegal_mode = src->illegal_mode;
- dist->illegal_substchar = src->illegal_substchar;
-}
-
-static int
-mbfl_convert_filter_devcat(mbfl_convert_filter *filter, mbfl_memory_device *src
- TSRMLS_DC)
-{
- int n;
- unsigned char *p;
-
- p = src->buffer;
- n = src->pos;
- while (n > 0) {
- if ((*filter->filter_function)(*p++, filter TSRMLS_CC) < 0) {
- return -1;
- }
- n--;
- }
-
- return n;
-}
-
-static int
-mbfl_convert_filter_strcat(mbfl_convert_filter *filter, const unsigned char *p TSRMLS_DC)
-{
- int c;
-
- while ((c = *p++) != '\0') {
- if ((*filter->filter_function)(c, filter TSRMLS_CC) < 0) {
- return -1;
- }
- }
-
- return 0;
-}
-
-#if 0
-static int
-mbfl_convert_filter_strncat(mbfl_convert_filter *filter, const unsigned char *p,
- int n TSRMLS_DC)
-{
- while (n > 0) {
- if ((*filter->filter_function)(*p++, filter TSRMLS_CC) < 0) {
- return -1;
- }
- n--;
- }
-
- return n;
-}
-#endif
-
-/* illegal character output function for conv-filter */
-int
-mbfl_filt_conv_illegal_output(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int mode_backup, ret, n, m, r;
-
- ret = 0;
- mode_backup = filter->illegal_mode;
- filter->illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
- switch (mode_backup) {
- case MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR:
- ret = (*filter->filter_function)(filter->illegal_substchar, filter TSRMLS_CC);
- break;
- case MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG:
- if (c >= 0) {
- if (c < MBFL_WCSGROUP_UCS4MAX) { /* unicode */
- ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"U+" TSRMLS_CC);
- } else {
- if (c < MBFL_WCSGROUP_WCHARMAX) {
- m = c & ~MBFL_WCSPLANE_MASK;
- switch (m) {
- case MBFL_WCSPLANE_JIS0208:
- ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"JIS+" TSRMLS_CC);
- break;
- case MBFL_WCSPLANE_JIS0212:
- ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"JIS2+" TSRMLS_CC);
- break;
- case MBFL_WCSPLANE_WINCP932:
- ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"W932+" TSRMLS_CC);
- break;
- case MBFL_WCSPLANE_8859_1:
- ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"I8859_1+" TSRMLS_CC);
- break;
- default:
- ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"?+" TSRMLS_CC);
- break;
- }
- c &= MBFL_WCSPLANE_MASK;
- } else {
- ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"BAD+" TSRMLS_CC);
- c &= MBFL_WCSGROUP_MASK;
- }
- }
- if (ret >= 0) {
- m = 0;
- r = 28;
- while (r >= 0) {
- n = (c >> r) & 0xf;
- if (n || m) {
- m = 1;
- ret = (*filter->filter_function)(mbfl_hexchar_table[n], filter TSRMLS_CC);
- if (ret < 0) {
- break;
- }
- }
- r -= 4;
- }
- if (m == 0 && ret >= 0) {
- ret = (*filter->filter_function)(mbfl_hexchar_table[0], filter TSRMLS_CC);
- }
- }
- }
- break;
- default:
- break;
- }
- filter->illegal_mode = mode_backup;
-
- return ret;
-}
-
-
-/*
- * identify filter
- */
-
-static void
-mbfl_identify_filter_set_vtbl(mbfl_identify_filter *filter, const struct mbfl_identify_vtbl *vtbl)
-{
- if (filter && vtbl) {
- filter->filter_ctor = vtbl->filter_ctor;
- filter->filter_dtor = vtbl->filter_dtor;
- filter->filter_function = vtbl->filter_function;
- }
-}
-
-static const struct mbfl_identify_vtbl *
-mbfl_identify_filter_get_vtbl(enum mbfl_no_encoding encoding)
-{
- const struct mbfl_identify_vtbl * vtbl;
- int i;
-
- i = 0;
- while ((vtbl = mbfl_identify_filter_list[i++]) != NULL) {
- if (vtbl->encoding == encoding) {
- break;
- }
- }
-
- return vtbl;
-}
-
-static void
-mbfl_identify_filter_select_vtbl(mbfl_identify_filter *filter)
-{
- const struct mbfl_identify_vtbl *vtbl;
-
- vtbl = mbfl_identify_filter_get_vtbl(filter->encoding->no_encoding);
- if (vtbl == NULL) {
- vtbl = &vtbl_identify_false;
- }
- mbfl_identify_filter_set_vtbl(filter, vtbl);
-}
-
-mbfl_identify_filter *
-mbfl_identify_filter_new(enum mbfl_no_encoding encoding TSRMLS_DC)
-{
- mbfl_identify_filter * filter;
-
- /* allocate */
- filter = (mbfl_identify_filter *)mbfl_malloc(sizeof(mbfl_identify_filter));
- if (filter == NULL) {
- return NULL;
- }
-
- /* encoding structure */
- filter->encoding = mbfl_no2encoding(encoding);
- if (filter->encoding == NULL) {
- filter->encoding = &mbfl_encoding_pass;
- }
-
- filter->status = 0;
- filter->flag = 0;
- filter->score = 0;
-
- /* setup the function table */
- mbfl_identify_filter_select_vtbl(filter);
-
- /* constructor */
- (*filter->filter_ctor)(filter TSRMLS_CC);
-
- return filter;
-}
-
-void
-mbfl_identify_filter_delete(mbfl_identify_filter *filter TSRMLS_DC)
-{
- if (filter) {
- (*filter->filter_dtor)(filter TSRMLS_CC);
- mbfl_free((void*)filter);
- }
-}
-
-
-
-/*
- * buffering converter
- */
-mbfl_buffer_converter *
-mbfl_buffer_converter_new(
- enum mbfl_no_encoding from,
- enum mbfl_no_encoding to,
- int buf_initsz TSRMLS_DC)
-{
- mbfl_buffer_converter *convd;
-
- /* allocate */
- convd = (mbfl_buffer_converter*)mbfl_malloc(sizeof (mbfl_buffer_converter));
- if (convd == NULL) {
- return NULL;
- }
-
- /* initialize */
- convd->from = mbfl_no2encoding(from);
- convd->to = mbfl_no2encoding(to);
- if (convd->from == NULL) {
- convd->from = &mbfl_encoding_pass;
- }
- if (convd->to == NULL) {
- convd->to = &mbfl_encoding_pass;
- }
-
- /* create convert filter */
- convd->filter1 = NULL;
- convd->filter2 = NULL;
- if (mbfl_convert_filter_get_vtbl(convd->from->no_encoding, convd->to->no_encoding) != NULL) {
- convd->filter1 = mbfl_convert_filter_new(convd->from->no_encoding, convd->to->no_encoding, mbfl_memory_device_output, 0, &convd->device TSRMLS_CC);
- } else {
- convd->filter2 = mbfl_convert_filter_new(mbfl_no_encoding_wchar, convd->to->no_encoding, mbfl_memory_device_output, 0, &convd->device TSRMLS_CC);
- if (convd->filter2 != NULL) {
- convd->filter1 = mbfl_convert_filter_new(convd->from->no_encoding, mbfl_no_encoding_wchar, (int (*)(int, void* TSRMLS_DC))convd->filter2->filter_function, NULL, convd->filter2 TSRMLS_CC);
- if (convd->filter1 == NULL) {
- mbfl_convert_filter_delete(convd->filter2 TSRMLS_CC);
- }
- }
- }
- if (convd->filter1 == NULL) {
- return NULL;
- }
-
- mbfl_memory_device_init(&convd->device, buf_initsz, buf_initsz/4 TSRMLS_CC);
-
- return convd;
-}
-
-void
-mbfl_buffer_converter_delete(mbfl_buffer_converter *convd TSRMLS_DC)
-{
- if (convd != NULL) {
- if (convd->filter1) {
- mbfl_convert_filter_delete(convd->filter1 TSRMLS_CC);
- }
- if (convd->filter2) {
- mbfl_convert_filter_delete(convd->filter2 TSRMLS_CC);
- }
- mbfl_memory_device_clear(&convd->device TSRMLS_CC);
- mbfl_free((void*)convd);
- }
-}
-
-void
-mbfl_buffer_converter_reset(mbfl_buffer_converter *convd TSRMLS_DC)
-{
- mbfl_memory_device_reset(&convd->device TSRMLS_CC);
-}
-
-int
-mbfl_buffer_converter_illegal_mode(mbfl_buffer_converter *convd, int mode TSRMLS_DC)
-{
- if (convd != NULL) {
- if (convd->filter2 != NULL) {
- convd->filter2->illegal_mode = mode;
- } else if (convd->filter1 != NULL) {
- convd->filter1->illegal_mode = mode;
- } else {
- return 0;
- }
- }
-
- return 1;
-}
-
-int
-mbfl_buffer_converter_illegal_substchar(mbfl_buffer_converter *convd, int substchar TSRMLS_DC)
-{
- if (convd != NULL) {
- if (convd->filter2 != NULL) {
- convd->filter2->illegal_substchar = substchar;
- } else if (convd->filter1 != NULL) {
- convd->filter1->illegal_substchar = substchar;
- } else {
- return 0;
- }
- }
-
- return 1;
-}
-
-int
-mbfl_buffer_converter_strncat(mbfl_buffer_converter *convd, const unsigned char *p, int n TSRMLS_DC)
-{
- mbfl_convert_filter *filter;
- int (*filter_function)(int c, mbfl_convert_filter *filter TSRMLS_DC);
-
- if (convd != NULL && p != NULL) {
- filter = convd->filter1;
- if (filter != NULL) {
- filter_function = filter->filter_function;
- while (n > 0) {
- if ((*filter_function)(*p++, filter TSRMLS_CC) < 0) {
- break;
- }
- n--;
- }
- }
- }
-
- return n;
-}
-
-int
-mbfl_buffer_converter_feed(mbfl_buffer_converter *convd, mbfl_string *string TSRMLS_DC)
-{
- int n;
- unsigned char *p;
- mbfl_convert_filter *filter;
- int (*filter_function)(int c, mbfl_convert_filter *filter TSRMLS_DC);
-
- if (convd == NULL || string == NULL) {
- return -1;
- }
- mbfl_memory_device_realloc(&convd->device, convd->device.pos + string->len, string->len/4 TSRMLS_CC);
- /* feed data */
- n = string->len;
- p = string->val;
- filter = convd->filter1;
- if (filter != NULL) {
- filter_function = filter->filter_function;
- while (n > 0) {
- if ((*filter_function)(*p++, filter TSRMLS_CC) < 0) {
- return -1;
- }
- n--;
- }
- }
-
- return 0;
-}
-
-int
-mbfl_buffer_converter_flush(mbfl_buffer_converter *convd TSRMLS_DC)
-{
- if (convd == NULL) {
- return -1;
- }
-
- if (convd->filter1 != NULL) {
- mbfl_convert_filter_flush(convd->filter1 TSRMLS_CC);
- }
- if (convd->filter2 != NULL) {
- mbfl_convert_filter_flush(convd->filter2 TSRMLS_CC);
- }
-
- return 0;
-}
-
-mbfl_string *
-mbfl_buffer_converter_getbuffer(mbfl_buffer_converter *convd, mbfl_string *result TSRMLS_DC)
-{
- if (convd != NULL && result != NULL && convd->device.buffer != NULL) {
- result->no_encoding = convd->to->no_encoding;
- result->val = convd->device.buffer;
- result->len = convd->device.pos;
- } else {
- result = NULL;
- }
-
- return result;
-}
-
-mbfl_string *
-mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result TSRMLS_DC)
-{
- if (convd == NULL || result == NULL) {
- return NULL;
- }
- result->no_encoding = convd->to->no_encoding;
- return mbfl_memory_device_result(&convd->device, result TSRMLS_CC);
-}
-
-mbfl_string *
-mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string,
- mbfl_string *result TSRMLS_DC)
-{
- if (convd == NULL || string == NULL || result == NULL) {
- return NULL;
- }
- mbfl_buffer_converter_feed(convd, string TSRMLS_CC);
- if (convd->filter1 != NULL) {
- mbfl_convert_filter_flush(convd->filter1 TSRMLS_CC);
- }
- if (convd->filter2 != NULL) {
- mbfl_convert_filter_flush(convd->filter2 TSRMLS_CC);
- }
- result->no_encoding = convd->to->no_encoding;
- return mbfl_memory_device_result(&convd->device, result TSRMLS_CC);
-}
-
-
-/*
- * encoding detector
- */
-mbfl_encoding_detector *
-mbfl_encoding_detector_new(enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC)
-{
- mbfl_encoding_detector *identd;
-
- int i, num;
- mbfl_identify_filter *filter;
-
- if (elist == NULL || eliztsz <= 0) {
- return NULL;
- }
-
- /* allocate */
- identd = (mbfl_encoding_detector*)mbfl_malloc(sizeof(mbfl_encoding_detector));
- if (identd == NULL) {
- return NULL;
- }
- identd->filter_list = (mbfl_identify_filter **)mbfl_calloc(eliztsz, sizeof(mbfl_identify_filter *));
- if (identd->filter_list == NULL) {
- mbfl_free(identd);
- return NULL;
- }
-
- /* create filters */
- i = 0;
- num = 0;
- while (i < eliztsz) {
- filter = mbfl_identify_filter_new(elist[i] TSRMLS_CC);
- if (filter != NULL) {
- identd->filter_list[num] = filter;
- num++;
- }
- i++;
- }
- identd->filter_list_size = num;
-
- return identd;
-}
-
-void
-mbfl_encoding_detector_delete(mbfl_encoding_detector *identd TSRMLS_DC)
-{
- int i;
-
- if (identd != NULL) {
- if (identd->filter_list != NULL) {
- i = identd->filter_list_size;
- while (i > 0) {
- i--;
- mbfl_identify_filter_delete(identd->filter_list[i] TSRMLS_CC);
- }
- mbfl_free((void *)identd->filter_list);
- }
- mbfl_free((void *)identd);
- }
-}
-
-int
-mbfl_encoding_detector_feed(mbfl_encoding_detector *identd, mbfl_string *string TSRMLS_DC)
-{
- int i, n, num, bad, res;
- unsigned char *p;
- mbfl_identify_filter *filter;
-
- res = 0;
- /* feed data */
- if (identd != NULL && string != NULL && string->val != NULL) {
- num = identd->filter_list_size;
- n = string->len;
- p = string->val;
- while (n > 0) {
- i = 0;
- bad = 0;
- while (i < num) {
- filter = identd->filter_list[i];
- (*filter->filter_function)(*p, filter TSRMLS_CC);
- if (filter->flag) {
- bad++;
- }
- i++;
- }
- if ((num - 1) <= bad) {
- res = 1;
- break;
- }
- p++;
- n--;
- }
- }
-
- return res;
-}
-
-enum mbfl_no_encoding mbfl_encoding_detector_judge(mbfl_encoding_detector *identd TSRMLS_DC)
-{
- mbfl_identify_filter *filter;
- enum mbfl_no_encoding encoding;
- int n;
-
- /* judge */
- encoding = mbfl_no_encoding_invalid;
- if (identd != NULL) {
- n = identd->filter_list_size - 1;
- while (n >= 0) {
- filter = identd->filter_list[n];
- if (!filter->flag) {
- encoding = filter->encoding->no_encoding;
- }
- n--;
- }
- }
-
- return encoding;
-}
-
-
-/*
- * encoding converter
- */
-mbfl_string *
-mbfl_convert_encoding(
- mbfl_string *string,
- mbfl_string *result,
- enum mbfl_no_encoding toenc TSRMLS_DC)
-{
- int n;
- unsigned char *p;
- const mbfl_encoding *encoding;
- mbfl_memory_device device;
- mbfl_convert_filter *filter1;
- mbfl_convert_filter *filter2;
-
- /* initialize */
- encoding = mbfl_no2encoding(toenc);
- if (encoding == NULL || string == NULL || result == NULL) {
- return NULL;
- }
-
- filter1 = NULL;
- filter2 = NULL;
- if (mbfl_convert_filter_get_vtbl(string->no_encoding, toenc) != NULL) {
- filter1 = mbfl_convert_filter_new(string->no_encoding, toenc, mbfl_memory_device_output, 0, &device TSRMLS_CC);
- } else {
- filter2 = mbfl_convert_filter_new(mbfl_no_encoding_wchar, toenc, mbfl_memory_device_output, 0, &device TSRMLS_CC);
- if (filter2 != NULL) {
- filter1 = mbfl_convert_filter_new(string->no_encoding, mbfl_no_encoding_wchar, (int (*)(int, void* TSRMLS_DC))filter2->filter_function, NULL, filter2 TSRMLS_CC);
- if (filter1 == NULL) {
- mbfl_convert_filter_delete(filter2 TSRMLS_CC);
- }
- }
- }
- if (filter1 == NULL) {
- return NULL;
- }
- if (filter2 != NULL) {
- filter2->illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- filter2->illegal_substchar = 0x3f; /* '?' */
- }
- mbfl_memory_device_init(&device, string->len, (string->len >> 2) + 8 TSRMLS_CC);
-
- /* feed data */
- n = string->len;
- p = string->val;
- if (p != NULL) {
- while (n > 0) {
- if ((*filter1->filter_function)(*p++, filter1 TSRMLS_CC) < 0) {
- break;
- }
- n--;
- }
- }
-
- mbfl_convert_filter_flush(filter1 TSRMLS_CC);
- mbfl_convert_filter_delete(filter1 TSRMLS_CC);
- if (filter2 != NULL) {
- mbfl_convert_filter_flush(filter2 TSRMLS_CC);
- mbfl_convert_filter_delete(filter2 TSRMLS_CC);
- }
-
- return mbfl_memory_device_result(&device, result TSRMLS_CC);
-}
-
-
-/*
- * identify encoding
- */
-const mbfl_encoding *
-mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC)
-{
- int i, n, num, bad;
- unsigned char *p;
- const struct mbfl_identify_vtbl *vtbl;
- mbfl_identify_filter *flist, *filter;
- const mbfl_encoding *encoding;
-
- /* initialize */
- flist = (mbfl_identify_filter *)mbfl_calloc(eliztsz, sizeof(mbfl_identify_filter));
- if (flist == NULL) {
- return NULL;
- }
- i = 0;
- num = 0;
- if (elist != NULL) {
- while (i < eliztsz) {
- vtbl = mbfl_identify_filter_get_vtbl(elist[i]);
- if (vtbl != NULL) {
- filter = &flist[num];
- mbfl_identify_filter_set_vtbl(filter, vtbl);
- filter->encoding = mbfl_no2encoding(vtbl->encoding);
- (*filter->filter_ctor)(filter TSRMLS_CC);
- num++;
- }
- i++;
- }
- }
-
- /* feed data */
- n = string->len;
- p = string->val;
- if (p != NULL) {
- while (n > 0) {
- i = 0;
- bad = 0;
- while (i < num) {
- filter = &flist[i];
- (*filter->filter_function)(*p, filter TSRMLS_CC);
- if (filter->flag) {
- bad++;
- }
- i++;
- }
- if ((num - 1) <= bad) {
- break;
- }
- p++;
- n--;
- }
- }
-
- /* judge */
- i = num - 1;
- bad = 1;
- encoding = NULL;
- while (i >= 0) {
- filter = &flist[i];
- if (filter->flag) {
- bad++;
- } else {
- encoding = filter->encoding;
- }
- i--;
- }
-#if 0
- if (bad < num) {
- encoding = NULL;
- }
-#endif
-
- i = 0;
- while (i < num) {
- filter = &flist[i];
- (*filter->filter_dtor)(filter TSRMLS_CC);
- i++;
- }
- mbfl_free((void *)flist);
-
- return encoding;
-}
-
-const char*
-mbfl_identify_encoding_name(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC)
-{
- const mbfl_encoding *encoding;
-
- encoding = mbfl_identify_encoding(string, elist, eliztsz TSRMLS_CC);
- if (encoding != NULL &&
- encoding->no_encoding > mbfl_no_encoding_charset_min &&
- encoding->no_encoding < mbfl_no_encoding_charset_max) {
- return encoding->name;
- } else {
- return NULL;
- }
-}
-
-const enum mbfl_no_encoding
-mbfl_identify_encoding_no(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC)
-{
- const mbfl_encoding *encoding;
-
- encoding = mbfl_identify_encoding(string, elist, eliztsz TSRMLS_CC);
- if (encoding != NULL &&
- encoding->no_encoding > mbfl_no_encoding_charset_min &&
- encoding->no_encoding < mbfl_no_encoding_charset_max) {
- return encoding->no_encoding;
- } else {
- return mbfl_no_encoding_invalid;
- }
-}
-
-
-/*
- * strlen
- */
-static int
-filter_count_output(int c, void *data TSRMLS_DC)
-{
- (*(int *)data)++;
- return c;
-}
-
-int
-mbfl_strlen(mbfl_string *string TSRMLS_DC)
-{
- int len, n, m, k;
- unsigned char *p;
- const unsigned char *mbtab;
- const mbfl_encoding *encoding;
-
- encoding = mbfl_no2encoding(string->no_encoding);
- if (encoding == NULL || string == NULL) {
- return -1;
- }
-
- len = 0;
- if (encoding->flag & MBFL_ENCTYPE_SBCS) {
- len = string->len;
- } else if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) {
- len = string->len/2;
- } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) {
- len = string->len/4;
- } else if (encoding->mblen_table != NULL) {
- mbtab = encoding->mblen_table;
- n = 0;
- p = string->val;
- k = string->len;
- /* count */
- if (p != NULL) {
- while (n < k) {
- m = mbtab[*p];
- n += m;
- p += m;
- len++;
- };
- }
- } else {
- /* wchar filter */
- mbfl_convert_filter *filter = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- filter_count_output, 0, &len TSRMLS_CC);
- if (filter == NULL) {
- return -1;
- }
- /* count */
- n = string->len;
- p = string->val;
- if (p != NULL) {
- while (n > 0) {
- (*filter->filter_function)(*p++, filter TSRMLS_CC);
- n--;
- }
- }
- mbfl_convert_filter_delete(filter TSRMLS_CC);
- }
-
- return len;
-}
-
-#ifdef ZEND_MULTIBYTE
-/*
- * oddlen
- */
-int
-mbfl_oddlen(mbfl_string *string)
-{
- int len, n, m, k;
- unsigned char *p;
- const unsigned char *mbtab;
- const mbfl_encoding *encoding;
-
- encoding = mbfl_no2encoding(string->no_encoding);
- if (encoding == NULL || string == NULL) {
- return -1;
- }
-
- len = 0;
- if (encoding->flag & MBFL_ENCTYPE_SBCS) {
- return 0;
- } else if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) {
- return len % 2;
- } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) {
- return len % 4;
- } else if (encoding->mblen_table != NULL) {
- mbtab = encoding->mblen_table;
- n = 0;
- p = string->val;
- k = string->len;
- /* count */
- if (p != NULL) {
- while (n < k) {
- m = mbtab[*p];
- n += m;
- p += m;
- };
- }
- return n-k;
- } else {
- /* how can i do ? */
- return 0;
- }
- /* NOT REACHED */
-}
-#endif /* ZEND_MULTIBYTE */
-
-
-/*
- * strpos
- */
-struct collector_strpos_data {
- mbfl_convert_filter *next_filter;
- mbfl_wchar_device needle;
- int needle_len;
- int start;
- int output;
- int found_pos;
- int needle_pos;
- int matched_pos;
-};
-
-static int
-collector_strpos(int c, void* data TSRMLS_DC)
-{
- int *p, *h, *m, n;
- struct collector_strpos_data *pc = (struct collector_strpos_data*)data;
-
- if (pc->output >= pc->start) {
- if (c == (int)pc->needle.buffer[pc->needle_pos]) {
- if (pc->needle_pos == 0) {
- pc->found_pos = pc->output; /* found position */
- }
- pc->needle_pos++; /* needle pointer */
- if (pc->needle_pos >= pc->needle_len) {
- pc->matched_pos = pc->found_pos; /* matched position */
- pc->needle_pos--;
- goto retry;
- }
- } else if (pc->needle_pos != 0) {
-retry:
- h = (int *)pc->needle.buffer;
- h++;
- for (;;) {
- pc->found_pos++;
- p = h;
- m = (int *)pc->needle.buffer;
- n = pc->needle_pos - 1;
- while (n > 0 && *p == *m) {
- n--;
- p++;
- m++;
- }
- if (n <= 0) {
- if (*m != c) {
- pc->needle_pos = 0;
- }
- break;
- } else {
- h++;
- pc->needle_pos--;
- }
- }
- }
- }
-
- pc->output++;
- return c;
-}
-
-int
-mbfl_strpos(
- mbfl_string *haystack,
- mbfl_string *needle,
- int offset,
- int reverse TSRMLS_DC)
-{
- int n, result;
- unsigned char *p;
- mbfl_convert_filter *filter;
- struct collector_strpos_data pc;
-
- if (haystack == NULL || needle == NULL) {
- return -8;
- }
- /* needle is converted into wchar */
- mbfl_wchar_device_init(&pc.needle TSRMLS_CC);
- filter = mbfl_convert_filter_new(
- needle->no_encoding,
- mbfl_no_encoding_wchar,
- mbfl_wchar_device_output, 0, &pc.needle TSRMLS_CC);
- if (filter == NULL) {
- return -4;
- }
- p = needle->val;
- n = needle->len;
- if (p != NULL) {
- while (n > 0) {
- if ((*filter->filter_function)(*p++, filter TSRMLS_CC) < 0) {
- break;
- }
- n--;
- }
- }
- mbfl_convert_filter_flush(filter TSRMLS_CC);
- mbfl_convert_filter_delete(filter TSRMLS_CC);
- pc.needle_len = pc.needle.pos;
- if (pc.needle.buffer == NULL) {
- return -4;
- }
- if (pc.needle_len <= 0) {
- mbfl_wchar_device_clear(&pc.needle TSRMLS_CC);
- return -2;
- }
- /* initialize filter and collector data */
- filter = mbfl_convert_filter_new(
- haystack->no_encoding,
- mbfl_no_encoding_wchar,
- collector_strpos, 0, &pc TSRMLS_CC);
- if (filter == NULL) {
- mbfl_wchar_device_clear(&pc.needle TSRMLS_CC);
- return -4;
- }
- pc.start = offset;
- pc.output = 0;
- pc.needle_pos = 0;
- pc.found_pos = 0;
- pc.matched_pos = -1;
-
- /* feed data */
- p = haystack->val;
- n = haystack->len;
- if (p != NULL) {
- while (n > 0) {
- if ((*filter->filter_function)(*p++, filter TSRMLS_CC) < 0) {
- pc.matched_pos = -4;
- break;
- }
- if (pc.matched_pos >= 0 && !reverse) {
- break;
- }
- n--;
- }
- }
- mbfl_convert_filter_flush(filter TSRMLS_CC);
- result = pc.matched_pos;
- mbfl_convert_filter_delete(filter TSRMLS_CC);
- mbfl_wchar_device_clear(&pc.needle TSRMLS_CC);
-
- return result;
-}
-
-/*
- * substr_count
- */
-
-int
-mbfl_substr_count(
- mbfl_string *haystack,
- mbfl_string *needle
- TSRMLS_DC)
-{
- int n, result = 0;
- unsigned char *p;
- mbfl_convert_filter *filter;
- struct collector_strpos_data pc;
-
- if (haystack == NULL || needle == NULL) {
- return -8;
- }
- /* needle is converted into wchar */
- mbfl_wchar_device_init(&pc.needle TSRMLS_CC);
- filter = mbfl_convert_filter_new(
- needle->no_encoding,
- mbfl_no_encoding_wchar,
- mbfl_wchar_device_output, 0, &pc.needle TSRMLS_CC);
- if (filter == NULL) {
- return -4;
- }
- p = needle->val;
- n = needle->len;
- if (p != NULL) {
- while (n > 0) {
- if ((*filter->filter_function)(*p++, filter TSRMLS_CC) < 0) {
- break;
- }
- n--;
- }
- }
- mbfl_convert_filter_flush(filter TSRMLS_CC);
- mbfl_convert_filter_delete(filter TSRMLS_CC);
- pc.needle_len = pc.needle.pos;
- if (pc.needle.buffer == NULL) {
- return -4;
- }
- if (pc.needle_len <= 0) {
- mbfl_wchar_device_clear(&pc.needle TSRMLS_CC);
- return -2;
- }
- /* initialize filter and collector data */
- filter = mbfl_convert_filter_new(
- haystack->no_encoding,
- mbfl_no_encoding_wchar,
- collector_strpos, 0, &pc TSRMLS_CC);
- if (filter == NULL) {
- mbfl_wchar_device_clear(&pc.needle TSRMLS_CC);
- return -4;
- }
- pc.start = 0;
- pc.output = 0;
- pc.needle_pos = 0;
- pc.found_pos = 0;
- pc.matched_pos = -1;
-
- /* feed data */
- p = haystack->val;
- n = haystack->len;
- if (p != NULL) {
- while (n > 0) {
- if ((*filter->filter_function)(*p++, filter TSRMLS_CC) < 0) {
- pc.matched_pos = -4;
- break;
- }
- if (pc.matched_pos >= 0) {
- ++result;
- pc.matched_pos = -1;
- }
- n--;
- }
- }
- mbfl_convert_filter_flush(filter TSRMLS_CC);
- mbfl_convert_filter_delete(filter TSRMLS_CC);
- mbfl_wchar_device_clear(&pc.needle TSRMLS_CC);
-
- return result;
-}
-
-/*
- * substr
- */
-struct collector_substr_data {
- mbfl_convert_filter *next_filter;
- int start;
- int stop;
- int output;
-};
-
-static int
-collector_substr(int c, void* data TSRMLS_DC)
-{
- struct collector_substr_data *pc = (struct collector_substr_data*)data;
-
- if (pc->output >= pc->stop) {
- return -1;
- }
-
- if (pc->output >= pc->start) {
- (*pc->next_filter->filter_function)(c, pc->next_filter TSRMLS_CC);
- }
-
- pc->output++;
-
- return c;
-}
-
-mbfl_string *
-mbfl_substr(
- mbfl_string *string,
- mbfl_string *result,
- int from,
- int length TSRMLS_DC)
-{
- const mbfl_encoding *encoding;
- int n, m, k, len, start, end;
- unsigned char *p, *w;
- const unsigned char *mbtab;
-
- encoding = mbfl_no2encoding(string->no_encoding);
- if (encoding == NULL || string == NULL || result == NULL) {
- return NULL;
- }
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = string->no_encoding;
-
- if ((encoding->flag & (MBFL_ENCTYPE_SBCS | MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE | MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) ||
- encoding->mblen_table != NULL) {
- len = string->len;
- start = from;
- end = from + length;
- if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_MWC2LE)) {
- start *= 2;
- end = start + length*2;
- } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_MWC4LE)) {
- start *= 4;
- end = start + length*4;
- } else if (encoding->mblen_table != NULL) {
- mbtab = encoding->mblen_table;
- start = 0;
- end = 0;
- n = 0;
- k = 0;
- p = string->val;
- if (p != NULL) {
- /* search start position */
- while (k <= from) {
- start = n;
- if (n >= len) {
- break;
- }
- m = mbtab[*p];
- n += m;
- p += m;
- k++;
- }
- /* detect end position */
- k = 0;
- end = start;
- while (k < length) {
- end = n;
- if (n >= len) {
- break;
- }
- m = mbtab[*p];
- n += m;
- p += m;
- k++;
- }
- }
- }
-
- if (start > len) {
- start = len;
- }
- if (start < 0) {
- start = 0;
- }
- if (end > len) {
- end = len;
- }
- if (end < 0) {
- end = 0;
- }
- if (start > end) {
- start = end;
- }
-
- /* allocate memory and copy */
- n = end - start;
- result->len = 0;
- result->val = w = (unsigned char*)mbfl_malloc((n + 8)*sizeof(unsigned char));
- if (w != NULL) {
- p = string->val;
- if (p != NULL) {
- p += start;
- result->len = n;
- while (n > 0) {
- *w++ = *p++;
- n--;
- }
- }
- *w++ = '\0';
- *w++ = '\0';
- *w++ = '\0';
- *w = '\0';
- } else {
- result = NULL;
- }
- } else {
- mbfl_memory_device device;
- struct collector_substr_data pc;
- mbfl_convert_filter *decoder;
- mbfl_convert_filter *encoder;
-
- mbfl_memory_device_init(&device, length + 1, 0 TSRMLS_CC);
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = string->no_encoding;
- /* output code filter */
- decoder = mbfl_convert_filter_new(
- mbfl_no_encoding_wchar,
- string->no_encoding,
- mbfl_memory_device_output, 0, &device TSRMLS_CC);
- /* wchar filter */
- encoder = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- collector_substr, 0, &pc TSRMLS_CC);
- if (decoder == NULL || encoder == NULL) {
- mbfl_convert_filter_delete(encoder TSRMLS_CC);
- mbfl_convert_filter_delete(decoder TSRMLS_CC);
- return NULL;
- }
- pc.next_filter = decoder;
- pc.start = from;
- pc.stop = from + length;
- pc.output = 0;
-
- /* feed data */
- p = string->val;
- n = string->len;
- if (p != NULL) {
- while (n > 0) {
- if ((*encoder->filter_function)(*p++, encoder TSRMLS_CC) < 0) {
- break;
- }
- n--;
- }
- }
-
- mbfl_convert_filter_flush(encoder TSRMLS_CC);
- mbfl_convert_filter_flush(decoder TSRMLS_CC);
- result = mbfl_memory_device_result(&device, result TSRMLS_CC);
- mbfl_convert_filter_delete(encoder TSRMLS_CC);
- mbfl_convert_filter_delete(decoder TSRMLS_CC);
- }
-
- return result;
-}
-
-
-/*
- * strcut
- */
-mbfl_string *
-mbfl_strcut(
- mbfl_string *string,
- mbfl_string *result,
- int from,
- int length TSRMLS_DC)
-{
- const mbfl_encoding *encoding;
- int n, m, k, len, start, end;
- unsigned char *p, *w;
- const unsigned char *mbtab;
- mbfl_memory_device device;
- mbfl_convert_filter *encoder, *encoder_tmp, *decoder, *decoder_tmp;
-
- encoding = mbfl_no2encoding(string->no_encoding);
- if (encoding == NULL || string == NULL || result == NULL) {
- return NULL;
- }
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = string->no_encoding;
-
- if (from > (int)string->len) {
- result->len = 0;
- result->val = mbfl_malloc(1);
- result->val[0] = '\0';
- return result;
- }
-
- if ((encoding->flag & (MBFL_ENCTYPE_SBCS | MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE | MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) ||
- encoding->mblen_table != NULL) {
- len = string->len;
- start = from;
- end = from + length;
- if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) {
- start /= 2;
- start *= 2;
- end = length/2;
- end *= 2;
- end += start;
- } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) {
- start /= 4;
- start *= 4;
- end = length/4;
- end *= 4;
- end += start;
- } else if (encoding->mblen_table != NULL) {
- mbtab = encoding->mblen_table;
- start = 0;
- end = 0;
- n = 0;
- p = string->val;
- if (p != NULL) {
- /* search start position */
- for (;;) {
- m = mbtab[*p];
- n += m;
- p += m;
- if (n > from) {
- break;
- }
- start = n;
- }
- /* search end position */
- k = start + length;
- if (k >= (int)string->len) {
- end = string->len;
- } else {
- end = start;
- while (n <= k) {
- end = n;
- m = mbtab[*p];
- n += m;
- p += m;
- }
- }
- }
- }
-
- if (start > len) {
- start = len;
- }
- if (start < 0) {
- start = 0;
- }
- if (end > len) {
- end = len;
- }
- if (end < 0) {
- end = 0;
- }
- if (start > end) {
- start = end;
- }
- /* allocate memory and copy string */
- n = end - start;
- result->len = 0;
- result->val = w = (unsigned char*)mbfl_malloc((n + 8)*sizeof(unsigned char));
- if (w != NULL) {
- result->len = n;
- p = &(string->val[start]);
- while (n > 0) {
- *w++ = *p++;
- n--;
- }
- *w++ = '\0';
- *w++ = '\0';
- *w++ = '\0';
- *w = '\0';
- } else {
- result = NULL;
- }
- } else {
- /* wchar filter */
- encoder = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- mbfl_filter_output_null, 0, 0 TSRMLS_CC);
- encoder_tmp = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- mbfl_filter_output_null, 0, 0 TSRMLS_CC);
- /* output code filter */
- decoder = mbfl_convert_filter_new(
- mbfl_no_encoding_wchar,
- string->no_encoding,
- mbfl_memory_device_output, 0, &device TSRMLS_CC);
- decoder_tmp = mbfl_convert_filter_new(
- mbfl_no_encoding_wchar,
- string->no_encoding,
- mbfl_memory_device_output, 0, &device TSRMLS_CC);
- if (encoder == NULL || encoder_tmp == NULL || decoder == NULL || decoder_tmp == NULL) {
- mbfl_convert_filter_delete(encoder TSRMLS_CC);
- mbfl_convert_filter_delete(encoder_tmp TSRMLS_CC);
- mbfl_convert_filter_delete(decoder TSRMLS_CC);
- mbfl_convert_filter_delete(decoder_tmp TSRMLS_CC);
- return NULL;
- }
- mbfl_memory_device_init(&device, length + 8, 0 TSRMLS_CC);
- k = 0;
- n = 0;
- p = string->val;
- if (p != NULL) {
- /* seartch start position */
- while (n < from) {
- (*encoder->filter_function)(*p++, encoder TSRMLS_CC);
- n++;
- }
- /* output a little shorter than "length" */
- encoder->output_function = mbfl_filter_output_pipe;
- encoder->data = decoder;
- k = length - 20;
- len = string->len;
- while (n < len && device.pos < k) {
- (*encoder->filter_function)(*p++, encoder TSRMLS_CC);
- n++;
- }
- /* detect end position */
- for (;;) {
- /* backup current state */
- k = device.pos;
- mbfl_convert_filter_copy(encoder, encoder_tmp TSRMLS_CC);
- mbfl_convert_filter_copy(decoder, decoder_tmp TSRMLS_CC);
- if (n >= len) {
- break;
- }
- /* feed 1byte and flush */
- (*encoder->filter_function)(*p, encoder TSRMLS_CC);
- (*encoder->filter_flush)(encoder TSRMLS_CC);
- (*decoder->filter_flush)(decoder TSRMLS_CC);
- if (device.pos > length) {
- break;
- }
- /* restore filter and re-feed data */
- device.pos = k;
- mbfl_convert_filter_copy(encoder_tmp, encoder TSRMLS_CC);
- mbfl_convert_filter_copy(decoder_tmp, decoder TSRMLS_CC);
- (*encoder->filter_function)(*p, encoder TSRMLS_CC);
- p++;
- n++;
- }
- device.pos = k;
- mbfl_convert_filter_copy(encoder_tmp, encoder TSRMLS_CC);
- mbfl_convert_filter_copy(decoder_tmp, decoder TSRMLS_CC);
- mbfl_convert_filter_flush(encoder TSRMLS_CC);
- mbfl_convert_filter_flush(decoder TSRMLS_CC);
- }
- result = mbfl_memory_device_result(&device, result TSRMLS_CC);
- mbfl_convert_filter_delete(encoder TSRMLS_CC);
- mbfl_convert_filter_delete(encoder_tmp TSRMLS_CC);
- mbfl_convert_filter_delete(decoder TSRMLS_CC);
- mbfl_convert_filter_delete(decoder_tmp TSRMLS_CC);
- }
-
- return result;
-}
-
-
-/*
- * strwidth
- */
-static int
-filter_count_width(int c, void* data TSRMLS_DC)
-{
- if (c >= 0x20) {
- if (c < 0x2000 || (c > 0xff60 && c < 0xffa0)) {
- (*(int *)data)++;
- } else {
- (*(int *)data) += 2;
- }
- }
-
- return c;
-}
-
-int
-mbfl_strwidth(mbfl_string *string TSRMLS_DC)
-{
- int len, n;
- unsigned char *p;
- mbfl_convert_filter *filter;
-
- len = 0;
- if (string->len > 0 && string->val != NULL) {
- /* wchar filter */
- filter = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- filter_count_width, 0, &len TSRMLS_CC);
- if (filter == NULL) {
- mbfl_convert_filter_delete(filter TSRMLS_CC);
- return -1;
- }
-
- /* feed data */
- p = string->val;
- n = string->len;
- while (n > 0) {
- (*filter->filter_function)(*p++, filter TSRMLS_CC);
- n--;
- }
-
- mbfl_convert_filter_flush(filter TSRMLS_CC);
- mbfl_convert_filter_delete(filter TSRMLS_CC);
- }
-
- return len;
-}
-
-
-/*
- * strimwidth
- */
-struct collector_strimwidth_data {
- mbfl_convert_filter *decoder;
- mbfl_convert_filter *decoder_backup;
- mbfl_memory_device device;
- int from;
- int width;
- int outwidth;
- int outchar;
- int status;
- int endpos;
-};
-
-static int
-collector_strimwidth(int c, void* data TSRMLS_DC)
-{
- struct collector_strimwidth_data *pc = (struct collector_strimwidth_data*)data;
-
- switch (pc->status) {
- case 10:
- (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC);
- break;
- default:
- if (pc->outchar >= pc->from) {
- if (c >= 0x20) {
- if (c < 0x2000 || (c > 0xff60 && c < 0xffa0)) {
- pc->outwidth++;
- } else {
- pc->outwidth += 2;
- }
- }
- if (pc->outwidth > pc->width) {
- if (pc->status == 0) {
- pc->endpos = pc->device.pos;
- mbfl_convert_filter_copy(pc->decoder, pc->decoder_backup TSRMLS_CC);
- }
- pc->status++;
- (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC);
- c = -1;
- } else {
- (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC);
- }
- }
- pc->outchar++;
- break;
- }
-
- return c;
-}
-
-mbfl_string *
-mbfl_strimwidth(
- mbfl_string *string,
- mbfl_string *marker,
- mbfl_string *result,
- int from,
- int width TSRMLS_DC)
-{
- struct collector_strimwidth_data pc;
- mbfl_convert_filter *encoder;
- int n, mkwidth;
- unsigned char *p;
-
- if (string == NULL || result == NULL) {
- return NULL;
- }
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = string->no_encoding;
- mbfl_memory_device_init(&pc.device, width, 0 TSRMLS_CC);
-
- /* output code filter */
- pc.decoder = mbfl_convert_filter_new(
- mbfl_no_encoding_wchar,
- string->no_encoding,
- mbfl_memory_device_output, 0, &pc.device TSRMLS_CC);
- pc.decoder_backup = mbfl_convert_filter_new(
- mbfl_no_encoding_wchar,
- string->no_encoding,
- mbfl_memory_device_output, 0, &pc.device TSRMLS_CC);
- /* wchar filter */
- encoder = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- collector_strimwidth, 0, &pc TSRMLS_CC);
- if (pc.decoder == NULL || pc.decoder_backup == NULL || encoder == NULL) {
- mbfl_convert_filter_delete(encoder TSRMLS_CC);
- mbfl_convert_filter_delete(pc.decoder TSRMLS_CC);
- mbfl_convert_filter_delete(pc.decoder_backup TSRMLS_CC);
- return NULL;
- }
- mkwidth = 0;
- if (marker) {
- mkwidth = mbfl_strwidth(marker TSRMLS_CC);
- }
- pc.from = from;
- pc.width = width - mkwidth;
- pc.outwidth = 0;
- pc.outchar = 0;
- pc.status = 0;
- pc.endpos = 0;
-
- /* feed data */
- p = string->val;
- n = string->len;
- if (p != NULL) {
- while (n > 0) {
- n--;
- if ((*encoder->filter_function)(*p++, encoder TSRMLS_CC) < 0) {
- break;
- }
- }
- mbfl_convert_filter_flush(encoder TSRMLS_CC);
- if (pc.status != 0 && mkwidth > 0) {
- pc.width += mkwidth;
- while (n > 0) {
- if ((*encoder->filter_function)(*p++, encoder TSRMLS_CC) < 0) {
- break;
- }
- n--;
- }
- mbfl_convert_filter_flush(encoder TSRMLS_CC);
- if (pc.status != 1) {
- pc.status = 10;
- pc.device.pos = pc.endpos;
- mbfl_convert_filter_copy(pc.decoder_backup, pc.decoder TSRMLS_CC);
- mbfl_convert_filter_reset(encoder, marker->no_encoding, mbfl_no_encoding_wchar TSRMLS_CC);
- p = marker->val;
- n = marker->len;
- while (n > 0) {
- if ((*encoder->filter_function)(*p++, encoder TSRMLS_CC) < 0) {
- break;
- }
- n--;
- }
- mbfl_convert_filter_flush(encoder TSRMLS_CC);
- }
- } else if (pc.status != 0) {
- pc.device.pos = pc.endpos;
- mbfl_convert_filter_copy(pc.decoder_backup, pc.decoder TSRMLS_CC);
- }
- mbfl_convert_filter_flush(pc.decoder TSRMLS_CC);
- }
- result = mbfl_memory_device_result(&pc.device, result TSRMLS_CC);
- mbfl_convert_filter_delete(encoder TSRMLS_CC);
- mbfl_convert_filter_delete(pc.decoder TSRMLS_CC);
- mbfl_convert_filter_delete(pc.decoder_backup TSRMLS_CC);
-
- return result;
-}
-
-
-
-/*
- * convert Hankaku and Zenkaku
- */
-struct collector_hantozen_data {
- mbfl_convert_filter *next_filter;
- int mode;
- int status;
- int cache;
-};
-
-static const unsigned char hankana2zenkata_table[64] = {
- 0x00,0x02,0x0C,0x0D,0x01,0xFB,0xF2,0xA1,0xA3,0xA5,
- 0xA7,0xA9,0xE3,0xE5,0xE7,0xC3,0xFC,0xA2,0xA4,0xA6,
- 0xA8,0xAA,0xAB,0xAD,0xAF,0xB1,0xB3,0xB5,0xB7,0xB9,
- 0xBB,0xBD,0xBF,0xC1,0xC4,0xC6,0xC8,0xCA,0xCB,0xCC,
- 0xCD,0xCE,0xCF,0xD2,0xD5,0xD8,0xDB,0xDE,0xDF,0xE0,
- 0xE1,0xE2,0xE4,0xE6,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,
- 0xEF,0xF3,0x9B,0x9C
-};
-static const unsigned char hankana2zenhira_table[64] = {
- 0x00,0x02,0x0C,0x0D,0x01,0xFB,0x92,0x41,0x43,0x45,
- 0x47,0x49,0x83,0x85,0x87,0x63,0xFC,0x42,0x44,0x46,
- 0x48,0x4A,0x4B,0x4D,0x4F,0x51,0x53,0x55,0x57,0x59,
- 0x5B,0x5D,0x5F,0x61,0x64,0x66,0x68,0x6A,0x6B,0x6C,
- 0x6D,0x6E,0x6F,0x72,0x75,0x78,0x7B,0x7E,0x7F,0x80,
- 0x81,0x82,0x84,0x86,0x88,0x89,0x8A,0x8B,0x8C,0x8D,
- 0x8F,0x93,0x9B,0x9C
-};
-static const unsigned char zenkana2hankana_table[84][2] = {
- {0x67,0x00},{0x71,0x00},{0x68,0x00},{0x72,0x00},{0x69,0x00},
- {0x73,0x00},{0x6A,0x00},{0x74,0x00},{0x6B,0x00},{0x75,0x00},
- {0x76,0x00},{0x76,0x9E},{0x77,0x00},{0x77,0x9E},{0x78,0x00},
- {0x78,0x9E},{0x79,0x00},{0x79,0x9E},{0x7A,0x00},{0x7A,0x9E},
- {0x7B,0x00},{0x7B,0x9E},{0x7C,0x00},{0x7C,0x9E},{0x7D,0x00},
- {0x7D,0x9E},{0x7E,0x00},{0x7E,0x9E},{0x7F,0x00},{0x7F,0x9E},
- {0x80,0x00},{0x80,0x9E},{0x81,0x00},{0x81,0x9E},{0x6F,0x00},
- {0x82,0x00},{0x82,0x9E},{0x83,0x00},{0x83,0x9E},{0x84,0x00},
- {0x84,0x9E},{0x85,0x00},{0x86,0x00},{0x87,0x00},{0x88,0x00},
- {0x89,0x00},{0x8A,0x00},{0x8A,0x9E},{0x8A,0x9F},{0x8B,0x00},
- {0x8B,0x9E},{0x8B,0x9F},{0x8C,0x00},{0x8C,0x9E},{0x8C,0x9F},
- {0x8D,0x00},{0x8D,0x9E},{0x8D,0x9F},{0x8E,0x00},{0x8E,0x9E},
- {0x8E,0x9F},{0x8F,0x00},{0x90,0x00},{0x91,0x00},{0x92,0x00},
- {0x93,0x00},{0x6C,0x00},{0x94,0x00},{0x6D,0x00},{0x95,0x00},
- {0x6E,0x00},{0x96,0x00},{0x97,0x00},{0x98,0x00},{0x99,0x00},
- {0x9A,0x00},{0x9B,0x00},{0x9C,0x00},{0x9C,0x00},{0x72,0x00},
- {0x74,0x00},{0x66,0x00},{0x9D,0x00},{0x73,0x9E}
-};
-
-static int
-collector_hantozen(int c, void* data TSRMLS_DC)
-{
- int s, mode, n;
- struct collector_hantozen_data *pc = (struct collector_hantozen_data*)data;
-
- s = c;
- mode = pc->mode;
-
- if (mode & 0xf) { /* hankaku to zenkaku */
- if ((mode & 0x1) && c >= 0x21 && c <= 0x7d && c != 0x22 && c != 0x27 && c != 0x5c) { /* all except <"> <'> <\> <~> */
- s = c + 0xfee0;
- } else if ((mode & 0x2) && ((c >= 0x41 && c <= 0x5a) || (c >= 0x61 && c <= 0x7a))) { /* alpha */
- s = c + 0xfee0;
- } else if ((mode & 0x4) && c >= 0x30 && c <= 0x39) { /* num */
- s = c + 0xfee0;
- } else if ((mode & 0x8) && c == 0x20) { /* spase */
- s = 0x3000;
- }
- }
-
- if (mode & 0xf0) { /* zenkaku to hankaku */
- if ((mode & 0x10) && c >= 0xff01 && c <= 0xff5d && c != 0xff02 && c != 0xff07 && c!= 0xff3c) { /* all except <"> <'> <\> <~> */
- s = c - 0xfee0;
- } else if ((mode & 0x20) && ((c >= 0xff21 && c <= 0xff3a) || (c >= 0xff41 && c <= 0xff5a))) { /* alpha */
- s = c - 0xfee0;
- } else if ((mode & 0x40) && (c >= 0xff10 && c <= 0xff19)) { /* num */
- s = c - 0xfee0;
- } else if ((mode & 0x80) && (c == 0x3000)) { /* spase */
- s = 0x20;
- } else if ((mode & 0x10) && (c == 0x2212)) { /* MINUS SIGN */
- s = 0x2d;
- }
- }
-
- if (mode & 0x300) { /* hankaku kana to zenkaku kana */
- if ((mode & 0x100) && (mode & 0x800)) { /* hankaku kana to zenkaku katakana and glue voiced sound mark */
- if (c >= 0xff61 && c <= 0xff9f) {
- if (pc->status) {
- n = (pc->cache - 0xff60) & 0x3f;
- if (c == 0xff9e && ((n >= 22 && n <= 36) || (n >= 42 && n <= 46))) {
- pc->status = 0;
- s = 0x3001 + hankana2zenkata_table[n];
- } else if (c == 0xff9e && n == 19) {
- pc->status = 0;
- s = 0x30f4;
- } else if (c == 0xff9f && (n >= 42 && n <= 46)) {
- pc->status = 0;
- s = 0x3002 + hankana2zenkata_table[n];
- } else {
- pc->status = 1;
- pc->cache = c;
- s = 0x3000 + hankana2zenkata_table[n];
- }
- } else {
- pc->status = 1;
- pc->cache = c;
- return c;
- }
- } else {
- if (pc->status) {
- n = (pc->cache - 0xff60) & 0x3f;
- pc->status = 0;
- (*pc->next_filter->filter_function)(0x3000 + hankana2zenkata_table[n], pc->next_filter TSRMLS_CC);
- }
- }
- } else if ((mode & 0x200) && (mode & 0x800)) { /* hankaku kana to zenkaku hirangana and glue voiced sound mark */
- if (c >= 0xff61 && c <= 0xff9f) {
- if (pc->status) {
- n = (pc->cache - 0xff60) & 0x3f;
- if (c == 0xff9e && ((n >= 22 && n <= 36) || (n >= 42 && n <= 46))) {
- pc->status = 0;
- s = 0x3001 + hankana2zenhira_table[n];
- } else if (c == 0xff9f && (n >= 42 && n <= 46)) {
- pc->status = 0;
- s = 0x3002 + hankana2zenhira_table[n];
- } else {
- pc->status = 1;
- pc->cache = c;
- s = 0x3000 + hankana2zenhira_table[n];
- }
- } else {
- pc->status = 1;
- pc->cache = c;
- return c;
- }
- } else {
- if (pc->status) {
- n = (pc->cache - 0xff60) & 0x3f;
- pc->status = 0;
- (*pc->next_filter->filter_function)(0x3000 + hankana2zenhira_table[n], pc->next_filter TSRMLS_CC);
- }
- }
- } else if ((mode & 0x100) && c >= 0xff61 && c <= 0xff9f) { /* hankaku kana to zenkaku katakana */
- s = 0x3000 + hankana2zenkata_table[c - 0xff60];
- } else if ((mode & 0x200) && c >= 0xff61 && c <= 0xff9f) { /* hankaku kana to zenkaku hirangana */
- s = 0x3000 + hankana2zenhira_table[c - 0xff60];
- }
- }
-
- if (mode & 0x3000) { /* Zenkaku kana to hankaku kana */
- if ((mode & 0x1000) && c >= 0x30a1 && c <= 0x30f4) { /* Zenkaku katakana to hankaku kana */
- n = c - 0x30a1;
- if (zenkana2hankana_table[n][1] != 0) {
- (*pc->next_filter->filter_function)(0xff00 + zenkana2hankana_table[n][0], pc->next_filter TSRMLS_CC);
- s = 0xff00 + zenkana2hankana_table[n][1];
- } else {
- s = 0xff00 + zenkana2hankana_table[n][0];
- }
- } else if ((mode & 0x2000) && c >= 0x3041 && c <= 0x3093) { /* Zenkaku hirangana to hankaku kana */
- n = c - 0x3041;
- if (zenkana2hankana_table[n][1] != 0) {
- (*pc->next_filter->filter_function)(0xff00 + zenkana2hankana_table[n][0], pc->next_filter TSRMLS_CC);
- s = 0xff00 + zenkana2hankana_table[n][1];
- } else {
- s = 0xff00 + zenkana2hankana_table[n][0];
- }
- } else if (c == 0x3001) {
- s = 0xff64; /* HALFWIDTH IDEOGRAPHIC COMMA */
- } else if (c == 0x3002) {
- s = 0xff61; /* HALFWIDTH IDEOGRAPHIC FULL STOP */
- } else if (c == 0x300c) {
- s = 0xff62; /* HALFWIDTH LEFT CORNER BRACKET */
- } else if (c == 0x300d) {
- s = 0xff63; /* HALFWIDTH RIGHT CORNER BRACKET */
- } else if (c == 0x309b) {
- s = 0xff9e; /* HALFWIDTH KATAKANA VOICED SOUND MARK */
- } else if (c == 0x309c) {
- s = 0xff9f; /* HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK */
- } else if (c == 0x30fc) {
- s = 0xff70; /* HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK */
- } else if (c == 0x30fb) {
- s = 0xff65; /* HALFWIDTH KATAKANA MIDDLE DOT */
- }
- } else if (mode & 0x30000) {
- if ((mode & 0x10000) && c >= 0x3041 && c <= 0x3093) { /* Zenkaku hirangana to Zenkaku katakana */
- s = c + 0x60;
- } else if ((mode & 0x20000) && c >= 0x30a1 && c <= 0x30f3) { /* Zenkaku katakana to Zenkaku hirangana */
- s = c - 0x60;
- }
- }
-
- if (mode & 0x100000) { /* special ascii to symbol */
- if (c == 0x5c) {
- s = 0xffe5; /* FULLWIDTH YEN SIGN */
- } else if (c == 0xa5) { /* YEN SIGN */
- s = 0xffe5; /* FULLWIDTH YEN SIGN */
- } else if (c == 0x7e) {
- s = 0xffe3; /* FULLWIDTH MACRON */
- } else if (c == 0x203e) { /* OVERLINE */
- s = 0xffe3; /* FULLWIDTH MACRON */
- } else if (c == 0x27) {
- s = 0x2019; /* RIGHT SINGLE QUOTATION MARK */
- } else if (c == 0x22) {
- s = 0x201d; /* RIGHT DOUBLE QUOTATION MARK */
- }
- } else if (mode & 0x200000) { /* special symbol to ascii */
- if (c == 0xffe5) { /* FULLWIDTH YEN SIGN */
- s = 0x5c;
- } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s = 0x5c;
- } else if (c == 0xffe3) { /* FULLWIDTH MACRON */
- s = 0x7e;
- } else if (c == 0x203e) { /* OVERLINE */
- s = 0x7e;
- } else if (c == 0x2018) { /* LEFT SINGLE QUOTATION MARK*/
- s = 0x27;
- } else if (c == 0x2019) { /* RIGHT SINGLE QUOTATION MARK */
- s = 0x27;
- } else if (c == 0x201c) { /* LEFT DOUBLE QUOTATION MARK */
- s = 0x22;
- } else if (c == 0x201d) { /* RIGHT DOUBLE QUOTATION MARK */
- s = 0x22;
- }
- }
-
- if (mode & 0x400000) { /* special ascii to symbol */
- if (c == 0x5c) {
- s = 0xff3c; /* FULLWIDTH REVERSE SOLIDUS */
- } else if (c == 0x7e) {
- s = 0xff5e; /* FULLWIDTH TILDE */
- } else if (c == 0x27) {
- s = 0xff07; /* FULLWIDTH APOSTROPHE */
- } else if (c == 0x22) {
- s = 0xff02; /* FULLWIDTH QUOTATION MARK */
- }
- } else if (mode & 0x800000) { /* special symbol to ascii */
- if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s = 0x5c;
- } else if (c == 0xff5e) { /* FULLWIDTH TILDE */
- s = 0x7e;
- } else if (c == 0xff07) { /* FULLWIDTH APOSTROPHE */
- s = 0x27;
- } else if (c == 0xff02) { /* FULLWIDTH QUOTATION MARK */
- s = 0x22;
- }
- }
-
- return (*pc->next_filter->filter_function)(s, pc->next_filter TSRMLS_CC);
-}
-
-static int
-collector_hantozen_flush(struct collector_hantozen_data *pc TSRMLS_DC)
-{
- int ret, n;
-
- ret = 0;
- if (pc->status) {
- n = (pc->cache - 0xff60) & 0x3f;
- if (pc->mode & 0x100) { /* hankaku kana to zenkaku katakana */
- ret = (*pc->next_filter->filter_function)(0x3000 + hankana2zenkata_table[n], pc->next_filter TSRMLS_CC);
- } else if (pc->mode & 0x200) { /* hankaku kana to zenkaku hirangana */
- ret = (*pc->next_filter->filter_function)(0x3000 + hankana2zenhira_table[n], pc->next_filter TSRMLS_CC);
- }
- pc->status = 0;
- }
-
- return ret;
-}
-
-mbfl_string *
-mbfl_ja_jp_hantozen(
- mbfl_string *string,
- mbfl_string *result,
- int mode TSRMLS_DC)
-{
- int n;
- unsigned char *p;
- const mbfl_encoding *encoding;
- mbfl_memory_device device;
- struct collector_hantozen_data pc;
- mbfl_convert_filter *decoder;
- mbfl_convert_filter *encoder;
-
- /* initialize */
- if (string == NULL || result == NULL) {
- return NULL;
- }
- encoding = mbfl_no2encoding(string->no_encoding);
- if (encoding == NULL) {
- return NULL;
- }
- mbfl_memory_device_init(&device, string->len, 0 TSRMLS_CC);
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = string->no_encoding;
- decoder = mbfl_convert_filter_new(
- mbfl_no_encoding_wchar,
- string->no_encoding,
- mbfl_memory_device_output, 0, &device TSRMLS_CC);
- encoder = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- collector_hantozen, 0, &pc TSRMLS_CC);
- if (decoder == NULL || encoder == NULL) {
- mbfl_convert_filter_delete(encoder TSRMLS_CC);
- mbfl_convert_filter_delete(decoder TSRMLS_CC);
- return NULL;
- }
- pc.next_filter = decoder;
- pc.mode = mode;
- pc.status = 0;
- pc.cache = 0;
-
- /* feed data */
- p = string->val;
- n = string->len;
- if (p != NULL) {
- while (n > 0) {
- if ((*encoder->filter_function)(*p++, encoder TSRMLS_CC) < 0) {
- break;
- }
- n--;
- }
- }
-
- mbfl_convert_filter_flush(encoder TSRMLS_CC);
- collector_hantozen_flush(&pc TSRMLS_CC);
- mbfl_convert_filter_flush(decoder TSRMLS_CC);
- result = mbfl_memory_device_result(&device, result TSRMLS_CC);
- mbfl_convert_filter_delete(encoder TSRMLS_CC);
- mbfl_convert_filter_delete(decoder TSRMLS_CC);
-
- return result;
-}
-
-
-/*
- * MIME header encode
- */
-struct mime_header_encoder_data {
- mbfl_convert_filter *conv1_filter;
- mbfl_convert_filter *block_filter;
- mbfl_convert_filter *conv2_filter;
- mbfl_convert_filter *conv2_filter_backup;
- mbfl_convert_filter *encod_filter;
- mbfl_convert_filter *encod_filter_backup;
- mbfl_memory_device outdev;
- mbfl_memory_device tmpdev;
- int status1;
- int status2;
- int prevpos;
- int linehead;
- int firstindent;
- int encnamelen;
- int lwsplen;
- char encname[128];
- char lwsp[16];
-};
-
-static int
-mime_header_encoder_block_collector(int c, void *data TSRMLS_DC)
-{
- int n;
- struct mime_header_encoder_data *pe = (struct mime_header_encoder_data *)data;
-
- switch (pe->status2) {
- case 1: /* encoded word */
- pe->prevpos = pe->outdev.pos;
- mbfl_convert_filter_copy(pe->conv2_filter, pe->conv2_filter_backup TSRMLS_CC);
- mbfl_convert_filter_copy(pe->encod_filter, pe->encod_filter_backup TSRMLS_CC);
- (*pe->conv2_filter->filter_function)(c, pe->conv2_filter TSRMLS_CC);
- (*pe->conv2_filter->filter_flush)(pe->conv2_filter TSRMLS_CC);
- (*pe->encod_filter->filter_flush)(pe->encod_filter TSRMLS_CC);
- n = pe->outdev.pos - pe->linehead + pe->firstindent;
- pe->outdev.pos = pe->prevpos;
- mbfl_convert_filter_copy(pe->conv2_filter_backup, pe->conv2_filter TSRMLS_CC);
- mbfl_convert_filter_copy(pe->encod_filter_backup, pe->encod_filter TSRMLS_CC);
- if (n >= 74) {
- (*pe->conv2_filter->filter_flush)(pe->conv2_filter TSRMLS_CC);
- (*pe->encod_filter->filter_flush)(pe->encod_filter TSRMLS_CC);
- mbfl_memory_device_strncat(&pe->outdev, "\x3f\x3d", 2 TSRMLS_CC); /* ?= */
- mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen TSRMLS_CC);
- pe->linehead = pe->outdev.pos;
- pe->firstindent = 0;
- mbfl_memory_device_strncat(&pe->outdev, pe->encname, pe->encnamelen TSRMLS_CC);
- c = (*pe->conv2_filter->filter_function)(c, pe->conv2_filter TSRMLS_CC);
- } else {
- c = (*pe->conv2_filter->filter_function)(c, pe->conv2_filter TSRMLS_CC);
- }
- break;
-
- default:
- mbfl_memory_device_strncat(&pe->outdev, pe->encname, pe->encnamelen TSRMLS_CC);
- c = (*pe->conv2_filter->filter_function)(c, pe->conv2_filter TSRMLS_CC);
- pe->status2 = 1;
- break;
- }
-
- return c;
-}
-
-static int
-mime_header_encoder_collector(int c, void *data TSRMLS_DC)
-{
- int n;
- struct mime_header_encoder_data *pe = (struct mime_header_encoder_data *)data;
-
- switch (pe->status1) {
- case 11: /* encoded word */
- (*pe->block_filter->filter_function)(c, pe->block_filter TSRMLS_CC);
- break;
-
- default: /* ASCII */
- if (c >= 0x21 && c < 0x7f) { /* ASCII exclude SPACE and CTLs */
- mbfl_memory_device_output(c, &pe->tmpdev TSRMLS_CC);
- pe->status1 = 1;
- } else if (pe->status1 == 0 && c == 0x20) { /* repeat SPACE */
- mbfl_memory_device_output(c, &pe->tmpdev TSRMLS_CC);
- } else {
- if (pe->tmpdev.pos < 74 && c == 0x20) {
- n = pe->outdev.pos - pe->linehead + pe->tmpdev.pos + pe->firstindent;
- if (n > 74) {
- mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen TSRMLS_CC); /* LWSP */
- pe->linehead = pe->outdev.pos;
- pe->firstindent = 0;
- } else if (pe->outdev.pos > 0) {
- mbfl_memory_device_output(0x20, &pe->outdev TSRMLS_CC);
- }
- mbfl_memory_device_devcat(&pe->outdev, &pe->tmpdev TSRMLS_CC);
- mbfl_memory_device_reset(&pe->tmpdev TSRMLS_CC);
- pe->status1 = 0;
- } else {
- n = pe->outdev.pos - pe->linehead + pe->encnamelen + pe->firstindent;
- if (n > 60) {
- mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen TSRMLS_CC); /* LWSP */
- pe->linehead = pe->outdev.pos;
- pe->firstindent = 0;
- } else if (pe->outdev.pos > 0) {
- mbfl_memory_device_output(0x20, &pe->outdev TSRMLS_CC);
- }
- mbfl_convert_filter_devcat(pe->block_filter, &pe->tmpdev TSRMLS_CC);
- mbfl_memory_device_reset(&pe->tmpdev TSRMLS_CC);
- (*pe->block_filter->filter_function)(c, pe->block_filter TSRMLS_CC);
- pe->status1 = 11;
- }
- }
- break;
- }
-
- return c;
-}
-
-mbfl_string *
-mime_header_encoder_result(struct mime_header_encoder_data *pe, mbfl_string *result TSRMLS_DC)
-{
- if (pe->status1 >= 10) {
- (*pe->conv2_filter->filter_flush)(pe->conv2_filter TSRMLS_CC);
- (*pe->encod_filter->filter_flush)(pe->encod_filter TSRMLS_CC);
- mbfl_memory_device_strncat(&pe->outdev, "\x3f\x3d", 2 TSRMLS_CC); /* ?= */
- } else if (pe->tmpdev.pos > 0) {
- if (pe->outdev.pos > 0) {
- if ((pe->outdev.pos - pe->linehead + pe->tmpdev.pos) > 74) {
- mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen TSRMLS_CC);
- } else {
- mbfl_memory_device_output(0x20, &pe->outdev TSRMLS_CC);
- }
- }
- mbfl_memory_device_devcat(&pe->outdev, &pe->tmpdev TSRMLS_CC);
- }
- mbfl_memory_device_reset(&pe->tmpdev TSRMLS_CC);
- pe->prevpos = 0;
- pe->linehead = 0;
- pe->status1 = 0;
- pe->status2 = 0;
-
- return mbfl_memory_device_result(&pe->outdev, result TSRMLS_CC);
-}
-
-struct mime_header_encoder_data*
-mime_header_encoder_new(
- enum mbfl_no_encoding incode,
- enum mbfl_no_encoding outcode,
- enum mbfl_no_encoding transenc TSRMLS_DC)
-{
- int n;
- const char *s;
- const mbfl_encoding *outencoding;
- struct mime_header_encoder_data *pe;
-
- /* get output encoding and check MIME charset name */
- outencoding = mbfl_no2encoding(outcode);
- if (outencoding == NULL || outencoding->mime_name == NULL || outencoding->mime_name[0] == '\0') {
- return NULL;
- }
-
- pe = (struct mime_header_encoder_data*)mbfl_malloc(sizeof(struct mime_header_encoder_data));
- if (pe == NULL) {
- return NULL;
- }
-
- mbfl_memory_device_init(&pe->outdev, 0, 0 TSRMLS_CC);
- mbfl_memory_device_init(&pe->tmpdev, 0, 0 TSRMLS_CC);
- pe->prevpos = 0;
- pe->linehead = 0;
- pe->firstindent = 0;
- pe->status1 = 0;
- pe->status2 = 0;
-
- /* make the encoding description string exp. "=?ISO-2022-JP?B?" */
- n = 0;
- pe->encname[n++] = 0x3d;
- pe->encname[n++] = 0x3f;
- s = outencoding->mime_name;
- while (*s) {
- pe->encname[n++] = *s++;
- }
- pe->encname[n++] = 0x3f;
- if (transenc == mbfl_no_encoding_qprint) {
- pe->encname[n++] = 0x51;
- } else {
- pe->encname[n++] = 0x42;
- transenc = mbfl_no_encoding_base64;
- }
- pe->encname[n++] = 0x3f;
- pe->encname[n] = '\0';
- pe->encnamelen = n;
-
- n = 0;
- pe->lwsp[n++] = 0x0d;
- pe->lwsp[n++] = 0x0a;
- pe->lwsp[n++] = 0x20;
- pe->lwsp[n] = '\0';
- pe->lwsplen = n;
-
- /* transfer encode filter */
- pe->encod_filter = mbfl_convert_filter_new(outcode, transenc, mbfl_memory_device_output, 0, &(pe->outdev) TSRMLS_CC);
- pe->encod_filter_backup = mbfl_convert_filter_new(outcode, transenc, mbfl_memory_device_output, 0, &(pe->outdev) TSRMLS_CC);
-
- /* Output code filter */
- pe->conv2_filter = mbfl_convert_filter_new(mbfl_no_encoding_wchar, outcode, mbfl_filter_output_pipe, 0, pe->encod_filter TSRMLS_CC);
- pe->conv2_filter_backup = mbfl_convert_filter_new(mbfl_no_encoding_wchar, outcode, mbfl_filter_output_pipe, 0, pe->encod_filter TSRMLS_CC);
-
- /* encoded block filter */
- pe->block_filter = mbfl_convert_filter_new(mbfl_no_encoding_wchar, mbfl_no_encoding_wchar, mime_header_encoder_block_collector, 0, pe TSRMLS_CC);
-
- /* Input code filter */
- pe->conv1_filter = mbfl_convert_filter_new(incode, mbfl_no_encoding_wchar, mime_header_encoder_collector, 0, pe TSRMLS_CC);
-
- if (pe->encod_filter == NULL ||
- pe->encod_filter_backup == NULL ||
- pe->conv2_filter == NULL ||
- pe->conv2_filter_backup == NULL ||
- pe->conv1_filter == NULL) {
- mime_header_encoder_delete(pe TSRMLS_CC);
- return NULL;
- }
-
- if (transenc == mbfl_no_encoding_qprint) {
- pe->encod_filter->status |= MBFL_QPRINT_STS_MIME_HEADER;
- pe->encod_filter_backup->status |= MBFL_QPRINT_STS_MIME_HEADER;
- } else {
- pe->encod_filter->status |= MBFL_BASE64_STS_MIME_HEADER;
- pe->encod_filter_backup->status |= MBFL_BASE64_STS_MIME_HEADER;
- }
-
- return pe;
-}
-
-void
-mime_header_encoder_delete(struct mime_header_encoder_data *pe TSRMLS_DC)
-{
- if (pe) {
- mbfl_convert_filter_delete(pe->conv1_filter TSRMLS_CC);
- mbfl_convert_filter_delete(pe->block_filter TSRMLS_CC);
- mbfl_convert_filter_delete(pe->conv2_filter TSRMLS_CC);
- mbfl_convert_filter_delete(pe->conv2_filter_backup TSRMLS_CC);
- mbfl_convert_filter_delete(pe->encod_filter TSRMLS_CC);
- mbfl_convert_filter_delete(pe->encod_filter_backup TSRMLS_CC);
- mbfl_memory_device_clear(&pe->outdev TSRMLS_CC);
- mbfl_memory_device_clear(&pe->tmpdev TSRMLS_CC);
- mbfl_free((void*)pe);
- }
-}
-
-int
-mime_header_encoder_feed(int c, struct mime_header_encoder_data *pe TSRMLS_DC)
-{
- return (*pe->conv1_filter->filter_function)(c, pe->conv1_filter TSRMLS_CC);
-}
-
-mbfl_string *
-mbfl_mime_header_encode(
- mbfl_string *string,
- mbfl_string *result,
- enum mbfl_no_encoding outcode,
- enum mbfl_no_encoding encoding,
- const char *linefeed,
- int indent TSRMLS_DC)
-{
- int n;
- unsigned char *p;
- struct mime_header_encoder_data *pe;
-
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = mbfl_no_encoding_ascii;
-
- pe = mime_header_encoder_new(string->no_encoding, outcode, encoding TSRMLS_CC);
- if (pe == NULL) {
- return NULL;
- }
-
- if (linefeed != NULL) {
- n = 0;
- while (*linefeed && n < 8) {
- pe->lwsp[n++] = *linefeed++;
- }
- pe->lwsp[n++] = 0x20;
- pe->lwsp[n] = '\0';
- pe->lwsplen = n;
- }
- if (indent > 0 && indent < 74) {
- pe->firstindent = indent;
- }
-
- n = string->len;
- p = string->val;
- while (n > 0) {
- (*pe->conv1_filter->filter_function)(*p++, pe->conv1_filter TSRMLS_CC);
- n--;
- }
-
- result = mime_header_encoder_result(pe, result TSRMLS_CC);
- mime_header_encoder_delete(pe TSRMLS_CC);
-
- return result;
-}
-
-
-/*
- * MIME header decode
- */
-struct mime_header_decoder_data {
- mbfl_convert_filter *deco_filter;
- mbfl_convert_filter *conv1_filter;
- mbfl_convert_filter *conv2_filter;
- mbfl_memory_device outdev;
- mbfl_memory_device tmpdev;
- int cspos;
- int status;
- enum mbfl_no_encoding encoding;
- enum mbfl_no_encoding incode;
- enum mbfl_no_encoding outcode;
-};
-
-static int
-mime_header_decoder_collector(int c, void* data TSRMLS_DC)
-{
- const mbfl_encoding *encoding;
- struct mime_header_decoder_data *pd = (struct mime_header_decoder_data*)data;
-
- switch (pd->status) {
- case 1:
- if (c == 0x3f) { /* ? */
- mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC);
- pd->cspos = pd->tmpdev.pos;
- pd->status = 2;
- } else {
- mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev TSRMLS_CC);
- mbfl_memory_device_reset(&pd->tmpdev TSRMLS_CC);
- if (c == 0x3d) { /* = */
- mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC);
- } else if (c == 0x0d || c == 0x0a) { /* CR or LF */
- pd->status = 9;
- } else {
- (*pd->conv1_filter->filter_function)(c, pd->conv1_filter TSRMLS_CC);
- pd->status = 0;
- }
- }
- break;
- case 2: /* store charset string */
- if (c == 0x3f) { /* ? */
- /* identify charset */
- mbfl_memory_device_output('\0', &pd->tmpdev TSRMLS_CC);
- encoding = mbfl_name2encoding((const char *)&pd->tmpdev.buffer[pd->cspos]);
- if (encoding != NULL) {
- pd->incode = encoding->no_encoding;
- pd->status = 3;
- }
- mbfl_memory_device_unput(&pd->tmpdev TSRMLS_CC);
- mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC);
- } else {
- mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC);
- if (pd->tmpdev.pos > 100) { /* too long charset string */
- pd->status = 0;
- } else if (c == 0x0d || c == 0x0a) { /* CR or LF */
- mbfl_memory_device_unput(&pd->tmpdev TSRMLS_CC);
- pd->status = 9;
- }
- if (pd->status != 2) {
- mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev TSRMLS_CC);
- mbfl_memory_device_reset(&pd->tmpdev TSRMLS_CC);
- }
- }
- break;
- case 3: /* identify encoding */
- mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC);
- if (c == 0x42 || c == 0x62) { /* 'B' or 'b' */
- pd->encoding = mbfl_no_encoding_base64;
- pd->status = 4;
- } else if (c == 0x51 || c == 0x71) { /* 'Q' or 'q' */
- pd->encoding = mbfl_no_encoding_qprint;
- pd->status = 4;
- } else {
- if (c == 0x0d || c == 0x0a) { /* CR or LF */
- mbfl_memory_device_unput(&pd->tmpdev TSRMLS_CC);
- pd->status = 9;
- } else {
- pd->status = 0;
- }
- mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev TSRMLS_CC);
- mbfl_memory_device_reset(&pd->tmpdev TSRMLS_CC);
- }
- break;
- case 4: /* reset filter */
- mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC);
- if (c == 0x3f) { /* ? */
- /* charset convert filter */
- mbfl_convert_filter_reset(pd->conv1_filter, pd->incode, mbfl_no_encoding_wchar TSRMLS_CC);
- /* decode filter */
- mbfl_convert_filter_reset(pd->deco_filter, pd->encoding, mbfl_no_encoding_8bit TSRMLS_CC);
- pd->status = 5;
- } else {
- if (c == 0x0d || c == 0x0a) { /* CR or LF */
- mbfl_memory_device_unput(&pd->tmpdev TSRMLS_CC);
- pd->status = 9;
- } else {
- pd->status = 0;
- }
- mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev TSRMLS_CC);
- }
- mbfl_memory_device_reset(&pd->tmpdev TSRMLS_CC);
- break;
- case 5: /* encoded block */
- if (c == 0x3f) { /* ? */
- pd->status = 6;
- } else {
- (*pd->deco_filter->filter_function)(c, pd->deco_filter TSRMLS_CC);
- }
- break;
- case 6: /* check end position */
- if (c == 0x3d) { /* = */
- /* flush and reset filter */
- (*pd->deco_filter->filter_flush)(pd->deco_filter TSRMLS_CC);
- (*pd->conv1_filter->filter_flush)(pd->conv1_filter TSRMLS_CC);
- mbfl_convert_filter_reset(pd->conv1_filter, mbfl_no_encoding_ascii, mbfl_no_encoding_wchar TSRMLS_CC);
- pd->status = 7;
- } else {
- (*pd->deco_filter->filter_function)(0x3f, pd->deco_filter TSRMLS_CC);
- if (c != 0x3f) { /* ? */
- (*pd->deco_filter->filter_function)(c, pd->deco_filter TSRMLS_CC);
- pd->status = 5;
- }
- }
- break;
- case 7: /* after encoded block */
- if (c == 0x0d || c == 0x0a) { /* CR LF */
- pd->status = 8;
- } else {
- mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC);
- if (c == 0x3d) { /* = */
- pd->status = 1;
- } else if (c != 0x20 && c != 0x09) { /* not space */
- mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev TSRMLS_CC);
- mbfl_memory_device_reset(&pd->tmpdev TSRMLS_CC);
- pd->status = 0;
- }
- }
- break;
- case 8: /* folding */
- case 9: /* folding */
- if (c != 0x0d && c != 0x0a && c != 0x20 && c != 0x09) {
- if (c == 0x3d) { /* = */
- if (pd->status == 8) {
- mbfl_memory_device_output(0x20, &pd->tmpdev TSRMLS_CC); /* SPACE */
- } else {
- (*pd->conv1_filter->filter_function)(0x20, pd->conv1_filter TSRMLS_CC);
- }
- mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC);
- pd->status = 1;
- } else {
- mbfl_memory_device_output(0x20, &pd->tmpdev TSRMLS_CC);
- mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC);
- mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev TSRMLS_CC);
- mbfl_memory_device_reset(&pd->tmpdev TSRMLS_CC);
- pd->status = 0;
- }
- }
- break;
- default: /* non encoded block */
- if (c == 0x0d || c == 0x0a) { /* CR LF */
- pd->status = 9;
- } else if (c == 0x3d) { /* = */
- mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC);
- pd->status = 1;
- } else {
- (*pd->conv1_filter->filter_function)(c, pd->conv1_filter TSRMLS_CC);
- }
- break;
- }
-
- return c;
-}
-
-mbfl_string *
-mime_header_decoder_result(struct mime_header_decoder_data *pd, mbfl_string *result TSRMLS_DC)
-{
- switch (pd->status) {
- case 1:
- case 2:
- case 3:
- case 4:
- case 7:
- case 8:
- case 9:
- mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev TSRMLS_CC);
- break;
- case 5:
- case 6:
- (*pd->deco_filter->filter_flush)(pd->deco_filter TSRMLS_CC);
- (*pd->conv1_filter->filter_flush)(pd->conv1_filter TSRMLS_CC);
- break;
- }
- (*pd->conv2_filter->filter_flush)(pd->conv2_filter TSRMLS_CC);
- mbfl_memory_device_reset(&pd->tmpdev TSRMLS_CC);
- pd->status = 0;
-
- return mbfl_memory_device_result(&pd->outdev, result TSRMLS_CC);
-}
-
-struct mime_header_decoder_data*
-mime_header_decoder_new(enum mbfl_no_encoding outcode TSRMLS_DC)
-{
- struct mime_header_decoder_data *pd;
-
- pd = (struct mime_header_decoder_data*)mbfl_malloc(sizeof(struct mime_header_decoder_data));
- if (pd == NULL) {
- return NULL;
- }
-
- mbfl_memory_device_init(&pd->outdev, 0, 0 TSRMLS_CC);
- mbfl_memory_device_init(&pd->tmpdev, 0, 0 TSRMLS_CC);
- pd->cspos = 0;
- pd->status = 0;
- pd->encoding = mbfl_no_encoding_pass;
- pd->incode = mbfl_no_encoding_ascii;
- pd->outcode = outcode;
- /* charset convert filter */
- pd->conv2_filter = mbfl_convert_filter_new(mbfl_no_encoding_wchar, pd->outcode, mbfl_memory_device_output, 0, &pd->outdev TSRMLS_CC);
- pd->conv1_filter = mbfl_convert_filter_new(pd->incode, mbfl_no_encoding_wchar, mbfl_filter_output_pipe, 0, pd->conv2_filter TSRMLS_CC);
- /* decode filter */
- pd->deco_filter = mbfl_convert_filter_new(pd->encoding, mbfl_no_encoding_8bit, mbfl_filter_output_pipe, 0, pd->conv1_filter TSRMLS_CC);
-
- if (pd->conv1_filter == NULL || pd->conv2_filter == NULL || pd->deco_filter == NULL) {
- mime_header_decoder_delete(pd TSRMLS_CC);
- return NULL;
- }
-
- return pd;
-}
-
-void
-mime_header_decoder_delete(struct mime_header_decoder_data *pd TSRMLS_DC)
-{
- if (pd) {
- mbfl_convert_filter_delete(pd->conv2_filter TSRMLS_CC);
- mbfl_convert_filter_delete(pd->conv1_filter TSRMLS_CC);
- mbfl_convert_filter_delete(pd->deco_filter TSRMLS_CC);
- mbfl_memory_device_clear(&pd->outdev TSRMLS_CC);
- mbfl_memory_device_clear(&pd->tmpdev TSRMLS_CC);
- mbfl_free((void*)pd);
- }
-}
-
-int
-mime_header_decoder_feed(int c, struct mime_header_decoder_data *pd TSRMLS_DC)
-{
- return mime_header_decoder_collector(c, pd TSRMLS_CC);
-}
-
-mbfl_string *
-mbfl_mime_header_decode(
- mbfl_string *string,
- mbfl_string *result,
- enum mbfl_no_encoding outcode TSRMLS_DC)
-{
- int n;
- unsigned char *p;
- struct mime_header_decoder_data *pd;
-
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = outcode;
-
- pd = mime_header_decoder_new(outcode TSRMLS_CC);
- if (pd == NULL) {
- return NULL;
- }
-
- /* feed data */
- n = string->len;
- p = string->val;
- while (n > 0) {
- mime_header_decoder_collector(*p++, pd TSRMLS_CC);
- n--;
- }
-
- result = mime_header_decoder_result(pd, result TSRMLS_CC);
- mime_header_decoder_delete(pd TSRMLS_CC);
-
- return result;
-}
-
-
-
-/*
- * convert HTML numeric entity
- */
-struct collector_htmlnumericentity_data {
- mbfl_convert_filter *decoder;
- int status;
- int cache;
- int digit;
- int *convmap;
- int mapsize;
-};
-
-static int
-collector_encode_htmlnumericentity(int c, void *data TSRMLS_DC)
-{
- struct collector_htmlnumericentity_data *pc = (struct collector_htmlnumericentity_data *)data;
- int f, n, s, r, d, size, *mapelm;
-
- size = pc->mapsize;
- f = 0;
- n = 0;
- while (n < size) {
- mapelm = &(pc->convmap[n*4]);
- if (c >= mapelm[0] && c <= mapelm[1]) {
- s = (c + mapelm[2]) & mapelm[3];
- if (s >= 0) {
- (*pc->decoder->filter_function)(0x26, pc->decoder TSRMLS_CC); /* '&' */
- (*pc->decoder->filter_function)(0x23, pc->decoder TSRMLS_CC); /* '#' */
- r = 100000000;
- s %= r;
- while (r > 0) {
- d = s/r;
- if (d || f) {
- f = 1;
- s %= r;
- (*pc->decoder->filter_function)(mbfl_hexchar_table[d], pc->decoder TSRMLS_CC);
- }
- r /= 10;
- }
- if (!f) {
- f = 1;
- (*pc->decoder->filter_function)(mbfl_hexchar_table[0], pc->decoder TSRMLS_CC);
- }
- (*pc->decoder->filter_function)(0x3b, pc->decoder TSRMLS_CC); /* ';' */
- }
- }
- if (f) {
- break;
- }
- n++;
- }
- if (!f) {
- (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC);
- }
-
- return c;
-}
-
-static int
-collector_decode_htmlnumericentity(int c, void *data TSRMLS_DC)
-{
- struct collector_htmlnumericentity_data *pc = (struct collector_htmlnumericentity_data *)data;
- int f, n, s, r, d, size, *mapelm;
-
- switch (pc->status) {
- case 1:
- if (c == 0x23) { /* '#' */
- pc->status = 2;
- } else {
- pc->status = 0;
- (*pc->decoder->filter_function)(0x26, pc->decoder TSRMLS_CC); /* '&' */
- (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC);
- }
- break;
- case 2:
- if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */
- pc->cache = c - 0x30;
- pc->status = 3;
- pc->digit = 1;
- } else {
- pc->status = 0;
- (*pc->decoder->filter_function)(0x26, pc->decoder TSRMLS_CC); /* '&' */
- (*pc->decoder->filter_function)(0x23, pc->decoder TSRMLS_CC); /* '#' */
- (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC);
- }
- break;
- case 3:
- s = 0;
- f = 0;
- if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */
- if (pc->digit > 9) {
- pc->status = 0;
- s = pc->cache;
- f = 1;
- } else {
- s = pc->cache*10 + c - 0x30;
- pc->cache = s;
- pc->digit++;
- }
- } else {
- pc->status = 0;
- s = pc->cache;
- f = 1;
- n = 0;
- size = pc->mapsize;
- while (n < size) {
- mapelm = &(pc->convmap[n*4]);
- d = s - mapelm[2];
- if (d >= mapelm[0] && d <= mapelm[1]) {
- f = 0;
- (*pc->decoder->filter_function)(d, pc->decoder TSRMLS_CC);
- if (c != 0x3b) { /* ';' */
- (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC);
- }
- break;
- }
- n++;
- }
- }
- if (f) {
- (*pc->decoder->filter_function)(0x26, pc->decoder TSRMLS_CC); /* '&' */
- (*pc->decoder->filter_function)(0x23, pc->decoder TSRMLS_CC); /* '#' */
- r = 1;
- n = pc->digit;
- while (n > 0) {
- r *= 10;
- n--;
- }
- s %= r;
- r /= 10;
- while (r > 0) {
- d = s/r;
- s %= r;
- r /= 10;
- (*pc->decoder->filter_function)(mbfl_hexchar_table[d], pc->decoder TSRMLS_CC);
- }
- (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC);
- }
- break;
- default:
- if (c == 0x26) { /* '&' */
- pc->status = 1;
- } else {
- (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC);
- }
- break;
- }
-
- return c;
-}
-
-mbfl_string *
-mbfl_html_numeric_entity(
- mbfl_string *string,
- mbfl_string *result,
- int *convmap,
- int mapsize,
- int type TSRMLS_DC)
-{
- struct collector_htmlnumericentity_data pc;
- mbfl_memory_device device;
- mbfl_convert_filter *encoder;
- int n;
- unsigned char *p;
-
- if (string == NULL || result == NULL) {
- return NULL;
- }
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = string->no_encoding;
- mbfl_memory_device_init(&device, string->len, 0 TSRMLS_CC);
-
- /* output code filter */
- pc.decoder = mbfl_convert_filter_new(
- mbfl_no_encoding_wchar,
- string->no_encoding,
- mbfl_memory_device_output, 0, &device TSRMLS_CC);
- /* wchar filter */
- if (type == 0) {
- encoder = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- collector_encode_htmlnumericentity, 0, &pc TSRMLS_CC);
- } else {
- encoder = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- collector_decode_htmlnumericentity, 0, &pc TSRMLS_CC);
- }
- if (pc.decoder == NULL || encoder == NULL) {
- mbfl_convert_filter_delete(encoder TSRMLS_CC);
- mbfl_convert_filter_delete(pc.decoder TSRMLS_CC);
- return NULL;
- }
- pc.status = 0;
- pc.cache = 0;
- pc.digit = 0;
- pc.convmap = convmap;
- pc.mapsize = mapsize;
-
- /* feed data */
- p = string->val;
- n = string->len;
- if (p != NULL) {
- while (n > 0) {
- if ((*encoder->filter_function)(*p++, encoder TSRMLS_CC) < 0) {
- break;
- }
- n--;
- }
- }
- mbfl_convert_filter_flush(encoder TSRMLS_CC);
- mbfl_convert_filter_flush(pc.decoder TSRMLS_CC);
- result = mbfl_memory_device_result(&device, result TSRMLS_CC);
- mbfl_convert_filter_delete(encoder TSRMLS_CC);
- mbfl_convert_filter_delete(pc.decoder TSRMLS_CC);
-
- return result;
-}
-
-#endif /* HAVE_MBSTRING */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/mbstring/mbfilter.h b/ext/mbstring/mbfilter.h
deleted file mode 100644
index f39ed8b2f5..0000000000
--- a/ext/mbstring/mbfilter.h
+++ /dev/null
@@ -1,597 +0,0 @@
-/* charset=UTF-8
- * vim: encoding=utf-8:
- * */
-
-/*
- * "streamable kanji code filter and converter"
- *
- * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved.
- *
- * This software is released under the GNU Lesser General Public License.
- * (Version 2.1, February 1999)
- * Please read the following detail of the licence (in japanese).
- *
- * ◆使用許諾æ¡ä»¶â—†
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•ã‚Œã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ
- * ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã«é–¢
- * ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ
- * ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利
- * ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用
- * ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’「GNU Lesser General Public License (Version 2.1, February
- * 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser
- * General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢
- * ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚
- *
- * 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã
- * ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“ã‚Œã¾ã§Library General
- * Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚
- * http://www.gnu.org/ --- GNUウェブサイト
- * http://www.gnu.org/copyleft/lesser.html --- ライセンス文é¢
- * ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。
- *
- * ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプロジェクトã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§
- * ã¯ã‚ã‚Šã¾ã›ã‚“。
- *
- * â—†ä¿è¨¼å†…容◆
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€æœŸå¾…ã•ã‚ŒãŸå‹•ä½œãƒ»æ©Ÿèƒ½ãƒ»æ€§èƒ½ã‚’æŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨­è¨ˆã•ã‚Œ
- * 開発ã•ã‚Œã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚ã‚Šã¾ã›ã‚“。ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€Œã“
- * ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•ã‚Œã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定ã®
- * 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•ã‚‰ã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•ã‚ŒãŸã‚Šæš—é»™ã«ç¤ºã•ã‚Œã¦ã„
- * ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åŠ¹ã§ã™ã€‚ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã—ãŸçµæžœãªã„ã—使
- * 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æ害
- * ã€ãƒ‡ãƒ¼ã‚¿ã®æ失ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æ害ã«ã¤ã„ã¦ã¯ã€ãã®æ害ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€…
- * ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è­¦å‘Šã•ã‚Œã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æ害ã®è³ 
- * å„ŸãŠã‚ˆã³è£œå¡«ã‚’è¡Œã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ»
- * 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚
- *
- * ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—†
- *
- * 〒102-0073
- * æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F
- * æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ
- * Phone: 03-3512-3655, Fax: 03-3512-3656
- * Email: sales@happysize.co.jp
- * Web: http://happysize.com/
- *
- * ◆著者◆
- *
- * 金本 茂 <sgk@happysize.co.jp>
- *
- * ◆履歴◆
- *
- * 1998/11/10 sgk implementation in C++
- * 1999/4/25 sgk Cã§æ›¸ããªãŠã—。
- * 1999/4/26 sgk 入力フィルタを実装。漢字コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’追加。
- * 1999/6/?? Unicodeサãƒãƒ¼ãƒˆã€‚
- * 1999/6/22 sgk ライセンスをLGPLã«å¤‰æ›´ã€‚
- *
- */
-
-/*
- * Unicode support
- *
- * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team.
- * All rights reserved.
- *
- */
-
-/*
- *
- * streamable kanji code filter and converter
- * mbfl : Multi Byte FiLter Liblary
- *
- */
-
-/* $Id$ */
-
-
-#ifndef MBFL_MBFILTER_H
-#define MBFL_MBFILTER_H
-
-enum mbfl_no_language {
- mbfl_no_language_invalid = -1,
- mbfl_no_language_neutral,
- mbfl_no_language_uni,
- mbfl_no_language_min,
- mbfl_no_language_catalan, /* ca */
- mbfl_no_language_danish, /* da */
- mbfl_no_language_german, /* de */
- mbfl_no_language_english, /* en */
- mbfl_no_language_estonian, /* et */
- mbfl_no_language_greek, /* el */
- mbfl_no_language_spanish, /* es */
- mbfl_no_language_french, /* fr */
- mbfl_no_language_italian, /* it */
- mbfl_no_language_japanese, /* ja */
- mbfl_no_language_korean, /* ko */
- mbfl_no_language_dutch, /* nl */
- mbfl_no_language_polish, /* pl */
- mbfl_no_language_portuguese, /* pt */
- mbfl_no_language_swedish, /* sv */
- mbfl_no_language_simplified_chinese, /* zh-cn */
- mbfl_no_language_traditional_chinese, /* zh-tw */
- mbfl_no_language_russian, /* ru */
- mbfl_no_language_max
-};
-
-enum mbfl_no_encoding {
- mbfl_no_encoding_invalid = -1,
- mbfl_no_encoding_pass,
- mbfl_no_encoding_auto,
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_byte2be,
- mbfl_no_encoding_byte2le,
- mbfl_no_encoding_byte4be,
- mbfl_no_encoding_byte4le,
- mbfl_no_encoding_base64,
- mbfl_no_encoding_uuencode,
- mbfl_no_encoding_html_ent,
- mbfl_no_encoding_qprint,
- mbfl_no_encoding_7bit,
- mbfl_no_encoding_8bit,
- mbfl_no_encoding_charset_min,
- mbfl_no_encoding_ucs4,
- mbfl_no_encoding_ucs4be,
- mbfl_no_encoding_ucs4le,
- mbfl_no_encoding_ucs2,
- mbfl_no_encoding_ucs2be,
- mbfl_no_encoding_ucs2le,
- mbfl_no_encoding_utf32,
- mbfl_no_encoding_utf32be,
- mbfl_no_encoding_utf32le,
- mbfl_no_encoding_utf16,
- mbfl_no_encoding_utf16be,
- mbfl_no_encoding_utf16le,
- mbfl_no_encoding_utf8,
- mbfl_no_encoding_utf7,
- mbfl_no_encoding_utf7imap,
- mbfl_no_encoding_ascii,
- mbfl_no_encoding_euc_jp,
- mbfl_no_encoding_sjis,
- mbfl_no_encoding_eucjp_win,
- mbfl_no_encoding_sjis_win,
- mbfl_no_encoding_sjis_mac,
- mbfl_no_encoding_jis,
- mbfl_no_encoding_2022jp,
- mbfl_no_encoding_cp1252,
- mbfl_no_encoding_8859_1,
- mbfl_no_encoding_8859_2,
- mbfl_no_encoding_8859_3,
- mbfl_no_encoding_8859_4,
- mbfl_no_encoding_8859_5,
- mbfl_no_encoding_8859_6,
- mbfl_no_encoding_8859_7,
- mbfl_no_encoding_8859_8,
- mbfl_no_encoding_8859_9,
- mbfl_no_encoding_8859_10,
- mbfl_no_encoding_8859_13,
- mbfl_no_encoding_8859_14,
- mbfl_no_encoding_8859_15,
- mbfl_no_encoding_euc_cn,
- mbfl_no_encoding_cp936,
- mbfl_no_encoding_euc_tw,
- mbfl_no_encoding_big5,
- mbfl_no_encoding_euc_kr,
- mbfl_no_encoding_2022kr,
- mbfl_no_encoding_uhc,
- mbfl_no_encoding_hz,
- mbfl_no_encoding_cp1251,
- mbfl_no_encoding_cp866,
- mbfl_no_encoding_koi8r,
- mbfl_no_encoding_charset_max
-};
-
-
-/*
- * language
- */
-typedef struct _mbfl_language {
- enum mbfl_no_language no_language;
- const char *name;
- const char *short_name;
- const char *(*aliases)[];
- enum mbfl_no_encoding mail_charset;
- enum mbfl_no_encoding mail_header_encoding;
- enum mbfl_no_encoding mail_body_encoding;
-} mbfl_language;
-
-
-/*
- * encoding
- */
-typedef struct _mbfl_encoding {
- enum mbfl_no_encoding no_encoding;
- const char *name;
- const char *mime_name;
- const char *(*aliases)[];
- const unsigned char *mblen_table;
- unsigned int flag;
-} mbfl_encoding;
-
-
-#define MBFL_ENCTYPE_SBCS 0x00000001
-#define MBFL_ENCTYPE_MBCS 0x00000002
-#define MBFL_ENCTYPE_WCS2BE 0x00000010
-#define MBFL_ENCTYPE_WCS2LE 0x00000020
-#define MBFL_ENCTYPE_MWC2BE 0x00000040
-#define MBFL_ENCTYPE_MWC2LE 0x00000080
-#define MBFL_ENCTYPE_WCS4BE 0x00000100
-#define MBFL_ENCTYPE_WCS4LE 0x00000200
-#define MBFL_ENCTYPE_MWC4BE 0x00000400
-#define MBFL_ENCTYPE_MWC4LE 0x00000800
-#define MBFL_ENCTYPE_SHFTCODE 0x00001000
-#define MBFL_ENCTYPE_HTML_ENT 0x00002000
-
-/* wchar plane, special charactor */
-#define MBFL_WCSPLANE_MASK 0xffff
-#define MBFL_WCSPLANE_UCS2MAX 0x00010000
-#define MBFL_WCSPLANE_SUPMIN 0x00010000
-#define MBFL_WCSPLANE_SUPMAX 0x00200000
-#define MBFL_WCSPLANE_JIS0208 0x70e10000 /* JIS HEX : 2121h - 7E7Eh */
-#define MBFL_WCSPLANE_JIS0212 0x70e20000 /* JIS HEX : 2121h - 7E7Eh */
-#define MBFL_WCSPLANE_WINCP932 0x70e30000 /* JIS HEX : 2121h - 9898h */
-#define MBFL_WCSPLANE_8859_1 0x70e40000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_2 0x70e50000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_3 0x70e60000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_4 0x70e70000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_5 0x70e80000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_6 0x70e90000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_7 0x70ea0000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_8 0x70eb0000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_9 0x70ec0000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_10 0x70ed0000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_13 0x70ee0000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_14 0x70ef0000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_15 0x70f00000 /* 00h - FFh */
-#define MBFL_WCSPLANE_KSC5601 0x70f10000 /* 2121h - 7E7Eh */
-#define MBFL_WCSPLANE_GB2312 0x70f20000 /* 2121h - 7E7Eh */
-#define MBFL_WCSPLANE_WINCP936 0x70f30000 /* 2121h - 9898h */
-#define MBFL_WCSPLANE_BIG5 0x70f40000 /* 2121h - 9898h */
-#define MBFL_WCSPLANE_CNS11643 0x70f50000 /* 2121h - 9898h */
-#define MBFL_WCSPLANE_UHC 0x70f60000 /* 8141h - fefeh */
-#define MBFL_WCSPLANE_CP1251 0x70f70000
-#define MBFL_WCSPLANE_CP866 0x70f80000
-#define MBFL_WCSPLANE_KOI8R 0x70f90000
-#define MBFL_WCSGROUP_MASK 0xffffff
-#define MBFL_WCSGROUP_UCS4MAX 0x70000000
-#define MBFL_WCSGROUP_WCHARMAX 0x78000000
-#define MBFL_WCSGROUP_THROUGH 0x78000000 /* 000000h - FFFFFFh */
-
-
-/*
- * string object
- */
-typedef struct _mbfl_string {
- enum mbfl_no_language no_language;
- enum mbfl_no_encoding no_encoding;
- unsigned char *val;
- unsigned int len;
-} mbfl_string;
-
-void mbfl_string_init(mbfl_string *string);
-void mbfl_string_init_set(mbfl_string *string, enum mbfl_no_language no_language, enum mbfl_no_encoding no_encoding);
-void mbfl_string_clear(mbfl_string *string);
-
-
-/*
- * language resolver
- */
-const mbfl_language * mbfl_name2language(const char *name);
-const mbfl_language * mbfl_no2language(enum mbfl_no_language no_language);
-enum mbfl_no_language mbfl_name2no_language(const char *name);
-const char * mbfl_no_language2name(enum mbfl_no_language no_language);
-
-
-/*
- * encoding resolver
- */
-const mbfl_encoding * mbfl_name2encoding(const char *name);
-const mbfl_encoding * mbfl_no2encoding(enum mbfl_no_encoding no_encoding);
-enum mbfl_no_encoding mbfl_name2no_encoding(const char *name);
-const char * mbfl_no_encoding2name(enum mbfl_no_encoding no_encoding);
-const char * mbfl_no2preferred_mime_name(enum mbfl_no_encoding no_encoding);
-int mbfl_is_support_encoding(const char *name);
-
-
-/*
- * memory output function
- */
-#define MBFL_MEMORY_DEVICE_ALLOC_SIZE 64
-
-typedef struct _mbfl_memory_device {
- unsigned char *buffer;
- int length;
- int pos;
- int allocsz;
-} mbfl_memory_device;
-
-typedef struct _mbfl_wchar_device {
- unsigned int *buffer;
- int length;
- int pos;
- int allocsz;
-} mbfl_wchar_device;
-
-void mbfl_memory_device_init(mbfl_memory_device *device, int initsz, int allocsz TSRMLS_DC);
-void mbfl_memory_device_realloc(mbfl_memory_device *device, int initsz, int allocsz TSRMLS_DC);
-void mbfl_memory_device_clear(mbfl_memory_device *device TSRMLS_DC);
-void mbfl_memory_device_reset(mbfl_memory_device *device TSRMLS_DC);
-mbfl_string * mbfl_memory_device_result(mbfl_memory_device *device, mbfl_string *result TSRMLS_DC);
-int mbfl_memory_device_output(int c, void *data TSRMLS_DC);
-int mbfl_memory_device_output2(int c, void *data TSRMLS_DC);
-int mbfl_memory_device_output4(int c, void *data TSRMLS_DC);
-int mbfl_memory_device_strcat(mbfl_memory_device *device, const char *psrc TSRMLS_DC);
-int mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, int len TSRMLS_DC);
-int mbfl_memory_device_devcat(mbfl_memory_device *dest, mbfl_memory_device *src TSRMLS_DC);
-
-void mbfl_wchar_device_init(mbfl_wchar_device *device TSRMLS_DC);
-int mbfl_wchar_device_output(int c, void *data TSRMLS_DC);
-
-
-/*
- * convert filter
- */
-#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE 0
-#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR 1
-#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG 2
-
-typedef struct _mbfl_convert_filter mbfl_convert_filter;
-
-struct _mbfl_convert_filter {
- void (*filter_ctor)(mbfl_convert_filter *filter TSRMLS_DC);
- void (*filter_dtor)(mbfl_convert_filter *filter TSRMLS_DC);
- int (*filter_function)(int c, mbfl_convert_filter *filter TSRMLS_DC);
- int (*filter_flush)(mbfl_convert_filter *filter TSRMLS_DC);
- int (*output_function)(int c, void *data TSRMLS_DC);
- int (*flush_function)(void *data TSRMLS_DC);
- void *data;
- int status;
- int cache;
- const mbfl_encoding *from;
- const mbfl_encoding *to;
- int illegal_mode;
- int illegal_substchar;
-};
-
-struct mbfl_convert_vtbl {
- enum mbfl_no_encoding from;
- enum mbfl_no_encoding to;
- void (*filter_ctor)(mbfl_convert_filter *filter TSRMLS_DC);
- void (*filter_dtor)(mbfl_convert_filter *filter TSRMLS_DC);
- int (*filter_function)(int c, mbfl_convert_filter *filter TSRMLS_DC);
- int (*filter_flush)(mbfl_convert_filter *filter TSRMLS_DC);
-};
-
-mbfl_convert_filter *
-mbfl_convert_filter_new(
- enum mbfl_no_encoding from,
- enum mbfl_no_encoding to,
- int (*output_function)(int, void * TSRMLS_DC),
- int (*flush_function)(void * TSRMLS_DC),
- void *data TSRMLS_DC);
-void mbfl_convert_filter_delete(mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_convert_filter_feed(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_convert_filter_flush(mbfl_convert_filter *filter TSRMLS_DC);
-void mbfl_convert_filter_reset(mbfl_convert_filter *filter, enum mbfl_no_encoding from, enum mbfl_no_encoding to TSRMLS_DC);
-void mbfl_convert_filter_copy(mbfl_convert_filter *src, mbfl_convert_filter *dist TSRMLS_DC);
-int mbfl_filt_conv_illegal_output(int c, mbfl_convert_filter *filter TSRMLS_DC);
-
-
-/*
- * identify filter
- */
-typedef struct _mbfl_identify_filter mbfl_identify_filter;
-
-struct _mbfl_identify_filter {
- void (*filter_ctor)(mbfl_identify_filter *filter TSRMLS_DC);
- void (*filter_dtor)(mbfl_identify_filter *filter TSRMLS_DC);
- int (*filter_function)(int c, mbfl_identify_filter *filter TSRMLS_DC);
- int status;
- int flag;
- int score;
- const mbfl_encoding *encoding;
-};
-
-struct mbfl_identify_vtbl {
- enum mbfl_no_encoding encoding;
- void (*filter_ctor)(mbfl_identify_filter *filter TSRMLS_DC);
- void (*filter_dtor)(mbfl_identify_filter *filter TSRMLS_DC);
- int (*filter_function)(int c, mbfl_identify_filter *filter TSRMLS_DC);
-};
-
-mbfl_identify_filter * mbfl_identify_filter_new(enum mbfl_no_encoding encoding TSRMLS_DC);
-void mbfl_identify_filter_delete(mbfl_identify_filter *filter TSRMLS_DC);
-
-
-/*
- * buffering converter
- */
-typedef struct _mbfl_buffer_converter mbfl_buffer_converter;
-
-struct _mbfl_buffer_converter {
- mbfl_convert_filter *filter1;
- mbfl_convert_filter *filter2;
- mbfl_memory_device device;
- const mbfl_encoding *from;
- const mbfl_encoding *to;
-};
-
-mbfl_buffer_converter * mbfl_buffer_converter_new(enum mbfl_no_encoding from, enum mbfl_no_encoding to, int buf_initsz TSRMLS_DC);
-void mbfl_buffer_converter_delete(mbfl_buffer_converter *convd TSRMLS_DC);
-void mbfl_buffer_converter_reset(mbfl_buffer_converter *convd TSRMLS_DC);
-int mbfl_buffer_converter_illegal_mode(mbfl_buffer_converter *convd, int mode TSRMLS_DC);
-int mbfl_buffer_converter_illegal_substchar(mbfl_buffer_converter *convd, int substchar TSRMLS_DC);
-int mbfl_buffer_converter_strncat(mbfl_buffer_converter *convd, const unsigned char *p, int n TSRMLS_DC);
-int mbfl_buffer_converter_feed(mbfl_buffer_converter *convd, mbfl_string *string TSRMLS_DC);
-int mbfl_buffer_converter_flush(mbfl_buffer_converter *convd TSRMLS_DC);
-mbfl_string * mbfl_buffer_converter_getbuffer(mbfl_buffer_converter *convd, mbfl_string *result TSRMLS_DC);
-mbfl_string * mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result TSRMLS_DC);
-mbfl_string * mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string, mbfl_string *result TSRMLS_DC);
-
-
-/*
- * encoding detector
- */
-typedef struct _mbfl_encoding_detector mbfl_encoding_detector;
-
-struct _mbfl_encoding_detector {
- mbfl_identify_filter **filter_list;
- int filter_list_size;
-};
-
-mbfl_encoding_detector * mbfl_encoding_detector_new(enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC);
-void mbfl_encoding_detector_delete(mbfl_encoding_detector *identd TSRMLS_DC);
-int mbfl_encoding_detector_feed(mbfl_encoding_detector *identd, mbfl_string *string TSRMLS_DC);
-enum mbfl_no_encoding mbfl_encoding_detector_judge(mbfl_encoding_detector *identd TSRMLS_DC);
-
-
-/*
- * encoding converter
- */
-mbfl_string *
-mbfl_convert_encoding(mbfl_string *string, mbfl_string *result, enum mbfl_no_encoding toenc TSRMLS_DC);
-
-
-/*
- * identify encoding
- */
-const mbfl_encoding *
-mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC);
-
-const char *
-mbfl_identify_encoding_name(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC);
-
-const enum mbfl_no_encoding
-mbfl_identify_encoding_no(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC);
-
-/*
- * strlen
- */
-int
-mbfl_strlen(mbfl_string *string TSRMLS_DC);
-
-#ifdef ZEND_MULTIBYTE
-/*
- * oddlen
- */
-int
-mbfl_oddlen(mbfl_string *string);
-#endif /* ZEND_MULTIBYTE */
-
-/*
- * strpos
- */
-int
-mbfl_strpos(mbfl_string *haystack, mbfl_string *needle, int offset, int reverse TSRMLS_DC);
-
-
-/*
- * substr_count
- */
-int
-mbfl_substr_count(mbfl_string *haystack, mbfl_string *needle TSRMLS_DC);
-
-/*
- * substr
- */
-mbfl_string *
-mbfl_substr(mbfl_string *string, mbfl_string *result, int from, int length TSRMLS_DC);
-
-/*
- * strcut
- */
-mbfl_string *
-mbfl_strcut(mbfl_string *string, mbfl_string *result, int from, int length TSRMLS_DC);
-
-/*
- * strwidth
- */
-int
-mbfl_strwidth(mbfl_string *string TSRMLS_DC);
-
-/*
- * strimwidth
- */
-mbfl_string *
-mbfl_strimwidth(mbfl_string *string, mbfl_string *marker, mbfl_string *result, int from, int width TSRMLS_DC);
-
-/*
- * MIME header encode
- */
-struct mime_header_encoder_data; /* forward declaration */
-
-struct mime_header_encoder_data *
-mime_header_encoder_new(
- enum mbfl_no_encoding incode,
- enum mbfl_no_encoding outcode,
- enum mbfl_no_encoding encoding TSRMLS_DC);
-
-void
-mime_header_encoder_delete(struct mime_header_encoder_data *pe TSRMLS_DC);
-
-int
-mime_header_encoder_feed(int c, struct mime_header_encoder_data *pe TSRMLS_DC);
-
-mbfl_string *
-mime_header_encoder_result(struct mime_header_encoder_data *pe, mbfl_string *result TSRMLS_DC);
-
-mbfl_string *
-mbfl_mime_header_encode(
- mbfl_string *string, mbfl_string *result,
- enum mbfl_no_encoding outcode,
- enum mbfl_no_encoding encoding,
- const char *linefeed,
- int indent TSRMLS_DC);
-
-/*
- * MIME header decode
- */
-struct mime_header_decoder_data; /* forward declaration */
-
-struct mime_header_decoder_data *
-mime_header_decoder_new(enum mbfl_no_encoding outcode TSRMLS_DC);
-
-void
-mime_header_decoder_delete(struct mime_header_decoder_data *pd TSRMLS_DC);
-
-int
-mime_header_decoder_feed(int c, struct mime_header_decoder_data *pd TSRMLS_DC);
-
-mbfl_string *
-mime_header_decoder_result(struct mime_header_decoder_data *pd, mbfl_string *result TSRMLS_DC);
-
-mbfl_string *
-mbfl_mime_header_decode(
- mbfl_string *string,
- mbfl_string *result,
- enum mbfl_no_encoding outcode TSRMLS_DC);
-
-
-/*
- * convert HTML numeric entity
- */
-mbfl_string *
-mbfl_html_numeric_entity(mbfl_string *string, mbfl_string *result, int *convmap, int mapsize, int type TSRMLS_DC);
-
-
-/*
- * convert of harfwidth and fullwidth for japanese
- */
-mbfl_string *
-mbfl_ja_jp_hantozen(mbfl_string *string, mbfl_string *result, int mode TSRMLS_DC);
-
-/*
- * HTML Entity table
- */
-typedef struct _mbfl_html_entity {
- char * name;
- int code;
-} mbfl_html_entity;
-
-extern const mbfl_html_entity mbfl_html_entity_list[];
-
-#endif /* MBFL_MBFILTER_H */
diff --git a/ext/mbstring/mbfilter_cn.c b/ext/mbstring/mbfilter_cn.c
deleted file mode 100644
index 6feab182dd..0000000000
--- a/ext/mbstring/mbfilter_cn.c
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rui Hirokawa <hirokawa@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * "streamable simplified chinese code filter and converter"
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-
-#if defined(HAVE_MBSTR_CN)
-#include "mbfilter.h"
-#include "mbfilter_cn.h"
-
-#include "unicode_table_cn.h"
-
-#define CK(statement) do { if ((statement) < 0) return (-1); } while (0)
-
-
-/*
- * EUC-CN => wchar
- */
-int
-mbfl_filt_conv_euccn_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, w;
-
- switch (filter->status) {
- case 0:
- if (c >= 0 && c < 0x80) { /* latin */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else if (c > 0xa0 && c < 0xff) { /* dbcs lead byte */
- filter->status = 1;
- filter->cache = c;
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 1: /* dbcs second byte */
- filter->status = 0;
- c1 = filter->cache;
- if (c1 > 0xa0 && c1 < 0xff && c > 0xa0 && c < 0xff) {
- w = (c1 - 0x81)*192 + (c - 0x40);
- if (w >= 0 && w < cp936_ucs_table_size) {
- w = cp936_ucs_table[w];
- } else {
- w = 0;
- }
- if (w <= 0) {
- w = (c1 << 8) | c;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_GB2312;
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => EUC-CN
- */
-int
-mbfl_filt_conv_wchar_euccn(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, c2, s;
-
- s = 0;
- if (c >= ucs_a1_cp936_table_min && c < ucs_a1_cp936_table_max) {
- s = ucs_a1_cp936_table[c - ucs_a1_cp936_table_min];
- } else if (c >= ucs_a2_cp936_table_min && c < ucs_a2_cp936_table_max) {
- s = ucs_a2_cp936_table[c - ucs_a2_cp936_table_min];
- } else if (c >= ucs_a3_cp936_table_min && c < ucs_a3_cp936_table_max) {
- s = ucs_a3_cp936_table[c - ucs_a3_cp936_table_min];
- } else if (c >= ucs_i_cp936_table_min && c < ucs_i_cp936_table_max) {
- s = ucs_i_cp936_table[c - ucs_i_cp936_table_min];
- } else if (c >= ucs_hff_cp936_table_min && c < ucs_hff_cp936_table_max) {
- s = ucs_hff_cp936_table[c - ucs_hff_cp936_table_min];
- }
- c1 = (s >> 8) & 0xff;
- c2 = s & 0xff;
-
- if (c1 < 0xa1 || c2 < 0xa1) { /* exclude CP936 extension */
- s = c;
- }
-
- if (s <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_GB2312) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- if (c == 0) {
- s = 0;
- } else if (s <= 0) {
- s = -1;
- }
- }
- if (s >= 0) {
- if (s < 0x80) { /* latin */
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * CP936 => wchar
- */
-int
-mbfl_filt_conv_cp936_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, w;
-
- switch (filter->status) {
- case 0:
- if (c >= 0 && c < 0x80) { /* latin */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else if (c == 0x80) { /* euro sign */
- CK((*filter->output_function)(0x20ac, filter->data TSRMLS_CC));
- } else if (c > 0x80 && c < 0xff) { /* dbcs lead byte */
- filter->status = 1;
- filter->cache = c;
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 1: /* dbcs second byte */
- filter->status = 0;
- c1 = filter->cache;
- if ( c1 < 0xff && c1 > 0x80 && c > 0x39 && c < 0xff && c != 0x7f) {
- w = (c1 - 0x81)*192 + (c - 0x40);
- if (w >= 0 && w < cp936_ucs_table_size) {
- w = cp936_ucs_table[w];
- } else {
- w = 0;
- }
- if (w <= 0) {
- w = (c1 << 8) | c;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_WINCP936;
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => CP936
- */
-int
-mbfl_filt_conv_wchar_cp936(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, s;
-
- s = 0;
- if (c >= ucs_a1_cp936_table_min && c < ucs_a1_cp936_table_max) {
- s = ucs_a1_cp936_table[c - ucs_a1_cp936_table_min];
- } else if (c >= ucs_a2_cp936_table_min && c < ucs_a2_cp936_table_max) {
- s = ucs_a2_cp936_table[c - ucs_a2_cp936_table_min];
- } else if (c >= ucs_a3_cp936_table_min && c < ucs_a3_cp936_table_max) {
- s = ucs_a3_cp936_table[c - ucs_a3_cp936_table_min];
- } else if (c >= ucs_i_cp936_table_min && c < ucs_i_cp936_table_max) {
- s = ucs_i_cp936_table[c - ucs_i_cp936_table_min];
- } else if (c >= ucs_ci_cp936_table_min && c < ucs_ci_cp936_table_max) {
- s = ucs_ci_cp936_table[c - ucs_ci_cp936_table_min];
- } else if (c >= ucs_cf_cp936_table_min && c < ucs_cf_cp936_table_max) {
- s = ucs_cf_cp936_table[c - ucs_cf_cp936_table_min];
- } else if (c >= ucs_sfv_cp936_table_min && c < ucs_sfv_cp936_table_max) {
- s = ucs_sfv_cp936_table[c - ucs_sfv_cp936_table_min];
- } else if (c >= ucs_hff_cp936_table_min && c < ucs_hff_cp936_table_max) {
- s = ucs_hff_cp936_table[c - ucs_hff_cp936_table_min];
- }
- if (s <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_WINCP936) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- if (c == 0) {
- s = 0;
- } else if (s <= 0) {
- s = -1;
- }
- }
- if (s >= 0) {
- if (s < 0x80) { /* latin */
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-
-/*
- * HZ => wchar
- */
-int
-mbfl_filt_conv_hz_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, s, w;
-
- switch (filter->status & 0xf) {
-/* case 0x00: ASCII */
-/* case 0x10: GB2312 */
- case 0:
- if (c == 0x7e) {
- filter->status += 2;
- } else if (filter->status == 0x10 && c > 0x20 && c < 0x7f) { /* DBCS first char */
- filter->cache = c;
- filter->status += 1;
- } else if (c >= 0 && c < 0x80) { /* latin, CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
-/* case 0x11: GB2312 second char */
- case 1:
- filter->status &= ~0xf;
- c1 = filter->cache;
- if (c1 > 0x20 && c1 < 0x7f && c > 0x20 && c < 0x7f) {
- s = (c1 - 1)*192 + c + 0x40; /* GB2312 */
- if (s >= 0 && s < cp936_ucs_table_size) {
- w = cp936_ucs_table[s];
- } else {
- w = 0;
- }
- if (w <= 0) {
- w = (c1 << 8) | c;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_GB2312;
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- /* '~' */
- case 2:
- if (c == 0x7d) { /* '}' */
- filter->status = 0x0;
- } else if (c == 0x7b) { /* '{' */
- filter->status = 0x10;
- } else if (c == 0x7e) { /* '~' */
- filter->status = 0x0;
- CK((*filter->output_function)(0x007e, filter->data TSRMLS_CC));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => HZ
- */
-int
-mbfl_filt_conv_wchar_hz(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- s = 0;
- if (c >= ucs_a1_cp936_table_min && c < ucs_a1_cp936_table_max) {
- s = ucs_a1_cp936_table[c - ucs_a1_cp936_table_min];
- } else if (c >= ucs_a2_cp936_table_min && c < ucs_a2_cp936_table_max) {
- s = ucs_a2_cp936_table[c - ucs_a2_cp936_table_min];
- } else if (c >= ucs_a3_cp936_table_min && c < ucs_a3_cp936_table_max) {
- s = ucs_a3_cp936_table[c - ucs_a3_cp936_table_min];
- } else if (c >= ucs_i_cp936_table_min && c < ucs_i_cp936_table_max) {
- s = ucs_i_cp936_table[c - ucs_i_cp936_table_min];
- } else if (c >= ucs_hff_cp936_table_min && c < ucs_hff_cp936_table_max) {
- s = ucs_hff_cp936_table[c - ucs_hff_cp936_table_min];
- }
- if (s & 0x8000) {
- s -= 0x8080;
- }
-
- if (s <= 0) {
- if (c == 0) {
- s = 0;
- } else if (s <= 0) {
- s = -1;
- }
- } else if ((s >= 0x80 && s < 0x2121) || (s > 0x8080)) {
- s = -1;
- }
- if (s >= 0) {
- if (s < 0x80) { /* ASCII */
- if ((filter->status & 0xff00) != 0) {
- CK((*filter->output_function)(0x7e, filter->data TSRMLS_CC)); /* '~' */
- CK((*filter->output_function)(0x7d, filter->data TSRMLS_CC)); /* '}' */
- }
- filter->status = 0;
- if (s == 0x7e){
- CK((*filter->output_function)(0x7e, filter->data TSRMLS_CC));
- }
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else { /* GB 2312-80 */
- if ((filter->status & 0xff00) != 0x200) {
- CK((*filter->output_function)(0x7e, filter->data TSRMLS_CC)); /* '~' */
- CK((*filter->output_function)(0x7b, filter->data TSRMLS_CC)); /* '{' */
- }
- filter->status = 0x200;
- CK((*filter->output_function)((s >> 8) & 0x7f, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s & 0x7f, filter->data TSRMLS_CC));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-int
-mbfl_filt_conv_any_hz_flush(mbfl_convert_filter *filter TSRMLS_DC)
-{
- /* back to latin */
- if ((filter->status & 0xff00) != 0) {
- CK((*filter->output_function)(0x7e, filter->data TSRMLS_CC)); /* ~ */
- CK((*filter->output_function)(0x7d, filter->data TSRMLS_CC)); /* '{' */
- }
- filter->status &= 0xff;
- return 0;
-}
-
-#endif /* HAVE_MBSTR_CN */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/mbstring/mbfilter_cn.h b/ext/mbstring/mbfilter_cn.h
deleted file mode 100644
index be25417174..0000000000
--- a/ext/mbstring/mbfilter_cn.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rui Hirokawa <hirokawa@php.net> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef MBFL_MBFILTER_CN_H
-#define MBFL_MBFILTER_CN_H
-
-int mbfl_filt_conv_euccn_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_euccn(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_cp936_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_cp936(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_hz_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_hz(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_any_hz_flush(mbfl_convert_filter *filter TSRMLS_DC);
-
-#endif /* MBFL_MBFILTER_CN_H */
diff --git a/ext/mbstring/mbfilter_ja.c b/ext/mbstring/mbfilter_ja.c
deleted file mode 100644
index bd473900cd..0000000000
--- a/ext/mbstring/mbfilter_ja.c
+++ /dev/null
@@ -1,1291 +0,0 @@
-/* charset=UTF-8 */
-
-/*
- * "streamable kanji code filter and converter"
- *
- * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved.
- *
- * This software is released under the GNU Lesser General Public License.
- * (Version 2.1, February 1999)
- * Please read the following detail of the licence (in japanese).
- *
- * ◆使用許諾æ¡ä»¶â—†
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•ã‚Œã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ
- * ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã«é–¢
- * ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ
- * ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利
- * ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用
- * ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’「GNU Lesser General Public License (Version 2.1, February
- * 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser
- * General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢
- * ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚
- *
- * 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã
- * ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“ã‚Œã¾ã§Library General
- * Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚
- * http://www.gnu.org/ --- GNUウェブサイト
- * http://www.gnu.org/copyleft/lesser.html --- ライセンス文é¢
- * ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。
- *
- * ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプロジェクトã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§
- * ã¯ã‚ã‚Šã¾ã›ã‚“。
- *
- * â—†ä¿è¨¼å†…容◆
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€æœŸå¾…ã•ã‚ŒãŸå‹•ä½œãƒ»æ©Ÿèƒ½ãƒ»æ€§èƒ½ã‚’æŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨­è¨ˆã•ã‚Œ
- * 開発ã•ã‚Œã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚ã‚Šã¾ã›ã‚“。ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€Œã“
- * ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•ã‚Œã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定ã®
- * 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•ã‚‰ã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•ã‚ŒãŸã‚Šæš—é»™ã«ç¤ºã•ã‚Œã¦ã„
- * ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åŠ¹ã§ã™ã€‚ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã—ãŸçµæžœãªã„ã—使
- * 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æ害
- * ã€ãƒ‡ãƒ¼ã‚¿ã®æ失ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æ害ã«ã¤ã„ã¦ã¯ã€ãã®æ害ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€…
- * ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è­¦å‘Šã•ã‚Œã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æ害ã®è³ 
- * å„ŸãŠã‚ˆã³è£œå¡«ã‚’è¡Œã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ»
- * 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚
- *
- * ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—†
- *
- * 〒102-0073
- * æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F
- * æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ
- * Phone: 03-3512-3655, Fax: 03-3512-3656
- * Email: sales@happysize.co.jp
- * Web: http://happysize.com/
- *
- * ◆著者◆
- *
- * 金本 茂 <sgk@happysize.co.jp>
- *
- * ◆履歴◆
- *
- * 1998/11/10 sgk implementation in C++
- * 1999/4/25 sgk Cã§æ›¸ããªãŠã—。
- * 1999/4/26 sgk 入力フィルタを実装。漢字コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’追加。
- * 1999/6/?? Unicodeサãƒãƒ¼ãƒˆã€‚
- * 1999/6/22 sgk ライセンスをLGPLã«å¤‰æ›´ã€‚
- *
- */
-
-/*
- * Unicode support
- *
- * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team.
- * All rights reserved.
- *
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-
-#if defined(HAVE_MBSTR_JA)
-
-#include "mbfilter.h"
-#include "mbfilter_ja.h"
-
-#include "cp932_table.h"
-#include "unicode_table_ja.h"
-
-#define CK(statement) do { if ((statement) < 0) return (-1); } while (0)
-
-#define SJIS_ENCODE(c1,c2,s1,s2) \
- do { \
- s1 = c1; \
- s1--; \
- s1 >>= 1; \
- if ((c1) < 0x5f) { \
- s1 += 0x71; \
- } else { \
- s1 += 0xb1; \
- } \
- s2 = c2; \
- if ((c1) & 1) { \
- if ((c2) < 0x60) { \
- s2--; \
- } \
- s2 += 0x20; \
- } else { \
- s2 += 0x7e; \
- } \
- } while (0)
-
-#define SJIS_DECODE(c1,c2,s1,s2) \
- do { \
- s1 = c1; \
- if (s1 < 0xa0) { \
- s1 -= 0x81; \
- } else { \
- s1 -= 0xc1; \
- } \
- s1 <<= 1; \
- s1 += 0x21; \
- s2 = c2; \
- if (s2 < 0x9f) { \
- if (s2 < 0x7f) { \
- s2++; \
- } \
- s2 -= 0x20; \
- } else { \
- s1++; \
- s2 -= 0x7e; \
- } \
- } while (0)
-
-
-/*
- * EUC-JP => wchar
- */
-int
-mbfl_filt_conv_eucjp_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, s, w;
-
- switch (filter->status) {
- case 0:
- if (c >= 0 && c < 0x80) { /* latin */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else if (c > 0xa0 && c < 0xff) { /* X 0208 first char */
- filter->status = 1;
- filter->cache = c;
- } else if (c == 0x8e) { /* kana first char */
- filter->status = 2;
- } else if (c == 0x8f) { /* X 0212 first char */
- filter->status = 3;
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 1: /* got first half */
- filter->status = 0;
- c1 = filter->cache;
- if (c > 0xa0 && c < 0xff) {
- s = (c1 - 0xa1)*94 + c - 0xa1;
- if (s >= 0 && s < jisx0208_ucs_table_size) {
- w = jisx0208_ucs_table[s];
- } else {
- w = 0;
- }
- if (w <= 0) {
- w = ((c1 & 0x7f) << 8) | (c & 0x7f);
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_JIS0208;
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 2: /* got 0x8e */
- filter->status = 0;
- if (c > 0xa0 && c < 0xe0) {
- w = 0xfec0 + c;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = 0x8e00 | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 3: /* got 0x8f, X 0212 first char */
- if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- filter->status = 0;
- } else {
- filter->status++;
- filter->cache = c;
- }
- break;
- case 4: /* got 0x8f, X 0212 second char */
- filter->status = 0;
- c1 = filter->cache;
- if (c1 > 0xa0 && c1 < 0xff && c > 0xa0 && c < 0xff) {
- s = (c1 - 0xa1)*94 + c - 0xa1;
- if (s >= 0 && s < jisx0212_ucs_table_size) {
- w = jisx0212_ucs_table[s];
- } else {
- w = 0;
- }
- if (w <= 0) {
- w = ((c1 & 0x7f) << 8) | (c & 0x7f);
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_JIS0212;
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c | 0x8f0000;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => EUC-JP
- */
-int
-mbfl_filt_conv_wchar_eucjp(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, s;
-
- s = 0;
- if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) {
- s = ucs_a1_jis_table[c - ucs_a1_jis_table_min];
- } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) {
- s = ucs_a2_jis_table[c - ucs_a2_jis_table_min];
- } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) {
- s = ucs_i_jis_table[c - ucs_i_jis_table_min];
- } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) {
- s = ucs_r_jis_table[c - ucs_r_jis_table_min];
- }
- if (s <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_JIS0208) {
- s = c & MBFL_WCSPLANE_MASK;
- } else if (c1 == MBFL_WCSPLANE_JIS0212) {
- s = c & MBFL_WCSPLANE_MASK;
- s |= 0x8080;
- } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s = 0x2140;
- } else if (c == 0xff5e) { /* FULLWIDTH TILDE */
- s = 0x2141;
- } else if (c == 0x2225) { /* PARALLEL TO */
- s = 0x2142;
- } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
- s = 0x215d;
- } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */
- s = 0x2171;
- } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */
- s = 0x2172;
- } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */
- s = 0x224c;
- }
- if (c == 0) {
- s = 0;
- } else if (s <= 0) {
- s = -1;
- }
- }
- if (s >= 0) {
- if (s < 0x80) { /* latin */
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else if (s < 0x100) { /* kana */
- CK((*filter->output_function)(0x8e, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else if (s < 0x8080) { /* X 0208 */
- CK((*filter->output_function)(((s >> 8) & 0xff) | 0x80, filter->data TSRMLS_CC));
- CK((*filter->output_function)((s & 0xff) | 0x80, filter->data TSRMLS_CC));
- } else { /* X 0212 */
- CK((*filter->output_function)(0x8f, filter->data TSRMLS_CC));
- CK((*filter->output_function)(((s >> 8) & 0xff) | 0x80, filter->data TSRMLS_CC));
- CK((*filter->output_function)((s & 0xff) | 0x80, filter->data TSRMLS_CC));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-
-/*
- * eucJP-win => wchar
- */
-int
-mbfl_filt_conv_eucjpwin_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, s, w, n;
-
- switch (filter->status) {
- case 0:
- if (c >= 0 && c < 0x80) { /* latin */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else if (c > 0xa0 && c < 0xff) { /* CP932 first char */
- filter->status = 1;
- filter->cache = c;
- } else if (c == 0x8e) { /* kana first char */
- filter->status = 2;
- } else if (c == 0x8f) { /* X 0212 first char */
- filter->status = 3;
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 1: /* got first half */
- filter->status = 0;
- c1 = filter->cache;
- if (c > 0xa0 && c < 0xff) {
- w = 0;
- s = (c1 - 0xa1)*94 + c - 0xa1;
- if (s <= 137) {
- if (s == 31) {
- w = 0xff3c; /* FULLWIDTH REVERSE SOLIDUS */
- } else if (s == 32) {
- w = 0xff5e; /* FULLWIDTH TILDE */
- } else if (s == 33) {
- w = 0x2225; /* PARALLEL TO */
- } else if (s == 60) {
- w = 0xff0d; /* FULLWIDTH HYPHEN-MINUS */
- } else if (s == 80) {
- w = 0xffe0; /* FULLWIDTH CENT SIGN */
- } else if (s == 81) {
- w = 0xffe1; /* FULLWIDTH POUND SIGN */
- } else if (s == 137) {
- w = 0xffe2; /* FULLWIDTH NOT SIGN */
- }
- }
- if (w == 0) {
- if (s >= cp932ext1_ucs_table_min && s < cp932ext1_ucs_table_max) { /* vendor ext1 (13ku) */
- w = cp932ext1_ucs_table[s - cp932ext1_ucs_table_min];
- } else if (s >= 0 && s < jisx0208_ucs_table_size) { /* X 0208 */
- w = jisx0208_ucs_table[s];
- } else if (s >= (84*94)) { /* user (85ku - 94ku) */
- w = s - (84*94) + 0xe000;
- }
- }
- if (w <= 0) {
- w = ((c1 & 0x7f) << 8) | (c & 0x7f);
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_WINCP932;
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 2: /* got 0x8e, X0201 kana */
- filter->status = 0;
- if (c > 0xa0 && c < 0xe0) {
- w = 0xfec0 + c;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = 0x8e00 | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 3: /* got 0x8f, X 0212 first char */
- if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- filter->status = 0;
- } else {
- filter->status++;
- filter->cache = c;
- }
- break;
- case 4: /* got 0x8f, X 0212 second char */
- filter->status = 0;
- c1 = filter->cache;
- if (c1 > 0xa0 && c1 < 0xff && c > 0xa0 && c < 0xff) {
- s = (c1 - 0xa1)*94 + c - 0xa1;
- if (s >= 0 && s < jisx0212_ucs_table_size) {
- w = jisx0212_ucs_table[s];
- } else if (s >= (82*94) && s < (84*94)) { /* vender ext3 (83ku - 84ku) <-> CP932 (115ku -120ku) */
- s = (c1<< 8) | c;
- w = 0;
- n = 0;
- while (n < cp932ext3_eucjp_table_size) {
- if (s == cp932ext3_eucjp_table[n]) {
- if (n < (cp932ext3_ucs_table_max - cp932ext3_ucs_table_min)) {
- w = cp932ext3_ucs_table[n];
- }
- break;
- }
- n++;
- }
- } else if (s >= (84*94)) { /* user (85ku - 94ku) */
- w = s - (84*94) + (0xe000 + (94*10));
- } else {
- w = 0;
- }
- if (w <= 0) {
- w = ((c1 & 0x7f) << 8) | (c & 0x7f);
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_JIS0212;
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c | 0x8f0000;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => eucJP-win
- */
-int
-mbfl_filt_conv_wchar_eucjpwin(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, c2, s1;
-
- s1 = 0;
- if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) {
- s1 = ucs_a1_jis_table[c - ucs_a1_jis_table_min];
- } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) {
- s1 = ucs_a2_jis_table[c - ucs_a2_jis_table_min];
- } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) {
- s1 = ucs_i_jis_table[c - ucs_i_jis_table_min];
- } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) {
- s1 = ucs_r_jis_table[c - ucs_r_jis_table_min];
- } else if (c >= 0xe000 && c < (0xe000 + 10*94)) { /* user (X0208 85ku - 94ku) */
- s1 = c - 0xe000;
- c1 = s1/94 + 0x75;
- c2 = s1%94 + 0x21;
- s1 = (c1 << 8) | c2;
- } else if (c >= (0xe000 + 10*94) && c < (0xe000 + 20*94)) { /* user (X0212 85ku - 94ku) */
- s1 = c - (0xe000 + 10*94);
- c1 = s1/94 + 0xf5;
- c2 = s1%94 + 0xa1;
- s1 = (c1 << 8) | c2;
- }
- if (s1 <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_WINCP932) {
- s1 = c & MBFL_WCSPLANE_MASK;
- if (s1 >= ((85 + 0x20) << 8)) { /* 85ku - 120ku */
- s1 = -1;
- }
- } else if (c1 == MBFL_WCSPLANE_JIS0208) {
- s1 = c & MBFL_WCSPLANE_MASK;
- if (s1 >= ((85 + 0x20) << 8)) { /* 85ku - 94ku */
- s1 = -1;
- }
- } else if (c1 == MBFL_WCSPLANE_JIS0212) {
- s1 = c & MBFL_WCSPLANE_MASK;
- if (s1 >= ((83 + 0x20) << 8)) { /* 83ku - 94ku */
- s1 = -1;
- } else {
- s1 |= 0x8080;
- }
- } else if (c == 0xa5) { /* YEN SIGN */
- s1 = 0x216f; /* FULLWIDTH YEN SIGN */
- } else if (c == 0x203e) { /* OVER LINE */
- s1 = 0x2131; /* FULLWIDTH MACRON */
- } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s1 = 0x2140;
- } else if (c == 0xff5e) { /* FULLWIDTH TILDE */
- s1 = 0x2141;
- } else if (c == 0x2225) { /* PARALLEL TO */
- s1 = 0x2142;
- } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
- s1 = 0x215d;
- } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */
- s1 = 0x2171;
- } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */
- s1 = 0x2172;
- } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */
- s1 = 0x224c;
- } else {
- s1 = -1;
- c1 = 0;
- c2 = cp932ext1_ucs_table_max - cp932ext1_ucs_table_min;
- while (c1 < c2) { /* CP932 vendor ext1 (13ku) */
- if (c == cp932ext1_ucs_table[c1]) {
- s1 = ((c1/94 + 0x2d) << 8) + (c1%94 + 0x21);
- break;
- }
- c1++;
- }
- if (s1 < 0) {
- c1 = 0;
- c2 = cp932ext3_ucs_table_max - cp932ext3_ucs_table_min;
- while (c1 < c2) { /* CP932 vendor ext3 (115ku - 119ku) */
- if (c == cp932ext3_ucs_table[c1]) {
- if (c1 < cp932ext3_eucjp_table_size) {
- s1 = cp932ext3_eucjp_table[c1];
- }
- break;
- }
- c1++;
- }
- }
- }
- if (c == 0) {
- s1 = 0;
- } else if (s1 <= 0) {
- s1 = -1;
- }
- }
-
- if (s1 >= 0) {
- if (s1 < 0x80) { /* latin */
- CK((*filter->output_function)(s1, filter->data TSRMLS_CC));
- } else if (s1 < 0x100) { /* kana */
- CK((*filter->output_function)(0x8e, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s1, filter->data TSRMLS_CC));
- } else if (s1 < 0x8080) { /* X 0208 */
- CK((*filter->output_function)(((s1 >> 8) & 0xff) | 0x80, filter->data TSRMLS_CC));
- CK((*filter->output_function)((s1 & 0xff) | 0x80, filter->data TSRMLS_CC));
- } else { /* X 0212 */
- CK((*filter->output_function)(0x8f, filter->data TSRMLS_CC));
- CK((*filter->output_function)(((s1 >> 8) & 0xff) | 0x80, filter->data TSRMLS_CC));
- CK((*filter->output_function)((s1 & 0xff) | 0x80, filter->data TSRMLS_CC));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-
-/*
- * SJIS => wchar
- */
-int
-mbfl_filt_conv_sjis_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, s1, s2, w;
-
- switch (filter->status) {
- case 0:
- if (c >= 0 && c < 0x80) { /* latin */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else if (c > 0xa0 && c < 0xe0) { /* kana */
- CK((*filter->output_function)(0xfec0 + c, filter->data TSRMLS_CC));
- } else if (c > 0x80 && c < 0xfd && c != 0xa0) { /* kanji first char */
- filter->status = 1;
- filter->cache = c;
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 1: /* kanji second char */
- filter->status = 0;
- c1 = filter->cache;
- if (c > 0x39 && c < 0xfd && c != 0x7f) {
- SJIS_DECODE(c1, c, s1, s2);
- w = (s1 - 0x21)*94 + s2 - 0x21;
- if (w >= 0 && w < jisx0208_ucs_table_size) {
- w = jisx0208_ucs_table[w];
- } else {
- w = 0;
- }
- if (w <= 0) {
- if (s1 < 0x7f && s2 < 0x7f) {
- w = (s1 << 8) | s2;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_JIS0208;
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- }
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => SJIS
- */
-int
-mbfl_filt_conv_wchar_sjis(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, c2, s1, s2;
-
- s1 = 0;
- if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) {
- s1 = ucs_a1_jis_table[c - ucs_a1_jis_table_min];
- } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) {
- s1 = ucs_a2_jis_table[c - ucs_a2_jis_table_min];
- } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) {
- s1 = ucs_i_jis_table[c - ucs_i_jis_table_min];
- } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) {
- s1 = ucs_r_jis_table[c - ucs_r_jis_table_min];
- }
- if (s1 <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_JIS0208) {
- s1 = c & MBFL_WCSPLANE_MASK;
- } else if (c == 0xa5) { /* YEN SIGN */
- s1 = 0x216f; /* FULLWIDTH YEN SIGN */
- } else if (c == 0x203e) { /* OVER LINE */
- s1 = 0x2131; /* FULLWIDTH MACRON */
- } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s1 = 0x2140;
- } else if (c == 0xff5e) { /* FULLWIDTH TILDE */
- s1 = 0x2141;
- } else if (c == 0x2225) { /* PARALLEL TO */
- s1 = 0x2142;
- } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
- s1 = 0x215d;
- } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */
- s1 = 0x2171;
- } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */
- s1 = 0x2172;
- } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */
- s1 = 0x224c;
- }
- if (c == 0) {
- s1 = 0;
- } else if (s1 <= 0) {
- s1 = -1;
- }
- } else if (s1 >= 0x8080) {
- s1 = -1;
- }
- if (s1 >= 0) {
- if (s1 < 0x100) { /* latin or kana */
- CK((*filter->output_function)(s1, filter->data TSRMLS_CC));
- } else { /* kanji */
- c1 = (s1 >> 8) & 0xff;
- c2 = s1 & 0xff;
- SJIS_ENCODE(c1, c2, s1, s2);
- CK((*filter->output_function)(s1, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s2, filter->data TSRMLS_CC));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-
-/*
- * SJIS-win => wchar
- */
-int
-mbfl_filt_conv_sjiswin_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, s, s1, s2, w;
-
- switch (filter->status) {
- case 0:
- if (c >= 0 && c < 0x80) { /* latin */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else if (c > 0xa0 && c < 0xe0) { /* kana */
- CK((*filter->output_function)(0xfec0 + c, filter->data TSRMLS_CC));
- } else if (c > 0x80 && c < 0xfd && c != 0xa0) { /* kanji first char */
- filter->status = 1;
- filter->cache = c;
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 1: /* kanji second char */
- filter->status = 0;
- c1 = filter->cache;
- if (c > 0x39 && c < 0xfd && c != 0x7f) {
- w = 0;
- SJIS_DECODE(c1, c, s1, s2);
- s = (s1 - 0x21)*94 + s2 - 0x21;
- if (s <= 137) {
- if (s == 31) {
- w = 0xff3c; /* FULLWIDTH REVERSE SOLIDUS */
- } else if (s == 32) {
- w = 0xff5e; /* FULLWIDTH TILDE */
- } else if (s == 33) {
- w = 0x2225; /* PARALLEL TO */
- } else if (s == 60) {
- w = 0xff0d; /* FULLWIDTH HYPHEN-MINUS */
- } else if (s == 80) {
- w = 0xffe0; /* FULLWIDTH CENT SIGN */
- } else if (s == 81) {
- w = 0xffe1; /* FULLWIDTH POUND SIGN */
- } else if (s == 137) {
- w = 0xffe2; /* FULLWIDTH NOT SIGN */
- }
- }
- if (w == 0) {
- if (s >= cp932ext1_ucs_table_min && s < cp932ext1_ucs_table_max) { /* vendor ext1 (13ku) */
- w = cp932ext1_ucs_table[s - cp932ext1_ucs_table_min];
- } else if (s >= 0 && s < jisx0208_ucs_table_size) { /* X 0208 */
- w = jisx0208_ucs_table[s];
- } else if (s >= cp932ext2_ucs_table_min && s < cp932ext2_ucs_table_max) { /* vendor ext2 (89ku - 92ku) */
- w = cp932ext2_ucs_table[s - cp932ext2_ucs_table_min];
- } else if (s >= cp932ext3_ucs_table_min && s < cp932ext3_ucs_table_max) { /* vendor ext3 (115ku - 119ku) */
- w = cp932ext3_ucs_table[s - cp932ext3_ucs_table_min];
- } else if (s >= (94*94) && s < (114*94)) { /* user (95ku - 114ku) */
- w = s - (94*94) + 0xe000;
- }
- }
- if (w <= 0) {
- w = (s1 << 8) | s2;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_WINCP932;
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => SJIS-win
- */
-int
-mbfl_filt_conv_wchar_sjiswin(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, c2, s1, s2;
-
- s1 = 0;
- s2 = 0;
- if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) {
- s1 = ucs_a1_jis_table[c - ucs_a1_jis_table_min];
- } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) {
- s1 = ucs_a2_jis_table[c - ucs_a2_jis_table_min];
- } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) {
- s1 = ucs_i_jis_table[c - ucs_i_jis_table_min];
- } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) {
- s1 = ucs_r_jis_table[c - ucs_r_jis_table_min];
- } else if (c >= 0xe000 && c < (0xe000 + 20*94)) { /* user (95ku - 114ku) */
- s1 = c - 0xe000;
- c1 = s1/94 + 0x7f;
- c2 = s1%94 + 0x21;
- s1 = (c1 << 8) | c2;
- s2 = 1;
- }
- if (s1 <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_WINCP932) {
- s1 = c & MBFL_WCSPLANE_MASK;
- s2 = 1;
- } else if (c1 == MBFL_WCSPLANE_JIS0208) {
- s1 = c & MBFL_WCSPLANE_MASK;
- } else if (c1 == MBFL_WCSPLANE_JIS0212) {
- s1 = c & MBFL_WCSPLANE_MASK;
- s1 |= 0x8080;
- } else if (c == 0xa5) { /* YEN SIGN */
- s1 = 0x216f; /* FULLWIDTH YEN SIGN */
- } else if (c == 0x203e) { /* OVER LINE */
- s1 = 0x2131; /* FULLWIDTH MACRON */
- } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s1 = 0x2140;
- } else if (c == 0xff5e) { /* FULLWIDTH TILDE */
- s1 = 0x2141;
- } else if (c == 0x2225) { /* PARALLEL TO */
- s1 = 0x2142;
- } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
- s1 = 0x215d;
- } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */
- s1 = 0x2171;
- } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */
- s1 = 0x2172;
- } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */
- s1 = 0x224c;
- }
- }
- if ((s1 <= 0) || (s1 >= 0x8080 && s2 == 0)) { /* not found or X 0212 */
- s1 = -1;
- c1 = 0;
- c2 = cp932ext1_ucs_table_max - cp932ext1_ucs_table_min;
- while (c1 < c2) { /* CP932 vendor ext1 (13ku) */
- if (c == cp932ext1_ucs_table[c1]) {
- s1 = ((c1/94 + 0x2d) << 8) + (c1%94 + 0x21);
- break;
- }
- c1++;
- }
- if (s1 <= 0) {
- c1 = 0;
- c2 = cp932ext3_ucs_table_max - cp932ext3_ucs_table_min;
- while (c1 < c2) { /* CP932 vendor ext3 (115ku - 119ku) */
- if (c == cp932ext3_ucs_table[c1]) {
- s1 = ((c1/94 + 0x93) << 8) + (c1%94 + 0x21);
- break;
- }
- c1++;
- }
- }
- if (c == 0) {
- s1 = 0;
- } else if (s1 <= 0) {
- s1 = -1;
- }
- }
- if (s1 >= 0) {
- if (s1 < 0x100) { /* latin or kana */
- CK((*filter->output_function)(s1, filter->data TSRMLS_CC));
- } else { /* kanji */
- c1 = (s1 >> 8) & 0xff;
- c2 = s1 & 0xff;
- SJIS_ENCODE(c1, c2, s1, s2);
- CK((*filter->output_function)(s1, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s2, filter->data TSRMLS_CC));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-
-/*
- * JIS => wchar
- */
-int
-mbfl_filt_conv_jis_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, s, w;
-
-retry:
- switch (filter->status & 0xf) {
-/* case 0x00: ASCII */
-/* case 0x10: X 0201 latin */
-/* case 0x20: X 0201 kana */
-/* case 0x80: X 0208 */
-/* case 0x90: X 0212 */
- case 0:
- if (c == 0x1b) {
- filter->status += 2;
- } else if (c == 0x0e) { /* "kana in" */
- filter->status = 0x20;
- } else if (c == 0x0f) { /* "kana out" */
- filter->status = 0;
- } else if (filter->status == 0x10 && c == 0x5c) { /* YEN SIGN */
- CK((*filter->output_function)(0xa5, filter->data TSRMLS_CC));
- } else if (filter->status == 0x10 && c == 0x7e) { /* OVER LINE */
- CK((*filter->output_function)(0x203e, filter->data TSRMLS_CC));
- } else if (filter->status == 0x20 && c > 0x20 && c < 0x60) { /* kana */
- CK((*filter->output_function)(0xff40 + c, filter->data TSRMLS_CC));
- } else if ((filter->status == 0x80 || filter->status == 0x90) && c > 0x20 && c < 0x7f) { /* kanji first char */
- filter->cache = c;
- filter->status += 1;
- } else if (c >= 0 && c < 0x80) { /* latin, CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else if (c > 0xa0 && c < 0xe0) { /* GR kana */
- CK((*filter->output_function)(0xfec0 + c, filter->data TSRMLS_CC));
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
-/* case 0x81: X 0208 second char */
-/* case 0x91: X 0212 second char */
- case 1:
- filter->status &= ~0xf;
- c1 = filter->cache;
- if (c > 0x20 && c < 0x7f) {
- s = (c1 - 0x21)*94 + c - 0x21;
- if (filter->status == 0x80) {
- if (s >= 0 && s < jisx0208_ucs_table_size) {
- w = jisx0208_ucs_table[s];
- } else {
- w = 0;
- }
- if (w <= 0) {
- w = (c1 << 8) | c;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_JIS0208;
- }
- } else {
- if (s >= 0 && s < jisx0212_ucs_table_size) {
- w = jisx0212_ucs_table[s];
- } else {
- w = 0;
- }
- if (w <= 0) {
- w = (c1 << 8) | c;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_JIS0212;
- }
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if (c == 0x1b) {
- filter->status += 2;
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- /* ESC */
-/* case 0x02: */
-/* case 0x12: */
-/* case 0x22: */
-/* case 0x82: */
-/* case 0x92: */
- case 2:
- if (c == 0x24) { /* '$' */
- filter->status++;
- } else if (c == 0x28) { /* '(' */
- filter->status += 3;
- } else {
- filter->status &= ~0xf;
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC));
- goto retry;
- }
- break;
-
- /* ESC $ */
-/* case 0x03: */
-/* case 0x13: */
-/* case 0x23: */
-/* case 0x83: */
-/* case 0x93: */
- case 3:
- if (c == 0x40 || c == 0x42) { /* '@' or 'B' */
- filter->status = 0x80;
- } else if (c == 0x28) { /* '(' */
- filter->status++;
- } else {
- filter->status &= ~0xf;
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x24, filter->data TSRMLS_CC));
- goto retry;
- }
- break;
-
- /* ESC $ ( */
-/* case 0x04: */
-/* case 0x14: */
-/* case 0x24: */
-/* case 0x84: */
-/* case 0x94: */
- case 4:
- if (c == 0x40 || c == 0x42) { /* '@' or 'B' */
- filter->status = 0x80;
- } else if (c == 0x44) { /* 'D' */
- filter->status = 0x90;
- } else {
- filter->status &= ~0xf;
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x24, filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x28, filter->data TSRMLS_CC));
- goto retry;
- }
- break;
-
- /* ESC ( */
-/* case 0x05: */
-/* case 0x15: */
-/* case 0x25: */
-/* case 0x85: */
-/* case 0x95: */
- case 5:
- if (c == 0x42 || c == 0x48) { /* 'B' or 'H' */
- filter->status = 0;
- } else if (c == 0x4a) { /* 'J' */
- filter->status = 0x10;
- } else if (c == 0x49) { /* 'I' */
- filter->status = 0x20;
- } else {
- filter->status &= ~0xf;
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x28, filter->data TSRMLS_CC));
- goto retry;
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => JIS
- */
-int
-mbfl_filt_conv_wchar_jis(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, s;
-
- s = 0;
- if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) {
- s = ucs_a1_jis_table[c - ucs_a1_jis_table_min];
- } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) {
- s = ucs_a2_jis_table[c - ucs_a2_jis_table_min];
- } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) {
- s = ucs_i_jis_table[c - ucs_i_jis_table_min];
- } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) {
- s = ucs_r_jis_table[c - ucs_r_jis_table_min];
- }
- if (s <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_JIS0208) {
- s = c & MBFL_WCSPLANE_MASK;
- } else if (c1 == MBFL_WCSPLANE_JIS0212) {
- s = c & MBFL_WCSPLANE_MASK;
- s |= 0x8080;
- } else if (c == 0xa5) { /* YEN SIGN */
- s = 0x1005c;
- } else if (c == 0x203e) { /* OVER LINE */
- s = 0x1007e;
- } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s = 0x2140;
- } else if (c == 0xff5e) { /* FULLWIDTH TILDE */
- s = 0x2141;
- } else if (c == 0x2225) { /* PARALLEL TO */
- s = 0x2142;
- } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
- s = 0x215d;
- } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */
- s = 0x2171;
- } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */
- s = 0x2172;
- } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */
- s = 0x224c;
- }
- if (c == 0) {
- s = 0;
- } else if (s <= 0) {
- s = -1;
- }
- }
- if (s >= 0) {
- if (s < 0x80) { /* ASCII */
- if ((filter->status & 0xff00) != 0) {
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */
- CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); /* '(' */
- CK((*filter->output_function)(0x42, filter->data TSRMLS_CC)); /* 'B' */
- }
- filter->status = 0;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else if (s < 0x100) { /* kana */
- if ((filter->status & 0xff00) != 0x100) {
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */
- CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); /* '(' */
- CK((*filter->output_function)(0x49, filter->data TSRMLS_CC)); /* 'I' */
- }
- filter->status = 0x100;
- CK((*filter->output_function)(s & 0x7f, filter->data TSRMLS_CC));
- } else if (s < 0x8080) { /* X 0208 */
- if ((filter->status & 0xff00) != 0x200) {
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */
- CK((*filter->output_function)(0x24, filter->data TSRMLS_CC)); /* '$' */
- CK((*filter->output_function)(0x42, filter->data TSRMLS_CC)); /* 'B' */
- }
- filter->status = 0x200;
- CK((*filter->output_function)((s >> 8) & 0x7f, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s & 0x7f, filter->data TSRMLS_CC));
- } else if (s < 0x10000) { /* X 0212 */
- if ((filter->status & 0xff00) != 0x300) {
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */
- CK((*filter->output_function)(0x24, filter->data TSRMLS_CC)); /* '$' */
- CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); /* '(' */
- CK((*filter->output_function)(0x44, filter->data TSRMLS_CC)); /* 'D' */
- }
- filter->status = 0x300;
- CK((*filter->output_function)((s >> 8) & 0x7f, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s & 0x7f, filter->data TSRMLS_CC));
- } else { /* X 0201 latin */
- if ((filter->status & 0xff00) != 0x400) {
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */
- CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); /* '(' */
- CK((*filter->output_function)(0x4a, filter->data TSRMLS_CC)); /* 'J' */
- }
- filter->status = 0x400;
- CK((*filter->output_function)(s & 0x7f, filter->data TSRMLS_CC));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-
-/*
- * wchar => ISO-2022-JP
- */
-int
-mbfl_filt_conv_wchar_2022jp(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- s = 0;
- if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) {
- s = ucs_a1_jis_table[c - ucs_a1_jis_table_min];
- } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) {
- s = ucs_a2_jis_table[c - ucs_a2_jis_table_min];
- } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) {
- s = ucs_i_jis_table[c - ucs_i_jis_table_min];
- } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) {
- s = ucs_r_jis_table[c - ucs_r_jis_table_min];
- }
- if (s <= 0) {
- if (c == 0xa5) { /* YEN SIGN */
- s = 0x1005c;
- } else if (c == 0x203e) { /* OVER LINE */
- s = 0x1007e;
- } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s = 0x2140;
- } else if (c == 0xff5e) { /* FULLWIDTH TILDE */
- s = 0x2141;
- } else if (c == 0x2225) { /* PARALLEL TO */
- s = 0x2142;
- } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
- s = 0x215d;
- } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */
- s = 0x2171;
- } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */
- s = 0x2172;
- } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */
- s = 0x224c;
- }
- if (c == 0) {
- s = 0;
- } else if (s <= 0) {
- s = -1;
- }
- } else if ((s >= 0x80 && s < 0x2121) || (s > 0x8080)) {
- s = -1;
- }
- if (s >= 0) {
- if (s < 0x80) { /* ASCII */
- if ((filter->status & 0xff00) != 0) {
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */
- CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); /* '(' */
- CK((*filter->output_function)(0x42, filter->data TSRMLS_CC)); /* 'B' */
- }
- filter->status = 0;
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else if (s < 0x10000) { /* X 0208 */
- if ((filter->status & 0xff00) != 0x200) {
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */
- CK((*filter->output_function)(0x24, filter->data TSRMLS_CC)); /* '$' */
- CK((*filter->output_function)(0x42, filter->data TSRMLS_CC)); /* 'B' */
- }
- filter->status = 0x200;
- CK((*filter->output_function)((s >> 8) & 0x7f, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s & 0x7f, filter->data TSRMLS_CC));
- } else { /* X 0201 latin */
- if ((filter->status & 0xff00) != 0x400) {
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */
- CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); /* '(' */
- CK((*filter->output_function)(0x4a, filter->data TSRMLS_CC)); /* 'J' */
- }
- filter->status = 0x400;
- CK((*filter->output_function)(s & 0x7f, filter->data TSRMLS_CC));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-int
-mbfl_filt_conv_any_jis_flush(mbfl_convert_filter *filter TSRMLS_DC)
-{
- /* back to latin */
- if ((filter->status & 0xff00) != 0) {
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */
- CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); /* '(' */
- CK((*filter->output_function)(0x42, filter->data TSRMLS_CC)); /* 'B' */
- }
- filter->status &= 0xff;
- return 0;
-}
-
-#endif /* HAVE_MBSTR_JA */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/mbstring/mbfilter_ja.h b/ext/mbstring/mbfilter_ja.h
deleted file mode 100644
index 5f15542d61..0000000000
--- a/ext/mbstring/mbfilter_ja.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* charset=UTF-8 */
-
-/*
- * "streamable kanji code filter and converter"
- *
- * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved.
- *
- * This software is released under the GNU Lesser General Public License.
- * (Version 2.1, February 1999)
- * Please read the following detail of the licence (in japanese).
- *
- * ◆使用許諾æ¡ä»¶â—†
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•ã‚Œã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ
- * ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã«é–¢
- * ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ
- * ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利
- * ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用
- * ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’「GNU Lesser General Public License (Version 2.1, February
- * 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser
- * General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢
- * ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚
- *
- * 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã
- * ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“ã‚Œã¾ã§Library General
- * Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚
- * http://www.gnu.org/ --- GNUウェブサイト
- * http://www.gnu.org/copyleft/lesser.html --- ライセンス文é¢
- * ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。
- *
- * ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプロジェクトã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§
- * ã¯ã‚ã‚Šã¾ã›ã‚“。
- *
- * â—†ä¿è¨¼å†…容◆
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€æœŸå¾…ã•ã‚ŒãŸå‹•ä½œãƒ»æ©Ÿèƒ½ãƒ»æ€§èƒ½ã‚’æŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨­è¨ˆã•ã‚Œ
- * 開発ã•ã‚Œã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚ã‚Šã¾ã›ã‚“。ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€Œã“
- * ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•ã‚Œã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定ã®
- * 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•ã‚‰ã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•ã‚ŒãŸã‚Šæš—é»™ã«ç¤ºã•ã‚Œã¦ã„
- * ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åŠ¹ã§ã™ã€‚ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã—ãŸçµæžœãªã„ã—使
- * 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æ害
- * ã€ãƒ‡ãƒ¼ã‚¿ã®æ失ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æ害ã«ã¤ã„ã¦ã¯ã€ãã®æ害ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€…
- * ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è­¦å‘Šã•ã‚Œã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æ害ã®è³ 
- * å„ŸãŠã‚ˆã³è£œå¡«ã‚’è¡Œã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ»
- * 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚
- *
- * ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—†
- *
- * 〒102-0073
- * æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F
- * æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ
- * Phone: 03-3512-3655, Fax: 03-3512-3656
- * Email: sales@happysize.co.jp
- * Web: http://happysize.com/
- *
- * ◆著者◆
- *
- * 金本 茂 <sgk@happysize.co.jp>
- *
- * ◆履歴◆
- *
- * 1998/11/10 sgk implementation in C++
- * 1999/4/25 sgk Cã§æ›¸ããªãŠã—。
- * 1999/4/26 sgk 入力フィルタを実装。漢字コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’追加。
- * 1999/6/?? Unicodeサãƒãƒ¼ãƒˆã€‚
- * 1999/6/22 sgk ライセンスをLGPLã«å¤‰æ›´ã€‚
- *
- */
-
-/*
- * Unicode support
- *
- * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team.
- * All rights reserved.
- *
- */
-
-/* $Id$ */
-
-#ifndef MBFL_MBFILTER_JA_H
-#define MBFL_MBFILTER_JA_H
-
-int mbfl_filt_conv_eucjp_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_eucjp(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_eucjpwin_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_eucjpwin(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_sjis_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_sjis(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_sjiswin_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_sjiswin(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_jis_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_jis(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_2022jp(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_any_jis_flush(mbfl_convert_filter *filter TSRMLS_DC);
-
-#endif /* MBFL_MBFILTER_JA_H */
diff --git a/ext/mbstring/mbfilter_kr.c b/ext/mbstring/mbfilter_kr.c
deleted file mode 100644
index 0d7e7efce8..0000000000
--- a/ext/mbstring/mbfilter_kr.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rui Hirokawa <hirokawa@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * "streamable korean code filter and converter"
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-
-#if defined(HAVE_MBSTR_KR)
-#include "mbfilter.h"
-#include "mbfilter_cn.h"
-
-#include "unicode_table_kr.h"
-
-#define CK(statement) do { if ((statement) < 0) return (-1); } while (0)
-
-
-/*
- * EUC-KR => wchar
- */
-int
-mbfl_filt_conv_euckr_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, w, flag;
-
- switch (filter->status) {
- case 0:
- if (c >= 0 && c < 0x80) { /* latin */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else if (c > 0xa0 && c < 0xff && c != 0xc9) { /* dbcs lead byte */
- filter->status = 1;
- filter->cache = c;
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 1: /* dbcs second byte */
- filter->status = 0;
- c1 = filter->cache;
- flag = 0;
- if (c1 >= 0xa1 && c1 <= 0xc6) {
- flag = 1;
- } else if (c1 >= 0xc7 && c1 <= 0xfe && c1 != 0xc9) {
- flag = 2;
- }
- if (flag > 0 && c >= 0xa1 && c <= 0xfe) {
- if (flag == 1){ /* 1st: 0xa1..0xc6, 2nd: 0x41..0x7a, 0x81..0xfe */
- w = (c1 - 0xa1)*190 + (c - 0x41);
- if (w >= 0 && w < uhc2_ucs_table_size) {
- w = uhc2_ucs_table[w];
- } else {
- w = 0;
- }
- } else { /* 1st: 0xc7..0xc8,0xca..0xfe, 2nd: 0xa1..0xfe */
- w = (c1 - 0xc7)*94 + (c - 0xa1);
- if (w >= 0 && w < uhc3_ucs_table_size) {
- w = uhc3_ucs_table[w];
- } else {
- w = 0;
- }
- }
-
- if (w <= 0) {
- w = (c1 << 8) | c;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_KSC5601;
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => EUC-KR
- */
-int
-mbfl_filt_conv_wchar_euckr(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, c2, s;
-
- s = 0;
-
- if (c >= ucs_a1_uhc_table_min && c < ucs_a1_uhc_table_max) {
- s = ucs_a1_uhc_table[c - ucs_a1_uhc_table_min];
- } else if (c >= ucs_a2_uhc_table_min && c < ucs_a2_uhc_table_max) {
- s = ucs_a2_uhc_table[c - ucs_a2_uhc_table_min];
- } else if (c >= ucs_a3_uhc_table_min && c < ucs_a3_uhc_table_max) {
- s = ucs_a3_uhc_table[c - ucs_a3_uhc_table_min];
- } else if (c >= ucs_i_uhc_table_min && c < ucs_i_uhc_table_max) {
- s = ucs_i_uhc_table[c - ucs_i_uhc_table_min];
- } else if (c >= ucs_s_uhc_table_min && c < ucs_s_uhc_table_max) {
- s = ucs_s_uhc_table[c - ucs_s_uhc_table_min];
- } else if (c >= ucs_r1_uhc_table_min && c < ucs_r1_uhc_table_max) {
- s = ucs_r1_uhc_table[c - ucs_r1_uhc_table_min];
- } else if (c >= ucs_r2_uhc_table_min && c < ucs_r2_uhc_table_max) {
- s = ucs_r2_uhc_table[c - ucs_r2_uhc_table_min];
- }
-
- c1 = (s >> 8) & 0xff;
- c2 = s & 0xff;
- /* exclude UHC extension area */
- if (c1 < 0xa1 || c2 < 0xa1){
- s = c;
- }
-
- if (s <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_KSC5601) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- if (c == 0) {
- s = 0;
- } else if (s <= 0) {
- s = -1;
- }
- }
- if (s >= 0) {
- if (s < 0x80) { /* latin */
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-
-/*
- * ISO-2022-KR => wchar
- */
-int
-mbfl_filt_conv_2022kr_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, w, flag;
-
-retry:
- switch (filter->status & 0xf) {
- /* case 0x00: ASCII */
- /* case 0x10: KSC5601 */
- case 0:
- if (c == 0x1b) { /* ESC */
- filter->status += 2;
- } else if (c == 0x0f) { /* SI (ASCII) */
- filter->status &= ~0xff;
- } else if (c == 0x0e) { /* SO (KSC5601) */
- filter->status |= 0x10;
- } else if ((filter->status & 0x10) != 0 && c > 0x20 && c < 0x7f) {
- /* KSC5601 lead byte */
- filter->cache = c;
- filter->status += 1;
- } else if ((filter->status & 0x10) == 0 && c >= 0 && c < 0x80) {
- /* latin, CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 1: /* dbcs second byte */
- filter->status &= ~0xf;
- c1 = filter->cache;
- flag = 0;
- if (c1 > 0x20 && c1 < 0x47) {
- flag = 1;
- } else if (c1 >= 0x47 && c1 <= 0x7e && c1 != 0x49) {
- flag = 2;
- }
- if (flag > 0 && c > 0x20 && c < 0x7f) {
- if (flag == 1){
- w = (c1 - 0x21)*190 + (c - 0x41) + 0x80;
- if (w >= 0 && w < uhc2_ucs_table_size) {
- w = uhc2_ucs_table[w];
- } else {
- w = 0;
- }
- } else {
- w = (c1 - 0x47)*94 + (c - 0x21);
- if (w >= 0 && w < uhc3_ucs_table_size) {
- w = uhc3_ucs_table[w];
- } else {
- w = 0;
- }
- }
-
- if (w <= 0) {
- w = (c1 << 8) | c;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_KSC5601;
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if (c == 0x1b) { /* ESC */
- filter->status++;
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 2: /* ESC */
- if (c == 0x24) { /* '$' */
- filter->status++;
- } else {
- filter->status &= ~0xf;
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC));
- goto retry;
- }
- break;
- case 3: /* ESC $ */
- if (c == 0x29) { /* ')' */
- filter->status++;
- } else {
- filter->status &= ~0xf;
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x24, filter->data TSRMLS_CC));
- goto retry;
- }
- break;
- case 4: /* ESC $ ) */
- if (c == 0x43) { /* 'C' */
- filter->status &= ~0xf;
- filter->status |= 0x100;
- } else {
- filter->status &= ~0xf;
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x24, filter->data TSRMLS_CC));
- CK((*filter->output_function)(0x29, filter->data TSRMLS_CC));
- goto retry;
- }
- break;
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => ISO-2022-KR
- */
-int
-mbfl_filt_conv_wchar_2022kr(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, c2, s;
-
- s = 0;
-
- if (c >= ucs_a1_uhc_table_min && c < ucs_a1_uhc_table_max) {
- s = ucs_a1_uhc_table[c - ucs_a1_uhc_table_min];
- } else if (c >= ucs_a2_uhc_table_min && c < ucs_a2_uhc_table_max) {
- s = ucs_a2_uhc_table[c - ucs_a2_uhc_table_min];
- } else if (c >= ucs_a3_uhc_table_min && c < ucs_a3_uhc_table_max) {
- s = ucs_a3_uhc_table[c - ucs_a3_uhc_table_min];
- } else if (c >= ucs_i_uhc_table_min && c < ucs_i_uhc_table_max) {
- s = ucs_i_uhc_table[c - ucs_i_uhc_table_min];
- } else if (c >= ucs_s_uhc_table_min && c < ucs_s_uhc_table_max) {
- s = ucs_s_uhc_table[c - ucs_s_uhc_table_min];
- } else if (c >= ucs_r1_uhc_table_min && c < ucs_r1_uhc_table_max) {
- s = ucs_r1_uhc_table[c - ucs_r1_uhc_table_min];
- } else if (c >= ucs_r2_uhc_table_min && c < ucs_r2_uhc_table_max) {
- s = ucs_r2_uhc_table[c - ucs_r2_uhc_table_min];
- }
-
- c1 = (s >> 8) & 0xff;
- c2 = s & 0xff;
- /* exclude UHC extension area */
- if (c1 < 0xa1 || c2 < 0xa1){
- s = c;
- }
- if (s & 0x8000) {
- s -= 0x8080;
- }
-
- if (s <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_KSC5601) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- if (c == 0) {
- s = 0;
- } else if (s <= 0) {
- s = -1;
- }
- } else if ((s >= 0x80 && s < 0x2121) || (s > 0x8080)) {
- s = -1;
- }
- if (s >= 0) {
- if (s < 0x80 && s > 0) { /* ASCII */
- if ((filter->status & 0x10) != 0) {
- CK((*filter->output_function)(0x0f, filter->data TSRMLS_CC)); /* SI */
- filter->status &= ~0x10;
- }
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if ( (filter->status & 0x100) == 0) {
- CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */
- CK((*filter->output_function)(0x24, filter->data TSRMLS_CC)); /* '$' */
- CK((*filter->output_function)(0x29, filter->data TSRMLS_CC)); /* ')' */
- CK((*filter->output_function)(0x43, filter->data TSRMLS_CC)); /* 'C' */
- filter->status |= 0x100;
- }
- if ((filter->status & 0x10) == 0) {
- CK((*filter->output_function)(0x0e, filter->data TSRMLS_CC)); /* SO */
- filter->status |= 0x10;
- }
- CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * UHC => wchar
- */
-int
-mbfl_filt_conv_uhc_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, w = 0, flag = 0;
-
- switch (filter->status) {
- case 0:
- if (c >= 0 && c < 0x80) { /* latin */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else if (c > 0x80 && c < 0xff && c != 0xc9) { /* dbcs lead byte */
- filter->status = 1;
- filter->cache = c;
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 1: /* dbcs second byte */
- filter->status = 0;
- c1 = filter->cache;
- if ( c1 >= 0x81 && c1 <= 0xa0){
- w = (c1 - 0x81)*190 + (c - 0x41);
- if (w >= 0 && w < uhc1_ucs_table_size) {
- flag = 1;
- w = uhc1_ucs_table[w];
- } else {
- w = 0;
- }
- } else if ( c1 >= 0xa1 && c1 <= 0xc6){
- w = (c1 - 0xa1)*190 + (c - 0x41);
- if (w >= 0 && w < uhc2_ucs_table_size) {
- flag = 2;
- w = uhc2_ucs_table[w];
- } else {
- w = 0;
- }
- } else if ( c1 >= 0xc7 && c1 <= 0xfe){
- w = (c1 - 0xc7)*94 + (c - 0xa1);
- if (w >= 0 && w < uhc3_ucs_table_size) {
- flag = 3;
- w = uhc3_ucs_table[w];
- } else {
- w = 0;
- }
- }
- if (flag > 0){
- if (w <= 0) {
- w = (c1 << 8) | c;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_UHC;
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else {
- if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => UHC
- */
-int
-mbfl_filt_conv_wchar_uhc(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, s;
-
- s = 0;
- if (c >= ucs_a1_uhc_table_min && c < ucs_a1_uhc_table_max) {
- s = ucs_a1_uhc_table[c - ucs_a1_uhc_table_min];
- } else if (c >= ucs_a2_uhc_table_min && c < ucs_a2_uhc_table_max) {
- s = ucs_a2_uhc_table[c - ucs_a2_uhc_table_min];
- } else if (c >= ucs_a3_uhc_table_min && c < ucs_a3_uhc_table_max) {
- s = ucs_a3_uhc_table[c - ucs_a3_uhc_table_min];
- } else if (c >= ucs_i_uhc_table_min && c < ucs_i_uhc_table_max) {
- s = ucs_i_uhc_table[c - ucs_i_uhc_table_min];
- } else if (c >= ucs_s_uhc_table_min && c < ucs_s_uhc_table_max) {
- s = ucs_s_uhc_table[c - ucs_s_uhc_table_min];
- } else if (c >= ucs_r1_uhc_table_min && c < ucs_r1_uhc_table_max) {
- s = ucs_r1_uhc_table[c - ucs_r1_uhc_table_min];
- } else if (c >= ucs_r2_uhc_table_min && c < ucs_r2_uhc_table_max) {
- s = ucs_r2_uhc_table[c - ucs_r2_uhc_table_min];
- }
- if (s <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_UHC) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- if (c == 0) {
- s = 0;
- } else if (s <= 0) {
- s = -1;
- }
- }
- if (s >= 0) {
- if (s < 0x80) { /* latin */
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-int
-mbfl_filt_conv_any_2022kr_flush(mbfl_convert_filter *filter TSRMLS_DC)
-{
- /* back to ascii */
- if ((filter->status & 0xff00) != 0) {
- CK((*filter->output_function)(0x0f, filter->data TSRMLS_CC)); /* SI */
- }
- filter->status &= 0xff;
- return 0;
-}
-
-#endif /* HAVE_MBSTR_KR */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/mbstring/mbfilter_kr.h b/ext/mbstring/mbfilter_kr.h
deleted file mode 100644
index 34d0d54309..0000000000
--- a/ext/mbstring/mbfilter_kr.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rui Hirokawa <hirokawa@php.net> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef MBFL_MBFILTER_KR_H
-#define MBFL_MBFILTER_KR_H
-
-int mbfl_filt_conv_euckr_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_euckr(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_uhc_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_uhc(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_2022kr_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_2022kr(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_any_2022kr_flush(mbfl_convert_filter *filter TSRMLS_DC);
-
-#endif /* MBFL_MBFILTER_KR_H */
diff --git a/ext/mbstring/mbfilter_ru.c b/ext/mbstring/mbfilter_ru.c
deleted file mode 100644
index 24847aed5e..0000000000
--- a/ext/mbstring/mbfilter_ru.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Den V. Tsopa <tdv@edisoft.ru> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * "russian code filter and converter"
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-
-#if defined(HAVE_MBSTR_RU)
-#include "mbfilter.h"
-#include "unicode_table_ru.h"
-
-/*
- * encoding filter
- */
-#define CK(statement) do { if ((statement) < 0) return (-1); } while (0)
-
-/*
- * cp1251 => wchar
- */
-int
-mbfl_filt_conv_cp1251_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0 && c < cp1251_ucs_table_min) {
- s = c;
- } else if (c >= cp1251_ucs_table_min && c < 0x100) {
- s = cp1251_ucs_table[c - cp1251_ucs_table_min];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_CP1251;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => cp1251
- */
-int
-mbfl_filt_conv_wchar_cp1251(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- if (c < 0x80) {
- s = c;
- } else {
- s = -1;
- n = cp1251_ucs_table_len-1;
- while (n >= 0) {
- if (c == cp1251_ucs_table[n]) {
- s = cp1251_ucs_table_min + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_CP1251) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * cp866 => wchar
- */
-int
-mbfl_filt_conv_cp866_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0 && c < cp866_ucs_table_min) {
- s = c;
- } else if (c >= cp866_ucs_table_min && c < 0x100) {
- s = cp866_ucs_table[c - cp866_ucs_table_min];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_CP866;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => cp866
- */
-int
-mbfl_filt_conv_wchar_cp866(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- if (c < 0x80) {
- s = c;
- } else {
- s = -1;
- n = cp866_ucs_table_len-1;
- while (n >= 0) {
- if (c == cp866_ucs_table[n]) {
- s = cp866_ucs_table_min + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_CP866) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-/*
- * koi8r => wchar
- */
-int
-mbfl_filt_conv_koi8r_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s;
-
- if (c >= 0 && c < koi8r_ucs_table_min) {
- s = c;
- } else if (c >= koi8r_ucs_table_min && c < 0x100) {
- s = koi8r_ucs_table[c - koi8r_ucs_table_min];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_KOI8R;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
-
- return c;
-}
-
-/*
- * wchar => koi8r
- */
-int
-mbfl_filt_conv_wchar_koi8r(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int s, n;
-
- if (c < 0x80) {
- s = c;
- } else {
- s = -1;
- n = koi8r_ucs_table_len-1;
- while (n >= 0) {
- if (c == koi8r_ucs_table[n]) {
- s = koi8r_ucs_table_min + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_KOI8R) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-#endif /* HAVE_MBSTR_RU */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/mbstring/mbfilter_ru.h b/ext/mbstring/mbfilter_ru.h
deleted file mode 100644
index fda4d076b9..0000000000
--- a/ext/mbstring/mbfilter_ru.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Den V. Tsopa <tdv@edisoft.ru> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef MBFL_MBFILTER_RU_H
-#define MBFL_MBFILTER_RU_H
-
-int mbfl_filt_conv_cp1251_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_cp1251(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_cp866_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_cp866(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_koi8r_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_koi8r(int c, mbfl_convert_filter *filter TSRMLS_DC);
-
-#endif /* MBFL_MBFILTER_RU_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/mbstring/mbfilter_tw.c b/ext/mbstring/mbfilter_tw.c
deleted file mode 100644
index bdad919cff..0000000000
--- a/ext/mbstring/mbfilter_tw.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rui Hirokawa <hirokawa@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * "streamable traditional chinese code filter and converter"
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-
-#if defined(HAVE_MBSTR_TW)
-#include "mbfilter.h"
-#include "mbfilter_tw.h"
-
-#include "unicode_table_tw.h"
-
-#define CK(statement) do { if ((statement) < 0) return (-1); } while (0)
-
-/*
- * EUC-TW => wchar
- */
-int
-mbfl_filt_conv_euctw_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, s, w, plane;
-
- switch (filter->status) {
- case 0:
- if (c >= 0 && c < 0x80) { /* latin */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else if (c > 0xa0 && c < 0xff) { /* dbcs first byte */
- filter->status = 1;
- filter->cache = c;
- } else if (c == 0x8e) { /* mbcs first byte */
- filter->status = 2;
- filter->cache = c;
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 1: /* mbcs second byte */
- filter->status = 0;
- c1 = filter->cache;
- if (c > 0xa0 && c < 0xff) {
- w = (c1 - 0xa1)*94 + (c - 0xa1);
- if (w >= 0 && w < cns11643_1_ucs_table_size) {
- w = cns11643_1_ucs_table[w];
- } else {
- w = 0;
- }
- if (w <= 0) {
- w = (c1 << 8) | c;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_CNS11643;
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 2: /* got 0x8e, first char */
- c1 = filter->cache;
- if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- filter->status = 0;
- } else if (c > 0xa0 && c < 0xaf) {
- filter->status = 3;
- filter->cache = c - 0xa1;
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 3: /* got 0x8e, third char */
- filter->status = 0;
- c1 = filter->cache;
- if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- filter->status = 0;
- } else if (c > 0xa0 && c < 0xff) {
- filter->status = 4;
- filter->cache = (c1 << 8) + c - 0xa1;
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 4: /* mbcs fourth char */
- filter->status = 0;
- c1 = filter->cache;
- if (c1 >= 0x100 && c1 <= 0xdff && c > 0xa0 && c < 0xff) {
- plane = (c1 & 0xf00) >> 8;
- s = (c1 & 0xff)*94 + c - 0xa1;
- w = 0;
- if (s >= 0) {
- if (plane == 1 && s < cns11643_2_ucs_table_size) {
- w = cns11643_2_ucs_table[s];
- }
- if (plane == 13 && s < cns11643_14_ucs_table_size) {
- w = cns11643_14_ucs_table[s];
- }
- }
- if (w <= 0) {
- w = ((c1 & 0x7f) << 8) | (c & 0x7f);
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_CNS11643;
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c | 0x8e0000;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => EUC-TW
- */
-int
-mbfl_filt_conv_wchar_euctw(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, s, plane;
-
- s = 0;
- if (c >= ucs_a1_cns11643_table_min && c < ucs_a1_cns11643_table_max) {
- s = ucs_a1_cns11643_table[c - ucs_a1_cns11643_table_min];
- } else if (c >= ucs_a2_cns11643_table_min && c < ucs_a2_cns11643_table_max) {
- s = ucs_a2_cns11643_table[c - ucs_a2_cns11643_table_min];
- } else if (c >= ucs_a3_cns11643_table_min && c < ucs_a3_cns11643_table_max) {
- s = ucs_a3_cns11643_table[c - ucs_a3_cns11643_table_min];
- } else if (c >= ucs_i_cns11643_table_min && c < ucs_i_cns11643_table_max) {
- s = ucs_i_cns11643_table[c - ucs_i_cns11643_table_min];
- } else if (c >= ucs_r_cns11643_table_min && c < ucs_r_cns11643_table_max) {
- s = ucs_r_cns11643_table[c - ucs_r_cns11643_table_min];
- }
- if (s <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_CNS11643) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- if (c == 0) {
- s = 0;
- } else if (s <= 0) {
- s = -1;
- }
- }
- if (s >= 0) {
- plane = (s & 0x1f0000) >> 16;
- if (plane <= 1){
- if (s < 0x80) { /* latin */
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- s = (s & 0xffff) | 0x8080;
- CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC));
- }
- } else {
- s = (0x8ea00000 + (plane << 16)) | ((s & 0xffff) | 0x8080);
- CK((*filter->output_function)(0x8e , filter->data TSRMLS_CC));
- CK((*filter->output_function)((s >> 16) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
- return c;
-}
-
-/*
- * Big5 => wchar
- */
-int
-mbfl_filt_conv_big5_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, w;
-
- switch (filter->status) {
- case 0:
- if (c >= 0 && c < 0x80) { /* latin */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else if (c > 0xa0 && c < 0xff) { /* dbcs lead byte */
- filter->status = 1;
- filter->cache = c;
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- case 1: /* dbcs second byte */
- filter->status = 0;
- c1 = filter->cache;
- if ((c > 0x39 && c < 0x7f) | (c > 0xa0 && c < 0xff)) {
- if (c < 0x7f){
- w = (c1 - 0xa1)*157 + (c - 0x40);
- } else {
- w = (c1 - 0xa1)*157 + (c - 0xa1) + 0x3f;
- }
- if (w >= 0 && w < big5_ucs_table_size) {
- w = big5_ucs_table[w];
- } else {
- w = 0;
- }
- if (w <= 0) {
- w = (c1 << 8) | c;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_BIG5;
- }
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data TSRMLS_CC));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data TSRMLS_CC));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => Big5
- */
-int
-mbfl_filt_conv_wchar_big5(int c, mbfl_convert_filter *filter TSRMLS_DC)
-{
- int c1, s;
-
- s = 0;
- if (c >= ucs_a1_big5_table_min && c < ucs_a1_big5_table_max) {
- s = ucs_a1_big5_table[c - ucs_a1_big5_table_min];
- } else if (c >= ucs_a2_big5_table_min && c < ucs_a2_big5_table_max) {
- s = ucs_a2_big5_table[c - ucs_a2_big5_table_min];
- } else if (c >= ucs_a3_big5_table_min && c < ucs_a3_big5_table_max) {
- s = ucs_a3_big5_table[c - ucs_a3_big5_table_min];
- } else if (c >= ucs_i_big5_table_min && c < ucs_i_big5_table_max) {
- s = ucs_i_big5_table[c - ucs_i_big5_table_min];
- } else if (c >= ucs_pua_big5_table_min && c < ucs_pua_big5_table_max) {
- s = ucs_pua_big5_table[c - ucs_pua_big5_table_min];
- } else if (c >= ucs_r1_big5_table_min && c < ucs_r1_big5_table_max) {
- s = ucs_r1_big5_table[c - ucs_r1_big5_table_min];
- } else if (c >= ucs_r2_big5_table_min && c < ucs_r2_big5_table_max) {
- s = ucs_r2_big5_table[c - ucs_r2_big5_table_min];
- }
- if (s <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_BIG5) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- if (c == 0) {
- s = 0;
- } else if (s <= 0) {
- s = -1;
- }
- }
- if (s >= 0) {
- if (s < 0x80) { /* latin */
- CK((*filter->output_function)(s, filter->data TSRMLS_CC));
- } else {
- CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC));
- CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC));
- }
- }
-
- return c;
-}
-
-#endif /* HAVE_MBSTR_TW */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/mbstring/mbfilter_tw.h b/ext/mbstring/mbfilter_tw.h
deleted file mode 100644
index f6507d2114..0000000000
--- a/ext/mbstring/mbfilter_tw.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rui Hirokawa <hirokawa@php.net> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef MBFL_MBFILTER_TW_H
-#define MBFL_MBFILTER_TW_H
-
-int mbfl_filt_conv_euctw_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_euctw(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_big5_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC);
-int mbfl_filt_conv_wchar_big5(int c, mbfl_convert_filter *filter TSRMLS_DC);
-
-#endif /* MBFL_MBFILTER_TW_H */
diff --git a/ext/mbstring/mbregex.c b/ext/mbstring/mbregex.c
deleted file mode 100644
index 34a0550cb4..0000000000
--- a/ext/mbstring/mbregex.c
+++ /dev/null
@@ -1,4708 +0,0 @@
-/* Extended regular expression matching and search library.
- Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-/* Multi-byte extension added May, 1993 by t^2 (Takahiro Tanimoto)
- Last change: May 21, 1993 by t^2 */
-/* removed gapped buffer support, multiple syntax support by matz <matz@nts.co.jp> */
-/* Perl5 extension added by matz <matz@caelum.co.jp> */
-/* UTF-8 extension added Jan 16 1999 by Yoshida Masato <yoshidam@tau.bekkoame.ne.jp> */
-
-#include "php.h"
-
-#if HAVE_MBREGEX
-
-#define re_compile_pattern mbre_compile_pattern
-#define re_free_pattern mbre_free_pattern
-#define re_adjust_startpos mbre_adjust_startpos
-#define re_compile_fastmap mbre_compile_fastmap
-#define re_search mbre_search
-#define re_match mbre_match
-#define re_set_casetable mbre_set_casetable
-#define re_copy_registers mbre_copy_registers
-#define re_free_registers mbre_free_registers
-
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
-
-/* We write fatal error messages on standard error. */
-#include <stdio.h>
-
-/* isalpha(3) etc. are used for the character classes. */
-#include <ctype.h>
-#include <sys/types.h>
-
-#ifndef PARAMS
-# if defined __GNUC__ || (defined __STDC__ && __STDC__)
-# define PARAMS(args) args
-# else
-# define PARAMS(args) ()
-# endif /* GCC. */
-#endif /* Not PARAMS. */
-
-#if defined(STDC_HEADERS)
-# include <stddef.h>
-#else
-/* We need this for `regex.h', and perhaps for the Emacs include files. */
-# include <sys/types.h>
-#endif
-
-#ifndef __STDC__
-# define volatile
-#endif
-
-#ifdef HAVE_PROTOTYPES
-# define _(args) args
-#else
-# define _(args) ()
-#endif
-
-#ifdef RUBY_PLATFORM
-#include "defines.h"
-
-# define RUBY
-extern int rb_prohibit_interrupt;
-extern int rb_trap_pending;
-void rb_trap_exec _((void));
-
-# define CHECK_INTS if (!rb_prohibit_interrupt) {\
- if (rb_trap_pending) rb_trap_exec();\
-}
-
-#define xmalloc ruby_xmalloc
-#define xcalloc ruby_xcalloc
-#define xrealloc ruby_xrealloc
-#define xfree ruby_xfree
-
-void *xmalloc _((size_t));
-void *xcalloc _((size_t,size_t));
-void *xrealloc _((void*,size_t));
-void xfree _((void*));
-#endif
-
-
-#define xmalloc emalloc
-#define xcalloc ecalloc
-#define xrealloc erealloc
-#define xfree efree
-
-
-/* Make alloca work the best possible way. */
-#ifdef __GNUC__
-# ifndef atarist
-# ifndef alloca
-# define alloca __builtin_alloca
-# endif
-# endif /* atarist */
-#else
-# if defined(HAVE_ALLOCA_H)
-# include <alloca.h>
-# elif !defined(alloca)
-char *alloca();
-# endif
-#endif /* __GNUC__ */
-
-#ifdef _AIX
-#pragma alloca
-#endif
-
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
-
-#ifdef C_ALLOCA
-#define FREE_VARIABLES() alloca(0)
-#else
-#define FREE_VARIABLES()
-#endif
-
-#define FREE_AND_RETURN_VOID(stackb) do { \
- FREE_VARIABLES(); \
- if (stackb != stacka) xfree(stackb); \
- return; \
-} while(0)
-
-#define FREE_AND_RETURN(stackb,val) do { \
- FREE_VARIABLES(); \
- if (stackb != stacka) xfree(stackb); \
- return(val); \
-} while(0)
-
-#define DOUBLE_STACK(type) do { \
- type *stackx; \
- unsigned int xlen = stacke - stackb; \
- if (stackb == stacka) { \
- stackx = (type*)xmalloc(2 * xlen * sizeof(type)); \
- memcpy(stackx, stackb, xlen * sizeof (type)); \
- } \
- else { \
- stackx = (type*)xrealloc(stackb, 2 * xlen * sizeof(type)); \
- } \
- /* Rearrange the pointers. */ \
- stackp = stackx + (stackp - stackb); \
- stackb = stackx; \
- stacke = stackb + 2 * xlen; \
-} while (0)
-
-#define RE_TALLOC(n,t) ((t*)alloca((n)*sizeof(t)))
-#define TMALLOC(n,t) ((t*)xmalloc((n)*sizeof(t)))
-#define TREALLOC(s,n,t) (s=((t*)xrealloc(s,(n)*sizeof(t))))
-
-#define EXPAND_FAIL_STACK() DOUBLE_STACK(unsigned char*)
-#define ENSURE_FAIL_STACK(n) \
- do { \
- if (stacke - stackp <= (n)) { \
- /* if (len > re_max_failures * MAX_NUM_FAILURE_ITEMS) \
- { \
- FREE_AND_RETURN(stackb,(-2)); \
- }*/ \
- \
- /* Roughly double the size of the stack. */ \
- EXPAND_FAIL_STACK(); \
- } \
- } while (0)
-
-/* Get the interface, including the syntax bits. */
-#include "mbregex.h"
-
-/* Subroutines for re_compile_pattern. */
-static void store_jump _((char*, int, char*));
-static void insert_jump _((int, char*, char*, char*));
-static void store_jump_n _((char*, int, char*, unsigned));
-static void insert_jump_n _((int, char*, char*, char*, unsigned));
-#if 0
-static void insert_op _((int, char*, char*));
-#endif
-static void insert_op_2 _((int, char*, char*, int, int));
-static int memcmp_translate _((unsigned char*, unsigned char*, int, const unsigned char*));
-static const unsigned char* re_mbctab_get _((int));
-
-/* Define the syntax stuff, so we can do the \<, \>, etc. */
-
-/* This must be nonzero for the wordchar and notwordchar pattern
- commands in re_match. */
-#define Sword 1
-#define Sword2 2
-
-#define SYNTAX(c) re_syntax_table[c]
-
-static const char casetable[] = {
- '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
- '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
- '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
- '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
- /* ' ' '!' '"' '#' '$' '%' '&' ''' */
- '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
- /* '(' ')' '*' '+' ',' '-' '.' '/' */
- '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
- /* '0' '1' '2' '3' '4' '5' '6' '7' */
- '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
- /* '8' '9' ':' ';' '<' '=' '>' '?' */
- '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
- /* '@' 'A' 'B' 'C' 'D' 'E' 'F' 'G' */
- '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
- /* 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' */
- '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
- /* 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' */
- '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
- /* 'X' 'Y' 'Z' '[' '\' ']' '^' '_' */
- '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
- /* '`' 'a' 'b' 'c' 'd' 'e' 'f' 'g' */
- '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
- /* 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' */
- '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
- /* 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' */
- '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
- /* 'x' 'y' 'z' '{' '|' '}' '~' */
- '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
- '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
- '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
- '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
- '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
- '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
- '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
- '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
- '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
- '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
- '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
- '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
- '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
- '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
- '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
- '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
- '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377',
-};
-
-static char re_syntax_table[256];
-static void init_syntax_once _((void));
-static const unsigned char *translate = (const unsigned char*)casetable;
-static void init_regs _((struct mbre_registers*, unsigned int));
-static void bm_init_skip _((int *, unsigned char*, int, const unsigned char*));
-#if 0
-static int current_mbctype = MBCTYPE_ASCII;
-#endif
-
-#undef P
-
-static unsigned long
-scan_oct(start, len, retlen)
-const char *start;
-int len;
-int *retlen;
-{
- register const char *s = start;
- register unsigned long retval = 0;
-
- while (len-- && *s >= '0' && *s <= '7') {
- retval <<= 3;
- retval |= *s++ - '0';
- }
- *retlen = s - start;
- return retval;
-}
-
-static unsigned long
-scan_hex(start, len, retlen)
-const char *start;
-int len;
-int *retlen;
-{
- static char hexdigit[] = "0123456789abcdef0123456789ABCDEFx";
- register const char *s = start;
- register unsigned long retval = 0;
- char *tmp;
-
- while (len-- && *s && (tmp = strchr(hexdigit, *s))) {
- retval <<= 4;
- retval |= (tmp - hexdigit) & 15;
- s++;
- }
- *retlen = s - start;
- return retval;
-}
-
-#define rt re_syntax_table
-static void
-init_syntax_once()
-{
- register int c;
- static int done = 0;
-
-#ifdef ZTS
- extern MUTEX_T mbregex_locale_mutex;
-#endif
-
- if (done) {
- return;
- }
-#ifdef ZTS
- tsrm_mutex_lock( mbregex_locale_mutex );
-#endif
-
- memset(re_syntax_table, 0, sizeof(re_syntax_table));
-
- for (c=0; c<=0x7f; c++) {
- if (isalnum(c)) {
- re_syntax_table[c] = Sword;
- }
- }
- re_syntax_table['_'] = Sword;
-
- for (c=0x80; c<=0xff; c++) {
- if (isalnum(c)) {
- re_syntax_table[c] = Sword2;
- }
- }
-#ifdef ZTS
- tsrm_mutex_unlock( mbregex_locale_mutex );
-#endif
- done = 1;
-}
-
-void
-re_set_casetable(table)
- const char *table;
-{
- translate = (const unsigned char*)table;
-}
-
-/* Jim Meyering writes:
-
- "... Some ctype macros are valid only for character codes that
- isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
- using /bin/cc or gcc but without giving an ansi option). So, all
- ctype uses should be through macros like ISPRINT... If
- STDC_HEADERS is defined, then autoconf has verified that the ctype
- macros don't need to be guarded with references to isascii. ...
- Defining isascii to 1 should let any compiler worth its salt
- eliminate the && through constant folding."
- Solaris defines some of these symbols so we must undefine them first. */
-
-#undef ISASCII
-#if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
-# define ISASCII(c) 1
-#else
-# define ISASCII(c) isascii(c)
-#endif
-
-#ifdef isblank
-# define ISBLANK(c) (ISASCII(c) && isblank(c))
-#else
-# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
-#endif
-#ifdef isgraph
-# define ISGRAPH(c) (ISASCII(c) && isgraph(c))
-#else
-# define ISGRAPH(c) (ISASCII(c) && isprint(c) && !isspace(c))
-#endif
-
-#undef ISPRINT
-#define ISPRINT(c) (ISASCII(c) && isprint(c))
-#define ISDIGIT(c) (ISASCII(c) && isdigit(c))
-#define ISALNUM(c) (ISASCII(c) && isalnum(c))
-#define ISALPHA(c) (ISASCII(c) && isalpha(c))
-#define ISCNTRL(c) (ISASCII(c) && iscntrl(c))
-#define ISLOWER(c) (ISASCII(c) && islower(c))
-#define ISPUNCT(c) (ISASCII(c) && ispunct(c))
-#define ISSPACE(c) (ISASCII(c) && isspace(c))
-#define ISUPPER(c) (ISASCII(c) && isupper(c))
-#define ISXDIGIT(c) (ISASCII(c) && isxdigit(c))
-
-#ifndef NULL
-# define NULL (void *)0
-#endif
-
-/* We remove any previous definition of `SIGN_EXTEND_CHAR',
- since ours (we hope) works properly with all combinations of
- machines, compilers, `char' and `unsigned char' argument types.
- (Per Bothner suggested the basic approach.) */
-#undef SIGN_EXTEND_CHAR
-#if __STDC__
-# define SIGN_EXTEND_CHAR(c) ((signed char)(c))
-#else /* not __STDC__ */
-/* As in Harbison and Steele. */
-# define SIGN_EXTEND_CHAR(c) ((((unsigned char)(c)) ^ 128) - 128)
-#endif
-
-/* These are the command codes that appear in compiled regular
- expressions, one per byte. Some command codes are followed by
- argument bytes. A command code can specify any interpretation
- whatsoever for its arguments. Zero-bytes may appear in the compiled
- regular expression.
-
- The value of `exactn' is needed in search.c (search_buffer) in emacs.
- So regex.h defines a symbol `RE_EXACTN_VALUE' to be 1; the value of
- `exactn' we use here must also be 1. */
-
-enum regexpcode
- {
- unused=0,
- exactn=1, /* Followed by one byte giving n, then by n literal bytes. */
- begline, /* Fail unless at beginning of line. */
- endline, /* Fail unless at end of line. */
- begbuf, /* Succeeds if at beginning of buffer (if emacs) or at beginning
- of string to be matched (if not). */
- endbuf, /* Analogously, for end of buffer/string. */
- endbuf2, /* End of buffer/string, or newline just before it. */
- begpos, /* Matches where last scan//gsub left off. */
- jump, /* Followed by two bytes giving relative address to jump to. */
- jump_past_alt,/* Same as jump, but marks the end of an alternative. */
- on_failure_jump, /* Followed by two bytes giving relative address of
- place to resume at in case of failure. */
- finalize_jump, /* Throw away latest failure point and then jump to
- address. */
- maybe_finalize_jump, /* Like jump but finalize if safe to do so.
- This is used to jump back to the beginning
- of a repeat. If the command that follows
- this jump is clearly incompatible with the
- one at the beginning of the repeat, such that
- we can be sure that there is no use backtracking
- out of repetitions already completed,
- then we finalize. */
- dummy_failure_jump, /* Jump, and push a dummy failure point. This
- failure point will be thrown away if an attempt
- is made to use it for a failure. A + construct
- makes this before the first repeat. Also
- use it as an intermediary kind of jump when
- compiling an or construct. */
- push_dummy_failure, /* Push a dummy failure point and continue. Used at the end of
- alternatives. */
- succeed_n, /* Used like on_failure_jump except has to succeed n times;
- then gets turned into an on_failure_jump. The relative
- address following it is useless until then. The
- address is followed by two bytes containing n. */
- jump_n, /* Similar to jump, but jump n times only; also the relative
- address following is in turn followed by yet two more bytes
- containing n. */
- try_next, /* Jump to next pattern for the first time,
- leaving this pattern on the failure stack. */
- finalize_push, /* Finalize stack and push the beginning of the pattern
- on the stack to retry (used for non-greedy match) */
- finalize_push_n, /* Similar to finalize_push, buf finalize n time only */
- set_number_at, /* Set the following relative location to the
- subsequent number. */
- anychar, /* Matches any (more or less) one character excluding newlines. */
- anychar_repeat, /* Matches sequence of characters excluding newlines. */
- charset, /* Matches any one char belonging to specified set.
- First following byte is number of bitmap bytes.
- Then come bytes for a bitmap saying which chars are in.
- Bits in each byte are ordered low-bit-first.
- A character is in the set if its bit is 1.
- A character too large to have a bit in the map
- is automatically not in the set. */
- charset_not, /* Same parameters as charset, but match any character
- that is not one of those specified. */
- start_memory, /* Start remembering the text that is matched, for
- storing in a memory register. Followed by one
- byte containing the register number. Register numbers
- must be in the range 0 through MBRE_NREGS. */
- stop_memory, /* Stop remembering the text that is matched
- and store it in a memory register. Followed by
- one byte containing the register number. Register
- numbers must be in the range 0 through MBRE_NREGS. */
- start_paren, /* Place holder at the start of (?:..). */
- stop_paren, /* Place holder at the end of (?:..). */
- casefold_on, /* Turn on casefold flag. */
- casefold_off, /* Turn off casefold flag. */
- option_set, /* Turn on multi line match (match with newlines). */
- start_nowidth, /* Save string point to the stack. */
- stop_nowidth, /* Restore string place at the point start_nowidth. */
- pop_and_fail, /* Fail after popping nowidth entry from stack. */
- stop_backtrack, /* Restore backtrack stack at the point start_nowidth. */
- duplicate, /* Match a duplicate of something remembered.
- Followed by one byte containing the index of the memory
- register. */
- fail, /* always fails. */
- wordchar, /* Matches any word-constituent character. */
- notwordchar, /* Matches any char that is not a word-constituent. */
- wordbeg, /* Succeeds if at word beginning. */
- wordend, /* Succeeds if at word end. */
- wordbound, /* Succeeds if at a word boundary. */
- notwordbound /* Succeeds if not at a word boundary. */
- };
-
-
-/* Number of failure points to allocate space for initially,
- when matching. If this number is exceeded, more space is allocated,
- so it is not a hard limit. */
-
-#ifndef NFAILURES
-#define NFAILURES 160
-#endif
-
-/* Store NUMBER in two contiguous bytes starting at DESTINATION. */
-#define STORE_NUMBER(destination, number) \
- do { (destination)[0] = (number) & 0377; \
- (destination)[1] = (number) >> 8; } while (0)
-
-/* Same as STORE_NUMBER, except increment the destination pointer to
- the byte after where the number is stored. Watch out that values for
- DESTINATION such as p + 1 won't work, whereas p will. */
-#define STORE_NUMBER_AND_INCR(destination, number) \
- do { STORE_NUMBER(destination, number); \
- (destination) += 2; } while (0)
-
-
-/* Put into DESTINATION a number stored in two contingous bytes starting
- at SOURCE. */
-#define EXTRACT_NUMBER(destination, source) \
- do { (destination) = *(source) & 0377; \
- (destination) += SIGN_EXTEND_CHAR(*(char*)((source) + 1)) << 8; } while (0)
-
-/* Same as EXTRACT_NUMBER, except increment the pointer for source to
- point to second byte of SOURCE. Note that SOURCE has to be a value
- such as p, not, e.g., p + 1. */
-#define EXTRACT_NUMBER_AND_INCR(destination, source) \
- do { EXTRACT_NUMBER(destination, source); \
- (source) += 2; } while (0)
-
-
-/* Specify the precise syntax of regexps for compilation. This provides
- for compatibility for various utilities which historically have
- different, incompatible syntaxes.
-
- The argument SYNTAX is a bit-mask comprised of the various bits
- defined in regex.h. */
-#if 0
-long
-re_set_syntax(syntax)
- long syntax;
-{
- /* obsolete */
- return 0;
-}
-#endif
-
-/* Macros for re_compile_pattern, which is found below these definitions. */
-
-#define TRANSLATE_P() ((options&MBRE_OPTION_IGNORECASE) && translate)
-#define MAY_TRANSLATE() ((bufp->options&(MBRE_OPTION_IGNORECASE|MBRE_MAY_IGNORECASE)) && translate)
-/* Fetch the next character in the uncompiled pattern---translating it
- if necessary. Also cast from a signed character in the constant
- string passed to us by the user to an unsigned char that we can use
- as an array index (in, e.g., `translate'). */
-#define PATFETCH(c) \
- do {if (p == pend) goto end_of_pattern; \
- c = (unsigned char) *p++; \
- if (TRANSLATE_P()) c = (unsigned char)translate[c]; \
- } while (0)
-
-/* Fetch the next character in the uncompiled pattern, with no
- translation. */
-#define PATFETCH_RAW(c) \
- do {if (p == pend) goto end_of_pattern; \
- c = (unsigned char)*p++; \
- } while (0)
-
-/* Go backwards one character in the pattern. */
-#define PATUNFETCH p--
-
-#define MBC2WC(c, p) \
- do { \
- if (current_mbctype == MBCTYPE_UTF8) { \
- int n = mbclen(c) - 1; \
- c &= (1<<(MBRE_BYTEWIDTH-2-n)) - 1; \
- while (n--) { \
- c = c << 6 | (*p++ & ((1<<6)-1)); \
- } \
- } \
- else { \
- c <<= 8; \
- c |= (unsigned char)*(p)++; \
- } \
- } while (0)
-
-#define PATFETCH_MBC(c) \
- do { \
- if (p + mbclen(c) - 1 >= pend) goto end_of_pattern; \
- MBC2WC(c, p); \
- } while(0)
-
-#define WC2MBC1ST(c) \
- ((c<0x100)?(c):((current_mbctype != MBCTYPE_UTF8)?(((c)>>8)&0xff):utf8_firstbyte(c)))
-
-static unsigned int
-utf8_firstbyte(c)
- unsigned long c;
-{
- if (c < 0x80) return c;
- if (c <= 0x7ff) return ((c>>6)&0xff)|0xc0;
- if (c <= 0xffff) return ((c>>12)&0xff)|0xe0;
- if (c <= 0x1fffff) return ((c>>18)&0xff)|0xf0;
- if (c <= 0x3ffffff) return ((c>>24)&0xff)|0xf8;
- if (c <= 0x7fffffff) return ((c>>30)&0xff)|0xfc;
-#if SIZEOF_INT > 4
- if (c <= 0xfffffffff) return 0xfe;
-#else
- return 0xfe;
-#endif
-}
-
-#if 0
-static void
-print_mbc(c)
- unsigned int c;
-{
- if (current_mbctype == MBCTYPE_UTF8) {
- if (c < 0x80)
- printf("%c", c);
- else if (c <= 0x7ff)
- printf("%c%c", utf8_firstbyte(c), c&0x3f);
- else if (c <= 0xffff)
- printf("%c%c%c", utf8_firstbyte(c), (c>>6)&0x3f, c&0x3f);
- else if (c <= 0x1fffff)
- printf("%c%c%c%c", utf8_firstbyte(c), (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f);
- else if (c <= 0x3ffffff)
- printf("%c%c%c%c%c", utf8_firstbyte(c), (c>>18)&0x3f, (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f);
- else if (c <= 0x7fffffff)
- printf("%c%c%c%c%c%c", utf8_firstbyte(c), (c>>24)&0x3f, (c>>18)&0x3f, (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f);
- }
- else if (c < 0xff) {
- printf("\\%o", c);
- }
- else {
- printf("%c%c", c>>MBRE_BYTEWIDTH, c&0xff);
- }
-}
-#endif
-
-/* If the buffer isn't allocated when it comes in, use this. */
-#define INIT_BUF_SIZE 28
-
-/* Make sure we have at least N more bytes of space in buffer. */
-#define GET_BUFFER_SPACE(n) \
- do { \
- while (b - bufp->buffer + (size_t)(n) >= (size_t)bufp->allocated) \
- EXTEND_BUFFER; \
- } while (0)
-
-/* Make sure we have one more byte of buffer space and then add CH to it. */
-#define BUFPUSH(ch) \
- do { \
- GET_BUFFER_SPACE(1); \
- *b++ = (char)(ch); \
- } while (0)
-
-/* Extend the buffer by twice its current size via reallociation and
- reset the pointers that pointed into the old allocation to point to
- the correct places in the new allocation. If extending the buffer
- results in it being larger than 1 << 16, then flag memory exhausted. */
-#define EXTEND_BUFFER \
- do { char *old_buffer = bufp->buffer; \
- if (bufp->allocated == (1L<<16)) goto too_big; \
- bufp->allocated *= 2; \
- if (bufp->allocated > (1L<<16)) bufp->allocated = (1L<<16); \
- bufp->buffer = (char*)xrealloc(bufp->buffer, bufp->allocated); \
- if (bufp->buffer == 0) \
- goto memory_exhausted; \
- b = (b - old_buffer) + bufp->buffer; \
- if (fixup_alt_jump) \
- fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer; \
- if (laststart) \
- laststart = (laststart - old_buffer) + bufp->buffer; \
- begalt = (begalt - old_buffer) + bufp->buffer; \
- if (pending_exact) \
- pending_exact = (pending_exact - old_buffer) + bufp->buffer; \
- } while (0)
-
-
-/* Set the bit for character C in a character set list. */
-#define SET_LIST_BIT(c) \
- (b[(unsigned char)(c) / MBRE_BYTEWIDTH] \
- |= 1 << ((unsigned char)(c) % MBRE_BYTEWIDTH))
-
-/* Get the next unsigned number in the uncompiled pattern. */
-#define GET_UNSIGNED_NUMBER(num) \
- do { if (p != pend) { \
- PATFETCH(c); \
- while (ISDIGIT(c)) { \
- if (num < 0) \
- num = 0; \
- num = num * 10 + c - '0'; \
- if (p == pend) \
- break; \
- PATFETCH(c); \
- } \
- } \
- } while (0)
-
-#define STREQ(s1, s2) ((strcmp(s1, s2) == 0))
-
-#define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
-
-#define IS_CHAR_CLASS(string) \
- (STREQ(string, "alpha") || STREQ(string, "upper") \
- || STREQ(string, "lower") || STREQ(string, "digit") \
- || STREQ(string, "alnum") || STREQ(string, "xdigit") \
- || STREQ(string, "space") || STREQ(string, "print") \
- || STREQ(string, "punct") || STREQ(string, "graph") \
- || STREQ(string, "cntrl") || STREQ(string, "blank"))
-
-#define STORE_MBC(p, c) \
- do { \
- (p)[0] = (unsigned char)(((c) >>24) & 0xff); \
- (p)[1] = (unsigned char)(((c) >>16) & 0xff); \
- (p)[2] = (unsigned char)(((c) >> 8) & 0xff); \
- (p)[3] = (unsigned char)(((c) >> 0) & 0xff); \
- } while (0)
-
-#define STORE_MBC_AND_INCR(p, c) \
- do { \
- *(p)++ = (unsigned char)(((c) >>24) & 0xff); \
- *(p)++ = (unsigned char)(((c) >>16) & 0xff); \
- *(p)++ = (unsigned char)(((c) >> 8) & 0xff); \
- *(p)++ = (unsigned char)(((c) >> 0) & 0xff); \
- } while (0)
-
-#define EXTRACT_MBC(p) \
- ((unsigned int)((unsigned char)(p)[0] << 24 | \
- (unsigned char)(p)[1] << 16 | \
- (unsigned char)(p)[2] << 8 | \
- (unsigned char)(p)[3]))
-
-#define EXTRACT_MBC_AND_INCR(p) \
- ((unsigned int)((p) += 4, \
- (unsigned char)(p)[-4] << 24 | \
- (unsigned char)(p)[-3] << 16 | \
- (unsigned char)(p)[-2] << 8 | \
- (unsigned char)(p)[-1]))
-
-#define EXTRACT_UNSIGNED(p) \
- ((unsigned char)(p)[0] | (unsigned char)(p)[1] << 8)
-#define EXTRACT_UNSIGNED_AND_INCR(p) \
- ((p) += 2, (unsigned char)(p)[-2] | (unsigned char)(p)[-1] << 8)
-
-/* Handle (mb)?charset(_not)?.
-
- Structure of mbcharset(_not)? in compiled pattern.
-
- struct {
- unsinged char id; mbcharset(_not)?
- unsigned char sbc_size;
- unsigned char sbc_map[sbc_size]; same as charset(_not)? up to here.
- unsigned short mbc_size; number of intervals.
- struct {
- unsigned long beg; beginning of interval.
- unsigned long end; end of interval.
- } intervals[mbc_size];
- }; */
-
-static void
-set_list_bits(c1, c2, b)
- unsigned long c1, c2;
- unsigned char *b;
-{
- unsigned char sbc_size = b[-1];
- unsigned short mbc_size = EXTRACT_UNSIGNED(&b[sbc_size]);
- unsigned short beg, end, upb;
-
- if (c1 > c2)
- return;
- b = &b[sbc_size + 2];
-
- for (beg = 0, upb = mbc_size; beg < upb; ) {
- unsigned short mid = (unsigned short)(beg + upb) >> 1;
-
- if ((int)c1 - 1 > (int)EXTRACT_MBC(&b[mid*8+4]))
- beg = mid + 1;
- else
- upb = mid;
- }
-
- for (end = beg, upb = mbc_size; end < upb; ) {
- unsigned short mid = (unsigned short)(end + upb) >> 1;
-
- if ((int)c2 >= (int)EXTRACT_MBC(&b[mid*8]) - 1)
- end = mid + 1;
- else
- upb = mid;
- }
-
- if (beg != end) {
- if (c1 > EXTRACT_MBC(&b[beg*8]))
- c1 = EXTRACT_MBC(&b[beg*8]);
- if (c2 < EXTRACT_MBC(&b[(end - 1)*8+4]))
- c2 = EXTRACT_MBC(&b[(end - 1)*8+4]);
- }
- if (end < mbc_size && end != beg + 1)
- /* NOTE: memcpy() would not work here. */
- memmove(&b[(beg + 1)*8], &b[end*8], (mbc_size - end)*8);
- STORE_MBC(&b[beg*8 + 0], c1);
- STORE_MBC(&b[beg*8 + 4], c2);
- mbc_size += beg - end + 1;
- STORE_NUMBER(&b[-2], mbc_size);
-}
-
-static int
-is_in_list(c, b)
- unsigned long c;
- const unsigned char *b;
-{
- unsigned short size;
- unsigned short i, j;
-
- size = *b++;
- if ((int)c / MBRE_BYTEWIDTH < (int)size && b[c / MBRE_BYTEWIDTH] & 1 << c % MBRE_BYTEWIDTH) {
- return 1;
- }
- b += size + 2;
- size = EXTRACT_UNSIGNED(&b[-2]);
- if (size == 0) return 0;
-
- for (i = 0, j = size; i < j; ) {
- unsigned short k = (unsigned short)(i + j) >> 1;
-
- if (c > EXTRACT_MBC(&b[k*8+4]))
- i = k + 1;
- else
- j = k;
- }
- if (i < size && EXTRACT_MBC(&b[i*8]) <= c
- && ((unsigned char)c != '\n' && (unsigned char)c != '\0'))
- return 1;
- return 0;
-}
-
-#if 0
-static void
-print_partial_compiled_pattern(start, end)
- unsigned char *start;
- unsigned char *end;
-{
- int mcnt, mcnt2;
- unsigned char *p = start;
- unsigned char *pend = end;
-
- if (start == NULL) {
- printf("(null)\n");
- return;
- }
-
- /* Loop over pattern commands. */
- while (p < pend) {
- switch ((enum regexpcode)*p++) {
- case unused:
- printf("/unused");
- break;
-
- case exactn:
- mcnt = *p++;
- printf("/exactn/%d", mcnt);
- do {
- putchar('/');
- printf("%c", *p++);
- }
- while (--mcnt);
- break;
-
- case start_memory:
- mcnt = *p++;
- printf("/start_memory/%d/%d", mcnt, *p++);
- break;
-
- case stop_memory:
- mcnt = *p++;
- printf("/stop_memory/%d/%d", mcnt, *p++);
- break;
-
- case start_paren:
- printf("/start_paren");
- break;
-
- case stop_paren:
- printf("/stop_paren");
- break;
-
- case casefold_on:
- printf("/casefold_on");
- break;
-
- case casefold_off:
- printf("/casefold_off");
- break;
-
- case option_set:
- printf("/option_set/%d", *p++);
- break;
-
- case start_nowidth:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- printf("/start_nowidth//%d", mcnt);
- break;
-
- case stop_nowidth:
- printf("/stop_nowidth//");
- p += 2;
- break;
-
- case pop_and_fail:
- printf("/pop_and_fail");
- break;
-
- case stop_backtrack:
- printf("/stop_backtrack//");
- p += 2;
- break;
-
- case duplicate:
- printf("/duplicate/%d", *p++);
- break;
-
- case anychar:
- printf("/anychar");
- break;
-
- case anychar_repeat:
- printf("/anychar_repeat");
- break;
-
- case charset:
- case charset_not:
- {
- register int c;
-
- printf("/charset%s",
- (enum regexpcode)*(p - 1) == charset_not ? "_not" : "");
-
- mcnt = *p++;
- printf("/%d", mcnt);
- for (c = 0; c < mcnt; c++) {
- unsigned bit;
- unsigned char map_byte = p[c];
-
- putchar ('/');
-
- for (bit = 0; bit < MBRE_BYTEWIDTH; bit++)
- if (map_byte & (1 << bit))
- printf("%c", c * MBRE_BYTEWIDTH + bit);
- }
- p += mcnt;
- mcnt = EXTRACT_UNSIGNED_AND_INCR(p);
- printf("/");
- while (mcnt--) {
- print_mbc(EXTRACT_MBC_AND_INCR(p));
- printf("-");
- print_mbc(EXTRACT_MBC_AND_INCR(p));
- }
- break;
- }
-
- case begline:
- printf("/begline");
- break;
-
- case endline:
- printf("/endline");
- break;
-
- case on_failure_jump:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- printf("/on_failure_jump//%d", mcnt);
- break;
-
- case dummy_failure_jump:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- printf("/dummy_failure_jump//%d", mcnt);
- break;
-
- case push_dummy_failure:
- printf("/push_dummy_failure");
- break;
-
- case finalize_jump:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- printf("/finalize_jump//%d", mcnt);
- break;
-
- case maybe_finalize_jump:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- printf("/maybe_finalize_jump//%d", mcnt);
- break;
-
- case jump_past_alt:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- printf("/jump_past_alt//%d", mcnt);
- break;
-
- case jump:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- printf("/jump//%d", mcnt);
- break;
-
- case succeed_n:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- EXTRACT_NUMBER_AND_INCR(mcnt2, p);
- printf("/succeed_n//%d//%d", mcnt, mcnt2);
- break;
-
- case jump_n:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- EXTRACT_NUMBER_AND_INCR(mcnt2, p);
- printf("/jump_n//%d//%d", mcnt, mcnt2);
- break;
-
- case set_number_at:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- EXTRACT_NUMBER_AND_INCR(mcnt2, p);
- printf("/set_number_at//%d//%d", mcnt, mcnt2);
- break;
-
- case try_next:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- printf("/try_next//%d", mcnt);
- break;
-
- case finalize_push:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- printf("/finalize_push//%d", mcnt);
- break;
-
- case finalize_push_n:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- EXTRACT_NUMBER_AND_INCR(mcnt2, p);
- printf("/finalize_push_n//%d//%d", mcnt, mcnt2);
- break;
-
- case wordbound:
- printf("/wordbound");
- break;
-
- case notwordbound:
- printf("/notwordbound");
- break;
-
- case wordbeg:
- printf("/wordbeg");
- break;
-
- case wordend:
- printf("/wordend");
-
- case wordchar:
- printf("/wordchar");
- break;
-
- case notwordchar:
- printf("/notwordchar");
- break;
-
- case begbuf:
- printf("/begbuf");
- break;
-
- case endbuf:
- printf("/endbuf");
- break;
-
- case endbuf2:
- printf("/endbuf2");
- break;
-
- case begpos:
- printf("/begpos");
- break;
-
- default:
- printf("?%d", *(p-1));
- }
- }
- printf("/\n");
-}
-
-
-static void
-print_compiled_pattern(bufp)
- struct mbre_pattern_buffer *bufp;
-{
- unsigned char *buffer = (unsigned char*)bufp->buffer;
-
- print_partial_compiled_pattern(buffer, buffer + bufp->used);
-}
-#endif
-
-static char*
-calculate_must_string(start, end)
- char *start;
- char *end;
-{
- int mcnt;
- int max = 0;
- char *p = start;
- char *pend = end;
- char *must = 0;
-
- if (start == NULL) return 0;
-
- /* Loop over pattern commands. */
- while (p < pend) {
- switch ((enum regexpcode)*p++) {
- case unused:
- break;
-
- case exactn:
- mcnt = *p;
- if (mcnt > max) {
- must = p;
- max = mcnt;
- }
- p += mcnt+1;
- break;
-
- case start_memory:
- case stop_memory:
- p += 2;
- break;
-
- case duplicate:
- p++;
- break;
-
- case casefold_on:
- case casefold_off:
- return 0; /* should not check must_string */
-
- case pop_and_fail:
- case anychar:
- case anychar_repeat:
- case begline:
- case endline:
- case wordbound:
- case notwordbound:
- case wordbeg:
- case wordend:
- case wordchar:
- case notwordchar:
- case begbuf:
- case endbuf:
- case endbuf2:
- case begpos:
- case push_dummy_failure:
- case start_paren:
- case stop_paren:
- case option_set:
- break;
-
- case charset:
- case charset_not:
- mcnt = *p++;
- p += mcnt;
- mcnt = EXTRACT_UNSIGNED_AND_INCR(p);
- while (mcnt--) {
- p += 4;
- }
- break;
-
- case on_failure_jump:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- if (mcnt > 0) p += mcnt;
- if ((enum regexpcode)p[-3] == jump) {
- p -= 2;
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- if (mcnt > 0) p += mcnt;
- }
- break;
-
- case dummy_failure_jump:
- case succeed_n:
- case try_next:
- case jump:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- if (mcnt > 0) p += mcnt;
- break;
-
- case start_nowidth:
- case stop_nowidth:
- case stop_backtrack:
- case finalize_jump:
- case maybe_finalize_jump:
- case finalize_push:
- p += 2;
- break;
-
- case jump_n:
- case set_number_at:
- case finalize_push_n:
- p += 4;
- break;
-
- default:
- break;
- }
- }
- return must;
-}
-
-static unsigned int
-read_backslash(c)
- int c;
-{
- switch (c) {
- case 'n':
- return '\n';
-
- case 't':
- return '\t';
-
- case 'r':
- return '\r';
-
- case 'f':
- return '\f';
-
- case 'v':
- return '\v';
-
- case 'a':
- return '\007';
-
- case 'b':
- return '\010';
-
- case 'e':
- return '\033';
- }
- return c;
-}
-
-static unsigned int
-read_special(p, pend, pp)
- const char *p, *pend, **pp;
-{
- int c;
-
- PATFETCH_RAW(c);
- switch (c) {
- case 'M':
- PATFETCH_RAW(c);
- if (c != '-') return -1;
- PATFETCH_RAW(c);
- *pp = p;
- if (c == '\\') {
- return read_special(p, pend, pp) | 0x80;
- }
- else if (c == -1) return ~0;
- else {
- return ((c & 0xff) | 0x80);
- }
-
- case 'C':
- PATFETCH_RAW(c);
- if (c != '-') return ~0;
- case 'c':
- PATFETCH_RAW(c);
- *pp = p;
- if (c == '\\') {
- c = read_special(p, pend, pp);
- }
- else if (c == '?') return 0177;
- else if (c == -1) return ~0;
- return c & 0x9f;
- default:
- return read_backslash(c);
- }
-
- end_of_pattern:
- return ~0;
-}
-
-/* re_compile_pattern takes a regular-expression string
- and converts it into a buffer full of byte commands for matching.
-
- PATTERN is the address of the pattern string
- SIZE is the length of it.
- BUFP is a struct mbre_pattern_buffer * which points to the info
- on where to store the byte commands.
- This structure contains a char * which points to the
- actual space, which should have been obtained with malloc.
- re_compile_pattern may use realloc to grow the buffer space.
-
- The number of bytes of commands can be found out by looking in
- the `struct mbre_pattern_buffer' that bufp pointed to, after
- re_compile_pattern returns. */
-
-char *
-re_compile_pattern(pattern, size, bufp)
- const char *pattern;
- int size;
- struct mbre_pattern_buffer *bufp;
-{
- register char *b = bufp->buffer;
- register const char *p = pattern;
- const char *nextp;
- const char *pend = pattern + size;
- register unsigned int c, c1=0;
- const char *p0;
- int numlen;
-#define ERROR_MSG_MAX_SIZE 200
- static char error_msg[ERROR_MSG_MAX_SIZE+1];
-
- /* Address of the count-byte of the most recently inserted `exactn'
- command. This makes it possible to tell whether a new exact-match
- character can be added to that command or requires a new `exactn'
- command. */
-
- char *pending_exact = 0;
-
- /* Address of the place where a forward-jump should go to the end of
- the containing expression. Each alternative of an `or', except the
- last, ends with a forward-jump of this sort. */
-
- char *fixup_alt_jump = 0;
-
- /* Address of start of the most recently finished expression.
- This tells postfix * where to find the start of its operand. */
-
- char *laststart = 0;
-
- /* In processing a repeat, 1 means zero matches is allowed. */
-
- char zero_times_ok;
-
- /* In processing a repeat, 1 means many matches is allowed. */
-
- char many_times_ok;
-
- /* In processing a repeat, 1 means non-greedy matches. */
-
- char greedy;
-
- /* Address of beginning of regexp, or inside of last (. */
-
- char *begalt = b;
-
- /* Place in the uncompiled pattern (i.e., the {) to
- which to go back if the interval is invalid. */
- const char *beg_interval;
-
- /* In processing an interval, at least this many matches must be made. */
- int lower_bound;
-
- /* In processing an interval, at most this many matches can be made. */
- int upper_bound;
-
- /* Stack of information saved by ( and restored by ).
- Five stack elements are pushed by each (:
- First, the value of b.
- Second, the value of fixup_alt_jump.
- Third, the value of begalt.
- Fourth, the value of regnum.
- Fifth, the type of the paren. */
-
- int stacka[40];
- int *stackb = stacka;
- int *stackp = stackb;
- int *stacke = stackb + 40;
-
- /* Counts ('s as they are encountered. Remembered for the matching ),
- where it becomes the register number to put in the stop_memory
- command. */
-
- int regnum = 1;
-
- int range = 0;
- int had_mbchar = 0;
- int had_num_literal = 0;
- int had_char_class = 0;
-
- int options = bufp->options;
-
- int current_mbctype = bufp->mbctype;
- const unsigned char *re_mbctab = re_mbctab_get(current_mbctype);
-
- bufp->fastmap_accurate = 0;
- bufp->must = 0;
- bufp->must_skip = 0;
- bufp->stclass = 0;
-
- /* Initialize the syntax table. */
- init_syntax_once();
-
- if (bufp->allocated == 0) {
- bufp->allocated = INIT_BUF_SIZE;
- if (bufp->buffer)
- /* EXTEND_BUFFER loses when bufp->allocated is 0. */
- bufp->buffer = (char*)xrealloc(bufp->buffer, INIT_BUF_SIZE);
- else
- /* Caller did not allocate a buffer. Do it for them. */
- bufp->buffer = (char*)xmalloc(INIT_BUF_SIZE);
- if (!bufp->buffer) goto memory_exhausted;
- begalt = b = bufp->buffer;
- }
-
- while (p != pend) {
- PATFETCH(c);
-
- switch (c) {
- case '$':
- if (bufp->options & MBRE_OPTION_SINGLELINE) {
- BUFPUSH(endbuf);
- }
- else {
- p0 = p;
- /* When testing what follows the $,
- look past the \-constructs that don't consume anything. */
-
- while (p0 != pend) {
- if (*p0 == '\\' && p0 + 1 != pend
- && (p0[1] == 'b' || p0[1] == 'B'))
- p0 += 2;
- else
- break;
- }
- BUFPUSH(endline);
- }
- break;
-
- case '^':
- if (bufp->options & MBRE_OPTION_SINGLELINE)
- BUFPUSH(begbuf);
- else
- BUFPUSH(begline);
- break;
-
- case '+':
- case '?':
- case '*':
- /* If there is no previous pattern, char not special. */
- if (!laststart) {
- snprintf(error_msg, ERROR_MSG_MAX_SIZE,
- "invalid regular expression; there's no previous pattern, to which '%c' would define cardinality at %d",
- c, p-pattern);
- if (bufp->buffer) {
- xfree(bufp->buffer);
- }
- FREE_AND_RETURN(stackb, error_msg);
- }
- /* If there is a sequence of repetition chars,
- collapse it down to just one. */
- zero_times_ok = c != '+';
- many_times_ok = c != '?';
- greedy = 1;
- if (p != pend) {
- PATFETCH(c);
- switch (c) {
- case '?':
- greedy = 0;
- break;
- case '*':
- case '+':
- goto nested_meta;
- default:
- PATUNFETCH;
- break;
- }
- }
-
- repeat:
- /* Star, etc. applied to an empty pattern is equivalent
- to an empty pattern. */
- if (!laststart)
- break;
-
- if (greedy && many_times_ok && *laststart == anychar && b - laststart <= 2) {
- if (b[-1] == stop_paren)
- b--;
- if (zero_times_ok)
- *laststart = anychar_repeat;
- else {
- BUFPUSH(anychar_repeat);
- }
- break;
- }
- /* Now we know whether or not zero matches is allowed
- and also whether or not two or more matches is allowed. */
- if (many_times_ok) {
- /* If more than one repetition is allowed, put in at the
- end a backward relative jump from b to before the next
- jump we're going to put in below (which jumps from
- laststart to after this jump). */
- GET_BUFFER_SPACE(3);
- store_jump(b,greedy?maybe_finalize_jump:finalize_push,laststart-3);
- b += 3; /* Because store_jump put stuff here. */
- }
-
- /* On failure, jump from laststart to next pattern, which will be the
- end of the buffer after this jump is inserted. */
- GET_BUFFER_SPACE(3);
- insert_jump(on_failure_jump, laststart, b + 3, b);
- b += 3;
-
- if (zero_times_ok) {
- if (greedy == 0) {
- GET_BUFFER_SPACE(3);
- insert_jump(try_next, laststart, b + 3, b);
- b += 3;
- }
- }
- else {
- /* At least one repetition is required, so insert a
- `dummy_failure_jump' before the initial
- `on_failure_jump' instruction of the loop. This
- effects a skip over that instruction the first time
- we hit that loop. */
- GET_BUFFER_SPACE(3);
- insert_jump(dummy_failure_jump, laststart, laststart + 6, b);
- b += 3;
- }
- break;
-
- case '.':
- laststart = b;
- BUFPUSH(anychar);
- break;
-
- case '[':
- if (p == pend)
- FREE_AND_RETURN(stackb, "invalid regular expression; '[' can't be the last character ie. can't start range at the end of pattern");
- while ((b - bufp->buffer + 9 + (1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH)
- > bufp->allocated)
- EXTEND_BUFFER;
-
- laststart = b;
- if (*p == '^') {
- BUFPUSH(charset_not);
- p++;
- }
- else
- BUFPUSH(charset);
- p0 = p;
-
- BUFPUSH((1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH);
- /* Clear the whole map */
- memset(b, 0, (1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH + 2);
-
- had_mbchar = 0;
- had_num_literal = 0;
- had_char_class = 0;
-
- /* Read in characters and ranges, setting map bits. */
- for (;;) {
- int size;
- unsigned last = (unsigned)-1;
-
- if ((size = EXTRACT_UNSIGNED(&b[(1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH]))
- || current_mbctype) {
- /* Ensure the space is enough to hold another interval
- of multi-byte chars in charset(_not)?. */
- size = (1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH + 2 + size*8 + 8;
- while (b + size + 1 > bufp->buffer + bufp->allocated)
- EXTEND_BUFFER;
- }
- range_retry:
- if (range && had_char_class) {
- FREE_AND_RETURN(stackb, "invalid regular expression; can't use character class as an end value of range");
- }
- PATFETCH(c);
-
- if (c == ']') {
- if (p == p0 + 1) {
- if (p == pend)
- FREE_AND_RETURN(stackb, "invalid regular expression; empty character class");
- }
- else
- /* Stop if this isn't merely a ] inside a bracket
- expression, but rather the end of a bracket
- expression. */
- break;
- }
- /* Look ahead to see if it's a range when the last thing
- was a character class. */
- if (had_char_class && c == '-' && *p != ']')
- FREE_AND_RETURN(stackb, "invalid regular expression; can't use character class as a start value of range");
- if (ismbchar(c)) {
- PATFETCH_MBC(c);
- had_mbchar++;
- }
- had_char_class = 0;
-
- /* \ escapes characters when inside [...]. */
- if (c == '\\') {
- PATFETCH_RAW(c);
- switch (c) {
- case 'w':
- for (c = 0; c < (1 << MBRE_BYTEWIDTH); c++) {
- if (SYNTAX(c) == Sword ||
- (!current_mbctype && SYNTAX(c) == Sword2))
- SET_LIST_BIT(c);
- }
- if (current_mbctype) {
- set_list_bits(0x80, 0xffffffff, b);
- }
- had_char_class = 1;
- last = -1;
- continue;
-
- case 'W':
- for (c = 0; c < (1 << MBRE_BYTEWIDTH); c++) {
- if (SYNTAX(c) != Sword &&
- ((current_mbctype && !re_mbctab[c]) ||
- (!current_mbctype && SYNTAX(c) != Sword2)))
- SET_LIST_BIT(c);
- }
- had_char_class = 1;
- last = -1;
- continue;
-
- case 's':
- for (c = 0; c < 256; c++)
- if (ISSPACE(c))
- SET_LIST_BIT(c);
- had_char_class = 1;
- last = -1;
- continue;
-
- case 'S':
- for (c = 0; c < 256; c++)
- if (!ISSPACE(c))
- SET_LIST_BIT(c);
- if (current_mbctype)
- set_list_bits(0x80, 0xffffffff, b);
- had_char_class = 1;
- last = -1;
- continue;
-
- case 'd':
- for (c = '0'; c <= '9'; c++)
- SET_LIST_BIT(c);
- had_char_class = 1;
- last = -1;
- continue;
-
- case 'D':
- for (c = 0; c < 256; c++)
- if (!ISDIGIT(c))
- SET_LIST_BIT(c);
- if (current_mbctype)
- set_list_bits(0x80, 0xffffffff, b);
- had_char_class = 1;
- last = -1;
- continue;
-
- case 'x':
- c = scan_hex(p, 2, &numlen);
- p += numlen;
- had_num_literal = 1;
- break;
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- PATUNFETCH;
- c = scan_oct(p, 3, &numlen);
- p += numlen;
- had_num_literal = 1;
- break;
-
- case 'M':
- case 'C':
- case 'c':
- p0 = --p;
- c = read_special(p, pend, &p0);
- if (c > 255) goto invalid_escape;
- p = p0;
- had_num_literal = 1;
- break;
-
- default:
- c = read_backslash(c);
- if (ismbchar(c)) {
- PATFETCH_MBC(c);
- had_mbchar++;
- }
- break;
- }
- }
-
- /* Get a range. */
- if (range) {
- if (last > c)
- goto invalid_pattern;
-
- range = 0;
- if (had_mbchar == 0) {
- for (;last<=c;last++)
- SET_LIST_BIT(last);
- }
- else if (had_mbchar == 2) {
- set_list_bits(last, c, b);
- }
- else {
- /* restriction: range between sbc and mbc */
- goto invalid_pattern;
- }
- }
- else if (p[0] == '-' && p[1] != ']') {
- last = c;
- PATFETCH(c1);
- range = 1;
- goto range_retry;
- }
- else if (c == '[' && *p == ':') {
- /* Leave room for the null. */
- char str[CHAR_CLASS_MAX_LENGTH + 1];
-
- PATFETCH_RAW(c);
- c1 = 0;
-
- /* If pattern is `[[:'. */
- if (p == pend)
- FREE_AND_RETURN(stackb, "invalid regular expression; re can't end '[[:'");
-
- for (;;) {
- PATFETCH (c);
- if (c == ':' || c == ']' || p == pend
- || c1 == CHAR_CLASS_MAX_LENGTH)
- break;
- str[c1++] = c;
- }
- str[c1] = '\0';
-
- /* If isn't a word bracketed by `[:' and:`]':
- undo the ending character, the letters, and leave
- the leading `:' and `[' (but set bits for them). */
- if (c == ':' && *p == ']') {
- int ch;
- char is_alnum = STREQ(str, "alnum");
- char is_alpha = STREQ(str, "alpha");
- char is_blank = STREQ(str, "blank");
- char is_cntrl = STREQ(str, "cntrl");
- char is_digit = STREQ(str, "digit");
- char is_graph = STREQ(str, "graph");
- char is_lower = STREQ(str, "lower");
- char is_print = STREQ(str, "print");
- char is_punct = STREQ(str, "punct");
- char is_space = STREQ(str, "space");
- char is_upper = STREQ(str, "upper");
- char is_xdigit = STREQ(str, "xdigit");
-
- if (!IS_CHAR_CLASS(str)){
- snprintf(error_msg, ERROR_MSG_MAX_SIZE,
- "invalid regular expression; [:%s:] is not a character class", str);
- FREE_AND_RETURN(stackb, error_msg);
- }
-
- /* Throw away the ] at the end of the character class. */
- PATFETCH(c);
-
- if (p == pend)
- FREE_AND_RETURN(stackb, "invalid regular expression; range doesn't have ending ']' after a character class");
-
- for (ch = 0; ch < 1 << MBRE_BYTEWIDTH; ch++) {
- if ( (is_alnum && ISALNUM(ch))
- || (is_alpha && ISALPHA(ch))
- || (is_blank && ISBLANK(ch))
- || (is_cntrl && ISCNTRL(ch))
- || (is_digit && ISDIGIT(ch))
- || (is_graph && ISGRAPH(ch))
- || (is_lower && ISLOWER(ch))
- || (is_print && ISPRINT(ch))
- || (is_punct && ISPUNCT(ch))
- || (is_space && ISSPACE(ch))
- || (is_upper && ISUPPER(ch))
- || (is_xdigit && ISXDIGIT(ch)))
- SET_LIST_BIT(ch);
- }
- had_char_class = 1;
- }
- else {
- c1++;
- while (c1--)
- PATUNFETCH;
- SET_LIST_BIT(TRANSLATE_P()?translate['[']:'[');
- SET_LIST_BIT(TRANSLATE_P()?translate[':']:':');
- had_char_class = 0;
- last = ':';
- }
- }
- else if (had_mbchar == 0 && (!current_mbctype || !had_num_literal)) {
- SET_LIST_BIT(c);
- had_num_literal = 0;
- }
- else
- set_list_bits(c, c, b);
- had_mbchar = 0;
- }
-
- /* Discard any character set/class bitmap bytes that are all
- 0 at the end of the map. Decrement the map-length byte too. */
- while ((int)b[-1] > 0 && b[(int)b[-1] - 1] == 0)
- b[-1]--;
- if (b[-1] != (1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH)
- memmove(&b[(int)b[-1]], &b[(1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH],
- 2 + EXTRACT_UNSIGNED(&b[(1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH])*8);
- b += b[-1] + 2 + EXTRACT_UNSIGNED(&b[(int)b[-1]])*8;
- break;
-
- case '(':
- {
- int old_options = options;
- int push_option = 0;
- int casefold = 0;
-
- PATFETCH(c);
- if (c == '?') {
- int negative = 0;
-
- PATFETCH_RAW(c);
- switch (c) {
- case 'x': case 'p': case 'm': case 'i': case '-':
- for (;;) {
- switch (c) {
- case '-':
- negative = 1;
- break;
-
- case ':':
- case ')':
- break;
-
- case 'x':
- if (negative)
- options &= ~MBRE_OPTION_EXTENDED;
- else
- options |= MBRE_OPTION_EXTENDED;
- break;
-
- case 'p':
- if (negative) {
- if ((options&MBRE_OPTION_POSIXLINE) == MBRE_OPTION_POSIXLINE) {
- options &= ~MBRE_OPTION_POSIXLINE;
- }
- }
- else if ((options&MBRE_OPTION_POSIXLINE) != MBRE_OPTION_POSIXLINE) {
- options |= MBRE_OPTION_POSIXLINE;
- }
- push_option = 1;
- break;
-
- case 'm':
- if (negative) {
- if (options&MBRE_OPTION_MULTILINE) {
- options &= ~MBRE_OPTION_MULTILINE;
- }
- }
- else if (!(options&MBRE_OPTION_MULTILINE)) {
- options |= MBRE_OPTION_MULTILINE;
- }
- push_option = 1;
- break;
-
- case 'i':
- if (negative) {
- if (options&MBRE_OPTION_IGNORECASE) {
- options &= ~MBRE_OPTION_IGNORECASE;
- }
- }
- else if (!(options&MBRE_OPTION_IGNORECASE)) {
- options |= MBRE_OPTION_IGNORECASE;
- }
- casefold = 1;
- break;
-
- default:
- FREE_AND_RETURN(stackb, "undefined (?...) inline option");
- }
- if (c == ')') {
- c = '#'; /* read whole in-line options */
- break;
- }
- if (c == ':') break;
- PATFETCH_RAW(c);
- }
- break;
-
- case '#':
- for (;;) {
- PATFETCH(c);
- if (c == ')') break;
- }
- c = '#';
- break;
-
- case ':':
- case '=':
- case '!':
- case '>':
- break;
-
- default:
- FREE_AND_RETURN(stackb, "undefined (?...) sequence");
- }
- }
- else {
- PATUNFETCH;
- c = '(';
- }
- if (c == '#') {
- if (push_option) {
- BUFPUSH(option_set);
- BUFPUSH(options);
- }
- if (casefold) {
- if (options & MBRE_OPTION_IGNORECASE)
- BUFPUSH(casefold_on);
- else
- BUFPUSH(casefold_off);
- }
- break;
- }
- if (stackp+8 >= stacke) {
- DOUBLE_STACK(int);
- }
-
- /* Laststart should point to the start_memory that we are about
- to push (unless the pattern has MBRE_NREGS or more ('s). */
- /* obsolete: now MBRE_NREGS is just a default register size. */
- *stackp++ = b - bufp->buffer;
- *stackp++ = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0;
- *stackp++ = begalt - bufp->buffer;
- switch (c) {
- case '(':
- BUFPUSH(start_memory);
- BUFPUSH(regnum);
- *stackp++ = regnum++;
- *stackp++ = b - bufp->buffer;
- BUFPUSH(0);
- /* too many ()'s to fit in a byte. (max 254) */
- if (regnum >= MBRE_REG_MAX) goto too_big;
- break;
-
- case '=':
- case '!':
- case '>':
- BUFPUSH(start_nowidth);
- *stackp++ = b - bufp->buffer;
- BUFPUSH(0); /* temporary value */
- BUFPUSH(0);
- if (c != '!') break;
-
- BUFPUSH(on_failure_jump);
- *stackp++ = b - bufp->buffer;
- BUFPUSH(0); /* temporary value */
- BUFPUSH(0);
- break;
-
- case ':':
- BUFPUSH(start_paren);
- pending_exact = 0;
- default:
- break;
- }
- if (push_option) {
- BUFPUSH(option_set);
- BUFPUSH(options);
- }
- if (casefold) {
- if (options & MBRE_OPTION_IGNORECASE)
- BUFPUSH(casefold_on);
- else
- BUFPUSH(casefold_off);
- }
- *stackp++ = c;
- *stackp++ = old_options;
- fixup_alt_jump = 0;
- laststart = 0;
- begalt = b;
- }
- break;
-
- case ')':
- if (stackp == stackb)
- FREE_AND_RETURN(stackb, "unmatched )");
-
- pending_exact = 0;
- if (fixup_alt_jump) {
- /* Push a dummy failure point at the end of the
- alternative for a possible future
- `finalize_jump' to pop. See comments at
- `push_dummy_failure' in `re_match'. */
- BUFPUSH(push_dummy_failure);
-
- /* We allocated space for this jump when we assigned
- to `fixup_alt_jump', in the `handle_alt' case below. */
- store_jump(fixup_alt_jump, jump, b);
- }
- if (options != stackp[-1]) {
- if ((options ^ stackp[-1]) & MBRE_OPTION_IGNORECASE) {
- BUFPUSH((options&MBRE_OPTION_IGNORECASE)?casefold_off:casefold_on);
- }
- if ((options ^ stackp[-1]) != MBRE_OPTION_IGNORECASE) {
- BUFPUSH(option_set);
- BUFPUSH(stackp[-1]);
- }
- }
- p0 = b;
- options = *--stackp;
- switch (c = *--stackp) {
- case '(':
- {
- char *loc = bufp->buffer + *--stackp;
- *loc = regnum - stackp[-1];
- BUFPUSH(stop_memory);
- BUFPUSH(stackp[-1]);
- BUFPUSH(regnum - stackp[-1]);
- stackp--;
- }
- break;
-
- case '!':
- BUFPUSH(pop_and_fail);
- /* back patch */
- STORE_NUMBER(bufp->buffer+stackp[-1], b - bufp->buffer - stackp[-1] - 2);
- stackp--;
- /* fall through */
- case '=':
- BUFPUSH(stop_nowidth);
- /* tell stack-pos place to start_nowidth */
- STORE_NUMBER(bufp->buffer+stackp[-1], b - bufp->buffer - stackp[-1] - 2);
- BUFPUSH(0); /* space to hold stack pos */
- BUFPUSH(0);
- stackp--;
- break;
-
- case '>':
- BUFPUSH(stop_backtrack);
- /* tell stack-pos place to start_nowidth */
- STORE_NUMBER(bufp->buffer+stackp[-1], b - bufp->buffer - stackp[-1] - 2);
- BUFPUSH(0); /* space to hold stack pos */
- BUFPUSH(0);
- stackp--;
- break;
-
- case ':':
- BUFPUSH(stop_paren);
- break;
-
- default:
- break;
- }
- begalt = *--stackp + bufp->buffer;
- stackp--;
- fixup_alt_jump = *stackp ? *stackp + bufp->buffer - 1 : 0;
- laststart = *--stackp + bufp->buffer;
- if (c == '!' || c == '=') laststart = b;
- break;
-
- case '|':
- /* Insert before the previous alternative a jump which
- jumps to this alternative if the former fails. */
- GET_BUFFER_SPACE(3);
- insert_jump(on_failure_jump, begalt, b + 6, b);
- pending_exact = 0;
- b += 3;
- /* The alternative before this one has a jump after it
- which gets executed if it gets matched. Adjust that
- jump so it will jump to this alternative's analogous
- jump (put in below, which in turn will jump to the next
- (if any) alternative's such jump, etc.). The last such
- jump jumps to the correct final destination. A picture:
- _____ _____
- | | | |
- | v | v
- a | b | c
-
- If we are at `b', then fixup_alt_jump right now points to a
- three-byte space after `a'. We'll put in the jump, set
- fixup_alt_jump to right after `b', and leave behind three
- bytes which we'll fill in when we get to after `c'. */
-
- if (fixup_alt_jump)
- store_jump(fixup_alt_jump, jump_past_alt, b);
-
- /* Mark and leave space for a jump after this alternative,
- to be filled in later either by next alternative or
- when know we're at the end of a series of alternatives. */
- fixup_alt_jump = b;
- GET_BUFFER_SPACE(3);
- b += 3;
-
- laststart = 0;
- begalt = b;
- break;
-
- case '{':
- /* If there is no previous pattern, this is an invalid pattern. */
- if (!laststart) {
- snprintf(error_msg, ERROR_MSG_MAX_SIZE,
- "invalid regular expression; there's no previous pattern, to which '{' would define cardinality at %d",
- p-pattern);
- FREE_AND_RETURN(stackb, error_msg);
- }
- if( p == pend)
- FREE_AND_RETURN(stackb, "invalid regular expression; '{' can't be last character" );
-
- beg_interval = p - 1;
-
- lower_bound = -1; /* So can see if are set. */
- upper_bound = -1;
- GET_UNSIGNED_NUMBER(lower_bound);
- if (c == ',') {
- GET_UNSIGNED_NUMBER(upper_bound);
- }
- else
- /* Interval such as `{1}' => match exactly once. */
- upper_bound = lower_bound;
-
- if (lower_bound < 0 || c != '}')
- goto unfetch_interval;
-
- if (lower_bound >= MBRE_DUP_MAX || upper_bound >= MBRE_DUP_MAX)
- FREE_AND_RETURN(stackb, "too big quantifier in {,}");
- if (upper_bound < 0) upper_bound = MBRE_DUP_MAX;
- if (lower_bound > upper_bound)
- FREE_AND_RETURN(stackb, "can't do {n,m} with n > m");
-
- beg_interval = 0;
- pending_exact = 0;
-
- greedy = 1;
- if (p != pend) {
- PATFETCH(c);
- if (c == '?') greedy = 0;
- else PATUNFETCH;
- }
-
- if (lower_bound == 0) {
- zero_times_ok = 1;
- if (upper_bound == MBRE_DUP_MAX) {
- many_times_ok = 1;
- goto repeat;
- }
- if (upper_bound == 1) {
- many_times_ok = 0;
- goto repeat;
- }
- }
- if (lower_bound == 1) {
- if (upper_bound == 1) {
- /* No need to repeat */
- break;
- }
- if (upper_bound == MBRE_DUP_MAX) {
- many_times_ok = 1;
- zero_times_ok = 0;
- goto repeat;
- }
- }
-
- /* If upper_bound is zero, don't want to succeed at all;
- jump from laststart to b + 3, which will be the end of
- the buffer after this jump is inserted. */
-
- if (upper_bound == 0) {
- GET_BUFFER_SPACE(3);
- insert_jump(jump, laststart, b + 3, b);
- b += 3;
- break;
- }
-
- /* If lower_bound == upper_bound, repeat count can be removed */
- if (lower_bound == upper_bound) {
- int mcnt;
- int skip_stop_paren = 0;
-
- if (b[-1] == stop_paren) {
- skip_stop_paren = 1;
- b--;
- }
-
- if (*laststart == exactn && laststart[1]+2 == b - laststart
- && laststart[1]*lower_bound < 256) {
- mcnt = laststart[1];
- GET_BUFFER_SPACE((lower_bound-1)*mcnt);
- laststart[1] = lower_bound*mcnt;
- while (--lower_bound) {
- memcpy(b, laststart+2, mcnt);
- b += mcnt;
- }
- if (skip_stop_paren) BUFPUSH(stop_paren);
- break;
- }
-
- if (lower_bound < 5 && b - laststart < 10) {
- /* 5 and 10 are the magic numbers */
-
- mcnt = b - laststart;
- GET_BUFFER_SPACE((lower_bound-1)*mcnt);
- while (--lower_bound) {
- memcpy(b, laststart, mcnt);
- b += mcnt;
- }
- if (skip_stop_paren) BUFPUSH(stop_paren);
- break;
- }
- if (skip_stop_paren) b++; /* push back stop_paren */
- }
-
- /* Otherwise, we have a nontrivial interval. When
- we're all done, the pattern will look like:
- set_number_at <jump count> <upper bound>
- set_number_at <succeed_n count> <lower bound>
- succeed_n <after jump addr> <succed_n count>
- <body of loop>
- jump_n <succeed_n addr> <jump count>
- (The upper bound and `jump_n' are omitted if
- `upper_bound' is 1, though.) */
- { /* If the upper bound is > 1, we need to insert
- more at the end of the loop. */
- unsigned int nbytes = (unsigned int)upper_bound == 1 ? 10 : 20;
-
- GET_BUFFER_SPACE(nbytes);
- /* Initialize lower bound of the `succeed_n', even
- though it will be set during matching by its
- attendant `set_number_at' (inserted next),
- because `re_compile_fastmap' needs to know.
- Jump to the `jump_n' we might insert below. */
- insert_jump_n(succeed_n, laststart, b + (nbytes/2),
- b, lower_bound);
- b += 5; /* Just increment for the succeed_n here. */
-
- /* Code to initialize the lower bound. Insert
- before the `succeed_n'. The `5' is the last two
- bytes of this `set_number_at', plus 3 bytes of
- the following `succeed_n'. */
- insert_op_2(set_number_at, laststart, b, 5, lower_bound);
- b += 5;
-
- if (upper_bound > 1) {
- /* More than one repetition is allowed, so
- append a backward jump to the `succeed_n'
- that starts this interval.
-
- When we've reached this during matching,
- we'll have matched the interval once, so
- jump back only `upper_bound - 1' times. */
- GET_BUFFER_SPACE(5);
- store_jump_n(b, greedy?jump_n:finalize_push_n, laststart + 5,
- upper_bound - 1);
- b += 5;
-
- /* The location we want to set is the second
- parameter of the `jump_n'; that is `b-2' as
- an absolute address. `laststart' will be
- the `set_number_at' we're about to insert;
- `laststart+3' the number to set, the source
- for the relative address. But we are
- inserting into the middle of the pattern --
- so everything is getting moved up by 5.
- Conclusion: (b - 2) - (laststart + 3) + 5,
- i.e., b - laststart.
-
- We insert this at the beginning of the loop
- so that if we fail during matching, we'll
- reinitialize the bounds. */
- insert_op_2(set_number_at, laststart, b, b - laststart,
- upper_bound - 1);
- b += 5;
- }
- }
- break;
-
- unfetch_interval:
- /* If an invalid interval, match the characters as literals. */
- p = beg_interval;
- beg_interval = 0;
-
- /* normal_char and normal_backslash need `c'. */
- PATFETCH(c);
- goto normal_char;
-
- case '\\':
- if (p == pend)
- FREE_AND_RETURN(stackb, "invalid regular expression; '\\' can't be last character");
- /* Do not translate the character after the \, so that we can
- distinguish, e.g., \B from \b, even if we normally would
- translate, e.g., B to b. */
- PATFETCH_RAW(c);
- switch (c) {
- case 's':
- case 'S':
- case 'd':
- case 'D':
- while (b - bufp->buffer + 9 + (1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH
- > bufp->allocated)
- EXTEND_BUFFER;
-
- laststart = b;
- if (c == 's' || c == 'd') {
- BUFPUSH(charset);
- }
- else {
- BUFPUSH(charset_not);
- }
-
- BUFPUSH((1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH);
- memset(b, 0, (1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH + 2);
- if (c == 's' || c == 'S') {
- SET_LIST_BIT(' ');
- SET_LIST_BIT('\t');
- SET_LIST_BIT('\n');
- SET_LIST_BIT('\r');
- SET_LIST_BIT('\f');
- }
- else {
- char cc;
-
- for (cc = '0'; cc <= '9'; cc++) {
- SET_LIST_BIT(cc);
- }
- }
-
- while ((int)b[-1] > 0 && b[b[-1] - 1] == 0)
- b[-1]--;
- if (b[-1] != (1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH)
- memmove(&b[(int)b[-1]], &b[(1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH],
- 2 + EXTRACT_UNSIGNED(&b[(1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH])*8);
- b += b[-1] + 2 + EXTRACT_UNSIGNED(&b[(int)b[-1]])*8;
- break;
-
- case 'w':
- laststart = b;
- BUFPUSH(wordchar);
- break;
-
- case 'W':
- laststart = b;
- BUFPUSH(notwordchar);
- break;
-
-#ifndef RUBY
- case '<':
- BUFPUSH(wordbeg);
- break;
-
- case '>':
- BUFPUSH(wordend);
- break;
-#endif
-
- case 'b':
- BUFPUSH(wordbound);
- break;
-
- case 'B':
- BUFPUSH(notwordbound);
- break;
-
- case 'A':
- BUFPUSH(begbuf);
- break;
-
- case 'Z':
- if ((bufp->options & MBRE_OPTION_SINGLELINE) == 0) {
- BUFPUSH(endbuf2);
- break;
- }
- /* fall through */
- case 'z':
- BUFPUSH(endbuf);
- break;
-
- case 'G':
- BUFPUSH(begpos);
- break;
-
- /* hex */
- case 'x':
- had_mbchar = 0;
- c = scan_hex(p, 2, &numlen);
- p += numlen;
- had_num_literal = 1;
- goto numeric_char;
-
- /* octal */
- case '0':
- had_mbchar = 0;
- c = scan_oct(p, 3, &numlen);
- p += numlen;
- had_num_literal = 1;
- goto numeric_char;
-
- /* back-ref or octal */
- case '1': case '2': case '3':
- case '4': case '5': case '6':
- case '7': case '8': case '9':
- PATUNFETCH;
- p0 = p;
-
- had_mbchar = 0;
- c1 = 0;
- GET_UNSIGNED_NUMBER(c1);
- if (!ISDIGIT(c)) PATUNFETCH;
-
- if (9 < c1 && c1 >= (unsigned int)regnum) {
- /* need to get octal */
- c = scan_oct(p0, 3, &numlen) & 0xff;
- p = p0 + numlen;
- c1 = 0;
- had_num_literal = 1;
- goto numeric_char;
- }
-
- laststart = b;
- BUFPUSH(duplicate);
- BUFPUSH(c1);
- break;
-
- case 'M':
- case 'C':
- case 'c':
- p0 = --p;
- c = read_special(p, pend, &p0);
- if (c > 255) goto invalid_escape;
- p = p0;
- had_num_literal = 1;
- goto numeric_char;
-
- default:
- c = read_backslash(c);
- goto normal_char;
- }
- break;
-
- case '#':
- if (options & MBRE_OPTION_EXTENDED) {
- while (p != pend) {
- PATFETCH(c);
- if (c == '\n') break;
- }
- break;
- }
- goto normal_char;
-
- case ' ':
- case '\t':
- case '\f':
- case '\r':
- case '\n':
- if (options & MBRE_OPTION_EXTENDED)
- break;
-
- default:
- normal_char: /* Expects the character in `c'. */
- had_mbchar = 0;
- if (ismbchar(c)) {
- had_mbchar = 1;
- c1 = p - pattern;
- }
- numeric_char:
- nextp = p + mbclen(c) - 1;
- if (!pending_exact || pending_exact + *pending_exact + 1 != b
- || *pending_exact >= (c1 ? 0176 : 0177)
- || *nextp == '+' || *nextp == '?'
- || *nextp == '*' || *nextp == '^'
- || *nextp == '{') {
- laststart = b;
- BUFPUSH(exactn);
- pending_exact = b;
- BUFPUSH(0);
- }
- if (had_num_literal || c == 0xff) {
- BUFPUSH(0xff);
- (*pending_exact)++;
- had_num_literal = 0;
- }
- BUFPUSH(c);
- (*pending_exact)++;
- if (had_mbchar) {
- int len = mbclen(c) - 1;
- while (len--) {
- PATFETCH_RAW(c);
- BUFPUSH(c);
- (*pending_exact)++;
- }
- }
- }
- }
-
- if (fixup_alt_jump)
- store_jump(fixup_alt_jump, jump, b);
-
- if (stackp != stackb)
- FREE_AND_RETURN(stackb, "unmatched (");
-
- /* set optimize flags */
- laststart = bufp->buffer;
- if (laststart != b) {
- if (*laststart == start_memory) laststart += 3;
- if (*laststart == dummy_failure_jump) laststart += 3;
- else if (*laststart == try_next) laststart += 3;
- if (*laststart == anychar_repeat) {
- bufp->options |= MBRE_OPTIMIZE_ANCHOR;
- }
- else if (*laststart == on_failure_jump) {
- int mcnt;
-
- laststart++;
- EXTRACT_NUMBER_AND_INCR(mcnt, laststart);
- if (*laststart == charset || *laststart == charset_not) {
- p0 = laststart;
- mcnt = *++p0;
- p0 += mcnt+1;
- mcnt = EXTRACT_UNSIGNED_AND_INCR(p0);
- p0 += 8*mcnt;
- if (*p0 == maybe_finalize_jump) {
- bufp->stclass = laststart;
- }
- }
- }
- }
-
- bufp->used = b - bufp->buffer;
- bufp->re_nsub = regnum;
- laststart = bufp->buffer;
- if (laststart != b) {
- if (*laststart == start_memory) laststart += 3;
- if (*laststart == exactn) {
- bufp->options |= MBRE_OPTIMIZE_EXACTN;
- bufp->must = laststart+1;
- }
- }
- if (!bufp->must) {
- bufp->must = calculate_must_string(bufp->buffer, b);
- }
- if (current_mbctype == MBCTYPE_SJIS) bufp->options |= MBRE_OPTIMIZE_NO_BM;
- else if (bufp->must) {
- int i;
- int len = (unsigned char)bufp->must[0];
-
- for (i=1; i<len; i++) {
- if ((unsigned char)bufp->must[i] == 0xff ||
- (current_mbctype && ismbchar(bufp->must[i]))) {
- bufp->options |= MBRE_OPTIMIZE_NO_BM;
- break;
- }
- }
- if (!(bufp->options & MBRE_OPTIMIZE_NO_BM)) {
- bufp->must_skip = (int *) xmalloc((1 << MBRE_BYTEWIDTH)*sizeof(int));
- bm_init_skip(bufp->must_skip, (unsigned char*)bufp->must+1,
- (unsigned char)bufp->must[0],
- (unsigned char*)(MAY_TRANSLATE()?translate:0));
- }
- }
-
- bufp->regstart = TMALLOC(regnum, unsigned char*);
- bufp->regend = TMALLOC(regnum, unsigned char*);
- bufp->old_regstart = TMALLOC(regnum, unsigned char*);
- bufp->old_regend = TMALLOC(regnum, unsigned char*);
- bufp->reg_info = TMALLOC(regnum, mbre_register_info_type);
- bufp->best_regstart = TMALLOC(regnum, unsigned char*);
- bufp->best_regend = TMALLOC(regnum, unsigned char*);
- FREE_AND_RETURN(stackb, 0);
-
- invalid_pattern:
- FREE_AND_RETURN(stackb, "invalid regular expression");
-
- end_of_pattern:
- FREE_AND_RETURN(stackb, "premature end of regular expression");
-
- too_big:
- FREE_AND_RETURN(stackb, "regular expression too big");
-
- memory_exhausted:
- FREE_AND_RETURN(stackb, "memory exhausted");
-
- nested_meta:
- FREE_AND_RETURN(stackb, "nested *?+ in regexp");
-
- invalid_escape:
- FREE_AND_RETURN(stackb, "Invalid escape character syntax");
-}
-
-void
-re_free_pattern(bufp)
- struct mbre_pattern_buffer *bufp;
-{
- if(bufp){
- if (bufp->buffer) xfree(bufp->buffer);
- if (bufp->fastmap) xfree(bufp->fastmap);
- if (bufp->must_skip) xfree(bufp->must_skip);
-
- if (bufp->regstart) xfree(bufp->regstart);
- if (bufp->regend) xfree(bufp->regend);
- if (bufp->old_regstart) xfree(bufp->old_regstart);
- if (bufp->old_regend) xfree(bufp->old_regend);
- if (bufp->best_regstart) xfree(bufp->best_regstart);
- if (bufp->best_regend) xfree(bufp->best_regend);
- if (bufp->reg_info) xfree(bufp->reg_info);
- }
-}
-
-/* Store a jump of the form <OPCODE> <relative address>.
- Store in the location FROM a jump operation to jump to relative
- address FROM - TO. OPCODE is the opcode to store. */
-
-static void
-store_jump(from, opcode, to)
- char *from, *to;
- int opcode;
-{
- from[0] = (char)opcode;
- STORE_NUMBER(from + 1, to - (from + 3));
-}
-
-
-/* Open up space before char FROM, and insert there a jump to TO.
- CURRENT_END gives the end of the storage not in use, so we know
- how much data to copy up. OP is the opcode of the jump to insert.
-
- If you call this function, you must zero out pending_exact. */
-
-static void
-insert_jump(op, from, to, current_end)
- int op;
- char *from, *to, *current_end;
-{
- register char *pfrom = current_end; /* Copy from here... */
- register char *pto = current_end + 3; /* ...to here. */
-
- while (pfrom != from)
- *--pto = *--pfrom;
- store_jump(from, op, to);
-}
-
-
-/* Store a jump of the form <opcode> <relative address> <n> .
-
- Store in the location FROM a jump operation to jump to relative
- address FROM - TO. OPCODE is the opcode to store, N is a number the
- jump uses, say, to decide how many times to jump.
-
- If you call this function, you must zero out pending_exact. */
-
-static void
-store_jump_n(from, opcode, to, n)
- char *from, *to;
- int opcode;
- unsigned n;
-{
- from[0] = (char)opcode;
- STORE_NUMBER(from + 1, to - (from + 3));
- STORE_NUMBER(from + 3, n);
-}
-
-
-/* Similar to insert_jump, but handles a jump which needs an extra
- number to handle minimum and maximum cases. Open up space at
- location FROM, and insert there a jump to TO. CURRENT_END gives the
- end of the storage in use, so we know how much data to copy up. OP is
- the opcode of the jump to insert.
-
- If you call this function, you must zero out pending_exact. */
-
-static void
-insert_jump_n(op, from, to, current_end, n)
- int op;
- char *from, *to, *current_end;
- unsigned n;
-{
- register char *pfrom = current_end; /* Copy from here... */
- register char *pto = current_end + 5; /* ...to here. */
-
- while (pfrom != from)
- *--pto = *--pfrom;
- store_jump_n(from, op, to, n);
-}
-
-
-/* Open up space at location THERE, and insert operation OP.
- CURRENT_END gives the end of the storage in use, so
- we know how much data to copy up.
-
- If you call this function, you must zero out pending_exact. */
-
-#if 0
-static void
-insert_op(op, there, current_end)
- int op;
- char *there, *current_end;
-{
- register char *pfrom = current_end; /* Copy from here... */
- register char *pto = current_end + 1; /* ...to here. */
-
- while (pfrom != there)
- *--pto = *--pfrom;
-
- there[0] = (char)op;
-}
-#endif
-
-/* Open up space at location THERE, and insert operation OP followed by
- NUM_1 and NUM_2. CURRENT_END gives the end of the storage in use, so
- we know how much data to copy up.
-
- If you call this function, you must zero out pending_exact. */
-
-static void
-insert_op_2(op, there, current_end, num_1, num_2)
- int op;
- char *there, *current_end;
- int num_1, num_2;
-{
- register char *pfrom = current_end; /* Copy from here... */
- register char *pto = current_end + 5; /* ...to here. */
-
- while (pfrom != there)
- *--pto = *--pfrom;
-
- there[0] = (char)op;
- STORE_NUMBER(there + 1, num_1);
- STORE_NUMBER(there + 3, num_2);
-}
-
-
-#define trans_eq(c1, c2, translate) (translate?(translate[c1]==translate[c2]):((c1)==(c2)))
-static int
-slow_match(little, lend, big, bend, translate)
- unsigned char *little, *lend;
- unsigned char *big, *bend;
- unsigned char *translate;
-{
- int c;
-
- while (little < lend && big < bend) {
- c = *little++;
- if (c == 0xff)
- c = *little++;
- if (!trans_eq(*big++, c, translate)) break;
- }
- if (little == lend) return 1;
- return 0;
-}
-
-static int
-slow_search(little, llen, big, blen, translate, re_mbctab)
- unsigned char *little;
- int llen;
- unsigned char *big;
- int blen;
- char *translate;
- const unsigned char *re_mbctab;
-{
- unsigned char *bsave = big;
- unsigned char *bend = big + blen;
- register int c;
- int fescape = 0;
-
- c = *little;
- if (c == 0xff) {
- c = little[1];
- fescape = 1;
- }
- else if (translate && !ismbchar(c)) {
- c = translate[c];
- }
-
- while (big < bend) {
- /* look for first character */
- if (fescape) {
- while (big < bend) {
- if (*big == c) break;
- big++;
- }
- }
- else if (translate && !ismbchar(c)) {
- while (big < bend) {
- if (ismbchar(*big)) big+=mbclen(*big)-1;
- else if (translate[*big] == c) break;
- big++;
- }
- }
- else {
- while (big < bend) {
- if (*big == c) break;
- if (ismbchar(*big)) big+=mbclen(*big)-1;
- big++;
- }
- }
-
- if (slow_match(little, little+llen, big, bend, translate))
- return big - bsave;
-
- big+=mbclen(*big);
- }
- return -1;
-}
-
-static void
-bm_init_skip(skip, pat, m, translate)
- int *skip;
- unsigned char *pat;
- int m;
- const unsigned char *translate;
-{
- int j, c;
-
- for (c=0; c<256; c++) {
- skip[c] = m;
- }
- if (translate) {
- for (j=0; j<m-1; j++) {
- skip[translate[pat[j]]] = m-1-j;
- }
- }
- else {
- for (j=0; j<m-1; j++) {
- skip[pat[j]] = m-1-j;
- }
- }
-}
-
-static int
-bm_search(little, llen, big, blen, skip, translate)
- unsigned char *little;
- int llen;
- unsigned char *big;
- int blen;
- int *skip;
- unsigned char *translate;
-{
- int i, j, k;
-
- i = llen-1;
- if (translate) {
- while (i < blen) {
- k = i;
- j = llen-1;
- while (j >= 0 && translate[big[k]] == translate[little[j]]) {
- k--;
- j--;
- }
- if (j < 0) return k+1;
-
- i += skip[translate[big[i]]];
- }
- return -1;
- }
- while (i < blen) {
- k = i;
- j = llen-1;
- while (j >= 0 && big[k] == little[j]) {
- k--;
- j--;
- }
- if (j < 0) return k+1;
-
- i += skip[big[i]];
- }
- return -1;
-}
-
-/* Given a pattern, compute a fastmap from it. The fastmap records
- which of the (1 << MBRE_BYTEWIDTH) possible characters can start a string
- that matches the pattern. This fastmap is used by re_search to skip
- quickly over totally implausible text.
-
- The caller must supply the address of a (1 << MBRE_BYTEWIDTH)-byte data
- area as bufp->fastmap.
- The other components of bufp describe the pattern to be used. */
-void
-re_compile_fastmap(bufp)
- struct mbre_pattern_buffer *bufp;
-{
- unsigned char *pattern = (unsigned char*)bufp->buffer;
- int size = bufp->used;
- register char *fastmap = bufp->fastmap;
- register unsigned char *p = pattern;
- register unsigned char *pend = pattern + size;
- register int j, k;
- unsigned is_a_succeed_n;
-
-
- unsigned char *stacka[NFAILURES];
- unsigned char **stackb = stacka;
- unsigned char **stackp = stackb;
- unsigned char **stacke = stackb + NFAILURES;
- int options = bufp->options;
-
- int current_mbctype = bufp->mbctype;
- const unsigned char *re_mbctab = re_mbctab_get(current_mbctype);
-
- memset(fastmap, 0, (1 << MBRE_BYTEWIDTH));
- bufp->fastmap_accurate = 1;
- bufp->can_be_null = 0;
-
- while (p) {
- is_a_succeed_n = 0;
- if (p == pend) {
- bufp->can_be_null = 1;
- break;
- }
-#ifdef SWITCH_ENUM_BUG
- switch ((int)((enum regexpcode)*p++))
-#else
- switch ((enum regexpcode)*p++)
-#endif
- {
- case exactn:
- if (p[1] == 0xff) {
- if (TRANSLATE_P())
- fastmap[translate[p[2]]] = 2;
- else
- fastmap[p[2]] = 2;
- bufp->options |= MBRE_OPTIMIZE_BMATCH;
- }
- else if (TRANSLATE_P())
- fastmap[translate[p[1]]] = 1;
- else
- fastmap[p[1]] = 1;
- break;
-
- case begline:
- case begbuf:
- case endbuf:
- case endbuf2:
- case wordbound:
- case notwordbound:
- case wordbeg:
- case wordend:
- case pop_and_fail:
- case push_dummy_failure:
- case start_paren:
- case stop_paren:
- continue;
-
- case casefold_on:
- bufp->options |= MBRE_MAY_IGNORECASE;
- case casefold_off:
- options ^= MBRE_OPTION_IGNORECASE;
- continue;
-
- case option_set:
- options = *p++;
- continue;
-
- case endline:
- if (TRANSLATE_P())
- fastmap[translate['\n']] = 1;
- else
- fastmap['\n'] = 1;
- if ((options & MBRE_OPTION_SINGLELINE) == 0 && bufp->can_be_null == 0)
- bufp->can_be_null = 2;
- break;
-
- case jump_n:
- case finalize_jump:
- case maybe_finalize_jump:
- case jump:
- case jump_past_alt:
- case dummy_failure_jump:
- case finalize_push:
- case finalize_push_n:
- EXTRACT_NUMBER_AND_INCR(j, p);
- p += j;
- if (j > 0)
- continue;
- /* Jump backward reached implies we just went through
- the body of a loop and matched nothing.
- Opcode jumped to should be an on_failure_jump.
- Just treat it like an ordinary jump.
- For a * loop, it has pushed its failure point already;
- If so, discard that as redundant. */
-
- if ((enum regexpcode)*p != on_failure_jump
- && (enum regexpcode)*p != try_next
- && (enum regexpcode)*p != succeed_n)
- continue;
- p++;
- EXTRACT_NUMBER_AND_INCR(j, p);
- p += j;
- if (stackp != stackb && *stackp == p)
- stackp--; /* pop */
- continue;
-
- case try_next:
- case start_nowidth:
- case stop_nowidth:
- case stop_backtrack:
- p += 2;
- continue;
-
- case succeed_n:
- is_a_succeed_n = 1;
- /* Get to the number of times to succeed. */
- EXTRACT_NUMBER(k, p + 2);
- /* Increment p past the n for when k != 0. */
- if (k != 0) {
- p += 4;
- continue;
- }
- /* fall through */
-
- case on_failure_jump:
- EXTRACT_NUMBER_AND_INCR(j, p);
- if (p + j < pend) {
- if (stackp == stacke) {
- EXPAND_FAIL_STACK();
- }
- *++stackp = p + j; /* push */
- }
- else {
- bufp->can_be_null = 1;
- }
- if (is_a_succeed_n)
- EXTRACT_NUMBER_AND_INCR(k, p); /* Skip the n. */
- continue;
-
- case set_number_at:
- p += 4;
- continue;
-
- case start_memory:
- case stop_memory:
- p += 2;
- continue;
-
- case duplicate:
- bufp->can_be_null = 1;
- fastmap['\n'] = 1;
- case anychar_repeat:
- case anychar:
- for (j = 0; j < (1 << MBRE_BYTEWIDTH); j++) {
- if (j != '\n' || (options & MBRE_OPTION_MULTILINE))
- fastmap[j] = 1;
- }
- if (bufp->can_be_null) {
- FREE_AND_RETURN_VOID(stackb);
- }
- /* Don't return; check the alternative paths
- so we can set can_be_null if appropriate. */
- if ((enum regexpcode)p[-1] == anychar_repeat) {
- continue;
- }
- break;
-
- case wordchar:
- for (j = 0; j < 0x80; j++) {
- if (SYNTAX(j) == Sword)
- fastmap[j] = 1;
- }
- switch (current_mbctype) {
- case MBCTYPE_ASCII:
- for (j = 0x80; j < (1 << MBRE_BYTEWIDTH); j++) {
- if (SYNTAX(j) == Sword2)
- fastmap[j] = 1;
- }
- break;
- case MBCTYPE_EUC:
- case MBCTYPE_SJIS:
- case MBCTYPE_UTF8:
- for (j = 0x80; j < (1 << MBRE_BYTEWIDTH); j++) {
- if (re_mbctab[j])
- fastmap[j] = 1;
- }
- break;
- }
- break;
-
- case notwordchar:
- for (j = 0; j < 0x80; j++)
- if (SYNTAX(j) != Sword)
- fastmap[j] = 1;
- switch (current_mbctype) {
- case MBCTYPE_ASCII:
- for (j = 0x80; j < (1 << MBRE_BYTEWIDTH); j++) {
- if (SYNTAX(j) != Sword2)
- fastmap[j] = 1;
- }
- break;
- case MBCTYPE_EUC:
- case MBCTYPE_SJIS:
- case MBCTYPE_UTF8:
- for (j = 0x80; j < (1 << MBRE_BYTEWIDTH); j++) {
- if (!re_mbctab[j])
- fastmap[j] = 1;
- }
- break;
- }
- break;
-
- case charset:
- /* NOTE: Charset for single-byte chars never contain
- multi-byte char. See set_list_bits(). */
- for (j = *p++ * MBRE_BYTEWIDTH - 1; j >= 0; j--)
- if (p[j / MBRE_BYTEWIDTH] & (1 << (j % MBRE_BYTEWIDTH))) {
- int tmp = TRANSLATE_P()?translate[j]:j;
- fastmap[tmp] = 1;
- }
- {
- unsigned short size;
- unsigned long c, beg, end;
-
- p += p[-1] + 2;
- size = EXTRACT_UNSIGNED(&p[-2]);
- for (j = 0; j < (int)size; j++) {
- c = EXTRACT_MBC(&p[j*8]);
- beg = WC2MBC1ST(c);
- c = EXTRACT_MBC(&p[j*8+4]);
- end = WC2MBC1ST(c);
- /* set bits for 1st bytes of multi-byte chars. */
- while (beg <= end) {
- /* NOTE: Charset for multi-byte chars might contain
- single-byte chars. We must reject them. */
- if (c < 0x100) {
- fastmap[beg] = 2;
- bufp->options |= MBRE_OPTIMIZE_BMATCH;
- }
- else if (ismbchar(beg))
- fastmap[beg] = 1;
- beg++;
- }
- }
- }
- break;
-
- case charset_not:
- /* S: set of all single-byte chars.
- M: set of all first bytes that can start multi-byte chars.
- s: any set of single-byte chars.
- m: any set of first bytes that can start multi-byte chars.
-
- We assume S+M = U.
- ___ _ _
- s+m = (S*s+M*m). */
- /* Chars beyond end of map must be allowed */
- /* NOTE: Charset_not for single-byte chars might contain
- multi-byte chars. See set_list_bits(). */
- for (j = *p * MBRE_BYTEWIDTH; j < (1 << MBRE_BYTEWIDTH); j++)
- if (!ismbchar(j))
- fastmap[j] = 1;
-
- for (j = *p++ * MBRE_BYTEWIDTH - 1; j >= 0; j--)
- if (!(p[j / MBRE_BYTEWIDTH] & (1 << (j % MBRE_BYTEWIDTH)))) {
- if (!ismbchar(j))
- fastmap[j] = 1;
- }
- {
- unsigned short size;
- unsigned long c, beg;
- int num_literal = 0;
-
- p += p[-1] + 2;
- size = EXTRACT_UNSIGNED(&p[-2]);
- if (size == 0) {
- for (j = 0x80; j < (1 << MBRE_BYTEWIDTH); j++)
- if (ismbchar(j))
- fastmap[j] = 1;
- break;
- }
- for (j = 0,c = 0;j < (int)size; j++) {
- unsigned int cc = EXTRACT_MBC(&p[j*8]);
- beg = WC2MBC1ST(cc);
- while (c <= beg) {
- if (ismbchar(c))
- fastmap[c] = 1;
- c++;
- }
-
- cc = EXTRACT_MBC(&p[j*8+4]);
- if (cc < 0xff) {
- num_literal = 1;
- while (c <= cc) {
- if (ismbchar(c))
- fastmap[c] = 1;
- c++;
- }
- }
- c = WC2MBC1ST(cc);
- }
-
- for (j = c; j < (1 << MBRE_BYTEWIDTH); j++) {
- if (num_literal)
- fastmap[j] = 1;
- if (ismbchar(j))
- fastmap[j] = 1;
- }
- }
- break;
-
- case begpos:
- case unused: /* pacify gcc -Wall */
- break;
- case fail:
- break;
- }
-
- /* Get here means we have successfully found the possible starting
- characters of one path of the pattern. We need not follow this
- path any farther. Instead, look at the next alternative
- remembered in the stack. */
- if (stackp != stackb)
- p = *stackp--; /* pop */
- else
- break;
- }
- FREE_AND_RETURN_VOID(stackb);
-}
-
-/* adjust startpos value to the position between characters. */
-int
-re_adjust_startpos(bufp, string, size, startpos, range)
- struct mbre_pattern_buffer *bufp;
- const char *string;
- int size, startpos, range;
-{
- int current_mbctype = bufp->mbctype;
- const unsigned char *re_mbctab = re_mbctab_get(current_mbctype);
-
- /* Update the fastmap now if not correct already. */
- if (!bufp->fastmap_accurate) {
- re_compile_fastmap(bufp);
- }
-
- /* Adjust startpos for mbc string */
- if (current_mbctype && startpos>0 && !(bufp->options&MBRE_OPTIMIZE_BMATCH)) {
- int i = 0;
-
- if (range > 0) {
- while (i<size) {
- i += mbclen(string[i]);
- if (startpos <= i) {
- startpos = i;
- break;
- }
- }
- }
- else {
- int w;
-
- while (i<size) {
- w = mbclen(string[i]);
- if (startpos < i + w) {
- startpos = i;
- break;
- }
- i += w;
- }
- }
- }
- return startpos;
-}
-
-
-/* Using the compiled pattern in BUFP->buffer, first tries to match
- STRING, starting first at index STARTPOS, then at STARTPOS + 1, and
- so on. RANGE is the number of places to try before giving up. If
- RANGE is negative, it searches backwards, i.e., the starting
- positions tried are STARTPOS, STARTPOS - 1, etc. STRING is of SIZE.
- In REGS, return the indices of STRING that matched the entire
- BUFP->buffer and its contained subexpressions.
-
- The value returned is the position in the strings at which the match
- was found, or -1 if no match was found, or -2 if error (such as
- failure stack overflow). */
-
-int
-re_search(bufp, string, size, startpos, range, regs)
- struct mbre_pattern_buffer *bufp;
- const char *string;
- int size, startpos, range;
- struct mbre_registers *regs;
-{
- register char *fastmap = bufp->fastmap;
- int val, anchor = 0;
-
- int current_mbctype = bufp->mbctype;
- const unsigned char *re_mbctab = re_mbctab_get(current_mbctype);
-
- /* Check for out-of-range starting position. */
- if (startpos < 0 || startpos > size)
- return -1;
-
- /* Update the fastmap now if not correct already. */
- if (fastmap && !bufp->fastmap_accurate) {
- re_compile_fastmap(bufp);
- }
-
-
- /* If the search isn't to be a backwards one, don't waste time in a
- search for a pattern that must be anchored. */
- if (bufp->used > 0) {
- switch ((enum regexpcode)bufp->buffer[0]) {
- case begbuf:
- begbuf_match:
- if (range > 0) {
- if (startpos > 0) return -1;
- else {
- val = re_match(bufp, string, size, 0, regs);
- if (val >= 0) return 0;
- return val;
- }
- }
- break;
-
- case begline:
- anchor = 1;
- break;
-
- case begpos:
- val = re_match(bufp, string, size, startpos, regs);
- if (val >= 0) return startpos;
- return val;
-
- default:
- break;
- }
- }
- if (bufp->options & MBRE_OPTIMIZE_ANCHOR) {
- if (bufp->options&MBRE_OPTION_SINGLELINE) {
- goto begbuf_match;
- }
- anchor = 1;
- }
-
- if (bufp->must) {
- int len = ((unsigned char*)bufp->must)[0];
- int pos, pbeg, pend;
-
- pbeg = startpos;
- pend = startpos + range;
- if (pbeg > pend) { /* swap pbeg,pend */
- pos = pend; pend = pbeg; pbeg = pos;
- }
- pend = size;
- if (bufp->options & MBRE_OPTIMIZE_NO_BM) {
- pos = slow_search(bufp->must+1, len,
- string+pbeg, pend-pbeg,
- MAY_TRANSLATE()?translate:0, re_mbctab);
- }
- else {
- pos = bm_search(bufp->must+1, len,
- string+pbeg, pend-pbeg,
- bufp->must_skip,
- MAY_TRANSLATE()?translate:0);
- }
- if (pos == -1) return -1;
- if (range > 0 && (bufp->options & MBRE_OPTIMIZE_EXACTN)) {
- startpos += pos;
- range -= pos;
- if (range < 0) return -1;
- }
- }
-
- for (;;) {
- /* If a fastmap is supplied, skip quickly over characters that
- cannot possibly be the start of a match. Note, however, that
- if the pattern can possibly match the null string, we must
- test it at each starting point so that we take the first null
- string we get. */
-
- if (fastmap && startpos < size
- && bufp->can_be_null != 1 && !(anchor && startpos == 0)) {
- if (range > 0) { /* Searching forwards. */
- register unsigned char *p, c;
- int irange = range;
-
- p = (unsigned char*)string+startpos;
-
- while (range > 0) {
- c = *p++;
- if (ismbchar(c)) {
- int len;
-
- if (fastmap[c])
- break;
- len = mbclen(c) - 1;
- while (len--) {
- c = *p++;
- range--;
- if (fastmap[c] == 2)
- goto startpos_adjust;
- }
- }
- else {
- if (fastmap[MAY_TRANSLATE() ? translate[c] : c])
- break;
- }
- range--;
- }
- startpos_adjust:
- startpos += irange - range;
- }
- else { /* Searching backwards. */
- register unsigned char c;
-
- c = string[startpos];
- c &= 0xff;
- if (MAY_TRANSLATE() ? !fastmap[translate[c]] : !fastmap[c])
- goto advance;
- }
- }
-
- if (startpos > size) return -1;
- if ((anchor || !bufp->can_be_null) && range > 0 && size > 0 && startpos == size)
- return -1;
- val = re_match(bufp, string, size, startpos, regs);
- if (val >= 0) return startpos;
- if (val == -2) return -2;
-
-#ifndef NO_ALLOCA
-#ifdef C_ALLOCA
- alloca(0);
-#endif /* C_ALLOCA */
-#endif /* NO_ALLOCA */
-
- if (range > 0) {
- if (anchor && startpos < size &&
- (startpos < 1 || string[startpos-1] != '\n')) {
- while (range > 0 && string[startpos] != '\n') {
- range--;
- startpos++;
- }
- }
- else if (fastmap && (bufp->stclass)) {
- register unsigned char *p;
- unsigned long c;
- int irange = range;
-
- p = (unsigned char*)string+startpos;
- while (range > 0) {
- c = *p++;
- if (ismbchar(c) && fastmap[c] != 2) {
- MBC2WC(c, p);
- }
- else if (MAY_TRANSLATE())
- c = translate[c];
- if (*bufp->stclass == charset) {
- if (!is_in_list(c, bufp->stclass+1)) break;
- }
- else {
- if (is_in_list(c, bufp->stclass+1)) break;
- }
- range--;
- if (c > 256) range--;
- }
- startpos += irange - range;
- }
- }
-
- advance:
- if (!range)
- break;
- else if (range > 0) {
- const char *d = string + startpos;
-
- if (ismbchar(*d)) {
- int len = mbclen(*d) - 1;
- range-=len, startpos+=len;
- if (!range)
- break;
- }
- range--, startpos++;
- }
- else {
- range++, startpos--;
- {
- const char *s, *d, *p;
-
- s = string; d = string + startpos;
- for (p = d; p-- > s && ismbchar(*p); )
- /* --p >= s would not work on 80[12]?86.
- (when the offset of s equals 0 other than huge model.) */
- ;
- if (!((d - p) & 1)) {
- if (!range)
- break;
- range++, startpos--;
- }
- }
- }
- }
- return -1;
-}
-
-
-
-
-/* The following are used for re_match, defined below: */
-
-/* Accessing macros used in re_match: */
-
-#define IS_ACTIVE(R) ((R).bits.is_active)
-#define MATCHED_SOMETHING(R) ((R).bits.matched_something)
-
-
-/* Macros used by re_match: */
-
-/* I.e., regstart, regend, and reg_info. */
-#define NUM_REG_ITEMS 3
-
-/* I.e., ptr and count. */
-#define NUM_COUNT_ITEMS 2
-
-/* Individual items aside from the registers. */
-#define NUM_NONREG_ITEMS 4
-
-/* We push at most this many things on the stack whenever we
- fail. The `+ 2' refers to PATTERN_PLACE and STRING_PLACE, which are
- arguments to the PUSH_FAILURE_POINT macro. */
-#define MAX_NUM_FAILURE_ITEMS (num_regs * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
-
-/* We push this many things on the stack whenever we fail. */
-#define NUM_FAILURE_ITEMS (last_used_reg * NUM_REG_ITEMS + NUM_NONREG_ITEMS + 1)
-
-/* This pushes counter information for succeed_n and jump_n */
-#define PUSH_FAILURE_COUNT(ptr) \
- do { \
- int c; \
- EXTRACT_NUMBER(c, ptr); \
- ENSURE_FAIL_STACK(NUM_COUNT_ITEMS); \
- *stackp++ = (unsigned char*)(long)c; \
- *stackp++ = (ptr); \
- num_failure_counts++; \
- } while (0)
-
-/* This pushes most of the information about the current state we will want
- if we ever fail back to it. */
-
-#define PUSH_FAILURE_POINT(pattern_place, string_place) \
- do { \
- long last_used_reg, this_reg; \
- \
- /* Find out how many registers are active or have been matched. \
- (Aside from register zero, which is only set at the end.) */ \
- for (last_used_reg = num_regs-1; last_used_reg > 0; last_used_reg--)\
- if (!REG_UNSET(regstart[last_used_reg])) \
- break; \
- \
- ENSURE_FAIL_STACK(NUM_FAILURE_ITEMS); \
- *stackp++ = (unsigned char*)(long)num_failure_counts; \
- num_failure_counts = 0; \
- \
- /* Now push the info for each of those registers. */ \
- for (this_reg = 1; this_reg <= last_used_reg; this_reg++) { \
- *stackp++ = regstart[this_reg]; \
- *stackp++ = regend[this_reg]; \
- *stackp++ = reg_info[this_reg].word; \
- } \
- \
- /* Push how many registers we saved. */ \
- *stackp++ = (unsigned char*)last_used_reg; \
- \
- *stackp++ = pattern_place; \
- *stackp++ = string_place; \
- *stackp++ = (unsigned char*)options; /* current option status */ \
- *stackp++ = (unsigned char*)0; /* non-greedy flag */ \
- } while(0)
-
-#define NON_GREEDY ((unsigned char*)1)
-
-#define POP_FAILURE_COUNT() \
- do { \
- unsigned char *ptr = *--stackp; \
- int count = (long)*--stackp; \
- STORE_NUMBER(ptr, count); \
- } while (0)
-
-/* This pops what PUSH_FAILURE_POINT pushes. */
-
-#define POP_FAILURE_POINT() \
- do { \
- long temp; \
- stackp -= NUM_NONREG_ITEMS; /* Remove failure points (and flag). */ \
- temp = (long)*--stackp; /* How many regs pushed. */ \
- temp *= NUM_REG_ITEMS; /* How much to take off the stack. */ \
- stackp -= temp; /* Remove the register info. */ \
- temp = (long)*--stackp; /* How many counters pushed. */ \
- while (temp--) { \
- POP_FAILURE_COUNT(); /* Remove the counter info. */ \
- } \
- num_failure_counts = 0; /* Reset num_failure_counts. */ \
- } while(0)
-
- /* Registers are set to a sentinel when they haven't yet matched. */
-#define REG_UNSET_VALUE ((unsigned char*)-1)
-#define REG_UNSET(e) ((e) == REG_UNSET_VALUE)
-
-#define PREFETCH if (d == dend) goto fail
-
- /* Call this when have matched something; it sets `matched' flags for the
- registers corresponding to the subexpressions of which we currently
- are inside. */
-#define SET_REGS_MATCHED \
- do { unsigned this_reg; \
- for (this_reg = 0; this_reg < num_regs; this_reg++) { \
- if (IS_ACTIVE(reg_info[this_reg])) \
- MATCHED_SOMETHING(reg_info[this_reg]) = 1; \
- else \
- MATCHED_SOMETHING(reg_info[this_reg]) = 0; \
- } \
- } while(0)
-
-#define AT_STRINGS_BEG(d) ((d) == string)
-#define AT_STRINGS_END(d) ((d) == dend)
-
-#define IS_A_LETTER(d) (SYNTAX(*(d)) == Sword || \
- (current_mbctype ? \
- (re_mbctab[*(d)] && ((d)+mbclen(*(d)))<=dend): \
- SYNTAX(*(d)) == Sword2))
-
-#define PREV_IS_A_LETTER(d) ((current_mbctype == MBCTYPE_SJIS)? \
- IS_A_LETTER((d)-(!AT_STRINGS_BEG((d)-1)&& \
- ismbchar((d)[-2])?2:1)): \
- ((current_mbctype && ((d)[-1] >= 0x80)) || \
- IS_A_LETTER((d)-1)))
-
-static void
-init_regs(regs, num_regs)
- struct mbre_registers *regs;
- unsigned int num_regs;
-{
- int i;
-
- regs->num_regs = num_regs;
- if (num_regs < MBRE_NREGS)
- num_regs = MBRE_NREGS;
-
- if (regs->allocated == 0) {
- regs->beg = TMALLOC(num_regs, int);
- regs->end = TMALLOC(num_regs, int);
- regs->allocated = num_regs;
- }
- else if (regs->allocated < (int)num_regs) {
- TREALLOC(regs->beg, num_regs, int);
- TREALLOC(regs->end, num_regs, int);
- regs->allocated = num_regs;
- }
- for (i=0; i<(int)num_regs; i++) {
- regs->beg[i] = regs->end[i] = -1;
- }
-}
-
-/* Match the pattern described by BUFP against STRING, which is of
- SIZE. Start the match at index POS in STRING. In REGS, return the
- indices of STRING that matched the entire BUFP->buffer and its
- contained subexpressions.
-
- If bufp->fastmap is nonzero, then it had better be up to date.
-
- The reason that the data to match are specified as two components
- which are to be regarded as concatenated is so this function can be
- used directly on the contents of an Emacs buffer.
-
- -1 is returned if there is no match. -2 is returned if there is an
- error (such as match stack overflow). Otherwise the value is the
- length of the substring which was matched. */
-
-int
-re_match(bufp, string_arg, size, pos, regs)
- struct mbre_pattern_buffer *bufp;
- const char *string_arg;
- int size, pos;
- struct mbre_registers *regs;
-{
- register unsigned char *p = (unsigned char*)bufp->buffer;
- unsigned char *p1;
-
- /* Pointer to beyond end of buffer. */
- register unsigned char *pend = p + bufp->used;
-
- unsigned num_regs = bufp->re_nsub;
-
- unsigned char *string = (unsigned char*)string_arg;
-
- register unsigned char *d, *dend;
- register int mcnt; /* Multipurpose. */
- int options = bufp->options;
-
- /* Failure point stack. Each place that can handle a failure further
- down the line pushes a failure point on this stack. It consists of
- restart, regend, and reg_info for all registers corresponding to the
- subexpressions we're currently inside, plus the number of such
- registers, and, finally, two char *'s. The first char * is where to
- resume scanning the pattern; the second one is where to resume
- scanning the strings. If the latter is zero, the failure point is a
- ``dummy''; if a failure happens and the failure point is a dummy, it
- gets discarded and the next next one is tried. */
-
- unsigned char **stacka;
- unsigned char **stackb;
- unsigned char **stackp;
- unsigned char **stacke;
-
- /* Information on the contents of registers. These are pointers into
- the input strings; they record just what was matched (on this
- attempt) by a subexpression part of the pattern, that is, the
- regnum-th regstart pointer points to where in the pattern we began
- matching and the regnum-th regend points to right after where we
- stopped matching the regnum-th subexpression. (The zeroth register
- keeps track of what the whole pattern matches.) */
-
- unsigned char **regstart = bufp->regstart;
- unsigned char **regend = bufp->regend;
-
- /* If a group that's operated upon by a repetition operator fails to
- match anything, then the register for its start will need to be
- restored because it will have been set to wherever in the string we
- are when we last see its open-group operator. Similarly for a
- register's end. */
- unsigned char **old_regstart = bufp->old_regstart;
- unsigned char **old_regend = bufp->old_regend;
-
- /* The is_active field of reg_info helps us keep track of which (possibly
- nested) subexpressions we are currently in. The matched_something
- field of reg_info[reg_num] helps us tell whether or not we have
- matched any of the pattern so far this time through the reg_num-th
- subexpression. These two fields get reset each time through any
- loop their register is in. */
-
- mbre_register_info_type *reg_info = bufp->reg_info;
-
- /* The following record the register info as found in the above
- variables when we find a match better than any we've seen before.
- This happens as we backtrack through the failure points, which in
- turn happens only if we have not yet matched the entire string. */
-
- unsigned best_regs_set = 0;
- unsigned char **best_regstart = bufp->best_regstart;
- unsigned char **best_regend = bufp->best_regend;
-
- int num_failure_counts = 0;
-
- int current_mbctype = bufp->mbctype;
- const unsigned char *re_mbctab = re_mbctab_get(current_mbctype);
-
- if (regs) {
- init_regs(regs, num_regs);
- }
-
- /* Initialize the stack. */
- stacka = RE_TALLOC(MAX_NUM_FAILURE_ITEMS * NFAILURES, unsigned char*);
- stackb = stacka;
- stackp = stackb;
- stacke = &stackb[MAX_NUM_FAILURE_ITEMS * NFAILURES];
-
-#ifdef DEBUG_REGEX
- fprintf(stderr, "Entering re_match(%s)\n", string_arg);
-#endif
-
- /* Initialize subexpression text positions to -1 to mark ones that no
- ( or ( and ) or ) has been seen for. Also set all registers to
- inactive and mark them as not having matched anything or ever
- failed. */
- for (mcnt = 0; mcnt < (int)num_regs; mcnt++) {
- regstart[mcnt] = regend[mcnt]
- = old_regstart[mcnt] = old_regend[mcnt]
- = best_regstart[mcnt] = best_regend[mcnt] = REG_UNSET_VALUE;
-#ifdef __CHECKER__
- reg_info[mcnt].word = 0;
-#endif
- IS_ACTIVE (reg_info[mcnt]) = 0;
- MATCHED_SOMETHING (reg_info[mcnt]) = 0;
- }
-
- /* Set up pointers to ends of strings.
- Don't allow the second string to be empty unless both are empty. */
-
-
- /* `p' scans through the pattern as `d' scans through the data. `dend'
- is the end of the input string that `d' points within. `d' is
- advanced into the following input string whenever necessary, but
- this happens before fetching; therefore, at the beginning of the
- loop, `d' can be pointing at the end of a string, but it cannot
- equal string2. */
-
- d = string + pos, dend = string + size;
-
- /* This loops over pattern commands. It exits by returning from the
- function if match is complete, or it drops through if match fails
- at this starting point in the input data. */
-
- for (;;) {
-#ifdef DEBUG_REGEX
- fprintf(stderr,
- "regex loop(%d): matching 0x%02d\n",
- p - (unsigned char*)bufp->buffer,
- *p);
-#endif
- /* End of pattern means we might have succeeded. */
- if (p == pend) {
- /* If not end of string, try backtracking. Otherwise done. */
- if ((bufp->options & MBRE_OPTION_LONGEST) && d != dend) {
- if (best_regs_set) /* non-greedy, no need to backtrack */
- goto restore_best_regs;
- while (stackp != stackb && stackp[-1] == NON_GREEDY) {
- if (best_regs_set) /* non-greedy, no need to backtrack */
- goto restore_best_regs;
- POP_FAILURE_POINT();
- }
- if (stackp != stackb) {
- /* More failure points to try. */
-
- /* If exceeds best match so far, save it. */
- if (! best_regs_set || (d > best_regend[0])) {
- best_regs_set = 1;
- best_regend[0] = d; /* Never use regstart[0]. */
-
- for (mcnt = 1; mcnt < (int)num_regs; mcnt++) {
- best_regstart[mcnt] = regstart[mcnt];
- best_regend[mcnt] = regend[mcnt];
- }
- }
- goto fail;
- }
- /* If no failure points, don't restore garbage. */
- else if (best_regs_set) {
- restore_best_regs:
- /* Restore best match. */
- d = best_regend[0];
-
- for (mcnt = 0; mcnt < (int)num_regs; mcnt++) {
- regstart[mcnt] = best_regstart[mcnt];
- regend[mcnt] = best_regend[mcnt];
- }
- }
- }
-
- /* If caller wants register contents data back, convert it
- to indices. */
- if (regs) {
- regs->beg[0] = pos;
- regs->end[0] = d - string;
- for (mcnt = 1; mcnt < (int)num_regs; mcnt++) {
- if (REG_UNSET(regend[mcnt])) {
- regs->beg[mcnt] = -1;
- regs->end[mcnt] = -1;
- continue;
- }
- regs->beg[mcnt] = regstart[mcnt] - string;
- regs->end[mcnt] = regend[mcnt] - string;
- }
- }
- FREE_AND_RETURN(stackb, (d - pos - string));
- }
-
- /* Otherwise match next pattern command. */
-#ifdef SWITCH_ENUM_BUG
- switch ((int)((enum regexpcode)*p++))
-#else
- switch ((enum regexpcode)*p++)
-#endif
- {
- /* ( [or `(', as appropriate] is represented by start_memory,
- ) by stop_memory. Both of those commands are followed by
- a register number in the next byte. The text matched
- within the ( and ) is recorded under that number. */
- case start_memory:
- old_regstart[*p] = regstart[*p];
- regstart[*p] = d;
- IS_ACTIVE(reg_info[*p]) = 1;
- MATCHED_SOMETHING(reg_info[*p]) = 0;
- p += 2;
- continue;
-
- case stop_memory:
- old_regend[*p] = regend[*p];
- regend[*p] = d;
- IS_ACTIVE(reg_info[*p]) = 0;
- p += 2;
- continue;
-
- case start_paren:
- case stop_paren:
- break;
-
- /* \<digit> has been turned into a `duplicate' command which is
- followed by the numeric value of <digit> as the register number. */
- case duplicate:
- {
- int regno = *p++; /* Get which register to match against */
- register unsigned char *d2, *dend2;
-
- /* Check if there's corresponding group */
- if (regno >= (int)num_regs) goto fail;
- /* Check if corresponding group is still open */
- if (IS_ACTIVE(reg_info[regno])) goto fail;
-
- /* Where in input to try to start matching. */
- d2 = regstart[regno];
- if (REG_UNSET(d2)) goto fail;
-
- /* Where to stop matching; if both the place to start and
- the place to stop matching are in the same string, then
- set to the place to stop, otherwise, for now have to use
- the end of the first string. */
-
- dend2 = regend[regno];
- if (REG_UNSET(dend2)) goto fail;
- for (;;) {
- /* At end of register contents => success */
- if (d2 == dend2) break;
-
- /* If necessary, advance to next segment in data. */
- PREFETCH;
-
- /* How many characters left in this segment to match. */
- mcnt = dend - d;
-
- /* Want how many consecutive characters we can match in
- one shot, so, if necessary, adjust the count. */
- if (mcnt > dend2 - d2)
- mcnt = dend2 - d2;
-
- /* Compare that many; failure if mismatch, else move
- past them. */
- if ((options & MBRE_OPTION_IGNORECASE)
- ? memcmp_translate(d, d2, mcnt, re_mbctab)
- : memcmp((char*)d, (char*)d2, mcnt))
- goto fail;
- d += mcnt, d2 += mcnt;
- }
- }
- break;
-
- case start_nowidth:
- PUSH_FAILURE_POINT(0, d);
- if (stackp - stackb > MBRE_DUP_MAX) {
- FREE_AND_RETURN(stackb,(-2));
- }
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- STORE_NUMBER(p+mcnt, stackp - stackb);
- continue;
-
- case stop_nowidth:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- stackp = stackb + mcnt;
- d = stackp[-3];
- POP_FAILURE_POINT();
- continue;
-
- case stop_backtrack:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- stackp = stackb + mcnt;
- POP_FAILURE_POINT();
- continue;
-
- case pop_and_fail:
- EXTRACT_NUMBER(mcnt, p+1);
- stackp = stackb + mcnt;
- POP_FAILURE_POINT();
- goto fail;
-
- case anychar:
- PREFETCH;
- if (ismbchar(*d)) {
- if (d + mbclen(*d) > dend)
- goto fail;
- SET_REGS_MATCHED;
- d += mbclen(*d);
- break;
- }
- if (!(options&MBRE_OPTION_MULTILINE)
- && (TRANSLATE_P() ? translate[*d] : *d) == '\n')
- goto fail;
- SET_REGS_MATCHED;
- d++;
- break;
-
- case anychar_repeat:
- for (;;) {
- PUSH_FAILURE_POINT(p, d);
- PREFETCH;
- if (ismbchar(*d)) {
- if (d + mbclen(*d) > dend)
- goto fail;
- SET_REGS_MATCHED;
- d += mbclen(*d);
- continue;
- }
- if (!(options&MBRE_OPTION_MULTILINE) &&
- (TRANSLATE_P() ? translate[*d] : *d) == '\n')
- goto fail;
- SET_REGS_MATCHED;
- d++;
- }
- break;
-
- case charset:
- case charset_not:
- {
- int not; /* Nonzero for charset_not. */
- int part = 0; /* true if matched part of mbc */
- unsigned char *dsave = d + 1;
- int cc, c;
-
- PREFETCH;
- cc = c = (unsigned char)*d++;
- if (ismbchar(c)) {
- if (d + mbclen(c) - 1 <= dend) {
- MBC2WC(c, d);
- }
- }
- else if (TRANSLATE_P())
- cc = c = (unsigned char)translate[c];
-
- not = is_in_list(c, p);
- if (!not && cc != c) {
- part = not = is_in_list(cc, p);
- }
- if (*(p - 1) == (unsigned char)charset_not) {
- not = !not;
- }
- if (!not) goto fail;
-
- p += 1 + *p + 2 + EXTRACT_UNSIGNED(&p[1 + *p])*8;
- SET_REGS_MATCHED;
-
- if (part) d = dsave;
- break;
- }
-
- case begline:
- if (size == 0 || AT_STRINGS_BEG(d))
- break;
- if (d[-1] == '\n' && !AT_STRINGS_END(d))
- break;
- goto fail;
-
- case endline:
- if (AT_STRINGS_END(d)) {
- if (size == 0 || d[-1] != '\n')
- break;
- }
- else if (*d == '\n')
- break;
- goto fail;
-
- /* Match at the very beginning of the string. */
- case begbuf:
- if (AT_STRINGS_BEG(d))
- break;
- goto fail;
-
- /* Match at the very end of the data. */
- case endbuf:
- if (AT_STRINGS_END(d))
- break;
- goto fail;
-
- /* Match at the very end of the data. */
- case endbuf2:
- if (AT_STRINGS_END(d)) {
- if (size == 0 || d[-1] != '\n')
- break;
- }
- /* .. or newline just before the end of the data. */
- if (*d == '\n' && AT_STRINGS_END(d+1))
- break;
- goto fail;
-
- /* `or' constructs are handled by starting each alternative with
- an on_failure_jump that points to the start of the next
- alternative. Each alternative except the last ends with a
- jump to the joining point. (Actually, each jump except for
- the last one really jumps to the following jump, because
- tensioning the jumps is a hassle.) */
-
- /* The start of a stupid repeat has an on_failure_jump that points
- past the end of the repeat text. This makes a failure point so
- that on failure to match a repetition, matching restarts past
- as many repetitions have been found with no way to fail and
- look for another one. */
-
- /* A smart repeat is similar but loops back to the on_failure_jump
- so that each repetition makes another failure point. */
-
- /* Match at the starting position. */
- case begpos:
- if (d - string == pos)
- break;
- goto fail;
-
- case on_failure_jump:
- on_failure:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- PUSH_FAILURE_POINT(p + mcnt, d);
- continue;
-
- /* The end of a smart repeat has a maybe_finalize_jump back.
- Change it either to a finalize_jump or an ordinary jump. */
- case maybe_finalize_jump:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- p1 = p;
-
- /* Compare the beginning of the repeat with what in the
- pattern follows its end. If we can establish that there
- is nothing that they would both match, i.e., that we
- would have to backtrack because of (as in, e.g., `a*a')
- then we can change to finalize_jump, because we'll
- never have to backtrack.
-
- This is not true in the case of alternatives: in
- `(a|ab)*' we do need to backtrack to the `ab' alternative
- (e.g., if the string was `ab'). But instead of trying to
- detect that here, the alternative has put on a dummy
- failure point which is what we will end up popping. */
-
- /* Skip over open/close-group commands. */
- while (p1 + 2 < pend) {
- if ((enum regexpcode)*p1 == stop_memory ||
- (enum regexpcode)*p1 == start_memory)
- p1 += 3; /* Skip over args, too. */
- else if (/*(enum regexpcode)*p1 == start_paren ||*/
- (enum regexpcode)*p1 == stop_paren)
- p1 += 1;
- else
- break;
- }
-
- if (p1 == pend)
- p[-3] = (unsigned char)finalize_jump;
- else if (*p1 == (unsigned char)exactn ||
- *p1 == (unsigned char)endline) {
- register int c = *p1 == (unsigned char)endline ? '\n' : p1[2];
- register unsigned char *p2 = p + mcnt;
- /* p2[0] ... p2[2] are an on_failure_jump.
- Examine what follows that. */
- if (p2[3] == (unsigned char)exactn && p2[5] != c)
- p[-3] = (unsigned char)finalize_jump;
- else if (p2[3] == (unsigned char)charset ||
- p2[3] == (unsigned char)charset_not) {
- int not;
- if (ismbchar(c)) {
- unsigned char *pp = p1+3;
- MBC2WC(c, pp);
- }
- /* `is_in_list()' is TRUE if c would match */
- /* That means it is not safe to finalize. */
- not = is_in_list(c, p2 + 4);
- if (p2[3] == (unsigned char)charset_not)
- not = !not;
- if (!not)
- p[-3] = (unsigned char)finalize_jump;
- }
- }
- p -= 2; /* Point at relative address again. */
- if (p[-1] != (unsigned char)finalize_jump) {
- p[-1] = (unsigned char)jump;
- goto nofinalize;
- }
- /* Note fall through. */
-
- /* The end of a stupid repeat has a finalize_jump back to the
- start, where another failure point will be made which will
- point to after all the repetitions found so far. */
-
- /* Take off failure points put on by matching on_failure_jump
- because didn't fail. Also remove the register information
- put on by the on_failure_jump. */
- case finalize_jump:
- if (stackp > stackb && stackp[-3] == d) {
- p = stackp[-4];
- POP_FAILURE_POINT();
- continue;
- }
- POP_FAILURE_POINT();
- /* Note fall through. */
-
- /* We need this opcode so we can detect where alternatives end
- in `group_match_null_string_p' et al. */
- case jump_past_alt:
- /* fall through */
-
- /* Jump without taking off any failure points. */
- case jump:
- nofinalize:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- if (mcnt < 0 && stackp > stackb && stackp[-3] == d) /* avoid infinite loop */
- goto fail;
- p += mcnt;
- continue;
-
- case dummy_failure_jump:
- /* Normally, the on_failure_jump pushes a failure point, which
- then gets popped at finalize_jump. We will end up at
- finalize_jump, also, and with a pattern of, say, `a+', we
- are skipping over the on_failure_jump, so we have to push
- something meaningless for finalize_jump to pop. */
- PUSH_FAILURE_POINT(0, 0);
- goto nofinalize;
-
- /* At the end of an alternative, we need to push a dummy failure
- point in case we are followed by a `finalize_jump', because
- we don't want the failure point for the alternative to be
- popped. For example, matching `(a|ab)*' against `aab'
- requires that we match the `ab' alternative. */
- case push_dummy_failure:
- /* See comments just above at `dummy_failure_jump' about the
- two zeroes. */
- p1 = p;
- /* Skip over open/close-group commands. */
- while (p1 + 2 < pend) {
- if ((enum regexpcode)*p1 == stop_memory ||
- (enum regexpcode)*p1 == start_memory)
- p1 += 3; /* Skip over args, too. */
- else if (/*(enum regexpcode)*p1 == start_paren ||*/
- (enum regexpcode)*p1 == stop_paren)
- p1 += 1;
- else
- break;
- }
- if ((enum regexpcode)*p1 == jump)
- p[-1] = unused;
- else
- PUSH_FAILURE_POINT(0, 0);
- break;
-
- /* Have to succeed matching what follows at least n times. Then
- just handle like an on_failure_jump. */
- case succeed_n:
- EXTRACT_NUMBER(mcnt, p + 2);
- /* Originally, this is how many times we HAVE to succeed. */
- if (mcnt != 0) {
- mcnt--;
- p += 2;
- PUSH_FAILURE_COUNT(p);
- STORE_NUMBER_AND_INCR(p, mcnt);
- PUSH_FAILURE_POINT(0, 0);
- }
- else {
- goto on_failure;
- }
- continue;
-
- case jump_n:
- EXTRACT_NUMBER(mcnt, p + 2);
- /* Originally, this is how many times we CAN jump. */
- if (mcnt) {
- mcnt--;
- PUSH_FAILURE_COUNT(p + 2);
- STORE_NUMBER(p + 2, mcnt);
- goto nofinalize; /* Do the jump without taking off
- any failure points. */
- }
- /* If don't have to jump any more, skip over the rest of command. */
- else
- p += 4;
- continue;
-
- case set_number_at:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- p1 = p + mcnt;
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- STORE_NUMBER(p1, mcnt);
- continue;
-
- case try_next:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- if (p + mcnt < pend) {
- PUSH_FAILURE_POINT(p, d);
- stackp[-1] = NON_GREEDY;
- }
- p += mcnt;
- continue;
-
- case finalize_push:
- POP_FAILURE_POINT();
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- if (mcnt < 0 && stackp > stackb && stackp[-3] == d) /* avoid infinite loop */
- goto fail;
- PUSH_FAILURE_POINT(p + mcnt, d);
- stackp[-1] = NON_GREEDY;
- continue;
-
- case finalize_push_n:
- EXTRACT_NUMBER(mcnt, p + 2);
- /* Originally, this is how many times we CAN jump. */
- if (mcnt) {
- int pos, i;
-
- mcnt--;
- STORE_NUMBER(p + 2, mcnt);
- EXTRACT_NUMBER(pos, p);
- EXTRACT_NUMBER(i, p+pos+5);
- if (i > 0) goto nofinalize;
- POP_FAILURE_POINT();
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- PUSH_FAILURE_POINT(p + mcnt, d);
- stackp[-1] = NON_GREEDY;
- p += 2; /* skip n */
- }
- /* If don't have to push any more, skip over the rest of command. */
- else
- p += 4;
- continue;
-
- /* Ignore these. Used to ignore the n of succeed_n's which
- currently have n == 0. */
- case unused:
- continue;
-
- case casefold_on:
- options |= MBRE_OPTION_IGNORECASE;
- continue;
-
- case casefold_off:
- options &= ~MBRE_OPTION_IGNORECASE;
- continue;
-
- case option_set:
- options = *p++;
- continue;
-
- case wordbound:
- if (AT_STRINGS_BEG(d)) {
- if (IS_A_LETTER(d)) break;
- else goto fail;
- }
- if (AT_STRINGS_END(d)) {
- if (PREV_IS_A_LETTER(d)) break;
- else goto fail;
- }
- if (PREV_IS_A_LETTER(d) != IS_A_LETTER(d))
- break;
- goto fail;
-
- case notwordbound:
- if (AT_STRINGS_BEG(d)) {
- if (IS_A_LETTER(d)) goto fail;
- else break;
- }
- if (AT_STRINGS_END(d)) {
- if (PREV_IS_A_LETTER(d)) goto fail;
- else break;
- }
- if (PREV_IS_A_LETTER(d) != IS_A_LETTER(d))
- goto fail;
- break;
-
- case wordbeg:
- if (IS_A_LETTER(d) && (AT_STRINGS_BEG(d) || !PREV_IS_A_LETTER(d)))
- break;
- goto fail;
-
- case wordend:
- if (!AT_STRINGS_BEG(d) && PREV_IS_A_LETTER(d)
- && (!IS_A_LETTER(d) || AT_STRINGS_END(d)))
- break;
- goto fail;
-
- case wordchar:
- PREFETCH;
- if (!IS_A_LETTER(d))
- goto fail;
- if (ismbchar(*d) && d + mbclen(*d) - 1 < dend)
- d += mbclen(*d) - 1;
- d++;
- SET_REGS_MATCHED;
- break;
-
- case notwordchar:
- PREFETCH;
- if (IS_A_LETTER(d))
- goto fail;
- if (ismbchar(*d) && d + mbclen(*d) - 1 < dend)
- d += mbclen(*d) - 1;
- d++;
- SET_REGS_MATCHED;
- break;
-
- case exactn:
- /* Match the next few pattern characters exactly.
- mcnt is how many characters to match. */
- mcnt = *p++;
- /* This is written out as an if-else so we don't waste time
- testing `translate' inside the loop. */
- if (TRANSLATE_P()) {
- do {
- unsigned char c;
-
- PREFETCH;
- if (*p == 0xff) {
- p++;
- if (!--mcnt
- || AT_STRINGS_END(d)
- || (unsigned char)*d++ != (unsigned char)*p++)
- goto fail;
- continue;
- }
- c = *d++;
- if (ismbchar(c)) {
- int n;
-
- if (c != (unsigned char)*p++)
- goto fail;
- for (n = mbclen(c) - 1; n > 0; n--)
- if (!--mcnt /* redundant check if pattern was
- compiled properly. */
- || AT_STRINGS_END(d)
- || (unsigned char)*d++ != (unsigned char)*p++)
- goto fail;
- continue;
- }
- /* compiled code translation needed for ruby */
- if ((unsigned char)translate[c] != (unsigned char)translate[*p++])
- goto fail;
- }
- while (--mcnt);
- }
- else {
- do {
- PREFETCH;
- if (*p == 0xff) {p++; mcnt--;}
- if (*d++ != *p++) goto fail;
- }
- while (--mcnt);
- }
- SET_REGS_MATCHED;
- break;
- case fail:
- goto fail;
- break;
- }
-#ifdef RUBY
- CHECK_INTS;
-#endif
- continue; /* Successfully executed one pattern command; keep going. */
-
- /* Jump here if any matching operation fails. */
- fail:
- if (stackp != stackb) {
- /* A restart point is known. Restart there and pop it. */
- long last_used_reg, this_reg;
-
- /* If this failure point is from a dummy_failure_point, just
- skip it. */
- if (stackp[-4] == 0 || (best_regs_set && stackp[-1] == NON_GREEDY)) {
- POP_FAILURE_POINT();
- goto fail;
- }
- stackp--; /* discard greedy flag */
- options = (int)*--stackp;
- d = *--stackp;
- p = *--stackp;
- /* Restore register info. */
- last_used_reg = (long)*--stackp;
-
- /* Make the ones that weren't saved -1 or 0 again. */
- for (this_reg = num_regs - 1; this_reg > last_used_reg; this_reg--) {
- regend[this_reg] = REG_UNSET_VALUE;
- regstart[this_reg] = REG_UNSET_VALUE;
- IS_ACTIVE(reg_info[this_reg]) = 0;
- MATCHED_SOMETHING(reg_info[this_reg]) = 0;
- }
-
- /* And restore the rest from the stack. */
- for ( ; this_reg > 0; this_reg--) {
- reg_info[this_reg].word = *--stackp;
- regend[this_reg] = *--stackp;
- regstart[this_reg] = *--stackp;
- }
- mcnt = (long)*--stackp;
- while (mcnt--) {
- POP_FAILURE_COUNT();
- }
- if (p < pend) {
- int is_a_jump_n = 0;
- int failed_paren = 0;
-
- p1 = p;
- /* If failed to a backwards jump that's part of a repetition
- loop, need to pop this failure point and use the next one. */
- switch ((enum regexpcode)*p1) {
- case jump_n:
- case finalize_push_n:
- is_a_jump_n = 1;
- case maybe_finalize_jump:
- case finalize_jump:
- case finalize_push:
- case jump:
- p1++;
- EXTRACT_NUMBER_AND_INCR(mcnt, p1);
-
- if (mcnt >= 0) break; /* should be backward jump */
- p1 += mcnt;
-
- if (( is_a_jump_n && (enum regexpcode)*p1 == succeed_n) ||
- (!is_a_jump_n && (enum regexpcode)*p1 == on_failure_jump)) {
- if (failed_paren) {
- p1++;
- EXTRACT_NUMBER_AND_INCR(mcnt, p1);
- PUSH_FAILURE_POINT(p1 + mcnt, d);
- }
- goto fail;
- }
- break;
- default:
- /* do nothing */;
- }
- }
- }
- else
- break; /* Matching at this starting point really fails. */
- }
-
- if (best_regs_set)
- goto restore_best_regs;
-
- FREE_AND_RETURN(stackb,(-1)); /* Failure to match. */
-}
-
-
-static int
-memcmp_translate(s1, s2, len, re_mbctab)
- unsigned char *s1, *s2;
- register int len;
- const unsigned char *re_mbctab;
-{
- register unsigned char *p1 = s1, *p2 = s2, c;
- while (len) {
- c = *p1++;
- if (ismbchar(c)) {
- int n;
-
- if (c != *p2++) return 1;
- for (n = mbclen(c) - 1; n > 0; n--)
- if (!--len || *p1++ != *p2++)
- return 1;
- }
- else
- if (translate[c] != translate[*p2++])
- return 1;
- len--;
- }
- return 0;
-}
-
-void
-re_copy_registers(regs1, regs2)
- struct mbre_registers *regs1, *regs2;
-{
- int i;
-
- if (regs1 == regs2) return;
- if (regs1->allocated == 0) {
- regs1->beg = TMALLOC(regs2->num_regs, int);
- regs1->end = TMALLOC(regs2->num_regs, int);
- regs1->allocated = regs2->num_regs;
- }
- else if (regs1->allocated < regs2->num_regs) {
- TREALLOC(regs1->beg, regs2->num_regs, int);
- TREALLOC(regs1->end, regs2->num_regs, int);
- regs1->allocated = regs2->num_regs;
- }
- for (i=0; i<regs2->num_regs; i++) {
- regs1->beg[i] = regs2->beg[i];
- regs1->end[i] = regs2->end[i];
- }
- regs1->num_regs = regs2->num_regs;
-}
-
-void
-re_free_registers(regs)
- struct mbre_registers *regs;
-{
- if (regs->allocated == 0) return;
- if (regs->beg) xfree(regs->beg);
- if (regs->end) xfree(regs->end);
-}
-
-/* Functions for multi-byte support.
- Created for grep multi-byte extension Jul., 1993 by t^2 (Takahiro Tanimoto)
- Last change: Jul. 9, 1993 by t^2 */
-static const unsigned char mbctab_ascii[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static const unsigned char mbctab_euc[] = { /* 0xA1-0xFE */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0
-};
-
-static const unsigned char mbctab_sjis[] = { /* 0x80-0x9f,0xE0-0xFF */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
-};
-
-static const unsigned char mbctab_utf8[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 0, 0
-};
-
-#if 0
-const unsigned char *re_mbctab = mbctab_ascii;
-
-void
-re_mbcinit(mbctype)
- int mbctype;
-{
- switch (mbctype) {
- case MBCTYPE_ASCII:
- re_mbctab = mbctab_ascii;
- current_mbctype = MBCTYPE_ASCII;
- break;
- case MBCTYPE_EUC:
- re_mbctab = mbctab_euc;
- current_mbctype = MBCTYPE_EUC;
- break;
- case MBCTYPE_SJIS:
- re_mbctab = mbctab_sjis;
- current_mbctype = MBCTYPE_SJIS;
- break;
- case MBCTYPE_UTF8:
- re_mbctab = mbctab_utf8;
- current_mbctype = MBCTYPE_UTF8;
- break;
- }
-}
-#endif
-
-static const unsigned char*
-re_mbctab_get(mbctype)
- int mbctype;
-{
- const unsigned char *p;
-
- switch (mbctype) {
- case MBCTYPE_EUC:
- p = mbctab_euc;
- break;
- case MBCTYPE_SJIS:
- p = mbctab_sjis;
- break;
- case MBCTYPE_UTF8:
- p = mbctab_utf8;
- break;
- default:
- p = mbctab_ascii;
- break;
- }
-
- return p;
-}
-
-#endif /* HAVE_MBREGEX */
diff --git a/ext/mbstring/mbregex.h b/ext/mbstring/mbregex.h
deleted file mode 100644
index 03292bcd38..0000000000
--- a/ext/mbstring/mbregex.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/* Definitions for data structures and routines for the regular
- expression library, version 0.12.
- Copyright (C) 1985,89,90,91,92,93,95,96,97,98 Free Software Foundation, Inc.
-
- This file is part of the GNU C Library. Its master source is NOT part of
- the C library, however. The master source lives in /gd/gnu/lib.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-/* Multi-byte extension added May, 1993 by t^2 (Takahiro Tanimoto)
- Last change: May 21, 1993 by t^2 */
-/* modified for Ruby by matz@netlab.co.jp */
-
-#ifndef __MB_REGEXP_LIBRARY
-#define __MB_REGEXP_LIBRARY
-
-#include <stddef.h>
-
-/* Define number of parens for which we record the beginnings and ends.
- This affects how much space the `struct re_registers' type takes up. */
-#ifndef MBRE_NREGS
-#define MBRE_NREGS 10
-#endif
-
-#define MBRE_BYTEWIDTH 8
-
-#define MBRE_REG_MAX ((1<<MBRE_BYTEWIDTH)-1)
-
-/* Maximum number of duplicates an interval can allow. */
-#ifndef MBRE_DUP_MAX
-#define MBRE_DUP_MAX ((1 << 15) - 1)
-#endif
-
-
-/* If this bit is set, then character classes are supported; they are:
- [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
- [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
- If not set, then character classes are not supported. */
-#define MBRE_CHAR_CLASSES (1L << 9)
-
-/* match will be done case insensetively */
-#define MBRE_OPTION_IGNORECASE (1L)
-/* perl-style extended pattern available */
-#define MBRE_OPTION_EXTENDED (MBRE_OPTION_IGNORECASE<<1)
-/* newline will be included for . */
-#define MBRE_OPTION_MULTILINE (MBRE_OPTION_EXTENDED<<1)
-/* ^ and $ ignore newline */
-#define MBRE_OPTION_SINGLELINE (MBRE_OPTION_MULTILINE<<1)
-/* works line Perl's /s; it's called POSIX for wrong reason */
-#define MBRE_OPTION_POSIXLINE (MBRE_OPTION_MULTILINE|MBRE_OPTION_SINGLELINE)
-/* search for longest match, in accord with POSIX regexp */
-#define MBRE_OPTION_LONGEST (MBRE_OPTION_SINGLELINE<<1)
-
-#define MBRE_MAY_IGNORECASE (MBRE_OPTION_LONGEST<<1)
-#define MBRE_OPTIMIZE_ANCHOR (MBRE_MAY_IGNORECASE<<1)
-#define MBRE_OPTIMIZE_EXACTN (MBRE_OPTIMIZE_ANCHOR<<1)
-#define MBRE_OPTIMIZE_NO_BM (MBRE_OPTIMIZE_EXACTN<<1)
-#define MBRE_OPTIMIZE_BMATCH (MBRE_OPTIMIZE_NO_BM<<1)
-
-/* For multi-byte char support */
-#define MBCTYPE_ASCII 0
-#define MBCTYPE_EUC 1
-#define MBCTYPE_SJIS 2
-#define MBCTYPE_UTF8 3
-
-#if 0
-#if defined IMPORT || defined USEIMPORTLIB
-extern __declspec(dllimport)
-#elif defined EXPORT
-extern __declspec(dllexport)
-#else
-extern
-#endif
-const unsigned char *re_mbctab;
-#if defined(__STDC__)
-void re_mbcinit (int);
-#else
-void re_mbcinit ();
-#endif
-#endif
-
-#undef ismbchar
-#define ismbchar(c) re_mbctab[(unsigned char)(c)]
-#define mbclen(c) (re_mbctab[(unsigned char)(c)]+1)
-
-/* Structure used in re_match() */
-
-typedef union
-{
- unsigned char *word;
- struct {
- unsigned is_active : 1;
- unsigned matched_something : 1;
- } bits;
-} mbre_register_info_type;
-
-/* This data structure is used to represent a compiled pattern. */
-
-struct mbre_pattern_buffer
- {
- char *buffer; /* Space holding the compiled pattern commands. */
- int allocated; /* Size of space that `buffer' points to. */
- int used; /* Length of portion of buffer actually occupied */
- char *fastmap; /* Pointer to fastmap, if any, or zero if none. */
- /* re_search uses the fastmap, if there is one,
- to skip over totally implausible characters. */
- char *must; /* Pointer to exact pattern which strings should have
- to be matched. */
- int *must_skip; /* Pointer to exact pattern skip table for bm_search */
- char *stclass; /* Pointer to character class list at top */
- long options; /* Flags for options such as extended_pattern. */
- long re_nsub; /* Number of subexpressions found by the compiler. */
- char fastmap_accurate;
- /* Set to zero when a new pattern is stored,
- set to one when the fastmap is updated from it. */
- char can_be_null; /* Set to one by compiling fastmap
- if this pattern might match the null string.
- It does not necessarily match the null string
- in that case, but if this is zero, it cannot.
- 2 as value means can match null string
- but at end of range or before a character
- listed in the fastmap. */
-
- /* stack & working area for re_match() */
- unsigned char **regstart;
- unsigned char **regend;
- unsigned char **old_regstart;
- unsigned char **old_regend;
- mbre_register_info_type *reg_info;
- unsigned char **best_regstart;
- unsigned char **best_regend;
-
- int mbctype;
- };
-
-typedef struct mbre_pattern_buffer mb_regex_t;
-
-/* Structure to store register contents data in.
-
- Pass the address of such a structure as an argument to re_match, etc.,
- if you want this information back.
-
- For i from 1 to MBRE_NREGS - 1, start[i] records the starting index in
- the string of where the ith subexpression matched, and end[i] records
- one after the ending index. start[0] and end[0] are analogous, for
- the entire pattern. */
-
-struct mbre_registers
- {
- int allocated;
- int num_regs;
- int *beg;
- int *end;
- };
-
-#if 0
-/* Type for byte offsets within the string. POSIX mandates this. */
-typedef size_t regoff_t;
-
-/* POSIX specification for registers. Aside from the different names than
- `mbre_registers', POSIX uses an array of structures, instead of a
- structure of arrays. */
-typedef struct
-{
- regoff_t rm_so; /* Byte offset from string's start to substring's start. */
- regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
-} regmatch_t;
-#endif
-
-
-#ifdef __STDC__
-
-extern char *mbre_compile_pattern (const char *, int, struct mbre_pattern_buffer *);
-void mbre_free_pattern (struct mbre_pattern_buffer *);
-/* Is this really advertised? */
-extern int mbre_adjust_startpos (struct mbre_pattern_buffer *, const char*, int, int, int);
-extern void mbre_compile_fastmap (struct mbre_pattern_buffer *);
-extern int mbre_search (struct mbre_pattern_buffer *, const char*, int, int, int,
- struct mbre_registers *);
-extern int mbre_match (struct mbre_pattern_buffer *, const char *, int, int,
- struct mbre_registers *);
-extern void mbre_set_casetable (const char *table);
-extern void mbre_copy_registers (struct mbre_registers*, struct mbre_registers*);
-extern void mbre_free_registers (struct mbre_registers*);
-
-#else /* !__STDC__ */
-
-extern char *mbre_compile_pattern ();
-void mbre_free_pattern ();
-/* Is this really advertised? */
-extern int mbre_adjust_startpos ();
-extern void mbre_compile_fastmap ();
-extern int mbre_search ();
-extern int mbre_match ();
-extern void mbre_set_casetable ();
-extern void mbre_copy_registers ();
-extern void mbre_free_registers ();
-
-#endif /* __STDC__ */
-
-#endif /* !__MB_REGEXP_LIBRARY */
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
deleted file mode 100644
index eec453b140..0000000000
--- a/ext/mbstring/mbstring.c
+++ /dev/null
@@ -1,3396 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Tsukada Takuya <tsukada@fminn.nagano.nagano.jp> |
- | Rui Hirokawa <hirokawa@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*
- * PHP4 Multibyte String module "mbstring"
- *
- * History:
- * 2000.5.19 Release php-4.0RC2_jstring-1.0
- * 2001.4.1 Release php4_jstring-1.0.91
- * 2001.4.30 Release php4_jstring-1.1 (contribute to The PHP Group)
- * 2001.5.1 Renamed from jstring to mbstring (hirokawa@php.net)
- */
-
-/*
- * PHP3 Internationalization support program.
- *
- * Copyright (c) 1999,2000 by the PHP3 internationalization team.
- * All rights reserved.
- *
- * See README_PHP3-i18n-ja for more detail.
- *
- * Authors:
- * Hironori Sato <satoh@jpnnet.com>
- * Shigeru Kanemoto <sgk@happysize.co.jp>
- * Tsukada Takuya <tsukada@fminn.nagano.nagano.jp>
- * Rui Hirokawa <rui_hirokawa@ybb.ne.jp>
- */
-
-/* {{{ includes */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_variables.h"
-#include "mbstring.h"
-#include "ext/standard/php_string.h"
-#include "ext/standard/php_mail.h"
-#include "ext/standard/php_smart_str.h"
-#include "ext/standard/url.h"
-#include "main/php_output.h"
-#include "ext/standard/info.h"
-
-#include "php_variables.h"
-#include "php_globals.h"
-#include "rfc1867.h"
-#include "php_content_types.h"
-#include "SAPI.h"
-#include "php_unicode.h"
-#include "TSRM.h"
-
-#include "mb_gpc.h"
-
-#ifdef ZEND_MULTIBYTE
-#include "zend_multibyte.h"
-#endif /* ZEND_MULTIBYTE */
-
-#if HAVE_MBSTRING
-
-#if HAVE_MBREGEX
-#include "mbregex.h"
-#endif
-/* }}} */
-
-/* {{{ prototypes */
-static void _php_mb_globals_ctor(zend_mbstring_globals *pglobals TSRMLS_DC);
-static void _php_mb_globals_dtor(zend_mbstring_globals *pglobals TSRMLS_DC);
-/* }}} */
-
-/* {{{ php_mb_default_identify_list[] */
-#if defined(HAVE_MBSTR_JA)
-static const enum mbfl_no_encoding php_mb_default_identify_list[] = {
- mbfl_no_encoding_ascii,
- mbfl_no_encoding_jis,
- mbfl_no_encoding_utf8,
- mbfl_no_encoding_euc_jp,
- mbfl_no_encoding_sjis
-};
-#endif
-
-#if defined(HAVE_MBSTR_CN) & !defined(HAVE_MBSTR_JA)
-static const enum mbfl_no_encoding php_mb_default_identify_list[] = {
- mbfl_no_encoding_ascii,
- mbfl_no_encoding_utf8,
- mbfl_no_encoding_euc_cn,
- mbfl_no_encoding_cp936
-};
-#endif
-
-#if defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_CN) & !defined(HAVE_MBSTR_JA)
-static const enum mbfl_no_encoding php_mb_default_identify_list[] = {
- mbfl_no_encoding_ascii,
- mbfl_no_encoding_utf8,
- mbfl_no_encoding_euc_tw,
- mbfl_no_encoding_big5
-};
-#endif
-
-#if defined(HAVE_MBSTR_KR) & !defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_CN) & !defined(HAVE_MBSTR_JA)
-static const enum mbfl_no_encoding php_mb_default_identify_list[] = {
- mbfl_no_encoding_ascii,
- mbfl_no_encoding_utf8,
- mbfl_no_encoding_euc_kr,
- mbfl_no_encoding_uhc
-};
-#endif
-
-#if defined(HAVE_MBSTR_RU) & !defined(HAVE_MBSTR_KR) & !defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_CN) & !defined(HAVE_MBSTR_JA)
-static const enum mbfl_no_encoding php_mb_default_identify_list[] = {
- mbfl_no_encoding_ascii,
- mbfl_no_encoding_utf8,
- mbfl_no_encoding_koi8r,
- mbfl_no_encoding_cp1251,
- mbfl_no_encoding_cp866
-};
-#endif
-
-#if !defined(HAVE_MBSTR_RU) & !defined(HAVE_MBSTR_KR) & !defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_CN) & !defined(HAVE_MBSTR_JA)
-static const enum mbfl_no_encoding php_mb_default_identify_list[] = {
- mbfl_no_encoding_ascii,
- mbfl_no_encoding_utf8
-};
-#endif
-
-static const int php_mb_default_identify_list_size = sizeof(php_mb_default_identify_list)/sizeof(enum mbfl_no_encoding);
-/* }}} */
-
-static const unsigned char third_and_rest_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE_REST };
-static const unsigned char second_args_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
-#if HAVE_MBREGEX
-static const unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-#endif
-
-/* {{{ mb_overload_def mb_ovld[] */
-static const struct mb_overload_def mb_ovld[] = {
- {MB_OVERLOAD_MAIL, "mail", "mb_send_mail", "mb_orig_mail"},
- {MB_OVERLOAD_STRING, "strlen", "mb_strlen", "mb_orig_strlen"},
- {MB_OVERLOAD_STRING, "strpos", "mb_strpos", "mb_orig_strpos"},
- {MB_OVERLOAD_STRING, "strrpos", "mb_strrpos", "mb_orig_strrpos"},
- {MB_OVERLOAD_STRING, "substr", "mb_substr", "mb_orig_substr"},
- {MB_OVERLOAD_STRING, "strtolower", "mb_strtolower", "mb_orig_strtolower"},
- {MB_OVERLOAD_STRING, "strtoupper", "mb_strtoupper", "mb_orig_strtoupper"},
- {MB_OVERLOAD_STRING, "substr_count", "mb_substr_count", "mb_orig_substr_count"},
-#if HAVE_MBREGEX
- {MB_OVERLOAD_REGEX, "ereg", "mb_ereg", "mb_orig_ereg"},
- {MB_OVERLOAD_REGEX, "eregi", "mb_eregi", "mb_orig_eregi"},
- {MB_OVERLOAD_REGEX, "ereg_replace", "mb_ereg_replace", "mb_orig_ereg_replace"},
- {MB_OVERLOAD_REGEX, "eregi_replace", "mb_eregi_replace", "mb_orig_eregi_replace"},
- {MB_OVERLOAD_REGEX, "split", "mb_split", "mb_orig_split"},
-#endif
- {0, NULL, NULL, NULL}
-};
-/* }}} */
-
-#if HAVE_MBREGEX
-struct def_mbctype_tbl {
- enum mbfl_no_encoding mbfl_encoding;
- int regex_encoding;
-};
-
-const struct def_mbctype_tbl mbctype_tbl[] = {
- {mbfl_no_encoding_ascii,MBCTYPE_ASCII},
- {mbfl_no_encoding_euc_jp,MBCTYPE_EUC},
- {mbfl_no_encoding_sjis,MBCTYPE_SJIS},
- {mbfl_no_encoding_utf8,MBCTYPE_UTF8},
- {mbfl_no_encoding_pass,-1}
-};
-#endif
-
-/* {{{ function_entry mbstring_functions[] */
-function_entry mbstring_functions[] = {
- PHP_FE(mb_convert_case, NULL)
- PHP_FE(mb_strtoupper, NULL)
- PHP_FE(mb_strtolower, NULL)
- PHP_FE(mb_language, NULL)
- PHP_FE(mb_internal_encoding, NULL)
- PHP_FE(mb_http_input, NULL)
- PHP_FE(mb_http_output, NULL)
- PHP_FE(mb_detect_order, NULL)
- PHP_FE(mb_substitute_character, NULL)
- PHP_FE(mb_parse_str, (unsigned char *)second_args_force_ref)
- PHP_FE(mb_output_handler, NULL)
- PHP_FE(mb_preferred_mime_name, NULL)
- PHP_FE(mb_strlen, NULL)
- PHP_FE(mb_strpos, NULL)
- PHP_FE(mb_strrpos, NULL)
- PHP_FE(mb_substr_count, NULL)
- PHP_FE(mb_substr, NULL)
- PHP_FE(mb_strcut, NULL)
- PHP_FE(mb_strwidth, NULL)
- PHP_FE(mb_strimwidth, NULL)
- PHP_FE(mb_convert_encoding, NULL)
- PHP_FE(mb_detect_encoding, NULL)
- PHP_FE(mb_convert_kana, NULL)
- PHP_FE(mb_encode_mimeheader, NULL)
- PHP_FE(mb_decode_mimeheader, NULL)
- PHP_FE(mb_convert_variables, (unsigned char *)third_and_rest_force_ref)
- PHP_FE(mb_encode_numericentity, NULL)
- PHP_FE(mb_decode_numericentity, NULL)
- PHP_FE(mb_send_mail, NULL)
- PHP_FE(mb_get_info, NULL)
-#if HAVE_MBREGEX
- PHP_MBREGEX_FUNCTION_ENTRIES
-#endif
- { NULL, NULL, NULL }
-};
-/* }}} */
-
-/* {{{ zend_module_entry mbstring_module_entry */
-zend_module_entry mbstring_module_entry = {
- STANDARD_MODULE_HEADER,
- "mbstring",
- mbstring_functions,
- PHP_MINIT(mbstring),
- PHP_MSHUTDOWN(mbstring),
- PHP_RINIT(mbstring),
- PHP_RSHUTDOWN(mbstring),
- PHP_MINFO(mbstring),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-ZEND_DECLARE_MODULE_GLOBALS(mbstring)
-
-#ifdef COMPILE_DL_MBSTRING
-ZEND_GET_MODULE(mbstring)
-#endif
-
-/* {{{ static int php_mb_parse_encoding_list()
- * Return 0 if input contains any illegal encoding, otherwise 1.
- * Even if any illegal encoding is detected the result may contain a list
- * of parsed encodings.
- */
-static int
-php_mb_parse_encoding_list(const char *value, int value_length, int **return_list, int *return_size, int persistent)
-{
- int n, l, size, bauto, *src, *list, *entry, ret = 1;
- char *p, *p1, *p2, *endp, *tmpstr;
- enum mbfl_no_encoding no_encoding;
-
- list = NULL;
- if (value == NULL || value_length <= 0) {
- if (return_list) {
- *return_list = NULL;
- }
- if (return_size) {
- *return_size = 0;
- }
- return 0;
- } else {
- /* copy the value string for work */
- if (value[0]=='"' && value[value_length-1]=='"' && value_length>2) {
- tmpstr = (char *)estrndup(value+1, value_length-2);
- value_length -= 2;
- }
- else
- tmpstr = (char *)estrndup(value, value_length);
- if (tmpstr == NULL) {
- return 0;
- }
- /* count the number of listed encoding names */
- endp = tmpstr + value_length;
- n = 1;
- p1 = tmpstr;
- while ((p2 = php_memnstr(p1, ",", 1, endp)) != NULL) {
- p1 = p2 + 1;
- n++;
- }
- size = n + php_mb_default_identify_list_size;
- /* make list */
- list = (int *)pecalloc(size, sizeof(int), persistent);
- if (list != NULL) {
- entry = list;
- n = 0;
- bauto = 0;
- p1 = tmpstr;
- do {
- p2 = p = php_memnstr(p1, ",", 1, endp);
- if (p == NULL) {
- p = endp;
- }
- *p = '\0';
- /* trim spaces */
- while (p1 < p && (*p1 == ' ' || *p1 == '\t')) {
- p1++;
- }
- p--;
- while (p > p1 && (*p == ' ' || *p == '\t')) {
- *p = '\0';
- p--;
- }
- /* convert to the encoding number and check encoding */
- no_encoding = mbfl_name2no_encoding(p1);
- if (no_encoding == mbfl_no_encoding_auto) {
- if (!bauto) {
- bauto = 1;
- l = php_mb_default_identify_list_size;
- src = (int*)php_mb_default_identify_list;
- while (l > 0) {
- *entry++ = *src++;
- l--;
- n++;
- }
- }
- } else if (no_encoding != mbfl_no_encoding_invalid) {
- *entry++ = no_encoding;
- n++;
- } else {
- ret = 0;
- }
- p1 = p2 + 1;
- } while (n < size && p2 != NULL);
- if (n > 0) {
- if (return_list) {
- *return_list = list;
- } else {
- pefree(list, persistent);
- }
- } else {
- pefree(list, persistent);
- if (return_list) {
- *return_list = NULL;
- }
- ret = 0;
- }
- if (return_size) {
- *return_size = n;
- }
- } else {
- if (return_list) {
- *return_list = NULL;
- }
- if (return_size) {
- *return_size = 0;
- }
- ret = 0;
- }
- efree(tmpstr);
- }
-
- return ret;
-}
-/* }}} */
-
-/* {{{ MBSTRING_API php_mb_check_encoding_list */
-MBSTRING_API int php_mb_check_encoding_list(const char *encoding_list TSRMLS_DC) {
- return php_mb_parse_encoding_list(encoding_list, strlen(encoding_list), NULL, NULL, 0);
-}
-/* }}} */
-
-/* {{{ static int php_mb_parse_encoding_array()
- * Return 0 if input contains any illegal encoding, otherwise 1.
- * Even if any illegal encoding is detected the result may contain a list
- * of parsed encodings.
- */
-static int
-php_mb_parse_encoding_array(zval *array, int **return_list, int *return_size, int persistent)
-{
- zval **hash_entry;
- HashTable *target_hash;
- int i, n, l, size, bauto, *list, *entry, *src, ret = 1;
- enum mbfl_no_encoding no_encoding;
-
- list = NULL;
- if (Z_TYPE_P(array) == IS_ARRAY) {
- target_hash = Z_ARRVAL_P(array);
- zend_hash_internal_pointer_reset(target_hash);
- i = zend_hash_num_elements(target_hash);
- size = i + php_mb_default_identify_list_size;
- list = (int *)pecalloc(size, sizeof(int), persistent);
- if (list != NULL) {
- entry = list;
- bauto = 0;
- n = 0;
- while (i > 0) {
- if (zend_hash_get_current_data(target_hash, (void **) &hash_entry) == FAILURE) {
- break;
- }
- convert_to_string_ex(hash_entry);
- no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(hash_entry));
- if (no_encoding == mbfl_no_encoding_auto) {
- if (!bauto) {
- bauto = 1;
- l = php_mb_default_identify_list_size;
- src = (int*)php_mb_default_identify_list;
- while (l > 0) {
- *entry++ = *src++;
- l--;
- n++;
- }
- }
- } else if (no_encoding != mbfl_no_encoding_invalid) {
- *entry++ = no_encoding;
- n++;
- } else {
- ret = 0;;
- }
- zend_hash_move_forward(target_hash);
- i--;
- }
- if (n > 0) {
- if (return_list) {
- *return_list = list;
- } else {
- pefree(list, persistent);
- }
- } else {
- pefree(list, persistent);
- if (return_list) {
- *return_list = NULL;
- }
- ret = 0;
- }
- if (return_size) {
- *return_size = n;
- }
- } else {
- if (return_list) {
- *return_list = NULL;
- }
- if (return_size) {
- *return_size = 0;
- }
- ret = 0;
- }
- }
-
- return ret;
-}
-/* }}} */
-
-/* {{{ php.ini directive handler */
-static PHP_INI_MH(OnUpdate_mbstring_language)
-{
- enum mbfl_no_language no_language;
- char *default_enc = NULL;
-
- no_language = mbfl_name2no_language(new_value);
- if (no_language != mbfl_no_language_invalid) {
- MBSTRG(language) = no_language;
- switch (no_language) {
- case mbfl_no_language_uni:
- default_enc = "UTF-8";
- break;
- case mbfl_no_language_japanese:
- default_enc = "EUC-JP";
- break;
- case mbfl_no_language_korean:
- default_enc = "EUC-KR";
- break;
- case mbfl_no_language_simplified_chinese:
- default_enc = "EUC-CN";
- break;
- case mbfl_no_language_traditional_chinese:
- default_enc = "EUC-TW";
- break;
- case mbfl_no_language_russian:
- default_enc = "KOI8-R";
- break;
- case mbfl_no_language_english:
- default:
- default_enc = "ISO-8859-1";
- break;
- }
- MBSTRG(current_language) = MBSTRG(language);
- if (default_enc) {
- zend_alter_ini_entry("mbstring.internal_encoding",
- sizeof("mbstring.internal_encoding"),
- default_enc, strlen(default_enc),
- PHP_INI_PERDIR, stage);
- }
- } else {
- return FAILURE;
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ static PHP_INI_MH(OnUpdate_mbstring_detect_order) */
-static PHP_INI_MH(OnUpdate_mbstring_detect_order)
-{
- int *list, size;
-
- if (php_mb_parse_encoding_list(new_value, new_value_length, &list, &size, 1)) {
- if (MBSTRG(detect_order_list) != NULL) {
- free(MBSTRG(detect_order_list));
- }
- MBSTRG(detect_order_list) = list;
- MBSTRG(detect_order_list_size) = size;
- } else {
- return FAILURE;
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ static PHP_INI_MH(OnUpdate_mbstring_http_input) */
-static PHP_INI_MH(OnUpdate_mbstring_http_input)
-{
- int *list, size;
-
- if (php_mb_parse_encoding_list(new_value, new_value_length, &list, &size, 1)) {
- if (MBSTRG(http_input_list) != NULL) {
- free(MBSTRG(http_input_list));
- }
- MBSTRG(http_input_list) = list;
- MBSTRG(http_input_list_size) = size;
- } else {
- return FAILURE;
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ static PHP_INI_MH(OnUpdate_mbstring_http_output) */
-static PHP_INI_MH(OnUpdate_mbstring_http_output)
-{
- enum mbfl_no_encoding no_encoding;
-
- no_encoding = mbfl_name2no_encoding(new_value);
- if (no_encoding != mbfl_no_encoding_invalid) {
- MBSTRG(http_output_encoding) = no_encoding;
- MBSTRG(current_http_output_encoding) = no_encoding;
- } else {
- if (new_value != NULL && new_value_length > 0) {
- return FAILURE;
- }
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) */
-static PHP_INI_MH(OnUpdate_mbstring_internal_encoding)
-{
- enum mbfl_no_encoding no_encoding;
-#if HAVE_MBREGEX
- const struct def_mbctype_tbl *p = NULL;
-#endif
-
- no_encoding = mbfl_name2no_encoding(new_value);
- if (no_encoding != mbfl_no_encoding_invalid) {
- MBSTRG(internal_encoding) = no_encoding;
- MBSTRG(current_internal_encoding) = no_encoding;
-#if HAVE_MBREGEX
- p=&(mbctype_tbl[0]);
- while (p->regex_encoding >= 0){
- if (p->mbfl_encoding == MBSTRG(internal_encoding)){
- MBSTRG(default_mbctype) = p->regex_encoding;
- MBSTRG(current_mbctype) = p->regex_encoding;
- break;
- }
- p++;
- }
-#endif
-#ifdef ZEND_MULTIBYTE
- zend_multibyte_set_internal_encoding(new_value, new_value_length TSRMLS_CC);
-#endif /* ZEND_MULTIBYTE */
- } else {
- if (new_value != NULL && new_value_length > 0) {
- return FAILURE;
- }
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-#ifdef ZEND_MULTIBYTE
-/* {{{ static PHP_INI_MH(OnUpdate_mbstring_script_encoding) */
-static PHP_INI_MH(OnUpdate_mbstring_script_encoding)
-{
- int *list, size;
-
- if (php_mb_parse_encoding_list(new_value, new_value_length, &list, &size, 1)) {
- if (MBSTRG(script_encoding_list) != NULL) {
- free(MBSTRG(script_encoding_list));
- }
- MBSTRG(script_encoding_list) = list;
- MBSTRG(script_encoding_list_size) = size;
- } else {
- return FAILURE;
- }
-
- return SUCCESS;
-}
-/* }}} */
-#endif /* ZEND_MULTIBYTE */
-
-/* {{{ static PHP_INI_MH(OnUpdate_mbstring_substitute_character) */
-static PHP_INI_MH(OnUpdate_mbstring_substitute_character)
-{
- if (new_value != NULL) {
- if (strcasecmp("none", new_value) == 0) {
- MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
- } else if (strcasecmp("long", new_value) == 0) {
- MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
- } else {
- MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- MBSTRG(filter_illegal_substchar) = zend_atoi(new_value, new_value_length);
- }
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ static PHP_INI_MH(OnUpdate_mbstring_encoding_translation) */
-static PHP_INI_MH(OnUpdate_mbstring_encoding_translation)
-{
- if (new_value == NULL) {
- return FAILURE;
- }
-
- OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
-
- if (MBSTRG(encoding_translation)){
- _php_mb_enable_encoding_translation(1);
- } else {
- _php_mb_enable_encoding_translation(0);
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php.ini directive registration */
-PHP_INI_BEGIN()
- PHP_INI_ENTRY("mbstring.language", "neutral", PHP_INI_SYSTEM | PHP_INI_PERDIR, OnUpdate_mbstring_language)
- PHP_INI_ENTRY("mbstring.detect_order", NULL, PHP_INI_ALL, OnUpdate_mbstring_detect_order)
- PHP_INI_ENTRY("mbstring.http_input", "pass", PHP_INI_ALL, OnUpdate_mbstring_http_input)
- PHP_INI_ENTRY("mbstring.http_output", "pass", PHP_INI_ALL, OnUpdate_mbstring_http_output)
- PHP_INI_ENTRY("mbstring.internal_encoding", "none", PHP_INI_ALL, OnUpdate_mbstring_internal_encoding)
-#ifdef ZEND_MULTIBYTE
- PHP_INI_ENTRY("mbstring.script_encoding", NULL, PHP_INI_ALL, OnUpdate_mbstring_script_encoding)
-#endif /* ZEND_MULTIBYTE */
- PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character)
- STD_PHP_INI_ENTRY("mbstring.func_overload", "0", PHP_INI_SYSTEM |
- PHP_INI_PERDIR, OnUpdateLong, func_overload, zend_mbstring_globals, mbstring_globals)
-
- STD_PHP_INI_BOOLEAN("mbstring.encoding_translation", "0",
- PHP_INI_SYSTEM | PHP_INI_PERDIR, OnUpdate_mbstring_encoding_translation,
- encoding_translation, zend_mbstring_globals, mbstring_globals)
-PHP_INI_END()
-/* }}} */
-
-/* {{{ module global initialize handler */
-static void _php_mb_globals_ctor(zend_mbstring_globals *pglobals TSRMLS_DC)
-{
- MBSTRG(language) = mbfl_no_language_uni;
- MBSTRG(current_language) = MBSTRG(language);
- MBSTRG(internal_encoding) = mbfl_no_encoding_pass;
- MBSTRG(current_internal_encoding) = MBSTRG(internal_encoding);
-#ifdef ZEND_MULTIBYTE
- MBSTRG(script_encoding_list) = NULL;
- MBSTRG(script_encoding_list_size) = 0;
-#endif /* ZEND_MULTIBYTE */
- MBSTRG(http_output_encoding) = mbfl_no_encoding_pass;
- MBSTRG(current_http_output_encoding) = mbfl_no_encoding_pass;
- MBSTRG(http_input_identify) = mbfl_no_encoding_invalid;
- MBSTRG(http_input_identify_get) = mbfl_no_encoding_invalid;
- MBSTRG(http_input_identify_post) = mbfl_no_encoding_invalid;
- MBSTRG(http_input_identify_cookie) = mbfl_no_encoding_invalid;
- MBSTRG(http_input_identify_string) = mbfl_no_encoding_invalid;
- MBSTRG(http_input_list) = NULL;
- MBSTRG(http_input_list_size) = 0;
- MBSTRG(detect_order_list) = NULL;
- MBSTRG(detect_order_list_size) = 0;
- MBSTRG(current_detect_order_list) = NULL;
- MBSTRG(current_detect_order_list_size) = 0;
- MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- MBSTRG(filter_illegal_substchar) = 0x3f; /* '?' */
- MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- MBSTRG(current_filter_illegal_substchar) = 0x3f; /* '?' */
- MBSTRG(func_overload) = 0;
- MBSTRG(encoding_translation) = 0;
- pglobals->outconv = NULL;
-#if HAVE_MBREGEX
- _php_mb_regex_globals_ctor(pglobals TSRMLS_CC);
-#endif
-}
-/* }}} */
-
-/* {{{ static void _php_mb_globals_dtor() */
-static void _php_mb_globals_dtor(zend_mbstring_globals *pglobals TSRMLS_DC)
-{
-#if HAVE_MBREGEX
- _php_mb_regex_globals_dtor(pglobals TSRMLS_CC);
-#endif
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION(mbstring) */
-PHP_MINIT_FUNCTION(mbstring)
-{
-#ifdef ZTS
- ts_allocate_id(&mbstring_globals_id, sizeof(zend_mbstring_globals),
- (ts_allocate_ctor) _php_mb_globals_ctor,
- (ts_allocate_dtor) _php_mb_globals_dtor);
-#else
- _php_mb_globals_ctor(&mbstring_globals TSRMLS_CC);
-#endif
-
- REGISTER_INI_ENTRIES();
-
- if (MBSTRG(encoding_translation)) {
- _php_mb_enable_encoding_translation(1);
- }
-
- REGISTER_LONG_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MB_OVERLOAD_REGEX", MB_OVERLOAD_REGEX, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("MB_CASE_UPPER", PHP_UNICODE_CASE_UPPER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MB_CASE_LOWER", PHP_UNICODE_CASE_LOWER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MB_CASE_TITLE", PHP_UNICODE_CASE_TITLE, CONST_CS | CONST_PERSISTENT);
-
-#if HAVE_MBREGEX
- PHP_MINIT(mb_regex) (INIT_FUNC_ARGS_PASSTHRU);
-#endif
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION(mbstring) */
-PHP_MSHUTDOWN_FUNCTION(mbstring)
-{
- UNREGISTER_INI_ENTRIES();
-
- if (MBSTRG(http_input_list)) {
- free(MBSTRG(http_input_list));
- }
-#ifdef ZEND_MULTIBYTE
- if (MBSTRG(script_encoding_list)) {
- free(MBSTRG(script_encoding_list));
- }
-#endif /* ZEND_MULTIBYTE */
- if (MBSTRG(detect_order_list)) {
- free(MBSTRG(detect_order_list));
- }
-
- if (MBSTRG(encoding_translation)) {
- _php_mb_enable_encoding_translation(0);
- }
-
-#if HAVE_MBREGEX
- PHP_MSHUTDOWN(mb_regex) (INIT_FUNC_ARGS_PASSTHRU);
-#endif
-
-#ifdef ZTS
- ts_free_id(mbstring_globals_id);
-#else
- _php_mb_globals_dtor(&mbstring_globals TSRMLS_CC);
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION(mbstring) */
-PHP_RINIT_FUNCTION(mbstring)
-{
- int n, *list=NULL, *entry;
- zend_function *func, *orig;
- const struct mb_overload_def *p;
-
- MBSTRG(current_language) = MBSTRG(language);
- MBSTRG(current_internal_encoding) = MBSTRG(internal_encoding);
- MBSTRG(current_http_output_encoding) = MBSTRG(http_output_encoding);
- MBSTRG(current_filter_illegal_mode) = MBSTRG(filter_illegal_mode);
- MBSTRG(current_filter_illegal_substchar) = MBSTRG(filter_illegal_substchar);
-
- n = 0;
- if (MBSTRG(detect_order_list)) {
- list = MBSTRG(detect_order_list);
- n = MBSTRG(detect_order_list_size);
- }
- if (n <= 0) {
- list = (int*)php_mb_default_identify_list;
- n = php_mb_default_identify_list_size;
- }
- entry = (int *)safe_emalloc(n, sizeof(int), 0);
- MBSTRG(current_detect_order_list) = entry;
- MBSTRG(current_detect_order_list_size) = n;
- while (n > 0) {
- *entry++ = *list++;
- n--;
- }
-
- /* override original function. */
- if (MBSTRG(func_overload)){
- p = &(mb_ovld[0]);
-
- while (p->type > 0) {
- if ((MBSTRG(func_overload) & p->type) == p->type &&
- zend_hash_find(EG(function_table), p->save_func,
- strlen(p->save_func)+1, (void **)&orig) != SUCCESS) {
-
- zend_hash_find(EG(function_table), p->ovld_func, strlen(p->ovld_func)+1 , (void **)&func);
-
- if (zend_hash_find(EG(function_table), p->orig_func, strlen(p->orig_func)+1, (void **)&orig) != SUCCESS) {
- php_error_docref("ref.mbstring" TSRMLS_CC, E_WARNING, "mbstring couldn't find function %s.", p->orig_func);
- return FAILURE;
- } else {
- zend_hash_add(EG(function_table), p->save_func, strlen(p->save_func)+1, orig, sizeof(zend_function), NULL);
-
- if (zend_hash_update(EG(function_table), p->orig_func, strlen(p->orig_func)+1, func, sizeof(zend_function),
- NULL) == FAILURE) {
- php_error_docref("ref.mbstring" TSRMLS_CC, E_WARNING, "mbstring couldn't replace function %s.", p->orig_func);
- return FAILURE;
- }
- }
- }
- p++;
- }
- }
-#if HAVE_MBREGEX
- PHP_RINIT(mb_regex) (INIT_FUNC_ARGS_PASSTHRU);
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION(mbstring) */
-PHP_RSHUTDOWN_FUNCTION(mbstring)
-{
- const struct mb_overload_def *p;
- zend_function *orig;
-
- if (MBSTRG(current_detect_order_list) != NULL) {
- efree(MBSTRG(current_detect_order_list));
- MBSTRG(current_detect_order_list) = NULL;
- MBSTRG(current_detect_order_list_size) = 0;
- }
- if (MBSTRG(outconv) != NULL) {
- mbfl_buffer_converter_delete(MBSTRG(outconv) TSRMLS_CC);
- MBSTRG(outconv) = NULL;
- }
-
- /* clear http input identification. */
- MBSTRG(http_input_identify) = mbfl_no_encoding_invalid;
- MBSTRG(http_input_identify_post) = mbfl_no_encoding_invalid;
- MBSTRG(http_input_identify_get) = mbfl_no_encoding_invalid;
- MBSTRG(http_input_identify_cookie) = mbfl_no_encoding_invalid;
- MBSTRG(http_input_identify_string) = mbfl_no_encoding_invalid;
-
- /* clear overloaded function. */
- if (MBSTRG(func_overload)){
- p = &(mb_ovld[0]);
- while (p->type > 0 && zend_hash_find(EG(function_table), p->save_func, strlen(p->save_func)+1 , (void **)&orig) == SUCCESS) {
- zend_hash_update(EG(function_table), p->orig_func, strlen(p->orig_func)+1, orig, sizeof(zend_function), NULL);
- zend_hash_del(EG(function_table), p->save_func, strlen(p->save_func)+1);
- p++;
- }
- }
-
-#if HAVE_MBREGEX
- PHP_RSHUTDOWN(mb_regex) (INIT_FUNC_ARGS_PASSTHRU);
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION(mbstring) */
-PHP_MINFO_FUNCTION(mbstring)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Multibyte Support", "enabled");
-#if defined(HAVE_MBSTR_JA)
- php_info_print_table_row(2, "Japanese support", "enabled");
-#endif
-#if defined(HAVE_MBSTR_CN)
- php_info_print_table_row(2, "Simplified chinese support", "enabled");
-#endif
-#if defined(HAVE_MBSTR_TW)
- php_info_print_table_row(2, "Traditional chinese support", "enabled");
-#endif
-#if defined(HAVE_MBSTR_KR)
- php_info_print_table_row(2, "Korean support", "enabled");
-#endif
-#if defined(HAVE_MBSTR_RU)
- php_info_print_table_row(2, "Russian support", "enabled");
-#endif
- if (MBSTRG(encoding_translation)) {
- php_info_print_table_row(2, "HTTP input encoding translation", "enabled");
- }
-#if defined(HAVE_MBREGEX)
- php_info_print_table_row(2, "Multibyte (japanese) regex support", "enabled");
-#endif
- php_info_print_table_end();
-
- php_info_print_table_start();
- php_info_print_table_colspan_header(2, "mbstring extension makes use of \"streamable kanji code filter and converter\", which is distributed under the GNU Lesser General Public License version 2.1.");
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-/* }}} */
-
-/* {{{ proto string mb_language([string language])
- Sets the current language or Returns the current language as a string */
-PHP_FUNCTION(mb_language)
-{
- char *name = NULL;
- int name_len = 0;
- enum mbfl_no_language no_language;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
- return;
- }
- if (name == NULL) {
- RETURN_STRING((char *)mbfl_no_language2name(MBSTRG(current_language)), 1);
- } else {
- no_language = mbfl_name2no_language(name);
- if (no_language == mbfl_no_language_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown language \"%s\"", name);
- RETURN_FALSE;
- } else {
- MBSTRG(current_language) = no_language;
- RETURN_TRUE;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string mb_internal_encoding([string encoding])
- Sets the current internal encoding or Returns the current internal encoding as a string */
-PHP_FUNCTION(mb_internal_encoding)
-{
- char *name = NULL;
- int name_len;
- enum mbfl_no_encoding no_encoding;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
- RETURN_FALSE;
- }
- if (name == NULL) {
- name = (char *)mbfl_no_encoding2name(MBSTRG(current_internal_encoding));
- if (name != NULL) {
- RETURN_STRING(name, 1);
- } else {
- RETURN_FALSE;
- }
- } else {
- no_encoding = mbfl_name2no_encoding(name);
- if (no_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", name);
- RETURN_FALSE;
- } else {
- MBSTRG(current_internal_encoding) = no_encoding;
-#ifdef ZEND_MULTIBYTE
- zend_multibyte_set_internal_encoding(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1) TSRMLS_CC);
-#endif /* ZEND_MULTIBYTE */
- RETURN_TRUE;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto mixed mb_http_input([string type])
- Returns the input encoding */
-PHP_FUNCTION(mb_http_input)
-{
- char *typ = NULL;
- int typ_len;
- int retname, n, *entry;
- char *name, *list, *temp;
- enum mbfl_no_encoding result = mbfl_no_encoding_invalid;
-
- retname = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &typ, &typ_len) == FAILURE) {
- RETURN_FALSE;
- }
- if (typ == NULL) {
- result = MBSTRG(http_input_identify);
- } else {
- switch (*typ) {
- case 'G':
- case 'g':
- result = MBSTRG(http_input_identify_get);
- break;
- case 'P':
- case 'p':
- result = MBSTRG(http_input_identify_post);
- break;
- case 'C':
- case 'c':
- result = MBSTRG(http_input_identify_cookie);
- break;
- case 'S':
- case 's':
- result = MBSTRG(http_input_identify_string);
- break;
- case 'I':
- case 'i':
- array_init(return_value);
- entry = MBSTRG(http_input_list);
- n = MBSTRG(http_input_list_size);
- while (n > 0) {
- name = (char *)mbfl_no_encoding2name(*entry);
- if (name) {
- add_next_index_string(return_value, name, 1);
- }
- entry++;
- n--;
- }
- retname = 0;
- break;
- case 'L':
- case 'l':
- entry = MBSTRG(http_input_list);
- n = MBSTRG(http_input_list_size);
- list = NULL;
- while (n > 0) {
- name = (char *)mbfl_no_encoding2name(*entry);
- if (name) {
- if (list) {
- temp = list;
- spprintf(&list, 0, "%s,%s", temp, name);
- efree(temp);
- if (!list) {
- break;
- }
- } else {
- list = estrdup(name);
- }
- }
- entry++;
- n--;
- }
- if (!list) {
- RETURN_FALSE;
- }
- RETVAL_STRING(list, 0);
- retname = 0;
- break;
- default:
- result = MBSTRG(http_input_identify);
- break;
- }
- }
-
- if (retname) {
- if (result != mbfl_no_encoding_invalid &&
- (name = (char *)mbfl_no_encoding2name(result)) != NULL) {
- RETVAL_STRING(name, 1);
- } else {
- RETVAL_FALSE;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string mb_http_output([string encoding])
- Sets the current output_encoding or returns the current output_encoding as a string */
-PHP_FUNCTION(mb_http_output)
-{
- char *name = NULL;
- int name_len;
- enum mbfl_no_encoding no_encoding;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", (char **)&name, &name_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (name == NULL) {
- name = (char *)mbfl_no_encoding2name(MBSTRG(current_http_output_encoding));
- if (name != NULL) {
- RETURN_STRING(name, 1);
- } else {
- RETURN_FALSE;
- }
- } else {
- no_encoding = mbfl_name2no_encoding(name);
- if (no_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", name);
- RETURN_FALSE;
- } else {
- MBSTRG(current_http_output_encoding) = no_encoding;
- RETURN_TRUE;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto bool|array mb_detect_order([mixed encoding-list])
- Sets the current detect_order or Return the current detect_order as a array */
-PHP_FUNCTION(mb_detect_order)
-{
- zval **arg1;
- int n, size, *list, *entry;
- char *name;
-
- if (ZEND_NUM_ARGS() == 0) {
- array_init(return_value);
- entry = MBSTRG(current_detect_order_list);
- n = MBSTRG(current_detect_order_list_size);
- while (n > 0) {
- name = (char *)mbfl_no_encoding2name(*entry);
- if (name) {
- add_next_index_string(return_value, name, 1);
- }
- entry++;
- n--;
- }
- } else if (ZEND_NUM_ARGS() == 1 && zend_get_parameters_ex(1, &arg1) != FAILURE) {
- list = NULL;
- size = 0;
- switch (Z_TYPE_PP(arg1)) {
- case IS_ARRAY:
- if (!php_mb_parse_encoding_array(*arg1, &list, &size, 0)) {
- if (list) {
- efree(list);
- }
- RETURN_FALSE;
- }
- break;
- default:
- convert_to_string_ex(arg1);
- if (!php_mb_parse_encoding_list(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1), &list, &size, 0)) {
- if (list) {
- efree(list);
- }
- RETURN_FALSE;
- }
- break;
- }
- if (list == NULL) {
- RETVAL_FALSE;
- } else {
- if (MBSTRG(current_detect_order_list)) {
- efree(MBSTRG(current_detect_order_list));
- }
- MBSTRG(current_detect_order_list) = list;
- MBSTRG(current_detect_order_list_size) = size;
- RETVAL_TRUE;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-/* {{{ proto mixed mb_substitute_character([mixed substchar])
- Sets the current substitute_character or returns the current substitute_character */
-PHP_FUNCTION(mb_substitute_character)
-{
- zval **arg1;
-
- if (ZEND_NUM_ARGS() == 0) {
- if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- RETVAL_STRING("none", 1);
- } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
- RETVAL_STRING("long", 1);
- } else {
- RETVAL_LONG(MBSTRG(current_filter_illegal_substchar));
- }
- } else if (ZEND_NUM_ARGS() == 1 && zend_get_parameters_ex(1, &arg1) != FAILURE) {
- RETVAL_TRUE;
- switch (Z_TYPE_PP(arg1)) {
- case IS_STRING:
- if (strcasecmp("none", Z_STRVAL_PP(arg1)) == 0) {
- MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
- } else if (strcasecmp("long", Z_STRVAL_PP(arg1)) == 0) {
- MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
- } else {
- convert_to_long_ex(arg1);
- if (Z_LVAL_PP(arg1)< 0xffff && Z_LVAL_PP(arg1)> 0x0) {
- MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- MBSTRG(current_filter_illegal_substchar) = Z_LVAL_PP(arg1);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown character.");
- RETVAL_FALSE;
- }
- }
- break;
- default:
- convert_to_long_ex(arg1);
- if (Z_LVAL_PP(arg1)< 0xffff && Z_LVAL_PP(arg1)> 0x0) {
- MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- MBSTRG(current_filter_illegal_substchar) = Z_LVAL_PP(arg1);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown character.");
- RETVAL_FALSE;
- }
- break;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-/* {{{ proto string mb_preferred_mime_name(string encoding)
- Return the preferred MIME name (charset) as a string */
-PHP_FUNCTION(mb_preferred_mime_name)
-{
- enum mbfl_no_encoding no_encoding;
- char *name = NULL;
- int name_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
- return;
- } else {
- no_encoding = mbfl_name2no_encoding(name);
- if (no_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", name);
- RETVAL_FALSE;
- } else {
- const char *preferred_name = mbfl_no2preferred_mime_name(no_encoding);
- if (preferred_name == NULL || *preferred_name == '\0') {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No MIME preferred name corresponding to \"%s\"", name);
- RETVAL_FALSE;
- } else {
- RETVAL_STRING((char *)preferred_name, 1);
- }
- }
- }
-}
-/* }}} */
-
-#define IS_SJIS1(c) ((((c)>=0x81 && (c)<=0x9f) || ((c)>=0xe0 && (c)<=0xf5)) ? 1 : 0)
-#define IS_SJIS2(c) ((((c)>=0x40 && (c)<=0x7e) || ((c)>=0x80 && (c)<=0xfc)) ? 1 : 0)
-
-/* {{{ proto bool mb_parse_str(string encoded_string [, array result])
- Parses GET/POST/COOKIE data and sets global variables */
-PHP_FUNCTION(mb_parse_str)
-{
- zval *track_vars_array;
- char *encstr = NULL, *separator = NULL;
- int encstr_len;
-
- track_vars_array = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &encstr, &encstr_len, &track_vars_array) == FAILURE) {
- return;
- }
-
- separator = (char *)estrdup(PG(arg_separator).input);
-
- /* Clear out the array */
- if (track_vars_array != NULL) {
- zval_dtor(track_vars_array);
- array_init(track_vars_array);
- }
-
- encstr = estrndup(encstr, encstr_len);
-
- RETVAL_BOOL(_php_mb_encoding_handler_ex(PARSE_STRING, track_vars_array, encstr, separator, (track_vars_array == NULL), 1 TSRMLS_CC));
-
- if (encstr != NULL) efree(encstr);
- if (separator != NULL) efree(separator);
-}
-/* }}} */
-
-/* {{{ proto string mb_output_handler(string contents, int status)
- Returns string in output buffer converted to the http_output encoding */
-PHP_FUNCTION(mb_output_handler)
-{
- char *arg_string;
- int arg_string_len;
- long arg_status;
- mbfl_string string, result;
- const char *charset;
- char *p;
- enum mbfl_no_encoding encoding;
- int last_feed, len;
- unsigned char send_text_mimetype = 0;
- char *s, *mimetype = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &arg_string, &arg_string_len, &arg_status) == FAILURE) {
- return;
- }
-
- encoding = MBSTRG(current_http_output_encoding);
-
- /* start phase only */
- if ((arg_status & PHP_OUTPUT_HANDLER_START) != 0) {
- /* delete the converter just in case. */
- if (MBSTRG(outconv)) {
- mbfl_buffer_converter_delete(MBSTRG(outconv) TSRMLS_CC);
- MBSTRG(outconv) = NULL;
- }
- if (encoding == mbfl_no_encoding_pass) {
- RETURN_STRINGL(arg_string, arg_string_len, 1);
- }
-
- /* analyze mime type */
- if (SG(sapi_headers).mimetype &&
- strncmp(SG(sapi_headers).mimetype, "text/", 5) == 0) {
- if ((s = strchr(SG(sapi_headers).mimetype,';')) == NULL){
- mimetype = estrdup(SG(sapi_headers).mimetype);
- } else {
- mimetype = estrndup(SG(sapi_headers).mimetype,s-SG(sapi_headers).mimetype);
- }
- send_text_mimetype = 1;
- } else if (SG(sapi_headers).send_default_content_type) {
- mimetype = SG(default_mimetype) ? SG(default_mimetype) : SAPI_DEFAULT_MIMETYPE;
- }
-
- /* if content-type is not yet set, set it and activate the converter */
- if (SG(sapi_headers).send_default_content_type || send_text_mimetype) {
- charset = mbfl_no2preferred_mime_name(encoding);
- if (charset) {
- len = spprintf( &p, 0, "Content-Type: %s; charset=%s", mimetype, charset );
- if (sapi_add_header(p, len, 0) != FAILURE) {
- SG(sapi_headers).send_default_content_type = 0;
- }
- }
- /* activate the converter */
- MBSTRG(outconv) = mbfl_buffer_converter_new(MBSTRG(current_internal_encoding), encoding, 0 TSRMLS_CC);
- if (send_text_mimetype){
- efree(mimetype);
- }
- }
- }
-
- /* just return if the converter is not activated. */
- if (MBSTRG(outconv) == NULL) {
- RETURN_STRINGL(arg_string, arg_string_len, 1);
- }
-
- /* flag */
- last_feed = ((arg_status & PHP_OUTPUT_HANDLER_END) != 0);
- /* mode */
- mbfl_buffer_converter_illegal_mode(MBSTRG(outconv), MBSTRG(current_filter_illegal_mode) TSRMLS_CC);
- mbfl_buffer_converter_illegal_substchar(MBSTRG(outconv), MBSTRG(current_filter_illegal_substchar) TSRMLS_CC);
-
- /* feed the string */
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
- string.val = (unsigned char *)arg_string;
- string.len = arg_string_len;
- mbfl_buffer_converter_feed(MBSTRG(outconv), &string TSRMLS_CC);
- if (last_feed) {
- mbfl_buffer_converter_flush(MBSTRG(outconv) TSRMLS_CC);
- }
- /* get the converter output, and return it */
- mbfl_buffer_converter_result(MBSTRG(outconv), &result TSRMLS_CC);
- RETVAL_STRINGL((char *)result.val, result.len, 0); /* the string is already strdup()'ed */
-
- /* delete the converter if it is the last feed. */
- if (last_feed) {
- mbfl_buffer_converter_delete(MBSTRG(outconv) TSRMLS_CC);
- MBSTRG(outconv) = NULL;
- }
-}
-/* }}} */
-
-/* {{{ proto int mb_strlen(string str [, string encoding])
- Get character numbers of a string */
-PHP_FUNCTION(mb_strlen)
-{
- int n;
- mbfl_string string;
- char *enc_name = NULL;
- int enc_name_len;
-
- mbfl_string_init(&string);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", (char **)&string.val, &string.len, &enc_name, &enc_name_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- string.no_language = MBSTRG(current_language);
- if (enc_name == NULL) {
- string.no_encoding = MBSTRG(current_internal_encoding);
- } else {
- string.no_encoding = mbfl_name2no_encoding(enc_name);
- if (string.no_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", enc_name);
- RETURN_FALSE;
- }
- }
-
- n = mbfl_strlen(&string TSRMLS_CC);
- if (n >= 0) {
- RETVAL_LONG(n);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int mb_strpos(string haystack, string needle [, int offset [, string encoding]])
- Find position of first occurrence of a string within another */
-PHP_FUNCTION(mb_strpos)
-{
- int n, reverse = 0;
- long offset;
- mbfl_string haystack, needle;
- char *enc_name = NULL;
- int enc_name_len;
-
- mbfl_string_init(&haystack);
- mbfl_string_init(&needle);
- haystack.no_language = MBSTRG(current_language);
- haystack.no_encoding = MBSTRG(current_internal_encoding);
- needle.no_language = MBSTRG(current_language);
- needle.no_encoding = MBSTRG(current_internal_encoding);
- offset = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &offset, &enc_name, &enc_name_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (enc_name != NULL) {
- haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(enc_name);
- if (haystack.no_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", enc_name);
- RETURN_FALSE;
- }
- }
-
- if (offset < 0 || (unsigned long)offset > haystack.len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is out of range");
- RETURN_FALSE;
- }
- if (needle.len == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle");
- RETURN_FALSE;
- }
-
- n = mbfl_strpos(&haystack, &needle, offset, reverse TSRMLS_CC);
- if (n >= 0) {
- RETVAL_LONG(n);
- } else {
- switch (-n) {
- case 1:
- break;
- case 2:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Needle has not positive length.");
- break;
- case 4:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding or conversion error.");
- break;
- case 8:
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Argument is empty.");
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error in mb_strpos.");
- break;
- }
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int mb_strrpos(string haystack, string needle [, string encoding])
- Find the last occurrence of a character in a string within another */
-PHP_FUNCTION(mb_strrpos)
-{
- int n;
- mbfl_string haystack, needle;
- char *enc_name = NULL;
- int enc_name_len;
-
- mbfl_string_init(&haystack);
- mbfl_string_init(&needle);
- haystack.no_language = MBSTRG(current_language);
- haystack.no_encoding = MBSTRG(current_internal_encoding);
- needle.no_language = MBSTRG(current_language);
- needle.no_encoding = MBSTRG(current_internal_encoding);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|s", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &enc_name, &enc_name_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (enc_name != NULL) {
- haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(enc_name);
- if (haystack.no_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", enc_name);
- RETURN_FALSE;
- }
- }
-
- if (haystack.len <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty haystack");
- RETURN_FALSE;
- }
- if (needle.len <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Empty needle");
- RETURN_FALSE;
- }
- n = mbfl_strpos(&haystack, &needle, 0, 1 TSRMLS_CC);
- if (n >= 0) {
- RETVAL_LONG(n);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int mb_substr_count(string haystack, string needle [, string encoding])
- Count the number of substring occurrences */
-PHP_FUNCTION(mb_substr_count)
-{
- int n;
- mbfl_string haystack, needle;
- char *enc_name = NULL;
- int enc_name_len;
-
- mbfl_string_init(&haystack);
- mbfl_string_init(&needle);
- haystack.no_language = MBSTRG(current_language);
- haystack.no_encoding = MBSTRG(current_internal_encoding);
- needle.no_language = MBSTRG(current_language);
- needle.no_encoding = MBSTRG(current_internal_encoding);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|s", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &enc_name, &enc_name_len) == FAILURE) {
- return;
- }
-
- if (enc_name != NULL) {
- haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(enc_name);
- if (haystack.no_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", enc_name);
- RETURN_FALSE;
- }
- }
-
- if (needle.len <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Empty needle");
- RETURN_FALSE;
- }
-
- n = mbfl_substr_count(&haystack, &needle TSRMLS_CC);
- if (n >= 0) {
- RETVAL_LONG(n);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string mb_substr(string str, int start [, int length [, string encoding]])
- Returns part of a string */
-PHP_FUNCTION(mb_substr)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- int argc, from, len, mblen;
- mbfl_string string, result, *ret;
-
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
-
- argc = ZEND_NUM_ARGS();
- switch (argc) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg4);
- string.no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg4));
- if (string.no_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", Z_STRVAL_PP(arg4));
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- string.val = (unsigned char *)Z_STRVAL_PP(arg1);
- string.len = Z_STRLEN_PP(arg1);
-
- convert_to_long_ex(arg2);
- from = Z_LVAL_PP(arg2);
- if (argc >= 3) {
- convert_to_long_ex(arg3);
- len = Z_LVAL_PP(arg3);
- } else {
- len = Z_STRLEN_PP(arg1);
- }
-
- /* measures length */
- mblen = 0;
- if (from < 0 || len < 0) {
- mblen = mbfl_strlen(&string TSRMLS_CC);
- }
-
- /* if "from" position is negative, count start position from the end
- * of the string
- */
- if (from < 0) {
- from = mblen + from;
- if (from < 0) {
- from = 0;
- }
- }
-
- /* if "length" position is negative, set it to the length
- * needed to stop that many chars from the end of the string
- */
- if (len < 0) {
- len = (mblen - from) + len;
- if (len < 0) {
- len = 0;
- }
- }
-
- ret = mbfl_substr(&string, &result, from, len TSRMLS_CC);
- if (ret != NULL) {
- RETVAL_STRINGL((char *)ret->val, ret->len, 0); /* the string is already strdup()'ed */
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string mb_strcut(string str, int start [, int length [, string encoding]])
- Returns part of a string */
-PHP_FUNCTION(mb_strcut)
-{
- pval **arg1, **arg2, **arg3, **arg4;
- int argc, from, len;
- mbfl_string string, result, *ret;
-
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
-
- argc = ZEND_NUM_ARGS();
- switch (argc) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg4);
- string.no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg4));
- if (string.no_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", Z_STRVAL_PP(arg4));
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- string.val = Z_STRVAL_PP(arg1);
- string.len = Z_STRLEN_PP(arg1);
-
- convert_to_long_ex(arg2);
- from = Z_LVAL_PP(arg2);
- if (argc >= 3) {
- convert_to_long_ex(arg3);
- len = Z_LVAL_PP(arg3);
- } else {
- len = Z_STRLEN_PP(arg1);
- }
-
- /* if "from" position is negative, count start position from the end
- * of the string
- */
- if (from < 0) {
- from = Z_STRLEN_PP(arg1) + from;
- if (from < 0) {
- from = 0;
- }
- }
-
- /* if "length" position is negative, set it to the length
- * needed to stop that many chars from the end of the string
- */
- if (len < 0) {
- len = (Z_STRLEN_PP(arg1) - from) + len;
- if (len < 0) {
- len = 0;
- }
- }
-
- ret = mbfl_strcut(&string, &result, from, len TSRMLS_CC);
- if (ret != NULL) {
- RETVAL_STRINGL(ret->val, ret->len, 0); /* the string is already strdup()'ed */
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int mb_strwidth(string str [, string encoding])
- Gets terminal width of a string */
-PHP_FUNCTION(mb_strwidth)
-{
- int n;
- mbfl_string string;
- char *enc_name = NULL;
- int enc_name_len;
-
- mbfl_string_init(&string);
-
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", (char **)&string.val, &string.len, &enc_name, &enc_name_len) == FAILURE) {
- return;
- }
-
- if (enc_name != NULL) {
- string.no_encoding = mbfl_name2no_encoding(enc_name);
- if (string.no_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", enc_name);
- RETURN_FALSE;
- }
- }
-
- n = mbfl_strwidth(&string TSRMLS_CC);
- if (n >= 0) {
- RETVAL_LONG(n);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string mb_strimwidth(string str, int start, int width [, string trimmarker [, string encoding]])
- Trim the string in terminal width */
-PHP_FUNCTION(mb_strimwidth)
-{
- pval **arg1, **arg2, **arg3, **arg4, **arg5;
- int from, width;
- mbfl_string string, result, marker, *ret;
-
- mbfl_string_init(&string);
- mbfl_string_init(&marker);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
- marker.no_language = MBSTRG(current_language);
- marker.no_encoding = MBSTRG(current_internal_encoding);
- marker.val = NULL;
- marker.len = 0;
-
- switch (ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 5:
- if (zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg5);
- string.no_encoding = marker.no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg5));
- if (string.no_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", Z_STRVAL_PP(arg5));
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- string.val = (unsigned char *)Z_STRVAL_PP(arg1);
- string.len = Z_STRLEN_PP(arg1);
-
- convert_to_long_ex(arg2);
- from = Z_LVAL_PP(arg2);
- if (from < 0 || from > Z_STRLEN_PP(arg1)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Start position is out of reange");
- RETURN_FALSE;
- }
-
- convert_to_long_ex(arg3);
- width = Z_LVAL_PP(arg3);
-
- if (width < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Width is negative value");
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() >= 4) {
- convert_to_string_ex(arg4);
- marker.val = (unsigned char *)Z_STRVAL_PP(arg4);
- marker.len = Z_STRLEN_PP(arg4);
- }
-
- ret = mbfl_strimwidth(&string, &marker, &result, from, width TSRMLS_CC);
- if (ret != NULL) {
- RETVAL_STRINGL((char *)ret->val, ret->len, 0); /* the string is already strdup()'ed */
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ MBSTRING_API char *php_mb_convert_encoding() */
-MBSTRING_API char * php_mb_convert_encoding(char *input, size_t length, char *_to_encoding, char *_from_encodings, size_t *output_len TSRMLS_DC)
-{
- mbfl_string string, result, *ret;
- enum mbfl_no_encoding from_encoding, to_encoding;
- mbfl_buffer_converter *convd;
- int size, *list;
- char *output=NULL;
-
- if (output_len) {
- *output_len = 0;
- }
- if ( !input || !length) {
- return NULL;
- }
- /* new encoding */
- if (_to_encoding && strlen(_to_encoding)) {
- to_encoding = mbfl_name2no_encoding(_to_encoding);
- if (to_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", _to_encoding);
- return NULL;
- }
- } else {
- to_encoding = MBSTRG(current_internal_encoding);
- }
-
- /* initialize string */
- mbfl_string_init(&string);
- mbfl_string_init(&result);
- from_encoding = MBSTRG(current_internal_encoding);
- string.no_encoding = from_encoding;
- string.no_language = MBSTRG(current_language);
- string.val = (unsigned char *)input;
- string.len = length;
-
- /* pre-conversion encoding */
- if (_from_encodings) {
- list = NULL;
- size = 0;
- php_mb_parse_encoding_list(_from_encodings, strlen(_from_encodings), &list, &size, 0);
- if (size == 1) {
- from_encoding = *list;
- string.no_encoding = from_encoding;
- } else if (size > 1) {
- /* auto detect */
- from_encoding = mbfl_identify_encoding_no(&string, list, size TSRMLS_CC);
- if (from_encoding != mbfl_no_encoding_invalid) {
- string.no_encoding = from_encoding;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to detect character encoding");
- from_encoding = mbfl_no_encoding_pass;
- to_encoding = from_encoding;
- string.no_encoding = from_encoding;
- }
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal character encoding specified");
- }
- if (list != NULL) {
- efree((void *)list);
- }
- }
-
- /* initialize converter */
- convd = mbfl_buffer_converter_new(from_encoding, to_encoding, string.len TSRMLS_CC);
- if (convd == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create character encoding converter");
- return NULL;
- }
- mbfl_buffer_converter_illegal_mode(convd, MBSTRG(current_filter_illegal_mode) TSRMLS_CC);
- mbfl_buffer_converter_illegal_substchar(convd, MBSTRG(current_filter_illegal_substchar) TSRMLS_CC);
-
- /* do it */
- ret = mbfl_buffer_converter_feed_result(convd, &string, &result TSRMLS_CC);
- if (ret) {
- if (output_len) {
- *output_len = ret->len;
- }
- output = (char *)ret->val;
- }
-
- mbfl_buffer_converter_delete(convd TSRMLS_CC);
- return output;
-}
-/* }}} */
-
-/* {{{ proto string mb_convert_encoding(string str, string to-encoding [, mixed from-encoding])
- Returns converted string in desired encoding */
-PHP_FUNCTION(mb_convert_encoding)
-{
- pval **arg_str, **arg_new, **arg_old;
- int i;
- size_t size, l, n;
- char *_from_encodings, *ret, *s_free = NULL;
-
- zval **hash_entry;
- HashTable *target_hash;
-
- _from_encodings = NULL;
- if (ZEND_NUM_ARGS() == 2) {
- if (zend_get_parameters_ex(2, &arg_str, &arg_new) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &arg_str, &arg_new, &arg_old) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch (Z_TYPE_PP(arg_old)) {
- case IS_ARRAY:
-
- target_hash = Z_ARRVAL_PP(arg_old);
- zend_hash_internal_pointer_reset(target_hash);
- i = zend_hash_num_elements(target_hash);
- _from_encodings = NULL;
- while (i > 0) {
- if (zend_hash_get_current_data(target_hash, (void **) &hash_entry) == FAILURE) {
- break;
- }
- convert_to_string_ex(hash_entry);
- if ( _from_encodings) {
- l = strlen(_from_encodings);
- n = strlen(Z_STRVAL_PP(hash_entry));
- _from_encodings = erealloc(_from_encodings, l+n+2);
- strcpy(_from_encodings+l,",");
- strcpy(_from_encodings+l+1,Z_STRVAL_PP(hash_entry));
- } else {
- _from_encodings = estrdup(Z_STRVAL_PP(hash_entry));
- }
- zend_hash_move_forward(target_hash);
- i--;
- }
- if (_from_encodings != NULL && !strlen(_from_encodings)) {
- efree(_from_encodings);
- _from_encodings = NULL;
- }
- s_free = _from_encodings;
- break;
- default:
- convert_to_string_ex(arg_old);
- _from_encodings = Z_STRVAL_PP(arg_old);
- break;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-
- /* new encoding */
- convert_to_string_ex(arg_str);
- convert_to_string_ex(arg_new);
- ret = php_mb_convert_encoding( Z_STRVAL_PP(arg_str), Z_STRLEN_PP(arg_str), Z_STRVAL_PP(arg_new), _from_encodings, &size TSRMLS_CC);
- if (ret != NULL) {
- RETVAL_STRINGL(ret, size, 0); /* the string is already strdup()'ed */
- } else {
- RETVAL_FALSE;
- }
- if ( s_free) {
- efree(s_free);
- }
-}
-/* }}} */
-
-/* {{{ proto string mb_convert_case(string sourcestring, int mode [, string encoding])
- Returns a case-folded version of sourcestring */
-PHP_FUNCTION(mb_convert_case)
-{
- char *str, *from_encoding = (char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding));
- int str_len, from_encoding_len;
- long case_mode = 0;
- char *newstr;
- size_t ret_len;
-
- RETVAL_FALSE;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|s!", &str, &str_len,
- &case_mode, &from_encoding, &from_encoding_len) == FAILURE)
- RETURN_FALSE;
-
- newstr = php_unicode_convert_case(case_mode, str, (size_t) str_len, &ret_len, from_encoding TSRMLS_CC);
-
- if (newstr) {
- RETVAL_STRINGL(newstr, ret_len, 0);
- }
-}
-/* }}} */
-
-/* {{{ proto string mb_strtoupper(string sourcestring [, string encoding])
- * Returns a uppercased version of sourcestring
- */
-PHP_FUNCTION(mb_strtoupper)
-{
- char *str, *from_encoding = (char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding));
- int str_len, from_encoding_len;
- char *newstr;
- size_t ret_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!", &str, &str_len,
- &from_encoding, &from_encoding_len) == FAILURE) {
- return;
- }
- newstr = php_unicode_convert_case(PHP_UNICODE_CASE_UPPER, str, (size_t) str_len, &ret_len, from_encoding TSRMLS_CC);
-
- if (newstr) {
- RETURN_STRINGL(newstr, ret_len, 0);
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string mb_strtolower(string sourcestring [, string encoding])
- * Returns a lowercased version of sourcestring
- */
-PHP_FUNCTION(mb_strtolower)
-{
- char *str, *from_encoding = (char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding));
- int str_len, from_encoding_len;
- char *newstr;
- size_t ret_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!", &str, &str_len,
- &from_encoding, &from_encoding_len) == FAILURE) {
- return;
- }
- newstr = php_unicode_convert_case(PHP_UNICODE_CASE_LOWER, str, (size_t) str_len, &ret_len, from_encoding TSRMLS_CC);
-
- if (newstr) {
- RETURN_STRINGL(newstr, ret_len, 0);
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string mb_detect_encoding(string str [, mixed encoding_list])
- Encodings of the given string is returned (as a string) */
-PHP_FUNCTION(mb_detect_encoding)
-{
- pval **arg_str, **arg_list;
- mbfl_string string;
- const char *ret;
- enum mbfl_no_encoding *elist;
- int size, *list;
-
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &arg_str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 2) {
- if (zend_get_parameters_ex(2, &arg_str, &arg_list) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-
- /* make encoding list */
- list = NULL;
- size = 0;
- if (ZEND_NUM_ARGS() >= 2) {
- switch (Z_TYPE_PP(arg_list)) {
- case IS_ARRAY:
- if (!php_mb_parse_encoding_array(*arg_list, &list, &size, 0)) {
- if (list) {
- efree(list);
- size = 0;
- }
- }
- break;
- default:
- convert_to_string_ex(arg_list);
- if (!php_mb_parse_encoding_list(Z_STRVAL_PP(arg_list), Z_STRLEN_PP(arg_list), &list, &size, 0)) {
- if (list) {
- efree(list);
- size = 0;
- }
- }
- break;
- }
- if (size <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal argument");
- }
- }
-
- if (size > 0 && list != NULL) {
- elist = list;
- } else {
- elist = MBSTRG(current_detect_order_list);
- size = MBSTRG(current_detect_order_list_size);
- }
-
- convert_to_string_ex(arg_str);
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.val = (unsigned char *)Z_STRVAL_PP(arg_str);
- string.len = Z_STRLEN_PP(arg_str);
- ret = mbfl_identify_encoding_name(&string, elist, size TSRMLS_CC);
- if (list != NULL) {
- efree((void *)list);
- }
- if (ret != NULL) {
- RETVAL_STRING((char *)ret, 1);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string mb_encode_mimeheader(string str [, string charset [, string transfer-encoding [, string linefeed]]])
- Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?= */
-PHP_FUNCTION(mb_encode_mimeheader)
-{
- enum mbfl_no_encoding charset, transenc;
- mbfl_string string, result, *ret;
- char *charset_name = NULL;
- int charset_name_len;
- char *trans_enc_name = NULL;
- int trans_enc_name_len;
- char *linefeed = "\r\n";
- int linefeed_len;
-
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sss", (char **)&string.val, &string.len, &charset_name, &charset_name_len, &trans_enc_name, &trans_enc_name_len, &linefeed, &linefeed_len) == FAILURE) {
- return;
- }
-
- charset = mbfl_no_encoding_pass;
- transenc = mbfl_no_encoding_base64;
-
- if (charset_name != NULL) {
- charset = mbfl_name2no_encoding(charset_name);
- if (charset == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", charset_name);
- RETURN_FALSE;
- }
- } else {
- const mbfl_language *lang = mbfl_no2language(MBSTRG(current_language));
- if (lang != NULL) {
- charset = lang->mail_charset;
- transenc = lang->mail_header_encoding;
- }
- }
-
- if (trans_enc_name != NULL) {
- if (*trans_enc_name == 'B' || *trans_enc_name == 'b') {
- transenc = mbfl_no_encoding_base64;
- } else if (*trans_enc_name == 'Q' || *trans_enc_name == 'q') {
- transenc = mbfl_no_encoding_qprint;
- }
- }
-
- mbfl_string_init(&result);
- ret = mbfl_mime_header_encode(&string, &result, charset, transenc, linefeed, 0 TSRMLS_CC);
- if (ret != NULL) {
- RETVAL_STRINGL((char *)ret->val, ret->len, 0) /* the string is already strdup()'ed */
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string mb_decode_mimeheader(string string)
- Decodes the MIME "encoded-word" in the string */
-PHP_FUNCTION(mb_decode_mimeheader)
-{
- mbfl_string string, result, *ret;
-
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", (char **)&string.val, &string.len) == FAILURE) {
- return;
- }
-
- mbfl_string_init(&result);
- ret = mbfl_mime_header_decode(&string, &result, MBSTRG(current_internal_encoding) TSRMLS_CC);
- if (ret != NULL) {
- RETVAL_STRINGL((char *)ret->val, ret->len, 0) /* the string is already strdup()'ed */
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string mb_convert_kana(string str [, string option] [, string encoding])
- Conversion between full-width character and half-width character (Japanese) */
-PHP_FUNCTION(mb_convert_kana)
-{
- int opt, i;
- mbfl_string string, result, *ret;
- char *optstr = NULL;
- int optstr_len;
- char *encname = NULL;
- int encname_len;
-
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ss", (char **)&string.val, &string.len, &optstr, &optstr_len, &encname, &encname_len) == FAILURE) {
- return;
- }
-
- /* option */
- if (optstr != NULL) {
- char *p = optstr;
- int n = optstr_len;
- i = 0;
- opt = 0;
- while (i < n) {
- i++;
- switch (*p++) {
- case 'A':
- opt |= 0x1;
- break;
- case 'a':
- opt |= 0x10;
- break;
- case 'R':
- opt |= 0x2;
- break;
- case 'r':
- opt |= 0x20;
- break;
- case 'N':
- opt |= 0x4;
- break;
- case 'n':
- opt |= 0x40;
- break;
- case 'S':
- opt |= 0x8;
- break;
- case 's':
- opt |= 0x80;
- break;
- case 'K':
- opt |= 0x100;
- break;
- case 'k':
- opt |= 0x1000;
- break;
- case 'H':
- opt |= 0x200;
- break;
- case 'h':
- opt |= 0x2000;
- break;
- case 'V':
- opt |= 0x800;
- break;
- case 'C':
- opt |= 0x10000;
- break;
- case 'c':
- opt |= 0x20000;
- break;
- case 'M':
- opt |= 0x100000;
- break;
- case 'm':
- opt |= 0x200000;
- break;
- }
- }
- } else {
- opt = 0x900;
- }
-
- /* encoding */
- if (encname != NULL) {
- string.no_encoding = mbfl_name2no_encoding(encname);
- if (string.no_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", encname);
- RETURN_FALSE;
- }
- }
-
- ret = mbfl_ja_jp_hantozen(&string, &result, opt TSRMLS_CC);
- if (ret != NULL) {
- RETVAL_STRINGL((char *)ret->val, ret->len, 0); /* the string is already strdup()'ed */
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-#define PHP_MBSTR_STACK_BLOCK_SIZE 32
-
-/* {{{ proto string mb_convert_variables(string to-encoding, mixed from-encoding [, mixed ...])
- Converts the string resource in variables to desired encoding */
-PHP_FUNCTION(mb_convert_variables)
-{
- pval ***args, ***stack, **var, **hash_entry;
- HashTable *target_hash;
- mbfl_string string, result, *ret;
- enum mbfl_no_encoding from_encoding, to_encoding;
- mbfl_encoding_detector *identd;
- mbfl_buffer_converter *convd;
- int n, argc, stack_level, stack_max, *elist, elistsz;
- char *name;
- void *ptmp;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 3) {
- WRONG_PARAM_COUNT;
- }
- args = (pval ***)ecalloc(argc, sizeof(pval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree((void *)args);
- WRONG_PARAM_COUNT;
- }
-
- /* new encoding */
- convert_to_string_ex(args[0]);
- to_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(args[0]));
- if (to_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", Z_STRVAL_PP(args[0]));
- efree((void *)args);
- RETURN_FALSE;
- }
-
- /* initialize string */
- mbfl_string_init(&string);
- mbfl_string_init(&result);
- from_encoding = MBSTRG(current_internal_encoding);
- string.no_encoding = from_encoding;
- string.no_language = MBSTRG(current_language);
-
- /* pre-conversion encoding */
- elist = NULL;
- elistsz = 0;
- switch (Z_TYPE_PP(args[1])) {
- case IS_ARRAY:
- php_mb_parse_encoding_array(*args[1], &elist, &elistsz, 0);
- break;
- default:
- convert_to_string_ex(args[1]);
- php_mb_parse_encoding_list(Z_STRVAL_PP(args[1]), Z_STRLEN_PP(args[1]), &elist, &elistsz, 0);
- break;
- }
- if (elistsz <= 0) {
- from_encoding = mbfl_no_encoding_pass;
- } else if (elistsz == 1) {
- from_encoding = *elist;
- } else {
- /* auto detect */
- from_encoding = mbfl_no_encoding_invalid;
- stack_max = PHP_MBSTR_STACK_BLOCK_SIZE;
- stack = (pval ***)safe_emalloc(stack_max, sizeof(pval **), 0);
- stack_level = 0;
- identd = mbfl_encoding_detector_new(elist, elistsz TSRMLS_CC);
- if (identd != NULL) {
- n = 2;
- while (n < argc || stack_level > 0) {
- if (stack_level <= 0) {
- var = args[n++];
- if (Z_TYPE_PP(var) == IS_ARRAY || Z_TYPE_PP(var) == IS_OBJECT) {
- target_hash = HASH_OF(*var);
- if (target_hash != NULL) {
- zend_hash_internal_pointer_reset(target_hash);
- }
- }
- } else {
- stack_level--;
- var = stack[stack_level];
- }
- if (Z_TYPE_PP(var) == IS_ARRAY || Z_TYPE_PP(var) == IS_OBJECT) {
- target_hash = HASH_OF(*var);
- if (target_hash != NULL) {
- while (zend_hash_get_current_data(target_hash, (void **) &hash_entry) != FAILURE) {
- zend_hash_move_forward(target_hash);
- if (Z_TYPE_PP(hash_entry) == IS_ARRAY || Z_TYPE_PP(hash_entry) == IS_OBJECT) {
- if (stack_level >= stack_max) {
- stack_max += PHP_MBSTR_STACK_BLOCK_SIZE;
- ptmp = erealloc(stack, sizeof(pval **)*stack_max);
- stack = (pval ***)ptmp;
- }
- stack[stack_level] = var;
- stack_level++;
- var = hash_entry;
- target_hash = HASH_OF(*var);
- if (target_hash != NULL) {
- zend_hash_internal_pointer_reset(target_hash);
- continue;
- }
- } else if (Z_TYPE_PP(hash_entry) == IS_STRING) {
- string.val = (unsigned char *)Z_STRVAL_PP(hash_entry);
- string.len = Z_STRLEN_PP(hash_entry);
- if (mbfl_encoding_detector_feed(identd, &string TSRMLS_CC)) {
- goto detect_end; /* complete detecting */
- }
- }
- }
- }
- } else if (Z_TYPE_PP(var) == IS_STRING) {
- string.val = (unsigned char *)Z_STRVAL_PP(var);
- string.len = Z_STRLEN_PP(var);
- if (mbfl_encoding_detector_feed(identd, &string TSRMLS_CC)) {
- goto detect_end; /* complete detecting */
- }
- }
- }
-detect_end:
- from_encoding = mbfl_encoding_detector_judge(identd TSRMLS_CC);
- mbfl_encoding_detector_delete(identd TSRMLS_CC);
- }
- efree(stack);
-
- if (from_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to detect encoding");
- from_encoding = mbfl_no_encoding_pass;
- }
- }
- if (elist != NULL) {
- efree((void *)elist);
- }
- /* create converter */
- convd = NULL;
- if (from_encoding != mbfl_no_encoding_pass) {
- convd = mbfl_buffer_converter_new(from_encoding, to_encoding, 0 TSRMLS_CC);
- if (convd == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create converter");
- RETURN_FALSE;
- }
- mbfl_buffer_converter_illegal_mode(convd, MBSTRG(current_filter_illegal_mode) TSRMLS_CC);
- mbfl_buffer_converter_illegal_substchar(convd, MBSTRG(current_filter_illegal_substchar) TSRMLS_CC);
- }
-
- /* convert */
- if (convd != NULL) {
- stack_max = PHP_MBSTR_STACK_BLOCK_SIZE;
- stack = (pval ***)safe_emalloc(stack_max, sizeof(pval **), 0);
- stack_level = 0;
- n = 2;
- while (n < argc || stack_level > 0) {
- if (stack_level <= 0) {
- var = args[n++];
- if (Z_TYPE_PP(var) == IS_ARRAY || Z_TYPE_PP(var) == IS_OBJECT) {
- target_hash = HASH_OF(*var);
- if (target_hash != NULL) {
- zend_hash_internal_pointer_reset(target_hash);
- }
- }
- } else {
- stack_level--;
- var = stack[stack_level];
- }
- if (Z_TYPE_PP(var) == IS_ARRAY || Z_TYPE_PP(var) == IS_OBJECT) {
- target_hash = HASH_OF(*var);
- if (target_hash != NULL) {
- while (zend_hash_get_current_data(target_hash, (void **) &hash_entry) != FAILURE) {
- zend_hash_move_forward(target_hash);
- if (Z_TYPE_PP(hash_entry) == IS_ARRAY || Z_TYPE_PP(hash_entry) == IS_OBJECT) {
- if (stack_level >= stack_max) {
- stack_max += PHP_MBSTR_STACK_BLOCK_SIZE;
- ptmp = erealloc(stack, sizeof(pval **)*stack_max);
- stack = (pval ***)ptmp;
- }
- stack[stack_level] = var;
- stack_level++;
- var = hash_entry;
- target_hash = HASH_OF(*var);
- if (target_hash != NULL) {
- zend_hash_internal_pointer_reset(target_hash);
- continue;
- }
- } else if (Z_TYPE_PP(hash_entry) == IS_STRING) {
- string.val = (unsigned char *)Z_STRVAL_PP(hash_entry);
- string.len = Z_STRLEN_PP(hash_entry);
- ret = mbfl_buffer_converter_feed_result(convd, &string, &result TSRMLS_CC);
- if (ret != NULL) {
- STR_FREE(Z_STRVAL_PP(hash_entry));
- Z_STRVAL_PP(hash_entry) = (char *)ret->val;
- Z_STRLEN_PP(hash_entry) = ret->len;
- }
- }
- }
- }
- } else if (Z_TYPE_PP(var) == IS_STRING) {
- string.val = (unsigned char *)Z_STRVAL_PP(var);
- string.len = Z_STRLEN_PP(var);
- ret = mbfl_buffer_converter_feed_result(convd, &string, &result TSRMLS_CC);
- if (ret != NULL) {
- STR_FREE(Z_STRVAL_PP(var));
- Z_STRVAL_PP(var) = (char *)ret->val;
- Z_STRLEN_PP(var) = ret->len;
- }
- }
- }
- efree(stack);
-
- mbfl_buffer_converter_delete(convd TSRMLS_CC);
- }
-
- efree((void *)args);
-
- name = (char *)mbfl_no_encoding2name(from_encoding);
- if (name != NULL) {
- RETURN_STRING(name, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ HTML numeric entity */
-/* {{{ static void php_mb_numericentity_exec() */
-static void
-php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
-{
- pval **arg1, **arg2, **arg3, **hash_entry;
- HashTable *target_hash;
- int argc, i, *convmap, *mapelm, mapsize=0;
- mbfl_string string, result, *ret;
- enum mbfl_no_encoding no_encoding;
-
- argc = ZEND_NUM_ARGS();
- if ((argc == 2 && zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) ||
- (argc == 3 && zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) ||
- argc < 2 || argc > 3) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
- string.val = (unsigned char *)Z_STRVAL_PP(arg1);
- string.len = Z_STRLEN_PP(arg1);
-
- /* encoding */
- if (argc == 3) {
- convert_to_string_ex(arg3);
- no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg3));
- if (no_encoding == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", Z_STRVAL_PP(arg3));
- RETURN_FALSE;
- } else {
- string.no_encoding = no_encoding;
- }
- }
-
- /* conversion map */
- convmap = NULL;
- if (Z_TYPE_PP(arg2) == IS_ARRAY){
- target_hash = Z_ARRVAL_PP(arg2);
- zend_hash_internal_pointer_reset(target_hash);
- i = zend_hash_num_elements(target_hash);
- if (i > 0) {
- convmap = (int *)safe_emalloc(i, sizeof(int), 0);
- mapelm = convmap;
- mapsize = 0;
- while (i > 0) {
- if (zend_hash_get_current_data(target_hash, (void **) &hash_entry) == FAILURE) {
- break;
- }
- convert_to_long_ex(hash_entry);
- *mapelm++ = Z_LVAL_PP(hash_entry);
- mapsize++;
- i--;
- zend_hash_move_forward(target_hash);
- }
- }
- }
- if (convmap == NULL) {
- RETURN_FALSE;
- }
- mapsize /= 4;
-
- ret = mbfl_html_numeric_entity(&string, &result, convmap, mapsize, type TSRMLS_CC);
- if (ret != NULL) {
- RETVAL_STRINGL((char *)ret->val, ret->len, 0);
- } else {
- RETVAL_FALSE;
- }
- efree((void *)convmap);
-}
-/* }}} */
-
-/* {{{ proto string mb_encode_numericentity(string string, array convmap [, string encoding])
- Converts specified characters to HTML numeric entities */
-PHP_FUNCTION(mb_encode_numericentity)
-{
- php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string mb_decode_numericentity(string string, array convmap [, string encoding])
- Converts HTML numeric entities to character code */
-PHP_FUNCTION(mb_decode_numericentity)
-{
- php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-/* }}} */
-
-/* {{{ proto int mb_send_mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
- * Sends an email message with MIME scheme
- */
-#if HAVE_SENDMAIL
-
-#define APPEND_ONE_CHAR(ch) do { \
- if (token.a > 0) { \
- smart_str_appendc(&token, ch); \
- } else {\
- token.len++; \
- } \
-} while (0)
-
-#define SEPARATE_SMART_STR(str) do {\
- if ((str)->a == 0) { \
- char *tmp_ptr; \
- (str)->a = 1; \
- while ((str)->a < (str)->len) { \
- (str)->a <<= 1; \
- } \
- tmp_ptr = emalloc((str)->a + 1); \
- memcpy(tmp_ptr, (str)->c, (str)->len); \
- (str)->c = tmp_ptr; \
- } \
-} while (0)
-
-static void my_smart_str_dtor(smart_str *s)
-{
- if (s->a > 0) {
- smart_str_free(s);
- }
-}
-
-static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t str_len)
-{
- const char *ps;
- size_t icnt;
- int state = 0;
- int crlf_state = -1;
-
- smart_str token = { 0, 0, 0 };
- smart_str fld_name = { 0, 0, 0 }, fld_val = { 0, 0, 0 };
-
- ps = str;
- icnt = str_len;
-
- /*
- * C o n t e n t - T y p e : t e x t / h t m l \r\n
- * ^ ^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^ ^^^^
- * state 0 1 2 3
- *
- * C o n t e n t - T y p e : t e x t / h t m l \r\n
- * ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^
- * crlf_state -1 0 1 -1
- *
- */
-
- while (icnt > 0) {
- switch (*ps) {
- case ':':
- if (crlf_state == 1) {
- APPEND_ONE_CHAR('\r');
- }
-
- if (state == 0 || state == 1) {
- fld_name = token;
-
- state = 2;
- } else {
- APPEND_ONE_CHAR(*ps);
- }
-
- crlf_state = 0;
- break;
-
- case '\n':
- if (crlf_state == -1) {
- goto out;
- }
- crlf_state = -1;
- break;
-
- case '\r':
- if (crlf_state == 1) {
- APPEND_ONE_CHAR('\r');
- } else {
- crlf_state = 1;
- }
- break;
-
- case ' ': case '\t':
- if (crlf_state == -1) {
- if (state == 3) {
- /* continuing from the previous line */
- SEPARATE_SMART_STR(&token);
- state = 4;
- } else {
- /* simply skipping this new line */
- state = 5;
- }
- } else {
- if (crlf_state == 1) {
- APPEND_ONE_CHAR('\r');
- }
- if (state == 1 || state == 3) {
- APPEND_ONE_CHAR(*ps);
- }
- }
- crlf_state = 0;
- break;
-
- default:
- switch (state) {
- case 0:
- token.c = (char *)ps;
- token.len = 0;
- token.a = 0;
- state = 1;
- break;
-
- case 2:
- if (crlf_state != -1) {
- token.c = (char *)ps;
- token.len = 0;
- token.a = 0;
-
- state = 3;
- break;
- }
- /* break is missing intentionally */
-
- case 3:
- if (crlf_state == -1) {
- fld_val = token;
-
- if (fld_name.c != NULL && fld_val.c != NULL) {
- char *dummy;
-
- /* FIXME: some locale free implementation is
- * really required here,,, */
- SEPARATE_SMART_STR(&fld_name);
- php_strtoupper(fld_name.c, fld_name.len);
-
- zend_hash_update(ht, (char *)fld_name.c, fld_name.len, &fld_val, sizeof(smart_str), (void **)&dummy);
-
- my_smart_str_dtor(&fld_name);
- }
-
- memset(&fld_name, 0, sizeof(smart_str));
- memset(&fld_val, 0, sizeof(smart_str));
-
- token.c = (char *)ps;
- token.len = 0;
- token.a = 0;
-
- state = 1;
- }
- break;
-
- case 4:
- APPEND_ONE_CHAR(' ');
- state = 3;
- break;
- }
-
- if (crlf_state == 1) {
- APPEND_ONE_CHAR('\r');
- }
-
- APPEND_ONE_CHAR(*ps);
-
- crlf_state = 0;
- break;
- }
- ps++, icnt--;
- }
-out:
- if (state == 2) {
- token.c = "";
- token.len = 0;
- token.a = 0;
-
- state = 3;
- }
- if (state == 3) {
- fld_val = token;
-
- if (fld_name.c != NULL && fld_val.c != NULL) {
- void *dummy;
-
- /* FIXME: some locale free implementation is
- * really required here,,, */
- SEPARATE_SMART_STR(&fld_name);
- php_strtoupper(fld_name.c, fld_name.len);
-
- zend_hash_update(ht, (char *)fld_name.c, fld_name.len, &fld_val, sizeof(smart_str), (void **)&dummy);
-
- my_smart_str_dtor(&fld_name);
- }
- }
- return state;
-}
-
-PHP_FUNCTION(mb_send_mail)
-{
- int n;
- char *to=NULL;
- int to_len;
- char *message=NULL;
- int message_len;
- char *headers=NULL;
- int headers_len;
- char *subject=NULL;
- int subject_len;
- char *extra_cmd=NULL;
- int extra_cmd_len;
- struct {
- int cnt_type:1;
- int cnt_trans_enc:1;
- } suppressed_hdrs = { 0, 0 };
-
- char *message_buf=NULL, *subject_buf=NULL, *p;
- mbfl_string orig_str, conv_str;
- mbfl_string *pstr; /* pointer to mbfl string for return value */
- enum mbfl_no_encoding
- tran_cs, /* transfar text charset */
- head_enc, /* header transfar encoding */
- body_enc; /* body transfar encoding */
- mbfl_memory_device device; /* automatic allocateable buffer for additional header */
- const mbfl_language *lang;
- int err = 0;
- HashTable ht_headers;
- smart_str *s;
- extern void mbfl_memory_device_unput(mbfl_memory_device *device TSRMLS_DC);
-
- /* initialize */
- mbfl_memory_device_init(&device, 0, 0 TSRMLS_CC);
- mbfl_string_init(&orig_str);
- mbfl_string_init(&conv_str);
-
- /* character-set, transfer-encoding */
- tran_cs = mbfl_no_encoding_utf8;
- head_enc = mbfl_no_encoding_base64;
- body_enc = mbfl_no_encoding_base64;
- lang = mbfl_no2language(MBSTRG(current_language));
- if (lang != NULL) {
- tran_cs = lang->mail_charset;
- head_enc = lang->mail_header_encoding;
- body_enc = lang->mail_body_encoding;
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ss", &to, &to_len, &subject, &subject_len, &message, &message_len, &headers, &headers_len, &extra_cmd, &extra_cmd_len) == FAILURE) {
- return;
- }
-
- zend_hash_init(&ht_headers, 0, NULL, (dtor_func_t) my_smart_str_dtor, 0);
-
- if (headers != NULL) {
- _php_mbstr_parse_mail_headers(&ht_headers, headers, headers_len);
- }
-
- if (zend_hash_find(&ht_headers, "CONTENT-TYPE", sizeof("CONTENT-TYPE") - 1, (void **)&s) == SUCCESS) {
- char *tmp;
- char *param_name;
- char *charset = NULL;
-
- SEPARATE_SMART_STR(s);
- smart_str_0(s);
-
- p = strchr(s->c, ';');
-
- if (p != NULL) {
- /* skipping the padded spaces */
- do {
- ++p;
- } while (*p == ' ' || *p == '\t');
-
- if (*p != '\0') {
- if ((param_name = php_strtok_r(p, "= ", &tmp)) != NULL) {
- if (strcasecmp(param_name, "charset") == 0) {
- enum mbfl_no_encoding _tran_cs = tran_cs;
-
- charset = php_strtok_r(NULL, "= ", &tmp);
- if (charset != NULL) {
- _tran_cs = mbfl_name2no_encoding(charset);
- }
-
- if (_tran_cs == mbfl_no_encoding_invalid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported charset \"%s\" - will be regarded as ascii", charset);
- _tran_cs = mbfl_no_encoding_ascii;
- }
- tran_cs = _tran_cs;
- }
- }
- }
- }
- suppressed_hdrs.cnt_type = 1;
- }
-
- if (zend_hash_find(&ht_headers, "CONTENT-TRANSFER-ENCODING", sizeof("CONTENT-TRANSFER-ENCODING") - 1, (void **)&s) == SUCCESS) {
- enum mbfl_no_encoding _body_enc;
- SEPARATE_SMART_STR(s);
- smart_str_0(s);
-
- _body_enc = mbfl_name2no_encoding(s->c);
- switch (_body_enc) {
- case mbfl_no_encoding_base64:
- case mbfl_no_encoding_7bit:
- case mbfl_no_encoding_8bit:
- body_enc = _body_enc;
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported transfer encoding \"%s\" - will be regarded as 8bit", s->c);
- body_enc = mbfl_no_encoding_8bit;
- break;
- }
- suppressed_hdrs.cnt_trans_enc = 1;
- }
-
- /* To: */
- if (to == NULL || to_len <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing To: field");
- err = 1;
- }
-
- /* Subject: */
- if (subject != NULL && subject_len >= 0) {
- orig_str.no_language = MBSTRG(current_language);
- orig_str.val = (unsigned char *)subject;
- orig_str.len = subject_len;
- orig_str.no_encoding = MBSTRG(current_internal_encoding);
- if (orig_str.no_encoding == mbfl_no_encoding_invalid
- || orig_str.no_encoding == mbfl_no_encoding_pass) {
- orig_str.no_encoding = mbfl_identify_encoding_no(&orig_str, MBSTRG(current_detect_order_list), MBSTRG(current_detect_order_list_size) TSRMLS_CC);
- }
- pstr = mbfl_mime_header_encode(&orig_str, &conv_str, tran_cs, head_enc, "\n", sizeof("Subject: [PHP-jp nnnnnnnn]") TSRMLS_CC);
- if (pstr != NULL) {
- subject_buf = subject = (char *)pstr->val;
- }
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing Subject: field");
- err = 1;
- }
-
- /* message body */
- if (message != NULL) {
- orig_str.no_language = MBSTRG(current_language);
- orig_str.val = message;
- orig_str.len = message_len;
- orig_str.no_encoding = MBSTRG(current_internal_encoding);
-
- if (orig_str.no_encoding == mbfl_no_encoding_invalid
- || orig_str.no_encoding == mbfl_no_encoding_pass) {
- orig_str.no_encoding = mbfl_identify_encoding_no(&orig_str, MBSTRG(current_detect_order_list), MBSTRG(current_detect_order_list_size) TSRMLS_CC);
- }
-
- pstr = NULL;
- {
- mbfl_string tmpstr;
-
- if (mbfl_convert_encoding(&orig_str, &tmpstr, tran_cs TSRMLS_CC) != NULL) {
- tmpstr.no_encoding=mbfl_no_encoding_8bit;
- pstr = mbfl_convert_encoding(&tmpstr, &conv_str, body_enc TSRMLS_CC);
- efree(tmpstr.val);
- }
- }
- if (pstr != NULL) {
- message_buf = message = (char *)pstr->val;
- }
- } else {
- /* this is not really an error, so it is allowed. */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty message body");
- message = NULL;
- }
-
- /* other headers */
-#define PHP_MBSTR_MAIL_MIME_HEADER1 "Mime-Version: 1.0"
-#define PHP_MBSTR_MAIL_MIME_HEADER2 "Content-Type: text/plain"
-#define PHP_MBSTR_MAIL_MIME_HEADER3 "; charset="
-#define PHP_MBSTR_MAIL_MIME_HEADER4 "Content-Transfer-Encoding: "
- if (headers != NULL) {
- p = headers;
- n = headers_len;
- mbfl_memory_device_strncat(&device, p, n TSRMLS_CC);
- if (n > 0 && p[n - 1] != '\n') {
- mbfl_memory_device_strncat(&device, "\n", 1 TSRMLS_CC);
- }
- }
-
- mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER1, sizeof(PHP_MBSTR_MAIL_MIME_HEADER1) - 1 TSRMLS_CC);
- mbfl_memory_device_strncat(&device, "\n", 1 TSRMLS_CC);
-
- if (!suppressed_hdrs.cnt_type) {
- mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER2, sizeof(PHP_MBSTR_MAIL_MIME_HEADER2) - 1 TSRMLS_CC);
-
- p = (char *)mbfl_no2preferred_mime_name(tran_cs);
- if (p != NULL) {
- mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER3, sizeof(PHP_MBSTR_MAIL_MIME_HEADER3) - 1 TSRMLS_CC);
- mbfl_memory_device_strcat(&device, p TSRMLS_CC);
- }
- mbfl_memory_device_strncat(&device, "\n", 1 TSRMLS_CC);
- }
- if (!suppressed_hdrs.cnt_trans_enc) {
- mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER4, sizeof(PHP_MBSTR_MAIL_MIME_HEADER4) - 1 TSRMLS_CC);
- p = (char *)mbfl_no2preferred_mime_name(body_enc);
- if (p == NULL) {
- p = "7bit";
- }
- mbfl_memory_device_strcat(&device, p TSRMLS_CC);
- mbfl_memory_device_strncat(&device, "\n", 1 TSRMLS_CC);
- }
-
- mbfl_memory_device_unput(&device TSRMLS_CC);
- mbfl_memory_device_output('\0', &device TSRMLS_CC);
- headers = (char *)device.buffer;
-
- if (!err && php_mail(to, subject, message, headers, extra_cmd TSRMLS_CC)) {
- RETVAL_TRUE;
- } else {
- RETVAL_FALSE;
- }
-
- if (subject_buf) {
- efree((void *)subject_buf);
- }
- if (message_buf) {
- efree((void *)message_buf);
- }
- mbfl_memory_device_clear(&device TSRMLS_CC);
- zend_hash_destroy(&ht_headers);
-}
-
-#undef APPEND_ONE_CHAR
-#undef SEPARATE_SMART_STR
-#undef PHP_MBSTR_MAIL_MIME_HEADER1
-#undef PHP_MBSTR_MAIL_MIME_HEADER2
-#undef PHP_MBSTR_MAIL_MIME_HEADER3
-#undef PHP_MBSTR_MAIL_MIME_HEADER4
-
-#else /* HAVE_SENDMAIL */
-
-PHP_FUNCTION(mb_send_mail)
-{
- RETURN_FALSE;
-}
-
-#endif /* HAVE_SENDMAIL */
-
-/* }}} */
-
-/* {{{ proto string mb_get_info([string type])
- Returns the current settings of mbstring */
-PHP_FUNCTION(mb_get_info)
-{
- char *typ = NULL;
- int typ_len;
- char *name;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &typ, &typ_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (!strcasecmp("all", typ)) {
- array_init(return_value);
- if ((name = (char *)mbfl_no_encoding2name(MBSTRG(current_internal_encoding))) != NULL) {
- add_assoc_string(return_value, "internal_encoding", name, 1);
- }
- if ((name = (char *)mbfl_no_encoding2name(MBSTRG(http_input_identify))) != NULL) {
- add_assoc_string(return_value, "http_input", name, 1);
- }
- if ((name = (char *)mbfl_no_encoding2name(MBSTRG(current_http_output_encoding))) != NULL) {
- add_assoc_string(return_value, "http_output", name, 1);
- }
- if ((name = (char *)mbfl_no_encoding2name(MBSTRG(func_overload))) != NULL) {
- add_assoc_string(return_value, "func_overload", name, 1);
- }
- } else if (!strcasecmp("internal_encoding", typ)) {
- if ((name = (char *)mbfl_no_encoding2name(MBSTRG(current_internal_encoding))) != NULL) {
- RETVAL_STRING(name, 1);
- }
- } else if (!strcasecmp("http_input", typ)) {
- if ((name = (char *)mbfl_no_encoding2name(MBSTRG(http_input_identify))) != NULL) {
- RETVAL_STRING(name, 1);
- }
- } else if (!strcasecmp("http_output", typ)) {
- if ((name = (char *)mbfl_no_encoding2name(MBSTRG(current_http_output_encoding))) != NULL) {
- RETVAL_STRING(name, 1);
- }
- } else if (!strcasecmp("func_overload", typ)) {
- if ((name = (char *)mbfl_no_encoding2name(MBSTRG(func_overload))) != NULL) {
- RETVAL_STRING(name, 1);
- }
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ MBSTRING_API int php_mb_encoding_translation() */
-MBSTRING_API int php_mb_encoding_translation(TSRMLS_D)
-{
- return MBSTRG(encoding_translation);
-}
-/* }}} */
-
-/* {{{ MBSTRING_API size_t php_mb_mbchar_bytes_ex() */
-MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc)
-{
- if (enc != NULL) {
- if (enc->flag & MBFL_ENCTYPE_MBCS) {
- if (enc->mblen_table != NULL) {
- if (s != NULL) return enc->mblen_table[*(unsigned char *)s];
- }
- } else if (enc->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) {
- return 2;
- } else if (enc->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) {
- return 4;
- }
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ MBSTRING_API size_t php_mb_mbchar_bytes() */
-MBSTRING_API size_t php_mb_mbchar_bytes(const char *s TSRMLS_DC)
-{
- return php_mb_mbchar_bytes_ex(s,
- mbfl_no2encoding(MBSTRG(internal_encoding)));
-}
-/* }}} */
-
-/* {{{ MBSTRING_API char *php_mb_safe_strrchr_ex() */
-MBSTRING_API char *php_mb_safe_strrchr_ex(const char *s, unsigned int c, size_t nbytes, const mbfl_encoding *enc)
-{
- register const char *p = s;
- char *last=NULL;
-
- if (nbytes == (size_t)-1) {
- size_t nb = 0;
-
- while (*p != '\0') {
- if (nb == 0) {
- if ((unsigned char)*p == (unsigned char)c) {
- last = (char *)p;
- }
- nb = php_mb_mbchar_bytes_ex(p, enc);
- if (nb == 0) {
- return NULL; /* something is going wrong! */
- }
- }
- --nb;
- ++p;
- }
- } else {
- register size_t bcnt = nbytes;
- register size_t nbytes_char;
- while (bcnt > 0) {
- if ((unsigned char)*p == (unsigned char)c) {
- last = (char *)p;
- }
- nbytes_char = php_mb_mbchar_bytes_ex(p, enc);
- if (bcnt < nbytes_char) {
- return NULL;
- }
- p += nbytes_char;
- bcnt -= nbytes_char;
- }
- }
- return last;
-}
-/* }}} */
-
-/* {{{ MBSTRING_API char *php_mb_safe_strrchr() */
-MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c, size_t nbytes TSRMLS_DC)
-{
- return php_mb_safe_strrchr_ex(s, c, nbytes,
- mbfl_no2encoding(MBSTRG(internal_encoding)));
-}
-/* }}} */
-
-/* {{{ MBSTRING_API char *php_mb_strrchr() */
-MBSTRING_API char *php_mb_strrchr(const char *s, char c TSRMLS_DC)
-{
- return php_mb_safe_strrchr(s, c, -1 TSRMLS_CC);
-}
-/* }}} */
-
-#ifdef ZEND_MULTIBYTE
-/* {{{ MBSTRING_API int php_mb_set_zend_encoding() */
-MBSTRING_API int php_mb_set_zend_encoding(TSRMLS_D)
-{
- /* 'd better use mbfl_memory_device? */
- char *name, *list = NULL;
- int n, *entry, list_size = 0;
- zend_encoding_detector encoding_detector;
- zend_encoding_converter encoding_converter;
- zend_multibyte_oddlen multibyte_oddlen;
-
- /* notify script encoding to Zend Engine */
- entry = MBSTRG(script_encoding_list);
- n = MBSTRG(script_encoding_list_size);
- while (n > 0) {
- name = (char *)mbfl_no_encoding2name(*entry);
- if (name) {
- list_size += strlen(name) + 1;
- if (!list) {
- list = (char*)emalloc(list_size);
- *list = (char)NULL;
- } else {
- list = (char*)erealloc(list, list_size);
- strcat(list, ",");
- }
- strcat(list, name);
- }
- entry++;
- n--;
- }
- zend_multibyte_set_script_encoding(list, (list ? strlen(list) : 0) TSRMLS_CC);
- if (list) {
- efree(list);
- }
- encoding_detector = php_mb_encoding_detector;
- encoding_converter = NULL;
- multibyte_oddlen = php_mb_oddlen;
-
- if (MBSTRG(encoding_translation)) {
- /* notify internal encoding to Zend Engine */
- name = (char*)mbfl_no_encoding2name(MBSTRG(current_internal_encoding));
- zend_multibyte_set_internal_encoding(name, strlen(name) TSRMLS_CC);
-
- encoding_converter = php_mb_encoding_converter;
- }
-
- zend_multibyte_set_functions(encoding_detector, encoding_converter,
- multibyte_oddlen TSRMLS_CC);
-
- return 0;
-}
-/* }}} */
-
-/* {{{ char *php_mb_encoding_detector()
- * Interface for Zend Engine
- */
-char* php_mb_encoding_detector(const char *arg_string, int arg_length, char *arg_list TSRMLS_DC)
-{
- mbfl_string string;
- const char *ret;
- enum mbfl_no_encoding *elist;
- int size, *list;
-
- /* make encoding list */
- list = NULL;
- size = 0;
- php_mb_parse_encoding_list(arg_list, strlen(arg_list), &list, &size, 0);
- if (size <= 0) {
- return NULL;
- }
- if (size > 0 && list != NULL) {
- elist = list;
- } else {
- elist = MBSTRG(current_detect_order_list);
- size = MBSTRG(current_detect_order_list_size);
- }
-
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.val = (char*)arg_string;
- string.len = arg_length;
- ret = mbfl_identify_encoding_name(&string, elist, size TSRMLS_CC);
- if (list != NULL) {
- efree((void *)list);
- }
- if (ret != NULL) {
- return estrdup(ret);
- } else {
- return NULL;
- }
-}
-/* }}} */
-
-/* {{{ int php_mb_encoding_converter() */
-int php_mb_encoding_converter(char **to, int *to_length, const char *from,
- int from_length, const char *encoding_to, const char *encoding_from
- TSRMLS_DC)
-{
- mbfl_string string, result, *ret;
- enum mbfl_no_encoding from_encoding, to_encoding;
- mbfl_buffer_converter *convd;
-
- /* new encoding */
- to_encoding = mbfl_name2no_encoding(encoding_to);
- if (to_encoding == mbfl_no_encoding_invalid) {
- return -1;
- }
- /* old encoding */
- from_encoding = mbfl_name2no_encoding(encoding_from);
- if (from_encoding == mbfl_no_encoding_invalid) {
- return -1;
- }
- /* initialize string */
- mbfl_string_init(&string);
- mbfl_string_init(&result);
- string.no_encoding = from_encoding;
- string.no_language = MBSTRG(current_language);
- string.val = (char*)from;
- string.len = from_length;
-
- /* initialize converter */
- convd = mbfl_buffer_converter_new(from_encoding, to_encoding, string.len TSRMLS_CC);
- if (convd == NULL) {
- return -1;
- }
- mbfl_buffer_converter_illegal_mode(convd, MBSTRG(current_filter_illegal_mode) TSRMLS_CC);
- mbfl_buffer_converter_illegal_substchar(convd, MBSTRG(current_filter_illegal_substchar) TSRMLS_CC);
-
- /* do it */
- ret = mbfl_buffer_converter_feed_result(convd, &string, &result TSRMLS_CC);
- if (ret != NULL) {
- *to = ret->val;
- *to_length = ret->len;
- }
- mbfl_buffer_converter_delete(convd TSRMLS_CC);
-
- return ret ? 0 : -1;
-}
-/* }}} */
-
-/* {{{ int php_mb_oddlen()
- * returns number of odd (e.g. appears only first byte of multibyte
- * character) chars
- */
-int php_mb_oddlen(const char *string, int length, const char *encoding TSRMLS_DC)
-{
- mbfl_string mb_string;
-
- mbfl_string_init(&mb_string);
- mb_string.no_language = MBSTRG(current_language);
- mb_string.no_encoding = mbfl_name2no_encoding(encoding);
- mb_string.val = (char*)string;
- mb_string.len = length;
-
- if (mb_string.no_encoding == mbfl_no_encoding_invalid) {
- return 0;
- }
- return mbfl_oddlen(&mb_string);
-}
-/* }}} */
-#endif /* ZEND_MULTIBYTE */
-
-#endif /* HAVE_MBSTRING */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/mbstring/mbstring.dsp b/ext/mbstring/mbstring.dsp
deleted file mode 100644
index d40c9910ad..0000000000
--- a/ext/mbstring/mbstring.dsp
+++ /dev/null
@@ -1,211 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mbstring" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mbstring - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mbstring.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mbstring.mak" CFG="mbstring - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mbstring - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mbstring - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mbstring - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "mbstring___Win32_Release_TS"
-# PROP BASE Intermediate_Dir "mbstring___Win32_Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MBSTRING_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "_MBCS" /D "_USRDLL" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MBSTRING" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D MBSTRING_EXPORTS=1 /D HAVE_MBSTRING=1 /D HAVE_MBREGEX=1 /D HAVE_MBSTR_CN=1 /D HAVE_MBSTR_JA=1 /D HAVE_MBSTR_KR=1 /D HAVE_MBSTR_RU=1 /D HAVE_MBSTR_TW=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mbstring.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "mbstring - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "mbstring___Win32_Debug_TS"
-# PROP BASE Intermediate_Dir "mbstring___Win32_Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "mbstring___Win32_Debug_TS"
-# PROP Intermediate_Dir "mbstring___Win32_Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MBSTRING_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "MBSTRING_EXPORTS" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MBSTRING" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D MBSTRING_EXPORTS=1 /D HAVE_MBSTRING=1 /D HAVE_MBREGEX=1 /D HAVE_MBSTR_CN=1 /D HAVE_MBSTR_JA=1 /D HAVE_MBSTR_KR=1 /D HAVE_MBSTR_RU=1 /D HAVE_MBSTR_TW=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_mbstring.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "mbstring - Win32 Release_TS"
-# Name "mbstring - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\html_entities.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mb_gpc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbfilter.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbfilter_cn.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbfilter_ja.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbfilter_kr.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbfilter_ru.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbfilter_tw.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbregex.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbstring.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_mbregex.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_unicode.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\cp932_table.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mb_gpc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbfilter.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbfilter_cn.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbfilter_ja.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbfilter_kr.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbfilter_ru.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbfilter_tw.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbregex.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbstring.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_unicode.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\unicode_data.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\unicode_table.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\unicode_table_cn.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\unicode_table_kr.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\unicode_table_tw.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/mbstring/mbstring.h b/ext/mbstring/mbstring.h
deleted file mode 100644
index c84aadb65c..0000000000
--- a/ext/mbstring/mbstring.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Tsukada Takuya <tsukada@fminn.nagano.nagano.jp> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*
- * PHP4 Multibyte String module "mbstring" (currently only for Japanese)
- *
- * History:
- * 2000.5.19 Release php-4.0RC2_jstring-1.0
- * 2001.4.1 Release php4_jstring-1.0.91
- * 2001.4.30 Release php4-jstring-1.1 (contribute to The PHP Group)
- * 2001.5.1 Renamed from jstring to mbstring (hirokawa@php.net)
- */
-
-/*
- * PHP3 Internationalization support program.
- *
- * Copyright (c) 1999,2000 by the PHP3 internationalization team.
- * All rights reserved.
- *
- * See README_PHP3-i18n-ja for more detail.
- *
- * Authors:
- * Hironori Sato <satoh@jpnnet.com>
- * Shigeru Kanemoto <sgk@happysize.co.jp>
- * Tsukada Takuya <tsukada@fminn.nagano.nagano.jp>
- */
-
-
-#ifndef _MBSTRING_H
-#define _MBSTRING_H
-
-#ifdef COMPILE_DL_MBSTRING
-#undef HAVE_MBSTRING
-#define HAVE_MBSTRING 1
-#endif
-
-#ifdef PHP_WIN32
-# undef MBSTRING_API
-# ifdef MBSTRING_EXPORTS
-# define MBSTRING_API __declspec(dllexport)
-# else
-# define MBSTRING_API __declspec(dllimport)
-# endif
-#else
-# undef MBSTRING_API
-# define MBSTRING_API /* nothing special */
-#endif
-
-
-#if HAVE_MBSTRING
-
-#include "mbfilter.h"
-#include "SAPI.h"
-
-#define PHP_MBSTRING_API 20021024
-
-#if HAVE_MBREGEX
-#include "php_mbregex.h"
-#endif
-
-extern zend_module_entry mbstring_module_entry;
-#define mbstring_module_ptr &mbstring_module_entry
-
-PHP_MINIT_FUNCTION(mbstring);
-PHP_MSHUTDOWN_FUNCTION(mbstring);
-PHP_RINIT_FUNCTION(mbstring);
-PHP_RSHUTDOWN_FUNCTION(mbstring);
-PHP_MINFO_FUNCTION(mbstring);
-
-/* functions in php_unicode.c */
-PHP_FUNCTION(mb_convert_case);
-PHP_FUNCTION(mb_strtoupper);
-PHP_FUNCTION(mb_strtolower);
-
-/* php function registration */
-PHP_FUNCTION(mb_language);
-PHP_FUNCTION(mb_internal_encoding);
-PHP_FUNCTION(mb_http_input);
-PHP_FUNCTION(mb_http_output);
-PHP_FUNCTION(mb_detect_order);
-PHP_FUNCTION(mb_substitute_character);
-PHP_FUNCTION(mb_preferred_mime_name);
-PHP_FUNCTION(mb_parse_str);
-PHP_FUNCTION(mb_output_handler);
-PHP_FUNCTION(mb_strlen);
-PHP_FUNCTION(mb_strpos);
-PHP_FUNCTION(mb_strrpos);
-PHP_FUNCTION(mb_substr_count);
-PHP_FUNCTION(mb_substr);
-PHP_FUNCTION(mb_strcut);
-PHP_FUNCTION(mb_strwidth);
-PHP_FUNCTION(mb_strimwidth);
-PHP_FUNCTION(mb_convert_encoding);
-PHP_FUNCTION(mb_detect_encoding);
-PHP_FUNCTION(mb_convert_kana);
-PHP_FUNCTION(mb_encode_mimeheader);
-PHP_FUNCTION(mb_decode_mimeheader);
-PHP_FUNCTION(mb_convert_variables);
-PHP_FUNCTION(mb_encode_numericentity);
-PHP_FUNCTION(mb_decode_numericentity);
-PHP_FUNCTION(mb_send_mail);
-PHP_FUNCTION(mb_get_info);
-
-MBSTRING_API int php_mb_encoding_translation(TSRMLS_D);
-
-MBSTRING_API char *php_mb_safe_strrchr_ex(const char *s, unsigned int c,
- size_t nbytes, const mbfl_encoding *enc);
-MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c,
- size_t nbytes TSRMLS_DC);
-MBSTRING_API char *php_mb_strrchr(const char *s, char c TSRMLS_DC);
-
-MBSTRING_API char * php_mb_convert_encoding(char *input, size_t length,
- char *_to_encoding,
- char *_from_encodings,
- size_t *output_len TSRMLS_DC);
-
-MBSTRING_API int php_mb_check_encoding_list(const char *encoding_list TSRMLS_DC);
-
-MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc);
-MBSTRING_API size_t php_mb_mbchar_bytes(const char *s TSRMLS_DC);
-
-
-ZEND_BEGIN_MODULE_GLOBALS(mbstring)
- enum mbfl_no_language language;
- enum mbfl_no_language current_language;
- enum mbfl_no_encoding internal_encoding;
- enum mbfl_no_encoding current_internal_encoding;
-#ifdef ZEND_MULTIBYTE
- enum mbfl_no_encoding *script_encoding_list;
- int script_encoding_list_size;
-#endif /* ZEND_MULTIBYTE */
- enum mbfl_no_encoding http_output_encoding;
- enum mbfl_no_encoding current_http_output_encoding;
- enum mbfl_no_encoding http_input_identify;
- enum mbfl_no_encoding http_input_identify_get;
- enum mbfl_no_encoding http_input_identify_post;
- enum mbfl_no_encoding http_input_identify_cookie;
- enum mbfl_no_encoding http_input_identify_string;
- enum mbfl_no_encoding *http_input_list;
- int http_input_list_size;
- enum mbfl_no_encoding *detect_order_list;
- int detect_order_list_size;
- enum mbfl_no_encoding *current_detect_order_list;
- int current_detect_order_list_size;
- int filter_illegal_mode;
- int filter_illegal_substchar;
- int current_filter_illegal_mode;
- int current_filter_illegal_substchar;
- long func_overload;
- zend_bool encoding_translation;
- mbfl_buffer_converter *outconv;
-#if HAVE_MBREGEX && defined(PHP_MBREGEX_GLOBALS)
- PHP_MBREGEX_GLOBALS
-#endif
-ZEND_END_MODULE_GLOBALS(mbstring)
-
-#define MB_OVERLOAD_MAIL 1
-#define MB_OVERLOAD_STRING 2
-#define MB_OVERLOAD_REGEX 4
-
-struct mb_overload_def {
- int type;
- char *orig_func;
- char *ovld_func;
- char *save_func;
-};
-
-#ifdef ZTS
-#define MBSTRG(v) TSRMG(mbstring_globals_id, zend_mbstring_globals *, v)
-#else
-#define MBSTRG(v) (mbstring_globals.v)
-#endif
-
-#ifdef ZEND_MULTIBYTE
-MBSTRING_API int php_mb_set_zend_encoding(TSRMLS_D);
-char* php_mb_encoding_detector(const char *string, int length, char *list
- TSRMLS_DC);
-int php_mb_encoding_converter(char **to, int *to_length, const char *from,
- int from_length, const char *encoding_to, const char *encoding_from
- TSRMLS_DC);
-int php_mb_oddlen(const char *string, int length, const char *encoding TSRMLS_DC);
-#endif /* ZEND_MULTIBYTE */
-
-#else /* HAVE_MBSTRING */
-
-#define mbstring_module_ptr NULL
-
-#endif /* HAVE_MBSTRING */
-
-#define phpext_mbstring_ptr mbstring_module_ptr
-
-#endif /* _MBSTRING_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
deleted file mode 100644
index c99a83e270..0000000000
--- a/ext/mbstring/php_mbregex.c
+++ /dev/null
@@ -1,1176 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Tsukada Takuya <tsukada@fminn.nagano.nagano.jp> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_mbregex.h"
-#include "mbregex.h"
-#include "mbstring.h"
-
-#if HAVE_MBREGEX
-
-ZEND_EXTERN_MODULE_GLOBALS(mbstring)
-
-#ifdef ZTS
-MUTEX_T mbregex_locale_mutex = NULL;
-#endif
-
-/*
- * string buffer
- */
-struct strbuf {
- unsigned char* buffer;
- int length;
- int pos;
- int allocsz;
-};
-
-static void
-_php_mb_regex_strbuf_init(struct strbuf *pd)
-{
- if (pd) {
- pd->buffer = (unsigned char*)0;
- pd->length = 0;
- pd->pos = 0;
- pd->allocsz = 64;
- }
-}
-
-static int
-_php_mb_regex_strbuf_ncat(struct strbuf *pd, const unsigned char *psrc, int len)
-{
- if (pd == NULL || psrc == NULL) {
- return -1;
- }
-
- if ((pd->pos + len) >= pd->length) {
- /* reallocate buffer */
- int newlen = pd->length + pd->allocsz + len;
- unsigned char *tmp = (unsigned char*)erealloc((void*)pd->buffer, newlen);
- if (tmp == NULL) {
- return -1;
- }
- pd->length = newlen;
- pd->buffer = tmp;
- }
-
- while (len > 0) {
- pd->buffer[pd->pos++] = *psrc++;
- len--;
- }
-
- return len;
-}
-
-/* {{{ static void php_mb_regex_free_cache() */
-static void php_mb_regex_free_cache(mb_regex_t *pre)
-{
- mbre_free_pattern(pre);
-}
-/* }}} */
-
-/* {{{ _php_mb_regex_globals_ctor */
-void _php_mb_regex_globals_ctor(zend_mbstring_globals *pglobals TSRMLS_DC)
-{
- MBSTRG(default_mbctype) = MBCTYPE_EUC;
- MBSTRG(current_mbctype) = MBCTYPE_EUC;
- zend_hash_init(&(MBSTRG(ht_rc)), 0, NULL, (void (*)(void *)) php_mb_regex_free_cache, 1);
- MBSTRG(search_str) = (zval**)0;
- MBSTRG(search_str_val) = (zval*)0;
- MBSTRG(search_re) = (mb_regex_t*)0;
- MBSTRG(search_pos) = 0;
- MBSTRG(search_regs) = (struct mbre_registers*)0;
-}
-/* }}} */
-
-/* {{{ _php_mb_regex_globals_dtor */
-void _php_mb_regex_globals_dtor(zend_mbstring_globals *pglobals TSRMLS_DC)
-{
- zend_hash_destroy(&MBSTRG(ht_rc));
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION(mb_regex) */
-PHP_MINIT_FUNCTION(mb_regex)
-{
-# ifdef ZTS
- mbregex_locale_mutex = tsrm_mutex_alloc();
-# endif
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION(mb_regex) */
-PHP_MSHUTDOWN_FUNCTION(mb_regex)
-{
-#ifdef ZTS
- if (mbregex_locale_mutex != NULL) {
- tsrm_mutex_free(mbregex_locale_mutex);
- }
-#endif
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION(mb_regex) */
-PHP_RINIT_FUNCTION(mb_regex)
-{
- MBSTRG(regex_default_options) = MBRE_OPTION_POSIXLINE;
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION(mb_regex) */
-PHP_RSHUTDOWN_FUNCTION(mb_regex)
-{
- MBSTRG(current_mbctype) = MBSTRG(default_mbctype);
- if (MBSTRG(search_str)) {
- if (ZVAL_REFCOUNT(*MBSTRG(search_str)) > 1) {
- ZVAL_DELREF(*MBSTRG(search_str));
- } else {
- zval_dtor(*MBSTRG(search_str));
- FREE_ZVAL(*MBSTRG(search_str));
- }
- MBSTRG(search_str) = (zval **)0;
- MBSTRG(search_str_val) = (zval *)0;
- }
- MBSTRG(search_pos) = 0;
- if (MBSTRG(search_re)) {
- efree(MBSTRG(search_re));
- MBSTRG(search_re) = (mb_regex_t *)0;
- }
- if (MBSTRG(search_regs)) {
- mbre_free_registers(MBSTRG(search_regs));
- efree(MBSTRG(search_regs));
- MBSTRG(search_regs) = (struct mbre_registers*)0;
- }
- zend_hash_clean(&MBSTRG(ht_rc));
-
- return SUCCESS;
-}
-/* }}} */
-
-/*
- * encoding name resolver
- */
-static int _php_mb_regex_name2mbctype(const char *pname)
-{
- int mbctype;
-
- mbctype = -1;
- if (pname != NULL) {
- if (strcasecmp("EUC-JP", pname) == 0
- || strcasecmp("X-EUC-JP", pname) == 0
- || strcasecmp("UJIS", pname) == 0
- || strcasecmp("EUCJP", pname) == 0
- || strcasecmp("EUC_JP", pname) == 0) {
- mbctype = MBCTYPE_EUC;
- } else if (strcasecmp("UTF-8", pname) == 0
- || strcasecmp("UTF8", pname) == 0) {
- mbctype = MBCTYPE_UTF8;
- } else if (strcasecmp("SJIS", pname) == 0
- || strcasecmp("CP932", pname) == 0
- || strcasecmp("MS932", pname) == 0
- || strcasecmp("SHIFT_JIS", pname) == 0 ) {
- mbctype = MBCTYPE_SJIS;
- } else if (strcasecmp("ASCII", pname) == 0) {
- mbctype = MBCTYPE_ASCII;
- mbctype = MBCTYPE_EUC;
- }
- }
-
- return mbctype;
-}
-
-static const char*
-php_mbregex_mbctype2name(int mbctype)
-{
- const char *p = NULL;
-
- if (mbctype == MBCTYPE_EUC) {
- p = "EUC-JP";
- } else if(mbctype == MBCTYPE_UTF8) {
- p = "UTF-8";
- } else if(mbctype == MBCTYPE_SJIS) {
- p = "SJIS";
- } else if(mbctype == MBCTYPE_ASCII) {
- p = "ascii";
- }
-
- return p;
-}
-
-
-/*
- * regex cache
- */
-static int
-php_mbregex_compile_pattern(mb_regex_t *pre, const char *pattern, int patlen, int options, int mbctype TSRMLS_DC)
-{
- int res = 0;
- const char *err_str = NULL;
- mb_regex_t *rc = NULL;
-
- if(zend_hash_find(&MBSTRG(ht_rc), (char *)pattern, patlen+1, (void **) &rc) == FAILURE ||
- rc->options != options || rc->mbctype != mbctype) {
- memset(pre, 0, sizeof(*pre));
- pre->fastmap = (char*)safe_emalloc((1 << MBRE_BYTEWIDTH), sizeof(char), 0);
- pre->options = options;
- pre->mbctype = mbctype;
- err_str = mbre_compile_pattern(pattern, patlen, pre);
- if (!err_str) {
- zend_hash_update(&MBSTRG(ht_rc), (char *) pattern, patlen+1, (void *) pre, sizeof(*pre), NULL);
- } else {
- efree(pre->fastmap);
- pre->fastmap = (char*)0;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex compile err: %s", err_str);
- res = 1;
- }
- } else {
- memcpy(pre, rc, sizeof(*pre));
- }
-
- return res;
-}
-
-static size_t
-_php_mb_regex_get_option_string(char *str, size_t len, int option)
-{
- size_t len_left = len;
- size_t len_req = 0;
- char *p = str;
-
-
- if ((option & MBRE_OPTION_IGNORECASE) != 0) {
- if (len_left > 0) {
- --len_left;
- *(p++) = 'i';
- }
- ++len_req;
- }
-
- if ((option & MBRE_OPTION_EXTENDED) != 0) {
- if (len_left > 0) {
- --len_left;
- *(p++) = 'x';
- }
- ++len_req;
- }
-
- if ((option & MBRE_OPTION_POSIXLINE) == MBRE_OPTION_POSIXLINE) {
- if (len_left > 0) {
- --len_left;
- *(p++) = 'p';
- }
- ++len_req;
- } else {
- if ((option & MBRE_OPTION_MULTILINE) != 0) {
- if (len_left > 0) {
- --len_left;
- *(p++) = 'm';
- }
- ++len_req;
- }
-
- if ((option & MBRE_OPTION_SINGLELINE) != 0) {
- if (len_left > 0) {
- --len_left;
- *(p++) = 's';
- }
- ++len_req;
- }
- }
- if ((option & MBRE_OPTION_LONGEST) != 0) {
- if (len_left > 0) {
- --len_left;
- *(p++) = 'l';
- }
- ++len_req;
- }
- if (len_left > 0) {
- --len_left;
- *(p++) = '\0';
- }
-
- ++len_req;
- if (len < len_req) {
- return len_req;
- }
-
- return 0;
-}
-
-static void
-_php_mb_regex_init_options(const char *parg, int narg, int *option, int *eval)
-{
- int n;
- char c;
- int optm = 0;
-
- if (parg != NULL) {
- n = 0;
- while(n < narg) {
- c = parg[n++];
- switch (c) {
- case 'i':
- optm |= MBRE_OPTION_IGNORECASE;
- break;
- case 'x':
- optm |= MBRE_OPTION_EXTENDED;
- break;
- case 'm':
- optm |= MBRE_OPTION_MULTILINE;
- break;
- case 's':
- optm |= MBRE_OPTION_SINGLELINE;
- break;
- case 'p':
- optm |= MBRE_OPTION_POSIXLINE;
- break;
- case 'l':
- optm |= MBRE_OPTION_LONGEST;
- break;
- case 'e':
- if (eval != NULL) *eval = 1;
- break;
- default:
- break;
- }
- }
- if (option != NULL) *option|=optm;
- }
-}
-
-
-/*
- * php funcions
- */
-
-/* {{{ proto string mb_regex_encoding([string encoding])
- Returns the current encoding for regex as a string. */
-PHP_FUNCTION(mb_regex_encoding)
-{
- zval **arg1;
- int mbctype;
-
- if (ZEND_NUM_ARGS() == 0) {
- const char *retval = php_mbregex_mbctype2name(MBSTRG(current_mbctype));
- if ( retval != NULL ) {
- RETVAL_STRING((char *)retval, 1);
- } else {
- RETVAL_FALSE;
- }
- } else if (ZEND_NUM_ARGS() == 1 &&
- zend_get_parameters_ex(1, &arg1) != FAILURE) {
- convert_to_string_ex(arg1);
- mbctype = _php_mb_regex_name2mbctype(Z_STRVAL_PP(arg1));
- if (mbctype < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", Z_STRVAL_PP(arg1));
- RETVAL_FALSE;
- } else {
- MBSTRG(current_mbctype) = mbctype;
- RETVAL_TRUE;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-
-/* {{{ _php_mb_regex_ereg_exec */
-static void
-_php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
-{
- zval tmp;
- zval *arg_pattern, *array;
- char *string;
- int string_len;
- mb_regex_t re;
- struct mbre_registers regs = {0, 0, 0, 0};
- int i, err, match_len, option, beg, end;
- char *str;
-
- array = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|z", &arg_pattern, &string, &string_len, &array) == FAILURE) {
- RETURN_FALSE;
- }
-
- option = MBSTRG(regex_default_options);
- if (icase) {
- option |= MBRE_OPTION_IGNORECASE;
- }
-
- /* compile the regular expression from the supplied regex */
- if (Z_TYPE_P(arg_pattern) != IS_STRING) {
- /* we convert numbers to integers and treat them as a string */
- tmp = *arg_pattern;
- zval_copy_ctor(&tmp);
- if (Z_TYPE_P(&tmp) == IS_DOUBLE) {
- convert_to_long(&tmp); /* get rid of decimal places */
- }
- convert_to_string(&tmp);
- arg_pattern = &tmp;
- /* don't bother doing an extended regex with just a number */
- }
- err = php_mbregex_compile_pattern(
- &re,
- Z_STRVAL_P(arg_pattern),
- Z_STRLEN_P(arg_pattern),
- option, MBSTRG(current_mbctype) TSRMLS_CC);
- if (err) {
- RETVAL_FALSE;
- goto out;
- }
-
- /* actually execute the regular expression */
- err = mbre_search(
- &re,
- string,
- string_len,
- 0, string_len,
- &regs);
- if (err < 0) {
- mbre_free_registers(&regs);
- RETVAL_FALSE;
- goto out;
- }
-
- match_len = 1;
- str = string;
- if (array) {
- match_len = regs.end[0] - regs.beg[0];
- zval_dtor(array); /* start with clean array */
- array_init(array);
- for (i = 0; i < regs.num_regs; i++) {
- beg = regs.beg[i];
- end = regs.end[i];
- if (beg >= 0 && beg < end && end <= string_len) {
- add_index_stringl(array, i, (char *)&str[beg], end - beg, 1);
- } else {
- add_index_bool(array, i, 0);
- }
- }
- }
-
- mbre_free_registers(&regs);
- if (match_len == 0) {
- match_len = 1;
- }
- RETVAL_LONG(match_len);
-out:
- if (arg_pattern == &tmp) {
- zval_dtor(&tmp);
- }
-}
-
-/* {{{ proto int mb_ereg(string pattern, string string [, array registers])
- Regular expression match for multibyte string */
-PHP_FUNCTION(mb_ereg)
-{
- _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int mb_eregi(string pattern, string string [, array registers])
- Case-insensitive regular expression match for multibyte string */
-PHP_FUNCTION(mb_eregi)
-{
- _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-
-/* {{{ _php_mb_regex_ereg_replace_exec */
-static void
-_php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option)
-{
- zval *arg_pattern_zval;
-
- char *arg_pattern;
- int arg_pattern_len;
-
- char *replace;
- int replace_len;
-
- char *string;
- int string_len;
-
- char *p;
- mb_regex_t re;
- struct mbre_registers regs = {0, 0, 0, 0};
- struct strbuf outdev, evaldev, *pdevice;
- int i, n, err, pos, eval;
- char *description = NULL;
- char pat_buf[2];
-
- const mbfl_encoding *enc;
-
- {
- const char *current_enc_name;
- current_enc_name = php_mbregex_mbctype2name(MBSTRG(current_mbctype));
- if (current_enc_name == NULL ||
- (enc = mbfl_name2encoding(current_enc_name)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error");
- RETURN_FALSE;
- }
- }
- eval = 0;
- {
- char *option_str = NULL;
- int option_str_len = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zss|s",
- &arg_pattern_zval,
- &replace, &replace_len,
- &string, &string_len,
- &option_str, &option_str_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (option_str != NULL) {
- _php_mb_regex_init_options(option_str, option_str_len, &option, &eval);
- } else {
- option |= MBSTRG(regex_default_options);
- }
- }
- if (Z_TYPE_P(arg_pattern_zval) == IS_STRING) {
- arg_pattern = Z_STRVAL_P(arg_pattern_zval);
- arg_pattern_len = Z_STRLEN_P(arg_pattern_zval);
- } else {
- /* FIXME: this code is not multibyte aware! */
- convert_to_long_ex(&arg_pattern_zval);
- pat_buf[0] = (char)Z_LVAL_P(arg_pattern_zval);
- pat_buf[1] = '\0';
-
- arg_pattern = pat_buf;
- arg_pattern_len = 1;
- }
- /* create regex pattern buffer */
- err = php_mbregex_compile_pattern(
- &re,
- arg_pattern,
- arg_pattern_len,
- option, MBSTRG(current_mbctype) TSRMLS_CC);
- if (err) {
- RETURN_FALSE;
- }
-
- /* initialize string buffer (auto reallocate buffer) */
- _php_mb_regex_strbuf_init(&outdev);
- _php_mb_regex_strbuf_init(&evaldev);
- outdev.allocsz = (string_len >> 2) + 8;
-
- if (eval) {
- pdevice = &evaldev;
- description = zend_make_compiled_string_description("mbregex replace" TSRMLS_CC);
- } else {
- pdevice = &outdev;
- description = NULL;
- }
-
- /* do the actual work */
- err = 0;
- pos = 0;
- while (err >= 0) {
- err = mbre_search(&re, string, string_len, pos, string_len - pos, &regs);
- if (err <= -2) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex search failure in php_mbereg_replace_exec()");
- break;
- }
- if (err >= 0) {
-#if moriyoshi_0
- if ( regs.beg[0] == regs.end[0] ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty regular expression");
- break;
- }
-#endif
- /* copy the part of the string before the match */
- _php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)&string[pos], regs.beg[0] - pos);
- /* copy replacement and backrefs */
- i = 0;
- p = replace;
- while (i < replace_len) {
- int fwd = (int) php_mb_mbchar_bytes_ex(p, enc);
- n = -1;
- if ((replace_len - i) >= 2 && fwd == 1 &&
- p[0] == '\\' && p[1] >= '0' && p[1] <= '9') {
- n = p[1] - '0';
- }
- if (n >= 0 && n < regs.num_regs) {
- if (regs.beg[n] >= 0 && regs.beg[n] < regs.end[n] && regs.end[n] <= string_len) {
- _php_mb_regex_strbuf_ncat(pdevice, (const unsigned char *)&string[regs.beg[n]], regs.end[n] - regs.beg[n]);
- }
- p += 2;
- i += 2;
- } else {
- _php_mb_regex_strbuf_ncat(pdevice, (const unsigned char *)p, fwd);
- p += fwd;
- i += fwd;
- }
- }
- if (eval) {
- zval v;
- /* null terminate buffer */
- _php_mb_regex_strbuf_ncat(&evaldev, (const unsigned char *)"\0", 1);
- /* do eval */
- zend_eval_string((char *)evaldev.buffer, &v, description TSRMLS_CC);
- /* result of eval */
- convert_to_string(&v);
- _php_mb_regex_strbuf_ncat(&outdev, Z_STRVAL(v), Z_STRLEN(v));
- /* Clean up */
- evaldev.pos = 0;
- zval_dtor(&v);
- }
- n = regs.end[0];
- if (pos < n) {
- pos = n;
- } else {
- _php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)&string[pos], 1 );
- pos++;
- }
- } else { /* nomatch */
- /* stick that last bit of string on our output */
- _php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)&string[pos], string_len - pos);
- }
- }
-
- if (description) {
- efree(description);
- }
- mbre_free_registers(&regs);
- if (evaldev.buffer) {
- efree((void*)evaldev.buffer);
- }
- n = outdev.pos;
- _php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)"\0", 1);
- if (err <= -2) {
- if (outdev.buffer) {
- efree((void*)outdev.buffer);
- }
- RETVAL_FALSE;
- } else {
- RETVAL_STRINGL((char *)outdev.buffer, n, 0);
- }
-}
-/* }}} */
-/* {{{ proto string mb_ereg_replace(string pattern, string replacement, string string [, string option])
- Replace regular expression for multibyte string */
-PHP_FUNCTION(mb_ereg_replace)
-{
- _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string mb_eregi_replace(string pattern, string replacement, string string)
- Case insensitive replace regular expression for multibyte string */
-PHP_FUNCTION(mb_eregi_replace)
-{
- _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, MBRE_OPTION_IGNORECASE);
-}
-/* }}} */
-
-
-/* {{{ proto array mb_split(string pattern, string string [, int limit])
- split multibyte string into array by regular expression */
-PHP_FUNCTION(mb_split)
-{
- char *arg_pattern;
- int arg_pattern_len;
- mb_regex_t re;
- struct mbre_registers regs = {0, 0, 0, 0};
- char *string;
- int string_len;
-
- int n, err, pos;
- long count = -1;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &arg_pattern, &arg_pattern_len, &string, &string_len, &count) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (count == 0) {
- count = 1;
- }
-
- /* create regex pattern buffer */
- err = php_mbregex_compile_pattern(
- &re,
- arg_pattern,
- arg_pattern_len,
- MBSTRG(regex_default_options), MBSTRG(current_mbctype) TSRMLS_CC);
- if (err) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- pos = 0;
- err = 0;
- /* churn through str, generating array entries as we go */
- while ((--count != 0) &&
- (err = mbre_search(&re, string, string_len, pos, string_len - pos, &regs)) >= 0) {
- if ( regs.beg[0] == regs.end[0] ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty regular expression");
- break;
- }
-
-
- /* add it to the array */
- if ( regs.beg[0] < string_len && regs.beg[0] >= pos) {
- add_next_index_stringl(return_value, (char *)&string[pos], regs.beg[0]-pos, 1);
- } else {
- err = -2;
- break;
- }
- /* point at our new starting point */
- n = regs.end[0];
- if (pos < n) {
- pos = n;
- }
- if (count < 0) {
- count = 0;
- }
- }
-
- mbre_free_registers(&regs);
-
- /* see if we encountered an error */
- if (err <= -2) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex search failure in mbsplit()");
- zval_dtor(return_value);
- RETURN_FALSE;
- }
-
- /* otherwise we just have one last element to add to the array */
- n = string_len - pos;
- if (n > 0) {
- add_next_index_stringl(return_value, (char *)&string[pos], n, 1);
- } else {
- add_next_index_stringl(return_value, (char *)empty_string, 0, 1);
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool mb_ereg_match(string pattern, string string [,string option])
- Regular expression match for multibyte string */
-PHP_FUNCTION(mb_ereg_match)
-{
- char *arg_pattern;
- int arg_pattern_len;
-
- char *string;
- int string_len;
-
- mb_regex_t re;
- int option, err;
-
- option = 0;
- {
- char *option_str = NULL;
- int option_str_len = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|s",
- &arg_pattern, &arg_pattern_len, &string, &string_len,
- &option_str, &option_str_len)==FAILURE) {
- RETURN_FALSE;
- }
-
- if (option_str != NULL) {
- _php_mb_regex_init_options(option_str, option_str_len, &option, NULL);
- } else {
- option |= MBSTRG(regex_default_options);
- }
- }
-
- err = php_mbregex_compile_pattern(
- &re,
- arg_pattern,
- arg_pattern_len,
- option, MBSTRG(current_mbctype) TSRMLS_CC);
-
- if (err) {
- RETURN_FALSE;
- }
-
- /* match */
- err = mbre_match(&re, string, string_len, 0, NULL);
- if (err >= 0) {
- RETVAL_TRUE;
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-
-/* regex search */
-static void
-_php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- zval **arg_pattern, **arg_options;
- int n, i, err, pos, len, beg, end, option;
- unsigned char *str;
-
- option = MBSTRG(regex_default_options);
- switch (ZEND_NUM_ARGS()) {
- case 0:
- break;
- case 1:
- if (zend_get_parameters_ex(1, &arg_pattern) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &arg_pattern, &arg_options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg_options);
- option = 0;
- _php_mb_regex_init_options(Z_STRVAL_PP(arg_options), Z_STRLEN_PP(arg_options), &option, NULL);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- if (ZEND_NUM_ARGS() > 0) {
- /* create regex pattern buffer */
- convert_to_string_ex(arg_pattern);
- if (!MBSTRG(search_re)) {
- MBSTRG(search_re) = (mb_regex_t*)ecalloc(1, sizeof(mb_regex_t));
- }
- err = php_mbregex_compile_pattern(
- MBSTRG(search_re),
- Z_STRVAL_PP(arg_pattern),
- Z_STRLEN_PP(arg_pattern),
- option, MBSTRG(current_mbctype) TSRMLS_CC);
- if (err) {
- efree(MBSTRG(search_re));
- MBSTRG(search_re) = (mb_regex_t*)0;
- RETURN_FALSE;
- }
- }
-
- pos = MBSTRG(search_pos);
- str = NULL;
- len = 0;
- if (MBSTRG(search_str) != NULL && Z_TYPE_PP(MBSTRG(search_str)) == IS_STRING){
- str = (unsigned char *)Z_STRVAL_PP(MBSTRG(search_str));
- len = Z_STRLEN_PP(MBSTRG(search_str));
- }
-
- if (!MBSTRG(search_re)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No regex given");
- RETURN_FALSE;
- }
- if (!str) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No string given");
- RETURN_FALSE;
- }
- if (MBSTRG(search_regs)) {
- mbre_free_registers(MBSTRG(search_regs));
- memset(MBSTRG(search_regs), 0, sizeof(struct mbre_registers));
- } else {
- MBSTRG(search_regs) = (struct mbre_registers*)ecalloc(1, sizeof(struct mbre_registers));
- }
-
- err = mbre_search(MBSTRG(search_re), (const char *)str, len, pos, len - pos, MBSTRG(search_regs));
- if (err <= -2) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex search failure in mbregex_search()");
- RETVAL_FALSE;
- } else if (err < 0) {
- MBSTRG(search_pos) = len;
- RETVAL_FALSE;
- } else {
- if (MBSTRG(search_regs)->beg[0] == MBSTRG(search_regs)->end[0]) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty regular expression");
- }
- switch (mode) {
- case 1:
- array_init(return_value);
- beg = MBSTRG(search_regs)->beg[0];
- end = MBSTRG(search_regs)->end[0];
- add_next_index_long(return_value, beg);
- add_next_index_long(return_value, end - beg);
- break;
- case 2:
- array_init(return_value);
- n = MBSTRG(search_regs)->num_regs;
- for (i = 0; i < n; i++) {
- beg = MBSTRG(search_regs)->beg[i];
- end = MBSTRG(search_regs)->end[i];
- if (beg >= 0 && beg <= end && end <= len) {
- add_index_stringl(return_value, i, (char *)&str[beg], end - beg, 1);
- } else {
- add_index_bool(return_value, i, 0);
- }
- }
- break;
- default:
- RETVAL_TRUE;
- break;
- }
- end = MBSTRG(search_regs)->end[0];
- if (pos < end) {
- MBSTRG(search_pos) = end;
- } else {
- MBSTRG(search_pos) = pos + 1;
- }
- }
-
- if (err < 0) {
- mbre_free_registers(MBSTRG(search_regs));
- efree(MBSTRG(search_regs));
- MBSTRG(search_regs) = (struct mbre_registers*)0;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool mb_ereg_search([string pattern[, string option]])
- Regular expression search for multibyte string */
-PHP_FUNCTION(mb_ereg_search)
-{
- _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-
-/* {{{ proto array mb_ereg_search_pos([string pattern[, string option]])
- Regular expression search for multibyte string */
-PHP_FUNCTION(mb_ereg_search_pos)
-{
- _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-/* {{{ proto array mb_ereg_search_regs([string pattern[, string option]])
- Regular expression search for multibyte string */
-PHP_FUNCTION(mb_ereg_search_regs)
-{
- _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);
-}
-/* }}} */
-
-
-/* {{{ proto bool mb_ereg_search_init(string string [, string pattern[, string option]])
- Initialize string and regular expression for search. */
-PHP_FUNCTION(mb_ereg_search_init)
-{
- zval **arg_str, **arg_pattern, **arg_options;
- int err, option;
-
- option = MBSTRG(regex_default_options);
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &arg_str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &arg_str, &arg_pattern) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &arg_str, &arg_pattern, &arg_options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg_options);
- option = 0;
- _php_mb_regex_init_options(Z_STRVAL_PP(arg_options), Z_STRLEN_PP(arg_options), &option, NULL);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- if (ZEND_NUM_ARGS() > 1) {
- /* create regex pattern buffer */
- convert_to_string_ex(arg_pattern);
- if (!MBSTRG(search_re)) {
- MBSTRG(search_re) = (mb_regex_t*)ecalloc(1, sizeof(mb_regex_t));
- }
- err = php_mbregex_compile_pattern(
- MBSTRG(search_re),
- Z_STRVAL_PP(arg_pattern),
- Z_STRLEN_PP(arg_pattern),
- option, MBSTRG(current_mbctype) TSRMLS_CC);
- if (err) {
- efree(MBSTRG(search_re));
- MBSTRG(search_re) = (mb_regex_t*)0;
- RETURN_FALSE;
- }
- }
-
- if (MBSTRG(search_str)) {
- if (ZVAL_REFCOUNT(*MBSTRG(search_str)) > 1) {
- ZVAL_DELREF(*MBSTRG(search_str));
- } else {
- zval_dtor(*MBSTRG(search_str));
- FREE_ZVAL(*MBSTRG(search_str));
- }
- MBSTRG(search_str) = (zval **)0;
- MBSTRG(search_str_val) = (zval *)0;
- }
-
- if (PZVAL_IS_REF(*arg_str)) {
- ZVAL_ADDREF(*arg_str);
- MBSTRG(search_str_val) = *arg_str;
- MBSTRG(search_str) = &MBSTRG(search_str_val);
- } else {
- MAKE_STD_ZVAL(MBSTRG(search_str_val));
- *MBSTRG(search_str_val) = **arg_str;
- zval_copy_ctor(MBSTRG(search_str_val));
- MBSTRG(search_str_val)->refcount = 1;
- MBSTRG(search_str_val)->is_ref = 0;
- MBSTRG(search_str) = &MBSTRG(search_str_val);
- convert_to_string_ex(MBSTRG(search_str));
- }
-
- MBSTRG(search_pos) = 0;
-
- if (MBSTRG(search_regs)) {
- mbre_free_registers(MBSTRG(search_regs));
- efree(MBSTRG(search_regs));
- MBSTRG(search_regs) = (struct mbre_registers*)0;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto array mb_ereg_search_getregs(void)
- Get matched substring of the last time */
-PHP_FUNCTION(mb_ereg_search_getregs)
-{
- int n, i, len, beg, end;
- unsigned char *str;
-
- if (MBSTRG(search_regs) && Z_TYPE_PP(MBSTRG(search_str)) == IS_STRING &&
- Z_STRVAL_PP(MBSTRG(search_str)) && array_init(return_value) != FAILURE) {
- str = (unsigned char *)Z_STRVAL_PP(MBSTRG(search_str));
- len = Z_STRLEN_PP(MBSTRG(search_str));
- n = MBSTRG(search_regs)->num_regs;
- for (i = 0; i < n; i++) {
- beg = MBSTRG(search_regs)->beg[i];
- end = MBSTRG(search_regs)->end[i];
- if (beg >= 0 && beg <= end && end <= len) {
- add_index_stringl(return_value, i, (char *)&str[beg], end - beg, 1);
- } else {
- add_index_bool(return_value, i, 0);
- }
- }
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto int mb_ereg_search_getpos(void)
- Get search start position */
-PHP_FUNCTION(mb_ereg_search_getpos)
-{
- RETVAL_LONG(MBSTRG(search_pos));
-}
-/* }}} */
-
-
-/* {{{ proto bool mb_ereg_search_setpos(int position)
- Set search start position */
-PHP_FUNCTION(mb_ereg_search_setpos)
-{
- zval **arg_pos;
- int n;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_pos) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg_pos);
- n = Z_LVAL_PP(arg_pos);
- if (n < 0
- || ( MBSTRG(search_str) != NULL && *MBSTRG(search_str) != NULL &&
- Z_TYPE_PP(MBSTRG(search_str)) == IS_STRING &&
- n >= Z_STRLEN_PP(MBSTRG(search_str)) ) ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Position is out of range");
- MBSTRG(search_pos) = 0;
- RETVAL_FALSE;
- } else {
- MBSTRG(search_pos) = n;
- RETVAL_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ php_mb_regex_set_options */
-int php_mb_regex_set_options( int options TSRMLS_DC)
-{
- int prev_opt = MBSTRG(regex_default_options);
- MBSTRG(regex_default_options) = options;
- return prev_opt;
-}
-/* }}} */
-
-/* {{{ php_mb_regex_set_options_by_string */
-int php_mb_regex_set_options_by_string( const char *opt_str, int len TSRMLS_DC)
-{
- int new_opt = 0;
- _php_mb_regex_init_options( opt_str, len, &new_opt, NULL);
- return php_mb_regex_set_options( new_opt TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto string mb_regex_set_options([string options])
- Set or get the default options for mbregex functions */
-PHP_FUNCTION(mb_regex_set_options)
-{
- int opt;
- char *string = NULL;
- int string_len;
- char buf[16];
-
- if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "|s",
- &string, &string_len ) == FAILURE ) {
- RETURN_FALSE;
- }
- if (string != NULL) {
- opt = php_mb_regex_set_options_by_string( (const char*)string,
- string_len TSRMLS_CC );
- } else {
- opt = MBSTRG(regex_default_options);
- }
- _php_mb_regex_get_option_string(buf, sizeof(buf), opt);
-
- RETVAL_STRING(buf, 1);
-}
-/* }}} */
-
-#endif /* HAVE_MBREGEX */
diff --git a/ext/mbstring/php_mbregex.h b/ext/mbstring/php_mbregex.h
deleted file mode 100644
index cdc9e0eb63..0000000000
--- a/ext/mbstring/php_mbregex.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Moriyoshi Koizumi <moriyoshi@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _PHP_MBREGEX_H
-#define _PHP_MBREGEX_H
-
-#if HAVE_MBREGEX
-
-#include "php.h"
-#include "zend.h"
-#include "mbregex.h"
-
-/* {{{ PHP_MBREGEX_GLOBALS */
-#define PHP_MBREGEX_GLOBALS \
- int default_mbctype; \
- int current_mbctype; \
- HashTable ht_rc; \
- zval **search_str; \
- zval *search_str_val; \
- unsigned int search_pos; \
- mb_regex_t *search_re; \
- struct mbre_registers *search_regs; \
- int regex_default_options;
-/* }}} */
-
-/* {{{ PHP_MBREGEX_FUNCTION_ENTRIES */
-#define PHP_MBREGEX_FUNCTION_ENTRIES \
- PHP_FE(mb_regex_encoding, NULL) \
- PHP_FE(mb_regex_set_options, NULL) \
- PHP_FE(mb_ereg, (unsigned char *)third_argument_force_ref) \
- PHP_FE(mb_eregi, (unsigned char *)third_argument_force_ref) \
- PHP_FE(mb_ereg_replace, NULL) \
- PHP_FE(mb_eregi_replace, NULL) \
- PHP_FE(mb_split, NULL) \
- PHP_FE(mb_ereg_match, NULL) \
- PHP_FE(mb_ereg_search, NULL) \
- PHP_FE(mb_ereg_search_pos, NULL) \
- PHP_FE(mb_ereg_search_regs, NULL) \
- PHP_FE(mb_ereg_search_init, NULL) \
- PHP_FE(mb_ereg_search_getregs, NULL) \
- PHP_FE(mb_ereg_search_getpos, NULL) \
- PHP_FE(mb_ereg_search_setpos, NULL) \
- PHP_FALIAS(mbregex_encoding, mb_regex_encoding, NULL) \
- PHP_FALIAS(mbereg, mb_ereg, NULL) \
- PHP_FALIAS(mberegi, mb_eregi, NULL) \
- PHP_FALIAS(mbereg_replace, mb_ereg_replace, NULL) \
- PHP_FALIAS(mberegi_replace, mb_eregi_replace, NULL) \
- PHP_FALIAS(mbsplit, mb_split, NULL) \
- PHP_FALIAS(mbereg_match, mb_ereg_match, NULL) \
- PHP_FALIAS(mbereg_search, mb_ereg_search, NULL) \
- PHP_FALIAS(mbereg_search_pos, mb_ereg_search_pos, NULL) \
- PHP_FALIAS(mbereg_search_regs, mb_ereg_search_regs, NULL) \
- PHP_FALIAS(mbereg_search_init, mb_ereg_search_init, NULL) \
- PHP_FALIAS(mbereg_search_getregs, mb_ereg_search_getregs, NULL) \
- PHP_FALIAS(mbereg_search_getpos, mb_ereg_search_getpos, NULL) \
- PHP_FALIAS(mbereg_search_setpos, mb_ereg_search_setpos, NULL)
-/* }}} */
-
-typedef struct _zend_mbstring_globals * zend_mbstring_globals_ptr;
-
-#define PHP_MBREGEX_MAXCACHE 50
-
-int php_mb_regex_name2mbctype(const char *pname);
-int php_mb_regex_set_options(int options TSRMLS_DC);
-int php_mb_regex_set_options_by_string(const char *optstr, int len TSRMLS_DC);
-
-PHP_MINIT_FUNCTION(mb_regex);
-PHP_MSHUTDOWN_FUNCTION(mb_regex);
-PHP_RINIT_FUNCTION(mb_regex);
-PHP_RSHUTDOWN_FUNCTION(mb_regex);
-void _php_mb_regex_globals_ctor(zend_mbstring_globals_ptr pglobals TSRMLS_DC);
-void _php_mb_regex_globals_dtor(zend_mbstring_globals_ptr pglobals TSRMLS_DC);
-
-PHP_FUNCTION(mb_regex_encoding);
-PHP_FUNCTION(mb_ereg);
-PHP_FUNCTION(mb_eregi);
-PHP_FUNCTION(mb_ereg_replace);
-PHP_FUNCTION(mb_eregi_replace);
-PHP_FUNCTION(mb_split);
-PHP_FUNCTION(mb_ereg_match);
-PHP_FUNCTION(mb_ereg_search);
-PHP_FUNCTION(mb_ereg_search_pos);
-PHP_FUNCTION(mb_ereg_search_regs);
-PHP_FUNCTION(mb_ereg_search_init);
-PHP_FUNCTION(mb_ereg_search_getregs);
-PHP_FUNCTION(mb_ereg_search_getpos);
-PHP_FUNCTION(mb_ereg_search_setpos);
-PHP_FUNCTION(mb_regex_set_options);
-
-#endif /* HAVE_MBREGEX */
-
-#endif /* _PHP_MBREGEX_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
-
diff --git a/ext/mbstring/php_unicode.c b/ext/mbstring/php_unicode.c
deleted file mode 100644
index db293010d8..0000000000
--- a/ext/mbstring/php_unicode.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong (wez@thebrainroom.com) |
- +----------------------------------------------------------------------+
-
- Based on code from ucdata-2.5, which has the following Copyright:
-
- Copyright 2001 Computing Research Labs, New Mexico State University
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-
-#if HAVE_MBSTRING
-
-/* include case folding data generated from the official UnicodeData.txt file */
-#include "mbstring.h"
-#include "php_unicode.h"
-#include "unicode_data.h"
-
-/*
- * A simple array of 32-bit masks for lookup.
- */
-static unsigned long masks32[32] = {
- 0x00000001, 0x00000002, 0x00000004, 0x00000008, 0x00000010, 0x00000020,
- 0x00000040, 0x00000080, 0x00000100, 0x00000200, 0x00000400, 0x00000800,
- 0x00001000, 0x00002000, 0x00004000, 0x00008000, 0x00010000, 0x00020000,
- 0x00040000, 0x00080000, 0x00100000, 0x00200000, 0x00400000, 0x00800000,
- 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, 0x20000000,
- 0x40000000, 0x80000000
-};
-
-
-static int prop_lookup(unsigned long code, unsigned long n)
-{
- long l, r, m;
-
- /*
- * There is an extra node on the end of the offsets to allow this routine
- * to work right. If the index is 0xffff, then there are no nodes for the
- * property.
- */
- if ((l = _ucprop_offsets[n]) == 0xffff)
- return 0;
-
- /*
- * Locate the next offset that is not 0xffff. The sentinel at the end of
- * the array is the max index value.
- */
- for (m = 1; n + m < _ucprop_size && _ucprop_offsets[n + m] == 0xffff; m++)
- ;
-
- r = _ucprop_offsets[n + m] - 1;
-
- while (l <= r) {
- /*
- * Determine a "mid" point and adjust to make sure the mid point is at
- * the beginning of a range pair.
- */
- m = (l + r) >> 1;
- m -= (m & 1);
- if (code > _ucprop_ranges[m + 1])
- l = m + 2;
- else if (code < _ucprop_ranges[m])
- r = m - 2;
- else if (code >= _ucprop_ranges[m] && code <= _ucprop_ranges[m + 1])
- return 1;
- }
- return 0;
-
-}
-
-MBSTRING_API int php_unicode_is_prop(unsigned long code, unsigned long mask1,
- unsigned long mask2)
-{
- unsigned long i;
-
- if (mask1 == 0 && mask2 == 0)
- return 0;
-
- for (i = 0; mask1 && i < 32; i++) {
- if ((mask1 & masks32[i]) && prop_lookup(code, i))
- return 1;
- }
-
- for (i = 32; mask2 && i < _ucprop_size; i++) {
- if ((mask2 & masks32[i & 31]) && prop_lookup(code, i))
- return 1;
- }
-
- return 0;
-}
-
-static unsigned long case_lookup(unsigned long code, long l, long r, int field)
-{
- long m;
-
- /*
- * Do the binary search.
- */
- while (l <= r) {
- /*
- * Determine a "mid" point and adjust to make sure the mid point is at
- * the beginning of a case mapping triple.
- */
- m = (l + r) >> 1;
- m -= (m % 3);
- if (code > _uccase_map[m])
- l = m + 3;
- else if (code < _uccase_map[m])
- r = m - 3;
- else if (code == _uccase_map[m])
- return _uccase_map[m + field];
- }
-
- return code;
-}
-
-MBSTRING_API unsigned long php_unicode_toupper(unsigned long code)
-{
- int field;
- long l, r;
-
- if (php_unicode_is_upper(code))
- return code;
-
- if (php_unicode_is_lower(code)) {
- /*
- * The character is lower case.
- */
- field = 2;
- l = _uccase_len[0];
- r = (l + _uccase_len[1]) - 3;
- } else {
- /*
- * The character is title case.
- */
- field = 1;
- l = _uccase_len[0] + _uccase_len[1];
- r = _uccase_size - 3;
- }
- return case_lookup(code, l, r, field);
-}
-
-MBSTRING_API unsigned long php_unicode_tolower(unsigned long code)
-{
- int field;
- long l, r;
-
- if (php_unicode_is_lower(code))
- return code;
-
- if (php_unicode_is_upper(code)) {
- /*
- * The character is upper case.
- */
- field = 1;
- l = 0;
- r = _uccase_len[0] - 3;
- } else {
- /*
- * The character is title case.
- */
- field = 2;
- l = _uccase_len[0] + _uccase_len[1];
- r = _uccase_size - 3;
- }
- return case_lookup(code, l, r, field);
-}
-
-MBSTRING_API unsigned long php_unicode_totitle(unsigned long code)
-{
- int field;
- long l, r;
-
- if (php_unicode_is_title(code))
- return code;
-
- /*
- * The offset will always be the same for converting to title case.
- */
- field = 2;
-
- if (php_unicode_is_upper(code)) {
- /*
- * The character is upper case.
- */
- l = 0;
- r = _uccase_len[0] - 3;
- } else {
- /*
- * The character is lower case.
- */
- l = _uccase_len[0];
- r = (l + _uccase_len[1]) - 3;
- }
- return case_lookup(code, l, r, field);
-
-}
-
-
-#define BE_ARY_TO_UINT32(ptr) (\
- ((unsigned char*)(ptr))[0]<<24 |\
- ((unsigned char*)(ptr))[1]<<16 |\
- ((unsigned char*)(ptr))[2]<< 8 |\
- ((unsigned char*)(ptr))[3] )
-
-#define UINT32_TO_BE_ARY(ptr,val) { \
- unsigned int v = val; \
- ((unsigned char*)(ptr))[0] = (v>>24) & 0xff,\
- ((unsigned char*)(ptr))[1] = (v>>16) & 0xff,\
- ((unsigned char*)(ptr))[2] = (v>> 8) & 0xff,\
- ((unsigned char*)(ptr))[3] = (v ) & 0xff;\
-}
-
-MBSTRING_API char *php_unicode_convert_case(int case_mode, char *srcstr, size_t srclen, size_t *ret_len,
- char *src_encoding TSRMLS_DC)
-{
- char *unicode, *newstr;
- size_t unicode_len;
- unsigned char *unicode_ptr;
- size_t i;
-
- unicode = php_mb_convert_encoding(srcstr, srclen, "UCS-4BE", src_encoding, &unicode_len TSRMLS_CC);
- if (unicode == NULL)
- return NULL;
-
- unicode_ptr = unicode;
-
- switch(case_mode) {
- case PHP_UNICODE_CASE_UPPER:
- for (i = 0; i < unicode_len; i+=4) {
- UINT32_TO_BE_ARY(&unicode_ptr[i],
- php_unicode_toupper(BE_ARY_TO_UINT32(&unicode_ptr[i])));
- }
- break;
-
- case PHP_UNICODE_CASE_LOWER:
- for (i = 0; i < unicode_len; i+=4) {
- UINT32_TO_BE_ARY(&unicode_ptr[i],
- php_unicode_tolower(BE_ARY_TO_UINT32(&unicode_ptr[i])));
- }
- break;
-
- case PHP_UNICODE_CASE_TITLE: {
- int mode = 0;
-
- for (i = 0; i < unicode_len; i+=4) {
- int res = php_unicode_is_prop(
- BE_ARY_TO_UINT32(&unicode_ptr[i]),
- UC_MN|UC_ME|UC_CF|UC_LM|UC_SK|UC_LU|UC_LL|UC_LT, 0);
- if (mode) {
- if (res) {
- UINT32_TO_BE_ARY(&unicode_ptr[i],
- php_unicode_tolower(BE_ARY_TO_UINT32(&unicode_ptr[i])));
- } else {
- mode = 0;
- }
- } else {
- if (res) {
- mode = 1;
- UINT32_TO_BE_ARY(&unicode_ptr[i],
- php_unicode_totitle(BE_ARY_TO_UINT32(&unicode_ptr[i])));
- }
- }
- }
- } break;
-
- }
-
- newstr = php_mb_convert_encoding(unicode, unicode_len, src_encoding, "UCS-4BE", ret_len TSRMLS_CC);
- efree(unicode);
-
- return newstr;
-}
-
-
-#endif /* HAVE_MBSTRING */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/mbstring/php_unicode.h b/ext/mbstring/php_unicode.h
deleted file mode 100644
index bff1d2ebd4..0000000000
--- a/ext/mbstring/php_unicode.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong (wez@thebrainroom.com) |
- +----------------------------------------------------------------------+
-
- Based on code from ucdata-2.5, which has the following Copyright:
-
- Copyright 2001 Computing Research Labs, New Mexico State University
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-*/
-
-#ifndef PHP_UNICODE_H
-#define PHP_UNICODE_H
-
-#if HAVE_MBSTRING
-/*
- * Values that can appear in the `mask1' parameter of the php_unicode_is_prop()
- * function.
- */
-#define UC_MN 0x00000001 /* Mark, Non-Spacing */
-#define UC_MC 0x00000002 /* Mark, Spacing Combining */
-#define UC_ME 0x00000004 /* Mark, Enclosing */
-#define UC_ND 0x00000008 /* Number, Decimal Digit */
-#define UC_NL 0x00000010 /* Number, Letter */
-#define UC_NO 0x00000020 /* Number, Other */
-#define UC_ZS 0x00000040 /* Separator, Space */
-#define UC_ZL 0x00000080 /* Separator, Line */
-#define UC_ZP 0x00000100 /* Separator, Paragraph */
-#define UC_CC 0x00000200 /* Other, Control */
-#define UC_CF 0x00000400 /* Other, Format */
-#define UC_OS 0x00000800 /* Other, Surrogate */
-#define UC_CO 0x00001000 /* Other, Private Use */
-#define UC_CN 0x00002000 /* Other, Not Assigned */
-#define UC_LU 0x00004000 /* Letter, Uppercase */
-#define UC_LL 0x00008000 /* Letter, Lowercase */
-#define UC_LT 0x00010000 /* Letter, Titlecase */
-#define UC_LM 0x00020000 /* Letter, Modifier */
-#define UC_LO 0x00040000 /* Letter, Other */
-#define UC_PC 0x00080000 /* Punctuation, Connector */
-#define UC_PD 0x00100000 /* Punctuation, Dash */
-#define UC_PS 0x00200000 /* Punctuation, Open */
-#define UC_PE 0x00400000 /* Punctuation, Close */
-#define UC_PO 0x00800000 /* Punctuation, Other */
-#define UC_SM 0x01000000 /* Symbol, Math */
-#define UC_SC 0x02000000 /* Symbol, Currency */
-#define UC_SK 0x04000000 /* Symbol, Modifier */
-#define UC_SO 0x08000000 /* Symbol, Other */
-#define UC_L 0x10000000 /* Left-To-Right */
-#define UC_R 0x20000000 /* Right-To-Left */
-#define UC_EN 0x40000000 /* European Number */
-#define UC_ES 0x80000000 /* European Number Separator */
-
-/*
- * Values that can appear in the `mask2' parameter of the php_unicode_is_prop()
- * function.
- */
-#define UC_ET 0x00000001 /* European Number Terminator */
-#define UC_AN 0x00000002 /* Arabic Number */
-#define UC_CS 0x00000004 /* Common Number Separator */
-#define UC_B 0x00000008 /* Block Separator */
-#define UC_S 0x00000010 /* Segment Separator */
-#define UC_WS 0x00000020 /* Whitespace */
-#define UC_ON 0x00000040 /* Other Neutrals */
-/*
- * Implementation specific character properties.
- */
-#define UC_CM 0x00000080 /* Composite */
-#define UC_NB 0x00000100 /* Non-Breaking */
-#define UC_SY 0x00000200 /* Symmetric */
-#define UC_HD 0x00000400 /* Hex Digit */
-#define UC_QM 0x00000800 /* Quote Mark */
-#define UC_MR 0x00001000 /* Mirroring */
-#define UC_SS 0x00002000 /* Space, other */
-
-#define UC_CP 0x00004000 /* Defined */
-
-/*
- * Added for UnicodeData-2.1.3.
- */
-#define UC_PI 0x00008000 /* Punctuation, Initial */
-#define UC_PF 0x00010000 /* Punctuation, Final */
-
-MBSTRING_API int php_unicode_is_prop(unsigned long code, unsigned long mask1,
- unsigned long mask2);
-MBSTRING_API char *php_unicode_convert_case(int case_mode, char *srcstr, size_t srclen, size_t *retlen,
- char *src_encoding TSRMLS_DC);
-
-#define PHP_UNICODE_CASE_UPPER 0
-#define PHP_UNICODE_CASE_LOWER 1
-#define PHP_UNICODE_CASE_TITLE 2
-
-#define php_unicode_is_alpha(cc) php_unicode_is_prop(cc, UC_LU|UC_LL|UC_LM|UC_LO|UC_LT, 0)
-#define php_unicode_is_digit(cc) php_unicode_is_prop(cc, UC_ND, 0)
-#define php_unicode_is_alnum(cc) php_unicode_is_prop(cc, UC_LU|UC_LL|UC_LM|UC_LO|UC_LT|UC_ND, 0)
-#define php_unicode_is_cntrl(cc) php_unicode_is_prop(cc, UC_CC|UC_CF, 0)
-#define php_unicode_is_space(cc) php_unicode_is_prop(cc, UC_ZS|UC_SS, 0)
-#define php_unicode_is_blank(cc) php_unicode_is_prop(cc, UC_ZS, 0)
-#define php_unicode_is_punct(cc) php_unicode_is_prop(cc, UC_PD|UC_PS|UC_PE|UC_PO, UC_PI|UC_PF)
-#define php_unicode_is_graph(cc) php_unicode_is_prop(cc, UC_MN|UC_MC|UC_ME|UC_ND|UC_NL|UC_NO|\
- UC_LU|UC_LL|UC_LT|UC_LM|UC_LO|UC_PC|UC_PD|\
- UC_PS|UC_PE|UC_PO|UC_SM|UC_SM|UC_SC|UC_SK|\
- UC_SO, UC_PI|UC_PF)
-#define php_unicode_is_print(cc) php_unicode_is_prop(cc, UC_MN|UC_MC|UC_ME|UC_ND|UC_NL|UC_NO|\
- UC_LU|UC_LL|UC_LT|UC_LM|UC_LO|UC_PC|UC_PD|\
- UC_PS|UC_PE|UC_PO|UC_SM|UC_SM|UC_SC|UC_SK|\
- UC_SO|UC_ZS, UC_PI|UC_PF)
-#define php_unicode_is_upper(cc) php_unicode_is_prop(cc, UC_LU, 0)
-#define php_unicode_is_lower(cc) php_unicode_is_prop(cc, UC_LL, 0)
-#define php_unicode_is_title(cc) php_unicode_is_prop(cc, UC_LT, 0)
-#define php_unicode_is_xdigit(cc) php_unicode_is_prop(cc, 0, UC_HD)
-
-#define php_unicode_is_isocntrl(cc) php_unicode_is_prop(cc, UC_CC, 0)
-#define php_unicode_is_fmtcntrl(cc) php_unicode_is_prop(cc, UC_CF, 0)
-
-#define php_unicode_is_symbol(cc) php_unicode_is_prop(cc, UC_SM|UC_SC|UC_SO|UC_SK, 0)
-#define php_unicode_is_number(cc) php_unicode_is_prop(cc, UC_ND|UC_NO|UC_NL, 0)
-#define php_unicode_is_nonspacing(cc) php_unicode_is_prop(cc, UC_MN, 0)
-#define php_unicode_is_openpunct(cc) php_unicode_is_prop(cc, UC_PS, 0)
-#define php_unicode_is_closepunct(cc) php_unicode_is_prop(cc, UC_PE, 0)
-#define php_unicode_is_initialpunct(cc) php_unicode_is_prop(cc, 0, UC_PI)
-#define php_unicode_is_finalpunct(cc) php_unicode_is_prop(cc, 0, UC_PF)
-
-#define php_unicode_is_composite(cc) php_unicode_is_prop(cc, 0, UC_CM)
-#define php_unicode_is_hex(cc) php_unicode_is_prop(cc, 0, UC_HD)
-#define php_unicode_is_quote(cc) php_unicode_is_prop(cc, 0, UC_QM)
-#define php_unicode_is_symmetric(cc) php_unicode_is_prop(cc, 0, UC_SY)
-#define php_unicode_is_mirroring(cc) php_unicode_is_prop(cc, 0, UC_MR)
-#define php_unicode_is_nonbreaking(cc) php_unicode_is_prop(cc, 0, UC_NB)
-
-/*
- * Directionality macros.
- */
-#define php_unicode_is_rtl(cc) php_unicode_is_prop(cc, UC_R, 0)
-#define php_unicode_is_ltr(cc) php_unicode_is_prop(cc, UC_L, 0)
-#define php_unicode_is_strong(cc) php_unicode_is_prop(cc, UC_L|UC_R, 0)
-#define php_unicode_is_weak(cc) php_unicode_is_prop(cc, UC_EN|UC_ES, UC_ET|UC_AN|UC_CS)
-#define php_unicode_is_neutral(cc) php_unicode_is_prop(cc, 0, UC_B|UC_S|UC_WS|UC_ON)
-#define php_unicode_is_separator(cc) php_unicode_is_prop(cc, 0, UC_B|UC_S)
-
-/*
- * Other macros inspired by John Cowan.
- */
-#define php_unicode_is_mark(cc) php_unicode_is_prop(cc, UC_MN|UC_MC|UC_ME, 0)
-#define php_unicode_is_modif(cc) php_unicode_is_prop(cc, UC_LM, 0)
-#define php_unicode_is_letnum(cc) php_unicode_is_prop(cc, UC_NL, 0)
-#define php_unicode_is_connect(cc) php_unicode_is_prop(cc, UC_PC, 0)
-#define php_unicode_is_dash(cc) php_unicode_is_prop(cc, UC_PD, 0)
-#define php_unicode_is_math(cc) php_unicode_is_prop(cc, UC_SM, 0)
-#define php_unicode_is_currency(cc) php_unicode_is_prop(cc, UC_SC, 0)
-#define php_unicode_is_modifsymbol(cc) php_unicode_is_prop(cc, UC_SK, 0)
-#define php_unicode_is_nsmark(cc) php_unicode_is_prop(cc, UC_MN, 0)
-#define php_unicode_is_spmark(cc) php_unicode_is_prop(cc, UC_MC, 0)
-#define php_unicode_is_enclosing(cc) php_unicode_is_prop(cc, UC_ME, 0)
-#define php_unicode_is_private(cc) php_unicode_is_prop(cc, UC_CO, 0)
-#define php_unicode_is_surrogate(cc) php_unicode_is_prop(cc, UC_OS, 0)
-#define php_unicode_is_lsep(cc) php_unicode_is_prop(cc, UC_ZL, 0)
-#define php_unicode_is_psep(cc) php_unicode_is_prop(cc, UC_ZP, 0)
-
-#define php_unicode_is_identstart(cc) php_unicode_is_prop(cc, UC_LU|UC_LL|UC_LT|UC_LO|UC_NL, 0)
-#define php_unicode_is_identpart(cc) php_unicode_is_prop(cc, UC_LU|UC_LL|UC_LT|UC_LO|UC_NL|\
- UC_MN|UC_MC|UC_ND|UC_PC|UC_CF, 0)
-
-#define php_unicode_is_defined(cc) php_unicode_is_prop(cc, 0, UC_CP)
-#define php_unicode_is_undefined(cc) !php_unicode_is_prop(cc, 0, UC_CP)
-
-/*
- * Other miscellaneous character property macros.
- */
-#define php_unicode_is_han(cc) (((cc) >= 0x4e00 && (cc) <= 0x9fff) ||\
- ((cc) >= 0xf900 && (cc) <= 0xfaff))
-#define php_unicode_is_hangul(cc) ((cc) >= 0xac00 && (cc) <= 0xd7ff)
-
-
-#endif
-
-
-#endif /* PHP_UNICODE_H */
-
-
-
diff --git a/ext/mbstring/tests/bug20087.phpt b/ext/mbstring/tests/bug20087.phpt
deleted file mode 100644
index efae733ca2..0000000000
--- a/ext/mbstring/tests/bug20087.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Bug #20087 (Assertion failure)
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-ini_set('include_path','.');
-include_once('common.inc');
-$testmoo = "blah blah";
-var_dump(mb_parse_str("testmoo"));
-var_dump($testmoo);
-var_dump(mb_parse_str("test=moo"));
-var_dump($test);
-?>
---EXPECT--
-bool(true)
-string(0) ""
-bool(true)
-string(3) "moo"
-
diff --git a/ext/mbstring/tests/casefold.phpt b/ext/mbstring/tests/casefold.phpt
deleted file mode 100644
index 977b0bb658..0000000000
--- a/ext/mbstring/tests/casefold.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-mb_strtoupper() / mb_strtolower()
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip mbstring not available');
-function_exists('mb_strtolower') and
-function_exists('mb_convert_case' ) or die("skip mb_convert_case() is not available");
-?>
---INI--
-output_handler=
---FILE--
-<?php
- mb_internal_encoding( 'ISO-8859-1' );
- print mb_strtolower( "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" );
- print mb_strtoupper( mb_strtolower( "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" ) );
- print mb_strtoupper( "äëï\n" );
- print mb_convert_case( "äëï\n", MB_CASE_TITLE );
-?>
-
---EXPECT--
-abcdefghijklmnopqrstuvwxyz
-ABCDEFGHIJKLMNOPQRSTUVWXYZ
-ÄËÏ
-Äëï
diff --git a/ext/mbstring/tests/common.inc b/ext/mbstring/tests/common.inc
deleted file mode 100644
index d4d1d9a495..0000000000
--- a/ext/mbstring/tests/common.inc
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/*
- * Common definition and Settings
- */
-
-// Custom Error Hanlder for testing
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- global $debug;
-
- $err_type = array (
- 1 => "Error", // E_ERROR
- 2 => "Warning", // E_WARINING
- 4 => "Parsing Error", // E_PARSE
- 8 => "Notice", // E_NOTICE
- 16 => "Core Error", // E_CORE_ERROR
- 32 => "Core Warning", // E_CORE_WARNING
- 64 => "Compile Error", // E_COMPILE_ERROR
- 128 => "Compile Warning", // E_COMPILE_WARNING
- 256 => "User Error", // E_USER_ERROR
- 512 => "User Warning", // E_USER_WARMING
- 1024=> "User Notice" // E_USER_NOTICE
- );
-
- if (!empty($debug)) {
- printf("%s: %s (%d)\n", $err_type[$err_no], $err_msg, $linenum);
- }
- else {
- printf("ERR: %s\n",$err_type[$err_no]);
- }
-}
-
-set_error_handler('test_error_handler');
-
-
-// Var def for testing
-$t_ary = array(
- 's1' => 'ÆüËܸìEUC-JP¤Îʸ»úÎó',
- 's2' => 'English Text'
- );
-
-class tc
-{
- var $s1 = 'ÆüËܸìEUC-JP¤Îʸ»úÎó';
- var $s2 = 'English Text';
-
- function tc()
- {
- }
-}
-
-$t_obj = new tc;
-
-?> \ No newline at end of file
diff --git a/ext/mbstring/tests/htmlent.phpt b/ext/mbstring/tests/htmlent.phpt
deleted file mode 100644
index ca7d64ba41..0000000000
--- a/ext/mbstring/tests/htmlent.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-HTML input/output
---SKIPIF--
-<?php
- ini_set('include_path','.');
- extension_loaded('mbstring') or die('skip mbstring not available');
-?>
---INI--
-output_handler=mb_output_handler
-zlib.output_compression=
-arg_separator.input="x"
-error_reporting=0
-mbstring.http_input=HTML-ENTITIES
-mbstring.internal_encoding=UTF8
-mbstring.http_output=HTML-ENTITIES
-mbstring.encoding_translation=1
---FILE--
-<?php
-// enable output encoding through output handler
-ob_start("mb_output_handler");
-// &#64... are must be decoded on input these are not reencoded on output.
-// If you see &#64;&#65;&#66; on output this means input encoding fails.
-// If you do not see &auml;... on output this means output encoding fails.
-// Using UTF-8 internally allows to encode/decode ALL characters.
-// &128... will stay as they are since their character codes are above 127
-// and they do not have a named entity representaion.
-?>
-<?php echo mb_http_input('l').'>'.mb_internal_encoding().'>'.mb_http_output();?>
-
-<?php mb_parse_str("test=&&;&&#64;&#65;&#66;&#128;&#129;&#130;&auml;&ouml;&uuml;&euro;&lang;&rang;");
-echo "test='$test'";
-?>
---EXPECT--
-HTML-ENTITIES>UTF-8>HTML-ENTITIES
-test='&&;&@AB&#128;&#129;&#130;&auml;&ouml;&uuml;&euro;&lang;&rang;' \ No newline at end of file
diff --git a/ext/mbstring/tests/ini_language.phpt b/ext/mbstring/tests/ini_language.phpt
deleted file mode 100644
index a8b42c78e7..0000000000
--- a/ext/mbstring/tests/ini_language.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-mbstring.language bug
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-mbstring.internal_encoding=Shift_JIS
-mbstring.language=Japanese
---FILE--
-<?php
-var_dump(ini_get('mbstring.internal_encoding'));
-var_dump(mb_internal_encoding());
-?>
---EXPECT--
-string(6) "EUC-JP"
-string(6) "EUC-JP"
diff --git a/ext/mbstring/tests/mb_convert_encoding.phpt b/ext/mbstring/tests/mb_convert_encoding.phpt
deleted file mode 100644
index 774563683e..0000000000
--- a/ext/mbstring/tests/mb_convert_encoding.phpt
+++ /dev/null
@@ -1,137 +0,0 @@
---TEST--
-mb_convert_encoding()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-output_handler=
---FILE--
-<?php
-// TODO: Add more tests
-//$debug = true; // Uncomment this line to view error/warning/notice message in *.out file
-ini_set('include_path','.');
-include_once('common.inc');
-
-// SJIS string (BASE64 encoded)
-$sjis = base64_decode('k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg==');
-// JIS string (BASE64 encoded)
-$jis = base64_decode('GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg==');
-// EUC-JP string
-$euc_jp = 'ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£';
-
-// Test with sigle "form encoding"
-// Note: For some reason it complains, results are differ. Not reserched.
-echo "== BASIC TEST ==\n";
-$s = $sjis;
-$s = mb_convert_encoding($s, 'EUC-JP', 'SJIS');
-print("EUC-JP: $s\n"); // EUC-JP
-
-$s = $jis;
-$s = mb_convert_encoding($s, 'EUC-JP', 'JIS');
-print("EUC-JP: $s\n"); // EUC-JP
-
-$s = $euc_jp;
-$s = mb_convert_encoding($s, 'SJIS', 'EUC-JP');
-print("SJIS: ".base64_encode($s)."\n"); // SJIS
-
-$s = $euc_jp;
-$s = mb_convert_encoding($s, 'JIS', 'EUC-JP');
-print("JIS: ".base64_encode($s)."\n"); // JIS
-
-
-// Using Encoding List Array
-echo "== STRING ENCODING LIST ==\n";
-
-$a = 'JIS,UTF-8,EUC-JP,SJIS';
-$s = $jis;
-$s = mb_convert_encoding($s, 'EUC-JP', $a);
-print("EUC-JP: $s\n"); // EUC-JP
-
-$s = $euc_jp;
-$s = mb_convert_encoding($s, 'SJIS', $a);
-print("SJIS: ".base64_encode($s)."\n"); // SJIS
-
-$s = $euc_jp;
-$s = mb_convert_encoding($s, 'JIS', $a);
-print("JIS: ".base64_encode($s)."\n"); // JIS
-
-
-// Using Encoding List Array
-echo "== ARRAY ENCODING LIST ==\n";
-
-$a = array(0=>'JIS', 1=>'UTF-8', 2=>'EUC-JP', 3=>'SJIS');
-$s = $jis;
-$s = mb_convert_encoding($s, 'EUC-JP', $a);
-print("EUC-JP: $s\n"); // EUC-JP
-
-$s = $euc_jp;
-$s = mb_convert_encoding($s, 'SJIS', $a);
-print("SJIS: ".base64_encode($s)."\n"); // SJIS
-
-$s = $euc_jp;
-$s = mb_convert_encoding($s, 'JIS', $a);
-print("JIS: ".base64_encode($s)."\n"); // JIS
-
-
-// Using Detect Order
-echo "== DETECT ORDER ==\n";
-
-$s = $jis;
-$s = mb_convert_encoding($s, 'EUC-JP', 'auto');
-print("EUC-JP: $s\n"); // EUC-JP
-
-$s = $euc_jp;
-$s = mb_convert_encoding($s, 'SJIS', 'auto');
-print("SJIS: ".base64_encode($s)."\n"); // SJIS
-
-$s = $euc_jp;
-$s = mb_convert_encoding($s, 'JIS', 'auto');
-print("JIS: ".base64_encode($s)."\n"); // JIS
-
-
-// Invalid(?) Parameters
-echo "== INVALID PARAMETER ==\n";
-
-$s = mb_convert_encoding(1234, 'EUC-JP');
-print("INT: $s\n"); // EUC-JP
-
-$s = mb_convert_encoding('', 'EUC-JP');
-print("EUC-JP: $s\n"); // SJIS
-
-$s = $euc_jp;
-$s = mb_convert_encoding($s, 'BAD');
-print("BAD: $s\n"); // BAD
-
-$s = $euc_jp;
-$s = mb_convert_encoding($s);
-print("MP: $s\n"); // Missing parameter
-
-
-?>
-
---EXPECT--
-== BASIC TEST ==
-EUC-JP: ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£
-EUC-JP: ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£
-SJIS: k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg==
-JIS: GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg==
-== STRING ENCODING LIST ==
-EUC-JP: ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£
-SJIS: k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg==
-JIS: GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg==
-== ARRAY ENCODING LIST ==
-EUC-JP: ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£
-SJIS: k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg==
-JIS: GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg==
-== DETECT ORDER ==
-EUC-JP: ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£
-SJIS: k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg==
-JIS: GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg==
-== INVALID PARAMETER ==
-INT: 1234
-EUC-JP:
-ERR: Warning
-BAD:
-ERR: Warning
-MP:
-
-
diff --git a/ext/mbstring/tests/mb_convert_variables.phpt b/ext/mbstring/tests/mb_convert_variables.phpt
deleted file mode 100644
index 86ffc8a994..0000000000
--- a/ext/mbstring/tests/mb_convert_variables.phpt
+++ /dev/null
@@ -1,163 +0,0 @@
---TEST--
-mb_convert_variables()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-output_handler=
---FILE--
-<?php
-// TODO: Add more tests
-//$debug = true; // Uncomment this line to view error/warning/notice message in *.out file
-ini_set('include_path','.');
-include_once('common.inc');
-
-// SJIS string (BASE64 encoded)
-$sjis = base64_decode('k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg==');
-// JIS string (BASE64 encoded)
-$jis = base64_decode('GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg==');
-// EUC-JP string
-$euc_jp = 'ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£';
-
-// Test for single scaler
-echo "== SCALER TEST ==\n";
-$s = $sjis;
-$encoding = mb_convert_variables('EUC-JP', 'SJIS', $s);
-print("$encoding\n"); // SJIS
-print("$s\n"); // Converted to EUC-JP
-
-$s = $jis;
-$encoding = mb_convert_variables('EUC-JP', 'JIS', $s);
-print("$encoding\n"); // JIS
-print("$s\n"); // Converted to EUC-JP
-
-$s = $euc_jp;
-$encoding = mb_convert_variables('SJIS', 'EUC-JP', $s);
-print("$encoding\n"); // EUC-JP
-print(base64_encode($s)."\n"); // Converted to SJIS (base64 encoded)
-
-$s = $euc_jp;
-$encoding = mb_convert_variables('JIS', 'EUC-JP', $s);
-print("$encoding\n"); // EUC-JP
-print(base64_encode($s)."\n"); // Converted to JIS (base64 encoded)
-
-// Test for multiple slcaler
-$s1 = $euc_jp;
-$s2 = $euc_jp;
-$s3 = $euc_jp;
-$encoding = mb_convert_variables('EUC-JP', 'auto', $s1, $s2, $s3);
-print("$encoding\n"); // EUC-JP
-print("$s1$s2$s3\n"); // Converted to EUC-JP
-
-
-
-// Note: Mixing encoding in array/object is not supported?
-// Test for array
-echo "== ARRAY TEST ==\n";
-$a = array($s3, $s2, $s1);
-$aa = $a;
-$encoding = mb_convert_variables('EUC-JP', 'auto', $aa);
-print("$encoding\n"); // EUC-JP
-print("{$aa[0]}{$aa[1]}{$aa[2]}\n"); // Converted to EUC-JP
-
-$a = array($s1, $s2, $s3);
-$aa = $a;
-$encoding = mb_convert_variables('EUC-JP', 'auto', $aa);
-print("$encoding\n"); // EUC-JP
-print("{$aa[0]}{$aa[1]}{$aa[2]}\n"); // Converted to EUC-JP
-
-
-
-// Test for object
-echo "== OBJECT TEST ==\n";
-class foo
-{
- var $s1;
- var $s2;
- var $s3;
-
- function foo()
- {
- global $sjis, $jis, $euc_jp;
-
- $this->s1 = $euc_jp;
- $this->s2 = $euc_jp;
- $this->s3 = $euc_jp;
- }
-}
-
-class bar
-{
- var $s1;
- var $s2;
- var $s3;
-
- function bar()
- {
- global $sjis, $jis, $euc_jp;
-
- $this->s1 = $euc_jp;
- $this->s2 = $euc_jp;
- $this->s3 = $euc_jp;
- }
-}
-
-
-$o = new foo;
-$oo = $o;
-$encoding = mb_convert_variables('EUC-JP', 'auto', $oo);
-print("$encoding\n"); // EUC-JP
-print("{$oo->s1}{$oo->s2}{$oo->s3}\n"); // Converted to EUC-JP
-
-$o = new bar;
-$oo = $o;
-$encoding = mb_convert_variables('EUC-JP', 'auto', $oo);
-print("$encoding\n"); // EUC-JP
-print("{$oo->s1}{$oo->s2}{$oo->s3}\n"); // Converted to EUC-JP
-
-
-// Test for scaler, array and object
-echo "== SCALER, ARRAY AND OBJECT TEST ==\n";
-
-$s1 = $euc_jp;
-$s2 = $euc_jp;
-$s3 = $euc_jp;
-$aa = $a;
-$oo = $o;
-
-$encoding = mb_convert_variables('EUC-JP', 'auto', $s1, $s2, $s3, $aa, $oo);
-print("$encoding\n"); // EUC-JP
-print("$s1$s2$s3\n"); // Converted to EUC-JP
-print("{$aa[0]}{$aa[1]}{$aa[2]}\n"); // Converted to EUC-JP
-print("{$oo->s1}{$oo->s2}{$oo->s3}\n"); // Converted to EUC-JP
-
-
-?>
-
---EXPECT--
-== SCALER TEST ==
-SJIS
-ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£
-JIS
-ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£
-EUC-JP
-k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg==
-EUC-JP
-GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg==
-EUC-JP
-ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£
-== ARRAY TEST ==
-EUC-JP
-ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£
-EUC-JP
-ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£
-== OBJECT TEST ==
-EUC-JP
-ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£
-EUC-JP
-ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£
-== SCALER, ARRAY AND OBJECT TEST ==
-EUC-JP
-ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£
-ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£
-ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£
-
diff --git a/ext/mbstring/tests/mb_detect_encoding.phpt b/ext/mbstring/tests/mb_detect_encoding.phpt
deleted file mode 100644
index 5031f6fb8f..0000000000
--- a/ext/mbstring/tests/mb_detect_encoding.phpt
+++ /dev/null
@@ -1,119 +0,0 @@
---TEST--
-mb_detect_encoding()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-// TODO: Add more tests
-//$debug = true; // Uncomment this line to view error/warning/notice message in *.out file
-ini_set('include_path','.');
-include_once('common.inc');
-
-// SJIS string (BASE64 encoded)
-$sjis = base64_decode('k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg==');
-// JIS string (BASE64 encoded)
-$jis = base64_decode('GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg==');
-// EUC-JP string
-$euc_jp = 'ÆüËܸì¥Æ¥­¥¹¥È¤Ç¤¹¡£01234£µ£¶£·£¸£¹¡£';
-
-// Test with sigle "form encoding"
-// Note: For some reason it complains, results are differ. Not reserched.
-echo "== BASIC TEST ==\n";
-$s = $sjis;
-$s = mb_detect_encoding($s, 'SJIS');
-print("SJIS: $s\n");
-
-$s = $jis;
-$s = mb_detect_encoding($s, 'JIS');
-print("JIS: $s\n");
-
-$s = $euc_jp;
-$s = mb_detect_encoding($s, 'UTF-8,EUC-JP,JIS');
-print("EUC-JP: $s\n");
-
-$s = $euc_jp;
-$s = mb_detect_encoding($s, 'JIS,EUC-JP');
-print("EUC-JP: $s\n");
-
-
-
-// Using Encoding List Array
-echo "== ARRAY ENCODING LIST ==\n";
-
-$a = array(0=>'UTF-8',1=>'EUC-JP', 2=>'SJIS', 3=>'JIS');
-
-// Note: Due to detect order, detected as UTF-8
-$s = $jis;
-$s = mb_detect_encoding($s, $a);
-print("JIS: $s\n");
-
-$s = $euc_jp;
-$s = mb_detect_encoding($s, $a);
-print("EUC-JP: $s\n");
-
-$s = $sjis;
-$s = mb_detect_encoding($s, $a);
-print("SJIS: $s\n");
-
-
-// Using Detect Order
-echo "== DETECT ORDER ==\n";
-
-mb_detect_order('auto');
-
-
-$s = $jis;
-$s = mb_detect_encoding($s);
-print("JIS: $s\n");
-
-$s = $euc_jp;
-$s = mb_detect_encoding($s);
-print("EUC-JP: $s\n");
-
-$s = $sjis;
-$s = mb_detect_encoding($s);
-print("SJIS: $s\n");
-
-
-// Invalid(?) Parameters
-echo "== INVALID PARAMETER ==\n";
-
-$s = mb_detect_encoding(1234, 'EUC-JP');
-print("INT: $s\n"); // EUC-JP
-
-$s = mb_detect_encoding('', 'EUC-JP');
-print("EUC-JP: $s\n"); // SJIS
-
-$s = $euc_jp;
-$s = mb_detect_encoding($s, 'BAD');
-print("BAD: $s\n"); // BAD
-
-$s = $euc_jp;
-$s = mb_detect_encoding();
-print("MP: $s\n"); // Missing parameter
-
-
-?>
-
---EXPECT--
-== BASIC TEST ==
-SJIS: SJIS
-JIS: JIS
-EUC-JP: EUC-JP
-EUC-JP: EUC-JP
-== ARRAY ENCODING LIST ==
-JIS: UTF-8
-EUC-JP: EUC-JP
-SJIS: SJIS
-== DETECT ORDER ==
-JIS: JIS
-EUC-JP: EUC-JP
-SJIS: SJIS
-== INVALID PARAMETER ==
-INT: EUC-JP
-EUC-JP: EUC-JP
-ERR: Warning
-BAD: EUC-JP
-ERR: Warning
-MP:
-
diff --git a/ext/mbstring/tests/mb_detect_order.phpt b/ext/mbstring/tests/mb_detect_order.phpt
deleted file mode 100644
index 3a76b4d0ed..0000000000
--- a/ext/mbstring/tests/mb_detect_order.phpt
+++ /dev/null
@@ -1,59 +0,0 @@
---TEST--
-mb_detect_order()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-//$debug = true;
-ini_set('include_path','.');
-include_once('common.inc');
-
-
-// Set order to "auto"
-$r = mb_detect_order('auto');
-($r === TRUE) ? print "OK_AUTO\n" : print "NG_AUTO\n";
-print implode(', ', mb_detect_order()) . "\n";
-
-
-// Set order by string
-$r = mb_detect_order('SJIS,EUC-JP,JIS,UTF-8');
-($r === TRUE) ? print "OK_STR\n" : print "NG_STR\n";
-print implode(', ', mb_detect_order()) . "\n";
-
-
-// Set order by array
-$a[] = 'ASCII';
-$a[] = 'JIS';
-$a[] = 'EUC-JP';
-$a[] = 'UTF-8';
-$r = mb_detect_order($a);
-($r === TRUE) ? print "OK_ARRAY\n" : print "NG_ARRAY\n";
-print implode(', ', mb_detect_order()) . "\n";
-
-// Set invalid encoding. Should fail.
-print "== INVALID PARAMETER ==\n";
-
-$r = mb_detect_order('BAD_NAME');
-($r === FALSE) ? print "OK_BAD_STR\n" : print "NG_BAD_STR\n";
-print implode(', ', mb_detect_order()) . "\n";
-
-$a[] = 'BAD_NAME';
-$r = mb_detect_order($a);
-($r === FALSE) ? print "OK_BAD_ARRAY\n" : print "NG_BAD_ARRAY\n";
-print implode(', ', mb_detect_order()) . "\n";
-
-?>
-
---EXPECT--
-OK_AUTO
-ASCII, JIS, UTF-8, EUC-JP, SJIS
-OK_STR
-SJIS, EUC-JP, JIS, UTF-8
-OK_ARRAY
-ASCII, JIS, EUC-JP, UTF-8
-== INVALID PARAMETER ==
-OK_BAD_STR
-ASCII, JIS, EUC-JP, UTF-8
-OK_BAD_ARRAY
-ASCII, JIS, EUC-JP, UTF-8
-
diff --git a/ext/mbstring/tests/mb_ereg-compat-01.phpt b/ext/mbstring/tests/mb_ereg-compat-01.phpt
deleted file mode 100644
index 09376780ed..0000000000
--- a/ext/mbstring/tests/mb_ereg-compat-01.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-mb_ereg() compat test 1
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/004.phpt) */
- $a="This is a nice and simple string";
- if (mb_ereg(".*nice and simple.*",$a)) {
- echo "ok\n";
- }
- if (!mb_ereg(".*doesn't exist.*",$a)) {
- echo "ok\n";
- }
-?>
---EXPECT--
-ok
-ok
diff --git a/ext/mbstring/tests/mb_ereg-compat-02.phpt b/ext/mbstring/tests/mb_ereg-compat-02.phpt
deleted file mode 100644
index 2f40422543..0000000000
--- a/ext/mbstring/tests/mb_ereg-compat-02.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-mb_ereg() compat test 2
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/005.phpt) */
- $a="This is a nice and simple string";
- echo mb_ereg(".*(is).*(is).*",$a,$registers);
- echo "\n";
- echo $registers[0];
- echo "\n";
- echo $registers[1];
- echo "\n";
- echo $registers[2];
- echo "\n";
-?>
---EXPECT--
-32
-This is a nice and simple string
-is
-is
diff --git a/ext/mbstring/tests/mb_ereg.phpt b/ext/mbstring/tests/mb_ereg.phpt
deleted file mode 100644
index d069b2593d..0000000000
--- a/ext/mbstring/tests/mb_ereg.phpt
+++ /dev/null
@@ -1,47 +0,0 @@
---TEST--
-mb_ereg()
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip mbstring not available');
-function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
-?>
---INI--
-output_handler=
---FILE--
-<?php
- mb_regex_set_options( '' );
-
- $encs = array( 'EUC-JP', 'Shift_JIS', 'SJIS', 'UTF-8' );
-
- function test_ereg( $test_enc, $pat, $str, $in_enc = 'EUC-JP' ) {
- mb_regex_encoding( $test_enc );
- $pat = mb_convert_encoding( $pat, $test_enc, $in_enc );
- $str = mb_convert_encoding( $str, $test_enc, $in_enc );
-
- printf( "(%d)%s\n", mb_ereg( $pat, $str, $reg ), ( is_array( $reg )? mb_convert_encoding( implode( ' ', $reg ), $in_enc, $test_enc ) : '' ) );
- }
- function do_tests( $enc ) {
- test_ereg( $enc, 'abc ([a-z]+) ([a-z]+) ([a-z]+)$', "abc def ghi jkl" );
- $pat = '([£á-£ú]+) ([ ¤¢-¤«]+)([¤«-¤Ê]+) ([¤ï-¤ó]+)$';
- test_ereg( $enc, $pat, '£á£â£ã ¤¢¤ª¤¤ ¤«¤³¤Ê ¤ï¤ñ¤ó' );
- test_ereg( $enc, $pat, '£í£ú£ø£æ£ð ¤¦¤ª¤« ¤­¤« ¤ò¤ð' );
- }
-
- foreach( $encs as $enc ) {
- do_tests( $enc );
- }
-?>
-
---EXPECT--
-(15)abc def ghi jkl def ghi jkl
-(27)£á£â£ã ¤¢¤ª¤¤ ¤«¤³¤Ê ¤ï¤ñ¤ó £á£â£ã ¤¢¤ª¤¤ ¤« ¤³¤Ê ¤ï¤ñ¤ó
-(27)£í£ú£ø£æ£ð ¤¦¤ª¤« ¤­¤« ¤ò¤ð £í£ú£ø£æ£ð ¤¦¤ª¤« ¤­¤« ¤ò¤ð
-(15)abc def ghi jkl def ghi jkl
-(27)£á£â£ã ¤¢¤ª¤¤ ¤«¤³¤Ê ¤ï¤ñ¤ó £á£â£ã ¤¢¤ª¤¤ ¤« ¤³¤Ê ¤ï¤ñ¤ó
-(27)£í£ú£ø£æ£ð ¤¦¤ª¤« ¤­¤« ¤ò¤ð £í£ú£ø£æ£ð ¤¦¤ª¤« ¤­¤« ¤ò¤ð
-(15)abc def ghi jkl def ghi jkl
-(27)£á£â£ã ¤¢¤ª¤¤ ¤«¤³¤Ê ¤ï¤ñ¤ó £á£â£ã ¤¢¤ª¤¤ ¤« ¤³¤Ê ¤ï¤ñ¤ó
-(27)£í£ú£ø£æ£ð ¤¦¤ª¤« ¤­¤« ¤ò¤ð £í£ú£ø£æ£ð ¤¦¤ª¤« ¤­¤« ¤ò¤ð
-(15)abc def ghi jkl def ghi jkl
-(39)£á£â£ã ¤¢¤ª¤¤ ¤«¤³¤Ê ¤ï¤ñ¤ó £á£â£ã ¤¢¤ª¤¤ ¤« ¤³¤Ê ¤ï¤ñ¤ó
-(39)£í£ú£ø£æ£ð ¤¦¤ª¤« ¤­¤« ¤ò¤ð £í£ú£ø£æ£ð ¤¦¤ª¤« ¤­¤« ¤ò¤ð
diff --git a/ext/mbstring/tests/mb_ereg_replace-compat-01.phpt b/ext/mbstring/tests/mb_ereg_replace-compat-01.phpt
deleted file mode 100644
index ad2c6c1c56..0000000000
--- a/ext/mbstring/tests/mb_ereg_replace-compat-01.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-mb_ereg_replace() compat test 1
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/001.phpt) */
- $a="abc123";
- echo mb_ereg_replace("123","def",$a);
-?>
---EXPECT--
-abcdef
diff --git a/ext/mbstring/tests/mb_ereg_replace-compat-02.phpt b/ext/mbstring/tests/mb_ereg_replace-compat-02.phpt
deleted file mode 100644
index b5ea12196d..0000000000
--- a/ext/mbstring/tests/mb_ereg_replace-compat-02.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-mb_ereg_replace() compat test 2
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/002.phpt) */
- $a="abc123";
- echo mb_ereg_replace("123","",$a);
-?>
---EXPECT--
-abc
diff --git a/ext/mbstring/tests/mb_ereg_replace-compat-03.phpt b/ext/mbstring/tests/mb_ereg_replace-compat-03.phpt
deleted file mode 100644
index c02a346c5e..0000000000
--- a/ext/mbstring/tests/mb_ereg_replace-compat-03.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-mb_ereg_replace() compat test 3
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/003.phpt) */
- $a="\\'test";
- echo mb_ereg_replace("\\\\'","'",$a);
-?>
---EXPECT--
-'test
diff --git a/ext/mbstring/tests/mb_ereg_replace-compat-04.phpt b/ext/mbstring/tests/mb_ereg_replace-compat-04.phpt
deleted file mode 100644
index 94ff320707..0000000000
--- a/ext/mbstring/tests/mb_ereg_replace-compat-04.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-mb_ereg_replace() compat test 4
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/006.phpt) */
- $a="This is a nice and simple string";
- echo mb_ereg_replace("^This","That",$a);
-?>
---EXPECT--
-That is a nice and simple string
diff --git a/ext/mbstring/tests/mb_ereg_replace-compat-05.phpt b/ext/mbstring/tests/mb_ereg_replace-compat-05.phpt
deleted file mode 100644
index f5dae3da14..0000000000
--- a/ext/mbstring/tests/mb_ereg_replace-compat-05.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-mb_ereg_replace() compat test 5
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/007.phpt) */
- $a="abcd";
- $b=mb_ereg_replace("abcd","",$a);
- echo "strlen(\$b)=".strlen($b);
-?>
---EXPECT--
-strlen($b)=0
diff --git a/ext/mbstring/tests/mb_ereg_replace-compat-06.phpt b/ext/mbstring/tests/mb_ereg_replace-compat-06.phpt
deleted file mode 100644
index 8c84dc1e3c..0000000000
--- a/ext/mbstring/tests/mb_ereg_replace-compat-06.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-mb_ereg_replace() compat test 6
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/008.phpt) */
- echo mb_ereg_replace("([a-z]*)([-=+|]*)([0-9]+)","\\3 \\1 \\2\n","abc+-|=123");
-?>
---EXPECT--
-123 abc +-|=
diff --git a/ext/mbstring/tests/mb_ereg_replace-compat-07.phpt b/ext/mbstring/tests/mb_ereg_replace-compat-07.phpt
deleted file mode 100644
index e390655ef4..0000000000
--- a/ext/mbstring/tests/mb_ereg_replace-compat-07.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-mb_ereg_replace() compat test 7
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/010.phpt) */
- $a="abc122222222223";
- echo mb_ereg_replace("1(2*)3","\\1def\\1",$a);
-?>
---EXPECT--
-abc2222222222def2222222222
diff --git a/ext/mbstring/tests/mb_ereg_replace-compat-08.phpt b/ext/mbstring/tests/mb_ereg_replace-compat-08.phpt
deleted file mode 100644
index 5ccc9fd1c0..0000000000
--- a/ext/mbstring/tests/mb_ereg_replace-compat-08.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-mb_ereg_replace() compat test 8
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/011.phpt) */
- $a="abc123";
- echo mb_ereg_replace("123","def\\0ghi",$a);
-?>
---EXPECT--
-abcdef123ghi
diff --git a/ext/mbstring/tests/mb_ereg_replace-compat-09.phpt b/ext/mbstring/tests/mb_ereg_replace-compat-09.phpt
deleted file mode 100644
index bef8be1f4d..0000000000
--- a/ext/mbstring/tests/mb_ereg_replace-compat-09.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-mb_ereg_replace() compat test 9
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/012.phpt) */
- $a="abc123";
- echo mb_ereg_replace("123",'def\1ghi',$a);
-?>
---EXPECT--
-abcdef\1ghi
diff --git a/ext/mbstring/tests/mb_ereg_replace-compat-10.phpt b/ext/mbstring/tests/mb_ereg_replace-compat-10.phpt
deleted file mode 100644
index ac80a4e052..0000000000
--- a/ext/mbstring/tests/mb_ereg_replace-compat-10.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-mb_ereg_replace() compat test 10
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/013.phpt) */
- $a="abc123";
- echo mb_ereg_replace("123","def\\g\\\\hi\\",$a);
-?>
---EXPECT--
-abcdef\g\\hi\
diff --git a/ext/mbstring/tests/mb_ereg_replace-compat-11.phpt b/ext/mbstring/tests/mb_ereg_replace-compat-11.phpt
deleted file mode 100644
index 7ae3edf62f..0000000000
--- a/ext/mbstring/tests/mb_ereg_replace-compat-11.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-mb_ereg_replace() compat test 11
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/014.phpt) */
- $a="a\\2bxc";
- echo mb_ereg_replace("a(.*)b(.*)c","\\1",$a);
-?>
---EXPECT--
-\2
diff --git a/ext/mbstring/tests/mb_ereg_replace-compat-12.phpt b/ext/mbstring/tests/mb_ereg_replace-compat-12.phpt
deleted file mode 100644
index 53bc51e676..0000000000
--- a/ext/mbstring/tests/mb_ereg_replace-compat-12.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-mb_ereg_replace() compat test 12
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/015.phpt) */
- echo mb_ereg_replace("^","z","abc123");
-?>
---EXPECT--
-zabc123
diff --git a/ext/mbstring/tests/mb_ereg_replace-compat-13.phpt b/ext/mbstring/tests/mb_ereg_replace-compat-13.phpt
deleted file mode 100644
index 2975ab75ba..0000000000
--- a/ext/mbstring/tests/mb_ereg_replace-compat-13.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-mb_ereg_replace() compat test 13
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/016.phpt) */
- echo mb_ereg_replace('\?',"abc","?123?");
-?>
---EXPECT--
-abc123abc
diff --git a/ext/mbstring/tests/mb_ereg_replace.phpt b/ext/mbstring/tests/mb_ereg_replace.phpt
deleted file mode 100644
index 9413da82b9..0000000000
--- a/ext/mbstring/tests/mb_ereg_replace.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-mb_ereg_replace()
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip mbstring not available');
-function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
-?>
---FILE--
-<?php
- mb_regex_set_options( '' );
- print mb_ereg_replace( ' ', '-', 'a b c d e' )."\n";
- print mb_ereg_replace( '([a-z]+)','[\\1]', 'abc def ghi' );
-?>
-
---EXPECT--
-a-b-c-d-e
-[abc] [def] [ghi]
-
diff --git a/ext/mbstring/tests/mb_ereg_search_xxx.phpt b/ext/mbstring/tests/mb_ereg_search_xxx.phpt
deleted file mode 100644
index c2c0b84a85..0000000000
--- a/ext/mbstring/tests/mb_ereg_search_xxx.phpt
+++ /dev/null
@@ -1,82 +0,0 @@
---TEST--
-mb_ereg_search() stuff
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip mbstring not available');
-function_exists('mb_ereg_search') or die("skip\n");
-?>
---INI--
-output_handler=
---FILE--
-<?php
- mb_regex_set_options( '' );
-
- $encs = array( 'EUC-JP', 'Shift_JIS', 'SJIS', 'UTF-8' );
-
- function test_search( $test_enc, $str, $look_for, $opt, $in_enc = 'EUC-JP' ) {
- mb_regex_encoding( $test_enc );
- $str = mb_convert_encoding( $str, $test_enc, $in_enc );
- $look_for = mb_convert_encoding( $look_for, $test_enc, $in_enc );
- mb_ereg_search_init( $str, $look_for, $opt );
- while ( mb_ereg_search_pos() ) {
- $regs = mb_ereg_search_getregs();
- array_shift( $regs );
- printf( "(%s) (%d) %s\n", $test_enc, mb_ereg_search_getpos(), mb_convert_encoding( ( is_array( $regs ) ? implode( '-', $regs ): '' ), $in_enc, $test_enc ) );
- }
- }
- function do_tests( $enc, $opt ) {
- test_search( $enc, "¢Ï¡¦ ¡¦¢Ï\n", ' (¡¦?¢Ï¡¦?)[[:space:]]', $opt );
- test_search( $enc, 'abcde abdeabcf anvfabc odu abcd ', '(ab[a-z]+)', $opt );
- }
-
- foreach( $encs as $enc ) {
- do_tests( $enc, '' );
- do_tests( $enc, 'x' );
- }
-?>
-
---EXPECT--
-(EUC-JP) (10) ¡¦¢Ï
-(EUC-JP) (5) abcde
-(EUC-JP) (14) abdeabcf
-(EUC-JP) (22) abc
-(EUC-JP) (31) abcd
-(EUC-JP) (5) ¢Ï¡¦
-(EUC-JP) (10) ¡¦¢Ï
-(EUC-JP) (5) abcde
-(EUC-JP) (14) abdeabcf
-(EUC-JP) (22) abc
-(EUC-JP) (31) abcd
-(Shift_JIS) (10) ¡¦¢Ï
-(Shift_JIS) (5) abcde
-(Shift_JIS) (14) abdeabcf
-(Shift_JIS) (22) abc
-(Shift_JIS) (31) abcd
-(Shift_JIS) (5) ¢Ï¡¦
-(Shift_JIS) (10) ¡¦¢Ï
-(Shift_JIS) (5) abcde
-(Shift_JIS) (14) abdeabcf
-(Shift_JIS) (22) abc
-(Shift_JIS) (31) abcd
-(SJIS) (10) ¡¦¢Ï
-(SJIS) (5) abcde
-(SJIS) (14) abdeabcf
-(SJIS) (22) abc
-(SJIS) (31) abcd
-(SJIS) (5) ¢Ï¡¦
-(SJIS) (10) ¡¦¢Ï
-(SJIS) (5) abcde
-(SJIS) (14) abdeabcf
-(SJIS) (22) abc
-(SJIS) (31) abcd
-(UTF-8) (14) ¡¦¢Ï
-(UTF-8) (5) abcde
-(UTF-8) (14) abdeabcf
-(UTF-8) (22) abc
-(UTF-8) (31) abcd
-(UTF-8) (7) ¢Ï¡¦
-(UTF-8) (14) ¡¦¢Ï
-(UTF-8) (5) abcde
-(UTF-8) (14) abdeabcf
-(UTF-8) (22) abc
-(UTF-8) (31) abcd
diff --git a/ext/mbstring/tests/mb_http_input.phpt b/ext/mbstring/tests/mb_http_input.phpt
deleted file mode 100644
index a27de9f873..0000000000
--- a/ext/mbstring/tests/mb_http_input.phpt
+++ /dev/null
@@ -1,50 +0,0 @@
---TEST--
-mb_http_input()
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip mbstring not available');
-(php_sapi_name()=='cgi') or die("skip sapi is not a cgi version");
-?>
---POST--
-a=ÆüËܸì0123456789ÆüËܸ쥫¥¿¥«¥Ê¤Ò¤é¤¬¤Ê
---GET--
-b=ÆüËܸì0123456789ÆüËܸ쥫¥¿¥«¥Ê¤Ò¤é¤¬¤Ê
---FILE--
-<?php
-// TODO: This is not a real test.... Need to change so that it does real testing
-//$debug = true;
-ini_set('include_path','.');
-include_once('common.inc');
-
-$ini = ini_get('mbstring.http_input');
-
-// It must be url encoded....
-// echo vars
-echo $_POST['a']."\n";
-echo $_GET['b']."\n";
-
-// Get encoding
-$enc = mb_http_input('P');
-
-// check
-if (empty($ini)) {
- // Must be pass
- if ($enc === 'pass') {
- echo "OK\n";
- }
- else {
- echo "NG\n";
- }
-}
-else {
- // Some encoding
- echo "This heppens when php.ini-dist is not used\n";
-}
-
-?>
-
---EXPECT--
-ÆüËܸì0123456789ÆüËܸ쥫¥¿¥«¥Ê¤Ò¤é¤¬¤Ê
-ÆüËܸì0123456789ÆüËܸ쥫¥¿¥«¥Ê¤Ò¤é¤¬¤Ê
-OK
-
diff --git a/ext/mbstring/tests/mb_http_output.phpt b/ext/mbstring/tests/mb_http_output.phpt
deleted file mode 100644
index 0a6839f7f1..0000000000
--- a/ext/mbstring/tests/mb_http_output.phpt
+++ /dev/null
@@ -1,84 +0,0 @@
---TEST--
-mb_http_output()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-//TODO: Add more encoding. Wrong paramter type test.
-//$debug = true;
-ini_set('include_path','.');
-include_once('common.inc');
-
-// Set HTTP output encoding to ASCII
-$r = mb_http_output('ASCII');
-($r === TRUE) ? print "OK_ASCII_SET\n" : print "NG_ASCII_SET\n";
-$enc = mb_http_output();
-print "$enc\n";
-
-// Set HTTP output encoding to SJIS
-$r = mb_http_output('SJIS');
-($r === TRUE) ? print "OK_SJIS_SET\n" : print "NG_SJIS_SET\n";
-$enc = mb_http_output();
-print "$enc\n";
-
-// Set HTTP output encoding to JIS
-$r = mb_http_output('JIS');
-($r === TRUE) ? print "OK_JIS_SET\n" : print "NG_JIS_SET\n";
-$enc = mb_http_output();
-print "$enc\n";
-
-// Set HTTP output encoding to UTF8
-$r = mb_http_output('UTF-8');
-($r === TRUE) ? print "OK_UTF-8_SET\n" : print "NG_UTF-8_SET\n";
-$enc = mb_http_output();
-print "$enc\n";
-
-// Set HTTP output encoding to EUC-JP
-$r = mb_http_output('EUC-JP');
-($r === TRUE) ? print "OK_EUC-JP_SET\n" : print "NG_EUC-JP_SET\n";
-$enc = mb_http_output();
-print "$enc\n";
-
-// Invalid parameters
-print "== INVALID PARAMETER ==\n";
-
-// Note: Bad string raise Warning. Bad Type raise Notice (Type Conversion) and Warning....
-$r = mb_http_output('BAD_NAME');
-($r === FALSE) ? print "OK_BAD_SET\n" : print "NG_BAD_SET\n";
-$enc = mb_http_output();
-print "$enc\n";
-
-$r = mb_http_output($t_ary);
-($r === FALSE) ? print "OK_BAD_ARY_SET\n" : print "NG_BAD_ARY_SET\n";
-$enc = mb_http_output();
-print "$enc\n";
-
-$r = mb_http_output($t_obj);
-($r === FALSE) ? print "OK_BAD_OBJ_SET\n" : print "NG_BAD_OBJ_SET\n";
-$enc = mb_http_output();
-print "$enc\n";
-
-?>
-
---EXPECT--
-OK_ASCII_SET
-ASCII
-OK_SJIS_SET
-SJIS
-OK_JIS_SET
-JIS
-OK_UTF-8_SET
-UTF-8
-OK_EUC-JP_SET
-EUC-JP
-== INVALID PARAMETER ==
-ERR: Warning
-OK_BAD_SET
-EUC-JP
-ERR: Warning
-OK_BAD_ARY_SET
-EUC-JP
-ERR: Warning
-OK_BAD_OBJ_SET
-EUC-JP
-
diff --git a/ext/mbstring/tests/mb_internal_encoding.phpt b/ext/mbstring/tests/mb_internal_encoding.phpt
deleted file mode 100644
index 1d62962529..0000000000
--- a/ext/mbstring/tests/mb_internal_encoding.phpt
+++ /dev/null
@@ -1,68 +0,0 @@
---TEST--
-mb_internal_encoding()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-// TODO:
-//$debug = true;
-ini_set('include_path','.');
-include_once('common.inc');
-
-// EUC-JP
-$r = mb_internal_encoding('EUC-JP');
-($r === TRUE) ? print "OK_EUC-JP_SET\n" : print "NG_EUC-JP_SET\n";
-$enc = mb_internal_encoding();
-print "$enc\n";
-
-// UTF-8
-$r = mb_internal_encoding('UTF-8');
-($r === TRUE) ? print "OK_UTF-8_SET\n" : print "NG_UTF-8_SET\n";
-$enc = mb_internal_encoding();
-print "$enc\n";
-
-// ASCII
-$r = mb_internal_encoding('ASCII');
-($r === TRUE) ? print "OK_ASCII_SET\n" : print "NG_ASCII_SET\n";
-$enc = mb_internal_encoding();
-print "$enc\n";
-
-// Invalid Parameter
-print "== INVALID PARAMETER ==\n";
-
-// Note: Other than string type, PHP raises Warning
-$r = mb_internal_encoding('BAD');
-($r === FALSE) ? print "OK_BAD_SET\n" : print "NG_BAD_SET\n";
-$enc = mb_internal_encoding();
-print "$enc\n";
-
-$r = mb_internal_encoding($t_ary);
-($r === FALSE) ? print "OK_BAD_ARY_SET\n" : print "NG_BAD_ARY_SET\n";
-$enc = mb_internal_encoding();
-print "$enc\n";
-
-$r = mb_internal_encoding($t_obj);
-($r === FALSE) ? print "OK_BAD_OBJ_SET\n" : print "NG_BAD_OBJ_SET\n";
-$enc = mb_internal_encoding();
-print "$enc\n";
-
-?>
-
---EXPECT--
-OK_EUC-JP_SET
-EUC-JP
-OK_UTF-8_SET
-UTF-8
-OK_ASCII_SET
-ASCII
-== INVALID PARAMETER ==
-ERR: Warning
-OK_BAD_SET
-ASCII
-ERR: Warning
-OK_BAD_ARY_SET
-ASCII
-ERR: Warning
-OK_BAD_OBJ_SET
-ASCII
-
diff --git a/ext/mbstring/tests/mb_output_handler_euc_jp.phpt b/ext/mbstring/tests/mb_output_handler_euc_jp.phpt
deleted file mode 100644
index dff5c97743..0000000000
--- a/ext/mbstring/tests/mb_output_handler_euc_jp.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-mb_output_handler() (EUC-JP)
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-// TODO: Do real test
-
-// EUC-JP
-$euc_jp = "¥Æ¥¹¥ÈÍÑÆüËܸìʸ»úÎ󡣤³¤Î¥â¥¸¥å¡¼¥ë¤ÏPHP¤Ë¥Þ¥ë¥Á¥Ð¥¤¥È´Ø¿ô¤òÄ󶡤·¤Þ¤¹¡£";
-mb_http_output('EUC-JP') or print("mb_http_output() failed\n");
-ob_start('mb_output_handler');
-echo $euc_jp;
-$output = ob_get_clean();
-
-var_dump( $output );
-
-?>
-
---EXPECT--
-string(73) "¥Æ¥¹¥ÈÍÑÆüËܸìʸ»úÎ󡣤³¤Î¥â¥¸¥å¡¼¥ë¤ÏPHP¤Ë¥Þ¥ë¥Á¥Ð¥¤¥È´Ø¿ô¤òÄ󶡤·¤Þ¤¹¡£"
diff --git a/ext/mbstring/tests/mb_output_handler_shift_jis.phpt b/ext/mbstring/tests/mb_output_handler_shift_jis.phpt
deleted file mode 100644
index d4612d9775..0000000000
--- a/ext/mbstring/tests/mb_output_handler_shift_jis.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-mb_output_handler() (Shift_JIS)
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-output_handler=mb_output_handler
-mbstring.internal_encoding=Shift_JIS
-mbstring.http_output=EUC-JP
---FILE--
-<?php
-// Shift_JIS
-var_dump("ƒeƒXƒg—p“ú–{Œê•¶Žš—ñB‚±‚̃‚ƒWƒ…[ƒ‹‚ÍPHP‚Ƀ}ƒ‹ƒ`ƒoƒCƒgŠÖ”‚ð’ñ‹Ÿ‚µ‚Ü‚·B");
-?>
-
---EXPECT--
-string(73) "¥Æ¥¹¥ÈÍÑÆüËܸìʸ»úÎ󡣤³¤Î¥â¥¸¥å¡¼¥ë¤ÏPHP¤Ë¥Þ¥ë¥Á¥Ð¥¤¥È´Ø¿ô¤òÄ󶡤·¤Þ¤¹¡£"
diff --git a/ext/mbstring/tests/mb_parse_str.phpt b/ext/mbstring/tests/mb_parse_str.phpt
deleted file mode 100644
index 8b320b0845..0000000000
--- a/ext/mbstring/tests/mb_parse_str.phpt
+++ /dev/null
@@ -1,80 +0,0 @@
---TEST--
-mb_parse_str()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-arg_separator.input=&
-register_globals=0
---FILE--
-<?php
-$queries = array(
- "foo=abc&bar=def",
- "%2bfoo=def&-bar=jkl",
- "foo[]=abc&foo[]=def&foo[]=ghi&bar[]=jkl"
-);
-function test($query) {
- $foo = '';
- $bar = '';
- mb_parse_str($query, $array);
- var_dump($array);
- var_dump($foo);
- var_dump($bar);
- mb_parse_str($query);
- var_dump($foo);
- var_dump($bar);
-}
-foreach ($queries as $query) {
- test($query);
-}
-?>
---EXPECT--
-array(2) {
- ["foo"]=>
- string(3) "abc"
- ["bar"]=>
- string(3) "def"
-}
-string(0) ""
-string(0) ""
-string(3) "abc"
-string(3) "def"
-array(2) {
- ["+foo"]=>
- string(3) "def"
- ["-bar"]=>
- string(3) "jkl"
-}
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-array(2) {
- ["foo"]=>
- array(3) {
- [0]=>
- string(3) "abc"
- [1]=>
- string(3) "def"
- [2]=>
- string(3) "ghi"
- }
- ["bar"]=>
- array(1) {
- [0]=>
- string(3) "jkl"
- }
-}
-string(0) ""
-string(0) ""
-array(3) {
- [0]=>
- string(3) "abc"
- [1]=>
- string(3) "def"
- [2]=>
- string(3) "ghi"
-}
-array(1) {
- [0]=>
- string(3) "jkl"
-}
diff --git a/ext/mbstring/tests/mb_parse_str02.phpt b/ext/mbstring/tests/mb_parse_str02.phpt
deleted file mode 100644
index 51cfb63cb9..0000000000
--- a/ext/mbstring/tests/mb_parse_str02.phpt
+++ /dev/null
@@ -1,105 +0,0 @@
---TEST--
-mb_parse_str() test 2
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-arg_separator.input=&#
-register_globals=0
---FILE--
-<?php
-$queries = array(
- "foo=abc#bar=def&fubar=ghi",
- "%2bfoo=def&-bar=jkl#+fubar",
- " foo[]=abc&foo[]=def#foo[]=ghi#bar[]=#foo[]&fubar[]=="
-);
-function test($query) {
- $foo = '';
- $bar = '';
- $fubar = '';
- mb_parse_str($query, $array);
- var_dump($array);
- var_dump($foo);
- var_dump($bar);
- var_dump($fubar);
- mb_parse_str($query);
- var_dump($foo);
- var_dump($bar);
- var_dump($fubar);
-}
-foreach ($queries as $query) {
- test($query);
-}
-?>
---EXPECT--
-array(3) {
- ["foo"]=>
- string(3) "abc"
- ["bar"]=>
- string(3) "def"
- ["fubar"]=>
- string(3) "ghi"
-}
-string(0) ""
-string(0) ""
-string(0) ""
-string(3) "abc"
-string(3) "def"
-string(3) "ghi"
-array(3) {
- ["+foo"]=>
- string(3) "def"
- ["-bar"]=>
- string(3) "jkl"
- ["fubar"]=>
- string(0) ""
-}
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-array(3) {
- ["foo"]=>
- array(4) {
- [0]=>
- string(3) "abc"
- [1]=>
- string(3) "def"
- [2]=>
- string(3) "ghi"
- [3]=>
- string(0) ""
- }
- ["bar"]=>
- array(1) {
- [0]=>
- string(0) ""
- }
- ["fubar"]=>
- array(1) {
- [0]=>
- string(1) "="
- }
-}
-string(0) ""
-string(0) ""
-string(0) ""
-array(4) {
- [0]=>
- string(3) "abc"
- [1]=>
- string(3) "def"
- [2]=>
- string(3) "ghi"
- [3]=>
- string(0) ""
-}
-array(1) {
- [0]=>
- string(0) ""
-}
-array(1) {
- [0]=>
- string(1) "="
-}
diff --git a/ext/mbstring/tests/mb_preferred_mime_name.phpt b/ext/mbstring/tests/mb_preferred_mime_name.phpt
deleted file mode 100644
index 82f88b15c3..0000000000
--- a/ext/mbstring/tests/mb_preferred_mime_name.phpt
+++ /dev/null
@@ -1,61 +0,0 @@
---TEST--
-mb_preferred_mime_name()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-// TODO: Add more encoding names
-
-//$debug=true;
-ini_set('include_path','.');
-include_once('common.inc');
-
-
-$str = mb_preferred_mime_name('sjis-win');
-echo "$str\n";
-
-$str = mb_preferred_mime_name('SJIS');
-echo "$str\n";
-
-$str = mb_preferred_mime_name('EUC-JP');
-echo "$str\n";
-
-$str = mb_preferred_mime_name('UTF-8');
-echo "$str\n";
-
-$str = mb_preferred_mime_name('ISO-2022-JP');
-echo "$str\n";
-
-$str = mb_preferred_mime_name('JIS');
-echo "$str\n";
-
-$str = mb_preferred_mime_name('ISO-8859-1');
-echo "$str\n";
-
-$str = mb_preferred_mime_name('UCS2');
-echo "$str\n";
-
-$str = mb_preferred_mime_name('UCS4');
-echo "$str\n";
-
-echo "== INVALID PARAMETER ==\n";
-// Invalid name
-$r = mb_preferred_mime_name('BAD_NAME');
-($r === FALSE) ? print("OK_BAD_NAME\n") : print("NG_BAD_NAME\n");
-
-?>
-
---EXPECT--
-Shift_JIS
-Shift_JIS
-EUC-JP
-UTF-8
-ISO-2022-JP
-ISO-2022-JP
-ISO-8859-1
-UCS-2
-UCS-4
-== INVALID PARAMETER ==
-ERR: Warning
-OK_BAD_NAME
-
diff --git a/ext/mbstring/tests/mb_regex_set_options.phpt b/ext/mbstring/tests/mb_regex_set_options.phpt
deleted file mode 100644
index 88ee9c9250..0000000000
--- a/ext/mbstring/tests/mb_regex_set_options.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-mb_regex_set_options()
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die("skip mbstring not available\n");
-function_exists('mb_regex_set_options') or die("skip\n");
-?>
---FILE--
-<?php
- mb_regex_set_options( 'x' );
- print mb_ereg_replace(' -', '+', '- - - - -' );
-
- mb_regex_set_options( '' );
- print mb_ereg_replace(' -', '+', '- - - - -' );
-?>
-
---EXPECT--
-+ + + + +-++++
diff --git a/ext/mbstring/tests/mb_send_mail01.phpt b/ext/mbstring/tests/mb_send_mail01.phpt
deleted file mode 100644
index 4c75185454..0000000000
--- a/ext/mbstring/tests/mb_send_mail01.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-mb_send_mail() test 1 (lang=neutral)
---SKIPIF--
-<?php
-if (@mb_send_mail() === false || !mb_language("neutral")) {
- die("skip mb_send_mail() not available");
-}
-?>
---INI--
-sendmail_path=cat
---FILE--
-<?php
-$to = 'example@example.com';
-
-/* default setting */
-mb_send_mail($to, mb_language(), "test");
-
-/* neutral (UTF-8) */
-if (mb_language("neutral")) {
- mb_internal_encoding("none");
- mb_send_mail($to, "test ".mb_language(), "test");
-}
-?>
---EXPECTF--
-To: example@example.com
-Subject: %s
-Mime-Version: 1.0
-Content-Type: text/plain; charset=%s
-Content-Transfer-Encoding: %s
-
-%s
-To: example@example.com
-Subject: test neutral
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: BASE64
-
-dGVzdA==
diff --git a/ext/mbstring/tests/mb_send_mail02.phpt b/ext/mbstring/tests/mb_send_mail02.phpt
deleted file mode 100644
index f3048ddefa..0000000000
--- a/ext/mbstring/tests/mb_send_mail02.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-mb_send_mail() test 2 (lang=Japanese)
---SKIPIF--
-<?php
-if (@mb_send_mail() === false || !mb_language("japanese")) {
- die("skip mb_send_mail() not available");
-}
-?>
---INI--
-sendmail_path=cat
---FILE--
-<?php
-$to = 'example@example.com';
-
-/* default setting */
-mb_send_mail($to, mb_language(), "test");
-
-/* Japanese (EUC-JP) */
-if (mb_language("japanese")) {
- mb_internal_encoding('EUC-JP');
- mb_send_mail($to, "¥Æ¥¹¥È ".mb_language(), "¥Æ¥¹¥È");
-}
-?>
---EXPECTF--
-To: example@example.com
-Subject: %s
-Mime-Version: 1.0
-Content-Type: text/plain; charset=%s
-Content-Transfer-Encoding: %s
-
-%s
-To: example@example.com
-Subject: =?ISO-2022-JP?B?GyRCJUYlOSVIGyhCIEphcGFuZXNl?=
-Mime-Version: 1.0
-Content-Type: text/plain; charset=ISO-2022-JP
-Content-Transfer-Encoding: 7bit
-
-$B%F%9%H(B
diff --git a/ext/mbstring/tests/mb_send_mail03.phpt b/ext/mbstring/tests/mb_send_mail03.phpt
deleted file mode 100644
index 545c6b71bb..0000000000
--- a/ext/mbstring/tests/mb_send_mail03.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-mb_send_mail() test 3 (lang=English)
---SKIPIF--
-<?php
-if (@mb_send_mail() === false || !mb_language("english")) {
- die("skip mb_send_mail() not available");
-}
-?>
---INI--
-sendmail_path=cat
---FILE--
-<?php
-$to = 'example@example.com';
-
-/* default setting */
-mb_send_mail($to, mb_language(), "test");
-
-/* English (iso-8859-1) */
-if (mb_language("english")) {
- mb_internal_encoding("ISO-8859-1");
- mb_send_mail($to, "test ".mb_language(), "test");
-}
-?>
---EXPECTF--
-To: example@example.com
-Subject: %s
-Mime-Version: 1.0
-Content-Type: text/plain; charset=%s
-Content-Transfer-Encoding: %s
-
-%s
-To: example@example.com
-Subject: test English
-Mime-Version: 1.0
-Content-Type: text/plain; charset=%s-8859-1
-Content-Transfer-Encoding: 8bit
-
-test
diff --git a/ext/mbstring/tests/mb_send_mail04.phpt b/ext/mbstring/tests/mb_send_mail04.phpt
deleted file mode 100644
index 9b8b53633b..0000000000
--- a/ext/mbstring/tests/mb_send_mail04.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-mb_send_mail() test 4 (lang=German)
---SKIPIF--
-<?php
-if (@mb_send_mail() === false || !mb_language("german")) {
- die("skip mb_send_mail() not available");
-}
-?>
---INI--
-sendmail_path=cat
---FILE--
-<?php
-$to = 'example@example.com';
-
-/* default setting */
-mb_send_mail($to, mb_language(), "test");
-
-/* German (iso-8859-15) */
-if (mb_language("german")) {
- mb_internal_encoding("ISO-8859-15");
- mb_send_mail($to, "Pr"."\xfc"."fung ".mb_language(), "Pr"."\xfc"."fung");
-}
-?>
---EXPECTF--
-To: example@example.com
-Subject: %s
-Mime-Version: 1.0
-Content-Type: text/plain; charset=%s
-Content-Transfer-Encoding: %s
-
-%s
-To: example@example.com
-Subject: =?ISO-8859-15?Q?Pr=FCfung=20German?=
-Mime-Version: 1.0
-Content-Type: text/plain; charset=%s-8859-15
-Content-Transfer-Encoding: 8bit
-
-Prüfung
diff --git a/ext/mbstring/tests/mb_send_mail05.phpt b/ext/mbstring/tests/mb_send_mail05.phpt
deleted file mode 100644
index 37bbe33a69..0000000000
--- a/ext/mbstring/tests/mb_send_mail05.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-mb_send_mail() test 5 (lang=Simplified Chinese)
---SKIPIF--
-<?php
-if (@mb_send_mail() === false || !mb_language("Simplified Chinese")) {
- die("skip mb_send_mail() not available");
-}
-if (!@mb_internal_encoding('GB2312')) {
- die("skip GB2312 encoding is not avaliable on this platform");
-}
-?>
---INI--
-sendmail_path=cat
---FILE--
-<?php
-$to = 'example@example.com';
-
-/* default setting */
-mb_send_mail($to, mb_language(), "test");
-
-/* Simplified Chinese (HK-GB-2312) */
-if (mb_language("simplified chinese")) {
- mb_internal_encoding('GB2312');
- mb_send_mail($to, "²âÑé ".mb_language(), "²âÑé");
-}
-?>
---EXPECTF--
-To: example@example.com
-Subject: %s
-Mime-Version: 1.0
-Content-Type: text/plain; charset=%s
-Content-Transfer-Encoding: %s
-
-%s
-To: example@example.com
-Subject: =?HZ-GB-2312?B?fnsyYlFpfn0gU2ltcGxpZmllZCBD?=
- =?HZ-GB-2312?B?aGluZXNl?=
-Mime-Version: 1.0
-Content-Type: text/plain; charset=HZ-GB-2312
-Content-Transfer-Encoding: 7bit
-
-~{2bQi~}
diff --git a/ext/mbstring/tests/mb_send_mail06.phpt b/ext/mbstring/tests/mb_send_mail06.phpt
deleted file mode 100644
index 20a42d79b7..0000000000
--- a/ext/mbstring/tests/mb_send_mail06.phpt
+++ /dev/null
@@ -1,41 +0,0 @@
---TEST--
-mb_send_mail() test 6 (lang=Traditional Chinese)
---SKIPIF--
-<?php
-if (@mb_send_mail() === false || !mb_language("Traditional Chinese")) {
- die("skip mb_send_mail() not available");
-}
-if (!@mb_internal_encoding('BIG5')) {
- die("skip BIG5 encoding is not avaliable on this platform");
-}
-?>
---INI--
-sendmail_path=cat
---FILE--
-<?php
-$to = 'example@example.com';
-
-/* default setting */
-mb_send_mail($to, mb_language(), "test");
-
-/* Traditional Chinese () */
-if (mb_language("traditional chinese")) {
- mb_internal_encoding('BIG5');
- mb_send_mail($to, "´úÅç ".mb_language(), "´úÅç");
-}
-?>
---EXPECTF--
-To: example@example.com
-Subject: %s
-Mime-Version: 1.0
-Content-Type: text/plain; charset=%s
-Content-Transfer-Encoding: %s
-
-%s
-To: example@example.com
-Subject: =?BIG5?B?tPrF5yBUcmFkaXRpb25hbCBDaGluZXNl?=
-Mime-Version: 1.0
-Content-Type: text/plain; charset=BIG5
-Content-Transfer-Encoding: 8bit
-
-´úÅç
diff --git a/ext/mbstring/tests/mb_send_mail07.phpt b/ext/mbstring/tests/mb_send_mail07.phpt
deleted file mode 100644
index e7ad08254a..0000000000
--- a/ext/mbstring/tests/mb_send_mail07.phpt
+++ /dev/null
@@ -1,41 +0,0 @@
---TEST--
-mb_send_mail() test 7 (lang=Korean)
---SKIPIF--
-<?php
-if (@mb_send_mail() === false || !mb_language("Korean")) {
- die("skip mb_send_mail() not available");
-}
-if (!@mb_internal_encoding('ISO-2022-KR')) {
- die("skip ISO-2022-KR encoding is not avaliable on this platform");
-}
-?>
---INI--
-sendmail_path=cat
---FILE--
-<?php
-$to = 'example@example.com';
-
-/* default setting */
-mb_send_mail($to, mb_language(), "test");
-
-/* Korean */
-if (mb_language("korean")) {
- mb_internal_encoding('EUC-KR');
- mb_send_mail($to, "Å×½ºÆ® ".mb_language(), "Å×½ºÆ®");
-}
-?>
---EXPECTF--
-To: example@example.com
-Subject: %s
-Mime-Version: 1.0
-Content-Type: text/plain; charset=%s
-Content-Transfer-Encoding: %s
-
-dGVzdA==
-To: example@example.com
-Subject: =?ISO-2022-KR?B?GyQpQw5FVz06Ri4PIEtvcmVhbg8=?=
-Mime-Version: 1.0
-Content-Type: text/plain; charset=ISO-2022-KR
-Content-Transfer-Encoding: 7bit
-
-$)CEW=:F.
diff --git a/ext/mbstring/tests/mb_split-compat-01.phpt b/ext/mbstring/tests/mb_split-compat-01.phpt
deleted file mode 100644
index 8dbc82c130..0000000000
--- a/ext/mbstring/tests/mb_split-compat-01.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-mb_split() compat test 1
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_split') or die("skip mb_split() is not available in this build");
-?>
---FILE--
-<?php
-/* (counterpart: ext/standard/tests/reg/009.phpt) */
- $a=mb_split("[[:space:]]","this is a
-test");
- echo count($a) . "\n";
- for ($i = 0; $i < count($a); $i++) {
- echo $a[$i] . "\n";
- }
-?>
---EXPECT--
-4
-this
-is
-a
-test
diff --git a/ext/mbstring/tests/mb_split.phpt b/ext/mbstring/tests/mb_split.phpt
deleted file mode 100644
index abe12763eb..0000000000
--- a/ext/mbstring/tests/mb_split.phpt
+++ /dev/null
@@ -1,48 +0,0 @@
---TEST--
-mb_split()
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip mbstring not available');
-function_exists('mb_split') or die("skip mb_split() is not available in this build");
-?>
---INI--
-mbstring.func_overload=0
---FILE--
-<?php
- mb_regex_set_options( '' );
- mb_regex_encoding( 'EUC-JP' );
-
- function verify_split( $spliton, $str, $count = 0 )
- {
- $result1 = mb_split( $spliton, $str, $count );
- $result2 = split( $spliton, $str, $count );
- if ( $result1 == $result2 ) {
- print "ok\n";
- } else {
- print count($result1).'-'.count($result2)."\n";
- }
- }
-
- var_dump( mb_split( " ", "a b c d e f g" )
- == mb_split( "[[:space:]]", "a\nb\tc\nd e f g" ) );
-
- for ( $i = 0; $i < 5; ++$i ) {
- verify_split( " ", "a\tb\tc\td e\tf g", $i );
- }
-
- for ( $i = 1; $i < 5; ++$i ) {
- verify_split( "\xa1\xa1+", "\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1", $i );
- }
-?>
-
---EXPECT--
-bool(true)
-ok
-ok
-ok
-ok
-ok
-ok
-2-2
-3-3
-4-4
diff --git a/ext/mbstring/tests/mb_strcut.phpt b/ext/mbstring/tests/mb_strcut.phpt
deleted file mode 100644
index 8ea074a3cd..0000000000
--- a/ext/mbstring/tests/mb_strcut.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-mb_strcut()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-output_handler=
---FILE--
-<?php
-// TODO: Add more encodings
-ini_set('include_path','.');
-include_once('common.inc');
-
-// EUC-JP
-$euc_jp = '0123¤³¤Îʸ»úÎó¤ÏÆüËܸì¤Ç¤¹¡£EUC-JP¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£ÆüËܸì¤ÏÌÌÅݽ­¤¤¡£';
-
-print mb_strcut($euc_jp, 6, 5,'EUC-JP') . "\n";
-print mb_strcut($euc_jp, 0, 100,'EUC-JP') . "\n";
-
-$str = mb_strcut($euc_jp, 100, 10,'EUC-JP');
-($str === "") ? print "OK\n" : print "NG: $str\n";
-
-$str = mb_strcut($euc_jp, -100, 10,'EUC-JP');
-($str !== "") ? print "OK: $str\n" : print "NG:\n";
-
-
-?>
-
---EXPECT--
-¤Îʸ
-0123¤³¤Îʸ»úÎó¤ÏÆüËܸì¤Ç¤¹¡£EUC-JP¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£ÆüËܸì¤ÏÌÌÅݽ­¤¤¡£
-OK
-OK: 0123¤³¤Îʸ
-
-
diff --git a/ext/mbstring/tests/mb_strimwidth.phpt b/ext/mbstring/tests/mb_strimwidth.phpt
deleted file mode 100644
index efa98856f1..0000000000
--- a/ext/mbstring/tests/mb_strimwidth.phpt
+++ /dev/null
@@ -1,43 +0,0 @@
---TEST--
-mb_strimwidth()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-output_handler=
---FILE--
-<?php
-// TODO: Add more encoding
-//$debug = true;
-ini_set('include_path','.');
-include_once('common.inc');
-
-// EUC-JP
-$euc_jp = '0123¤³¤Îʸ»úÎó¤ÏÆüËܸì¤Ç¤¹¡£EUC-JP¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£ÆüËܸì¤ÏÌÌÅݽ­¤¤¡£';
-
-print "1: ". mb_strimwidth($euc_jp, 0, 15,'...','EUC-JP') . "\n";
-print "2: ". mb_strimwidth($euc_jp, 0, 100,'...','EUC-JP') . "\n";
-print "3: ". mb_strimwidth($euc_jp, 15, 100,'...','EUC-JP') . "\n";
-// Note: Did not start form -22 offset. Staring from 0.
-$str = mb_strimwidth($euc_jp,-22, 100,'...','EUC-JP');
-($str === FALSE) ? print "4 OK\n" : print "NG: $str\n";
-
-$str = mb_strimwidth($euc_jp, 100, -10,'...','EUC-JP');
-($str === FALSE) ? print "5 OK\n" : print "NG: $str\n";
-
-$str = mb_strimwidth($euc_jp, -100, 10,'...','EUC-JP');
-($str === FALSE) ? print "6 OK\n" : print "NG: $str\n";
-
-?>
-
---EXPECT--
-1: 0123¤³¤Îʸ»ú...
-2: 0123¤³¤Îʸ»úÎó¤ÏÆüËܸì¤Ç¤¹¡£EUC-JP¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£ÆüËܸì¤ÏÌÌÅݽ­¤¤¡£
-3: ¡£EUC-JP¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£ÆüËܸì¤ÏÌÌÅݽ­¤¤¡£
-ERR: Warning
-4 OK
-ERR: Warning
-5 OK
-ERR: Warning
-6 OK
-
-
diff --git a/ext/mbstring/tests/mb_strlen.phpt b/ext/mbstring/tests/mb_strlen.phpt
deleted file mode 100644
index 500237e2cc..0000000000
--- a/ext/mbstring/tests/mb_strlen.phpt
+++ /dev/null
@@ -1,104 +0,0 @@
---TEST--
-mb_strlen()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-// TODO: Add more encodings
-
-//$debug=true;
-ini_set('include_path','.');
-include_once('common.inc');
-
-// restore detect_order to 'auto'
-mb_detect_order('auto');
-
-// Test string
-$euc_jp = '0123¤³¤Îʸ»úÎó¤ÏÆüËܸì¤Ç¤¹¡£EUC-JP¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£0123ÆüËܸì¤ÏÌÌÅݽ­¤¤¡£';
-$ascii = 'abcdefghijklmnopqrstuvwxyz;]=#0123456789';
-
-// ASCII
-echo "== ASCII ==\n";
-print strlen($ascii,'ASCII') . "\n";
-print strlen($ascii) . "\n";
-
-// EUC-JP
-echo "== EUC-JP ==\n";
-print strlen($euc_jp,'EUC-JP') . "\n";
-mb_internal_encoding('EUC-JP') or print("mb_internal_encoding() failed\n");
-print strlen($euc_jp) . "\n";
-
-// SJIS
-echo "== SJIS ==\n";
-$sjis = mb_convert_encoding($euc_jp, 'SJIS');
-print strlen($sjis,'SJIS') . "\n";
-mb_internal_encoding('SJIS') or print("mb_internal_encoding() failed\n");
-print strlen($sjis) . "\n";
-
-// JIS
-// Note: either convert_encoding or strlen has problem
-echo "== JIS ==\n";
-$jis = mb_convert_encoding($euc_jp, 'JIS');
-print strlen($jis,'JIS') . "\n";
-mb_internal_encoding('JIS') or print("mb_internal_encoding() failed\n");
-print strlen($jis) . "\n";
-
-// UTF-8
-// Note: either convert_encoding or strlen has problem
-echo "== UTF-8 ==\n";
-$utf8 = mb_convert_encoding($euc_jp, 'UTF-8');
-print strlen($utf8,'UTF-8') . "\n";
-mb_internal_encoding('UTF-8') or print("mb_internal_encoding() failed\n");
-print strlen($utf8) . "\n";
-
-
-// Wrong Parameters
-echo "== WRONG PARAMETERS ==\n";
-// Array
-// Note: PHP Notice, but returns some value
-$r = strlen($t_ary);
-echo $r."\n";
-// Object
-// Note: PHP Notice, but returns some value
-$r = strlen($t_obj);
-echo $r."\n";
-// Wrong encoding
-mb_internal_encoding('EUC-JP');
-$r = strlen($euc_jp, 'BAD_NAME');
-echo $r."\n";
-
-
-
-
-?>
-
---EXPECT--
-== ASCII ==
-ERR: Warning
-
-40
-== EUC-JP ==
-ERR: Warning
-
-72
-== SJIS ==
-ERR: Warning
-
-72
-== JIS ==
-ERR: Warning
-
-121
-== UTF-8 ==
-ERR: Warning
-
-174
-== WRONG PARAMETERS ==
-ERR: Notice
-5
-ERR: Notice
-6
-ERR: Warning
-
-
-
diff --git a/ext/mbstring/tests/mb_strpos.phpt b/ext/mbstring/tests/mb_strpos.phpt
deleted file mode 100644
index ca49599fa7..0000000000
--- a/ext/mbstring/tests/mb_strpos.phpt
+++ /dev/null
@@ -1,175 +0,0 @@
---TEST--
-mb_strpos()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-// TODO: Add more encodings
-
-//$debug=true;
-ini_set('include_path','.');
-include_once('common.inc');
-
-
-// Test string
-$euc_jp = '0123¤³¤Îʸ»úÎó¤ÏÆüËܸì¤Ç¤¹¡£EUC-JP¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£0123ÆüËܸì¤ÏÌÌÅݽ­¤¤¡£';
-
-// EUC-JP - With encoding parameter
-mb_internal_encoding('UTF-8') or print("mb_internal_encoding() failed\n");
-
-echo "== POSITIVE OFFSET ==\n";
-print mb_strpos($euc_jp,'ÆüËܸì', 0, 'EUC-JP') . "\n";
-print mb_strpos($euc_jp, '0', 0, 'EUC-JP') . "\n";
-print mb_strpos($euc_jp, 3, 0, 'EUC-JP') . "\n";
-print mb_strpos($euc_jp, 0, 0, 'EUC-JP') . "\n";
-print mb_strpos($euc_jp,'ÆüËܸì', 15, 'EUC-JP') . "\n";
-print mb_strpos($euc_jp, '0', 15, 'EUC-JP') . "\n";
-print mb_strpos($euc_jp, 3, 15, 'EUC-JP') . "\n";
-print mb_strpos($euc_jp, 0, 15, 'EUC-JP') . "\n";
-
-// Negative offset
-// Note: PHP Warning - offset is negative.
-// Note: For offset(-15). It does not return position of latter string. (ie the same result as -50)
-echo "== NEGATIVE OFFSET ==\n";
-$r = mb_strpos($euc_jp,'ÆüËܸì', -15, 'EUC-JP');
-($r === FALSE) ? print "OK_NEGATIVE_OFFSET\n" : print "NG_NEGATIVE_OFFSET\n";
-$r = mb_strpos($euc_jp, '0', -15, 'EUC-JP');
-($r === FALSE) ? print "OK_NEGATIVE_OFFSET\n" : print "NG_NEGATIVE_OFFSET\n";
-$r = mb_strpos($euc_jp, 3, -15, 'EUC-JP');
-($r === FALSE) ? print "OK_NEGATIVE_OFFSET\n" : print "NG_NEGATIVE_OFFSET\n";
-$r = mb_strpos($euc_jp, 0, -15, 'EUC-JP');
-($r === FALSE) ? print "OK_NEGATIVE_OFFSET\n" : print "NG_NEGATIVE_OFFSET\n";
-$r = mb_strpos($euc_jp,'ÆüËܸì', -50, 'EUC-JP');
-($r === FALSE) ? print "OK_NEGATIVE_OFFSET\n" : print "NG_NEGATIVE_OFFSET\n";
-$r = mb_strpos($euc_jp, '0', -50, 'EUC-JP');
-($r === FALSE) ? print "OK_NEGATIVE_OFFSET\n" : print "NG_NEGATIVE_OFFSET\n";
-$r = mb_strpos($euc_jp, 3, -50, 'EUC-JP');
-($r === FALSE) ? print "OK_NEGATIVE_OFFSET\n" : print "NG_NEGATIVE_OFFSET\n";
-$r = mb_strpos($euc_jp, 0, -50, 'EUC-JP');
-($r === FALSE) ? print "OK_NEGATIVE_OFFSET\n" : print "NG_NEGATIVE_OFFSET\n";
-
-// Out of range - should return false
-print ("== OUT OF RANGE ==\n");
-$r = mb_strpos($euc_jp,'ÆüËܸì', 40, 'EUC-JP');
-($r === FALSE) ? print "OK_OUT_RANGE\n" : print "NG_OUT_RANGE\n";
-$r = mb_strpos($euc_jp, '0', 40, 'EUC-JP');
-($r === FALSE) ? print "OK_OUT_RANGE\n" : print "NG_OUT_RANGE\n";
-$r = mb_strpos($euc_jp, 3, 40, 'EUC-JP');
-($r === FALSE) ? print "OK_OUT_RANGE\n" : print "NG_OUT_RANGE\n";
-$r = mb_strpos($euc_jp, 0, 40, 'EUC-JP');
-($r === FALSE) ? print "OK_OUT_RANGE\n" : print "NG_OUT_RANGE\n";
-// Note: Returned NULL string
-// echo gettype($r). ' val '. $r ."\n";
-
-
-// Non-existent
-echo "== NON-EXISTENT ==\n";
-$r = mb_strpos($euc_jp, '´Ú¹ñ¸ì', 0, 'EUC-JP');
-($r === FALSE) ? print "OK_STR\n" : print "NG_STR\n";
-$r = mb_strpos($euc_jp, "\n", 0, 'EUC-JP');
-($r === FALSE) ? print "OK_NEWLINE\n" : print "NG_NEWLINE\n";
-
-
-// EUC-JP - No encoding parameter
-echo "== NO ENCODING PARAMETER ==\n";
-mb_internal_encoding('EUC-JP') or print("mb_internal_encoding() failed\n");
-
-print mb_strpos($euc_jp,'ÆüËܸì', 0) . "\n";
-print mb_strpos($euc_jp, '0', 0) . "\n";
-print mb_strpos($euc_jp, 3, 0) . "\n";
-print mb_strpos($euc_jp, 0, 0) . "\n";
-
-$r = mb_strpos($euc_jp,'´Ú¹ñ¸ì', 0);
-($r === FALSE) ? print "OK_STR\n" : print "NG_STR\n";
-$r = mb_strpos($euc_jp,"\n", 0);
-($r === FALSE) ? print "OK_NEWLINE\n" : print "NG_NEWLINE\n";
-
-// EUC-JP - No offset and encoding parameter
-echo "== NO OFFSET AND ENCODING PARAMETER ==\n";
-mb_internal_encoding('EUC-JP') or print("mb_internal_encoding() failed\n");
-
-print mb_strpos($euc_jp,'ÆüËܸì') . "\n";
-print mb_strpos($euc_jp, '0') . "\n";
-print mb_strpos($euc_jp, 3) . "\n";
-print mb_strpos($euc_jp, 0) . "\n";
-
-$r = mb_strpos($euc_jp,'´Ú¹ñ¸ì');
-($r === FALSE) ? print "OK_STR\n" : print "NG_STR\n";
-$r = mb_strpos($euc_jp,"\n");
-($r === FALSE) ? print "OK_NEWLINE\n" : print "NG_NEWLINE\n";
-
-
-// Invalid Parameters
-echo "== INVALID PARAMETER TEST ==\n";
-
-$r = mb_strpos($euc_jp,'','EUC-JP');
-($r === FALSE) ? print("OK_NULL\n") : print("NG_NULL\n");
-$r = mb_strpos($euc_jp, $t_ary, 'EUC-JP');
-($r === FALSE) ? print("OK_ARRAY\n") : print("NG_ARRAY\n");
-$r = mb_strpos($euc_jp, $t_obj, 'EUC-JP');
-($r === FALSE) ? print("OK_OBJECT\n") : print("NG_OBJECT\n");
-$r = mb_strpos($euc_jp, $t_obj, 'BAD_ENCODING');
-($r === FALSE) ? print("OK_BAD_ENCODING\n") : print("NG_BAD_ENCODING\n");
-
-
-?>
-
---EXPECT--
-== POSITIVE OFFSET ==
-10
-0
-3
-0
-34
-30
-33
-30
-== NEGATIVE OFFSET ==
-ERR: Warning
-OK_NEGATIVE_OFFSET
-ERR: Warning
-OK_NEGATIVE_OFFSET
-ERR: Warning
-OK_NEGATIVE_OFFSET
-ERR: Warning
-OK_NEGATIVE_OFFSET
-ERR: Warning
-OK_NEGATIVE_OFFSET
-ERR: Warning
-OK_NEGATIVE_OFFSET
-ERR: Warning
-OK_NEGATIVE_OFFSET
-ERR: Warning
-OK_NEGATIVE_OFFSET
-== OUT OF RANGE ==
-OK_OUT_RANGE
-OK_OUT_RANGE
-OK_OUT_RANGE
-OK_OUT_RANGE
-== NON-EXISTENT ==
-OK_STR
-OK_NEWLINE
-== NO ENCODING PARAMETER ==
-10
-0
-3
-0
-OK_STR
-OK_NEWLINE
-== NO OFFSET AND ENCODING PARAMETER ==
-10
-0
-3
-0
-OK_STR
-OK_NEWLINE
-== INVALID PARAMETER TEST ==
-ERR: Warning
-OK_NULL
-ERR: Warning
-OK_ARRAY
-ERR: Warning
-OK_OBJECT
-ERR: Warning
-OK_BAD_ENCODING
-
diff --git a/ext/mbstring/tests/mb_strwidth.phpt b/ext/mbstring/tests/mb_strwidth.phpt
deleted file mode 100644
index 33ec851c3d..0000000000
--- a/ext/mbstring/tests/mb_strwidth.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-mb_strwidth()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-// TODO: Add more encoding, strings.....
-//$debug = true;
-ini_set('include_path','.');
-include_once('common.inc');
-
-// EUC-JP
-$euc_jp = '0123¤³¤Îʸ»úÎó¤ÏÆüËܸì¤Ç¤¹¡£EUC-JP¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£ÆüËܸì¤ÏÌÌÅݽ­¤¤¡£';
-
-print "1: ". mb_strwidth($euc_jp, 'EUC-JP') . "\n";
-/*
-
-print "2: ". mb_strwidth($euc_jp, 'EUC-JP') . "\n";
-print "3: ". mb_strwidth($euc_jp, 'EUC-JP') . "\n";
-// Note: Did not start form -22 offset. Staring from 0.
-print "4: ". mb_strwidth($euc_jp, 'EUC-JP') . "\n";
-
-$str = mb_strwidth($euc_jp, 100, -10,'...','EUC-JP');
-($str === "") ? print "5 OK\n" : print "NG: $str\n";
-
-$str = mb_strwidth($euc_jp, -100, 10,'...','EUC-JP');
-($str !== "") ? print "6 OK: $str\n" : print "NG: $str\n";
-*/
-?>
-
---EXPECT--
-1: 68
diff --git a/ext/mbstring/tests/mb_substitute_character.phpt b/ext/mbstring/tests/mb_substitute_character.phpt
deleted file mode 100644
index 9f2131080e..0000000000
--- a/ext/mbstring/tests/mb_substitute_character.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-mb_substitute_character()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-//$debug = true;
-ini_set('include_path','.');
-include_once('common.inc');
-
-// Note: It does not return TRUE/FALSE for setting char
-
-// Use Unicode val
-$r = mb_substitute_character(0x3013);
-//$r = mb_substitute_character('U+3013');
-($r === TRUE) ? print "OK_UTF\n" : print("NG_UTF: ".gettype($r)." $r\n");
-print mb_substitute_character() . "\n";
-
-
-// Use "long"
-$r = mb_substitute_character('long');
-($r === TRUE) ? print "OK_LONG\n" : print("NG_LONG: ".gettype($r)." $r\n");
-print mb_substitute_character() . "\n";
-
-
-// Use "none"
-$r = mb_substitute_character('none');
-($r === TRUE) ? print "OK_NONE\n" : print("NG_NONE: ".gettype($r)." $r\n");
-print mb_substitute_character() . "\n";
-
-
-// Set invalid string. Should fail.
-print "== INVALID PARAMETER ==\n";
-$r = mb_substitute_character('BAD_NAME');
-($r === FALSE) ? print "OK_BAD_NAME\n" : print("NG_BAD_NAME: ".gettype($r)." $r\n");
-
-?>
-
---EXPECT--
-OK_UTF
-12307
-OK_LONG
-long
-OK_NONE
-none
-== INVALID PARAMETER ==
-ERR: Warning
-OK_BAD_NAME
-
diff --git a/ext/mbstring/tests/mb_substr.phpt b/ext/mbstring/tests/mb_substr.phpt
deleted file mode 100644
index 893cb64819..0000000000
--- a/ext/mbstring/tests/mb_substr.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-mb_substr()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-output_handler=
---FILE--
-<?php
-// TODO: Add more encodings
-ini_set('include_path','.');
-include_once('common.inc');
-
-// EUC-JP
-$euc_jp = '0123¤³¤Îʸ»úÎó¤ÏÆüËܸì¤Ç¤¹¡£EUC-JP¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£ÆüËܸì¤ÏÌÌÅݽ­¤¤¡£';
-
-print "1: ". mb_substr($euc_jp, 10, 10,'EUC-JP') . "\n";
-print "2: ". mb_substr($euc_jp, 0, 100,'EUC-JP') . "\n";
-
-$str = mb_substr($euc_jp, 100, 10,'EUC-JP');
-// Note: returns last character
-($str === "") ? print "3 OK\n" : print "NG: $str\n";
-
-$str = mb_substr($euc_jp, -100, 10,'EUC-JP');
-($str !== "") ? print "4 OK: $str\n" : print "NG: $str\n";
-
-?>
-
---EXPECT--
-1: ÆüËܸì¤Ç¤¹¡£EUC-
-2: 0123¤³¤Îʸ»úÎó¤ÏÆüËܸì¤Ç¤¹¡£EUC-JP¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£ÆüËܸì¤ÏÌÌÅݽ­¤¤¡£
-3 OK
-4 OK: 0123¤³¤Îʸ»úÎó¤Ï
-
-
diff --git a/ext/mbstring/tests/mb_substr_count.phpt b/ext/mbstring/tests/mb_substr_count.phpt
deleted file mode 100644
index 5be5109375..0000000000
--- a/ext/mbstring/tests/mb_substr_count.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-mb_substr_count()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-output_handler=
---FILE--
-<?php
- mb_internal_encoding("EUC-JP");
- var_dump(@mb_substr_count("", ""));
- var_dump(@mb_substr_count("¤¢", ""));
- var_dump(@mb_substr_count("", "¤¢"));
- var_dump(@mb_substr_count("", "¤¢"));
- var_dump(@mb_substr_count("", chr(0)));
-
- $a = str_repeat("abcacba", 100);
- var_dump(@mb_substr_count($a, "bca"));
-
- $a = str_repeat("¤¢¤¤¤¦¤¢¤¦¤¤¤¢", 100);
- $b = "¤¤¤¦¤¢";
- var_dump(@mb_substr_count($a, $b));
-
- $to_enc = "UTF-8";
- var_dump(@mb_substr_count(mb_convert_encoding($a, $to_enc),
- mb_convert_encoding($b, $to_enc), $to_enc));
-
- $to_enc = "Shift_JIS";
- var_dump(@mb_substr_count(mb_convert_encoding($a, $to_enc),
- mb_convert_encoding($b, $to_enc), $to_enc));
-
- $a = str_repeat("abcacbabca", 100);
- var_dump(@mb_substr_count($a, "bca"));
-?>
---EXPECT--
-bool(false)
-bool(false)
-int(0)
-int(0)
-int(0)
-int(100)
-int(100)
-int(100)
-int(100)
-int(200)
diff --git a/ext/mbstring/tests/overload01.phpt b/ext/mbstring/tests/overload01.phpt
deleted file mode 100644
index b0990e8161..0000000000
--- a/ext/mbstring/tests/overload01.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-Function overloading test 1
---SKIPIF--
-<?php
- extension_loaded('mbstring') or die('skip mbstring not available');
- if (!function_exists("mail")) {
- die('skip mail() function is not available.');
- }
-?>
---INI--
-output_handler=
-mbstring.func_overload=7
-mbstring.internal_encoding=EUC-JP
---FILE--
-<?php
-echo mb_internal_encoding()."\n";
-
-$ngchars = array('ǽ','ɽ','»½','¥½');
-$str = '¸µÏ½ÍÜ»½Ðò¼Òº¾µ½É½¸½Ç½ÎÏɽ¼¨±½ÌÈÄä˽ÎÏŽÉÕ¹½Ê¸·½»ÒͽÃÎñ½Æ¬¥½¥Õ¥¡¡¼';
-var_dump(strlen($str));
-var_dump(mb_strlen($str));
---EXPECT--
-EUC-JP
-int(33)
-int(33)
diff --git a/ext/mbstring/tests/overload02.phpt b/ext/mbstring/tests/overload02.phpt
deleted file mode 100644
index 9b5cecdc40..0000000000
--- a/ext/mbstring/tests/overload02.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Function overloading test 2
---SKIPIF--
-<?php
- extension_loaded('mbstring') or die('skip mbstring not available');
- if (!function_exists("mail")) {
- die('skip mail() function is not available.');
- }
- if (!function_exists("mb_ereg_replace")) {
- die('skip mb_ereg_replace() function is not available.');
- }
-?>
---INI--
-output_handler=
-mbstring.func_overload=7
-mbstring.internal_encoding=EUC-JP
---FILE--
-<?php
-echo mb_internal_encoding()."\n";
-
-$ngchars = array('ǽ','ɽ','»½','¥½');
-$str = '¸µÏ½ÍÜ»½Ðò¼Òº¾µ½É½¸½Ç½ÎÏɽ¼¨±½ÌÈÄä˽ÎÏŽÉÕ¹½Ê¸·½»ÒͽÃÎñ½Æ¬¥½¥Õ¥¡¡¼';
-$converted_str = mb_convert_encoding($str, 'Shift_JIS');
-mb_regex_encoding('Shift_JIS');
-foreach($ngchars as $c) {
- $c = mb_convert_encoding($c, 'Shift_JIS');
- $replaced = mb_convert_encoding(ereg_replace($c, '!!', $converted_str), mb_internal_encoding(), 'Shift_JIS');
- var_dump(strpos($replaced, '!!'));
-}
-?>
---EXPECT--
-EUC-JP
-int(10)
-int(8)
-int(3)
-int(29)
diff --git a/ext/mbstring/tests/php_gr_jp_10830.phpt b/ext/mbstring/tests/php_gr_jp_10830.phpt
deleted file mode 100644
index 85eefd756c..0000000000
--- a/ext/mbstring/tests/php_gr_jp_10830.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-php-users@php.gr.jp #10830
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip mbstring not available');
-function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
-?>
---FILE--
-<?php
-$a="aaa\n<>";
-
-var_dump( mb_ereg("^[^><]+$",$a) );
-var_dump( ereg("^[^><]+$",$a) );
-?>
-
---EXPECT--
-bool(false)
-bool(false)
diff --git a/ext/mbstring/tests/simpletest.phpt b/ext/mbstring/tests/simpletest.phpt
deleted file mode 100644
index 80b2f72596..0000000000
--- a/ext/mbstring/tests/simpletest.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-Simple multi-byte print test (EUC-JP)
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-output_handler=
---FILE--
-<?php
-/*
- * Test basic PHP functions to check if it works with multi-byte chars
- */
-
-// EUC-JP strings
-$s1 = "¥Þ¥ë¥Á¥Ð¥¤¥È´Ø¿ô¤¬»È¤¨¤Þ¤¹¡£";
-$s2 = "¤³¤Îʸ»ú¤¬Ï¢·ë¤µ¤ì¤Æ¤¤¤ë¤Ï¤º¡£";
-
-// print directly
-echo "echo: ".$s1.$s2."\n";
-print("print: ".$s1.$s2."\n");
-printf("printf: %s%s\n",$s1, $s2);
-echo sprintf("sprintf: %s%s\n",$s1, $s2);
-
-// Assign to var
-$s3 = $s1.$s2."\n";
-echo "echo: ".$s3;
-
-?>
---EXPECT--
-echo: ¥Þ¥ë¥Á¥Ð¥¤¥È´Ø¿ô¤¬»È¤¨¤Þ¤¹¡£¤³¤Îʸ»ú¤¬Ï¢·ë¤µ¤ì¤Æ¤¤¤ë¤Ï¤º¡£
-print: ¥Þ¥ë¥Á¥Ð¥¤¥È´Ø¿ô¤¬»È¤¨¤Þ¤¹¡£¤³¤Îʸ»ú¤¬Ï¢·ë¤µ¤ì¤Æ¤¤¤ë¤Ï¤º¡£
-printf: ¥Þ¥ë¥Á¥Ð¥¤¥È´Ø¿ô¤¬»È¤¨¤Þ¤¹¡£¤³¤Îʸ»ú¤¬Ï¢·ë¤µ¤ì¤Æ¤¤¤ë¤Ï¤º¡£
-sprintf: ¥Þ¥ë¥Á¥Ð¥¤¥È´Ø¿ô¤¬»È¤¨¤Þ¤¹¡£¤³¤Îʸ»ú¤¬Ï¢·ë¤µ¤ì¤Æ¤¤¤ë¤Ï¤º¡£
-echo: ¥Þ¥ë¥Á¥Ð¥¤¥È´Ø¿ô¤¬»È¤¨¤Þ¤¹¡£¤³¤Îʸ»ú¤¬Ï¢·ë¤µ¤ì¤Æ¤¤¤ë¤Ï¤º¡£
-
diff --git a/ext/mbstring/tests/skipif.inc b/ext/mbstring/tests/skipif.inc
deleted file mode 100644
index 7eec8aab5a..0000000000
--- a/ext/mbstring/tests/skipif.inc
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-// This script prints "skip" if condition does not meet.
-
-/*
-if (!extension_loaded("mbstring") && ini_get("enable_dl")) {
- $dlext = (substr(PHP_OS, 0, 3) == "WIN") ? ".dll" : ".so";
- @dl("mbstring$dlext");
-}
-*/
-
-if (!extension_loaded("mbstring")) {
- die("skip\n");
-}
-?>
diff --git a/ext/mbstring/tests/zend-multibyte.phpt b/ext/mbstring/tests/zend-multibyte.phpt
deleted file mode 100644
index 9268fdd2f6..0000000000
--- a/ext/mbstring/tests/zend-multibyte.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-zend multibyte
---SKIPIF--
-<?php
-ini_set("mbstring.script_encoding","SJIS");
-if (ini_set("mbstring.script_encoding","SJIS") != "SJIS") {
- die("skip zend-multibyte is not available");
-}
-?>
---INI--
-mbstring.script_encoding=Shift_JIS
-mbstring.internal_encoding=Shift_JIS
---FILE--
-<?php
- function —\Ž\”\($ˆø”)
- {
- echo $ˆø”;
- }
-
- —\Ž\”\("ƒhƒŒƒ~ƒtƒ@ƒ\");
-?>
---EXPECT--
-ƒhƒŒƒ~ƒtƒ@ƒ\
diff --git a/ext/mbstring/unicode_data.h b/ext/mbstring/unicode_data.h
deleted file mode 100644
index 3cdd0735a8..0000000000
--- a/ext/mbstring/unicode_data.h
+++ /dev/null
@@ -1,2738 +0,0 @@
-/* This file holds unicode properties and case folding information.
- * It was generated by a modified version of ucgendat, part of the ucdata-2.5 package */
-
-/* {{{ ctype data */
-static unsigned short _ucprop_size = 0x0032;
-static unsigned short _ucprop_offsets[] = {
-0x0000, 0x00d0, 0x0138, 0x0140, 0x016a, 0x0176, 0x019e,
-0x01ac, 0x01ae, 0x01b0, 0x01b4, 0x01cc, 0x01ce, 0xffff, 0x01d8,
-0x051e, 0x0866, 0x087a, 0x08a2, 0x0a3a, 0x0a48, 0x0a60, 0x0ae0,
-0x0b5c, 0x0be8, 0x0c5c, 0x0c72, 0x0c9e, 0x0d6e, 0x0ff2, 0x100e,
-0x1024, 0x1028, 0x1058, 0x105c, 0x1072, 0x107c, 0x1082, 0x1092,
-0x1244, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x13ec,
-0x16f4, 0x16fe, 0x1706, 0x1730, 0x0000, };
-static unsigned long _ucprop_ranges[] = {
-0x00000300, 0x0000034f, 0x00000360, 0x0000036f,
-0x00000483, 0x00000486, 0x00000591, 0x000005a1, 0x000005a3,
-0x000005b9, 0x000005bb, 0x000005bd, 0x000005bf, 0x000005bf,
-0x000005c1, 0x000005c2, 0x000005c4, 0x000005c4, 0x0000064b,
-0x00000655, 0x00000670, 0x00000670, 0x000006d6, 0x000006dc,
-0x000006df, 0x000006e4, 0x000006e7, 0x000006e8, 0x000006ea,
-0x000006ed, 0x00000711, 0x00000711, 0x00000730, 0x0000074a,
-0x000007a6, 0x000007b0, 0x00000901, 0x00000902, 0x0000093c,
-0x0000093c, 0x00000941, 0x00000948, 0x0000094d, 0x0000094d,
-0x00000951, 0x00000954, 0x00000962, 0x00000963, 0x00000981,
-0x00000981, 0x000009bc, 0x000009bc, 0x000009c1, 0x000009c4,
-0x000009cd, 0x000009cd, 0x000009e2, 0x000009e3, 0x00000a02,
-0x00000a02, 0x00000a3c, 0x00000a3c, 0x00000a41, 0x00000a42,
-0x00000a47, 0x00000a48, 0x00000a4b, 0x00000a4d, 0x00000a70,
-0x00000a71, 0x00000a81, 0x00000a82, 0x00000abc, 0x00000abc,
-0x00000ac1, 0x00000ac5, 0x00000ac7, 0x00000ac8, 0x00000acd,
-0x00000acd, 0x00000b01, 0x00000b01, 0x00000b3c, 0x00000b3c,
-0x00000b3f, 0x00000b3f, 0x00000b41, 0x00000b43, 0x00000b4d,
-0x00000b4d, 0x00000b56, 0x00000b56, 0x00000b82, 0x00000b82,
-0x00000bc0, 0x00000bc0, 0x00000bcd, 0x00000bcd, 0x00000c3e,
-0x00000c40, 0x00000c46, 0x00000c48, 0x00000c4a, 0x00000c4d,
-0x00000c55, 0x00000c56, 0x00000cbf, 0x00000cbf, 0x00000cc6,
-0x00000cc6, 0x00000ccc, 0x00000ccd, 0x00000d41, 0x00000d43,
-0x00000d4d, 0x00000d4d, 0x00000dca, 0x00000dca, 0x00000dd2,
-0x00000dd4, 0x00000dd6, 0x00000dd6, 0x00000e31, 0x00000e31,
-0x00000e34, 0x00000e3a, 0x00000e47, 0x00000e4e, 0x00000eb1,
-0x00000eb1, 0x00000eb4, 0x00000eb9, 0x00000ebb, 0x00000ebc,
-0x00000ec8, 0x00000ecd, 0x00000f18, 0x00000f19, 0x00000f35,
-0x00000f35, 0x00000f37, 0x00000f37, 0x00000f39, 0x00000f39,
-0x00000f71, 0x00000f7e, 0x00000f80, 0x00000f84, 0x00000f86,
-0x00000f87, 0x00000f90, 0x00000f97, 0x00000f99, 0x00000fbc,
-0x00000fc6, 0x00000fc6, 0x0000102d, 0x00001030, 0x00001032,
-0x00001032, 0x00001036, 0x00001037, 0x00001039, 0x00001039,
-0x00001058, 0x00001059, 0x00001712, 0x00001714, 0x00001732,
-0x00001734, 0x00001752, 0x00001753, 0x00001772, 0x00001773,
-0x000017b7, 0x000017bd, 0x000017c6, 0x000017c6, 0x000017c9,
-0x000017d3, 0x0000180b, 0x0000180d, 0x000018a9, 0x000018a9,
-0x000020d0, 0x000020dc, 0x000020e1, 0x000020e1, 0x000020e5,
-0x000020ea, 0x0000302a, 0x0000302f, 0x00003099, 0x0000309a,
-0x0000fb1e, 0x0000fb1e, 0x0000fe00, 0x0000fe0f, 0x0000fe20,
-0x0000fe23, 0x0001d167, 0x0001d169, 0x0001d17b, 0x0001d182,
-0x0001d185, 0x0001d18b, 0x0001d1aa, 0x0001d1ad,
-0x00000903, 0x00000903, 0x0000093e, 0x00000940,
-0x00000949, 0x0000094c, 0x00000982, 0x00000983, 0x000009be,
-0x000009c0, 0x000009c7, 0x000009c8, 0x000009cb, 0x000009cc,
-0x000009d7, 0x000009d7, 0x00000a3e, 0x00000a40, 0x00000a83,
-0x00000a83, 0x00000abe, 0x00000ac0, 0x00000ac9, 0x00000ac9,
-0x00000acb, 0x00000acc, 0x00000b02, 0x00000b03, 0x00000b3e,
-0x00000b3e, 0x00000b40, 0x00000b40, 0x00000b47, 0x00000b48,
-0x00000b4b, 0x00000b4c, 0x00000b57, 0x00000b57, 0x00000bbe,
-0x00000bbf, 0x00000bc1, 0x00000bc2, 0x00000bc6, 0x00000bc8,
-0x00000bca, 0x00000bcc, 0x00000bd7, 0x00000bd7, 0x00000c01,
-0x00000c03, 0x00000c41, 0x00000c44, 0x00000c82, 0x00000c83,
-0x00000cbe, 0x00000cbe, 0x00000cc0, 0x00000cc4, 0x00000cc7,
-0x00000cc8, 0x00000cca, 0x00000ccb, 0x00000cd5, 0x00000cd6,
-0x00000d02, 0x00000d03, 0x00000d3e, 0x00000d40, 0x00000d46,
-0x00000d48, 0x00000d4a, 0x00000d4c, 0x00000d57, 0x00000d57,
-0x00000d82, 0x00000d83, 0x00000dcf, 0x00000dd1, 0x00000dd8,
-0x00000ddf, 0x00000df2, 0x00000df3, 0x00000f3e, 0x00000f3f,
-0x00000f7f, 0x00000f7f, 0x0000102c, 0x0000102c, 0x00001031,
-0x00001031, 0x00001038, 0x00001038, 0x00001056, 0x00001057,
-0x000017b4, 0x000017b6, 0x000017be, 0x000017c5, 0x000017c7,
-0x000017c8, 0x0001d165, 0x0001d166, 0x0001d16d, 0x0001d172,
-0x00000488, 0x00000489, 0x000006de, 0x000006de,
-0x000020dd, 0x000020e0, 0x000020e2, 0x000020e4,
-0x00000030, 0x00000039, 0x00000660, 0x00000669,
-0x000006f0, 0x000006f9, 0x00000966, 0x0000096f, 0x000009e6,
-0x000009ef, 0x00000a66, 0x00000a6f, 0x00000ae6, 0x00000aef,
-0x00000b66, 0x00000b6f, 0x00000be7, 0x00000bef, 0x00000c66,
-0x00000c6f, 0x00000ce6, 0x00000cef, 0x00000d66, 0x00000d6f,
-0x00000e50, 0x00000e59, 0x00000ed0, 0x00000ed9, 0x00000f20,
-0x00000f29, 0x00001040, 0x00001049, 0x00001369, 0x00001371,
-0x000017e0, 0x000017e9, 0x00001810, 0x00001819, 0x0000ff10,
-0x0000ff19, 0x0001d7ce, 0x0001d7ff,
-0x000016ee, 0x000016f0, 0x00002160, 0x00002183,
-0x00003007, 0x00003007, 0x00003021, 0x00003029, 0x00003038,
-0x0000303a, 0x0001034a, 0x0001034a,
-0x000000b2, 0x000000b3, 0x000000b9, 0x000000b9,
-0x000000bc, 0x000000be, 0x000009f4, 0x000009f9, 0x00000bf0,
-0x00000bf2, 0x00000f2a, 0x00000f33, 0x00001372, 0x0000137c,
-0x00002070, 0x00002070, 0x00002074, 0x00002079, 0x00002080,
-0x00002089, 0x00002153, 0x0000215f, 0x00002460, 0x0000249b,
-0x000024ea, 0x000024fe, 0x00002776, 0x00002793, 0x00003192,
-0x00003195, 0x00003220, 0x00003229, 0x00003251, 0x0000325f,
-0x00003280, 0x00003289, 0x000032b1, 0x000032bf, 0x00010320,
-0x00010323,
-0x00000020, 0x00000020, 0x000000a0, 0x000000a0,
-0x00001680, 0x00001680, 0x00002000, 0x0000200b, 0x0000202f,
-0x0000202f, 0x0000205f, 0x0000205f, 0x00003000, 0x00003000,
-0x00002028, 0x00002028,
-0x00002029, 0x00002029,
-0x00000000, 0x0000001f, 0x0000007f, 0x0000009f,
-0x000006dd, 0x000006dd, 0x0000070f, 0x0000070f,
-0x0000180e, 0x0000180e, 0x0000200c, 0x0000200f, 0x0000202a,
-0x0000202e, 0x00002060, 0x00002063, 0x0000206a, 0x0000206f,
-0x0000feff, 0x0000feff, 0x0000fff9, 0x0000fffb, 0x0001d173,
-0x0001d17a, 0x000e0001, 0x000e0001, 0x000e0020, 0x000e007f,
-0x00010000, 0x0010ffff,
-0x0000e000, 0x0000f8ff, 0x000f0000, 0x000f0000,
-0x000ffffd, 0x000ffffd, 0x00100000, 0x00100000, 0x0010fffd,
-0x0010fffd,
-0x00000041, 0x0000005a, 0x000000c0, 0x000000d6,
-0x000000d8, 0x000000de, 0x00000100, 0x00000100, 0x00000102,
-0x00000102, 0x00000104, 0x00000104, 0x00000106, 0x00000106,
-0x00000108, 0x00000108, 0x0000010a, 0x0000010a, 0x0000010c,
-0x0000010c, 0x0000010e, 0x0000010e, 0x00000110, 0x00000110,
-0x00000112, 0x00000112, 0x00000114, 0x00000114, 0x00000116,
-0x00000116, 0x00000118, 0x00000118, 0x0000011a, 0x0000011a,
-0x0000011c, 0x0000011c, 0x0000011e, 0x0000011e, 0x00000120,
-0x00000120, 0x00000122, 0x00000122, 0x00000124, 0x00000124,
-0x00000126, 0x00000126, 0x00000128, 0x00000128, 0x0000012a,
-0x0000012a, 0x0000012c, 0x0000012c, 0x0000012e, 0x0000012e,
-0x00000130, 0x00000130, 0x00000132, 0x00000132, 0x00000134,
-0x00000134, 0x00000136, 0x00000136, 0x00000139, 0x00000139,
-0x0000013b, 0x0000013b, 0x0000013d, 0x0000013d, 0x0000013f,
-0x0000013f, 0x00000141, 0x00000141, 0x00000143, 0x00000143,
-0x00000145, 0x00000145, 0x00000147, 0x00000147, 0x0000014a,
-0x0000014a, 0x0000014c, 0x0000014c, 0x0000014e, 0x0000014e,
-0x00000150, 0x00000150, 0x00000152, 0x00000152, 0x00000154,
-0x00000154, 0x00000156, 0x00000156, 0x00000158, 0x00000158,
-0x0000015a, 0x0000015a, 0x0000015c, 0x0000015c, 0x0000015e,
-0x0000015e, 0x00000160, 0x00000160, 0x00000162, 0x00000162,
-0x00000164, 0x00000164, 0x00000166, 0x00000166, 0x00000168,
-0x00000168, 0x0000016a, 0x0000016a, 0x0000016c, 0x0000016c,
-0x0000016e, 0x0000016e, 0x00000170, 0x00000170, 0x00000172,
-0x00000172, 0x00000174, 0x00000174, 0x00000176, 0x00000176,
-0x00000178, 0x00000179, 0x0000017b, 0x0000017b, 0x0000017d,
-0x0000017d, 0x00000181, 0x00000182, 0x00000184, 0x00000184,
-0x00000186, 0x00000187, 0x00000189, 0x0000018b, 0x0000018e,
-0x00000191, 0x00000193, 0x00000194, 0x00000196, 0x00000198,
-0x0000019c, 0x0000019d, 0x0000019f, 0x000001a0, 0x000001a2,
-0x000001a2, 0x000001a4, 0x000001a4, 0x000001a6, 0x000001a7,
-0x000001a9, 0x000001a9, 0x000001ac, 0x000001ac, 0x000001ae,
-0x000001af, 0x000001b1, 0x000001b3, 0x000001b5, 0x000001b5,
-0x000001b7, 0x000001b8, 0x000001bc, 0x000001bc, 0x000001c4,
-0x000001c4, 0x000001c7, 0x000001c7, 0x000001ca, 0x000001ca,
-0x000001cd, 0x000001cd, 0x000001cf, 0x000001cf, 0x000001d1,
-0x000001d1, 0x000001d3, 0x000001d3, 0x000001d5, 0x000001d5,
-0x000001d7, 0x000001d7, 0x000001d9, 0x000001d9, 0x000001db,
-0x000001db, 0x000001de, 0x000001de, 0x000001e0, 0x000001e0,
-0x000001e2, 0x000001e2, 0x000001e4, 0x000001e4, 0x000001e6,
-0x000001e6, 0x000001e8, 0x000001e8, 0x000001ea, 0x000001ea,
-0x000001ec, 0x000001ec, 0x000001ee, 0x000001ee, 0x000001f1,
-0x000001f1, 0x000001f4, 0x000001f4, 0x000001f6, 0x000001f8,
-0x000001fa, 0x000001fa, 0x000001fc, 0x000001fc, 0x000001fe,
-0x000001fe, 0x00000200, 0x00000200, 0x00000202, 0x00000202,
-0x00000204, 0x00000204, 0x00000206, 0x00000206, 0x00000208,
-0x00000208, 0x0000020a, 0x0000020a, 0x0000020c, 0x0000020c,
-0x0000020e, 0x0000020e, 0x00000210, 0x00000210, 0x00000212,
-0x00000212, 0x00000214, 0x00000214, 0x00000216, 0x00000216,
-0x00000218, 0x00000218, 0x0000021a, 0x0000021a, 0x0000021c,
-0x0000021c, 0x0000021e, 0x0000021e, 0x00000220, 0x00000220,
-0x00000222, 0x00000222, 0x00000224, 0x00000224, 0x00000226,
-0x00000226, 0x00000228, 0x00000228, 0x0000022a, 0x0000022a,
-0x0000022c, 0x0000022c, 0x0000022e, 0x0000022e, 0x00000230,
-0x00000230, 0x00000232, 0x00000232, 0x00000386, 0x00000386,
-0x00000388, 0x0000038a, 0x0000038c, 0x0000038c, 0x0000038e,
-0x0000038f, 0x00000391, 0x000003a1, 0x000003a3, 0x000003ab,
-0x000003d2, 0x000003d4, 0x000003d8, 0x000003d8, 0x000003da,
-0x000003da, 0x000003dc, 0x000003dc, 0x000003de, 0x000003de,
-0x000003e0, 0x000003e0, 0x000003e2, 0x000003e2, 0x000003e4,
-0x000003e4, 0x000003e6, 0x000003e6, 0x000003e8, 0x000003e8,
-0x000003ea, 0x000003ea, 0x000003ec, 0x000003ec, 0x000003ee,
-0x000003ee, 0x000003f4, 0x000003f4, 0x00000400, 0x0000042f,
-0x00000460, 0x00000460, 0x00000462, 0x00000462, 0x00000464,
-0x00000464, 0x00000466, 0x00000466, 0x00000468, 0x00000468,
-0x0000046a, 0x0000046a, 0x0000046c, 0x0000046c, 0x0000046e,
-0x0000046e, 0x00000470, 0x00000470, 0x00000472, 0x00000472,
-0x00000474, 0x00000474, 0x00000476, 0x00000476, 0x00000478,
-0x00000478, 0x0000047a, 0x0000047a, 0x0000047c, 0x0000047c,
-0x0000047e, 0x0000047e, 0x00000480, 0x00000480, 0x0000048a,
-0x0000048a, 0x0000048c, 0x0000048c, 0x0000048e, 0x0000048e,
-0x00000490, 0x00000490, 0x00000492, 0x00000492, 0x00000494,
-0x00000494, 0x00000496, 0x00000496, 0x00000498, 0x00000498,
-0x0000049a, 0x0000049a, 0x0000049c, 0x0000049c, 0x0000049e,
-0x0000049e, 0x000004a0, 0x000004a0, 0x000004a2, 0x000004a2,
-0x000004a4, 0x000004a4, 0x000004a6, 0x000004a6, 0x000004a8,
-0x000004a8, 0x000004aa, 0x000004aa, 0x000004ac, 0x000004ac,
-0x000004ae, 0x000004ae, 0x000004b0, 0x000004b0, 0x000004b2,
-0x000004b2, 0x000004b4, 0x000004b4, 0x000004b6, 0x000004b6,
-0x000004b8, 0x000004b8, 0x000004ba, 0x000004ba, 0x000004bc,
-0x000004bc, 0x000004be, 0x000004be, 0x000004c0, 0x000004c1,
-0x000004c3, 0x000004c3, 0x000004c5, 0x000004c5, 0x000004c7,
-0x000004c7, 0x000004c9, 0x000004c9, 0x000004cb, 0x000004cb,
-0x000004cd, 0x000004cd, 0x000004d0, 0x000004d0, 0x000004d2,
-0x000004d2, 0x000004d4, 0x000004d4, 0x000004d6, 0x000004d6,
-0x000004d8, 0x000004d8, 0x000004da, 0x000004da, 0x000004dc,
-0x000004dc, 0x000004de, 0x000004de, 0x000004e0, 0x000004e0,
-0x000004e2, 0x000004e2, 0x000004e4, 0x000004e4, 0x000004e6,
-0x000004e6, 0x000004e8, 0x000004e8, 0x000004ea, 0x000004ea,
-0x000004ec, 0x000004ec, 0x000004ee, 0x000004ee, 0x000004f0,
-0x000004f0, 0x000004f2, 0x000004f2, 0x000004f4, 0x000004f4,
-0x000004f8, 0x000004f8, 0x00000500, 0x00000500, 0x00000502,
-0x00000502, 0x00000504, 0x00000504, 0x00000506, 0x00000506,
-0x00000508, 0x00000508, 0x0000050a, 0x0000050a, 0x0000050c,
-0x0000050c, 0x0000050e, 0x0000050e, 0x00000531, 0x00000556,
-0x000010a0, 0x000010c5, 0x00001e00, 0x00001e00, 0x00001e02,
-0x00001e02, 0x00001e04, 0x00001e04, 0x00001e06, 0x00001e06,
-0x00001e08, 0x00001e08, 0x00001e0a, 0x00001e0a, 0x00001e0c,
-0x00001e0c, 0x00001e0e, 0x00001e0e, 0x00001e10, 0x00001e10,
-0x00001e12, 0x00001e12, 0x00001e14, 0x00001e14, 0x00001e16,
-0x00001e16, 0x00001e18, 0x00001e18, 0x00001e1a, 0x00001e1a,
-0x00001e1c, 0x00001e1c, 0x00001e1e, 0x00001e1e, 0x00001e20,
-0x00001e20, 0x00001e22, 0x00001e22, 0x00001e24, 0x00001e24,
-0x00001e26, 0x00001e26, 0x00001e28, 0x00001e28, 0x00001e2a,
-0x00001e2a, 0x00001e2c, 0x00001e2c, 0x00001e2e, 0x00001e2e,
-0x00001e30, 0x00001e30, 0x00001e32, 0x00001e32, 0x00001e34,
-0x00001e34, 0x00001e36, 0x00001e36, 0x00001e38, 0x00001e38,
-0x00001e3a, 0x00001e3a, 0x00001e3c, 0x00001e3c, 0x00001e3e,
-0x00001e3e, 0x00001e40, 0x00001e40, 0x00001e42, 0x00001e42,
-0x00001e44, 0x00001e44, 0x00001e46, 0x00001e46, 0x00001e48,
-0x00001e48, 0x00001e4a, 0x00001e4a, 0x00001e4c, 0x00001e4c,
-0x00001e4e, 0x00001e4e, 0x00001e50, 0x00001e50, 0x00001e52,
-0x00001e52, 0x00001e54, 0x00001e54, 0x00001e56, 0x00001e56,
-0x00001e58, 0x00001e58, 0x00001e5a, 0x00001e5a, 0x00001e5c,
-0x00001e5c, 0x00001e5e, 0x00001e5e, 0x00001e60, 0x00001e60,
-0x00001e62, 0x00001e62, 0x00001e64, 0x00001e64, 0x00001e66,
-0x00001e66, 0x00001e68, 0x00001e68, 0x00001e6a, 0x00001e6a,
-0x00001e6c, 0x00001e6c, 0x00001e6e, 0x00001e6e, 0x00001e70,
-0x00001e70, 0x00001e72, 0x00001e72, 0x00001e74, 0x00001e74,
-0x00001e76, 0x00001e76, 0x00001e78, 0x00001e78, 0x00001e7a,
-0x00001e7a, 0x00001e7c, 0x00001e7c, 0x00001e7e, 0x00001e7e,
-0x00001e80, 0x00001e80, 0x00001e82, 0x00001e82, 0x00001e84,
-0x00001e84, 0x00001e86, 0x00001e86, 0x00001e88, 0x00001e88,
-0x00001e8a, 0x00001e8a, 0x00001e8c, 0x00001e8c, 0x00001e8e,
-0x00001e8e, 0x00001e90, 0x00001e90, 0x00001e92, 0x00001e92,
-0x00001e94, 0x00001e94, 0x00001ea0, 0x00001ea0, 0x00001ea2,
-0x00001ea2, 0x00001ea4, 0x00001ea4, 0x00001ea6, 0x00001ea6,
-0x00001ea8, 0x00001ea8, 0x00001eaa, 0x00001eaa, 0x00001eac,
-0x00001eac, 0x00001eae, 0x00001eae, 0x00001eb0, 0x00001eb0,
-0x00001eb2, 0x00001eb2, 0x00001eb4, 0x00001eb4, 0x00001eb6,
-0x00001eb6, 0x00001eb8, 0x00001eb8, 0x00001eba, 0x00001eba,
-0x00001ebc, 0x00001ebc, 0x00001ebe, 0x00001ebe, 0x00001ec0,
-0x00001ec0, 0x00001ec2, 0x00001ec2, 0x00001ec4, 0x00001ec4,
-0x00001ec6, 0x00001ec6, 0x00001ec8, 0x00001ec8, 0x00001eca,
-0x00001eca, 0x00001ecc, 0x00001ecc, 0x00001ece, 0x00001ece,
-0x00001ed0, 0x00001ed0, 0x00001ed2, 0x00001ed2, 0x00001ed4,
-0x00001ed4, 0x00001ed6, 0x00001ed6, 0x00001ed8, 0x00001ed8,
-0x00001eda, 0x00001eda, 0x00001edc, 0x00001edc, 0x00001ede,
-0x00001ede, 0x00001ee0, 0x00001ee0, 0x00001ee2, 0x00001ee2,
-0x00001ee4, 0x00001ee4, 0x00001ee6, 0x00001ee6, 0x00001ee8,
-0x00001ee8, 0x00001eea, 0x00001eea, 0x00001eec, 0x00001eec,
-0x00001eee, 0x00001eee, 0x00001ef0, 0x00001ef0, 0x00001ef2,
-0x00001ef2, 0x00001ef4, 0x00001ef4, 0x00001ef6, 0x00001ef6,
-0x00001ef8, 0x00001ef8, 0x00001f08, 0x00001f0f, 0x00001f18,
-0x00001f1d, 0x00001f28, 0x00001f2f, 0x00001f38, 0x00001f3f,
-0x00001f48, 0x00001f4d, 0x00001f59, 0x00001f59, 0x00001f5b,
-0x00001f5b, 0x00001f5d, 0x00001f5d, 0x00001f5f, 0x00001f5f,
-0x00001f68, 0x00001f6f, 0x00001fb8, 0x00001fbb, 0x00001fc8,
-0x00001fcb, 0x00001fd8, 0x00001fdb, 0x00001fe8, 0x00001fec,
-0x00001ff8, 0x00001ffb, 0x00002102, 0x00002102, 0x00002107,
-0x00002107, 0x0000210b, 0x0000210d, 0x00002110, 0x00002112,
-0x00002115, 0x00002115, 0x00002119, 0x0000211d, 0x00002124,
-0x00002124, 0x00002126, 0x00002126, 0x00002128, 0x00002128,
-0x0000212a, 0x0000212d, 0x00002130, 0x00002131, 0x00002133,
-0x00002133, 0x0000213e, 0x0000213f, 0x00002145, 0x00002145,
-0x0000ff21, 0x0000ff3a, 0x00010400, 0x00010425, 0x0001d400,
-0x0001d419, 0x0001d434, 0x0001d44d, 0x0001d468, 0x0001d481,
-0x0001d49c, 0x0001d49c, 0x0001d49e, 0x0001d49f, 0x0001d4a2,
-0x0001d4a2, 0x0001d4a5, 0x0001d4a6, 0x0001d4a9, 0x0001d4ac,
-0x0001d4ae, 0x0001d4b5, 0x0001d4d0, 0x0001d4e9, 0x0001d504,
-0x0001d505, 0x0001d507, 0x0001d50a, 0x0001d50d, 0x0001d514,
-0x0001d516, 0x0001d51c, 0x0001d538, 0x0001d539, 0x0001d53b,
-0x0001d53e, 0x0001d540, 0x0001d544, 0x0001d546, 0x0001d546,
-0x0001d54a, 0x0001d550, 0x0001d56c, 0x0001d585, 0x0001d5a0,
-0x0001d5b9, 0x0001d5d4, 0x0001d5ed, 0x0001d608, 0x0001d621,
-0x0001d63c, 0x0001d655, 0x0001d670, 0x0001d689, 0x0001d6a8,
-0x0001d6c0, 0x0001d6e2, 0x0001d6fa, 0x0001d71c, 0x0001d734,
-0x0001d756, 0x0001d76e, 0x0001d790, 0x0001d7a8,
-0x00000061, 0x0000007a, 0x000000aa, 0x000000aa,
-0x000000b5, 0x000000b5, 0x000000ba, 0x000000ba, 0x000000df,
-0x000000f6, 0x000000f8, 0x000000ff, 0x00000101, 0x00000101,
-0x00000103, 0x00000103, 0x00000105, 0x00000105, 0x00000107,
-0x00000107, 0x00000109, 0x00000109, 0x0000010b, 0x0000010b,
-0x0000010d, 0x0000010d, 0x0000010f, 0x0000010f, 0x00000111,
-0x00000111, 0x00000113, 0x00000113, 0x00000115, 0x00000115,
-0x00000117, 0x00000117, 0x00000119, 0x00000119, 0x0000011b,
-0x0000011b, 0x0000011d, 0x0000011d, 0x0000011f, 0x0000011f,
-0x00000121, 0x00000121, 0x00000123, 0x00000123, 0x00000125,
-0x00000125, 0x00000127, 0x00000127, 0x00000129, 0x00000129,
-0x0000012b, 0x0000012b, 0x0000012d, 0x0000012d, 0x0000012f,
-0x0000012f, 0x00000131, 0x00000131, 0x00000133, 0x00000133,
-0x00000135, 0x00000135, 0x00000137, 0x00000138, 0x0000013a,
-0x0000013a, 0x0000013c, 0x0000013c, 0x0000013e, 0x0000013e,
-0x00000140, 0x00000140, 0x00000142, 0x00000142, 0x00000144,
-0x00000144, 0x00000146, 0x00000146, 0x00000148, 0x00000149,
-0x0000014b, 0x0000014b, 0x0000014d, 0x0000014d, 0x0000014f,
-0x0000014f, 0x00000151, 0x00000151, 0x00000153, 0x00000153,
-0x00000155, 0x00000155, 0x00000157, 0x00000157, 0x00000159,
-0x00000159, 0x0000015b, 0x0000015b, 0x0000015d, 0x0000015d,
-0x0000015f, 0x0000015f, 0x00000161, 0x00000161, 0x00000163,
-0x00000163, 0x00000165, 0x00000165, 0x00000167, 0x00000167,
-0x00000169, 0x00000169, 0x0000016b, 0x0000016b, 0x0000016d,
-0x0000016d, 0x0000016f, 0x0000016f, 0x00000171, 0x00000171,
-0x00000173, 0x00000173, 0x00000175, 0x00000175, 0x00000177,
-0x00000177, 0x0000017a, 0x0000017a, 0x0000017c, 0x0000017c,
-0x0000017e, 0x00000180, 0x00000183, 0x00000183, 0x00000185,
-0x00000185, 0x00000188, 0x00000188, 0x0000018c, 0x0000018d,
-0x00000192, 0x00000192, 0x00000195, 0x00000195, 0x00000199,
-0x0000019b, 0x0000019e, 0x0000019e, 0x000001a1, 0x000001a1,
-0x000001a3, 0x000001a3, 0x000001a5, 0x000001a5, 0x000001a8,
-0x000001a8, 0x000001aa, 0x000001ab, 0x000001ad, 0x000001ad,
-0x000001b0, 0x000001b0, 0x000001b4, 0x000001b4, 0x000001b6,
-0x000001b6, 0x000001b9, 0x000001ba, 0x000001bd, 0x000001bf,
-0x000001c6, 0x000001c6, 0x000001c9, 0x000001c9, 0x000001cc,
-0x000001cc, 0x000001ce, 0x000001ce, 0x000001d0, 0x000001d0,
-0x000001d2, 0x000001d2, 0x000001d4, 0x000001d4, 0x000001d6,
-0x000001d6, 0x000001d8, 0x000001d8, 0x000001da, 0x000001da,
-0x000001dc, 0x000001dd, 0x000001df, 0x000001df, 0x000001e1,
-0x000001e1, 0x000001e3, 0x000001e3, 0x000001e5, 0x000001e5,
-0x000001e7, 0x000001e7, 0x000001e9, 0x000001e9, 0x000001eb,
-0x000001eb, 0x000001ed, 0x000001ed, 0x000001ef, 0x000001f0,
-0x000001f3, 0x000001f3, 0x000001f5, 0x000001f5, 0x000001f9,
-0x000001f9, 0x000001fb, 0x000001fb, 0x000001fd, 0x000001fd,
-0x000001ff, 0x000001ff, 0x00000201, 0x00000201, 0x00000203,
-0x00000203, 0x00000205, 0x00000205, 0x00000207, 0x00000207,
-0x00000209, 0x00000209, 0x0000020b, 0x0000020b, 0x0000020d,
-0x0000020d, 0x0000020f, 0x0000020f, 0x00000211, 0x00000211,
-0x00000213, 0x00000213, 0x00000215, 0x00000215, 0x00000217,
-0x00000217, 0x00000219, 0x00000219, 0x0000021b, 0x0000021b,
-0x0000021d, 0x0000021d, 0x0000021f, 0x0000021f, 0x00000223,
-0x00000223, 0x00000225, 0x00000225, 0x00000227, 0x00000227,
-0x00000229, 0x00000229, 0x0000022b, 0x0000022b, 0x0000022d,
-0x0000022d, 0x0000022f, 0x0000022f, 0x00000231, 0x00000231,
-0x00000233, 0x00000233, 0x00000250, 0x000002ad, 0x00000390,
-0x00000390, 0x000003ac, 0x000003ce, 0x000003d0, 0x000003d1,
-0x000003d5, 0x000003d7, 0x000003d9, 0x000003d9, 0x000003db,
-0x000003db, 0x000003dd, 0x000003dd, 0x000003df, 0x000003df,
-0x000003e1, 0x000003e1, 0x000003e3, 0x000003e3, 0x000003e5,
-0x000003e5, 0x000003e7, 0x000003e7, 0x000003e9, 0x000003e9,
-0x000003eb, 0x000003eb, 0x000003ed, 0x000003ed, 0x000003ef,
-0x000003f3, 0x000003f5, 0x000003f5, 0x00000430, 0x0000045f,
-0x00000461, 0x00000461, 0x00000463, 0x00000463, 0x00000465,
-0x00000465, 0x00000467, 0x00000467, 0x00000469, 0x00000469,
-0x0000046b, 0x0000046b, 0x0000046d, 0x0000046d, 0x0000046f,
-0x0000046f, 0x00000471, 0x00000471, 0x00000473, 0x00000473,
-0x00000475, 0x00000475, 0x00000477, 0x00000477, 0x00000479,
-0x00000479, 0x0000047b, 0x0000047b, 0x0000047d, 0x0000047d,
-0x0000047f, 0x0000047f, 0x00000481, 0x00000481, 0x0000048b,
-0x0000048b, 0x0000048d, 0x0000048d, 0x0000048f, 0x0000048f,
-0x00000491, 0x00000491, 0x00000493, 0x00000493, 0x00000495,
-0x00000495, 0x00000497, 0x00000497, 0x00000499, 0x00000499,
-0x0000049b, 0x0000049b, 0x0000049d, 0x0000049d, 0x0000049f,
-0x0000049f, 0x000004a1, 0x000004a1, 0x000004a3, 0x000004a3,
-0x000004a5, 0x000004a5, 0x000004a7, 0x000004a7, 0x000004a9,
-0x000004a9, 0x000004ab, 0x000004ab, 0x000004ad, 0x000004ad,
-0x000004af, 0x000004af, 0x000004b1, 0x000004b1, 0x000004b3,
-0x000004b3, 0x000004b5, 0x000004b5, 0x000004b7, 0x000004b7,
-0x000004b9, 0x000004b9, 0x000004bb, 0x000004bb, 0x000004bd,
-0x000004bd, 0x000004bf, 0x000004bf, 0x000004c2, 0x000004c2,
-0x000004c4, 0x000004c4, 0x000004c6, 0x000004c6, 0x000004c8,
-0x000004c8, 0x000004ca, 0x000004ca, 0x000004cc, 0x000004cc,
-0x000004ce, 0x000004ce, 0x000004d1, 0x000004d1, 0x000004d3,
-0x000004d3, 0x000004d5, 0x000004d5, 0x000004d7, 0x000004d7,
-0x000004d9, 0x000004d9, 0x000004db, 0x000004db, 0x000004dd,
-0x000004dd, 0x000004df, 0x000004df, 0x000004e1, 0x000004e1,
-0x000004e3, 0x000004e3, 0x000004e5, 0x000004e5, 0x000004e7,
-0x000004e7, 0x000004e9, 0x000004e9, 0x000004eb, 0x000004eb,
-0x000004ed, 0x000004ed, 0x000004ef, 0x000004ef, 0x000004f1,
-0x000004f1, 0x000004f3, 0x000004f3, 0x000004f5, 0x000004f5,
-0x000004f9, 0x000004f9, 0x00000501, 0x00000501, 0x00000503,
-0x00000503, 0x00000505, 0x00000505, 0x00000507, 0x00000507,
-0x00000509, 0x00000509, 0x0000050b, 0x0000050b, 0x0000050d,
-0x0000050d, 0x0000050f, 0x0000050f, 0x00000561, 0x00000587,
-0x00001e01, 0x00001e01, 0x00001e03, 0x00001e03, 0x00001e05,
-0x00001e05, 0x00001e07, 0x00001e07, 0x00001e09, 0x00001e09,
-0x00001e0b, 0x00001e0b, 0x00001e0d, 0x00001e0d, 0x00001e0f,
-0x00001e0f, 0x00001e11, 0x00001e11, 0x00001e13, 0x00001e13,
-0x00001e15, 0x00001e15, 0x00001e17, 0x00001e17, 0x00001e19,
-0x00001e19, 0x00001e1b, 0x00001e1b, 0x00001e1d, 0x00001e1d,
-0x00001e1f, 0x00001e1f, 0x00001e21, 0x00001e21, 0x00001e23,
-0x00001e23, 0x00001e25, 0x00001e25, 0x00001e27, 0x00001e27,
-0x00001e29, 0x00001e29, 0x00001e2b, 0x00001e2b, 0x00001e2d,
-0x00001e2d, 0x00001e2f, 0x00001e2f, 0x00001e31, 0x00001e31,
-0x00001e33, 0x00001e33, 0x00001e35, 0x00001e35, 0x00001e37,
-0x00001e37, 0x00001e39, 0x00001e39, 0x00001e3b, 0x00001e3b,
-0x00001e3d, 0x00001e3d, 0x00001e3f, 0x00001e3f, 0x00001e41,
-0x00001e41, 0x00001e43, 0x00001e43, 0x00001e45, 0x00001e45,
-0x00001e47, 0x00001e47, 0x00001e49, 0x00001e49, 0x00001e4b,
-0x00001e4b, 0x00001e4d, 0x00001e4d, 0x00001e4f, 0x00001e4f,
-0x00001e51, 0x00001e51, 0x00001e53, 0x00001e53, 0x00001e55,
-0x00001e55, 0x00001e57, 0x00001e57, 0x00001e59, 0x00001e59,
-0x00001e5b, 0x00001e5b, 0x00001e5d, 0x00001e5d, 0x00001e5f,
-0x00001e5f, 0x00001e61, 0x00001e61, 0x00001e63, 0x00001e63,
-0x00001e65, 0x00001e65, 0x00001e67, 0x00001e67, 0x00001e69,
-0x00001e69, 0x00001e6b, 0x00001e6b, 0x00001e6d, 0x00001e6d,
-0x00001e6f, 0x00001e6f, 0x00001e71, 0x00001e71, 0x00001e73,
-0x00001e73, 0x00001e75, 0x00001e75, 0x00001e77, 0x00001e77,
-0x00001e79, 0x00001e79, 0x00001e7b, 0x00001e7b, 0x00001e7d,
-0x00001e7d, 0x00001e7f, 0x00001e7f, 0x00001e81, 0x00001e81,
-0x00001e83, 0x00001e83, 0x00001e85, 0x00001e85, 0x00001e87,
-0x00001e87, 0x00001e89, 0x00001e89, 0x00001e8b, 0x00001e8b,
-0x00001e8d, 0x00001e8d, 0x00001e8f, 0x00001e8f, 0x00001e91,
-0x00001e91, 0x00001e93, 0x00001e93, 0x00001e95, 0x00001e9b,
-0x00001ea1, 0x00001ea1, 0x00001ea3, 0x00001ea3, 0x00001ea5,
-0x00001ea5, 0x00001ea7, 0x00001ea7, 0x00001ea9, 0x00001ea9,
-0x00001eab, 0x00001eab, 0x00001ead, 0x00001ead, 0x00001eaf,
-0x00001eaf, 0x00001eb1, 0x00001eb1, 0x00001eb3, 0x00001eb3,
-0x00001eb5, 0x00001eb5, 0x00001eb7, 0x00001eb7, 0x00001eb9,
-0x00001eb9, 0x00001ebb, 0x00001ebb, 0x00001ebd, 0x00001ebd,
-0x00001ebf, 0x00001ebf, 0x00001ec1, 0x00001ec1, 0x00001ec3,
-0x00001ec3, 0x00001ec5, 0x00001ec5, 0x00001ec7, 0x00001ec7,
-0x00001ec9, 0x00001ec9, 0x00001ecb, 0x00001ecb, 0x00001ecd,
-0x00001ecd, 0x00001ecf, 0x00001ecf, 0x00001ed1, 0x00001ed1,
-0x00001ed3, 0x00001ed3, 0x00001ed5, 0x00001ed5, 0x00001ed7,
-0x00001ed7, 0x00001ed9, 0x00001ed9, 0x00001edb, 0x00001edb,
-0x00001edd, 0x00001edd, 0x00001edf, 0x00001edf, 0x00001ee1,
-0x00001ee1, 0x00001ee3, 0x00001ee3, 0x00001ee5, 0x00001ee5,
-0x00001ee7, 0x00001ee7, 0x00001ee9, 0x00001ee9, 0x00001eeb,
-0x00001eeb, 0x00001eed, 0x00001eed, 0x00001eef, 0x00001eef,
-0x00001ef1, 0x00001ef1, 0x00001ef3, 0x00001ef3, 0x00001ef5,
-0x00001ef5, 0x00001ef7, 0x00001ef7, 0x00001ef9, 0x00001ef9,
-0x00001f00, 0x00001f07, 0x00001f10, 0x00001f15, 0x00001f20,
-0x00001f27, 0x00001f30, 0x00001f37, 0x00001f40, 0x00001f45,
-0x00001f50, 0x00001f57, 0x00001f60, 0x00001f67, 0x00001f70,
-0x00001f7d, 0x00001f80, 0x00001f87, 0x00001f90, 0x00001f97,
-0x00001fa0, 0x00001fa7, 0x00001fb0, 0x00001fb4, 0x00001fb6,
-0x00001fb7, 0x00001fbe, 0x00001fbe, 0x00001fc2, 0x00001fc4,
-0x00001fc6, 0x00001fc7, 0x00001fd0, 0x00001fd3, 0x00001fd6,
-0x00001fd7, 0x00001fe0, 0x00001fe7, 0x00001ff2, 0x00001ff4,
-0x00001ff6, 0x00001ff7, 0x00002071, 0x00002071, 0x0000207f,
-0x0000207f, 0x0000210a, 0x0000210a, 0x0000210e, 0x0000210f,
-0x00002113, 0x00002113, 0x0000212f, 0x0000212f, 0x00002134,
-0x00002134, 0x00002139, 0x00002139, 0x0000213d, 0x0000213d,
-0x00002146, 0x00002149, 0x0000fb00, 0x0000fb06, 0x0000fb13,
-0x0000fb17, 0x0000ff41, 0x0000ff5a, 0x00010428, 0x0001044d,
-0x0001d41a, 0x0001d433, 0x0001d44e, 0x0001d454, 0x0001d456,
-0x0001d467, 0x0001d482, 0x0001d49b, 0x0001d4b6, 0x0001d4b9,
-0x0001d4bb, 0x0001d4bb, 0x0001d4bd, 0x0001d4c0, 0x0001d4c2,
-0x0001d4c3, 0x0001d4c5, 0x0001d4cf, 0x0001d4ea, 0x0001d503,
-0x0001d51e, 0x0001d537, 0x0001d552, 0x0001d56b, 0x0001d586,
-0x0001d59f, 0x0001d5ba, 0x0001d5d3, 0x0001d5ee, 0x0001d607,
-0x0001d622, 0x0001d63b, 0x0001d656, 0x0001d66f, 0x0001d68a,
-0x0001d6a3, 0x0001d6c2, 0x0001d6da, 0x0001d6dc, 0x0001d6e1,
-0x0001d6fc, 0x0001d714, 0x0001d716, 0x0001d71b, 0x0001d736,
-0x0001d74e, 0x0001d750, 0x0001d755, 0x0001d770, 0x0001d788,
-0x0001d78a, 0x0001d78f, 0x0001d7aa, 0x0001d7c2, 0x0001d7c4,
-0x0001d7c9,
-0x000001c5, 0x000001c5, 0x000001c8, 0x000001c8,
-0x000001cb, 0x000001cb, 0x000001f2, 0x000001f2, 0x00001f88,
-0x00001f8f, 0x00001f98, 0x00001f9f, 0x00001fa8, 0x00001faf,
-0x00001fbc, 0x00001fbc, 0x00001fcc, 0x00001fcc, 0x00001ffc,
-0x00001ffc,
-0x000002b0, 0x000002b8, 0x000002bb, 0x000002c1,
-0x000002d0, 0x000002d1, 0x000002e0, 0x000002e4, 0x000002ee,
-0x000002ee, 0x0000037a, 0x0000037a, 0x00000559, 0x00000559,
-0x00000640, 0x00000640, 0x000006e5, 0x000006e6, 0x00000e46,
-0x00000e46, 0x00000ec6, 0x00000ec6, 0x000017d7, 0x000017d7,
-0x00001843, 0x00001843, 0x00003005, 0x00003005, 0x00003031,
-0x00003035, 0x0000303b, 0x0000303b, 0x0000309d, 0x0000309e,
-0x000030fc, 0x000030fe, 0x0000ff70, 0x0000ff70, 0x0000ff9e,
-0x0000ff9f,
-0x000001bb, 0x000001bb, 0x000001c0, 0x000001c3,
-0x000005d0, 0x000005ea, 0x000005f0, 0x000005f2, 0x00000621,
-0x0000063a, 0x00000641, 0x0000064a, 0x0000066e, 0x0000066f,
-0x00000671, 0x000006d3, 0x000006d5, 0x000006d5, 0x000006fa,
-0x000006fc, 0x00000710, 0x00000710, 0x00000712, 0x0000072c,
-0x00000780, 0x000007a5, 0x000007b1, 0x000007b1, 0x00000905,
-0x00000939, 0x0000093d, 0x0000093d, 0x00000950, 0x00000950,
-0x00000958, 0x00000961, 0x00000985, 0x0000098c, 0x0000098f,
-0x00000990, 0x00000993, 0x000009a8, 0x000009aa, 0x000009b0,
-0x000009b2, 0x000009b2, 0x000009b6, 0x000009b9, 0x000009dc,
-0x000009dd, 0x000009df, 0x000009e1, 0x000009f0, 0x000009f1,
-0x00000a05, 0x00000a0a, 0x00000a0f, 0x00000a10, 0x00000a13,
-0x00000a28, 0x00000a2a, 0x00000a30, 0x00000a32, 0x00000a33,
-0x00000a35, 0x00000a36, 0x00000a38, 0x00000a39, 0x00000a59,
-0x00000a5c, 0x00000a5e, 0x00000a5e, 0x00000a72, 0x00000a74,
-0x00000a85, 0x00000a8b, 0x00000a8d, 0x00000a8d, 0x00000a8f,
-0x00000a91, 0x00000a93, 0x00000aa8, 0x00000aaa, 0x00000ab0,
-0x00000ab2, 0x00000ab3, 0x00000ab5, 0x00000ab9, 0x00000abd,
-0x00000abd, 0x00000ad0, 0x00000ad0, 0x00000ae0, 0x00000ae0,
-0x00000b05, 0x00000b0c, 0x00000b0f, 0x00000b10, 0x00000b13,
-0x00000b28, 0x00000b2a, 0x00000b30, 0x00000b32, 0x00000b33,
-0x00000b36, 0x00000b39, 0x00000b3d, 0x00000b3d, 0x00000b5c,
-0x00000b5d, 0x00000b5f, 0x00000b61, 0x00000b83, 0x00000b83,
-0x00000b85, 0x00000b8a, 0x00000b8e, 0x00000b90, 0x00000b92,
-0x00000b95, 0x00000b99, 0x00000b9a, 0x00000b9c, 0x00000b9c,
-0x00000b9e, 0x00000b9f, 0x00000ba3, 0x00000ba4, 0x00000ba8,
-0x00000baa, 0x00000bae, 0x00000bb5, 0x00000bb7, 0x00000bb9,
-0x00000c05, 0x00000c0c, 0x00000c0e, 0x00000c10, 0x00000c12,
-0x00000c28, 0x00000c2a, 0x00000c33, 0x00000c35, 0x00000c39,
-0x00000c60, 0x00000c61, 0x00000c85, 0x00000c8c, 0x00000c8e,
-0x00000c90, 0x00000c92, 0x00000ca8, 0x00000caa, 0x00000cb3,
-0x00000cb5, 0x00000cb9, 0x00000cde, 0x00000cde, 0x00000ce0,
-0x00000ce1, 0x00000d05, 0x00000d0c, 0x00000d0e, 0x00000d10,
-0x00000d12, 0x00000d28, 0x00000d2a, 0x00000d39, 0x00000d60,
-0x00000d61, 0x00000d85, 0x00000d96, 0x00000d9a, 0x00000db1,
-0x00000db3, 0x00000dbb, 0x00000dbd, 0x00000dbd, 0x00000dc0,
-0x00000dc6, 0x00000e01, 0x00000e30, 0x00000e32, 0x00000e33,
-0x00000e40, 0x00000e45, 0x00000e81, 0x00000e82, 0x00000e84,
-0x00000e84, 0x00000e87, 0x00000e88, 0x00000e8a, 0x00000e8a,
-0x00000e8d, 0x00000e8d, 0x00000e94, 0x00000e97, 0x00000e99,
-0x00000e9f, 0x00000ea1, 0x00000ea3, 0x00000ea5, 0x00000ea5,
-0x00000ea7, 0x00000ea7, 0x00000eaa, 0x00000eab, 0x00000ead,
-0x00000eb0, 0x00000eb2, 0x00000eb3, 0x00000ebd, 0x00000ebd,
-0x00000ec0, 0x00000ec4, 0x00000edc, 0x00000edd, 0x00000f00,
-0x00000f00, 0x00000f40, 0x00000f47, 0x00000f49, 0x00000f6a,
-0x00000f88, 0x00000f8b, 0x00001000, 0x00001021, 0x00001023,
-0x00001027, 0x00001029, 0x0000102a, 0x00001050, 0x00001055,
-0x000010d0, 0x000010f8, 0x00001100, 0x00001159, 0x0000115f,
-0x000011a2, 0x000011a8, 0x000011f9, 0x00001200, 0x00001206,
-0x00001208, 0x00001246, 0x00001248, 0x00001248, 0x0000124a,
-0x0000124d, 0x00001250, 0x00001256, 0x00001258, 0x00001258,
-0x0000125a, 0x0000125d, 0x00001260, 0x00001286, 0x00001288,
-0x00001288, 0x0000128a, 0x0000128d, 0x00001290, 0x000012ae,
-0x000012b0, 0x000012b0, 0x000012b2, 0x000012b5, 0x000012b8,
-0x000012be, 0x000012c0, 0x000012c0, 0x000012c2, 0x000012c5,
-0x000012c8, 0x000012ce, 0x000012d0, 0x000012d6, 0x000012d8,
-0x000012ee, 0x000012f0, 0x0000130e, 0x00001310, 0x00001310,
-0x00001312, 0x00001315, 0x00001318, 0x0000131e, 0x00001320,
-0x00001346, 0x00001348, 0x0000135a, 0x000013a0, 0x000013f4,
-0x00001401, 0x0000166c, 0x0000166f, 0x00001676, 0x00001681,
-0x0000169a, 0x000016a0, 0x000016ea, 0x00001700, 0x0000170c,
-0x0000170e, 0x00001711, 0x00001720, 0x00001731, 0x00001740,
-0x00001751, 0x00001760, 0x0000176c, 0x0000176e, 0x00001770,
-0x00001780, 0x000017b3, 0x000017dc, 0x000017dc, 0x00001820,
-0x00001842, 0x00001844, 0x00001877, 0x00001880, 0x000018a8,
-0x00002135, 0x00002138, 0x00003006, 0x00003006, 0x0000303c,
-0x0000303c, 0x00003041, 0x00003096, 0x0000309f, 0x0000309f,
-0x000030a1, 0x000030fa, 0x000030ff, 0x000030ff, 0x00003105,
-0x0000312c, 0x00003131, 0x0000318e, 0x000031a0, 0x000031b7,
-0x000031f0, 0x000031ff, 0x00003400, 0x00003400, 0x00004db5,
-0x00004db5, 0x00004e00, 0x0000a48c, 0x0000ac00, 0x0000d7a3,
-0x0000f900, 0x0000faff, 0x0000fb1d, 0x0000fb1d, 0x0000fb1f,
-0x0000fb28, 0x0000fb2a, 0x0000fb36, 0x0000fb38, 0x0000fb3c,
-0x0000fb3e, 0x0000fb3e, 0x0000fb40, 0x0000fb41, 0x0000fb43,
-0x0000fb44, 0x0000fb46, 0x0000fbb1, 0x0000fbd3, 0x0000fd3d,
-0x0000fd50, 0x0000fd8f, 0x0000fd92, 0x0000fdc7, 0x0000fdf0,
-0x0000fdfb, 0x0000fe70, 0x0000fe74, 0x0000fe76, 0x0000fefc,
-0x0000ff66, 0x0000ff6f, 0x0000ff71, 0x0000ff9d, 0x0000ffa0,
-0x0000ffbe, 0x0000ffc2, 0x0000ffc7, 0x0000ffca, 0x0000ffcf,
-0x0000ffd2, 0x0000ffd7, 0x0000ffda, 0x0000ffdc, 0x00010300,
-0x0001031e, 0x00010330, 0x00010349, 0x00020000, 0x00020000,
-0x0002a6d6, 0x0002a6d6, 0x0002f800, 0x0002fa1d,
-0x0000005f, 0x0000005f, 0x0000203f, 0x00002040,
-0x000030fb, 0x000030fb, 0x0000fe33, 0x0000fe34, 0x0000fe4d,
-0x0000fe4f, 0x0000ff3f, 0x0000ff3f, 0x0000ff65, 0x0000ff65,
-0x0000002d, 0x0000002d, 0x000000ad, 0x000000ad,
-0x0000058a, 0x0000058a, 0x00001806, 0x00001806, 0x00002010,
-0x00002015, 0x0000301c, 0x0000301c, 0x00003030, 0x00003030,
-0x000030a0, 0x000030a0, 0x0000fe31, 0x0000fe32, 0x0000fe58,
-0x0000fe58, 0x0000fe63, 0x0000fe63, 0x0000ff0d, 0x0000ff0d,
-0x00000028, 0x00000028, 0x0000005b, 0x0000005b,
-0x0000007b, 0x0000007b, 0x00000f3a, 0x00000f3a, 0x00000f3c,
-0x00000f3c, 0x0000169b, 0x0000169b, 0x0000201a, 0x0000201a,
-0x0000201e, 0x0000201e, 0x00002045, 0x00002045, 0x0000207d,
-0x0000207d, 0x0000208d, 0x0000208d, 0x00002329, 0x00002329,
-0x000023b4, 0x000023b4, 0x00002768, 0x00002768, 0x0000276a,
-0x0000276a, 0x0000276c, 0x0000276c, 0x0000276e, 0x0000276e,
-0x00002770, 0x00002770, 0x00002772, 0x00002772, 0x00002774,
-0x00002774, 0x000027e6, 0x000027e6, 0x000027e8, 0x000027e8,
-0x000027ea, 0x000027ea, 0x00002983, 0x00002983, 0x00002985,
-0x00002985, 0x00002987, 0x00002987, 0x00002989, 0x00002989,
-0x0000298b, 0x0000298b, 0x0000298d, 0x0000298d, 0x0000298f,
-0x0000298f, 0x00002991, 0x00002991, 0x00002993, 0x00002993,
-0x00002995, 0x00002995, 0x00002997, 0x00002997, 0x000029d8,
-0x000029d8, 0x000029da, 0x000029da, 0x000029fc, 0x000029fc,
-0x00003008, 0x00003008, 0x0000300a, 0x0000300a, 0x0000300c,
-0x0000300c, 0x0000300e, 0x0000300e, 0x00003010, 0x00003010,
-0x00003014, 0x00003014, 0x00003016, 0x00003016, 0x00003018,
-0x00003018, 0x0000301a, 0x0000301a, 0x0000301d, 0x0000301d,
-0x0000fd3e, 0x0000fd3e, 0x0000fe35, 0x0000fe35, 0x0000fe37,
-0x0000fe37, 0x0000fe39, 0x0000fe39, 0x0000fe3b, 0x0000fe3b,
-0x0000fe3d, 0x0000fe3d, 0x0000fe3f, 0x0000fe3f, 0x0000fe41,
-0x0000fe41, 0x0000fe43, 0x0000fe43, 0x0000fe59, 0x0000fe59,
-0x0000fe5b, 0x0000fe5b, 0x0000fe5d, 0x0000fe5d, 0x0000ff08,
-0x0000ff08, 0x0000ff3b, 0x0000ff3b, 0x0000ff5b, 0x0000ff5b,
-0x0000ff5f, 0x0000ff5f, 0x0000ff62, 0x0000ff62,
-0x00000029, 0x00000029, 0x0000005d, 0x0000005d,
-0x0000007d, 0x0000007d, 0x00000f3b, 0x00000f3b, 0x00000f3d,
-0x00000f3d, 0x0000169c, 0x0000169c, 0x00002046, 0x00002046,
-0x0000207e, 0x0000207e, 0x0000208e, 0x0000208e, 0x0000232a,
-0x0000232a, 0x000023b5, 0x000023b5, 0x00002769, 0x00002769,
-0x0000276b, 0x0000276b, 0x0000276d, 0x0000276d, 0x0000276f,
-0x0000276f, 0x00002771, 0x00002771, 0x00002773, 0x00002773,
-0x00002775, 0x00002775, 0x000027e7, 0x000027e7, 0x000027e9,
-0x000027e9, 0x000027eb, 0x000027eb, 0x00002984, 0x00002984,
-0x00002986, 0x00002986, 0x00002988, 0x00002988, 0x0000298a,
-0x0000298a, 0x0000298c, 0x0000298c, 0x0000298e, 0x0000298e,
-0x00002990, 0x00002990, 0x00002992, 0x00002992, 0x00002994,
-0x00002994, 0x00002996, 0x00002996, 0x00002998, 0x00002998,
-0x000029d9, 0x000029d9, 0x000029db, 0x000029db, 0x000029fd,
-0x000029fd, 0x00003009, 0x00003009, 0x0000300b, 0x0000300b,
-0x0000300d, 0x0000300d, 0x0000300f, 0x0000300f, 0x00003011,
-0x00003011, 0x00003015, 0x00003015, 0x00003017, 0x00003017,
-0x00003019, 0x00003019, 0x0000301b, 0x0000301b, 0x0000301e,
-0x0000301f, 0x0000fd3f, 0x0000fd3f, 0x0000fe36, 0x0000fe36,
-0x0000fe38, 0x0000fe38, 0x0000fe3a, 0x0000fe3a, 0x0000fe3c,
-0x0000fe3c, 0x0000fe3e, 0x0000fe3e, 0x0000fe40, 0x0000fe40,
-0x0000fe42, 0x0000fe42, 0x0000fe44, 0x0000fe44, 0x0000fe5a,
-0x0000fe5a, 0x0000fe5c, 0x0000fe5c, 0x0000fe5e, 0x0000fe5e,
-0x0000ff09, 0x0000ff09, 0x0000ff3d, 0x0000ff3d, 0x0000ff5d,
-0x0000ff5d, 0x0000ff60, 0x0000ff60, 0x0000ff63, 0x0000ff63,
-0x00000021, 0x00000023, 0x00000025, 0x00000027,
-0x0000002a, 0x0000002a, 0x0000002c, 0x0000002c, 0x0000002e,
-0x0000002f, 0x0000003a, 0x0000003b, 0x0000003f, 0x00000040,
-0x0000005c, 0x0000005c, 0x000000a1, 0x000000a1, 0x000000b7,
-0x000000b7, 0x000000bf, 0x000000bf, 0x0000037e, 0x0000037e,
-0x00000387, 0x00000387, 0x0000055a, 0x0000055f, 0x00000589,
-0x00000589, 0x000005be, 0x000005be, 0x000005c0, 0x000005c0,
-0x000005c3, 0x000005c3, 0x000005f3, 0x000005f4, 0x0000060c,
-0x0000060c, 0x0000061b, 0x0000061b, 0x0000061f, 0x0000061f,
-0x0000066a, 0x0000066d, 0x000006d4, 0x000006d4, 0x00000700,
-0x0000070d, 0x00000964, 0x00000965, 0x00000970, 0x00000970,
-0x00000df4, 0x00000df4, 0x00000e4f, 0x00000e4f, 0x00000e5a,
-0x00000e5b, 0x00000f04, 0x00000f12, 0x00000f85, 0x00000f85,
-0x0000104a, 0x0000104f, 0x000010fb, 0x000010fb, 0x00001361,
-0x00001368, 0x0000166d, 0x0000166e, 0x000016eb, 0x000016ed,
-0x00001735, 0x00001736, 0x000017d4, 0x000017d6, 0x000017d8,
-0x000017da, 0x00001800, 0x00001805, 0x00001807, 0x0000180a,
-0x00002016, 0x00002017, 0x00002020, 0x00002027, 0x00002030,
-0x00002038, 0x0000203b, 0x0000203e, 0x00002041, 0x00002043,
-0x00002047, 0x00002051, 0x00002057, 0x00002057, 0x000023b6,
-0x000023b6, 0x00003001, 0x00003003, 0x0000303d, 0x0000303d,
-0x0000fe30, 0x0000fe30, 0x0000fe45, 0x0000fe46, 0x0000fe49,
-0x0000fe4c, 0x0000fe50, 0x0000fe52, 0x0000fe54, 0x0000fe57,
-0x0000fe5f, 0x0000fe61, 0x0000fe68, 0x0000fe68, 0x0000fe6a,
-0x0000fe6b, 0x0000ff01, 0x0000ff03, 0x0000ff05, 0x0000ff07,
-0x0000ff0a, 0x0000ff0a, 0x0000ff0c, 0x0000ff0c, 0x0000ff0e,
-0x0000ff0f, 0x0000ff1a, 0x0000ff1b, 0x0000ff1f, 0x0000ff20,
-0x0000ff3c, 0x0000ff3c, 0x0000ff61, 0x0000ff61, 0x0000ff64,
-0x0000ff64,
-0x0000002b, 0x0000002b, 0x0000003c, 0x0000003e,
-0x0000007c, 0x0000007c, 0x0000007e, 0x0000007e, 0x000000ac,
-0x000000ac, 0x000000b1, 0x000000b1, 0x000000d7, 0x000000d7,
-0x000000f7, 0x000000f7, 0x000003f6, 0x000003f6, 0x00002044,
-0x00002044, 0x00002052, 0x00002052, 0x0000207a, 0x0000207c,
-0x0000208a, 0x0000208c, 0x00002140, 0x00002144, 0x0000214b,
-0x0000214b, 0x00002190, 0x00002194, 0x0000219a, 0x0000219b,
-0x000021a0, 0x000021a0, 0x000021a3, 0x000021a3, 0x000021a6,
-0x000021a6, 0x000021ae, 0x000021ae, 0x000021ce, 0x000021cf,
-0x000021d2, 0x000021d2, 0x000021d4, 0x000021d4, 0x000021f4,
-0x000022ff, 0x00002308, 0x0000230b, 0x00002320, 0x00002321,
-0x0000237c, 0x0000237c, 0x0000239b, 0x000023b3, 0x000025b7,
-0x000025b7, 0x000025c1, 0x000025c1, 0x000025f8, 0x000025ff,
-0x0000266f, 0x0000266f, 0x000027d0, 0x000027e5, 0x000027f0,
-0x000027ff, 0x00002900, 0x00002982, 0x00002999, 0x000029d7,
-0x000029dc, 0x000029fb, 0x000029fe, 0x00002aff, 0x0000fb29,
-0x0000fb29, 0x0000fe62, 0x0000fe62, 0x0000fe64, 0x0000fe66,
-0x0000ff0b, 0x0000ff0b, 0x0000ff1c, 0x0000ff1e, 0x0000ff5c,
-0x0000ff5c, 0x0000ff5e, 0x0000ff5e, 0x0000ffe2, 0x0000ffe2,
-0x0000ffe9, 0x0000ffec, 0x0001d6c1, 0x0001d6c1, 0x0001d6db,
-0x0001d6db, 0x0001d6fb, 0x0001d6fb, 0x0001d715, 0x0001d715,
-0x0001d735, 0x0001d735, 0x0001d74f, 0x0001d74f, 0x0001d76f,
-0x0001d76f, 0x0001d789, 0x0001d789, 0x0001d7a9, 0x0001d7a9,
-0x0001d7c3, 0x0001d7c3,
-0x00000024, 0x00000024, 0x000000a2, 0x000000a5,
-0x000009f2, 0x000009f3, 0x00000e3f, 0x00000e3f, 0x000017db,
-0x000017db, 0x000020a0, 0x000020b1, 0x0000fdfc, 0x0000fdfc,
-0x0000fe69, 0x0000fe69, 0x0000ff04, 0x0000ff04, 0x0000ffe0,
-0x0000ffe1, 0x0000ffe5, 0x0000ffe6,
-0x0000005e, 0x0000005e, 0x00000060, 0x00000060,
-0x000000a8, 0x000000a8, 0x000000af, 0x000000af, 0x000000b4,
-0x000000b4, 0x000000b8, 0x000000b8, 0x000002b9, 0x000002ba,
-0x000002c2, 0x000002cf, 0x000002d2, 0x000002df, 0x000002e5,
-0x000002ed, 0x00000374, 0x00000375, 0x00000384, 0x00000385,
-0x00001fbd, 0x00001fbd, 0x00001fbf, 0x00001fc1, 0x00001fcd,
-0x00001fcf, 0x00001fdd, 0x00001fdf, 0x00001fed, 0x00001fef,
-0x00001ffd, 0x00001ffe, 0x0000309b, 0x0000309c, 0x0000ff3e,
-0x0000ff3e, 0x0000ff40, 0x0000ff40, 0x0000ffe3, 0x0000ffe3,
-0x000000a6, 0x000000a7, 0x000000a9, 0x000000a9,
-0x000000ae, 0x000000ae, 0x000000b0, 0x000000b0, 0x000000b6,
-0x000000b6, 0x00000482, 0x00000482, 0x000006e9, 0x000006e9,
-0x000006fd, 0x000006fe, 0x000009fa, 0x000009fa, 0x00000b70,
-0x00000b70, 0x00000f01, 0x00000f03, 0x00000f13, 0x00000f17,
-0x00000f1a, 0x00000f1f, 0x00000f34, 0x00000f34, 0x00000f36,
-0x00000f36, 0x00000f38, 0x00000f38, 0x00000fbe, 0x00000fc5,
-0x00000fc7, 0x00000fcc, 0x00000fcf, 0x00000fcf, 0x00002100,
-0x00002101, 0x00002103, 0x00002106, 0x00002108, 0x00002109,
-0x00002114, 0x00002114, 0x00002116, 0x00002118, 0x0000211e,
-0x00002123, 0x00002125, 0x00002125, 0x00002127, 0x00002127,
-0x00002129, 0x00002129, 0x0000212e, 0x0000212e, 0x00002132,
-0x00002132, 0x0000213a, 0x0000213a, 0x0000214a, 0x0000214a,
-0x00002195, 0x00002199, 0x0000219c, 0x0000219f, 0x000021a1,
-0x000021a2, 0x000021a4, 0x000021a5, 0x000021a7, 0x000021ad,
-0x000021af, 0x000021cd, 0x000021d0, 0x000021d1, 0x000021d3,
-0x000021d3, 0x000021d5, 0x000021f3, 0x00002300, 0x00002307,
-0x0000230c, 0x0000231f, 0x00002322, 0x00002328, 0x0000232b,
-0x0000237b, 0x0000237d, 0x0000239a, 0x000023b7, 0x000023ce,
-0x00002400, 0x00002426, 0x00002440, 0x0000244a, 0x0000249c,
-0x000024e9, 0x00002500, 0x000025b6, 0x000025b8, 0x000025c0,
-0x000025c2, 0x000025f7, 0x00002600, 0x00002613, 0x00002616,
-0x00002617, 0x00002619, 0x0000266e, 0x00002670, 0x0000267d,
-0x00002680, 0x00002689, 0x00002701, 0x00002704, 0x00002706,
-0x00002709, 0x0000270c, 0x00002727, 0x00002729, 0x0000274b,
-0x0000274d, 0x0000274d, 0x0000274f, 0x00002752, 0x00002756,
-0x00002756, 0x00002758, 0x0000275e, 0x00002761, 0x00002767,
-0x00002794, 0x00002794, 0x00002798, 0x000027af, 0x000027b1,
-0x000027be, 0x00002800, 0x000028ff, 0x00002e80, 0x00002e99,
-0x00002e9b, 0x00002ef3, 0x00002f00, 0x00002fd5, 0x00002ff0,
-0x00002ffb, 0x00003004, 0x00003004, 0x00003012, 0x00003013,
-0x00003020, 0x00003020, 0x00003036, 0x00003037, 0x0000303e,
-0x0000303f, 0x00003190, 0x00003191, 0x00003196, 0x0000319f,
-0x00003200, 0x0000321c, 0x0000322a, 0x00003243, 0x00003260,
-0x0000327b, 0x0000327f, 0x0000327f, 0x0000328a, 0x000032b0,
-0x000032c0, 0x000032cb, 0x000032d0, 0x000032fe, 0x00003300,
-0x00003376, 0x0000337b, 0x000033dd, 0x000033e0, 0x000033fe,
-0x0000a490, 0x0000a4c6, 0x0000ffe4, 0x0000ffe4, 0x0000ffe8,
-0x0000ffe8, 0x0000ffed, 0x0000ffee, 0x0000fffc, 0x0000fffd,
-0x0001d000, 0x0001d0f5, 0x0001d100, 0x0001d126, 0x0001d12a,
-0x0001d164, 0x0001d16a, 0x0001d16c, 0x0001d183, 0x0001d184,
-0x0001d18c, 0x0001d1a9, 0x0001d1ae, 0x0001d1dd,
-0x00000041, 0x0000005a, 0x00000061, 0x0000007a,
-0x000000aa, 0x000000aa, 0x000000b5, 0x000000b5, 0x000000ba,
-0x000000ba, 0x000000c0, 0x000000d6, 0x000000d8, 0x000000f6,
-0x000000f8, 0x00000220, 0x00000222, 0x00000233, 0x00000250,
-0x000002ad, 0x000002b0, 0x000002b8, 0x000002bb, 0x000002c1,
-0x000002d0, 0x000002d1, 0x000002e0, 0x000002e4, 0x000002ee,
-0x000002ee, 0x0000037a, 0x0000037a, 0x00000386, 0x00000386,
-0x00000388, 0x0000038a, 0x0000038c, 0x0000038c, 0x0000038e,
-0x000003a1, 0x000003a3, 0x000003ce, 0x000003d0, 0x000003f5,
-0x00000400, 0x00000482, 0x0000048a, 0x000004ce, 0x000004d0,
-0x000004f5, 0x000004f8, 0x000004f9, 0x00000500, 0x0000050f,
-0x00000531, 0x00000556, 0x00000559, 0x0000055f, 0x00000561,
-0x00000587, 0x00000589, 0x00000589, 0x00000903, 0x00000903,
-0x00000905, 0x00000939, 0x0000093d, 0x00000940, 0x00000949,
-0x0000094c, 0x00000950, 0x00000950, 0x00000958, 0x00000961,
-0x00000964, 0x00000970, 0x00000982, 0x00000983, 0x00000985,
-0x0000098c, 0x0000098f, 0x00000990, 0x00000993, 0x000009a8,
-0x000009aa, 0x000009b0, 0x000009b2, 0x000009b2, 0x000009b6,
-0x000009b9, 0x000009be, 0x000009c0, 0x000009c7, 0x000009c8,
-0x000009cb, 0x000009cc, 0x000009d7, 0x000009d7, 0x000009dc,
-0x000009dd, 0x000009df, 0x000009e1, 0x000009e6, 0x000009f1,
-0x000009f4, 0x000009fa, 0x00000a05, 0x00000a0a, 0x00000a0f,
-0x00000a10, 0x00000a13, 0x00000a28, 0x00000a2a, 0x00000a30,
-0x00000a32, 0x00000a33, 0x00000a35, 0x00000a36, 0x00000a38,
-0x00000a39, 0x00000a3e, 0x00000a40, 0x00000a59, 0x00000a5c,
-0x00000a5e, 0x00000a5e, 0x00000a66, 0x00000a6f, 0x00000a72,
-0x00000a74, 0x00000a83, 0x00000a83, 0x00000a85, 0x00000a8b,
-0x00000a8d, 0x00000a8d, 0x00000a8f, 0x00000a91, 0x00000a93,
-0x00000aa8, 0x00000aaa, 0x00000ab0, 0x00000ab2, 0x00000ab3,
-0x00000ab5, 0x00000ab9, 0x00000abd, 0x00000ac0, 0x00000ac9,
-0x00000ac9, 0x00000acb, 0x00000acc, 0x00000ad0, 0x00000ad0,
-0x00000ae0, 0x00000ae0, 0x00000ae6, 0x00000aef, 0x00000b02,
-0x00000b03, 0x00000b05, 0x00000b0c, 0x00000b0f, 0x00000b10,
-0x00000b13, 0x00000b28, 0x00000b2a, 0x00000b30, 0x00000b32,
-0x00000b33, 0x00000b36, 0x00000b39, 0x00000b3d, 0x00000b3e,
-0x00000b40, 0x00000b40, 0x00000b47, 0x00000b48, 0x00000b4b,
-0x00000b4c, 0x00000b57, 0x00000b57, 0x00000b5c, 0x00000b5d,
-0x00000b5f, 0x00000b61, 0x00000b66, 0x00000b70, 0x00000b83,
-0x00000b83, 0x00000b85, 0x00000b8a, 0x00000b8e, 0x00000b90,
-0x00000b92, 0x00000b95, 0x00000b99, 0x00000b9a, 0x00000b9c,
-0x00000b9c, 0x00000b9e, 0x00000b9f, 0x00000ba3, 0x00000ba4,
-0x00000ba8, 0x00000baa, 0x00000bae, 0x00000bb5, 0x00000bb7,
-0x00000bb9, 0x00000bbe, 0x00000bbf, 0x00000bc1, 0x00000bc2,
-0x00000bc6, 0x00000bc8, 0x00000bca, 0x00000bcc, 0x00000bd7,
-0x00000bd7, 0x00000be7, 0x00000bf2, 0x00000c01, 0x00000c03,
-0x00000c05, 0x00000c0c, 0x00000c0e, 0x00000c10, 0x00000c12,
-0x00000c28, 0x00000c2a, 0x00000c33, 0x00000c35, 0x00000c39,
-0x00000c41, 0x00000c44, 0x00000c60, 0x00000c61, 0x00000c66,
-0x00000c6f, 0x00000c82, 0x00000c83, 0x00000c85, 0x00000c8c,
-0x00000c8e, 0x00000c90, 0x00000c92, 0x00000ca8, 0x00000caa,
-0x00000cb3, 0x00000cb5, 0x00000cb9, 0x00000cbe, 0x00000cbe,
-0x00000cc0, 0x00000cc4, 0x00000cc7, 0x00000cc8, 0x00000cca,
-0x00000ccb, 0x00000cd5, 0x00000cd6, 0x00000cde, 0x00000cde,
-0x00000ce0, 0x00000ce1, 0x00000ce6, 0x00000cef, 0x00000d02,
-0x00000d03, 0x00000d05, 0x00000d0c, 0x00000d0e, 0x00000d10,
-0x00000d12, 0x00000d28, 0x00000d2a, 0x00000d39, 0x00000d3e,
-0x00000d40, 0x00000d46, 0x00000d48, 0x00000d4a, 0x00000d4c,
-0x00000d57, 0x00000d57, 0x00000d60, 0x00000d61, 0x00000d66,
-0x00000d6f, 0x00000d82, 0x00000d83, 0x00000d85, 0x00000d96,
-0x00000d9a, 0x00000db1, 0x00000db3, 0x00000dbb, 0x00000dbd,
-0x00000dbd, 0x00000dc0, 0x00000dc6, 0x00000dcf, 0x00000dd1,
-0x00000dd8, 0x00000ddf, 0x00000df2, 0x00000df4, 0x00000e01,
-0x00000e30, 0x00000e32, 0x00000e33, 0x00000e40, 0x00000e46,
-0x00000e4f, 0x00000e5b, 0x00000e81, 0x00000e82, 0x00000e84,
-0x00000e84, 0x00000e87, 0x00000e88, 0x00000e8a, 0x00000e8a,
-0x00000e8d, 0x00000e8d, 0x00000e94, 0x00000e97, 0x00000e99,
-0x00000e9f, 0x00000ea1, 0x00000ea3, 0x00000ea5, 0x00000ea5,
-0x00000ea7, 0x00000ea7, 0x00000eaa, 0x00000eab, 0x00000ead,
-0x00000eb0, 0x00000eb2, 0x00000eb3, 0x00000ebd, 0x00000ebd,
-0x00000ec0, 0x00000ec4, 0x00000ec6, 0x00000ec6, 0x00000ed0,
-0x00000ed9, 0x00000edc, 0x00000edd, 0x00000f00, 0x00000f17,
-0x00000f1a, 0x00000f34, 0x00000f36, 0x00000f36, 0x00000f38,
-0x00000f38, 0x00000f3e, 0x00000f47, 0x00000f49, 0x00000f6a,
-0x00000f7f, 0x00000f7f, 0x00000f85, 0x00000f85, 0x00000f88,
-0x00000f8b, 0x00000fbe, 0x00000fc5, 0x00000fc7, 0x00000fcc,
-0x00000fcf, 0x00000fcf, 0x00001000, 0x00001021, 0x00001023,
-0x00001027, 0x00001029, 0x0000102a, 0x0000102c, 0x0000102c,
-0x00001031, 0x00001031, 0x00001038, 0x00001038, 0x00001040,
-0x00001057, 0x000010a0, 0x000010c5, 0x000010d0, 0x000010f8,
-0x000010fb, 0x000010fb, 0x00001100, 0x00001159, 0x0000115f,
-0x000011a2, 0x000011a8, 0x000011f9, 0x00001200, 0x00001206,
-0x00001208, 0x00001246, 0x00001248, 0x00001248, 0x0000124a,
-0x0000124d, 0x00001250, 0x00001256, 0x00001258, 0x00001258,
-0x0000125a, 0x0000125d, 0x00001260, 0x00001286, 0x00001288,
-0x00001288, 0x0000128a, 0x0000128d, 0x00001290, 0x000012ae,
-0x000012b0, 0x000012b0, 0x000012b2, 0x000012b5, 0x000012b8,
-0x000012be, 0x000012c0, 0x000012c0, 0x000012c2, 0x000012c5,
-0x000012c8, 0x000012ce, 0x000012d0, 0x000012d6, 0x000012d8,
-0x000012ee, 0x000012f0, 0x0000130e, 0x00001310, 0x00001310,
-0x00001312, 0x00001315, 0x00001318, 0x0000131e, 0x00001320,
-0x00001346, 0x00001348, 0x0000135a, 0x00001361, 0x0000137c,
-0x000013a0, 0x000013f4, 0x00001401, 0x00001676, 0x00001681,
-0x0000169a, 0x000016a0, 0x000016f0, 0x00001700, 0x0000170c,
-0x0000170e, 0x00001711, 0x00001720, 0x00001731, 0x00001735,
-0x00001736, 0x00001740, 0x00001751, 0x00001760, 0x0000176c,
-0x0000176e, 0x00001770, 0x00001780, 0x000017b6, 0x000017be,
-0x000017c5, 0x000017c7, 0x000017c8, 0x000017d4, 0x000017da,
-0x000017dc, 0x000017dc, 0x000017e0, 0x000017e9, 0x00001810,
-0x00001819, 0x00001820, 0x00001877, 0x00001880, 0x000018a8,
-0x00001e00, 0x00001e9b, 0x00001ea0, 0x00001ef9, 0x00001f00,
-0x00001f15, 0x00001f18, 0x00001f1d, 0x00001f20, 0x00001f45,
-0x00001f48, 0x00001f4d, 0x00001f50, 0x00001f57, 0x00001f59,
-0x00001f59, 0x00001f5b, 0x00001f5b, 0x00001f5d, 0x00001f5d,
-0x00001f5f, 0x00001f7d, 0x00001f80, 0x00001fb4, 0x00001fb6,
-0x00001fbc, 0x00001fbe, 0x00001fbe, 0x00001fc2, 0x00001fc4,
-0x00001fc6, 0x00001fcc, 0x00001fd0, 0x00001fd3, 0x00001fd6,
-0x00001fdb, 0x00001fe0, 0x00001fec, 0x00001ff2, 0x00001ff4,
-0x00001ff6, 0x00001ffc, 0x0000200e, 0x0000200e, 0x00002071,
-0x00002071, 0x0000207f, 0x0000207f, 0x00002102, 0x00002102,
-0x00002107, 0x00002107, 0x0000210a, 0x00002113, 0x00002115,
-0x00002115, 0x00002119, 0x0000211d, 0x00002124, 0x00002124,
-0x00002126, 0x00002126, 0x00002128, 0x00002128, 0x0000212a,
-0x0000212d, 0x0000212f, 0x00002131, 0x00002133, 0x00002139,
-0x0000213d, 0x0000213f, 0x00002145, 0x00002149, 0x00002160,
-0x00002183, 0x00002336, 0x0000237a, 0x00002395, 0x00002395,
-0x0000249c, 0x000024e9, 0x00003005, 0x00003007, 0x00003021,
-0x00003029, 0x00003031, 0x00003035, 0x00003038, 0x0000303c,
-0x00003041, 0x00003096, 0x0000309d, 0x0000309f, 0x000030a1,
-0x000030fa, 0x000030fc, 0x000030ff, 0x00003105, 0x0000312c,
-0x00003131, 0x0000318e, 0x00003190, 0x000031b7, 0x000031f0,
-0x0000321c, 0x00003220, 0x00003243, 0x00003260, 0x0000327b,
-0x0000327f, 0x000032b0, 0x000032c0, 0x000032cb, 0x000032d0,
-0x000032fe, 0x00003300, 0x00003376, 0x0000337b, 0x000033dd,
-0x000033e0, 0x000033fe, 0x00003400, 0x00003400, 0x00004db5,
-0x00004db5, 0x00004e00, 0x0000a48c, 0x0000ac00, 0x0000d7a3,
-0x0000e000, 0x0000fb06, 0x0000fb13, 0x0000fb17, 0x0000ff21,
-0x0000ff3a, 0x0000ff41, 0x0000ff5a, 0x0000ff66, 0x0000ffbe,
-0x0000ffc2, 0x0000ffc7, 0x0000ffca, 0x0000ffcf, 0x0000ffd2,
-0x0000ffd7, 0x0000ffda, 0x0000ffdc, 0x00010000, 0x0010ffff,
-0x000005be, 0x000005be, 0x000005c0, 0x000005c0,
-0x000005c3, 0x000005c3, 0x000005d0, 0x000005ea, 0x000005f0,
-0x000005f4, 0x0000200f, 0x0000200f, 0x0000fb1d, 0x0000fb1d,
-0x0000fb1f, 0x0000fb28, 0x0000fb2a, 0x0000fb36, 0x0000fb38,
-0x0000fb3c, 0x0000fb3e, 0x0000fb3e, 0x0000fb40, 0x0000fb41,
-0x0000fb43, 0x0000fb44, 0x0000fb46, 0x0000fb4f,
-0x00000030, 0x00000039, 0x000000b2, 0x000000b3,
-0x000000b9, 0x000000b9, 0x000006f0, 0x000006f9, 0x00002070,
-0x00002070, 0x00002074, 0x00002079, 0x00002080, 0x00002089,
-0x00002460, 0x0000249b, 0x000024ea, 0x000024ea, 0x0000ff10,
-0x0000ff19, 0x0001d7ce, 0x0001d7ff,
-0x0000002f, 0x0000002f, 0x0000ff0f, 0x0000ff0f,
-0x00000023, 0x00000025, 0x0000002b, 0x0000002b,
-0x0000002d, 0x0000002d, 0x000000a2, 0x000000a5, 0x000000b0,
-0x000000b1, 0x0000066a, 0x0000066a, 0x000009f2, 0x000009f3,
-0x00000e3f, 0x00000e3f, 0x000017db, 0x000017db, 0x00002030,
-0x00002034, 0x0000207a, 0x0000207b, 0x0000208a, 0x0000208b,
-0x000020a0, 0x000020b1, 0x0000212e, 0x0000212e, 0x00002212,
-0x00002213, 0x0000fb29, 0x0000fb29, 0x0000fe5f, 0x0000fe5f,
-0x0000fe62, 0x0000fe63, 0x0000fe69, 0x0000fe6a, 0x0000ff03,
-0x0000ff05, 0x0000ff0b, 0x0000ff0b, 0x0000ff0d, 0x0000ff0d,
-0x0000ffe0, 0x0000ffe1, 0x0000ffe5, 0x0000ffe6,
-0x00000660, 0x00000669, 0x0000066b, 0x0000066c,
-0x0000002c, 0x0000002c, 0x0000002e, 0x0000002e,
-0x0000003a, 0x0000003a, 0x000000a0, 0x000000a0, 0x0000060c,
-0x0000060c, 0x0000fe50, 0x0000fe50, 0x0000fe52, 0x0000fe52,
-0x0000fe55, 0x0000fe55, 0x0000ff0c, 0x0000ff0c, 0x0000ff0e,
-0x0000ff0e, 0x0000ff1a, 0x0000ff1a,
-0x0000000a, 0x0000000a, 0x0000000d, 0x0000000d,
-0x0000001c, 0x0000001e, 0x00000085, 0x00000085, 0x00002029,
-0x00002029,
-0x00000009, 0x00000009, 0x0000000b, 0x0000000b,
-0x0000001f, 0x0000001f,
-0x0000000c, 0x0000000c, 0x00000020, 0x00000020,
-0x00001680, 0x00001680, 0x00002000, 0x0000200a, 0x00002028,
-0x00002028, 0x0000202f, 0x0000202f, 0x0000205f, 0x0000205f,
-0x00003000, 0x00003000,
-0x00000000, 0x00000008, 0x0000000e, 0x0000001b,
-0x00000021, 0x00000022, 0x00000026, 0x0000002a, 0x0000003b,
-0x00000040, 0x0000005b, 0x00000060, 0x0000007b, 0x00000084,
-0x00000086, 0x0000009f, 0x000000a1, 0x000000a1, 0x000000a6,
-0x000000a9, 0x000000ab, 0x000000af, 0x000000b4, 0x000000b4,
-0x000000b6, 0x000000b8, 0x000000bb, 0x000000bf, 0x000000d7,
-0x000000d7, 0x000000f7, 0x000000f7, 0x000002b9, 0x000002ba,
-0x000002c2, 0x000002cf, 0x000002d2, 0x000002df, 0x000002e5,
-0x000002ed, 0x00000300, 0x0000034f, 0x00000360, 0x0000036f,
-0x00000374, 0x00000375, 0x0000037e, 0x0000037e, 0x00000384,
-0x00000385, 0x00000387, 0x00000387, 0x000003f6, 0x000003f6,
-0x00000483, 0x00000486, 0x00000488, 0x00000489, 0x0000058a,
-0x0000058a, 0x00000591, 0x000005a1, 0x000005a3, 0x000005b9,
-0x000005bb, 0x000005bd, 0x000005bf, 0x000005bf, 0x000005c1,
-0x000005c2, 0x000005c4, 0x000005c4, 0x0000064b, 0x00000655,
-0x00000670, 0x00000670, 0x000006d6, 0x000006dc, 0x000006de,
-0x000006e4, 0x000006e7, 0x000006ed, 0x0000070f, 0x0000070f,
-0x00000711, 0x00000711, 0x00000730, 0x0000074a, 0x000007a6,
-0x000007b0, 0x00000901, 0x00000902, 0x0000093c, 0x0000093c,
-0x00000941, 0x00000948, 0x0000094d, 0x0000094d, 0x00000951,
-0x00000954, 0x00000962, 0x00000963, 0x00000981, 0x00000981,
-0x000009bc, 0x000009bc, 0x000009c1, 0x000009c4, 0x000009cd,
-0x000009cd, 0x000009e2, 0x000009e3, 0x00000a02, 0x00000a02,
-0x00000a3c, 0x00000a3c, 0x00000a41, 0x00000a42, 0x00000a47,
-0x00000a48, 0x00000a4b, 0x00000a4d, 0x00000a70, 0x00000a71,
-0x00000a81, 0x00000a82, 0x00000abc, 0x00000abc, 0x00000ac1,
-0x00000ac5, 0x00000ac7, 0x00000ac8, 0x00000acd, 0x00000acd,
-0x00000b01, 0x00000b01, 0x00000b3c, 0x00000b3c, 0x00000b3f,
-0x00000b3f, 0x00000b41, 0x00000b43, 0x00000b4d, 0x00000b4d,
-0x00000b56, 0x00000b56, 0x00000b82, 0x00000b82, 0x00000bc0,
-0x00000bc0, 0x00000bcd, 0x00000bcd, 0x00000c3e, 0x00000c40,
-0x00000c46, 0x00000c48, 0x00000c4a, 0x00000c4d, 0x00000c55,
-0x00000c56, 0x00000cbf, 0x00000cbf, 0x00000cc6, 0x00000cc6,
-0x00000ccc, 0x00000ccd, 0x00000d41, 0x00000d43, 0x00000d4d,
-0x00000d4d, 0x00000dca, 0x00000dca, 0x00000dd2, 0x00000dd4,
-0x00000dd6, 0x00000dd6, 0x00000e31, 0x00000e31, 0x00000e34,
-0x00000e3a, 0x00000e47, 0x00000e4e, 0x00000eb1, 0x00000eb1,
-0x00000eb4, 0x00000eb9, 0x00000ebb, 0x00000ebc, 0x00000ec8,
-0x00000ecd, 0x00000f18, 0x00000f19, 0x00000f35, 0x00000f35,
-0x00000f37, 0x00000f37, 0x00000f39, 0x00000f3d, 0x00000f71,
-0x00000f7e, 0x00000f80, 0x00000f84, 0x00000f86, 0x00000f87,
-0x00000f90, 0x00000f97, 0x00000f99, 0x00000fbc, 0x00000fc6,
-0x00000fc6, 0x0000102d, 0x00001030, 0x00001032, 0x00001032,
-0x00001036, 0x00001037, 0x00001039, 0x00001039, 0x00001058,
-0x00001059, 0x0000169b, 0x0000169c, 0x00001712, 0x00001714,
-0x00001732, 0x00001734, 0x00001752, 0x00001753, 0x00001772,
-0x00001773, 0x000017b7, 0x000017bd, 0x000017c6, 0x000017c6,
-0x000017c9, 0x000017d3, 0x00001800, 0x0000180e, 0x000018a9,
-0x000018a9, 0x00001fbd, 0x00001fbd, 0x00001fbf, 0x00001fc1,
-0x00001fcd, 0x00001fcf, 0x00001fdd, 0x00001fdf, 0x00001fed,
-0x00001fef, 0x00001ffd, 0x00001ffe, 0x0000200b, 0x0000200d,
-0x00002010, 0x00002027, 0x0000202a, 0x0000202e, 0x00002035,
-0x00002052, 0x00002057, 0x00002057, 0x00002060, 0x00002063,
-0x0000206a, 0x0000206f, 0x0000207c, 0x0000207e, 0x0000208c,
-0x0000208e, 0x000020d0, 0x000020ea, 0x00002100, 0x00002101,
-0x00002103, 0x00002106, 0x00002108, 0x00002109, 0x00002114,
-0x00002114, 0x00002116, 0x00002118, 0x0000211e, 0x00002123,
-0x00002125, 0x00002125, 0x00002127, 0x00002127, 0x00002129,
-0x00002129, 0x00002132, 0x00002132, 0x0000213a, 0x0000213a,
-0x00002140, 0x00002144, 0x0000214a, 0x0000214b, 0x00002153,
-0x0000215f, 0x00002190, 0x00002211, 0x00002214, 0x00002335,
-0x0000237b, 0x00002394, 0x00002396, 0x000023ce, 0x00002400,
-0x00002426, 0x00002440, 0x0000244a, 0x000024eb, 0x000024fe,
-0x00002500, 0x00002613, 0x00002616, 0x00002617, 0x00002619,
-0x0000267d, 0x00002680, 0x00002689, 0x00002701, 0x00002704,
-0x00002706, 0x00002709, 0x0000270c, 0x00002727, 0x00002729,
-0x0000274b, 0x0000274d, 0x0000274d, 0x0000274f, 0x00002752,
-0x00002756, 0x00002756, 0x00002758, 0x0000275e, 0x00002761,
-0x00002794, 0x00002798, 0x000027af, 0x000027b1, 0x000027be,
-0x000027d0, 0x000027eb, 0x000027f0, 0x00002aff, 0x00002e80,
-0x00002e99, 0x00002e9b, 0x00002ef3, 0x00002f00, 0x00002fd5,
-0x00002ff0, 0x00002ffb, 0x00003001, 0x00003004, 0x00003008,
-0x00003020, 0x0000302a, 0x00003030, 0x00003036, 0x00003037,
-0x0000303d, 0x0000303f, 0x00003099, 0x0000309c, 0x000030a0,
-0x000030a0, 0x000030fb, 0x000030fb, 0x00003251, 0x0000325f,
-0x000032b1, 0x000032bf, 0x0000a490, 0x0000a4c6, 0x0000fb1e,
-0x0000fb1e, 0x0000fd3e, 0x0000fd3f, 0x0000fe00, 0x0000fe0f,
-0x0000fe20, 0x0000fe23, 0x0000fe30, 0x0000fe46, 0x0000fe49,
-0x0000fe4f, 0x0000fe51, 0x0000fe51, 0x0000fe54, 0x0000fe54,
-0x0000fe56, 0x0000fe5e, 0x0000fe60, 0x0000fe61, 0x0000fe64,
-0x0000fe66, 0x0000fe68, 0x0000fe68, 0x0000fe6b, 0x0000fe6b,
-0x0000feff, 0x0000feff, 0x0000ff01, 0x0000ff02, 0x0000ff06,
-0x0000ff0a, 0x0000ff1b, 0x0000ff20, 0x0000ff3b, 0x0000ff40,
-0x0000ff5b, 0x0000ff65, 0x0000ffe2, 0x0000ffe4, 0x0000ffe8,
-0x0000ffee, 0x0000fff9, 0x0000fffd, 0x0001d167, 0x0001d169,
-0x0001d173, 0x0001d182, 0x0001d185, 0x0001d18b, 0x0001d1aa,
-0x0001d1ad, 0x000e0001, 0x000e0001, 0x000e0020, 0x000e007f,
-0x000000c0, 0x000000c5, 0x000000c7, 0x000000cf,
-0x000000d1, 0x000000d6, 0x000000d9, 0x000000dd, 0x000000e0,
-0x000000e5, 0x000000e7, 0x000000ef, 0x000000f1, 0x000000f6,
-0x000000f9, 0x000000fd, 0x000000ff, 0x0000010f, 0x00000112,
-0x00000125, 0x00000128, 0x00000130, 0x00000134, 0x00000137,
-0x00000139, 0x0000013e, 0x00000143, 0x00000148, 0x0000014c,
-0x00000151, 0x00000154, 0x00000165, 0x00000168, 0x0000017e,
-0x000001a0, 0x000001a1, 0x000001af, 0x000001b0, 0x000001cd,
-0x000001dc, 0x000001de, 0x000001e3, 0x000001e6, 0x000001f0,
-0x000001f4, 0x000001f5, 0x000001f8, 0x0000021b, 0x0000021e,
-0x0000021f, 0x00000226, 0x00000233, 0x00000340, 0x00000341,
-0x00000343, 0x00000344, 0x00000374, 0x00000374, 0x0000037e,
-0x0000037e, 0x00000385, 0x0000038a, 0x0000038c, 0x0000038c,
-0x0000038e, 0x00000390, 0x000003aa, 0x000003b0, 0x000003ca,
-0x000003ce, 0x000003d3, 0x000003d4, 0x00000400, 0x00000401,
-0x00000403, 0x00000403, 0x00000407, 0x00000407, 0x0000040c,
-0x0000040e, 0x00000419, 0x00000419, 0x00000439, 0x00000439,
-0x00000450, 0x00000451, 0x00000453, 0x00000453, 0x00000457,
-0x00000457, 0x0000045c, 0x0000045e, 0x00000476, 0x00000477,
-0x000004c1, 0x000004c2, 0x000004d0, 0x000004d3, 0x000004d6,
-0x000004d7, 0x000004da, 0x000004df, 0x000004e2, 0x000004e7,
-0x000004ea, 0x000004f5, 0x000004f8, 0x000004f9, 0x00000622,
-0x00000626, 0x000006c0, 0x000006c0, 0x000006c2, 0x000006c2,
-0x000006d3, 0x000006d3, 0x00000929, 0x00000929, 0x00000931,
-0x00000931, 0x00000934, 0x00000934, 0x00000958, 0x0000095f,
-0x000009cb, 0x000009cc, 0x000009dc, 0x000009dd, 0x000009df,
-0x000009df, 0x00000a33, 0x00000a33, 0x00000a36, 0x00000a36,
-0x00000a59, 0x00000a5b, 0x00000a5e, 0x00000a5e, 0x00000b48,
-0x00000b48, 0x00000b4b, 0x00000b4c, 0x00000b5c, 0x00000b5d,
-0x00000b94, 0x00000b94, 0x00000bca, 0x00000bcc, 0x00000c48,
-0x00000c48, 0x00000cc0, 0x00000cc0, 0x00000cc7, 0x00000cc8,
-0x00000cca, 0x00000ccb, 0x00000d4a, 0x00000d4c, 0x00000dda,
-0x00000dda, 0x00000ddc, 0x00000dde, 0x00000f43, 0x00000f43,
-0x00000f4d, 0x00000f4d, 0x00000f52, 0x00000f52, 0x00000f57,
-0x00000f57, 0x00000f5c, 0x00000f5c, 0x00000f69, 0x00000f69,
-0x00000f73, 0x00000f73, 0x00000f75, 0x00000f76, 0x00000f78,
-0x00000f78, 0x00000f81, 0x00000f81, 0x00000f93, 0x00000f93,
-0x00000f9d, 0x00000f9d, 0x00000fa2, 0x00000fa2, 0x00000fa7,
-0x00000fa7, 0x00000fac, 0x00000fac, 0x00000fb9, 0x00000fb9,
-0x00001026, 0x00001026, 0x00001e00, 0x00001e99, 0x00001e9b,
-0x00001e9b, 0x00001ea0, 0x00001ef9, 0x00001f00, 0x00001f15,
-0x00001f18, 0x00001f1d, 0x00001f20, 0x00001f45, 0x00001f48,
-0x00001f4d, 0x00001f50, 0x00001f57, 0x00001f59, 0x00001f59,
-0x00001f5b, 0x00001f5b, 0x00001f5d, 0x00001f5d, 0x00001f5f,
-0x00001f7d, 0x00001f80, 0x00001fb4, 0x00001fb6, 0x00001fbc,
-0x00001fbe, 0x00001fbe, 0x00001fc1, 0x00001fc4, 0x00001fc6,
-0x00001fd3, 0x00001fd6, 0x00001fdb, 0x00001fdd, 0x00001fef,
-0x00001ff2, 0x00001ff4, 0x00001ff6, 0x00001ffd, 0x00002000,
-0x00002001, 0x00002126, 0x00002126, 0x0000212a, 0x0000212b,
-0x0000219a, 0x0000219b, 0x000021ae, 0x000021ae, 0x000021cd,
-0x000021cf, 0x00002204, 0x00002204, 0x00002209, 0x00002209,
-0x0000220c, 0x0000220c, 0x00002224, 0x00002224, 0x00002226,
-0x00002226, 0x00002241, 0x00002241, 0x00002244, 0x00002244,
-0x00002247, 0x00002247, 0x00002249, 0x00002249, 0x00002260,
-0x00002260, 0x00002262, 0x00002262, 0x0000226d, 0x00002271,
-0x00002274, 0x00002275, 0x00002278, 0x00002279, 0x00002280,
-0x00002281, 0x00002284, 0x00002285, 0x00002288, 0x00002289,
-0x000022ac, 0x000022af, 0x000022e0, 0x000022e3, 0x000022ea,
-0x000022ed, 0x00002329, 0x0000232a, 0x00002adc, 0x00002adc,
-0x0000304c, 0x0000304c, 0x0000304e, 0x0000304e, 0x00003050,
-0x00003050, 0x00003052, 0x00003052, 0x00003054, 0x00003054,
-0x00003056, 0x00003056, 0x00003058, 0x00003058, 0x0000305a,
-0x0000305a, 0x0000305c, 0x0000305c, 0x0000305e, 0x0000305e,
-0x00003060, 0x00003060, 0x00003062, 0x00003062, 0x00003065,
-0x00003065, 0x00003067, 0x00003067, 0x00003069, 0x00003069,
-0x00003070, 0x00003071, 0x00003073, 0x00003074, 0x00003076,
-0x00003077, 0x00003079, 0x0000307a, 0x0000307c, 0x0000307d,
-0x00003094, 0x00003094, 0x0000309e, 0x0000309e, 0x000030ac,
-0x000030ac, 0x000030ae, 0x000030ae, 0x000030b0, 0x000030b0,
-0x000030b2, 0x000030b2, 0x000030b4, 0x000030b4, 0x000030b6,
-0x000030b6, 0x000030b8, 0x000030b8, 0x000030ba, 0x000030ba,
-0x000030bc, 0x000030bc, 0x000030be, 0x000030be, 0x000030c0,
-0x000030c0, 0x000030c2, 0x000030c2, 0x000030c5, 0x000030c5,
-0x000030c7, 0x000030c7, 0x000030c9, 0x000030c9, 0x000030d0,
-0x000030d1, 0x000030d3, 0x000030d4, 0x000030d6, 0x000030d7,
-0x000030d9, 0x000030da, 0x000030dc, 0x000030dd, 0x000030f4,
-0x000030f4, 0x000030f7, 0x000030fa, 0x000030fe, 0x000030fe,
-0x0000f902, 0x0000fa0d, 0x0000fa10, 0x0000fa10, 0x0000fa12,
-0x0000fa12, 0x0000fa15, 0x0000fa1e, 0x0000fa20, 0x0000fa20,
-0x0000fa22, 0x0000fa22, 0x0000fa25, 0x0000fa26, 0x0000fa2a,
-0x0000fa2d, 0x0000fa30, 0x0000fa6a, 0x0000fb1d, 0x0000fb1d,
-0x0000fb1f, 0x0000fb1f, 0x0000fb2a, 0x0000fb36, 0x0000fb38,
-0x0000fb3c, 0x0000fb3e, 0x0000fb3e, 0x0000fb40, 0x0000fb41,
-0x0000fb43, 0x0000fb44, 0x0000fb46, 0x0000fb4e, 0x0001d15e,
-0x0001d164, 0x0001d1bb, 0x0001d1c0, 0x0002f800, 0x0002fa1d,
-0x00000000, 0x00000220, 0x00000222, 0x00000233,
-0x00000250, 0x000002ad, 0x000002b0, 0x000002ee, 0x00000300,
-0x0000034f, 0x00000360, 0x0000036f, 0x00000374, 0x00000375,
-0x0000037a, 0x0000037a, 0x0000037e, 0x0000037e, 0x00000384,
-0x0000038a, 0x0000038c, 0x0000038c, 0x0000038e, 0x000003a1,
-0x000003a3, 0x000003ce, 0x000003d0, 0x000003f6, 0x00000400,
-0x00000486, 0x00000488, 0x000004ce, 0x000004d0, 0x000004f5,
-0x000004f8, 0x000004f9, 0x00000500, 0x0000050f, 0x00000531,
-0x00000556, 0x00000559, 0x0000055f, 0x00000561, 0x00000587,
-0x00000589, 0x0000058a, 0x00000591, 0x000005a1, 0x000005a3,
-0x000005b9, 0x000005bb, 0x000005c4, 0x000005d0, 0x000005ea,
-0x000005f0, 0x000005f4, 0x0000060c, 0x0000060c, 0x0000061b,
-0x0000061b, 0x0000061f, 0x0000061f, 0x00000621, 0x0000063a,
-0x00000640, 0x00000655, 0x00000660, 0x000006ed, 0x000006f0,
-0x000006fe, 0x00000700, 0x0000070d, 0x0000070f, 0x0000072c,
-0x00000730, 0x0000074a, 0x00000780, 0x000007b1, 0x00000901,
-0x00000903, 0x00000905, 0x00000939, 0x0000093c, 0x0000094d,
-0x00000950, 0x00000954, 0x00000958, 0x00000970, 0x00000981,
-0x00000983, 0x00000985, 0x0000098c, 0x0000098f, 0x00000990,
-0x00000993, 0x000009a8, 0x000009aa, 0x000009b0, 0x000009b2,
-0x000009b2, 0x000009b6, 0x000009b9, 0x000009bc, 0x000009bc,
-0x000009be, 0x000009c4, 0x000009c7, 0x000009c8, 0x000009cb,
-0x000009cd, 0x000009d7, 0x000009d7, 0x000009dc, 0x000009dd,
-0x000009df, 0x000009e3, 0x000009e6, 0x000009fa, 0x00000a02,
-0x00000a02, 0x00000a05, 0x00000a0a, 0x00000a0f, 0x00000a10,
-0x00000a13, 0x00000a28, 0x00000a2a, 0x00000a30, 0x00000a32,
-0x00000a33, 0x00000a35, 0x00000a36, 0x00000a38, 0x00000a39,
-0x00000a3c, 0x00000a3c, 0x00000a3e, 0x00000a42, 0x00000a47,
-0x00000a48, 0x00000a4b, 0x00000a4d, 0x00000a59, 0x00000a5c,
-0x00000a5e, 0x00000a5e, 0x00000a66, 0x00000a74, 0x00000a81,
-0x00000a83, 0x00000a85, 0x00000a8b, 0x00000a8d, 0x00000a8d,
-0x00000a8f, 0x00000a91, 0x00000a93, 0x00000aa8, 0x00000aaa,
-0x00000ab0, 0x00000ab2, 0x00000ab3, 0x00000ab5, 0x00000ab9,
-0x00000abc, 0x00000ac5, 0x00000ac7, 0x00000ac9, 0x00000acb,
-0x00000acd, 0x00000ad0, 0x00000ad0, 0x00000ae0, 0x00000ae0,
-0x00000ae6, 0x00000aef, 0x00000b01, 0x00000b03, 0x00000b05,
-0x00000b0c, 0x00000b0f, 0x00000b10, 0x00000b13, 0x00000b28,
-0x00000b2a, 0x00000b30, 0x00000b32, 0x00000b33, 0x00000b36,
-0x00000b39, 0x00000b3c, 0x00000b43, 0x00000b47, 0x00000b48,
-0x00000b4b, 0x00000b4d, 0x00000b56, 0x00000b57, 0x00000b5c,
-0x00000b5d, 0x00000b5f, 0x00000b61, 0x00000b66, 0x00000b70,
-0x00000b82, 0x00000b83, 0x00000b85, 0x00000b8a, 0x00000b8e,
-0x00000b90, 0x00000b92, 0x00000b95, 0x00000b99, 0x00000b9a,
-0x00000b9c, 0x00000b9c, 0x00000b9e, 0x00000b9f, 0x00000ba3,
-0x00000ba4, 0x00000ba8, 0x00000baa, 0x00000bae, 0x00000bb5,
-0x00000bb7, 0x00000bb9, 0x00000bbe, 0x00000bc2, 0x00000bc6,
-0x00000bc8, 0x00000bca, 0x00000bcd, 0x00000bd7, 0x00000bd7,
-0x00000be7, 0x00000bf2, 0x00000c01, 0x00000c03, 0x00000c05,
-0x00000c0c, 0x00000c0e, 0x00000c10, 0x00000c12, 0x00000c28,
-0x00000c2a, 0x00000c33, 0x00000c35, 0x00000c39, 0x00000c3e,
-0x00000c44, 0x00000c46, 0x00000c48, 0x00000c4a, 0x00000c4d,
-0x00000c55, 0x00000c56, 0x00000c60, 0x00000c61, 0x00000c66,
-0x00000c6f, 0x00000c82, 0x00000c83, 0x00000c85, 0x00000c8c,
-0x00000c8e, 0x00000c90, 0x00000c92, 0x00000ca8, 0x00000caa,
-0x00000cb3, 0x00000cb5, 0x00000cb9, 0x00000cbe, 0x00000cc4,
-0x00000cc6, 0x00000cc8, 0x00000cca, 0x00000ccd, 0x00000cd5,
-0x00000cd6, 0x00000cde, 0x00000cde, 0x00000ce0, 0x00000ce1,
-0x00000ce6, 0x00000cef, 0x00000d02, 0x00000d03, 0x00000d05,
-0x00000d0c, 0x00000d0e, 0x00000d10, 0x00000d12, 0x00000d28,
-0x00000d2a, 0x00000d39, 0x00000d3e, 0x00000d43, 0x00000d46,
-0x00000d48, 0x00000d4a, 0x00000d4d, 0x00000d57, 0x00000d57,
-0x00000d60, 0x00000d61, 0x00000d66, 0x00000d6f, 0x00000d82,
-0x00000d83, 0x00000d85, 0x00000d96, 0x00000d9a, 0x00000db1,
-0x00000db3, 0x00000dbb, 0x00000dbd, 0x00000dbd, 0x00000dc0,
-0x00000dc6, 0x00000dca, 0x00000dca, 0x00000dcf, 0x00000dd4,
-0x00000dd6, 0x00000dd6, 0x00000dd8, 0x00000ddf, 0x00000df2,
-0x00000df4, 0x00000e01, 0x00000e3a, 0x00000e3f, 0x00000e5b,
-0x00000e81, 0x00000e82, 0x00000e84, 0x00000e84, 0x00000e87,
-0x00000e88, 0x00000e8a, 0x00000e8a, 0x00000e8d, 0x00000e8d,
-0x00000e94, 0x00000e97, 0x00000e99, 0x00000e9f, 0x00000ea1,
-0x00000ea3, 0x00000ea5, 0x00000ea5, 0x00000ea7, 0x00000ea7,
-0x00000eaa, 0x00000eab, 0x00000ead, 0x00000eb9, 0x00000ebb,
-0x00000ebd, 0x00000ec0, 0x00000ec4, 0x00000ec6, 0x00000ec6,
-0x00000ec8, 0x00000ecd, 0x00000ed0, 0x00000ed9, 0x00000edc,
-0x00000edd, 0x00000f00, 0x00000f47, 0x00000f49, 0x00000f6a,
-0x00000f71, 0x00000f8b, 0x00000f90, 0x00000f97, 0x00000f99,
-0x00000fbc, 0x00000fbe, 0x00000fcc, 0x00000fcf, 0x00000fcf,
-0x00001000, 0x00001021, 0x00001023, 0x00001027, 0x00001029,
-0x0000102a, 0x0000102c, 0x00001032, 0x00001036, 0x00001039,
-0x00001040, 0x00001059, 0x000010a0, 0x000010c5, 0x000010d0,
-0x000010f8, 0x000010fb, 0x000010fb, 0x00001100, 0x00001159,
-0x0000115f, 0x000011a2, 0x000011a8, 0x000011f9, 0x00001200,
-0x00001206, 0x00001208, 0x00001246, 0x00001248, 0x00001248,
-0x0000124a, 0x0000124d, 0x00001250, 0x00001256, 0x00001258,
-0x00001258, 0x0000125a, 0x0000125d, 0x00001260, 0x00001286,
-0x00001288, 0x00001288, 0x0000128a, 0x0000128d, 0x00001290,
-0x000012ae, 0x000012b0, 0x000012b0, 0x000012b2, 0x000012b5,
-0x000012b8, 0x000012be, 0x000012c0, 0x000012c0, 0x000012c2,
-0x000012c5, 0x000012c8, 0x000012ce, 0x000012d0, 0x000012d6,
-0x000012d8, 0x000012ee, 0x000012f0, 0x0000130e, 0x00001310,
-0x00001310, 0x00001312, 0x00001315, 0x00001318, 0x0000131e,
-0x00001320, 0x00001346, 0x00001348, 0x0000135a, 0x00001361,
-0x0000137c, 0x000013a0, 0x000013f4, 0x00001401, 0x00001676,
-0x00001680, 0x0000169c, 0x000016a0, 0x000016f0, 0x00001700,
-0x0000170c, 0x0000170e, 0x00001714, 0x00001720, 0x00001736,
-0x00001740, 0x00001753, 0x00001760, 0x0000176c, 0x0000176e,
-0x00001770, 0x00001772, 0x00001773, 0x00001780, 0x000017dc,
-0x000017e0, 0x000017e9, 0x00001800, 0x0000180e, 0x00001810,
-0x00001819, 0x00001820, 0x00001877, 0x00001880, 0x000018a9,
-0x00001e00, 0x00001e9b, 0x00001ea0, 0x00001ef9, 0x00001f00,
-0x00001f15, 0x00001f18, 0x00001f1d, 0x00001f20, 0x00001f45,
-0x00001f48, 0x00001f4d, 0x00001f50, 0x00001f57, 0x00001f59,
-0x00001f59, 0x00001f5b, 0x00001f5b, 0x00001f5d, 0x00001f5d,
-0x00001f5f, 0x00001f7d, 0x00001f80, 0x00001fb4, 0x00001fb6,
-0x00001fc4, 0x00001fc6, 0x00001fd3, 0x00001fd6, 0x00001fdb,
-0x00001fdd, 0x00001fef, 0x00001ff2, 0x00001ff4, 0x00001ff6,
-0x00001ffe, 0x00002000, 0x00002052, 0x00002057, 0x00002057,
-0x0000205f, 0x00002063, 0x0000206a, 0x00002071, 0x00002074,
-0x0000208e, 0x000020a0, 0x000020b1, 0x000020d0, 0x000020ea,
-0x00002100, 0x0000213a, 0x0000213d, 0x0000214b, 0x00002153,
-0x00002183, 0x00002190, 0x000023ce, 0x00002400, 0x00002426,
-0x00002440, 0x0000244a, 0x00002460, 0x000024fe, 0x00002500,
-0x00002613, 0x00002616, 0x00002617, 0x00002619, 0x0000267d,
-0x00002680, 0x00002689, 0x00002701, 0x00002704, 0x00002706,
-0x00002709, 0x0000270c, 0x00002727, 0x00002729, 0x0000274b,
-0x0000274d, 0x0000274d, 0x0000274f, 0x00002752, 0x00002756,
-0x00002756, 0x00002758, 0x0000275e, 0x00002761, 0x00002794,
-0x00002798, 0x000027af, 0x000027b1, 0x000027be, 0x000027d0,
-0x000027eb, 0x000027f0, 0x00002aff, 0x00002e80, 0x00002e99,
-0x00002e9b, 0x00002ef3, 0x00002f00, 0x00002fd5, 0x00002ff0,
-0x00002ffb, 0x00003000, 0x0000303f, 0x00003041, 0x00003096,
-0x00003099, 0x000030ff, 0x00003105, 0x0000312c, 0x00003131,
-0x0000318e, 0x00003190, 0x000031b7, 0x000031f0, 0x0000321c,
-0x00003220, 0x00003243, 0x00003251, 0x0000327b, 0x0000327f,
-0x000032cb, 0x000032d0, 0x000032fe, 0x00003300, 0x00003376,
-0x0000337b, 0x000033dd, 0x000033e0, 0x000033fe, 0x00003400,
-0x00003400, 0x00004db5, 0x00004db5, 0x00004e00, 0x00009fa5,
-0x0000a000, 0x0000a48c, 0x0000a490, 0x0000a4c6, 0x0000ac00,
-0x0000d7a3, 0x0000f900, 0x0000fb06, 0x0000fb13, 0x0000fb17,
-0x0000fb1d, 0x0000fb36, 0x0000fb38, 0x0000fb3c, 0x0000fb3e,
-0x0000fb3e, 0x0000fb40, 0x0000fb41, 0x0000fb43, 0x0000fb44,
-0x0000fb46, 0x0000fbb1, 0x0000fbd3, 0x0000fd3f, 0x0000fd50,
-0x0000fd8f, 0x0000fd92, 0x0000fdc7, 0x0000fdf0, 0x0000fdfc,
-0x0000fe00, 0x0000fe0f, 0x0000fe20, 0x0000fe23, 0x0000fe30,
-0x0000fe46, 0x0000fe49, 0x0000fe52, 0x0000fe54, 0x0000fe66,
-0x0000fe68, 0x0000fe6b, 0x0000fe70, 0x0000fe74, 0x0000fe76,
-0x0000fefc, 0x0000feff, 0x0000feff, 0x0000ff01, 0x0000ffbe,
-0x0000ffc2, 0x0000ffc7, 0x0000ffca, 0x0000ffcf, 0x0000ffd2,
-0x0000ffd7, 0x0000ffda, 0x0000ffdc, 0x0000ffe0, 0x0000ffe6,
-0x0000ffe8, 0x0000ffee, 0x0000fff9, 0x0000fffd, 0x00010300,
-0x0001031e, 0x00010320, 0x00010323, 0x00010330, 0x0001034a,
-0x00010400, 0x00010425, 0x00010428, 0x0001044d, 0x0001d000,
-0x0001d0f5, 0x0001d100, 0x0001d126, 0x0001d12a, 0x0001d1dd,
-0x0001d400, 0x0001d454, 0x0001d456, 0x0001d49c, 0x0001d49e,
-0x0001d49f, 0x0001d4a2, 0x0001d4a2, 0x0001d4a5, 0x0001d4a6,
-0x0001d4a9, 0x0001d4ac, 0x0001d4ae, 0x0001d4b9, 0x0001d4bb,
-0x0001d4bb, 0x0001d4bd, 0x0001d4c0, 0x0001d4c2, 0x0001d4c3,
-0x0001d4c5, 0x0001d505, 0x0001d507, 0x0001d50a, 0x0001d50d,
-0x0001d514, 0x0001d516, 0x0001d51c, 0x0001d51e, 0x0001d539,
-0x0001d53b, 0x0001d53e, 0x0001d540, 0x0001d544, 0x0001d546,
-0x0001d546, 0x0001d54a, 0x0001d550, 0x0001d552, 0x0001d6a3,
-0x0001d6a8, 0x0001d7c9, 0x0001d7ce, 0x0001d7ff, 0x00020000,
-0x00020000, 0x0002a6d6, 0x0002a6d6, 0x0002f800, 0x0002fa1d,
-0x000e0001, 0x000e0001, 0x000e0020, 0x000e007f, 0x000f0000,
-0x000f0000, 0x000ffffd, 0x000ffffd, 0x00100000, 0x00100000,
-0x0010fffd, 0x0010fffd,
-0x000000ab, 0x000000ab, 0x00002018, 0x00002018,
-0x0000201b, 0x0000201c, 0x0000201f, 0x0000201f, 0x00002039,
-0x00002039,
-0x000000bb, 0x000000bb, 0x00002019, 0x00002019,
-0x0000201d, 0x0000201d, 0x0000203a, 0x0000203a,
-0x0000061b, 0x0000061b, 0x0000061f, 0x0000061f,
-0x00000621, 0x0000063a, 0x00000640, 0x0000064a, 0x0000066d,
-0x0000066f, 0x00000671, 0x000006d5, 0x000006dd, 0x000006dd,
-0x000006e5, 0x000006e6, 0x000006fa, 0x000006fe, 0x00000700,
-0x0000070d, 0x00000710, 0x00000710, 0x00000712, 0x0000072c,
-0x00000780, 0x000007a5, 0x000007b1, 0x000007b1, 0x0000fb50,
-0x0000fbb1, 0x0000fbd3, 0x0000fd3d, 0x0000fd50, 0x0000fd8f,
-0x0000fd92, 0x0000fdc7, 0x0000fdf0, 0x0000fdfc, 0x0000fe70,
-0x0000fe74, 0x0000fe76, 0x0000fefc,
-};
-/* }}} */
-/* {{{ case data */
-static unsigned short _uccase_size = 0x05e0;
-static unsigned short _uccase_len[2] = { 0x08bb, 0x08d9 };
-static unsigned long _uccase_map[] = {
-/* upper */
-0x00000041, 0x00000061, 0x00000041,
-0x00000042, 0x00000062, 0x00000042,
-0x00000043, 0x00000063, 0x00000043,
-0x00000044, 0x00000064, 0x00000044,
-0x00000045, 0x00000065, 0x00000045,
-0x00000046, 0x00000066, 0x00000046,
-0x00000047, 0x00000067, 0x00000047,
-0x00000048, 0x00000068, 0x00000048,
-0x00000049, 0x00000069, 0x00000049,
-0x0000004a, 0x0000006a, 0x0000004a,
-0x0000004b, 0x0000006b, 0x0000004b,
-0x0000004c, 0x0000006c, 0x0000004c,
-0x0000004d, 0x0000006d, 0x0000004d,
-0x0000004e, 0x0000006e, 0x0000004e,
-0x0000004f, 0x0000006f, 0x0000004f,
-0x00000050, 0x00000070, 0x00000050,
-0x00000051, 0x00000071, 0x00000051,
-0x00000052, 0x00000072, 0x00000052,
-0x00000053, 0x00000073, 0x00000053,
-0x00000054, 0x00000074, 0x00000054,
-0x00000055, 0x00000075, 0x00000055,
-0x00000056, 0x00000076, 0x00000056,
-0x00000057, 0x00000077, 0x00000057,
-0x00000058, 0x00000078, 0x00000058,
-0x00000059, 0x00000079, 0x00000059,
-0x0000005a, 0x0000007a, 0x0000005a,
-0x000000c0, 0x000000e0, 0x000000c0,
-0x000000c1, 0x000000e1, 0x000000c1,
-0x000000c2, 0x000000e2, 0x000000c2,
-0x000000c3, 0x000000e3, 0x000000c3,
-0x000000c4, 0x000000e4, 0x000000c4,
-0x000000c5, 0x000000e5, 0x000000c5,
-0x000000c6, 0x000000e6, 0x000000c6,
-0x000000c7, 0x000000e7, 0x000000c7,
-0x000000c8, 0x000000e8, 0x000000c8,
-0x000000c9, 0x000000e9, 0x000000c9,
-0x000000ca, 0x000000ea, 0x000000ca,
-0x000000cb, 0x000000eb, 0x000000cb,
-0x000000cc, 0x000000ec, 0x000000cc,
-0x000000cd, 0x000000ed, 0x000000cd,
-0x000000ce, 0x000000ee, 0x000000ce,
-0x000000cf, 0x000000ef, 0x000000cf,
-0x000000d0, 0x000000f0, 0x000000d0,
-0x000000d1, 0x000000f1, 0x000000d1,
-0x000000d2, 0x000000f2, 0x000000d2,
-0x000000d3, 0x000000f3, 0x000000d3,
-0x000000d4, 0x000000f4, 0x000000d4,
-0x000000d5, 0x000000f5, 0x000000d5,
-0x000000d6, 0x000000f6, 0x000000d6,
-0x000000d8, 0x000000f8, 0x000000d8,
-0x000000d9, 0x000000f9, 0x000000d9,
-0x000000da, 0x000000fa, 0x000000da,
-0x000000db, 0x000000fb, 0x000000db,
-0x000000dc, 0x000000fc, 0x000000dc,
-0x000000dd, 0x000000fd, 0x000000dd,
-0x000000de, 0x000000fe, 0x000000de,
-0x00000100, 0x00000101, 0x00000100,
-0x00000102, 0x00000103, 0x00000102,
-0x00000104, 0x00000105, 0x00000104,
-0x00000106, 0x00000107, 0x00000106,
-0x00000108, 0x00000109, 0x00000108,
-0x0000010a, 0x0000010b, 0x0000010a,
-0x0000010c, 0x0000010d, 0x0000010c,
-0x0000010e, 0x0000010f, 0x0000010e,
-0x00000110, 0x00000111, 0x00000110,
-0x00000112, 0x00000113, 0x00000112,
-0x00000114, 0x00000115, 0x00000114,
-0x00000116, 0x00000117, 0x00000116,
-0x00000118, 0x00000119, 0x00000118,
-0x0000011a, 0x0000011b, 0x0000011a,
-0x0000011c, 0x0000011d, 0x0000011c,
-0x0000011e, 0x0000011f, 0x0000011e,
-0x00000120, 0x00000121, 0x00000120,
-0x00000122, 0x00000123, 0x00000122,
-0x00000124, 0x00000125, 0x00000124,
-0x00000126, 0x00000127, 0x00000126,
-0x00000128, 0x00000129, 0x00000128,
-0x0000012a, 0x0000012b, 0x0000012a,
-0x0000012c, 0x0000012d, 0x0000012c,
-0x0000012e, 0x0000012f, 0x0000012e,
-0x00000130, 0x00000069, 0x00000130,
-0x00000132, 0x00000133, 0x00000132,
-0x00000134, 0x00000135, 0x00000134,
-0x00000136, 0x00000137, 0x00000136,
-0x00000139, 0x0000013a, 0x00000139,
-0x0000013b, 0x0000013c, 0x0000013b,
-0x0000013d, 0x0000013e, 0x0000013d,
-0x0000013f, 0x00000140, 0x0000013f,
-0x00000141, 0x00000142, 0x00000141,
-0x00000143, 0x00000144, 0x00000143,
-0x00000145, 0x00000146, 0x00000145,
-0x00000147, 0x00000148, 0x00000147,
-0x0000014a, 0x0000014b, 0x0000014a,
-0x0000014c, 0x0000014d, 0x0000014c,
-0x0000014e, 0x0000014f, 0x0000014e,
-0x00000150, 0x00000151, 0x00000150,
-0x00000152, 0x00000153, 0x00000152,
-0x00000154, 0x00000155, 0x00000154,
-0x00000156, 0x00000157, 0x00000156,
-0x00000158, 0x00000159, 0x00000158,
-0x0000015a, 0x0000015b, 0x0000015a,
-0x0000015c, 0x0000015d, 0x0000015c,
-0x0000015e, 0x0000015f, 0x0000015e,
-0x00000160, 0x00000161, 0x00000160,
-0x00000162, 0x00000163, 0x00000162,
-0x00000164, 0x00000165, 0x00000164,
-0x00000166, 0x00000167, 0x00000166,
-0x00000168, 0x00000169, 0x00000168,
-0x0000016a, 0x0000016b, 0x0000016a,
-0x0000016c, 0x0000016d, 0x0000016c,
-0x0000016e, 0x0000016f, 0x0000016e,
-0x00000170, 0x00000171, 0x00000170,
-0x00000172, 0x00000173, 0x00000172,
-0x00000174, 0x00000175, 0x00000174,
-0x00000176, 0x00000177, 0x00000176,
-0x00000178, 0x000000ff, 0x00000178,
-0x00000179, 0x0000017a, 0x00000179,
-0x0000017b, 0x0000017c, 0x0000017b,
-0x0000017d, 0x0000017e, 0x0000017d,
-0x00000181, 0x00000253, 0x00000181,
-0x00000182, 0x00000183, 0x00000182,
-0x00000184, 0x00000185, 0x00000184,
-0x00000186, 0x00000254, 0x00000186,
-0x00000187, 0x00000188, 0x00000187,
-0x00000189, 0x00000256, 0x00000189,
-0x0000018a, 0x00000257, 0x0000018a,
-0x0000018b, 0x0000018c, 0x0000018b,
-0x0000018e, 0x000001dd, 0x0000018e,
-0x0000018f, 0x00000259, 0x0000018f,
-0x00000190, 0x0000025b, 0x00000190,
-0x00000191, 0x00000192, 0x00000191,
-0x00000193, 0x00000260, 0x00000193,
-0x00000194, 0x00000263, 0x00000194,
-0x00000196, 0x00000269, 0x00000196,
-0x00000197, 0x00000268, 0x00000197,
-0x00000198, 0x00000199, 0x00000198,
-0x0000019c, 0x0000026f, 0x0000019c,
-0x0000019d, 0x00000272, 0x0000019d,
-0x0000019f, 0x00000275, 0x0000019f,
-0x000001a0, 0x000001a1, 0x000001a0,
-0x000001a2, 0x000001a3, 0x000001a2,
-0x000001a4, 0x000001a5, 0x000001a4,
-0x000001a6, 0x00000280, 0x000001a6,
-0x000001a7, 0x000001a8, 0x000001a7,
-0x000001a9, 0x00000283, 0x000001a9,
-0x000001ac, 0x000001ad, 0x000001ac,
-0x000001ae, 0x00000288, 0x000001ae,
-0x000001af, 0x000001b0, 0x000001af,
-0x000001b1, 0x0000028a, 0x000001b1,
-0x000001b2, 0x0000028b, 0x000001b2,
-0x000001b3, 0x000001b4, 0x000001b3,
-0x000001b5, 0x000001b6, 0x000001b5,
-0x000001b7, 0x00000292, 0x000001b7,
-0x000001b8, 0x000001b9, 0x000001b8,
-0x000001bc, 0x000001bd, 0x000001bc,
-0x000001c4, 0x000001c6, 0x000001c5,
-0x000001c7, 0x000001c9, 0x000001c8,
-0x000001ca, 0x000001cc, 0x000001cb,
-0x000001cd, 0x000001ce, 0x000001cd,
-0x000001cf, 0x000001d0, 0x000001cf,
-0x000001d1, 0x000001d2, 0x000001d1,
-0x000001d3, 0x000001d4, 0x000001d3,
-0x000001d5, 0x000001d6, 0x000001d5,
-0x000001d7, 0x000001d8, 0x000001d7,
-0x000001d9, 0x000001da, 0x000001d9,
-0x000001db, 0x000001dc, 0x000001db,
-0x000001de, 0x000001df, 0x000001de,
-0x000001e0, 0x000001e1, 0x000001e0,
-0x000001e2, 0x000001e3, 0x000001e2,
-0x000001e4, 0x000001e5, 0x000001e4,
-0x000001e6, 0x000001e7, 0x000001e6,
-0x000001e8, 0x000001e9, 0x000001e8,
-0x000001ea, 0x000001eb, 0x000001ea,
-0x000001ec, 0x000001ed, 0x000001ec,
-0x000001ee, 0x000001ef, 0x000001ee,
-0x000001f1, 0x000001f3, 0x000001f2,
-0x000001f4, 0x000001f5, 0x000001f4,
-0x000001f6, 0x00000195, 0x000001f6,
-0x000001f7, 0x000001bf, 0x000001f7,
-0x000001f8, 0x000001f9, 0x000001f8,
-0x000001fa, 0x000001fb, 0x000001fa,
-0x000001fc, 0x000001fd, 0x000001fc,
-0x000001fe, 0x000001ff, 0x000001fe,
-0x00000200, 0x00000201, 0x00000200,
-0x00000202, 0x00000203, 0x00000202,
-0x00000204, 0x00000205, 0x00000204,
-0x00000206, 0x00000207, 0x00000206,
-0x00000208, 0x00000209, 0x00000208,
-0x0000020a, 0x0000020b, 0x0000020a,
-0x0000020c, 0x0000020d, 0x0000020c,
-0x0000020e, 0x0000020f, 0x0000020e,
-0x00000210, 0x00000211, 0x00000210,
-0x00000212, 0x00000213, 0x00000212,
-0x00000214, 0x00000215, 0x00000214,
-0x00000216, 0x00000217, 0x00000216,
-0x00000218, 0x00000219, 0x00000218,
-0x0000021a, 0x0000021b, 0x0000021a,
-0x0000021c, 0x0000021d, 0x0000021c,
-0x0000021e, 0x0000021f, 0x0000021e,
-0x00000220, 0x0000019e, 0x00000220,
-0x00000222, 0x00000223, 0x00000222,
-0x00000224, 0x00000225, 0x00000224,
-0x00000226, 0x00000227, 0x00000226,
-0x00000228, 0x00000229, 0x00000228,
-0x0000022a, 0x0000022b, 0x0000022a,
-0x0000022c, 0x0000022d, 0x0000022c,
-0x0000022e, 0x0000022f, 0x0000022e,
-0x00000230, 0x00000231, 0x00000230,
-0x00000232, 0x00000233, 0x00000232,
-0x00000386, 0x000003ac, 0x00000386,
-0x00000388, 0x000003ad, 0x00000388,
-0x00000389, 0x000003ae, 0x00000389,
-0x0000038a, 0x000003af, 0x0000038a,
-0x0000038c, 0x000003cc, 0x0000038c,
-0x0000038e, 0x000003cd, 0x0000038e,
-0x0000038f, 0x000003ce, 0x0000038f,
-0x00000391, 0x000003b1, 0x00000391,
-0x00000392, 0x000003b2, 0x00000392,
-0x00000393, 0x000003b3, 0x00000393,
-0x00000394, 0x000003b4, 0x00000394,
-0x00000395, 0x000003b5, 0x00000395,
-0x00000396, 0x000003b6, 0x00000396,
-0x00000397, 0x000003b7, 0x00000397,
-0x00000398, 0x000003b8, 0x00000398,
-0x00000399, 0x000003b9, 0x00000399,
-0x0000039a, 0x000003ba, 0x0000039a,
-0x0000039b, 0x000003bb, 0x0000039b,
-0x0000039c, 0x000003bc, 0x0000039c,
-0x0000039d, 0x000003bd, 0x0000039d,
-0x0000039e, 0x000003be, 0x0000039e,
-0x0000039f, 0x000003bf, 0x0000039f,
-0x000003a0, 0x000003c0, 0x000003a0,
-0x000003a1, 0x000003c1, 0x000003a1,
-0x000003a3, 0x000003c3, 0x000003a3,
-0x000003a4, 0x000003c4, 0x000003a4,
-0x000003a5, 0x000003c5, 0x000003a5,
-0x000003a6, 0x000003c6, 0x000003a6,
-0x000003a7, 0x000003c7, 0x000003a7,
-0x000003a8, 0x000003c8, 0x000003a8,
-0x000003a9, 0x000003c9, 0x000003a9,
-0x000003aa, 0x000003ca, 0x000003aa,
-0x000003ab, 0x000003cb, 0x000003ab,
-0x000003d8, 0x000003d9, 0x000003d8,
-0x000003da, 0x000003db, 0x000003da,
-0x000003dc, 0x000003dd, 0x000003dc,
-0x000003de, 0x000003df, 0x000003de,
-0x000003e0, 0x000003e1, 0x000003e0,
-0x000003e2, 0x000003e3, 0x000003e2,
-0x000003e4, 0x000003e5, 0x000003e4,
-0x000003e6, 0x000003e7, 0x000003e6,
-0x000003e8, 0x000003e9, 0x000003e8,
-0x000003ea, 0x000003eb, 0x000003ea,
-0x000003ec, 0x000003ed, 0x000003ec,
-0x000003ee, 0x000003ef, 0x000003ee,
-0x000003f4, 0x000003b8, 0x000003f4,
-0x00000400, 0x00000450, 0x00000400,
-0x00000401, 0x00000451, 0x00000401,
-0x00000402, 0x00000452, 0x00000402,
-0x00000403, 0x00000453, 0x00000403,
-0x00000404, 0x00000454, 0x00000404,
-0x00000405, 0x00000455, 0x00000405,
-0x00000406, 0x00000456, 0x00000406,
-0x00000407, 0x00000457, 0x00000407,
-0x00000408, 0x00000458, 0x00000408,
-0x00000409, 0x00000459, 0x00000409,
-0x0000040a, 0x0000045a, 0x0000040a,
-0x0000040b, 0x0000045b, 0x0000040b,
-0x0000040c, 0x0000045c, 0x0000040c,
-0x0000040d, 0x0000045d, 0x0000040d,
-0x0000040e, 0x0000045e, 0x0000040e,
-0x0000040f, 0x0000045f, 0x0000040f,
-0x00000410, 0x00000430, 0x00000410,
-0x00000411, 0x00000431, 0x00000411,
-0x00000412, 0x00000432, 0x00000412,
-0x00000413, 0x00000433, 0x00000413,
-0x00000414, 0x00000434, 0x00000414,
-0x00000415, 0x00000435, 0x00000415,
-0x00000416, 0x00000436, 0x00000416,
-0x00000417, 0x00000437, 0x00000417,
-0x00000418, 0x00000438, 0x00000418,
-0x00000419, 0x00000439, 0x00000419,
-0x0000041a, 0x0000043a, 0x0000041a,
-0x0000041b, 0x0000043b, 0x0000041b,
-0x0000041c, 0x0000043c, 0x0000041c,
-0x0000041d, 0x0000043d, 0x0000041d,
-0x0000041e, 0x0000043e, 0x0000041e,
-0x0000041f, 0x0000043f, 0x0000041f,
-0x00000420, 0x00000440, 0x00000420,
-0x00000421, 0x00000441, 0x00000421,
-0x00000422, 0x00000442, 0x00000422,
-0x00000423, 0x00000443, 0x00000423,
-0x00000424, 0x00000444, 0x00000424,
-0x00000425, 0x00000445, 0x00000425,
-0x00000426, 0x00000446, 0x00000426,
-0x00000427, 0x00000447, 0x00000427,
-0x00000428, 0x00000448, 0x00000428,
-0x00000429, 0x00000449, 0x00000429,
-0x0000042a, 0x0000044a, 0x0000042a,
-0x0000042b, 0x0000044b, 0x0000042b,
-0x0000042c, 0x0000044c, 0x0000042c,
-0x0000042d, 0x0000044d, 0x0000042d,
-0x0000042e, 0x0000044e, 0x0000042e,
-0x0000042f, 0x0000044f, 0x0000042f,
-0x00000460, 0x00000461, 0x00000460,
-0x00000462, 0x00000463, 0x00000462,
-0x00000464, 0x00000465, 0x00000464,
-0x00000466, 0x00000467, 0x00000466,
-0x00000468, 0x00000469, 0x00000468,
-0x0000046a, 0x0000046b, 0x0000046a,
-0x0000046c, 0x0000046d, 0x0000046c,
-0x0000046e, 0x0000046f, 0x0000046e,
-0x00000470, 0x00000471, 0x00000470,
-0x00000472, 0x00000473, 0x00000472,
-0x00000474, 0x00000475, 0x00000474,
-0x00000476, 0x00000477, 0x00000476,
-0x00000478, 0x00000479, 0x00000478,
-0x0000047a, 0x0000047b, 0x0000047a,
-0x0000047c, 0x0000047d, 0x0000047c,
-0x0000047e, 0x0000047f, 0x0000047e,
-0x00000480, 0x00000481, 0x00000480,
-0x0000048a, 0x0000048b, 0x0000048a,
-0x0000048c, 0x0000048d, 0x0000048c,
-0x0000048e, 0x0000048f, 0x0000048e,
-0x00000490, 0x00000491, 0x00000490,
-0x00000492, 0x00000493, 0x00000492,
-0x00000494, 0x00000495, 0x00000494,
-0x00000496, 0x00000497, 0x00000496,
-0x00000498, 0x00000499, 0x00000498,
-0x0000049a, 0x0000049b, 0x0000049a,
-0x0000049c, 0x0000049d, 0x0000049c,
-0x0000049e, 0x0000049f, 0x0000049e,
-0x000004a0, 0x000004a1, 0x000004a0,
-0x000004a2, 0x000004a3, 0x000004a2,
-0x000004a4, 0x000004a5, 0x000004a4,
-0x000004a6, 0x000004a7, 0x000004a6,
-0x000004a8, 0x000004a9, 0x000004a8,
-0x000004aa, 0x000004ab, 0x000004aa,
-0x000004ac, 0x000004ad, 0x000004ac,
-0x000004ae, 0x000004af, 0x000004ae,
-0x000004b0, 0x000004b1, 0x000004b0,
-0x000004b2, 0x000004b3, 0x000004b2,
-0x000004b4, 0x000004b5, 0x000004b4,
-0x000004b6, 0x000004b7, 0x000004b6,
-0x000004b8, 0x000004b9, 0x000004b8,
-0x000004ba, 0x000004bb, 0x000004ba,
-0x000004bc, 0x000004bd, 0x000004bc,
-0x000004be, 0x000004bf, 0x000004be,
-0x000004c1, 0x000004c2, 0x000004c1,
-0x000004c3, 0x000004c4, 0x000004c3,
-0x000004c5, 0x000004c6, 0x000004c5,
-0x000004c7, 0x000004c8, 0x000004c7,
-0x000004c9, 0x000004ca, 0x000004c9,
-0x000004cb, 0x000004cc, 0x000004cb,
-0x000004cd, 0x000004ce, 0x000004cd,
-0x000004d0, 0x000004d1, 0x000004d0,
-0x000004d2, 0x000004d3, 0x000004d2,
-0x000004d4, 0x000004d5, 0x000004d4,
-0x000004d6, 0x000004d7, 0x000004d6,
-0x000004d8, 0x000004d9, 0x000004d8,
-0x000004da, 0x000004db, 0x000004da,
-0x000004dc, 0x000004dd, 0x000004dc,
-0x000004de, 0x000004df, 0x000004de,
-0x000004e0, 0x000004e1, 0x000004e0,
-0x000004e2, 0x000004e3, 0x000004e2,
-0x000004e4, 0x000004e5, 0x000004e4,
-0x000004e6, 0x000004e7, 0x000004e6,
-0x000004e8, 0x000004e9, 0x000004e8,
-0x000004ea, 0x000004eb, 0x000004ea,
-0x000004ec, 0x000004ed, 0x000004ec,
-0x000004ee, 0x000004ef, 0x000004ee,
-0x000004f0, 0x000004f1, 0x000004f0,
-0x000004f2, 0x000004f3, 0x000004f2,
-0x000004f4, 0x000004f5, 0x000004f4,
-0x000004f8, 0x000004f9, 0x000004f8,
-0x00000500, 0x00000501, 0x00000500,
-0x00000502, 0x00000503, 0x00000502,
-0x00000504, 0x00000505, 0x00000504,
-0x00000506, 0x00000507, 0x00000506,
-0x00000508, 0x00000509, 0x00000508,
-0x0000050a, 0x0000050b, 0x0000050a,
-0x0000050c, 0x0000050d, 0x0000050c,
-0x0000050e, 0x0000050f, 0x0000050e,
-0x00000531, 0x00000561, 0x00000531,
-0x00000532, 0x00000562, 0x00000532,
-0x00000533, 0x00000563, 0x00000533,
-0x00000534, 0x00000564, 0x00000534,
-0x00000535, 0x00000565, 0x00000535,
-0x00000536, 0x00000566, 0x00000536,
-0x00000537, 0x00000567, 0x00000537,
-0x00000538, 0x00000568, 0x00000538,
-0x00000539, 0x00000569, 0x00000539,
-0x0000053a, 0x0000056a, 0x0000053a,
-0x0000053b, 0x0000056b, 0x0000053b,
-0x0000053c, 0x0000056c, 0x0000053c,
-0x0000053d, 0x0000056d, 0x0000053d,
-0x0000053e, 0x0000056e, 0x0000053e,
-0x0000053f, 0x0000056f, 0x0000053f,
-0x00000540, 0x00000570, 0x00000540,
-0x00000541, 0x00000571, 0x00000541,
-0x00000542, 0x00000572, 0x00000542,
-0x00000543, 0x00000573, 0x00000543,
-0x00000544, 0x00000574, 0x00000544,
-0x00000545, 0x00000575, 0x00000545,
-0x00000546, 0x00000576, 0x00000546,
-0x00000547, 0x00000577, 0x00000547,
-0x00000548, 0x00000578, 0x00000548,
-0x00000549, 0x00000579, 0x00000549,
-0x0000054a, 0x0000057a, 0x0000054a,
-0x0000054b, 0x0000057b, 0x0000054b,
-0x0000054c, 0x0000057c, 0x0000054c,
-0x0000054d, 0x0000057d, 0x0000054d,
-0x0000054e, 0x0000057e, 0x0000054e,
-0x0000054f, 0x0000057f, 0x0000054f,
-0x00000550, 0x00000580, 0x00000550,
-0x00000551, 0x00000581, 0x00000551,
-0x00000552, 0x00000582, 0x00000552,
-0x00000553, 0x00000583, 0x00000553,
-0x00000554, 0x00000584, 0x00000554,
-0x00000555, 0x00000585, 0x00000555,
-0x00000556, 0x00000586, 0x00000556,
-0x00001e00, 0x00001e01, 0x00001e00,
-0x00001e02, 0x00001e03, 0x00001e02,
-0x00001e04, 0x00001e05, 0x00001e04,
-0x00001e06, 0x00001e07, 0x00001e06,
-0x00001e08, 0x00001e09, 0x00001e08,
-0x00001e0a, 0x00001e0b, 0x00001e0a,
-0x00001e0c, 0x00001e0d, 0x00001e0c,
-0x00001e0e, 0x00001e0f, 0x00001e0e,
-0x00001e10, 0x00001e11, 0x00001e10,
-0x00001e12, 0x00001e13, 0x00001e12,
-0x00001e14, 0x00001e15, 0x00001e14,
-0x00001e16, 0x00001e17, 0x00001e16,
-0x00001e18, 0x00001e19, 0x00001e18,
-0x00001e1a, 0x00001e1b, 0x00001e1a,
-0x00001e1c, 0x00001e1d, 0x00001e1c,
-0x00001e1e, 0x00001e1f, 0x00001e1e,
-0x00001e20, 0x00001e21, 0x00001e20,
-0x00001e22, 0x00001e23, 0x00001e22,
-0x00001e24, 0x00001e25, 0x00001e24,
-0x00001e26, 0x00001e27, 0x00001e26,
-0x00001e28, 0x00001e29, 0x00001e28,
-0x00001e2a, 0x00001e2b, 0x00001e2a,
-0x00001e2c, 0x00001e2d, 0x00001e2c,
-0x00001e2e, 0x00001e2f, 0x00001e2e,
-0x00001e30, 0x00001e31, 0x00001e30,
-0x00001e32, 0x00001e33, 0x00001e32,
-0x00001e34, 0x00001e35, 0x00001e34,
-0x00001e36, 0x00001e37, 0x00001e36,
-0x00001e38, 0x00001e39, 0x00001e38,
-0x00001e3a, 0x00001e3b, 0x00001e3a,
-0x00001e3c, 0x00001e3d, 0x00001e3c,
-0x00001e3e, 0x00001e3f, 0x00001e3e,
-0x00001e40, 0x00001e41, 0x00001e40,
-0x00001e42, 0x00001e43, 0x00001e42,
-0x00001e44, 0x00001e45, 0x00001e44,
-0x00001e46, 0x00001e47, 0x00001e46,
-0x00001e48, 0x00001e49, 0x00001e48,
-0x00001e4a, 0x00001e4b, 0x00001e4a,
-0x00001e4c, 0x00001e4d, 0x00001e4c,
-0x00001e4e, 0x00001e4f, 0x00001e4e,
-0x00001e50, 0x00001e51, 0x00001e50,
-0x00001e52, 0x00001e53, 0x00001e52,
-0x00001e54, 0x00001e55, 0x00001e54,
-0x00001e56, 0x00001e57, 0x00001e56,
-0x00001e58, 0x00001e59, 0x00001e58,
-0x00001e5a, 0x00001e5b, 0x00001e5a,
-0x00001e5c, 0x00001e5d, 0x00001e5c,
-0x00001e5e, 0x00001e5f, 0x00001e5e,
-0x00001e60, 0x00001e61, 0x00001e60,
-0x00001e62, 0x00001e63, 0x00001e62,
-0x00001e64, 0x00001e65, 0x00001e64,
-0x00001e66, 0x00001e67, 0x00001e66,
-0x00001e68, 0x00001e69, 0x00001e68,
-0x00001e6a, 0x00001e6b, 0x00001e6a,
-0x00001e6c, 0x00001e6d, 0x00001e6c,
-0x00001e6e, 0x00001e6f, 0x00001e6e,
-0x00001e70, 0x00001e71, 0x00001e70,
-0x00001e72, 0x00001e73, 0x00001e72,
-0x00001e74, 0x00001e75, 0x00001e74,
-0x00001e76, 0x00001e77, 0x00001e76,
-0x00001e78, 0x00001e79, 0x00001e78,
-0x00001e7a, 0x00001e7b, 0x00001e7a,
-0x00001e7c, 0x00001e7d, 0x00001e7c,
-0x00001e7e, 0x00001e7f, 0x00001e7e,
-0x00001e80, 0x00001e81, 0x00001e80,
-0x00001e82, 0x00001e83, 0x00001e82,
-0x00001e84, 0x00001e85, 0x00001e84,
-0x00001e86, 0x00001e87, 0x00001e86,
-0x00001e88, 0x00001e89, 0x00001e88,
-0x00001e8a, 0x00001e8b, 0x00001e8a,
-0x00001e8c, 0x00001e8d, 0x00001e8c,
-0x00001e8e, 0x00001e8f, 0x00001e8e,
-0x00001e90, 0x00001e91, 0x00001e90,
-0x00001e92, 0x00001e93, 0x00001e92,
-0x00001e94, 0x00001e95, 0x00001e94,
-0x00001ea0, 0x00001ea1, 0x00001ea0,
-0x00001ea2, 0x00001ea3, 0x00001ea2,
-0x00001ea4, 0x00001ea5, 0x00001ea4,
-0x00001ea6, 0x00001ea7, 0x00001ea6,
-0x00001ea8, 0x00001ea9, 0x00001ea8,
-0x00001eaa, 0x00001eab, 0x00001eaa,
-0x00001eac, 0x00001ead, 0x00001eac,
-0x00001eae, 0x00001eaf, 0x00001eae,
-0x00001eb0, 0x00001eb1, 0x00001eb0,
-0x00001eb2, 0x00001eb3, 0x00001eb2,
-0x00001eb4, 0x00001eb5, 0x00001eb4,
-0x00001eb6, 0x00001eb7, 0x00001eb6,
-0x00001eb8, 0x00001eb9, 0x00001eb8,
-0x00001eba, 0x00001ebb, 0x00001eba,
-0x00001ebc, 0x00001ebd, 0x00001ebc,
-0x00001ebe, 0x00001ebf, 0x00001ebe,
-0x00001ec0, 0x00001ec1, 0x00001ec0,
-0x00001ec2, 0x00001ec3, 0x00001ec2,
-0x00001ec4, 0x00001ec5, 0x00001ec4,
-0x00001ec6, 0x00001ec7, 0x00001ec6,
-0x00001ec8, 0x00001ec9, 0x00001ec8,
-0x00001eca, 0x00001ecb, 0x00001eca,
-0x00001ecc, 0x00001ecd, 0x00001ecc,
-0x00001ece, 0x00001ecf, 0x00001ece,
-0x00001ed0, 0x00001ed1, 0x00001ed0,
-0x00001ed2, 0x00001ed3, 0x00001ed2,
-0x00001ed4, 0x00001ed5, 0x00001ed4,
-0x00001ed6, 0x00001ed7, 0x00001ed6,
-0x00001ed8, 0x00001ed9, 0x00001ed8,
-0x00001eda, 0x00001edb, 0x00001eda,
-0x00001edc, 0x00001edd, 0x00001edc,
-0x00001ede, 0x00001edf, 0x00001ede,
-0x00001ee0, 0x00001ee1, 0x00001ee0,
-0x00001ee2, 0x00001ee3, 0x00001ee2,
-0x00001ee4, 0x00001ee5, 0x00001ee4,
-0x00001ee6, 0x00001ee7, 0x00001ee6,
-0x00001ee8, 0x00001ee9, 0x00001ee8,
-0x00001eea, 0x00001eeb, 0x00001eea,
-0x00001eec, 0x00001eed, 0x00001eec,
-0x00001eee, 0x00001eef, 0x00001eee,
-0x00001ef0, 0x00001ef1, 0x00001ef0,
-0x00001ef2, 0x00001ef3, 0x00001ef2,
-0x00001ef4, 0x00001ef5, 0x00001ef4,
-0x00001ef6, 0x00001ef7, 0x00001ef6,
-0x00001ef8, 0x00001ef9, 0x00001ef8,
-0x00001f08, 0x00001f00, 0x00001f08,
-0x00001f09, 0x00001f01, 0x00001f09,
-0x00001f0a, 0x00001f02, 0x00001f0a,
-0x00001f0b, 0x00001f03, 0x00001f0b,
-0x00001f0c, 0x00001f04, 0x00001f0c,
-0x00001f0d, 0x00001f05, 0x00001f0d,
-0x00001f0e, 0x00001f06, 0x00001f0e,
-0x00001f0f, 0x00001f07, 0x00001f0f,
-0x00001f18, 0x00001f10, 0x00001f18,
-0x00001f19, 0x00001f11, 0x00001f19,
-0x00001f1a, 0x00001f12, 0x00001f1a,
-0x00001f1b, 0x00001f13, 0x00001f1b,
-0x00001f1c, 0x00001f14, 0x00001f1c,
-0x00001f1d, 0x00001f15, 0x00001f1d,
-0x00001f28, 0x00001f20, 0x00001f28,
-0x00001f29, 0x00001f21, 0x00001f29,
-0x00001f2a, 0x00001f22, 0x00001f2a,
-0x00001f2b, 0x00001f23, 0x00001f2b,
-0x00001f2c, 0x00001f24, 0x00001f2c,
-0x00001f2d, 0x00001f25, 0x00001f2d,
-0x00001f2e, 0x00001f26, 0x00001f2e,
-0x00001f2f, 0x00001f27, 0x00001f2f,
-0x00001f38, 0x00001f30, 0x00001f38,
-0x00001f39, 0x00001f31, 0x00001f39,
-0x00001f3a, 0x00001f32, 0x00001f3a,
-0x00001f3b, 0x00001f33, 0x00001f3b,
-0x00001f3c, 0x00001f34, 0x00001f3c,
-0x00001f3d, 0x00001f35, 0x00001f3d,
-0x00001f3e, 0x00001f36, 0x00001f3e,
-0x00001f3f, 0x00001f37, 0x00001f3f,
-0x00001f48, 0x00001f40, 0x00001f48,
-0x00001f49, 0x00001f41, 0x00001f49,
-0x00001f4a, 0x00001f42, 0x00001f4a,
-0x00001f4b, 0x00001f43, 0x00001f4b,
-0x00001f4c, 0x00001f44, 0x00001f4c,
-0x00001f4d, 0x00001f45, 0x00001f4d,
-0x00001f59, 0x00001f51, 0x00001f59,
-0x00001f5b, 0x00001f53, 0x00001f5b,
-0x00001f5d, 0x00001f55, 0x00001f5d,
-0x00001f5f, 0x00001f57, 0x00001f5f,
-0x00001f68, 0x00001f60, 0x00001f68,
-0x00001f69, 0x00001f61, 0x00001f69,
-0x00001f6a, 0x00001f62, 0x00001f6a,
-0x00001f6b, 0x00001f63, 0x00001f6b,
-0x00001f6c, 0x00001f64, 0x00001f6c,
-0x00001f6d, 0x00001f65, 0x00001f6d,
-0x00001f6e, 0x00001f66, 0x00001f6e,
-0x00001f6f, 0x00001f67, 0x00001f6f,
-0x00001f88, 0x00001f80, 0x00001f88,
-0x00001f89, 0x00001f81, 0x00001f89,
-0x00001f8a, 0x00001f82, 0x00001f8a,
-0x00001f8b, 0x00001f83, 0x00001f8b,
-0x00001f8c, 0x00001f84, 0x00001f8c,
-0x00001f8d, 0x00001f85, 0x00001f8d,
-0x00001f8e, 0x00001f86, 0x00001f8e,
-0x00001f8f, 0x00001f87, 0x00001f8f,
-0x00001f98, 0x00001f90, 0x00001f98,
-0x00001f99, 0x00001f91, 0x00001f99,
-0x00001f9a, 0x00001f92, 0x00001f9a,
-0x00001f9b, 0x00001f93, 0x00001f9b,
-0x00001f9c, 0x00001f94, 0x00001f9c,
-0x00001f9d, 0x00001f95, 0x00001f9d,
-0x00001f9e, 0x00001f96, 0x00001f9e,
-0x00001f9f, 0x00001f97, 0x00001f9f,
-0x00001fa8, 0x00001fa0, 0x00001fa8,
-0x00001fa9, 0x00001fa1, 0x00001fa9,
-0x00001faa, 0x00001fa2, 0x00001faa,
-0x00001fab, 0x00001fa3, 0x00001fab,
-0x00001fac, 0x00001fa4, 0x00001fac,
-0x00001fad, 0x00001fa5, 0x00001fad,
-0x00001fae, 0x00001fa6, 0x00001fae,
-0x00001faf, 0x00001fa7, 0x00001faf,
-0x00001fb8, 0x00001fb0, 0x00001fb8,
-0x00001fb9, 0x00001fb1, 0x00001fb9,
-0x00001fba, 0x00001f70, 0x00001fba,
-0x00001fbb, 0x00001f71, 0x00001fbb,
-0x00001fbc, 0x00001fb3, 0x00001fbc,
-0x00001fc8, 0x00001f72, 0x00001fc8,
-0x00001fc9, 0x00001f73, 0x00001fc9,
-0x00001fca, 0x00001f74, 0x00001fca,
-0x00001fcb, 0x00001f75, 0x00001fcb,
-0x00001fcc, 0x00001fc3, 0x00001fcc,
-0x00001fd8, 0x00001fd0, 0x00001fd8,
-0x00001fd9, 0x00001fd1, 0x00001fd9,
-0x00001fda, 0x00001f76, 0x00001fda,
-0x00001fdb, 0x00001f77, 0x00001fdb,
-0x00001fe8, 0x00001fe0, 0x00001fe8,
-0x00001fe9, 0x00001fe1, 0x00001fe9,
-0x00001fea, 0x00001f7a, 0x00001fea,
-0x00001feb, 0x00001f7b, 0x00001feb,
-0x00001fec, 0x00001fe5, 0x00001fec,
-0x00001ff8, 0x00001f78, 0x00001ff8,
-0x00001ff9, 0x00001f79, 0x00001ff9,
-0x00001ffa, 0x00001f7c, 0x00001ffa,
-0x00001ffb, 0x00001f7d, 0x00001ffb,
-0x00001ffc, 0x00001ff3, 0x00001ffc,
-0x00002126, 0x000003c9, 0x00002126,
-0x0000212a, 0x0000006b, 0x0000212a,
-0x0000212b, 0x000000e5, 0x0000212b,
-0x00002160, 0x00002170, 0x00002160,
-0x00002161, 0x00002171, 0x00002161,
-0x00002162, 0x00002172, 0x00002162,
-0x00002163, 0x00002173, 0x00002163,
-0x00002164, 0x00002174, 0x00002164,
-0x00002165, 0x00002175, 0x00002165,
-0x00002166, 0x00002176, 0x00002166,
-0x00002167, 0x00002177, 0x00002167,
-0x00002168, 0x00002178, 0x00002168,
-0x00002169, 0x00002179, 0x00002169,
-0x0000216a, 0x0000217a, 0x0000216a,
-0x0000216b, 0x0000217b, 0x0000216b,
-0x0000216c, 0x0000217c, 0x0000216c,
-0x0000216d, 0x0000217d, 0x0000216d,
-0x0000216e, 0x0000217e, 0x0000216e,
-0x0000216f, 0x0000217f, 0x0000216f,
-0x000024b6, 0x000024d0, 0x000024b6,
-0x000024b7, 0x000024d1, 0x000024b7,
-0x000024b8, 0x000024d2, 0x000024b8,
-0x000024b9, 0x000024d3, 0x000024b9,
-0x000024ba, 0x000024d4, 0x000024ba,
-0x000024bb, 0x000024d5, 0x000024bb,
-0x000024bc, 0x000024d6, 0x000024bc,
-0x000024bd, 0x000024d7, 0x000024bd,
-0x000024be, 0x000024d8, 0x000024be,
-0x000024bf, 0x000024d9, 0x000024bf,
-0x000024c0, 0x000024da, 0x000024c0,
-0x000024c1, 0x000024db, 0x000024c1,
-0x000024c2, 0x000024dc, 0x000024c2,
-0x000024c3, 0x000024dd, 0x000024c3,
-0x000024c4, 0x000024de, 0x000024c4,
-0x000024c5, 0x000024df, 0x000024c5,
-0x000024c6, 0x000024e0, 0x000024c6,
-0x000024c7, 0x000024e1, 0x000024c7,
-0x000024c8, 0x000024e2, 0x000024c8,
-0x000024c9, 0x000024e3, 0x000024c9,
-0x000024ca, 0x000024e4, 0x000024ca,
-0x000024cb, 0x000024e5, 0x000024cb,
-0x000024cc, 0x000024e6, 0x000024cc,
-0x000024cd, 0x000024e7, 0x000024cd,
-0x000024ce, 0x000024e8, 0x000024ce,
-0x000024cf, 0x000024e9, 0x000024cf,
-0x0000ff21, 0x0000ff41, 0x0000ff21,
-0x0000ff22, 0x0000ff42, 0x0000ff22,
-0x0000ff23, 0x0000ff43, 0x0000ff23,
-0x0000ff24, 0x0000ff44, 0x0000ff24,
-0x0000ff25, 0x0000ff45, 0x0000ff25,
-0x0000ff26, 0x0000ff46, 0x0000ff26,
-0x0000ff27, 0x0000ff47, 0x0000ff27,
-0x0000ff28, 0x0000ff48, 0x0000ff28,
-0x0000ff29, 0x0000ff49, 0x0000ff29,
-0x0000ff2a, 0x0000ff4a, 0x0000ff2a,
-0x0000ff2b, 0x0000ff4b, 0x0000ff2b,
-0x0000ff2c, 0x0000ff4c, 0x0000ff2c,
-0x0000ff2d, 0x0000ff4d, 0x0000ff2d,
-0x0000ff2e, 0x0000ff4e, 0x0000ff2e,
-0x0000ff2f, 0x0000ff4f, 0x0000ff2f,
-0x0000ff30, 0x0000ff50, 0x0000ff30,
-0x0000ff31, 0x0000ff51, 0x0000ff31,
-0x0000ff32, 0x0000ff52, 0x0000ff32,
-0x0000ff33, 0x0000ff53, 0x0000ff33,
-0x0000ff34, 0x0000ff54, 0x0000ff34,
-0x0000ff35, 0x0000ff55, 0x0000ff35,
-0x0000ff36, 0x0000ff56, 0x0000ff36,
-0x0000ff37, 0x0000ff57, 0x0000ff37,
-0x0000ff38, 0x0000ff58, 0x0000ff38,
-0x0000ff39, 0x0000ff59, 0x0000ff39,
-0x0000ff3a, 0x0000ff5a, 0x0000ff3a,
-0x00010400, 0x00010428, 0x00010400,
-0x00010401, 0x00010429, 0x00010401,
-0x00010402, 0x0001042a, 0x00010402,
-0x00010403, 0x0001042b, 0x00010403,
-0x00010404, 0x0001042c, 0x00010404,
-0x00010405, 0x0001042d, 0x00010405,
-0x00010406, 0x0001042e, 0x00010406,
-0x00010407, 0x0001042f, 0x00010407,
-0x00010408, 0x00010430, 0x00010408,
-0x00010409, 0x00010431, 0x00010409,
-0x0001040a, 0x00010432, 0x0001040a,
-0x0001040b, 0x00010433, 0x0001040b,
-0x0001040c, 0x00010434, 0x0001040c,
-0x0001040d, 0x00010435, 0x0001040d,
-0x0001040e, 0x00010436, 0x0001040e,
-0x0001040f, 0x00010437, 0x0001040f,
-0x00010410, 0x00010438, 0x00010410,
-0x00010411, 0x00010439, 0x00010411,
-0x00010412, 0x0001043a, 0x00010412,
-0x00010413, 0x0001043b, 0x00010413,
-0x00010414, 0x0001043c, 0x00010414,
-0x00010415, 0x0001043d, 0x00010415,
-0x00010416, 0x0001043e, 0x00010416,
-0x00010417, 0x0001043f, 0x00010417,
-0x00010418, 0x00010440, 0x00010418,
-0x00010419, 0x00010441, 0x00010419,
-0x0001041a, 0x00010442, 0x0001041a,
-0x0001041b, 0x00010443, 0x0001041b,
-0x0001041c, 0x00010444, 0x0001041c,
-0x0001041d, 0x00010445, 0x0001041d,
-0x0001041e, 0x00010446, 0x0001041e,
-0x0001041f, 0x00010447, 0x0001041f,
-0x00010420, 0x00010448, 0x00010420,
-0x00010421, 0x00010449, 0x00010421,
-0x00010422, 0x0001044a, 0x00010422,
-0x00010423, 0x0001044b, 0x00010423,
-0x00010424, 0x0001044c, 0x00010424,
-0x00010425, 0x0001044d, 0x00010425,
-/* lower */
-0x00000061, 0x00000041, 0x00000041,
-0x00000062, 0x00000042, 0x00000042,
-0x00000063, 0x00000043, 0x00000043,
-0x00000064, 0x00000044, 0x00000044,
-0x00000065, 0x00000045, 0x00000045,
-0x00000066, 0x00000046, 0x00000046,
-0x00000067, 0x00000047, 0x00000047,
-0x00000068, 0x00000048, 0x00000048,
-0x00000069, 0x00000049, 0x00000049,
-0x0000006a, 0x0000004a, 0x0000004a,
-0x0000006b, 0x0000004b, 0x0000004b,
-0x0000006c, 0x0000004c, 0x0000004c,
-0x0000006d, 0x0000004d, 0x0000004d,
-0x0000006e, 0x0000004e, 0x0000004e,
-0x0000006f, 0x0000004f, 0x0000004f,
-0x00000070, 0x00000050, 0x00000050,
-0x00000071, 0x00000051, 0x00000051,
-0x00000072, 0x00000052, 0x00000052,
-0x00000073, 0x00000053, 0x00000053,
-0x00000074, 0x00000054, 0x00000054,
-0x00000075, 0x00000055, 0x00000055,
-0x00000076, 0x00000056, 0x00000056,
-0x00000077, 0x00000057, 0x00000057,
-0x00000078, 0x00000058, 0x00000058,
-0x00000079, 0x00000059, 0x00000059,
-0x0000007a, 0x0000005a, 0x0000005a,
-0x000000b5, 0x0000039c, 0x0000039c,
-0x000000e0, 0x000000c0, 0x000000c0,
-0x000000e1, 0x000000c1, 0x000000c1,
-0x000000e2, 0x000000c2, 0x000000c2,
-0x000000e3, 0x000000c3, 0x000000c3,
-0x000000e4, 0x000000c4, 0x000000c4,
-0x000000e5, 0x000000c5, 0x000000c5,
-0x000000e6, 0x000000c6, 0x000000c6,
-0x000000e7, 0x000000c7, 0x000000c7,
-0x000000e8, 0x000000c8, 0x000000c8,
-0x000000e9, 0x000000c9, 0x000000c9,
-0x000000ea, 0x000000ca, 0x000000ca,
-0x000000eb, 0x000000cb, 0x000000cb,
-0x000000ec, 0x000000cc, 0x000000cc,
-0x000000ed, 0x000000cd, 0x000000cd,
-0x000000ee, 0x000000ce, 0x000000ce,
-0x000000ef, 0x000000cf, 0x000000cf,
-0x000000f0, 0x000000d0, 0x000000d0,
-0x000000f1, 0x000000d1, 0x000000d1,
-0x000000f2, 0x000000d2, 0x000000d2,
-0x000000f3, 0x000000d3, 0x000000d3,
-0x000000f4, 0x000000d4, 0x000000d4,
-0x000000f5, 0x000000d5, 0x000000d5,
-0x000000f6, 0x000000d6, 0x000000d6,
-0x000000f8, 0x000000d8, 0x000000d8,
-0x000000f9, 0x000000d9, 0x000000d9,
-0x000000fa, 0x000000da, 0x000000da,
-0x000000fb, 0x000000db, 0x000000db,
-0x000000fc, 0x000000dc, 0x000000dc,
-0x000000fd, 0x000000dd, 0x000000dd,
-0x000000fe, 0x000000de, 0x000000de,
-0x000000ff, 0x00000178, 0x00000178,
-0x00000101, 0x00000100, 0x00000100,
-0x00000103, 0x00000102, 0x00000102,
-0x00000105, 0x00000104, 0x00000104,
-0x00000107, 0x00000106, 0x00000106,
-0x00000109, 0x00000108, 0x00000108,
-0x0000010b, 0x0000010a, 0x0000010a,
-0x0000010d, 0x0000010c, 0x0000010c,
-0x0000010f, 0x0000010e, 0x0000010e,
-0x00000111, 0x00000110, 0x00000110,
-0x00000113, 0x00000112, 0x00000112,
-0x00000115, 0x00000114, 0x00000114,
-0x00000117, 0x00000116, 0x00000116,
-0x00000119, 0x00000118, 0x00000118,
-0x0000011b, 0x0000011a, 0x0000011a,
-0x0000011d, 0x0000011c, 0x0000011c,
-0x0000011f, 0x0000011e, 0x0000011e,
-0x00000121, 0x00000120, 0x00000120,
-0x00000123, 0x00000122, 0x00000122,
-0x00000125, 0x00000124, 0x00000124,
-0x00000127, 0x00000126, 0x00000126,
-0x00000129, 0x00000128, 0x00000128,
-0x0000012b, 0x0000012a, 0x0000012a,
-0x0000012d, 0x0000012c, 0x0000012c,
-0x0000012f, 0x0000012e, 0x0000012e,
-0x00000131, 0x00000049, 0x00000049,
-0x00000133, 0x00000132, 0x00000132,
-0x00000135, 0x00000134, 0x00000134,
-0x00000137, 0x00000136, 0x00000136,
-0x0000013a, 0x00000139, 0x00000139,
-0x0000013c, 0x0000013b, 0x0000013b,
-0x0000013e, 0x0000013d, 0x0000013d,
-0x00000140, 0x0000013f, 0x0000013f,
-0x00000142, 0x00000141, 0x00000141,
-0x00000144, 0x00000143, 0x00000143,
-0x00000146, 0x00000145, 0x00000145,
-0x00000148, 0x00000147, 0x00000147,
-0x0000014b, 0x0000014a, 0x0000014a,
-0x0000014d, 0x0000014c, 0x0000014c,
-0x0000014f, 0x0000014e, 0x0000014e,
-0x00000151, 0x00000150, 0x00000150,
-0x00000153, 0x00000152, 0x00000152,
-0x00000155, 0x00000154, 0x00000154,
-0x00000157, 0x00000156, 0x00000156,
-0x00000159, 0x00000158, 0x00000158,
-0x0000015b, 0x0000015a, 0x0000015a,
-0x0000015d, 0x0000015c, 0x0000015c,
-0x0000015f, 0x0000015e, 0x0000015e,
-0x00000161, 0x00000160, 0x00000160,
-0x00000163, 0x00000162, 0x00000162,
-0x00000165, 0x00000164, 0x00000164,
-0x00000167, 0x00000166, 0x00000166,
-0x00000169, 0x00000168, 0x00000168,
-0x0000016b, 0x0000016a, 0x0000016a,
-0x0000016d, 0x0000016c, 0x0000016c,
-0x0000016f, 0x0000016e, 0x0000016e,
-0x00000171, 0x00000170, 0x00000170,
-0x00000173, 0x00000172, 0x00000172,
-0x00000175, 0x00000174, 0x00000174,
-0x00000177, 0x00000176, 0x00000176,
-0x0000017a, 0x00000179, 0x00000179,
-0x0000017c, 0x0000017b, 0x0000017b,
-0x0000017e, 0x0000017d, 0x0000017d,
-0x0000017f, 0x00000053, 0x00000053,
-0x00000183, 0x00000182, 0x00000182,
-0x00000185, 0x00000184, 0x00000184,
-0x00000188, 0x00000187, 0x00000187,
-0x0000018c, 0x0000018b, 0x0000018b,
-0x00000192, 0x00000191, 0x00000191,
-0x00000195, 0x000001f6, 0x000001f6,
-0x00000199, 0x00000198, 0x00000198,
-0x0000019e, 0x00000220, 0x00000220,
-0x000001a1, 0x000001a0, 0x000001a0,
-0x000001a3, 0x000001a2, 0x000001a2,
-0x000001a5, 0x000001a4, 0x000001a4,
-0x000001a8, 0x000001a7, 0x000001a7,
-0x000001ad, 0x000001ac, 0x000001ac,
-0x000001b0, 0x000001af, 0x000001af,
-0x000001b4, 0x000001b3, 0x000001b3,
-0x000001b6, 0x000001b5, 0x000001b5,
-0x000001b9, 0x000001b8, 0x000001b8,
-0x000001bd, 0x000001bc, 0x000001bc,
-0x000001bf, 0x000001f7, 0x000001f7,
-0x000001c6, 0x000001c4, 0x000001c5,
-0x000001c9, 0x000001c7, 0x000001c8,
-0x000001cc, 0x000001ca, 0x000001cb,
-0x000001ce, 0x000001cd, 0x000001cd,
-0x000001d0, 0x000001cf, 0x000001cf,
-0x000001d2, 0x000001d1, 0x000001d1,
-0x000001d4, 0x000001d3, 0x000001d3,
-0x000001d6, 0x000001d5, 0x000001d5,
-0x000001d8, 0x000001d7, 0x000001d7,
-0x000001da, 0x000001d9, 0x000001d9,
-0x000001dc, 0x000001db, 0x000001db,
-0x000001dd, 0x0000018e, 0x0000018e,
-0x000001df, 0x000001de, 0x000001de,
-0x000001e1, 0x000001e0, 0x000001e0,
-0x000001e3, 0x000001e2, 0x000001e2,
-0x000001e5, 0x000001e4, 0x000001e4,
-0x000001e7, 0x000001e6, 0x000001e6,
-0x000001e9, 0x000001e8, 0x000001e8,
-0x000001eb, 0x000001ea, 0x000001ea,
-0x000001ed, 0x000001ec, 0x000001ec,
-0x000001ef, 0x000001ee, 0x000001ee,
-0x000001f3, 0x000001f1, 0x000001f2,
-0x000001f5, 0x000001f4, 0x000001f4,
-0x000001f9, 0x000001f8, 0x000001f8,
-0x000001fb, 0x000001fa, 0x000001fa,
-0x000001fd, 0x000001fc, 0x000001fc,
-0x000001ff, 0x000001fe, 0x000001fe,
-0x00000201, 0x00000200, 0x00000200,
-0x00000203, 0x00000202, 0x00000202,
-0x00000205, 0x00000204, 0x00000204,
-0x00000207, 0x00000206, 0x00000206,
-0x00000209, 0x00000208, 0x00000208,
-0x0000020b, 0x0000020a, 0x0000020a,
-0x0000020d, 0x0000020c, 0x0000020c,
-0x0000020f, 0x0000020e, 0x0000020e,
-0x00000211, 0x00000210, 0x00000210,
-0x00000213, 0x00000212, 0x00000212,
-0x00000215, 0x00000214, 0x00000214,
-0x00000217, 0x00000216, 0x00000216,
-0x00000219, 0x00000218, 0x00000218,
-0x0000021b, 0x0000021a, 0x0000021a,
-0x0000021d, 0x0000021c, 0x0000021c,
-0x0000021f, 0x0000021e, 0x0000021e,
-0x00000223, 0x00000222, 0x00000222,
-0x00000225, 0x00000224, 0x00000224,
-0x00000227, 0x00000226, 0x00000226,
-0x00000229, 0x00000228, 0x00000228,
-0x0000022b, 0x0000022a, 0x0000022a,
-0x0000022d, 0x0000022c, 0x0000022c,
-0x0000022f, 0x0000022e, 0x0000022e,
-0x00000231, 0x00000230, 0x00000230,
-0x00000233, 0x00000232, 0x00000232,
-0x00000253, 0x00000181, 0x00000181,
-0x00000254, 0x00000186, 0x00000186,
-0x00000256, 0x00000189, 0x00000189,
-0x00000257, 0x0000018a, 0x0000018a,
-0x00000259, 0x0000018f, 0x0000018f,
-0x0000025b, 0x00000190, 0x00000190,
-0x00000260, 0x00000193, 0x00000193,
-0x00000263, 0x00000194, 0x00000194,
-0x00000268, 0x00000197, 0x00000197,
-0x00000269, 0x00000196, 0x00000196,
-0x0000026f, 0x0000019c, 0x0000019c,
-0x00000272, 0x0000019d, 0x0000019d,
-0x00000275, 0x0000019f, 0x0000019f,
-0x00000280, 0x000001a6, 0x000001a6,
-0x00000283, 0x000001a9, 0x000001a9,
-0x00000288, 0x000001ae, 0x000001ae,
-0x0000028a, 0x000001b1, 0x000001b1,
-0x0000028b, 0x000001b2, 0x000001b2,
-0x00000292, 0x000001b7, 0x000001b7,
-0x00000345, 0x00000399, 0x00000399,
-0x000003ac, 0x00000386, 0x00000386,
-0x000003ad, 0x00000388, 0x00000388,
-0x000003ae, 0x00000389, 0x00000389,
-0x000003af, 0x0000038a, 0x0000038a,
-0x000003b1, 0x00000391, 0x00000391,
-0x000003b2, 0x00000392, 0x00000392,
-0x000003b3, 0x00000393, 0x00000393,
-0x000003b4, 0x00000394, 0x00000394,
-0x000003b5, 0x00000395, 0x00000395,
-0x000003b6, 0x00000396, 0x00000396,
-0x000003b7, 0x00000397, 0x00000397,
-0x000003b8, 0x00000398, 0x00000398,
-0x000003b9, 0x00000399, 0x00000399,
-0x000003ba, 0x0000039a, 0x0000039a,
-0x000003bb, 0x0000039b, 0x0000039b,
-0x000003bc, 0x0000039c, 0x0000039c,
-0x000003bd, 0x0000039d, 0x0000039d,
-0x000003be, 0x0000039e, 0x0000039e,
-0x000003bf, 0x0000039f, 0x0000039f,
-0x000003c0, 0x000003a0, 0x000003a0,
-0x000003c1, 0x000003a1, 0x000003a1,
-0x000003c2, 0x000003a3, 0x000003a3,
-0x000003c3, 0x000003a3, 0x000003a3,
-0x000003c4, 0x000003a4, 0x000003a4,
-0x000003c5, 0x000003a5, 0x000003a5,
-0x000003c6, 0x000003a6, 0x000003a6,
-0x000003c7, 0x000003a7, 0x000003a7,
-0x000003c8, 0x000003a8, 0x000003a8,
-0x000003c9, 0x000003a9, 0x000003a9,
-0x000003ca, 0x000003aa, 0x000003aa,
-0x000003cb, 0x000003ab, 0x000003ab,
-0x000003cc, 0x0000038c, 0x0000038c,
-0x000003cd, 0x0000038e, 0x0000038e,
-0x000003ce, 0x0000038f, 0x0000038f,
-0x000003d0, 0x00000392, 0x00000392,
-0x000003d1, 0x00000398, 0x00000398,
-0x000003d5, 0x000003a6, 0x000003a6,
-0x000003d6, 0x000003a0, 0x000003a0,
-0x000003d9, 0x000003d8, 0x000003d8,
-0x000003db, 0x000003da, 0x000003da,
-0x000003dd, 0x000003dc, 0x000003dc,
-0x000003df, 0x000003de, 0x000003de,
-0x000003e1, 0x000003e0, 0x000003e0,
-0x000003e3, 0x000003e2, 0x000003e2,
-0x000003e5, 0x000003e4, 0x000003e4,
-0x000003e7, 0x000003e6, 0x000003e6,
-0x000003e9, 0x000003e8, 0x000003e8,
-0x000003eb, 0x000003ea, 0x000003ea,
-0x000003ed, 0x000003ec, 0x000003ec,
-0x000003ef, 0x000003ee, 0x000003ee,
-0x000003f0, 0x0000039a, 0x0000039a,
-0x000003f1, 0x000003a1, 0x000003a1,
-0x000003f2, 0x000003a3, 0x000003a3,
-0x000003f5, 0x00000395, 0x00000395,
-0x00000430, 0x00000410, 0x00000410,
-0x00000431, 0x00000411, 0x00000411,
-0x00000432, 0x00000412, 0x00000412,
-0x00000433, 0x00000413, 0x00000413,
-0x00000434, 0x00000414, 0x00000414,
-0x00000435, 0x00000415, 0x00000415,
-0x00000436, 0x00000416, 0x00000416,
-0x00000437, 0x00000417, 0x00000417,
-0x00000438, 0x00000418, 0x00000418,
-0x00000439, 0x00000419, 0x00000419,
-0x0000043a, 0x0000041a, 0x0000041a,
-0x0000043b, 0x0000041b, 0x0000041b,
-0x0000043c, 0x0000041c, 0x0000041c,
-0x0000043d, 0x0000041d, 0x0000041d,
-0x0000043e, 0x0000041e, 0x0000041e,
-0x0000043f, 0x0000041f, 0x0000041f,
-0x00000440, 0x00000420, 0x00000420,
-0x00000441, 0x00000421, 0x00000421,
-0x00000442, 0x00000422, 0x00000422,
-0x00000443, 0x00000423, 0x00000423,
-0x00000444, 0x00000424, 0x00000424,
-0x00000445, 0x00000425, 0x00000425,
-0x00000446, 0x00000426, 0x00000426,
-0x00000447, 0x00000427, 0x00000427,
-0x00000448, 0x00000428, 0x00000428,
-0x00000449, 0x00000429, 0x00000429,
-0x0000044a, 0x0000042a, 0x0000042a,
-0x0000044b, 0x0000042b, 0x0000042b,
-0x0000044c, 0x0000042c, 0x0000042c,
-0x0000044d, 0x0000042d, 0x0000042d,
-0x0000044e, 0x0000042e, 0x0000042e,
-0x0000044f, 0x0000042f, 0x0000042f,
-0x00000450, 0x00000400, 0x00000400,
-0x00000451, 0x00000401, 0x00000401,
-0x00000452, 0x00000402, 0x00000402,
-0x00000453, 0x00000403, 0x00000403,
-0x00000454, 0x00000404, 0x00000404,
-0x00000455, 0x00000405, 0x00000405,
-0x00000456, 0x00000406, 0x00000406,
-0x00000457, 0x00000407, 0x00000407,
-0x00000458, 0x00000408, 0x00000408,
-0x00000459, 0x00000409, 0x00000409,
-0x0000045a, 0x0000040a, 0x0000040a,
-0x0000045b, 0x0000040b, 0x0000040b,
-0x0000045c, 0x0000040c, 0x0000040c,
-0x0000045d, 0x0000040d, 0x0000040d,
-0x0000045e, 0x0000040e, 0x0000040e,
-0x0000045f, 0x0000040f, 0x0000040f,
-0x00000461, 0x00000460, 0x00000460,
-0x00000463, 0x00000462, 0x00000462,
-0x00000465, 0x00000464, 0x00000464,
-0x00000467, 0x00000466, 0x00000466,
-0x00000469, 0x00000468, 0x00000468,
-0x0000046b, 0x0000046a, 0x0000046a,
-0x0000046d, 0x0000046c, 0x0000046c,
-0x0000046f, 0x0000046e, 0x0000046e,
-0x00000471, 0x00000470, 0x00000470,
-0x00000473, 0x00000472, 0x00000472,
-0x00000475, 0x00000474, 0x00000474,
-0x00000477, 0x00000476, 0x00000476,
-0x00000479, 0x00000478, 0x00000478,
-0x0000047b, 0x0000047a, 0x0000047a,
-0x0000047d, 0x0000047c, 0x0000047c,
-0x0000047f, 0x0000047e, 0x0000047e,
-0x00000481, 0x00000480, 0x00000480,
-0x0000048b, 0x0000048a, 0x0000048a,
-0x0000048d, 0x0000048c, 0x0000048c,
-0x0000048f, 0x0000048e, 0x0000048e,
-0x00000491, 0x00000490, 0x00000490,
-0x00000493, 0x00000492, 0x00000492,
-0x00000495, 0x00000494, 0x00000494,
-0x00000497, 0x00000496, 0x00000496,
-0x00000499, 0x00000498, 0x00000498,
-0x0000049b, 0x0000049a, 0x0000049a,
-0x0000049d, 0x0000049c, 0x0000049c,
-0x0000049f, 0x0000049e, 0x0000049e,
-0x000004a1, 0x000004a0, 0x000004a0,
-0x000004a3, 0x000004a2, 0x000004a2,
-0x000004a5, 0x000004a4, 0x000004a4,
-0x000004a7, 0x000004a6, 0x000004a6,
-0x000004a9, 0x000004a8, 0x000004a8,
-0x000004ab, 0x000004aa, 0x000004aa,
-0x000004ad, 0x000004ac, 0x000004ac,
-0x000004af, 0x000004ae, 0x000004ae,
-0x000004b1, 0x000004b0, 0x000004b0,
-0x000004b3, 0x000004b2, 0x000004b2,
-0x000004b5, 0x000004b4, 0x000004b4,
-0x000004b7, 0x000004b6, 0x000004b6,
-0x000004b9, 0x000004b8, 0x000004b8,
-0x000004bb, 0x000004ba, 0x000004ba,
-0x000004bd, 0x000004bc, 0x000004bc,
-0x000004bf, 0x000004be, 0x000004be,
-0x000004c2, 0x000004c1, 0x000004c1,
-0x000004c4, 0x000004c3, 0x000004c3,
-0x000004c6, 0x000004c5, 0x000004c5,
-0x000004c8, 0x000004c7, 0x000004c7,
-0x000004ca, 0x000004c9, 0x000004c9,
-0x000004cc, 0x000004cb, 0x000004cb,
-0x000004ce, 0x000004cd, 0x000004cd,
-0x000004d1, 0x000004d0, 0x000004d0,
-0x000004d3, 0x000004d2, 0x000004d2,
-0x000004d5, 0x000004d4, 0x000004d4,
-0x000004d7, 0x000004d6, 0x000004d6,
-0x000004d9, 0x000004d8, 0x000004d8,
-0x000004db, 0x000004da, 0x000004da,
-0x000004dd, 0x000004dc, 0x000004dc,
-0x000004df, 0x000004de, 0x000004de,
-0x000004e1, 0x000004e0, 0x000004e0,
-0x000004e3, 0x000004e2, 0x000004e2,
-0x000004e5, 0x000004e4, 0x000004e4,
-0x000004e7, 0x000004e6, 0x000004e6,
-0x000004e9, 0x000004e8, 0x000004e8,
-0x000004eb, 0x000004ea, 0x000004ea,
-0x000004ed, 0x000004ec, 0x000004ec,
-0x000004ef, 0x000004ee, 0x000004ee,
-0x000004f1, 0x000004f0, 0x000004f0,
-0x000004f3, 0x000004f2, 0x000004f2,
-0x000004f5, 0x000004f4, 0x000004f4,
-0x000004f9, 0x000004f8, 0x000004f8,
-0x00000501, 0x00000500, 0x00000500,
-0x00000503, 0x00000502, 0x00000502,
-0x00000505, 0x00000504, 0x00000504,
-0x00000507, 0x00000506, 0x00000506,
-0x00000509, 0x00000508, 0x00000508,
-0x0000050b, 0x0000050a, 0x0000050a,
-0x0000050d, 0x0000050c, 0x0000050c,
-0x0000050f, 0x0000050e, 0x0000050e,
-0x00000561, 0x00000531, 0x00000531,
-0x00000562, 0x00000532, 0x00000532,
-0x00000563, 0x00000533, 0x00000533,
-0x00000564, 0x00000534, 0x00000534,
-0x00000565, 0x00000535, 0x00000535,
-0x00000566, 0x00000536, 0x00000536,
-0x00000567, 0x00000537, 0x00000537,
-0x00000568, 0x00000538, 0x00000538,
-0x00000569, 0x00000539, 0x00000539,
-0x0000056a, 0x0000053a, 0x0000053a,
-0x0000056b, 0x0000053b, 0x0000053b,
-0x0000056c, 0x0000053c, 0x0000053c,
-0x0000056d, 0x0000053d, 0x0000053d,
-0x0000056e, 0x0000053e, 0x0000053e,
-0x0000056f, 0x0000053f, 0x0000053f,
-0x00000570, 0x00000540, 0x00000540,
-0x00000571, 0x00000541, 0x00000541,
-0x00000572, 0x00000542, 0x00000542,
-0x00000573, 0x00000543, 0x00000543,
-0x00000574, 0x00000544, 0x00000544,
-0x00000575, 0x00000545, 0x00000545,
-0x00000576, 0x00000546, 0x00000546,
-0x00000577, 0x00000547, 0x00000547,
-0x00000578, 0x00000548, 0x00000548,
-0x00000579, 0x00000549, 0x00000549,
-0x0000057a, 0x0000054a, 0x0000054a,
-0x0000057b, 0x0000054b, 0x0000054b,
-0x0000057c, 0x0000054c, 0x0000054c,
-0x0000057d, 0x0000054d, 0x0000054d,
-0x0000057e, 0x0000054e, 0x0000054e,
-0x0000057f, 0x0000054f, 0x0000054f,
-0x00000580, 0x00000550, 0x00000550,
-0x00000581, 0x00000551, 0x00000551,
-0x00000582, 0x00000552, 0x00000552,
-0x00000583, 0x00000553, 0x00000553,
-0x00000584, 0x00000554, 0x00000554,
-0x00000585, 0x00000555, 0x00000555,
-0x00000586, 0x00000556, 0x00000556,
-0x00001e01, 0x00001e00, 0x00001e00,
-0x00001e03, 0x00001e02, 0x00001e02,
-0x00001e05, 0x00001e04, 0x00001e04,
-0x00001e07, 0x00001e06, 0x00001e06,
-0x00001e09, 0x00001e08, 0x00001e08,
-0x00001e0b, 0x00001e0a, 0x00001e0a,
-0x00001e0d, 0x00001e0c, 0x00001e0c,
-0x00001e0f, 0x00001e0e, 0x00001e0e,
-0x00001e11, 0x00001e10, 0x00001e10,
-0x00001e13, 0x00001e12, 0x00001e12,
-0x00001e15, 0x00001e14, 0x00001e14,
-0x00001e17, 0x00001e16, 0x00001e16,
-0x00001e19, 0x00001e18, 0x00001e18,
-0x00001e1b, 0x00001e1a, 0x00001e1a,
-0x00001e1d, 0x00001e1c, 0x00001e1c,
-0x00001e1f, 0x00001e1e, 0x00001e1e,
-0x00001e21, 0x00001e20, 0x00001e20,
-0x00001e23, 0x00001e22, 0x00001e22,
-0x00001e25, 0x00001e24, 0x00001e24,
-0x00001e27, 0x00001e26, 0x00001e26,
-0x00001e29, 0x00001e28, 0x00001e28,
-0x00001e2b, 0x00001e2a, 0x00001e2a,
-0x00001e2d, 0x00001e2c, 0x00001e2c,
-0x00001e2f, 0x00001e2e, 0x00001e2e,
-0x00001e31, 0x00001e30, 0x00001e30,
-0x00001e33, 0x00001e32, 0x00001e32,
-0x00001e35, 0x00001e34, 0x00001e34,
-0x00001e37, 0x00001e36, 0x00001e36,
-0x00001e39, 0x00001e38, 0x00001e38,
-0x00001e3b, 0x00001e3a, 0x00001e3a,
-0x00001e3d, 0x00001e3c, 0x00001e3c,
-0x00001e3f, 0x00001e3e, 0x00001e3e,
-0x00001e41, 0x00001e40, 0x00001e40,
-0x00001e43, 0x00001e42, 0x00001e42,
-0x00001e45, 0x00001e44, 0x00001e44,
-0x00001e47, 0x00001e46, 0x00001e46,
-0x00001e49, 0x00001e48, 0x00001e48,
-0x00001e4b, 0x00001e4a, 0x00001e4a,
-0x00001e4d, 0x00001e4c, 0x00001e4c,
-0x00001e4f, 0x00001e4e, 0x00001e4e,
-0x00001e51, 0x00001e50, 0x00001e50,
-0x00001e53, 0x00001e52, 0x00001e52,
-0x00001e55, 0x00001e54, 0x00001e54,
-0x00001e57, 0x00001e56, 0x00001e56,
-0x00001e59, 0x00001e58, 0x00001e58,
-0x00001e5b, 0x00001e5a, 0x00001e5a,
-0x00001e5d, 0x00001e5c, 0x00001e5c,
-0x00001e5f, 0x00001e5e, 0x00001e5e,
-0x00001e61, 0x00001e60, 0x00001e60,
-0x00001e63, 0x00001e62, 0x00001e62,
-0x00001e65, 0x00001e64, 0x00001e64,
-0x00001e67, 0x00001e66, 0x00001e66,
-0x00001e69, 0x00001e68, 0x00001e68,
-0x00001e6b, 0x00001e6a, 0x00001e6a,
-0x00001e6d, 0x00001e6c, 0x00001e6c,
-0x00001e6f, 0x00001e6e, 0x00001e6e,
-0x00001e71, 0x00001e70, 0x00001e70,
-0x00001e73, 0x00001e72, 0x00001e72,
-0x00001e75, 0x00001e74, 0x00001e74,
-0x00001e77, 0x00001e76, 0x00001e76,
-0x00001e79, 0x00001e78, 0x00001e78,
-0x00001e7b, 0x00001e7a, 0x00001e7a,
-0x00001e7d, 0x00001e7c, 0x00001e7c,
-0x00001e7f, 0x00001e7e, 0x00001e7e,
-0x00001e81, 0x00001e80, 0x00001e80,
-0x00001e83, 0x00001e82, 0x00001e82,
-0x00001e85, 0x00001e84, 0x00001e84,
-0x00001e87, 0x00001e86, 0x00001e86,
-0x00001e89, 0x00001e88, 0x00001e88,
-0x00001e8b, 0x00001e8a, 0x00001e8a,
-0x00001e8d, 0x00001e8c, 0x00001e8c,
-0x00001e8f, 0x00001e8e, 0x00001e8e,
-0x00001e91, 0x00001e90, 0x00001e90,
-0x00001e93, 0x00001e92, 0x00001e92,
-0x00001e95, 0x00001e94, 0x00001e94,
-0x00001e9b, 0x00001e60, 0x00001e60,
-0x00001ea1, 0x00001ea0, 0x00001ea0,
-0x00001ea3, 0x00001ea2, 0x00001ea2,
-0x00001ea5, 0x00001ea4, 0x00001ea4,
-0x00001ea7, 0x00001ea6, 0x00001ea6,
-0x00001ea9, 0x00001ea8, 0x00001ea8,
-0x00001eab, 0x00001eaa, 0x00001eaa,
-0x00001ead, 0x00001eac, 0x00001eac,
-0x00001eaf, 0x00001eae, 0x00001eae,
-0x00001eb1, 0x00001eb0, 0x00001eb0,
-0x00001eb3, 0x00001eb2, 0x00001eb2,
-0x00001eb5, 0x00001eb4, 0x00001eb4,
-0x00001eb7, 0x00001eb6, 0x00001eb6,
-0x00001eb9, 0x00001eb8, 0x00001eb8,
-0x00001ebb, 0x00001eba, 0x00001eba,
-0x00001ebd, 0x00001ebc, 0x00001ebc,
-0x00001ebf, 0x00001ebe, 0x00001ebe,
-0x00001ec1, 0x00001ec0, 0x00001ec0,
-0x00001ec3, 0x00001ec2, 0x00001ec2,
-0x00001ec5, 0x00001ec4, 0x00001ec4,
-0x00001ec7, 0x00001ec6, 0x00001ec6,
-0x00001ec9, 0x00001ec8, 0x00001ec8,
-0x00001ecb, 0x00001eca, 0x00001eca,
-0x00001ecd, 0x00001ecc, 0x00001ecc,
-0x00001ecf, 0x00001ece, 0x00001ece,
-0x00001ed1, 0x00001ed0, 0x00001ed0,
-0x00001ed3, 0x00001ed2, 0x00001ed2,
-0x00001ed5, 0x00001ed4, 0x00001ed4,
-0x00001ed7, 0x00001ed6, 0x00001ed6,
-0x00001ed9, 0x00001ed8, 0x00001ed8,
-0x00001edb, 0x00001eda, 0x00001eda,
-0x00001edd, 0x00001edc, 0x00001edc,
-0x00001edf, 0x00001ede, 0x00001ede,
-0x00001ee1, 0x00001ee0, 0x00001ee0,
-0x00001ee3, 0x00001ee2, 0x00001ee2,
-0x00001ee5, 0x00001ee4, 0x00001ee4,
-0x00001ee7, 0x00001ee6, 0x00001ee6,
-0x00001ee9, 0x00001ee8, 0x00001ee8,
-0x00001eeb, 0x00001eea, 0x00001eea,
-0x00001eed, 0x00001eec, 0x00001eec,
-0x00001eef, 0x00001eee, 0x00001eee,
-0x00001ef1, 0x00001ef0, 0x00001ef0,
-0x00001ef3, 0x00001ef2, 0x00001ef2,
-0x00001ef5, 0x00001ef4, 0x00001ef4,
-0x00001ef7, 0x00001ef6, 0x00001ef6,
-0x00001ef9, 0x00001ef8, 0x00001ef8,
-0x00001f00, 0x00001f08, 0x00001f08,
-0x00001f01, 0x00001f09, 0x00001f09,
-0x00001f02, 0x00001f0a, 0x00001f0a,
-0x00001f03, 0x00001f0b, 0x00001f0b,
-0x00001f04, 0x00001f0c, 0x00001f0c,
-0x00001f05, 0x00001f0d, 0x00001f0d,
-0x00001f06, 0x00001f0e, 0x00001f0e,
-0x00001f07, 0x00001f0f, 0x00001f0f,
-0x00001f10, 0x00001f18, 0x00001f18,
-0x00001f11, 0x00001f19, 0x00001f19,
-0x00001f12, 0x00001f1a, 0x00001f1a,
-0x00001f13, 0x00001f1b, 0x00001f1b,
-0x00001f14, 0x00001f1c, 0x00001f1c,
-0x00001f15, 0x00001f1d, 0x00001f1d,
-0x00001f20, 0x00001f28, 0x00001f28,
-0x00001f21, 0x00001f29, 0x00001f29,
-0x00001f22, 0x00001f2a, 0x00001f2a,
-0x00001f23, 0x00001f2b, 0x00001f2b,
-0x00001f24, 0x00001f2c, 0x00001f2c,
-0x00001f25, 0x00001f2d, 0x00001f2d,
-0x00001f26, 0x00001f2e, 0x00001f2e,
-0x00001f27, 0x00001f2f, 0x00001f2f,
-0x00001f30, 0x00001f38, 0x00001f38,
-0x00001f31, 0x00001f39, 0x00001f39,
-0x00001f32, 0x00001f3a, 0x00001f3a,
-0x00001f33, 0x00001f3b, 0x00001f3b,
-0x00001f34, 0x00001f3c, 0x00001f3c,
-0x00001f35, 0x00001f3d, 0x00001f3d,
-0x00001f36, 0x00001f3e, 0x00001f3e,
-0x00001f37, 0x00001f3f, 0x00001f3f,
-0x00001f40, 0x00001f48, 0x00001f48,
-0x00001f41, 0x00001f49, 0x00001f49,
-0x00001f42, 0x00001f4a, 0x00001f4a,
-0x00001f43, 0x00001f4b, 0x00001f4b,
-0x00001f44, 0x00001f4c, 0x00001f4c,
-0x00001f45, 0x00001f4d, 0x00001f4d,
-0x00001f51, 0x00001f59, 0x00001f59,
-0x00001f53, 0x00001f5b, 0x00001f5b,
-0x00001f55, 0x00001f5d, 0x00001f5d,
-0x00001f57, 0x00001f5f, 0x00001f5f,
-0x00001f60, 0x00001f68, 0x00001f68,
-0x00001f61, 0x00001f69, 0x00001f69,
-0x00001f62, 0x00001f6a, 0x00001f6a,
-0x00001f63, 0x00001f6b, 0x00001f6b,
-0x00001f64, 0x00001f6c, 0x00001f6c,
-0x00001f65, 0x00001f6d, 0x00001f6d,
-0x00001f66, 0x00001f6e, 0x00001f6e,
-0x00001f67, 0x00001f6f, 0x00001f6f,
-0x00001f70, 0x00001fba, 0x00001fba,
-0x00001f71, 0x00001fbb, 0x00001fbb,
-0x00001f72, 0x00001fc8, 0x00001fc8,
-0x00001f73, 0x00001fc9, 0x00001fc9,
-0x00001f74, 0x00001fca, 0x00001fca,
-0x00001f75, 0x00001fcb, 0x00001fcb,
-0x00001f76, 0x00001fda, 0x00001fda,
-0x00001f77, 0x00001fdb, 0x00001fdb,
-0x00001f78, 0x00001ff8, 0x00001ff8,
-0x00001f79, 0x00001ff9, 0x00001ff9,
-0x00001f7a, 0x00001fea, 0x00001fea,
-0x00001f7b, 0x00001feb, 0x00001feb,
-0x00001f7c, 0x00001ffa, 0x00001ffa,
-0x00001f7d, 0x00001ffb, 0x00001ffb,
-0x00001f80, 0x00001f88, 0x00001f88,
-0x00001f81, 0x00001f89, 0x00001f89,
-0x00001f82, 0x00001f8a, 0x00001f8a,
-0x00001f83, 0x00001f8b, 0x00001f8b,
-0x00001f84, 0x00001f8c, 0x00001f8c,
-0x00001f85, 0x00001f8d, 0x00001f8d,
-0x00001f86, 0x00001f8e, 0x00001f8e,
-0x00001f87, 0x00001f8f, 0x00001f8f,
-0x00001f90, 0x00001f98, 0x00001f98,
-0x00001f91, 0x00001f99, 0x00001f99,
-0x00001f92, 0x00001f9a, 0x00001f9a,
-0x00001f93, 0x00001f9b, 0x00001f9b,
-0x00001f94, 0x00001f9c, 0x00001f9c,
-0x00001f95, 0x00001f9d, 0x00001f9d,
-0x00001f96, 0x00001f9e, 0x00001f9e,
-0x00001f97, 0x00001f9f, 0x00001f9f,
-0x00001fa0, 0x00001fa8, 0x00001fa8,
-0x00001fa1, 0x00001fa9, 0x00001fa9,
-0x00001fa2, 0x00001faa, 0x00001faa,
-0x00001fa3, 0x00001fab, 0x00001fab,
-0x00001fa4, 0x00001fac, 0x00001fac,
-0x00001fa5, 0x00001fad, 0x00001fad,
-0x00001fa6, 0x00001fae, 0x00001fae,
-0x00001fa7, 0x00001faf, 0x00001faf,
-0x00001fb0, 0x00001fb8, 0x00001fb8,
-0x00001fb1, 0x00001fb9, 0x00001fb9,
-0x00001fb3, 0x00001fbc, 0x00001fbc,
-0x00001fbe, 0x00000399, 0x00000399,
-0x00001fc3, 0x00001fcc, 0x00001fcc,
-0x00001fd0, 0x00001fd8, 0x00001fd8,
-0x00001fd1, 0x00001fd9, 0x00001fd9,
-0x00001fe0, 0x00001fe8, 0x00001fe8,
-0x00001fe1, 0x00001fe9, 0x00001fe9,
-0x00001fe5, 0x00001fec, 0x00001fec,
-0x00001ff3, 0x00001ffc, 0x00001ffc,
-0x00002170, 0x00002160, 0x00002160,
-0x00002171, 0x00002161, 0x00002161,
-0x00002172, 0x00002162, 0x00002162,
-0x00002173, 0x00002163, 0x00002163,
-0x00002174, 0x00002164, 0x00002164,
-0x00002175, 0x00002165, 0x00002165,
-0x00002176, 0x00002166, 0x00002166,
-0x00002177, 0x00002167, 0x00002167,
-0x00002178, 0x00002168, 0x00002168,
-0x00002179, 0x00002169, 0x00002169,
-0x0000217a, 0x0000216a, 0x0000216a,
-0x0000217b, 0x0000216b, 0x0000216b,
-0x0000217c, 0x0000216c, 0x0000216c,
-0x0000217d, 0x0000216d, 0x0000216d,
-0x0000217e, 0x0000216e, 0x0000216e,
-0x0000217f, 0x0000216f, 0x0000216f,
-0x000024d0, 0x000024b6, 0x000024b6,
-0x000024d1, 0x000024b7, 0x000024b7,
-0x000024d2, 0x000024b8, 0x000024b8,
-0x000024d3, 0x000024b9, 0x000024b9,
-0x000024d4, 0x000024ba, 0x000024ba,
-0x000024d5, 0x000024bb, 0x000024bb,
-0x000024d6, 0x000024bc, 0x000024bc,
-0x000024d7, 0x000024bd, 0x000024bd,
-0x000024d8, 0x000024be, 0x000024be,
-0x000024d9, 0x000024bf, 0x000024bf,
-0x000024da, 0x000024c0, 0x000024c0,
-0x000024db, 0x000024c1, 0x000024c1,
-0x000024dc, 0x000024c2, 0x000024c2,
-0x000024dd, 0x000024c3, 0x000024c3,
-0x000024de, 0x000024c4, 0x000024c4,
-0x000024df, 0x000024c5, 0x000024c5,
-0x000024e0, 0x000024c6, 0x000024c6,
-0x000024e1, 0x000024c7, 0x000024c7,
-0x000024e2, 0x000024c8, 0x000024c8,
-0x000024e3, 0x000024c9, 0x000024c9,
-0x000024e4, 0x000024ca, 0x000024ca,
-0x000024e5, 0x000024cb, 0x000024cb,
-0x000024e6, 0x000024cc, 0x000024cc,
-0x000024e7, 0x000024cd, 0x000024cd,
-0x000024e8, 0x000024ce, 0x000024ce,
-0x000024e9, 0x000024cf, 0x000024cf,
-0x0000ff41, 0x0000ff21, 0x0000ff21,
-0x0000ff42, 0x0000ff22, 0x0000ff22,
-0x0000ff43, 0x0000ff23, 0x0000ff23,
-0x0000ff44, 0x0000ff24, 0x0000ff24,
-0x0000ff45, 0x0000ff25, 0x0000ff25,
-0x0000ff46, 0x0000ff26, 0x0000ff26,
-0x0000ff47, 0x0000ff27, 0x0000ff27,
-0x0000ff48, 0x0000ff28, 0x0000ff28,
-0x0000ff49, 0x0000ff29, 0x0000ff29,
-0x0000ff4a, 0x0000ff2a, 0x0000ff2a,
-0x0000ff4b, 0x0000ff2b, 0x0000ff2b,
-0x0000ff4c, 0x0000ff2c, 0x0000ff2c,
-0x0000ff4d, 0x0000ff2d, 0x0000ff2d,
-0x0000ff4e, 0x0000ff2e, 0x0000ff2e,
-0x0000ff4f, 0x0000ff2f, 0x0000ff2f,
-0x0000ff50, 0x0000ff30, 0x0000ff30,
-0x0000ff51, 0x0000ff31, 0x0000ff31,
-0x0000ff52, 0x0000ff32, 0x0000ff32,
-0x0000ff53, 0x0000ff33, 0x0000ff33,
-0x0000ff54, 0x0000ff34, 0x0000ff34,
-0x0000ff55, 0x0000ff35, 0x0000ff35,
-0x0000ff56, 0x0000ff36, 0x0000ff36,
-0x0000ff57, 0x0000ff37, 0x0000ff37,
-0x0000ff58, 0x0000ff38, 0x0000ff38,
-0x0000ff59, 0x0000ff39, 0x0000ff39,
-0x0000ff5a, 0x0000ff3a, 0x0000ff3a,
-0x00010428, 0x00010400, 0x00010400,
-0x00010429, 0x00010401, 0x00010401,
-0x0001042a, 0x00010402, 0x00010402,
-0x0001042b, 0x00010403, 0x00010403,
-0x0001042c, 0x00010404, 0x00010404,
-0x0001042d, 0x00010405, 0x00010405,
-0x0001042e, 0x00010406, 0x00010406,
-0x0001042f, 0x00010407, 0x00010407,
-0x00010430, 0x00010408, 0x00010408,
-0x00010431, 0x00010409, 0x00010409,
-0x00010432, 0x0001040a, 0x0001040a,
-0x00010433, 0x0001040b, 0x0001040b,
-0x00010434, 0x0001040c, 0x0001040c,
-0x00010435, 0x0001040d, 0x0001040d,
-0x00010436, 0x0001040e, 0x0001040e,
-0x00010437, 0x0001040f, 0x0001040f,
-0x00010438, 0x00010410, 0x00010410,
-0x00010439, 0x00010411, 0x00010411,
-0x0001043a, 0x00010412, 0x00010412,
-0x0001043b, 0x00010413, 0x00010413,
-0x0001043c, 0x00010414, 0x00010414,
-0x0001043d, 0x00010415, 0x00010415,
-0x0001043e, 0x00010416, 0x00010416,
-0x0001043f, 0x00010417, 0x00010417,
-0x00010440, 0x00010418, 0x00010418,
-0x00010441, 0x00010419, 0x00010419,
-0x00010442, 0x0001041a, 0x0001041a,
-0x00010443, 0x0001041b, 0x0001041b,
-0x00010444, 0x0001041c, 0x0001041c,
-0x00010445, 0x0001041d, 0x0001041d,
-0x00010446, 0x0001041e, 0x0001041e,
-0x00010447, 0x0001041f, 0x0001041f,
-0x00010448, 0x00010420, 0x00010420,
-0x00010449, 0x00010421, 0x00010421,
-0x0001044a, 0x00010422, 0x00010422,
-0x0001044b, 0x00010423, 0x00010423,
-0x0001044c, 0x00010424, 0x00010424,
-0x0001044d, 0x00010425, 0x00010425,
-/* title */
-0x000001c5, 0x000001c4, 0x000001c6,
-0x000001c8, 0x000001c7, 0x000001c9,
-0x000001cb, 0x000001ca, 0x000001cc,
-0x000001f2, 0x000001f1, 0x000001f3,
-};
diff --git a/ext/mbstring/unicode_table.h b/ext/mbstring/unicode_table.h
deleted file mode 100644
index 884e6e37ae..0000000000
--- a/ext/mbstring/unicode_table.h
+++ /dev/null
@@ -1,347 +0,0 @@
-/* charactor property table */
-#define MBFL_CHP_CTL 0x01
-#define MBFL_CHP_DIGIT 0x02
-#define MBFL_CHP_UALPHA 0x04
-#define MBFL_CHP_LALPHA 0x08
-#define MBFL_CHP_MMHQENC 0x10 /* must Q-encoding in MIME Header encoded-word */
-#define MBFL_CHP_MSPECIAL 0x20 /* RFC822 Special characters */
-
-/*
- * Unicode table
- */
-
-
-/* Windows CodePage 1252 - it's the same as iso-8859-1 but
- * defines extra symbols in the range 0x80-0x9f.
- * This table differs from the rest of the unicode tables below
- * as it only covers this range, while the rest cover 0xa0 onwards */
-static const unsigned short cp1252_ucs_table[] = {
- 0x20ac,0xfffe,0x201a,0x0192,0x201e,0x2026,0x2020,0x2021,
- 0x02c6,0x2030,0x0160,0x2039,0x0152,0xfffe,0x017d,0xfffe,
- 0xfffe,0x2018,0x2019,0x201c,0x201d,0x2022,0x2013,0x2014,
- 0x02dc,0x2122,0x0161,0x203a,0x0153,0xfffe,0x017e,0x0178
-};
-
-
-static const unsigned short iso8859_2_ucs_table[] = {
- 0x00A0,0x0104,0x02D8,0x0141,0x00A4,0x013D,0x015A,0x00A7,
- 0x00A8,0x0160,0x015E,0x0164,0x0179,0x00AD,0x017D,0x017B,
- 0x00B0,0x0105,0x02DB,0x0142,0x00B4,0x013E,0x015B,0x02C7,
- 0x00B8,0x0161,0x015F,0x0165,0x017A,0x02DD,0x017E,0x017C,
- 0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7,
- 0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E,
- 0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7,
- 0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF,
- 0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7,
- 0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F,
- 0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7,
- 0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9
-};
-
-
-static const unsigned short iso8859_3_ucs_table[] = {
- 0x00A0,0x0126,0x02D8,0x00A3,0x00A4,0x0000,0x0124,0x00A7,
- 0x00A8,0x0130,0x015E,0x011E,0x0134,0x00AD,0x0000,0x017B,
- 0x00B0,0x0127,0x00B2,0x00B3,0x00B4,0x00B5,0x0125,0x00B7,
- 0x00B8,0x0131,0x015F,0x011F,0x0135,0x00BD,0x0000,0x017C,
- 0x00C0,0x00C1,0x00C2,0x0000,0x00C4,0x010A,0x0108,0x00C7,
- 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
- 0x0000,0x00D1,0x00D2,0x00D3,0x00D4,0x0120,0x00D6,0x00D7,
- 0x011C,0x00D9,0x00DA,0x00DB,0x00DC,0x016C,0x015C,0x00DF,
- 0x00E0,0x00E1,0x00E2,0x0000,0x00E4,0x010B,0x0109,0x00E7,
- 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
- 0x0000,0x00F1,0x00F2,0x00F3,0x00F4,0x0121,0x00F6,0x00F7,
- 0x011D,0x00F9,0x00FA,0x00FB,0x00FC,0x016D,0x015D,0x02D9
-};
-
-
-static const unsigned short iso8859_4_ucs_table[] = {
- 0x00A0,0x0104,0x0138,0x0156,0x00A4,0x0128,0x013B,0x00A7,
- 0x00A8,0x0160,0x0112,0x0122,0x0166,0x00AD,0x017D,0x00AF,
- 0x00B0,0x0105,0x02DB,0x0157,0x00B4,0x0129,0x013C,0x02C7,
- 0x00B8,0x0161,0x0113,0x0123,0x0167,0x014A,0x017E,0x014B,
- 0x0100,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x012E,
- 0x010C,0x00C9,0x0118,0x00CB,0x0116,0x00CD,0x00CE,0x012A,
- 0x0110,0x0145,0x014C,0x0136,0x00D4,0x00D5,0x00D6,0x00D7,
- 0x00D8,0x0172,0x00DA,0x00DB,0x00DC,0x0168,0x016A,0x00DF,
- 0x0101,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x012F,
- 0x010D,0x00E9,0x0119,0x00EB,0x0117,0x00ED,0x00EE,0x012B,
- 0x0111,0x0146,0x014D,0x0137,0x00F4,0x00F5,0x00F6,0x00F7,
- 0x00F8,0x0173,0x00FA,0x00FB,0x00FC,0x0169,0x016B,0x02D9
-};
-
-
-static const unsigned short iso8859_5_ucs_table[] = {
- 0x00A0,0x0401,0x0402,0x0403,0x0404,0x0405,0x0406,0x0407,
- 0x0408,0x0409,0x040A,0x040B,0x040C,0x00AD,0x040E,0x040F,
- 0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417,
- 0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F,
- 0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427,
- 0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F,
- 0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437,
- 0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F,
- 0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447,
- 0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F,
- 0x2116,0x0451,0x0452,0x0453,0x0454,0x0455,0x0456,0x0457,
- 0x0458,0x0459,0x045A,0x045B,0x045C,0x00A7,0x045E,0x045F
-};
-
-
-static const unsigned short iso8859_6_ucs_table[] = {
- 0x00A0,0x0000,0x0000,0x0000,0x00A4,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x060C,0x00AD,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x061B,0x0000,0x0000,0x0000,0x061F,
- 0x0000,0x0621,0x0622,0x0623,0x0624,0x0625,0x0626,0x0627,
- 0x0628,0x0629,0x062A,0x062B,0x062C,0x062D,0x062E,0x062F,
- 0x0630,0x0631,0x0632,0x0633,0x0634,0x0635,0x0636,0x0637,
- 0x0638,0x0639,0x063A,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0640,0x0641,0x0642,0x0643,0x0644,0x0645,0x0646,0x0647,
- 0x0648,0x0649,0x064A,0x064B,0x064C,0x064D,0x064E,0x064F,
- 0x0650,0x0651,0x0652,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x060C,0x00AD,0x0000,0x0000
-};
-
-
-static const unsigned short iso8859_7_ucs_table[] = {
- 0x00A0,0x2018,0x2019,0x00A3,0x0000,0x0000,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x0000,0x00AB,0x00AC,0x00AD,0x0000,0x2015,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x0384,0x0385,0x0386,0x00B7,
- 0x0388,0x0389,0x038A,0x00BB,0x038C,0x00BD,0x038E,0x038F,
- 0x0390,0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,
- 0x0398,0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,
- 0x03A0,0x03A1,0x0000,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,
- 0x03A8,0x03A9,0x03AA,0x03AB,0x03AC,0x03AD,0x03AE,0x03AF,
- 0x03B0,0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,
- 0x03B8,0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,
- 0x03C0,0x03C1,0x03C2,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,
- 0x03C8,0x03C9,0x03CA,0x03CB,0x03CC,0x03CD,0x03CE,0x0000
-};
-
-
-static const unsigned short iso8859_8_ucs_table[] = {
- 0x00A0,0x0000,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x00D7,0x00AB,0x00AC,0x00AD,0x00AE,0x203E,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
- 0x00B8,0x00B9,0x00F7,0x00BB,0x00BC,0x00BD,0x00BE,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2017,
- 0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7,
- 0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF,
- 0x05E0,0x05E1,0x05E2,0x05E3,0x05E4,0x05E5,0x05E6,0x05E7,
- 0x05E8,0x05E9,0x05EA,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-
-static const unsigned short iso8859_9_ucs_table[] = {
- 0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
- 0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
- 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
- 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
- 0x011E,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
- 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x0130,0x015E,0x00DF,
- 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
- 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
- 0x011F,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,
- 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x0131,0x015F,0x00FF
-};
-
-
-static const unsigned short iso8859_10_ucs_table[] = {
- 0x00A0,0x0104,0x0112,0x0122,0x0124,0x0128,0x0136,0x00A7,
- 0x013B,0x0110,0x0160,0x0166,0x017D,0x00AD,0x016A,0x014A,
- 0x00B0,0x0105,0x0113,0x0123,0x012B,0x0129,0x0137,0x00B7,
- 0x013C,0x0111,0x0161,0x0167,0x017E,0x2015,0x016B,0x014B,
- 0x0100,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x012E,
- 0x010C,0x00C9,0x0118,0x00CB,0x0116,0x00CD,0x00CE,0x00CF,
- 0x00D0,0x0145,0x014C,0x00D3,0x00D4,0x00D5,0x00D6,0x0168,
- 0x00D8,0x0172,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
- 0x0101,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x012F,
- 0x010D,0x00E9,0x0119,0x00EB,0x0117,0x00ED,0x00EE,0x00EF,
- 0x00F0,0x0146,0x014D,0x00F3,0x00F4,0x00F5,0x00F6,0x0169,
- 0x00F8,0x0173,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x0138
-};
-
-
-static const unsigned short iso8859_13_ucs_table[] = {
- 0x00A0,0x201D,0x00A2,0x00A3,0x00A4,0x201E,0x00A6,0x00A7,
- 0x00D8,0x00A9,0x0156,0x00AB,0x00AC,0x00AD,0x00AE,0x00C6,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x201C,0x00B5,0x00B6,0x00B7,
- 0x00F8,0x00B9,0x0157,0x00BB,0x00BC,0x00BD,0x00BE,0x00E6,
- 0x0104,0x012E,0x0100,0x0106,0x00C4,0x00C5,0x0118,0x0112,
- 0x010C,0x00C9,0x0179,0x0116,0x0122,0x0136,0x012A,0x013B,
- 0x0160,0x0143,0x0145,0x00D3,0x014C,0x00D5,0x00D6,0x00D7,
- 0x0172,0x0141,0x015A,0x016A,0x00DC,0x017B,0x017D,0x00DF,
- 0x0105,0x012F,0x0101,0x0107,0x00E4,0x00E5,0x0119,0x0113,
- 0x010D,0x00E9,0x017A,0x0117,0x0123,0x0137,0x012B,0x013C,
- 0x0161,0x0144,0x0146,0x00F3,0x014D,0x00F5,0x00F6,0x00F7,
- 0x0173,0x0142,0x015B,0x016B,0x00FC,0x017C,0x017E,0x2019
-};
-
-
-static const unsigned short iso8859_14_ucs_table[] = {
- 0x00A0,0x1E02,0x1E03,0x00A3,0x010A,0x010B,0x1E0A,0x00A7,
- 0x1E80,0x00A9,0x1E82,0x1E0B,0x1EF2,0x00AD,0x00AE,0x0178,
- 0x1E1E,0x1E1F,0x0120,0x0121,0x1E40,0x1E41,0x00B6,0x1E56,
- 0x1E81,0x1E57,0x1E83,0x1E60,0x1EF3,0x1E84,0x1E85,0x1E61,
- 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
- 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
- 0x0174,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x1E6A,
- 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x0176,0x00DF,
- 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
- 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
- 0x0175,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x1E6B,
- 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x0177,0x00FF
-};
-
-
-static const unsigned short iso8859_15_ucs_table[] = {
- 0x00A0,0x00A1,0x00A2,0x00A3,0x20AC,0x00A5,0x0160,0x00A7,
- 0x0161,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x017D,0x00B5,0x00B6,0x00B7,
- 0x017E,0x00B9,0x00BA,0x00BB,0x0152,0x0153,0x0178,0x00BF,
- 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
- 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
- 0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
- 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
- 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
- 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
- 0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,
- 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF
-};
-
-
-static const unsigned char mbfl_charprop_table[] = {
-/* NUL 0 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC,
-/* SCH 1 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* SIX 2 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* EIX 3 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* EOT 4 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* ENQ 5 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* ACK 6 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* BEL 7 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* BS 8 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* HI 9 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* LF 10 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* VI 11 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* FF 12 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* CR 13 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* SO 14 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* SI 15 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* SLE 16 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* CSI 17 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* DC2 18 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* DC3 19 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* DC4 20 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* NAK 21 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* SYN 22 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* EIB 23 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* CAN 24 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* EM 25 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* SLB 26 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* ESC 27 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* FS 28 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* GS 29 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* RS 30 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* US 31 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* SP 32 */ MBFL_CHP_MMHQENC ,
-/* ! 33 */ 0 ,
-/* " 34 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* # 35 */ MBFL_CHP_MMHQENC ,
-/* $ 36 */ MBFL_CHP_MMHQENC ,
-/* % 37 */ MBFL_CHP_MMHQENC ,
-/* & 38 */ MBFL_CHP_MMHQENC ,
-/* ' 39 */ MBFL_CHP_MMHQENC ,
-/* ( 40 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* ) 41 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* * 42 */ 0 ,
-/* + 43 */ 0 ,
-/* , 44 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* - 45 */ 0 ,
-/* . 46 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* / 47 */ 0 ,
-/* 0 48 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 1 49 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 2 50 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 3 51 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 4 52 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 5 53 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 6 54 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 7 55 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 8 56 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 9 57 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* : 58 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* ; 59 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* < 60 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* = 61 */ 0 ,
-/* > 62 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* ? 63 */ MBFL_CHP_MMHQENC ,
-/* @ 64 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* A 65 */ MBFL_CHP_UALPHA ,
-/* B 66 */ MBFL_CHP_UALPHA ,
-/* C 67 */ MBFL_CHP_UALPHA ,
-/* D 68 */ MBFL_CHP_UALPHA ,
-/* E 69 */ MBFL_CHP_UALPHA ,
-/* F 70 */ MBFL_CHP_UALPHA ,
-/* G 71 */ MBFL_CHP_UALPHA ,
-/* H 72 */ MBFL_CHP_UALPHA ,
-/* I 73 */ MBFL_CHP_UALPHA ,
-/* J 74 */ MBFL_CHP_UALPHA ,
-/* K 75 */ MBFL_CHP_UALPHA ,
-/* L 76 */ MBFL_CHP_UALPHA ,
-/* M 77 */ MBFL_CHP_UALPHA ,
-/* N 78 */ MBFL_CHP_UALPHA ,
-/* O 79 */ MBFL_CHP_UALPHA ,
-/* P 80 */ MBFL_CHP_UALPHA ,
-/* Q 81 */ MBFL_CHP_UALPHA ,
-/* R 82 */ MBFL_CHP_UALPHA ,
-/* S 83 */ MBFL_CHP_UALPHA ,
-/* T 84 */ MBFL_CHP_UALPHA ,
-/* U 85 */ MBFL_CHP_UALPHA ,
-/* V 86 */ MBFL_CHP_UALPHA ,
-/* W 87 */ MBFL_CHP_UALPHA ,
-/* X 88 */ MBFL_CHP_UALPHA ,
-/* Y 89 */ MBFL_CHP_UALPHA ,
-/* Z 90 */ MBFL_CHP_UALPHA ,
-/* [ 91 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* \ 92 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* ] 93 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* ^ 94 */ MBFL_CHP_MMHQENC ,
-/* _ 95 */ MBFL_CHP_MMHQENC ,
-/* ` 96 */ MBFL_CHP_MMHQENC ,
-/* a 97 */ MBFL_CHP_LALPHA ,
-/* b 98 */ MBFL_CHP_LALPHA ,
-/* c 99 */ MBFL_CHP_LALPHA ,
-/* d 100 */ MBFL_CHP_LALPHA ,
-/* e 101 */ MBFL_CHP_LALPHA ,
-/* f 102 */ MBFL_CHP_LALPHA ,
-/* g 103 */ MBFL_CHP_LALPHA ,
-/* h 104 */ MBFL_CHP_LALPHA ,
-/* i 105 */ MBFL_CHP_LALPHA ,
-/* j 106 */ MBFL_CHP_LALPHA ,
-/* k 107 */ MBFL_CHP_LALPHA ,
-/* l 108 */ MBFL_CHP_LALPHA ,
-/* m 109 */ MBFL_CHP_LALPHA ,
-/* n 110 */ MBFL_CHP_LALPHA ,
-/* o 111 */ MBFL_CHP_LALPHA ,
-/* p 112 */ MBFL_CHP_LALPHA ,
-/* q 113 */ MBFL_CHP_LALPHA ,
-/* r 114 */ MBFL_CHP_LALPHA ,
-/* s 115 */ MBFL_CHP_LALPHA ,
-/* t 116 */ MBFL_CHP_LALPHA ,
-/* u 117 */ MBFL_CHP_LALPHA ,
-/* v 118 */ MBFL_CHP_LALPHA ,
-/* w 119 */ MBFL_CHP_LALPHA ,
-/* x 120 */ MBFL_CHP_LALPHA ,
-/* y 121 */ MBFL_CHP_LALPHA ,
-/* z 122 */ MBFL_CHP_LALPHA ,
-/* { 123 */ MBFL_CHP_MMHQENC ,
-/* | 124 */ MBFL_CHP_MMHQENC ,
-/* } 125 */ MBFL_CHP_MMHQENC ,
-/* ~ 126 */ MBFL_CHP_MMHQENC ,
-/* DEL 127 */ MBFL_CHP_MMHQENC
-};
diff --git a/ext/mbstring/unicode_table_cn.h b/ext/mbstring/unicode_table_cn.h
deleted file mode 100644
index ca440a3de9..0000000000
--- a/ext/mbstring/unicode_table_cn.h
+++ /dev/null
@@ -1,6463 +0,0 @@
-/*
- * Unicode table
- */
-
-static const unsigned short cp936_ucs_table[] = {
-/* 0x8100 */
-0x4e02,0x4e04,0x4e05,0x4e06,0x4e0f,0x4e12,0x4e17,0x4e1f,
-0x4e20,0x4e21,0x4e23,0x4e26,0x4e29,0x4e2e,0x4e2f,0x4e31,
-0x4e33,0x4e35,0x4e37,0x4e3c,0x4e40,0x4e41,0x4e42,0x4e44,
-0x4e46,0x4e4a,0x4e51,0x4e55,0x4e57,0x4e5a,0x4e5b,0x4e62,
-0x4e63,0x4e64,0x4e65,0x4e67,0x4e68,0x4e6a,0x4e6b,0x4e6c,
-0x4e6d,0x4e6e,0x4e6f,0x4e72,0x4e74,0x4e75,0x4e76,0x4e77,
-0x4e78,0x4e79,0x4e7a,0x4e7b,0x4e7c,0x4e7d,0x4e7f,0x4e80,
-0x4e81,0x4e82,0x4e83,0x4e84,0x4e85,0x4e87,0x4e8a,0x0000,
-0x4e90,0x4e96,0x4e97,0x4e99,0x4e9c,0x4e9d,0x4e9e,0x4ea3,
-0x4eaa,0x4eaf,0x4eb0,0x4eb1,0x4eb4,0x4eb6,0x4eb7,0x4eb8,
-0x4eb9,0x4ebc,0x4ebd,0x4ebe,0x4ec8,0x4ecc,0x4ecf,0x4ed0,
-0x4ed2,0x4eda,0x4edb,0x4edc,0x4ee0,0x4ee2,0x4ee6,0x4ee7,
-0x4ee9,0x4eed,0x4eee,0x4eef,0x4ef1,0x4ef4,0x4ef8,0x4ef9,
-0x4efa,0x4efc,0x4efe,0x4f00,0x4f02,0x4f03,0x4f04,0x4f05,
-0x4f06,0x4f07,0x4f08,0x4f0b,0x4f0c,0x4f12,0x4f13,0x4f14,
-0x4f15,0x4f16,0x4f1c,0x4f1d,0x4f21,0x4f23,0x4f28,0x4f29,
-0x4f2c,0x4f2d,0x4f2e,0x4f31,0x4f33,0x4f35,0x4f37,0x4f39,
-0x4f3b,0x4f3e,0x4f3f,0x4f40,0x4f41,0x4f42,0x4f44,0x4f45,
-0x4f47,0x4f48,0x4f49,0x4f4a,0x4f4b,0x4f4c,0x4f52,0x4f54,
-0x4f56,0x4f61,0x4f62,0x4f66,0x4f68,0x4f6a,0x4f6b,0x4f6d,
-0x4f6e,0x4f71,0x4f72,0x4f75,0x4f77,0x4f78,0x4f79,0x4f7a,
-0x4f7d,0x4f80,0x4f81,0x4f82,0x4f85,0x4f86,0x4f87,0x4f8a,
-0x4f8c,0x4f8e,0x4f90,0x4f92,0x4f93,0x4f95,0x4f96,0x4f98,
-0x4f99,0x4f9a,0x4f9c,0x4f9e,0x4f9f,0x4fa1,0x4fa2,0x0000,
-/* 0x8200 */
-0x4fa4,0x4fab,0x4fad,0x4fb0,0x4fb1,0x4fb2,0x4fb3,0x4fb4,
-0x4fb6,0x4fb7,0x4fb8,0x4fb9,0x4fba,0x4fbb,0x4fbc,0x4fbd,
-0x4fbe,0x4fc0,0x4fc1,0x4fc2,0x4fc6,0x4fc7,0x4fc8,0x4fc9,
-0x4fcb,0x4fcc,0x4fcd,0x4fd2,0x4fd3,0x4fd4,0x4fd5,0x4fd6,
-0x4fd9,0x4fdb,0x4fe0,0x4fe2,0x4fe4,0x4fe5,0x4fe7,0x4feb,
-0x4fec,0x4ff0,0x4ff2,0x4ff4,0x4ff5,0x4ff6,0x4ff7,0x4ff9,
-0x4ffb,0x4ffc,0x4ffd,0x4fff,0x5000,0x5001,0x5002,0x5003,
-0x5004,0x5005,0x5006,0x5007,0x5008,0x5009,0x500a,0x0000,
-0x500b,0x500e,0x5010,0x5011,0x5013,0x5015,0x5016,0x5017,
-0x501b,0x501d,0x501e,0x5020,0x5022,0x5023,0x5024,0x5027,
-0x502b,0x502f,0x5030,0x5031,0x5032,0x5033,0x5034,0x5035,
-0x5036,0x5037,0x5038,0x5039,0x503b,0x503d,0x503f,0x5040,
-0x5041,0x5042,0x5044,0x5045,0x5046,0x5049,0x504a,0x504b,
-0x504d,0x5050,0x5051,0x5052,0x5053,0x5054,0x5056,0x5057,
-0x5058,0x5059,0x505b,0x505d,0x505e,0x505f,0x5060,0x5061,
-0x5062,0x5063,0x5064,0x5066,0x5067,0x5068,0x5069,0x506a,
-0x506b,0x506d,0x506e,0x506f,0x5070,0x5071,0x5072,0x5073,
-0x5074,0x5075,0x5078,0x5079,0x507a,0x507c,0x507d,0x5081,
-0x5082,0x5083,0x5084,0x5086,0x5087,0x5089,0x508a,0x508b,
-0x508c,0x508e,0x508f,0x5090,0x5091,0x5092,0x5093,0x5094,
-0x5095,0x5096,0x5097,0x5098,0x5099,0x509a,0x509b,0x509c,
-0x509d,0x509e,0x509f,0x50a0,0x50a1,0x50a2,0x50a4,0x50a6,
-0x50aa,0x50ab,0x50ad,0x50ae,0x50af,0x50b0,0x50b1,0x50b3,
-0x50b4,0x50b5,0x50b6,0x50b7,0x50b8,0x50b9,0x50bc,0x0000,
-/* 0x8300 */
-0x50bd,0x50be,0x50bf,0x50c0,0x50c1,0x50c2,0x50c3,0x50c4,
-0x50c5,0x50c6,0x50c7,0x50c8,0x50c9,0x50ca,0x50cb,0x50cc,
-0x50cd,0x50ce,0x50d0,0x50d1,0x50d2,0x50d3,0x50d4,0x50d5,
-0x50d7,0x50d8,0x50d9,0x50db,0x50dc,0x50dd,0x50de,0x50df,
-0x50e0,0x50e1,0x50e2,0x50e3,0x50e4,0x50e5,0x50e8,0x50e9,
-0x50ea,0x50eb,0x50ef,0x50f0,0x50f1,0x50f2,0x50f4,0x50f6,
-0x50f7,0x50f8,0x50f9,0x50fa,0x50fc,0x50fd,0x50fe,0x50ff,
-0x5100,0x5101,0x5102,0x5103,0x5104,0x5105,0x5108,0x0000,
-0x5109,0x510a,0x510c,0x510d,0x510e,0x510f,0x5110,0x5111,
-0x5113,0x5114,0x5115,0x5116,0x5117,0x5118,0x5119,0x511a,
-0x511b,0x511c,0x511d,0x511e,0x511f,0x5120,0x5122,0x5123,
-0x5124,0x5125,0x5126,0x5127,0x5128,0x5129,0x512a,0x512b,
-0x512c,0x512d,0x512e,0x512f,0x5130,0x5131,0x5132,0x5133,
-0x5134,0x5135,0x5136,0x5137,0x5138,0x5139,0x513a,0x513b,
-0x513c,0x513d,0x513e,0x5142,0x5147,0x514a,0x514c,0x514e,
-0x514f,0x5150,0x5152,0x5153,0x5157,0x5158,0x5159,0x515b,
-0x515d,0x515e,0x515f,0x5160,0x5161,0x5163,0x5164,0x5166,
-0x5167,0x5169,0x516a,0x516f,0x5172,0x517a,0x517e,0x517f,
-0x5183,0x5184,0x5186,0x5187,0x518a,0x518b,0x518e,0x518f,
-0x5190,0x5191,0x5193,0x5194,0x5198,0x519a,0x519d,0x519e,
-0x519f,0x51a1,0x51a3,0x51a6,0x51a7,0x51a8,0x51a9,0x51aa,
-0x51ad,0x51ae,0x51b4,0x51b8,0x51b9,0x51ba,0x51be,0x51bf,
-0x51c1,0x51c2,0x51c3,0x51c5,0x51c8,0x51ca,0x51cd,0x51ce,
-0x51d0,0x51d2,0x51d3,0x51d4,0x51d5,0x51d6,0x51d7,0x0000,
-/* 0x8400 */
-0x51d8,0x51d9,0x51da,0x51dc,0x51de,0x51df,0x51e2,0x51e3,
-0x51e5,0x51e6,0x51e7,0x51e8,0x51e9,0x51ea,0x51ec,0x51ee,
-0x51f1,0x51f2,0x51f4,0x51f7,0x51fe,0x5204,0x5205,0x5209,
-0x520b,0x520c,0x520f,0x5210,0x5213,0x5214,0x5215,0x521c,
-0x521e,0x521f,0x5221,0x5222,0x5223,0x5225,0x5226,0x5227,
-0x522a,0x522c,0x522f,0x5231,0x5232,0x5234,0x5235,0x523c,
-0x523e,0x5244,0x5245,0x5246,0x5247,0x5248,0x5249,0x524b,
-0x524e,0x524f,0x5252,0x5253,0x5255,0x5257,0x5258,0x0000,
-0x5259,0x525a,0x525b,0x525d,0x525f,0x5260,0x5262,0x5263,
-0x5264,0x5266,0x5268,0x526b,0x526c,0x526d,0x526e,0x5270,
-0x5271,0x5273,0x5274,0x5275,0x5276,0x5277,0x5278,0x5279,
-0x527a,0x527b,0x527c,0x527e,0x5280,0x5283,0x5284,0x5285,
-0x5286,0x5287,0x5289,0x528a,0x528b,0x528c,0x528d,0x528e,
-0x528f,0x5291,0x5292,0x5294,0x5295,0x5296,0x5297,0x5298,
-0x5299,0x529a,0x529c,0x52a4,0x52a5,0x52a6,0x52a7,0x52ae,
-0x52af,0x52b0,0x52b4,0x52b5,0x52b6,0x52b7,0x52b8,0x52b9,
-0x52ba,0x52bb,0x52bc,0x52bd,0x52c0,0x52c1,0x52c2,0x52c4,
-0x52c5,0x52c6,0x52c8,0x52ca,0x52cc,0x52cd,0x52ce,0x52cf,
-0x52d1,0x52d3,0x52d4,0x52d5,0x52d7,0x52d9,0x52da,0x52db,
-0x52dc,0x52dd,0x52de,0x52e0,0x52e1,0x52e2,0x52e3,0x52e5,
-0x52e6,0x52e7,0x52e8,0x52e9,0x52ea,0x52eb,0x52ec,0x52ed,
-0x52ee,0x52ef,0x52f1,0x52f2,0x52f3,0x52f4,0x52f5,0x52f6,
-0x52f7,0x52f8,0x52fb,0x52fc,0x52fd,0x5301,0x5302,0x5303,
-0x5304,0x5307,0x5309,0x530a,0x530b,0x530c,0x530e,0x0000,
-/* 0x8500 */
-0x5311,0x5312,0x5313,0x5314,0x5318,0x531b,0x531c,0x531e,
-0x531f,0x5322,0x5324,0x5325,0x5327,0x5328,0x5329,0x532b,
-0x532c,0x532d,0x532f,0x5330,0x5331,0x5332,0x5333,0x5334,
-0x5335,0x5336,0x5337,0x5338,0x533c,0x533d,0x5340,0x5342,
-0x5344,0x5346,0x534b,0x534c,0x534d,0x5350,0x5354,0x5358,
-0x5359,0x535b,0x535d,0x5365,0x5368,0x536a,0x536c,0x536d,
-0x5372,0x5376,0x5379,0x537b,0x537c,0x537d,0x537e,0x5380,
-0x5381,0x5383,0x5387,0x5388,0x538a,0x538e,0x538f,0x0000,
-0x5390,0x5391,0x5392,0x5393,0x5394,0x5396,0x5397,0x5399,
-0x539b,0x539c,0x539e,0x53a0,0x53a1,0x53a4,0x53a7,0x53aa,
-0x53ab,0x53ac,0x53ad,0x53af,0x53b0,0x53b1,0x53b2,0x53b3,
-0x53b4,0x53b5,0x53b7,0x53b8,0x53b9,0x53ba,0x53bc,0x53bd,
-0x53be,0x53c0,0x53c3,0x53c4,0x53c5,0x53c6,0x53c7,0x53ce,
-0x53cf,0x53d0,0x53d2,0x53d3,0x53d5,0x53da,0x53dc,0x53dd,
-0x53de,0x53e1,0x53e2,0x53e7,0x53f4,0x53fa,0x53fe,0x53ff,
-0x5400,0x5402,0x5405,0x5407,0x540b,0x5414,0x5418,0x5419,
-0x541a,0x541c,0x5422,0x5424,0x5425,0x542a,0x5430,0x5433,
-0x5436,0x5437,0x543a,0x543d,0x543f,0x5441,0x5442,0x5444,
-0x5445,0x5447,0x5449,0x544c,0x544d,0x544e,0x544f,0x5451,
-0x545a,0x545d,0x545e,0x545f,0x5460,0x5461,0x5463,0x5465,
-0x5467,0x5469,0x546a,0x546b,0x546c,0x546d,0x546e,0x546f,
-0x5470,0x5474,0x5479,0x547a,0x547e,0x547f,0x5481,0x5483,
-0x5485,0x5487,0x5488,0x5489,0x548a,0x548d,0x5491,0x5493,
-0x5497,0x5498,0x549c,0x549e,0x549f,0x54a0,0x54a1,0x0000,
-/* 0x8600 */
-0x54a2,0x54a5,0x54ae,0x54b0,0x54b2,0x54b5,0x54b6,0x54b7,
-0x54b9,0x54ba,0x54bc,0x54be,0x54c3,0x54c5,0x54ca,0x54cb,
-0x54d6,0x54d8,0x54db,0x54e0,0x54e1,0x54e2,0x54e3,0x54e4,
-0x54eb,0x54ec,0x54ef,0x54f0,0x54f1,0x54f4,0x54f5,0x54f6,
-0x54f7,0x54f8,0x54f9,0x54fb,0x54fe,0x5500,0x5502,0x5503,
-0x5504,0x5505,0x5508,0x550a,0x550b,0x550c,0x550d,0x550e,
-0x5512,0x5513,0x5515,0x5516,0x5517,0x5518,0x5519,0x551a,
-0x551c,0x551d,0x551e,0x551f,0x5521,0x5525,0x5526,0x0000,
-0x5528,0x5529,0x552b,0x552d,0x5532,0x5534,0x5535,0x5536,
-0x5538,0x5539,0x553a,0x553b,0x553d,0x5540,0x5542,0x5545,
-0x5547,0x5548,0x554b,0x554c,0x554d,0x554e,0x554f,0x5551,
-0x5552,0x5553,0x5554,0x5557,0x5558,0x5559,0x555a,0x555b,
-0x555d,0x555e,0x555f,0x5560,0x5562,0x5563,0x5568,0x5569,
-0x556b,0x556f,0x5570,0x5571,0x5572,0x5573,0x5574,0x5579,
-0x557a,0x557d,0x557f,0x5585,0x5586,0x558c,0x558d,0x558e,
-0x5590,0x5592,0x5593,0x5595,0x5596,0x5597,0x559a,0x559b,
-0x559e,0x55a0,0x55a1,0x55a2,0x55a3,0x55a4,0x55a5,0x55a6,
-0x55a8,0x55a9,0x55aa,0x55ab,0x55ac,0x55ad,0x55ae,0x55af,
-0x55b0,0x55b2,0x55b4,0x55b6,0x55b8,0x55ba,0x55bc,0x55bf,
-0x55c0,0x55c1,0x55c2,0x55c3,0x55c6,0x55c7,0x55c8,0x55ca,
-0x55cb,0x55ce,0x55cf,0x55d0,0x55d5,0x55d7,0x55d8,0x55d9,
-0x55da,0x55db,0x55de,0x55e0,0x55e2,0x55e7,0x55e9,0x55ed,
-0x55ee,0x55f0,0x55f1,0x55f4,0x55f6,0x55f8,0x55f9,0x55fa,
-0x55fb,0x55fc,0x55ff,0x5602,0x5603,0x5604,0x5605,0x0000,
-/* 0x8700 */
-0x5606,0x5607,0x560a,0x560b,0x560d,0x5610,0x5611,0x5612,
-0x5613,0x5614,0x5615,0x5616,0x5617,0x5619,0x561a,0x561c,
-0x561d,0x5620,0x5621,0x5622,0x5625,0x5626,0x5628,0x5629,
-0x562a,0x562b,0x562e,0x562f,0x5630,0x5633,0x5635,0x5637,
-0x5638,0x563a,0x563c,0x563d,0x563e,0x5640,0x5641,0x5642,
-0x5643,0x5644,0x5645,0x5646,0x5647,0x5648,0x5649,0x564a,
-0x564b,0x564f,0x5650,0x5651,0x5652,0x5653,0x5655,0x5656,
-0x565a,0x565b,0x565d,0x565e,0x565f,0x5660,0x5661,0x0000,
-0x5663,0x5665,0x5666,0x5667,0x566d,0x566e,0x566f,0x5670,
-0x5672,0x5673,0x5674,0x5675,0x5677,0x5678,0x5679,0x567a,
-0x567d,0x567e,0x567f,0x5680,0x5681,0x5682,0x5683,0x5684,
-0x5687,0x5688,0x5689,0x568a,0x568b,0x568c,0x568d,0x5690,
-0x5691,0x5692,0x5694,0x5695,0x5696,0x5697,0x5698,0x5699,
-0x569a,0x569b,0x569c,0x569d,0x569e,0x569f,0x56a0,0x56a1,
-0x56a2,0x56a4,0x56a5,0x56a6,0x56a7,0x56a8,0x56a9,0x56aa,
-0x56ab,0x56ac,0x56ad,0x56ae,0x56b0,0x56b1,0x56b2,0x56b3,
-0x56b4,0x56b5,0x56b6,0x56b8,0x56b9,0x56ba,0x56bb,0x56bd,
-0x56be,0x56bf,0x56c0,0x56c1,0x56c2,0x56c3,0x56c4,0x56c5,
-0x56c6,0x56c7,0x56c8,0x56c9,0x56cb,0x56cc,0x56cd,0x56ce,
-0x56cf,0x56d0,0x56d1,0x56d2,0x56d3,0x56d5,0x56d6,0x56d8,
-0x56d9,0x56dc,0x56e3,0x56e5,0x56e6,0x56e7,0x56e8,0x56e9,
-0x56ea,0x56ec,0x56ee,0x56ef,0x56f2,0x56f3,0x56f6,0x56f7,
-0x56f8,0x56fb,0x56fc,0x5700,0x5701,0x5702,0x5705,0x5707,
-0x570b,0x570c,0x570d,0x570e,0x570f,0x5710,0x5711,0x0000,
-/* 0x8800 */
-0x5712,0x5713,0x5714,0x5715,0x5716,0x5717,0x5718,0x5719,
-0x571a,0x571b,0x571d,0x571e,0x5720,0x5721,0x5722,0x5724,
-0x5725,0x5726,0x5727,0x572b,0x5731,0x5732,0x5734,0x5735,
-0x5736,0x5737,0x5738,0x573c,0x573d,0x573f,0x5741,0x5743,
-0x5744,0x5745,0x5746,0x5748,0x5749,0x574b,0x5752,0x5753,
-0x5754,0x5755,0x5756,0x5758,0x5759,0x5762,0x5763,0x5765,
-0x5767,0x576c,0x576e,0x5770,0x5771,0x5772,0x5774,0x5775,
-0x5778,0x5779,0x577a,0x577d,0x577e,0x577f,0x5780,0x0000,
-0x5781,0x5787,0x5788,0x5789,0x578a,0x578d,0x578e,0x578f,
-0x5790,0x5791,0x5794,0x5795,0x5796,0x5797,0x5798,0x5799,
-0x579a,0x579c,0x579d,0x579e,0x579f,0x57a5,0x57a8,0x57aa,
-0x57ac,0x57af,0x57b0,0x57b1,0x57b3,0x57b5,0x57b6,0x57b7,
-0x57b9,0x57ba,0x57bb,0x57bc,0x57bd,0x57be,0x57bf,0x57c0,
-0x57c1,0x57c4,0x57c5,0x57c6,0x57c7,0x57c8,0x57c9,0x57ca,
-0x57cc,0x57cd,0x57d0,0x57d1,0x57d3,0x57d6,0x57d7,0x57db,
-0x57dc,0x57de,0x57e1,0x57e2,0x57e3,0x57e5,0x57e6,0x57e7,
-0x57e8,0x57e9,0x57ea,0x57eb,0x57ec,0x57ee,0x57f0,0x57f1,
-0x57f2,0x57f3,0x57f5,0x57f6,0x57f7,0x57fb,0x57fc,0x57fe,
-0x57ff,0x5801,0x5803,0x5804,0x5805,0x5808,0x5809,0x580a,
-0x580c,0x580e,0x580f,0x5810,0x5812,0x5813,0x5814,0x5816,
-0x5817,0x5818,0x581a,0x581b,0x581c,0x581d,0x581f,0x5822,
-0x5823,0x5825,0x5826,0x5827,0x5828,0x5829,0x582b,0x582c,
-0x582d,0x582e,0x582f,0x5831,0x5832,0x5833,0x5834,0x5836,
-0x5837,0x5838,0x5839,0x583a,0x583b,0x583c,0x583d,0x0000,
-/* 0x8900 */
-0x583e,0x583f,0x5840,0x5841,0x5842,0x5843,0x5845,0x5846,
-0x5847,0x5848,0x5849,0x584a,0x584b,0x584e,0x584f,0x5850,
-0x5852,0x5853,0x5855,0x5856,0x5857,0x5859,0x585a,0x585b,
-0x585c,0x585d,0x585f,0x5860,0x5861,0x5862,0x5863,0x5864,
-0x5866,0x5867,0x5868,0x5869,0x586a,0x586d,0x586e,0x586f,
-0x5870,0x5871,0x5872,0x5873,0x5874,0x5875,0x5876,0x5877,
-0x5878,0x5879,0x587a,0x587b,0x587c,0x587d,0x587f,0x5882,
-0x5884,0x5886,0x5887,0x5888,0x588a,0x588b,0x588c,0x0000,
-0x588d,0x588e,0x588f,0x5890,0x5891,0x5894,0x5895,0x5896,
-0x5897,0x5898,0x589b,0x589c,0x589d,0x58a0,0x58a1,0x58a2,
-0x58a3,0x58a4,0x58a5,0x58a6,0x58a7,0x58aa,0x58ab,0x58ac,
-0x58ad,0x58ae,0x58af,0x58b0,0x58b1,0x58b2,0x58b3,0x58b4,
-0x58b5,0x58b6,0x58b7,0x58b8,0x58b9,0x58ba,0x58bb,0x58bd,
-0x58be,0x58bf,0x58c0,0x58c2,0x58c3,0x58c4,0x58c6,0x58c7,
-0x58c8,0x58c9,0x58ca,0x58cb,0x58cc,0x58cd,0x58ce,0x58cf,
-0x58d0,0x58d2,0x58d3,0x58d4,0x58d6,0x58d7,0x58d8,0x58d9,
-0x58da,0x58db,0x58dc,0x58dd,0x58de,0x58df,0x58e0,0x58e1,
-0x58e2,0x58e3,0x58e5,0x58e6,0x58e7,0x58e8,0x58e9,0x58ea,
-0x58ed,0x58ef,0x58f1,0x58f2,0x58f4,0x58f5,0x58f7,0x58f8,
-0x58fa,0x58fb,0x58fc,0x58fd,0x58fe,0x58ff,0x5900,0x5901,
-0x5903,0x5905,0x5906,0x5908,0x5909,0x590a,0x590b,0x590c,
-0x590e,0x5910,0x5911,0x5912,0x5913,0x5917,0x5918,0x591b,
-0x591d,0x591e,0x5920,0x5921,0x5922,0x5923,0x5926,0x5928,
-0x592c,0x5930,0x5932,0x5933,0x5935,0x5936,0x593b,0x0000,
-/* 0x8a00 */
-0x593d,0x593e,0x593f,0x5940,0x5943,0x5945,0x5946,0x594a,
-0x594c,0x594d,0x5950,0x5952,0x5953,0x5959,0x595b,0x595c,
-0x595d,0x595e,0x595f,0x5961,0x5963,0x5964,0x5966,0x5967,
-0x5968,0x5969,0x596a,0x596b,0x596c,0x596d,0x596e,0x596f,
-0x5970,0x5971,0x5972,0x5975,0x5977,0x597a,0x597b,0x597c,
-0x597e,0x597f,0x5980,0x5985,0x5989,0x598b,0x598c,0x598e,
-0x598f,0x5990,0x5991,0x5994,0x5995,0x5998,0x599a,0x599b,
-0x599c,0x599d,0x599f,0x59a0,0x59a1,0x59a2,0x59a6,0x0000,
-0x59a7,0x59ac,0x59ad,0x59b0,0x59b1,0x59b3,0x59b4,0x59b5,
-0x59b6,0x59b7,0x59b8,0x59ba,0x59bc,0x59bd,0x59bf,0x59c0,
-0x59c1,0x59c2,0x59c3,0x59c4,0x59c5,0x59c7,0x59c8,0x59c9,
-0x59cc,0x59cd,0x59ce,0x59cf,0x59d5,0x59d6,0x59d9,0x59db,
-0x59de,0x59df,0x59e0,0x59e1,0x59e2,0x59e4,0x59e6,0x59e7,
-0x59e9,0x59ea,0x59eb,0x59ed,0x59ee,0x59ef,0x59f0,0x59f1,
-0x59f2,0x59f3,0x59f4,0x59f5,0x59f6,0x59f7,0x59f8,0x59fa,
-0x59fc,0x59fd,0x59fe,0x5a00,0x5a02,0x5a0a,0x5a0b,0x5a0d,
-0x5a0e,0x5a0f,0x5a10,0x5a12,0x5a14,0x5a15,0x5a16,0x5a17,
-0x5a19,0x5a1a,0x5a1b,0x5a1d,0x5a1e,0x5a21,0x5a22,0x5a24,
-0x5a26,0x5a27,0x5a28,0x5a2a,0x5a2b,0x5a2c,0x5a2d,0x5a2e,
-0x5a2f,0x5a30,0x5a33,0x5a35,0x5a37,0x5a38,0x5a39,0x5a3a,
-0x5a3b,0x5a3d,0x5a3e,0x5a3f,0x5a41,0x5a42,0x5a43,0x5a44,
-0x5a45,0x5a47,0x5a48,0x5a4b,0x5a4c,0x5a4d,0x5a4e,0x5a4f,
-0x5a50,0x5a51,0x5a52,0x5a53,0x5a54,0x5a56,0x5a57,0x5a58,
-0x5a59,0x5a5b,0x5a5c,0x5a5d,0x5a5e,0x5a5f,0x5a60,0x0000,
-/* 0x8b00 */
-0x5a61,0x5a63,0x5a64,0x5a65,0x5a66,0x5a68,0x5a69,0x5a6b,
-0x5a6c,0x5a6d,0x5a6e,0x5a6f,0x5a70,0x5a71,0x5a72,0x5a73,
-0x5a78,0x5a79,0x5a7b,0x5a7c,0x5a7d,0x5a7e,0x5a80,0x5a81,
-0x5a82,0x5a83,0x5a84,0x5a85,0x5a86,0x5a87,0x5a88,0x5a89,
-0x5a8a,0x5a8b,0x5a8c,0x5a8d,0x5a8e,0x5a8f,0x5a90,0x5a91,
-0x5a93,0x5a94,0x5a95,0x5a96,0x5a97,0x5a98,0x5a99,0x5a9c,
-0x5a9d,0x5a9e,0x5a9f,0x5aa0,0x5aa1,0x5aa2,0x5aa3,0x5aa4,
-0x5aa5,0x5aa6,0x5aa7,0x5aa8,0x5aa9,0x5aab,0x5aac,0x0000,
-0x5aad,0x5aae,0x5aaf,0x5ab0,0x5ab1,0x5ab4,0x5ab6,0x5ab7,
-0x5ab9,0x5aba,0x5abb,0x5abc,0x5abd,0x5abf,0x5ac0,0x5ac3,
-0x5ac4,0x5ac5,0x5ac6,0x5ac7,0x5ac8,0x5aca,0x5acb,0x5acd,
-0x5ace,0x5acf,0x5ad0,0x5ad1,0x5ad3,0x5ad5,0x5ad7,0x5ad9,
-0x5ada,0x5adb,0x5add,0x5ade,0x5adf,0x5ae2,0x5ae4,0x5ae5,
-0x5ae7,0x5ae8,0x5aea,0x5aec,0x5aed,0x5aee,0x5aef,0x5af0,
-0x5af2,0x5af3,0x5af4,0x5af5,0x5af6,0x5af7,0x5af8,0x5af9,
-0x5afa,0x5afb,0x5afc,0x5afd,0x5afe,0x5aff,0x5b00,0x5b01,
-0x5b02,0x5b03,0x5b04,0x5b05,0x5b06,0x5b07,0x5b08,0x5b0a,
-0x5b0b,0x5b0c,0x5b0d,0x5b0e,0x5b0f,0x5b10,0x5b11,0x5b12,
-0x5b13,0x5b14,0x5b15,0x5b18,0x5b19,0x5b1a,0x5b1b,0x5b1c,
-0x5b1d,0x5b1e,0x5b1f,0x5b20,0x5b21,0x5b22,0x5b23,0x5b24,
-0x5b25,0x5b26,0x5b27,0x5b28,0x5b29,0x5b2a,0x5b2b,0x5b2c,
-0x5b2d,0x5b2e,0x5b2f,0x5b30,0x5b31,0x5b33,0x5b35,0x5b36,
-0x5b38,0x5b39,0x5b3a,0x5b3b,0x5b3c,0x5b3d,0x5b3e,0x5b3f,
-0x5b41,0x5b42,0x5b43,0x5b44,0x5b45,0x5b46,0x5b47,0x0000,
-/* 0x8c00 */
-0x5b48,0x5b49,0x5b4a,0x5b4b,0x5b4c,0x5b4d,0x5b4e,0x5b4f,
-0x5b52,0x5b56,0x5b5e,0x5b60,0x5b61,0x5b67,0x5b68,0x5b6b,
-0x5b6d,0x5b6e,0x5b6f,0x5b72,0x5b74,0x5b76,0x5b77,0x5b78,
-0x5b79,0x5b7b,0x5b7c,0x5b7e,0x5b7f,0x5b82,0x5b86,0x5b8a,
-0x5b8d,0x5b8e,0x5b90,0x5b91,0x5b92,0x5b94,0x5b96,0x5b9f,
-0x5ba7,0x5ba8,0x5ba9,0x5bac,0x5bad,0x5bae,0x5baf,0x5bb1,
-0x5bb2,0x5bb7,0x5bba,0x5bbb,0x5bbc,0x5bc0,0x5bc1,0x5bc3,
-0x5bc8,0x5bc9,0x5bca,0x5bcb,0x5bcd,0x5bce,0x5bcf,0x0000,
-0x5bd1,0x5bd4,0x5bd5,0x5bd6,0x5bd7,0x5bd8,0x5bd9,0x5bda,
-0x5bdb,0x5bdc,0x5be0,0x5be2,0x5be3,0x5be6,0x5be7,0x5be9,
-0x5bea,0x5beb,0x5bec,0x5bed,0x5bef,0x5bf1,0x5bf2,0x5bf3,
-0x5bf4,0x5bf5,0x5bf6,0x5bf7,0x5bfd,0x5bfe,0x5c00,0x5c02,
-0x5c03,0x5c05,0x5c07,0x5c08,0x5c0b,0x5c0c,0x5c0d,0x5c0e,
-0x5c10,0x5c12,0x5c13,0x5c17,0x5c19,0x5c1b,0x5c1e,0x5c1f,
-0x5c20,0x5c21,0x5c23,0x5c26,0x5c28,0x5c29,0x5c2a,0x5c2b,
-0x5c2d,0x5c2e,0x5c2f,0x5c30,0x5c32,0x5c33,0x5c35,0x5c36,
-0x5c37,0x5c43,0x5c44,0x5c46,0x5c47,0x5c4c,0x5c4d,0x5c52,
-0x5c53,0x5c54,0x5c56,0x5c57,0x5c58,0x5c5a,0x5c5b,0x5c5c,
-0x5c5d,0x5c5f,0x5c62,0x5c64,0x5c67,0x5c68,0x5c69,0x5c6a,
-0x5c6b,0x5c6c,0x5c6d,0x5c70,0x5c72,0x5c73,0x5c74,0x5c75,
-0x5c76,0x5c77,0x5c78,0x5c7b,0x5c7c,0x5c7d,0x5c7e,0x5c80,
-0x5c83,0x5c84,0x5c85,0x5c86,0x5c87,0x5c89,0x5c8a,0x5c8b,
-0x5c8e,0x5c8f,0x5c92,0x5c93,0x5c95,0x5c9d,0x5c9e,0x5c9f,
-0x5ca0,0x5ca1,0x5ca4,0x5ca5,0x5ca6,0x5ca7,0x5ca8,0x0000,
-/* 0x8d00 */
-0x5caa,0x5cae,0x5caf,0x5cb0,0x5cb2,0x5cb4,0x5cb6,0x5cb9,
-0x5cba,0x5cbb,0x5cbc,0x5cbe,0x5cc0,0x5cc2,0x5cc3,0x5cc5,
-0x5cc6,0x5cc7,0x5cc8,0x5cc9,0x5cca,0x5ccc,0x5ccd,0x5cce,
-0x5ccf,0x5cd0,0x5cd1,0x5cd3,0x5cd4,0x5cd5,0x5cd6,0x5cd7,
-0x5cd8,0x5cda,0x5cdb,0x5cdc,0x5cdd,0x5cde,0x5cdf,0x5ce0,
-0x5ce2,0x5ce3,0x5ce7,0x5ce9,0x5ceb,0x5cec,0x5cee,0x5cef,
-0x5cf1,0x5cf2,0x5cf3,0x5cf4,0x5cf5,0x5cf6,0x5cf7,0x5cf8,
-0x5cf9,0x5cfa,0x5cfc,0x5cfd,0x5cfe,0x5cff,0x5d00,0x0000,
-0x5d01,0x5d04,0x5d05,0x5d08,0x5d09,0x5d0a,0x5d0b,0x5d0c,
-0x5d0d,0x5d0f,0x5d10,0x5d11,0x5d12,0x5d13,0x5d15,0x5d17,
-0x5d18,0x5d19,0x5d1a,0x5d1c,0x5d1d,0x5d1f,0x5d20,0x5d21,
-0x5d22,0x5d23,0x5d25,0x5d28,0x5d2a,0x5d2b,0x5d2c,0x5d2f,
-0x5d30,0x5d31,0x5d32,0x5d33,0x5d35,0x5d36,0x5d37,0x5d38,
-0x5d39,0x5d3a,0x5d3b,0x5d3c,0x5d3f,0x5d40,0x5d41,0x5d42,
-0x5d43,0x5d44,0x5d45,0x5d46,0x5d48,0x5d49,0x5d4d,0x5d4e,
-0x5d4f,0x5d50,0x5d51,0x5d52,0x5d53,0x5d54,0x5d55,0x5d56,
-0x5d57,0x5d59,0x5d5a,0x5d5c,0x5d5e,0x5d5f,0x5d60,0x5d61,
-0x5d62,0x5d63,0x5d64,0x5d65,0x5d66,0x5d67,0x5d68,0x5d6a,
-0x5d6d,0x5d6e,0x5d70,0x5d71,0x5d72,0x5d73,0x5d75,0x5d76,
-0x5d77,0x5d78,0x5d79,0x5d7a,0x5d7b,0x5d7c,0x5d7d,0x5d7e,
-0x5d7f,0x5d80,0x5d81,0x5d83,0x5d84,0x5d85,0x5d86,0x5d87,
-0x5d88,0x5d89,0x5d8a,0x5d8b,0x5d8c,0x5d8d,0x5d8e,0x5d8f,
-0x5d90,0x5d91,0x5d92,0x5d93,0x5d94,0x5d95,0x5d96,0x5d97,
-0x5d98,0x5d9a,0x5d9b,0x5d9c,0x5d9e,0x5d9f,0x5da0,0x0000,
-/* 0x8e00 */
-0x5da1,0x5da2,0x5da3,0x5da4,0x5da5,0x5da6,0x5da7,0x5da8,
-0x5da9,0x5daa,0x5dab,0x5dac,0x5dad,0x5dae,0x5daf,0x5db0,
-0x5db1,0x5db2,0x5db3,0x5db4,0x5db5,0x5db6,0x5db8,0x5db9,
-0x5dba,0x5dbb,0x5dbc,0x5dbd,0x5dbe,0x5dbf,0x5dc0,0x5dc1,
-0x5dc2,0x5dc3,0x5dc4,0x5dc6,0x5dc7,0x5dc8,0x5dc9,0x5dca,
-0x5dcb,0x5dcc,0x5dce,0x5dcf,0x5dd0,0x5dd1,0x5dd2,0x5dd3,
-0x5dd4,0x5dd5,0x5dd6,0x5dd7,0x5dd8,0x5dd9,0x5dda,0x5ddc,
-0x5ddf,0x5de0,0x5de3,0x5de4,0x5dea,0x5dec,0x5ded,0x0000,
-0x5df0,0x5df5,0x5df6,0x5df8,0x5df9,0x5dfa,0x5dfb,0x5dfc,
-0x5dff,0x5e00,0x5e04,0x5e07,0x5e09,0x5e0a,0x5e0b,0x5e0d,
-0x5e0e,0x5e12,0x5e13,0x5e17,0x5e1e,0x5e1f,0x5e20,0x5e21,
-0x5e22,0x5e23,0x5e24,0x5e25,0x5e28,0x5e29,0x5e2a,0x5e2b,
-0x5e2c,0x5e2f,0x5e30,0x5e32,0x5e33,0x5e34,0x5e35,0x5e36,
-0x5e39,0x5e3a,0x5e3e,0x5e3f,0x5e40,0x5e41,0x5e43,0x5e46,
-0x5e47,0x5e48,0x5e49,0x5e4a,0x5e4b,0x5e4d,0x5e4e,0x5e4f,
-0x5e50,0x5e51,0x5e52,0x5e53,0x5e56,0x5e57,0x5e58,0x5e59,
-0x5e5a,0x5e5c,0x5e5d,0x5e5f,0x5e60,0x5e63,0x5e64,0x5e65,
-0x5e66,0x5e67,0x5e68,0x5e69,0x5e6a,0x5e6b,0x5e6c,0x5e6d,
-0x5e6e,0x5e6f,0x5e70,0x5e71,0x5e75,0x5e77,0x5e79,0x5e7e,
-0x5e81,0x5e82,0x5e83,0x5e85,0x5e88,0x5e89,0x5e8c,0x5e8d,
-0x5e8e,0x5e92,0x5e98,0x5e9b,0x5e9d,0x5ea1,0x5ea2,0x5ea3,
-0x5ea4,0x5ea8,0x5ea9,0x5eaa,0x5eab,0x5eac,0x5eae,0x5eaf,
-0x5eb0,0x5eb1,0x5eb2,0x5eb4,0x5eba,0x5ebb,0x5ebc,0x5ebd,
-0x5ebf,0x5ec0,0x5ec1,0x5ec2,0x5ec3,0x5ec4,0x5ec5,0x0000,
-/* 0x8f00 */
-0x5ec6,0x5ec7,0x5ec8,0x5ecb,0x5ecc,0x5ecd,0x5ece,0x5ecf,
-0x5ed0,0x5ed4,0x5ed5,0x5ed7,0x5ed8,0x5ed9,0x5eda,0x5edc,
-0x5edd,0x5ede,0x5edf,0x5ee0,0x5ee1,0x5ee2,0x5ee3,0x5ee4,
-0x5ee5,0x5ee6,0x5ee7,0x5ee9,0x5eeb,0x5eec,0x5eed,0x5eee,
-0x5eef,0x5ef0,0x5ef1,0x5ef2,0x5ef3,0x5ef5,0x5ef8,0x5ef9,
-0x5efb,0x5efc,0x5efd,0x5f05,0x5f06,0x5f07,0x5f09,0x5f0c,
-0x5f0d,0x5f0e,0x5f10,0x5f12,0x5f14,0x5f16,0x5f19,0x5f1a,
-0x5f1c,0x5f1d,0x5f1e,0x5f21,0x5f22,0x5f23,0x5f24,0x0000,
-0x5f28,0x5f2b,0x5f2c,0x5f2e,0x5f30,0x5f32,0x5f33,0x5f34,
-0x5f35,0x5f36,0x5f37,0x5f38,0x5f3b,0x5f3d,0x5f3e,0x5f3f,
-0x5f41,0x5f42,0x5f43,0x5f44,0x5f45,0x5f46,0x5f47,0x5f48,
-0x5f49,0x5f4a,0x5f4b,0x5f4c,0x5f4d,0x5f4e,0x5f4f,0x5f51,
-0x5f54,0x5f59,0x5f5a,0x5f5b,0x5f5c,0x5f5e,0x5f5f,0x5f60,
-0x5f63,0x5f65,0x5f67,0x5f68,0x5f6b,0x5f6e,0x5f6f,0x5f72,
-0x5f74,0x5f75,0x5f76,0x5f78,0x5f7a,0x5f7d,0x5f7e,0x5f7f,
-0x5f83,0x5f86,0x5f8d,0x5f8e,0x5f8f,0x5f91,0x5f93,0x5f94,
-0x5f96,0x5f9a,0x5f9b,0x5f9d,0x5f9e,0x5f9f,0x5fa0,0x5fa2,
-0x5fa3,0x5fa4,0x5fa5,0x5fa6,0x5fa7,0x5fa9,0x5fab,0x5fac,
-0x5faf,0x5fb0,0x5fb1,0x5fb2,0x5fb3,0x5fb4,0x5fb6,0x5fb8,
-0x5fb9,0x5fba,0x5fbb,0x5fbe,0x5fbf,0x5fc0,0x5fc1,0x5fc2,
-0x5fc7,0x5fc8,0x5fca,0x5fcb,0x5fce,0x5fd3,0x5fd4,0x5fd5,
-0x5fda,0x5fdb,0x5fdc,0x5fde,0x5fdf,0x5fe2,0x5fe3,0x5fe5,
-0x5fe6,0x5fe8,0x5fe9,0x5fec,0x5fef,0x5ff0,0x5ff2,0x5ff3,
-0x5ff4,0x5ff6,0x5ff7,0x5ff9,0x5ffa,0x5ffc,0x6007,0x0000,
-/* 0x9000 */
-0x6008,0x6009,0x600b,0x600c,0x6010,0x6011,0x6013,0x6017,
-0x6018,0x601a,0x601e,0x601f,0x6022,0x6023,0x6024,0x602c,
-0x602d,0x602e,0x6030,0x6031,0x6032,0x6033,0x6034,0x6036,
-0x6037,0x6038,0x6039,0x603a,0x603d,0x603e,0x6040,0x6044,
-0x6045,0x6046,0x6047,0x6048,0x6049,0x604a,0x604c,0x604e,
-0x604f,0x6051,0x6053,0x6054,0x6056,0x6057,0x6058,0x605b,
-0x605c,0x605e,0x605f,0x6060,0x6061,0x6065,0x6066,0x606e,
-0x6071,0x6072,0x6074,0x6075,0x6077,0x607e,0x6080,0x0000,
-0x6081,0x6082,0x6085,0x6086,0x6087,0x6088,0x608a,0x608b,
-0x608e,0x608f,0x6090,0x6091,0x6093,0x6095,0x6097,0x6098,
-0x6099,0x609c,0x609e,0x60a1,0x60a2,0x60a4,0x60a5,0x60a7,
-0x60a9,0x60aa,0x60ae,0x60b0,0x60b3,0x60b5,0x60b6,0x60b7,
-0x60b9,0x60ba,0x60bd,0x60be,0x60bf,0x60c0,0x60c1,0x60c2,
-0x60c3,0x60c4,0x60c7,0x60c8,0x60c9,0x60cc,0x60cd,0x60ce,
-0x60cf,0x60d0,0x60d2,0x60d3,0x60d4,0x60d6,0x60d7,0x60d9,
-0x60db,0x60de,0x60e1,0x60e2,0x60e3,0x60e4,0x60e5,0x60ea,
-0x60f1,0x60f2,0x60f5,0x60f7,0x60f8,0x60fb,0x60fc,0x60fd,
-0x60fe,0x60ff,0x6102,0x6103,0x6104,0x6105,0x6107,0x610a,
-0x610b,0x610c,0x6110,0x6111,0x6112,0x6113,0x6114,0x6116,
-0x6117,0x6118,0x6119,0x611b,0x611c,0x611d,0x611e,0x6121,
-0x6122,0x6125,0x6128,0x6129,0x612a,0x612c,0x612d,0x612e,
-0x612f,0x6130,0x6131,0x6132,0x6133,0x6134,0x6135,0x6136,
-0x6137,0x6138,0x6139,0x613a,0x613b,0x613c,0x613d,0x613e,
-0x6140,0x6141,0x6142,0x6143,0x6144,0x6145,0x6146,0x0000,
-/* 0x9100 */
-0x6147,0x6149,0x614b,0x614d,0x614f,0x6150,0x6152,0x6153,
-0x6154,0x6156,0x6157,0x6158,0x6159,0x615a,0x615b,0x615c,
-0x615e,0x615f,0x6160,0x6161,0x6163,0x6164,0x6165,0x6166,
-0x6169,0x616a,0x616b,0x616c,0x616d,0x616e,0x616f,0x6171,
-0x6172,0x6173,0x6174,0x6176,0x6178,0x6179,0x617a,0x617b,
-0x617c,0x617d,0x617e,0x617f,0x6180,0x6181,0x6182,0x6183,
-0x6184,0x6185,0x6186,0x6187,0x6188,0x6189,0x618a,0x618c,
-0x618d,0x618f,0x6190,0x6191,0x6192,0x6193,0x6195,0x0000,
-0x6196,0x6197,0x6198,0x6199,0x619a,0x619b,0x619c,0x619e,
-0x619f,0x61a0,0x61a1,0x61a2,0x61a3,0x61a4,0x61a5,0x61a6,
-0x61aa,0x61ab,0x61ad,0x61ae,0x61af,0x61b0,0x61b1,0x61b2,
-0x61b3,0x61b4,0x61b5,0x61b6,0x61b8,0x61b9,0x61ba,0x61bb,
-0x61bc,0x61bd,0x61bf,0x61c0,0x61c1,0x61c3,0x61c4,0x61c5,
-0x61c6,0x61c7,0x61c9,0x61cc,0x61cd,0x61ce,0x61cf,0x61d0,
-0x61d3,0x61d5,0x61d6,0x61d7,0x61d8,0x61d9,0x61da,0x61db,
-0x61dc,0x61dd,0x61de,0x61df,0x61e0,0x61e1,0x61e2,0x61e3,
-0x61e4,0x61e5,0x61e7,0x61e8,0x61e9,0x61ea,0x61eb,0x61ec,
-0x61ed,0x61ee,0x61ef,0x61f0,0x61f1,0x61f2,0x61f3,0x61f4,
-0x61f6,0x61f7,0x61f8,0x61f9,0x61fa,0x61fb,0x61fc,0x61fd,
-0x61fe,0x6200,0x6201,0x6202,0x6203,0x6204,0x6205,0x6207,
-0x6209,0x6213,0x6214,0x6219,0x621c,0x621d,0x621e,0x6220,
-0x6223,0x6226,0x6227,0x6228,0x6229,0x622b,0x622d,0x622f,
-0x6230,0x6231,0x6232,0x6235,0x6236,0x6238,0x6239,0x623a,
-0x623b,0x623c,0x6242,0x6244,0x6245,0x6246,0x624a,0x0000,
-/* 0x9200 */
-0x624f,0x6250,0x6255,0x6256,0x6257,0x6259,0x625a,0x625c,
-0x625d,0x625e,0x625f,0x6260,0x6261,0x6262,0x6264,0x6265,
-0x6268,0x6271,0x6272,0x6274,0x6275,0x6277,0x6278,0x627a,
-0x627b,0x627d,0x6281,0x6282,0x6283,0x6285,0x6286,0x6287,
-0x6288,0x628b,0x628c,0x628d,0x628e,0x628f,0x6290,0x6294,
-0x6299,0x629c,0x629d,0x629e,0x62a3,0x62a6,0x62a7,0x62a9,
-0x62aa,0x62ad,0x62ae,0x62af,0x62b0,0x62b2,0x62b3,0x62b4,
-0x62b6,0x62b7,0x62b8,0x62ba,0x62be,0x62c0,0x62c1,0x0000,
-0x62c3,0x62cb,0x62cf,0x62d1,0x62d5,0x62dd,0x62de,0x62e0,
-0x62e1,0x62e4,0x62ea,0x62eb,0x62f0,0x62f2,0x62f5,0x62f8,
-0x62f9,0x62fa,0x62fb,0x6300,0x6303,0x6304,0x6305,0x6306,
-0x630a,0x630b,0x630c,0x630d,0x630f,0x6310,0x6312,0x6313,
-0x6314,0x6315,0x6317,0x6318,0x6319,0x631c,0x6326,0x6327,
-0x6329,0x632c,0x632d,0x632e,0x6330,0x6331,0x6333,0x6334,
-0x6335,0x6336,0x6337,0x6338,0x633b,0x633c,0x633e,0x633f,
-0x6340,0x6341,0x6344,0x6347,0x6348,0x634a,0x6351,0x6352,
-0x6353,0x6354,0x6356,0x6357,0x6358,0x6359,0x635a,0x635b,
-0x635c,0x635d,0x6360,0x6364,0x6365,0x6366,0x6368,0x636a,
-0x636b,0x636c,0x636f,0x6370,0x6372,0x6373,0x6374,0x6375,
-0x6378,0x6379,0x637c,0x637d,0x637e,0x637f,0x6381,0x6383,
-0x6384,0x6385,0x6386,0x638b,0x638d,0x6391,0x6393,0x6394,
-0x6395,0x6397,0x6399,0x639a,0x639b,0x639c,0x639d,0x639e,
-0x639f,0x63a1,0x63a4,0x63a6,0x63ab,0x63af,0x63b1,0x63b2,
-0x63b5,0x63b6,0x63b9,0x63bb,0x63bd,0x63bf,0x63c0,0x0000,
-/* 0x9300 */
-0x63c1,0x63c2,0x63c3,0x63c5,0x63c7,0x63c8,0x63ca,0x63cb,
-0x63cc,0x63d1,0x63d3,0x63d4,0x63d5,0x63d7,0x63d8,0x63d9,
-0x63da,0x63db,0x63dc,0x63dd,0x63df,0x63e2,0x63e4,0x63e5,
-0x63e6,0x63e7,0x63e8,0x63eb,0x63ec,0x63ee,0x63ef,0x63f0,
-0x63f1,0x63f3,0x63f5,0x63f7,0x63f9,0x63fa,0x63fb,0x63fc,
-0x63fe,0x6403,0x6404,0x6406,0x6407,0x6408,0x6409,0x640a,
-0x640d,0x640e,0x6411,0x6412,0x6415,0x6416,0x6417,0x6418,
-0x6419,0x641a,0x641d,0x641f,0x6422,0x6423,0x6424,0x0000,
-0x6425,0x6427,0x6428,0x6429,0x642b,0x642e,0x642f,0x6430,
-0x6431,0x6432,0x6433,0x6435,0x6436,0x6437,0x6438,0x6439,
-0x643b,0x643c,0x643e,0x6440,0x6442,0x6443,0x6449,0x644b,
-0x644c,0x644d,0x644e,0x644f,0x6450,0x6451,0x6453,0x6455,
-0x6456,0x6457,0x6459,0x645a,0x645b,0x645c,0x645d,0x645f,
-0x6460,0x6461,0x6462,0x6463,0x6464,0x6465,0x6466,0x6468,
-0x646a,0x646b,0x646c,0x646e,0x646f,0x6470,0x6471,0x6472,
-0x6473,0x6474,0x6475,0x6476,0x6477,0x647b,0x647c,0x647d,
-0x647e,0x647f,0x6480,0x6481,0x6483,0x6486,0x6488,0x6489,
-0x648a,0x648b,0x648c,0x648d,0x648e,0x648f,0x6490,0x6493,
-0x6494,0x6497,0x6498,0x649a,0x649b,0x649c,0x649d,0x649f,
-0x64a0,0x64a1,0x64a2,0x64a3,0x64a5,0x64a6,0x64a7,0x64a8,
-0x64aa,0x64ab,0x64af,0x64b1,0x64b2,0x64b3,0x64b4,0x64b6,
-0x64b9,0x64bb,0x64bd,0x64be,0x64bf,0x64c1,0x64c3,0x64c4,
-0x64c6,0x64c7,0x64c8,0x64c9,0x64ca,0x64cb,0x64cc,0x64cf,
-0x64d1,0x64d3,0x64d4,0x64d5,0x64d6,0x64d9,0x64da,0x0000,
-/* 0x9400 */
-0x64db,0x64dc,0x64dd,0x64df,0x64e0,0x64e1,0x64e3,0x64e5,
-0x64e7,0x64e8,0x64e9,0x64ea,0x64eb,0x64ec,0x64ed,0x64ee,
-0x64ef,0x64f0,0x64f1,0x64f2,0x64f3,0x64f4,0x64f5,0x64f6,
-0x64f7,0x64f8,0x64f9,0x64fa,0x64fb,0x64fc,0x64fd,0x64fe,
-0x64ff,0x6501,0x6502,0x6503,0x6504,0x6505,0x6506,0x6507,
-0x6508,0x650a,0x650b,0x650c,0x650d,0x650e,0x650f,0x6510,
-0x6511,0x6513,0x6514,0x6515,0x6516,0x6517,0x6519,0x651a,
-0x651b,0x651c,0x651d,0x651e,0x651f,0x6520,0x6521,0x0000,
-0x6522,0x6523,0x6524,0x6526,0x6527,0x6528,0x6529,0x652a,
-0x652c,0x652d,0x6530,0x6531,0x6532,0x6533,0x6537,0x653a,
-0x653c,0x653d,0x6540,0x6541,0x6542,0x6543,0x6544,0x6546,
-0x6547,0x654a,0x654b,0x654d,0x654e,0x6550,0x6552,0x6553,
-0x6554,0x6557,0x6558,0x655a,0x655c,0x655f,0x6560,0x6561,
-0x6564,0x6565,0x6567,0x6568,0x6569,0x656a,0x656d,0x656e,
-0x656f,0x6571,0x6573,0x6575,0x6576,0x6578,0x6579,0x657a,
-0x657b,0x657c,0x657d,0x657e,0x657f,0x6580,0x6581,0x6582,
-0x6583,0x6584,0x6585,0x6586,0x6588,0x6589,0x658a,0x658d,
-0x658e,0x658f,0x6592,0x6594,0x6595,0x6596,0x6598,0x659a,
-0x659d,0x659e,0x65a0,0x65a2,0x65a3,0x65a6,0x65a8,0x65aa,
-0x65ac,0x65ae,0x65b1,0x65b2,0x65b3,0x65b4,0x65b5,0x65b6,
-0x65b7,0x65b8,0x65ba,0x65bb,0x65be,0x65bf,0x65c0,0x65c2,
-0x65c7,0x65c8,0x65c9,0x65ca,0x65cd,0x65d0,0x65d1,0x65d3,
-0x65d4,0x65d5,0x65d8,0x65d9,0x65da,0x65db,0x65dc,0x65dd,
-0x65de,0x65df,0x65e1,0x65e3,0x65e4,0x65ea,0x65eb,0x0000,
-/* 0x9500 */
-0x65f2,0x65f3,0x65f4,0x65f5,0x65f8,0x65f9,0x65fb,0x65fc,
-0x65fd,0x65fe,0x65ff,0x6601,0x6604,0x6605,0x6607,0x6608,
-0x6609,0x660b,0x660d,0x6610,0x6611,0x6612,0x6616,0x6617,
-0x6618,0x661a,0x661b,0x661c,0x661e,0x6621,0x6622,0x6623,
-0x6624,0x6626,0x6629,0x662a,0x662b,0x662c,0x662e,0x6630,
-0x6632,0x6633,0x6637,0x6638,0x6639,0x663a,0x663b,0x663d,
-0x663f,0x6640,0x6642,0x6644,0x6645,0x6646,0x6647,0x6648,
-0x6649,0x664a,0x664d,0x664e,0x6650,0x6651,0x6658,0x0000,
-0x6659,0x665b,0x665c,0x665d,0x665e,0x6660,0x6662,0x6663,
-0x6665,0x6667,0x6669,0x666a,0x666b,0x666c,0x666d,0x6671,
-0x6672,0x6673,0x6675,0x6678,0x6679,0x667b,0x667c,0x667d,
-0x667f,0x6680,0x6681,0x6683,0x6685,0x6686,0x6688,0x6689,
-0x668a,0x668b,0x668d,0x668e,0x668f,0x6690,0x6692,0x6693,
-0x6694,0x6695,0x6698,0x6699,0x669a,0x669b,0x669c,0x669e,
-0x669f,0x66a0,0x66a1,0x66a2,0x66a3,0x66a4,0x66a5,0x66a6,
-0x66a9,0x66aa,0x66ab,0x66ac,0x66ad,0x66af,0x66b0,0x66b1,
-0x66b2,0x66b3,0x66b5,0x66b6,0x66b7,0x66b8,0x66ba,0x66bb,
-0x66bc,0x66bd,0x66bf,0x66c0,0x66c1,0x66c2,0x66c3,0x66c4,
-0x66c5,0x66c6,0x66c7,0x66c8,0x66c9,0x66ca,0x66cb,0x66cc,
-0x66cd,0x66ce,0x66cf,0x66d0,0x66d1,0x66d2,0x66d3,0x66d4,
-0x66d5,0x66d6,0x66d7,0x66d8,0x66da,0x66de,0x66df,0x66e0,
-0x66e1,0x66e2,0x66e3,0x66e4,0x66e5,0x66e7,0x66e8,0x66ea,
-0x66eb,0x66ec,0x66ed,0x66ee,0x66ef,0x66f1,0x66f5,0x66f6,
-0x66f8,0x66fa,0x66fb,0x66fd,0x6701,0x6702,0x6703,0x0000,
-/* 0x9600 */
-0x6704,0x6705,0x6706,0x6707,0x670c,0x670e,0x670f,0x6711,
-0x6712,0x6713,0x6716,0x6718,0x6719,0x671a,0x671c,0x671e,
-0x6720,0x6721,0x6722,0x6723,0x6724,0x6725,0x6727,0x6729,
-0x672e,0x6730,0x6732,0x6733,0x6736,0x6737,0x6738,0x6739,
-0x673b,0x673c,0x673e,0x673f,0x6741,0x6744,0x6745,0x6747,
-0x674a,0x674b,0x674d,0x6752,0x6754,0x6755,0x6757,0x6758,
-0x6759,0x675a,0x675b,0x675d,0x6762,0x6763,0x6764,0x6766,
-0x6767,0x676b,0x676c,0x676e,0x6771,0x6774,0x6776,0x0000,
-0x6778,0x6779,0x677a,0x677b,0x677d,0x6780,0x6782,0x6783,
-0x6785,0x6786,0x6788,0x678a,0x678c,0x678d,0x678e,0x678f,
-0x6791,0x6792,0x6793,0x6794,0x6796,0x6799,0x679b,0x679f,
-0x67a0,0x67a1,0x67a4,0x67a6,0x67a9,0x67ac,0x67ae,0x67b1,
-0x67b2,0x67b4,0x67b9,0x67ba,0x67bb,0x67bc,0x67bd,0x67be,
-0x67bf,0x67c0,0x67c2,0x67c5,0x67c6,0x67c7,0x67c8,0x67c9,
-0x67ca,0x67cb,0x67cc,0x67cd,0x67ce,0x67d5,0x67d6,0x67d7,
-0x67db,0x67df,0x67e1,0x67e3,0x67e4,0x67e6,0x67e7,0x67e8,
-0x67ea,0x67eb,0x67ed,0x67ee,0x67f2,0x67f5,0x67f6,0x67f7,
-0x67f8,0x67f9,0x67fa,0x67fb,0x67fc,0x67fe,0x6801,0x6802,
-0x6803,0x6804,0x6806,0x680d,0x6810,0x6812,0x6814,0x6815,
-0x6818,0x6819,0x681a,0x681b,0x681c,0x681e,0x681f,0x6820,
-0x6822,0x6823,0x6824,0x6825,0x6826,0x6827,0x6828,0x682b,
-0x682c,0x682d,0x682e,0x682f,0x6830,0x6831,0x6834,0x6835,
-0x6836,0x683a,0x683b,0x683f,0x6847,0x684b,0x684d,0x684f,
-0x6852,0x6856,0x6857,0x6858,0x6859,0x685a,0x685b,0x0000,
-/* 0x9700 */
-0x685c,0x685d,0x685e,0x685f,0x686a,0x686c,0x686d,0x686e,
-0x686f,0x6870,0x6871,0x6872,0x6873,0x6875,0x6878,0x6879,
-0x687a,0x687b,0x687c,0x687d,0x687e,0x687f,0x6880,0x6882,
-0x6884,0x6887,0x6888,0x6889,0x688a,0x688b,0x688c,0x688d,
-0x688e,0x6890,0x6891,0x6892,0x6894,0x6895,0x6896,0x6898,
-0x6899,0x689a,0x689b,0x689c,0x689d,0x689e,0x689f,0x68a0,
-0x68a1,0x68a3,0x68a4,0x68a5,0x68a9,0x68aa,0x68ab,0x68ac,
-0x68ae,0x68b1,0x68b2,0x68b4,0x68b6,0x68b7,0x68b8,0x0000,
-0x68b9,0x68ba,0x68bb,0x68bc,0x68bd,0x68be,0x68bf,0x68c1,
-0x68c3,0x68c4,0x68c5,0x68c6,0x68c7,0x68c8,0x68ca,0x68cc,
-0x68ce,0x68cf,0x68d0,0x68d1,0x68d3,0x68d4,0x68d6,0x68d7,
-0x68d9,0x68db,0x68dc,0x68dd,0x68de,0x68df,0x68e1,0x68e2,
-0x68e4,0x68e5,0x68e6,0x68e7,0x68e8,0x68e9,0x68ea,0x68eb,
-0x68ec,0x68ed,0x68ef,0x68f2,0x68f3,0x68f4,0x68f6,0x68f7,
-0x68f8,0x68fb,0x68fd,0x68fe,0x68ff,0x6900,0x6902,0x6903,
-0x6904,0x6906,0x6907,0x6908,0x6909,0x690a,0x690c,0x690f,
-0x6911,0x6913,0x6914,0x6915,0x6916,0x6917,0x6918,0x6919,
-0x691a,0x691b,0x691c,0x691d,0x691e,0x6921,0x6922,0x6923,
-0x6925,0x6926,0x6927,0x6928,0x6929,0x692a,0x692b,0x692c,
-0x692e,0x692f,0x6931,0x6932,0x6933,0x6935,0x6936,0x6937,
-0x6938,0x693a,0x693b,0x693c,0x693e,0x6940,0x6941,0x6943,
-0x6944,0x6945,0x6946,0x6947,0x6948,0x6949,0x694a,0x694b,
-0x694c,0x694d,0x694e,0x694f,0x6950,0x6951,0x6952,0x6953,
-0x6955,0x6956,0x6958,0x6959,0x695b,0x695c,0x695f,0x0000,
-/* 0x9800 */
-0x6961,0x6962,0x6964,0x6965,0x6967,0x6968,0x6969,0x696a,
-0x696c,0x696d,0x696f,0x6970,0x6972,0x6973,0x6974,0x6975,
-0x6976,0x697a,0x697b,0x697d,0x697e,0x697f,0x6981,0x6983,
-0x6985,0x698a,0x698b,0x698c,0x698e,0x698f,0x6990,0x6991,
-0x6992,0x6993,0x6996,0x6997,0x6999,0x699a,0x699d,0x699e,
-0x699f,0x69a0,0x69a1,0x69a2,0x69a3,0x69a4,0x69a5,0x69a6,
-0x69a9,0x69aa,0x69ac,0x69ae,0x69af,0x69b0,0x69b2,0x69b3,
-0x69b5,0x69b6,0x69b8,0x69b9,0x69ba,0x69bc,0x69bd,0x0000,
-0x69be,0x69bf,0x69c0,0x69c2,0x69c3,0x69c4,0x69c5,0x69c6,
-0x69c7,0x69c8,0x69c9,0x69cb,0x69cd,0x69cf,0x69d1,0x69d2,
-0x69d3,0x69d5,0x69d6,0x69d7,0x69d8,0x69d9,0x69da,0x69dc,
-0x69dd,0x69de,0x69e1,0x69e2,0x69e3,0x69e4,0x69e5,0x69e6,
-0x69e7,0x69e8,0x69e9,0x69ea,0x69eb,0x69ec,0x69ee,0x69ef,
-0x69f0,0x69f1,0x69f3,0x69f4,0x69f5,0x69f6,0x69f7,0x69f8,
-0x69f9,0x69fa,0x69fb,0x69fc,0x69fe,0x6a00,0x6a01,0x6a02,
-0x6a03,0x6a04,0x6a05,0x6a06,0x6a07,0x6a08,0x6a09,0x6a0b,
-0x6a0c,0x6a0d,0x6a0e,0x6a0f,0x6a10,0x6a11,0x6a12,0x6a13,
-0x6a14,0x6a15,0x6a16,0x6a19,0x6a1a,0x6a1b,0x6a1c,0x6a1d,
-0x6a1e,0x6a20,0x6a22,0x6a23,0x6a24,0x6a25,0x6a26,0x6a27,
-0x6a29,0x6a2b,0x6a2c,0x6a2d,0x6a2e,0x6a30,0x6a32,0x6a33,
-0x6a34,0x6a36,0x6a37,0x6a38,0x6a39,0x6a3a,0x6a3b,0x6a3c,
-0x6a3f,0x6a40,0x6a41,0x6a42,0x6a43,0x6a45,0x6a46,0x6a48,
-0x6a49,0x6a4a,0x6a4b,0x6a4c,0x6a4d,0x6a4e,0x6a4f,0x6a51,
-0x6a52,0x6a53,0x6a54,0x6a55,0x6a56,0x6a57,0x6a5a,0x0000,
-/* 0x9900 */
-0x6a5c,0x6a5d,0x6a5e,0x6a5f,0x6a60,0x6a62,0x6a63,0x6a64,
-0x6a66,0x6a67,0x6a68,0x6a69,0x6a6a,0x6a6b,0x6a6c,0x6a6d,
-0x6a6e,0x6a6f,0x6a70,0x6a72,0x6a73,0x6a74,0x6a75,0x6a76,
-0x6a77,0x6a78,0x6a7a,0x6a7b,0x6a7d,0x6a7e,0x6a7f,0x6a81,
-0x6a82,0x6a83,0x6a85,0x6a86,0x6a87,0x6a88,0x6a89,0x6a8a,
-0x6a8b,0x6a8c,0x6a8d,0x6a8f,0x6a92,0x6a93,0x6a94,0x6a95,
-0x6a96,0x6a98,0x6a99,0x6a9a,0x6a9b,0x6a9c,0x6a9d,0x6a9e,
-0x6a9f,0x6aa1,0x6aa2,0x6aa3,0x6aa4,0x6aa5,0x6aa6,0x0000,
-0x6aa7,0x6aa8,0x6aaa,0x6aad,0x6aae,0x6aaf,0x6ab0,0x6ab1,
-0x6ab2,0x6ab3,0x6ab4,0x6ab5,0x6ab6,0x6ab7,0x6ab8,0x6ab9,
-0x6aba,0x6abb,0x6abc,0x6abd,0x6abe,0x6abf,0x6ac0,0x6ac1,
-0x6ac2,0x6ac3,0x6ac4,0x6ac5,0x6ac6,0x6ac7,0x6ac8,0x6ac9,
-0x6aca,0x6acb,0x6acc,0x6acd,0x6ace,0x6acf,0x6ad0,0x6ad1,
-0x6ad2,0x6ad3,0x6ad4,0x6ad5,0x6ad6,0x6ad7,0x6ad8,0x6ad9,
-0x6ada,0x6adb,0x6adc,0x6add,0x6ade,0x6adf,0x6ae0,0x6ae1,
-0x6ae2,0x6ae3,0x6ae4,0x6ae5,0x6ae6,0x6ae7,0x6ae8,0x6ae9,
-0x6aea,0x6aeb,0x6aec,0x6aed,0x6aee,0x6aef,0x6af0,0x6af1,
-0x6af2,0x6af3,0x6af4,0x6af5,0x6af6,0x6af7,0x6af8,0x6af9,
-0x6afa,0x6afb,0x6afc,0x6afd,0x6afe,0x6aff,0x6b00,0x6b01,
-0x6b02,0x6b03,0x6b04,0x6b05,0x6b06,0x6b07,0x6b08,0x6b09,
-0x6b0a,0x6b0b,0x6b0c,0x6b0d,0x6b0e,0x6b0f,0x6b10,0x6b11,
-0x6b12,0x6b13,0x6b14,0x6b15,0x6b16,0x6b17,0x6b18,0x6b19,
-0x6b1a,0x6b1b,0x6b1c,0x6b1d,0x6b1e,0x6b1f,0x6b25,0x6b26,
-0x6b28,0x6b29,0x6b2a,0x6b2b,0x6b2c,0x6b2d,0x6b2e,0x0000,
-/* 0x9a00 */
-0x6b2f,0x6b30,0x6b31,0x6b33,0x6b34,0x6b35,0x6b36,0x6b38,
-0x6b3b,0x6b3c,0x6b3d,0x6b3f,0x6b40,0x6b41,0x6b42,0x6b44,
-0x6b45,0x6b48,0x6b4a,0x6b4b,0x6b4d,0x6b4e,0x6b4f,0x6b50,
-0x6b51,0x6b52,0x6b53,0x6b54,0x6b55,0x6b56,0x6b57,0x6b58,
-0x6b5a,0x6b5b,0x6b5c,0x6b5d,0x6b5e,0x6b5f,0x6b60,0x6b61,
-0x6b68,0x6b69,0x6b6b,0x6b6c,0x6b6d,0x6b6e,0x6b6f,0x6b70,
-0x6b71,0x6b72,0x6b73,0x6b74,0x6b75,0x6b76,0x6b77,0x6b78,
-0x6b7a,0x6b7d,0x6b7e,0x6b7f,0x6b80,0x6b85,0x6b88,0x0000,
-0x6b8c,0x6b8e,0x6b8f,0x6b90,0x6b91,0x6b94,0x6b95,0x6b97,
-0x6b98,0x6b99,0x6b9c,0x6b9d,0x6b9e,0x6b9f,0x6ba0,0x6ba2,
-0x6ba3,0x6ba4,0x6ba5,0x6ba6,0x6ba7,0x6ba8,0x6ba9,0x6bab,
-0x6bac,0x6bad,0x6bae,0x6baf,0x6bb0,0x6bb1,0x6bb2,0x6bb6,
-0x6bb8,0x6bb9,0x6bba,0x6bbb,0x6bbc,0x6bbd,0x6bbe,0x6bc0,
-0x6bc3,0x6bc4,0x6bc6,0x6bc7,0x6bc8,0x6bc9,0x6bca,0x6bcc,
-0x6bce,0x6bd0,0x6bd1,0x6bd8,0x6bda,0x6bdc,0x6bdd,0x6bde,
-0x6bdf,0x6be0,0x6be2,0x6be3,0x6be4,0x6be5,0x6be6,0x6be7,
-0x6be8,0x6be9,0x6bec,0x6bed,0x6bee,0x6bf0,0x6bf1,0x6bf2,
-0x6bf4,0x6bf6,0x6bf7,0x6bf8,0x6bfa,0x6bfb,0x6bfc,0x6bfe,
-0x6bff,0x6c00,0x6c01,0x6c02,0x6c03,0x6c04,0x6c08,0x6c09,
-0x6c0a,0x6c0b,0x6c0c,0x6c0e,0x6c12,0x6c17,0x6c1c,0x6c1d,
-0x6c1e,0x6c20,0x6c23,0x6c25,0x6c2b,0x6c2c,0x6c2d,0x6c31,
-0x6c33,0x6c36,0x6c37,0x6c39,0x6c3a,0x6c3b,0x6c3c,0x6c3e,
-0x6c3f,0x6c43,0x6c44,0x6c45,0x6c48,0x6c4b,0x6c4c,0x6c4d,
-0x6c4e,0x6c4f,0x6c51,0x6c52,0x6c53,0x6c56,0x6c58,0x0000,
-/* 0x9b00 */
-0x6c59,0x6c5a,0x6c62,0x6c63,0x6c65,0x6c66,0x6c67,0x6c6b,
-0x6c6c,0x6c6d,0x6c6e,0x6c6f,0x6c71,0x6c73,0x6c75,0x6c77,
-0x6c78,0x6c7a,0x6c7b,0x6c7c,0x6c7f,0x6c80,0x6c84,0x6c87,
-0x6c8a,0x6c8b,0x6c8d,0x6c8e,0x6c91,0x6c92,0x6c95,0x6c96,
-0x6c97,0x6c98,0x6c9a,0x6c9c,0x6c9d,0x6c9e,0x6ca0,0x6ca2,
-0x6ca8,0x6cac,0x6caf,0x6cb0,0x6cb4,0x6cb5,0x6cb6,0x6cb7,
-0x6cba,0x6cc0,0x6cc1,0x6cc2,0x6cc3,0x6cc6,0x6cc7,0x6cc8,
-0x6ccb,0x6ccd,0x6cce,0x6ccf,0x6cd1,0x6cd2,0x6cd8,0x0000,
-0x6cd9,0x6cda,0x6cdc,0x6cdd,0x6cdf,0x6ce4,0x6ce6,0x6ce7,
-0x6ce9,0x6cec,0x6ced,0x6cf2,0x6cf4,0x6cf9,0x6cff,0x6d00,
-0x6d02,0x6d03,0x6d05,0x6d06,0x6d08,0x6d09,0x6d0a,0x6d0d,
-0x6d0f,0x6d10,0x6d11,0x6d13,0x6d14,0x6d15,0x6d16,0x6d18,
-0x6d1c,0x6d1d,0x6d1f,0x6d20,0x6d21,0x6d22,0x6d23,0x6d24,
-0x6d26,0x6d28,0x6d29,0x6d2c,0x6d2d,0x6d2f,0x6d30,0x6d34,
-0x6d36,0x6d37,0x6d38,0x6d3a,0x6d3f,0x6d40,0x6d42,0x6d44,
-0x6d49,0x6d4c,0x6d50,0x6d55,0x6d56,0x6d57,0x6d58,0x6d5b,
-0x6d5d,0x6d5f,0x6d61,0x6d62,0x6d64,0x6d65,0x6d67,0x6d68,
-0x6d6b,0x6d6c,0x6d6d,0x6d70,0x6d71,0x6d72,0x6d73,0x6d75,
-0x6d76,0x6d79,0x6d7a,0x6d7b,0x6d7d,0x6d7e,0x6d7f,0x6d80,
-0x6d81,0x6d83,0x6d84,0x6d86,0x6d87,0x6d8a,0x6d8b,0x6d8d,
-0x6d8f,0x6d90,0x6d92,0x6d96,0x6d97,0x6d98,0x6d99,0x6d9a,
-0x6d9c,0x6da2,0x6da5,0x6dac,0x6dad,0x6db0,0x6db1,0x6db3,
-0x6db4,0x6db6,0x6db7,0x6db9,0x6dba,0x6dbb,0x6dbc,0x6dbd,
-0x6dbe,0x6dc1,0x6dc2,0x6dc3,0x6dc8,0x6dc9,0x6dca,0x0000,
-/* 0x9c00 */
-0x6dcd,0x6dce,0x6dcf,0x6dd0,0x6dd2,0x6dd3,0x6dd4,0x6dd5,
-0x6dd7,0x6dda,0x6ddb,0x6ddc,0x6ddf,0x6de2,0x6de3,0x6de5,
-0x6de7,0x6de8,0x6de9,0x6dea,0x6ded,0x6def,0x6df0,0x6df2,
-0x6df4,0x6df5,0x6df6,0x6df8,0x6dfa,0x6dfd,0x6dfe,0x6dff,
-0x6e00,0x6e01,0x6e02,0x6e03,0x6e04,0x6e06,0x6e07,0x6e08,
-0x6e09,0x6e0b,0x6e0f,0x6e12,0x6e13,0x6e15,0x6e18,0x6e19,
-0x6e1b,0x6e1c,0x6e1e,0x6e1f,0x6e22,0x6e26,0x6e27,0x6e28,
-0x6e2a,0x6e2c,0x6e2e,0x6e30,0x6e31,0x6e33,0x6e35,0x0000,
-0x6e36,0x6e37,0x6e39,0x6e3b,0x6e3c,0x6e3d,0x6e3e,0x6e3f,
-0x6e40,0x6e41,0x6e42,0x6e45,0x6e46,0x6e47,0x6e48,0x6e49,
-0x6e4a,0x6e4b,0x6e4c,0x6e4f,0x6e50,0x6e51,0x6e52,0x6e55,
-0x6e57,0x6e59,0x6e5a,0x6e5c,0x6e5d,0x6e5e,0x6e60,0x6e61,
-0x6e62,0x6e63,0x6e64,0x6e65,0x6e66,0x6e67,0x6e68,0x6e69,
-0x6e6a,0x6e6c,0x6e6d,0x6e6f,0x6e70,0x6e71,0x6e72,0x6e73,
-0x6e74,0x6e75,0x6e76,0x6e77,0x6e78,0x6e79,0x6e7a,0x6e7b,
-0x6e7c,0x6e7d,0x6e80,0x6e81,0x6e82,0x6e84,0x6e87,0x6e88,
-0x6e8a,0x6e8b,0x6e8c,0x6e8d,0x6e8e,0x6e91,0x6e92,0x6e93,
-0x6e94,0x6e95,0x6e96,0x6e97,0x6e99,0x6e9a,0x6e9b,0x6e9d,
-0x6e9e,0x6ea0,0x6ea1,0x6ea3,0x6ea4,0x6ea6,0x6ea8,0x6ea9,
-0x6eab,0x6eac,0x6ead,0x6eae,0x6eb0,0x6eb3,0x6eb5,0x6eb8,
-0x6eb9,0x6ebc,0x6ebe,0x6ebf,0x6ec0,0x6ec3,0x6ec4,0x6ec5,
-0x6ec6,0x6ec8,0x6ec9,0x6eca,0x6ecc,0x6ecd,0x6ece,0x6ed0,
-0x6ed2,0x6ed6,0x6ed8,0x6ed9,0x6edb,0x6edc,0x6edd,0x6ee3,
-0x6ee7,0x6eea,0x6eeb,0x6eec,0x6eed,0x6eee,0x6eef,0x0000,
-/* 0x9d00 */
-0x6ef0,0x6ef1,0x6ef2,0x6ef3,0x6ef5,0x6ef6,0x6ef7,0x6ef8,
-0x6efa,0x6efb,0x6efc,0x6efd,0x6efe,0x6eff,0x6f00,0x6f01,
-0x6f03,0x6f04,0x6f05,0x6f07,0x6f08,0x6f0a,0x6f0b,0x6f0c,
-0x6f0d,0x6f0e,0x6f10,0x6f11,0x6f12,0x6f16,0x6f17,0x6f18,
-0x6f19,0x6f1a,0x6f1b,0x6f1c,0x6f1d,0x6f1e,0x6f1f,0x6f21,
-0x6f22,0x6f23,0x6f25,0x6f26,0x6f27,0x6f28,0x6f2c,0x6f2e,
-0x6f30,0x6f32,0x6f34,0x6f35,0x6f37,0x6f38,0x6f39,0x6f3a,
-0x6f3b,0x6f3c,0x6f3d,0x6f3f,0x6f40,0x6f41,0x6f42,0x0000,
-0x6f43,0x6f44,0x6f45,0x6f48,0x6f49,0x6f4a,0x6f4c,0x6f4e,
-0x6f4f,0x6f50,0x6f51,0x6f52,0x6f53,0x6f54,0x6f55,0x6f56,
-0x6f57,0x6f59,0x6f5a,0x6f5b,0x6f5d,0x6f5f,0x6f60,0x6f61,
-0x6f63,0x6f64,0x6f65,0x6f67,0x6f68,0x6f69,0x6f6a,0x6f6b,
-0x6f6c,0x6f6f,0x6f70,0x6f71,0x6f73,0x6f75,0x6f76,0x6f77,
-0x6f79,0x6f7b,0x6f7d,0x6f7e,0x6f7f,0x6f80,0x6f81,0x6f82,
-0x6f83,0x6f85,0x6f86,0x6f87,0x6f8a,0x6f8b,0x6f8f,0x6f90,
-0x6f91,0x6f92,0x6f93,0x6f94,0x6f95,0x6f96,0x6f97,0x6f98,
-0x6f99,0x6f9a,0x6f9b,0x6f9d,0x6f9e,0x6f9f,0x6fa0,0x6fa2,
-0x6fa3,0x6fa4,0x6fa5,0x6fa6,0x6fa8,0x6fa9,0x6faa,0x6fab,
-0x6fac,0x6fad,0x6fae,0x6faf,0x6fb0,0x6fb1,0x6fb2,0x6fb4,
-0x6fb5,0x6fb7,0x6fb8,0x6fba,0x6fbb,0x6fbc,0x6fbd,0x6fbe,
-0x6fbf,0x6fc1,0x6fc3,0x6fc4,0x6fc5,0x6fc6,0x6fc7,0x6fc8,
-0x6fca,0x6fcb,0x6fcc,0x6fcd,0x6fce,0x6fcf,0x6fd0,0x6fd3,
-0x6fd4,0x6fd5,0x6fd6,0x6fd7,0x6fd8,0x6fd9,0x6fda,0x6fdb,
-0x6fdc,0x6fdd,0x6fdf,0x6fe2,0x6fe3,0x6fe4,0x6fe5,0x0000,
-/* 0x9e00 */
-0x6fe6,0x6fe7,0x6fe8,0x6fe9,0x6fea,0x6feb,0x6fec,0x6fed,
-0x6ff0,0x6ff1,0x6ff2,0x6ff3,0x6ff4,0x6ff5,0x6ff6,0x6ff7,
-0x6ff8,0x6ff9,0x6ffa,0x6ffb,0x6ffc,0x6ffd,0x6ffe,0x6fff,
-0x7000,0x7001,0x7002,0x7003,0x7004,0x7005,0x7006,0x7007,
-0x7008,0x7009,0x700a,0x700b,0x700c,0x700d,0x700e,0x700f,
-0x7010,0x7012,0x7013,0x7014,0x7015,0x7016,0x7017,0x7018,
-0x7019,0x701c,0x701d,0x701e,0x701f,0x7020,0x7021,0x7022,
-0x7024,0x7025,0x7026,0x7027,0x7028,0x7029,0x702a,0x0000,
-0x702b,0x702c,0x702d,0x702e,0x702f,0x7030,0x7031,0x7032,
-0x7033,0x7034,0x7036,0x7037,0x7038,0x703a,0x703b,0x703c,
-0x703d,0x703e,0x703f,0x7040,0x7041,0x7042,0x7043,0x7044,
-0x7045,0x7046,0x7047,0x7048,0x7049,0x704a,0x704b,0x704d,
-0x704e,0x7050,0x7051,0x7052,0x7053,0x7054,0x7055,0x7056,
-0x7057,0x7058,0x7059,0x705a,0x705b,0x705c,0x705d,0x705f,
-0x7060,0x7061,0x7062,0x7063,0x7064,0x7065,0x7066,0x7067,
-0x7068,0x7069,0x706a,0x706e,0x7071,0x7072,0x7073,0x7074,
-0x7077,0x7079,0x707a,0x707b,0x707d,0x7081,0x7082,0x7083,
-0x7084,0x7086,0x7087,0x7088,0x708b,0x708c,0x708d,0x708f,
-0x7090,0x7091,0x7093,0x7097,0x7098,0x709a,0x709b,0x709e,
-0x709f,0x70a0,0x70a1,0x70a2,0x70a3,0x70a4,0x70a5,0x70a6,
-0x70a7,0x70a8,0x70a9,0x70aa,0x70b0,0x70b2,0x70b4,0x70b5,
-0x70b6,0x70ba,0x70be,0x70bf,0x70c4,0x70c5,0x70c6,0x70c7,
-0x70c9,0x70cb,0x70cc,0x70cd,0x70ce,0x70cf,0x70d0,0x70d1,
-0x70d2,0x70d3,0x70d4,0x70d5,0x70d6,0x70d7,0x70da,0x0000,
-/* 0x9f00 */
-0x70dc,0x70dd,0x70de,0x70e0,0x70e1,0x70e2,0x70e3,0x70e5,
-0x70ea,0x70ee,0x70f0,0x70f1,0x70f2,0x70f3,0x70f4,0x70f5,
-0x70f6,0x70f8,0x70fa,0x70fb,0x70fc,0x70fe,0x70ff,0x7100,
-0x7101,0x7102,0x7103,0x7104,0x7105,0x7106,0x7107,0x7108,
-0x710b,0x710c,0x710d,0x710e,0x710f,0x7111,0x7112,0x7114,
-0x7117,0x711b,0x711c,0x711d,0x711e,0x711f,0x7120,0x7121,
-0x7122,0x7123,0x7124,0x7125,0x7127,0x7128,0x7129,0x712a,
-0x712b,0x712c,0x712d,0x712e,0x7132,0x7133,0x7134,0x0000,
-0x7135,0x7137,0x7138,0x7139,0x713a,0x713b,0x713c,0x713d,
-0x713e,0x713f,0x7140,0x7141,0x7142,0x7143,0x7144,0x7146,
-0x7147,0x7148,0x7149,0x714b,0x714d,0x714f,0x7150,0x7151,
-0x7152,0x7153,0x7154,0x7155,0x7156,0x7157,0x7158,0x7159,
-0x715a,0x715b,0x715d,0x715f,0x7160,0x7161,0x7162,0x7163,
-0x7165,0x7169,0x716a,0x716b,0x716c,0x716d,0x716f,0x7170,
-0x7171,0x7174,0x7175,0x7176,0x7177,0x7179,0x717b,0x717c,
-0x717e,0x717f,0x7180,0x7181,0x7182,0x7183,0x7185,0x7186,
-0x7187,0x7188,0x7189,0x718b,0x718c,0x718d,0x718e,0x7190,
-0x7191,0x7192,0x7193,0x7195,0x7196,0x7197,0x719a,0x719b,
-0x719c,0x719d,0x719e,0x71a1,0x71a2,0x71a3,0x71a4,0x71a5,
-0x71a6,0x71a7,0x71a9,0x71aa,0x71ab,0x71ad,0x71ae,0x71af,
-0x71b0,0x71b1,0x71b2,0x71b4,0x71b6,0x71b7,0x71b8,0x71ba,
-0x71bb,0x71bc,0x71bd,0x71be,0x71bf,0x71c0,0x71c1,0x71c2,
-0x71c4,0x71c5,0x71c6,0x71c7,0x71c8,0x71c9,0x71ca,0x71cb,
-0x71cc,0x71cd,0x71cf,0x71d0,0x71d1,0x71d2,0x71d3,0x0000,
-/* 0xa000 */
-0x71d6,0x71d7,0x71d8,0x71d9,0x71da,0x71db,0x71dc,0x71dd,
-0x71de,0x71df,0x71e1,0x71e2,0x71e3,0x71e4,0x71e6,0x71e8,
-0x71e9,0x71ea,0x71eb,0x71ec,0x71ed,0x71ef,0x71f0,0x71f1,
-0x71f2,0x71f3,0x71f4,0x71f5,0x71f6,0x71f7,0x71f8,0x71fa,
-0x71fb,0x71fc,0x71fd,0x71fe,0x71ff,0x7200,0x7201,0x7202,
-0x7203,0x7204,0x7205,0x7207,0x7208,0x7209,0x720a,0x720b,
-0x720c,0x720d,0x720e,0x720f,0x7210,0x7211,0x7212,0x7213,
-0x7214,0x7215,0x7216,0x7217,0x7218,0x7219,0x721a,0x0000,
-0x721b,0x721c,0x721e,0x721f,0x7220,0x7221,0x7222,0x7223,
-0x7224,0x7225,0x7226,0x7227,0x7229,0x722b,0x722d,0x722e,
-0x722f,0x7232,0x7233,0x7234,0x723a,0x723c,0x723e,0x7240,
-0x7241,0x7242,0x7243,0x7244,0x7245,0x7246,0x7249,0x724a,
-0x724b,0x724e,0x724f,0x7250,0x7251,0x7253,0x7254,0x7255,
-0x7257,0x7258,0x725a,0x725c,0x725e,0x7260,0x7263,0x7264,
-0x7265,0x7268,0x726a,0x726b,0x726c,0x726d,0x7270,0x7271,
-0x7273,0x7274,0x7276,0x7277,0x7278,0x727b,0x727c,0x727d,
-0x7282,0x7283,0x7285,0x7286,0x7287,0x7288,0x7289,0x728c,
-0x728e,0x7290,0x7291,0x7293,0x7294,0x7295,0x7296,0x7297,
-0x7298,0x7299,0x729a,0x729b,0x729c,0x729d,0x729e,0x72a0,
-0x72a1,0x72a2,0x72a3,0x72a4,0x72a5,0x72a6,0x72a7,0x72a8,
-0x72a9,0x72aa,0x72ab,0x72ae,0x72b1,0x72b2,0x72b3,0x72b5,
-0x72ba,0x72bb,0x72bc,0x72bd,0x72be,0x72bf,0x72c0,0x72c5,
-0x72c6,0x72c7,0x72c9,0x72ca,0x72cb,0x72cc,0x72cf,0x72d1,
-0x72d3,0x72d4,0x72d5,0x72d6,0x72d8,0x72da,0x72db,0x0000,
-/* 0xa100 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x3000,0x3001,0x3002,0x00b7,0x02c9,0x02c7,0x00a8,
-0x3003,0x3005,0x2014,0xff5e,0x2016,0x2026,0x2018,0x2019,
-0x201c,0x201d,0x3014,0x3015,0x3008,0x3009,0x300a,0x300b,
-0x300c,0x300d,0x300e,0x300f,0x3016,0x3017,0x3010,0x3011,
-0x00b1,0x00d7,0x00f7,0x2236,0x2227,0x2228,0x2211,0x220f,
-0x222a,0x2229,0x2208,0x2237,0x221a,0x22a5,0x2225,0x2220,
-0x2312,0x2299,0x222b,0x222e,0x2261,0x224c,0x2248,0x223d,
-0x221d,0x2260,0x226e,0x226f,0x2264,0x2265,0x221e,0x2235,
-0x2234,0x2642,0x2640,0x00b0,0x2032,0x2033,0x2103,0xff04,
-0x00a4,0xffe0,0xffe1,0x2030,0x00a7,0x2116,0x2606,0x2605,
-0x25cb,0x25cf,0x25ce,0x25c7,0x25c6,0x25a1,0x25a0,0x25b3,
-0x25b2,0x203b,0x2192,0x2190,0x2191,0x2193,0x3013,0x0000,
-/* 0xa200 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,
-0x2177,0x2178,0x2179,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x2488,0x2489,0x248a,0x248b,0x248c,0x248d,0x248e,
-0x248f,0x2490,0x2491,0x2492,0x2493,0x2494,0x2495,0x2496,
-0x2497,0x2498,0x2499,0x249a,0x249b,0x2474,0x2475,0x2476,
-0x2477,0x2478,0x2479,0x247a,0x247b,0x247c,0x247d,0x247e,
-0x247f,0x2480,0x2481,0x2482,0x2483,0x2484,0x2485,0x2486,
-0x2487,0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,
-0x2467,0x2468,0x2469,0x0000,0x0000,0x3220,0x3221,0x3222,
-0x3223,0x3224,0x3225,0x3226,0x3227,0x3228,0x3229,0x0000,
-0x0000,0x2160,0x2161,0x2162,0x2163,0x2164,0x2165,0x2166,
-0x2167,0x2168,0x2169,0x216a,0x216b,0x0000,0x0000,0x0000,
-/* 0xa300 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xff01,0xff02,0xff03,0xffe5,0xff05,0xff06,0xff07,
-0xff08,0xff09,0xff0a,0xff0b,0xff0c,0xff0d,0xff0e,0xff0f,
-0xff10,0xff11,0xff12,0xff13,0xff14,0xff15,0xff16,0xff17,
-0xff18,0xff19,0xff1a,0xff1b,0xff1c,0xff1d,0xff1e,0xff1f,
-0xff20,0xff21,0xff22,0xff23,0xff24,0xff25,0xff26,0xff27,
-0xff28,0xff29,0xff2a,0xff2b,0xff2c,0xff2d,0xff2e,0xff2f,
-0xff30,0xff31,0xff32,0xff33,0xff34,0xff35,0xff36,0xff37,
-0xff38,0xff39,0xff3a,0xff3b,0xff3c,0xff3d,0xff3e,0xff3f,
-0xff40,0xff41,0xff42,0xff43,0xff44,0xff45,0xff46,0xff47,
-0xff48,0xff49,0xff4a,0xff4b,0xff4c,0xff4d,0xff4e,0xff4f,
-0xff50,0xff51,0xff52,0xff53,0xff54,0xff55,0xff56,0xff57,
-0xff58,0xff59,0xff5a,0xff5b,0xff5c,0xff5d,0xffe3,0x0000,
-/* 0xa400 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x3041,0x3042,0x3043,0x3044,0x3045,0x3046,0x3047,
-0x3048,0x3049,0x304a,0x304b,0x304c,0x304d,0x304e,0x304f,
-0x3050,0x3051,0x3052,0x3053,0x3054,0x3055,0x3056,0x3057,
-0x3058,0x3059,0x305a,0x305b,0x305c,0x305d,0x305e,0x305f,
-0x3060,0x3061,0x3062,0x3063,0x3064,0x3065,0x3066,0x3067,
-0x3068,0x3069,0x306a,0x306b,0x306c,0x306d,0x306e,0x306f,
-0x3070,0x3071,0x3072,0x3073,0x3074,0x3075,0x3076,0x3077,
-0x3078,0x3079,0x307a,0x307b,0x307c,0x307d,0x307e,0x307f,
-0x3080,0x3081,0x3082,0x3083,0x3084,0x3085,0x3086,0x3087,
-0x3088,0x3089,0x308a,0x308b,0x308c,0x308d,0x308e,0x308f,
-0x3090,0x3091,0x3092,0x3093,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xa500 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x30a1,0x30a2,0x30a3,0x30a4,0x30a5,0x30a6,0x30a7,
-0x30a8,0x30a9,0x30aa,0x30ab,0x30ac,0x30ad,0x30ae,0x30af,
-0x30b0,0x30b1,0x30b2,0x30b3,0x30b4,0x30b5,0x30b6,0x30b7,
-0x30b8,0x30b9,0x30ba,0x30bb,0x30bc,0x30bd,0x30be,0x30bf,
-0x30c0,0x30c1,0x30c2,0x30c3,0x30c4,0x30c5,0x30c6,0x30c7,
-0x30c8,0x30c9,0x30ca,0x30cb,0x30cc,0x30cd,0x30ce,0x30cf,
-0x30d0,0x30d1,0x30d2,0x30d3,0x30d4,0x30d5,0x30d6,0x30d7,
-0x30d8,0x30d9,0x30da,0x30db,0x30dc,0x30dd,0x30de,0x30df,
-0x30e0,0x30e1,0x30e2,0x30e3,0x30e4,0x30e5,0x30e6,0x30e7,
-0x30e8,0x30e9,0x30ea,0x30eb,0x30ec,0x30ed,0x30ee,0x30ef,
-0x30f0,0x30f1,0x30f2,0x30f3,0x30f4,0x30f5,0x30f6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xa600 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,
-0x0398,0x0399,0x039a,0x039b,0x039c,0x039d,0x039e,0x039f,
-0x03a0,0x03a1,0x03a3,0x03a4,0x03a5,0x03a6,0x03a7,0x03a8,
-0x03a9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x03b1,0x03b2,0x03b3,0x03b4,0x03b5,0x03b6,0x03b7,
-0x03b8,0x03b9,0x03ba,0x03bb,0x03bc,0x03bd,0x03be,0x03bf,
-0x03c0,0x03c1,0x03c3,0x03c4,0x03c5,0x03c6,0x03c7,0x03c8,
-0x03c9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xfe35,0xfe36,0xfe39,0xfe3a,0xfe3f,0xfe40,0xfe3d,0xfe3e,
-0xfe41,0xfe42,0xfe43,0xfe44,0x0000,0x0000,0xfe3b,0xfe3c,
-0xfe37,0xfe38,0xfe31,0x0000,0xfe33,0xfe34,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xa700 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0401,
-0x0416,0x0417,0x0418,0x0419,0x041a,0x041b,0x041c,0x041d,
-0x041e,0x041f,0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,
-0x0426,0x0427,0x0428,0x0429,0x042a,0x042b,0x042c,0x042d,
-0x042e,0x042f,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0451,
-0x0436,0x0437,0x0438,0x0439,0x043a,0x043b,0x043c,0x043d,
-0x043e,0x043f,0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,
-0x0446,0x0447,0x0448,0x0449,0x044a,0x044b,0x044c,0x044d,
-0x044e,0x044f,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xa800 */
-0x02ca,0x02cb,0x02d9,0x2013,0x2015,0x2025,0x2035,0x2105,
-0x2109,0x2196,0x2197,0x2198,0x2199,0x2215,0x221f,0x2223,
-0x2252,0x2266,0x2267,0x22bf,0x2550,0x2551,0x2552,0x2553,
-0x2554,0x2555,0x2556,0x2557,0x2558,0x2559,0x255a,0x255b,
-0x255c,0x255d,0x255e,0x255f,0x2560,0x2561,0x2562,0x2563,
-0x2564,0x2565,0x2566,0x2567,0x2568,0x2569,0x256a,0x256b,
-0x256c,0x256d,0x256e,0x256f,0x2570,0x2571,0x2572,0x2573,
-0x2581,0x2582,0x2583,0x2584,0x2585,0x2586,0x2587,0x0000,
-0x2588,0x2589,0x258a,0x258b,0x258c,0x258d,0x258e,0x258f,
-0x2593,0x2594,0x2595,0x25bc,0x25bd,0x25e2,0x25e3,0x25e4,
-0x25e5,0x2609,0x2295,0x3012,0x301d,0x301e,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0101,0x00e1,0x01ce,0x00e0,0x0113,0x00e9,0x011b,
-0x00e8,0x012b,0x00ed,0x01d0,0x00ec,0x014d,0x00f3,0x01d2,
-0x00f2,0x016b,0x00fa,0x01d4,0x00f9,0x01d6,0x01d8,0x01da,
-0x01dc,0x00fc,0x00ea,0x0251,0x0000,0x0144,0x0148,0x0000,
-0x0261,0x0000,0x0000,0x0000,0x0000,0x3105,0x3106,0x3107,
-0x3108,0x3109,0x310a,0x310b,0x310c,0x310d,0x310e,0x310f,
-0x3110,0x3111,0x3112,0x3113,0x3114,0x3115,0x3116,0x3117,
-0x3118,0x3119,0x311a,0x311b,0x311c,0x311d,0x311e,0x311f,
-0x3120,0x3121,0x3122,0x3123,0x3124,0x3125,0x3126,0x3127,
-0x3128,0x3129,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xa900 */
-0x3021,0x3022,0x3023,0x3024,0x3025,0x3026,0x3027,0x3028,
-0x3029,0x32a3,0x338e,0x338f,0x339c,0x339d,0x339e,0x33a1,
-0x33c4,0x33ce,0x33d1,0x33d2,0x33d5,0xfe30,0xffe2,0xffe4,
-0x0000,0x2121,0x3231,0x0000,0x2010,0x0000,0x0000,0x0000,
-0x30fc,0x309b,0x309c,0x30fd,0x30fe,0x3006,0x309d,0x309e,
-0xfe49,0xfe4a,0xfe4b,0xfe4c,0xfe4d,0xfe4e,0xfe4f,0xfe50,
-0xfe51,0xfe52,0xfe54,0xfe55,0xfe56,0xfe57,0xfe59,0xfe5a,
-0xfe5b,0xfe5c,0xfe5d,0xfe5e,0xfe5f,0xfe60,0xfe61,0x0000,
-0xfe62,0xfe63,0xfe64,0xfe65,0xfe66,0xfe68,0xfe69,0xfe6a,
-0xfe6b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3007,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x2500,0x2501,0x2502,0x2503,
-0x2504,0x2505,0x2506,0x2507,0x2508,0x2509,0x250a,0x250b,
-0x250c,0x250d,0x250e,0x250f,0x2510,0x2511,0x2512,0x2513,
-0x2514,0x2515,0x2516,0x2517,0x2518,0x2519,0x251a,0x251b,
-0x251c,0x251d,0x251e,0x251f,0x2520,0x2521,0x2522,0x2523,
-0x2524,0x2525,0x2526,0x2527,0x2528,0x2529,0x252a,0x252b,
-0x252c,0x252d,0x252e,0x252f,0x2530,0x2531,0x2532,0x2533,
-0x2534,0x2535,0x2536,0x2537,0x2538,0x2539,0x253a,0x253b,
-0x253c,0x253d,0x253e,0x253f,0x2540,0x2541,0x2542,0x2543,
-0x2544,0x2545,0x2546,0x2547,0x2548,0x2549,0x254a,0x254b,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xaa00 */
-0x72dc,0x72dd,0x72df,0x72e2,0x72e3,0x72e4,0x72e5,0x72e6,
-0x72e7,0x72ea,0x72eb,0x72f5,0x72f6,0x72f9,0x72fd,0x72fe,
-0x72ff,0x7300,0x7302,0x7304,0x7305,0x7306,0x7307,0x7308,
-0x7309,0x730b,0x730c,0x730d,0x730f,0x7310,0x7311,0x7312,
-0x7314,0x7318,0x7319,0x731a,0x731f,0x7320,0x7323,0x7324,
-0x7326,0x7327,0x7328,0x732d,0x732f,0x7330,0x7332,0x7333,
-0x7335,0x7336,0x733a,0x733b,0x733c,0x733d,0x7340,0x7341,
-0x7342,0x7343,0x7344,0x7345,0x7346,0x7347,0x7348,0x0000,
-0x7349,0x734a,0x734b,0x734c,0x734e,0x734f,0x7351,0x7353,
-0x7354,0x7355,0x7356,0x7358,0x7359,0x735a,0x735b,0x735c,
-0x735d,0x735e,0x735f,0x7361,0x7362,0x7363,0x7364,0x7365,
-0x7366,0x7367,0x7368,0x7369,0x736a,0x736b,0x736e,0x7370,
-0x7371,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xab00 */
-0x7372,0x7373,0x7374,0x7375,0x7376,0x7377,0x7378,0x7379,
-0x737a,0x737b,0x737c,0x737d,0x737f,0x7380,0x7381,0x7382,
-0x7383,0x7385,0x7386,0x7388,0x738a,0x738c,0x738d,0x738f,
-0x7390,0x7392,0x7393,0x7394,0x7395,0x7397,0x7398,0x7399,
-0x739a,0x739c,0x739d,0x739e,0x73a0,0x73a1,0x73a3,0x73a4,
-0x73a5,0x73a6,0x73a7,0x73a8,0x73aa,0x73ac,0x73ad,0x73b1,
-0x73b4,0x73b5,0x73b6,0x73b8,0x73b9,0x73bc,0x73bd,0x73be,
-0x73bf,0x73c1,0x73c3,0x73c4,0x73c5,0x73c6,0x73c7,0x0000,
-0x73cb,0x73cc,0x73ce,0x73d2,0x73d3,0x73d4,0x73d5,0x73d6,
-0x73d7,0x73d8,0x73da,0x73db,0x73dc,0x73dd,0x73df,0x73e1,
-0x73e2,0x73e3,0x73e4,0x73e6,0x73e8,0x73ea,0x73eb,0x73ec,
-0x73ee,0x73ef,0x73f0,0x73f1,0x73f3,0x73f4,0x73f5,0x73f6,
-0x73f7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xac00 */
-0x73f8,0x73f9,0x73fa,0x73fb,0x73fc,0x73fd,0x73fe,0x73ff,
-0x7400,0x7401,0x7402,0x7404,0x7407,0x7408,0x740b,0x740c,
-0x740d,0x740e,0x7411,0x7412,0x7413,0x7414,0x7415,0x7416,
-0x7417,0x7418,0x7419,0x741c,0x741d,0x741e,0x741f,0x7420,
-0x7421,0x7423,0x7424,0x7427,0x7429,0x742b,0x742d,0x742f,
-0x7431,0x7432,0x7437,0x7438,0x7439,0x743a,0x743b,0x743d,
-0x743e,0x743f,0x7440,0x7442,0x7443,0x7444,0x7445,0x7446,
-0x7447,0x7448,0x7449,0x744a,0x744b,0x744c,0x744d,0x0000,
-0x744e,0x744f,0x7450,0x7451,0x7452,0x7453,0x7454,0x7456,
-0x7458,0x745d,0x7460,0x7461,0x7462,0x7463,0x7464,0x7465,
-0x7466,0x7467,0x7468,0x7469,0x746a,0x746b,0x746c,0x746e,
-0x746f,0x7471,0x7472,0x7473,0x7474,0x7475,0x7478,0x7479,
-0x747a,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xad00 */
-0x747b,0x747c,0x747d,0x747f,0x7482,0x7484,0x7485,0x7486,
-0x7488,0x7489,0x748a,0x748c,0x748d,0x748f,0x7491,0x7492,
-0x7493,0x7494,0x7495,0x7496,0x7497,0x7498,0x7499,0x749a,
-0x749b,0x749d,0x749f,0x74a0,0x74a1,0x74a2,0x74a3,0x74a4,
-0x74a5,0x74a6,0x74aa,0x74ab,0x74ac,0x74ad,0x74ae,0x74af,
-0x74b0,0x74b1,0x74b2,0x74b3,0x74b4,0x74b5,0x74b6,0x74b7,
-0x74b8,0x74b9,0x74bb,0x74bc,0x74bd,0x74be,0x74bf,0x74c0,
-0x74c1,0x74c2,0x74c3,0x74c4,0x74c5,0x74c6,0x74c7,0x0000,
-0x74c8,0x74c9,0x74ca,0x74cb,0x74cc,0x74cd,0x74ce,0x74cf,
-0x74d0,0x74d1,0x74d3,0x74d4,0x74d5,0x74d6,0x74d7,0x74d8,
-0x74d9,0x74da,0x74db,0x74dd,0x74df,0x74e1,0x74e5,0x74e7,
-0x74e8,0x74e9,0x74ea,0x74eb,0x74ec,0x74ed,0x74f0,0x74f1,
-0x74f2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xae00 */
-0x74f3,0x74f5,0x74f8,0x74f9,0x74fa,0x74fb,0x74fc,0x74fd,
-0x74fe,0x7500,0x7501,0x7502,0x7503,0x7505,0x7506,0x7507,
-0x7508,0x7509,0x750a,0x750b,0x750c,0x750e,0x7510,0x7512,
-0x7514,0x7515,0x7516,0x7517,0x751b,0x751d,0x751e,0x7520,
-0x7521,0x7522,0x7523,0x7524,0x7526,0x7527,0x752a,0x752e,
-0x7534,0x7536,0x7539,0x753c,0x753d,0x753f,0x7541,0x7542,
-0x7543,0x7544,0x7546,0x7547,0x7549,0x754a,0x754d,0x7550,
-0x7551,0x7552,0x7553,0x7555,0x7556,0x7557,0x7558,0x0000,
-0x755d,0x755e,0x755f,0x7560,0x7561,0x7562,0x7563,0x7564,
-0x7567,0x7568,0x7569,0x756b,0x756c,0x756d,0x756e,0x756f,
-0x7570,0x7571,0x7573,0x7575,0x7576,0x7577,0x757a,0x757b,
-0x757c,0x757d,0x757e,0x7580,0x7581,0x7582,0x7584,0x7585,
-0x7587,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xaf00 */
-0x7588,0x7589,0x758a,0x758c,0x758d,0x758e,0x7590,0x7593,
-0x7595,0x7598,0x759b,0x759c,0x759e,0x75a2,0x75a6,0x75a7,
-0x75a8,0x75a9,0x75aa,0x75ad,0x75b6,0x75b7,0x75ba,0x75bb,
-0x75bf,0x75c0,0x75c1,0x75c6,0x75cb,0x75cc,0x75ce,0x75cf,
-0x75d0,0x75d1,0x75d3,0x75d7,0x75d9,0x75da,0x75dc,0x75dd,
-0x75df,0x75e0,0x75e1,0x75e5,0x75e9,0x75ec,0x75ed,0x75ee,
-0x75ef,0x75f2,0x75f3,0x75f5,0x75f6,0x75f7,0x75f8,0x75fa,
-0x75fb,0x75fd,0x75fe,0x7602,0x7604,0x7606,0x7607,0x0000,
-0x7608,0x7609,0x760b,0x760d,0x760e,0x760f,0x7611,0x7612,
-0x7613,0x7614,0x7616,0x761a,0x761c,0x761d,0x761e,0x7621,
-0x7623,0x7627,0x7628,0x762c,0x762e,0x762f,0x7631,0x7632,
-0x7636,0x7637,0x7639,0x763a,0x763b,0x763d,0x7641,0x7642,
-0x7644,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xb000 */
-0x7645,0x7646,0x7647,0x7648,0x7649,0x764a,0x764b,0x764e,
-0x764f,0x7650,0x7651,0x7652,0x7653,0x7655,0x7657,0x7658,
-0x7659,0x765a,0x765b,0x765d,0x765f,0x7660,0x7661,0x7662,
-0x7664,0x7665,0x7666,0x7667,0x7668,0x7669,0x766a,0x766c,
-0x766d,0x766e,0x7670,0x7671,0x7672,0x7673,0x7674,0x7675,
-0x7676,0x7677,0x7679,0x767a,0x767c,0x767f,0x7680,0x7681,
-0x7683,0x7685,0x7689,0x768a,0x768c,0x768d,0x768f,0x7690,
-0x7692,0x7694,0x7695,0x7697,0x7698,0x769a,0x769b,0x0000,
-0x769c,0x769d,0x769e,0x769f,0x76a0,0x76a1,0x76a2,0x76a3,
-0x76a5,0x76a6,0x76a7,0x76a8,0x76a9,0x76aa,0x76ab,0x76ac,
-0x76ad,0x76af,0x76b0,0x76b3,0x76b5,0x76b6,0x76b7,0x76b8,
-0x76b9,0x76ba,0x76bb,0x76bc,0x76bd,0x76be,0x76c0,0x76c1,
-0x76c3,0x554a,0x963f,0x57c3,0x6328,0x54ce,0x5509,0x54c0,
-0x7691,0x764c,0x853c,0x77ee,0x827e,0x788d,0x7231,0x9698,
-0x978d,0x6c28,0x5b89,0x4ffa,0x6309,0x6697,0x5cb8,0x80fa,
-0x6848,0x80ae,0x6602,0x76ce,0x51f9,0x6556,0x71ac,0x7ff1,
-0x8884,0x50b2,0x5965,0x61ca,0x6fb3,0x82ad,0x634c,0x6252,
-0x53ed,0x5427,0x7b06,0x516b,0x75a4,0x5df4,0x62d4,0x8dcb,
-0x9776,0x628a,0x8019,0x575d,0x9738,0x7f62,0x7238,0x767d,
-0x67cf,0x767e,0x6446,0x4f70,0x8d25,0x62dc,0x7a17,0x6591,
-0x73ed,0x642c,0x6273,0x822c,0x9881,0x677f,0x7248,0x626e,
-0x62cc,0x4f34,0x74e3,0x534a,0x529e,0x7eca,0x90a6,0x5e2e,
-0x6886,0x699c,0x8180,0x7ed1,0x68d2,0x78c5,0x868c,0x9551,
-0x508d,0x8c24,0x82de,0x80de,0x5305,0x8912,0x5265,0x0000,
-/* 0xb100 */
-0x76c4,0x76c7,0x76c9,0x76cb,0x76cc,0x76d3,0x76d5,0x76d9,
-0x76da,0x76dc,0x76dd,0x76de,0x76e0,0x76e1,0x76e2,0x76e3,
-0x76e4,0x76e6,0x76e7,0x76e8,0x76e9,0x76ea,0x76eb,0x76ec,
-0x76ed,0x76f0,0x76f3,0x76f5,0x76f6,0x76f7,0x76fa,0x76fb,
-0x76fd,0x76ff,0x7700,0x7702,0x7703,0x7705,0x7706,0x770a,
-0x770c,0x770e,0x770f,0x7710,0x7711,0x7712,0x7713,0x7714,
-0x7715,0x7716,0x7717,0x7718,0x771b,0x771c,0x771d,0x771e,
-0x7721,0x7723,0x7724,0x7725,0x7727,0x772a,0x772b,0x0000,
-0x772c,0x772e,0x7730,0x7731,0x7732,0x7733,0x7734,0x7739,
-0x773b,0x773d,0x773e,0x773f,0x7742,0x7744,0x7745,0x7746,
-0x7748,0x7749,0x774a,0x774b,0x774c,0x774d,0x774e,0x774f,
-0x7752,0x7753,0x7754,0x7755,0x7756,0x7757,0x7758,0x7759,
-0x775c,0x8584,0x96f9,0x4fdd,0x5821,0x9971,0x5b9d,0x62b1,
-0x62a5,0x66b4,0x8c79,0x9c8d,0x7206,0x676f,0x7891,0x60b2,
-0x5351,0x5317,0x8f88,0x80cc,0x8d1d,0x94a1,0x500d,0x72c8,
-0x5907,0x60eb,0x7119,0x88ab,0x5954,0x82ef,0x672c,0x7b28,
-0x5d29,0x7ef7,0x752d,0x6cf5,0x8e66,0x8ff8,0x903c,0x9f3b,
-0x6bd4,0x9119,0x7b14,0x5f7c,0x78a7,0x84d6,0x853d,0x6bd5,
-0x6bd9,0x6bd6,0x5e01,0x5e87,0x75f9,0x95ed,0x655d,0x5f0a,
-0x5fc5,0x8f9f,0x58c1,0x81c2,0x907f,0x965b,0x97ad,0x8fb9,
-0x7f16,0x8d2c,0x6241,0x4fbf,0x53d8,0x535e,0x8fa8,0x8fa9,
-0x8fab,0x904d,0x6807,0x5f6a,0x8198,0x8868,0x9cd6,0x618b,
-0x522b,0x762a,0x5f6c,0x658c,0x6fd2,0x6ee8,0x5bbe,0x6448,
-0x5175,0x51b0,0x67c4,0x4e19,0x79c9,0x997c,0x70b3,0x0000,
-/* 0xb200 */
-0x775d,0x775e,0x775f,0x7760,0x7764,0x7767,0x7769,0x776a,
-0x776d,0x776e,0x776f,0x7770,0x7771,0x7772,0x7773,0x7774,
-0x7775,0x7776,0x7777,0x7778,0x777a,0x777b,0x777c,0x7781,
-0x7782,0x7783,0x7786,0x7787,0x7788,0x7789,0x778a,0x778b,
-0x778f,0x7790,0x7793,0x7794,0x7795,0x7796,0x7797,0x7798,
-0x7799,0x779a,0x779b,0x779c,0x779d,0x779e,0x77a1,0x77a3,
-0x77a4,0x77a6,0x77a8,0x77ab,0x77ad,0x77ae,0x77af,0x77b1,
-0x77b2,0x77b4,0x77b6,0x77b7,0x77b8,0x77b9,0x77ba,0x0000,
-0x77bc,0x77be,0x77c0,0x77c1,0x77c2,0x77c3,0x77c4,0x77c5,
-0x77c6,0x77c7,0x77c8,0x77c9,0x77ca,0x77cb,0x77cc,0x77ce,
-0x77cf,0x77d0,0x77d1,0x77d2,0x77d3,0x77d4,0x77d5,0x77d6,
-0x77d8,0x77d9,0x77da,0x77dd,0x77de,0x77df,0x77e0,0x77e1,
-0x77e4,0x75c5,0x5e76,0x73bb,0x83e0,0x64ad,0x62e8,0x94b5,
-0x6ce2,0x535a,0x52c3,0x640f,0x94c2,0x7b94,0x4f2f,0x5e1b,
-0x8236,0x8116,0x818a,0x6e24,0x6cca,0x9a73,0x6355,0x535c,
-0x54fa,0x8865,0x57e0,0x4e0d,0x5e03,0x6b65,0x7c3f,0x90e8,
-0x6016,0x64e6,0x731c,0x88c1,0x6750,0x624d,0x8d22,0x776c,
-0x8e29,0x91c7,0x5f69,0x83dc,0x8521,0x9910,0x53c2,0x8695,
-0x6b8b,0x60ed,0x60e8,0x707f,0x82cd,0x8231,0x4ed3,0x6ca7,
-0x85cf,0x64cd,0x7cd9,0x69fd,0x66f9,0x8349,0x5395,0x7b56,
-0x4fa7,0x518c,0x6d4b,0x5c42,0x8e6d,0x63d2,0x53c9,0x832c,
-0x8336,0x67e5,0x78b4,0x643d,0x5bdf,0x5c94,0x5dee,0x8be7,
-0x62c6,0x67f4,0x8c7a,0x6400,0x63ba,0x8749,0x998b,0x8c17,
-0x7f20,0x94f2,0x4ea7,0x9610,0x98a4,0x660c,0x7316,0x0000,
-/* 0xb300 */
-0x77e6,0x77e8,0x77ea,0x77ef,0x77f0,0x77f1,0x77f2,0x77f4,
-0x77f5,0x77f7,0x77f9,0x77fa,0x77fb,0x77fc,0x7803,0x7804,
-0x7805,0x7806,0x7807,0x7808,0x780a,0x780b,0x780e,0x780f,
-0x7810,0x7813,0x7815,0x7819,0x781b,0x781e,0x7820,0x7821,
-0x7822,0x7824,0x7828,0x782a,0x782b,0x782e,0x782f,0x7831,
-0x7832,0x7833,0x7835,0x7836,0x783d,0x783f,0x7841,0x7842,
-0x7843,0x7844,0x7846,0x7848,0x7849,0x784a,0x784b,0x784d,
-0x784f,0x7851,0x7853,0x7854,0x7858,0x7859,0x785a,0x0000,
-0x785b,0x785c,0x785e,0x785f,0x7860,0x7861,0x7862,0x7863,
-0x7864,0x7865,0x7866,0x7867,0x7868,0x7869,0x786f,0x7870,
-0x7871,0x7872,0x7873,0x7874,0x7875,0x7876,0x7878,0x7879,
-0x787a,0x787b,0x787d,0x787e,0x787f,0x7880,0x7881,0x7882,
-0x7883,0x573a,0x5c1d,0x5e38,0x957f,0x507f,0x80a0,0x5382,
-0x655e,0x7545,0x5531,0x5021,0x8d85,0x6284,0x949e,0x671d,
-0x5632,0x6f6e,0x5de2,0x5435,0x7092,0x8f66,0x626f,0x64a4,
-0x63a3,0x5f7b,0x6f88,0x90f4,0x81e3,0x8fb0,0x5c18,0x6668,
-0x5ff1,0x6c89,0x9648,0x8d81,0x886c,0x6491,0x79f0,0x57ce,
-0x6a59,0x6210,0x5448,0x4e58,0x7a0b,0x60e9,0x6f84,0x8bda,
-0x627f,0x901e,0x9a8b,0x79e4,0x5403,0x75f4,0x6301,0x5319,
-0x6c60,0x8fdf,0x5f1b,0x9a70,0x803b,0x9f7f,0x4f88,0x5c3a,
-0x8d64,0x7fc5,0x65a5,0x70bd,0x5145,0x51b2,0x866b,0x5d07,
-0x5ba0,0x62bd,0x916c,0x7574,0x8e0c,0x7a20,0x6101,0x7b79,
-0x4ec7,0x7ef8,0x7785,0x4e11,0x81ed,0x521d,0x51fa,0x6a71,
-0x53a8,0x8e87,0x9504,0x96cf,0x6ec1,0x9664,0x695a,0x0000,
-/* 0xb400 */
-0x7884,0x7885,0x7886,0x7888,0x788a,0x788b,0x788f,0x7890,
-0x7892,0x7894,0x7895,0x7896,0x7899,0x789d,0x789e,0x78a0,
-0x78a2,0x78a4,0x78a6,0x78a8,0x78a9,0x78aa,0x78ab,0x78ac,
-0x78ad,0x78ae,0x78af,0x78b5,0x78b6,0x78b7,0x78b8,0x78ba,
-0x78bb,0x78bc,0x78bd,0x78bf,0x78c0,0x78c2,0x78c3,0x78c4,
-0x78c6,0x78c7,0x78c8,0x78cc,0x78cd,0x78ce,0x78cf,0x78d1,
-0x78d2,0x78d3,0x78d6,0x78d7,0x78d8,0x78da,0x78db,0x78dc,
-0x78dd,0x78de,0x78df,0x78e0,0x78e1,0x78e2,0x78e3,0x0000,
-0x78e4,0x78e5,0x78e6,0x78e7,0x78e9,0x78ea,0x78eb,0x78ed,
-0x78ee,0x78ef,0x78f0,0x78f1,0x78f3,0x78f5,0x78f6,0x78f8,
-0x78f9,0x78fb,0x78fc,0x78fd,0x78fe,0x78ff,0x7900,0x7902,
-0x7903,0x7904,0x7906,0x7907,0x7908,0x7909,0x790a,0x790b,
-0x790c,0x7840,0x50a8,0x77d7,0x6410,0x89e6,0x5904,0x63e3,
-0x5ddd,0x7a7f,0x693d,0x4f20,0x8239,0x5598,0x4e32,0x75ae,
-0x7a97,0x5e62,0x5e8a,0x95ef,0x521b,0x5439,0x708a,0x6376,
-0x9524,0x5782,0x6625,0x693f,0x9187,0x5507,0x6df3,0x7eaf,
-0x8822,0x6233,0x7ef0,0x75b5,0x8328,0x78c1,0x96cc,0x8f9e,
-0x6148,0x74f7,0x8bcd,0x6b64,0x523a,0x8d50,0x6b21,0x806a,
-0x8471,0x56f1,0x5306,0x4ece,0x4e1b,0x51d1,0x7c97,0x918b,
-0x7c07,0x4fc3,0x8e7f,0x7be1,0x7a9c,0x6467,0x5d14,0x50ac,
-0x8106,0x7601,0x7cb9,0x6dec,0x7fe0,0x6751,0x5b58,0x5bf8,
-0x78cb,0x64ae,0x6413,0x63aa,0x632b,0x9519,0x642d,0x8fbe,
-0x7b54,0x7629,0x6253,0x5927,0x5446,0x6b79,0x50a3,0x6234,
-0x5e26,0x6b86,0x4ee3,0x8d37,0x888b,0x5f85,0x902e,0x0000,
-/* 0xb500 */
-0x790d,0x790e,0x790f,0x7910,0x7911,0x7912,0x7914,0x7915,
-0x7916,0x7917,0x7918,0x7919,0x791a,0x791b,0x791c,0x791d,
-0x791f,0x7920,0x7921,0x7922,0x7923,0x7925,0x7926,0x7927,
-0x7928,0x7929,0x792a,0x792b,0x792c,0x792d,0x792e,0x792f,
-0x7930,0x7931,0x7932,0x7933,0x7935,0x7936,0x7937,0x7938,
-0x7939,0x793d,0x793f,0x7942,0x7943,0x7944,0x7945,0x7947,
-0x794a,0x794b,0x794c,0x794d,0x794e,0x794f,0x7950,0x7951,
-0x7952,0x7954,0x7955,0x7958,0x7959,0x7961,0x7963,0x0000,
-0x7964,0x7966,0x7969,0x796a,0x796b,0x796c,0x796e,0x7970,
-0x7971,0x7972,0x7973,0x7974,0x7975,0x7976,0x7979,0x797b,
-0x797c,0x797d,0x797e,0x797f,0x7982,0x7983,0x7986,0x7987,
-0x7988,0x7989,0x798b,0x798c,0x798d,0x798e,0x7990,0x7991,
-0x7992,0x6020,0x803d,0x62c5,0x4e39,0x5355,0x90f8,0x63b8,
-0x80c6,0x65e6,0x6c2e,0x4f46,0x60ee,0x6de1,0x8bde,0x5f39,
-0x86cb,0x5f53,0x6321,0x515a,0x8361,0x6863,0x5200,0x6363,
-0x8e48,0x5012,0x5c9b,0x7977,0x5bfc,0x5230,0x7a3b,0x60bc,
-0x9053,0x76d7,0x5fb7,0x5f97,0x7684,0x8e6c,0x706f,0x767b,
-0x7b49,0x77aa,0x51f3,0x9093,0x5824,0x4f4e,0x6ef4,0x8fea,
-0x654c,0x7b1b,0x72c4,0x6da4,0x7fdf,0x5ae1,0x62b5,0x5e95,
-0x5730,0x8482,0x7b2c,0x5e1d,0x5f1f,0x9012,0x7f14,0x98a0,
-0x6382,0x6ec7,0x7898,0x70b9,0x5178,0x975b,0x57ab,0x7535,
-0x4f43,0x7538,0x5e97,0x60e6,0x5960,0x6dc0,0x6bbf,0x7889,
-0x53fc,0x96d5,0x51cb,0x5201,0x6389,0x540a,0x9493,0x8c03,
-0x8dcc,0x7239,0x789f,0x8776,0x8fed,0x8c0d,0x53e0,0x0000,
-/* 0xb600 */
-0x7993,0x7994,0x7995,0x7996,0x7997,0x7998,0x7999,0x799b,
-0x799c,0x799d,0x799e,0x799f,0x79a0,0x79a1,0x79a2,0x79a3,
-0x79a4,0x79a5,0x79a6,0x79a8,0x79a9,0x79aa,0x79ab,0x79ac,
-0x79ad,0x79ae,0x79af,0x79b0,0x79b1,0x79b2,0x79b4,0x79b5,
-0x79b6,0x79b7,0x79b8,0x79bc,0x79bf,0x79c2,0x79c4,0x79c5,
-0x79c7,0x79c8,0x79ca,0x79cc,0x79ce,0x79cf,0x79d0,0x79d3,
-0x79d4,0x79d6,0x79d7,0x79d9,0x79da,0x79db,0x79dc,0x79dd,
-0x79de,0x79e0,0x79e1,0x79e2,0x79e5,0x79e8,0x79ea,0x0000,
-0x79ec,0x79ee,0x79f1,0x79f2,0x79f3,0x79f4,0x79f5,0x79f6,
-0x79f7,0x79f9,0x79fa,0x79fc,0x79fe,0x79ff,0x7a01,0x7a04,
-0x7a05,0x7a07,0x7a08,0x7a09,0x7a0a,0x7a0c,0x7a0f,0x7a10,
-0x7a11,0x7a12,0x7a13,0x7a15,0x7a16,0x7a18,0x7a19,0x7a1b,
-0x7a1c,0x4e01,0x76ef,0x53ee,0x9489,0x9876,0x9f0e,0x952d,
-0x5b9a,0x8ba2,0x4e22,0x4e1c,0x51ac,0x8463,0x61c2,0x52a8,
-0x680b,0x4f97,0x606b,0x51bb,0x6d1e,0x515c,0x6296,0x6597,
-0x9661,0x8c46,0x9017,0x75d8,0x90fd,0x7763,0x6bd2,0x728a,
-0x72ec,0x8bfb,0x5835,0x7779,0x8d4c,0x675c,0x9540,0x809a,
-0x5ea6,0x6e21,0x5992,0x7aef,0x77ed,0x953b,0x6bb5,0x65ad,
-0x7f0e,0x5806,0x5151,0x961f,0x5bf9,0x58a9,0x5428,0x8e72,
-0x6566,0x987f,0x56e4,0x949d,0x76fe,0x9041,0x6387,0x54c6,
-0x591a,0x593a,0x579b,0x8eb2,0x6735,0x8dfa,0x8235,0x5241,
-0x60f0,0x5815,0x86fe,0x5ce8,0x9e45,0x4fc4,0x989d,0x8bb9,
-0x5a25,0x6076,0x5384,0x627c,0x904f,0x9102,0x997f,0x6069,
-0x800c,0x513f,0x8033,0x5c14,0x9975,0x6d31,0x4e8c,0x0000,
-/* 0xb700 */
-0x7a1d,0x7a1f,0x7a21,0x7a22,0x7a24,0x7a25,0x7a26,0x7a27,
-0x7a28,0x7a29,0x7a2a,0x7a2b,0x7a2c,0x7a2d,0x7a2e,0x7a2f,
-0x7a30,0x7a31,0x7a32,0x7a34,0x7a35,0x7a36,0x7a38,0x7a3a,
-0x7a3e,0x7a40,0x7a41,0x7a42,0x7a43,0x7a44,0x7a45,0x7a47,
-0x7a48,0x7a49,0x7a4a,0x7a4b,0x7a4c,0x7a4d,0x7a4e,0x7a4f,
-0x7a50,0x7a52,0x7a53,0x7a54,0x7a55,0x7a56,0x7a58,0x7a59,
-0x7a5a,0x7a5b,0x7a5c,0x7a5d,0x7a5e,0x7a5f,0x7a60,0x7a61,
-0x7a62,0x7a63,0x7a64,0x7a65,0x7a66,0x7a67,0x7a68,0x0000,
-0x7a69,0x7a6a,0x7a6b,0x7a6c,0x7a6d,0x7a6e,0x7a6f,0x7a71,
-0x7a72,0x7a73,0x7a75,0x7a7b,0x7a7c,0x7a7d,0x7a7e,0x7a82,
-0x7a85,0x7a87,0x7a89,0x7a8a,0x7a8b,0x7a8c,0x7a8e,0x7a8f,
-0x7a90,0x7a93,0x7a94,0x7a99,0x7a9a,0x7a9b,0x7a9e,0x7aa1,
-0x7aa2,0x8d30,0x53d1,0x7f5a,0x7b4f,0x4f10,0x4e4f,0x9600,
-0x6cd5,0x73d0,0x85e9,0x5e06,0x756a,0x7ffb,0x6a0a,0x77fe,
-0x9492,0x7e41,0x51e1,0x70e6,0x53cd,0x8fd4,0x8303,0x8d29,
-0x72af,0x996d,0x6cdb,0x574a,0x82b3,0x65b9,0x80aa,0x623f,
-0x9632,0x59a8,0x4eff,0x8bbf,0x7eba,0x653e,0x83f2,0x975e,
-0x5561,0x98de,0x80a5,0x532a,0x8bfd,0x5420,0x80ba,0x5e9f,
-0x6cb8,0x8d39,0x82ac,0x915a,0x5429,0x6c1b,0x5206,0x7eb7,
-0x575f,0x711a,0x6c7e,0x7c89,0x594b,0x4efd,0x5fff,0x6124,
-0x7caa,0x4e30,0x5c01,0x67ab,0x8702,0x5cf0,0x950b,0x98ce,
-0x75af,0x70fd,0x9022,0x51af,0x7f1d,0x8bbd,0x5949,0x51e4,
-0x4f5b,0x5426,0x592b,0x6577,0x80a4,0x5b75,0x6276,0x62c2,
-0x8f90,0x5e45,0x6c1f,0x7b26,0x4f0f,0x4fd8,0x670d,0x0000,
-/* 0xb800 */
-0x7aa3,0x7aa4,0x7aa7,0x7aa9,0x7aaa,0x7aab,0x7aae,0x7aaf,
-0x7ab0,0x7ab1,0x7ab2,0x7ab4,0x7ab5,0x7ab6,0x7ab7,0x7ab8,
-0x7ab9,0x7aba,0x7abb,0x7abc,0x7abd,0x7abe,0x7ac0,0x7ac1,
-0x7ac2,0x7ac3,0x7ac4,0x7ac5,0x7ac6,0x7ac7,0x7ac8,0x7ac9,
-0x7aca,0x7acc,0x7acd,0x7ace,0x7acf,0x7ad0,0x7ad1,0x7ad2,
-0x7ad3,0x7ad4,0x7ad5,0x7ad7,0x7ad8,0x7ada,0x7adb,0x7adc,
-0x7add,0x7ae1,0x7ae2,0x7ae4,0x7ae7,0x7ae8,0x7ae9,0x7aea,
-0x7aeb,0x7aec,0x7aee,0x7af0,0x7af1,0x7af2,0x7af3,0x0000,
-0x7af4,0x7af5,0x7af6,0x7af7,0x7af8,0x7afb,0x7afc,0x7afe,
-0x7b00,0x7b01,0x7b02,0x7b05,0x7b07,0x7b09,0x7b0c,0x7b0d,
-0x7b0e,0x7b10,0x7b12,0x7b13,0x7b16,0x7b17,0x7b18,0x7b1a,
-0x7b1c,0x7b1d,0x7b1f,0x7b21,0x7b22,0x7b23,0x7b27,0x7b29,
-0x7b2d,0x6d6e,0x6daa,0x798f,0x88b1,0x5f17,0x752b,0x629a,
-0x8f85,0x4fef,0x91dc,0x65a7,0x812f,0x8151,0x5e9c,0x8150,
-0x8d74,0x526f,0x8986,0x8d4b,0x590d,0x5085,0x4ed8,0x961c,
-0x7236,0x8179,0x8d1f,0x5bcc,0x8ba3,0x9644,0x5987,0x7f1a,
-0x5490,0x5676,0x560e,0x8be5,0x6539,0x6982,0x9499,0x76d6,
-0x6e89,0x5e72,0x7518,0x6746,0x67d1,0x7aff,0x809d,0x8d76,
-0x611f,0x79c6,0x6562,0x8d63,0x5188,0x521a,0x94a2,0x7f38,
-0x809b,0x7eb2,0x5c97,0x6e2f,0x6760,0x7bd9,0x768b,0x9ad8,
-0x818f,0x7f94,0x7cd5,0x641e,0x9550,0x7a3f,0x544a,0x54e5,
-0x6b4c,0x6401,0x6208,0x9e3d,0x80f3,0x7599,0x5272,0x9769,
-0x845b,0x683c,0x86e4,0x9601,0x9694,0x94ec,0x4e2a,0x5404,
-0x7ed9,0x6839,0x8ddf,0x8015,0x66f4,0x5e9a,0x7fb9,0x0000,
-/* 0xb900 */
-0x7b2f,0x7b30,0x7b32,0x7b34,0x7b35,0x7b36,0x7b37,0x7b39,
-0x7b3b,0x7b3d,0x7b3f,0x7b40,0x7b41,0x7b42,0x7b43,0x7b44,
-0x7b46,0x7b48,0x7b4a,0x7b4d,0x7b4e,0x7b53,0x7b55,0x7b57,
-0x7b59,0x7b5c,0x7b5e,0x7b5f,0x7b61,0x7b63,0x7b64,0x7b65,
-0x7b66,0x7b67,0x7b68,0x7b69,0x7b6a,0x7b6b,0x7b6c,0x7b6d,
-0x7b6f,0x7b70,0x7b73,0x7b74,0x7b76,0x7b78,0x7b7a,0x7b7c,
-0x7b7d,0x7b7f,0x7b81,0x7b82,0x7b83,0x7b84,0x7b86,0x7b87,
-0x7b88,0x7b89,0x7b8a,0x7b8b,0x7b8c,0x7b8e,0x7b8f,0x0000,
-0x7b91,0x7b92,0x7b93,0x7b96,0x7b98,0x7b99,0x7b9a,0x7b9b,
-0x7b9e,0x7b9f,0x7ba0,0x7ba3,0x7ba4,0x7ba5,0x7bae,0x7baf,
-0x7bb0,0x7bb2,0x7bb3,0x7bb5,0x7bb6,0x7bb7,0x7bb9,0x7bba,
-0x7bbb,0x7bbc,0x7bbd,0x7bbe,0x7bbf,0x7bc0,0x7bc2,0x7bc3,
-0x7bc4,0x57c2,0x803f,0x6897,0x5de5,0x653b,0x529f,0x606d,
-0x9f9a,0x4f9b,0x8eac,0x516c,0x5bab,0x5f13,0x5de9,0x6c5e,
-0x62f1,0x8d21,0x5171,0x94a9,0x52fe,0x6c9f,0x82df,0x72d7,
-0x57a2,0x6784,0x8d2d,0x591f,0x8f9c,0x83c7,0x5495,0x7b8d,
-0x4f30,0x6cbd,0x5b64,0x59d1,0x9f13,0x53e4,0x86ca,0x9aa8,
-0x8c37,0x80a1,0x6545,0x987e,0x56fa,0x96c7,0x522e,0x74dc,
-0x5250,0x5be1,0x6302,0x8902,0x4e56,0x62d0,0x602a,0x68fa,
-0x5173,0x5b98,0x51a0,0x89c2,0x7ba1,0x9986,0x7f50,0x60ef,
-0x704c,0x8d2f,0x5149,0x5e7f,0x901b,0x7470,0x89c4,0x572d,
-0x7845,0x5f52,0x9f9f,0x95fa,0x8f68,0x9b3c,0x8be1,0x7678,
-0x6842,0x67dc,0x8dea,0x8d35,0x523d,0x8f8a,0x6eda,0x68cd,
-0x9505,0x90ed,0x56fd,0x679c,0x88f9,0x8fc7,0x54c8,0x0000,
-/* 0xba00 */
-0x7bc5,0x7bc8,0x7bc9,0x7bca,0x7bcb,0x7bcd,0x7bce,0x7bcf,
-0x7bd0,0x7bd2,0x7bd4,0x7bd5,0x7bd6,0x7bd7,0x7bd8,0x7bdb,
-0x7bdc,0x7bde,0x7bdf,0x7be0,0x7be2,0x7be3,0x7be4,0x7be7,
-0x7be8,0x7be9,0x7beb,0x7bec,0x7bed,0x7bef,0x7bf0,0x7bf2,
-0x7bf3,0x7bf4,0x7bf5,0x7bf6,0x7bf8,0x7bf9,0x7bfa,0x7bfb,
-0x7bfd,0x7bff,0x7c00,0x7c01,0x7c02,0x7c03,0x7c04,0x7c05,
-0x7c06,0x7c08,0x7c09,0x7c0a,0x7c0d,0x7c0e,0x7c10,0x7c11,
-0x7c12,0x7c13,0x7c14,0x7c15,0x7c17,0x7c18,0x7c19,0x0000,
-0x7c1a,0x7c1b,0x7c1c,0x7c1d,0x7c1e,0x7c20,0x7c21,0x7c22,
-0x7c23,0x7c24,0x7c25,0x7c28,0x7c29,0x7c2b,0x7c2c,0x7c2d,
-0x7c2e,0x7c2f,0x7c30,0x7c31,0x7c32,0x7c33,0x7c34,0x7c35,
-0x7c36,0x7c37,0x7c39,0x7c3a,0x7c3b,0x7c3c,0x7c3d,0x7c3e,
-0x7c42,0x9ab8,0x5b69,0x6d77,0x6c26,0x4ea5,0x5bb3,0x9a87,
-0x9163,0x61a8,0x90af,0x97e9,0x542b,0x6db5,0x5bd2,0x51fd,
-0x558a,0x7f55,0x7ff0,0x64bc,0x634d,0x65f1,0x61be,0x608d,
-0x710a,0x6c57,0x6c49,0x592f,0x676d,0x822a,0x58d5,0x568e,
-0x8c6a,0x6beb,0x90dd,0x597d,0x8017,0x53f7,0x6d69,0x5475,
-0x559d,0x8377,0x83cf,0x6838,0x79be,0x548c,0x4f55,0x5408,
-0x76d2,0x8c89,0x9602,0x6cb3,0x6db8,0x8d6b,0x8910,0x9e64,
-0x8d3a,0x563f,0x9ed1,0x75d5,0x5f88,0x72e0,0x6068,0x54fc,
-0x4ea8,0x6a2a,0x8861,0x6052,0x8f70,0x54c4,0x70d8,0x8679,
-0x9e3f,0x6d2a,0x5b8f,0x5f18,0x7ea2,0x5589,0x4faf,0x7334,
-0x543c,0x539a,0x5019,0x540e,0x547c,0x4e4e,0x5ffd,0x745a,
-0x58f6,0x846b,0x80e1,0x8774,0x72d0,0x7cca,0x6e56,0x0000,
-/* 0xbb00 */
-0x7c43,0x7c44,0x7c45,0x7c46,0x7c47,0x7c48,0x7c49,0x7c4a,
-0x7c4b,0x7c4c,0x7c4e,0x7c4f,0x7c50,0x7c51,0x7c52,0x7c53,
-0x7c54,0x7c55,0x7c56,0x7c57,0x7c58,0x7c59,0x7c5a,0x7c5b,
-0x7c5c,0x7c5d,0x7c5e,0x7c5f,0x7c60,0x7c61,0x7c62,0x7c63,
-0x7c64,0x7c65,0x7c66,0x7c67,0x7c68,0x7c69,0x7c6a,0x7c6b,
-0x7c6c,0x7c6d,0x7c6e,0x7c6f,0x7c70,0x7c71,0x7c72,0x7c75,
-0x7c76,0x7c77,0x7c78,0x7c79,0x7c7a,0x7c7e,0x7c7f,0x7c80,
-0x7c81,0x7c82,0x7c83,0x7c84,0x7c85,0x7c86,0x7c87,0x0000,
-0x7c88,0x7c8a,0x7c8b,0x7c8c,0x7c8d,0x7c8e,0x7c8f,0x7c90,
-0x7c93,0x7c94,0x7c96,0x7c99,0x7c9a,0x7c9b,0x7ca0,0x7ca1,
-0x7ca3,0x7ca6,0x7ca7,0x7ca8,0x7ca9,0x7cab,0x7cac,0x7cad,
-0x7caf,0x7cb0,0x7cb4,0x7cb5,0x7cb6,0x7cb7,0x7cb8,0x7cba,
-0x7cbb,0x5f27,0x864e,0x552c,0x62a4,0x4e92,0x6caa,0x6237,
-0x82b1,0x54d7,0x534e,0x733e,0x6ed1,0x753b,0x5212,0x5316,
-0x8bdd,0x69d0,0x5f8a,0x6000,0x6dee,0x574f,0x6b22,0x73af,
-0x6853,0x8fd8,0x7f13,0x6362,0x60a3,0x5524,0x75ea,0x8c62,
-0x7115,0x6da3,0x5ba6,0x5e7b,0x8352,0x614c,0x9ec4,0x78fa,
-0x8757,0x7c27,0x7687,0x51f0,0x60f6,0x714c,0x6643,0x5e4c,
-0x604d,0x8c0e,0x7070,0x6325,0x8f89,0x5fbd,0x6062,0x86d4,
-0x56de,0x6bc1,0x6094,0x6167,0x5349,0x60e0,0x6666,0x8d3f,
-0x79fd,0x4f1a,0x70e9,0x6c47,0x8bb3,0x8bf2,0x7ed8,0x8364,
-0x660f,0x5a5a,0x9b42,0x6d51,0x6df7,0x8c41,0x6d3b,0x4f19,
-0x706b,0x83b7,0x6216,0x60d1,0x970d,0x8d27,0x7978,0x51fb,
-0x573e,0x57fa,0x673a,0x7578,0x7a3d,0x79ef,0x7b95,0x0000,
-/* 0xbc00 */
-0x7cbf,0x7cc0,0x7cc2,0x7cc3,0x7cc4,0x7cc6,0x7cc9,0x7ccb,
-0x7cce,0x7ccf,0x7cd0,0x7cd1,0x7cd2,0x7cd3,0x7cd4,0x7cd8,
-0x7cda,0x7cdb,0x7cdd,0x7cde,0x7ce1,0x7ce2,0x7ce3,0x7ce4,
-0x7ce5,0x7ce6,0x7ce7,0x7ce9,0x7cea,0x7ceb,0x7cec,0x7ced,
-0x7cee,0x7cf0,0x7cf1,0x7cf2,0x7cf3,0x7cf4,0x7cf5,0x7cf6,
-0x7cf7,0x7cf9,0x7cfa,0x7cfc,0x7cfd,0x7cfe,0x7cff,0x7d00,
-0x7d01,0x7d02,0x7d03,0x7d04,0x7d05,0x7d06,0x7d07,0x7d08,
-0x7d09,0x7d0b,0x7d0c,0x7d0d,0x7d0e,0x7d0f,0x7d10,0x0000,
-0x7d11,0x7d12,0x7d13,0x7d14,0x7d15,0x7d16,0x7d17,0x7d18,
-0x7d19,0x7d1a,0x7d1b,0x7d1c,0x7d1d,0x7d1e,0x7d1f,0x7d21,
-0x7d23,0x7d24,0x7d25,0x7d26,0x7d28,0x7d29,0x7d2a,0x7d2c,
-0x7d2d,0x7d2e,0x7d30,0x7d31,0x7d32,0x7d33,0x7d34,0x7d35,
-0x7d36,0x808c,0x9965,0x8ff9,0x6fc0,0x8ba5,0x9e21,0x59ec,
-0x7ee9,0x7f09,0x5409,0x6781,0x68d8,0x8f91,0x7c4d,0x96c6,
-0x53ca,0x6025,0x75be,0x6c72,0x5373,0x5ac9,0x7ea7,0x6324,
-0x51e0,0x810a,0x5df1,0x84df,0x6280,0x5180,0x5b63,0x4f0e,
-0x796d,0x5242,0x60b8,0x6d4e,0x5bc4,0x5bc2,0x8ba1,0x8bb0,
-0x65e2,0x5fcc,0x9645,0x5993,0x7ee7,0x7eaa,0x5609,0x67b7,
-0x5939,0x4f73,0x5bb6,0x52a0,0x835a,0x988a,0x8d3e,0x7532,
-0x94be,0x5047,0x7a3c,0x4ef7,0x67b6,0x9a7e,0x5ac1,0x6b7c,
-0x76d1,0x575a,0x5c16,0x7b3a,0x95f4,0x714e,0x517c,0x80a9,
-0x8270,0x5978,0x7f04,0x8327,0x68c0,0x67ec,0x78b1,0x7877,
-0x62e3,0x6361,0x7b80,0x4fed,0x526a,0x51cf,0x8350,0x69db,
-0x9274,0x8df5,0x8d31,0x89c1,0x952e,0x7bad,0x4ef6,0x0000,
-/* 0xbd00 */
-0x7d37,0x7d38,0x7d39,0x7d3a,0x7d3b,0x7d3c,0x7d3d,0x7d3e,
-0x7d3f,0x7d40,0x7d41,0x7d42,0x7d43,0x7d44,0x7d45,0x7d46,
-0x7d47,0x7d48,0x7d49,0x7d4a,0x7d4b,0x7d4c,0x7d4d,0x7d4e,
-0x7d4f,0x7d50,0x7d51,0x7d52,0x7d53,0x7d54,0x7d55,0x7d56,
-0x7d57,0x7d58,0x7d59,0x7d5a,0x7d5b,0x7d5c,0x7d5d,0x7d5e,
-0x7d5f,0x7d60,0x7d61,0x7d62,0x7d63,0x7d64,0x7d65,0x7d66,
-0x7d67,0x7d68,0x7d69,0x7d6a,0x7d6b,0x7d6c,0x7d6d,0x7d6f,
-0x7d70,0x7d71,0x7d72,0x7d73,0x7d74,0x7d75,0x7d76,0x0000,
-0x7d78,0x7d79,0x7d7a,0x7d7b,0x7d7c,0x7d7d,0x7d7e,0x7d7f,
-0x7d80,0x7d81,0x7d82,0x7d83,0x7d84,0x7d85,0x7d86,0x7d87,
-0x7d88,0x7d89,0x7d8a,0x7d8b,0x7d8c,0x7d8d,0x7d8e,0x7d8f,
-0x7d90,0x7d91,0x7d92,0x7d93,0x7d94,0x7d95,0x7d96,0x7d97,
-0x7d98,0x5065,0x8230,0x5251,0x996f,0x6e10,0x6e85,0x6da7,
-0x5efa,0x50f5,0x59dc,0x5c06,0x6d46,0x6c5f,0x7586,0x848b,
-0x6868,0x5956,0x8bb2,0x5320,0x9171,0x964d,0x8549,0x6912,
-0x7901,0x7126,0x80f6,0x4ea4,0x90ca,0x6d47,0x9a84,0x5a07,
-0x56bc,0x6405,0x94f0,0x77eb,0x4fa5,0x811a,0x72e1,0x89d2,
-0x997a,0x7f34,0x7ede,0x527f,0x6559,0x9175,0x8f7f,0x8f83,
-0x53eb,0x7a96,0x63ed,0x63a5,0x7686,0x79f8,0x8857,0x9636,
-0x622a,0x52ab,0x8282,0x6854,0x6770,0x6377,0x776b,0x7aed,
-0x6d01,0x7ed3,0x89e3,0x59d0,0x6212,0x85c9,0x82a5,0x754c,
-0x501f,0x4ecb,0x75a5,0x8beb,0x5c4a,0x5dfe,0x7b4b,0x65a4,
-0x91d1,0x4eca,0x6d25,0x895f,0x7d27,0x9526,0x4ec5,0x8c28,
-0x8fdb,0x9773,0x664b,0x7981,0x8fd1,0x70ec,0x6d78,0x0000,
-/* 0xbe00 */
-0x7d99,0x7d9a,0x7d9b,0x7d9c,0x7d9d,0x7d9e,0x7d9f,0x7da0,
-0x7da1,0x7da2,0x7da3,0x7da4,0x7da5,0x7da7,0x7da8,0x7da9,
-0x7daa,0x7dab,0x7dac,0x7dad,0x7daf,0x7db0,0x7db1,0x7db2,
-0x7db3,0x7db4,0x7db5,0x7db6,0x7db7,0x7db8,0x7db9,0x7dba,
-0x7dbb,0x7dbc,0x7dbd,0x7dbe,0x7dbf,0x7dc0,0x7dc1,0x7dc2,
-0x7dc3,0x7dc4,0x7dc5,0x7dc6,0x7dc7,0x7dc8,0x7dc9,0x7dca,
-0x7dcb,0x7dcc,0x7dcd,0x7dce,0x7dcf,0x7dd0,0x7dd1,0x7dd2,
-0x7dd3,0x7dd4,0x7dd5,0x7dd6,0x7dd7,0x7dd8,0x7dd9,0x0000,
-0x7dda,0x7ddb,0x7ddc,0x7ddd,0x7dde,0x7ddf,0x7de0,0x7de1,
-0x7de2,0x7de3,0x7de4,0x7de5,0x7de6,0x7de7,0x7de8,0x7de9,
-0x7dea,0x7deb,0x7dec,0x7ded,0x7dee,0x7def,0x7df0,0x7df1,
-0x7df2,0x7df3,0x7df4,0x7df5,0x7df6,0x7df7,0x7df8,0x7df9,
-0x7dfa,0x5c3d,0x52b2,0x8346,0x5162,0x830e,0x775b,0x6676,
-0x9cb8,0x4eac,0x60ca,0x7cbe,0x7cb3,0x7ecf,0x4e95,0x8b66,
-0x666f,0x9888,0x9759,0x5883,0x656c,0x955c,0x5f84,0x75c9,
-0x9756,0x7adf,0x7ade,0x51c0,0x70af,0x7a98,0x63ea,0x7a76,
-0x7ea0,0x7396,0x97ed,0x4e45,0x7078,0x4e5d,0x9152,0x53a9,
-0x6551,0x65e7,0x81fc,0x8205,0x548e,0x5c31,0x759a,0x97a0,
-0x62d8,0x72d9,0x75bd,0x5c45,0x9a79,0x83ca,0x5c40,0x5480,
-0x77e9,0x4e3e,0x6cae,0x805a,0x62d2,0x636e,0x5de8,0x5177,
-0x8ddd,0x8e1e,0x952f,0x4ff1,0x53e5,0x60e7,0x70ac,0x5267,
-0x6350,0x9e43,0x5a1f,0x5026,0x7737,0x5377,0x7ee2,0x6485,
-0x652b,0x6289,0x6398,0x5014,0x7235,0x89c9,0x51b3,0x8bc0,
-0x7edd,0x5747,0x83cc,0x94a7,0x519b,0x541b,0x5cfb,0x0000,
-/* 0xbf00 */
-0x7dfb,0x7dfc,0x7dfd,0x7dfe,0x7dff,0x7e00,0x7e01,0x7e02,
-0x7e03,0x7e04,0x7e05,0x7e06,0x7e07,0x7e08,0x7e09,0x7e0a,
-0x7e0b,0x7e0c,0x7e0d,0x7e0e,0x7e0f,0x7e10,0x7e11,0x7e12,
-0x7e13,0x7e14,0x7e15,0x7e16,0x7e17,0x7e18,0x7e19,0x7e1a,
-0x7e1b,0x7e1c,0x7e1d,0x7e1e,0x7e1f,0x7e20,0x7e21,0x7e22,
-0x7e23,0x7e24,0x7e25,0x7e26,0x7e27,0x7e28,0x7e29,0x7e2a,
-0x7e2b,0x7e2c,0x7e2d,0x7e2e,0x7e2f,0x7e30,0x7e31,0x7e32,
-0x7e33,0x7e34,0x7e35,0x7e36,0x7e37,0x7e38,0x7e39,0x0000,
-0x7e3a,0x7e3c,0x7e3d,0x7e3e,0x7e3f,0x7e40,0x7e42,0x7e43,
-0x7e44,0x7e45,0x7e46,0x7e48,0x7e49,0x7e4a,0x7e4b,0x7e4c,
-0x7e4d,0x7e4e,0x7e4f,0x7e50,0x7e51,0x7e52,0x7e53,0x7e54,
-0x7e55,0x7e56,0x7e57,0x7e58,0x7e59,0x7e5a,0x7e5b,0x7e5c,
-0x7e5d,0x4fca,0x7ae3,0x6d5a,0x90e1,0x9a8f,0x5580,0x5496,
-0x5361,0x54af,0x5f00,0x63e9,0x6977,0x51ef,0x6168,0x520a,
-0x582a,0x52d8,0x574e,0x780d,0x770b,0x5eb7,0x6177,0x7ce0,
-0x625b,0x6297,0x4ea2,0x7095,0x8003,0x62f7,0x70e4,0x9760,
-0x5777,0x82db,0x67ef,0x68f5,0x78d5,0x9897,0x79d1,0x58f3,
-0x54b3,0x53ef,0x6e34,0x514b,0x523b,0x5ba2,0x8bfe,0x80af,
-0x5543,0x57a6,0x6073,0x5751,0x542d,0x7a7a,0x6050,0x5b54,
-0x63a7,0x62a0,0x53e3,0x6263,0x5bc7,0x67af,0x54ed,0x7a9f,
-0x82e6,0x9177,0x5e93,0x88e4,0x5938,0x57ae,0x630e,0x8de8,
-0x80ef,0x5757,0x7b77,0x4fa9,0x5feb,0x5bbd,0x6b3e,0x5321,
-0x7b50,0x72c2,0x6846,0x77ff,0x7736,0x65f7,0x51b5,0x4e8f,
-0x76d4,0x5cbf,0x7aa5,0x8475,0x594e,0x9b41,0x5080,0x0000,
-/* 0xc000 */
-0x7e5e,0x7e5f,0x7e60,0x7e61,0x7e62,0x7e63,0x7e64,0x7e65,
-0x7e66,0x7e67,0x7e68,0x7e69,0x7e6a,0x7e6b,0x7e6c,0x7e6d,
-0x7e6e,0x7e6f,0x7e70,0x7e71,0x7e72,0x7e73,0x7e74,0x7e75,
-0x7e76,0x7e77,0x7e78,0x7e79,0x7e7a,0x7e7b,0x7e7c,0x7e7d,
-0x7e7e,0x7e7f,0x7e80,0x7e81,0x7e83,0x7e84,0x7e85,0x7e86,
-0x7e87,0x7e88,0x7e89,0x7e8a,0x7e8b,0x7e8c,0x7e8d,0x7e8e,
-0x7e8f,0x7e90,0x7e91,0x7e92,0x7e93,0x7e94,0x7e95,0x7e96,
-0x7e97,0x7e98,0x7e99,0x7e9a,0x7e9c,0x7e9d,0x7e9e,0x0000,
-0x7eae,0x7eb4,0x7ebb,0x7ebc,0x7ed6,0x7ee4,0x7eec,0x7ef9,
-0x7f0a,0x7f10,0x7f1e,0x7f37,0x7f39,0x7f3b,0x7f3c,0x7f3d,
-0x7f3e,0x7f3f,0x7f40,0x7f41,0x7f43,0x7f46,0x7f47,0x7f48,
-0x7f49,0x7f4a,0x7f4b,0x7f4c,0x7f4d,0x7f4e,0x7f4f,0x7f52,
-0x7f53,0x9988,0x6127,0x6e83,0x5764,0x6606,0x6346,0x56f0,
-0x62ec,0x6269,0x5ed3,0x9614,0x5783,0x62c9,0x5587,0x8721,
-0x814a,0x8fa3,0x5566,0x83b1,0x6765,0x8d56,0x84dd,0x5a6a,
-0x680f,0x62e6,0x7bee,0x9611,0x5170,0x6f9c,0x8c30,0x63fd,
-0x89c8,0x61d2,0x7f06,0x70c2,0x6ee5,0x7405,0x6994,0x72fc,
-0x5eca,0x90ce,0x6717,0x6d6a,0x635e,0x52b3,0x7262,0x8001,
-0x4f6c,0x59e5,0x916a,0x70d9,0x6d9d,0x52d2,0x4e50,0x96f7,
-0x956d,0x857e,0x78ca,0x7d2f,0x5121,0x5792,0x64c2,0x808b,
-0x7c7b,0x6cea,0x68f1,0x695e,0x51b7,0x5398,0x68a8,0x7281,
-0x9ece,0x7bf1,0x72f8,0x79bb,0x6f13,0x7406,0x674e,0x91cc,
-0x9ca4,0x793c,0x8389,0x8354,0x540f,0x6817,0x4e3d,0x5389,
-0x52b1,0x783e,0x5386,0x5229,0x5088,0x4f8b,0x4fd0,0x0000,
-/* 0xc100 */
-0x7f56,0x7f59,0x7f5b,0x7f5c,0x7f5d,0x7f5e,0x7f60,0x7f63,
-0x7f64,0x7f65,0x7f66,0x7f67,0x7f6b,0x7f6c,0x7f6d,0x7f6f,
-0x7f70,0x7f73,0x7f75,0x7f76,0x7f77,0x7f78,0x7f7a,0x7f7b,
-0x7f7c,0x7f7d,0x7f7f,0x7f80,0x7f82,0x7f83,0x7f84,0x7f85,
-0x7f86,0x7f87,0x7f88,0x7f89,0x7f8b,0x7f8d,0x7f8f,0x7f90,
-0x7f91,0x7f92,0x7f93,0x7f95,0x7f96,0x7f97,0x7f98,0x7f99,
-0x7f9b,0x7f9c,0x7fa0,0x7fa2,0x7fa3,0x7fa5,0x7fa6,0x7fa8,
-0x7fa9,0x7faa,0x7fab,0x7fac,0x7fad,0x7fae,0x7fb1,0x0000,
-0x7fb3,0x7fb4,0x7fb5,0x7fb6,0x7fb7,0x7fba,0x7fbb,0x7fbe,
-0x7fc0,0x7fc2,0x7fc3,0x7fc4,0x7fc6,0x7fc7,0x7fc8,0x7fc9,
-0x7fcb,0x7fcd,0x7fcf,0x7fd0,0x7fd1,0x7fd2,0x7fd3,0x7fd6,
-0x7fd7,0x7fd9,0x7fda,0x7fdb,0x7fdc,0x7fdd,0x7fde,0x7fe2,
-0x7fe3,0x75e2,0x7acb,0x7c92,0x6ca5,0x96b6,0x529b,0x7483,
-0x54e9,0x4fe9,0x8054,0x83b2,0x8fde,0x9570,0x5ec9,0x601c,
-0x6d9f,0x5e18,0x655b,0x8138,0x94fe,0x604b,0x70bc,0x7ec3,
-0x7cae,0x51c9,0x6881,0x7cb1,0x826f,0x4e24,0x8f86,0x91cf,
-0x667e,0x4eae,0x8c05,0x64a9,0x804a,0x50da,0x7597,0x71ce,
-0x5be5,0x8fbd,0x6f66,0x4e86,0x6482,0x9563,0x5ed6,0x6599,
-0x5217,0x88c2,0x70c8,0x52a3,0x730e,0x7433,0x6797,0x78f7,
-0x9716,0x4e34,0x90bb,0x9cde,0x6dcb,0x51db,0x8d41,0x541d,
-0x62ce,0x73b2,0x83f1,0x96f6,0x9f84,0x94c3,0x4f36,0x7f9a,
-0x51cc,0x7075,0x9675,0x5cad,0x9886,0x53e6,0x4ee4,0x6e9c,
-0x7409,0x69b4,0x786b,0x998f,0x7559,0x5218,0x7624,0x6d41,
-0x67f3,0x516d,0x9f99,0x804b,0x5499,0x7b3c,0x7abf,0x0000,
-/* 0xc200 */
-0x7fe4,0x7fe7,0x7fe8,0x7fea,0x7feb,0x7fec,0x7fed,0x7fef,
-0x7ff2,0x7ff4,0x7ff5,0x7ff6,0x7ff7,0x7ff8,0x7ff9,0x7ffa,
-0x7ffd,0x7ffe,0x7fff,0x8002,0x8007,0x8008,0x8009,0x800a,
-0x800e,0x800f,0x8011,0x8013,0x801a,0x801b,0x801d,0x801e,
-0x801f,0x8021,0x8023,0x8024,0x802b,0x802c,0x802d,0x802e,
-0x802f,0x8030,0x8032,0x8034,0x8039,0x803a,0x803c,0x803e,
-0x8040,0x8041,0x8044,0x8045,0x8047,0x8048,0x8049,0x804e,
-0x804f,0x8050,0x8051,0x8053,0x8055,0x8056,0x8057,0x0000,
-0x8059,0x805b,0x805c,0x805d,0x805e,0x805f,0x8060,0x8061,
-0x8062,0x8063,0x8064,0x8065,0x8066,0x8067,0x8068,0x806b,
-0x806c,0x806d,0x806e,0x806f,0x8070,0x8072,0x8073,0x8074,
-0x8075,0x8076,0x8077,0x8078,0x8079,0x807a,0x807b,0x807c,
-0x807d,0x9686,0x5784,0x62e2,0x9647,0x697c,0x5a04,0x6402,
-0x7bd3,0x6f0f,0x964b,0x82a6,0x5362,0x9885,0x5e90,0x7089,
-0x63b3,0x5364,0x864f,0x9c81,0x9e93,0x788c,0x9732,0x8def,
-0x8d42,0x9e7f,0x6f5e,0x7984,0x5f55,0x9646,0x622e,0x9a74,
-0x5415,0x94dd,0x4fa3,0x65c5,0x5c65,0x5c61,0x7f15,0x8651,
-0x6c2f,0x5f8b,0x7387,0x6ee4,0x7eff,0x5ce6,0x631b,0x5b6a,
-0x6ee6,0x5375,0x4e71,0x63a0,0x7565,0x62a1,0x8f6e,0x4f26,
-0x4ed1,0x6ca6,0x7eb6,0x8bba,0x841d,0x87ba,0x7f57,0x903b,
-0x9523,0x7ba9,0x9aa1,0x88f8,0x843d,0x6d1b,0x9a86,0x7edc,
-0x5988,0x9ebb,0x739b,0x7801,0x8682,0x9a6c,0x9a82,0x561b,
-0x5417,0x57cb,0x4e70,0x9ea6,0x5356,0x8fc8,0x8109,0x7792,
-0x9992,0x86ee,0x6ee1,0x8513,0x66fc,0x6162,0x6f2b,0x0000,
-/* 0xc300 */
-0x807e,0x8081,0x8082,0x8085,0x8088,0x808a,0x808d,0x808e,
-0x808f,0x8090,0x8091,0x8092,0x8094,0x8095,0x8097,0x8099,
-0x809e,0x80a3,0x80a6,0x80a7,0x80a8,0x80ac,0x80b0,0x80b3,
-0x80b5,0x80b6,0x80b8,0x80b9,0x80bb,0x80c5,0x80c7,0x80c8,
-0x80c9,0x80ca,0x80cb,0x80cf,0x80d0,0x80d1,0x80d2,0x80d3,
-0x80d4,0x80d5,0x80d8,0x80df,0x80e0,0x80e2,0x80e3,0x80e6,
-0x80ee,0x80f5,0x80f7,0x80f9,0x80fb,0x80fe,0x80ff,0x8100,
-0x8101,0x8103,0x8104,0x8105,0x8107,0x8108,0x810b,0x0000,
-0x810c,0x8115,0x8117,0x8119,0x811b,0x811c,0x811d,0x811f,
-0x8120,0x8121,0x8122,0x8123,0x8124,0x8125,0x8126,0x8127,
-0x8128,0x8129,0x812a,0x812b,0x812d,0x812e,0x8130,0x8133,
-0x8134,0x8135,0x8137,0x8139,0x813a,0x813b,0x813c,0x813d,
-0x813f,0x8c29,0x8292,0x832b,0x76f2,0x6c13,0x5fd9,0x83bd,
-0x732b,0x8305,0x951a,0x6bdb,0x77db,0x94c6,0x536f,0x8302,
-0x5192,0x5e3d,0x8c8c,0x8d38,0x4e48,0x73ab,0x679a,0x6885,
-0x9176,0x9709,0x7164,0x6ca1,0x7709,0x5a92,0x9541,0x6bcf,
-0x7f8e,0x6627,0x5bd0,0x59b9,0x5a9a,0x95e8,0x95f7,0x4eec,
-0x840c,0x8499,0x6aac,0x76df,0x9530,0x731b,0x68a6,0x5b5f,
-0x772f,0x919a,0x9761,0x7cdc,0x8ff7,0x8c1c,0x5f25,0x7c73,
-0x79d8,0x89c5,0x6ccc,0x871c,0x5bc6,0x5e42,0x68c9,0x7720,
-0x7ef5,0x5195,0x514d,0x52c9,0x5a29,0x7f05,0x9762,0x82d7,
-0x63cf,0x7784,0x85d0,0x79d2,0x6e3a,0x5e99,0x5999,0x8511,
-0x706d,0x6c11,0x62bf,0x76bf,0x654f,0x60af,0x95fd,0x660e,
-0x879f,0x9e23,0x94ed,0x540d,0x547d,0x8c2c,0x6478,0x0000,
-/* 0xc400 */
-0x8140,0x8141,0x8142,0x8143,0x8144,0x8145,0x8147,0x8149,
-0x814d,0x814e,0x814f,0x8152,0x8156,0x8157,0x8158,0x815b,
-0x815c,0x815d,0x815e,0x815f,0x8161,0x8162,0x8163,0x8164,
-0x8166,0x8168,0x816a,0x816b,0x816c,0x816f,0x8172,0x8173,
-0x8175,0x8176,0x8177,0x8178,0x8181,0x8183,0x8184,0x8185,
-0x8186,0x8187,0x8189,0x818b,0x818c,0x818d,0x818e,0x8190,
-0x8192,0x8193,0x8194,0x8195,0x8196,0x8197,0x8199,0x819a,
-0x819e,0x819f,0x81a0,0x81a1,0x81a2,0x81a4,0x81a5,0x0000,
-0x81a7,0x81a9,0x81ab,0x81ac,0x81ad,0x81ae,0x81af,0x81b0,
-0x81b1,0x81b2,0x81b4,0x81b5,0x81b6,0x81b7,0x81b8,0x81b9,
-0x81bc,0x81bd,0x81be,0x81bf,0x81c4,0x81c5,0x81c7,0x81c8,
-0x81c9,0x81cb,0x81cd,0x81ce,0x81cf,0x81d0,0x81d1,0x81d2,
-0x81d3,0x6479,0x8611,0x6a21,0x819c,0x78e8,0x6469,0x9b54,
-0x62b9,0x672b,0x83ab,0x58a8,0x9ed8,0x6cab,0x6f20,0x5bde,
-0x964c,0x8c0b,0x725f,0x67d0,0x62c7,0x7261,0x4ea9,0x59c6,
-0x6bcd,0x5893,0x66ae,0x5e55,0x52df,0x6155,0x6728,0x76ee,
-0x7766,0x7267,0x7a46,0x62ff,0x54ea,0x5450,0x94a0,0x90a3,
-0x5a1c,0x7eb3,0x6c16,0x4e43,0x5976,0x8010,0x5948,0x5357,
-0x7537,0x96be,0x56ca,0x6320,0x8111,0x607c,0x95f9,0x6dd6,
-0x5462,0x9981,0x5185,0x5ae9,0x80fd,0x59ae,0x9713,0x502a,
-0x6ce5,0x5c3c,0x62df,0x4f60,0x533f,0x817b,0x9006,0x6eba,
-0x852b,0x62c8,0x5e74,0x78be,0x64b5,0x637b,0x5ff5,0x5a18,
-0x917f,0x9e1f,0x5c3f,0x634f,0x8042,0x5b7d,0x556e,0x954a,
-0x954d,0x6d85,0x60a8,0x67e0,0x72de,0x51dd,0x5b81,0x0000,
-/* 0xc500 */
-0x81d4,0x81d5,0x81d6,0x81d7,0x81d8,0x81d9,0x81da,0x81db,
-0x81dc,0x81dd,0x81de,0x81df,0x81e0,0x81e1,0x81e2,0x81e4,
-0x81e5,0x81e6,0x81e8,0x81e9,0x81eb,0x81ee,0x81ef,0x81f0,
-0x81f1,0x81f2,0x81f5,0x81f6,0x81f7,0x81f8,0x81f9,0x81fa,
-0x81fd,0x81ff,0x8203,0x8207,0x8208,0x8209,0x820a,0x820b,
-0x820e,0x820f,0x8211,0x8213,0x8215,0x8216,0x8217,0x8218,
-0x8219,0x821a,0x821d,0x8220,0x8224,0x8225,0x8226,0x8227,
-0x8229,0x822e,0x8232,0x823a,0x823c,0x823d,0x823f,0x0000,
-0x8240,0x8241,0x8242,0x8243,0x8245,0x8246,0x8248,0x824a,
-0x824c,0x824d,0x824e,0x8250,0x8251,0x8252,0x8253,0x8254,
-0x8255,0x8256,0x8257,0x8259,0x825b,0x825c,0x825d,0x825e,
-0x8260,0x8261,0x8262,0x8263,0x8264,0x8265,0x8266,0x8267,
-0x8269,0x62e7,0x6cde,0x725b,0x626d,0x94ae,0x7ebd,0x8113,
-0x6d53,0x519c,0x5f04,0x5974,0x52aa,0x6012,0x5973,0x6696,
-0x8650,0x759f,0x632a,0x61e6,0x7cef,0x8bfa,0x54e6,0x6b27,
-0x9e25,0x6bb4,0x85d5,0x5455,0x5076,0x6ca4,0x556a,0x8db4,
-0x722c,0x5e15,0x6015,0x7436,0x62cd,0x6392,0x724c,0x5f98,
-0x6e43,0x6d3e,0x6500,0x6f58,0x76d8,0x78d0,0x76fc,0x7554,
-0x5224,0x53db,0x4e53,0x5e9e,0x65c1,0x802a,0x80d6,0x629b,
-0x5486,0x5228,0x70ae,0x888d,0x8dd1,0x6ce1,0x5478,0x80da,
-0x57f9,0x88f4,0x8d54,0x966a,0x914d,0x4f69,0x6c9b,0x55b7,
-0x76c6,0x7830,0x62a8,0x70f9,0x6f8e,0x5f6d,0x84ec,0x68da,
-0x787c,0x7bf7,0x81a8,0x670b,0x9e4f,0x6367,0x78b0,0x576f,
-0x7812,0x9739,0x6279,0x62ab,0x5288,0x7435,0x6bd7,0x0000,
-/* 0xc600 */
-0x826a,0x826b,0x826c,0x826d,0x8271,0x8275,0x8276,0x8277,
-0x8278,0x827b,0x827c,0x8280,0x8281,0x8283,0x8285,0x8286,
-0x8287,0x8289,0x828c,0x8290,0x8293,0x8294,0x8295,0x8296,
-0x829a,0x829b,0x829e,0x82a0,0x82a2,0x82a3,0x82a7,0x82b2,
-0x82b5,0x82b6,0x82ba,0x82bb,0x82bc,0x82bf,0x82c0,0x82c2,
-0x82c3,0x82c5,0x82c6,0x82c9,0x82d0,0x82d6,0x82d9,0x82da,
-0x82dd,0x82e2,0x82e7,0x82e8,0x82e9,0x82ea,0x82ec,0x82ed,
-0x82ee,0x82f0,0x82f2,0x82f3,0x82f5,0x82f6,0x82f8,0x0000,
-0x82fa,0x82fc,0x82fd,0x82fe,0x82ff,0x8300,0x830a,0x830b,
-0x830d,0x8310,0x8312,0x8313,0x8316,0x8318,0x8319,0x831d,
-0x831e,0x831f,0x8320,0x8321,0x8322,0x8323,0x8324,0x8325,
-0x8326,0x8329,0x832a,0x832e,0x8330,0x8332,0x8337,0x833b,
-0x833d,0x5564,0x813e,0x75b2,0x76ae,0x5339,0x75de,0x50fb,
-0x5c41,0x8b6c,0x7bc7,0x504f,0x7247,0x9a97,0x98d8,0x6f02,
-0x74e2,0x7968,0x6487,0x77a5,0x62fc,0x9891,0x8d2b,0x54c1,
-0x8058,0x4e52,0x576a,0x82f9,0x840d,0x5e73,0x51ed,0x74f6,
-0x8bc4,0x5c4f,0x5761,0x6cfc,0x9887,0x5a46,0x7834,0x9b44,
-0x8feb,0x7c95,0x5256,0x6251,0x94fa,0x4ec6,0x8386,0x8461,
-0x83e9,0x84b2,0x57d4,0x6734,0x5703,0x666e,0x6d66,0x8c31,
-0x66dd,0x7011,0x671f,0x6b3a,0x6816,0x621a,0x59bb,0x4e03,
-0x51c4,0x6f06,0x67d2,0x6c8f,0x5176,0x68cb,0x5947,0x6b67,
-0x7566,0x5d0e,0x8110,0x9f50,0x65d7,0x7948,0x7941,0x9a91,
-0x8d77,0x5c82,0x4e5e,0x4f01,0x542f,0x5951,0x780c,0x5668,
-0x6c14,0x8fc4,0x5f03,0x6c7d,0x6ce3,0x8bab,0x6390,0x0000,
-/* 0xc700 */
-0x833e,0x833f,0x8341,0x8342,0x8344,0x8345,0x8348,0x834a,
-0x834b,0x834c,0x834d,0x834e,0x8353,0x8355,0x8356,0x8357,
-0x8358,0x8359,0x835d,0x8362,0x8370,0x8371,0x8372,0x8373,
-0x8374,0x8375,0x8376,0x8379,0x837a,0x837e,0x837f,0x8380,
-0x8381,0x8382,0x8383,0x8384,0x8387,0x8388,0x838a,0x838b,
-0x838c,0x838d,0x838f,0x8390,0x8391,0x8394,0x8395,0x8396,
-0x8397,0x8399,0x839a,0x839d,0x839f,0x83a1,0x83a2,0x83a3,
-0x83a4,0x83a5,0x83a6,0x83a7,0x83ac,0x83ad,0x83ae,0x0000,
-0x83af,0x83b5,0x83bb,0x83be,0x83bf,0x83c2,0x83c3,0x83c4,
-0x83c6,0x83c8,0x83c9,0x83cb,0x83cd,0x83ce,0x83d0,0x83d1,
-0x83d2,0x83d3,0x83d5,0x83d7,0x83d9,0x83da,0x83db,0x83de,
-0x83e2,0x83e3,0x83e4,0x83e6,0x83e7,0x83e8,0x83eb,0x83ec,
-0x83ed,0x6070,0x6d3d,0x7275,0x6266,0x948e,0x94c5,0x5343,
-0x8fc1,0x7b7e,0x4edf,0x8c26,0x4e7e,0x9ed4,0x94b1,0x94b3,
-0x524d,0x6f5c,0x9063,0x6d45,0x8c34,0x5811,0x5d4c,0x6b20,
-0x6b49,0x67aa,0x545b,0x8154,0x7f8c,0x5899,0x8537,0x5f3a,
-0x62a2,0x6a47,0x9539,0x6572,0x6084,0x6865,0x77a7,0x4e54,
-0x4fa8,0x5de7,0x9798,0x64ac,0x7fd8,0x5ced,0x4fcf,0x7a8d,
-0x5207,0x8304,0x4e14,0x602f,0x7a83,0x94a6,0x4fb5,0x4eb2,
-0x79e6,0x7434,0x52e4,0x82b9,0x64d2,0x79bd,0x5bdd,0x6c81,
-0x9752,0x8f7b,0x6c22,0x503e,0x537f,0x6e05,0x64ce,0x6674,
-0x6c30,0x60c5,0x9877,0x8bf7,0x5e86,0x743c,0x7a77,0x79cb,
-0x4e18,0x90b1,0x7403,0x6c42,0x56da,0x914b,0x6cc5,0x8d8b,
-0x533a,0x86c6,0x66f2,0x8eaf,0x5c48,0x9a71,0x6e20,0x0000,
-/* 0xc800 */
-0x83ee,0x83ef,0x83f3,0x83f4,0x83f5,0x83f6,0x83f7,0x83fa,
-0x83fb,0x83fc,0x83fe,0x83ff,0x8400,0x8402,0x8405,0x8407,
-0x8408,0x8409,0x840a,0x8410,0x8412,0x8413,0x8414,0x8415,
-0x8416,0x8417,0x8419,0x841a,0x841b,0x841e,0x841f,0x8420,
-0x8421,0x8422,0x8423,0x8429,0x842a,0x842b,0x842c,0x842d,
-0x842e,0x842f,0x8430,0x8432,0x8433,0x8434,0x8435,0x8436,
-0x8437,0x8439,0x843a,0x843b,0x843e,0x843f,0x8440,0x8441,
-0x8442,0x8443,0x8444,0x8445,0x8447,0x8448,0x8449,0x0000,
-0x844a,0x844b,0x844c,0x844d,0x844e,0x844f,0x8450,0x8452,
-0x8453,0x8454,0x8455,0x8456,0x8458,0x845d,0x845e,0x845f,
-0x8460,0x8462,0x8464,0x8465,0x8466,0x8467,0x8468,0x846a,
-0x846e,0x846f,0x8470,0x8472,0x8474,0x8477,0x8479,0x847b,
-0x847c,0x53d6,0x5a36,0x9f8b,0x8da3,0x53bb,0x5708,0x98a7,
-0x6743,0x919b,0x6cc9,0x5168,0x75ca,0x62f3,0x72ac,0x5238,
-0x529d,0x7f3a,0x7094,0x7638,0x5374,0x9e4a,0x69b7,0x786e,
-0x96c0,0x88d9,0x7fa4,0x7136,0x71c3,0x5189,0x67d3,0x74e4,
-0x58e4,0x6518,0x56b7,0x8ba9,0x9976,0x6270,0x7ed5,0x60f9,
-0x70ed,0x58ec,0x4ec1,0x4eba,0x5fcd,0x97e7,0x4efb,0x8ba4,
-0x5203,0x598a,0x7eab,0x6254,0x4ecd,0x65e5,0x620e,0x8338,
-0x84c9,0x8363,0x878d,0x7194,0x6eb6,0x5bb9,0x7ed2,0x5197,
-0x63c9,0x67d4,0x8089,0x8339,0x8815,0x5112,0x5b7a,0x5982,
-0x8fb1,0x4e73,0x6c5d,0x5165,0x8925,0x8f6f,0x962e,0x854a,
-0x745e,0x9510,0x95f0,0x6da6,0x82e5,0x5f31,0x6492,0x6d12,
-0x8428,0x816e,0x9cc3,0x585e,0x8d5b,0x4e09,0x53c1,0x0000,
-/* 0xc900 */
-0x847d,0x847e,0x847f,0x8480,0x8481,0x8483,0x8484,0x8485,
-0x8486,0x848a,0x848d,0x848f,0x8490,0x8491,0x8492,0x8493,
-0x8494,0x8495,0x8496,0x8498,0x849a,0x849b,0x849d,0x849e,
-0x849f,0x84a0,0x84a2,0x84a3,0x84a4,0x84a5,0x84a6,0x84a7,
-0x84a8,0x84a9,0x84aa,0x84ab,0x84ac,0x84ad,0x84ae,0x84b0,
-0x84b1,0x84b3,0x84b5,0x84b6,0x84b7,0x84bb,0x84bc,0x84be,
-0x84c0,0x84c2,0x84c3,0x84c5,0x84c6,0x84c7,0x84c8,0x84cb,
-0x84cc,0x84ce,0x84cf,0x84d2,0x84d4,0x84d5,0x84d7,0x0000,
-0x84d8,0x84d9,0x84da,0x84db,0x84dc,0x84de,0x84e1,0x84e2,
-0x84e4,0x84e7,0x84e8,0x84e9,0x84ea,0x84eb,0x84ed,0x84ee,
-0x84ef,0x84f1,0x84f2,0x84f3,0x84f4,0x84f5,0x84f6,0x84f7,
-0x84f8,0x84f9,0x84fa,0x84fb,0x84fd,0x84fe,0x8500,0x8501,
-0x8502,0x4f1e,0x6563,0x6851,0x55d3,0x4e27,0x6414,0x9a9a,
-0x626b,0x5ac2,0x745f,0x8272,0x6da9,0x68ee,0x50e7,0x838e,
-0x7802,0x6740,0x5239,0x6c99,0x7eb1,0x50bb,0x5565,0x715e,
-0x7b5b,0x6652,0x73ca,0x82eb,0x6749,0x5c71,0x5220,0x717d,
-0x886b,0x95ea,0x9655,0x64c5,0x8d61,0x81b3,0x5584,0x6c55,
-0x6247,0x7f2e,0x5892,0x4f24,0x5546,0x8d4f,0x664c,0x4e0a,
-0x5c1a,0x88f3,0x68a2,0x634e,0x7a0d,0x70e7,0x828d,0x52fa,
-0x97f6,0x5c11,0x54e8,0x90b5,0x7ecd,0x5962,0x8d4a,0x86c7,
-0x820c,0x820d,0x8d66,0x6444,0x5c04,0x6151,0x6d89,0x793e,
-0x8bbe,0x7837,0x7533,0x547b,0x4f38,0x8eab,0x6df1,0x5a20,
-0x7ec5,0x795e,0x6c88,0x5ba1,0x5a76,0x751a,0x80be,0x614e,
-0x6e17,0x58f0,0x751f,0x7525,0x7272,0x5347,0x7ef3,0x0000,
-/* 0xca00 */
-0x8503,0x8504,0x8505,0x8506,0x8507,0x8508,0x8509,0x850a,
-0x850b,0x850d,0x850e,0x850f,0x8510,0x8512,0x8514,0x8515,
-0x8516,0x8518,0x8519,0x851b,0x851c,0x851d,0x851e,0x8520,
-0x8522,0x8523,0x8524,0x8525,0x8526,0x8527,0x8528,0x8529,
-0x852a,0x852d,0x852e,0x852f,0x8530,0x8531,0x8532,0x8533,
-0x8534,0x8535,0x8536,0x853e,0x853f,0x8540,0x8541,0x8542,
-0x8544,0x8545,0x8546,0x8547,0x854b,0x854c,0x854d,0x854e,
-0x854f,0x8550,0x8551,0x8552,0x8553,0x8554,0x8555,0x0000,
-0x8557,0x8558,0x855a,0x855b,0x855c,0x855d,0x855f,0x8560,
-0x8561,0x8562,0x8563,0x8565,0x8566,0x8567,0x8569,0x856a,
-0x856b,0x856c,0x856d,0x856e,0x856f,0x8570,0x8571,0x8573,
-0x8575,0x8576,0x8577,0x8578,0x857c,0x857d,0x857f,0x8580,
-0x8581,0x7701,0x76db,0x5269,0x80dc,0x5723,0x5e08,0x5931,
-0x72ee,0x65bd,0x6e7f,0x8bd7,0x5c38,0x8671,0x5341,0x77f3,
-0x62fe,0x65f6,0x4ec0,0x98df,0x8680,0x5b9e,0x8bc6,0x53f2,
-0x77e2,0x4f7f,0x5c4e,0x9a76,0x59cb,0x5f0f,0x793a,0x58eb,
-0x4e16,0x67ff,0x4e8b,0x62ed,0x8a93,0x901d,0x52bf,0x662f,
-0x55dc,0x566c,0x9002,0x4ed5,0x4f8d,0x91ca,0x9970,0x6c0f,
-0x5e02,0x6043,0x5ba4,0x89c6,0x8bd5,0x6536,0x624b,0x9996,
-0x5b88,0x5bff,0x6388,0x552e,0x53d7,0x7626,0x517d,0x852c,
-0x67a2,0x68b3,0x6b8a,0x6292,0x8f93,0x53d4,0x8212,0x6dd1,
-0x758f,0x4e66,0x8d4e,0x5b70,0x719f,0x85af,0x6691,0x66d9,
-0x7f72,0x8700,0x9ecd,0x9f20,0x5c5e,0x672f,0x8ff0,0x6811,
-0x675f,0x620d,0x7ad6,0x5885,0x5eb6,0x6570,0x6f31,0x0000,
-/* 0xcb00 */
-0x8582,0x8583,0x8586,0x8588,0x8589,0x858a,0x858b,0x858c,
-0x858d,0x858e,0x8590,0x8591,0x8592,0x8593,0x8594,0x8595,
-0x8596,0x8597,0x8598,0x8599,0x859a,0x859d,0x859e,0x859f,
-0x85a0,0x85a1,0x85a2,0x85a3,0x85a5,0x85a6,0x85a7,0x85a9,
-0x85ab,0x85ac,0x85ad,0x85b1,0x85b2,0x85b3,0x85b4,0x85b5,
-0x85b6,0x85b8,0x85ba,0x85bb,0x85bc,0x85bd,0x85be,0x85bf,
-0x85c0,0x85c2,0x85c3,0x85c4,0x85c5,0x85c6,0x85c7,0x85c8,
-0x85ca,0x85cb,0x85cc,0x85cd,0x85ce,0x85d1,0x85d2,0x0000,
-0x85d4,0x85d6,0x85d7,0x85d8,0x85d9,0x85da,0x85db,0x85dd,
-0x85de,0x85df,0x85e0,0x85e1,0x85e2,0x85e3,0x85e5,0x85e6,
-0x85e7,0x85e8,0x85ea,0x85eb,0x85ec,0x85ed,0x85ee,0x85ef,
-0x85f0,0x85f1,0x85f2,0x85f3,0x85f4,0x85f5,0x85f6,0x85f7,
-0x85f8,0x6055,0x5237,0x800d,0x6454,0x8870,0x7529,0x5e05,
-0x6813,0x62f4,0x971c,0x53cc,0x723d,0x8c01,0x6c34,0x7761,
-0x7a0e,0x542e,0x77ac,0x987a,0x821c,0x8bf4,0x7855,0x6714,
-0x70c1,0x65af,0x6495,0x5636,0x601d,0x79c1,0x53f8,0x4e1d,
-0x6b7b,0x8086,0x5bfa,0x55e3,0x56db,0x4f3a,0x4f3c,0x9972,
-0x5df3,0x677e,0x8038,0x6002,0x9882,0x9001,0x5b8b,0x8bbc,
-0x8bf5,0x641c,0x8258,0x64de,0x55fd,0x82cf,0x9165,0x4fd7,
-0x7d20,0x901f,0x7c9f,0x50f3,0x5851,0x6eaf,0x5bbf,0x8bc9,
-0x8083,0x9178,0x849c,0x7b97,0x867d,0x968b,0x968f,0x7ee5,
-0x9ad3,0x788e,0x5c81,0x7a57,0x9042,0x96a7,0x795f,0x5b59,
-0x635f,0x7b0b,0x84d1,0x68ad,0x5506,0x7f29,0x7410,0x7d22,
-0x9501,0x6240,0x584c,0x4ed6,0x5b83,0x5979,0x5854,0x0000,
-/* 0xcc00 */
-0x85f9,0x85fa,0x85fc,0x85fd,0x85fe,0x8600,0x8601,0x8602,
-0x8603,0x8604,0x8606,0x8607,0x8608,0x8609,0x860a,0x860b,
-0x860c,0x860d,0x860e,0x860f,0x8610,0x8612,0x8613,0x8614,
-0x8615,0x8617,0x8618,0x8619,0x861a,0x861b,0x861c,0x861d,
-0x861e,0x861f,0x8620,0x8621,0x8622,0x8623,0x8624,0x8625,
-0x8626,0x8628,0x862a,0x862b,0x862c,0x862d,0x862e,0x862f,
-0x8630,0x8631,0x8632,0x8633,0x8634,0x8635,0x8636,0x8637,
-0x8639,0x863a,0x863b,0x863d,0x863e,0x863f,0x8640,0x0000,
-0x8641,0x8642,0x8643,0x8644,0x8645,0x8646,0x8647,0x8648,
-0x8649,0x864a,0x864b,0x864c,0x8652,0x8653,0x8655,0x8656,
-0x8657,0x8658,0x8659,0x865b,0x865c,0x865d,0x865f,0x8660,
-0x8661,0x8663,0x8664,0x8665,0x8666,0x8667,0x8668,0x8669,
-0x866a,0x736d,0x631e,0x8e4b,0x8e0f,0x80ce,0x82d4,0x62ac,
-0x53f0,0x6cf0,0x915e,0x592a,0x6001,0x6c70,0x574d,0x644a,
-0x8d2a,0x762b,0x6ee9,0x575b,0x6a80,0x75f0,0x6f6d,0x8c2d,
-0x8c08,0x5766,0x6bef,0x8892,0x78b3,0x63a2,0x53f9,0x70ad,
-0x6c64,0x5858,0x642a,0x5802,0x68e0,0x819b,0x5510,0x7cd6,
-0x5018,0x8eba,0x6dcc,0x8d9f,0x70eb,0x638f,0x6d9b,0x6ed4,
-0x7ee6,0x8404,0x6843,0x9003,0x6dd8,0x9676,0x8ba8,0x5957,
-0x7279,0x85e4,0x817e,0x75bc,0x8a8a,0x68af,0x5254,0x8e22,
-0x9511,0x63d0,0x9898,0x8e44,0x557c,0x4f53,0x66ff,0x568f,
-0x60d5,0x6d95,0x5243,0x5c49,0x5929,0x6dfb,0x586b,0x7530,
-0x751c,0x606c,0x8214,0x8146,0x6311,0x6761,0x8fe2,0x773a,
-0x8df3,0x8d34,0x94c1,0x5e16,0x5385,0x542c,0x70c3,0x0000,
-/* 0xcd00 */
-0x866d,0x866f,0x8670,0x8672,0x8673,0x8674,0x8675,0x8676,
-0x8677,0x8678,0x8683,0x8684,0x8685,0x8686,0x8687,0x8688,
-0x8689,0x868e,0x868f,0x8690,0x8691,0x8692,0x8694,0x8696,
-0x8697,0x8698,0x8699,0x869a,0x869b,0x869e,0x869f,0x86a0,
-0x86a1,0x86a2,0x86a5,0x86a6,0x86ab,0x86ad,0x86ae,0x86b2,
-0x86b3,0x86b7,0x86b8,0x86b9,0x86bb,0x86bc,0x86bd,0x86be,
-0x86bf,0x86c1,0x86c2,0x86c3,0x86c5,0x86c8,0x86cc,0x86cd,
-0x86d2,0x86d3,0x86d5,0x86d6,0x86d7,0x86da,0x86dc,0x0000,
-0x86dd,0x86e0,0x86e1,0x86e2,0x86e3,0x86e5,0x86e6,0x86e7,
-0x86e8,0x86ea,0x86eb,0x86ec,0x86ef,0x86f5,0x86f6,0x86f7,
-0x86fa,0x86fb,0x86fc,0x86fd,0x86ff,0x8701,0x8704,0x8705,
-0x8706,0x870b,0x870c,0x870e,0x870f,0x8710,0x8711,0x8714,
-0x8716,0x6c40,0x5ef7,0x505c,0x4ead,0x5ead,0x633a,0x8247,
-0x901a,0x6850,0x916e,0x77b3,0x540c,0x94dc,0x5f64,0x7ae5,
-0x6876,0x6345,0x7b52,0x7edf,0x75db,0x5077,0x6295,0x5934,
-0x900f,0x51f8,0x79c3,0x7a81,0x56fe,0x5f92,0x9014,0x6d82,
-0x5c60,0x571f,0x5410,0x5154,0x6e4d,0x56e2,0x63a8,0x9893,
-0x817f,0x8715,0x892a,0x9000,0x541e,0x5c6f,0x81c0,0x62d6,
-0x6258,0x8131,0x9e35,0x9640,0x9a6e,0x9a7c,0x692d,0x59a5,
-0x62d3,0x553e,0x6316,0x54c7,0x86d9,0x6d3c,0x5a03,0x74e6,
-0x889c,0x6b6a,0x5916,0x8c4c,0x5f2f,0x6e7e,0x73a9,0x987d,
-0x4e38,0x70f7,0x5b8c,0x7897,0x633d,0x665a,0x7696,0x60cb,
-0x5b9b,0x5a49,0x4e07,0x8155,0x6c6a,0x738b,0x4ea1,0x6789,
-0x7f51,0x5f80,0x65fa,0x671b,0x5fd8,0x5984,0x5a01,0x0000,
-/* 0xce00 */
-0x8719,0x871b,0x871d,0x871f,0x8720,0x8724,0x8726,0x8727,
-0x8728,0x872a,0x872b,0x872c,0x872d,0x872f,0x8730,0x8732,
-0x8733,0x8735,0x8736,0x8738,0x8739,0x873a,0x873c,0x873d,
-0x8740,0x8741,0x8742,0x8743,0x8744,0x8745,0x8746,0x874a,
-0x874b,0x874d,0x874f,0x8750,0x8751,0x8752,0x8754,0x8755,
-0x8756,0x8758,0x875a,0x875b,0x875c,0x875d,0x875e,0x875f,
-0x8761,0x8762,0x8766,0x8767,0x8768,0x8769,0x876a,0x876b,
-0x876c,0x876d,0x876f,0x8771,0x8772,0x8773,0x8775,0x0000,
-0x8777,0x8778,0x8779,0x877a,0x877f,0x8780,0x8781,0x8784,
-0x8786,0x8787,0x8789,0x878a,0x878c,0x878e,0x878f,0x8790,
-0x8791,0x8792,0x8794,0x8795,0x8796,0x8798,0x8799,0x879a,
-0x879b,0x879c,0x879d,0x879e,0x87a0,0x87a1,0x87a2,0x87a3,
-0x87a4,0x5dcd,0x5fae,0x5371,0x97e6,0x8fdd,0x6845,0x56f4,
-0x552f,0x60df,0x4e3a,0x6f4d,0x7ef4,0x82c7,0x840e,0x59d4,
-0x4f1f,0x4f2a,0x5c3e,0x7eac,0x672a,0x851a,0x5473,0x754f,
-0x80c3,0x5582,0x9b4f,0x4f4d,0x6e2d,0x8c13,0x5c09,0x6170,
-0x536b,0x761f,0x6e29,0x868a,0x6587,0x95fb,0x7eb9,0x543b,
-0x7a33,0x7d0a,0x95ee,0x55e1,0x7fc1,0x74ee,0x631d,0x8717,
-0x6da1,0x7a9d,0x6211,0x65a1,0x5367,0x63e1,0x6c83,0x5deb,
-0x545c,0x94a8,0x4e4c,0x6c61,0x8bec,0x5c4b,0x65e0,0x829c,
-0x68a7,0x543e,0x5434,0x6bcb,0x6b66,0x4e94,0x6342,0x5348,
-0x821e,0x4f0d,0x4fae,0x575e,0x620a,0x96fe,0x6664,0x7269,
-0x52ff,0x52a1,0x609f,0x8bef,0x6614,0x7199,0x6790,0x897f,
-0x7852,0x77fd,0x6670,0x563b,0x5438,0x9521,0x727a,0x0000,
-/* 0xcf00 */
-0x87a5,0x87a6,0x87a7,0x87a9,0x87aa,0x87ae,0x87b0,0x87b1,
-0x87b2,0x87b4,0x87b6,0x87b7,0x87b8,0x87b9,0x87bb,0x87bc,
-0x87be,0x87bf,0x87c1,0x87c2,0x87c3,0x87c4,0x87c5,0x87c7,
-0x87c8,0x87c9,0x87cc,0x87cd,0x87ce,0x87cf,0x87d0,0x87d4,
-0x87d5,0x87d6,0x87d7,0x87d8,0x87d9,0x87da,0x87dc,0x87dd,
-0x87de,0x87df,0x87e1,0x87e2,0x87e3,0x87e4,0x87e6,0x87e7,
-0x87e8,0x87e9,0x87eb,0x87ec,0x87ed,0x87ef,0x87f0,0x87f1,
-0x87f2,0x87f3,0x87f4,0x87f5,0x87f6,0x87f7,0x87f8,0x0000,
-0x87fa,0x87fb,0x87fc,0x87fd,0x87ff,0x8800,0x8801,0x8802,
-0x8804,0x8805,0x8806,0x8807,0x8808,0x8809,0x880b,0x880c,
-0x880d,0x880e,0x880f,0x8810,0x8811,0x8812,0x8814,0x8817,
-0x8818,0x8819,0x881a,0x881c,0x881d,0x881e,0x881f,0x8820,
-0x8823,0x7a00,0x606f,0x5e0c,0x6089,0x819d,0x5915,0x60dc,
-0x7184,0x70ef,0x6eaa,0x6c50,0x7280,0x6a84,0x88ad,0x5e2d,
-0x4e60,0x5ab3,0x559c,0x94e3,0x6d17,0x7cfb,0x9699,0x620f,
-0x7ec6,0x778e,0x867e,0x5323,0x971e,0x8f96,0x6687,0x5ce1,
-0x4fa0,0x72ed,0x4e0b,0x53a6,0x590f,0x5413,0x6380,0x9528,
-0x5148,0x4ed9,0x9c9c,0x7ea4,0x54b8,0x8d24,0x8854,0x8237,
-0x95f2,0x6d8e,0x5f26,0x5acc,0x663e,0x9669,0x73b0,0x732e,
-0x53bf,0x817a,0x9985,0x7fa1,0x5baa,0x9677,0x9650,0x7ebf,
-0x76f8,0x53a2,0x9576,0x9999,0x7bb1,0x8944,0x6e58,0x4e61,
-0x7fd4,0x7965,0x8be6,0x60f3,0x54cd,0x4eab,0x9879,0x5df7,
-0x6a61,0x50cf,0x5411,0x8c61,0x8427,0x785d,0x9704,0x524a,
-0x54ee,0x56a3,0x9500,0x6d88,0x5bb5,0x6dc6,0x6653,0x0000,
-/* 0xd000 */
-0x8824,0x8825,0x8826,0x8827,0x8828,0x8829,0x882a,0x882b,
-0x882c,0x882d,0x882e,0x882f,0x8830,0x8831,0x8833,0x8834,
-0x8835,0x8836,0x8837,0x8838,0x883a,0x883b,0x883d,0x883e,
-0x883f,0x8841,0x8842,0x8843,0x8846,0x8847,0x8848,0x8849,
-0x884a,0x884b,0x884e,0x884f,0x8850,0x8851,0x8852,0x8853,
-0x8855,0x8856,0x8858,0x885a,0x885b,0x885c,0x885d,0x885e,
-0x885f,0x8860,0x8866,0x8867,0x886a,0x886d,0x886f,0x8871,
-0x8873,0x8874,0x8875,0x8876,0x8878,0x8879,0x887a,0x0000,
-0x887b,0x887c,0x8880,0x8883,0x8886,0x8887,0x8889,0x888a,
-0x888c,0x888e,0x888f,0x8890,0x8891,0x8893,0x8894,0x8895,
-0x8897,0x8898,0x8899,0x889a,0x889b,0x889d,0x889e,0x889f,
-0x88a0,0x88a1,0x88a3,0x88a5,0x88a6,0x88a7,0x88a8,0x88a9,
-0x88aa,0x5c0f,0x5b5d,0x6821,0x8096,0x5578,0x7b11,0x6548,
-0x6954,0x4e9b,0x6b47,0x874e,0x978b,0x534f,0x631f,0x643a,
-0x90aa,0x659c,0x80c1,0x8c10,0x5199,0x68b0,0x5378,0x87f9,
-0x61c8,0x6cc4,0x6cfb,0x8c22,0x5c51,0x85aa,0x82af,0x950c,
-0x6b23,0x8f9b,0x65b0,0x5ffb,0x5fc3,0x4fe1,0x8845,0x661f,
-0x8165,0x7329,0x60fa,0x5174,0x5211,0x578b,0x5f62,0x90a2,
-0x884c,0x9192,0x5e78,0x674f,0x6027,0x59d3,0x5144,0x51f6,
-0x80f8,0x5308,0x6c79,0x96c4,0x718a,0x4f11,0x4fee,0x7f9e,
-0x673d,0x55c5,0x9508,0x79c0,0x8896,0x7ee3,0x589f,0x620c,
-0x9700,0x865a,0x5618,0x987b,0x5f90,0x8bb8,0x84c4,0x9157,
-0x53d9,0x65ed,0x5e8f,0x755c,0x6064,0x7d6e,0x5a7f,0x7eea,
-0x7eed,0x8f69,0x55a7,0x5ba3,0x60ac,0x65cb,0x7384,0x0000,
-/* 0xd100 */
-0x88ac,0x88ae,0x88af,0x88b0,0x88b2,0x88b3,0x88b4,0x88b5,
-0x88b6,0x88b8,0x88b9,0x88ba,0x88bb,0x88bd,0x88be,0x88bf,
-0x88c0,0x88c3,0x88c4,0x88c7,0x88c8,0x88ca,0x88cb,0x88cc,
-0x88cd,0x88cf,0x88d0,0x88d1,0x88d3,0x88d6,0x88d7,0x88da,
-0x88db,0x88dc,0x88dd,0x88de,0x88e0,0x88e1,0x88e6,0x88e7,
-0x88e9,0x88ea,0x88eb,0x88ec,0x88ed,0x88ee,0x88ef,0x88f2,
-0x88f5,0x88f6,0x88f7,0x88fa,0x88fb,0x88fd,0x88ff,0x8900,
-0x8901,0x8903,0x8904,0x8905,0x8906,0x8907,0x8908,0x0000,
-0x8909,0x890b,0x890c,0x890d,0x890e,0x890f,0x8911,0x8914,
-0x8915,0x8916,0x8917,0x8918,0x891c,0x891d,0x891e,0x891f,
-0x8920,0x8922,0x8923,0x8924,0x8926,0x8927,0x8928,0x8929,
-0x892c,0x892d,0x892e,0x892f,0x8931,0x8932,0x8933,0x8935,
-0x8937,0x9009,0x7663,0x7729,0x7eda,0x9774,0x859b,0x5b66,
-0x7a74,0x96ea,0x8840,0x52cb,0x718f,0x5faa,0x65ec,0x8be2,
-0x5bfb,0x9a6f,0x5de1,0x6b89,0x6c5b,0x8bad,0x8baf,0x900a,
-0x8fc5,0x538b,0x62bc,0x9e26,0x9e2d,0x5440,0x4e2b,0x82bd,
-0x7259,0x869c,0x5d16,0x8859,0x6daf,0x96c5,0x54d1,0x4e9a,
-0x8bb6,0x7109,0x54bd,0x9609,0x70df,0x6df9,0x76d0,0x4e25,
-0x7814,0x8712,0x5ca9,0x5ef6,0x8a00,0x989c,0x960e,0x708e,
-0x6cbf,0x5944,0x63a9,0x773c,0x884d,0x6f14,0x8273,0x5830,
-0x71d5,0x538c,0x781a,0x96c1,0x5501,0x5f66,0x7130,0x5bb4,
-0x8c1a,0x9a8c,0x6b83,0x592e,0x9e2f,0x79e7,0x6768,0x626c,
-0x4f6f,0x75a1,0x7f8a,0x6d0b,0x9633,0x6c27,0x4ef0,0x75d2,
-0x517b,0x6837,0x6f3e,0x9080,0x8170,0x5996,0x7476,0x0000,
-/* 0xd200 */
-0x8938,0x8939,0x893a,0x893b,0x893c,0x893d,0x893e,0x893f,
-0x8940,0x8942,0x8943,0x8945,0x8946,0x8947,0x8948,0x8949,
-0x894a,0x894b,0x894c,0x894d,0x894e,0x894f,0x8950,0x8951,
-0x8952,0x8953,0x8954,0x8955,0x8956,0x8957,0x8958,0x8959,
-0x895a,0x895b,0x895c,0x895d,0x8960,0x8961,0x8962,0x8963,
-0x8964,0x8965,0x8967,0x8968,0x8969,0x896a,0x896b,0x896c,
-0x896d,0x896e,0x896f,0x8970,0x8971,0x8972,0x8973,0x8974,
-0x8975,0x8976,0x8977,0x8978,0x8979,0x897a,0x897c,0x0000,
-0x897d,0x897e,0x8980,0x8982,0x8984,0x8985,0x8987,0x8988,
-0x8989,0x898a,0x898b,0x898c,0x898d,0x898e,0x898f,0x8990,
-0x8991,0x8992,0x8993,0x8994,0x8995,0x8996,0x8997,0x8998,
-0x8999,0x899a,0x899b,0x899c,0x899d,0x899e,0x899f,0x89a0,
-0x89a1,0x6447,0x5c27,0x9065,0x7a91,0x8c23,0x59da,0x54ac,
-0x8200,0x836f,0x8981,0x8000,0x6930,0x564e,0x8036,0x7237,
-0x91ce,0x51b6,0x4e5f,0x9875,0x6396,0x4e1a,0x53f6,0x66f3,
-0x814b,0x591c,0x6db2,0x4e00,0x58f9,0x533b,0x63d6,0x94f1,
-0x4f9d,0x4f0a,0x8863,0x9890,0x5937,0x9057,0x79fb,0x4eea,
-0x80f0,0x7591,0x6c82,0x5b9c,0x59e8,0x5f5d,0x6905,0x8681,
-0x501a,0x5df2,0x4e59,0x77e3,0x4ee5,0x827a,0x6291,0x6613,
-0x9091,0x5c79,0x4ebf,0x5f79,0x81c6,0x9038,0x8084,0x75ab,
-0x4ea6,0x88d4,0x610f,0x6bc5,0x5fc6,0x4e49,0x76ca,0x6ea2,
-0x8be3,0x8bae,0x8c0a,0x8bd1,0x5f02,0x7ffc,0x7fcc,0x7ece,
-0x8335,0x836b,0x56e0,0x6bb7,0x97f3,0x9634,0x59fb,0x541f,
-0x94f6,0x6deb,0x5bc5,0x996e,0x5c39,0x5f15,0x9690,0x0000,
-/* 0xd300 */
-0x89a2,0x89a3,0x89a4,0x89a5,0x89a6,0x89a7,0x89a8,0x89a9,
-0x89aa,0x89ab,0x89ac,0x89ad,0x89ae,0x89af,0x89b0,0x89b1,
-0x89b2,0x89b3,0x89b4,0x89b5,0x89b6,0x89b7,0x89b8,0x89b9,
-0x89ba,0x89bb,0x89bc,0x89bd,0x89be,0x89bf,0x89c0,0x89c3,
-0x89cd,0x89d3,0x89d4,0x89d5,0x89d7,0x89d8,0x89d9,0x89db,
-0x89dd,0x89df,0x89e0,0x89e1,0x89e2,0x89e4,0x89e7,0x89e8,
-0x89e9,0x89ea,0x89ec,0x89ed,0x89ee,0x89f0,0x89f1,0x89f2,
-0x89f4,0x89f5,0x89f6,0x89f7,0x89f8,0x89f9,0x89fa,0x0000,
-0x89fb,0x89fc,0x89fd,0x89fe,0x89ff,0x8a01,0x8a02,0x8a03,
-0x8a04,0x8a05,0x8a06,0x8a08,0x8a09,0x8a0a,0x8a0b,0x8a0c,
-0x8a0d,0x8a0e,0x8a0f,0x8a10,0x8a11,0x8a12,0x8a13,0x8a14,
-0x8a15,0x8a16,0x8a17,0x8a18,0x8a19,0x8a1a,0x8a1b,0x8a1c,
-0x8a1d,0x5370,0x82f1,0x6a31,0x5a74,0x9e70,0x5e94,0x7f28,
-0x83b9,0x8424,0x8425,0x8367,0x8747,0x8fce,0x8d62,0x76c8,
-0x5f71,0x9896,0x786c,0x6620,0x54df,0x62e5,0x4f63,0x81c3,
-0x75c8,0x5eb8,0x96cd,0x8e0a,0x86f9,0x548f,0x6cf3,0x6d8c,
-0x6c38,0x607f,0x52c7,0x7528,0x5e7d,0x4f18,0x60a0,0x5fe7,
-0x5c24,0x7531,0x90ae,0x94c0,0x72b9,0x6cb9,0x6e38,0x9149,
-0x6709,0x53cb,0x53f3,0x4f51,0x91c9,0x8bf1,0x53c8,0x5e7c,
-0x8fc2,0x6de4,0x4e8e,0x76c2,0x6986,0x865e,0x611a,0x8206,
-0x4f59,0x4fde,0x903e,0x9c7c,0x6109,0x6e1d,0x6e14,0x9685,
-0x4e88,0x5a31,0x96e8,0x4e0e,0x5c7f,0x79b9,0x5b87,0x8bed,
-0x7fbd,0x7389,0x57df,0x828b,0x90c1,0x5401,0x9047,0x55bb,
-0x5cea,0x5fa1,0x6108,0x6b32,0x72f1,0x80b2,0x8a89,0x0000,
-/* 0xd400 */
-0x8a1e,0x8a1f,0x8a20,0x8a21,0x8a22,0x8a23,0x8a24,0x8a25,
-0x8a26,0x8a27,0x8a28,0x8a29,0x8a2a,0x8a2b,0x8a2c,0x8a2d,
-0x8a2e,0x8a2f,0x8a30,0x8a31,0x8a32,0x8a33,0x8a34,0x8a35,
-0x8a36,0x8a37,0x8a38,0x8a39,0x8a3a,0x8a3b,0x8a3c,0x8a3d,
-0x8a3f,0x8a40,0x8a41,0x8a42,0x8a43,0x8a44,0x8a45,0x8a46,
-0x8a47,0x8a49,0x8a4a,0x8a4b,0x8a4c,0x8a4d,0x8a4e,0x8a4f,
-0x8a50,0x8a51,0x8a52,0x8a53,0x8a54,0x8a55,0x8a56,0x8a57,
-0x8a58,0x8a59,0x8a5a,0x8a5b,0x8a5c,0x8a5d,0x8a5e,0x0000,
-0x8a5f,0x8a60,0x8a61,0x8a62,0x8a63,0x8a64,0x8a65,0x8a66,
-0x8a67,0x8a68,0x8a69,0x8a6a,0x8a6b,0x8a6c,0x8a6d,0x8a6e,
-0x8a6f,0x8a70,0x8a71,0x8a72,0x8a73,0x8a74,0x8a75,0x8a76,
-0x8a77,0x8a78,0x8a7a,0x8a7b,0x8a7c,0x8a7d,0x8a7e,0x8a7f,
-0x8a80,0x6d74,0x5bd3,0x88d5,0x9884,0x8c6b,0x9a6d,0x9e33,
-0x6e0a,0x51a4,0x5143,0x57a3,0x8881,0x539f,0x63f4,0x8f95,
-0x56ed,0x5458,0x5706,0x733f,0x6e90,0x7f18,0x8fdc,0x82d1,
-0x613f,0x6028,0x9662,0x66f0,0x7ea6,0x8d8a,0x8dc3,0x94a5,
-0x5cb3,0x7ca4,0x6708,0x60a6,0x9605,0x8018,0x4e91,0x90e7,
-0x5300,0x9668,0x5141,0x8fd0,0x8574,0x915d,0x6655,0x97f5,
-0x5b55,0x531d,0x7838,0x6742,0x683d,0x54c9,0x707e,0x5bb0,
-0x8f7d,0x518d,0x5728,0x54b1,0x6512,0x6682,0x8d5e,0x8d43,
-0x810f,0x846c,0x906d,0x7cdf,0x51ff,0x85fb,0x67a3,0x65e9,
-0x6fa1,0x86a4,0x8e81,0x566a,0x9020,0x7682,0x7076,0x71e5,
-0x8d23,0x62e9,0x5219,0x6cfd,0x8d3c,0x600e,0x589e,0x618e,
-0x66fe,0x8d60,0x624e,0x55b3,0x6e23,0x672d,0x8f67,0x0000,
-/* 0xd500 */
-0x8a81,0x8a82,0x8a83,0x8a84,0x8a85,0x8a86,0x8a87,0x8a88,
-0x8a8b,0x8a8c,0x8a8d,0x8a8e,0x8a8f,0x8a90,0x8a91,0x8a92,
-0x8a94,0x8a95,0x8a96,0x8a97,0x8a98,0x8a99,0x8a9a,0x8a9b,
-0x8a9c,0x8a9d,0x8a9e,0x8a9f,0x8aa0,0x8aa1,0x8aa2,0x8aa3,
-0x8aa4,0x8aa5,0x8aa6,0x8aa7,0x8aa8,0x8aa9,0x8aaa,0x8aab,
-0x8aac,0x8aad,0x8aae,0x8aaf,0x8ab0,0x8ab1,0x8ab2,0x8ab3,
-0x8ab4,0x8ab5,0x8ab6,0x8ab7,0x8ab8,0x8ab9,0x8aba,0x8abb,
-0x8abc,0x8abd,0x8abe,0x8abf,0x8ac0,0x8ac1,0x8ac2,0x0000,
-0x8ac3,0x8ac4,0x8ac5,0x8ac6,0x8ac7,0x8ac8,0x8ac9,0x8aca,
-0x8acb,0x8acc,0x8acd,0x8ace,0x8acf,0x8ad0,0x8ad1,0x8ad2,
-0x8ad3,0x8ad4,0x8ad5,0x8ad6,0x8ad7,0x8ad8,0x8ad9,0x8ada,
-0x8adb,0x8adc,0x8add,0x8ade,0x8adf,0x8ae0,0x8ae1,0x8ae2,
-0x8ae3,0x94e1,0x95f8,0x7728,0x6805,0x69a8,0x548b,0x4e4d,
-0x70b8,0x8bc8,0x6458,0x658b,0x5b85,0x7a84,0x503a,0x5be8,
-0x77bb,0x6be1,0x8a79,0x7c98,0x6cbe,0x76cf,0x65a9,0x8f97,
-0x5d2d,0x5c55,0x8638,0x6808,0x5360,0x6218,0x7ad9,0x6e5b,
-0x7efd,0x6a1f,0x7ae0,0x5f70,0x6f33,0x5f20,0x638c,0x6da8,
-0x6756,0x4e08,0x5e10,0x8d26,0x4ed7,0x80c0,0x7634,0x969c,
-0x62db,0x662d,0x627e,0x6cbc,0x8d75,0x7167,0x7f69,0x5146,
-0x8087,0x53ec,0x906e,0x6298,0x54f2,0x86f0,0x8f99,0x8005,
-0x9517,0x8517,0x8fd9,0x6d59,0x73cd,0x659f,0x771f,0x7504,
-0x7827,0x81fb,0x8d1e,0x9488,0x4fa6,0x6795,0x75b9,0x8bca,
-0x9707,0x632f,0x9547,0x9635,0x84b8,0x6323,0x7741,0x5f81,
-0x72f0,0x4e89,0x6014,0x6574,0x62ef,0x6b63,0x653f,0x0000,
-/* 0xd600 */
-0x8ae4,0x8ae5,0x8ae6,0x8ae7,0x8ae8,0x8ae9,0x8aea,0x8aeb,
-0x8aec,0x8aed,0x8aee,0x8aef,0x8af0,0x8af1,0x8af2,0x8af3,
-0x8af4,0x8af5,0x8af6,0x8af7,0x8af8,0x8af9,0x8afa,0x8afb,
-0x8afc,0x8afd,0x8afe,0x8aff,0x8b00,0x8b01,0x8b02,0x8b03,
-0x8b04,0x8b05,0x8b06,0x8b08,0x8b09,0x8b0a,0x8b0b,0x8b0c,
-0x8b0d,0x8b0e,0x8b0f,0x8b10,0x8b11,0x8b12,0x8b13,0x8b14,
-0x8b15,0x8b16,0x8b17,0x8b18,0x8b19,0x8b1a,0x8b1b,0x8b1c,
-0x8b1d,0x8b1e,0x8b1f,0x8b20,0x8b21,0x8b22,0x8b23,0x0000,
-0x8b24,0x8b25,0x8b27,0x8b28,0x8b29,0x8b2a,0x8b2b,0x8b2c,
-0x8b2d,0x8b2e,0x8b2f,0x8b30,0x8b31,0x8b32,0x8b33,0x8b34,
-0x8b35,0x8b36,0x8b37,0x8b38,0x8b39,0x8b3a,0x8b3b,0x8b3c,
-0x8b3d,0x8b3e,0x8b3f,0x8b40,0x8b41,0x8b42,0x8b43,0x8b44,
-0x8b45,0x5e27,0x75c7,0x90d1,0x8bc1,0x829d,0x679d,0x652f,
-0x5431,0x8718,0x77e5,0x80a2,0x8102,0x6c41,0x4e4b,0x7ec7,
-0x804c,0x76f4,0x690d,0x6b96,0x6267,0x503c,0x4f84,0x5740,
-0x6307,0x6b62,0x8dbe,0x53ea,0x65e8,0x7eb8,0x5fd7,0x631a,
-0x63b7,0x81f3,0x81f4,0x7f6e,0x5e1c,0x5cd9,0x5236,0x667a,
-0x79e9,0x7a1a,0x8d28,0x7099,0x75d4,0x6ede,0x6cbb,0x7a92,
-0x4e2d,0x76c5,0x5fe0,0x949f,0x8877,0x7ec8,0x79cd,0x80bf,
-0x91cd,0x4ef2,0x4f17,0x821f,0x5468,0x5dde,0x6d32,0x8bcc,
-0x7ca5,0x8f74,0x8098,0x5e1a,0x5492,0x76b1,0x5b99,0x663c,
-0x9aa4,0x73e0,0x682a,0x86db,0x6731,0x732a,0x8bf8,0x8bdb,
-0x9010,0x7af9,0x70db,0x716e,0x62c4,0x77a9,0x5631,0x4e3b,
-0x8457,0x67f1,0x52a9,0x86c0,0x8d2e,0x94f8,0x7b51,0x0000,
-/* 0xd700 */
-0x8b46,0x8b47,0x8b48,0x8b49,0x8b4a,0x8b4b,0x8b4c,0x8b4d,
-0x8b4e,0x8b4f,0x8b50,0x8b51,0x8b52,0x8b53,0x8b54,0x8b55,
-0x8b56,0x8b57,0x8b58,0x8b59,0x8b5a,0x8b5b,0x8b5c,0x8b5d,
-0x8b5e,0x8b5f,0x8b60,0x8b61,0x8b62,0x8b63,0x8b64,0x8b65,
-0x8b67,0x8b68,0x8b69,0x8b6a,0x8b6b,0x8b6d,0x8b6e,0x8b6f,
-0x8b70,0x8b71,0x8b72,0x8b73,0x8b74,0x8b75,0x8b76,0x8b77,
-0x8b78,0x8b79,0x8b7a,0x8b7b,0x8b7c,0x8b7d,0x8b7e,0x8b7f,
-0x8b80,0x8b81,0x8b82,0x8b83,0x8b84,0x8b85,0x8b86,0x0000,
-0x8b87,0x8b88,0x8b89,0x8b8a,0x8b8b,0x8b8c,0x8b8d,0x8b8e,
-0x8b8f,0x8b90,0x8b91,0x8b92,0x8b93,0x8b94,0x8b95,0x8b96,
-0x8b97,0x8b98,0x8b99,0x8b9a,0x8b9b,0x8b9c,0x8b9d,0x8b9e,
-0x8b9f,0x8bac,0x8bb1,0x8bbb,0x8bc7,0x8bd0,0x8bea,0x8c09,
-0x8c1e,0x4f4f,0x6ce8,0x795d,0x9a7b,0x6293,0x722a,0x62fd,
-0x4e13,0x7816,0x8f6c,0x64b0,0x8d5a,0x7bc6,0x6869,0x5e84,
-0x88c5,0x5986,0x649e,0x58ee,0x72b6,0x690e,0x9525,0x8ffd,
-0x8d58,0x5760,0x7f00,0x8c06,0x51c6,0x6349,0x62d9,0x5353,
-0x684c,0x7422,0x8301,0x914c,0x5544,0x7740,0x707c,0x6d4a,
-0x5179,0x54a8,0x8d44,0x59ff,0x6ecb,0x6dc4,0x5b5c,0x7d2b,
-0x4ed4,0x7c7d,0x6ed3,0x5b50,0x81ea,0x6e0d,0x5b57,0x9b03,
-0x68d5,0x8e2a,0x5b97,0x7efc,0x603b,0x7eb5,0x90b9,0x8d70,
-0x594f,0x63cd,0x79df,0x8db3,0x5352,0x65cf,0x7956,0x8bc5,
-0x963b,0x7ec4,0x94bb,0x7e82,0x5634,0x9189,0x6700,0x7f6a,
-0x5c0a,0x9075,0x6628,0x5de6,0x4f50,0x67de,0x505a,0x4f5c,
-0x5750,0x5ea7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xd800 */
-0x8c38,0x8c39,0x8c3a,0x8c3b,0x8c3c,0x8c3d,0x8c3e,0x8c3f,
-0x8c40,0x8c42,0x8c43,0x8c44,0x8c45,0x8c48,0x8c4a,0x8c4b,
-0x8c4d,0x8c4e,0x8c4f,0x8c50,0x8c51,0x8c52,0x8c53,0x8c54,
-0x8c56,0x8c57,0x8c58,0x8c59,0x8c5b,0x8c5c,0x8c5d,0x8c5e,
-0x8c5f,0x8c60,0x8c63,0x8c64,0x8c65,0x8c66,0x8c67,0x8c68,
-0x8c69,0x8c6c,0x8c6d,0x8c6e,0x8c6f,0x8c70,0x8c71,0x8c72,
-0x8c74,0x8c75,0x8c76,0x8c77,0x8c7b,0x8c7c,0x8c7d,0x8c7e,
-0x8c7f,0x8c80,0x8c81,0x8c83,0x8c84,0x8c86,0x8c87,0x0000,
-0x8c88,0x8c8b,0x8c8d,0x8c8e,0x8c8f,0x8c90,0x8c91,0x8c92,
-0x8c93,0x8c95,0x8c96,0x8c97,0x8c99,0x8c9a,0x8c9b,0x8c9c,
-0x8c9d,0x8c9e,0x8c9f,0x8ca0,0x8ca1,0x8ca2,0x8ca3,0x8ca4,
-0x8ca5,0x8ca6,0x8ca7,0x8ca8,0x8ca9,0x8caa,0x8cab,0x8cac,
-0x8cad,0x4e8d,0x4e0c,0x5140,0x4e10,0x5eff,0x5345,0x4e15,
-0x4e98,0x4e1e,0x9b32,0x5b6c,0x5669,0x4e28,0x79ba,0x4e3f,
-0x5315,0x4e47,0x592d,0x723b,0x536e,0x6c10,0x56df,0x80e4,
-0x9997,0x6bd3,0x777e,0x9f17,0x4e36,0x4e9f,0x9f10,0x4e5c,
-0x4e69,0x4e93,0x8288,0x5b5b,0x556c,0x560f,0x4ec4,0x538d,
-0x539d,0x53a3,0x53a5,0x53ae,0x9765,0x8d5d,0x531a,0x53f5,
-0x5326,0x532e,0x533e,0x8d5c,0x5366,0x5363,0x5202,0x5208,
-0x520e,0x522d,0x5233,0x523f,0x5240,0x524c,0x525e,0x5261,
-0x525c,0x84af,0x527d,0x5282,0x5281,0x5290,0x5293,0x5182,
-0x7f54,0x4ebb,0x4ec3,0x4ec9,0x4ec2,0x4ee8,0x4ee1,0x4eeb,
-0x4ede,0x4f1b,0x4ef3,0x4f22,0x4f64,0x4ef5,0x4f25,0x4f27,
-0x4f09,0x4f2b,0x4f5e,0x4f67,0x6538,0x4f5a,0x4f5d,0x0000,
-/* 0xd900 */
-0x8cae,0x8caf,0x8cb0,0x8cb1,0x8cb2,0x8cb3,0x8cb4,0x8cb5,
-0x8cb6,0x8cb7,0x8cb8,0x8cb9,0x8cba,0x8cbb,0x8cbc,0x8cbd,
-0x8cbe,0x8cbf,0x8cc0,0x8cc1,0x8cc2,0x8cc3,0x8cc4,0x8cc5,
-0x8cc6,0x8cc7,0x8cc8,0x8cc9,0x8cca,0x8ccb,0x8ccc,0x8ccd,
-0x8cce,0x8ccf,0x8cd0,0x8cd1,0x8cd2,0x8cd3,0x8cd4,0x8cd5,
-0x8cd6,0x8cd7,0x8cd8,0x8cd9,0x8cda,0x8cdb,0x8cdc,0x8cdd,
-0x8cde,0x8cdf,0x8ce0,0x8ce1,0x8ce2,0x8ce3,0x8ce4,0x8ce5,
-0x8ce6,0x8ce7,0x8ce8,0x8ce9,0x8cea,0x8ceb,0x8cec,0x0000,
-0x8ced,0x8cee,0x8cef,0x8cf0,0x8cf1,0x8cf2,0x8cf3,0x8cf4,
-0x8cf5,0x8cf6,0x8cf7,0x8cf8,0x8cf9,0x8cfa,0x8cfb,0x8cfc,
-0x8cfd,0x8cfe,0x8cff,0x8d00,0x8d01,0x8d02,0x8d03,0x8d04,
-0x8d05,0x8d06,0x8d07,0x8d08,0x8d09,0x8d0a,0x8d0b,0x8d0c,
-0x8d0d,0x4f5f,0x4f57,0x4f32,0x4f3d,0x4f76,0x4f74,0x4f91,
-0x4f89,0x4f83,0x4f8f,0x4f7e,0x4f7b,0x4faa,0x4f7c,0x4fac,
-0x4f94,0x4fe6,0x4fe8,0x4fea,0x4fc5,0x4fda,0x4fe3,0x4fdc,
-0x4fd1,0x4fdf,0x4ff8,0x5029,0x504c,0x4ff3,0x502c,0x500f,
-0x502e,0x502d,0x4ffe,0x501c,0x500c,0x5025,0x5028,0x507e,
-0x5043,0x5055,0x5048,0x504e,0x506c,0x507b,0x50a5,0x50a7,
-0x50a9,0x50ba,0x50d6,0x5106,0x50ed,0x50ec,0x50e6,0x50ee,
-0x5107,0x510b,0x4edd,0x6c3d,0x4f58,0x4f65,0x4fce,0x9fa0,
-0x6c46,0x7c74,0x516e,0x5dfd,0x9ec9,0x9998,0x5181,0x5914,
-0x52f9,0x530d,0x8a07,0x5310,0x51eb,0x5919,0x5155,0x4ea0,
-0x5156,0x4eb3,0x886e,0x88a4,0x4eb5,0x8114,0x88d2,0x7980,
-0x5b34,0x8803,0x7fb8,0x51ab,0x51b1,0x51bd,0x51bc,0x0000,
-/* 0xda00 */
-0x8d0e,0x8d0f,0x8d10,0x8d11,0x8d12,0x8d13,0x8d14,0x8d15,
-0x8d16,0x8d17,0x8d18,0x8d19,0x8d1a,0x8d1b,0x8d1c,0x8d20,
-0x8d51,0x8d52,0x8d57,0x8d5f,0x8d65,0x8d68,0x8d69,0x8d6a,
-0x8d6c,0x8d6e,0x8d6f,0x8d71,0x8d72,0x8d78,0x8d79,0x8d7a,
-0x8d7b,0x8d7c,0x8d7d,0x8d7e,0x8d7f,0x8d80,0x8d82,0x8d83,
-0x8d86,0x8d87,0x8d88,0x8d89,0x8d8c,0x8d8d,0x8d8e,0x8d8f,
-0x8d90,0x8d92,0x8d93,0x8d95,0x8d96,0x8d97,0x8d98,0x8d99,
-0x8d9a,0x8d9b,0x8d9c,0x8d9d,0x8d9e,0x8da0,0x8da1,0x0000,
-0x8da2,0x8da4,0x8da5,0x8da6,0x8da7,0x8da8,0x8da9,0x8daa,
-0x8dab,0x8dac,0x8dad,0x8dae,0x8daf,0x8db0,0x8db2,0x8db6,
-0x8db7,0x8db9,0x8dbb,0x8dbd,0x8dc0,0x8dc1,0x8dc2,0x8dc5,
-0x8dc7,0x8dc8,0x8dc9,0x8dca,0x8dcd,0x8dd0,0x8dd2,0x8dd3,
-0x8dd4,0x51c7,0x5196,0x51a2,0x51a5,0x8ba0,0x8ba6,0x8ba7,
-0x8baa,0x8bb4,0x8bb5,0x8bb7,0x8bc2,0x8bc3,0x8bcb,0x8bcf,
-0x8bce,0x8bd2,0x8bd3,0x8bd4,0x8bd6,0x8bd8,0x8bd9,0x8bdc,
-0x8bdf,0x8be0,0x8be4,0x8be8,0x8be9,0x8bee,0x8bf0,0x8bf3,
-0x8bf6,0x8bf9,0x8bfc,0x8bff,0x8c00,0x8c02,0x8c04,0x8c07,
-0x8c0c,0x8c0f,0x8c11,0x8c12,0x8c14,0x8c15,0x8c16,0x8c19,
-0x8c1b,0x8c18,0x8c1d,0x8c1f,0x8c20,0x8c21,0x8c25,0x8c27,
-0x8c2a,0x8c2b,0x8c2e,0x8c2f,0x8c32,0x8c33,0x8c35,0x8c36,
-0x5369,0x537a,0x961d,0x9622,0x9621,0x9631,0x962a,0x963d,
-0x963c,0x9642,0x9649,0x9654,0x965f,0x9667,0x966c,0x9672,
-0x9674,0x9688,0x968d,0x9697,0x96b0,0x9097,0x909b,0x909d,
-0x9099,0x90ac,0x90a1,0x90b4,0x90b3,0x90b6,0x90ba,0x0000,
-/* 0xdb00 */
-0x8dd5,0x8dd8,0x8dd9,0x8ddc,0x8de0,0x8de1,0x8de2,0x8de5,
-0x8de6,0x8de7,0x8de9,0x8ded,0x8dee,0x8df0,0x8df1,0x8df2,
-0x8df4,0x8df6,0x8dfc,0x8dfe,0x8dff,0x8e00,0x8e01,0x8e02,
-0x8e03,0x8e04,0x8e06,0x8e07,0x8e08,0x8e0b,0x8e0d,0x8e0e,
-0x8e10,0x8e11,0x8e12,0x8e13,0x8e15,0x8e16,0x8e17,0x8e18,
-0x8e19,0x8e1a,0x8e1b,0x8e1c,0x8e20,0x8e21,0x8e24,0x8e25,
-0x8e26,0x8e27,0x8e28,0x8e2b,0x8e2d,0x8e30,0x8e32,0x8e33,
-0x8e34,0x8e36,0x8e37,0x8e38,0x8e3b,0x8e3c,0x8e3e,0x0000,
-0x8e3f,0x8e43,0x8e45,0x8e46,0x8e4c,0x8e4d,0x8e4e,0x8e4f,
-0x8e50,0x8e53,0x8e54,0x8e55,0x8e56,0x8e57,0x8e58,0x8e5a,
-0x8e5b,0x8e5c,0x8e5d,0x8e5e,0x8e5f,0x8e60,0x8e61,0x8e62,
-0x8e63,0x8e64,0x8e65,0x8e67,0x8e68,0x8e6a,0x8e6b,0x8e6e,
-0x8e71,0x90b8,0x90b0,0x90cf,0x90c5,0x90be,0x90d0,0x90c4,
-0x90c7,0x90d3,0x90e6,0x90e2,0x90dc,0x90d7,0x90db,0x90eb,
-0x90ef,0x90fe,0x9104,0x9122,0x911e,0x9123,0x9131,0x912f,
-0x9139,0x9143,0x9146,0x520d,0x5942,0x52a2,0x52ac,0x52ad,
-0x52be,0x54ff,0x52d0,0x52d6,0x52f0,0x53df,0x71ee,0x77cd,
-0x5ef4,0x51f5,0x51fc,0x9b2f,0x53b6,0x5f01,0x755a,0x5def,
-0x574c,0x57a9,0x57a1,0x587e,0x58bc,0x58c5,0x58d1,0x5729,
-0x572c,0x572a,0x5733,0x5739,0x572e,0x572f,0x575c,0x573b,
-0x5742,0x5769,0x5785,0x576b,0x5786,0x577c,0x577b,0x5768,
-0x576d,0x5776,0x5773,0x57ad,0x57a4,0x578c,0x57b2,0x57cf,
-0x57a7,0x57b4,0x5793,0x57a0,0x57d5,0x57d8,0x57da,0x57d9,
-0x57d2,0x57b8,0x57f4,0x57ef,0x57f8,0x57e4,0x57dd,0x0000,
-/* 0xdc00 */
-0x8e73,0x8e75,0x8e77,0x8e78,0x8e79,0x8e7a,0x8e7b,0x8e7d,
-0x8e7e,0x8e80,0x8e82,0x8e83,0x8e84,0x8e86,0x8e88,0x8e89,
-0x8e8a,0x8e8b,0x8e8c,0x8e8d,0x8e8e,0x8e91,0x8e92,0x8e93,
-0x8e95,0x8e96,0x8e97,0x8e98,0x8e99,0x8e9a,0x8e9b,0x8e9d,
-0x8e9f,0x8ea0,0x8ea1,0x8ea2,0x8ea3,0x8ea4,0x8ea5,0x8ea6,
-0x8ea7,0x8ea8,0x8ea9,0x8eaa,0x8ead,0x8eae,0x8eb0,0x8eb1,
-0x8eb3,0x8eb4,0x8eb5,0x8eb6,0x8eb7,0x8eb8,0x8eb9,0x8ebb,
-0x8ebc,0x8ebd,0x8ebe,0x8ebf,0x8ec0,0x8ec1,0x8ec2,0x0000,
-0x8ec3,0x8ec4,0x8ec5,0x8ec6,0x8ec7,0x8ec8,0x8ec9,0x8eca,
-0x8ecb,0x8ecc,0x8ecd,0x8ecf,0x8ed0,0x8ed1,0x8ed2,0x8ed3,
-0x8ed4,0x8ed5,0x8ed6,0x8ed7,0x8ed8,0x8ed9,0x8eda,0x8edb,
-0x8edc,0x8edd,0x8ede,0x8edf,0x8ee0,0x8ee1,0x8ee2,0x8ee3,
-0x8ee4,0x580b,0x580d,0x57fd,0x57ed,0x5800,0x581e,0x5819,
-0x5844,0x5820,0x5865,0x586c,0x5881,0x5889,0x589a,0x5880,
-0x99a8,0x9f19,0x61ff,0x8279,0x827d,0x827f,0x828f,0x828a,
-0x82a8,0x8284,0x828e,0x8291,0x8297,0x8299,0x82ab,0x82b8,
-0x82be,0x82b0,0x82c8,0x82ca,0x82e3,0x8298,0x82b7,0x82ae,
-0x82cb,0x82cc,0x82c1,0x82a9,0x82b4,0x82a1,0x82aa,0x829f,
-0x82c4,0x82ce,0x82a4,0x82e1,0x8309,0x82f7,0x82e4,0x830f,
-0x8307,0x82dc,0x82f4,0x82d2,0x82d8,0x830c,0x82fb,0x82d3,
-0x8311,0x831a,0x8306,0x8314,0x8315,0x82e0,0x82d5,0x831c,
-0x8351,0x835b,0x835c,0x8308,0x8392,0x833c,0x8334,0x8331,
-0x839b,0x835e,0x832f,0x834f,0x8347,0x8343,0x835f,0x8340,
-0x8317,0x8360,0x832d,0x833a,0x8333,0x8366,0x8365,0x0000,
-/* 0xdd00 */
-0x8ee5,0x8ee6,0x8ee7,0x8ee8,0x8ee9,0x8eea,0x8eeb,0x8eec,
-0x8eed,0x8eee,0x8eef,0x8ef0,0x8ef1,0x8ef2,0x8ef3,0x8ef4,
-0x8ef5,0x8ef6,0x8ef7,0x8ef8,0x8ef9,0x8efa,0x8efb,0x8efc,
-0x8efd,0x8efe,0x8eff,0x8f00,0x8f01,0x8f02,0x8f03,0x8f04,
-0x8f05,0x8f06,0x8f07,0x8f08,0x8f09,0x8f0a,0x8f0b,0x8f0c,
-0x8f0d,0x8f0e,0x8f0f,0x8f10,0x8f11,0x8f12,0x8f13,0x8f14,
-0x8f15,0x8f16,0x8f17,0x8f18,0x8f19,0x8f1a,0x8f1b,0x8f1c,
-0x8f1d,0x8f1e,0x8f1f,0x8f20,0x8f21,0x8f22,0x8f23,0x0000,
-0x8f24,0x8f25,0x8f26,0x8f27,0x8f28,0x8f29,0x8f2a,0x8f2b,
-0x8f2c,0x8f2d,0x8f2e,0x8f2f,0x8f30,0x8f31,0x8f32,0x8f33,
-0x8f34,0x8f35,0x8f36,0x8f37,0x8f38,0x8f39,0x8f3a,0x8f3b,
-0x8f3c,0x8f3d,0x8f3e,0x8f3f,0x8f40,0x8f41,0x8f42,0x8f43,
-0x8f44,0x8368,0x831b,0x8369,0x836c,0x836a,0x836d,0x836e,
-0x83b0,0x8378,0x83b3,0x83b4,0x83a0,0x83aa,0x8393,0x839c,
-0x8385,0x837c,0x83b6,0x83a9,0x837d,0x83b8,0x837b,0x8398,
-0x839e,0x83a8,0x83ba,0x83bc,0x83c1,0x8401,0x83e5,0x83d8,
-0x5807,0x8418,0x840b,0x83dd,0x83fd,0x83d6,0x841c,0x8438,
-0x8411,0x8406,0x83d4,0x83df,0x840f,0x8403,0x83f8,0x83f9,
-0x83ea,0x83c5,0x83c0,0x8426,0x83f0,0x83e1,0x845c,0x8451,
-0x845a,0x8459,0x8473,0x8487,0x8488,0x847a,0x8489,0x8478,
-0x843c,0x8446,0x8469,0x8476,0x848c,0x848e,0x8431,0x846d,
-0x84c1,0x84cd,0x84d0,0x84e6,0x84bd,0x84d3,0x84ca,0x84bf,
-0x84ba,0x84e0,0x84a1,0x84b9,0x84b4,0x8497,0x84e5,0x84e3,
-0x850c,0x750d,0x8538,0x84f0,0x8539,0x851f,0x853a,0x0000,
-/* 0xde00 */
-0x8f45,0x8f46,0x8f47,0x8f48,0x8f49,0x8f4a,0x8f4b,0x8f4c,
-0x8f4d,0x8f4e,0x8f4f,0x8f50,0x8f51,0x8f52,0x8f53,0x8f54,
-0x8f55,0x8f56,0x8f57,0x8f58,0x8f59,0x8f5a,0x8f5b,0x8f5c,
-0x8f5d,0x8f5e,0x8f5f,0x8f60,0x8f61,0x8f62,0x8f63,0x8f64,
-0x8f65,0x8f6a,0x8f80,0x8f8c,0x8f92,0x8f9d,0x8fa0,0x8fa1,
-0x8fa2,0x8fa4,0x8fa5,0x8fa6,0x8fa7,0x8faa,0x8fac,0x8fad,
-0x8fae,0x8faf,0x8fb2,0x8fb3,0x8fb4,0x8fb5,0x8fb7,0x8fb8,
-0x8fba,0x8fbb,0x8fbc,0x8fbf,0x8fc0,0x8fc3,0x8fc6,0x0000,
-0x8fc9,0x8fca,0x8fcb,0x8fcc,0x8fcd,0x8fcf,0x8fd2,0x8fd6,
-0x8fd7,0x8fda,0x8fe0,0x8fe1,0x8fe3,0x8fe7,0x8fec,0x8fef,
-0x8ff1,0x8ff2,0x8ff4,0x8ff5,0x8ff6,0x8ffa,0x8ffb,0x8ffc,
-0x8ffe,0x8fff,0x9007,0x9008,0x900c,0x900e,0x9013,0x9015,
-0x9018,0x8556,0x853b,0x84ff,0x84fc,0x8559,0x8548,0x8568,
-0x8564,0x855e,0x857a,0x77a2,0x8543,0x8572,0x857b,0x85a4,
-0x85a8,0x8587,0x858f,0x8579,0x85ae,0x859c,0x8585,0x85b9,
-0x85b7,0x85b0,0x85d3,0x85c1,0x85dc,0x85ff,0x8627,0x8605,
-0x8629,0x8616,0x863c,0x5efe,0x5f08,0x593c,0x5941,0x8037,
-0x5955,0x595a,0x5958,0x530f,0x5c22,0x5c25,0x5c2c,0x5c34,
-0x624c,0x626a,0x629f,0x62bb,0x62ca,0x62da,0x62d7,0x62ee,
-0x6322,0x62f6,0x6339,0x634b,0x6343,0x63ad,0x63f6,0x6371,
-0x637a,0x638e,0x63b4,0x636d,0x63ac,0x638a,0x6369,0x63ae,
-0x63bc,0x63f2,0x63f8,0x63e0,0x63ff,0x63c4,0x63de,0x63ce,
-0x6452,0x63c6,0x63be,0x6445,0x6441,0x640b,0x641b,0x6420,
-0x640c,0x6426,0x6421,0x645e,0x6484,0x646d,0x6496,0x0000,
-/* 0xdf00 */
-0x9019,0x901c,0x9023,0x9024,0x9025,0x9027,0x9028,0x9029,
-0x902a,0x902b,0x902c,0x9030,0x9031,0x9032,0x9033,0x9034,
-0x9037,0x9039,0x903a,0x903d,0x903f,0x9040,0x9043,0x9045,
-0x9046,0x9048,0x9049,0x904a,0x904b,0x904c,0x904e,0x9054,
-0x9055,0x9056,0x9059,0x905a,0x905c,0x905d,0x905e,0x905f,
-0x9060,0x9061,0x9064,0x9066,0x9067,0x9069,0x906a,0x906b,
-0x906c,0x906f,0x9070,0x9071,0x9072,0x9073,0x9076,0x9077,
-0x9078,0x9079,0x907a,0x907b,0x907c,0x907e,0x9081,0x0000,
-0x9084,0x9085,0x9086,0x9087,0x9089,0x908a,0x908c,0x908d,
-0x908e,0x908f,0x9090,0x9092,0x9094,0x9096,0x9098,0x909a,
-0x909c,0x909e,0x909f,0x90a0,0x90a4,0x90a5,0x90a7,0x90a8,
-0x90a9,0x90ab,0x90ad,0x90b2,0x90b7,0x90bc,0x90bd,0x90bf,
-0x90c0,0x647a,0x64b7,0x64b8,0x6499,0x64ba,0x64c0,0x64d0,
-0x64d7,0x64e4,0x64e2,0x6509,0x6525,0x652e,0x5f0b,0x5fd2,
-0x7519,0x5f11,0x535f,0x53f1,0x53fd,0x53e9,0x53e8,0x53fb,
-0x5412,0x5416,0x5406,0x544b,0x5452,0x5453,0x5454,0x5456,
-0x5443,0x5421,0x5457,0x5459,0x5423,0x5432,0x5482,0x5494,
-0x5477,0x5471,0x5464,0x549a,0x549b,0x5484,0x5476,0x5466,
-0x549d,0x54d0,0x54ad,0x54c2,0x54b4,0x54d2,0x54a7,0x54a6,
-0x54d3,0x54d4,0x5472,0x54a3,0x54d5,0x54bb,0x54bf,0x54cc,
-0x54d9,0x54da,0x54dc,0x54a9,0x54aa,0x54a4,0x54dd,0x54cf,
-0x54de,0x551b,0x54e7,0x5520,0x54fd,0x5514,0x54f3,0x5522,
-0x5523,0x550f,0x5511,0x5527,0x552a,0x5567,0x558f,0x55b5,
-0x5549,0x556d,0x5541,0x5555,0x553f,0x5550,0x553c,0x0000,
-/* 0xe000 */
-0x90c2,0x90c3,0x90c6,0x90c8,0x90c9,0x90cb,0x90cc,0x90cd,
-0x90d2,0x90d4,0x90d5,0x90d6,0x90d8,0x90d9,0x90da,0x90de,
-0x90df,0x90e0,0x90e3,0x90e4,0x90e5,0x90e9,0x90ea,0x90ec,
-0x90ee,0x90f0,0x90f1,0x90f2,0x90f3,0x90f5,0x90f6,0x90f7,
-0x90f9,0x90fa,0x90fb,0x90fc,0x90ff,0x9100,0x9101,0x9103,
-0x9105,0x9106,0x9107,0x9108,0x9109,0x910a,0x910b,0x910c,
-0x910d,0x910e,0x910f,0x9110,0x9111,0x9112,0x9113,0x9114,
-0x9115,0x9116,0x9117,0x9118,0x911a,0x911b,0x911c,0x0000,
-0x911d,0x911f,0x9120,0x9121,0x9124,0x9125,0x9126,0x9127,
-0x9128,0x9129,0x912a,0x912b,0x912c,0x912d,0x912e,0x9130,
-0x9132,0x9133,0x9134,0x9135,0x9136,0x9137,0x9138,0x913a,
-0x913b,0x913c,0x913d,0x913e,0x913f,0x9140,0x9141,0x9142,
-0x9144,0x5537,0x5556,0x5575,0x5576,0x5577,0x5533,0x5530,
-0x555c,0x558b,0x55d2,0x5583,0x55b1,0x55b9,0x5588,0x5581,
-0x559f,0x557e,0x55d6,0x5591,0x557b,0x55df,0x55bd,0x55be,
-0x5594,0x5599,0x55ea,0x55f7,0x55c9,0x561f,0x55d1,0x55eb,
-0x55ec,0x55d4,0x55e6,0x55dd,0x55c4,0x55ef,0x55e5,0x55f2,
-0x55f3,0x55cc,0x55cd,0x55e8,0x55f5,0x55e4,0x8f94,0x561e,
-0x5608,0x560c,0x5601,0x5624,0x5623,0x55fe,0x5600,0x5627,
-0x562d,0x5658,0x5639,0x5657,0x562c,0x564d,0x5662,0x5659,
-0x565c,0x564c,0x5654,0x5686,0x5664,0x5671,0x566b,0x567b,
-0x567c,0x5685,0x5693,0x56af,0x56d4,0x56d7,0x56dd,0x56e1,
-0x56f5,0x56eb,0x56f9,0x56ff,0x5704,0x570a,0x5709,0x571c,
-0x5e0f,0x5e19,0x5e14,0x5e11,0x5e31,0x5e3b,0x5e3c,0x0000,
-/* 0xe100 */
-0x9145,0x9147,0x9148,0x9151,0x9153,0x9154,0x9155,0x9156,
-0x9158,0x9159,0x915b,0x915c,0x915f,0x9160,0x9166,0x9167,
-0x9168,0x916b,0x916d,0x9173,0x917a,0x917b,0x917c,0x9180,
-0x9181,0x9182,0x9183,0x9184,0x9186,0x9188,0x918a,0x918e,
-0x918f,0x9193,0x9194,0x9195,0x9196,0x9197,0x9198,0x9199,
-0x919c,0x919d,0x919e,0x919f,0x91a0,0x91a1,0x91a4,0x91a5,
-0x91a6,0x91a7,0x91a8,0x91a9,0x91ab,0x91ac,0x91b0,0x91b1,
-0x91b2,0x91b3,0x91b6,0x91b7,0x91b8,0x91b9,0x91bb,0x0000,
-0x91bc,0x91bd,0x91be,0x91bf,0x91c0,0x91c1,0x91c2,0x91c3,
-0x91c4,0x91c5,0x91c6,0x91c8,0x91cb,0x91d0,0x91d2,0x91d3,
-0x91d4,0x91d5,0x91d6,0x91d7,0x91d8,0x91d9,0x91da,0x91db,
-0x91dd,0x91de,0x91df,0x91e0,0x91e1,0x91e2,0x91e3,0x91e4,
-0x91e5,0x5e37,0x5e44,0x5e54,0x5e5b,0x5e5e,0x5e61,0x5c8c,
-0x5c7a,0x5c8d,0x5c90,0x5c96,0x5c88,0x5c98,0x5c99,0x5c91,
-0x5c9a,0x5c9c,0x5cb5,0x5ca2,0x5cbd,0x5cac,0x5cab,0x5cb1,
-0x5ca3,0x5cc1,0x5cb7,0x5cc4,0x5cd2,0x5ce4,0x5ccb,0x5ce5,
-0x5d02,0x5d03,0x5d27,0x5d26,0x5d2e,0x5d24,0x5d1e,0x5d06,
-0x5d1b,0x5d58,0x5d3e,0x5d34,0x5d3d,0x5d6c,0x5d5b,0x5d6f,
-0x5d5d,0x5d6b,0x5d4b,0x5d4a,0x5d69,0x5d74,0x5d82,0x5d99,
-0x5d9d,0x8c73,0x5db7,0x5dc5,0x5f73,0x5f77,0x5f82,0x5f87,
-0x5f89,0x5f8c,0x5f95,0x5f99,0x5f9c,0x5fa8,0x5fad,0x5fb5,
-0x5fbc,0x8862,0x5f61,0x72ad,0x72b0,0x72b4,0x72b7,0x72b8,
-0x72c3,0x72c1,0x72ce,0x72cd,0x72d2,0x72e8,0x72ef,0x72e9,
-0x72f2,0x72f4,0x72f7,0x7301,0x72f3,0x7303,0x72fa,0x0000,
-/* 0xe200 */
-0x91e6,0x91e7,0x91e8,0x91e9,0x91ea,0x91eb,0x91ec,0x91ed,
-0x91ee,0x91ef,0x91f0,0x91f1,0x91f2,0x91f3,0x91f4,0x91f5,
-0x91f6,0x91f7,0x91f8,0x91f9,0x91fa,0x91fb,0x91fc,0x91fd,
-0x91fe,0x91ff,0x9200,0x9201,0x9202,0x9203,0x9204,0x9205,
-0x9206,0x9207,0x9208,0x9209,0x920a,0x920b,0x920c,0x920d,
-0x920e,0x920f,0x9210,0x9211,0x9212,0x9213,0x9214,0x9215,
-0x9216,0x9217,0x9218,0x9219,0x921a,0x921b,0x921c,0x921d,
-0x921e,0x921f,0x9220,0x9221,0x9222,0x9223,0x9224,0x0000,
-0x9225,0x9226,0x9227,0x9228,0x9229,0x922a,0x922b,0x922c,
-0x922d,0x922e,0x922f,0x9230,0x9231,0x9232,0x9233,0x9234,
-0x9235,0x9236,0x9237,0x9238,0x9239,0x923a,0x923b,0x923c,
-0x923d,0x923e,0x923f,0x9240,0x9241,0x9242,0x9243,0x9244,
-0x9245,0x72fb,0x7317,0x7313,0x7321,0x730a,0x731e,0x731d,
-0x7315,0x7322,0x7339,0x7325,0x732c,0x7338,0x7331,0x7350,
-0x734d,0x7357,0x7360,0x736c,0x736f,0x737e,0x821b,0x5925,
-0x98e7,0x5924,0x5902,0x9963,0x9967,0x9968,0x9969,0x996a,
-0x996b,0x996c,0x9974,0x9977,0x997d,0x9980,0x9984,0x9987,
-0x998a,0x998d,0x9990,0x9991,0x9993,0x9994,0x9995,0x5e80,
-0x5e91,0x5e8b,0x5e96,0x5ea5,0x5ea0,0x5eb9,0x5eb5,0x5ebe,
-0x5eb3,0x8d53,0x5ed2,0x5ed1,0x5edb,0x5ee8,0x5eea,0x81ba,
-0x5fc4,0x5fc9,0x5fd6,0x5fcf,0x6003,0x5fee,0x6004,0x5fe1,
-0x5fe4,0x5ffe,0x6005,0x6006,0x5fea,0x5fed,0x5ff8,0x6019,
-0x6035,0x6026,0x601b,0x600f,0x600d,0x6029,0x602b,0x600a,
-0x603f,0x6021,0x6078,0x6079,0x607b,0x607a,0x6042,0x0000,
-/* 0xe300 */
-0x9246,0x9247,0x9248,0x9249,0x924a,0x924b,0x924c,0x924d,
-0x924e,0x924f,0x9250,0x9251,0x9252,0x9253,0x9254,0x9255,
-0x9256,0x9257,0x9258,0x9259,0x925a,0x925b,0x925c,0x925d,
-0x925e,0x925f,0x9260,0x9261,0x9262,0x9263,0x9264,0x9265,
-0x9266,0x9267,0x9268,0x9269,0x926a,0x926b,0x926c,0x926d,
-0x926e,0x926f,0x9270,0x9271,0x9272,0x9273,0x9275,0x9276,
-0x9277,0x9278,0x9279,0x927a,0x927b,0x927c,0x927d,0x927e,
-0x927f,0x9280,0x9281,0x9282,0x9283,0x9284,0x9285,0x0000,
-0x9286,0x9287,0x9288,0x9289,0x928a,0x928b,0x928c,0x928d,
-0x928f,0x9290,0x9291,0x9292,0x9293,0x9294,0x9295,0x9296,
-0x9297,0x9298,0x9299,0x929a,0x929b,0x929c,0x929d,0x929e,
-0x929f,0x92a0,0x92a1,0x92a2,0x92a3,0x92a4,0x92a5,0x92a6,
-0x92a7,0x606a,0x607d,0x6096,0x609a,0x60ad,0x609d,0x6083,
-0x6092,0x608c,0x609b,0x60ec,0x60bb,0x60b1,0x60dd,0x60d8,
-0x60c6,0x60da,0x60b4,0x6120,0x6126,0x6115,0x6123,0x60f4,
-0x6100,0x610e,0x612b,0x614a,0x6175,0x61ac,0x6194,0x61a7,
-0x61b7,0x61d4,0x61f5,0x5fdd,0x96b3,0x95e9,0x95eb,0x95f1,
-0x95f3,0x95f5,0x95f6,0x95fc,0x95fe,0x9603,0x9604,0x9606,
-0x9608,0x960a,0x960b,0x960c,0x960d,0x960f,0x9612,0x9615,
-0x9616,0x9617,0x9619,0x961a,0x4e2c,0x723f,0x6215,0x6c35,
-0x6c54,0x6c5c,0x6c4a,0x6ca3,0x6c85,0x6c90,0x6c94,0x6c8c,
-0x6c68,0x6c69,0x6c74,0x6c76,0x6c86,0x6ca9,0x6cd0,0x6cd4,
-0x6cad,0x6cf7,0x6cf8,0x6cf1,0x6cd7,0x6cb2,0x6ce0,0x6cd6,
-0x6cfa,0x6ceb,0x6cee,0x6cb1,0x6cd3,0x6cef,0x6cfe,0x0000,
-/* 0xe400 */
-0x92a8,0x92a9,0x92aa,0x92ab,0x92ac,0x92ad,0x92af,0x92b0,
-0x92b1,0x92b2,0x92b3,0x92b4,0x92b5,0x92b6,0x92b7,0x92b8,
-0x92b9,0x92ba,0x92bb,0x92bc,0x92bd,0x92be,0x92bf,0x92c0,
-0x92c1,0x92c2,0x92c3,0x92c4,0x92c5,0x92c6,0x92c7,0x92c9,
-0x92ca,0x92cb,0x92cc,0x92cd,0x92ce,0x92cf,0x92d0,0x92d1,
-0x92d2,0x92d3,0x92d4,0x92d5,0x92d6,0x92d7,0x92d8,0x92d9,
-0x92da,0x92db,0x92dc,0x92dd,0x92de,0x92df,0x92e0,0x92e1,
-0x92e2,0x92e3,0x92e4,0x92e5,0x92e6,0x92e7,0x92e8,0x0000,
-0x92e9,0x92ea,0x92eb,0x92ec,0x92ed,0x92ee,0x92ef,0x92f0,
-0x92f1,0x92f2,0x92f3,0x92f4,0x92f5,0x92f6,0x92f7,0x92f8,
-0x92f9,0x92fa,0x92fb,0x92fc,0x92fd,0x92fe,0x92ff,0x9300,
-0x9301,0x9302,0x9303,0x9304,0x9305,0x9306,0x9307,0x9308,
-0x9309,0x6d39,0x6d27,0x6d0c,0x6d43,0x6d48,0x6d07,0x6d04,
-0x6d19,0x6d0e,0x6d2b,0x6d4d,0x6d2e,0x6d35,0x6d1a,0x6d4f,
-0x6d52,0x6d54,0x6d33,0x6d91,0x6d6f,0x6d9e,0x6da0,0x6d5e,
-0x6d93,0x6d94,0x6d5c,0x6d60,0x6d7c,0x6d63,0x6e1a,0x6dc7,
-0x6dc5,0x6dde,0x6e0e,0x6dbf,0x6de0,0x6e11,0x6de6,0x6ddd,
-0x6dd9,0x6e16,0x6dab,0x6e0c,0x6dae,0x6e2b,0x6e6e,0x6e4e,
-0x6e6b,0x6eb2,0x6e5f,0x6e86,0x6e53,0x6e54,0x6e32,0x6e25,
-0x6e44,0x6edf,0x6eb1,0x6e98,0x6ee0,0x6f2d,0x6ee2,0x6ea5,
-0x6ea7,0x6ebd,0x6ebb,0x6eb7,0x6ed7,0x6eb4,0x6ecf,0x6e8f,
-0x6ec2,0x6e9f,0x6f62,0x6f46,0x6f47,0x6f24,0x6f15,0x6ef9,
-0x6f2f,0x6f36,0x6f4b,0x6f74,0x6f2a,0x6f09,0x6f29,0x6f89,
-0x6f8d,0x6f8c,0x6f78,0x6f72,0x6f7c,0x6f7a,0x6fd1,0x0000,
-/* 0xe500 */
-0x930a,0x930b,0x930c,0x930d,0x930e,0x930f,0x9310,0x9311,
-0x9312,0x9313,0x9314,0x9315,0x9316,0x9317,0x9318,0x9319,
-0x931a,0x931b,0x931c,0x931d,0x931e,0x931f,0x9320,0x9321,
-0x9322,0x9323,0x9324,0x9325,0x9326,0x9327,0x9328,0x9329,
-0x932a,0x932b,0x932c,0x932d,0x932e,0x932f,0x9330,0x9331,
-0x9332,0x9333,0x9334,0x9335,0x9336,0x9337,0x9338,0x9339,
-0x933a,0x933b,0x933c,0x933d,0x933f,0x9340,0x9341,0x9342,
-0x9343,0x9344,0x9345,0x9346,0x9347,0x9348,0x9349,0x0000,
-0x934a,0x934b,0x934c,0x934d,0x934e,0x934f,0x9350,0x9351,
-0x9352,0x9353,0x9354,0x9355,0x9356,0x9357,0x9358,0x9359,
-0x935a,0x935b,0x935c,0x935d,0x935e,0x935f,0x9360,0x9361,
-0x9362,0x9363,0x9364,0x9365,0x9366,0x9367,0x9368,0x9369,
-0x936b,0x6fc9,0x6fa7,0x6fb9,0x6fb6,0x6fc2,0x6fe1,0x6fee,
-0x6fde,0x6fe0,0x6fef,0x701a,0x7023,0x701b,0x7039,0x7035,
-0x704f,0x705e,0x5b80,0x5b84,0x5b95,0x5b93,0x5ba5,0x5bb8,
-0x752f,0x9a9e,0x6434,0x5be4,0x5bee,0x8930,0x5bf0,0x8e47,
-0x8b07,0x8fb6,0x8fd3,0x8fd5,0x8fe5,0x8fee,0x8fe4,0x8fe9,
-0x8fe6,0x8ff3,0x8fe8,0x9005,0x9004,0x900b,0x9026,0x9011,
-0x900d,0x9016,0x9021,0x9035,0x9036,0x902d,0x902f,0x9044,
-0x9051,0x9052,0x9050,0x9068,0x9058,0x9062,0x905b,0x66b9,
-0x9074,0x907d,0x9082,0x9088,0x9083,0x908b,0x5f50,0x5f57,
-0x5f56,0x5f58,0x5c3b,0x54ab,0x5c50,0x5c59,0x5b71,0x5c63,
-0x5c66,0x7fbc,0x5f2a,0x5f29,0x5f2d,0x8274,0x5f3c,0x9b3b,
-0x5c6e,0x5981,0x5983,0x598d,0x59a9,0x59aa,0x59a3,0x0000,
-/* 0xe600 */
-0x936c,0x936d,0x936e,0x936f,0x9370,0x9371,0x9372,0x9373,
-0x9374,0x9375,0x9376,0x9377,0x9378,0x9379,0x937a,0x937b,
-0x937c,0x937d,0x937e,0x937f,0x9380,0x9381,0x9382,0x9383,
-0x9384,0x9385,0x9386,0x9387,0x9388,0x9389,0x938a,0x938b,
-0x938c,0x938d,0x938e,0x9390,0x9391,0x9392,0x9393,0x9394,
-0x9395,0x9396,0x9397,0x9398,0x9399,0x939a,0x939b,0x939c,
-0x939d,0x939e,0x939f,0x93a0,0x93a1,0x93a2,0x93a3,0x93a4,
-0x93a5,0x93a6,0x93a7,0x93a8,0x93a9,0x93aa,0x93ab,0x0000,
-0x93ac,0x93ad,0x93ae,0x93af,0x93b0,0x93b1,0x93b2,0x93b3,
-0x93b4,0x93b5,0x93b6,0x93b7,0x93b8,0x93b9,0x93ba,0x93bb,
-0x93bc,0x93bd,0x93be,0x93bf,0x93c0,0x93c1,0x93c2,0x93c3,
-0x93c4,0x93c5,0x93c6,0x93c7,0x93c8,0x93c9,0x93cb,0x93cc,
-0x93cd,0x5997,0x59ca,0x59ab,0x599e,0x59a4,0x59d2,0x59b2,
-0x59af,0x59d7,0x59be,0x5a05,0x5a06,0x59dd,0x5a08,0x59e3,
-0x59d8,0x59f9,0x5a0c,0x5a09,0x5a32,0x5a34,0x5a11,0x5a23,
-0x5a13,0x5a40,0x5a67,0x5a4a,0x5a55,0x5a3c,0x5a62,0x5a75,
-0x80ec,0x5aaa,0x5a9b,0x5a77,0x5a7a,0x5abe,0x5aeb,0x5ab2,
-0x5ad2,0x5ad4,0x5ab8,0x5ae0,0x5ae3,0x5af1,0x5ad6,0x5ae6,
-0x5ad8,0x5adc,0x5b09,0x5b17,0x5b16,0x5b32,0x5b37,0x5b40,
-0x5c15,0x5c1c,0x5b5a,0x5b65,0x5b73,0x5b51,0x5b53,0x5b62,
-0x9a75,0x9a77,0x9a78,0x9a7a,0x9a7f,0x9a7d,0x9a80,0x9a81,
-0x9a85,0x9a88,0x9a8a,0x9a90,0x9a92,0x9a93,0x9a96,0x9a98,
-0x9a9b,0x9a9c,0x9a9d,0x9a9f,0x9aa0,0x9aa2,0x9aa3,0x9aa5,
-0x9aa7,0x7e9f,0x7ea1,0x7ea3,0x7ea5,0x7ea8,0x7ea9,0x0000,
-/* 0xe700 */
-0x93ce,0x93cf,0x93d0,0x93d1,0x93d2,0x93d3,0x93d4,0x93d5,
-0x93d7,0x93d8,0x93d9,0x93da,0x93db,0x93dc,0x93dd,0x93de,
-0x93df,0x93e0,0x93e1,0x93e2,0x93e3,0x93e4,0x93e5,0x93e6,
-0x93e7,0x93e8,0x93e9,0x93ea,0x93eb,0x93ec,0x93ed,0x93ee,
-0x93ef,0x93f0,0x93f1,0x93f2,0x93f3,0x93f4,0x93f5,0x93f6,
-0x93f7,0x93f8,0x93f9,0x93fa,0x93fb,0x93fc,0x93fd,0x93fe,
-0x93ff,0x9400,0x9401,0x9402,0x9403,0x9404,0x9405,0x9406,
-0x9407,0x9408,0x9409,0x940a,0x940b,0x940c,0x940d,0x0000,
-0x940e,0x940f,0x9410,0x9411,0x9412,0x9413,0x9414,0x9415,
-0x9416,0x9417,0x9418,0x9419,0x941a,0x941b,0x941c,0x941d,
-0x941e,0x941f,0x9420,0x9421,0x9422,0x9423,0x9424,0x9425,
-0x9426,0x9427,0x9428,0x9429,0x942a,0x942b,0x942c,0x942d,
-0x942e,0x7ead,0x7eb0,0x7ebe,0x7ec0,0x7ec1,0x7ec2,0x7ec9,
-0x7ecb,0x7ecc,0x7ed0,0x7ed4,0x7ed7,0x7edb,0x7ee0,0x7ee1,
-0x7ee8,0x7eeb,0x7eee,0x7eef,0x7ef1,0x7ef2,0x7f0d,0x7ef6,
-0x7efa,0x7efb,0x7efe,0x7f01,0x7f02,0x7f03,0x7f07,0x7f08,
-0x7f0b,0x7f0c,0x7f0f,0x7f11,0x7f12,0x7f17,0x7f19,0x7f1c,
-0x7f1b,0x7f1f,0x7f21,0x7f22,0x7f23,0x7f24,0x7f25,0x7f26,
-0x7f27,0x7f2a,0x7f2b,0x7f2c,0x7f2d,0x7f2f,0x7f30,0x7f31,
-0x7f32,0x7f33,0x7f35,0x5e7a,0x757f,0x5ddb,0x753e,0x9095,
-0x738e,0x7391,0x73ae,0x73a2,0x739f,0x73cf,0x73c2,0x73d1,
-0x73b7,0x73b3,0x73c0,0x73c9,0x73c8,0x73e5,0x73d9,0x987c,
-0x740a,0x73e9,0x73e7,0x73de,0x73ba,0x73f2,0x740f,0x742a,
-0x745b,0x7426,0x7425,0x7428,0x7430,0x742e,0x742c,0x0000,
-/* 0xe800 */
-0x942f,0x9430,0x9431,0x9432,0x9433,0x9434,0x9435,0x9436,
-0x9437,0x9438,0x9439,0x943a,0x943b,0x943c,0x943d,0x943f,
-0x9440,0x9441,0x9442,0x9443,0x9444,0x9445,0x9446,0x9447,
-0x9448,0x9449,0x944a,0x944b,0x944c,0x944d,0x944e,0x944f,
-0x9450,0x9451,0x9452,0x9453,0x9454,0x9455,0x9456,0x9457,
-0x9458,0x9459,0x945a,0x945b,0x945c,0x945d,0x945e,0x945f,
-0x9460,0x9461,0x9462,0x9463,0x9464,0x9465,0x9466,0x9467,
-0x9468,0x9469,0x946a,0x946c,0x946d,0x946e,0x946f,0x0000,
-0x9470,0x9471,0x9472,0x9473,0x9474,0x9475,0x9476,0x9477,
-0x9478,0x9479,0x947a,0x947b,0x947c,0x947d,0x947e,0x947f,
-0x9480,0x9481,0x9482,0x9483,0x9484,0x9491,0x9496,0x9498,
-0x94c7,0x94cf,0x94d3,0x94d4,0x94da,0x94e6,0x94fb,0x951c,
-0x9520,0x741b,0x741a,0x7441,0x745c,0x7457,0x7455,0x7459,
-0x7477,0x746d,0x747e,0x749c,0x748e,0x7480,0x7481,0x7487,
-0x748b,0x749e,0x74a8,0x74a9,0x7490,0x74a7,0x74d2,0x74ba,
-0x97ea,0x97eb,0x97ec,0x674c,0x6753,0x675e,0x6748,0x6769,
-0x67a5,0x6787,0x676a,0x6773,0x6798,0x67a7,0x6775,0x67a8,
-0x679e,0x67ad,0x678b,0x6777,0x677c,0x67f0,0x6809,0x67d8,
-0x680a,0x67e9,0x67b0,0x680c,0x67d9,0x67b5,0x67da,0x67b3,
-0x67dd,0x6800,0x67c3,0x67b8,0x67e2,0x680e,0x67c1,0x67fd,
-0x6832,0x6833,0x6860,0x6861,0x684e,0x6862,0x6844,0x6864,
-0x6883,0x681d,0x6855,0x6866,0x6841,0x6867,0x6840,0x683e,
-0x684a,0x6849,0x6829,0x68b5,0x688f,0x6874,0x6877,0x6893,
-0x686b,0x68c2,0x696e,0x68fc,0x691f,0x6920,0x68f9,0x0000,
-/* 0xe900 */
-0x9527,0x9533,0x953d,0x9543,0x9548,0x954b,0x9555,0x955a,
-0x9560,0x956e,0x9574,0x9575,0x9577,0x9578,0x9579,0x957a,
-0x957b,0x957c,0x957d,0x957e,0x9580,0x9581,0x9582,0x9583,
-0x9584,0x9585,0x9586,0x9587,0x9588,0x9589,0x958a,0x958b,
-0x958c,0x958d,0x958e,0x958f,0x9590,0x9591,0x9592,0x9593,
-0x9594,0x9595,0x9596,0x9597,0x9598,0x9599,0x959a,0x959b,
-0x959c,0x959d,0x959e,0x959f,0x95a0,0x95a1,0x95a2,0x95a3,
-0x95a4,0x95a5,0x95a6,0x95a7,0x95a8,0x95a9,0x95aa,0x0000,
-0x95ab,0x95ac,0x95ad,0x95ae,0x95af,0x95b0,0x95b1,0x95b2,
-0x95b3,0x95b4,0x95b5,0x95b6,0x95b7,0x95b8,0x95b9,0x95ba,
-0x95bb,0x95bc,0x95bd,0x95be,0x95bf,0x95c0,0x95c1,0x95c2,
-0x95c3,0x95c4,0x95c5,0x95c6,0x95c7,0x95c8,0x95c9,0x95ca,
-0x95cb,0x6924,0x68f0,0x690b,0x6901,0x6957,0x68e3,0x6910,
-0x6971,0x6939,0x6960,0x6942,0x695d,0x6984,0x696b,0x6980,
-0x6998,0x6978,0x6934,0x69cc,0x6987,0x6988,0x69ce,0x6989,
-0x6966,0x6963,0x6979,0x699b,0x69a7,0x69bb,0x69ab,0x69ad,
-0x69d4,0x69b1,0x69c1,0x69ca,0x69df,0x6995,0x69e0,0x698d,
-0x69ff,0x6a2f,0x69ed,0x6a17,0x6a18,0x6a65,0x69f2,0x6a44,
-0x6a3e,0x6aa0,0x6a50,0x6a5b,0x6a35,0x6a8e,0x6a79,0x6a3d,
-0x6a28,0x6a58,0x6a7c,0x6a91,0x6a90,0x6aa9,0x6a97,0x6aab,
-0x7337,0x7352,0x6b81,0x6b82,0x6b87,0x6b84,0x6b92,0x6b93,
-0x6b8d,0x6b9a,0x6b9b,0x6ba1,0x6baa,0x8f6b,0x8f6d,0x8f71,
-0x8f72,0x8f73,0x8f75,0x8f76,0x8f78,0x8f77,0x8f79,0x8f7a,
-0x8f7c,0x8f7e,0x8f81,0x8f82,0x8f84,0x8f87,0x8f8b,0x0000,
-/* 0xea00 */
-0x95cc,0x95cd,0x95ce,0x95cf,0x95d0,0x95d1,0x95d2,0x95d3,
-0x95d4,0x95d5,0x95d6,0x95d7,0x95d8,0x95d9,0x95da,0x95db,
-0x95dc,0x95dd,0x95de,0x95df,0x95e0,0x95e1,0x95e2,0x95e3,
-0x95e4,0x95e5,0x95e6,0x95e7,0x95ec,0x95ff,0x9607,0x9613,
-0x9618,0x961b,0x961e,0x9620,0x9623,0x9624,0x9625,0x9626,
-0x9627,0x9628,0x9629,0x962b,0x962c,0x962d,0x962f,0x9630,
-0x9637,0x9638,0x9639,0x963a,0x963e,0x9641,0x9643,0x964a,
-0x964e,0x964f,0x9651,0x9652,0x9653,0x9656,0x9657,0x0000,
-0x9658,0x9659,0x965a,0x965c,0x965d,0x965e,0x9660,0x9663,
-0x9665,0x9666,0x966b,0x966d,0x966e,0x966f,0x9670,0x9671,
-0x9673,0x9678,0x9679,0x967a,0x967b,0x967c,0x967d,0x967e,
-0x967f,0x9680,0x9681,0x9682,0x9683,0x9684,0x9687,0x9689,
-0x968a,0x8f8d,0x8f8e,0x8f8f,0x8f98,0x8f9a,0x8ece,0x620b,
-0x6217,0x621b,0x621f,0x6222,0x6221,0x6225,0x6224,0x622c,
-0x81e7,0x74ef,0x74f4,0x74ff,0x750f,0x7511,0x7513,0x6534,
-0x65ee,0x65ef,0x65f0,0x660a,0x6619,0x6772,0x6603,0x6615,
-0x6600,0x7085,0x66f7,0x661d,0x6634,0x6631,0x6636,0x6635,
-0x8006,0x665f,0x6654,0x6641,0x664f,0x6656,0x6661,0x6657,
-0x6677,0x6684,0x668c,0x66a7,0x669d,0x66be,0x66db,0x66dc,
-0x66e6,0x66e9,0x8d32,0x8d33,0x8d36,0x8d3b,0x8d3d,0x8d40,
-0x8d45,0x8d46,0x8d48,0x8d49,0x8d47,0x8d4d,0x8d55,0x8d59,
-0x89c7,0x89ca,0x89cb,0x89cc,0x89ce,0x89cf,0x89d0,0x89d1,
-0x726e,0x729f,0x725d,0x7266,0x726f,0x727e,0x727f,0x7284,
-0x728b,0x728d,0x728f,0x7292,0x6308,0x6332,0x63b0,0x0000,
-/* 0xeb00 */
-0x968c,0x968e,0x9691,0x9692,0x9693,0x9695,0x9696,0x969a,
-0x969b,0x969d,0x969e,0x969f,0x96a0,0x96a1,0x96a2,0x96a3,
-0x96a4,0x96a5,0x96a6,0x96a8,0x96a9,0x96aa,0x96ab,0x96ac,
-0x96ad,0x96ae,0x96af,0x96b1,0x96b2,0x96b4,0x96b5,0x96b7,
-0x96b8,0x96ba,0x96bb,0x96bf,0x96c2,0x96c3,0x96c8,0x96ca,
-0x96cb,0x96d0,0x96d1,0x96d3,0x96d4,0x96d6,0x96d7,0x96d8,
-0x96d9,0x96da,0x96db,0x96dc,0x96dd,0x96de,0x96df,0x96e1,
-0x96e2,0x96e3,0x96e4,0x96e5,0x96e6,0x96e7,0x96eb,0x0000,
-0x96ec,0x96ed,0x96ee,0x96f0,0x96f1,0x96f2,0x96f4,0x96f5,
-0x96f8,0x96fa,0x96fb,0x96fc,0x96fd,0x96ff,0x9702,0x9703,
-0x9705,0x970a,0x970b,0x970c,0x9710,0x9711,0x9712,0x9714,
-0x9715,0x9717,0x9718,0x9719,0x971a,0x971b,0x971d,0x971f,
-0x9720,0x643f,0x64d8,0x8004,0x6bea,0x6bf3,0x6bfd,0x6bf5,
-0x6bf9,0x6c05,0x6c07,0x6c06,0x6c0d,0x6c15,0x6c18,0x6c19,
-0x6c1a,0x6c21,0x6c29,0x6c24,0x6c2a,0x6c32,0x6535,0x6555,
-0x656b,0x724d,0x7252,0x7256,0x7230,0x8662,0x5216,0x809f,
-0x809c,0x8093,0x80bc,0x670a,0x80bd,0x80b1,0x80ab,0x80ad,
-0x80b4,0x80b7,0x80e7,0x80e8,0x80e9,0x80ea,0x80db,0x80c2,
-0x80c4,0x80d9,0x80cd,0x80d7,0x6710,0x80dd,0x80eb,0x80f1,
-0x80f4,0x80ed,0x810d,0x810e,0x80f2,0x80fc,0x6715,0x8112,
-0x8c5a,0x8136,0x811e,0x812c,0x8118,0x8132,0x8148,0x814c,
-0x8153,0x8174,0x8159,0x815a,0x8171,0x8160,0x8169,0x817c,
-0x817d,0x816d,0x8167,0x584d,0x5ab5,0x8188,0x8182,0x8191,
-0x6ed5,0x81a3,0x81aa,0x81cc,0x6726,0x81ca,0x81bb,0x0000,
-/* 0xec00 */
-0x9721,0x9722,0x9723,0x9724,0x9725,0x9726,0x9727,0x9728,
-0x9729,0x972b,0x972c,0x972e,0x972f,0x9731,0x9733,0x9734,
-0x9735,0x9736,0x9737,0x973a,0x973b,0x973c,0x973d,0x973f,
-0x9740,0x9741,0x9742,0x9743,0x9744,0x9745,0x9746,0x9747,
-0x9748,0x9749,0x974a,0x974b,0x974c,0x974d,0x974e,0x974f,
-0x9750,0x9751,0x9754,0x9755,0x9757,0x9758,0x975a,0x975c,
-0x975d,0x975f,0x9763,0x9764,0x9766,0x9767,0x9768,0x976a,
-0x976b,0x976c,0x976d,0x976e,0x976f,0x9770,0x9771,0x0000,
-0x9772,0x9775,0x9777,0x9778,0x9779,0x977a,0x977b,0x977d,
-0x977e,0x977f,0x9780,0x9781,0x9782,0x9783,0x9784,0x9786,
-0x9787,0x9788,0x9789,0x978a,0x978c,0x978e,0x978f,0x9790,
-0x9793,0x9795,0x9796,0x9797,0x9799,0x979a,0x979b,0x979c,
-0x979d,0x81c1,0x81a6,0x6b24,0x6b37,0x6b39,0x6b43,0x6b46,
-0x6b59,0x98d1,0x98d2,0x98d3,0x98d5,0x98d9,0x98da,0x6bb3,
-0x5f40,0x6bc2,0x89f3,0x6590,0x9f51,0x6593,0x65bc,0x65c6,
-0x65c4,0x65c3,0x65cc,0x65ce,0x65d2,0x65d6,0x7080,0x709c,
-0x7096,0x709d,0x70bb,0x70c0,0x70b7,0x70ab,0x70b1,0x70e8,
-0x70ca,0x7110,0x7113,0x7116,0x712f,0x7131,0x7173,0x715c,
-0x7168,0x7145,0x7172,0x714a,0x7178,0x717a,0x7198,0x71b3,
-0x71b5,0x71a8,0x71a0,0x71e0,0x71d4,0x71e7,0x71f9,0x721d,
-0x7228,0x706c,0x7118,0x7166,0x71b9,0x623e,0x623d,0x6243,
-0x6248,0x6249,0x793b,0x7940,0x7946,0x7949,0x795b,0x795c,
-0x7953,0x795a,0x7962,0x7957,0x7960,0x796f,0x7967,0x797a,
-0x7985,0x798a,0x799a,0x79a7,0x79b3,0x5fd1,0x5fd0,0x0000,
-/* 0xed00 */
-0x979e,0x979f,0x97a1,0x97a2,0x97a4,0x97a5,0x97a6,0x97a7,
-0x97a8,0x97a9,0x97aa,0x97ac,0x97ae,0x97b0,0x97b1,0x97b3,
-0x97b5,0x97b6,0x97b7,0x97b8,0x97b9,0x97ba,0x97bb,0x97bc,
-0x97bd,0x97be,0x97bf,0x97c0,0x97c1,0x97c2,0x97c3,0x97c4,
-0x97c5,0x97c6,0x97c7,0x97c8,0x97c9,0x97ca,0x97cb,0x97cc,
-0x97cd,0x97ce,0x97cf,0x97d0,0x97d1,0x97d2,0x97d3,0x97d4,
-0x97d5,0x97d6,0x97d7,0x97d8,0x97d9,0x97da,0x97db,0x97dc,
-0x97dd,0x97de,0x97df,0x97e0,0x97e1,0x97e2,0x97e3,0x0000,
-0x97e4,0x97e5,0x97e8,0x97ee,0x97ef,0x97f0,0x97f1,0x97f2,
-0x97f4,0x97f7,0x97f8,0x97f9,0x97fa,0x97fb,0x97fc,0x97fd,
-0x97fe,0x97ff,0x9800,0x9801,0x9802,0x9803,0x9804,0x9805,
-0x9806,0x9807,0x9808,0x9809,0x980a,0x980b,0x980c,0x980d,
-0x980e,0x603c,0x605d,0x605a,0x6067,0x6041,0x6059,0x6063,
-0x60ab,0x6106,0x610d,0x615d,0x61a9,0x619d,0x61cb,0x61d1,
-0x6206,0x8080,0x807f,0x6c93,0x6cf6,0x6dfc,0x77f6,0x77f8,
-0x7800,0x7809,0x7817,0x7818,0x7811,0x65ab,0x782d,0x781c,
-0x781d,0x7839,0x783a,0x783b,0x781f,0x783c,0x7825,0x782c,
-0x7823,0x7829,0x784e,0x786d,0x7856,0x7857,0x7826,0x7850,
-0x7847,0x784c,0x786a,0x789b,0x7893,0x789a,0x7887,0x789c,
-0x78a1,0x78a3,0x78b2,0x78b9,0x78a5,0x78d4,0x78d9,0x78c9,
-0x78ec,0x78f2,0x7905,0x78f4,0x7913,0x7924,0x791e,0x7934,
-0x9f9b,0x9ef9,0x9efb,0x9efc,0x76f1,0x7704,0x770d,0x76f9,
-0x7707,0x7708,0x771a,0x7722,0x7719,0x772d,0x7726,0x7735,
-0x7738,0x7750,0x7751,0x7747,0x7743,0x775a,0x7768,0x0000,
-/* 0xee00 */
-0x980f,0x9810,0x9811,0x9812,0x9813,0x9814,0x9815,0x9816,
-0x9817,0x9818,0x9819,0x981a,0x981b,0x981c,0x981d,0x981e,
-0x981f,0x9820,0x9821,0x9822,0x9823,0x9824,0x9825,0x9826,
-0x9827,0x9828,0x9829,0x982a,0x982b,0x982c,0x982d,0x982e,
-0x982f,0x9830,0x9831,0x9832,0x9833,0x9834,0x9835,0x9836,
-0x9837,0x9838,0x9839,0x983a,0x983b,0x983c,0x983d,0x983e,
-0x983f,0x9840,0x9841,0x9842,0x9843,0x9844,0x9845,0x9846,
-0x9847,0x9848,0x9849,0x984a,0x984b,0x984c,0x984d,0x0000,
-0x984e,0x984f,0x9850,0x9851,0x9852,0x9853,0x9854,0x9855,
-0x9856,0x9857,0x9858,0x9859,0x985a,0x985b,0x985c,0x985d,
-0x985e,0x985f,0x9860,0x9861,0x9862,0x9863,0x9864,0x9865,
-0x9866,0x9867,0x9868,0x9869,0x986a,0x986b,0x986c,0x986d,
-0x986e,0x7762,0x7765,0x777f,0x778d,0x777d,0x7780,0x778c,
-0x7791,0x779f,0x77a0,0x77b0,0x77b5,0x77bd,0x753a,0x7540,
-0x754e,0x754b,0x7548,0x755b,0x7572,0x7579,0x7583,0x7f58,
-0x7f61,0x7f5f,0x8a48,0x7f68,0x7f74,0x7f71,0x7f79,0x7f81,
-0x7f7e,0x76cd,0x76e5,0x8832,0x9485,0x9486,0x9487,0x948b,
-0x948a,0x948c,0x948d,0x948f,0x9490,0x9494,0x9497,0x9495,
-0x949a,0x949b,0x949c,0x94a3,0x94a4,0x94ab,0x94aa,0x94ad,
-0x94ac,0x94af,0x94b0,0x94b2,0x94b4,0x94b6,0x94b7,0x94b8,
-0x94b9,0x94ba,0x94bc,0x94bd,0x94bf,0x94c4,0x94c8,0x94c9,
-0x94ca,0x94cb,0x94cc,0x94cd,0x94ce,0x94d0,0x94d1,0x94d2,
-0x94d5,0x94d6,0x94d7,0x94d9,0x94d8,0x94db,0x94de,0x94df,
-0x94e0,0x94e2,0x94e4,0x94e5,0x94e7,0x94e8,0x94ea,0x0000,
-/* 0xef00 */
-0x986f,0x9870,0x9871,0x9872,0x9873,0x9874,0x988b,0x988e,
-0x9892,0x9895,0x9899,0x98a3,0x98a8,0x98a9,0x98aa,0x98ab,
-0x98ac,0x98ad,0x98ae,0x98af,0x98b0,0x98b1,0x98b2,0x98b3,
-0x98b4,0x98b5,0x98b6,0x98b7,0x98b8,0x98b9,0x98ba,0x98bb,
-0x98bc,0x98bd,0x98be,0x98bf,0x98c0,0x98c1,0x98c2,0x98c3,
-0x98c4,0x98c5,0x98c6,0x98c7,0x98c8,0x98c9,0x98ca,0x98cb,
-0x98cc,0x98cd,0x98cf,0x98d0,0x98d4,0x98d6,0x98d7,0x98db,
-0x98dc,0x98dd,0x98e0,0x98e1,0x98e2,0x98e3,0x98e4,0x0000,
-0x98e5,0x98e6,0x98e9,0x98ea,0x98eb,0x98ec,0x98ed,0x98ee,
-0x98ef,0x98f0,0x98f1,0x98f2,0x98f3,0x98f4,0x98f5,0x98f6,
-0x98f7,0x98f8,0x98f9,0x98fa,0x98fb,0x98fc,0x98fd,0x98fe,
-0x98ff,0x9900,0x9901,0x9902,0x9903,0x9904,0x9905,0x9906,
-0x9907,0x94e9,0x94eb,0x94ee,0x94ef,0x94f3,0x94f4,0x94f5,
-0x94f7,0x94f9,0x94fc,0x94fd,0x94ff,0x9503,0x9502,0x9506,
-0x9507,0x9509,0x950a,0x950d,0x950e,0x950f,0x9512,0x9513,
-0x9514,0x9515,0x9516,0x9518,0x951b,0x951d,0x951e,0x951f,
-0x9522,0x952a,0x952b,0x9529,0x952c,0x9531,0x9532,0x9534,
-0x9536,0x9537,0x9538,0x953c,0x953e,0x953f,0x9542,0x9535,
-0x9544,0x9545,0x9546,0x9549,0x954c,0x954e,0x954f,0x9552,
-0x9553,0x9554,0x9556,0x9557,0x9558,0x9559,0x955b,0x955e,
-0x955f,0x955d,0x9561,0x9562,0x9564,0x9565,0x9566,0x9567,
-0x9568,0x9569,0x956a,0x956b,0x956c,0x956f,0x9571,0x9572,
-0x9573,0x953a,0x77e7,0x77ec,0x96c9,0x79d5,0x79ed,0x79e3,
-0x79eb,0x7a06,0x5d47,0x7a03,0x7a02,0x7a1e,0x7a14,0x0000,
-/* 0xf000 */
-0x9908,0x9909,0x990a,0x990b,0x990c,0x990e,0x990f,0x9911,
-0x9912,0x9913,0x9914,0x9915,0x9916,0x9917,0x9918,0x9919,
-0x991a,0x991b,0x991c,0x991d,0x991e,0x991f,0x9920,0x9921,
-0x9922,0x9923,0x9924,0x9925,0x9926,0x9927,0x9928,0x9929,
-0x992a,0x992b,0x992c,0x992d,0x992f,0x9930,0x9931,0x9932,
-0x9933,0x9934,0x9935,0x9936,0x9937,0x9938,0x9939,0x993a,
-0x993b,0x993c,0x993d,0x993e,0x993f,0x9940,0x9941,0x9942,
-0x9943,0x9944,0x9945,0x9946,0x9947,0x9948,0x9949,0x0000,
-0x994a,0x994b,0x994c,0x994d,0x994e,0x994f,0x9950,0x9951,
-0x9952,0x9953,0x9956,0x9957,0x9958,0x9959,0x995a,0x995b,
-0x995c,0x995d,0x995e,0x995f,0x9960,0x9961,0x9962,0x9964,
-0x9966,0x9973,0x9978,0x9979,0x997b,0x997e,0x9982,0x9983,
-0x9989,0x7a39,0x7a37,0x7a51,0x9ecf,0x99a5,0x7a70,0x7688,
-0x768e,0x7693,0x7699,0x76a4,0x74de,0x74e0,0x752c,0x9e20,
-0x9e22,0x9e28,0x9e29,0x9e2a,0x9e2b,0x9e2c,0x9e32,0x9e31,
-0x9e36,0x9e38,0x9e37,0x9e39,0x9e3a,0x9e3e,0x9e41,0x9e42,
-0x9e44,0x9e46,0x9e47,0x9e48,0x9e49,0x9e4b,0x9e4c,0x9e4e,
-0x9e51,0x9e55,0x9e57,0x9e5a,0x9e5b,0x9e5c,0x9e5e,0x9e63,
-0x9e66,0x9e67,0x9e68,0x9e69,0x9e6a,0x9e6b,0x9e6c,0x9e71,
-0x9e6d,0x9e73,0x7592,0x7594,0x7596,0x75a0,0x759d,0x75ac,
-0x75a3,0x75b3,0x75b4,0x75b8,0x75c4,0x75b1,0x75b0,0x75c3,
-0x75c2,0x75d6,0x75cd,0x75e3,0x75e8,0x75e6,0x75e4,0x75eb,
-0x75e7,0x7603,0x75f1,0x75fc,0x75ff,0x7610,0x7600,0x7605,
-0x760c,0x7617,0x760a,0x7625,0x7618,0x7615,0x7619,0x0000,
-/* 0xf100 */
-0x998c,0x998e,0x999a,0x999b,0x999c,0x999d,0x999e,0x999f,
-0x99a0,0x99a1,0x99a2,0x99a3,0x99a4,0x99a6,0x99a7,0x99a9,
-0x99aa,0x99ab,0x99ac,0x99ad,0x99ae,0x99af,0x99b0,0x99b1,
-0x99b2,0x99b3,0x99b4,0x99b5,0x99b6,0x99b7,0x99b8,0x99b9,
-0x99ba,0x99bb,0x99bc,0x99bd,0x99be,0x99bf,0x99c0,0x99c1,
-0x99c2,0x99c3,0x99c4,0x99c5,0x99c6,0x99c7,0x99c8,0x99c9,
-0x99ca,0x99cb,0x99cc,0x99cd,0x99ce,0x99cf,0x99d0,0x99d1,
-0x99d2,0x99d3,0x99d4,0x99d5,0x99d6,0x99d7,0x99d8,0x0000,
-0x99d9,0x99da,0x99db,0x99dc,0x99dd,0x99de,0x99df,0x99e0,
-0x99e1,0x99e2,0x99e3,0x99e4,0x99e5,0x99e6,0x99e7,0x99e8,
-0x99e9,0x99ea,0x99eb,0x99ec,0x99ed,0x99ee,0x99ef,0x99f0,
-0x99f1,0x99f2,0x99f3,0x99f4,0x99f5,0x99f6,0x99f7,0x99f8,
-0x99f9,0x761b,0x763c,0x7622,0x7620,0x7640,0x762d,0x7630,
-0x763f,0x7635,0x7643,0x763e,0x7633,0x764d,0x765e,0x7654,
-0x765c,0x7656,0x766b,0x766f,0x7fca,0x7ae6,0x7a78,0x7a79,
-0x7a80,0x7a86,0x7a88,0x7a95,0x7aa6,0x7aa0,0x7aac,0x7aa8,
-0x7aad,0x7ab3,0x8864,0x8869,0x8872,0x887d,0x887f,0x8882,
-0x88a2,0x88c6,0x88b7,0x88bc,0x88c9,0x88e2,0x88ce,0x88e3,
-0x88e5,0x88f1,0x891a,0x88fc,0x88e8,0x88fe,0x88f0,0x8921,
-0x8919,0x8913,0x891b,0x890a,0x8934,0x892b,0x8936,0x8941,
-0x8966,0x897b,0x758b,0x80e5,0x76b2,0x76b4,0x77dc,0x8012,
-0x8014,0x8016,0x801c,0x8020,0x8022,0x8025,0x8026,0x8027,
-0x8029,0x8028,0x8031,0x800b,0x8035,0x8043,0x8046,0x804d,
-0x8052,0x8069,0x8071,0x8983,0x9878,0x9880,0x9883,0x0000,
-/* 0xf200 */
-0x99fa,0x99fb,0x99fc,0x99fd,0x99fe,0x99ff,0x9a00,0x9a01,
-0x9a02,0x9a03,0x9a04,0x9a05,0x9a06,0x9a07,0x9a08,0x9a09,
-0x9a0a,0x9a0b,0x9a0c,0x9a0d,0x9a0e,0x9a0f,0x9a10,0x9a11,
-0x9a12,0x9a13,0x9a14,0x9a15,0x9a16,0x9a17,0x9a18,0x9a19,
-0x9a1a,0x9a1b,0x9a1c,0x9a1d,0x9a1e,0x9a1f,0x9a20,0x9a21,
-0x9a22,0x9a23,0x9a24,0x9a25,0x9a26,0x9a27,0x9a28,0x9a29,
-0x9a2a,0x9a2b,0x9a2c,0x9a2d,0x9a2e,0x9a2f,0x9a30,0x9a31,
-0x9a32,0x9a33,0x9a34,0x9a35,0x9a36,0x9a37,0x9a38,0x0000,
-0x9a39,0x9a3a,0x9a3b,0x9a3c,0x9a3d,0x9a3e,0x9a3f,0x9a40,
-0x9a41,0x9a42,0x9a43,0x9a44,0x9a45,0x9a46,0x9a47,0x9a48,
-0x9a49,0x9a4a,0x9a4b,0x9a4c,0x9a4d,0x9a4e,0x9a4f,0x9a50,
-0x9a51,0x9a52,0x9a53,0x9a54,0x9a55,0x9a56,0x9a57,0x9a58,
-0x9a59,0x9889,0x988c,0x988d,0x988f,0x9894,0x989a,0x989b,
-0x989e,0x989f,0x98a1,0x98a2,0x98a5,0x98a6,0x864d,0x8654,
-0x866c,0x866e,0x867f,0x867a,0x867c,0x867b,0x86a8,0x868d,
-0x868b,0x86ac,0x869d,0x86a7,0x86a3,0x86aa,0x8693,0x86a9,
-0x86b6,0x86c4,0x86b5,0x86ce,0x86b0,0x86ba,0x86b1,0x86af,
-0x86c9,0x86cf,0x86b4,0x86e9,0x86f1,0x86f2,0x86ed,0x86f3,
-0x86d0,0x8713,0x86de,0x86f4,0x86df,0x86d8,0x86d1,0x8703,
-0x8707,0x86f8,0x8708,0x870a,0x870d,0x8709,0x8723,0x873b,
-0x871e,0x8725,0x872e,0x871a,0x873e,0x8748,0x8734,0x8731,
-0x8729,0x8737,0x873f,0x8782,0x8722,0x877d,0x877e,0x877b,
-0x8760,0x8770,0x874c,0x876e,0x878b,0x8753,0x8763,0x877c,
-0x8764,0x8759,0x8765,0x8793,0x87af,0x87a8,0x87d2,0x0000,
-/* 0xf300 */
-0x9a5a,0x9a5b,0x9a5c,0x9a5d,0x9a5e,0x9a5f,0x9a60,0x9a61,
-0x9a62,0x9a63,0x9a64,0x9a65,0x9a66,0x9a67,0x9a68,0x9a69,
-0x9a6a,0x9a6b,0x9a72,0x9a83,0x9a89,0x9a8d,0x9a8e,0x9a94,
-0x9a95,0x9a99,0x9aa6,0x9aa9,0x9aaa,0x9aab,0x9aac,0x9aad,
-0x9aae,0x9aaf,0x9ab2,0x9ab3,0x9ab4,0x9ab5,0x9ab9,0x9abb,
-0x9abd,0x9abe,0x9abf,0x9ac3,0x9ac4,0x9ac6,0x9ac7,0x9ac8,
-0x9ac9,0x9aca,0x9acd,0x9ace,0x9acf,0x9ad0,0x9ad2,0x9ad4,
-0x9ad5,0x9ad6,0x9ad7,0x9ad9,0x9ada,0x9adb,0x9adc,0x0000,
-0x9add,0x9ade,0x9ae0,0x9ae2,0x9ae3,0x9ae4,0x9ae5,0x9ae7,
-0x9ae8,0x9ae9,0x9aea,0x9aec,0x9aee,0x9af0,0x9af1,0x9af2,
-0x9af3,0x9af4,0x9af5,0x9af6,0x9af7,0x9af8,0x9afa,0x9afc,
-0x9afd,0x9afe,0x9aff,0x9b00,0x9b01,0x9b02,0x9b04,0x9b05,
-0x9b06,0x87c6,0x8788,0x8785,0x87ad,0x8797,0x8783,0x87ab,
-0x87e5,0x87ac,0x87b5,0x87b3,0x87cb,0x87d3,0x87bd,0x87d1,
-0x87c0,0x87ca,0x87db,0x87ea,0x87e0,0x87ee,0x8816,0x8813,
-0x87fe,0x880a,0x881b,0x8821,0x8839,0x883c,0x7f36,0x7f42,
-0x7f44,0x7f45,0x8210,0x7afa,0x7afd,0x7b08,0x7b03,0x7b04,
-0x7b15,0x7b0a,0x7b2b,0x7b0f,0x7b47,0x7b38,0x7b2a,0x7b19,
-0x7b2e,0x7b31,0x7b20,0x7b25,0x7b24,0x7b33,0x7b3e,0x7b1e,
-0x7b58,0x7b5a,0x7b45,0x7b75,0x7b4c,0x7b5d,0x7b60,0x7b6e,
-0x7b7b,0x7b62,0x7b72,0x7b71,0x7b90,0x7ba6,0x7ba7,0x7bb8,
-0x7bac,0x7b9d,0x7ba8,0x7b85,0x7baa,0x7b9c,0x7ba2,0x7bab,
-0x7bb4,0x7bd1,0x7bc1,0x7bcc,0x7bdd,0x7bda,0x7be5,0x7be6,
-0x7bea,0x7c0c,0x7bfe,0x7bfc,0x7c0f,0x7c16,0x7c0b,0x0000,
-/* 0xf400 */
-0x9b07,0x9b09,0x9b0a,0x9b0b,0x9b0c,0x9b0d,0x9b0e,0x9b10,
-0x9b11,0x9b12,0x9b14,0x9b15,0x9b16,0x9b17,0x9b18,0x9b19,
-0x9b1a,0x9b1b,0x9b1c,0x9b1d,0x9b1e,0x9b20,0x9b21,0x9b22,
-0x9b24,0x9b25,0x9b26,0x9b27,0x9b28,0x9b29,0x9b2a,0x9b2b,
-0x9b2c,0x9b2d,0x9b2e,0x9b30,0x9b31,0x9b33,0x9b34,0x9b35,
-0x9b36,0x9b37,0x9b38,0x9b39,0x9b3a,0x9b3d,0x9b3e,0x9b3f,
-0x9b40,0x9b46,0x9b4a,0x9b4b,0x9b4c,0x9b4e,0x9b50,0x9b52,
-0x9b53,0x9b55,0x9b56,0x9b57,0x9b58,0x9b59,0x9b5a,0x0000,
-0x9b5b,0x9b5c,0x9b5d,0x9b5e,0x9b5f,0x9b60,0x9b61,0x9b62,
-0x9b63,0x9b64,0x9b65,0x9b66,0x9b67,0x9b68,0x9b69,0x9b6a,
-0x9b6b,0x9b6c,0x9b6d,0x9b6e,0x9b6f,0x9b70,0x9b71,0x9b72,
-0x9b73,0x9b74,0x9b75,0x9b76,0x9b77,0x9b78,0x9b79,0x9b7a,
-0x9b7b,0x7c1f,0x7c2a,0x7c26,0x7c38,0x7c41,0x7c40,0x81fe,
-0x8201,0x8202,0x8204,0x81ec,0x8844,0x8221,0x8222,0x8223,
-0x822d,0x822f,0x8228,0x822b,0x8238,0x823b,0x8233,0x8234,
-0x823e,0x8244,0x8249,0x824b,0x824f,0x825a,0x825f,0x8268,
-0x887e,0x8885,0x8888,0x88d8,0x88df,0x895e,0x7f9d,0x7f9f,
-0x7fa7,0x7faf,0x7fb0,0x7fb2,0x7c7c,0x6549,0x7c91,0x7c9d,
-0x7c9c,0x7c9e,0x7ca2,0x7cb2,0x7cbc,0x7cbd,0x7cc1,0x7cc7,
-0x7ccc,0x7ccd,0x7cc8,0x7cc5,0x7cd7,0x7ce8,0x826e,0x66a8,
-0x7fbf,0x7fce,0x7fd5,0x7fe5,0x7fe1,0x7fe6,0x7fe9,0x7fee,
-0x7ff3,0x7cf8,0x7d77,0x7da6,0x7dae,0x7e47,0x7e9b,0x9eb8,
-0x9eb4,0x8d73,0x8d84,0x8d94,0x8d91,0x8db1,0x8d67,0x8d6d,
-0x8c47,0x8c49,0x914a,0x9150,0x914e,0x914f,0x9164,0x0000,
-/* 0xf500 */
-0x9b7c,0x9b7d,0x9b7e,0x9b7f,0x9b80,0x9b81,0x9b82,0x9b83,
-0x9b84,0x9b85,0x9b86,0x9b87,0x9b88,0x9b89,0x9b8a,0x9b8b,
-0x9b8c,0x9b8d,0x9b8e,0x9b8f,0x9b90,0x9b91,0x9b92,0x9b93,
-0x9b94,0x9b95,0x9b96,0x9b97,0x9b98,0x9b99,0x9b9a,0x9b9b,
-0x9b9c,0x9b9d,0x9b9e,0x9b9f,0x9ba0,0x9ba1,0x9ba2,0x9ba3,
-0x9ba4,0x9ba5,0x9ba6,0x9ba7,0x9ba8,0x9ba9,0x9baa,0x9bab,
-0x9bac,0x9bad,0x9bae,0x9baf,0x9bb0,0x9bb1,0x9bb2,0x9bb3,
-0x9bb4,0x9bb5,0x9bb6,0x9bb7,0x9bb8,0x9bb9,0x9bba,0x0000,
-0x9bbb,0x9bbc,0x9bbd,0x9bbe,0x9bbf,0x9bc0,0x9bc1,0x9bc2,
-0x9bc3,0x9bc4,0x9bc5,0x9bc6,0x9bc7,0x9bc8,0x9bc9,0x9bca,
-0x9bcb,0x9bcc,0x9bcd,0x9bce,0x9bcf,0x9bd0,0x9bd1,0x9bd2,
-0x9bd3,0x9bd4,0x9bd5,0x9bd6,0x9bd7,0x9bd8,0x9bd9,0x9bda,
-0x9bdb,0x9162,0x9161,0x9170,0x9169,0x916f,0x917d,0x917e,
-0x9172,0x9174,0x9179,0x918c,0x9185,0x9190,0x918d,0x9191,
-0x91a2,0x91a3,0x91aa,0x91ad,0x91ae,0x91af,0x91b5,0x91b4,
-0x91ba,0x8c55,0x9e7e,0x8db8,0x8deb,0x8e05,0x8e59,0x8e69,
-0x8db5,0x8dbf,0x8dbc,0x8dba,0x8dc4,0x8dd6,0x8dd7,0x8dda,
-0x8dde,0x8dce,0x8dcf,0x8ddb,0x8dc6,0x8dec,0x8df7,0x8df8,
-0x8de3,0x8df9,0x8dfb,0x8de4,0x8e09,0x8dfd,0x8e14,0x8e1d,
-0x8e1f,0x8e2c,0x8e2e,0x8e23,0x8e2f,0x8e3a,0x8e40,0x8e39,
-0x8e35,0x8e3d,0x8e31,0x8e49,0x8e41,0x8e42,0x8e51,0x8e52,
-0x8e4a,0x8e70,0x8e76,0x8e7c,0x8e6f,0x8e74,0x8e85,0x8e8f,
-0x8e94,0x8e90,0x8e9c,0x8e9e,0x8c78,0x8c82,0x8c8a,0x8c85,
-0x8c98,0x8c94,0x659b,0x89d6,0x89de,0x89da,0x89dc,0x0000,
-/* 0xf600 */
-0x9bdc,0x9bdd,0x9bde,0x9bdf,0x9be0,0x9be1,0x9be2,0x9be3,
-0x9be4,0x9be5,0x9be6,0x9be7,0x9be8,0x9be9,0x9bea,0x9beb,
-0x9bec,0x9bed,0x9bee,0x9bef,0x9bf0,0x9bf1,0x9bf2,0x9bf3,
-0x9bf4,0x9bf5,0x9bf6,0x9bf7,0x9bf8,0x9bf9,0x9bfa,0x9bfb,
-0x9bfc,0x9bfd,0x9bfe,0x9bff,0x9c00,0x9c01,0x9c02,0x9c03,
-0x9c04,0x9c05,0x9c06,0x9c07,0x9c08,0x9c09,0x9c0a,0x9c0b,
-0x9c0c,0x9c0d,0x9c0e,0x9c0f,0x9c10,0x9c11,0x9c12,0x9c13,
-0x9c14,0x9c15,0x9c16,0x9c17,0x9c18,0x9c19,0x9c1a,0x0000,
-0x9c1b,0x9c1c,0x9c1d,0x9c1e,0x9c1f,0x9c20,0x9c21,0x9c22,
-0x9c23,0x9c24,0x9c25,0x9c26,0x9c27,0x9c28,0x9c29,0x9c2a,
-0x9c2b,0x9c2c,0x9c2d,0x9c2e,0x9c2f,0x9c30,0x9c31,0x9c32,
-0x9c33,0x9c34,0x9c35,0x9c36,0x9c37,0x9c38,0x9c39,0x9c3a,
-0x9c3b,0x89e5,0x89eb,0x89ef,0x8a3e,0x8b26,0x9753,0x96e9,
-0x96f3,0x96ef,0x9706,0x9701,0x9708,0x970f,0x970e,0x972a,
-0x972d,0x9730,0x973e,0x9f80,0x9f83,0x9f85,0x9f86,0x9f87,
-0x9f88,0x9f89,0x9f8a,0x9f8c,0x9efe,0x9f0b,0x9f0d,0x96b9,
-0x96bc,0x96bd,0x96ce,0x96d2,0x77bf,0x96e0,0x928e,0x92ae,
-0x92c8,0x933e,0x936a,0x93ca,0x938f,0x943e,0x946b,0x9c7f,
-0x9c82,0x9c85,0x9c86,0x9c87,0x9c88,0x7a23,0x9c8b,0x9c8e,
-0x9c90,0x9c91,0x9c92,0x9c94,0x9c95,0x9c9a,0x9c9b,0x9c9e,
-0x9c9f,0x9ca0,0x9ca1,0x9ca2,0x9ca3,0x9ca5,0x9ca6,0x9ca7,
-0x9ca8,0x9ca9,0x9cab,0x9cad,0x9cae,0x9cb0,0x9cb1,0x9cb2,
-0x9cb3,0x9cb4,0x9cb5,0x9cb6,0x9cb7,0x9cba,0x9cbb,0x9cbc,
-0x9cbd,0x9cc4,0x9cc5,0x9cc6,0x9cc7,0x9cca,0x9ccb,0x0000,
-/* 0xf700 */
-0x9c3c,0x9c3d,0x9c3e,0x9c3f,0x9c40,0x9c41,0x9c42,0x9c43,
-0x9c44,0x9c45,0x9c46,0x9c47,0x9c48,0x9c49,0x9c4a,0x9c4b,
-0x9c4c,0x9c4d,0x9c4e,0x9c4f,0x9c50,0x9c51,0x9c52,0x9c53,
-0x9c54,0x9c55,0x9c56,0x9c57,0x9c58,0x9c59,0x9c5a,0x9c5b,
-0x9c5c,0x9c5d,0x9c5e,0x9c5f,0x9c60,0x9c61,0x9c62,0x9c63,
-0x9c64,0x9c65,0x9c66,0x9c67,0x9c68,0x9c69,0x9c6a,0x9c6b,
-0x9c6c,0x9c6d,0x9c6e,0x9c6f,0x9c70,0x9c71,0x9c72,0x9c73,
-0x9c74,0x9c75,0x9c76,0x9c77,0x9c78,0x9c79,0x9c7a,0x0000,
-0x9c7b,0x9c7d,0x9c7e,0x9c80,0x9c83,0x9c84,0x9c89,0x9c8a,
-0x9c8c,0x9c8f,0x9c93,0x9c96,0x9c97,0x9c98,0x9c99,0x9c9d,
-0x9caa,0x9cac,0x9caf,0x9cb9,0x9cbe,0x9cbf,0x9cc0,0x9cc1,
-0x9cc2,0x9cc8,0x9cc9,0x9cd1,0x9cd2,0x9cda,0x9cdb,0x9ce0,
-0x9ce1,0x9ccc,0x9ccd,0x9cce,0x9ccf,0x9cd0,0x9cd3,0x9cd4,
-0x9cd5,0x9cd7,0x9cd8,0x9cd9,0x9cdc,0x9cdd,0x9cdf,0x9ce2,
-0x977c,0x9785,0x9791,0x9792,0x9794,0x97af,0x97ab,0x97a3,
-0x97b2,0x97b4,0x9ab1,0x9ab0,0x9ab7,0x9e58,0x9ab6,0x9aba,
-0x9abc,0x9ac1,0x9ac0,0x9ac5,0x9ac2,0x9acb,0x9acc,0x9ad1,
-0x9b45,0x9b43,0x9b47,0x9b49,0x9b48,0x9b4d,0x9b51,0x98e8,
-0x990d,0x992e,0x9955,0x9954,0x9adf,0x9ae1,0x9ae6,0x9aef,
-0x9aeb,0x9afb,0x9aed,0x9af9,0x9b08,0x9b0f,0x9b13,0x9b1f,
-0x9b23,0x9ebd,0x9ebe,0x7e3b,0x9e82,0x9e87,0x9e88,0x9e8b,
-0x9e92,0x93d6,0x9e9d,0x9e9f,0x9edb,0x9edc,0x9edd,0x9ee0,
-0x9edf,0x9ee2,0x9ee9,0x9ee7,0x9ee5,0x9eea,0x9eef,0x9f22,
-0x9f2c,0x9f2f,0x9f39,0x9f37,0x9f3d,0x9f3e,0x9f44,0x0000,
-/* 0xf800 */
-0x9ce3,0x9ce4,0x9ce5,0x9ce6,0x9ce7,0x9ce8,0x9ce9,0x9cea,
-0x9ceb,0x9cec,0x9ced,0x9cee,0x9cef,0x9cf0,0x9cf1,0x9cf2,
-0x9cf3,0x9cf4,0x9cf5,0x9cf6,0x9cf7,0x9cf8,0x9cf9,0x9cfa,
-0x9cfb,0x9cfc,0x9cfd,0x9cfe,0x9cff,0x9d00,0x9d01,0x9d02,
-0x9d03,0x9d04,0x9d05,0x9d06,0x9d07,0x9d08,0x9d09,0x9d0a,
-0x9d0b,0x9d0c,0x9d0d,0x9d0e,0x9d0f,0x9d10,0x9d11,0x9d12,
-0x9d13,0x9d14,0x9d15,0x9d16,0x9d17,0x9d18,0x9d19,0x9d1a,
-0x9d1b,0x9d1c,0x9d1d,0x9d1e,0x9d1f,0x9d20,0x9d21,0x0000,
-0x9d22,0x9d23,0x9d24,0x9d25,0x9d26,0x9d27,0x9d28,0x9d29,
-0x9d2a,0x9d2b,0x9d2c,0x9d2d,0x9d2e,0x9d2f,0x9d30,0x9d31,
-0x9d32,0x9d33,0x9d34,0x9d35,0x9d36,0x9d37,0x9d38,0x9d39,
-0x9d3a,0x9d3b,0x9d3c,0x9d3d,0x9d3e,0x9d3f,0x9d40,0x9d41,
-0x9d42,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xf900 */
-0x9d43,0x9d44,0x9d45,0x9d46,0x9d47,0x9d48,0x9d49,0x9d4a,
-0x9d4b,0x9d4c,0x9d4d,0x9d4e,0x9d4f,0x9d50,0x9d51,0x9d52,
-0x9d53,0x9d54,0x9d55,0x9d56,0x9d57,0x9d58,0x9d59,0x9d5a,
-0x9d5b,0x9d5c,0x9d5d,0x9d5e,0x9d5f,0x9d60,0x9d61,0x9d62,
-0x9d63,0x9d64,0x9d65,0x9d66,0x9d67,0x9d68,0x9d69,0x9d6a,
-0x9d6b,0x9d6c,0x9d6d,0x9d6e,0x9d6f,0x9d70,0x9d71,0x9d72,
-0x9d73,0x9d74,0x9d75,0x9d76,0x9d77,0x9d78,0x9d79,0x9d7a,
-0x9d7b,0x9d7c,0x9d7d,0x9d7e,0x9d7f,0x9d80,0x9d81,0x0000,
-0x9d82,0x9d83,0x9d84,0x9d85,0x9d86,0x9d87,0x9d88,0x9d89,
-0x9d8a,0x9d8b,0x9d8c,0x9d8d,0x9d8e,0x9d8f,0x9d90,0x9d91,
-0x9d92,0x9d93,0x9d94,0x9d95,0x9d96,0x9d97,0x9d98,0x9d99,
-0x9d9a,0x9d9b,0x9d9c,0x9d9d,0x9d9e,0x9d9f,0x9da0,0x9da1,
-0x9da2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xfa00 */
-0x9da3,0x9da4,0x9da5,0x9da6,0x9da7,0x9da8,0x9da9,0x9daa,
-0x9dab,0x9dac,0x9dad,0x9dae,0x9daf,0x9db0,0x9db1,0x9db2,
-0x9db3,0x9db4,0x9db5,0x9db6,0x9db7,0x9db8,0x9db9,0x9dba,
-0x9dbb,0x9dbc,0x9dbd,0x9dbe,0x9dbf,0x9dc0,0x9dc1,0x9dc2,
-0x9dc3,0x9dc4,0x9dc5,0x9dc6,0x9dc7,0x9dc8,0x9dc9,0x9dca,
-0x9dcb,0x9dcc,0x9dcd,0x9dce,0x9dcf,0x9dd0,0x9dd1,0x9dd2,
-0x9dd3,0x9dd4,0x9dd5,0x9dd6,0x9dd7,0x9dd8,0x9dd9,0x9dda,
-0x9ddb,0x9ddc,0x9ddd,0x9dde,0x9ddf,0x9de0,0x9de1,0x0000,
-0x9de2,0x9de3,0x9de4,0x9de5,0x9de6,0x9de7,0x9de8,0x9de9,
-0x9dea,0x9deb,0x9dec,0x9ded,0x9dee,0x9def,0x9df0,0x9df1,
-0x9df2,0x9df3,0x9df4,0x9df5,0x9df6,0x9df7,0x9df8,0x9df9,
-0x9dfa,0x9dfb,0x9dfc,0x9dfd,0x9dfe,0x9dff,0x9e00,0x9e01,
-0x9e02,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xfb00 */
-0x9e03,0x9e04,0x9e05,0x9e06,0x9e07,0x9e08,0x9e09,0x9e0a,
-0x9e0b,0x9e0c,0x9e0d,0x9e0e,0x9e0f,0x9e10,0x9e11,0x9e12,
-0x9e13,0x9e14,0x9e15,0x9e16,0x9e17,0x9e18,0x9e19,0x9e1a,
-0x9e1b,0x9e1c,0x9e1d,0x9e1e,0x9e24,0x9e27,0x9e2e,0x9e30,
-0x9e34,0x9e3b,0x9e3c,0x9e40,0x9e4d,0x9e50,0x9e52,0x9e53,
-0x9e54,0x9e56,0x9e59,0x9e5d,0x9e5f,0x9e60,0x9e61,0x9e62,
-0x9e65,0x9e6e,0x9e6f,0x9e72,0x9e74,0x9e75,0x9e76,0x9e77,
-0x9e78,0x9e79,0x9e7a,0x9e7b,0x9e7c,0x9e7d,0x9e80,0x0000,
-0x9e81,0x9e83,0x9e84,0x9e85,0x9e86,0x9e89,0x9e8a,0x9e8c,
-0x9e8d,0x9e8e,0x9e8f,0x9e90,0x9e91,0x9e94,0x9e95,0x9e96,
-0x9e97,0x9e98,0x9e99,0x9e9a,0x9e9b,0x9e9c,0x9e9e,0x9ea0,
-0x9ea1,0x9ea2,0x9ea3,0x9ea4,0x9ea5,0x9ea7,0x9ea8,0x9ea9,
-0x9eaa,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xfc00 */
-0x9eab,0x9eac,0x9ead,0x9eae,0x9eaf,0x9eb0,0x9eb1,0x9eb2,
-0x9eb3,0x9eb5,0x9eb6,0x9eb7,0x9eb9,0x9eba,0x9ebc,0x9ebf,
-0x9ec0,0x9ec1,0x9ec2,0x9ec3,0x9ec5,0x9ec6,0x9ec7,0x9ec8,
-0x9eca,0x9ecb,0x9ecc,0x9ed0,0x9ed2,0x9ed3,0x9ed5,0x9ed6,
-0x9ed7,0x9ed9,0x9eda,0x9ede,0x9ee1,0x9ee3,0x9ee4,0x9ee6,
-0x9ee8,0x9eeb,0x9eec,0x9eed,0x9eee,0x9ef0,0x9ef1,0x9ef2,
-0x9ef3,0x9ef4,0x9ef5,0x9ef6,0x9ef7,0x9ef8,0x9efa,0x9efd,
-0x9eff,0x9f00,0x9f01,0x9f02,0x9f03,0x9f04,0x9f05,0x0000,
-0x9f06,0x9f07,0x9f08,0x9f09,0x9f0a,0x9f0c,0x9f0f,0x9f11,
-0x9f12,0x9f14,0x9f15,0x9f16,0x9f18,0x9f1a,0x9f1b,0x9f1c,
-0x9f1d,0x9f1e,0x9f1f,0x9f21,0x9f23,0x9f24,0x9f25,0x9f26,
-0x9f27,0x9f28,0x9f29,0x9f2a,0x9f2b,0x9f2d,0x9f2e,0x9f30,
-0x9f31,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xfd00 */
-0x9f32,0x9f33,0x9f34,0x9f35,0x9f36,0x9f38,0x9f3a,0x9f3c,
-0x9f3f,0x9f40,0x9f41,0x9f42,0x9f43,0x9f45,0x9f46,0x9f47,
-0x9f48,0x9f49,0x9f4a,0x9f4b,0x9f4c,0x9f4d,0x9f4e,0x9f4f,
-0x9f52,0x9f53,0x9f54,0x9f55,0x9f56,0x9f57,0x9f58,0x9f59,
-0x9f5a,0x9f5b,0x9f5c,0x9f5d,0x9f5e,0x9f5f,0x9f60,0x9f61,
-0x9f62,0x9f63,0x9f64,0x9f65,0x9f66,0x9f67,0x9f68,0x9f69,
-0x9f6a,0x9f6b,0x9f6c,0x9f6d,0x9f6e,0x9f6f,0x9f70,0x9f71,
-0x9f72,0x9f73,0x9f74,0x9f75,0x9f76,0x9f77,0x9f78,0x0000,
-0x9f79,0x9f7a,0x9f7b,0x9f7c,0x9f7d,0x9f7e,0x9f81,0x9f82,
-0x9f8d,0x9f8e,0x9f8f,0x9f90,0x9f91,0x9f92,0x9f93,0x9f94,
-0x9f95,0x9f96,0x9f97,0x9f98,0x9f9c,0x9f9d,0x9f9e,0x9fa1,
-0x9fa2,0x9fa3,0x9fa4,0x9fa5,0xf92c,0xf979,0xf995,0xf9e7,
-0xf9f1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xfe00 */
-0xfa0c,0xfa0d,0xfa0e,0xfa0f,0xfa11,0xfa13,0xfa14,0xfa18,
-0xfa1f,0xfa20,0xfa21,0xfa23,0xfa24,0xfa27,0xfa28,0xfa29};
-
-static const int cp936_ucs_table_size = (sizeof(cp936_ucs_table)/sizeof(unsigned short));
-
-
-/* UCS -> CP936 */
-static const unsigned short ucs_a1_cp936_table[] = {
-0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
-0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
-0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
-0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
-0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
-0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
-0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
-0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
-0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
-0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
-0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
-0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
-0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
-0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
-0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
-0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa1e8,0x0000,0x0000,0xa1ec,
-0xa1a7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1e3,0xa1c0,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1a4,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1c1,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa8a4,0xa8a2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa8a8,0xa8a6,0xa8ba,0x0000,0xa8ac,0xa8aa,0x0000,0x0000,
-0x0000,0x0000,0xa8b0,0xa8ae,0x0000,0x0000,0x0000,0xa1c2,
-0x0000,0xa8b4,0xa8b2,0x0000,0xa8b9,0x0000,0x0000,0x0000,
-/* 0x0100 */
-0x0000,0xa8a1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa8a5,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa8a7,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa8a9,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa8bd,0x0000,0x0000,0x0000,
-0xa8be,0x0000,0x0000,0x0000,0x0000,0xa8ad,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa8b1,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa8a3,0x0000,
-0xa8ab,0x0000,0xa8af,0x0000,0xa8b3,0x0000,0xa8b5,0x0000,
-0xa8b6,0x0000,0xa8b7,0x0000,0xa8b8,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x0200 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa8bb,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa8c0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1a6,
-0x0000,0xa1a5,0xa840,0xa841,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa842,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x0300 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa6a1,0xa6a2,0xa6a3,0xa6a4,0xa6a5,0xa6a6,0xa6a7,
-0xa6a8,0xa6a9,0xa6aa,0xa6ab,0xa6ac,0xa6ad,0xa6ae,0xa6af,
-0xa6b0,0xa6b1,0x0000,0xa6b2,0xa6b3,0xa6b4,0xa6b5,0xa6b6,
-0xa6b7,0xa6b8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa6c1,0xa6c2,0xa6c3,0xa6c4,0xa6c5,0xa6c6,0xa6c7,
-0xa6c8,0xa6c9,0xa6ca,0xa6cb,0xa6cc,0xa6cd,0xa6ce,0xa6cf,
-0xa6d0,0xa6d1,0x0000,0xa6d2,0xa6d3,0xa6d4,0xa6d5,0xa6d6,
-0xa6d7,0xa6d8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x0400 */
-0x0000,0xa7a7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa7a1,0xa7a2,0xa7a3,0xa7a4,0xa7a5,0xa7a6,0xa7a8,0xa7a9,
-0xa7aa,0xa7ab,0xa7ac,0xa7ad,0xa7ae,0xa7af,0xa7b0,0xa7b1,
-0xa7b2,0xa7b3,0xa7b4,0xa7b5,0xa7b6,0xa7b7,0xa7b8,0xa7b9,
-0xa7ba,0xa7bb,0xa7bc,0xa7bd,0xa7be,0xa7bf,0xa7c0,0xa7c1,
-0xa7d1,0xa7d2,0xa7d3,0xa7d4,0xa7d5,0xa7d6,0xa7d8,0xa7d9,
-0xa7da,0xa7db,0xa7dc,0xa7dd,0xa7de,0xa7df,0xa7e0,0xa7e1,
-0xa7e2,0xa7e3,0xa7e4,0xa7e5,0xa7e6,0xa7e7,0xa7e8,0xa7e9,
-0xa7ea,0xa7eb,0xa7ec,0xa7ed,0xa7ee,0xa7ef,0xa7f0,0xa7f1,
-0x0000,0xa7d7};
-
-static const int ucs_a1_cp936_table_min = 0x0000;
-static const int ucs_a1_cp936_table_max = 0x0000 + (sizeof (ucs_a1_cp936_table) / sizeof (unsigned short));
-
-/* 0x2000 */
-static const unsigned short ucs_a2_cp936_table[] = {
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa95c,0x0000,0x0000,0xa843,0xa1aa,0xa844,0xa1ac,0x0000,
-0xa1ae,0xa1af,0x0000,0x0000,0xa1b0,0xa1b1,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa845,0xa1ad,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1eb,0x0000,0xa1e4,0xa1e5,0x0000,0xa846,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa1f9,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0080,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x2100 */
-0x0000,0x0000,0x0000,0xa1e6,0x0000,0xa847,0x0000,0x0000,
-0x0000,0xa848,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1ed,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa959,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa2f1,0xa2f2,0xa2f3,0xa2f4,0xa2f5,0xa2f6,0xa2f7,0xa2f8,
-0xa2f9,0xa2fa,0xa2fb,0xa2fc,0x0000,0x0000,0x0000,0x0000,
-0xa2a1,0xa2a2,0xa2a3,0xa2a4,0xa2a5,0xa2a6,0xa2a7,0xa2a8,
-0xa2a9,0xa2aa,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1fb,0xa1fc,0xa1fa,0xa1fd,0x0000,0x0000,0xa849,0xa84a,
-0xa84b,0xa84c,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x2200 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1ca,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1c7,
-0x0000,0xa1c6,0x0000,0x0000,0x0000,0xa84d,0x0000,0x0000,
-0x0000,0x0000,0xa1cc,0x0000,0x0000,0xa1d8,0xa1de,0xa84e,
-0xa1cf,0x0000,0x0000,0xa84f,0x0000,0xa1ce,0x0000,0xa1c4,
-0xa1c5,0xa1c9,0xa1c8,0xa1d2,0x0000,0x0000,0xa1d3,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa1e0,0xa1df,0xa1c3,0xa1cb,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa1d7,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1d6,0x0000,0x0000,0x0000,0xa1d5,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa850,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1d9,0xa1d4,0x0000,0x0000,0xa1dc,0xa1dd,0xa851,0xa852,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1da,0xa1db,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa892,0x0000,0x0000,
-0x0000,0xa1d1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa1cd,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa853,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x2300 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa1d0,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x2400 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa2d9,0xa2da,0xa2db,0xa2dc,0xa2dd,0xa2de,0xa2df,0xa2e0,
-0xa2e1,0xa2e2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa2c5,0xa2c6,0xa2c7,0xa2c8,
-0xa2c9,0xa2ca,0xa2cb,0xa2cc,0xa2cd,0xa2ce,0xa2cf,0xa2d0,
-0xa2d1,0xa2d2,0xa2d3,0xa2d4,0xa2d5,0xa2d6,0xa2d7,0xa2d8,
-0xa2b1,0xa2b2,0xa2b3,0xa2b4,0xa2b5,0xa2b6,0xa2b7,0xa2b8,
-0xa2b9,0xa2ba,0xa2bb,0xa2bc,0xa2bd,0xa2be,0xa2bf,0xa2c0,
-0xa2c1,0xa2c2,0xa2c3,0xa2c4,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x2500 */
-0xa9a4,0xa9a5,0xa9a6,0xa9a7,0xa9a8,0xa9a9,0xa9aa,0xa9ab,
-0xa9ac,0xa9ad,0xa9ae,0xa9af,0xa9b0,0xa9b1,0xa9b2,0xa9b3,
-0xa9b4,0xa9b5,0xa9b6,0xa9b7,0xa9b8,0xa9b9,0xa9ba,0xa9bb,
-0xa9bc,0xa9bd,0xa9be,0xa9bf,0xa9c0,0xa9c1,0xa9c2,0xa9c3,
-0xa9c4,0xa9c5,0xa9c6,0xa9c7,0xa9c8,0xa9c9,0xa9ca,0xa9cb,
-0xa9cc,0xa9cd,0xa9ce,0xa9cf,0xa9d0,0xa9d1,0xa9d2,0xa9d3,
-0xa9d4,0xa9d5,0xa9d6,0xa9d7,0xa9d8,0xa9d9,0xa9da,0xa9db,
-0xa9dc,0xa9dd,0xa9de,0xa9df,0xa9e0,0xa9e1,0xa9e2,0xa9e3,
-0xa9e4,0xa9e5,0xa9e6,0xa9e7,0xa9e8,0xa9e9,0xa9ea,0xa9eb,
-0xa9ec,0xa9ed,0xa9ee,0xa9ef,0x0000,0x0000,0x0000,0x0000,
-0xa854,0xa855,0xa856,0xa857,0xa858,0xa859,0xa85a,0xa85b,
-0xa85c,0xa85d,0xa85e,0xa85f,0xa860,0xa861,0xa862,0xa863,
-0xa864,0xa865,0xa866,0xa867,0xa868,0xa869,0xa86a,0xa86b,
-0xa86c,0xa86d,0xa86e,0xa86f,0xa870,0xa871,0xa872,0xa873,
-0xa874,0xa875,0xa876,0xa877,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa878,0xa879,0xa87a,0xa87b,0xa87c,0xa87d,0xa87e,
-0xa880,0xa881,0xa882,0xa883,0xa884,0xa885,0xa886,0xa887,
-0x0000,0x0000,0x0000,0xa888,0xa889,0xa88a,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1f6,0xa1f5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa1f8,0xa1f7,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa88b,0xa88c,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1f4,0xa1f3,
-0x0000,0x0000,0x0000,0xa1f0,0x0000,0x0000,0xa1f2,0xa1f1,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa88d,0xa88e,0xa88f,0xa890,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x2600 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa1ef,0xa1ee,0x0000,
-0x0000,0xa891,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1e2,0x0000,0xa1e1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-static const int ucs_a2_cp936_table_min = 0x2000;
-static const int ucs_a2_cp936_table_max = 0x2000 + (sizeof (ucs_a2_cp936_table) / sizeof (unsigned short));
-
-static const unsigned short ucs_a3_cp936_table[] = {
-/* 0x2f00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1a1,0xa1a2,0xa1a3,0xa1a8,0x0000,0xa1a9,0xa965,0xa996,
-0xa1b4,0xa1b5,0xa1b6,0xa1b7,0xa1b8,0xa1b9,0xa1ba,0xa1bb,
-0xa1be,0xa1bf,0xa893,0xa1fe,0xa1b2,0xa1b3,0xa1bc,0xa1bd,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa894,0xa895,0x0000,
-0x0000,0xa940,0xa941,0xa942,0xa943,0xa944,0xa945,0xa946,
-0xa947,0xa948,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa4a1,0xa4a2,0xa4a3,0xa4a4,0xa4a5,0xa4a6,0xa4a7,
-0xa4a8,0xa4a9,0xa4aa,0xa4ab,0xa4ac,0xa4ad,0xa4ae,0xa4af,
-0xa4b0,0xa4b1,0xa4b2,0xa4b3,0xa4b4,0xa4b5,0xa4b6,0xa4b7,
-0xa4b8,0xa4b9,0xa4ba,0xa4bb,0xa4bc,0xa4bd,0xa4be,0xa4bf,
-0xa4c0,0xa4c1,0xa4c2,0xa4c3,0xa4c4,0xa4c5,0xa4c6,0xa4c7,
-0xa4c8,0xa4c9,0xa4ca,0xa4cb,0xa4cc,0xa4cd,0xa4ce,0xa4cf,
-0xa4d0,0xa4d1,0xa4d2,0xa4d3,0xa4d4,0xa4d5,0xa4d6,0xa4d7,
-0xa4d8,0xa4d9,0xa4da,0xa4db,0xa4dc,0xa4dd,0xa4de,0xa4df,
-0xa4e0,0xa4e1,0xa4e2,0xa4e3,0xa4e4,0xa4e5,0xa4e6,0xa4e7,
-0xa4e8,0xa4e9,0xa4ea,0xa4eb,0xa4ec,0xa4ed,0xa4ee,0xa4ef,
-0xa4f0,0xa4f1,0xa4f2,0xa4f3,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa961,0xa962,0xa966,0xa967,0x0000,
-0x0000,0xa5a1,0xa5a2,0xa5a3,0xa5a4,0xa5a5,0xa5a6,0xa5a7,
-0xa5a8,0xa5a9,0xa5aa,0xa5ab,0xa5ac,0xa5ad,0xa5ae,0xa5af,
-0xa5b0,0xa5b1,0xa5b2,0xa5b3,0xa5b4,0xa5b5,0xa5b6,0xa5b7,
-0xa5b8,0xa5b9,0xa5ba,0xa5bb,0xa5bc,0xa5bd,0xa5be,0xa5bf,
-0xa5c0,0xa5c1,0xa5c2,0xa5c3,0xa5c4,0xa5c5,0xa5c6,0xa5c7,
-0xa5c8,0xa5c9,0xa5ca,0xa5cb,0xa5cc,0xa5cd,0xa5ce,0xa5cf,
-0xa5d0,0xa5d1,0xa5d2,0xa5d3,0xa5d4,0xa5d5,0xa5d6,0xa5d7,
-0xa5d8,0xa5d9,0xa5da,0xa5db,0xa5dc,0xa5dd,0xa5de,0xa5df,
-0xa5e0,0xa5e1,0xa5e2,0xa5e3,0xa5e4,0xa5e5,0xa5e6,0xa5e7,
-0xa5e8,0xa5e9,0xa5ea,0xa5eb,0xa5ec,0xa5ed,0xa5ee,0xa5ef,
-0xa5f0,0xa5f1,0xa5f2,0xa5f3,0xa5f4,0xa5f5,0xa5f6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa960,0xa963,0xa964,0x0000,
-/* 0x3100 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa8c5,0xa8c6,0xa8c7,
-0xa8c8,0xa8c9,0xa8ca,0xa8cb,0xa8cc,0xa8cd,0xa8ce,0xa8cf,
-0xa8d0,0xa8d1,0xa8d2,0xa8d3,0xa8d4,0xa8d5,0xa8d6,0xa8d7,
-0xa8d8,0xa8d9,0xa8da,0xa8db,0xa8dc,0xa8dd,0xa8de,0xa8df,
-0xa8e0,0xa8e1,0xa8e2,0xa8e3,0xa8e4,0xa8e5,0xa8e6,0xa8e7,
-0xa8e8,0xa8e9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x3200 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa2e5,0xa2e6,0xa2e7,0xa2e8,0xa2e9,0xa2ea,0xa2eb,0xa2ec,
-0xa2ed,0xa2ee,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa95a,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa949,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x3300 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa94a,0xa94b,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa94c,0xa94d,0xa94e,0x0000,
-0x0000,0xa94f,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa950,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa951,0x0000,
-0x0000,0xa952,0xa953,0x0000,0x0000,0xa954,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static const int ucs_a3_cp936_table_min = 0x2f00;
-static const int ucs_a3_cp936_table_max = 0x2f00 + (sizeof (ucs_a3_cp936_table) / sizeof (unsigned short));
-
-/* 4d00h CJK Unified Ideographs (+ Extension A) */
-static const unsigned short ucs_i_cp936_table[] = {
-/* 0x4d00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd2bb,0xb6a1,0x8140,0xc6df,0x8141,0x8142,0x8143,0xcdf2,
-0xd5c9,0xc8fd,0xc9cf,0xcfc2,0xd8a2,0xb2bb,0xd3eb,0x8144,
-0xd8a4,0xb3f3,0x8145,0xd7a8,0xc7d2,0xd8a7,0xcac0,0x8146,
-0xc7f0,0xb1fb,0xd2b5,0xb4d4,0xb6ab,0xcbbf,0xd8a9,0x8147,
-0x8148,0x8149,0xb6aa,0x814a,0xc1bd,0xd1cf,0x814b,0xc9a5,
-0xd8ad,0x814c,0xb8f6,0xd1be,0xe3dc,0xd6d0,0x814d,0x814e,
-0xb7e1,0x814f,0xb4ae,0x8150,0xc1d9,0x8151,0xd8bc,0x8152,
-0xcde8,0xb5a4,0xceaa,0xd6f7,0x8153,0xc0f6,0xbed9,0xd8af,
-0x8154,0x8155,0x8156,0xc4cb,0x8157,0xbec3,0x8158,0xd8b1,
-0xc3b4,0xd2e5,0x8159,0xd6ae,0xceda,0xd5a7,0xbaf5,0xb7a6,
-0xc0d6,0x815a,0xc6b9,0xc5d2,0xc7c7,0x815b,0xb9d4,0x815c,
-0xb3cb,0xd2d2,0x815d,0x815e,0xd8bf,0xbec5,0xc6f2,0xd2b2,
-0xcfb0,0xcfe7,0x815f,0x8160,0x8161,0x8162,0xcae9,0x8163,
-0x8164,0xd8c0,0x8165,0x8166,0x8167,0x8168,0x8169,0x816a,
-0xc2f2,0xc2d2,0x816b,0xc8e9,0x816c,0x816d,0x816e,0x816f,
-0x8170,0x8171,0x8172,0x8173,0x8174,0x8175,0xc7ac,0x8176,
-0x8177,0x8178,0x8179,0x817a,0x817b,0x817c,0xc1cb,0x817d,
-0xd3e8,0xd5f9,0x817e,0xcac2,0xb6fe,0xd8a1,0xd3da,0xbff7,
-0x8180,0xd4c6,0xbba5,0xd8c1,0xcee5,0xbeae,0x8181,0x8182,
-0xd8a8,0x8183,0xd1c7,0xd0a9,0x8184,0x8185,0x8186,0xd8bd,
-0xd9ef,0xcdf6,0xbfba,0x8187,0xbdbb,0xbaa5,0xd2e0,0xb2fa,
-0xbae0,0xc4b6,0x8188,0xcfed,0xbea9,0xcda4,0xc1c1,0x8189,
-0x818a,0x818b,0xc7d7,0xd9f1,0x818c,0xd9f4,0x818d,0x818e,
-0x818f,0x8190,0xc8cb,0xd8e9,0x8191,0x8192,0x8193,0xd2da,
-0xcab2,0xc8ca,0xd8ec,0xd8ea,0xd8c6,0xbdf6,0xc6cd,0xb3f0,
-0x8194,0xd8eb,0xbdf1,0xbde9,0x8195,0xc8d4,0xb4d3,0x8196,
-0x8197,0xc2d8,0x8198,0xb2d6,0xd7d0,0xcacb,0xcbfb,0xd5cc,
-0xb8b6,0xcfc9,0x8199,0x819a,0x819b,0xd9da,0xd8f0,0xc7aa,
-0x819c,0xd8ee,0x819d,0xb4fa,0xc1ee,0xd2d4,0x819e,0x819f,
-0xd8ed,0x81a0,0xd2c7,0xd8ef,0xc3c7,0x81a1,0x81a2,0x81a3,
-0xd1f6,0x81a4,0xd6d9,0xd8f2,0x81a5,0xd8f5,0xbcfe,0xbcdb,
-0x81a6,0x81a7,0x81a8,0xc8ce,0x81a9,0xb7dd,0x81aa,0xb7c2,
-0x81ab,0xc6f3,0x81ac,0x81ad,0x81ae,0x81af,0x81b0,0x81b1,
-0x81b2,0xd8f8,0xd2c1,0x81b3,0x81b4,0xcee9,0xbcbf,0xb7fc,
-0xb7a5,0xd0dd,0x81b5,0x81b6,0x81b7,0x81b8,0x81b9,0xd6da,
-0xd3c5,0xbbef,0xbbe1,0xd8f1,0x81ba,0x81bb,0xc9a1,0xceb0,
-0xb4ab,0x81bc,0xd8f3,0x81bd,0xc9cb,0xd8f6,0xc2d7,0xd8f7,
-0x81be,0x81bf,0xceb1,0xd8f9,0x81c0,0x81c1,0x81c2,0xb2ae,
-0xb9c0,0x81c3,0xd9a3,0x81c4,0xb0e9,0x81c5,0xc1e6,0x81c6,
-0xc9ec,0x81c7,0xcbc5,0x81c8,0xcbc6,0xd9a4,0x81c9,0x81ca,
-0x81cb,0x81cc,0x81cd,0xb5e8,0x81ce,0x81cf,0xb5ab,0x81d0,
-0x81d1,0x81d2,0x81d3,0x81d4,0x81d5,0xcebb,0xb5cd,0xd7a1,
-0xd7f4,0xd3d3,0x81d6,0xcce5,0x81d7,0xbace,0x81d8,0xd9a2,
-0xd9dc,0xd3e0,0xd8fd,0xb7f0,0xd7f7,0xd8fe,0xd8fa,0xd9a1,
-0xc4e3,0x81d9,0x81da,0xd3b6,0xd8f4,0xd9dd,0x81db,0xd8fb,
-0x81dc,0xc5e5,0x81dd,0x81de,0xc0d0,0x81df,0x81e0,0xd1f0,
-0xb0db,0x81e1,0x81e2,0xbcd1,0xd9a6,0x81e3,0xd9a5,0x81e4,
-0x81e5,0x81e6,0x81e7,0xd9ac,0xd9ae,0x81e8,0xd9ab,0xcab9,
-0x81e9,0x81ea,0x81eb,0xd9a9,0xd6b6,0x81ec,0x81ed,0x81ee,
-0xb3de,0xd9a8,0x81ef,0xc0fd,0x81f0,0xcacc,0x81f1,0xd9aa,
-0x81f2,0xd9a7,0x81f3,0x81f4,0xd9b0,0x81f5,0x81f6,0xb6b1,
-0x81f7,0x81f8,0x81f9,0xb9a9,0x81fa,0xd2c0,0x81fb,0x81fc,
-0xcfc0,0x81fd,0x81fe,0xc2c2,0x8240,0xbdc4,0xd5ec,0xb2e0,
-0xc7c8,0xbfeb,0xd9ad,0x8241,0xd9af,0x8242,0xceea,0xbaee,
-0x8243,0x8244,0x8245,0x8246,0x8247,0xc7d6,0x8248,0x8249,
-0x824a,0x824b,0x824c,0x824d,0x824e,0x824f,0x8250,0xb1e3,
-0x8251,0x8252,0x8253,0xb4d9,0xb6ed,0xd9b4,0x8254,0x8255,
-0x8256,0x8257,0xbfa1,0x8258,0x8259,0x825a,0xd9de,0xc7ce,
-0xc0fe,0xd9b8,0x825b,0x825c,0x825d,0x825e,0x825f,0xcbd7,
-0xb7fd,0x8260,0xd9b5,0x8261,0xd9b7,0xb1a3,0xd3e1,0xd9b9,
-0x8262,0xd0c5,0x8263,0xd9b6,0x8264,0x8265,0xd9b1,0x8266,
-0xd9b2,0xc1a9,0xd9b3,0x8267,0x8268,0xbcf3,0xd0de,0xb8a9,
-0x8269,0xbee3,0x826a,0xd9bd,0x826b,0x826c,0x826d,0x826e,
-0xd9ba,0x826f,0xb0b3,0x8270,0x8271,0x8272,0xd9c2,0x8273,
-0x8274,0x8275,0x8276,0x8277,0x8278,0x8279,0x827a,0x827b,
-0x827c,0x827d,0x827e,0x8280,0xd9c4,0xb1b6,0x8281,0xd9bf,
-0x8282,0x8283,0xb5b9,0x8284,0xbef3,0x8285,0x8286,0x8287,
-0xccc8,0xbaf2,0xd2d0,0x8288,0xd9c3,0x8289,0x828a,0xbde8,
-0x828b,0xb3ab,0x828c,0x828d,0x828e,0xd9c5,0xbeeb,0x828f,
-0xd9c6,0xd9bb,0xc4df,0x8290,0xd9be,0xd9c1,0xd9c0,0x8291,
-0x8292,0x8293,0x8294,0x8295,0x8296,0x8297,0x8298,0x8299,
-0x829a,0x829b,0xd5ae,0x829c,0xd6b5,0x829d,0xc7e3,0x829e,
-0x829f,0x82a0,0x82a1,0xd9c8,0x82a2,0x82a3,0x82a4,0xbcd9,
-0xd9ca,0x82a5,0x82a6,0x82a7,0xd9bc,0x82a8,0xd9cb,0xc6ab,
-0x82a9,0x82aa,0x82ab,0x82ac,0x82ad,0xd9c9,0x82ae,0x82af,
-0x82b0,0x82b1,0xd7f6,0x82b2,0xcda3,0x82b3,0x82b4,0x82b5,
-0x82b6,0x82b7,0x82b8,0x82b9,0x82ba,0xbda1,0x82bb,0x82bc,
-0x82bd,0x82be,0x82bf,0x82c0,0xd9cc,0x82c1,0x82c2,0x82c3,
-0x82c4,0x82c5,0x82c6,0x82c7,0x82c8,0x82c9,0xc5bc,0xcdb5,
-0x82ca,0x82cb,0x82cc,0xd9cd,0x82cd,0x82ce,0xd9c7,0xb3a5,
-0xbffe,0x82cf,0x82d0,0x82d1,0x82d2,0xb8b5,0x82d3,0x82d4,
-0xc0fc,0x82d5,0x82d6,0x82d7,0x82d8,0xb0f8,0x82d9,0x82da,
-0x82db,0x82dc,0x82dd,0x82de,0x82df,0x82e0,0x82e1,0x82e2,
-0x82e3,0x82e4,0x82e5,0x82e6,0x82e7,0x82e8,0x82e9,0x82ea,
-0x82eb,0x82ec,0x82ed,0xb4f6,0x82ee,0xd9ce,0x82ef,0xd9cf,
-0xb4a2,0xd9d0,0x82f0,0x82f1,0xb4df,0x82f2,0x82f3,0x82f4,
-0x82f5,0x82f6,0xb0c1,0x82f7,0x82f8,0x82f9,0x82fa,0x82fb,
-0x82fc,0x82fd,0xd9d1,0xc9b5,0x82fe,0x8340,0x8341,0x8342,
-0x8343,0x8344,0x8345,0x8346,0x8347,0x8348,0x8349,0x834a,
-0x834b,0x834c,0x834d,0x834e,0x834f,0x8350,0x8351,0xcff1,
-0x8352,0x8353,0x8354,0x8355,0x8356,0x8357,0xd9d2,0x8358,
-0x8359,0x835a,0xc1c5,0x835b,0x835c,0x835d,0x835e,0x835f,
-0x8360,0x8361,0x8362,0x8363,0x8364,0x8365,0xd9d6,0xc9ae,
-0x8366,0x8367,0x8368,0x8369,0xd9d5,0xd9d4,0xd9d7,0x836a,
-0x836b,0x836c,0x836d,0xcbdb,0x836e,0xbda9,0x836f,0x8370,
-0x8371,0x8372,0x8373,0xc6a7,0x8374,0x8375,0x8376,0x8377,
-0x8378,0x8379,0x837a,0x837b,0x837c,0x837d,0xd9d3,0xd9d8,
-0x837e,0x8380,0x8381,0xd9d9,0x8382,0x8383,0x8384,0x8385,
-0x8386,0x8387,0xc8e5,0x8388,0x8389,0x838a,0x838b,0x838c,
-0x838d,0x838e,0x838f,0x8390,0x8391,0x8392,0x8393,0x8394,
-0x8395,0xc0dc,0x8396,0x8397,0x8398,0x8399,0x839a,0x839b,
-0x839c,0x839d,0x839e,0x839f,0x83a0,0x83a1,0x83a2,0x83a3,
-0x83a4,0x83a5,0x83a6,0x83a7,0x83a8,0x83a9,0x83aa,0x83ab,
-0x83ac,0x83ad,0x83ae,0x83af,0x83b0,0x83b1,0x83b2,0xb6f9,
-0xd8a3,0xd4ca,0x83b3,0xd4aa,0xd0d6,0xb3e4,0xd5d7,0x83b4,
-0xcfc8,0xb9e2,0x83b5,0xbfcb,0x83b6,0xc3e2,0x83b7,0x83b8,
-0x83b9,0xb6d2,0x83ba,0x83bb,0xcdc3,0xd9ee,0xd9f0,0x83bc,
-0x83bd,0x83be,0xb5b3,0x83bf,0xb6b5,0x83c0,0x83c1,0x83c2,
-0x83c3,0x83c4,0xbea4,0x83c5,0x83c6,0xc8eb,0x83c7,0x83c8,
-0xc8ab,0x83c9,0x83ca,0xb0cb,0xb9ab,0xc1f9,0xd9e2,0x83cb,
-0xc0bc,0xb9b2,0x83cc,0xb9d8,0xd0cb,0xb1f8,0xc6e4,0xbedf,
-0xb5e4,0xd7c8,0x83cd,0xd1f8,0xbce6,0xcade,0x83ce,0x83cf,
-0xbcbd,0xd9e6,0xd8e7,0x83d0,0x83d1,0xc4da,0x83d2,0x83d3,
-0xb8d4,0xc8bd,0x83d4,0x83d5,0xb2e1,0xd4d9,0x83d6,0x83d7,
-0x83d8,0x83d9,0xc3b0,0x83da,0x83db,0xc3e1,0xdaa2,0xc8df,
-0x83dc,0xd0b4,0x83dd,0xbefc,0xc5a9,0x83de,0x83df,0x83e0,
-0xb9da,0x83e1,0xdaa3,0x83e2,0xd4a9,0xdaa4,0x83e3,0x83e4,
-0x83e5,0x83e6,0x83e7,0xd9fb,0xb6ac,0x83e8,0x83e9,0xb7eb,
-0xb1f9,0xd9fc,0xb3e5,0xbef6,0x83ea,0xbff6,0xd2b1,0xc0e4,
-0x83eb,0x83ec,0x83ed,0xb6b3,0xd9fe,0xd9fd,0x83ee,0x83ef,
-0xbebb,0x83f0,0x83f1,0x83f2,0xc6e0,0x83f3,0xd7bc,0xdaa1,
-0x83f4,0xc1b9,0x83f5,0xb5f2,0xc1e8,0x83f6,0x83f7,0xbcf5,
-0x83f8,0xb4d5,0x83f9,0x83fa,0x83fb,0x83fc,0x83fd,0x83fe,
-0x8440,0x8441,0x8442,0xc1dd,0x8443,0xc4fd,0x8444,0x8445,
-0xbcb8,0xb7b2,0x8446,0x8447,0xb7ef,0x8448,0x8449,0x844a,
-0x844b,0x844c,0x844d,0xd9ec,0x844e,0xc6be,0x844f,0xbfad,
-0xbbcb,0x8450,0x8451,0xb5ca,0x8452,0xdbc9,0xd0d7,0x8453,
-0xcdb9,0xb0bc,0xb3f6,0xbbf7,0xdbca,0xbaaf,0x8454,0xd4e4,
-0xb5b6,0xb5f3,0xd8d6,0xc8d0,0x8455,0x8456,0xb7d6,0xc7d0,
-0xd8d7,0x8457,0xbfaf,0x8458,0x8459,0xdbbb,0xd8d8,0x845a,
-0x845b,0xd0cc,0xbbae,0x845c,0x845d,0x845e,0xebbe,0xc1d0,
-0xc1f5,0xd4f2,0xb8d5,0xb4b4,0x845f,0xb3f5,0x8460,0x8461,
-0xc9be,0x8462,0x8463,0x8464,0xc5d0,0x8465,0x8466,0x8467,
-0xc5d9,0xc0fb,0x8468,0xb1f0,0x8469,0xd8d9,0xb9ce,0x846a,
-0xb5bd,0x846b,0x846c,0xd8da,0x846d,0x846e,0xd6c6,0xcba2,
-0xc8af,0xc9b2,0xb4cc,0xbfcc,0x846f,0xb9f4,0x8470,0xd8db,
-0xd8dc,0xb6e7,0xbcc1,0xccea,0x8471,0x8472,0x8473,0x8474,
-0x8475,0x8476,0xcff7,0x8477,0xd8dd,0xc7b0,0x8478,0x8479,
-0xb9d0,0xbda3,0x847a,0x847b,0xccde,0x847c,0xc6ca,0x847d,
-0x847e,0x8480,0x8481,0x8482,0xd8e0,0x8483,0xd8de,0x8484,
-0x8485,0xd8df,0x8486,0x8487,0x8488,0xb0fe,0x8489,0xbee7,
-0x848a,0xcaa3,0xbcf4,0x848b,0x848c,0x848d,0x848e,0xb8b1,
-0x848f,0x8490,0xb8ee,0x8491,0x8492,0x8493,0x8494,0x8495,
-0x8496,0x8497,0x8498,0x8499,0x849a,0xd8e2,0x849b,0xbdcb,
-0x849c,0xd8e4,0xd8e3,0x849d,0x849e,0x849f,0x84a0,0x84a1,
-0xc5fc,0x84a2,0x84a3,0x84a4,0x84a5,0x84a6,0x84a7,0x84a8,
-0xd8e5,0x84a9,0x84aa,0xd8e6,0x84ab,0x84ac,0x84ad,0x84ae,
-0x84af,0x84b0,0x84b1,0xc1a6,0x84b2,0xc8b0,0xb0ec,0xb9a6,
-0xbcd3,0xcef1,0xdbbd,0xc1d3,0x84b3,0x84b4,0x84b5,0x84b6,
-0xb6af,0xd6fa,0xc5ac,0xbdd9,0xdbbe,0xdbbf,0x84b7,0x84b8,
-0x84b9,0xc0f8,0xbea2,0xc0cd,0x84ba,0x84bb,0x84bc,0x84bd,
-0x84be,0x84bf,0x84c0,0x84c1,0x84c2,0x84c3,0xdbc0,0xcac6,
-0x84c4,0x84c5,0x84c6,0xb2aa,0x84c7,0x84c8,0x84c9,0xd3c2,
-0x84ca,0xc3e3,0x84cb,0xd1ab,0x84cc,0x84cd,0x84ce,0x84cf,
-0xdbc2,0x84d0,0xc0d5,0x84d1,0x84d2,0x84d3,0xdbc3,0x84d4,
-0xbfb1,0x84d5,0x84d6,0x84d7,0x84d8,0x84d9,0x84da,0xc4bc,
-0x84db,0x84dc,0x84dd,0x84de,0xc7da,0x84df,0x84e0,0x84e1,
-0x84e2,0x84e3,0x84e4,0x84e5,0x84e6,0x84e7,0x84e8,0x84e9,
-0xdbc4,0x84ea,0x84eb,0x84ec,0x84ed,0x84ee,0x84ef,0x84f0,
-0x84f1,0xd9e8,0xc9d7,0x84f2,0x84f3,0x84f4,0xb9b4,0xcef0,
-0xd4c8,0x84f5,0x84f6,0x84f7,0x84f8,0xb0fc,0xb4d2,0x84f9,
-0xd0d9,0x84fa,0x84fb,0x84fc,0x84fd,0xd9e9,0x84fe,0xdecb,
-0xd9eb,0x8540,0x8541,0x8542,0x8543,0xd8b0,0xbbaf,0xb1b1,
-0x8544,0xb3d7,0xd8ce,0x8545,0x8546,0xd4d1,0x8547,0x8548,
-0xbdb3,0xbfef,0x8549,0xcfbb,0x854a,0x854b,0xd8d0,0x854c,
-0x854d,0x854e,0xb7cb,0x854f,0x8550,0x8551,0xd8d1,0x8552,
-0x8553,0x8554,0x8555,0x8556,0x8557,0x8558,0x8559,0x855a,
-0x855b,0xc6a5,0xc7f8,0xd2bd,0x855c,0x855d,0xd8d2,0xc4e4,
-0x855e,0xcaae,0x855f,0xc7a7,0x8560,0xd8a6,0x8561,0xc9fd,
-0xcee7,0xbbdc,0xb0eb,0x8562,0x8563,0x8564,0xbbaa,0xd0ad,
-0x8565,0xb1b0,0xd7e4,0xd7bf,0x8566,0xb5a5,0xc2f4,0xc4cf,
-0x8567,0x8568,0xb2a9,0x8569,0xb2b7,0x856a,0xb1e5,0xdfb2,
-0xd5bc,0xbfa8,0xc2ac,0xd8d5,0xc2b1,0x856b,0xd8d4,0xced4,
-0x856c,0xdae0,0x856d,0xcec0,0x856e,0x856f,0xd8b4,0xc3ae,
-0xd3a1,0xcea3,0x8570,0xbcb4,0xc8b4,0xc2d1,0x8571,0xbeed,
-0xd0b6,0x8572,0xdae1,0x8573,0x8574,0x8575,0x8576,0xc7e4,
-0x8577,0x8578,0xb3a7,0x8579,0xb6f2,0xccfc,0xc0fa,0x857a,
-0x857b,0xc0f7,0x857c,0xd1b9,0xd1e1,0xd8c7,0x857d,0x857e,
-0x8580,0x8581,0x8582,0x8583,0x8584,0xb2de,0x8585,0x8586,
-0xc0e5,0x8587,0xbaf1,0x8588,0x8589,0xd8c8,0x858a,0xd4ad,
-0x858b,0x858c,0xcfe1,0xd8c9,0x858d,0xd8ca,0xcfc3,0x858e,
-0xb3f8,0xbec7,0x858f,0x8590,0x8591,0x8592,0xd8cb,0x8593,
-0x8594,0x8595,0x8596,0x8597,0x8598,0x8599,0xdbcc,0x859a,
-0x859b,0x859c,0x859d,0xc8a5,0x859e,0x859f,0x85a0,0xcfd8,
-0x85a1,0xc8fe,0xb2ce,0x85a2,0x85a3,0x85a4,0x85a5,0x85a6,
-0xd3d6,0xb2e6,0xbcb0,0xd3d1,0xcbab,0xb7b4,0x85a7,0x85a8,
-0x85a9,0xb7a2,0x85aa,0x85ab,0xcae5,0x85ac,0xc8a1,0xcadc,
-0xb1e4,0xd0f0,0x85ad,0xc5d1,0x85ae,0x85af,0x85b0,0xdbc5,
-0xb5fe,0x85b1,0x85b2,0xbfda,0xb9c5,0xbee4,0xc1ed,0x85b3,
-0xdfb6,0xdfb5,0xd6bb,0xbdd0,0xd5d9,0xb0c8,0xb6a3,0xbfc9,
-0xcca8,0xdfb3,0xcab7,0xd3d2,0x85b4,0xd8cf,0xd2b6,0xbac5,
-0xcbbe,0xccbe,0x85b5,0xdfb7,0xb5f0,0xdfb4,0x85b6,0x85b7,
-0x85b8,0xd3f5,0x85b9,0xb3d4,0xb8f7,0x85ba,0xdfba,0x85bb,
-0xbacf,0xbcaa,0xb5f5,0x85bc,0xcdac,0xc3fb,0xbaf3,0xc0f4,
-0xcdc2,0xcff2,0xdfb8,0xcfc5,0x85bd,0xc2c0,0xdfb9,0xc2f0,
-0x85be,0x85bf,0x85c0,0xbefd,0x85c1,0xc1df,0xcdcc,0xd2f7,
-0xb7cd,0xdfc1,0x85c2,0xdfc4,0x85c3,0x85c4,0xb7f1,0xb0c9,
-0xb6d6,0xb7d4,0x85c5,0xbaac,0xccfd,0xbfd4,0xcbb1,0xc6f4,
-0x85c6,0xd6a8,0xdfc5,0x85c7,0xcee2,0xb3b3,0x85c8,0x85c9,
-0xcefc,0xb4b5,0x85ca,0xcec7,0xbaf0,0x85cb,0xcee1,0x85cc,
-0xd1bd,0x85cd,0x85ce,0xdfc0,0x85cf,0x85d0,0xb4f4,0x85d1,
-0xb3ca,0x85d2,0xb8e6,0xdfbb,0x85d3,0x85d4,0x85d5,0x85d6,
-0xc4c5,0x85d7,0xdfbc,0xdfbd,0xdfbe,0xc5bb,0xdfbf,0xdfc2,
-0xd4b1,0xdfc3,0x85d8,0xc7ba,0xced8,0x85d9,0x85da,0x85db,
-0x85dc,0x85dd,0xc4d8,0x85de,0xdfca,0x85df,0xdfcf,0x85e0,
-0xd6dc,0x85e1,0x85e2,0x85e3,0x85e4,0x85e5,0x85e6,0x85e7,
-0x85e8,0xdfc9,0xdfda,0xceb6,0x85e9,0xbac7,0xdfce,0xdfc8,
-0xc5de,0x85ea,0x85eb,0xc9eb,0xbaf4,0xc3fc,0x85ec,0x85ed,
-0xbed7,0x85ee,0xdfc6,0x85ef,0xdfcd,0x85f0,0xc5d8,0x85f1,
-0x85f2,0x85f3,0x85f4,0xd5a6,0xbacd,0x85f5,0xbecc,0xd3bd,
-0xb8c0,0x85f6,0xd6e4,0x85f7,0xdfc7,0xb9be,0xbfa7,0x85f8,
-0x85f9,0xc1fc,0xdfcb,0xdfcc,0x85fa,0xdfd0,0x85fb,0x85fc,
-0x85fd,0x85fe,0x8640,0xdfdb,0xdfe5,0x8641,0xdfd7,0xdfd6,
-0xd7c9,0xdfe3,0xdfe4,0xe5eb,0xd2a7,0xdfd2,0x8642,0xbfa9,
-0x8643,0xd4db,0x8644,0xbfc8,0xdfd4,0x8645,0x8646,0x8647,
-0xcfcc,0x8648,0x8649,0xdfdd,0x864a,0xd1ca,0x864b,0xdfde,
-0xb0a7,0xc6b7,0xdfd3,0x864c,0xbae5,0x864d,0xb6df,0xcddb,
-0xb9fe,0xd4d5,0x864e,0x864f,0xdfdf,0xcfec,0xb0a5,0xdfe7,
-0xdfd1,0xd1c6,0xdfd5,0xdfd8,0xdfd9,0xdfdc,0x8650,0xbba9,
-0x8651,0xdfe0,0xdfe1,0x8652,0xdfe2,0xdfe6,0xdfe8,0xd3b4,
-0x8653,0x8654,0x8655,0x8656,0x8657,0xb8e7,0xc5b6,0xdfea,
-0xc9da,0xc1a8,0xc4c4,0x8658,0x8659,0xbfde,0xcff8,0x865a,
-0x865b,0x865c,0xd5dc,0xdfee,0x865d,0x865e,0x865f,0x8660,
-0x8661,0x8662,0xb2b8,0x8663,0xbadf,0xdfec,0x8664,0xdbc1,
-0x8665,0xd1e4,0x8666,0x8667,0x8668,0x8669,0xcbf4,0xb4bd,
-0x866a,0xb0a6,0x866b,0x866c,0x866d,0x866e,0x866f,0xdff1,
-0xccc6,0xdff2,0x8670,0x8671,0xdfed,0x8672,0x8673,0x8674,
-0x8675,0x8676,0x8677,0xdfe9,0x8678,0x8679,0x867a,0x867b,
-0xdfeb,0x867c,0xdfef,0xdff0,0xbbbd,0x867d,0x867e,0xdff3,
-0x8680,0x8681,0xdff4,0x8682,0xbba3,0x8683,0xcadb,0xcea8,
-0xe0a7,0xb3aa,0x8684,0xe0a6,0x8685,0x8686,0x8687,0xe0a1,
-0x8688,0x8689,0x868a,0x868b,0xdffe,0x868c,0xcdd9,0xdffc,
-0x868d,0xdffa,0x868e,0xbfd0,0xd7c4,0x868f,0xc9cc,0x8690,
-0x8691,0xdff8,0xb0a1,0x8692,0x8693,0x8694,0x8695,0x8696,
-0xdffd,0x8697,0x8698,0x8699,0x869a,0xdffb,0xe0a2,0x869b,
-0x869c,0x869d,0x869e,0x869f,0xe0a8,0x86a0,0x86a1,0x86a2,
-0x86a3,0xb7c8,0x86a4,0x86a5,0xc6a1,0xc9b6,0xc0b2,0xdff5,
-0x86a6,0x86a7,0xc5be,0x86a8,0xd8c4,0xdff9,0xc4f6,0x86a9,
-0x86aa,0x86ab,0x86ac,0x86ad,0x86ae,0xe0a3,0xe0a4,0xe0a5,
-0xd0a5,0x86af,0x86b0,0xe0b4,0xcce4,0x86b1,0xe0b1,0x86b2,
-0xbfa6,0xe0af,0xceb9,0xe0ab,0xc9c6,0x86b3,0x86b4,0xc0ae,
-0xe0ae,0xbaed,0xbab0,0xe0a9,0x86b5,0x86b6,0x86b7,0xdff6,
-0x86b8,0xe0b3,0x86b9,0x86ba,0xe0b8,0x86bb,0x86bc,0x86bd,
-0xb4ad,0xe0b9,0x86be,0x86bf,0xcfb2,0xbac8,0x86c0,0xe0b0,
-0x86c1,0x86c2,0x86c3,0x86c4,0x86c5,0x86c6,0x86c7,0xd0fa,
-0x86c8,0x86c9,0x86ca,0x86cb,0x86cc,0x86cd,0x86ce,0x86cf,
-0x86d0,0xe0ac,0x86d1,0xd4fb,0x86d2,0xdff7,0x86d3,0xc5e7,
-0x86d4,0xe0ad,0x86d5,0xd3f7,0x86d6,0xe0b6,0xe0b7,0x86d7,
-0x86d8,0x86d9,0x86da,0x86db,0xe0c4,0xd0e1,0x86dc,0x86dd,
-0x86de,0xe0bc,0x86df,0x86e0,0xe0c9,0xe0ca,0x86e1,0x86e2,
-0x86e3,0xe0be,0xe0aa,0xc9a4,0xe0c1,0x86e4,0xe0b2,0x86e5,
-0x86e6,0x86e7,0x86e8,0x86e9,0xcac8,0xe0c3,0x86ea,0xe0b5,
-0x86eb,0xcecb,0x86ec,0xcbc3,0xe0cd,0xe0c6,0xe0c2,0x86ed,
-0xe0cb,0x86ee,0xe0ba,0xe0bf,0xe0c0,0x86ef,0x86f0,0xe0c5,
-0x86f1,0x86f2,0xe0c7,0xe0c8,0x86f3,0xe0cc,0x86f4,0xe0bb,
-0x86f5,0x86f6,0x86f7,0x86f8,0x86f9,0xcbd4,0xe0d5,0x86fa,
-0xe0d6,0xe0d2,0x86fb,0x86fc,0x86fd,0x86fe,0x8740,0x8741,
-0xe0d0,0xbcce,0x8742,0x8743,0xe0d1,0x8744,0xb8c2,0xd8c5,
-0x8745,0x8746,0x8747,0x8748,0x8749,0x874a,0x874b,0x874c,
-0xd0ea,0x874d,0x874e,0xc2ef,0x874f,0x8750,0xe0cf,0xe0bd,
-0x8751,0x8752,0x8753,0xe0d4,0xe0d3,0x8754,0x8755,0xe0d7,
-0x8756,0x8757,0x8758,0x8759,0xe0dc,0xe0d8,0x875a,0x875b,
-0x875c,0xd6f6,0xb3b0,0x875d,0xd7ec,0x875e,0xcbbb,0x875f,
-0x8760,0xe0da,0x8761,0xcefb,0x8762,0x8763,0x8764,0xbad9,
-0x8765,0x8766,0x8767,0x8768,0x8769,0x876a,0x876b,0x876c,
-0x876d,0x876e,0x876f,0x8770,0xe0e1,0xe0dd,0xd2ad,0x8771,
-0x8772,0x8773,0x8774,0x8775,0xe0e2,0x8776,0x8777,0xe0db,
-0xe0d9,0xe0df,0x8778,0x8779,0xe0e0,0x877a,0x877b,0x877c,
-0x877d,0x877e,0xe0de,0x8780,0xe0e4,0x8781,0x8782,0x8783,
-0xc6f7,0xd8ac,0xd4eb,0xe0e6,0xcac9,0x8784,0x8785,0x8786,
-0x8787,0xe0e5,0x8788,0x8789,0x878a,0x878b,0xb8c1,0x878c,
-0x878d,0x878e,0x878f,0xe0e7,0xe0e8,0x8790,0x8791,0x8792,
-0x8793,0x8794,0x8795,0x8796,0x8797,0xe0e9,0xe0e3,0x8798,
-0x8799,0x879a,0x879b,0x879c,0x879d,0x879e,0xbabf,0xcce7,
-0x879f,0x87a0,0x87a1,0xe0ea,0x87a2,0x87a3,0x87a4,0x87a5,
-0x87a6,0x87a7,0x87a8,0x87a9,0x87aa,0x87ab,0x87ac,0x87ad,
-0x87ae,0x87af,0x87b0,0xcff9,0x87b1,0x87b2,0x87b3,0x87b4,
-0x87b5,0x87b6,0x87b7,0x87b8,0x87b9,0x87ba,0x87bb,0xe0eb,
-0x87bc,0x87bd,0x87be,0x87bf,0x87c0,0x87c1,0x87c2,0xc8c2,
-0x87c3,0x87c4,0x87c5,0x87c6,0xbdc0,0x87c7,0x87c8,0x87c9,
-0x87ca,0x87cb,0x87cc,0x87cd,0x87ce,0x87cf,0x87d0,0x87d1,
-0x87d2,0x87d3,0xc4d2,0x87d4,0x87d5,0x87d6,0x87d7,0x87d8,
-0x87d9,0x87da,0x87db,0x87dc,0xe0ec,0x87dd,0x87de,0xe0ed,
-0x87df,0x87e0,0xc7f4,0xcbc4,0x87e1,0xe0ee,0xbbd8,0xd8b6,
-0xd2f2,0xe0ef,0xcdc5,0x87e2,0xb6da,0x87e3,0x87e4,0x87e5,
-0x87e6,0x87e7,0x87e8,0xe0f1,0x87e9,0xd4b0,0x87ea,0x87eb,
-0xc0a7,0xb4d1,0x87ec,0x87ed,0xcea7,0xe0f0,0x87ee,0x87ef,
-0x87f0,0xe0f2,0xb9cc,0x87f1,0x87f2,0xb9fa,0xcdbc,0xe0f3,
-0x87f3,0x87f4,0x87f5,0xc6d4,0xe0f4,0x87f6,0xd4b2,0x87f7,
-0xc8a6,0xe0f6,0xe0f5,0x87f8,0x87f9,0x87fa,0x87fb,0x87fc,
-0x87fd,0x87fe,0x8840,0x8841,0x8842,0x8843,0x8844,0x8845,
-0x8846,0x8847,0x8848,0x8849,0xe0f7,0x884a,0x884b,0xcdc1,
-0x884c,0x884d,0x884e,0xcaa5,0x884f,0x8850,0x8851,0x8852,
-0xd4da,0xdbd7,0xdbd9,0x8853,0xdbd8,0xb9e7,0xdbdc,0xdbdd,
-0xb5d8,0x8854,0x8855,0xdbda,0x8856,0x8857,0x8858,0x8859,
-0x885a,0xdbdb,0xb3a1,0xdbdf,0x885b,0x885c,0xbbf8,0x885d,
-0xd6b7,0x885e,0xdbe0,0x885f,0x8860,0x8861,0x8862,0xbef9,
-0x8863,0x8864,0xb7bb,0x8865,0xdbd0,0xccae,0xbfb2,0xbbb5,
-0xd7f8,0xbfd3,0x8866,0x8867,0x8868,0x8869,0x886a,0xbfe9,
-0x886b,0x886c,0xbce1,0xccb3,0xdbde,0xb0d3,0xceeb,0xb7d8,
-0xd7b9,0xc6c2,0x886d,0x886e,0xc0a4,0x886f,0xccb9,0x8870,
-0xdbe7,0xdbe1,0xc6ba,0xdbe3,0x8871,0xdbe8,0x8872,0xc5f7,
-0x8873,0x8874,0x8875,0xdbea,0x8876,0x8877,0xdbe9,0xbfc0,
-0x8878,0x8879,0x887a,0xdbe6,0xdbe5,0x887b,0x887c,0x887d,
-0x887e,0x8880,0xb4b9,0xc0ac,0xc2a2,0xdbe2,0xdbe4,0x8881,
-0x8882,0x8883,0x8884,0xd0cd,0xdbed,0x8885,0x8886,0x8887,
-0x8888,0x8889,0xc0dd,0xdbf2,0x888a,0x888b,0x888c,0x888d,
-0x888e,0x888f,0x8890,0xb6e2,0x8891,0x8892,0x8893,0x8894,
-0xdbf3,0xdbd2,0xb9b8,0xd4ab,0xdbec,0x8895,0xbfd1,0xdbf0,
-0x8896,0xdbd1,0x8897,0xb5e6,0x8898,0xdbeb,0xbfe5,0x8899,
-0x889a,0x889b,0xdbee,0x889c,0xdbf1,0x889d,0x889e,0x889f,
-0xdbf9,0x88a0,0x88a1,0x88a2,0x88a3,0x88a4,0x88a5,0x88a6,
-0x88a7,0x88a8,0xb9a1,0xb0a3,0x88a9,0x88aa,0x88ab,0x88ac,
-0x88ad,0x88ae,0x88af,0xc2f1,0x88b0,0x88b1,0xb3c7,0xdbef,
-0x88b2,0x88b3,0xdbf8,0x88b4,0xc6d2,0xdbf4,0x88b5,0x88b6,
-0xdbf5,0xdbf7,0xdbf6,0x88b7,0x88b8,0xdbfe,0x88b9,0xd3f2,
-0xb2ba,0x88ba,0x88bb,0x88bc,0xdbfd,0x88bd,0x88be,0x88bf,
-0x88c0,0x88c1,0x88c2,0x88c3,0x88c4,0xdca4,0x88c5,0xdbfb,
-0x88c6,0x88c7,0x88c8,0x88c9,0xdbfa,0x88ca,0x88cb,0x88cc,
-0xdbfc,0xc5e0,0xbbf9,0x88cd,0x88ce,0xdca3,0x88cf,0x88d0,
-0xdca5,0x88d1,0xccc3,0x88d2,0x88d3,0x88d4,0xb6d1,0xddc0,
-0x88d5,0x88d6,0x88d7,0xdca1,0x88d8,0xdca2,0x88d9,0x88da,
-0x88db,0xc7b5,0x88dc,0x88dd,0x88de,0xb6e9,0x88df,0x88e0,
-0x88e1,0xdca7,0x88e2,0x88e3,0x88e4,0x88e5,0xdca6,0x88e6,
-0xdca9,0xb1a4,0x88e7,0x88e8,0xb5cc,0x88e9,0x88ea,0x88eb,
-0x88ec,0x88ed,0xbfb0,0x88ee,0x88ef,0x88f0,0x88f1,0x88f2,
-0xd1df,0x88f3,0x88f4,0x88f5,0x88f6,0xb6c2,0x88f7,0x88f8,
-0x88f9,0x88fa,0x88fb,0x88fc,0x88fd,0x88fe,0x8940,0x8941,
-0x8942,0x8943,0x8944,0x8945,0xdca8,0x8946,0x8947,0x8948,
-0x8949,0x894a,0x894b,0x894c,0xcbfa,0xebf3,0x894d,0x894e,
-0x894f,0xcbdc,0x8950,0x8951,0xcbfe,0x8952,0x8953,0x8954,
-0xccc1,0x8955,0x8956,0x8957,0x8958,0x8959,0xc8fb,0x895a,
-0x895b,0x895c,0x895d,0x895e,0x895f,0xdcaa,0x8960,0x8961,
-0x8962,0x8963,0x8964,0xccee,0xdcab,0x8965,0x8966,0x8967,
-0x8968,0x8969,0x896a,0x896b,0x896c,0x896d,0x896e,0x896f,
-0x8970,0x8971,0x8972,0x8973,0x8974,0x8975,0xdbd3,0x8976,
-0xdcaf,0xdcac,0x8977,0xbeb3,0x8978,0xcafb,0x8979,0x897a,
-0x897b,0xdcad,0x897c,0x897d,0x897e,0x8980,0x8981,0x8982,
-0x8983,0x8984,0xc9ca,0xc4b9,0x8985,0x8986,0x8987,0x8988,
-0x8989,0xc7bd,0xdcae,0x898a,0x898b,0x898c,0xd4f6,0xd0e6,
-0x898d,0x898e,0x898f,0x8990,0x8991,0x8992,0x8993,0x8994,
-0xc4ab,0xb6d5,0x8995,0x8996,0x8997,0x8998,0x8999,0x899a,
-0x899b,0x899c,0x899d,0x899e,0x899f,0x89a0,0x89a1,0x89a2,
-0x89a3,0x89a4,0x89a5,0x89a6,0xdbd4,0x89a7,0x89a8,0x89a9,
-0x89aa,0xb1da,0x89ab,0x89ac,0x89ad,0xdbd5,0x89ae,0x89af,
-0x89b0,0x89b1,0x89b2,0x89b3,0x89b4,0x89b5,0x89b6,0x89b7,
-0x89b8,0xdbd6,0x89b9,0x89ba,0x89bb,0xbabe,0x89bc,0x89bd,
-0x89be,0x89bf,0x89c0,0x89c1,0x89c2,0x89c3,0x89c4,0x89c5,
-0x89c6,0x89c7,0x89c8,0x89c9,0xc8c0,0x89ca,0x89cb,0x89cc,
-0x89cd,0x89ce,0x89cf,0xcabf,0xc8c9,0x89d0,0xd7b3,0x89d1,
-0xc9f9,0x89d2,0x89d3,0xbfc7,0x89d4,0x89d5,0xbaf8,0x89d6,
-0x89d7,0xd2bc,0x89d8,0x89d9,0x89da,0x89db,0x89dc,0x89dd,
-0x89de,0x89df,0xe2ba,0x89e0,0xb4a6,0x89e1,0x89e2,0xb1b8,
-0x89e3,0x89e4,0x89e5,0x89e6,0x89e7,0xb8b4,0x89e8,0xcfc4,
-0x89e9,0x89ea,0x89eb,0x89ec,0xd9e7,0xcfa6,0xcde2,0x89ed,
-0x89ee,0xd9ed,0xb6e0,0x89ef,0xd2b9,0x89f0,0x89f1,0xb9bb,
-0x89f2,0x89f3,0x89f4,0x89f5,0xe2b9,0xe2b7,0x89f6,0xb4f3,
-0x89f7,0xccec,0xccab,0xb7f2,0x89f8,0xd8b2,0xd1eb,0xbabb,
-0x89f9,0xcaa7,0x89fa,0x89fb,0xcdb7,0x89fc,0x89fd,0xd2c4,
-0xbfe4,0xbcd0,0xb6e1,0x89fe,0xdec5,0x8a40,0x8a41,0x8a42,
-0x8a43,0xdec6,0xdbbc,0x8a44,0xd1d9,0x8a45,0x8a46,0xc6e6,
-0xc4ce,0xb7ee,0x8a47,0xb7dc,0x8a48,0x8a49,0xbffc,0xd7e0,
-0x8a4a,0xc6f5,0x8a4b,0x8a4c,0xb1bc,0xdec8,0xbdb1,0xccd7,
-0xdeca,0x8a4d,0xdec9,0x8a4e,0x8a4f,0x8a50,0x8a51,0x8a52,
-0xb5ec,0x8a53,0xc9dd,0x8a54,0x8a55,0xb0c2,0x8a56,0x8a57,
-0x8a58,0x8a59,0x8a5a,0x8a5b,0x8a5c,0x8a5d,0x8a5e,0x8a5f,
-0x8a60,0x8a61,0x8a62,0xc5ae,0xc5ab,0x8a63,0xc4cc,0x8a64,
-0xbce9,0xcbfd,0x8a65,0x8a66,0x8a67,0xbac3,0x8a68,0x8a69,
-0x8a6a,0xe5f9,0xc8e7,0xe5fa,0xcdfd,0x8a6b,0xd7b1,0xb8be,
-0xc2e8,0x8a6c,0xc8d1,0x8a6d,0x8a6e,0xe5fb,0x8a6f,0x8a70,
-0x8a71,0x8a72,0xb6ca,0xbccb,0x8a73,0x8a74,0xd1fd,0xe6a1,
-0x8a75,0xc3ee,0x8a76,0x8a77,0x8a78,0x8a79,0xe6a4,0x8a7a,
-0x8a7b,0x8a7c,0x8a7d,0xe5fe,0xe6a5,0xcdd7,0x8a7e,0x8a80,
-0xb7c1,0xe5fc,0xe5fd,0xe6a3,0x8a81,0x8a82,0xc4dd,0xe6a8,
-0x8a83,0x8a84,0xe6a7,0x8a85,0x8a86,0x8a87,0x8a88,0x8a89,
-0x8a8a,0xc3c3,0x8a8b,0xc6de,0x8a8c,0x8a8d,0xe6aa,0x8a8e,
-0x8a8f,0x8a90,0x8a91,0x8a92,0x8a93,0x8a94,0xc4b7,0x8a95,
-0x8a96,0x8a97,0xe6a2,0xcabc,0x8a98,0x8a99,0x8a9a,0x8a9b,
-0xbde3,0xb9c3,0xe6a6,0xd0d5,0xceaf,0x8a9c,0x8a9d,0xe6a9,
-0xe6b0,0x8a9e,0xd2a6,0x8a9f,0xbdaa,0xe6ad,0x8aa0,0x8aa1,
-0x8aa2,0x8aa3,0x8aa4,0xe6af,0x8aa5,0xc0d1,0x8aa6,0x8aa7,
-0xd2cc,0x8aa8,0x8aa9,0x8aaa,0xbca7,0x8aab,0x8aac,0x8aad,
-0x8aae,0x8aaf,0x8ab0,0x8ab1,0x8ab2,0x8ab3,0x8ab4,0x8ab5,
-0x8ab6,0xe6b1,0x8ab7,0xd2f6,0x8ab8,0x8ab9,0x8aba,0xd7cb,
-0x8abb,0xcdfe,0x8abc,0xcdde,0xc2a6,0xe6ab,0xe6ac,0xbdbf,
-0xe6ae,0xe6b3,0x8abd,0x8abe,0xe6b2,0x8abf,0x8ac0,0x8ac1,
-0x8ac2,0xe6b6,0x8ac3,0xe6b8,0x8ac4,0x8ac5,0x8ac6,0x8ac7,
-0xc4ef,0x8ac8,0x8ac9,0x8aca,0xc4c8,0x8acb,0x8acc,0xbeea,
-0xc9ef,0x8acd,0x8ace,0xe6b7,0x8acf,0xb6f0,0x8ad0,0x8ad1,
-0x8ad2,0xc3e4,0x8ad3,0x8ad4,0x8ad5,0x8ad6,0x8ad7,0x8ad8,
-0x8ad9,0xd3e9,0xe6b4,0x8ada,0xe6b5,0x8adb,0xc8a2,0x8adc,
-0x8add,0x8ade,0x8adf,0x8ae0,0xe6bd,0x8ae1,0x8ae2,0x8ae3,
-0xe6b9,0x8ae4,0x8ae5,0x8ae6,0x8ae7,0x8ae8,0xc6c5,0x8ae9,
-0x8aea,0xcdf1,0xe6bb,0x8aeb,0x8aec,0x8aed,0x8aee,0x8aef,
-0x8af0,0x8af1,0x8af2,0x8af3,0x8af4,0xe6bc,0x8af5,0x8af6,
-0x8af7,0x8af8,0xbbe9,0x8af9,0x8afa,0x8afb,0x8afc,0x8afd,
-0x8afe,0x8b40,0xe6be,0x8b41,0x8b42,0x8b43,0x8b44,0xe6ba,
-0x8b45,0x8b46,0xc0b7,0x8b47,0x8b48,0x8b49,0x8b4a,0x8b4b,
-0x8b4c,0x8b4d,0x8b4e,0x8b4f,0xd3a4,0xe6bf,0xc9f4,0xe6c3,
-0x8b50,0x8b51,0xe6c4,0x8b52,0x8b53,0x8b54,0x8b55,0xd0f6,
-0x8b56,0x8b57,0x8b58,0x8b59,0x8b5a,0x8b5b,0x8b5c,0x8b5d,
-0x8b5e,0x8b5f,0x8b60,0x8b61,0x8b62,0x8b63,0x8b64,0x8b65,
-0x8b66,0x8b67,0xc3bd,0x8b68,0x8b69,0x8b6a,0x8b6b,0x8b6c,
-0x8b6d,0x8b6e,0xc3c4,0xe6c2,0x8b6f,0x8b70,0x8b71,0x8b72,
-0x8b73,0x8b74,0x8b75,0x8b76,0x8b77,0x8b78,0x8b79,0x8b7a,
-0x8b7b,0x8b7c,0xe6c1,0x8b7d,0x8b7e,0x8b80,0x8b81,0x8b82,
-0x8b83,0x8b84,0xe6c7,0xcfb1,0x8b85,0xebf4,0x8b86,0x8b87,
-0xe6ca,0x8b88,0x8b89,0x8b8a,0x8b8b,0x8b8c,0xe6c5,0x8b8d,
-0x8b8e,0xbcde,0xc9a9,0x8b8f,0x8b90,0x8b91,0x8b92,0x8b93,
-0x8b94,0xbcb5,0x8b95,0x8b96,0xcfd3,0x8b97,0x8b98,0x8b99,
-0x8b9a,0x8b9b,0xe6c8,0x8b9c,0xe6c9,0x8b9d,0xe6ce,0x8b9e,
-0xe6d0,0x8b9f,0x8ba0,0x8ba1,0xe6d1,0x8ba2,0x8ba3,0x8ba4,
-0xe6cb,0xb5d5,0x8ba5,0xe6cc,0x8ba6,0x8ba7,0xe6cf,0x8ba8,
-0x8ba9,0xc4db,0x8baa,0xe6c6,0x8bab,0x8bac,0x8bad,0x8bae,
-0x8baf,0xe6cd,0x8bb0,0x8bb1,0x8bb2,0x8bb3,0x8bb4,0x8bb5,
-0x8bb6,0x8bb7,0x8bb8,0x8bb9,0x8bba,0x8bbb,0x8bbc,0x8bbd,
-0x8bbe,0x8bbf,0x8bc0,0x8bc1,0x8bc2,0x8bc3,0x8bc4,0x8bc5,
-0x8bc6,0xe6d2,0x8bc7,0x8bc8,0x8bc9,0x8bca,0x8bcb,0x8bcc,
-0x8bcd,0x8bce,0x8bcf,0x8bd0,0x8bd1,0x8bd2,0xe6d4,0xe6d3,
-0x8bd3,0x8bd4,0x8bd5,0x8bd6,0x8bd7,0x8bd8,0x8bd9,0x8bda,
-0x8bdb,0x8bdc,0x8bdd,0x8bde,0x8bdf,0x8be0,0x8be1,0x8be2,
-0x8be3,0x8be4,0x8be5,0x8be6,0x8be7,0x8be8,0x8be9,0x8bea,
-0x8beb,0x8bec,0xe6d5,0x8bed,0xd9f8,0x8bee,0x8bef,0xe6d6,
-0x8bf0,0x8bf1,0x8bf2,0x8bf3,0x8bf4,0x8bf5,0x8bf6,0x8bf7,
-0xe6d7,0x8bf8,0x8bf9,0x8bfa,0x8bfb,0x8bfc,0x8bfd,0x8bfe,
-0x8c40,0x8c41,0x8c42,0x8c43,0x8c44,0x8c45,0x8c46,0x8c47,
-0xd7d3,0xe6dd,0x8c48,0xe6de,0xbfd7,0xd4d0,0x8c49,0xd7d6,
-0xb4e6,0xcbef,0xe6da,0xd8c3,0xd7ce,0xd0a2,0x8c4a,0xc3cf,
-0x8c4b,0x8c4c,0xe6df,0xbcbe,0xb9c2,0xe6db,0xd1a7,0x8c4d,
-0x8c4e,0xbaa2,0xc2cf,0x8c4f,0xd8ab,0x8c50,0x8c51,0x8c52,
-0xcaeb,0xe5ee,0x8c53,0xe6dc,0x8c54,0xb7f5,0x8c55,0x8c56,
-0x8c57,0x8c58,0xc8e6,0x8c59,0x8c5a,0xc4f5,0x8c5b,0x8c5c,
-0xe5b2,0xc4fe,0x8c5d,0xcbfc,0xe5b3,0xd5ac,0x8c5e,0xd3ee,
-0xcad8,0xb0b2,0x8c5f,0xcbce,0xcdea,0x8c60,0x8c61,0xbaea,
-0x8c62,0x8c63,0x8c64,0xe5b5,0x8c65,0xe5b4,0x8c66,0xd7da,
-0xb9d9,0xd6e6,0xb6a8,0xcdf0,0xd2cb,0xb1a6,0xcab5,0x8c67,
-0xb3e8,0xc9f3,0xbfcd,0xd0fb,0xcad2,0xe5b6,0xbbc2,0x8c68,
-0x8c69,0x8c6a,0xcfdc,0xb9ac,0x8c6b,0x8c6c,0x8c6d,0x8c6e,
-0xd4d7,0x8c6f,0x8c70,0xbaa6,0xd1e7,0xcffc,0xbcd2,0x8c71,
-0xe5b7,0xc8dd,0x8c72,0x8c73,0x8c74,0xbfed,0xb1f6,0xcbde,
-0x8c75,0x8c76,0xbcc5,0x8c77,0xbcc4,0xd2fa,0xc3dc,0xbfdc,
-0x8c78,0x8c79,0x8c7a,0x8c7b,0xb8bb,0x8c7c,0x8c7d,0x8c7e,
-0xc3c2,0x8c80,0xbaae,0xd4a2,0x8c81,0x8c82,0x8c83,0x8c84,
-0x8c85,0x8c86,0x8c87,0x8c88,0x8c89,0xc7de,0xc4af,0xb2ec,
-0x8c8a,0xb9d1,0x8c8b,0x8c8c,0xe5bb,0xc1c8,0x8c8d,0x8c8e,
-0xd5af,0x8c8f,0x8c90,0x8c91,0x8c92,0x8c93,0xe5bc,0x8c94,
-0xe5be,0x8c95,0x8c96,0x8c97,0x8c98,0x8c99,0x8c9a,0x8c9b,
-0xb4e7,0xb6d4,0xcbc2,0xd1b0,0xb5bc,0x8c9c,0x8c9d,0xcad9,
-0x8c9e,0xb7e2,0x8c9f,0x8ca0,0xc9e4,0x8ca1,0xbdab,0x8ca2,
-0x8ca3,0xcebe,0xd7f0,0x8ca4,0x8ca5,0x8ca6,0x8ca7,0xd0a1,
-0x8ca8,0xc9d9,0x8ca9,0x8caa,0xb6fb,0xe6d8,0xbce2,0x8cab,
-0xb3be,0x8cac,0xc9d0,0x8cad,0xe6d9,0xb3a2,0x8cae,0x8caf,
-0x8cb0,0x8cb1,0xdecc,0x8cb2,0xd3c8,0xdecd,0x8cb3,0xd2a2,
-0x8cb4,0x8cb5,0x8cb6,0x8cb7,0xdece,0x8cb8,0x8cb9,0x8cba,
-0x8cbb,0xbecd,0x8cbc,0x8cbd,0xdecf,0x8cbe,0x8cbf,0x8cc0,
-0xcaac,0xd2fc,0xb3df,0xe5ea,0xc4e1,0xbea1,0xceb2,0xc4f2,
-0xbed6,0xc6a8,0xb2e3,0x8cc1,0x8cc2,0xbed3,0x8cc3,0x8cc4,
-0xc7fc,0xcceb,0xbdec,0xcedd,0x8cc5,0x8cc6,0xcaba,0xc6c1,
-0xe5ec,0xd0bc,0x8cc7,0x8cc8,0x8cc9,0xd5b9,0x8cca,0x8ccb,
-0x8ccc,0xe5ed,0x8ccd,0x8cce,0x8ccf,0x8cd0,0xcaf4,0x8cd1,
-0xcdc0,0xc2c5,0x8cd2,0xe5ef,0x8cd3,0xc2c4,0xe5f0,0x8cd4,
-0x8cd5,0x8cd6,0x8cd7,0x8cd8,0x8cd9,0x8cda,0xe5f8,0xcdcd,
-0x8cdb,0xc9bd,0x8cdc,0x8cdd,0x8cde,0x8cdf,0x8ce0,0x8ce1,
-0x8ce2,0xd2d9,0xe1a8,0x8ce3,0x8ce4,0x8ce5,0x8ce6,0xd3ec,
-0x8ce7,0xcbea,0xc6f1,0x8ce8,0x8ce9,0x8cea,0x8ceb,0x8cec,
-0xe1ac,0x8ced,0x8cee,0x8cef,0xe1a7,0xe1a9,0x8cf0,0x8cf1,
-0xe1aa,0xe1af,0x8cf2,0x8cf3,0xb2ed,0x8cf4,0xe1ab,0xb8da,
-0xe1ad,0xe1ae,0xe1b0,0xb5ba,0xe1b1,0x8cf5,0x8cf6,0x8cf7,
-0x8cf8,0x8cf9,0xe1b3,0xe1b8,0x8cfa,0x8cfb,0x8cfc,0x8cfd,
-0x8cfe,0xd1d2,0x8d40,0xe1b6,0xe1b5,0xc1eb,0x8d41,0x8d42,
-0x8d43,0xe1b7,0x8d44,0xd4c0,0x8d45,0xe1b2,0x8d46,0xe1ba,
-0xb0b6,0x8d47,0x8d48,0x8d49,0x8d4a,0xe1b4,0x8d4b,0xbff9,
-0x8d4c,0xe1b9,0x8d4d,0x8d4e,0xe1bb,0x8d4f,0x8d50,0x8d51,
-0x8d52,0x8d53,0x8d54,0xe1be,0x8d55,0x8d56,0x8d57,0x8d58,
-0x8d59,0x8d5a,0xe1bc,0x8d5b,0x8d5c,0x8d5d,0x8d5e,0x8d5f,
-0x8d60,0xd6c5,0x8d61,0x8d62,0x8d63,0x8d64,0x8d65,0x8d66,
-0x8d67,0xcfbf,0x8d68,0x8d69,0xe1bd,0xe1bf,0xc2cd,0x8d6a,
-0xb6eb,0x8d6b,0xd3f8,0x8d6c,0x8d6d,0xc7cd,0x8d6e,0x8d6f,
-0xb7e5,0x8d70,0x8d71,0x8d72,0x8d73,0x8d74,0x8d75,0x8d76,
-0x8d77,0x8d78,0x8d79,0xbefe,0x8d7a,0x8d7b,0x8d7c,0x8d7d,
-0x8d7e,0x8d80,0xe1c0,0xe1c1,0x8d81,0x8d82,0xe1c7,0xb3e7,
-0x8d83,0x8d84,0x8d85,0x8d86,0x8d87,0x8d88,0xc6e9,0x8d89,
-0x8d8a,0x8d8b,0x8d8c,0x8d8d,0xb4de,0x8d8e,0xd1c2,0x8d8f,
-0x8d90,0x8d91,0x8d92,0xe1c8,0x8d93,0x8d94,0xe1c6,0x8d95,
-0x8d96,0x8d97,0x8d98,0x8d99,0xe1c5,0x8d9a,0xe1c3,0xe1c2,
-0x8d9b,0xb1c0,0x8d9c,0x8d9d,0x8d9e,0xd5b8,0xe1c4,0x8d9f,
-0x8da0,0x8da1,0x8da2,0x8da3,0xe1cb,0x8da4,0x8da5,0x8da6,
-0x8da7,0x8da8,0x8da9,0x8daa,0x8dab,0xe1cc,0xe1ca,0x8dac,
-0x8dad,0x8dae,0x8daf,0x8db0,0x8db1,0x8db2,0x8db3,0xeffa,
-0x8db4,0x8db5,0xe1d3,0xe1d2,0xc7b6,0x8db6,0x8db7,0x8db8,
-0x8db9,0x8dba,0x8dbb,0x8dbc,0x8dbd,0x8dbe,0x8dbf,0x8dc0,
-0xe1c9,0x8dc1,0x8dc2,0xe1ce,0x8dc3,0xe1d0,0x8dc4,0x8dc5,
-0x8dc6,0x8dc7,0x8dc8,0x8dc9,0x8dca,0x8dcb,0x8dcc,0x8dcd,
-0x8dce,0xe1d4,0x8dcf,0xe1d1,0xe1cd,0x8dd0,0x8dd1,0xe1cf,
-0x8dd2,0x8dd3,0x8dd4,0x8dd5,0xe1d5,0x8dd6,0x8dd7,0x8dd8,
-0x8dd9,0x8dda,0x8ddb,0x8ddc,0x8ddd,0x8dde,0x8ddf,0x8de0,
-0x8de1,0x8de2,0xe1d6,0x8de3,0x8de4,0x8de5,0x8de6,0x8de7,
-0x8de8,0x8de9,0x8dea,0x8deb,0x8dec,0x8ded,0x8dee,0x8def,
-0x8df0,0x8df1,0x8df2,0x8df3,0x8df4,0x8df5,0x8df6,0x8df7,
-0x8df8,0xe1d7,0x8df9,0x8dfa,0x8dfb,0xe1d8,0x8dfc,0x8dfd,
-0x8dfe,0x8e40,0x8e41,0x8e42,0x8e43,0x8e44,0x8e45,0x8e46,
-0x8e47,0x8e48,0x8e49,0x8e4a,0x8e4b,0x8e4c,0x8e4d,0x8e4e,
-0x8e4f,0x8e50,0x8e51,0x8e52,0x8e53,0x8e54,0x8e55,0xe1da,
-0x8e56,0x8e57,0x8e58,0x8e59,0x8e5a,0x8e5b,0x8e5c,0x8e5d,
-0x8e5e,0x8e5f,0x8e60,0x8e61,0x8e62,0xe1db,0x8e63,0x8e64,
-0x8e65,0x8e66,0x8e67,0x8e68,0x8e69,0xcea1,0x8e6a,0x8e6b,
-0x8e6c,0x8e6d,0x8e6e,0x8e6f,0x8e70,0x8e71,0x8e72,0x8e73,
-0x8e74,0x8e75,0x8e76,0xe7dd,0x8e77,0xb4a8,0xd6dd,0x8e78,
-0x8e79,0xd1b2,0xb3b2,0x8e7a,0x8e7b,0xb9a4,0xd7f3,0xc7c9,
-0xbede,0xb9ae,0x8e7c,0xced7,0x8e7d,0x8e7e,0xb2ee,0xdbcf,
-0x8e80,0xbcba,0xd2d1,0xcbc8,0xb0cd,0x8e81,0x8e82,0xcfef,
-0x8e83,0x8e84,0x8e85,0x8e86,0x8e87,0xd9e3,0xbded,0x8e88,
-0x8e89,0xb1d2,0xcad0,0xb2bc,0x8e8a,0xcba7,0xb7ab,0x8e8b,
-0xcaa6,0x8e8c,0x8e8d,0x8e8e,0xcfa3,0x8e8f,0x8e90,0xe0f8,
-0xd5ca,0xe0fb,0x8e91,0x8e92,0xe0fa,0xc5c1,0xccfb,0x8e93,
-0xc1b1,0xe0f9,0xd6e3,0xb2af,0xd6c4,0xb5db,0x8e94,0x8e95,
-0x8e96,0x8e97,0x8e98,0x8e99,0x8e9a,0x8e9b,0xb4f8,0xd6a1,
-0x8e9c,0x8e9d,0x8e9e,0x8e9f,0x8ea0,0xcfaf,0xb0ef,0x8ea1,
-0x8ea2,0xe0fc,0x8ea3,0x8ea4,0x8ea5,0x8ea6,0x8ea7,0xe1a1,
-0xb3a3,0x8ea8,0x8ea9,0xe0fd,0xe0fe,0xc3b1,0x8eaa,0x8eab,
-0x8eac,0x8ead,0xc3dd,0x8eae,0xe1a2,0xb7f9,0x8eaf,0x8eb0,
-0x8eb1,0x8eb2,0x8eb3,0x8eb4,0xbbcf,0x8eb5,0x8eb6,0x8eb7,
-0x8eb8,0x8eb9,0x8eba,0x8ebb,0xe1a3,0xc4bb,0x8ebc,0x8ebd,
-0x8ebe,0x8ebf,0x8ec0,0xe1a4,0x8ec1,0x8ec2,0xe1a5,0x8ec3,
-0x8ec4,0xe1a6,0xb4b1,0x8ec5,0x8ec6,0x8ec7,0x8ec8,0x8ec9,
-0x8eca,0x8ecb,0x8ecc,0x8ecd,0x8ece,0x8ecf,0x8ed0,0x8ed1,
-0x8ed2,0x8ed3,0xb8c9,0xc6bd,0xc4ea,0x8ed4,0xb2a2,0x8ed5,
-0xd0d2,0x8ed6,0xe7db,0xbbc3,0xd3d7,0xd3c4,0x8ed7,0xb9e3,
-0xe2cf,0x8ed8,0x8ed9,0x8eda,0xd7af,0x8edb,0xc7ec,0xb1d3,
-0x8edc,0x8edd,0xb4b2,0xe2d1,0x8ede,0x8edf,0x8ee0,0xd0f2,
-0xc2ae,0xe2d0,0x8ee1,0xbfe2,0xd3a6,0xb5d7,0xe2d2,0xb5ea,
-0x8ee2,0xc3ed,0xb8fd,0x8ee3,0xb8ae,0x8ee4,0xc5d3,0xb7cf,
-0xe2d4,0x8ee5,0x8ee6,0x8ee7,0x8ee8,0xe2d3,0xb6c8,0xd7f9,
-0x8ee9,0x8eea,0x8eeb,0x8eec,0x8eed,0xcda5,0x8eee,0x8eef,
-0x8ef0,0x8ef1,0x8ef2,0xe2d8,0x8ef3,0xe2d6,0xcafc,0xbfb5,
-0xd3b9,0xe2d5,0x8ef4,0x8ef5,0x8ef6,0x8ef7,0xe2d7,0x8ef8,
-0x8ef9,0x8efa,0x8efb,0x8efc,0x8efd,0x8efe,0x8f40,0x8f41,
-0x8f42,0xc1ae,0xc0c8,0x8f43,0x8f44,0x8f45,0x8f46,0x8f47,
-0x8f48,0xe2db,0xe2da,0xc0aa,0x8f49,0x8f4a,0xc1ce,0x8f4b,
-0x8f4c,0x8f4d,0x8f4e,0xe2dc,0x8f4f,0x8f50,0x8f51,0x8f52,
-0x8f53,0x8f54,0x8f55,0x8f56,0x8f57,0x8f58,0x8f59,0x8f5a,
-0xe2dd,0x8f5b,0xe2de,0x8f5c,0x8f5d,0x8f5e,0x8f5f,0x8f60,
-0x8f61,0x8f62,0x8f63,0x8f64,0xdbc8,0x8f65,0xd1d3,0xcda2,
-0x8f66,0x8f67,0xbda8,0x8f68,0x8f69,0x8f6a,0xdec3,0xd8a5,
-0xbfaa,0xdbcd,0xd2ec,0xc6fa,0xc5aa,0x8f6b,0x8f6c,0x8f6d,
-0xdec4,0x8f6e,0xb1d7,0xdfae,0x8f6f,0x8f70,0x8f71,0xcabd,
-0x8f72,0xdfb1,0x8f73,0xb9ad,0x8f74,0xd2fd,0x8f75,0xb8a5,
-0xbaeb,0x8f76,0x8f77,0xb3da,0x8f78,0x8f79,0x8f7a,0xb5dc,
-0xd5c5,0x8f7b,0x8f7c,0x8f7d,0x8f7e,0xc3d6,0xcfd2,0xbba1,
-0x8f80,0xe5f3,0xe5f2,0x8f81,0x8f82,0xe5f4,0x8f83,0xcde4,
-0x8f84,0xc8f5,0x8f85,0x8f86,0x8f87,0x8f88,0x8f89,0x8f8a,
-0x8f8b,0xb5af,0xc7bf,0x8f8c,0xe5f6,0x8f8d,0x8f8e,0x8f8f,
-0xecb0,0x8f90,0x8f91,0x8f92,0x8f93,0x8f94,0x8f95,0x8f96,
-0x8f97,0x8f98,0x8f99,0x8f9a,0x8f9b,0x8f9c,0x8f9d,0x8f9e,
-0xe5e6,0x8f9f,0xb9e9,0xb5b1,0x8fa0,0xc2bc,0xe5e8,0xe5e7,
-0xe5e9,0x8fa1,0x8fa2,0x8fa3,0x8fa4,0xd2cd,0x8fa5,0x8fa6,
-0x8fa7,0xe1ea,0xd0ce,0x8fa8,0xcdae,0x8fa9,0xd1e5,0x8faa,
-0x8fab,0xb2ca,0xb1eb,0x8fac,0xb1f2,0xc5ed,0x8fad,0x8fae,
-0xd5c3,0xd3b0,0x8faf,0xe1dc,0x8fb0,0x8fb1,0x8fb2,0xe1dd,
-0x8fb3,0xd2db,0x8fb4,0xb3b9,0xb1cb,0x8fb5,0x8fb6,0x8fb7,
-0xcdf9,0xd5f7,0xe1de,0x8fb8,0xbeb6,0xb4fd,0x8fb9,0xe1df,
-0xbadc,0xe1e0,0xbbb2,0xc2c9,0xe1e1,0x8fba,0x8fbb,0x8fbc,
-0xd0ec,0x8fbd,0xcdbd,0x8fbe,0x8fbf,0xe1e2,0x8fc0,0xb5c3,
-0xc5c7,0xe1e3,0x8fc1,0x8fc2,0xe1e4,0x8fc3,0x8fc4,0x8fc5,
-0x8fc6,0xd3f9,0x8fc7,0x8fc8,0x8fc9,0x8fca,0x8fcb,0x8fcc,
-0xe1e5,0x8fcd,0xd1ad,0x8fce,0x8fcf,0xe1e6,0xcea2,0x8fd0,
-0x8fd1,0x8fd2,0x8fd3,0x8fd4,0x8fd5,0xe1e7,0x8fd6,0xb5c2,
-0x8fd7,0x8fd8,0x8fd9,0x8fda,0xe1e8,0xbbd5,0x8fdb,0x8fdc,
-0x8fdd,0x8fde,0x8fdf,0xd0c4,0xe2e0,0xb1d8,0xd2e4,0x8fe0,
-0x8fe1,0xe2e1,0x8fe2,0x8fe3,0xbcc9,0xc8cc,0x8fe4,0xe2e3,
-0xecfe,0xecfd,0xdfaf,0x8fe5,0x8fe6,0x8fe7,0xe2e2,0xd6be,
-0xcdfc,0xc3a6,0x8fe8,0x8fe9,0x8fea,0xe3c3,0x8feb,0x8fec,
-0xd6d2,0xe2e7,0x8fed,0x8fee,0xe2e8,0x8fef,0x8ff0,0xd3c7,
-0x8ff1,0x8ff2,0xe2ec,0xbfec,0x8ff3,0xe2ed,0xe2e5,0x8ff4,
-0x8ff5,0xb3c0,0x8ff6,0x8ff7,0x8ff8,0xc4ee,0x8ff9,0x8ffa,
-0xe2ee,0x8ffb,0x8ffc,0xd0c3,0x8ffd,0xbaf6,0xe2e9,0xb7de,
-0xbbb3,0xccac,0xcbcb,0xe2e4,0xe2e6,0xe2ea,0xe2eb,0x8ffe,
-0x9040,0x9041,0xe2f7,0x9042,0x9043,0xe2f4,0xd4f5,0xe2f3,
-0x9044,0x9045,0xc5ad,0x9046,0xd5fa,0xc5c2,0xb2c0,0x9047,
-0x9048,0xe2ef,0x9049,0xe2f2,0xc1af,0xcbbc,0x904a,0x904b,
-0xb5a1,0xe2f9,0x904c,0x904d,0x904e,0xbcb1,0xe2f1,0xd0d4,
-0xd4b9,0xe2f5,0xb9d6,0xe2f6,0x904f,0x9050,0x9051,0xc7d3,
-0x9052,0x9053,0x9054,0x9055,0x9056,0xe2f0,0x9057,0x9058,
-0x9059,0x905a,0x905b,0xd7dc,0xeda1,0x905c,0x905d,0xe2f8,
-0x905e,0xeda5,0xe2fe,0xcad1,0x905f,0x9060,0x9061,0x9062,
-0x9063,0x9064,0x9065,0xc1b5,0x9066,0xbbd0,0x9067,0x9068,
-0xbfd6,0x9069,0xbae3,0x906a,0x906b,0xcba1,0x906c,0x906d,
-0x906e,0xeda6,0xeda3,0x906f,0x9070,0xeda2,0x9071,0x9072,
-0x9073,0x9074,0xbbd6,0xeda7,0xd0f4,0x9075,0x9076,0xeda4,
-0xbade,0xb6f7,0xe3a1,0xb6b2,0xccf1,0xb9a7,0x9077,0xcfa2,
-0xc7a1,0x9078,0x9079,0xbfd2,0x907a,0x907b,0xb6f1,0x907c,
-0xe2fa,0xe2fb,0xe2fd,0xe2fc,0xc4d5,0xe3a2,0x907d,0xd3c1,
-0x907e,0x9080,0x9081,0xe3a7,0xc7c4,0x9082,0x9083,0x9084,
-0x9085,0xcfa4,0x9086,0x9087,0xe3a9,0xbab7,0x9088,0x9089,
-0x908a,0x908b,0xe3a8,0x908c,0xbbda,0x908d,0xe3a3,0x908e,
-0x908f,0x9090,0xe3a4,0xe3aa,0x9091,0xe3a6,0x9092,0xcef2,
-0xd3c6,0x9093,0x9094,0xbbbc,0x9095,0x9096,0xd4c3,0x9097,
-0xc4fa,0x9098,0x9099,0xeda8,0xd0fc,0xe3a5,0x909a,0xc3f5,
-0x909b,0xe3ad,0xb1af,0x909c,0xe3b2,0x909d,0x909e,0x909f,
-0xbcc2,0x90a0,0x90a1,0xe3ac,0xb5bf,0x90a2,0x90a3,0x90a4,
-0x90a5,0x90a6,0x90a7,0x90a8,0x90a9,0xc7e9,0xe3b0,0x90aa,
-0x90ab,0x90ac,0xbeaa,0xcdef,0x90ad,0x90ae,0x90af,0x90b0,
-0x90b1,0xbbf3,0x90b2,0x90b3,0x90b4,0xcce8,0x90b5,0x90b6,
-0xe3af,0x90b7,0xe3b1,0x90b8,0xcfa7,0xe3ae,0x90b9,0xcea9,
-0xbbdd,0x90ba,0x90bb,0x90bc,0x90bd,0x90be,0xb5eb,0xbee5,
-0xb2d2,0xb3cd,0x90bf,0xb1b9,0xe3ab,0xb2d1,0xb5ac,0xb9df,
-0xb6e8,0x90c0,0x90c1,0xcfeb,0xe3b7,0x90c2,0xbbcc,0x90c3,
-0x90c4,0xc8c7,0xd0ca,0x90c5,0x90c6,0x90c7,0x90c8,0x90c9,
-0xe3b8,0xb3ee,0x90ca,0x90cb,0x90cc,0x90cd,0xeda9,0x90ce,
-0xd3fa,0xd3e4,0x90cf,0x90d0,0x90d1,0xedaa,0xe3b9,0xd2e2,
-0x90d2,0x90d3,0x90d4,0x90d5,0x90d6,0xe3b5,0x90d7,0x90d8,
-0x90d9,0x90da,0xd3de,0x90db,0x90dc,0x90dd,0x90de,0xb8d0,
-0xe3b3,0x90df,0x90e0,0xe3b6,0xb7df,0x90e1,0xe3b4,0xc0a2,
-0x90e2,0x90e3,0x90e4,0xe3ba,0x90e5,0x90e6,0x90e7,0x90e8,
-0x90e9,0x90ea,0x90eb,0x90ec,0x90ed,0x90ee,0x90ef,0x90f0,
-0x90f1,0x90f2,0x90f3,0x90f4,0x90f5,0x90f6,0x90f7,0xd4b8,
-0x90f8,0x90f9,0x90fa,0x90fb,0x90fc,0x90fd,0x90fe,0x9140,
-0xb4c8,0x9141,0xe3bb,0x9142,0xbbc5,0x9143,0xc9f7,0x9144,
-0x9145,0xc9e5,0x9146,0x9147,0x9148,0xc4bd,0x9149,0x914a,
-0x914b,0x914c,0x914d,0x914e,0x914f,0xedab,0x9150,0x9151,
-0x9152,0x9153,0xc2fd,0x9154,0x9155,0x9156,0x9157,0xbbdb,
-0xbfae,0x9158,0x9159,0x915a,0x915b,0x915c,0x915d,0x915e,
-0xcebf,0x915f,0x9160,0x9161,0x9162,0xe3bc,0x9163,0xbfb6,
-0x9164,0x9165,0x9166,0x9167,0x9168,0x9169,0x916a,0x916b,
-0x916c,0x916d,0x916e,0x916f,0x9170,0x9171,0x9172,0x9173,
-0x9174,0x9175,0x9176,0xb1ef,0x9177,0x9178,0xd4f7,0x9179,
-0x917a,0x917b,0x917c,0x917d,0xe3be,0x917e,0x9180,0x9181,
-0x9182,0x9183,0x9184,0x9185,0x9186,0xedad,0x9187,0x9188,
-0x9189,0x918a,0x918b,0x918c,0x918d,0x918e,0x918f,0xe3bf,
-0xbaa9,0xedac,0x9190,0x9191,0xe3bd,0x9192,0x9193,0x9194,
-0x9195,0x9196,0x9197,0x9198,0x9199,0x919a,0x919b,0xe3c0,
-0x919c,0x919d,0x919e,0x919f,0x91a0,0x91a1,0xbab6,0x91a2,
-0x91a3,0x91a4,0xb6ae,0x91a5,0x91a6,0x91a7,0x91a8,0x91a9,
-0xd0b8,0x91aa,0xb0c3,0xedae,0x91ab,0x91ac,0x91ad,0x91ae,
-0x91af,0xedaf,0xc0c1,0x91b0,0xe3c1,0x91b1,0x91b2,0x91b3,
-0x91b4,0x91b5,0x91b6,0x91b7,0x91b8,0x91b9,0x91ba,0x91bb,
-0x91bc,0x91bd,0x91be,0x91bf,0x91c0,0x91c1,0xc5b3,0x91c2,
-0x91c3,0x91c4,0x91c5,0x91c6,0x91c7,0x91c8,0x91c9,0x91ca,
-0x91cb,0x91cc,0x91cd,0x91ce,0x91cf,0xe3c2,0x91d0,0x91d1,
-0x91d2,0x91d3,0x91d4,0x91d5,0x91d6,0x91d7,0x91d8,0xdcb2,
-0x91d9,0x91da,0x91db,0x91dc,0x91dd,0x91de,0xedb0,0x91df,
-0xb8ea,0x91e0,0xceec,0xeaa7,0xd0e7,0xcaf9,0xc8d6,0xcfb7,
-0xb3c9,0xced2,0xbde4,0x91e1,0x91e2,0xe3de,0xbbf2,0xeaa8,
-0xd5bd,0x91e3,0xc6dd,0xeaa9,0x91e4,0x91e5,0x91e6,0xeaaa,
-0x91e7,0xeaac,0xeaab,0x91e8,0xeaae,0xeaad,0x91e9,0x91ea,
-0x91eb,0x91ec,0xbdd8,0x91ed,0xeaaf,0x91ee,0xc2be,0x91ef,
-0x91f0,0x91f1,0x91f2,0xb4c1,0xb4f7,0x91f3,0x91f4,0xbba7,
-0x91f5,0x91f6,0x91f7,0x91f8,0x91f9,0xece6,0xece5,0xb7bf,
-0xcbf9,0xb1e2,0x91fa,0xece7,0x91fb,0x91fc,0x91fd,0xc9c8,
-0xece8,0xece9,0x91fe,0xcad6,0xded0,0xb2c5,0xd4fa,0x9240,
-0x9241,0xc6cb,0xb0c7,0xb4f2,0xc8d3,0x9242,0x9243,0x9244,
-0xcdd0,0x9245,0x9246,0xbfb8,0x9247,0x9248,0x9249,0x924a,
-0x924b,0x924c,0x924d,0xbfdb,0x924e,0x924f,0xc7a4,0xd6b4,
-0x9250,0xc0a9,0xded1,0xc9a8,0xd1ef,0xc5a4,0xb0e7,0xb3b6,
-0xc8c5,0x9251,0x9252,0xb0e2,0x9253,0x9254,0xb7f6,0x9255,
-0x9256,0xc5fa,0x9257,0x9258,0xb6f3,0x9259,0xd5d2,0xb3d0,
-0xbcbc,0x925a,0x925b,0x925c,0xb3ad,0x925d,0x925e,0x925f,
-0x9260,0xbef1,0xb0d1,0x9261,0x9262,0x9263,0x9264,0x9265,
-0x9266,0xd2d6,0xcae3,0xd7a5,0x9267,0xcdb6,0xb6b6,0xbfb9,
-0xd5db,0x9268,0xb8a7,0xc5d7,0x9269,0x926a,0x926b,0xded2,
-0xbfd9,0xc2d5,0xc7c0,0x926c,0xbba4,0xb1a8,0x926d,0x926e,
-0xc5ea,0x926f,0x9270,0xc5fb,0xcca7,0x9271,0x9272,0x9273,
-0x9274,0xb1a7,0x9275,0x9276,0x9277,0xb5d6,0x9278,0x9279,
-0x927a,0xc4a8,0x927b,0xded3,0xd1ba,0xb3e9,0x927c,0xc3f2,
-0x927d,0x927e,0xb7f7,0x9280,0xd6f4,0xb5a3,0xb2f0,0xc4b4,
-0xc4e9,0xc0ad,0xded4,0x9281,0xb0e8,0xc5c4,0xc1e0,0x9282,
-0xb9d5,0x9283,0xbedc,0xcdd8,0xb0ce,0x9284,0xcdcf,0xded6,
-0xbed0,0xd7be,0xded5,0xd5d0,0xb0dd,0x9285,0x9286,0xc4e2,
-0x9287,0x9288,0xc2a3,0xbcf0,0x9289,0xd3b5,0xc0b9,0xc5a1,
-0xb2a6,0xd4f1,0x928a,0x928b,0xc0a8,0xcac3,0xded7,0xd5fc,
-0x928c,0xb9b0,0x928d,0xc8ad,0xcba9,0x928e,0xded9,0xbfbd,
-0x928f,0x9290,0x9291,0x9292,0xc6b4,0xd7a7,0xcab0,0xc4c3,
-0x9293,0xb3d6,0xb9d2,0x9294,0x9295,0x9296,0x9297,0xd6b8,
-0xeafc,0xb0b4,0x9298,0x9299,0x929a,0x929b,0xbfe6,0x929c,
-0x929d,0xccf4,0x929e,0x929f,0x92a0,0x92a1,0xcdda,0x92a2,
-0x92a3,0x92a4,0xd6bf,0xc2ce,0x92a5,0xcece,0xcca2,0xd0ae,
-0xc4d3,0xb5b2,0xded8,0xd5f5,0xbcb7,0xbbd3,0x92a6,0x92a7,
-0xb0a4,0x92a8,0xc5b2,0xb4ec,0x92a9,0x92aa,0x92ab,0xd5f1,
-0x92ac,0x92ad,0xeafd,0x92ae,0x92af,0x92b0,0x92b1,0x92b2,
-0x92b3,0xdeda,0xcda6,0x92b4,0x92b5,0xcdec,0x92b6,0x92b7,
-0x92b8,0x92b9,0xcee6,0xdedc,0x92ba,0xcdb1,0xc0a6,0x92bb,
-0x92bc,0xd7bd,0x92bd,0xdedb,0xb0c6,0xbab4,0xc9d3,0xc4f3,
-0xbee8,0x92be,0x92bf,0x92c0,0x92c1,0xb2b6,0x92c2,0x92c3,
-0x92c4,0x92c5,0x92c6,0x92c7,0x92c8,0x92c9,0xc0cc,0xcbf0,
-0x92ca,0xbcf1,0xbbbb,0xb5b7,0x92cb,0x92cc,0x92cd,0xc5f5,
-0x92ce,0xdee6,0x92cf,0x92d0,0x92d1,0xdee3,0xbedd,0x92d2,
-0x92d3,0xdedf,0x92d4,0x92d5,0x92d6,0x92d7,0xb4b7,0xbddd,
-0x92d8,0x92d9,0xdee0,0xc4ed,0x92da,0x92db,0x92dc,0x92dd,
-0xcfc6,0x92de,0xb5e0,0x92df,0x92e0,0x92e1,0x92e2,0xb6de,
-0xcada,0xb5f4,0xdee5,0x92e3,0xd5c6,0x92e4,0xdee1,0xcccd,
-0xc6fe,0x92e5,0xc5c5,0x92e6,0x92e7,0x92e8,0xd2b4,0x92e9,
-0xbef2,0x92ea,0x92eb,0x92ec,0x92ed,0x92ee,0x92ef,0x92f0,
-0xc2d3,0x92f1,0xccbd,0xb3b8,0x92f2,0xbdd3,0x92f3,0xbfd8,
-0xcdc6,0xd1da,0xb4eb,0x92f4,0xdee4,0xdedd,0xdee7,0x92f5,
-0xeafe,0x92f6,0x92f7,0xc2b0,0xdee2,0x92f8,0x92f9,0xd6c0,
-0xb5a7,0x92fa,0xb2f4,0x92fb,0xdee8,0x92fc,0xdef2,0x92fd,
-0x92fe,0x9340,0x9341,0x9342,0xdeed,0x9343,0xdef1,0x9344,
-0x9345,0xc8e0,0x9346,0x9347,0x9348,0xd7e1,0xdeef,0xc3e8,
-0xcce1,0x9349,0xb2e5,0x934a,0x934b,0x934c,0xd2be,0x934d,
-0x934e,0x934f,0x9350,0x9351,0x9352,0x9353,0xdeee,0x9354,
-0xdeeb,0xced5,0x9355,0xb4a7,0x9356,0x9357,0x9358,0x9359,
-0x935a,0xbfab,0xbebe,0x935b,0x935c,0xbdd2,0x935d,0x935e,
-0x935f,0x9360,0xdee9,0x9361,0xd4ae,0x9362,0xdede,0x9363,
-0xdeea,0x9364,0x9365,0x9366,0x9367,0xc0bf,0x9368,0xdeec,
-0xb2f3,0xb8e9,0xc2a7,0x9369,0x936a,0xbdc1,0x936b,0x936c,
-0x936d,0x936e,0x936f,0xdef5,0xdef8,0x9370,0x9371,0xb2ab,
-0xb4a4,0x9372,0x9373,0xb4ea,0xc9a6,0x9374,0x9375,0x9376,
-0x9377,0x9378,0x9379,0xdef6,0xcbd1,0x937a,0xb8e3,0x937b,
-0xdef7,0xdefa,0x937c,0x937d,0x937e,0x9380,0xdef9,0x9381,
-0x9382,0x9383,0xccc2,0x9384,0xb0e1,0xb4ee,0x9385,0x9386,
-0x9387,0x9388,0x9389,0x938a,0xe5ba,0x938b,0x938c,0x938d,
-0x938e,0x938f,0xd0af,0x9390,0x9391,0xb2eb,0x9392,0xeba1,
-0x9393,0xdef4,0x9394,0x9395,0xc9e3,0xdef3,0xb0da,0xd2a1,
-0xb1f7,0x9396,0xccaf,0x9397,0x9398,0x9399,0x939a,0x939b,
-0x939c,0x939d,0xdef0,0x939e,0xcba4,0x939f,0x93a0,0x93a1,
-0xd5aa,0x93a2,0x93a3,0x93a4,0x93a5,0x93a6,0xdefb,0x93a7,
-0x93a8,0x93a9,0x93aa,0x93ab,0x93ac,0x93ad,0x93ae,0xb4dd,
-0x93af,0xc4a6,0x93b0,0x93b1,0x93b2,0xdefd,0x93b3,0x93b4,
-0x93b5,0x93b6,0x93b7,0x93b8,0x93b9,0x93ba,0x93bb,0x93bc,
-0xc3fe,0xc4a1,0xdfa1,0x93bd,0x93be,0x93bf,0x93c0,0x93c1,
-0x93c2,0x93c3,0xc1cc,0x93c4,0xdefc,0xbeef,0x93c5,0xc6b2,
-0x93c6,0x93c7,0x93c8,0x93c9,0x93ca,0x93cb,0x93cc,0x93cd,
-0x93ce,0xb3c5,0xc8f6,0x93cf,0x93d0,0xcbba,0xdefe,0x93d1,
-0x93d2,0xdfa4,0x93d3,0x93d4,0x93d5,0x93d6,0xd7b2,0x93d7,
-0x93d8,0x93d9,0x93da,0x93db,0xb3b7,0x93dc,0x93dd,0x93de,
-0x93df,0xc1c3,0x93e0,0x93e1,0xc7cb,0xb2a5,0xb4e9,0x93e2,
-0xd7ab,0x93e3,0x93e4,0x93e5,0x93e6,0xc4ec,0x93e7,0xdfa2,
-0xdfa3,0x93e8,0xdfa5,0x93e9,0xbab3,0x93ea,0x93eb,0x93ec,
-0xdfa6,0x93ed,0xc0de,0x93ee,0x93ef,0xc9c3,0x93f0,0x93f1,
-0x93f2,0x93f3,0x93f4,0x93f5,0x93f6,0xb2d9,0xc7e6,0x93f7,
-0xdfa7,0x93f8,0xc7dc,0x93f9,0x93fa,0x93fb,0x93fc,0xdfa8,
-0xeba2,0x93fd,0x93fe,0x9440,0x9441,0x9442,0xcbd3,0x9443,
-0x9444,0x9445,0xdfaa,0x9446,0xdfa9,0x9447,0xb2c1,0x9448,
-0x9449,0x944a,0x944b,0x944c,0x944d,0x944e,0x944f,0x9450,
-0x9451,0x9452,0x9453,0x9454,0x9455,0x9456,0x9457,0x9458,
-0x9459,0x945a,0x945b,0x945c,0x945d,0x945e,0x945f,0x9460,
-0xc5ca,0x9461,0x9462,0x9463,0x9464,0x9465,0x9466,0x9467,
-0x9468,0xdfab,0x9469,0x946a,0x946b,0x946c,0x946d,0x946e,
-0x946f,0x9470,0xd4dc,0x9471,0x9472,0x9473,0x9474,0x9475,
-0xc8c1,0x9476,0x9477,0x9478,0x9479,0x947a,0x947b,0x947c,
-0x947d,0x947e,0x9480,0x9481,0x9482,0xdfac,0x9483,0x9484,
-0x9485,0x9486,0x9487,0xbef0,0x9488,0x9489,0xdfad,0xd6a7,
-0x948a,0x948b,0x948c,0x948d,0xeab7,0xebb6,0xcad5,0x948e,
-0xd8fc,0xb8c4,0x948f,0xb9a5,0x9490,0x9491,0xb7c5,0xd5fe,
-0x9492,0x9493,0x9494,0x9495,0x9496,0xb9ca,0x9497,0x9498,
-0xd0a7,0xf4cd,0x9499,0x949a,0xb5d0,0x949b,0x949c,0xc3f4,
-0x949d,0xbec8,0x949e,0x949f,0x94a0,0xebb7,0xb0bd,0x94a1,
-0x94a2,0xbdcc,0x94a3,0xc1b2,0x94a4,0xb1d6,0xb3a8,0x94a5,
-0x94a6,0x94a7,0xb8d2,0xc9a2,0x94a8,0x94a9,0xb6d8,0x94aa,
-0x94ab,0x94ac,0x94ad,0xebb8,0xbeb4,0x94ae,0x94af,0x94b0,
-0xcafd,0x94b1,0xc7c3,0x94b2,0xd5fb,0x94b3,0x94b4,0xb7f3,
-0x94b5,0x94b6,0x94b7,0x94b8,0x94b9,0x94ba,0x94bb,0x94bc,
-0x94bd,0x94be,0x94bf,0x94c0,0x94c1,0x94c2,0x94c3,0xcec4,
-0x94c4,0x94c5,0x94c6,0xd5ab,0xb1f3,0x94c7,0x94c8,0x94c9,
-0xecb3,0xb0df,0x94ca,0xecb5,0x94cb,0x94cc,0x94cd,0xb6b7,
-0x94ce,0xc1cf,0x94cf,0xf5fa,0xd0b1,0x94d0,0x94d1,0xd5e5,
-0x94d2,0xced3,0x94d3,0x94d4,0xbdef,0xb3e2,0x94d5,0xb8ab,
-0x94d6,0xd5b6,0x94d7,0xedbd,0x94d8,0xb6cf,0x94d9,0xcbb9,
-0xd0c2,0x94da,0x94db,0x94dc,0x94dd,0x94de,0x94df,0x94e0,
-0x94e1,0xb7bd,0x94e2,0x94e3,0xecb6,0xcaa9,0x94e4,0x94e5,
-0x94e6,0xc5d4,0x94e7,0xecb9,0xecb8,0xc2c3,0xecb7,0x94e8,
-0x94e9,0x94ea,0x94eb,0xd0fd,0xecba,0x94ec,0xecbb,0xd7e5,
-0x94ed,0x94ee,0xecbc,0x94ef,0x94f0,0x94f1,0xecbd,0xc6ec,
-0x94f2,0x94f3,0x94f4,0x94f5,0x94f6,0x94f7,0x94f8,0x94f9,
-0xcede,0x94fa,0xbcc8,0x94fb,0x94fc,0xc8d5,0xb5a9,0xbec9,
-0xd6bc,0xd4e7,0x94fd,0x94fe,0xd1ae,0xd0f1,0xeab8,0xeab9,
-0xeaba,0xbab5,0x9540,0x9541,0x9542,0x9543,0xcab1,0xbff5,
-0x9544,0x9545,0xcdfa,0x9546,0x9547,0x9548,0x9549,0x954a,
-0xeac0,0x954b,0xb0ba,0xeabe,0x954c,0x954d,0xc0a5,0x954e,
-0x954f,0x9550,0xeabb,0x9551,0xb2fd,0x9552,0xc3f7,0xbbe8,
-0x9553,0x9554,0x9555,0xd2d7,0xcef4,0xeabf,0x9556,0x9557,
-0x9558,0xeabc,0x9559,0x955a,0x955b,0xeac3,0x955c,0xd0c7,
-0xd3b3,0x955d,0x955e,0x955f,0x9560,0xb4ba,0x9561,0xc3c1,
-0xd7f2,0x9562,0x9563,0x9564,0x9565,0xd5d1,0x9566,0xcac7,
-0x9567,0xeac5,0x9568,0x9569,0xeac4,0xeac7,0xeac6,0x956a,
-0x956b,0x956c,0x956d,0x956e,0xd6e7,0x956f,0xcfd4,0x9570,
-0x9571,0xeacb,0x9572,0xbbce,0x9573,0x9574,0x9575,0x9576,
-0x9577,0x9578,0x9579,0xbdfa,0xc9ce,0x957a,0x957b,0xeacc,
-0x957c,0x957d,0xc9b9,0xcffe,0xeaca,0xd4ce,0xeacd,0xeacf,
-0x957e,0x9580,0xcded,0x9581,0x9582,0x9583,0x9584,0xeac9,
-0x9585,0xeace,0x9586,0x9587,0xceee,0x9588,0xbbde,0x9589,
-0xb3bf,0x958a,0x958b,0x958c,0x958d,0x958e,0xc6d5,0xbeb0,
-0xcefa,0x958f,0x9590,0x9591,0xc7e7,0x9592,0xbea7,0xead0,
-0x9593,0x9594,0xd6c7,0x9595,0x9596,0x9597,0xc1c0,0x9598,
-0x9599,0x959a,0xd4dd,0x959b,0xead1,0x959c,0x959d,0xcfbe,
-0x959e,0x959f,0x95a0,0x95a1,0xead2,0x95a2,0x95a3,0x95a4,
-0x95a5,0xcaee,0x95a6,0x95a7,0x95a8,0x95a9,0xc5af,0xb0b5,
-0x95aa,0x95ab,0x95ac,0x95ad,0x95ae,0xead4,0x95af,0x95b0,
-0x95b1,0x95b2,0x95b3,0x95b4,0x95b5,0x95b6,0x95b7,0xead3,
-0xf4df,0x95b8,0x95b9,0x95ba,0x95bb,0x95bc,0xc4ba,0x95bd,
-0x95be,0x95bf,0x95c0,0x95c1,0xb1a9,0x95c2,0x95c3,0x95c4,
-0x95c5,0xe5df,0x95c6,0x95c7,0x95c8,0x95c9,0xead5,0x95ca,
-0x95cb,0x95cc,0x95cd,0x95ce,0x95cf,0x95d0,0x95d1,0x95d2,
-0x95d3,0x95d4,0x95d5,0x95d6,0x95d7,0x95d8,0x95d9,0x95da,
-0x95db,0x95dc,0x95dd,0x95de,0x95df,0x95e0,0x95e1,0x95e2,
-0x95e3,0xcaef,0x95e4,0xead6,0xead7,0xc6d8,0x95e5,0x95e6,
-0x95e7,0x95e8,0x95e9,0x95ea,0x95eb,0x95ec,0xead8,0x95ed,
-0x95ee,0xead9,0x95ef,0x95f0,0x95f1,0x95f2,0x95f3,0x95f4,
-0xd4bb,0x95f5,0xc7fa,0xd2b7,0xb8fc,0x95f6,0x95f7,0xeac2,
-0x95f8,0xb2dc,0x95f9,0x95fa,0xc2fc,0x95fb,0xd4f8,0xcce6,
-0xd7ee,0x95fc,0x95fd,0x95fe,0x9640,0x9641,0x9642,0x9643,
-0xd4c2,0xd3d0,0xebc3,0xc5f3,0x9644,0xb7fe,0x9645,0x9646,
-0xebd4,0x9647,0x9648,0x9649,0xcbb7,0xebde,0x964a,0xc0ca,
-0x964b,0x964c,0x964d,0xcdfb,0x964e,0xb3af,0x964f,0xc6da,
-0x9650,0x9651,0x9652,0x9653,0x9654,0x9655,0xebfc,0x9656,
-0xc4be,0x9657,0xceb4,0xc4a9,0xb1be,0xd4fd,0x9658,0xcaf5,
-0x9659,0xd6ec,0x965a,0x965b,0xc6d3,0xb6e4,0x965c,0x965d,
-0x965e,0x965f,0xbbfa,0x9660,0x9661,0xd0e0,0x9662,0x9663,
-0xc9b1,0x9664,0xd4d3,0xc8a8,0x9665,0x9666,0xb8cb,0x9667,
-0xe8be,0xc9bc,0x9668,0x9669,0xe8bb,0x966a,0xc0ee,0xd0d3,
-0xb2c4,0xb4e5,0x966b,0xe8bc,0x966c,0x966d,0xd5c8,0x966e,
-0x966f,0x9670,0x9671,0x9672,0xb6c5,0x9673,0xe8bd,0xcaf8,
-0xb8dc,0xccf5,0x9674,0x9675,0x9676,0xc0b4,0x9677,0x9678,
-0xd1ee,0xe8bf,0xe8c2,0x9679,0x967a,0xbabc,0x967b,0xb1ad,
-0xbddc,0x967c,0xeabd,0xe8c3,0x967d,0xe8c6,0x967e,0xe8cb,
-0x9680,0x9681,0x9682,0x9683,0xe8cc,0x9684,0xcbc9,0xb0e5,
-0x9685,0xbcab,0x9686,0x9687,0xb9b9,0x9688,0x9689,0xe8c1,
-0x968a,0xcdf7,0x968b,0xe8ca,0x968c,0x968d,0x968e,0x968f,
-0xcef6,0x9690,0x9691,0x9692,0x9693,0xd5ed,0x9694,0xc1d6,
-0xe8c4,0x9695,0xc3b6,0x9696,0xb9fb,0xd6a6,0xe8c8,0x9697,
-0x9698,0x9699,0xcae0,0xd4e6,0x969a,0xe8c0,0x969b,0xe8c5,
-0xe8c7,0x969c,0xc7b9,0xb7e3,0x969d,0xe8c9,0x969e,0xbfdd,
-0xe8d2,0x969f,0x96a0,0xe8d7,0x96a1,0xe8d5,0xbcdc,0xbccf,
-0xe8db,0x96a2,0x96a3,0x96a4,0x96a5,0x96a6,0x96a7,0x96a8,
-0x96a9,0xe8de,0x96aa,0xe8da,0xb1fa,0x96ab,0x96ac,0x96ad,
-0x96ae,0x96af,0x96b0,0x96b1,0x96b2,0x96b3,0x96b4,0xb0d8,
-0xc4b3,0xb8cc,0xc6e2,0xc8be,0xc8e1,0x96b5,0x96b6,0x96b7,
-0xe8cf,0xe8d4,0xe8d6,0x96b8,0xb9f1,0xe8d8,0xd7f5,0x96b9,
-0xc4fb,0x96ba,0xe8dc,0x96bb,0x96bc,0xb2e9,0x96bd,0x96be,
-0x96bf,0xe8d1,0x96c0,0x96c1,0xbced,0x96c2,0x96c3,0xbfc2,
-0xe8cd,0xd6f9,0x96c4,0xc1f8,0xb2f1,0x96c5,0x96c6,0x96c7,
-0x96c8,0x96c9,0x96ca,0x96cb,0x96cc,0xe8df,0x96cd,0xcac1,
-0xe8d9,0x96ce,0x96cf,0x96d0,0x96d1,0xd5a4,0x96d2,0xb1ea,
-0xd5bb,0xe8ce,0xe8d0,0xb6b0,0xe8d3,0x96d3,0xe8dd,0xc0b8,
-0x96d4,0xcaf7,0x96d5,0xcba8,0x96d6,0x96d7,0xc6dc,0xc0f5,
-0x96d8,0x96d9,0x96da,0x96db,0x96dc,0xe8e9,0x96dd,0x96de,
-0x96df,0xd0a3,0x96e0,0x96e1,0x96e2,0x96e3,0x96e4,0x96e5,
-0x96e6,0xe8f2,0xd6ea,0x96e7,0x96e8,0x96e9,0x96ea,0x96eb,
-0x96ec,0x96ed,0xe8e0,0xe8e1,0x96ee,0x96ef,0x96f0,0xd1f9,
-0xbacb,0xb8f9,0x96f1,0x96f2,0xb8f1,0xd4d4,0xe8ef,0x96f3,
-0xe8ee,0xe8ec,0xb9f0,0xccd2,0xe8e6,0xcea6,0xbff2,0x96f4,
-0xb0b8,0xe8f1,0xe8f0,0x96f5,0xd7c0,0x96f6,0xe8e4,0x96f7,
-0xcda9,0xc9a3,0x96f8,0xbbb8,0xbddb,0xe8ea,0x96f9,0x96fa,
-0x96fb,0x96fc,0x96fd,0x96fe,0x9740,0x9741,0x9742,0x9743,
-0xe8e2,0xe8e3,0xe8e5,0xb5b5,0xe8e7,0xc7c5,0xe8eb,0xe8ed,
-0xbdb0,0xd7ae,0x9744,0xe8f8,0x9745,0x9746,0x9747,0x9748,
-0x9749,0x974a,0x974b,0x974c,0xe8f5,0x974d,0xcdb0,0xe8f6,
-0x974e,0x974f,0x9750,0x9751,0x9752,0x9753,0x9754,0x9755,
-0x9756,0xc1ba,0x9757,0xe8e8,0x9758,0xc3b7,0xb0f0,0x9759,
-0x975a,0x975b,0x975c,0x975d,0x975e,0x975f,0x9760,0xe8f4,
-0x9761,0x9762,0x9763,0xe8f7,0x9764,0x9765,0x9766,0xb9a3,
-0x9767,0x9768,0x9769,0x976a,0x976b,0x976c,0x976d,0x976e,
-0x976f,0x9770,0xc9d2,0x9771,0x9772,0x9773,0xc3ce,0xcee0,
-0xc0e6,0x9774,0x9775,0x9776,0x9777,0xcbf3,0x9778,0xccdd,
-0xd0b5,0x9779,0x977a,0xcae1,0x977b,0xe8f3,0x977c,0x977d,
-0x977e,0x9780,0x9781,0x9782,0x9783,0x9784,0x9785,0x9786,
-0xbcec,0x9787,0xe8f9,0x9788,0x9789,0x978a,0x978b,0x978c,
-0x978d,0xc3de,0x978e,0xc6e5,0x978f,0xb9f7,0x9790,0x9791,
-0x9792,0x9793,0xb0f4,0x9794,0x9795,0xd7d8,0x9796,0x9797,
-0xbcac,0x9798,0xc5ef,0x9799,0x979a,0x979b,0x979c,0x979d,
-0xccc4,0x979e,0x979f,0xe9a6,0x97a0,0x97a1,0x97a2,0x97a3,
-0x97a4,0x97a5,0x97a6,0x97a7,0x97a8,0x97a9,0xc9ad,0x97aa,
-0xe9a2,0xc0e2,0x97ab,0x97ac,0x97ad,0xbfc3,0x97ae,0x97af,
-0x97b0,0xe8fe,0xb9d7,0x97b1,0xe8fb,0x97b2,0x97b3,0x97b4,
-0x97b5,0xe9a4,0x97b6,0x97b7,0x97b8,0xd2ce,0x97b9,0x97ba,
-0x97bb,0x97bc,0x97bd,0xe9a3,0x97be,0xd6b2,0xd7b5,0x97bf,
-0xe9a7,0x97c0,0xbdb7,0x97c1,0x97c2,0x97c3,0x97c4,0x97c5,
-0x97c6,0x97c7,0x97c8,0x97c9,0x97ca,0x97cb,0x97cc,0xe8fc,
-0xe8fd,0x97cd,0x97ce,0x97cf,0xe9a1,0x97d0,0x97d1,0x97d2,
-0x97d3,0x97d4,0x97d5,0x97d6,0x97d7,0xcdd6,0x97d8,0x97d9,
-0xd2ac,0x97da,0x97db,0x97dc,0xe9b2,0x97dd,0x97de,0x97df,
-0x97e0,0xe9a9,0x97e1,0x97e2,0x97e3,0xb4aa,0x97e4,0xb4bb,
-0x97e5,0x97e6,0xe9ab,0x97e7,0x97e8,0x97e9,0x97ea,0x97eb,
-0x97ec,0x97ed,0x97ee,0x97ef,0x97f0,0x97f1,0x97f2,0x97f3,
-0x97f4,0x97f5,0x97f6,0x97f7,0xd0a8,0x97f8,0x97f9,0xe9a5,
-0x97fa,0x97fb,0xb3fe,0x97fc,0x97fd,0xe9ac,0xc0e3,0x97fe,
-0xe9aa,0x9840,0x9841,0xe9b9,0x9842,0x9843,0xe9b8,0x9844,
-0x9845,0x9846,0x9847,0xe9ae,0x9848,0x9849,0xe8fa,0x984a,
-0x984b,0xe9a8,0x984c,0x984d,0x984e,0x984f,0x9850,0xbfac,
-0xe9b1,0xe9ba,0x9851,0x9852,0xc2a5,0x9853,0x9854,0x9855,
-0xe9af,0x9856,0xb8c5,0x9857,0xe9ad,0x9858,0xd3dc,0xe9b4,
-0xe9b5,0xe9b7,0x9859,0x985a,0x985b,0xe9c7,0x985c,0x985d,
-0x985e,0x985f,0x9860,0x9861,0xc0c6,0xe9c5,0x9862,0x9863,
-0xe9b0,0x9864,0x9865,0xe9bb,0xb0f1,0x9866,0x9867,0x9868,
-0x9869,0x986a,0x986b,0x986c,0x986d,0x986e,0x986f,0xe9bc,
-0xd5a5,0x9870,0x9871,0xe9be,0x9872,0xe9bf,0x9873,0x9874,
-0x9875,0xe9c1,0x9876,0x9877,0xc1f1,0x9878,0x9879,0xc8b6,
-0x987a,0x987b,0x987c,0xe9bd,0x987d,0x987e,0x9880,0x9881,
-0x9882,0xe9c2,0x9883,0x9884,0x9885,0x9886,0x9887,0x9888,
-0x9889,0x988a,0xe9c3,0x988b,0xe9b3,0x988c,0xe9b6,0x988d,
-0xbbb1,0x988e,0x988f,0x9890,0xe9c0,0x9891,0x9892,0x9893,
-0x9894,0x9895,0x9896,0xbcf7,0x9897,0x9898,0x9899,0xe9c4,
-0xe9c6,0x989a,0x989b,0x989c,0x989d,0x989e,0x989f,0x98a0,
-0x98a1,0x98a2,0x98a3,0x98a4,0x98a5,0xe9ca,0x98a6,0x98a7,
-0x98a8,0x98a9,0xe9ce,0x98aa,0x98ab,0x98ac,0x98ad,0x98ae,
-0x98af,0x98b0,0x98b1,0x98b2,0x98b3,0xb2db,0x98b4,0xe9c8,
-0x98b5,0x98b6,0x98b7,0x98b8,0x98b9,0x98ba,0x98bb,0x98bc,
-0x98bd,0x98be,0xb7ae,0x98bf,0x98c0,0x98c1,0x98c2,0x98c3,
-0x98c4,0x98c5,0x98c6,0x98c7,0x98c8,0x98c9,0x98ca,0xe9cb,
-0xe9cc,0x98cb,0x98cc,0x98cd,0x98ce,0x98cf,0x98d0,0xd5c1,
-0x98d1,0xc4a3,0x98d2,0x98d3,0x98d4,0x98d5,0x98d6,0x98d7,
-0xe9d8,0x98d8,0xbae1,0x98d9,0x98da,0x98db,0x98dc,0xe9c9,
-0x98dd,0xd3a3,0x98de,0x98df,0x98e0,0xe9d4,0x98e1,0x98e2,
-0x98e3,0x98e4,0x98e5,0x98e6,0x98e7,0xe9d7,0xe9d0,0x98e8,
-0x98e9,0x98ea,0x98eb,0x98ec,0xe9cf,0x98ed,0x98ee,0xc7c1,
-0x98ef,0x98f0,0x98f1,0x98f2,0x98f3,0x98f4,0x98f5,0x98f6,
-0xe9d2,0x98f7,0x98f8,0x98f9,0x98fa,0x98fb,0x98fc,0x98fd,
-0xe9d9,0xb3c8,0x98fe,0xe9d3,0x9940,0x9941,0x9942,0x9943,
-0x9944,0xcff0,0x9945,0x9946,0x9947,0xe9cd,0x9948,0x9949,
-0x994a,0x994b,0x994c,0x994d,0x994e,0x994f,0x9950,0x9951,
-0x9952,0xb3f7,0x9953,0x9954,0x9955,0x9956,0x9957,0x9958,
-0x9959,0xe9d6,0x995a,0x995b,0xe9da,0x995c,0x995d,0x995e,
-0xccb4,0x995f,0x9960,0x9961,0xcfad,0x9962,0x9963,0x9964,
-0x9965,0x9966,0x9967,0x9968,0x9969,0x996a,0xe9d5,0x996b,
-0xe9dc,0xe9db,0x996c,0x996d,0x996e,0x996f,0x9970,0xe9de,
-0x9971,0x9972,0x9973,0x9974,0x9975,0x9976,0x9977,0x9978,
-0xe9d1,0x9979,0x997a,0x997b,0x997c,0x997d,0x997e,0x9980,
-0x9981,0xe9dd,0x9982,0xe9df,0xc3ca,0x9983,0x9984,0x9985,
-0x9986,0x9987,0x9988,0x9989,0x998a,0x998b,0x998c,0x998d,
-0x998e,0x998f,0x9990,0x9991,0x9992,0x9993,0x9994,0x9995,
-0x9996,0x9997,0x9998,0x9999,0x999a,0x999b,0x999c,0x999d,
-0x999e,0x999f,0x99a0,0x99a1,0x99a2,0x99a3,0x99a4,0x99a5,
-0x99a6,0x99a7,0x99a8,0x99a9,0x99aa,0x99ab,0x99ac,0x99ad,
-0x99ae,0x99af,0x99b0,0x99b1,0x99b2,0x99b3,0x99b4,0x99b5,
-0x99b6,0x99b7,0x99b8,0x99b9,0x99ba,0x99bb,0x99bc,0x99bd,
-0x99be,0x99bf,0x99c0,0x99c1,0x99c2,0x99c3,0x99c4,0x99c5,
-0x99c6,0x99c7,0x99c8,0x99c9,0x99ca,0x99cb,0x99cc,0x99cd,
-0x99ce,0x99cf,0x99d0,0x99d1,0x99d2,0x99d3,0x99d4,0x99d5,
-0x99d6,0x99d7,0x99d8,0x99d9,0x99da,0x99db,0x99dc,0x99dd,
-0x99de,0x99df,0x99e0,0x99e1,0x99e2,0x99e3,0x99e4,0x99e5,
-0x99e6,0x99e7,0x99e8,0x99e9,0x99ea,0x99eb,0x99ec,0x99ed,
-0x99ee,0x99ef,0x99f0,0x99f1,0x99f2,0x99f3,0x99f4,0x99f5,
-0xc7b7,0xb4ce,0xbbb6,0xd0c0,0xeca3,0x99f6,0x99f7,0xc5b7,
-0x99f8,0x99f9,0x99fa,0x99fb,0x99fc,0x99fd,0x99fe,0x9a40,
-0x9a41,0x9a42,0xd3fb,0x9a43,0x9a44,0x9a45,0x9a46,0xeca4,
-0x9a47,0xeca5,0xc6db,0x9a48,0x9a49,0x9a4a,0xbfee,0x9a4b,
-0x9a4c,0x9a4d,0x9a4e,0xeca6,0x9a4f,0x9a50,0xeca7,0xd0aa,
-0x9a51,0xc7b8,0x9a52,0x9a53,0xb8e8,0x9a54,0x9a55,0x9a56,
-0x9a57,0x9a58,0x9a59,0x9a5a,0x9a5b,0x9a5c,0x9a5d,0x9a5e,
-0x9a5f,0xeca8,0x9a60,0x9a61,0x9a62,0x9a63,0x9a64,0x9a65,
-0x9a66,0x9a67,0xd6b9,0xd5fd,0xb4cb,0xb2bd,0xcee4,0xc6e7,
-0x9a68,0x9a69,0xcde1,0x9a6a,0x9a6b,0x9a6c,0x9a6d,0x9a6e,
-0x9a6f,0x9a70,0x9a71,0x9a72,0x9a73,0x9a74,0x9a75,0x9a76,
-0x9a77,0xb4f5,0x9a78,0xcbc0,0xbcdf,0x9a79,0x9a7a,0x9a7b,
-0x9a7c,0xe9e2,0xe9e3,0xd1ea,0xe9e5,0x9a7d,0xb4f9,0xe9e4,
-0x9a7e,0xd1b3,0xcae2,0xb2d0,0x9a80,0xe9e8,0x9a81,0x9a82,
-0x9a83,0x9a84,0xe9e6,0xe9e7,0x9a85,0x9a86,0xd6b3,0x9a87,
-0x9a88,0x9a89,0xe9e9,0xe9ea,0x9a8a,0x9a8b,0x9a8c,0x9a8d,
-0x9a8e,0xe9eb,0x9a8f,0x9a90,0x9a91,0x9a92,0x9a93,0x9a94,
-0x9a95,0x9a96,0xe9ec,0x9a97,0x9a98,0x9a99,0x9a9a,0x9a9b,
-0x9a9c,0x9a9d,0x9a9e,0xecaf,0xc5b9,0xb6ce,0x9a9f,0xd2f3,
-0x9aa0,0x9aa1,0x9aa2,0x9aa3,0x9aa4,0x9aa5,0x9aa6,0xb5ee,
-0x9aa7,0xbbd9,0xecb1,0x9aa8,0x9aa9,0xd2e3,0x9aaa,0x9aab,
-0x9aac,0x9aad,0x9aae,0xcee3,0x9aaf,0xc4b8,0x9ab0,0xc3bf,
-0x9ab1,0x9ab2,0xb6be,0xd8b9,0xb1c8,0xb1cf,0xb1d1,0xc5fe,
-0x9ab3,0xb1d0,0x9ab4,0xc3ab,0x9ab5,0x9ab6,0x9ab7,0x9ab8,
-0x9ab9,0xd5b1,0x9aba,0x9abb,0x9abc,0x9abd,0x9abe,0x9abf,
-0x9ac0,0x9ac1,0xeba4,0xbac1,0x9ac2,0x9ac3,0x9ac4,0xccba,
-0x9ac5,0x9ac6,0x9ac7,0xeba5,0x9ac8,0xeba7,0x9ac9,0x9aca,
-0x9acb,0xeba8,0x9acc,0x9acd,0x9ace,0xeba6,0x9acf,0x9ad0,
-0x9ad1,0x9ad2,0x9ad3,0x9ad4,0x9ad5,0xeba9,0xebab,0xebaa,
-0x9ad6,0x9ad7,0x9ad8,0x9ad9,0x9ada,0xebac,0x9adb,0xcacf,
-0xd8b5,0xc3f1,0x9adc,0xc3a5,0xc6f8,0xebad,0xc4ca,0x9add,
-0xebae,0xebaf,0xebb0,0xb7d5,0x9ade,0x9adf,0x9ae0,0xb7fa,
-0x9ae1,0xebb1,0xc7e2,0x9ae2,0xebb3,0x9ae3,0xbaa4,0xd1f5,
-0xb0b1,0xebb2,0xebb4,0x9ae4,0x9ae5,0x9ae6,0xb5aa,0xc2c8,
-0xc7e8,0x9ae7,0xebb5,0x9ae8,0xcbae,0xe3df,0x9ae9,0x9aea,
-0xd3c0,0x9aeb,0x9aec,0x9aed,0x9aee,0xd9db,0x9aef,0x9af0,
-0xcda1,0xd6ad,0xc7f3,0x9af1,0x9af2,0x9af3,0xd9e0,0xbbe3,
-0x9af4,0xbaba,0xe3e2,0x9af5,0x9af6,0x9af7,0x9af8,0x9af9,
-0xcfab,0x9afa,0x9afb,0x9afc,0xe3e0,0xc9c7,0x9afd,0xbab9,
-0x9afe,0x9b40,0x9b41,0xd1b4,0xe3e1,0xc8ea,0xb9af,0xbdad,
-0xb3d8,0xcedb,0x9b42,0x9b43,0xccc0,0x9b44,0x9b45,0x9b46,
-0xe3e8,0xe3e9,0xcdf4,0x9b47,0x9b48,0x9b49,0x9b4a,0x9b4b,
-0xccad,0x9b4c,0xbcb3,0x9b4d,0xe3ea,0x9b4e,0xe3eb,0x9b4f,
-0x9b50,0xd0da,0x9b51,0x9b52,0x9b53,0xc6fb,0xb7da,0x9b54,
-0x9b55,0xc7df,0xd2ca,0xced6,0x9b56,0xe3e4,0xe3ec,0x9b57,
-0xc9f2,0xb3c1,0x9b58,0x9b59,0xe3e7,0x9b5a,0x9b5b,0xc6e3,
-0xe3e5,0x9b5c,0x9b5d,0xedb3,0xe3e6,0x9b5e,0x9b5f,0x9b60,
-0x9b61,0xc9b3,0x9b62,0xc5e6,0x9b63,0x9b64,0x9b65,0xb9b5,
-0x9b66,0xc3bb,0x9b67,0xe3e3,0xc5bd,0xc1a4,0xc2d9,0xb2d7,
-0x9b68,0xe3ed,0xbba6,0xc4ad,0x9b69,0xe3f0,0xbeda,0x9b6a,
-0x9b6b,0xe3fb,0xe3f5,0xbad3,0x9b6c,0x9b6d,0x9b6e,0x9b6f,
-0xb7d0,0xd3cd,0x9b70,0xd6ce,0xd5d3,0xb9c1,0xd5b4,0xd1d8,
-0x9b71,0x9b72,0x9b73,0x9b74,0xd0b9,0xc7f6,0x9b75,0x9b76,
-0x9b77,0xc8aa,0xb2b4,0x9b78,0xc3da,0x9b79,0x9b7a,0x9b7b,
-0xe3ee,0x9b7c,0x9b7d,0xe3fc,0xe3ef,0xb7a8,0xe3f7,0xe3f4,
-0x9b7e,0x9b80,0x9b81,0xb7ba,0x9b82,0x9b83,0xc5a2,0x9b84,
-0xe3f6,0xc5dd,0xb2a8,0xc6fc,0x9b85,0xc4e0,0x9b86,0x9b87,
-0xd7a2,0x9b88,0xc0e1,0xe3f9,0x9b89,0x9b8a,0xe3fa,0xe3fd,
-0xcca9,0xe3f3,0x9b8b,0xd3be,0x9b8c,0xb1c3,0xedb4,0xe3f1,
-0xe3f2,0x9b8d,0xe3f8,0xd0ba,0xc6c3,0xd4f3,0xe3fe,0x9b8e,
-0x9b8f,0xbde0,0x9b90,0x9b91,0xe4a7,0x9b92,0x9b93,0xe4a6,
-0x9b94,0x9b95,0x9b96,0xd1f3,0xe4a3,0x9b97,0xe4a9,0x9b98,
-0x9b99,0x9b9a,0xc8f7,0x9b9b,0x9b9c,0x9b9d,0x9b9e,0xcfb4,
-0x9b9f,0xe4a8,0xe4ae,0xc2e5,0x9ba0,0x9ba1,0xb6b4,0x9ba2,
-0x9ba3,0x9ba4,0x9ba5,0x9ba6,0x9ba7,0xbdf2,0x9ba8,0xe4a2,
-0x9ba9,0x9baa,0xbae9,0xe4aa,0x9bab,0x9bac,0xe4ac,0x9bad,
-0x9bae,0xb6fd,0xd6de,0xe4b2,0x9baf,0xe4ad,0x9bb0,0x9bb1,
-0x9bb2,0xe4a1,0x9bb3,0xbbee,0xcddd,0xc7a2,0xc5c9,0x9bb4,
-0x9bb5,0xc1f7,0x9bb6,0xe4a4,0x9bb7,0xc7b3,0xbdac,0xbdbd,
-0xe4a5,0x9bb8,0xd7c7,0xb2e2,0x9bb9,0xe4ab,0xbcc3,0xe4af,
-0x9bba,0xbbeb,0xe4b0,0xc5a8,0xe4b1,0x9bbb,0x9bbc,0x9bbd,
-0x9bbe,0xd5e3,0xbfa3,0x9bbf,0xe4ba,0x9bc0,0xe4b7,0x9bc1,
-0xe4bb,0x9bc2,0x9bc3,0xe4bd,0x9bc4,0x9bc5,0xc6d6,0x9bc6,
-0x9bc7,0xbac6,0xc0cb,0x9bc8,0x9bc9,0x9bca,0xb8a1,0xe4b4,
-0x9bcb,0x9bcc,0x9bcd,0x9bce,0xd4a1,0x9bcf,0x9bd0,0xbaa3,
-0xbdfe,0x9bd1,0x9bd2,0x9bd3,0xe4bc,0x9bd4,0x9bd5,0x9bd6,
-0x9bd7,0x9bd8,0xcdbf,0x9bd9,0x9bda,0xc4f9,0x9bdb,0x9bdc,
-0xcffb,0xc9e6,0x9bdd,0x9bde,0xd3bf,0x9bdf,0xcfd1,0x9be0,
-0x9be1,0xe4b3,0x9be2,0xe4b8,0xe4b9,0xcce9,0x9be3,0x9be4,
-0x9be5,0x9be6,0x9be7,0xccce,0x9be8,0xc0d4,0xe4b5,0xc1b0,
-0xe4b6,0xced0,0x9be9,0xbbc1,0xb5d3,0x9bea,0xc8f3,0xbda7,
-0xd5c7,0xc9ac,0xb8a2,0xe4ca,0x9beb,0x9bec,0xe4cc,0xd1c4,
-0x9bed,0x9bee,0xd2ba,0x9bef,0x9bf0,0xbaad,0x9bf1,0x9bf2,
-0xbad4,0x9bf3,0x9bf4,0x9bf5,0x9bf6,0x9bf7,0x9bf8,0xe4c3,
-0xb5ed,0x9bf9,0x9bfa,0x9bfb,0xd7cd,0xe4c0,0xcffd,0xe4bf,
-0x9bfc,0x9bfd,0x9bfe,0xc1dc,0xccca,0x9c40,0x9c41,0x9c42,
-0x9c43,0xcae7,0x9c44,0x9c45,0x9c46,0x9c47,0xc4d7,0x9c48,
-0xccd4,0xe4c8,0x9c49,0x9c4a,0x9c4b,0xe4c7,0xe4c1,0x9c4c,
-0xe4c4,0xb5ad,0x9c4d,0x9c4e,0xd3d9,0x9c4f,0xe4c6,0x9c50,
-0x9c51,0x9c52,0x9c53,0xd2f9,0xb4e3,0x9c54,0xbbb4,0x9c55,
-0x9c56,0xc9ee,0x9c57,0xb4be,0x9c58,0x9c59,0x9c5a,0xbbec,
-0x9c5b,0xd1cd,0x9c5c,0xcced,0xedb5,0x9c5d,0x9c5e,0x9c5f,
-0x9c60,0x9c61,0x9c62,0x9c63,0x9c64,0xc7e5,0x9c65,0x9c66,
-0x9c67,0x9c68,0xd4a8,0x9c69,0xe4cb,0xd7d5,0xe4c2,0x9c6a,
-0xbda5,0xe4c5,0x9c6b,0x9c6c,0xd3e6,0x9c6d,0xe4c9,0xc9f8,
-0x9c6e,0x9c6f,0xe4be,0x9c70,0x9c71,0xd3e5,0x9c72,0x9c73,
-0xc7fe,0xb6c9,0x9c74,0xd4fc,0xb2b3,0xe4d7,0x9c75,0x9c76,
-0x9c77,0xcec2,0x9c78,0xe4cd,0x9c79,0xcebc,0x9c7a,0xb8db,
-0x9c7b,0x9c7c,0xe4d6,0x9c7d,0xbfca,0x9c7e,0x9c80,0x9c81,
-0xd3ce,0x9c82,0xc3ec,0x9c83,0x9c84,0x9c85,0x9c86,0x9c87,
-0x9c88,0x9c89,0x9c8a,0xc5c8,0xe4d8,0x9c8b,0x9c8c,0x9c8d,
-0x9c8e,0x9c8f,0x9c90,0x9c91,0x9c92,0xcdc4,0xe4cf,0x9c93,
-0x9c94,0x9c95,0x9c96,0xe4d4,0xe4d5,0x9c97,0xbafe,0x9c98,
-0xcfe6,0x9c99,0x9c9a,0xd5bf,0x9c9b,0x9c9c,0x9c9d,0xe4d2,
-0x9c9e,0x9c9f,0x9ca0,0x9ca1,0x9ca2,0x9ca3,0x9ca4,0x9ca5,
-0x9ca6,0x9ca7,0x9ca8,0xe4d0,0x9ca9,0x9caa,0xe4ce,0x9cab,
-0x9cac,0x9cad,0x9cae,0x9caf,0x9cb0,0x9cb1,0x9cb2,0x9cb3,
-0x9cb4,0x9cb5,0x9cb6,0x9cb7,0x9cb8,0x9cb9,0xcde5,0xcaaa,
-0x9cba,0x9cbb,0x9cbc,0xc0a3,0x9cbd,0xbda6,0xe4d3,0x9cbe,
-0x9cbf,0xb8c8,0x9cc0,0x9cc1,0x9cc2,0x9cc3,0x9cc4,0xe4e7,
-0xd4b4,0x9cc5,0x9cc6,0x9cc7,0x9cc8,0x9cc9,0x9cca,0x9ccb,
-0xe4db,0x9ccc,0x9ccd,0x9cce,0xc1ef,0x9ccf,0x9cd0,0xe4e9,
-0x9cd1,0x9cd2,0xd2e7,0x9cd3,0x9cd4,0xe4df,0x9cd5,0xe4e0,
-0x9cd6,0x9cd7,0xcfaa,0x9cd8,0x9cd9,0x9cda,0x9cdb,0xcbdd,
-0x9cdc,0xe4da,0xe4d1,0x9cdd,0xe4e5,0x9cde,0xc8dc,0xe4e3,
-0x9cdf,0x9ce0,0xc4e7,0xe4e2,0x9ce1,0xe4e1,0x9ce2,0x9ce3,
-0x9ce4,0xb3fc,0xe4e8,0x9ce5,0x9ce6,0x9ce7,0x9ce8,0xb5e1,
-0x9ce9,0x9cea,0x9ceb,0xd7cc,0x9cec,0x9ced,0x9cee,0xe4e6,
-0x9cef,0xbbac,0x9cf0,0xd7d2,0xcccf,0xebf8,0x9cf1,0xe4e4,
-0x9cf2,0x9cf3,0xb9f6,0x9cf4,0x9cf5,0x9cf6,0xd6cd,0xe4d9,
-0xe4dc,0xc2fa,0xe4de,0x9cf7,0xc2cb,0xc0c4,0xc2d0,0x9cf8,
-0xb1f5,0xccb2,0x9cf9,0x9cfa,0x9cfb,0x9cfc,0x9cfd,0x9cfe,
-0x9d40,0x9d41,0x9d42,0x9d43,0xb5ce,0x9d44,0x9d45,0x9d46,
-0x9d47,0xe4ef,0x9d48,0x9d49,0x9d4a,0x9d4b,0x9d4c,0x9d4d,
-0x9d4e,0x9d4f,0xc6af,0x9d50,0x9d51,0x9d52,0xc6e1,0x9d53,
-0x9d54,0xe4f5,0x9d55,0x9d56,0x9d57,0x9d58,0x9d59,0xc2a9,
-0x9d5a,0x9d5b,0x9d5c,0xc0ec,0xd1dd,0xe4ee,0x9d5d,0x9d5e,
-0x9d5f,0x9d60,0x9d61,0x9d62,0x9d63,0x9d64,0x9d65,0x9d66,
-0xc4ae,0x9d67,0x9d68,0x9d69,0xe4ed,0x9d6a,0x9d6b,0x9d6c,
-0x9d6d,0xe4f6,0xe4f4,0xc2fe,0x9d6e,0xe4dd,0x9d6f,0xe4f0,
-0x9d70,0xcafe,0x9d71,0xd5c4,0x9d72,0x9d73,0xe4f1,0x9d74,
-0x9d75,0x9d76,0x9d77,0x9d78,0x9d79,0x9d7a,0xd1fa,0x9d7b,
-0x9d7c,0x9d7d,0x9d7e,0x9d80,0x9d81,0x9d82,0xe4eb,0xe4ec,
-0x9d83,0x9d84,0x9d85,0xe4f2,0x9d86,0xceab,0x9d87,0x9d88,
-0x9d89,0x9d8a,0x9d8b,0x9d8c,0x9d8d,0x9d8e,0x9d8f,0x9d90,
-0xc5cb,0x9d91,0x9d92,0x9d93,0xc7b1,0x9d94,0xc2ba,0x9d95,
-0x9d96,0x9d97,0xe4ea,0x9d98,0x9d99,0x9d9a,0xc1ca,0x9d9b,
-0x9d9c,0x9d9d,0x9d9e,0x9d9f,0x9da0,0xccb6,0xb3b1,0x9da1,
-0x9da2,0x9da3,0xe4fb,0x9da4,0xe4f3,0x9da5,0x9da6,0x9da7,
-0xe4fa,0x9da8,0xe4fd,0x9da9,0xe4fc,0x9daa,0x9dab,0x9dac,
-0x9dad,0x9dae,0x9daf,0x9db0,0xb3ce,0x9db1,0x9db2,0x9db3,
-0xb3ba,0xe4f7,0x9db4,0x9db5,0xe4f9,0xe4f8,0xc5ec,0x9db6,
-0x9db7,0x9db8,0x9db9,0x9dba,0x9dbb,0x9dbc,0x9dbd,0x9dbe,
-0x9dbf,0x9dc0,0x9dc1,0x9dc2,0xc0bd,0x9dc3,0x9dc4,0x9dc5,
-0x9dc6,0xd4e8,0x9dc7,0x9dc8,0x9dc9,0x9dca,0x9dcb,0xe5a2,
-0x9dcc,0x9dcd,0x9dce,0x9dcf,0x9dd0,0x9dd1,0x9dd2,0x9dd3,
-0x9dd4,0x9dd5,0x9dd6,0xb0c4,0x9dd7,0x9dd8,0xe5a4,0x9dd9,
-0x9dda,0xe5a3,0x9ddb,0x9ddc,0x9ddd,0x9dde,0x9ddf,0x9de0,
-0xbca4,0x9de1,0xe5a5,0x9de2,0x9de3,0x9de4,0x9de5,0x9de6,
-0x9de7,0xe5a1,0x9de8,0x9de9,0x9dea,0x9deb,0x9dec,0x9ded,
-0x9dee,0xe4fe,0xb1f4,0x9def,0x9df0,0x9df1,0x9df2,0x9df3,
-0x9df4,0x9df5,0x9df6,0x9df7,0x9df8,0x9df9,0xe5a8,0x9dfa,
-0xe5a9,0xe5a6,0x9dfb,0x9dfc,0x9dfd,0x9dfe,0x9e40,0x9e41,
-0x9e42,0x9e43,0x9e44,0x9e45,0x9e46,0x9e47,0xe5a7,0xe5aa,
-0x9e48,0x9e49,0x9e4a,0x9e4b,0x9e4c,0x9e4d,0x9e4e,0x9e4f,
-0x9e50,0x9e51,0x9e52,0x9e53,0x9e54,0x9e55,0x9e56,0x9e57,
-0x9e58,0x9e59,0x9e5a,0x9e5b,0x9e5c,0x9e5d,0x9e5e,0x9e5f,
-0x9e60,0x9e61,0x9e62,0x9e63,0x9e64,0x9e65,0x9e66,0x9e67,
-0x9e68,0xc6d9,0x9e69,0x9e6a,0x9e6b,0x9e6c,0x9e6d,0x9e6e,
-0x9e6f,0x9e70,0xe5ab,0xe5ad,0x9e71,0x9e72,0x9e73,0x9e74,
-0x9e75,0x9e76,0x9e77,0xe5ac,0x9e78,0x9e79,0x9e7a,0x9e7b,
-0x9e7c,0x9e7d,0x9e7e,0x9e80,0x9e81,0x9e82,0x9e83,0x9e84,
-0x9e85,0x9e86,0x9e87,0x9e88,0x9e89,0xe5af,0x9e8a,0x9e8b,
-0x9e8c,0xe5ae,0x9e8d,0x9e8e,0x9e8f,0x9e90,0x9e91,0x9e92,
-0x9e93,0x9e94,0x9e95,0x9e96,0x9e97,0x9e98,0x9e99,0x9e9a,
-0x9e9b,0x9e9c,0x9e9d,0x9e9e,0xb9e0,0x9e9f,0x9ea0,0xe5b0,
-0x9ea1,0x9ea2,0x9ea3,0x9ea4,0x9ea5,0x9ea6,0x9ea7,0x9ea8,
-0x9ea9,0x9eaa,0x9eab,0x9eac,0x9ead,0x9eae,0xe5b1,0x9eaf,
-0x9eb0,0x9eb1,0x9eb2,0x9eb3,0x9eb4,0x9eb5,0x9eb6,0x9eb7,
-0x9eb8,0x9eb9,0x9eba,0xbbf0,0xece1,0xc3f0,0x9ebb,0xb5c6,
-0xbbd2,0x9ebc,0x9ebd,0x9ebe,0x9ebf,0xc1e9,0xd4ee,0x9ec0,
-0xbec4,0x9ec1,0x9ec2,0x9ec3,0xd7c6,0x9ec4,0xd4d6,0xb2d3,
-0xecbe,0x9ec5,0x9ec6,0x9ec7,0x9ec8,0xeac1,0x9ec9,0x9eca,
-0x9ecb,0xc2af,0xb4b6,0x9ecc,0x9ecd,0x9ece,0xd1d7,0x9ecf,
-0x9ed0,0x9ed1,0xb3b4,0x9ed2,0xc8b2,0xbfbb,0xecc0,0x9ed3,
-0x9ed4,0xd6cb,0x9ed5,0x9ed6,0xecbf,0xecc1,0x9ed7,0x9ed8,
-0x9ed9,0x9eda,0x9edb,0x9edc,0x9edd,0x9ede,0x9edf,0x9ee0,
-0x9ee1,0x9ee2,0x9ee3,0xecc5,0xbee6,0xccbf,0xc5da,0xbebc,
-0x9ee4,0xecc6,0x9ee5,0xb1fe,0x9ee6,0x9ee7,0x9ee8,0xecc4,
-0xd5a8,0xb5e3,0x9ee9,0xecc2,0xc1b6,0xb3e3,0x9eea,0x9eeb,
-0xecc3,0xcbb8,0xc0c3,0xccfe,0x9eec,0x9eed,0x9eee,0x9eef,
-0xc1d2,0x9ef0,0xecc8,0x9ef1,0x9ef2,0x9ef3,0x9ef4,0x9ef5,
-0x9ef6,0x9ef7,0x9ef8,0x9ef9,0x9efa,0x9efb,0x9efc,0x9efd,
-0xbae6,0xc0d3,0x9efe,0xd6f2,0x9f40,0x9f41,0x9f42,0xd1cc,
-0x9f43,0x9f44,0x9f45,0x9f46,0xbfbe,0x9f47,0xb7b3,0xc9d5,
-0xecc7,0xbbe2,0x9f48,0xcccc,0xbdfd,0xc8c8,0x9f49,0xcfa9,
-0x9f4a,0x9f4b,0x9f4c,0x9f4d,0x9f4e,0x9f4f,0x9f50,0xcde9,
-0x9f51,0xc5eb,0x9f52,0x9f53,0x9f54,0xb7e9,0x9f55,0x9f56,
-0x9f57,0x9f58,0x9f59,0x9f5a,0x9f5b,0x9f5c,0x9f5d,0x9f5e,
-0x9f5f,0xd1c9,0xbab8,0x9f60,0x9f61,0x9f62,0x9f63,0x9f64,
-0xecc9,0x9f65,0x9f66,0xecca,0x9f67,0xbbc0,0xeccb,0x9f68,
-0xece2,0xb1ba,0xb7d9,0x9f69,0x9f6a,0x9f6b,0x9f6c,0x9f6d,
-0x9f6e,0x9f6f,0x9f70,0x9f71,0x9f72,0x9f73,0xbdb9,0x9f74,
-0x9f75,0x9f76,0x9f77,0x9f78,0x9f79,0x9f7a,0x9f7b,0xeccc,
-0xd1e6,0xeccd,0x9f7c,0x9f7d,0x9f7e,0x9f80,0xc8bb,0x9f81,
-0x9f82,0x9f83,0x9f84,0x9f85,0x9f86,0x9f87,0x9f88,0x9f89,
-0x9f8a,0x9f8b,0x9f8c,0x9f8d,0x9f8e,0xecd1,0x9f8f,0x9f90,
-0x9f91,0x9f92,0xecd3,0x9f93,0xbbcd,0x9f94,0xbce5,0x9f95,
-0x9f96,0x9f97,0x9f98,0x9f99,0x9f9a,0x9f9b,0x9f9c,0x9f9d,
-0x9f9e,0x9f9f,0x9fa0,0x9fa1,0xeccf,0x9fa2,0xc9b7,0x9fa3,
-0x9fa4,0x9fa5,0x9fa6,0x9fa7,0xc3ba,0x9fa8,0xece3,0xd5d5,
-0xecd0,0x9fa9,0x9faa,0x9fab,0x9fac,0x9fad,0xd6f3,0x9fae,
-0x9faf,0x9fb0,0xecd2,0xecce,0x9fb1,0x9fb2,0x9fb3,0x9fb4,
-0xecd4,0x9fb5,0xecd5,0x9fb6,0x9fb7,0xc9bf,0x9fb8,0x9fb9,
-0x9fba,0x9fbb,0x9fbc,0x9fbd,0xcfa8,0x9fbe,0x9fbf,0x9fc0,
-0x9fc1,0x9fc2,0xd0dc,0x9fc3,0x9fc4,0x9fc5,0x9fc6,0xd1ac,
-0x9fc7,0x9fc8,0x9fc9,0x9fca,0xc8db,0x9fcb,0x9fcc,0x9fcd,
-0xecd6,0xcef5,0x9fce,0x9fcf,0x9fd0,0x9fd1,0x9fd2,0xcaec,
-0xecda,0x9fd3,0x9fd4,0x9fd5,0x9fd6,0x9fd7,0x9fd8,0x9fd9,
-0xecd9,0x9fda,0x9fdb,0x9fdc,0xb0be,0x9fdd,0x9fde,0x9fdf,
-0x9fe0,0x9fe1,0x9fe2,0xecd7,0x9fe3,0xecd8,0x9fe4,0x9fe5,
-0x9fe6,0xece4,0x9fe7,0x9fe8,0x9fe9,0x9fea,0x9feb,0x9fec,
-0x9fed,0x9fee,0x9fef,0xc8bc,0x9ff0,0x9ff1,0x9ff2,0x9ff3,
-0x9ff4,0x9ff5,0x9ff6,0x9ff7,0x9ff8,0x9ff9,0xc1c7,0x9ffa,
-0x9ffb,0x9ffc,0x9ffd,0x9ffe,0xecdc,0xd1e0,0xa040,0xa041,
-0xa042,0xa043,0xa044,0xa045,0xa046,0xa047,0xa048,0xa049,
-0xecdb,0xa04a,0xa04b,0xa04c,0xa04d,0xd4ef,0xa04e,0xecdd,
-0xa04f,0xa050,0xa051,0xa052,0xa053,0xa054,0xdbc6,0xa055,
-0xa056,0xa057,0xa058,0xa059,0xa05a,0xa05b,0xa05c,0xa05d,
-0xa05e,0xecde,0xa05f,0xa060,0xa061,0xa062,0xa063,0xa064,
-0xa065,0xa066,0xa067,0xa068,0xa069,0xa06a,0xb1ac,0xa06b,
-0xa06c,0xa06d,0xa06e,0xa06f,0xa070,0xa071,0xa072,0xa073,
-0xa074,0xa075,0xa076,0xa077,0xa078,0xa079,0xa07a,0xa07b,
-0xa07c,0xa07d,0xa07e,0xa080,0xa081,0xecdf,0xa082,0xa083,
-0xa084,0xa085,0xa086,0xa087,0xa088,0xa089,0xa08a,0xa08b,
-0xece0,0xa08c,0xd7a6,0xa08d,0xc5c0,0xa08e,0xa08f,0xa090,
-0xebbc,0xb0ae,0xa091,0xa092,0xa093,0xbef4,0xb8b8,0xd2af,
-0xb0d6,0xb5f9,0xa094,0xd8b3,0xa095,0xcbac,0xa096,0xe3dd,
-0xa097,0xa098,0xa099,0xa09a,0xa09b,0xa09c,0xa09d,0xc6ac,
-0xb0e6,0xa09e,0xa09f,0xa0a0,0xc5c6,0xebb9,0xa0a1,0xa0a2,
-0xa0a3,0xa0a4,0xebba,0xa0a5,0xa0a6,0xa0a7,0xebbb,0xa0a8,
-0xa0a9,0xd1c0,0xa0aa,0xc5a3,0xa0ab,0xeaf2,0xa0ac,0xc4b2,
-0xa0ad,0xc4b5,0xc0ce,0xa0ae,0xa0af,0xa0b0,0xeaf3,0xc4c1,
-0xa0b1,0xceef,0xa0b2,0xa0b3,0xa0b4,0xa0b5,0xeaf0,0xeaf4,
-0xa0b6,0xa0b7,0xc9fc,0xa0b8,0xa0b9,0xc7a3,0xa0ba,0xa0bb,
-0xa0bc,0xccd8,0xcefe,0xa0bd,0xa0be,0xa0bf,0xeaf5,0xeaf6,
-0xcfac,0xc0e7,0xa0c0,0xa0c1,0xeaf7,0xa0c2,0xa0c3,0xa0c4,
-0xa0c5,0xa0c6,0xb6bf,0xeaf8,0xa0c7,0xeaf9,0xa0c8,0xeafa,
-0xa0c9,0xa0ca,0xeafb,0xa0cb,0xa0cc,0xa0cd,0xa0ce,0xa0cf,
-0xa0d0,0xa0d1,0xa0d2,0xa0d3,0xa0d4,0xa0d5,0xa0d6,0xeaf1,
-0xa0d7,0xa0d8,0xa0d9,0xa0da,0xa0db,0xa0dc,0xa0dd,0xa0de,
-0xa0df,0xa0e0,0xa0e1,0xa0e2,0xc8ae,0xe1eb,0xa0e3,0xb7b8,
-0xe1ec,0xa0e4,0xa0e5,0xa0e6,0xe1ed,0xa0e7,0xd7b4,0xe1ee,
-0xe1ef,0xd3cc,0xa0e8,0xa0e9,0xa0ea,0xa0eb,0xa0ec,0xa0ed,
-0xa0ee,0xe1f1,0xbff1,0xe1f0,0xb5d2,0xa0ef,0xa0f0,0xa0f1,
-0xb1b7,0xa0f2,0xa0f3,0xa0f4,0xa0f5,0xe1f3,0xe1f2,0xa0f6,
-0xbafc,0xa0f7,0xe1f4,0xa0f8,0xa0f9,0xa0fa,0xa0fb,0xb9b7,
-0xa0fc,0xbed1,0xa0fd,0xa0fe,0xaa40,0xaa41,0xc4fc,0xaa42,
-0xbadd,0xbdc6,0xaa43,0xaa44,0xaa45,0xaa46,0xaa47,0xaa48,
-0xe1f5,0xe1f7,0xaa49,0xaa4a,0xb6c0,0xcfc1,0xcaa8,0xe1f6,
-0xd5f8,0xd3fc,0xe1f8,0xe1fc,0xe1f9,0xaa4b,0xaa4c,0xe1fa,
-0xc0ea,0xaa4d,0xe1fe,0xe2a1,0xc0c7,0xaa4e,0xaa4f,0xaa50,
-0xaa51,0xe1fb,0xaa52,0xe1fd,0xaa53,0xaa54,0xaa55,0xaa56,
-0xaa57,0xaa58,0xe2a5,0xaa59,0xaa5a,0xaa5b,0xc1d4,0xaa5c,
-0xaa5d,0xaa5e,0xaa5f,0xe2a3,0xaa60,0xe2a8,0xb2fe,0xe2a2,
-0xaa61,0xaa62,0xaa63,0xc3cd,0xb2c2,0xe2a7,0xe2a6,0xaa64,
-0xaa65,0xe2a4,0xe2a9,0xaa66,0xaa67,0xe2ab,0xaa68,0xaa69,
-0xaa6a,0xd0c9,0xd6ed,0xc3a8,0xe2ac,0xaa6b,0xcfd7,0xaa6c,
-0xaa6d,0xe2ae,0xaa6e,0xaa6f,0xbaef,0xaa70,0xaa71,0xe9e0,
-0xe2ad,0xe2aa,0xaa72,0xaa73,0xaa74,0xaa75,0xbbab,0xd4b3,
-0xaa76,0xaa77,0xaa78,0xaa79,0xaa7a,0xaa7b,0xaa7c,0xaa7d,
-0xaa7e,0xaa80,0xaa81,0xaa82,0xaa83,0xe2b0,0xaa84,0xaa85,
-0xe2af,0xaa86,0xe9e1,0xaa87,0xaa88,0xaa89,0xaa8a,0xe2b1,
-0xaa8b,0xaa8c,0xaa8d,0xaa8e,0xaa8f,0xaa90,0xaa91,0xaa92,
-0xe2b2,0xaa93,0xaa94,0xaa95,0xaa96,0xaa97,0xaa98,0xaa99,
-0xaa9a,0xaa9b,0xaa9c,0xaa9d,0xe2b3,0xcca1,0xaa9e,0xe2b4,
-0xaa9f,0xaaa0,0xab40,0xab41,0xab42,0xab43,0xab44,0xab45,
-0xab46,0xab47,0xab48,0xab49,0xab4a,0xab4b,0xe2b5,0xab4c,
-0xab4d,0xab4e,0xab4f,0xab50,0xd0fe,0xab51,0xab52,0xc2ca,
-0xab53,0xd3f1,0xab54,0xcdf5,0xab55,0xab56,0xe7e0,0xab57,
-0xab58,0xe7e1,0xab59,0xab5a,0xab5b,0xab5c,0xbec1,0xab5d,
-0xab5e,0xab5f,0xab60,0xc2ea,0xab61,0xab62,0xab63,0xe7e4,
-0xab64,0xab65,0xe7e3,0xab66,0xab67,0xab68,0xab69,0xab6a,
-0xab6b,0xcde6,0xab6c,0xc3b5,0xab6d,0xab6e,0xe7e2,0xbbb7,
-0xcfd6,0xab6f,0xc1e1,0xe7e9,0xab70,0xab71,0xab72,0xe7e8,
-0xab73,0xab74,0xe7f4,0xb2a3,0xab75,0xab76,0xab77,0xab78,
-0xe7ea,0xab79,0xe7e6,0xab7a,0xab7b,0xab7c,0xab7d,0xab7e,
-0xe7ec,0xe7eb,0xc9ba,0xab80,0xab81,0xd5e4,0xab82,0xe7e5,
-0xb7a9,0xe7e7,0xab83,0xab84,0xab85,0xab86,0xab87,0xab88,
-0xab89,0xe7ee,0xab8a,0xab8b,0xab8c,0xab8d,0xe7f3,0xab8e,
-0xd6e9,0xab8f,0xab90,0xab91,0xab92,0xe7ed,0xab93,0xe7f2,
-0xab94,0xe7f1,0xab95,0xab96,0xab97,0xb0e0,0xab98,0xab99,
-0xab9a,0xab9b,0xe7f5,0xab9c,0xab9d,0xab9e,0xab9f,0xaba0,
-0xac40,0xac41,0xac42,0xac43,0xac44,0xac45,0xac46,0xac47,
-0xac48,0xac49,0xac4a,0xc7f2,0xac4b,0xc0c5,0xc0ed,0xac4c,
-0xac4d,0xc1f0,0xe7f0,0xac4e,0xac4f,0xac50,0xac51,0xe7f6,
-0xcbf6,0xac52,0xac53,0xac54,0xac55,0xac56,0xac57,0xac58,
-0xac59,0xac5a,0xe8a2,0xe8a1,0xac5b,0xac5c,0xac5d,0xac5e,
-0xac5f,0xac60,0xd7c1,0xac61,0xac62,0xe7fa,0xe7f9,0xac63,
-0xe7fb,0xac64,0xe7f7,0xac65,0xe7fe,0xac66,0xe7fd,0xac67,
-0xe7fc,0xac68,0xac69,0xc1d5,0xc7d9,0xc5fd,0xc5c3,0xac6a,
-0xac6b,0xac6c,0xac6d,0xac6e,0xc7ed,0xac6f,0xac70,0xac71,
-0xac72,0xe8a3,0xac73,0xac74,0xac75,0xac76,0xac77,0xac78,
-0xac79,0xac7a,0xac7b,0xac7c,0xac7d,0xac7e,0xac80,0xac81,
-0xac82,0xac83,0xac84,0xac85,0xac86,0xe8a6,0xac87,0xe8a5,
-0xac88,0xe8a7,0xbaf7,0xe7f8,0xe8a4,0xac89,0xc8f0,0xc9aa,
-0xac8a,0xac8b,0xac8c,0xac8d,0xac8e,0xac8f,0xac90,0xac91,
-0xac92,0xac93,0xac94,0xac95,0xac96,0xe8a9,0xac97,0xac98,
-0xb9e5,0xac99,0xac9a,0xac9b,0xac9c,0xac9d,0xd1fe,0xe8a8,
-0xac9e,0xac9f,0xaca0,0xad40,0xad41,0xad42,0xe8aa,0xad43,
-0xe8ad,0xe8ae,0xad44,0xc1a7,0xad45,0xad46,0xad47,0xe8af,
-0xad48,0xad49,0xad4a,0xe8b0,0xad4b,0xad4c,0xe8ac,0xad4d,
-0xe8b4,0xad4e,0xad4f,0xad50,0xad51,0xad52,0xad53,0xad54,
-0xad55,0xad56,0xad57,0xad58,0xe8ab,0xad59,0xe8b1,0xad5a,
-0xad5b,0xad5c,0xad5d,0xad5e,0xad5f,0xad60,0xad61,0xe8b5,
-0xe8b2,0xe8b3,0xad62,0xad63,0xad64,0xad65,0xad66,0xad67,
-0xad68,0xad69,0xad6a,0xad6b,0xad6c,0xad6d,0xad6e,0xad6f,
-0xad70,0xad71,0xe8b7,0xad72,0xad73,0xad74,0xad75,0xad76,
-0xad77,0xad78,0xad79,0xad7a,0xad7b,0xad7c,0xad7d,0xad7e,
-0xad80,0xad81,0xad82,0xad83,0xad84,0xad85,0xad86,0xad87,
-0xad88,0xad89,0xe8b6,0xad8a,0xad8b,0xad8c,0xad8d,0xad8e,
-0xad8f,0xad90,0xad91,0xad92,0xb9cf,0xad93,0xf0ac,0xad94,
-0xf0ad,0xad95,0xc6b0,0xb0ea,0xc8bf,0xad96,0xcddf,0xad97,
-0xad98,0xad99,0xad9a,0xad9b,0xad9c,0xad9d,0xcecd,0xeab1,
-0xad9e,0xad9f,0xada0,0xae40,0xeab2,0xae41,0xc6bf,0xb4c9,
-0xae42,0xae43,0xae44,0xae45,0xae46,0xae47,0xae48,0xeab3,
-0xae49,0xae4a,0xae4b,0xae4c,0xd5e7,0xae4d,0xae4e,0xae4f,
-0xae50,0xae51,0xae52,0xae53,0xae54,0xddf9,0xae55,0xeab4,
-0xae56,0xeab5,0xae57,0xeab6,0xae58,0xae59,0xae5a,0xae5b,
-0xb8ca,0xdfb0,0xc9f5,0xae5c,0xccf0,0xae5d,0xae5e,0xc9fa,
-0xae5f,0xae60,0xae61,0xae62,0xae63,0xc9fb,0xae64,0xae65,
-0xd3c3,0xcba6,0xae66,0xb8a6,0xf0ae,0xb1c2,0xae67,0xe5b8,
-0xccef,0xd3c9,0xbcd7,0xc9ea,0xae68,0xb5e7,0xae69,0xc4d0,
-0xb5e9,0xae6a,0xeeae,0xbbad,0xae6b,0xae6c,0xe7de,0xae6d,
-0xeeaf,0xae6e,0xae6f,0xae70,0xae71,0xb3a9,0xae72,0xae73,
-0xeeb2,0xae74,0xae75,0xeeb1,0xbde7,0xae76,0xeeb0,0xceb7,
-0xae77,0xae78,0xae79,0xae7a,0xc5cf,0xae7b,0xae7c,0xae7d,
-0xae7e,0xc1f4,0xdbce,0xeeb3,0xd0f3,0xae80,0xae81,0xae82,
-0xae83,0xae84,0xae85,0xae86,0xae87,0xc2d4,0xc6e8,0xae88,
-0xae89,0xae8a,0xb7ac,0xae8b,0xae8c,0xae8d,0xae8e,0xae8f,
-0xae90,0xae91,0xeeb4,0xae92,0xb3eb,0xae93,0xae94,0xae95,
-0xbbfb,0xeeb5,0xae96,0xae97,0xae98,0xae99,0xae9a,0xe7dc,
-0xae9b,0xae9c,0xae9d,0xeeb6,0xae9e,0xae9f,0xbdae,0xaea0,
-0xaf40,0xaf41,0xaf42,0xf1e2,0xaf43,0xaf44,0xaf45,0xcae8,
-0xaf46,0xd2c9,0xf0da,0xaf47,0xf0db,0xaf48,0xf0dc,0xc1c6,
-0xaf49,0xb8ed,0xbece,0xaf4a,0xaf4b,0xf0de,0xaf4c,0xc5b1,
-0xf0dd,0xd1f1,0xaf4d,0xf0e0,0xb0cc,0xbdea,0xaf4e,0xaf4f,
-0xaf50,0xaf51,0xaf52,0xd2df,0xf0df,0xaf53,0xb4af,0xb7e8,
-0xf0e6,0xf0e5,0xc6a3,0xf0e1,0xf0e2,0xb4c3,0xaf54,0xaf55,
-0xf0e3,0xd5ee,0xaf56,0xaf57,0xccdb,0xbed2,0xbcb2,0xaf58,
-0xaf59,0xaf5a,0xf0e8,0xf0e7,0xf0e4,0xb2a1,0xaf5b,0xd6a2,
-0xd3b8,0xbeb7,0xc8ac,0xaf5c,0xaf5d,0xf0ea,0xaf5e,0xaf5f,
-0xaf60,0xaf61,0xd1f7,0xaf62,0xd6cc,0xbadb,0xf0e9,0xaf63,
-0xb6bb,0xaf64,0xaf65,0xcdb4,0xaf66,0xaf67,0xc6a6,0xaf68,
-0xaf69,0xaf6a,0xc1a1,0xf0eb,0xf0ee,0xaf6b,0xf0ed,0xf0f0,
-0xf0ec,0xaf6c,0xbbbe,0xf0ef,0xaf6d,0xaf6e,0xaf6f,0xaf70,
-0xccb5,0xf0f2,0xaf71,0xaf72,0xb3d5,0xaf73,0xaf74,0xaf75,
-0xaf76,0xb1d4,0xaf77,0xaf78,0xf0f3,0xaf79,0xaf7a,0xf0f4,
-0xf0f6,0xb4e1,0xaf7b,0xf0f1,0xaf7c,0xf0f7,0xaf7d,0xaf7e,
-0xaf80,0xaf81,0xf0fa,0xaf82,0xf0f8,0xaf83,0xaf84,0xaf85,
-0xf0f5,0xaf86,0xaf87,0xaf88,0xaf89,0xf0fd,0xaf8a,0xf0f9,
-0xf0fc,0xf0fe,0xaf8b,0xf1a1,0xaf8c,0xaf8d,0xaf8e,0xcec1,
-0xf1a4,0xaf8f,0xf1a3,0xaf90,0xc1f6,0xf0fb,0xcadd,0xaf91,
-0xaf92,0xb4f1,0xb1f1,0xccb1,0xaf93,0xf1a6,0xaf94,0xaf95,
-0xf1a7,0xaf96,0xaf97,0xf1ac,0xd5ce,0xf1a9,0xaf98,0xaf99,
-0xc8b3,0xaf9a,0xaf9b,0xaf9c,0xf1a2,0xaf9d,0xf1ab,0xf1a8,
-0xf1a5,0xaf9e,0xaf9f,0xf1aa,0xafa0,0xb040,0xb041,0xb042,
-0xb043,0xb044,0xb045,0xb046,0xb0a9,0xf1ad,0xb047,0xb048,
-0xb049,0xb04a,0xb04b,0xb04c,0xf1af,0xb04d,0xf1b1,0xb04e,
-0xb04f,0xb050,0xb051,0xb052,0xf1b0,0xb053,0xf1ae,0xb054,
-0xb055,0xb056,0xb057,0xd1a2,0xb058,0xb059,0xb05a,0xb05b,
-0xb05c,0xb05d,0xb05e,0xf1b2,0xb05f,0xb060,0xb061,0xf1b3,
-0xb062,0xb063,0xb064,0xb065,0xb066,0xb067,0xb068,0xb069,
-0xb9ef,0xb06a,0xb06b,0xb5c7,0xb06c,0xb0d7,0xb0d9,0xb06d,
-0xb06e,0xb06f,0xd4ed,0xb070,0xb5c4,0xb071,0xbdd4,0xbbca,
-0xf0a7,0xb072,0xb073,0xb8de,0xb074,0xb075,0xf0a8,0xb076,
-0xb077,0xb0a8,0xb078,0xf0a9,0xb079,0xb07a,0xcdee,0xb07b,
-0xb07c,0xf0aa,0xb07d,0xb07e,0xb080,0xb081,0xb082,0xb083,
-0xb084,0xb085,0xb086,0xb087,0xf0ab,0xb088,0xb089,0xb08a,
-0xb08b,0xb08c,0xb08d,0xb08e,0xb08f,0xb090,0xc6a4,0xb091,
-0xb092,0xd6e5,0xf1e4,0xb093,0xf1e5,0xb094,0xb095,0xb096,
-0xb097,0xb098,0xb099,0xb09a,0xb09b,0xb09c,0xb09d,0xc3f3,
-0xb09e,0xb09f,0xd3db,0xb0a0,0xb140,0xd6d1,0xc5e8,0xb141,
-0xd3af,0xb142,0xd2e6,0xb143,0xb144,0xeec1,0xb0bb,0xd5b5,
-0xd1ce,0xbce0,0xbad0,0xb145,0xbff8,0xb146,0xb8c7,0xb5c1,
-0xc5cc,0xb147,0xb148,0xcaa2,0xb149,0xb14a,0xb14b,0xc3cb,
-0xb14c,0xb14d,0xb14e,0xb14f,0xb150,0xeec2,0xb151,0xb152,
-0xb153,0xb154,0xb155,0xb156,0xb157,0xb158,0xc4bf,0xb6a2,
-0xb159,0xedec,0xc3a4,0xb15a,0xd6b1,0xb15b,0xb15c,0xb15d,
-0xcfe0,0xedef,0xb15e,0xb15f,0xc5ce,0xb160,0xb6dc,0xb161,
-0xb162,0xcaa1,0xb163,0xb164,0xeded,0xb165,0xb166,0xedf0,
-0xedf1,0xc3bc,0xb167,0xbfb4,0xb168,0xedee,0xb169,0xb16a,
-0xb16b,0xb16c,0xb16d,0xb16e,0xb16f,0xb170,0xb171,0xb172,
-0xb173,0xedf4,0xedf2,0xb174,0xb175,0xb176,0xb177,0xd5e6,
-0xc3df,0xb178,0xedf3,0xb179,0xb17a,0xb17b,0xedf6,0xb17c,
-0xd5a3,0xd1a3,0xb17d,0xb17e,0xb180,0xedf5,0xb181,0xc3d0,
-0xb182,0xb183,0xb184,0xb185,0xb186,0xedf7,0xbff4,0xbeec,
-0xedf8,0xb187,0xccf7,0xb188,0xd1db,0xb189,0xb18a,0xb18b,
-0xd7c5,0xd5f6,0xb18c,0xedfc,0xb18d,0xb18e,0xb18f,0xedfb,
-0xb190,0xb191,0xb192,0xb193,0xb194,0xb195,0xb196,0xb197,
-0xedf9,0xedfa,0xb198,0xb199,0xb19a,0xb19b,0xb19c,0xb19d,
-0xb19e,0xb19f,0xedfd,0xbea6,0xb1a0,0xb240,0xb241,0xb242,
-0xb243,0xcbaf,0xeea1,0xb6bd,0xb244,0xeea2,0xc4c0,0xb245,
-0xedfe,0xb246,0xb247,0xbdde,0xb2c7,0xb248,0xb249,0xb24a,
-0xb24b,0xb24c,0xb24d,0xb24e,0xb24f,0xb250,0xb251,0xb252,
-0xb253,0xb6c3,0xb254,0xb255,0xb256,0xeea5,0xd8ba,0xeea3,
-0xeea6,0xb257,0xb258,0xb259,0xc3e9,0xb3f2,0xb25a,0xb25b,
-0xb25c,0xb25d,0xb25e,0xb25f,0xeea7,0xeea4,0xcfb9,0xb260,
-0xb261,0xeea8,0xc2f7,0xb262,0xb263,0xb264,0xb265,0xb266,
-0xb267,0xb268,0xb269,0xb26a,0xb26b,0xb26c,0xb26d,0xeea9,
-0xeeaa,0xb26e,0xdeab,0xb26f,0xb270,0xc6b3,0xb271,0xc7c6,
-0xb272,0xd6f5,0xb5c9,0xb273,0xcbb2,0xb274,0xb275,0xb276,
-0xeeab,0xb277,0xb278,0xcdab,0xb279,0xeeac,0xb27a,0xb27b,
-0xb27c,0xb27d,0xb27e,0xd5b0,0xb280,0xeead,0xb281,0xf6c4,
-0xb282,0xb283,0xb284,0xb285,0xb286,0xb287,0xb288,0xb289,
-0xb28a,0xb28b,0xb28c,0xb28d,0xb28e,0xdbc7,0xb28f,0xb290,
-0xb291,0xb292,0xb293,0xb294,0xb295,0xb296,0xb297,0xb4a3,
-0xb298,0xb299,0xb29a,0xc3ac,0xf1e6,0xb29b,0xb29c,0xb29d,
-0xb29e,0xb29f,0xcab8,0xd2d3,0xb2a0,0xd6aa,0xb340,0xeff2,
-0xb341,0xbed8,0xb342,0xbdc3,0xeff3,0xb6cc,0xb0ab,0xb343,
-0xb344,0xb345,0xb346,0xcaaf,0xb347,0xb348,0xedb6,0xb349,
-0xedb7,0xb34a,0xb34b,0xb34c,0xb34d,0xcef9,0xb7af,0xbff3,
-0xedb8,0xc2eb,0xc9b0,0xb34e,0xb34f,0xb350,0xb351,0xb352,
-0xb353,0xedb9,0xb354,0xb355,0xc6f6,0xbfb3,0xb356,0xb357,
-0xb358,0xedbc,0xc5f8,0xb359,0xd1d0,0xb35a,0xd7a9,0xedba,
-0xedbb,0xb35b,0xd1e2,0xb35c,0xedbf,0xedc0,0xb35d,0xedc4,
-0xb35e,0xb35f,0xb360,0xedc8,0xb361,0xedc6,0xedce,0xd5e8,
-0xb362,0xedc9,0xb363,0xb364,0xedc7,0xedbe,0xb365,0xb366,
-0xc5e9,0xb367,0xb368,0xb369,0xc6c6,0xb36a,0xb36b,0xc9e9,
-0xd4d2,0xedc1,0xedc2,0xedc3,0xedc5,0xb36c,0xc0f9,0xb36d,
-0xb4a1,0xb36e,0xb36f,0xb370,0xb371,0xb9e8,0xb372,0xedd0,
-0xb373,0xb374,0xb375,0xb376,0xedd1,0xb377,0xedca,0xb378,
-0xedcf,0xb379,0xcef8,0xb37a,0xb37b,0xcbb6,0xedcc,0xedcd,
-0xb37c,0xb37d,0xb37e,0xb380,0xb381,0xcff5,0xb382,0xb383,
-0xb384,0xb385,0xb386,0xb387,0xb388,0xb389,0xb38a,0xb38b,
-0xb38c,0xb38d,0xedd2,0xc1f2,0xd3b2,0xedcb,0xc8b7,0xb38e,
-0xb38f,0xb390,0xb391,0xb392,0xb393,0xb394,0xb395,0xbcef,
-0xb396,0xb397,0xb398,0xb399,0xc5f0,0xb39a,0xb39b,0xb39c,
-0xb39d,0xb39e,0xb39f,0xb3a0,0xb440,0xb441,0xb442,0xedd6,
-0xb443,0xb5ef,0xb444,0xb445,0xc2b5,0xb0ad,0xcbe9,0xb446,
-0xb447,0xb1ae,0xb448,0xedd4,0xb449,0xb44a,0xb44b,0xcdeb,
-0xb5e2,0xb44c,0xedd5,0xedd3,0xedd7,0xb44d,0xb44e,0xb5fa,
-0xb44f,0xedd8,0xb450,0xedd9,0xb451,0xeddc,0xb452,0xb1cc,
-0xb453,0xb454,0xb455,0xb456,0xb457,0xb458,0xb459,0xb45a,
-0xc5f6,0xbcee,0xedda,0xccbc,0xb2ea,0xb45b,0xb45c,0xb45d,
-0xb45e,0xeddb,0xb45f,0xb460,0xb461,0xb462,0xc4eb,0xb463,
-0xb464,0xb4c5,0xb465,0xb466,0xb467,0xb0f5,0xb468,0xb469,
-0xb46a,0xeddf,0xc0da,0xb4e8,0xb46b,0xb46c,0xb46d,0xb46e,
-0xc5cd,0xb46f,0xb470,0xb471,0xeddd,0xbfc4,0xb472,0xb473,
-0xb474,0xedde,0xb475,0xb476,0xb477,0xb478,0xb479,0xb47a,
-0xb47b,0xb47c,0xb47d,0xb47e,0xb480,0xb481,0xb482,0xb483,
-0xc4a5,0xb484,0xb485,0xb486,0xede0,0xb487,0xb488,0xb489,
-0xb48a,0xb48b,0xede1,0xb48c,0xede3,0xb48d,0xb48e,0xc1d7,
-0xb48f,0xb490,0xbbc7,0xb491,0xb492,0xb493,0xb494,0xb495,
-0xb496,0xbdb8,0xb497,0xb498,0xb499,0xede2,0xb49a,0xb49b,
-0xb49c,0xb49d,0xb49e,0xb49f,0xb4a0,0xb540,0xb541,0xb542,
-0xb543,0xb544,0xb545,0xede4,0xb546,0xb547,0xb548,0xb549,
-0xb54a,0xb54b,0xb54c,0xb54d,0xb54e,0xb54f,0xede6,0xb550,
-0xb551,0xb552,0xb553,0xb554,0xede5,0xb555,0xb556,0xb557,
-0xb558,0xb559,0xb55a,0xb55b,0xb55c,0xb55d,0xb55e,0xb55f,
-0xb560,0xb561,0xb562,0xb563,0xede7,0xb564,0xb565,0xb566,
-0xb567,0xb568,0xcabe,0xecea,0xc0f1,0xb569,0xc9e7,0xb56a,
-0xeceb,0xc6ee,0xb56b,0xb56c,0xb56d,0xb56e,0xecec,0xb56f,
-0xc6ed,0xeced,0xb570,0xb571,0xb572,0xb573,0xb574,0xb575,
-0xb576,0xb577,0xb578,0xecf0,0xb579,0xb57a,0xd7e6,0xecf3,
-0xb57b,0xb57c,0xecf1,0xecee,0xecef,0xd7a3,0xc9f1,0xcbee,
-0xecf4,0xb57d,0xecf2,0xb57e,0xb580,0xcfe9,0xb581,0xecf6,
-0xc6b1,0xb582,0xb583,0xb584,0xb585,0xbcc0,0xb586,0xecf5,
-0xb587,0xb588,0xb589,0xb58a,0xb58b,0xb58c,0xb58d,0xb5bb,
-0xbbf6,0xb58e,0xecf7,0xb58f,0xb590,0xb591,0xb592,0xb593,
-0xd9f7,0xbdfb,0xb594,0xb595,0xc2bb,0xecf8,0xb596,0xb597,
-0xb598,0xb599,0xecf9,0xb59a,0xb59b,0xb59c,0xb59d,0xb8a3,
-0xb59e,0xb59f,0xb5a0,0xb640,0xb641,0xb642,0xb643,0xb644,
-0xb645,0xb646,0xecfa,0xb647,0xb648,0xb649,0xb64a,0xb64b,
-0xb64c,0xb64d,0xb64e,0xb64f,0xb650,0xb651,0xb652,0xecfb,
-0xb653,0xb654,0xb655,0xb656,0xb657,0xb658,0xb659,0xb65a,
-0xb65b,0xb65c,0xb65d,0xecfc,0xb65e,0xb65f,0xb660,0xb661,
-0xb662,0xd3ed,0xd8ae,0xc0eb,0xb663,0xc7dd,0xbacc,0xb664,
-0xd0e3,0xcbbd,0xb665,0xcdba,0xb666,0xb667,0xb8d1,0xb668,
-0xb669,0xb1fc,0xb66a,0xc7ef,0xb66b,0xd6d6,0xb66c,0xb66d,
-0xb66e,0xbfc6,0xc3eb,0xb66f,0xb670,0xeff5,0xb671,0xb672,
-0xc3d8,0xb673,0xb674,0xb675,0xb676,0xb677,0xb678,0xd7e2,
-0xb679,0xb67a,0xb67b,0xeff7,0xb3d3,0xb67c,0xc7d8,0xd1ed,
-0xb67d,0xd6c8,0xb67e,0xeff8,0xb680,0xeff6,0xb681,0xbbfd,
-0xb3c6,0xb682,0xb683,0xb684,0xb685,0xb686,0xb687,0xb688,
-0xbdd5,0xb689,0xb68a,0xd2c6,0xb68b,0xbbe0,0xb68c,0xb68d,
-0xcfa1,0xb68e,0xeffc,0xeffb,0xb68f,0xb690,0xeff9,0xb691,
-0xb692,0xb693,0xb694,0xb3cc,0xb695,0xc9d4,0xcbb0,0xb696,
-0xb697,0xb698,0xb699,0xb69a,0xeffe,0xb69b,0xb69c,0xb0de,
-0xb69d,0xb69e,0xd6c9,0xb69f,0xb6a0,0xb740,0xeffd,0xb741,
-0xb3ed,0xb742,0xb743,0xf6d5,0xb744,0xb745,0xb746,0xb747,
-0xb748,0xb749,0xb74a,0xb74b,0xb74c,0xb74d,0xb74e,0xb74f,
-0xb750,0xb751,0xb752,0xcec8,0xb753,0xb754,0xb755,0xf0a2,
-0xb756,0xf0a1,0xb757,0xb5be,0xbcda,0xbbfc,0xb758,0xb8e5,
-0xb759,0xb75a,0xb75b,0xb75c,0xb75d,0xb75e,0xc4c2,0xb75f,
-0xb760,0xb761,0xb762,0xb763,0xb764,0xb765,0xb766,0xb767,
-0xb768,0xf0a3,0xb769,0xb76a,0xb76b,0xb76c,0xb76d,0xcbeb,
-0xb76e,0xb76f,0xb770,0xb771,0xb772,0xb773,0xb774,0xb775,
-0xb776,0xb777,0xb778,0xb779,0xb77a,0xb77b,0xb77c,0xb77d,
-0xb77e,0xb780,0xb781,0xb782,0xb783,0xb784,0xb785,0xb786,
-0xf0a6,0xb787,0xb788,0xb789,0xd1a8,0xb78a,0xbebf,0xc7ee,
-0xf1b6,0xf1b7,0xbfd5,0xb78b,0xb78c,0xb78d,0xb78e,0xb4a9,
-0xf1b8,0xcdbb,0xb78f,0xc7d4,0xd5ad,0xb790,0xf1b9,0xb791,
-0xf1ba,0xb792,0xb793,0xb794,0xb795,0xc7cf,0xb796,0xb797,
-0xb798,0xd2a4,0xd6cf,0xb799,0xb79a,0xf1bb,0xbdd1,0xb4b0,
-0xbebd,0xb79b,0xb79c,0xb79d,0xb4dc,0xced1,0xb79e,0xbfdf,
-0xf1bd,0xb79f,0xb7a0,0xb840,0xb841,0xbffa,0xf1bc,0xb842,
-0xf1bf,0xb843,0xb844,0xb845,0xf1be,0xf1c0,0xb846,0xb847,
-0xb848,0xb849,0xb84a,0xf1c1,0xb84b,0xb84c,0xb84d,0xb84e,
-0xb84f,0xb850,0xb851,0xb852,0xb853,0xb854,0xb855,0xc1fe,
-0xb856,0xb857,0xb858,0xb859,0xb85a,0xb85b,0xb85c,0xb85d,
-0xb85e,0xb85f,0xb860,0xc1a2,0xb861,0xb862,0xb863,0xb864,
-0xb865,0xb866,0xb867,0xb868,0xb869,0xb86a,0xcafa,0xb86b,
-0xb86c,0xd5be,0xb86d,0xb86e,0xb86f,0xb870,0xbeba,0xbeb9,
-0xd5c2,0xb871,0xb872,0xbfa2,0xb873,0xcdaf,0xf1b5,0xb874,
-0xb875,0xb876,0xb877,0xb878,0xb879,0xbddf,0xb87a,0xb6cb,
-0xb87b,0xb87c,0xb87d,0xb87e,0xb880,0xb881,0xb882,0xb883,
-0xb884,0xd6f1,0xf3c3,0xb885,0xb886,0xf3c4,0xb887,0xb8cd,
-0xb888,0xb889,0xb88a,0xf3c6,0xf3c7,0xb88b,0xb0ca,0xb88c,
-0xf3c5,0xb88d,0xf3c9,0xcbf1,0xb88e,0xb88f,0xb890,0xf3cb,
-0xb891,0xd0a6,0xb892,0xb893,0xb1ca,0xf3c8,0xb894,0xb895,
-0xb896,0xf3cf,0xb897,0xb5d1,0xb898,0xb899,0xf3d7,0xb89a,
-0xf3d2,0xb89b,0xb89c,0xb89d,0xf3d4,0xf3d3,0xb7fb,0xb89e,
-0xb1bf,0xb89f,0xf3ce,0xf3ca,0xb5da,0xb8a0,0xf3d0,0xb940,
-0xb941,0xf3d1,0xb942,0xf3d5,0xb943,0xb944,0xb945,0xb946,
-0xf3cd,0xb947,0xbce3,0xb948,0xc1fd,0xb949,0xf3d6,0xb94a,
-0xb94b,0xb94c,0xb94d,0xb94e,0xb94f,0xf3da,0xb950,0xf3cc,
-0xb951,0xb5c8,0xb952,0xbdee,0xf3dc,0xb953,0xb954,0xb7a4,
-0xbff0,0xd6fe,0xcdb2,0xb955,0xb4f0,0xb956,0xb2df,0xb957,
-0xf3d8,0xb958,0xf3d9,0xc9b8,0xb959,0xf3dd,0xb95a,0xb95b,
-0xf3de,0xb95c,0xf3e1,0xb95d,0xb95e,0xb95f,0xb960,0xb961,
-0xb962,0xb963,0xb964,0xb965,0xb966,0xb967,0xf3df,0xb968,
-0xb969,0xf3e3,0xf3e2,0xb96a,0xb96b,0xf3db,0xb96c,0xbfea,
-0xb96d,0xb3ef,0xb96e,0xf3e0,0xb96f,0xb970,0xc7a9,0xb971,
-0xbcf2,0xb972,0xb973,0xb974,0xb975,0xf3eb,0xb976,0xb977,
-0xb978,0xb979,0xb97a,0xb97b,0xb97c,0xb9bf,0xb97d,0xb97e,
-0xf3e4,0xb980,0xb981,0xb982,0xb2ad,0xbbfe,0xb983,0xcbe3,
-0xb984,0xb985,0xb986,0xb987,0xf3ed,0xf3e9,0xb988,0xb989,
-0xb98a,0xb9dc,0xf3ee,0xb98b,0xb98c,0xb98d,0xf3e5,0xf3e6,
-0xf3ea,0xc2e1,0xf3ec,0xf3ef,0xf3e8,0xbcfd,0xb98e,0xb98f,
-0xb990,0xcfe4,0xb991,0xb992,0xf3f0,0xb993,0xb994,0xb995,
-0xf3e7,0xb996,0xb997,0xb998,0xb999,0xb99a,0xb99b,0xb99c,
-0xb99d,0xf3f2,0xb99e,0xb99f,0xb9a0,0xba40,0xd7ad,0xc6aa,
-0xba41,0xba42,0xba43,0xba44,0xf3f3,0xba45,0xba46,0xba47,
-0xba48,0xf3f1,0xba49,0xc2a8,0xba4a,0xba4b,0xba4c,0xba4d,
-0xba4e,0xb8dd,0xf3f5,0xba4f,0xba50,0xf3f4,0xba51,0xba52,
-0xba53,0xb4db,0xba54,0xba55,0xba56,0xf3f6,0xf3f7,0xba57,
-0xba58,0xba59,0xf3f8,0xba5a,0xba5b,0xba5c,0xc0ba,0xba5d,
-0xba5e,0xc0e9,0xba5f,0xba60,0xba61,0xba62,0xba63,0xc5f1,
-0xba64,0xba65,0xba66,0xba67,0xf3fb,0xba68,0xf3fa,0xba69,
-0xba6a,0xba6b,0xba6c,0xba6d,0xba6e,0xba6f,0xba70,0xb4d8,
-0xba71,0xba72,0xba73,0xf3fe,0xf3f9,0xba74,0xba75,0xf3fc,
-0xba76,0xba77,0xba78,0xba79,0xba7a,0xba7b,0xf3fd,0xba7c,
-0xba7d,0xba7e,0xba80,0xba81,0xba82,0xba83,0xba84,0xf4a1,
-0xba85,0xba86,0xba87,0xba88,0xba89,0xba8a,0xf4a3,0xbbc9,
-0xba8b,0xba8c,0xf4a2,0xba8d,0xba8e,0xba8f,0xba90,0xba91,
-0xba92,0xba93,0xba94,0xba95,0xba96,0xba97,0xba98,0xba99,
-0xf4a4,0xba9a,0xba9b,0xba9c,0xba9d,0xba9e,0xba9f,0xb2be,
-0xf4a6,0xf4a5,0xbaa0,0xbb40,0xbb41,0xbb42,0xbb43,0xbb44,
-0xbb45,0xbb46,0xbb47,0xbb48,0xbb49,0xbcae,0xbb4a,0xbb4b,
-0xbb4c,0xbb4d,0xbb4e,0xbb4f,0xbb50,0xbb51,0xbb52,0xbb53,
-0xbb54,0xbb55,0xbb56,0xbb57,0xbb58,0xbb59,0xbb5a,0xbb5b,
-0xbb5c,0xbb5d,0xbb5e,0xbb5f,0xbb60,0xbb61,0xbb62,0xbb63,
-0xbb64,0xbb65,0xbb66,0xbb67,0xbb68,0xbb69,0xbb6a,0xbb6b,
-0xbb6c,0xbb6d,0xbb6e,0xc3d7,0xd9e1,0xbb6f,0xbb70,0xbb71,
-0xbb72,0xbb73,0xbb74,0xc0e0,0xf4cc,0xd7d1,0xbb75,0xbb76,
-0xbb77,0xbb78,0xbb79,0xbb7a,0xbb7b,0xbb7c,0xbb7d,0xbb7e,
-0xbb80,0xb7db,0xbb81,0xbb82,0xbb83,0xbb84,0xbb85,0xbb86,
-0xbb87,0xf4ce,0xc1a3,0xbb88,0xbb89,0xc6c9,0xbb8a,0xb4d6,
-0xd5b3,0xbb8b,0xbb8c,0xbb8d,0xf4d0,0xf4cf,0xf4d1,0xcbda,
-0xbb8e,0xbb8f,0xf4d2,0xbb90,0xd4c1,0xd6e0,0xbb91,0xbb92,
-0xbb93,0xbb94,0xb7e0,0xbb95,0xbb96,0xbb97,0xc1b8,0xbb98,
-0xbb99,0xc1bb,0xf4d3,0xbeac,0xbb9a,0xbb9b,0xbb9c,0xbb9d,
-0xbb9e,0xb4e2,0xbb9f,0xbba0,0xf4d4,0xf4d5,0xbeab,0xbc40,
-0xbc41,0xf4d6,0xbc42,0xbc43,0xbc44,0xf4db,0xbc45,0xf4d7,
-0xf4da,0xbc46,0xbafd,0xbc47,0xf4d8,0xf4d9,0xbc48,0xbc49,
-0xbc4a,0xbc4b,0xbc4c,0xbc4d,0xbc4e,0xb8e2,0xccc7,0xf4dc,
-0xbc4f,0xb2da,0xbc50,0xbc51,0xc3d3,0xbc52,0xbc53,0xd4e3,
-0xbfb7,0xbc54,0xbc55,0xbc56,0xbc57,0xbc58,0xbc59,0xbc5a,
-0xf4dd,0xbc5b,0xbc5c,0xbc5d,0xbc5e,0xbc5f,0xbc60,0xc5b4,
-0xbc61,0xbc62,0xbc63,0xbc64,0xbc65,0xbc66,0xbc67,0xbc68,
-0xf4e9,0xbc69,0xbc6a,0xcfb5,0xbc6b,0xbc6c,0xbc6d,0xbc6e,
-0xbc6f,0xbc70,0xbc71,0xbc72,0xbc73,0xbc74,0xbc75,0xbc76,
-0xbc77,0xbc78,0xcec9,0xbc79,0xbc7a,0xbc7b,0xbc7c,0xbc7d,
-0xbc7e,0xbc80,0xbc81,0xbc82,0xbc83,0xbc84,0xbc85,0xbc86,
-0xbc87,0xbc88,0xbc89,0xbc8a,0xbc8b,0xbc8c,0xbc8d,0xbc8e,
-0xcbd8,0xbc8f,0xcbf7,0xbc90,0xbc91,0xbc92,0xbc93,0xbdf4,
-0xbc94,0xbc95,0xbc96,0xd7cf,0xbc97,0xbc98,0xbc99,0xc0db,
-0xbc9a,0xbc9b,0xbc9c,0xbc9d,0xbc9e,0xbc9f,0xbca0,0xbd40,
-0xbd41,0xbd42,0xbd43,0xbd44,0xbd45,0xbd46,0xbd47,0xbd48,
-0xbd49,0xbd4a,0xbd4b,0xbd4c,0xbd4d,0xbd4e,0xbd4f,0xbd50,
-0xbd51,0xbd52,0xbd53,0xbd54,0xbd55,0xbd56,0xbd57,0xbd58,
-0xbd59,0xbd5a,0xbd5b,0xbd5c,0xbd5d,0xbd5e,0xbd5f,0xbd60,
-0xbd61,0xbd62,0xbd63,0xbd64,0xbd65,0xbd66,0xbd67,0xbd68,
-0xbd69,0xbd6a,0xbd6b,0xbd6c,0xbd6d,0xbd6e,0xbd6f,0xbd70,
-0xbd71,0xbd72,0xbd73,0xbd74,0xbd75,0xbd76,0xd0f5,0xbd77,
-0xbd78,0xbd79,0xbd7a,0xbd7b,0xbd7c,0xbd7d,0xbd7e,0xf4ea,
-0xbd80,0xbd81,0xbd82,0xbd83,0xbd84,0xbd85,0xbd86,0xbd87,
-0xbd88,0xbd89,0xbd8a,0xbd8b,0xbd8c,0xbd8d,0xbd8e,0xbd8f,
-0xbd90,0xbd91,0xbd92,0xbd93,0xbd94,0xbd95,0xbd96,0xbd97,
-0xbd98,0xbd99,0xbd9a,0xbd9b,0xbd9c,0xbd9d,0xbd9e,0xbd9f,
-0xbda0,0xbe40,0xbe41,0xbe42,0xbe43,0xbe44,0xbe45,0xbe46,
-0xbe47,0xbe48,0xbe49,0xbe4a,0xbe4b,0xbe4c,0xf4eb,0xbe4d,
-0xbe4e,0xbe4f,0xbe50,0xbe51,0xbe52,0xbe53,0xf4ec,0xbe54,
-0xbe55,0xbe56,0xbe57,0xbe58,0xbe59,0xbe5a,0xbe5b,0xbe5c,
-0xbe5d,0xbe5e,0xbe5f,0xbe60,0xbe61,0xbe62,0xbe63,0xbe64,
-0xbe65,0xbe66,0xbe67,0xbe68,0xbe69,0xbe6a,0xbe6b,0xbe6c,
-0xbe6d,0xbe6e,0xbe6f,0xbe70,0xbe71,0xbe72,0xbe73,0xbe74,
-0xbe75,0xbe76,0xbe77,0xbe78,0xbe79,0xbe7a,0xbe7b,0xbe7c,
-0xbe7d,0xbe7e,0xbe80,0xbe81,0xbe82,0xbe83,0xbe84,0xbe85,
-0xbe86,0xbe87,0xbe88,0xbe89,0xbe8a,0xbe8b,0xbe8c,0xbe8d,
-0xbe8e,0xbe8f,0xbe90,0xbe91,0xbe92,0xbe93,0xbe94,0xbe95,
-0xbe96,0xbe97,0xbe98,0xbe99,0xbe9a,0xbe9b,0xbe9c,0xbe9d,
-0xbe9e,0xbe9f,0xbea0,0xbf40,0xbf41,0xbf42,0xbf43,0xbf44,
-0xbf45,0xbf46,0xbf47,0xbf48,0xbf49,0xbf4a,0xbf4b,0xbf4c,
-0xbf4d,0xbf4e,0xbf4f,0xbf50,0xbf51,0xbf52,0xbf53,0xbf54,
-0xbf55,0xbf56,0xbf57,0xbf58,0xbf59,0xbf5a,0xbf5b,0xbf5c,
-0xbf5d,0xbf5e,0xbf5f,0xbf60,0xbf61,0xbf62,0xbf63,0xbf64,
-0xbf65,0xbf66,0xbf67,0xbf68,0xbf69,0xbf6a,0xbf6b,0xbf6c,
-0xbf6d,0xbf6e,0xbf6f,0xbf70,0xbf71,0xbf72,0xbf73,0xbf74,
-0xbf75,0xbf76,0xbf77,0xbf78,0xbf79,0xbf7a,0xbf7b,0xbf7c,
-0xbf7d,0xbf7e,0xbf80,0xf7e3,0xbf81,0xbf82,0xbf83,0xbf84,
-0xbf85,0xb7b1,0xbf86,0xbf87,0xbf88,0xbf89,0xbf8a,0xf4ed,
-0xbf8b,0xbf8c,0xbf8d,0xbf8e,0xbf8f,0xbf90,0xbf91,0xbf92,
-0xbf93,0xbf94,0xbf95,0xbf96,0xbf97,0xbf98,0xbf99,0xbf9a,
-0xbf9b,0xbf9c,0xbf9d,0xbf9e,0xbf9f,0xbfa0,0xc040,0xc041,
-0xc042,0xc043,0xc044,0xc045,0xc046,0xc047,0xc048,0xc049,
-0xc04a,0xc04b,0xc04c,0xc04d,0xc04e,0xc04f,0xc050,0xc051,
-0xc052,0xc053,0xc054,0xc055,0xc056,0xc057,0xc058,0xc059,
-0xc05a,0xc05b,0xc05c,0xc05d,0xc05e,0xc05f,0xc060,0xc061,
-0xc062,0xc063,0xd7eb,0xc064,0xc065,0xc066,0xc067,0xc068,
-0xc069,0xc06a,0xc06b,0xc06c,0xc06d,0xc06e,0xc06f,0xc070,
-0xc071,0xc072,0xc073,0xc074,0xc075,0xc076,0xc077,0xc078,
-0xc079,0xc07a,0xc07b,0xf4ee,0xc07c,0xc07d,0xc07e,0xe6f9,
-0xbec0,0xe6fa,0xbaec,0xe6fb,0xcfcb,0xe6fc,0xd4bc,0xbcb6,
-0xe6fd,0xe6fe,0xbccd,0xc8d2,0xceb3,0xe7a1,0xc080,0xb4bf,
-0xe7a2,0xc9b4,0xb8d9,0xc4c9,0xc081,0xd7dd,0xc2da,0xb7d7,
-0xd6bd,0xcec6,0xb7c4,0xc082,0xc083,0xc5a6,0xe7a3,0xcfdf,
-0xe7a4,0xe7a5,0xe7a6,0xc1b7,0xd7e9,0xc9f0,0xcfb8,0xd6af,
-0xd6d5,0xe7a7,0xb0ed,0xe7a8,0xe7a9,0xc9dc,0xd2ef,0xbead,
-0xe7aa,0xb0f3,0xc8de,0xbde1,0xe7ab,0xc8c6,0xc084,0xe7ac,
-0xbbe6,0xb8f8,0xd1a4,0xe7ad,0xc2e7,0xbef8,0xbdca,0xcdb3,
-0xe7ae,0xe7af,0xbeee,0xd0e5,0xc085,0xcbe7,0xccd0,0xbccc,
-0xe7b0,0xbca8,0xd0f7,0xe7b1,0xc086,0xd0f8,0xe7b2,0xe7b3,
-0xb4c2,0xe7b4,0xe7b5,0xc9fe,0xceac,0xc3e0,0xe7b7,0xb1c1,
-0xb3f1,0xc087,0xe7b8,0xe7b9,0xd7db,0xd5c0,0xe7ba,0xc2cc,
-0xd7ba,0xe7bb,0xe7bc,0xe7bd,0xbcea,0xc3e5,0xc0c2,0xe7be,
-0xe7bf,0xbca9,0xc088,0xe7c0,0xe7c1,0xe7b6,0xb6d0,0xe7c2,
-0xc089,0xe7c3,0xe7c4,0xbbba,0xb5de,0xc2c6,0xb1e0,0xe7c5,
-0xd4b5,0xe7c6,0xb8bf,0xe7c8,0xe7c7,0xb7ec,0xc08a,0xe7c9,
-0xb2f8,0xe7ca,0xe7cb,0xe7cc,0xe7cd,0xe7ce,0xe7cf,0xe7d0,
-0xd3a7,0xcbf5,0xe7d1,0xe7d2,0xe7d3,0xe7d4,0xc9c9,0xe7d5,
-0xe7d6,0xe7d7,0xe7d8,0xe7d9,0xbdc9,0xe7da,0xf3be,0xc08b,
-0xb8d7,0xc08c,0xc8b1,0xc08d,0xc08e,0xc08f,0xc090,0xc091,
-0xc092,0xc093,0xf3bf,0xc094,0xf3c0,0xf3c1,0xc095,0xc096,
-0xc097,0xc098,0xc099,0xc09a,0xc09b,0xc09c,0xc09d,0xc09e,
-0xb9de,0xcdf8,0xc09f,0xc0a0,0xd8e8,0xbab1,0xc140,0xc2de,
-0xeeb7,0xc141,0xb7a3,0xc142,0xc143,0xc144,0xc145,0xeeb9,
-0xc146,0xeeb8,0xb0d5,0xc147,0xc148,0xc149,0xc14a,0xc14b,
-0xeebb,0xd5d6,0xd7ef,0xc14c,0xc14d,0xc14e,0xd6c3,0xc14f,
-0xc150,0xeebd,0xcaf0,0xc151,0xeebc,0xc152,0xc153,0xc154,
-0xc155,0xeebe,0xc156,0xc157,0xc158,0xc159,0xeec0,0xc15a,
-0xc15b,0xeebf,0xc15c,0xc15d,0xc15e,0xc15f,0xc160,0xc161,
-0xc162,0xc163,0xd1f2,0xc164,0xc7bc,0xc165,0xc3c0,0xc166,
-0xc167,0xc168,0xc169,0xc16a,0xb8e1,0xc16b,0xc16c,0xc16d,
-0xc16e,0xc16f,0xc1e7,0xc170,0xc171,0xf4c6,0xd0df,0xf4c7,
-0xc172,0xcfdb,0xc173,0xc174,0xc8ba,0xc175,0xc176,0xf4c8,
-0xc177,0xc178,0xc179,0xc17a,0xc17b,0xc17c,0xc17d,0xf4c9,
-0xf4ca,0xc17e,0xf4cb,0xc180,0xc181,0xc182,0xc183,0xc184,
-0xd9fa,0xb8fe,0xc185,0xc186,0xe5f1,0xd3f0,0xc187,0xf4e0,
-0xc188,0xcecc,0xc189,0xc18a,0xc18b,0xb3e1,0xc18c,0xc18d,
-0xc18e,0xc18f,0xf1b4,0xc190,0xd2ee,0xc191,0xf4e1,0xc192,
-0xc193,0xc194,0xc195,0xc196,0xcfe8,0xf4e2,0xc197,0xc198,
-0xc7cc,0xc199,0xc19a,0xc19b,0xc19c,0xc19d,0xc19e,0xb5d4,
-0xb4e4,0xf4e4,0xc19f,0xc1a0,0xc240,0xf4e3,0xf4e5,0xc241,
-0xc242,0xf4e6,0xc243,0xc244,0xc245,0xc246,0xf4e7,0xc247,
-0xbab2,0xb0bf,0xc248,0xf4e8,0xc249,0xc24a,0xc24b,0xc24c,
-0xc24d,0xc24e,0xc24f,0xb7ad,0xd2ed,0xc250,0xc251,0xc252,
-0xd2ab,0xc0cf,0xc253,0xbfbc,0xeba3,0xd5df,0xeac8,0xc254,
-0xc255,0xc256,0xc257,0xf1f3,0xb6f8,0xcba3,0xc258,0xc259,
-0xc4cd,0xc25a,0xf1e7,0xc25b,0xf1e8,0xb8fb,0xf1e9,0xbac4,
-0xd4c5,0xb0d2,0xc25c,0xc25d,0xf1ea,0xc25e,0xc25f,0xc260,
-0xf1eb,0xc261,0xf1ec,0xc262,0xc263,0xf1ed,0xf1ee,0xf1ef,
-0xf1f1,0xf1f0,0xc5d5,0xc264,0xc265,0xc266,0xc267,0xc268,
-0xc269,0xf1f2,0xc26a,0xb6fa,0xc26b,0xf1f4,0xd2ae,0xdec7,
-0xcbca,0xc26c,0xc26d,0xb3dc,0xc26e,0xb5a2,0xc26f,0xb9a2,
-0xc270,0xc271,0xc4f4,0xf1f5,0xc272,0xc273,0xf1f6,0xc274,
-0xc275,0xc276,0xc1c4,0xc1fb,0xd6b0,0xf1f7,0xc277,0xc278,
-0xc279,0xc27a,0xf1f8,0xc27b,0xc1aa,0xc27c,0xc27d,0xc27e,
-0xc6b8,0xc280,0xbedb,0xc281,0xc282,0xc283,0xc284,0xc285,
-0xc286,0xc287,0xc288,0xc289,0xc28a,0xc28b,0xc28c,0xc28d,
-0xc28e,0xf1f9,0xb4cf,0xc28f,0xc290,0xc291,0xc292,0xc293,
-0xc294,0xf1fa,0xc295,0xc296,0xc297,0xc298,0xc299,0xc29a,
-0xc29b,0xc29c,0xc29d,0xc29e,0xc29f,0xc2a0,0xc340,0xedb2,
-0xedb1,0xc341,0xc342,0xcbe0,0xd2de,0xc343,0xcbc1,0xd5d8,
-0xc344,0xc8e2,0xc345,0xc0df,0xbca1,0xc346,0xc347,0xc348,
-0xc349,0xc34a,0xc34b,0xebc1,0xc34c,0xc34d,0xd0a4,0xc34e,
-0xd6e2,0xc34f,0xb6c7,0xb8d8,0xebc0,0xb8ce,0xc350,0xebbf,
-0xb3a6,0xb9c9,0xd6ab,0xc351,0xb7f4,0xb7ca,0xc352,0xc353,
-0xc354,0xbce7,0xb7be,0xebc6,0xc355,0xebc7,0xb0b9,0xbfcf,
-0xc356,0xebc5,0xd3fd,0xc357,0xebc8,0xc358,0xc359,0xebc9,
-0xc35a,0xc35b,0xb7ce,0xc35c,0xebc2,0xebc4,0xc9f6,0xd6d7,
-0xd5cd,0xd0b2,0xebcf,0xceb8,0xebd0,0xc35d,0xb5a8,0xc35e,
-0xc35f,0xc360,0xc361,0xc362,0xb1b3,0xebd2,0xcca5,0xc363,
-0xc364,0xc365,0xc366,0xc367,0xc368,0xc369,0xc5d6,0xebd3,
-0xc36a,0xebd1,0xc5df,0xebce,0xcaa4,0xebd5,0xb0fb,0xc36b,
-0xc36c,0xbafa,0xc36d,0xc36e,0xd8b7,0xf1e3,0xc36f,0xebca,
-0xebcb,0xebcc,0xebcd,0xebd6,0xe6c0,0xebd9,0xc370,0xbfe8,
-0xd2c8,0xebd7,0xebdc,0xb8ec,0xebd8,0xc371,0xbdba,0xc372,
-0xd0d8,0xc373,0xb0b7,0xc374,0xebdd,0xc4dc,0xc375,0xc376,
-0xc377,0xc378,0xd6ac,0xc379,0xc37a,0xc37b,0xb4e0,0xc37c,
-0xc37d,0xc2f6,0xbcb9,0xc37e,0xc380,0xebda,0xebdb,0xd4e0,
-0xc6ea,0xc4d4,0xebdf,0xc5a7,0xd9f5,0xc381,0xb2b1,0xc382,
-0xebe4,0xc383,0xbdc5,0xc384,0xc385,0xc386,0xebe2,0xc387,
-0xc388,0xc389,0xc38a,0xc38b,0xc38c,0xc38d,0xc38e,0xc38f,
-0xc390,0xc391,0xc392,0xc393,0xebe3,0xc394,0xc395,0xb8ac,
-0xc396,0xcdd1,0xebe5,0xc397,0xc398,0xc399,0xebe1,0xc39a,
-0xc1b3,0xc39b,0xc39c,0xc39d,0xc39e,0xc39f,0xc6a2,0xc3a0,
-0xc440,0xc441,0xc442,0xc443,0xc444,0xc445,0xccf3,0xc446,
-0xebe6,0xc447,0xc0b0,0xd2b8,0xebe7,0xc448,0xc449,0xc44a,
-0xb8af,0xb8ad,0xc44b,0xebe8,0xc7bb,0xcdf3,0xc44c,0xc44d,
-0xc44e,0xebea,0xebeb,0xc44f,0xc450,0xc451,0xc452,0xc453,
-0xebed,0xc454,0xc455,0xc456,0xc457,0xd0c8,0xc458,0xebf2,
-0xc459,0xebee,0xc45a,0xc45b,0xc45c,0xebf1,0xc8f9,0xc45d,
-0xd1fc,0xebec,0xc45e,0xc45f,0xebe9,0xc460,0xc461,0xc462,
-0xc463,0xb8b9,0xcfd9,0xc4e5,0xebef,0xebf0,0xccda,0xcdc8,
-0xb0f2,0xc464,0xebf6,0xc465,0xc466,0xc467,0xc468,0xc469,
-0xebf5,0xc46a,0xb2b2,0xc46b,0xc46c,0xc46d,0xc46e,0xb8e0,
-0xc46f,0xebf7,0xc470,0xc471,0xc472,0xc473,0xc474,0xc475,
-0xb1ec,0xc476,0xc477,0xccc5,0xc4a4,0xcfa5,0xc478,0xc479,
-0xc47a,0xc47b,0xc47c,0xebf9,0xc47d,0xc47e,0xeca2,0xc480,
-0xc5f2,0xc481,0xebfa,0xc482,0xc483,0xc484,0xc485,0xc486,
-0xc487,0xc488,0xc489,0xc9c5,0xc48a,0xc48b,0xc48c,0xc48d,
-0xc48e,0xc48f,0xe2df,0xebfe,0xc490,0xc491,0xc492,0xc493,
-0xcdce,0xeca1,0xb1db,0xd3b7,0xc494,0xc495,0xd2dc,0xc496,
-0xc497,0xc498,0xebfd,0xc499,0xebfb,0xc49a,0xc49b,0xc49c,
-0xc49d,0xc49e,0xc49f,0xc4a0,0xc540,0xc541,0xc542,0xc543,
-0xc544,0xc545,0xc546,0xc547,0xc548,0xc549,0xc54a,0xc54b,
-0xc54c,0xc54d,0xc54e,0xb3bc,0xc54f,0xc550,0xc551,0xeab0,
-0xc552,0xc553,0xd7d4,0xc554,0xf4ab,0xb3f4,0xc555,0xc556,
-0xc557,0xc558,0xc559,0xd6c1,0xd6c2,0xc55a,0xc55b,0xc55c,
-0xc55d,0xc55e,0xc55f,0xd5e9,0xbeca,0xc560,0xf4a7,0xc561,
-0xd2a8,0xf4a8,0xf4a9,0xc562,0xf4aa,0xbecb,0xd3df,0xc563,
-0xc564,0xc565,0xc566,0xc567,0xc9e0,0xc9e1,0xc568,0xc569,
-0xf3c2,0xc56a,0xcae6,0xc56b,0xccf2,0xc56c,0xc56d,0xc56e,
-0xc56f,0xc570,0xc571,0xe2b6,0xcbb4,0xc572,0xcee8,0xd6db,
-0xc573,0xf4ad,0xf4ae,0xf4af,0xc574,0xc575,0xc576,0xc577,
-0xf4b2,0xc578,0xbabd,0xf4b3,0xb0e3,0xf4b0,0xc579,0xf4b1,
-0xbda2,0xb2d5,0xc57a,0xf4b6,0xf4b7,0xb6e6,0xb2b0,0xcfcf,
-0xf4b4,0xb4ac,0xc57b,0xf4b5,0xc57c,0xc57d,0xf4b8,0xc57e,
-0xc580,0xc581,0xc582,0xc583,0xf4b9,0xc584,0xc585,0xcda7,
-0xc586,0xf4ba,0xc587,0xf4bb,0xc588,0xc589,0xc58a,0xf4bc,
-0xc58b,0xc58c,0xc58d,0xc58e,0xc58f,0xc590,0xc591,0xc592,
-0xcbd2,0xc593,0xf4bd,0xc594,0xc595,0xc596,0xc597,0xf4be,
-0xc598,0xc599,0xc59a,0xc59b,0xc59c,0xc59d,0xc59e,0xc59f,
-0xf4bf,0xc5a0,0xc640,0xc641,0xc642,0xc643,0xf4de,0xc1bc,
-0xbce8,0xc644,0xc9ab,0xd1de,0xe5f5,0xc645,0xc646,0xc647,
-0xc648,0xdcb3,0xd2d5,0xc649,0xc64a,0xdcb4,0xb0ac,0xdcb5,
-0xc64b,0xc64c,0xbdda,0xc64d,0xdcb9,0xc64e,0xc64f,0xc650,
-0xd8c2,0xc651,0xdcb7,0xd3f3,0xc652,0xc9d6,0xdcba,0xdcb6,
-0xc653,0xdcbb,0xc3a2,0xc654,0xc655,0xc656,0xc657,0xdcbc,
-0xdcc5,0xdcbd,0xc658,0xc659,0xcedf,0xd6a5,0xc65a,0xdccf,
-0xc65b,0xdccd,0xc65c,0xc65d,0xdcd2,0xbde6,0xc2ab,0xc65e,
-0xdcb8,0xdccb,0xdcce,0xdcbe,0xb7d2,0xb0c5,0xdcc7,0xd0be,
-0xdcc1,0xbba8,0xc65f,0xb7bc,0xdccc,0xc660,0xc661,0xdcc6,
-0xdcbf,0xc7db,0xc662,0xc663,0xc664,0xd1bf,0xdcc0,0xc665,
-0xc666,0xdcca,0xc667,0xc668,0xdcd0,0xc669,0xc66a,0xcead,
-0xdcc2,0xc66b,0xdcc3,0xdcc8,0xdcc9,0xb2d4,0xdcd1,0xcbd5,
-0xc66c,0xd4b7,0xdcdb,0xdcdf,0xcca6,0xdce6,0xc66d,0xc3e7,
-0xdcdc,0xc66e,0xc66f,0xbfc1,0xdcd9,0xc670,0xb0fa,0xb9b6,
-0xdce5,0xdcd3,0xc671,0xdcc4,0xdcd6,0xc8f4,0xbfe0,0xc672,
-0xc673,0xc674,0xc675,0xc9bb,0xc676,0xc677,0xc678,0xb1bd,
-0xc679,0xd3a2,0xc67a,0xc67b,0xdcda,0xc67c,0xc67d,0xdcd5,
-0xc67e,0xc6bb,0xc680,0xdcde,0xc681,0xc682,0xc683,0xc684,
-0xc685,0xd7c2,0xc3af,0xb7b6,0xc7d1,0xc3a9,0xdce2,0xdcd8,
-0xdceb,0xdcd4,0xc686,0xc687,0xdcdd,0xc688,0xbea5,0xdcd7,
-0xc689,0xdce0,0xc68a,0xc68b,0xdce3,0xdce4,0xc68c,0xdcf8,
-0xc68d,0xc68e,0xdce1,0xdda2,0xdce7,0xc68f,0xc690,0xc691,
-0xc692,0xc693,0xc694,0xc695,0xc696,0xc697,0xc698,0xbceb,
-0xb4c4,0xc699,0xc69a,0xc3a3,0xb2e7,0xdcfa,0xc69b,0xdcf2,
-0xc69c,0xdcef,0xc69d,0xdcfc,0xdcee,0xd2f0,0xb2e8,0xc69e,
-0xc8d7,0xc8e3,0xdcfb,0xc69f,0xdced,0xc6a0,0xc740,0xc741,
-0xdcf7,0xc742,0xc743,0xdcf5,0xc744,0xc745,0xbea3,0xdcf4,
-0xc746,0xb2dd,0xc747,0xc748,0xc749,0xc74a,0xc74b,0xdcf3,
-0xbcf6,0xdce8,0xbbc4,0xc74c,0xc0f3,0xc74d,0xc74e,0xc74f,
-0xc750,0xc751,0xbcd4,0xdce9,0xdcea,0xc752,0xdcf1,0xdcf6,
-0xdcf9,0xb5b4,0xc753,0xc8d9,0xbbe7,0xdcfe,0xdcfd,0xd3ab,
-0xdda1,0xdda3,0xdda5,0xd2f1,0xdda4,0xdda6,0xdda7,0xd2a9,
-0xc754,0xc755,0xc756,0xc757,0xc758,0xc759,0xc75a,0xbac9,
-0xdda9,0xc75b,0xc75c,0xddb6,0xddb1,0xddb4,0xc75d,0xc75e,
-0xc75f,0xc760,0xc761,0xc762,0xc763,0xddb0,0xc6ce,0xc764,
-0xc765,0xc0f2,0xc766,0xc767,0xc768,0xc769,0xc9af,0xc76a,
-0xc76b,0xc76c,0xdcec,0xddae,0xc76d,0xc76e,0xc76f,0xc770,
-0xddb7,0xc771,0xc772,0xdcf0,0xddaf,0xc773,0xddb8,0xc774,
-0xddac,0xc775,0xc776,0xc777,0xc778,0xc779,0xc77a,0xc77b,
-0xddb9,0xddb3,0xddad,0xc4aa,0xc77c,0xc77d,0xc77e,0xc780,
-0xdda8,0xc0b3,0xc1ab,0xddaa,0xddab,0xc781,0xddb2,0xbbf1,
-0xddb5,0xd3a8,0xddba,0xc782,0xddbb,0xc3a7,0xc783,0xc784,
-0xddd2,0xddbc,0xc785,0xc786,0xc787,0xddd1,0xc788,0xb9bd,
-0xc789,0xc78a,0xbed5,0xc78b,0xbefa,0xc78c,0xc78d,0xbaca,
-0xc78e,0xc78f,0xc790,0xc791,0xddca,0xc792,0xddc5,0xc793,
-0xddbf,0xc794,0xc795,0xc796,0xb2cb,0xddc3,0xc797,0xddcb,
-0xb2a4,0xddd5,0xc798,0xc799,0xc79a,0xddbe,0xc79b,0xc79c,
-0xc79d,0xc6d0,0xddd0,0xc79e,0xc79f,0xc7a0,0xc840,0xc841,
-0xddd4,0xc1e2,0xb7c6,0xc842,0xc843,0xc844,0xc845,0xc846,
-0xddce,0xddcf,0xc847,0xc848,0xc849,0xddc4,0xc84a,0xc84b,
-0xc84c,0xddbd,0xc84d,0xddcd,0xccd1,0xc84e,0xddc9,0xc84f,
-0xc850,0xc851,0xc852,0xddc2,0xc3c8,0xc6bc,0xceae,0xddcc,
-0xc853,0xddc8,0xc854,0xc855,0xc856,0xc857,0xc858,0xc859,
-0xddc1,0xc85a,0xc85b,0xc85c,0xddc6,0xc2dc,0xc85d,0xc85e,
-0xc85f,0xc860,0xc861,0xc862,0xd3a9,0xd3aa,0xddd3,0xcff4,
-0xc8f8,0xc863,0xc864,0xc865,0xc866,0xc867,0xc868,0xc869,
-0xc86a,0xdde6,0xc86b,0xc86c,0xc86d,0xc86e,0xc86f,0xc870,
-0xddc7,0xc871,0xc872,0xc873,0xdde0,0xc2e4,0xc874,0xc875,
-0xc876,0xc877,0xc878,0xc879,0xc87a,0xc87b,0xdde1,0xc87c,
-0xc87d,0xc87e,0xc880,0xc881,0xc882,0xc883,0xc884,0xc885,
-0xc886,0xddd7,0xc887,0xc888,0xc889,0xc88a,0xc88b,0xd6f8,
-0xc88c,0xddd9,0xddd8,0xb8f0,0xddd6,0xc88d,0xc88e,0xc88f,
-0xc890,0xc6cf,0xc891,0xb6ad,0xc892,0xc893,0xc894,0xc895,
-0xc896,0xdde2,0xc897,0xbaf9,0xd4e1,0xdde7,0xc898,0xc899,
-0xc89a,0xb4d0,0xc89b,0xddda,0xc89c,0xbffb,0xdde3,0xc89d,
-0xdddf,0xc89e,0xdddd,0xc89f,0xc8a0,0xc940,0xc941,0xc942,
-0xc943,0xc944,0xb5d9,0xc945,0xc946,0xc947,0xc948,0xdddb,
-0xdddc,0xddde,0xc949,0xbdaf,0xdde4,0xc94a,0xdde5,0xc94b,
-0xc94c,0xc94d,0xc94e,0xc94f,0xc950,0xc951,0xc952,0xddf5,
-0xc953,0xc3c9,0xc954,0xc955,0xcbe2,0xc956,0xc957,0xc958,
-0xc959,0xddf2,0xc95a,0xc95b,0xc95c,0xc95d,0xc95e,0xc95f,
-0xc960,0xc961,0xc962,0xc963,0xc964,0xc965,0xc966,0xd8e1,
-0xc967,0xc968,0xc6d1,0xc969,0xddf4,0xc96a,0xc96b,0xc96c,
-0xd5f4,0xddf3,0xddf0,0xc96d,0xc96e,0xddec,0xc96f,0xddef,
-0xc970,0xdde8,0xc971,0xc972,0xd0ee,0xc973,0xc974,0xc975,
-0xc976,0xc8d8,0xddee,0xc977,0xc978,0xdde9,0xc979,0xc97a,
-0xddea,0xcbf2,0xc97b,0xdded,0xc97c,0xc97d,0xb1cd,0xc97e,
-0xc980,0xc981,0xc982,0xc983,0xc984,0xc0b6,0xc985,0xbcbb,
-0xddf1,0xc986,0xc987,0xddf7,0xc988,0xddf6,0xddeb,0xc989,
-0xc98a,0xc98b,0xc98c,0xc98d,0xc5ee,0xc98e,0xc98f,0xc990,
-0xddfb,0xc991,0xc992,0xc993,0xc994,0xc995,0xc996,0xc997,
-0xc998,0xc999,0xc99a,0xc99b,0xdea4,0xc99c,0xc99d,0xdea3,
-0xc99e,0xc99f,0xc9a0,0xca40,0xca41,0xca42,0xca43,0xca44,
-0xca45,0xca46,0xca47,0xca48,0xddf8,0xca49,0xca4a,0xca4b,
-0xca4c,0xc3ef,0xca4d,0xc2fb,0xca4e,0xca4f,0xca50,0xd5e1,
-0xca51,0xca52,0xceb5,0xca53,0xca54,0xca55,0xca56,0xddfd,
-0xca57,0xb2cc,0xca58,0xca59,0xca5a,0xca5b,0xca5c,0xca5d,
-0xca5e,0xca5f,0xca60,0xc4e8,0xcadf,0xca61,0xca62,0xca63,
-0xca64,0xca65,0xca66,0xca67,0xca68,0xca69,0xca6a,0xc7be,
-0xddfa,0xddfc,0xddfe,0xdea2,0xb0aa,0xb1ce,0xca6b,0xca6c,
-0xca6d,0xca6e,0xca6f,0xdeac,0xca70,0xca71,0xca72,0xca73,
-0xdea6,0xbdb6,0xc8ef,0xca74,0xca75,0xca76,0xca77,0xca78,
-0xca79,0xca7a,0xca7b,0xca7c,0xca7d,0xca7e,0xdea1,0xca80,
-0xca81,0xdea5,0xca82,0xca83,0xca84,0xca85,0xdea9,0xca86,
-0xca87,0xca88,0xca89,0xca8a,0xdea8,0xca8b,0xca8c,0xca8d,
-0xdea7,0xca8e,0xca8f,0xca90,0xca91,0xca92,0xca93,0xca94,
-0xca95,0xca96,0xdead,0xca97,0xd4cc,0xca98,0xca99,0xca9a,
-0xca9b,0xdeb3,0xdeaa,0xdeae,0xca9c,0xca9d,0xc0d9,0xca9e,
-0xca9f,0xcaa0,0xcb40,0xcb41,0xb1a1,0xdeb6,0xcb42,0xdeb1,
-0xcb43,0xcb44,0xcb45,0xcb46,0xcb47,0xcb48,0xcb49,0xdeb2,
-0xcb4a,0xcb4b,0xcb4c,0xcb4d,0xcb4e,0xcb4f,0xcb50,0xcb51,
-0xcb52,0xcb53,0xcb54,0xd1a6,0xdeb5,0xcb55,0xcb56,0xcb57,
-0xcb58,0xcb59,0xcb5a,0xcb5b,0xdeaf,0xcb5c,0xcb5d,0xcb5e,
-0xdeb0,0xcb5f,0xd0bd,0xcb60,0xcb61,0xcb62,0xdeb4,0xcaed,
-0xdeb9,0xcb63,0xcb64,0xcb65,0xcb66,0xcb67,0xcb68,0xdeb8,
-0xcb69,0xdeb7,0xcb6a,0xcb6b,0xcb6c,0xcb6d,0xcb6e,0xcb6f,
-0xcb70,0xdebb,0xcb71,0xcb72,0xcb73,0xcb74,0xcb75,0xcb76,
-0xcb77,0xbde5,0xcb78,0xcb79,0xcb7a,0xcb7b,0xcb7c,0xb2d8,
-0xc3ea,0xcb7d,0xcb7e,0xdeba,0xcb80,0xc5ba,0xcb81,0xcb82,
-0xcb83,0xcb84,0xcb85,0xcb86,0xdebc,0xcb87,0xcb88,0xcb89,
-0xcb8a,0xcb8b,0xcb8c,0xcb8d,0xccd9,0xcb8e,0xcb8f,0xcb90,
-0xcb91,0xb7aa,0xcb92,0xcb93,0xcb94,0xcb95,0xcb96,0xcb97,
-0xcb98,0xcb99,0xcb9a,0xcb9b,0xcb9c,0xcb9d,0xcb9e,0xcb9f,
-0xcba0,0xcc40,0xcc41,0xd4e5,0xcc42,0xcc43,0xcc44,0xdebd,
-0xcc45,0xcc46,0xcc47,0xcc48,0xcc49,0xdebf,0xcc4a,0xcc4b,
-0xcc4c,0xcc4d,0xcc4e,0xcc4f,0xcc50,0xcc51,0xcc52,0xcc53,
-0xcc54,0xc4a2,0xcc55,0xcc56,0xcc57,0xcc58,0xdec1,0xcc59,
-0xcc5a,0xcc5b,0xcc5c,0xcc5d,0xcc5e,0xcc5f,0xcc60,0xcc61,
-0xcc62,0xcc63,0xcc64,0xcc65,0xcc66,0xcc67,0xcc68,0xdebe,
-0xcc69,0xdec0,0xcc6a,0xcc6b,0xcc6c,0xcc6d,0xcc6e,0xcc6f,
-0xcc70,0xcc71,0xcc72,0xcc73,0xcc74,0xcc75,0xcc76,0xcc77,
-0xd5ba,0xcc78,0xcc79,0xcc7a,0xdec2,0xcc7b,0xcc7c,0xcc7d,
-0xcc7e,0xcc80,0xcc81,0xcc82,0xcc83,0xcc84,0xcc85,0xcc86,
-0xcc87,0xcc88,0xcc89,0xcc8a,0xcc8b,0xf2ae,0xbba2,0xc2b2,
-0xc5b0,0xc2c7,0xcc8c,0xcc8d,0xf2af,0xcc8e,0xcc8f,0xcc90,
-0xcc91,0xcc92,0xd0e9,0xcc93,0xcc94,0xcc95,0xd3dd,0xcc96,
-0xcc97,0xcc98,0xebbd,0xcc99,0xcc9a,0xcc9b,0xcc9c,0xcc9d,
-0xcc9e,0xcc9f,0xcca0,0xb3e6,0xf2b0,0xcd40,0xf2b1,0xcd41,
-0xcd42,0xcaad,0xcd43,0xcd44,0xcd45,0xcd46,0xcd47,0xcd48,
-0xcd49,0xbae7,0xf2b3,0xf2b5,0xf2b4,0xcbe4,0xcfba,0xf2b2,
-0xcab4,0xd2cf,0xc2ec,0xcd4a,0xcd4b,0xcd4c,0xcd4d,0xcd4e,
-0xcd4f,0xcd50,0xcec3,0xf2b8,0xb0f6,0xf2b7,0xcd51,0xcd52,
-0xcd53,0xcd54,0xcd55,0xf2be,0xcd56,0xb2cf,0xcd57,0xcd58,
-0xcd59,0xcd5a,0xcd5b,0xcd5c,0xd1c1,0xf2ba,0xcd5d,0xcd5e,
-0xcd5f,0xcd60,0xcd61,0xf2bc,0xd4e9,0xcd62,0xcd63,0xf2bb,
-0xf2b6,0xf2bf,0xf2bd,0xcd64,0xf2b9,0xcd65,0xcd66,0xf2c7,
-0xf2c4,0xf2c6,0xcd67,0xcd68,0xf2ca,0xf2c2,0xf2c0,0xcd69,
-0xcd6a,0xcd6b,0xf2c5,0xcd6c,0xcd6d,0xcd6e,0xcd6f,0xcd70,
-0xd6fb,0xcd71,0xcd72,0xcd73,0xf2c1,0xcd74,0xc7f9,0xc9df,
-0xcd75,0xf2c8,0xb9c6,0xb5b0,0xcd76,0xcd77,0xf2c3,0xf2c9,
-0xf2d0,0xf2d6,0xcd78,0xcd79,0xbbd7,0xcd7a,0xcd7b,0xcd7c,
-0xf2d5,0xcddc,0xcd7d,0xd6eb,0xcd7e,0xcd80,0xf2d2,0xf2d4,
-0xcd81,0xcd82,0xcd83,0xcd84,0xb8f2,0xcd85,0xcd86,0xcd87,
-0xcd88,0xf2cb,0xcd89,0xcd8a,0xcd8b,0xf2ce,0xc2f9,0xcd8c,
-0xd5dd,0xf2cc,0xf2cd,0xf2cf,0xf2d3,0xcd8d,0xcd8e,0xcd8f,
-0xf2d9,0xd3bc,0xcd90,0xcd91,0xcd92,0xcd93,0xb6ea,0xcd94,
-0xcaf1,0xcd95,0xb7e4,0xf2d7,0xcd96,0xcd97,0xcd98,0xf2d8,
-0xf2da,0xf2dd,0xf2db,0xcd99,0xcd9a,0xf2dc,0xcd9b,0xcd9c,
-0xcd9d,0xcd9e,0xd1d1,0xf2d1,0xcd9f,0xcdc9,0xcda0,0xcecf,
-0xd6a9,0xce40,0xf2e3,0xce41,0xc3db,0xce42,0xf2e0,0xce43,
-0xce44,0xc0af,0xf2ec,0xf2de,0xce45,0xf2e1,0xce46,0xce47,
-0xce48,0xf2e8,0xce49,0xce4a,0xce4b,0xce4c,0xf2e2,0xce4d,
-0xce4e,0xf2e7,0xce4f,0xce50,0xf2e6,0xce51,0xce52,0xf2e9,
-0xce53,0xce54,0xce55,0xf2df,0xce56,0xce57,0xf2e4,0xf2ea,
-0xce58,0xce59,0xce5a,0xce5b,0xce5c,0xce5d,0xce5e,0xd3ac,
-0xf2e5,0xb2f5,0xce5f,0xce60,0xf2f2,0xce61,0xd0ab,0xce62,
-0xce63,0xce64,0xce65,0xf2f5,0xce66,0xce67,0xce68,0xbbc8,
-0xce69,0xf2f9,0xce6a,0xce6b,0xce6c,0xce6d,0xce6e,0xce6f,
-0xf2f0,0xce70,0xce71,0xf2f6,0xf2f8,0xf2fa,0xce72,0xce73,
-0xce74,0xce75,0xce76,0xce77,0xce78,0xce79,0xf2f3,0xce7a,
-0xf2f1,0xce7b,0xce7c,0xce7d,0xbafb,0xce7e,0xb5fb,0xce80,
-0xce81,0xce82,0xce83,0xf2ef,0xf2f7,0xf2ed,0xf2ee,0xce84,
-0xce85,0xce86,0xf2eb,0xf3a6,0xce87,0xf3a3,0xce88,0xce89,
-0xf3a2,0xce8a,0xce8b,0xf2f4,0xce8c,0xc8da,0xce8d,0xce8e,
-0xce8f,0xce90,0xce91,0xf2fb,0xce92,0xce93,0xce94,0xf3a5,
-0xce95,0xce96,0xce97,0xce98,0xce99,0xce9a,0xce9b,0xc3f8,
-0xce9c,0xce9d,0xce9e,0xce9f,0xcea0,0xcf40,0xcf41,0xcf42,
-0xf2fd,0xcf43,0xcf44,0xf3a7,0xf3a9,0xf3a4,0xcf45,0xf2fc,
-0xcf46,0xcf47,0xcf48,0xf3ab,0xcf49,0xf3aa,0xcf4a,0xcf4b,
-0xcf4c,0xcf4d,0xc2dd,0xcf4e,0xcf4f,0xf3ae,0xcf50,0xcf51,
-0xf3b0,0xcf52,0xcf53,0xcf54,0xcf55,0xcf56,0xf3a1,0xcf57,
-0xcf58,0xcf59,0xf3b1,0xf3ac,0xcf5a,0xcf5b,0xcf5c,0xcf5d,
-0xcf5e,0xf3af,0xf2fe,0xf3ad,0xcf5f,0xcf60,0xcf61,0xcf62,
-0xcf63,0xcf64,0xcf65,0xf3b2,0xcf66,0xcf67,0xcf68,0xcf69,
-0xf3b4,0xcf6a,0xcf6b,0xcf6c,0xcf6d,0xf3a8,0xcf6e,0xcf6f,
-0xcf70,0xcf71,0xf3b3,0xcf72,0xcf73,0xcf74,0xf3b5,0xcf75,
-0xcf76,0xcf77,0xcf78,0xcf79,0xcf7a,0xcf7b,0xcf7c,0xcf7d,
-0xcf7e,0xd0b7,0xcf80,0xcf81,0xcf82,0xcf83,0xf3b8,0xcf84,
-0xcf85,0xcf86,0xcf87,0xd9f9,0xcf88,0xcf89,0xcf8a,0xcf8b,
-0xcf8c,0xcf8d,0xf3b9,0xcf8e,0xcf8f,0xcf90,0xcf91,0xcf92,
-0xcf93,0xcf94,0xcf95,0xf3b7,0xcf96,0xc8e4,0xf3b6,0xcf97,
-0xcf98,0xcf99,0xcf9a,0xf3ba,0xcf9b,0xcf9c,0xcf9d,0xcf9e,
-0xcf9f,0xf3bb,0xb4c0,0xcfa0,0xd040,0xd041,0xd042,0xd043,
-0xd044,0xd045,0xd046,0xd047,0xd048,0xd049,0xd04a,0xd04b,
-0xd04c,0xd04d,0xeec3,0xd04e,0xd04f,0xd050,0xd051,0xd052,
-0xd053,0xf3bc,0xd054,0xd055,0xf3bd,0xd056,0xd057,0xd058,
-0xd1aa,0xd059,0xd05a,0xd05b,0xf4ac,0xd0c6,0xd05c,0xd05d,
-0xd05e,0xd05f,0xd060,0xd061,0xd0d0,0xd1dc,0xd062,0xd063,
-0xd064,0xd065,0xd066,0xd067,0xcfce,0xd068,0xd069,0xbdd6,
-0xd06a,0xd1c3,0xd06b,0xd06c,0xd06d,0xd06e,0xd06f,0xd070,
-0xd071,0xbae2,0xe1e9,0xd2c2,0xf1c2,0xb2b9,0xd072,0xd073,
-0xb1ed,0xf1c3,0xd074,0xc9c0,0xb3c4,0xd075,0xd9f2,0xd076,
-0xcba5,0xd077,0xf1c4,0xd078,0xd079,0xd07a,0xd07b,0xd6d4,
-0xd07c,0xd07d,0xd07e,0xd080,0xd081,0xf1c5,0xf4c0,0xf1c6,
-0xd082,0xd4ac,0xf1c7,0xd083,0xb0c0,0xf4c1,0xd084,0xd085,
-0xf4c2,0xd086,0xd087,0xb4fc,0xd088,0xc5db,0xd089,0xd08a,
-0xd08b,0xd08c,0xccbb,0xd08d,0xd08e,0xd08f,0xd0e4,0xd090,
-0xd091,0xd092,0xd093,0xd094,0xcde0,0xd095,0xd096,0xd097,
-0xd098,0xd099,0xf1c8,0xd09a,0xd9f3,0xd09b,0xd09c,0xd09d,
-0xd09e,0xd09f,0xd0a0,0xb1bb,0xd140,0xcfae,0xd141,0xd142,
-0xd143,0xb8a4,0xd144,0xd145,0xd146,0xd147,0xd148,0xf1ca,
-0xd149,0xd14a,0xd14b,0xd14c,0xf1cb,0xd14d,0xd14e,0xd14f,
-0xd150,0xb2c3,0xc1d1,0xd151,0xd152,0xd7b0,0xf1c9,0xd153,
-0xd154,0xf1cc,0xd155,0xd156,0xd157,0xd158,0xf1ce,0xd159,
-0xd15a,0xd15b,0xd9f6,0xd15c,0xd2e1,0xd4a3,0xd15d,0xd15e,
-0xf4c3,0xc8b9,0xd15f,0xd160,0xd161,0xd162,0xd163,0xf4c4,
-0xd164,0xd165,0xf1cd,0xf1cf,0xbfe3,0xf1d0,0xd166,0xd167,
-0xf1d4,0xd168,0xd169,0xd16a,0xd16b,0xd16c,0xd16d,0xd16e,
-0xf1d6,0xf1d1,0xd16f,0xc9d1,0xc5e1,0xd170,0xd171,0xd172,
-0xc2e3,0xb9fc,0xd173,0xd174,0xf1d3,0xd175,0xf1d5,0xd176,
-0xd177,0xd178,0xb9d3,0xd179,0xd17a,0xd17b,0xd17c,0xd17d,
-0xd17e,0xd180,0xf1db,0xd181,0xd182,0xd183,0xd184,0xd185,
-0xbad6,0xd186,0xb0fd,0xf1d9,0xd187,0xd188,0xd189,0xd18a,
-0xd18b,0xf1d8,0xf1d2,0xf1da,0xd18c,0xd18d,0xd18e,0xd18f,
-0xd190,0xf1d7,0xd191,0xd192,0xd193,0xc8ec,0xd194,0xd195,
-0xd196,0xd197,0xcdca,0xf1dd,0xd198,0xd199,0xd19a,0xd19b,
-0xe5bd,0xd19c,0xd19d,0xd19e,0xf1dc,0xd19f,0xf1de,0xd1a0,
-0xd240,0xd241,0xd242,0xd243,0xd244,0xd245,0xd246,0xd247,
-0xd248,0xf1df,0xd249,0xd24a,0xcfe5,0xd24b,0xd24c,0xd24d,
-0xd24e,0xd24f,0xd250,0xd251,0xd252,0xd253,0xd254,0xd255,
-0xd256,0xd257,0xd258,0xd259,0xd25a,0xd25b,0xd25c,0xd25d,
-0xd25e,0xd25f,0xd260,0xd261,0xd262,0xd263,0xf4c5,0xbdf3,
-0xd264,0xd265,0xd266,0xd267,0xd268,0xd269,0xf1e0,0xd26a,
-0xd26b,0xd26c,0xd26d,0xd26e,0xd26f,0xd270,0xd271,0xd272,
-0xd273,0xd274,0xd275,0xd276,0xd277,0xd278,0xd279,0xd27a,
-0xd27b,0xd27c,0xd27d,0xf1e1,0xd27e,0xd280,0xd281,0xcef7,
-0xd282,0xd2aa,0xd283,0xf1fb,0xd284,0xd285,0xb8b2,0xd286,
-0xd287,0xd288,0xd289,0xd28a,0xd28b,0xd28c,0xd28d,0xd28e,
-0xd28f,0xd290,0xd291,0xd292,0xd293,0xd294,0xd295,0xd296,
-0xd297,0xd298,0xd299,0xd29a,0xd29b,0xd29c,0xd29d,0xd29e,
-0xd29f,0xd2a0,0xd340,0xd341,0xd342,0xd343,0xd344,0xd345,
-0xd346,0xd347,0xd348,0xd349,0xd34a,0xd34b,0xd34c,0xd34d,
-0xd34e,0xd34f,0xd350,0xd351,0xd352,0xd353,0xd354,0xd355,
-0xd356,0xd357,0xd358,0xd359,0xd35a,0xd35b,0xd35c,0xd35d,
-0xd35e,0xbcfb,0xb9db,0xd35f,0xb9e6,0xc3d9,0xcad3,0xeae8,
-0xc0c0,0xbef5,0xeae9,0xeaea,0xeaeb,0xd360,0xeaec,0xeaed,
-0xeaee,0xeaef,0xbdc7,0xd361,0xd362,0xd363,0xf5fb,0xd364,
-0xd365,0xd366,0xf5fd,0xd367,0xf5fe,0xd368,0xf5fc,0xd369,
-0xd36a,0xd36b,0xd36c,0xbde2,0xd36d,0xf6a1,0xb4a5,0xd36e,
-0xd36f,0xd370,0xd371,0xf6a2,0xd372,0xd373,0xd374,0xf6a3,
-0xd375,0xd376,0xd377,0xecb2,0xd378,0xd379,0xd37a,0xd37b,
-0xd37c,0xd37d,0xd37e,0xd380,0xd381,0xd382,0xd383,0xd384,
-0xd1d4,0xd385,0xd386,0xd387,0xd388,0xd389,0xd38a,0xd9ea,
-0xd38b,0xd38c,0xd38d,0xd38e,0xd38f,0xd390,0xd391,0xd392,
-0xd393,0xd394,0xd395,0xd396,0xd397,0xd398,0xd399,0xd39a,
-0xd39b,0xd39c,0xd39d,0xd39e,0xd39f,0xd3a0,0xd440,0xd441,
-0xd442,0xd443,0xd444,0xd445,0xd446,0xd447,0xd448,0xd449,
-0xd44a,0xd44b,0xd44c,0xd44d,0xd44e,0xd44f,0xd450,0xd451,
-0xd452,0xd453,0xd454,0xd455,0xd456,0xd457,0xd458,0xd459,
-0xd45a,0xd45b,0xd45c,0xd45d,0xd45e,0xd45f,0xf6a4,0xd460,
-0xd461,0xd462,0xd463,0xd464,0xd465,0xd466,0xd467,0xd468,
-0xeeba,0xd469,0xd46a,0xd46b,0xd46c,0xd46d,0xd46e,0xd46f,
-0xd470,0xd471,0xd472,0xd473,0xd474,0xd475,0xd476,0xd477,
-0xd478,0xd479,0xd47a,0xd47b,0xd47c,0xd47d,0xd47e,0xd480,
-0xd481,0xd482,0xd483,0xd484,0xd485,0xd486,0xd487,0xd488,
-0xd489,0xd48a,0xd48b,0xd48c,0xd48d,0xd48e,0xd48f,0xd490,
-0xd491,0xd492,0xd493,0xd494,0xd495,0xd496,0xd497,0xd498,
-0xd499,0xd5b2,0xd49a,0xd49b,0xd49c,0xd49d,0xd49e,0xd49f,
-0xd4a0,0xd540,0xd541,0xd542,0xd543,0xd544,0xd545,0xd546,
-0xd547,0xd3fe,0xccdc,0xd548,0xd549,0xd54a,0xd54b,0xd54c,
-0xd54d,0xd54e,0xd54f,0xcac4,0xd550,0xd551,0xd552,0xd553,
-0xd554,0xd555,0xd556,0xd557,0xd558,0xd559,0xd55a,0xd55b,
-0xd55c,0xd55d,0xd55e,0xd55f,0xd560,0xd561,0xd562,0xd563,
-0xd564,0xd565,0xd566,0xd567,0xd568,0xd569,0xd56a,0xd56b,
-0xd56c,0xd56d,0xd56e,0xd56f,0xd570,0xd571,0xd572,0xd573,
-0xd574,0xd575,0xd576,0xd577,0xd578,0xd579,0xd57a,0xd57b,
-0xd57c,0xd57d,0xd57e,0xd580,0xd581,0xd582,0xd583,0xd584,
-0xd585,0xd586,0xd587,0xd588,0xd589,0xd58a,0xd58b,0xd58c,
-0xd58d,0xd58e,0xd58f,0xd590,0xd591,0xd592,0xd593,0xd594,
-0xd595,0xd596,0xd597,0xd598,0xd599,0xd59a,0xd59b,0xd59c,
-0xd59d,0xd59e,0xd59f,0xd5a0,0xd640,0xd641,0xd642,0xd643,
-0xd644,0xd645,0xd646,0xd647,0xd648,0xd649,0xd64a,0xd64b,
-0xd64c,0xd64d,0xd64e,0xd64f,0xd650,0xd651,0xd652,0xd653,
-0xd654,0xd655,0xd656,0xd657,0xd658,0xd659,0xd65a,0xd65b,
-0xd65c,0xd65d,0xd65e,0xd65f,0xd660,0xd661,0xd662,0xe5c0,
-0xd663,0xd664,0xd665,0xd666,0xd667,0xd668,0xd669,0xd66a,
-0xd66b,0xd66c,0xd66d,0xd66e,0xd66f,0xd670,0xd671,0xd672,
-0xd673,0xd674,0xd675,0xd676,0xd677,0xd678,0xd679,0xd67a,
-0xd67b,0xd67c,0xd67d,0xd67e,0xd680,0xd681,0xf6a5,0xd682,
-0xd683,0xd684,0xd685,0xd686,0xd687,0xd688,0xd689,0xd68a,
-0xd68b,0xd68c,0xd68d,0xd68e,0xd68f,0xd690,0xd691,0xd692,
-0xd693,0xd694,0xd695,0xd696,0xd697,0xd698,0xd699,0xd69a,
-0xd69b,0xd69c,0xd69d,0xd69e,0xd69f,0xd6a0,0xd740,0xd741,
-0xd742,0xd743,0xd744,0xd745,0xd746,0xd747,0xd748,0xd749,
-0xd74a,0xd74b,0xd74c,0xd74d,0xd74e,0xd74f,0xd750,0xd751,
-0xd752,0xd753,0xd754,0xd755,0xd756,0xd757,0xd758,0xd759,
-0xd75a,0xd75b,0xd75c,0xd75d,0xd75e,0xd75f,0xbeaf,0xd760,
-0xd761,0xd762,0xd763,0xd764,0xc6a9,0xd765,0xd766,0xd767,
-0xd768,0xd769,0xd76a,0xd76b,0xd76c,0xd76d,0xd76e,0xd76f,
-0xd770,0xd771,0xd772,0xd773,0xd774,0xd775,0xd776,0xd777,
-0xd778,0xd779,0xd77a,0xd77b,0xd77c,0xd77d,0xd77e,0xd780,
-0xd781,0xd782,0xd783,0xd784,0xd785,0xd786,0xd787,0xd788,
-0xd789,0xd78a,0xd78b,0xd78c,0xd78d,0xd78e,0xd78f,0xd790,
-0xd791,0xd792,0xd793,0xd794,0xd795,0xd796,0xd797,0xd798,
-0xdaa5,0xbcc6,0xb6a9,0xb8bc,0xc8cf,0xbca5,0xdaa6,0xdaa7,
-0xccd6,0xc8c3,0xdaa8,0xc6fd,0xd799,0xd1b5,0xd2e9,0xd1b6,
-0xbcc7,0xd79a,0xbdb2,0xbbe4,0xdaa9,0xdaaa,0xd1c8,0xdaab,
-0xd0ed,0xb6ef,0xc2db,0xd79b,0xcbcf,0xb7ed,0xc9e8,0xb7c3,
-0xbef7,0xd6a4,0xdaac,0xdaad,0xc6c0,0xd7e7,0xcab6,0xd79c,
-0xd5a9,0xcbdf,0xd5ef,0xdaae,0xd6df,0xb4ca,0xdab0,0xdaaf,
-0xd79d,0xd2eb,0xdab1,0xdab2,0xdab3,0xcad4,0xdab4,0xcaab,
-0xdab5,0xdab6,0xb3cf,0xd6ef,0xdab7,0xbbb0,0xb5ae,0xdab8,
-0xdab9,0xb9ee,0xd1af,0xd2e8,0xdaba,0xb8c3,0xcfea,0xb2ef,
-0xdabb,0xdabc,0xd79e,0xbdeb,0xcedc,0xd3ef,0xdabd,0xcef3,
-0xdabe,0xd3d5,0xbbe5,0xdabf,0xcbb5,0xcbd0,0xdac0,0xc7eb,
-0xd6ee,0xdac1,0xc5b5,0xb6c1,0xdac2,0xb7cc,0xbfce,0xdac3,
-0xdac4,0xcbad,0xdac5,0xb5f7,0xdac6,0xc1c2,0xd7bb,0xdac7,
-0xccb8,0xd79f,0xd2ea,0xc4b1,0xdac8,0xb5fd,0xbbd1,0xdac9,
-0xd0b3,0xdaca,0xdacb,0xcebd,0xdacc,0xdacd,0xdace,0xb2f7,
-0xdad1,0xdacf,0xd1e8,0xdad0,0xc3d5,0xdad2,0xd7a0,0xdad3,
-0xdad4,0xdad5,0xd0bb,0xd2a5,0xb0f9,0xdad6,0xc7ab,0xdad7,
-0xbdf7,0xc3a1,0xdad8,0xdad9,0xc3fd,0xccb7,0xdada,0xdadb,
-0xc0be,0xc6d7,0xdadc,0xdadd,0xc7b4,0xdade,0xdadf,0xb9c8,
-0xd840,0xd841,0xd842,0xd843,0xd844,0xd845,0xd846,0xd847,
-0xd848,0xbbed,0xd849,0xd84a,0xd84b,0xd84c,0xb6b9,0xf4f8,
-0xd84d,0xf4f9,0xd84e,0xd84f,0xcde3,0xd850,0xd851,0xd852,
-0xd853,0xd854,0xd855,0xd856,0xd857,0xf5b9,0xd858,0xd859,
-0xd85a,0xd85b,0xebe0,0xd85c,0xd85d,0xd85e,0xd85f,0xd860,
-0xd861,0xcff3,0xbbbf,0xd862,0xd863,0xd864,0xd865,0xd866,
-0xd867,0xd868,0xbac0,0xd4a5,0xd869,0xd86a,0xd86b,0xd86c,
-0xd86d,0xd86e,0xd86f,0xe1d9,0xd870,0xd871,0xd872,0xd873,
-0xf5f4,0xb1aa,0xb2f2,0xd874,0xd875,0xd876,0xd877,0xd878,
-0xd879,0xd87a,0xf5f5,0xd87b,0xd87c,0xf5f7,0xd87d,0xd87e,
-0xd880,0xbad1,0xf5f6,0xd881,0xc3b2,0xd882,0xd883,0xd884,
-0xd885,0xd886,0xd887,0xd888,0xf5f9,0xd889,0xd88a,0xd88b,
-0xf5f8,0xd88c,0xd88d,0xd88e,0xd88f,0xd890,0xd891,0xd892,
-0xd893,0xd894,0xd895,0xd896,0xd897,0xd898,0xd899,0xd89a,
-0xd89b,0xd89c,0xd89d,0xd89e,0xd89f,0xd8a0,0xd940,0xd941,
-0xd942,0xd943,0xd944,0xd945,0xd946,0xd947,0xd948,0xd949,
-0xd94a,0xd94b,0xd94c,0xd94d,0xd94e,0xd94f,0xd950,0xd951,
-0xd952,0xd953,0xd954,0xd955,0xd956,0xd957,0xd958,0xd959,
-0xd95a,0xd95b,0xd95c,0xd95d,0xd95e,0xd95f,0xd960,0xd961,
-0xd962,0xd963,0xd964,0xd965,0xd966,0xd967,0xd968,0xd969,
-0xd96a,0xd96b,0xd96c,0xd96d,0xd96e,0xd96f,0xd970,0xd971,
-0xd972,0xd973,0xd974,0xd975,0xd976,0xd977,0xd978,0xd979,
-0xd97a,0xd97b,0xd97c,0xd97d,0xd97e,0xd980,0xd981,0xd982,
-0xd983,0xd984,0xd985,0xd986,0xd987,0xd988,0xd989,0xd98a,
-0xd98b,0xd98c,0xd98d,0xd98e,0xd98f,0xd990,0xd991,0xd992,
-0xd993,0xd994,0xd995,0xd996,0xd997,0xd998,0xd999,0xd99a,
-0xd99b,0xd99c,0xd99d,0xd99e,0xd99f,0xd9a0,0xda40,0xda41,
-0xda42,0xda43,0xda44,0xda45,0xda46,0xda47,0xda48,0xda49,
-0xda4a,0xda4b,0xda4c,0xda4d,0xda4e,0xb1b4,0xd5ea,0xb8ba,
-0xda4f,0xb9b1,0xb2c6,0xd4f0,0xcfcd,0xb0dc,0xd5cb,0xbbf5,
-0xd6ca,0xb7b7,0xccb0,0xc6b6,0xb1e1,0xb9ba,0xd6fc,0xb9e1,
-0xb7a1,0xbcfa,0xeada,0xeadb,0xccf9,0xb9f3,0xeadc,0xb4fb,
-0xc3b3,0xb7d1,0xbad8,0xeadd,0xd4f4,0xeade,0xbcd6,0xbbdf,
-0xeadf,0xc1de,0xc2b8,0xd4df,0xd7ca,0xeae0,0xeae1,0xeae4,
-0xeae2,0xeae3,0xc9de,0xb8b3,0xb6c4,0xeae5,0xcaea,0xc9cd,
-0xb4cd,0xda50,0xda51,0xe2d9,0xc5e2,0xeae6,0xc0b5,0xda52,
-0xd7b8,0xeae7,0xd7ac,0xc8fc,0xd8d3,0xd8cd,0xd4de,0xda53,
-0xd4f9,0xc9c4,0xd3ae,0xb8d3,0xb3e0,0xda54,0xc9e2,0xf4f6,
-0xda55,0xda56,0xda57,0xbad5,0xda58,0xf4f7,0xda59,0xda5a,
-0xd7df,0xda5b,0xda5c,0xf4f1,0xb8b0,0xd5d4,0xb8cf,0xc6f0,
-0xda5d,0xda5e,0xda5f,0xda60,0xda61,0xda62,0xda63,0xda64,
-0xda65,0xb3c3,0xda66,0xda67,0xf4f2,0xb3ac,0xda68,0xda69,
-0xda6a,0xda6b,0xd4bd,0xc7f7,0xda6c,0xda6d,0xda6e,0xda6f,
-0xda70,0xf4f4,0xda71,0xda72,0xf4f3,0xda73,0xda74,0xda75,
-0xda76,0xda77,0xda78,0xda79,0xda7a,0xda7b,0xda7c,0xcccb,
-0xda7d,0xda7e,0xda80,0xc8a4,0xda81,0xda82,0xda83,0xda84,
-0xda85,0xda86,0xda87,0xda88,0xda89,0xda8a,0xda8b,0xda8c,
-0xda8d,0xf4f5,0xda8e,0xd7e3,0xc5bf,0xf5c0,0xda8f,0xda90,
-0xf5bb,0xda91,0xf5c3,0xda92,0xf5c2,0xda93,0xd6ba,0xf5c1,
-0xda94,0xda95,0xda96,0xd4be,0xf5c4,0xda97,0xf5cc,0xda98,
-0xda99,0xda9a,0xda9b,0xb0cf,0xb5f8,0xda9c,0xf5c9,0xf5ca,
-0xda9d,0xc5dc,0xda9e,0xda9f,0xdaa0,0xdb40,0xf5c5,0xf5c6,
-0xdb41,0xdb42,0xf5c7,0xf5cb,0xdb43,0xbee0,0xf5c8,0xb8fa,
-0xdb44,0xdb45,0xdb46,0xf5d0,0xf5d3,0xdb47,0xdb48,0xdb49,
-0xbfe7,0xdb4a,0xb9f2,0xf5bc,0xf5cd,0xdb4b,0xdb4c,0xc2b7,
-0xdb4d,0xdb4e,0xdb4f,0xccf8,0xdb50,0xbcf9,0xdb51,0xf5ce,
-0xf5cf,0xf5d1,0xb6e5,0xf5d2,0xdb52,0xf5d5,0xdb53,0xdb54,
-0xdb55,0xdb56,0xdb57,0xdb58,0xdb59,0xf5bd,0xdb5a,0xdb5b,
-0xdb5c,0xf5d4,0xd3bb,0xdb5d,0xb3ec,0xdb5e,0xdb5f,0xcca4,
-0xdb60,0xdb61,0xdb62,0xdb63,0xf5d6,0xdb64,0xdb65,0xdb66,
-0xdb67,0xdb68,0xdb69,0xdb6a,0xdb6b,0xf5d7,0xbee1,0xf5d8,
-0xdb6c,0xdb6d,0xccdf,0xf5db,0xdb6e,0xdb6f,0xdb70,0xdb71,
-0xdb72,0xb2c8,0xd7d9,0xdb73,0xf5d9,0xdb74,0xf5da,0xf5dc,
-0xdb75,0xf5e2,0xdb76,0xdb77,0xdb78,0xf5e0,0xdb79,0xdb7a,
-0xdb7b,0xf5df,0xf5dd,0xdb7c,0xdb7d,0xf5e1,0xdb7e,0xdb80,
-0xf5de,0xf5e4,0xf5e5,0xdb81,0xcce3,0xdb82,0xdb83,0xe5bf,
-0xb5b8,0xf5e3,0xf5e8,0xcca3,0xdb84,0xdb85,0xdb86,0xdb87,
-0xdb88,0xf5e6,0xf5e7,0xdb89,0xdb8a,0xdb8b,0xdb8c,0xdb8d,
-0xdb8e,0xf5be,0xdb8f,0xdb90,0xdb91,0xdb92,0xdb93,0xdb94,
-0xdb95,0xdb96,0xdb97,0xdb98,0xdb99,0xdb9a,0xb1c4,0xdb9b,
-0xdb9c,0xf5bf,0xdb9d,0xdb9e,0xb5c5,0xb2e4,0xdb9f,0xf5ec,
-0xf5e9,0xdba0,0xb6d7,0xdc40,0xf5ed,0xdc41,0xf5ea,0xdc42,
-0xdc43,0xdc44,0xdc45,0xdc46,0xf5eb,0xdc47,0xdc48,0xb4da,
-0xdc49,0xd4ea,0xdc4a,0xdc4b,0xdc4c,0xf5ee,0xdc4d,0xb3f9,
-0xdc4e,0xdc4f,0xdc50,0xdc51,0xdc52,0xdc53,0xdc54,0xf5ef,
-0xf5f1,0xdc55,0xdc56,0xdc57,0xf5f0,0xdc58,0xdc59,0xdc5a,
-0xdc5b,0xdc5c,0xdc5d,0xdc5e,0xf5f2,0xdc5f,0xf5f3,0xdc60,
-0xdc61,0xdc62,0xdc63,0xdc64,0xdc65,0xdc66,0xdc67,0xdc68,
-0xdc69,0xdc6a,0xdc6b,0xc9ed,0xb9aa,0xdc6c,0xdc6d,0xc7fb,
-0xdc6e,0xdc6f,0xb6e3,0xdc70,0xdc71,0xdc72,0xdc73,0xdc74,
-0xdc75,0xdc76,0xccc9,0xdc77,0xdc78,0xdc79,0xdc7a,0xdc7b,
-0xdc7c,0xdc7d,0xdc7e,0xdc80,0xdc81,0xdc82,0xdc83,0xdc84,
-0xdc85,0xdc86,0xdc87,0xdc88,0xdc89,0xdc8a,0xeaa6,0xdc8b,
-0xdc8c,0xdc8d,0xdc8e,0xdc8f,0xdc90,0xdc91,0xdc92,0xdc93,
-0xdc94,0xdc95,0xdc96,0xdc97,0xdc98,0xdc99,0xdc9a,0xdc9b,
-0xdc9c,0xdc9d,0xdc9e,0xdc9f,0xdca0,0xdd40,0xdd41,0xdd42,
-0xdd43,0xdd44,0xdd45,0xdd46,0xdd47,0xdd48,0xdd49,0xdd4a,
-0xdd4b,0xdd4c,0xdd4d,0xdd4e,0xdd4f,0xdd50,0xdd51,0xdd52,
-0xdd53,0xdd54,0xdd55,0xdd56,0xdd57,0xdd58,0xdd59,0xdd5a,
-0xdd5b,0xdd5c,0xdd5d,0xdd5e,0xdd5f,0xdd60,0xdd61,0xdd62,
-0xdd63,0xdd64,0xdd65,0xdd66,0xdd67,0xdd68,0xdd69,0xdd6a,
-0xdd6b,0xdd6c,0xdd6d,0xdd6e,0xdd6f,0xdd70,0xdd71,0xdd72,
-0xdd73,0xdd74,0xdd75,0xdd76,0xdd77,0xdd78,0xdd79,0xdd7a,
-0xdd7b,0xdd7c,0xdd7d,0xdd7e,0xdd80,0xdd81,0xdd82,0xdd83,
-0xdd84,0xdd85,0xdd86,0xdd87,0xdd88,0xdd89,0xdd8a,0xdd8b,
-0xdd8c,0xdd8d,0xdd8e,0xdd8f,0xdd90,0xdd91,0xdd92,0xdd93,
-0xdd94,0xdd95,0xdd96,0xdd97,0xdd98,0xdd99,0xdd9a,0xdd9b,
-0xdd9c,0xdd9d,0xdd9e,0xdd9f,0xdda0,0xde40,0xde41,0xde42,
-0xde43,0xde44,0xde45,0xde46,0xde47,0xde48,0xde49,0xde4a,
-0xde4b,0xde4c,0xde4d,0xde4e,0xde4f,0xde50,0xde51,0xde52,
-0xde53,0xde54,0xde55,0xde56,0xde57,0xde58,0xde59,0xde5a,
-0xde5b,0xde5c,0xde5d,0xde5e,0xde5f,0xde60,0xb3b5,0xd4fe,
-0xb9ec,0xd0f9,0xde61,0xe9ed,0xd7aa,0xe9ee,0xc2d6,0xc8ed,
-0xbae4,0xe9ef,0xe9f0,0xe9f1,0xd6e1,0xe9f2,0xe9f3,0xe9f5,
-0xe9f4,0xe9f6,0xe9f7,0xc7e1,0xe9f8,0xd4d8,0xe9f9,0xbdce,
-0xde62,0xe9fa,0xe9fb,0xbdcf,0xe9fc,0xb8a8,0xc1be,0xe9fd,
-0xb1b2,0xbbd4,0xb9f5,0xe9fe,0xde63,0xeaa1,0xeaa2,0xeaa3,
-0xb7f8,0xbcad,0xde64,0xcae4,0xe0ce,0xd4af,0xcfbd,0xd5b7,
-0xeaa4,0xd5de,0xeaa5,0xd0c1,0xb9bc,0xde65,0xb4c7,0xb1d9,
-0xde66,0xde67,0xde68,0xc0b1,0xde69,0xde6a,0xde6b,0xde6c,
-0xb1e6,0xb1e7,0xde6d,0xb1e8,0xde6e,0xde6f,0xde70,0xde71,
-0xb3bd,0xc8e8,0xde72,0xde73,0xde74,0xde75,0xe5c1,0xde76,
-0xde77,0xb1df,0xde78,0xde79,0xde7a,0xc1c9,0xb4ef,0xde7b,
-0xde7c,0xc7a8,0xd3d8,0xde7d,0xc6f9,0xd1b8,0xde7e,0xb9fd,
-0xc2f5,0xde80,0xde81,0xde82,0xde83,0xde84,0xd3ad,0xde85,
-0xd4cb,0xbdfc,0xde86,0xe5c2,0xb7b5,0xe5c3,0xde87,0xde88,
-0xbbb9,0xd5e2,0xde89,0xbdf8,0xd4b6,0xcea5,0xc1ac,0xb3d9,
-0xde8a,0xde8b,0xccf6,0xde8c,0xe5c6,0xe5c4,0xe5c8,0xde8d,
-0xe5ca,0xe5c7,0xb5cf,0xc6c8,0xde8e,0xb5fc,0xe5c5,0xde8f,
-0xcaf6,0xde90,0xde91,0xe5c9,0xde92,0xde93,0xde94,0xc3d4,
-0xb1c5,0xbca3,0xde95,0xde96,0xde97,0xd7b7,0xde98,0xde99,
-0xcdcb,0xcbcd,0xcaca,0xccd3,0xe5cc,0xe5cb,0xc4e6,0xde9a,
-0xde9b,0xd1a1,0xd1b7,0xe5cd,0xde9c,0xe5d0,0xde9d,0xcdb8,
-0xd6f0,0xe5cf,0xb5dd,0xde9e,0xcdbe,0xde9f,0xe5d1,0xb6ba,
-0xdea0,0xdf40,0xcda8,0xb9e4,0xdf41,0xcac5,0xb3d1,0xcbd9,
-0xd4ec,0xe5d2,0xb7ea,0xdf42,0xdf43,0xdf44,0xe5ce,0xdf45,
-0xdf46,0xdf47,0xdf48,0xdf49,0xdf4a,0xe5d5,0xb4fe,0xe5d6,
-0xdf4b,0xdf4c,0xdf4d,0xdf4e,0xdf4f,0xe5d3,0xe5d4,0xdf50,
-0xd2dd,0xdf51,0xdf52,0xc2df,0xb1c6,0xdf53,0xd3e2,0xdf54,
-0xdf55,0xb6dd,0xcbec,0xdf56,0xe5d7,0xdf57,0xdf58,0xd3f6,
-0xdf59,0xdf5a,0xdf5b,0xdf5c,0xdf5d,0xb1e9,0xdf5e,0xb6f4,
-0xe5da,0xe5d8,0xe5d9,0xb5c0,0xdf5f,0xdf60,0xdf61,0xd2c5,
-0xe5dc,0xdf62,0xdf63,0xe5de,0xdf64,0xdf65,0xdf66,0xdf67,
-0xdf68,0xdf69,0xe5dd,0xc7b2,0xdf6a,0xd2a3,0xdf6b,0xdf6c,
-0xe5db,0xdf6d,0xdf6e,0xdf6f,0xdf70,0xd4e2,0xd5da,0xdf71,
-0xdf72,0xdf73,0xdf74,0xdf75,0xe5e0,0xd7f1,0xdf76,0xdf77,
-0xdf78,0xdf79,0xdf7a,0xdf7b,0xdf7c,0xe5e1,0xdf7d,0xb1dc,
-0xd1fb,0xdf7e,0xe5e2,0xe5e4,0xdf80,0xdf81,0xdf82,0xdf83,
-0xe5e3,0xdf84,0xdf85,0xe5e5,0xdf86,0xdf87,0xdf88,0xdf89,
-0xdf8a,0xd2d8,0xdf8b,0xb5cb,0xdf8c,0xe7df,0xdf8d,0xdaf5,
-0xdf8e,0xdaf8,0xdf8f,0xdaf6,0xdf90,0xdaf7,0xdf91,0xdf92,
-0xdf93,0xdafa,0xd0cf,0xc4c7,0xdf94,0xdf95,0xb0ee,0xdf96,
-0xdf97,0xdf98,0xd0b0,0xdf99,0xdaf9,0xdf9a,0xd3ca,0xbaaa,
-0xdba2,0xc7f1,0xdf9b,0xdafc,0xdafb,0xc9db,0xdafd,0xdf9c,
-0xdba1,0xd7de,0xdafe,0xc1da,0xdf9d,0xdf9e,0xdba5,0xdf9f,
-0xdfa0,0xd3f4,0xe040,0xe041,0xdba7,0xdba4,0xe042,0xdba8,
-0xe043,0xe044,0xbdbc,0xe045,0xe046,0xe047,0xc0c9,0xdba3,
-0xdba6,0xd6a3,0xe048,0xdba9,0xe049,0xe04a,0xe04b,0xdbad,
-0xe04c,0xe04d,0xe04e,0xdbae,0xdbac,0xbac2,0xe04f,0xe050,
-0xe051,0xbfa4,0xdbab,0xe052,0xe053,0xe054,0xdbaa,0xd4c7,
-0xb2bf,0xe055,0xe056,0xdbaf,0xe057,0xb9f9,0xe058,0xdbb0,
-0xe059,0xe05a,0xe05b,0xe05c,0xb3bb,0xe05d,0xe05e,0xe05f,
-0xb5a6,0xe060,0xe061,0xe062,0xe063,0xb6bc,0xdbb1,0xe064,
-0xe065,0xe066,0xb6f5,0xe067,0xdbb2,0xe068,0xe069,0xe06a,
-0xe06b,0xe06c,0xe06d,0xe06e,0xe06f,0xe070,0xe071,0xe072,
-0xe073,0xe074,0xe075,0xe076,0xe077,0xe078,0xe079,0xe07a,
-0xe07b,0xb1c9,0xe07c,0xe07d,0xe07e,0xe080,0xdbb4,0xe081,
-0xe082,0xe083,0xdbb3,0xdbb5,0xe084,0xe085,0xe086,0xe087,
-0xe088,0xe089,0xe08a,0xe08b,0xe08c,0xe08d,0xe08e,0xdbb7,
-0xe08f,0xdbb6,0xe090,0xe091,0xe092,0xe093,0xe094,0xe095,
-0xe096,0xdbb8,0xe097,0xe098,0xe099,0xe09a,0xe09b,0xe09c,
-0xe09d,0xe09e,0xe09f,0xdbb9,0xe0a0,0xe140,0xdbba,0xe141,
-0xe142,0xd3cf,0xf4fa,0xc7f5,0xd7c3,0xc5e4,0xf4fc,0xf4fd,
-0xf4fb,0xe143,0xbec6,0xe144,0xe145,0xe146,0xe147,0xd0ef,
-0xe148,0xe149,0xb7d3,0xe14a,0xe14b,0xd4cd,0xccaa,0xe14c,
-0xe14d,0xf5a2,0xf5a1,0xbaa8,0xf4fe,0xcbd6,0xe14e,0xe14f,
-0xe150,0xf5a4,0xc0d2,0xe151,0xb3ea,0xe152,0xcdaa,0xf5a5,
-0xf5a3,0xbdb4,0xf5a8,0xe153,0xf5a9,0xbdcd,0xc3b8,0xbfe1,
-0xcbe1,0xf5aa,0xe154,0xe155,0xe156,0xf5a6,0xf5a7,0xc4f0,
-0xe157,0xe158,0xe159,0xe15a,0xe15b,0xf5ac,0xe15c,0xb4bc,
-0xe15d,0xd7ed,0xe15e,0xb4d7,0xf5ab,0xf5ae,0xe15f,0xe160,
-0xf5ad,0xf5af,0xd0d1,0xe161,0xe162,0xe163,0xe164,0xe165,
-0xe166,0xe167,0xc3d1,0xc8a9,0xe168,0xe169,0xe16a,0xe16b,
-0xe16c,0xe16d,0xf5b0,0xf5b1,0xe16e,0xe16f,0xe170,0xe171,
-0xe172,0xe173,0xf5b2,0xe174,0xe175,0xf5b3,0xf5b4,0xf5b5,
-0xe176,0xe177,0xe178,0xe179,0xf5b7,0xf5b6,0xe17a,0xe17b,
-0xe17c,0xe17d,0xf5b8,0xe17e,0xe180,0xe181,0xe182,0xe183,
-0xe184,0xe185,0xe186,0xe187,0xe188,0xe189,0xe18a,0xb2c9,
-0xe18b,0xd3d4,0xcacd,0xe18c,0xc0ef,0xd6d8,0xd2b0,0xc1bf,
-0xe18d,0xbdf0,0xe18e,0xe18f,0xe190,0xe191,0xe192,0xe193,
-0xe194,0xe195,0xe196,0xe197,0xb8aa,0xe198,0xe199,0xe19a,
-0xe19b,0xe19c,0xe19d,0xe19e,0xe19f,0xe1a0,0xe240,0xe241,
-0xe242,0xe243,0xe244,0xe245,0xe246,0xe247,0xe248,0xe249,
-0xe24a,0xe24b,0xe24c,0xe24d,0xe24e,0xe24f,0xe250,0xe251,
-0xe252,0xe253,0xe254,0xe255,0xe256,0xe257,0xe258,0xe259,
-0xe25a,0xe25b,0xe25c,0xe25d,0xe25e,0xe25f,0xe260,0xe261,
-0xe262,0xe263,0xe264,0xe265,0xe266,0xe267,0xe268,0xe269,
-0xe26a,0xe26b,0xe26c,0xe26d,0xe26e,0xe26f,0xe270,0xe271,
-0xe272,0xe273,0xe274,0xe275,0xe276,0xe277,0xe278,0xe279,
-0xe27a,0xe27b,0xe27c,0xe27d,0xe27e,0xe280,0xe281,0xe282,
-0xe283,0xe284,0xe285,0xe286,0xe287,0xe288,0xe289,0xe28a,
-0xe28b,0xe28c,0xe28d,0xe28e,0xe28f,0xe290,0xe291,0xe292,
-0xe293,0xe294,0xe295,0xe296,0xe297,0xe298,0xe299,0xe29a,
-0xe29b,0xe29c,0xe29d,0xe29e,0xe29f,0xe2a0,0xe340,0xe341,
-0xe342,0xe343,0xe344,0xe345,0xe346,0xe347,0xe348,0xe349,
-0xe34a,0xe34b,0xe34c,0xe34d,0xe34e,0xe34f,0xe350,0xe351,
-0xe352,0xe353,0xe354,0xe355,0xe356,0xe357,0xe358,0xe359,
-0xe35a,0xe35b,0xe35c,0xe35d,0xe35e,0xe35f,0xe360,0xe361,
-0xe362,0xe363,0xe364,0xe365,0xe366,0xe367,0xe368,0xe369,
-0xe36a,0xe36b,0xe36c,0xe36d,0xbcf8,0xe36e,0xe36f,0xe370,
-0xe371,0xe372,0xe373,0xe374,0xe375,0xe376,0xe377,0xe378,
-0xe379,0xe37a,0xe37b,0xe37c,0xe37d,0xe37e,0xe380,0xe381,
-0xe382,0xe383,0xe384,0xe385,0xe386,0xe387,0xf6c6,0xe388,
-0xe389,0xe38a,0xe38b,0xe38c,0xe38d,0xe38e,0xe38f,0xe390,
-0xe391,0xe392,0xe393,0xe394,0xe395,0xe396,0xe397,0xe398,
-0xe399,0xe39a,0xe39b,0xe39c,0xe39d,0xe39e,0xe39f,0xe3a0,
-0xe440,0xe441,0xe442,0xe443,0xe444,0xe445,0xf6c7,0xe446,
-0xe447,0xe448,0xe449,0xe44a,0xe44b,0xe44c,0xe44d,0xe44e,
-0xe44f,0xe450,0xe451,0xe452,0xe453,0xe454,0xe455,0xe456,
-0xe457,0xe458,0xe459,0xe45a,0xe45b,0xe45c,0xe45d,0xe45e,
-0xf6c8,0xe45f,0xe460,0xe461,0xe462,0xe463,0xe464,0xe465,
-0xe466,0xe467,0xe468,0xe469,0xe46a,0xe46b,0xe46c,0xe46d,
-0xe46e,0xe46f,0xe470,0xe471,0xe472,0xe473,0xe474,0xe475,
-0xe476,0xe477,0xe478,0xe479,0xe47a,0xe47b,0xe47c,0xe47d,
-0xe47e,0xe480,0xe481,0xe482,0xe483,0xe484,0xe485,0xe486,
-0xe487,0xe488,0xe489,0xe48a,0xe48b,0xe48c,0xe48d,0xe48e,
-0xe48f,0xe490,0xe491,0xe492,0xe493,0xe494,0xe495,0xe496,
-0xe497,0xe498,0xe499,0xe49a,0xe49b,0xe49c,0xe49d,0xe49e,
-0xe49f,0xe4a0,0xe540,0xe541,0xe542,0xe543,0xe544,0xe545,
-0xe546,0xe547,0xe548,0xe549,0xe54a,0xe54b,0xe54c,0xe54d,
-0xe54e,0xe54f,0xe550,0xe551,0xe552,0xe553,0xe554,0xe555,
-0xe556,0xe557,0xe558,0xe559,0xe55a,0xe55b,0xe55c,0xe55d,
-0xe55e,0xe55f,0xe560,0xe561,0xe562,0xe563,0xe564,0xe565,
-0xe566,0xe567,0xe568,0xe569,0xe56a,0xe56b,0xe56c,0xe56d,
-0xe56e,0xe56f,0xe570,0xe571,0xe572,0xe573,0xf6c9,0xe574,
-0xe575,0xe576,0xe577,0xe578,0xe579,0xe57a,0xe57b,0xe57c,
-0xe57d,0xe57e,0xe580,0xe581,0xe582,0xe583,0xe584,0xe585,
-0xe586,0xe587,0xe588,0xe589,0xe58a,0xe58b,0xe58c,0xe58d,
-0xe58e,0xe58f,0xe590,0xe591,0xe592,0xe593,0xe594,0xe595,
-0xe596,0xe597,0xe598,0xe599,0xe59a,0xe59b,0xe59c,0xe59d,
-0xe59e,0xe59f,0xf6ca,0xe5a0,0xe640,0xe641,0xe642,0xe643,
-0xe644,0xe645,0xe646,0xe647,0xe648,0xe649,0xe64a,0xe64b,
-0xe64c,0xe64d,0xe64e,0xe64f,0xe650,0xe651,0xe652,0xe653,
-0xe654,0xe655,0xe656,0xe657,0xe658,0xe659,0xe65a,0xe65b,
-0xe65c,0xe65d,0xe65e,0xe65f,0xe660,0xe661,0xe662,0xf6cc,
-0xe663,0xe664,0xe665,0xe666,0xe667,0xe668,0xe669,0xe66a,
-0xe66b,0xe66c,0xe66d,0xe66e,0xe66f,0xe670,0xe671,0xe672,
-0xe673,0xe674,0xe675,0xe676,0xe677,0xe678,0xe679,0xe67a,
-0xe67b,0xe67c,0xe67d,0xe67e,0xe680,0xe681,0xe682,0xe683,
-0xe684,0xe685,0xe686,0xe687,0xe688,0xe689,0xe68a,0xe68b,
-0xe68c,0xe68d,0xe68e,0xe68f,0xe690,0xe691,0xe692,0xe693,
-0xe694,0xe695,0xe696,0xe697,0xe698,0xe699,0xe69a,0xe69b,
-0xe69c,0xe69d,0xf6cb,0xe69e,0xe69f,0xe6a0,0xe740,0xe741,
-0xe742,0xe743,0xe744,0xe745,0xe746,0xe747,0xf7e9,0xe748,
-0xe749,0xe74a,0xe74b,0xe74c,0xe74d,0xe74e,0xe74f,0xe750,
-0xe751,0xe752,0xe753,0xe754,0xe755,0xe756,0xe757,0xe758,
-0xe759,0xe75a,0xe75b,0xe75c,0xe75d,0xe75e,0xe75f,0xe760,
-0xe761,0xe762,0xe763,0xe764,0xe765,0xe766,0xe767,0xe768,
-0xe769,0xe76a,0xe76b,0xe76c,0xe76d,0xe76e,0xe76f,0xe770,
-0xe771,0xe772,0xe773,0xe774,0xe775,0xe776,0xe777,0xe778,
-0xe779,0xe77a,0xe77b,0xe77c,0xe77d,0xe77e,0xe780,0xe781,
-0xe782,0xe783,0xe784,0xe785,0xe786,0xe787,0xe788,0xe789,
-0xe78a,0xe78b,0xe78c,0xe78d,0xe78e,0xe78f,0xe790,0xe791,
-0xe792,0xe793,0xe794,0xe795,0xe796,0xe797,0xe798,0xe799,
-0xe79a,0xe79b,0xe79c,0xe79d,0xe79e,0xe79f,0xe7a0,0xe840,
-0xe841,0xe842,0xe843,0xe844,0xe845,0xe846,0xe847,0xe848,
-0xe849,0xe84a,0xe84b,0xe84c,0xe84d,0xe84e,0xf6cd,0xe84f,
-0xe850,0xe851,0xe852,0xe853,0xe854,0xe855,0xe856,0xe857,
-0xe858,0xe859,0xe85a,0xe85b,0xe85c,0xe85d,0xe85e,0xe85f,
-0xe860,0xe861,0xe862,0xe863,0xe864,0xe865,0xe866,0xe867,
-0xe868,0xe869,0xe86a,0xe86b,0xe86c,0xe86d,0xe86e,0xe86f,
-0xe870,0xe871,0xe872,0xe873,0xe874,0xe875,0xe876,0xe877,
-0xe878,0xe879,0xe87a,0xf6ce,0xe87b,0xe87c,0xe87d,0xe87e,
-0xe880,0xe881,0xe882,0xe883,0xe884,0xe885,0xe886,0xe887,
-0xe888,0xe889,0xe88a,0xe88b,0xe88c,0xe88d,0xe88e,0xe88f,
-0xe890,0xe891,0xe892,0xe893,0xe894,0xeec4,0xeec5,0xeec6,
-0xd5eb,0xb6a4,0xeec8,0xeec7,0xeec9,0xeeca,0xc7a5,0xeecb,
-0xeecc,0xe895,0xb7b0,0xb5f6,0xeecd,0xeecf,0xe896,0xeece,
-0xe897,0xb8c6,0xeed0,0xeed1,0xeed2,0xb6db,0xb3ae,0xd6d3,
-0xc4c6,0xb1b5,0xb8d6,0xeed3,0xeed4,0xd4bf,0xc7d5,0xbefb,
-0xced9,0xb9b3,0xeed6,0xeed5,0xeed8,0xeed7,0xc5a5,0xeed9,
-0xeeda,0xc7ae,0xeedb,0xc7af,0xeedc,0xb2a7,0xeedd,0xeede,
-0xeedf,0xeee0,0xeee1,0xd7ea,0xeee2,0xeee3,0xbcd8,0xeee4,
-0xd3cb,0xccfa,0xb2ac,0xc1e5,0xeee5,0xc7a6,0xc3ad,0xe898,
-0xeee6,0xeee7,0xeee8,0xeee9,0xeeea,0xeeeb,0xeeec,0xe899,
-0xeeed,0xeeee,0xeeef,0xe89a,0xe89b,0xeef0,0xeef1,0xeef2,
-0xeef4,0xeef3,0xe89c,0xeef5,0xcdad,0xc2c1,0xeef6,0xeef7,
-0xeef8,0xd5a1,0xeef9,0xcfb3,0xeefa,0xeefb,0xe89d,0xeefc,
-0xeefd,0xefa1,0xeefe,0xefa2,0xb8f5,0xc3fa,0xefa3,0xefa4,
-0xbdc2,0xd2bf,0xb2f9,0xefa5,0xefa6,0xefa7,0xd2f8,0xefa8,
-0xd6fd,0xefa9,0xc6cc,0xe89e,0xefaa,0xefab,0xc1b4,0xefac,
-0xcffa,0xcbf8,0xefae,0xefad,0xb3fa,0xb9f8,0xefaf,0xefb0,
-0xd0e2,0xefb1,0xefb2,0xb7e6,0xd0bf,0xefb3,0xefb4,0xefb5,
-0xc8f1,0xcce0,0xefb6,0xefb7,0xefb8,0xefb9,0xefba,0xd5e0,
-0xefbb,0xb4ed,0xc3aa,0xefbc,0xe89f,0xefbd,0xefbe,0xefbf,
-0xe8a0,0xcefd,0xefc0,0xc2e0,0xb4b8,0xd7b6,0xbdf5,0xe940,
-0xcfc7,0xefc3,0xefc1,0xefc2,0xefc4,0xb6a7,0xbcfc,0xbee2,
-0xc3cc,0xefc5,0xefc6,0xe941,0xefc7,0xefcf,0xefc8,0xefc9,
-0xefca,0xc7c2,0xeff1,0xb6cd,0xefcb,0xe942,0xefcc,0xefcd,
-0xb6c6,0xc3be,0xefce,0xe943,0xefd0,0xefd1,0xefd2,0xd5f2,
-0xe944,0xefd3,0xc4f7,0xe945,0xefd4,0xc4f8,0xefd5,0xefd6,
-0xb8e4,0xb0f7,0xefd7,0xefd8,0xefd9,0xe946,0xefda,0xefdb,
-0xefdc,0xefdd,0xe947,0xefde,0xbeb5,0xefe1,0xefdf,0xefe0,
-0xe948,0xefe2,0xefe3,0xc1cd,0xefe4,0xefe5,0xefe6,0xefe7,
-0xefe8,0xefe9,0xefea,0xefeb,0xefec,0xc0d8,0xe949,0xefed,
-0xc1ad,0xefee,0xefef,0xeff0,0xe94a,0xe94b,0xcfe2,0xe94c,
-0xe94d,0xe94e,0xe94f,0xe950,0xe951,0xe952,0xe953,0xb3a4,
-0xe954,0xe955,0xe956,0xe957,0xe958,0xe959,0xe95a,0xe95b,
-0xe95c,0xe95d,0xe95e,0xe95f,0xe960,0xe961,0xe962,0xe963,
-0xe964,0xe965,0xe966,0xe967,0xe968,0xe969,0xe96a,0xe96b,
-0xe96c,0xe96d,0xe96e,0xe96f,0xe970,0xe971,0xe972,0xe973,
-0xe974,0xe975,0xe976,0xe977,0xe978,0xe979,0xe97a,0xe97b,
-0xe97c,0xe97d,0xe97e,0xe980,0xe981,0xe982,0xe983,0xe984,
-0xe985,0xe986,0xe987,0xe988,0xe989,0xe98a,0xe98b,0xe98c,
-0xe98d,0xe98e,0xe98f,0xe990,0xe991,0xe992,0xe993,0xe994,
-0xe995,0xe996,0xe997,0xe998,0xe999,0xe99a,0xe99b,0xe99c,
-0xe99d,0xe99e,0xe99f,0xe9a0,0xea40,0xea41,0xea42,0xea43,
-0xea44,0xea45,0xea46,0xea47,0xea48,0xea49,0xea4a,0xea4b,
-0xea4c,0xea4d,0xea4e,0xea4f,0xea50,0xea51,0xea52,0xea53,
-0xea54,0xea55,0xea56,0xea57,0xea58,0xea59,0xea5a,0xea5b,
-0xc3c5,0xe3c5,0xc9c1,0xe3c6,0xea5c,0xb1d5,0xceca,0xb4b3,
-0xc8f2,0xe3c7,0xcfd0,0xe3c8,0xbce4,0xe3c9,0xe3ca,0xc3c6,
-0xd5a2,0xc4d6,0xb9eb,0xcec5,0xe3cb,0xc3f6,0xe3cc,0xea5d,
-0xb7a7,0xb8f3,0xbad2,0xe3cd,0xe3ce,0xd4c4,0xe3cf,0xea5e,
-0xe3d0,0xd1cb,0xe3d1,0xe3d2,0xe3d3,0xe3d4,0xd1d6,0xe3d5,
-0xb2fb,0xc0bb,0xe3d6,0xea5f,0xc0ab,0xe3d7,0xe3d8,0xe3d9,
-0xea60,0xe3da,0xe3db,0xea61,0xb8b7,0xdae2,0xea62,0xb6d3,
-0xea63,0xdae4,0xdae3,0xea64,0xea65,0xea66,0xea67,0xea68,
-0xea69,0xea6a,0xdae6,0xea6b,0xea6c,0xea6d,0xc8ee,0xea6e,
-0xea6f,0xdae5,0xb7c0,0xd1f4,0xd2f5,0xd5f3,0xbdd7,0xea70,
-0xea71,0xea72,0xea73,0xd7e8,0xdae8,0xdae7,0xea74,0xb0a2,
-0xcdd3,0xea75,0xdae9,0xea76,0xb8bd,0xbcca,0xc2bd,0xc2a4,
-0xb3c2,0xdaea,0xea77,0xc2aa,0xc4b0,0xbdb5,0xea78,0xea79,
-0xcfde,0xea7a,0xea7b,0xea7c,0xdaeb,0xc9c2,0xea7d,0xea7e,
-0xea80,0xea81,0xea82,0xb1dd,0xea83,0xea84,0xea85,0xdaec,
-0xea86,0xb6b8,0xd4ba,0xea87,0xb3fd,0xea88,0xea89,0xdaed,
-0xd4c9,0xcfd5,0xc5e3,0xea8a,0xdaee,0xea8b,0xea8c,0xea8d,
-0xea8e,0xea8f,0xdaef,0xea90,0xdaf0,0xc1ea,0xccd5,0xcfdd,
-0xea91,0xea92,0xea93,0xea94,0xea95,0xea96,0xea97,0xea98,
-0xea99,0xea9a,0xea9b,0xea9c,0xea9d,0xd3e7,0xc2a1,0xea9e,
-0xdaf1,0xea9f,0xeaa0,0xcbe5,0xeb40,0xdaf2,0xeb41,0xcbe6,
-0xd2fe,0xeb42,0xeb43,0xeb44,0xb8f4,0xeb45,0xeb46,0xdaf3,
-0xb0af,0xcfb6,0xeb47,0xeb48,0xd5cf,0xeb49,0xeb4a,0xeb4b,
-0xeb4c,0xeb4d,0xeb4e,0xeb4f,0xeb50,0xeb51,0xeb52,0xcbed,
-0xeb53,0xeb54,0xeb55,0xeb56,0xeb57,0xeb58,0xeb59,0xeb5a,
-0xdaf4,0xeb5b,0xeb5c,0xe3c4,0xeb5d,0xeb5e,0xc1a5,0xeb5f,
-0xeb60,0xf6bf,0xeb61,0xeb62,0xf6c0,0xf6c1,0xc4d1,0xeb63,
-0xc8b8,0xd1e3,0xeb64,0xeb65,0xd0db,0xd1c5,0xbcaf,0xb9cd,
-0xeb66,0xeff4,0xeb67,0xeb68,0xb4c6,0xd3ba,0xf6c2,0xb3fb,
-0xeb69,0xeb6a,0xf6c3,0xeb6b,0xeb6c,0xb5f1,0xeb6d,0xeb6e,
-0xeb6f,0xeb70,0xeb71,0xeb72,0xeb73,0xeb74,0xeb75,0xeb76,
-0xf6c5,0xeb77,0xeb78,0xeb79,0xeb7a,0xeb7b,0xeb7c,0xeb7d,
-0xd3ea,0xf6a7,0xd1a9,0xeb7e,0xeb80,0xeb81,0xeb82,0xf6a9,
-0xeb83,0xeb84,0xeb85,0xf6a8,0xeb86,0xeb87,0xc1e3,0xc0d7,
-0xeb88,0xb1a2,0xeb89,0xeb8a,0xeb8b,0xeb8c,0xceed,0xeb8d,
-0xd0e8,0xf6ab,0xeb8e,0xeb8f,0xcff6,0xeb90,0xf6aa,0xd5f0,
-0xf6ac,0xc3b9,0xeb91,0xeb92,0xeb93,0xbbf4,0xf6ae,0xf6ad,
-0xeb94,0xeb95,0xeb96,0xc4de,0xeb97,0xeb98,0xc1d8,0xeb99,
-0xeb9a,0xeb9b,0xeb9c,0xeb9d,0xcbaa,0xeb9e,0xcfbc,0xeb9f,
-0xeba0,0xec40,0xec41,0xec42,0xec43,0xec44,0xec45,0xec46,
-0xec47,0xec48,0xf6af,0xec49,0xec4a,0xf6b0,0xec4b,0xec4c,
-0xf6b1,0xec4d,0xc2b6,0xec4e,0xec4f,0xec50,0xec51,0xec52,
-0xb0d4,0xc5f9,0xec53,0xec54,0xec55,0xec56,0xf6b2,0xec57,
-0xec58,0xec59,0xec5a,0xec5b,0xec5c,0xec5d,0xec5e,0xec5f,
-0xec60,0xec61,0xec62,0xec63,0xec64,0xec65,0xec66,0xec67,
-0xec68,0xec69,0xc7e0,0xf6a6,0xec6a,0xec6b,0xbeb8,0xec6c,
-0xec6d,0xbeb2,0xec6e,0xb5e5,0xec6f,0xec70,0xb7c7,0xec71,
-0xbfbf,0xc3d2,0xc3e6,0xec72,0xec73,0xd8cc,0xec74,0xec75,
-0xec76,0xb8ef,0xec77,0xec78,0xec79,0xec7a,0xec7b,0xec7c,
-0xec7d,0xec7e,0xec80,0xbdf9,0xd1a5,0xec81,0xb0d0,0xec82,
-0xec83,0xec84,0xec85,0xec86,0xf7b0,0xec87,0xec88,0xec89,
-0xec8a,0xec8b,0xec8c,0xec8d,0xec8e,0xf7b1,0xec8f,0xec90,
-0xec91,0xec92,0xec93,0xd0ac,0xec94,0xb0b0,0xec95,0xec96,
-0xec97,0xf7b2,0xf7b3,0xec98,0xf7b4,0xec99,0xec9a,0xec9b,
-0xc7ca,0xec9c,0xec9d,0xec9e,0xec9f,0xeca0,0xed40,0xed41,
-0xbecf,0xed42,0xed43,0xf7b7,0xed44,0xed45,0xed46,0xed47,
-0xed48,0xed49,0xed4a,0xf7b6,0xed4b,0xb1de,0xed4c,0xf7b5,
-0xed4d,0xed4e,0xf7b8,0xed4f,0xf7b9,0xed50,0xed51,0xed52,
-0xed53,0xed54,0xed55,0xed56,0xed57,0xed58,0xed59,0xed5a,
-0xed5b,0xed5c,0xed5d,0xed5e,0xed5f,0xed60,0xed61,0xed62,
-0xed63,0xed64,0xed65,0xed66,0xed67,0xed68,0xed69,0xed6a,
-0xed6b,0xed6c,0xed6d,0xed6e,0xed6f,0xed70,0xed71,0xed72,
-0xed73,0xed74,0xed75,0xed76,0xed77,0xed78,0xed79,0xed7a,
-0xed7b,0xed7c,0xed7d,0xed7e,0xed80,0xed81,0xcea4,0xc8cd,
-0xed82,0xbaab,0xe8b8,0xe8b9,0xe8ba,0xbec2,0xed83,0xed84,
-0xed85,0xed86,0xed87,0xd2f4,0xed88,0xd4cf,0xc9d8,0xed89,
-0xed8a,0xed8b,0xed8c,0xed8d,0xed8e,0xed8f,0xed90,0xed91,
-0xed92,0xed93,0xed94,0xed95,0xed96,0xed97,0xed98,0xed99,
-0xed9a,0xed9b,0xed9c,0xed9d,0xed9e,0xed9f,0xeda0,0xee40,
-0xee41,0xee42,0xee43,0xee44,0xee45,0xee46,0xee47,0xee48,
-0xee49,0xee4a,0xee4b,0xee4c,0xee4d,0xee4e,0xee4f,0xee50,
-0xee51,0xee52,0xee53,0xee54,0xee55,0xee56,0xee57,0xee58,
-0xee59,0xee5a,0xee5b,0xee5c,0xee5d,0xee5e,0xee5f,0xee60,
-0xee61,0xee62,0xee63,0xee64,0xee65,0xee66,0xee67,0xee68,
-0xee69,0xee6a,0xee6b,0xee6c,0xee6d,0xee6e,0xee6f,0xee70,
-0xee71,0xee72,0xee73,0xee74,0xee75,0xee76,0xee77,0xee78,
-0xee79,0xee7a,0xee7b,0xee7c,0xee7d,0xee7e,0xee80,0xee81,
-0xee82,0xee83,0xee84,0xee85,0xee86,0xee87,0xee88,0xee89,
-0xee8a,0xee8b,0xee8c,0xee8d,0xee8e,0xee8f,0xee90,0xee91,
-0xee92,0xee93,0xee94,0xee95,0xee96,0xee97,0xee98,0xee99,
-0xee9a,0xee9b,0xee9c,0xee9d,0xee9e,0xee9f,0xeea0,0xef40,
-0xef41,0xef42,0xef43,0xef44,0xef45,0xd2b3,0xb6a5,0xc7ea,
-0xf1fc,0xcfee,0xcbb3,0xd0eb,0xe7ef,0xcde7,0xb9cb,0xb6d9,
-0xf1fd,0xb0e4,0xcbcc,0xf1fe,0xd4a4,0xc2ad,0xc1ec,0xc6c4,
-0xbeb1,0xf2a1,0xbcd5,0xef46,0xf2a2,0xf2a3,0xef47,0xf2a4,
-0xd2c3,0xc6b5,0xef48,0xcdc7,0xf2a5,0xef49,0xd3b1,0xbfc5,
-0xcce2,0xef4a,0xf2a6,0xf2a7,0xd1d5,0xb6ee,0xf2a8,0xf2a9,
-0xb5df,0xf2aa,0xf2ab,0xef4b,0xb2fc,0xf2ac,0xf2ad,0xc8a7,
-0xef4c,0xef4d,0xef4e,0xef4f,0xef50,0xef51,0xef52,0xef53,
-0xef54,0xef55,0xef56,0xef57,0xef58,0xef59,0xef5a,0xef5b,
-0xef5c,0xef5d,0xef5e,0xef5f,0xef60,0xef61,0xef62,0xef63,
-0xef64,0xef65,0xef66,0xef67,0xef68,0xef69,0xef6a,0xef6b,
-0xef6c,0xef6d,0xef6e,0xef6f,0xef70,0xef71,0xb7e7,0xef72,
-0xef73,0xeca9,0xecaa,0xecab,0xef74,0xecac,0xef75,0xef76,
-0xc6ae,0xecad,0xecae,0xef77,0xef78,0xef79,0xb7c9,0xcab3,
-0xef7a,0xef7b,0xef7c,0xef7d,0xef7e,0xef80,0xef81,0xe2b8,
-0xf7cf,0xef82,0xef83,0xef84,0xef85,0xef86,0xef87,0xef88,
-0xef89,0xef8a,0xef8b,0xef8c,0xef8d,0xef8e,0xef8f,0xef90,
-0xef91,0xef92,0xef93,0xef94,0xef95,0xef96,0xef97,0xef98,
-0xef99,0xef9a,0xef9b,0xef9c,0xef9d,0xef9e,0xef9f,0xefa0,
-0xf040,0xf041,0xf042,0xf043,0xf044,0xf7d0,0xf045,0xf046,
-0xb2cd,0xf047,0xf048,0xf049,0xf04a,0xf04b,0xf04c,0xf04d,
-0xf04e,0xf04f,0xf050,0xf051,0xf052,0xf053,0xf054,0xf055,
-0xf056,0xf057,0xf058,0xf059,0xf05a,0xf05b,0xf05c,0xf05d,
-0xf05e,0xf05f,0xf060,0xf061,0xf062,0xf063,0xf7d1,0xf064,
-0xf065,0xf066,0xf067,0xf068,0xf069,0xf06a,0xf06b,0xf06c,
-0xf06d,0xf06e,0xf06f,0xf070,0xf071,0xf072,0xf073,0xf074,
-0xf075,0xf076,0xf077,0xf078,0xf079,0xf07a,0xf07b,0xf07c,
-0xf07d,0xf07e,0xf080,0xf081,0xf082,0xf083,0xf084,0xf085,
-0xf086,0xf087,0xf088,0xf089,0xf7d3,0xf7d2,0xf08a,0xf08b,
-0xf08c,0xf08d,0xf08e,0xf08f,0xf090,0xf091,0xf092,0xf093,
-0xf094,0xf095,0xf096,0xe2bb,0xf097,0xbca2,0xf098,0xe2bc,
-0xe2bd,0xe2be,0xe2bf,0xe2c0,0xe2c1,0xb7b9,0xd2fb,0xbda4,
-0xcace,0xb1a5,0xcbc7,0xf099,0xe2c2,0xb6fc,0xc8c4,0xe2c3,
-0xf09a,0xf09b,0xbdc8,0xf09c,0xb1fd,0xe2c4,0xf09d,0xb6f6,
-0xe2c5,0xc4d9,0xf09e,0xf09f,0xe2c6,0xcfda,0xb9dd,0xe2c7,
-0xc0a1,0xf0a0,0xe2c8,0xb2f6,0xf140,0xe2c9,0xf141,0xc1f3,
-0xe2ca,0xe2cb,0xc2f8,0xe2cc,0xe2cd,0xe2ce,0xcad7,0xd8b8,
-0xd9e5,0xcfe3,0xf142,0xf143,0xf144,0xf145,0xf146,0xf147,
-0xf148,0xf149,0xf14a,0xf14b,0xf14c,0xf0a5,0xf14d,0xf14e,
-0xdcb0,0xf14f,0xf150,0xf151,0xf152,0xf153,0xf154,0xf155,
-0xf156,0xf157,0xf158,0xf159,0xf15a,0xf15b,0xf15c,0xf15d,
-0xf15e,0xf15f,0xf160,0xf161,0xf162,0xf163,0xf164,0xf165,
-0xf166,0xf167,0xf168,0xf169,0xf16a,0xf16b,0xf16c,0xf16d,
-0xf16e,0xf16f,0xf170,0xf171,0xf172,0xf173,0xf174,0xf175,
-0xf176,0xf177,0xf178,0xf179,0xf17a,0xf17b,0xf17c,0xf17d,
-0xf17e,0xf180,0xf181,0xf182,0xf183,0xf184,0xf185,0xf186,
-0xf187,0xf188,0xf189,0xf18a,0xf18b,0xf18c,0xf18d,0xf18e,
-0xf18f,0xf190,0xf191,0xf192,0xf193,0xf194,0xf195,0xf196,
-0xf197,0xf198,0xf199,0xf19a,0xf19b,0xf19c,0xf19d,0xf19e,
-0xf19f,0xf1a0,0xf240,0xf241,0xf242,0xf243,0xf244,0xf245,
-0xf246,0xf247,0xf248,0xf249,0xf24a,0xf24b,0xf24c,0xf24d,
-0xf24e,0xf24f,0xf250,0xf251,0xf252,0xf253,0xf254,0xf255,
-0xf256,0xf257,0xf258,0xf259,0xf25a,0xf25b,0xf25c,0xf25d,
-0xf25e,0xf25f,0xf260,0xf261,0xf262,0xf263,0xf264,0xf265,
-0xf266,0xf267,0xf268,0xf269,0xf26a,0xf26b,0xf26c,0xf26d,
-0xf26e,0xf26f,0xf270,0xf271,0xf272,0xf273,0xf274,0xf275,
-0xf276,0xf277,0xf278,0xf279,0xf27a,0xf27b,0xf27c,0xf27d,
-0xf27e,0xf280,0xf281,0xf282,0xf283,0xf284,0xf285,0xf286,
-0xf287,0xf288,0xf289,0xf28a,0xf28b,0xf28c,0xf28d,0xf28e,
-0xf28f,0xf290,0xf291,0xf292,0xf293,0xf294,0xf295,0xf296,
-0xf297,0xf298,0xf299,0xf29a,0xf29b,0xf29c,0xf29d,0xf29e,
-0xf29f,0xf2a0,0xf340,0xf341,0xf342,0xf343,0xf344,0xf345,
-0xf346,0xf347,0xf348,0xf349,0xf34a,0xf34b,0xf34c,0xf34d,
-0xf34e,0xf34f,0xf350,0xf351,0xc2ed,0xd4a6,0xcdd4,0xd1b1,
-0xb3db,0xc7fd,0xf352,0xb2b5,0xc2bf,0xe6e0,0xcabb,0xe6e1,
-0xe6e2,0xbed4,0xe6e3,0xd7a4,0xcdd5,0xe6e5,0xbcdd,0xe6e4,
-0xe6e6,0xe6e7,0xc2ee,0xf353,0xbdbe,0xe6e8,0xc2e6,0xbaa7,
-0xe6e9,0xf354,0xe6ea,0xb3d2,0xd1e9,0xf355,0xf356,0xbfa5,
-0xe6eb,0xc6ef,0xe6ec,0xe6ed,0xf357,0xf358,0xe6ee,0xc6ad,
-0xe6ef,0xf359,0xc9a7,0xe6f0,0xe6f1,0xe6f2,0xe5b9,0xe6f3,
-0xe6f4,0xc2e2,0xe6f5,0xe6f6,0xd6e8,0xe6f7,0xf35a,0xe6f8,
-0xb9c7,0xf35b,0xf35c,0xf35d,0xf35e,0xf35f,0xf360,0xf361,
-0xf7bb,0xf7ba,0xf362,0xf363,0xf364,0xf365,0xf7be,0xf7bc,
-0xbaa1,0xf366,0xf7bf,0xf367,0xf7c0,0xf368,0xf369,0xf36a,
-0xf7c2,0xf7c1,0xf7c4,0xf36b,0xf36c,0xf7c3,0xf36d,0xf36e,
-0xf36f,0xf370,0xf371,0xf7c5,0xf7c6,0xf372,0xf373,0xf374,
-0xf375,0xf7c7,0xf376,0xcbe8,0xf377,0xf378,0xf379,0xf37a,
-0xb8df,0xf37b,0xf37c,0xf37d,0xf37e,0xf380,0xf381,0xf7d4,
-0xf382,0xf7d5,0xf383,0xf384,0xf385,0xf386,0xf7d6,0xf387,
-0xf388,0xf389,0xf38a,0xf7d8,0xf38b,0xf7da,0xf38c,0xf7d7,
-0xf38d,0xf38e,0xf38f,0xf390,0xf391,0xf392,0xf393,0xf394,
-0xf395,0xf7db,0xf396,0xf7d9,0xf397,0xf398,0xf399,0xf39a,
-0xf39b,0xf39c,0xf39d,0xd7d7,0xf39e,0xf39f,0xf3a0,0xf440,
-0xf7dc,0xf441,0xf442,0xf443,0xf444,0xf445,0xf446,0xf7dd,
-0xf447,0xf448,0xf449,0xf7de,0xf44a,0xf44b,0xf44c,0xf44d,
-0xf44e,0xf44f,0xf450,0xf451,0xf452,0xf453,0xf454,0xf7df,
-0xf455,0xf456,0xf457,0xf7e0,0xf458,0xf459,0xf45a,0xf45b,
-0xf45c,0xf45d,0xf45e,0xf45f,0xf460,0xf461,0xf462,0xdbcb,
-0xf463,0xf464,0xd8aa,0xf465,0xf466,0xf467,0xf468,0xf469,
-0xf46a,0xf46b,0xf46c,0xe5f7,0xb9ed,0xf46d,0xf46e,0xf46f,
-0xf470,0xbffd,0xbbea,0xf7c9,0xc6c7,0xf7c8,0xf471,0xf7ca,
-0xf7cc,0xf7cb,0xf472,0xf473,0xf474,0xf7cd,0xf475,0xceba,
-0xf476,0xf7ce,0xf477,0xf478,0xc4a7,0xf479,0xf47a,0xf47b,
-0xf47c,0xf47d,0xf47e,0xf480,0xf481,0xf482,0xf483,0xf484,
-0xf485,0xf486,0xf487,0xf488,0xf489,0xf48a,0xf48b,0xf48c,
-0xf48d,0xf48e,0xf48f,0xf490,0xf491,0xf492,0xf493,0xf494,
-0xf495,0xf496,0xf497,0xf498,0xf499,0xf49a,0xf49b,0xf49c,
-0xf49d,0xf49e,0xf49f,0xf4a0,0xf540,0xf541,0xf542,0xf543,
-0xf544,0xf545,0xf546,0xf547,0xf548,0xf549,0xf54a,0xf54b,
-0xf54c,0xf54d,0xf54e,0xf54f,0xf550,0xf551,0xf552,0xf553,
-0xf554,0xf555,0xf556,0xf557,0xf558,0xf559,0xf55a,0xf55b,
-0xf55c,0xf55d,0xf55e,0xf55f,0xf560,0xf561,0xf562,0xf563,
-0xf564,0xf565,0xf566,0xf567,0xf568,0xf569,0xf56a,0xf56b,
-0xf56c,0xf56d,0xf56e,0xf56f,0xf570,0xf571,0xf572,0xf573,
-0xf574,0xf575,0xf576,0xf577,0xf578,0xf579,0xf57a,0xf57b,
-0xf57c,0xf57d,0xf57e,0xf580,0xf581,0xf582,0xf583,0xf584,
-0xf585,0xf586,0xf587,0xf588,0xf589,0xf58a,0xf58b,0xf58c,
-0xf58d,0xf58e,0xf58f,0xf590,0xf591,0xf592,0xf593,0xf594,
-0xf595,0xf596,0xf597,0xf598,0xf599,0xf59a,0xf59b,0xf59c,
-0xf59d,0xf59e,0xf59f,0xf5a0,0xf640,0xf641,0xf642,0xf643,
-0xf644,0xf645,0xf646,0xf647,0xf648,0xf649,0xf64a,0xf64b,
-0xf64c,0xf64d,0xf64e,0xf64f,0xf650,0xf651,0xf652,0xf653,
-0xf654,0xf655,0xf656,0xf657,0xf658,0xf659,0xf65a,0xf65b,
-0xf65c,0xf65d,0xf65e,0xf65f,0xf660,0xf661,0xf662,0xf663,
-0xf664,0xf665,0xf666,0xf667,0xf668,0xf669,0xf66a,0xf66b,
-0xf66c,0xf66d,0xf66e,0xf66f,0xf670,0xf671,0xf672,0xf673,
-0xf674,0xf675,0xf676,0xf677,0xf678,0xf679,0xf67a,0xf67b,
-0xf67c,0xf67d,0xf67e,0xf680,0xf681,0xf682,0xf683,0xf684,
-0xf685,0xf686,0xf687,0xf688,0xf689,0xf68a,0xf68b,0xf68c,
-0xf68d,0xf68e,0xf68f,0xf690,0xf691,0xf692,0xf693,0xf694,
-0xf695,0xf696,0xf697,0xf698,0xf699,0xf69a,0xf69b,0xf69c,
-0xf69d,0xf69e,0xf69f,0xf6a0,0xf740,0xf741,0xf742,0xf743,
-0xf744,0xf745,0xf746,0xf747,0xf748,0xf749,0xf74a,0xf74b,
-0xf74c,0xf74d,0xf74e,0xf74f,0xf750,0xf751,0xf752,0xf753,
-0xf754,0xf755,0xf756,0xf757,0xf758,0xf759,0xf75a,0xf75b,
-0xf75c,0xf75d,0xf75e,0xf75f,0xf760,0xf761,0xf762,0xf763,
-0xf764,0xf765,0xf766,0xf767,0xf768,0xf769,0xf76a,0xf76b,
-0xf76c,0xf76d,0xf76e,0xf76f,0xf770,0xf771,0xf772,0xf773,
-0xf774,0xf775,0xf776,0xf777,0xf778,0xf779,0xf77a,0xf77b,
-0xf77c,0xf77d,0xf77e,0xf780,0xd3e3,0xf781,0xf782,0xf6cf,
-0xf783,0xc2b3,0xf6d0,0xf784,0xf785,0xf6d1,0xf6d2,0xf6d3,
-0xf6d4,0xf786,0xf787,0xf6d6,0xf788,0xb1ab,0xf6d7,0xf789,
-0xf6d8,0xf6d9,0xf6da,0xf78a,0xf6db,0xf6dc,0xf78b,0xf78c,
-0xf78d,0xf78e,0xf6dd,0xf6de,0xcfca,0xf78f,0xf6df,0xf6e0,
-0xf6e1,0xf6e2,0xf6e3,0xf6e4,0xc0f0,0xf6e5,0xf6e6,0xf6e7,
-0xf6e8,0xf6e9,0xf790,0xf6ea,0xf791,0xf6eb,0xf6ec,0xf792,
-0xf6ed,0xf6ee,0xf6ef,0xf6f0,0xf6f1,0xf6f2,0xf6f3,0xf6f4,
-0xbea8,0xf793,0xf6f5,0xf6f6,0xf6f7,0xf6f8,0xf794,0xf795,
-0xf796,0xf797,0xf798,0xc8fa,0xf6f9,0xf6fa,0xf6fb,0xf6fc,
-0xf799,0xf79a,0xf6fd,0xf6fe,0xf7a1,0xf7a2,0xf7a3,0xf7a4,
-0xf7a5,0xf79b,0xf79c,0xf7a6,0xf7a7,0xf7a8,0xb1ee,0xf7a9,
-0xf7aa,0xf7ab,0xf79d,0xf79e,0xf7ac,0xf7ad,0xc1db,0xf7ae,
-0xf79f,0xf7a0,0xf7af,0xf840,0xf841,0xf842,0xf843,0xf844,
-0xf845,0xf846,0xf847,0xf848,0xf849,0xf84a,0xf84b,0xf84c,
-0xf84d,0xf84e,0xf84f,0xf850,0xf851,0xf852,0xf853,0xf854,
-0xf855,0xf856,0xf857,0xf858,0xf859,0xf85a,0xf85b,0xf85c,
-0xf85d,0xf85e,0xf85f,0xf860,0xf861,0xf862,0xf863,0xf864,
-0xf865,0xf866,0xf867,0xf868,0xf869,0xf86a,0xf86b,0xf86c,
-0xf86d,0xf86e,0xf86f,0xf870,0xf871,0xf872,0xf873,0xf874,
-0xf875,0xf876,0xf877,0xf878,0xf879,0xf87a,0xf87b,0xf87c,
-0xf87d,0xf87e,0xf880,0xf881,0xf882,0xf883,0xf884,0xf885,
-0xf886,0xf887,0xf888,0xf889,0xf88a,0xf88b,0xf88c,0xf88d,
-0xf88e,0xf88f,0xf890,0xf891,0xf892,0xf893,0xf894,0xf895,
-0xf896,0xf897,0xf898,0xf899,0xf89a,0xf89b,0xf89c,0xf89d,
-0xf89e,0xf89f,0xf8a0,0xf940,0xf941,0xf942,0xf943,0xf944,
-0xf945,0xf946,0xf947,0xf948,0xf949,0xf94a,0xf94b,0xf94c,
-0xf94d,0xf94e,0xf94f,0xf950,0xf951,0xf952,0xf953,0xf954,
-0xf955,0xf956,0xf957,0xf958,0xf959,0xf95a,0xf95b,0xf95c,
-0xf95d,0xf95e,0xf95f,0xf960,0xf961,0xf962,0xf963,0xf964,
-0xf965,0xf966,0xf967,0xf968,0xf969,0xf96a,0xf96b,0xf96c,
-0xf96d,0xf96e,0xf96f,0xf970,0xf971,0xf972,0xf973,0xf974,
-0xf975,0xf976,0xf977,0xf978,0xf979,0xf97a,0xf97b,0xf97c,
-0xf97d,0xf97e,0xf980,0xf981,0xf982,0xf983,0xf984,0xf985,
-0xf986,0xf987,0xf988,0xf989,0xf98a,0xf98b,0xf98c,0xf98d,
-0xf98e,0xf98f,0xf990,0xf991,0xf992,0xf993,0xf994,0xf995,
-0xf996,0xf997,0xf998,0xf999,0xf99a,0xf99b,0xf99c,0xf99d,
-0xf99e,0xf99f,0xf9a0,0xfa40,0xfa41,0xfa42,0xfa43,0xfa44,
-0xfa45,0xfa46,0xfa47,0xfa48,0xfa49,0xfa4a,0xfa4b,0xfa4c,
-0xfa4d,0xfa4e,0xfa4f,0xfa50,0xfa51,0xfa52,0xfa53,0xfa54,
-0xfa55,0xfa56,0xfa57,0xfa58,0xfa59,0xfa5a,0xfa5b,0xfa5c,
-0xfa5d,0xfa5e,0xfa5f,0xfa60,0xfa61,0xfa62,0xfa63,0xfa64,
-0xfa65,0xfa66,0xfa67,0xfa68,0xfa69,0xfa6a,0xfa6b,0xfa6c,
-0xfa6d,0xfa6e,0xfa6f,0xfa70,0xfa71,0xfa72,0xfa73,0xfa74,
-0xfa75,0xfa76,0xfa77,0xfa78,0xfa79,0xfa7a,0xfa7b,0xfa7c,
-0xfa7d,0xfa7e,0xfa80,0xfa81,0xfa82,0xfa83,0xfa84,0xfa85,
-0xfa86,0xfa87,0xfa88,0xfa89,0xfa8a,0xfa8b,0xfa8c,0xfa8d,
-0xfa8e,0xfa8f,0xfa90,0xfa91,0xfa92,0xfa93,0xfa94,0xfa95,
-0xfa96,0xfa97,0xfa98,0xfa99,0xfa9a,0xfa9b,0xfa9c,0xfa9d,
-0xfa9e,0xfa9f,0xfaa0,0xfb40,0xfb41,0xfb42,0xfb43,0xfb44,
-0xfb45,0xfb46,0xfb47,0xfb48,0xfb49,0xfb4a,0xfb4b,0xfb4c,
-0xfb4d,0xfb4e,0xfb4f,0xfb50,0xfb51,0xfb52,0xfb53,0xfb54,
-0xfb55,0xfb56,0xfb57,0xfb58,0xfb59,0xfb5a,0xfb5b,0xc4f1,
-0xf0af,0xbca6,0xf0b0,0xc3f9,0xfb5c,0xc5b8,0xd1bb,0xfb5d,
-0xf0b1,0xf0b2,0xf0b3,0xf0b4,0xf0b5,0xd1bc,0xfb5e,0xd1ec,
-0xfb5f,0xf0b7,0xf0b6,0xd4a7,0xfb60,0xcdd2,0xf0b8,0xf0ba,
-0xf0b9,0xf0bb,0xf0bc,0xfb61,0xfb62,0xb8eb,0xf0bd,0xbae8,
-0xfb63,0xf0be,0xf0bf,0xbee9,0xf0c0,0xb6ec,0xf0c1,0xf0c2,
-0xf0c3,0xf0c4,0xc8b5,0xf0c5,0xf0c6,0xfb64,0xf0c7,0xc5f4,
-0xfb65,0xf0c8,0xfb66,0xfb67,0xfb68,0xf0c9,0xfb69,0xf0ca,
-0xf7bd,0xfb6a,0xf0cb,0xf0cc,0xf0cd,0xfb6b,0xf0ce,0xfb6c,
-0xfb6d,0xfb6e,0xfb6f,0xf0cf,0xbad7,0xfb70,0xf0d0,0xf0d1,
-0xf0d2,0xf0d3,0xf0d4,0xf0d5,0xf0d6,0xf0d8,0xfb71,0xfb72,
-0xd3a5,0xf0d7,0xfb73,0xf0d9,0xfb74,0xfb75,0xfb76,0xfb77,
-0xfb78,0xfb79,0xfb7a,0xfb7b,0xfb7c,0xfb7d,0xf5ba,0xc2b9,
-0xfb7e,0xfb80,0xf7e4,0xfb81,0xfb82,0xfb83,0xfb84,0xf7e5,
-0xf7e6,0xfb85,0xfb86,0xf7e7,0xfb87,0xfb88,0xfb89,0xfb8a,
-0xfb8b,0xfb8c,0xf7e8,0xc2b4,0xfb8d,0xfb8e,0xfb8f,0xfb90,
-0xfb91,0xfb92,0xfb93,0xfb94,0xfb95,0xf7ea,0xfb96,0xf7eb,
-0xfb97,0xfb98,0xfb99,0xfb9a,0xfb9b,0xfb9c,0xc2f3,0xfb9d,
-0xfb9e,0xfb9f,0xfba0,0xfc40,0xfc41,0xfc42,0xfc43,0xfc44,
-0xfc45,0xfc46,0xfc47,0xfc48,0xf4f0,0xfc49,0xfc4a,0xfc4b,
-0xf4ef,0xfc4c,0xfc4d,0xc2e9,0xfc4e,0xf7e1,0xf7e2,0xfc4f,
-0xfc50,0xfc51,0xfc52,0xfc53,0xbbc6,0xfc54,0xfc55,0xfc56,
-0xfc57,0xd9e4,0xfc58,0xfc59,0xfc5a,0xcaf2,0xc0e8,0xf0a4,
-0xfc5b,0xbada,0xfc5c,0xfc5d,0xc7ad,0xfc5e,0xfc5f,0xfc60,
-0xc4ac,0xfc61,0xfc62,0xf7ec,0xf7ed,0xf7ee,0xfc63,0xf7f0,
-0xf7ef,0xfc64,0xf7f1,0xfc65,0xfc66,0xf7f4,0xfc67,0xf7f3,
-0xfc68,0xf7f2,0xf7f5,0xfc69,0xfc6a,0xfc6b,0xfc6c,0xf7f6,
-0xfc6d,0xfc6e,0xfc6f,0xfc70,0xfc71,0xfc72,0xfc73,0xfc74,
-0xfc75,0xede9,0xfc76,0xedea,0xedeb,0xfc77,0xf6bc,0xfc78,
-0xfc79,0xfc7a,0xfc7b,0xfc7c,0xfc7d,0xfc7e,0xfc80,0xfc81,
-0xfc82,0xfc83,0xfc84,0xf6bd,0xfc85,0xf6be,0xb6a6,0xfc86,
-0xd8be,0xfc87,0xfc88,0xb9c4,0xfc89,0xfc8a,0xfc8b,0xd8bb,
-0xfc8c,0xdcb1,0xfc8d,0xfc8e,0xfc8f,0xfc90,0xfc91,0xfc92,
-0xcaf3,0xfc93,0xf7f7,0xfc94,0xfc95,0xfc96,0xfc97,0xfc98,
-0xfc99,0xfc9a,0xfc9b,0xfc9c,0xf7f8,0xfc9d,0xfc9e,0xf7f9,
-0xfc9f,0xfca0,0xfd40,0xfd41,0xfd42,0xfd43,0xfd44,0xf7fb,
-0xfd45,0xf7fa,0xfd46,0xb1c7,0xfd47,0xf7fc,0xf7fd,0xfd48,
-0xfd49,0xfd4a,0xfd4b,0xfd4c,0xf7fe,0xfd4d,0xfd4e,0xfd4f,
-0xfd50,0xfd51,0xfd52,0xfd53,0xfd54,0xfd55,0xfd56,0xfd57,
-0xc6eb,0xecb4,0xfd58,0xfd59,0xfd5a,0xfd5b,0xfd5c,0xfd5d,
-0xfd5e,0xfd5f,0xfd60,0xfd61,0xfd62,0xfd63,0xfd64,0xfd65,
-0xfd66,0xfd67,0xfd68,0xfd69,0xfd6a,0xfd6b,0xfd6c,0xfd6d,
-0xfd6e,0xfd6f,0xfd70,0xfd71,0xfd72,0xfd73,0xfd74,0xfd75,
-0xfd76,0xfd77,0xfd78,0xfd79,0xfd7a,0xfd7b,0xfd7c,0xfd7d,
-0xfd7e,0xfd80,0xfd81,0xfd82,0xfd83,0xfd84,0xfd85,0xb3dd,
-0xf6b3,0xfd86,0xfd87,0xf6b4,0xc1e4,0xf6b5,0xf6b6,0xf6b7,
-0xf6b8,0xf6b9,0xf6ba,0xc8a3,0xf6bb,0xfd88,0xfd89,0xfd8a,
-0xfd8b,0xfd8c,0xfd8d,0xfd8e,0xfd8f,0xfd90,0xfd91,0xfd92,
-0xfd93,0xc1fa,0xb9a8,0xede8,0xfd94,0xfd95,0xfd96,0xb9ea,
-0xd9df,0xfd97,0xfd98,0xfd99,0xfd9a,0xfd9b,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-}; /* 9fffh */
-static const int ucs_i_cp936_table_min = 0x4d00;
-static const int ucs_i_cp936_table_max = 0x4d00 + (sizeof (ucs_i_cp936_table) / sizeof (unsigned short));
-
-
-
-/* 0xf900 CJK Compatibility Ideographs */
-static const unsigned short ucs_ci_cp936_table[] = {
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xfd9c,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xfd9d,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xfd9e,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfd9f,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xfda0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xfa00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xfe40,0xfe41,0xfe42,0xfe43,
-0x0000,0xfe44,0x0000,0xfe45,0xfe46,0x0000,0x0000,0x0000,
-0xfe47,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfe48,
-0xfe49,0xfe4a,0x0000,0xfe4b,0xfe4c,0x0000,0x0000,0xfe4d,
-0xfe4e,0xfe4f,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000};
-static const int ucs_ci_cp936_table_min = 0xf900;
-static const int ucs_ci_cp936_table_max = 0xf900 + (sizeof (ucs_ci_cp936_table) / sizeof (unsigned short));
-
-
- /* FE30h CJK Compatibility Forms */
-static const unsigned short ucs_cf_cp936_table[] = {
-0xa955,0xa6f2,0x0000,0xa6f4,0xa6f5,0xa6e0,0xa6e1,0xa6f0,
-0xa6f1,0xa6e2,0xa6e3,0xa6ee,0xa6ef,0xa6e6,0xa6e7,0xa6e4,
-0xa6e5,0xa6e8,0xa6e9,0xa6ea,0xa6eb,0x0000,0x0000,0x0000,
-0x0000,0xa968,0xa969,0xa96a,0xa96b,0xa96c,0xa96d,0xa96e};
-
-static const int ucs_cf_cp936_table_min = 0xfe30;
-static const int ucs_cf_cp936_table_max = 0xfe30 + (sizeof (ucs_cf_cp936_table) / sizeof (unsigned short));
-
-
- /* FE50h Small Form Variants */
-static const unsigned short ucs_sfv_cp936_table[] = {
-0xa96f,0xa970,0xa971,0x0000,0xa972,0xa973,0xa974,0xa975,
-0x0000,0xa976,0xa977,0xa978,0xa979,0xa97a,0xa97b,0xa97c,
-0xa97d,0xa97e,0xa980,0xa981,0xa982,0xa983,0xa984,0x0000,
-0xa985,0xa986,0xa987,0xa988,0x0000,0x0000,0x0000,0x0000};
-
-static const int ucs_sfv_cp936_table_min = 0xfe50;
-static const int ucs_sfv_cp936_table_max = 0xfe50 + (sizeof (ucs_sfv_cp936_table) / sizeof (unsigned short));
-
- /* FF00h Halfwidth and Fullwidth Forms */
-static const unsigned short ucs_hff_cp936_table[] = {
-0x0000,0xa3a1,0xa3a2,0xa3a3,0xa1e7,0xa3a5,0xa3a6,0xa3a7,
-0xa3a8,0xa3a9,0xa3aa,0xa3ab,0xa3ac,0xa3ad,0xa3ae,0xa3af,
-0xa3b0,0xa3b1,0xa3b2,0xa3b3,0xa3b4,0xa3b5,0xa3b6,0xa3b7,
-0xa3b8,0xa3b9,0xa3ba,0xa3bb,0xa3bc,0xa3bd,0xa3be,0xa3bf,
-0xa3c0,0xa3c1,0xa3c2,0xa3c3,0xa3c4,0xa3c5,0xa3c6,0xa3c7,
-0xa3c8,0xa3c9,0xa3ca,0xa3cb,0xa3cc,0xa3cd,0xa3ce,0xa3cf,
-0xa3d0,0xa3d1,0xa3d2,0xa3d3,0xa3d4,0xa3d5,0xa3d6,0xa3d7,
-0xa3d8,0xa3d9,0xa3da,0xa3db,0xa3dc,0xa3dd,0xa3de,0xa3df,
-0xa3e0,0xa3e1,0xa3e2,0xa3e3,0xa3e4,0xa3e5,0xa3e6,0xa3e7,
-0xa3e8,0xa3e9,0xa3ea,0xa3eb,0xa3ec,0xa3ed,0xa3ee,0xa3ef,
-0xa3f0,0xa3f1,0xa3f2,0xa3f3,0xa3f4,0xa3f5,0xa3f6,0xa3f7,
-0xa3f8,0xa3f9,0xa3fa,0xa3fb,0xa3fc,0xa3fd,0xa1ab,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1e9,0xa1ea,0xa956,0xa3fe,0xa957,0xa3a4,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-static const int ucs_hff_cp936_table_min = 0xff00;
-static const int ucs_hff_cp936_table_max = 0xff00 + (sizeof (ucs_hff_cp936_table) / sizeof (unsigned short));
-
-
-
diff --git a/ext/mbstring/unicode_table_ja.h b/ext/mbstring/unicode_table_ja.h
deleted file mode 100644
index 961eb4731c..0000000000
--- a/ext/mbstring/unicode_table_ja.h
+++ /dev/null
@@ -1,5961 +0,0 @@
-/*
- * Unicode table
- */
-static const unsigned short jisx0208_ucs_table[] = {
- /* ku 1 */
- 0x3000,0x3001,0x3002,0xFF0C,0xFF0E,0x30FB,0xFF1A,0xFF1B,
- 0xFF1F,0xFF01,0x309B,0x309C,0x00B4,0xFF40,0x00A8,0xFF3E,
- 0xFFE3,0xFF3F,0x30FD,0x30FE,0x309D,0x309E,0x3003,0x4EDD,
- 0x3005,0x3006,0x3007,0x30FC,0x2015,0x2010,0xFF0F,0xFF3C,
- 0x301C,0x2016,0xFF5C,0x2026,0x2025,0x2018,0x2019,0x201C,
- 0x201D,0xFF08,0xFF09,0x3014,0x3015,0xFF3B,0xFF3D,0xFF5B,
- 0xFF5D,0x3008,0x3009,0x300A,0x300B,0x300C,0x300D,0x300E,
- 0x300F,0x3010,0x3011,0xFF0B,0x2212,0x00B1,0x00D7,0x00F7,
- 0xFF1D,0x2260,0xFF1C,0xFF1E,0x2266,0x2267,0x221E,0x2234,
- 0x2642,0x2640,0x00B0,0x2032,0x2033,0x2103,0xFFE5,0xFF04,
- 0x00A2,0x00A3,0xFF05,0xFF03,0xFF06,0xFF0A,0xFF20,0x00A7,
- 0x2606,0x2605,0x25CB,0x25CF,0x25CE,0x25C7,
-
- /* ku 2 */
- 0x25C6,0x25A1,0x25A0,0x25B3,0x25B2,0x25BD,0x25BC,0x203B,
- 0x3012,0x2192,0x2190,0x2191,0x2193,0x3013,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x2208,0x220B,0x2286,0x2287,0x2282,0x2283,0x222A,
- 0x2229,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x2227,0x2228,0x00AC,0x21D2,0x21D4,0x2200,0x2203,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x2220,0x22A5,0x2312,0x2202,0x2207,
- 0x2261,0x2252,0x226A,0x226B,0x221A,0x223D,0x221D,0x2235,
- 0x222B,0x222C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x212B,0x2030,0x266F,0x266D,0x266A,0x2020,0x2021,
- 0x00B6,0x0000,0x0000,0x0000,0x0000,0x25EF,
-
- /* ku 3 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xFF10,
- 0xFF11,0xFF12,0xFF13,0xFF14,0xFF15,0xFF16,0xFF17,0xFF18,
- 0xFF19,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xFF21,0xFF22,0xFF23,0xFF24,0xFF25,0xFF26,0xFF27,0xFF28,
- 0xFF29,0xFF2A,0xFF2B,0xFF2C,0xFF2D,0xFF2E,0xFF2F,0xFF30,
- 0xFF31,0xFF32,0xFF33,0xFF34,0xFF35,0xFF36,0xFF37,0xFF38,
- 0xFF39,0xFF3A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xFF41,0xFF42,0xFF43,0xFF44,0xFF45,0xFF46,0xFF47,0xFF48,
- 0xFF49,0xFF4A,0xFF4B,0xFF4C,0xFF4D,0xFF4E,0xFF4F,0xFF50,
- 0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0xFF57,0xFF58,
- 0xFF59,0xFF5A,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 4 */
- 0x3041,0x3042,0x3043,0x3044,0x3045,0x3046,0x3047,0x3048,
- 0x3049,0x304A,0x304B,0x304C,0x304D,0x304E,0x304F,0x3050,
- 0x3051,0x3052,0x3053,0x3054,0x3055,0x3056,0x3057,0x3058,
- 0x3059,0x305A,0x305B,0x305C,0x305D,0x305E,0x305F,0x3060,
- 0x3061,0x3062,0x3063,0x3064,0x3065,0x3066,0x3067,0x3068,
- 0x3069,0x306A,0x306B,0x306C,0x306D,0x306E,0x306F,0x3070,
- 0x3071,0x3072,0x3073,0x3074,0x3075,0x3076,0x3077,0x3078,
- 0x3079,0x307A,0x307B,0x307C,0x307D,0x307E,0x307F,0x3080,
- 0x3081,0x3082,0x3083,0x3084,0x3085,0x3086,0x3087,0x3088,
- 0x3089,0x308A,0x308B,0x308C,0x308D,0x308E,0x308F,0x3090,
- 0x3091,0x3092,0x3093,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 5 */
- 0x30A1,0x30A2,0x30A3,0x30A4,0x30A5,0x30A6,0x30A7,0x30A8,
- 0x30A9,0x30AA,0x30AB,0x30AC,0x30AD,0x30AE,0x30AF,0x30B0,
- 0x30B1,0x30B2,0x30B3,0x30B4,0x30B5,0x30B6,0x30B7,0x30B8,
- 0x30B9,0x30BA,0x30BB,0x30BC,0x30BD,0x30BE,0x30BF,0x30C0,
- 0x30C1,0x30C2,0x30C3,0x30C4,0x30C5,0x30C6,0x30C7,0x30C8,
- 0x30C9,0x30CA,0x30CB,0x30CC,0x30CD,0x30CE,0x30CF,0x30D0,
- 0x30D1,0x30D2,0x30D3,0x30D4,0x30D5,0x30D6,0x30D7,0x30D8,
- 0x30D9,0x30DA,0x30DB,0x30DC,0x30DD,0x30DE,0x30DF,0x30E0,
- 0x30E1,0x30E2,0x30E3,0x30E4,0x30E5,0x30E6,0x30E7,0x30E8,
- 0x30E9,0x30EA,0x30EB,0x30EC,0x30ED,0x30EE,0x30EF,0x30F0,
- 0x30F1,0x30F2,0x30F3,0x30F4,0x30F5,0x30F6,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 6 */
- 0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,
- 0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,0x03A0,
- 0x03A1,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,0x03A8,0x03A9,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,0x03B8,
- 0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,0x03C0,
- 0x03C1,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,0x03C9,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 7 */
- 0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0401,0x0416,
- 0x0417,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,
- 0x041F,0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,
- 0x0427,0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,
- 0x042F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0451,0x0436,
- 0x0437,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,
- 0x043F,0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,
- 0x0447,0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,
- 0x044F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 8 */
- 0x2500,0x2502,0x250C,0x2510,0x2518,0x2514,0x251C,0x252C,
- 0x2524,0x2534,0x253C,0x2501,0x2503,0x250F,0x2513,0x251B,
- 0x2517,0x2523,0x2533,0x252B,0x253B,0x254B,0x2520,0x252F,
- 0x2528,0x2537,0x253F,0x251D,0x2530,0x2525,0x2538,0x2542,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 9 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 10 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 11 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 12 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 13 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 14 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 15 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 16 */
- 0x4E9C,0x5516,0x5A03,0x963F,0x54C0,0x611B,0x6328,0x59F6,
- 0x9022,0x8475,0x831C,0x7A50,0x60AA,0x63E1,0x6E25,0x65ED,
- 0x8466,0x82A6,0x9BF5,0x6893,0x5727,0x65A1,0x6271,0x5B9B,
- 0x59D0,0x867B,0x98F4,0x7D62,0x7DBE,0x9B8E,0x6216,0x7C9F,
- 0x88B7,0x5B89,0x5EB5,0x6309,0x6697,0x6848,0x95C7,0x978D,
- 0x674F,0x4EE5,0x4F0A,0x4F4D,0x4F9D,0x5049,0x56F2,0x5937,
- 0x59D4,0x5A01,0x5C09,0x60DF,0x610F,0x6170,0x6613,0x6905,
- 0x70BA,0x754F,0x7570,0x79FB,0x7DAD,0x7DEF,0x80C3,0x840E,
- 0x8863,0x8B02,0x9055,0x907A,0x533B,0x4E95,0x4EA5,0x57DF,
- 0x80B2,0x90C1,0x78EF,0x4E00,0x58F1,0x6EA2,0x9038,0x7A32,
- 0x8328,0x828B,0x9C2F,0x5141,0x5370,0x54BD,0x54E1,0x56E0,
- 0x59FB,0x5F15,0x98F2,0x6DEB,0x80E4,0x852D,
-
- /* ku 17 */
- 0x9662,0x9670,0x96A0,0x97FB,0x540B,0x53F3,0x5B87,0x70CF,
- 0x7FBD,0x8FC2,0x96E8,0x536F,0x9D5C,0x7ABA,0x4E11,0x7893,
- 0x81FC,0x6E26,0x5618,0x5504,0x6B1D,0x851A,0x9C3B,0x59E5,
- 0x53A9,0x6D66,0x74DC,0x958F,0x5642,0x4E91,0x904B,0x96F2,
- 0x834F,0x990C,0x53E1,0x55B6,0x5B30,0x5F71,0x6620,0x66F3,
- 0x6804,0x6C38,0x6CF3,0x6D29,0x745B,0x76C8,0x7A4E,0x9834,
- 0x82F1,0x885B,0x8A60,0x92ED,0x6DB2,0x75AB,0x76CA,0x99C5,
- 0x60A6,0x8B01,0x8D8A,0x95B2,0x698E,0x53AD,0x5186,0x5712,
- 0x5830,0x5944,0x5BB4,0x5EF6,0x6028,0x63A9,0x63F4,0x6CBF,
- 0x6F14,0x708E,0x7114,0x7159,0x71D5,0x733F,0x7E01,0x8276,
- 0x82D1,0x8597,0x9060,0x925B,0x9D1B,0x5869,0x65BC,0x6C5A,
- 0x7525,0x51F9,0x592E,0x5965,0x5F80,0x5FDC,
-
- /* ku 18 */
- 0x62BC,0x65FA,0x6A2A,0x6B27,0x6BB4,0x738B,0x7FC1,0x8956,
- 0x9D2C,0x9D0E,0x9EC4,0x5CA1,0x6C96,0x837B,0x5104,0x5C4B,
- 0x61B6,0x81C6,0x6876,0x7261,0x4E59,0x4FFA,0x5378,0x6069,
- 0x6E29,0x7A4F,0x97F3,0x4E0B,0x5316,0x4EEE,0x4F55,0x4F3D,
- 0x4FA1,0x4F73,0x52A0,0x53EF,0x5609,0x590F,0x5AC1,0x5BB6,
- 0x5BE1,0x79D1,0x6687,0x679C,0x67B6,0x6B4C,0x6CB3,0x706B,
- 0x73C2,0x798D,0x79BE,0x7A3C,0x7B87,0x82B1,0x82DB,0x8304,
- 0x8377,0x83EF,0x83D3,0x8766,0x8AB2,0x5629,0x8CA8,0x8FE6,
- 0x904E,0x971E,0x868A,0x4FC4,0x5CE8,0x6211,0x7259,0x753B,
- 0x81E5,0x82BD,0x86FE,0x8CC0,0x96C5,0x9913,0x99D5,0x4ECB,
- 0x4F1A,0x89E3,0x56DE,0x584A,0x58CA,0x5EFB,0x5FEB,0x602A,
- 0x6094,0x6062,0x61D0,0x6212,0x62D0,0x6539,
-
- /* ku 19 */
- 0x9B41,0x6666,0x68B0,0x6D77,0x7070,0x754C,0x7686,0x7D75,
- 0x82A5,0x87F9,0x958B,0x968E,0x8C9D,0x51F1,0x52BE,0x5916,
- 0x54B3,0x5BB3,0x5D16,0x6168,0x6982,0x6DAF,0x788D,0x84CB,
- 0x8857,0x8A72,0x93A7,0x9AB8,0x6D6C,0x99A8,0x86D9,0x57A3,
- 0x67FF,0x86CE,0x920E,0x5283,0x5687,0x5404,0x5ED3,0x62E1,
- 0x64B9,0x683C,0x6838,0x6BBB,0x7372,0x78BA,0x7A6B,0x899A,
- 0x89D2,0x8D6B,0x8F03,0x90ED,0x95A3,0x9694,0x9769,0x5B66,
- 0x5CB3,0x697D,0x984D,0x984E,0x639B,0x7B20,0x6A2B,0x6A7F,
- 0x68B6,0x9C0D,0x6F5F,0x5272,0x559D,0x6070,0x62EC,0x6D3B,
- 0x6E07,0x6ED1,0x845B,0x8910,0x8F44,0x4E14,0x9C39,0x53F6,
- 0x691B,0x6A3A,0x9784,0x682A,0x515C,0x7AC3,0x84B2,0x91DC,
- 0x938C,0x565B,0x9D28,0x6822,0x8305,0x8431,
-
- /* ku 20 */
- 0x7CA5,0x5208,0x82C5,0x74E6,0x4E7E,0x4F83,0x51A0,0x5BD2,
- 0x520A,0x52D8,0x52E7,0x5DFB,0x559A,0x582A,0x59E6,0x5B8C,
- 0x5B98,0x5BDB,0x5E72,0x5E79,0x60A3,0x611F,0x6163,0x61BE,
- 0x63DB,0x6562,0x67D1,0x6853,0x68FA,0x6B3E,0x6B53,0x6C57,
- 0x6F22,0x6F97,0x6F45,0x74B0,0x7518,0x76E3,0x770B,0x7AFF,
- 0x7BA1,0x7C21,0x7DE9,0x7F36,0x7FF0,0x809D,0x8266,0x839E,
- 0x89B3,0x8ACC,0x8CAB,0x9084,0x9451,0x9593,0x9591,0x95A2,
- 0x9665,0x97D3,0x9928,0x8218,0x4E38,0x542B,0x5CB8,0x5DCC,
- 0x73A9,0x764C,0x773C,0x5CA9,0x7FEB,0x8D0B,0x96C1,0x9811,
- 0x9854,0x9858,0x4F01,0x4F0E,0x5371,0x559C,0x5668,0x57FA,
- 0x5947,0x5B09,0x5BC4,0x5C90,0x5E0C,0x5E7E,0x5FCC,0x63EE,
- 0x673A,0x65D7,0x65E2,0x671F,0x68CB,0x68C4,
-
- /* ku 21 */
- 0x6A5F,0x5E30,0x6BC5,0x6C17,0x6C7D,0x757F,0x7948,0x5B63,
- 0x7A00,0x7D00,0x5FBD,0x898F,0x8A18,0x8CB4,0x8D77,0x8ECC,
- 0x8F1D,0x98E2,0x9A0E,0x9B3C,0x4E80,0x507D,0x5100,0x5993,
- 0x5B9C,0x622F,0x6280,0x64EC,0x6B3A,0x72A0,0x7591,0x7947,
- 0x7FA9,0x87FB,0x8ABC,0x8B70,0x63AC,0x83CA,0x97A0,0x5409,
- 0x5403,0x55AB,0x6854,0x6A58,0x8A70,0x7827,0x6775,0x9ECD,
- 0x5374,0x5BA2,0x811A,0x8650,0x9006,0x4E18,0x4E45,0x4EC7,
- 0x4F11,0x53CA,0x5438,0x5BAE,0x5F13,0x6025,0x6551,0x673D,
- 0x6C42,0x6C72,0x6CE3,0x7078,0x7403,0x7A76,0x7AAE,0x7B08,
- 0x7D1A,0x7CFE,0x7D66,0x65E7,0x725B,0x53BB,0x5C45,0x5DE8,
- 0x62D2,0x62E0,0x6319,0x6E20,0x865A,0x8A31,0x8DDD,0x92F8,
- 0x6F01,0x79A6,0x9B5A,0x4EA8,0x4EAB,0x4EAC,
-
- /* ku 22 */
- 0x4F9B,0x4FA0,0x50D1,0x5147,0x7AF6,0x5171,0x51F6,0x5354,
- 0x5321,0x537F,0x53EB,0x55AC,0x5883,0x5CE1,0x5F37,0x5F4A,
- 0x602F,0x6050,0x606D,0x631F,0x6559,0x6A4B,0x6CC1,0x72C2,
- 0x72ED,0x77EF,0x80F8,0x8105,0x8208,0x854E,0x90F7,0x93E1,
- 0x97FF,0x9957,0x9A5A,0x4EF0,0x51DD,0x5C2D,0x6681,0x696D,
- 0x5C40,0x66F2,0x6975,0x7389,0x6850,0x7C81,0x50C5,0x52E4,
- 0x5747,0x5DFE,0x9326,0x65A4,0x6B23,0x6B3D,0x7434,0x7981,
- 0x79BD,0x7B4B,0x7DCA,0x82B9,0x83CC,0x887F,0x895F,0x8B39,
- 0x8FD1,0x91D1,0x541F,0x9280,0x4E5D,0x5036,0x53E5,0x533A,
- 0x72D7,0x7396,0x77E9,0x82E6,0x8EAF,0x99C6,0x99C8,0x99D2,
- 0x5177,0x611A,0x865E,0x55B0,0x7A7A,0x5076,0x5BD3,0x9047,
- 0x9685,0x4E32,0x6ADB,0x91E7,0x5C51,0x5C48,
-
- /* ku 23 */
- 0x6398,0x7A9F,0x6C93,0x9774,0x8F61,0x7AAA,0x718A,0x9688,
- 0x7C82,0x6817,0x7E70,0x6851,0x936C,0x52F2,0x541B,0x85AB,
- 0x8A13,0x7FA4,0x8ECD,0x90E1,0x5366,0x8888,0x7941,0x4FC2,
- 0x50BE,0x5211,0x5144,0x5553,0x572D,0x73EA,0x578B,0x5951,
- 0x5F62,0x5F84,0x6075,0x6176,0x6167,0x61A9,0x63B2,0x643A,
- 0x656C,0x666F,0x6842,0x6E13,0x7566,0x7A3D,0x7CFB,0x7D4C,
- 0x7D99,0x7E4B,0x7F6B,0x830E,0x834A,0x86CD,0x8A08,0x8A63,
- 0x8B66,0x8EFD,0x981A,0x9D8F,0x82B8,0x8FCE,0x9BE8,0x5287,
- 0x621F,0x6483,0x6FC0,0x9699,0x6841,0x5091,0x6B20,0x6C7A,
- 0x6F54,0x7A74,0x7D50,0x8840,0x8A23,0x6708,0x4EF6,0x5039,
- 0x5026,0x5065,0x517C,0x5238,0x5263,0x55A7,0x570F,0x5805,
- 0x5ACC,0x5EFA,0x61B2,0x61F8,0x62F3,0x6372,
-
- /* ku 24 */
- 0x691C,0x6A29,0x727D,0x72AC,0x732E,0x7814,0x786F,0x7D79,
- 0x770C,0x80A9,0x898B,0x8B19,0x8CE2,0x8ED2,0x9063,0x9375,
- 0x967A,0x9855,0x9A13,0x9E78,0x5143,0x539F,0x53B3,0x5E7B,
- 0x5F26,0x6E1B,0x6E90,0x7384,0x73FE,0x7D43,0x8237,0x8A00,
- 0x8AFA,0x9650,0x4E4E,0x500B,0x53E4,0x547C,0x56FA,0x59D1,
- 0x5B64,0x5DF1,0x5EAB,0x5F27,0x6238,0x6545,0x67AF,0x6E56,
- 0x72D0,0x7CCA,0x88B4,0x80A1,0x80E1,0x83F0,0x864E,0x8A87,
- 0x8DE8,0x9237,0x96C7,0x9867,0x9F13,0x4E94,0x4E92,0x4F0D,
- 0x5348,0x5449,0x543E,0x5A2F,0x5F8C,0x5FA1,0x609F,0x68A7,
- 0x6A8E,0x745A,0x7881,0x8A9E,0x8AA4,0x8B77,0x9190,0x4E5E,
- 0x9BC9,0x4EA4,0x4F7C,0x4FAF,0x5019,0x5016,0x5149,0x516C,
- 0x529F,0x52B9,0x52FE,0x539A,0x53E3,0x5411,
-
- /* ku 25 */
- 0x540E,0x5589,0x5751,0x57A2,0x597D,0x5B54,0x5B5D,0x5B8F,
- 0x5DE5,0x5DE7,0x5DF7,0x5E78,0x5E83,0x5E9A,0x5EB7,0x5F18,
- 0x6052,0x614C,0x6297,0x62D8,0x63A7,0x653B,0x6602,0x6643,
- 0x66F4,0x676D,0x6821,0x6897,0x69CB,0x6C5F,0x6D2A,0x6D69,
- 0x6E2F,0x6E9D,0x7532,0x7687,0x786C,0x7A3F,0x7CE0,0x7D05,
- 0x7D18,0x7D5E,0x7DB1,0x8015,0x8003,0x80AF,0x80B1,0x8154,
- 0x818F,0x822A,0x8352,0x884C,0x8861,0x8B1B,0x8CA2,0x8CFC,
- 0x90CA,0x9175,0x9271,0x783F,0x92FC,0x95A4,0x964D,0x9805,
- 0x9999,0x9AD8,0x9D3B,0x525B,0x52AB,0x53F7,0x5408,0x58D5,
- 0x62F7,0x6FE0,0x8C6A,0x8F5F,0x9EB9,0x514B,0x523B,0x544A,
- 0x56FD,0x7A40,0x9177,0x9D60,0x9ED2,0x7344,0x6F09,0x8170,
- 0x7511,0x5FFD,0x60DA,0x9AA8,0x72DB,0x8FBC,
-
- /* ku 26 */
- 0x6B64,0x9803,0x4ECA,0x56F0,0x5764,0x58BE,0x5A5A,0x6068,
- 0x61C7,0x660F,0x6606,0x6839,0x68B1,0x6DF7,0x75D5,0x7D3A,
- 0x826E,0x9B42,0x4E9B,0x4F50,0x53C9,0x5506,0x5D6F,0x5DE6,
- 0x5DEE,0x67FB,0x6C99,0x7473,0x7802,0x8A50,0x9396,0x88DF,
- 0x5750,0x5EA7,0x632B,0x50B5,0x50AC,0x518D,0x6700,0x54C9,
- 0x585E,0x59BB,0x5BB0,0x5F69,0x624D,0x63A1,0x683D,0x6B73,
- 0x6E08,0x707D,0x91C7,0x7280,0x7815,0x7826,0x796D,0x658E,
- 0x7D30,0x83DC,0x88C1,0x8F09,0x969B,0x5264,0x5728,0x6750,
- 0x7F6A,0x8CA1,0x51B4,0x5742,0x962A,0x583A,0x698A,0x80B4,
- 0x54B2,0x5D0E,0x57FC,0x7895,0x9DFA,0x4F5C,0x524A,0x548B,
- 0x643E,0x6628,0x6714,0x67F5,0x7A84,0x7B56,0x7D22,0x932F,
- 0x685C,0x9BAD,0x7B39,0x5319,0x518A,0x5237,
-
- /* ku 27 */
- 0x5BDF,0x62F6,0x64AE,0x64E6,0x672D,0x6BBA,0x85A9,0x96D1,
- 0x7690,0x9BD6,0x634C,0x9306,0x9BAB,0x76BF,0x6652,0x4E09,
- 0x5098,0x53C2,0x5C71,0x60E8,0x6492,0x6563,0x685F,0x71E6,
- 0x73CA,0x7523,0x7B97,0x7E82,0x8695,0x8B83,0x8CDB,0x9178,
- 0x9910,0x65AC,0x66AB,0x6B8B,0x4ED5,0x4ED4,0x4F3A,0x4F7F,
- 0x523A,0x53F8,0x53F2,0x55E3,0x56DB,0x58EB,0x59CB,0x59C9,
- 0x59FF,0x5B50,0x5C4D,0x5E02,0x5E2B,0x5FD7,0x601D,0x6307,
- 0x652F,0x5B5C,0x65AF,0x65BD,0x65E8,0x679D,0x6B62,0x6B7B,
- 0x6C0F,0x7345,0x7949,0x79C1,0x7CF8,0x7D19,0x7D2B,0x80A2,
- 0x8102,0x81F3,0x8996,0x8A5E,0x8A69,0x8A66,0x8A8C,0x8AEE,
- 0x8CC7,0x8CDC,0x96CC,0x98FC,0x6B6F,0x4E8B,0x4F3C,0x4F8D,
- 0x5150,0x5B57,0x5BFA,0x6148,0x6301,0x6642,
-
- /* ku 28 */
- 0x6B21,0x6ECB,0x6CBB,0x723E,0x74BD,0x75D4,0x78C1,0x793A,
- 0x800C,0x8033,0x81EA,0x8494,0x8F9E,0x6C50,0x9E7F,0x5F0F,
- 0x8B58,0x9D2B,0x7AFA,0x8EF8,0x5B8D,0x96EB,0x4E03,0x53F1,
- 0x57F7,0x5931,0x5AC9,0x5BA4,0x6089,0x6E7F,0x6F06,0x75BE,
- 0x8CEA,0x5B9F,0x8500,0x7BE0,0x5072,0x67F4,0x829D,0x5C61,
- 0x854A,0x7E1E,0x820E,0x5199,0x5C04,0x6368,0x8D66,0x659C,
- 0x716E,0x793E,0x7D17,0x8005,0x8B1D,0x8ECA,0x906E,0x86C7,
- 0x90AA,0x501F,0x52FA,0x5C3A,0x6753,0x707C,0x7235,0x914C,
- 0x91C8,0x932B,0x82E5,0x5BC2,0x5F31,0x60F9,0x4E3B,0x53D6,
- 0x5B88,0x624B,0x6731,0x6B8A,0x72E9,0x73E0,0x7A2E,0x816B,
- 0x8DA3,0x9152,0x9996,0x5112,0x53D7,0x546A,0x5BFF,0x6388,
- 0x6A39,0x7DAC,0x9700,0x56DA,0x53CE,0x5468,
-
- /* ku 29 */
- 0x5B97,0x5C31,0x5DDE,0x4FEE,0x6101,0x62FE,0x6D32,0x79C0,
- 0x79CB,0x7D42,0x7E4D,0x7FD2,0x81ED,0x821F,0x8490,0x8846,
- 0x8972,0x8B90,0x8E74,0x8F2F,0x9031,0x914B,0x916C,0x96C6,
- 0x919C,0x4EC0,0x4F4F,0x5145,0x5341,0x5F93,0x620E,0x67D4,
- 0x6C41,0x6E0B,0x7363,0x7E26,0x91CD,0x9283,0x53D4,0x5919,
- 0x5BBF,0x6DD1,0x795D,0x7E2E,0x7C9B,0x587E,0x719F,0x51FA,
- 0x8853,0x8FF0,0x4FCA,0x5CFB,0x6625,0x77AC,0x7AE3,0x821C,
- 0x99FF,0x51C6,0x5FAA,0x65EC,0x696F,0x6B89,0x6DF3,0x6E96,
- 0x6F64,0x76FE,0x7D14,0x5DE1,0x9075,0x9187,0x9806,0x51E6,
- 0x521D,0x6240,0x6691,0x66D9,0x6E1A,0x5EB6,0x7DD2,0x7F72,
- 0x66F8,0x85AF,0x85F7,0x8AF8,0x52A9,0x53D9,0x5973,0x5E8F,
- 0x5F90,0x6055,0x92E4,0x9664,0x50B7,0x511F,
-
- /* ku 30 */
- 0x52DD,0x5320,0x5347,0x53EC,0x54E8,0x5546,0x5531,0x5617,
- 0x5968,0x59BE,0x5A3C,0x5BB5,0x5C06,0x5C0F,0x5C11,0x5C1A,
- 0x5E84,0x5E8A,0x5EE0,0x5F70,0x627F,0x6284,0x62DB,0x638C,
- 0x6377,0x6607,0x660C,0x662D,0x6676,0x677E,0x68A2,0x6A1F,
- 0x6A35,0x6CBC,0x6D88,0x6E09,0x6E58,0x713C,0x7126,0x7167,
- 0x75C7,0x7701,0x785D,0x7901,0x7965,0x79F0,0x7AE0,0x7B11,
- 0x7CA7,0x7D39,0x8096,0x83D6,0x848B,0x8549,0x885D,0x88F3,
- 0x8A1F,0x8A3C,0x8A54,0x8A73,0x8C61,0x8CDE,0x91A4,0x9266,
- 0x937E,0x9418,0x969C,0x9798,0x4E0A,0x4E08,0x4E1E,0x4E57,
- 0x5197,0x5270,0x57CE,0x5834,0x58CC,0x5B22,0x5E38,0x60C5,
- 0x64FE,0x6761,0x6756,0x6D44,0x72B6,0x7573,0x7A63,0x84B8,
- 0x8B72,0x91B8,0x9320,0x5631,0x57F4,0x98FE,
-
- /* ku 31 */
- 0x62ED,0x690D,0x6B96,0x71ED,0x7E54,0x8077,0x8272,0x89E6,
- 0x98DF,0x8755,0x8FB1,0x5C3B,0x4F38,0x4FE1,0x4FB5,0x5507,
- 0x5A20,0x5BDD,0x5BE9,0x5FC3,0x614E,0x632F,0x65B0,0x664B,
- 0x68EE,0x699B,0x6D78,0x6DF1,0x7533,0x75B9,0x771F,0x795E,
- 0x79E6,0x7D33,0x81E3,0x82AF,0x85AA,0x89AA,0x8A3A,0x8EAB,
- 0x8F9B,0x9032,0x91DD,0x9707,0x4EBA,0x4EC1,0x5203,0x5875,
- 0x58EC,0x5C0B,0x751A,0x5C3D,0x814E,0x8A0A,0x8FC5,0x9663,
- 0x976D,0x7B25,0x8ACF,0x9808,0x9162,0x56F3,0x53A8,0x9017,
- 0x5439,0x5782,0x5E25,0x63A8,0x6C34,0x708A,0x7761,0x7C8B,
- 0x7FE0,0x8870,0x9042,0x9154,0x9310,0x9318,0x968F,0x745E,
- 0x9AC4,0x5D07,0x5D69,0x6570,0x67A2,0x8DA8,0x96DB,0x636E,
- 0x6749,0x6919,0x83C5,0x9817,0x96C0,0x88FE,
-
- /* ku 32 */
- 0x6F84,0x647A,0x5BF8,0x4E16,0x702C,0x755D,0x662F,0x51C4,
- 0x5236,0x52E2,0x59D3,0x5F81,0x6027,0x6210,0x653F,0x6574,
- 0x661F,0x6674,0x68F2,0x6816,0x6B63,0x6E05,0x7272,0x751F,
- 0x76DB,0x7CBE,0x8056,0x58F0,0x88FD,0x897F,0x8AA0,0x8A93,
- 0x8ACB,0x901D,0x9192,0x9752,0x9759,0x6589,0x7A0E,0x8106,
- 0x96BB,0x5E2D,0x60DC,0x621A,0x65A5,0x6614,0x6790,0x77F3,
- 0x7A4D,0x7C4D,0x7E3E,0x810A,0x8CAC,0x8D64,0x8DE1,0x8E5F,
- 0x78A9,0x5207,0x62D9,0x63A5,0x6442,0x6298,0x8A2D,0x7A83,
- 0x7BC0,0x8AAC,0x96EA,0x7D76,0x820C,0x8749,0x4ED9,0x5148,
- 0x5343,0x5360,0x5BA3,0x5C02,0x5C16,0x5DDD,0x6226,0x6247,
- 0x64B0,0x6813,0x6834,0x6CC9,0x6D45,0x6D17,0x67D3,0x6F5C,
- 0x714E,0x717D,0x65CB,0x7A7F,0x7BAD,0x7DDA,
-
- /* ku 33 */
- 0x7E4A,0x7FA8,0x817A,0x821B,0x8239,0x85A6,0x8A6E,0x8CCE,
- 0x8DF5,0x9078,0x9077,0x92AD,0x9291,0x9583,0x9BAE,0x524D,
- 0x5584,0x6F38,0x7136,0x5168,0x7985,0x7E55,0x81B3,0x7CCE,
- 0x564C,0x5851,0x5CA8,0x63AA,0x66FE,0x66FD,0x695A,0x72D9,
- 0x758F,0x758E,0x790E,0x7956,0x79DF,0x7C97,0x7D20,0x7D44,
- 0x8607,0x8A34,0x963B,0x9061,0x9F20,0x50E7,0x5275,0x53CC,
- 0x53E2,0x5009,0x55AA,0x58EE,0x594F,0x723D,0x5B8B,0x5C64,
- 0x531D,0x60E3,0x60F3,0x635C,0x6383,0x633F,0x63BB,0x64CD,
- 0x65E9,0x66F9,0x5DE3,0x69CD,0x69FD,0x6F15,0x71E5,0x4E89,
- 0x75E9,0x76F8,0x7A93,0x7CDF,0x7DCF,0x7D9C,0x8061,0x8349,
- 0x8358,0x846C,0x84BC,0x85FB,0x88C5,0x8D70,0x9001,0x906D,
- 0x9397,0x971C,0x9A12,0x50CF,0x5897,0x618E,
-
- /* ku 34 */
- 0x81D3,0x8535,0x8D08,0x9020,0x4FC3,0x5074,0x5247,0x5373,
- 0x606F,0x6349,0x675F,0x6E2C,0x8DB3,0x901F,0x4FD7,0x5C5E,
- 0x8CCA,0x65CF,0x7D9A,0x5352,0x8896,0x5176,0x63C3,0x5B58,
- 0x5B6B,0x5C0A,0x640D,0x6751,0x905C,0x4ED6,0x591A,0x592A,
- 0x6C70,0x8A51,0x553E,0x5815,0x59A5,0x60F0,0x6253,0x67C1,
- 0x8235,0x6955,0x9640,0x99C4,0x9A28,0x4F53,0x5806,0x5BFE,
- 0x8010,0x5CB1,0x5E2F,0x5F85,0x6020,0x614B,0x6234,0x66FF,
- 0x6CF0,0x6EDE,0x80CE,0x817F,0x82D4,0x888B,0x8CB8,0x9000,
- 0x902E,0x968A,0x9EDB,0x9BDB,0x4EE3,0x53F0,0x5927,0x7B2C,
- 0x918D,0x984C,0x9DF9,0x6EDD,0x7027,0x5353,0x5544,0x5B85,
- 0x6258,0x629E,0x62D3,0x6CA2,0x6FEF,0x7422,0x8A17,0x9438,
- 0x6FC1,0x8AFE,0x8338,0x51E7,0x86F8,0x53EA,
-
- /* ku 35 */
- 0x53E9,0x4F46,0x9054,0x8FB0,0x596A,0x8131,0x5DFD,0x7AEA,
- 0x8FBF,0x68DA,0x8C37,0x72F8,0x9C48,0x6A3D,0x8AB0,0x4E39,
- 0x5358,0x5606,0x5766,0x62C5,0x63A2,0x65E6,0x6B4E,0x6DE1,
- 0x6E5B,0x70AD,0x77ED,0x7AEF,0x7BAA,0x7DBB,0x803D,0x80C6,
- 0x86CB,0x8A95,0x935B,0x56E3,0x58C7,0x5F3E,0x65AD,0x6696,
- 0x6A80,0x6BB5,0x7537,0x8AC7,0x5024,0x77E5,0x5730,0x5F1B,
- 0x6065,0x667A,0x6C60,0x75F4,0x7A1A,0x7F6E,0x81F4,0x8718,
- 0x9045,0x99B3,0x7BC9,0x755C,0x7AF9,0x7B51,0x84C4,0x9010,
- 0x79E9,0x7A92,0x8336,0x5AE1,0x7740,0x4E2D,0x4EF2,0x5B99,
- 0x5FE0,0x62BD,0x663C,0x67F1,0x6CE8,0x866B,0x8877,0x8A3B,
- 0x914E,0x92F3,0x99D0,0x6A17,0x7026,0x732A,0x82E7,0x8457,
- 0x8CAF,0x4E01,0x5146,0x51CB,0x558B,0x5BF5,
-
- /* ku 36 */
- 0x5E16,0x5E33,0x5E81,0x5F14,0x5F35,0x5F6B,0x5FB4,0x61F2,
- 0x6311,0x66A2,0x671D,0x6F6E,0x7252,0x753A,0x773A,0x8074,
- 0x8139,0x8178,0x8776,0x8ABF,0x8ADC,0x8D85,0x8DF3,0x929A,
- 0x9577,0x9802,0x9CE5,0x52C5,0x6357,0x76F4,0x6715,0x6C88,
- 0x73CD,0x8CC3,0x93AE,0x9673,0x6D25,0x589C,0x690E,0x69CC,
- 0x8FFD,0x939A,0x75DB,0x901A,0x585A,0x6802,0x63B4,0x69FB,
- 0x4F43,0x6F2C,0x67D8,0x8FBB,0x8526,0x7DB4,0x9354,0x693F,
- 0x6F70,0x576A,0x58F7,0x5B2C,0x7D2C,0x722A,0x540A,0x91E3,
- 0x9DB4,0x4EAD,0x4F4E,0x505C,0x5075,0x5243,0x8C9E,0x5448,
- 0x5824,0x5B9A,0x5E1D,0x5E95,0x5EAD,0x5EF7,0x5F1F,0x608C,
- 0x62B5,0x633A,0x63D0,0x68AF,0x6C40,0x7887,0x798E,0x7A0B,
- 0x7DE0,0x8247,0x8A02,0x8AE6,0x8E44,0x9013,
-
- /* ku 37 */
- 0x90B8,0x912D,0x91D8,0x9F0E,0x6CE5,0x6458,0x64E2,0x6575,
- 0x6EF4,0x7684,0x7B1B,0x9069,0x93D1,0x6EBA,0x54F2,0x5FB9,
- 0x64A4,0x8F4D,0x8FED,0x9244,0x5178,0x586B,0x5929,0x5C55,
- 0x5E97,0x6DFB,0x7E8F,0x751C,0x8CBC,0x8EE2,0x985B,0x70B9,
- 0x4F1D,0x6BBF,0x6FB1,0x7530,0x96FB,0x514E,0x5410,0x5835,
- 0x5857,0x59AC,0x5C60,0x5F92,0x6597,0x675C,0x6E21,0x767B,
- 0x83DF,0x8CED,0x9014,0x90FD,0x934D,0x7825,0x783A,0x52AA,
- 0x5EA6,0x571F,0x5974,0x6012,0x5012,0x515A,0x51AC,0x51CD,
- 0x5200,0x5510,0x5854,0x5858,0x5957,0x5B95,0x5CF6,0x5D8B,
- 0x60BC,0x6295,0x642D,0x6771,0x6843,0x68BC,0x68DF,0x76D7,
- 0x6DD8,0x6E6F,0x6D9B,0x706F,0x71C8,0x5F53,0x75D8,0x7977,
- 0x7B49,0x7B54,0x7B52,0x7CD6,0x7D71,0x5230,
-
- /* ku 38 */
- 0x8463,0x8569,0x85E4,0x8A0E,0x8B04,0x8C46,0x8E0F,0x9003,
- 0x900F,0x9419,0x9676,0x982D,0x9A30,0x95D8,0x50CD,0x52D5,
- 0x540C,0x5802,0x5C0E,0x61A7,0x649E,0x6D1E,0x77B3,0x7AE5,
- 0x80F4,0x8404,0x9053,0x9285,0x5CE0,0x9D07,0x533F,0x5F97,
- 0x5FB3,0x6D9C,0x7279,0x7763,0x79BF,0x7BE4,0x6BD2,0x72EC,
- 0x8AAD,0x6803,0x6A61,0x51F8,0x7A81,0x6934,0x5C4A,0x9CF6,
- 0x82EB,0x5BC5,0x9149,0x701E,0x5678,0x5C6F,0x60C7,0x6566,
- 0x6C8C,0x8C5A,0x9041,0x9813,0x5451,0x66C7,0x920D,0x5948,
- 0x90A3,0x5185,0x4E4D,0x51EA,0x8599,0x8B0E,0x7058,0x637A,
- 0x934B,0x6962,0x99B4,0x7E04,0x7577,0x5357,0x6960,0x8EDF,
- 0x96E3,0x6C5D,0x4E8C,0x5C3C,0x5F10,0x8FE9,0x5302,0x8CD1,
- 0x8089,0x8679,0x5EFF,0x65E5,0x4E73,0x5165,
-
- /* ku 39 */
- 0x5982,0x5C3F,0x97EE,0x4EFB,0x598A,0x5FCD,0x8A8D,0x6FE1,
- 0x79B0,0x7962,0x5BE7,0x8471,0x732B,0x71B1,0x5E74,0x5FF5,
- 0x637B,0x649A,0x71C3,0x7C98,0x4E43,0x5EFC,0x4E4B,0x57DC,
- 0x56A2,0x60A9,0x6FC3,0x7D0D,0x80FD,0x8133,0x81BF,0x8FB2,
- 0x8997,0x86A4,0x5DF4,0x628A,0x64AD,0x8987,0x6777,0x6CE2,
- 0x6D3E,0x7436,0x7834,0x5A46,0x7F75,0x82AD,0x99AC,0x4FF3,
- 0x5EC3,0x62DD,0x6392,0x6557,0x676F,0x76C3,0x724C,0x80CC,
- 0x80BA,0x8F29,0x914D,0x500D,0x57F9,0x5A92,0x6885,0x6973,
- 0x7164,0x72FD,0x8CB7,0x58F2,0x8CE0,0x966A,0x9019,0x877F,
- 0x79E4,0x77E7,0x8429,0x4F2F,0x5265,0x535A,0x62CD,0x67CF,
- 0x6CCA,0x767D,0x7B94,0x7C95,0x8236,0x8584,0x8FEB,0x66DD,
- 0x6F20,0x7206,0x7E1B,0x83AB,0x99C1,0x9EA6,
-
- /* ku 40 */
- 0x51FD,0x7BB1,0x7872,0x7BB8,0x8087,0x7B48,0x6AE8,0x5E61,
- 0x808C,0x7551,0x7560,0x516B,0x9262,0x6E8C,0x767A,0x9197,
- 0x9AEA,0x4F10,0x7F70,0x629C,0x7B4F,0x95A5,0x9CE9,0x567A,
- 0x5859,0x86E4,0x96BC,0x4F34,0x5224,0x534A,0x53CD,0x53DB,
- 0x5E06,0x642C,0x6591,0x677F,0x6C3E,0x6C4E,0x7248,0x72AF,
- 0x73ED,0x7554,0x7E41,0x822C,0x85E9,0x8CA9,0x7BC4,0x91C6,
- 0x7169,0x9812,0x98EF,0x633D,0x6669,0x756A,0x76E4,0x78D0,
- 0x8543,0x86EE,0x532A,0x5351,0x5426,0x5983,0x5E87,0x5F7C,
- 0x60B2,0x6249,0x6279,0x62AB,0x6590,0x6BD4,0x6CCC,0x75B2,
- 0x76AE,0x7891,0x79D8,0x7DCB,0x7F77,0x80A5,0x88AB,0x8AB9,
- 0x8CBB,0x907F,0x975E,0x98DB,0x6A0B,0x7C38,0x5099,0x5C3E,
- 0x5FAE,0x6787,0x6BD8,0x7435,0x7709,0x7F8E,
-
- /* ku 41 */
- 0x9F3B,0x67CA,0x7A17,0x5339,0x758B,0x9AED,0x5F66,0x819D,
- 0x83F1,0x8098,0x5F3C,0x5FC5,0x7562,0x7B46,0x903C,0x6867,
- 0x59EB,0x5A9B,0x7D10,0x767E,0x8B2C,0x4FF5,0x5F6A,0x6A19,
- 0x6C37,0x6F02,0x74E2,0x7968,0x8868,0x8A55,0x8C79,0x5EDF,
- 0x63CF,0x75C5,0x79D2,0x82D7,0x9328,0x92F2,0x849C,0x86ED,
- 0x9C2D,0x54C1,0x5F6C,0x658C,0x6D5C,0x7015,0x8CA7,0x8CD3,
- 0x983B,0x654F,0x74F6,0x4E0D,0x4ED8,0x57E0,0x592B,0x5A66,
- 0x5BCC,0x51A8,0x5E03,0x5E9C,0x6016,0x6276,0x6577,0x65A7,
- 0x666E,0x6D6E,0x7236,0x7B26,0x8150,0x819A,0x8299,0x8B5C,
- 0x8CA0,0x8CE6,0x8D74,0x961C,0x9644,0x4FAE,0x64AB,0x6B66,
- 0x821E,0x8461,0x856A,0x90E8,0x5C01,0x6953,0x98A8,0x847A,
- 0x8557,0x4F0F,0x526F,0x5FA9,0x5E45,0x670D,
-
- /* ku 42 */
- 0x798F,0x8179,0x8907,0x8986,0x6DF5,0x5F17,0x6255,0x6CB8,
- 0x4ECF,0x7269,0x9B92,0x5206,0x543B,0x5674,0x58B3,0x61A4,
- 0x626E,0x711A,0x596E,0x7C89,0x7CDE,0x7D1B,0x96F0,0x6587,
- 0x805E,0x4E19,0x4F75,0x5175,0x5840,0x5E63,0x5E73,0x5F0A,
- 0x67C4,0x4E26,0x853D,0x9589,0x965B,0x7C73,0x9801,0x50FB,
- 0x58C1,0x7656,0x78A7,0x5225,0x77A5,0x8511,0x7B86,0x504F,
- 0x5909,0x7247,0x7BC7,0x7DE8,0x8FBA,0x8FD4,0x904D,0x4FBF,
- 0x52C9,0x5A29,0x5F01,0x97AD,0x4FDD,0x8217,0x92EA,0x5703,
- 0x6355,0x6B69,0x752B,0x88DC,0x8F14,0x7A42,0x52DF,0x5893,
- 0x6155,0x620A,0x66AE,0x6BCD,0x7C3F,0x83E9,0x5023,0x4FF8,
- 0x5305,0x5446,0x5831,0x5949,0x5B9D,0x5CF0,0x5CEF,0x5D29,
- 0x5E96,0x62B1,0x6367,0x653E,0x65B9,0x670B,
-
- /* ku 43 */
- 0x6CD5,0x6CE1,0x70F9,0x7832,0x7E2B,0x80DE,0x82B3,0x840C,
- 0x84EC,0x8702,0x8912,0x8A2A,0x8C4A,0x90A6,0x92D2,0x98FD,
- 0x9CF3,0x9D6C,0x4E4F,0x4EA1,0x508D,0x5256,0x574A,0x59A8,
- 0x5E3D,0x5FD8,0x5FD9,0x623F,0x66B4,0x671B,0x67D0,0x68D2,
- 0x5192,0x7D21,0x80AA,0x81A8,0x8B00,0x8C8C,0x8CBF,0x927E,
- 0x9632,0x5420,0x982C,0x5317,0x50D5,0x535C,0x58A8,0x64B2,
- 0x6734,0x7267,0x7766,0x7A46,0x91E6,0x52C3,0x6CA1,0x6B86,
- 0x5800,0x5E4C,0x5954,0x672C,0x7FFB,0x51E1,0x76C6,0x6469,
- 0x78E8,0x9B54,0x9EBB,0x57CB,0x59B9,0x6627,0x679A,0x6BCE,
- 0x54E9,0x69D9,0x5E55,0x819C,0x6795,0x9BAA,0x67FE,0x9C52,
- 0x685D,0x4EA6,0x4FE3,0x53C8,0x62B9,0x672B,0x6CAB,0x8FC4,
- 0x4FAD,0x7E6D,0x9EBF,0x4E07,0x6162,0x6E80,
-
- /* ku 44 */
- 0x6F2B,0x8513,0x5473,0x672A,0x9B45,0x5DF3,0x7B95,0x5CAC,
- 0x5BC6,0x871C,0x6E4A,0x84D1,0x7A14,0x8108,0x5999,0x7C8D,
- 0x6C11,0x7720,0x52D9,0x5922,0x7121,0x725F,0x77DB,0x9727,
- 0x9D61,0x690B,0x5A7F,0x5A18,0x51A5,0x540D,0x547D,0x660E,
- 0x76DF,0x8FF7,0x9298,0x9CF4,0x59EA,0x725D,0x6EC5,0x514D,
- 0x68C9,0x7DBF,0x7DEC,0x9762,0x9EBA,0x6478,0x6A21,0x8302,
- 0x5984,0x5B5F,0x6BDB,0x731B,0x76F2,0x7DB2,0x8017,0x8499,
- 0x5132,0x6728,0x9ED9,0x76EE,0x6762,0x52FF,0x9905,0x5C24,
- 0x623B,0x7C7E,0x8CB0,0x554F,0x60B6,0x7D0B,0x9580,0x5301,
- 0x4E5F,0x51B6,0x591C,0x723A,0x8036,0x91CE,0x5F25,0x77E2,
- 0x5384,0x5F79,0x7D04,0x85AC,0x8A33,0x8E8D,0x9756,0x67F3,
- 0x85AE,0x9453,0x6109,0x6108,0x6CB9,0x7652,
-
- /* ku 45 */
- 0x8AED,0x8F38,0x552F,0x4F51,0x512A,0x52C7,0x53CB,0x5BA5,
- 0x5E7D,0x60A0,0x6182,0x63D6,0x6709,0x67DA,0x6E67,0x6D8C,
- 0x7336,0x7337,0x7531,0x7950,0x88D5,0x8A98,0x904A,0x9091,
- 0x90F5,0x96C4,0x878D,0x5915,0x4E88,0x4F59,0x4E0E,0x8A89,
- 0x8F3F,0x9810,0x50AD,0x5E7C,0x5996,0x5BB9,0x5EB8,0x63DA,
- 0x63FA,0x64C1,0x66DC,0x694A,0x69D8,0x6D0B,0x6EB6,0x7194,
- 0x7528,0x7AAF,0x7F8A,0x8000,0x8449,0x84C9,0x8981,0x8B21,
- 0x8E0A,0x9065,0x967D,0x990A,0x617E,0x6291,0x6B32,0x6C83,
- 0x6D74,0x7FCC,0x7FFC,0x6DC0,0x7F85,0x87BA,0x88F8,0x6765,
- 0x83B1,0x983C,0x96F7,0x6D1B,0x7D61,0x843D,0x916A,0x4E71,
- 0x5375,0x5D50,0x6B04,0x6FEB,0x85CD,0x862D,0x89A7,0x5229,
- 0x540F,0x5C65,0x674E,0x68A8,0x7406,0x7483,
-
- /* ku 46 */
- 0x75E2,0x88CF,0x88E1,0x91CC,0x96E2,0x9678,0x5F8B,0x7387,
- 0x7ACB,0x844E,0x63A0,0x7565,0x5289,0x6D41,0x6E9C,0x7409,
- 0x7559,0x786B,0x7C92,0x9686,0x7ADC,0x9F8D,0x4FB6,0x616E,
- 0x65C5,0x865C,0x4E86,0x4EAE,0x50DA,0x4E21,0x51CC,0x5BEE,
- 0x6599,0x6881,0x6DBC,0x731F,0x7642,0x77AD,0x7A1C,0x7CE7,
- 0x826F,0x8AD2,0x907C,0x91CF,0x9675,0x9818,0x529B,0x7DD1,
- 0x502B,0x5398,0x6797,0x6DCB,0x71D0,0x7433,0x81E8,0x8F2A,
- 0x96A3,0x9C57,0x9E9F,0x7460,0x5841,0x6D99,0x7D2F,0x985E,
- 0x4EE4,0x4F36,0x4F8B,0x51B7,0x52B1,0x5DBA,0x601C,0x73B2,
- 0x793C,0x82D3,0x9234,0x96B7,0x96F6,0x970A,0x9E97,0x9F62,
- 0x66A6,0x6B74,0x5217,0x52A3,0x70C8,0x88C2,0x5EC9,0x604B,
- 0x6190,0x6F23,0x7149,0x7C3E,0x7DF4,0x806F,
-
- /* ku 47 */
- 0x84EE,0x9023,0x932C,0x5442,0x9B6F,0x6AD3,0x7089,0x8CC2,
- 0x8DEF,0x9732,0x52B4,0x5A41,0x5ECA,0x5F04,0x6717,0x697C,
- 0x6994,0x6D6A,0x6F0F,0x7262,0x72FC,0x7BED,0x8001,0x807E,
- 0x874B,0x90CE,0x516D,0x9E93,0x7984,0x808B,0x9332,0x8AD6,
- 0x502D,0x548C,0x8A71,0x6B6A,0x8CC4,0x8107,0x60D1,0x67A0,
- 0x9DF2,0x4E99,0x4E98,0x9C10,0x8A6B,0x85C1,0x8568,0x6900,
- 0x6E7E,0x7897,0x8155,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 48 */
- 0x5F0C,0x4E10,0x4E15,0x4E2A,0x4E31,0x4E36,0x4E3C,0x4E3F,
- 0x4E42,0x4E56,0x4E58,0x4E82,0x4E85,0x8C6B,0x4E8A,0x8212,
- 0x5F0D,0x4E8E,0x4E9E,0x4E9F,0x4EA0,0x4EA2,0x4EB0,0x4EB3,
- 0x4EB6,0x4ECE,0x4ECD,0x4EC4,0x4EC6,0x4EC2,0x4ED7,0x4EDE,
- 0x4EED,0x4EDF,0x4EF7,0x4F09,0x4F5A,0x4F30,0x4F5B,0x4F5D,
- 0x4F57,0x4F47,0x4F76,0x4F88,0x4F8F,0x4F98,0x4F7B,0x4F69,
- 0x4F70,0x4F91,0x4F6F,0x4F86,0x4F96,0x5118,0x4FD4,0x4FDF,
- 0x4FCE,0x4FD8,0x4FDB,0x4FD1,0x4FDA,0x4FD0,0x4FE4,0x4FE5,
- 0x501A,0x5028,0x5014,0x502A,0x5025,0x5005,0x4F1C,0x4FF6,
- 0x5021,0x5029,0x502C,0x4FFE,0x4FEF,0x5011,0x5006,0x5043,
- 0x5047,0x6703,0x5055,0x5050,0x5048,0x505A,0x5056,0x506C,
- 0x5078,0x5080,0x509A,0x5085,0x50B4,0x50B2,
-
- /* ku 49 */
- 0x50C9,0x50CA,0x50B3,0x50C2,0x50D6,0x50DE,0x50E5,0x50ED,
- 0x50E3,0x50EE,0x50F9,0x50F5,0x5109,0x5101,0x5102,0x5116,
- 0x5115,0x5114,0x511A,0x5121,0x513A,0x5137,0x513C,0x513B,
- 0x513F,0x5140,0x5152,0x514C,0x5154,0x5162,0x7AF8,0x5169,
- 0x516A,0x516E,0x5180,0x5182,0x56D8,0x518C,0x5189,0x518F,
- 0x5191,0x5193,0x5195,0x5196,0x51A4,0x51A6,0x51A2,0x51A9,
- 0x51AA,0x51AB,0x51B3,0x51B1,0x51B2,0x51B0,0x51B5,0x51BD,
- 0x51C5,0x51C9,0x51DB,0x51E0,0x8655,0x51E9,0x51ED,0x51F0,
- 0x51F5,0x51FE,0x5204,0x520B,0x5214,0x520E,0x5227,0x522A,
- 0x522E,0x5233,0x5239,0x524F,0x5244,0x524B,0x524C,0x525E,
- 0x5254,0x526A,0x5274,0x5269,0x5273,0x527F,0x527D,0x528D,
- 0x5294,0x5292,0x5271,0x5288,0x5291,0x8FA8,
-
- /* ku 50 */
- 0x8FA7,0x52AC,0x52AD,0x52BC,0x52B5,0x52C1,0x52CD,0x52D7,
- 0x52DE,0x52E3,0x52E6,0x98ED,0x52E0,0x52F3,0x52F5,0x52F8,
- 0x52F9,0x5306,0x5308,0x7538,0x530D,0x5310,0x530F,0x5315,
- 0x531A,0x5323,0x532F,0x5331,0x5333,0x5338,0x5340,0x5346,
- 0x5345,0x4E17,0x5349,0x534D,0x51D6,0x535E,0x5369,0x536E,
- 0x5918,0x537B,0x5377,0x5382,0x5396,0x53A0,0x53A6,0x53A5,
- 0x53AE,0x53B0,0x53B6,0x53C3,0x7C12,0x96D9,0x53DF,0x66FC,
- 0x71EE,0x53EE,0x53E8,0x53ED,0x53FA,0x5401,0x543D,0x5440,
- 0x542C,0x542D,0x543C,0x542E,0x5436,0x5429,0x541D,0x544E,
- 0x548F,0x5475,0x548E,0x545F,0x5471,0x5477,0x5470,0x5492,
- 0x547B,0x5480,0x5476,0x5484,0x5490,0x5486,0x54C7,0x54A2,
- 0x54B8,0x54A5,0x54AC,0x54C4,0x54C8,0x54A8,
-
- /* ku 51 */
- 0x54AB,0x54C2,0x54A4,0x54BE,0x54BC,0x54D8,0x54E5,0x54E6,
- 0x550F,0x5514,0x54FD,0x54EE,0x54ED,0x54FA,0x54E2,0x5539,
- 0x5540,0x5563,0x554C,0x552E,0x555C,0x5545,0x5556,0x5557,
- 0x5538,0x5533,0x555D,0x5599,0x5580,0x54AF,0x558A,0x559F,
- 0x557B,0x557E,0x5598,0x559E,0x55AE,0x557C,0x5583,0x55A9,
- 0x5587,0x55A8,0x55DA,0x55C5,0x55DF,0x55C4,0x55DC,0x55E4,
- 0x55D4,0x5614,0x55F7,0x5616,0x55FE,0x55FD,0x561B,0x55F9,
- 0x564E,0x5650,0x71DF,0x5634,0x5636,0x5632,0x5638,0x566B,
- 0x5664,0x562F,0x566C,0x566A,0x5686,0x5680,0x568A,0x56A0,
- 0x5694,0x568F,0x56A5,0x56AE,0x56B6,0x56B4,0x56C2,0x56BC,
- 0x56C1,0x56C3,0x56C0,0x56C8,0x56CE,0x56D1,0x56D3,0x56D7,
- 0x56EE,0x56F9,0x5700,0x56FF,0x5704,0x5709,
-
- /* ku 52 */
- 0x5708,0x570B,0x570D,0x5713,0x5718,0x5716,0x55C7,0x571C,
- 0x5726,0x5737,0x5738,0x574E,0x573B,0x5740,0x574F,0x5769,
- 0x57C0,0x5788,0x5761,0x577F,0x5789,0x5793,0x57A0,0x57B3,
- 0x57A4,0x57AA,0x57B0,0x57C3,0x57C6,0x57D4,0x57D2,0x57D3,
- 0x580A,0x57D6,0x57E3,0x580B,0x5819,0x581D,0x5872,0x5821,
- 0x5862,0x584B,0x5870,0x6BC0,0x5852,0x583D,0x5879,0x5885,
- 0x58B9,0x589F,0x58AB,0x58BA,0x58DE,0x58BB,0x58B8,0x58AE,
- 0x58C5,0x58D3,0x58D1,0x58D7,0x58D9,0x58D8,0x58E5,0x58DC,
- 0x58E4,0x58DF,0x58EF,0x58FA,0x58F9,0x58FB,0x58FC,0x58FD,
- 0x5902,0x590A,0x5910,0x591B,0x68A6,0x5925,0x592C,0x592D,
- 0x5932,0x5938,0x593E,0x7AD2,0x5955,0x5950,0x594E,0x595A,
- 0x5958,0x5962,0x5960,0x5967,0x596C,0x5969,
-
- /* ku 53 */
- 0x5978,0x5981,0x599D,0x4F5E,0x4FAB,0x59A3,0x59B2,0x59C6,
- 0x59E8,0x59DC,0x598D,0x59D9,0x59DA,0x5A25,0x5A1F,0x5A11,
- 0x5A1C,0x5A09,0x5A1A,0x5A40,0x5A6C,0x5A49,0x5A35,0x5A36,
- 0x5A62,0x5A6A,0x5A9A,0x5ABC,0x5ABE,0x5ACB,0x5AC2,0x5ABD,
- 0x5AE3,0x5AD7,0x5AE6,0x5AE9,0x5AD6,0x5AFA,0x5AFB,0x5B0C,
- 0x5B0B,0x5B16,0x5B32,0x5AD0,0x5B2A,0x5B36,0x5B3E,0x5B43,
- 0x5B45,0x5B40,0x5B51,0x5B55,0x5B5A,0x5B5B,0x5B65,0x5B69,
- 0x5B70,0x5B73,0x5B75,0x5B78,0x6588,0x5B7A,0x5B80,0x5B83,
- 0x5BA6,0x5BB8,0x5BC3,0x5BC7,0x5BC9,0x5BD4,0x5BD0,0x5BE4,
- 0x5BE6,0x5BE2,0x5BDE,0x5BE5,0x5BEB,0x5BF0,0x5BF6,0x5BF3,
- 0x5C05,0x5C07,0x5C08,0x5C0D,0x5C13,0x5C20,0x5C22,0x5C28,
- 0x5C38,0x5C39,0x5C41,0x5C46,0x5C4E,0x5C53,
-
- /* ku 54 */
- 0x5C50,0x5C4F,0x5B71,0x5C6C,0x5C6E,0x4E62,0x5C76,0x5C79,
- 0x5C8C,0x5C91,0x5C94,0x599B,0x5CAB,0x5CBB,0x5CB6,0x5CBC,
- 0x5CB7,0x5CC5,0x5CBE,0x5CC7,0x5CD9,0x5CE9,0x5CFD,0x5CFA,
- 0x5CED,0x5D8C,0x5CEA,0x5D0B,0x5D15,0x5D17,0x5D5C,0x5D1F,
- 0x5D1B,0x5D11,0x5D14,0x5D22,0x5D1A,0x5D19,0x5D18,0x5D4C,
- 0x5D52,0x5D4E,0x5D4B,0x5D6C,0x5D73,0x5D76,0x5D87,0x5D84,
- 0x5D82,0x5DA2,0x5D9D,0x5DAC,0x5DAE,0x5DBD,0x5D90,0x5DB7,
- 0x5DBC,0x5DC9,0x5DCD,0x5DD3,0x5DD2,0x5DD6,0x5DDB,0x5DEB,
- 0x5DF2,0x5DF5,0x5E0B,0x5E1A,0x5E19,0x5E11,0x5E1B,0x5E36,
- 0x5E37,0x5E44,0x5E43,0x5E40,0x5E4E,0x5E57,0x5E54,0x5E5F,
- 0x5E62,0x5E64,0x5E47,0x5E75,0x5E76,0x5E7A,0x9EBC,0x5E7F,
- 0x5EA0,0x5EC1,0x5EC2,0x5EC8,0x5ED0,0x5ECF,
-
- /* ku 55 */
- 0x5ED6,0x5EE3,0x5EDD,0x5EDA,0x5EDB,0x5EE2,0x5EE1,0x5EE8,
- 0x5EE9,0x5EEC,0x5EF1,0x5EF3,0x5EF0,0x5EF4,0x5EF8,0x5EFE,
- 0x5F03,0x5F09,0x5F5D,0x5F5C,0x5F0B,0x5F11,0x5F16,0x5F29,
- 0x5F2D,0x5F38,0x5F41,0x5F48,0x5F4C,0x5F4E,0x5F2F,0x5F51,
- 0x5F56,0x5F57,0x5F59,0x5F61,0x5F6D,0x5F73,0x5F77,0x5F83,
- 0x5F82,0x5F7F,0x5F8A,0x5F88,0x5F91,0x5F87,0x5F9E,0x5F99,
- 0x5F98,0x5FA0,0x5FA8,0x5FAD,0x5FBC,0x5FD6,0x5FFB,0x5FE4,
- 0x5FF8,0x5FF1,0x5FDD,0x60B3,0x5FFF,0x6021,0x6060,0x6019,
- 0x6010,0x6029,0x600E,0x6031,0x601B,0x6015,0x602B,0x6026,
- 0x600F,0x603A,0x605A,0x6041,0x606A,0x6077,0x605F,0x604A,
- 0x6046,0x604D,0x6063,0x6043,0x6064,0x6042,0x606C,0x606B,
- 0x6059,0x6081,0x608D,0x60E7,0x6083,0x609A,
-
- /* ku 56 */
- 0x6084,0x609B,0x6096,0x6097,0x6092,0x60A7,0x608B,0x60E1,
- 0x60B8,0x60E0,0x60D3,0x60B4,0x5FF0,0x60BD,0x60C6,0x60B5,
- 0x60D8,0x614D,0x6115,0x6106,0x60F6,0x60F7,0x6100,0x60F4,
- 0x60FA,0x6103,0x6121,0x60FB,0x60F1,0x610D,0x610E,0x6147,
- 0x613E,0x6128,0x6127,0x614A,0x613F,0x613C,0x612C,0x6134,
- 0x613D,0x6142,0x6144,0x6173,0x6177,0x6158,0x6159,0x615A,
- 0x616B,0x6174,0x616F,0x6165,0x6171,0x615F,0x615D,0x6153,
- 0x6175,0x6199,0x6196,0x6187,0x61AC,0x6194,0x619A,0x618A,
- 0x6191,0x61AB,0x61AE,0x61CC,0x61CA,0x61C9,0x61F7,0x61C8,
- 0x61C3,0x61C6,0x61BA,0x61CB,0x7F79,0x61CD,0x61E6,0x61E3,
- 0x61F6,0x61FA,0x61F4,0x61FF,0x61FD,0x61FC,0x61FE,0x6200,
- 0x6208,0x6209,0x620D,0x620C,0x6214,0x621B,
-
- /* ku 57 */
- 0x621E,0x6221,0x622A,0x622E,0x6230,0x6232,0x6233,0x6241,
- 0x624E,0x625E,0x6263,0x625B,0x6260,0x6268,0x627C,0x6282,
- 0x6289,0x627E,0x6292,0x6293,0x6296,0x62D4,0x6283,0x6294,
- 0x62D7,0x62D1,0x62BB,0x62CF,0x62FF,0x62C6,0x64D4,0x62C8,
- 0x62DC,0x62CC,0x62CA,0x62C2,0x62C7,0x629B,0x62C9,0x630C,
- 0x62EE,0x62F1,0x6327,0x6302,0x6308,0x62EF,0x62F5,0x6350,
- 0x633E,0x634D,0x641C,0x634F,0x6396,0x638E,0x6380,0x63AB,
- 0x6376,0x63A3,0x638F,0x6389,0x639F,0x63B5,0x636B,0x6369,
- 0x63BE,0x63E9,0x63C0,0x63C6,0x63E3,0x63C9,0x63D2,0x63F6,
- 0x63C4,0x6416,0x6434,0x6406,0x6413,0x6426,0x6436,0x651D,
- 0x6417,0x6428,0x640F,0x6467,0x646F,0x6476,0x644E,0x652A,
- 0x6495,0x6493,0x64A5,0x64A9,0x6488,0x64BC,
-
- /* ku 58 */
- 0x64DA,0x64D2,0x64C5,0x64C7,0x64BB,0x64D8,0x64C2,0x64F1,
- 0x64E7,0x8209,0x64E0,0x64E1,0x62AC,0x64E3,0x64EF,0x652C,
- 0x64F6,0x64F4,0x64F2,0x64FA,0x6500,0x64FD,0x6518,0x651C,
- 0x6505,0x6524,0x6523,0x652B,0x6534,0x6535,0x6537,0x6536,
- 0x6538,0x754B,0x6548,0x6556,0x6555,0x654D,0x6558,0x655E,
- 0x655D,0x6572,0x6578,0x6582,0x6583,0x8B8A,0x659B,0x659F,
- 0x65AB,0x65B7,0x65C3,0x65C6,0x65C1,0x65C4,0x65CC,0x65D2,
- 0x65DB,0x65D9,0x65E0,0x65E1,0x65F1,0x6772,0x660A,0x6603,
- 0x65FB,0x6773,0x6635,0x6636,0x6634,0x661C,0x664F,0x6644,
- 0x6649,0x6641,0x665E,0x665D,0x6664,0x6667,0x6668,0x665F,
- 0x6662,0x6670,0x6683,0x6688,0x668E,0x6689,0x6684,0x6698,
- 0x669D,0x66C1,0x66B9,0x66C9,0x66BE,0x66BC,
-
- /* ku 59 */
- 0x66C4,0x66B8,0x66D6,0x66DA,0x66E0,0x663F,0x66E6,0x66E9,
- 0x66F0,0x66F5,0x66F7,0x670F,0x6716,0x671E,0x6726,0x6727,
- 0x9738,0x672E,0x673F,0x6736,0x6741,0x6738,0x6737,0x6746,
- 0x675E,0x6760,0x6759,0x6763,0x6764,0x6789,0x6770,0x67A9,
- 0x677C,0x676A,0x678C,0x678B,0x67A6,0x67A1,0x6785,0x67B7,
- 0x67EF,0x67B4,0x67EC,0x67B3,0x67E9,0x67B8,0x67E4,0x67DE,
- 0x67DD,0x67E2,0x67EE,0x67B9,0x67CE,0x67C6,0x67E7,0x6A9C,
- 0x681E,0x6846,0x6829,0x6840,0x684D,0x6832,0x684E,0x68B3,
- 0x682B,0x6859,0x6863,0x6877,0x687F,0x689F,0x688F,0x68AD,
- 0x6894,0x689D,0x689B,0x6883,0x6AAE,0x68B9,0x6874,0x68B5,
- 0x68A0,0x68BA,0x690F,0x688D,0x687E,0x6901,0x68CA,0x6908,
- 0x68D8,0x6922,0x6926,0x68E1,0x690C,0x68CD,
-
- /* ku 60 */
- 0x68D4,0x68E7,0x68D5,0x6936,0x6912,0x6904,0x68D7,0x68E3,
- 0x6925,0x68F9,0x68E0,0x68EF,0x6928,0x692A,0x691A,0x6923,
- 0x6921,0x68C6,0x6979,0x6977,0x695C,0x6978,0x696B,0x6954,
- 0x697E,0x696E,0x6939,0x6974,0x693D,0x6959,0x6930,0x6961,
- 0x695E,0x695D,0x6981,0x696A,0x69B2,0x69AE,0x69D0,0x69BF,
- 0x69C1,0x69D3,0x69BE,0x69CE,0x5BE8,0x69CA,0x69DD,0x69BB,
- 0x69C3,0x69A7,0x6A2E,0x6991,0x69A0,0x699C,0x6995,0x69B4,
- 0x69DE,0x69E8,0x6A02,0x6A1B,0x69FF,0x6B0A,0x69F9,0x69F2,
- 0x69E7,0x6A05,0x69B1,0x6A1E,0x69ED,0x6A14,0x69EB,0x6A0A,
- 0x6A12,0x6AC1,0x6A23,0x6A13,0x6A44,0x6A0C,0x6A72,0x6A36,
- 0x6A78,0x6A47,0x6A62,0x6A59,0x6A66,0x6A48,0x6A38,0x6A22,
- 0x6A90,0x6A8D,0x6AA0,0x6A84,0x6AA2,0x6AA3,
-
- /* ku 61 */
- 0x6A97,0x8617,0x6ABB,0x6AC3,0x6AC2,0x6AB8,0x6AB3,0x6AAC,
- 0x6ADE,0x6AD1,0x6ADF,0x6AAA,0x6ADA,0x6AEA,0x6AFB,0x6B05,
- 0x8616,0x6AFA,0x6B12,0x6B16,0x9B31,0x6B1F,0x6B38,0x6B37,
- 0x76DC,0x6B39,0x98EE,0x6B47,0x6B43,0x6B49,0x6B50,0x6B59,
- 0x6B54,0x6B5B,0x6B5F,0x6B61,0x6B78,0x6B79,0x6B7F,0x6B80,
- 0x6B84,0x6B83,0x6B8D,0x6B98,0x6B95,0x6B9E,0x6BA4,0x6BAA,
- 0x6BAB,0x6BAF,0x6BB2,0x6BB1,0x6BB3,0x6BB7,0x6BBC,0x6BC6,
- 0x6BCB,0x6BD3,0x6BDF,0x6BEC,0x6BEB,0x6BF3,0x6BEF,0x9EBE,
- 0x6C08,0x6C13,0x6C14,0x6C1B,0x6C24,0x6C23,0x6C5E,0x6C55,
- 0x6C62,0x6C6A,0x6C82,0x6C8D,0x6C9A,0x6C81,0x6C9B,0x6C7E,
- 0x6C68,0x6C73,0x6C92,0x6C90,0x6CC4,0x6CF1,0x6CD3,0x6CBD,
- 0x6CD7,0x6CC5,0x6CDD,0x6CAE,0x6CB1,0x6CBE,
-
- /* ku 62 */
- 0x6CBA,0x6CDB,0x6CEF,0x6CD9,0x6CEA,0x6D1F,0x884D,0x6D36,
- 0x6D2B,0x6D3D,0x6D38,0x6D19,0x6D35,0x6D33,0x6D12,0x6D0C,
- 0x6D63,0x6D93,0x6D64,0x6D5A,0x6D79,0x6D59,0x6D8E,0x6D95,
- 0x6FE4,0x6D85,0x6DF9,0x6E15,0x6E0A,0x6DB5,0x6DC7,0x6DE6,
- 0x6DB8,0x6DC6,0x6DEC,0x6DDE,0x6DCC,0x6DE8,0x6DD2,0x6DC5,
- 0x6DFA,0x6DD9,0x6DE4,0x6DD5,0x6DEA,0x6DEE,0x6E2D,0x6E6E,
- 0x6E2E,0x6E19,0x6E72,0x6E5F,0x6E3E,0x6E23,0x6E6B,0x6E2B,
- 0x6E76,0x6E4D,0x6E1F,0x6E43,0x6E3A,0x6E4E,0x6E24,0x6EFF,
- 0x6E1D,0x6E38,0x6E82,0x6EAA,0x6E98,0x6EC9,0x6EB7,0x6ED3,
- 0x6EBD,0x6EAF,0x6EC4,0x6EB2,0x6ED4,0x6ED5,0x6E8F,0x6EA5,
- 0x6EC2,0x6E9F,0x6F41,0x6F11,0x704C,0x6EEC,0x6EF8,0x6EFE,
- 0x6F3F,0x6EF2,0x6F31,0x6EEF,0x6F32,0x6ECC,
-
- /* ku 63 */
- 0x6F3E,0x6F13,0x6EF7,0x6F86,0x6F7A,0x6F78,0x6F81,0x6F80,
- 0x6F6F,0x6F5B,0x6FF3,0x6F6D,0x6F82,0x6F7C,0x6F58,0x6F8E,
- 0x6F91,0x6FC2,0x6F66,0x6FB3,0x6FA3,0x6FA1,0x6FA4,0x6FB9,
- 0x6FC6,0x6FAA,0x6FDF,0x6FD5,0x6FEC,0x6FD4,0x6FD8,0x6FF1,
- 0x6FEE,0x6FDB,0x7009,0x700B,0x6FFA,0x7011,0x7001,0x700F,
- 0x6FFE,0x701B,0x701A,0x6F74,0x701D,0x7018,0x701F,0x7030,
- 0x703E,0x7032,0x7051,0x7063,0x7099,0x7092,0x70AF,0x70F1,
- 0x70AC,0x70B8,0x70B3,0x70AE,0x70DF,0x70CB,0x70DD,0x70D9,
- 0x7109,0x70FD,0x711C,0x7119,0x7165,0x7155,0x7188,0x7166,
- 0x7162,0x714C,0x7156,0x716C,0x718F,0x71FB,0x7184,0x7195,
- 0x71A8,0x71AC,0x71D7,0x71B9,0x71BE,0x71D2,0x71C9,0x71D4,
- 0x71CE,0x71E0,0x71EC,0x71E7,0x71F5,0x71FC,
-
- /* ku 64 */
- 0x71F9,0x71FF,0x720D,0x7210,0x721B,0x7228,0x722D,0x722C,
- 0x7230,0x7232,0x723B,0x723C,0x723F,0x7240,0x7246,0x724B,
- 0x7258,0x7274,0x727E,0x7282,0x7281,0x7287,0x7292,0x7296,
- 0x72A2,0x72A7,0x72B9,0x72B2,0x72C3,0x72C6,0x72C4,0x72CE,
- 0x72D2,0x72E2,0x72E0,0x72E1,0x72F9,0x72F7,0x500F,0x7317,
- 0x730A,0x731C,0x7316,0x731D,0x7334,0x732F,0x7329,0x7325,
- 0x733E,0x734E,0x734F,0x9ED8,0x7357,0x736A,0x7368,0x7370,
- 0x7378,0x7375,0x737B,0x737A,0x73C8,0x73B3,0x73CE,0x73BB,
- 0x73C0,0x73E5,0x73EE,0x73DE,0x74A2,0x7405,0x746F,0x7425,
- 0x73F8,0x7432,0x743A,0x7455,0x743F,0x745F,0x7459,0x7441,
- 0x745C,0x7469,0x7470,0x7463,0x746A,0x7476,0x747E,0x748B,
- 0x749E,0x74A7,0x74CA,0x74CF,0x74D4,0x73F1,
-
- /* ku 65 */
- 0x74E0,0x74E3,0x74E7,0x74E9,0x74EE,0x74F2,0x74F0,0x74F1,
- 0x74F8,0x74F7,0x7504,0x7503,0x7505,0x750C,0x750E,0x750D,
- 0x7515,0x7513,0x751E,0x7526,0x752C,0x753C,0x7544,0x754D,
- 0x754A,0x7549,0x755B,0x7546,0x755A,0x7569,0x7564,0x7567,
- 0x756B,0x756D,0x7578,0x7576,0x7586,0x7587,0x7574,0x758A,
- 0x7589,0x7582,0x7594,0x759A,0x759D,0x75A5,0x75A3,0x75C2,
- 0x75B3,0x75C3,0x75B5,0x75BD,0x75B8,0x75BC,0x75B1,0x75CD,
- 0x75CA,0x75D2,0x75D9,0x75E3,0x75DE,0x75FE,0x75FF,0x75FC,
- 0x7601,0x75F0,0x75FA,0x75F2,0x75F3,0x760B,0x760D,0x7609,
- 0x761F,0x7627,0x7620,0x7621,0x7622,0x7624,0x7634,0x7630,
- 0x763B,0x7647,0x7648,0x7646,0x765C,0x7658,0x7661,0x7662,
- 0x7668,0x7669,0x766A,0x7667,0x766C,0x7670,
-
- /* ku 66 */
- 0x7672,0x7676,0x7678,0x767C,0x7680,0x7683,0x7688,0x768B,
- 0x768E,0x7696,0x7693,0x7699,0x769A,0x76B0,0x76B4,0x76B8,
- 0x76B9,0x76BA,0x76C2,0x76CD,0x76D6,0x76D2,0x76DE,0x76E1,
- 0x76E5,0x76E7,0x76EA,0x862F,0x76FB,0x7708,0x7707,0x7704,
- 0x7729,0x7724,0x771E,0x7725,0x7726,0x771B,0x7737,0x7738,
- 0x7747,0x775A,0x7768,0x776B,0x775B,0x7765,0x777F,0x777E,
- 0x7779,0x778E,0x778B,0x7791,0x77A0,0x779E,0x77B0,0x77B6,
- 0x77B9,0x77BF,0x77BC,0x77BD,0x77BB,0x77C7,0x77CD,0x77D7,
- 0x77DA,0x77DC,0x77E3,0x77EE,0x77FC,0x780C,0x7812,0x7926,
- 0x7820,0x792A,0x7845,0x788E,0x7874,0x7886,0x787C,0x789A,
- 0x788C,0x78A3,0x78B5,0x78AA,0x78AF,0x78D1,0x78C6,0x78CB,
- 0x78D4,0x78BE,0x78BC,0x78C5,0x78CA,0x78EC,
-
- /* ku 67 */
- 0x78E7,0x78DA,0x78FD,0x78F4,0x7907,0x7912,0x7911,0x7919,
- 0x792C,0x792B,0x7940,0x7960,0x7957,0x795F,0x795A,0x7955,
- 0x7953,0x797A,0x797F,0x798A,0x799D,0x79A7,0x9F4B,0x79AA,
- 0x79AE,0x79B3,0x79B9,0x79BA,0x79C9,0x79D5,0x79E7,0x79EC,
- 0x79E1,0x79E3,0x7A08,0x7A0D,0x7A18,0x7A19,0x7A20,0x7A1F,
- 0x7980,0x7A31,0x7A3B,0x7A3E,0x7A37,0x7A43,0x7A57,0x7A49,
- 0x7A61,0x7A62,0x7A69,0x9F9D,0x7A70,0x7A79,0x7A7D,0x7A88,
- 0x7A97,0x7A95,0x7A98,0x7A96,0x7AA9,0x7AC8,0x7AB0,0x7AB6,
- 0x7AC5,0x7AC4,0x7ABF,0x9083,0x7AC7,0x7ACA,0x7ACD,0x7ACF,
- 0x7AD5,0x7AD3,0x7AD9,0x7ADA,0x7ADD,0x7AE1,0x7AE2,0x7AE6,
- 0x7AED,0x7AF0,0x7B02,0x7B0F,0x7B0A,0x7B06,0x7B33,0x7B18,
- 0x7B19,0x7B1E,0x7B35,0x7B28,0x7B36,0x7B50,
-
- /* ku 68 */
- 0x7B7A,0x7B04,0x7B4D,0x7B0B,0x7B4C,0x7B45,0x7B75,0x7B65,
- 0x7B74,0x7B67,0x7B70,0x7B71,0x7B6C,0x7B6E,0x7B9D,0x7B98,
- 0x7B9F,0x7B8D,0x7B9C,0x7B9A,0x7B8B,0x7B92,0x7B8F,0x7B5D,
- 0x7B99,0x7BCB,0x7BC1,0x7BCC,0x7BCF,0x7BB4,0x7BC6,0x7BDD,
- 0x7BE9,0x7C11,0x7C14,0x7BE6,0x7BE5,0x7C60,0x7C00,0x7C07,
- 0x7C13,0x7BF3,0x7BF7,0x7C17,0x7C0D,0x7BF6,0x7C23,0x7C27,
- 0x7C2A,0x7C1F,0x7C37,0x7C2B,0x7C3D,0x7C4C,0x7C43,0x7C54,
- 0x7C4F,0x7C40,0x7C50,0x7C58,0x7C5F,0x7C64,0x7C56,0x7C65,
- 0x7C6C,0x7C75,0x7C83,0x7C90,0x7CA4,0x7CAD,0x7CA2,0x7CAB,
- 0x7CA1,0x7CA8,0x7CB3,0x7CB2,0x7CB1,0x7CAE,0x7CB9,0x7CBD,
- 0x7CC0,0x7CC5,0x7CC2,0x7CD8,0x7CD2,0x7CDC,0x7CE2,0x9B3B,
- 0x7CEF,0x7CF2,0x7CF4,0x7CF6,0x7CFA,0x7D06,
-
- /* ku 69 */
- 0x7D02,0x7D1C,0x7D15,0x7D0A,0x7D45,0x7D4B,0x7D2E,0x7D32,
- 0x7D3F,0x7D35,0x7D46,0x7D73,0x7D56,0x7D4E,0x7D72,0x7D68,
- 0x7D6E,0x7D4F,0x7D63,0x7D93,0x7D89,0x7D5B,0x7D8F,0x7D7D,
- 0x7D9B,0x7DBA,0x7DAE,0x7DA3,0x7DB5,0x7DC7,0x7DBD,0x7DAB,
- 0x7E3D,0x7DA2,0x7DAF,0x7DDC,0x7DB8,0x7D9F,0x7DB0,0x7DD8,
- 0x7DDD,0x7DE4,0x7DDE,0x7DFB,0x7DF2,0x7DE1,0x7E05,0x7E0A,
- 0x7E23,0x7E21,0x7E12,0x7E31,0x7E1F,0x7E09,0x7E0B,0x7E22,
- 0x7E46,0x7E66,0x7E3B,0x7E35,0x7E39,0x7E43,0x7E37,0x7E32,
- 0x7E3A,0x7E67,0x7E5D,0x7E56,0x7E5E,0x7E59,0x7E5A,0x7E79,
- 0x7E6A,0x7E69,0x7E7C,0x7E7B,0x7E83,0x7DD5,0x7E7D,0x8FAE,
- 0x7E7F,0x7E88,0x7E89,0x7E8C,0x7E92,0x7E90,0x7E93,0x7E94,
- 0x7E96,0x7E8E,0x7E9B,0x7E9C,0x7F38,0x7F3A,
-
- /* ku 70 */
- 0x7F45,0x7F4C,0x7F4D,0x7F4E,0x7F50,0x7F51,0x7F55,0x7F54,
- 0x7F58,0x7F5F,0x7F60,0x7F68,0x7F69,0x7F67,0x7F78,0x7F82,
- 0x7F86,0x7F83,0x7F88,0x7F87,0x7F8C,0x7F94,0x7F9E,0x7F9D,
- 0x7F9A,0x7FA3,0x7FAF,0x7FB2,0x7FB9,0x7FAE,0x7FB6,0x7FB8,
- 0x8B71,0x7FC5,0x7FC6,0x7FCA,0x7FD5,0x7FD4,0x7FE1,0x7FE6,
- 0x7FE9,0x7FF3,0x7FF9,0x98DC,0x8006,0x8004,0x800B,0x8012,
- 0x8018,0x8019,0x801C,0x8021,0x8028,0x803F,0x803B,0x804A,
- 0x8046,0x8052,0x8058,0x805A,0x805F,0x8062,0x8068,0x8073,
- 0x8072,0x8070,0x8076,0x8079,0x807D,0x807F,0x8084,0x8086,
- 0x8085,0x809B,0x8093,0x809A,0x80AD,0x5190,0x80AC,0x80DB,
- 0x80E5,0x80D9,0x80DD,0x80C4,0x80DA,0x80D6,0x8109,0x80EF,
- 0x80F1,0x811B,0x8129,0x8123,0x812F,0x814B,
-
- /* ku 71 */
- 0x968B,0x8146,0x813E,0x8153,0x8151,0x80FC,0x8171,0x816E,
- 0x8165,0x8166,0x8174,0x8183,0x8188,0x818A,0x8180,0x8182,
- 0x81A0,0x8195,0x81A4,0x81A3,0x815F,0x8193,0x81A9,0x81B0,
- 0x81B5,0x81BE,0x81B8,0x81BD,0x81C0,0x81C2,0x81BA,0x81C9,
- 0x81CD,0x81D1,0x81D9,0x81D8,0x81C8,0x81DA,0x81DF,0x81E0,
- 0x81E7,0x81FA,0x81FB,0x81FE,0x8201,0x8202,0x8205,0x8207,
- 0x820A,0x820D,0x8210,0x8216,0x8229,0x822B,0x8238,0x8233,
- 0x8240,0x8259,0x8258,0x825D,0x825A,0x825F,0x8264,0x8262,
- 0x8268,0x826A,0x826B,0x822E,0x8271,0x8277,0x8278,0x827E,
- 0x828D,0x8292,0x82AB,0x829F,0x82BB,0x82AC,0x82E1,0x82E3,
- 0x82DF,0x82D2,0x82F4,0x82F3,0x82FA,0x8393,0x8303,0x82FB,
- 0x82F9,0x82DE,0x8306,0x82DC,0x8309,0x82D9,
-
- /* ku 72 */
- 0x8335,0x8334,0x8316,0x8332,0x8331,0x8340,0x8339,0x8350,
- 0x8345,0x832F,0x832B,0x8317,0x8318,0x8385,0x839A,0x83AA,
- 0x839F,0x83A2,0x8396,0x8323,0x838E,0x8387,0x838A,0x837C,
- 0x83B5,0x8373,0x8375,0x83A0,0x8389,0x83A8,0x83F4,0x8413,
- 0x83EB,0x83CE,0x83FD,0x8403,0x83D8,0x840B,0x83C1,0x83F7,
- 0x8407,0x83E0,0x83F2,0x840D,0x8422,0x8420,0x83BD,0x8438,
- 0x8506,0x83FB,0x846D,0x842A,0x843C,0x855A,0x8484,0x8477,
- 0x846B,0x84AD,0x846E,0x8482,0x8469,0x8446,0x842C,0x846F,
- 0x8479,0x8435,0x84CA,0x8462,0x84B9,0x84BF,0x849F,0x84D9,
- 0x84CD,0x84BB,0x84DA,0x84D0,0x84C1,0x84C6,0x84D6,0x84A1,
- 0x8521,0x84FF,0x84F4,0x8517,0x8518,0x852C,0x851F,0x8515,
- 0x8514,0x84FC,0x8540,0x8563,0x8558,0x8548,
-
- /* ku 73 */
- 0x8541,0x8602,0x854B,0x8555,0x8580,0x85A4,0x8588,0x8591,
- 0x858A,0x85A8,0x856D,0x8594,0x859B,0x85EA,0x8587,0x859C,
- 0x8577,0x857E,0x8590,0x85C9,0x85BA,0x85CF,0x85B9,0x85D0,
- 0x85D5,0x85DD,0x85E5,0x85DC,0x85F9,0x860A,0x8613,0x860B,
- 0x85FE,0x85FA,0x8606,0x8622,0x861A,0x8630,0x863F,0x864D,
- 0x4E55,0x8654,0x865F,0x8667,0x8671,0x8693,0x86A3,0x86A9,
- 0x86AA,0x868B,0x868C,0x86B6,0x86AF,0x86C4,0x86C6,0x86B0,
- 0x86C9,0x8823,0x86AB,0x86D4,0x86DE,0x86E9,0x86EC,0x86DF,
- 0x86DB,0x86EF,0x8712,0x8706,0x8708,0x8700,0x8703,0x86FB,
- 0x8711,0x8709,0x870D,0x86F9,0x870A,0x8734,0x873F,0x8737,
- 0x873B,0x8725,0x8729,0x871A,0x8760,0x875F,0x8778,0x874C,
- 0x874E,0x8774,0x8757,0x8768,0x876E,0x8759,
-
- /* ku 74 */
- 0x8753,0x8763,0x876A,0x8805,0x87A2,0x879F,0x8782,0x87AF,
- 0x87CB,0x87BD,0x87C0,0x87D0,0x96D6,0x87AB,0x87C4,0x87B3,
- 0x87C7,0x87C6,0x87BB,0x87EF,0x87F2,0x87E0,0x880F,0x880D,
- 0x87FE,0x87F6,0x87F7,0x880E,0x87D2,0x8811,0x8816,0x8815,
- 0x8822,0x8821,0x8831,0x8836,0x8839,0x8827,0x883B,0x8844,
- 0x8842,0x8852,0x8859,0x885E,0x8862,0x886B,0x8881,0x887E,
- 0x889E,0x8875,0x887D,0x88B5,0x8872,0x8882,0x8897,0x8892,
- 0x88AE,0x8899,0x88A2,0x888D,0x88A4,0x88B0,0x88BF,0x88B1,
- 0x88C3,0x88C4,0x88D4,0x88D8,0x88D9,0x88DD,0x88F9,0x8902,
- 0x88FC,0x88F4,0x88E8,0x88F2,0x8904,0x890C,0x890A,0x8913,
- 0x8943,0x891E,0x8925,0x892A,0x892B,0x8941,0x8944,0x893B,
- 0x8936,0x8938,0x894C,0x891D,0x8960,0x895E,
-
- /* ku 75 */
- 0x8966,0x8964,0x896D,0x896A,0x896F,0x8974,0x8977,0x897E,
- 0x8983,0x8988,0x898A,0x8993,0x8998,0x89A1,0x89A9,0x89A6,
- 0x89AC,0x89AF,0x89B2,0x89BA,0x89BD,0x89BF,0x89C0,0x89DA,
- 0x89DC,0x89DD,0x89E7,0x89F4,0x89F8,0x8A03,0x8A16,0x8A10,
- 0x8A0C,0x8A1B,0x8A1D,0x8A25,0x8A36,0x8A41,0x8A5B,0x8A52,
- 0x8A46,0x8A48,0x8A7C,0x8A6D,0x8A6C,0x8A62,0x8A85,0x8A82,
- 0x8A84,0x8AA8,0x8AA1,0x8A91,0x8AA5,0x8AA6,0x8A9A,0x8AA3,
- 0x8AC4,0x8ACD,0x8AC2,0x8ADA,0x8AEB,0x8AF3,0x8AE7,0x8AE4,
- 0x8AF1,0x8B14,0x8AE0,0x8AE2,0x8AF7,0x8ADE,0x8ADB,0x8B0C,
- 0x8B07,0x8B1A,0x8AE1,0x8B16,0x8B10,0x8B17,0x8B20,0x8B33,
- 0x97AB,0x8B26,0x8B2B,0x8B3E,0x8B28,0x8B41,0x8B4C,0x8B4F,
- 0x8B4E,0x8B49,0x8B56,0x8B5B,0x8B5A,0x8B6B,
-
- /* ku 76 */
- 0x8B5F,0x8B6C,0x8B6F,0x8B74,0x8B7D,0x8B80,0x8B8C,0x8B8E,
- 0x8B92,0x8B93,0x8B96,0x8B99,0x8B9A,0x8C3A,0x8C41,0x8C3F,
- 0x8C48,0x8C4C,0x8C4E,0x8C50,0x8C55,0x8C62,0x8C6C,0x8C78,
- 0x8C7A,0x8C82,0x8C89,0x8C85,0x8C8A,0x8C8D,0x8C8E,0x8C94,
- 0x8C7C,0x8C98,0x621D,0x8CAD,0x8CAA,0x8CBD,0x8CB2,0x8CB3,
- 0x8CAE,0x8CB6,0x8CC8,0x8CC1,0x8CE4,0x8CE3,0x8CDA,0x8CFD,
- 0x8CFA,0x8CFB,0x8D04,0x8D05,0x8D0A,0x8D07,0x8D0F,0x8D0D,
- 0x8D10,0x9F4E,0x8D13,0x8CCD,0x8D14,0x8D16,0x8D67,0x8D6D,
- 0x8D71,0x8D73,0x8D81,0x8D99,0x8DC2,0x8DBE,0x8DBA,0x8DCF,
- 0x8DDA,0x8DD6,0x8DCC,0x8DDB,0x8DCB,0x8DEA,0x8DEB,0x8DDF,
- 0x8DE3,0x8DFC,0x8E08,0x8E09,0x8DFF,0x8E1D,0x8E1E,0x8E10,
- 0x8E1F,0x8E42,0x8E35,0x8E30,0x8E34,0x8E4A,
-
- /* ku 77 */
- 0x8E47,0x8E49,0x8E4C,0x8E50,0x8E48,0x8E59,0x8E64,0x8E60,
- 0x8E2A,0x8E63,0x8E55,0x8E76,0x8E72,0x8E7C,0x8E81,0x8E87,
- 0x8E85,0x8E84,0x8E8B,0x8E8A,0x8E93,0x8E91,0x8E94,0x8E99,
- 0x8EAA,0x8EA1,0x8EAC,0x8EB0,0x8EC6,0x8EB1,0x8EBE,0x8EC5,
- 0x8EC8,0x8ECB,0x8EDB,0x8EE3,0x8EFC,0x8EFB,0x8EEB,0x8EFE,
- 0x8F0A,0x8F05,0x8F15,0x8F12,0x8F19,0x8F13,0x8F1C,0x8F1F,
- 0x8F1B,0x8F0C,0x8F26,0x8F33,0x8F3B,0x8F39,0x8F45,0x8F42,
- 0x8F3E,0x8F4C,0x8F49,0x8F46,0x8F4E,0x8F57,0x8F5C,0x8F62,
- 0x8F63,0x8F64,0x8F9C,0x8F9F,0x8FA3,0x8FAD,0x8FAF,0x8FB7,
- 0x8FDA,0x8FE5,0x8FE2,0x8FEA,0x8FEF,0x9087,0x8FF4,0x9005,
- 0x8FF9,0x8FFA,0x9011,0x9015,0x9021,0x900D,0x901E,0x9016,
- 0x900B,0x9027,0x9036,0x9035,0x9039,0x8FF8,
-
- /* ku 78 */
- 0x904F,0x9050,0x9051,0x9052,0x900E,0x9049,0x903E,0x9056,
- 0x9058,0x905E,0x9068,0x906F,0x9076,0x96A8,0x9072,0x9082,
- 0x907D,0x9081,0x9080,0x908A,0x9089,0x908F,0x90A8,0x90AF,
- 0x90B1,0x90B5,0x90E2,0x90E4,0x6248,0x90DB,0x9102,0x9112,
- 0x9119,0x9132,0x9130,0x914A,0x9156,0x9158,0x9163,0x9165,
- 0x9169,0x9173,0x9172,0x918B,0x9189,0x9182,0x91A2,0x91AB,
- 0x91AF,0x91AA,0x91B5,0x91B4,0x91BA,0x91C0,0x91C1,0x91C9,
- 0x91CB,0x91D0,0x91D6,0x91DF,0x91E1,0x91DB,0x91FC,0x91F5,
- 0x91F6,0x921E,0x91FF,0x9214,0x922C,0x9215,0x9211,0x925E,
- 0x9257,0x9245,0x9249,0x9264,0x9248,0x9295,0x923F,0x924B,
- 0x9250,0x929C,0x9296,0x9293,0x929B,0x925A,0x92CF,0x92B9,
- 0x92B7,0x92E9,0x930F,0x92FA,0x9344,0x932E,
-
- /* ku 79 */
- 0x9319,0x9322,0x931A,0x9323,0x933A,0x9335,0x933B,0x935C,
- 0x9360,0x937C,0x936E,0x9356,0x93B0,0x93AC,0x93AD,0x9394,
- 0x93B9,0x93D6,0x93D7,0x93E8,0x93E5,0x93D8,0x93C3,0x93DD,
- 0x93D0,0x93C8,0x93E4,0x941A,0x9414,0x9413,0x9403,0x9407,
- 0x9410,0x9436,0x942B,0x9435,0x9421,0x943A,0x9441,0x9452,
- 0x9444,0x945B,0x9460,0x9462,0x945E,0x946A,0x9229,0x9470,
- 0x9475,0x9477,0x947D,0x945A,0x947C,0x947E,0x9481,0x947F,
- 0x9582,0x9587,0x958A,0x9594,0x9596,0x9598,0x9599,0x95A0,
- 0x95A8,0x95A7,0x95AD,0x95BC,0x95BB,0x95B9,0x95BE,0x95CA,
- 0x6FF6,0x95C3,0x95CD,0x95CC,0x95D5,0x95D4,0x95D6,0x95DC,
- 0x95E1,0x95E5,0x95E2,0x9621,0x9628,0x962E,0x962F,0x9642,
- 0x964C,0x964F,0x964B,0x9677,0x965C,0x965E,
-
- /* ku 80 */
- 0x965D,0x965F,0x9666,0x9672,0x966C,0x968D,0x9698,0x9695,
- 0x9697,0x96AA,0x96A7,0x96B1,0x96B2,0x96B0,0x96B4,0x96B6,
- 0x96B8,0x96B9,0x96CE,0x96CB,0x96C9,0x96CD,0x894D,0x96DC,
- 0x970D,0x96D5,0x96F9,0x9704,0x9706,0x9708,0x9713,0x970E,
- 0x9711,0x970F,0x9716,0x9719,0x9724,0x972A,0x9730,0x9739,
- 0x973D,0x973E,0x9744,0x9746,0x9748,0x9742,0x9749,0x975C,
- 0x9760,0x9764,0x9766,0x9768,0x52D2,0x976B,0x9771,0x9779,
- 0x9785,0x977C,0x9781,0x977A,0x9786,0x978B,0x978F,0x9790,
- 0x979C,0x97A8,0x97A6,0x97A3,0x97B3,0x97B4,0x97C3,0x97C6,
- 0x97C8,0x97CB,0x97DC,0x97ED,0x9F4F,0x97F2,0x7ADF,0x97F6,
- 0x97F5,0x980F,0x980C,0x9838,0x9824,0x9821,0x9837,0x983D,
- 0x9846,0x984F,0x984B,0x986B,0x986F,0x9870,
-
- /* ku 81 */
- 0x9871,0x9874,0x9873,0x98AA,0x98AF,0x98B1,0x98B6,0x98C4,
- 0x98C3,0x98C6,0x98E9,0x98EB,0x9903,0x9909,0x9912,0x9914,
- 0x9918,0x9921,0x991D,0x991E,0x9924,0x9920,0x992C,0x992E,
- 0x993D,0x993E,0x9942,0x9949,0x9945,0x9950,0x994B,0x9951,
- 0x9952,0x994C,0x9955,0x9997,0x9998,0x99A5,0x99AD,0x99AE,
- 0x99BC,0x99DF,0x99DB,0x99DD,0x99D8,0x99D1,0x99ED,0x99EE,
- 0x99F1,0x99F2,0x99FB,0x99F8,0x9A01,0x9A0F,0x9A05,0x99E2,
- 0x9A19,0x9A2B,0x9A37,0x9A45,0x9A42,0x9A40,0x9A43,0x9A3E,
- 0x9A55,0x9A4D,0x9A5B,0x9A57,0x9A5F,0x9A62,0x9A65,0x9A64,
- 0x9A69,0x9A6B,0x9A6A,0x9AAD,0x9AB0,0x9ABC,0x9AC0,0x9ACF,
- 0x9AD1,0x9AD3,0x9AD4,0x9ADE,0x9ADF,0x9AE2,0x9AE3,0x9AE6,
- 0x9AEF,0x9AEB,0x9AEE,0x9AF4,0x9AF1,0x9AF7,
-
- /* ku 82 */
- 0x9AFB,0x9B06,0x9B18,0x9B1A,0x9B1F,0x9B22,0x9B23,0x9B25,
- 0x9B27,0x9B28,0x9B29,0x9B2A,0x9B2E,0x9B2F,0x9B32,0x9B44,
- 0x9B43,0x9B4F,0x9B4D,0x9B4E,0x9B51,0x9B58,0x9B74,0x9B93,
- 0x9B83,0x9B91,0x9B96,0x9B97,0x9B9F,0x9BA0,0x9BA8,0x9BB4,
- 0x9BC0,0x9BCA,0x9BB9,0x9BC6,0x9BCF,0x9BD1,0x9BD2,0x9BE3,
- 0x9BE2,0x9BE4,0x9BD4,0x9BE1,0x9C3A,0x9BF2,0x9BF1,0x9BF0,
- 0x9C15,0x9C14,0x9C09,0x9C13,0x9C0C,0x9C06,0x9C08,0x9C12,
- 0x9C0A,0x9C04,0x9C2E,0x9C1B,0x9C25,0x9C24,0x9C21,0x9C30,
- 0x9C47,0x9C32,0x9C46,0x9C3E,0x9C5A,0x9C60,0x9C67,0x9C76,
- 0x9C78,0x9CE7,0x9CEC,0x9CF0,0x9D09,0x9D08,0x9CEB,0x9D03,
- 0x9D06,0x9D2A,0x9D26,0x9DAF,0x9D23,0x9D1F,0x9D44,0x9D15,
- 0x9D12,0x9D41,0x9D3F,0x9D3E,0x9D46,0x9D48,
-
- /* ku 83 */
- 0x9D5D,0x9D5E,0x9D64,0x9D51,0x9D50,0x9D59,0x9D72,0x9D89,
- 0x9D87,0x9DAB,0x9D6F,0x9D7A,0x9D9A,0x9DA4,0x9DA9,0x9DB2,
- 0x9DC4,0x9DC1,0x9DBB,0x9DB8,0x9DBA,0x9DC6,0x9DCF,0x9DC2,
- 0x9DD9,0x9DD3,0x9DF8,0x9DE6,0x9DED,0x9DEF,0x9DFD,0x9E1A,
- 0x9E1B,0x9E1E,0x9E75,0x9E79,0x9E7D,0x9E81,0x9E88,0x9E8B,
- 0x9E8C,0x9E92,0x9E95,0x9E91,0x9E9D,0x9EA5,0x9EA9,0x9EB8,
- 0x9EAA,0x9EAD,0x9761,0x9ECC,0x9ECE,0x9ECF,0x9ED0,0x9ED4,
- 0x9EDC,0x9EDE,0x9EDD,0x9EE0,0x9EE5,0x9EE8,0x9EEF,0x9EF4,
- 0x9EF6,0x9EF7,0x9EF9,0x9EFB,0x9EFC,0x9EFD,0x9F07,0x9F08,
- 0x76B7,0x9F15,0x9F21,0x9F2C,0x9F3E,0x9F4A,0x9F52,0x9F54,
- 0x9F63,0x9F5F,0x9F60,0x9F61,0x9F66,0x9F67,0x9F6C,0x9F6A,
- 0x9F77,0x9F72,0x9F76,0x9F95,0x9F9C,0x9FA0,
-
- /* ku 84 */
- 0x582F,0x69C7,0x9059,0x7464,0x51DC,0x7199
-};
-
-static const int jisx0208_ucs_table_size = (sizeof (jisx0208_ucs_table) / sizeof (unsigned short));
-
-static const unsigned short cp932ext1_ucs_table[] = {
- /* ku 13 */
- 0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,
- 0x2468,0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F,
- 0x2470,0x2471,0x2472,0x2473,0x2160,0x2161,0x2162,0x2163,
- 0x2164,0x2165,0x2166,0x2167,0x2168,0x2169,0x0000,0x3349,
- 0x3314,0x3322,0x334D,0x3318,0x3327,0x3303,0x3336,0x3351,
- 0x3357,0x330D,0x3326,0x3323,0x332B,0x334A,0x333B,0x339C,
- 0x339D,0x339E,0x338E,0x338F,0x33C4,0x33A1,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x337B,0x301D,
- 0x301F,0x2116,0x33CD,0x2121,0x32A4,0x32A5,0x32A6,0x32A7,
- 0x32A8,0x3231,0x3232,0x3239,0x337E,0x337D,0x337C,0x2252,
- 0x2261,0x222B,0x222E,0x2211,0x221A,0x22A5,0x2220,0x221F,
- 0x22BF,0x2235,0x2229,0x222A,0x0000,0x0000
-};
-static const int cp932ext1_ucs_table_min = (13 - 1)*94;
-static const int cp932ext1_ucs_table_max = (13 - 1)*94 + (sizeof (cp932ext1_ucs_table) / sizeof (unsigned short));
-
-static const unsigned short cp932ext2_ucs_table[] = {
- /* ku 89 */
- 0x7E8A,0x891C,0x9348,0x9288,0x84DC,0x4FC9,0x70BB,0x6631,
- 0x68C8,0x92F9,0x66FB,0x5F45,0x4E28,0x4EE1,0x4EFC,0x4F00,
- 0x4F03,0x4F39,0x4F56,0x4F92,0x4F8A,0x4F9A,0x4F94,0x4FCD,
- 0x5040,0x5022,0x4FFF,0x501E,0x5046,0x5070,0x5042,0x5094,
- 0x50F4,0x50D8,0x514A,0x5164,0x519D,0x51BE,0x51EC,0x5215,
- 0x529C,0x52A6,0x52C0,0x52DB,0x5300,0x5307,0x5324,0x5372,
- 0x5393,0x53B2,0x53DD,0xFA0E,0x549C,0x548A,0x54A9,0x54FF,
- 0x5586,0x5759,0x5765,0x57AC,0x57C8,0x57C7,0xFA0F,0xFA10,
- 0x589E,0x58B2,0x590B,0x5953,0x595B,0x595D,0x5963,0x59A4,
- 0x59BA,0x5B56,0x5BC0,0x752F,0x5BD8,0x5BEC,0x5C1E,0x5CA6,
- 0x5CBA,0x5CF5,0x5D27,0x5D53,0xFA11,0x5D42,0x5D6D,0x5DB8,
- 0x5DB9,0x5DD0,0x5F21,0x5F34,0x5F67,0x5FB7,
-
- /* ku 90 */
- 0x5FDE,0x605D,0x6085,0x608A,0x60DE,0x60D5,0x6120,0x60F2,
- 0x6111,0x6137,0x6130,0x6198,0x6213,0x62A6,0x63F5,0x6460,
- 0x649D,0x64CE,0x654E,0x6600,0x6615,0x663B,0x6609,0x662E,
- 0x661E,0x6624,0x6665,0x6657,0x6659,0xFA12,0x6673,0x6699,
- 0x66A0,0x66B2,0x66BF,0x66FA,0x670E,0xF929,0x6766,0x67BB,
- 0x6852,0x67C0,0x6801,0x6844,0x68CF,0xFA13,0x6968,0xFA14,
- 0x6998,0x69E2,0x6A30,0x6A6B,0x6A46,0x6A73,0x6A7E,0x6AE2,
- 0x6AE4,0x6BD6,0x6C3F,0x6C5C,0x6C86,0x6C6F,0x6CDA,0x6D04,
- 0x6D87,0x6D6F,0x6D96,0x6DAC,0x6DCF,0x6DF8,0x6DF2,0x6DFC,
- 0x6E39,0x6E5C,0x6E27,0x6E3C,0x6EBF,0x6F88,0x6FB5,0x6FF5,
- 0x7005,0x7007,0x7028,0x7085,0x70AB,0x710F,0x7104,0x715C,
- 0x7146,0x7147,0xFA15,0x71C1,0x71FE,0x72B1,
-
- /* ku 91 */
- 0x72BE,0x7324,0xFA16,0x7377,0x73BD,0x73C9,0x73D6,0x73E3,
- 0x73D2,0x7407,0x73F5,0x7426,0x742A,0x7429,0x742E,0x7462,
- 0x7489,0x749F,0x7501,0x756F,0x7682,0x769C,0x769E,0x769B,
- 0x76A6,0xFA17,0x7746,0x52AF,0x7821,0x784E,0x7864,0x787A,
- 0x7930,0xFA18,0xFA19,0xFA1A,0x7994,0xFA1B,0x799B,0x7AD1,
- 0x7AE7,0xFA1C,0x7AEB,0x7B9E,0xFA1D,0x7D48,0x7D5C,0x7DB7,
- 0x7DA0,0x7DD6,0x7E52,0x7F47,0x7FA1,0xFA1E,0x8301,0x8362,
- 0x837F,0x83C7,0x83F6,0x8448,0x84B4,0x8553,0x8559,0x856B,
- 0xFA1F,0x85B0,0xFA20,0xFA21,0x8807,0x88F5,0x8A12,0x8A37,
- 0x8A79,0x8AA7,0x8ABE,0x8ADF,0xFA22,0x8AF6,0x8B53,0x8B7F,
- 0x8CF0,0x8CF4,0x8D12,0x8D76,0xFA23,0x8ECF,0xFA24,0xFA25,
- 0x9067,0x90DE,0xFA26,0x9115,0x9127,0x91DA,
-
- /* ku 92 */
- 0x91D7,0x91DE,0x91ED,0x91EE,0x91E4,0x91E5,0x9206,0x9210,
- 0x920A,0x923A,0x9240,0x923C,0x924E,0x9259,0x9251,0x9239,
- 0x9267,0x92A7,0x9277,0x9278,0x92E7,0x92D7,0x92D9,0x92D0,
- 0xFA27,0x92D5,0x92E0,0x92D3,0x9325,0x9321,0x92FB,0xFA28,
- 0x931E,0x92FF,0x931D,0x9302,0x9370,0x9357,0x93A4,0x93C6,
- 0x93DE,0x93F8,0x9431,0x9445,0x9448,0x9592,0xF9DC,0xFA29,
- 0x969D,0x96AF,0x9733,0x973B,0x9743,0x974D,0x974F,0x9751,
- 0x9755,0x9857,0x9865,0xFA2A,0xFA2B,0x9927,0xFA2C,0x999E,
- 0x9A4E,0x9AD9,0x9ADC,0x9B75,0x9B72,0x9B8F,0x9BB1,0x9BBB,
- 0x9C00,0x9D70,0x9D6B,0xFA2D,0x9E19,0x9ED1,0x0000,0x0000,
- 0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177,
- 0x2178,0x2179,0xFFE2,0xFFE4,0xFF07,0xFF02
-};
-static const int cp932ext2_ucs_table_min = (89 - 1)*94;
-static const int cp932ext2_ucs_table_max = (89 - 1)*94 + (sizeof (cp932ext2_ucs_table) / sizeof (unsigned short));
-
-static const unsigned short cp932ext3_ucs_table[] = {
- /* ku 115 */
- 0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177,
- 0x2178,0x2179,0x2160,0x2161,0x2162,0x2163,0x2164,0x2165,
- 0x2166,0x2167,0x2168,0x2169,0xFFE2,0xFFE4,0xFF07,0xFF02,
- 0x3231,0x2116,0x2121,0x2235,0x7E8A,0x891C,0x9348,0x9288,
- 0x84DC,0x4FC9,0x70BB,0x6631,0x68C8,0x92F9,0x66FB,0x5F45,
- 0x4E28,0x4EE1,0x4EFC,0x4F00,0x4F03,0x4F39,0x4F56,0x4F92,
- 0x4F8A,0x4F9A,0x4F94,0x4FCD,0x5040,0x5022,0x4FFF,0x501E,
- 0x5046,0x5070,0x5042,0x5094,0x50F4,0x50D8,0x514A,0x5164,
- 0x519D,0x51BE,0x51EC,0x5215,0x529C,0x52A6,0x52C0,0x52DB,
- 0x5300,0x5307,0x5324,0x5372,0x5393,0x53B2,0x53DD,0xFA0E,
- 0x549C,0x548A,0x54A9,0x54FF,0x5586,0x5759,0x5765,0x57AC,
- 0x57C8,0x57C7,0xFA0F,0xFA10,0x589E,0x58B2,
-
- /* ku 116 */
- 0x590B,0x5953,0x595B,0x595D,0x5963,0x59A4,0x59BA,0x5B56,
- 0x5BC0,0x752F,0x5BD8,0x5BEC,0x5C1E,0x5CA6,0x5CBA,0x5CF5,
- 0x5D27,0x5D53,0xFA11,0x5D42,0x5D6D,0x5DB8,0x5DB9,0x5DD0,
- 0x5F21,0x5F34,0x5F67,0x5FB7,0x5FDE,0x605D,0x6085,0x608A,
- 0x60DE,0x60D5,0x6120,0x60F2,0x6111,0x6137,0x6130,0x6198,
- 0x6213,0x62A6,0x63F5,0x6460,0x649D,0x64CE,0x654E,0x6600,
- 0x6615,0x663B,0x6609,0x662E,0x661E,0x6624,0x6665,0x6657,
- 0x6659,0xFA12,0x6673,0x6699,0x66A0,0x66B2,0x66BF,0x66FA,
- 0x670E,0xF929,0x6766,0x67BB,0x6852,0x67C0,0x6801,0x6844,
- 0x68CF,0xFA13,0x6968,0xFA14,0x6998,0x69E2,0x6A30,0x6A6B,
- 0x6A46,0x6A73,0x6A7E,0x6AE2,0x6AE4,0x6BD6,0x6C3F,0x6C5C,
- 0x6C86,0x6C6F,0x6CDA,0x6D04,0x6D87,0x6D6F,
-
- /* ku 117 */
- 0x6D96,0x6DAC,0x6DCF,0x6DF8,0x6DF2,0x6DFC,0x6E39,0x6E5C,
- 0x6E27,0x6E3C,0x6EBF,0x6F88,0x6FB5,0x6FF5,0x7005,0x7007,
- 0x7028,0x7085,0x70AB,0x710F,0x7104,0x715C,0x7146,0x7147,
- 0xFA15,0x71C1,0x71FE,0x72B1,0x72BE,0x7324,0xFA16,0x7377,
- 0x73BD,0x73C9,0x73D6,0x73E3,0x73D2,0x7407,0x73F5,0x7426,
- 0x742A,0x7429,0x742E,0x7462,0x7489,0x749F,0x7501,0x756F,
- 0x7682,0x769C,0x769E,0x769B,0x76A6,0xFA17,0x7746,0x52AF,
- 0x7821,0x784E,0x7864,0x787A,0x7930,0xFA18,0xFA19,0xFA1A,
- 0x7994,0xFA1B,0x799B,0x7AD1,0x7AE7,0xFA1C,0x7AEB,0x7B9E,
- 0xFA1D,0x7D48,0x7D5C,0x7DB7,0x7DA0,0x7DD6,0x7E52,0x7F47,
- 0x7FA1,0xFA1E,0x8301,0x8362,0x837F,0x83C7,0x83F6,0x8448,
- 0x84B4,0x8553,0x8559,0x856B,0xFA1F,0x85B0,
-
- /* ku 118 */
- 0xFA20,0xFA21,0x8807,0x88F5,0x8A12,0x8A37,0x8A79,0x8AA7,
- 0x8ABE,0x8ADF,0xFA22,0x8AF6,0x8B53,0x8B7F,0x8CF0,0x8CF4,
- 0x8D12,0x8D76,0xFA23,0x8ECF,0xFA24,0xFA25,0x9067,0x90DE,
- 0xFA26,0x9115,0x9127,0x91DA,0x91D7,0x91DE,0x91ED,0x91EE,
- 0x91E4,0x91E5,0x9206,0x9210,0x920A,0x923A,0x9240,0x923C,
- 0x924E,0x9259,0x9251,0x9239,0x9267,0x92A7,0x9277,0x9278,
- 0x92E7,0x92D7,0x92D9,0x92D0,0xFA27,0x92D5,0x92E0,0x92D3,
- 0x9325,0x9321,0x92FB,0xFA28,0x931E,0x92FF,0x931D,0x9302,
- 0x9370,0x9357,0x93A4,0x93C6,0x93DE,0x93F8,0x9431,0x9445,
- 0x9448,0x9592,0xF9DC,0xFA29,0x969D,0x96AF,0x9733,0x973B,
- 0x9743,0x974D,0x974F,0x9751,0x9755,0x9857,0x9865,0xFA2A,
- 0xFA2B,0x9927,0xFA2C,0x999E,0x9A4E,0x9AD9,
-
- /* ku 119 */
- 0x9ADC,0x9B75,0x9B72,0x9B8F,0x9BB1,0x9BBB,0x9C00,0x9D70,
- 0x9D6B,0xFA2D,0x9E19,0x9ED1
-};
-static const int cp932ext3_ucs_table_min = (115 - 1)*94;
-static const int cp932ext3_ucs_table_max = (115 - 1)*94 + (sizeof (cp932ext3_ucs_table) / sizeof (unsigned short));
-
-
-static const unsigned short jisx0212_ucs_table[] = {
- /* ku 1 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 2 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x02D8,0x02C7,
- 0x00B8,0x02D9,0x02DD,0x00AF,0x02DB,0x02DA,0x007E,0x0384,
- 0x0385,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x00A1,0x00A6,0x00BF,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x00BA,0x00AA,0x00A9,0x00AE,0x2122,0x00A4,
- 0x2116,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 3 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 4 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 5 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 6 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0386,0x0388,0x0389,0x038A,0x03AA,0x0000,0x038C,0x0000,
- 0x038E,0x03AB,0x0000,0x038F,0x0000,0x0000,0x0000,0x0000,
- 0x03AC,0x03AD,0x03AE,0x03AF,0x03CA,0x0390,0x03CC,0x03C2,
- 0x03CD,0x03CB,0x03B0,0x03CE,0x0000,0x0000,
-
- /* ku 7 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0402,0x0403,0x0404,0x0405,0x0406,0x0407,0x0408,
- 0x0409,0x040A,0x040B,0x040C,0x040E,0x040F,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0452,0x0453,0x0454,0x0455,0x0456,0x0457,0x0458,
- 0x0459,0x045A,0x045B,0x045C,0x045E,0x045F,
-
- /* ku 8 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 9 */
- 0x00C6,0x0110,0x0000,0x0126,0x0000,0x0132,0x0000,0x0141,
- 0x013F,0x0000,0x014A,0x00D8,0x0152,0x0000,0x0166,0x00DE,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x00E6,0x0111,0x00F0,0x0127,0x0131,0x0133,0x0138,0x0142,
- 0x0140,0x0149,0x014B,0x00F8,0x0153,0x00DF,0x0167,0x00FE,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 10 */
- 0x00C1,0x00C0,0x00C4,0x00C2,0x0102,0x01CD,0x0100,0x0104,
- 0x00C5,0x00C3,0x0106,0x0108,0x010C,0x00C7,0x010A,0x010E,
- 0x00C9,0x00C8,0x00CB,0x00CA,0x011A,0x0116,0x0112,0x0118,
- 0x0000,0x011C,0x011E,0x0122,0x0120,0x0124,0x00CD,0x00CC,
- 0x00CF,0x00CE,0x01CF,0x0130,0x012A,0x012E,0x0128,0x0134,
- 0x0136,0x0139,0x013D,0x013B,0x0143,0x0147,0x0145,0x00D1,
- 0x00D3,0x00D2,0x00D6,0x00D4,0x01D1,0x0150,0x014C,0x00D5,
- 0x0154,0x0158,0x0156,0x015A,0x015C,0x0160,0x015E,0x0164,
- 0x0162,0x00DA,0x00D9,0x00DC,0x00DB,0x016C,0x01D3,0x0170,
- 0x016A,0x0172,0x016E,0x0168,0x01D7,0x01DB,0x01D9,0x01D5,
- 0x0174,0x00DD,0x0178,0x0176,0x0179,0x017D,0x017B,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 11 */
- 0x00E1,0x00E0,0x00E4,0x00E2,0x0103,0x01CE,0x0101,0x0105,
- 0x00E5,0x00E3,0x0107,0x0109,0x010D,0x00E7,0x010B,0x010F,
- 0x00E9,0x00E8,0x00EB,0x00EA,0x011B,0x0117,0x0113,0x0119,
- 0x01F5,0x011D,0x011F,0x0000,0x0121,0x0125,0x00ED,0x00EC,
- 0x00EF,0x00EE,0x01D0,0x0000,0x012B,0x012F,0x0129,0x0135,
- 0x0137,0x013A,0x013E,0x013C,0x0144,0x0148,0x0146,0x00F1,
- 0x00F3,0x00F2,0x00F6,0x00F4,0x01D2,0x0151,0x014D,0x00F5,
- 0x0155,0x0159,0x0157,0x015B,0x015D,0x0161,0x015F,0x0165,
- 0x0163,0x00FA,0x00F9,0x00FC,0x00FB,0x016D,0x01D4,0x0171,
- 0x016B,0x0173,0x016F,0x0169,0x01D8,0x01DC,0x01DA,0x01D6,
- 0x0175,0x00FD,0x00FF,0x0177,0x017A,0x017E,0x017C,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 12 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 13 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 14 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 15 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 16 */
- 0x4E02,0x4E04,0x4E05,0x4E0C,0x4E12,0x4E1F,0x4E23,0x4E24,
- 0x4E28,0x4E2B,0x4E2E,0x4E2F,0x4E30,0x4E35,0x4E40,0x4E41,
- 0x4E44,0x4E47,0x4E51,0x4E5A,0x4E5C,0x4E63,0x4E68,0x4E69,
- 0x4E74,0x4E75,0x4E79,0x4E7F,0x4E8D,0x4E96,0x4E97,0x4E9D,
- 0x4EAF,0x4EB9,0x4EC3,0x4ED0,0x4EDA,0x4EDB,0x4EE0,0x4EE1,
- 0x4EE2,0x4EE8,0x4EEF,0x4EF1,0x4EF3,0x4EF5,0x4EFD,0x4EFE,
- 0x4EFF,0x4F00,0x4F02,0x4F03,0x4F08,0x4F0B,0x4F0C,0x4F12,
- 0x4F15,0x4F16,0x4F17,0x4F19,0x4F2E,0x4F31,0x4F60,0x4F33,
- 0x4F35,0x4F37,0x4F39,0x4F3B,0x4F3E,0x4F40,0x4F42,0x4F48,
- 0x4F49,0x4F4B,0x4F4C,0x4F52,0x4F54,0x4F56,0x4F58,0x4F5F,
- 0x4F63,0x4F6A,0x4F6C,0x4F6E,0x4F71,0x4F77,0x4F78,0x4F79,
- 0x4F7A,0x4F7D,0x4F7E,0x4F81,0x4F82,0x4F84,
-
- /* ku 17 */
- 0x4F85,0x4F89,0x4F8A,0x4F8C,0x4F8E,0x4F90,0x4F92,0x4F93,
- 0x4F94,0x4F97,0x4F99,0x4F9A,0x4F9E,0x4F9F,0x4FB2,0x4FB7,
- 0x4FB9,0x4FBB,0x4FBC,0x4FBD,0x4FBE,0x4FC0,0x4FC1,0x4FC5,
- 0x4FC6,0x4FC8,0x4FC9,0x4FCB,0x4FCC,0x4FCD,0x4FCF,0x4FD2,
- 0x4FDC,0x4FE0,0x4FE2,0x4FF0,0x4FF2,0x4FFC,0x4FFD,0x4FFF,
- 0x5000,0x5001,0x5004,0x5007,0x500A,0x500C,0x500E,0x5010,
- 0x5013,0x5017,0x5018,0x501B,0x501C,0x501D,0x501E,0x5022,
- 0x5027,0x502E,0x5030,0x5032,0x5033,0x5035,0x5040,0x5041,
- 0x5042,0x5045,0x5046,0x504A,0x504C,0x504E,0x5051,0x5052,
- 0x5053,0x5057,0x5059,0x505F,0x5060,0x5062,0x5063,0x5066,
- 0x5067,0x506A,0x506D,0x5070,0x5071,0x503B,0x5081,0x5083,
- 0x5084,0x5086,0x508A,0x508E,0x508F,0x5090,
-
- /* ku 18 */
- 0x5092,0x5093,0x5094,0x5096,0x509B,0x509C,0x509E,0x509F,
- 0x50A0,0x50A1,0x50A2,0x50AA,0x50AF,0x50B0,0x50B9,0x50BA,
- 0x50BD,0x50C0,0x50C3,0x50C4,0x50C7,0x50CC,0x50CE,0x50D0,
- 0x50D3,0x50D4,0x50D8,0x50DC,0x50DD,0x50DF,0x50E2,0x50E4,
- 0x50E6,0x50E8,0x50E9,0x50EF,0x50F1,0x50F6,0x50FA,0x50FE,
- 0x5103,0x5106,0x5107,0x5108,0x510B,0x510C,0x510D,0x510E,
- 0x50F2,0x5110,0x5117,0x5119,0x511B,0x511C,0x511D,0x511E,
- 0x5123,0x5127,0x5128,0x512C,0x512D,0x512F,0x5131,0x5133,
- 0x5134,0x5135,0x5138,0x5139,0x5142,0x514A,0x514F,0x5153,
- 0x5155,0x5157,0x5158,0x515F,0x5164,0x5166,0x517E,0x5183,
- 0x5184,0x518B,0x518E,0x5198,0x519D,0x51A1,0x51A3,0x51AD,
- 0x51B8,0x51BA,0x51BC,0x51BE,0x51BF,0x51C2,
-
- /* ku 19 */
- 0x51C8,0x51CF,0x51D1,0x51D2,0x51D3,0x51D5,0x51D8,0x51DE,
- 0x51E2,0x51E5,0x51EE,0x51F2,0x51F3,0x51F4,0x51F7,0x5201,
- 0x5202,0x5205,0x5212,0x5213,0x5215,0x5216,0x5218,0x5222,
- 0x5228,0x5231,0x5232,0x5235,0x523C,0x5245,0x5249,0x5255,
- 0x5257,0x5258,0x525A,0x525C,0x525F,0x5260,0x5261,0x5266,
- 0x526E,0x5277,0x5278,0x5279,0x5280,0x5282,0x5285,0x528A,
- 0x528C,0x5293,0x5295,0x5296,0x5297,0x5298,0x529A,0x529C,
- 0x52A4,0x52A5,0x52A6,0x52A7,0x52AF,0x52B0,0x52B6,0x52B7,
- 0x52B8,0x52BA,0x52BB,0x52BD,0x52C0,0x52C4,0x52C6,0x52C8,
- 0x52CC,0x52CF,0x52D1,0x52D4,0x52D6,0x52DB,0x52DC,0x52E1,
- 0x52E5,0x52E8,0x52E9,0x52EA,0x52EC,0x52F0,0x52F1,0x52F4,
- 0x52F6,0x52F7,0x5300,0x5303,0x530A,0x530B,
-
- /* ku 20 */
- 0x530C,0x5311,0x5313,0x5318,0x531B,0x531C,0x531E,0x531F,
- 0x5325,0x5327,0x5328,0x5329,0x532B,0x532C,0x532D,0x5330,
- 0x5332,0x5335,0x533C,0x533D,0x533E,0x5342,0x534C,0x534B,
- 0x5359,0x535B,0x5361,0x5363,0x5365,0x536C,0x536D,0x5372,
- 0x5379,0x537E,0x5383,0x5387,0x5388,0x538E,0x5393,0x5394,
- 0x5399,0x539D,0x53A1,0x53A4,0x53AA,0x53AB,0x53AF,0x53B2,
- 0x53B4,0x53B5,0x53B7,0x53B8,0x53BA,0x53BD,0x53C0,0x53C5,
- 0x53CF,0x53D2,0x53D3,0x53D5,0x53DA,0x53DD,0x53DE,0x53E0,
- 0x53E6,0x53E7,0x53F5,0x5402,0x5413,0x541A,0x5421,0x5427,
- 0x5428,0x542A,0x542F,0x5431,0x5434,0x5435,0x5443,0x5444,
- 0x5447,0x544D,0x544F,0x545E,0x5462,0x5464,0x5466,0x5467,
- 0x5469,0x546B,0x546D,0x546E,0x5474,0x547F,
-
- /* ku 21 */
- 0x5481,0x5483,0x5485,0x5488,0x5489,0x548D,0x5491,0x5495,
- 0x5496,0x549C,0x549F,0x54A1,0x54A6,0x54A7,0x54A9,0x54AA,
- 0x54AD,0x54AE,0x54B1,0x54B7,0x54B9,0x54BA,0x54BB,0x54BF,
- 0x54C6,0x54CA,0x54CD,0x54CE,0x54E0,0x54EA,0x54EC,0x54EF,
- 0x54F6,0x54FC,0x54FE,0x54FF,0x5500,0x5501,0x5505,0x5508,
- 0x5509,0x550C,0x550D,0x550E,0x5515,0x552A,0x552B,0x5532,
- 0x5535,0x5536,0x553B,0x553C,0x553D,0x5541,0x5547,0x5549,
- 0x554A,0x554D,0x5550,0x5551,0x5558,0x555A,0x555B,0x555E,
- 0x5560,0x5561,0x5564,0x5566,0x557F,0x5581,0x5582,0x5586,
- 0x5588,0x558E,0x558F,0x5591,0x5592,0x5593,0x5594,0x5597,
- 0x55A3,0x55A4,0x55AD,0x55B2,0x55BF,0x55C1,0x55C3,0x55C6,
- 0x55C9,0x55CB,0x55CC,0x55CE,0x55D1,0x55D2,
-
- /* ku 22 */
- 0x55D3,0x55D7,0x55D8,0x55DB,0x55DE,0x55E2,0x55E9,0x55F6,
- 0x55FF,0x5605,0x5608,0x560A,0x560D,0x560E,0x560F,0x5610,
- 0x5611,0x5612,0x5619,0x562C,0x5630,0x5633,0x5635,0x5637,
- 0x5639,0x563B,0x563C,0x563D,0x563F,0x5640,0x5641,0x5643,
- 0x5644,0x5646,0x5649,0x564B,0x564D,0x564F,0x5654,0x565E,
- 0x5660,0x5661,0x5662,0x5663,0x5666,0x5669,0x566D,0x566F,
- 0x5671,0x5672,0x5675,0x5684,0x5685,0x5688,0x568B,0x568C,
- 0x5695,0x5699,0x569A,0x569D,0x569E,0x569F,0x56A6,0x56A7,
- 0x56A8,0x56A9,0x56AB,0x56AC,0x56AD,0x56B1,0x56B3,0x56B7,
- 0x56BE,0x56C5,0x56C9,0x56CA,0x56CB,0x56CF,0x56D0,0x56CC,
- 0x56CD,0x56D9,0x56DC,0x56DD,0x56DF,0x56E1,0x56E4,0x56E5,
- 0x56E6,0x56E7,0x56E8,0x56F1,0x56EB,0x56ED,
-
- /* ku 23 */
- 0x56F6,0x56F7,0x5701,0x5702,0x5707,0x570A,0x570C,0x5711,
- 0x5715,0x571A,0x571B,0x571D,0x5720,0x5722,0x5723,0x5724,
- 0x5725,0x5729,0x572A,0x572C,0x572E,0x572F,0x5733,0x5734,
- 0x573D,0x573E,0x573F,0x5745,0x5746,0x574C,0x574D,0x5752,
- 0x5762,0x5765,0x5767,0x5768,0x576B,0x576D,0x576E,0x576F,
- 0x5770,0x5771,0x5773,0x5774,0x5775,0x5777,0x5779,0x577A,
- 0x577B,0x577C,0x577E,0x5781,0x5783,0x578C,0x5794,0x5797,
- 0x5799,0x579A,0x579C,0x579D,0x579E,0x579F,0x57A1,0x5795,
- 0x57A7,0x57A8,0x57A9,0x57AC,0x57B8,0x57BD,0x57C7,0x57C8,
- 0x57CC,0x57CF,0x57D5,0x57DD,0x57DE,0x57E4,0x57E6,0x57E7,
- 0x57E9,0x57ED,0x57F0,0x57F5,0x57F6,0x57F8,0x57FD,0x57FE,
- 0x57FF,0x5803,0x5804,0x5808,0x5809,0x57E1,
-
- /* ku 24 */
- 0x580C,0x580D,0x581B,0x581E,0x581F,0x5820,0x5826,0x5827,
- 0x582D,0x5832,0x5839,0x583F,0x5849,0x584C,0x584D,0x584F,
- 0x5850,0x5855,0x585F,0x5861,0x5864,0x5867,0x5868,0x5878,
- 0x587C,0x587F,0x5880,0x5881,0x5887,0x5888,0x5889,0x588A,
- 0x588C,0x588D,0x588F,0x5890,0x5894,0x5896,0x589D,0x58A0,
- 0x58A1,0x58A2,0x58A6,0x58A9,0x58B1,0x58B2,0x58C4,0x58BC,
- 0x58C2,0x58C8,0x58CD,0x58CE,0x58D0,0x58D2,0x58D4,0x58D6,
- 0x58DA,0x58DD,0x58E1,0x58E2,0x58E9,0x58F3,0x5905,0x5906,
- 0x590B,0x590C,0x5912,0x5913,0x5914,0x8641,0x591D,0x5921,
- 0x5923,0x5924,0x5928,0x592F,0x5930,0x5933,0x5935,0x5936,
- 0x593F,0x5943,0x5946,0x5952,0x5953,0x5959,0x595B,0x595D,
- 0x595E,0x595F,0x5961,0x5963,0x596B,0x596D,
-
- /* ku 25 */
- 0x596F,0x5972,0x5975,0x5976,0x5979,0x597B,0x597C,0x598B,
- 0x598C,0x598E,0x5992,0x5995,0x5997,0x599F,0x59A4,0x59A7,
- 0x59AD,0x59AE,0x59AF,0x59B0,0x59B3,0x59B7,0x59BA,0x59BC,
- 0x59C1,0x59C3,0x59C4,0x59C8,0x59CA,0x59CD,0x59D2,0x59DD,
- 0x59DE,0x59DF,0x59E3,0x59E4,0x59E7,0x59EE,0x59EF,0x59F1,
- 0x59F2,0x59F4,0x59F7,0x5A00,0x5A04,0x5A0C,0x5A0D,0x5A0E,
- 0x5A12,0x5A13,0x5A1E,0x5A23,0x5A24,0x5A27,0x5A28,0x5A2A,
- 0x5A2D,0x5A30,0x5A44,0x5A45,0x5A47,0x5A48,0x5A4C,0x5A50,
- 0x5A55,0x5A5E,0x5A63,0x5A65,0x5A67,0x5A6D,0x5A77,0x5A7A,
- 0x5A7B,0x5A7E,0x5A8B,0x5A90,0x5A93,0x5A96,0x5A99,0x5A9C,
- 0x5A9E,0x5A9F,0x5AA0,0x5AA2,0x5AA7,0x5AAC,0x5AB1,0x5AB2,
- 0x5AB3,0x5AB5,0x5AB8,0x5ABA,0x5ABB,0x5ABF,
-
- /* ku 26 */
- 0x5AC4,0x5AC6,0x5AC8,0x5ACF,0x5ADA,0x5ADC,0x5AE0,0x5AE5,
- 0x5AEA,0x5AEE,0x5AF5,0x5AF6,0x5AFD,0x5B00,0x5B01,0x5B08,
- 0x5B17,0x5B34,0x5B19,0x5B1B,0x5B1D,0x5B21,0x5B25,0x5B2D,
- 0x5B38,0x5B41,0x5B4B,0x5B4C,0x5B52,0x5B56,0x5B5E,0x5B68,
- 0x5B6E,0x5B6F,0x5B7C,0x5B7D,0x5B7E,0x5B7F,0x5B81,0x5B84,
- 0x5B86,0x5B8A,0x5B8E,0x5B90,0x5B91,0x5B93,0x5B94,0x5B96,
- 0x5BA8,0x5BA9,0x5BAC,0x5BAD,0x5BAF,0x5BB1,0x5BB2,0x5BB7,
- 0x5BBA,0x5BBC,0x5BC0,0x5BC1,0x5BCD,0x5BCF,0x5BD6,0x5BD7,
- 0x5BD8,0x5BD9,0x5BDA,0x5BE0,0x5BEF,0x5BF1,0x5BF4,0x5BFD,
- 0x5C0C,0x5C17,0x5C1E,0x5C1F,0x5C23,0x5C26,0x5C29,0x5C2B,
- 0x5C2C,0x5C2E,0x5C30,0x5C32,0x5C35,0x5C36,0x5C59,0x5C5A,
- 0x5C5C,0x5C62,0x5C63,0x5C67,0x5C68,0x5C69,
-
- /* ku 27 */
- 0x5C6D,0x5C70,0x5C74,0x5C75,0x5C7A,0x5C7B,0x5C7C,0x5C7D,
- 0x5C87,0x5C88,0x5C8A,0x5C8F,0x5C92,0x5C9D,0x5C9F,0x5CA0,
- 0x5CA2,0x5CA3,0x5CA6,0x5CAA,0x5CB2,0x5CB4,0x5CB5,0x5CBA,
- 0x5CC9,0x5CCB,0x5CD2,0x5CDD,0x5CD7,0x5CEE,0x5CF1,0x5CF2,
- 0x5CF4,0x5D01,0x5D06,0x5D0D,0x5D12,0x5D2B,0x5D23,0x5D24,
- 0x5D26,0x5D27,0x5D31,0x5D34,0x5D39,0x5D3D,0x5D3F,0x5D42,
- 0x5D43,0x5D46,0x5D48,0x5D55,0x5D51,0x5D59,0x5D4A,0x5D5F,
- 0x5D60,0x5D61,0x5D62,0x5D64,0x5D6A,0x5D6D,0x5D70,0x5D79,
- 0x5D7A,0x5D7E,0x5D7F,0x5D81,0x5D83,0x5D88,0x5D8A,0x5D92,
- 0x5D93,0x5D94,0x5D95,0x5D99,0x5D9B,0x5D9F,0x5DA0,0x5DA7,
- 0x5DAB,0x5DB0,0x5DB4,0x5DB8,0x5DB9,0x5DC3,0x5DC7,0x5DCB,
- 0x5DD0,0x5DCE,0x5DD8,0x5DD9,0x5DE0,0x5DE4,
-
- /* ku 28 */
- 0x5DE9,0x5DF8,0x5DF9,0x5E00,0x5E07,0x5E0D,0x5E12,0x5E14,
- 0x5E15,0x5E18,0x5E1F,0x5E20,0x5E2E,0x5E28,0x5E32,0x5E35,
- 0x5E3E,0x5E4B,0x5E50,0x5E49,0x5E51,0x5E56,0x5E58,0x5E5B,
- 0x5E5C,0x5E5E,0x5E68,0x5E6A,0x5E6B,0x5E6C,0x5E6D,0x5E6E,
- 0x5E70,0x5E80,0x5E8B,0x5E8E,0x5EA2,0x5EA4,0x5EA5,0x5EA8,
- 0x5EAA,0x5EAC,0x5EB1,0x5EB3,0x5EBD,0x5EBE,0x5EBF,0x5EC6,
- 0x5ECC,0x5ECB,0x5ECE,0x5ED1,0x5ED2,0x5ED4,0x5ED5,0x5EDC,
- 0x5EDE,0x5EE5,0x5EEB,0x5F02,0x5F06,0x5F07,0x5F08,0x5F0E,
- 0x5F19,0x5F1C,0x5F1D,0x5F21,0x5F22,0x5F23,0x5F24,0x5F28,
- 0x5F2B,0x5F2C,0x5F2E,0x5F30,0x5F34,0x5F36,0x5F3B,0x5F3D,
- 0x5F3F,0x5F40,0x5F44,0x5F45,0x5F47,0x5F4D,0x5F50,0x5F54,
- 0x5F58,0x5F5B,0x5F60,0x5F63,0x5F64,0x5F67,
-
- /* ku 29 */
- 0x5F6F,0x5F72,0x5F74,0x5F75,0x5F78,0x5F7A,0x5F7D,0x5F7E,
- 0x5F89,0x5F8D,0x5F8F,0x5F96,0x5F9C,0x5F9D,0x5FA2,0x5FA7,
- 0x5FAB,0x5FA4,0x5FAC,0x5FAF,0x5FB0,0x5FB1,0x5FB8,0x5FC4,
- 0x5FC7,0x5FC8,0x5FC9,0x5FCB,0x5FD0,0x5FD1,0x5FD2,0x5FD3,
- 0x5FD4,0x5FDE,0x5FE1,0x5FE2,0x5FE8,0x5FE9,0x5FEA,0x5FEC,
- 0x5FED,0x5FEE,0x5FEF,0x5FF2,0x5FF3,0x5FF6,0x5FFA,0x5FFC,
- 0x6007,0x600A,0x600D,0x6013,0x6014,0x6017,0x6018,0x601A,
- 0x601F,0x6024,0x602D,0x6033,0x6035,0x6040,0x6047,0x6048,
- 0x6049,0x604C,0x6051,0x6054,0x6056,0x6057,0x605D,0x6061,
- 0x6067,0x6071,0x607E,0x607F,0x6082,0x6086,0x6088,0x608A,
- 0x608E,0x6091,0x6093,0x6095,0x6098,0x609D,0x609E,0x60A2,
- 0x60A4,0x60A5,0x60A8,0x60B0,0x60B1,0x60B7,
-
- /* ku 30 */
- 0x60BB,0x60BE,0x60C2,0x60C4,0x60C8,0x60C9,0x60CA,0x60CB,
- 0x60CE,0x60CF,0x60D4,0x60D5,0x60D9,0x60DB,0x60DD,0x60DE,
- 0x60E2,0x60E5,0x60F2,0x60F5,0x60F8,0x60FC,0x60FD,0x6102,
- 0x6107,0x610A,0x610C,0x6110,0x6111,0x6112,0x6113,0x6114,
- 0x6116,0x6117,0x6119,0x611C,0x611E,0x6122,0x612A,0x612B,
- 0x6130,0x6131,0x6135,0x6136,0x6137,0x6139,0x6141,0x6145,
- 0x6146,0x6149,0x615E,0x6160,0x616C,0x6172,0x6178,0x617B,
- 0x617C,0x617F,0x6180,0x6181,0x6183,0x6184,0x618B,0x618D,
- 0x6192,0x6193,0x6197,0x6198,0x619C,0x619D,0x619F,0x61A0,
- 0x61A5,0x61A8,0x61AA,0x61AD,0x61B8,0x61B9,0x61BC,0x61C0,
- 0x61C1,0x61C2,0x61CE,0x61CF,0x61D5,0x61DC,0x61DD,0x61DE,
- 0x61DF,0x61E1,0x61E2,0x61E7,0x61E9,0x61E5,
-
- /* ku 31 */
- 0x61EC,0x61ED,0x61EF,0x6201,0x6203,0x6204,0x6207,0x6213,
- 0x6215,0x621C,0x6220,0x6222,0x6223,0x6227,0x6229,0x622B,
- 0x6239,0x623D,0x6242,0x6243,0x6244,0x6246,0x624C,0x6250,
- 0x6251,0x6252,0x6254,0x6256,0x625A,0x625C,0x6264,0x626D,
- 0x626F,0x6273,0x627A,0x627D,0x628D,0x628E,0x628F,0x6290,
- 0x62A6,0x62A8,0x62B3,0x62B6,0x62B7,0x62BA,0x62BE,0x62BF,
- 0x62C4,0x62CE,0x62D5,0x62D6,0x62DA,0x62EA,0x62F2,0x62F4,
- 0x62FC,0x62FD,0x6303,0x6304,0x630A,0x630B,0x630D,0x6310,
- 0x6313,0x6316,0x6318,0x6329,0x632A,0x632D,0x6335,0x6336,
- 0x6339,0x633C,0x6341,0x6342,0x6343,0x6344,0x6346,0x634A,
- 0x634B,0x634E,0x6352,0x6353,0x6354,0x6358,0x635B,0x6365,
- 0x6366,0x636C,0x636D,0x6371,0x6374,0x6375,
-
- /* ku 32 */
- 0x6378,0x637C,0x637D,0x637F,0x6382,0x6384,0x6387,0x638A,
- 0x6390,0x6394,0x6395,0x6399,0x639A,0x639E,0x63A4,0x63A6,
- 0x63AD,0x63AE,0x63AF,0x63BD,0x63C1,0x63C5,0x63C8,0x63CE,
- 0x63D1,0x63D3,0x63D4,0x63D5,0x63DC,0x63E0,0x63E5,0x63EA,
- 0x63EC,0x63F2,0x63F3,0x63F5,0x63F8,0x63F9,0x6409,0x640A,
- 0x6410,0x6412,0x6414,0x6418,0x641E,0x6420,0x6422,0x6424,
- 0x6425,0x6429,0x642A,0x642F,0x6430,0x6435,0x643D,0x643F,
- 0x644B,0x644F,0x6451,0x6452,0x6453,0x6454,0x645A,0x645B,
- 0x645C,0x645D,0x645F,0x6460,0x6461,0x6463,0x646D,0x6473,
- 0x6474,0x647B,0x647D,0x6485,0x6487,0x648F,0x6490,0x6491,
- 0x6498,0x6499,0x649B,0x649D,0x649F,0x64A1,0x64A3,0x64A6,
- 0x64A8,0x64AC,0x64B3,0x64BD,0x64BE,0x64BF,
-
- /* ku 33 */
- 0x64C4,0x64C9,0x64CA,0x64CB,0x64CC,0x64CE,0x64D0,0x64D1,
- 0x64D5,0x64D7,0x64E4,0x64E5,0x64E9,0x64EA,0x64ED,0x64F0,
- 0x64F5,0x64F7,0x64FB,0x64FF,0x6501,0x6504,0x6508,0x6509,
- 0x650A,0x650F,0x6513,0x6514,0x6516,0x6519,0x651B,0x651E,
- 0x651F,0x6522,0x6526,0x6529,0x652E,0x6531,0x653A,0x653C,
- 0x653D,0x6543,0x6547,0x6549,0x6550,0x6552,0x6554,0x655F,
- 0x6560,0x6567,0x656B,0x657A,0x657D,0x6581,0x6585,0x658A,
- 0x6592,0x6595,0x6598,0x659D,0x65A0,0x65A3,0x65A6,0x65AE,
- 0x65B2,0x65B3,0x65B4,0x65BF,0x65C2,0x65C8,0x65C9,0x65CE,
- 0x65D0,0x65D4,0x65D6,0x65D8,0x65DF,0x65F0,0x65F2,0x65F4,
- 0x65F5,0x65F9,0x65FE,0x65FF,0x6600,0x6604,0x6608,0x6609,
- 0x660D,0x6611,0x6612,0x6615,0x6616,0x661D,
-
- /* ku 34 */
- 0x661E,0x6621,0x6622,0x6623,0x6624,0x6626,0x6629,0x662A,
- 0x662B,0x662C,0x662E,0x6630,0x6631,0x6633,0x6639,0x6637,
- 0x6640,0x6645,0x6646,0x664A,0x664C,0x6651,0x664E,0x6657,
- 0x6658,0x6659,0x665B,0x665C,0x6660,0x6661,0x66FB,0x666A,
- 0x666B,0x666C,0x667E,0x6673,0x6675,0x667F,0x6677,0x6678,
- 0x6679,0x667B,0x6680,0x667C,0x668B,0x668C,0x668D,0x6690,
- 0x6692,0x6699,0x669A,0x669B,0x669C,0x669F,0x66A0,0x66A4,
- 0x66AD,0x66B1,0x66B2,0x66B5,0x66BB,0x66BF,0x66C0,0x66C2,
- 0x66C3,0x66C8,0x66CC,0x66CE,0x66CF,0x66D4,0x66DB,0x66DF,
- 0x66E8,0x66EB,0x66EC,0x66EE,0x66FA,0x6705,0x6707,0x670E,
- 0x6713,0x6719,0x671C,0x6720,0x6722,0x6733,0x673E,0x6745,
- 0x6747,0x6748,0x674C,0x6754,0x6755,0x675D,
-
- /* ku 35 */
- 0x6766,0x676C,0x676E,0x6774,0x6776,0x677B,0x6781,0x6784,
- 0x678E,0x678F,0x6791,0x6793,0x6796,0x6798,0x6799,0x679B,
- 0x67B0,0x67B1,0x67B2,0x67B5,0x67BB,0x67BC,0x67BD,0x67F9,
- 0x67C0,0x67C2,0x67C3,0x67C5,0x67C8,0x67C9,0x67D2,0x67D7,
- 0x67D9,0x67DC,0x67E1,0x67E6,0x67F0,0x67F2,0x67F6,0x67F7,
- 0x6852,0x6814,0x6819,0x681D,0x681F,0x6828,0x6827,0x682C,
- 0x682D,0x682F,0x6830,0x6831,0x6833,0x683B,0x683F,0x6844,
- 0x6845,0x684A,0x684C,0x6855,0x6857,0x6858,0x685B,0x686B,
- 0x686E,0x686F,0x6870,0x6871,0x6872,0x6875,0x6879,0x687A,
- 0x687B,0x687C,0x6882,0x6884,0x6886,0x6888,0x6896,0x6898,
- 0x689A,0x689C,0x68A1,0x68A3,0x68A5,0x68A9,0x68AA,0x68AE,
- 0x68B2,0x68BB,0x68C5,0x68C8,0x68CC,0x68CF,
-
- /* ku 36 */
- 0x68D0,0x68D1,0x68D3,0x68D6,0x68D9,0x68DC,0x68DD,0x68E5,
- 0x68E8,0x68EA,0x68EB,0x68EC,0x68ED,0x68F0,0x68F1,0x68F5,
- 0x68F6,0x68FB,0x68FC,0x68FD,0x6906,0x6909,0x690A,0x6910,
- 0x6911,0x6913,0x6916,0x6917,0x6931,0x6933,0x6935,0x6938,
- 0x693B,0x6942,0x6945,0x6949,0x694E,0x6957,0x695B,0x6963,
- 0x6964,0x6965,0x6966,0x6968,0x6969,0x696C,0x6970,0x6971,
- 0x6972,0x697A,0x697B,0x697F,0x6980,0x698D,0x6992,0x6996,
- 0x6998,0x69A1,0x69A5,0x69A6,0x69A8,0x69AB,0x69AD,0x69AF,
- 0x69B7,0x69B8,0x69BA,0x69BC,0x69C5,0x69C8,0x69D1,0x69D6,
- 0x69D7,0x69E2,0x69E5,0x69EE,0x69EF,0x69F1,0x69F3,0x69F5,
- 0x69FE,0x6A00,0x6A01,0x6A03,0x6A0F,0x6A11,0x6A15,0x6A1A,
- 0x6A1D,0x6A20,0x6A24,0x6A28,0x6A30,0x6A32,
-
- /* ku 37 */
- 0x6A34,0x6A37,0x6A3B,0x6A3E,0x6A3F,0x6A45,0x6A46,0x6A49,
- 0x6A4A,0x6A4E,0x6A50,0x6A51,0x6A52,0x6A55,0x6A56,0x6A5B,
- 0x6A64,0x6A67,0x6A6A,0x6A71,0x6A73,0x6A7E,0x6A81,0x6A83,
- 0x6A86,0x6A87,0x6A89,0x6A8B,0x6A91,0x6A9B,0x6A9D,0x6A9E,
- 0x6A9F,0x6AA5,0x6AAB,0x6AAF,0x6AB0,0x6AB1,0x6AB4,0x6ABD,
- 0x6ABE,0x6ABF,0x6AC6,0x6AC9,0x6AC8,0x6ACC,0x6AD0,0x6AD4,
- 0x6AD5,0x6AD6,0x6ADC,0x6ADD,0x6AE4,0x6AE7,0x6AEC,0x6AF0,
- 0x6AF1,0x6AF2,0x6AFC,0x6AFD,0x6B02,0x6B03,0x6B06,0x6B07,
- 0x6B09,0x6B0F,0x6B10,0x6B11,0x6B17,0x6B1B,0x6B1E,0x6B24,
- 0x6B28,0x6B2B,0x6B2C,0x6B2F,0x6B35,0x6B36,0x6B3B,0x6B3F,
- 0x6B46,0x6B4A,0x6B4D,0x6B52,0x6B56,0x6B58,0x6B5D,0x6B60,
- 0x6B67,0x6B6B,0x6B6E,0x6B70,0x6B75,0x6B7D,
-
- /* ku 38 */
- 0x6B7E,0x6B82,0x6B85,0x6B97,0x6B9B,0x6B9F,0x6BA0,0x6BA2,
- 0x6BA3,0x6BA8,0x6BA9,0x6BAC,0x6BAD,0x6BAE,0x6BB0,0x6BB8,
- 0x6BB9,0x6BBD,0x6BBE,0x6BC3,0x6BC4,0x6BC9,0x6BCC,0x6BD6,
- 0x6BDA,0x6BE1,0x6BE3,0x6BE6,0x6BE7,0x6BEE,0x6BF1,0x6BF7,
- 0x6BF9,0x6BFF,0x6C02,0x6C04,0x6C05,0x6C09,0x6C0D,0x6C0E,
- 0x6C10,0x6C12,0x6C19,0x6C1F,0x6C26,0x6C27,0x6C28,0x6C2C,
- 0x6C2E,0x6C33,0x6C35,0x6C36,0x6C3A,0x6C3B,0x6C3F,0x6C4A,
- 0x6C4B,0x6C4D,0x6C4F,0x6C52,0x6C54,0x6C59,0x6C5B,0x6C5C,
- 0x6C6B,0x6C6D,0x6C6F,0x6C74,0x6C76,0x6C78,0x6C79,0x6C7B,
- 0x6C85,0x6C86,0x6C87,0x6C89,0x6C94,0x6C95,0x6C97,0x6C98,
- 0x6C9C,0x6C9F,0x6CB0,0x6CB2,0x6CB4,0x6CC2,0x6CC6,0x6CCD,
- 0x6CCF,0x6CD0,0x6CD1,0x6CD2,0x6CD4,0x6CD6,
-
- /* ku 39 */
- 0x6CDA,0x6CDC,0x6CE0,0x6CE7,0x6CE9,0x6CEB,0x6CEC,0x6CEE,
- 0x6CF2,0x6CF4,0x6D04,0x6D07,0x6D0A,0x6D0E,0x6D0F,0x6D11,
- 0x6D13,0x6D1A,0x6D26,0x6D27,0x6D28,0x6C67,0x6D2E,0x6D2F,
- 0x6D31,0x6D39,0x6D3C,0x6D3F,0x6D57,0x6D5E,0x6D5F,0x6D61,
- 0x6D65,0x6D67,0x6D6F,0x6D70,0x6D7C,0x6D82,0x6D87,0x6D91,
- 0x6D92,0x6D94,0x6D96,0x6D97,0x6D98,0x6DAA,0x6DAC,0x6DB4,
- 0x6DB7,0x6DB9,0x6DBD,0x6DBF,0x6DC4,0x6DC8,0x6DCA,0x6DCE,
- 0x6DCF,0x6DD6,0x6DDB,0x6DDD,0x6DDF,0x6DE0,0x6DE2,0x6DE5,
- 0x6DE9,0x6DEF,0x6DF0,0x6DF4,0x6DF6,0x6DFC,0x6E00,0x6E04,
- 0x6E1E,0x6E22,0x6E27,0x6E32,0x6E36,0x6E39,0x6E3B,0x6E3C,
- 0x6E44,0x6E45,0x6E48,0x6E49,0x6E4B,0x6E4F,0x6E51,0x6E52,
- 0x6E53,0x6E54,0x6E57,0x6E5C,0x6E5D,0x6E5E,
-
- /* ku 40 */
- 0x6E62,0x6E63,0x6E68,0x6E73,0x6E7B,0x6E7D,0x6E8D,0x6E93,
- 0x6E99,0x6EA0,0x6EA7,0x6EAD,0x6EAE,0x6EB1,0x6EB3,0x6EBB,
- 0x6EBF,0x6EC0,0x6EC1,0x6EC3,0x6EC7,0x6EC8,0x6ECA,0x6ECD,
- 0x6ECE,0x6ECF,0x6EEB,0x6EED,0x6EEE,0x6EF9,0x6EFB,0x6EFD,
- 0x6F04,0x6F08,0x6F0A,0x6F0C,0x6F0D,0x6F16,0x6F18,0x6F1A,
- 0x6F1B,0x6F26,0x6F29,0x6F2A,0x6F2F,0x6F30,0x6F33,0x6F36,
- 0x6F3B,0x6F3C,0x6F2D,0x6F4F,0x6F51,0x6F52,0x6F53,0x6F57,
- 0x6F59,0x6F5A,0x6F5D,0x6F5E,0x6F61,0x6F62,0x6F68,0x6F6C,
- 0x6F7D,0x6F7E,0x6F83,0x6F87,0x6F88,0x6F8B,0x6F8C,0x6F8D,
- 0x6F90,0x6F92,0x6F93,0x6F94,0x6F96,0x6F9A,0x6F9F,0x6FA0,
- 0x6FA5,0x6FA6,0x6FA7,0x6FA8,0x6FAE,0x6FAF,0x6FB0,0x6FB5,
- 0x6FB6,0x6FBC,0x6FC5,0x6FC7,0x6FC8,0x6FCA,
-
- /* ku 41 */
- 0x6FDA,0x6FDE,0x6FE8,0x6FE9,0x6FF0,0x6FF5,0x6FF9,0x6FFC,
- 0x6FFD,0x7000,0x7005,0x7006,0x7007,0x700D,0x7017,0x7020,
- 0x7023,0x702F,0x7034,0x7037,0x7039,0x703C,0x7043,0x7044,
- 0x7048,0x7049,0x704A,0x704B,0x7054,0x7055,0x705D,0x705E,
- 0x704E,0x7064,0x7065,0x706C,0x706E,0x7075,0x7076,0x707E,
- 0x7081,0x7085,0x7086,0x7094,0x7095,0x7096,0x7097,0x7098,
- 0x709B,0x70A4,0x70AB,0x70B0,0x70B1,0x70B4,0x70B7,0x70CA,
- 0x70D1,0x70D3,0x70D4,0x70D5,0x70D6,0x70D8,0x70DC,0x70E4,
- 0x70FA,0x7103,0x7104,0x7105,0x7106,0x7107,0x710B,0x710C,
- 0x710F,0x711E,0x7120,0x712B,0x712D,0x712F,0x7130,0x7131,
- 0x7138,0x7141,0x7145,0x7146,0x7147,0x714A,0x714B,0x7150,
- 0x7152,0x7157,0x715A,0x715C,0x715E,0x7160,
-
- /* ku 42 */
- 0x7168,0x7179,0x7180,0x7185,0x7187,0x718C,0x7192,0x719A,
- 0x719B,0x71A0,0x71A2,0x71AF,0x71B0,0x71B2,0x71B3,0x71BA,
- 0x71BF,0x71C0,0x71C1,0x71C4,0x71CB,0x71CC,0x71D3,0x71D6,
- 0x71D9,0x71DA,0x71DC,0x71F8,0x71FE,0x7200,0x7207,0x7208,
- 0x7209,0x7213,0x7217,0x721A,0x721D,0x721F,0x7224,0x722B,
- 0x722F,0x7234,0x7238,0x7239,0x7241,0x7242,0x7243,0x7245,
- 0x724E,0x724F,0x7250,0x7253,0x7255,0x7256,0x725A,0x725C,
- 0x725E,0x7260,0x7263,0x7268,0x726B,0x726E,0x726F,0x7271,
- 0x7277,0x7278,0x727B,0x727C,0x727F,0x7284,0x7289,0x728D,
- 0x728E,0x7293,0x729B,0x72A8,0x72AD,0x72AE,0x72B1,0x72B4,
- 0x72BE,0x72C1,0x72C7,0x72C9,0x72CC,0x72D5,0x72D6,0x72D8,
- 0x72DF,0x72E5,0x72F3,0x72F4,0x72FA,0x72FB,
-
- /* ku 43 */
- 0x72FE,0x7302,0x7304,0x7305,0x7307,0x730B,0x730D,0x7312,
- 0x7313,0x7318,0x7319,0x731E,0x7322,0x7324,0x7327,0x7328,
- 0x732C,0x7331,0x7332,0x7335,0x733A,0x733B,0x733D,0x7343,
- 0x734D,0x7350,0x7352,0x7356,0x7358,0x735D,0x735E,0x735F,
- 0x7360,0x7366,0x7367,0x7369,0x736B,0x736C,0x736E,0x736F,
- 0x7371,0x7377,0x7379,0x737C,0x7380,0x7381,0x7383,0x7385,
- 0x7386,0x738E,0x7390,0x7393,0x7395,0x7397,0x7398,0x739C,
- 0x739E,0x739F,0x73A0,0x73A2,0x73A5,0x73A6,0x73AA,0x73AB,
- 0x73AD,0x73B5,0x73B7,0x73B9,0x73BC,0x73BD,0x73BF,0x73C5,
- 0x73C6,0x73C9,0x73CB,0x73CC,0x73CF,0x73D2,0x73D3,0x73D6,
- 0x73D9,0x73DD,0x73E1,0x73E3,0x73E6,0x73E7,0x73E9,0x73F4,
- 0x73F5,0x73F7,0x73F9,0x73FA,0x73FB,0x73FD,
-
- /* ku 44 */
- 0x73FF,0x7400,0x7401,0x7404,0x7407,0x740A,0x7411,0x741A,
- 0x741B,0x7424,0x7426,0x7428,0x7429,0x742A,0x742B,0x742C,
- 0x742D,0x742E,0x742F,0x7430,0x7431,0x7439,0x7440,0x7443,
- 0x7444,0x7446,0x7447,0x744B,0x744D,0x7451,0x7452,0x7457,
- 0x745D,0x7462,0x7466,0x7467,0x7468,0x746B,0x746D,0x746E,
- 0x7471,0x7472,0x7480,0x7481,0x7485,0x7486,0x7487,0x7489,
- 0x748F,0x7490,0x7491,0x7492,0x7498,0x7499,0x749A,0x749C,
- 0x749F,0x74A0,0x74A1,0x74A3,0x74A6,0x74A8,0x74A9,0x74AA,
- 0x74AB,0x74AE,0x74AF,0x74B1,0x74B2,0x74B5,0x74B9,0x74BB,
- 0x74BF,0x74C8,0x74C9,0x74CC,0x74D0,0x74D3,0x74D8,0x74DA,
- 0x74DB,0x74DE,0x74DF,0x74E4,0x74E8,0x74EA,0x74EB,0x74EF,
- 0x74F4,0x74FA,0x74FB,0x74FC,0x74FF,0x7506,
-
- /* ku 45 */
- 0x7512,0x7516,0x7517,0x7520,0x7521,0x7524,0x7527,0x7529,
- 0x752A,0x752F,0x7536,0x7539,0x753D,0x753E,0x753F,0x7540,
- 0x7543,0x7547,0x7548,0x754E,0x7550,0x7552,0x7557,0x755E,
- 0x755F,0x7561,0x756F,0x7571,0x7579,0x757A,0x757B,0x757C,
- 0x757D,0x757E,0x7581,0x7585,0x7590,0x7592,0x7593,0x7595,
- 0x7599,0x759C,0x75A2,0x75A4,0x75B4,0x75BA,0x75BF,0x75C0,
- 0x75C1,0x75C4,0x75C6,0x75CC,0x75CE,0x75CF,0x75D7,0x75DC,
- 0x75DF,0x75E0,0x75E1,0x75E4,0x75E7,0x75EC,0x75EE,0x75EF,
- 0x75F1,0x75F9,0x7600,0x7602,0x7603,0x7604,0x7607,0x7608,
- 0x760A,0x760C,0x760F,0x7612,0x7613,0x7615,0x7616,0x7619,
- 0x761B,0x761C,0x761D,0x761E,0x7623,0x7625,0x7626,0x7629,
- 0x762D,0x7632,0x7633,0x7635,0x7638,0x7639,
-
- /* ku 46 */
- 0x763A,0x763C,0x764A,0x7640,0x7641,0x7643,0x7644,0x7645,
- 0x7649,0x764B,0x7655,0x7659,0x765F,0x7664,0x7665,0x766D,
- 0x766E,0x766F,0x7671,0x7674,0x7681,0x7685,0x768C,0x768D,
- 0x7695,0x769B,0x769C,0x769D,0x769F,0x76A0,0x76A2,0x76A3,
- 0x76A4,0x76A5,0x76A6,0x76A7,0x76A8,0x76AA,0x76AD,0x76BD,
- 0x76C1,0x76C5,0x76C9,0x76CB,0x76CC,0x76CE,0x76D4,0x76D9,
- 0x76E0,0x76E6,0x76E8,0x76EC,0x76F0,0x76F1,0x76F6,0x76F9,
- 0x76FC,0x7700,0x7706,0x770A,0x770E,0x7712,0x7714,0x7715,
- 0x7717,0x7719,0x771A,0x771C,0x7722,0x7728,0x772D,0x772E,
- 0x772F,0x7734,0x7735,0x7736,0x7739,0x773D,0x773E,0x7742,
- 0x7745,0x7746,0x774A,0x774D,0x774E,0x774F,0x7752,0x7756,
- 0x7757,0x775C,0x775E,0x775F,0x7760,0x7762,
-
- /* ku 47 */
- 0x7764,0x7767,0x776A,0x776C,0x7770,0x7772,0x7773,0x7774,
- 0x777A,0x777D,0x7780,0x7784,0x778C,0x778D,0x7794,0x7795,
- 0x7796,0x779A,0x779F,0x77A2,0x77A7,0x77AA,0x77AE,0x77AF,
- 0x77B1,0x77B5,0x77BE,0x77C3,0x77C9,0x77D1,0x77D2,0x77D5,
- 0x77D9,0x77DE,0x77DF,0x77E0,0x77E4,0x77E6,0x77EA,0x77EC,
- 0x77F0,0x77F1,0x77F4,0x77F8,0x77FB,0x7805,0x7806,0x7809,
- 0x780D,0x780E,0x7811,0x781D,0x7821,0x7822,0x7823,0x782D,
- 0x782E,0x7830,0x7835,0x7837,0x7843,0x7844,0x7847,0x7848,
- 0x784C,0x784E,0x7852,0x785C,0x785E,0x7860,0x7861,0x7863,
- 0x7864,0x7868,0x786A,0x786E,0x787A,0x787E,0x788A,0x788F,
- 0x7894,0x7898,0x78A1,0x789D,0x789E,0x789F,0x78A4,0x78A8,
- 0x78AC,0x78AD,0x78B0,0x78B1,0x78B2,0x78B3,
-
- /* ku 48 */
- 0x78BB,0x78BD,0x78BF,0x78C7,0x78C8,0x78C9,0x78CC,0x78CE,
- 0x78D2,0x78D3,0x78D5,0x78D6,0x78E4,0x78DB,0x78DF,0x78E0,
- 0x78E1,0x78E6,0x78EA,0x78F2,0x78F3,0x7900,0x78F6,0x78F7,
- 0x78FA,0x78FB,0x78FF,0x7906,0x790C,0x7910,0x791A,0x791C,
- 0x791E,0x791F,0x7920,0x7925,0x7927,0x7929,0x792D,0x7931,
- 0x7934,0x7935,0x793B,0x793D,0x793F,0x7944,0x7945,0x7946,
- 0x794A,0x794B,0x794F,0x7951,0x7954,0x7958,0x795B,0x795C,
- 0x7967,0x7969,0x796B,0x7972,0x7979,0x797B,0x797C,0x797E,
- 0x798B,0x798C,0x7991,0x7993,0x7994,0x7995,0x7996,0x7998,
- 0x799B,0x799C,0x79A1,0x79A8,0x79A9,0x79AB,0x79AF,0x79B1,
- 0x79B4,0x79B8,0x79BB,0x79C2,0x79C4,0x79C7,0x79C8,0x79CA,
- 0x79CF,0x79D4,0x79D6,0x79DA,0x79DD,0x79DE,
-
- /* ku 49 */
- 0x79E0,0x79E2,0x79E5,0x79EA,0x79EB,0x79ED,0x79F1,0x79F8,
- 0x79FC,0x7A02,0x7A03,0x7A07,0x7A09,0x7A0A,0x7A0C,0x7A11,
- 0x7A15,0x7A1B,0x7A1E,0x7A21,0x7A27,0x7A2B,0x7A2D,0x7A2F,
- 0x7A30,0x7A34,0x7A35,0x7A38,0x7A39,0x7A3A,0x7A44,0x7A45,
- 0x7A47,0x7A48,0x7A4C,0x7A55,0x7A56,0x7A59,0x7A5C,0x7A5D,
- 0x7A5F,0x7A60,0x7A65,0x7A67,0x7A6A,0x7A6D,0x7A75,0x7A78,
- 0x7A7E,0x7A80,0x7A82,0x7A85,0x7A86,0x7A8A,0x7A8B,0x7A90,
- 0x7A91,0x7A94,0x7A9E,0x7AA0,0x7AA3,0x7AAC,0x7AB3,0x7AB5,
- 0x7AB9,0x7ABB,0x7ABC,0x7AC6,0x7AC9,0x7ACC,0x7ACE,0x7AD1,
- 0x7ADB,0x7AE8,0x7AE9,0x7AEB,0x7AEC,0x7AF1,0x7AF4,0x7AFB,
- 0x7AFD,0x7AFE,0x7B07,0x7B14,0x7B1F,0x7B23,0x7B27,0x7B29,
- 0x7B2A,0x7B2B,0x7B2D,0x7B2E,0x7B2F,0x7B30,
-
- /* ku 50 */
- 0x7B31,0x7B34,0x7B3D,0x7B3F,0x7B40,0x7B41,0x7B47,0x7B4E,
- 0x7B55,0x7B60,0x7B64,0x7B66,0x7B69,0x7B6A,0x7B6D,0x7B6F,
- 0x7B72,0x7B73,0x7B77,0x7B84,0x7B89,0x7B8E,0x7B90,0x7B91,
- 0x7B96,0x7B9B,0x7B9E,0x7BA0,0x7BA5,0x7BAC,0x7BAF,0x7BB0,
- 0x7BB2,0x7BB5,0x7BB6,0x7BBA,0x7BBB,0x7BBC,0x7BBD,0x7BC2,
- 0x7BC5,0x7BC8,0x7BCA,0x7BD4,0x7BD6,0x7BD7,0x7BD9,0x7BDA,
- 0x7BDB,0x7BE8,0x7BEA,0x7BF2,0x7BF4,0x7BF5,0x7BF8,0x7BF9,
- 0x7BFA,0x7BFC,0x7BFE,0x7C01,0x7C02,0x7C03,0x7C04,0x7C06,
- 0x7C09,0x7C0B,0x7C0C,0x7C0E,0x7C0F,0x7C19,0x7C1B,0x7C20,
- 0x7C25,0x7C26,0x7C28,0x7C2C,0x7C31,0x7C33,0x7C34,0x7C36,
- 0x7C39,0x7C3A,0x7C46,0x7C4A,0x7C55,0x7C51,0x7C52,0x7C53,
- 0x7C59,0x7C5A,0x7C5B,0x7C5C,0x7C5D,0x7C5E,
-
- /* ku 51 */
- 0x7C61,0x7C63,0x7C67,0x7C69,0x7C6D,0x7C6E,0x7C70,0x7C72,
- 0x7C79,0x7C7C,0x7C7D,0x7C86,0x7C87,0x7C8F,0x7C94,0x7C9E,
- 0x7CA0,0x7CA6,0x7CB0,0x7CB6,0x7CB7,0x7CBA,0x7CBB,0x7CBC,
- 0x7CBF,0x7CC4,0x7CC7,0x7CC8,0x7CC9,0x7CCD,0x7CCF,0x7CD3,
- 0x7CD4,0x7CD5,0x7CD7,0x7CD9,0x7CDA,0x7CDD,0x7CE6,0x7CE9,
- 0x7CEB,0x7CF5,0x7D03,0x7D07,0x7D08,0x7D09,0x7D0F,0x7D11,
- 0x7D12,0x7D13,0x7D16,0x7D1D,0x7D1E,0x7D23,0x7D26,0x7D2A,
- 0x7D2D,0x7D31,0x7D3C,0x7D3D,0x7D3E,0x7D40,0x7D41,0x7D47,
- 0x7D48,0x7D4D,0x7D51,0x7D53,0x7D57,0x7D59,0x7D5A,0x7D5C,
- 0x7D5D,0x7D65,0x7D67,0x7D6A,0x7D70,0x7D78,0x7D7A,0x7D7B,
- 0x7D7F,0x7D81,0x7D82,0x7D83,0x7D85,0x7D86,0x7D88,0x7D8B,
- 0x7D8C,0x7D8D,0x7D91,0x7D96,0x7D97,0x7D9D,
-
- /* ku 52 */
- 0x7D9E,0x7DA6,0x7DA7,0x7DAA,0x7DB3,0x7DB6,0x7DB7,0x7DB9,
- 0x7DC2,0x7DC3,0x7DC4,0x7DC5,0x7DC6,0x7DCC,0x7DCD,0x7DCE,
- 0x7DD7,0x7DD9,0x7E00,0x7DE2,0x7DE5,0x7DE6,0x7DEA,0x7DEB,
- 0x7DED,0x7DF1,0x7DF5,0x7DF6,0x7DF9,0x7DFA,0x7E08,0x7E10,
- 0x7E11,0x7E15,0x7E17,0x7E1C,0x7E1D,0x7E20,0x7E27,0x7E28,
- 0x7E2C,0x7E2D,0x7E2F,0x7E33,0x7E36,0x7E3F,0x7E44,0x7E45,
- 0x7E47,0x7E4E,0x7E50,0x7E52,0x7E58,0x7E5F,0x7E61,0x7E62,
- 0x7E65,0x7E6B,0x7E6E,0x7E6F,0x7E73,0x7E78,0x7E7E,0x7E81,
- 0x7E86,0x7E87,0x7E8A,0x7E8D,0x7E91,0x7E95,0x7E98,0x7E9A,
- 0x7E9D,0x7E9E,0x7F3C,0x7F3B,0x7F3D,0x7F3E,0x7F3F,0x7F43,
- 0x7F44,0x7F47,0x7F4F,0x7F52,0x7F53,0x7F5B,0x7F5C,0x7F5D,
- 0x7F61,0x7F63,0x7F64,0x7F65,0x7F66,0x7F6D,
-
- /* ku 53 */
- 0x7F71,0x7F7D,0x7F7E,0x7F7F,0x7F80,0x7F8B,0x7F8D,0x7F8F,
- 0x7F90,0x7F91,0x7F96,0x7F97,0x7F9C,0x7FA1,0x7FA2,0x7FA6,
- 0x7FAA,0x7FAD,0x7FB4,0x7FBC,0x7FBF,0x7FC0,0x7FC3,0x7FC8,
- 0x7FCE,0x7FCF,0x7FDB,0x7FDF,0x7FE3,0x7FE5,0x7FE8,0x7FEC,
- 0x7FEE,0x7FEF,0x7FF2,0x7FFA,0x7FFD,0x7FFE,0x7FFF,0x8007,
- 0x8008,0x800A,0x800D,0x800E,0x800F,0x8011,0x8013,0x8014,
- 0x8016,0x801D,0x801E,0x801F,0x8020,0x8024,0x8026,0x802C,
- 0x802E,0x8030,0x8034,0x8035,0x8037,0x8039,0x803A,0x803C,
- 0x803E,0x8040,0x8044,0x8060,0x8064,0x8066,0x806D,0x8071,
- 0x8075,0x8081,0x8088,0x808E,0x809C,0x809E,0x80A6,0x80A7,
- 0x80AB,0x80B8,0x80B9,0x80C8,0x80CD,0x80CF,0x80D2,0x80D4,
- 0x80D5,0x80D7,0x80D8,0x80E0,0x80ED,0x80EE,
-
- /* ku 54 */
- 0x80F0,0x80F2,0x80F3,0x80F6,0x80F9,0x80FA,0x80FE,0x8103,
- 0x810B,0x8116,0x8117,0x8118,0x811C,0x811E,0x8120,0x8124,
- 0x8127,0x812C,0x8130,0x8135,0x813A,0x813C,0x8145,0x8147,
- 0x814A,0x814C,0x8152,0x8157,0x8160,0x8161,0x8167,0x8168,
- 0x8169,0x816D,0x816F,0x8177,0x8181,0x8190,0x8184,0x8185,
- 0x8186,0x818B,0x818E,0x8196,0x8198,0x819B,0x819E,0x81A2,
- 0x81AE,0x81B2,0x81B4,0x81BB,0x81CB,0x81C3,0x81C5,0x81CA,
- 0x81CE,0x81CF,0x81D5,0x81D7,0x81DB,0x81DD,0x81DE,0x81E1,
- 0x81E4,0x81EB,0x81EC,0x81F0,0x81F1,0x81F2,0x81F5,0x81F6,
- 0x81F8,0x81F9,0x81FD,0x81FF,0x8200,0x8203,0x820F,0x8213,
- 0x8214,0x8219,0x821A,0x821D,0x8221,0x8222,0x8228,0x8232,
- 0x8234,0x823A,0x8243,0x8244,0x8245,0x8246,
-
- /* ku 55 */
- 0x824B,0x824E,0x824F,0x8251,0x8256,0x825C,0x8260,0x8263,
- 0x8267,0x826D,0x8274,0x827B,0x827D,0x827F,0x8280,0x8281,
- 0x8283,0x8284,0x8287,0x8289,0x828A,0x828E,0x8291,0x8294,
- 0x8296,0x8298,0x829A,0x829B,0x82A0,0x82A1,0x82A3,0x82A4,
- 0x82A7,0x82A8,0x82A9,0x82AA,0x82AE,0x82B0,0x82B2,0x82B4,
- 0x82B7,0x82BA,0x82BC,0x82BE,0x82BF,0x82C6,0x82D0,0x82D5,
- 0x82DA,0x82E0,0x82E2,0x82E4,0x82E8,0x82EA,0x82ED,0x82EF,
- 0x82F6,0x82F7,0x82FD,0x82FE,0x8300,0x8301,0x8307,0x8308,
- 0x830A,0x830B,0x8354,0x831B,0x831D,0x831E,0x831F,0x8321,
- 0x8322,0x832C,0x832D,0x832E,0x8330,0x8333,0x8337,0x833A,
- 0x833C,0x833D,0x8342,0x8343,0x8344,0x8347,0x834D,0x834E,
- 0x8351,0x8355,0x8356,0x8357,0x8370,0x8378,
-
- /* ku 56 */
- 0x837D,0x837F,0x8380,0x8382,0x8384,0x8386,0x838D,0x8392,
- 0x8394,0x8395,0x8398,0x8399,0x839B,0x839C,0x839D,0x83A6,
- 0x83A7,0x83A9,0x83AC,0x83BE,0x83BF,0x83C0,0x83C7,0x83C9,
- 0x83CF,0x83D0,0x83D1,0x83D4,0x83DD,0x8353,0x83E8,0x83EA,
- 0x83F6,0x83F8,0x83F9,0x83FC,0x8401,0x8406,0x840A,0x840F,
- 0x8411,0x8415,0x8419,0x83AD,0x842F,0x8439,0x8445,0x8447,
- 0x8448,0x844A,0x844D,0x844F,0x8451,0x8452,0x8456,0x8458,
- 0x8459,0x845A,0x845C,0x8460,0x8464,0x8465,0x8467,0x846A,
- 0x8470,0x8473,0x8474,0x8476,0x8478,0x847C,0x847D,0x8481,
- 0x8485,0x8492,0x8493,0x8495,0x849E,0x84A6,0x84A8,0x84A9,
- 0x84AA,0x84AF,0x84B1,0x84B4,0x84BA,0x84BD,0x84BE,0x84C0,
- 0x84C2,0x84C7,0x84C8,0x84CC,0x84CF,0x84D3,
-
- /* ku 57 */
- 0x84DC,0x84E7,0x84EA,0x84EF,0x84F0,0x84F1,0x84F2,0x84F7,
- 0x8532,0x84FA,0x84FB,0x84FD,0x8502,0x8503,0x8507,0x850C,
- 0x850E,0x8510,0x851C,0x851E,0x8522,0x8523,0x8524,0x8525,
- 0x8527,0x852A,0x852B,0x852F,0x8533,0x8534,0x8536,0x853F,
- 0x8546,0x854F,0x8550,0x8551,0x8552,0x8553,0x8556,0x8559,
- 0x855C,0x855D,0x855E,0x855F,0x8560,0x8561,0x8562,0x8564,
- 0x856B,0x856F,0x8579,0x857A,0x857B,0x857D,0x857F,0x8581,
- 0x8585,0x8586,0x8589,0x858B,0x858C,0x858F,0x8593,0x8598,
- 0x859D,0x859F,0x85A0,0x85A2,0x85A5,0x85A7,0x85B4,0x85B6,
- 0x85B7,0x85B8,0x85BC,0x85BD,0x85BE,0x85BF,0x85C2,0x85C7,
- 0x85CA,0x85CB,0x85CE,0x85AD,0x85D8,0x85DA,0x85DF,0x85E0,
- 0x85E6,0x85E8,0x85ED,0x85F3,0x85F6,0x85FC,
-
- /* ku 58 */
- 0x85FF,0x8600,0x8604,0x8605,0x860D,0x860E,0x8610,0x8611,
- 0x8612,0x8618,0x8619,0x861B,0x861E,0x8621,0x8627,0x8629,
- 0x8636,0x8638,0x863A,0x863C,0x863D,0x8640,0x8642,0x8646,
- 0x8652,0x8653,0x8656,0x8657,0x8658,0x8659,0x865D,0x8660,
- 0x8661,0x8662,0x8663,0x8664,0x8669,0x866C,0x866F,0x8675,
- 0x8676,0x8677,0x867A,0x868D,0x8691,0x8696,0x8698,0x869A,
- 0x869C,0x86A1,0x86A6,0x86A7,0x86A8,0x86AD,0x86B1,0x86B3,
- 0x86B4,0x86B5,0x86B7,0x86B8,0x86B9,0x86BF,0x86C0,0x86C1,
- 0x86C3,0x86C5,0x86D1,0x86D2,0x86D5,0x86D7,0x86DA,0x86DC,
- 0x86E0,0x86E3,0x86E5,0x86E7,0x8688,0x86FA,0x86FC,0x86FD,
- 0x8704,0x8705,0x8707,0x870B,0x870E,0x870F,0x8710,0x8713,
- 0x8714,0x8719,0x871E,0x871F,0x8721,0x8723,
-
- /* ku 59 */
- 0x8728,0x872E,0x872F,0x8731,0x8732,0x8739,0x873A,0x873C,
- 0x873D,0x873E,0x8740,0x8743,0x8745,0x874D,0x8758,0x875D,
- 0x8761,0x8764,0x8765,0x876F,0x8771,0x8772,0x877B,0x8783,
- 0x8784,0x8785,0x8786,0x8787,0x8788,0x8789,0x878B,0x878C,
- 0x8790,0x8793,0x8795,0x8797,0x8798,0x8799,0x879E,0x87A0,
- 0x87A3,0x87A7,0x87AC,0x87AD,0x87AE,0x87B1,0x87B5,0x87BE,
- 0x87BF,0x87C1,0x87C8,0x87C9,0x87CA,0x87CE,0x87D5,0x87D6,
- 0x87D9,0x87DA,0x87DC,0x87DF,0x87E2,0x87E3,0x87E4,0x87EA,
- 0x87EB,0x87ED,0x87F1,0x87F3,0x87F8,0x87FA,0x87FF,0x8801,
- 0x8803,0x8806,0x8809,0x880A,0x880B,0x8810,0x8819,0x8812,
- 0x8813,0x8814,0x8818,0x881A,0x881B,0x881C,0x881E,0x881F,
- 0x8828,0x882D,0x882E,0x8830,0x8832,0x8835,
-
- /* ku 60 */
- 0x883A,0x883C,0x8841,0x8843,0x8845,0x8848,0x8849,0x884A,
- 0x884B,0x884E,0x8851,0x8855,0x8856,0x8858,0x885A,0x885C,
- 0x885F,0x8860,0x8864,0x8869,0x8871,0x8879,0x887B,0x8880,
- 0x8898,0x889A,0x889B,0x889C,0x889F,0x88A0,0x88A8,0x88AA,
- 0x88BA,0x88BD,0x88BE,0x88C0,0x88CA,0x88CB,0x88CC,0x88CD,
- 0x88CE,0x88D1,0x88D2,0x88D3,0x88DB,0x88DE,0x88E7,0x88EF,
- 0x88F0,0x88F1,0x88F5,0x88F7,0x8901,0x8906,0x890D,0x890E,
- 0x890F,0x8915,0x8916,0x8918,0x8919,0x891A,0x891C,0x8920,
- 0x8926,0x8927,0x8928,0x8930,0x8931,0x8932,0x8935,0x8939,
- 0x893A,0x893E,0x8940,0x8942,0x8945,0x8946,0x8949,0x894F,
- 0x8952,0x8957,0x895A,0x895B,0x895C,0x8961,0x8962,0x8963,
- 0x896B,0x896E,0x8970,0x8973,0x8975,0x897A,
-
- /* ku 61 */
- 0x897B,0x897C,0x897D,0x8989,0x898D,0x8990,0x8994,0x8995,
- 0x899B,0x899C,0x899F,0x89A0,0x89A5,0x89B0,0x89B4,0x89B5,
- 0x89B6,0x89B7,0x89BC,0x89D4,0x89D5,0x89D6,0x89D7,0x89D8,
- 0x89E5,0x89E9,0x89EB,0x89ED,0x89F1,0x89F3,0x89F6,0x89F9,
- 0x89FD,0x89FF,0x8A04,0x8A05,0x8A07,0x8A0F,0x8A11,0x8A12,
- 0x8A14,0x8A15,0x8A1E,0x8A20,0x8A22,0x8A24,0x8A26,0x8A2B,
- 0x8A2C,0x8A2F,0x8A35,0x8A37,0x8A3D,0x8A3E,0x8A40,0x8A43,
- 0x8A45,0x8A47,0x8A49,0x8A4D,0x8A4E,0x8A53,0x8A56,0x8A57,
- 0x8A58,0x8A5C,0x8A5D,0x8A61,0x8A65,0x8A67,0x8A75,0x8A76,
- 0x8A77,0x8A79,0x8A7A,0x8A7B,0x8A7E,0x8A7F,0x8A80,0x8A83,
- 0x8A86,0x8A8B,0x8A8F,0x8A90,0x8A92,0x8A96,0x8A97,0x8A99,
- 0x8A9F,0x8AA7,0x8AA9,0x8AAE,0x8AAF,0x8AB3,
-
- /* ku 62 */
- 0x8AB6,0x8AB7,0x8ABB,0x8ABE,0x8AC3,0x8AC6,0x8AC8,0x8AC9,
- 0x8ACA,0x8AD1,0x8AD3,0x8AD4,0x8AD5,0x8AD7,0x8ADD,0x8ADF,
- 0x8AEC,0x8AF0,0x8AF4,0x8AF5,0x8AF6,0x8AFC,0x8AFF,0x8B05,
- 0x8B06,0x8B0B,0x8B11,0x8B1C,0x8B1E,0x8B1F,0x8B0A,0x8B2D,
- 0x8B30,0x8B37,0x8B3C,0x8B42,0x8B43,0x8B44,0x8B45,0x8B46,
- 0x8B48,0x8B52,0x8B53,0x8B54,0x8B59,0x8B4D,0x8B5E,0x8B63,
- 0x8B6D,0x8B76,0x8B78,0x8B79,0x8B7C,0x8B7E,0x8B81,0x8B84,
- 0x8B85,0x8B8B,0x8B8D,0x8B8F,0x8B94,0x8B95,0x8B9C,0x8B9E,
- 0x8B9F,0x8C38,0x8C39,0x8C3D,0x8C3E,0x8C45,0x8C47,0x8C49,
- 0x8C4B,0x8C4F,0x8C51,0x8C53,0x8C54,0x8C57,0x8C58,0x8C5B,
- 0x8C5D,0x8C59,0x8C63,0x8C64,0x8C66,0x8C68,0x8C69,0x8C6D,
- 0x8C73,0x8C75,0x8C76,0x8C7B,0x8C7E,0x8C86,
-
- /* ku 63 */
- 0x8C87,0x8C8B,0x8C90,0x8C92,0x8C93,0x8C99,0x8C9B,0x8C9C,
- 0x8CA4,0x8CB9,0x8CBA,0x8CC5,0x8CC6,0x8CC9,0x8CCB,0x8CCF,
- 0x8CD6,0x8CD5,0x8CD9,0x8CDD,0x8CE1,0x8CE8,0x8CEC,0x8CEF,
- 0x8CF0,0x8CF2,0x8CF5,0x8CF7,0x8CF8,0x8CFE,0x8CFF,0x8D01,
- 0x8D03,0x8D09,0x8D12,0x8D17,0x8D1B,0x8D65,0x8D69,0x8D6C,
- 0x8D6E,0x8D7F,0x8D82,0x8D84,0x8D88,0x8D8D,0x8D90,0x8D91,
- 0x8D95,0x8D9E,0x8D9F,0x8DA0,0x8DA6,0x8DAB,0x8DAC,0x8DAF,
- 0x8DB2,0x8DB5,0x8DB7,0x8DB9,0x8DBB,0x8DC0,0x8DC5,0x8DC6,
- 0x8DC7,0x8DC8,0x8DCA,0x8DCE,0x8DD1,0x8DD4,0x8DD5,0x8DD7,
- 0x8DD9,0x8DE4,0x8DE5,0x8DE7,0x8DEC,0x8DF0,0x8DBC,0x8DF1,
- 0x8DF2,0x8DF4,0x8DFD,0x8E01,0x8E04,0x8E05,0x8E06,0x8E0B,
- 0x8E11,0x8E14,0x8E16,0x8E20,0x8E21,0x8E22,
-
- /* ku 64 */
- 0x8E23,0x8E26,0x8E27,0x8E31,0x8E33,0x8E36,0x8E37,0x8E38,
- 0x8E39,0x8E3D,0x8E40,0x8E41,0x8E4B,0x8E4D,0x8E4E,0x8E4F,
- 0x8E54,0x8E5B,0x8E5C,0x8E5D,0x8E5E,0x8E61,0x8E62,0x8E69,
- 0x8E6C,0x8E6D,0x8E6F,0x8E70,0x8E71,0x8E79,0x8E7A,0x8E7B,
- 0x8E82,0x8E83,0x8E89,0x8E90,0x8E92,0x8E95,0x8E9A,0x8E9B,
- 0x8E9D,0x8E9E,0x8EA2,0x8EA7,0x8EA9,0x8EAD,0x8EAE,0x8EB3,
- 0x8EB5,0x8EBA,0x8EBB,0x8EC0,0x8EC1,0x8EC3,0x8EC4,0x8EC7,
- 0x8ECF,0x8ED1,0x8ED4,0x8EDC,0x8EE8,0x8EEE,0x8EF0,0x8EF1,
- 0x8EF7,0x8EF9,0x8EFA,0x8EED,0x8F00,0x8F02,0x8F07,0x8F08,
- 0x8F0F,0x8F10,0x8F16,0x8F17,0x8F18,0x8F1E,0x8F20,0x8F21,
- 0x8F23,0x8F25,0x8F27,0x8F28,0x8F2C,0x8F2D,0x8F2E,0x8F34,
- 0x8F35,0x8F36,0x8F37,0x8F3A,0x8F40,0x8F41,
-
- /* ku 65 */
- 0x8F43,0x8F47,0x8F4F,0x8F51,0x8F52,0x8F53,0x8F54,0x8F55,
- 0x8F58,0x8F5D,0x8F5E,0x8F65,0x8F9D,0x8FA0,0x8FA1,0x8FA4,
- 0x8FA5,0x8FA6,0x8FB5,0x8FB6,0x8FB8,0x8FBE,0x8FC0,0x8FC1,
- 0x8FC6,0x8FCA,0x8FCB,0x8FCD,0x8FD0,0x8FD2,0x8FD3,0x8FD5,
- 0x8FE0,0x8FE3,0x8FE4,0x8FE8,0x8FEE,0x8FF1,0x8FF5,0x8FF6,
- 0x8FFB,0x8FFE,0x9002,0x9004,0x9008,0x900C,0x9018,0x901B,
- 0x9028,0x9029,0x902F,0x902A,0x902C,0x902D,0x9033,0x9034,
- 0x9037,0x903F,0x9043,0x9044,0x904C,0x905B,0x905D,0x9062,
- 0x9066,0x9067,0x906C,0x9070,0x9074,0x9079,0x9085,0x9088,
- 0x908B,0x908C,0x908E,0x9090,0x9095,0x9097,0x9098,0x9099,
- 0x909B,0x90A0,0x90A1,0x90A2,0x90A5,0x90B0,0x90B2,0x90B3,
- 0x90B4,0x90B6,0x90BD,0x90CC,0x90BE,0x90C3,
-
- /* ku 66 */
- 0x90C4,0x90C5,0x90C7,0x90C8,0x90D5,0x90D7,0x90D8,0x90D9,
- 0x90DC,0x90DD,0x90DF,0x90E5,0x90D2,0x90F6,0x90EB,0x90EF,
- 0x90F0,0x90F4,0x90FE,0x90FF,0x9100,0x9104,0x9105,0x9106,
- 0x9108,0x910D,0x9110,0x9114,0x9116,0x9117,0x9118,0x911A,
- 0x911C,0x911E,0x9120,0x9125,0x9122,0x9123,0x9127,0x9129,
- 0x912E,0x912F,0x9131,0x9134,0x9136,0x9137,0x9139,0x913A,
- 0x913C,0x913D,0x9143,0x9147,0x9148,0x914F,0x9153,0x9157,
- 0x9159,0x915A,0x915B,0x9161,0x9164,0x9167,0x916D,0x9174,
- 0x9179,0x917A,0x917B,0x9181,0x9183,0x9185,0x9186,0x918A,
- 0x918E,0x9191,0x9193,0x9194,0x9195,0x9198,0x919E,0x91A1,
- 0x91A6,0x91A8,0x91AC,0x91AD,0x91AE,0x91B0,0x91B1,0x91B2,
- 0x91B3,0x91B6,0x91BB,0x91BC,0x91BD,0x91BF,
-
- /* ku 67 */
- 0x91C2,0x91C3,0x91C5,0x91D3,0x91D4,0x91D7,0x91D9,0x91DA,
- 0x91DE,0x91E4,0x91E5,0x91E9,0x91EA,0x91EC,0x91ED,0x91EE,
- 0x91EF,0x91F0,0x91F1,0x91F7,0x91F9,0x91FB,0x91FD,0x9200,
- 0x9201,0x9204,0x9205,0x9206,0x9207,0x9209,0x920A,0x920C,
- 0x9210,0x9212,0x9213,0x9216,0x9218,0x921C,0x921D,0x9223,
- 0x9224,0x9225,0x9226,0x9228,0x922E,0x922F,0x9230,0x9233,
- 0x9235,0x9236,0x9238,0x9239,0x923A,0x923C,0x923E,0x9240,
- 0x9242,0x9243,0x9246,0x9247,0x924A,0x924D,0x924E,0x924F,
- 0x9251,0x9258,0x9259,0x925C,0x925D,0x9260,0x9261,0x9265,
- 0x9267,0x9268,0x9269,0x926E,0x926F,0x9270,0x9275,0x9276,
- 0x9277,0x9278,0x9279,0x927B,0x927C,0x927D,0x927F,0x9288,
- 0x9289,0x928A,0x928D,0x928E,0x9292,0x9297,
-
- /* ku 68 */
- 0x9299,0x929F,0x92A0,0x92A4,0x92A5,0x92A7,0x92A8,0x92AB,
- 0x92AF,0x92B2,0x92B6,0x92B8,0x92BA,0x92BB,0x92BC,0x92BD,
- 0x92BF,0x92C0,0x92C1,0x92C2,0x92C3,0x92C5,0x92C6,0x92C7,
- 0x92C8,0x92CB,0x92CC,0x92CD,0x92CE,0x92D0,0x92D3,0x92D5,
- 0x92D7,0x92D8,0x92D9,0x92DC,0x92DD,0x92DF,0x92E0,0x92E1,
- 0x92E3,0x92E5,0x92E7,0x92E8,0x92EC,0x92EE,0x92F0,0x92F9,
- 0x92FB,0x92FF,0x9300,0x9302,0x9308,0x930D,0x9311,0x9314,
- 0x9315,0x931C,0x931D,0x931E,0x931F,0x9321,0x9324,0x9325,
- 0x9327,0x9329,0x932A,0x9333,0x9334,0x9336,0x9337,0x9347,
- 0x9348,0x9349,0x9350,0x9351,0x9352,0x9355,0x9357,0x9358,
- 0x935A,0x935E,0x9364,0x9365,0x9367,0x9369,0x936A,0x936D,
- 0x936F,0x9370,0x9371,0x9373,0x9374,0x9376,
-
- /* ku 69 */
- 0x937A,0x937D,0x937F,0x9380,0x9381,0x9382,0x9388,0x938A,
- 0x938B,0x938D,0x938F,0x9392,0x9395,0x9398,0x939B,0x939E,
- 0x93A1,0x93A3,0x93A4,0x93A6,0x93A8,0x93AB,0x93B4,0x93B5,
- 0x93B6,0x93BA,0x93A9,0x93C1,0x93C4,0x93C5,0x93C6,0x93C7,
- 0x93C9,0x93CA,0x93CB,0x93CC,0x93CD,0x93D3,0x93D9,0x93DC,
- 0x93DE,0x93DF,0x93E2,0x93E6,0x93E7,0x93F9,0x93F7,0x93F8,
- 0x93FA,0x93FB,0x93FD,0x9401,0x9402,0x9404,0x9408,0x9409,
- 0x940D,0x940E,0x940F,0x9415,0x9416,0x9417,0x941F,0x942E,
- 0x942F,0x9431,0x9432,0x9433,0x9434,0x943B,0x943F,0x943D,
- 0x9443,0x9445,0x9448,0x944A,0x944C,0x9455,0x9459,0x945C,
- 0x945F,0x9461,0x9463,0x9468,0x946B,0x946D,0x946E,0x946F,
- 0x9471,0x9472,0x9484,0x9483,0x9578,0x9579,
-
- /* ku 70 */
- 0x957E,0x9584,0x9588,0x958C,0x958D,0x958E,0x959D,0x959E,
- 0x959F,0x95A1,0x95A6,0x95A9,0x95AB,0x95AC,0x95B4,0x95B6,
- 0x95BA,0x95BD,0x95BF,0x95C6,0x95C8,0x95C9,0x95CB,0x95D0,
- 0x95D1,0x95D2,0x95D3,0x95D9,0x95DA,0x95DD,0x95DE,0x95DF,
- 0x95E0,0x95E4,0x95E6,0x961D,0x961E,0x9622,0x9624,0x9625,
- 0x9626,0x962C,0x9631,0x9633,0x9637,0x9638,0x9639,0x963A,
- 0x963C,0x963D,0x9641,0x9652,0x9654,0x9656,0x9657,0x9658,
- 0x9661,0x966E,0x9674,0x967B,0x967C,0x967E,0x967F,0x9681,
- 0x9682,0x9683,0x9684,0x9689,0x9691,0x9696,0x969A,0x969D,
- 0x969F,0x96A4,0x96A5,0x96A6,0x96A9,0x96AE,0x96AF,0x96B3,
- 0x96BA,0x96CA,0x96D2,0x5DB2,0x96D8,0x96DA,0x96DD,0x96DE,
- 0x96DF,0x96E9,0x96EF,0x96F1,0x96FA,0x9702,
-
- /* ku 71 */
- 0x9703,0x9705,0x9709,0x971A,0x971B,0x971D,0x9721,0x9722,
- 0x9723,0x9728,0x9731,0x9733,0x9741,0x9743,0x974A,0x974E,
- 0x974F,0x9755,0x9757,0x9758,0x975A,0x975B,0x9763,0x9767,
- 0x976A,0x976E,0x9773,0x9776,0x9777,0x9778,0x977B,0x977D,
- 0x977F,0x9780,0x9789,0x9795,0x9796,0x9797,0x9799,0x979A,
- 0x979E,0x979F,0x97A2,0x97AC,0x97AE,0x97B1,0x97B2,0x97B5,
- 0x97B6,0x97B8,0x97B9,0x97BA,0x97BC,0x97BE,0x97BF,0x97C1,
- 0x97C4,0x97C5,0x97C7,0x97C9,0x97CA,0x97CC,0x97CD,0x97CE,
- 0x97D0,0x97D1,0x97D4,0x97D7,0x97D8,0x97D9,0x97DD,0x97DE,
- 0x97E0,0x97DB,0x97E1,0x97E4,0x97EF,0x97F1,0x97F4,0x97F7,
- 0x97F8,0x97FA,0x9807,0x980A,0x9819,0x980D,0x980E,0x9814,
- 0x9816,0x981C,0x981E,0x9820,0x9823,0x9826,
-
- /* ku 72 */
- 0x982B,0x982E,0x982F,0x9830,0x9832,0x9833,0x9835,0x9825,
- 0x983E,0x9844,0x9847,0x984A,0x9851,0x9852,0x9853,0x9856,
- 0x9857,0x9859,0x985A,0x9862,0x9863,0x9865,0x9866,0x986A,
- 0x986C,0x98AB,0x98AD,0x98AE,0x98B0,0x98B4,0x98B7,0x98B8,
- 0x98BA,0x98BB,0x98BF,0x98C2,0x98C5,0x98C8,0x98CC,0x98E1,
- 0x98E3,0x98E5,0x98E6,0x98E7,0x98EA,0x98F3,0x98F6,0x9902,
- 0x9907,0x9908,0x9911,0x9915,0x9916,0x9917,0x991A,0x991B,
- 0x991C,0x991F,0x9922,0x9926,0x9927,0x992B,0x9931,0x9932,
- 0x9933,0x9934,0x9935,0x9939,0x993A,0x993B,0x993C,0x9940,
- 0x9941,0x9946,0x9947,0x9948,0x994D,0x994E,0x9954,0x9958,
- 0x9959,0x995B,0x995C,0x995E,0x995F,0x9960,0x999B,0x999D,
- 0x999F,0x99A6,0x99B0,0x99B1,0x99B2,0x99B5,
-
- /* ku 73 */
- 0x99B9,0x99BA,0x99BD,0x99BF,0x99C3,0x99C9,0x99D3,0x99D4,
- 0x99D9,0x99DA,0x99DC,0x99DE,0x99E7,0x99EA,0x99EB,0x99EC,
- 0x99F0,0x99F4,0x99F5,0x99F9,0x99FD,0x99FE,0x9A02,0x9A03,
- 0x9A04,0x9A0B,0x9A0C,0x9A10,0x9A11,0x9A16,0x9A1E,0x9A20,
- 0x9A22,0x9A23,0x9A24,0x9A27,0x9A2D,0x9A2E,0x9A33,0x9A35,
- 0x9A36,0x9A38,0x9A47,0x9A41,0x9A44,0x9A4A,0x9A4B,0x9A4C,
- 0x9A4E,0x9A51,0x9A54,0x9A56,0x9A5D,0x9AAA,0x9AAC,0x9AAE,
- 0x9AAF,0x9AB2,0x9AB4,0x9AB5,0x9AB6,0x9AB9,0x9ABB,0x9ABE,
- 0x9ABF,0x9AC1,0x9AC3,0x9AC6,0x9AC8,0x9ACE,0x9AD0,0x9AD2,
- 0x9AD5,0x9AD6,0x9AD7,0x9ADB,0x9ADC,0x9AE0,0x9AE4,0x9AE5,
- 0x9AE7,0x9AE9,0x9AEC,0x9AF2,0x9AF3,0x9AF5,0x9AF9,0x9AFA,
- 0x9AFD,0x9AFF,0x9B00,0x9B01,0x9B02,0x9B03,
-
- /* ku 74 */
- 0x9B04,0x9B05,0x9B08,0x9B09,0x9B0B,0x9B0C,0x9B0D,0x9B0E,
- 0x9B10,0x9B12,0x9B16,0x9B19,0x9B1B,0x9B1C,0x9B20,0x9B26,
- 0x9B2B,0x9B2D,0x9B33,0x9B34,0x9B35,0x9B37,0x9B39,0x9B3A,
- 0x9B3D,0x9B48,0x9B4B,0x9B4C,0x9B55,0x9B56,0x9B57,0x9B5B,
- 0x9B5E,0x9B61,0x9B63,0x9B65,0x9B66,0x9B68,0x9B6A,0x9B6B,
- 0x9B6C,0x9B6D,0x9B6E,0x9B73,0x9B75,0x9B77,0x9B78,0x9B79,
- 0x9B7F,0x9B80,0x9B84,0x9B85,0x9B86,0x9B87,0x9B89,0x9B8A,
- 0x9B8B,0x9B8D,0x9B8F,0x9B90,0x9B94,0x9B9A,0x9B9D,0x9B9E,
- 0x9BA6,0x9BA7,0x9BA9,0x9BAC,0x9BB0,0x9BB1,0x9BB2,0x9BB7,
- 0x9BB8,0x9BBB,0x9BBC,0x9BBE,0x9BBF,0x9BC1,0x9BC7,0x9BC8,
- 0x9BCE,0x9BD0,0x9BD7,0x9BD8,0x9BDD,0x9BDF,0x9BE5,0x9BE7,
- 0x9BEA,0x9BEB,0x9BEF,0x9BF3,0x9BF7,0x9BF8,
-
- /* ku 75 */
- 0x9BF9,0x9BFA,0x9BFD,0x9BFF,0x9C00,0x9C02,0x9C0B,0x9C0F,
- 0x9C11,0x9C16,0x9C18,0x9C19,0x9C1A,0x9C1C,0x9C1E,0x9C22,
- 0x9C23,0x9C26,0x9C27,0x9C28,0x9C29,0x9C2A,0x9C31,0x9C35,
- 0x9C36,0x9C37,0x9C3D,0x9C41,0x9C43,0x9C44,0x9C45,0x9C49,
- 0x9C4A,0x9C4E,0x9C4F,0x9C50,0x9C53,0x9C54,0x9C56,0x9C58,
- 0x9C5B,0x9C5D,0x9C5E,0x9C5F,0x9C63,0x9C69,0x9C6A,0x9C5C,
- 0x9C6B,0x9C68,0x9C6E,0x9C70,0x9C72,0x9C75,0x9C77,0x9C7B,
- 0x9CE6,0x9CF2,0x9CF7,0x9CF9,0x9D0B,0x9D02,0x9D11,0x9D17,
- 0x9D18,0x9D1C,0x9D1D,0x9D1E,0x9D2F,0x9D30,0x9D32,0x9D33,
- 0x9D34,0x9D3A,0x9D3C,0x9D45,0x9D3D,0x9D42,0x9D43,0x9D47,
- 0x9D4A,0x9D53,0x9D54,0x9D5F,0x9D63,0x9D62,0x9D65,0x9D69,
- 0x9D6A,0x9D6B,0x9D70,0x9D76,0x9D77,0x9D7B,
-
- /* ku 76 */
- 0x9D7C,0x9D7E,0x9D83,0x9D84,0x9D86,0x9D8A,0x9D8D,0x9D8E,
- 0x9D92,0x9D93,0x9D95,0x9D96,0x9D97,0x9D98,0x9DA1,0x9DAA,
- 0x9DAC,0x9DAE,0x9DB1,0x9DB5,0x9DB9,0x9DBC,0x9DBF,0x9DC3,
- 0x9DC7,0x9DC9,0x9DCA,0x9DD4,0x9DD5,0x9DD6,0x9DD7,0x9DDA,
- 0x9DDE,0x9DDF,0x9DE0,0x9DE5,0x9DE7,0x9DE9,0x9DEB,0x9DEE,
- 0x9DF0,0x9DF3,0x9DF4,0x9DFE,0x9E0A,0x9E02,0x9E07,0x9E0E,
- 0x9E10,0x9E11,0x9E12,0x9E15,0x9E16,0x9E19,0x9E1C,0x9E1D,
- 0x9E7A,0x9E7B,0x9E7C,0x9E80,0x9E82,0x9E83,0x9E84,0x9E85,
- 0x9E87,0x9E8E,0x9E8F,0x9E96,0x9E98,0x9E9B,0x9E9E,0x9EA4,
- 0x9EA8,0x9EAC,0x9EAE,0x9EAF,0x9EB0,0x9EB3,0x9EB4,0x9EB5,
- 0x9EC6,0x9EC8,0x9ECB,0x9ED5,0x9EDF,0x9EE4,0x9EE7,0x9EEC,
- 0x9EED,0x9EEE,0x9EF0,0x9EF1,0x9EF2,0x9EF5,
-
- /* ku 77 */
- 0x9EF8,0x9EFF,0x9F02,0x9F03,0x9F09,0x9F0F,0x9F10,0x9F11,
- 0x9F12,0x9F14,0x9F16,0x9F17,0x9F19,0x9F1A,0x9F1B,0x9F1F,
- 0x9F22,0x9F26,0x9F2A,0x9F2B,0x9F2F,0x9F31,0x9F32,0x9F34,
- 0x9F37,0x9F39,0x9F3A,0x9F3C,0x9F3D,0x9F3F,0x9F41,0x9F43,
- 0x9F44,0x9F45,0x9F46,0x9F47,0x9F53,0x9F55,0x9F56,0x9F57,
- 0x9F58,0x9F5A,0x9F5D,0x9F5E,0x9F68,0x9F69,0x9F6D,0x9F6E,
- 0x9F6F,0x9F70,0x9F71,0x9F73,0x9F75,0x9F7A,0x9F7D,0x9F8F,
- 0x9F90,0x9F91,0x9F92,0x9F94,0x9F96,0x9F97,0x9F9E,0x9FA1,
- 0x9FA2,0x9FA3,0x9FA5
-};
-
-static const int jisx0212_ucs_table_size = (sizeof (jisx0212_ucs_table) / sizeof (unsigned short));
-
-
-static const unsigned short ucs_a1_jis_table[] = {
- /* 0000h */
- 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xA2C2,0x2171,0x2172,0xA2F0,0x0000,0xA2C3,0x2178,
- 0x212F,0xA2ED,0xA2EC,0x0000,0x224C,0x0000,0xA2EE,0xA2B4,
- 0x216B,0x215E,0x0000,0x0000,0x212D,0x0000,0x2279,0x0000,
- 0xA2B1,0x0000,0xA2EB,0x0000,0x0000,0x0000,0x0000,0xA2C4,
- 0xAAA2,0xAAA1,0xAAA4,0xAAAA,0xAAA3,0xAAA9,0xA9A1,0xAAAE,
- 0xAAB2,0xAAB1,0xAAB4,0xAAB3,0xAAC0,0xAABF,0xAAC2,0xAAC1,
- 0x0000,0xAAD0,0xAAD2,0xAAD1,0xAAD4,0xAAD8,0xAAD3,0x215F,
- 0xA9AC,0xAAE3,0xAAE2,0xAAE5,0xAAE4,0xAAF2,0xA9B0,0xA9CE,
- 0xABA2,0xABA1,0xABA4,0xABAA,0xABA3,0xABA9,0xA9C1,0xABAE,
- 0xABB2,0xABB1,0xABB4,0xABB3,0xABC0,0xABBF,0xABC2,0xABC1,
- 0xA9C3,0xABD0,0xABD2,0xABD1,0xABD4,0xABD8,0xABD3,0x2160,
- 0xA9CC,0xABE3,0xABE2,0xABE5,0xABE4,0xABF2,0xA9D0,0xABF3,
-
- /* 0100h */
- 0xAAA7,0xABA7,0xAAA5,0xABA5,0xAAA8,0xABA8,0xAAAB,0xABAB,
- 0xAAAC,0xABAC,0xAAAF,0xABAF,0xAAAD,0xABAD,0xAAB0,0xABB0,
- 0xA9A2,0xA9C2,0xAAB7,0xABB7,0x0000,0x0000,0xAAB6,0xABB6,
- 0xAAB8,0xABB8,0xAAB5,0xABB5,0xAABA,0xABBA,0xAABB,0xABBB,
- 0xAABD,0xABBD,0xAABC,0x0000,0xAABE,0xABBE,0xA9A4,0xA9C4,
- 0xAAC7,0xABC7,0xAAC5,0xABC5,0x0000,0x0000,0xAAC6,0xABC6,
- 0xAAC4,0xA9C5,0xA9A6,0xA9C6,0xAAC8,0xABC8,0xAAC9,0xABC9,
- 0xA9C7,0xAACA,0xABCA,0xAACC,0xABCC,0xAACB,0xABCB,0xA9A9,
- 0xA9C9,0xA9A8,0xA9C8,0xAACD,0xABCD,0xAACF,0xABCF,0xAACE,
- 0xABCE,0xA9CA,0xA9AB,0xA9CB,0xAAD7,0xABD7,0x0000,0x0000,
- 0xAAD6,0xABD6,0xA9AD,0xA9CD,0xAAD9,0xABD9,0xAADB,0xABDB,
- 0xAADA,0xABDA,0xAADC,0xABDC,0xAADD,0xABDD,0xAADF,0xABDF,
- 0xAADE,0xABDE,0xAAE1,0xABE1,0xAAE0,0xABE0,0xA9AF,0xA9CF,
- 0xAAEC,0xABEC,0xAAE9,0xABE9,0xAAE6,0xABE6,0xAAEB,0xABEB,
- 0xAAE8,0xABE8,0xAAEA,0xABEA,0xAAF1,0xABF1,0xAAF4,0xABF4,
- 0xAAF3,0xAAF5,0xABF5,0xAAF7,0xABF7,0xAAF6,0xABF6,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xAAA6,0xABA6,0xAAC3,
- 0xABC3,0xAAD5,0xABD5,0xAAE7,0xABE7,0xAAF0,0xABF0,0xAAED,
- 0xABED,0xAAEF,0xABEF,0xAAEE,0xABEE,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xABB9,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 0200h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xA2B0,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xA2AF,0xA2B2,0xA2B6,0xA2B5,0x0000,0xA2B3,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 0300h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0xA2B8,0xA2B9,0xA6E1,0x0000,
- 0xA6E2,0xA6E3,0xA6E4,0x0000,0xA6E7,0x0000,0xA6E9,0xA6EC,
- 0xA6F6,0x2621,0x2622,0x2623,0x2624,0x2625,0x2626,0x2627,
- 0x2628,0x2629,0x262A,0x262B,0x262C,0x262D,0x262E,0x262F,
- 0x2630,0x2631,0x0000,0x2632,0x2633,0x2634,0x2635,0x2636,
- 0x2637,0x2638,0xA6E5,0xA6EA,0xA6F1,0xA6F2,0xA6F3,0xA6F4,
- 0xA6FB,0x2641,0x2642,0x2643,0x2644,0x2645,0x2646,0x2647,
- 0x2648,0x2649,0x264A,0x264B,0x264C,0x264D,0x264E,0x264F,
- 0x2650,0x2651,0xA6F8,0x2652,0x2653,0x2654,0x2655,0x2656,
- 0x2657,0x2658,0xA6F5,0xA6FA,0xA6F7,0xA6F9,0xA6FC,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 0400h */
- 0x0000,0x2727,0xA7C2,0xA7C3,0xA7C4,0xA7C5,0xA7C6,0xA7C7,
- 0xA7C8,0xA7C9,0xA7CA,0xA7CB,0xA7CC,0x0000,0xA7CD,0xA7CE,
- 0x2721,0x2722,0x2723,0x2724,0x2725,0x2726,0x2728,0x2729,
- 0x272A,0x272B,0x272C,0x272D,0x272E,0x272F,0x2730,0x2731,
- 0x2732,0x2733,0x2734,0x2735,0x2736,0x2737,0x2738,0x2739,
- 0x273A,0x273B,0x273C,0x273D,0x273E,0x273F,0x2740,0x2741,
- 0x2751,0x2752,0x2753,0x2754,0x2755,0x2756,0x2758,0x2759,
- 0x275A,0x275B,0x275C,0x275D,0x275E,0x275F,0x2760,0x2761,
- 0x2762,0x2763,0x2764,0x2765,0x2766,0x2767,0x2768,0x2769,
- 0x276A,0x276B,0x276C,0x276D,0x276E,0x276F,0x2770,0x2771,
- 0x0000,0x2757,0xA7F2,0xA7F3,0xA7F4,0xA7F5,0xA7F6,0xA7F7,
- 0xA7F8,0xA7F9,0xA7FA,0xA7FB,0xA7FC,0x0000,0xA7FD,0xA7FE
-};
-static const int ucs_a1_jis_table_min = 0x0000;
-static const int ucs_a1_jis_table_max = 0x0000 + (sizeof (ucs_a1_jis_table) / sizeof (unsigned short));
-
-
-static const unsigned short ucs_a2_jis_table[] = {
- /* 2000h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x213E,0x0000,0x0000,0x0000,0x0000,0x213D,0x2142,0x0000,
- 0x2146,0x2147,0x0000,0x0000,0x2148,0x2149,0x0000,0x0000,
- 0x2277,0x2278,0x0000,0x0000,0x0000,0x2145,0x2144,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x2273,0x0000,0x216C,0x216D,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x2228,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2100h */
- 0x0000,0x0000,0x0000,0x216E,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xA2F1,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xA2EF,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x2272,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x222B,0x222C,0x222A,0x222D,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x224D,0x0000,0x224E,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2200h */
- 0x224F,0x0000,0x225F,0x2250,0x0000,0x0000,0x0000,0x2260,
- 0x223A,0x0000,0x0000,0x223B,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x215D,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x2265,0x0000,0x0000,0x2267,0x2167,0x0000,
- 0x225C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x224A,
- 0x224B,0x2241,0x2240,0x2269,0x226A,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x2168,0x2268,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x2266,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x2262,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x2162,0x2261,0x0000,0x0000,0x0000,0x0000,0x2165,0x2166,
- 0x0000,0x0000,0x2263,0x2264,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x223E,0x223F,0x0000,0x0000,0x223C,0x223D,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x225D,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2300h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x225E,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2400h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2500h */
- 0x2821,0x282C,0x2822,0x282D,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x2823,0x0000,0x0000,0x282E,
- 0x2824,0x0000,0x0000,0x282F,0x2826,0x0000,0x0000,0x2831,
- 0x2825,0x0000,0x0000,0x2830,0x2827,0x283C,0x0000,0x0000,
- 0x2837,0x0000,0x0000,0x2832,0x2829,0x283E,0x0000,0x0000,
- 0x2839,0x0000,0x0000,0x2834,0x2828,0x0000,0x0000,0x2838,
- 0x283D,0x0000,0x0000,0x2833,0x282A,0x0000,0x0000,0x283A,
- 0x283F,0x0000,0x0000,0x2835,0x282B,0x0000,0x0000,0x283B,
- 0x0000,0x0000,0x2840,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x2836,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x2223,0x2222,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x2225,0x2224,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x2227,0x2226,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2221,0x217E,
- 0x0000,0x0000,0x0000,0x217B,0x0000,0x0000,0x217D,0x217C,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x227E,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2600h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x217A,0x2179,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x216A,0x0000,0x2169,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x2276,0x0000,0x0000,0x2275,0x0000,0x2274,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2700h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2800h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2900h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2A00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2B00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2C00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2D00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2E00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2F00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 3000h */
- 0x2121,0x2122,0x2123,0x2137,0x0000,0x2139,0x213A,0x213B,
- 0x2152,0x2153,0x2154,0x2155,0x2156,0x2157,0x2158,0x2159,
- 0x215A,0x215B,0x2229,0x222E,0x214C,0x214D,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x2141,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x2421,0x2422,0x2423,0x2424,0x2425,0x2426,0x2427,
- 0x2428,0x2429,0x242A,0x242B,0x242C,0x242D,0x242E,0x242F,
- 0x2430,0x2431,0x2432,0x2433,0x2434,0x2435,0x2436,0x2437,
- 0x2438,0x2439,0x243A,0x243B,0x243C,0x243D,0x243E,0x243F,
- 0x2440,0x2441,0x2442,0x2443,0x2444,0x2445,0x2446,0x2447,
- 0x2448,0x2449,0x244A,0x244B,0x244C,0x244D,0x244E,0x244F,
- 0x2450,0x2451,0x2452,0x2453,0x2454,0x2455,0x2456,0x2457,
- 0x2458,0x2459,0x245A,0x245B,0x245C,0x245D,0x245E,0x245F,
- 0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,
- 0x2468,0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F,
- 0x2470,0x2471,0x2472,0x2473,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x212B,0x212C,0x2135,0x2136,0x0000,
- 0x0000,0x2521,0x2522,0x2523,0x2524,0x2525,0x2526,0x2527,
- 0x2528,0x2529,0x252A,0x252B,0x252C,0x252D,0x252E,0x252F,
- 0x2530,0x2531,0x2532,0x2533,0x2534,0x2535,0x2536,0x2537,
- 0x2538,0x2539,0x253A,0x253B,0x253C,0x253D,0x253E,0x253F,
- 0x2540,0x2541,0x2542,0x2543,0x2544,0x2545,0x2546,0x2547,
- 0x2548,0x2549,0x254A,0x254B,0x254C,0x254D,0x254E,0x254F,
- 0x2550,0x2551,0x2552,0x2553,0x2554,0x2555,0x2556,0x2557,
- 0x2558,0x2559,0x255A,0x255B,0x255C,0x255D,0x255E,0x255F,
- 0x2560,0x2561,0x2562,0x2563,0x2564,0x2565,0x2566,0x2567,
- 0x2568,0x2569,0x256A,0x256B,0x256C,0x256D,0x256E,0x256F,
- 0x2570,0x2571,0x2572,0x2573,0x2574,0x2575,0x2576,0x0000,
- 0x0000,0x0000,0x0000,0x2126,0x213C,0x2133,0x2134,0x0000
-};
-static const int ucs_a2_jis_table_min = 0x2000;
-static const int ucs_a2_jis_table_max = 0x2000 + (sizeof (ucs_a2_jis_table) / sizeof (unsigned short));
-
-
-static const unsigned short ucs_i_jis_table[] = {
- /* 4E00h */
- 0x306C,0x437A,0xB0A1,0x3C37,0xB0A2,0xB0A3,0x0000,0x4B7C,
- 0x3E66,0x3B30,0x3E65,0x323C,0xB0A4,0x4954,0x4D3F,0x0000,
- 0x5022,0x312F,0xB0A5,0x0000,0x336E,0x5023,0x4024,0x5242,
- 0x3556,0x4A3A,0x0000,0x0000,0x0000,0x0000,0x3E67,0xB0A6,
- 0x0000,0x4E3E,0x0000,0xB0A7,0xB0A8,0x0000,0x4A42,0x0000,
- 0xB0A9,0x0000,0x5024,0xB0AA,0x0000,0x4366,0xB0AB,0xB0AC,
- 0xB0AD,0x5025,0x367A,0x0000,0x0000,0xB0AE,0x5026,0x0000,
- 0x345D,0x4330,0x0000,0x3C67,0x5027,0x0000,0x0000,0x5028,
- 0xB0AF,0xB0B0,0x5029,0x4735,0xB0B1,0x3557,0x0000,0xB0B2,
- 0x0000,0x0000,0x0000,0x4737,0x0000,0x4663,0x3843,0x4B33,
- 0x0000,0xB0B3,0x0000,0x0000,0x0000,0x6949,0x502A,0x3E68,
- 0x502B,0x3235,0xB0B4,0x0000,0xB0B5,0x3665,0x3870,0x4C69,
- 0x0000,0x0000,0x5626,0xB0B6,0x0000,0x0000,0x0000,0x0000,
- 0xB0B7,0xB0B8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x4D70,0x0000,0x467D,0xB0B9,0xB0BA,0x0000,0x0000,
- 0x0000,0xB0BB,0x0000,0x0000,0x0000,0x0000,0x3425,0xB0BC,
- 0x3535,0x0000,0x502C,0x0000,0x0000,0x502D,0x4E3B,0x0000,
- 0x4D3D,0x4168,0x502F,0x3B76,0x4673,0xB0BD,0x5032,0x0000,
- 0x0000,0x313E,0x385F,0x0000,0x385E,0x3066,0xB0BE,0xB0BF,
- 0x4F4B,0x4F4A,0x0000,0x3A33,0x3021,0xB0C0,0x5033,0x5034,
- 0x5035,0x4B34,0x5036,0x0000,0x3872,0x3067,0x4B72,0x0000,
- 0x357C,0x0000,0x0000,0x357D,0x357E,0x4462,0x4E3C,0xB0C1,
- 0x5037,0x0000,0x0000,0x5038,0x0000,0x0000,0x5039,0x0000,
- 0x0000,0xB0C2,0x3F4D,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x3D3A,0x3F4E,0x503E,0xB0C3,0x503C,0x0000,0x503D,0x3558,
- 0x0000,0x0000,0x3A23,0x3270,0x0000,0x503B,0x503A,0x4A29,
- 0xB0C4,0x0000,0x0000,0x0000,0x3B46,0x3B45,0x423E,0x503F,
- 0x4955,0x4067,0xB0C5,0xB0C6,0x0000,0x2138,0x5040,0x5042,
- 0xB0C7,0xB0C8,0xB0C9,0x4265,0x4E61,0x304A,0x0000,0x0000,
- 0xB0CA,0x0000,0x0000,0x0000,0x0000,0x5041,0x323E,0xB0CB,
- 0x3644,0xB0CC,0x4367,0xB0CD,0x0000,0xB0CE,0x376F,0x5043,
- 0x0000,0x0000,0x0000,0x4724,0x0000,0xB0CF,0xB0D0,0xB0D1,
-
- /* 4F00h */
- 0xB0D2,0x346B,0xB0D3,0xB0D4,0x0000,0x0000,0x0000,0x0000,
- 0xB0D5,0x5044,0x304B,0xB0D6,0xB0D7,0x3860,0x346C,0x497A,
- 0x4832,0x3559,0xB0D8,0x0000,0x0000,0xB0D9,0xB0DA,0xB0DB,
- 0x0000,0xB0DC,0x3271,0x0000,0x5067,0x4541,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xB0DD,0x476C,
- 0x5046,0xB0DE,0x0000,0xB0E0,0x483C,0xB0E1,0x4E62,0xB0E2,
- 0x3F2D,0xB0E3,0x3B47,0xB0E4,0x3B77,0x3240,0xB0E5,0x0000,
- 0xB0E6,0x0000,0xB0E7,0x4451,0x0000,0x0000,0x4322,0x504A,
- 0xB0E8,0xB0E9,0x0000,0xB0EA,0xB0EB,0x304C,0x4463,0x3D3B,
- 0x3A34,0x4D24,0xB0EC,0x424E,0xB0ED,0x323F,0xB0EE,0x5049,
- 0xB0EF,0x4D3E,0x5045,0x5047,0x3A6E,0x5048,0x5524,0xB0F0,
- 0xB0DF,0x0000,0x0000,0xB0F1,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x5050,0xB0F2,0x0000,0xB0F3,0x0000,0xB0F4,0x5053,
- 0x5051,0xB0F5,0x0000,0x3242,0x0000,0x4A3B,0x504B,0xB0F6,
- 0xB0F7,0xB0F8,0xB0F9,0x504F,0x3873,0xB0FA,0xB0FB,0x3B48,
- 0x0000,0xB0FC,0xB0FD,0x3426,0xB0FE,0xB1A1,0x5054,0x0000,
- 0x504C,0xB1A2,0xB1A3,0x4E63,0xB1A4,0x3B78,0xB1A5,0x504D,
- 0xB1A6,0x5052,0xB1A7,0xB1A8,0xB1A9,0x0000,0x5055,0xB1AA,
- 0x504E,0xB1AB,0xB1AC,0x3621,0x0000,0x304D,0xB1AD,0xB1AE,
- 0x3622,0x3241,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x5525,0x0000,0x4B79,0x496E,0x3874,
- 0x0000,0x0000,0xB1AF,0x0000,0x0000,0x3F2F,0x4E37,0xB1B0,
- 0x0000,0xB1B1,0x0000,0xB1B2,0xB1B3,0xB1B4,0xB1B5,0x4A58,
- 0xB1B6,0xB1B7,0x3738,0x4225,0x3264,0xB1B8,0xB1B9,0x0000,
- 0xB1BA,0xB1BB,0x3D53,0xB1BC,0xB1BD,0xB1BE,0x5059,0xB1BF,
- 0x505E,0x505C,0xB1C0,0x0000,0x5057,0x0000,0x0000,0x422F,
- 0x505A,0x0000,0x505D,0x505B,0xB1C1,0x4A5D,0x0000,0x5058,
- 0xB1C2,0x3F2E,0xB1C3,0x4B73,0x505F,0x5060,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3D24,0x506D,
- 0xB1C4,0x0000,0xB1C5,0x4750,0x0000,0x4936,0x5068,0x0000,
- 0x4A70,0x0000,0x3236,0x0000,0xB1C6,0xB1C7,0x506C,0xB1C8,
-
- /* 5000h */
- 0xB1C9,0xB1CA,0x0000,0x0000,0xB1CB,0x5066,0x506F,0xB1CC,
- 0x0000,0x4152,0xB1CD,0x3844,0xB1CE,0x475C,0xB1CF,0x6047,
- 0xB1D0,0x506E,0x455D,0xB1D1,0x5063,0x0000,0x3876,0xB1D2,
- 0xB1D3,0x3875,0x5061,0xB1D4,0xB1D5,0xB1D6,0xB1D7,0x3C5A,
- 0x0000,0x5069,0xB1D8,0x4A6F,0x434D,0x5065,0x3771,0xB1D9,
- 0x5062,0x506A,0x5064,0x4E51,0x506B,0x4F41,0xB1DA,0x0000,
- 0xB1DB,0x0000,0xB1DC,0xB1DD,0x0000,0xB1DE,0x3666,0x0000,
- 0x0000,0x3770,0x0000,0xB1F6,0x0000,0x0000,0x0000,0x0000,
- 0xB1DF,0xB1E0,0xB1E1,0x5070,0x0000,0xB1E2,0xB1E3,0x5071,
- 0x5075,0x304E,0xB1E4,0x0000,0xB1E5,0x0000,0xB1E6,0x4A50,
- 0x5074,0xB1E7,0xB1E8,0xB1E9,0x0000,0x5073,0x5077,0xB1EA,
- 0x0000,0xB1EB,0x5076,0x0000,0x4464,0x0000,0x0000,0xB1EC,
- 0xB1ED,0x0000,0xB1EE,0xB1EF,0x0000,0x3772,0xB1F0,0xB1F1,
- 0x0000,0x0000,0xB1F2,0x0000,0x5078,0xB1F3,0x0000,0x0000,
- 0xB1F4,0xB1F5,0x3C45,0x0000,0x4226,0x4465,0x3676,0x0000,
- 0x5079,0x0000,0x0000,0x0000,0x0000,0x3536,0x0000,0x0000,
- 0x507A,0xB1F7,0x0000,0xB1F8,0xB1F9,0x507C,0xB1FA,0x0000,
- 0x0000,0x0000,0xB1FB,0x0000,0x0000,0x4B35,0xB1FC,0xB1FD,
- 0xB1FE,0x3766,0xB2A1,0xB2A2,0xB2A3,0x0000,0xB2A4,0x0000,
- 0x3B31,0x4877,0x507B,0xB2A5,0xB2A6,0x0000,0xB2A7,0xB2A8,
- 0xB2A9,0xB2AA,0xB2AB,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xB2AC,0x0000,0x3A45,0x4D43,0x0000,0xB2AD,
- 0xB2AE,0x0000,0x507E,0x5123,0x507D,0x3A44,0x0000,0x3D7D,
- 0x0000,0xB2AF,0xB2B0,0x0000,0x0000,0xB2B1,0x3739,0x0000,
- 0xB2B2,0x0000,0x5124,0xB2B3,0xB2B4,0x364F,0x0000,0xB2B5,
- 0x0000,0x5121,0x5122,0x0000,0xB2B6,0x462F,0xB2B7,0x417C,
- 0xB2B8,0x3623,0x0000,0xB2B9,0xB2BA,0x4B4D,0x5125,0x0000,
- 0xB2BB,0x0000,0x4E3D,0x0000,0xB2BC,0xB2BD,0x5126,0xB2BE,
- 0x0000,0x0000,0xB2BF,0x5129,0xB2C0,0x5127,0xB2C1,0x414E,
- 0xB2C2,0xB2C3,0x0000,0x0000,0x0000,0x5128,0x512A,0xB2C4,
- 0x0000,0xB2C5,0xB2D1,0x0000,0x0000,0x512C,0xB2C6,0x0000,
- 0x0000,0x512B,0xB2C7,0x4A48,0x0000,0x0000,0xB2C8,0x0000,
-
- /* 5100h */
- 0x3537,0x512E,0x512F,0xB2C9,0x322F,0x0000,0xB2CA,0xB2CB,
- 0xB2CC,0x512D,0x0000,0xB2CD,0xB2CE,0xB2CF,0xB2D0,0x0000,
- 0xB2D2,0x0000,0x3C74,0x0000,0x5132,0x5131,0x5130,0xB2D3,
- 0x5056,0xB2D4,0x5133,0xB2D5,0xB2D6,0xB2D7,0xB2D8,0x3D7E,
- 0x0000,0x5134,0x0000,0xB2D9,0x0000,0x0000,0x0000,0xB2DA,
- 0xB2DB,0x0000,0x4D25,0x0000,0xB2DC,0xB2DD,0x0000,0xB2DE,
- 0x0000,0xB2DF,0x4C59,0xB2E0,0xB2E1,0xB2E2,0x0000,0x5136,
- 0xB2E3,0xB2E4,0x5135,0x5138,0x5137,0x0000,0x0000,0x5139,
- 0x513A,0x3074,0xB2E5,0x3835,0x373B,0x3D3C,0x437B,0x3624,
- 0x4068,0x3877,0xB2E6,0x396E,0x513C,0x4C48,0x4546,0xB2E7,
- 0x3B79,0x0000,0x513B,0xB2E8,0x513D,0xB2E9,0x0000,0xB2EA,
- 0xB2EB,0x0000,0x455E,0x0000,0x3375,0x0000,0x0000,0xB2EC,
- 0x0000,0x0000,0x513E,0x0000,0xB2ED,0x467E,0xB2EE,0x0000,
- 0x4134,0x5140,0x5141,0x482C,0x3878,0x4F3B,0x5142,0x0000,
- 0x0000,0x3626,0x0000,0x0000,0x0000,0x4A3C,0x4236,0x3671,
- 0x4535,0x0000,0x0000,0x0000,0x3773,0x0000,0xB2EF,0x0000,
- 0x5143,0x0000,0x5144,0xB2F0,0xB2F1,0x4662,0x315F,0x0000,
- 0x0000,0x5147,0x3A7D,0xB2F2,0x5146,0x3A46,0xB2F3,0x5148,
- 0x666E,0x5149,0x4B41,0x514A,0x0000,0x514B,0x514C,0x3E69,
- 0xB2F4,0x3C4C,0x0000,0x0000,0x0000,0xB2F5,0x0000,0x0000,
- 0x3427,0xB2F6,0x514F,0xB2F7,0x514D,0x4C3D,0x514E,0x0000,
- 0x495A,0x5150,0x5151,0x5152,0x455F,0xB2F8,0x0000,0x0000,
- 0x5156,0x5154,0x5155,0x5153,0x3A63,0x5157,0x4C6A,0x4E64,
- 0xB2F9,0x0000,0xB2FA,0x0000,0xB2FB,0x5158,0xB2FC,0xB2FD,
- 0x0000,0x0000,0xB2FE,0x0000,0x4028,0x5159,0x3D5A,0x0000,
- 0xB3A1,0x515A,0x0000,0x437C,0x4E3F,0x4560,0x0000,0xB3A2,
- 0x0000,0xB3A3,0xB3A4,0xB3A5,0x0000,0xB3A6,0x5245,0x0000,
- 0xB3A7,0x0000,0x0000,0x515B,0x7425,0x3645,0xB3A8,0x0000,
- 0x515C,0x4B5E,0xB3A9,0x0000,0x0000,0xB3AA,0x3D68,0x427C,
- 0x0000,0x515E,0x4664,0x0000,0x0000,0x515F,0xB3AB,0x0000,
- 0x5160,0x332E,0xB3AC,0xB3AD,0xB3AE,0x5161,0x3627,0xB3AF,
- 0x464C,0x317A,0x3D50,0x0000,0x0000,0x4821,0x5162,0x0000,
-
- /* 5200h */
- 0x4561,0xB3B0,0xB3B1,0x3F4F,0x5163,0xB3B2,0x4A2C,0x405A,
- 0x3422,0x0000,0x3429,0x5164,0x0000,0x0000,0x5166,0x0000,
- 0x0000,0x373A,0xB3B3,0xB3B4,0x5165,0xB3B5,0xB3B6,0x4E73,
- 0xB3B7,0x0000,0x0000,0x0000,0x0000,0x3D69,0x0000,0x0000,
- 0x0000,0x0000,0xB3B8,0x0000,0x483D,0x4A4C,0x0000,0x5167,
- 0xB3B9,0x4D78,0x5168,0x0000,0x0000,0x0000,0x5169,0x0000,
- 0x457E,0xB3BA,0xB3BB,0x516A,0x0000,0xB3BC,0x4029,0x3A7E,
- 0x3774,0x516B,0x3B49,0x396F,0xB3BD,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x4466,0x516D,0xB3BE,0x0000,0x4227,
- 0x0000,0xB3BF,0x3A6F,0x516E,0x516F,0x4130,0x0000,0x516C,
- 0x0000,0x0000,0x0000,0x0000,0x5171,0xB3C0,0x4B36,0xB3C1,
- 0xB3C2,0x0000,0xB3C3,0x3964,0xB3C4,0x0000,0x5170,0xB3C5,
- 0xB3C6,0xB3C7,0x0000,0x3775,0x3A5E,0x476D,0xB3C8,0x0000,
- 0x0000,0x5174,0x5172,0x0000,0x0000,0x0000,0xB3C9,0x497B,
- 0x3E6A,0x517B,0x3364,0x5175,0x5173,0x414F,0x0000,0xB3CA,
- 0xB3CB,0xB3CC,0x0000,0x0000,0x0000,0x5177,0x0000,0x5176,
- 0xB3CD,0x0000,0xB3CE,0x3344,0x0000,0xB3CF,0x0000,0x3760,
- 0x517C,0x4E2D,0xB3D0,0x0000,0xB3D1,0x5178,0x0000,0x0000,
- 0x0000,0x517D,0x517A,0xB3D2,0x5179,0xB3D3,0xB3D4,0xB3D5,
- 0xB3D6,0x0000,0xB3D7,0x4E4F,0xB3D8,0x0000,0x0000,0x3879,
- 0x3243,0x0000,0x0000,0x4E74,0xB3D9,0xB3DA,0xB3DB,0xB3DC,
- 0x0000,0x3D75,0x4558,0x3965,0x5222,0x5223,0x0000,0xB3DD,
- 0xB3DE,0x4E65,0x0000,0x0000,0x4F2B,0x5225,0xB3DF,0xB3E0,
- 0xB3E1,0x387A,0xB3E2,0xB3E3,0x5224,0xB3E4,0x332F,0x0000,
- 0xB3E5,0x5226,0x0000,0x4B56,0xB3E6,0x443C,0xB3E7,0x4D26,
- 0xB3E8,0x4A59,0x0000,0x0000,0xB3E9,0x5227,0x0000,0xB3EA,
- 0x0000,0xB3EB,0x7055,0x0000,0xB3EC,0x4630,0xB3ED,0x5228,
- 0x342A,0x4C33,0x0000,0xB3EE,0xB3EF,0x3E21,0x5229,0x4A67,
- 0x522D,0xB3F0,0x402A,0x522A,0x3650,0xB3F1,0x522B,0x342B,
- 0xB3F2,0xB3F3,0xB3F4,0x0000,0xB3F5,0x0000,0x0000,0x0000,
- 0xB3F6,0xB3F7,0x372E,0x522E,0xB3F8,0x522F,0xB3F9,0xB3FA,
- 0x5230,0x5231,0x3C5B,0x0000,0x0000,0x0000,0x387B,0x4C5E,
-
- /* 5300h */
- 0xB3FB,0x4C68,0x4677,0xB3FC,0x0000,0x4A71,0x5232,0x0000,
- 0x5233,0x0000,0xB3FD,0xB3FE,0xB4A1,0x5235,0x0000,0x5237,
- 0x5236,0xB4A2,0x0000,0xB4A3,0x0000,0x5238,0x323D,0x4B4C,
- 0xB4A4,0x3A7C,0x5239,0xB4A5,0xB4A6,0x4159,0xB4A7,0xB4A8,
- 0x3E22,0x3629,0x0000,0x523A,0x0000,0xB4A9,0x0000,0xB4AA,
- 0xB4AB,0xB4AC,0x485B,0xB4AD,0xB4AE,0xB4AF,0x0000,0x523B,
- 0xB4B0,0x523C,0xB4B1,0x523D,0x0000,0xB4B2,0x0000,0x0000,
- 0x523E,0x4924,0x3668,0x3065,0xB4B3,0xB4B4,0xB4B5,0x463F,
- 0x523F,0x3D3D,0xB4B6,0x4069,0x0000,0x5241,0x5240,0x3E23,
- 0x3861,0x5243,0x483E,0xB4B8,0xB4B7,0x5244,0x0000,0x0000,
- 0x0000,0x485C,0x4234,0x426E,0x3628,0x0000,0x0000,0x466E,
- 0x4331,0xB4B9,0x476E,0xB4BA,0x4B4E,0x0000,0x5246,0x0000,
- 0x406A,0xB4BB,0x0000,0xB4BC,0x0000,0xB4BD,0x3735,0x0000,
- 0x0000,0x5247,0x0000,0x0000,0xB4BE,0xB4BF,0x5248,0x312C,
- 0x3075,0x346D,0xB4C0,0x4228,0x3551,0x4D71,0x0000,0x524B,
- 0x3237,0xB4C1,0x0000,0x524A,0x0000,0x0000,0xB4C2,0x362A,
- 0x0000,0x0000,0x524C,0xB4C3,0x4C71,0x0000,0x0000,0xB4C4,
- 0xB4C5,0x0000,0x0000,0x0000,0x0000,0x0000,0xB4C6,0x0000,
- 0x0000,0x0000,0x0000,0xB4C7,0xB4C8,0x0000,0x524D,0x0000,
- 0x4E52,0xB4C9,0x387C,0x0000,0x0000,0xB4CA,0x0000,0x3836,
- 0x524E,0xB4CB,0x0000,0x0000,0xB4CC,0x5250,0x524F,0x0000,
- 0x3F5F,0x3139,0xB4CD,0xB4CE,0x0000,0x315E,0x5251,0xB4CF,
- 0x5252,0x0000,0xB4D0,0x3837,0xB4D1,0xB4D2,0x5253,0xB4D3,
- 0xB4D4,0x0000,0xB4D5,0x356E,0x0000,0xB4D6,0x0000,0x0000,
- 0xB4D7,0x0000,0x3B32,0x5254,0x0000,0xB4D8,0x0000,0x0000,
- 0x4B74,0x3A35,0x355A,0x4D27,0x4150,0x483F,0x3C7D,0xB4D9,
- 0x0000,0x0000,0xB4DA,0xB4DB,0x3D47,0xB4DC,0x3C68,0x3C75,
- 0x0000,0x3D76,0xB4DD,0x4840,0x0000,0xB4DE,0xB4DF,0x5257,
- 0xB4E0,0x3143,0x4151,0x387D,0x3845,0x3667,0xB4E1,0xB4E2,
- 0x525B,0x4321,0x427E,0x362B,0x3E24,0x525C,0x525A,0x3244,
- 0x4266,0x3C38,0x3B4B,0x3126,0x0000,0xB4E3,0x3370,0x3966,
- 0x3B4A,0x0000,0x525D,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 5400h */
- 0x0000,0x525E,0xB4E4,0x3549,0x3346,0x0000,0x0000,0x0000,
- 0x3967,0x3548,0x445F,0x3125,0x4631,0x4C3E,0x3921,0x4D79,
- 0x4547,0x387E,0x0000,0xB4E5,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xB4E6,0x372F,0x0000,0x5267,0x0000,0x3663,
- 0x4B4A,0xB4E7,0x0000,0x0000,0x0000,0x0000,0x485D,0xB4E8,
- 0xB4E9,0x5266,0xB4EA,0x345E,0x5261,0x5262,0x5264,0xB4EB,
- 0x0000,0xB4EC,0x0000,0x0000,0xB4ED,0xB4EE,0x5265,0x0000,
- 0x355B,0x3F61,0x0000,0x4A2D,0x5263,0x525F,0x3863,0x0000,
- 0x5260,0x0000,0x4F24,0xB4EF,0xB4F0,0x0000,0x4A72,0xB4F1,
- 0x4468,0x3862,0x3970,0x0000,0x0000,0xB4F2,0x5268,0xB4F3,
- 0x0000,0x465D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xB4F4,0x526C,
- 0x0000,0x0000,0xB4F5,0x0000,0xB4F6,0x0000,0xB4F7,0xB4F8,
- 0x3C7E,0xB4F9,0x3C76,0xB4FA,0x0000,0xB4FB,0xB4FC,0x0000,
- 0x526F,0x526D,0x0000,0x4C23,0xB4FD,0x526A,0x5273,0x526E,
- 0x0000,0x0000,0x0000,0x5271,0x3846,0x4C3F,0x0000,0xB4FE,
- 0x5272,0xB5A1,0x0000,0xB5A2,0x5274,0xB5A3,0x5276,0x0000,
- 0xB5A4,0xB5A5,0x0000,0x3A70,0x4F42,0xB5A6,0x526B,0x5269,
- 0x5275,0xB5A7,0x5270,0x0000,0x0000,0xB5A8,0xB5A9,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0xB5AA,0x0000,0x0000,0xB5AB,
- 0x0000,0xB5AC,0x5278,0x0000,0x5323,0x527A,0xB5AD,0xB5AE,
- 0x527E,0xB5AF,0xB5B0,0x5321,0x527B,0xB5B1,0xB5B2,0x533E,
- 0x0000,0xB5B3,0x3A69,0x3331,0x0000,0x0000,0x0000,0xB5B4,
- 0x5279,0xB5B5,0xB5B6,0xB5B7,0x5325,0x3076,0x5324,0xB5B8,
- 0x3025,0x494A,0x5322,0x0000,0x527C,0x0000,0xB5B9,0x5277,
- 0x527D,0x3A48,0xB5BA,0x0000,0x0000,0xB5BB,0xB5BC,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x5326,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xB5BD,0x3077,0x532F,0x0000,0x0000,0x5327,0x5328,0x0000,
- 0x3E25,0x4B69,0xB5BE,0x0000,0xB5BF,0x532D,0x532C,0xB5C0,
- 0x0000,0x0000,0x452F,0x0000,0x0000,0x0000,0xB5C1,0x0000,
- 0x0000,0x0000,0x532E,0x0000,0xB5C2,0x532B,0xB5C3,0xB5C4,
-
- /* 5500h */
- 0xB5C5,0xB5C6,0x0000,0x0000,0x3134,0xB5C7,0x3A36,0x3F30,
- 0xB5C8,0xB5C9,0x0000,0x0000,0xB5CA,0xB5CB,0xB5CC,0x5329,
- 0x4562,0x0000,0x0000,0x0000,0x532A,0xB5CD,0x3022,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xB5CE,0xB5CF,0x0000,0x0000,0x5334,0x4D23,
- 0x0000,0x3E27,0xB5D0,0x533A,0x0000,0xB5D1,0xB5D2,0x0000,
- 0x5339,0x5330,0x0000,0xB5D3,0xB5D4,0xB5D5,0x4243,0x0000,
- 0x5331,0xB5D6,0x0000,0x0000,0x426F,0x5336,0x3E26,0xB5D7,
- 0x0000,0xB5D8,0xB5D9,0x0000,0x5333,0xB5DA,0x0000,0x4C64,
- 0xB5DB,0xB5DC,0x0000,0x373C,0x0000,0x0000,0x5337,0x5338,
- 0xB5DD,0x0000,0xB5DE,0xB5DF,0x5335,0x533B,0xB5E0,0x0000,
- 0xB5E1,0xB5E2,0x0000,0x5332,0xB5E3,0x0000,0xB5E4,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x5341,0x5346,0x0000,0x5342,0xB5E5,
- 0x533D,0xB5E6,0xB5E7,0x5347,0x4131,0x0000,0xB5E8,0x5349,
- 0xB5E9,0x3922,0x533F,0x437D,0x0000,0x0000,0xB5EA,0xB5EB,
- 0x0000,0xB5EC,0xB5ED,0xB5EE,0xB5EF,0x0000,0x0000,0xB5F0,
- 0x5343,0x533C,0x342D,0x0000,0x346E,0x3365,0x5344,0x5340,
- 0x0000,0x0000,0x0000,0xB5F1,0xB5F2,0x0000,0x0000,0x3776,
- 0x534A,0x5348,0x4153,0x354A,0x362C,0xB5F3,0x5345,0x0000,
- 0x3674,0x0000,0xB5F4,0x0000,0x0000,0x0000,0x3144,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xB5F5,
- 0x0000,0xB5F6,0x0000,0xB5F7,0x534E,0x534C,0xB5F8,0x5427,
- 0x0000,0xB5F9,0x0000,0xB5FA,0xB5FB,0x0000,0xB5FC,0x0000,
- 0x0000,0xB5FD,0xB5FE,0xB6A1,0x5351,0x0000,0x0000,0xB6A2,
- 0xB6A3,0x0000,0x534B,0xB6A4,0x534F,0x0000,0xB6A5,0x534D,
- 0x0000,0x0000,0xB6A6,0x3B4C,0x5350,0x0000,0x0000,0x0000,
- 0x0000,0xB6A7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xB6A8,0x5353,
- 0x0000,0x5358,0x0000,0x0000,0x0000,0x5356,0x5355,0xB6A9,
-
- /* 5600h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xB6AA,0x4332,0x0000,
- 0xB6AB,0x3245,0xB6AC,0x0000,0x0000,0xB6AD,0xB6AE,0xB6AF,
- 0xB6B0,0xB6B1,0xB6B2,0x0000,0x5352,0x0000,0x5354,0x3E28,
- 0x3133,0xB6B3,0x0000,0x5357,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x325E,0x0000,0x0000,0xB6B4,0x0000,0x0000,0x5362,
- 0xB6B5,0x3E7C,0x535E,0xB6B6,0x535C,0xB6B7,0x535D,0xB6B8,
- 0x535F,0xB6B9,0x0000,0xB6BA,0xB6BB,0xB6BC,0x0000,0xB6BD,
- 0xB6BE,0xB6BF,0x313D,0xB6C0,0xB6C1,0x0000,0xB6C2,0x0000,
- 0x0000,0xB6C3,0x0000,0xB6C4,0x4139,0xB6C5,0x5359,0xB6C6,
- 0x535A,0x0000,0x0000,0x0000,0xB6C7,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x337A,0x0000,0x0000,0xB6C8,0x0000,
- 0xB6C9,0xB6CA,0xB6CB,0xB6CC,0x5361,0x0000,0xB6CD,0x0000,
- 0x346F,0xB6CE,0x5364,0x5360,0x5363,0xB6CF,0x0000,0xB6D0,
- 0x0000,0xB6D1,0xB6D2,0x0000,0x4A2E,0xB6D3,0x0000,0x0000,
- 0x4655,0x0000,0x4838,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x5366,0x0000,0x0000,0x0000,0xB6D4,0xB6D5,0x5365,0x3345,
- 0xB6D6,0x0000,0x5367,0xB6D7,0xB6D8,0x0000,0x0000,0x536A,
- 0x0000,0x0000,0x0000,0x0000,0x5369,0xB6D9,0x0000,0x0000,
- 0x0000,0xB6DA,0xB6DB,0x0000,0x0000,0xB6DC,0xB6DD,0xB6DE,
- 0x5368,0x0000,0x4739,0x0000,0x0000,0x536B,0xB6DF,0xB6E0,
- 0xB6E1,0xB6E2,0x0000,0xB6E3,0xB6E4,0xB6E5,0x536C,0x0000,
- 0x0000,0xB6E6,0x0000,0xB6E7,0x536E,0x0000,0x536D,0xB6E8,
- 0x0000,0x0000,0x0000,0x0000,0x5370,0x0000,0xB6E9,0x0000,
- 0x5373,0x5371,0x536F,0x5372,0x0000,0xB6EA,0x0000,0x0000,
- 0x5374,0xB6EB,0xB6EC,0xB6ED,0xB6F0,0xB6F1,0x5375,0xB6EE,
- 0xB6EF,0x5376,0x0000,0x5377,0x0000,0x0000,0x0000,0x5378,
- 0x5145,0xB6F2,0x3C7C,0x3B4D,0xB6F3,0xB6F4,0x3273,0xB6F5,
- 0x3078,0xB6F6,0x0000,0x4344,0xB6F7,0xB6F8,0xB6F9,0xB6FA,
- 0xB6FB,0x0000,0x0000,0xB6FD,0x0000,0xB6FE,0x5379,0x0000,
- 0x3A24,0xB6FC,0x304F,0x3F5E,0x0000,0x0000,0xB7A1,0xB7A2,
- 0x0000,0x537A,0x3847,0x0000,0x0000,0x3971,0x0000,0x537C,
-
- /* 5700h */
- 0x537B,0xB7A3,0xB7A4,0x4A60,0x537D,0x0000,0x0000,0xB7A5,
- 0x5421,0x537E,0xB7A6,0x5422,0xB7A7,0x5423,0x0000,0x3777,
- 0x0000,0xB7A8,0x3160,0x5424,0x0000,0xB7A9,0x5426,0x0000,
- 0x5425,0x0000,0xB7AA,0xB7AB,0x5428,0xB7AC,0x0000,0x455A,
- 0xB7AD,0x0000,0xB7AE,0xB7AF,0xB7B0,0xB7B1,0x5429,0x3035,
- 0x3A5F,0xB7B2,0xB7B3,0x0000,0xB7B4,0x373D,0xB7B5,0xB7B6,
- 0x434F,0x0000,0x0000,0xB7B7,0xB7B8,0x0000,0x0000,0x542A,
- 0x542B,0x0000,0x0000,0x542D,0x0000,0xB7B9,0xB7BA,0xB7BB,
- 0x542E,0x0000,0x3A64,0x0000,0x0000,0xB7BC,0xB7BD,0x3651,
- 0x0000,0x0000,0x4B37,0x0000,0xB7BE,0xB7BF,0x542C,0x542F,
- 0x3A41,0x3923,0xB7C0,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x5433,0xB7C1,0x0000,0x3A25,0xB7C2,0x4333,0xB7C3,
- 0xB7C4,0x5430,0x445A,0xB7C5,0x0000,0xB7C6,0xB7C7,0xB7C8,
- 0xB7C9,0xB7CA,0x0000,0xB7CB,0xB7CC,0xB7CD,0x0000,0xB7CE,
- 0x0000,0xB7CF,0xB7D0,0xB7D1,0xB7D2,0x0000,0xB7D3,0x5434,
- 0x0000,0xB7D4,0x3F62,0xB7D5,0x0000,0x0000,0x0000,0x0000,
- 0x5432,0x5435,0x0000,0x373F,0xB7D6,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x5436,0xB7D7,0xB7E0,0x0000,0xB7D8,
- 0x0000,0xB7D9,0xB7DA,0x0000,0xB7DB,0xB7DC,0xB7DD,0xB7DE,
- 0x5437,0xB7DF,0x3924,0x3340,0x5439,0x0000,0x0000,0xB7E1,
- 0xB7E2,0xB7E3,0x543A,0x0000,0xB7E4,0x0000,0x0000,0x0000,
- 0x543B,0x0000,0x0000,0x5438,0x0000,0x0000,0x0000,0x0000,
- 0xB7E5,0x0000,0x0000,0x0000,0x0000,0xB7E6,0x0000,0x0000,
- 0x5431,0x0000,0x0000,0x543C,0x0000,0x0000,0x543D,0xB7E7,
- 0xB7E8,0x0000,0x0000,0x4B64,0xB7E9,0x0000,0x3E6B,0xB7EA,
- 0x0000,0x0000,0x543F,0x5440,0x543E,0xB7EB,0x5442,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x4738,0xB7EC,0xB7ED,0x3068,
- 0x4956,0xB7FE,0x0000,0x5443,0xB7EE,0x0000,0xB7EF,0xB7F0,
- 0x0000,0xB7F1,0x0000,0x0000,0x0000,0xB7F2,0x0000,0x0000,
- 0xB7F3,0x0000,0x0000,0x0000,0x3E7D,0xB7F4,0xB7F5,0x3C39,
- 0xB7F6,0x475D,0x3470,0x0000,0x3A6B,0xB7F7,0xB7F8,0xB7F9,
-
- /* 5800h */
- 0x4B59,0x0000,0x4632,0xB7FA,0xB7FB,0x3778,0x424F,0x0000,
- 0xB7FC,0xB7FD,0x5441,0x5444,0xB8A1,0xB8A2,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x4244,0x0000,0x0000,
- 0x0000,0x5445,0x0000,0xB8A3,0x0000,0x5446,0xB8A4,0xB8A5,
- 0xB8A6,0x5448,0x0000,0x0000,0x4469,0x0000,0xB8A7,0xB8A8,
- 0x0000,0x0000,0x342E,0x0000,0x0000,0xB8A9,0x0000,0x7421,
- 0x3161,0x4A73,0xB8AA,0x0000,0x3E6C,0x4548,0x0000,0x0000,
- 0x0000,0xB8AB,0x3A66,0x0000,0x0000,0x544E,0x0000,0xB8AC,
- 0x4A3D,0x4E5D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xB8AD,0x3274,0x544A,0xB8AE,0xB8AF,0x0000,0xB8B0,
- 0xB8B1,0x413A,0x544D,0x0000,0x4563,0xB8B2,0x0000,0x4549,
- 0x4564,0x4839,0x444D,0x0000,0x0000,0x0000,0x3A49,0xB8B3,
- 0x0000,0xB8B4,0x5449,0x0000,0xB8B5,0x0000,0x0000,0xB8B6,
- 0xB8B7,0x3176,0x0000,0x4536,0x0000,0x0000,0x0000,0x0000,
- 0x544B,0x0000,0x5447,0x0000,0x0000,0x3F50,0x0000,0x0000,
- 0xB8B8,0x544F,0x0000,0x0000,0xB8B9,0x0000,0x3D4E,0xB8BA,
- 0xB8BB,0xB8BC,0x0000,0x362D,0x0000,0x5450,0x0000,0xB8BD,
- 0xB8BE,0xB8BF,0xB8C0,0x0000,0xB8C1,0xB8C2,0x0000,0xB8C3,
- 0xB8C4,0x0000,0x0000,0x4A68,0xB8C5,0x0000,0xB8C6,0x417D,
- 0x0000,0x0000,0x0000,0x0000,0x4446,0xB8C7,0x0000,0x5452,
- 0xB8C8,0xB8C9,0xB8CA,0x0000,0x0000,0x0000,0xB8CB,0x0000,
- 0x4B4F,0xB8CC,0x0000,0x5453,0x0000,0x0000,0x5458,0x0000,
- 0x0000,0xB8CD,0xB8CE,0x4A2F,0x0000,0x0000,0x0000,0x0000,
- 0x5457,0x5451,0x5454,0x5456,0xB8D0,0x0000,0x3A26,0x0000,
- 0x0000,0x4A49,0xB8D1,0x0000,0xB8CF,0x5459,0x0000,0x4345,
- 0xB8D2,0x0000,0x3275,0x0000,0x3E6D,0xB8D3,0xB8D4,0x0000,
- 0xB8D5,0x545B,0xB8D6,0x545A,0xB8D7,0x3968,0xB8D8,0x545C,
- 0x545E,0x545D,0xB8D9,0x0000,0x5460,0xB8DA,0x5455,0x5462,
- 0x0000,0xB8DB,0xB8DC,0x0000,0x5461,0x545F,0x0000,0x0000,
- 0x0000,0xB8DD,0x0000,0x3B4E,0x3F51,0x0000,0x4154,0x5463,
- 0x403C,0x306D,0x4764,0xB8DE,0x0000,0x0000,0x0000,0x445B,
- 0x0000,0x5465,0x5464,0x5466,0x5467,0x5468,0x0000,0x0000,
-
- /* 5900h */
- 0x0000,0x0000,0x5469,0x0000,0x0000,0xB8DF,0xB8E0,0x0000,
- 0x0000,0x4A51,0x546A,0xB8E1,0xB8E2,0x0000,0x0000,0x3246,
- 0x546B,0x0000,0xB8E3,0xB8E4,0xB8E5,0x4D3C,0x3330,0x0000,
- 0x5249,0x3D48,0x423F,0x546C,0x4C6B,0xB8E7,0x0000,0x0000,
- 0x0000,0xB8E8,0x4C34,0xB8E9,0xB8EA,0x546E,0x0000,0x4267,
- 0xB8EB,0x4537,0x4240,0x4957,0x546F,0x5470,0x317B,0xB8EC,
- 0xB8ED,0x3C3A,0x5471,0xB8EE,0x0000,0xB8EF,0xB8F0,0x3050,
- 0x5472,0x0000,0x0000,0x0000,0x0000,0x0000,0x5473,0xB8F1,
- 0x0000,0x0000,0x0000,0xB8F2,0x3162,0x0000,0xB8F3,0x3471,
- 0x4660,0x4A74,0x0000,0x0000,0x0000,0x0000,0x5477,0x4155,
- 0x5476,0x3740,0xB8F4,0xB8F5,0x4B5B,0x5475,0x0000,0x4565,
- 0x5479,0xB8F6,0x5478,0xB8F7,0x0000,0xB8F8,0xB8F9,0xB8FA,
- 0x547B,0xB8FB,0x547A,0xB8FC,0x0000,0x317C,0x0000,0x547C,
- 0x3E29,0x547E,0x4325,0xB8FD,0x547D,0xB8FE,0x4A33,0xB9A1,
- 0x0000,0x0000,0xB9A2,0x3D77,0x455B,0xB9A3,0xB9A4,0x0000,
- 0x5521,0xB9A5,0x0000,0xB9A6,0xB9A7,0x3925,0x0000,0x0000,
- 0x0000,0x5522,0x4721,0x485E,0x4C51,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x4725,0xB9A8,0xB9A9,0x552B,0xB9AA,0x0000,
- 0x0000,0x0000,0xB9AB,0x3538,0x0000,0xB9AC,0x4D45,0xB9AD,
- 0x0000,0x4C2F,0x0000,0x562C,0x0000,0x5523,0x0000,0xB9AE,
- 0x0000,0x0000,0x0000,0x5526,0xB9AF,0x4245,0x0000,0xB9B0,
- 0x4B38,0x0000,0x0000,0x0000,0x454A,0xB9B1,0xB9B2,0xB9B3,
- 0xB9B4,0x0000,0x5527,0xB9B5,0x0000,0x0000,0x0000,0xB9B6,
- 0x0000,0x4B65,0xB9B7,0x3A4A,0xB9B8,0x0000,0x3E2A,0x0000,
- 0x0000,0xB9B9,0x0000,0xB9BA,0xB9BB,0x0000,0x5528,0x0000,
- 0xB9BC,0x3B50,0xB9BD,0x3B4F,0x0000,0xB9BE,0x0000,0x0000,
- 0x3039,0x3848,0xB9BF,0x402B,0x3051,0x0000,0x0000,0x0000,
- 0x0000,0x552C,0x552D,0x0000,0x552A,0xB9C0,0xB9C1,0xB9C2,
- 0x0000,0x0000,0x0000,0xB9C3,0xB9C4,0x3138,0x342F,0xB9C5,
- 0x5529,0x0000,0x4C45,0x4931,0x0000,0x0000,0xB9C6,0xB9C7,
- 0x0000,0xB9C8,0xB9C9,0x0000,0xB9CA,0x0000,0x3028,0xB9CB,
- 0x0000,0x0000,0x0000,0x3079,0x0000,0x0000,0x0000,0x3B51,
-
- /* 5A00h */
- 0xB9CC,0x3052,0x0000,0x3023,0xB9CD,0x0000,0x0000,0x0000,
- 0x0000,0x5532,0x0000,0x0000,0xB9CE,0xB9CF,0xB9D0,0x0000,
- 0x0000,0x5530,0xB9D1,0xB9D2,0x0000,0x0000,0x0000,0x0000,
- 0x4C3C,0x0000,0x5533,0x0000,0x5531,0x0000,0xB9D3,0x552F,
- 0x3F31,0x0000,0x0000,0xB9D4,0xB9D5,0x552E,0x0000,0xB9D6,
- 0xB9D7,0x4A5A,0xB9D8,0x0000,0x0000,0xB9D9,0x0000,0x3864,
- 0xB9DA,0x0000,0x0000,0x0000,0x0000,0x5537,0x5538,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x3E2B,0x0000,0x0000,0x0000,
- 0x5534,0x4F2C,0x0000,0x0000,0xB9DB,0xB9DC,0x474C,0xB9DD,
- 0xB9DE,0x5536,0x0000,0x0000,0xB9DF,0x0000,0x0000,0x0000,
- 0xB9E0,0x0000,0x0000,0x0000,0x0000,0xB9E1,0x0000,0x0000,
- 0x0000,0x0000,0x3A27,0x0000,0x0000,0x0000,0xB9E2,0x0000,
- 0x0000,0x0000,0x5539,0xB9E3,0x0000,0xB9E4,0x4958,0xB9E5,
- 0x0000,0x0000,0x553A,0x0000,0x5535,0xB9E6,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xB9E7,
- 0x0000,0x0000,0xB9E8,0xB9E9,0x0000,0x0000,0xB9EA,0x4C3B,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xB9EB,0x0000,0x0000,0x0000,0x0000,
- 0xB9EC,0x0000,0x475E,0xB9ED,0x0000,0x0000,0xB9EE,0x0000,
- 0x0000,0xB9EF,0x553B,0x4932,0xB9F0,0x0000,0xB9F1,0xB9F2,
- 0xB9F3,0x0000,0xB9F4,0x0000,0x0000,0x0000,0x0000,0xB9F5,
- 0x0000,0x0000,0x0000,0x0000,0xB9F6,0x0000,0x0000,0x0000,
- 0x0000,0xB9F7,0xB9F8,0xB9F9,0x0000,0xB9FA,0x0000,0x0000,
- 0xB9FB,0x0000,0xB9FC,0xB9FD,0x553C,0x5540,0x553D,0xB9FE,
- 0x0000,0x3247,0x553F,0x0000,0xBAA1,0x0000,0xBAA2,0x0000,
- 0xBAA3,0x3C3B,0x0000,0x553E,0x3779,0x0000,0x0000,0xBAA4,
- 0x554C,0x0000,0x0000,0x0000,0x0000,0x0000,0x5545,0x5542,
- 0x0000,0x0000,0xBAA5,0x0000,0xBAA6,0x0000,0x0000,0x0000,
- 0xBAA7,0x4364,0x0000,0x5541,0x0000,0xBAA8,0x5543,0x0000,
- 0x0000,0x5544,0xBAA9,0x0000,0x0000,0x0000,0xBAAA,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xBAAB,0xBAAC,0x0000,
- 0x0000,0x0000,0x5546,0x5547,0x0000,0xBAAD,0x0000,0x0000,
-
- /* 5B00h */
- 0xBAAE,0xBAAF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xBAB0,0x3472,0x0000,0x5549,0x5548,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x554A,0xBAB1,
- 0x0000,0xBAB3,0x0000,0xBAB4,0x0000,0xBAB5,0x0000,0x0000,
- 0x0000,0xBAB6,0x3E6E,0x0000,0x0000,0xBAB7,0x0000,0x0000,
- 0x0000,0x0000,0x554D,0x0000,0x445C,0xBAB8,0x0000,0x0000,
- 0x3145,0x0000,0x554B,0x0000,0xBAB2,0x0000,0x554E,0x0000,
- 0xBAB9,0x0000,0x0000,0x0000,0x0000,0x0000,0x554F,0x0000,
- 0x5552,0xBABA,0x0000,0x5550,0x0000,0x5551,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xBABB,0xBABC,0x0000,0x0000,0x0000,
- 0x3B52,0x5553,0xBABD,0x0000,0x3926,0x5554,0xBABE,0x3B7A,
- 0x4238,0x0000,0x5555,0x5556,0x3B5A,0x3927,0xBABF,0x4C52,
- 0x0000,0x0000,0x0000,0x3528,0x3849,0x5557,0x3358,0x0000,
- 0xBAC0,0x5558,0x0000,0x4239,0x0000,0x0000,0xBAC1,0xBAC2,
- 0x5559,0x5623,0x0000,0x555A,0x0000,0x555B,0x0000,0x0000,
- 0x555C,0x0000,0x555E,0x0000,0xBAC3,0xBAC4,0xBAC5,0xBAC6,
- 0x555F,0xBAC7,0x0000,0x5560,0xBAC8,0x4270,0xBAC9,0x3127,
- 0x3C69,0x3042,0xBACA,0x4157,0x3430,0x3C35,0xBACB,0x3928,
- 0xBACC,0xBACD,0x0000,0xBACE,0xBACF,0x4566,0xBAD0,0x3D21,
- 0x3431,0x4368,0x446A,0x3038,0x3539,0x4A75,0x0000,0x3C42,
- 0x0000,0x0000,0x3552,0x406B,0x3C3C,0x4D28,0x5561,0x0000,
- 0xBAD1,0xBAD2,0x0000,0x0000,0xBAD3,0xBAD4,0x355C,0xBAD5,
- 0x3A4B,0xBAD6,0xBAD7,0x3332,0x3163,0x3E2C,0x3248,0xBAD8,
- 0x5562,0x4D46,0xBAD9,0x0000,0xBADA,0x0000,0x0000,0x3D49,
- 0xBADB,0xBADC,0x3C64,0x5563,0x3473,0x4652,0x4C29,0x5564,
- 0x0000,0x5565,0x0000,0x0000,0x4959,0xBADD,0x0000,0xBADE,
- 0x5567,0x0000,0x3428,0x3677,0x5566,0x0000,0xBADF,0xBAE0,
- 0xBAE1,0xBAE2,0xBAE3,0x3432,0x0000,0x3F32,0x556B,0x3B21,
- 0xBAE4,0x3249,0x556A,0x0000,0x5568,0x556C,0x5569,0x472B,
- 0x5C4D,0x3F33,0x0000,0x556D,0x0000,0x0000,0x4E40,0xBAE5,
- 0x556E,0xBAE6,0x0000,0x5570,0xBAE7,0x437E,0x556F,0x0000,
- 0x4023,0x0000,0x3B7B,0x0000,0x0000,0xBAE8,0x4250,0x3C77,
-
- /* 5C00h */
- 0x0000,0x4975,0x406C,0x0000,0x3C4D,0x5571,0x3E2D,0x5572,
- 0x5573,0x3053,0x423A,0x3F52,0xBAE9,0x5574,0x4633,0x3E2E,
- 0x0000,0x3E2F,0x0000,0x5575,0x0000,0x0000,0x406D,0xBAEA,
- 0x0000,0x0000,0x3E30,0x0000,0x0000,0x0000,0xBAEB,0xBAEC,
- 0x5576,0x0000,0x5577,0xBAED,0x4C60,0x0000,0xBAEE,0x0000,
- 0x5578,0xBAEF,0x0000,0xBAF0,0xBAF1,0x3646,0xBAF2,0x0000,
- 0xBAF3,0x3D22,0xBAF4,0x0000,0x0000,0xBAF5,0xBAF6,0x0000,
- 0x5579,0x557A,0x3C5C,0x3F2C,0x4674,0x3F54,0x4878,0x4722,
- 0x3649,0x557B,0x0000,0x0000,0x0000,0x356F,0x557C,0x0000,
- 0x367E,0x0000,0x464F,0x3230,0x0000,0x3B53,0x557D,0x5622,
- 0x5621,0x367D,0x0000,0x557E,0x0000,0x4538,0x0000,0x0000,
- 0x0000,0xBAF7,0xBAF8,0x0000,0xBAF9,0x0000,0x4230,0x0000,
- 0x454B,0x3C48,0xBAFA,0xBAFB,0x4158,0x4D7A,0x0000,0xBAFC,
- 0xBAFD,0xBAFE,0x0000,0x0000,0x5624,0xBBA1,0x5625,0x4656,
- 0xBBA2,0x3B33,0x0000,0x0000,0xBBA3,0xBBA4,0x5627,0x0000,
- 0x0000,0x5628,0xBBA5,0xBBA6,0xBBA7,0xBBA8,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xBBA9,
- 0xBBAA,0x0000,0xBBAB,0x0000,0x5629,0x0000,0x0000,0xBBAC,
- 0x3474,0x562A,0xBBAD,0x0000,0x562B,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xBBAE,0x0000,0xBBAF,
- 0xBBB0,0x322C,0xBBB1,0xBBB2,0x0000,0x0000,0xBBB3,0x0000,
- 0x413B,0x3464,0xBBB4,0x562D,0x4C28,0x0000,0x0000,0x0000,
- 0x0000,0x4252,0xBBB5,0x3359,0xBBB6,0xBBB7,0x562F,0x5631,
- 0x345F,0x0000,0xBBB8,0x562E,0x5630,0x0000,0x5633,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x5632,0x0000,0x5634,
- 0x0000,0xBBB9,0x0000,0xBBBA,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xBBBB,0x0000,0x0000,0x0000,0x0000,0xBBBD,
- 0x0000,0x5635,0x0000,0x0000,0x0000,0xBBBC,0x0000,0x0000,
- 0x463D,0x362E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x3265,0x5636,0x563B,0x0000,0x0000,0x5639,0xBBBE,0x4A77,
- 0x4A76,0xBBBF,0xBBC0,0x0000,0xBBC1,0x0000,0x4567,0x0000,
- 0x0000,0x0000,0x5638,0x3D54,0x0000,0x5637,0x0000,0x0000,
-
- /* 5D00h */
- 0x0000,0xBBC2,0x0000,0x0000,0x0000,0x0000,0xBBC3,0x3F72,
- 0x0000,0x0000,0x0000,0x563C,0x0000,0xBBC4,0x3A6A,0x0000,
- 0x0000,0x5642,0xBBC5,0x0000,0x5643,0x563D,0x3333,0x563E,
- 0x5647,0x5646,0x5645,0x5641,0x0000,0x0000,0x0000,0x5640,
- 0x0000,0x0000,0x5644,0xBBC7,0xBBC8,0x0000,0xBBC9,0xBBCA,
- 0x0000,0x4A78,0x0000,0xBBC6,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xBBCB,0x0000,0x0000,0xBBCC,0x0000,0x0000,0x0000,
- 0x0000,0xBBCD,0x0000,0x0000,0x0000,0xBBCE,0x0000,0xBBCF,
- 0x0000,0x0000,0xBBD0,0xBBD1,0x0000,0x0000,0xBBD2,0x0000,
- 0xBBD3,0x0000,0xBBD7,0x564B,0x5648,0x0000,0x564A,0x0000,
- 0x4D72,0xBBD5,0x5649,0x0000,0x0000,0xBBD4,0x0000,0x0000,
- 0x0000,0xBBD6,0x0000,0x0000,0x563F,0x0000,0x0000,0xBBD8,
- 0xBBD9,0xBBDA,0xBBDB,0x0000,0xBBDC,0x0000,0x0000,0x0000,
- 0x0000,0x3F73,0xBBDD,0x0000,0x564C,0xBBDE,0x0000,0x3A37,
- 0xBBDF,0x0000,0x0000,0x564D,0x0000,0x0000,0x564E,0x0000,
- 0x0000,0xBBE0,0xBBE1,0x0000,0x0000,0x0000,0xBBE2,0xBBE3,
- 0x0000,0xBBE4,0x5651,0xBBE5,0x5650,0x0000,0x0000,0x564F,
- 0xBBE6,0x0000,0xBBE7,0x4568,0x563A,0x0000,0x0000,0x0000,
- 0x5657,0x0000,0xBBE8,0xBBE9,0xBBEA,0xBBEB,0x0000,0x0000,
- 0x0000,0xBBEC,0x0000,0xBBED,0x0000,0x5653,0x0000,0xBBEE,
- 0xBBEF,0x0000,0x5652,0x0000,0x0000,0x0000,0x0000,0xBBF0,
- 0x0000,0x0000,0x0000,0xBBF1,0x5654,0x0000,0x5655,0x0000,
- 0xBBF2,0x0000,0xE6F4,0x0000,0xBBF3,0x0000,0x0000,0x5658,
- 0xBBF4,0xBBF5,0x4E66,0x0000,0x5659,0x5656,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xBBF6,0x0000,0x0000,0x0000,0xBBF7,
- 0x0000,0x565A,0x0000,0xBBF8,0x3460,0x565B,0xBBFA,0x0000,
- 0xBBF9,0x0000,0x565D,0x565C,0x0000,0x0000,0x565E,0x0000,
- 0xBBFB,0xBBFC,0x0000,0x565F,0x0000,0x406E,0x3D23,0x0000,
- 0xBBFD,0x3D64,0x0000,0x4163,0xBBFE,0x3929,0x3A38,0x392A,
- 0x3570,0xBCA1,0x0000,0x5660,0x0000,0x0000,0x3A39,0x0000,
- 0x0000,0x384A,0x5661,0x4C26,0x4743,0x5662,0x0000,0x392B,
- 0xBCA2,0xBCA3,0x0000,0x342C,0x0000,0x4327,0x3652,0x0000,
-
- /* 5E00h */
- 0xBCA4,0x0000,0x3B54,0x495B,0x0000,0x0000,0x4841,0xBCA5,
- 0x0000,0x0000,0x0000,0x5663,0x3475,0xBCA6,0x0000,0x0000,
- 0x0000,0x5666,0xBCA7,0x0000,0xBCA8,0xBCA9,0x4421,0x0000,
- 0xBCAA,0x5665,0x5664,0x5667,0x0000,0x446B,0x0000,0xBCAB,
- 0xBCAC,0x0000,0x0000,0x0000,0x0000,0x3F63,0x0000,0x0000,
- 0xBCAE,0x0000,0x0000,0x3B55,0x0000,0x404A,0xBCAD,0x4253,
- 0x3522,0x0000,0xBCAF,0x4422,0x0000,0xBCB0,0x5668,0x5669,
- 0x3E6F,0x0000,0x0000,0x0000,0x0000,0x4B39,0xBCB1,0x0000,
- 0x566C,0x0000,0x0000,0x566B,0x566A,0x497D,0x0000,0x5673,
- 0x0000,0xBCB4,0x0000,0xBCB2,0x4B5A,0x0000,0x566D,0x0000,
- 0xBCB3,0xBCB5,0x0000,0x0000,0x566F,0x4B6B,0xBCB6,0x566E,
- 0xBCB7,0x0000,0x0000,0xBCB8,0xBCB9,0x0000,0xBCBA,0x5670,
- 0x0000,0x4828,0x5671,0x4A3E,0x5672,0x0000,0x0000,0x0000,
- 0xBCBB,0x0000,0xBCBC,0xBCBD,0xBCBE,0xBCBF,0xBCC0,0x0000,
- 0xBCC1,0x0000,0x3433,0x4A3F,0x472F,0x5674,0x5675,0x0000,
- 0x392C,0x3434,0x5676,0x3838,0x4D44,0x4D29,0x3476,0x5678,
- 0xBCC2,0x4423,0x0000,0x392D,0x3E31,0x0000,0x0000,0x485F,
- 0x0000,0x0000,0x3E32,0xBCC3,0x0000,0x0000,0xBCC4,0x3D78,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x446C,0x4A79,0x4539,
- 0x0000,0x0000,0x392E,0x0000,0x495C,0x0000,0x0000,0x0000,
- 0x5679,0x0000,0xBCC5,0x0000,0xBCC6,0xBCC7,0x4559,0x3A42,
- 0xBCC8,0x0000,0xBCC9,0x384B,0xBCCA,0x446D,0x0000,0x0000,
- 0x0000,0xBCCB,0x0000,0xBCCC,0x0000,0x3043,0x3D6E,0x392F,
- 0x4D47,0x0000,0x0000,0x0000,0x0000,0xBCCD,0xBCCE,0xBCCF,
- 0x0000,0x567A,0x567B,0x4751,0x0000,0x0000,0xBCD0,0x0000,
- 0x567C,0x4E77,0x4F2D,0xBCD2,0xBCD1,0x0000,0xBCD3,0x567E,
- 0x567D,0xBCD4,0xBCD5,0x3347,0xBCD6,0xBCD7,0x5721,0x0000,
- 0x0000,0x0000,0x5724,0x5725,0xBCD8,0x5723,0xBCD9,0x4940,
- 0x3E33,0x5727,0x5726,0x5722,0x0000,0xBCDA,0x0000,0x0000,
- 0x5728,0x5729,0x0000,0xBCDB,0x572A,0x0000,0x0000,0x0000,
- 0x572D,0x572B,0x0000,0x572C,0x572E,0x0000,0x3164,0x446E,
- 0x572F,0x0000,0x377A,0x3276,0x4736,0x0000,0x5730,0x467B,
-
- /* 5F00h */
- 0x0000,0x4A5B,0xBCDC,0x5731,0x4F2E,0x0000,0xBCDD,0xBCDE,
- 0xBCDF,0x5732,0x4A40,0x5735,0x5021,0x5031,0xBCE0,0x3C30,
- 0x4675,0x5736,0x0000,0x355D,0x4424,0x307A,0x5737,0x4A26,
- 0x3930,0xBCE1,0x0000,0x4350,0xBCE2,0xBCE3,0x0000,0x446F,
- 0x0000,0xBCE4,0xBCE5,0xBCE6,0xBCE7,0x4C6F,0x3839,0x384C,
- 0xBCE8,0x5738,0x0000,0xBCE9,0xBCEA,0x5739,0xBCEB,0x573F,
- 0xBCEC,0x3C65,0x0000,0x0000,0xBCED,0x4425,0xBCEE,0x362F,
- 0x573A,0x0000,0x0000,0xBCEF,0x492B,0xBCF0,0x4346,0xBCF1,
- 0xBCF2,0x573B,0x0000,0x0000,0xBCF3,0xBCF4,0x0000,0xBCF5,
- 0x573C,0x0000,0x3630,0x0000,0x573D,0xBCF6,0x573E,0x0000,
- 0xBCF7,0x5740,0x0000,0x4576,0xBCF8,0x0000,0x5741,0x5742,
- 0xBCF9,0x5743,0x0000,0xBCFA,0x5734,0x5733,0x0000,0x0000,
- 0xBCFB,0x5744,0x3741,0xBCFC,0xBCFD,0x0000,0x4927,0xBCFE,
- 0x0000,0x3A4C,0x4937,0x4426,0x494B,0x5745,0x0000,0xBDA1,
- 0x3E34,0x3146,0xBDA2,0x5746,0xBDA3,0xBDA4,0x0000,0x5747,
- 0xBDA5,0x4C72,0xBDA6,0x0000,0x4860,0xBDA7,0xBDA8,0x574A,
- 0x317D,0x402C,0x5749,0x5748,0x3742,0x4254,0x0000,0x574E,
- 0x574C,0xBDA9,0x574B,0x4E27,0x3865,0xBDAA,0x0000,0xBDAB,
- 0x3D79,0x574D,0x454C,0x3D3E,0x0000,0x0000,0xBDAC,0x4640,
- 0x5751,0x5750,0x0000,0x0000,0xBDAD,0xBDAE,0x574F,0x0000,
- 0x5752,0x3866,0xBDAF,0x0000,0xBDB2,0x0000,0x0000,0xBDB0,
- 0x5753,0x497C,0x3D5B,0xBDB1,0xBDB3,0x5754,0x4879,0xBDB4,
- 0xBDB5,0xBDB6,0x0000,0x4641,0x4427,0x0000,0x0000,0x0000,
- 0xBDB7,0x4530,0x0000,0x0000,0x5755,0x352B,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x3F34,0xBDB8,0x492C,0x0000,0xBDB9,
- 0xBDBA,0xBDBB,0x0000,0xBDBC,0x3477,0x4726,0x0000,0x0000,
- 0xBDBD,0xBDBE,0xBDBF,0xBDC0,0xBDC1,0x0000,0x5756,0x3B56,
- 0x4B3A,0x4B3B,0x0000,0x0000,0x317E,0x575B,0xBDC2,0x0000,
- 0x4369,0xBDC3,0xBDC4,0x0000,0x5758,0x0000,0x0000,0x0000,
- 0xBDC5,0xBDC6,0xBDC7,0x3277,0xBDC8,0xBDC9,0xBDCA,0xBDCB,
- 0x582D,0x575A,0xBDCC,0xBDCD,0x0000,0x4730,0xBDCE,0x0000,
- 0x5759,0x0000,0xBDCF,0x5757,0xBDD0,0x397A,0x0000,0x575D,
-
- /* 6000h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xBDD1,
- 0x0000,0x0000,0xBDD2,0x0000,0x0000,0xBDD3,0x5763,0x5769,
- 0x5761,0x0000,0x455C,0xBDD4,0xBDD5,0x5766,0x495D,0xBDD6,
- 0xBDD7,0x5760,0xBDD8,0x5765,0x4E67,0x3B57,0x0000,0xBDD9,
- 0x4255,0x575E,0x0000,0x0000,0xBDDA,0x355E,0x5768,0x402D,
- 0x3165,0x5762,0x3278,0x5767,0x0000,0xBDDB,0x0000,0x3631,
- 0x0000,0x5764,0x0000,0xBDDC,0x0000,0xBDDD,0x0000,0x0000,
- 0x0000,0x0000,0x576A,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xBDDE,0x576C,0x5776,0x5774,0x0000,0x0000,0x5771,0xBDDF,
- 0xBDE0,0xBDE1,0x5770,0x4E78,0xBDE2,0x5772,0x0000,0x0000,
- 0x3632,0xBDE3,0x3931,0x0000,0xBDE4,0x3D7A,0xBDE5,0xBDE6,
- 0x0000,0x5779,0x576B,0x0000,0x0000,0xBDE7,0x0000,0x576F,
- 0x575F,0xBDE8,0x327A,0x5773,0x5775,0x4351,0x0000,0xBDE9,
- 0x3A28,0x3238,0x576D,0x5778,0x5777,0x3633,0x0000,0x4229,
- 0x3366,0xBDEA,0x0000,0x0000,0x0000,0x3743,0x0000,0x576E,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xBDEB,0xBDEC,
- 0x0000,0x577A,0xBDED,0x577D,0x5821,0x0000,0xBDEE,0x0000,
- 0xBDEF,0x3C3D,0xBDF0,0x5827,0x4470,0x577B,0xBDF1,0x0000,
- 0x0000,0xBDF2,0x5825,0xBDF3,0x3279,0xBDF4,0x5823,0x5824,
- 0xBDF5,0x0000,0x577E,0x5822,0x0000,0xBDF6,0xBDF7,0x3867,
- 0x4D2A,0x0000,0xBDF8,0x3435,0xBDF9,0xBDFA,0x3159,0x5826,
- 0xBDFB,0x473A,0x302D,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xBDFC,0xBDFD,0x4861,0x575C,0x582C,0x5830,0x4C65,0xBDFE,
- 0x5829,0x0000,0x0000,0xBEA1,0x4569,0x582E,0xBEA2,0x0000,
- 0x0000,0x0000,0xBEA3,0x0000,0xBEA4,0x3E70,0x582F,0x4657,
- 0xBEA5,0xBEA6,0xBEA7,0xBEA8,0x0000,0x0000,0xBEA9,0xBEAA,
- 0x0000,0x4F47,0x0000,0x582B,0xBEAB,0xBEAC,0x0000,0x0000,
- 0x5831,0xBEAD,0x397B,0xBEAE,0x404B,0xBEAF,0xBEB0,0x3054,
- 0x582A,0x5828,0xBEB1,0x415A,0x0000,0xBEB2,0x0000,0x577C,
- 0x3B34,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x4246,0x583D,0xBEB3,0x415B,0x5838,0xBEB4,0x5835,0x5836,
- 0xBEB5,0x3C66,0x5839,0x583C,0xBEB6,0xBEB7,0x0000,0x0000,
-
- /* 6100h */
- 0x5837,0x3D25,0xBEB8,0x583A,0x0000,0x0000,0x5834,0xBEB9,
- 0x4C7C,0x4C7B,0xBEBA,0x0000,0xBEBB,0x583E,0x583F,0x3055,
- 0xBEBC,0xBEBD,0xBEBE,0xBEBF,0xBEC0,0x5833,0xBEC1,0xBEC2,
- 0x0000,0xBEC3,0x3672,0x3026,0xBEC4,0x0000,0xBEC5,0x3436,
- 0x0000,0x583B,0xBEC6,0x0000,0x0000,0x0000,0x0000,0x5843,
- 0x5842,0x0000,0xBEC7,0xBEC8,0x5847,0x0000,0x0000,0x0000,
- 0xBEC9,0xBECA,0x0000,0x0000,0x5848,0xBECB,0xBECC,0xBECD,
- 0x0000,0xBECE,0x0000,0x0000,0x5846,0x5849,0x5841,0x5845,
- 0x0000,0xBECF,0x584A,0x0000,0x584B,0xBED0,0xBED1,0x5840,
- 0x3B7C,0xBED2,0x5844,0x4256,0x3932,0x5832,0x3F35,0x0000,
- 0x0000,0x0000,0x0000,0x5858,0x0000,0x4A69,0x0000,0x0000,
- 0x584E,0x584F,0x5850,0x0000,0x0000,0x5857,0xBED3,0x5856,
- 0xBED4,0x0000,0x4B7D,0x3437,0x0000,0x5854,0x0000,0x3745,
- 0x3334,0x0000,0x0000,0x5851,0xBED5,0x0000,0x4E38,0x5853,
- 0x3056,0x5855,0xBED6,0x584C,0x5852,0x5859,0x3744,0x584D,
- 0xBED7,0x0000,0x0000,0xBED8,0xBED9,0x0000,0x4D5D,0xBEDA,
- 0xBEDB,0xBEDC,0x4D2B,0xBEDD,0xBEDE,0x0000,0x0000,0x585C,
- 0x0000,0x0000,0x5860,0xBEDF,0x0000,0xBEE0,0x417E,0x0000,
- 0x4E79,0x5861,0xBEE1,0xBEE2,0x585E,0x0000,0x585B,0xBEE3,
- 0xBEE4,0x585A,0x585F,0x0000,0xBEE5,0xBEE6,0x0000,0xBEE7,
- 0xBEE8,0x0000,0x0000,0x0000,0x4A30,0xBEE9,0x0000,0x4634,
- 0xBEEA,0x3746,0xBEEB,0x5862,0x585D,0xBEEC,0x5863,0x0000,
- 0x0000,0x0000,0x377B,0x0000,0x0000,0x0000,0x3231,0x0000,
- 0xBEED,0xBEEE,0x586B,0x0000,0xBEEF,0x0000,0x3438,0x0000,
- 0xBEF0,0xBEF1,0xBEF2,0x5869,0x0000,0x0000,0x586A,0x3A29,
- 0x5868,0x5866,0x5865,0x586C,0x5864,0x586E,0xBEF3,0xBEF4,
- 0x327B,0x0000,0x0000,0x0000,0x0000,0xBEF5,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0xBEF6,0xBEF7,0xBEF8,0xBEF9,
- 0x0000,0xBEFA,0xBEFB,0x5870,0x0000,0xBEFE,0x586F,0xBEFC,
- 0x0000,0xBEFD,0x0000,0x0000,0xBFA1,0xBFA2,0x0000,0xBFA3,
- 0x0000,0x0000,0x4428,0x0000,0x5873,0x0000,0x5871,0x5867,
- 0x377C,0x0000,0x5872,0x0000,0x5876,0x5875,0x5877,0x5874,
-
- /* 6200h */
- 0x5878,0xBFA4,0x0000,0xBFA5,0xBFA6,0x0000,0x0000,0xBFA7,
- 0x5879,0x587A,0x4A6A,0x0000,0x587C,0x587B,0x3D3F,0x0000,
- 0x402E,0x3266,0x327C,0xBFA8,0x587D,0xBFA9,0x303F,0x0000,
- 0x0000,0x0000,0x404C,0x587E,0xBFAA,0x6C43,0x5921,0x3761,
- 0xBFAB,0x5922,0xBFAC,0xBFAD,0x0000,0x0000,0x406F,0xBFAE,
- 0x0000,0xBFAF,0x5923,0xBFB0,0x0000,0x0000,0x5924,0x353A,
- 0x5925,0x0000,0x5926,0x5927,0x4257,0x0000,0x0000,0x0000,
- 0x384D,0xBFB1,0x0000,0x4C61,0x0000,0xBFB2,0x0000,0x4B3C,
- 0x3D6A,0x5928,0xBFB3,0xBFB4,0xBFB5,0x0000,0xBFB6,0x4070,
- 0x6E3D,0x4862,0x0000,0x3C6A,0xBFB7,0x3A4D,0x5929,0x0000,
- 0xBFB8,0xBFB9,0xBFBA,0x4247,0xBFBB,0x4A27,0xBFBC,0x0000,
- 0x4271,0x0000,0xBFBD,0x592C,0xBFBE,0x0000,0x592A,0x0000,
- 0x592D,0x0000,0x0000,0x592B,0xBFBF,0x0000,0x0000,0x0000,
- 0x592E,0x0000,0x0000,0x0000,0x0000,0xBFC0,0x4A31,0xBFC1,
- 0x0000,0x3037,0x0000,0xBFC2,0x0000,0x0000,0x495E,0x0000,
- 0x0000,0x4863,0xBFC3,0x0000,0x592F,0xBFC4,0x5932,0x3E35,
- 0x353B,0x0000,0x5930,0x5937,0x3E36,0x0000,0x0000,0x0000,
- 0x0000,0x5931,0x4744,0x0000,0x0000,0xBFC5,0xBFC6,0xBFC7,
- 0xBFC8,0x4D5E,0x5933,0x5934,0x5938,0x456A,0x5935,0x3933,
- 0x405E,0x0000,0x0000,0x5946,0x4834,0x0000,0x4272,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xBFC9,0x0000,
- 0xBFCA,0x0000,0x0000,0x4864,0x5A2D,0x0000,0x0000,0x0000,
- 0x0000,0x4A7A,0x0000,0xBFCB,0x0000,0x4471,0xBFCC,0xBFCD,
- 0x0000,0x4B75,0xBFCE,0x593B,0x3221,0x436A,0xBFCF,0xBFD0,
- 0x0000,0x0000,0x5944,0x0000,0xBFD1,0x4334,0x593E,0x5945,
- 0x5940,0x5947,0x5943,0x0000,0x5942,0x476F,0xBFD2,0x593C,
- 0x327D,0x593A,0x3571,0x4273,0x5936,0xBFD3,0xBFD4,0x5939,
- 0x3934,0x405B,0xBFD5,0x3E37,0x5941,0x4752,0x0000,0x0000,
- 0x3572,0x3348,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xBFD6,0x0000,0x3367,0x3F21,0x5949,0x594E,
- 0x0000,0x594A,0xBFD7,0x377D,0xBFD8,0x594F,0x3B22,0x3969,
- 0x0000,0x0000,0x0000,0x0000,0xBFD9,0xBFDA,0x3D26,0x593D,
-
- /* 6300h */
- 0x0000,0x3B7D,0x594C,0xBFDB,0xBFDC,0x0000,0x0000,0x3B58,
- 0x594D,0x3044,0xBFDD,0xBFDE,0x5948,0xBFDF,0x0000,0x0000,
- 0xBFE0,0x4429,0x0000,0xBFE1,0x0000,0x0000,0xBFE2,0x0000,
- 0xBFE3,0x3573,0x0000,0x0000,0x0000,0x0000,0x0000,0x3634,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x594B,
- 0x3027,0xBFE4,0xBFE5,0x3A43,0x0000,0xBFE6,0x0000,0x3F36,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xBFE7,0xBFE8,0x0000,
- 0x0000,0xBFE9,0x4472,0x0000,0xBFEA,0x4854,0x5951,0x415E,
- 0x0000,0xBFEB,0xBFEC,0xBFED,0xBFEE,0x0000,0xBFEF,0x0000,
- 0x0000,0x422A,0xBFF0,0xBFF1,0x3B2B,0x5952,0xBFF2,0x5954,
- 0x5950,0x0000,0xBFF3,0xBFF4,0xBFF5,0x4A61,0x0000,0x443D,
- 0xBFF6,0x0000,0x0000,0xBFF7,0x415C,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xBFF8,0xBFF9,0x4A7B,
- 0x3C4E,0x5960,0x0000,0x595F,0xBFFA,0xBFFB,0x3F78,0x0000,
- 0x0000,0xBFFC,0x377E,0x0000,0xBFFD,0xBFFE,0x5959,0x3E39,
- 0xC0A1,0x0000,0x4668,0x4731,0xC0A2,0xC0A3,0x0000,0xC0A4,
- 0x5957,0x0000,0xC0A5,0x415D,0xC0A6,0x0000,0x0000,0xC0A7,
- 0x3C78,0x595C,0xC0A8,0x0000,0x3E38,0x0000,0x5956,0x595B,
- 0xC0A9,0x0000,0x4753,0x0000,0xC0AA,0xC0AB,0x5955,0x0000,
- 0x3721,0xC0AC,0xC0AD,0x335D,0x0000,0x0000,0xC0AE,0x595D,
- 0x4E2B,0x3A4E,0x4335,0x595A,0xC0AF,0x405C,0xC0B0,0x3935,
- 0x3F64,0x3166,0x413C,0x5958,0x3545,0xC0B1,0xC0B2,0xC0B3,
- 0x0000,0x0000,0x3747,0x0000,0x444F,0x595E,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x415F,0x0000,0xC0B4,0x5961,0x0000,
- 0x5963,0xC0B5,0x0000,0x4237,0x5969,0xC0B6,0x5964,0x0000,
- 0xC0B7,0x5966,0x0000,0x0000,0x0000,0x0000,0xC0B8,0x4941,
- 0x4473,0xC0B9,0x5967,0xC0BA,0xC0BB,0xC0BC,0x4D2C,0x0000,
- 0x0000,0x0000,0x4D48,0x3439,0xC0BD,0x0000,0x0000,0x0000,
- 0xC0BE,0x302E,0x0000,0x5965,0x0000,0xC0BF,0x0000,0x0000,
- 0x0000,0x5962,0xC0C0,0x0000,0xC0C1,0x0000,0x3478,0x0000,
- 0x0000,0x0000,0xC0C2,0xC0C3,0x3167,0xC0C4,0x5968,0x0000,
- 0xC0C5,0xC0C6,0x4D49,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 6400h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x596C,0x0000,
- 0x0000,0xC0C7,0xC0C8,0x0000,0x0000,0x423B,0x0000,0x5973,
- 0xC0C9,0x0000,0xC0CA,0x596D,0xC0CB,0x0000,0x596A,0x5971,
- 0xC0CC,0x0000,0x0000,0x0000,0x5953,0x0000,0xC0CD,0x0000,
- 0xC0CE,0x0000,0xC0CF,0x0000,0xC0D0,0xC0D1,0x596E,0x0000,
- 0x5972,0xC0D2,0xC0D3,0x0000,0x4842,0x456B,0x0000,0xC0D4,
- 0xC0D5,0x0000,0x0000,0x0000,0x596B,0xC0D6,0x596F,0x0000,
- 0x0000,0x0000,0x3748,0x0000,0x0000,0xC0D7,0x3A71,0xC0D8,
- 0x0000,0x0000,0x405D,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xC0D9,0x0000,0x0000,0x5977,0xC0DA,
- 0x0000,0xC0DB,0xC0DC,0xC0DD,0xC0DE,0x0000,0x0000,0x0000,
- 0x4526,0x0000,0xC0DF,0xC0E0,0xC0E1,0xC0E2,0x0000,0xC0E3,
- 0xC0E4,0xC0E5,0x0000,0xC0E6,0x0000,0x0000,0x0000,0x5974,
- 0x0000,0x4B60,0x0000,0x0000,0x0000,0xC0E7,0x0000,0x5975,
- 0x0000,0x0000,0x0000,0xC0E8,0xC0E9,0x0000,0x5976,0x0000,
- 0x4C4E,0x0000,0x4022,0xC0EA,0x0000,0xC0EB,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x3762,0x0000,0xC0EC,0x0000,0xC0ED,
- 0x597D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xC0EE,
- 0xC0EF,0xC0F0,0x3B35,0x597A,0x0000,0x5979,0x0000,0x0000,
- 0xC0F1,0xC0F2,0x4732,0xC0F3,0x0000,0xC0F4,0x4635,0xC0F5,
- 0x0000,0xC0F6,0x0000,0xC0F7,0x4531,0x597B,0xC0F8,0x0000,
- 0xC0F9,0x597C,0x0000,0x496F,0xC0FA,0x4745,0x3B23,0x0000,
- 0x4071,0x0000,0x4B50,0xC0FB,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x3349,0x0000,0x5A25,0x597E,0xC0FC,0xC0FD,0xC0FE,
- 0x0000,0x4D4A,0x5A27,0x0000,0xC1A1,0x5A23,0x0000,0x5A24,
- 0x0000,0xC1A2,0xC1A3,0xC1A4,0xC1A5,0x4160,0xC1A6,0x0000,
- 0xC1A7,0xC1A8,0x5A22,0x0000,0x593F,0xC1A9,0x0000,0xC1AA,
- 0x5A26,0x0000,0x5A21,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x5A2B,0x5A2C,0x4527,0x5A2E,0xC1AB,0xC1AC,0x3B24,0x5A29,
- 0x0000,0xC1AD,0xC1AE,0x0000,0x353C,0xC1AF,0x0000,0x5A2F,
- 0xC1B0,0x5A28,0x5A33,0x0000,0x5A32,0xC1B1,0x5A31,0xC1B2,
- 0x0000,0x0000,0x5A34,0xC1B3,0x0000,0x5A36,0x3E71,0xC1B4,
-
- /* 6500h */
- 0x5A35,0xC1B5,0x0000,0x0000,0xC1B6,0x5A39,0x0000,0x0000,
- 0xC1B7,0xC1B8,0xC1B9,0x0000,0x0000,0x0000,0x0000,0xC1BA,
- 0x0000,0x0000,0x0000,0xC1BB,0xC1BC,0x0000,0xC1BD,0x0000,
- 0x5A37,0xC1BE,0x0000,0xC1BF,0x5A38,0x5970,0xC1C0,0xC1C1,
- 0x0000,0x0000,0xC1C2,0x5A3B,0x5A3A,0x0000,0xC1C3,0x0000,
- 0x0000,0xC1C4,0x5978,0x5A3C,0x5A30,0x0000,0xC1C5,0x3B59,
- 0x0000,0xC1C6,0x0000,0x0000,0x5A3D,0x5A3E,0x5A40,0x5A3F,
- 0x5A41,0x327E,0xC1C7,0x3936,0xC1C8,0xC1C9,0x4A7C,0x402F,
- 0x0000,0x0000,0x0000,0xC1CA,0x0000,0x384E,0x0000,0xC1CB,
- 0x5A43,0xC1CC,0x0000,0x0000,0x0000,0x5A46,0x0000,0x4952,
- 0xC1CD,0x355F,0xC1CE,0x0000,0xC1CF,0x5A45,0x5A44,0x4754,
- 0x5A47,0x3635,0x0000,0x0000,0x0000,0x5A49,0x5A48,0xC1D0,
- 0xC1D1,0x0000,0x343A,0x3B36,0x0000,0x0000,0x4658,0xC1D2,
- 0x0000,0x0000,0x0000,0xC1D3,0x3749,0x0000,0x0000,0x0000,
- 0x3F74,0x0000,0x5A4A,0x0000,0x4030,0x4528,0x0000,0x495F,
- 0x5A4B,0x0000,0xC1D4,0x0000,0x0000,0xC1D5,0x0000,0x0000,
- 0x0000,0xC1D6,0x5A4C,0x5A4D,0x0000,0xC1D7,0x0000,0x4A38,
- 0x555D,0x4046,0xC1D8,0x0000,0x494C,0x0000,0x3A58,0x0000,
- 0x4865,0x4843,0xC1D9,0x0000,0x0000,0xC1DA,0x0000,0x454D,
- 0xC1DB,0x4E41,0x0000,0x5A4F,0x3C50,0xC1DC,0x0000,0x5A50,
- 0xC1DD,0x3036,0x0000,0xC1DE,0x3654,0x404D,0xC1DF,0x4960,
- 0x0000,0x0000,0x0000,0x5A51,0x3B42,0x4347,0xC1E0,0x3B5B,
- 0x3F37,0x0000,0xC1E1,0xC1E2,0xC1E3,0x0000,0x0000,0x5A52,
- 0x0000,0x4A7D,0x0000,0x0000,0x3177,0x3B5C,0x0000,0xC1E4,
- 0x0000,0x5A55,0xC1E5,0x5A53,0x5A56,0x4E39,0x5A54,0x0000,
- 0xC1E6,0xC1E7,0x0000,0x407B,0x5A57,0x0000,0xC1E8,0x4232,
- 0xC1E9,0x0000,0x5A58,0x0000,0xC1EA,0x0000,0xC1EB,0x347A,
- 0xC1EC,0x5A5A,0x0000,0x5A59,0x0000,0x0000,0x0000,0xC1ED,
- 0x5A5B,0x5A5C,0x347B,0x0000,0x0000,0x467C,0x4336,0x356C,
- 0x3B5D,0x4161,0x0000,0x0000,0x3D5C,0x3030,0x0000,0x0000,
- 0xC1EE,0x5A5D,0xC1EF,0x0000,0xC1F0,0xC1F1,0x0000,0x0000,
- 0x0000,0xC1F2,0x3222,0x5A61,0x0000,0x0000,0xC1F3,0xC1F4,
-
- /* 6600h */
- 0xC1F5,0x0000,0x3937,0x5A60,0xC1F6,0x0000,0x3A2B,0x3E3A,
- 0xC1F7,0xC1F8,0x5A5F,0x0000,0x3E3B,0xC1F9,0x4C40,0x3A2A,
- 0x0000,0xC1FA,0xC1FB,0x3057,0x404E,0xC1FC,0xC1FD,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x5A66,0xC1FE,0xC2A1,0x4031,
- 0x3147,0xC2A2,0xC2A3,0xC2A4,0xC2A5,0x3D55,0xC2A6,0x4B66,
- 0x3A72,0xC2A7,0xC2A8,0xC2A9,0xC2AA,0x3E3C,0xC2AB,0x4027,
- 0xC2AC,0xC2AD,0x0000,0xC2AE,0x5A65,0x5A63,0x5A64,0xC2B0,
- 0x0000,0xC2AF,0x0000,0x0000,0x436B,0x0000,0x0000,0x5B26,
- 0xC2B1,0x5A6A,0x3B7E,0x3938,0x5A68,0xC2B2,0xC2B3,0x0000,
- 0x0000,0x5A69,0xC2B4,0x3F38,0xC2B5,0x0000,0xC2B7,0x5A67,
- 0x0000,0xC2B6,0x3B2F,0x0000,0x0000,0x0000,0x0000,0xC2B8,
- 0xC2B9,0xC2BA,0x0000,0xC2BB,0xC2BC,0x5A6C,0x5A6B,0x5A70,
- 0xC2BD,0xC2BE,0x5A71,0x0000,0x5A6D,0x0000,0x3322,0x5A6E,
- 0x5A6F,0x4855,0xC2C0,0xC2C1,0xC2C2,0x0000,0x4961,0x374A,
- 0x5A72,0x0000,0x0000,0xC2C4,0x4032,0xC2C5,0x3E3D,0xC2C7,
- 0xC2C8,0xC2C9,0x4352,0xC2CA,0xC2CC,0x0000,0xC2C3,0xC2C6,
- 0xC2CB,0x3647,0x0000,0x5A73,0x5A77,0x0000,0x0000,0x324B,
- 0x5A74,0x5A76,0x0000,0xC2CD,0xC2CE,0xC2CF,0x5A75,0x0000,
- 0xC2D0,0x3D6B,0xC2D1,0x0000,0x0000,0x0000,0x4348,0x3045,
- 0x5A78,0xC2D2,0xC2D3,0xC2D4,0xC2D5,0x5A79,0x0000,0xC2D6,
- 0xC2D7,0x0000,0x442A,0x0000,0xC2D8,0x0000,0x4E71,0x0000,
- 0x0000,0x0000,0x0000,0x3B43,0x0000,0xC2D9,0x4A6B,0x0000,
- 0x0000,0xC2DA,0xC2DB,0x0000,0x4B3D,0xC2DC,0x0000,0x0000,
- 0x5B22,0x5A7B,0x0000,0xC2DD,0x5A7E,0x0000,0x5A7D,0xC2DE,
- 0xC2DF,0x5A7A,0xC2E0,0xC2E1,0x5B21,0x0000,0x0000,0x465E,
- 0xC2E2,0x5A7C,0x0000,0x0000,0xC2E3,0x0000,0xC2E4,0xC2E5,
- 0x0000,0x0000,0x0000,0x0000,0xC2E6,0x0000,0x5B23,0x0000,
- 0x0000,0x3D6C,0x5B24,0xC2E7,0x4D4B,0x4778,0x0000,0xC2E8,
- 0x5B25,0x0000,0x0000,0x0000,0x0000,0x0000,0x5B27,0x0000,
- 0xC2E9,0x5B28,0x0000,0xC2EA,0xC2EB,0x0000,0xC2EC,0x0000,
- 0x5B29,0x0000,0x364A,0x3148,0x3939,0x5B2A,0x0000,0x5B2B,
- 0x3D71,0x4162,0xC2ED,0xC2BF,0x5258,0x413E,0x413D,0x4258,
-
- /* 6700h */
- 0x3A47,0x0000,0x0000,0x5072,0x0000,0xC2EE,0x0000,0xC2EF,
- 0x376E,0x4D2D,0x0000,0x4A7E,0x0000,0x497E,0xC2F0,0x5B2C,
- 0x0000,0x0000,0x0000,0xC2F1,0x3A73,0x443F,0x5B2D,0x4F2F,
- 0x0000,0xC2F2,0x0000,0x4B3E,0xC2F3,0x442B,0x5B2E,0x347C,
- 0xC2F4,0x0000,0xC2F5,0x0000,0x0000,0x0000,0x5B2F,0x5B30,
- 0x4C5A,0x0000,0x4C24,0x4B76,0x4B5C,0x3B25,0x5B32,0x0000,
- 0x0000,0x3C6B,0x0000,0xC2F6,0x4B51,0x0000,0x5B34,0x5B37,
- 0x5B36,0x0000,0x3479,0x0000,0x0000,0x3560,0xC2F7,0x5B33,
- 0x0000,0x5B35,0x0000,0x0000,0x0000,0xC2F8,0x5B38,0xC2F9,
- 0xC2FA,0x3F79,0x0000,0x0000,0xC2FB,0x0000,0x4D7B,0x3049,
- 0x3A60,0x423C,0x0000,0x3C5D,0xC2FC,0xC2FD,0x3E73,0x0000,
- 0x0000,0x5B3B,0x0000,0x0000,0x454E,0xC2FE,0x5B39,0x422B,
- 0x5B3A,0x3E72,0x4C5D,0x5B3C,0x5B3D,0x4D68,0xC3A1,0x0000,
- 0x0000,0x0000,0x5B42,0x0000,0xC3A2,0x393A,0xC3A3,0x4755,
- 0x5B3F,0x456C,0x5A5E,0x5A62,0xC3A4,0x354F,0xC3A5,0x4747,
- 0x0000,0x0000,0x0000,0xC3A6,0x5B41,0x0000,0x3E3E,0x4844,
- 0x0000,0xC3A7,0x0000,0x0000,0xC3A8,0x5B47,0x0000,0x487A,
- 0x0000,0x5B3E,0x0000,0x5B44,0x5B43,0x0000,0xC3A9,0xC3AA,
- 0x404F,0xC3AB,0x0000,0xC3AC,0x0000,0x4B6D,0xC3AD,0x4E53,
- 0xC3AE,0xC3AF,0x4B67,0xC3B0,0x324C,0x3B5E,0x0000,0x0000,
- 0x4F48,0x5B46,0x3F75,0x0000,0x0000,0x0000,0x5B45,0x0000,
- 0x0000,0x5B40,0x0000,0x0000,0x0000,0x0000,0x0000,0x384F,
- 0xC3B1,0xC3B2,0xC3B3,0x5B4C,0x5B4A,0xC3B4,0x324D,0x5B48,
- 0x5B4E,0x5B54,0x0000,0xC3B5,0xC3B6,0xC3B7,0x0000,0x0000,
- 0xC3B9,0x4248,0xC3BA,0xC3BB,0x4A41,0xC3BC,0x5B56,0x0000,
- 0xC3BD,0xC3BE,0x4922,0x0000,0x0000,0x0000,0x5B55,0x4770,
- 0x4B3F,0x343B,0xC3BF,0x4077,0x3D40,0x0000,0x0000,0xC3C0,
- 0x4453,0xC3C1,0x4D2E,0x0000,0xC3C2,0x5B51,0x5B50,0x0000,
- 0x0000,0xC3C3,0x5B52,0x0000,0x5B4F,0x0000,0xC3C4,0x5B57,
- 0x0000,0x5B4D,0x0000,0x0000,0x5B4B,0x0000,0x5B53,0x5B49,
- 0xC3C5,0x436C,0xC3C6,0x4C78,0x3C46,0x3A74,0xC3C7,0xC3C8,
- 0x0000,0xC3B8,0x0000,0x3A3A,0x0000,0x0000,0x4B6F,0x3341,
-
- /* 6800h */
- 0x0000,0x0000,0x444E,0x464A,0x3149,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x4072,0xC3CA,0x0000,0x4034,0x372A,
- 0x0000,0xC3CB,0x0000,0x0000,0x0000,0xC3CC,0x5B59,0xC3CD,
- 0x0000,0x393B,0x337C,0x0000,0x0000,0x0000,0x0000,0xC3CF,
- 0xC3CE,0x5B5B,0x3374,0x5B61,0xC3D0,0xC3D1,0x0000,0xC3D2,
- 0xC3D3,0xC3D4,0x5B5E,0xC3D5,0x4073,0x0000,0x0000,0x0000,
- 0x334B,0x3A2C,0x0000,0xC3D6,0x334A,0x3A4F,0x0000,0xC3D7,
- 0x5B5C,0x3765,0x374B,0x456D,0xC3D8,0xC3D9,0x5B5A,0x0000,
- 0x3046,0x0000,0xC3DA,0x0000,0xC3DB,0x5B5D,0x5B5F,0x0000,
- 0x364D,0x372C,0xC3C9,0x343C,0x354B,0xC3DC,0x0000,0xC3DD,
- 0xC3DE,0x5B62,0x0000,0xC3DF,0x3A79,0x4B71,0x0000,0x3B37,
- 0x0000,0x0000,0x0000,0x5B63,0x0000,0x0000,0x0000,0x4930,
- 0x0000,0x0000,0x0000,0xC3E0,0x0000,0x0000,0xC3E1,0xC3E2,
- 0xC3E3,0xC3E4,0xC3E5,0x0000,0x5B6F,0xC3E6,0x3233,0x5B64,
- 0x0000,0xC3E7,0xC3E8,0xC3E9,0xC3EA,0x0000,0x5B75,0x5B65,
- 0x0000,0x4E42,0xC3EB,0x5B6C,0xC3EC,0x475F,0xC3ED,0x0000,
- 0xC3EE,0x0000,0x0000,0x0000,0x0000,0x5B74,0x0000,0x5B67,
- 0x0000,0x0000,0x0000,0x3034,0x5B69,0x0000,0xC3EF,0x393C,
- 0xC3F0,0x0000,0xC3F1,0x5B6B,0xC3F2,0x5B6A,0x0000,0x5B66,
- 0x5B71,0xC3F3,0x3E3F,0xC3F4,0x0000,0xC3F5,0x546D,0x3868,
- 0x4D7C,0xC3F6,0xC3F7,0x0000,0x0000,0x5B68,0xC3F8,0x4474,
- 0x3323,0x3A2D,0xC3F9,0x5B60,0x0000,0x5B70,0x3361,0x0000,
- 0x0000,0x5B6E,0x5B72,0xC3FA,0x456E,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x347E,0xC3FB,0x5C32,0x0000,
- 0xC3FC,0x4C49,0x5B77,0x347D,0xC3FD,0x5B7E,0x0000,0xC3FE,
- 0xC4A1,0xC4A2,0x4B40,0xC4A3,0x5C21,0x5C23,0xC4A4,0x5C27,
- 0x5B79,0xC4A5,0x432A,0x0000,0xC4A6,0xC4A7,0x0000,0x456F,
- 0x5C2B,0x5B7C,0x0000,0x5C28,0x0000,0xC4A8,0x0000,0x5C22,
- 0xC4A9,0x0000,0xC4AA,0xC4AB,0xC4AC,0xC4AD,0x3F39,0x5C2C,
- 0xC4AE,0xC4AF,0x4033,0x0000,0x0000,0xC4B0,0xC4B1,0x0000,
- 0x0000,0x5C2A,0x343D,0xC4B2,0xC4B3,0xC4B4,0x0000,0x0000,
-
- /* 6900h */
- 0x4F50,0x5B76,0x0000,0x0000,0x5C26,0x3058,0xC4B5,0x0000,
- 0x5B78,0xC4B6,0xC4B7,0x4C3A,0x5B7D,0x3F22,0x4447,0x5B73,
- 0xC4B8,0xC4B9,0x5C25,0xC4BA,0x0000,0x0000,0xC4BB,0xC4BC,
- 0x0000,0x3F7A,0x5C2F,0x3371,0x3821,0x0000,0x0000,0x0000,
- 0x0000,0x5C31,0x5B7A,0x5C30,0x0000,0x5C29,0x5B7B,0x0000,
- 0x5C2D,0x0000,0x5C2E,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x5C3F,0xC4BD,0x0000,0xC4BE,0x464E,0xC4BF,0x5C24,0x0000,
- 0xC4C0,0x5C3B,0x0000,0xC4C1,0x0000,0x5C3D,0x0000,0x4458,
- 0x0000,0x0000,0xC4C2,0x0000,0x0000,0xC4C3,0x0000,0x0000,
- 0x0000,0xC4C4,0x4D4C,0x0000,0x0000,0x0000,0xC4C5,0x0000,
- 0x0000,0x0000,0x0000,0x4976,0x5C38,0x424A,0x0000,0xC4C6,
- 0x0000,0x5C3E,0x413F,0xC4C7,0x5C35,0x5C42,0x5C41,0x0000,
- 0x466F,0x5C40,0x466A,0xC4C8,0xC4C9,0xC4CA,0xC4CB,0x0000,
- 0xC4CC,0xC4CD,0x5C44,0x5C37,0xC4CE,0x3648,0x5C3A,0x3D5D,
- 0xC4CF,0xC4D0,0xC4D1,0x4760,0x5C3C,0x364B,0x0000,0x5C34,
- 0x5C36,0x5C33,0xC4D2,0xC4D3,0x4F30,0x335A,0x5C39,0xC4D4,
- 0xC4D5,0x5C43,0x3335,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x3A67,0x0000,0x0000,0xC4D6,0x315D,0x0000,
- 0x0000,0x5C54,0xC4D7,0x0000,0x4F31,0x5C57,0xC4D8,0x0000,
- 0xC4D9,0x0000,0x0000,0x3F3A,0x5C56,0x0000,0x0000,0x0000,
- 0x5C55,0xC4DA,0x0000,0x0000,0x0000,0xC4DB,0xC4DC,0x5C52,
- 0xC4DD,0x0000,0x0000,0xC4DE,0x0000,0xC4DF,0x5C46,0xC4E0,
- 0x0000,0x5C63,0x5C45,0x0000,0x5C58,0x0000,0x0000,0xC4E1,
- 0xC4E2,0x0000,0xC4E3,0x5C50,0xC4E4,0x0000,0x5C4B,0x5C48,
- 0x0000,0x5C49,0x0000,0x5C51,0x0000,0xC4E5,0x0000,0x7422,
- 0xC4E6,0x0000,0x5C4E,0x393D,0x4448,0x4164,0x5C4C,0x0000,
- 0x5C47,0xC4E7,0x0000,0x5C4A,0x0000,0x0000,0xC4E8,0xC4E9,
- 0x4D4D,0x4B6A,0x0000,0x0000,0x0000,0x5C4F,0x5C59,0x0000,
- 0x0000,0x0000,0xC4EA,0x0000,0x0000,0xC4EB,0x0000,0x5C61,
- 0x5C5A,0x0000,0x0000,0x5C67,0x0000,0x5C65,0xC4EC,0xC4ED,
- 0x0000,0xC4EE,0x5C60,0xC4EF,0x0000,0xC4F0,0x0000,0x0000,
- 0x0000,0x5C5F,0x0000,0x4450,0x0000,0x4165,0xC4F1,0x5C5D,
-
- /* 6A00h */
- 0xC4F2,0xC4F3,0x5C5B,0xC4F4,0x0000,0x5C62,0x0000,0x0000,
- 0x0000,0x0000,0x5C68,0x4875,0x5C6E,0x0000,0x0000,0xC4F5,
- 0x0000,0xC4F6,0x5C69,0x5C6C,0x5C66,0xC4F7,0x0000,0x4374,
- 0x0000,0x4938,0xC4F8,0x5C5C,0x0000,0xC4F9,0x5C64,0x3E40,
- 0xC4FA,0x4C4F,0x5C78,0x5C6B,0xC4FB,0x0000,0x0000,0x0000,
- 0xC4FC,0x3822,0x3223,0x335F,0x0000,0x0000,0x5C53,0x0000,
- 0xC4FD,0x0000,0xC4FE,0x0000,0xC5A1,0x3E41,0x5C70,0xC5A2,
- 0x5C77,0x3C79,0x3372,0xC5A3,0x0000,0x432E,0xC5A4,0xC5A5,
- 0x0000,0x0000,0x0000,0x0000,0x5C6D,0xC5A6,0xC5A7,0x5C72,
- 0x5C76,0xC5A8,0xC5A9,0x3636,0x0000,0x0000,0xC5AA,0x0000,
- 0xC5AB,0xC5AC,0xC5AD,0x0000,0x0000,0xC5AE,0xC5AF,0x0000,
- 0x354C,0x5C74,0x0000,0xC5B0,0x0000,0x0000,0x0000,0x3521,
- 0x0000,0x464B,0x5C73,0x0000,0xC5B1,0x0000,0x5C75,0xC5B2,
- 0x0000,0x0000,0xC5B3,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xC5B4,0x5C6F,0xC5B5,0x0000,0x0000,0x0000,0x0000,
- 0x5C71,0x0000,0x0000,0x0000,0x0000,0x0000,0xC5B6,0x3360,
- 0x4349,0xC5B7,0x0000,0xC5B8,0x5C7C,0x0000,0xC5B9,0xC5BA,
- 0x0000,0xC5BB,0x0000,0xC5BC,0x0000,0x5C7A,0x3869,0x0000,
- 0x5C79,0xC5BD,0x0000,0x0000,0x0000,0x0000,0x0000,0x5D21,
- 0x0000,0x0000,0x0000,0xC5BE,0x5B58,0xC5BF,0xC5C0,0xC5C1,
- 0x5C7B,0x0000,0x5C7D,0x5C7E,0x0000,0xC5C2,0x0000,0x0000,
- 0x0000,0x0000,0x5D2C,0xC5C3,0x5D28,0x0000,0x5B6D,0xC5C4,
- 0xC5C5,0xC5C6,0x0000,0x5D27,0xC5C7,0x0000,0x0000,0x0000,
- 0x5D26,0x0000,0x0000,0x5D23,0x0000,0xC5C8,0xC5C9,0xC5CA,
- 0x0000,0x5C6A,0x5D25,0x5D24,0x0000,0x0000,0xC5CB,0x0000,
- 0xC5CD,0xC5CC,0x0000,0x0000,0xC5CE,0x0000,0x0000,0x0000,
- 0xC5CF,0x5D2A,0x0000,0x4F26,0xC5D0,0xC5D1,0xC5D2,0x0000,
- 0x0000,0x0000,0x5D2D,0x367B,0xC5D3,0xC5D4,0x5D29,0x5D2B,
- 0x0000,0x0000,0x0000,0x0000,0xC5D5,0x0000,0x0000,0xC5D6,
- 0x4827,0x0000,0x5D2E,0x0000,0xC5D7,0x0000,0x0000,0x0000,
- 0xC5D8,0xC5D9,0xC5DA,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x5D32,0x5D2F,0xC5DB,0xC5DC,0x0000,0x0000,
-
- /* 6B00h */
- 0x0000,0x0000,0xC5DD,0xC5DE,0x4D73,0x5D30,0xC5DF,0xC5E0,
- 0x0000,0xC5E1,0x5C5E,0x0000,0x0000,0x0000,0x0000,0xC5E2,
- 0xC5E3,0xC5E4,0x5D33,0x0000,0x0000,0x0000,0x5D34,0xC5E5,
- 0x0000,0x0000,0x0000,0xC5E6,0x0000,0x3135,0xC5E7,0x5D36,
- 0x3767,0x3C21,0x0000,0x3655,0xC5E8,0x0000,0x0000,0x3224,
- 0xC5E9,0x0000,0x0000,0xC5EA,0xC5EB,0x0000,0x0000,0xC5EC,
- 0x0000,0x0000,0x4D5F,0x0000,0x0000,0xC5ED,0xC5EE,0x5D38,
- 0x5D37,0x5D3A,0x353D,0xC5EF,0x0000,0x3656,0x343E,0xC5F0,
- 0x0000,0x0000,0x0000,0x5D3D,0x0000,0x0000,0xC5F1,0x5D3C,
- 0x0000,0x5D3E,0xC5F2,0x0000,0x324E,0xC5F3,0x4337,0x0000,
- 0x5D3F,0x0000,0xC5F4,0x343F,0x5D41,0x0000,0xC5F5,0x0000,
- 0xC5F6,0x5D40,0x0000,0x5D42,0x0000,0xC5F7,0x0000,0x5D43,
- 0xC5F8,0x5D44,0x3B5F,0x4035,0x3A21,0x0000,0x4970,0xC5F9,
- 0x0000,0x4A62,0x4F44,0xC5FA,0x0000,0x0000,0xC5FB,0x3B75,
- 0xC5FC,0x0000,0x0000,0x3A50,0x4E72,0xC5FD,0x0000,0x0000,
- 0x5D45,0x5D46,0x0000,0x3B60,0x0000,0xC5FE,0xC6A1,0x5D47,
- 0x5D48,0x0000,0xC6A2,0x5D4A,0x5D49,0xC6A3,0x4B58,0x0000,
- 0x0000,0x3D5E,0x3C6C,0x3B44,0x0000,0x5D4B,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x5D4D,0x3F23,0xC6A4,
- 0x5D4C,0x0000,0x0000,0xC6A5,0x0000,0x0000,0x5D4E,0xC6A6,
- 0xC6A7,0x0000,0xC6A8,0xC6A9,0x5D4F,0x0000,0x0000,0x0000,
- 0xC6AA,0xC6AB,0x5D50,0x5D51,0xC6AC,0xC6AD,0xC6AE,0x5D52,
- 0xC6AF,0x5D54,0x5D53,0x5D55,0x3225,0x434A,0x0000,0x5D56,
- 0xC6B0,0xC6B1,0x3B26,0x334C,0x5D57,0xC6B2,0xC6B3,0x4542,
- 0x544C,0x0000,0x0000,0xC6B4,0xC6B5,0x3523,0x5D58,0x0000,
- 0x0000,0xC6B6,0x0000,0x5D59,0xC6B7,0x4A6C,0x4B68,0x0000,
- 0x0000,0x0000,0x4647,0x5D5A,0x4866,0x0000,0xC6B8,0x0000,
- 0x487B,0x0000,0xC6B9,0x4C53,0x0000,0x0000,0x0000,0x5D5B,
- 0x0000,0xC6BA,0x0000,0xC6BB,0x0000,0x0000,0xC6BC,0xC6BD,
- 0x0000,0x0000,0x0000,0x5D5D,0x5D5C,0x0000,0xC6BE,0x5D5F,
- 0x0000,0xC6BF,0x0000,0x5D5E,0x0000,0x0000,0x0000,0xC6C0,
- 0x0000,0xC6C1,0x0000,0x0000,0x0000,0x0000,0x0000,0xC6C2,
-
- /* 6C00h */
- 0x0000,0x0000,0xC6C3,0x0000,0xC6C4,0xC6C5,0x0000,0x0000,
- 0x5D61,0xC6C6,0x0000,0x0000,0x0000,0xC6C7,0xC6C8,0x3B61,
- 0xC6C9,0x4C31,0xC6CA,0x5D62,0x5D63,0x0000,0x0000,0x3524,
- 0x0000,0xC6CB,0x0000,0x5D64,0x0000,0x0000,0x0000,0xC6CC,
- 0x0000,0x0000,0x0000,0x5D66,0x5D65,0x0000,0xC6CD,0xC6CE,
- 0xC6CF,0x0000,0x0000,0x0000,0xC6D0,0x0000,0xC6D1,0x0000,
- 0x0000,0x0000,0x0000,0xC6D2,0x3F65,0xC6D3,0xC6D4,0x4939,
- 0x314A,0x0000,0xC6D5,0xC6D6,0x0000,0x0000,0x4845,0xC6D7,
- 0x4475,0x3D41,0x3561,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xC6D8,0xC6D9,0x0000,0xC6DA,0x4846,0xC6DB,
- 0x3C2E,0x0000,0xC6DC,0x0000,0xC6DD,0x5D68,0x0000,0x3440,
- 0x0000,0xC6DE,0x3178,0xC6DF,0xC6E0,0x4672,0x5D67,0x393E,
- 0x4353,0x0000,0x5D69,0x0000,0x0000,0x0000,0x0000,0xC7B6,
- 0x5D71,0x0000,0x5D6A,0xC6E1,0x0000,0xC6E2,0x0000,0xC6E3,
- 0x4241,0x0000,0x3562,0x5D72,0xC6E4,0x0000,0xC6E5,0x0000,
- 0xC6E6,0xC6E7,0x3768,0xC6E8,0x0000,0x3525,0x5D70,0x0000,
- 0x0000,0x5D6E,0x5D6B,0x4D60,0x0000,0xC6E9,0xC6EA,0xC6EB,
- 0x4440,0xC6EC,0x0000,0x0000,0x4659,0x5D6C,0x0000,0x0000,
- 0x5D74,0x0000,0x5D73,0x3723,0xC6ED,0xC6EE,0x322D,0xC6EF,
- 0xC6F0,0x3A3B,0x5D6D,0x5D6F,0xC6F1,0x0000,0x0000,0xC6F2,
- 0x0000,0x4B57,0x4274,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x4B77,0x0000,0x0000,0x5D7C,0x0000,
- 0xC6F3,0x5D7D,0xC6F4,0x324F,0xC6F5,0x0000,0x0000,0x0000,
- 0x4A28,0x4C7D,0x5E21,0x3C23,0x3E42,0x5D78,0x5D7E,0x3168,
- 0x0000,0x3637,0xC6F6,0x0000,0x5D75,0x5D7A,0xC6F7,0x0000,
- 0x0000,0x4074,0x4771,0x0000,0x4867,0xC6F8,0x0000,0xC6F9,
- 0xC6FA,0xC6FB,0xC6FC,0x5D77,0xC6FD,0x4B21,0xC6FE,0x5D79,
- 0x0000,0x5E24,0xC7A1,0x5E22,0xC7A2,0x5D7B,0x0000,0x0000,
- 0xC7A3,0x4B22,0x4748,0x3563,0x0000,0x4525,0x0000,0xC7A4,
- 0x436D,0xC7A5,0x5E25,0xC7A6,0xC7A7,0x0000,0xC7A8,0x5E23,
- 0x4259,0x5D76,0xC7A9,0x314B,0xC7AA,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 6D00h */
- 0x0000,0x0000,0x0000,0x0000,0xC7AB,0x0000,0x0000,0xC7AC,
- 0x0000,0x0000,0xC7AD,0x4D4E,0x5E30,0x0000,0xC7AE,0xC7AF,
- 0x0000,0xC7B0,0x5E2F,0xC7B1,0x0000,0x0000,0x0000,0x4076,
- 0x0000,0x5E2C,0xC7B2,0x4D6C,0x0000,0x0000,0x4636,0x5E26,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x4445,0xC7B3,0xC7B4,
- 0xC7B5,0x314C,0x393F,0x5E29,0x0000,0x0000,0xC7B7,0xC7B8,
- 0x0000,0xC7B9,0x3D27,0x5E2E,0x0000,0x5E2D,0x5E28,0x0000,
- 0x5E2B,0xC7BA,0x0000,0x3368,0xC7BB,0x5E2A,0x4749,0xC7BC,
- 0x0000,0x4E2E,0x0000,0x0000,0x3E74,0x4075,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xC7BD,
- 0x0000,0x5E36,0x5E34,0x0000,0x494D,0x0000,0xC7BE,0xC7BF,
- 0x0000,0xC7C0,0x0000,0x5E31,0x5E33,0xC7C1,0x313A,0xC7C2,
- 0x0000,0x3940,0x4F32,0x0000,0x333D,0x0000,0x4962,0xC7C3,
- 0xC7C4,0x0000,0x0000,0x0000,0x4D61,0x0000,0x0000,0x3324,
- 0x3F3B,0x5E35,0x0000,0x0000,0xC7C5,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xC7C6,0x0000,0x0000,0x5E3A,0x0000,0xC7C7,
- 0x3E43,0x0000,0x0000,0x0000,0x4D30,0x0000,0x5E37,0x0000,
- 0x0000,0xC7C8,0xC7C9,0x5E32,0xC7CA,0x5E38,0xC7CB,0xC7CC,
- 0xC7CD,0x4E5E,0x0000,0x4573,0x4642,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xC7CE,0x0000,0xC7CF,0x0000,0x0000,0x3336,
- 0x0000,0x0000,0x3155,0x0000,0xC7D0,0x5E3E,0x0000,0xC7D1,
- 0x5E41,0xC7D2,0x0000,0x0000,0x4E43,0xC7D3,0x0000,0xC7D4,
- 0x4D64,0x0000,0x0000,0x0000,0xC7D5,0x5E48,0x5E42,0x5E3F,
- 0xC7D6,0x0000,0xC7D7,0x4E54,0x5E45,0x0000,0xC7D8,0xC7D9,
- 0x0000,0x3D4A,0x5E47,0x0000,0x0000,0x5E4C,0xC7DA,0x0000,
- 0x4571,0x5E4A,0x0000,0xC7DB,0x0000,0xC7DC,0x5E44,0xC7DD,
- 0xC7DE,0x4338,0xC7DF,0x0000,0x5E4B,0xC7E0,0x5E40,0x0000,
- 0x5E46,0xC7E1,0x5E4D,0x307C,0x5E43,0x0000,0x5E4E,0xC7E2,
- 0xC7E3,0x3F3C,0x0000,0x3D5F,0xC7E4,0x4A25,0xC7E5,0x3A2E,
- 0x0000,0x5E3B,0x5E49,0x453A,0xC7E6,0x0000,0x0000,0x0000,
-
- /* 6E00h */
- 0xC7E7,0x0000,0x0000,0x0000,0xC7E8,0x4036,0x0000,0x3369,
- 0x3A51,0x3E44,0x5E3D,0x3D42,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x374C,0x0000,0x5E3C,0x0000,0x0000,
- 0x0000,0x5E52,0x3D6D,0x383A,0x0000,0x5E61,0xC7E9,0x5E5B,
- 0x3574,0x454F,0xC7EA,0x5E56,0x5E5F,0x302F,0x3132,0xC7EB,
- 0x0000,0x3239,0x0000,0x5E58,0x422C,0x5E4F,0x5E51,0x3941,
- 0x0000,0x0000,0xC7EC,0x0000,0x0000,0x0000,0xC7ED,0x0000,
- 0x5E62,0xC7EE,0x5E5D,0xC7EF,0xC7F0,0x0000,0x5E55,0x0000,
- 0x0000,0x0000,0x0000,0x5E5C,0xC7F1,0xC7F2,0x0000,0x0000,
- 0xC7F3,0xC7F4,0x4C2B,0xC7F5,0x0000,0x5E5A,0x5E5E,0xC7F6,
- 0x0000,0xC7F7,0xC7F8,0xC7F9,0xC7FA,0x0000,0x3850,0xC7FB,
- 0x3E45,0x0000,0x0000,0x4339,0xC7FC,0xC7FD,0xC7FE,0x5E54,
- 0x0000,0x0000,0xC8A1,0xC8A2,0x0000,0x0000,0x0000,0x4D2F,
- 0xC8A3,0x0000,0x0000,0x5E57,0x0000,0x0000,0x5E50,0x4572,
- 0x0000,0x0000,0x5E53,0xC8A4,0x0000,0x0000,0x5E59,0x0000,
- 0x0000,0x0000,0x0000,0xC8A5,0x0000,0xC8A6,0x4F51,0x3C3E,
- 0x4B7E,0x0000,0x5E63,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x482E,0xC8A7,0x0000,0x5E6F,
- 0x383B,0x0000,0x0000,0xC8A8,0x0000,0x0000,0x3D60,0x0000,
- 0x5E65,0xC8A9,0x0000,0x0000,0x4E2F,0x3942,0x0000,0x5E72,
- 0xC8AA,0x0000,0x306E,0x0000,0x0000,0x5E70,0x0000,0xC8AB,
- 0x0000,0x0000,0x5E64,0x0000,0x0000,0xC8AC,0xC8AD,0x5E6A,
- 0x0000,0xC8AE,0x5E6C,0xC8AF,0x0000,0x0000,0x4D4F,0x5E67,
- 0x0000,0x0000,0x452E,0xC8B0,0x0000,0x5E69,0x0000,0xC8B1,
- 0xC8B2,0xC8B3,0x5E71,0xC8B4,0x5E6B,0x4C47,0x0000,0xC8B5,
- 0xC8B6,0x5E66,0xC8B7,0x3C22,0x5E7E,0xC8B8,0xC8B9,0xC8BA,
- 0x0000,0x336A,0x0000,0x5E68,0x5E6D,0x5E6E,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x426C,0x425A,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xC8BB,0x5E76,0xC8BC,0xC8BD,0x5E7C,
- 0x0000,0x0000,0x5E7A,0x0000,0x4529,0x0000,0x0000,0x5F23,
- 0x5E77,0xC8BE,0x0000,0xC8BF,0x0000,0xC8C0,0x5E78,0x5E60,
-
- /* 6F00h */
- 0x0000,0x3579,0x493A,0x0000,0xC8C1,0x0000,0x3C3F,0x0000,
- 0xC8C2,0x3977,0xC8C3,0x0000,0xC8C4,0xC8C5,0x0000,0x4F33,
- 0x0000,0x5E74,0x0000,0x5F22,0x3169,0x4166,0xC8C6,0x0000,
- 0xC8C7,0x0000,0xC8C8,0xC8C9,0x0000,0x0000,0x0000,0x0000,
- 0x4779,0x0000,0x3441,0x4E7A,0x0000,0x0000,0xC8CA,0x0000,
- 0x0000,0xC8CB,0xC8CC,0x4C21,0x4452,0xC8D3,0x0000,0xC8CD,
- 0xC8CE,0x5E7B,0x5E7D,0xC8CF,0x0000,0x0000,0xC8D0,0x0000,
- 0x4132,0x0000,0x0000,0xC8D1,0xC8D2,0x0000,0x5F21,0x5E79,
- 0x0000,0x5E73,0x0000,0x0000,0x0000,0x3443,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xC8D4,
- 0x0000,0xC8D5,0xC8D6,0xC8D7,0x3769,0x0000,0x0000,0xC8D8,
- 0x5F2F,0xC8D9,0xC8DA,0x5F2A,0x4078,0xC8DB,0xC8DC,0x3363,
- 0x0000,0xC8DD,0xC8DE,0x0000,0x3D61,0x0000,0x5F33,0x0000,
- 0xC8DF,0x0000,0x0000,0x0000,0xC8E0,0x5F2C,0x442C,0x5F29,
- 0x4459,0x0000,0x0000,0x0000,0x5F4C,0x0000,0x0000,0x0000,
- 0x5F26,0x0000,0x5F25,0x0000,0x5F2E,0xC8E1,0xC8E2,0x0000,
- 0x5F28,0x5F27,0x5F2D,0xC8E3,0x4021,0x0000,0x5F24,0xC8E4,
- 0xC8E5,0x0000,0x0000,0xC8E6,0xC8E7,0xC8E8,0x5F30,0x0000,
- 0xC8E9,0x5F31,0xC8EA,0xC8EB,0xC8EC,0x0000,0xC8ED,0x3442,
- 0x0000,0x0000,0xC8EE,0x0000,0x0000,0x0000,0x0000,0xC8EF,
- 0xC8F0,0x5F36,0x0000,0x5F35,0x5F37,0xC8F1,0xC8F2,0xC8F3,
- 0xC8F4,0x0000,0x5F3A,0x0000,0x0000,0x0000,0xC8F5,0xC8F6,
- 0xC8F7,0x4543,0x0000,0x5F34,0x0000,0xC8F8,0xC8F9,0x0000,
- 0x0000,0x5F38,0x0000,0x0000,0xC8FA,0x0000,0x0000,0x0000,
- 0x3763,0x4279,0x5F32,0x473B,0x0000,0xC8FB,0x5F39,0xC8FC,
- 0xC8FD,0x0000,0xC8FE,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x5F3E,0x5F3C,0x0000,0x0000,
- 0x5F3F,0x0000,0xC9A1,0x5F42,0x0000,0x0000,0xC9A2,0x5F3B,
- 0x396A,0x4728,0x0000,0x0000,0x5E39,0x0000,0x0000,0x0000,
- 0xC9A3,0xC9A4,0x0000,0x4D74,0x5F3D,0x0000,0x5F41,0x4275,
- 0xC9A5,0x5F40,0x0000,0x5F2B,0x0000,0xC9A6,0x6F69,0x0000,
- 0x0000,0xC9A7,0x5F45,0x0000,0xC9A8,0xC9A9,0x5F49,0x0000,
-
- /* 7000h */
- 0xC9AA,0x5F47,0x0000,0x0000,0x0000,0xC9AB,0xC9AC,0xC9AD,
- 0x0000,0x5F43,0x0000,0x5F44,0x0000,0xC9AE,0x0000,0x5F48,
- 0x0000,0x5F46,0x0000,0x0000,0x0000,0x494E,0x0000,0xC9AF,
- 0x5F4E,0x0000,0x5F4B,0x5F4A,0x0000,0x5F4D,0x4654,0x5F4F,
- 0xC9B0,0x0000,0x0000,0xC9B1,0x0000,0x0000,0x4375,0x426D,
- 0x0000,0x0000,0x0000,0x0000,0x4025,0x0000,0x0000,0xC9B2,
- 0x5F50,0x0000,0x5F52,0x0000,0xC9B3,0x0000,0x0000,0xC9B4,
- 0x0000,0xC9B5,0x0000,0x0000,0xC9B6,0x0000,0x5F51,0x0000,
- 0x0000,0x0000,0x0000,0xC9B7,0xC9B8,0x0000,0x0000,0x0000,
- 0xC9B9,0xC9BA,0xC9BB,0xC9BC,0x5E75,0x0000,0xC9C1,0x0000,
- 0x0000,0x5F53,0x0000,0x0000,0xC9BD,0xC9BE,0x0000,0x0000,
- 0x4667,0x0000,0x0000,0x0000,0x0000,0xC9BF,0xC9C0,0x0000,
- 0x0000,0x0000,0x0000,0x5F54,0xC9C2,0xC9C3,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x3250,0xC9C4,0x0000,0xC9C5,0x4574,
- 0x3325,0x0000,0x0000,0x0000,0x0000,0xC9C6,0xC9C7,0x0000,
- 0x3564,0x0000,0x0000,0x0000,0x3C5E,0x3A52,0xC9C8,0x0000,
- 0x0000,0xC9C9,0x0000,0x0000,0x0000,0xC9CA,0xC9CB,0x0000,
- 0x0000,0x4F27,0x3F66,0x0000,0x0000,0x0000,0x316A,0x0000,
- 0x0000,0x0000,0x5F56,0x0000,0xC9CC,0xC9CD,0xC9CE,0xC9CF,
- 0xC9D0,0x5F55,0x0000,0xC9D1,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0xC9D2,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xC9D3,0x5F59,0x433A,0x5F5C,0x5F57,
- 0xC9D4,0xC9D5,0x0000,0x5F5B,0xC9D6,0x0000,0x0000,0xC9D7,
- 0x5F5A,0x4540,0x3059,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x4E75,0x0000,0xC9D8,0x5F5E,0x0000,0x0000,0x0000,0x3128,
- 0x0000,0xC9D9,0x0000,0xC9DA,0xC9DB,0xC9DC,0xC9DD,0x0000,
- 0xC9DE,0x5F60,0x0000,0x0000,0xC9DF,0x5F5F,0x0000,0x5F5D,
- 0x0000,0x0000,0x0000,0x0000,0xC9E0,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x5F58,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x4B23,0xC9E1,0x0000,0x0000,0x5F62,0x0000,0x0000,
-
- /* 7100h */
- 0x0000,0x0000,0x0000,0xC9E2,0xC9E3,0xC9E4,0xC9E5,0xC9E6,
- 0x0000,0x5F61,0x0000,0xC9E7,0xC9E8,0x0000,0x0000,0xC9E9,
- 0x0000,0x0000,0x0000,0x0000,0x316B,0x0000,0x0000,0x0000,
- 0x0000,0x5F64,0x4A32,0x0000,0x5F63,0x0000,0xC9EA,0x0000,
- 0xC9EB,0x4C35,0x0000,0x0000,0x0000,0x0000,0x3E47,0x0000,
- 0x0000,0x0000,0x0000,0xC9EC,0x0000,0xC9ED,0x0000,0xC9EE,
- 0xC9EF,0xC9F0,0x0000,0x0000,0x0000,0x0000,0x4133,0x0000,
- 0xC9F1,0x0000,0x0000,0x0000,0x3E46,0x0000,0x0000,0x0000,
- 0x0000,0xC9F2,0x0000,0x0000,0x0000,0xC9F3,0xC9F4,0xC9F5,
- 0x0000,0x4E7B,0xC9F6,0xC9F7,0x5F6A,0x0000,0x4079,0x0000,
- 0xC9F8,0x0000,0xC9F9,0x0000,0x0000,0x5F66,0x5F6B,0xC9FA,
- 0x0000,0x316C,0xC9FB,0x0000,0xC9FC,0x0000,0xC9FD,0x0000,
- 0xC9FE,0x0000,0x5F69,0x0000,0x4761,0x5F65,0x5F68,0x3E48,
- 0xCAA1,0x4851,0x0000,0x0000,0x5F6C,0x0000,0x3C51,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xCAA2,0x0000,0x0000,0x0000,0x407A,0x0000,0x0000,
- 0xCAA3,0x0000,0x0000,0x0000,0x5F6F,0xCAA4,0x0000,0xCAA5,
- 0x5F67,0x0000,0x3727,0x0000,0xCAA6,0x0000,0x0000,0x5F6D,
- 0x0000,0x0000,0xCAA7,0x0000,0x4D50,0x5F70,0x0000,0x0000,
- 0x0000,0x7426,0xCAA8,0xCAA9,0x0000,0x0000,0x0000,0x3D4F,
- 0xCAAA,0x0000,0xCAAB,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x5F71,0x0000,0x0000,0x0000,0x5F72,0x0000,0x0000,0xCAAC,
- 0xCAAD,0x472E,0xCAAE,0xCAAF,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x5F74,0xCAB0,0x0000,0x0000,0x0000,0x5F75,0xCAB1,
- 0xCAB2,0xCAB3,0x0000,0x4733,0xCAB4,0x0000,0x0000,0x0000,
- 0x4575,0x5F77,0x0000,0xCAB5,0xCAB6,0x0000,0x5F79,0x0000,
- 0x4E55,0x0000,0x5F76,0xCAB7,0x5F78,0x316D,0xCAB8,0x5F73,
- 0x0000,0xCAB9,0xCABA,0x0000,0xCABB,0x0000,0x0000,0x535B,
- 0x5F7A,0x0000,0x0000,0x0000,0x0000,0x4167,0x3B38,0x5F7C,
- 0x0000,0x0000,0x0000,0x0000,0x5F7B,0x3F24,0x5259,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x5F7D,0x0000,0x0000,
- 0xCABC,0x6021,0x0000,0x5F6E,0x5F7E,0x0000,0xCABD,0x6022,
-
- /* 7200h */
- 0xCABE,0x0000,0x0000,0x0000,0x0000,0x0000,0x477A,0xCABF,
- 0xCAC0,0xCAC1,0x0000,0x0000,0x0000,0x6023,0x0000,0x0000,
- 0x6024,0x0000,0x0000,0xCAC2,0x0000,0x0000,0x0000,0xCAC3,
- 0x0000,0x0000,0xCAC4,0x6025,0x0000,0xCAC5,0x0000,0xCAC6,
- 0x0000,0x0000,0x0000,0x0000,0xCAC7,0x0000,0x0000,0x0000,
- 0x6026,0x0000,0x445E,0xCAC8,0x6028,0x6027,0x0000,0xCAC9,
- 0x6029,0x0000,0x602A,0x0000,0xCACA,0x3C5F,0x4963,0x0000,
- 0xCACB,0xCACC,0x4C6C,0x602B,0x602C,0x4156,0x3C24,0x602D,
- 0x602E,0xCACD,0xCACE,0xCACF,0x0000,0xCAD0,0x602F,0x4A52,
- 0x4847,0x0000,0x0000,0x6030,0x4757,0x0000,0xCAD1,0xCAD2,
- 0xCAD3,0x0000,0x442D,0xCAD4,0x0000,0xCAD5,0xCAD6,0x0000,
- 0x6031,0x3267,0xCAD7,0x356D,0xCAD8,0x4C46,0xCAD9,0x4C36,
- 0xCADA,0x3234,0x4F34,0xCADB,0x0000,0x0000,0x0000,0x4B52,
- 0xCADC,0x4A2A,0x0000,0xCADD,0x0000,0x0000,0xCADE,0xCADF,
- 0x0000,0xCAE0,0x4037,0x0000,0x6032,0x0000,0x0000,0xCAE1,
- 0xCAE2,0x4643,0x0000,0xCAE3,0xCAE4,0x3823,0x6033,0xCAE5,
- 0x3A54,0x6035,0x6034,0x0000,0xCAE6,0x0000,0x0000,0x6036,
- 0x0000,0xCAE7,0x0000,0x0000,0x0000,0xCAE8,0xCAE9,0x0000,
- 0x0000,0x0000,0x6037,0xCAEA,0x0000,0x0000,0x6038,0x0000,
- 0x0000,0x0000,0x0000,0xCAEB,0x0000,0x0000,0x0000,0x0000,
- 0x353E,0x0000,0x6039,0x0000,0x0000,0x0000,0x0000,0x603A,
- 0xCAEC,0x0000,0x0000,0x0000,0x3824,0xCAED,0xCAEE,0x4848,
- 0x0000,0xCAEF,0x603C,0x0000,0xCAF0,0x0000,0x3E75,0x0000,
- 0x0000,0x603B,0x0000,0x0000,0x0000,0x0000,0xCAF1,0x0000,
- 0x0000,0xCAF2,0x3638,0x603D,0x603F,0x0000,0x603E,0xCAF3,
- 0x0000,0xCAF4,0x0000,0x0000,0xCAF5,0x0000,0x6040,0x0000,
- 0x3851,0x0000,0x6041,0x0000,0x0000,0xCAF6,0xCAF7,0x3669,
- 0xCAF8,0x4140,0x0000,0x397D,0x0000,0x0000,0x0000,0xCAF9,
- 0x6043,0x6044,0x6042,0x0000,0x0000,0xCAFA,0x0000,0x0000,
- 0x0000,0x3C6D,0x0000,0x0000,0x4648,0x3639,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xCAFB,0xCAFC,0x0000,0x0000,0x6046,
- 0x432C,0x6045,0xCAFD,0xCAFE,0x4F35,0x4762,0xCBA1,0x0000,
-
- /* 7300h */
- 0x0000,0x0000,0xCBA2,0x0000,0xCBA3,0xCBA4,0x0000,0xCBA5,
- 0x0000,0x0000,0x6049,0xCBA6,0x0000,0xCBA7,0x0000,0x0000,
- 0x0000,0x0000,0xCBA8,0xCBA9,0x0000,0x0000,0x604B,0x6048,
- 0xCBAA,0xCBAB,0x0000,0x4C54,0x604A,0x604C,0xCBAC,0x4E44,
- 0x0000,0x0000,0xCBAD,0x0000,0xCBAE,0x6050,0x0000,0xCBAF,
- 0xCBB0,0x604F,0x4376,0x472D,0xCBB1,0x0000,0x3825,0x604E,
- 0x0000,0xCBB2,0xCBB3,0x0000,0x604D,0xCBB4,0x4D31,0x4D32,
- 0x0000,0x0000,0xCBB5,0xCBB6,0x0000,0xCBB7,0x6051,0x316E,
- 0x0000,0x0000,0x0000,0xCBB8,0x3976,0x3B62,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xCBB9,0x6052,0x6053,
- 0xCBBA,0x0000,0xCBBB,0x0000,0x0000,0x0000,0xCBBC,0x6055,
- 0xCBBD,0x0000,0x0000,0x0000,0x0000,0xCBBE,0xCBBF,0xCBC0,
- 0xCBC1,0x0000,0x0000,0x3D43,0x0000,0x0000,0xCBC2,0xCBC3,
- 0x6057,0xCBC4,0x6056,0xCBC5,0xCBC6,0x0000,0xCBC7,0xCBC8,
- 0x6058,0xCBC9,0x334D,0x0000,0x0000,0x605A,0x0000,0xCBCA,
- 0x6059,0xCBCB,0x605C,0x605B,0xCBCC,0x0000,0x0000,0x0000,
- 0xCBCD,0xCBCE,0x0000,0xCBCF,0x383C,0xCBD0,0xCBD1,0x4E28,
- 0x0000,0x364C,0x0000,0x3226,0x0000,0x0000,0xCBD2,0x0000,
- 0xCBD3,0x0000,0x0000,0xCBD4,0x0000,0xCBD5,0x366A,0xCBD6,
- 0xCBD7,0x0000,0x0000,0x0000,0xCBD8,0x0000,0xCBD9,0xCBDA,
- 0xCBDB,0x0000,0xCBDC,0x0000,0x0000,0xCBDD,0xCBDE,0x0000,
- 0x0000,0x3461,0xCBDF,0xCBE0,0x0000,0xCBE1,0x0000,0x0000,
- 0x0000,0x0000,0x4E68,0x605E,0x0000,0xCBE2,0x0000,0xCBE3,
- 0x0000,0xCBE4,0x0000,0x6060,0xCBE5,0xCBE6,0x0000,0xCBE7,
- 0x6061,0x0000,0x3251,0x0000,0x0000,0xCBE8,0xCBE9,0x0000,
- 0x605D,0xCBEA,0x3B39,0xCBEB,0xCBEC,0x4441,0x605F,0xCBED,
- 0x0000,0x0000,0xCBEE,0xCBEF,0x0000,0x0000,0xCBF0,0x0000,
- 0x0000,0xCBF1,0x0000,0x0000,0x0000,0xCBF2,0x6064,0x0000,
- 0x3C6E,0xCBF3,0x0000,0xCBF4,0x0000,0x6062,0xCBF5,0xCBF6,
- 0x0000,0xCBF7,0x373E,0x0000,0x0000,0x4849,0x6063,0x0000,
- 0x0000,0x607E,0x0000,0x0000,0xCBF8,0xCBF9,0x0000,0xCBFA,
- 0x6069,0xCBFB,0xCBFC,0xCBFD,0x0000,0xCBFE,0x383D,0xCCA1,
-
- /* 7400h */
- 0xCCA2,0xCCA3,0x0000,0x3565,0xCCA4,0x6066,0x4D7D,0xCCA5,
- 0x0000,0x4E30,0xCCA6,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xCCA7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xCCA8,0xCCA9,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x4276,0x0000,0xCCAA,0x6068,0xCCAB,0x0000,
- 0xCCAC,0xCCAD,0xCCAE,0xCCAF,0xCCB0,0xCCB1,0xCCB2,0xCCB3,
- 0xCCB4,0xCCB5,0x606A,0x4E56,0x3657,0x487C,0x474A,0x0000,
- 0x0000,0xCCB6,0x606B,0x0000,0x0000,0x0000,0x0000,0x606D,
- 0xCCB7,0x6070,0x0000,0xCCB8,0xCCB9,0x0000,0xCCBA,0xCCBB,
- 0x0000,0x0000,0x0000,0xCCBC,0x0000,0xCCBD,0x0000,0x0000,
- 0x0000,0xCCBE,0xCCBF,0x0000,0x0000,0x606C,0x0000,0xCCC0,
- 0x0000,0x606F,0x386A,0x314D,0x6071,0xCCC1,0x3F70,0x606E,
- 0x4E5C,0x0000,0xCCC2,0x6074,0x7424,0x0000,0xCCC3,0xCCC4,
- 0xCCC5,0x6072,0x6075,0xCCC6,0x0000,0xCCC7,0xCCC8,0x6067,
- 0x6073,0xCCC9,0xCCCA,0x3A3C,0x0000,0x0000,0x6076,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x6077,0x0000,
- 0xCCCB,0xCCCC,0x0000,0x4D7E,0x0000,0xCCCD,0xCCCE,0xCCCF,
- 0x0000,0xCCD0,0x0000,0x6078,0x0000,0x0000,0x0000,0xCCD1,
- 0xCCD2,0xCCD3,0xCCD4,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xCCD5,0xCCD6,0xCCD7,0x0000,0xCCD8,0x0000,0x6079,0xCCD9,
- 0xCCDA,0xCCDB,0x6065,0xCCDC,0x0000,0x0000,0xCCDD,0x607A,
- 0xCCDE,0xCCDF,0xCCE0,0xCCE1,0x0000,0x0000,0xCCE2,0xCCE3,
- 0x3444,0xCCE4,0xCCE5,0x0000,0x0000,0xCCE6,0x0000,0x0000,
- 0x0000,0xCCE7,0x0000,0xCCE8,0x0000,0x3C25,0x0000,0xCCE9,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xCCEA,0xCCEB,0x607B,0x0000,0xCCEC,0x0000,0x0000,0x607C,
- 0xCCED,0x0000,0x0000,0xCCEE,0x607D,0x0000,0x0000,0x0000,
- 0xCCEF,0x0000,0xCCF0,0xCCF1,0x313B,0x0000,0xCCF2,0xCCF3,
- 0x6121,0x0000,0x493B,0x6122,0xCCF4,0x0000,0x3424,0x6123,
- 0xCCF5,0x6124,0xCCF6,0xCCF7,0x0000,0x0000,0x6125,0xCCF8,
- 0x6127,0x6128,0x6126,0x0000,0xCCF9,0x0000,0x4953,0x612A,
- 0x6129,0x0000,0xCCFA,0xCCFB,0xCCFC,0x0000,0x0000,0xCCFD,
-
- /* 7500h */
- 0x0000,0x0000,0x0000,0x612C,0x612B,0x612D,0xCCFE,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x612E,0x6130,0x612F,0x0000,
- 0x0000,0x3979,0xCDA1,0x6132,0x0000,0x6131,0xCDA2,0xCDA3,
- 0x3445,0x0000,0x3F53,0x0000,0x453C,0x0000,0x6133,0x4038,
- 0xCDA4,0xCDA5,0x0000,0x3B3A,0xCDA6,0x3179,0x6134,0xCDA7,
- 0x4D51,0xCDA8,0xCDA9,0x4A63,0x6135,0x0000,0x0000,0xCDAA,
- 0x4544,0x4D33,0x3943,0x3F3D,0x0000,0x0000,0xCDAB,0x434B,
- 0x5234,0xCDAC,0x442E,0x3268,0x6136,0xCDAD,0xCDAE,0xCDAF,
- 0xCDB0,0x0000,0x0000,0xCDB1,0x6137,0x0000,0x613C,0xCDB2,
- 0xCDB3,0x613A,0x6139,0x5A42,0x3326,0x6138,0xCDB4,0x305A,
- 0xCDB5,0x482A,0xCDB6,0x0000,0x484A,0x0000,0x0000,0xCDB7,
- 0x0000,0x4E31,0x613D,0x613B,0x435C,0x4026,0xCDB8,0xCDB9,
- 0x482B,0xCDBA,0x492D,0x0000,0x613F,0x4E2C,0x374D,0x6140,
- 0x0000,0x613E,0x4856,0x6141,0x0000,0x6142,0x0000,0xCDBB,
- 0x305B,0xCDBC,0x0000,0x3E76,0x6147,0x0000,0x6144,0x466D,
- 0x6143,0xCDBD,0xCDBE,0xCDBF,0xCDC0,0xCDC1,0xCDC2,0x3526,
- 0x0000,0xCDC3,0x614A,0x0000,0x0000,0xCDC4,0x6145,0x6146,
- 0x0000,0x6149,0x6148,0x4925,0x0000,0x0000,0x4142,0x4141,
- 0xCDC5,0x353F,0xCDC6,0xCDC7,0x614B,0xCDC8,0x0000,0x0000,
- 0x0000,0xCDC9,0x614C,0x0000,0xCDCA,0x614D,0x0000,0x0000,
- 0x0000,0x0000,0xCDCB,0x614F,0xCDCC,0x614E,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x3156,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x6157,0x4868,0x6151,0xCDCD,0x6153,0x0000,0x0000,
- 0x6155,0x3F3E,0xCDCE,0x0000,0x6156,0x6154,0x3C40,0xCDCF,
- 0xCDD0,0xCDD1,0x6150,0x6152,0xCDD2,0x4942,0xCDD3,0x3E49,
- 0x0000,0x0000,0x6159,0x0000,0xCDD4,0x6158,0xCDD5,0xCDD6,
- 0x0000,0x0000,0x615A,0x0000,0x3C26,0x3A2F,0x0000,0xCDD7,
- 0x4577,0x615B,0x0000,0x444B,0xCDD8,0x0000,0x615D,0xCDD9,
- 0xCDDA,0xCDDB,0x4E21,0x615C,0xCDDC,0x0000,0x0000,0xCDDD,
- 0x0000,0x4169,0x0000,0x0000,0xCDDE,0x0000,0xCDDF,0xCDE0,
- 0x6162,0xCDE1,0x6164,0x6165,0x4354,0x0000,0x0000,0x0000,
- 0x0000,0xCDE2,0x6163,0x0000,0x6160,0x0000,0x615E,0x615F,
-
- /* 7600h */
- 0xCDE3,0x6161,0xCDE4,0xCDE5,0xCDE6,0x0000,0x0000,0xCDE7,
- 0xCDE8,0x6168,0xCDE9,0x6166,0xCDEA,0x6167,0x0000,0xCDEB,
- 0x0000,0x0000,0xCDEC,0xCDED,0x0000,0xCDEE,0xCDEF,0x0000,
- 0x0000,0xCDF0,0x0000,0xCDF1,0xCDF2,0xCDF3,0xCDF4,0x6169,
- 0x616B,0x616C,0x616D,0xCDF5,0x616E,0xCDF6,0xCDF7,0x616A,
- 0x0000,0xCDF8,0x0000,0x0000,0x0000,0xCDF9,0x0000,0x0000,
- 0x6170,0x0000,0xCDFA,0xCDFB,0x616F,0xCDFC,0x0000,0x0000,
- 0xCDFD,0xCDFE,0xCEA1,0x6171,0xCEA2,0x0000,0x0000,0x0000,
- 0xCEA4,0xCEA5,0x4E45,0xCEA6,0xCEA7,0xCEA8,0x6174,0x6172,
- 0x6173,0xCEA9,0xCEA3,0xCEAA,0x3462,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x4C7E,0x0000,0x0000,0xCEAB,0x4A4A,0x0000,
- 0x6176,0xCEAC,0x0000,0x0000,0x6175,0x0000,0x0000,0xCEAD,
- 0x0000,0x6177,0x6178,0x0000,0xCEAE,0xCEAF,0x0000,0x617C,
- 0x6179,0x617A,0x617B,0x0000,0x617D,0xCEB0,0xCEB1,0xCEB2,
- 0x617E,0xCEB3,0x6221,0x0000,0xCEB4,0x0000,0x6222,0x0000,
- 0x6223,0x0000,0x482F,0x4550,0x6224,0x4772,0x4934,0x0000,
- 0x6225,0xCEB5,0x0000,0x6226,0x452A,0xCEB6,0x3327,0x3944,
- 0x6227,0x0000,0x0000,0x6228,0xCEB7,0xCEB8,0x6229,0x0000,
- 0x3B29,0x0000,0x0000,0x622B,0x0000,0xCEB9,0x622A,0x0000,
- 0x0000,0x622C,0x622D,0xCEBA,0xCEBB,0xCEBC,0x0000,0xCEBD,
- 0xCEBE,0x0000,0xCEBF,0xCEC0,0xCEC1,0xCEC2,0xCEC3,0xCEC4,
- 0xCEC5,0x0000,0xCEC6,0x0000,0x0000,0xCEC7,0x4869,0x0000,
- 0x622E,0x0000,0x0000,0x0000,0x622F,0x0000,0x0000,0x7369,
- 0x6230,0x6231,0x6232,0x0000,0x0000,0xCEC8,0x0000,0x3B2E,
- 0x0000,0xCEC9,0x6233,0x4756,0x0000,0xCECA,0x4B5F,0x0000,
- 0x314E,0xCECB,0x3157,0xCECC,0xCECD,0x6234,0xCECE,0x0000,
- 0x0000,0x0000,0x6236,0x0000,0xCECF,0x0000,0x6235,0x4570,
- 0x0000,0xCED0,0x0000,0x4039,0x5D39,0x0000,0x6237,0x4C41,
- 0xCED1,0x6238,0x0000,0x3446,0x4857,0x6239,0xCED2,0x623A,
- 0xCED3,0x0000,0x623B,0x0000,0xCED4,0x0000,0x4C5C,0x0000,
- 0xCED5,0xCED6,0x4C55,0x0000,0x443E,0x0000,0xCED7,0x0000,
- 0x416A,0xCED8,0x0000,0x623D,0xCED9,0x0000,0x3D62,0x0000,
-
- /* 7700h */
- 0xCEDA,0x3E4A,0x0000,0x0000,0x6240,0x0000,0xCEDB,0x623F,
- 0x623E,0x487D,0xCEDC,0x3447,0x3829,0x0000,0xCEDD,0x0000,
- 0x0000,0x0000,0xCEDE,0x0000,0xCEDF,0xCEE0,0x0000,0xCEE1,
- 0x0000,0xCEE2,0xCEE3,0x6246,0xCEE4,0x0000,0x6243,0x3F3F,
- 0x4C32,0x0000,0xCEE5,0x0000,0x6242,0x6244,0x6245,0x0000,
- 0xCEE6,0x6241,0x0000,0x0000,0x0000,0xCEE7,0xCEE8,0xCEE9,
- 0x0000,0x0000,0x0000,0x0000,0xCEEA,0xCEEB,0xCEEC,0x6247,
- 0x6248,0xCEED,0x442F,0x0000,0x3463,0xCEEE,0xCEEF,0x0000,
- 0x4365,0x0000,0xCEF0,0x0000,0x0000,0xCEF1,0xCEF2,0x6249,
- 0x0000,0x0000,0xCEF3,0x0000,0x0000,0xCEF4,0xCEF5,0xCEF6,
- 0x0000,0x0000,0xCEF7,0x0000,0x0000,0x0000,0xCEF8,0xCEF9,
- 0x0000,0x0000,0x624A,0x624D,0xCEFA,0x0000,0xCEFB,0xCEFC,
- 0xCEFD,0x3F67,0xCEFE,0x4644,0xCFA1,0x624E,0x4B53,0xCFA2,
- 0x624B,0x0000,0xCFA3,0x624C,0xCFA4,0x0000,0x0000,0x0000,
- 0xCFA5,0x0000,0xCFA6,0xCFA7,0xCFA8,0x0000,0x0000,0x0000,
- 0x0000,0x6251,0xCFA9,0x0000,0x0000,0xCFAA,0x6250,0x624F,
- 0xCFAB,0x0000,0x0000,0x0000,0xCFAC,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x6253,0xCFAD,0xCFAE,0x6252,0x0000,
- 0x0000,0x6254,0x0000,0x0000,0xCFAF,0xCFB0,0xCFB1,0x0000,
- 0x0000,0x0000,0xCFB2,0x0000,0x0000,0x0000,0x6256,0xCFB3,
- 0x6255,0x0000,0xCFB4,0x0000,0x0000,0x4A4D,0x0000,0xCFB5,
- 0x0000,0x0000,0xCFB6,0x0000,0x3D56,0x4E46,0xCFB7,0xCFB8,
- 0x6257,0xCFB9,0x0000,0x4637,0x0000,0xCFBA,0x6258,0x0000,
- 0x0000,0x6259,0x0000,0x625D,0x625B,0x625C,0xCFBB,0x625A,
- 0x0000,0x0000,0x0000,0xCFBC,0x0000,0x0000,0x0000,0x625E,
- 0x0000,0xCFBD,0x0000,0x0000,0x0000,0x625F,0x0000,0x0000,
- 0x0000,0xCFBE,0xCFBF,0x0000,0x0000,0xCFC0,0x0000,0x6260,
- 0x0000,0xCFC1,0x6261,0x4C37,0x6262,0x0000,0xCFC2,0xCFC3,
- 0xCFC4,0x0000,0x4C70,0x6263,0xCFC5,0x434E,0xCFC6,0x476A,
- 0x0000,0x366B,0xCFC7,0x0000,0xCFC8,0x433B,0x6264,0x363A,
- 0xCFC9,0xCFCA,0x0000,0x4050,0xCFCB,0x0000,0x0000,0x0000,
- 0xCFCC,0x0000,0x0000,0xCFCD,0x6265,0x0000,0x0000,0x0000,
-
- /* 7800h */
- 0x0000,0x0000,0x3A3D,0x0000,0x0000,0xCFCE,0xCFCF,0x0000,
- 0x0000,0xCFD0,0x0000,0x0000,0x6266,0xCFD1,0xCFD2,0x0000,
- 0x0000,0xCFD3,0x6267,0x0000,0x3826,0x3A55,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xCFD4,0x0000,0x0000,
- 0x6269,0xCFD5,0xCFD6,0xCFD7,0x0000,0x4556,0x3A56,0x354E,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xCFD8,0xCFD9,0x0000,
- 0xCFDA,0x0000,0x4B24,0x0000,0x474B,0xCFDB,0x0000,0xCFDC,
- 0x0000,0x0000,0x4557,0x0000,0x0000,0x0000,0x0000,0x395C,
- 0x0000,0x0000,0x0000,0xCFDD,0xCFDE,0x626B,0x0000,0xCFDF,
- 0xCFE0,0x0000,0x0000,0x0000,0xCFE1,0x0000,0xCFE2,0x0000,
- 0x0000,0x0000,0xCFE3,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0xCFE4,0x3E4B,0xCFE5,0x0000,
- 0xCFE6,0xCFE7,0x0000,0xCFE8,0xCFE9,0x0000,0x0000,0x0000,
- 0xCFEA,0x0000,0xCFEB,0x4E32,0x3945,0x0000,0xCFEC,0x3827,
- 0x0000,0x0000,0x4823,0x0000,0x626D,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xCFED,0x0000,0x626F,0x0000,0xCFEE,0x0000,
- 0x0000,0x386B,0x0000,0x0000,0x0000,0x0000,0x626E,0x4476,
- 0x0000,0x0000,0xCFEF,0x0000,0x6271,0x3337,0x626C,0xCFF0,
- 0x0000,0x486A,0x0000,0x3130,0xCFF1,0x3A6C,0x0000,0x4F52,
- 0xCFF2,0x0000,0x6270,0x0000,0x0000,0xCFF4,0xCFF5,0xCFF6,
- 0x0000,0xCFF3,0x0000,0x6272,0xCFF7,0x0000,0x0000,0x4A4B,
- 0xCFF8,0x4059,0x6274,0x0000,0xCFF9,0xCFFA,0x0000,0x6275,
- 0xCFFB,0xCFFC,0xCFFD,0xCFFE,0x0000,0x6273,0x0000,0x0000,
- 0x0000,0x0000,0x334E,0xD0A1,0x627B,0xD0A2,0x627A,0xD0A3,
- 0x0000,0x3C27,0x0000,0x0000,0x0000,0x627C,0x6277,0xD0A4,
- 0xD0A5,0xD0A6,0x627D,0x6278,0xD0A7,0x0000,0xD0A8,0x0000,
- 0x4858,0x6276,0xD0A9,0xD0AA,0x6279,0xD0AB,0xD0AC,0x0000,
- 0x0000,0x0000,0x6322,0xD0AE,0x0000,0x0000,0x0000,0xD0AF,
- 0xD0B0,0xD0B1,0x0000,0x0000,0xD0AD,0x0000,0xD0B2,0x6321,
- 0x4B61,0x0000,0xD0B3,0x0000,0x627E,0x0000,0x0000,0x306B,
- 0x0000,0x0000,0xD0B4,0xD0B5,0x6324,0x0000,0xD0B7,0xD0B8,
- 0x0000,0x0000,0xD0B9,0xD0BA,0x0000,0x6323,0x0000,0xD0BB,
-
- /* 7900h */
- 0xD0B6,0x3E4C,0x0000,0x0000,0x0000,0x0000,0xD0BC,0x6325,
- 0x0000,0x0000,0x0000,0x0000,0xD0BD,0x0000,0x4143,0x0000,
- 0xD0BE,0x6327,0x6326,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x6328,0xD0BF,0x0000,0xD0C0,0x0000,0xD0C1,0xD0C2,
- 0xD0C3,0x0000,0x0000,0x0000,0x0000,0xD0C4,0x6268,0xD0C5,
- 0x0000,0xD0C6,0x626A,0x632A,0x6329,0xD0C7,0x0000,0x0000,
- 0x0000,0xD0C8,0x0000,0x0000,0xD0C9,0xD0CA,0x0000,0x0000,
- 0x0000,0x0000,0x3C28,0xD0CB,0x4E69,0xD0CC,0x3C52,0xD0CD,
- 0x632B,0x3737,0x0000,0x0000,0xD0CE,0xD0CF,0xD0D0,0x3540,
- 0x3527,0x3B63,0xD0D1,0xD0D2,0x0000,0x0000,0x0000,0xD0D3,
- 0x4D34,0xD0D4,0x0000,0x6331,0xD0D5,0x6330,0x4144,0x632D,
- 0xD0D6,0x0000,0x632F,0xD0D7,0xD0D8,0x3D4B,0x3F40,0x632E,
- 0x632C,0x0000,0x472A,0x0000,0x0000,0x3E4D,0x0000,0xD0D9,
- 0x493C,0xD0DA,0x0000,0xD0DB,0x0000,0x3A57,0x0000,0x0000,
- 0x0000,0x0000,0xD0DC,0x0000,0x0000,0x0000,0x0000,0x4578,
- 0x0000,0xD0DD,0x6332,0xD0DE,0xD0DF,0x0000,0xD0E0,0x6333,
- 0x6349,0x3658,0x0000,0x0000,0x4F3D,0x4135,0x0000,0x0000,
- 0x0000,0x0000,0x6334,0xD0E1,0xD0E2,0x3252,0x4477,0x4A21,
- 0x0000,0xD0E3,0x0000,0xD0E4,0xD0E5,0xD0E6,0xD0E7,0x0000,
- 0xD0E8,0x0000,0x0000,0xD0E9,0xD0EA,0x6335,0x0000,0x0000,
- 0x0000,0xD0EB,0x0000,0x0000,0x0000,0x0000,0x357A,0x6336,
- 0xD0EC,0xD0ED,0x6338,0xD0EE,0x0000,0x0000,0x6339,0xD0EF,
- 0x4729,0xD0F0,0x0000,0x633A,0xD0F1,0x0000,0x0000,0x0000,
- 0xD0F2,0x633B,0x633C,0xD0F3,0x0000,0x3659,0x3253,0x4645,
- 0x3D28,0x3B64,0xD0F4,0x0000,0xD0F5,0x0000,0x0000,0xD0F6,
- 0xD0F7,0x633D,0xD0F8,0x3D29,0x0000,0x0000,0x0000,0xD0F9,
- 0x0000,0x324A,0x4943,0x0000,0xD0FA,0x633E,0xD0FB,0x0000,
- 0x486B,0x0000,0xD0FC,0x0000,0x0000,0xD0FD,0xD0FE,0x4145,
- 0xD1A1,0x6341,0xD1A2,0x6342,0x4769,0xD1A3,0x3F41,0x633F,
- 0x0000,0x4361,0xD1A4,0xD1A5,0x6340,0xD1A6,0x0000,0x0000,
- 0x3E4E,0xD1A7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xD1A8,0x0000,0x0000,0x305C,0xD1A9,0x0000,0x0000,0x0000,
-
- /* 7A00h */
- 0x3529,0x0000,0xD1AA,0xD1AB,0x0000,0x0000,0x0000,0xD1AC,
- 0x6343,0xD1AD,0xD1AE,0x4478,0xD1AF,0x6344,0x4047,0x0000,
- 0x0000,0xD1B0,0x0000,0x0000,0x4C2D,0xD1B1,0x0000,0x4923,
- 0x6345,0x6346,0x4355,0xD1B2,0x4E47,0x0000,0xD1B3,0x6348,
- 0x6347,0xD1B4,0x0000,0x0000,0x0000,0x0000,0x0000,0xD1B5,
- 0x0000,0x0000,0x0000,0xD1B6,0x0000,0xD1B7,0x3C6F,0xD1B8,
- 0xD1B9,0x634A,0x3070,0x0000,0xD1BA,0xD1BB,0x0000,0x634D,
- 0xD1BC,0xD1BD,0xD1BE,0x634B,0x3254,0x374E,0x634C,0x3946,
- 0x3972,0x0000,0x4A66,0x634E,0xD1BF,0xD1C0,0x4B54,0xD1C1,
- 0xD1C2,0x6350,0x0000,0x0000,0xD1C3,0x4051,0x314F,0x323A,
- 0x302C,0x0000,0x0000,0x0000,0x0000,0xD1C4,0xD1C5,0x634F,
- 0x0000,0xD1C6,0x0000,0x0000,0xD1C7,0xD1C8,0x0000,0xD1C9,
- 0xD1CA,0x6351,0x6352,0x3E77,0x0000,0xD1CB,0x0000,0xD1CC,
- 0x0000,0x6353,0xD1CD,0x334F,0x0000,0xD1CE,0x0000,0x0000,
- 0x6355,0x0000,0x0000,0x0000,0x376A,0xD1CF,0x3566,0x0000,
- 0xD1D0,0x6356,0x3675,0x0000,0x0000,0x6357,0xD1D1,0x407C,
- 0xD1D2,0x464D,0xD1D3,0x4060,0x3A75,0xD1D4,0xD1D5,0x0000,
- 0x6358,0x0000,0xD1D6,0xD1D7,0x0000,0x0000,0x0000,0x0000,
- 0xD1D8,0xD1D9,0x4362,0x416B,0xD1DA,0x635A,0x635C,0x6359,
- 0x635B,0x0000,0x0000,0x0000,0x0000,0x0000,0xD1DB,0x3722,
- 0xD1DC,0x0000,0x0000,0xD1DD,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x635D,0x3726,0x0000,0xD1DE,0x0000,0x3567,0x4D52,
- 0x635F,0x0000,0x0000,0xD1DF,0x0000,0xD1E0,0x6360,0x0000,
- 0x0000,0xD1E1,0x312E,0xD1E2,0xD1E3,0x0000,0x0000,0x6363,
- 0x0000,0x0000,0x0000,0x3376,0x6362,0x6361,0xD1E4,0x6365,
- 0x635E,0xD1E5,0x6366,0x4E29,0xD1E6,0x6367,0xD1E7,0x6368,
- 0x0000,0xD1E8,0x5474,0x636A,0x0000,0x6369,0x0000,0x0000,
- 0x0000,0x636B,0x636C,0xD1E9,0x4E35,0x636D,0x0000,0x706F,
- 0x3E4F,0x636E,0x636F,0x3D57,0x0000,0x4638,0x6370,0x0000,
- 0xD1EA,0xD1EB,0x4328,0xD1EC,0xD1ED,0x6371,0x0000,0x433C,
- 0x6372,0xD1EE,0x0000,0x0000,0xD1EF,0x0000,0x3625,0x0000,
- 0x513F,0x435D,0x3C33,0xD1F0,0x0000,0xD1F1,0xD1F2,0x3448,
-
- /* 7B00h */
- 0x0000,0x0000,0x6373,0x0000,0x6422,0x0000,0x6376,0xD1F3,
- 0x3568,0x0000,0x6375,0x6424,0x0000,0x0000,0x0000,0x6374,
- 0x0000,0x3E50,0x0000,0x0000,0xD1F4,0x0000,0x0000,0x0000,
- 0x6378,0x6379,0x0000,0x452B,0x0000,0x0000,0x637A,0xD1F5,
- 0x335E,0x0000,0x0000,0xD1F6,0x0000,0x3F5A,0x4964,0xD1F7,
- 0x637C,0xD1F8,0xD1F9,0xD1FA,0x4268,0xD1FB,0xD1FC,0xD1FD,
- 0xD1FE,0xD2A1,0x0000,0x6377,0xD2A2,0x637B,0x637D,0x0000,
- 0x0000,0x3A7B,0x0000,0x0000,0x0000,0xD2A3,0x0000,0xD2A4,
- 0xD2A5,0xD2A6,0x0000,0x0000,0x0000,0x6426,0x492E,0xD2A7,
- 0x4826,0x4579,0x0000,0x365A,0x6425,0x6423,0xD2A8,0x4835,
- 0x637E,0x435E,0x457B,0x0000,0x457A,0xD2A9,0x3A76,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x6438,0x0000,0x0000,
- 0xD2AA,0x0000,0x0000,0x0000,0xD2AB,0x6428,0xD2AC,0x642A,
- 0x0000,0xD2AD,0xD2AE,0x0000,0x642D,0xD2AF,0x642E,0xD2B0,
- 0x642B,0x642C,0xD2B1,0xD2B2,0x6429,0x6427,0x0000,0xD2B3,
- 0x0000,0x0000,0x6421,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0xD2B4,0x0000,0x4A4F,0x3255,
- 0x0000,0xD2B5,0x0000,0x6435,0x0000,0x6432,0xD2B6,0x6437,
- 0xD2B7,0xD2B8,0x6436,0x0000,0x4773,0x4C27,0xD2B9,0x3B3B,
- 0x6430,0x6439,0x6434,0xD2BA,0x6433,0x642F,0xD2BB,0x6431,
- 0xD2BC,0x3449,0x0000,0x0000,0x0000,0xD2BD,0x0000,0x0000,
- 0x0000,0x0000,0x433D,0x0000,0xD2BE,0x407D,0x0000,0xD2BF,
- 0xD2C0,0x4822,0xD2C1,0x0000,0x643E,0xD2C2,0xD2C3,0x0000,
- 0x4824,0x0000,0xD2C4,0xD2C5,0xD2C6,0xD2C7,0x0000,0x0000,
- 0x4061,0x643B,0xD2C8,0x0000,0x484F,0xD2C9,0x643F,0x4A53,
- 0xD2CA,0x435B,0xD2CB,0x643A,0x643C,0x0000,0x0000,0x643D,
- 0x0000,0x0000,0x0000,0x0000,0xD2CC,0x0000,0xD2CD,0xD2CE,
- 0x0000,0xD2CF,0xD2D0,0xD2D1,0x0000,0x6440,0x0000,0x0000,
- 0x3C44,0x0000,0x0000,0x0000,0x4646,0x6445,0x6444,0x0000,
- 0xD2D2,0x6441,0xD2D3,0x0000,0x0000,0x4F36,0x0000,0x0000,
- 0x0000,0x0000,0xD2D4,0x644A,0xD2D5,0xD2D6,0x644E,0x644B,
- 0xD2D7,0xD2D8,0xD2D9,0x0000,0xD2DA,0x0000,0xD2DB,0x0000,
-
- /* 7C00h */
- 0x6447,0xD2DC,0xD2DD,0xD2DE,0xD2DF,0x0000,0xD2E0,0x6448,
- 0x0000,0xD2E1,0x0000,0xD2E2,0xD2E3,0x644D,0xD2E4,0xD2E5,
- 0x0000,0x6442,0x5255,0x6449,0x6443,0x0000,0x0000,0x644C,
- 0x0000,0xD2E6,0x0000,0xD2E7,0x0000,0x0000,0x0000,0x6452,
- 0xD2E8,0x344A,0x0000,0x644F,0x0000,0xD2E9,0xD2EA,0x6450,
- 0xD2EB,0x0000,0x6451,0x6454,0xD2EC,0x0000,0x0000,0x0000,
- 0x0000,0xD2ED,0x0000,0xD2EE,0xD2EF,0x0000,0xD2F0,0x6453,
- 0x4876,0xD2F1,0xD2F2,0x0000,0x0000,0x6455,0x4E7C,0x4A6D,
- 0x645A,0x0000,0x0000,0x6457,0x0000,0x0000,0xD2F3,0x0000,
- 0x0000,0x0000,0xD2F4,0x0000,0x6456,0x4052,0x0000,0x6459,
- 0x645B,0xD2F6,0xD2F7,0xD2F8,0x6458,0xD2F5,0x645F,0x0000,
- 0x645C,0xD2F9,0xD2FA,0xD2FB,0xD2FC,0xD2FD,0xD2FE,0x645D,
- 0x6446,0xD3A1,0x0000,0xD3A2,0x645E,0x6460,0x0000,0xD3A3,
- 0x0000,0xD3A4,0x0000,0x0000,0x6461,0xD3A5,0xD3A6,0x0000,
- 0xD3A7,0x0000,0xD3A8,0x4A46,0x0000,0x6462,0x0000,0x0000,
- 0x0000,0xD3A9,0x0000,0x0000,0xD3AA,0xD3AB,0x4C62,0x0000,
- 0x0000,0x364E,0x3729,0x6463,0x0000,0x0000,0xD3AC,0xD3AD,
- 0x0000,0x4A34,0x0000,0x3F68,0x0000,0x4C30,0x0000,0xD3AE,
- 0x6464,0x0000,0x4E33,0x0000,0xD3AF,0x4774,0x0000,0x4146,
- 0x4734,0x0000,0x0000,0x3D4D,0x0000,0x0000,0xD3B0,0x3040,
- 0xD3B1,0x6469,0x6467,0x0000,0x6465,0x3421,0xD3B2,0x3E51,
- 0x646A,0x0000,0x0000,0x6468,0x0000,0x6466,0x646E,0x0000,
- 0xD3B3,0x646D,0x646C,0x646B,0x0000,0x0000,0xD3B4,0xD3B5,
- 0x0000,0x646F,0xD3B6,0xD3B7,0xD3B8,0x6470,0x403A,0xD3B9,
- 0x6471,0x0000,0x6473,0x0000,0xD3BA,0x6472,0x0000,0xD3BB,
- 0xD3BC,0xD3BD,0x3852,0x0000,0x0000,0xD3BE,0x4138,0xD3BF,
- 0x0000,0x0000,0x6475,0xD3C0,0xD3C1,0xD3C2,0x457C,0xD3C3,
- 0x6474,0xD3C4,0xD3C5,0x0000,0x6476,0xD3C6,0x4A35,0x416C,
- 0x3947,0x0000,0x6477,0x0000,0x0000,0x0000,0xD3C7,0x4E48,
- 0x0000,0xD3C8,0x0000,0xD3C9,0x0000,0x0000,0x0000,0x6479,
- 0x0000,0x0000,0x647A,0x0000,0x647B,0xD3CA,0x647C,0x0000,
- 0x3B65,0x0000,0x647D,0x374F,0x0000,0x0000,0x356A,0x0000,
-
- /* 7D00h */
- 0x352A,0x0000,0x6521,0xD3CB,0x4C73,0x3948,0x647E,0xD3CC,
- 0xD3CD,0xD3CE,0x6524,0x4C66,0x0000,0x473C,0x0000,0xD3CF,
- 0x4933,0xD3D0,0xD3D1,0xD3D2,0x3D63,0x6523,0xD3D3,0x3C53,
- 0x3949,0x3B66,0x3569,0x4A36,0x6522,0xD3D4,0xD3D5,0x0000,
- 0x4147,0x4B42,0x3A77,0xD3D6,0x0000,0x0000,0xD3D7,0x0000,
- 0x0000,0x0000,0xD3D8,0x3B67,0x445D,0xD3D9,0x6527,0x4E5F,
- 0x3A59,0xD3DA,0x6528,0x3F42,0x0000,0x652A,0x0000,0x0000,
- 0x0000,0x3E52,0x3A30,0x0000,0xD3DB,0xD3DC,0xD3DD,0x6529,
- 0xD3DE,0xD3DF,0x3D2A,0x383E,0x4148,0x6525,0x652B,0xD3E0,
- 0xD3E1,0x0000,0x0000,0x6526,0x3750,0xD3E2,0x652E,0x6532,
- 0x376B,0xD3E3,0x0000,0xD3E4,0x0000,0x0000,0x652D,0xD3E5,
- 0x0000,0xD3E6,0xD3E7,0x6536,0xD3E8,0xD3E9,0x394A,0x0000,
- 0x0000,0x4D6D,0x303C,0x6533,0x0000,0xD3EA,0x356B,0xD3EB,
- 0x6530,0x0000,0xD3EC,0x0000,0x0000,0x0000,0x6531,0x0000,
- 0xD3ED,0x457D,0x652F,0x652C,0x0000,0x3328,0x4064,0x0000,
- 0xD3EE,0x3828,0xD3EF,0xD3F0,0x0000,0x6538,0x0000,0xD3F1,
- 0x0000,0xD3F2,0xD3F3,0xD3F4,0x0000,0xD3F5,0xD3F6,0x0000,
- 0xD3F7,0x6535,0x0000,0xD3F8,0xD3F9,0xD3FA,0x0000,0x6537,
- 0x0000,0xD3FB,0x0000,0x6534,0x0000,0x0000,0xD3FC,0xD3FD,
- 0x0000,0x3751,0x4233,0x6539,0x416E,0xD3FE,0xD4A1,0x6546,
- 0x0000,0x0000,0x6542,0x653C,0x0000,0x0000,0xD4A2,0xD4A3,
- 0x0000,0x0000,0xD4A4,0x6540,0x3C7A,0x305D,0x653B,0x6543,
- 0x6547,0x394B,0x4C56,0xD4A5,0x4456,0x653D,0xD4A6,0xD4A7,
- 0x6545,0xD4A8,0x653A,0x433E,0x0000,0x653F,0x303D,0x4C4A,
- 0x0000,0x0000,0xD4A9,0xD4AA,0xD4AB,0xD4AC,0xD4AD,0x653E,
- 0x0000,0x0000,0x365B,0x486C,0xD4AE,0xD4AF,0xD4B0,0x416D,
- 0x0000,0x4E50,0x3D6F,0x0000,0x0000,0x656E,0x0000,0xD4B1,
- 0x6548,0xD4B2,0x407E,0x0000,0x6544,0x6549,0x654B,0x0000,
- 0x4479,0x654E,0xD4B4,0x0000,0x654A,0xD4B5,0xD4B6,0x0000,
- 0x4A54,0x344B,0xD4B7,0xD4B8,0x4C4B,0xD4B9,0x0000,0x305E,
- 0x0000,0xD4BA,0x654D,0x0000,0x4E7D,0xD4BB,0xD4BC,0x0000,
- 0x0000,0xD4BD,0xD4BE,0x654C,0x0000,0x0000,0x0000,0x0000,
-
- /* 7E00h */
- 0xD4B3,0x316F,0x0000,0x0000,0x466C,0x654F,0x0000,0x0000,
- 0xD4BF,0x6556,0x6550,0x6557,0x0000,0x0000,0x0000,0x0000,
- 0xD4C0,0xD4C1,0x6553,0x0000,0x0000,0xD4C2,0x0000,0xD4C3,
- 0x0000,0x0000,0x0000,0x477B,0xD4C4,0xD4C5,0x3C4A,0x6555,
- 0xD4C6,0x6552,0x6558,0x6551,0x0000,0x0000,0x3D44,0xD4C7,
- 0xD4C8,0x0000,0x0000,0x4B25,0xD4C9,0xD4CA,0x3D4C,0xD4CB,
- 0x0000,0x6554,0x6560,0xD4CC,0x0000,0x655C,0xD4CD,0x655F,
- 0x0000,0x655D,0x6561,0x655B,0x0000,0x6541,0x4053,0xD4CE,
- 0x0000,0x484B,0x0000,0x655E,0xD4CF,0xD4D0,0x6559,0xD4D1,
- 0x0000,0x0000,0x4121,0x3752,0x0000,0x3D2B,0xD4D2,0x0000,
- 0xD4D3,0x0000,0xD4D4,0x0000,0x3F25,0x4136,0x6564,0x0000,
- 0xD4D5,0x6566,0x6567,0x0000,0x0000,0x6563,0x6565,0xD4D6,
- 0x0000,0xD4D7,0xD4D8,0x0000,0x0000,0xD4D9,0x655A,0x6562,
- 0x0000,0x656A,0x6569,0xD4DA,0x0000,0x4B7A,0xD4DB,0xD4DC,
- 0x372B,0x0000,0x0000,0xD4DD,0x0000,0x0000,0x0000,0x0000,
- 0xD4DE,0x6568,0x0000,0x656C,0x656B,0x656F,0xD4DF,0x6571,
- 0x0000,0xD4E0,0x3B3C,0x656D,0x0000,0x0000,0xD4E1,0xD4E2,
- 0x6572,0x6573,0xD4E3,0x0000,0x6574,0xD4E4,0x657A,0x453B,
- 0x6576,0xD4E5,0x6575,0x6577,0x6578,0xD4E6,0x6579,0x0000,
- 0xD4E7,0x0000,0xD4E8,0x657B,0x657C,0xD4E9,0xD4EA,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 7F00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x344C,0x0000,
- 0x657D,0x0000,0x657E,0xD4EC,0xD4EB,0xD4ED,0xD4EE,0xD4EF,
- 0x0000,0x0000,0x0000,0xD4F0,0xD4F1,0x6621,0x0000,0xD4F2,
- 0x0000,0x0000,0x0000,0x0000,0x6622,0x6623,0x6624,0xD4F3,
- 0x6625,0x6626,0xD4F4,0xD4F5,0x6628,0x6627,0x0000,0x0000,
- 0x6629,0x0000,0x0000,0xD4F6,0xD4F7,0xD4F8,0x0000,0x662A,
- 0x662B,0xD4F9,0x0000,0xD4FA,0xD4FB,0xD4FC,0xD4FD,0x662E,
- 0x662C,0x662D,0x3A61,0x3753,0x0000,0xD4FE,0x4356,0x0000,
- 0x4833,0xD5A1,0x3D70,0x0000,0x0000,0x474D,0x0000,0x486D,
- 0x662F,0x586D,0x0000,0x0000,0x0000,0xD5A2,0xD5A3,0xD5A4,
- 0xD5A5,0x0000,0x6630,0x6632,0x0000,0x4D65,0x6631,0x6634,
- 0x6633,0x0000,0x4D53,0xD5A6,0x6635,0xD5A7,0x487E,0xD5A8,
- 0xD5A9,0xD5AA,0x0000,0x0000,0x6636,0x0000,0xD5AB,0xD5AC,
- 0x0000,0x0000,0x6639,0x0000,0xD5AD,0x6638,0x6637,0x0000,
- 0x0000,0xD5AE,0xD5AF,0x663A,0x3732,0x0000,0xD5B0,0x0000,
- 0x4122,0x3541,0xD5B1,0x0000,0x0000,0xD5B2,0x663E,0x663B,
- 0x0000,0x0000,0x663C,0x0000,0xD5B3,0x0000,0x663F,0x0000,
- 0x6640,0x663D,0x0000,0x0000,0xD5B4,0x3129,0x0000,0xD5B5,
- 0xD5B6,0x3227,0x0000,0xD5B7,0x0000,0x6642,0x6643,0x0000,
- 0xD5B8,0x0000,0x6644,0x0000,0x4D62,0x0000,0xD5B9,0xD5BA,
- 0x0000,0x0000,0x3D2C,0x0000,0x6646,0x6645,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xD5BB,0x0000,0x0000,0x0000,0xD5BC,
- 0x3F69,0x6647,0x0000,0xD5BD,0x0000,0xD5BE,0x6648,0x0000,
- 0xD5BF,0x6649,0x0000,0x3465,0xD5C0,0x0000,0xD5C1,0xD5C2,
- 0x344D,0x0000,0xD5C3,0x664A,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x664B,0xD5C4,0x4B5D,0x4D63,0xD5C5,0xD5C6,0xD5C7,
-
- /* 8000h */
- 0x4D54,0x4F37,0x0000,0x394D,0x664E,0x3C54,0x664D,0xD5C8,
- 0xD5C9,0x0000,0xD5CA,0x664F,0x3C29,0xD5CB,0xD5CC,0xD5CD,
- 0x4251,0xD5CE,0x6650,0xD5CF,0xD5D0,0x394C,0xD5D1,0x4C57,
- 0x6651,0x6652,0x0000,0x0000,0x6653,0xD5D2,0xD5D3,0xD5D4,
- 0xD5D5,0x6654,0x0000,0x0000,0xD5D6,0x0000,0xD5D7,0x0000,
- 0x6655,0x0000,0x0000,0x0000,0xD5D8,0x0000,0xD5D9,0x0000,
- 0xD5DA,0x0000,0x0000,0x3C2A,0xD5DB,0xD5DC,0x4C6D,0xD5DD,
- 0x0000,0xD5DE,0xD5DF,0x6657,0xD5E0,0x433F,0xD5E1,0x6656,
- 0xD5E2,0x0000,0x0000,0x0000,0xD5E3,0x0000,0x6659,0x0000,
- 0x0000,0x0000,0x6658,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x665A,0x0000,0x0000,0x0000,0x403B,0x0000,
- 0x665B,0x0000,0x665C,0x0000,0x0000,0x0000,0x4A39,0x665D,
- 0xD5E4,0x416F,0x665E,0x0000,0xD5E5,0x0000,0xD5E6,0x0000,
- 0x665F,0x0000,0x0000,0x0000,0x0000,0xD5E7,0x0000,0x4E7E,
- 0x6662,0xD5E8,0x6661,0x6660,0x4430,0xD5E9,0x6663,0x3F26,
- 0x0000,0x6664,0x0000,0x0000,0x0000,0x6665,0x4F38,0x6666,
- 0x0000,0xD5EA,0x0000,0x0000,0x6667,0x6669,0x6668,0x4825,
- 0xD5EB,0x4679,0x0000,0x4F3E,0x4829,0x0000,0xD5EC,0x0000,
- 0x0000,0x0000,0x0000,0x666B,0x0000,0x0000,0x3E53,0x0000,
- 0x492A,0x0000,0x666C,0x666A,0xD5ED,0x344E,0xD5EE,0x0000,
- 0x0000,0x3854,0x3B68,0x0000,0x0000,0x486E,0xD5EF,0xD5F0,
- 0x0000,0x382A,0x4B43,0xD5F1,0x666F,0x666D,0x0000,0x394E,
- 0x0000,0x394F,0x3069,0x0000,0x3A68,0x0000,0x0000,0x0000,
- 0xD5F2,0xD5F3,0x4759,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x305F,0x6674,0x0000,0x4340,0x0000,
- 0xD5F4,0x0000,0x0000,0x0000,0x4758,0xD5F5,0x425B,0xD5F6,
- 0x0000,0x0000,0xD5F7,0x0000,0xD5F8,0xD5F9,0x6676,0xD5FA,
- 0xD5FB,0x6672,0x6675,0x6670,0x0000,0x6673,0x4B26,0x0000,
- 0xD5FC,0x3855,0x0000,0x0000,0x307D,0x6671,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xD5FD,0xD5FE,0x6678,
- 0xD6A1,0x6679,0xD6A2,0xD6A3,0x4639,0x0000,0xD6A4,0x0000,
- 0x363B,0xD6A5,0xD6A6,0x0000,0x6726,0x473D,0xD6A7,0x0000,
-
- /* 8100h */
- 0x0000,0x0000,0x3B69,0xD6A8,0x0000,0x363C,0x4048,0x4F46,
- 0x4C2E,0x6677,0x4054,0xD6A9,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xD6AA,0xD6AB,
- 0xD6AC,0x0000,0x3553,0x667A,0xD6AD,0x0000,0xD6AE,0x0000,
- 0xD6AF,0x0000,0x0000,0x667C,0xD6B0,0x0000,0x0000,0xD6B1,
- 0x0000,0x667B,0x0000,0x0000,0xD6B2,0x0000,0x0000,0x667D,
- 0xD6B3,0x4326,0x0000,0x473E,0x0000,0xD6B4,0x0000,0x0000,
- 0x0000,0x4431,0xD6B5,0x0000,0xD6B6,0x0000,0x6723,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xD6B7,0x6722,0xD6B8,
- 0x0000,0x0000,0xD6B9,0x667E,0xD6BA,0x0000,0x3F55,0x0000,
- 0x4965,0x6725,0xD6BB,0x6724,0x3950,0x4F53,0x0000,0xD6BC,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x6735,
- 0xD6BD,0xD6BE,0x0000,0x0000,0x0000,0x6729,0x672A,0xD6BF,
- 0xD6C0,0xD6C1,0x0000,0x3C70,0x0000,0xD6C2,0x6728,0xD6C3,
- 0x3978,0x6727,0x0000,0x0000,0x672B,0x0000,0x0000,0xD6C4,
- 0x4432,0x4A22,0x4123,0x0000,0x0000,0x0000,0x0000,0x425C,
- 0x672F,0xD6C5,0x6730,0x672C,0xD6C7,0xD6C8,0xD6C9,0x0000,
- 0x672D,0x0000,0x672E,0xD6CA,0x0000,0x0000,0xD6CB,0x3951,
- 0xD6C6,0x0000,0x0000,0x6736,0x0000,0x6732,0xD6CC,0x0000,
- 0xD6CD,0x0000,0x4966,0xD6CE,0x4B6C,0x4928,0xD6CF,0x0000,
- 0x6731,0x0000,0xD6D0,0x6734,0x6733,0x0000,0x0000,0x0000,
- 0x4B44,0x6737,0x0000,0x0000,0x0000,0x0000,0xD6D1,0x0000,
- 0x6738,0x0000,0xD6D2,0x4137,0xD6D3,0x6739,0x0000,0x0000,
- 0x673B,0x0000,0x673F,0xD6D4,0x0000,0x673C,0x673A,0x473F,
- 0x673D,0x0000,0x673E,0xD6D6,0x0000,0xD6D7,0x3232,0x0000,
- 0x6745,0x6740,0xD6D8,0xD6D5,0x0000,0x6741,0xD6D9,0xD6DA,
- 0x0000,0x6742,0x0000,0x4221,0x0000,0xD6DB,0x0000,0xD6DC,
- 0x6744,0x6743,0x6746,0xD6DD,0x0000,0xD6DE,0xD6DF,0x6747,
- 0x6748,0xD6E0,0x0000,0x3F43,0xD6E1,0x3269,0x0000,0x6749,
- 0x4E57,0x0000,0x3C2B,0xD6E2,0xD6E3,0x3D2D,0x0000,0x0000,
- 0xD6E4,0xD6E5,0xD6E6,0x3B6A,0x4357,0xD6E7,0xD6E8,0x0000,
- 0xD6E9,0xD6EA,0x674A,0x674B,0x3131,0xD6EB,0x674C,0xD6EC,
-
- /* 8200h */
- 0xD6ED,0x674D,0x674E,0xD6EE,0x0000,0x674F,0x0000,0x6750,
- 0x363D,0x5A2A,0x6751,0x0000,0x4065,0x6752,0x3C4B,0xD6EF,
- 0x6753,0x0000,0x5030,0xD6F0,0xD6F1,0x0000,0x6754,0x4A5E,
- 0x345C,0xD6F2,0xD6F3,0x4124,0x3D58,0xD6F4,0x4971,0x3D2E,
- 0x0000,0xD6F5,0xD6F6,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xD6F7,0x6755,0x3952,0x6756,0x484C,0x0000,0x6764,0x0000,
- 0x0000,0x0000,0xD6F8,0x6758,0xD6F9,0x4249,0x4775,0x383F,
- 0x6757,0x4125,0xD6FA,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x6759,0x0000,0x0000,0xD6FB,0xD6FC,0xD6FD,0xD6FE,0x447A,
- 0x0000,0x0000,0x0000,0xD7A1,0x0000,0x0000,0xD7A2,0xD7A3,
- 0x0000,0xD7A4,0x0000,0x0000,0x0000,0x0000,0xD7A5,0x0000,
- 0x675B,0x675A,0x675D,0x0000,0xD7A6,0x675C,0x0000,0x675E,
- 0xD7A7,0x0000,0x6760,0xD7A8,0x675F,0x0000,0x344F,0xD7A9,
- 0x6761,0x0000,0x6762,0x6763,0x0000,0xD7AA,0x3A31,0x4E49,
- 0x0000,0x6765,0x3F27,0x0000,0xD7AB,0x0000,0x3170,0x6766,
- 0x6767,0x0000,0x0000,0xD7AC,0x0000,0xD7AD,0x6768,0xD7AE,
- 0xD7AF,0xD7B0,0x0000,0xD7B1,0xD7B2,0x0000,0x0000,0xD7B3,
- 0x0000,0xD7B4,0xD7B5,0x3072,0x0000,0x6769,0xD7B6,0x0000,
- 0x0000,0xD7B7,0x676A,0x0000,0xD7B8,0x0000,0xD7B9,0x0000,
- 0xD7BA,0x4967,0xD7BB,0xD7BC,0x0000,0x3C47,0x0000,0x676C,
- 0xD7BD,0xD7BE,0x0000,0xD7BF,0xD7C0,0x3329,0x3032,0xD7C1,
- 0xD7C2,0xD7C3,0xD7C4,0x676B,0x676E,0x474E,0xD7C5,0x3F44,
- 0xD7C6,0x3256,0xD7C7,0x4B27,0xD7C8,0x0000,0x0000,0xD7C9,
- 0x375D,0x365C,0xD7CA,0x676D,0xD7CB,0x326A,0xD7CC,0xD7CD,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x3423,0xD7CE,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xD7CF,0x3171,0x6772,0x4E6A,0x425D,0xD7D0,0x0000,0x4944,
- 0x0000,0x677E,0xD7D1,0x3257,0x677C,0x0000,0x677A,0x6771,
- 0xD7D2,0x676F,0xD7D3,0x6770,0xD7D4,0x3C63,0x366C,0x4377,
- 0xD7D5,0x0000,0xD7D6,0x4651,0x0000,0xD7D7,0x0000,0xD7D8,
- 0x0000,0x3151,0x0000,0x6774,0x6773,0x0000,0xD7D9,0xD7DA,
- 0x0000,0x6779,0x6775,0x6778,0x0000,0xD7DB,0xD7DC,0x0000,
-
- /* 8300h */
- 0xD7DD,0xD7DE,0x4C50,0x6777,0x3258,0x337D,0x677B,0xD7DF,
- 0xD7E0,0x677D,0xD7E1,0xD7E2,0x0000,0x0000,0x3754,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x6823,0x682C,
- 0x682D,0x0000,0x0000,0xD7E4,0x302B,0xD7E5,0xD7E6,0xD7E7,
- 0x0000,0xD7E8,0xD7E9,0x6834,0x0000,0x0000,0x0000,0x0000,
- 0x3071,0x0000,0x0000,0x682B,0xD7EA,0xD7EB,0xD7EC,0x682A,
- 0xD7ED,0x6825,0x6824,0xD7EE,0x6822,0x6821,0x4363,0xD7EF,
- 0x427B,0x6827,0xD7F0,0x0000,0xD7F1,0xD7F2,0x0000,0x0000,
- 0x6826,0x0000,0xD7F3,0xD7F4,0xD7F5,0x6829,0x0000,0xD7F6,
- 0x0000,0x4170,0x3755,0x0000,0x0000,0xD7F7,0xD7F8,0x3141,
- 0x6828,0xD7F9,0x3953,0xD8BE,0xD7E3,0xD7FA,0xD7FB,0xD7FC,
- 0x4171,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xD7FD,0x0000,0x0000,0x683A,0x0000,0x683B,0x0000,0x3259,
- 0xD7FE,0x0000,0x0000,0x322E,0x6838,0xD8A1,0x0000,0xD8A2,
- 0xD8A3,0x0000,0xD8A4,0x0000,0xD8A5,0x682E,0xD8A6,0x6836,
- 0x0000,0x683D,0x6837,0x0000,0x0000,0xD8A7,0x6835,0x0000,
- 0x0000,0x0000,0xD8A8,0x6776,0xD8A9,0xD8AA,0x6833,0x0000,
- 0xD8AB,0xD8AC,0x682F,0xD8AD,0xD8AE,0xD8AF,0x3450,0x6831,
- 0x683C,0x0000,0x6832,0x0000,0x0000,0x0000,0xD8B0,0xD8B1,
- 0x683E,0xD8B2,0x6830,0x477C,0xD8B3,0xD8CC,0x0000,0x0000,
- 0x0000,0x4D69,0x0000,0x0000,0x0000,0x6839,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x684F,0xD8B4,0xD8B5,
- 0xD8B6,0x6847,0x0000,0x0000,0x0000,0x3F7B,0x0000,0xD8B7,
- 0x0000,0xD8B8,0x3546,0x0000,0x365D,0x0000,0x6842,0xD8B9,
- 0xD8BA,0xD8BB,0x0000,0x325B,0xD8BC,0x0000,0x3E54,0x0000,
- 0x6845,0x0000,0x0000,0x0000,0x3A5A,0xD8BD,0x0000,0x4551,
- 0x684A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xD8BF,0x4A6E,0xD8C0,0x6841,0x0000,0x0000,0x0000,0x325A,
- 0x3856,0x4929,0x684B,0x0000,0x683F,0x0000,0xD8C1,0x6848,
- 0xD8C2,0xD8C3,0x0000,0x6852,0xD8C4,0x6843,0x0000,0x0000,
-
- /* 8400h */
- 0x0000,0xD8C5,0x0000,0x6844,0x463A,0x0000,0xD8C6,0x6849,
- 0x0000,0x0000,0xD8C7,0x6846,0x4B28,0x684C,0x3060,0xD8C8,
- 0x0000,0xD8C9,0x0000,0x6840,0x0000,0xD8CA,0x0000,0x0000,
- 0x0000,0xD8CB,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x684E,0x0000,0x684D,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x476B,0x6854,0x0000,0x685F,0x0000,0x0000,0xD8CD,
- 0x0000,0x337E,0x0000,0x0000,0x0000,0x6862,0x0000,0x0000,
- 0x6850,0xD8CE,0x0000,0x0000,0x6855,0x4D6E,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xD8CF,0x685E,0xD8D0,
- 0xD8D1,0x4D55,0xD8D2,0x0000,0x0000,0xD8D3,0x4E2A,0xD8D4,
- 0x0000,0xD8D5,0xD8D6,0x0000,0x0000,0x0000,0xD8D7,0x4378,
- 0xD8D8,0xD8D9,0xD8DA,0x336B,0xD8DB,0x0000,0x0000,0x0000,
- 0xD8DC,0x4972,0x6864,0x4621,0xD8DD,0xD8DE,0x3031,0xD8DF,
- 0x0000,0x685D,0xD8E0,0x6859,0x4172,0x6853,0x685B,0x6860,
- 0xD8E1,0x472C,0x0000,0xD8E2,0xD8E3,0x302A,0xD8E4,0x6858,
- 0xD8E5,0x6861,0x4978,0x0000,0xD8E6,0xD8E7,0x0000,0x0000,
- 0x0000,0xD8E8,0x685C,0x0000,0x6857,0xD8E9,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x3E55,0x0000,0x0000,0x0000,0x0000,
- 0x3D2F,0x0000,0xD8EA,0xD8EB,0x3C2C,0xD8EC,0x0000,0x0000,
- 0x0000,0x4C58,0x0000,0x0000,0x4947,0x0000,0xD8ED,0x6867,
- 0x0000,0x6870,0x0000,0x0000,0x0000,0x0000,0xD8EE,0x0000,
- 0xD8EF,0xD8F0,0xD8F1,0x0000,0x0000,0x685A,0x0000,0xD8F2,
- 0x0000,0xD8F3,0x3377,0x0000,0xD8F4,0x0000,0x0000,0x0000,
- 0x3E78,0x6865,0xD8F5,0x686A,0x4173,0xD8F6,0xD8F7,0x6866,
- 0xD8F8,0x686D,0xD8F9,0x0000,0x435F,0x0000,0x686E,0xD8FA,
- 0xD8FB,0x4D56,0x6863,0x3338,0xD8FC,0x6869,0x0000,0xD8FD,
- 0x686C,0x4C2C,0x0000,0xD8FE,0x0000,0x0000,0x686F,0x0000,
- 0x0000,0x6868,0x686B,0x0000,0xD9A1,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xD9A2,
- 0x0000,0x0000,0xD9A3,0x0000,0x4B29,0x0000,0x4F21,0xD9A4,
- 0xD9A5,0xD9A6,0xD9A7,0x0000,0x6873,0x0000,0x0000,0xD9A8,
- 0x0000,0x0000,0xD9AA,0xD9AB,0x687A,0xD9AC,0x0000,0x6872,
-
- /* 8500h */
- 0x3C43,0x0000,0xD9AD,0xD9AE,0x0000,0x0000,0x6851,0xD9AF,
- 0x0000,0x0000,0x0000,0x0000,0xD9B0,0x0000,0xD9B1,0x0000,
- 0xD9B2,0x4A4E,0x0000,0x4C22,0x6879,0x6878,0x0000,0x6874,
- 0x6875,0x0000,0x3136,0x0000,0xD9B3,0x0000,0xD9B4,0x6877,
- 0x0000,0x6871,0xD9B5,0xD9B6,0xD9B7,0xD9B8,0x4455,0xD9B9,
- 0x0000,0x0000,0xD9BA,0xD9BB,0x6876,0x307E,0x0000,0xD9BC,
- 0x0000,0x0000,0xD9A9,0xD9BD,0xD9BE,0x4222,0xD9BF,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x4A43,0x0000,0xD9C0,
- 0x687B,0x6921,0x0000,0x4859,0x0000,0x0000,0xD9C1,0x0000,
- 0x687E,0x3E56,0x3C49,0x6923,0x0000,0x0000,0x363E,0xD9C2,
- 0xD9C3,0xD9C4,0xD9C5,0xD9C6,0x0000,0x6924,0xD9C7,0x4979,
- 0x687D,0xD9C8,0x6856,0x0000,0xD9C9,0xD9CA,0xD9CB,0xD9CC,
- 0xD9CD,0xD9CE,0xD9CF,0x687C,0xD9D0,0x0000,0x0000,0x0000,
- 0x4F4F,0x4622,0x4973,0xD9D1,0x0000,0x692B,0x0000,0xD9D2,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x6931,
- 0x0000,0xD9D3,0xD9D4,0xD9D5,0x0000,0xD9D6,0x6932,0xD9D7,
- 0x6925,0xD9D8,0x0000,0x0000,0x4776,0xD9D9,0xD9DA,0x692F,
- 0x6927,0xD9DB,0x6929,0xD9DC,0xD9DD,0x0000,0x0000,0xD9DE,
- 0x6933,0x6928,0x0000,0xD9DF,0x692C,0x0000,0x0000,0x3172,
- 0xD9E0,0x4665,0x0000,0x692D,0x6930,0xD9E1,0x0000,0xD9E2,
- 0xD9E3,0x0000,0xD9E4,0x0000,0x6926,0xD9E5,0x4126,0xD9E6,
- 0x692A,0x3B27,0x3F45,0x3730,0x4C74,0xD9F4,0x4C79,0x3D72,
- 0x0000,0x0000,0x0000,0x0000,0xD9E7,0x0000,0xD9E8,0xD9E9,
- 0xD9EA,0x6937,0x6935,0x0000,0xD9EB,0xD9EC,0xD9ED,0xD9EE,
- 0x0000,0x4F4E,0xD9EF,0x0000,0x0000,0x0000,0x0000,0xD9F0,
- 0x0000,0x6934,0xD9F1,0xD9F2,0x0000,0x4D75,0xD9F3,0x6936,
- 0x6938,0x0000,0x0000,0x0000,0x0000,0x6939,0x0000,0x0000,
- 0xD9F5,0x0000,0xD9F6,0x0000,0x693C,0x693A,0x0000,0xD9F7,
- 0xD9F8,0x0000,0x0000,0x0000,0x4623,0x693B,0xD9F9,0x0000,
- 0xD9FA,0x484D,0x692E,0x0000,0x0000,0xD9FB,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xD9FC,0x0000,0x0000,0xD9FD,0x3D73,
- 0x0000,0x693D,0x6942,0x4174,0xD9FE,0x0000,0x6941,0xDAA1,
-
- /* 8600h */
- 0xDAA2,0x0000,0x6922,0x0000,0xDAA3,0xDAA4,0x6943,0x4149,
- 0x0000,0x0000,0x693E,0x6940,0x0000,0xDAA5,0xDAA6,0x0000,
- 0xDAA7,0xDAA8,0xDAA9,0x693F,0x0000,0x0000,0x5D31,0x5D22,
- 0xDAAA,0xDAAB,0x6945,0xDAAC,0x0000,0x0000,0xDAAD,0x0000,
- 0x0000,0xDAAE,0x6944,0x0000,0x0000,0x0000,0x0000,0xDAAF,
- 0x0000,0xDAB0,0x0000,0x0000,0x0000,0x4D76,0x0000,0x623C,
- 0x6946,0x0000,0x0000,0x0000,0x0000,0x0000,0xDAB1,0x0000,
- 0xDAB2,0x0000,0xDAB3,0x0000,0xDAB4,0xDAB5,0x0000,0x6947,
- 0xDAB6,0xB8E6,0xDAB7,0x0000,0x0000,0x0000,0xDAB8,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x6948,0x3857,0x0000,
- 0x3554,0x0000,0xDAB9,0xDABA,0x694A,0x515D,0xDABB,0xDABC,
- 0xDABD,0xDABE,0x3575,0x0000,0x4E3A,0xDABF,0x3673,0x694B,
- 0xDAC0,0xDAC1,0xDAC2,0xDAC3,0xDAC4,0x0000,0x0000,0x694C,
- 0x0000,0xDAC5,0x0000,0x436E,0xDAC6,0x0000,0x0000,0xDAC7,
- 0x0000,0x694D,0x0000,0x0000,0x0000,0xDAC8,0xDAC9,0xDACA,
- 0x0000,0x467A,0xDACB,0x303A,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xDAED,0x0000,0x3263,0x6952,0x6953,0xDACC,0x0000,0x0000,
- 0x0000,0xDACD,0x0000,0x694E,0x0000,0x3B3D,0xDACE,0x0000,
- 0xDACF,0x0000,0xDAD0,0x0000,0xDAD1,0x0000,0x0000,0x0000,
- 0x0000,0xDAD2,0x0000,0x694F,0x4742,0x0000,0xDAD3,0xDAD4,
- 0xDAD5,0x6950,0x6951,0x695B,0x0000,0xDAD6,0x0000,0x6955,
- 0x6958,0xDAD7,0x0000,0xDAD8,0xDAD9,0xDADA,0x6954,0xDADB,
- 0xDADC,0xDADD,0x0000,0x0000,0x0000,0x0000,0x0000,0xDADE,
- 0xDADF,0xDAE0,0x0000,0xDAE1,0x6956,0xDAE2,0x6957,0x3C58,
- 0x0000,0x6959,0x0000,0x4341,0x0000,0x3756,0x3342,0x0000,
- 0x0000,0xDAE3,0xDAE4,0x0000,0x695C,0xDAE5,0x0000,0xDAE6,
- 0x0000,0x333F,0xDAE7,0x6961,0xDAE8,0x0000,0x695D,0x6960,
- 0xDAE9,0x0000,0x0000,0xDAEA,0x483A,0xDAEB,0x0000,0xDAEC,
- 0x0000,0x695E,0x0000,0x0000,0x695F,0x4948,0x485A,0x6962,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x427D,0x696C,0xDAEE,0x6968,0xDAEF,0xDAF0,0x326B,0x0000,
-
- /* 8700h */
- 0x6966,0x0000,0x4B2A,0x6967,0xDAF1,0xDAF2,0x6964,0xDAF3,
- 0x6965,0x696A,0x696D,0xDAF4,0x0000,0x696B,0xDAF5,0xDAF6,
- 0xDAF7,0x6969,0x6963,0xDAF8,0xDAF9,0x0000,0x0000,0x0000,
- 0x4358,0xDAFA,0x6974,0x0000,0x4C2A,0x0000,0xDAFB,0xDAFC,
- 0x0000,0xDAFD,0x0000,0xDAFE,0x0000,0x6972,0x0000,0x0000,
- 0xDBA1,0x6973,0x0000,0x0000,0x0000,0x0000,0xDBA2,0xDBA3,
- 0x0000,0xDBA4,0xDBA5,0x0000,0x696E,0x0000,0x0000,0x6970,
- 0x0000,0xDBA6,0xDBA7,0x6971,0xDBA8,0xDBA9,0xDBAA,0x696F,
- 0xDBAB,0x0000,0x0000,0xDBAC,0x0000,0xDBAD,0x0000,0x0000,
- 0x0000,0x4066,0x0000,0x4F39,0x6978,0xDBAE,0x6979,0x0000,
- 0x0000,0x0000,0x0000,0x6A21,0x0000,0x3F2A,0x0000,0x697B,
- 0xDBAF,0x697E,0x0000,0x0000,0x0000,0xDBB0,0x0000,0x6976,
- 0x6975,0xDBB1,0x0000,0x6A22,0xDBB2,0xDBB3,0x325C,0x0000,
- 0x697C,0x0000,0x6A23,0x0000,0x0000,0x0000,0x697D,0xDBB4,
- 0x0000,0xDBB5,0xDBB6,0x0000,0x697A,0x0000,0x4433,0x0000,
- 0x6977,0x0000,0x0000,0xDBB7,0x0000,0x0000,0x0000,0x4768,
- 0x0000,0x0000,0x6A27,0xDBB8,0xDBB9,0xDBBA,0xDBBB,0xDBBC,
- 0xDBBD,0xDBBE,0x0000,0xDBBF,0xDBC0,0x4D3B,0x0000,0x0000,
- 0xDBC1,0x0000,0x0000,0xDBC2,0x0000,0xDBC3,0x0000,0xDBC4,
- 0xDBC5,0xDBC6,0x0000,0x0000,0x0000,0x0000,0xDBC7,0x6A26,
- 0xDBC8,0x0000,0x6A25,0xDBC9,0x0000,0x0000,0x0000,0xDBCA,
- 0x0000,0x0000,0x0000,0x6A2E,0xDBCB,0xDBCC,0xDBCD,0x6A28,
- 0x0000,0xDBCE,0x0000,0x6A30,0x0000,0xDBCF,0x0000,0x0000,
- 0x0000,0x0000,0x4D66,0x6A33,0x0000,0x6A2A,0xDBD0,0xDBD1,
- 0x6A2B,0xDBD2,0x0000,0x0000,0x6A2F,0x0000,0x6A32,0x6A31,
- 0xDBD3,0xDBD4,0xDBD5,0x6A29,0x0000,0x0000,0xDBD6,0x0000,
- 0x6A2C,0x0000,0x6A3D,0x0000,0x0000,0xDBD7,0xDBD8,0x0000,
- 0x0000,0xDBD9,0xDBDA,0x0000,0xDBDB,0x0000,0x0000,0xDBDC,
- 0x6A36,0x0000,0xDBDD,0xDBDE,0xDBDF,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xDBE0,0xDBE1,0x0000,0xDBE2,0x0000,0x6A34,
- 0x0000,0xDBE3,0x6A35,0xDBE4,0x0000,0x0000,0x6A3A,0x6A3B,
- 0xDBE5,0x332A,0xDBE6,0x3542,0x0000,0x0000,0x6A39,0xDBE7,
-
- /* 8800h */
- 0x0000,0xDBE8,0x0000,0xDBE9,0x0000,0x6A24,0xDBEA,0x0000,
- 0x0000,0xDBEB,0xDBEC,0xDBED,0x0000,0x6A38,0x6A3C,0x6A37,
- 0xDBEE,0x6A3E,0xDBF0,0xDBF1,0xDBF2,0x6A40,0x6A3F,0x0000,
- 0xDBF3,0xDBEF,0xDBF4,0xDBF5,0xDBF6,0x0000,0xDBF7,0xDBF8,
- 0x0000,0x6A42,0x6A41,0x695A,0x0000,0x0000,0x0000,0x6A46,
- 0xDBF9,0x0000,0x0000,0x0000,0x0000,0xDBFA,0xDBFB,0x0000,
- 0xDBFC,0x6A43,0xDBFD,0x0000,0x0000,0xDBFE,0x6A44,0x0000,
- 0x0000,0x6A45,0xDCA1,0x6A47,0xDCA2,0x0000,0x0000,0x0000,
- 0x376C,0xDCA3,0x6A49,0xDCA4,0x6A48,0xDCA5,0x3D30,0x0000,
- 0xDCA6,0xDCA7,0xDCA8,0xDCA9,0x3954,0x5E27,0xDCAA,0x0000,
- 0x0000,0xDCAB,0x6A4A,0x3D51,0x0000,0xDCAC,0xDCAD,0x3339,
- 0xDCAE,0x6A4B,0xDCAF,0x3152,0xDCB0,0x3E57,0x6A4C,0xDCB1,
- 0xDCB2,0x3955,0x6A4D,0x3061,0xDCB3,0x0000,0x0000,0x0000,
- 0x493D,0xDCB4,0x0000,0x6A4E,0x0000,0x0000,0x0000,0x0000,
- 0x3F6A,0xDCB5,0x6A55,0x0000,0x0000,0x6A52,0x0000,0x436F,
- 0x0000,0xDCB6,0x0000,0xDCB7,0x0000,0x6A53,0x6A50,0x365E,
- 0xDCB8,0x6A4F,0x6A56,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x3736,0x0000,0x0000,0x425E,0x0000,0x6A5C,0x0000,0x0000,
- 0x0000,0x0000,0x6A58,0x0000,0x0000,0x0000,0x4235,0x6A57,
- 0xDCB9,0x6A5A,0xDCBA,0xDCBB,0xDCBC,0x0000,0x6A51,0xDCBD,
- 0xDCBE,0x0000,0x6A5B,0x0000,0x6A5D,0x0000,0x0000,0x0000,
- 0xDCBF,0x0000,0xDCC0,0x486F,0x0000,0x0000,0x6A59,0x0000,
- 0x6A5E,0x6A60,0x0000,0x0000,0x3853,0x6A54,0x0000,0x3041,
- 0x0000,0x0000,0xDCC1,0x0000,0x0000,0xDCC2,0xDCC3,0x6A5F,
- 0xDCC4,0x3A5B,0x4E76,0x6A61,0x6A62,0x4175,0x0000,0x0000,
- 0x0000,0x0000,0xDCC5,0xDCC6,0xDCC7,0xDCC8,0xDCC9,0x4E22,
- 0x0000,0xDCCA,0xDCCB,0xDCCC,0x6A63,0x4D35,0x0000,0x0000,
- 0x6A64,0x6A65,0x0000,0xDCCD,0x4A64,0x6A66,0xDCCE,0x3A40,
- 0x0000,0x4E23,0x0000,0x0000,0x0000,0x0000,0x0000,0xDCCF,
- 0x6A6B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xDCD0,
- 0xDCD1,0xDCD2,0x6A6C,0x3E58,0x6A6A,0xDCD3,0x0000,0xDCD4,
- 0x4D67,0x6A67,0x0000,0x0000,0x6A69,0x403D,0x3F7E,0x0000,
-
- /* 8900h */
- 0x0000,0xDCD5,0x6A68,0x0000,0x6A6D,0x0000,0xDCD6,0x4A23,
- 0x0000,0x0000,0x6A6F,0x0000,0x6A6E,0xDCD7,0xDCD8,0xDCD9,
- 0x336C,0x0000,0x4B2B,0x6A70,0x0000,0xDCDA,0xDCDB,0x0000,
- 0xDCDC,0xDCDD,0xDCDE,0x0000,0xDCDF,0x6A7C,0x6A72,0x0000,
- 0xDCE0,0x0000,0x0000,0x0000,0x0000,0x6A73,0xDCE1,0xDCE2,
- 0xDCE3,0x0000,0x6A74,0x6A75,0x0000,0x0000,0x0000,0x0000,
- 0xDCE4,0xDCE5,0xDCE6,0x0000,0x0000,0xDCE7,0x6A79,0x0000,
- 0x6A7A,0xDCE8,0xDCE9,0x6A78,0x0000,0x0000,0xDCEA,0x0000,
- 0xDCEB,0x6A76,0xDCEC,0x6A71,0x6A77,0xDCED,0xDCEE,0x0000,
- 0x0000,0xDCEF,0x0000,0x0000,0x6A7B,0x7037,0x0000,0xDCF0,
- 0x0000,0x0000,0xDCF1,0x0000,0x0000,0x0000,0x3228,0xDCF2,
- 0x0000,0x0000,0xDCF3,0xDCF4,0xDCF5,0x0000,0x6A7E,0x365F,
- 0x6A7D,0xDCF6,0xDCF7,0xDCF8,0x6B22,0x0000,0x6B21,0x0000,
- 0x0000,0x0000,0x6B24,0xDCF9,0x0000,0x6B23,0xDCFA,0x6B25,
- 0xDCFB,0x0000,0x3D31,0xDCFC,0x6B26,0xDCFD,0x0000,0x6B27,
- 0x0000,0x0000,0xDCFE,0xDDA1,0xDDA2,0xDDA3,0x6B28,0x403E,
- 0x0000,0x4D57,0x0000,0x6B29,0x0000,0x0000,0x4A24,0x4746,
- 0x6B2A,0xDDA4,0x6B2B,0x382B,0x0000,0xDDA5,0x0000,0x352C,
- 0xDDA6,0x0000,0x0000,0x6B2C,0xDDA7,0xDDA8,0x3B6B,0x4741,
- 0x6B2D,0x0000,0x3350,0xDDA9,0xDDAA,0x0000,0x0000,0xDDAB,
- 0xDDAC,0x6B2E,0x0000,0x0000,0x0000,0xDDAD,0x6B30,0x4D77,
- 0x0000,0x6B2F,0x3F46,0x0000,0x6B31,0x0000,0x0000,0x6B32,
- 0xDDAE,0x0000,0x6B33,0x3451,0xDDAF,0xDDB0,0xDDB1,0xDDB2,
- 0x0000,0x0000,0x6B34,0x0000,0xDDB3,0x6B35,0x0000,0x6B36,
- 0x6B37,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x3351,0x0000,0xDDB4,0xDDB5,0xDDB6,0xDDB7,
- 0xDDB8,0x0000,0x6B38,0x0000,0x6B39,0x6B3A,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x3272,0x0000,0xDDB9,0x3F28,0x6B3B,
- 0x0000,0xDDBA,0x0000,0xDDBB,0x0000,0xDDBC,0x0000,0x0000,
- 0x0000,0xDDBD,0x0000,0xDDBE,0x6B3C,0x0000,0xDDBF,0x0000,
- 0x6B3D,0xDDC0,0x0000,0x0000,0x0000,0xDDC1,0x0000,0xDDC2,
-
- /* 8A00h */
- 0x3840,0x0000,0x447B,0x6B3E,0xDDC3,0xDDC4,0x0000,0xDDC5,
- 0x3757,0x0000,0x3F56,0x0000,0x6B41,0x0000,0x4624,0xDDC6,
- 0x6B40,0xDDC7,0xDDC8,0x3731,0xDDC9,0xDDCA,0x6B3F,0x4277,
- 0x352D,0x0000,0x0000,0x6B42,0x0000,0x6B43,0xDDCB,0x3E59,
- 0xDDCC,0x0000,0xDDCD,0x376D,0xDDCE,0x6B44,0xDDCF,0x0000,
- 0x0000,0x0000,0x4B2C,0xDDD0,0xDDD1,0x405F,0x0000,0xDDD2,
- 0x0000,0x3576,0x0000,0x4C75,0x414A,0xDDD3,0x6B45,0xDDD4,
- 0x0000,0x0000,0x3F47,0x4370,0x3E5A,0xDDD5,0xDDD6,0x0000,
- 0xDDD7,0x6B46,0x0000,0xDDD8,0x0000,0xDDD9,0x6B49,0xDDDA,
- 0x6B4A,0xDDDB,0x0000,0x0000,0x0000,0xDDDC,0xDDDD,0x0000,
- 0x3A3E,0x4242,0x6B48,0xDDDE,0x3E5B,0x493E,0xDDDF,0xDDE0,
- 0xDDE1,0x0000,0x0000,0x6B47,0xDDE2,0xDDE3,0x3B6C,0x0000,
- 0x3153,0xDDE4,0x6B4E,0x3758,0x0000,0xDDE5,0x3B6E,0xDDE6,
- 0x0000,0x3B6D,0x0000,0x4F4D,0x6B4D,0x6B4C,0x4127,0x0000,
- 0x354D,0x4F43,0x333A,0x3E5C,0x0000,0xDDE7,0xDDE8,0xDDE9,
- 0x0000,0xDDEA,0xDDEB,0xDDEC,0x6B4B,0x0000,0xDDED,0xDDEE,
- 0xDDEF,0x0000,0x6B50,0xDDF0,0x6B51,0x6B4F,0xDDF1,0x3858,
- 0x0000,0x4D40,0x0000,0xDDF2,0x3B6F,0x4727,0x0000,0xDDF3,
- 0xDDF4,0x6B54,0xDDF5,0x4040,0x0000,0x4342,0xDDF6,0xDDF7,
- 0x4D36,0xDDF8,0x6B57,0x0000,0x0000,0x0000,0x386C,0xDDF9,
- 0x403F,0x6B53,0x0000,0x6B58,0x386D,0x6B55,0x6B56,0xDDFA,
- 0x6B52,0xDDFB,0x0000,0x0000,0x4062,0x4649,0xDDFC,0xDDFD,
- 0x432F,0x0000,0x325D,0xDDFE,0x0000,0x0000,0xDEA1,0xDEA2,
- 0x0000,0x4870,0x0000,0xDEA3,0x3543,0x0000,0xDEA4,0x4434,
- 0x0000,0x0000,0x6B5B,0xDEA5,0x6B59,0x0000,0xDEA6,0x434C,
- 0xDEA7,0xDEA8,0xDEA9,0x4041,0x3452,0x6B5A,0x0000,0x3F5B,
- 0x0000,0xDEAA,0x4E4A,0xDEAB,0xDEAC,0xDEAD,0x4F40,0xDEAE,
- 0x0000,0x0000,0x6B5C,0x6B67,0x4435,0xDEAF,0x6B66,0xDEB0,
- 0x6B63,0x6B6B,0x6B64,0x0000,0x6B60,0x0000,0x447C,0x6B5F,
- 0x0000,0x0000,0x0000,0x6B5D,0xDEB1,0x4D21,0x3B70,0x0000,
- 0xDEB2,0x6B61,0x0000,0x6B5E,0xDEB3,0xDEB4,0xDEB5,0x6B65,
- 0x3D74,0x0000,0x3841,0x0000,0xDEB6,0x0000,0x427A,0xDEB7,
-
- /* 8B00h */
- 0x4B45,0x315A,0x3062,0x0000,0x4625,0xDEB8,0xDEB9,0x6B69,
- 0x0000,0x0000,0xDEBF,0xDEBA,0x6B68,0x0000,0x4666,0x0000,
- 0x6B6D,0xDEBB,0x0000,0x0000,0x6B62,0x0000,0x6B6C,0x6B6E,
- 0x0000,0x382C,0x6B6A,0x3956,0xDEBC,0x3C55,0xDEBD,0xDEBE,
- 0x6B6F,0x4D58,0x0000,0x0000,0x0000,0x0000,0x6B72,0x0000,
- 0x6B75,0x0000,0x0000,0x6B73,0x4935,0xDEC0,0x0000,0x0000,
- 0xDEC1,0x0000,0x0000,0x6B70,0x0000,0x0000,0x0000,0xDEC2,
- 0x0000,0x3660,0x0000,0x0000,0xDEC3,0x0000,0x6B74,0x0000,
- 0x0000,0x6B76,0xDEC4,0xDEC5,0xDEC6,0xDEC7,0xDEC8,0x0000,
- 0xDEC9,0x6B7A,0x0000,0x0000,0x6B77,0xDECE,0x6B79,0x6B78,
- 0x0000,0x0000,0xDECA,0xDECB,0xDECC,0x0000,0x6B7B,0x0000,
- 0x3C31,0xDECD,0x6B7D,0x6B7C,0x4968,0x0000,0xDECF,0x6C21,
- 0x0000,0x0000,0x0000,0xDED0,0x0000,0x0000,0x3759,0x0000,
- 0x0000,0x0000,0x0000,0x6B7E,0x6C22,0xDED1,0x0000,0x6C23,
- 0x3544,0x6641,0x3E79,0x0000,0x6C24,0x0000,0xDED2,0x386E,
- 0xDED3,0xDED4,0x0000,0x0000,0xDED5,0x6C25,0xDED6,0x0000,
- 0x6C26,0xDED7,0x0000,0x3B3E,0xDED8,0xDED9,0x0000,0x0000,
- 0x0000,0x0000,0x5A4E,0xDEDA,0x6C27,0xDEDB,0x6C28,0xDEDC,
- 0x3D32,0x0000,0x6C29,0x6C2A,0xDEDD,0xDEDE,0x6C2B,0x0000,
- 0x0000,0x6C2C,0x6C2D,0x0000,0xDEDF,0x0000,0xDEE0,0xDEE1,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 8C00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x432B,
- 0xDEE2,0xDEE3,0x6C2E,0x0000,0x0000,0xDEE4,0xDEE5,0x6C30,
- 0x0000,0x6C2F,0x0000,0x0000,0x0000,0xDEE6,0x4626,0xDEE7,
- 0x6C31,0xDEE8,0x4B2D,0xDEE9,0x6C32,0x0000,0x6C33,0xDEEA,
- 0x6C34,0xDEEB,0x0000,0xDEEC,0xDEED,0x6C35,0x0000,0xDEEE,
- 0xDEEF,0xDEF2,0x465A,0xDEF0,0x0000,0xDEF1,0x0000,0x0000,
- 0x0000,0x3E5D,0x6C36,0xDEF3,0xDEF4,0x0000,0xDEF5,0x0000,
- 0xDEF6,0xDEF7,0x396B,0x502E,0x6C37,0xDEF8,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xDEF9,0x0000,0xDEFA,0xDEFB,0x0000,
- 0x6C38,0x493F,0x6C39,0xDEFC,0x6C41,0x0000,0xDEFD,0x0000,
- 0x0000,0x0000,0x6C3A,0x0000,0x0000,0x6C3C,0xDEFE,0xDFA1,
- 0x0000,0x6C3B,0x6C3D,0xDFA2,0x4B46,0x6C3E,0x6C3F,0x0000,
- 0xDFA3,0x0000,0xDFA4,0xDFA5,0x6C40,0x0000,0x0000,0x0000,
- 0x6C42,0xDFA6,0x0000,0xDFA7,0xDFA8,0x332D,0x4467,0x0000,
- 0x4969,0x3A62,0x3957,0x0000,0xDFA9,0x0000,0x0000,0x494F,
- 0x325F,0x484E,0x6C45,0x3453,0x4055,0x6C44,0x6C49,0x4379,
- 0x4C63,0x0000,0x6C47,0x6C48,0x352E,0x0000,0x6C4A,0x4763,
- 0x425F,0xDFAA,0xDFAB,0x4871,0x453D,0x6C46,0x0000,0x4B47,
- 0x326C,0x6C4C,0x4F28,0x4442,0x4F45,0xDFAC,0xDFAD,0x3B71,
- 0x6C4B,0xDFAE,0x4231,0xDFAF,0x0000,0x6C5C,0x4128,0xDFB0,
- 0x0000,0x4678,0x0000,0x4950,0x0000,0xDFB2,0xDFB1,0x0000,
- 0x0000,0xDFB3,0x6C4F,0x3B3F,0x3B72,0xDFB4,0x3E5E,0x0000,
- 0x4765,0xDFB5,0x382D,0x6C4E,0x6C4D,0x0000,0x496A,0x0000,
- 0xDFB6,0x0000,0x3C41,0x0000,0xDFB7,0x4552,0x0000,0xDFB8,
- 0xDFB9,0x0000,0xDFBA,0x0000,0x0000,0xDFBB,0x0000,0xDFBC,
- 0xDFBD,0x0000,0x6C51,0x6C52,0x3958,0x6C50,0xDFBE,0xDFBF,
-
- /* 8D00h */
- 0x0000,0xDFC0,0x0000,0xDFC1,0x6C53,0x6C54,0x0000,0x6C56,
- 0x4223,0xDFC2,0x6C55,0x3466,0x0000,0x6C58,0x0000,0x6C57,
- 0x6C59,0x0000,0xDFC3,0x6C5B,0x6C5D,0x0000,0x6C5E,0xDFC4,
- 0x0000,0x0000,0x0000,0xDFC5,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x4056,0xDFC6,0x3C4F,0x6C5F,
- 0x0000,0xDFC7,0x0000,0x3352,0xDFC8,0x6C60,0xDFC9,0x0000,
- 0x4176,0x6C61,0x0000,0x6C62,0x496B,0x0000,0x0000,0x352F,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xDFCA,
- 0x0000,0x6C63,0xDFCB,0x0000,0xDFCC,0x4436,0x0000,0x0000,
- 0xDFCD,0x0000,0x315B,0x0000,0x0000,0xDFCE,0x0000,0x0000,
- 0xDFCF,0xDFD0,0x0000,0x0000,0x0000,0xDFD1,0x0000,0x0000,
- 0x0000,0x6C64,0x0000,0x0000,0x0000,0x0000,0xDFD2,0xDFD3,
- 0xDFD4,0x0000,0x0000,0x3C71,0x0000,0x0000,0xDFD5,0x0000,
- 0x3F76,0x0000,0x0000,0xDFD6,0xDFD7,0x0000,0x0000,0xDFD8,
- 0x0000,0x0000,0xDFD9,0x422D,0x0000,0xDFDA,0x0000,0xDFDB,
- 0x0000,0xDFDC,0x6C67,0xDFDD,0xDFEF,0x0000,0x6C66,0x0000,
- 0xDFDE,0x0000,0x6C65,0x0000,0x0000,0xDFDF,0xDFE0,0xDFE1,
- 0xDFE2,0x0000,0xDFE3,0x6C6D,0x6C6B,0x0000,0xDFE4,0x6C68,
- 0x0000,0xDFE5,0x0000,0x0000,0xDFE6,0xDFE7,0x6C6A,0xDFE8,
- 0x0000,0xDFE9,0x6C69,0x6C6C,0x0000,0x3577,0x0000,0x6C70,
- 0x0000,0x4057,0x0000,0x6C71,0xDFEA,0xDFEB,0x0000,0xDFEC,
- 0x3859,0x0000,0x6C6E,0x6C6F,0xDFED,0x0000,0x0000,0x4F29,
- 0xDFEE,0xDFF0,0xDFF1,0x4437,0xDFF2,0x4129,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x6C72,0xDFF3,0x0000,0x6C75,
-
- /* 8E00h */
- 0x0000,0xDFF4,0x0000,0x0000,0xDFF5,0xDFF6,0xDFF7,0x0000,
- 0x6C73,0x6C74,0x4D59,0xDFF8,0x0000,0x0000,0x0000,0x4627,
- 0x6C78,0xDFF9,0x0000,0x0000,0xDFFA,0x0000,0xDFFB,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x6C76,0x6C77,0x6C79,
- 0xDFFC,0xDFFD,0xDFFE,0xE0A1,0x0000,0x0000,0xE0A2,0xE0A3,
- 0x0000,0x0000,0x6D29,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x6C7C,0xE0A4,0x0000,0xE0A5,0x6C7D,0x6C7B,0xE0A6,0xE0A7,
- 0xE0A8,0xE0A9,0x0000,0x0000,0x0000,0xE0AA,0x0000,0x0000,
- 0xE0AB,0xE0AC,0x6C7A,0x0000,0x447D,0x0000,0x0000,0x6D21,
- 0x6D25,0x6D22,0x6C7E,0xE0AD,0x6D23,0xE0AE,0xE0AF,0xE0B0,
- 0x6D24,0x0000,0x0000,0x0000,0xE0B1,0x6D2B,0x0000,0x0000,
- 0x0000,0x6D26,0x0000,0xE0B2,0xE0B3,0xE0B4,0xE0B5,0x4058,
- 0x6D28,0xE0B6,0xE0B7,0x6D2A,0x6D27,0x0000,0x0000,0x0000,
- 0x0000,0xE0B8,0x0000,0x0000,0xE0B9,0xE0BA,0x0000,0xE0BB,
- 0xE0BC,0xE0BD,0x6D2D,0x0000,0x3D33,0x0000,0x6D2C,0x0000,
- 0x0000,0xE0BE,0xE0BF,0xE0C0,0x6D2E,0x0000,0x0000,0x0000,
- 0x0000,0x6D2F,0xE0C1,0xE0C2,0x6D32,0x6D31,0x0000,0x6D30,
- 0x0000,0xE0C3,0x6D34,0x6D33,0x0000,0x4C76,0x0000,0x0000,
- 0xE0C4,0x6D36,0xE0C5,0x6D35,0x6D37,0xE0C6,0x0000,0x0000,
- 0x0000,0x6D38,0xE0C7,0xE0C8,0x0000,0xE0C9,0xE0CA,0x0000,
- 0x0000,0x6D3A,0xE0CB,0x0000,0x0000,0x0000,0x0000,0xE0CC,
- 0x0000,0xE0CD,0x6D39,0x3F48,0x6D3B,0xE0CE,0xE0CF,0x366D,
- 0x6D3C,0x6D3E,0x0000,0xE0D0,0x0000,0xE0D1,0x0000,0x0000,
- 0x0000,0x0000,0xE0D2,0xE0D3,0x0000,0x0000,0x6D3F,0x0000,
- 0xE0D4,0xE0D5,0x0000,0xE0D6,0xE0D7,0x6D40,0x6D3D,0xE0D8,
- 0x6D41,0x0000,0x3C56,0x6D42,0x3530,0x3733,0x0000,0xE0D9,
- 0x0000,0xE0DA,0x382E,0x0000,0xE0DB,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x6D43,0xE0DC,0x0000,0x0000,0x4670,
- 0x0000,0x0000,0x453E,0x6D44,0x0000,0x0000,0x0000,0x0000,
- 0xE0DD,0x0000,0x0000,0x6D47,0x0000,0xE0E4,0xE0DE,0x0000,
- 0xE0DF,0xE0E0,0x0000,0x0000,0x0000,0x0000,0x0000,0xE0E1,
- 0x3C34,0xE0E2,0xE0E3,0x6D46,0x6D45,0x375A,0x6D48,0x0000,
-
- /* 8F00h */
- 0xE0E5,0x0000,0xE0E6,0x3353,0x0000,0x6D4A,0x0000,0xE0E7,
- 0xE0E8,0x3A5C,0x6D49,0x0000,0x6D52,0x0000,0x0000,0xE0E9,
- 0xE0EA,0x0000,0x6D4C,0x6D4E,0x4A65,0x6D4B,0xE0EB,0xE0EC,
- 0xE0ED,0x6D4D,0x0000,0x6D51,0x6D4F,0x3531,0xE0EE,0x6D50,
- 0xE0EF,0xE0F0,0x0000,0xE0F1,0x0000,0xE0F2,0x6D53,0xE0F3,
- 0xE0F4,0x475A,0x4E58,0x0000,0xE0F5,0xE0F6,0xE0F7,0x3D34,
- 0x0000,0x0000,0x0000,0x6D54,0xE0F8,0xE0F9,0xE0FA,0xE0FB,
- 0x4D22,0x6D56,0xE0FC,0x6D55,0x0000,0x0000,0x6D59,0x4D41,
- 0xE0FD,0xE0FE,0x6D58,0xE1A1,0x336D,0x6D57,0x6D5C,0xE1A2,
- 0x0000,0x6D5B,0x0000,0x0000,0x6D5A,0x4532,0x6D5D,0xE1A3,
- 0x0000,0xE1A4,0xE1A5,0xE1A6,0xE1A7,0xE1A8,0x0000,0x6D5E,
- 0xE1A9,0x0000,0x0000,0x0000,0x6D5F,0xE1AA,0xE1AB,0x396C,
- 0x0000,0x3725,0x6D60,0x6D61,0x6D62,0xE1AC,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x3F49,0x6D63,0xE1AD,0x3C2D,0x6D64,
- 0xE1AE,0xE1AF,0x0000,0x6D65,0xE1B0,0xE1B1,0xE1B2,0x5221,
- 0x517E,0x0000,0x0000,0x0000,0x0000,0x6D66,0x6570,0x6D67,
- 0x4324,0x3F2B,0x4740,0x0000,0x0000,0xE1B3,0xE1B4,0x6D68,
- 0xE1B5,0x0000,0x4A55,0x4454,0x397E,0x0000,0xE1B6,0x4329,
- 0xE1B7,0xE1B8,0x312A,0x0000,0x4B78,0x3F57,0xE1B9,0x0000,
- 0x0000,0x0000,0xE1BA,0xE1BB,0x0000,0xE1BC,0x375E,0x0000,
- 0xE1BD,0x3661,0xE1BE,0xE1BF,0x4A56,0xE1C0,0x0000,0x0000,
- 0x0000,0x0000,0x6D69,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xE1C1,0x0000,0x6D6B,0xE1C2,0xE1C3,0x6D6A,0x3260,0x0000,
- 0xE1C4,0x4676,0x6D6C,0x4777,0x0000,0x4533,0xE1C5,0x6D6D,
- 0x3D52,0xE1C6,0x0000,0x0000,0x6D6F,0xE1C7,0xE1C8,0x4C42,
- 0x6D7E,0x6D71,0x6D72,0xE1C9,0x0000,0x4449,0xE1CA,0x0000,
-
- /* 9000h */
- 0x4260,0x4177,0xE1CB,0x4628,0xE1CC,0x6D70,0x3555,0x0000,
- 0xE1CD,0x0000,0x0000,0x6D79,0xE1CE,0x6D76,0x6E25,0x4629,
- 0x4360,0x6D73,0x0000,0x447E,0x4553,0x6D74,0x6D78,0x3F60,
- 0xE1CF,0x4767,0x444C,0xE1D0,0x0000,0x4042,0x6D77,0x422E,
- 0x4224,0x6D75,0x3029,0x4F22,0x0000,0x0000,0x0000,0x6D7A,
- 0xE1D1,0xE1D2,0xE1D4,0x0000,0xE1D5,0xE1D6,0x4261,0xE1D3,
- 0x0000,0x3D35,0x3F4A,0xE1D7,0xE1D8,0x6D7C,0x6D7B,0xE1D9,
- 0x306F,0x6D7D,0x0000,0x0000,0x492F,0x0000,0x6E27,0xE1DA,
- 0x0000,0x465B,0x3F6B,0xE1DB,0xE1DC,0x4359,0x0000,0x3678,
- 0x0000,0x6E26,0x4D37,0x313F,0xE1DD,0x4A57,0x3261,0x6E21,
- 0x6E22,0x6E23,0x6E24,0x463B,0x4323,0x3063,0x6E28,0x0000,
- 0x6E29,0x7423,0x0000,0xE1DE,0x423D,0xE1DF,0x6E2A,0x0000,
- 0x3173,0x414C,0xE1E0,0x382F,0x0000,0x4D5A,0xE1E1,0xE1E2,
- 0x6E2B,0x452C,0x0000,0x0000,0xE1E3,0x4178,0x3C57,0x6E2C,
- 0xE1E4,0x0000,0x6E2F,0x0000,0xE1E5,0x3D65,0x6E2D,0x412B,
- 0x412A,0xE1E6,0x3064,0x0000,0x4E4B,0x6E31,0x0000,0x4872,
- 0x6E33,0x6E32,0x6E30,0x6364,0x3454,0xE1E7,0x0000,0x6D6E,
- 0xE1E8,0x6E35,0x6E34,0xE1E9,0xE1EA,0x0000,0xE1EB,0x6E36,
- 0xE1EC,0x4D38,0x0000,0x0000,0x0000,0xE1ED,0x0000,0xE1EE,
- 0xE1EF,0xE1F0,0x0000,0xE1F1,0x0000,0x0000,0x0000,0x0000,
- 0xE1F2,0xE1F3,0xE1F4,0x4661,0x0000,0xE1F5,0x4B2E,0x0000,
- 0x6E37,0x0000,0x3C59,0x0000,0x0000,0x0000,0x0000,0x6E38,
- 0xE1F6,0x6E39,0xE1F7,0xE1F8,0xE1F9,0x6E3A,0xE1FA,0x0000,
- 0x4521,0x0000,0x0000,0x0000,0x0000,0xE1FB,0xE1FD,0x0000,
- 0x0000,0x306A,0x0000,0xE1FE,0xE2A1,0xE2A2,0x0000,0xE2A3,
- 0xE2A4,0x0000,0x3959,0x0000,0xE1FC,0x0000,0x4F3A,0x0000,
- 0x0000,0x0000,0xE2AD,0x0000,0x0000,0xE2A5,0x0000,0xE2A6,
- 0xE2A7,0xE2A8,0x0000,0x6E3E,0xE2A9,0xE2AA,0x0000,0xE2AB,
- 0x0000,0x3734,0x6E3B,0x0000,0x6E3C,0xE2AC,0x0000,0x0000,
- 0x4974,0x0000,0x0000,0xE2AF,0x0000,0x3354,0x0000,0xE2B0,
- 0xE2B1,0x0000,0x0000,0x0000,0xE2B2,0x4D39,0xE2AE,0x363F,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x4554,0xE2B3,0xE2B4,
-
- /* 9100h */
- 0xE2B5,0x0000,0x6E3F,0x0000,0xE2B6,0xE2B7,0xE2B8,0x0000,
- 0xE2B9,0x0000,0x0000,0x0000,0x0000,0xE2BA,0x0000,0x0000,
- 0xE2BB,0x0000,0x6E40,0x0000,0xE2BC,0x0000,0xE2BD,0xE2BE,
- 0xE2BF,0x6E41,0xE2C0,0x0000,0xE2C1,0x0000,0xE2C2,0x0000,
- 0xE2C3,0x0000,0xE2C5,0xE2C6,0x0000,0xE2C4,0x0000,0xE2C7,
- 0x0000,0xE2C8,0x0000,0x0000,0x0000,0x4522,0xE2C9,0xE2CA,
- 0x6E43,0xE2CB,0x6E42,0x0000,0xE2CC,0x0000,0xE2CD,0xE2CE,
- 0x0000,0xE2CF,0xE2D0,0x0000,0xE2D1,0xE2D2,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xE2D3,0x0000,0x0000,0x0000,0xE2D4,
- 0xE2D5,0x4653,0x6E44,0x3D36,0x3C60,0x475B,0x4371,0xE2D6,
- 0x0000,0x0000,0x3C72,0xE2D7,0x3F6C,0x0000,0x6E45,0xE2D8,
- 0x6E46,0xE2D9,0xE2DA,0xE2DB,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xE2DC,0x3F5D,0x6E47,0xE2DD,0x6E48,0x0000,0xE2DE,
- 0x0000,0x6E49,0x4D6F,0x0000,0x3D37,0xE2DF,0x0000,0x0000,
- 0x0000,0x0000,0x6E4B,0x6E4A,0xE2E0,0x395A,0x0000,0x3973,
- 0x3B40,0xE2E1,0xE2E2,0xE2E3,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xE2E4,0x6E4E,0xE2E5,0x0000,0xE2E6,0xE2E7,0x3D66,
- 0x0000,0x6E4D,0xE2E8,0x6E4C,0x0000,0x4269,0xE2E9,0x0000,
- 0x386F,0xE2EA,0x4043,0xE2EB,0xE2EC,0xE2ED,0x0000,0x4830,
- 0xE2EE,0x0000,0x0000,0x0000,0x3D39,0x0000,0xE2EF,0x0000,
- 0x0000,0xE2F0,0x6E4F,0x0000,0x3E5F,0x0000,0xE2F1,0x0000,
- 0xE2F2,0x0000,0x6E52,0x6E50,0xE2F3,0xE2F4,0xE2F5,0x6E51,
- 0xE2F6,0xE2F7,0xE2F8,0xE2F9,0x6E54,0x6E53,0xE2FA,0x0000,
- 0x3E7A,0x0000,0x6E55,0xE2FB,0xE2FC,0xE2FD,0x0000,0xE2FE,
- 0x6E56,0x6E57,0xE3A1,0xE3A2,0x0000,0xE3A3,0x4850,0x3A53,
- 0x3C61,0x6E58,0x0000,0x6E59,0x4E24,0x3D45,0x4C6E,0x4E4C,
- 0x6E5A,0x3662,0x0000,0xE3A4,0xE3A5,0x0000,0x6E5B,0xE3A6,
- 0x4523,0xE3A7,0xE3A8,0x6E5E,0x3378,0x3F4B,0xE3A9,0x6E5C,
- 0x0000,0x6E5D,0x0000,0x4460,0xE3AA,0xE3AB,0x4B55,0x367C,
- 0x0000,0xE3AC,0xE3AD,0x0000,0xE3AE,0xE3AF,0xE3B0,0xE3B1,
- 0xE3B2,0xE3B3,0x0000,0x0000,0x0000,0x6E60,0x6E61,0xE3B4,
- 0x0000,0xE3B5,0x0000,0xE3B6,0x6E5F,0xE3B7,0x0000,0x6E63,
-
- /* 9200h */
- 0xE3B8,0xE3B9,0x0000,0x0000,0xE3BA,0xE3BB,0xE3BC,0xE3BD,
- 0x0000,0xE3BE,0xE3BF,0x0000,0xE3C0,0x465F,0x3343,0x0000,
- 0xE3C1,0x6E67,0xE3C2,0xE3C3,0x6E64,0x6E66,0xE3C4,0x0000,
- 0xE3C5,0x0000,0x0000,0x0000,0xE3C6,0xE3C7,0x6E62,0x0000,
- 0x0000,0x0000,0x0000,0xE3C8,0xE3C9,0xE3CA,0xE3CB,0x0000,
- 0xE3CC,0x6F4F,0x0000,0x0000,0x6E65,0x0000,0xE3CD,0xE3CE,
- 0xE3CF,0x0000,0x0000,0xE3D0,0x4E6B,0xE3D1,0xE3D2,0x385A,
- 0xE3D3,0xE3D4,0xE3D5,0x0000,0xE3D6,0x0000,0xE3D7,0x6E6F,
- 0xE3D8,0x0000,0xE3D9,0xE3DA,0x4534,0x6E6A,0xE3DB,0xE3DC,
- 0x6E6D,0x6E6B,0xE3DD,0x6E70,0x0000,0xE3DE,0xE3DF,0xE3E0,
- 0x6E71,0xE3E1,0x0000,0x0000,0x0000,0x0000,0x0000,0x6E69,
- 0xE3E2,0xE3E3,0x6E76,0x3174,0xE3E4,0xE3E5,0x6E68,0x0000,
- 0xE3E6,0xE3E7,0x482D,0x0000,0x6E6C,0xE3E8,0x3E60,0xE3E9,
- 0xE3EA,0xE3EB,0x0000,0x0000,0x0000,0x0000,0xE3EC,0xE3ED,
- 0xE3EE,0x395B,0x0000,0x0000,0x0000,0xE3EF,0xE3F0,0xE3F1,
- 0xE3F2,0xE3F3,0x0000,0xE3F4,0xE3F5,0xE3F6,0x4B48,0xE3F7,
- 0x3664,0x0000,0x0000,0x3D46,0x0000,0x463C,0x0000,0x0000,
- 0xE3F8,0xE3F9,0xE3FA,0x0000,0x0000,0xE3FB,0xE3FC,0x0000,
- 0x0000,0x412D,0xE3FD,0x6E74,0x0000,0x6E6E,0x6E73,0xE3FE,
- 0x4C43,0xE4A1,0x4438,0x6E75,0x6E72,0x0000,0x0000,0xE4A2,
- 0xE4A3,0x0000,0x0000,0x0000,0xE4A4,0xE4A5,0x0000,0xE4A6,
- 0xE4A7,0x0000,0x0000,0xE4A8,0x0000,0x412C,0x0000,0xE4A9,
- 0x0000,0x0000,0xE4AA,0x0000,0x0000,0x0000,0xE4AB,0x6E79,
- 0xE4AC,0x6E78,0xE4AD,0xE4AE,0xE4AF,0xE4B0,0x0000,0xE4B1,
- 0xE4B2,0xE4B3,0xE4B4,0xE4B5,0x0000,0xE4B6,0xE4B7,0xE4B8,
- 0xE4B9,0x0000,0x0000,0xE4BA,0xE4BB,0xE4BC,0xE4BD,0x6E77,
- 0xE4BE,0x0000,0x4B2F,0xE4BF,0x0000,0xE4C0,0x0000,0xE4C1,
- 0xE4C2,0xE4C3,0x0000,0x0000,0xE4C4,0xE4C5,0x0000,0xE4C6,
- 0xE4C7,0xE4C8,0x0000,0xE4C9,0x3D7B,0xE4CA,0x0000,0xE4CB,
- 0xE4CC,0x6E7A,0x4A5F,0x0000,0xE4CD,0x3154,0xE4CE,0x0000,
- 0xE4CF,0x0000,0x4946,0x4372,0x0000,0x0000,0x0000,0x0000,
- 0x3578,0xE4D0,0x6E7C,0xE4D1,0x395D,0x0000,0x0000,0xE4D2,
-
- /* 9300h */
- 0xE4D3,0x0000,0xE4D4,0x0000,0x0000,0x0000,0x3B2C,0x0000,
- 0xE4D5,0x0000,0x0000,0x0000,0x0000,0xE4D6,0x0000,0x6E7B,
- 0x3F6D,0xE4D7,0x0000,0x0000,0xE4D8,0xE4D9,0x0000,0x0000,
- 0x3F6E,0x6F21,0x6F23,0x0000,0xE4DA,0xE4DB,0xE4DC,0xE4DD,
- 0x3E7B,0xE4DE,0x6F22,0x6F24,0xE4DF,0xE4E0,0x3653,0xE4E1,
- 0x4945,0xE4E2,0xE4E3,0x3C62,0x4F23,0x0000,0x6E7E,0x3A78,
- 0x0000,0x0000,0x4F3F,0xE4E4,0xE4E5,0x6F26,0xE4E6,0xE4E7,
- 0x0000,0x0000,0x6F25,0x6F27,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x6E7D,0x0000,0x0000,0xE4E8,
- 0xE4E9,0xE4EA,0x0000,0x4669,0x0000,0x4555,0x0000,0x0000,
- 0xE4EB,0xE4EC,0xE4ED,0x0000,0x4457,0xE4EE,0x6F2C,0xE4EF,
- 0xE4F0,0x0000,0xE4F1,0x4343,0x6F28,0x0000,0xE4F2,0x0000,
- 0x6F29,0x0000,0x0000,0x0000,0xE4F3,0xE4F4,0x0000,0xE4F5,
- 0x0000,0xE4F6,0xE4F7,0x0000,0x372D,0xE4F8,0x6F2B,0xE4F9,
- 0xE4FA,0xE4FB,0x0000,0xE4FC,0xE4FD,0x3830,0xE4FE,0x0000,
- 0x0000,0x0000,0xE5A1,0x0000,0x6F2A,0xE5A2,0x3E61,0xE5A3,
- 0xE5A4,0xE5A5,0xE5A6,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xE5A7,0x0000,0xE5A8,0xE5A9,0x3379,0xE5AA,0x0000,0xE5AB,
- 0x0000,0x0000,0xE5AC,0x0000,0x6F30,0xE5AD,0x3A3F,0x4179,
- 0xE5AE,0x0000,0x444A,0xE5AF,0x0000,0x0000,0xE5B0,0x0000,
- 0x0000,0xE5B1,0x0000,0xE5B2,0xE5B3,0x0000,0xE5B4,0x333B,
- 0xE5B5,0xE5BB,0x0000,0xE5B6,0x6F2E,0x6F2F,0x4443,0x0000,
- 0x6F2D,0x0000,0x0000,0x0000,0xE5B7,0xE5B8,0xE5B9,0x0000,
- 0x0000,0x6F31,0xE5BA,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xE5BC,0x0000,0x6F37,0xE5BD,0xE5BE,0xE5BF,0xE5C0,
- 0x6F3A,0xE5C1,0xE5C2,0xE5C3,0xE5C4,0xE5C5,0x0000,0x0000,
- 0x6F39,0x452D,0x0000,0xE5C6,0x0000,0x0000,0x6F32,0x6F33,
- 0x6F36,0xE5C7,0x0000,0x0000,0xE5C8,0x6F38,0xE5C9,0xE5CA,
- 0x0000,0x3640,0xE5CB,0x0000,0x6F3B,0x6F35,0xE5CC,0xE5CD,
- 0x6F34,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xE5CF,
- 0xE5D0,0xE5CE,0xE5D1,0xE5D2,0x0000,0xE5D3,0x0000,0x0000,
-
- /* 9400h */
- 0x0000,0xE5D4,0xE5D5,0x6F3F,0xE5D6,0x0000,0x0000,0x6F40,
- 0xE5D7,0xE5D8,0x0000,0x0000,0x0000,0xE5D9,0xE5DA,0xE5DB,
- 0x6F41,0x0000,0x0000,0x6F3E,0x6F3D,0xE5DC,0xE5DD,0xE5DE,
- 0x3E62,0x462A,0x6F3C,0x0000,0x0000,0x0000,0x0000,0xE5DF,
- 0x0000,0x6F45,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x6F43,0x0000,0x0000,0xE5E0,0xE5E1,
- 0x0000,0xE5E2,0xE5E3,0xE5E4,0xE5E5,0x6F44,0x6F42,0x0000,
- 0x4278,0x0000,0x6F46,0xE5E6,0x0000,0xE5E8,0x0000,0xE5E7,
- 0x0000,0x6F47,0x0000,0xE5E9,0x6F49,0xE5EA,0x0000,0x0000,
- 0xE5EB,0x0000,0xE5EC,0x0000,0xE5ED,0x0000,0x0000,0x0000,
- 0x0000,0x3455,0x6F48,0x4C7A,0x0000,0xE5EE,0x0000,0x0000,
- 0x0000,0xE5EF,0x6F54,0x6F4A,0xE5F0,0x0000,0x6F4D,0xE5F1,
- 0x6F4B,0xE5F2,0x6F4C,0xE5F3,0x0000,0x0000,0x0000,0x0000,
- 0xE5F4,0x0000,0x6F4E,0xE5F5,0x0000,0xE5F6,0xE5F7,0xE5F8,
- 0x6F50,0xE5F9,0xE5FA,0x0000,0x0000,0x6F51,0x0000,0x6F52,
- 0x0000,0x0000,0x0000,0x0000,0x6F55,0x6F53,0x6F56,0x6F58,
- 0x0000,0x6F57,0x0000,0xE5FC,0xE5FB,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 9500h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x4439,
- 0xE5FD,0xE5FE,0x0000,0x0000,0x0000,0x0000,0xE6A1,0x0000,
- 0x4C67,0x0000,0x6F59,0x412E,0xE6A2,0x0000,0x0000,0x6F5A,
- 0xE6A3,0x4A44,0x6F5B,0x332B,0xE6A4,0xE6A5,0xE6A6,0x313C,
- 0x0000,0x3457,0x0000,0x3456,0x6F5C,0x0000,0x6F5D,0x0000,
- 0x6F5E,0x6F5F,0x0000,0x0000,0x0000,0xE6A7,0xE6A8,0xE6A9,
- 0x6F60,0xE6AA,0x3458,0x3355,0x395E,0x4836,0xE6AB,0x6F62,
- 0x6F61,0xE6AC,0x0000,0xE6AD,0xE6AE,0x6F63,0x0000,0x0000,
- 0x0000,0x0000,0x315C,0x0000,0xE6AF,0x0000,0xE6B0,0x0000,
- 0x0000,0x6F66,0xE6B1,0x6F65,0x6F64,0xE6B2,0x6F67,0xE6B3,
- 0x0000,0x0000,0x0000,0x6F6A,0x0000,0x0000,0xE6B4,0x3047,
- 0xE6B5,0xE6B6,0x6F68,0xE6B7,0x6F6C,0x6F6B,0x0000,0x0000,
- 0xE6B8,0xE6B9,0xE6BA,0xE6BB,0x6F6E,0x6F6D,0x6F6F,0x0000,
- 0x462E,0xE6BC,0xE6BD,0x0000,0x6F70,0xE6BE,0xE6BF,0xE6C0,
- 0xE6C1,0x6F71,0x6F73,0x0000,0xE6C2,0x6F72,0xE6C3,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 9600h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x496C,0xE6C4,0xE6C5,0x0000,
- 0x0000,0x6F74,0xE6C6,0x0000,0xE6C7,0xE6C8,0xE6C9,0x0000,
- 0x6F75,0x0000,0x3A65,0x0000,0xE6CA,0x0000,0x6F76,0x6F77,
- 0x0000,0xE6CB,0x4B49,0xE6CC,0x0000,0x0000,0x0000,0xE6CD,
- 0xE6CE,0xE6CF,0xE6D0,0x414B,0xE6D1,0xE6D2,0x0000,0x3024,
- 0x424B,0xE6D3,0x6F78,0x0000,0x496D,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x6F7B,0x6F79,0x395F,0x0000,0x6F7A,
- 0x3842,0x0000,0xE6D4,0x0000,0xE6D5,0x0000,0xE6D6,0xE6D7,
- 0xE6D8,0x0000,0x0000,0x4A45,0x6F7D,0x7021,0x6F7E,0x7022,
- 0x0000,0xE6D9,0x3121,0x3F58,0x3D7C,0x3459,0x7023,0x0000,
- 0x0000,0x0000,0x4766,0x0000,0x7025,0x0000,0xE6DA,0x0000,
- 0x3122,0x0000,0x7024,0x4444,0xE6DB,0x4E4D,0x462B,0x6F7C,
- 0x4E26,0x0000,0x3831,0xE6DC,0xE6DD,0x4D5B,0xE6DE,0xE6DF,
- 0x0000,0xE6E0,0xE6E1,0xE6E2,0xE6E3,0x3679,0x4E34,0x0000,
- 0x3728,0xE6E4,0x4262,0x6721,0x0000,0x7026,0x332C,0x3F6F,
- 0x0000,0xE6E5,0x0000,0x0000,0x3356,0x7028,0xE6E6,0x7029,
- 0x7027,0x3764,0xE6E7,0x3A5D,0x3E63,0xE6E8,0x0000,0xE6E9,
- 0x3123,0x0000,0x0000,0x4E59,0xE6EA,0xE6EB,0xE6EC,0x702B,
- 0x6E2E,0xE6ED,0x702A,0x0000,0x0000,0x0000,0xE6EE,0xE6EF,
- 0x702E,0x702C,0x702D,0xE6F0,0x702F,0x0000,0x7030,0x4E6C,
- 0x7031,0x7032,0xE6F1,0x4049,0x483B,0x0000,0x0000,0x0000,
- 0x3F7D,0x3467,0x0000,0x0000,0x4D3A,0x326D,0x3D38,0x385B,
- 0x0000,0x7035,0xE6F2,0x7034,0x3B73,0x7036,0x7033,0x0000,
- 0x0000,0x3B28,0xE6F3,0x0000,0x0000,0x703A,0x6A2D,0x0000,
- 0xE6F5,0x5256,0xE6F6,0x3F77,0x7038,0xE6F7,0xE6F8,0xE6F9,
- 0x0000,0x0000,0x4E25,0x4671,0x0000,0x0000,0x0000,0x0000,
- 0x312B,0xE6FA,0x4063,0x3C36,0x0000,0x0000,0x0000,0xE6FB,
- 0x4A37,0xE6FC,0x3140,0x0000,0x0000,0x0000,0x4E6D,0x4D6B,
- 0x0000,0x703B,0xE6FD,0x4545,0x0000,0x0000,0x0000,0x0000,
-
- /* 9700h */
- 0x3C7B,0x0000,0xE6FE,0xE7A1,0x703C,0xE7A2,0x703D,0x3F4C,
- 0x703E,0xE7A3,0x4E6E,0x0000,0x0000,0x7039,0x7040,0x7042,
- 0x0000,0x7041,0x0000,0x703F,0x0000,0x0000,0x7043,0x0000,
- 0x0000,0x7044,0xE7A4,0xE7A5,0x417A,0xE7A6,0x3262,0x0000,
- 0x0000,0xE7A7,0xE7A8,0xE7A9,0x7045,0x0000,0x0000,0x4C38,
- 0xE7AA,0x0000,0x7046,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x7047,0xE7AB,0x4F2A,0xE7AC,0x0000,0x0000,0x0000,0x0000,
- 0x5B31,0x7048,0x0000,0x0000,0x0000,0x7049,0x704A,0x0000,
- 0x0000,0xE7AD,0x704E,0xE7AE,0x704B,0x0000,0x704C,0x0000,
- 0x704D,0x704F,0xE7AF,0x0000,0x0000,0x0000,0xE7B0,0xE7B1,
- 0x0000,0x0000,0x4044,0x0000,0x0000,0xE7B2,0x4C77,0xE7B3,
- 0xE7B4,0x4045,0xE7B5,0xE7B6,0x7050,0x0000,0x4873,0x0000,
- 0x7051,0x7353,0x4C4C,0xE7B7,0x7052,0x0000,0x7053,0xE7B8,
- 0x7054,0x3357,0xE7B9,0x7056,0x0000,0x3F59,0xE7BA,0x0000,
- 0x0000,0x7057,0x0000,0xE7BB,0x3724,0x0000,0xE7BC,0xE7BD,
- 0xE7BE,0x7058,0x705C,0xE7BF,0x705A,0xE7C0,0x0000,0xE7C1,
- 0xE7C2,0x705B,0x0000,0x0000,0x3373,0x7059,0x705D,0x0000,
- 0x0000,0xE7C3,0x0000,0x705E,0x0000,0x3048,0x0000,0x705F,
- 0x7060,0x0000,0x0000,0x0000,0x0000,0xE7C4,0xE7C5,0xE7C6,
- 0x3E64,0xE7C7,0xE7C8,0x0000,0x7061,0x0000,0xE7C9,0xE7CA,
- 0x3547,0x0000,0xE7CB,0x7064,0x0000,0x0000,0x7063,0x0000,
- 0x7062,0x0000,0x0000,0x6B71,0xE7CC,0x4A5C,0xE7CD,0x0000,
- 0x0000,0xE7CE,0xE7CF,0x7065,0x7066,0xE7D0,0xE7D1,0x0000,
- 0xE7D2,0xE7D3,0xE7D4,0x0000,0xE7D5,0x0000,0xE7D6,0xE7D7,
- 0x0000,0xE7D8,0x0000,0x7067,0xE7D9,0xE7DA,0x7068,0xE7DB,
- 0x7069,0xE7DC,0xE7DD,0x706A,0xE7DE,0xE7DF,0xE7E0,0x0000,
- 0xE7E1,0xE7E2,0x0000,0x345A,0xE7E3,0x0000,0x0000,0xE7E4,
- 0xE7E5,0xE7E6,0x0000,0xE7EA,0x706B,0xE7E7,0xE7E8,0x0000,
- 0xE7E9,0xE7EB,0x0000,0x0000,0xE7EC,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x706C,0x4723,0xE7ED,
- 0x0000,0xE7EE,0x706E,0x323B,0xE7EF,0x7071,0x7070,0xE7F0,
- 0xE7F1,0x0000,0xE7F2,0x3124,0x0000,0x0000,0x0000,0x3641,
-
- /* 9800h */
- 0x0000,0x4A47,0x443A,0x3A22,0x0000,0x3960,0x3D67,0xE7F3,
- 0x3F5C,0x0000,0xE7F4,0x0000,0x7073,0xE7F6,0xE7F7,0x7072,
- 0x4D42,0x3468,0x4852,0x465C,0xE7F8,0x0000,0xE7F9,0x3F7C,
- 0x4E4E,0xE7F5,0x375B,0x0000,0xE7FA,0x0000,0xE7FB,0x0000,
- 0xE7FC,0x7076,0x0000,0xE7FD,0x7075,0xE8A8,0xE7FE,0x0000,
- 0x0000,0x0000,0x0000,0xE8A1,0x4B4B,0x462C,0xE8A2,0xE8A3,
- 0xE8A4,0x0000,0xE8A5,0xE8A6,0x3150,0xE8A7,0x0000,0x7077,
- 0x7074,0x0000,0x0000,0x4951,0x4D6A,0x7078,0xE8A9,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0xE8AA,0x0000,0x7079,0xE8AB,
- 0x0000,0x0000,0xE8AC,0x707B,0x426A,0x335B,0x335C,0x707A,
- 0x0000,0xE8AD,0xE8AE,0xE8AF,0x3469,0x3832,0xE8B0,0xE8B1,
- 0x346A,0xE8B2,0xE8B3,0x453F,0x0000,0x0000,0x4E60,0x0000,
- 0x0000,0x0000,0xE8B4,0xE8B5,0x0000,0xE8B6,0xE8B7,0x385C,
- 0x0000,0x0000,0xE8B8,0x707C,0xE8B9,0x0000,0x0000,0x707D,
- 0x707E,0x7121,0x0000,0x7123,0x7122,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x4977,0x0000,0x7124,0xE8BA,0x0000,0xE8BB,0xE8BC,0x7125,
- 0xE8BD,0x7126,0x0000,0x0000,0xE8BE,0x0000,0x7127,0xE8BF,
- 0xE8C0,0x0000,0xE8C1,0xE8C2,0x0000,0x0000,0x0000,0xE8C3,
- 0x0000,0x0000,0xE8C4,0x7129,0x7128,0xE8C5,0x712A,0x0000,
- 0xE8C6,0x0000,0x0000,0x0000,0xE8C7,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x4874,0x664C,0x0000,0x0000,0x3F29,
- 0x0000,0xE8C8,0x3532,0xE8C9,0x0000,0xE8CA,0xE8CB,0xE8CC,
- 0x0000,0x712B,0xE8CD,0x712C,0x0000,0x522C,0x5D3B,0x4853,
- 0x0000,0x0000,0x307B,0xE8CE,0x303B,0x0000,0xE8CF,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x3B74,0x4B30,0x3E7E,0x0000,
-
- /* 9900h */
- 0x0000,0x0000,0xE8D0,0x712D,0x0000,0x4C5F,0x0000,0xE8D1,
- 0xE8D2,0x712E,0x4D5C,0x0000,0x3142,0x0000,0x0000,0x0000,
- 0x3B41,0xE8D3,0x712F,0x326E,0x7130,0xE8D4,0xE8D5,0xE8D6,
- 0x7131,0x0000,0xE8D7,0xE8D8,0xE8D9,0x7133,0x7134,0xE8DA,
- 0x7136,0x7132,0xE8DB,0x0000,0x7135,0x0000,0xE8DC,0xE8DD,
- 0x345B,0x0000,0x0000,0xE8DE,0x7137,0x0000,0x7138,0x0000,
- 0x0000,0xE8DF,0xE8E0,0xE8E1,0xE8E2,0xE8E3,0x0000,0x0000,
- 0x0000,0xE8E4,0xE8E5,0xE8E6,0xE8E7,0x7139,0x713A,0x0000,
- 0xE8E8,0xE8E9,0x713B,0x0000,0x0000,0x713D,0xE8EA,0xE8EB,
- 0xE8EC,0x713C,0x0000,0x713F,0x7142,0xE8ED,0xE8EE,0x0000,
- 0x713E,0x7140,0x7141,0x0000,0xE8EF,0x7143,0x0000,0x3642,
- 0xE8F0,0xE8F1,0x0000,0xE8F2,0xE8F3,0x0000,0xE8F4,0xE8F5,
- 0xE8F6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3C73,0x7144,
- 0x7145,0x3961,0x0000,0xE8F7,0x0000,0xE8F8,0x0000,0xE8F9,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x7146,0xE8FA,0x0000,
- 0x333E,0x0000,0x0000,0x0000,0x474F,0x7147,0x7148,0x0000,
- 0xE8FB,0xE8FC,0xE8FD,0x435A,0x466B,0xE8FE,0x0000,0x0000,
- 0x0000,0xE9A1,0xE9A2,0x0000,0x7149,0xE9A3,0x0000,0xE9A4,
- 0x0000,0x477D,0x0000,0xE9A5,0x424C,0x3158,0x366E,0x0000,
- 0x366F,0xE9A6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x4373,0x714E,0x3670,0xE9A7,0xE9A8,0x326F,0x0000,0x0000,
- 0x714D,0xE9A9,0xE9AA,0x714B,0xE9AB,0x714C,0xE9AC,0x714A,
- 0x0000,0x0000,0x7158,0x0000,0x0000,0x0000,0x0000,0xE9AD,
- 0x0000,0x0000,0xE9AE,0xE9AF,0xE9B0,0x714F,0x7150,0x0000,
- 0xE9B1,0x7151,0x7152,0x0000,0xE9B2,0xE9B3,0x0000,0x0000,
- 0x7154,0xE9B4,0x0000,0x7153,0x0000,0xE9B5,0xE9B6,0x3D59,
-
- /* 9A00h */
- 0x0000,0x7155,0xE9B7,0xE9B8,0xE9B9,0x7157,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xE9BA,0xE9BB,0x0000,0x3533,0x7156,
- 0xE9BC,0xE9BD,0x417B,0x3833,0x0000,0x0000,0xE9BE,0x0000,
- 0x0000,0x7159,0x0000,0x0000,0x0000,0x0000,0xE9BF,0x0000,
- 0xE9C0,0x0000,0xE9C1,0xE9C2,0xE9C3,0x0000,0x0000,0xE9C4,
- 0x424D,0x0000,0x0000,0x715A,0x0000,0xE9C5,0xE9C6,0x0000,
- 0x462D,0x0000,0x0000,0xE9C7,0x0000,0xE9C8,0xE9C9,0x715B,
- 0xE9CA,0x0000,0x0000,0x0000,0x0000,0x0000,0x7160,0x0000,
- 0x715E,0xE9CC,0x715D,0x715F,0xE9CD,0x715C,0x0000,0xE9CB,
- 0x0000,0x0000,0xE9CE,0xE9CF,0xE9D0,0x7162,0xE9D1,0x0000,
- 0x0000,0xE9D2,0x0000,0x0000,0xE9D3,0x7161,0xE9D4,0x7164,
- 0x0000,0x0000,0x3643,0x7163,0x0000,0xE9D5,0x0000,0x7165,
- 0x0000,0x0000,0x7166,0x0000,0x7168,0x7167,0x0000,0x0000,
- 0x0000,0x7169,0x716B,0x716A,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x397C,0x0000,0xE9D6,0x0000,0xE9D7,0x716C,0xE9D8,0xE9D9,
- 0x716D,0x0000,0xE9DA,0x0000,0xE9DB,0xE9DC,0xE9DD,0x0000,
- 0x333C,0xE9DE,0x0000,0xE9DF,0x716E,0x0000,0xE9E0,0xE9E1,
- 0x716F,0xE9E2,0x0000,0xE9E3,0x3F71,0x0000,0xE9E4,0x0000,
- 0xE9E5,0x0000,0x0000,0x0000,0x0000,0x0000,0xE9E6,0x7170,
- 0xE9E7,0x7171,0xE9E8,0x7172,0x7173,0xE9E9,0xE9EA,0xE9EB,
- 0x3962,0x0000,0x0000,0xE9EC,0xE9ED,0x0000,0x7174,0x7175,
- 0xE9EE,0x0000,0x7176,0x7177,0xE9EF,0xE9F0,0x7178,0xE9F1,
- 0x0000,0xE9F2,0x4831,0x717A,0xE9F3,0x4926,0x717B,0x7179,
- 0x0000,0x717D,0xE9F4,0xE9F5,0x717C,0xE9F6,0x0000,0x717E,
- 0x0000,0xE9F7,0xE9F8,0x7221,0x0000,0xE9F9,0x0000,0xE9FA,
-
- /* 9B00h */
- 0xE9FB,0xE9FC,0xE9FD,0xE9FE,0xEAA1,0xEAA2,0x7222,0x0000,
- 0xEAA3,0xEAA4,0x0000,0xEAA5,0xEAA6,0xEAA7,0xEAA8,0x0000,
- 0xEAA9,0x0000,0xEAAA,0x0000,0x0000,0x0000,0xEAAB,0x0000,
- 0x7223,0xEAAC,0x7224,0xEAAD,0xEAAE,0x0000,0x0000,0x7225,
- 0xEAAF,0x0000,0x7226,0x7227,0x0000,0x7228,0xEAB0,0x7229,
- 0x722A,0x722B,0x722C,0xEAB1,0x0000,0xEAB2,0x722D,0x722E,
- 0x0000,0x5D35,0x722F,0xEAB3,0xEAB4,0xEAB5,0x0000,0xEAB6,
- 0x0000,0xEAB7,0xEAB8,0x6478,0x3534,0xEAB9,0x0000,0x0000,
- 0x0000,0x3321,0x3A32,0x7231,0x7230,0x4C25,0x0000,0x0000,
- 0xEABA,0x0000,0x0000,0xEABB,0xEABC,0x7233,0x7234,0x7232,
- 0x0000,0x7235,0x0000,0x0000,0x4B62,0xEABD,0xEABE,0xEABF,
- 0x7236,0x0000,0x357B,0xEAC0,0x0000,0x0000,0xEAC1,0x0000,
- 0x0000,0xEAC2,0x0000,0xEAC3,0x0000,0xEAC4,0xEAC5,0x0000,
- 0xEAC6,0x0000,0xEAC7,0xEAC8,0xEAC9,0xEACA,0xEACB,0x4F25,
- 0x0000,0x0000,0x0000,0xEACC,0x7237,0xEACD,0x0000,0xEACE,
- 0xEACF,0xEAD0,0x0000,0x0000,0x0000,0x0000,0x0000,0xEAD1,
- 0xEAD2,0x0000,0x0000,0x7239,0xEAD3,0xEAD4,0xEAD5,0xEAD6,
- 0x0000,0xEAD7,0xEAD8,0xEAD9,0x0000,0xEADA,0x303E,0xEADB,
- 0xEADC,0x723A,0x4A2B,0x7238,0xEADD,0x0000,0x723B,0x723C,
- 0x0000,0x0000,0xEADE,0x0000,0x0000,0xEADF,0xEAE0,0x723D,
- 0x723E,0x0000,0x0000,0x0000,0x0000,0x0000,0xEAE1,0xEAE2,
- 0x723F,0xEAE3,0x4B6E,0x3B2D,0xEAE4,0x3A7A,0x412F,0x0000,
- 0xEAE5,0xEAE6,0xEAE7,0x0000,0x7240,0x0000,0x0000,0xEAE8,
- 0xEAE9,0x7243,0x0000,0xEAEA,0xEAEB,0x0000,0xEAEC,0xEAED,
- 0x7241,0xEAEE,0x0000,0x0000,0x0000,0x0000,0x7244,0xEAEF,
- 0xEAF0,0x3871,0x7242,0x0000,0x0000,0x0000,0xEAF1,0x7245,
- 0xEAF2,0x7246,0x7247,0x0000,0x724B,0x0000,0x3B2A,0xEAF3,
- 0xEAF4,0x0000,0x0000,0x4264,0x0000,0xEAF5,0x0000,0xEAF6,
- 0x0000,0x724C,0x7249,0x7248,0x724A,0xEAF7,0x0000,0xEAF8,
- 0x375F,0x0000,0xEAF9,0xEAFA,0x0000,0x0000,0x0000,0xEAFB,
- 0x7250,0x724F,0x724E,0xEAFC,0x0000,0x3033,0x0000,0xEAFD,
- 0xEAFE,0xEBA1,0xEBA2,0x0000,0x0000,0xEBA3,0x0000,0xEBA4,
-
- /* 9C00h */
- 0xEBA5,0x0000,0xEBA6,0x0000,0x725A,0x0000,0x7256,0x0000,
- 0x7257,0x7253,0x7259,0xEBA7,0x7255,0x3362,0x0000,0xEBA8,
- 0x4F4C,0xEBA9,0x7258,0x7254,0x7252,0x7251,0xEBAA,0x0000,
- 0xEBAB,0xEBAC,0xEBAD,0x725C,0xEBAE,0x0000,0xEBAF,0x0000,
- 0x0000,0x725F,0xEBB0,0xEBB1,0x725E,0x725D,0xEBB2,0xEBB3,
- 0xEBB4,0xEBB5,0xEBB6,0x0000,0x0000,0x4949,0x725B,0x3073,
- 0x7260,0xEBB7,0x7262,0x0000,0x0000,0xEBB8,0xEBB9,0xEBBA,
- 0x0000,0x336F,0x724D,0x3137,0x0000,0xEBBB,0x7264,0x0000,
- 0x0000,0xEBBC,0x0000,0xEBBD,0xEBBE,0xEBBF,0x7263,0x7261,
- 0x432D,0xEBC0,0xEBC1,0x0000,0x0000,0x0000,0xEBC2,0xEBC3,
- 0xEBC4,0x0000,0x4B70,0xEBC5,0xEBC6,0x0000,0xEBC7,0x4E5A,
- 0xEBC8,0x0000,0x7265,0xEBC9,0xEBD0,0xEBCA,0xEBCB,0xEBCC,
- 0x7266,0x0000,0x0000,0xEBCD,0x0000,0x0000,0x0000,0x7267,
- 0xEBD2,0xEBCE,0xEBCF,0xEBD1,0x0000,0x0000,0xEBD3,0x0000,
- 0xEBD4,0x0000,0xEBD5,0x0000,0x0000,0xEBD6,0x7268,0xEBD7,
- 0x7269,0x0000,0x0000,0xEBD8,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x443B,0xEBD9,0x726A,
- 0x0000,0x4837,0x0000,0x726F,0x726B,0x0000,0x0000,0x0000,
- 0x726C,0x0000,0xEBDA,0x4B31,0x4C44,0x0000,0x4650,0xEBDB,
- 0x0000,0xEBDC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 9D00h */
- 0x0000,0x0000,0xEBDE,0x7270,0x0000,0x0000,0x7271,0x463E,
- 0x726E,0x726D,0x0000,0xEBDD,0x0000,0x0000,0x322A,0x0000,
- 0x0000,0xEBDF,0x7279,0x0000,0x0000,0x7278,0x0000,0xEBE0,
- 0xEBE1,0x0000,0x0000,0x3175,0xEBE2,0xEBE3,0xEBE4,0x7276,
- 0x0000,0x0000,0x0000,0x7275,0x0000,0x0000,0x7273,0x0000,
- 0x337B,0x0000,0x7272,0x3C32,0x3229,0x0000,0x0000,0xEBE5,
- 0xEBE6,0x0000,0xEBE7,0xEBE8,0xEBE9,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xEBEA,0x3963,0xEBEB,0xEBED,0x727C,0x727B,
- 0x0000,0x727A,0xEBEE,0xEBEF,0x7277,0xEBEC,0x727D,0xEBF0,
- 0x727E,0x0000,0xEBF1,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x7325,0x7324,0x0000,0xEBF2,0xEBF3,0x0000,0x0000,0x0000,
- 0x0000,0x7326,0x0000,0x0000,0x312D,0x7321,0x7322,0xEBF4,
- 0x3974,0x4C39,0xEBF6,0xEBF5,0x7323,0xEBF7,0x0000,0x0000,
- 0x0000,0xEBF8,0xEBF9,0xEBFA,0x4B32,0x0000,0x0000,0x732B,
- 0xEBFB,0x0000,0x7327,0x0000,0x0000,0x0000,0xEBFC,0xEBFD,
- 0x0000,0x0000,0x732C,0xEBFE,0xECA1,0x0000,0xECA2,0x0000,
- 0x0000,0x0000,0x0000,0xECA3,0xECA4,0x0000,0xECA5,0x7329,
- 0x0000,0x7328,0xECA6,0x0000,0x0000,0xECA7,0xECA8,0x375C,
- 0x0000,0x0000,0xECA9,0xECAA,0x0000,0xECAB,0xECAC,0xECAD,
- 0xECAE,0x0000,0x732D,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xECAF,0x0000,0x0000,0x732E,0x0000,0x0000,0x0000,
- 0x0000,0x732F,0xECB0,0x732A,0xECB1,0x0000,0xECB2,0x7274,
- 0x0000,0xECB3,0x7330,0x0000,0x4461,0xECB4,0x0000,0x0000,
- 0x7334,0xECB5,0x7335,0x7333,0xECB6,0x0000,0x0000,0xECB7,
- 0x0000,0x7332,0x7338,0xECB8,0x7331,0x0000,0x7336,0xECB9,
- 0x0000,0xECBA,0xECBB,0x0000,0x0000,0x0000,0x0000,0x7337,
- 0x0000,0x0000,0x0000,0x733A,0xECBC,0xECBD,0xECBE,0xECBF,
- 0x0000,0x7339,0xECC0,0x0000,0x0000,0x0000,0xECC1,0xECC2,
- 0xECC3,0x0000,0x0000,0x0000,0x0000,0xECC4,0x733C,0xECC5,
- 0x0000,0xECC6,0x0000,0xECC7,0x0000,0x733D,0xECC8,0x733E,
- 0xECC9,0x0000,0x4F49,0xECCA,0xECCB,0x0000,0x0000,0x0000,
- 0x733B,0x426B,0x3A6D,0x0000,0x0000,0x733F,0xECCC,0x0000,
-
- /* 9E00h */
- 0x0000,0x0000,0xECCE,0x0000,0x0000,0x0000,0x0000,0xECCF,
- 0x0000,0x0000,0xECCD,0x0000,0x0000,0x0000,0xECD0,0x0000,
- 0xECD1,0xECD2,0xECD3,0x0000,0x0000,0xECD4,0xECD5,0x0000,
- 0x0000,0xECD6,0x7340,0x7341,0xECD7,0xECD8,0x7342,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x7343,0x0000,0x0000,
- 0x3834,0x7344,0xECD9,0xECDA,0xECDB,0x7345,0x0000,0x3C2F,
- 0xECDC,0x7346,0xECDD,0xECDE,0xECDF,0xECE0,0x0000,0xECE1,
- 0x7347,0x0000,0x0000,0x7348,0x7349,0x0000,0xECE2,0xECE3,
- 0x0000,0x734C,0x734A,0x4F3C,0x0000,0x734B,0xECE4,0x4E6F,
- 0xECE5,0x0000,0x0000,0xECE6,0x0000,0x734D,0xECE7,0x4E5B,
- 0x0000,0x0000,0x0000,0x0000,0xECE8,0x734E,0x477E,0x0000,
- 0xECE9,0x734F,0x7351,0x0000,0xECEA,0x7352,0xECEB,0xECEC,
- 0xECED,0x0000,0x0000,0xECEE,0xECEF,0xECF0,0x0000,0x0000,
- 0x7350,0x396D,0x4C4D,0x4B63,0x5677,0x0000,0x5D60,0x4B7B,
- 0x0000,0x0000,0x0000,0x0000,0x322B,0x0000,0xECF1,0x0000,
- 0xECF2,0x0000,0x0000,0xECF3,0x7354,0x3550,0x7355,0x7356,
- 0x7357,0x0000,0x3975,0x0000,0x7358,0xECF4,0x0000,0x0000,
- 0x6054,0x4C5B,0x0000,0x4263,0x7359,0x735B,0x735A,0xECF5,
- 0x735C,0x0000,0x0000,0x0000,0xECF6,0x735D,0x0000,0xECF7,
- 0x735E,0x0000,0x0000,0x0000,0xECF8,0xECF9,0xECFA,0x735F,
- 0xECFB,0xECFC,0xECFD,0x0000,0x7360,0xECFE,0x7361,0x7362,
- 0xEDA1,0x7363,0x0000,0x7364,0x7365,0x7366,0x0000,0xEDA2,
-
- /* 9F00h */
- 0x0000,0x0000,0xEDA3,0xEDA4,0x0000,0x0000,0x0000,0x7367,
- 0x7368,0xEDA5,0x0000,0x0000,0x0000,0x0000,0x4524,0xEDA6,
- 0xEDA7,0xEDA8,0xEDA9,0x385D,0xEDAA,0x736A,0xEDAB,0xEDAC,
- 0x0000,0xEDAD,0xEDAE,0xEDAF,0x0000,0x0000,0x0000,0xEDB0,
- 0x414D,0x736B,0xEDB1,0x0000,0x0000,0x0000,0xEDB2,0x0000,
- 0x0000,0x0000,0xEDB3,0xEDB4,0x736C,0x0000,0x0000,0xEDB5,
- 0x0000,0xEDB6,0xEDB7,0x0000,0xEDB8,0x0000,0x0000,0xEDB9,
- 0x0000,0xEDBA,0xEDBB,0x4921,0xEDBC,0xEDBD,0x736D,0xEDBE,
- 0x0000,0xEDBF,0x0000,0xEDC0,0xEDC1,0xEDC2,0xEDC3,0xEDC4,
- 0x0000,0x0000,0x736E,0x6337,0x0000,0x0000,0x6C5A,0x706D,
- 0x0000,0x0000,0x736F,0xEDC5,0x7370,0xEDC6,0xEDC7,0xEDC8,
- 0xEDC9,0x0000,0xEDCA,0x0000,0x0000,0xEDCB,0xEDCC,0x7372,
- 0x7373,0x7374,0x4E70,0x7371,0x0000,0x0000,0x7375,0x7376,
- 0xEDCD,0xEDCE,0x7378,0x0000,0x7377,0xEDCF,0xEDD0,0xEDD1,
- 0xEDD2,0xEDD3,0x737A,0xEDD4,0x0000,0xEDD5,0x737B,0x7379,
- 0x0000,0x0000,0xEDD6,0x0000,0x0000,0xEDD7,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x4E36,0x0000,0xEDD8,
- 0xEDD9,0xEDDA,0xEDDB,0x0000,0xEDDC,0x737C,0xEDDD,0xEDDE,
- 0x0000,0x0000,0x0000,0x0000,0x737D,0x6354,0xEDDF,0x0000,
- 0x737E,0xEDE0,0xEDE1,0xEDE2,0x0000,0xEDE3,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-static const int ucs_i_jis_table_min = 0x4E00;
-static const int ucs_i_jis_table_max = 0x4E00 + (sizeof (ucs_i_jis_table) / sizeof (unsigned short));
-
-
-static const unsigned short ucs_r_jis_table[] = {
- /* FF00h */
- 0x0000,0x212A,0x0000,0x2174,0x2170,0x2173,0x2175,0x0000,
- 0x214A,0x214B,0x2176,0x215C,0x2124,0x0000,0x2125,0x213F,
- 0x2330,0x2331,0x2332,0x2333,0x2334,0x2335,0x2336,0x2337,
- 0x2338,0x2339,0x2127,0x2128,0x2163,0x2161,0x2164,0x2129,
- 0x2177,0x2341,0x2342,0x2343,0x2344,0x2345,0x2346,0x2347,
- 0x2348,0x2349,0x234A,0x234B,0x234C,0x234D,0x234E,0x234F,
- 0x2350,0x2351,0x2352,0x2353,0x2354,0x2355,0x2356,0x2357,
- 0x2358,0x2359,0x235A,0x214E,0x2140,0x214F,0x2130,0x2132,
- 0x212E,0x2361,0x2362,0x2363,0x2364,0x2365,0x2366,0x2367,
- 0x2368,0x2369,0x236A,0x236B,0x236C,0x236D,0x236E,0x236F,
- 0x2370,0x2371,0x2372,0x2373,0x2374,0x2375,0x2376,0x2377,
- 0x2378,0x2379,0x237A,0x2150,0x2143,0x2151,0x0000,0x0000,
- 0x0000,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
- 0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
- 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
- 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
- 0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
- 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x2131,0x0000,0x216F
-};
-static const int ucs_r_jis_table_min = 0xFF00;
-static const int ucs_r_jis_table_max = 0xFF00 + (sizeof (ucs_r_jis_table) / sizeof (unsigned short));
-
diff --git a/ext/mbstring/unicode_table_kr.h b/ext/mbstring/unicode_table_kr.h
deleted file mode 100644
index d4f7e78014..0000000000
--- a/ext/mbstring/unicode_table_kr.h
+++ /dev/null
@@ -1,7157 +0,0 @@
-/*
- * Unicode table
- */
-
-static const unsigned short uhc1_ucs_table[] = {
-0xac02,0xac03,0xac05,0xac06,0xac0b,0xac0c,0xac0d,0xac0e,
-0xac0f,0xac18,0xac1e,0xac1f,0xac21,0xac22,0xac23,0xac25,
-0xac26,0xac27,0xac28,0xac29,0xac2a,0xac2b,0xac2e,0xac32,
-0xac33,0xac34,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xac35,0xac36,0xac37,0xac3a,0xac3b,0xac3d,0xac3e,0xac3f,
-0xac41,0xac42,0xac43,0xac44,0xac45,0xac46,0xac47,0xac48,
-0xac49,0xac4a,0xac4c,0xac4e,0xac4f,0xac50,0xac51,0xac52,
-0xac53,0xac55,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xac56,0xac57,0xac59,0xac5a,0xac5b,0xac5d,0xac5e,0xac5f,
-0xac60,0xac61,0xac62,0xac63,0xac64,0xac65,0xac66,0xac67,
-0xac68,0xac69,0xac6a,0xac6b,0xac6c,0xac6d,0xac6e,0xac6f,
-0xac72,0xac73,0xac75,0xac76,0xac79,0xac7b,0xac7c,0xac7d,
-0xac7e,0xac7f,0xac82,0xac87,0xac88,0xac8d,0xac8e,0xac8f,
-0xac91,0xac92,0xac93,0xac95,0xac96,0xac97,0xac98,0xac99,
-0xac9a,0xac9b,0xac9e,0xaca2,0xaca3,0xaca4,0xaca5,0xaca6,
-0xaca7,0xacab,0xacad,0xacae,0xacb1,0xacb2,0xacb3,0xacb4,
-0xacb5,0xacb6,0xacb7,0xacba,0xacbe,0xacbf,0xacc0,0xacc2,
-0xacc3,0xacc5,0xacc6,0xacc7,0xacc9,0xacca,0xaccb,0xaccd,
-0xacce,0xaccf,0xacd0,0xacd1,0xacd2,0xacd3,0xacd4,0xacd6,
-0xacd8,0xacd9,0xacda,0xacdb,0xacdc,0xacdd,0xacde,0xacdf,
-0xace2,0xace3,0xace5,0xace6,0xace9,0xaceb,0xaced,0xacee,
-0xacf2,0xacf4,0xacf7,0xacf8,0xacf9,0xacfa,0xacfb,0xacfe,
-0xacff,0xad01,0xad02,0xad03,0xad05,0xad07,0xad08,0xad09,
-0xad0a,0xad0b,0xad0e,0xad10,0xad12,0xad13,0xad14,0xad15,
-0xad16,0xad17,0xad19,0xad1a,0xad1b,0xad1d,0xad1e,0xad1f,
-0xad21,0xad22,0xad23,0xad24,0xad25,0xad26,0xad27,0xad28,
-0xad2a,0xad2b,0xad2e,0xad2f,0xad30,0xad31,0xad32,0xad33,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xad36,0xad37,
-0xad39,0xad3a,0xad3b,0xad3d,0xad3e,0xad3f,0xad40,0xad41,
-0xad42,0xad43,0xad46,0xad48,0xad4a,0xad4b,0xad4c,0xad4d,
-0xad4e,0xad4f,0xad51,0xad52,0xad53,0xad55,0xad56,0xad57,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xad59,0xad5a,
-0xad5b,0xad5c,0xad5d,0xad5e,0xad5f,0xad60,0xad62,0xad64,
-0xad65,0xad66,0xad67,0xad68,0xad69,0xad6a,0xad6b,0xad6e,
-0xad6f,0xad71,0xad72,0xad77,0xad78,0xad79,0xad7a,0xad7e,
-0xad80,0xad83,0xad84,0xad85,0xad86,0xad87,0xad8a,0xad8b,
-0xad8d,0xad8e,0xad8f,0xad91,0xad92,0xad93,0xad94,0xad95,
-0xad96,0xad97,0xad98,0xad99,0xad9a,0xad9b,0xad9e,0xad9f,
-0xada0,0xada1,0xada2,0xada3,0xada5,0xada6,0xada7,0xada8,
-0xada9,0xadaa,0xadab,0xadac,0xadad,0xadae,0xadaf,0xadb0,
-0xadb1,0xadb2,0xadb3,0xadb4,0xadb5,0xadb6,0xadb8,0xadb9,
-0xadba,0xadbb,0xadbc,0xadbd,0xadbe,0xadbf,0xadc2,0xadc3,
-0xadc5,0xadc6,0xadc7,0xadc9,0xadca,0xadcb,0xadcc,0xadcd,
-0xadce,0xadcf,0xadd2,0xadd4,0xadd5,0xadd6,0xadd7,0xadd8,
-0xadd9,0xadda,0xaddb,0xaddd,0xadde,0xaddf,0xade1,0xade2,
-0xade3,0xade5,0xade6,0xade7,0xade8,0xade9,0xadea,0xadeb,
-0xadec,0xaded,0xadee,0xadef,0xadf0,0xadf1,0xadf2,0xadf3,
-0xadf4,0xadf5,0xadf6,0xadf7,0xadfa,0xadfb,0xadfd,0xadfe,
-0xae02,0xae03,0xae04,0xae05,0xae06,0xae07,0xae0a,0xae0c,
-0xae0e,0xae0f,0xae10,0xae11,0xae12,0xae13,0xae15,0xae16,
-0xae17,0xae18,0xae19,0xae1a,0xae1b,0xae1c,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xae1d,0xae1e,0xae1f,0xae20,
-0xae21,0xae22,0xae23,0xae24,0xae25,0xae26,0xae27,0xae28,
-0xae29,0xae2a,0xae2b,0xae2c,0xae2d,0xae2e,0xae2f,0xae32,
-0xae33,0xae35,0xae36,0xae39,0xae3b,0xae3c,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xae3d,0xae3e,0xae3f,0xae42,
-0xae44,0xae47,0xae48,0xae49,0xae4b,0xae4f,0xae51,0xae52,
-0xae53,0xae55,0xae57,0xae58,0xae59,0xae5a,0xae5b,0xae5e,
-0xae62,0xae63,0xae64,0xae66,0xae67,0xae6a,0xae6b,0xae6d,
-0xae6e,0xae6f,0xae71,0xae72,0xae73,0xae74,0xae75,0xae76,
-0xae77,0xae7a,0xae7e,0xae7f,0xae80,0xae81,0xae82,0xae83,
-0xae86,0xae87,0xae88,0xae89,0xae8a,0xae8b,0xae8d,0xae8e,
-0xae8f,0xae90,0xae91,0xae92,0xae93,0xae94,0xae95,0xae96,
-0xae97,0xae98,0xae99,0xae9a,0xae9b,0xae9c,0xae9d,0xae9e,
-0xae9f,0xaea0,0xaea1,0xaea2,0xaea3,0xaea4,0xaea5,0xaea6,
-0xaea7,0xaea8,0xaea9,0xaeaa,0xaeab,0xaeac,0xaead,0xaeae,
-0xaeaf,0xaeb0,0xaeb1,0xaeb2,0xaeb3,0xaeb4,0xaeb5,0xaeb6,
-0xaeb7,0xaeb8,0xaeb9,0xaeba,0xaebb,0xaebf,0xaec1,0xaec2,
-0xaec3,0xaec5,0xaec6,0xaec7,0xaec8,0xaec9,0xaeca,0xaecb,
-0xaece,0xaed2,0xaed3,0xaed4,0xaed5,0xaed6,0xaed7,0xaeda,
-0xaedb,0xaedd,0xaede,0xaedf,0xaee0,0xaee1,0xaee2,0xaee3,
-0xaee4,0xaee5,0xaee6,0xaee7,0xaee9,0xaeea,0xaeec,0xaeee,
-0xaeef,0xaef0,0xaef1,0xaef2,0xaef3,0xaef5,0xaef6,0xaef7,
-0xaef9,0xaefa,0xaefb,0xaefd,0xaefe,0xaeff,0xaf00,0xaf01,
-0xaf02,0xaf03,0xaf04,0xaf05,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xaf06,0xaf09,0xaf0a,0xaf0b,0xaf0c,0xaf0e,
-0xaf0f,0xaf11,0xaf12,0xaf13,0xaf14,0xaf15,0xaf16,0xaf17,
-0xaf18,0xaf19,0xaf1a,0xaf1b,0xaf1c,0xaf1d,0xaf1e,0xaf1f,
-0xaf20,0xaf21,0xaf22,0xaf23,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xaf24,0xaf25,0xaf26,0xaf27,0xaf28,0xaf29,
-0xaf2a,0xaf2b,0xaf2e,0xaf2f,0xaf31,0xaf33,0xaf35,0xaf36,
-0xaf37,0xaf38,0xaf39,0xaf3a,0xaf3b,0xaf3e,0xaf40,0xaf44,
-0xaf45,0xaf46,0xaf47,0xaf4a,0xaf4b,0xaf4c,0xaf4d,0xaf4e,
-0xaf4f,0xaf51,0xaf52,0xaf53,0xaf54,0xaf55,0xaf56,0xaf57,
-0xaf58,0xaf59,0xaf5a,0xaf5b,0xaf5e,0xaf5f,0xaf60,0xaf61,
-0xaf62,0xaf63,0xaf66,0xaf67,0xaf68,0xaf69,0xaf6a,0xaf6b,
-0xaf6c,0xaf6d,0xaf6e,0xaf6f,0xaf70,0xaf71,0xaf72,0xaf73,
-0xaf74,0xaf75,0xaf76,0xaf77,0xaf78,0xaf7a,0xaf7b,0xaf7c,
-0xaf7d,0xaf7e,0xaf7f,0xaf81,0xaf82,0xaf83,0xaf85,0xaf86,
-0xaf87,0xaf89,0xaf8a,0xaf8b,0xaf8c,0xaf8d,0xaf8e,0xaf8f,
-0xaf92,0xaf93,0xaf94,0xaf96,0xaf97,0xaf98,0xaf99,0xaf9a,
-0xaf9b,0xaf9d,0xaf9e,0xaf9f,0xafa0,0xafa1,0xafa2,0xafa3,
-0xafa4,0xafa5,0xafa6,0xafa7,0xafa8,0xafa9,0xafaa,0xafab,
-0xafac,0xafad,0xafae,0xafaf,0xafb0,0xafb1,0xafb2,0xafb3,
-0xafb4,0xafb5,0xafb6,0xafb7,0xafba,0xafbb,0xafbd,0xafbe,
-0xafbf,0xafc1,0xafc2,0xafc3,0xafc4,0xafc5,0xafc6,0xafca,
-0xafcc,0xafcf,0xafd0,0xafd1,0xafd2,0xafd3,0xafd5,0xafd6,
-0xafd7,0xafd8,0xafd9,0xafda,0xafdb,0xafdd,0xafde,0xafdf,
-0xafe0,0xafe1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xafe2,0xafe3,0xafe4,0xafe5,0xafe6,0xafe7,0xafea,0xafeb,
-0xafec,0xafed,0xafee,0xafef,0xaff2,0xaff3,0xaff5,0xaff6,
-0xaff7,0xaff9,0xaffa,0xaffb,0xaffc,0xaffd,0xaffe,0xafff,
-0xb002,0xb003,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xb005,0xb006,0xb007,0xb008,0xb009,0xb00a,0xb00b,0xb00d,
-0xb00e,0xb00f,0xb011,0xb012,0xb013,0xb015,0xb016,0xb017,
-0xb018,0xb019,0xb01a,0xb01b,0xb01e,0xb01f,0xb020,0xb021,
-0xb022,0xb023,0xb024,0xb025,0xb026,0xb027,0xb029,0xb02a,
-0xb02b,0xb02c,0xb02d,0xb02e,0xb02f,0xb030,0xb031,0xb032,
-0xb033,0xb034,0xb035,0xb036,0xb037,0xb038,0xb039,0xb03a,
-0xb03b,0xb03c,0xb03d,0xb03e,0xb03f,0xb040,0xb041,0xb042,
-0xb043,0xb046,0xb047,0xb049,0xb04b,0xb04d,0xb04f,0xb050,
-0xb051,0xb052,0xb056,0xb058,0xb05a,0xb05b,0xb05c,0xb05e,
-0xb05f,0xb060,0xb061,0xb062,0xb063,0xb064,0xb065,0xb066,
-0xb067,0xb068,0xb069,0xb06a,0xb06b,0xb06c,0xb06d,0xb06e,
-0xb06f,0xb070,0xb071,0xb072,0xb073,0xb074,0xb075,0xb076,
-0xb077,0xb078,0xb079,0xb07a,0xb07b,0xb07e,0xb07f,0xb081,
-0xb082,0xb083,0xb085,0xb086,0xb087,0xb088,0xb089,0xb08a,
-0xb08b,0xb08e,0xb090,0xb092,0xb093,0xb094,0xb095,0xb096,
-0xb097,0xb09b,0xb09d,0xb09e,0xb0a3,0xb0a4,0xb0a5,0xb0a6,
-0xb0a7,0xb0aa,0xb0b0,0xb0b2,0xb0b6,0xb0b7,0xb0b9,0xb0ba,
-0xb0bb,0xb0bd,0xb0be,0xb0bf,0xb0c0,0xb0c1,0xb0c2,0xb0c3,
-0xb0c6,0xb0ca,0xb0cb,0xb0cc,0xb0cd,0xb0ce,0xb0cf,0xb0d2,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb0d3,0xb0d5,
-0xb0d6,0xb0d7,0xb0d9,0xb0da,0xb0db,0xb0dc,0xb0dd,0xb0de,
-0xb0df,0xb0e1,0xb0e2,0xb0e3,0xb0e4,0xb0e6,0xb0e7,0xb0e8,
-0xb0e9,0xb0ea,0xb0eb,0xb0ec,0xb0ed,0xb0ee,0xb0ef,0xb0f0,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb0f1,0xb0f2,
-0xb0f3,0xb0f4,0xb0f5,0xb0f6,0xb0f7,0xb0f8,0xb0f9,0xb0fa,
-0xb0fb,0xb0fc,0xb0fd,0xb0fe,0xb0ff,0xb100,0xb101,0xb102,
-0xb103,0xb104,0xb105,0xb106,0xb107,0xb10a,0xb10d,0xb10e,
-0xb10f,0xb111,0xb114,0xb115,0xb116,0xb117,0xb11a,0xb11e,
-0xb11f,0xb120,0xb121,0xb122,0xb126,0xb127,0xb129,0xb12a,
-0xb12b,0xb12d,0xb12e,0xb12f,0xb130,0xb131,0xb132,0xb133,
-0xb136,0xb13a,0xb13b,0xb13c,0xb13d,0xb13e,0xb13f,0xb142,
-0xb143,0xb145,0xb146,0xb147,0xb149,0xb14a,0xb14b,0xb14c,
-0xb14d,0xb14e,0xb14f,0xb152,0xb153,0xb156,0xb157,0xb159,
-0xb15a,0xb15b,0xb15d,0xb15e,0xb15f,0xb161,0xb162,0xb163,
-0xb164,0xb165,0xb166,0xb167,0xb168,0xb169,0xb16a,0xb16b,
-0xb16c,0xb16d,0xb16e,0xb16f,0xb170,0xb171,0xb172,0xb173,
-0xb174,0xb175,0xb176,0xb177,0xb17a,0xb17b,0xb17d,0xb17e,
-0xb17f,0xb181,0xb183,0xb184,0xb185,0xb186,0xb187,0xb18a,
-0xb18c,0xb18e,0xb18f,0xb190,0xb191,0xb195,0xb196,0xb197,
-0xb199,0xb19a,0xb19b,0xb19d,0xb19e,0xb19f,0xb1a0,0xb1a1,
-0xb1a2,0xb1a3,0xb1a4,0xb1a5,0xb1a6,0xb1a7,0xb1a9,0xb1aa,
-0xb1ab,0xb1ac,0xb1ad,0xb1ae,0xb1af,0xb1b0,0xb1b1,0xb1b2,
-0xb1b3,0xb1b4,0xb1b5,0xb1b6,0xb1b7,0xb1b8,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xb1b9,0xb1ba,0xb1bb,0xb1bc,
-0xb1bd,0xb1be,0xb1bf,0xb1c0,0xb1c1,0xb1c2,0xb1c3,0xb1c4,
-0xb1c5,0xb1c6,0xb1c7,0xb1c8,0xb1c9,0xb1ca,0xb1cb,0xb1cd,
-0xb1ce,0xb1cf,0xb1d1,0xb1d2,0xb1d3,0xb1d5,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xb1d6,0xb1d7,0xb1d8,0xb1d9,
-0xb1da,0xb1db,0xb1de,0xb1e0,0xb1e1,0xb1e2,0xb1e3,0xb1e4,
-0xb1e5,0xb1e6,0xb1e7,0xb1ea,0xb1eb,0xb1ed,0xb1ee,0xb1ef,
-0xb1f1,0xb1f2,0xb1f3,0xb1f4,0xb1f5,0xb1f6,0xb1f7,0xb1f8,
-0xb1fa,0xb1fc,0xb1fe,0xb1ff,0xb200,0xb201,0xb202,0xb203,
-0xb206,0xb207,0xb209,0xb20a,0xb20d,0xb20e,0xb20f,0xb210,
-0xb211,0xb212,0xb213,0xb216,0xb218,0xb21a,0xb21b,0xb21c,
-0xb21d,0xb21e,0xb21f,0xb221,0xb222,0xb223,0xb224,0xb225,
-0xb226,0xb227,0xb228,0xb229,0xb22a,0xb22b,0xb22c,0xb22d,
-0xb22e,0xb22f,0xb230,0xb231,0xb232,0xb233,0xb235,0xb236,
-0xb237,0xb238,0xb239,0xb23a,0xb23b,0xb23d,0xb23e,0xb23f,
-0xb240,0xb241,0xb242,0xb243,0xb244,0xb245,0xb246,0xb247,
-0xb248,0xb249,0xb24a,0xb24b,0xb24c,0xb24d,0xb24e,0xb24f,
-0xb250,0xb251,0xb252,0xb253,0xb254,0xb255,0xb256,0xb257,
-0xb259,0xb25a,0xb25b,0xb25d,0xb25e,0xb25f,0xb261,0xb262,
-0xb263,0xb264,0xb265,0xb266,0xb267,0xb26a,0xb26b,0xb26c,
-0xb26d,0xb26e,0xb26f,0xb270,0xb271,0xb272,0xb273,0xb276,
-0xb277,0xb278,0xb279,0xb27a,0xb27b,0xb27d,0xb27e,0xb27f,
-0xb280,0xb281,0xb282,0xb283,0xb286,0xb287,0xb288,0xb28a,
-0xb28b,0xb28c,0xb28d,0xb28e,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xb28f,0xb292,0xb293,0xb295,0xb296,0xb297,
-0xb29b,0xb29c,0xb29d,0xb29e,0xb29f,0xb2a2,0xb2a4,0xb2a7,
-0xb2a8,0xb2a9,0xb2ab,0xb2ad,0xb2ae,0xb2af,0xb2b1,0xb2b2,
-0xb2b3,0xb2b5,0xb2b6,0xb2b7,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xb2b8,0xb2b9,0xb2ba,0xb2bb,0xb2bc,0xb2bd,
-0xb2be,0xb2bf,0xb2c0,0xb2c1,0xb2c2,0xb2c3,0xb2c4,0xb2c5,
-0xb2c6,0xb2c7,0xb2ca,0xb2cb,0xb2cd,0xb2ce,0xb2cf,0xb2d1,
-0xb2d3,0xb2d4,0xb2d5,0xb2d6,0xb2d7,0xb2da,0xb2dc,0xb2de,
-0xb2df,0xb2e0,0xb2e1,0xb2e3,0xb2e7,0xb2e9,0xb2ea,0xb2f0,
-0xb2f1,0xb2f2,0xb2f6,0xb2fc,0xb2fd,0xb2fe,0xb302,0xb303,
-0xb305,0xb306,0xb307,0xb309,0xb30a,0xb30b,0xb30c,0xb30d,
-0xb30e,0xb30f,0xb312,0xb316,0xb317,0xb318,0xb319,0xb31a,
-0xb31b,0xb31d,0xb31e,0xb31f,0xb320,0xb321,0xb322,0xb323,
-0xb324,0xb325,0xb326,0xb327,0xb328,0xb329,0xb32a,0xb32b,
-0xb32c,0xb32d,0xb32e,0xb32f,0xb330,0xb331,0xb332,0xb333,
-0xb334,0xb335,0xb336,0xb337,0xb338,0xb339,0xb33a,0xb33b,
-0xb33c,0xb33d,0xb33e,0xb33f,0xb340,0xb341,0xb342,0xb343,
-0xb344,0xb345,0xb346,0xb347,0xb348,0xb349,0xb34a,0xb34b,
-0xb34c,0xb34d,0xb34e,0xb34f,0xb350,0xb351,0xb352,0xb353,
-0xb357,0xb359,0xb35a,0xb35d,0xb360,0xb361,0xb362,0xb363,
-0xb366,0xb368,0xb36a,0xb36c,0xb36d,0xb36f,0xb372,0xb373,
-0xb375,0xb376,0xb377,0xb379,0xb37a,0xb37b,0xb37c,0xb37d,
-0xb37e,0xb37f,0xb382,0xb386,0xb387,0xb388,0xb389,0xb38a,
-0xb38b,0xb38d,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xb38e,0xb38f,0xb391,0xb392,0xb393,0xb395,0xb396,0xb397,
-0xb398,0xb399,0xb39a,0xb39b,0xb39c,0xb39d,0xb39e,0xb39f,
-0xb3a2,0xb3a3,0xb3a4,0xb3a5,0xb3a6,0xb3a7,0xb3a9,0xb3aa,
-0xb3ab,0xb3ad,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xb3ae,0xb3af,0xb3b0,0xb3b1,0xb3b2,0xb3b3,0xb3b4,0xb3b5,
-0xb3b6,0xb3b7,0xb3b8,0xb3b9,0xb3ba,0xb3bb,0xb3bc,0xb3bd,
-0xb3be,0xb3bf,0xb3c0,0xb3c1,0xb3c2,0xb3c3,0xb3c6,0xb3c7,
-0xb3c9,0xb3ca,0xb3cd,0xb3cf,0xb3d1,0xb3d2,0xb3d3,0xb3d6,
-0xb3d8,0xb3da,0xb3dc,0xb3de,0xb3df,0xb3e1,0xb3e2,0xb3e3,
-0xb3e5,0xb3e6,0xb3e7,0xb3e9,0xb3ea,0xb3eb,0xb3ec,0xb3ed,
-0xb3ee,0xb3ef,0xb3f0,0xb3f1,0xb3f2,0xb3f3,0xb3f4,0xb3f5,
-0xb3f6,0xb3f7,0xb3f8,0xb3f9,0xb3fa,0xb3fb,0xb3fd,0xb3fe,
-0xb3ff,0xb400,0xb401,0xb402,0xb403,0xb404,0xb405,0xb406,
-0xb407,0xb408,0xb409,0xb40a,0xb40b,0xb40c,0xb40d,0xb40e,
-0xb40f,0xb411,0xb412,0xb413,0xb414,0xb415,0xb416,0xb417,
-0xb419,0xb41a,0xb41b,0xb41d,0xb41e,0xb41f,0xb421,0xb422,
-0xb423,0xb424,0xb425,0xb426,0xb427,0xb42a,0xb42c,0xb42d,
-0xb42e,0xb42f,0xb430,0xb431,0xb432,0xb433,0xb435,0xb436,
-0xb437,0xb438,0xb439,0xb43a,0xb43b,0xb43c,0xb43d,0xb43e,
-0xb43f,0xb440,0xb441,0xb442,0xb443,0xb444,0xb445,0xb446,
-0xb447,0xb448,0xb449,0xb44a,0xb44b,0xb44c,0xb44d,0xb44e,
-0xb44f,0xb452,0xb453,0xb455,0xb456,0xb457,0xb459,0xb45a,
-0xb45b,0xb45c,0xb45d,0xb45e,0xb45f,0xb462,0xb464,0xb466,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb467,0xb468,
-0xb469,0xb46a,0xb46b,0xb46d,0xb46e,0xb46f,0xb470,0xb471,
-0xb472,0xb473,0xb474,0xb475,0xb476,0xb477,0xb478,0xb479,
-0xb47a,0xb47b,0xb47c,0xb47d,0xb47e,0xb47f,0xb481,0xb482,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb483,0xb484,
-0xb485,0xb486,0xb487,0xb489,0xb48a,0xb48b,0xb48c,0xb48d,
-0xb48e,0xb48f,0xb490,0xb491,0xb492,0xb493,0xb494,0xb495,
-0xb496,0xb497,0xb498,0xb499,0xb49a,0xb49b,0xb49c,0xb49e,
-0xb49f,0xb4a0,0xb4a1,0xb4a2,0xb4a3,0xb4a5,0xb4a6,0xb4a7,
-0xb4a9,0xb4aa,0xb4ab,0xb4ad,0xb4ae,0xb4af,0xb4b0,0xb4b1,
-0xb4b2,0xb4b3,0xb4b4,0xb4b6,0xb4b8,0xb4ba,0xb4bb,0xb4bc,
-0xb4bd,0xb4be,0xb4bf,0xb4c1,0xb4c2,0xb4c3,0xb4c5,0xb4c6,
-0xb4c7,0xb4c9,0xb4ca,0xb4cb,0xb4cc,0xb4cd,0xb4ce,0xb4cf,
-0xb4d1,0xb4d2,0xb4d3,0xb4d4,0xb4d6,0xb4d7,0xb4d8,0xb4d9,
-0xb4da,0xb4db,0xb4de,0xb4df,0xb4e1,0xb4e2,0xb4e5,0xb4e7,
-0xb4e8,0xb4e9,0xb4ea,0xb4eb,0xb4ee,0xb4f0,0xb4f2,0xb4f3,
-0xb4f4,0xb4f5,0xb4f6,0xb4f7,0xb4f9,0xb4fa,0xb4fb,0xb4fc,
-0xb4fd,0xb4fe,0xb4ff,0xb500,0xb501,0xb502,0xb503,0xb504,
-0xb505,0xb506,0xb507,0xb508,0xb509,0xb50a,0xb50b,0xb50c,
-0xb50d,0xb50e,0xb50f,0xb510,0xb511,0xb512,0xb513,0xb516,
-0xb517,0xb519,0xb51a,0xb51d,0xb51e,0xb51f,0xb520,0xb521,
-0xb522,0xb523,0xb526,0xb52b,0xb52c,0xb52d,0xb52e,0xb52f,
-0xb532,0xb533,0xb535,0xb536,0xb537,0xb539,0xb53a,0xb53b,
-0xb53c,0xb53d,0xb53e,0xb53f,0xb542,0xb546,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xb547,0xb548,0xb549,0xb54a,
-0xb54e,0xb54f,0xb551,0xb552,0xb553,0xb555,0xb556,0xb557,
-0xb558,0xb559,0xb55a,0xb55b,0xb55e,0xb562,0xb563,0xb564,
-0xb565,0xb566,0xb567,0xb568,0xb569,0xb56a,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xb56b,0xb56c,0xb56d,0xb56e,
-0xb56f,0xb570,0xb571,0xb572,0xb573,0xb574,0xb575,0xb576,
-0xb577,0xb578,0xb579,0xb57a,0xb57b,0xb57c,0xb57d,0xb57e,
-0xb57f,0xb580,0xb581,0xb582,0xb583,0xb584,0xb585,0xb586,
-0xb587,0xb588,0xb589,0xb58a,0xb58b,0xb58c,0xb58d,0xb58e,
-0xb58f,0xb590,0xb591,0xb592,0xb593,0xb594,0xb595,0xb596,
-0xb597,0xb598,0xb599,0xb59a,0xb59b,0xb59c,0xb59d,0xb59e,
-0xb59f,0xb5a2,0xb5a3,0xb5a5,0xb5a6,0xb5a7,0xb5a9,0xb5ac,
-0xb5ad,0xb5ae,0xb5af,0xb5b2,0xb5b6,0xb5b7,0xb5b8,0xb5b9,
-0xb5ba,0xb5be,0xb5bf,0xb5c1,0xb5c2,0xb5c3,0xb5c5,0xb5c6,
-0xb5c7,0xb5c8,0xb5c9,0xb5ca,0xb5cb,0xb5ce,0xb5d2,0xb5d3,
-0xb5d4,0xb5d5,0xb5d6,0xb5d7,0xb5d9,0xb5da,0xb5db,0xb5dc,
-0xb5dd,0xb5de,0xb5df,0xb5e0,0xb5e1,0xb5e2,0xb5e3,0xb5e4,
-0xb5e5,0xb5e6,0xb5e7,0xb5e8,0xb5e9,0xb5ea,0xb5eb,0xb5ed,
-0xb5ee,0xb5ef,0xb5f0,0xb5f1,0xb5f2,0xb5f3,0xb5f4,0xb5f5,
-0xb5f6,0xb5f7,0xb5f8,0xb5f9,0xb5fa,0xb5fb,0xb5fc,0xb5fd,
-0xb5fe,0xb5ff,0xb600,0xb601,0xb602,0xb603,0xb604,0xb605,
-0xb606,0xb607,0xb608,0xb609,0xb60a,0xb60b,0xb60c,0xb60d,
-0xb60e,0xb60f,0xb612,0xb613,0xb615,0xb616,0xb617,0xb619,
-0xb61a,0xb61b,0xb61c,0xb61d,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xb61e,0xb61f,0xb620,0xb621,0xb622,0xb623,
-0xb624,0xb626,0xb627,0xb628,0xb629,0xb62a,0xb62b,0xb62d,
-0xb62e,0xb62f,0xb630,0xb631,0xb632,0xb633,0xb635,0xb636,
-0xb637,0xb638,0xb639,0xb63a,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xb63b,0xb63c,0xb63d,0xb63e,0xb63f,0xb640,
-0xb641,0xb642,0xb643,0xb644,0xb645,0xb646,0xb647,0xb649,
-0xb64a,0xb64b,0xb64c,0xb64d,0xb64e,0xb64f,0xb650,0xb651,
-0xb652,0xb653,0xb654,0xb655,0xb656,0xb657,0xb658,0xb659,
-0xb65a,0xb65b,0xb65c,0xb65d,0xb65e,0xb65f,0xb660,0xb661,
-0xb662,0xb663,0xb665,0xb666,0xb667,0xb669,0xb66a,0xb66b,
-0xb66c,0xb66d,0xb66e,0xb66f,0xb670,0xb671,0xb672,0xb673,
-0xb674,0xb675,0xb676,0xb677,0xb678,0xb679,0xb67a,0xb67b,
-0xb67c,0xb67d,0xb67e,0xb67f,0xb680,0xb681,0xb682,0xb683,
-0xb684,0xb685,0xb686,0xb687,0xb688,0xb689,0xb68a,0xb68b,
-0xb68c,0xb68d,0xb68e,0xb68f,0xb690,0xb691,0xb692,0xb693,
-0xb694,0xb695,0xb696,0xb697,0xb698,0xb699,0xb69a,0xb69b,
-0xb69e,0xb69f,0xb6a1,0xb6a2,0xb6a3,0xb6a5,0xb6a6,0xb6a7,
-0xb6a8,0xb6a9,0xb6aa,0xb6ad,0xb6ae,0xb6af,0xb6b0,0xb6b2,
-0xb6b3,0xb6b4,0xb6b5,0xb6b6,0xb6b7,0xb6b8,0xb6b9,0xb6ba,
-0xb6bb,0xb6bc,0xb6bd,0xb6be,0xb6bf,0xb6c0,0xb6c1,0xb6c2,
-0xb6c3,0xb6c4,0xb6c5,0xb6c6,0xb6c7,0xb6c8,0xb6c9,0xb6ca,
-0xb6cb,0xb6cc,0xb6cd,0xb6ce,0xb6cf,0xb6d0,0xb6d1,0xb6d2,
-0xb6d3,0xb6d5,0xb6d6,0xb6d7,0xb6d8,0xb6d9,0xb6da,0xb6db,
-0xb6dc,0xb6dd,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xb6de,0xb6df,0xb6e0,0xb6e1,0xb6e2,0xb6e3,0xb6e4,0xb6e5,
-0xb6e6,0xb6e7,0xb6e8,0xb6e9,0xb6ea,0xb6eb,0xb6ec,0xb6ed,
-0xb6ee,0xb6ef,0xb6f1,0xb6f2,0xb6f3,0xb6f5,0xb6f6,0xb6f7,
-0xb6f9,0xb6fa,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xb6fb,0xb6fc,0xb6fd,0xb6fe,0xb6ff,0xb702,0xb703,0xb704,
-0xb706,0xb707,0xb708,0xb709,0xb70a,0xb70b,0xb70c,0xb70d,
-0xb70e,0xb70f,0xb710,0xb711,0xb712,0xb713,0xb714,0xb715,
-0xb716,0xb717,0xb718,0xb719,0xb71a,0xb71b,0xb71c,0xb71d,
-0xb71e,0xb71f,0xb720,0xb721,0xb722,0xb723,0xb724,0xb725,
-0xb726,0xb727,0xb72a,0xb72b,0xb72d,0xb72e,0xb731,0xb732,
-0xb733,0xb734,0xb735,0xb736,0xb737,0xb73a,0xb73c,0xb73d,
-0xb73e,0xb73f,0xb740,0xb741,0xb742,0xb743,0xb745,0xb746,
-0xb747,0xb749,0xb74a,0xb74b,0xb74d,0xb74e,0xb74f,0xb750,
-0xb751,0xb752,0xb753,0xb756,0xb757,0xb758,0xb759,0xb75a,
-0xb75b,0xb75c,0xb75d,0xb75e,0xb75f,0xb761,0xb762,0xb763,
-0xb765,0xb766,0xb767,0xb769,0xb76a,0xb76b,0xb76c,0xb76d,
-0xb76e,0xb76f,0xb772,0xb774,0xb776,0xb777,0xb778,0xb779,
-0xb77a,0xb77b,0xb77e,0xb77f,0xb781,0xb782,0xb783,0xb785,
-0xb786,0xb787,0xb788,0xb789,0xb78a,0xb78b,0xb78e,0xb793,
-0xb794,0xb795,0xb79a,0xb79b,0xb79d,0xb79e,0xb79f,0xb7a1,
-0xb7a2,0xb7a3,0xb7a4,0xb7a5,0xb7a6,0xb7a7,0xb7aa,0xb7ae,
-0xb7af,0xb7b0,0xb7b1,0xb7b2,0xb7b3,0xb7b6,0xb7b7,0xb7b9,
-0xb7ba,0xb7bb,0xb7bc,0xb7bd,0xb7be,0xb7bf,0xb7c0,0xb7c1,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb7c2,0xb7c3,
-0xb7c4,0xb7c5,0xb7c6,0xb7c8,0xb7ca,0xb7cb,0xb7cc,0xb7cd,
-0xb7ce,0xb7cf,0xb7d0,0xb7d1,0xb7d2,0xb7d3,0xb7d4,0xb7d5,
-0xb7d6,0xb7d7,0xb7d8,0xb7d9,0xb7da,0xb7db,0xb7dc,0xb7dd,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb7de,0xb7df,
-0xb7e0,0xb7e1,0xb7e2,0xb7e3,0xb7e4,0xb7e5,0xb7e6,0xb7e7,
-0xb7e8,0xb7e9,0xb7ea,0xb7eb,0xb7ee,0xb7ef,0xb7f1,0xb7f2,
-0xb7f3,0xb7f5,0xb7f6,0xb7f7,0xb7f8,0xb7f9,0xb7fa,0xb7fb,
-0xb7fe,0xb802,0xb803,0xb804,0xb805,0xb806,0xb80a,0xb80b,
-0xb80d,0xb80e,0xb80f,0xb811,0xb812,0xb813,0xb814,0xb815,
-0xb816,0xb817,0xb81a,0xb81c,0xb81e,0xb81f,0xb820,0xb821,
-0xb822,0xb823,0xb826,0xb827,0xb829,0xb82a,0xb82b,0xb82d,
-0xb82e,0xb82f,0xb830,0xb831,0xb832,0xb833,0xb836,0xb83a,
-0xb83b,0xb83c,0xb83d,0xb83e,0xb83f,0xb841,0xb842,0xb843,
-0xb845,0xb846,0xb847,0xb848,0xb849,0xb84a,0xb84b,0xb84c,
-0xb84d,0xb84e,0xb84f,0xb850,0xb852,0xb854,0xb855,0xb856,
-0xb857,0xb858,0xb859,0xb85a,0xb85b,0xb85e,0xb85f,0xb861,
-0xb862,0xb863,0xb865,0xb866,0xb867,0xb868,0xb869,0xb86a,
-0xb86b,0xb86e,0xb870,0xb872,0xb873,0xb874,0xb875,0xb876,
-0xb877,0xb879,0xb87a,0xb87b,0xb87d,0xb87e,0xb87f,0xb880,
-0xb881,0xb882,0xb883,0xb884,0xb885,0xb886,0xb887,0xb888,
-0xb889,0xb88a,0xb88b,0xb88c,0xb88e,0xb88f,0xb890,0xb891,
-0xb892,0xb893,0xb894,0xb895,0xb896,0xb897,0xb898,0xb899,
-0xb89a,0xb89b,0xb89c,0xb89d,0xb89e,0xb89f,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xb8a0,0xb8a1,0xb8a2,0xb8a3,
-0xb8a4,0xb8a5,0xb8a6,0xb8a7,0xb8a9,0xb8aa,0xb8ab,0xb8ac,
-0xb8ad,0xb8ae,0xb8af,0xb8b1,0xb8b2,0xb8b3,0xb8b5,0xb8b6,
-0xb8b7,0xb8b9,0xb8ba,0xb8bb,0xb8bc,0xb8bd,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xb8be,0xb8bf,0xb8c2,0xb8c4,
-0xb8c6,0xb8c7,0xb8c8,0xb8c9,0xb8ca,0xb8cb,0xb8cd,0xb8ce,
-0xb8cf,0xb8d1,0xb8d2,0xb8d3,0xb8d5,0xb8d6,0xb8d7,0xb8d8,
-0xb8d9,0xb8da,0xb8db,0xb8dc,0xb8de,0xb8e0,0xb8e2,0xb8e3,
-0xb8e4,0xb8e5,0xb8e6,0xb8e7,0xb8ea,0xb8eb,0xb8ed,0xb8ee,
-0xb8ef,0xb8f1,0xb8f2,0xb8f3,0xb8f4,0xb8f5,0xb8f6,0xb8f7,
-0xb8fa,0xb8fc,0xb8fe,0xb8ff,0xb900,0xb901,0xb902,0xb903,
-0xb905,0xb906,0xb907,0xb908,0xb909,0xb90a,0xb90b,0xb90c,
-0xb90d,0xb90e,0xb90f,0xb910,0xb911,0xb912,0xb913,0xb914,
-0xb915,0xb916,0xb917,0xb919,0xb91a,0xb91b,0xb91c,0xb91d,
-0xb91e,0xb91f,0xb921,0xb922,0xb923,0xb924,0xb925,0xb926,
-0xb927,0xb928,0xb929,0xb92a,0xb92b,0xb92c,0xb92d,0xb92e,
-0xb92f,0xb930,0xb931,0xb932,0xb933,0xb934,0xb935,0xb936,
-0xb937,0xb938,0xb939,0xb93a,0xb93b,0xb93e,0xb93f,0xb941,
-0xb942,0xb943,0xb945,0xb946,0xb947,0xb948,0xb949,0xb94a,
-0xb94b,0xb94d,0xb94e,0xb950,0xb952,0xb953,0xb954,0xb955,
-0xb956,0xb957,0xb95a,0xb95b,0xb95d,0xb95e,0xb95f,0xb961,
-0xb962,0xb963,0xb964,0xb965,0xb966,0xb967,0xb96a,0xb96c,
-0xb96e,0xb96f,0xb970,0xb971,0xb972,0xb973,0xb976,0xb977,
-0xb979,0xb97a,0xb97b,0xb97d,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xb97e,0xb97f,0xb980,0xb981,0xb982,0xb983,
-0xb986,0xb988,0xb98b,0xb98c,0xb98f,0xb990,0xb991,0xb992,
-0xb993,0xb994,0xb995,0xb996,0xb997,0xb998,0xb999,0xb99a,
-0xb99b,0xb99c,0xb99d,0xb99e,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xb99f,0xb9a0,0xb9a1,0xb9a2,0xb9a3,0xb9a4,
-0xb9a5,0xb9a6,0xb9a7,0xb9a8,0xb9a9,0xb9aa,0xb9ab,0xb9ae,
-0xb9af,0xb9b1,0xb9b2,0xb9b3,0xb9b5,0xb9b6,0xb9b7,0xb9b8,
-0xb9b9,0xb9ba,0xb9bb,0xb9be,0xb9c0,0xb9c2,0xb9c3,0xb9c4,
-0xb9c5,0xb9c6,0xb9c7,0xb9ca,0xb9cb,0xb9cd,0xb9d3,0xb9d4,
-0xb9d5,0xb9d6,0xb9d7,0xb9da,0xb9dc,0xb9df,0xb9e0,0xb9e2,
-0xb9e6,0xb9e7,0xb9e9,0xb9ea,0xb9eb,0xb9ed,0xb9ee,0xb9ef,
-0xb9f0,0xb9f1,0xb9f2,0xb9f3,0xb9f6,0xb9fb,0xb9fc,0xb9fd,
-0xb9fe,0xb9ff,0xba02,0xba03,0xba04,0xba05,0xba06,0xba07,
-0xba09,0xba0a,0xba0b,0xba0c,0xba0d,0xba0e,0xba0f,0xba10,
-0xba11,0xba12,0xba13,0xba14,0xba16,0xba17,0xba18,0xba19,
-0xba1a,0xba1b,0xba1c,0xba1d,0xba1e,0xba1f,0xba20,0xba21,
-0xba22,0xba23,0xba24,0xba25,0xba26,0xba27,0xba28,0xba29,
-0xba2a,0xba2b,0xba2c,0xba2d,0xba2e,0xba2f,0xba30,0xba31,
-0xba32,0xba33,0xba34,0xba35,0xba36,0xba37,0xba3a,0xba3b,
-0xba3d,0xba3e,0xba3f,0xba41,0xba43,0xba44,0xba45,0xba46,
-0xba47,0xba4a,0xba4c,0xba4f,0xba50,0xba51,0xba52,0xba56,
-0xba57,0xba59,0xba5a,0xba5b,0xba5d,0xba5e,0xba5f,0xba60,
-0xba61,0xba62,0xba63,0xba66,0xba6a,0xba6b,0xba6c,0xba6d,
-0xba6e,0xba6f,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xba72,0xba73,0xba75,0xba76,0xba77,0xba79,0xba7a,0xba7b,
-0xba7c,0xba7d,0xba7e,0xba7f,0xba80,0xba81,0xba82,0xba86,
-0xba88,0xba89,0xba8a,0xba8b,0xba8d,0xba8e,0xba8f,0xba90,
-0xba91,0xba92,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xba93,0xba94,0xba95,0xba96,0xba97,0xba98,0xba99,0xba9a,
-0xba9b,0xba9c,0xba9d,0xba9e,0xba9f,0xbaa0,0xbaa1,0xbaa2,
-0xbaa3,0xbaa4,0xbaa5,0xbaa6,0xbaa7,0xbaaa,0xbaad,0xbaae,
-0xbaaf,0xbab1,0xbab3,0xbab4,0xbab5,0xbab6,0xbab7,0xbaba,
-0xbabc,0xbabe,0xbabf,0xbac0,0xbac1,0xbac2,0xbac3,0xbac5,
-0xbac6,0xbac7,0xbac9,0xbaca,0xbacb,0xbacc,0xbacd,0xbace,
-0xbacf,0xbad0,0xbad1,0xbad2,0xbad3,0xbad4,0xbad5,0xbad6,
-0xbad7,0xbada,0xbadb,0xbadc,0xbadd,0xbade,0xbadf,0xbae0,
-0xbae1,0xbae2,0xbae3,0xbae4,0xbae5,0xbae6,0xbae7,0xbae8,
-0xbae9,0xbaea,0xbaeb,0xbaec,0xbaed,0xbaee,0xbaef,0xbaf0,
-0xbaf1,0xbaf2,0xbaf3,0xbaf4,0xbaf5,0xbaf6,0xbaf7,0xbaf8,
-0xbaf9,0xbafa,0xbafb,0xbafd,0xbafe,0xbaff,0xbb01,0xbb02,
-0xbb03,0xbb05,0xbb06,0xbb07,0xbb08,0xbb09,0xbb0a,0xbb0b,
-0xbb0c,0xbb0e,0xbb10,0xbb12,0xbb13,0xbb14,0xbb15,0xbb16,
-0xbb17,0xbb19,0xbb1a,0xbb1b,0xbb1d,0xbb1e,0xbb1f,0xbb21,
-0xbb22,0xbb23,0xbb24,0xbb25,0xbb26,0xbb27,0xbb28,0xbb2a,
-0xbb2c,0xbb2d,0xbb2e,0xbb2f,0xbb30,0xbb31,0xbb32,0xbb33,
-0xbb37,0xbb39,0xbb3a,0xbb3f,0xbb40,0xbb41,0xbb42,0xbb43,
-0xbb46,0xbb48,0xbb4a,0xbb4b,0xbb4c,0xbb4e,0xbb51,0xbb52,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xbb53,0xbb55,
-0xbb56,0xbb57,0xbb59,0xbb5a,0xbb5b,0xbb5c,0xbb5d,0xbb5e,
-0xbb5f,0xbb60,0xbb62,0xbb64,0xbb65,0xbb66,0xbb67,0xbb68,
-0xbb69,0xbb6a,0xbb6b,0xbb6d,0xbb6e,0xbb6f,0xbb70,0xbb71,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xbb72,0xbb73,
-0xbb74,0xbb75,0xbb76,0xbb77,0xbb78,0xbb79,0xbb7a,0xbb7b,
-0xbb7c,0xbb7d,0xbb7e,0xbb7f,0xbb80,0xbb81,0xbb82,0xbb83,
-0xbb84,0xbb85,0xbb86,0xbb87,0xbb89,0xbb8a,0xbb8b,0xbb8d,
-0xbb8e,0xbb8f,0xbb91,0xbb92,0xbb93,0xbb94,0xbb95,0xbb96,
-0xbb97,0xbb98,0xbb99,0xbb9a,0xbb9b,0xbb9c,0xbb9d,0xbb9e,
-0xbb9f,0xbba0,0xbba1,0xbba2,0xbba3,0xbba5,0xbba6,0xbba7,
-0xbba9,0xbbaa,0xbbab,0xbbad,0xbbae,0xbbaf,0xbbb0,0xbbb1,
-0xbbb2,0xbbb3,0xbbb5,0xbbb6,0xbbb8,0xbbb9,0xbbba,0xbbbb,
-0xbbbc,0xbbbd,0xbbbe,0xbbbf,0xbbc1,0xbbc2,0xbbc3,0xbbc5,
-0xbbc6,0xbbc7,0xbbc9,0xbbca,0xbbcb,0xbbcc,0xbbcd,0xbbce,
-0xbbcf,0xbbd1,0xbbd2,0xbbd4,0xbbd5,0xbbd6,0xbbd7,0xbbd8,
-0xbbd9,0xbbda,0xbbdb,0xbbdc,0xbbdd,0xbbde,0xbbdf,0xbbe0,
-0xbbe1,0xbbe2,0xbbe3,0xbbe4,0xbbe5,0xbbe6,0xbbe7,0xbbe8,
-0xbbe9,0xbbea,0xbbeb,0xbbec,0xbbed,0xbbee,0xbbef,0xbbf0,
-0xbbf1,0xbbf2,0xbbf3,0xbbf4,0xbbf5,0xbbf6,0xbbf7,0xbbfa,
-0xbbfb,0xbbfd,0xbbfe,0xbc01,0xbc03,0xbc04,0xbc05,0xbc06,
-0xbc07,0xbc0a,0xbc0e,0xbc10,0xbc12,0xbc13,0xbc19,0xbc1a,
-0xbc20,0xbc21,0xbc22,0xbc23,0xbc26,0xbc28,0xbc2a,0xbc2b,
-0xbc2c,0xbc2e,0xbc2f,0xbc32,0xbc33,0xbc35,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xbc36,0xbc37,0xbc39,0xbc3a,
-0xbc3b,0xbc3c,0xbc3d,0xbc3e,0xbc3f,0xbc42,0xbc46,0xbc47,
-0xbc48,0xbc4a,0xbc4b,0xbc4e,0xbc4f,0xbc51,0xbc52,0xbc53,
-0xbc54,0xbc55,0xbc56,0xbc57,0xbc58,0xbc59,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xbc5a,0xbc5b,0xbc5c,0xbc5e,
-0xbc5f,0xbc60,0xbc61,0xbc62,0xbc63,0xbc64,0xbc65,0xbc66,
-0xbc67,0xbc68,0xbc69,0xbc6a,0xbc6b,0xbc6c,0xbc6d,0xbc6e,
-0xbc6f,0xbc70,0xbc71,0xbc72,0xbc73,0xbc74,0xbc75,0xbc76,
-0xbc77,0xbc78,0xbc79,0xbc7a,0xbc7b,0xbc7c,0xbc7d,0xbc7e,
-0xbc7f,0xbc80,0xbc81,0xbc82,0xbc83,0xbc86,0xbc87,0xbc89,
-0xbc8a,0xbc8d,0xbc8f,0xbc90,0xbc91,0xbc92,0xbc93,0xbc96,
-0xbc98,0xbc9b,0xbc9c,0xbc9d,0xbc9e,0xbc9f,0xbca2,0xbca3,
-0xbca5,0xbca6,0xbca9,0xbcaa,0xbcab,0xbcac,0xbcad,0xbcae,
-0xbcaf,0xbcb2,0xbcb6,0xbcb7,0xbcb8,0xbcb9,0xbcba,0xbcbb,
-0xbcbe,0xbcbf,0xbcc1,0xbcc2,0xbcc3,0xbcc5,0xbcc6,0xbcc7,
-0xbcc8,0xbcc9,0xbcca,0xbccb,0xbccc,0xbcce,0xbcd2,0xbcd3,
-0xbcd4,0xbcd6,0xbcd7,0xbcd9,0xbcda,0xbcdb,0xbcdd,0xbcde,
-0xbcdf,0xbce0,0xbce1,0xbce2,0xbce3,0xbce4,0xbce5,0xbce6,
-0xbce7,0xbce8,0xbce9,0xbcea,0xbceb,0xbcec,0xbced,0xbcee,
-0xbcef,0xbcf0,0xbcf1,0xbcf2,0xbcf3,0xbcf7,0xbcf9,0xbcfa,
-0xbcfb,0xbcfd,0xbcfe,0xbcff,0xbd00,0xbd01,0xbd02,0xbd03,
-0xbd06,0xbd08,0xbd0a,0xbd0b,0xbd0c,0xbd0d,0xbd0e,0xbd0f,
-0xbd11,0xbd12,0xbd13,0xbd15,0xbd16,0xbd17,0xbd18,0xbd19,
-0xbd1a,0xbd1b,0xbd1c,0xbd1d,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xbd1e,0xbd1f,0xbd20,0xbd21,0xbd22,0xbd23,
-0xbd25,0xbd26,0xbd27,0xbd28,0xbd29,0xbd2a,0xbd2b,0xbd2d,
-0xbd2e,0xbd2f,0xbd30,0xbd31,0xbd32,0xbd33,0xbd34,0xbd35,
-0xbd36,0xbd37,0xbd38,0xbd39,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xbd3a,0xbd3b,0xbd3c,0xbd3d,0xbd3e,0xbd3f,
-0xbd41,0xbd42,0xbd43,0xbd44,0xbd45,0xbd46,0xbd47,0xbd4a,
-0xbd4b,0xbd4d,0xbd4e,0xbd4f,0xbd51,0xbd52,0xbd53,0xbd54,
-0xbd55,0xbd56,0xbd57,0xbd5a,0xbd5b,0xbd5c,0xbd5d,0xbd5e,
-0xbd5f,0xbd60,0xbd61,0xbd62,0xbd63,0xbd65,0xbd66,0xbd67,
-0xbd69,0xbd6a,0xbd6b,0xbd6c,0xbd6d,0xbd6e,0xbd6f,0xbd70,
-0xbd71,0xbd72,0xbd73,0xbd74,0xbd75,0xbd76,0xbd77,0xbd78,
-0xbd79,0xbd7a,0xbd7b,0xbd7c,0xbd7d,0xbd7e,0xbd7f,0xbd82,
-0xbd83,0xbd85,0xbd86,0xbd8b,0xbd8c,0xbd8d,0xbd8e,0xbd8f,
-0xbd92,0xbd94,0xbd96,0xbd97,0xbd98,0xbd9b,0xbd9d,0xbd9e,
-0xbd9f,0xbda0,0xbda1,0xbda2,0xbda3,0xbda5,0xbda6,0xbda7,
-0xbda8,0xbda9,0xbdaa,0xbdab,0xbdac,0xbdad,0xbdae,0xbdaf,
-0xbdb1,0xbdb2,0xbdb3,0xbdb4,0xbdb5,0xbdb6,0xbdb7,0xbdb9,
-0xbdba,0xbdbb,0xbdbc,0xbdbd,0xbdbe,0xbdbf,0xbdc0,0xbdc1,
-0xbdc2,0xbdc3,0xbdc4,0xbdc5,0xbdc6,0xbdc7,0xbdc8,0xbdc9,
-0xbdca,0xbdcb,0xbdcc,0xbdcd,0xbdce,0xbdcf,0xbdd0,0xbdd1,
-0xbdd2,0xbdd3,0xbdd6,0xbdd7,0xbdd9,0xbdda,0xbddb,0xbddd,
-0xbdde,0xbddf,0xbde0,0xbde1,0xbde2,0xbde3,0xbde4,0xbde5,
-0xbde6,0xbde7,0xbde8,0xbdea,0xbdeb,0xbdec,0xbded,0xbdee,
-0xbdef,0xbdf1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xbdf2,0xbdf3,0xbdf5,0xbdf6,0xbdf7,0xbdf9,0xbdfa,0xbdfb,
-0xbdfc,0xbdfd,0xbdfe,0xbdff,0xbe01,0xbe02,0xbe04,0xbe06,
-0xbe07,0xbe08,0xbe09,0xbe0a,0xbe0b,0xbe0e,0xbe0f,0xbe11,
-0xbe12,0xbe13,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xbe15,0xbe16,0xbe17,0xbe18,0xbe19,0xbe1a,0xbe1b,0xbe1e,
-0xbe20,0xbe21,0xbe22,0xbe23,0xbe24,0xbe25,0xbe26,0xbe27,
-0xbe28,0xbe29,0xbe2a,0xbe2b,0xbe2c,0xbe2d,0xbe2e,0xbe2f,
-0xbe30,0xbe31,0xbe32,0xbe33,0xbe34,0xbe35,0xbe36,0xbe37,
-0xbe38,0xbe39,0xbe3a,0xbe3b,0xbe3c,0xbe3d,0xbe3e,0xbe3f,
-0xbe40,0xbe41,0xbe42,0xbe43,0xbe46,0xbe47,0xbe49,0xbe4a,
-0xbe4b,0xbe4d,0xbe4f,0xbe50,0xbe51,0xbe52,0xbe53,0xbe56,
-0xbe58,0xbe5c,0xbe5d,0xbe5e,0xbe5f,0xbe62,0xbe63,0xbe65,
-0xbe66,0xbe67,0xbe69,0xbe6b,0xbe6c,0xbe6d,0xbe6e,0xbe6f,
-0xbe72,0xbe76,0xbe77,0xbe78,0xbe79,0xbe7a,0xbe7e,0xbe7f,
-0xbe81,0xbe82,0xbe83,0xbe85,0xbe86,0xbe87,0xbe88,0xbe89,
-0xbe8a,0xbe8b,0xbe8e,0xbe92,0xbe93,0xbe94,0xbe95,0xbe96,
-0xbe97,0xbe9a,0xbe9b,0xbe9c,0xbe9d,0xbe9e,0xbe9f,0xbea0,
-0xbea1,0xbea2,0xbea3,0xbea4,0xbea5,0xbea6,0xbea7,0xbea9,
-0xbeaa,0xbeab,0xbeac,0xbead,0xbeae,0xbeaf,0xbeb0,0xbeb1,
-0xbeb2,0xbeb3,0xbeb4,0xbeb5,0xbeb6,0xbeb7,0xbeb8,0xbeb9,
-0xbeba,0xbebb,0xbebc,0xbebd,0xbebe,0xbebf,0xbec0,0xbec1,
-0xbec2,0xbec3,0xbec4,0xbec5,0xbec6,0xbec7,0xbec8,0xbec9,
-0xbeca,0xbecb,0xbecc,0xbecd,0xbece,0xbecf,0xbed2,0xbed3,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xbed5,0xbed6,
-0xbed9,0xbeda,0xbedb,0xbedc,0xbedd,0xbede,0xbedf,0xbee1,
-0xbee2,0xbee6,0xbee7,0xbee8,0xbee9,0xbeea,0xbeeb,0xbeed,
-0xbeee,0xbeef,0xbef0,0xbef1,0xbef2,0xbef3,0xbef4,0xbef5,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xbef6,0xbef7,
-0xbef8,0xbef9,0xbefa,0xbefb,0xbefc,0xbefd,0xbefe,0xbeff,
-0xbf00,0xbf02,0xbf03,0xbf04,0xbf05,0xbf06,0xbf07,0xbf0a,
-0xbf0b,0xbf0c,0xbf0d,0xbf0e,0xbf0f,0xbf10,0xbf11,0xbf12,
-0xbf13,0xbf14,0xbf15,0xbf16,0xbf17,0xbf1a,0xbf1e,0xbf1f,
-0xbf20,0xbf21,0xbf22,0xbf23,0xbf24,0xbf25,0xbf26,0xbf27,
-0xbf28,0xbf29,0xbf2a,0xbf2b,0xbf2c,0xbf2d,0xbf2e,0xbf2f,
-0xbf30,0xbf31,0xbf32,0xbf33,0xbf34,0xbf35,0xbf36,0xbf37,
-0xbf38,0xbf39,0xbf3a,0xbf3b,0xbf3c,0xbf3d,0xbf3e,0xbf3f,
-0xbf42,0xbf43,0xbf45,0xbf46,0xbf47,0xbf49,0xbf4a,0xbf4b,
-0xbf4c,0xbf4d,0xbf4e,0xbf4f,0xbf52,0xbf53,0xbf54,0xbf56,
-0xbf57,0xbf58,0xbf59,0xbf5a,0xbf5b,0xbf5c,0xbf5d,0xbf5e,
-0xbf5f,0xbf60,0xbf61,0xbf62,0xbf63,0xbf64,0xbf65,0xbf66,
-0xbf67,0xbf68,0xbf69,0xbf6a,0xbf6b,0xbf6c,0xbf6d,0xbf6e,
-0xbf6f,0xbf70,0xbf71,0xbf72,0xbf73,0xbf74,0xbf75,0xbf76,
-0xbf77,0xbf78,0xbf79,0xbf7a,0xbf7b,0xbf7c,0xbf7d,0xbf7e,
-0xbf7f,0xbf80,0xbf81,0xbf82,0xbf83,0xbf84,0xbf85,0xbf86,
-0xbf87,0xbf88,0xbf89,0xbf8a,0xbf8b,0xbf8c,0xbf8d,0xbf8e,
-0xbf8f,0xbf90,0xbf91,0xbf92,0xbf93,0xbf95,0xbf96,0xbf97,
-0xbf98,0xbf99,0xbf9a,0xbf9b,0xbf9c,0xbf9d,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xbf9e,0xbf9f,0xbfa0,0xbfa1,
-0xbfa2,0xbfa3,0xbfa4,0xbfa5,0xbfa6,0xbfa7,0xbfa8,0xbfa9,
-0xbfaa,0xbfab,0xbfac,0xbfad,0xbfae,0xbfaf,0xbfb1,0xbfb2,
-0xbfb3,0xbfb4,0xbfb5,0xbfb6,0xbfb7,0xbfb8,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xbfb9,0xbfba,0xbfbb,0xbfbc,
-0xbfbd,0xbfbe,0xbfbf,0xbfc0,0xbfc1,0xbfc2,0xbfc3,0xbfc4,
-0xbfc6,0xbfc7,0xbfc8,0xbfc9,0xbfca,0xbfcb,0xbfce,0xbfcf,
-0xbfd1,0xbfd2,0xbfd3,0xbfd5,0xbfd6,0xbfd7,0xbfd8,0xbfd9,
-0xbfda,0xbfdb,0xbfdd,0xbfde,0xbfe0,0xbfe2,0xbfe3,0xbfe4,
-0xbfe5,0xbfe6,0xbfe7,0xbfe8,0xbfe9,0xbfea,0xbfeb,0xbfec,
-0xbfed,0xbfee,0xbfef,0xbff0,0xbff1,0xbff2,0xbff3,0xbff4,
-0xbff5,0xbff6,0xbff7,0xbff8,0xbff9,0xbffa,0xbffb,0xbffc,
-0xbffd,0xbffe,0xbfff,0xc000,0xc001,0xc002,0xc003,0xc004,
-0xc005,0xc006,0xc007,0xc008,0xc009,0xc00a,0xc00b,0xc00c,
-0xc00d,0xc00e,0xc00f,0xc010,0xc011,0xc012,0xc013,0xc014,
-0xc015,0xc016,0xc017,0xc018,0xc019,0xc01a,0xc01b,0xc01c,
-0xc01d,0xc01e,0xc01f,0xc020,0xc021,0xc022,0xc023,0xc024,
-0xc025,0xc026,0xc027,0xc028,0xc029,0xc02a,0xc02b,0xc02c,
-0xc02d,0xc02e,0xc02f,0xc030,0xc031,0xc032,0xc033,0xc034,
-0xc035,0xc036,0xc037,0xc038,0xc039,0xc03a,0xc03b,0xc03d,
-0xc03e,0xc03f,0xc040,0xc041,0xc042,0xc043,0xc044,0xc045,
-0xc046,0xc047,0xc048,0xc049,0xc04a,0xc04b,0xc04c,0xc04d,
-0xc04e,0xc04f,0xc050,0xc052,0xc053,0xc054,0xc055,0xc056,
-0xc057,0xc059,0xc05a,0xc05b,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xc05d,0xc05e,0xc05f,0xc061,0xc062,0xc063,
-0xc064,0xc065,0xc066,0xc067,0xc06a,0xc06b,0xc06c,0xc06d,
-0xc06e,0xc06f,0xc070,0xc071,0xc072,0xc073,0xc074,0xc075,
-0xc076,0xc077,0xc078,0xc079,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xc07a,0xc07b,0xc07c,0xc07d,0xc07e,0xc07f,
-0xc080,0xc081,0xc082,0xc083,0xc084,0xc085,0xc086,0xc087,
-0xc088,0xc089,0xc08a,0xc08b,0xc08c,0xc08d,0xc08e,0xc08f,
-0xc092,0xc093,0xc095,0xc096,0xc097,0xc099,0xc09a,0xc09b,
-0xc09c,0xc09d,0xc09e,0xc09f,0xc0a2,0xc0a4,0xc0a6,0xc0a7,
-0xc0a8,0xc0a9,0xc0aa,0xc0ab,0xc0ae,0xc0b1,0xc0b2,0xc0b7,
-0xc0b8,0xc0b9,0xc0ba,0xc0bb,0xc0be,0xc0c2,0xc0c3,0xc0c4,
-0xc0c6,0xc0c7,0xc0ca,0xc0cb,0xc0cd,0xc0ce,0xc0cf,0xc0d1,
-0xc0d2,0xc0d3,0xc0d4,0xc0d5,0xc0d6,0xc0d7,0xc0da,0xc0de,
-0xc0df,0xc0e0,0xc0e1,0xc0e2,0xc0e3,0xc0e6,0xc0e7,0xc0e9,
-0xc0ea,0xc0eb,0xc0ed,0xc0ee,0xc0ef,0xc0f0,0xc0f1,0xc0f2,
-0xc0f3,0xc0f6,0xc0f8,0xc0fa,0xc0fb,0xc0fc,0xc0fd,0xc0fe,
-0xc0ff,0xc101,0xc102,0xc103,0xc105,0xc106,0xc107,0xc109,
-0xc10a,0xc10b,0xc10c,0xc10d,0xc10e,0xc10f,0xc111,0xc112,
-0xc113,0xc114,0xc116,0xc117,0xc118,0xc119,0xc11a,0xc11b,
-0xc121,0xc122,0xc125,0xc128,0xc129,0xc12a,0xc12b,0xc12e,
-0xc132,0xc133,0xc134,0xc135,0xc137,0xc13a,0xc13b,0xc13d,
-0xc13e,0xc13f,0xc141,0xc142,0xc143,0xc144,0xc145,0xc146,
-0xc147,0xc14a,0xc14e,0xc14f,0xc150,0xc151,0xc152,0xc153,
-0xc156,0xc157,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xc159,0xc15a,0xc15b,0xc15d,0xc15e,0xc15f,0xc160,0xc161,
-0xc162,0xc163,0xc166,0xc16a,0xc16b,0xc16c,0xc16d,0xc16e,
-0xc16f,0xc171,0xc172,0xc173,0xc175,0xc176,0xc177,0xc179,
-0xc17a,0xc17b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xc17c,0xc17d,0xc17e,0xc17f,0xc180,0xc181,0xc182,0xc183,
-0xc184,0xc186,0xc187,0xc188,0xc189,0xc18a,0xc18b,0xc18f,
-0xc191,0xc192,0xc193,0xc195,0xc197,0xc198,0xc199,0xc19a,
-0xc19b,0xc19e,0xc1a0,0xc1a2,0xc1a3,0xc1a4,0xc1a6,0xc1a7,
-0xc1aa,0xc1ab,0xc1ad,0xc1ae,0xc1af,0xc1b1,0xc1b2,0xc1b3,
-0xc1b4,0xc1b5,0xc1b6,0xc1b7,0xc1b8,0xc1b9,0xc1ba,0xc1bb,
-0xc1bc,0xc1be,0xc1bf,0xc1c0,0xc1c1,0xc1c2,0xc1c3,0xc1c5,
-0xc1c6,0xc1c7,0xc1c9,0xc1ca,0xc1cb,0xc1cd,0xc1ce,0xc1cf,
-0xc1d0,0xc1d1,0xc1d2,0xc1d3,0xc1d5,0xc1d6,0xc1d9,0xc1da,
-0xc1db,0xc1dc,0xc1dd,0xc1de,0xc1df,0xc1e1,0xc1e2,0xc1e3,
-0xc1e5,0xc1e6,0xc1e7,0xc1e9,0xc1ea,0xc1eb,0xc1ec,0xc1ed,
-0xc1ee,0xc1ef,0xc1f2,0xc1f4,0xc1f5,0xc1f6,0xc1f7,0xc1f8,
-0xc1f9,0xc1fa,0xc1fb,0xc1fe,0xc1ff,0xc201,0xc202,0xc203,
-0xc205,0xc206,0xc207,0xc208,0xc209,0xc20a,0xc20b,0xc20e,
-0xc210,0xc212,0xc213,0xc214,0xc215,0xc216,0xc217,0xc21a,
-0xc21b,0xc21d,0xc21e,0xc221,0xc222,0xc223,0xc224,0xc225,
-0xc226,0xc227,0xc22a,0xc22c,0xc22e,0xc230,0xc233,0xc235,
-0xc236,0xc237,0xc238,0xc239,0xc23a,0xc23b,0xc23c,0xc23d,
-0xc23e,0xc23f,0xc240,0xc241,0xc242,0xc243,0xc244,0xc245,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc246,0xc247,
-0xc249,0xc24a,0xc24b,0xc24c,0xc24d,0xc24e,0xc24f,0xc252,
-0xc253,0xc255,0xc256,0xc257,0xc259,0xc25a,0xc25b,0xc25c,
-0xc25d,0xc25e,0xc25f,0xc261,0xc262,0xc263,0xc264,0xc266,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc267,0xc268,
-0xc269,0xc26a,0xc26b,0xc26e,0xc26f,0xc271,0xc272,0xc273,
-0xc275,0xc276,0xc277,0xc278,0xc279,0xc27a,0xc27b,0xc27e,
-0xc280,0xc282,0xc283,0xc284,0xc285,0xc286,0xc287,0xc28a,
-0xc28b,0xc28c,0xc28d,0xc28e,0xc28f,0xc291,0xc292,0xc293,
-0xc294,0xc295,0xc296,0xc297,0xc299,0xc29a,0xc29c,0xc29e,
-0xc29f,0xc2a0,0xc2a1,0xc2a2,0xc2a3,0xc2a6,0xc2a7,0xc2a9,
-0xc2aa,0xc2ab,0xc2ae,0xc2af,0xc2b0,0xc2b1,0xc2b2,0xc2b3,
-0xc2b6,0xc2b8,0xc2ba,0xc2bb,0xc2bc,0xc2bd,0xc2be,0xc2bf,
-0xc2c0,0xc2c1,0xc2c2,0xc2c3,0xc2c4,0xc2c5,0xc2c6,0xc2c7,
-0xc2c8,0xc2c9,0xc2ca,0xc2cb,0xc2cc,0xc2cd,0xc2ce,0xc2cf,
-0xc2d0,0xc2d1,0xc2d2,0xc2d3,0xc2d4,0xc2d5,0xc2d6,0xc2d7,
-0xc2d8,0xc2d9,0xc2da,0xc2db,0xc2de,0xc2df,0xc2e1,0xc2e2,
-0xc2e5,0xc2e6,0xc2e7,0xc2e8,0xc2e9,0xc2ea,0xc2ee,0xc2f0,
-0xc2f2,0xc2f3,0xc2f4,0xc2f5,0xc2f7,0xc2fa,0xc2fd,0xc2fe,
-0xc2ff,0xc301,0xc302,0xc303,0xc304,0xc305,0xc306,0xc307,
-0xc30a,0xc30b,0xc30e,0xc30f,0xc310,0xc311,0xc312,0xc316,
-0xc317,0xc319,0xc31a,0xc31b,0xc31d,0xc31e,0xc31f,0xc320,
-0xc321,0xc322,0xc323,0xc326,0xc327,0xc32a,0xc32b,0xc32c,
-0xc32d,0xc32e,0xc32f,0xc330,0xc331,0xc332,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xc333,0xc334,0xc335,0xc336,
-0xc337,0xc338,0xc339,0xc33a,0xc33b,0xc33c,0xc33d,0xc33e,
-0xc33f,0xc340,0xc341,0xc342,0xc343,0xc344,0xc346,0xc347,
-0xc348,0xc349,0xc34a,0xc34b,0xc34c,0xc34d,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xc34e,0xc34f,0xc350,0xc351,
-0xc352,0xc353,0xc354,0xc355,0xc356,0xc357,0xc358,0xc359,
-0xc35a,0xc35b,0xc35c,0xc35d,0xc35e,0xc35f,0xc360,0xc361,
-0xc362,0xc363,0xc364,0xc365,0xc366,0xc367,0xc36a,0xc36b,
-0xc36d,0xc36e,0xc36f,0xc371,0xc373,0xc374,0xc375,0xc376,
-0xc377,0xc37a,0xc37b,0xc37e,0xc37f,0xc380,0xc381,0xc382,
-0xc383,0xc385,0xc386,0xc387,0xc389,0xc38a,0xc38b,0xc38d,
-0xc38e,0xc38f,0xc390,0xc391,0xc392,0xc393,0xc394,0xc395,
-0xc396,0xc397,0xc398,0xc399,0xc39a,0xc39b,0xc39c,0xc39d,
-0xc39e,0xc39f,0xc3a0,0xc3a1,0xc3a2,0xc3a3,0xc3a4,0xc3a5,
-0xc3a6,0xc3a7,0xc3a8,0xc3a9,0xc3aa,0xc3ab,0xc3ac,0xc3ad,
-0xc3ae,0xc3af,0xc3b0,0xc3b1,0xc3b2,0xc3b3,0xc3b4,0xc3b5,
-0xc3b6,0xc3b7,0xc3b8,0xc3b9,0xc3ba,0xc3bb,0xc3bc,0xc3bd,
-0xc3be,0xc3bf,0xc3c1,0xc3c2,0xc3c3,0xc3c4,0xc3c5,0xc3c6,
-0xc3c7,0xc3c8,0xc3c9,0xc3ca,0xc3cb,0xc3cc,0xc3cd,0xc3ce,
-0xc3cf,0xc3d0,0xc3d1,0xc3d2,0xc3d3,0xc3d4,0xc3d5,0xc3d6,
-0xc3d7,0xc3da,0xc3db,0xc3dd,0xc3de,0xc3e1,0xc3e3,0xc3e4,
-0xc3e5,0xc3e6,0xc3e7,0xc3ea,0xc3eb,0xc3ec,0xc3ee,0xc3ef,
-0xc3f0,0xc3f1,0xc3f2,0xc3f3,0xc3f6,0xc3f7,0xc3f9,0xc3fa,
-0xc3fb,0xc3fc,0xc3fd,0xc3fe,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xc3ff,0xc400,0xc401,0xc402,0xc403,0xc404,
-0xc405,0xc406,0xc407,0xc409,0xc40a,0xc40b,0xc40c,0xc40d,
-0xc40e,0xc40f,0xc411,0xc412,0xc413,0xc414,0xc415,0xc416,
-0xc417,0xc418,0xc419,0xc41a,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xc41b,0xc41c,0xc41d,0xc41e,0xc41f,0xc420,
-0xc421,0xc422,0xc423,0xc425,0xc426,0xc427,0xc428,0xc429,
-0xc42a,0xc42b,0xc42d,0xc42e,0xc42f,0xc431,0xc432,0xc433,
-0xc435,0xc436,0xc437,0xc438,0xc439,0xc43a,0xc43b,0xc43e,
-0xc43f,0xc440,0xc441,0xc442,0xc443,0xc444,0xc445,0xc446,
-0xc447,0xc449,0xc44a,0xc44b,0xc44c,0xc44d,0xc44e,0xc44f,
-0xc450,0xc451,0xc452,0xc453,0xc454,0xc455,0xc456,0xc457,
-0xc458,0xc459,0xc45a,0xc45b,0xc45c,0xc45d,0xc45e,0xc45f,
-0xc460,0xc461,0xc462,0xc463,0xc466,0xc467,0xc469,0xc46a,
-0xc46b,0xc46d,0xc46e,0xc46f,0xc470,0xc471,0xc472,0xc473,
-0xc476,0xc477,0xc478,0xc47a,0xc47b,0xc47c,0xc47d,0xc47e,
-0xc47f,0xc481,0xc482,0xc483,0xc484,0xc485,0xc486,0xc487,
-0xc488,0xc489,0xc48a,0xc48b,0xc48c,0xc48d,0xc48e,0xc48f,
-0xc490,0xc491,0xc492,0xc493,0xc495,0xc496,0xc497,0xc498,
-0xc499,0xc49a,0xc49b,0xc49d,0xc49e,0xc49f,0xc4a0,0xc4a1,
-0xc4a2,0xc4a3,0xc4a4,0xc4a5,0xc4a6,0xc4a7,0xc4a8,0xc4a9,
-0xc4aa,0xc4ab,0xc4ac,0xc4ad,0xc4ae,0xc4af,0xc4b0,0xc4b1,
-0xc4b2,0xc4b3,0xc4b4,0xc4b5,0xc4b6,0xc4b7,0xc4b9,0xc4ba,
-0xc4bb,0xc4bd,0xc4be,0xc4bf,0xc4c0,0xc4c1,0xc4c2,0xc4c3,
-0xc4c4,0xc4c5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xc4c6,0xc4c7,0xc4c8,0xc4c9,0xc4ca,0xc4cb,0xc4cc,0xc4cd,
-0xc4ce,0xc4cf,0xc4d0,0xc4d1,0xc4d2,0xc4d3,0xc4d4,0xc4d5,
-0xc4d6,0xc4d7,0xc4d8,0xc4d9,0xc4da,0xc4db,0xc4dc,0xc4dd,
-0xc4de,0xc4df,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xc4e0,0xc4e1,0xc4e2,0xc4e3,0xc4e4,0xc4e5,0xc4e6,0xc4e7,
-0xc4e8,0xc4ea,0xc4eb,0xc4ec,0xc4ed,0xc4ee,0xc4ef,0xc4f2,
-0xc4f3,0xc4f5,0xc4f6,0xc4f7,0xc4f9,0xc4fb,0xc4fc,0xc4fd,
-0xc4fe,0xc502,0xc503,0xc504,0xc505,0xc506,0xc507,0xc508,
-0xc509,0xc50a,0xc50b,0xc50d,0xc50e,0xc50f,0xc511,0xc512,
-0xc513,0xc515,0xc516,0xc517,0xc518,0xc519,0xc51a,0xc51b,
-0xc51d,0xc51e,0xc51f,0xc520,0xc521,0xc522,0xc523,0xc524,
-0xc525,0xc526,0xc527,0xc52a,0xc52b,0xc52d,0xc52e,0xc52f,
-0xc531,0xc532,0xc533,0xc534,0xc535,0xc536,0xc537,0xc53a,
-0xc53c,0xc53e,0xc53f,0xc540,0xc541,0xc542,0xc543,0xc546,
-0xc547,0xc54b,0xc54f,0xc550,0xc551,0xc552,0xc556,0xc55a,
-0xc55b,0xc55c,0xc55f,0xc562,0xc563,0xc565,0xc566,0xc567,
-0xc569,0xc56a,0xc56b,0xc56c,0xc56d,0xc56e,0xc56f,0xc572,
-0xc576,0xc577,0xc578,0xc579,0xc57a,0xc57b,0xc57e,0xc57f,
-0xc581,0xc582,0xc583,0xc585,0xc586,0xc588,0xc589,0xc58a,
-0xc58b,0xc58e,0xc590,0xc592,0xc593,0xc594,0xc596,0xc599,
-0xc59a,0xc59b,0xc59d,0xc59e,0xc59f,0xc5a1,0xc5a2,0xc5a3,
-0xc5a4,0xc5a5,0xc5a6,0xc5a7,0xc5a8,0xc5aa,0xc5ab,0xc5ac,
-0xc5ad,0xc5ae,0xc5af,0xc5b0,0xc5b1,0xc5b2,0xc5b3,0xc5b6,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc5b7,0xc5ba,
-0xc5bf,0xc5c0,0xc5c1,0xc5c2,0xc5c3,0xc5cb,0xc5cd,0xc5cf,
-0xc5d2,0xc5d3,0xc5d5,0xc5d6,0xc5d7,0xc5d9,0xc5da,0xc5db,
-0xc5dc,0xc5dd,0xc5de,0xc5df,0xc5e2,0xc5e4,0xc5e6,0xc5e7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc5e8,0xc5e9,
-0xc5ea,0xc5eb,0xc5ef,0xc5f1,0xc5f2,0xc5f3,0xc5f5,0xc5f8,
-0xc5f9,0xc5fa,0xc5fb,0xc602,0xc603,0xc604,0xc609,0xc60a,
-0xc60b,0xc60d,0xc60e,0xc60f,0xc611,0xc612,0xc613,0xc614,
-0xc615,0xc616,0xc617,0xc61a,0xc61d,0xc61e,0xc61f,0xc620,
-0xc621,0xc622,0xc623,0xc626,0xc627,0xc629,0xc62a,0xc62b,
-0xc62f,0xc631,0xc632,0xc636,0xc638,0xc63a,0xc63c,0xc63d,
-0xc63e,0xc63f,0xc642,0xc643,0xc645,0xc646,0xc647,0xc649,
-0xc64a,0xc64b,0xc64c,0xc64d,0xc64e,0xc64f,0xc652,0xc656,
-0xc657,0xc658,0xc659,0xc65a,0xc65b,0xc65e,0xc65f,0xc661,
-0xc662,0xc663,0xc664,0xc665,0xc666,0xc667,0xc668,0xc669,
-0xc66a,0xc66b,0xc66d,0xc66e,0xc670,0xc672,0xc673,0xc674,
-0xc675,0xc676,0xc677,0xc67a,0xc67b,0xc67d,0xc67e,0xc67f,
-0xc681,0xc682,0xc683,0xc684,0xc685,0xc686,0xc687,0xc68a,
-0xc68c,0xc68e,0xc68f,0xc690,0xc691,0xc692,0xc693,0xc696,
-0xc697,0xc699,0xc69a,0xc69b,0xc69d,0xc69e,0xc69f,0xc6a0,
-0xc6a1,0xc6a2,0xc6a3,0xc6a6,0xc6a8,0xc6aa,0xc6ab,0xc6ac,
-0xc6ad,0xc6ae,0xc6af,0xc6b2,0xc6b3,0xc6b5,0xc6b6,0xc6b7,
-0xc6bb,0xc6bc,0xc6bd,0xc6be,0xc6bf,0xc6c2,0xc6c4,0xc6c6,
-0xc6c7,0xc6c8,0xc6c9,0xc6ca,0xc6cb,0xc6ce,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xc6cf,0xc6d1,0xc6d2,0xc6d3,
-0xc6d5,0xc6d6,0xc6d7,0xc6d8,0xc6d9,0xc6da,0xc6db,0xc6de,
-0xc6df,0xc6e2,0xc6e3,0xc6e4,0xc6e5,0xc6e6,0xc6e7,0xc6ea,
-0xc6eb,0xc6ed,0xc6ee,0xc6ef,0xc6f1,0xc6f2,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xc6f3,0xc6f4,0xc6f5,0xc6f6,
-0xc6f7,0xc6fa,0xc6fb,0xc6fc,0xc6fe,0xc6ff,0xc700,0xc701,
-0xc702,0xc703,0xc706,0xc707,0xc709,0xc70a,0xc70b,0xc70d,
-0xc70e,0xc70f,0xc710,0xc711,0xc712,0xc713,0xc716,0xc718,
-0xc71a,0xc71b,0xc71c,0xc71d,0xc71e,0xc71f,0xc722,0xc723,
-0xc725,0xc726,0xc727,0xc729,0xc72a,0xc72b,0xc72c,0xc72d,
-0xc72e,0xc72f,0xc732,0xc734,0xc736,0xc738,0xc739,0xc73a,
-0xc73b,0xc73e,0xc73f,0xc741,0xc742,0xc743,0xc745,0xc746,
-0xc747,0xc748,0xc749,0xc74b,0xc74e,0xc750,0xc759,0xc75a,
-0xc75b,0xc75d,0xc75e,0xc75f,0xc761,0xc762,0xc763,0xc764,
-0xc765,0xc766,0xc767,0xc769,0xc76a,0xc76c,0xc76d,0xc76e,
-0xc76f,0xc770,0xc771,0xc772,0xc773,0xc776,0xc777,0xc779,
-0xc77a,0xc77b,0xc77f,0xc780,0xc781,0xc782,0xc786,0xc78b,
-0xc78c,0xc78d,0xc78f,0xc792,0xc793,0xc795,0xc799,0xc79b,
-0xc79c,0xc79d,0xc79e,0xc79f,0xc7a2,0xc7a7,0xc7a8,0xc7a9,
-0xc7aa,0xc7ab,0xc7ae,0xc7af,0xc7b1,0xc7b2,0xc7b3,0xc7b5,
-0xc7b6,0xc7b7,0xc7b8,0xc7b9,0xc7ba,0xc7bb,0xc7be,0xc7c2,
-0xc7c3,0xc7c4,0xc7c5,0xc7c6,0xc7c7,0xc7ca,0xc7cb,0xc7cd,
-0xc7cf,0xc7d1,0xc7d2,0xc7d3,0xc7d4,0xc7d5,0xc7d6,0xc7d7,
-0xc7d9,0xc7da,0xc7db,0xc7dc,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xc7de,0xc7df,0xc7e0,0xc7e1,0xc7e2,0xc7e3,
-0xc7e5,0xc7e6,0xc7e7,0xc7e9,0xc7ea,0xc7eb,0xc7ed,0xc7ee,
-0xc7ef,0xc7f0,0xc7f1,0xc7f2,0xc7f3,0xc7f4,0xc7f5,0xc7f6,
-0xc7f7,0xc7f8,0xc7f9,0xc7fa,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xc7fb,0xc7fc,0xc7fd,0xc7fe,0xc7ff,0xc802,
-0xc803,0xc805,0xc806,0xc807,0xc809,0xc80b,0xc80c,0xc80d,
-0xc80e,0xc80f,0xc812,0xc814,0xc817,0xc818,0xc819,0xc81a,
-0xc81b,0xc81e,0xc81f,0xc821,0xc822,0xc823,0xc825,0xc826,
-0xc827,0xc828,0xc829,0xc82a,0xc82b,0xc82e,0xc830,0xc832,
-0xc833,0xc834,0xc835,0xc836,0xc837,0xc839,0xc83a,0xc83b,
-0xc83d,0xc83e,0xc83f,0xc841,0xc842,0xc843,0xc844,0xc845,
-0xc846,0xc847,0xc84a,0xc84b,0xc84e,0xc84f,0xc850,0xc851,
-0xc852,0xc853,0xc855,0xc856,0xc857,0xc858,0xc859,0xc85a,
-0xc85b,0xc85c,0xc85d,0xc85e,0xc85f,0xc860,0xc861,0xc862,
-0xc863,0xc864,0xc865,0xc866,0xc867,0xc868,0xc869,0xc86a,
-0xc86b,0xc86c,0xc86d,0xc86e,0xc86f,0xc872,0xc873,0xc875,
-0xc876,0xc877,0xc879,0xc87b,0xc87c,0xc87d,0xc87e,0xc87f,
-0xc882,0xc884,0xc888,0xc889,0xc88a,0xc88e,0xc88f,0xc890,
-0xc891,0xc892,0xc893,0xc895,0xc896,0xc897,0xc898,0xc899,
-0xc89a,0xc89b,0xc89c,0xc89e,0xc8a0,0xc8a2,0xc8a3,0xc8a4
-};
-
-static const int uhc1_ucs_table_size = (sizeof(uhc1_ucs_table)/sizeof(unsigned short));
-
-static const unsigned short uhc2_ucs_table[] = {
-0xc8a5,0xc8a6,0xc8a7,0xc8a9,0xc8aa,0xc8ab,0xc8ac,0xc8ad,
-0xc8ae,0xc8af,0xc8b0,0xc8b1,0xc8b2,0xc8b3,0xc8b4,0xc8b5,
-0xc8b6,0xc8b7,0xc8b8,0xc8b9,0xc8ba,0xc8bb,0xc8be,0xc8bf,
-0xc8c0,0xc8c1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xc8c2,0xc8c3,0xc8c5,0xc8c6,0xc8c7,0xc8c9,0xc8ca,0xc8cb,
-0xc8cd,0xc8ce,0xc8cf,0xc8d0,0xc8d1,0xc8d2,0xc8d3,0xc8d6,
-0xc8d8,0xc8da,0xc8db,0xc8dc,0xc8dd,0xc8de,0xc8df,0xc8e2,
-0xc8e3,0xc8e5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xc8e6,0xc8e7,0xc8e8,0xc8e9,0xc8ea,0xc8eb,0xc8ec,0xc8ed,
-0xc8ee,0xc8ef,0xc8f0,0xc8f1,0xc8f2,0xc8f3,0xc8f4,0xc8f6,
-0xc8f7,0xc8f8,0xc8f9,0xc8fa,0xc8fb,0xc8fe,0xc8ff,0xc901,
-0xc902,0xc903,0xc907,0xc908,0xc909,0xc90a,0xc90b,0xc90e,
-0x3000,0x3001,0x3002,0x00b7,0x2025,0x2026,0x00a8,0x3003,
-0x00ad,0x2015,0x2225,0xff3c,0x223c,0x2018,0x2019,0x201c,
-0x201d,0x3014,0x3015,0x3008,0x3009,0x300a,0x300b,0x300c,
-0x300d,0x300e,0x300f,0x3010,0x3011,0x00b1,0x00d7,0x00f7,
-0x2260,0x2264,0x2265,0x221e,0x2234,0x00b0,0x2032,0x2033,
-0x2103,0x212b,0xffe0,0xffe1,0xffe5,0x2642,0x2640,0x2220,
-0x22a5,0x2312,0x2202,0x2207,0x2261,0x2252,0x00a7,0x203b,
-0x2606,0x2605,0x25cb,0x25cf,0x25ce,0x25c7,0x25c6,0x25a1,
-0x25a0,0x25b3,0x25b2,0x25bd,0x25bc,0x2192,0x2190,0x2191,
-0x2193,0x2194,0x3013,0x226a,0x226b,0x221a,0x223d,0x221d,
-0x2235,0x222b,0x222c,0x2208,0x220b,0x2286,0x2287,0x2282,
-0x2283,0x222a,0x2229,0x2227,0x2228,0xffe2,0xc910,0xc912,
-0xc913,0xc914,0xc915,0xc916,0xc917,0xc919,0xc91a,0xc91b,
-0xc91c,0xc91d,0xc91e,0xc91f,0xc920,0xc921,0xc922,0xc923,
-0xc924,0xc925,0xc926,0xc927,0xc928,0xc929,0xc92a,0xc92b,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc92d,0xc92e,
-0xc92f,0xc930,0xc931,0xc932,0xc933,0xc935,0xc936,0xc937,
-0xc938,0xc939,0xc93a,0xc93b,0xc93c,0xc93d,0xc93e,0xc93f,
-0xc940,0xc941,0xc942,0xc943,0xc944,0xc945,0xc946,0xc947,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc948,0xc949,
-0xc94a,0xc94b,0xc94c,0xc94d,0xc94e,0xc94f,0xc952,0xc953,
-0xc955,0xc956,0xc957,0xc959,0xc95a,0xc95b,0xc95c,0xc95d,
-0xc95e,0xc95f,0xc962,0xc964,0xc965,0xc966,0xc967,0xc968,
-0xc969,0xc96a,0xc96b,0xc96d,0xc96e,0xc96f,0x21d2,0x21d4,
-0x2200,0x2203,0x00b4,0xff5e,0x02c7,0x02d8,0x02dd,0x02da,
-0x02d9,0x00b8,0x02db,0x00a1,0x00bf,0x02d0,0x222e,0x2211,
-0x220f,0x00a4,0x2109,0x2030,0x25c1,0x25c0,0x25b7,0x25b6,
-0x2664,0x2660,0x2661,0x2665,0x2667,0x2663,0x2299,0x25c8,
-0x25a3,0x25d0,0x25d1,0x2592,0x25a4,0x25a5,0x25a8,0x25a7,
-0x25a6,0x25a9,0x2668,0x260f,0x260e,0x261c,0x261e,0x00b6,
-0x2020,0x2021,0x2195,0x2197,0x2199,0x2196,0x2198,0x266d,
-0x2669,0x266a,0x266c,0x327f,0x321c,0x2116,0x33c7,0x2122,
-0x33c2,0x33d8,0x2121,0x20ac,0x00ae,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xc971,0xc972,0xc973,0xc975,
-0xc976,0xc977,0xc978,0xc979,0xc97a,0xc97b,0xc97d,0xc97e,
-0xc97f,0xc980,0xc981,0xc982,0xc983,0xc984,0xc985,0xc986,
-0xc987,0xc98a,0xc98b,0xc98d,0xc98e,0xc98f,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xc991,0xc992,0xc993,0xc994,
-0xc995,0xc996,0xc997,0xc99a,0xc99c,0xc99e,0xc99f,0xc9a0,
-0xc9a1,0xc9a2,0xc9a3,0xc9a4,0xc9a5,0xc9a6,0xc9a7,0xc9a8,
-0xc9a9,0xc9aa,0xc9ab,0xc9ac,0xc9ad,0xc9ae,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xc9af,0xc9b0,0xc9b1,0xc9b2,
-0xc9b3,0xc9b4,0xc9b5,0xc9b6,0xc9b7,0xc9b8,0xc9b9,0xc9ba,
-0xc9bb,0xc9bc,0xc9bd,0xc9be,0xc9bf,0xc9c2,0xc9c3,0xc9c5,
-0xc9c6,0xc9c9,0xc9cb,0xc9cc,0xc9cd,0xc9ce,0xc9cf,0xc9d2,
-0xc9d4,0xc9d7,0xc9d8,0xc9db,0xff01,0xff02,0xff03,0xff04,
-0xff05,0xff06,0xff07,0xff08,0xff09,0xff0a,0xff0b,0xff0c,
-0xff0d,0xff0e,0xff0f,0xff10,0xff11,0xff12,0xff13,0xff14,
-0xff15,0xff16,0xff17,0xff18,0xff19,0xff1a,0xff1b,0xff1c,
-0xff1d,0xff1e,0xff1f,0xff20,0xff21,0xff22,0xff23,0xff24,
-0xff25,0xff26,0xff27,0xff28,0xff29,0xff2a,0xff2b,0xff2c,
-0xff2d,0xff2e,0xff2f,0xff30,0xff31,0xff32,0xff33,0xff34,
-0xff35,0xff36,0xff37,0xff38,0xff39,0xff3a,0xff3b,0xffe6,
-0xff3d,0xff3e,0xff3f,0xff40,0xff41,0xff42,0xff43,0xff44,
-0xff45,0xff46,0xff47,0xff48,0xff49,0xff4a,0xff4b,0xff4c,
-0xff4d,0xff4e,0xff4f,0xff50,0xff51,0xff52,0xff53,0xff54,
-0xff55,0xff56,0xff57,0xff58,0xff59,0xff5a,0xff5b,0xff5c,
-0xff5d,0xffe3,0xc9de,0xc9df,0xc9e1,0xc9e3,0xc9e5,0xc9e6,
-0xc9e8,0xc9e9,0xc9ea,0xc9eb,0xc9ee,0xc9f2,0xc9f3,0xc9f4,
-0xc9f5,0xc9f6,0xc9f7,0xc9fa,0xc9fb,0xc9fd,0xc9fe,0xc9ff,
-0xca01,0xca02,0xca03,0xca04,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xca05,0xca06,0xca07,0xca0a,0xca0e,0xca0f,
-0xca10,0xca11,0xca12,0xca13,0xca15,0xca16,0xca17,0xca19,
-0xca1a,0xca1b,0xca1c,0xca1d,0xca1e,0xca1f,0xca20,0xca21,
-0xca22,0xca23,0xca24,0xca25,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xca26,0xca27,0xca28,0xca2a,0xca2b,0xca2c,
-0xca2d,0xca2e,0xca2f,0xca30,0xca31,0xca32,0xca33,0xca34,
-0xca35,0xca36,0xca37,0xca38,0xca39,0xca3a,0xca3b,0xca3c,
-0xca3d,0xca3e,0xca3f,0xca40,0xca41,0xca42,0xca43,0xca44,
-0xca45,0xca46,0x3131,0x3132,0x3133,0x3134,0x3135,0x3136,
-0x3137,0x3138,0x3139,0x313a,0x313b,0x313c,0x313d,0x313e,
-0x313f,0x3140,0x3141,0x3142,0x3143,0x3144,0x3145,0x3146,
-0x3147,0x3148,0x3149,0x314a,0x314b,0x314c,0x314d,0x314e,
-0x314f,0x3150,0x3151,0x3152,0x3153,0x3154,0x3155,0x3156,
-0x3157,0x3158,0x3159,0x315a,0x315b,0x315c,0x315d,0x315e,
-0x315f,0x3160,0x3161,0x3162,0x3163,0x3164,0x3165,0x3166,
-0x3167,0x3168,0x3169,0x316a,0x316b,0x316c,0x316d,0x316e,
-0x316f,0x3170,0x3171,0x3172,0x3173,0x3174,0x3175,0x3176,
-0x3177,0x3178,0x3179,0x317a,0x317b,0x317c,0x317d,0x317e,
-0x317f,0x3180,0x3181,0x3182,0x3183,0x3184,0x3185,0x3186,
-0x3187,0x3188,0x3189,0x318a,0x318b,0x318c,0x318d,0x318e,
-0xca47,0xca48,0xca49,0xca4a,0xca4b,0xca4e,0xca4f,0xca51,
-0xca52,0xca53,0xca55,0xca56,0xca57,0xca58,0xca59,0xca5a,
-0xca5b,0xca5e,0xca62,0xca63,0xca64,0xca65,0xca66,0xca67,
-0xca69,0xca6a,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xca6b,0xca6c,0xca6d,0xca6e,0xca6f,0xca70,0xca71,0xca72,
-0xca73,0xca74,0xca75,0xca76,0xca77,0xca78,0xca79,0xca7a,
-0xca7b,0xca7c,0xca7e,0xca7f,0xca80,0xca81,0xca82,0xca83,
-0xca85,0xca86,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xca87,0xca88,0xca89,0xca8a,0xca8b,0xca8c,0xca8d,0xca8e,
-0xca8f,0xca90,0xca91,0xca92,0xca93,0xca94,0xca95,0xca96,
-0xca97,0xca99,0xca9a,0xca9b,0xca9c,0xca9d,0xca9e,0xca9f,
-0xcaa0,0xcaa1,0xcaa2,0xcaa3,0xcaa4,0xcaa5,0xcaa6,0xcaa7,
-0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177,
-0x2178,0x2179,0x0000,0x0000,0x0000,0x0000,0x0000,0x2160,
-0x2161,0x2162,0x2163,0x2164,0x2165,0x2166,0x2167,0x2168,
-0x2169,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,
-0x0399,0x039a,0x039b,0x039c,0x039d,0x039e,0x039f,0x03a0,
-0x03a1,0x03a3,0x03a4,0x03a5,0x03a6,0x03a7,0x03a8,0x03a9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x03b1,0x03b2,0x03b3,0x03b4,0x03b5,0x03b6,0x03b7,0x03b8,
-0x03b9,0x03ba,0x03bb,0x03bc,0x03bd,0x03be,0x03bf,0x03c0,
-0x03c1,0x03c3,0x03c4,0x03c5,0x03c6,0x03c7,0x03c8,0x03c9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcaa8,0xcaa9,
-0xcaaa,0xcaab,0xcaac,0xcaad,0xcaae,0xcaaf,0xcab0,0xcab1,
-0xcab2,0xcab3,0xcab4,0xcab5,0xcab6,0xcab7,0xcab8,0xcab9,
-0xcaba,0xcabb,0xcabe,0xcabf,0xcac1,0xcac2,0xcac3,0xcac5,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcac6,0xcac7,
-0xcac8,0xcac9,0xcaca,0xcacb,0xcace,0xcad0,0xcad2,0xcad4,
-0xcad5,0xcad6,0xcad7,0xcada,0xcadb,0xcadc,0xcadd,0xcade,
-0xcadf,0xcae1,0xcae2,0xcae3,0xcae4,0xcae5,0xcae6,0xcae7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcae8,0xcae9,
-0xcaea,0xcaeb,0xcaed,0xcaee,0xcaef,0xcaf0,0xcaf1,0xcaf2,
-0xcaf3,0xcaf5,0xcaf6,0xcaf7,0xcaf8,0xcaf9,0xcafa,0xcafb,
-0xcafc,0xcafd,0xcafe,0xcaff,0xcb00,0xcb01,0xcb02,0xcb03,
-0xcb04,0xcb05,0xcb06,0xcb07,0xcb09,0xcb0a,0x2500,0x2502,
-0x250c,0x2510,0x2518,0x2514,0x251c,0x252c,0x2524,0x2534,
-0x253c,0x2501,0x2503,0x250f,0x2513,0x251b,0x2517,0x2523,
-0x2533,0x252b,0x253b,0x254b,0x2520,0x252f,0x2528,0x2537,
-0x253f,0x251d,0x2530,0x2525,0x2538,0x2542,0x2512,0x2511,
-0x251a,0x2519,0x2516,0x2515,0x250e,0x250d,0x251e,0x251f,
-0x2521,0x2522,0x2526,0x2527,0x2529,0x252a,0x252d,0x252e,
-0x2531,0x2532,0x2535,0x2536,0x2539,0x253a,0x253d,0x253e,
-0x2540,0x2541,0x2543,0x2544,0x2545,0x2546,0x2547,0x2548,
-0x2549,0x254a,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcb0b,0xcb0c,0xcb0d,0xcb0e,
-0xcb0f,0xcb11,0xcb12,0xcb13,0xcb15,0xcb16,0xcb17,0xcb19,
-0xcb1a,0xcb1b,0xcb1c,0xcb1d,0xcb1e,0xcb1f,0xcb22,0xcb23,
-0xcb24,0xcb25,0xcb26,0xcb27,0xcb28,0xcb29,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcb2a,0xcb2b,0xcb2c,0xcb2d,
-0xcb2e,0xcb2f,0xcb30,0xcb31,0xcb32,0xcb33,0xcb34,0xcb35,
-0xcb36,0xcb37,0xcb38,0xcb39,0xcb3a,0xcb3b,0xcb3c,0xcb3d,
-0xcb3e,0xcb3f,0xcb40,0xcb42,0xcb43,0xcb44,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcb45,0xcb46,0xcb47,0xcb4a,
-0xcb4b,0xcb4d,0xcb4e,0xcb4f,0xcb51,0xcb52,0xcb53,0xcb54,
-0xcb55,0xcb56,0xcb57,0xcb5a,0xcb5b,0xcb5c,0xcb5e,0xcb5f,
-0xcb60,0xcb61,0xcb62,0xcb63,0xcb65,0xcb66,0xcb67,0xcb68,
-0xcb69,0xcb6a,0xcb6b,0xcb6c,0x3395,0x3396,0x3397,0x2113,
-0x3398,0x33c4,0x33a3,0x33a4,0x33a5,0x33a6,0x3399,0x339a,
-0x339b,0x339c,0x339d,0x339e,0x339f,0x33a0,0x33a1,0x33a2,
-0x33ca,0x338d,0x338e,0x338f,0x33cf,0x3388,0x3389,0x33c8,
-0x33a7,0x33a8,0x33b0,0x33b1,0x33b2,0x33b3,0x33b4,0x33b5,
-0x33b6,0x33b7,0x33b8,0x33b9,0x3380,0x3381,0x3382,0x3383,
-0x3384,0x33ba,0x33bb,0x33bc,0x33bd,0x33be,0x33bf,0x3390,
-0x3391,0x3392,0x3393,0x3394,0x2126,0x33c0,0x33c1,0x338a,
-0x338b,0x338c,0x33d6,0x33c5,0x33ad,0x33ae,0x33af,0x33db,
-0x33a9,0x33aa,0x33ab,0x33ac,0x33dd,0x33d0,0x33d3,0x33c3,
-0x33c9,0x33dc,0x33c6,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xcb6d,0xcb6e,0xcb6f,0xcb70,0xcb71,0xcb72,
-0xcb73,0xcb74,0xcb75,0xcb76,0xcb77,0xcb7a,0xcb7b,0xcb7c,
-0xcb7d,0xcb7e,0xcb7f,0xcb80,0xcb81,0xcb82,0xcb83,0xcb84,
-0xcb85,0xcb86,0xcb87,0xcb88,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xcb89,0xcb8a,0xcb8b,0xcb8c,0xcb8d,0xcb8e,
-0xcb8f,0xcb90,0xcb91,0xcb92,0xcb93,0xcb94,0xcb95,0xcb96,
-0xcb97,0xcb98,0xcb99,0xcb9a,0xcb9b,0xcb9d,0xcb9e,0xcb9f,
-0xcba0,0xcba1,0xcba2,0xcba3,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xcba4,0xcba5,0xcba6,0xcba7,0xcba8,0xcba9,
-0xcbaa,0xcbab,0xcbac,0xcbad,0xcbae,0xcbaf,0xcbb0,0xcbb1,
-0xcbb2,0xcbb3,0xcbb4,0xcbb5,0xcbb6,0xcbb7,0xcbb9,0xcbba,
-0xcbbb,0xcbbc,0xcbbd,0xcbbe,0xcbbf,0xcbc0,0xcbc1,0xcbc2,
-0xcbc3,0xcbc4,0x00c6,0x00d0,0x00aa,0x0126,0x0000,0x0132,
-0x0000,0x013f,0x0141,0x00d8,0x0152,0x00ba,0x00de,0x0166,
-0x014a,0x0000,0x3260,0x3261,0x3262,0x3263,0x3264,0x3265,
-0x3266,0x3267,0x3268,0x3269,0x326a,0x326b,0x326c,0x326d,
-0x326e,0x326f,0x3270,0x3271,0x3272,0x3273,0x3274,0x3275,
-0x3276,0x3277,0x3278,0x3279,0x327a,0x327b,0x24d0,0x24d1,
-0x24d2,0x24d3,0x24d4,0x24d5,0x24d6,0x24d7,0x24d8,0x24d9,
-0x24da,0x24db,0x24dc,0x24dd,0x24de,0x24df,0x24e0,0x24e1,
-0x24e2,0x24e3,0x24e4,0x24e5,0x24e6,0x24e7,0x24e8,0x24e9,
-0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,
-0x2468,0x2469,0x246a,0x246b,0x246c,0x246d,0x246e,0x00bd,
-0x2153,0x2154,0x00bc,0x00be,0x215b,0x215c,0x215d,0x215e,
-0xcbc5,0xcbc6,0xcbc7,0xcbc8,0xcbc9,0xcbca,0xcbcb,0xcbcc,
-0xcbcd,0xcbce,0xcbcf,0xcbd0,0xcbd1,0xcbd2,0xcbd3,0xcbd5,
-0xcbd6,0xcbd7,0xcbd8,0xcbd9,0xcbda,0xcbdb,0xcbdc,0xcbdd,
-0xcbde,0xcbdf,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcbe0,0xcbe1,0xcbe2,0xcbe3,0xcbe5,0xcbe6,0xcbe8,0xcbea,
-0xcbeb,0xcbec,0xcbed,0xcbee,0xcbef,0xcbf0,0xcbf1,0xcbf2,
-0xcbf3,0xcbf4,0xcbf5,0xcbf6,0xcbf7,0xcbf8,0xcbf9,0xcbfa,
-0xcbfb,0xcbfc,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcbfd,0xcbfe,0xcbff,0xcc00,0xcc01,0xcc02,0xcc03,0xcc04,
-0xcc05,0xcc06,0xcc07,0xcc08,0xcc09,0xcc0a,0xcc0b,0xcc0e,
-0xcc0f,0xcc11,0xcc12,0xcc13,0xcc15,0xcc16,0xcc17,0xcc18,
-0xcc19,0xcc1a,0xcc1b,0xcc1e,0xcc1f,0xcc20,0xcc23,0xcc24,
-0x00e6,0x0111,0x00f0,0x0127,0x0131,0x0133,0x0138,0x0140,
-0x0142,0x00f8,0x0153,0x00df,0x00fe,0x0167,0x014b,0x0149,
-0x3200,0x3201,0x3202,0x3203,0x3204,0x3205,0x3206,0x3207,
-0x3208,0x3209,0x320a,0x320b,0x320c,0x320d,0x320e,0x320f,
-0x3210,0x3211,0x3212,0x3213,0x3214,0x3215,0x3216,0x3217,
-0x3218,0x3219,0x321a,0x321b,0x249c,0x249d,0x249e,0x249f,
-0x24a0,0x24a1,0x24a2,0x24a3,0x24a4,0x24a5,0x24a6,0x24a7,
-0x24a8,0x24a9,0x24aa,0x24ab,0x24ac,0x24ad,0x24ae,0x24af,
-0x24b0,0x24b1,0x24b2,0x24b3,0x24b4,0x24b5,0x2474,0x2475,
-0x2476,0x2477,0x2478,0x2479,0x247a,0x247b,0x247c,0x247d,
-0x247e,0x247f,0x2480,0x2481,0x2482,0x00b9,0x00b2,0x00b3,
-0x2074,0x207f,0x2081,0x2082,0x2083,0x2084,0xcc25,0xcc26,
-0xcc2a,0xcc2b,0xcc2d,0xcc2f,0xcc31,0xcc32,0xcc33,0xcc34,
-0xcc35,0xcc36,0xcc37,0xcc3a,0xcc3f,0xcc40,0xcc41,0xcc42,
-0xcc43,0xcc46,0xcc47,0xcc49,0xcc4a,0xcc4b,0xcc4d,0xcc4e,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcc4f,0xcc50,
-0xcc51,0xcc52,0xcc53,0xcc56,0xcc5a,0xcc5b,0xcc5c,0xcc5d,
-0xcc5e,0xcc5f,0xcc61,0xcc62,0xcc63,0xcc65,0xcc67,0xcc69,
-0xcc6a,0xcc6b,0xcc6c,0xcc6d,0xcc6e,0xcc6f,0xcc71,0xcc72,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcc73,0xcc74,
-0xcc76,0xcc77,0xcc78,0xcc79,0xcc7a,0xcc7b,0xcc7c,0xcc7d,
-0xcc7e,0xcc7f,0xcc80,0xcc81,0xcc82,0xcc83,0xcc84,0xcc85,
-0xcc86,0xcc87,0xcc88,0xcc89,0xcc8a,0xcc8b,0xcc8c,0xcc8d,
-0xcc8e,0xcc8f,0xcc90,0xcc91,0xcc92,0xcc93,0x3041,0x3042,
-0x3043,0x3044,0x3045,0x3046,0x3047,0x3048,0x3049,0x304a,
-0x304b,0x304c,0x304d,0x304e,0x304f,0x3050,0x3051,0x3052,
-0x3053,0x3054,0x3055,0x3056,0x3057,0x3058,0x3059,0x305a,
-0x305b,0x305c,0x305d,0x305e,0x305f,0x3060,0x3061,0x3062,
-0x3063,0x3064,0x3065,0x3066,0x3067,0x3068,0x3069,0x306a,
-0x306b,0x306c,0x306d,0x306e,0x306f,0x3070,0x3071,0x3072,
-0x3073,0x3074,0x3075,0x3076,0x3077,0x3078,0x3079,0x307a,
-0x307b,0x307c,0x307d,0x307e,0x307f,0x3080,0x3081,0x3082,
-0x3083,0x3084,0x3085,0x3086,0x3087,0x3088,0x3089,0x308a,
-0x308b,0x308c,0x308d,0x308e,0x308f,0x3090,0x3091,0x3092,
-0x3093,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcc94,0xcc95,0xcc96,0xcc97,
-0xcc9a,0xcc9b,0xcc9d,0xcc9e,0xcc9f,0xcca1,0xcca2,0xcca3,
-0xcca4,0xcca5,0xcca6,0xcca7,0xccaa,0xccae,0xccaf,0xccb0,
-0xccb1,0xccb2,0xccb3,0xccb6,0xccb7,0xccb9,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xccba,0xccbb,0xccbd,0xccbe,
-0xccbf,0xccc0,0xccc1,0xccc2,0xccc3,0xccc6,0xccc8,0xccca,
-0xcccb,0xcccc,0xcccd,0xccce,0xcccf,0xccd1,0xccd2,0xccd3,
-0xccd5,0xccd6,0xccd7,0xccd8,0xccd9,0xccda,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xccdb,0xccdc,0xccdd,0xccde,
-0xccdf,0xcce0,0xcce1,0xcce2,0xcce3,0xcce5,0xcce6,0xcce7,
-0xcce8,0xcce9,0xccea,0xcceb,0xcced,0xccee,0xccef,0xccf1,
-0xccf2,0xccf3,0xccf4,0xccf5,0xccf6,0xccf7,0xccf8,0xccf9,
-0xccfa,0xccfb,0xccfc,0xccfd,0x30a1,0x30a2,0x30a3,0x30a4,
-0x30a5,0x30a6,0x30a7,0x30a8,0x30a9,0x30aa,0x30ab,0x30ac,
-0x30ad,0x30ae,0x30af,0x30b0,0x30b1,0x30b2,0x30b3,0x30b4,
-0x30b5,0x30b6,0x30b7,0x30b8,0x30b9,0x30ba,0x30bb,0x30bc,
-0x30bd,0x30be,0x30bf,0x30c0,0x30c1,0x30c2,0x30c3,0x30c4,
-0x30c5,0x30c6,0x30c7,0x30c8,0x30c9,0x30ca,0x30cb,0x30cc,
-0x30cd,0x30ce,0x30cf,0x30d0,0x30d1,0x30d2,0x30d3,0x30d4,
-0x30d5,0x30d6,0x30d7,0x30d8,0x30d9,0x30da,0x30db,0x30dc,
-0x30dd,0x30de,0x30df,0x30e0,0x30e1,0x30e2,0x30e3,0x30e4,
-0x30e5,0x30e6,0x30e7,0x30e8,0x30e9,0x30ea,0x30eb,0x30ec,
-0x30ed,0x30ee,0x30ef,0x30f0,0x30f1,0x30f2,0x30f3,0x30f4,
-0x30f5,0x30f6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xccfe,0xccff,0xcd00,0xcd02,0xcd03,0xcd04,
-0xcd05,0xcd06,0xcd07,0xcd0a,0xcd0b,0xcd0d,0xcd0e,0xcd0f,
-0xcd11,0xcd12,0xcd13,0xcd14,0xcd15,0xcd16,0xcd17,0xcd1a,
-0xcd1c,0xcd1e,0xcd1f,0xcd20,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xcd21,0xcd22,0xcd23,0xcd25,0xcd26,0xcd27,
-0xcd29,0xcd2a,0xcd2b,0xcd2d,0xcd2e,0xcd2f,0xcd30,0xcd31,
-0xcd32,0xcd33,0xcd34,0xcd35,0xcd36,0xcd37,0xcd38,0xcd3a,
-0xcd3b,0xcd3c,0xcd3d,0xcd3e,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xcd3f,0xcd40,0xcd41,0xcd42,0xcd43,0xcd44,
-0xcd45,0xcd46,0xcd47,0xcd48,0xcd49,0xcd4a,0xcd4b,0xcd4c,
-0xcd4d,0xcd4e,0xcd4f,0xcd50,0xcd51,0xcd52,0xcd53,0xcd54,
-0xcd55,0xcd56,0xcd57,0xcd58,0xcd59,0xcd5a,0xcd5b,0xcd5d,
-0xcd5e,0xcd5f,0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,
-0x0401,0x0416,0x0417,0x0418,0x0419,0x041a,0x041b,0x041c,
-0x041d,0x041e,0x041f,0x0420,0x0421,0x0422,0x0423,0x0424,
-0x0425,0x0426,0x0427,0x0428,0x0429,0x042a,0x042b,0x042c,
-0x042d,0x042e,0x042f,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,
-0x0451,0x0436,0x0437,0x0438,0x0439,0x043a,0x043b,0x043c,
-0x043d,0x043e,0x043f,0x0440,0x0441,0x0442,0x0443,0x0444,
-0x0445,0x0446,0x0447,0x0448,0x0449,0x044a,0x044b,0x044c,
-0x044d,0x044e,0x044f,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcd61,0xcd62,0xcd63,0xcd65,0xcd66,0xcd67,0xcd68,0xcd69,
-0xcd6a,0xcd6b,0xcd6e,0xcd70,0xcd72,0xcd73,0xcd74,0xcd75,
-0xcd76,0xcd77,0xcd79,0xcd7a,0xcd7b,0xcd7c,0xcd7d,0xcd7e,
-0xcd7f,0xcd80,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcd81,0xcd82,0xcd83,0xcd84,0xcd85,0xcd86,0xcd87,0xcd89,
-0xcd8a,0xcd8b,0xcd8c,0xcd8d,0xcd8e,0xcd8f,0xcd90,0xcd91,
-0xcd92,0xcd93,0xcd96,0xcd97,0xcd99,0xcd9a,0xcd9b,0xcd9d,
-0xcd9e,0xcd9f,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcda0,0xcda1,0xcda2,0xcda3,0xcda6,0xcda8,0xcdaa,0xcdab,
-0xcdac,0xcdad,0xcdae,0xcdaf,0xcdb1,0xcdb2,0xcdb3,0xcdb4,
-0xcdb5,0xcdb6,0xcdb7,0xcdb8,0xcdb9,0xcdba,0xcdbb,0xcdbc,
-0xcdbd,0xcdbe,0xcdbf,0xcdc0,0xcdc1,0xcdc2,0xcdc3,0xcdc5,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcdc6,0xcdc7,
-0xcdc8,0xcdc9,0xcdca,0xcdcb,0xcdcd,0xcdce,0xcdcf,0xcdd1,
-0xcdd2,0xcdd3,0xcdd4,0xcdd5,0xcdd6,0xcdd7,0xcdd8,0xcdd9,
-0xcdda,0xcddb,0xcddc,0xcddd,0xcdde,0xcddf,0xcde0,0xcde1,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcde2,0xcde3,
-0xcde4,0xcde5,0xcde6,0xcde7,0xcde9,0xcdea,0xcdeb,0xcded,
-0xcdee,0xcdef,0xcdf1,0xcdf2,0xcdf3,0xcdf4,0xcdf5,0xcdf6,
-0xcdf7,0xcdfa,0xcdfc,0xcdfe,0xcdff,0xce00,0xce01,0xce02,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xce03,0xce05,
-0xce06,0xce07,0xce09,0xce0a,0xce0b,0xce0d,0xce0e,0xce0f,
-0xce10,0xce11,0xce12,0xce13,0xce15,0xce16,0xce17,0xce18,
-0xce1a,0xce1b,0xce1c,0xce1d,0xce1e,0xce1f,0xce22,0xce23,
-0xce25,0xce26,0xce27,0xce29,0xce2a,0xce2b,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xce2c,0xce2d,0xce2e,0xce2f,
-0xce32,0xce34,0xce36,0xce37,0xce38,0xce39,0xce3a,0xce3b,
-0xce3c,0xce3d,0xce3e,0xce3f,0xce40,0xce41,0xce42,0xce43,
-0xce44,0xce45,0xce46,0xce47,0xce48,0xce49,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xce4a,0xce4b,0xce4c,0xce4d,
-0xce4e,0xce4f,0xce50,0xce51,0xce52,0xce53,0xce54,0xce55,
-0xce56,0xce57,0xce5a,0xce5b,0xce5d,0xce5e,0xce62,0xce63,
-0xce64,0xce65,0xce66,0xce67,0xce6a,0xce6c,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xce6e,0xce6f,0xce70,0xce71,
-0xce72,0xce73,0xce76,0xce77,0xce79,0xce7a,0xce7b,0xce7d,
-0xce7e,0xce7f,0xce80,0xce81,0xce82,0xce83,0xce86,0xce88,
-0xce8a,0xce8b,0xce8c,0xce8d,0xce8e,0xce8f,0xce92,0xce93,
-0xce95,0xce96,0xce97,0xce99,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xce9a,0xce9b,0xce9c,0xce9d,0xce9e,0xce9f,
-0xcea2,0xcea6,0xcea7,0xcea8,0xcea9,0xceaa,0xceab,0xceae,
-0xceaf,0xceb0,0xceb1,0xceb2,0xceb3,0xceb4,0xceb5,0xceb6,
-0xceb7,0xceb8,0xceb9,0xceba,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xcebb,0xcebc,0xcebd,0xcebe,0xcebf,0xcec0,
-0xcec2,0xcec3,0xcec4,0xcec5,0xcec6,0xcec7,0xcec8,0xcec9,
-0xceca,0xcecb,0xcecc,0xcecd,0xcece,0xcecf,0xced0,0xced1,
-0xced2,0xced3,0xced4,0xced5,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xced6,0xced7,0xced8,0xced9,0xceda,0xcedb,
-0xcedc,0xcedd,0xcede,0xcedf,0xcee0,0xcee1,0xcee2,0xcee3,
-0xcee6,0xcee7,0xcee9,0xceea,0xceed,0xceee,0xceef,0xcef0,
-0xcef1,0xcef2,0xcef3,0xcef6,0xcefa,0xcefb,0xcefc,0xcefd,
-0xcefe,0xceff,0xac00,0xac01,0xac04,0xac07,0xac08,0xac09,
-0xac0a,0xac10,0xac11,0xac12,0xac13,0xac14,0xac15,0xac16,
-0xac17,0xac19,0xac1a,0xac1b,0xac1c,0xac1d,0xac20,0xac24,
-0xac2c,0xac2d,0xac2f,0xac30,0xac31,0xac38,0xac39,0xac3c,
-0xac40,0xac4b,0xac4d,0xac54,0xac58,0xac5c,0xac70,0xac71,
-0xac74,0xac77,0xac78,0xac7a,0xac80,0xac81,0xac83,0xac84,
-0xac85,0xac86,0xac89,0xac8a,0xac8b,0xac8c,0xac90,0xac94,
-0xac9c,0xac9d,0xac9f,0xaca0,0xaca1,0xaca8,0xaca9,0xacaa,
-0xacac,0xacaf,0xacb0,0xacb8,0xacb9,0xacbb,0xacbc,0xacbd,
-0xacc1,0xacc4,0xacc8,0xaccc,0xacd5,0xacd7,0xace0,0xace1,
-0xace4,0xace7,0xace8,0xacea,0xacec,0xacef,0xacf0,0xacf1,
-0xacf3,0xacf5,0xacf6,0xacfc,0xacfd,0xad00,0xad04,0xad06,
-0xcf02,0xcf03,0xcf05,0xcf06,0xcf07,0xcf09,0xcf0a,0xcf0b,
-0xcf0c,0xcf0d,0xcf0e,0xcf0f,0xcf12,0xcf14,0xcf16,0xcf17,
-0xcf18,0xcf19,0xcf1a,0xcf1b,0xcf1d,0xcf1e,0xcf1f,0xcf21,
-0xcf22,0xcf23,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcf25,0xcf26,0xcf27,0xcf28,0xcf29,0xcf2a,0xcf2b,0xcf2e,
-0xcf32,0xcf33,0xcf34,0xcf35,0xcf36,0xcf37,0xcf39,0xcf3a,
-0xcf3b,0xcf3c,0xcf3d,0xcf3e,0xcf3f,0xcf40,0xcf41,0xcf42,
-0xcf43,0xcf44,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcf45,0xcf46,0xcf47,0xcf48,0xcf49,0xcf4a,0xcf4b,0xcf4c,
-0xcf4d,0xcf4e,0xcf4f,0xcf50,0xcf51,0xcf52,0xcf53,0xcf56,
-0xcf57,0xcf59,0xcf5a,0xcf5b,0xcf5d,0xcf5e,0xcf5f,0xcf60,
-0xcf61,0xcf62,0xcf63,0xcf66,0xcf68,0xcf6a,0xcf6b,0xcf6c,
-0xad0c,0xad0d,0xad0f,0xad11,0xad18,0xad1c,0xad20,0xad29,
-0xad2c,0xad2d,0xad34,0xad35,0xad38,0xad3c,0xad44,0xad45,
-0xad47,0xad49,0xad50,0xad54,0xad58,0xad61,0xad63,0xad6c,
-0xad6d,0xad70,0xad73,0xad74,0xad75,0xad76,0xad7b,0xad7c,
-0xad7d,0xad7f,0xad81,0xad82,0xad88,0xad89,0xad8c,0xad90,
-0xad9c,0xad9d,0xada4,0xadb7,0xadc0,0xadc1,0xadc4,0xadc8,
-0xadd0,0xadd1,0xadd3,0xaddc,0xade0,0xade4,0xadf8,0xadf9,
-0xadfc,0xadff,0xae00,0xae01,0xae08,0xae09,0xae0b,0xae0d,
-0xae14,0xae30,0xae31,0xae34,0xae37,0xae38,0xae3a,0xae40,
-0xae41,0xae43,0xae45,0xae46,0xae4a,0xae4c,0xae4d,0xae4e,
-0xae50,0xae54,0xae56,0xae5c,0xae5d,0xae5f,0xae60,0xae61,
-0xae65,0xae68,0xae69,0xae6c,0xae70,0xae78,0xcf6d,0xcf6e,
-0xcf6f,0xcf72,0xcf73,0xcf75,0xcf76,0xcf77,0xcf79,0xcf7a,
-0xcf7b,0xcf7c,0xcf7d,0xcf7e,0xcf7f,0xcf81,0xcf82,0xcf83,
-0xcf84,0xcf86,0xcf87,0xcf88,0xcf89,0xcf8a,0xcf8b,0xcf8d,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcf8e,0xcf8f,
-0xcf90,0xcf91,0xcf92,0xcf93,0xcf94,0xcf95,0xcf96,0xcf97,
-0xcf98,0xcf99,0xcf9a,0xcf9b,0xcf9c,0xcf9d,0xcf9e,0xcf9f,
-0xcfa0,0xcfa2,0xcfa3,0xcfa4,0xcfa5,0xcfa6,0xcfa7,0xcfa9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcfaa,0xcfab,
-0xcfac,0xcfad,0xcfae,0xcfaf,0xcfb1,0xcfb2,0xcfb3,0xcfb4,
-0xcfb5,0xcfb6,0xcfb7,0xcfb8,0xcfb9,0xcfba,0xcfbb,0xcfbc,
-0xcfbd,0xcfbe,0xcfbf,0xcfc0,0xcfc1,0xcfc2,0xcfc3,0xcfc5,
-0xcfc6,0xcfc7,0xcfc8,0xcfc9,0xcfca,0xcfcb,0xae79,0xae7b,
-0xae7c,0xae7d,0xae84,0xae85,0xae8c,0xaebc,0xaebd,0xaebe,
-0xaec0,0xaec4,0xaecc,0xaecd,0xaecf,0xaed0,0xaed1,0xaed8,
-0xaed9,0xaedc,0xaee8,0xaeeb,0xaeed,0xaef4,0xaef8,0xaefc,
-0xaf07,0xaf08,0xaf0d,0xaf10,0xaf2c,0xaf2d,0xaf30,0xaf32,
-0xaf34,0xaf3c,0xaf3d,0xaf3f,0xaf41,0xaf42,0xaf43,0xaf48,
-0xaf49,0xaf50,0xaf5c,0xaf5d,0xaf64,0xaf65,0xaf79,0xaf80,
-0xaf84,0xaf88,0xaf90,0xaf91,0xaf95,0xaf9c,0xafb8,0xafb9,
-0xafbc,0xafc0,0xafc7,0xafc8,0xafc9,0xafcb,0xafcd,0xafce,
-0xafd4,0xafdc,0xafe8,0xafe9,0xaff0,0xaff1,0xaff4,0xaff8,
-0xb000,0xb001,0xb004,0xb00c,0xb010,0xb014,0xb01c,0xb01d,
-0xb028,0xb044,0xb045,0xb048,0xb04a,0xb04c,0xb04e,0xb053,
-0xb054,0xb055,0xb057,0xb059,0xcfcc,0xcfcd,0xcfce,0xcfcf,
-0xcfd0,0xcfd1,0xcfd2,0xcfd3,0xcfd4,0xcfd5,0xcfd6,0xcfd7,
-0xcfd8,0xcfd9,0xcfda,0xcfdb,0xcfdc,0xcfdd,0xcfde,0xcfdf,
-0xcfe2,0xcfe3,0xcfe5,0xcfe6,0xcfe7,0xcfe9,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcfea,0xcfeb,0xcfec,0xcfed,
-0xcfee,0xcfef,0xcff2,0xcff4,0xcff6,0xcff7,0xcff8,0xcff9,
-0xcffa,0xcffb,0xcffd,0xcffe,0xcfff,0xd001,0xd002,0xd003,
-0xd005,0xd006,0xd007,0xd008,0xd009,0xd00a,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd00b,0xd00c,0xd00d,0xd00e,
-0xd00f,0xd010,0xd012,0xd013,0xd014,0xd015,0xd016,0xd017,
-0xd019,0xd01a,0xd01b,0xd01c,0xd01d,0xd01e,0xd01f,0xd020,
-0xd021,0xd022,0xd023,0xd024,0xd025,0xd026,0xd027,0xd028,
-0xd029,0xd02a,0xd02b,0xd02c,0xb05d,0xb07c,0xb07d,0xb080,
-0xb084,0xb08c,0xb08d,0xb08f,0xb091,0xb098,0xb099,0xb09a,
-0xb09c,0xb09f,0xb0a0,0xb0a1,0xb0a2,0xb0a8,0xb0a9,0xb0ab,
-0xb0ac,0xb0ad,0xb0ae,0xb0af,0xb0b1,0xb0b3,0xb0b4,0xb0b5,
-0xb0b8,0xb0bc,0xb0c4,0xb0c5,0xb0c7,0xb0c8,0xb0c9,0xb0d0,
-0xb0d1,0xb0d4,0xb0d8,0xb0e0,0xb0e5,0xb108,0xb109,0xb10b,
-0xb10c,0xb110,0xb112,0xb113,0xb118,0xb119,0xb11b,0xb11c,
-0xb11d,0xb123,0xb124,0xb125,0xb128,0xb12c,0xb134,0xb135,
-0xb137,0xb138,0xb139,0xb140,0xb141,0xb144,0xb148,0xb150,
-0xb151,0xb154,0xb155,0xb158,0xb15c,0xb160,0xb178,0xb179,
-0xb17c,0xb180,0xb182,0xb188,0xb189,0xb18b,0xb18d,0xb192,
-0xb193,0xb194,0xb198,0xb19c,0xb1a8,0xb1cc,0xb1d0,0xb1d4,
-0xb1dc,0xb1dd,0xd02e,0xd02f,0xd030,0xd031,0xd032,0xd033,
-0xd036,0xd037,0xd039,0xd03a,0xd03b,0xd03d,0xd03e,0xd03f,
-0xd040,0xd041,0xd042,0xd043,0xd046,0xd048,0xd04a,0xd04b,
-0xd04c,0xd04d,0xd04e,0xd04f,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd051,0xd052,0xd053,0xd055,0xd056,0xd057,
-0xd059,0xd05a,0xd05b,0xd05c,0xd05d,0xd05e,0xd05f,0xd061,
-0xd062,0xd063,0xd064,0xd065,0xd066,0xd067,0xd068,0xd069,
-0xd06a,0xd06b,0xd06e,0xd06f,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd071,0xd072,0xd073,0xd075,0xd076,0xd077,
-0xd078,0xd079,0xd07a,0xd07b,0xd07e,0xd07f,0xd080,0xd082,
-0xd083,0xd084,0xd085,0xd086,0xd087,0xd088,0xd089,0xd08a,
-0xd08b,0xd08c,0xd08d,0xd08e,0xd08f,0xd090,0xd091,0xd092,
-0xd093,0xd094,0xb1df,0xb1e8,0xb1e9,0xb1ec,0xb1f0,0xb1f9,
-0xb1fb,0xb1fd,0xb204,0xb205,0xb208,0xb20b,0xb20c,0xb214,
-0xb215,0xb217,0xb219,0xb220,0xb234,0xb23c,0xb258,0xb25c,
-0xb260,0xb268,0xb269,0xb274,0xb275,0xb27c,0xb284,0xb285,
-0xb289,0xb290,0xb291,0xb294,0xb298,0xb299,0xb29a,0xb2a0,
-0xb2a1,0xb2a3,0xb2a5,0xb2a6,0xb2aa,0xb2ac,0xb2b0,0xb2b4,
-0xb2c8,0xb2c9,0xb2cc,0xb2d0,0xb2d2,0xb2d8,0xb2d9,0xb2db,
-0xb2dd,0xb2e2,0xb2e4,0xb2e5,0xb2e6,0xb2e8,0xb2eb,0xb2ec,
-0xb2ed,0xb2ee,0xb2ef,0xb2f3,0xb2f4,0xb2f5,0xb2f7,0xb2f8,
-0xb2f9,0xb2fa,0xb2fb,0xb2ff,0xb300,0xb301,0xb304,0xb308,
-0xb310,0xb311,0xb313,0xb314,0xb315,0xb31c,0xb354,0xb355,
-0xb356,0xb358,0xb35b,0xb35c,0xb35e,0xb35f,0xb364,0xb365,
-0xd095,0xd096,0xd097,0xd098,0xd099,0xd09a,0xd09b,0xd09c,
-0xd09d,0xd09e,0xd09f,0xd0a0,0xd0a1,0xd0a2,0xd0a3,0xd0a6,
-0xd0a7,0xd0a9,0xd0aa,0xd0ab,0xd0ad,0xd0ae,0xd0af,0xd0b0,
-0xd0b1,0xd0b2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd0b3,0xd0b6,0xd0b8,0xd0ba,0xd0bb,0xd0bc,0xd0bd,0xd0be,
-0xd0bf,0xd0c2,0xd0c3,0xd0c5,0xd0c6,0xd0c7,0xd0ca,0xd0cb,
-0xd0cc,0xd0cd,0xd0ce,0xd0cf,0xd0d2,0xd0d6,0xd0d7,0xd0d8,
-0xd0d9,0xd0da,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd0db,0xd0de,0xd0df,0xd0e1,0xd0e2,0xd0e3,0xd0e5,0xd0e6,
-0xd0e7,0xd0e8,0xd0e9,0xd0ea,0xd0eb,0xd0ee,0xd0f2,0xd0f3,
-0xd0f4,0xd0f5,0xd0f6,0xd0f7,0xd0f9,0xd0fa,0xd0fb,0xd0fc,
-0xd0fd,0xd0fe,0xd0ff,0xd100,0xd101,0xd102,0xd103,0xd104,
-0xb367,0xb369,0xb36b,0xb36e,0xb370,0xb371,0xb374,0xb378,
-0xb380,0xb381,0xb383,0xb384,0xb385,0xb38c,0xb390,0xb394,
-0xb3a0,0xb3a1,0xb3a8,0xb3ac,0xb3c4,0xb3c5,0xb3c8,0xb3cb,
-0xb3cc,0xb3ce,0xb3d0,0xb3d4,0xb3d5,0xb3d7,0xb3d9,0xb3db,
-0xb3dd,0xb3e0,0xb3e4,0xb3e8,0xb3fc,0xb410,0xb418,0xb41c,
-0xb420,0xb428,0xb429,0xb42b,0xb434,0xb450,0xb451,0xb454,
-0xb458,0xb460,0xb461,0xb463,0xb465,0xb46c,0xb480,0xb488,
-0xb49d,0xb4a4,0xb4a8,0xb4ac,0xb4b5,0xb4b7,0xb4b9,0xb4c0,
-0xb4c4,0xb4c8,0xb4d0,0xb4d5,0xb4dc,0xb4dd,0xb4e0,0xb4e3,
-0xb4e4,0xb4e6,0xb4ec,0xb4ed,0xb4ef,0xb4f1,0xb4f8,0xb514,
-0xb515,0xb518,0xb51b,0xb51c,0xb524,0xb525,0xb527,0xb528,
-0xb529,0xb52a,0xb530,0xb531,0xb534,0xb538,0xd105,0xd106,
-0xd107,0xd108,0xd109,0xd10a,0xd10b,0xd10c,0xd10e,0xd10f,
-0xd110,0xd111,0xd112,0xd113,0xd114,0xd115,0xd116,0xd117,
-0xd118,0xd119,0xd11a,0xd11b,0xd11c,0xd11d,0xd11e,0xd11f,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd120,0xd121,
-0xd122,0xd123,0xd124,0xd125,0xd126,0xd127,0xd128,0xd129,
-0xd12a,0xd12b,0xd12c,0xd12d,0xd12e,0xd12f,0xd132,0xd133,
-0xd135,0xd136,0xd137,0xd139,0xd13b,0xd13c,0xd13d,0xd13e,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd13f,0xd142,
-0xd146,0xd147,0xd148,0xd149,0xd14a,0xd14b,0xd14e,0xd14f,
-0xd151,0xd152,0xd153,0xd155,0xd156,0xd157,0xd158,0xd159,
-0xd15a,0xd15b,0xd15e,0xd160,0xd162,0xd163,0xd164,0xd165,
-0xd166,0xd167,0xd169,0xd16a,0xd16b,0xd16d,0xb540,0xb541,
-0xb543,0xb544,0xb545,0xb54b,0xb54c,0xb54d,0xb550,0xb554,
-0xb55c,0xb55d,0xb55f,0xb560,0xb561,0xb5a0,0xb5a1,0xb5a4,
-0xb5a8,0xb5aa,0xb5ab,0xb5b0,0xb5b1,0xb5b3,0xb5b4,0xb5b5,
-0xb5bb,0xb5bc,0xb5bd,0xb5c0,0xb5c4,0xb5cc,0xb5cd,0xb5cf,
-0xb5d0,0xb5d1,0xb5d8,0xb5ec,0xb610,0xb611,0xb614,0xb618,
-0xb625,0xb62c,0xb634,0xb648,0xb664,0xb668,0xb69c,0xb69d,
-0xb6a0,0xb6a4,0xb6ab,0xb6ac,0xb6b1,0xb6d4,0xb6f0,0xb6f4,
-0xb6f8,0xb700,0xb701,0xb705,0xb728,0xb729,0xb72c,0xb72f,
-0xb730,0xb738,0xb739,0xb73b,0xb744,0xb748,0xb74c,0xb754,
-0xb755,0xb760,0xb764,0xb768,0xb770,0xb771,0xb773,0xb775,
-0xb77c,0xb77d,0xb780,0xb784,0xb78c,0xb78d,0xb78f,0xb790,
-0xb791,0xb792,0xb796,0xb797,0xd16e,0xd16f,0xd170,0xd171,
-0xd172,0xd173,0xd174,0xd175,0xd176,0xd177,0xd178,0xd179,
-0xd17a,0xd17b,0xd17d,0xd17e,0xd17f,0xd180,0xd181,0xd182,
-0xd183,0xd185,0xd186,0xd187,0xd189,0xd18a,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd18b,0xd18c,0xd18d,0xd18e,
-0xd18f,0xd190,0xd191,0xd192,0xd193,0xd194,0xd195,0xd196,
-0xd197,0xd198,0xd199,0xd19a,0xd19b,0xd19c,0xd19d,0xd19e,
-0xd19f,0xd1a2,0xd1a3,0xd1a5,0xd1a6,0xd1a7,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd1a9,0xd1aa,0xd1ab,0xd1ac,
-0xd1ad,0xd1ae,0xd1af,0xd1b2,0xd1b4,0xd1b6,0xd1b7,0xd1b8,
-0xd1b9,0xd1bb,0xd1bd,0xd1be,0xd1bf,0xd1c1,0xd1c2,0xd1c3,
-0xd1c4,0xd1c5,0xd1c6,0xd1c7,0xd1c8,0xd1c9,0xd1ca,0xd1cb,
-0xd1cc,0xd1cd,0xd1ce,0xd1cf,0xb798,0xb799,0xb79c,0xb7a0,
-0xb7a8,0xb7a9,0xb7ab,0xb7ac,0xb7ad,0xb7b4,0xb7b5,0xb7b8,
-0xb7c7,0xb7c9,0xb7ec,0xb7ed,0xb7f0,0xb7f4,0xb7fc,0xb7fd,
-0xb7ff,0xb800,0xb801,0xb807,0xb808,0xb809,0xb80c,0xb810,
-0xb818,0xb819,0xb81b,0xb81d,0xb824,0xb825,0xb828,0xb82c,
-0xb834,0xb835,0xb837,0xb838,0xb839,0xb840,0xb844,0xb851,
-0xb853,0xb85c,0xb85d,0xb860,0xb864,0xb86c,0xb86d,0xb86f,
-0xb871,0xb878,0xb87c,0xb88d,0xb8a8,0xb8b0,0xb8b4,0xb8b8,
-0xb8c0,0xb8c1,0xb8c3,0xb8c5,0xb8cc,0xb8d0,0xb8d4,0xb8dd,
-0xb8df,0xb8e1,0xb8e8,0xb8e9,0xb8ec,0xb8f0,0xb8f8,0xb8f9,
-0xb8fb,0xb8fd,0xb904,0xb918,0xb920,0xb93c,0xb93d,0xb940,
-0xb944,0xb94c,0xb94f,0xb951,0xb958,0xb959,0xb95c,0xb960,
-0xb968,0xb969,0xd1d0,0xd1d1,0xd1d2,0xd1d3,0xd1d4,0xd1d5,
-0xd1d6,0xd1d7,0xd1d9,0xd1da,0xd1db,0xd1dc,0xd1dd,0xd1de,
-0xd1df,0xd1e0,0xd1e1,0xd1e2,0xd1e3,0xd1e4,0xd1e5,0xd1e6,
-0xd1e7,0xd1e8,0xd1e9,0xd1ea,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd1eb,0xd1ec,0xd1ed,0xd1ee,0xd1ef,0xd1f0,
-0xd1f1,0xd1f2,0xd1f3,0xd1f5,0xd1f6,0xd1f7,0xd1f9,0xd1fa,
-0xd1fb,0xd1fc,0xd1fd,0xd1fe,0xd1ff,0xd200,0xd201,0xd202,
-0xd203,0xd204,0xd205,0xd206,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd208,0xd20a,0xd20b,0xd20c,0xd20d,0xd20e,
-0xd20f,0xd211,0xd212,0xd213,0xd214,0xd215,0xd216,0xd217,
-0xd218,0xd219,0xd21a,0xd21b,0xd21c,0xd21d,0xd21e,0xd21f,
-0xd220,0xd221,0xd222,0xd223,0xd224,0xd225,0xd226,0xd227,
-0xd228,0xd229,0xb96b,0xb96d,0xb974,0xb975,0xb978,0xb97c,
-0xb984,0xb985,0xb987,0xb989,0xb98a,0xb98d,0xb98e,0xb9ac,
-0xb9ad,0xb9b0,0xb9b4,0xb9bc,0xb9bd,0xb9bf,0xb9c1,0xb9c8,
-0xb9c9,0xb9cc,0xb9ce,0xb9cf,0xb9d0,0xb9d1,0xb9d2,0xb9d8,
-0xb9d9,0xb9db,0xb9dd,0xb9de,0xb9e1,0xb9e3,0xb9e4,0xb9e5,
-0xb9e8,0xb9ec,0xb9f4,0xb9f5,0xb9f7,0xb9f8,0xb9f9,0xb9fa,
-0xba00,0xba01,0xba08,0xba15,0xba38,0xba39,0xba3c,0xba40,
-0xba42,0xba48,0xba49,0xba4b,0xba4d,0xba4e,0xba53,0xba54,
-0xba55,0xba58,0xba5c,0xba64,0xba65,0xba67,0xba68,0xba69,
-0xba70,0xba71,0xba74,0xba78,0xba83,0xba84,0xba85,0xba87,
-0xba8c,0xbaa8,0xbaa9,0xbaab,0xbaac,0xbab0,0xbab2,0xbab8,
-0xbab9,0xbabb,0xbabd,0xbac4,0xbac8,0xbad8,0xbad9,0xbafc,
-0xd22a,0xd22b,0xd22e,0xd22f,0xd231,0xd232,0xd233,0xd235,
-0xd236,0xd237,0xd238,0xd239,0xd23a,0xd23b,0xd23e,0xd240,
-0xd242,0xd243,0xd244,0xd245,0xd246,0xd247,0xd249,0xd24a,
-0xd24b,0xd24c,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd24d,0xd24e,0xd24f,0xd250,0xd251,0xd252,0xd253,0xd254,
-0xd255,0xd256,0xd257,0xd258,0xd259,0xd25a,0xd25b,0xd25d,
-0xd25e,0xd25f,0xd260,0xd261,0xd262,0xd263,0xd265,0xd266,
-0xd267,0xd268,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd269,0xd26a,0xd26b,0xd26c,0xd26d,0xd26e,0xd26f,0xd270,
-0xd271,0xd272,0xd273,0xd274,0xd275,0xd276,0xd277,0xd278,
-0xd279,0xd27a,0xd27b,0xd27c,0xd27d,0xd27e,0xd27f,0xd282,
-0xd283,0xd285,0xd286,0xd287,0xd289,0xd28a,0xd28b,0xd28c,
-0xbb00,0xbb04,0xbb0d,0xbb0f,0xbb11,0xbb18,0xbb1c,0xbb20,
-0xbb29,0xbb2b,0xbb34,0xbb35,0xbb36,0xbb38,0xbb3b,0xbb3c,
-0xbb3d,0xbb3e,0xbb44,0xbb45,0xbb47,0xbb49,0xbb4d,0xbb4f,
-0xbb50,0xbb54,0xbb58,0xbb61,0xbb63,0xbb6c,0xbb88,0xbb8c,
-0xbb90,0xbba4,0xbba8,0xbbac,0xbbb4,0xbbb7,0xbbc0,0xbbc4,
-0xbbc8,0xbbd0,0xbbd3,0xbbf8,0xbbf9,0xbbfc,0xbbff,0xbc00,
-0xbc02,0xbc08,0xbc09,0xbc0b,0xbc0c,0xbc0d,0xbc0f,0xbc11,
-0xbc14,0xbc15,0xbc16,0xbc17,0xbc18,0xbc1b,0xbc1c,0xbc1d,
-0xbc1e,0xbc1f,0xbc24,0xbc25,0xbc27,0xbc29,0xbc2d,0xbc30,
-0xbc31,0xbc34,0xbc38,0xbc40,0xbc41,0xbc43,0xbc44,0xbc45,
-0xbc49,0xbc4c,0xbc4d,0xbc50,0xbc5d,0xbc84,0xbc85,0xbc88,
-0xbc8b,0xbc8c,0xbc8e,0xbc94,0xbc95,0xbc97,0xd28d,0xd28e,
-0xd28f,0xd292,0xd293,0xd294,0xd296,0xd297,0xd298,0xd299,
-0xd29a,0xd29b,0xd29d,0xd29e,0xd29f,0xd2a1,0xd2a2,0xd2a3,
-0xd2a5,0xd2a6,0xd2a7,0xd2a8,0xd2a9,0xd2aa,0xd2ab,0xd2ad,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd2ae,0xd2af,
-0xd2b0,0xd2b2,0xd2b3,0xd2b4,0xd2b5,0xd2b6,0xd2b7,0xd2ba,
-0xd2bb,0xd2bd,0xd2be,0xd2c1,0xd2c3,0xd2c4,0xd2c5,0xd2c6,
-0xd2c7,0xd2ca,0xd2cc,0xd2cd,0xd2ce,0xd2cf,0xd2d0,0xd2d1,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd2d2,0xd2d3,
-0xd2d5,0xd2d6,0xd2d7,0xd2d9,0xd2da,0xd2db,0xd2dd,0xd2de,
-0xd2df,0xd2e0,0xd2e1,0xd2e2,0xd2e3,0xd2e6,0xd2e7,0xd2e8,
-0xd2e9,0xd2ea,0xd2eb,0xd2ec,0xd2ed,0xd2ee,0xd2ef,0xd2f2,
-0xd2f3,0xd2f5,0xd2f6,0xd2f7,0xd2f9,0xd2fa,0xbc99,0xbc9a,
-0xbca0,0xbca1,0xbca4,0xbca7,0xbca8,0xbcb0,0xbcb1,0xbcb3,
-0xbcb4,0xbcb5,0xbcbc,0xbcbd,0xbcc0,0xbcc4,0xbccd,0xbccf,
-0xbcd0,0xbcd1,0xbcd5,0xbcd8,0xbcdc,0xbcf4,0xbcf5,0xbcf6,
-0xbcf8,0xbcfc,0xbd04,0xbd05,0xbd07,0xbd09,0xbd10,0xbd14,
-0xbd24,0xbd2c,0xbd40,0xbd48,0xbd49,0xbd4c,0xbd50,0xbd58,
-0xbd59,0xbd64,0xbd68,0xbd80,0xbd81,0xbd84,0xbd87,0xbd88,
-0xbd89,0xbd8a,0xbd90,0xbd91,0xbd93,0xbd95,0xbd99,0xbd9a,
-0xbd9c,0xbda4,0xbdb0,0xbdb8,0xbdd4,0xbdd5,0xbdd8,0xbddc,
-0xbde9,0xbdf0,0xbdf4,0xbdf8,0xbe00,0xbe03,0xbe05,0xbe0c,
-0xbe0d,0xbe10,0xbe14,0xbe1c,0xbe1d,0xbe1f,0xbe44,0xbe45,
-0xbe48,0xbe4c,0xbe4e,0xbe54,0xbe55,0xbe57,0xbe59,0xbe5a,
-0xbe5b,0xbe60,0xbe61,0xbe64,0xd2fb,0xd2fc,0xd2fd,0xd2fe,
-0xd2ff,0xd302,0xd304,0xd306,0xd307,0xd308,0xd309,0xd30a,
-0xd30b,0xd30f,0xd311,0xd312,0xd313,0xd315,0xd317,0xd318,
-0xd319,0xd31a,0xd31b,0xd31e,0xd322,0xd323,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd324,0xd326,0xd327,0xd32a,
-0xd32b,0xd32d,0xd32e,0xd32f,0xd331,0xd332,0xd333,0xd334,
-0xd335,0xd336,0xd337,0xd33a,0xd33e,0xd33f,0xd340,0xd341,
-0xd342,0xd343,0xd346,0xd347,0xd348,0xd349,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd34a,0xd34b,0xd34c,0xd34d,
-0xd34e,0xd34f,0xd350,0xd351,0xd352,0xd353,0xd354,0xd355,
-0xd356,0xd357,0xd358,0xd359,0xd35a,0xd35b,0xd35c,0xd35d,
-0xd35e,0xd35f,0xd360,0xd361,0xd362,0xd363,0xd364,0xd365,
-0xd366,0xd367,0xd368,0xd369,0xbe68,0xbe6a,0xbe70,0xbe71,
-0xbe73,0xbe74,0xbe75,0xbe7b,0xbe7c,0xbe7d,0xbe80,0xbe84,
-0xbe8c,0xbe8d,0xbe8f,0xbe90,0xbe91,0xbe98,0xbe99,0xbea8,
-0xbed0,0xbed1,0xbed4,0xbed7,0xbed8,0xbee0,0xbee3,0xbee4,
-0xbee5,0xbeec,0xbf01,0xbf08,0xbf09,0xbf18,0xbf19,0xbf1b,
-0xbf1c,0xbf1d,0xbf40,0xbf41,0xbf44,0xbf48,0xbf50,0xbf51,
-0xbf55,0xbf94,0xbfb0,0xbfc5,0xbfcc,0xbfcd,0xbfd0,0xbfd4,
-0xbfdc,0xbfdf,0xbfe1,0xc03c,0xc051,0xc058,0xc05c,0xc060,
-0xc068,0xc069,0xc090,0xc091,0xc094,0xc098,0xc0a0,0xc0a1,
-0xc0a3,0xc0a5,0xc0ac,0xc0ad,0xc0af,0xc0b0,0xc0b3,0xc0b4,
-0xc0b5,0xc0b6,0xc0bc,0xc0bd,0xc0bf,0xc0c0,0xc0c1,0xc0c5,
-0xc0c8,0xc0c9,0xc0cc,0xc0d0,0xc0d8,0xc0d9,0xc0db,0xc0dc,
-0xc0dd,0xc0e4,0xd36a,0xd36b,0xd36c,0xd36d,0xd36e,0xd36f,
-0xd370,0xd371,0xd372,0xd373,0xd374,0xd375,0xd376,0xd377,
-0xd378,0xd379,0xd37a,0xd37b,0xd37e,0xd37f,0xd381,0xd382,
-0xd383,0xd385,0xd386,0xd387,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd388,0xd389,0xd38a,0xd38b,0xd38e,0xd392,
-0xd393,0xd394,0xd395,0xd396,0xd397,0xd39a,0xd39b,0xd39d,
-0xd39e,0xd39f,0xd3a1,0xd3a2,0xd3a3,0xd3a4,0xd3a5,0xd3a6,
-0xd3a7,0xd3aa,0xd3ac,0xd3ae,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd3af,0xd3b0,0xd3b1,0xd3b2,0xd3b3,0xd3b5,
-0xd3b6,0xd3b7,0xd3b9,0xd3ba,0xd3bb,0xd3bd,0xd3be,0xd3bf,
-0xd3c0,0xd3c1,0xd3c2,0xd3c3,0xd3c6,0xd3c7,0xd3ca,0xd3cb,
-0xd3cc,0xd3cd,0xd3ce,0xd3cf,0xd3d1,0xd3d2,0xd3d3,0xd3d4,
-0xd3d5,0xd3d6,0xc0e5,0xc0e8,0xc0ec,0xc0f4,0xc0f5,0xc0f7,
-0xc0f9,0xc100,0xc104,0xc108,0xc110,0xc115,0xc11c,0xc11d,
-0xc11e,0xc11f,0xc120,0xc123,0xc124,0xc126,0xc127,0xc12c,
-0xc12d,0xc12f,0xc130,0xc131,0xc136,0xc138,0xc139,0xc13c,
-0xc140,0xc148,0xc149,0xc14b,0xc14c,0xc14d,0xc154,0xc155,
-0xc158,0xc15c,0xc164,0xc165,0xc167,0xc168,0xc169,0xc170,
-0xc174,0xc178,0xc185,0xc18c,0xc18d,0xc18e,0xc190,0xc194,
-0xc196,0xc19c,0xc19d,0xc19f,0xc1a1,0xc1a5,0xc1a8,0xc1a9,
-0xc1ac,0xc1b0,0xc1bd,0xc1c4,0xc1c8,0xc1cc,0xc1d4,0xc1d7,
-0xc1d8,0xc1e0,0xc1e4,0xc1e8,0xc1f0,0xc1f1,0xc1f3,0xc1fc,
-0xc1fd,0xc200,0xc204,0xc20c,0xc20d,0xc20f,0xc211,0xc218,
-0xc219,0xc21c,0xc21f,0xc220,0xc228,0xc229,0xc22b,0xc22d,
-0xd3d7,0xd3d9,0xd3da,0xd3db,0xd3dc,0xd3dd,0xd3de,0xd3df,
-0xd3e0,0xd3e2,0xd3e4,0xd3e5,0xd3e6,0xd3e7,0xd3e8,0xd3e9,
-0xd3ea,0xd3eb,0xd3ee,0xd3ef,0xd3f1,0xd3f2,0xd3f3,0xd3f5,
-0xd3f6,0xd3f7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd3f8,0xd3f9,0xd3fa,0xd3fb,0xd3fe,0xd400,0xd402,0xd403,
-0xd404,0xd405,0xd406,0xd407,0xd409,0xd40a,0xd40b,0xd40c,
-0xd40d,0xd40e,0xd40f,0xd410,0xd411,0xd412,0xd413,0xd414,
-0xd415,0xd416,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd417,0xd418,0xd419,0xd41a,0xd41b,0xd41c,0xd41e,0xd41f,
-0xd420,0xd421,0xd422,0xd423,0xd424,0xd425,0xd426,0xd427,
-0xd428,0xd429,0xd42a,0xd42b,0xd42c,0xd42d,0xd42e,0xd42f,
-0xd430,0xd431,0xd432,0xd433,0xd434,0xd435,0xd436,0xd437,
-0xc22f,0xc231,0xc232,0xc234,0xc248,0xc250,0xc251,0xc254,
-0xc258,0xc260,0xc265,0xc26c,0xc26d,0xc270,0xc274,0xc27c,
-0xc27d,0xc27f,0xc281,0xc288,0xc289,0xc290,0xc298,0xc29b,
-0xc29d,0xc2a4,0xc2a5,0xc2a8,0xc2ac,0xc2ad,0xc2b4,0xc2b5,
-0xc2b7,0xc2b9,0xc2dc,0xc2dd,0xc2e0,0xc2e3,0xc2e4,0xc2eb,
-0xc2ec,0xc2ed,0xc2ef,0xc2f1,0xc2f6,0xc2f8,0xc2f9,0xc2fb,
-0xc2fc,0xc300,0xc308,0xc309,0xc30c,0xc30d,0xc313,0xc314,
-0xc315,0xc318,0xc31c,0xc324,0xc325,0xc328,0xc329,0xc345,
-0xc368,0xc369,0xc36c,0xc370,0xc372,0xc378,0xc379,0xc37c,
-0xc37d,0xc384,0xc388,0xc38c,0xc3c0,0xc3d8,0xc3d9,0xc3dc,
-0xc3df,0xc3e0,0xc3e2,0xc3e8,0xc3e9,0xc3ed,0xc3f4,0xc3f5,
-0xc3f8,0xc408,0xc410,0xc424,0xc42c,0xc430,0xd438,0xd439,
-0xd43a,0xd43b,0xd43c,0xd43d,0xd43e,0xd43f,0xd441,0xd442,
-0xd443,0xd445,0xd446,0xd447,0xd448,0xd449,0xd44a,0xd44b,
-0xd44c,0xd44d,0xd44e,0xd44f,0xd450,0xd451,0xd452,0xd453,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd454,0xd455,
-0xd456,0xd457,0xd458,0xd459,0xd45a,0xd45b,0xd45d,0xd45e,
-0xd45f,0xd461,0xd462,0xd463,0xd465,0xd466,0xd467,0xd468,
-0xd469,0xd46a,0xd46b,0xd46c,0xd46e,0xd470,0xd471,0xd472,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd473,0xd474,
-0xd475,0xd476,0xd477,0xd47a,0xd47b,0xd47d,0xd47e,0xd481,
-0xd483,0xd484,0xd485,0xd486,0xd487,0xd48a,0xd48c,0xd48e,
-0xd48f,0xd490,0xd491,0xd492,0xd493,0xd495,0xd496,0xd497,
-0xd498,0xd499,0xd49a,0xd49b,0xd49c,0xd49d,0xc434,0xc43c,
-0xc43d,0xc448,0xc464,0xc465,0xc468,0xc46c,0xc474,0xc475,
-0xc479,0xc480,0xc494,0xc49c,0xc4b8,0xc4bc,0xc4e9,0xc4f0,
-0xc4f1,0xc4f4,0xc4f8,0xc4fa,0xc4ff,0xc500,0xc501,0xc50c,
-0xc510,0xc514,0xc51c,0xc528,0xc529,0xc52c,0xc530,0xc538,
-0xc539,0xc53b,0xc53d,0xc544,0xc545,0xc548,0xc549,0xc54a,
-0xc54c,0xc54d,0xc54e,0xc553,0xc554,0xc555,0xc557,0xc558,
-0xc559,0xc55d,0xc55e,0xc560,0xc561,0xc564,0xc568,0xc570,
-0xc571,0xc573,0xc574,0xc575,0xc57c,0xc57d,0xc580,0xc584,
-0xc587,0xc58c,0xc58d,0xc58f,0xc591,0xc595,0xc597,0xc598,
-0xc59c,0xc5a0,0xc5a9,0xc5b4,0xc5b5,0xc5b8,0xc5b9,0xc5bb,
-0xc5bc,0xc5bd,0xc5be,0xc5c4,0xc5c5,0xc5c6,0xc5c7,0xc5c8,
-0xc5c9,0xc5ca,0xc5cc,0xc5ce,0xd49e,0xd49f,0xd4a0,0xd4a1,
-0xd4a2,0xd4a3,0xd4a4,0xd4a5,0xd4a6,0xd4a7,0xd4a8,0xd4aa,
-0xd4ab,0xd4ac,0xd4ad,0xd4ae,0xd4af,0xd4b0,0xd4b1,0xd4b2,
-0xd4b3,0xd4b4,0xd4b5,0xd4b6,0xd4b7,0xd4b8,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd4b9,0xd4ba,0xd4bb,0xd4bc,
-0xd4bd,0xd4be,0xd4bf,0xd4c0,0xd4c1,0xd4c2,0xd4c3,0xd4c4,
-0xd4c5,0xd4c6,0xd4c7,0xd4c8,0xd4c9,0xd4ca,0xd4cb,0xd4cd,
-0xd4ce,0xd4cf,0xd4d1,0xd4d2,0xd4d3,0xd4d5,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd4d6,0xd4d7,0xd4d8,0xd4d9,
-0xd4da,0xd4db,0xd4dd,0xd4de,0xd4e0,0xd4e1,0xd4e2,0xd4e3,
-0xd4e4,0xd4e5,0xd4e6,0xd4e7,0xd4e9,0xd4ea,0xd4eb,0xd4ed,
-0xd4ee,0xd4ef,0xd4f1,0xd4f2,0xd4f3,0xd4f4,0xd4f5,0xd4f6,
-0xd4f7,0xd4f9,0xd4fa,0xd4fc,0xc5d0,0xc5d1,0xc5d4,0xc5d8,
-0xc5e0,0xc5e1,0xc5e3,0xc5e5,0xc5ec,0xc5ed,0xc5ee,0xc5f0,
-0xc5f4,0xc5f6,0xc5f7,0xc5fc,0xc5fd,0xc5fe,0xc5ff,0xc600,
-0xc601,0xc605,0xc606,0xc607,0xc608,0xc60c,0xc610,0xc618,
-0xc619,0xc61b,0xc61c,0xc624,0xc625,0xc628,0xc62c,0xc62d,
-0xc62e,0xc630,0xc633,0xc634,0xc635,0xc637,0xc639,0xc63b,
-0xc640,0xc641,0xc644,0xc648,0xc650,0xc651,0xc653,0xc654,
-0xc655,0xc65c,0xc65d,0xc660,0xc66c,0xc66f,0xc671,0xc678,
-0xc679,0xc67c,0xc680,0xc688,0xc689,0xc68b,0xc68d,0xc694,
-0xc695,0xc698,0xc69c,0xc6a4,0xc6a5,0xc6a7,0xc6a9,0xc6b0,
-0xc6b1,0xc6b4,0xc6b8,0xc6b9,0xc6ba,0xc6c0,0xc6c1,0xc6c3,
-0xc6c5,0xc6cc,0xc6cd,0xc6d0,0xc6d4,0xc6dc,0xc6dd,0xc6e0,
-0xc6e1,0xc6e8,0xd4fe,0xd4ff,0xd500,0xd501,0xd502,0xd503,
-0xd505,0xd506,0xd507,0xd509,0xd50a,0xd50b,0xd50d,0xd50e,
-0xd50f,0xd510,0xd511,0xd512,0xd513,0xd516,0xd518,0xd519,
-0xd51a,0xd51b,0xd51c,0xd51d,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd51e,0xd51f,0xd520,0xd521,0xd522,0xd523,
-0xd524,0xd525,0xd526,0xd527,0xd528,0xd529,0xd52a,0xd52b,
-0xd52c,0xd52d,0xd52e,0xd52f,0xd530,0xd531,0xd532,0xd533,
-0xd534,0xd535,0xd536,0xd537,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd538,0xd539,0xd53a,0xd53b,0xd53e,0xd53f,
-0xd541,0xd542,0xd543,0xd545,0xd546,0xd547,0xd548,0xd549,
-0xd54a,0xd54b,0xd54e,0xd550,0xd552,0xd553,0xd554,0xd555,
-0xd556,0xd557,0xd55a,0xd55b,0xd55d,0xd55e,0xd55f,0xd561,
-0xd562,0xd563,0xc6e9,0xc6ec,0xc6f0,0xc6f8,0xc6f9,0xc6fd,
-0xc704,0xc705,0xc708,0xc70c,0xc714,0xc715,0xc717,0xc719,
-0xc720,0xc721,0xc724,0xc728,0xc730,0xc731,0xc733,0xc735,
-0xc737,0xc73c,0xc73d,0xc740,0xc744,0xc74a,0xc74c,0xc74d,
-0xc74f,0xc751,0xc752,0xc753,0xc754,0xc755,0xc756,0xc757,
-0xc758,0xc75c,0xc760,0xc768,0xc76b,0xc774,0xc775,0xc778,
-0xc77c,0xc77d,0xc77e,0xc783,0xc784,0xc785,0xc787,0xc788,
-0xc789,0xc78a,0xc78e,0xc790,0xc791,0xc794,0xc796,0xc797,
-0xc798,0xc79a,0xc7a0,0xc7a1,0xc7a3,0xc7a4,0xc7a5,0xc7a6,
-0xc7ac,0xc7ad,0xc7b0,0xc7b4,0xc7bc,0xc7bd,0xc7bf,0xc7c0,
-0xc7c1,0xc7c8,0xc7c9,0xc7cc,0xc7ce,0xc7d0,0xc7d8,0xc7dd,
-0xc7e4,0xc7e8,0xc7ec,0xc800,0xc801,0xc804,0xc808,0xc80a,
-0xd564,0xd566,0xd567,0xd56a,0xd56c,0xd56e,0xd56f,0xd570,
-0xd571,0xd572,0xd573,0xd576,0xd577,0xd579,0xd57a,0xd57b,
-0xd57d,0xd57e,0xd57f,0xd580,0xd581,0xd582,0xd583,0xd586,
-0xd58a,0xd58b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd58c,0xd58d,0xd58e,0xd58f,0xd591,0xd592,0xd593,0xd594,
-0xd595,0xd596,0xd597,0xd598,0xd599,0xd59a,0xd59b,0xd59c,
-0xd59d,0xd59e,0xd59f,0xd5a0,0xd5a1,0xd5a2,0xd5a3,0xd5a4,
-0xd5a6,0xd5a7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd5a8,0xd5a9,0xd5aa,0xd5ab,0xd5ac,0xd5ad,0xd5ae,0xd5af,
-0xd5b0,0xd5b1,0xd5b2,0xd5b3,0xd5b4,0xd5b5,0xd5b6,0xd5b7,
-0xd5b8,0xd5b9,0xd5ba,0xd5bb,0xd5bc,0xd5bd,0xd5be,0xd5bf,
-0xd5c0,0xd5c1,0xd5c2,0xd5c3,0xd5c4,0xd5c5,0xd5c6,0xd5c7,
-0xc810,0xc811,0xc813,0xc815,0xc816,0xc81c,0xc81d,0xc820,
-0xc824,0xc82c,0xc82d,0xc82f,0xc831,0xc838,0xc83c,0xc840,
-0xc848,0xc849,0xc84c,0xc84d,0xc854,0xc870,0xc871,0xc874,
-0xc878,0xc87a,0xc880,0xc881,0xc883,0xc885,0xc886,0xc887,
-0xc88b,0xc88c,0xc88d,0xc894,0xc89d,0xc89f,0xc8a1,0xc8a8,
-0xc8bc,0xc8bd,0xc8c4,0xc8c8,0xc8cc,0xc8d4,0xc8d5,0xc8d7,
-0xc8d9,0xc8e0,0xc8e1,0xc8e4,0xc8f5,0xc8fc,0xc8fd,0xc900,
-0xc904,0xc905,0xc906,0xc90c,0xc90d,0xc90f,0xc911,0xc918,
-0xc92c,0xc934,0xc950,0xc951,0xc954,0xc958,0xc960,0xc961,
-0xc963,0xc96c,0xc970,0xc974,0xc97c,0xc988,0xc989,0xc98c,
-0xc990,0xc998,0xc999,0xc99b,0xc99d,0xc9c0,0xc9c1,0xc9c4,
-0xc9c7,0xc9c8,0xc9ca,0xc9d0,0xc9d1,0xc9d3,0xd5ca,0xd5cb,
-0xd5cd,0xd5ce,0xd5cf,0xd5d1,0xd5d3,0xd5d4,0xd5d5,0xd5d6,
-0xd5d7,0xd5da,0xd5dc,0xd5de,0xd5df,0xd5e0,0xd5e1,0xd5e2,
-0xd5e3,0xd5e6,0xd5e7,0xd5e9,0xd5ea,0xd5eb,0xd5ed,0xd5ee,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd5ef,0xd5f0,
-0xd5f1,0xd5f2,0xd5f3,0xd5f6,0xd5f8,0xd5fa,0xd5fb,0xd5fc,
-0xd5fd,0xd5fe,0xd5ff,0xd602,0xd603,0xd605,0xd606,0xd607,
-0xd609,0xd60a,0xd60b,0xd60c,0xd60d,0xd60e,0xd60f,0xd612,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd616,0xd617,
-0xd618,0xd619,0xd61a,0xd61b,0xd61d,0xd61e,0xd61f,0xd621,
-0xd622,0xd623,0xd625,0xd626,0xd627,0xd628,0xd629,0xd62a,
-0xd62b,0xd62c,0xd62e,0xd62f,0xd630,0xd631,0xd632,0xd633,
-0xd634,0xd635,0xd636,0xd637,0xd63a,0xd63b,0xc9d5,0xc9d6,
-0xc9d9,0xc9da,0xc9dc,0xc9dd,0xc9e0,0xc9e2,0xc9e4,0xc9e7,
-0xc9ec,0xc9ed,0xc9ef,0xc9f0,0xc9f1,0xc9f8,0xc9f9,0xc9fc,
-0xca00,0xca08,0xca09,0xca0b,0xca0c,0xca0d,0xca14,0xca18,
-0xca29,0xca4c,0xca4d,0xca50,0xca54,0xca5c,0xca5d,0xca5f,
-0xca60,0xca61,0xca68,0xca7d,0xca84,0xca98,0xcabc,0xcabd,
-0xcac0,0xcac4,0xcacc,0xcacd,0xcacf,0xcad1,0xcad3,0xcad8,
-0xcad9,0xcae0,0xcaec,0xcaf4,0xcb08,0xcb10,0xcb14,0xcb18,
-0xcb20,0xcb21,0xcb41,0xcb48,0xcb49,0xcb4c,0xcb50,0xcb58,
-0xcb59,0xcb5d,0xcb64,0xcb78,0xcb79,0xcb9c,0xcbb8,0xcbd4,
-0xcbe4,0xcbe7,0xcbe9,0xcc0c,0xcc0d,0xcc10,0xcc14,0xcc1c,
-0xcc1d,0xcc21,0xcc22,0xcc27,0xcc28,0xcc29,0xcc2c,0xcc2e,
-0xcc30,0xcc38,0xcc39,0xcc3b,0xd63d,0xd63e,0xd63f,0xd641,
-0xd642,0xd643,0xd644,0xd646,0xd647,0xd64a,0xd64c,0xd64e,
-0xd64f,0xd650,0xd652,0xd653,0xd656,0xd657,0xd659,0xd65a,
-0xd65b,0xd65d,0xd65e,0xd65f,0xd660,0xd661,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd662,0xd663,0xd664,0xd665,
-0xd666,0xd668,0xd66a,0xd66b,0xd66c,0xd66d,0xd66e,0xd66f,
-0xd672,0xd673,0xd675,0xd676,0xd677,0xd678,0xd679,0xd67a,
-0xd67b,0xd67c,0xd67d,0xd67e,0xd67f,0xd680,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd681,0xd682,0xd684,0xd686,
-0xd687,0xd688,0xd689,0xd68a,0xd68b,0xd68e,0xd68f,0xd691,
-0xd692,0xd693,0xd695,0xd696,0xd697,0xd698,0xd699,0xd69a,
-0xd69b,0xd69c,0xd69e,0xd6a0,0xd6a2,0xd6a3,0xd6a4,0xd6a5,
-0xd6a6,0xd6a7,0xd6a9,0xd6aa,0xcc3c,0xcc3d,0xcc3e,0xcc44,
-0xcc45,0xcc48,0xcc4c,0xcc54,0xcc55,0xcc57,0xcc58,0xcc59,
-0xcc60,0xcc64,0xcc66,0xcc68,0xcc70,0xcc75,0xcc98,0xcc99,
-0xcc9c,0xcca0,0xcca8,0xcca9,0xccab,0xccac,0xccad,0xccb4,
-0xccb5,0xccb8,0xccbc,0xccc4,0xccc5,0xccc7,0xccc9,0xccd0,
-0xccd4,0xcce4,0xccec,0xccf0,0xcd01,0xcd08,0xcd09,0xcd0c,
-0xcd10,0xcd18,0xcd19,0xcd1b,0xcd1d,0xcd24,0xcd28,0xcd2c,
-0xcd39,0xcd5c,0xcd60,0xcd64,0xcd6c,0xcd6d,0xcd6f,0xcd71,
-0xcd78,0xcd88,0xcd94,0xcd95,0xcd98,0xcd9c,0xcda4,0xcda5,
-0xcda7,0xcda9,0xcdb0,0xcdc4,0xcdcc,0xcdd0,0xcde8,0xcdec,
-0xcdf0,0xcdf8,0xcdf9,0xcdfb,0xcdfd,0xce04,0xce08,0xce0c,
-0xce14,0xce19,0xce20,0xce21,0xce24,0xce28,0xce30,0xce31,
-0xce33,0xce35,0xd6ab,0xd6ad,0xd6ae,0xd6af,0xd6b1,0xd6b2,
-0xd6b3,0xd6b4,0xd6b5,0xd6b6,0xd6b7,0xd6b8,0xd6ba,0xd6bc,
-0xd6bd,0xd6be,0xd6bf,0xd6c0,0xd6c1,0xd6c2,0xd6c3,0xd6c6,
-0xd6c7,0xd6c9,0xd6ca,0xd6cb,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd6cd,0xd6ce,0xd6cf,0xd6d0,0xd6d2,0xd6d3,
-0xd6d5,0xd6d6,0xd6d8,0xd6da,0xd6db,0xd6dc,0xd6dd,0xd6de,
-0xd6df,0xd6e1,0xd6e2,0xd6e3,0xd6e5,0xd6e6,0xd6e7,0xd6e9,
-0xd6ea,0xd6eb,0xd6ec,0xd6ed,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd6ee,0xd6ef,0xd6f1,0xd6f2,0xd6f3,0xd6f4,
-0xd6f6,0xd6f7,0xd6f8,0xd6f9,0xd6fa,0xd6fb,0xd6fe,0xd6ff,
-0xd701,0xd702,0xd703,0xd705,0xd706,0xd707,0xd708,0xd709,
-0xd70a,0xd70b,0xd70c,0xd70d,0xd70e,0xd70f,0xd710,0xd712,
-0xd713,0xd714,0xce58,0xce59,0xce5c,0xce5f,0xce60,0xce61,
-0xce68,0xce69,0xce6b,0xce6d,0xce74,0xce75,0xce78,0xce7c,
-0xce84,0xce85,0xce87,0xce89,0xce90,0xce91,0xce94,0xce98,
-0xcea0,0xcea1,0xcea3,0xcea4,0xcea5,0xceac,0xcead,0xcec1,
-0xcee4,0xcee5,0xcee8,0xceeb,0xceec,0xcef4,0xcef5,0xcef7,
-0xcef8,0xcef9,0xcf00,0xcf01,0xcf04,0xcf08,0xcf10,0xcf11,
-0xcf13,0xcf15,0xcf1c,0xcf20,0xcf24,0xcf2c,0xcf2d,0xcf2f,
-0xcf30,0xcf31,0xcf38,0xcf54,0xcf55,0xcf58,0xcf5c,0xcf64,
-0xcf65,0xcf67,0xcf69,0xcf70,0xcf71,0xcf74,0xcf78,0xcf80,
-0xcf85,0xcf8c,0xcfa1,0xcfa8,0xcfb0,0xcfc4,0xcfe0,0xcfe1,
-0xcfe4,0xcfe8,0xcff0,0xcff1,0xcff3,0xcff5,0xcffc,0xd000,
-0xd004,0xd011,0xd018,0xd02d,0xd034,0xd035,0xd038,0xd03c,
-0xd715,0xd716,0xd717,0xd71a,0xd71b,0xd71d,0xd71e,0xd71f,
-0xd721,0xd722,0xd723,0xd724,0xd725,0xd726,0xd727,0xd72a,
-0xd72c,0xd72e,0xd72f,0xd730,0xd731,0xd732,0xd733,0xd736,
-0xd737,0xd739,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd73a,0xd73b,0xd73d,0xd73e,0xd73f,0xd740,0xd741,0xd742,
-0xd743,0xd745,0xd746,0xd748,0xd74a,0xd74b,0xd74c,0xd74d,
-0xd74e,0xd74f,0xd752,0xd753,0xd755,0xd75a,0xd75b,0xd75c,
-0xd75d,0xd75e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd75f,0xd762,0xd764,0xd766,0xd767,0xd768,0xd76a,0xd76b,
-0xd76d,0xd76e,0xd76f,0xd771,0xd772,0xd773,0xd775,0xd776,
-0xd777,0xd778,0xd779,0xd77a,0xd77b,0xd77e,0xd77f,0xd780,
-0xd782,0xd783,0xd784,0xd785,0xd786,0xd787,0xd78a,0xd78b,
-0xd044,0xd045,0xd047,0xd049,0xd050,0xd054,0xd058,0xd060,
-0xd06c,0xd06d,0xd070,0xd074,0xd07c,0xd07d,0xd081,0xd0a4,
-0xd0a5,0xd0a8,0xd0ac,0xd0b4,0xd0b5,0xd0b7,0xd0b9,0xd0c0,
-0xd0c1,0xd0c4,0xd0c8,0xd0c9,0xd0d0,0xd0d1,0xd0d3,0xd0d4,
-0xd0d5,0xd0dc,0xd0dd,0xd0e0,0xd0e4,0xd0ec,0xd0ed,0xd0ef,
-0xd0f0,0xd0f1,0xd0f8,0xd10d,0xd130,0xd131,0xd134,0xd138,
-0xd13a,0xd140,0xd141,0xd143,0xd144,0xd145,0xd14c,0xd14d,
-0xd150,0xd154,0xd15c,0xd15d,0xd15f,0xd161,0xd168,0xd16c,
-0xd17c,0xd184,0xd188,0xd1a0,0xd1a1,0xd1a4,0xd1a8,0xd1b0,
-0xd1b1,0xd1b3,0xd1b5,0xd1ba,0xd1bc,0xd1c0,0xd1d8,0xd1f4,
-0xd1f8,0xd207,0xd209,0xd210,0xd22c,0xd22d,0xd230,0xd234,
-0xd23c,0xd23d,0xd23f,0xd241,0xd248,0xd25c,0xd78d,0xd78e,
-0xd78f,0xd791,0xd792,0xd793,0xd794,0xd795,0xd796,0xd797,
-0xd79a,0xd79c,0xd79e,0xd79f,0xd7a0,0xd7a1,0xd7a2,0xd7a3,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd264,0xd280,
-0xd281,0xd284,0xd288,0xd290,0xd291,0xd295,0xd29c,0xd2a0,
-0xd2a4,0xd2ac,0xd2b1,0xd2b8,0xd2b9,0xd2bc,0xd2bf,0xd2c0,
-0xd2c2,0xd2c8,0xd2c9,0xd2cb,0xd2d4,0xd2d8,0xd2dc,0xd2e4,
-0xd2e5,0xd2f0,0xd2f1,0xd2f4,0xd2f8,0xd300,0xd301,0xd303,
-0xd305,0xd30c,0xd30d,0xd30e,0xd310,0xd314,0xd316,0xd31c,
-0xd31d,0xd31f,0xd320,0xd321,0xd325,0xd328,0xd329,0xd32c,
-0xd330,0xd338,0xd339,0xd33b,0xd33c,0xd33d,0xd344,0xd345,
-0xd37c,0xd37d,0xd380,0xd384,0xd38c,0xd38d,0xd38f,0xd390,
-0xd391,0xd398,0xd399,0xd39c,0xd3a0,0xd3a8,0xd3a9,0xd3ab,
-0xd3ad,0xd3b4,0xd3b8,0xd3bc,0xd3c4,0xd3c5,0xd3c8,0xd3c9,
-0xd3d0,0xd3d8,0xd3e1,0xd3e3,0xd3ec,0xd3ed,0xd3f0,0xd3f4,
-0xd3fc,0xd3fd,0xd3ff,0xd401};
-
-static const int uhc2_ucs_table_size = (sizeof(uhc2_ucs_table)/sizeof(unsigned short));
-
-static const unsigned short uhc3_ucs_table[] = {
-0xd408,0xd41d,0xd440,0xd444,0xd45c,0xd460,0xd464,0xd46d,
-0xd46f,0xd478,0xd479,0xd47c,0xd47f,0xd480,0xd482,0xd488,
-0xd489,0xd48b,0xd48d,0xd494,0xd4a9,0xd4cc,0xd4d0,0xd4d4,
-0xd4dc,0xd4df,0xd4e8,0xd4ec,0xd4f0,0xd4f8,0xd4fb,0xd4fd,
-0xd504,0xd508,0xd50c,0xd514,0xd515,0xd517,0xd53c,0xd53d,
-0xd540,0xd544,0xd54c,0xd54d,0xd54f,0xd551,0xd558,0xd559,
-0xd55c,0xd560,0xd565,0xd568,0xd569,0xd56b,0xd56d,0xd574,
-0xd575,0xd578,0xd57c,0xd584,0xd585,0xd587,0xd588,0xd589,
-0xd590,0xd5a5,0xd5c8,0xd5c9,0xd5cc,0xd5d0,0xd5d2,0xd5d8,
-0xd5d9,0xd5db,0xd5dd,0xd5e4,0xd5e5,0xd5e8,0xd5ec,0xd5f4,
-0xd5f5,0xd5f7,0xd5f9,0xd600,0xd601,0xd604,0xd608,0xd610,
-0xd611,0xd613,0xd614,0xd615,0xd61c,0xd620,0xd624,0xd62d,
-0xd638,0xd639,0xd63c,0xd640,0xd645,0xd648,0xd649,0xd64b,
-0xd64d,0xd651,0xd654,0xd655,0xd658,0xd65c,0xd667,0xd669,
-0xd670,0xd671,0xd674,0xd683,0xd685,0xd68c,0xd68d,0xd690,
-0xd694,0xd69d,0xd69f,0xd6a1,0xd6a8,0xd6ac,0xd6b0,0xd6b9,
-0xd6bb,0xd6c4,0xd6c5,0xd6c8,0xd6cc,0xd6d1,0xd6d4,0xd6d7,
-0xd6d9,0xd6e0,0xd6e4,0xd6e8,0xd6f0,0xd6f5,0xd6fc,0xd6fd,
-0xd700,0xd704,0xd711,0xd718,0xd719,0xd71c,0xd720,0xd728,
-0xd729,0xd72b,0xd72d,0xd734,0xd735,0xd738,0xd73c,0xd744,
-0xd747,0xd749,0xd750,0xd751,0xd754,0xd756,0xd757,0xd758,
-0xd759,0xd760,0xd761,0xd763,0xd765,0xd769,0xd76c,0xd770,
-0xd774,0xd77c,0xd77d,0xd781,0xd788,0xd789,0xd78c,0xd790,
-0xd798,0xd799,0xd79b,0xd79d,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x4f3d,0x4f73,0x5047,0x50f9,0x52a0,0x53ef,
-0x5475,0x54e5,0x5609,0x5ac1,0x5bb6,0x6687,0x67b6,0x67b7,
-0x67ef,0x6b4c,0x73c2,0x75c2,0x7a3c,0x82db,0x8304,0x8857,
-0x8888,0x8a36,0x8cc8,0x8dcf,0x8efb,0x8fe6,0x99d5,0x523b,
-0x5374,0x5404,0x606a,0x6164,0x6bbc,0x73cf,0x811a,0x89ba,
-0x89d2,0x95a3,0x4f83,0x520a,0x58be,0x5978,0x59e6,0x5e72,
-0x5e79,0x61c7,0x63c0,0x6746,0x67ec,0x687f,0x6f97,0x764e,
-0x770b,0x78f5,0x7a08,0x7aff,0x7c21,0x809d,0x826e,0x8271,
-0x8aeb,0x9593,0x4e6b,0x559d,0x66f7,0x6e34,0x78a3,0x7aed,
-0x845b,0x8910,0x874e,0x97a8,0x52d8,0x574e,0x582a,0x5d4c,
-0x611f,0x61be,0x6221,0x6562,0x67d1,0x6a44,0x6e1b,0x7518,
-0x75b3,0x76e3,0x77b0,0x7d3a,0x90af,0x9451,0x9452,0x9f95,
-0x5323,0x5cac,0x7532,0x80db,0x9240,0x9598,0x525b,0x5808,
-0x59dc,0x5ca1,0x5d17,0x5eb7,0x5f3a,0x5f4a,0x6177,0x6c5f,
-0x757a,0x7586,0x7ce0,0x7d73,0x7db1,0x7f8c,0x8154,0x8221,
-0x8591,0x8941,0x8b1b,0x92fc,0x964d,0x9c47,0x4ecb,0x4ef7,
-0x500b,0x51f1,0x584f,0x6137,0x613e,0x6168,0x6539,0x69ea,
-0x6f11,0x75a5,0x7686,0x76d6,0x7b87,0x82a5,0x84cb,0xf900,
-0x93a7,0x958b,0x5580,0x5ba2,0x5751,0xf901,0x7cb3,0x7fb9,
-0x91b5,0x5028,0x53bb,0x5c45,0x5de8,0x62d2,0x636e,0x64da,
-0x64e7,0x6e20,0x70ac,0x795b,0x8ddd,0x8e1e,0xf902,0x907d,
-0x9245,0x92f8,0x4e7e,0x4ef6,0x5065,0x5dfe,0x5efa,0x6106,
-0x6957,0x8171,0x8654,0x8e47,0x9375,0x9a2b,0x4e5e,0x5091,
-0x6770,0x6840,0x5109,0x528d,0x5292,0x6aa2,0x77bc,0x9210,
-0x9ed4,0x52ab,0x602f,0x8ff2,0x5048,0x61a9,0x63ed,0x64ca,
-0x683c,0x6a84,0x6fc0,0x8188,0x89a1,0x9694,0x5805,0x727d,
-0x72ac,0x7504,0x7d79,0x7e6d,0x80a9,0x898b,0x8b74,0x9063,
-0x9d51,0x6289,0x6c7a,0x6f54,0x7d50,0x7f3a,0x8a23,0x517c,
-0x614a,0x7b9d,0x8b19,0x9257,0x938c,0x4eac,0x4fd3,0x501e,
-0x50be,0x5106,0x52c1,0x52cd,0x537f,0x5770,0x5883,0x5e9a,
-0x5f91,0x6176,0x61ac,0x64ce,0x656c,0x666f,0x66bb,0x66f4,
-0x6897,0x6d87,0x7085,0x70f1,0x749f,0x74a5,0x74ca,0x75d9,
-0x786c,0x78ec,0x7adf,0x7af6,0x7d45,0x7d93,0x8015,0x803f,
-0x811b,0x8396,0x8b66,0x8f15,0x9015,0x93e1,0x9803,0x9838,
-0x9a5a,0x9be8,0x4fc2,0x5553,0x583a,0x5951,0x5b63,0x5c46,
-0x60b8,0x6212,0x6842,0x68b0,0x68e8,0x6eaa,0x754c,0x7678,
-0x78ce,0x7a3d,0x7cfb,0x7e6b,0x7e7c,0x8a08,0x8aa1,0x8c3f,
-0x968e,0x9dc4,0x53e4,0x53e9,0x544a,0x5471,0x56fa,0x59d1,
-0x5b64,0x5c3b,0x5eab,0x62f7,0x6537,0x6545,0x6572,0x66a0,
-0x67af,0x69c1,0x6cbd,0x75fc,0x7690,0x777e,0x7a3f,0x7f94,
-0x8003,0x80a1,0x818f,0x82e6,0x82fd,0x83f0,0x85c1,0x8831,
-0x88b4,0x8aa5,0xf903,0x8f9c,0x932e,0x96c7,0x9867,0x9ad8,
-0x9f13,0x54ed,0x659b,0x66f2,0x688f,0x7a40,0x8c37,0x9d60,
-0x56f0,0x5764,0x5d11,0x6606,0x68b1,0x68cd,0x6efe,0x7428,
-0x889e,0x9be4,0x6c68,0xf904,0x9aa8,0x4f9b,0x516c,0x5171,
-0x529f,0x5b54,0x5de5,0x6050,0x606d,0x62f1,0x63a7,0x653b,
-0x73d9,0x7a7a,0x86a3,0x8ca2,0x978f,0x4e32,0x5be1,0x6208,
-0x679c,0x74dc,0x79d1,0x83d3,0x8a87,0x8ab2,0x8de8,0x904e,
-0x934b,0x9846,0x5ed3,0x69e8,0x85ff,0x90ed,0xf905,0x51a0,
-0x5b98,0x5bec,0x6163,0x68fa,0x6b3e,0x704c,0x742f,0x74d8,
-0x7ba1,0x7f50,0x83c5,0x89c0,0x8cab,0x95dc,0x9928,0x522e,
-0x605d,0x62ec,0x9002,0x4f8a,0x5149,0x5321,0x58d9,0x5ee3,
-0x66e0,0x6d38,0x709a,0x72c2,0x73d6,0x7b50,0x80f1,0x945b,
-0x5366,0x639b,0x7f6b,0x4e56,0x5080,0x584a,0x58de,0x602a,
-0x6127,0x62d0,0x69d0,0x9b41,0x5b8f,0x7d18,0x80b1,0x8f5f,
-0x4ea4,0x50d1,0x54ac,0x55ac,0x5b0c,0x5da0,0x5de7,0x652a,
-0x654e,0x6821,0x6a4b,0x72e1,0x768e,0x77ef,0x7d5e,0x7ff9,
-0x81a0,0x854e,0x86df,0x8f03,0x8f4e,0x90ca,0x9903,0x9a55,
-0x9bab,0x4e18,0x4e45,0x4e5d,0x4ec7,0x4ff1,0x5177,0x52fe,
-0x5340,0x53e3,0x53e5,0x548e,0x5614,0x5775,0x57a2,0x5bc7,
-0x5d87,0x5ed0,0x61fc,0x62d8,0x6551,0x67b8,0x67e9,0x69cb,
-0x6b50,0x6bc6,0x6bec,0x6c42,0x6e9d,0x7078,0x72d7,0x7396,
-0x7403,0x77bf,0x77e9,0x7a76,0x7d7f,0x8009,0x81fc,0x8205,
-0x820a,0x82df,0x8862,0x8b33,0x8cfc,0x8ec0,0x9011,0x90b1,
-0x9264,0x92b6,0x99d2,0x9a45,0x9ce9,0x9dd7,0x9f9c,0x570b,
-0x5c40,0x83ca,0x97a0,0x97ab,0x9eb4,0x541b,0x7a98,0x7fa4,
-0x88d9,0x8ecd,0x90e1,0x5800,0x5c48,0x6398,0x7a9f,0x5bae,
-0x5f13,0x7a79,0x7aae,0x828e,0x8eac,0x5026,0x5238,0x52f8,
-0x5377,0x5708,0x62f3,0x6372,0x6b0a,0x6dc3,0x7737,0x53a5,
-0x7357,0x8568,0x8e76,0x95d5,0x673a,0x6ac3,0x6f70,0x8a6d,
-0x8ecc,0x994b,0xf906,0x6677,0x6b78,0x8cb4,0x9b3c,0xf907,
-0x53eb,0x572d,0x594e,0x63c6,0x69fb,0x73ea,0x7845,0x7aba,
-0x7ac5,0x7cfe,0x8475,0x898f,0x8d73,0x9035,0x95a8,0x52fb,
-0x5747,0x7547,0x7b60,0x83cc,0x921e,0xf908,0x6a58,0x514b,
-0x524b,0x5287,0x621f,0x68d8,0x6975,0x9699,0x50c5,0x52a4,
-0x52e4,0x61c3,0x65a4,0x6839,0x69ff,0x747e,0x7b4b,0x82b9,
-0x83eb,0x89b2,0x8b39,0x8fd1,0x9949,0xf909,0x4eca,0x5997,
-0x64d2,0x6611,0x6a8e,0x7434,0x7981,0x79bd,0x82a9,0x887e,
-0x887f,0x895f,0xf90a,0x9326,0x4f0b,0x53ca,0x6025,0x6271,
-0x6c72,0x7d1a,0x7d66,0x4e98,0x5162,0x77dc,0x80af,0x4f01,
-0x4f0e,0x5176,0x5180,0x55dc,0x5668,0x573b,0x57fa,0x57fc,
-0x5914,0x5947,0x5993,0x5bc4,0x5c90,0x5d0e,0x5df1,0x5e7e,
-0x5fcc,0x6280,0x65d7,0x65e3,0x671e,0x671f,0x675e,0x68cb,
-0x68c4,0x6a5f,0x6b3a,0x6c23,0x6c7d,0x6c82,0x6dc7,0x7398,
-0x7426,0x742a,0x7482,0x74a3,0x7578,0x757f,0x7881,0x78ef,
-0x7941,0x7947,0x7948,0x797a,0x7b95,0x7d00,0x7dba,0x7f88,
-0x8006,0x802d,0x808c,0x8a18,0x8b4f,0x8c48,0x8d77,0x9321,
-0x9324,0x98e2,0x9951,0x9a0e,0x9a0f,0x9a65,0x9e92,0x7dca,
-0x4f76,0x5409,0x62ee,0x6854,0x91d1,0x55ab,0x513a,0xf90b,
-0xf90c,0x5a1c,0x61e6,0xf90d,0x62cf,0x62ff,0xf90e,0xf90f,
-0xf910,0xf911,0xf912,0xf913,0x90a3,0xf914,0xf915,0xf916,
-0xf917,0xf918,0x8afe,0xf919,0xf91a,0xf91b,0xf91c,0x6696,
-0xf91d,0x7156,0xf91e,0xf91f,0x96e3,0xf920,0x634f,0x637a,
-0x5357,0xf921,0x678f,0x6960,0x6e73,0xf922,0x7537,0xf923,
-0xf924,0xf925,0x7d0d,0xf926,0xf927,0x8872,0x56ca,0x5a18,
-0xf928,0xf929,0xf92a,0xf92b,0xf92c,0x4e43,0xf92d,0x5167,
-0x5948,0x67f0,0x8010,0xf92e,0x5973,0x5e74,0x649a,0x79ca,
-0x5ff5,0x606c,0x62c8,0x637b,0x5be7,0x5bd7,0x52aa,0xf92f,
-0x5974,0x5f29,0x6012,0xf930,0xf931,0xf932,0x7459,0xf933,
-0xf934,0xf935,0xf936,0xf937,0xf938,0x99d1,0xf939,0xf93a,
-0xf93b,0xf93c,0xf93d,0xf93e,0xf93f,0xf940,0xf941,0xf942,
-0xf943,0x6fc3,0xf944,0xf945,0x81bf,0x8fb2,0x60f1,0xf946,
-0xf947,0x8166,0xf948,0xf949,0x5c3f,0xf94a,0xf94b,0xf94c,
-0xf94d,0xf94e,0xf94f,0xf950,0xf951,0x5ae9,0x8a25,0x677b,
-0x7d10,0xf952,0xf953,0xf954,0xf955,0xf956,0xf957,0x80fd,
-0xf958,0xf959,0x5c3c,0x6ce5,0x533f,0x6eba,0x591a,0x8336,
-0x4e39,0x4eb6,0x4f46,0x55ae,0x5718,0x58c7,0x5f56,0x65b7,
-0x65e6,0x6a80,0x6bb5,0x6e4d,0x77ed,0x7aef,0x7c1e,0x7dde,
-0x86cb,0x8892,0x9132,0x935b,0x64bb,0x6fbe,0x737a,0x75b8,
-0x9054,0x5556,0x574d,0x61ba,0x64d4,0x66c7,0x6de1,0x6e5b,
-0x6f6d,0x6fb9,0x75f0,0x8043,0x81bd,0x8541,0x8983,0x8ac7,
-0x8b5a,0x931f,0x6c93,0x7553,0x7b54,0x8e0f,0x905d,0x5510,
-0x5802,0x5858,0x5e62,0x6207,0x649e,0x68e0,0x7576,0x7cd6,
-0x87b3,0x9ee8,0x4ee3,0x5788,0x576e,0x5927,0x5c0d,0x5cb1,
-0x5e36,0x5f85,0x6234,0x64e1,0x73b3,0x81fa,0x888b,0x8cb8,
-0x968a,0x9edb,0x5b85,0x5fb7,0x60b3,0x5012,0x5200,0x5230,
-0x5716,0x5835,0x5857,0x5c0e,0x5c60,0x5cf6,0x5d8b,0x5ea6,
-0x5f92,0x60bc,0x6311,0x6389,0x6417,0x6843,0x68f9,0x6ac2,
-0x6dd8,0x6e21,0x6ed4,0x6fe4,0x71fe,0x76dc,0x7779,0x79b1,
-0x7a3b,0x8404,0x89a9,0x8ced,0x8df3,0x8e48,0x9003,0x9014,
-0x9053,0x90fd,0x934d,0x9676,0x97dc,0x6bd2,0x7006,0x7258,
-0x72a2,0x7368,0x7763,0x79bf,0x7be4,0x7e9b,0x8b80,0x58a9,
-0x60c7,0x6566,0x65fd,0x66be,0x6c8c,0x711e,0x71c9,0x8c5a,
-0x9813,0x4e6d,0x7a81,0x4edd,0x51ac,0x51cd,0x52d5,0x540c,
-0x61a7,0x6771,0x6850,0x68df,0x6d1e,0x6f7c,0x75bc,0x77b3,
-0x7ae5,0x80f4,0x8463,0x9285,0x515c,0x6597,0x675c,0x6793,
-0x75d8,0x7ac7,0x8373,0xf95a,0x8c46,0x9017,0x982d,0x5c6f,
-0x81c0,0x829a,0x9041,0x906f,0x920d,0x5f97,0x5d9d,0x6a59,
-0x71c8,0x767b,0x7b49,0x85e4,0x8b04,0x9127,0x9a30,0x5587,
-0x61f6,0xf95b,0x7669,0x7f85,0x863f,0x87ba,0x88f8,0x908f,
-0xf95c,0x6d1b,0x70d9,0x73de,0x7d61,0x843d,0xf95d,0x916a,
-0x99f1,0xf95e,0x4e82,0x5375,0x6b04,0x6b12,0x703e,0x721b,
-0x862d,0x9e1e,0x524c,0x8fa3,0x5d50,0x64e5,0x652c,0x6b16,
-0x6feb,0x7c43,0x7e9c,0x85cd,0x8964,0x89bd,0x62c9,0x81d8,
-0x881f,0x5eca,0x6717,0x6d6a,0x72fc,0x7405,0x746f,0x8782,
-0x90de,0x4f86,0x5d0d,0x5fa0,0x840a,0x51b7,0x63a0,0x7565,
-0x4eae,0x5006,0x5169,0x51c9,0x6881,0x6a11,0x7cae,0x7cb1,
-0x7ce7,0x826f,0x8ad2,0x8f1b,0x91cf,0x4fb6,0x5137,0x52f5,
-0x5442,0x5eec,0x616e,0x623e,0x65c5,0x6ada,0x6ffe,0x792a,
-0x85dc,0x8823,0x95ad,0x9a62,0x9a6a,0x9e97,0x9ece,0x529b,
-0x66c6,0x6b77,0x701d,0x792b,0x8f62,0x9742,0x6190,0x6200,
-0x6523,0x6f23,0x7149,0x7489,0x7df4,0x806f,0x84ee,0x8f26,
-0x9023,0x934a,0x51bd,0x5217,0x52a3,0x6d0c,0x70c8,0x88c2,
-0x5ec9,0x6582,0x6bae,0x6fc2,0x7c3e,0x7375,0x4ee4,0x4f36,
-0x56f9,0xf95f,0x5cba,0x5dba,0x601c,0x73b2,0x7b2d,0x7f9a,
-0x7fce,0x8046,0x901e,0x9234,0x96f6,0x9748,0x9818,0x9f61,
-0x4f8b,0x6fa7,0x79ae,0x91b4,0x96b7,0x52de,0xf960,0x6488,
-0x64c4,0x6ad3,0x6f5e,0x7018,0x7210,0x76e7,0x8001,0x8606,
-0x865c,0x8def,0x8f05,0x9732,0x9b6f,0x9dfa,0x9e75,0x788c,
-0x797f,0x7da0,0x83c9,0x9304,0x9e7f,0x9e93,0x8ad6,0x58df,
-0x5f04,0x6727,0x7027,0x74cf,0x7c60,0x807e,0x5121,0x7028,
-0x7262,0x78ca,0x8cc2,0x8cda,0x8cf4,0x96f7,0x4e86,0x50da,
-0x5bee,0x5ed6,0x6599,0x71ce,0x7642,0x77ad,0x804a,0x84fc,
-0x907c,0x9b27,0x9f8d,0x58d8,0x5a41,0x5c62,0x6a13,0x6dda,
-0x6f0f,0x763b,0x7d2f,0x7e37,0x851e,0x8938,0x93e4,0x964b,
-0x5289,0x65d2,0x67f3,0x69b4,0x6d41,0x6e9c,0x700f,0x7409,
-0x7460,0x7559,0x7624,0x786b,0x8b2c,0x985e,0x516d,0x622e,
-0x9678,0x4f96,0x502b,0x5d19,0x6dea,0x7db8,0x8f2a,0x5f8b,
-0x6144,0x6817,0xf961,0x9686,0x52d2,0x808b,0x51dc,0x51cc,
-0x695e,0x7a1c,0x7dbe,0x83f1,0x9675,0x4fda,0x5229,0x5398,
-0x540f,0x550e,0x5c65,0x60a7,0x674e,0x68a8,0x6d6c,0x7281,
-0x72f8,0x7406,0x7483,0xf962,0x75e2,0x7c6c,0x7f79,0x7fb8,
-0x8389,0x88cf,0x88e1,0x91cc,0x91d0,0x96e2,0x9bc9,0x541d,
-0x6f7e,0x71d0,0x7498,0x85fa,0x8eaa,0x96a3,0x9c57,0x9e9f,
-0x6797,0x6dcb,0x7433,0x81e8,0x9716,0x782c,0x7acb,0x7b20,
-0x7c92,0x6469,0x746a,0x75f2,0x78bc,0x78e8,0x99ac,0x9b54,
-0x9ebb,0x5bde,0x5e55,0x6f20,0x819c,0x83ab,0x9088,0x4e07,
-0x534d,0x5a29,0x5dd2,0x5f4e,0x6162,0x633d,0x6669,0x66fc,
-0x6eff,0x6f2b,0x7063,0x779e,0x842c,0x8513,0x883b,0x8f13,
-0x9945,0x9c3b,0x551c,0x62b9,0x672b,0x6cab,0x8309,0x896a,
-0x977a,0x4ea1,0x5984,0x5fd8,0x5fd9,0x671b,0x7db2,0x7f54,
-0x8292,0x832b,0x83bd,0x8f1e,0x9099,0x57cb,0x59b9,0x5a92,
-0x5bd0,0x6627,0x679a,0x6885,0x6bcf,0x7164,0x7f75,0x8cb7,
-0x8ce3,0x9081,0x9b45,0x8108,0x8c8a,0x964c,0x9a40,0x9ea5,
-0x5b5f,0x6c13,0x731b,0x76f2,0x76df,0x840c,0x51aa,0x8993,
-0x514d,0x5195,0x52c9,0x68c9,0x6c94,0x7704,0x7720,0x7dbf,
-0x7dec,0x9762,0x9eb5,0x6ec5,0x8511,0x51a5,0x540d,0x547d,
-0x660e,0x669d,0x6927,0x6e9f,0x76bf,0x7791,0x8317,0x84c2,
-0x879f,0x9169,0x9298,0x9cf4,0x8882,0x4fae,0x5192,0x52df,
-0x59c6,0x5e3d,0x6155,0x6478,0x6479,0x66ae,0x67d0,0x6a21,
-0x6bcd,0x6bdb,0x725f,0x7261,0x7441,0x7738,0x77db,0x8017,
-0x82bc,0x8305,0x8b00,0x8b28,0x8c8c,0x6728,0x6c90,0x7267,
-0x76ee,0x7766,0x7a46,0x9da9,0x6b7f,0x6c92,0x5922,0x6726,
-0x8499,0x536f,0x5893,0x5999,0x5edf,0x63cf,0x6634,0x6773,
-0x6e3a,0x732b,0x7ad7,0x82d7,0x9328,0x52d9,0x5deb,0x61ae,
-0x61cb,0x620a,0x62c7,0x64ab,0x65e0,0x6959,0x6b66,0x6bcb,
-0x7121,0x73f7,0x755d,0x7e46,0x821e,0x8302,0x856a,0x8aa3,
-0x8cbf,0x9727,0x9d61,0x58a8,0x9ed8,0x5011,0x520e,0x543b,
-0x554f,0x6587,0x6c76,0x7d0a,0x7d0b,0x805e,0x868a,0x9580,
-0x96ef,0x52ff,0x6c95,0x7269,0x5473,0x5a9a,0x5c3e,0x5d4b,
-0x5f4c,0x5fae,0x672a,0x68b6,0x6963,0x6e3c,0x6e44,0x7709,
-0x7c73,0x7f8e,0x8587,0x8b0e,0x8ff7,0x9761,0x9ef4,0x5cb7,
-0x60b6,0x610d,0x61ab,0x654f,0x65fb,0x65fc,0x6c11,0x6cef,
-0x739f,0x73c9,0x7de1,0x9594,0x5bc6,0x871c,0x8b10,0x525d,
-0x535a,0x62cd,0x640f,0x64b2,0x6734,0x6a38,0x6cca,0x73c0,
-0x749e,0x7b94,0x7c95,0x7e1b,0x818a,0x8236,0x8584,0x8feb,
-0x96f9,0x99c1,0x4f34,0x534a,0x53cd,0x53db,0x62cc,0x642c,
-0x6500,0x6591,0x69c3,0x6cee,0x6f58,0x73ed,0x7554,0x7622,
-0x76e4,0x76fc,0x78d0,0x78fb,0x792c,0x7d46,0x822c,0x87e0,
-0x8fd4,0x9812,0x98ef,0x52c3,0x62d4,0x64a5,0x6e24,0x6f51,
-0x767c,0x8dcb,0x91b1,0x9262,0x9aee,0x9b43,0x5023,0x508d,
-0x574a,0x59a8,0x5c28,0x5e47,0x5f77,0x623f,0x653e,0x65b9,
-0x65c1,0x6609,0x678b,0x699c,0x6ec2,0x78c5,0x7d21,0x80aa,
-0x8180,0x822b,0x82b3,0x84a1,0x868c,0x8a2a,0x8b17,0x90a6,
-0x9632,0x9f90,0x500d,0x4ff3,0xf963,0x57f9,0x5f98,0x62dc,
-0x6392,0x676f,0x6e43,0x7119,0x76c3,0x80cc,0x80da,0x88f4,
-0x88f5,0x8919,0x8ce0,0x8f29,0x914d,0x966a,0x4f2f,0x4f70,
-0x5e1b,0x67cf,0x6822,0x767d,0x767e,0x9b44,0x5e61,0x6a0a,
-0x7169,0x71d4,0x756a,0xf964,0x7e41,0x8543,0x85e9,0x98dc,
-0x4f10,0x7b4f,0x7f70,0x95a5,0x51e1,0x5e06,0x68b5,0x6c3e,
-0x6c4e,0x6cdb,0x72af,0x7bc4,0x8303,0x6cd5,0x743a,0x50fb,
-0x5288,0x58c1,0x64d8,0x6a97,0x74a7,0x7656,0x78a7,0x8617,
-0x95e2,0x9739,0xf965,0x535e,0x5f01,0x8b8a,0x8fa8,0x8faf,
-0x908a,0x5225,0x77a5,0x9c49,0x9f08,0x4e19,0x5002,0x5175,
-0x5c5b,0x5e77,0x661e,0x663a,0x67c4,0x68c5,0x70b3,0x7501,
-0x75c5,0x79c9,0x7add,0x8f27,0x9920,0x9a08,0x4fdd,0x5821,
-0x5831,0x5bf6,0x666e,0x6b65,0x6d11,0x6e7a,0x6f7d,0x73e4,
-0x752b,0x83e9,0x88dc,0x8913,0x8b5c,0x8f14,0x4f0f,0x50d5,
-0x5310,0x535c,0x5b93,0x5fa9,0x670d,0x798f,0x8179,0x832f,
-0x8514,0x8907,0x8986,0x8f39,0x8f3b,0x99a5,0x9c12,0x672c,
-0x4e76,0x4ff8,0x5949,0x5c01,0x5cef,0x5cf0,0x6367,0x68d2,
-0x70fd,0x71a2,0x742b,0x7e2b,0x84ec,0x8702,0x9022,0x92d2,
-0x9cf3,0x4e0d,0x4ed8,0x4fef,0x5085,0x5256,0x526f,0x5426,
-0x5490,0x57e0,0x592b,0x5a66,0x5b5a,0x5b75,0x5bcc,0x5e9c,
-0xf966,0x6276,0x6577,0x65a7,0x6d6e,0x6ea5,0x7236,0x7b26,
-0x7c3f,0x7f36,0x8150,0x8151,0x819a,0x8240,0x8299,0x83a9,
-0x8a03,0x8ca0,0x8ce6,0x8cfb,0x8d74,0x8dba,0x90e8,0x91dc,
-0x961c,0x9644,0x99d9,0x9ce7,0x5317,0x5206,0x5429,0x5674,
-0x58b3,0x5954,0x596e,0x5fff,0x61a4,0x626e,0x6610,0x6c7e,
-0x711a,0x76c6,0x7c89,0x7cde,0x7d1b,0x82ac,0x8cc1,0x96f0,
-0xf967,0x4f5b,0x5f17,0x5f7f,0x62c2,0x5d29,0x670b,0x68da,
-0x787c,0x7e43,0x9d6c,0x4e15,0x5099,0x5315,0x532a,0x5351,
-0x5983,0x5a62,0x5e87,0x60b2,0x618a,0x6249,0x6279,0x6590,
-0x6787,0x69a7,0x6bd4,0x6bd6,0x6bd7,0x6bd8,0x6cb8,0xf968,
-0x7435,0x75fa,0x7812,0x7891,0x79d5,0x79d8,0x7c83,0x7dcb,
-0x7fe1,0x80a5,0x813e,0x81c2,0x83f2,0x871a,0x88e8,0x8ab9,
-0x8b6c,0x8cbb,0x9119,0x975e,0x98db,0x9f3b,0x56ac,0x5b2a,
-0x5f6c,0x658c,0x6ab3,0x6baf,0x6d5c,0x6ff1,0x7015,0x725d,
-0x73ad,0x8ca7,0x8cd3,0x983b,0x6191,0x6c37,0x8058,0x9a01,
-0x4e4d,0x4e8b,0x4e9b,0x4ed5,0x4f3a,0x4f3c,0x4f7f,0x4fdf,
-0x50ff,0x53f2,0x53f8,0x5506,0x55e3,0x56db,0x58eb,0x5962,
-0x5a11,0x5beb,0x5bfa,0x5c04,0x5df3,0x5e2b,0x5f99,0x601d,
-0x6368,0x659c,0x65af,0x67f6,0x67fb,0x68ad,0x6b7b,0x6c99,
-0x6cd7,0x6e23,0x7009,0x7345,0x7802,0x793e,0x7940,0x7960,
-0x79c1,0x7be9,0x7d17,0x7d72,0x8086,0x820d,0x838e,0x84d1,
-0x86c7,0x88df,0x8a50,0x8a5e,0x8b1d,0x8cdc,0x8d66,0x8fad,
-0x90aa,0x98fc,0x99df,0x9e9d,0x524a,0xf969,0x6714,0xf96a,
-0x5098,0x522a,0x5c71,0x6563,0x6c55,0x73ca,0x7523,0x759d,
-0x7b97,0x849c,0x9178,0x9730,0x4e77,0x6492,0x6bba,0x715e,
-0x85a9,0x4e09,0xf96b,0x6749,0x68ee,0x6e17,0x829f,0x8518,
-0x886b,0x63f7,0x6f81,0x9212,0x98af,0x4e0a,0x50b7,0x50cf,
-0x511f,0x5546,0x55aa,0x5617,0x5b40,0x5c19,0x5ce0,0x5e38,
-0x5e8a,0x5ea0,0x5ec2,0x60f3,0x6851,0x6a61,0x6e58,0x723d,
-0x7240,0x72c0,0x76f8,0x7965,0x7bb1,0x7fd4,0x88f3,0x89f4,
-0x8a73,0x8c61,0x8cde,0x971c,0x585e,0x74bd,0x8cfd,0x55c7,
-0xf96c,0x7a61,0x7d22,0x8272,0x7272,0x751f,0x7525,0xf96d,
-0x7b19,0x5885,0x58fb,0x5dbc,0x5e8f,0x5eb6,0x5f90,0x6055,
-0x6292,0x637f,0x654d,0x6691,0x66d9,0x66f8,0x6816,0x68f2,
-0x7280,0x745e,0x7b6e,0x7d6e,0x7dd6,0x7f72,0x80e5,0x8212,
-0x85af,0x897f,0x8a93,0x901d,0x92e4,0x9ecd,0x9f20,0x5915,
-0x596d,0x5e2d,0x60dc,0x6614,0x6673,0x6790,0x6c50,0x6dc5,
-0x6f5f,0x77f3,0x78a9,0x84c6,0x91cb,0x932b,0x4ed9,0x50ca,
-0x5148,0x5584,0x5b0b,0x5ba3,0x6247,0x657e,0x65cb,0x6e32,
-0x717d,0x7401,0x7444,0x7487,0x74bf,0x766c,0x79aa,0x7dda,
-0x7e55,0x7fa8,0x817a,0x81b3,0x8239,0x861a,0x87ec,0x8a75,
-0x8de3,0x9078,0x9291,0x9425,0x994d,0x9bae,0x5368,0x5c51,
-0x6954,0x6cc4,0x6d29,0x6e2b,0x820c,0x859b,0x893b,0x8a2d,
-0x8aaa,0x96ea,0x9f67,0x5261,0x66b9,0x6bb2,0x7e96,0x87fe,
-0x8d0d,0x9583,0x965d,0x651d,0x6d89,0x71ee,0xf96e,0x57ce,
-0x59d3,0x5bac,0x6027,0x60fa,0x6210,0x661f,0x665f,0x7329,
-0x73f9,0x76db,0x7701,0x7b6c,0x8056,0x8072,0x8165,0x8aa0,
-0x9192,0x4e16,0x52e2,0x6b72,0x6d17,0x7a05,0x7b39,0x7d30,
-0xf96f,0x8cb0,0x53ec,0x562f,0x5851,0x5bb5,0x5c0f,0x5c11,
-0x5de2,0x6240,0x6383,0x6414,0x662d,0x68b3,0x6cbc,0x6d88,
-0x6eaf,0x701f,0x70a4,0x71d2,0x7526,0x758f,0x758e,0x7619,
-0x7b11,0x7be0,0x7c2b,0x7d20,0x7d39,0x852c,0x856d,0x8607,
-0x8a34,0x900d,0x9061,0x90b5,0x92b7,0x97f6,0x9a37,0x4fd7,
-0x5c6c,0x675f,0x6d91,0x7c9f,0x7e8c,0x8b16,0x8d16,0x901f,
-0x5b6b,0x5dfd,0x640d,0x84c0,0x905c,0x98e1,0x7387,0x5b8b,
-0x609a,0x677e,0x6dde,0x8a1f,0x8aa6,0x9001,0x980c,0x5237,
-0xf970,0x7051,0x788e,0x9396,0x8870,0x91d7,0x4fee,0x53d7,
-0x55fd,0x56da,0x5782,0x58fd,0x5ac2,0x5b88,0x5cab,0x5cc0,
-0x5e25,0x6101,0x620d,0x624b,0x6388,0x641c,0x6536,0x6578,
-0x6a39,0x6b8a,0x6c34,0x6d19,0x6f31,0x71e7,0x72e9,0x7378,
-0x7407,0x74b2,0x7626,0x7761,0x79c0,0x7a57,0x7aea,0x7cb9,
-0x7d8f,0x7dac,0x7e61,0x7f9e,0x8129,0x8331,0x8490,0x84da,
-0x85ea,0x8896,0x8ab0,0x8b90,0x8f38,0x9042,0x9083,0x916c,
-0x9296,0x92b9,0x968b,0x96a7,0x96a8,0x96d6,0x9700,0x9808,
-0x9996,0x9ad3,0x9b1a,0x53d4,0x587e,0x5919,0x5b70,0x5bbf,
-0x6dd1,0x6f5a,0x719f,0x7421,0x74b9,0x8085,0x83fd,0x5de1,
-0x5f87,0x5faa,0x6042,0x65ec,0x6812,0x696f,0x6a53,0x6b89,
-0x6d35,0x6df3,0x73e3,0x76fe,0x77ac,0x7b4d,0x7d14,0x8123,
-0x821c,0x8340,0x84f4,0x8563,0x8a62,0x8ac4,0x9187,0x931e,
-0x9806,0x99b4,0x620c,0x8853,0x8ff0,0x9265,0x5d07,0x5d27,
-0x5d69,0x745f,0x819d,0x8768,0x6fd5,0x62fe,0x7fd2,0x8936,
-0x8972,0x4e1e,0x4e58,0x50e7,0x52dd,0x5347,0x627f,0x6607,
-0x7e69,0x8805,0x965e,0x4f8d,0x5319,0x5636,0x59cb,0x5aa4,
-0x5c38,0x5c4e,0x5c4d,0x5e02,0x5f11,0x6043,0x65bd,0x662f,
-0x6642,0x67be,0x67f4,0x731c,0x77e2,0x793a,0x7fc5,0x8494,
-0x84cd,0x8996,0x8a66,0x8a69,0x8ae1,0x8c55,0x8c7a,0x57f4,
-0x5bd4,0x5f0f,0x606f,0x62ed,0x690d,0x6b96,0x6e5c,0x7184,
-0x7bd2,0x8755,0x8b58,0x8efe,0x98df,0x98fe,0x4f38,0x4f81,
-0x4fe1,0x547b,0x5a20,0x5bb8,0x613c,0x65b0,0x6668,0x71fc,
-0x7533,0x795e,0x7d33,0x814e,0x81e3,0x8398,0x85aa,0x85ce,
-0x8703,0x8a0a,0x8eab,0x8f9b,0xf971,0x8fc5,0x5931,0x5ba4,
-0x5be6,0x6089,0x5be9,0x5c0b,0x5fc3,0x6c81,0xf972,0x6df1,
-0x700b,0x751a,0x82af,0x8af6,0x4ec0,0x5341,0xf973,0x96d9,
-0x6c0f,0x4e9e,0x4fc4,0x5152,0x555e,0x5a25,0x5ce8,0x6211,
-0x7259,0x82bd,0x83aa,0x86fe,0x8859,0x8a1d,0x963f,0x96c5,
-0x9913,0x9d09,0x9d5d,0x580a,0x5cb3,0x5dbd,0x5e44,0x60e1,
-0x6115,0x63e1,0x6a02,0x6e25,0x9102,0x9354,0x984e,0x9c10,
-0x9f77,0x5b89,0x5cb8,0x6309,0x664f,0x6848,0x773c,0x96c1,
-0x978d,0x9854,0x9b9f,0x65a1,0x8b01,0x8ecb,0x95bc,0x5535,
-0x5ca9,0x5dd6,0x5eb5,0x6697,0x764c,0x83f4,0x95c7,0x58d3,
-0x62bc,0x72ce,0x9d28,0x4ef0,0x592e,0x600f,0x663b,0x6b83,
-0x79e7,0x9d26,0x5393,0x54c0,0x57c3,0x5d16,0x611b,0x66d6,
-0x6daf,0x788d,0x827e,0x9698,0x9744,0x5384,0x627c,0x6396,
-0x6db2,0x7e0a,0x814b,0x984d,0x6afb,0x7f4c,0x9daf,0x9e1a,
-0x4e5f,0x503b,0x51b6,0x591c,0x60f9,0x63f6,0x6930,0x723a,
-0x8036,0xf974,0x91ce,0x5f31,0xf975,0xf976,0x7d04,0x82e5,
-0x846f,0x84bb,0x85e5,0x8e8d,0xf977,0x4f6f,0xf978,0xf979,
-0x58e4,0x5b43,0x6059,0x63da,0x6518,0x656d,0x6698,0xf97a,
-0x694a,0x6a23,0x6d0b,0x7001,0x716c,0x75d2,0x760d,0x79b3,
-0x7a70,0xf97b,0x7f8a,0xf97c,0x8944,0xf97d,0x8b93,0x91c0,
-0x967d,0xf97e,0x990a,0x5704,0x5fa1,0x65bc,0x6f01,0x7600,
-0x79a6,0x8a9e,0x99ad,0x9b5a,0x9f6c,0x5104,0x61b6,0x6291,
-0x6a8d,0x81c6,0x5043,0x5830,0x5f66,0x7109,0x8a00,0x8afa,
-0x5b7c,0x8616,0x4ffa,0x513c,0x56b4,0x5944,0x63a9,0x6df9,
-0x5daa,0x696d,0x5186,0x4e88,0x4f59,0xf97f,0xf980,0xf981,
-0x5982,0xf982,0xf983,0x6b5f,0x6c5d,0xf984,0x74b5,0x7916,
-0xf985,0x8207,0x8245,0x8339,0x8f3f,0x8f5d,0xf986,0x9918,
-0xf987,0xf988,0xf989,0x4ea6,0xf98a,0x57df,0x5f79,0x6613,
-0xf98b,0xf98c,0x75ab,0x7e79,0x8b6f,0xf98d,0x9006,0x9a5b,
-0x56a5,0x5827,0x59f8,0x5a1f,0x5bb4,0xf98e,0x5ef6,0xf98f,
-0xf990,0x6350,0x633b,0xf991,0x693d,0x6c87,0x6cbf,0x6d8e,
-0x6d93,0x6df5,0x6f14,0xf992,0x70df,0x7136,0x7159,0xf993,
-0x71c3,0x71d5,0xf994,0x784f,0x786f,0xf995,0x7b75,0x7de3,
-0xf996,0x7e2f,0xf997,0x884d,0x8edf,0xf998,0xf999,0xf99a,
-0x925b,0xf99b,0x9cf6,0xf99c,0xf99d,0xf99e,0x6085,0x6d85,
-0xf99f,0x71b1,0xf9a0,0xf9a1,0x95b1,0x53ad,0xf9a2,0xf9a3,
-0xf9a4,0x67d3,0xf9a5,0x708e,0x7130,0x7430,0x8276,0x82d2,
-0xf9a6,0x95bb,0x9ae5,0x9e7d,0x66c4,0xf9a7,0x71c1,0x8449,
-0xf9a8,0xf9a9,0x584b,0xf9aa,0xf9ab,0x5db8,0x5f71,0xf9ac,
-0x6620,0x668e,0x6979,0x69ae,0x6c38,0x6cf3,0x6e36,0x6f41,
-0x6fda,0x701b,0x702f,0x7150,0x71df,0x7370,0xf9ad,0x745b,
-0xf9ae,0x74d4,0x76c8,0x7a4e,0x7e93,0xf9af,0xf9b0,0x82f1,
-0x8a60,0x8fce,0xf9b1,0x9348,0xf9b2,0x9719,0xf9b3,0xf9b4,
-0x4e42,0x502a,0xf9b5,0x5208,0x53e1,0x66f3,0x6c6d,0x6fca,
-0x730a,0x777f,0x7a62,0x82ae,0x85dd,0x8602,0xf9b6,0x88d4,
-0x8a63,0x8b7d,0x8c6b,0xf9b7,0x92b3,0xf9b8,0x9713,0x9810,
-0x4e94,0x4f0d,0x4fc9,0x50b2,0x5348,0x543e,0x5433,0x55da,
-0x5862,0x58ba,0x5967,0x5a1b,0x5be4,0x609f,0xf9b9,0x61ca,
-0x6556,0x65ff,0x6664,0x68a7,0x6c5a,0x6fb3,0x70cf,0x71ac,
-0x7352,0x7b7d,0x8708,0x8aa4,0x9c32,0x9f07,0x5c4b,0x6c83,
-0x7344,0x7389,0x923a,0x6eab,0x7465,0x761f,0x7a69,0x7e15,
-0x860a,0x5140,0x58c5,0x64c1,0x74ee,0x7515,0x7670,0x7fc1,
-0x9095,0x96cd,0x9954,0x6e26,0x74e6,0x7aa9,0x7aaa,0x81e5,
-0x86d9,0x8778,0x8a1b,0x5a49,0x5b8c,0x5b9b,0x68a1,0x6900,
-0x6d63,0x73a9,0x7413,0x742c,0x7897,0x7de9,0x7feb,0x8118,
-0x8155,0x839e,0x8c4c,0x962e,0x9811,0x66f0,0x5f80,0x65fa,
-0x6789,0x6c6a,0x738b,0x502d,0x5a03,0x6b6a,0x77ee,0x5916,
-0x5d6c,0x5dcd,0x7325,0x754f,0xf9ba,0xf9bb,0x50e5,0x51f9,
-0x582f,0x592d,0x5996,0x59da,0x5be5,0xf9bc,0xf9bd,0x5da2,
-0x62d7,0x6416,0x6493,0x64fe,0xf9be,0x66dc,0xf9bf,0x6a48,
-0xf9c0,0x71ff,0x7464,0xf9c1,0x7a88,0x7aaf,0x7e47,0x7e5e,
-0x8000,0x8170,0xf9c2,0x87ef,0x8981,0x8b20,0x9059,0xf9c3,
-0x9080,0x9952,0x617e,0x6b32,0x6d74,0x7e1f,0x8925,0x8fb1,
-0x4fd1,0x50ad,0x5197,0x52c7,0x57c7,0x5889,0x5bb9,0x5eb8,
-0x6142,0x6995,0x6d8c,0x6e67,0x6eb6,0x7194,0x7462,0x7528,
-0x752c,0x8073,0x8338,0x84c9,0x8e0a,0x9394,0x93de,0xf9c4,
-0x4e8e,0x4f51,0x5076,0x512a,0x53c8,0x53cb,0x53f3,0x5b87,
-0x5bd3,0x5c24,0x611a,0x6182,0x65f4,0x725b,0x7397,0x7440,
-0x76c2,0x7950,0x7991,0x79b9,0x7d06,0x7fbd,0x828b,0x85d5,
-0x865e,0x8fc2,0x9047,0x90f5,0x91ea,0x9685,0x96e8,0x96e9,
-0x52d6,0x5f67,0x65ed,0x6631,0x682f,0x715c,0x7a36,0x90c1,
-0x980a,0x4e91,0xf9c5,0x6a52,0x6b9e,0x6f90,0x7189,0x8018,
-0x82b8,0x8553,0x904b,0x9695,0x96f2,0x97fb,0x851a,0x9b31,
-0x4e90,0x718a,0x96c4,0x5143,0x539f,0x54e1,0x5713,0x5712,
-0x57a3,0x5a9b,0x5ac4,0x5bc3,0x6028,0x613f,0x63f4,0x6c85,
-0x6d39,0x6e72,0x6e90,0x7230,0x733f,0x7457,0x82d1,0x8881,
-0x8f45,0x9060,0xf9c6,0x9662,0x9858,0x9d1b,0x6708,0x8d8a,
-0x925e,0x4f4d,0x5049,0x50de,0x5371,0x570d,0x59d4,0x5a01,
-0x5c09,0x6170,0x6690,0x6e2d,0x7232,0x744b,0x7def,0x80c3,
-0x840e,0x8466,0x853f,0x875f,0x885b,0x8918,0x8b02,0x9055,
-0x97cb,0x9b4f,0x4e73,0x4f91,0x5112,0x516a,0xf9c7,0x552f,
-0x55a9,0x5b7a,0x5ba5,0x5e7c,0x5e7d,0x5ebe,0x60a0,0x60df,
-0x6108,0x6109,0x63c4,0x6538,0x6709,0xf9c8,0x67d4,0x67da,
-0xf9c9,0x6961,0x6962,0x6cb9,0x6d27,0xf9ca,0x6e38,0xf9cb,
-0x6fe1,0x7336,0x7337,0xf9cc,0x745c,0x7531,0xf9cd,0x7652,
-0xf9ce,0xf9cf,0x7dad,0x81fe,0x8438,0x88d5,0x8a98,0x8adb,
-0x8aed,0x8e30,0x8e42,0x904a,0x903e,0x907a,0x9149,0x91c9,
-0x936e,0xf9d0,0xf9d1,0x5809,0xf9d2,0x6bd3,0x8089,0x80b2,
-0xf9d3,0xf9d4,0x5141,0x596b,0x5c39,0xf9d5,0xf9d6,0x6f64,
-0x73a7,0x80e4,0x8d07,0xf9d7,0x9217,0x958f,0xf9d8,0xf9d9,
-0xf9da,0xf9db,0x807f,0x620e,0x701c,0x7d68,0x878d,0xf9dc,
-0x57a0,0x6069,0x6147,0x6bb7,0x8abe,0x9280,0x96b1,0x4e59,
-0x541f,0x6deb,0x852d,0x9670,0x97f3,0x98ee,0x63d6,0x6ce3,
-0x9091,0x51dd,0x61c9,0x81ba,0x9df9,0x4f9d,0x501a,0x5100,
-0x5b9c,0x610f,0x61ff,0x64ec,0x6905,0x6bc5,0x7591,0x77e3,
-0x7fa9,0x8264,0x858f,0x87fb,0x8863,0x8abc,0x8b70,0x91ab,
-0x4e8c,0x4ee5,0x4f0a,0xf9dd,0xf9de,0x5937,0x59e8,0xf9df,
-0x5df2,0x5f1b,0x5f5b,0x6021,0xf9e0,0xf9e1,0xf9e2,0xf9e3,
-0x723e,0x73e5,0xf9e4,0x7570,0x75cd,0xf9e5,0x79fb,0xf9e6,
-0x800c,0x8033,0x8084,0x82e1,0x8351,0xf9e7,0xf9e8,0x8cbd,
-0x8cb3,0x9087,0xf9e9,0xf9ea,0x98f4,0x990c,0xf9eb,0xf9ec,
-0x7037,0x76ca,0x7fca,0x7fcc,0x7ffc,0x8b1a,0x4eba,0x4ec1,
-0x5203,0x5370,0xf9ed,0x54bd,0x56e0,0x59fb,0x5bc5,0x5f15,
-0x5fcd,0x6e6e,0xf9ee,0xf9ef,0x7d6a,0x8335,0xf9f0,0x8693,
-0x8a8d,0xf9f1,0x976d,0x9777,0xf9f2,0xf9f3,0x4e00,0x4f5a,
-0x4f7e,0x58f9,0x65e5,0x6ea2,0x9038,0x93b0,0x99b9,0x4efb,
-0x58ec,0x598a,0x59d9,0x6041,0xf9f4,0xf9f5,0x7a14,0xf9f6,
-0x834f,0x8cc3,0x5165,0x5344,0xf9f7,0xf9f8,0xf9f9,0x4ecd,
-0x5269,0x5b55,0x82bf,0x4ed4,0x523a,0x54a8,0x59c9,0x59ff,
-0x5b50,0x5b57,0x5b5c,0x6063,0x6148,0x6ecb,0x7099,0x716e,
-0x7386,0x74f7,0x75b5,0x78c1,0x7d2b,0x8005,0x81ea,0x8328,
-0x8517,0x85c9,0x8aee,0x8cc7,0x96cc,0x4f5c,0x52fa,0x56bc,
-0x65ab,0x6628,0x707c,0x70b8,0x7235,0x7dbd,0x828d,0x914c,
-0x96c0,0x9d72,0x5b71,0x68e7,0x6b98,0x6f7a,0x76de,0x5c91,
-0x66ab,0x6f5b,0x7bb4,0x7c2a,0x8836,0x96dc,0x4e08,0x4ed7,
-0x5320,0x5834,0x58bb,0x58ef,0x596c,0x5c07,0x5e33,0x5e84,
-0x5f35,0x638c,0x66b2,0x6756,0x6a1f,0x6aa3,0x6b0c,0x6f3f,
-0x7246,0xf9fa,0x7350,0x748b,0x7ae0,0x7ca7,0x8178,0x81df,
-0x81e7,0x838a,0x846c,0x8523,0x8594,0x85cf,0x88dd,0x8d13,
-0x91ac,0x9577,0x969c,0x518d,0x54c9,0x5728,0x5bb0,0x624d,
-0x6750,0x683d,0x6893,0x6e3d,0x6ed3,0x707d,0x7e21,0x88c1,
-0x8ca1,0x8f09,0x9f4b,0x9f4e,0x722d,0x7b8f,0x8acd,0x931a,
-0x4f47,0x4f4e,0x5132,0x5480,0x59d0,0x5e95,0x62b5,0x6775,
-0x696e,0x6a17,0x6cae,0x6e1a,0x72d9,0x732a,0x75bd,0x7bb8,
-0x7d35,0x82e7,0x83f9,0x8457,0x85f7,0x8a5b,0x8caf,0x8e87,
-0x9019,0x90b8,0x96ce,0x9f5f,0x52e3,0x540a,0x5ae1,0x5bc2,
-0x6458,0x6575,0x6ef4,0x72c4,0xf9fb,0x7684,0x7a4d,0x7b1b,
-0x7c4d,0x7e3e,0x7fdf,0x837b,0x8b2b,0x8cca,0x8d64,0x8de1,
-0x8e5f,0x8fea,0x8ff9,0x9069,0x93d1,0x4f43,0x4f7a,0x50b3,
-0x5168,0x5178,0x524d,0x526a,0x5861,0x587c,0x5960,0x5c08,
-0x5c55,0x5edb,0x609b,0x6230,0x6813,0x6bbf,0x6c08,0x6fb1,
-0x714e,0x7420,0x7530,0x7538,0x7551,0x7672,0x7b4c,0x7b8b,
-0x7bad,0x7bc6,0x7e8f,0x8a6e,0x8f3e,0x8f49,0x923f,0x9293,
-0x9322,0x942b,0x96fb,0x985a,0x986b,0x991e,0x5207,0x622a,
-0x6298,0x6d59,0x7664,0x7aca,0x7bc0,0x7d76,0x5360,0x5cbe,
-0x5e97,0x6f38,0x70b9,0x7c98,0x9711,0x9b8e,0x9ede,0x63a5,
-0x647a,0x8776,0x4e01,0x4e95,0x4ead,0x505c,0x5075,0x5448,
-0x59c3,0x5b9a,0x5e40,0x5ead,0x5ef7,0x5f81,0x60c5,0x633a,
-0x653f,0x6574,0x65cc,0x6676,0x6678,0x67fe,0x6968,0x6a89,
-0x6b63,0x6c40,0x6dc0,0x6de8,0x6e1f,0x6e5e,0x701e,0x70a1,
-0x738e,0x73fd,0x753a,0x775b,0x7887,0x798e,0x7a0b,0x7a7d,
-0x7cbe,0x7d8e,0x8247,0x8a02,0x8aea,0x8c9e,0x912d,0x914a,
-0x91d8,0x9266,0x92cc,0x9320,0x9706,0x9756,0x975c,0x9802,
-0x9f0e,0x5236,0x5291,0x557c,0x5824,0x5e1d,0x5f1f,0x608c,
-0x63d0,0x68af,0x6fdf,0x796d,0x7b2c,0x81cd,0x85ba,0x88fd,
-0x8af8,0x8e44,0x918d,0x9664,0x969b,0x973d,0x984c,0x9f4a,
-0x4fce,0x5146,0x51cb,0x52a9,0x5632,0x5f14,0x5f6b,0x63aa,
-0x64cd,0x65e9,0x6641,0x66fa,0x66f9,0x671d,0x689d,0x68d7,
-0x69fd,0x6f15,0x6f6e,0x7167,0x71e5,0x722a,0x74aa,0x773a,
-0x7956,0x795a,0x79df,0x7a20,0x7a95,0x7c97,0x7cdf,0x7d44,
-0x7e70,0x8087,0x85fb,0x86a4,0x8a54,0x8abf,0x8d99,0x8e81,
-0x9020,0x906d,0x91e3,0x963b,0x96d5,0x9ce5,0x65cf,0x7c07,
-0x8db3,0x93c3,0x5b58,0x5c0a,0x5352,0x62d9,0x731d,0x5027,
-0x5b97,0x5f9e,0x60b0,0x616b,0x68d5,0x6dd9,0x742e,0x7a2e,
-0x7d42,0x7d9c,0x7e31,0x816b,0x8e2a,0x8e35,0x937e,0x9418,
-0x4f50,0x5750,0x5de6,0x5ea7,0x632b,0x7f6a,0x4e3b,0x4f4f,
-0x4f8f,0x505a,0x59dd,0x80c4,0x546a,0x5468,0x55fe,0x594f,
-0x5b99,0x5dde,0x5eda,0x665d,0x6731,0x67f1,0x682a,0x6ce8,
-0x6d32,0x6e4a,0x6f8d,0x70b7,0x73e0,0x7587,0x7c4c,0x7d02,
-0x7d2c,0x7da2,0x821f,0x86db,0x8a3b,0x8a85,0x8d70,0x8e8a,
-0x8f33,0x9031,0x914e,0x9152,0x9444,0x99d0,0x7af9,0x7ca5,
-0x4fca,0x5101,0x51c6,0x57c8,0x5bef,0x5cfb,0x6659,0x6a3d,
-0x6d5a,0x6e96,0x6fec,0x710c,0x756f,0x7ae3,0x8822,0x9021,
-0x9075,0x96cb,0x99ff,0x8301,0x4e2d,0x4ef2,0x8846,0x91cd,
-0x537d,0x6adb,0x696b,0x6c41,0x847a,0x589e,0x618e,0x66fe,
-0x62ef,0x70dd,0x7511,0x75c7,0x7e52,0x84b8,0x8b49,0x8d08,
-0x4e4b,0x53ea,0x54ab,0x5730,0x5740,0x5fd7,0x6301,0x6307,
-0x646f,0x652f,0x65e8,0x667a,0x679d,0x67b3,0x6b62,0x6c60,
-0x6c9a,0x6f2c,0x77e5,0x7825,0x7949,0x7957,0x7d19,0x80a2,
-0x8102,0x81f3,0x829d,0x82b7,0x8718,0x8a8c,0xf9fc,0x8d04,
-0x8dbe,0x9072,0x76f4,0x7a19,0x7a37,0x7e54,0x8077,0x5507,
-0x55d4,0x5875,0x632f,0x6422,0x6649,0x664b,0x686d,0x699b,
-0x6b84,0x6d25,0x6eb1,0x73cd,0x7468,0x74a1,0x755b,0x75b9,
-0x76e1,0x771e,0x778b,0x79e6,0x7e09,0x7e1d,0x81fb,0x852f,
-0x8897,0x8a3a,0x8cd1,0x8eeb,0x8fb0,0x9032,0x93ad,0x9663,
-0x9673,0x9707,0x4f84,0x53f1,0x59ea,0x5ac9,0x5e19,0x684e,
-0x74c6,0x75be,0x79e9,0x7a92,0x81a3,0x86ed,0x8cea,0x8dcc,
-0x8fed,0x659f,0x6715,0xf9fd,0x57f7,0x6f57,0x7ddd,0x8f2f,
-0x93f6,0x96c6,0x5fb5,0x61f2,0x6f84,0x4e14,0x4f98,0x501f,
-0x53c9,0x55df,0x5d6f,0x5dee,0x6b21,0x6b64,0x78cb,0x7b9a,
-0xf9fe,0x8e49,0x8eca,0x906e,0x6349,0x643e,0x7740,0x7a84,
-0x932f,0x947f,0x9f6a,0x64b0,0x6faf,0x71e6,0x74a8,0x74da,
-0x7ac4,0x7c12,0x7e82,0x7cb2,0x7e98,0x8b9a,0x8d0a,0x947d,
-0x9910,0x994c,0x5239,0x5bdf,0x64e6,0x672d,0x7d2e,0x50ed,
-0x53c3,0x5879,0x6158,0x6159,0x61fa,0x65ac,0x7ad9,0x8b92,
-0x8b96,0x5009,0x5021,0x5275,0x5531,0x5a3c,0x5ee0,0x5f70,
-0x6134,0x655e,0x660c,0x6636,0x66a2,0x69cd,0x6ec4,0x6f32,
-0x7316,0x7621,0x7a93,0x8139,0x8259,0x83d6,0x84bc,0x50b5,
-0x57f0,0x5bc0,0x5be8,0x5f69,0x63a1,0x7826,0x7db5,0x83dc,
-0x8521,0x91c7,0x91f5,0x518a,0x67f5,0x7b56,0x8cac,0x51c4,
-0x59bb,0x60bd,0x8655,0x501c,0xf9ff,0x5254,0x5c3a,0x617d,
-0x621a,0x62d3,0x64f2,0x65a5,0x6ecc,0x7620,0x810a,0x8e60,
-0x965f,0x96bb,0x4edf,0x5343,0x5598,0x5929,0x5ddd,0x64c5,
-0x6cc9,0x6dfa,0x7394,0x7a7f,0x821b,0x85a6,0x8ce4,0x8e10,
-0x9077,0x91e7,0x95e1,0x9621,0x97c6,0x51f8,0x54f2,0x5586,
-0x5fb9,0x64a4,0x6f88,0x7db4,0x8f1f,0x8f4d,0x9435,0x50c9,
-0x5c16,0x6cbe,0x6dfb,0x751b,0x77bb,0x7c3d,0x7c64,0x8a79,
-0x8ac2,0x581e,0x59be,0x5e16,0x6377,0x7252,0x758a,0x776b,
-0x8adc,0x8cbc,0x8f12,0x5ef3,0x6674,0x6df8,0x807d,0x83c1,
-0x8acb,0x9751,0x9bd6,0xfa00,0x5243,0x66ff,0x6d95,0x6eef,
-0x7de0,0x8ae6,0x902e,0x905e,0x9ad4,0x521d,0x527f,0x54e8,
-0x6194,0x6284,0x62db,0x68a2,0x6912,0x695a,0x6a35,0x7092,
-0x7126,0x785d,0x7901,0x790e,0x79d2,0x7a0d,0x8096,0x8278,
-0x82d5,0x8349,0x8549,0x8c82,0x8d85,0x9162,0x918b,0x91ae,
-0x4fc3,0x56d1,0x71ed,0x77d7,0x8700,0x89f8,0x5bf8,0x5fd6,
-0x6751,0x90a8,0x53e2,0x585a,0x5bf5,0x60a4,0x6181,0x6460,
-0x7e3d,0x8070,0x8525,0x9283,0x64ae,0x50ac,0x5d14,0x6700,
-0x589c,0x62bd,0x63a8,0x690e,0x6978,0x6a1e,0x6e6b,0x76ba,
-0x79cb,0x82bb,0x8429,0x8acf,0x8da8,0x8ffd,0x9112,0x914b,
-0x919c,0x9310,0x9318,0x939a,0x96db,0x9a36,0x9c0d,0x4e11,
-0x755c,0x795d,0x7afa,0x7b51,0x7bc9,0x7e2e,0x84c4,0x8e59,
-0x8e74,0x8ef8,0x9010,0x6625,0x693f,0x7443,0x51fa,0x672e,
-0x9edc,0x5145,0x5fe0,0x6c96,0x87f2,0x885d,0x8877,0x60b4,
-0x81b5,0x8403,0x8d05,0x53d6,0x5439,0x5634,0x5a36,0x5c31,
-0x708a,0x7fe0,0x805a,0x8106,0x81ed,0x8da3,0x9189,0x9a5f,
-0x9df2,0x5074,0x4ec4,0x53a0,0x60fb,0x6e2c,0x5c64,0x4f88,
-0x5024,0x55e4,0x5cd9,0x5e5f,0x6065,0x6894,0x6cbb,0x6dc4,
-0x71be,0x75d4,0x75f4,0x7661,0x7a1a,0x7a49,0x7dc7,0x7dfb,
-0x7f6e,0x81f4,0x86a9,0x8f1c,0x96c9,0x99b3,0x9f52,0x5247,
-0x52c5,0x98ed,0x89aa,0x4e03,0x67d2,0x6f06,0x4fb5,0x5be2,
-0x6795,0x6c88,0x6d78,0x741b,0x7827,0x91dd,0x937c,0x87c4,
-0x79e4,0x7a31,0x5feb,0x4ed6,0x54a4,0x553e,0x58ae,0x59a5,
-0x60f0,0x6253,0x62d6,0x6736,0x6955,0x8235,0x9640,0x99b1,
-0x99dd,0x502c,0x5353,0x5544,0x577c,0xfa01,0x6258,0xfa02,
-0x64e2,0x666b,0x67dd,0x6fc1,0x6fef,0x7422,0x7438,0x8a17,
-0x9438,0x5451,0x5606,0x5766,0x5f48,0x619a,0x6b4e,0x7058,
-0x70ad,0x7dbb,0x8a95,0x596a,0x812b,0x63a2,0x7708,0x803d,
-0x8caa,0x5854,0x642d,0x69bb,0x5b95,0x5e11,0x6e6f,0xfa03,
-0x8569,0x514c,0x53f0,0x592a,0x6020,0x614b,0x6b86,0x6c70,
-0x6cf0,0x7b1e,0x80ce,0x82d4,0x8dc6,0x90b0,0x98b1,0xfa04,
-0x64c7,0x6fa4,0x6491,0x6504,0x514e,0x5410,0x571f,0x8a0e,
-0x615f,0x6876,0xfa05,0x75db,0x7b52,0x7d71,0x901a,0x5806,
-0x69cc,0x817f,0x892a,0x9000,0x9839,0x5078,0x5957,0x59ac,
-0x6295,0x900f,0x9b2a,0x615d,0x7279,0x95d6,0x5761,0x5a46,
-0x5df4,0x628a,0x64ad,0x64fa,0x6777,0x6ce2,0x6d3e,0x722c,
-0x7436,0x7834,0x7f77,0x82ad,0x8ddb,0x9817,0x5224,0x5742,
-0x677f,0x7248,0x74e3,0x8ca9,0x8fa6,0x9211,0x962a,0x516b,
-0x53ed,0x634c,0x4f69,0x5504,0x6096,0x6557,0x6c9b,0x6d7f,
-0x724c,0x72fd,0x7a17,0x8987,0x8c9d,0x5f6d,0x6f8e,0x70f9,
-0x81a8,0x610e,0x4fbf,0x504f,0x6241,0x7247,0x7bc7,0x7de8,
-0x7fe9,0x904d,0x97ad,0x9a19,0x8cb6,0x576a,0x5e73,0x67b0,
-0x840d,0x8a55,0x5420,0x5b16,0x5e63,0x5ee2,0x5f0a,0x6583,
-0x80ba,0x853d,0x9589,0x965b,0x4f48,0x5305,0x530d,0x530f,
-0x5486,0x54fa,0x5703,0x5e03,0x6016,0x629b,0x62b1,0x6355,
-0xfa06,0x6ce1,0x6d66,0x75b1,0x7832,0x80de,0x812f,0x82de,
-0x8461,0x84b2,0x888d,0x8912,0x900b,0x92ea,0x98fd,0x9b91,
-0x5e45,0x66b4,0x66dd,0x7011,0x7206,0xfa07,0x4ff5,0x527d,
-0x5f6a,0x6153,0x6753,0x6a19,0x6f02,0x74e2,0x7968,0x8868,
-0x8c79,0x98c7,0x98c4,0x9a43,0x54c1,0x7a1f,0x6953,0x8af7,
-0x8c4a,0x98a8,0x99ae,0x5f7c,0x62ab,0x75b2,0x76ae,0x88ab,
-0x907f,0x9642,0x5339,0x5f3c,0x5fc5,0x6ccc,0x73cc,0x7562,
-0x758b,0x7b46,0x82fe,0x999d,0x4e4f,0x903c,0x4e0b,0x4f55,
-0x53a6,0x590f,0x5ec8,0x6630,0x6cb3,0x7455,0x8377,0x8766,
-0x8cc0,0x9050,0x971e,0x9c15,0x58d1,0x5b78,0x8650,0x8b14,
-0x9db4,0x5bd2,0x6068,0x608d,0x65f1,0x6c57,0x6f22,0x6fa3,
-0x701a,0x7f55,0x7ff0,0x9591,0x9592,0x9650,0x97d3,0x5272,
-0x8f44,0x51fd,0x542b,0x54b8,0x5563,0x558a,0x6abb,0x6db5,
-0x7dd8,0x8266,0x929c,0x9677,0x9e79,0x5408,0x54c8,0x76d2,
-0x86e4,0x95a4,0x95d4,0x965c,0x4ea2,0x4f09,0x59ee,0x5ae6,
-0x5df7,0x6052,0x6297,0x676d,0x6841,0x6c86,0x6e2f,0x7f38,
-0x809b,0x822a,0xfa08,0xfa09,0x9805,0x4ea5,0x5055,0x54b3,
-0x5793,0x595a,0x5b69,0x5bb3,0x61c8,0x6977,0x6d77,0x7023,
-0x87f9,0x89e3,0x8a72,0x8ae7,0x9082,0x99ed,0x9ab8,0x52be,
-0x6838,0x5016,0x5e78,0x674f,0x8347,0x884c,0x4eab,0x5411,
-0x56ae,0x73e6,0x9115,0x97ff,0x9909,0x9957,0x9999,0x5653,
-0x589f,0x865b,0x8a31,0x61b2,0x6af6,0x737b,0x8ed2,0x6b47,
-0x96aa,0x9a57,0x5955,0x7200,0x8d6b,0x9769,0x4fd4,0x5cf4,
-0x5f26,0x61f8,0x665b,0x6ceb,0x70ab,0x7384,0x73b9,0x73fe,
-0x7729,0x774d,0x7d43,0x7d62,0x7e23,0x8237,0x8852,0xfa0a,
-0x8ce2,0x9249,0x986f,0x5b51,0x7a74,0x8840,0x9801,0x5acc,
-0x4fe0,0x5354,0x593e,0x5cfd,0x633e,0x6d79,0x72f9,0x8105,
-0x8107,0x83a2,0x92cf,0x9830,0x4ea8,0x5144,0x5211,0x578b,
-0x5f62,0x6cc2,0x6ece,0x7005,0x7050,0x70af,0x7192,0x73e9,
-0x7469,0x834a,0x87a2,0x8861,0x9008,0x90a2,0x93a3,0x99a8,
-0x516e,0x5f57,0x60e0,0x6167,0x66b3,0x8559,0x8e4a,0x91af,
-0x978b,0x4e4e,0x4e92,0x547c,0x58d5,0x58fa,0x597d,0x5cb5,
-0x5f27,0x6236,0x6248,0x660a,0x6667,0x6beb,0x6d69,0x6dcf,
-0x6e56,0x6ef8,0x6f94,0x6fe0,0x6fe9,0x705d,0x72d0,0x7425,
-0x745a,0x74e0,0x7693,0x795c,0x7cca,0x7e1e,0x80e1,0x82a6,
-0x846b,0x84bf,0x864e,0x865f,0x8774,0x8b77,0x8c6a,0x93ac,
-0x9800,0x9865,0x60d1,0x6216,0x9177,0x5a5a,0x660f,0x6df7,
-0x6e3e,0x743f,0x9b42,0x5ffd,0x60da,0x7b0f,0x54c4,0x5f18,
-0x6c5e,0x6cd3,0x6d2a,0x70d8,0x7d05,0x8679,0x8a0c,0x9d3b,
-0x5316,0x548c,0x5b05,0x6a3a,0x706b,0x7575,0x798d,0x79be,
-0x82b1,0x83ef,0x8a71,0x8b41,0x8ca8,0x9774,0xfa0b,0x64f4,
-0x652b,0x78ba,0x78bb,0x7a6b,0x4e38,0x559a,0x5950,0x5ba6,
-0x5e7b,0x60a3,0x63db,0x6b61,0x6665,0x6853,0x6e19,0x7165,
-0x74b0,0x7d08,0x9084,0x9a69,0x9c25,0x6d3b,0x6ed1,0x733e,
-0x8c41,0x95ca,0x51f0,0x5e4c,0x5fa8,0x604d,0x60f6,0x6130,
-0x614c,0x6643,0x6644,0x69a5,0x6cc1,0x6e5f,0x6ec9,0x6f62,
-0x714c,0x749c,0x7687,0x7bc1,0x7c27,0x8352,0x8757,0x9051,
-0x968d,0x9ec3,0x532f,0x56de,0x5efb,0x5f8a,0x6062,0x6094,
-0x61f7,0x6666,0x6703,0x6a9c,0x6dee,0x6fae,0x7070,0x736a,
-0x7e6a,0x81be,0x8334,0x86d4,0x8aa8,0x8cc4,0x5283,0x7372,
-0x5b96,0x6a6b,0x9404,0x54ee,0x5686,0x5b5d,0x6548,0x6585,
-0x66c9,0x689f,0x6d8d,0x6dc6,0x723b,0x80b4,0x9175,0x9a4d,
-0x4faf,0x5019,0x539a,0x540e,0x543c,0x5589,0x55c5,0x5e3f,
-0x5f8c,0x673d,0x7166,0x73dd,0x9005,0x52db,0x52f3,0x5864,
-0x58ce,0x7104,0x718f,0x71fb,0x85b0,0x8a13,0x6688,0x85a8,
-0x55a7,0x6684,0x714a,0x8431,0x5349,0x5599,0x6bc1,0x5f59,
-0x5fbd,0x63ee,0x6689,0x7147,0x8af1,0x8f1d,0x9ebe,0x4f11,
-0x643a,0x70cb,0x7566,0x8667,0x6064,0x8b4e,0x9df8,0x5147,
-0x51f6,0x5308,0x6d36,0x80f8,0x9ed1,0x6615,0x6b23,0x7098,
-0x75d5,0x5403,0x5c79,0x7d07,0x8a16,0x6b20,0x6b3d,0x6b46,
-0x5438,0x6070,0x6d3d,0x7fd5,0x8208,0x50d6,0x51de,0x559c,
-0x566b,0x56cd,0x59ec,0x5b09,0x5e0c,0x6199,0x6198,0x6231,
-0x665e,0x66e6,0x7199,0x71b9,0x71ba,0x72a7,0x79a7,0x7a00,
-0x7fb2,0x8a70};
-
-static const int uhc3_ucs_table_size = (sizeof(uhc3_ucs_table)/sizeof(unsigned short));
-
-/* UCS -> UHC */
-static const unsigned short ucs_a1_uhc_table[] = {
-0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
-0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
-0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
-0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
-0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
-0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
-0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
-0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
-0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
-0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
-0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
-0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
-0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
-0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
-0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
-0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa2ae,0x0000,0x0000,0xa2b4,0x0000,0x0000,0xa1d7,
-0xa1a7,0x0000,0xa8a3,0x0000,0x0000,0xa1a9,0xa2e7,0x0000,
-0xa1c6,0xa1be,0xa9f7,0xa9f8,0xa2a5,0x0000,0xa2d2,0xa1a4,
-0xa2ac,0xa9f6,0xa8ac,0x0000,0xa8f9,0xa8f6,0xa8fa,0xa2af,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa8a1,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa8a2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1bf,
-0xa8aa,0x0000,0x0000,0x0000,0x0000,0x0000,0xa8ad,0xa9ac,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa9a1,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa9a3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1c0,
-0xa9aa,0x0000,0x0000,0x0000,0x0000,0x0000,0xa9ad,0x0000,
-/* 0x0100 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa9a2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa8a4,0xa9a4,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa9a5,0xa8a6,0xa9a6,0x0000,0x0000,0x0000,0x0000,
-0xa9a7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa8a8,
-0xa9a8,0xa8a9,0xa9a9,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa9b0,0xa8af,0xa9af,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa8ab,0xa9ab,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa8ae,0xa9ae,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x0200 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa2a7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa2b0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa2a8,0xa2ab,0xa2aa,0xa2ad,0x0000,0xa2a9,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x0300 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa5c1,0xa5c2,0xa5c3,0xa5c4,0xa5c5,0xa5c6,0xa5c7,
-0xa5c8,0xa5c9,0xa5ca,0xa5cb,0xa5cc,0xa5cd,0xa5ce,0xa5cf,
-0xa5d0,0xa5d1,0x0000,0xa5d2,0xa5d3,0xa5d4,0xa5d5,0xa5d6,
-0xa5d7,0xa5d8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa5e1,0xa5e2,0xa5e3,0xa5e4,0xa5e5,0xa5e6,0xa5e7,
-0xa5e8,0xa5e9,0xa5ea,0xa5eb,0xa5ec,0xa5ed,0xa5ee,0xa5ef,
-0xa5f0,0xa5f1,0x0000,0xa5f2,0xa5f3,0xa5f4,0xa5f5,0xa5f6,
-0xa5f7,0xa5f8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x0400 */
-0x0000,0xaca7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xaca1,0xaca2,0xaca3,0xaca4,0xaca5,0xaca6,0xaca8,0xaca9,
-0xacaa,0xacab,0xacac,0xacad,0xacae,0xacaf,0xacb0,0xacb1,
-0xacb2,0xacb3,0xacb4,0xacb5,0xacb6,0xacb7,0xacb8,0xacb9,
-0xacba,0xacbb,0xacbc,0xacbd,0xacbe,0xacbf,0xacc0,0xacc1,
-0xacd1,0xacd2,0xacd3,0xacd4,0xacd5,0xacd6,0xacd8,0xacd9,
-0xacda,0xacdb,0xacdc,0xacdd,0xacde,0xacdf,0xace0,0xace1,
-0xace2,0xace3,0xace4,0xace5,0xace6,0xace7,0xace8,0xace9,
-0xacea,0xaceb,0xacec,0xaced,0xacee,0xacef,0xacf0,0xacf1,
-0x0000,0xacd7};
-
-static const int ucs_a1_uhc_table_min = 0x0000;
-static const int ucs_a1_uhc_table_max = 0x0000 + (sizeof(ucs_a1_uhc_table)/sizeof(unsigned short));
-
-static const unsigned short ucs_a2_uhc_table[] = {
-/* 0x2000 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa1aa,0x0000,0x0000,
-0xa1ae,0xa1af,0x0000,0x0000,0xa1b0,0xa1b1,0x0000,0x0000,
-0xa2d3,0xa2d4,0x0000,0x0000,0x0000,0xa1a5,0xa1a6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa2b6,0x0000,0xa1c7,0xa1c8,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa1d8,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa9f9,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa9fa,
-0x0000,0xa9fb,0xa9fc,0xa9fd,0xa9fe,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa2e6,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x2100 */
-0x0000,0x0000,0x0000,0xa1c9,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa2b5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa7a4,0x0000,0x0000,0xa2e0,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa2e5,0xa2e2,0x0000,0x0000,0x0000,0xa7d9,0x0000,
-0x0000,0x0000,0x0000,0xa1ca,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa8f7,0xa8f8,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa8fb,0xa8fc,0xa8fd,0xa8fe,0x0000,
-0xa5b0,0xa5b1,0xa5b2,0xa5b3,0xa5b4,0xa5b5,0xa5b6,0xa5b7,
-0xa5b8,0xa5b9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa5a1,0xa5a2,0xa5a3,0xa5a4,0xa5a5,0xa5a6,0xa5a7,0xa5a8,
-0xa5a9,0xa5aa,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1e7,0xa1e8,0xa1e6,0xa1e9,0xa1ea,0xa2d5,0xa2d8,0xa2d6,
-0xa2d9,0xa2d7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa2a1,0x0000,0xa2a2,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa2a3,0x0000,0xa1d3,0xa2a4,0x0000,0x0000,0x0000,0xa1d4,
-0xa1f4,0x0000,0x0000,0xa1f5,0x0000,0x0000,0x0000,0xa2b3,
-0x0000,0xa2b2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa1ee,0x0000,0x0000,0xa1f0,0xa1c4,0x0000,
-0xa1d0,0x0000,0x0000,0x0000,0x0000,0xa1ab,0x0000,0xa1fc,
-0xa1fd,0xa1fb,0xa1fa,0xa1f2,0xa1f3,0x0000,0xa2b1,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa1c5,0xa1f1,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa1ad,0xa1ef,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa1d6,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1c1,0xa1d5,0x0000,0x0000,0xa1c2,0xa1c3,0x0000,0x0000,
-0x0000,0x0000,0xa1ec,0xa1ed,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa1f8,0xa1f9,0x0000,0x0000,0xa1f6,0xa1f7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa2c1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa1d1,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x2300 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa1d2,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x2400 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa8e7,0xa8e8,0xa8e9,0xa8ea,0xa8eb,0xa8ec,0xa8ed,0xa8ee,
-0xa8ef,0xa8f0,0xa8f1,0xa8f2,0xa8f3,0xa8f4,0xa8f5,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa9e7,0xa9e8,0xa9e9,0xa9ea,
-0xa9eb,0xa9ec,0xa9ed,0xa9ee,0xa9ef,0xa9f0,0xa9f1,0xa9f2,
-0xa9f3,0xa9f4,0xa9f5,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa9cd,0xa9ce,0xa9cf,0xa9d0,
-0xa9d1,0xa9d2,0xa9d3,0xa9d4,0xa9d5,0xa9d6,0xa9d7,0xa9d8,
-0xa9d9,0xa9da,0xa9db,0xa9dc,0xa9dd,0xa9de,0xa9df,0xa9e0,
-0xa9e1,0xa9e2,0xa9e3,0xa9e4,0xa9e5,0xa9e6,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa8cd,0xa8ce,0xa8cf,0xa8d0,0xa8d1,0xa8d2,0xa8d3,0xa8d4,
-0xa8d5,0xa8d6,0xa8d7,0xa8d8,0xa8d9,0xa8da,0xa8db,0xa8dc,
-0xa8dd,0xa8de,0xa8df,0xa8e0,0xa8e1,0xa8e2,0xa8e3,0xa8e4,
-0xa8e5,0xa8e6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa6a1,0xa6ac,0xa6a2,0xa6ad,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa6a3,0xa6c8,0xa6c7,0xa6ae,
-0xa6a4,0xa6c2,0xa6c1,0xa6af,0xa6a6,0xa6c6,0xa6c5,0xa6b1,
-0xa6a5,0xa6c4,0xa6c3,0xa6b0,0xa6a7,0xa6bc,0xa6c9,0xa6ca,
-0xa6b7,0xa6cb,0xa6cc,0xa6b2,0xa6a9,0xa6be,0xa6cd,0xa6ce,
-0xa6b9,0xa6cf,0xa6d0,0xa6b4,0xa6a8,0xa6d1,0xa6d2,0xa6b8,
-0xa6bd,0xa6d3,0xa6d4,0xa6b3,0xa6aa,0xa6d5,0xa6d6,0xa6ba,
-0xa6bf,0xa6d7,0xa6d8,0xa6b5,0xa6ab,0xa6d9,0xa6da,0xa6bb,
-0xa6db,0xa6dc,0xa6c0,0xa6dd,0xa6de,0xa6df,0xa6e0,0xa6e1,
-0xa6e2,0xa6e3,0xa6e4,0xa6b6,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa2c6,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1e1,0xa1e0,0x0000,0xa2c3,0xa2c7,0xa2c8,0xa2cb,0xa2ca,
-0xa2c9,0xa2cc,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa1e3,0xa1e2,0x0000,0x0000,0xa2ba,0xa2b9,
-0x0000,0x0000,0x0000,0x0000,0xa1e5,0xa1e4,0x0000,0x0000,
-0xa2b8,0xa2b7,0x0000,0x0000,0x0000,0x0000,0xa1df,0xa1de,
-0xa2c2,0x0000,0x0000,0xa1db,0x0000,0x0000,0xa1dd,0xa1dc,
-0xa2c4,0xa2c5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x2600 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa1da,0xa1d9,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa2cf,0xa2ce,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa2d0,0x0000,0xa2d1,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1cf,0x0000,0xa1ce,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa2bc,0xa2bd,0x0000,0xa2c0,0xa2bb,0xa2be,0x0000,0xa2bf,
-0xa2cd,0xa2db,0xa2dc,0x0000,0xa2dd,0xa2da};
-
-static const int ucs_a2_uhc_table_min = 0x2000;
-static const int ucs_a2_uhc_table_max = 0x2000 + (sizeof(ucs_a2_uhc_table)/sizeof(unsigned short));
-
-static const unsigned short ucs_a3_uhc_table[] = {
-/* 0x2f00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1a1,0xa1a2,0xa1a3,0xa1a8,0x0000,0x0000,0x0000,0x0000,
-0xa1b4,0xa1b5,0xa1b6,0xa1b7,0xa1b8,0xa1b9,0xa1ba,0xa1bb,
-0xa1bc,0xa1bd,0x0000,0xa1eb,0xa1b2,0xa1b3,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xaaa1,0xaaa2,0xaaa3,0xaaa4,0xaaa5,0xaaa6,0xaaa7,
-0xaaa8,0xaaa9,0xaaaa,0xaaab,0xaaac,0xaaad,0xaaae,0xaaaf,
-0xaab0,0xaab1,0xaab2,0xaab3,0xaab4,0xaab5,0xaab6,0xaab7,
-0xaab8,0xaab9,0xaaba,0xaabb,0xaabc,0xaabd,0xaabe,0xaabf,
-0xaac0,0xaac1,0xaac2,0xaac3,0xaac4,0xaac5,0xaac6,0xaac7,
-0xaac8,0xaac9,0xaaca,0xaacb,0xaacc,0xaacd,0xaace,0xaacf,
-0xaad0,0xaad1,0xaad2,0xaad3,0xaad4,0xaad5,0xaad6,0xaad7,
-0xaad8,0xaad9,0xaada,0xaadb,0xaadc,0xaadd,0xaade,0xaadf,
-0xaae0,0xaae1,0xaae2,0xaae3,0xaae4,0xaae5,0xaae6,0xaae7,
-0xaae8,0xaae9,0xaaea,0xaaeb,0xaaec,0xaaed,0xaaee,0xaaef,
-0xaaf0,0xaaf1,0xaaf2,0xaaf3,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xaba1,0xaba2,0xaba3,0xaba4,0xaba5,0xaba6,0xaba7,
-0xaba8,0xaba9,0xabaa,0xabab,0xabac,0xabad,0xabae,0xabaf,
-0xabb0,0xabb1,0xabb2,0xabb3,0xabb4,0xabb5,0xabb6,0xabb7,
-0xabb8,0xabb9,0xabba,0xabbb,0xabbc,0xabbd,0xabbe,0xabbf,
-0xabc0,0xabc1,0xabc2,0xabc3,0xabc4,0xabc5,0xabc6,0xabc7,
-0xabc8,0xabc9,0xabca,0xabcb,0xabcc,0xabcd,0xabce,0xabcf,
-0xabd0,0xabd1,0xabd2,0xabd3,0xabd4,0xabd5,0xabd6,0xabd7,
-0xabd8,0xabd9,0xabda,0xabdb,0xabdc,0xabdd,0xabde,0xabdf,
-0xabe0,0xabe1,0xabe2,0xabe3,0xabe4,0xabe5,0xabe6,0xabe7,
-0xabe8,0xabe9,0xabea,0xabeb,0xabec,0xabed,0xabee,0xabef,
-0xabf0,0xabf1,0xabf2,0xabf3,0xabf4,0xabf5,0xabf6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x3100 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa4a1,0xa4a2,0xa4a3,0xa4a4,0xa4a5,0xa4a6,0xa4a7,
-0xa4a8,0xa4a9,0xa4aa,0xa4ab,0xa4ac,0xa4ad,0xa4ae,0xa4af,
-0xa4b0,0xa4b1,0xa4b2,0xa4b3,0xa4b4,0xa4b5,0xa4b6,0xa4b7,
-0xa4b8,0xa4b9,0xa4ba,0xa4bb,0xa4bc,0xa4bd,0xa4be,0xa4bf,
-0xa4c0,0xa4c1,0xa4c2,0xa4c3,0xa4c4,0xa4c5,0xa4c6,0xa4c7,
-0xa4c8,0xa4c9,0xa4ca,0xa4cb,0xa4cc,0xa4cd,0xa4ce,0xa4cf,
-0xa4d0,0xa4d1,0xa4d2,0xa4d3,0xa4d4,0xa4d5,0xa4d6,0xa4d7,
-0xa4d8,0xa4d9,0xa4da,0xa4db,0xa4dc,0xa4dd,0xa4de,0xa4df,
-0xa4e0,0xa4e1,0xa4e2,0xa4e3,0xa4e4,0xa4e5,0xa4e6,0xa4e7,
-0xa4e8,0xa4e9,0xa4ea,0xa4eb,0xa4ec,0xa4ed,0xa4ee,0xa4ef,
-0xa4f0,0xa4f1,0xa4f2,0xa4f3,0xa4f4,0xa4f5,0xa4f6,0xa4f7,
-0xa4f8,0xa4f9,0xa4fa,0xa4fb,0xa4fc,0xa4fd,0xa4fe,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa9b1,0xa9b2,0xa9b3,0xa9b4,0xa9b5,0xa9b6,0xa9b7,0xa9b8,
-0xa9b9,0xa9ba,0xa9bb,0xa9bc,0xa9bd,0xa9be,0xa9bf,0xa9c0,
-0xa9c1,0xa9c2,0xa9c3,0xa9c4,0xa9c5,0xa9c6,0xa9c7,0xa9c8,
-0xa9c9,0xa9ca,0xa9cb,0xa9cc,0xa2df,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa8b1,0xa8b2,0xa8b3,0xa8b4,0xa8b5,0xa8b6,0xa8b7,0xa8b8,
-0xa8b9,0xa8ba,0xa8bb,0xa8bc,0xa8bd,0xa8be,0xa8bf,0xa8c0,
-0xa8c1,0xa8c2,0xa8c3,0xa8c4,0xa8c5,0xa8c6,0xa8c7,0xa8c8,
-0xa8c9,0xa8ca,0xa8cb,0xa8cc,0x0000,0x0000,0x0000,0xa2de,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x3300 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa7c9,0xa7ca,0xa7cb,0xa7cc,0xa7cd,0x0000,0x0000,0x0000,
-0xa7ba,0xa7bb,0xa7dc,0xa7dd,0xa7de,0xa7b6,0xa7b7,0xa7b8,
-0xa7d4,0xa7d5,0xa7d6,0xa7d7,0xa7d8,0xa7a1,0xa7a2,0xa7a3,
-0xa7a5,0xa7ab,0xa7ac,0xa7ad,0xa7ae,0xa7af,0xa7b0,0xa7b1,
-0xa7b2,0xa7b3,0xa7b4,0xa7a7,0xa7a8,0xa7a9,0xa7aa,0xa7bd,
-0xa7be,0xa7e5,0xa7e6,0xa7e7,0xa7e8,0xa7e1,0xa7e2,0xa7e3,
-0xa7bf,0xa7c0,0xa7c1,0xa7c2,0xa7c3,0xa7c4,0xa7c5,0xa7c6,
-0xa7c7,0xa7c8,0xa7ce,0xa7cf,0xa7d0,0xa7d1,0xa7d2,0xa7d3,
-0xa7da,0xa7db,0xa2e3,0xa7ec,0xa7a6,0xa7e0,0xa7ef,0xa2e1,
-0xa7bc,0xa7ed,0xa7b5,0x0000,0x0000,0x0000,0x0000,0xa7b9,
-0xa7ea,0x0000,0x0000,0xa7eb,0x0000,0x0000,0xa7df,0x0000,
-0xa2e4,0x0000,0x0000,0xa7e4,0xa7ee,0xa7e9};
-
-static const int ucs_a3_uhc_table_min = 0x2f00;
-static const int ucs_a3_uhc_table_max = 0x2f00 + (sizeof(ucs_a3_uhc_table)/sizeof(unsigned short));
-
-static const unsigned short ucs_i_uhc_table[] = {
-/* 0x4d00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xece9,0xefcb,0x0000,0xf6d2,0x0000,0x0000,0x0000,0xd8b2,
-0xeddb,0xdfb2,0xdfbe,0xf9bb,0x0000,0xdcf4,0x0000,0x0000,
-0x0000,0xf5e4,0x0000,0x0000,0xf3a6,0xdde0,0xe1a6,0x0000,
-0xcef8,0xdcb0,0x0000,0x0000,0x0000,0x0000,0xe3aa,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf1e9,0x0000,0x0000,
-0x0000,0x0000,0xcdfa,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xfcaf,0xd3a1,0x0000,0xf1ab,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe7d1,0xd2ac,0x0000,0xcef9,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf1fd,0x0000,0xdebf,0xfbba,0xf9b9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xced2,0x0000,
-0xe3ab,0xebe0,0x0000,0x0000,0x0000,0xcefa,0xcbf7,0xe5a5,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xcae1,0x0000,0xd4cc,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xeae1,0x0000,0x0000,0xdce3,0xdfad,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcbeb,0x0000,
-0x0000,0x0000,0xd5af,0x0000,0x0000,0x0000,0xd6f5,0x0000,
-0xe5f8,0x0000,0x0000,0xdec0,0xeca3,0x0000,0xe9cd,0x0000,
-0xeaa7,0xe9f6,0xfbbb,0x0000,0xe7e9,0xefcc,0x0000,0x0000,
-0xd0e6,0x0000,0x0000,0xdec1,0x0000,0x0000,0xe4ac,0x0000,
-0x0000,0xd8cc,0xf9f1,0x0000,0xcedf,0xfaa4,0xe6b2,0x0000,
-0xfafb,0x0000,0x0000,0xfabd,0xccc8,0xefcd,0xd5d5,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd3a2,0x0000,
-0x0000,0x0000,0xecd1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe4a7,0xecd2,0x0000,0x0000,0xf6b1,0x0000,0x0000,0xcefb,
-0x0000,0x0000,0xd0d1,0xcbbf,0x0000,0xeda4,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xeda8,0xdec2,0xf6e2,0xeddc,
-0xdcf5,0xe0b9,0x0000,0x0000,0x0000,0xd4ce,0x0000,0xf4b5,
-0x0000,0x0000,0x0000,0xd3db,0xd6b5,0xeca4,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe4e6,0x0000,0xf1ea,0x0000,0x0000,0x0000,0xcbec,0xcbc0,
-0x0000,0x0000,0x0000,0xecf2,0x0000,0x0000,0x0000,0x0000,
-/* 0x4f00 */
-0x0000,0xd0ea,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf9f2,0xeca5,0xd0df,0x0000,0xe7ea,0xd0eb,0xdcd1,
-0xdbe9,0xfdcc,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdbd7,
-0x0000,0x0000,0x0000,0x0000,0xdae1,0x0000,0xd6b6,0x0000,
-0xe3df,0x0000,0xdec3,0x0000,0xdec4,0xcaa1,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xeeec,0x0000,0x0000,0xd3a3,0xeeb7,
-0xf8cf,0x0000,0x0000,0x0000,0x0000,0xeac8,0xeeb8,0xf1ac,
-0xf1a5,0xe9ce,0x0000,0x0000,0x0000,0xf9bc,0x0000,0x0000,
-0x0000,0xe5f9,0xecea,0xddd6,0xedc2,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf8a5,0x0000,0x0000,0x0000,0x0000,0x0000,0xe5ba,
-0xdbd8,0x0000,0x0000,0xcaa2,0x0000,0x0000,0xd1cd,0x0000,
-0x0000,0x0000,0xeeed,0x0000,0x0000,0x0000,0xeceb,0xdec5,
-0x0000,0xe3e0,0x0000,0xcac9,0xf2e9,0x0000,0xd5ce,0x0000,
-0xf6b6,0x0000,0xcec2,0xd6c7,0x0000,0xe3b4,0x0000,0xf1ad,
-0x0000,0xeae2,0x0000,0x0000,0x0000,0x0000,0xd7c2,0x0000,
-0xf3a7,0x0000,0x0000,0xcdea,0x0000,0xebee,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd9b2,0xfda5,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf6d5,0xd5e2,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf8b5,
-0x0000,0x0000,0xccf5,0xf5b5,0xe4ad,0x0000,0x0000,0x0000,
-0x0000,0xe7eb,0xf1d5,0x0000,0x0000,0x0000,0xf0bb,0x0000,
-0x0000,0xe9b5,0x0000,0xccc9,0xfad5,0x0000,0x0000,0xe1d4,
-0x0000,0x0000,0xd7d6,0x0000,0x0000,0xdcc1,0x0000,0xdec6,
-0xfaef,0xe3e1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe1f3,0xdcf6,
-0x0000,0xcefc,0x0000,0xdbc4,0x0000,0xf8f1,0x0000,0x0000,
-0xdce4,0x0000,0xe5ef,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x5000 */
-0x0000,0x0000,0xdcb1,0x0000,0x0000,0x0000,0xd5d6,0x0000,
-0x0000,0xf3da,0x0000,0xcbc1,0x0000,0xdbc3,0x0000,0x0000,
-0x0000,0xd9fa,0xd3ee,0x0000,0x0000,0x0000,0xfab8,0x0000,
-0x0000,0xfda6,0xebef,0x0000,0xf4a6,0x0000,0xccca,0xf3a8,
-0x0000,0xf3db,0x0000,0xdba7,0xf6b7,0x0000,0xcfe6,0xf0f2,
-0xcbda,0x0000,0xe7d2,0xd7c3,0xf6f0,0xe8de,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe5a6,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe5e7,0x0000,0x0000,0x0000,0xcaa3,
-0xcca7,0xeac9,0x0000,0x0000,0x0000,0x0000,0x0000,0xf8b6,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xfaa5,0x0000,0x0000,
-0x0000,0x0000,0xf1ae,0x0000,0xefce,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xcbed,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf6b0,0xefcf,0xe9cf,0x0000,
-0xf7de,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xced3,0x0000,0x0000,0x0000,0x0000,0xdcf7,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xdba8,0x0000,0x0000,
-0x0000,0xcbf8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xdfa1,0xdde1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf5ca,0xe9b6,0x0000,0x0000,
-0x0000,0x0000,0xe7ec,0xeeee,0x0000,0xf3f0,0x0000,0xdfbf,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcccb,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd0c1,0x0000,0x0000,
-0x0000,0xf4d2,0xe0ba,0x0000,0x0000,0x0000,0x0000,0xdfc0,
-0x0000,0xcee0,0x0000,0x0000,0x0000,0xdcd2,0xfdea,0x0000,
-0x0000,0x0000,0xd6f6,0x0000,0x0000,0x0000,0xeaca,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe8e9,0x0000,0xe3ac,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf3d0,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xcaa4,0x0000,0xdbf8,0x0000,0x0000,0x0000,0xdec7,
-0xebf0,0xf1d6,0x0000,0x0000,0xe5e2,0x0000,0xcccc,0x0000,
-0x0000,0xcbfb,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xeae3,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdfc1,
-0x0000,0xd6ed,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe9d0,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xeeb9,0x0000,0x0000,0x0000,0x0000,0xd5e3,
-0x0000,0x0000,0xd1d3,0x0000,0xe5f0,0x0000,0x0000,0x0000,
-0xe8b4,0xebc3,0x0000,0xeaaa,0xfafc,0xf5f6,0xf0bc,0xfdd4,
-0xe0bb,0xcec3,0x0000,0xd0ba,0xf7ba,0xd8f3,0xf7cd,0x0000,
-0x0000,0x0000,0xe4ae,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd4df,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd0e7,0x0000,0x0000,0xecfd,0x0000,0xd2ae,
-0xeeef,0xd5d7,0xeae4,0xf8a2,0xcdeb,0xd7bf,0xfbb1,0x0000,
-0x0000,0xcdec,0x0000,0x0000,0x0000,0xdcb2,0xd0ec,0xcefd,
-0xeef0,0x0000,0x0000,0x0000,0xccc2,0x0000,0x0000,0x0000,
-0xd0ed,0x0000,0x0000,0x0000,0x0000,0x0000,0xe5f7,0x0000,
-0x0000,0x0000,0xf3fc,0x0000,0x0000,0xeea2,0x0000,0x0000,
-0x0000,0x0000,0xd9b3,0x0000,0x0000,0xd8f4,0x0000,0xe9b7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xceae,0x0000,0x0000,0x0000,0x0000,0xd9a2,0x0000,0x0000,
-0x0000,0x0000,0xd8f1,0x0000,0xd4cf,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe5a7,0xd5d2,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd6a9,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf4a2,0x0000,0xf1d7,0x0000,
-0x0000,0xd5d8,0x0000,0xf0bd,0xd7d0,0xd4d0,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd7cf,0xebea,0xfdeb,0x0000,
-0x0000,0xdbed,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xfcc5,0xcbc2,0x0000,0x0000,0x0000,0x0000,0xfdd5,0x0000,
-0xf4c8,0xe8ea,0xf5f3,0x0000,0x0000,0xf9de,0x0000,0x0000,
-0xd3ef,0x0000,0x0000,0xecd3,0x0000,0x0000,0xddc2,0xefb7,
-0xe7d4,0x0000,0xcaca,0x0000,0x0000,0x0000,0xd9fb,0x0000,
-0x0000,0xfafd,0x0000,0x0000,0x0000,0x0000,0x0000,0xd6aa,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf4f8,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf7f7,0xdcac,0x0000,0x0000,
-0x0000,0xd7d7,0xdfa2,0x0000,0x0000,0x0000,0xcebe,0x0000,
-0xd3f0,0x0000,0x0000,0x0000,0x0000,0x0000,0xf0a4,0xe1ec,
-0xcfe7,0xf3cb,0xeda9,0xcabe,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf4ef,0x0000,0x0000,0x0000,0xf6ce,
-0x0000,0x0000,0xdefb,0xd0bb,0xd5b7,0xeef1,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf4a8,0x0000,0xdcf8,0x0000,
-0x0000,0x0000,0x0000,0xcba7,0x0000,0xdace,0x0000,0x0000,
-0x0000,0xe0e6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xeda5,0xeef2,0x0000,0x0000,0x0000,0x0000,0xdcf9,
-0x0000,0x0000,0xf9dc,0x0000,0x0000,0xf3dc,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf8f2,0x0000,0xf4f9,
-0x0000,0x0000,0x0000,0xfcf1,0x0000,0x0000,0x0000,0xd0bc,
-0xdbf9,0xd7b1,0x0000,0x0000,0x0000,0xcbfc,0x0000,0x0000,
-0x0000,0xf0a5,0xcbfd,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd5f4,0x0000,0x0000,0x0000,0xcded,
-0xcaa5,0x0000,0x0000,0xd6ab,0xd0c2,0x0000,0x0000,0x0000,
-0x0000,0xf0be,0xd2bd,0xcca4,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfab6,0x0000,
-0x0000,0xcccd,0x0000,0xdafa,0x0000,0xf6cf,0x0000,0xe9b8,
-0x0000,0xd8f5,0x0000,0x0000,0x0000,0xccce,0x0000,0x0000,
-0x0000,0x0000,0xd7cd,0x0000,0x0000,0xd4d1,0xe9ed,0x0000,
-0xcaeb,0xd9e2,0x0000,0xfdb2,0x0000,0xe3ad,0xd6cc,0xd9b4,
-0x0000,0x0000,0xe1a7,0xeed3,0xd0c3,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xfdb3,0x0000,0xd5e4,0x0000,0x0000,
-0xcfe8,0x0000,0xedc3,0xd0b2,0x0000,0x0000,0xcefe,0xdaa8,
-/* 0x5300 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf8d0,0x0000,0x0000,
-0xfdd6,0x0000,0x0000,0x0000,0x0000,0xf8d1,0x0000,0xf8d2,
-0xdcd3,0x0000,0x0000,0x0000,0x0000,0xdde2,0xfbf9,0xddc1,
-0x0000,0xe3b5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xeddd,0xcec4,0x0000,0xcba1,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xdde3,0x0000,0x0000,0x0000,0x0000,0xfcdd,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf9af,0x0000,0x0000,0x0000,0x0000,0x0000,0xd2fb,
-0xcfa1,0xe4a8,0x0000,0xf4b6,0xecfe,0x0000,0x0000,0xe3ae,
-0xe7ed,0xfdc1,0xdae2,0x0000,0x0000,0xd8b3,0x0000,0x0000,
-0x0000,0xdde4,0xf0ef,0xf6f1,0xfaf0,0x0000,0x0000,0xd1f5,
-0x0000,0x0000,0xdacf,0x0000,0xdcd4,0x0000,0xdca6,0x0000,
-0xefbf,0x0000,0x0000,0x0000,0x0000,0x0000,0xcecf,0x0000,
-0xe0d9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd9d6,
-0xecd4,0xeacb,0x0000,0x0000,0xcabf,0xd5b0,0x0000,0xcfe9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf1ed,0x0000,0xcccf,
-0x0000,0x0000,0x0000,0x0000,0xe4f8,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe4ed,0x0000,0x0000,0x0000,0x0000,
-0xd7d8,0x0000,0xfda7,0x0000,0x0000,0x0000,0x0000,0xeaab,
-0xf6b2,0x0000,0x0000,0x0000,0x0000,0xcff0,0xf9bd,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe6f4,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xcbdb,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf3d1,0x0000,0x0000,0x0000,0x0000,
-0xe9d1,0xf3a9,0xd0e0,0xe9d2,0x0000,0xdae3,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe2d2,0x0000,0xf6a2,0xe1f4,
-0x0000,0x0000,0x0000,0xdae4,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe7d5,0xf5bf,0xcfa2,0xcdaf,0xcfa3,0x0000,0x0000,
-0x0000,0xcdb0,0xf1fe,0xd0a3,0xe1af,0xf8a3,0x0000,0xcaa6,
-0xf7bb,0xf2ea,0xdec8,0xe9d3,0x0000,0x0000,0x0000,0x0000,
-0xdec9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x5400 */
-0x0000,0x0000,0x0000,0xfdde,0xcac0,0x0000,0x0000,0x0000,
-0xf9ea,0xd1ce,0xeed4,0x0000,0xd4d2,0xd9a3,0xfda8,0xd7d9,
-0xf7ce,0xfabe,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xcfd6,0x0000,0xd7f0,0x0000,0xebe1,
-0xf8c5,0x0000,0x0000,0x0000,0x0000,0x0000,0xdcfa,0x0000,
-0x0000,0xddc3,0x0000,0xf9df,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe7ef,0x0000,0x0000,0x0000,0x0000,
-0xfde5,0xf6a3,0x0000,0xd9fc,0xfda9,0x0000,0xe7ee,0x0000,
-0x0000,0x0000,0xd5e5,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xefd0,0x0000,0xcdb1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf7a2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf1b2,0x0000,0xf1b1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xcdb2,0x0000,0xdaab,0x0000,0xcaa7,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe3e2,0xfbbc,0xd9a4,0x0000,0x0000,
-0xeeba,0x0000,0x0000,0x0000,0x0000,0x0000,0xf8d3,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xfbfa,0x0000,0xcfa4,0x0000,
-0xdcfb,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf6e3,0x0000,0x0000,0x0000,
-0xedaa,0x0000,0x0000,0xf2a1,0xcee1,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xfaa6,0x0000,0x0000,0x0000,0x0000,
-0xf9e0,0x0000,0x0000,0x0000,0x0000,0xecd6,0x0000,0x0000,
-0xe4ee,0xf9a1,0x0000,0x0000,0xfbef,0x0000,0x0000,0x0000,
-0xf9eb,0xeea3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xeaac,0x0000,0x0000,0x0000,0xcaa8,0x0000,0x0000,
-0xf4fa,0x0000,0x0000,0x0000,0x0000,0xcdd6,0xfcf6,0x0000,
-0x0000,0x0000,0xf4c9,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf8d4,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x5500 */
-0x0000,0x0000,0x0000,0x0000,0xf8a6,0x0000,0xdeca,0xf2c6,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd7da,0x0000,
-0xd3d0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd8c5,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xeae6,
-0x0000,0xf3dd,0x0000,0x0000,0x0000,0xe4da,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf6e4,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf6f2,0x0000,0xdfc2,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd9fd,
-0x0000,0x0000,0x0000,0xccf6,0x0000,0x0000,0xd3ba,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe4af,0x0000,
-0x0000,0x0000,0x0000,0xf9e1,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf0a6,0x0000,0x0000,0x0000,
-0xcbd3,0x0000,0x0000,0x0000,0xe0bc,0x0000,0xf4ca,0xd4fa,
-0x0000,0xfdaa,0xf9e2,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf4b7,0xfdc2,0xfcb0,0x0000,0xfdec,0xcae2,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfdbd,
-0x0000,0xeae7,0xdfc3,0xd1d2,0xcee2,0x0000,0xd3a4,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xfdab,0x0000,0xdfe0,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf2c7,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe7f0,0x0000,0xd0ee,0x0000,0x0000,0xf3aa,
-0x0000,0x0000,0x0000,0xdecb,0xf6b8,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe1f5,0xf1b3,0x0000,
-/* 0x5600 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf7a3,0x0000,
-0x0000,0xcaa9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcfa5,0x0000,0x0000,0xdfc4,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe1b0,
-0x0000,0x0000,0xf0bf,0x0000,0xf6a4,0x0000,0xe3b6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xfac6,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd0ef,0x0000,0x0000,0xfded,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xddc4,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfcf7,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe6bf,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xdead,0x0000,0xfabf,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe5f1,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xedc4,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd2a5,0x0000,0x0000,0xfdee,0x0000,0x0000,
-0x0000,0xf5b6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe1f6,0xdecc,0x0000,0x0000,0xfcde,0x0000,
-0xecd7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcddd,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd6b7,0xcdb3,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x5700 */
-0x0000,0x0000,0x0000,0xf8d5,0xe5d8,0x0000,0x0000,0x0000,
-0xcfea,0x0000,0x0000,0xcfd0,0x0000,0xeacc,0x0000,0x0000,
-0x0000,0x0000,0xeaae,0xeaad,0x0000,0x0000,0xd3f1,0x0000,
-0xd3a5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf7cf,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xeea4,0x0000,0x0000,0x0000,0x0000,0xd0a4,0x0000,0x0000,
-0xf2a2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd0f0,0x0000,0x0000,0x0000,0x0000,
-0xf2a3,0x0000,0xf7f8,0x0000,0x0000,0x0000,0x0000,0xd0b3,
-0x0000,0x0000,0xdba9,0x0000,0x0000,0xd3bb,0xcaec,0x0000,
-0xf1a6,0xcbd5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf7e7,0x0000,0x0000,0xcdde,0x0000,0xf7a4,0x0000,
-0x0000,0x0000,0xf8c0,0x0000,0x0000,0x0000,0xd3dd,0x0000,
-0xccd0,0x0000,0x0000,0x0000,0x0000,0xcfa6,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf6f3,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe1f7,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd3dc,0x0000,0x0000,0xfafe,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xfaa7,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xebd9,0x0000,0xcfa7,0xeaaf,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe4ef,0x0000,0x0000,0x0000,0xe9b9,
-0xf1d8,0x0000,0x0000,0xd8d8,0x0000,0x0000,0xe0f2,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe6b4,
-0xdcfc,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf3f1,0x0000,0x0000,0x0000,0xe3d0,0x0000,0x0000,0xf2fb,
-0x0000,0xdbc6,0xd0f1,0x0000,0xd0f2,0x0000,0x0000,0x0000,
-0xcfdc,0x0000,0xd3d1,0x0000,0x0000,0xccb1,0xf7d8,0x0000,
-0xcba8,0xebbc,0xe4be,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf4dc,0x0000,
-0x0000,0xdcc2,0x0000,0x0000,0xf0a7,0x0000,0x0000,0xe6c0,
-0x0000,0x0000,0xcaed,0x0000,0x0000,0x0000,0x0000,0xe8eb,
-0xe5e8,0xdcc3,0x0000,0x0000,0xedde,0xd3f2,0x0000,0x0000,
-0x0000,0x0000,0xccf7,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xced4,0xe7ab,0x0000,0x0000,0x0000,0xcbc3,
-0x0000,0xe1b1,0x0000,0x0000,0xf7b2,0x0000,0x0000,0xd3f3,
-0xd3d2,0x0000,0xf5c0,0x0000,0x0000,0x0000,0xdfdd,0x0000,
-0x0000,0xeef3,0xe7f1,0x0000,0xfdb4,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf2c8,0x0000,0x0000,
-0x0000,0xf3d2,0x0000,0x0000,0xeef4,0x0000,0xe2d3,0x0000,
-0x0000,0x0000,0x0000,0xccd1,0x0000,0xdfea,0x0000,0x0000,
-0x0000,0xe9ba,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd9d7,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf5cd,0x0000,0xf1f2,0xfac7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd9f8,0xd4c2,0x0000,0x0000,0x0000,0x0000,0xf6e5,0x0000,
-0x0000,0x0000,0x0000,0xddc5,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe7f2,0xeddf,0x0000,0x0000,0xcacb,0x0000,
-0x0000,0xdbfa,0x0000,0x0000,0x0000,0xe8b5,0x0000,0xd3a6,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfdb5,0x0000,
-0x0000,0xf9c9,0x0000,0xe4e2,0x0000,0xfbbd,0x0000,0x0000,
-0xd7a4,0xcec5,0x0000,0x0000,0x0000,0x0000,0xced5,0xd6e6,
-0x0000,0x0000,0x0000,0x0000,0xe5bd,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xdecd,0xecf3,0x0000,0x0000,0xede0,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xecec,0xfbbe,0xdfeb,0x0000,0xe1f8,0x0000,0x0000,
-/* 0x5900 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf9be,
-0x0000,0x0000,0x0000,0x0000,0xd0f3,0xe0aa,0xe8e2,0x0000,
-0x0000,0xe2d4,0xd2fd,0x0000,0xe5a8,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd9d3,0x0000,0x0000,0x0000,0x0000,0xd3de,
-0x0000,0xf4b8,0xf7bc,0xdcfd,0x0000,0xe8ec,0xe4e7,0x0000,
-0x0000,0xe3f7,0x0000,0x0000,0x0000,0x0000,0x0000,0xeca8,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfaf1,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe5f2,0x0000,0x0000,0xd0f4,
-0xd2af,0xdce5,0x0000,0x0000,0x0000,0x0000,0xd0a5,0xf1b4,
-0xfcb1,0xccf8,0x0000,0x0000,0xddc6,0xfad1,0x0000,0xf7df,
-0x0000,0x0000,0xfaa8,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xeef5,0x0000,0xdece,0x0000,0x0000,0x0000,0x0000,0xe7f3,
-0x0000,0x0000,0xf7ac,0xebc4,0xede1,0xe0ab,0xddc7,0x0000,
-0x0000,0x0000,0x0000,0xd2b3,0xd2bf,0x0000,0x0000,0x0000,
-0xcacc,0x0000,0x0000,0x0000,0x0000,0xfbbf,0x0000,0x0000,
-0x0000,0x0000,0xe5fd,0xdde5,0xd8cd,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xecf4,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd0f5,0x0000,0x0000,0xe8ed,0xd0d2,
-0x0000,0xd9d8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf6e6,0x0000,0x0000,
-0xdbaa,0x0000,0x0000,0x0000,0xf7e0,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd8d9,0x0000,0xf4a3,0x0000,0x0000,0xf4dd,0x0000,
-0x0000,0x0000,0x0000,0xefd1,0x0000,0x0000,0xd9b5,0x0000,
-0x0000,0xedab,0x0000,0xe3b7,0x0000,0x0000,0x0000,0x0000,
-0xeebb,0xcdb4,0x0000,0xe0f3,0xeacd,0x0000,0x0000,0x0000,
-0x0000,0xecf5,0xe8ee,0x0000,0xcba9,0xf1af,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcacd,0x0000,
-0xeca9,0x0000,0xf2eb,0x0000,0xfdef,0x0000,0xf9f3,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe6c1,0x0000,0x0000,0xecd8,0x0000,0x0000,0x0000,0xedac,
-/* 0x5a00 */
-0x0000,0xeace,0x0000,0xe8df,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xdecf,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd2a6,0x0000,0x0000,0xe7f4,0xd1d6,0x0000,0x0000,0xe6c2,
-0xe3e3,0x0000,0x0000,0x0000,0x0000,0xe4b0,0x0000,0x0000,
-0x0000,0xd8b4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf6a5,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf3de,0x0000,0x0000,0x0000,
-0x0000,0xd7a5,0x0000,0x0000,0x0000,0x0000,0xf7e8,0x0000,
-0x0000,0xe8c6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xfbe6,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xdde6,0x0000,0x0000,0x0000,0xdcfe,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd8da,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xdaac,0xeab0,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe3b8,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xcaaa,0xe1f9,0x0000,0xeab1,0x0000,0x0000,0x0000,
-0x0000,0xf2ec,0x0000,0x0000,0xfaee,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xeed5,0x0000,0x0000,0x0000,0x0000,0xf9f4,0x0000,
-0x0000,0xd2ec,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x5b00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0xfbfb,0x0000,0x0000,
-0x0000,0xfdf0,0x0000,0xe0bd,0xcee3,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf8c6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xdeae,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xdfc5,0x0000,0x0000,0xe5be,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xedad,0xfaea,0x0000,0x0000,0xcdee,0xeda6,0x0000,0xedae,
-0xf0ed,0x0000,0xdda1,0x0000,0xedaf,0xfcf8,0x0000,0xd8eb,
-0x0000,0x0000,0x0000,0xccf9,0xcdb5,0x0000,0x0000,0x0000,
-0x0000,0xfaa9,0x0000,0xe1dd,0x0000,0x0000,0x0000,0x0000,
-0xe2d5,0xedcf,0x0000,0x0000,0x0000,0xdda2,0x0000,0x0000,
-0xf9ca,0x0000,0xeae8,0x0000,0xe5ed,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd3eb,0x0000,0xe9d4,
-0xe1fa,0xe4cc,0x0000,0xe1e4,0xe8c7,0x0000,0x0000,0xcedb,
-0x0000,0x0000,0x0000,0xdcd5,0x0000,0xf7b5,0xfcf3,0xf0f3,
-0xceaf,0xf1b5,0xefd2,0xe8c8,0xebf1,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xcbd4,0xe0be,0xe3f8,0xeae9,0xfcb2,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe0f4,0x0000,0xcfe0,0x0000,
-0xeea5,0x0000,0x0000,0xfaaa,0xe6c3,0xe1b2,0xcaab,0x0000,
-0xe3e4,0xe9bb,0x0000,0x0000,0x0000,0x0000,0x0000,0xe2d6,
-0xf3f2,0x0000,0xeed6,0xeab2,0xd0f6,0xecd9,0xdacb,0xcfa8,
-0x0000,0x0000,0x0000,0x0000,0xdda3,0x0000,0x0000,0x0000,
-0xd8db,0x0000,0xf9ce,0xe9d5,0xe3d1,0x0000,0x0000,0xd2bc,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd8ac,0xf3cc,
-0x0000,0xcdfb,0xf6d6,0x0000,0xe7f5,0xe8ef,0xe3f9,0xd2bb,
-0xf3f3,0xe3fb,0x0000,0xded0,0xceb0,0x0000,0xd6f7,0xf1d9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf5c1,0xdcc4,0x0000,
-0xf5bb,0x0000,0xded1,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x5c00 */
-0x0000,0xdce6,0x0000,0x0000,0xded2,0x0000,0x0000,0xede2,
-0xeef6,0xeacf,0xf0ee,0xe3fc,0x0000,0xd3df,0xd3f4,0xe1b3,
-0x0000,0xe1b4,0x0000,0x0000,0x0000,0x0000,0xf4d3,0x0000,
-0x0000,0xdfc6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe9d6,0x0000,0x0000,0x0000,
-0xdbab,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf6a6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe3b9,0xebc5,0xf4a9,0xcdb6,0xd2f9,0x0000,0xdaad,0xd2e3,
-0xcfd1,0x0000,0x0000,0x0000,0x0000,0xcbdc,0xccfa,0x0000,
-0xcfdd,0x0000,0x0000,0xe8a9,0x0000,0xe3bb,0xe3ba,0x0000,
-0x0000,0xe0da,0x0000,0x0000,0x0000,0xeef7,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xdcb3,0x0000,0x0000,0x0000,0x0000,
-0xd3f5,0x0000,0xd7a6,0x0000,0xf6b5,0xd7db,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe1d5,0x0000,0x0000,0xd4ea,
-0x0000,0xdfa3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xfddf,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd0f7,0xedd4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xcbaa,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe4db,0x0000,0xe1fb,0xcba2,0x0000,0x0000,0x0000,
-0x0000,0xd3e0,0x0000,0xe4bf,0x0000,0xfbc0,0x0000,0xdabe,
-0xe4cd,0x0000,0xd6b9,0x0000,0x0000,0x0000,0xefc0,0x0000,
-0xe1fc,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf6b9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xdfc7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe4b1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdce7,
-0xdce8,0x0000,0x0000,0x0000,0xfad6,0x0000,0xd3f6,0x0000,
-0x0000,0x0000,0x0000,0xf1da,0x0000,0xfaf2,0x0000,0x0000,
-/* 0x5d00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe2fd,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd5cf,0xd0f8,0x0000,
-0x0000,0xcddf,0x0000,0x0000,0xf5cb,0x0000,0xe4f0,0xcbab,
-0x0000,0xd7c4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe2fe,
-0x0000,0xddda,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xdaae,0xcaee,0x0000,0x0000,0x0000,
-0xd5b9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe3a1,0x0000,0x0000,0xe8e3,0x0000,0x0000,0xf3ab,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcfa9,
-0x0000,0x0000,0x0000,0xd3f7,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd4f1,0x0000,0x0000,
-0xcee4,0x0000,0xe8f2,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe5f5,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe7ae,0x0000,0xd6ba,0x0000,0xdfec,0xe4c0,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe8e4,0x0000,0x0000,
-0x0000,0x0000,0xd8b5,0x0000,0x0000,0x0000,0xe4dc,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf4b9,0xf1b6,0x0000,
-0x0000,0xe2de,0xe1b5,0x0000,0x0000,0xcdef,0xf1a7,0xcee5,
-0xcbdd,0x0000,0x0000,0xd9e3,0x0000,0x0000,0xf3ac,0x0000,
-0x0000,0xd0f9,0xecab,0xded3,0xf7e9,0x0000,0x0000,0xf9f5,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe1de,0xcbee,0x0000,
-/* 0x5e00 */
-0x0000,0x0000,0xe3bc,0xf8d6,0x0000,0x0000,0xdbee,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xfdf1,0x0000,0x0000,0x0000,
-0x0000,0xf7b6,0x0000,0x0000,0x0000,0x0000,0xf4de,0x0000,
-0x0000,0xf2ed,0x0000,0xdbd9,0x0000,0xf0a8,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe1fd,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xded4,0x0000,0xe0ac,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xede3,0x0000,0x0000,0xd3e1,0x0000,
-0xdfc8,0x0000,0x0000,0x0000,0x0000,0xd9b6,0x0000,0xfdac,
-0xefd3,0x0000,0x0000,0x0000,0xe4c1,0xf8eb,0x0000,0xdbac,
-0x0000,0x0000,0x0000,0x0000,0xfcc6,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd8ad,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf6ba,
-0x0000,0xdbdf,0xd3d3,0xf8c7,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xcace,0xf8c1,0xd2b4,0x0000,0x0000,0xdcb4,
-0xfab9,0xcacf,0x0000,0xfcb3,0xeaea,0xeaeb,0xd0fa,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xede4,0x0000,0x0000,0xdde7,
-0x0000,0x0000,0xdfc9,0x0000,0x0000,0x0000,0x0000,0xdfed,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xeebc,0x0000,0xefc1,
-0x0000,0x0000,0xccd2,0x0000,0xdda4,0x0000,0x0000,0x0000,
-0xdfca,0x0000,0x0000,0x0000,0x0000,0x0000,0xd3f8,0xf1a8,
-0x0000,0x0000,0x0000,0xcdb7,0x0000,0xefd4,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe4dd,0xdfee,0xcbac,
-0xe9bc,0x0000,0x0000,0x0000,0x0000,0x0000,0xeaec,0x0000,
-0x0000,0x0000,0xdfcb,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf9bf,0xd6af,0xd5c6,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcfaa,0x0000,0x0000,0xcea9,0x0000,0x0000,0xd6f8,0x0000,
-0x0000,0x0000,0xf1b7,0xeef8,0x0000,0x0000,0x0000,0xd9d9,
-0xf3df,0x0000,0xf8c8,0xcec6,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd5e6,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf4e6,0x0000,0x0000,0xe6c5,0xefd5,
-0x0000,0x0000,0xcbef,0xfcdf,0x0000,0x0000,0x0000,0x0000,
-/* 0x5f00 */
-0x0000,0xdca7,0x0000,0x0000,0xd6e7,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf8c9,0x0000,0x0000,0x0000,0x0000,0xe3d2,
-0x0000,0xe3bd,0x0000,0xcfe1,0xf0c0,0xecda,0x0000,0xddd7,
-0xfbf0,0x0000,0x0000,0xecac,0x0000,0x0000,0x0000,0xf0a9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfad7,0xfbc1,
-0x0000,0xd2c0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe5b0,0x0000,0x0000,0x0000,0xede5,0x0000,0x0000,
-0x0000,0x0000,0xcbad,0x0000,0xf9b0,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf7a5,0x0000,0xcbae,0x0000,0xdaaf,0x0000,0xd8b6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd3a7,0xfbb2,
-0x0000,0xfdc4,0x0000,0xecad,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xfba1,0x0000,0x0000,0x0000,0xe5e9,0xe9ee,
-0x0000,0xf3f4,0xf8f3,0xf0c1,0xdeaf,0xf8b0,0x0000,0x0000,
-0xf3e0,0xe7af,0x0000,0x0000,0x0000,0x0000,0x0000,0xdbad,
-0x0000,0xe6b5,0x0000,0x0000,0xf9a8,0x0000,0x0000,0xddd8,
-0xe8d9,0xefd6,0x0000,0x0000,0x0000,0xd3e2,0x0000,0xe2df,
-0x0000,0x0000,0xfce0,0xd7c8,0xfdad,0x0000,0x0000,0x0000,
-0xdfef,0xccd3,0xd3f9,0x0000,0x0000,0x0000,0x0000,0xd4f0,
-0xdbc7,0xded5,0x0000,0x0000,0x0000,0x0000,0xf0f4,0x0000,
-0xd5d0,0xe5d9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xfcc7,0xdcd6,0xe2e0,0x0000,0x0000,0x0000,0xdab0,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf3a3,0x0000,0xd3ec,
-0x0000,0xf4cb,0x0000,0x0000,0x0000,0xfdc5,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe3fd,0x0000,0xf9b1,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd0fb,0xecdb,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf5bc,0xf2a4,
-0xd8ce,0xd8cf,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf5f7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf6e1,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd2b7,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xfbec,0x0000,0xddc8,
-/* 0x6000 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe4e8,
-0x0000,0x0000,0xd2c1,0x0000,0x0000,0x0000,0xf8d7,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd6bb,0xded6,0x0000,0x0000,
-0xf7bd,0xecae,0x0000,0x0000,0x0000,0xd0e1,0x0000,0xe0f5,
-0xeab3,0x0000,0xced6,0x0000,0x0000,0x0000,0x0000,0xcca5,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xecf6,0xe2e1,0xe3be,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xfcc8,0x0000,0x0000,
-0xcdf0,0x0000,0xf9f6,0x0000,0x0000,0xdff0,0x0000,0x0000,
-0x0000,0xe5bf,0x0000,0x0000,0x0000,0xcebf,0x0000,0x0000,
-0x0000,0x0000,0xfce1,0xedb0,0xfdd1,0xf6bb,0x0000,0x0000,
-0xf9cf,0xebda,0xcac1,0x0000,0xd2b8,0xcdf1,0x0000,0xe3d3,
-0xfde6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe6ed,0x0000,0x0000,
-0x0000,0xe3fa,0x0000,0x0000,0xf0aa,0xf9d0,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xfce2,0x0000,0xf8a7,0x0000,
-0x0000,0x0000,0xe1e5,0xeef9,0x0000,0x0000,0x0000,0xe7f6,
-0xeaed,0x0000,0x0000,0xfcb4,0xf5c2,0x0000,0x0000,0xd7dc,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf0f5,0x0000,0xdde8,0xd3ed,0xf5fc,0x0000,0xdabf,0x0000,
-0xccfb,0x0000,0x0000,0x0000,0xd3fa,0xf4a4,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xefd7,0x0000,0xd4c3,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xfbe3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xfbed,0x0000,0xe0ad,0x0000,0x0000,0xeaee,
-0xfbb3,0xe4c2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf6e7,0xd2dd,0x0000,0xdfcc,0x0000,0x0000,0xfcc9,0x0000,
-0x0000,0xe5a9,0xe0f6,0xf6b3,0x0000,0x0000,0x0000,0x0000,
-/* 0x6100 */
-0x0000,0xe1fe,0x0000,0x0000,0x0000,0x0000,0xcbf0,0x0000,
-0xeaef,0xeaf0,0x0000,0x0000,0x0000,0xdac0,0xf8b4,0xebf2,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe4c3,0x0000,0x0000,
-0x0000,0x0000,0xe9d7,0xe4f1,0x0000,0x0000,0x0000,0xcaef,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xced7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xfcca,0x0000,0x0000,0x0000,0xf3e1,0x0000,0x0000,0xcbc4,
-0x0000,0x0000,0x0000,0x0000,0xe3e5,0x0000,0xcbc5,0xeab4,
-0x0000,0x0000,0xe9bd,0x0000,0xd7c9,0x0000,0x0000,0xebdb,
-0xedb1,0x0000,0xccc3,0xf7be,0xfccb,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf8f4,0x0000,0xd9b7,0x0000,0x0000,
-0xf3d3,0xf3d4,0x0000,0x0000,0x0000,0xf7e4,0x0000,0xf7d1,
-0x0000,0x0000,0xd8b7,0xceb1,0xcac2,0x0000,0x0000,0xfbb4,
-0xcbc6,0x0000,0x0000,0xf0f6,0x0000,0x0000,0xd5e7,0x0000,
-0xead0,0x0000,0x0000,0x0000,0x0000,0x0000,0xccd4,0xcbaf,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf4aa,0xe9af,0x0000,
-0x0000,0xf5c3,0xe9d8,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xdde9,0x0000,0x0000,0x0000,0xf1f3,0x0000,
-0xd5fb,0xdebb,0x0000,0x0000,0xf4fb,0x0000,0x0000,0x0000,
-0xfdf3,0xfdf2,0xf7a6,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xddc9,0x0000,0x0000,0xd4d3,
-0x0000,0xcca8,0x0000,0xdac1,0xccd5,0x0000,0xd9e4,0x0000,
-0x0000,0x0000,0xfaca,0x0000,0x0000,0x0000,0xe5e3,0x0000,
-0x0000,0x0000,0xd3bc,0x0000,0x0000,0x0000,0xcaf0,0x0000,
-0x0000,0x0000,0x0000,0xd0c4,0x0000,0x0000,0x0000,0xcad0,
-0xfaab,0xebeb,0xe7f8,0xd9e5,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd1d7,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf3a4,0x0000,0x0000,0x0000,0xd4fb,0xfce3,
-0xfad8,0x0000,0xf3d5,0x0000,0xcfab,0x0000,0x0000,0xebf3,
-0xd5fc,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd3d4,
-0xcdfc,0x0000,0xd9e6,0x0000,0xe2f9,0xe2a1,0xebd4,0x0000,
-0xe0f7,0xe4b2,0xccfc,0x0000,0x0000,0x0000,0xfbe4,0x0000,
-0x0000,0x0000,0xf4ab,0x0000,0x0000,0x0000,0x0000,0xd0bd,
-0x0000,0xcaf1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xefb8,0x0000,0x0000,0x0000,0xd7c0,0x0000,
-0xeefa,0xfdf4,0x0000,0x0000,0xd3e3,0x0000,0xfbc2,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd5e8,0xdbae,
-0xe1b6,0xf8b7,0x0000,0x0000,0x0000,0x0000,0x0000,0xe0bf,
-0xfbc3,0xddea,0x0000,0xe2a2,0x0000,0xeea6,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf6e8,0x0000,0x0000,0x0000,0x0000,
-0xf6f5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xddca,0x0000,
-0x0000,0xd0e2,0x0000,0x0000,0x0000,0x0000,0xdda6,0x0000,
-0x0000,0xddeb,0x0000,0x0000,0xe4f9,0x0000,0x0000,0xe3af,
-0xd0fc,0x0000,0x0000,0x0000,0xf4fc,0x0000,0x0000,0x0000,
-0x0000,0xccbc,0xf7ea,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe5e4,0xdff1,0x0000,0x0000,0xf7e1,0x0000,0xf9f7,
-0xefb9,0x0000,0x0000,0xf8d8,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf9a9,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf8d9,0x0000,0x0000,0x0000,0xeebd,0x0000,0x0000,
-0x0000,0xd8c6,0x0000,0x0000,0xe4e3,0xf5ce,0x0000,0x0000,
-0x0000,0x0000,0xddd9,0x0000,0x0000,0x0000,0x0000,0xd9e7,
-0xd2b9,0xd5c3,0x0000,0x0000,0xdae5,0xdad0,0x0000,0xd1d9,
-0xced8,0x0000,0xcbde,0xf4ac,0xdafb,0x0000,0xf6e9,0xe8f3,
-0xcfac,0xf0f0,0x0000,0xf4fd,0xdbc8,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcec0,0xe3d4,0xd1cf,0xf1f5,
-0x0000,0xcdf2,0x0000,0xcfeb,0x0000,0x0000,0x0000,0xcdb8,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe3a6,0xd1da,
-/* 0x6300 */
-0x0000,0xf2a5,0x0000,0x0000,0x0000,0x0000,0x0000,0xf2a6,
-0x0000,0xe4ce,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd3fb,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf1a9,0x0000,0x0000,0x0000,0xf2c9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xefd8,0xe6c9,0x0000,0xd8b8,0xfaf3,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf3b5,0x0000,0x0000,0xf8a4,0x0000,0x0000,0xd1f3,
-0xe6c8,0x0000,0x0000,0x0000,0x0000,0xf8da,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdce9,
-0xded7,0x0000,0x0000,0x0000,0x0000,0x0000,0xcbdf,0x0000,
-0x0000,0x0000,0xcfec,0x0000,0x0000,0x0000,0x0000,0xf4df,
-0x0000,0x0000,0xd1f4,0xd2ba,0x0000,0x0000,0x0000,0xdff2,
-0x0000,0x0000,0x0000,0xe1b7,0x0000,0x0000,0x0000,0x0000,
-0xe2a3,0xd3fc,0x0000,0x0000,0xede6,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xdbc9,0x0000,0x0000,0x0000,0xe4fa,0x0000,
-0xcfde,0x0000,0x0000,0xced0,0x0000,0x0000,0x0000,0x0000,
-0xd5d3,0xf3f5,0xf7ae,0x0000,0x0000,0xefc8,0x0000,0xcdf3,
-0xf5cf,0xe5f3,0xf0c2,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcad1,0x0000,0x0000,0x0000,0xeaf1,0x0000,0xd0a6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd9da,
-0xf0ab,0x0000,0x0000,0x0000,0x0000,0x0000,0xebe7,0x0000,
-0x0000,0x0000,0xe5c0,0xfcb5,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe4c4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xcca9,0xfdc6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xeab5,0x0000,0xe5aa,0xdfba,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x6400 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe1df,0x0000,0xdad1,
-0x0000,0x0000,0x0000,0x0000,0xe1b8,0x0000,0xe8f4,0xd3fd,
-0x0000,0x0000,0x0000,0x0000,0xe2a4,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf2ca,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xdae6,0xf7b3,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xfdcd,0x0000,0x0000,0x0000,0xf3b6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xeed7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf5c4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd8a4,0x0000,0x0000,0x0000,0x0000,0x0000,0xf2a7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd9b8,0xd9b9,0xefc9,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd6ce,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf7cb,0xdfae,0xe8f5,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd2b5,0x0000,0x0000,0x0000,0xd3d5,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf4cc,0xdafc,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd9e8,0x0000,0xf7eb,0xf5c9,0x0000,
-0xf3bc,0x0000,0xdad2,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd3b5,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe8b6,0x0000,0x0000,0xd6cf,0xf4ba,0x0000,0xf7c9,
-0x0000,0x0000,0xccaa,0x0000,0x0000,0xf0c3,0xccd6,0x0000,
-0x0000,0x0000,0xd0d3,0x0000,0xd3bd,0x0000,0x0000,0x0000,
-0xdbfb,0x0000,0xcbe0,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd3e4,0xf6f7,0x0000,0x0000,0xd5ba,0xf3cd,0xcbe1,
-0x0000,0x0000,0x0000,0x0000,0xebf4,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf4ad,0x0000,0xfcaa,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf7ec,0x0000,0x0000,0x0000,0xe8f6,0x0000,
-0xdae7,0x0000,0x0000,0x0000,0xf7cc,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe5c1,0x0000,0x0000,0x0000,0x0000,0xe0ee,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd5fd,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xcee6,0xfcab,0xd5bb,0x0000,0x0000,0xf2a8,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe2a5,0xcdb9,
-0xeaf2,0xcbc7,0x0000,0xcdf4,0x0000,0x0000,0xdbaf,0xefd9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xcdba,0x0000,0x0000,
-0xfcf9,0x0000,0x0000,0x0000,0x0000,0xdff3,0xcee7,0xdac2,
-0x0000,0xcfad,0x0000,0x0000,0x0000,0x0000,0xe7f9,0xf8a8,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf3e2,0x0000,
-0x0000,0x0000,0xcaf2,0xdfa4,0x0000,0x0000,0xd4c4,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xccd7,0xe5c2,0x0000,0x0000,
-0x0000,0x0000,0xcdbb,0x0000,0xefda,0xeed8,0x0000,0xdda7,
-0xe2a6,0x0000,0x0000,0x0000,0x0000,0x0000,0xe0c0,0x0000,
-0x0000,0x0000,0xd6b0,0xf8ca,0x0000,0xfcfa,0x0000,0xd9fe,
-0x0000,0x0000,0x0000,0x0000,0xdeb0,0x0000,0x0000,0x0000,
-0xddec,0xdae8,0x0000,0x0000,0x0000,0x0000,0x0000,0xd4e0,
-0x0000,0xd6f9,0x0000,0xcdd7,0xded8,0x0000,0x0000,0xf2f8,
-0x0000,0xe4d6,0x0000,0x0000,0xd0c5,0xf4ae,0x0000,0xdda8,
-0x0000,0x0000,0x0000,0xedc5,0xf3d6,0x0000,0x0000,0xded9,
-0xe3e6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd3a8,
-0x0000,0xdbb0,0x0000,0x0000,0xe5da,0xe3bf,0x0000,0x0000,
-0x0000,0xdbb1,0x0000,0x0000,0x0000,0xd5e9,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe0c1,0xefdb,0x0000,0x0000,0xf0e9,
-0x0000,0x0000,0xd7b2,0x0000,0x0000,0x0000,0x0000,0xd0fd,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd9e9,0x0000,0x0000,0xd0fe,0x0000,0xeced,0xd3a9,0x0000,
-0xf2a9,0xf0c4,0x0000,0x0000,0xe2e2,0xe9ef,0x0000,0x0000,
-0x0000,0xf9d1,0x0000,0x0000,0xe9d9,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe8da,0xdac3,0xdac4,0xd4c5,0x0000,0xe7fa,
-/* 0x6600 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcde0,0xe3b0,
-0x0000,0xdbb2,0xfbc4,0x0000,0xf3e3,0x0000,0xd9a5,0xfbe7,
-0xddcb,0xd0d4,0x0000,0xe6b6,0xe0ae,0xfdda,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdcb5,0xe0f8,
-0xe7b1,0x0000,0x0000,0x0000,0x0000,0xf5f0,0x0000,0xd8dc,
-0xedc6,0x0000,0x0000,0x0000,0x0000,0xe1b9,0x0000,0xe3c0,
-0xf9c0,0xe9f0,0x0000,0x0000,0xd9db,0x0000,0xf3e4,0x0000,
-0x0000,0x0000,0xdcb6,0xe4e9,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf0c5,0xe3c1,0xfccc,0xfccd,0x0000,0x0000,0x0000,
-0x0000,0xf2cb,0x0000,0xf2cc,0x0000,0x0000,0x0000,0xe4cf,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf1db,0x0000,0xfad9,0x0000,0xf1b8,0xfdf5,0xe0f9,
-0x0000,0x0000,0x0000,0x0000,0xe7fb,0xfcb7,0xfce4,0xfbc5,
-0xe3e7,0xd8b9,0x0000,0xf6f8,0x0000,0x0000,0xdcc5,0xccd8,
-0x0000,0x0000,0x0000,0xe0af,0xf4e7,0x0000,0xefdc,0xcffc,
-0xefdd,0x0000,0xf2aa,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xfdbe,0x0000,0x0000,0xcaac,
-0xfdbb,0xfdc7,0x0000,0x0000,0x0000,0x0000,0xe7b2,0x0000,
-0xead1,0xdff4,0x0000,0x0000,0x0000,0x0000,0xd1ec,0xe4de,
-0xe5c3,0x0000,0x0000,0x0000,0x0000,0xd9a6,0x0000,0x0000,
-0xcdbc,0x0000,0xf3e5,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xedd5,0x0000,0x0000,0xd9ba,0x0000,
-0x0000,0x0000,0xede7,0xfbb5,0xf8ec,0x0000,0x0000,0x0000,
-0x0000,0xe0e7,0x0000,0xccd9,0x0000,0x0000,0xd4c6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe7a5,0x0000,0xd5f5,0xd3be,
-0x0000,0xfcfb,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe4f2,0x0000,
-0x0000,0xdff5,0x0000,0x0000,0xe8f8,0xf8ed,0x0000,0x0000,
-0xcec7,0x0000,0x0000,0x0000,0x0000,0x0000,0xfdf6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe8d8,0x0000,0xcdd8,0xe7d6,0xccda,0x0000,0x0000,0xcae3,
-0xdff6,0xf0c7,0xf0c6,0x0000,0xd8ba,0x0000,0xf1f4,0xf4f0,
-0xf5cc,0x0000,0x0000,0xfce5,0x0000,0x0000,0x0000,0x0000,
-0xeac5,0xeaf3,0x0000,0xdddb,0x0000,0xdcd7,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xdefd,0xf2f9,0x0000,0xd5c7,
-0x0000,0x0000,0x0000,0xd8d0,0x0000,0xf0c8,0xd1a1,0xd1a2,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd9d4,0xd6e8,
-0xd9ca,0x0000,0xdab1,0xd8c7,0xdce2,0xf3ce,0xf5f4,0x0000,
-0x0000,0xf1b9,0x0000,0x0000,0xdad3,0x0000,0xf6ea,0x0000,
-0x0000,0x0000,0xcff5,0x0000,0x0000,0xfdae,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcad2,0x0000,
-0x0000,0xdfb4,0x0000,0x0000,0x0000,0x0000,0xd7dd,0xfaba,
-0xeea7,0xf5bd,0x0000,0xf8f5,0x0000,0x0000,0xede8,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd4e1,0x0000,0xd1a3,0xe1d6,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf9f8,0x0000,0xdbca,
-0xcbf9,0xd4d4,0x0000,0xd9dc,0x0000,0xeebe,0x0000,0xf7ed,
-0x0000,0x0000,0x0000,0xd2ee,0x0000,0x0000,0xe1e6,0xf7f9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdded,
-0x0000,0xe8db,0x0000,0xdbb3,0x0000,0x0000,0x0000,0xd1f7,
-0xe0b0,0x0000,0x0000,0xd4e2,0x0000,0xf6d7,0x0000,0xd7f9,
-0x0000,0x0000,0xd8dd,0x0000,0xcdfd,0xf2ab,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcdbd,
-0xf8c2,0x0000,0x0000,0xf2ac,0x0000,0x0000,0xcaad,0xcaae,
-0xcfae,0x0000,0x0000,0x0000,0x0000,0x0000,0xe3c2,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xdcb7,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdbda,
-0xd9bb,0xcaf3,0xf6d3,0xe6f8,0xeaf5,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xeaf6,0x0000,0x0000,0xf6f9,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xcfaf,0x0000,0x0000,0xcad3,0x0000,0x0000,0xcaaf,
-0xd2b0,0xf1ba,0x0000,0xd7b3,0xe3c3,0xf3fd,0xdeda,0x0000,
-0x0000,0x0000,0x0000,0xdedb,0x0000,0x0000,0xefde,0x0000,
-/* 0x6800 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe2e3,0xeefb,0x0000,0x0000,0xdff7,0xd7ca,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xcee8,0xdbdb,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf1bb,0x0000,0x0000,0x0000,0x0000,0xe9f1,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xfab7,0xd0c6,0x0000,0x0000,0xccab,0xeea8,0x0000,0x0000,
-0xcbfa,0xf9f9,0xccfd,0xd3fe,0x0000,0x0000,0x0000,0x0000,
-0xe4d0,0x0000,0x0000,0x0000,0x0000,0x0000,0xf2ee,0x0000,
-0xd4d5,0xdfcd,0x0000,0xfcb8,0xd1d0,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf2cd,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf7d2,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcad4,
-0x0000,0xd5d9,0x0000,0x0000,0x0000,0xd8de,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcdd9,
-0x0000,0x0000,0x0000,0xeea9,0xf6bc,0x0000,0x0000,0xccdb,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf0c9,0x0000,0xfcfc,
-0x0000,0xe8c9,0xf4fe,0x0000,0x0000,0x0000,0x0000,0xe7fc,
-0xd7de,0x0000,0x0000,0x0000,0x0000,0xdedc,0x0000,0xf0ac,
-0xccfe,0xcde1,0x0000,0xe1ba,0x0000,0xdbef,0xdab2,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd1a5,0xdcb8,0x0000,0x0000,
-0x0000,0xd8f6,0x0000,0xd1a4,0x0000,0xcde2,0x0000,0x0000,
-0x0000,0x0000,0xdcea,0x0000,0x0000,0xf0f7,0x0000,0xf0ca,
-0xd0be,0x0000,0xdddc,0x0000,0x0000,0x0000,0x0000,0xd4d6,
-0xd3d6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xedd0,
-0xcda1,0x0000,0x0000,0x0000,0x0000,0x0000,0xdfb5,0x0000,
-0x0000,0x0000,0xdff8,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd4a1,0xceb2,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe8ca,0x0000,0x0000,0x0000,0x0000,0xebf5,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe3d5,0xf5d0,0x0000,
-0x0000,0x0000,0xf5a1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd9a7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe5ab,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe6cb,0x0000,0xf5f1,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe5c5,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf9a3,0xe0db,0xf6eb,0x0000,0xcbf1,
-0x0000,0xd9ea,0xf5a2,0x0000,0x0000,0x0000,0xd7d1,0x0000,
-0xd1f8,0xeaf8,0xeaf9,0xdab3,0x0000,0x0000,0x0000,0x0000,
-0xefdf,0x0000,0x0000,0xf1ef,0x0000,0xe5f6,0xeebf,0xe2e4,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd0bf,0x0000,0xfaac,
-0xf5d1,0xe7b3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe9be,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf2ce,0xdbb4,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xfcce,0x0000,0xddee,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe7b4,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd7b4,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf7b4,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xcdbe,0x0000,0xdae9,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xcfb0,0xf7d9,0xf3e6,0x0000,0x0000,
-0xced9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xceaa,0x0000,0xcbc8,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd0a7,0x0000,0xf0cb,0x0000,0xd0c7,
-/* 0x6a00 */
-0x0000,0x0000,0xe4c5,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xdbe0,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd5da,0x0000,0xd7a7,0x0000,0x0000,0x0000,0xeec0,
-0x0000,0xf8f6,0x0000,0x0000,0x0000,0x0000,0xf5d2,0xede9,
-0x0000,0xd9bc,0x0000,0xe5c6,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf5a3,0x0000,0x0000,
-0xdad4,0xe2a7,0xfbfc,0x0000,0x0000,0xf1dc,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcaf4,0x0000,0x0000,0x0000,
-0xe8fa,0x0000,0x0000,0xcee9,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe9f8,0xe2e5,0x0000,0x0000,0x0000,0x0000,
-0xd0b9,0xd4f2,0x0000,0x0000,0x0000,0x0000,0x0000,0xd1a6,
-0x0000,0xdfce,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xfcf4,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd3aa,0x0000,0x0000,0x0000,0xccac,0x0000,0x0000,0x0000,
-0x0000,0xefe0,0x0000,0x0000,0x0000,0xe5e5,0xd0d5,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdbfc,
-0x0000,0x0000,0x0000,0x0000,0xfce6,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xcbfe,0xedea,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xdeb1,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf9e3,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd4a2,0xcff6,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd6d0,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd5ea,0xf1ee,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfacb,0x0000,
-0x0000,0x0000,0x0000,0xe5a1,0x0000,0x0000,0x0000,0x0000,
-/* 0x6b00 */
-0x0000,0x0000,0x0000,0x0000,0xd5b1,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xcfed,0x0000,0xedeb,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd5b2,0x0000,0x0000,0x0000,0xd5bc,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xfde2,0xf3ad,0x0000,0xfddb,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe9b0,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd1a7,0x0000,0x0000,0xfde3,0xceb3,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfde4,0xface,
-0x0000,0x0000,0x0000,0x0000,0xcab0,0x0000,0xf7a7,0x0000,
-0xcfb1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe6a2,
-0x0000,0xfcb6,0xf2ad,0xefe1,0xf3ae,0xdcc6,0xd9eb,0x0000,
-0x0000,0x0000,0xe8e0,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe1a8,0x0000,0x0000,0x0000,0x0000,0xd5f6,
-0xcffd,0x0000,0x0000,0xdedd,0x0000,0x0000,0x0000,0xd9d1,
-0x0000,0x0000,0x0000,0xe4ea,0xf2cf,0x0000,0xf7bf,0x0000,
-0x0000,0xe2e6,0xe2a8,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe3d6,0x0000,
-0xedd1,0x0000,0x0000,0x0000,0x0000,0x0000,0xe9f9,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd6b1,0xdeb2,
-0x0000,0x0000,0xe0e8,0x0000,0x0000,0xd3ab,0x0000,0xebdc,
-0x0000,0x0000,0xdfaf,0x0000,0xcac3,0x0000,0x0000,0xeefc,
-0x0000,0xfdc3,0x0000,0x0000,0x0000,0xebf6,0xcfb2,0x0000,
-0x0000,0x0000,0x0000,0xd9ec,0x0000,0xd9bd,0x0000,0xd8df,
-0x0000,0x0000,0xd4b8,0xebbe,0xddef,0x0000,0xddf0,0xddf1,
-0xddf2,0x0000,0x0000,0xd9be,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xfbc6,0xcfb3,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x6c00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xeefd,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe4ab,
-0x0000,0xdac5,0x0000,0xd8ec,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd1a8,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe2a9,0x0000,0x0000,0xdebc,
-0xe7b5,0x0000,0x0000,0x0000,0x0000,0x0000,0xdbf0,0x0000,
-0xefe2,0xf1f0,0xcfb4,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdbf1,0x0000,
-0xe0b1,0x0000,0x0000,0x0000,0x0000,0xdfa5,0x0000,0xf9d2,
-0x0000,0x0000,0xe7fd,0x0000,0x0000,0xe6a3,0xfbf1,0xcbb0,
-0xf2ae,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcde7,0x0000,0xe8dc,0x0000,0x0000,0xe7d7,0x0000,0x0000,
-0xf7c0,0x0000,0xd0e3,0x0000,0x0000,0x0000,0xdaa1,0x0000,
-0x0000,0x0000,0xccbd,0x0000,0x0000,0xd1a9,0xddcc,0x0000,
-0x0000,0xe3fe,0xd1aa,0xe8aa,0x0000,0xeab6,0xf9fa,0xe6cc,
-0xf6d8,0x0000,0x0000,0x0000,0xd4c7,0x0000,0x0000,0x0000,
-0xd9cb,0x0000,0xd9d2,0xd3cb,0xd8f7,0xdaa9,0xf5f8,0x0000,
-0x0000,0xdede,0xf2af,0xf8a9,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd8c8,0x0000,0x0000,0xeec1,0x0000,
-0x0000,0x0000,0x0000,0xf9c1,0x0000,0x0000,0x0000,0x0000,
-0xddf3,0xeafa,0x0000,0xf6bd,0xe1bb,0xcdbf,0xf4d4,0xe6cd,
-0x0000,0xfccf,0xfba2,0x0000,0xe0dc,0x0000,0x0000,0x0000,
-0x0000,0xf4bb,0xdad5,0x0000,0xf9b2,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xfbf2,0x0000,0xdbf6,0x0000,0xdedf,
-0x0000,0x0000,0x0000,0xdbf2,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf8dc,0xf7ee,0xebe8,0x0000,0xd2fa,0x0000,0x0000,
-0xf1bc,0x0000,0x0000,0xfada,0x0000,0x0000,0xdaea,0xdac6,
-0xf7c1,0x0000,0x0000,0xe7b6,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x6d00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe5c7,0xd6ac,0x0000,0x0000,0x0000,
-0x0000,0xdcc7,0x0000,0x0000,0x0000,0x0000,0x0000,0xe1a9,
-0x0000,0xe2aa,0x0000,0xd5a6,0x0000,0x0000,0xd4d7,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf2d0,0x0000,0xeafb,
-0x0000,0xe0dd,0xfbf3,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf1bd,0x0000,0x0000,0xe2e7,0xfdd7,0x0000,
-0xcec8,0xeab7,0x0000,0xfcc0,0x0000,0xfde7,0xf7ef,0x0000,
-0x0000,0xd7b5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xefba,0xf1dd,0x0000,0xdeb3,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe8cb,0x0000,0x0000,0xf8dd,0x0000,
-0x0000,0xfbc7,0xd5c8,0x0000,0xd7df,0x0000,0xdda9,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe9b1,0x0000,0x0000,0xfaad,
-0xf6d9,0xfaf4,0x0000,0x0000,0x0000,0x0000,0x0000,0xf8aa,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe6ee,0x0000,0xccdc,
-0xe1bc,0xe0ef,0x0000,0x0000,0xe9bf,0xfcfd,0xe6ce,0x0000,
-0x0000,0xe1d7,0x0000,0xe6cf,0x0000,0xf4f1,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe4f3,
-0x0000,0x0000,0xe4fb,0x0000,0x0000,0xf9e4,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xefe3,0x0000,0x0000,0xcfee,0xf6be,0xe0b2,0xfcfe,0xd1ab,
-0x0000,0x0000,0x0000,0xd7fa,0x0000,0x0000,0x0000,0xfbc8,
-0x0000,0xe2d7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd4a3,0xf0f8,0xd7a8,0x0000,0x0000,0x0000,0xe1e7,0x0000,
-0x0000,0xd3bf,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xefe4,0x0000,0xd7c5,0xebe2,0x0000,0x0000,0xfce7,0x0000,
-0x0000,0xe4a2,0x0000,0xe2e8,0x0000,0xe6d0,0x0000,0xfbe8,
-0xf4e8,0xe5f4,0xf4bc,0xf4d5,0x0000,0x0000,0x0000,0x0000,
-/* 0x6e00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdfb6,
-0x0000,0xfcb9,0xeec2,0xcaf5,0x0000,0x0000,0x0000,0xefe5,
-0xcbe2,0xd4a4,0x0000,0xdee0,0xdafd,0xe4c6,0xe8be,0x0000,
-0x0000,0x0000,0x0000,0xe0de,0xf6b4,0xead2,0x0000,0xf9fb,
-0x0000,0x0000,0xe0c2,0x0000,0xcae4,0x0000,0xe7b7,0x0000,
-0xeafd,0x0000,0xd9dd,0x0000,0xdab4,0xeeaa,0xfbe9,0x0000,
-0x0000,0x0000,0x0000,0xdbcb,0xdab5,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf1be,0x0000,0x0000,0xd3ac,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfbc9,0x0000,
-0xdfcf,0x0000,0x0000,0xd3c0,0xe3d7,0x0000,0xefe6,0xfcd0,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe9c0,
-0x0000,0x0000,0x0000,0xf5d3,0x0000,0x0000,0xecdc,0xf7b7,
-0x0000,0x0000,0xeab8,0xd1f9,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xdcc8,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xeab9,0x0000,0x0000,0x0000,0x0000,0x0000,0xf1de,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd7b6,0xcfb5,0x0000,0xd9a8,
-0x0000,0x0000,0xecee,0x0000,0x0000,0xddaa,0x0000,0x0000,
-0x0000,0x0000,0xcda2,0xe8ae,0x0000,0x0000,0x0000,0xe1bd,
-0x0000,0xf2d1,0x0000,0x0000,0x0000,0x0000,0xe9c1,0x0000,
-0x0000,0x0000,0xd2fc,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xdbb5,0x0000,0xf3e7,0xd8fe,0x0000,0x0000,
-0x0000,0xfcd1,0x0000,0xedb2,0xf4af,0x0000,0xfba3,0x0000,
-0x0000,0xfcc1,0x0000,0xeeab,0xd4a5,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf4f2,
-0x0000,0x0000,0x0000,0x0000,0xeed9,0x0000,0x0000,0x0000,
-0xfbca,0x0000,0x0000,0x0000,0x0000,0x0000,0xcde3,0xd8bb,
-/* 0x6f00 */
-0x0000,0xe5db,0xf8f7,0x0000,0x0000,0x0000,0xf6d4,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd7a9,
-0x0000,0xcbc9,0x0000,0x0000,0xe6d1,0xf0cc,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd8ae,0x0000,0xf9d3,0xd5fe,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd8bc,0xf2b0,0x0000,0x0000,0x0000,
-0x0000,0xe2ab,0xf3e8,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xefc2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xedec,
-0x0000,0xe7b8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xdafe,0x0000,0x0000,0xccbe,0x0000,0x0000,0xf2fc,
-0xdaeb,0x0000,0xe2d8,0xedd6,0x0000,0x0000,0xd6d1,0xe0b3,
-0x0000,0x0000,0xfcd2,0x0000,0xebc8,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd3c1,0xf0cd,0x0000,
-0xcff7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xedd2,0x0000,0xd4d8,0xdcc9,0xd7f1,0x0000,
-0x0000,0xdfbb,0x0000,0x0000,0xf3a5,0x0000,0x0000,0x0000,
-0xf4cd,0x0000,0x0000,0x0000,0x0000,0xf1bf,0xf8b1,0x0000,
-0xe9fa,0x0000,0x0000,0x0000,0xfbcb,0x0000,0x0000,0xcad5,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf9d4,0xf7ca,0x0000,0x0000,0xd6c8,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfce8,0xf3bd,
-0x0000,0xeefe,0x0000,0xe7fe,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd3c2,0x0000,0x0000,0x0000,0x0000,0xd3b6,0x0000,
-0xccad,0xf6fa,0xd6b2,0xd2d8,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe7d8,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe3a5,0x0000,0x0000,
-0x0000,0x0000,0xe7b9,0x0000,0x0000,0x0000,0x0000,0xf0ad,
-0xfbcc,0xeba1,0x0000,0x0000,0xd4a6,0x0000,0x0000,0x0000,
-0x0000,0xfbcd,0x0000,0xd5bd,0xf1df,0x0000,0x0000,0xf6fb,
-0x0000,0xdeb4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd5eb,0x0000,
-/* 0x7000 */
-0x0000,0xe5c8,0x0000,0x0000,0x0000,0xfba4,0xd4b9,0x0000,
-0x0000,0xdee1,0x0000,0xe4a3,0x0000,0x0000,0x0000,0xd7b7,
-0x0000,0xf8ee,0x0000,0x0000,0x0000,0xdeb5,0x0000,0x0000,
-0xd6d2,0x0000,0xf9d5,0xe7ba,0xebd5,0xd5f7,0xefe7,0xe1be,
-0x0000,0x0000,0x0000,0xfaae,0x0000,0x0000,0x0000,0xd6e9,
-0xd6ee,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe7bb,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xeccb,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd5b3,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xceb4,0x0000,0x0000,0x0000,
-0xfba5,0xe1ee,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf7a8,0x0000,0x0000,0x0000,0x0000,0xfbce,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd8bd,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xfbfd,0x0000,0x0000,0x0000,0x0000,
-0xfce9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcfb6,0x0000,0x0000,0x0000,0xedc7,0xeeac,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xccdd,0x0000,0x0000,
-0x0000,0x0000,0xf6a7,0x0000,0x0000,0x0000,0xe6fa,0x0000,
-0x0000,0x0000,0xf5a4,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xfddc,0xedb3,0xcec9,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xefe8,0x0000,0x0000,0xe1bf,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xfadb,0xcbe3,0xf7a9,0x0000,0xfba6,
-0x0000,0x0000,0x0000,0xdcb9,0x0000,0x0000,0x0000,0xf1c0,
-0xedc8,0xefc3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd6ad,0x0000,0x0000,0xfdce,0x0000,0x0000,0x0000,0xe8a1,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xfbf4,0xd5a7,0x0000,0x0000,0x0000,0xf1f6,0x0000,0xe6d3,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xccde,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf8b2,0x0000,0x0000,0x0000,0xdceb,0x0000,0x0000,
-/* 0x7100 */
-0x0000,0x0000,0x0000,0x0000,0xfdb6,0x0000,0x0000,0x0000,
-0x0000,0xe5ea,0x0000,0x0000,0xf1e0,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xdbcc,0xddcd,0x0000,0x0000,0x0000,0xd4c8,0x0000,
-0x0000,0xd9ed,0x0000,0x0000,0x0000,0x0000,0xf5a5,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe6fb,0x0000,0x0000,0x0000,0x0000,0x0000,0xe6d4,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfdc8,
-0x0000,0xd6a1,0xfdbf,0x0000,0xfcd3,0x0000,0xefa1,0x0000,
-0xe7bc,0x0000,0x0000,0x0000,0x0000,0x0000,0xd1ee,0x0000,
-0x0000,0xe6d5,0x0000,0x0000,0xe9f2,0x0000,0xdfb0,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd8e0,0xfcba,0xfdaf,0xf0ce,
-0x0000,0xdbe1,0x0000,0x0000,0xe5c9,0x0000,0xedb4,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe0c3,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe3d8,0x0000,0x0000,0x0000,
-0x0000,0xe9fb,0xeaa8,0x0000,0x0000,0x0000,0x0000,0xfdb7,
-0x0000,0x0000,0xfba7,0x0000,0xe9c2,0x0000,0x0000,0x0000,
-0x0000,0xfdf7,0x0000,0x0000,0x0000,0x0000,0x0000,0xe2d9,
-0x0000,0x0000,0xdcec,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe8a2,0x0000,0x0000,0x0000,
-0x0000,0xe6f0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xfdf8,0xfdf9,0x0000,0x0000,0x0000,0xf6bf,0x0000,
-0x0000,0xe7a7,0x0000,0xe6d7,0x0000,0x0000,0x0000,0x0000,
-0xd4f3,0xd4c9,0x0000,0x0000,0x0000,0x0000,0xd6fa,0x0000,
-0xd7f2,0x0000,0xe1c0,0x0000,0xdbe2,0xe6d8,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe7bd,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf0cf,0xf3be,0xe2ac,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf5b7,0xe0f0,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xfdb8,0xe3e8,0x0000,0xd4a7,0xe8fc,
-0xfad2,0x0000,0x0000,0x0000,0x0000,0x0000,0xf8ef,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd6d3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd5b4,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf0d0,0x0000,0xf7f0,0xeeb3,0x0000,0x0000,
-0xeaba,0x0000,0xead3,0x0000,0x0000,0xedc9,0xddab,0x0000,
-0x0000,0x0000,0xe5ac,0xfda1,0x0000,0xdfd0,0xecb3,0x0000,
-0xdfd1,0x0000,0x0000,0x0000,0x0000,0x0000,0xeded,0xf8b8,
-0xf7fa,0x0000,0x0000,0x0000,0xf8ab,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf4e0,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd4ba,0xe4b3,0x0000,0xe9da,0x0000,0xdeb6,0x0000,0xd9bf,
-0x0000,0xd9c0,0xd6ef,0x0000,0x0000,0x0000,0x0000,0xd9cc,
-0x0000,0xdaaa,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xdfe5,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf7e5,0x0000,0x0000,0x0000,0xccb2,0x0000,0x0000,
-0xdff9,0xd7e0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd4bb,0x0000,0x0000,0x0000,0x0000,0xfdfa,
-0x0000,0x0000,0x0000,0x0000,0xccb3,0x0000,0x0000,0xdbf3,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xdfd2,0x0000,0xceca,0x0000,0xeeda,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe4e4,0x0000,
-0xfbcf,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcfb7,
-0x0000,0xeec3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xceea,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe2ad,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd7e1,0xfaf5,0x0000,0x0000,0xd5c9,0xf8ac,0x0000,0x0000,
-/* 0x7300 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe7d9,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf3e9,0x0000,
-0x0000,0x0000,0x0000,0xd8ed,0xe3c4,0xf0f1,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe8e5,0x0000,0x0000,
-0x0000,0xe0fa,0xeec4,0xd9de,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xeba2,0xeba3,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfcc2,0xeabb,
-0x0000,0x0000,0x0000,0x0000,0xe8ab,0xdee2,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xedef,0x0000,0xe8a3,0x0000,0x0000,0x0000,0x0000,0xcff1,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd4bc,0x0000,0xfcea,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe7be,0x0000,0xfcf2,0x0000,0x0000,0xd6b4,0x0000,0x0000,
-0xe2ae,0x0000,0xd3b7,0xfacc,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xfadc,0x0000,0xedb5,0xe1e3,
-0x0000,0xe8ac,0x0000,0xe8dd,0x0000,0x0000,0xefe9,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf4bd,0x0000,0xcfb8,0xe9db,
-0xd1ac,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdac7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xebc9,
-0x0000,0xe8cc,0x0000,0x0000,0x0000,0xdeb7,0x0000,0x0000,
-0x0000,0x0000,0xd6bc,0xd3e5,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xfadd,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xdad6,0x0000,0xcab1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xdac8,0xdfa6,0x0000,0xf9b3,0xf2d2,0x0000,0xcac4,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcecb,0x0000,
-0x0000,0xcdf5,0x0000,0x0000,0x0000,0xfdb0,0xd5a8,0x0000,
-0xf1c1,0x0000,0x0000,0xe2e9,0xdcca,0xecb4,0xfac0,0x0000,
-0x0000,0xfba8,0xd0a8,0x0000,0x0000,0xdaec,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd9ee,
-0x0000,0xe0fb,0x0000,0x0000,0x0000,0xefea,0xfade,0x0000,
-/* 0x7400 */
-0x0000,0xe0c4,0x0000,0xcfb9,0x0000,0xd5ca,0xd7e2,0xe2af,
-0x0000,0xd7b8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe8cd,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf6da,0x0000,0x0000,0x0000,0x0000,
-0xefa2,0xe2da,0xf6fc,0x0000,0x0000,0xfbd0,0xd1ad,0x0000,
-0xcde4,0x0000,0xd1ae,0xdced,0xe8ce,0x0000,0xf0f9,0xceb5,
-0xe6fc,0x0000,0x0000,0xd7fb,0xd0d6,0xddf5,0xf7f1,0x0000,
-0xf6fd,0x0000,0xdbf7,0x0000,0x0000,0x0000,0x0000,0xfbea,
-0xe9dc,0xd9c1,0x0000,0xf5f2,0xe0c5,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xead4,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf9c2,0x0000,0xeabc,
-0x0000,0xd2c5,0xfbd1,0xe7c0,0xeba5,0x0000,0xdffa,0xe3a2,
-0xd7b9,0x0000,0xe9c3,0x0000,0xe8fd,0xe8af,0x0000,0x0000,
-0xf2d3,0xfba9,0xd8a5,0x0000,0x0000,0x0000,0x0000,0xd5cb,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd0c8,0x0000,
-0x0000,0x0000,0xd1af,0xd7e3,0x0000,0x0000,0x0000,0xe0c6,
-0x0000,0xd6a2,0x0000,0xedf0,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd7f3,0x0000,0x0000,0x0000,0xfcd4,0x0000,0xdad7,0xccdf,
-0x0000,0xf2d4,0x0000,0xd1b0,0x0000,0xcce0,0x0000,0xdbfd,
-0xf3bf,0x0000,0xf0d1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xfcbb,0x0000,0xe2b0,0x0000,0x0000,0xe6a5,0x0000,0x0000,
-0x0000,0xe2db,0x0000,0x0000,0x0000,0xdfde,0x0000,0xe0c7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf2ef,0x0000,
-0x0000,0x0000,0xcce1,0x0000,0x0000,0x0000,0x0000,0xd6ea,
-0x0000,0x0000,0x0000,0x0000,0xe7c2,0x0000,0x0000,0x0000,
-0xceb6,0x0000,0xf3c0,0x0000,0xcdfe,0x0000,0x0000,0x0000,
-0xfbd2,0x0000,0xf8f8,0xf7fb,0x0000,0x0000,0xe8bf,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe8b7,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xedb6,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x7500 */
-0x0000,0xdcba,0x0000,0x0000,0xccb4,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf1f7,0x0000,0x0000,0x0000,0xe8b8,0x0000,0x0000,
-0xcaf6,0x0000,0xe4a4,0xf4d6,0x0000,0x0000,0x0000,0xdfe6,
-0x0000,0x0000,0x0000,0xdfa7,0x0000,0xdfe7,0xe1c1,0x0000,
-0xe9c4,0x0000,0x0000,0xdccb,0xe9c5,0x0000,0x0000,0x0000,
-0xefa3,0xeba6,0xcba3,0xe3e9,0x0000,0x0000,0x0000,0xd1fb,
-0xefa4,0x0000,0xefeb,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd0b4,
-0x0000,0x0000,0x0000,0x0000,0xcda3,0x0000,0x0000,0xe8e6,
-0x0000,0xefa5,0x0000,0xd3cc,0xdaed,0x0000,0x0000,0x0000,
-0x0000,0xd7ba,0x0000,0xf2d5,0xf5e5,0xd9ef,0x0000,0x0000,
-0x0000,0x0000,0xf9b4,0x0000,0x0000,0xd5d4,0xfdcf,0x0000,
-0x0000,0x0000,0xdbe3,0x0000,0x0000,0x0000,0x0000,0xf1e1,
-0xecb6,0x0000,0x0000,0x0000,0x0000,0xfbfe,0xd3d7,0x0000,
-0xd1b1,0x0000,0xcbb1,0x0000,0x0000,0x0000,0x0000,0xd1b2,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcbb2,0xf1c2,
-0x0000,0x0000,0xf4e1,0xf9b5,0x0000,0x0000,0xe1c3,0xe1c2,
-0x0000,0xebf7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xdfa8,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xcbca,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe6b9,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf8de,0xf9aa,0xcaf7,0x0000,0xedb7,0x0000,0x0000,
-0xd3b8,0xf2d6,0x0000,0x0000,0xd4d9,0xeec5,0xf2f0,0x0000,
-0x0000,0x0000,0xcab2,0x0000,0x0000,0xdcbb,0x0000,0xf1f8,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xecb7,0x0000,0x0000,
-0x0000,0x0000,0xe5ca,0x0000,0xf6c0,0xfddd,0x0000,0x0000,
-0xd4e3,0xcce2,0x0000,0xf7d4,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd7e5,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd3c3,0x0000,0xd8a6,0x0000,0xf6c1,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xddf6,0x0000,0xcdc0,0x0000,0x0000,0x0000,
-0xe5dc,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe5cb,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe1c4,0x0000,0x0000,0x0000,0x0000,0x0000,0xe8b0,
-0xf4b0,0xf3ea,0xdaee,0x0000,0xd7bb,0x0000,0xe2b1,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd7aa,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd6fb,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe4df,0x0000,0xcad6,0x0000,
-0x0000,0x0000,0xeba8,0x0000,0x0000,0x0000,0xdbfe,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf6c2,0x0000,0x0000,0xefbb,0x0000,0x0000,0x0000,
-0x0000,0xd4fd,0x0000,0x0000,0xe0c8,0x0000,0x0000,0x0000,
-0xe8b9,0x0000,0xefa6,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcda4,0x0000,0x0000,0xd4f4,0xdba1,0xdbdc,0xdbdd,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xeedc,0x0000,0xcbcb,0xfcd5,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xceeb,0x0000,
-0xcdc1,0x0000,0x0000,0xfbd3,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf9ab,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf5d4,0x0000,0x0000,0x0000,0x0000,0xd9a9,
-0x0000,0x0000,0xe9dd,0xdbcd,0x0000,0x0000,0xddce,0x0000,
-0xe7c3,0x0000,0xeccc,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf9ec,0x0000,0x0000,0x0000,0xcbcc,0x0000,
-0x0000,0x0000,0x0000,0xe0fc,0xd4a8,0x0000,0xedd3,0xd8ef,
-0x0000,0xf2d7,0x0000,0xcaf8,0xdaef,0x0000,0x0000,0xd6d4,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd9cd,0x0000,
-0x0000,0x0000,0xd8ee,0x0000,0xf2c1,0x0000,0x0000,0x0000,
-0xdfd3,0x0000,0x0000,0x0000,0xdaf0,0x0000,0xe2ea,0x0000,
-/* 0x7700 */
-0x0000,0xe0fd,0x0000,0x0000,0xd8f8,0x0000,0x0000,0x0000,
-0xf7af,0xdab6,0x0000,0xcad7,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf2d8,0x0000,
-0xd8f9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xfadf,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcfef,
-0xd9c2,0x0000,0xf0d2,0x0000,0xe4d1,0x0000,0x0000,0x0000,
-0xf3b7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xfae0,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xefec,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe2b2,0x0000,0xd4bd,0x0000,0x0000,0xd9ce,0x0000,
-0x0000,0x0000,0x0000,0xf4e2,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd4a9,0x0000,0x0000,0x0000,0x0000,0xcdc2,0xe7da,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf2d9,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd9aa,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd8be,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xdcad,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe2eb,0xd6fc,0x0000,0x0000,
-0xcaf9,0x0000,0x0000,0xd4da,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf4d7,0xcca1,0x0000,0x0000,0xcfba,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf5b8,
-0x0000,0x0000,0x0000,0xd9c3,0xd0e8,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe3c5,0xebf8,0x0000,0xf2b1,0x0000,0x0000,
-0x0000,0xcfbb,0x0000,0x0000,0x0000,0xd3ad,0xe8e1,0xceec,
-0x0000,0x0000,0x0000,0xe0b4,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x7800 */
-0x0000,0x0000,0xdee3,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xddf7,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf2b2,0xf3f6,0xf6db,
-0x0000,0x0000,0x0000,0x0000,0xd7fe,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf8df,0x0000,0xf7f2,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd0a9,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe6da,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf5a6,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd7bc,0xcce3,0x0000,0x0000,0xe6db,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xdddd,0x0000,0x0000,0x0000,
-0x0000,0xd1b3,0x0000,0x0000,0x0000,0x0000,0x0000,0xefed,
-0x0000,0x0000,0x0000,0x0000,0xd6de,0xe4f4,0xe1ef,0x0000,
-0x0000,0xddf8,0x0000,0x0000,0x0000,0x0000,0x0000,0xe8cf,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xcae5,0x0000,0x0000,0x0000,0xdca1,
-0x0000,0xe0b5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xfcac,0xfcad,0xd8a7,0x0000,0x0000,0x0000,
-0x0000,0xedb8,0x0000,0x0000,0x0000,0xdbb6,0x0000,0x0000,
-0x0000,0x0000,0xd6f0,0xf3af,0x0000,0x0000,0xcda5,0x0000,
-0xdaf1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd8a8,0x0000,0x0000,0x0000,0xcce4,0x0000,0x0000,0xd1b4,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xcad8,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xdaf2,0x0000,0x0000,0x0000,0x0000,
-/* 0x7900 */
-0x0000,0xf5a7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf5a8,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe6a6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd5ec,0xd5f8,0xdaf3,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe3c6,0x0000,0x0000,0x0000,0xdee4,0x0000,
-0xdee5,0xd1b5,0x0000,0x0000,0x0000,0x0000,0x0000,0xd1b6,
-0xd1b7,0xf2b3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe9de,0x0000,0x0000,0x0000,0x0000,0x0000,0xf0d3,0xf2b4,
-0x0000,0x0000,0xf0d4,0xcbe4,0xfbd4,0xf5e6,0xe3ea,0x0000,
-0xdee6,0x0000,0x0000,0x0000,0x0000,0xdfd4,0x0000,0x0000,
-0xf8f9,0x0000,0x0000,0x0000,0x0000,0xf0ae,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd1b8,0x0000,0x0000,0x0000,0x0000,0xd6df,
-0x0000,0xd0d7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xfca1,0xefee,0xdcd8,
-0x0000,0xe9df,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe5dd,0xfdfb,
-0x0000,0x0000,0xe0c9,0x0000,0x0000,0x0000,0xd6c9,0x0000,
-0x0000,0xd4aa,0x0000,0xe5cc,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe9e0,0x0000,0x0000,0x0000,0xd0d8,0xfca2,0xd4be,
-0xe2b3,0xdee7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xdcbc,0xd2b6,0xf5d5,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xcea1,0xf5a9,0x0000,0x0000,0xddf9,0x0000,0x0000,
-0xddfa,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf0d5,
-0x0000,0x0000,0x0000,0x0000,0xf6df,0x0000,0xf2da,0xe4eb,
-0x0000,0xf2f1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xecb9,0x0000,0x0000,0x0000,0x0000,
-0xfdfc,0x0000,0x0000,0x0000,0x0000,0xe1aa,0x0000,0x0000,
-0xcad9,0x0000,0x0000,0xefef,0x0000,0xf5aa,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xecf9,0x0000,0x0000,0xf8ad,
-0x0000,0xf2c2,0xf6c3,0x0000,0xd7d2,0x0000,0x0000,0xf9a2,
-0xf0d6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf0fa,0x0000,
-0x0000,0xf6e0,0x0000,0x0000,0x0000,0x0000,0xe9f3,0xf2c3,
-0x0000,0x0000,0x0000,0xd4ab,0xcab3,0xcda6,0x0000,0xcdc3,
-0xcdda,0x0000,0x0000,0x0000,0x0000,0x0000,0xd9cf,0x0000,
-0x0000,0xf6c4,0x0000,0x0000,0x0000,0xeedd,0xe7c4,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe2b4,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xdfe2,0xe7db,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe8b1,0x0000,0xfcae,0x0000,0x0000,0x0000,0x0000,
-0xe5cd,0x0000,0x0000,0x0000,0xfaeb,0x0000,0xcfbc,0x0000,
-0x0000,0xcfe2,0xcdf6,0x0000,0x0000,0xeff0,0x0000,0xf4be,
-0x0000,0xd4cd,0x0000,0x0000,0xf3b8,0x0000,0x0000,0x0000,
-0xe9a1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf2f2,0xf3eb,0x0000,0xf0d7,0x0000,0x0000,
-0xcfd7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcfdf,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe8c0,0xe8c1,0x0000,0x0000,0x0000,0xcfe3,0xe9a2,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd0aa,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf3c1,0xd0ab,0x0000,0xd4e4,
-0x0000,0x0000,0xefbc,0xd8a1,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd9df,
-0x0000,0xf3d7,0x0000,0x0000,0x0000,0xdcbd,0x0000,0xcce5,
-0xedf1,0x0000,0x0000,0xf1e2,0x0000,0xd4db,0x0000,0x0000,
-0x0000,0x0000,0xe2b5,0x0000,0x0000,0xcae6,0x0000,0xd3ae,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcce6,0x0000,
-0x0000,0xf1d3,0xf5e7,0x0000,0x0000,0x0000,0x0000,0xcada,
-/* 0x7b00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfbee,
-0x0000,0xe1c5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xdfe9,0x0000,0xeede,0x0000,0x0000,0xf7c2,0x0000,
-0xd8a2,0x0000,0x0000,0x0000,0x0000,0x0000,0xddac,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf0af,0xd6bd,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe1ab,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf9b6,0x0000,
-0x0000,0xd4f5,0x0000,0xd0c9,0xefa7,0xe2ec,0x0000,0xdbea,
-0xcecc,0xf5e8,0xf7d5,0x0000,0xd3cd,0x0000,0xf3fe,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd0b5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe0fe,0x0000,0xdffb,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe6dd,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe8a4,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcbcd,
-0x0000,0x0000,0x0000,0xefa8,0x0000,0x0000,0x0000,0xeeb4,
-0x0000,0x0000,0x0000,0x0000,0xdad8,0xd1b9,0x0000,0xdfa9,
-0x0000,0x0000,0xf3b0,0x0000,0x0000,0xccc4,0x0000,0x0000,
-0x0000,0xceb7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xefa9,0x0000,0x0000,
-0x0000,0xdfd5,0x0000,0x0000,0xedd7,0x0000,0x0000,0x0000,
-0xeec6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xefbd,0xfcd6,0x0000,0x0000,0xdbf4,0x0000,0xefaa,0xf8b9,
-0x0000,0xf5e9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe3d9,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe1c6,0x0000,0x0000,0x0000,0xd4bf,0x0000,0x0000,0x0000,
-0x0000,0xdee8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x7c00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf0ea,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf3c2,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd3af,0x0000,
-0x0000,0xcadb,0x0000,0x0000,0x0000,0x0000,0x0000,0xfcd7,
-0x0000,0x0000,0xedd8,0xe1c7,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf4d8,0xd6b3,0xddad,
-0x0000,0x0000,0x0000,0xd5be,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf1c3,0xeedf,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd6eb,0x0000,0x0000,0x0000,0xf4d9,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd7e6,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xdab7,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xddfb,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xddcf,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd8a3,0x0000,0x0000,0xdad9,0x0000,0xf0d8,
-0xefc4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe1d8,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf1d4,0x0000,0xedf2,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd5db,0x0000,
-0x0000,0xd5dc,0xf3c4,0xcbd7,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe2b6,0x0000,0x0000,0x0000,0x0000,0xeff1,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xfbd5,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd3d8,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xddd0,0xf0d9,
-0xcbb3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd5dd,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xcda7,0x0000,0x0000,0xd0ac,0x0000,
-0xd1ba,0x0000,0xf1c4,0x0000,0xe5b3,0xfbf5,0xe9e1,0xfde0,
-0xfcbc,0x0000,0xdaa2,0xdaa3,0x0000,0xd2a1,0x0000,0x0000,
-0xd2ef,0x0000,0x0000,0x0000,0xe2ed,0x0000,0x0000,0xdee9,
-0xcedc,0xf2b5,0xd0e4,0xddd1,0x0000,0x0000,0x0000,0x0000,
-0xe1c8,0xdbb7,0xdfe3,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xedb9,0xf1c5,0x0000,0xf3cf,0xd7ab,
-0xe1ac,0x0000,0x0000,0xe3eb,0x0000,0xeec7,0x0000,0x0000,
-0x0000,0xe1c9,0xcafa,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf0fb,0xfae1,0xf0da,0xcce7,0xdaf4,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xccbf,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xceed,0x0000,
-0x0000,0xd5a9,0xfae2,0x0000,0x0000,0x0000,0xd0e5,0x0000,
-0xebd6,0x0000,0xecdf,0x0000,0x0000,0x0000,0xdffc,0x0000,
-0x0000,0xf7d6,0xdeea,0xcbb4,0x0000,0x0000,0xefbe,0x0000,
-0x0000,0xccb5,0x0000,0x0000,0x0000,0x0000,0x0000,0xcfbd,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xeff2,0xe2b7,
-0x0000,0x0000,0x0000,0xcce8,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf0fc,0x0000,0x0000,0x0000,
-0xd6e0,0x0000,0xf1c6,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe2b8,0xebab,0x0000,0x0000,
-0x0000,0xcbb5,0xd8d1,0x0000,0xf4ce,0xf3f7,0x0000,0x0000,
-0xd7c6,0x0000,0xd1bb,0xf7aa,0x0000,0xedca,0xd7d3,0xd8fa,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf6c5,
-0x0000,0x0000,0xd1cc,0xddfc,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdffd,0x0000,
-0xf9e5,0x0000,0xe0ca,0x0000,0x0000,0xf2fd,0xd3b0,0x0000,
-0xf4f3,0xdac9,0x0000,0xe6de,0x0000,0x0000,0x0000,0x0000,
-0xf8ba,0xe8d0,0x0000,0x0000,0xd8fb,0x0000,0x0000,0xead5,
-0x0000,0x0000,0x0000,0x0000,0xd6a3,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf6c6,0x0000,0x0000,0x0000,0x0000,
-/* 0x7e00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf2db,0xe4fc,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe8b2,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xdada,0x0000,0xf2dc,0xfbd6,0xe9b2,
-0x0000,0xeead,0x0000,0xfae3,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xdcee,0x0000,0x0000,0xf5ea,0xe6e0,
-0x0000,0xf0fd,0x0000,0x0000,0x0000,0x0000,0x0000,0xd7ac,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf5c5,0xeee0,0x0000,
-0x0000,0xdbe5,0x0000,0xddde,0x0000,0x0000,0xd9f0,0xe9a3,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf1f9,0x0000,0xf2c4,0xe0cb,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe9a4,0x0000,
-0x0000,0xe2b9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe3b1,0xfceb,0xcda8,0x0000,0xccb6,0x0000,0x0000,
-0xf0db,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe6ba,0x0000,0x0000,0xcda9,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf3c3,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe1d9,0x0000,0x0000,0xefab,
-0x0000,0x0000,0x0000,0xe7c5,0x0000,0x0000,0xe0e9,0x0000,
-0xf3c5,0x0000,0x0000,0xd4c0,0xd5bf,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x7f00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xddae,0x0000,
-0xf9fc,0x0000,0xccc0,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe5a2,0x0000,0x0000,0x0000,
-0xceb8,0x0000,0x0000,0x0000,0xd8d2,0xf9d6,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf1aa,0xced1,0x0000,0x0000,0xf6c7,0x0000,
-0xdbeb,0x0000,0xdffe,0x0000,0x0000,0xd8e1,0x0000,0xf7f3,
-0x0000,0xd7e7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd4fe,0x0000,0x0000,
-0xd1bc,0x0000,0xe5cf,0x0000,0xcbb6,0x0000,0xdab8,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcdc4,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd6be,0x0000,0x0000,0x0000,0xe2ba,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcfd8,0x0000,0x0000,0x0000,
-0xe0cc,0xebf9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xfdfd,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd7e8,0xcbd8,0x0000,0x0000,0x0000,0xe9e2,0x0000,0x0000,
-0x0000,0xe8ba,0x0000,0x0000,0x0000,0xe3c7,0x0000,0x0000,
-0x0000,0x0000,0xeccd,0x0000,0xecce,0x0000,0xd6bf,0x0000,
-0x0000,0x0000,0xe3a7,0x0000,0xdfd6,0xfde8,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xeee1,
-0xf6a8,0xddfd,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf8bb,0x0000,0xe8d1,0x0000,0x0000,0x0000,0x0000,
-0xf9d7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xceee,0x0000,0x0000,0xeccf,0x0000,0x0000,0x0000,
-0xe9a5,0xd6d5,0x0000,0xcdc5,0x0000,0xedba,0xd1bd,0x0000,
-0x0000,0xcfbe,0x0000,0x0000,0xecbb,0x0000,0x0000,0x0000,
-0xd2b1,0x0000,0x0000,0x0000,0x0000,0xcce9,0x0000,0xd9c4,
-0xe9fc,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd1be,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xecbc,0x0000,0x0000,0xe5ad,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf7b0,0x0000,0xccea,
-0x0000,0x0000,0x0000,0xd3c4,0x0000,0x0000,0xd6c0,0x0000,
-0x0000,0x0000,0xd6fd,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe1a1,0x0000,
-0xdebd,0x0000,0xf6a9,0x0000,0x0000,0x0000,0xdaa4,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd6a4,
-0xf5c6,0x0000,0xe1a2,0xe9c6,0x0000,0x0000,0x0000,0xf2c5,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf4e9,0xd6ec,0xebd3,
-0x0000,0x0000,0x0000,0x0000,0xecbd,0xe2dc,0xdeeb,0xf0dc,
-0x0000,0xebbf,0x0000,0xd7ce,0xd1bf,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf5ab,0x0000,
-0x0000,0x0000,0x0000,0xf9fd,0x0000,0xcadc,0x0000,0x0000,
-0x0000,0xcdc6,0xf2b6,0x0000,0x0000,0xddfe,0x0000,0x0000,
-0x0000,0xccb7,0xdbb8,0x0000,0x0000,0x0000,0x0000,0xd0e9,
-0x0000,0xcedd,0xebc0,0x0000,0xfda2,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf8cb,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xead6,0xf1b0,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xdbce,0x0000,0xf7c3,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xdbcf,0xcba4,0x0000,0x0000,0xf8e0,0x0000,
-0x0000,0xfbd7,0x0000,0x0000,0xebca,0xe0a1,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xcecd,0x0000,0x0000,0xd4dc,0x0000,0x0000,0x0000,
-0xfdd8,0x0000,0x0000,0x0000,0x0000,0xd2f6,0x0000,0x0000,
-/* 0x8100 */
-0x0000,0x0000,0xf2b7,0x0000,0x0000,0xfaf6,0xf6aa,0xfaf7,
-0xd8e6,0x0000,0xf4b1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe8d2,0x0000,0xcac5,0xcceb,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe2ee,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe2bb,0x0000,0xf7ad,0x0000,0x0000,0x0000,0xf8e1,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf3ec,0x0000,0x0000,0x0000,0x0000,0xdea1,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe4fd,0x0000,0x0000,0xe3ec,0x0000,
-0xddaf,0xddb0,0x0000,0x0000,0xcbb7,0xe8d3,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe1a3,0xd2e0,0x0000,
-0x0000,0x0000,0x0000,0xf0fe,0x0000,0x0000,0x0000,0x0000,
-0xe9a6,0xcbf2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xedf3,0xdcd9,0xe0cd,0x0000,0x0000,0x0000,0x0000,0xf7da,
-0xdbb9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xccae,0x0000,0xdadb,0x0000,0x0000,0x0000,0x0000,0xcdc7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xddb1,0x0000,0xd8af,0xe3a3,0x0000,0x0000,
-0xceef,0x0000,0x0000,0xf2f3,0x0000,0x0000,0x0000,0x0000,
-0xf8b3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe0ce,0x0000,0xf5fd,0x0000,0x0000,
-0x0000,0x0000,0xebec,0x0000,0x0000,0xd3c5,0xfcec,0xd2db,
-0xd4eb,0x0000,0xdea2,0x0000,0x0000,0x0000,0xe5e6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf0b0,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd5c4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xedf4,
-0x0000,0x0000,0x0000,0xe3ed,0x0000,0xe8c2,0x0000,0xedf5,
-0xd7fc,0x0000,0xedbb,0x0000,0x0000,0xf6ab,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf2b8,0xf6c8,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd3e6,0xf2dd,0xcfbf,0x0000,0xebac,0x0000,
-/* 0x8200 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0xcfc0,0x0000,0xe6a8,
-0xfde9,0x0000,0xcfc1,0x0000,0xe0df,0xdeec,0x0000,0x0000,
-0x0000,0x0000,0xe0a2,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf4bf,0xe2ef,0x0000,0xd9f1,0xf1c7,
-0x0000,0xcbb8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf9fe,0xdbba,0xdaf5,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf6ec,0xdadc,0xfae4,
-0x0000,0xe0cf,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xddb2,0x0000,0x0000,0x0000,0x0000,0xe6a9,0x0000,0xeff3,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf3ed,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xebfa,0x0000,0xf9e6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcadd,0xd5de,
-0x0000,0xcade,0xdfe4,0x0000,0x0000,0x0000,0xe6fd,0x0000,
-0xf5ac,0x0000,0x0000,0x0000,0x0000,0x0000,0xe4f5,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe9e3,0x0000,0xedcb,0xcfe4,0x0000,
-0x0000,0x0000,0xd8d3,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xddb3,0xd4ec,0x0000,0x0000,0xf2b9,0x0000,0xdfb7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xcbce,0xfbd8,0x0000,
-0x0000,0xd0d9,0x0000,0x0000,0xddd2,0xf7f4,0xe7dc,0xe4a5,
-0x0000,0xfca3,0x0000,0xdbbb,0x0000,0x0000,0x0000,0xf2ba,
-0xe9fd,0xd0ca,0x0000,0xf5d6,0xd9c5,0xe4b4,0x0000,0xeda7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xeabd,0xe6fe,0x0000,0xf7c4,0xf5ad,0x0000,0xd9e0,
-0x0000,0x0000,0x0000,0xcab4,0x0000,0x0000,0xf8e2,0xcfc2,
-0x0000,0xecbe,0x0000,0x0000,0x0000,0xe5b4,0xcdc8,0xeec8,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe7c8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xcdc9,0xf9b7,0x0000,
-/* 0x8300 */
-0x0000,0xf1e8,0xd9f2,0xdbf5,0xcab5,0xd9c6,0x0000,0x0000,
-0x0000,0xd8c9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd9ab,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xedbc,0x0000,0x0000,0xd8d4,0x0000,0x0000,0x0000,0xdcda,
-0x0000,0xe2bc,0x0000,0x0000,0xfced,0xece0,0xd2fe,0x0000,
-0xe9c7,0xe6aa,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe2f0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfabb,
-0x0000,0xf5ae,0xfbaa,0x0000,0x0000,0x0000,0x0000,0xecfb,
-0x0000,0xecbf,0xfcd8,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd4e5,0x0000,0x0000,0x0000,0xf9c3,
-0x0000,0x0000,0x0000,0xeee2,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd7e9,0xedf6,0x0000,0x0000,0x0000,0xdeed,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xccec,0x0000,
-0xe3ee,0x0000,0x0000,0x0000,0x0000,0x0000,0xe8d4,0x0000,
-0x0000,0x0000,0xfaf8,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xddb4,0xe4b5,0xd8b0,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd8d5,0x0000,0x0000,
-0x0000,0xf4ea,0x0000,0x0000,0x0000,0xceb9,0x0000,0x0000,
-0x0000,0xd6e1,0xcfd2,0x0000,0xd0b6,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xcea2,0x0000,0x0000,0xf3ee,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf3f8,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xdccc,0x0000,0xd0cb,0x0000,0x0000,0x0000,0xfca4,
-0xcdca,0xd7d4,0xdea3,0x0000,0xe4e0,0x0000,0x0000,0x0000,
-0x0000,0xeec9,0x0000,0x0000,0x0000,0xe2dd,0x0000,0x0000,
-/* 0x8400 */
-0x0000,0x0000,0x0000,0xf5fe,0xd4ac,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd5d1,0x0000,0xd8f0,0xf8c3,0xead7,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf5d7,0x0000,0x0000,0xd8bf,0x0000,0x0000,0x0000,
-0x0000,0xfdc0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xebad,0x0000,0x0000,0x0000,0x0000,0xd5aa,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe7a8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xeeca,
-0x0000,0x0000,0x0000,0xcae7,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf8e3,0x0000,0xd4dd,0x0000,0x0000,0xead8,0x0000,
-0x0000,0x0000,0x0000,0xfbd9,0xedf7,0x0000,0x0000,0xe5b5,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd0ad,0x0000,0x0000,
-0x0000,0x0000,0xf1f1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe2bd,0x0000,0x0000,0x0000,0xe3c8,0x0000,0x0000,0x0000,
-0x0000,0xd9d5,0x0000,0x0000,0xdfaa,0x0000,0x0000,0x0000,
-0x0000,0xdbbc,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf8e4,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf1fa,0x0000,0x0000,0xe5b6,0xf3ef,0x0000,0x0000,0xfbda,
-0xe1e0,0x0000,0xd9ac,0x0000,0xf5eb,0x0000,0xe0b6,0x0000,
-0x0000,0xe9c8,0x0000,0xcbcf,0x0000,0xe3c9,0x0000,0x0000,
-0x0000,0xdeee,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe2be,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xdcef,0x0000,0xd6a5,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe2f1,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd6fe,0x0000,0x0000,0x0000,
-/* 0x8500 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd9a1,0x0000,0xd8c0,0xdcdb,0x0000,0x0000,0xedbd,
-0xdfb8,0x0000,0xeaa5,0x0000,0x0000,0x0000,0xd7ad,0x0000,
-0x0000,0xf3f9,0x0000,0xedf8,0x0000,0xf5c7,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe1ca,0xebe3,0x0000,0xf2de,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf8cc,0x0000,0xead9,
-0x0000,0xd3c6,0x0000,0xdbe6,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf5af,0x0000,0x0000,0x0000,0x0000,0xcef0,0x0000,
-0x0000,0x0000,0x0000,0xe9fe,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xfbb6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe2f2,0x0000,0x0000,0x0000,0x0000,
-0xcff2,0xf7b9,0xd9f3,0x0000,0x0000,0xe1cb,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xdadd,0x0000,0x0000,0xdab9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xebfb,
-0x0000,0xcbb9,0x0000,0x0000,0xedf9,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe0e0,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf4c0,0x0000,
-0xfdbc,0xdfb1,0xe3ef,0x0000,0x0000,0x0000,0x0000,0xe0a3,
-0xfdb9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf0b1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xcdcb,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xedbe,0x0000,0x0000,0x0000,0xd5c0,0xe3f0,0xedfa,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe9e4,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd5ed,0xe7dd,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd4f6,0xe5b7,0x0000,0x0000,
-0x0000,0xdbe7,0xe2bf,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xeecb,
-0x0000,0x0000,0xd7f4,0xf0dd,0x0000,0x0000,0x0000,0xceab,
-/* 0x8600 */
-0x0000,0x0000,0xe7de,0x0000,0x0000,0x0000,0xd6d6,0xe1cc,
-0x0000,0x0000,0xe8b3,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe5ee,0xdca2,
-0x0000,0x0000,0xe0d0,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd5b5,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd5a1,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfbdb,0x0000,
-0xf9cb,0x0000,0x0000,0x0000,0xcbf3,0xf4a5,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xfac8,0xd6d7,0x0000,0xe9e5,0xfbdc,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfdd0,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xfbf6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xdaa5,0x0000,0xdbbd,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xece2,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xcdf7,0xf0de,0x0000,0x0000,0x0000,
-0x0000,0xf6c9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdeef,
-0x0000,0x0000,0x0000,0xd3b1,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xfcee,0x0000,0x0000,0x0000,
-0x0000,0xe8c3,0x0000,0xf1c8,0x0000,0x0000,0x0000,0xcef1,
-0x0000,0x0000,0x0000,0x0000,0xf9ed,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf2f4,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe4b6,0x0000,
-0xf5b9,0x0000,0xdcf0,0xe3f1,0x0000,0x0000,0x0000,0x0000,
-0xe8a5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf2bb,0x0000,0xdea4,0x0000,0xdacc,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcae9,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe3da,0x0000,0xfcd9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xeada,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf9c4,0x0000,
-0xe3a4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xfbdd,0x0000,0xefca,0x0000,
-0xe8c4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd5cc,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xebd7,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd9ad,
-0x0000,0x0000,0xfbab,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd3d9,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd5a2,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf6de,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xdaf6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe0d1,0x0000,0x0000,0xe9a8,
-0x0000,0x0000,0xf5f9,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xfaaf,0x0000,0xebfc,0x0000,0x0000,0xe0ea,0x0000,
-/* 0x8800 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe3b2,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd5c5,
-0x0000,0x0000,0xf1e3,0xd5ee,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xcdcc,0x0000,0x0000,0x0000,0x0000,0xedd9,0x0000,
-0x0000,0x0000,0x0000,0xd8c1,0x0000,0x0000,0x0000,0x0000,
-0xfaec,0x0000,0x0000,0x0000,0x0000,0x0000,0xf1eb,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xfabc,0xe6e2,0x0000,0x0000,
-0x0000,0x0000,0xfae5,0xe2fa,0x0000,0x0000,0x0000,0xcab6,
-0x0000,0xe4b7,0x0000,0xeadb,0x0000,0xf5fa,0x0000,0x0000,
-0x0000,0xfbac,0xcfc3,0xebfd,0x0000,0x0000,0x0000,0x0000,
-0xf8fa,0x0000,0x0000,0xdfb9,0x0000,0x0000,0x0000,0x0000,
-0xe1f1,0x0000,0xd2a4,0x0000,0x0000,0x0000,0x0000,0xf5fb,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd0da,0xd0db,
-0x0000,0xeabe,0xd9b1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcab7,0x0000,0x0000,0xd3e7,0x0000,0xf8e5,0x0000,0x0000,
-0x0000,0x0000,0xd3b2,0x0000,0x0000,0x0000,0xe2c0,0xf2df,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcde5,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf9ac,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcdcd,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xeeae,0xd6ae,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd7ea,
-0x0000,0x0000,0x0000,0x0000,0xe7e0,0xebae,0x0000,0x0000,
-0x0000,0xcfd9,0x0000,0x0000,0xdccd,0xedfb,0x0000,0xdef0,
-0x0000,0xd7eb,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xdea5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xdfd7,0xdbd0,0xdbd1,0x0000,0x0000,
-0xd5a3,0x0000,0x0000,0x0000,0x0000,0xf0b2,0x0000,0x0000,
-/* 0x8900 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdcdc,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcae8,0x0000,0xf8e6,0xdcce,0x0000,0x0000,0x0000,0x0000,
-0xeadc,0xdbd2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe9b3,0x0000,0x0000,
-0x0000,0x0000,0xf7db,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe3a8,0x0000,
-0xd7ae,0x0000,0x0000,0xe0e1,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xcbba,0x0000,0x0000,0xe5d1,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd0dc,
-0x0000,0x0000,0x0000,0x0000,0xd5c1,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd8ca,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe3a9,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe0a4,
-0x0000,0xe9a9,0x0000,0xd3c7,0x0000,0x0000,0xdcdd,0xf8ae,
-0x0000,0x0000,0x0000,0xccb8,0x0000,0x0000,0x0000,0xd0ae,
-0x0000,0x0000,0x0000,0xd8f2,0x0000,0x0000,0xe3ca,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xccaf,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd4ad,0xf6d1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd0cc,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xcac6,0x0000,0x0000,0xd5c2,0x0000,0x0000,
-0xceba,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xcac7,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xfab0,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xdfd8,0x0000,0x0000,0x0000,
-0xf5ba,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe5eb,0x0000,0xeff4,0xddb5,0x0000,0x0000,0x0000,0x0000,
-0xcdaa,0x0000,0xe3f2,0x0000,0xfbf7,0x0000,0xf7d0,0x0000,
-0x0000,0x0000,0x0000,0xfdba,0x0000,0x0000,0xfde1,0xf6fe,
-0xd1c0,0x0000,0x0000,0xe8c5,0x0000,0xe4b8,0x0000,0xe1e8,
-0x0000,0x0000,0x0000,0xccc1,0x0000,0xd2ed,0x0000,0x0000,
-0x0000,0x0000,0xdbbe,0x0000,0x0000,0xe0e2,0x0000,0x0000,
-0x0000,0xfac9,0x0000,0x0000,0xe1cd,0x0000,0xcab8,0x0000,
-0x0000,0x0000,0xf2e0,0xf1c9,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xdef1,0x0000,0x0000,0x0000,0xf0df,0xf8c4,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xeecc,0x0000,0x0000,0xdef2,0x0000,
-0xe7c9,0x0000,0xe2f3,0xe7e1,0x0000,0x0000,0xe3cb,0x0000,
-0x0000,0xe3cc,0x0000,0x0000,0x0000,0xcff8,0xefac,0x0000,
-0xfdfe,0xfca5,0xfab1,0xdfd9,0x0000,0xe0d2,0x0000,0x0000,
-0x0000,0xf4da,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf1ca,0x0000,0xcea3,
-0x0000,0x0000,0x0000,0x0000,0xf2bc,0xece3,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe0a5,0x0000,0xf7ab,0x0000,0x0000,
-0xebaf,0x0000,0x0000,0x0000,0x0000,0x0000,0xe5de,0x0000,
-0xe1a4,0xcdab,0x0000,0xd9f4,0xe8a6,0xcdce,0xe1e9,0x0000,
-0xfcef,0x0000,0xe0e3,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe2c1,0x0000,0xcea4,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xdea6,0x0000,0x0000,0xebfe,0x0000,0xebdd,0xf0e0,
-0x0000,0x0000,0xf4db,0x0000,0xe2f4,0x0000,0x0000,0xd3c8,
-0x0000,0x0000,0x0000,0xf4eb,0x0000,0xeeb5,0x0000,0xf5d8,
-0x0000,0x0000,0xd5df,0x0000,0x0000,0x0000,0xd6e5,0x0000,
-0x0000,0x0000,0x0000,0xebb0,0xf4e3,0x0000,0x0000,0x0000,
-0x0000,0xe3cd,0x0000,0x0000,0x0000,0x0000,0xf4f4,0xfab2,
-0x0000,0x0000,0xeff5,0xcadf,0x0000,0xebb1,0xedbf,0x0000,
-0x0000,0xfdc9,0x0000,0x0000,0x0000,0x0000,0xe4a6,0xf9a4,
-0xf0b3,0x0000,0xe5ec,0x0000,0x0000,0x0000,0xd1e7,0x0000,
-0xd9c7,0xe4d7,0xeadd,0x0000,0xd4f7,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdaba,0x0000,
-0xdacd,0x0000,0x0000,0x0000,0xf9cc,0x0000,0xe1da,0xdbbf,
-0x0000,0xccc5,0xecd0,0xcbbb,0x0000,0xdef3,0x0000,0x0000,
-0xe9aa,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd9c8,0x0000,0x0000,0xeee3,0xd7bd,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xcfc4,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd0cd,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xfca6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf1fb,0x0000,0x0000,0x0000,0x0000,0xfdd2,0xd1c1,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe3db,0x0000,0xd3c9,0x0000,0xdccf,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcced,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xdea7,0x0000,0x0000,0xe6bb,
-0xeca1,0x0000,0x0000,0x0000,0xccb9,0x0000,0x0000,0xfbde,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe7e2,0x0000,0x0000,
-0xd4c1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xdca8,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe2c2,0x0000,0xf3d8,0xe5d3,0x0000,0x0000,0xf3d9,0x0000,
-0x0000,0x0000,0xf3c6,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x8c00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcddb,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcdac,
-0x0000,0xfcc3,0x0000,0x0000,0x0000,0x0000,0xd4e7,0x0000,
-0xd1c2,0x0000,0xf9a5,0x0000,0xe8d5,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe3ce,0x0000,0x0000,
-0x0000,0x0000,0xd4ca,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xdfda,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xfbdf,0xe7e3,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf8fb,0xe3cf,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf5b0,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd8e7,0x0000,0xd9c9,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf8af,0xeff6,0x0000,
-0xddb6,0xeeaf,0xcdf8,0x0000,0x0000,0x0000,0x0000,0xdeb8,
-0xfca7,0xf7fc,0xf7b1,0xcebb,0xf4a1,0x0000,0x0000,0xeecd,
-0xe1ae,0x0000,0x0000,0xecc3,0xcffe,0x0000,0xf8bf,0xd8e2,
-0xd3e8,0x0000,0x0000,0xdea8,0xf4e4,0xecc2,0x0000,0xd9f5,
-0xf9c5,0xddd3,0xd6f1,0xecfc,0xfcf0,0x0000,0x0000,0xedc0,
-0xcab9,0x0000,0xeee4,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf2e1,0x0000,0xdeb9,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd6f2,0x0000,0xdef4,0x0000,0xdfdb,0x0000,
-0xdbd3,0x0000,0xfae7,0xd8e3,0xf4c1,0x0000,0xddb7,0x0000,
-0x0000,0x0000,0xf2f5,0x0000,0x0000,0xd4ae,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd6f3,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xddb8,0xcfc5,0xdfdf,0x0000,0x0000,
-/* 0x8d00 */
-0x0000,0x0000,0x0000,0x0000,0xf2be,0xf6a1,0x0000,0xebcb,
-0xf1fc,0x0000,0xf3c7,0x0000,0x0000,0xe0eb,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xedfc,0x0000,0x0000,0xe1db,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xeee5,0x0000,0xdef5,0x0000,
-0x0000,0x0000,0x0000,0xfad3,0x0000,0x0000,0x0000,0x0000,
-0xf1cb,0x0000,0x0000,0xd0af,0xddb9,0x0000,0x0000,0xd1c3,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf5b1,0x0000,0x0000,
-0x0000,0x0000,0xeac6,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf0e1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf6ac,0x0000,0x0000,0x0000,0x0000,
-0xf5d9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf0eb,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xddba,0x0000,0x0000,0x0000,0xf2bf,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf7c5,0x0000,
-0x0000,0x0000,0x0000,0xdba2,0xf2f6,0x0000,0x0000,0xcaba,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf7f5,0x0000,0xcbe5,0x0000,0x0000,
-0x0000,0xeee6,0x0000,0xe0d3,0x0000,0x0000,0x0000,0x0000,
-0xcea5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd6d8,
-0x0000,0x0000,0x0000,0xd4af,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x8e00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe9c9,0x0000,0x0000,0x0000,0x0000,0xd3ce,
-0xf4c2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcbe6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf1a1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xebb2,0x0000,0x0000,0x0000,0x0000,0xf1a2,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xebb3,0x0000,0xf0b4,0x0000,0x0000,0xcbf4,
-0xd4b0,0xf3b2,0xfbb7,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf5ec,0x0000,0x0000,0x0000,0x0000,0x0000,0xeee7,
-0xf4b2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf5ed,0x0000,0xcff3,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf0e2,0x0000,0x0000,0x0000,0x0000,0x0000,0xeece,
-0x0000,0x0000,0xf1cc,0x0000,0x0000,0xe5b8,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd7f5,0xe3f3,0xcfe5,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcfc6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf3b3,0xe4d8,0xcff9,0xcfda,0x0000,0x0000,
-0x0000,0x0000,0xfacd,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe6e3,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf2e2,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf5ee,0x0000,0x0000,0xcabb,0x0000,0x0000,0xe3dc,0x0000,
-/* 0x8f00 */
-0x0000,0x0000,0x0000,0xcef2,0x0000,0xd6d9,0x0000,0x0000,
-0x0000,0xeeb0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf4e5,0xd8c2,0xdcd0,0xccee,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd5e0,0xf6ca,0xfdca,0xd8d6,0xf4cf,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd6a6,0xdcbe,
-0x0000,0xdbd4,0xd7c7,0x0000,0x0000,0x0000,0x0000,0xf2fe,
-0x0000,0x0000,0x0000,0xf1cd,0x0000,0x0000,0x0000,0x0000,
-0xe2c3,0xdcde,0x0000,0xdcdf,0x0000,0x0000,0xefad,0xe6ab,
-0x0000,0x0000,0x0000,0x0000,0xf9dd,0xeabf,0x0000,0x0000,
-0x0000,0xefae,0x0000,0x0000,0x0000,0xf4d0,0xcef3,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe6ac,0x0000,0xcede,
-0x0000,0x0000,0xd5f9,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe3f4,0xcdd0,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd5b8,0x0000,0x0000,0xf7fd,0x0000,
-0xdca9,0x0000,0x0000,0x0000,0x0000,0xdef6,0x0000,0xdcaa,
-0xf2e3,0xe9b4,0xd2dc,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe9e6,0x0000,0x0000,0xe3f6,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe7ca,0x0000,
-0x0000,0xd0ce,0x0000,0x0000,0xdaf7,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcabc,0x0000,
-0x0000,0x0000,0xeee8,0xdade,0x0000,0xf2f7,0x0000,0x0000,
-0xe2fb,0x0000,0xcca6,0x0000,0x0000,0x0000,0x0000,0xdabb,
-0x0000,0xeee9,0x0000,0x0000,0x0000,0xf5da,0x0000,0x0000,
-0xf7dc,0xe1ea,0xcec1,0xd4b1,0x0000,0xfdb1,0xe6bd,0x0000,
-0xfbad,0x0000,0x0000,0xf8e7,0x0000,0xe1ce,0x0000,0xf7e2,
-0xf5ef,0xcfc7,0x0000,0x0000,0xd4b2,0xccef,0x0000,0xd4e8,
-0x0000,0xeecf,0xf7d7,0x0000,0x0000,0xe0a6,0xd6c1,0xe1dc,
-0xf0e3,0xf1e4,0xdcf1,0xd6a7,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf4f5,0x0000,
-0x0000,0xf1ce,0xf2e4,0x0000,0x0000,0xd0b0,0x0000,0x0000,
-0xecef,0x0000,0x0000,0x0000,0xf9ba,0x0000,0xebb5,0x0000,
-0x0000,0xd4ed,0xe2c4,0x0000,0x0000,0x0000,0x0000,0xe9e7,
-0x0000,0x0000,0xebb4,0xeaa1,0x0000,0xf8bc,0xcea6,0x0000,
-0xf9c6,0xfcda,0x0000,0xd4b3,0xd3b9,0xeade,0x0000,0x0000,
-0x0000,0xe9ab,0x0000,0x0000,0xe1e1,0xd3cf,0xf4f6,0x0000,
-0xeac0,0xe1cf,0x0000,0xccba,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xeeea,0x0000,0x0000,0x0000,0xf0e4,0xf3b4,0xd4ee,
-0x0000,0x0000,0xf2c0,0x0000,0x0000,0xf1e5,0x0000,0xf4c3,
-0xe0d4,0x0000,0xebb6,0x0000,0xd7a1,0xcbe8,0x0000,0xf9ad,
-0xe9ad,0xd8e4,0xfab3,0xe2c5,0xfcbd,0x0000,0x0000,0xecc4,
-0xd8b1,0x0000,0xdcab,0x0000,0x0000,0x0000,0x0000,0xd5a4,
-0x0000,0xebe9,0x0000,0x0000,0x0000,0xe8bb,0x0000,0x0000,
-0x0000,0xd8d7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xfbae,0xd1e1,0x0000,0x0000,0xdbc0,0x0000,
-0xf5be,0x0000,0xdef7,0x0000,0x0000,0x0000,0x0000,0xcafb,
-0xf7c6,0xcfc8,0x0000,0x0000,0x0000,0xe1d0,0x0000,0x0000,
-0xeed0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe9f4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xcef4,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd5cd,0x0000,
-0x0000,0xcfdb,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xddbb,0x0000,0x0000,0x0000,0x0000,0xceac,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe9e8,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd4b4,0x0000,0x0000,
-/* 0x9100 */
-0x0000,0x0000,0xe4c7,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf5db,0x0000,0x0000,0xfac1,0x0000,0x0000,
-0x0000,0xdea9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd4f8,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xeff7,0x0000,0x0000,
-0x0000,0x0000,0xd3b3,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xebb7,0xeff8,0xf5dc,0xedcc,0xdbd5,0xf1cf,0x0000,
-0x0000,0x0000,0xf1d0,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf5b2,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd9ae,0xd5ac,0x0000,0xe2c6,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xfda3,0x0000,0xfbe5,
-0xdfab,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe2f5,
-0x0000,0xf6ad,0x0000,0xf5b3,0x0000,0xf0b5,0x0000,0x0000,
-0x0000,0x0000,0xe1a5,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf5dd,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xeca2,0xedfd,0x0000,0xf5b4,0xfbb8,
-0x0000,0xdba3,0x0000,0x0000,0xd6ca,0xcbd9,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe5d4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf3fa,
-0x0000,0xebb8,0x0000,0xe0b7,0xd7ec,0xf1ec,0xe5af,0xd5e1,
-0xd7ed,0xd1d1,0x0000,0x0000,0x0000,0x0000,0x0000,0xe1f2,
-0xeff9,0x0000,0x0000,0x0000,0xddbc,0xf6dc,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf0e5,0x0000,0x0000,0x0000,0xf4c4,
-0x0000,0x0000,0xe9e9,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf3fb,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x9200 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd4ef,0x0000,0x0000,
-0xcca2,0xf7fe,0xdfbc,0x0000,0x0000,0x0000,0x0000,0xebcd,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd0b7,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd6c2,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe8ad,0x0000,0x0000,0x0000,0x0000,0xefaf,
-0xcba5,0x0000,0x0000,0x0000,0x0000,0xcbe9,0x0000,0x0000,
-0x0000,0xfae8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xccc6,
-0x0000,0x0000,0x0000,0xe6e7,0x0000,0x0000,0xeac7,0x0000,
-0x0000,0x0000,0xdba4,0x0000,0xcfc9,0xe2fc,0xeffa,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xebde,0x0000,0x0000,0xf5c8,0x0000,0xd4de,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe0d5,0x0000,0xefb0,0x0000,0x0000,0xe2c7,0x0000,
-0xd9af,0x0000,0x0000,0x0000,0xf9e7,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe7e5,0x0000,0x0000,0xcfca,0xe1d1,
-0x0000,0xe2c8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xeffb,0x0000,0x0000,0xfaf9,
-0x0000,0x0000,0xdcf2,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe0a7,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf8e8,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcbea,0x0000,0x0000,0x0000,0xcbbc,0x0000,0x0000,0x0000,
-/* 0x9300 */
-0x0000,0x0000,0x0000,0x0000,0xd6e2,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf5de,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf5df,0x0000,0xeeb6,0x0000,0x0000,0x0000,0xe2f6,0xd3ca,
-0xeffc,0xd1c4,0xefb1,0x0000,0xd1c5,0x0000,0xd0de,0x0000,
-0xd9e1,0x0000,0x0000,0xe0b8,0x0000,0x0000,0xcdd1,0xf3b9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe7cc,0x0000,0xd6a8,0xcea7,0x0000,0xd4b5,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe4c8,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd3b4,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xebb9,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xcbf5,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf6dd,0x0000,0xf1a3,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xccc7,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe9ca,0x0000,0xe1f0,0x0000,
-0x0000,0x0000,0xf5e0,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xfbaf,0x0000,0x0000,0x0000,0xcbd1,
-0x0000,0x0000,0x0000,0x0000,0xfbe0,0xf2e5,0x0000,0x0000,
-0xecf0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf0ec,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xeeeb,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe9cb,0x0000,
-0x0000,0xccf0,0x0000,0x0000,0xd7af,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf3a1,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x9400 */
-0x0000,0x0000,0x0000,0x0000,0xfcf5,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf1a4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe0d6,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xefb2,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf4d1,0x0000,0x0000,
-0xf7a1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf1d1,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xcafc,0xcafd,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xcece,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf3c8,0x0000,0xf3ba,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x9500 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xedfe,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xdaa6,0x0000,0x0000,0xe0ec,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf8cd,0x0000,0xcbd2,0x0000,0x0000,0x0000,0xebce,
-0x0000,0xf9d8,0xf9d9,0xcae0,0xdaca,0x0000,0x0000,0x0000,
-0xcba6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xcac8,0xf9ee,0xdbec,0x0000,0x0000,
-0xd0b1,0x0000,0x0000,0x0000,0x0000,0xd5ef,0x0000,0x0000,
-0x0000,0xe6f3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe7a2,0xe4d9,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe4e1,
-0x0000,0x0000,0xfcc4,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf9ef,0xcff4,0xf7e6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcebc,0x0000,0x0000,0x0000,
-0x0000,0xf4c5,0xdca3,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x9600 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xddbd,0x0000,0x0000,0x0000,
-0x0000,0xf4c6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf8a1,0x0000,0x0000,0x0000,0xe8d6,0x0000,
-0x0000,0x0000,0xdbc1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf0e6,0x0000,0x0000,0x0000,0xe4b9,
-0xf6ed,0x0000,0xf9ae,0x0000,0xddbe,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd7b0,0xd8e8,0xcbbd,0x0000,0x0000,
-0xf9da,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf8ce,0xf9f0,0xe0ed,0xe3b3,0xf4b3,
-0x0000,0x0000,0xeac2,0xf2e6,0xf0b6,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xdbd6,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xebe4,0x0000,0x0000,0xf2e7,0x0000,0xd7d5,0xd4b6,0xf9e8,
-0xd7c1,0x0000,0x0000,0x0000,0x0000,0xe5d5,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe9ea,0xd7cc,0x0000,
-0x0000,0x0000,0xd3e9,0xe2c9,0x0000,0xfcdb,0xcdad,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xccb0,0xeaa2,0x0000,0x0000,
-0xe4f6,0xd0c0,0x0000,0xf0b7,0xeea1,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd7f6,0x0000,0x0000,0x0000,0xe2ca,
-0xe2cb,0x0000,0xfacf,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xebdf,0x0000,0x0000,0x0000,0x0000,0x0000,0xd6cb,
-0x0000,0x0000,0x0000,0xf4b4,0x0000,0x0000,0x0000,0x0000,
-0xedcd,0xe4d2,0x0000,0x0000,0xeaa9,0xe4ba,0xf3a2,0xcdd2,
-0x0000,0xf6cb,0x0000,0xf1e6,0xedc1,0xe8bc,0xeed1,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf0e7,0xe2cc,0x0000,
-0x0000,0xe4aa,0x0000,0xf5e1,0xedda,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd7ee,0xd1f1,0x0000,0x0000,0x0000,0x0000,
-0xe9eb,0xe9ec,0xe0e4,0x0000,0x0000,0x0000,0x0000,0xdaa7,
-0xddd4,0x0000,0xeaa3,0x0000,0x0000,0x0000,0xd6c3,0xd6f4,
-0x0000,0xdadf,0x0000,0xefb3,0x0000,0x0000,0x0000,0x0000,
-0xe2cd,0x0000,0x0000,0x0000,0x0000,0x0000,0xeffd,0xf2e8,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xefc5,0x0000,0xe7e7,0x0000,0x0000,0xd7fd,0x0000,
-0x0000,0xe7ce,0x0000,0x0000,0xdfdc,0x0000,0xf9c7,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd9f6,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xdfac,0x0000,0xd6da,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xdca4,0x0000,0x0000,0x0000,0xf0b8,0x0000,0x0000,
-0x0000,0x0000,0xd5fa,0x0000,0xe4f7,0x0000,0x0000,0x0000,
-0xd6c4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf4ec,0x0000,0x0000,0x0000,0x0000,0xeffe,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf0a1,0x0000,0xdeaa,0x0000,
-0x0000,0xdabc,0xd8fc,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xfad4,0x0000,0x0000,0x0000,0xece5,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xfca8,0x0000,0x0000,0xece6,
-0x0000,0x0000,0xd8cb,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xfbb9,0x0000,0xe4d3,0x0000,0xcdf9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcfd3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcaea,0x0000,0x0000,0xcfd4,0x0000,0xf8bd,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf4c7,0x0000,
-0x0000,0x0000,0x0000,0xeadf,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf9db,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd4b7,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xebe5,0x0000,0x0000,0xe1d2,0x0000,
-0x0000,0x0000,0x0000,0xeaa4,0x0000,0x0000,0x0000,0xfac2,
-0xfbe1,0xfaed,0xf0a2,0xccf1,0x0000,0xfaa3,0xe2f7,0x0000,
-0xe2ce,0x0000,0xe9f5,0x0000,0xe1eb,0x0000,0x0000,0x0000,
-0xe7e8,0xe8d7,0xdaf8,0xd4cb,0x0000,0x0000,0x0000,0xf7f6,
-0xd6c5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd4e9,0x0000,0x0000,
-0xfafa,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xccf2,0xf7dd,0x0000,0xdeba,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcea8,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf0b9,0xe4fe,0xe4c9,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe4d4,0x0000,0x0000,0x0000,
-0xeac3,0x0000,0xefb4,0x0000,0x0000,0x0000,0xd7be,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xfbe2,0x0000,0xcdd3,
-0x0000,0x0000,0x0000,0xefb5,0x0000,0x0000,0x0000,0xfae9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf9a6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdfbd,
-0x0000,0xf7c7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xf8fd,0x0000,0x0000,0xf8fc,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xdeab,0xdbe8,0x0000,0x0000,0xe3dd,
-0x0000,0xe1e2,0xd1c6,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf6d0,0xebe6,0xdaf9,
-0x0000,0x0000,0x0000,0x0000,0xecc7,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xdef8,0xf8e9,0xe3de,0x0000,
-/* 0x9900 */
-0x0000,0x0000,0x0000,0xcef5,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xfac3,0xe5d7,0x0000,0xecc8,0x0000,0x0000,0x0000,
-0xf3c9,0x0000,0x0000,0xe4bb,0x0000,0x0000,0x0000,0x0000,
-0xe6ae,0x0000,0x0000,0x0000,0x0000,0x0000,0xefb6,0x0000,
-0xdcbf,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcebd,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd8c3,0x0000,0x0000,
-0x0000,0xd0cf,0x0000,0xcffa,0xf3ca,0xe0d7,0x0000,0x0000,
-0x0000,0xd1c7,0xe9ae,0x0000,0xe8bd,0x0000,0x0000,0xfac4,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe2cf,0x0000,
-0x0000,0xfac5,0x0000,0x0000,0x0000,0xf9b8,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xdce0,0x0000,0x0000,
-0xfbb0,0x0000,0x0000,0x0000,0xd8a9,0xe5df,0xf9a7,0x0000,
-0x0000,0xf6ee,0x0000,0xf6cc,0xe2f8,0x0000,0x0000,0x0000,
-0x0000,0xecf1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xdae0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf1d2,0xd2cc,0xcfcb,0x0000,0x0000,0xcabd,0x0000,0x0000,
-0x0000,0xddbf,0x0000,0x0000,0x0000,0xf6ef,0x0000,0xdef9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xfab4,0x0000,0x0000,
-0x0000,0xd5ad,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf1e7,
-/* 0x9a00 */
-0x0000,0xdebe,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xdcc0,0x0000,0x0000,0x0000,0x0000,0x0000,0xd1c8,0xd1c9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf8be,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xcbf6,0x0000,0x0000,0x0000,0x0000,
-0xd4f9,0x0000,0x0000,0x0000,0x0000,0x0000,0xf5e2,0xe1d3,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd8e9,0x0000,0x0000,0xf8fe,0x0000,0xcfcc,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xfda4,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xcef6,0x0000,0xfad0,
-0x0000,0x0000,0xccf3,0xe6be,0x0000,0x0000,0x0000,0xf6ae,
-0x0000,0x0000,0xd5f0,0x0000,0x0000,0xd1ca,0x0000,0x0000,
-0x0000,0xfcbe,0xd5f1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcde9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xfab5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe2d0,0xf4f7,0x0000,0x0000,0x0000,
-0xcdd4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe7a3,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdba5,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x9b00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe2d1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd7a2,
-0x0000,0x0000,0xf7e3,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xeaa6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd0a1,0x0000,0x0000,0x0000,
-0x0000,0xceda,0xfbeb,0xdba6,0xdbde,0xd8e5,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xeae0,
-0x0000,0x0000,0x0000,0x0000,0xd8aa,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe5e0,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd6db,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xefc6,0x0000,
-0x0000,0xf8ea,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe4d5,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xcef7,0x0000,0x0000,0xe0d8,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd7ef,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf4ed,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcde6,0x0000,0x0000,0x0000,
-0xccf4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x9c00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf5e3,0x0000,0x0000,
-0xe4ca,0x0000,0xdce1,0x0000,0x0000,0xf9c8,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xfcbf,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe8a7,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd8c4,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcbbe,
-0x0000,0xdcae,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd7f7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf0e8,0x0000,0xddc0,
-0x0000,0xcfcd,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xdcf3,0xd9b0,0x0000,0xe6e9,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x9d00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe4bc,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xeac4,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe4ec,0x0000,
-0xe4e5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xfbf8,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xccbb,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe4bd,0x0000,0x0000,
-0xcddc,0xd9f7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xdddf,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xedce,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd9d0,0x0000,0x0000,0x0000,0x0000,0x0000,0xe5a3,
-0x0000,0x0000,0x0000,0x0000,0xf9cd,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcdae,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcfce,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf6af,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xfdd3,0xebed,0xd6dc,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x9e00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe5a4,0x0000,0x0000,0x0000,0xd5b6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd6dd,0x0000,0x0000,
-0x0000,0xf9e9,0x0000,0x0000,0x0000,0xe7a4,0x0000,0xd6e3,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd1cb,0xd6e4,0x0000,0x0000,0x0000,0xd5f2,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xdefa,0x0000,0xd7f8,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd8ea,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcfd5,0xd8fd,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd8ab,0x0000,0x0000,0xfdcb,0x0000,
-0x0000,0x0000,0x0000,0xfcdc,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe0a8,0xd5f3,0x0000,
-0x0000,0xfdd9,0x0000,0x0000,0xcca3,0x0000,0x0000,0x0000,
-0xd9f9,0x0000,0x0000,0xd3ea,0xf5f5,0x0000,0xefc7,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd3da,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xdabd,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x9f00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe8a8,
-0xdcaf,0x0000,0x0000,0x0000,0x0000,0x0000,0xf0a3,0x0000,
-0x0000,0x0000,0x0000,0xcdd5,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe0a9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xdeac,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xf0ba,0xeeb1,0x0000,0x0000,0xeeb2,0x0000,
-0x0000,0x0000,0xf6cd,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xeed2,
-0x0000,0xd6c6,0x0000,0x0000,0x0000,0x0000,0x0000,0xe0e5,
-0x0000,0x0000,0xf3bb,0x0000,0xe5e1,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe4cb,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd7a3,0x0000,0x0000,
-0xdbc2,0x0000,0x0000,0x0000,0x0000,0xcafe,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcfcf};
-
-static const int ucs_i_uhc_table_min = 0x4d00;
-static const int ucs_i_uhc_table_max = 0x4d00 + (sizeof(ucs_i_uhc_table)/sizeof(unsigned short));
-
-static const unsigned short ucs_s_uhc_table[] = {
-/* 0xab00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xb0a1,0xb0a2,0x8141,0x8142,0xb0a3,0x8143,0x8144,0xb0a4,
-0xb0a5,0xb0a6,0xb0a7,0x8145,0x8146,0x8147,0x8148,0x8149,
-0xb0a8,0xb0a9,0xb0aa,0xb0ab,0xb0ac,0xb0ad,0xb0ae,0xb0af,
-0x814a,0xb0b0,0xb0b1,0xb0b2,0xb0b3,0xb0b4,0x814b,0x814c,
-0xb0b5,0x814d,0x814e,0x814f,0xb0b6,0x8150,0x8151,0x8152,
-0x8153,0x8154,0x8155,0x8156,0xb0b7,0xb0b8,0x8157,0xb0b9,
-0xb0ba,0xb0bb,0x8158,0x8159,0x815a,0x8161,0x8162,0x8163,
-0xb0bc,0xb0bd,0x8164,0x8165,0xb0be,0x8166,0x8167,0x8168,
-0xb0bf,0x8169,0x816a,0x816b,0x816c,0x816d,0x816e,0x816f,
-0x8170,0x8171,0x8172,0xb0c0,0x8173,0xb0c1,0x8174,0x8175,
-0x8176,0x8177,0x8178,0x8179,0xb0c2,0x817a,0x8181,0x8182,
-0xb0c3,0x8183,0x8184,0x8185,0xb0c4,0x8186,0x8187,0x8188,
-0x8189,0x818a,0x818b,0x818c,0x818d,0x818e,0x818f,0x8190,
-0x8191,0x8192,0x8193,0x8194,0x8195,0x8196,0x8197,0x8198,
-0xb0c5,0xb0c6,0x8199,0x819a,0xb0c7,0x819b,0x819c,0xb0c8,
-0xb0c9,0x819d,0xb0ca,0x819e,0x819f,0x81a0,0x81a1,0x81a2,
-0xb0cb,0xb0cc,0x81a3,0xb0cd,0xb0ce,0xb0cf,0xb0d0,0x81a4,
-0x81a5,0xb0d1,0xb0d2,0xb0d3,0xb0d4,0x81a6,0x81a7,0x81a8,
-0xb0d5,0x81a9,0x81aa,0x81ab,0xb0d6,0x81ac,0x81ad,0x81ae,
-0x81af,0x81b0,0x81b1,0x81b2,0xb0d7,0xb0d8,0x81b3,0xb0d9,
-0xb0da,0xb0db,0x81b4,0x81b5,0x81b6,0x81b7,0x81b8,0x81b9,
-0xb0dc,0xb0dd,0xb0de,0x81ba,0xb0df,0x81bb,0x81bc,0xb0e0,
-0xb0e1,0x81bd,0x81be,0x81bf,0x81c0,0x81c1,0x81c2,0x81c3,
-0xb0e2,0xb0e3,0x81c4,0xb0e4,0xb0e5,0xb0e6,0x81c5,0x81c6,
-0x81c7,0xb0e7,0x81c8,0x81c9,0xb0e8,0x81ca,0x81cb,0x81cc,
-0xb0e9,0x81cd,0x81ce,0x81cf,0xb0ea,0x81d0,0x81d1,0x81d2,
-0x81d3,0x81d4,0x81d5,0x81d6,0x81d7,0xb0eb,0x81d8,0xb0ec,
-0x81d9,0x81da,0x81db,0x81dc,0x81dd,0x81de,0x81df,0x81e0,
-0xb0ed,0xb0ee,0x81e1,0x81e2,0xb0ef,0x81e3,0x81e4,0xb0f0,
-0xb0f1,0x81e5,0xb0f2,0x81e6,0xb0f3,0x81e7,0x81e8,0xb0f4,
-0xb0f5,0xb0f6,0x81e9,0xb0f7,0x81ea,0xb0f8,0xb0f9,0x81eb,
-0x81ec,0x81ed,0x81ee,0x81ef,0xb0fa,0xb0fb,0x81f0,0x81f1,
-/* 0xad00 */
-0xb0fc,0x81f2,0x81f3,0x81f4,0xb0fd,0x81f5,0xb0fe,0x81f6,
-0x81f7,0x81f8,0x81f9,0x81fa,0xb1a1,0xb1a2,0x81fb,0xb1a3,
-0x81fc,0xb1a4,0x81fd,0x81fe,0x8241,0x8242,0x8243,0x8244,
-0xb1a5,0x8245,0x8246,0x8247,0xb1a6,0x8248,0x8249,0x824a,
-0xb1a7,0x824b,0x824c,0x824d,0x824e,0x824f,0x8250,0x8251,
-0x8252,0xb1a8,0x8253,0x8254,0xb1a9,0xb1aa,0x8255,0x8256,
-0x8257,0x8258,0x8259,0x825a,0xb1ab,0xb1ac,0x8261,0x8262,
-0xb1ad,0x8263,0x8264,0x8265,0xb1ae,0x8266,0x8267,0x8268,
-0x8269,0x826a,0x826b,0x826c,0xb1af,0xb1b0,0x826d,0xb1b1,
-0x826e,0xb1b2,0x826f,0x8270,0x8271,0x8272,0x8273,0x8274,
-0xb1b3,0x8275,0x8276,0x8277,0xb1b4,0x8278,0x8279,0x827a,
-0xb1b5,0x8281,0x8282,0x8283,0x8284,0x8285,0x8286,0x8287,
-0x8288,0xb1b6,0x8289,0xb1b7,0x828a,0x828b,0x828c,0x828d,
-0x828e,0x828f,0x8290,0x8291,0xb1b8,0xb1b9,0x8292,0x8293,
-0xb1ba,0x8294,0x8295,0xb1bb,0xb1bc,0xb1bd,0xb1be,0x8296,
-0x8297,0x8298,0x8299,0xb1bf,0xb1c0,0xb1c1,0x829a,0xb1c2,
-0x829b,0xb1c3,0xb1c4,0x829c,0x829d,0x829e,0x829f,0x82a0,
-0xb1c5,0xb1c6,0x82a1,0x82a2,0xb1c7,0x82a3,0x82a4,0x82a5,
-0xb1c8,0x82a6,0x82a7,0x82a8,0x82a9,0x82aa,0x82ab,0x82ac,
-0x82ad,0x82ae,0x82af,0x82b0,0xb1c9,0xb1ca,0x82b1,0x82b2,
-0x82b3,0x82b4,0x82b5,0x82b6,0xb1cb,0x82b7,0x82b8,0x82b9,
-0x82ba,0x82bb,0x82bc,0x82bd,0x82be,0x82bf,0x82c0,0x82c1,
-0x82c2,0x82c3,0x82c4,0x82c5,0x82c6,0x82c7,0x82c8,0xb1cc,
-0x82c9,0x82ca,0x82cb,0x82cc,0x82cd,0x82ce,0x82cf,0x82d0,
-0xb1cd,0xb1ce,0x82d1,0x82d2,0xb1cf,0x82d3,0x82d4,0x82d5,
-0xb1d0,0x82d6,0x82d7,0x82d8,0x82d9,0x82da,0x82db,0x82dc,
-0xb1d1,0xb1d2,0x82dd,0xb1d3,0x82de,0x82df,0x82e0,0x82e1,
-0x82e2,0x82e3,0x82e4,0x82e5,0xb1d4,0x82e6,0x82e7,0x82e8,
-0xb1d5,0x82e9,0x82ea,0x82eb,0xb1d6,0x82ec,0x82ed,0x82ee,
-0x82ef,0x82f0,0x82f1,0x82f2,0x82f3,0x82f4,0x82f5,0x82f6,
-0x82f7,0x82f8,0x82f9,0x82fa,0x82fb,0x82fc,0x82fd,0x82fe,
-0xb1d7,0xb1d8,0x8341,0x8342,0xb1d9,0x8343,0x8344,0xb1da,
-/* 0xae00 */
-0xb1db,0xb1dc,0x8345,0x8346,0x8347,0x8348,0x8349,0x834a,
-0xb1dd,0xb1de,0x834b,0xb1df,0x834c,0xb1e0,0x834d,0x834e,
-0x834f,0x8350,0x8351,0x8352,0xb1e1,0x8353,0x8354,0x8355,
-0x8356,0x8357,0x8358,0x8359,0x835a,0x8361,0x8362,0x8363,
-0x8364,0x8365,0x8366,0x8367,0x8368,0x8369,0x836a,0x836b,
-0x836c,0x836d,0x836e,0x836f,0x8370,0x8371,0x8372,0x8373,
-0xb1e2,0xb1e3,0x8374,0x8375,0xb1e4,0x8376,0x8377,0xb1e5,
-0xb1e6,0x8378,0xb1e7,0x8379,0x837a,0x8381,0x8382,0x8383,
-0xb1e8,0xb1e9,0x8384,0xb1ea,0x8385,0xb1eb,0xb1ec,0x8386,
-0x8387,0x8388,0xb1ed,0x8389,0xb1ee,0xb1ef,0xb1f0,0x838a,
-0xb1f1,0x838b,0x838c,0x838d,0xb1f2,0x838e,0xb1f3,0x838f,
-0x8390,0x8391,0x8392,0x8393,0xb1f4,0xb1f5,0x8394,0xb1f6,
-0xb1f7,0xb1f8,0x8395,0x8396,0x8397,0xb1f9,0x8398,0x8399,
-0xb1fa,0xb1fb,0x839a,0x839b,0xb1fc,0x839c,0x839d,0x839e,
-0xb1fd,0x839f,0x83a0,0x83a1,0x83a2,0x83a3,0x83a4,0x83a5,
-0xb1fe,0xb2a1,0x83a6,0xb2a2,0xb2a3,0xb2a4,0x83a7,0x83a8,
-0x83a9,0x83aa,0x83ab,0x83ac,0xb2a5,0xb2a6,0x83ad,0x83ae,
-0x83af,0x83b0,0x83b1,0x83b2,0xb2a7,0x83b3,0x83b4,0x83b5,
-0x83b6,0x83b7,0x83b8,0x83b9,0x83ba,0x83bb,0x83bc,0x83bd,
-0x83be,0x83bf,0x83c0,0x83c1,0x83c2,0x83c3,0x83c4,0x83c5,
-0x83c6,0x83c7,0x83c8,0x83c9,0x83ca,0x83cb,0x83cc,0x83cd,
-0x83ce,0x83cf,0x83d0,0x83d1,0x83d2,0x83d3,0x83d4,0x83d5,
-0x83d6,0x83d7,0x83d8,0x83d9,0x83da,0x83db,0x83dc,0x83dd,
-0x83de,0x83df,0x83e0,0x83e1,0xb2a8,0xb2a9,0xb2aa,0x83e2,
-0xb2ab,0x83e3,0x83e4,0x83e5,0xb2ac,0x83e6,0x83e7,0x83e8,
-0x83e9,0x83ea,0x83eb,0x83ec,0xb2ad,0xb2ae,0x83ed,0xb2af,
-0xb2b0,0xb2b1,0x83ee,0x83ef,0x83f0,0x83f1,0x83f2,0x83f3,
-0xb2b2,0xb2b3,0x83f4,0x83f5,0xb2b4,0x83f6,0x83f7,0x83f8,
-0x83f9,0x83fa,0x83fb,0x83fc,0x83fd,0x83fe,0x8441,0x8442,
-0xb2b5,0x8443,0x8444,0xb2b6,0x8445,0xb2b7,0x8446,0x8447,
-0x8448,0x8449,0x844a,0x844b,0xb2b8,0x844c,0x844d,0x844e,
-0xb2b9,0x844f,0x8450,0x8451,0xb2ba,0x8452,0x8453,0x8454,
-/* 0xaf00 */
-0x8455,0x8456,0x8457,0x8458,0x8459,0x845a,0x8461,0xb2bb,
-0xb2bc,0x8462,0x8463,0x8464,0x8465,0xb2bd,0x8466,0x8467,
-0xb2be,0x8468,0x8469,0x846a,0x846b,0x846c,0x846d,0x846e,
-0x846f,0x8470,0x8471,0x8472,0x8473,0x8474,0x8475,0x8476,
-0x8477,0x8478,0x8479,0x847a,0x8481,0x8482,0x8483,0x8484,
-0x8485,0x8486,0x8487,0x8488,0xb2bf,0xb2c0,0x8489,0x848a,
-0xb2c1,0x848b,0xb2c2,0x848c,0xb2c3,0x848d,0x848e,0x848f,
-0x8490,0x8491,0x8492,0x8493,0xb2c4,0xb2c5,0x8494,0xb2c6,
-0x8495,0xb2c7,0xb2c8,0xb2c9,0x8496,0x8497,0x8498,0x8499,
-0xb2ca,0xb2cb,0x849a,0x849b,0x849c,0x849d,0x849e,0x849f,
-0xb2cc,0x84a0,0x84a1,0x84a2,0x84a3,0x84a4,0x84a5,0x84a6,
-0x84a7,0x84a8,0x84a9,0x84aa,0xb2cd,0xb2ce,0x84ab,0x84ac,
-0x84ad,0x84ae,0x84af,0x84b0,0xb2cf,0xb2d0,0x84b1,0x84b2,
-0x84b3,0x84b4,0x84b5,0x84b6,0x84b7,0x84b8,0x84b9,0x84ba,
-0x84bb,0x84bc,0x84bd,0x84be,0x84bf,0x84c0,0x84c1,0x84c2,
-0x84c3,0xb2d1,0x84c4,0x84c5,0x84c6,0x84c7,0x84c8,0x84c9,
-0xb2d2,0x84ca,0x84cb,0x84cc,0xb2d3,0x84cd,0x84ce,0x84cf,
-0xb2d4,0x84d0,0x84d1,0x84d2,0x84d3,0x84d4,0x84d5,0x84d6,
-0xb2d5,0xb2d6,0x84d7,0x84d8,0x84d9,0xb2d7,0x84da,0x84db,
-0x84dc,0x84dd,0x84de,0x84df,0xb2d8,0x84e0,0x84e1,0x84e2,
-0x84e3,0x84e4,0x84e5,0x84e6,0x84e7,0x84e8,0x84e9,0x84ea,
-0x84eb,0x84ec,0x84ed,0x84ee,0x84ef,0x84f0,0x84f1,0x84f2,
-0x84f3,0x84f4,0x84f5,0x84f6,0x84f7,0x84f8,0x84f9,0x84fa,
-0xb2d9,0xb2da,0x84fb,0x84fc,0xb2db,0x84fd,0x84fe,0x8541,
-0xb2dc,0x8542,0x8543,0x8544,0x8545,0x8546,0x8547,0xb2dd,
-0xb2de,0xb2df,0x8548,0xb2e0,0x8549,0xb2e1,0xb2e2,0x854a,
-0x854b,0x854c,0x854d,0x854e,0xb2e3,0x854f,0x8550,0x8551,
-0x8552,0x8553,0x8554,0x8555,0xb2e4,0x8556,0x8557,0x8558,
-0x8559,0x855a,0x8561,0x8562,0x8563,0x8564,0x8565,0x8566,
-0xb2e5,0xb2e6,0x8567,0x8568,0x8569,0x856a,0x856b,0x856c,
-0xb2e7,0xb2e8,0x856d,0x856e,0xb2e9,0x856f,0x8570,0x8571,
-0xb2ea,0x8572,0x8573,0x8574,0x8575,0x8576,0x8577,0x8578,
-/* 0xb000 */
-0xb2eb,0xb2ec,0x8579,0x857a,0xb2ed,0x8581,0x8582,0x8583,
-0x8584,0x8585,0x8586,0x8587,0xb2ee,0x8588,0x8589,0x858a,
-0xb2ef,0x858b,0x858c,0x858d,0xb2f0,0x858e,0x858f,0x8590,
-0x8591,0x8592,0x8593,0x8594,0xb2f1,0xb2f2,0x8595,0x8596,
-0x8597,0x8598,0x8599,0x859a,0x859b,0x859c,0x859d,0x859e,
-0xb2f3,0x859f,0x85a0,0x85a1,0x85a2,0x85a3,0x85a4,0x85a5,
-0x85a6,0x85a7,0x85a8,0x85a9,0x85aa,0x85ab,0x85ac,0x85ad,
-0x85ae,0x85af,0x85b0,0x85b1,0x85b2,0x85b3,0x85b4,0x85b5,
-0x85b6,0x85b7,0x85b8,0x85b9,0xb2f4,0xb2f5,0x85ba,0x85bb,
-0xb2f6,0x85bc,0xb2f7,0x85bd,0xb2f8,0x85be,0xb2f9,0x85bf,
-0x85c0,0x85c1,0x85c2,0xb2fa,0xb2fb,0xb2fc,0x85c3,0xb2fd,
-0x85c4,0xb2fe,0x85c5,0x85c6,0x85c7,0xb3a1,0x85c8,0x85c9,
-0x85ca,0x85cb,0x85cc,0x85cd,0x85ce,0x85cf,0x85d0,0x85d1,
-0x85d2,0x85d3,0x85d4,0x85d5,0x85d6,0x85d7,0x85d8,0x85d9,
-0x85da,0x85db,0x85dc,0x85dd,0x85de,0x85df,0x85e0,0x85e1,
-0x85e2,0x85e3,0x85e4,0x85e5,0xb3a2,0xb3a3,0x85e6,0x85e7,
-0xb3a4,0x85e8,0x85e9,0x85ea,0xb3a5,0x85eb,0x85ec,0x85ed,
-0x85ee,0x85ef,0x85f0,0x85f1,0xb3a6,0xb3a7,0x85f2,0xb3a8,
-0x85f3,0xb3a9,0x85f4,0x85f5,0x85f6,0x85f7,0x85f8,0x85f9,
-0xb3aa,0xb3ab,0xb3ac,0x85fa,0xb3ad,0x85fb,0x85fc,0xb3ae,
-0xb3af,0xb3b0,0xb3b1,0x85fd,0x85fe,0x8641,0x8642,0x8643,
-0xb3b2,0xb3b3,0x8644,0xb3b4,0xb3b5,0xb3b6,0xb3b7,0xb3b8,
-0x8645,0xb3b9,0x8646,0xb3ba,0xb3bb,0xb3bc,0x8647,0x8648,
-0xb3bd,0x8649,0x864a,0x864b,0xb3be,0x864c,0x864d,0x864e,
-0x864f,0x8650,0x8651,0x8652,0xb3bf,0xb3c0,0x8653,0xb3c1,
-0xb3c2,0xb3c3,0x8654,0x8655,0x8656,0x8657,0x8658,0x8659,
-0xb3c4,0xb3c5,0x865a,0x8661,0xb3c6,0x8662,0x8663,0x8664,
-0xb3c7,0x8665,0x8666,0x8667,0x8668,0x8669,0x866a,0x866b,
-0xb3c8,0x866c,0x866d,0x866e,0x866f,0xb3c9,0x8670,0x8671,
-0x8672,0x8673,0x8674,0x8675,0x8676,0x8677,0x8678,0x8679,
-0x867a,0x8681,0x8682,0x8683,0x8684,0x8685,0x8686,0x8687,
-0x8688,0x8689,0x868a,0x868b,0x868c,0x868d,0x868e,0x868f,
-/* 0xb100 */
-0x8690,0x8691,0x8692,0x8693,0x8694,0x8695,0x8696,0x8697,
-0xb3ca,0xb3cb,0x8698,0xb3cc,0xb3cd,0x8699,0x869a,0x869b,
-0xb3ce,0x869c,0xb3cf,0xb3d0,0x869d,0x869e,0x869f,0x86a0,
-0xb3d1,0xb3d2,0x86a1,0xb3d3,0xb3d4,0xb3d5,0x86a2,0x86a3,
-0x86a4,0x86a5,0x86a6,0xb3d6,0xb3d7,0xb3d8,0x86a7,0x86a8,
-0xb3d9,0x86a9,0x86aa,0x86ab,0xb3da,0x86ac,0x86ad,0x86ae,
-0x86af,0x86b0,0x86b1,0x86b2,0xb3db,0xb3dc,0x86b3,0xb3dd,
-0xb3de,0xb3df,0x86b4,0x86b5,0x86b6,0x86b7,0x86b8,0x86b9,
-0xb3e0,0xb3e1,0x86ba,0x86bb,0xb3e2,0x86bc,0x86bd,0x86be,
-0xb3e3,0x86bf,0x86c0,0x86c1,0x86c2,0x86c3,0x86c4,0x86c5,
-0xb3e4,0xb3e5,0x86c6,0x86c7,0xb3e6,0xb3e7,0x86c8,0x86c9,
-0xb3e8,0x86ca,0x86cb,0x86cc,0xb3e9,0x86cd,0x86ce,0x86cf,
-0xb3ea,0x86d0,0x86d1,0x86d2,0x86d3,0x86d4,0x86d5,0x86d6,
-0x86d7,0x86d8,0x86d9,0x86da,0x86db,0x86dc,0x86dd,0x86de,
-0x86df,0x86e0,0x86e1,0x86e2,0x86e3,0x86e4,0x86e5,0x86e6,
-0xb3eb,0xb3ec,0x86e7,0x86e8,0xb3ed,0x86e9,0x86ea,0x86eb,
-0xb3ee,0x86ec,0xb3ef,0x86ed,0x86ee,0x86ef,0x86f0,0x86f1,
-0xb3f0,0xb3f1,0x86f2,0xb3f2,0x86f3,0xb3f3,0x86f4,0x86f5,
-0x86f6,0x86f7,0xb3f4,0xb3f5,0xb3f6,0x86f8,0x86f9,0x86fa,
-0xb3f7,0x86fb,0x86fc,0x86fd,0xb3f8,0x86fe,0x8741,0x8742,
-0x8743,0x8744,0x8745,0x8746,0x8747,0x8748,0x8749,0x874a,
-0xb3f9,0x874b,0x874c,0x874d,0x874e,0x874f,0x8750,0x8751,
-0x8752,0x8753,0x8754,0x8755,0x8756,0x8757,0x8758,0x8759,
-0x875a,0x8761,0x8762,0x8763,0x8764,0x8765,0x8766,0x8767,
-0x8768,0x8769,0x876a,0x876b,0x876c,0x876d,0x876e,0x876f,
-0x8770,0x8771,0x8772,0x8773,0xb3fa,0x8774,0x8775,0x8776,
-0xb3fb,0x8777,0x8778,0x8779,0xb3fc,0x877a,0x8781,0x8782,
-0x8783,0x8784,0x8785,0x8786,0xb3fd,0xb3fe,0x8787,0xb4a1,
-0x8788,0x8789,0x878a,0x878b,0x878c,0x878d,0x878e,0x878f,
-0xb4a2,0xb4a3,0x8790,0x8791,0xb4a4,0x8792,0x8793,0x8794,
-0xb4a5,0x8795,0x8796,0x8797,0x8798,0x8799,0x879a,0x879b,
-0x879c,0xb4a6,0x879d,0xb4a7,0x879e,0xb4a8,0x879f,0x87a0,
-/* 0xb200 */
-0x87a1,0x87a2,0x87a3,0x87a4,0xb4a9,0xb4aa,0x87a5,0x87a6,
-0xb4ab,0x87a7,0x87a8,0xb4ac,0xb4ad,0x87a9,0x87aa,0x87ab,
-0x87ac,0x87ad,0x87ae,0x87af,0xb4ae,0xb4af,0x87b0,0xb4b0,
-0x87b1,0xb4b1,0x87b2,0x87b3,0x87b4,0x87b5,0x87b6,0x87b7,
-0xb4b2,0x87b8,0x87b9,0x87ba,0x87bb,0x87bc,0x87bd,0x87be,
-0x87bf,0x87c0,0x87c1,0x87c2,0x87c3,0x87c4,0x87c5,0x87c6,
-0x87c7,0x87c8,0x87c9,0x87ca,0xb4b3,0x87cb,0x87cc,0x87cd,
-0x87ce,0x87cf,0x87d0,0x87d1,0xb4b4,0x87d2,0x87d3,0x87d4,
-0x87d5,0x87d6,0x87d7,0x87d8,0x87d9,0x87da,0x87db,0x87dc,
-0x87dd,0x87de,0x87df,0x87e0,0x87e1,0x87e2,0x87e3,0x87e4,
-0x87e5,0x87e6,0x87e7,0x87e8,0x87e9,0x87ea,0x87eb,0x87ec,
-0xb4b5,0x87ed,0x87ee,0x87ef,0xb4b6,0x87f0,0x87f1,0x87f2,
-0xb4b7,0x87f3,0x87f4,0x87f5,0x87f6,0x87f7,0x87f8,0x87f9,
-0xb4b8,0xb4b9,0x87fa,0x87fb,0x87fc,0x87fd,0x87fe,0x8841,
-0x8842,0x8843,0x8844,0x8845,0xb4ba,0xb4bb,0x8846,0x8847,
-0x8848,0x8849,0x884a,0x884b,0xb4bc,0x884c,0x884d,0x884e,
-0x884f,0x8850,0x8851,0x8852,0xb4bd,0xb4be,0x8853,0x8854,
-0x8855,0xb4bf,0x8856,0x8857,0x8858,0x8859,0x885a,0x8861,
-0xb4c0,0xb4c1,0x8862,0x8863,0xb4c2,0x8864,0x8865,0x8866,
-0xb4c3,0xb4c4,0xb4c5,0x8867,0x8868,0x8869,0x886a,0x886b,
-0xb4c6,0xb4c7,0x886c,0xb4c8,0x886d,0xb4c9,0xb4ca,0x886e,
-0x886f,0x8870,0xb4cb,0x8871,0xb4cc,0x8872,0x8873,0x8874,
-0xb4cd,0x8875,0x8876,0x8877,0xb4ce,0x8878,0x8879,0x887a,
-0x8881,0x8882,0x8883,0x8884,0x8885,0x8886,0x8887,0x8888,
-0x8889,0x888a,0x888b,0x888c,0x888d,0x888e,0x888f,0x8890,
-0xb4cf,0xb4d0,0x8891,0x8892,0xb4d1,0x8893,0x8894,0x8895,
-0xb4d2,0x8896,0xb4d3,0x8897,0x8898,0x8899,0x889a,0x889b,
-0xb4d4,0xb4d5,0x889c,0xb4d6,0x889d,0xb4d7,0x889e,0x889f,
-0x88a0,0x88a1,0xb4d8,0x88a2,0xb4d9,0xb4da,0xb4db,0x88a3,
-0xb4dc,0x88a4,0x88a5,0xb4dd,0xb4de,0xb4df,0xb4e0,0xb4e1,
-0x88a6,0x88a7,0x88a8,0xb4e2,0xb4e3,0xb4e4,0x88a9,0xb4e5,
-0xb4e6,0xb4e7,0xb4e8,0xb4e9,0x88aa,0x88ab,0x88ac,0xb4ea,
-/* 0xb300 */
-0xb4eb,0xb4ec,0x88ad,0x88ae,0xb4ed,0x88af,0x88b0,0x88b1,
-0xb4ee,0x88b2,0x88b3,0x88b4,0x88b5,0x88b6,0x88b7,0x88b8,
-0xb4ef,0xb4f0,0x88b9,0xb4f1,0xb4f2,0xb4f3,0x88ba,0x88bb,
-0x88bc,0x88bd,0x88be,0x88bf,0xb4f4,0x88c0,0x88c1,0x88c2,
-0x88c3,0x88c4,0x88c5,0x88c6,0x88c7,0x88c8,0x88c9,0x88ca,
-0x88cb,0x88cc,0x88cd,0x88ce,0x88cf,0x88d0,0x88d1,0x88d2,
-0x88d3,0x88d4,0x88d5,0x88d6,0x88d7,0x88d8,0x88d9,0x88da,
-0x88db,0x88dc,0x88dd,0x88de,0x88df,0x88e0,0x88e1,0x88e2,
-0x88e3,0x88e4,0x88e5,0x88e6,0x88e7,0x88e8,0x88e9,0x88ea,
-0x88eb,0x88ec,0x88ed,0x88ee,0x88ef,0x88f0,0x88f1,0x88f2,
-0x88f3,0x88f4,0x88f5,0x88f6,0xb4f5,0xb4f6,0xb4f7,0x88f7,
-0xb4f8,0x88f8,0x88f9,0xb4f9,0xb4fa,0x88fa,0xb4fb,0xb4fc,
-0x88fb,0x88fc,0x88fd,0x88fe,0xb4fd,0xb4fe,0x8941,0xb5a1,
-0x8942,0xb5a2,0x8943,0xb5a3,0x8944,0x8945,0xb5a4,0x8946,
-0xb5a5,0xb5a6,0x8947,0x8948,0xb5a7,0x8949,0x894a,0x894b,
-0xb5a8,0x894c,0x894d,0x894e,0x894f,0x8950,0x8951,0x8952,
-0xb5a9,0xb5aa,0x8953,0xb5ab,0xb5ac,0xb5ad,0x8954,0x8955,
-0x8956,0x8957,0x8958,0x8959,0xb5ae,0x895a,0x8961,0x8962,
-0xb5af,0x8963,0x8964,0x8965,0xb5b0,0x8966,0x8967,0x8968,
-0x8969,0x896a,0x896b,0x896c,0x896d,0x896e,0x896f,0x8970,
-0xb5b1,0xb5b2,0x8971,0x8972,0x8973,0x8974,0x8975,0x8976,
-0xb5b3,0x8977,0x8978,0x8979,0xb5b4,0x897a,0x8981,0x8982,
-0x8983,0x8984,0x8985,0x8986,0x8987,0x8988,0x8989,0x898a,
-0x898b,0x898c,0x898d,0x898e,0x898f,0x8990,0x8991,0x8992,
-0x8993,0x8994,0x8995,0x8996,0xb5b5,0xb5b6,0x8997,0x8998,
-0xb5b7,0x8999,0x899a,0xb5b8,0xb5b9,0x899b,0xb5ba,0x899c,
-0xb5bb,0x899d,0x899e,0x899f,0xb5bc,0xb5bd,0x89a0,0xb5be,
-0x89a1,0xb5bf,0x89a2,0xb5c0,0x89a3,0xb5c1,0x89a4,0x89a5,
-0xb5c2,0x89a6,0x89a7,0x89a8,0xb5c3,0x89a9,0x89aa,0x89ab,
-0xb5c4,0x89ac,0x89ad,0x89ae,0x89af,0x89b0,0x89b1,0x89b2,
-0x89b3,0x89b4,0x89b5,0x89b6,0x89b7,0x89b8,0x89b9,0x89ba,
-0x89bb,0x89bc,0x89bd,0x89be,0xb5c5,0x89bf,0x89c0,0x89c1,
-/* 0xb400 */
-0x89c2,0x89c3,0x89c4,0x89c5,0x89c6,0x89c7,0x89c8,0x89c9,
-0x89ca,0x89cb,0x89cc,0x89cd,0x89ce,0x89cf,0x89d0,0x89d1,
-0xb5c6,0x89d2,0x89d3,0x89d4,0x89d5,0x89d6,0x89d7,0x89d8,
-0xb5c7,0x89d9,0x89da,0x89db,0xb5c8,0x89dc,0x89dd,0x89de,
-0xb5c9,0x89df,0x89e0,0x89e1,0x89e2,0x89e3,0x89e4,0x89e5,
-0xb5ca,0xb5cb,0x89e6,0xb5cc,0x89e7,0x89e8,0x89e9,0x89ea,
-0x89eb,0x89ec,0x89ed,0x89ee,0xb5cd,0x89ef,0x89f0,0x89f1,
-0x89f2,0x89f3,0x89f4,0x89f5,0x89f6,0x89f7,0x89f8,0x89f9,
-0x89fa,0x89fb,0x89fc,0x89fd,0x89fe,0x8a41,0x8a42,0x8a43,
-0x8a44,0x8a45,0x8a46,0x8a47,0x8a48,0x8a49,0x8a4a,0x8a4b,
-0xb5ce,0xb5cf,0x8a4c,0x8a4d,0xb5d0,0x8a4e,0x8a4f,0x8a50,
-0xb5d1,0x8a51,0x8a52,0x8a53,0x8a54,0x8a55,0x8a56,0x8a57,
-0xb5d2,0xb5d3,0x8a58,0xb5d4,0x8a59,0xb5d5,0x8a5a,0x8a61,
-0x8a62,0x8a63,0x8a64,0x8a65,0xb5d6,0x8a66,0x8a67,0x8a68,
-0x8a69,0x8a6a,0x8a6b,0x8a6c,0x8a6d,0x8a6e,0x8a6f,0x8a70,
-0x8a71,0x8a72,0x8a73,0x8a74,0x8a75,0x8a76,0x8a77,0x8a78,
-0xb5d7,0x8a79,0x8a7a,0x8a81,0x8a82,0x8a83,0x8a84,0x8a85,
-0xb5d8,0x8a86,0x8a87,0x8a88,0x8a89,0x8a8a,0x8a8b,0x8a8c,
-0x8a8d,0x8a8e,0x8a8f,0x8a90,0x8a91,0x8a92,0x8a93,0x8a94,
-0x8a95,0x8a96,0x8a97,0x8a98,0x8a99,0xb5d9,0x8a9a,0x8a9b,
-0x8a9c,0x8a9d,0x8a9e,0x8a9f,0xb5da,0x8aa0,0x8aa1,0x8aa2,
-0xb5db,0x8aa3,0x8aa4,0x8aa5,0xb5dc,0x8aa6,0x8aa7,0x8aa8,
-0x8aa9,0x8aaa,0x8aab,0x8aac,0x8aad,0xb5dd,0x8aae,0xb5de,
-0x8aaf,0xb5df,0x8ab0,0x8ab1,0x8ab2,0x8ab3,0x8ab4,0x8ab5,
-0xb5e0,0x8ab6,0x8ab7,0x8ab8,0xb5e1,0x8ab9,0x8aba,0x8abb,
-0xb5e2,0x8abc,0x8abd,0x8abe,0x8abf,0x8ac0,0x8ac1,0x8ac2,
-0xb5e3,0x8ac3,0x8ac4,0x8ac5,0x8ac6,0xb5e4,0x8ac7,0x8ac8,
-0x8ac9,0x8aca,0x8acb,0x8acc,0xb5e5,0xb5e6,0x8acd,0x8ace,
-0xb5e7,0x8acf,0x8ad0,0xb5e8,0xb5e9,0x8ad1,0xb5ea,0x8ad2,
-0x8ad3,0x8ad4,0x8ad5,0x8ad6,0xb5eb,0xb5ec,0x8ad7,0xb5ed,
-0x8ad8,0xb5ee,0x8ad9,0x8ada,0x8adb,0x8adc,0x8add,0x8ade,
-0xb5ef,0x8adf,0x8ae0,0x8ae1,0x8ae2,0x8ae3,0x8ae4,0x8ae5,
-/* 0xb500 */
-0x8ae6,0x8ae7,0x8ae8,0x8ae9,0x8aea,0x8aeb,0x8aec,0x8aed,
-0x8aee,0x8aef,0x8af0,0x8af1,0x8af2,0x8af3,0x8af4,0x8af5,
-0x8af6,0x8af7,0x8af8,0x8af9,0xb5f0,0xb5f1,0x8afa,0x8afb,
-0xb5f2,0x8afc,0x8afd,0xb5f3,0xb5f4,0x8afe,0x8b41,0x8b42,
-0x8b43,0x8b44,0x8b45,0x8b46,0xb5f5,0xb5f6,0x8b47,0xb5f7,
-0xb5f8,0xb5f9,0xb5fa,0x8b48,0x8b49,0x8b4a,0x8b4b,0x8b4c,
-0xb5fb,0xb5fc,0x8b4d,0x8b4e,0xb5fd,0x8b4f,0x8b50,0x8b51,
-0xb5fe,0x8b52,0x8b53,0x8b54,0x8b55,0x8b56,0x8b57,0x8b58,
-0xb6a1,0xb6a2,0x8b59,0xb6a3,0xb6a4,0xb6a5,0x8b5a,0x8b61,
-0x8b62,0x8b63,0x8b64,0xb6a6,0xb6a7,0xb6a8,0x8b65,0x8b66,
-0xb6a9,0x8b67,0x8b68,0x8b69,0xb6aa,0x8b6a,0x8b6b,0x8b6c,
-0x8b6d,0x8b6e,0x8b6f,0x8b70,0xb6ab,0xb6ac,0x8b71,0xb6ad,
-0xb6ae,0xb6af,0x8b72,0x8b73,0x8b74,0x8b75,0x8b76,0x8b77,
-0x8b78,0x8b79,0x8b7a,0x8b81,0x8b82,0x8b83,0x8b84,0x8b85,
-0x8b86,0x8b87,0x8b88,0x8b89,0x8b8a,0x8b8b,0x8b8c,0x8b8d,
-0x8b8e,0x8b8f,0x8b90,0x8b91,0x8b92,0x8b93,0x8b94,0x8b95,
-0x8b96,0x8b97,0x8b98,0x8b99,0x8b9a,0x8b9b,0x8b9c,0x8b9d,
-0x8b9e,0x8b9f,0x8ba0,0x8ba1,0x8ba2,0x8ba3,0x8ba4,0x8ba5,
-0x8ba6,0x8ba7,0x8ba8,0x8ba9,0x8baa,0x8bab,0x8bac,0x8bad,
-0x8bae,0x8baf,0x8bb0,0x8bb1,0x8bb2,0x8bb3,0x8bb4,0x8bb5,
-0xb6b0,0xb6b1,0x8bb6,0x8bb7,0xb6b2,0x8bb8,0x8bb9,0x8bba,
-0xb6b3,0x8bbb,0xb6b4,0xb6b5,0x8bbc,0x8bbd,0x8bbe,0x8bbf,
-0xb6b6,0xb6b7,0x8bc0,0xb6b8,0xb6b9,0xb6ba,0x8bc1,0x8bc2,
-0x8bc3,0x8bc4,0x8bc5,0xb6bb,0xb6bc,0xb6bd,0x8bc6,0x8bc7,
-0xb6be,0x8bc8,0x8bc9,0x8bca,0xb6bf,0x8bcb,0x8bcc,0x8bcd,
-0x8bce,0x8bcf,0x8bd0,0x8bd1,0xb6c0,0xb6c1,0x8bd2,0xb6c2,
-0xb6c3,0xb6c4,0x8bd3,0x8bd4,0x8bd5,0x8bd6,0x8bd7,0x8bd8,
-0xb6c5,0x8bd9,0x8bda,0x8bdb,0x8bdc,0x8bdd,0x8bde,0x8bdf,
-0x8be0,0x8be1,0x8be2,0x8be3,0x8be4,0x8be5,0x8be6,0x8be7,
-0x8be8,0x8be9,0x8bea,0x8beb,0xb6c6,0x8bec,0x8bed,0x8bee,
-0x8bef,0x8bf0,0x8bf1,0x8bf2,0x8bf3,0x8bf4,0x8bf5,0x8bf6,
-0x8bf7,0x8bf8,0x8bf9,0x8bfa,0x8bfb,0x8bfc,0x8bfd,0x8bfe,
-/* 0xb600 */
-0x8c41,0x8c42,0x8c43,0x8c44,0x8c45,0x8c46,0x8c47,0x8c48,
-0x8c49,0x8c4a,0x8c4b,0x8c4c,0x8c4d,0x8c4e,0x8c4f,0x8c50,
-0xb6c7,0xb6c8,0x8c51,0x8c52,0xb6c9,0x8c53,0x8c54,0x8c55,
-0xb6ca,0x8c56,0x8c57,0x8c58,0x8c59,0x8c5a,0x8c61,0x8c62,
-0x8c63,0x8c64,0x8c65,0x8c66,0x8c67,0xb6cb,0x8c68,0x8c69,
-0x8c6a,0x8c6b,0x8c6c,0x8c6d,0xb6cc,0x8c6e,0x8c6f,0x8c70,
-0x8c71,0x8c72,0x8c73,0x8c74,0xb6cd,0x8c75,0x8c76,0x8c77,
-0x8c78,0x8c79,0x8c7a,0x8c81,0x8c82,0x8c83,0x8c84,0x8c85,
-0x8c86,0x8c87,0x8c88,0x8c89,0x8c8a,0x8c8b,0x8c8c,0x8c8d,
-0xb6ce,0x8c8e,0x8c8f,0x8c90,0x8c91,0x8c92,0x8c93,0x8c94,
-0x8c95,0x8c96,0x8c97,0x8c98,0x8c99,0x8c9a,0x8c9b,0x8c9c,
-0x8c9d,0x8c9e,0x8c9f,0x8ca0,0x8ca1,0x8ca2,0x8ca3,0x8ca4,
-0x8ca5,0x8ca6,0x8ca7,0x8ca8,0xb6cf,0x8ca9,0x8caa,0x8cab,
-0xb6d0,0x8cac,0x8cad,0x8cae,0x8caf,0x8cb0,0x8cb1,0x8cb2,
-0x8cb3,0x8cb4,0x8cb5,0x8cb6,0x8cb7,0x8cb8,0x8cb9,0x8cba,
-0x8cbb,0x8cbc,0x8cbd,0x8cbe,0x8cbf,0x8cc0,0x8cc1,0x8cc2,
-0x8cc3,0x8cc4,0x8cc5,0x8cc6,0x8cc7,0x8cc8,0x8cc9,0x8cca,
-0x8ccb,0x8ccc,0x8ccd,0x8cce,0x8ccf,0x8cd0,0x8cd1,0x8cd2,
-0x8cd3,0x8cd4,0x8cd5,0x8cd6,0x8cd7,0x8cd8,0x8cd9,0x8cda,
-0x8cdb,0x8cdc,0x8cdd,0x8cde,0xb6d1,0xb6d2,0x8cdf,0x8ce0,
-0xb6d3,0x8ce1,0x8ce2,0x8ce3,0xb6d4,0x8ce4,0x8ce5,0x8ce6,
-0x8ce7,0x8ce8,0x8ce9,0xb6d5,0xb6d6,0x8cea,0x8ceb,0x8cec,
-0x8ced,0xb6d7,0x8cee,0x8cef,0x8cf0,0x8cf1,0x8cf2,0x8cf3,
-0x8cf4,0x8cf5,0x8cf6,0x8cf7,0x8cf8,0x8cf9,0x8cfa,0x8cfb,
-0x8cfc,0x8cfd,0x8cfe,0x8d41,0x8d42,0x8d43,0x8d44,0x8d45,
-0x8d46,0x8d47,0x8d48,0x8d49,0x8d4a,0x8d4b,0x8d4c,0x8d4d,
-0x8d4e,0x8d4f,0x8d50,0x8d51,0xb6d8,0x8d52,0x8d53,0x8d54,
-0x8d55,0x8d56,0x8d57,0x8d58,0x8d59,0x8d5a,0x8d61,0x8d62,
-0x8d63,0x8d64,0x8d65,0x8d66,0x8d67,0x8d68,0x8d69,0x8d6a,
-0x8d6b,0x8d6c,0x8d6d,0x8d6e,0x8d6f,0x8d70,0x8d71,0x8d72,
-0xb6d9,0x8d73,0x8d74,0x8d75,0xb6da,0x8d76,0x8d77,0x8d78,
-0xb6db,0x8d79,0x8d7a,0x8d81,0x8d82,0x8d83,0x8d84,0x8d85,
-/* 0xb700 */
-0xb6dc,0xb6dd,0x8d86,0x8d87,0x8d88,0xb6de,0x8d89,0x8d8a,
-0x8d8b,0x8d8c,0x8d8d,0x8d8e,0x8d8f,0x8d90,0x8d91,0x8d92,
-0x8d93,0x8d94,0x8d95,0x8d96,0x8d97,0x8d98,0x8d99,0x8d9a,
-0x8d9b,0x8d9c,0x8d9d,0x8d9e,0x8d9f,0x8da0,0x8da1,0x8da2,
-0x8da3,0x8da4,0x8da5,0x8da6,0x8da7,0x8da8,0x8da9,0x8daa,
-0xb6df,0xb6e0,0x8dab,0x8dac,0xb6e1,0x8dad,0x8dae,0xb6e2,
-0xb6e3,0x8daf,0x8db0,0x8db1,0x8db2,0x8db3,0x8db4,0x8db5,
-0xb6e4,0xb6e5,0x8db6,0xb6e6,0x8db7,0x8db8,0x8db9,0x8dba,
-0x8dbb,0x8dbc,0x8dbd,0x8dbe,0xb6e7,0x8dbf,0x8dc0,0x8dc1,
-0xb6e8,0x8dc2,0x8dc3,0x8dc4,0xb6e9,0x8dc5,0x8dc6,0x8dc7,
-0x8dc8,0x8dc9,0x8dca,0x8dcb,0xb6ea,0xb6eb,0x8dcc,0x8dcd,
-0x8dce,0x8dcf,0x8dd0,0x8dd1,0x8dd2,0x8dd3,0x8dd4,0x8dd5,
-0xb6ec,0x8dd6,0x8dd7,0x8dd8,0xb6ed,0x8dd9,0x8dda,0x8ddb,
-0xb6ee,0x8ddc,0x8ddd,0x8dde,0x8ddf,0x8de0,0x8de1,0x8de2,
-0xb6ef,0xb6f0,0x8de3,0xb6f1,0x8de4,0xb6f2,0x8de5,0x8de6,
-0x8de7,0x8de8,0x8de9,0x8dea,0xb6f3,0xb6f4,0x8deb,0x8dec,
-0xb6f5,0x8ded,0x8dee,0x8def,0xb6f6,0x8df0,0x8df1,0x8df2,
-0x8df3,0x8df4,0x8df5,0x8df6,0xb6f7,0xb6f8,0x8df7,0xb6f9,
-0xb6fa,0xb6fb,0xb6fc,0x8df8,0x8df9,0x8dfa,0xb6fd,0xb6fe,
-0xb7a1,0xb7a2,0x8dfb,0x8dfc,0xb7a3,0x8dfd,0x8dfe,0x8e41,
-0xb7a4,0x8e42,0x8e43,0x8e44,0x8e45,0x8e46,0x8e47,0x8e48,
-0xb7a5,0xb7a6,0x8e49,0xb7a7,0xb7a8,0xb7a9,0x8e4a,0x8e4b,
-0x8e4c,0x8e4d,0x8e4e,0x8e4f,0xb7aa,0xb7ab,0x8e50,0x8e51,
-0xb7ac,0x8e52,0x8e53,0x8e54,0x8e55,0x8e56,0x8e57,0x8e58,
-0x8e59,0x8e5a,0x8e61,0x8e62,0x8e63,0x8e64,0x8e65,0xb7ad,
-0x8e66,0xb7ae,0x8e67,0x8e68,0x8e69,0x8e6a,0x8e6b,0x8e6c,
-0x8e6d,0x8e6e,0x8e6f,0x8e70,0x8e71,0x8e72,0x8e73,0x8e74,
-0x8e75,0x8e76,0x8e77,0x8e78,0x8e79,0x8e7a,0x8e81,0x8e82,
-0x8e83,0x8e84,0x8e85,0x8e86,0x8e87,0x8e88,0x8e89,0x8e8a,
-0x8e8b,0x8e8c,0x8e8d,0x8e8e,0xb7af,0xb7b0,0x8e8f,0x8e90,
-0xb7b1,0x8e91,0x8e92,0x8e93,0xb7b2,0x8e94,0x8e95,0x8e96,
-0x8e97,0x8e98,0x8e99,0x8e9a,0xb7b3,0xb7b4,0x8e9b,0xb7b5,
-/* 0xb800 */
-0xb7b6,0xb7b7,0x8e9c,0x8e9d,0x8e9e,0x8e9f,0x8ea0,0xb7b8,
-0xb7b9,0xb7ba,0x8ea1,0x8ea2,0xb7bb,0x8ea3,0x8ea4,0x8ea5,
-0xb7bc,0x8ea6,0x8ea7,0x8ea8,0x8ea9,0x8eaa,0x8eab,0x8eac,
-0xb7bd,0xb7be,0x8ead,0xb7bf,0x8eae,0xb7c0,0x8eaf,0x8eb0,
-0x8eb1,0x8eb2,0x8eb3,0x8eb4,0xb7c1,0xb7c2,0x8eb5,0x8eb6,
-0xb7c3,0x8eb7,0x8eb8,0x8eb9,0xb7c4,0x8eba,0x8ebb,0x8ebc,
-0x8ebd,0x8ebe,0x8ebf,0x8ec0,0xb7c5,0xb7c6,0x8ec1,0xb7c7,
-0xb7c8,0xb7c9,0x8ec2,0x8ec3,0x8ec4,0x8ec5,0x8ec6,0x8ec7,
-0xb7ca,0x8ec8,0x8ec9,0x8eca,0xb7cb,0x8ecb,0x8ecc,0x8ecd,
-0x8ece,0x8ecf,0x8ed0,0x8ed1,0x8ed2,0x8ed3,0x8ed4,0x8ed5,
-0x8ed6,0xb7cc,0x8ed7,0xb7cd,0x8ed8,0x8ed9,0x8eda,0x8edb,
-0x8edc,0x8edd,0x8ede,0x8edf,0xb7ce,0xb7cf,0x8ee0,0x8ee1,
-0xb7d0,0x8ee2,0x8ee3,0x8ee4,0xb7d1,0x8ee5,0x8ee6,0x8ee7,
-0x8ee8,0x8ee9,0x8eea,0x8eeb,0xb7d2,0xb7d3,0x8eec,0xb7d4,
-0x8eed,0xb7d5,0x8eee,0x8eef,0x8ef0,0x8ef1,0x8ef2,0x8ef3,
-0xb7d6,0x8ef4,0x8ef5,0x8ef6,0xb7d7,0x8ef7,0x8ef8,0x8ef9,
-0x8efa,0x8efb,0x8efc,0x8efd,0x8efe,0x8f41,0x8f42,0x8f43,
-0x8f44,0x8f45,0x8f46,0x8f47,0x8f48,0xb7d8,0x8f49,0x8f4a,
-0x8f4b,0x8f4c,0x8f4d,0x8f4e,0x8f4f,0x8f50,0x8f51,0x8f52,
-0x8f53,0x8f54,0x8f55,0x8f56,0x8f57,0x8f58,0x8f59,0x8f5a,
-0x8f61,0x8f62,0x8f63,0x8f64,0x8f65,0x8f66,0x8f67,0x8f68,
-0xb7d9,0x8f69,0x8f6a,0x8f6b,0x8f6c,0x8f6d,0x8f6e,0x8f6f,
-0xb7da,0x8f70,0x8f71,0x8f72,0xb7db,0x8f73,0x8f74,0x8f75,
-0xb7dc,0x8f76,0x8f77,0x8f78,0x8f79,0x8f7a,0x8f81,0x8f82,
-0xb7dd,0xb7de,0x8f83,0xb7df,0x8f84,0xb7e0,0x8f85,0x8f86,
-0x8f87,0x8f88,0x8f89,0x8f8a,0xb7e1,0x8f8b,0x8f8c,0x8f8d,
-0xb7e2,0x8f8e,0x8f8f,0x8f90,0xb7e3,0x8f91,0x8f92,0x8f93,
-0x8f94,0x8f95,0x8f96,0x8f97,0x8f98,0xb7e4,0x8f99,0xb7e5,
-0x8f9a,0xb7e6,0x8f9b,0x8f9c,0x8f9d,0x8f9e,0x8f9f,0x8fa0,
-0xb7e7,0xb7e8,0x8fa1,0x8fa2,0xb7e9,0x8fa3,0x8fa4,0x8fa5,
-0xb7ea,0x8fa6,0x8fa7,0x8fa8,0x8fa9,0x8faa,0x8fab,0x8fac,
-0xb7eb,0xb7ec,0x8fad,0xb7ed,0x8fae,0xb7ee,0x8faf,0x8fb0,
-/* 0xb900 */
-0x8fb1,0x8fb2,0x8fb3,0x8fb4,0xb7ef,0x8fb5,0x8fb6,0x8fb7,
-0x8fb8,0x8fb9,0x8fba,0x8fbb,0x8fbc,0x8fbd,0x8fbe,0x8fbf,
-0x8fc0,0x8fc1,0x8fc2,0x8fc3,0x8fc4,0x8fc5,0x8fc6,0x8fc7,
-0xb7f0,0x8fc8,0x8fc9,0x8fca,0x8fcb,0x8fcc,0x8fcd,0x8fce,
-0xb7f1,0x8fcf,0x8fd0,0x8fd1,0x8fd2,0x8fd3,0x8fd4,0x8fd5,
-0x8fd6,0x8fd7,0x8fd8,0x8fd9,0x8fda,0x8fdb,0x8fdc,0x8fdd,
-0x8fde,0x8fdf,0x8fe0,0x8fe1,0x8fe2,0x8fe3,0x8fe4,0x8fe5,
-0x8fe6,0x8fe7,0x8fe8,0x8fe9,0xb7f2,0xb7f3,0x8fea,0x8feb,
-0xb7f4,0x8fec,0x8fed,0x8fee,0xb7f5,0x8fef,0x8ff0,0x8ff1,
-0x8ff2,0x8ff3,0x8ff4,0x8ff5,0xb7f6,0x8ff6,0x8ff7,0xb7f7,
-0x8ff8,0xb7f8,0x8ff9,0x8ffa,0x8ffb,0x8ffc,0x8ffd,0x8ffe,
-0xb7f9,0xb7fa,0x9041,0x9042,0xb7fb,0x9043,0x9044,0x9045,
-0xb7fc,0x9046,0x9047,0x9048,0x9049,0x904a,0x904b,0x904c,
-0xb7fd,0xb7fe,0x904d,0xb8a1,0x904e,0xb8a2,0x904f,0x9050,
-0x9051,0x9052,0x9053,0x9054,0xb8a3,0xb8a4,0x9055,0x9056,
-0xb8a5,0x9057,0x9058,0x9059,0xb8a6,0x905a,0x9061,0x9062,
-0x9063,0x9064,0x9065,0x9066,0xb8a7,0xb8a8,0x9067,0xb8a9,
-0x9068,0xb8aa,0xb8ab,0x9069,0x906a,0xb8ac,0xb8ad,0x906b,
-0x906c,0x906d,0x906e,0x906f,0x9070,0x9071,0x9072,0x9073,
-0x9074,0x9075,0x9076,0x9077,0x9078,0x9079,0x907a,0x9081,
-0x9082,0x9083,0x9084,0x9085,0x9086,0x9087,0x9088,0x9089,
-0x908a,0x908b,0x908c,0x908d,0xb8ae,0xb8af,0x908e,0x908f,
-0xb8b0,0x9090,0x9091,0x9092,0xb8b1,0x9093,0x9094,0x9095,
-0x9096,0x9097,0x9098,0x9099,0xb8b2,0xb8b3,0x909a,0xb8b4,
-0x909b,0xb8b5,0x909c,0x909d,0x909e,0x909f,0x90a0,0x90a1,
-0xb8b6,0xb8b7,0x90a2,0x90a3,0xb8b8,0x90a4,0xb8b9,0xb8ba,
-0xb8bb,0xb8bc,0xb8bd,0x90a5,0x90a6,0x90a7,0x90a8,0x90a9,
-0xb8be,0xb8bf,0x90aa,0xb8c0,0x90ab,0xb8c1,0xb8c2,0x90ac,
-0x90ad,0xb8c3,0x90ae,0xb8c4,0xb8c5,0xb8c6,0x90af,0x90b0,
-0xb8c7,0x90b1,0x90b2,0x90b3,0xb8c8,0x90b4,0x90b5,0x90b6,
-0x90b7,0x90b8,0x90b9,0x90ba,0xb8c9,0xb8ca,0x90bb,0xb8cb,
-0xb8cc,0xb8cd,0xb8ce,0x90bc,0x90bd,0x90be,0x90bf,0x90c0,
-/* 0xba00 */
-0xb8cf,0xb8d0,0x90c1,0x90c2,0x90c3,0x90c4,0x90c5,0x90c6,
-0xb8d1,0x90c7,0x90c8,0x90c9,0x90ca,0x90cb,0x90cc,0x90cd,
-0x90ce,0x90cf,0x90d0,0x90d1,0x90d2,0xb8d2,0x90d3,0x90d4,
-0x90d5,0x90d6,0x90d7,0x90d8,0x90d9,0x90da,0x90db,0x90dc,
-0x90dd,0x90de,0x90df,0x90e0,0x90e1,0x90e2,0x90e3,0x90e4,
-0x90e5,0x90e6,0x90e7,0x90e8,0x90e9,0x90ea,0x90eb,0x90ec,
-0x90ed,0x90ee,0x90ef,0x90f0,0x90f1,0x90f2,0x90f3,0x90f4,
-0xb8d3,0xb8d4,0x90f5,0x90f6,0xb8d5,0x90f7,0x90f8,0x90f9,
-0xb8d6,0x90fa,0xb8d7,0x90fb,0x90fc,0x90fd,0x90fe,0x9141,
-0xb8d8,0xb8d9,0x9142,0xb8da,0x9143,0xb8db,0xb8dc,0x9144,
-0x9145,0x9146,0x9147,0xb8dd,0xb8de,0xb8df,0x9148,0x9149,
-0xb8e0,0x914a,0x914b,0x914c,0xb8e1,0x914d,0x914e,0x914f,
-0x9150,0x9151,0x9152,0x9153,0xb8e2,0xb8e3,0x9154,0xb8e4,
-0xb8e5,0xb8e6,0x9155,0x9156,0x9157,0x9158,0x9159,0x915a,
-0xb8e7,0xb8e8,0x9161,0x9162,0xb8e9,0x9163,0x9164,0x9165,
-0xb8ea,0x9166,0x9167,0x9168,0x9169,0x916a,0x916b,0x916c,
-0x916d,0x916e,0x916f,0xb8eb,0xb8ec,0xb8ed,0x9170,0xb8ee,
-0x9171,0x9172,0x9173,0x9174,0xb8ef,0x9175,0x9176,0x9177,
-0x9178,0x9179,0x917a,0x9181,0x9182,0x9183,0x9184,0x9185,
-0x9186,0x9187,0x9188,0x9189,0x918a,0x918b,0x918c,0x918d,
-0x918e,0x918f,0x9190,0x9191,0x9192,0x9193,0x9194,0x9195,
-0xb8f0,0xb8f1,0x9196,0xb8f2,0xb8f3,0x9197,0x9198,0x9199,
-0xb8f4,0x919a,0xb8f5,0x919b,0x919c,0x919d,0x919e,0x919f,
-0xb8f6,0xb8f7,0x91a0,0xb8f8,0x91a1,0xb8f9,0x91a2,0x91a3,
-0x91a4,0x91a5,0x91a6,0x91a7,0xb8fa,0x91a8,0x91a9,0x91aa,
-0xb8fb,0x91ab,0x91ac,0x91ad,0x91ae,0x91af,0x91b0,0x91b1,
-0x91b2,0x91b3,0x91b4,0x91b5,0x91b6,0x91b7,0x91b8,0x91b9,
-0xb8fc,0xb8fd,0x91ba,0x91bb,0x91bc,0x91bd,0x91be,0x91bf,
-0x91c0,0x91c1,0x91c2,0x91c3,0x91c4,0x91c5,0x91c6,0x91c7,
-0x91c8,0x91c9,0x91ca,0x91cb,0x91cc,0x91cd,0x91ce,0x91cf,
-0x91d0,0x91d1,0x91d2,0x91d3,0x91d4,0x91d5,0x91d6,0x91d7,
-0x91d8,0x91d9,0x91da,0x91db,0xb8fe,0x91dc,0x91dd,0x91de,
-/* 0xbb00 */
-0xb9a1,0x91df,0x91e0,0x91e1,0xb9a2,0x91e2,0x91e3,0x91e4,
-0x91e5,0x91e6,0x91e7,0x91e8,0x91e9,0xb9a3,0x91ea,0xb9a4,
-0x91eb,0xb9a5,0x91ec,0x91ed,0x91ee,0x91ef,0x91f0,0x91f1,
-0xb9a6,0x91f2,0x91f3,0x91f4,0xb9a7,0x91f5,0x91f6,0x91f7,
-0xb9a8,0x91f8,0x91f9,0x91fa,0x91fb,0x91fc,0x91fd,0x91fe,
-0x9241,0xb9a9,0x9242,0xb9aa,0x9243,0x9244,0x9245,0x9246,
-0x9247,0x9248,0x9249,0x924a,0xb9ab,0xb9ac,0xb9ad,0x924b,
-0xb9ae,0x924c,0x924d,0xb9af,0xb9b0,0xb9b1,0xb9b2,0x924e,
-0x924f,0x9250,0x9251,0x9252,0xb9b3,0xb9b4,0x9253,0xb9b5,
-0x9254,0xb9b6,0x9255,0x9256,0x9257,0xb9b7,0x9258,0xb9b8,
-0xb9b9,0x9259,0x925a,0x9261,0xb9ba,0x9262,0x9263,0x9264,
-0xb9bb,0x9265,0x9266,0x9267,0x9268,0x9269,0x926a,0x926b,
-0x926c,0xb9bc,0x926d,0xb9bd,0x926e,0x926f,0x9270,0x9271,
-0x9272,0x9273,0x9274,0x9275,0xb9be,0x9276,0x9277,0x9278,
-0x9279,0x927a,0x9281,0x9282,0x9283,0x9284,0x9285,0x9286,
-0x9287,0x9288,0x9289,0x928a,0x928b,0x928c,0x928d,0x928e,
-0x928f,0x9290,0x9291,0x9292,0x9293,0x9294,0x9295,0x9296,
-0xb9bf,0x9297,0x9298,0x9299,0xb9c0,0x929a,0x929b,0x929c,
-0xb9c1,0x929d,0x929e,0x929f,0x92a0,0x92a1,0x92a2,0x92a3,
-0x92a4,0x92a5,0x92a6,0x92a7,0x92a8,0x92a9,0x92aa,0x92ab,
-0x92ac,0x92ad,0x92ae,0x92af,0xb9c2,0x92b0,0x92b1,0x92b2,
-0xb9c3,0x92b3,0x92b4,0x92b5,0xb9c4,0x92b6,0x92b7,0x92b8,
-0x92b9,0x92ba,0x92bb,0x92bc,0xb9c5,0x92bd,0x92be,0xb9c6,
-0x92bf,0x92c0,0x92c1,0x92c2,0x92c3,0x92c4,0x92c5,0x92c6,
-0xb9c7,0x92c7,0x92c8,0x92c9,0xb9c8,0x92ca,0x92cb,0x92cc,
-0xb9c9,0x92cd,0x92ce,0x92cf,0x92d0,0x92d1,0x92d2,0x92d3,
-0xb9ca,0x92d4,0x92d5,0xb9cb,0x92d6,0x92d7,0x92d8,0x92d9,
-0x92da,0x92db,0x92dc,0x92dd,0x92de,0x92df,0x92e0,0x92e1,
-0x92e2,0x92e3,0x92e4,0x92e5,0x92e6,0x92e7,0x92e8,0x92e9,
-0x92ea,0x92eb,0x92ec,0x92ed,0x92ee,0x92ef,0x92f0,0x92f1,
-0x92f2,0x92f3,0x92f4,0x92f5,0x92f6,0x92f7,0x92f8,0x92f9,
-0xb9cc,0xb9cd,0x92fa,0x92fb,0xb9ce,0x92fc,0x92fd,0xb9cf,
-/* 0xbc00 */
-0xb9d0,0x92fe,0xb9d1,0x9341,0x9342,0x9343,0x9344,0x9345,
-0xb9d2,0xb9d3,0x9346,0xb9d4,0xb9d5,0xb9d6,0x9347,0xb9d7,
-0x9348,0xb9d8,0x9349,0x934a,0xb9d9,0xb9da,0xb9db,0xb9dc,
-0xb9dd,0x934b,0x934c,0xb9de,0xb9df,0xb9e0,0xb9e1,0xb9e2,
-0x934d,0x934e,0x934f,0x9350,0xb9e3,0xb9e4,0x9351,0xb9e5,
-0x9352,0xb9e6,0x9353,0x9354,0x9355,0xb9e7,0x9356,0x9357,
-0xb9e8,0xb9e9,0x9358,0x9359,0xb9ea,0x935a,0x9361,0x9362,
-0xb9eb,0x9363,0x9364,0x9365,0x9366,0x9367,0x9368,0x9369,
-0xb9ec,0xb9ed,0x936a,0xb9ee,0xb9ef,0xb9f0,0x936b,0x936c,
-0x936d,0xb9f1,0x936e,0x936f,0xb9f2,0xb9f3,0x9370,0x9371,
-0xb9f4,0x9372,0x9373,0x9374,0x9375,0x9376,0x9377,0x9378,
-0x9379,0x937a,0x9381,0x9382,0x9383,0xb9f5,0x9384,0x9385,
-0x9386,0x9387,0x9388,0x9389,0x938a,0x938b,0x938c,0x938d,
-0x938e,0x938f,0x9390,0x9391,0x9392,0x9393,0x9394,0x9395,
-0x9396,0x9397,0x9398,0x9399,0x939a,0x939b,0x939c,0x939d,
-0x939e,0x939f,0x93a0,0x93a1,0x93a2,0x93a3,0x93a4,0x93a5,
-0x93a6,0x93a7,0x93a8,0x93a9,0xb9f6,0xb9f7,0x93aa,0x93ab,
-0xb9f8,0x93ac,0x93ad,0xb9f9,0xb9fa,0x93ae,0xb9fb,0x93af,
-0x93b0,0x93b1,0x93b2,0x93b3,0xb9fc,0xb9fd,0x93b4,0xb9fe,
-0x93b5,0xbaa1,0xbaa2,0x93b6,0x93b7,0x93b8,0x93b9,0x93ba,
-0xbaa3,0xbaa4,0x93bb,0x93bc,0xbaa5,0x93bd,0x93be,0xbaa6,
-0xbaa7,0x93bf,0x93c0,0x93c1,0x93c2,0x93c3,0x93c4,0x93c5,
-0xbaa8,0xbaa9,0x93c6,0xbaaa,0xbaab,0xbaac,0x93c7,0x93c8,
-0x93c9,0x93ca,0x93cb,0x93cc,0xbaad,0xbaae,0x93cd,0x93ce,
-0xbaaf,0x93cf,0x93d0,0x93d1,0xbab0,0x93d2,0x93d3,0x93d4,
-0x93d5,0x93d6,0x93d7,0x93d8,0x93d9,0xbab1,0x93da,0xbab2,
-0xbab3,0xbab4,0x93db,0x93dc,0x93dd,0xbab5,0x93de,0x93df,
-0xbab6,0x93e0,0x93e1,0x93e2,0xbab7,0x93e3,0x93e4,0x93e5,
-0x93e6,0x93e7,0x93e8,0x93e9,0x93ea,0x93eb,0x93ec,0x93ed,
-0x93ee,0x93ef,0x93f0,0x93f1,0x93f2,0x93f3,0x93f4,0x93f5,
-0x93f6,0x93f7,0x93f8,0x93f9,0xbab8,0xbab9,0xbaba,0x93fa,
-0xbabb,0x93fb,0x93fc,0x93fd,0xbabc,0x93fe,0x9441,0x9442,
-/* 0xbd00 */
-0x9443,0x9444,0x9445,0x9446,0xbabd,0xbabe,0x9447,0xbabf,
-0x9448,0xbac0,0x9449,0x944a,0x944b,0x944c,0x944d,0x944e,
-0xbac1,0x944f,0x9450,0x9451,0xbac2,0x9452,0x9453,0x9454,
-0x9455,0x9456,0x9457,0x9458,0x9459,0x945a,0x9461,0x9462,
-0x9463,0x9464,0x9465,0x9466,0xbac3,0x9467,0x9468,0x9469,
-0x946a,0x946b,0x946c,0x946d,0xbac4,0x946e,0x946f,0x9470,
-0x9471,0x9472,0x9473,0x9474,0x9475,0x9476,0x9477,0x9478,
-0x9479,0x947a,0x9481,0x9482,0x9483,0x9484,0x9485,0x9486,
-0xbac5,0x9487,0x9488,0x9489,0x948a,0x948b,0x948c,0x948d,
-0xbac6,0xbac7,0x948e,0x948f,0xbac8,0x9490,0x9491,0x9492,
-0xbac9,0x9493,0x9494,0x9495,0x9496,0x9497,0x9498,0x9499,
-0xbaca,0xbacb,0x949a,0x949b,0x949c,0x949d,0x949e,0x949f,
-0x94a0,0x94a1,0x94a2,0x94a3,0xbacc,0x94a4,0x94a5,0x94a6,
-0xbacd,0x94a7,0x94a8,0x94a9,0x94aa,0x94ab,0x94ac,0x94ad,
-0x94ae,0x94af,0x94b0,0x94b1,0x94b2,0x94b3,0x94b4,0x94b5,
-0x94b6,0x94b7,0x94b8,0x94b9,0x94ba,0x94bb,0x94bc,0x94bd,
-0xbace,0xbacf,0x94be,0x94bf,0xbad0,0x94c0,0x94c1,0xbad1,
-0xbad2,0xbad3,0xbad4,0x94c2,0x94c3,0x94c4,0x94c5,0x94c6,
-0xbad5,0xbad6,0x94c7,0xbad7,0x94c8,0xbad8,0x94c9,0x94ca,
-0x94cb,0xbad9,0xbada,0x94cc,0xbadb,0x94cd,0x94ce,0x94cf,
-0x94d0,0x94d1,0x94d2,0x94d3,0xbadc,0x94d4,0x94d5,0x94d6,
-0x94d7,0x94d8,0x94d9,0x94da,0x94db,0x94dc,0x94dd,0x94de,
-0xbadd,0x94df,0x94e0,0x94e1,0x94e2,0x94e3,0x94e4,0x94e5,
-0xbade,0x94e6,0x94e7,0x94e8,0x94e9,0x94ea,0x94eb,0x94ec,
-0x94ed,0x94ee,0x94ef,0x94f0,0x94f1,0x94f2,0x94f3,0x94f4,
-0x94f5,0x94f6,0x94f7,0x94f8,0x94f9,0x94fa,0x94fb,0x94fc,
-0x94fd,0x94fe,0x9541,0x9542,0xbadf,0xbae0,0x9543,0x9544,
-0xbae1,0x9545,0x9546,0x9547,0xbae2,0x9548,0x9549,0x954a,
-0x954b,0x954c,0x954d,0x954e,0x954f,0x9550,0x9551,0x9552,
-0x9553,0xbae3,0x9554,0x9555,0x9556,0x9557,0x9558,0x9559,
-0xbae4,0x955a,0x9561,0x9562,0xbae5,0x9563,0x9564,0x9565,
-0xbae6,0x9566,0x9567,0x9568,0x9569,0x956a,0x956b,0x956c,
-/* 0xbe00 */
-0xbae7,0x956d,0x956e,0xbae8,0x956f,0xbae9,0x9570,0x9571,
-0x9572,0x9573,0x9574,0x9575,0xbaea,0xbaeb,0x9576,0x9577,
-0xbaec,0x9578,0x9579,0x957a,0xbaed,0x9581,0x9582,0x9583,
-0x9584,0x9585,0x9586,0x9587,0xbaee,0xbaef,0x9588,0xbaf0,
-0x9589,0x958a,0x958b,0x958c,0x958d,0x958e,0x958f,0x9590,
-0x9591,0x9592,0x9593,0x9594,0x9595,0x9596,0x9597,0x9598,
-0x9599,0x959a,0x959b,0x959c,0x959d,0x959e,0x959f,0x95a0,
-0x95a1,0x95a2,0x95a3,0x95a4,0x95a5,0x95a6,0x95a7,0x95a8,
-0x95a9,0x95aa,0x95ab,0x95ac,0xbaf1,0xbaf2,0x95ad,0x95ae,
-0xbaf3,0x95af,0x95b0,0x95b1,0xbaf4,0x95b2,0xbaf5,0x95b3,
-0x95b4,0x95b5,0x95b6,0x95b7,0xbaf6,0xbaf7,0x95b8,0xbaf8,
-0x95b9,0xbaf9,0xbafa,0xbafb,0x95ba,0x95bb,0x95bc,0x95bd,
-0xbafc,0xbafd,0x95be,0x95bf,0xbafe,0x95c0,0x95c1,0x95c2,
-0xbba1,0x95c3,0xbba2,0x95c4,0x95c5,0x95c6,0x95c7,0x95c8,
-0xbba3,0xbba4,0x95c9,0xbba5,0xbba6,0xbba7,0x95ca,0x95cb,
-0x95cc,0x95cd,0x95ce,0xbba8,0xbba9,0xbbaa,0x95cf,0x95d0,
-0xbbab,0x95d1,0x95d2,0x95d3,0xbbac,0x95d4,0x95d5,0x95d6,
-0x95d7,0x95d8,0x95d9,0x95da,0xbbad,0xbbae,0x95db,0xbbaf,
-0xbbb0,0xbbb1,0x95dc,0x95dd,0x95de,0x95df,0x95e0,0x95e1,
-0xbbb2,0xbbb3,0x95e2,0x95e3,0x95e4,0x95e5,0x95e6,0x95e7,
-0x95e8,0x95e9,0x95ea,0x95eb,0x95ec,0x95ed,0x95ee,0x95ef,
-0xbbb4,0x95f0,0x95f1,0x95f2,0x95f3,0x95f4,0x95f5,0x95f6,
-0x95f7,0x95f8,0x95f9,0x95fa,0x95fb,0x95fc,0x95fd,0x95fe,
-0x9641,0x9642,0x9643,0x9644,0x9645,0x9646,0x9647,0x9648,
-0x9649,0x964a,0x964b,0x964c,0x964d,0x964e,0x964f,0x9650,
-0x9651,0x9652,0x9653,0x9654,0x9655,0x9656,0x9657,0x9658,
-0xbbb5,0xbbb6,0x9659,0x965a,0xbbb7,0x9661,0x9662,0xbbb8,
-0xbbb9,0x9663,0x9664,0x9665,0x9666,0x9667,0x9668,0x9669,
-0xbbba,0x966a,0x966b,0xbbbb,0xbbbc,0xbbbd,0x966c,0x966d,
-0x966e,0x966f,0x9670,0x9671,0xbbbe,0x9672,0x9673,0x9674,
-0x9675,0x9676,0x9677,0x9678,0x9679,0x967a,0x9681,0x9682,
-0x9683,0x9684,0x9685,0x9686,0x9687,0x9688,0x9689,0x968a,
-/* 0xbf00 */
-0x968b,0xbbbf,0x968c,0x968d,0x968e,0x968f,0x9690,0x9691,
-0xbbc0,0xbbc1,0x9692,0x9693,0x9694,0x9695,0x9696,0x9697,
-0x9698,0x9699,0x969a,0x969b,0x969c,0x969d,0x969e,0x969f,
-0xbbc2,0xbbc3,0x96a0,0xbbc4,0xbbc5,0xbbc6,0x96a1,0x96a2,
-0x96a3,0x96a4,0x96a5,0x96a6,0x96a7,0x96a8,0x96a9,0x96aa,
-0x96ab,0x96ac,0x96ad,0x96ae,0x96af,0x96b0,0x96b1,0x96b2,
-0x96b3,0x96b4,0x96b5,0x96b6,0x96b7,0x96b8,0x96b9,0x96ba,
-0x96bb,0x96bc,0x96bd,0x96be,0x96bf,0x96c0,0x96c1,0x96c2,
-0xbbc7,0xbbc8,0x96c3,0x96c4,0xbbc9,0x96c5,0x96c6,0x96c7,
-0xbbca,0x96c8,0x96c9,0x96ca,0x96cb,0x96cc,0x96cd,0x96ce,
-0xbbcb,0xbbcc,0x96cf,0x96d0,0x96d1,0xbbcd,0x96d2,0x96d3,
-0x96d4,0x96d5,0x96d6,0x96d7,0x96d8,0x96d9,0x96da,0x96db,
-0x96dc,0x96dd,0x96de,0x96df,0x96e0,0x96e1,0x96e2,0x96e3,
-0x96e4,0x96e5,0x96e6,0x96e7,0x96e8,0x96e9,0x96ea,0x96eb,
-0x96ec,0x96ed,0x96ee,0x96ef,0x96f0,0x96f1,0x96f2,0x96f3,
-0x96f4,0x96f5,0x96f6,0x96f7,0x96f8,0x96f9,0x96fa,0x96fb,
-0x96fc,0x96fd,0x96fe,0x9741,0x9742,0x9743,0x9744,0x9745,
-0x9746,0x9747,0x9748,0x9749,0x974a,0x974b,0x974c,0x974d,
-0x974e,0x974f,0x9750,0x9751,0xbbce,0x9752,0x9753,0x9754,
-0x9755,0x9756,0x9757,0x9758,0x9759,0x975a,0x9761,0x9762,
-0x9763,0x9764,0x9765,0x9766,0x9767,0x9768,0x9769,0x976a,
-0x976b,0x976c,0x976d,0x976e,0x976f,0x9770,0x9771,0x9772,
-0xbbcf,0x9773,0x9774,0x9775,0x9776,0x9777,0x9778,0x9779,
-0x977a,0x9781,0x9782,0x9783,0x9784,0x9785,0x9786,0x9787,
-0x9788,0x9789,0x978a,0x978b,0x978c,0xbbd0,0x978d,0x978e,
-0x978f,0x9790,0x9791,0x9792,0xbbd1,0xbbd2,0x9793,0x9794,
-0xbbd3,0x9795,0x9796,0x9797,0xbbd4,0x9798,0x9799,0x979a,
-0x979b,0x979c,0x979d,0x979e,0xbbd5,0x979f,0x97a0,0xbbd6,
-0x97a1,0xbbd7,0x97a2,0x97a3,0x97a4,0x97a5,0x97a6,0x97a7,
-0x97a8,0x97a9,0x97aa,0x97ab,0x97ac,0x97ad,0x97ae,0x97af,
-0x97b0,0x97b1,0x97b2,0x97b3,0x97b4,0x97b5,0x97b6,0x97b7,
-0x97b8,0x97b9,0x97ba,0x97bb,0x97bc,0x97bd,0x97be,0x97bf,
-/* 0xc000 */
-0x97c0,0x97c1,0x97c2,0x97c3,0x97c4,0x97c5,0x97c6,0x97c7,
-0x97c8,0x97c9,0x97ca,0x97cb,0x97cc,0x97cd,0x97ce,0x97cf,
-0x97d0,0x97d1,0x97d2,0x97d3,0x97d4,0x97d5,0x97d6,0x97d7,
-0x97d8,0x97d9,0x97da,0x97db,0x97dc,0x97dd,0x97de,0x97df,
-0x97e0,0x97e1,0x97e2,0x97e3,0x97e4,0x97e5,0x97e6,0x97e7,
-0x97e8,0x97e9,0x97ea,0x97eb,0x97ec,0x97ed,0x97ee,0x97ef,
-0x97f0,0x97f1,0x97f2,0x97f3,0x97f4,0x97f5,0x97f6,0x97f7,
-0x97f8,0x97f9,0x97fa,0x97fb,0xbbd8,0x97fc,0x97fd,0x97fe,
-0x9841,0x9842,0x9843,0x9844,0x9845,0x9846,0x9847,0x9848,
-0x9849,0x984a,0x984b,0x984c,0x984d,0x984e,0x984f,0x9850,
-0x9851,0xbbd9,0x9852,0x9853,0x9854,0x9855,0x9856,0x9857,
-0xbbda,0x9858,0x9859,0x985a,0xbbdb,0x9861,0x9862,0x9863,
-0xbbdc,0x9864,0x9865,0x9866,0x9867,0x9868,0x9869,0x986a,
-0xbbdd,0xbbde,0x986b,0x986c,0x986d,0x986e,0x986f,0x9870,
-0x9871,0x9872,0x9873,0x9874,0x9875,0x9876,0x9877,0x9878,
-0x9879,0x987a,0x9881,0x9882,0x9883,0x9884,0x9885,0x9886,
-0x9887,0x9888,0x9889,0x988a,0x988b,0x988c,0x988d,0x988e,
-0x988f,0x9890,0x9891,0x9892,0x9893,0x9894,0x9895,0x9896,
-0xbbdf,0xbbe0,0x9897,0x9898,0xbbe1,0x9899,0x989a,0x989b,
-0xbbe2,0x989c,0x989d,0x989e,0x989f,0x98a0,0x98a1,0x98a2,
-0xbbe3,0xbbe4,0x98a3,0xbbe5,0x98a4,0xbbe6,0x98a5,0x98a6,
-0x98a7,0x98a8,0x98a9,0x98aa,0xbbe7,0xbbe8,0x98ab,0xbbe9,
-0xbbea,0x98ac,0x98ad,0xbbeb,0xbbec,0xbbed,0xbbee,0x98ae,
-0x98af,0x98b0,0x98b1,0x98b2,0xbbef,0xbbf0,0x98b3,0xbbf1,
-0xbbf2,0xbbf3,0x98b4,0x98b5,0x98b6,0xbbf4,0x98b7,0x98b8,
-0xbbf5,0xbbf6,0x98b9,0x98ba,0xbbf7,0x98bb,0x98bc,0x98bd,
-0xbbf8,0x98be,0x98bf,0x98c0,0x98c1,0x98c2,0x98c3,0x98c4,
-0xbbf9,0xbbfa,0x98c5,0xbbfb,0xbbfc,0xbbfd,0x98c6,0x98c7,
-0x98c8,0x98c9,0x98ca,0x98cb,0xbbfe,0xbca1,0x98cc,0x98cd,
-0xbca2,0x98ce,0x98cf,0x98d0,0xbca3,0x98d1,0x98d2,0x98d3,
-0x98d4,0x98d5,0x98d6,0x98d7,0xbca4,0xbca5,0x98d8,0xbca6,
-0x98d9,0xbca7,0x98da,0x98db,0x98dc,0x98dd,0x98de,0x98df,
-/* 0xc100 */
-0xbca8,0x98e0,0x98e1,0x98e2,0xbca9,0x98e3,0x98e4,0x98e5,
-0xbcaa,0x98e6,0x98e7,0x98e8,0x98e9,0x98ea,0x98eb,0x98ec,
-0xbcab,0x98ed,0x98ee,0x98ef,0x98f0,0xbcac,0x98f1,0x98f2,
-0x98f3,0x98f4,0x98f5,0x98f6,0xbcad,0xbcae,0xbcaf,0xbcb0,
-0xbcb1,0x98f7,0x98f8,0xbcb2,0xbcb3,0x98f9,0xbcb4,0xbcb5,
-0x98fa,0x98fb,0x98fc,0x98fd,0xbcb6,0xbcb7,0x98fe,0xbcb8,
-0xbcb9,0xbcba,0x9941,0x9942,0x9943,0x9944,0xbcbb,0x9945,
-0xbcbc,0xbcbd,0x9946,0x9947,0xbcbe,0x9948,0x9949,0x994a,
-0xbcbf,0x994b,0x994c,0x994d,0x994e,0x994f,0x9950,0x9951,
-0xbcc0,0xbcc1,0x9952,0xbcc2,0xbcc3,0xbcc4,0x9953,0x9954,
-0x9955,0x9956,0x9957,0x9958,0xbcc5,0xbcc6,0x9959,0x995a,
-0xbcc7,0x9961,0x9962,0x9963,0xbcc8,0x9964,0x9965,0x9966,
-0x9967,0x9968,0x9969,0x996a,0xbcc9,0xbcca,0x996b,0xbccb,
-0xbccc,0xbccd,0x996c,0x996d,0x996e,0x996f,0x9970,0x9971,
-0xbcce,0x9972,0x9973,0x9974,0xbccf,0x9975,0x9976,0x9977,
-0xbcd0,0x9978,0x9979,0x997a,0x9981,0x9982,0x9983,0x9984,
-0x9985,0x9986,0x9987,0x9988,0x9989,0xbcd1,0x998a,0x998b,
-0x998c,0x998d,0x998e,0x998f,0xbcd2,0xbcd3,0xbcd4,0x9990,
-0xbcd5,0x9991,0x9992,0x9993,0xbcd6,0x9994,0xbcd7,0x9995,
-0x9996,0x9997,0x9998,0x9999,0xbcd8,0xbcd9,0x999a,0xbcda,
-0x999b,0xbcdb,0x999c,0x999d,0x999e,0xbcdc,0x999f,0x99a0,
-0xbcdd,0xbcde,0x99a1,0x99a2,0xbcdf,0x99a3,0x99a4,0x99a5,
-0xbce0,0x99a6,0x99a7,0x99a8,0x99a9,0x99aa,0x99ab,0x99ac,
-0x99ad,0x99ae,0x99af,0x99b0,0x99b1,0xbce1,0x99b2,0x99b3,
-0x99b4,0x99b5,0x99b6,0x99b7,0xbce2,0x99b8,0x99b9,0x99ba,
-0xbce3,0x99bb,0x99bc,0x99bd,0xbce4,0x99be,0x99bf,0x99c0,
-0x99c1,0x99c2,0x99c3,0x99c4,0xbce5,0x99c5,0x99c6,0xbce6,
-0xbce7,0x99c7,0x99c8,0x99c9,0x99ca,0x99cb,0x99cc,0x99cd,
-0xbce8,0x99ce,0x99cf,0x99d0,0xbce9,0x99d1,0x99d2,0x99d3,
-0xbcea,0x99d4,0x99d5,0x99d6,0x99d7,0x99d8,0x99d9,0x99da,
-0xbceb,0xbcec,0x99db,0xbced,0x99dc,0x99dd,0x99de,0x99df,
-0x99e0,0x99e1,0x99e2,0x99e3,0xbcee,0xbcef,0x99e4,0x99e5,
-/* 0xc200 */
-0xbcf0,0x99e6,0x99e7,0x99e8,0xbcf1,0x99e9,0x99ea,0x99eb,
-0x99ec,0x99ed,0x99ee,0x99ef,0xbcf2,0xbcf3,0x99f0,0xbcf4,
-0x99f1,0xbcf5,0x99f2,0x99f3,0x99f4,0x99f5,0x99f6,0x99f7,
-0xbcf6,0xbcf7,0x99f8,0x99f9,0xbcf8,0x99fa,0x99fb,0xbcf9,
-0xbcfa,0x99fc,0x99fd,0x99fe,0x9a41,0x9a42,0x9a43,0x9a44,
-0xbcfb,0xbcfc,0x9a45,0xbcfd,0x9a46,0xbcfe,0x9a47,0xbda1,
-0x9a48,0xbda2,0xbda3,0x9a49,0xbda4,0x9a4a,0x9a4b,0x9a4c,
-0x9a4d,0x9a4e,0x9a4f,0x9a50,0x9a51,0x9a52,0x9a53,0x9a54,
-0x9a55,0x9a56,0x9a57,0x9a58,0x9a59,0x9a5a,0x9a61,0x9a62,
-0xbda5,0x9a63,0x9a64,0x9a65,0x9a66,0x9a67,0x9a68,0x9a69,
-0xbda6,0xbda7,0x9a6a,0x9a6b,0xbda8,0x9a6c,0x9a6d,0x9a6e,
-0xbda9,0x9a6f,0x9a70,0x9a71,0x9a72,0x9a73,0x9a74,0x9a75,
-0xbdaa,0x9a76,0x9a77,0x9a78,0x9a79,0xbdab,0x9a7a,0x9a81,
-0x9a82,0x9a83,0x9a84,0x9a85,0xbdac,0xbdad,0x9a86,0x9a87,
-0xbdae,0x9a88,0x9a89,0x9a8a,0xbdaf,0x9a8b,0x9a8c,0x9a8d,
-0x9a8e,0x9a8f,0x9a90,0x9a91,0xbdb0,0xbdb1,0x9a92,0xbdb2,
-0x9a93,0xbdb3,0x9a94,0x9a95,0x9a96,0x9a97,0x9a98,0x9a99,
-0xbdb4,0xbdb5,0x9a9a,0x9a9b,0x9a9c,0x9a9d,0x9a9e,0x9a9f,
-0xbdb6,0x9aa0,0x9aa1,0x9aa2,0x9aa3,0x9aa4,0x9aa5,0x9aa6,
-0xbdb7,0x9aa7,0x9aa8,0xbdb8,0x9aa9,0xbdb9,0x9aaa,0x9aab,
-0x9aac,0x9aad,0x9aae,0x9aaf,0xbdba,0xbdbb,0x9ab0,0x9ab1,
-0xbdbc,0x9ab2,0x9ab3,0x9ab4,0xbdbd,0xbdbe,0x9ab5,0x9ab6,
-0x9ab7,0x9ab8,0x9ab9,0x9aba,0xbdbf,0xbdc0,0x9abb,0xbdc1,
-0x9abc,0xbdc2,0x9abd,0x9abe,0x9abf,0x9ac0,0x9ac1,0x9ac2,
-0x9ac3,0x9ac4,0x9ac5,0x9ac6,0x9ac7,0x9ac8,0x9ac9,0x9aca,
-0x9acb,0x9acc,0x9acd,0x9ace,0x9acf,0x9ad0,0x9ad1,0x9ad2,
-0x9ad3,0x9ad4,0x9ad5,0x9ad6,0x9ad7,0x9ad8,0x9ad9,0x9ada,
-0x9adb,0x9adc,0x9add,0x9ade,0xbdc3,0xbdc4,0x9adf,0x9ae0,
-0xbdc5,0x9ae1,0x9ae2,0xbdc6,0xbdc7,0x9ae3,0x9ae4,0x9ae5,
-0x9ae6,0x9ae7,0x9ae8,0xbdc8,0xbdc9,0xbdca,0x9ae9,0xbdcb,
-0x9aea,0xbdcc,0x9aeb,0x9aec,0x9aed,0x9aee,0xbdcd,0x9aef,
-0xbdce,0xbdcf,0x9af0,0xbdd0,0xbdd1,0x9af1,0x9af2,0x9af3,
-/* 0xc300 */
-0xbdd2,0x9af4,0x9af5,0x9af6,0x9af7,0x9af8,0x9af9,0x9afa,
-0xbdd3,0xbdd4,0x9afb,0x9afc,0xbdd5,0xbdd6,0x9afd,0x9afe,
-0x9b41,0x9b42,0x9b43,0xbdd7,0xbdd8,0xbdd9,0x9b44,0x9b45,
-0xbdda,0x9b46,0x9b47,0x9b48,0xbddb,0x9b49,0x9b4a,0x9b4b,
-0x9b4c,0x9b4d,0x9b4e,0x9b4f,0xbddc,0xbddd,0x9b50,0x9b51,
-0xbdde,0xbddf,0x9b52,0x9b53,0x9b54,0x9b55,0x9b56,0x9b57,
-0x9b58,0x9b59,0x9b5a,0x9b61,0x9b62,0x9b63,0x9b64,0x9b65,
-0x9b66,0x9b67,0x9b68,0x9b69,0x9b6a,0x9b6b,0x9b6c,0x9b6d,
-0x9b6e,0x9b6f,0x9b70,0x9b71,0x9b72,0xbde0,0x9b73,0x9b74,
-0x9b75,0x9b76,0x9b77,0x9b78,0x9b79,0x9b7a,0x9b81,0x9b82,
-0x9b83,0x9b84,0x9b85,0x9b86,0x9b87,0x9b88,0x9b89,0x9b8a,
-0x9b8b,0x9b8c,0x9b8d,0x9b8e,0x9b8f,0x9b90,0x9b91,0x9b92,
-0x9b93,0x9b94,0x9b95,0x9b96,0x9b97,0x9b98,0x9b99,0x9b9a,
-0xbde1,0xbde2,0x9b9b,0x9b9c,0xbde3,0x9b9d,0x9b9e,0x9b9f,
-0xbde4,0x9ba0,0xbde5,0x9ba1,0x9ba2,0x9ba3,0x9ba4,0x9ba5,
-0xbde6,0xbde7,0x9ba6,0x9ba7,0xbde8,0xbde9,0x9ba8,0x9ba9,
-0x9baa,0x9bab,0x9bac,0x9bad,0xbdea,0x9bae,0x9baf,0x9bb0,
-0xbdeb,0x9bb1,0x9bb2,0x9bb3,0xbdec,0x9bb4,0x9bb5,0x9bb6,
-0x9bb7,0x9bb8,0x9bb9,0x9bba,0x9bbb,0x9bbc,0x9bbd,0x9bbe,
-0x9bbf,0x9bc0,0x9bc1,0x9bc2,0x9bc3,0x9bc4,0x9bc5,0x9bc6,
-0x9bc7,0x9bc8,0x9bc9,0x9bca,0x9bcb,0x9bcc,0x9bcd,0x9bce,
-0x9bcf,0x9bd0,0x9bd1,0x9bd2,0x9bd3,0x9bd4,0x9bd5,0x9bd6,
-0x9bd7,0x9bd8,0x9bd9,0x9bda,0x9bdb,0x9bdc,0x9bdd,0x9bde,
-0x9bdf,0x9be0,0x9be1,0x9be2,0x9be3,0x9be4,0x9be5,0x9be6,
-0xbded,0x9be7,0x9be8,0x9be9,0x9bea,0x9beb,0x9bec,0x9bed,
-0x9bee,0x9bef,0x9bf0,0x9bf1,0x9bf2,0x9bf3,0x9bf4,0x9bf5,
-0x9bf6,0x9bf7,0x9bf8,0x9bf9,0x9bfa,0x9bfb,0x9bfc,0x9bfd,
-0xbdee,0xbdef,0x9bfe,0x9c41,0xbdf0,0x9c42,0x9c43,0xbdf1,
-0xbdf2,0x9c44,0xbdf3,0x9c45,0x9c46,0x9c47,0x9c48,0x9c49,
-0xbdf4,0xbdf5,0x9c4a,0x9c4b,0x9c4c,0xbdf6,0x9c4d,0x9c4e,
-0x9c4f,0x9c50,0x9c51,0x9c52,0xbdf7,0xbdf8,0x9c53,0x9c54,
-0xbdf9,0x9c55,0x9c56,0x9c57,0x9c58,0x9c59,0x9c5a,0x9c61,
-/* 0xc400 */
-0x9c62,0x9c63,0x9c64,0x9c65,0x9c66,0x9c67,0x9c68,0x9c69,
-0xbdfa,0x9c6a,0x9c6b,0x9c6c,0x9c6d,0x9c6e,0x9c6f,0x9c70,
-0xbdfb,0x9c71,0x9c72,0x9c73,0x9c74,0x9c75,0x9c76,0x9c77,
-0x9c78,0x9c79,0x9c7a,0x9c81,0x9c82,0x9c83,0x9c84,0x9c85,
-0x9c86,0x9c87,0x9c88,0x9c89,0xbdfc,0x9c8a,0x9c8b,0x9c8c,
-0x9c8d,0x9c8e,0x9c8f,0x9c90,0xbdfd,0x9c91,0x9c92,0x9c93,
-0xbdfe,0x9c94,0x9c95,0x9c96,0xbea1,0x9c97,0x9c98,0x9c99,
-0x9c9a,0x9c9b,0x9c9c,0x9c9d,0xbea2,0xbea3,0x9c9e,0x9c9f,
-0x9ca0,0x9ca1,0x9ca2,0x9ca3,0x9ca4,0x9ca5,0x9ca6,0x9ca7,
-0xbea4,0x9ca8,0x9ca9,0x9caa,0x9cab,0x9cac,0x9cad,0x9cae,
-0x9caf,0x9cb0,0x9cb1,0x9cb2,0x9cb3,0x9cb4,0x9cb5,0x9cb6,
-0x9cb7,0x9cb8,0x9cb9,0x9cba,0x9cbb,0x9cbc,0x9cbd,0x9cbe,
-0x9cbf,0x9cc0,0x9cc1,0x9cc2,0xbea5,0xbea6,0x9cc3,0x9cc4,
-0xbea7,0x9cc5,0x9cc6,0x9cc7,0xbea8,0x9cc8,0x9cc9,0x9cca,
-0x9ccb,0x9ccc,0x9ccd,0x9cce,0xbea9,0xbeaa,0x9ccf,0x9cd0,
-0x9cd1,0xbeab,0x9cd2,0x9cd3,0x9cd4,0x9cd5,0x9cd6,0x9cd7,
-0xbeac,0x9cd8,0x9cd9,0x9cda,0x9cdb,0x9cdc,0x9cdd,0x9cde,
-0x9cdf,0x9ce0,0x9ce1,0x9ce2,0x9ce3,0x9ce4,0x9ce5,0x9ce6,
-0x9ce7,0x9ce8,0x9ce9,0x9cea,0xbead,0x9ceb,0x9cec,0x9ced,
-0x9cee,0x9cef,0x9cf0,0x9cf1,0xbeae,0x9cf2,0x9cf3,0x9cf4,
-0x9cf5,0x9cf6,0x9cf7,0x9cf8,0x9cf9,0x9cfa,0x9cfb,0x9cfc,
-0x9cfd,0x9cfe,0x9d41,0x9d42,0x9d43,0x9d44,0x9d45,0x9d46,
-0x9d47,0x9d48,0x9d49,0x9d4a,0x9d4b,0x9d4c,0x9d4d,0x9d4e,
-0xbeaf,0x9d4f,0x9d50,0x9d51,0xbeb0,0x9d52,0x9d53,0x9d54,
-0x9d55,0x9d56,0x9d57,0x9d58,0x9d59,0x9d5a,0x9d61,0x9d62,
-0x9d63,0x9d64,0x9d65,0x9d66,0x9d67,0x9d68,0x9d69,0x9d6a,
-0x9d6b,0x9d6c,0x9d6d,0x9d6e,0x9d6f,0x9d70,0x9d71,0x9d72,
-0x9d73,0x9d74,0x9d75,0x9d76,0x9d77,0x9d78,0x9d79,0x9d7a,
-0x9d81,0x9d82,0x9d83,0x9d84,0x9d85,0x9d86,0x9d87,0x9d88,
-0x9d89,0xbeb1,0x9d8a,0x9d8b,0x9d8c,0x9d8d,0x9d8e,0x9d8f,
-0xbeb2,0xbeb3,0x9d90,0x9d91,0xbeb4,0x9d92,0x9d93,0x9d94,
-0xbeb5,0x9d95,0xbeb6,0x9d96,0x9d97,0x9d98,0x9d99,0xbeb7,
-/* 0xc500 */
-0xbeb8,0xbeb9,0x9d9a,0x9d9b,0x9d9c,0x9d9d,0x9d9e,0x9d9f,
-0x9da0,0x9da1,0x9da2,0x9da3,0xbeba,0x9da4,0x9da5,0x9da6,
-0xbebb,0x9da7,0x9da8,0x9da9,0xbebc,0x9daa,0x9dab,0x9dac,
-0x9dad,0x9dae,0x9daf,0x9db0,0xbebd,0x9db1,0x9db2,0x9db3,
-0x9db4,0x9db5,0x9db6,0x9db7,0x9db8,0x9db9,0x9dba,0x9dbb,
-0xbebe,0xbebf,0x9dbc,0x9dbd,0xbec0,0x9dbe,0x9dbf,0x9dc0,
-0xbec1,0x9dc1,0x9dc2,0x9dc3,0x9dc4,0x9dc5,0x9dc6,0x9dc7,
-0xbec2,0xbec3,0x9dc8,0xbec4,0x9dc9,0xbec5,0x9dca,0x9dcb,
-0x9dcc,0x9dcd,0x9dce,0x9dcf,0xbec6,0xbec7,0x9dd0,0x9dd1,
-0xbec8,0xbec9,0xbeca,0x9dd2,0xbecb,0xbecc,0xbecd,0x9dd3,
-0x9dd4,0x9dd5,0x9dd6,0xbece,0xbecf,0xbed0,0x9dd7,0xbed1,
-0xbed2,0xbed3,0x9dd8,0x9dd9,0x9dda,0xbed4,0xbed5,0x9ddb,
-0xbed6,0xbed7,0x9ddc,0x9ddd,0xbed8,0x9dde,0x9ddf,0x9de0,
-0xbed9,0x9de1,0x9de2,0x9de3,0x9de4,0x9de5,0x9de6,0x9de7,
-0xbeda,0xbedb,0x9de8,0xbedc,0xbedd,0xbede,0x9de9,0x9dea,
-0x9deb,0x9dec,0x9ded,0x9dee,0xbedf,0xbee0,0x9def,0x9df0,
-0xbee1,0x9df1,0x9df2,0x9df3,0xbee2,0x9df4,0x9df5,0xbee3,
-0x9df6,0x9df7,0x9df8,0x9df9,0xbee4,0xbee5,0x9dfa,0xbee6,
-0x9dfb,0xbee7,0x9dfc,0x9dfd,0x9dfe,0xbee8,0x9e41,0xbee9,
-0xbeea,0x9e42,0x9e43,0x9e44,0xbeeb,0x9e45,0x9e46,0x9e47,
-0xbeec,0x9e48,0x9e49,0x9e4a,0x9e4b,0x9e4c,0x9e4d,0x9e4e,
-0x9e4f,0xbeed,0x9e50,0x9e51,0x9e52,0x9e53,0x9e54,0x9e55,
-0x9e56,0x9e57,0x9e58,0x9e59,0xbeee,0xbeef,0x9e5a,0x9e61,
-0xbef0,0xbef1,0x9e62,0xbef2,0xbef3,0xbef4,0xbef5,0x9e63,
-0x9e64,0x9e65,0x9e66,0x9e67,0xbef6,0xbef7,0xbef8,0xbef9,
-0xbefa,0xbefb,0xbefc,0x9e68,0xbefd,0x9e69,0xbefe,0x9e6a,
-0xbfa1,0xbfa2,0x9e6b,0x9e6c,0xbfa3,0x9e6d,0x9e6e,0x9e6f,
-0xbfa4,0x9e70,0x9e71,0x9e72,0x9e73,0x9e74,0x9e75,0x9e76,
-0xbfa5,0xbfa6,0x9e77,0xbfa7,0x9e78,0xbfa8,0x9e79,0x9e7a,
-0x9e81,0x9e82,0x9e83,0x9e84,0xbfa9,0xbfaa,0xbfab,0x9e85,
-0xbfac,0x9e86,0x9e87,0x9e88,0xbfad,0x9e89,0xbfae,0xbfaf,
-0x9e8a,0x9e8b,0x9e8c,0x9e8d,0xbfb0,0xbfb1,0xbfb2,0xbfb3,
-/* 0xc600 */
-0xbfb4,0xbfb5,0x9e8e,0x9e8f,0x9e90,0xbfb6,0xbfb7,0xbfb8,
-0xbfb9,0x9e91,0x9e92,0x9e93,0xbfba,0x9e94,0x9e95,0x9e96,
-0xbfbb,0x9e97,0x9e98,0x9e99,0x9e9a,0x9e9b,0x9e9c,0x9e9d,
-0xbfbc,0xbfbd,0x9e9e,0xbfbe,0xbfbf,0x9e9f,0x9ea0,0x9ea1,
-0x9ea2,0x9ea3,0x9ea4,0x9ea5,0xbfc0,0xbfc1,0x9ea6,0x9ea7,
-0xbfc2,0x9ea8,0x9ea9,0x9eaa,0xbfc3,0xbfc4,0xbfc5,0x9eab,
-0xbfc6,0x9eac,0x9ead,0xbfc7,0xbfc8,0xbfc9,0x9eae,0xbfca,
-0x9eaf,0xbfcb,0x9eb0,0xbfcc,0x9eb1,0x9eb2,0x9eb3,0x9eb4,
-0xbfcd,0xbfce,0x9eb5,0x9eb6,0xbfcf,0x9eb7,0x9eb8,0x9eb9,
-0xbfd0,0x9eba,0x9ebb,0x9ebc,0x9ebd,0x9ebe,0x9ebf,0x9ec0,
-0xbfd1,0xbfd2,0x9ec1,0xbfd3,0xbfd4,0xbfd5,0x9ec2,0x9ec3,
-0x9ec4,0x9ec5,0x9ec6,0x9ec7,0xbfd6,0xbfd7,0x9ec8,0x9ec9,
-0xbfd8,0x9eca,0x9ecb,0x9ecc,0x9ecd,0x9ece,0x9ecf,0x9ed0,
-0x9ed1,0x9ed2,0x9ed3,0x9ed4,0xbfd9,0x9ed5,0x9ed6,0xbfda,
-0x9ed7,0xbfdb,0x9ed8,0x9ed9,0x9eda,0x9edb,0x9edc,0x9edd,
-0xbfdc,0xbfdd,0x9ede,0x9edf,0xbfde,0x9ee0,0x9ee1,0x9ee2,
-0xbfdf,0x9ee3,0x9ee4,0x9ee5,0x9ee6,0x9ee7,0x9ee8,0x9ee9,
-0xbfe0,0xbfe1,0x9eea,0xbfe2,0x9eeb,0xbfe3,0x9eec,0x9eed,
-0x9eee,0x9eef,0x9ef0,0x9ef1,0xbfe4,0xbfe5,0x9ef2,0x9ef3,
-0xbfe6,0x9ef4,0x9ef5,0x9ef6,0xbfe7,0x9ef7,0x9ef8,0x9ef9,
-0x9efa,0x9efb,0x9efc,0x9efd,0xbfe8,0xbfe9,0x9efe,0xbfea,
-0x9f41,0xbfeb,0x9f42,0x9f43,0x9f44,0x9f45,0x9f46,0x9f47,
-0xbfec,0xbfed,0x9f48,0x9f49,0xbfee,0x9f4a,0x9f4b,0x9f4c,
-0xbfef,0xbff0,0xbff1,0x9f4d,0x9f4e,0x9f4f,0x9f50,0x9f51,
-0xbff2,0xbff3,0x9f52,0xbff4,0x9f53,0xbff5,0x9f54,0x9f55,
-0x9f56,0x9f57,0x9f58,0x9f59,0xbff6,0xbff7,0x9f5a,0x9f61,
-0xbff8,0x9f62,0x9f63,0x9f64,0xbff9,0x9f65,0x9f66,0x9f67,
-0x9f68,0x9f69,0x9f6a,0x9f6b,0xbffa,0xbffb,0x9f6c,0x9f6d,
-0xbffc,0xbffd,0x9f6e,0x9f6f,0x9f70,0x9f71,0x9f72,0x9f73,
-0xbffe,0xc0a1,0x9f74,0x9f75,0xc0a2,0x9f76,0x9f77,0x9f78,
-0xc0a3,0x9f79,0x9f7a,0x9f81,0x9f82,0x9f83,0x9f84,0x9f85,
-0xc0a4,0xc0a5,0x9f86,0x9f87,0x9f88,0xc0a6,0x9f89,0x9f8a,
-/* 0xc700 */
-0x9f8b,0x9f8c,0x9f8d,0x9f8e,0xc0a7,0xc0a8,0x9f8f,0x9f90,
-0xc0a9,0x9f91,0x9f92,0x9f93,0xc0aa,0x9f94,0x9f95,0x9f96,
-0x9f97,0x9f98,0x9f99,0x9f9a,0xc0ab,0xc0ac,0x9f9b,0xc0ad,
-0x9f9c,0xc0ae,0x9f9d,0x9f9e,0x9f9f,0x9fa0,0x9fa1,0x9fa2,
-0xc0af,0xc0b0,0x9fa3,0x9fa4,0xc0b1,0x9fa5,0x9fa6,0x9fa7,
-0xc0b2,0x9fa8,0x9fa9,0x9faa,0x9fab,0x9fac,0x9fad,0x9fae,
-0xc0b3,0xc0b4,0x9faf,0xc0b5,0x9fb0,0xc0b6,0x9fb1,0xc0b7,
-0x9fb2,0x9fb3,0x9fb4,0x9fb5,0xc0b8,0xc0b9,0x9fb6,0x9fb7,
-0xc0ba,0x9fb8,0x9fb9,0x9fba,0xc0bb,0x9fbb,0x9fbc,0x9fbd,
-0x9fbe,0x9fbf,0xc0bc,0x9fc0,0xc0bd,0xc0be,0x9fc1,0xc0bf,
-0x9fc2,0xc0c0,0xc0c1,0xc0c2,0xc0c3,0xc0c4,0xc0c5,0xc0c6,
-0xc0c7,0x9fc3,0x9fc4,0x9fc5,0xc0c8,0x9fc6,0x9fc7,0x9fc8,
-0xc0c9,0x9fc9,0x9fca,0x9fcb,0x9fcc,0x9fcd,0x9fce,0x9fcf,
-0xc0ca,0x9fd0,0x9fd1,0xc0cb,0x9fd2,0x9fd3,0x9fd4,0x9fd5,
-0x9fd6,0x9fd7,0x9fd8,0x9fd9,0xc0cc,0xc0cd,0x9fda,0x9fdb,
-0xc0ce,0x9fdc,0x9fdd,0x9fde,0xc0cf,0xc0d0,0xc0d1,0x9fdf,
-0x9fe0,0x9fe1,0x9fe2,0xc0d2,0xc0d3,0xc0d4,0x9fe3,0xc0d5,
-0xc0d6,0xc0d7,0xc0d8,0x9fe4,0x9fe5,0x9fe6,0xc0d9,0x9fe7,
-0xc0da,0xc0db,0x9fe8,0x9fe9,0xc0dc,0x9fea,0xc0dd,0xc0de,
-0xc0df,0x9feb,0xc0e0,0x9fec,0x9fed,0x9fee,0x9fef,0x9ff0,
-0xc0e1,0xc0e2,0x9ff1,0xc0e3,0xc0e4,0xc0e5,0xc0e6,0x9ff2,
-0x9ff3,0x9ff4,0x9ff5,0x9ff6,0xc0e7,0xc0e8,0x9ff7,0x9ff8,
-0xc0e9,0x9ff9,0x9ffa,0x9ffb,0xc0ea,0x9ffc,0x9ffd,0x9ffe,
-0xa041,0xa042,0xa043,0xa044,0xc0eb,0xc0ec,0xa045,0xc0ed,
-0xc0ee,0xc0ef,0xa046,0xa047,0xa048,0xa049,0xa04a,0xa04b,
-0xc0f0,0xc0f1,0xa04c,0xa04d,0xc0f2,0xa04e,0xc0f3,0xa04f,
-0xc0f4,0xa050,0xa051,0xa052,0xa053,0xa054,0xa055,0xa056,
-0xc0f5,0xa057,0xa058,0xa059,0xa05a,0xc0f6,0xa061,0xa062,
-0xa063,0xa064,0xa065,0xa066,0xc0f7,0xa067,0xa068,0xa069,
-0xc0f8,0xa06a,0xa06b,0xa06c,0xc0f9,0xa06d,0xa06e,0xa06f,
-0xa070,0xa071,0xa072,0xa073,0xa074,0xa075,0xa076,0xa077,
-0xa078,0xa079,0xa07a,0xa081,0xa082,0xa083,0xa084,0xa085,
-/* 0xc800 */
-0xc0fa,0xc0fb,0xa086,0xa087,0xc0fc,0xa088,0xa089,0xa08a,
-0xc0fd,0xa08b,0xc0fe,0xa08c,0xa08d,0xa08e,0xa08f,0xa090,
-0xc1a1,0xc1a2,0xa091,0xc1a3,0xa092,0xc1a4,0xc1a5,0xa093,
-0xa094,0xa095,0xa096,0xa097,0xc1a6,0xc1a7,0xa098,0xa099,
-0xc1a8,0xa09a,0xa09b,0xa09c,0xc1a9,0xa09d,0xa09e,0xa09f,
-0xa0a0,0xa0a1,0xa0a2,0xa0a3,0xc1aa,0xc1ab,0xa0a4,0xc1ac,
-0xa0a5,0xc1ad,0xa0a6,0xa0a7,0xa0a8,0xa0a9,0xa0aa,0xa0ab,
-0xc1ae,0xa0ac,0xa0ad,0xa0ae,0xc1af,0xa0af,0xa0b0,0xa0b1,
-0xc1b0,0xa0b2,0xa0b3,0xa0b4,0xa0b5,0xa0b6,0xa0b7,0xa0b8,
-0xc1b1,0xc1b2,0xa0b9,0xa0ba,0xc1b3,0xc1b4,0xa0bb,0xa0bc,
-0xa0bd,0xa0be,0xa0bf,0xa0c0,0xc1b5,0xa0c1,0xa0c2,0xa0c3,
-0xa0c4,0xa0c5,0xa0c6,0xa0c7,0xa0c8,0xa0c9,0xa0ca,0xa0cb,
-0xa0cc,0xa0cd,0xa0ce,0xa0cf,0xa0d0,0xa0d1,0xa0d2,0xa0d3,
-0xa0d4,0xa0d5,0xa0d6,0xa0d7,0xa0d8,0xa0d9,0xa0da,0xa0db,
-0xc1b6,0xc1b7,0xa0dc,0xa0dd,0xc1b8,0xa0de,0xa0df,0xa0e0,
-0xc1b9,0xa0e1,0xc1ba,0xa0e2,0xa0e3,0xa0e4,0xa0e5,0xa0e6,
-0xc1bb,0xc1bc,0xa0e7,0xc1bd,0xa0e8,0xc1be,0xc1bf,0xc1c0,
-0xa0e9,0xa0ea,0xa0eb,0xc1c1,0xc1c2,0xc1c3,0xa0ec,0xa0ed,
-0xa0ee,0xa0ef,0xa0f0,0xa0f1,0xc1c4,0xa0f2,0xa0f3,0xa0f4,
-0xa0f5,0xa0f6,0xa0f7,0xa0f8,0xa0f9,0xc1c5,0xa0fa,0xc1c6,
-0xa0fb,0xc1c7,0xa0fc,0xa0fd,0xa0fe,0xa141,0xa142,0xa143,
-0xc1c8,0xa144,0xa145,0xa146,0xa147,0xa148,0xa149,0xa14a,
-0xa14b,0xa14c,0xa14d,0xa14e,0xa14f,0xa150,0xa151,0xa152,
-0xa153,0xa154,0xa155,0xa156,0xc1c9,0xc1ca,0xa157,0xa158,
-0xa159,0xa15a,0xa161,0xa162,0xc1cb,0xa163,0xa164,0xa165,
-0xc1cc,0xa166,0xa167,0xa168,0xc1cd,0xa169,0xa16a,0xa16b,
-0xa16c,0xa16d,0xa16e,0xa16f,0xc1ce,0xc1cf,0xa170,0xc1d0,
-0xa171,0xc1d1,0xa172,0xa173,0xa174,0xa175,0xa176,0xa177,
-0xc1d2,0xc1d3,0xa178,0xa179,0xc1d4,0xa17a,0xa181,0xa182,
-0xa183,0xa184,0xa185,0xa186,0xa187,0xa188,0xa189,0xa18a,
-0xa18b,0xa18c,0xa18d,0xa18e,0xa18f,0xc1d5,0xa190,0xa191,
-0xa192,0xa193,0xa194,0xa195,0xc1d6,0xc1d7,0xa196,0xa197,
-/* 0xc900 */
-0xc1d8,0xa198,0xa199,0xa19a,0xc1d9,0xc1da,0xc1db,0xa19b,
-0xa19c,0xa19d,0xa19e,0xa19f,0xc1dc,0xc1dd,0xa1a0,0xc1de,
-0xa241,0xc1df,0xa242,0xa243,0xa244,0xa245,0xa246,0xa247,
-0xc1e0,0xa248,0xa249,0xa24a,0xa24b,0xa24c,0xa24d,0xa24e,
-0xa24f,0xa250,0xa251,0xa252,0xa253,0xa254,0xa255,0xa256,
-0xa257,0xa258,0xa259,0xa25a,0xc1e1,0xa261,0xa262,0xa263,
-0xa264,0xa265,0xa266,0xa267,0xc1e2,0xa268,0xa269,0xa26a,
-0xa26b,0xa26c,0xa26d,0xa26e,0xa26f,0xa270,0xa271,0xa272,
-0xa273,0xa274,0xa275,0xa276,0xa277,0xa278,0xa279,0xa27a,
-0xa281,0xa282,0xa283,0xa284,0xa285,0xa286,0xa287,0xa288,
-0xc1e3,0xc1e4,0xa289,0xa28a,0xc1e5,0xa28b,0xa28c,0xa28d,
-0xc1e6,0xa28e,0xa28f,0xa290,0xa291,0xa292,0xa293,0xa294,
-0xc1e7,0xc1e8,0xa295,0xc1e9,0xa296,0xa297,0xa298,0xa299,
-0xa29a,0xa29b,0xa29c,0xa29d,0xc1ea,0xa29e,0xa29f,0xa2a0,
-0xc1eb,0xa341,0xa342,0xa343,0xc1ec,0xa344,0xa345,0xa346,
-0xa347,0xa348,0xa349,0xa34a,0xc1ed,0xa34b,0xa34c,0xa34d,
-0xa34e,0xa34f,0xa350,0xa351,0xa352,0xa353,0xa354,0xa355,
-0xc1ee,0xc1ef,0xa356,0xa357,0xc1f0,0xa358,0xa359,0xa35a,
-0xc1f1,0xa361,0xa362,0xa363,0xa364,0xa365,0xa366,0xa367,
-0xc1f2,0xc1f3,0xa368,0xc1f4,0xa369,0xc1f5,0xa36a,0xa36b,
-0xa36c,0xa36d,0xa36e,0xa36f,0xa370,0xa371,0xa372,0xa373,
-0xa374,0xa375,0xa376,0xa377,0xa378,0xa379,0xa37a,0xa381,
-0xa382,0xa383,0xa384,0xa385,0xa386,0xa387,0xa388,0xa389,
-0xa38a,0xa38b,0xa38c,0xa38d,0xa38e,0xa38f,0xa390,0xa391,
-0xc1f6,0xc1f7,0xa392,0xa393,0xc1f8,0xa394,0xa395,0xc1f9,
-0xc1fa,0xa396,0xc1fb,0xa397,0xa398,0xa399,0xa39a,0xa39b,
-0xc1fc,0xc1fd,0xa39c,0xc1fe,0xa39d,0xc2a1,0xc2a2,0xa39e,
-0xa39f,0xc2a3,0xc2a4,0xa3a0,0xc2a5,0xc2a6,0xa441,0xa442,
-0xc2a7,0xa443,0xc2a8,0xa444,0xc2a9,0xa445,0xa446,0xc2aa,
-0xa447,0xa448,0xa449,0xa44a,0xc2ab,0xc2ac,0xa44b,0xc2ad,
-0xc2ae,0xc2af,0xa44c,0xa44d,0xa44e,0xa44f,0xa450,0xa451,
-0xc2b0,0xc2b1,0xa452,0xa453,0xc2b2,0xa454,0xa455,0xa456,
-/* 0xca00 */
-0xc2b3,0xa457,0xa458,0xa459,0xa45a,0xa461,0xa462,0xa463,
-0xc2b4,0xc2b5,0xa464,0xc2b6,0xc2b7,0xc2b8,0xa465,0xa466,
-0xa467,0xa468,0xa469,0xa46a,0xc2b9,0xa46b,0xa46c,0xa46d,
-0xc2ba,0xa46e,0xa46f,0xa470,0xa471,0xa472,0xa473,0xa474,
-0xa475,0xa476,0xa477,0xa478,0xa479,0xa47a,0xa481,0xa482,
-0xa483,0xc2bb,0xa484,0xa485,0xa486,0xa487,0xa488,0xa489,
-0xa48a,0xa48b,0xa48c,0xa48d,0xa48e,0xa48f,0xa490,0xa491,
-0xa492,0xa493,0xa494,0xa495,0xa496,0xa497,0xa498,0xa499,
-0xa49a,0xa49b,0xa49c,0xa49d,0xa49e,0xa49f,0xa4a0,0xa541,
-0xa542,0xa543,0xa544,0xa545,0xc2bc,0xc2bd,0xa546,0xa547,
-0xc2be,0xa548,0xa549,0xa54a,0xc2bf,0xa54b,0xa54c,0xa54d,
-0xa54e,0xa54f,0xa550,0xa551,0xc2c0,0xc2c1,0xa552,0xc2c2,
-0xc2c3,0xc2c4,0xa553,0xa554,0xa555,0xa556,0xa557,0xa558,
-0xc2c5,0xa559,0xa55a,0xa561,0xa562,0xa563,0xa564,0xa565,
-0xa566,0xa567,0xa568,0xa569,0xa56a,0xa56b,0xa56c,0xa56d,
-0xa56e,0xa56f,0xa570,0xa571,0xa572,0xc2c6,0xa573,0xa574,
-0xa575,0xa576,0xa577,0xa578,0xc2c7,0xa579,0xa57a,0xa581,
-0xa582,0xa583,0xa584,0xa585,0xa586,0xa587,0xa588,0xa589,
-0xa58a,0xa58b,0xa58c,0xa58d,0xa58e,0xa58f,0xa590,0xa591,
-0xc2c8,0xa592,0xa593,0xa594,0xa595,0xa596,0xa597,0xa598,
-0xa599,0xa59a,0xa59b,0xa59c,0xa59d,0xa59e,0xa59f,0xa5a0,
-0xa641,0xa642,0xa643,0xa644,0xa645,0xa646,0xa647,0xa648,
-0xa649,0xa64a,0xa64b,0xa64c,0xa64d,0xa64e,0xa64f,0xa650,
-0xa651,0xa652,0xa653,0xa654,0xc2c9,0xc2ca,0xa655,0xa656,
-0xc2cb,0xa657,0xa658,0xa659,0xc2cc,0xa65a,0xa661,0xa662,
-0xa663,0xa664,0xa665,0xa666,0xc2cd,0xc2ce,0xa667,0xc2cf,
-0xa668,0xc2d0,0xa669,0xc2d1,0xa66a,0xa66b,0xa66c,0xa66d,
-0xc2d2,0xc2d3,0xa66e,0xa66f,0xa670,0xa671,0xa672,0xa673,
-0xc2d4,0xa674,0xa675,0xa676,0xa677,0xa678,0xa679,0xa67a,
-0xa681,0xa682,0xa683,0xa684,0xc2d5,0xa685,0xa686,0xa687,
-0xa688,0xa689,0xa68a,0xa68b,0xc2d6,0xa68c,0xa68d,0xa68e,
-0xa68f,0xa690,0xa691,0xa692,0xa693,0xa694,0xa695,0xa696,
-/* 0xcb00 */
-0xa697,0xa698,0xa699,0xa69a,0xa69b,0xa69c,0xa69d,0xa69e,
-0xc2d7,0xa69f,0xa6a0,0xa741,0xa742,0xa743,0xa744,0xa745,
-0xc2d8,0xa746,0xa747,0xa748,0xc2d9,0xa749,0xa74a,0xa74b,
-0xc2da,0xa74c,0xa74d,0xa74e,0xa74f,0xa750,0xa751,0xa752,
-0xc2db,0xc2dc,0xa753,0xa754,0xa755,0xa756,0xa757,0xa758,
-0xa759,0xa75a,0xa761,0xa762,0xa763,0xa764,0xa765,0xa766,
-0xa767,0xa768,0xa769,0xa76a,0xa76b,0xa76c,0xa76d,0xa76e,
-0xa76f,0xa770,0xa771,0xa772,0xa773,0xa774,0xa775,0xa776,
-0xa777,0xc2dd,0xa778,0xa779,0xa77a,0xa781,0xa782,0xa783,
-0xc2de,0xc2df,0xa784,0xa785,0xc2e0,0xa786,0xa787,0xa788,
-0xc2e1,0xa789,0xa78a,0xa78b,0xa78c,0xa78d,0xa78e,0xa78f,
-0xc2e2,0xc2e3,0xa790,0xa791,0xa792,0xc2e4,0xa793,0xa794,
-0xa795,0xa796,0xa797,0xa798,0xc2e5,0xa799,0xa79a,0xa79b,
-0xa79c,0xa79d,0xa79e,0xa79f,0xa7a0,0xa841,0xa842,0xa843,
-0xa844,0xa845,0xa846,0xa847,0xa848,0xa849,0xa84a,0xa84b,
-0xc2e6,0xc2e7,0xa84c,0xa84d,0xa84e,0xa84f,0xa850,0xa851,
-0xa852,0xa853,0xa854,0xa855,0xa856,0xa857,0xa858,0xa859,
-0xa85a,0xa861,0xa862,0xa863,0xa864,0xa865,0xa866,0xa867,
-0xa868,0xa869,0xa86a,0xa86b,0xa86c,0xa86d,0xa86e,0xa86f,
-0xa870,0xa871,0xa872,0xa873,0xc2e8,0xa874,0xa875,0xa876,
-0xa877,0xa878,0xa879,0xa87a,0xa881,0xa882,0xa883,0xa884,
-0xa885,0xa886,0xa887,0xa888,0xa889,0xa88a,0xa88b,0xa88c,
-0xa88d,0xa88e,0xa88f,0xa890,0xa891,0xa892,0xa893,0xa894,
-0xc2e9,0xa895,0xa896,0xa897,0xa898,0xa899,0xa89a,0xa89b,
-0xa89c,0xa89d,0xa89e,0xa89f,0xa8a0,0xa941,0xa942,0xa943,
-0xa944,0xa945,0xa946,0xa947,0xa948,0xa949,0xa94a,0xa94b,
-0xa94c,0xa94d,0xa94e,0xa94f,0xc2ea,0xa950,0xa951,0xa952,
-0xa953,0xa954,0xa955,0xa956,0xa957,0xa958,0xa959,0xa95a,
-0xa961,0xa962,0xa963,0xa964,0xc2eb,0xa965,0xa966,0xc2ec,
-0xa967,0xc2ed,0xa968,0xa969,0xa96a,0xa96b,0xa96c,0xa96d,
-0xa96e,0xa96f,0xa970,0xa971,0xa972,0xa973,0xa974,0xa975,
-0xa976,0xa977,0xa978,0xa979,0xa97a,0xa981,0xa982,0xa983,
-/* 0xcc00 */
-0xa984,0xa985,0xa986,0xa987,0xa988,0xa989,0xa98a,0xa98b,
-0xa98c,0xa98d,0xa98e,0xa98f,0xc2ee,0xc2ef,0xa990,0xa991,
-0xc2f0,0xa992,0xa993,0xa994,0xc2f1,0xa995,0xa996,0xa997,
-0xa998,0xa999,0xa99a,0xa99b,0xc2f2,0xc2f3,0xa99c,0xa99d,
-0xa99e,0xc2f4,0xc2f5,0xa99f,0xa9a0,0xaa41,0xaa42,0xc2f6,
-0xc2f7,0xc2f8,0xaa43,0xaa44,0xc2f9,0xaa45,0xc2fa,0xaa46,
-0xc2fb,0xaa47,0xaa48,0xaa49,0xaa4a,0xaa4b,0xaa4c,0xaa4d,
-0xc2fc,0xc2fd,0xaa4e,0xc2fe,0xc3a1,0xc3a2,0xc3a3,0xaa4f,
-0xaa50,0xaa51,0xaa52,0xaa53,0xc3a4,0xc3a5,0xaa54,0xaa55,
-0xc3a6,0xaa56,0xaa57,0xaa58,0xc3a7,0xaa59,0xaa5a,0xaa61,
-0xaa62,0xaa63,0xaa64,0xaa65,0xc3a8,0xc3a9,0xaa66,0xc3aa,
-0xc3ab,0xc3ac,0xaa67,0xaa68,0xaa69,0xaa6a,0xaa6b,0xaa6c,
-0xc3ad,0xaa6d,0xaa6e,0xaa6f,0xc3ae,0xaa70,0xc3af,0xaa71,
-0xc3b0,0xaa72,0xaa73,0xaa74,0xaa75,0xaa76,0xaa77,0xaa78,
-0xc3b1,0xaa79,0xaa7a,0xaa81,0xaa82,0xc3b2,0xaa83,0xaa84,
-0xaa85,0xaa86,0xaa87,0xaa88,0xaa89,0xaa8a,0xaa8b,0xaa8c,
-0xaa8d,0xaa8e,0xaa8f,0xaa90,0xaa91,0xaa92,0xaa93,0xaa94,
-0xaa95,0xaa96,0xaa97,0xaa98,0xaa99,0xaa9a,0xaa9b,0xaa9c,
-0xaa9d,0xaa9e,0xaa9f,0xaaa0,0xab41,0xab42,0xab43,0xab44,
-0xc3b3,0xc3b4,0xab45,0xab46,0xc3b5,0xab47,0xab48,0xab49,
-0xc3b6,0xab4a,0xab4b,0xab4c,0xab4d,0xab4e,0xab4f,0xab50,
-0xc3b7,0xc3b8,0xab51,0xc3b9,0xc3ba,0xc3bb,0xab52,0xab53,
-0xab54,0xab55,0xab56,0xab57,0xc3bc,0xc3bd,0xab58,0xab59,
-0xc3be,0xab5a,0xab61,0xab62,0xc3bf,0xab63,0xab64,0xab65,
-0xab66,0xab67,0xab68,0xab69,0xc3c0,0xc3c1,0xab6a,0xc3c2,
-0xab6b,0xc3c3,0xab6c,0xab6d,0xab6e,0xab6f,0xab70,0xab71,
-0xc3c4,0xab72,0xab73,0xab74,0xc3c5,0xab75,0xab76,0xab77,
-0xab78,0xab79,0xab7a,0xab81,0xab82,0xab83,0xab84,0xab85,
-0xab86,0xab87,0xab88,0xab89,0xc3c6,0xab8a,0xab8b,0xab8c,
-0xab8d,0xab8e,0xab8f,0xab90,0xc3c7,0xab91,0xab92,0xab93,
-0xc3c8,0xab94,0xab95,0xab96,0xab97,0xab98,0xab99,0xab9a,
-0xab9b,0xab9c,0xab9d,0xab9e,0xab9f,0xaba0,0xac41,0xac42,
-/* 0xcd00 */
-0xac43,0xc3c9,0xac44,0xac45,0xac46,0xac47,0xac48,0xac49,
-0xc3ca,0xc3cb,0xac4a,0xac4b,0xc3cc,0xac4c,0xac4d,0xac4e,
-0xc3cd,0xac4f,0xac50,0xac51,0xac52,0xac53,0xac54,0xac55,
-0xc3ce,0xc3cf,0xac56,0xc3d0,0xac57,0xc3d1,0xac58,0xac59,
-0xac5a,0xac61,0xac62,0xac63,0xc3d2,0xac64,0xac65,0xac66,
-0xc3d3,0xac67,0xac68,0xac69,0xc3d4,0xac6a,0xac6b,0xac6c,
-0xac6d,0xac6e,0xac6f,0xac70,0xac71,0xac72,0xac73,0xac74,
-0xac75,0xc3d5,0xac76,0xac77,0xac78,0xac79,0xac7a,0xac81,
-0xac82,0xac83,0xac84,0xac85,0xac86,0xac87,0xac88,0xac89,
-0xac8a,0xac8b,0xac8c,0xac8d,0xac8e,0xac8f,0xac90,0xac91,
-0xac92,0xac93,0xac94,0xac95,0xac96,0xac97,0xac98,0xac99,
-0xac9a,0xac9b,0xac9c,0xac9d,0xc3d6,0xac9e,0xac9f,0xaca0,
-0xc3d7,0xad41,0xad42,0xad43,0xc3d8,0xad44,0xad45,0xad46,
-0xad47,0xad48,0xad49,0xad4a,0xc3d9,0xc3da,0xad4b,0xc3db,
-0xad4c,0xc3dc,0xad4d,0xad4e,0xad4f,0xad50,0xad51,0xad52,
-0xc3dd,0xad53,0xad54,0xad55,0xad56,0xad57,0xad58,0xad59,
-0xad5a,0xad61,0xad62,0xad63,0xad64,0xad65,0xad66,0xad67,
-0xc3de,0xad68,0xad69,0xad6a,0xad6b,0xad6c,0xad6d,0xad6e,
-0xad6f,0xad70,0xad71,0xad72,0xc3df,0xc3e0,0xad73,0xad74,
-0xc3e1,0xad75,0xad76,0xad77,0xc3e2,0xad78,0xad79,0xad7a,
-0xad81,0xad82,0xad83,0xad84,0xc3e3,0xc3e4,0xad85,0xc3e5,
-0xad86,0xc3e6,0xad87,0xad88,0xad89,0xad8a,0xad8b,0xad8c,
-0xc3e7,0xad8d,0xad8e,0xad8f,0xad90,0xad91,0xad92,0xad93,
-0xad94,0xad95,0xad96,0xad97,0xad98,0xad99,0xad9a,0xad9b,
-0xad9c,0xad9d,0xad9e,0xad9f,0xc3e8,0xada0,0xae41,0xae42,
-0xae43,0xae44,0xae45,0xae46,0xc3e9,0xae47,0xae48,0xae49,
-0xc3ea,0xae4a,0xae4b,0xae4c,0xae4d,0xae4e,0xae4f,0xae50,
-0xae51,0xae52,0xae53,0xae54,0xae55,0xae56,0xae57,0xae58,
-0xae59,0xae5a,0xae61,0xae62,0xae63,0xae64,0xae65,0xae66,
-0xc3eb,0xae67,0xae68,0xae69,0xc3ec,0xae6a,0xae6b,0xae6c,
-0xc3ed,0xae6d,0xae6e,0xae6f,0xae70,0xae71,0xae72,0xae73,
-0xc3ee,0xc3ef,0xae74,0xc3f0,0xae75,0xc3f1,0xae76,0xae77,
-/* 0xce00 */
-0xae78,0xae79,0xae7a,0xae81,0xc3f2,0xae82,0xae83,0xae84,
-0xc3f3,0xae85,0xae86,0xae87,0xc3f4,0xae88,0xae89,0xae8a,
-0xae8b,0xae8c,0xae8d,0xae8e,0xc3f5,0xae8f,0xae90,0xae91,
-0xae92,0xc3f6,0xae93,0xae94,0xae95,0xae96,0xae97,0xae98,
-0xc3f7,0xc3f8,0xae99,0xae9a,0xc3f9,0xae9b,0xae9c,0xae9d,
-0xc3fa,0xae9e,0xae9f,0xaea0,0xaf41,0xaf42,0xaf43,0xaf44,
-0xc3fb,0xc3fc,0xaf45,0xc3fd,0xaf46,0xc3fe,0xaf47,0xaf48,
-0xaf49,0xaf4a,0xaf4b,0xaf4c,0xaf4d,0xaf4e,0xaf4f,0xaf50,
-0xaf51,0xaf52,0xaf53,0xaf54,0xaf55,0xaf56,0xaf57,0xaf58,
-0xaf59,0xaf5a,0xaf61,0xaf62,0xaf63,0xaf64,0xaf65,0xaf66,
-0xaf67,0xaf68,0xaf69,0xaf6a,0xaf6b,0xaf6c,0xaf6d,0xaf6e,
-0xc4a1,0xc4a2,0xaf6f,0xaf70,0xc4a3,0xaf71,0xaf72,0xc4a4,
-0xc4a5,0xc4a6,0xaf73,0xaf74,0xaf75,0xaf76,0xaf77,0xaf78,
-0xc4a7,0xc4a8,0xaf79,0xc4a9,0xaf7a,0xc4aa,0xaf81,0xaf82,
-0xaf83,0xaf84,0xaf85,0xaf86,0xc4ab,0xc4ac,0xaf87,0xaf88,
-0xc4ad,0xaf89,0xaf8a,0xaf8b,0xc4ae,0xaf8c,0xaf8d,0xaf8e,
-0xaf8f,0xaf90,0xaf91,0xaf92,0xc4af,0xc4b0,0xaf93,0xc4b1,
-0xaf94,0xc4b2,0xaf95,0xaf96,0xaf97,0xaf98,0xaf99,0xaf9a,
-0xc4b3,0xc4b4,0xaf9b,0xaf9c,0xc4b5,0xaf9d,0xaf9e,0xaf9f,
-0xc4b6,0xafa0,0xb041,0xb042,0xb043,0xb044,0xb045,0xb046,
-0xc4b7,0xc4b8,0xb047,0xc4b9,0xc4ba,0xc4bb,0xb048,0xb049,
-0xb04a,0xb04b,0xb04c,0xb04d,0xc4bc,0xc4bd,0xb04e,0xb04f,
-0xb050,0xb051,0xb052,0xb053,0xb054,0xb055,0xb056,0xb057,
-0xb058,0xb059,0xb05a,0xb061,0xb062,0xb063,0xb064,0xb065,
-0xb066,0xc4be,0xb067,0xb068,0xb069,0xb06a,0xb06b,0xb06c,
-0xb06d,0xb06e,0xb06f,0xb070,0xb071,0xb072,0xb073,0xb074,
-0xb075,0xb076,0xb077,0xb078,0xb079,0xb07a,0xb081,0xb082,
-0xb083,0xb084,0xb085,0xb086,0xb087,0xb088,0xb089,0xb08a,
-0xb08b,0xb08c,0xb08d,0xb08e,0xc4bf,0xc4c0,0xb08f,0xb090,
-0xc4c1,0xb091,0xb092,0xc4c2,0xc4c3,0xb093,0xb094,0xb095,
-0xb096,0xb097,0xb098,0xb099,0xc4c4,0xc4c5,0xb09a,0xc4c6,
-0xc4c7,0xc4c8,0xb09b,0xb09c,0xb09d,0xb09e,0xb09f,0xb0a0,
-/* 0xcf00 */
-0xc4c9,0xc4ca,0xb141,0xb142,0xc4cb,0xb143,0xb144,0xb145,
-0xc4cc,0xb146,0xb147,0xb148,0xb149,0xb14a,0xb14b,0xb14c,
-0xc4cd,0xc4ce,0xb14d,0xc4cf,0xb14e,0xc4d0,0xb14f,0xb150,
-0xb151,0xb152,0xb153,0xb154,0xc4d1,0xb155,0xb156,0xb157,
-0xc4d2,0xb158,0xb159,0xb15a,0xc4d3,0xb161,0xb162,0xb163,
-0xb164,0xb165,0xb166,0xb167,0xc4d4,0xc4d5,0xb168,0xc4d6,
-0xc4d7,0xc4d8,0xb169,0xb16a,0xb16b,0xb16c,0xb16d,0xb16e,
-0xc4d9,0xb16f,0xb170,0xb171,0xb172,0xb173,0xb174,0xb175,
-0xb176,0xb177,0xb178,0xb179,0xb17a,0xb181,0xb182,0xb183,
-0xb184,0xb185,0xb186,0xb187,0xb188,0xb189,0xb18a,0xb18b,
-0xb18c,0xb18d,0xb18e,0xb18f,0xc4da,0xc4db,0xb190,0xb191,
-0xc4dc,0xb192,0xb193,0xb194,0xc4dd,0xb195,0xb196,0xb197,
-0xb198,0xb199,0xb19a,0xb19b,0xc4de,0xc4df,0xb19c,0xc4e0,
-0xb19d,0xc4e1,0xb19e,0xb19f,0xb1a0,0xb241,0xb242,0xb243,
-0xc4e2,0xc4e3,0xb244,0xb245,0xc4e4,0xb246,0xb247,0xb248,
-0xc4e5,0xb249,0xb24a,0xb24b,0xb24c,0xb24d,0xb24e,0xb24f,
-0xc4e6,0xb250,0xb251,0xb252,0xb253,0xc4e7,0xb254,0xb255,
-0xb256,0xb257,0xb258,0xb259,0xc4e8,0xb25a,0xb261,0xb262,
-0xb263,0xb264,0xb265,0xb266,0xb267,0xb268,0xb269,0xb26a,
-0xb26b,0xb26c,0xb26d,0xb26e,0xb26f,0xb270,0xb271,0xb272,
-0xb273,0xc4e9,0xb274,0xb275,0xb276,0xb277,0xb278,0xb279,
-0xc4ea,0xb27a,0xb281,0xb282,0xb283,0xb284,0xb285,0xb286,
-0xc4eb,0xb287,0xb288,0xb289,0xb28a,0xb28b,0xb28c,0xb28d,
-0xb28e,0xb28f,0xb290,0xb291,0xb292,0xb293,0xb294,0xb295,
-0xb296,0xb297,0xb298,0xb299,0xc4ec,0xb29a,0xb29b,0xb29c,
-0xb29d,0xb29e,0xb29f,0xb2a0,0xb341,0xb342,0xb343,0xb344,
-0xb345,0xb346,0xb347,0xb348,0xb349,0xb34a,0xb34b,0xb34c,
-0xb34d,0xb34e,0xb34f,0xb350,0xb351,0xb352,0xb353,0xb354,
-0xc4ed,0xc4ee,0xb355,0xb356,0xc4ef,0xb357,0xb358,0xb359,
-0xc4f0,0xb35a,0xb361,0xb362,0xb363,0xb364,0xb365,0xb366,
-0xc4f1,0xc4f2,0xb367,0xc4f3,0xb368,0xc4f4,0xb369,0xb36a,
-0xb36b,0xb36c,0xb36d,0xb36e,0xc4f5,0xb36f,0xb370,0xb371,
-/* 0xd000 */
-0xc4f6,0xb372,0xb373,0xb374,0xc4f7,0xb375,0xb376,0xb377,
-0xb378,0xb379,0xb37a,0xb381,0xb382,0xb383,0xb384,0xb385,
-0xb386,0xc4f8,0xb387,0xb388,0xb389,0xb38a,0xb38b,0xb38c,
-0xc4f9,0xb38d,0xb38e,0xb38f,0xb390,0xb391,0xb392,0xb393,
-0xb394,0xb395,0xb396,0xb397,0xb398,0xb399,0xb39a,0xb39b,
-0xb39c,0xb39d,0xb39e,0xb39f,0xb3a0,0xc4fa,0xb441,0xb442,
-0xb443,0xb444,0xb445,0xb446,0xc4fb,0xc4fc,0xb447,0xb448,
-0xc4fd,0xb449,0xb44a,0xb44b,0xc4fe,0xb44c,0xb44d,0xb44e,
-0xb44f,0xb450,0xb451,0xb452,0xc5a1,0xc5a2,0xb453,0xc5a3,
-0xb454,0xc5a4,0xb455,0xb456,0xb457,0xb458,0xb459,0xb45a,
-0xc5a5,0xb461,0xb462,0xb463,0xc5a6,0xb464,0xb465,0xb466,
-0xc5a7,0xb467,0xb468,0xb469,0xb46a,0xb46b,0xb46c,0xb46d,
-0xc5a8,0xb46e,0xb46f,0xb470,0xb471,0xb472,0xb473,0xb474,
-0xb475,0xb476,0xb477,0xb478,0xc5a9,0xc5aa,0xb479,0xb47a,
-0xc5ab,0xb481,0xb482,0xb483,0xc5ac,0xb484,0xb485,0xb486,
-0xb487,0xb488,0xb489,0xb48a,0xc5ad,0xc5ae,0xb48b,0xb48c,
-0xb48d,0xc5af,0xb48e,0xb48f,0xb490,0xb491,0xb492,0xb493,
-0xb494,0xb495,0xb496,0xb497,0xb498,0xb499,0xb49a,0xb49b,
-0xb49c,0xb49d,0xb49e,0xb49f,0xb4a0,0xb541,0xb542,0xb543,
-0xb544,0xb545,0xb546,0xb547,0xb548,0xb549,0xb54a,0xb54b,
-0xb54c,0xb54d,0xb54e,0xb54f,0xc5b0,0xc5b1,0xb550,0xb551,
-0xc5b2,0xb552,0xb553,0xb554,0xc5b3,0xb555,0xb556,0xb557,
-0xb558,0xb559,0xb55a,0xb561,0xc5b4,0xc5b5,0xb562,0xc5b6,
-0xb563,0xc5b7,0xb564,0xb565,0xb566,0xb567,0xb568,0xb569,
-0xc5b8,0xc5b9,0xb56a,0xb56b,0xc5ba,0xb56c,0xb56d,0xb56e,
-0xc5bb,0xc5bc,0xb56f,0xb570,0xb571,0xb572,0xb573,0xb574,
-0xc5bd,0xc5be,0xb575,0xc5bf,0xc5c0,0xc5c1,0xb576,0xb577,
-0xb578,0xb579,0xb57a,0xb581,0xc5c2,0xc5c3,0xb582,0xb583,
-0xc5c4,0xb584,0xb585,0xb586,0xc5c5,0xb587,0xb588,0xb589,
-0xb58a,0xb58b,0xb58c,0xb58d,0xc5c6,0xc5c7,0xb58e,0xc5c8,
-0xc5c9,0xc5ca,0xb58f,0xb590,0xb591,0xb592,0xb593,0xb594,
-0xc5cb,0xb595,0xb596,0xb597,0xb598,0xb599,0xb59a,0xb59b,
-/* 0xd100 */
-0xb59c,0xb59d,0xb59e,0xb59f,0xb5a0,0xb641,0xb642,0xb643,
-0xb644,0xb645,0xb646,0xb647,0xb648,0xc5cc,0xb649,0xb64a,
-0xb64b,0xb64c,0xb64d,0xb64e,0xb64f,0xb650,0xb651,0xb652,
-0xb653,0xb654,0xb655,0xb656,0xb657,0xb658,0xb659,0xb65a,
-0xb661,0xb662,0xb663,0xb664,0xb665,0xb666,0xb667,0xb668,
-0xb669,0xb66a,0xb66b,0xb66c,0xb66d,0xb66e,0xb66f,0xb670,
-0xc5cd,0xc5ce,0xb671,0xb672,0xc5cf,0xb673,0xb674,0xb675,
-0xc5d0,0xb676,0xc5d1,0xb677,0xb678,0xb679,0xb67a,0xb681,
-0xc5d2,0xc5d3,0xb682,0xc5d4,0xc5d5,0xc5d6,0xb683,0xb684,
-0xb685,0xb686,0xb687,0xb688,0xc5d7,0xc5d8,0xb689,0xb68a,
-0xc5d9,0xb68b,0xb68c,0xb68d,0xc5da,0xb68e,0xb68f,0xb690,
-0xb691,0xb692,0xb693,0xb694,0xc5db,0xc5dc,0xb695,0xc5dd,
-0xb696,0xc5de,0xb697,0xb698,0xb699,0xb69a,0xb69b,0xb69c,
-0xc5df,0xb69d,0xb69e,0xb69f,0xc5e0,0xb6a0,0xb741,0xb742,
-0xb743,0xb744,0xb745,0xb746,0xb747,0xb748,0xb749,0xb74a,
-0xb74b,0xb74c,0xb74d,0xb74e,0xc5e1,0xb74f,0xb750,0xb751,
-0xb752,0xb753,0xb754,0xb755,0xc5e2,0xb756,0xb757,0xb758,
-0xc5e3,0xb759,0xb75a,0xb761,0xb762,0xb763,0xb764,0xb765,
-0xb766,0xb767,0xb768,0xb769,0xb76a,0xb76b,0xb76c,0xb76d,
-0xb76e,0xb76f,0xb770,0xb771,0xb772,0xb773,0xb774,0xb775,
-0xc5e4,0xc5e5,0xb776,0xb777,0xc5e6,0xb778,0xb779,0xb77a,
-0xc5e7,0xb781,0xb782,0xb783,0xb784,0xb785,0xb786,0xb787,
-0xc5e8,0xc5e9,0xb788,0xc5ea,0xb789,0xc5eb,0xb78a,0xb78b,
-0xb78c,0xb78d,0xc5ec,0xb78e,0xc5ed,0xb78f,0xb790,0xb791,
-0xc5ee,0xb792,0xb793,0xb794,0xb795,0xb796,0xb797,0xb798,
-0xb799,0xb79a,0xb79b,0xb79c,0xb79d,0xb79e,0xb79f,0xb7a0,
-0xb841,0xb842,0xb843,0xb844,0xb845,0xb846,0xb847,0xb848,
-0xc5ef,0xb849,0xb84a,0xb84b,0xb84c,0xb84d,0xb84e,0xb84f,
-0xb850,0xb851,0xb852,0xb853,0xb854,0xb855,0xb856,0xb857,
-0xb858,0xb859,0xb85a,0xb861,0xb862,0xb863,0xb864,0xb865,
-0xb866,0xb867,0xb868,0xb869,0xc5f0,0xb86a,0xb86b,0xb86c,
-0xc5f1,0xb86d,0xb86e,0xb86f,0xb870,0xb871,0xb872,0xb873,
-/* 0xd200 */
-0xb874,0xb875,0xb876,0xb877,0xb878,0xb879,0xb87a,0xc5f2,
-0xb881,0xc5f3,0xb882,0xb883,0xb884,0xb885,0xb886,0xb887,
-0xc5f4,0xb888,0xb889,0xb88a,0xb88b,0xb88c,0xb88d,0xb88e,
-0xb88f,0xb890,0xb891,0xb892,0xb893,0xb894,0xb895,0xb896,
-0xb897,0xb898,0xb899,0xb89a,0xb89b,0xb89c,0xb89d,0xb89e,
-0xb89f,0xb8a0,0xb941,0xb942,0xc5f5,0xc5f6,0xb943,0xb944,
-0xc5f7,0xb945,0xb946,0xb947,0xc5f8,0xb948,0xb949,0xb94a,
-0xb94b,0xb94c,0xb94d,0xb94e,0xc5f9,0xc5fa,0xb94f,0xc5fb,
-0xb950,0xc5fc,0xb951,0xb952,0xb953,0xb954,0xb955,0xb956,
-0xc5fd,0xb957,0xb958,0xb959,0xb95a,0xb961,0xb962,0xb963,
-0xb964,0xb965,0xb966,0xb967,0xb968,0xb969,0xb96a,0xb96b,
-0xb96c,0xb96d,0xb96e,0xb96f,0xc5fe,0xb970,0xb971,0xb972,
-0xb973,0xb974,0xb975,0xb976,0xc6a1,0xb977,0xb978,0xb979,
-0xb97a,0xb981,0xb982,0xb983,0xb984,0xb985,0xb986,0xb987,
-0xb988,0xb989,0xb98a,0xb98b,0xb98c,0xb98d,0xb98e,0xb98f,
-0xb990,0xb991,0xb992,0xb993,0xb994,0xb995,0xb996,0xb997,
-0xc6a2,0xc6a3,0xb998,0xb999,0xc6a4,0xb99a,0xb99b,0xb99c,
-0xc6a5,0xb99d,0xb99e,0xb99f,0xb9a0,0xba41,0xba42,0xba43,
-0xc6a6,0xc6a7,0xba44,0xba45,0xba46,0xc6a8,0xba47,0xba48,
-0xba49,0xba4a,0xba4b,0xba4c,0xc6a9,0xba4d,0xba4e,0xba4f,
-0xc6aa,0xba50,0xba51,0xba52,0xc6ab,0xba53,0xba54,0xba55,
-0xba56,0xba57,0xba58,0xba59,0xc6ac,0xba5a,0xba61,0xba62,
-0xba63,0xc6ad,0xba64,0xba65,0xba66,0xba67,0xba68,0xba69,
-0xc6ae,0xc6af,0xba6a,0xba6b,0xc6b0,0xba6c,0xba6d,0xc6b1,
-0xc6b2,0xba6e,0xc6b3,0xba6f,0xba70,0xba71,0xba72,0xba73,
-0xc6b4,0xc6b5,0xba74,0xc6b6,0xba75,0xba76,0xba77,0xba78,
-0xba79,0xba7a,0xba81,0xba82,0xc6b7,0xba83,0xba84,0xba85,
-0xc6b8,0xba86,0xba87,0xba88,0xc6b9,0xba89,0xba8a,0xba8b,
-0xba8c,0xba8d,0xba8e,0xba8f,0xc6ba,0xc6bb,0xba90,0xba91,
-0xba92,0xba93,0xba94,0xba95,0xba96,0xba97,0xba98,0xba99,
-0xc6bc,0xc6bd,0xba9a,0xba9b,0xc6be,0xba9c,0xba9d,0xba9e,
-0xc6bf,0xba9f,0xbaa0,0xbb41,0xbb42,0xbb43,0xbb44,0xbb45,
-/* 0xd300 */
-0xc6c0,0xc6c1,0xbb46,0xc6c2,0xbb47,0xc6c3,0xbb48,0xbb49,
-0xbb4a,0xbb4b,0xbb4c,0xbb4d,0xc6c4,0xc6c5,0xc6c6,0xbb4e,
-0xc6c7,0xbb4f,0xbb50,0xbb51,0xc6c8,0xbb52,0xc6c9,0xbb53,
-0xbb54,0xbb55,0xbb56,0xbb57,0xc6ca,0xc6cb,0xbb58,0xc6cc,
-0xc6cd,0xc6ce,0xbb59,0xbb5a,0xbb61,0xc6cf,0xbb62,0xbb63,
-0xc6d0,0xc6d1,0xbb64,0xbb65,0xc6d2,0xbb66,0xbb67,0xbb68,
-0xc6d3,0xbb69,0xbb6a,0xbb6b,0xbb6c,0xbb6d,0xbb6e,0xbb6f,
-0xc6d4,0xc6d5,0xbb70,0xc6d6,0xc6d7,0xc6d8,0xbb71,0xbb72,
-0xbb73,0xbb74,0xbb75,0xbb76,0xc6d9,0xc6da,0xbb77,0xbb78,
-0xbb79,0xbb7a,0xbb81,0xbb82,0xbb83,0xbb84,0xbb85,0xbb86,
-0xbb87,0xbb88,0xbb89,0xbb8a,0xbb8b,0xbb8c,0xbb8d,0xbb8e,
-0xbb8f,0xbb90,0xbb91,0xbb92,0xbb93,0xbb94,0xbb95,0xbb96,
-0xbb97,0xbb98,0xbb99,0xbb9a,0xbb9b,0xbb9c,0xbb9d,0xbb9e,
-0xbb9f,0xbba0,0xbc41,0xbc42,0xbc43,0xbc44,0xbc45,0xbc46,
-0xbc47,0xbc48,0xbc49,0xbc4a,0xbc4b,0xbc4c,0xbc4d,0xbc4e,
-0xbc4f,0xbc50,0xbc51,0xbc52,0xc6db,0xc6dc,0xbc53,0xbc54,
-0xc6dd,0xbc55,0xbc56,0xbc57,0xc6de,0xbc58,0xbc59,0xbc5a,
-0xbc61,0xbc62,0xbc63,0xbc64,0xc6df,0xc6e0,0xbc65,0xc6e1,
-0xc6e2,0xc6e3,0xbc66,0xbc67,0xbc68,0xbc69,0xbc6a,0xbc6b,
-0xc6e4,0xc6e5,0xbc6c,0xbc6d,0xc6e6,0xbc6e,0xbc6f,0xbc70,
-0xc6e7,0xbc71,0xbc72,0xbc73,0xbc74,0xbc75,0xbc76,0xbc77,
-0xc6e8,0xc6e9,0xbc78,0xc6ea,0xbc79,0xc6eb,0xbc7a,0xbc81,
-0xbc82,0xbc83,0xbc84,0xbc85,0xc6ec,0xbc86,0xbc87,0xbc88,
-0xc6ed,0xbc89,0xbc8a,0xbc8b,0xc6ee,0xbc8c,0xbc8d,0xbc8e,
-0xbc8f,0xbc90,0xbc91,0xbc92,0xc6ef,0xc6f0,0xbc93,0xbc94,
-0xc6f1,0xc6f2,0xbc95,0xbc96,0xbc97,0xbc98,0xbc99,0xbc9a,
-0xc6f3,0xbc9b,0xbc9c,0xbc9d,0xbc9e,0xbc9f,0xbca0,0xbd41,
-0xc6f4,0xbd42,0xbd43,0xbd44,0xbd45,0xbd46,0xbd47,0xbd48,
-0xbd49,0xc6f5,0xbd4a,0xc6f6,0xbd4b,0xbd4c,0xbd4d,0xbd4e,
-0xbd4f,0xbd50,0xbd51,0xbd52,0xc6f7,0xc6f8,0xbd53,0xbd54,
-0xc6f9,0xbd55,0xbd56,0xbd57,0xc6fa,0xbd58,0xbd59,0xbd5a,
-0xbd61,0xbd62,0xbd63,0xbd64,0xc6fb,0xc6fc,0xbd65,0xc6fd,
-/* 0xd400 */
-0xbd66,0xc6fe,0xbd67,0xbd68,0xbd69,0xbd6a,0xbd6b,0xbd6c,
-0xc7a1,0xbd6d,0xbd6e,0xbd6f,0xbd70,0xbd71,0xbd72,0xbd73,
-0xbd74,0xbd75,0xbd76,0xbd77,0xbd78,0xbd79,0xbd7a,0xbd81,
-0xbd82,0xbd83,0xbd84,0xbd85,0xbd86,0xc7a2,0xbd87,0xbd88,
-0xbd89,0xbd8a,0xbd8b,0xbd8c,0xbd8d,0xbd8e,0xbd8f,0xbd90,
-0xbd91,0xbd92,0xbd93,0xbd94,0xbd95,0xbd96,0xbd97,0xbd98,
-0xbd99,0xbd9a,0xbd9b,0xbd9c,0xbd9d,0xbd9e,0xbd9f,0xbda0,
-0xbe41,0xbe42,0xbe43,0xbe44,0xbe45,0xbe46,0xbe47,0xbe48,
-0xc7a3,0xbe49,0xbe4a,0xbe4b,0xc7a4,0xbe4c,0xbe4d,0xbe4e,
-0xbe4f,0xbe50,0xbe51,0xbe52,0xbe53,0xbe54,0xbe55,0xbe56,
-0xbe57,0xbe58,0xbe59,0xbe5a,0xbe61,0xbe62,0xbe63,0xbe64,
-0xbe65,0xbe66,0xbe67,0xbe68,0xc7a5,0xbe69,0xbe6a,0xbe6b,
-0xc7a6,0xbe6c,0xbe6d,0xbe6e,0xc7a7,0xbe6f,0xbe70,0xbe71,
-0xbe72,0xbe73,0xbe74,0xbe75,0xbe76,0xc7a8,0xbe77,0xc7a9,
-0xbe78,0xbe79,0xbe7a,0xbe81,0xbe82,0xbe83,0xbe84,0xbe85,
-0xc7aa,0xc7ab,0xbe86,0xbe87,0xc7ac,0xbe88,0xbe89,0xc7ad,
-0xc7ae,0xbe8a,0xc7af,0xbe8b,0xbe8c,0xbe8d,0xbe8e,0xbe8f,
-0xc7b0,0xc7b1,0xbe90,0xc7b2,0xbe91,0xc7b3,0xbe92,0xbe93,
-0xbe94,0xbe95,0xbe96,0xbe97,0xc7b4,0xbe98,0xbe99,0xbe9a,
-0xbe9b,0xbe9c,0xbe9d,0xbe9e,0xbe9f,0xbea0,0xbf41,0xbf42,
-0xbf43,0xbf44,0xbf45,0xbf46,0xbf47,0xbf48,0xbf49,0xbf4a,
-0xbf4b,0xc7b5,0xbf4c,0xbf4d,0xbf4e,0xbf4f,0xbf50,0xbf51,
-0xbf52,0xbf53,0xbf54,0xbf55,0xbf56,0xbf57,0xbf58,0xbf59,
-0xbf5a,0xbf61,0xbf62,0xbf63,0xbf64,0xbf65,0xbf66,0xbf67,
-0xbf68,0xbf69,0xbf6a,0xbf6b,0xbf6c,0xbf6d,0xbf6e,0xbf6f,
-0xbf70,0xbf71,0xbf72,0xbf73,0xc7b6,0xbf74,0xbf75,0xbf76,
-0xc7b7,0xbf77,0xbf78,0xbf79,0xc7b8,0xbf7a,0xbf81,0xbf82,
-0xbf83,0xbf84,0xbf85,0xbf86,0xc7b9,0xbf87,0xbf88,0xc7ba,
-0xbf89,0xbf8a,0xbf8b,0xbf8c,0xbf8d,0xbf8e,0xbf8f,0xbf90,
-0xc7bb,0xbf91,0xbf92,0xbf93,0xc7bc,0xbf94,0xbf95,0xbf96,
-0xc7bd,0xbf97,0xbf98,0xbf99,0xbf9a,0xbf9b,0xbf9c,0xbf9d,
-0xc7be,0xbf9e,0xbf9f,0xc7bf,0xbfa0,0xc7c0,0xc041,0xc042,
-/* 0xd500 */
-0xc043,0xc044,0xc045,0xc046,0xc7c1,0xc047,0xc048,0xc049,
-0xc7c2,0xc04a,0xc04b,0xc04c,0xc7c3,0xc04d,0xc04e,0xc04f,
-0xc050,0xc051,0xc052,0xc053,0xc7c4,0xc7c5,0xc054,0xc7c6,
-0xc055,0xc056,0xc057,0xc058,0xc059,0xc05a,0xc061,0xc062,
-0xc063,0xc064,0xc065,0xc066,0xc067,0xc068,0xc069,0xc06a,
-0xc06b,0xc06c,0xc06d,0xc06e,0xc06f,0xc070,0xc071,0xc072,
-0xc073,0xc074,0xc075,0xc076,0xc077,0xc078,0xc079,0xc07a,
-0xc081,0xc082,0xc083,0xc084,0xc7c7,0xc7c8,0xc085,0xc086,
-0xc7c9,0xc087,0xc088,0xc089,0xc7ca,0xc08a,0xc08b,0xc08c,
-0xc08d,0xc08e,0xc08f,0xc090,0xc7cb,0xc7cc,0xc091,0xc7cd,
-0xc092,0xc7ce,0xc093,0xc094,0xc095,0xc096,0xc097,0xc098,
-0xc7cf,0xc7d0,0xc099,0xc09a,0xc7d1,0xc09b,0xc09c,0xc09d,
-0xc7d2,0xc09e,0xc09f,0xc0a0,0xc141,0xc7d3,0xc142,0xc143,
-0xc7d4,0xc7d5,0xc144,0xc7d6,0xc145,0xc7d7,0xc146,0xc147,
-0xc148,0xc149,0xc14a,0xc14b,0xc7d8,0xc7d9,0xc14c,0xc14d,
-0xc7da,0xc14e,0xc14f,0xc150,0xc7db,0xc151,0xc152,0xc153,
-0xc154,0xc155,0xc156,0xc157,0xc7dc,0xc7dd,0xc158,0xc7de,
-0xc7df,0xc7e0,0xc159,0xc15a,0xc161,0xc162,0xc163,0xc164,
-0xc7e1,0xc165,0xc166,0xc167,0xc168,0xc169,0xc16a,0xc16b,
-0xc16c,0xc16d,0xc16e,0xc16f,0xc170,0xc171,0xc172,0xc173,
-0xc174,0xc175,0xc176,0xc177,0xc178,0xc7e2,0xc179,0xc17a,
-0xc181,0xc182,0xc183,0xc184,0xc185,0xc186,0xc187,0xc188,
-0xc189,0xc18a,0xc18b,0xc18c,0xc18d,0xc18e,0xc18f,0xc190,
-0xc191,0xc192,0xc193,0xc194,0xc195,0xc196,0xc197,0xc198,
-0xc199,0xc19a,0xc19b,0xc19c,0xc19d,0xc19e,0xc19f,0xc1a0,
-0xc7e3,0xc7e4,0xc241,0xc242,0xc7e5,0xc243,0xc244,0xc245,
-0xc7e6,0xc246,0xc7e7,0xc247,0xc248,0xc249,0xc24a,0xc24b,
-0xc7e8,0xc7e9,0xc24c,0xc7ea,0xc24d,0xc7eb,0xc24e,0xc24f,
-0xc250,0xc251,0xc252,0xc253,0xc7ec,0xc7ed,0xc254,0xc255,
-0xc7ee,0xc256,0xc257,0xc258,0xc7ef,0xc259,0xc25a,0xc261,
-0xc262,0xc263,0xc264,0xc265,0xc7f0,0xc7f1,0xc266,0xc7f2,
-0xc267,0xc7f3,0xc268,0xc269,0xc26a,0xc26b,0xc26c,0xc26d,
-/* 0xd600 */
-0xc7f4,0xc7f5,0xc26e,0xc26f,0xc7f6,0xc270,0xc271,0xc272,
-0xc7f7,0xc273,0xc274,0xc275,0xc276,0xc277,0xc278,0xc279,
-0xc7f8,0xc7f9,0xc27a,0xc7fa,0xc7fb,0xc7fc,0xc281,0xc282,
-0xc283,0xc284,0xc285,0xc286,0xc7fd,0xc287,0xc288,0xc289,
-0xc7fe,0xc28a,0xc28b,0xc28c,0xc8a1,0xc28d,0xc28e,0xc28f,
-0xc290,0xc291,0xc292,0xc293,0xc294,0xc8a2,0xc295,0xc296,
-0xc297,0xc298,0xc299,0xc29a,0xc29b,0xc29c,0xc29d,0xc29e,
-0xc8a3,0xc8a4,0xc29f,0xc2a0,0xc8a5,0xc341,0xc342,0xc343,
-0xc8a6,0xc344,0xc345,0xc346,0xc347,0xc8a7,0xc348,0xc349,
-0xc8a8,0xc8a9,0xc34a,0xc8aa,0xc34b,0xc8ab,0xc34c,0xc34d,
-0xc34e,0xc8ac,0xc34f,0xc350,0xc8ad,0xc8ae,0xc351,0xc352,
-0xc8af,0xc353,0xc354,0xc355,0xc8b0,0xc356,0xc357,0xc358,
-0xc359,0xc35a,0xc361,0xc362,0xc363,0xc364,0xc365,0xc8b1,
-0xc366,0xc8b2,0xc367,0xc368,0xc369,0xc36a,0xc36b,0xc36c,
-0xc8b3,0xc8b4,0xc36d,0xc36e,0xc8b5,0xc36f,0xc370,0xc371,
-0xc372,0xc373,0xc374,0xc375,0xc376,0xc377,0xc378,0xc379,
-0xc37a,0xc381,0xc382,0xc8b6,0xc383,0xc8b7,0xc384,0xc385,
-0xc386,0xc387,0xc388,0xc389,0xc8b8,0xc8b9,0xc38a,0xc38b,
-0xc8ba,0xc38c,0xc38d,0xc38e,0xc8bb,0xc38f,0xc390,0xc391,
-0xc392,0xc393,0xc394,0xc395,0xc396,0xc8bc,0xc397,0xc8bd,
-0xc398,0xc8be,0xc399,0xc39a,0xc39b,0xc39c,0xc39d,0xc39e,
-0xc8bf,0xc39f,0xc3a0,0xc441,0xc8c0,0xc442,0xc443,0xc444,
-0xc8c1,0xc445,0xc446,0xc447,0xc448,0xc449,0xc44a,0xc44b,
-0xc44c,0xc8c2,0xc44d,0xc8c3,0xc44e,0xc44f,0xc450,0xc451,
-0xc452,0xc453,0xc454,0xc455,0xc8c4,0xc8c5,0xc456,0xc457,
-0xc8c6,0xc458,0xc459,0xc45a,0xc8c7,0xc461,0xc462,0xc463,
-0xc464,0xc8c8,0xc465,0xc466,0xc8c9,0xc467,0xc468,0xc8ca,
-0xc469,0xc8cb,0xc46a,0xc46b,0xc46c,0xc46d,0xc46e,0xc46f,
-0xc8cc,0xc470,0xc471,0xc472,0xc8cd,0xc473,0xc474,0xc475,
-0xc8ce,0xc476,0xc477,0xc478,0xc479,0xc47a,0xc481,0xc482,
-0xc8cf,0xc483,0xc484,0xc485,0xc486,0xc8d0,0xc487,0xc488,
-0xc489,0xc48a,0xc48b,0xc48c,0xc8d1,0xc8d2,0xc48d,0xc48e,
-/* 0xd700 */
-0xc8d3,0xc48f,0xc490,0xc491,0xc8d4,0xc492,0xc493,0xc494,
-0xc495,0xc496,0xc497,0xc498,0xc499,0xc49a,0xc49b,0xc49c,
-0xc49d,0xc8d5,0xc49e,0xc49f,0xc4a0,0xc541,0xc542,0xc543,
-0xc8d6,0xc8d7,0xc544,0xc545,0xc8d8,0xc546,0xc547,0xc548,
-0xc8d9,0xc549,0xc54a,0xc54b,0xc54c,0xc54d,0xc54e,0xc54f,
-0xc8da,0xc8db,0xc550,0xc8dc,0xc551,0xc8dd,0xc552,0xc553,
-0xc554,0xc555,0xc556,0xc557,0xc8de,0xc8df,0xc558,0xc559,
-0xc8e0,0xc55a,0xc561,0xc562,0xc8e1,0xc563,0xc564,0xc565,
-0xc566,0xc567,0xc568,0xc569,0xc8e2,0xc56a,0xc56b,0xc8e3,
-0xc56c,0xc8e4,0xc56d,0xc56e,0xc56f,0xc570,0xc571,0xc572,
-0xc8e5,0xc8e6,0xc573,0xc574,0xc8e7,0xc575,0xc8e8,0xc8e9,
-0xc8ea,0xc8eb,0xc576,0xc577,0xc578,0xc579,0xc57a,0xc581,
-0xc8ec,0xc8ed,0xc582,0xc8ee,0xc583,0xc8ef,0xc584,0xc585,
-0xc586,0xc8f0,0xc587,0xc588,0xc8f1,0xc589,0xc58a,0xc58b,
-0xc8f2,0xc58c,0xc58d,0xc58e,0xc8f3,0xc58f,0xc590,0xc591,
-0xc592,0xc593,0xc594,0xc595,0xc8f4,0xc8f5,0xc596,0xc597,
-0xc598,0xc8f6,0xc599,0xc59a,0xc59b,0xc59c,0xc59d,0xc59e,
-0xc8f7,0xc8f8,0xc59f,0xc5a0,0xc8f9,0xc641,0xc642,0xc643,
-0xc8fa,0xc644,0xc645,0xc646,0xc647,0xc648,0xc649,0xc64a,
-0xc8fb,0xc8fc,0xc64b,0xc8fd,0xc64c,0xc8fe,0xc64d,0xc64e,
-0xc64f,0xc650,0xc651,0xc652};
-
-
-static const int ucs_s_uhc_table_min = 0xab00;
-static const int ucs_s_uhc_table_max = 0xab00 + (sizeof(ucs_s_uhc_table)/sizeof(unsigned short));
-
-static const unsigned short ucs_r1_uhc_table[] = {
-/* 0xf800 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcbd0,0xcbd6,0xcbe7,0xcdcf,0xcde8,0xcead,0xcffb,0xd0a2,
-0xd0b8,0xd0d0,0xd0dd,0xd1d4,0xd1d5,0xd1d8,0xd1db,0xd1dc,
-0xd1dd,0xd1de,0xd1df,0xd1e0,0xd1e2,0xd1e3,0xd1e4,0xd1e5,
-0xd1e6,0xd1e8,0xd1e9,0xd1ea,0xd1eb,0xd1ed,0xd1ef,0xd1f0,
-0xd1f2,0xd1f6,0xd1fa,0xd1fc,0xd1fd,0xd1fe,0xd2a2,0xd2a3,
-0xd2a7,0xd2a8,0xd2a9,0xd2aa,0xd2ab,0xd2ad,0xd2b2,0xd2be,
-0xd2c2,0xd2c3,0xd2c4,0xd2c6,0xd2c7,0xd2c8,0xd2c9,0xd2ca,
-0xd2cb,0xd2cd,0xd2ce,0xd2cf,0xd2d0,0xd2d1,0xd2d2,0xd2d3,
-0xd2d4,0xd2d5,0xd2d6,0xd2d7,0xd2d9,0xd2da,0xd2de,0xd2df,
-0xd2e1,0xd2e2,0xd2e4,0xd2e5,0xd2e6,0xd2e7,0xd2e8,0xd2e9,
-0xd2ea,0xd2eb,0xd2f0,0xd2f1,0xd2f2,0xd2f3,0xd2f4,0xd2f5,
-0xd2f7,0xd2f8,0xd4e6,0xd4fc,0xd5a5,0xd5ab,0xd5ae,0xd6b8,
-0xd6cd,0xd7cb,0xd7e4,0xdbc5,0xdbe4,0xdca5,0xdda5,0xddd5,
-0xddf4,0xdefc,0xdefe,0xdfb3,0xdfe1,0xdfe8,0xe0f1,0xe1ad,
-0xe1ed,0xe3f5,0xe4a1,0xe4a9,0xe5ae,0xe5b1,0xe5b2,0xe5b9,
-0xe5bb,0xe5bc,0xe5c4,0xe5ce,0xe5d0,0xe5d2,0xe5d6,0xe5fa,
-0xe5fb,0xe5fc,0xe5fe,0xe6a1,0xe6a4,0xe6a7,0xe6ad,0xe6af,
-0xe6b0,0xe6b1,0xe6b3,0xe6b7,0xe6b8,0xe6bc,0xe6c4,0xe6c6,
-0xe6c7,0xe6ca,0xe6d2,0xe6d6,0xe6d9,0xe6dc,0xe6df,0xe6e1,
-0xe6e4,0xe6e5,0xe6e6,0xe6e8,0xe6ea,0xe6eb,0xe6ec,0xe6ef,
-0xe6f1,0xe6f2,0xe6f5,0xe6f6,0xe6f7,0xe6f9,0xe7a1,0xe7a6,
-0xe7a9,0xe7aa,0xe7ac,0xe7ad,0xe7b0,0xe7bf,0xe7c1,0xe7c6,
-0xe7c7,0xe7cb,0xe7cd,0xe7cf,0xe7d0,0xe7d3,0xe7df,0xe7e4,
-0xe7e6,0xe7f7,0xe8e7,0xe8e8,0xe8f0,0xe8f1,0xe8f7,0xe8f9,
-0xe8fb,0xe8fe,0xe9a7,0xe9ac,0xe9cc,0xe9f7,0xeac1,0xeae5,
-0xeaf4,0xeaf7,0xeafc,0xeafe,0xeba4,0xeba7,0xeba9,0xebaa,
-0xebba,0xebbb,0xebbd,0xebc1,0xebc2,0xebc6,0xebc7,0xebcc,
-0xebcf,0xebd0,0xebd1,0xebd2,0xebd8,0xeca6,0xeca7,0xecaa,
-0xecaf,0xecb0,0xecb1,0xecb2,0xecb5,0xecb8,0xecba,0xecc0,
-0xecc1,0xecc5,0xecc6,0xecc9,0xecca,0xecd5,0xecdd,0xecde,
-0xece1,0xece4,0xece7,0xece8,0xecf7,0xecf8,0xecfa,0xeda1,
-0xeda2,0xeda3,0xedee,0xeedb,0xf2bd,0xf2fa,0xf3b1,0xf4a7,
-0xf4ee,0xf6f4,0xf6f6,0xf7b8,0xf7c8,0xf7d3,0xf8db,0xf8f0,
-0xfaa1,0xfaa2,0xfae6,0xfca9};
-
-static const int ucs_r1_uhc_table_min = 0xf800;
-static const int ucs_r1_uhc_table_max = 0xf800 + (sizeof(ucs_r1_uhc_table)/sizeof(unsigned short));
-
-static const unsigned short ucs_r2_uhc_table[] = {
-/* 0xff00 */
-0x0000,0xa3a1,0xa3a2,0xa3a3,0xa3a4,0xa3a5,0xa3a6,0xa3a7,
-0xa3a8,0xa3a9,0xa3aa,0xa3ab,0xa3ac,0xa3ad,0xa3ae,0xa3af,
-0xa3b0,0xa3b1,0xa3b2,0xa3b3,0xa3b4,0xa3b5,0xa3b6,0xa3b7,
-0xa3b8,0xa3b9,0xa3ba,0xa3bb,0xa3bc,0xa3bd,0xa3be,0xa3bf,
-0xa3c0,0xa3c1,0xa3c2,0xa3c3,0xa3c4,0xa3c5,0xa3c6,0xa3c7,
-0xa3c8,0xa3c9,0xa3ca,0xa3cb,0xa3cc,0xa3cd,0xa3ce,0xa3cf,
-0xa3d0,0xa3d1,0xa3d2,0xa3d3,0xa3d4,0xa3d5,0xa3d6,0xa3d7,
-0xa3d8,0xa3d9,0xa3da,0xa3db,0xa1ac,0xa3dd,0xa3de,0xa3df,
-0xa3e0,0xa3e1,0xa3e2,0xa3e3,0xa3e4,0xa3e5,0xa3e6,0xa3e7,
-0xa3e8,0xa3e9,0xa3ea,0xa3eb,0xa3ec,0xa3ed,0xa3ee,0xa3ef,
-0xa3f0,0xa3f1,0xa3f2,0xa3f3,0xa3f4,0xa3f5,0xa3f6,0xa3f7,
-0xa3f8,0xa3f9,0xa3fa,0xa3fb,0xa3fc,0xa3fd,0xa2a6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1cb,0xa1cc,0xa1fe,0xa3fe,0x0000,0xa1cd,0xa3dc};
-
-static const int ucs_r2_uhc_table_min = 0xff00;
-static const int ucs_r2_uhc_table_max = 0xff00 + (sizeof (ucs_r2_uhc_table) / sizeof (unsigned short));
-
-
-
diff --git a/ext/mbstring/unicode_table_ru.h b/ext/mbstring/unicode_table_ru.h
deleted file mode 100644
index c2f44e6f4b..0000000000
--- a/ext/mbstring/unicode_table_ru.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* cp1251 to Unicode table */
-static const unsigned short cp1251_ucs_table[] = {
- 0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021,
- 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f,
- 0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014,
- 0x003f, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f,
- 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7,
- 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407,
- 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7,
- 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457,
- 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
- 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f,
- 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
- 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f,
- 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
- 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f,
- 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
- 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f
-};
-static const int cp1251_ucs_table_min = 0x80;
-static const int cp1251_ucs_table_len = (sizeof (cp1251_ucs_table) / sizeof (unsigned short));
-static const int cp1251_ucs_table_max = 0x80 + (sizeof (cp1251_ucs_table) / sizeof (unsigned short));
-
-/* cp866_DOSCyrillicRussian to Unicode table */
-static const unsigned short cp866_ucs_table[] = {
- 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
- 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f,
- 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
- 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f,
- 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
- 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f,
- 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
- 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510,
- 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f,
- 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567,
- 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b,
- 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580,
- 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
- 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f,
- 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040e, 0x045e,
- 0x00b0, 0x2219, 0x00b7, 0x221a, 0x2116, 0x00a4, 0x25a0, 0x00a0
-};
-static const int cp866_ucs_table_min = 0x80;
-static const int cp866_ucs_table_len = (sizeof (cp866_ucs_table) / sizeof (unsigned short));
-static const int cp866_ucs_table_max = 0x80 + (sizeof (cp866_ucs_table) / sizeof (unsigned short));
-
-/* KOI8-R (RFC1489) to Unicode */
-static const unsigned short koi8r_ucs_table[] = {
- 0x2500, 0x2502, 0x250c, 0x2510, 0x2514, 0x2518, 0x251c, 0x2524,
- 0x252c, 0x2534, 0x253c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590,
- 0x2591, 0x2592, 0x2593, 0x2320, 0x25a0, 0x2219, 0x221a, 0x2248,
- 0x2264, 0x2265, 0x00a0, 0x2321, 0x00b0, 0x00b2, 0x00b7, 0x00f7,
- 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556,
- 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, 0x255e,
- 0x255f, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565,
- 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x00a9,
- 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433,
- 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e,
- 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432,
- 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a,
- 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413,
- 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e,
- 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412,
- 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a
-};
-static const int koi8r_ucs_table_min = 0x80;
-static const int koi8r_ucs_table_len = (sizeof (koi8r_ucs_table) / sizeof (unsigned short));
-static const int koi8r_ucs_table_max = 0x80 + (sizeof (koi8r_ucs_table) / sizeof (unsigned short));
-
diff --git a/ext/mbstring/unicode_table_tw.h b/ext/mbstring/unicode_table_tw.h
deleted file mode 100644
index ac29cc818a..0000000000
--- a/ext/mbstring/unicode_table_tw.h
+++ /dev/null
@@ -1,11215 +0,0 @@
-/*
- * Unicode table
- */
-
-/* CNS11643 -> UCS */
-static const unsigned short cns11643_1_ucs_table[] = {
-0x3000,0xff0c,0x3001,0x3002,0xff0e,0x30fb,0xff1b,0xff1a,
-0xff1f,0xff01,0xfe30,0x2026,0x2025,0xfe50,0xfe51,0xfe52,
-0x00b7,0xfe54,0xfe55,0xfe56,0xfe57,0xfe31,0x2014,0xfe32,
-0x2013,0x0000,0x0000,0x0000,0x0000,0xff08,0xff09,0xfe35,
-0xfe36,0xff5b,0xff5d,0xfe37,0xfe38,0x3014,0x3015,0xfe39,
-0xfe3a,0x3010,0x3011,0xfe3b,0xfe3c,0x300a,0x300b,0xfe3d,
-0xfe3e,0x3008,0x3009,0xfe3f,0xfe40,0x300c,0x300d,0xfe41,
-0xfe42,0x300e,0x300f,0xfe43,0xfe44,0xfe59,0xfe5a,0xfe5b,
-0xfe5c,0xfe5d,0xfe5e,0x2018,0x2019,0x201c,0x201d,0x301d,
-0x301e,0x2032,0x2035,0xff03,0xff06,0xff0a,0x203b,0x00a7,
-0x3003,0x25cb,0x25cf,0x25b3,0x25b2,0x25ce,0x2606,0x2605,
-0x25c7,0x25c6,0x25a1,0x25a0,0x25bd,0x25bc,0x32a3,0x2105,
-0x203e,0x0000,0xff3f,0x0000,0xfe49,0xfe4a,0xfe4d,0xfe4e,
-0xfe4b,0xfe4c,0xfe5f,0xfe60,0xfe61,0xff0b,0xff0d,0x00d7,
-0x00f7,0x00b1,0x221a,0xff1c,0xff1e,0xff1d,0x2266,0x2267,
-0x2260,0x221e,0x2252,0x2261,0xfe62,0xfe63,0xfe64,0xfe66,
-0xfe65,0x223c,0x2229,0x222a,0x22a5,0x2220,0x221f,0x22bf,
-0x33d2,0x33d1,0x222b,0x222e,0x2235,0x2234,0x2640,0x2642,
-0x2641,0x2609,0x2191,0x2193,0x2192,0x2190,0x2196,0x2197,
-0x2199,0x2198,0x2016,0xff5c,0xff0f,0xff3c,0x2215,0xfe68,
-0xff04,0xffe5,0x3012,0xffe0,0xffe1,0xff05,0xff20,0x2103,
-0x2109,0xfe69,0xfe6a,0xfe6b,0x33d5,0x339c,0x339d,0x339e,
-0x33ce,0x33a1,0x338e,0x338f,0x33c4,0x00b0,0x5159,0x515b,
-0x515e,0x515d,0x5161,0x5163,0x55e7,0x74e9,0x7cce,0x2581,
-0x2582,0x2583,0x2584,0x2585,0x2586,0x2587,0x2588,0x258f,
-0x258e,0x258d,0x258c,0x258b,0x258a,0x2589,0x253c,0x2534,
-0x252c,0x2524,0x251c,0x2594,0x2500,0x2502,0x2595,0x250c,
-0x2510,0x2514,0x2518,0x256d,0x256e,0x2570,0x256f,0x2550,
-0x255e,0x256a,0x2561,0x25e2,0x25e3,0x25e5,0x25e4,0x2571,
-0x2572,0x2573,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xff10,0xff11,0xff12,0xff13,0xff14,0xff15,
-0xff16,0xff17,0xff18,0xff19,0x2160,0x2161,0x2162,0x2163,
-0x2164,0x2165,0x2166,0x2167,0x2168,0x2169,0x3021,0x3022,
-0x3023,0x3024,0x3025,0x3026,0x3027,0x3028,0x3029,0x0000,
-0x5344,0x0000,0xff21,0xff22,0xff23,0xff24,0xff25,0xff26,
-0xff27,0xff28,0xff29,0xff2a,0xff2b,0xff2c,0xff2d,0xff2e,
-0xff2f,0xff30,0xff31,0xff32,0xff33,0xff34,0xff35,0xff36,
-0xff37,0xff38,0xff39,0xff3a,0xff41,0xff42,0xff43,0xff44,
-0xff45,0xff46,0xff47,0xff48,0xff49,0xff4a,0xff4b,0xff4c,
-0xff4d,0xff4e,0xff4f,0xff50,0xff51,0xff52,0xff53,0xff54,
-0xff55,0xff56,0xff57,0xff58,0xff59,0xff5a,0x0391,0x0392,
-0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,0x0399,0x039a,
-0x039b,0x039c,0x039d,0x039e,0x039f,0x03a0,0x03a1,0x03a3,
-0x03a4,0x03a5,0x03a6,0x03a7,0x03a8,0x03a9,0x03b1,0x03b2,
-0x03b3,0x03b4,0x03b5,0x03b6,0x03b7,0x03b8,0x03b9,0x03ba,
-0x03bb,0x03bc,0x03bd,0x03be,0x03bf,0x03c0,0x03c1,0x03c3,
-0x03c4,0x03c5,0x03c6,0x03c7,0x03c8,0x03c9,0x3105,0x3106,
-0x3107,0x3108,0x3109,0x310a,0x310b,0x310c,0x310d,0x310e,
-0x310f,0x3110,0x3111,0x3112,0x3113,0x3114,0x3115,0x3116,
-0x3117,0x3118,0x3119,0x311a,0x311b,0x311c,0x311d,0x311e,
-0x311f,0x3120,0x3121,0x3122,0x3123,0x3124,0x3125,0x3126,
-0x3127,0x3128,0x3129,0x02d9,0x02c9,0x02ca,0x02c7,0x02cb,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2460,0x2461,
-0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,0x2468,0x2469,
-0x2474,0x2475,0x2476,0x2477,0x2478,0x2479,0x247a,0x247b,
-0x247c,0x247d,0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,
-0x2176,0x2177,0x2178,0x2179,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2400,0x2401,
-0x2402,0x2403,0x2404,0x2405,0x2406,0x2407,0x2408,0x2409,
-0x240a,0x240b,0x240c,0x240d,0x240e,0x240f,0x2410,0x2411,
-0x2412,0x2413,0x2414,0x2415,0x2416,0x2417,0x2418,0x2419,
-0x241a,0x241b,0x241c,0x241d,0x241e,0x241f,0x2421,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x4e00,0x4e59,0x4e01,0x4e03,0x4e43,0x4e5d,
-0x4e86,0x4e8c,0x4eba,0x513f,0x5165,0x516b,0x51e0,0x5200,
-0x5201,0x529b,0x5315,0x5341,0x535c,0x53c8,0x4e09,0x4e0b,
-0x4e08,0x4e0a,0x4e2b,0x4e38,0x51e1,0x4e45,0x4e48,0x4e5f,
-0x4e5e,0x4e8e,0x4ea1,0x5140,0x5203,0x52fa,0x5343,0x53c9,
-0x53e3,0x571f,0x58eb,0x5915,0x5927,0x5973,0x5b50,0x5b51,
-0x5b53,0x5bf8,0x5c0f,0x5c22,0x5c38,0x5c71,0x5ddd,0x5de5,
-0x5df1,0x5df2,0x5df3,0x5dfe,0x5e72,0x5efe,0x5f0b,0x5f13,
-0x624d,0x4e11,0x4e10,0x4e0d,0x4e2d,0x4e30,0x4e39,0x4e4b,
-0x5c39,0x4e88,0x4e91,0x4e95,0x4e92,0x4e94,0x4ea2,0x4ec1,
-0x4ec0,0x4ec3,0x4ec6,0x4ec7,0x4ecd,0x4eca,0x4ecb,0x4ec4,
-0x5143,0x5141,0x5167,0x516d,0x516e,0x516c,0x5197,0x51f6,
-0x5206,0x5207,0x5208,0x52fb,0x52fe,0x52ff,0x5316,0x5339,
-0x5348,0x5347,0x5345,0x535e,0x5384,0x53cb,0x53ca,0x53cd,
-0x58ec,0x5929,0x592b,0x592a,0x592d,0x5b54,0x5c11,0x5c24,
-0x5c3a,0x5c6f,0x5df4,0x5e7b,0x5eff,0x5f14,0x5f15,0x5fc3,
-0x6208,0x6236,0x624b,0x624e,0x652f,0x6587,0x6597,0x65a4,
-0x65b9,0x65e5,0x66f0,0x6708,0x6728,0x6b20,0x6b62,0x6b79,
-0x6bcb,0x6bd4,0x6bdb,0x6c0f,0x6c34,0x706b,0x722a,0x7236,
-0x723b,0x7247,0x7259,0x725b,0x72ac,0x738b,0x4e19,0x4e16,
-0x4e15,0x4e14,0x4e18,0x4e3b,0x4e4d,0x4e4f,0x4e4e,0x4ee5,
-0x4ed8,0x4ed4,0x4ed5,0x4ed6,0x4ed7,0x4ee3,0x4ee4,0x4ed9,
-0x4ede,0x5145,0x5144,0x5189,0x518a,0x51ac,0x51f9,0x51fa,
-0x51f8,0x520a,0x52a0,0x529f,0x5305,0x5306,0x5317,0x531d,
-0x4edf,0x534a,0x5349,0x5361,0x5360,0x536f,0x536e,0x53bb,
-0x53ef,0x53e4,0x53f3,0x53ec,0x53ee,0x53e9,0x53e8,0x53fc,
-0x53f8,0x53f5,0x53eb,0x53e6,0x53ea,0x53f2,0x53f1,0x53f0,
-0x53e5,0x53ed,0x53fb,0x56db,0x56da,0x5916,0x592e,0x5931,
-0x5974,0x5976,0x5b55,0x5b83,0x5c3c,0x5de8,0x5de7,0x5de6,
-0x5e02,0x5e03,0x5e73,0x5e7c,0x5f01,0x5f18,0x5f17,0x5fc5,
-0x620a,0x6253,0x6254,0x6252,0x6251,0x65a5,0x65e6,0x672e,
-0x672c,0x672a,0x672b,0x672d,0x6b63,0x6bcd,0x6c11,0x6c10,
-0x6c38,0x6c41,0x6c40,0x6c3e,0x72af,0x7384,0x7389,0x74dc,
-0x74e6,0x7518,0x751f,0x7528,0x7529,0x7530,0x7531,0x7532,
-0x7533,0x758b,0x767d,0x76ae,0x76bf,0x76ee,0x77db,0x77e2,
-0x77f3,0x793a,0x79be,0x7a74,0x7acb,0x4e1e,0x4e1f,0x4e52,
-0x4e53,0x4e69,0x4e99,0x4ea4,0x4ea6,0x4ea5,0x4eff,0x4f09,
-0x4f19,0x4f0a,0x4f15,0x4f0d,0x4f10,0x4f11,0x4f0f,0x4ef2,
-0x4ef6,0x4efb,0x4ef0,0x4ef3,0x4efd,0x4f01,0x4f0b,0x5149,
-0x5147,0x5146,0x5148,0x5168,0x5171,0x518d,0x51b0,0x5217,
-0x5211,0x5212,0x520e,0x5216,0x52a3,0x5308,0x5321,0x5320,
-0x5370,0x5371,0x5409,0x540f,0x540c,0x540a,0x5410,0x5401,
-0x540b,0x5404,0x5411,0x540d,0x5408,0x5403,0x540e,0x5406,
-0x5412,0x56e0,0x56de,0x56dd,0x5733,0x5730,0x5728,0x572d,
-0x572c,0x572f,0x5729,0x5919,0x591a,0x5937,0x5938,0x5984,
-0x5978,0x5983,0x597d,0x5979,0x5982,0x5981,0x5b57,0x5b58,
-0x5b87,0x5b88,0x5b85,0x5b89,0x5bfa,0x5c16,0x5c79,0x5dde,
-0x5e06,0x5e76,0x5e74,0x5f0f,0x5f1b,0x5fd9,0x5fd6,0x620e,
-0x620c,0x620d,0x6210,0x6263,0x625b,0x6258,0x6536,0x65e9,
-0x65e8,0x65ec,0x65ed,0x66f2,0x66f3,0x6709,0x673d,0x6734,
-0x6731,0x6735,0x6b21,0x6b64,0x6b7b,0x6c16,0x6c5d,0x6c57,
-0x6c59,0x6c5f,0x6c60,0x6c50,0x6c55,0x6c61,0x6c5b,0x6c4d,
-0x6c4e,0x7070,0x725f,0x725d,0x767e,0x7af9,0x7c73,0x7cf8,
-0x7f36,0x7f8a,0x7fbd,0x8001,0x8003,0x800c,0x8012,0x8033,
-0x807f,0x8089,0x808b,0x808c,0x81e3,0x81ea,0x81f3,0x81fc,
-0x820c,0x821b,0x821f,0x826e,0x8272,0x827e,0x866b,0x8840,
-0x884c,0x8863,0x897f,0x9621,0x4e32,0x4ea8,0x4f4d,0x4f4f,
-0x4f47,0x4f57,0x4f5e,0x4f34,0x4f5b,0x4f55,0x4f30,0x4f50,
-0x4f51,0x4f3d,0x4f3a,0x4f38,0x4f43,0x4f54,0x4f3c,0x4f46,
-0x4f63,0x4f5c,0x4f60,0x4f2f,0x4f4e,0x4f36,0x4f59,0x4f5d,
-0x4f48,0x4f5a,0x514c,0x514b,0x514d,0x5175,0x51b6,0x51b7,
-0x5225,0x5224,0x5229,0x522a,0x5228,0x52ab,0x52a9,0x52aa,
-0x52ac,0x5323,0x5373,0x5375,0x541d,0x542d,0x541e,0x543e,
-0x5426,0x544e,0x5427,0x5446,0x5443,0x5433,0x5448,0x5442,
-0x541b,0x5429,0x544a,0x5439,0x543b,0x5438,0x542e,0x5435,
-0x5436,0x5420,0x543c,0x5440,0x5431,0x542b,0x541f,0x542c,
-0x56ea,0x56f0,0x56e4,0x56eb,0x574a,0x5751,0x5740,0x574d,
-0x5747,0x574e,0x573e,0x5750,0x574f,0x573b,0x58ef,0x593e,
-0x599d,0x5992,0x59a8,0x599e,0x59a3,0x5999,0x5996,0x598d,
-0x59a4,0x5993,0x598a,0x59a5,0x5b5d,0x5b5c,0x5b5a,0x5b5b,
-0x5b8c,0x5b8b,0x5b8f,0x5c2c,0x5c40,0x5c41,0x5c3f,0x5c3e,
-0x5c90,0x5c91,0x5c94,0x5c8c,0x5deb,0x5e0c,0x5e8f,0x5e87,
-0x5e8a,0x5ef7,0x5f04,0x5f1f,0x5f64,0x5f62,0x5f77,0x5f79,
-0x5fd8,0x5fcc,0x5fd7,0x5fcd,0x5ff1,0x5feb,0x5ff8,0x5fea,
-0x6212,0x6211,0x6284,0x6297,0x6296,0x6280,0x6276,0x6289,
-0x626d,0x628a,0x627c,0x627e,0x6279,0x6273,0x6292,0x626f,
-0x6298,0x626e,0x6295,0x6293,0x6291,0x6286,0x6539,0x653b,
-0x6538,0x65f1,0x66f4,0x675f,0x674e,0x674f,0x6750,0x6751,
-0x675c,0x6756,0x675e,0x6749,0x6746,0x6760,0x6753,0x6757,
-0x6b65,0x6bcf,0x6c42,0x6c5e,0x6c99,0x6c81,0x6c88,0x6c89,
-0x6c85,0x6c9b,0x6c6a,0x6c7a,0x6c90,0x6c70,0x6c8c,0x6c68,
-0x6c96,0x6c92,0x6c7d,0x6c83,0x6c72,0x6c7e,0x6c74,0x6c86,
-0x6c76,0x6c8d,0x6c94,0x6c98,0x6c82,0x7076,0x707c,0x707d,
-0x7078,0x7262,0x7261,0x7260,0x72c4,0x72c2,0x7396,0x752c,
-0x752b,0x7537,0x7538,0x7682,0x76ef,0x77e3,0x79c1,0x79c0,
-0x79bf,0x7a76,0x7cfb,0x7f55,0x8096,0x8093,0x809d,0x8098,
-0x809b,0x809a,0x80b2,0x826f,0x8292,0x828b,0x828d,0x898b,
-0x89d2,0x8a00,0x8c37,0x8c46,0x8c55,0x8c9d,0x8d64,0x8d70,
-0x8db3,0x8eab,0x8eca,0x8f9b,0x8fb0,0x8fc2,0x8fc6,0x8fc5,
-0x8fc4,0x5de1,0x9091,0x90a2,0x90aa,0x90a6,0x90a3,0x9149,
-0x91c6,0x91cc,0x9632,0x962e,0x9631,0x962a,0x962c,0x4e26,
-0x4e56,0x4e73,0x4e8b,0x4e9b,0x4e9e,0x4eab,0x4eac,0x4f6f,
-0x4f9d,0x4f8d,0x4f73,0x4f7f,0x4f6c,0x4f9b,0x4f8b,0x4f86,
-0x4f83,0x4f70,0x4f75,0x4f88,0x4f69,0x4f7b,0x4f96,0x4f7e,
-0x4f8f,0x4f91,0x4f7a,0x5154,0x5152,0x5155,0x5169,0x5177,
-0x5176,0x5178,0x51bd,0x51fd,0x523b,0x5238,0x5237,0x523a,
-0x5230,0x522e,0x5236,0x5241,0x52be,0x52bb,0x5352,0x5354,
-0x5353,0x5351,0x5366,0x5377,0x5378,0x5379,0x53d6,0x53d4,
-0x53d7,0x5473,0x5475,0x5496,0x5478,0x5495,0x5480,0x547b,
-0x5477,0x5484,0x5492,0x5486,0x547c,0x5490,0x5471,0x5476,
-0x548c,0x549a,0x5462,0x5468,0x548b,0x547d,0x548e,0x56fa,
-0x5783,0x5777,0x576a,0x5769,0x5761,0x5766,0x5764,0x577c,
-0x591c,0x5949,0x5947,0x5948,0x5944,0x5954,0x59be,0x59bb,
-0x59d4,0x59b9,0x59ae,0x59d1,0x59c6,0x59d0,0x59cd,0x59cb,
-0x59d3,0x59ca,0x59af,0x59b3,0x59d2,0x59c5,0x5b5f,0x5b64,
-0x5b63,0x5b97,0x5b9a,0x5b98,0x5b9c,0x5b99,0x5b9b,0x5c1a,
-0x5c48,0x5c45,0x5c46,0x5cb7,0x5ca1,0x5cb8,0x5ca9,0x5cab,
-0x5cb1,0x5cb3,0x5e18,0x5e1a,0x5e16,0x5e15,0x5e1b,0x5e11,
-0x5e78,0x5e9a,0x5e97,0x5e9c,0x5e95,0x5e96,0x5ef6,0x5f26,
-0x5f27,0x5f29,0x5f80,0x5f81,0x5f7f,0x5f7c,0x5fdd,0x5fe0,
-0x5ffd,0x5ff5,0x5fff,0x600f,0x6014,0x602f,0x6035,0x6016,
-0x602a,0x6015,0x6021,0x6027,0x6029,0x602b,0x601b,0x6216,
-0x6215,0x623f,0x623e,0x6240,0x627f,0x62c9,0x62cc,0x62c4,
-0x62bf,0x62c2,0x62b9,0x62d2,0x62db,0x62ab,0x62d3,0x62d4,
-0x62cb,0x62c8,0x62a8,0x62bd,0x62bc,0x62d0,0x62d9,0x62c7,
-0x62cd,0x62b5,0x62da,0x62b1,0x62d8,0x62d6,0x62d7,0x62c6,
-0x62ac,0x62ce,0x653e,0x65a7,0x65bc,0x65fa,0x6614,0x6613,
-0x660c,0x6606,0x6602,0x660e,0x6600,0x660f,0x6615,0x660a,
-0x6607,0x670d,0x670b,0x676d,0x678b,0x6795,0x6771,0x679c,
-0x6773,0x6777,0x6787,0x679d,0x6797,0x676f,0x6770,0x677f,
-0x6789,0x677e,0x6790,0x6775,0x679a,0x6793,0x677c,0x676a,
-0x6772,0x6b23,0x6b66,0x6b67,0x6b7f,0x6c13,0x6c1b,0x6ce3,
-0x6ce8,0x6cf3,0x6cb1,0x6ccc,0x6ce5,0x6cb3,0x6cbd,0x6cbe,
-0x6cbc,0x6ce2,0x6cab,0x6cd5,0x6cd3,0x6cb8,0x6cc4,0x6cb9,
-0x6cc1,0x6cae,0x6cd7,0x6cc5,0x6cf1,0x6cbf,0x6cbb,0x6ce1,
-0x6cdb,0x6cca,0x6cac,0x6cef,0x6cdc,0x6cd6,0x6ce0,0x7095,
-0x708e,0x7092,0x708a,0x7099,0x722c,0x722d,0x7238,0x7248,
-0x7267,0x7269,0x72c0,0x72ce,0x72d9,0x72d7,0x72d0,0x73a9,
-0x73a8,0x739f,0x73ab,0x73a5,0x753d,0x759d,0x7599,0x759a,
-0x7684,0x76c2,0x76f2,0x76f4,0x77e5,0x77fd,0x793e,0x7940,
-0x7941,0x79c9,0x79c8,0x7a7a,0x7a79,0x7afa,0x7cfe,0x7f54,
-0x7f8c,0x7f8b,0x8005,0x80ba,0x80a5,0x80a2,0x80b1,0x80a1,
-0x80ab,0x80a9,0x80b4,0x80aa,0x80af,0x81e5,0x81fe,0x820d,
-0x82b3,0x829d,0x8299,0x82ad,0x82bd,0x829f,0x82b9,0x82b1,
-0x82ac,0x82a5,0x82af,0x82b8,0x82a3,0x82b0,0x82be,0x82b7,
-0x864e,0x8671,0x521d,0x8868,0x8ecb,0x8fce,0x8fd4,0x8fd1,
-0x90b5,0x90b8,0x90b1,0x90b6,0x91c7,0x91d1,0x9577,0x9580,
-0x961c,0x9640,0x963f,0x963b,0x9644,0x9642,0x96b9,0x96e8,
-0x9752,0x975e,0x4e9f,0x4ead,0x4eae,0x4fe1,0x4fb5,0x4faf,
-0x4fbf,0x4fe0,0x4fd1,0x4fcf,0x4fdd,0x4fc3,0x4fb6,0x4fd8,
-0x4fdf,0x4fca,0x4fd7,0x4fae,0x4fd0,0x4fc4,0x4fc2,0x4fda,
-0x4fce,0x4fde,0x4fb7,0x5157,0x5192,0x5191,0x51a0,0x524e,
-0x5243,0x524a,0x524d,0x524c,0x524b,0x5247,0x52c7,0x52c9,
-0x52c3,0x52c1,0x530d,0x5357,0x537b,0x539a,0x53db,0x54ac,
-0x54c0,0x54a8,0x54ce,0x54c9,0x54b8,0x54a6,0x54b3,0x54c7,
-0x54c2,0x54bd,0x54aa,0x54c1,0x54c4,0x54c8,0x54af,0x54ab,
-0x54b1,0x54bb,0x54a9,0x54a7,0x54bf,0x56ff,0x5782,0x578b,
-0x57a0,0x57a3,0x57a2,0x57ce,0x57ae,0x5793,0x5955,0x5951,
-0x594f,0x594e,0x5950,0x59dc,0x59d8,0x59ff,0x59e3,0x59e8,
-0x5a03,0x59e5,0x59ea,0x59da,0x59e6,0x5a01,0x59fb,0x5b69,
-0x5ba3,0x5ba6,0x5ba4,0x5ba2,0x5ba5,0x5c01,0x5c4e,0x5c4f,
-0x5c4d,0x5c4b,0x5cd9,0x5cd2,0x5df7,0x5e1d,0x5e25,0x5e1f,
-0x5e7d,0x5ea0,0x5ea6,0x5efa,0x5f08,0x5f2d,0x5f65,0x5f88,
-0x5f85,0x5f8a,0x5f8b,0x5f87,0x5f8c,0x5f89,0x6012,0x601d,
-0x6020,0x6025,0x600e,0x6028,0x604d,0x6070,0x6068,0x6062,
-0x6046,0x6043,0x606c,0x606b,0x606a,0x6064,0x6241,0x62dc,
-0x6316,0x6309,0x62fc,0x62ed,0x6301,0x62ee,0x62fd,0x6307,
-0x62f1,0x62f7,0x62ef,0x62ec,0x62fe,0x62f4,0x6311,0x6302,
-0x653f,0x6545,0x65ab,0x65bd,0x65e2,0x6625,0x662d,0x6620,
-0x6627,0x662f,0x661f,0x6628,0x6631,0x6624,0x66f7,0x67ff,
-0x67d3,0x67f1,0x67d4,0x67d0,0x67ec,0x67b6,0x67af,0x67f5,
-0x67e9,0x67ef,0x67c4,0x67d1,0x67b4,0x67da,0x67e5,0x67b8,
-0x67cf,0x67de,0x67f3,0x67b0,0x67d9,0x67e2,0x67dd,0x67d2,
-0x6b6a,0x6b83,0x6b86,0x6bb5,0x6bd2,0x6bd7,0x6c1f,0x6cc9,
-0x6d0b,0x6d32,0x6d2a,0x6d41,0x6d25,0x6d0c,0x6d31,0x6d1e,
-0x6d17,0x6d3b,0x6d3d,0x6d3e,0x6d36,0x6d1b,0x6cf5,0x6d39,
-0x6d27,0x6d38,0x6d29,0x6d2e,0x6d35,0x6d0e,0x6d2b,0x70ab,
-0x70ba,0x70b3,0x70ac,0x70af,0x70ad,0x70b8,0x70ae,0x70a4,
-0x7230,0x7272,0x726f,0x7274,0x72e9,0x72e0,0x72e1,0x73b7,
-0x73ca,0x73bb,0x73b2,0x73cd,0x73c0,0x73b3,0x751a,0x752d,
-0x754f,0x754c,0x754e,0x754b,0x75ab,0x75a4,0x75a5,0x75a2,
-0x75a3,0x7678,0x7686,0x7687,0x7688,0x76c8,0x76c6,0x76c3,
-0x76c5,0x7701,0x76f9,0x76f8,0x7709,0x770b,0x76fe,0x76fc,
-0x7707,0x77dc,0x7802,0x7814,0x780c,0x780d,0x7946,0x7949,
-0x7948,0x7947,0x79b9,0x79ba,0x79d1,0x79d2,0x79cb,0x7a7f,
-0x7a81,0x7aff,0x7afd,0x7c7d,0x7d02,0x7d05,0x7d00,0x7d09,
-0x7d07,0x7d04,0x7d06,0x7f38,0x7f8e,0x7fbf,0x8010,0x800d,
-0x8011,0x8036,0x80d6,0x80e5,0x80da,0x80c3,0x80c4,0x80cc,
-0x80e1,0x80db,0x80ce,0x80de,0x80e4,0x80dd,0x81f4,0x8222,
-0x82e7,0x8303,0x8305,0x82e3,0x82db,0x82e6,0x8304,0x82e5,
-0x8302,0x8309,0x82d2,0x82d7,0x82f1,0x8301,0x82dc,0x82d4,
-0x82d1,0x82de,0x82d3,0x82df,0x82ef,0x8306,0x8650,0x8679,
-0x867b,0x867a,0x884d,0x886b,0x8981,0x89d4,0x8a08,0x8a02,
-0x8a03,0x8c9e,0x8ca0,0x8d74,0x8d73,0x8db4,0x8ecd,0x8ecc,
-0x8ff0,0x8fe6,0x8fe2,0x8fea,0x8fe5,0x8fed,0x8feb,0x8fe4,
-0x8fe8,0x90ca,0x90ce,0x90c1,0x90c3,0x914b,0x914a,0x91cd,
-0x9582,0x9650,0x964b,0x964c,0x964d,0x9762,0x9769,0x97cb,
-0x97ed,0x97f3,0x9801,0x98a8,0x98db,0x98df,0x9996,0x9999,
-0x4e58,0x4eb3,0x500c,0x500d,0x5023,0x4fef,0x5026,0x5025,
-0x4ff8,0x5029,0x5016,0x5006,0x503c,0x501f,0x501a,0x5012,
-0x5011,0x4ffa,0x5000,0x5014,0x5028,0x4ff1,0x5021,0x500b,
-0x5019,0x5018,0x4ff3,0x4fee,0x502d,0x502a,0x4ffe,0x502b,
-0x5009,0x517c,0x51a4,0x51a5,0x51a2,0x51cd,0x51cc,0x51c6,
-0x51cb,0x5256,0x525c,0x5254,0x525b,0x525d,0x532a,0x537f,
-0x539f,0x539d,0x53df,0x54e8,0x5510,0x5501,0x5537,0x54fc,
-0x54e5,0x54f2,0x5506,0x54fa,0x5514,0x54e9,0x54ed,0x54e1,
-0x5509,0x54ee,0x54ea,0x54e6,0x5527,0x5507,0x54fd,0x550f,
-0x5703,0x5704,0x57c2,0x57d4,0x57cb,0x57c3,0x5809,0x590f,
-0x5957,0x5958,0x595a,0x5a11,0x5a18,0x5a1c,0x5a1f,0x5a1b,
-0x5a13,0x59ec,0x5a20,0x5a23,0x5a29,0x5a25,0x5a0c,0x5a09,
-0x5b6b,0x5c58,0x5bb0,0x5bb3,0x5bb6,0x5bb4,0x5bae,0x5bb5,
-0x5bb9,0x5bb8,0x5c04,0x5c51,0x5c55,0x5c50,0x5ced,0x5cfd,
-0x5cfb,0x5cea,0x5ce8,0x5cf0,0x5cf6,0x5d01,0x5cf4,0x5dee,
-0x5e2d,0x5e2b,0x5eab,0x5ead,0x5ea7,0x5f31,0x5f92,0x5f91,
-0x5f90,0x6059,0x6063,0x6065,0x6050,0x6055,0x606d,0x6069,
-0x606f,0x6084,0x609f,0x609a,0x608d,0x6094,0x608c,0x6085,
-0x6096,0x6247,0x62f3,0x6308,0x62ff,0x634e,0x633e,0x632f,
-0x6355,0x6342,0x6346,0x634f,0x6349,0x633a,0x6350,0x633d,
-0x632a,0x632b,0x6328,0x634d,0x634c,0x6548,0x6549,0x6599,
-0x65c1,0x65c5,0x6642,0x6649,0x664f,0x6643,0x6652,0x664c,
-0x6645,0x6641,0x66f8,0x6714,0x6715,0x6717,0x6821,0x6838,
-0x6848,0x6846,0x6853,0x6839,0x6842,0x6854,0x6829,0x68b3,
-0x6817,0x684c,0x6851,0x683d,0x67f4,0x6850,0x6840,0x683c,
-0x6843,0x682a,0x6845,0x6813,0x6818,0x6841,0x6b8a,0x6b89,
-0x6bb7,0x6c23,0x6c27,0x6c28,0x6c26,0x6c24,0x6cf0,0x6d6a,
-0x6d95,0x6d88,0x6d87,0x6d66,0x6d78,0x6d77,0x6d59,0x6d93,
-0x6d6c,0x6d89,0x6d6e,0x6d5a,0x6d74,0x6d69,0x6d8c,0x6d8a,
-0x6d79,0x6d85,0x6d65,0x6d94,0x70ca,0x70d8,0x70e4,0x70d9,
-0x70c8,0x70cf,0x7239,0x7279,0x72fc,0x72f9,0x72fd,0x72f8,
-0x72f7,0x7386,0x73ed,0x7409,0x73ee,0x73e0,0x73ea,0x73de,
-0x7554,0x755d,0x755c,0x755a,0x7559,0x75be,0x75c5,0x75c7,
-0x75b2,0x75b3,0x75bd,0x75bc,0x75b9,0x75c2,0x75b8,0x768b,
-0x76b0,0x76ca,0x76cd,0x76ce,0x7729,0x771f,0x7720,0x7728,
-0x77e9,0x7830,0x7827,0x7838,0x781d,0x7834,0x7837,0x7825,
-0x782d,0x7820,0x781f,0x7832,0x7955,0x7950,0x7960,0x795f,
-0x7956,0x795e,0x795d,0x7957,0x795a,0x79e4,0x79e3,0x79e7,
-0x79df,0x79e6,0x79e9,0x79d8,0x7a84,0x7a88,0x7ad9,0x7b06,
-0x7b11,0x7c89,0x7d21,0x7d17,0x7d0b,0x7d0a,0x7d20,0x7d22,
-0x7d14,0x7d10,0x7d15,0x7d1a,0x7d1c,0x7d0d,0x7d19,0x7d1b,
-0x7f3a,0x7f5f,0x7f94,0x7fc5,0x7fc1,0x8006,0x8004,0x8018,
-0x8015,0x8019,0x8017,0x803d,0x803f,0x80f1,0x8102,0x80f0,
-0x8105,0x80ed,0x80f4,0x8106,0x80f8,0x80f3,0x8108,0x80fd,
-0x810a,0x80fc,0x80ef,0x81ed,0x81ec,0x8200,0x8210,0x822a,
-0x822b,0x8228,0x822c,0x82bb,0x832b,0x8352,0x8354,0x834a,
-0x8338,0x8350,0x8349,0x8335,0x8334,0x834f,0x8332,0x8339,
-0x8336,0x8317,0x8340,0x8331,0x8328,0x8343,0x8654,0x868a,
-0x86aa,0x8693,0x86a4,0x86a9,0x868c,0x86a3,0x869c,0x8870,
-0x8877,0x8881,0x8882,0x887d,0x8879,0x8a18,0x8a10,0x8a0e,
-0x8a0c,0x8a15,0x8a0a,0x8a17,0x8a13,0x8a16,0x8a0f,0x8a11,
-0x8c48,0x8c7a,0x8c79,0x8ca1,0x8ca2,0x8d77,0x8eac,0x8ed2,
-0x8ed4,0x8ecf,0x8fb1,0x9001,0x9006,0x8ff7,0x9000,0x8ffa,
-0x8ff4,0x9003,0x8ffd,0x9005,0x8ff8,0x9095,0x90e1,0x90dd,
-0x90e2,0x9152,0x914d,0x914c,0x91d8,0x91dd,0x91d7,0x91dc,
-0x91d9,0x9583,0x9662,0x9663,0x9661,0x965b,0x965d,0x9664,
-0x9658,0x965e,0x96bb,0x98e2,0x99ac,0x9aa8,0x9ad8,0x9b25,
-0x9b32,0x9b3c,0x4e7e,0x507a,0x507d,0x505c,0x5047,0x5043,
-0x504c,0x505a,0x5049,0x5065,0x5076,0x504e,0x5055,0x5075,
-0x5074,0x5077,0x504f,0x500f,0x506f,0x506d,0x515c,0x5195,
-0x51f0,0x526a,0x526f,0x52d2,0x52d9,0x52d8,0x52d5,0x5310,
-0x530f,0x5319,0x533f,0x5340,0x533e,0x53c3,0x66fc,0x5546,
-0x556a,0x5566,0x5544,0x555e,0x5561,0x5543,0x554a,0x5531,
-0x5556,0x554f,0x5555,0x552f,0x5564,0x5538,0x552e,0x555c,
-0x552c,0x5563,0x5533,0x5541,0x5557,0x5708,0x570b,0x5709,
-0x57df,0x5805,0x580a,0x5806,0x57e0,0x57e4,0x57fa,0x5802,
-0x5835,0x57f7,0x57f9,0x5920,0x5962,0x5a36,0x5a41,0x5a49,
-0x5a66,0x5a6a,0x5a40,0x5a3c,0x5a62,0x5a5a,0x5a46,0x5a4a,
-0x5b70,0x5bc7,0x5bc5,0x5bc4,0x5bc2,0x5bbf,0x5bc6,0x5c09,
-0x5c08,0x5c07,0x5c60,0x5c5c,0x5c5d,0x5d07,0x5d06,0x5d0e,
-0x5d1b,0x5d16,0x5d22,0x5d11,0x5d29,0x5d14,0x5d19,0x5d24,
-0x5d27,0x5d17,0x5de2,0x5e38,0x5e36,0x5e33,0x5e37,0x5eb7,
-0x5eb8,0x5eb6,0x5eb5,0x5ebe,0x5f35,0x5f37,0x5f57,0x5f6c,
-0x5f69,0x5f6b,0x5f97,0x5f99,0x5f9e,0x5f98,0x5fa1,0x5fa0,
-0x5f9c,0x607f,0x60a3,0x6089,0x60a0,0x60a8,0x60cb,0x60b4,
-0x60e6,0x60bd,0x60c5,0x60bb,0x60b5,0x60dc,0x60bc,0x60d8,
-0x60d5,0x60c6,0x60df,0x60b8,0x60da,0x60c7,0x621a,0x621b,
-0x6248,0x63a0,0x63a7,0x6372,0x6396,0x63a2,0x63a5,0x6377,
-0x6367,0x6398,0x63aa,0x6371,0x63a9,0x6389,0x6383,0x639b,
-0x636b,0x63a8,0x6384,0x6388,0x6399,0x63a1,0x63ac,0x6392,
-0x638f,0x6380,0x637b,0x6369,0x6368,0x637a,0x655d,0x6556,
-0x6551,0x6559,0x6557,0x555f,0x654f,0x6558,0x6555,0x6554,
-0x659c,0x659b,0x65ac,0x65cf,0x65cb,0x65cc,0x65ce,0x665d,
-0x665a,0x6664,0x6668,0x6666,0x665e,0x66f9,0x52d7,0x671b,
-0x6881,0x68af,0x68a2,0x6893,0x68b5,0x687f,0x6876,0x68b1,
-0x68a7,0x6897,0x68b0,0x6883,0x68c4,0x68ad,0x6886,0x6885,
-0x6894,0x689d,0x68a8,0x689f,0x68a1,0x6882,0x6b32,0x6bba,
-0x6beb,0x6bec,0x6c2b,0x6d8e,0x6dbc,0x6df3,0x6dd9,0x6db2,
-0x6de1,0x6dcc,0x6de4,0x6dfb,0x6dfa,0x6e05,0x6dc7,0x6dcb,
-0x6daf,0x6dd1,0x6dae,0x6dde,0x6df9,0x6db8,0x6df7,0x6df5,
-0x6dc5,0x6dd2,0x6e1a,0x6db5,0x6dda,0x6deb,0x6dd8,0x6dea,
-0x6df1,0x6dee,0x6de8,0x6dc6,0x6dc4,0x6daa,0x6dec,0x6dbf,
-0x6de6,0x70f9,0x7109,0x710a,0x70fd,0x70ef,0x723d,0x727d,
-0x7281,0x731c,0x731b,0x7316,0x7313,0x7319,0x7387,0x7405,
-0x740a,0x7403,0x7406,0x73fe,0x740d,0x74e0,0x74f6,0x74f7,
-0x751c,0x7522,0x7565,0x7566,0x7562,0x7570,0x758f,0x75d4,
-0x75d5,0x75b5,0x75ca,0x75cd,0x768e,0x76d4,0x76d2,0x76db,
-0x7737,0x773e,0x773c,0x7736,0x7738,0x773a,0x786b,0x7843,
-0x784e,0x7965,0x7968,0x796d,0x79fb,0x7a92,0x7a95,0x7b20,
-0x7b28,0x7b1b,0x7b2c,0x7b26,0x7b19,0x7b1e,0x7b2e,0x7c92,
-0x7c97,0x7c95,0x7d46,0x7d43,0x7d71,0x7d2e,0x7d39,0x7d3c,
-0x7d40,0x7d30,0x7d33,0x7d44,0x7d2f,0x7d42,0x7d32,0x7d31,
-0x7f3d,0x7f9e,0x7f9a,0x7fcc,0x7fce,0x7fd2,0x801c,0x804a,
-0x8046,0x812f,0x8116,0x8123,0x812b,0x8129,0x8130,0x8124,
-0x8202,0x8235,0x8237,0x8236,0x8239,0x838e,0x839e,0x8398,
-0x8378,0x83a2,0x8396,0x83bd,0x83ab,0x8392,0x838a,0x8393,
-0x8389,0x83a0,0x8377,0x837b,0x837c,0x8386,0x83a7,0x8655,
-0x5f6a,0x86c7,0x86c0,0x86b6,0x86c4,0x86b5,0x86c6,0x86cb,
-0x86b1,0x86af,0x86c9,0x8853,0x889e,0x8888,0x88ab,0x8892,
-0x8896,0x888d,0x888b,0x8993,0x898f,0x8a2a,0x8a1d,0x8a23,
-0x8a25,0x8a31,0x8a2d,0x8a1f,0x8a1b,0x8a22,0x8c49,0x8c5a,
-0x8ca9,0x8cac,0x8cab,0x8ca8,0x8caa,0x8ca7,0x8d67,0x8d66,
-0x8dbe,0x8dba,0x8edb,0x8edf,0x9019,0x900d,0x901a,0x9017,
-0x9023,0x901f,0x901d,0x9010,0x9015,0x901e,0x9020,0x900f,
-0x9022,0x9016,0x901b,0x9014,0x90e8,0x90ed,0x90fd,0x9157,
-0x91ce,0x91f5,0x91e6,0x91e3,0x91e7,0x91ed,0x91e9,0x9589,
-0x966a,0x9675,0x9673,0x9678,0x9670,0x9674,0x9676,0x9677,
-0x966c,0x96c0,0x96ea,0x96e9,0x7ae0,0x7adf,0x9802,0x9803,
-0x9b5a,0x9ce5,0x9e75,0x9e7f,0x9ea5,0x9ebb,0x50a2,0x508d,
-0x5085,0x5099,0x5091,0x5080,0x5096,0x5098,0x509a,0x6700,
-0x51f1,0x5272,0x5274,0x5275,0x5269,0x52de,0x52dd,0x52db,
-0x535a,0x53a5,0x557b,0x5580,0x55a7,0x557c,0x558a,0x559d,
-0x5598,0x5582,0x559c,0x55aa,0x5594,0x5587,0x558b,0x5583,
-0x55b3,0x55ae,0x559f,0x553e,0x55b2,0x559a,0x55bb,0x55ac,
-0x55b1,0x557e,0x5589,0x55ab,0x5599,0x570d,0x582f,0x582a,
-0x5834,0x5824,0x5830,0x5831,0x5821,0x581d,0x5820,0x58f9,
-0x58fa,0x5960,0x5a77,0x5a9a,0x5a7f,0x5a92,0x5a9b,0x5aa7,
-0x5b73,0x5b71,0x5bd2,0x5bcc,0x5bd3,0x5bd0,0x5c0a,0x5c0b,
-0x5c31,0x5d4c,0x5d50,0x5d34,0x5d47,0x5dfd,0x5e45,0x5e3d,
-0x5e40,0x5e43,0x5e7e,0x5eca,0x5ec1,0x5ec2,0x5ec4,0x5f3c,
-0x5f6d,0x5fa9,0x5faa,0x5fa8,0x60d1,0x60e1,0x60b2,0x60b6,
-0x60e0,0x611c,0x6123,0x60fa,0x6115,0x60f0,0x60fb,0x60f4,
-0x6168,0x60f1,0x610e,0x60f6,0x6109,0x6100,0x6112,0x621f,
-0x6249,0x63a3,0x638c,0x63cf,0x63c0,0x63e9,0x63c9,0x63c6,
-0x63cd,0x63d2,0x63e3,0x63d0,0x63e1,0x63d6,0x63ed,0x63ee,
-0x6376,0x63f4,0x63ea,0x63db,0x6452,0x63da,0x63f9,0x655e,
-0x6566,0x6562,0x6563,0x6591,0x6590,0x65af,0x666e,0x6670,
-0x6674,0x6676,0x666f,0x6691,0x667a,0x667e,0x6677,0x66fe,
-0x66ff,0x671f,0x671d,0x68fa,0x68d5,0x68e0,0x68d8,0x68d7,
-0x6905,0x68df,0x68f5,0x68ee,0x68e7,0x68f9,0x68d2,0x68f2,
-0x68e3,0x68cb,0x68cd,0x690d,0x6912,0x690e,0x68c9,0x68da,
-0x696e,0x68fb,0x6b3e,0x6b3a,0x6b3d,0x6b98,0x6b96,0x6bbc,
-0x6bef,0x6c2e,0x6c2f,0x6c2c,0x6e2f,0x6e38,0x6e54,0x6e21,
-0x6e32,0x6e67,0x6e4a,0x6e20,0x6e25,0x6e23,0x6e1b,0x6e5b,
-0x6e58,0x6e24,0x6e56,0x6e6e,0x6e2d,0x6e26,0x6e6f,0x6e34,
-0x6e4d,0x6e3a,0x6e2c,0x6e43,0x6e1d,0x6e3e,0x6ecb,0x6e89,
-0x6e19,0x6e4e,0x6e63,0x6e44,0x6e72,0x6e69,0x6e5f,0x7119,
-0x711a,0x7126,0x7130,0x7121,0x7136,0x716e,0x711c,0x724c,
-0x7284,0x7280,0x7336,0x7325,0x7334,0x7329,0x743a,0x742a,
-0x7433,0x7422,0x7425,0x7435,0x7436,0x7434,0x742f,0x741b,
-0x7426,0x7428,0x7525,0x7526,0x756b,0x756a,0x75e2,0x75db,
-0x75e3,0x75d9,0x75d8,0x75de,0x75e0,0x767b,0x767c,0x7696,
-0x7693,0x76b4,0x76dc,0x774f,0x77ed,0x785d,0x786c,0x786f,
-0x7a0d,0x7a08,0x7a0b,0x7a05,0x7a00,0x7a98,0x7a97,0x7a96,
-0x7ae5,0x7ae3,0x7b49,0x7b56,0x7b46,0x7b50,0x7b52,0x7b54,
-0x7b4d,0x7b4b,0x7b4f,0x7b51,0x7c9f,0x7ca5,0x7d5e,0x7d50,
-0x7d68,0x7d55,0x7d2b,0x7d6e,0x7d72,0x7d61,0x7d66,0x7d62,
-0x7d70,0x7d73,0x5584,0x7fd4,0x7fd5,0x800b,0x8052,0x8085,
-0x8155,0x8154,0x814b,0x8151,0x814e,0x8139,0x8146,0x813e,
-0x814c,0x8153,0x8174,0x8212,0x821c,0x83e9,0x8403,0x83f8,
-0x840d,0x83e0,0x83c5,0x840b,0x83c1,0x83ef,0x83f1,0x83f4,
-0x8457,0x840a,0x83f0,0x840c,0x83cc,0x83fd,0x83f2,0x83ca,
-0x8438,0x840e,0x8404,0x83dc,0x8407,0x83d4,0x83df,0x865b,
-0x86df,0x86d9,0x86ed,0x86d4,0x86db,0x86e4,0x86d0,0x86de,
-0x8857,0x88c1,0x88c2,0x88b1,0x8983,0x8996,0x8a3b,0x8a60,
-0x8a55,0x8a5e,0x8a3c,0x8a41,0x8a54,0x8a5b,0x8a50,0x8a46,
-0x8a34,0x8a3a,0x8a36,0x8a56,0x8c61,0x8c82,0x8caf,0x8cbc,
-0x8cb3,0x8cbd,0x8cc1,0x8cbb,0x8cc0,0x8cb4,0x8cb7,0x8cb6,
-0x8cbf,0x8cb8,0x8d8a,0x8d85,0x8d81,0x8dce,0x8ddd,0x8dcb,
-0x8dda,0x8dd1,0x8dcc,0x8ddb,0x8dc6,0x8efb,0x8ef8,0x8efc,
-0x8f9c,0x902e,0x9035,0x9031,0x9038,0x9032,0x9036,0x9102,
-0x90f5,0x9109,0x90fe,0x9163,0x9165,0x91cf,0x9214,0x9215,
-0x9223,0x9209,0x921e,0x920d,0x9210,0x9207,0x9211,0x9594,
-0x958f,0x958b,0x9591,0x9593,0x9592,0x958e,0x968a,0x968e,
-0x968b,0x967d,0x9685,0x9686,0x968d,0x9672,0x9684,0x96c1,
-0x96c5,0x96c4,0x96c6,0x96c7,0x96ef,0x96f2,0x97cc,0x9805,
-0x9806,0x9808,0x98e7,0x98ea,0x98ef,0x98e9,0x98f2,0x98ed,
-0x99ae,0x99ad,0x9ec3,0x9ecd,0x9ed1,0x4e82,0x50ad,0x50b5,
-0x50b2,0x50b3,0x50c5,0x50be,0x50ac,0x50b7,0x50bb,0x50af,
-0x50c7,0x527f,0x5277,0x527d,0x52df,0x52e6,0x52e4,0x52e2,
-0x52e3,0x532f,0x55df,0x55e8,0x55d3,0x55e6,0x55ce,0x55dc,
-0x55c7,0x55d1,0x55e3,0x55e4,0x55ef,0x55da,0x55e1,0x55c5,
-0x55c6,0x55e5,0x55c9,0x5712,0x5713,0x585e,0x5851,0x5858,
-0x5857,0x585a,0x5854,0x586b,0x584c,0x586d,0x584a,0x5862,
-0x5852,0x584b,0x5967,0x5ac1,0x5ac9,0x5acc,0x5abe,0x5abd,
-0x5abc,0x5ab3,0x5ac2,0x5ab2,0x5d69,0x5d6f,0x5e4c,0x5e79,
-0x5ec9,0x5ec8,0x5f12,0x5f59,0x5fac,0x5fae,0x611a,0x610f,
-0x6148,0x611f,0x60f3,0x611b,0x60f9,0x6101,0x6108,0x614e,
-0x614c,0x6144,0x614d,0x613e,0x6134,0x6127,0x610d,0x6106,
-0x6137,0x6221,0x6222,0x6413,0x643e,0x641e,0x642a,0x642d,
-0x643d,0x642c,0x640f,0x641c,0x6414,0x640d,0x6436,0x6416,
-0x6417,0x6406,0x656c,0x659f,0x65b0,0x6697,0x6689,0x6687,
-0x6688,0x6696,0x6684,0x6698,0x668d,0x6703,0x6994,0x696d,
-0x695a,0x6977,0x6960,0x6954,0x6975,0x6930,0x6982,0x694a,
-0x6968,0x696b,0x695e,0x6953,0x6979,0x6986,0x695d,0x6963,
-0x695b,0x6b47,0x6b72,0x6bc0,0x6bbf,0x6bd3,0x6bfd,0x6ea2,
-0x6eaf,0x6ed3,0x6eb6,0x6ec2,0x6e90,0x6e9d,0x6ec7,0x6ec5,
-0x6ea5,0x6e98,0x6ebc,0x6eba,0x6eab,0x6ed1,0x6e96,0x6e9c,
-0x6ec4,0x6ed4,0x6eaa,0x6ea7,0x6eb4,0x714e,0x7159,0x7169,
-0x7164,0x7149,0x7167,0x715c,0x716c,0x7166,0x714c,0x7165,
-0x715e,0x7146,0x7168,0x7156,0x723a,0x7252,0x7337,0x7345,
-0x733f,0x733e,0x746f,0x745a,0x7455,0x745f,0x745e,0x7441,
-0x743f,0x7459,0x745b,0x745c,0x7576,0x7578,0x7600,0x75f0,
-0x7601,0x75f2,0x75f1,0x75fa,0x75ff,0x75f4,0x75f3,0x76de,
-0x76df,0x775b,0x776b,0x7766,0x775e,0x7763,0x7779,0x776a,
-0x776c,0x775c,0x7765,0x7768,0x7762,0x77ee,0x788e,0x78b0,
-0x7897,0x7898,0x788c,0x7889,0x787c,0x7891,0x7893,0x787f,
-0x797a,0x797f,0x7981,0x842c,0x79bd,0x7a1c,0x7a1a,0x7a20,
-0x7a14,0x7a1f,0x7a1e,0x7a9f,0x7aa0,0x7b77,0x7bc0,0x7b60,
-0x7b6e,0x7b67,0x7cb1,0x7cb3,0x7cb5,0x7d93,0x7d79,0x7d91,
-0x7d81,0x7d8f,0x7d5b,0x7f6e,0x7f69,0x7f6a,0x7f72,0x7fa9,
-0x7fa8,0x7fa4,0x8056,0x8058,0x8086,0x8084,0x8171,0x8170,
-0x8178,0x8165,0x816e,0x8173,0x816b,0x8179,0x817a,0x8166,
-0x8205,0x8247,0x8482,0x8477,0x843d,0x8431,0x8475,0x8466,
-0x846b,0x8449,0x846c,0x845b,0x843c,0x8435,0x8461,0x8463,
-0x8469,0x846d,0x8446,0x865e,0x865c,0x865f,0x86f9,0x8713,
-0x8708,0x8707,0x8700,0x86fe,0x86fb,0x8702,0x8703,0x8706,
-0x870a,0x8859,0x88df,0x88d4,0x88d9,0x88dc,0x88d8,0x88dd,
-0x88e1,0x88ca,0x88d5,0x88d2,0x899c,0x89e3,0x8a6b,0x8a72,
-0x8a73,0x8a66,0x8a69,0x8a70,0x8a87,0x8a7c,0x8a63,0x8aa0,
-0x8a71,0x8a85,0x8a6d,0x8a62,0x8a6e,0x8a6c,0x8a79,0x8a7b,
-0x8a3e,0x8a68,0x8c62,0x8c8a,0x8c89,0x8cca,0x8cc7,0x8cc8,
-0x8cc4,0x8cb2,0x8cc3,0x8cc2,0x8cc5,0x8de1,0x8ddf,0x8de8,
-0x8def,0x8df3,0x8dfa,0x8dea,0x8de4,0x8de6,0x8eb2,0x8f03,
-0x8f09,0x8efe,0x8f0a,0x8f9f,0x8fb2,0x904b,0x904a,0x9053,
-0x9042,0x9054,0x903c,0x9055,0x9050,0x9047,0x904f,0x904e,
-0x904d,0x9051,0x903e,0x9041,0x9112,0x9117,0x916c,0x916a,
-0x9169,0x91c9,0x9237,0x9257,0x9238,0x923d,0x9240,0x923e,
-0x925b,0x924b,0x9264,0x9251,0x9234,0x9249,0x924d,0x9245,
-0x9239,0x923f,0x925a,0x9598,0x9698,0x9694,0x9695,0x96cd,
-0x96cb,0x96c9,0x96ca,0x96f7,0x96fb,0x96f9,0x96f6,0x9756,
-0x9774,0x9776,0x9810,0x9811,0x9813,0x980a,0x9812,0x980c,
-0x98fc,0x98f4,0x98fd,0x98fe,0x99b3,0x99b1,0x99b4,0x9ae1,
-0x9ce9,0x9e82,0x9f0e,0x9f13,0x9f20,0x50e7,0x50ee,0x50e5,
-0x50d6,0x50ed,0x50da,0x50d5,0x50cf,0x50d1,0x50f1,0x50ce,
-0x50e9,0x5162,0x51f3,0x5283,0x5282,0x5331,0x53ad,0x55fe,
-0x5600,0x561b,0x5617,0x55fd,0x5614,0x5606,0x5609,0x560d,
-0x560e,0x55f7,0x5616,0x561f,0x5608,0x5610,0x55f6,0x5718,
-0x5716,0x5875,0x587e,0x5883,0x5893,0x588a,0x5879,0x5885,
-0x587d,0x58fd,0x5925,0x5922,0x5924,0x596a,0x5969,0x5ae1,
-0x5ae6,0x5ae9,0x5ad7,0x5ad6,0x5ad8,0x5ae3,0x5b75,0x5bde,
-0x5be7,0x5be1,0x5be5,0x5be6,0x5be8,0x5be2,0x5be4,0x5bdf,
-0x5c0d,0x5c62,0x5d84,0x5d87,0x5e5b,0x5e63,0x5e55,0x5e57,
-0x5e54,0x5ed3,0x5ed6,0x5f0a,0x5f46,0x5f70,0x5fb9,0x6147,
-0x613f,0x614b,0x6177,0x6162,0x6163,0x615f,0x615a,0x6158,
-0x6175,0x622a,0x6487,0x6458,0x6454,0x64a4,0x6478,0x645f,
-0x647a,0x6451,0x6467,0x6434,0x646d,0x647b,0x6572,0x65a1,
-0x65d7,0x65d6,0x66a2,0x66a8,0x669d,0x699c,0x69a8,0x6995,
-0x69c1,0x69ae,0x69d3,0x69cb,0x699b,0x69b7,0x69bb,0x69ab,
-0x69b4,0x69d0,0x69cd,0x69ad,0x69cc,0x69a6,0x69c3,0x69a3,
-0x6b49,0x6b4c,0x6c33,0x6f33,0x6f14,0x6efe,0x6f13,0x6ef4,
-0x6f29,0x6f3e,0x6f20,0x6f2c,0x6f0f,0x6f02,0x6f22,0x6eff,
-0x6eef,0x6f06,0x6f31,0x6f38,0x6f32,0x6f23,0x6f15,0x6f2b,
-0x6f2f,0x6f88,0x6f2a,0x6eec,0x6f01,0x6ef2,0x6ecc,0x6ef7,
-0x7194,0x7199,0x717d,0x718a,0x7184,0x7192,0x723e,0x7292,
-0x7296,0x7344,0x7350,0x7464,0x7463,0x746a,0x7470,0x746d,
-0x7504,0x7591,0x7627,0x760d,0x760b,0x7609,0x7613,0x76e1,
-0x76e3,0x7784,0x777d,0x777f,0x7761,0x78c1,0x789f,0x78a7,
-0x78b3,0x78a9,0x78a3,0x798e,0x798f,0x798d,0x7a2e,0x7a31,
-0x7aaa,0x7aa9,0x7aed,0x7aef,0x7ba1,0x7b95,0x7b8b,0x7b75,
-0x7b97,0x7b9d,0x7b94,0x7b8f,0x7bb8,0x7b87,0x7b84,0x7cb9,
-0x7cbd,0x7cbe,0x7dbb,0x7db0,0x7d9c,0x7dbd,0x7dbe,0x7da0,
-0x7dca,0x7db4,0x7db2,0x7db1,0x7dba,0x7da2,0x7dbf,0x7db5,
-0x7db8,0x7dad,0x7dd2,0x7dc7,0x7dac,0x7f70,0x7fe0,0x7fe1,
-0x7fdf,0x805e,0x805a,0x8087,0x8150,0x8180,0x818f,0x8188,
-0x818a,0x817f,0x8182,0x81e7,0x81fa,0x8207,0x8214,0x821e,
-0x824b,0x84c9,0x84bf,0x84c6,0x84c4,0x8499,0x849e,0x84b2,
-0x849c,0x84cb,0x84b8,0x84c0,0x84d3,0x8490,0x84bc,0x84d1,
-0x84ca,0x873f,0x871c,0x873b,0x8722,0x8725,0x8734,0x8718,
-0x8755,0x8737,0x8729,0x88f3,0x8902,0x88f4,0x88f9,0x88f8,
-0x88fd,0x88e8,0x891a,0x88ef,0x8aa6,0x8a8c,0x8a9e,0x8aa3,
-0x8a8d,0x8aa1,0x8a93,0x8aa4,0x8aaa,0x8aa5,0x8aa8,0x8a98,
-0x8a91,0x8a9a,0x8aa7,0x8c6a,0x8c8d,0x8c8c,0x8cd3,0x8cd1,
-0x8cd2,0x8d6b,0x8d99,0x8d95,0x8dfc,0x8f14,0x8f12,0x8f15,
-0x8f13,0x8fa3,0x9060,0x9058,0x905c,0x9063,0x9059,0x905e,
-0x9062,0x905d,0x905b,0x9119,0x9118,0x911e,0x9175,0x9178,
-0x9177,0x9174,0x9278,0x92ac,0x9280,0x9285,0x9298,0x9296,
-0x927b,0x9293,0x929c,0x92a8,0x927c,0x9291,0x95a1,0x95a8,
-0x95a9,0x95a3,0x95a5,0x95a4,0x9699,0x969c,0x969b,0x96cc,
-0x96d2,0x9700,0x977c,0x9785,0x97f6,0x9817,0x9818,0x98af,
-0x98b1,0x9903,0x9905,0x990c,0x9909,0x99c1,0x9aaf,0x9ab0,
-0x9ae6,0x9b41,0x9b42,0x9cf4,0x9cf6,0x9cf3,0x9ebc,0x9f3b,
-0x9f4a,0x5104,0x5100,0x50fb,0x50f5,0x50f9,0x5102,0x5108,
-0x5109,0x5105,0x51dc,0x5287,0x5288,0x5289,0x528d,0x528a,
-0x52f0,0x53b2,0x562e,0x563b,0x5639,0x5632,0x563f,0x5634,
-0x5629,0x5653,0x564e,0x5657,0x5674,0x5636,0x562f,0x5630,
-0x5880,0x589f,0x589e,0x58b3,0x589c,0x58ae,0x58a9,0x58a6,
-0x596d,0x5b09,0x5afb,0x5b0b,0x5af5,0x5b0c,0x5b08,0x5bee,
-0x5bec,0x5be9,0x5beb,0x5c64,0x5c65,0x5d9d,0x5d94,0x5e62,
-0x5e5f,0x5e61,0x5ee2,0x5eda,0x5edf,0x5edd,0x5ee3,0x5ee0,
-0x5f48,0x5f71,0x5fb7,0x5fb5,0x6176,0x6167,0x616e,0x615d,
-0x6155,0x6182,0x617c,0x6170,0x616b,0x617e,0x61a7,0x6190,
-0x61ab,0x618e,0x61ac,0x619a,0x61a4,0x6194,0x61ae,0x622e,
-0x6469,0x646f,0x6479,0x649e,0x64b2,0x6488,0x6490,0x64b0,
-0x64a5,0x6493,0x6495,0x64a9,0x6492,0x64ae,0x64ad,0x64ab,
-0x649a,0x64ac,0x6499,0x64a2,0x64b3,0x6575,0x6577,0x6578,
-0x66ae,0x66ab,0x66b4,0x66b1,0x6a23,0x6a1f,0x69e8,0x6a01,
-0x6a1e,0x6a19,0x69fd,0x6a21,0x6a13,0x6a0a,0x69f3,0x6a02,
-0x6a05,0x69ed,0x6a11,0x6b50,0x6b4e,0x6ba4,0x6bc5,0x6bc6,
-0x6f3f,0x6f7c,0x6f84,0x6f51,0x6f66,0x6f54,0x6f86,0x6f6d,
-0x6f5b,0x6f78,0x6f6e,0x6f8e,0x6f7a,0x6f70,0x6f64,0x6f97,
-0x6f58,0x6ed5,0x6f6f,0x6f60,0x6f5f,0x719f,0x71ac,0x71b1,
-0x71a8,0x7256,0x729b,0x734e,0x7357,0x7469,0x748b,0x7483,
-0x747e,0x7480,0x757f,0x7620,0x7629,0x761f,0x7624,0x7626,
-0x7621,0x7622,0x769a,0x76ba,0x76e4,0x778e,0x7787,0x778c,
-0x7791,0x778b,0x78cb,0x78c5,0x78ba,0x78ca,0x78be,0x78d5,
-0x78bc,0x78d0,0x7a3f,0x7a3c,0x7a40,0x7a3d,0x7a37,0x7a3b,
-0x7aaf,0x7aae,0x7bad,0x7bb1,0x7bc4,0x7bb4,0x7bc6,0x7bc7,
-0x7bc1,0x7ba0,0x7bcc,0x7cca,0x7de0,0x7df4,0x7def,0x7dfb,
-0x7dd8,0x7dec,0x7ddd,0x7de8,0x7de3,0x7dda,0x7dde,0x7de9,
-0x7d9e,0x7dd9,0x7df2,0x7df9,0x7f75,0x7f77,0x7faf,0x7fe9,
-0x8026,0x819b,0x819c,0x819d,0x81a0,0x819a,0x8198,0x8517,
-0x853d,0x851a,0x84ee,0x852c,0x852d,0x8513,0x8511,0x8523,
-0x8521,0x8514,0x84ec,0x8525,0x84ff,0x8506,0x8782,0x8774,
-0x8776,0x8760,0x8766,0x8778,0x8768,0x8759,0x8757,0x874c,
-0x8753,0x885b,0x885d,0x8910,0x8907,0x8912,0x8913,0x8915,
-0x890a,0x8abc,0x8ad2,0x8ac7,0x8ac4,0x8a95,0x8acb,0x8af8,
-0x8ab2,0x8ac9,0x8ac2,0x8abf,0x8ab0,0x8ad6,0x8acd,0x8ab6,
-0x8ab9,0x8adb,0x8c4c,0x8c4e,0x8c6c,0x8ce0,0x8cde,0x8ce6,
-0x8ce4,0x8cec,0x8ced,0x8ce2,0x8ce3,0x8cdc,0x8cea,0x8ce1,
-0x8d6d,0x8d9f,0x8da3,0x8e2b,0x8e10,0x8e1d,0x8e22,0x8e0f,
-0x8e29,0x8e1f,0x8e21,0x8e1e,0x8eba,0x8f1d,0x8f1b,0x8f1f,
-0x8f29,0x8f26,0x8f2a,0x8f1c,0x8f1e,0x8f25,0x9069,0x906e,
-0x9068,0x906d,0x9077,0x9130,0x912d,0x9127,0x9131,0x9187,
-0x9189,0x918b,0x9183,0x92c5,0x92bb,0x92b7,0x92ea,0x92e4,
-0x92c1,0x92b3,0x92bc,0x92d2,0x92c7,0x92f0,0x92b2,0x95ad,
-0x95b1,0x9704,0x9706,0x9707,0x9709,0x9760,0x978d,0x978b,
-0x978f,0x9821,0x982b,0x981c,0x98b3,0x990a,0x9913,0x9912,
-0x9918,0x99dd,0x99d0,0x99df,0x99db,0x99d1,0x99d5,0x99d2,
-0x99d9,0x9ab7,0x9aee,0x9aef,0x9b27,0x9b45,0x9b44,0x9b77,
-0x9b6f,0x9d06,0x9d09,0x9d03,0x9ea9,0x9ebe,0x9ece,0x58a8,
-0x9f52,0x5112,0x5118,0x5114,0x5110,0x5115,0x5180,0x51aa,
-0x51dd,0x5291,0x5293,0x52f3,0x5659,0x566b,0x5679,0x5669,
-0x5664,0x5678,0x566a,0x5668,0x5665,0x5671,0x566f,0x566c,
-0x5662,0x5676,0x58c1,0x58be,0x58c7,0x58c5,0x596e,0x5b1d,
-0x5b34,0x5b78,0x5bf0,0x5c0e,0x5f4a,0x61b2,0x6191,0x61a9,
-0x618a,0x61cd,0x61b6,0x61be,0x61ca,0x61c8,0x6230,0x64c5,
-0x64c1,0x64cb,0x64bb,0x64bc,0x64da,0x64c4,0x64c7,0x64c2,
-0x64cd,0x64bf,0x64d2,0x64d4,0x64be,0x6574,0x66c6,0x66c9,
-0x66b9,0x66c4,0x66c7,0x66b8,0x6a3d,0x6a38,0x6a3a,0x6a59,
-0x6a6b,0x6a58,0x6a39,0x6a44,0x6a62,0x6a61,0x6a4b,0x6a47,
-0x6a35,0x6a5f,0x6a48,0x6b59,0x6b77,0x6c05,0x6fc2,0x6fb1,
-0x6fa1,0x6fc3,0x6fa4,0x6fc1,0x6fa7,0x6fb3,0x6fc0,0x6fb9,
-0x6fb6,0x6fa6,0x6fa0,0x6fb4,0x71be,0x71c9,0x71d0,0x71d2,
-0x71c8,0x71d5,0x71b9,0x71ce,0x71d9,0x71dc,0x71c3,0x71c4,
-0x7368,0x749c,0x74a3,0x7498,0x749f,0x749e,0x74e2,0x750c,
-0x750d,0x7634,0x7638,0x763a,0x76e7,0x76e5,0x77a0,0x779e,
-0x779f,0x77a5,0x78e8,0x78da,0x78ec,0x78e7,0x79a6,0x7a4d,
-0x7a4e,0x7a46,0x7a4c,0x7a4b,0x7aba,0x7bd9,0x7c11,0x7bc9,
-0x7be4,0x7bdb,0x7be1,0x7be9,0x7be6,0x7cd5,0x7cd6,0x7e0a,
-0x7e11,0x7e08,0x7e1b,0x7e23,0x7e1e,0x7e1d,0x7e09,0x7e10,
-0x7f79,0x7fb2,0x7ff0,0x7ff1,0x7fee,0x8028,0x81b3,0x81a9,
-0x81a8,0x81fb,0x8208,0x8258,0x8259,0x854a,0x8559,0x8548,
-0x8568,0x8569,0x8543,0x8549,0x856d,0x856a,0x855e,0x8783,
-0x879f,0x879e,0x87a2,0x878d,0x8861,0x892a,0x8932,0x8925,
-0x892b,0x8921,0x89aa,0x89a6,0x8ae6,0x8afa,0x8aeb,0x8af1,
-0x8b00,0x8adc,0x8ae7,0x8aee,0x8afe,0x8b01,0x8b02,0x8af7,
-0x8aed,0x8af3,0x8af6,0x8afc,0x8c6b,0x8c6d,0x8c93,0x8cf4,
-0x8e44,0x8e31,0x8e34,0x8e42,0x8e39,0x8e35,0x8f3b,0x8f2f,
-0x8f38,0x8f33,0x8fa8,0x8fa6,0x9075,0x9074,0x9078,0x9072,
-0x907c,0x907a,0x9134,0x9192,0x9320,0x9336,0x92f8,0x9333,
-0x932f,0x9322,0x92fc,0x932b,0x9304,0x931a,0x9310,0x9326,
-0x9321,0x9315,0x932e,0x9319,0x95bb,0x96a7,0x96a8,0x96aa,
-0x96d5,0x970e,0x9711,0x9716,0x970d,0x9713,0x970f,0x975b,
-0x975c,0x9766,0x9798,0x9830,0x9838,0x983b,0x9837,0x982d,
-0x9839,0x9824,0x9910,0x9928,0x991e,0x991b,0x9921,0x991a,
-0x99ed,0x99e2,0x99f1,0x9ab8,0x9abc,0x9afb,0x9aed,0x9b28,
-0x9b91,0x9d15,0x9d23,0x9d26,0x9d28,0x9d12,0x9d1b,0x9ed8,
-0x9ed4,0x9f8d,0x9f9c,0x512a,0x511f,0x5121,0x5132,0x52f5,
-0x568e,0x5680,0x5690,0x5685,0x5687,0x568f,0x58d5,0x58d3,
-0x58d1,0x58ce,0x5b30,0x5b2a,0x5b24,0x5b7a,0x5c37,0x5c68,
-0x5dbc,0x5dba,0x5dbd,0x5db8,0x5e6b,0x5f4c,0x5fbd,0x61c9,
-0x61c2,0x61c7,0x61e6,0x61cb,0x6232,0x6234,0x64ce,0x64ca,
-0x64d8,0x64e0,0x64f0,0x64e6,0x64ec,0x64f1,0x64e2,0x64ed,
-0x6582,0x6583,0x66d9,0x66d6,0x6a80,0x6a94,0x6a84,0x6aa2,
-0x6a9c,0x6adb,0x6aa3,0x6a7e,0x6a97,0x6a90,0x6aa0,0x6b5c,
-0x6bae,0x6bda,0x6c08,0x6fd8,0x6ff1,0x6fdf,0x6fe0,0x6fdb,
-0x6fe4,0x6feb,0x6fef,0x6f80,0x6fec,0x6fe1,0x6fe9,0x6fd5,
-0x6fee,0x6ff0,0x71e7,0x71df,0x71ee,0x71e6,0x71e5,0x71ed,
-0x71ec,0x71f4,0x71e0,0x7235,0x7246,0x7370,0x7372,0x74a9,
-0x74b0,0x74a6,0x74a8,0x7646,0x7642,0x764c,0x76ea,0x77b3,
-0x77aa,0x77b0,0x77ac,0x77a7,0x77ad,0x77ef,0x78f7,0x78fa,
-0x78f4,0x78ef,0x7901,0x79a7,0x79aa,0x7a57,0x7abf,0x7c07,
-0x7c0d,0x7bfe,0x7bf7,0x7c0c,0x7be0,0x7ce0,0x7cdc,0x7cde,
-0x7ce2,0x7cdf,0x7cd9,0x7cdd,0x7e2e,0x7e3e,0x7e46,0x7e37,
-0x7e32,0x7e43,0x7e2b,0x7e3d,0x7e31,0x7e45,0x7e41,0x7e34,
-0x7e39,0x7e48,0x7e35,0x7e3f,0x7e2f,0x7f44,0x7ff3,0x7ffc,
-0x8071,0x8072,0x8070,0x806f,0x8073,0x81c6,0x81c3,0x81ba,
-0x81c2,0x81c0,0x81bf,0x81bd,0x81c9,0x81be,0x81e8,0x8209,
-0x8271,0x85aa,0x8584,0x857e,0x859c,0x8591,0x8594,0x85af,
-0x859b,0x8587,0x85a8,0x858a,0x85a6,0x8667,0x87c0,0x87d1,
-0x87b3,0x87d2,0x87c6,0x87ab,0x87bb,0x87ba,0x87c8,0x87cb,
-0x893b,0x8936,0x8944,0x8938,0x893d,0x89ac,0x8b0e,0x8b17,
-0x8b19,0x8b1b,0x8b0a,0x8b20,0x8b1d,0x8b04,0x8b10,0x8c41,
-0x8c3f,0x8c73,0x8cfa,0x8cfd,0x8cfc,0x8cf8,0x8cfb,0x8da8,
-0x8e49,0x8e4b,0x8e48,0x8e4a,0x8f44,0x8f3e,0x8f42,0x8f45,
-0x8f3f,0x907f,0x907d,0x9084,0x9081,0x9082,0x9080,0x9139,
-0x91a3,0x919e,0x919c,0x934d,0x9382,0x9328,0x9375,0x934a,
-0x9365,0x934b,0x9318,0x937e,0x936c,0x935b,0x9370,0x935a,
-0x9354,0x95ca,0x95cb,0x95cc,0x95c8,0x95c6,0x96b1,0x96b8,
-0x96d6,0x971c,0x971e,0x97a0,0x97d3,0x9846,0x98b6,0x9935,
-0x9a01,0x99ff,0x9bae,0x9bab,0x9baa,0x9bad,0x9d3b,0x9d3f,
-0x9e8b,0x9ecf,0x9ede,0x9edc,0x9edd,0x9edb,0x9f3e,0x9f4b,
-0x53e2,0x5695,0x56ae,0x58d9,0x58d8,0x5b38,0x5f5e,0x61e3,
-0x6233,0x64f4,0x64f2,0x64fe,0x6506,0x64fa,0x64fb,0x64f7,
-0x65b7,0x66dc,0x6726,0x6ab3,0x6aac,0x6ac3,0x6abb,0x6ab8,
-0x6ac2,0x6aae,0x6aaf,0x6b5f,0x6b78,0x6baf,0x7009,0x700b,
-0x6ffe,0x7006,0x6ffa,0x7011,0x700f,0x71fb,0x71fc,0x71fe,
-0x71f8,0x7377,0x7375,0x74a7,0x74bf,0x7515,0x7656,0x7658,
-0x7652,0x77bd,0x77bf,0x77bb,0x77bc,0x790e,0x79ae,0x7a61,
-0x7a62,0x7a60,0x7ac4,0x7ac5,0x7c2b,0x7c27,0x7c2a,0x7c1e,
-0x7c23,0x7c21,0x7ce7,0x7e54,0x7e55,0x7e5e,0x7e5a,0x7e61,
-0x7e52,0x7e59,0x7f48,0x7ff9,0x7ffb,0x8077,0x8076,0x81cd,
-0x81cf,0x820a,0x85cf,0x85a9,0x85cd,0x85d0,0x85c9,0x85b0,
-0x85ba,0x85b9,0x87ef,0x87ec,0x87f2,0x87e0,0x8986,0x89b2,
-0x89f4,0x8b28,0x8b39,0x8b2c,0x8b2b,0x8c50,0x8d05,0x8e59,
-0x8e63,0x8e66,0x8e64,0x8e5f,0x8e55,0x8ec0,0x8f49,0x8f4d,
-0x9087,0x9083,0x9088,0x91ab,0x91ac,0x91d0,0x9394,0x938a,
-0x9396,0x93a2,0x93b3,0x93ae,0x93ac,0x93b0,0x9398,0x939a,
-0x9397,0x95d4,0x95d6,0x95d0,0x95d5,0x96e2,0x96dc,0x96d9,
-0x96db,0x96de,0x9724,0x97a3,0x97a6,0x97ad,0x97f9,0x984d,
-0x984f,0x984c,0x984e,0x9853,0x98ba,0x993e,0x993f,0x993d,
-0x992e,0x99a5,0x9a0e,0x9ac1,0x9b03,0x9b06,0x9b4f,0x9b4e,
-0x9b4d,0x9bca,0x9bc9,0x9bfd,0x9bc8,0x9bc0,0x9d51,0x9d5d,
-0x9d60,0x9ee0,0x9f15,0x9f2c,0x5133,0x56a5,0x56a8,0x58de,
-0x58df,0x58e2,0x5bf5,0x9f90,0x5eec,0x61f2,0x61f7,0x61f6,
-0x61f5,0x6500,0x650f,0x66e0,0x66dd,0x6ae5,0x6add,0x6ada,
-0x6ad3,0x701b,0x701f,0x7028,0x701a,0x701d,0x7015,0x7018,
-0x7206,0x720d,0x7258,0x72a2,0x7378,0x737a,0x74bd,0x74ca,
-0x74e3,0x7587,0x7586,0x765f,0x7661,0x77c7,0x7919,0x79b1,
-0x7a6b,0x7a69,0x7c3e,0x7c3f,0x7c38,0x7c3d,0x7c37,0x7c40,
-0x7e6b,0x7e6d,0x7e79,0x7e69,0x7e6a,0x7e73,0x7f85,0x7fb6,
-0x7fb9,0x7fb8,0x81d8,0x85e9,0x85dd,0x85ea,0x85d5,0x85e4,
-0x85e5,0x85f7,0x87fb,0x8805,0x880d,0x87f9,0x87fe,0x8960,
-0x895f,0x8956,0x895e,0x8b41,0x8b5c,0x8b58,0x8b49,0x8b5a,
-0x8b4e,0x8b4f,0x8b46,0x8b59,0x8d08,0x8d0a,0x8e7c,0x8e72,
-0x8e87,0x8e76,0x8e6c,0x8e7a,0x8e74,0x8f54,0x8f4e,0x8fad,
-0x908a,0x908b,0x91b1,0x91ae,0x93e1,0x93d1,0x93df,0x93c3,
-0x93c8,0x93dc,0x93dd,0x93d6,0x93e2,0x93cd,0x93d8,0x93e4,
-0x93d7,0x93e8,0x95dc,0x96b4,0x96e3,0x972a,0x9727,0x9761,
-0x97dc,0x97fb,0x985e,0x9858,0x985b,0x98bc,0x9945,0x9949,
-0x9a16,0x9a19,0x9b0d,0x9be8,0x9be7,0x9bd6,0x9bdb,0x9d89,
-0x9d61,0x9d72,0x9d6a,0x9d6c,0x9e92,0x9e97,0x9e93,0x9eb4,
-0x52f8,0x56b7,0x56b6,0x56b4,0x56bc,0x58e4,0x5b40,0x5b43,
-0x5b7d,0x5bf6,0x5dc9,0x61f8,0x61fa,0x6518,0x6514,0x6519,
-0x66e6,0x6727,0x6aec,0x703e,0x7030,0x7032,0x7210,0x737b,
-0x74cf,0x7662,0x7665,0x7926,0x792a,0x792c,0x792b,0x7ac7,
-0x7af6,0x7c4c,0x7c43,0x7c4d,0x7cef,0x7cf0,0x8fae,0x7e7d,
-0x7e7c,0x7e82,0x7f4c,0x8000,0x81da,0x8266,0x85fb,0x85f9,
-0x8611,0x85fa,0x8606,0x860b,0x8607,0x860a,0x8814,0x8815,
-0x8964,0x89ba,0x89f8,0x8b70,0x8b6c,0x8b66,0x8b6f,0x8b5f,
-0x8b6b,0x8d0f,0x8d0d,0x8e89,0x8e81,0x8e85,0x8e82,0x91b4,
-0x91cb,0x9418,0x9403,0x93fd,0x95e1,0x9730,0x98c4,0x9952,
-0x9951,0x99a8,0x9a2b,0x9a30,0x9a37,0x9a35,0x9c13,0x9c0d,
-0x9e79,0x9eb5,0x9ee8,0x9f2f,0x9f5f,0x9f63,0x9f61,0x5137,
-0x5138,0x56c1,0x56c0,0x56c2,0x5914,0x5c6c,0x5dcd,0x61fc,
-0x61fe,0x651d,0x651c,0x6595,0x66e9,0x6afb,0x6b04,0x6afa,
-0x6bb2,0x704c,0x721b,0x72a7,0x74d6,0x74d4,0x7669,0x77d3,
-0x7c50,0x7e8f,0x7e8c,0x7fbc,0x8617,0x862d,0x861a,0x8823,
-0x8822,0x8821,0x881f,0x896a,0x896c,0x89bd,0x8b74,0x8b77,
-0x8b7d,0x8d13,0x8e8a,0x8e8d,0x8e8b,0x8f5f,0x8faf,0x91ba,
-0x942e,0x9433,0x9435,0x943a,0x9438,0x9432,0x942b,0x95e2,
-0x9738,0x9739,0x9732,0x97ff,0x9867,0x9865,0x9957,0x9a45,
-0x9a43,0x9a40,0x9a3e,0x9acf,0x9b54,0x9b51,0x9c2d,0x9c25,
-0x9daf,0x9db4,0x9dc2,0x9db8,0x9e9d,0x9eef,0x9f19,0x9f5c,
-0x9f66,0x9f67,0x513c,0x513b,0x56c8,0x56ca,0x56c9,0x5b7f,
-0x5dd4,0x5dd2,0x5f4e,0x61ff,0x6524,0x6b0a,0x6b61,0x7051,
-0x7058,0x7380,0x74e4,0x758a,0x766e,0x766c,0x79b3,0x7c60,
-0x7c5f,0x807e,0x807d,0x81df,0x8972,0x896f,0x89fc,0x8b80,
-0x8d16,0x8d17,0x8e91,0x8e93,0x8f61,0x9148,0x9444,0x9451,
-0x9452,0x973d,0x973e,0x97c3,0x97c1,0x986b,0x9955,0x9a55,
-0x9a4d,0x9ad2,0x9b1a,0x9c49,0x9c31,0x9c3e,0x9c3b,0x9dd3,
-0x9dd7,0x9f34,0x9f6c,0x9f6a,0x9f94,0x56cc,0x5dd6,0x6200,
-0x6523,0x652b,0x652a,0x66ec,0x6b10,0x74da,0x7aca,0x7c64,
-0x7c63,0x7c65,0x7e93,0x7e96,0x7e94,0x81e2,0x8638,0x863f,
-0x8831,0x8b8a,0x9090,0x908f,0x9463,0x9460,0x9464,0x9768,
-0x986f,0x995c,0x9a5a,0x9a5b,0x9a57,0x9ad3,0x9ad4,0x9ad1,
-0x9c54,0x9c57,0x9c56,0x9de5,0x9e9f,0x9ef4,0x56d1,0x58e9,
-0x652c,0x705e,0x7671,0x7672,0x77d7,0x7f50,0x7f88,0x8836,
-0x8839,0x8862,0x8b93,0x8b92,0x8b96,0x8277,0x8d1b,0x91c0,
-0x946a,0x9742,0x9748,0x9744,0x97c6,0x9870,0x9a5f,0x9b22,
-0x9b58,0x9c5f,0x9df9,0x9dfa,0x9e7c,0x9e7d,0x9f07,0x9f77,
-0x9f72,0x5ef3,0x6b16,0x7063,0x7c6c,0x7c6e,0x883b,0x89c0,
-0x8ea1,0x91c1,0x9472,0x9470,0x9871,0x995e,0x9ad6,0x9b23,
-0x9ecc,0x7064,0x77da,0x8b9a,0x9477,0x97c9,0x9a62,0x9a65,
-0x7e9c,0x8b9c,0x8eaa,0x91c5,0x947d,0x947e,0x947c,0x9c77,
-0x9c78,0x9ef7,0x8c54,0x947f,0x9e1a,0x7228,0x9a6a,0x9b31,
-0x9e1b,0x9e1e,0x7c72};
-
-static const int cns11643_1_ucs_table_size = (sizeof(cns11643_1_ucs_table)/sizeof(unsigned short));
-
-static const unsigned short cns11643_2_ucs_table[] = {
-0x4e42,0x4e5c,0x51f5,0x531a,0x5382,0x4e07,0x4e0c,0x4e47,
-0x4e8d,0x56d7,0x5c6e,0x5f73,0x4e0f,0x5187,0x4e0e,0x4e2e,
-0x4e93,0x4ec2,0x4ec9,0x4ec8,0x5198,0x52fc,0x536c,0x53b9,
-0x5720,0x5903,0x592c,0x5c10,0x5dff,0x65e1,0x6bb3,0x6bcc,
-0x6c14,0x723f,0x4e31,0x4e3c,0x4ee8,0x4edc,0x4ee9,0x4ee1,
-0x4edd,0x4eda,0x520c,0x5209,0x531c,0x534c,0x5722,0x5723,
-0x5917,0x592f,0x5b81,0x5b84,0x5c12,0x5c3b,0x5c74,0x5c73,
-0x5e04,0x5e80,0x5e82,0x5fc9,0x6209,0x6250,0x6c15,0x6c36,
-0x6c43,0x6c3f,0x6c3b,0x72ae,0x72b0,0x738a,0x79b8,0x808a,
-0x961e,0x4f0e,0x4f18,0x4f2c,0x4ef5,0x4f14,0x4ef1,0x4f00,
-0x4ef7,0x4f08,0x4f1d,0x4f02,0x4f05,0x4f22,0x4f13,0x4f04,
-0x4ef4,0x4f12,0x51b1,0x5213,0x5210,0x52a6,0x5322,0x531f,
-0x534d,0x538a,0x5407,0x56e1,0x56df,0x572e,0x572a,0x5734,
-0x593c,0x5980,0x597c,0x5985,0x597b,0x597e,0x5977,0x597f,
-0x5b56,0x5c15,0x5c25,0x5c7c,0x5c7a,0x5c7b,0x5c7e,0x5ddf,
-0x5e75,0x5e84,0x5f02,0x5f1a,0x5f74,0x5fd5,0x5fd4,0x5fcf,
-0x625c,0x625e,0x6264,0x6261,0x6266,0x6262,0x6259,0x6260,
-0x625a,0x6265,0x6537,0x65ef,0x65ee,0x673e,0x6739,0x6738,
-0x673b,0x673a,0x673f,0x673c,0x6733,0x6c18,0x6c46,0x6c52,
-0x6c5c,0x6c4f,0x6c4a,0x6c54,0x6c4b,0x6c4c,0x7071,0x725e,
-0x72b4,0x72b5,0x738e,0x752a,0x767f,0x7a75,0x7f51,0x8278,
-0x827c,0x8280,0x827d,0x827f,0x864d,0x897e,0x9099,0x9097,
-0x9098,0x909b,0x9094,0x9622,0x9624,0x9620,0x9623,0x4f56,
-0x4f3b,0x4f62,0x4f49,0x4f53,0x4f64,0x4f3e,0x4f67,0x4f52,
-0x4f5f,0x4f41,0x4f58,0x4f2d,0x4f33,0x4f3f,0x4f61,0x518f,
-0x51b9,0x521c,0x521e,0x5221,0x52ad,0x52ae,0x5309,0x5363,
-0x5372,0x538e,0x538f,0x5430,0x5437,0x542a,0x5454,0x5445,
-0x5419,0x541c,0x5425,0x5418,0x543d,0x544f,0x5441,0x5428,
-0x5424,0x5447,0x56ee,0x56e7,0x56e5,0x5741,0x5745,0x574c,
-0x5749,0x574b,0x5752,0x5906,0x5940,0x59a6,0x5998,0x59a0,
-0x5997,0x598e,0x59a2,0x5990,0x598f,0x59a7,0x59a1,0x5b8e,
-0x5b92,0x5c28,0x5c2a,0x5c8d,0x5c8f,0x5c88,0x5c8b,0x5c89,
-0x5c92,0x5c8a,0x5c86,0x5c93,0x5c95,0x5de0,0x5e0a,0x5e0e,
-0x5e8b,0x5e89,0x5e8c,0x5e88,0x5e8d,0x5f05,0x5f1d,0x5f78,
-0x5f76,0x5fd2,0x5fd1,0x5fd0,0x5fed,0x5fe8,0x5fee,0x5ff3,
-0x5fe1,0x5fe4,0x5fe3,0x5ffa,0x5fef,0x5ff7,0x5ffb,0x6000,
-0x5ff4,0x623a,0x6283,0x628c,0x628e,0x628f,0x6294,0x6287,
-0x6271,0x627b,0x627a,0x6270,0x6281,0x6288,0x6277,0x627d,
-0x6272,0x6274,0x65f0,0x65f4,0x65f3,0x65f2,0x65f5,0x6745,
-0x6747,0x6759,0x6755,0x674c,0x6748,0x675d,0x674d,0x675a,
-0x674b,0x6bd0,0x6c19,0x6c1a,0x6c78,0x6c67,0x6c6b,0x6c84,
-0x6c8b,0x6c8f,0x6c71,0x6c6f,0x6c69,0x6c9a,0x6c6d,0x6c87,
-0x6c95,0x6c9c,0x6c66,0x6c73,0x6c65,0x6c7b,0x6c8e,0x7074,
-0x707a,0x7263,0x72bf,0x72bd,0x72c3,0x72c6,0x72c1,0x72ba,
-0x72c5,0x7395,0x7397,0x7393,0x7394,0x7392,0x753a,0x7539,
-0x7594,0x7595,0x7681,0x793d,0x8034,0x8095,0x8099,0x8090,
-0x8092,0x809c,0x8290,0x828f,0x8285,0x828e,0x8291,0x8293,
-0x828a,0x8283,0x8284,0x8c78,0x8fc9,0x8fbf,0x909f,0x90a1,
-0x90a5,0x909e,0x90a7,0x90a0,0x9630,0x9628,0x962f,0x962d,
-0x4e33,0x4f98,0x4f7c,0x4f85,0x4f7d,0x4f80,0x4f87,0x4f76,
-0x4f74,0x4f89,0x4f84,0x4f77,0x4f4c,0x4f97,0x4f6a,0x4f9a,
-0x4f79,0x4f81,0x4f78,0x4f90,0x4f9c,0x4f94,0x4f9e,0x4f92,
-0x4f82,0x4f95,0x4f6b,0x4f6e,0x519e,0x51bc,0x51be,0x5235,
-0x5232,0x5233,0x5246,0x5231,0x52bc,0x530a,0x530b,0x533c,
-0x5392,0x5394,0x5487,0x547f,0x5481,0x5491,0x5482,0x5488,
-0x546b,0x547a,0x547e,0x5465,0x546c,0x5474,0x5466,0x548d,
-0x546f,0x5461,0x5460,0x5498,0x5463,0x5467,0x5464,0x56f7,
-0x56f9,0x576f,0x5772,0x576d,0x576b,0x5771,0x5770,0x5776,
-0x5780,0x5775,0x577b,0x5773,0x5774,0x5762,0x5768,0x577d,
-0x590c,0x5945,0x59b5,0x59ba,0x59cf,0x59ce,0x59b2,0x59cc,
-0x59c1,0x59b6,0x59bc,0x59c3,0x59d6,0x59b1,0x59bd,0x59c0,
-0x59c8,0x59b4,0x59c7,0x5b62,0x5b65,0x5b93,0x5b95,0x5c44,
-0x5c47,0x5cae,0x5ca4,0x5ca0,0x5cb5,0x5caf,0x5ca8,0x5cac,
-0x5c9f,0x5ca3,0x5cad,0x5ca2,0x5caa,0x5ca7,0x5c9d,0x5ca5,
-0x5cb6,0x5cb0,0x5ca6,0x5e17,0x5e14,0x5e19,0x5f28,0x5f22,
-0x5f23,0x5f24,0x5f54,0x5f82,0x5f7e,0x5f7d,0x5fde,0x5fe5,
-0x602d,0x6026,0x6019,0x6032,0x600b,0x6034,0x600a,0x6017,
-0x6033,0x601a,0x601e,0x602c,0x6022,0x600d,0x6010,0x602e,
-0x6013,0x6011,0x600c,0x6009,0x601c,0x6214,0x623d,0x62ad,
-0x62b4,0x62d1,0x62be,0x62aa,0x62b6,0x62ca,0x62ae,0x62b3,
-0x62af,0x62bb,0x62a9,0x62b0,0x62b8,0x653d,0x65a8,0x65bb,
-0x6609,0x65fc,0x6604,0x6612,0x6608,0x65fb,0x6603,0x660b,
-0x660d,0x6605,0x65fd,0x6611,0x6610,0x66f6,0x670a,0x6785,
-0x676c,0x678e,0x6792,0x6776,0x677b,0x6798,0x6786,0x6784,
-0x6774,0x678d,0x678c,0x677a,0x679f,0x6791,0x6799,0x6783,
-0x677d,0x6781,0x6778,0x6779,0x6794,0x6b25,0x6b80,0x6b7e,
-0x6bde,0x6c1d,0x6c93,0x6cec,0x6ceb,0x6cee,0x6cd9,0x6cb6,
-0x6cd4,0x6cad,0x6ce7,0x6cb7,0x6cd0,0x6cc2,0x6cba,0x6cc3,
-0x6cc6,0x6ced,0x6cf2,0x6cd2,0x6cdd,0x6cb4,0x6c8a,0x6c9d,
-0x6c80,0x6cde,0x6cc0,0x6d30,0x6ccd,0x6cc7,0x6cb0,0x6cf9,
-0x6ccf,0x6ce9,0x6cd1,0x7094,0x7098,0x7085,0x7093,0x7086,
-0x7084,0x7091,0x7096,0x7082,0x709a,0x7083,0x726a,0x72d6,
-0x72cb,0x72d8,0x72c9,0x72dc,0x72d2,0x72d4,0x72da,0x72cc,
-0x72d1,0x73a4,0x73a1,0x73ad,0x73a6,0x73a2,0x73a0,0x73ac,
-0x739d,0x74dd,0x74e8,0x753f,0x7540,0x753e,0x758c,0x7598,
-0x76af,0x76f3,0x76f1,0x76f0,0x76f5,0x77f8,0x77fc,0x77f9,
-0x77fb,0x77fa,0x77f7,0x7942,0x793f,0x79c5,0x7a78,0x7a7b,
-0x7afb,0x7c75,0x7cfd,0x8035,0x808f,0x80ae,0x80a3,0x80b8,
-0x80b5,0x80ad,0x8220,0x82a0,0x82c0,0x82ab,0x829a,0x8298,
-0x829b,0x82b5,0x82a7,0x82ae,0x82bc,0x829e,0x82ba,0x82b4,
-0x82a8,0x82a1,0x82a9,0x82c2,0x82a4,0x82c3,0x82b6,0x82a2,
-0x8670,0x866f,0x866d,0x866e,0x8c56,0x8fd2,0x8fcb,0x8fd3,
-0x8fcd,0x8fd6,0x8fd5,0x8fd7,0x90b2,0x90b4,0x90af,0x90b3,
-0x90b0,0x9639,0x963d,0x963c,0x963a,0x9643,0x4fcd,0x4fc5,
-0x4fd3,0x4fb2,0x4fc9,0x4fcb,0x4fc1,0x4fd4,0x4fdc,0x4fd9,
-0x4fbb,0x4fb3,0x4fdb,0x4fc7,0x4fd6,0x4fba,0x4fc0,0x4fb9,
-0x4fec,0x5244,0x5249,0x52c0,0x52c2,0x533d,0x537c,0x5397,
-0x5396,0x5399,0x5398,0x54ba,0x54a1,0x54ad,0x54a5,0x54cf,
-0x54c3,0x830d,0x54b7,0x54ae,0x54d6,0x54b6,0x54c5,0x54c6,
-0x54a0,0x5470,0x54bc,0x54a2,0x54be,0x5472,0x54de,0x54b0,
-0x57b5,0x579e,0x579f,0x57a4,0x578c,0x5797,0x579d,0x579b,
-0x5794,0x5798,0x578f,0x5799,0x57a5,0x579a,0x5795,0x58f4,
-0x590d,0x5953,0x59e1,0x59de,0x59ee,0x5a00,0x59f1,0x59dd,
-0x59fa,0x59fd,0x59fc,0x59f6,0x59e4,0x59f2,0x59f7,0x59db,
-0x59e9,0x59f3,0x59f5,0x59e0,0x59fe,0x59f4,0x59ed,0x5ba8,
-0x5c4c,0x5cd0,0x5cd8,0x5ccc,0x5cd7,0x5ccb,0x5cdb,0x5cde,
-0x5cda,0x5cc9,0x5cc7,0x5cca,0x5cd6,0x5cd3,0x5cd4,0x5ccf,
-0x5cc8,0x5cc6,0x5cce,0x5cdf,0x5cf8,0x5df9,0x5e21,0x5e22,
-0x5e23,0x5e20,0x5e24,0x5eb0,0x5ea4,0x5ea2,0x5e9b,0x5ea3,
-0x5ea5,0x5f07,0x5f2e,0x5f56,0x5f86,0x6037,0x6039,0x6054,
-0x6072,0x605e,0x6045,0x6053,0x6047,0x6049,0x605b,0x604c,
-0x6040,0x6042,0x605f,0x6024,0x6044,0x6058,0x6066,0x606e,
-0x6242,0x6243,0x62cf,0x630d,0x630b,0x62f5,0x630e,0x6303,
-0x62eb,0x62f9,0x630f,0x630c,0x62f8,0x62f6,0x6300,0x6313,
-0x6314,0x62fa,0x6315,0x62fb,0x62f0,0x6541,0x6543,0x65aa,
-0x65bf,0x6636,0x6621,0x6632,0x6635,0x661c,0x6626,0x6622,
-0x6633,0x662b,0x663a,0x661d,0x6634,0x6639,0x662e,0x670f,
-0x6710,0x67c1,0x67f2,0x67c8,0x67ba,0x67dc,0x67bb,0x67f8,
-0x67d8,0x67c0,0x67b7,0x67c5,0x67eb,0x67e4,0x67df,0x67b5,
-0x67cd,0x67b3,0x67f7,0x67f6,0x67ee,0x67e3,0x67c2,0x67b9,
-0x67ce,0x67e7,0x67f0,0x67b2,0x67fc,0x67c6,0x67ed,0x67cc,
-0x67ae,0x67e6,0x67db,0x67fa,0x67c9,0x67ca,0x67c3,0x67ea,
-0x67cb,0x6b28,0x6b82,0x6b84,0x6bb6,0x6bd6,0x6bd8,0x6be0,
-0x6c20,0x6c21,0x6d28,0x6d34,0x6d2d,0x6d1f,0x6d3c,0x6d3f,
-0x6d12,0x6d0a,0x6cda,0x6d33,0x6d04,0x6d19,0x6d3a,0x6d1a,
-0x6d11,0x6d00,0x6d1d,0x6d42,0x6d01,0x6d18,0x6d37,0x6d03,
-0x6d0f,0x6d40,0x6d07,0x6d20,0x6d2c,0x6d08,0x6d22,0x6d09,
-0x6d10,0x70b7,0x709f,0x70be,0x70b1,0x70b0,0x70a1,0x70b4,
-0x70b5,0x70a9,0x7241,0x7249,0x724a,0x726c,0x7270,0x7273,
-0x726e,0x72ca,0x72e4,0x72e8,0x72eb,0x72df,0x72ea,0x72e6,
-0x72e3,0x7385,0x73cc,0x73c2,0x73c8,0x73c5,0x73b9,0x73b6,
-0x73b5,0x73b4,0x73eb,0x73bf,0x73c7,0x73be,0x73c3,0x73c6,
-0x73b8,0x73cb,0x74ec,0x74ee,0x752e,0x7547,0x7548,0x75a7,
-0x75aa,0x7679,0x76c4,0x7708,0x7703,0x7704,0x7705,0x770a,
-0x76f7,0x76fb,0x76fa,0x77e7,0x77e8,0x7806,0x7811,0x7812,
-0x7805,0x7810,0x780f,0x780e,0x7809,0x7803,0x7813,0x794a,
-0x794c,0x794b,0x7945,0x7944,0x79d5,0x79cd,0x79cf,0x79d6,
-0x79ce,0x7a80,0x7a7e,0x7ad1,0x7b00,0x7b01,0x7c7a,0x7c78,
-0x7c79,0x7c7f,0x7c80,0x7c81,0x7d03,0x7d08,0x7d01,0x7f58,
-0x7f91,0x7f8d,0x7fbe,0x8007,0x800e,0x800f,0x8014,0x8037,
-0x80d8,0x80c7,0x80e0,0x80d1,0x80c8,0x80c2,0x80d0,0x80c5,
-0x80e3,0x80d9,0x80dc,0x80ca,0x80d5,0x80c9,0x80cf,0x80d7,
-0x80e6,0x80cd,0x81ff,0x8221,0x8294,0x82d9,0x82fe,0x82f9,
-0x8307,0x82e8,0x8300,0x82d5,0x833a,0x82eb,0x82d6,0x82f4,
-0x82ec,0x82e1,0x82f2,0x82f5,0x830c,0x82fb,0x82f6,0x82f0,
-0x82ea,0x82e4,0x82e0,0x82fa,0x82f3,0x82ed,0x8677,0x8674,
-0x867c,0x8673,0x8841,0x884e,0x8867,0x886a,0x8869,0x89d3,
-0x8a04,0x8a07,0x8d72,0x8fe3,0x8fe1,0x8fee,0x8fe0,0x90f1,
-0x90bd,0x90bf,0x90d5,0x90c5,0x90be,0x90c7,0x90cb,0x90c8,
-0x91d4,0x91d3,0x9654,0x964f,0x9651,0x9653,0x964a,0x964e,
-0x501e,0x5005,0x5007,0x5013,0x5022,0x5030,0x501b,0x4ff5,
-0x4ff4,0x5033,0x5037,0x502c,0x4ff6,0x4ff7,0x5017,0x501c,
-0x5020,0x5027,0x5035,0x502f,0x5031,0x500e,0x515a,0x5194,
-0x5193,0x51ca,0x51c4,0x51c5,0x51c8,0x51ce,0x5261,0x525a,
-0x5252,0x525e,0x525f,0x5255,0x5262,0x52cd,0x530e,0x539e,
-0x5526,0x54e2,0x5517,0x5512,0x54e7,0x54f3,0x54e4,0x551a,
-0x54ff,0x5504,0x5508,0x54eb,0x5511,0x5505,0x54f1,0x550a,
-0x54fb,0x54f7,0x54f8,0x54e0,0x550e,0x5503,0x550b,0x5701,
-0x5702,0x57cc,0x5832,0x57d5,0x57d2,0x57ba,0x57c6,0x57bd,
-0x57bc,0x57b8,0x57b6,0x57bf,0x57c7,0x57d0,0x57b9,0x57c1,
-0x590e,0x594a,0x5a19,0x5a16,0x5a2d,0x5a2e,0x5a15,0x5a0f,
-0x5a17,0x5a0a,0x5a1e,0x5a33,0x5b6c,0x5ba7,0x5bad,0x5bac,
-0x5c03,0x5c56,0x5c54,0x5cec,0x5cff,0x5cee,0x5cf1,0x5cf7,
-0x5d00,0x5cf9,0x5e29,0x5e28,0x5ea8,0x5eae,0x5eaa,0x5eac,
-0x5f33,0x5f30,0x5f67,0x605d,0x605a,0x6067,0x6041,0x60a2,
-0x6088,0x6080,0x6092,0x6081,0x609d,0x6083,0x6095,0x609b,
-0x6097,0x6087,0x609c,0x608e,0x6219,0x6246,0x62f2,0x6310,
-0x6356,0x632c,0x6344,0x6345,0x6336,0x6343,0x63e4,0x6339,
-0x634b,0x634a,0x633c,0x6329,0x6341,0x6334,0x6358,0x6354,
-0x6359,0x632d,0x6347,0x6333,0x635a,0x6351,0x6338,0x6357,
-0x6340,0x6348,0x654a,0x6546,0x65c6,0x65c3,0x65c4,0x65c2,
-0x664a,0x665f,0x6647,0x6651,0x6712,0x6713,0x681f,0x681a,
-0x6849,0x6832,0x6833,0x683b,0x684b,0x684f,0x6816,0x6831,
-0x681c,0x6835,0x682b,0x682d,0x682f,0x684e,0x6844,0x6834,
-0x681d,0x6812,0x6814,0x6826,0x6828,0x682e,0x684d,0x683a,
-0x6825,0x6820,0x6b2c,0x6b2f,0x6b2d,0x6b31,0x6b34,0x6b6d,
-0x8082,0x6b88,0x6be6,0x6be4,0x6be8,0x6be3,0x6be2,0x6be7,
-0x6c25,0x6d7a,0x6d63,0x6d64,0x6d76,0x6d0d,0x6d61,0x6d92,
-0x6d58,0x6d62,0x6d6d,0x6d6f,0x6d91,0x6d8d,0x6def,0x6d7f,
-0x6d86,0x6d5e,0x6d67,0x6d60,0x6d97,0x6d70,0x6d7c,0x6d5f,
-0x6d82,0x6d98,0x6d2f,0x6d68,0x6d8b,0x6d7e,0x6d80,0x6d84,
-0x6d16,0x6d83,0x6d7b,0x6d7d,0x6d75,0x6d90,0x70dc,0x70d3,
-0x70d1,0x70dd,0x70cb,0x7f39,0x70e2,0x70d7,0x70d2,0x70de,
-0x70e0,0x70d4,0x70cd,0x70c5,0x70c6,0x70c7,0x70da,0x70ce,
-0x70e1,0x7242,0x7278,0x7277,0x7276,0x7300,0x72fa,0x72f4,
-0x72fe,0x72f6,0x72f3,0x72fb,0x7301,0x73d3,0x73d9,0x73e5,
-0x73d6,0x73bc,0x73e7,0x73e3,0x73e9,0x73dc,0x73d2,0x73db,
-0x73d4,0x73dd,0x73da,0x73d7,0x73d8,0x73e8,0x74de,0x74df,
-0x74f4,0x74f5,0x7521,0x755b,0x755f,0x75b0,0x75c1,0x75bb,
-0x75c4,0x75c0,0x75bf,0x75b6,0x75ba,0x768a,0x76c9,0x771d,
-0x771b,0x7710,0x7713,0x7712,0x7723,0x7711,0x7715,0x7719,
-0x771a,0x7722,0x7727,0x7823,0x782c,0x7822,0x7835,0x782f,
-0x7828,0x782e,0x782b,0x7821,0x7829,0x7833,0x782a,0x7831,
-0x7954,0x795b,0x794f,0x795c,0x7953,0x7952,0x7951,0x79eb,
-0x79ec,0x79e0,0x79ee,0x79ed,0x79ea,0x79dc,0x79de,0x79dd,
-0x7a86,0x7a89,0x7a85,0x7a8b,0x7a8c,0x7a8a,0x7a87,0x7ad8,
-0x7b10,0x7b04,0x7b13,0x7b05,0x7b0f,0x7b08,0x7b0a,0x7b0e,
-0x7b09,0x7b12,0x7c84,0x7c91,0x7c8a,0x7c8c,0x7c88,0x7c8d,
-0x7c85,0x7d1e,0x7d1d,0x7d11,0x7d0e,0x7d18,0x7d16,0x7d13,
-0x7d1f,0x7d12,0x7d0f,0x7d0c,0x7f5c,0x7f61,0x7f5e,0x7f60,
-0x7f5d,0x7f5b,0x7f96,0x7f92,0x7fc3,0x7fc2,0x7fc0,0x8016,
-0x803e,0x8039,0x80fa,0x80f2,0x80f9,0x80f5,0x8101,0x80fb,
-0x8100,0x8201,0x822f,0x8225,0x8333,0x832d,0x8344,0x8319,
-0x8351,0x8325,0x8356,0x833f,0x8341,0x8326,0x831c,0x8322,
-0x8342,0x834e,0x831b,0x832a,0x8308,0x833c,0x834d,0x8316,
-0x8324,0x8320,0x8337,0x832f,0x8329,0x8347,0x8345,0x834c,
-0x8353,0x831e,0x832c,0x834b,0x8327,0x8348,0x8653,0x8652,
-0x86a2,0x86a8,0x8696,0x868d,0x8691,0x869e,0x8687,0x8697,
-0x8686,0x868b,0x869a,0x8685,0x86a5,0x8699,0x86a1,0x86a7,
-0x8695,0x8698,0x868e,0x869d,0x8690,0x8694,0x8843,0x8844,
-0x886d,0x8875,0x8876,0x8872,0x8880,0x8871,0x887f,0x886f,
-0x8883,0x887e,0x8874,0x887c,0x8a12,0x8c47,0x8c57,0x8c7b,
-0x8ca4,0x8ca3,0x8d76,0x8d78,0x8db5,0x8db7,0x8db6,0x8ed1,
-0x8ed3,0x8ffe,0x8ff5,0x9002,0x8fff,0x8ffb,0x9004,0x8ffc,
-0x8ff6,0x90d6,0x90e0,0x90d9,0x90da,0x90e3,0x90df,0x90e5,
-0x90d8,0x90db,0x90d7,0x90dc,0x90e4,0x9150,0x914e,0x914f,
-0x91d5,0x91e2,0x91da,0x965c,0x965f,0x96bc,0x98e3,0x9adf,
-0x9b2f,0x4e7f,0x5070,0x506a,0x5061,0x505e,0x5060,0x5053,
-0x504b,0x505d,0x5072,0x5048,0x504d,0x5041,0x505b,0x504a,
-0x5062,0x5015,0x5045,0x505f,0x5069,0x506b,0x5063,0x5064,
-0x5046,0x5040,0x506e,0x5073,0x5057,0x5051,0x51d0,0x526b,
-0x526d,0x526c,0x526e,0x52d6,0x52d3,0x532d,0x539c,0x5575,
-0x5576,0x553c,0x554d,0x5550,0x5534,0x552a,0x5551,0x5562,
-0x5536,0x5535,0x5530,0x5552,0x5545,0x550c,0x5532,0x5565,
-0x554e,0x5539,0x5548,0x552d,0x553b,0x5540,0x554b,0x570a,
-0x5707,0x57fb,0x5814,0x57e2,0x57f6,0x57dc,0x57f4,0x5800,
-0x57ed,0x57fd,0x5808,0x57f8,0x580b,0x57f3,0x57cf,0x5807,
-0x57ee,0x57e3,0x57f2,0x57e5,0x57ec,0x57e1,0x580e,0x57fc,
-0x5810,0x57e7,0x5801,0x580c,0x57f1,0x57e9,0x57f0,0x580d,
-0x5804,0x595c,0x5a60,0x5a58,0x5a55,0x5a67,0x5a5e,0x5a38,
-0x5a35,0x5a6d,0x5a50,0x5a5f,0x5a65,0x5a6c,0x5a53,0x5a64,
-0x5a57,0x5a43,0x5a5d,0x5a52,0x5a44,0x5a5b,0x5a48,0x5a8e,
-0x5a3e,0x5a4d,0x5a39,0x5a4c,0x5a70,0x5a69,0x5a47,0x5a51,
-0x5a56,0x5a42,0x5a5c,0x5b72,0x5b6e,0x5bc1,0x5bc0,0x5c59,
-0x5d1e,0x5d0b,0x5d1d,0x5d1a,0x5d20,0x5d0c,0x5d28,0x5d0d,
-0x5d26,0x5d25,0x5d0f,0x5d30,0x5d12,0x5d23,0x5d1f,0x5d2e,
-0x5e3e,0x5e34,0x5eb1,0x5eb4,0x5eb9,0x5eb2,0x5eb3,0x5f36,
-0x5f38,0x5f9b,0x5f96,0x5f9f,0x608a,0x6090,0x6086,0x60be,
-0x60b0,0x60ba,0x60d3,0x60d4,0x60cf,0x60e4,0x60d9,0x60dd,
-0x60c8,0x60b1,0x60db,0x60b7,0x60ca,0x60bf,0x60c3,0x60cd,
-0x60c0,0x6332,0x6365,0x638a,0x6382,0x637d,0x63bd,0x639e,
-0x63ad,0x639d,0x6397,0x63ab,0x638e,0x636f,0x6387,0x6390,
-0x636e,0x63af,0x6375,0x639c,0x636d,0x63ae,0x637c,0x63a4,
-0x633b,0x639f,0x6378,0x6385,0x6381,0x6391,0x638d,0x6370,
-0x6553,0x65cd,0x6665,0x6661,0x665b,0x6659,0x665c,0x6662,
-0x6718,0x6879,0x6887,0x6890,0x689c,0x686d,0x686e,0x68ae,
-0x68ab,0x6956,0x686f,0x68a3,0x68ac,0x68a9,0x6875,0x6874,
-0x68b2,0x688f,0x6877,0x6892,0x687c,0x686b,0x6872,0x68aa,
-0x6880,0x6871,0x687e,0x689b,0x6896,0x688b,0x68a0,0x6889,
-0x68a4,0x6878,0x687b,0x6891,0x688c,0x688a,0x687d,0x6b36,
-0x6b33,0x6b37,0x6b38,0x6b91,0x6b8f,0x6b8d,0x6b8e,0x6b8c,
-0x6c2a,0x6dc0,0x6dab,0x6db4,0x6db3,0x6e74,0x6dac,0x6de9,
-0x6de2,0x6db7,0x6df6,0x6dd4,0x6e00,0x6dc8,0x6de0,0x6ddf,
-0x6dd6,0x6dbe,0x6de5,0x6ddc,0x6ddd,0x6ddb,0x6df4,0x6dca,
-0x6dbd,0x6ded,0x6df0,0x6dba,0x6dd5,0x6dc2,0x6dcf,0x6dc9,
-0x6dd0,0x6df2,0x6dd3,0x6dfd,0x6dd7,0x6dcd,0x6de3,0x6dbb,
-0x70fa,0x710d,0x70f7,0x7117,0x70f4,0x710c,0x70f0,0x7104,
-0x70f3,0x7110,0x70fc,0x70ff,0x7106,0x7113,0x7100,0x70f8,
-0x70f6,0x710b,0x7102,0x710e,0x727e,0x727b,0x727c,0x727f,
-0x731d,0x7317,0x7307,0x7311,0x7318,0x730a,0x7308,0x72ff,
-0x730f,0x731e,0x7388,0x73f6,0x73f8,0x73f5,0x7404,0x7401,
-0x73fd,0x7407,0x7400,0x73fa,0x73fc,0x73ff,0x740c,0x740b,
-0x73f4,0x7408,0x7564,0x7563,0x75ce,0x75d2,0x75cf,0x75cb,
-0x75cc,0x75d1,0x75d0,0x768f,0x7689,0x76d3,0x7739,0x772f,
-0x772d,0x7731,0x7732,0x7734,0x7733,0x773d,0x7725,0x773b,
-0x7735,0x7848,0x7852,0x7849,0x784d,0x784a,0x784c,0x7826,
-0x7845,0x7850,0x7964,0x7967,0x7969,0x796a,0x7963,0x796b,
-0x7961,0x79bb,0x79fa,0x79f8,0x79f6,0x79f7,0x7a8f,0x7a94,
-0x7a90,0x7b35,0x7b3b,0x7b34,0x7b25,0x7b30,0x7b22,0x7b24,
-0x7b33,0x7b18,0x7b2a,0x7b1d,0x7b31,0x7b2b,0x7b2d,0x7b2f,
-0x7b32,0x7b38,0x7b1a,0x7b23,0x7c94,0x7c98,0x7c96,0x7ca3,
-0x7d35,0x7d3d,0x7d38,0x7d36,0x7d3a,0x7d45,0x7d2c,0x7d29,
-0x7d41,0x7d47,0x7d3e,0x7d3f,0x7d4a,0x7d3b,0x7d28,0x7f63,
-0x7f95,0x7f9c,0x7f9d,0x7f9b,0x7fca,0x7fcb,0x7fcd,0x7fd0,
-0x7fd1,0x7fc7,0x7fcf,0x7fc9,0x801f,0x801e,0x801b,0x8047,
-0x8043,0x8048,0x8118,0x8125,0x8119,0x811b,0x812d,0x811f,
-0x812c,0x811e,0x8121,0x8115,0x8127,0x811d,0x8122,0x8211,
-0x8238,0x8233,0x823a,0x8234,0x8232,0x8274,0x8390,0x83a3,
-0x83a8,0x838d,0x837a,0x8373,0x83a4,0x8374,0x838f,0x8381,
-0x8395,0x8399,0x8375,0x8394,0x83a9,0x837d,0x8383,0x838c,
-0x839d,0x839b,0x83aa,0x838b,0x837e,0x83a5,0x83af,0x8388,
-0x8397,0x83b0,0x837f,0x83a6,0x8387,0x83ae,0x8376,0x8659,
-0x8656,0x86bf,0x86b7,0x86c2,0x86c1,0x86c5,0x86ba,0x86b0,
-0x86c8,0x86b9,0x86b3,0x86b8,0x86cc,0x86b4,0x86bb,0x86bc,
-0x86c3,0x86bd,0x86be,0x8852,0x8889,0x8895,0x88a8,0x88a2,
-0x88aa,0x889a,0x8891,0x88a1,0x889f,0x8898,0x88a7,0x8899,
-0x889b,0x8897,0x88a4,0x88ac,0x888c,0x8893,0x888e,0x8982,
-0x89d6,0x89d9,0x89d5,0x8a30,0x8a27,0x8a2c,0x8a1e,0x8c39,
-0x8c3b,0x8c5c,0x8c5d,0x8c7d,0x8ca5,0x8d7d,0x8d7b,0x8d79,
-0x8dbc,0x8dc2,0x8db9,0x8dbf,0x8dc1,0x8ed8,0x8ede,0x8edd,
-0x8edc,0x8ed7,0x8ee0,0x8ee1,0x9024,0x900b,0x9011,0x901c,
-0x900c,0x9021,0x90ef,0x90ea,0x90f0,0x90f4,0x90f2,0x90f3,
-0x90d4,0x90eb,0x90ec,0x90e9,0x9156,0x9158,0x915a,0x9153,
-0x9155,0x91ec,0x91f4,0x91f1,0x91f3,0x91f8,0x91e4,0x91f9,
-0x91ea,0x91eb,0x91f7,0x91e8,0x91ee,0x957a,0x9586,0x9588,
-0x967c,0x966d,0x966b,0x9671,0x966f,0x96bf,0x976a,0x9804,
-0x98e5,0x9997,0x509b,0x5095,0x5094,0x509e,0x508b,0x50a3,
-0x5083,0x508c,0x508e,0x509d,0x5068,0x509c,0x5092,0x5082,
-0x5087,0x515f,0x51d4,0x5312,0x5311,0x53a4,0x53a7,0x5591,
-0x55a8,0x55a5,0x55ad,0x5577,0x5645,0x55a2,0x5593,0x5588,
-0x558f,0x55b5,0x5581,0x55a3,0x5592,0x55a4,0x557d,0x558c,
-0x55a6,0x557f,0x5595,0x55a1,0x558e,0x570c,0x5829,0x5837,
-0x5819,0x581e,0x5827,0x5823,0x5828,0x57f5,0x5848,0x5825,
-0x581c,0x581b,0x5833,0x583f,0x5836,0x582e,0x5839,0x5838,
-0x582d,0x582c,0x583b,0x5961,0x5aaf,0x5a94,0x5a9f,0x5a7a,
-0x5aa2,0x5a9e,0x5a78,0x5aa6,0x5a7c,0x5aa5,0x5aac,0x5a95,
-0x5aae,0x5a37,0x5a84,0x5a8a,0x5a97,0x5a83,0x5a8b,0x5aa9,
-0x5a7b,0x5a7d,0x5a8c,0x5a9c,0x5a8f,0x5a93,0x5a9d,0x5bea,
-0x5bcd,0x5bcb,0x5bd4,0x5bd1,0x5bca,0x5bce,0x5c0c,0x5c30,
-0x5d37,0x5d43,0x5d6b,0x5d41,0x5d4b,0x5d3f,0x5d35,0x5d51,
-0x5d4e,0x5d55,0x5d33,0x5d3a,0x5d52,0x5d3d,0x5d31,0x5d59,
-0x5d42,0x5d39,0x5d49,0x5d38,0x5d3c,0x5d32,0x5d36,0x5d40,
-0x5d45,0x5e44,0x5e41,0x5f58,0x5fa6,0x5fa5,0x5fab,0x60c9,
-0x60b9,0x60cc,0x60e2,0x60ce,0x60c4,0x6114,0x60f2,0x610a,
-0x6116,0x6105,0x60f5,0x6113,0x60f8,0x60fc,0x60fe,0x60c1,
-0x6103,0x6118,0x611d,0x6110,0x60ff,0x6104,0x610b,0x624a,
-0x6394,0x63b1,0x63b0,0x63ce,0x63e5,0x63e8,0x63ef,0x63c3,
-0x649d,0x63f3,0x63ca,0x63e0,0x63f6,0x63d5,0x63f2,0x63f5,
-0x6461,0x63df,0x63be,0x63dd,0x63dc,0x63c4,0x63d8,0x63d3,
-0x63c2,0x63c7,0x63cc,0x63cb,0x63c8,0x63f0,0x63d7,0x63d9,
-0x6532,0x6567,0x656a,0x6564,0x655c,0x6568,0x6565,0x658c,
-0x659d,0x659e,0x65ae,0x65d0,0x65d2,0x667c,0x666c,0x667b,
-0x6680,0x6671,0x6679,0x666a,0x6672,0x6701,0x690c,0x68d3,
-0x6904,0x68dc,0x692a,0x68ec,0x68ea,0x68f1,0x690f,0x68d6,
-0x68f7,0x68eb,0x68e4,0x68f6,0x6913,0x6910,0x68f3,0x68e1,
-0x6907,0x68cc,0x6908,0x6970,0x68b4,0x6911,0x68ef,0x68c6,
-0x6914,0x68f8,0x68d0,0x68fd,0x68fc,0x68e8,0x690b,0x690a,
-0x6917,0x68ce,0x68c8,0x68dd,0x68de,0x68e6,0x68f4,0x68d1,
-0x6906,0x68d4,0x68e9,0x6915,0x6925,0x68c7,0x6b39,0x6b3b,
-0x6b3f,0x6b3c,0x6b94,0x6b97,0x6b99,0x6b95,0x6bbd,0x6bf0,
-0x6bf2,0x6bf3,0x6c30,0x6dfc,0x6e46,0x6e47,0x6e1f,0x6e49,
-0x6e88,0x6e3c,0x6e3d,0x6e45,0x6e62,0x6e2b,0x6e3f,0x6e41,
-0x6e5d,0x6e73,0x6e1c,0x6e33,0x6e4b,0x6e40,0x6e51,0x6e3b,
-0x6e03,0x6e2e,0x6e5e,0x6e68,0x6e5c,0x6e61,0x6e31,0x6e28,
-0x6e60,0x6e71,0x6e6b,0x6e39,0x6e22,0x6e30,0x6e53,0x6e65,
-0x6e27,0x6e78,0x6e64,0x6e77,0x6e55,0x6e79,0x6e52,0x6e66,
-0x6e35,0x6e36,0x6e5a,0x7120,0x711e,0x712f,0x70fb,0x712e,
-0x7131,0x7123,0x7125,0x7122,0x7132,0x711f,0x7128,0x713a,
-0x711b,0x724b,0x725a,0x7288,0x7289,0x7286,0x7285,0x728b,
-0x7312,0x730b,0x7330,0x7322,0x7331,0x7333,0x7327,0x7332,
-0x732d,0x7326,0x7323,0x7335,0x730c,0x742e,0x742c,0x7430,
-0x742b,0x7416,0x741a,0x7421,0x742d,0x7431,0x7424,0x7423,
-0x741d,0x7429,0x7420,0x7432,0x74fb,0x752f,0x756f,0x756c,
-0x75e7,0x75da,0x75e1,0x75e6,0x75dd,0x75df,0x75e4,0x75d7,
-0x7695,0x7692,0x76da,0x7746,0x7747,0x7744,0x774d,0x7745,
-0x774a,0x774e,0x774b,0x774c,0x77de,0x77ec,0x7860,0x7864,
-0x7865,0x785c,0x786d,0x7871,0x786a,0x786e,0x7870,0x7869,
-0x7868,0x785e,0x7862,0x7974,0x7973,0x7972,0x7970,0x7a02,
-0x7a0a,0x7a03,0x7a0c,0x7a04,0x7a99,0x7ae6,0x7ae4,0x7b4a,
-0x7b47,0x7b44,0x7b48,0x7b4c,0x7b4e,0x7b40,0x7b58,0x7b45,
-0x7ca2,0x7c9e,0x7ca8,0x7ca1,0x7d58,0x7d6f,0x7d63,0x7d53,
-0x7d56,0x7d67,0x7d6a,0x7d4f,0x7d6d,0x7d5c,0x7d6b,0x7d52,
-0x7d54,0x7d69,0x7d51,0x7d5f,0x7d4e,0x7f3e,0x7f3f,0x7f65,
-0x7f66,0x7fa2,0x7fa0,0x7fa1,0x7fd7,0x8051,0x804f,0x8050,
-0x80fe,0x80d4,0x8143,0x814a,0x8152,0x814f,0x8147,0x813d,
-0x814d,0x813a,0x81e6,0x81ee,0x81f7,0x81f8,0x81f9,0x8204,
-0x823c,0x823d,0x823f,0x8275,0x833b,0x83cf,0x83f9,0x8423,
-0x83c0,0x83e8,0x8412,0x83e7,0x83e4,0x83fc,0x83f6,0x8410,
-0x83c6,0x83c8,0x83eb,0x83e3,0x83bf,0x8401,0x83dd,0x83e5,
-0x83d8,0x83ff,0x83e1,0x83cb,0x83ce,0x83d6,0x83f5,0x83c9,
-0x8409,0x840f,0x83de,0x8411,0x8406,0x83c2,0x83f3,0x83d5,
-0x83fa,0x83c7,0x83d1,0x83ea,0x8413,0x839a,0x83c3,0x83ec,
-0x83ee,0x83c4,0x83fb,0x83d7,0x83e2,0x841b,0x83db,0x83fe,
-0x86d8,0x86e2,0x86e6,0x86d3,0x86e3,0x86da,0x86ea,0x86dd,
-0x86eb,0x86dc,0x86ec,0x86e9,0x86d7,0x86e8,0x86d1,0x8848,
-0x8856,0x8855,0x88ba,0x88d7,0x88b9,0x88b8,0x88c0,0x88be,
-0x88b6,0x88bc,0x88b7,0x88bd,0x88b2,0x8901,0x88c9,0x8995,
-0x8998,0x8997,0x89dd,0x89da,0x89db,0x8a4e,0x8a4d,0x8a39,
-0x8a59,0x8a40,0x8a57,0x8a58,0x8a44,0x8a45,0x8a52,0x8a48,
-0x8a51,0x8a4a,0x8a4c,0x8a4f,0x8c5f,0x8c81,0x8c80,0x8cba,
-0x8cbe,0x8cb0,0x8cb9,0x8cb5,0x8d84,0x8d80,0x8d89,0x8dd8,
-0x8dd3,0x8dcd,0x8dc7,0x8dd6,0x8ddc,0x8dcf,0x8dd5,0x8dd9,
-0x8dc8,0x8dd7,0x8dc5,0x8eef,0x8ef7,0x8efa,0x8ef9,0x8ee6,
-0x8eee,0x8ee5,0x8ef5,0x8ee7,0x8ee8,0x8ef6,0x8eeb,0x8ef1,
-0x8eec,0x8ef4,0x8ee9,0x902d,0x9034,0x902f,0x9106,0x912c,
-0x9104,0x90ff,0x90fc,0x9108,0x90f9,0x90fb,0x9101,0x9100,
-0x9107,0x9105,0x9103,0x9161,0x9164,0x915f,0x9162,0x9160,
-0x9201,0x920a,0x9225,0x9203,0x921a,0x9226,0x920f,0x920c,
-0x9200,0x9212,0x91ff,0x91fd,0x9206,0x9204,0x9227,0x9202,
-0x921c,0x9224,0x9219,0x9217,0x9205,0x9216,0x957b,0x958d,
-0x958c,0x9590,0x9687,0x967e,0x9688,0x9689,0x9683,0x9680,
-0x96c2,0x96c8,0x96c3,0x96f1,0x96f0,0x976c,0x9770,0x976e,
-0x9807,0x98a9,0x98eb,0x9ce6,0x9ef9,0x4e83,0x4e84,0x4eb6,
-0x50bd,0x50bf,0x50c6,0x50ae,0x50c4,0x50ca,0x50b4,0x50c8,
-0x50c2,0x50b0,0x50c1,0x50ba,0x50b1,0x50cb,0x50c9,0x50b6,
-0x50b8,0x51d7,0x527a,0x5278,0x527b,0x527c,0x55c3,0x55db,
-0x55cc,0x55d0,0x55cb,0x55ca,0x55dd,0x55c0,0x55d4,0x55c4,
-0x55e9,0x55bf,0x55d2,0x558d,0x55cf,0x55d5,0x55e2,0x55d6,
-0x55c8,0x55f2,0x55cd,0x55d9,0x55c2,0x5714,0x5853,0x5868,
-0x5864,0x584f,0x584d,0x5849,0x586f,0x5855,0x584e,0x585d,
-0x5859,0x5865,0x585b,0x583d,0x5863,0x5871,0x58fc,0x5ac7,
-0x5ac4,0x5acb,0x5aba,0x5ab8,0x5ab1,0x5ab5,0x5ab0,0x5abf,
-0x5ac8,0x5abb,0x5ac6,0x5ab7,0x5ac0,0x5aca,0x5ab4,0x5ab6,
-0x5acd,0x5ab9,0x5a90,0x5bd6,0x5bd8,0x5bd9,0x5c1f,0x5c33,
-0x5d71,0x5d63,0x5d4a,0x5d65,0x5d72,0x5d6c,0x5d5e,0x5d68,
-0x5d67,0x5d62,0x5df0,0x5e4f,0x5e4e,0x5e4a,0x5e4d,0x5e4b,
-0x5ec5,0x5ecc,0x5ec6,0x5ecb,0x5ec7,0x5f40,0x5faf,0x5fad,
-0x60f7,0x6149,0x614a,0x612b,0x6145,0x6136,0x6132,0x612e,
-0x6146,0x612f,0x614f,0x6129,0x6140,0x6220,0x9168,0x6223,
-0x6225,0x6224,0x63c5,0x63f1,0x63eb,0x6410,0x6412,0x6409,
-0x6420,0x6424,0x6433,0x6443,0x641f,0x6415,0x6418,0x6439,
-0x6437,0x6422,0x6423,0x640c,0x6426,0x6430,0x6428,0x6441,
-0x6435,0x642f,0x640a,0x641a,0x6440,0x6425,0x6427,0x640b,
-0x63e7,0x641b,0x642e,0x6421,0x640e,0x656f,0x6592,0x65d3,
-0x6686,0x668c,0x6695,0x6690,0x668b,0x668a,0x6699,0x6694,
-0x6678,0x6720,0x6966,0x695f,0x6938,0x694e,0x6962,0x6971,
-0x693f,0x6945,0x696a,0x6939,0x6942,0x6957,0x6959,0x697a,
-0x6948,0x6949,0x6935,0x696c,0x6933,0x693d,0x6965,0x68f0,
-0x6978,0x6934,0x6969,0x6940,0x696f,0x6944,0x6976,0x6958,
-0x6941,0x6974,0x694c,0x693b,0x694b,0x6937,0x695c,0x694f,
-0x6951,0x6932,0x6952,0x692f,0x697b,0x693c,0x6b46,0x6b45,
-0x6b43,0x6b42,0x6b48,0x6b41,0x6b9b,0x6bfb,0x6bfc,0x6bf9,
-0x6bf7,0x6bf8,0x6e9b,0x6ed6,0x6ec8,0x6e8f,0x6ec0,0x6e9f,
-0x6e93,0x6e94,0x6ea0,0x6eb1,0x6eb9,0x6ec6,0x6ed2,0x6ebd,
-0x6ec1,0x6e9e,0x6ec9,0x6eb7,0x6eb0,0x6ecd,0x6ea6,0x6ecf,
-0x6eb2,0x6ebe,0x6ec3,0x6edc,0x6ed8,0x6e99,0x6e92,0x6e8e,
-0x6e8d,0x6ea4,0x6ea1,0x6ebf,0x6eb3,0x6ed0,0x6eca,0x6e97,
-0x6eae,0x6ea3,0x7147,0x7154,0x7152,0x7163,0x7160,0x7141,
-0x715d,0x7162,0x7172,0x7178,0x716a,0x7161,0x7142,0x7158,
-0x7143,0x714b,0x7170,0x715f,0x7150,0x7153,0x7144,0x714d,
-0x715a,0x724f,0x728d,0x728c,0x7291,0x7290,0x728e,0x733c,
-0x7342,0x733b,0x733a,0x7340,0x734a,0x7349,0x7444,0x744a,
-0x744b,0x7452,0x7451,0x7457,0x7440,0x744f,0x7450,0x744e,
-0x7442,0x7446,0x744d,0x7454,0x74e1,0x74ff,0x74fe,0x74fd,
-0x751d,0x7579,0x7577,0x6983,0x75ef,0x760f,0x7603,0x75f7,
-0x75fe,0x75fc,0x75f9,0x75f8,0x7610,0x75fb,0x75f6,0x75ed,
-0x75f5,0x75fd,0x7699,0x76b5,0x76dd,0x7755,0x775f,0x7760,
-0x7752,0x7756,0x775a,0x7769,0x7767,0x7754,0x7759,0x776d,
-0x77e0,0x7887,0x789a,0x7894,0x788f,0x7884,0x7895,0x7885,
-0x7886,0x78a1,0x7883,0x7879,0x7899,0x7880,0x7896,0x787b,
-0x797c,0x7982,0x797d,0x7979,0x7a11,0x7a18,0x7a19,0x7a12,
-0x7a17,0x7a15,0x7a22,0x7a13,0x7a1b,0x7a10,0x7aa3,0x7aa2,
-0x7a9e,0x7aeb,0x7b66,0x7b64,0x7b6d,0x7b74,0x7b69,0x7b72,
-0x7b65,0x7b73,0x7b71,0x7b70,0x7b61,0x7b78,0x7b76,0x7b63,
-0x7cb2,0x7cb4,0x7caf,0x7d88,0x7d86,0x7d80,0x7d8d,0x7d7f,
-0x7d85,0x7d7a,0x7d8e,0x7d7b,0x7d83,0x7d7c,0x7d8c,0x7d94,
-0x7d84,0x7d7d,0x7d92,0x7f6d,0x7f6b,0x7f67,0x7f68,0x7f6c,
-0x7fa6,0x7fa5,0x7fa7,0x7fdb,0x7fdc,0x8021,0x8164,0x8160,
-0x8177,0x815c,0x8169,0x815b,0x8162,0x8172,0x6721,0x815e,
-0x8176,0x8167,0x816f,0x8144,0x8161,0x821d,0x8249,0x8244,
-0x8240,0x8242,0x8245,0x84f1,0x843f,0x8456,0x8476,0x8479,
-0x848f,0x848d,0x8465,0x8451,0x8440,0x8486,0x8467,0x8430,
-0x844d,0x847d,0x845a,0x8459,0x8474,0x8473,0x845d,0x8507,
-0x845e,0x8437,0x843a,0x8434,0x847a,0x8443,0x8478,0x8432,
-0x8445,0x8429,0x83d9,0x844b,0x842f,0x8442,0x842d,0x845f,
-0x8470,0x8439,0x844e,0x844c,0x8452,0x846f,0x84c5,0x848e,
-0x843b,0x8447,0x8436,0x8433,0x8468,0x847e,0x8444,0x842b,
-0x8460,0x8454,0x846e,0x8450,0x870b,0x8704,0x86f7,0x870c,
-0x86fa,0x86d6,0x86f5,0x874d,0x86f8,0x870e,0x8709,0x8701,
-0x86f6,0x870d,0x8705,0x88d6,0x88cb,0x88cd,0x88ce,0x88de,
-0x88db,0x88da,0x88cc,0x88d0,0x8985,0x899b,0x89df,0x89e5,
-0x89e4,0x89e1,0x89e0,0x89e2,0x89dc,0x89e6,0x8a76,0x8a86,
-0x8a7f,0x8a61,0x8a3f,0x8a77,0x8a82,0x8a84,0x8a75,0x8a83,
-0x8a81,0x8a74,0x8a7a,0x8c3c,0x8c4b,0x8c4a,0x8c65,0x8c64,
-0x8c66,0x8c86,0x8c84,0x8c85,0x8ccc,0x8d68,0x8d69,0x8d91,
-0x8d8c,0x8d8e,0x8d8f,0x8d8d,0x8d93,0x8d94,0x8d90,0x8d92,
-0x8df0,0x8de0,0x8dec,0x8df1,0x8dee,0x8dd0,0x8de9,0x8de3,
-0x8de2,0x8de7,0x8df2,0x8deb,0x8df4,0x8f06,0x8eff,0x8f01,
-0x8f00,0x8f05,0x8f07,0x8f08,0x8f02,0x8f0b,0x9052,0x903f,
-0x9044,0x9049,0x903d,0x9110,0x910d,0x910f,0x9111,0x9116,
-0x9114,0x910b,0x910e,0x916e,0x916f,0x9248,0x9252,0x9230,
-0x923a,0x9266,0x9233,0x9265,0x925e,0x9283,0x922e,0x924a,
-0x9246,0x926d,0x926c,0x924f,0x9260,0x9267,0x926f,0x9236,
-0x9261,0x9270,0x9231,0x9254,0x9263,0x9250,0x9272,0x924e,
-0x9253,0x924c,0x9256,0x9232,0x959f,0x959c,0x959e,0x959b,
-0x9692,0x9693,0x9691,0x9697,0x96ce,0x96fa,0x96fd,0x96f8,
-0x96f5,0x9773,0x9777,0x9778,0x9772,0x980f,0x980d,0x980e,
-0x98ac,0x98f6,0x98f9,0x99af,0x99b2,0x99b0,0x99b5,0x9aad,
-0x9aab,0x9b5b,0x9cea,0x9ced,0x9ce7,0x9e80,0x9efd,0x50e6,
-0x50d4,0x50d7,0x50e8,0x50f3,0x50db,0x50ea,0x50dd,0x50e4,
-0x50d3,0x50ec,0x50f0,0x50ef,0x50e3,0x50e0,0x51d8,0x5280,
-0x5281,0x52e9,0x52eb,0x5330,0x53ac,0x5627,0x5615,0x560c,
-0x5612,0x55fc,0x560f,0x561c,0x5601,0x5613,0x5602,0x55fa,
-0x561d,0x5604,0x55ff,0x55f9,0x5889,0x587c,0x5890,0x5898,
-0x5886,0x5881,0x587f,0x5874,0x588b,0x587a,0x5887,0x5891,
-0x588e,0x5876,0x5882,0x5888,0x587b,0x5894,0x588f,0x58fe,
-0x596b,0x5adc,0x5aee,0x5ae5,0x5ad5,0x5aea,0x5ada,0x5aed,
-0x5aeb,0x5af3,0x5ae2,0x5ae0,0x5adb,0x5aec,0x5ade,0x5add,
-0x5ad9,0x5ae8,0x5adf,0x5b77,0x5be0,0x5be3,0x5c63,0x5d82,
-0x5d80,0x5d7d,0x5d86,0x5d7a,0x5d81,0x5d77,0x5d8a,0x5d89,
-0x5d88,0x5d7e,0x5d7c,0x5d8d,0x5d79,0x5d7f,0x5e58,0x5e59,
-0x5e53,0x5ed8,0x5ed1,0x5ed7,0x5ece,0x5edc,0x5ed5,0x5ed9,
-0x5ed2,0x5ed4,0x5f44,0x5f43,0x5f6f,0x5fb6,0x612c,0x6128,
-0x6141,0x615e,0x6171,0x6173,0x6152,0x6153,0x6172,0x616c,
-0x6180,0x6174,0x6154,0x617a,0x615b,0x6165,0x613b,0x616a,
-0x6161,0x6156,0x6229,0x6227,0x622b,0x642b,0x644d,0x645b,
-0x645d,0x6474,0x6476,0x6472,0x6473,0x647d,0x6475,0x6466,
-0x64a6,0x644e,0x6482,0x645e,0x645c,0x644b,0x6453,0x6460,
-0x6450,0x647f,0x643f,0x646c,0x646b,0x6459,0x6465,0x6477,
-0x6573,0x65a0,0x66a1,0x66a0,0x669f,0x6705,0x6704,0x6722,
-0x69b1,0x69b6,0x69c9,0x69a0,0x69ce,0x6996,0x69b0,0x69ac,
-0x69bc,0x6991,0x6999,0x698e,0x69a7,0x698d,0x69a9,0x69be,
-0x69af,0x69bf,0x69c4,0x69bd,0x69a4,0x69d4,0x69b9,0x69ca,
-0x699a,0x69cf,0x69b3,0x6993,0x69aa,0x69a1,0x699e,0x69d9,
-0x6997,0x6990,0x69c2,0x69b5,0x69a5,0x69c6,0x6b4a,0x6b4d,
-0x6b4b,0x6b9e,0x6b9f,0x6ba0,0x6bc3,0x6bc4,0x6bfe,0x6ece,
-0x6ef5,0x6ef1,0x6f03,0x6f25,0x6ef8,0x6f37,0x6efb,0x6f2e,
-0x6f09,0x6f4e,0x6f19,0x6f1a,0x6f27,0x6f18,0x6f3b,0x6f12,
-0x6eed,0x6f0a,0x6f36,0x6f73,0x6ef9,0x6eee,0x6f2d,0x6f40,
-0x6f30,0x6f3c,0x6f35,0x6eeb,0x6f07,0x6f0e,0x6f43,0x6f05,
-0x6efd,0x6ef6,0x6f39,0x6f1c,0x6efc,0x6f3a,0x6f1f,0x6f0d,
-0x6f1e,0x6f08,0x6f21,0x7187,0x7190,0x7189,0x7180,0x7185,
-0x7182,0x718f,0x717b,0x7186,0x7181,0x7197,0x7244,0x7253,
-0x7297,0x7295,0x7293,0x7343,0x734d,0x7351,0x734c,0x7462,
-0x7473,0x7471,0x7475,0x7472,0x7467,0x746e,0x7500,0x7502,
-0x7503,0x757d,0x7590,0x7616,0x7608,0x760c,0x7615,0x7611,
-0x760a,0x7614,0x76b8,0x7781,0x777c,0x7785,0x7782,0x776e,
-0x7780,0x776f,0x777e,0x7783,0x78b2,0x78aa,0x78b4,0x78ad,
-0x78a8,0x787e,0x78ab,0x789e,0x78a5,0x78a0,0x78ac,0x78a2,
-0x78a4,0x7998,0x798a,0x798b,0x7996,0x7995,0x7994,0x7993,
-0x7997,0x7988,0x7992,0x7990,0x7a2b,0x7a4a,0x7a30,0x7a2f,
-0x7a28,0x7a26,0x7aa8,0x7aab,0x7aac,0x7aee,0x7b88,0x7b9c,
-0x7b8a,0x7b91,0x7b90,0x7b96,0x7b8d,0x7b8c,0x7b9b,0x7b8e,
-0x7b85,0x7b98,0x5284,0x7b99,0x7ba4,0x7b82,0x7cbb,0x7cbf,
-0x7cbc,0x7cba,0x7da7,0x7db7,0x7dc2,0x7da3,0x7daa,0x7dc1,
-0x7dc0,0x7dc5,0x7d9d,0x7dce,0x7dc4,0x7dc6,0x7dcb,0x7dcc,
-0x7daf,0x7db9,0x7d96,0x7dbc,0x7d9f,0x7da6,0x7dae,0x7da9,
-0x7da1,0x7dc9,0x7f73,0x7fe2,0x7fe3,0x7fe5,0x7fde,0x8024,
-0x805d,0x805c,0x8189,0x8186,0x8183,0x8187,0x818d,0x818c,
-0x818b,0x8215,0x8497,0x84a4,0x84a1,0x849f,0x84ba,0x84ce,
-0x84c2,0x84ac,0x84ae,0x84ab,0x84b9,0x84b4,0x84c1,0x84cd,
-0x84aa,0x849a,0x84b1,0x84d0,0x849d,0x84a7,0x84bb,0x84a2,
-0x8494,0x84c7,0x84cc,0x849b,0x84a9,0x84af,0x84a8,0x84d6,
-0x8498,0x84b6,0x84cf,0x84a0,0x84d7,0x84d4,0x84d2,0x84db,
-0x84b0,0x8491,0x8661,0x8733,0x8723,0x8728,0x876b,0x8740,
-0x872e,0x871e,0x8721,0x8719,0x871b,0x8743,0x872c,0x8741,
-0x873e,0x8746,0x8720,0x8732,0x872a,0x872d,0x873c,0x8712,
-0x873a,0x8731,0x8735,0x8742,0x8726,0x8727,0x8738,0x8724,
-0x871a,0x8730,0x8711,0x88f7,0x88e7,0x88f1,0x88f2,0x88fa,
-0x88fe,0x88ee,0x88fc,0x88f6,0x88fb,0x88f0,0x88ec,0x88eb,
-0x899d,0x89a1,0x899f,0x899e,0x89e9,0x89eb,0x89e8,0x8aab,
-0x8a99,0x8a8b,0x8a92,0x8a8f,0x8a96,0x8c3d,0x8c68,0x8c69,
-0x8cd5,0x8ccf,0x8cd7,0x8d96,0x8e09,0x8e02,0x8dff,0x8e0d,
-0x8dfd,0x8e0a,0x8e03,0x8e07,0x8e06,0x8e05,0x8dfe,0x8e00,
-0x8e04,0x8f10,0x8f11,0x8f0e,0x8f0d,0x9123,0x911c,0x9120,
-0x9122,0x911f,0x911d,0x911a,0x9124,0x9121,0x911b,0x917a,
-0x9172,0x9179,0x9173,0x92a5,0x92a4,0x9276,0x929b,0x927a,
-0x92a0,0x9294,0x92aa,0x928d,0x92a6,0x929a,0x92ab,0x9279,
-0x9297,0x927f,0x92a3,0x92ee,0x928e,0x9282,0x9295,0x92a2,
-0x927d,0x9288,0x92a1,0x928a,0x9286,0x928c,0x9299,0x92a7,
-0x927e,0x9287,0x92a9,0x929d,0x928b,0x922d,0x969e,0x96a1,
-0x96ff,0x9758,0x977d,0x977a,0x977e,0x9783,0x9780,0x9782,
-0x977b,0x9784,0x9781,0x977f,0x97ce,0x97cd,0x9816,0x98ad,
-0x98ae,0x9902,0x9900,0x9907,0x999d,0x999c,0x99c3,0x99b9,
-0x99bb,0x99ba,0x99c2,0x99bd,0x99c7,0x9ab1,0x9ae3,0x9ae7,
-0x9b3e,0x9b3f,0x9b60,0x9b61,0x9b5f,0x9cf1,0x9cf2,0x9cf5,
-0x9ea7,0x50ff,0x5103,0x5130,0x50f8,0x5106,0x5107,0x50f6,
-0x50fe,0x510b,0x510c,0x50fd,0x510a,0x528b,0x528c,0x52f1,
-0x52ef,0x5648,0x5642,0x564c,0x5635,0x5641,0x564a,0x5649,
-0x5646,0x5658,0x565a,0x5640,0x5633,0x563d,0x562c,0x563e,
-0x5638,0x562a,0x563a,0x571a,0x58ab,0x589d,0x58b1,0x58a0,
-0x58a3,0x58af,0x58ac,0x58a5,0x58a1,0x58ff,0x5aff,0x5af4,
-0x5afd,0x5af7,0x5af6,0x5b03,0x5af8,0x5b02,0x5af9,0x5b01,
-0x5b07,0x5b05,0x5b0f,0x5c67,0x5d99,0x5d97,0x5d9f,0x5d92,
-0x5da2,0x5d93,0x5d95,0x5da0,0x5d9c,0x5da1,0x5d9a,0x5d9e,
-0x5e69,0x5e5d,0x5e60,0x5e5c,0x7df3,0x5edb,0x5ede,0x5ee1,
-0x5f49,0x5fb2,0x618b,0x6183,0x6179,0x61b1,0x61b0,0x61a2,
-0x6189,0x619b,0x6193,0x61af,0x61ad,0x619f,0x6192,0x61aa,
-0x61a1,0x618d,0x6166,0x61b3,0x622d,0x646e,0x6470,0x6496,
-0x64a0,0x6485,0x6497,0x649c,0x648f,0x648b,0x648a,0x648c,
-0x64a3,0x649f,0x6468,0x64b1,0x6498,0x6576,0x657a,0x6579,
-0x657b,0x65b2,0x65b3,0x66b5,0x66b0,0x66a9,0x66b2,0x66b7,
-0x66aa,0x66af,0x6a00,0x6a06,0x6a17,0x69e5,0x69f8,0x6a15,
-0x69f1,0x69e4,0x6a20,0x69ff,0x69ec,0x69e2,0x6a1b,0x6a1d,
-0x69fe,0x6a27,0x69f2,0x69ee,0x6a14,0x69f7,0x69e7,0x6a40,
-0x6a08,0x69e6,0x69fb,0x6a0d,0x69fc,0x69eb,0x6a09,0x6a04,
-0x6a18,0x6a25,0x6a0f,0x69f6,0x6a26,0x6a07,0x69f4,0x6a16,
-0x6b51,0x6ba5,0x6ba3,0x6ba2,0x6ba6,0x6c01,0x6c00,0x6bff,
-0x6c02,0x6f41,0x6f26,0x6f7e,0x6f87,0x6fc6,0x6f92,0x6f8d,
-0x6f89,0x6f8c,0x6f62,0x6f4f,0x6f85,0x6f5a,0x6f96,0x6f76,
-0x6f6c,0x6f82,0x6f55,0x6f72,0x6f52,0x6f50,0x6f57,0x6f94,
-0x6f93,0x6f5d,0x6f00,0x6f61,0x6f6b,0x6f7d,0x6f67,0x6f90,
-0x6f53,0x6f8b,0x6f69,0x6f7f,0x6f95,0x6f63,0x6f77,0x6f6a,
-0x6f7b,0x71b2,0x71af,0x719b,0x71b0,0x71a0,0x719a,0x71a9,
-0x71b5,0x719d,0x71a5,0x719e,0x71a4,0x71a1,0x71aa,0x719c,
-0x71a7,0x71b3,0x7298,0x729a,0x7358,0x7352,0x735e,0x735f,
-0x7360,0x735d,0x735b,0x7361,0x735a,0x7359,0x7362,0x7487,
-0x7489,0x748a,0x7486,0x7481,0x747d,0x7485,0x7488,0x747c,
-0x7479,0x7508,0x7507,0x757e,0x7625,0x761e,0x7619,0x761d,
-0x761c,0x7623,0x761a,0x7628,0x761b,0x769c,0x769d,0x769e,
-0x769b,0x778d,0x778f,0x7789,0x7788,0x78cd,0x78bb,0x78cf,
-0x78cc,0x78d1,0x78ce,0x78d4,0x78c8,0x78c3,0x78c4,0x78c9,
-0x799a,0x79a1,0x79a0,0x799c,0x79a2,0x799b,0x6b76,0x7a39,
-0x7ab2,0x7ab4,0x7ab3,0x7bb7,0x7bcb,0x7bbe,0x7bac,0x7bce,
-0x7baf,0x7bb9,0x7bca,0x7bb5,0x7cc5,0x7cc8,0x7ccc,0x7ccb,
-0x7df7,0x7ddb,0x7dea,0x7de7,0x7dd7,0x7de1,0x7e03,0x7dfa,
-0x7de6,0x7df6,0x7df1,0x7df0,0x7dee,0x7ddf,0x7f76,0x7fac,
-0x7fb0,0x7fad,0x7fed,0x7feb,0x7fea,0x7fec,0x7fe6,0x7fe8,
-0x8064,0x8067,0x81a3,0x819f,0x819e,0x8195,0x81a2,0x8199,
-0x8197,0x8216,0x824f,0x8253,0x8252,0x8250,0x824e,0x8251,
-0x8524,0x853b,0x850f,0x8500,0x8529,0x850e,0x8509,0x850d,
-0x851f,0x850a,0x8527,0x851c,0x84fb,0x852b,0x84fa,0x8508,
-0x850c,0x84f4,0x852a,0x84f2,0x8515,0x84f7,0x84eb,0x84f3,
-0x84fc,0x8512,0x84ea,0x84e9,0x8516,0x84fe,0x8528,0x851d,
-0x852e,0x8502,0x84fd,0x851e,0x84f6,0x8531,0x8526,0x84e7,
-0x84e8,0x84f0,0x84ef,0x84f9,0x8518,0x8520,0x8530,0x850b,
-0x8519,0x852f,0x8662,0x8756,0x8763,0x8764,0x8777,0x87e1,
-0x8773,0x8758,0x8754,0x875b,0x8752,0x8761,0x875a,0x8751,
-0x875e,0x876d,0x876a,0x8750,0x874e,0x875f,0x875d,0x876f,
-0x876c,0x877a,0x876e,0x875c,0x8765,0x874f,0x877b,0x8775,
-0x8762,0x8767,0x8769,0x885a,0x8905,0x890c,0x8914,0x890b,
-0x8917,0x8918,0x8919,0x8906,0x8916,0x8911,0x890e,0x8909,
-0x89a2,0x89a4,0x89a3,0x89ed,0x89f0,0x89ec,0x8acf,0x8ac6,
-0x8ab8,0x8ad3,0x8ad1,0x8ad4,0x8ad5,0x8abb,0x8ad7,0x8abe,
-0x8ac0,0x8ac5,0x8ad8,0x8ac3,0x8aba,0x8abd,0x8ad9,0x8c3e,
-0x8c4d,0x8c8f,0x8ce5,0x8cdf,0x8cd9,0x8ce8,0x8cda,0x8cdd,
-0x8ce7,0x8da0,0x8d9c,0x8da1,0x8d9b,0x8e20,0x8e23,0x8e25,
-0x8e24,0x8e2e,0x8e15,0x8e1b,0x8e16,0x8e11,0x8e19,0x8e26,
-0x8e27,0x8e14,0x8e12,0x8e18,0x8e13,0x8e1c,0x8e17,0x8e1a,
-0x8f2c,0x8f24,0x8f18,0x8f1a,0x8f20,0x8f23,0x8f16,0x8f17,
-0x9073,0x9070,0x906f,0x9067,0x906b,0x912f,0x912b,0x9129,
-0x912a,0x9132,0x9126,0x912e,0x9185,0x9186,0x918a,0x9181,
-0x9182,0x9184,0x9180,0x92d0,0x92c3,0x92c4,0x92c0,0x92d9,
-0x92b6,0x92cf,0x92f1,0x92df,0x92d8,0x92e9,0x92d7,0x92dd,
-0x92cc,0x92ef,0x92c2,0x92e8,0x92ca,0x92c8,0x92ce,0x92e6,
-0x92cd,0x92d5,0x92c9,0x92e0,0x92de,0x92e7,0x92d1,0x92d3,
-0x92b5,0x92e1,0x9325,0x92c6,0x92b4,0x957c,0x95ac,0x95ab,
-0x95ae,0x95b0,0x96a4,0x96a2,0x96d3,0x9705,0x9708,0x9702,
-0x975a,0x978a,0x978e,0x9788,0x97d0,0x97cf,0x981e,0x981d,
-0x9826,0x9829,0x9828,0x9820,0x981b,0x9827,0x98b2,0x9908,
-0x98fa,0x9911,0x9914,0x9916,0x9917,0x9915,0x99dc,0x99cd,
-0x99cf,0x99d3,0x99d4,0x99ce,0x99c9,0x99d6,0x99d8,0x99cb,
-0x99d7,0x99cc,0x9ab3,0x9aec,0x9aeb,0x9af3,0x9af2,0x9af1,
-0x9b46,0x9b43,0x9b67,0x9b74,0x9b71,0x9b66,0x9b76,0x9b75,
-0x9b70,0x9b68,0x9b64,0x9b6c,0x9cfc,0x9cfa,0x9cfd,0x9cff,
-0x9cf7,0x9d07,0x9d00,0x9cf9,0x9cfb,0x9d08,0x9d05,0x9d04,
-0x9e83,0x9ed3,0x9f0f,0x9f10,0x511c,0x5113,0x5117,0x511a,
-0x5111,0x51de,0x5334,0x53e1,0x5670,0x5660,0x566e,0x5673,
-0x5666,0x5663,0x566d,0x5672,0x565e,0x5677,0x571c,0x571b,
-0x58c8,0x58bd,0x58c9,0x58bf,0x58ba,0x58c2,0x58bc,0x58c6,
-0x5b17,0x5b19,0x5b1b,0x5b21,0x5b14,0x5b13,0x5b10,0x5b16,
-0x5b28,0x5b1a,0x5b20,0x5b1e,0x5bef,0x5dac,0x5db1,0x5da9,
-0x5da7,0x5db5,0x5db0,0x5dae,0x5daa,0x5da8,0x5db2,0x5dad,
-0x5daf,0x5db4,0x5e67,0x5e68,0x5e66,0x5e6f,0x5ee9,0x5ee7,
-0x5ee6,0x5ee8,0x5ee5,0x5f4b,0x5fbc,0x5fbb,0x619d,0x61a8,
-0x6196,0x61c5,0x61b4,0x61c6,0x61c1,0x61cc,0x61ba,0x61bf,
-0x61b8,0x618c,0x64d7,0x64d6,0x64d0,0x64cf,0x64c9,0x64bd,
-0x6489,0x64c3,0x64db,0x64f3,0x64d9,0x6533,0x657f,0x657c,
-0x65a2,0x66c8,0x66be,0x66c0,0x66ca,0x66cb,0x66cf,0x66bd,
-0x66bb,0x66ba,0x66cc,0x6723,0x6a34,0x6a66,0x6a49,0x6a67,
-0x6a32,0x6a68,0x6a3e,0x6a5d,0x6a6d,0x6a76,0x6a5b,0x6a51,
-0x6a28,0x6a5a,0x6a3b,0x6a3f,0x6a41,0x6a6a,0x6a64,0x6a50,
-0x6a4f,0x6a54,0x6a6f,0x6a69,0x6a60,0x6a3c,0x6a5e,0x6a56,
-0x6a55,0x6a4d,0x6a4e,0x6a46,0x6b55,0x6b54,0x6b56,0x6ba7,
-0x6baa,0x6bab,0x6bc8,0x6bc7,0x6c04,0x6c03,0x6c06,0x6fad,
-0x6fcb,0x6fa3,0x6fc7,0x6fbc,0x6fce,0x6fc8,0x6f5e,0x6fc4,
-0x6fbd,0x6f9e,0x6fca,0x6fa8,0x7004,0x6fa5,0x6fae,0x6fba,
-0x6fac,0x6faa,0x6fcf,0x6fbf,0x6fb8,0x6fa2,0x6fc9,0x6fab,
-0x6fcd,0x6faf,0x6fb2,0x6fb0,0x71c5,0x71c2,0x71bf,0x71b8,
-0x71d6,0x71c0,0x71c1,0x71cb,0x71d4,0x71ca,0x71c7,0x71cf,
-0x71bd,0x71d8,0x71bc,0x71c6,0x71da,0x71db,0x729d,0x729e,
-0x7369,0x7366,0x7367,0x736c,0x7365,0x736b,0x736a,0x747f,
-0x749a,0x74a0,0x7494,0x7492,0x7495,0x74a1,0x750b,0x7580,
-0x762f,0x762d,0x7631,0x763d,0x7633,0x763c,0x7635,0x7632,
-0x7630,0x76bb,0x76e6,0x779a,0x779d,0x77a1,0x779c,0x779b,
-0x77a2,0x77a3,0x7795,0x7799,0x7797,0x78dd,0x78e9,0x78e5,
-0x78ea,0x78de,0x78e3,0x78db,0x78e1,0x78e2,0x78ed,0x78df,
-0x78e0,0x79a4,0x7a44,0x7a48,0x7a47,0x7ab6,0x7ab8,0x7ab5,
-0x7ab1,0x7ab7,0x7bde,0x7be3,0x7be7,0x7bdd,0x7bd5,0x7be5,
-0x7bda,0x7be8,0x7bf9,0x7bd4,0x7bea,0x7be2,0x7bdc,0x7beb,
-0x7bd8,0x7bdf,0x7cd2,0x7cd4,0x7cd7,0x7cd0,0x7cd1,0x7e12,
-0x7e21,0x7e17,0x7e0c,0x7e1f,0x7e20,0x7e13,0x7e0e,0x7e1c,
-0x7e15,0x7e1a,0x7e22,0x7e0b,0x7e0f,0x7e16,0x7e0d,0x7e14,
-0x7e25,0x7e24,0x7f43,0x7f7b,0x7f7c,0x7f7a,0x7fb1,0x7fef,
-0x802a,0x8029,0x806c,0x81b1,0x81a6,0x81ae,0x81b9,0x81b5,
-0x81ab,0x81b0,0x81ac,0x81b4,0x81b2,0x81b7,0x81a7,0x81f2,
-0x8255,0x8256,0x8257,0x8556,0x8545,0x856b,0x854d,0x8553,
-0x8561,0x8558,0x8540,0x8546,0x8564,0x8541,0x8562,0x8544,
-0x8551,0x8547,0x8563,0x853e,0x855b,0x8571,0x854e,0x856e,
-0x8575,0x8555,0x8567,0x8560,0x858c,0x8566,0x855d,0x8554,
-0x8565,0x856c,0x8663,0x8665,0x8664,0x87a4,0x879b,0x878f,
-0x8797,0x8793,0x8792,0x8788,0x8781,0x8796,0x8798,0x8779,
-0x8787,0x87a3,0x8785,0x8790,0x8791,0x879d,0x8784,0x8794,
-0x879c,0x879a,0x8789,0x891e,0x8926,0x8930,0x892d,0x892e,
-0x8927,0x8931,0x8922,0x8929,0x8923,0x892f,0x892c,0x891f,
-0x89f1,0x8ae0,0x8ae2,0x8af2,0x8af4,0x8af5,0x8add,0x8b14,
-0x8ae4,0x8adf,0x8af0,0x8ac8,0x8ade,0x8ae1,0x8ae8,0x8aff,
-0x8aef,0x8afb,0x8c91,0x8c92,0x8c90,0x8cf5,0x8cee,0x8cf1,
-0x8cf0,0x8cf3,0x8d6c,0x8d6e,0x8da5,0x8da7,0x8e33,0x8e3e,
-0x8e38,0x8e40,0x8e45,0x8e36,0x8e3c,0x8e3d,0x8e41,0x8e30,
-0x8e3f,0x8ebd,0x8f36,0x8f2e,0x8f35,0x8f32,0x8f39,0x8f37,
-0x8f34,0x9076,0x9079,0x907b,0x9086,0x90fa,0x9133,0x9135,
-0x9136,0x9193,0x9190,0x9191,0x918d,0x918f,0x9327,0x931e,
-0x9308,0x931f,0x9306,0x930f,0x937a,0x9338,0x933c,0x931b,
-0x9323,0x9312,0x9301,0x9346,0x932d,0x930e,0x930d,0x92cb,
-0x931d,0x92fa,0x9313,0x92f9,0x92f7,0x9334,0x9302,0x9324,
-0x92ff,0x9329,0x9339,0x9335,0x932a,0x9314,0x930c,0x930b,
-0x92fe,0x9309,0x9300,0x92fb,0x9316,0x95bc,0x95cd,0x95be,
-0x95b9,0x95ba,0x95b6,0x95bf,0x95b5,0x95bd,0x96a9,0x96d4,
-0x970b,0x9712,0x9710,0x9799,0x9797,0x9794,0x97f0,0x97f8,
-0x9835,0x982f,0x9832,0x9924,0x991f,0x9927,0x9929,0x999e,
-0x99ee,0x99ec,0x99e5,0x99e4,0x99f0,0x99e3,0x99ea,0x99e9,
-0x99e7,0x9ab9,0x9abf,0x9ab4,0x9abb,0x9af6,0x9afa,0x9af9,
-0x9af7,0x9b33,0x9b80,0x9b85,0x9b87,0x9b7c,0x9b7e,0x9b7b,
-0x9b82,0x9b93,0x9b92,0x9b90,0x9b7a,0x9b95,0x9b7d,0x9b88,
-0x9d25,0x9d17,0x9d20,0x9d1e,0x9d14,0x9d29,0x9d1d,0x9d18,
-0x9d22,0x9d10,0x9d19,0x9d1f,0x9e88,0x9e86,0x9e87,0x9eae,
-0x9ead,0x9ed5,0x9ed6,0x9efa,0x9f12,0x9f3d,0x5126,0x5125,
-0x5122,0x5124,0x5120,0x5129,0x52f4,0x5693,0x568c,0x568d,
-0x5686,0x5684,0x5683,0x567e,0x5682,0x567f,0x5681,0x58d6,
-0x58d4,0x58cf,0x58d2,0x5b2d,0x5b25,0x5b32,0x5b23,0x5b2c,
-0x5b27,0x5b26,0x5b2f,0x5b2e,0x5b7b,0x5bf1,0x5bf2,0x5db7,
-0x5e6c,0x5e6a,0x5fbe,0x61c3,0x61b5,0x61bc,0x61e7,0x61e0,
-0x61e5,0x61e4,0x61e8,0x61de,0x64ef,0x64e9,0x64e3,0x64eb,
-0x64e4,0x64e8,0x6581,0x6580,0x65b6,0x65da,0x66d2,0x6a8d,
-0x6a96,0x6a81,0x6aa5,0x6a89,0x6a9f,0x6a9b,0x6aa1,0x6a9e,
-0x6a87,0x6a93,0x6a8e,0x6a95,0x6a83,0x6aa8,0x6aa4,0x6a91,
-0x6a7f,0x6aa6,0x6a9a,0x6a85,0x6a8c,0x6a92,0x6b5b,0x6bad,
-0x6c09,0x6fcc,0x6fa9,0x6ff4,0x6fd4,0x6fe3,0x6fdc,0x6fed,
-0x6fe7,0x6fe6,0x6fde,0x6ff2,0x6fdd,0x6fe2,0x6fe8,0x71e1,
-0x71f1,0x71e8,0x71f2,0x71e4,0x71f0,0x71e2,0x7373,0x736e,
-0x736f,0x7497,0x74b2,0x74ab,0x7490,0x74aa,0x74ad,0x74b1,
-0x74a5,0x74af,0x7510,0x7511,0x7512,0x750f,0x7584,0x7643,
-0x7648,0x7649,0x7647,0x76a4,0x76e9,0x77b5,0x77ab,0x77b2,
-0x77b7,0x77b6,0x77b4,0x77b1,0x77a8,0x77f0,0x78f3,0x78fd,
-0x7902,0x78fb,0x78fc,0x78ff,0x78f2,0x7905,0x78f9,0x78fe,
-0x7904,0x79ab,0x79a8,0x7a5c,0x7a5b,0x7a56,0x7a58,0x7a54,
-0x7a5a,0x7abe,0x7ac0,0x7ac1,0x7c05,0x7c0f,0x7bf2,0x7c00,
-0x7bff,0x7bfb,0x7c0e,0x7bf4,0x7c0b,0x7bf3,0x7c02,0x7c09,
-0x7c03,0x7c01,0x7bf8,0x7bfd,0x7c06,0x7bf0,0x7bf1,0x7c10,
-0x7c0a,0x7ce8,0x7e2d,0x7e3c,0x7e42,0x7e33,0x9848,0x7e38,
-0x7e2a,0x7e49,0x7e40,0x7e47,0x7e29,0x7e4c,0x7e30,0x7e3b,
-0x7e36,0x7e44,0x7e3a,0x7f45,0x7f7f,0x7f7e,0x7f7d,0x7ff4,
-0x7ff2,0x802c,0x81bb,0x81c4,0x81cc,0x81ca,0x81c5,0x81c7,
-0x81bc,0x81e9,0x825b,0x825a,0x825c,0x8583,0x8580,0x858f,
-0x85a7,0x8595,0x85a0,0x858b,0x85a3,0x857b,0x85a4,0x859a,
-0x859e,0x8577,0x857c,0x8589,0x85a1,0x857a,0x8578,0x8557,
-0x858e,0x8596,0x8586,0x858d,0x8599,0x859d,0x8581,0x85a2,
-0x8582,0x8588,0x8585,0x8579,0x8576,0x8598,0x8590,0x859f,
-0x8668,0x87be,0x87aa,0x87ad,0x87c5,0x87b0,0x87ac,0x87b9,
-0x87b5,0x87bc,0x87ae,0x87c9,0x87c3,0x87c2,0x87cc,0x87b7,
-0x87af,0x87c4,0x87ca,0x87b4,0x87b6,0x87bf,0x87b8,0x87bd,
-0x87de,0x87b2,0x8935,0x8933,0x893c,0x893e,0x8941,0x8952,
-0x8937,0x8942,0x89ad,0x89af,0x89ae,0x89f2,0x89f3,0x8b1e,
-0x8b18,0x8b16,0x8b11,0x8b05,0x8b0b,0x8b22,0x8b0f,0x8b12,
-0x8b15,0x8b07,0x8b0d,0x8b08,0x8b06,0x8b1c,0x8b13,0x8b1a,
-0x8c4f,0x8c70,0x8c72,0x8c71,0x8c6f,0x8c95,0x8c94,0x8cf9,
-0x8d6f,0x8e4e,0x8e4d,0x8e53,0x8e50,0x8e4c,0x8e47,0x8f43,
-0x8f40,0x9085,0x907e,0x9138,0x919a,0x91a2,0x919b,0x9199,
-0x919f,0x91a1,0x919d,0x91a0,0x93a1,0x9383,0x93af,0x9364,
-0x9356,0x9347,0x937c,0x9358,0x935c,0x9376,0x9349,0x9350,
-0x9351,0x9360,0x936d,0x938f,0x934c,0x936a,0x9379,0x9357,
-0x9355,0x9352,0x934f,0x9371,0x9377,0x937b,0x9361,0x935e,
-0x9363,0x9367,0x934e,0x9359,0x95c7,0x95c0,0x95c9,0x95c3,
-0x95c5,0x95b7,0x96ae,0x96b0,0x96ac,0x9720,0x971f,0x9718,
-0x971d,0x9719,0x979a,0x97a1,0x979c,0x979e,0x979d,0x97d5,
-0x97d4,0x97f1,0x9841,0x9844,0x984a,0x9849,0x9845,0x9843,
-0x9925,0x992b,0x992c,0x992a,0x9933,0x9932,0x992f,0x992d,
-0x9931,0x9930,0x9998,0x99a3,0x99a1,0x9a02,0x99fa,0x99f4,
-0x99f7,0x99f9,0x99f8,0x99f6,0x99fb,0x99fd,0x99fe,0x99fc,
-0x9a03,0x9abe,0x9afe,0x9afd,0x9b01,0x9afc,0x9b48,0x9b9a,
-0x9ba8,0x9b9e,0x9b9b,0x9ba6,0x9ba1,0x9ba5,0x9ba4,0x9b86,
-0x9ba2,0x9ba0,0x9baf,0x9d33,0x9d41,0x9d67,0x9d36,0x9d2e,
-0x9d2f,0x9d31,0x9d38,0x9d30,0x9d45,0x9d42,0x9d43,0x9d3e,
-0x9d37,0x9d40,0x9d3d,0x7ff5,0x9d2d,0x9e8a,0x9e89,0x9e8d,
-0x9eb0,0x9ec8,0x9eda,0x9efb,0x9eff,0x9f24,0x9f23,0x9f22,
-0x9f54,0x9fa0,0x5131,0x512d,0x512e,0x5698,0x569c,0x5697,
-0x569a,0x569d,0x5699,0x5970,0x5b3c,0x5c69,0x5c6a,0x5dc0,
-0x5e6d,0x5e6e,0x61d8,0x61df,0x61ed,0x61ee,0x61f1,0x61ea,
-0x61f0,0x61eb,0x61d6,0x61e9,0x64ff,0x6504,0x64fd,0x64f8,
-0x6501,0x6503,0x64fc,0x6594,0x65db,0x66da,0x66db,0x66d8,
-0x6ac5,0x6ab9,0x6abd,0x6ae1,0x6ac6,0x6aba,0x6ab6,0x6ab7,
-0x6ac7,0x6ab4,0x6aad,0x6b5e,0x6bc9,0x6c0b,0x7007,0x700c,
-0x700d,0x7001,0x7005,0x7014,0x700e,0x6fff,0x7000,0x6ffb,
-0x7026,0x6ffc,0x6ff7,0x700a,0x7201,0x71ff,0x71f9,0x7203,
-0x71fd,0x7376,0x74b8,0x74c0,0x74b5,0x74c1,0x74be,0x74b6,
-0x74bb,0x74c2,0x7514,0x7513,0x765c,0x7664,0x7659,0x7650,
-0x7653,0x7657,0x765a,0x76a6,0x76bd,0x76ec,0x77c2,0x77ba,
-0x790c,0x7913,0x7914,0x7909,0x7910,0x7912,0x7911,0x79ad,
-0x79ac,0x7a5f,0x7c1c,0x7c29,0x7c19,0x7c20,0x7c1f,0x7c2d,
-0x7c1d,0x7c26,0x7c28,0x7c22,0x7c25,0x7c30,0x7e5c,0x7e50,
-0x7e56,0x7e63,0x7e58,0x7e62,0x7e5f,0x7e51,0x7e60,0x7e57,
-0x7e53,0x7fb5,0x7fb3,0x7ff7,0x7ff8,0x8075,0x81d1,0x81d2,
-0x81d0,0x825f,0x825e,0x85b4,0x85c6,0x85c0,0x85c3,0x85c2,
-0x85b3,0x85b5,0x85bd,0x85c7,0x85c4,0x85bf,0x85cb,0x85ce,
-0x85c8,0x85c5,0x85b1,0x85b6,0x85d2,0x8624,0x85b8,0x85b7,
-0x85be,0x8669,0x87e7,0x87e6,0x87e2,0x87db,0x87eb,0x87ea,
-0x87e5,0x87df,0x87f3,0x87e4,0x87d4,0x87dc,0x87d3,0x87ed,
-0x87d8,0x87e3,0x87d7,0x87d9,0x8801,0x87f4,0x87e8,0x87dd,
-0x8953,0x894b,0x894f,0x894c,0x8946,0x8950,0x8951,0x8949,
-0x8b2a,0x8b27,0x8b23,0x8b33,0x8b30,0x8b35,0x8b47,0x8b2f,
-0x8b3c,0x8b3e,0x8b31,0x8b25,0x8b37,0x8b26,0x8b36,0x8b2e,
-0x8b24,0x8b3b,0x8b3d,0x8b3a,0x8c42,0x8c75,0x8c99,0x8c98,
-0x8c97,0x8cfe,0x8d04,0x8d02,0x8d00,0x8e5c,0x8e62,0x8e60,
-0x8e57,0x8e56,0x8e5e,0x8e65,0x8e67,0x8e5b,0x8e5a,0x8e61,
-0x8e5d,0x8e69,0x8e54,0x8f46,0x8f47,0x8f48,0x8f4b,0x9128,
-0x913a,0x913b,0x913e,0x91a8,0x91a5,0x91a7,0x91af,0x91aa,
-0x93b5,0x938c,0x9392,0x93b7,0x939b,0x939d,0x9389,0x93a7,
-0x938e,0x93aa,0x939e,0x93a6,0x9395,0x9388,0x9399,0x939f,
-0x9380,0x938d,0x93b1,0x9391,0x93b2,0x93a4,0x93a8,0x93b4,
-0x93a3,0x95d2,0x95d3,0x95d1,0x96b3,0x96d7,0x96da,0x5dc2,
-0x96df,0x96d8,0x96dd,0x9723,0x9722,0x9725,0x97ac,0x97ae,
-0x97a8,0x97ab,0x97a4,0x97aa,0x97a2,0x97a5,0x97d7,0x97d9,
-0x97d6,0x97d8,0x97fa,0x9850,0x9851,0x9852,0x98b8,0x9941,
-0x993c,0x993a,0x9a0f,0x9a0b,0x9a09,0x9a0d,0x9a04,0x9a11,
-0x9a0a,0x9a05,0x9a07,0x9a06,0x9ac0,0x9adc,0x9b08,0x9b04,
-0x9b05,0x9b29,0x9b35,0x9b4a,0x9b4c,0x9b4b,0x9bc7,0x9bc6,
-0x9bc3,0x9bbf,0x9bc1,0x9bb5,0x9bb8,0x9bd3,0x9bb6,0x9bc4,
-0x9bb9,0x9bbd,0x9d5c,0x9d53,0x9d4f,0x9d4a,0x9d5b,0x9d4b,
-0x9d59,0x9d56,0x9d4c,0x9d57,0x9d52,0x9d54,0x9d5f,0x9d58,
-0x9d5a,0x9e8e,0x9e8c,0x9edf,0x9f01,0x9f00,0x9f16,0x9f25,
-0x9f2b,0x9f2a,0x9f29,0x9f28,0x9f4c,0x9f55,0x5134,0x5135,
-0x5296,0x52f7,0x53b4,0x56ab,0x56ad,0x56a6,0x56a7,0x56aa,
-0x56ac,0x58da,0x58dd,0x58db,0x5912,0x5b3d,0x5b3e,0x5b3f,
-0x5dc3,0x5e70,0x5fbf,0x61fb,0x6507,0x6510,0x650d,0x6509,
-0x650c,0x650e,0x6584,0x65de,0x65dd,0x66de,0x6ae7,0x6ae0,
-0x6acc,0x6ad1,0x6ad9,0x6acb,0x6adf,0x6adc,0x6ad0,0x6aeb,
-0x6acf,0x6acd,0x6ade,0x6b60,0x6bb0,0x6c0c,0x7019,0x7027,
-0x7020,0x7016,0x702b,0x7021,0x7022,0x7023,0x7029,0x7017,
-0x7024,0x701c,0x720c,0x720a,0x7207,0x7202,0x7205,0x72a5,
-0x72a6,0x72a4,0x72a3,0x72a1,0x74cb,0x74c5,0x74b7,0x74c3,
-0x7516,0x7660,0x77c9,0x77ca,0x77c4,0x77f1,0x791d,0x791b,
-0x7921,0x791c,0x7917,0x791e,0x79b0,0x7a67,0x7a68,0x7c33,
-0x7c3c,0x7c39,0x7c2c,0x7c3b,0x7cec,0x7cea,0x7e76,0x7e75,
-0x7e78,0x7e70,0x7e77,0x7e6f,0x7e7a,0x7e72,0x7e74,0x7e68,
-0x7f4b,0x7f4a,0x7f83,0x7f86,0x7fb7,0x7ffd,0x7ffe,0x8078,
-0x81d7,0x81d5,0x820b,0x8264,0x8261,0x8263,0x85eb,0x85f1,
-0x85ed,0x85d9,0x85e1,0x85e8,0x85da,0x85d7,0x85ec,0x85f2,
-0x85f8,0x85d8,0x85df,0x85e3,0x85dc,0x85d1,0x85f0,0x85e6,
-0x85ef,0x85de,0x85e2,0x8800,0x87fa,0x8803,0x87f6,0x87f7,
-0x8809,0x880c,0x880b,0x8806,0x87fc,0x8808,0x87ff,0x880a,
-0x8802,0x8962,0x895a,0x895b,0x8957,0x8961,0x895c,0x8958,
-0x895d,0x8959,0x8988,0x89b7,0x89b6,0x89f6,0x8b50,0x8b48,
-0x8b4a,0x8b40,0x8b53,0x8b56,0x8b54,0x8b4b,0x8b55,0x8b51,
-0x8b42,0x8b52,0x8b57,0x8c43,0x8c77,0x8c76,0x8c9a,0x8d06,
-0x8d07,0x8d09,0x8dac,0x8daa,0x8dad,0x8dab,0x8e6d,0x8e78,
-0x8e73,0x8e6a,0x8e6f,0x8e7b,0x8ec2,0x8f52,0x8f51,0x8f4f,
-0x8f50,0x8f53,0x8fb4,0x9140,0x913f,0x91b0,0x91ad,0x93de,
-0x93c7,0x93cf,0x93c2,0x93da,0x93d0,0x93f9,0x93ec,0x93cc,
-0x93d9,0x93a9,0x93e6,0x93ca,0x93d4,0x93ee,0x93e3,0x93d5,
-0x93c4,0x93ce,0x93c0,0x93d2,0x93a5,0x93e7,0x957d,0x95da,
-0x95db,0x96e1,0x9729,0x972b,0x972c,0x9728,0x9726,0x97b3,
-0x97b7,0x97b6,0x97dd,0x97de,0x97df,0x985c,0x9859,0x985d,
-0x9857,0x98bf,0x98bd,0x98bb,0x98be,0x9948,0x9947,0x9943,
-0x99a6,0x99a7,0x9a1a,0x9a15,0x9a25,0x9a1d,0x9a24,0x9a1b,
-0x9a22,0x9a20,0x9a27,0x9a23,0x9a1e,0x9a1c,0x9a14,0x9ac2,
-0x9b0b,0x9b0a,0x9b0e,0x9b0c,0x9b37,0x9bea,0x9beb,0x9be0,
-0x9bde,0x9be4,0x9be6,0x9be2,0x9bf0,0x9bd4,0x9bd7,0x9bec,
-0x9bdc,0x9bd9,0x9be5,0x9bd5,0x9be1,0x9bda,0x9d77,0x9d81,
-0x9d8a,0x9d84,0x9d88,0x9d71,0x9d80,0x9d78,0x9d86,0x9d8b,
-0x9d8c,0x9d7d,0x9d6b,0x9d74,0x9d75,0x9d70,0x9d69,0x9d85,
-0x9d73,0x9d7b,0x9d82,0x9d6f,0x9d79,0x9d7f,0x9d87,0x9d68,
-0x9e94,0x9e91,0x9ec0,0x9efc,0x9f2d,0x9f40,0x9f41,0x9f4d,
-0x9f56,0x9f57,0x9f58,0x5337,0x56b2,0x56b5,0x56b3,0x58e3,
-0x5b45,0x5dc6,0x5dc7,0x5eee,0x5eef,0x5fc0,0x5fc1,0x61f9,
-0x6517,0x6516,0x6515,0x6513,0x65df,0x66e8,0x66e3,0x66e4,
-0x6af3,0x6af0,0x6aea,0x6ae8,0x6af9,0x6af1,0x6aee,0x6aef,
-0x703c,0x7035,0x702f,0x7037,0x7034,0x7031,0x7042,0x7038,
-0x703f,0x703a,0x7039,0x702a,0x7040,0x703b,0x7033,0x7041,
-0x7213,0x7214,0x72a8,0x737d,0x737c,0x74ba,0x76ab,0x76aa,
-0x76be,0x76ed,0x77cc,0x77ce,0x77cf,0x77cd,0x77f2,0x7925,
-0x7923,0x7927,0x7928,0x7924,0x7929,0x79b2,0x7a6e,0x7a6c,
-0x7a6d,0x7af7,0x7c49,0x7c48,0x7c4a,0x7c47,0x7c45,0x7cee,
-0x7e7b,0x7e7e,0x7e81,0x7e80,0x7fba,0x7fff,0x8079,0x81db,
-0x81d9,0x8268,0x8269,0x8622,0x85ff,0x8601,0x85fe,0x861b,
-0x8600,0x85f6,0x8604,0x8609,0x8605,0x860c,0x85fd,0x8819,
-0x8810,0x8811,0x8817,0x8813,0x8816,0x8963,0x8966,0x89b9,
-0x89f7,0x8b60,0x8b6a,0x8b5d,0x8b68,0x8b63,0x8b65,0x8b67,
-0x8b6d,0x8dae,0x8e86,0x8e88,0x8e84,0x8f59,0x8f56,0x8f57,
-0x8f55,0x8f58,0x8f5a,0x908d,0x9143,0x9141,0x91b7,0x91b5,
-0x91b2,0x91b3,0x940b,0x9413,0x93fb,0x9420,0x940f,0x9414,
-0x93fe,0x9415,0x9410,0x9428,0x9419,0x940d,0x93f5,0x9400,
-0x93f7,0x9407,0x940e,0x9416,0x9412,0x93fa,0x9409,0x93f8,
-0x943c,0x940a,0x93ff,0x93fc,0x940c,0x93f6,0x9411,0x9406,
-0x95de,0x95e0,0x95df,0x972e,0x972f,0x97b9,0x97bb,0x97fd,
-0x97fe,0x9860,0x9862,0x9863,0x985f,0x98c1,0x98c2,0x9950,
-0x994e,0x9959,0x994c,0x994b,0x9953,0x9a32,0x9a34,0x9a31,
-0x9a2c,0x9a2a,0x9a36,0x9a29,0x9a2e,0x9a38,0x9a2d,0x9ac7,
-0x9aca,0x9ac6,0x9b10,0x9b12,0x9b11,0x9c0b,0x9c08,0x9bf7,
-0x9c05,0x9c12,0x9bf8,0x9c40,0x9c07,0x9c0e,0x9c06,0x9c17,
-0x9c14,0x9c09,0x9d9f,0x9d99,0x9da4,0x9d9d,0x9d92,0x9d98,
-0x9d90,0x9d9b,0x9da0,0x9d94,0x9d9c,0x9daa,0x9d97,0x9da1,
-0x9d9a,0x9da2,0x9da8,0x9d9e,0x9da3,0x9dbf,0x9da9,0x9d96,
-0x9da6,0x9da7,0x9e99,0x9e9b,0x9e9a,0x9ee5,0x9ee4,0x9ee7,
-0x9ee6,0x9f30,0x9f2e,0x9f5b,0x9f60,0x9f5e,0x9f5d,0x9f59,
-0x9f91,0x513a,0x5139,0x5298,0x5297,0x56c3,0x56bd,0x56be,
-0x5b48,0x5b47,0x5dcb,0x5dcf,0x5ef1,0x61fd,0x651b,0x6b02,
-0x6afc,0x6b03,0x6af8,0x6b00,0x7043,0x7044,0x704a,0x7048,
-0x7049,0x7045,0x7046,0x721d,0x721a,0x7219,0x737e,0x7517,
-0x766a,0x77d0,0x792d,0x7931,0x792f,0x7c54,0x7c53,0x7cf2,
-0x7e8a,0x7e87,0x7e88,0x7e8b,0x7e86,0x7e8d,0x7f4d,0x7fbb,
-0x8030,0x81dd,0x8618,0x862a,0x8626,0x861f,0x8623,0x861c,
-0x8619,0x8627,0x862e,0x8621,0x8620,0x8629,0x861e,0x8625,
-0x8829,0x881d,0x881b,0x8820,0x8824,0x881c,0x882b,0x884a,
-0x896d,0x8969,0x896e,0x896b,0x89fa,0x8b79,0x8b78,0x8b45,
-0x8b7a,0x8b7b,0x8d10,0x8d14,0x8daf,0x8e8e,0x8e8c,0x8f5e,
-0x8f5b,0x8f5d,0x9146,0x9144,0x9145,0x91b9,0x943f,0x943b,
-0x9436,0x9429,0x943d,0x9430,0x9439,0x942a,0x9437,0x942c,
-0x9440,0x9431,0x95e5,0x95e4,0x95e3,0x9735,0x973a,0x97bf,
-0x97e1,0x9864,0x98c9,0x98c6,0x98c0,0x9958,0x9956,0x9a39,
-0x9a3d,0x9a46,0x9a44,0x9a42,0x9a41,0x9a3a,0x9a3f,0x9acd,
-0x9b15,0x9b17,0x9b18,0x9b16,0x9b3a,0x9b52,0x9c2b,0x9c1d,
-0x9c1c,0x9c2c,0x9c23,0x9c28,0x9c29,0x9c24,0x9c21,0x9db7,
-0x9db6,0x9dbc,0x9dc1,0x9dc7,0x9dca,0x9dcf,0x9dbe,0x9dc5,
-0x9dc3,0x9dbb,0x9db5,0x9dce,0x9db9,0x9dba,0x9dac,0x9dc8,
-0x9db1,0x9dad,0x9dcc,0x9db3,0x9dcd,0x9db2,0x9e7a,0x9e9c,
-0x9eeb,0x9eee,0x9eed,0x9f1b,0x9f18,0x9f1a,0x9f31,0x9f4e,
-0x9f65,0x9f64,0x9f92,0x4eb9,0x56c6,0x56c5,0x56cb,0x5971,
-0x5b4b,0x5b4c,0x5dd5,0x5dd1,0x5ef2,0x6521,0x6520,0x6526,
-0x6522,0x6b0b,0x6b08,0x6b09,0x6c0d,0x7055,0x7056,0x7057,
-0x7052,0x721e,0x721f,0x72a9,0x737f,0x74d8,0x74d5,0x74d9,
-0x74d7,0x766d,0x76ad,0x7935,0x79b4,0x7a70,0x7a71,0x7c57,
-0x7c5c,0x7c59,0x7c5b,0x7c5a,0x7cf4,0x7cf1,0x7e91,0x7f4f,
-0x7f87,0x81de,0x826b,0x8634,0x8635,0x8633,0x862c,0x8632,
-0x8636,0x882c,0x8828,0x8826,0x882a,0x8825,0x8971,0x89bf,
-0x89be,0x89fb,0x8b7e,0x8b84,0x8b82,0x8b86,0x8b85,0x8b7f,
-0x8d15,0x8e95,0x8e94,0x8e9a,0x8e92,0x8e90,0x8e96,0x8e97,
-0x8f60,0x8f62,0x9147,0x944c,0x9450,0x944a,0x944b,0x944f,
-0x9447,0x9445,0x9448,0x9449,0x9446,0x973f,0x97e3,0x986a,
-0x9869,0x98cb,0x9954,0x995b,0x9a4e,0x9a53,0x9a54,0x9a4c,
-0x9a4f,0x9a48,0x9a4a,0x9a49,0x9a52,0x9a50,0x9ad0,0x9b19,
-0x9b2b,0x9b3b,0x9b56,0x9b55,0x9c46,0x9c48,0x9c3f,0x9c44,
-0x9c39,0x9c33,0x9c41,0x9c3c,0x9c37,0x9c34,0x9c32,0x9c3d,
-0x9c36,0x9ddb,0x9dd2,0x9dde,0x9dda,0x9dcb,0x9dd0,0x9ddc,
-0x9dd1,0x9ddf,0x9de9,0x9dd9,0x9dd8,0x9dd6,0x9df5,0x9dd5,
-0x9ddd,0x9eb6,0x9ef0,0x9f35,0x9f33,0x9f32,0x9f42,0x9f6b,
-0x9f95,0x9fa2,0x513d,0x5299,0x58e8,0x58e7,0x5972,0x5b4d,
-0x5dd8,0x882f,0x5f4f,0x6201,0x6203,0x6204,0x6529,0x6525,
-0x6596,0x66eb,0x6b11,0x6b12,0x6b0f,0x6bca,0x705b,0x705a,
-0x7222,0x7382,0x7381,0x7383,0x7670,0x77d4,0x7c67,0x7c66,
-0x7e95,0x826c,0x863a,0x8640,0x8639,0x863c,0x8631,0x863b,
-0x863e,0x8830,0x8832,0x882e,0x8833,0x8976,0x8974,0x8973,
-0x89fe,0x8b8c,0x8b8e,0x8b8b,0x8b88,0x8c45,0x8d19,0x8e98,
-0x8f64,0x8f63,0x91bc,0x9462,0x9455,0x945d,0x9457,0x945e,
-0x97c4,0x97c5,0x9800,0x9a56,0x9a59,0x9b1e,0x9b1f,0x9b20,
-0x9c52,0x9c58,0x9c50,0x9c4a,0x9c4d,0x9c4b,0x9c55,0x9c59,
-0x9c4c,0x9c4e,0x9dfb,0x9df7,0x9def,0x9de3,0x9deb,0x9df8,
-0x9de4,0x9df6,0x9de1,0x9dee,0x9de6,0x9df2,0x9df0,0x9de2,
-0x9dec,0x9df4,0x9df3,0x9de8,0x9ded,0x9ec2,0x9ed0,0x9ef2,
-0x9ef3,0x9f06,0x9f1c,0x9f38,0x9f37,0x9f36,0x9f43,0x9f4f,
-0x9f71,0x9f70,0x9f6e,0x9f6f,0x56d3,0x56cd,0x5b4e,0x5c6d,
-0x652d,0x66ed,0x66ee,0x6b13,0x705f,0x7061,0x705d,0x7060,
-0x7223,0x74db,0x74e5,0x77d5,0x7938,0x79b7,0x79b6,0x7c6a,
-0x7e97,0x7f89,0x826d,0x8643,0x8838,0x8837,0x8835,0x884b,
-0x8b94,0x8b95,0x8e9e,0x8e9f,0x8ea0,0x8e9d,0x91be,0x91bd,
-0x91c2,0x946b,0x9468,0x9469,0x96e5,0x9746,0x9743,0x9747,
-0x97c7,0x97e5,0x9a5e,0x9ad5,0x9b59,0x9c63,0x9c67,0x9c66,
-0x9c62,0x9c5e,0x9c60,0x9e02,0x9dfe,0x9e07,0x9e03,0x9e06,
-0x9e05,0x9e00,0x9e01,0x9e09,0x9dff,0x9dfd,0x9e04,0x9ea0,
-0x9f1e,0x9f46,0x9f74,0x9f75,0x9f76,0x56d4,0x652e,0x65b8,
-0x6b18,0x6b19,0x6b17,0x6b1a,0x7062,0x7226,0x72aa,0x77d8,
-0x77d9,0x7939,0x7c69,0x7c6b,0x7cf6,0x7e9a,0x7e98,0x7e9b,
-0x7e99,0x81e0,0x81e1,0x8646,0x8647,0x8648,0x8979,0x897a,
-0x897c,0x897b,0x89ff,0x8b98,0x8b99,0x8ea5,0x8ea4,0x8ea3,
-0x946e,0x946d,0x946f,0x9471,0x9473,0x9749,0x9872,0x995f,
-0x9c68,0x9c6e,0x9c6d,0x9e0b,0x9e0d,0x9e10,0x9e0f,0x9e12,
-0x9e11,0x9ea1,0x9ef5,0x9f09,0x9f47,0x9f78,0x9f7b,0x9f7a,
-0x9f79,0x571e,0x7066,0x7c6f,0x883c,0x8db2,0x8ea6,0x91c3,
-0x9474,0x9478,0x9476,0x9475,0x9a60,0x9b2e,0x9c74,0x9c73,
-0x9c71,0x9c75,0x9e14,0x9e13,0x9ef6,0x9f0a,0x9fa4,0x7068,
-0x7065,0x7cf7,0x866a,0x883e,0x883d,0x883f,0x8b9e,0x8c9c,
-0x8ea9,0x8ec9,0x974b,0x9873,0x9874,0x98cc,0x9961,0x99ab,
-0x9a64,0x9a66,0x9a67,0x9b24,0x9e15,0x9e17,0x9f48,0x6207,
-0x6b1e,0x7227,0x864c,0x8ea8,0x9482,0x9480,0x9481,0x9a69,
-0x9a68,0x9e19,0x864b,0x8b9f,0x9483,0x9c79,0x9eb7,0x7675,
-0x9a6b,0x9c7a,0x9e1d,0x7069,0x706a,0x7229,0x9ea4,0x9f7e,
-0x9f49,0x9f98};
-
-static const int cns11643_2_ucs_table_size = (sizeof (cns11643_2_ucs_table) / sizeof (unsigned short));
-
-static const unsigned short cns11643_14_ucs_table[] = {
-0x4e28,0x4e36,0x4e3f,0x4e85,0x4e05,0x4e04,0x5182,0x5196,
-0x5338,0x5369,0x53b6,0x4e2a,0x4e87,0x4e49,0x51e2,0x4e46,
-0x4e8f,0x4ebc,0x4ebe,0x5166,0x51e3,0x5204,0x529c,0x0000,
-0x5902,0x590a,0x5b80,0x5ddb,0x5e7a,0x5e7f,0x5ef4,0x5f50,
-0x5f51,0x5f61,0x961d,0x0000,0x4e63,0x4e62,0x4ea3,0x5185,
-0x4ec5,0x4ecf,0x4ece,0x4ecc,0x5184,0x5186,0x0000,0x0000,
-0x51e4,0x5205,0x529e,0x529d,0x52fd,0x5300,0x533a,0x0000,
-0x5346,0x535d,0x5386,0x53b7,0x0000,0x53cc,0x0000,0x53ce,
-0x5721,0x0000,0x5e00,0x5f0c,0x6237,0x6238,0x6534,0x6535,
-0x65e0,0x0000,0x738d,0x4e97,0x4ee0,0x0000,0x0000,0x4ee7,
-0x0000,0x4ee6,0x0000,0x0000,0x0000,0x0000,0x56d8,0x518b,
-0x518c,0x5199,0x51e5,0x0000,0x520b,0x0000,0x0000,0x5304,
-0x5303,0x5307,0x0000,0x531e,0x535f,0x536d,0x5389,0x53ba,
-0x53d0,0x0000,0x53f6,0x53f7,0x53f9,0x0000,0x53f4,0x0000,
-0x0000,0x5724,0x5904,0x5918,0x5932,0x5930,0x5934,0x0000,
-0x5975,0x0000,0x5b82,0x5bf9,0x5c14,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x5e81,0x5e83,0x5f0d,0x5f52,
-0x0000,0x5fca,0x5fc7,0x6239,0x0000,0x624f,0x65e7,0x672f,
-0x6b7a,0x6c39,0x0000,0x0000,0x6c37,0x6c44,0x6c45,0x738c,
-0x7592,0x7676,0x9093,0x9092,0x0000,0x0000,0x4e21,0x4e20,
-0x4e22,0x4e68,0x4e89,0x4e98,0x4ef9,0x4eef,0x0000,0x0000,
-0x4ef8,0x4f06,0x4f03,0x4efc,0x4eee,0x4f16,0x0000,0x4f28,
-0x4f1c,0x4f07,0x4f1a,0x4efa,0x4f17,0x514a,0x0000,0x5172,
-0x0000,0x51b4,0x51b3,0x51b2,0x0000,0x51e8,0x0000,0x5214,
-0x520f,0x5215,0x5218,0x52a8,0x0000,0x534b,0x534f,0x0000,
-0x5350,0x0000,0x538b,0x0000,0x53be,0x0000,0x53d2,0x5416,
-0x53ff,0x0000,0x5400,0x0000,0x5405,0x5413,0x5415,0x0000,
-0x0000,0x56e3,0x5735,0x5736,0x5731,0x5732,0x58ee,0x5905,
-0x4e54,0x0000,0x5936,0x0000,0x0000,0x0000,0x597a,0x0000,
-0x5986,0x0000,0x0000,0x5b86,0x5f53,0x5c18,0x0000,0x5c3d,
-0x5c78,0x0000,0x0000,0x0000,0x0000,0x5c80,0x0000,0x5e08,
-0x0000,0x0000,0x0000,0x0000,0x5ef5,0x5f0e,0x0000,0x0000,
-0x0000,0x5fd3,0x5fda,0x0000,0x5fdb,0x0000,0x620f,0x625d,
-0x625f,0x6267,0x6257,0x9f50,0x0000,0x65eb,0x65ea,0x0000,
-0x6737,0x0000,0x6732,0x6736,0x6b22,0x6bce,0x0000,0x6c58,
-0x6c51,0x6c77,0x6c3c,0x0000,0x6c5a,0x0000,0x6c53,0x706f,
-0x7072,0x706e,0x0000,0x0000,0x7073,0x72b1,0x72b2,0x0000,
-0x738f,0x0000,0x0000,0x0000,0x793c,0x0000,0x808d,0x808e,
-0x0000,0x827b,0x0000,0x8d71,0x8fb9,0x9096,0x909a,0x0000,
-0x4e24,0x4e71,0x0000,0x4e9c,0x4f45,0x4f4a,0x4f39,0x4f37,
-0x0000,0x4f32,0x4f42,0x0000,0x4f44,0x4f4b,0x0000,0x4f40,
-0x4f35,0x4f31,0x5151,0x0000,0x5150,0x514e,0x0000,0x0000,
-0x519d,0x0000,0x51b5,0x51b8,0x51ec,0x5223,0x5227,0x5226,
-0x521f,0x522b,0x5220,0x52b4,0x52b3,0x0000,0x5325,0x533b,
-0x5374,0x0000,0x0000,0x0000,0x0000,0x0000,0x544d,0x0000,
-0x0000,0x543a,0x0000,0x0000,0x5444,0x544c,0x5423,0x541a,
-0x5432,0x544b,0x5421,0x0000,0x5434,0x5449,0x5450,0x5422,
-0x543f,0x5451,0x545a,0x542f,0x0000,0x56e9,0x56f2,0x56f3,
-0x56ef,0x56ed,0x56ec,0x56e6,0x5748,0x0000,0x5744,0x573f,
-0x573c,0x5753,0x5756,0x0000,0x575f,0x5743,0x5758,0x5757,
-0x0000,0x0000,0x0000,0x5746,0x0000,0x573d,0x0000,0x5742,
-0x5754,0x5755,0x58f1,0x58f2,0x58f0,0x590b,0x9ea6,0x56f1,
-0x593d,0x0000,0x5994,0x598c,0x0000,0x599c,0x0000,0x0000,
-0x599f,0x0000,0x599b,0x0000,0x5989,0x599a,0x0000,0x6588,
-0x0000,0x5b8d,0x0000,0x5bfe,0x5bff,0x5bfd,0x5c2b,0x0000,
-0x5c84,0x5c8e,0x5c9c,0x0000,0x0000,0x5c85,0x5df5,0x5e09,
-0x0000,0x0000,0x5e0b,0x0000,0x5e92,0x5e90,0x5f03,0x0000,
-0x5f1e,0x5f63,0x0000,0x5fe7,0x5ffe,0x5fe6,0x5fdc,0x5fce,
-0x0000,0x5ffc,0x5fdf,0x5fec,0x5ff6,0x0000,0x5ff2,0x5ff0,
-0x5ff9,0x0000,0x6213,0x0000,0x0000,0x623b,0x623c,0x6282,
-0x0000,0x0000,0x0000,0x6278,0x628b,0x0000,0x629e,0x62a5,
-0x629b,0x629c,0x6299,0x628d,0x6285,0x629d,0x6275,0x0000,
-0x0000,0x0000,0x65f6,0x0000,0x0000,0x0000,0x66f5,0x675b,
-0x0000,0x6754,0x6752,0x0000,0x6758,0x6744,0x674a,0x6761,
-0x0000,0x6c7f,0x6c91,0x6c9e,0x0000,0x6c6e,0x6c7c,0x6c9f,
-0x6c75,0x0000,0x6c56,0x6ca2,0x6c79,0x0000,0x6ca1,0x0000,
-0x6caa,0x6ca0,0x0000,0x7079,0x7077,0x707e,0x0000,0x7075,
-0x707b,0x7264,0x0000,0x72bb,0x72bc,0x72c7,0x72b9,0x72be,
-0x72b6,0x0000,0x0000,0x7398,0x0000,0x0000,0x0000,0x0000,
-0x7593,0x7680,0x0000,0x7683,0x76c0,0x76c1,0x0000,0x0000,
-0x77f4,0x77f5,0x0000,0x7acc,0x7acd,0x7cfa,0x809f,0x8091,
-0x8097,0x8094,0x0000,0x8286,0x828c,0x0000,0x8295,0x0000,
-0x866c,0x0000,0x8fb5,0x8fbe,0x8fc7,0x0000,0x8fc1,0x90a9,
-0x90a4,0x0000,0x0000,0x0000,0x90a8,0x9627,0x9626,0x962b,
-0x9633,0x9634,0x9629,0x4e3d,0x0000,0x4e9d,0x4f93,0x4f8a,
-0x0000,0x0000,0x4f6d,0x4f8e,0x4fa0,0x4fa2,0x4fa1,0x4f9f,
-0x4fa3,0x0000,0x4f72,0x0000,0x4f8c,0x5156,0x0000,0x0000,
-0x5190,0x0000,0x0000,0x0000,0x51ed,0x51fe,0x522f,0x0000,
-0x523c,0x5234,0x5239,0x52b9,0x52b5,0x52bf,0x5355,0x0000,
-0x5376,0x537a,0x5393,0x0000,0x53c1,0x53c2,0x53d5,0x5485,
-0x0000,0x545f,0x5493,0x5489,0x5479,0x9efe,0x548f,0x5469,
-0x546d,0x0000,0x5494,0x546a,0x548a,0x0000,0x56fd,0x56fb,
-0x56f8,0x0000,0x56fc,0x56f6,0x5765,0x5781,0x5763,0x5767,
-0x0000,0x576e,0x5778,0x577f,0x0000,0x0000,0x58f3,0x594b,
-0x594c,0x0000,0x0000,0x0000,0x59ad,0x0000,0x59c4,0x0000,
-0x59c2,0x59b0,0x0000,0x0000,0x0000,0x0000,0x59bf,0x0000,
-0x59c9,0x59b8,0x59ac,0x0000,0x0000,0x0000,0x59b7,0x59d7,
-0x0000,0x5b60,0x0000,0x5b96,0x5b9e,0x5b94,0x5b9f,0x5b9d,
-0x0000,0x5c00,0x5c19,0x0000,0x0000,0x5c49,0x5c4a,0x0000,
-0x5cbb,0x5cc1,0x0000,0x0000,0x0000,0x5cb9,0x5c9e,0x5cb4,
-0x5cba,0x5df6,0x5e13,0x5e12,0x5e77,0x0000,0x5e98,0x0000,
-0x5e99,0x5e9d,0x5ef8,0x0000,0x5ef9,0x0000,0x5f06,0x5f21,
-0x0000,0x5f25,0x5f55,0x0000,0x0000,0x0000,0x5f84,0x5f83,
-0x6030,0x6007,0x0000,0x6036,0x0000,0x0000,0x0000,0x5fe9,
-0x603d,0x6008,0x0000,0x0000,0x62ba,0x62b2,0x0000,0x62b7,
-0x62e4,0x62a7,0x0000,0x0000,0x0000,0x62d5,0x62e1,0x62dd,
-0x62a6,0x62c1,0x62c5,0x62c0,0x62df,0x62e0,0x62de,0x0000,
-0x6589,0x0000,0x65a6,0x65ba,0x0000,0x65ff,0x0000,0x6617,
-0x6618,0x6601,0x65fe,0x0000,0x670c,0x0000,0x676b,0x6796,
-0x6782,0x678a,0x0000,0x67a3,0x0000,0x67a2,0x678f,0x0000,
-0x67f9,0x6780,0x6b26,0x6b27,0x6b68,0x6b69,0x0000,0x6b81,
-0x6bb4,0x6bd1,0x0000,0x0000,0x6c1c,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x6c97,0x6c6c,0x6cdf,0x0000,0x6cea,0x0000,
-0x6ce4,0x6cd8,0x6cb2,0x6cce,0x6cc8,0x0000,0x708b,0x7088,
-0x7090,0x708f,0x0000,0x7087,0x7089,0x708d,0x7081,0x0000,
-0x708c,0x0000,0x0000,0x7240,0x0000,0x0000,0x7265,0x7266,
-0x7268,0x0000,0x0000,0x72cd,0x72d3,0x72db,0x0000,0x72cf,
-0x73a7,0x73a3,0x739e,0x0000,0x73af,0x0000,0x0000,0x73aa,
-0x739c,0x0000,0x7542,0x7544,0x753b,0x7541,0x0000,0x759b,
-0x759e,0x0000,0x79c4,0x79c3,0x79c6,0x0000,0x0000,0x79c7,
-0x0000,0x79ca,0x0000,0x0000,0x7acf,0x7c76,0x7c74,0x7cff,
-0x7cfc,0x0000,0x0000,0x7f59,0x80a8,0x0000,0x0000,0x80b0,
-0x0000,0x80b3,0x0000,0x80a4,0x80b6,0x80a7,0x80ac,0x0000,
-0x80a6,0x5367,0x820e,0x82c4,0x833e,0x829c,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x82aa,0x0000,0x82c9,0x0000,0x0000,
-0x82a6,0x82b2,0x0000,0x0000,0x0000,0x8fcc,0x8fd9,0x8fca,
-0x8fd8,0x8fcf,0x90b7,0x0000,0x90ad,0x90b9,0x9637,0x0000,
-0x9641,0x963e,0x96b6,0x9751,0x9763,0x4e57,0x4e79,0x4eb2,
-0x4eb0,0x4eaf,0x4eb1,0x4fd2,0x4fd5,0x0000,0x4fbe,0x4fb8,
-0x4fb0,0x4fb1,0x4fc8,0x0000,0x0000,0x4fc6,0x4fcc,0x4fe5,
-0x4fe3,0x4fb4,0x516a,0x0000,0x519f,0x0000,0x51c1,0x0000,
-0x51c2,0x51c3,0x5245,0x5248,0x0000,0x0000,0x524f,0x0000,
-0x0000,0x52c5,0x52ca,0x52c4,0x5327,0x5358,0x537d,0x0000,
-0x53dd,0x53dc,0x53da,0x53d9,0x54b9,0x0000,0x54d0,0x54b4,
-0x54ca,0x0000,0x54a3,0x54da,0x54a4,0x0000,0x54b2,0x549e,
-0x549f,0x54b5,0x0000,0x0000,0x54cd,0x0000,0x54cc,0x0000,
-0x5700,0x57ac,0x5791,0x578e,0x578d,0x5792,0x57a1,0x5790,
-0x57a6,0x57a8,0x0000,0x579c,0x5796,0x57a7,0x0000,0x0000,
-0x0000,0x0000,0x58f5,0x0000,0x5909,0x5908,0x0000,0x5952,
-0x0000,0x0000,0x59df,0x0000,0x59eb,0x59ef,0x59f0,0x59d5,
-0x5a0d,0x5a04,0x59f9,0x5a02,0x59f8,0x59e2,0x59d9,0x59e7,
-0x5b6a,0x0000,0x0000,0x5bab,0x0000,0x5c1b,0x5c2f,0x0000,
-0x663c,0x0000,0x0000,0x0000,0x5cd1,0x5cdc,0x5ce6,0x5ce1,
-0x5ccd,0x0000,0x5ce2,0x5cdd,0x5ce5,0x5dfb,0x5dfa,0x5e1e,
-0x0000,0x5ea1,0x0000,0x0000,0x5efc,0x5efb,0x5f2f,0x0000,
-0x0000,0x5f66,0x0000,0x0000,0x0000,0x605c,0x0000,0x604e,
-0x6051,0x0000,0x0000,0x6023,0x6031,0x607c,0x6052,0x0000,
-0x6060,0x604a,0x6061,0x0000,0x6218,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x631f,0x6317,0x62ea,0x6321,
-0x6304,0x6305,0x0000,0x6531,0x6544,0x6540,0x0000,0x6542,
-0x65be,0x0000,0x6629,0x661b,0x0000,0x6623,0x662c,0x661a,
-0x6630,0x663b,0x661e,0x6637,0x6638,0x0000,0x670e,0x0000,
-0x0000,0x67e8,0x67d6,0x0000,0x67c7,0x67bc,0x6852,0x67bf,
-0x67d5,0x67fe,0x8363,0x67fb,0x0000,0x67b1,0x6801,0x6805,
-0x6800,0x67d7,0x0000,0x6b2a,0x6b6b,0x0000,0x0000,0x0000,
-0x0000,0x6be1,0x0000,0x0000,0x6d23,0x6cff,0x6d14,0x6d05,
-0x6d13,0x6d06,0x6d21,0x0000,0x6d15,0x6caf,0x6cf4,0x6d02,
-0x6d45,0x0000,0x6d26,0x0000,0x6d44,0x0000,0x6d24,0x70a5,
-0x0000,0x70a3,0x0000,0x70a2,0x70bb,0x70a0,0x70aa,0x0000,
-0x0000,0x70a8,0x70b6,0x70b2,0x70a7,0x0000,0x0000,0x70b9,
-0x722e,0x0000,0x723c,0x0000,0x726d,0x0000,0x0000,0x72e7,
-0x72ed,0x0000,0x72ec,0x72e5,0x72e2,0x0000,0x73c4,0x73bd,
-0x73cf,0x73c9,0x73c1,0x73d0,0x0000,0x73ce,0x74ed,0x74eb,
-0x0000,0x74ef,0x7549,0x7550,0x7546,0x754a,0x0000,0x754d,
-0x75a6,0x0000,0x0000,0x0000,0x75a8,0x0000,0x0000,0x76c7,
-0x76ff,0x0000,0x76fd,0x77e6,0x780a,0x0000,0x7804,0x780b,
-0x7807,0x0000,0x7815,0x7808,0x0000,0x79d3,0x79d4,0x79d0,
-0x79d7,0x7a7c,0x0000,0x0000,0x7a7d,0x7a83,0x7a82,0x0000,
-0x7ad4,0x7ad5,0x7ad3,0x7ad0,0x7ad2,0x7afe,0x7afc,0x7c77,
-0x7c7c,0x7c7b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x7f8f,0x80d3,0x0000,0x80cb,0x80d2,0x0000,
-0x8109,0x80e2,0x80df,0x80c6,0x0000,0x8224,0x82f7,0x82d8,
-0x82dd,0x0000,0x0000,0x82f8,0x82fc,0x0000,0x0000,0x82e9,
-0x0000,0x82ee,0x0000,0x82d0,0x830e,0x82e2,0x830b,0x82fd,
-0x5179,0x8676,0x0000,0x8678,0x0000,0x0000,0x8675,0x867d,
-0x0000,0x8842,0x8866,0x0000,0x898c,0x8a05,0x0000,0x8a06,
-0x0000,0x8c9f,0x0000,0x8ff1,0x8fe7,0x8fe9,0x8fef,0x90c2,
-0x90bc,0x0000,0x90c6,0x90c0,0x0000,0x0000,0x90cd,0x90c9,
-0x0000,0x90c4,0x0000,0x9581,0x0000,0x9cec,0x5032,0x4ff9,
-0x501d,0x4fff,0x5004,0x4ff0,0x5003,0x0000,0x5002,0x4ffc,
-0x4ff2,0x5024,0x5008,0x5036,0x502e,0x0000,0x5010,0x5038,
-0x5039,0x4ffd,0x5056,0x4ffb,0x51a3,0x51a6,0x51a1,0x0000,
-0x0000,0x51c7,0x51c9,0x5260,0x5264,0x5259,0x5265,0x5267,
-0x5257,0x5263,0x0000,0x5253,0x0000,0x52cf,0x0000,0x52ce,
-0x52d0,0x52d1,0x52cc,0x0000,0x0000,0x0000,0x550d,0x54f4,
-0x0000,0x5513,0x54ef,0x54f5,0x54f9,0x5502,0x5500,0x0000,
-0x0000,0x5518,0x54f0,0x54f6,0x0000,0x0000,0x5519,0x0000,
-0x5705,0x57c9,0x0000,0x57b7,0x57cd,0x0000,0x0000,0x0000,
-0x57be,0x57bb,0x0000,0x57db,0x57c8,0x57c4,0x57c5,0x57d1,
-0x57ca,0x57c0,0x0000,0x0000,0x5a21,0x5a2a,0x0000,0x5a1d,
-0x0000,0x5a0b,0x0000,0x0000,0x0000,0x0000,0x5a22,0x0000,
-0x0000,0x5a24,0x0000,0x5a14,0x5a31,0x0000,0x5a2f,0x5a1a,
-0x5a12,0x0000,0x0000,0x5a26,0x0000,0x0000,0x5bbc,0x5bbb,
-0x5bb7,0x5c05,0x5c06,0x5c52,0x5c53,0x0000,0x0000,0x5cfa,
-0x5ceb,0x0000,0x5cf3,0x5cf5,0x5ce9,0x5cef,0x0000,0x5e2a,
-0x5e30,0x5e2e,0x5e2c,0x5e2f,0x5eaf,0x5ea9,0x0000,0x5efd,
-0x5f32,0x5f8e,0x5f93,0x5f8f,0x604f,0x6099,0x0000,0x607e,
-0x0000,0x6074,0x604b,0x6073,0x6075,0x0000,0x0000,0x6056,
-0x60a9,0x608b,0x60a6,0x0000,0x6093,0x60ae,0x609e,0x60a7,
-0x6245,0x0000,0x0000,0x632e,0x0000,0x6352,0x6330,0x635b,
-0x0000,0x6319,0x631b,0x0000,0x6331,0x635d,0x6337,0x6335,
-0x6353,0x0000,0x635c,0x633f,0x654b,0x0000,0x0000,0x658b,
-0x0000,0x659a,0x6650,0x6646,0x664e,0x6640,0x0000,0x664b,
-0x6648,0x0000,0x6660,0x6644,0x664d,0x0000,0x6837,0x6824,
-0x0000,0x0000,0x681b,0x6836,0x0000,0x682c,0x6819,0x6856,
-0x6847,0x683e,0x681e,0x0000,0x6815,0x6822,0x6827,0x6859,
-0x6858,0x6855,0x6830,0x6823,0x6b2e,0x6b2b,0x6b30,0x6b6c,
-0x0000,0x6b8b,0x0000,0x6be9,0x6bea,0x6be5,0x6d6b,0x0000,
-0x0000,0x6d73,0x6d57,0x0000,0x0000,0x6d5d,0x6d56,0x6d8f,
-0x6d5b,0x6d1c,0x6d9a,0x6d9b,0x6d99,0x0000,0x6d81,0x6d71,
-0x0000,0x0000,0x6d72,0x6d5c,0x6d96,0x70c4,0x70db,0x70cc,
-0x70d0,0x70e3,0x70df,0x0000,0x70d6,0x70ee,0x70d5,0x0000,
-0x0000,0x0000,0x0000,0x727a,0x0000,0x72f5,0x7302,0x0000,
-0x0000,0x73e2,0x73ec,0x73d5,0x73f9,0x73df,0x73e6,0x0000,
-0x0000,0x0000,0x0000,0x73e4,0x73e1,0x74f3,0x0000,0x0000,
-0x0000,0x0000,0x7556,0x7555,0x7558,0x7557,0x755e,0x75c3,
-0x0000,0x0000,0x75b4,0x0000,0x75b1,0x0000,0x0000,0x76cb,
-0x76cc,0x772a,0x0000,0x7716,0x770f,0x0000,0x0000,0x773f,
-0x772b,0x770e,0x7724,0x0000,0x7721,0x7718,0x77dd,0x0000,
-0x0000,0x7824,0x7836,0x0000,0x7958,0x7959,0x0000,0x7962,
-0x79da,0x79d9,0x0000,0x79e1,0x79e5,0x79e8,0x79db,0x0000,
-0x79e2,0x79f0,0x0000,0x0000,0x0000,0x0000,0x7ada,0x7add,
-0x0000,0x7adb,0x7adc,0x0000,0x0000,0x7b0d,0x7b0b,0x7b14,
-0x7c8e,0x7c86,0x0000,0x7c87,0x7c83,0x7c8b,0x0000,0x0000,
-0x0000,0x0000,0x7d24,0x0000,0x0000,0x0000,0x7d25,0x7f62,
-0x7f93,0x7f99,0x7f97,0x0000,0x0000,0x7fc4,0x7fc6,0x800a,
-0x0000,0x0000,0x8040,0x803c,0x803b,0x80f6,0x80ff,0x80ee,
-0x8104,0x8103,0x8107,0x0000,0x0000,0x80f7,0x0000,0x0000,
-0x822d,0x0000,0x8227,0x8229,0x831f,0x8357,0x0000,0x0000,
-0x0000,0x0000,0x8321,0x0000,0x0000,0x8318,0x8358,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x8684,0x869f,0x869b,0x8689,
-0x86a6,0x8692,0x868f,0x86a0,0x884f,0x8878,0x887a,0x886e,
-0x887b,0x8884,0x8873,0x0000,0x0000,0x8a0d,0x8a0b,0x8a19,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x8ff9,0x9009,
-0x9008,0x0000,0x90de,0x9151,0x0000,0x0000,0x91db,0x91df,
-0x91de,0x91d6,0x91e0,0x9585,0x9660,0x9659,0x0000,0x9656,
-0x0000,0x0000,0x96bd,0x0000,0x0000,0x5042,0x5059,0x0000,
-0x5044,0x5066,0x5052,0x5054,0x5071,0x5050,0x507b,0x507c,
-0x5058,0x0000,0x0000,0x5079,0x506c,0x5078,0x51a8,0x51d1,
-0x51cf,0x5268,0x5276,0x52d4,0x0000,0x53a0,0x53c4,0x0000,
-0x5558,0x554c,0x5568,0x0000,0x5549,0x0000,0x0000,0x555d,
-0x5529,0x0000,0x5554,0x5553,0x0000,0x555a,0x0000,0x553a,
-0x553f,0x552b,0x57ea,0x0000,0x57ef,0x0000,0x0000,0x57dd,
-0x57fe,0x0000,0x57de,0x57e6,0x0000,0x57e8,0x57ff,0x5803,
-0x58f7,0x68a6,0x591f,0x0000,0x595b,0x595d,0x595e,0x0000,
-0x0000,0x5a2b,0x0000,0x5a3b,0x0000,0x0000,0x5a61,0x5a3a,
-0x5a6e,0x5a4b,0x5a6b,0x0000,0x0000,0x5a45,0x5a4e,0x5a68,
-0x5a3d,0x5a71,0x5a3f,0x5a6f,0x5a75,0x0000,0x5a73,0x5a2c,
-0x5a59,0x5a54,0x5a4f,0x5a63,0x0000,0x0000,0x5bc8,0x0000,
-0x5bc3,0x0000,0x5c5b,0x5c61,0x0000,0x5d21,0x5d0a,0x5d09,
-0x0000,0x5d2c,0x5d08,0x0000,0x0000,0x5d2a,0x5d15,0x0000,
-0x5d10,0x5d13,0x0000,0x5d2f,0x5d18,0x0000,0x5de3,0x5e39,
-0x5e35,0x5e3a,0x5e32,0x0000,0x0000,0x0000,0x0000,0x5ebb,
-0x5eba,0x5f34,0x5f39,0x0000,0x0000,0x0000,0x0000,0x6098,
-0x0000,0x60d0,0x0000,0x0000,0x0000,0x60d7,0x60aa,0x0000,
-0x60a1,0x60a4,0x0000,0x60ee,0x0000,0x60e7,0x0000,0x0000,
-0x60de,0x0000,0x0000,0x637e,0x638b,0x0000,0x0000,0x6379,
-0x6386,0x6393,0x0000,0x6373,0x636a,0x0000,0x636c,0x0000,
-0x637f,0x0000,0x63b2,0x63ba,0x0000,0x0000,0x6366,0x6374,
-0x0000,0x655a,0x0000,0x654e,0x654d,0x658d,0x658e,0x65ad,
-0x0000,0x65c7,0x65ca,0x0000,0x65c9,0x0000,0x65e3,0x6657,
-0x0000,0x6663,0x6667,0x671a,0x6719,0x6716,0x0000,0x0000,
-0x689e,0x68b6,0x6898,0x6873,0x0000,0x689a,0x688e,0x68b7,
-0x68db,0x68a5,0x686c,0x68c1,0x6884,0x0000,0x0000,0x6895,
-0x687a,0x6899,0x0000,0x68b8,0x68b9,0x6870,0x0000,0x6b35,
-0x0000,0x6b90,0x6bbb,0x6bed,0x0000,0x0000,0x0000,0x6dc1,
-0x6dc3,0x6dce,0x0000,0x0000,0x6dad,0x6e04,0x0000,0x6db9,
-0x0000,0x6de7,0x0000,0x6e08,0x6e06,0x0000,0x6e0a,0x6db0,
-0x0000,0x6df8,0x6e0c,0x0000,0x6db1,0x0000,0x6e02,0x6e07,
-0x6e09,0x6e01,0x6e17,0x6dff,0x6e12,0x0000,0x0000,0x7103,
-0x7107,0x7101,0x70f5,0x70f1,0x7108,0x70f2,0x710f,0x0000,
-0x70fe,0x0000,0x0000,0x0000,0x731a,0x7310,0x730e,0x7402,
-0x73f3,0x0000,0x0000,0x73fb,0x0000,0x0000,0x0000,0x751b,
-0x7523,0x7561,0x7568,0x0000,0x7567,0x75d3,0x0000,0x0000,
-0x7690,0x0000,0x0000,0x76d5,0x76d7,0x76d6,0x7730,0x0000,
-0x7726,0x0000,0x7740,0x0000,0x771e,0x0000,0x0000,0x0000,
-0x7847,0x0000,0x784b,0x7851,0x784f,0x7842,0x7846,0x0000,
-0x796e,0x796c,0x79f2,0x0000,0x79f1,0x79f5,0x79f3,0x79f9,
-0x0000,0x0000,0x0000,0x7a9a,0x7a93,0x7a91,0x7ae1,0x0000,
-0x0000,0x7b21,0x7b1c,0x7b16,0x7b17,0x7b36,0x7b1f,0x0000,
-0x7c93,0x7c99,0x7c9a,0x7c9c,0x0000,0x7d49,0x0000,0x7d34,
-0x7d37,0x0000,0x7d2d,0x0000,0x7d4c,0x0000,0x0000,0x7d48,
-0x0000,0x0000,0x7f3b,0x0000,0x0000,0x0000,0x0000,0x8008,
-0x801a,0x0000,0x801d,0x0000,0x8049,0x8045,0x8044,0x7c9b,
-0x0000,0x0000,0x812a,0x812e,0x0000,0x0000,0x8131,0x0000,
-0x811a,0x8134,0x8117,0x0000,0x0000,0x0000,0x831d,0x8371,
-0x8384,0x8380,0x8372,0x83a1,0x0000,0x8379,0x8391,0x0000,
-0x839f,0x83ad,0x0000,0x0000,0x8323,0x0000,0x8385,0x839c,
-0x83b7,0x8658,0x865a,0x0000,0x8657,0x86b2,0x0000,0x86ae,
-0x0000,0x0000,0x0000,0x8845,0x889c,0x8894,0x88a3,0x888f,
-0x88a5,0x88a9,0x88a6,0x888a,0x88a0,0x8890,0x8992,0x8991,
-0x8994,0x0000,0x8a26,0x8a32,0x8a28,0x0000,0x0000,0x8a1c,
-0x0000,0x8a2b,0x8a20,0x0000,0x8a29,0x0000,0x0000,0x0000,
-0x8a21,0x8c3a,0x0000,0x8c5b,0x8c58,0x8c7c,0x0000,0x8ca6,
-0x8cae,0x8cad,0x8d65,0x0000,0x8d7e,0x0000,0x8d7c,0x8d7f,
-0x8d7a,0x8dbd,0x0000,0x0000,0x8dc0,0x8dbb,0x8ead,0x8eaf,
-0x8ed6,0x0000,0x0000,0x0000,0x0000,0x0000,0x8ed9,0x0000,
-0x0000,0x9012,0x900e,0x9025,0x0000,0x9013,0x90ee,0x0000,
-0x90ab,0x90f7,0x0000,0x9159,0x9154,0x91f2,0x91f0,0x91e5,
-0x91f6,0x0000,0x0000,0x9587,0x0000,0x965a,0x0000,0x0000,
-0x966e,0x0000,0x0000,0x0000,0x9679,0x0000,0x98e1,0x98e6,
-0x0000,0x9ec4,0x9ed2,0x4e80,0x0000,0x4e81,0x508f,0x5097,
-0x5088,0x5089,0x0000,0x0000,0x5081,0x5160,0x0000,0x0000,
-0x5e42,0x51d3,0x0000,0x0000,0x51d2,0x51d6,0x5273,0x0000,
-0x5270,0x0000,0x0000,0x0000,0x53a8,0x53a6,0x53c5,0x5597,
-0x55de,0x0000,0x0000,0x5596,0x55b4,0x0000,0x5585,0x0000,
-0x559b,0x55a0,0x0000,0x5559,0x0000,0x5586,0x0000,0x0000,
-0x55af,0x557a,0x0000,0x0000,0x0000,0x559e,0x0000,0x55a9,
-0x570f,0x570e,0x581a,0x0000,0x581f,0x0000,0x583c,0x5818,
-0x583e,0x5826,0x0000,0x583a,0x0000,0x5822,0x0000,0x58fb,
-0x5963,0x5964,0x0000,0x5aa8,0x5aa3,0x5a82,0x5a88,0x5aa1,
-0x5a85,0x5a98,0x0000,0x5a99,0x0000,0x5a89,0x5a81,0x5a96,
-0x5a80,0x0000,0x0000,0x5a91,0x0000,0x0000,0x0000,0x0000,
-0x5acf,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x5a87,
-0x5aa0,0x0000,0x5a79,0x0000,0x5a86,0x5aab,0x5aaa,0x5aa4,
-0x5a8d,0x5a7e,0x0000,0x5bd5,0x0000,0x0000,0x0000,0x5c1e,
-0x5c5f,0x5c5e,0x5d44,0x5d3e,0x0000,0x5d48,0x5d1c,0x0000,
-0x5d5b,0x5d4d,0x0000,0x0000,0x5d57,0x0000,0x5d53,0x5d4f,
-0x0000,0x5d3b,0x5d46,0x0000,0x0000,0x5e46,0x5e47,0x0000,
-0x5e48,0x5ec0,0x5ebd,0x5ebf,0x0000,0x5f11,0x0000,0x5f3e,
-0x5f3b,0x0000,0x5f3a,0x0000,0x0000,0x0000,0x5fa7,0x0000,
-0x60ea,0x0000,0x6107,0x6122,0x610c,0x0000,0x0000,0x60b3,
-0x60d6,0x60d2,0x0000,0x60e3,0x60e5,0x60e9,0x0000,0x0000,
-0x6111,0x60fd,0x0000,0x0000,0x611e,0x6120,0x6121,0x621e,
-0x0000,0x63e2,0x63de,0x63e6,0x0000,0x0000,0x0000,0x0000,
-0x63f8,0x0000,0x63fe,0x63c1,0x63bf,0x63f7,0x63d1,0x655f,
-0x6560,0x6561,0x0000,0x0000,0x65d1,0x0000,0x0000,0x667d,
-0x666b,0x667f,0x0000,0x0000,0x6673,0x6681,0x666d,0x6669,
-0x0000,0x0000,0x671e,0x68ed,0x0000,0x0000,0x0000,0x0000,
-0x6903,0x0000,0x68fe,0x68e5,0x691e,0x6902,0x0000,0x0000,
-0x6909,0x68ca,0x6900,0x0000,0x6901,0x6918,0x68e2,0x68cf,
-0x0000,0x692e,0x68c5,0x68ff,0x0000,0x691c,0x68c3,0x0000,
-0x6b6f,0x0000,0x6b6e,0x0000,0x6bbe,0x0000,0x6bf4,0x6c2d,
-0x0000,0x6db6,0x6e75,0x6e1e,0x0000,0x6e18,0x0000,0x6e48,
-0x0000,0x6e4f,0x0000,0x6e42,0x6e6a,0x6e70,0x6dfe,0x0000,
-0x0000,0x6e6d,0x0000,0x6e7b,0x6e7e,0x6e59,0x0000,0x6e57,
-0x0000,0x6e80,0x6e50,0x0000,0x6e29,0x6e76,0x6e2a,0x6e4c,
-0x712a,0x0000,0x7135,0x712c,0x7137,0x711d,0x0000,0x0000,
-0x7138,0x0000,0x7134,0x712b,0x7133,0x7127,0x7124,0x0000,
-0x712d,0x7232,0x7283,0x7282,0x7287,0x7306,0x7324,0x7338,
-0x732a,0x732c,0x732b,0x0000,0x732f,0x7328,0x7417,0x0000,
-0x0000,0x7419,0x7438,0x0000,0x741f,0x7414,0x743c,0x73f7,
-0x741c,0x7415,0x7418,0x7439,0x74f9,0x7524,0x0000,0x0000,
-0x0000,0x756e,0x756d,0x7571,0x758e,0x0000,0x75e5,0x0000,
-0x0000,0x0000,0x0000,0x7694,0x76b3,0x0000,0x76d9,0x0000,
-0x7748,0x7749,0x7743,0x0000,0x0000,0x7742,0x77df,0x0000,
-0x7863,0x7876,0x0000,0x785f,0x7866,0x7966,0x7971,0x0000,
-0x0000,0x7976,0x7984,0x7975,0x79ff,0x7a07,0x0000,0x7a0e,
-0x7a09,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7ae7,
-0x7ae2,0x7b55,0x0000,0x0000,0x7b43,0x7b57,0x7b6c,0x7b42,
-0x7b53,0x0000,0x7b41,0x0000,0x0000,0x7ca7,0x7ca0,0x7ca6,
-0x7ca4,0x7d74,0x0000,0x7d59,0x0000,0x7d60,0x7d57,0x7d6c,
-0x7d7e,0x7d64,0x0000,0x7d5a,0x7d5d,0x0000,0x0000,0x0000,
-0x7d76,0x7d4d,0x7d75,0x0000,0x7fd3,0x7fd6,0x0000,0x0000,
-0x8060,0x804e,0x8145,0x813b,0x0000,0x8148,0x8142,0x8149,
-0x8140,0x8114,0x8141,0x0000,0x81ef,0x81f6,0x8203,0x0000,
-0x83ed,0x0000,0x83da,0x8418,0x83d2,0x8408,0x0000,0x8400,
-0x0000,0x0000,0x0000,0x8417,0x8346,0x8414,0x83d3,0x8405,
-0x841f,0x8402,0x8416,0x83cd,0x83e6,0x0000,0x865d,0x86d5,
-0x86e1,0x0000,0x0000,0x0000,0x0000,0x86ee,0x8847,0x8846,
-0x0000,0x0000,0x88bb,0x0000,0x88bf,0x88b4,0x0000,0x88b5,
-0x0000,0x899a,0x8a43,0x0000,0x0000,0x8a5a,0x0000,0x0000,
-0x0000,0x8a35,0x8a38,0x8a42,0x8a49,0x8a5d,0x8a4b,0x8a3d,
-0x0000,0x0000,0x0000,0x0000,0x8c60,0x8c5e,0x8c7f,0x8c7e,
-0x8c83,0x0000,0x8cb1,0x8d87,0x0000,0x0000,0x8d88,0x8d83,
-0x0000,0x0000,0x8d86,0x8d8b,0x8d82,0x8dca,0x8dd2,0x0000,
-0x0000,0x8dd4,0x8dc9,0x8eb0,0x0000,0x0000,0x0000,0x8ef2,
-0x8ee4,0x8ef3,0x8eea,0x0000,0x8efd,0x0000,0x8f9d,0x902b,
-0x902a,0x0000,0x9028,0x9029,0x902c,0x0000,0x0000,0x903a,
-0x9030,0x9037,0x903b,0x0000,0x910a,0x0000,0x0000,0x0000,
-0x91fe,0x9220,0x0000,0x920b,0x0000,0x9218,0x9222,0x0000,
-0x921b,0x9208,0x0000,0x920e,0x9213,0x0000,0x0000,0x9595,
-0x0000,0x0000,0x0000,0x968c,0x967b,0x967f,0x9681,0x0000,
-0x9682,0x0000,0x0000,0x0000,0x0000,0x0000,0x96ee,0x96ed,
-0x0000,0x96ec,0x975f,0x976f,0x0000,0x976d,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x98f0,0x0000,0x0000,0x0000,
-0x9aa9,0x0000,0x0000,0x9ae0,0x4eb7,0x0000,0x0000,0x50cc,
-0x50bc,0x0000,0x50aa,0x50b9,0x0000,0x50ab,0x50c3,0x50cd,
-0x517e,0x527e,0x5279,0x0000,0x0000,0x52e1,0x52e0,0x52e7,
-0x5380,0x53ab,0x53aa,0x53a9,0x53e0,0x55ea,0x0000,0x55d7,
-0x0000,0x0000,0x55c1,0x5715,0x0000,0x586c,0x0000,0x585c,
-0x5850,0x5861,0x586a,0x5869,0x5856,0x5860,0x5866,0x585f,
-0x5923,0x5966,0x5968,0x0000,0x0000,0x5ace,0x0000,0x5ac5,
-0x5ac3,0x0000,0x0000,0x5ad0,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x5b74,0x5b76,0x5bdc,0x5bd7,0x5bda,0x5bdb,
-0x0000,0x5c20,0x5d6d,0x5d66,0x0000,0x5d64,0x5d6e,0x0000,
-0x5d60,0x5f42,0x5f5a,0x5f6e,0x0000,0x0000,0x6130,0x613a,
-0x612a,0x6143,0x6119,0x6131,0x0000,0x613d,0x0000,0x0000,
-0x0000,0x6408,0x6432,0x6438,0x0000,0x6431,0x0000,0x6419,
-0x0000,0x6411,0x0000,0x0000,0x6429,0x641d,0x0000,0x0000,
-0x0000,0x643c,0x0000,0x6446,0x6447,0x0000,0x0000,0x643a,
-0x6407,0x0000,0x656b,0x0000,0x6570,0x656d,0x0000,0x65e4,
-0x6693,0x0000,0x0000,0x0000,0x0000,0x668f,0x0000,0x0000,
-0x6692,0x0000,0x668e,0x0000,0x6946,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x6931,0x0000,0x0000,0x693e,
-0x0000,0x697c,0x6943,0x0000,0x6973,0x0000,0x6955,0x0000,
-0x0000,0x6985,0x694d,0x6950,0x6947,0x6967,0x6936,0x6964,
-0x6961,0x0000,0x697d,0x6b44,0x6b40,0x6b71,0x6b73,0x6b9c,
-0x0000,0x0000,0x0000,0x6bc1,0x0000,0x6bfa,0x6c31,0x6c32,
-0x0000,0x0000,0x6eb8,0x6ea8,0x0000,0x6e91,0x6ebb,0x0000,
-0x6e9a,0x0000,0x0000,0x6ea9,0x0000,0x0000,0x6eb5,0x6e6c,
-0x6ee8,0x0000,0x6edd,0x6eda,0x6ee6,0x6eac,0x0000,0x0000,
-0x0000,0x6ed9,0x6ee3,0x6ee9,0x6edb,0x0000,0x716f,0x0000,
-0x0000,0x7148,0x0000,0x714a,0x716b,0x0000,0x714f,0x7157,
-0x7174,0x0000,0x0000,0x0000,0x7145,0x7151,0x716d,0x0000,
-0x7251,0x7250,0x724e,0x0000,0x7341,0x0000,0x732e,0x7346,
-0x0000,0x7427,0x0000,0x7448,0x7453,0x743d,0x0000,0x745d,
-0x7456,0x0000,0x741e,0x7447,0x7443,0x7458,0x7449,0x0000,
-0x744c,0x7445,0x743e,0x0000,0x7501,0x751e,0x0000,0x0000,
-0x757a,0x75ee,0x7602,0x7697,0x7698,0x0000,0x0000,0x0000,
-0x775d,0x7764,0x7753,0x7758,0x7882,0x7890,0x788a,0x0000,
-0x787a,0x787d,0x0000,0x788b,0x7878,0x0000,0x0000,0x788d,
-0x7888,0x7892,0x7881,0x797e,0x7983,0x0000,0x0000,0x0000,
-0x7980,0x0000,0x0000,0x0000,0x7a0f,0x0000,0x0000,0x7a1d,
-0x0000,0x7aa1,0x7aa4,0x0000,0x7ae9,0x7aea,0x0000,0x7b62,
-0x7b6b,0x0000,0x7b5e,0x0000,0x7b79,0x0000,0x0000,0x7b6f,
-0x7b68,0x0000,0x0000,0x7cae,0x0000,0x0000,0x0000,0x7cb0,
-0x0000,0x7d90,0x0000,0x7d8a,0x0000,0x7d8b,0x7d99,0x7d95,
-0x0000,0x7d87,0x7d78,0x7d97,0x7d89,0x7d98,0x0000,0x0000,
-0x0000,0x7fa3,0x0000,0x0000,0x0000,0x7fdd,0x8057,0x0000,
-0x8163,0x816a,0x816c,0x0000,0x0000,0x0000,0x815d,0x8175,
-0x0000,0x815f,0x0000,0x817d,0x816d,0x0000,0x0000,0x8241,
-0x844f,0x8484,0x0000,0x847f,0x0000,0x8448,0x842a,0x847b,
-0x8472,0x8464,0x842e,0x845c,0x8453,0x0000,0x8441,0x84c8,
-0x0000,0x8462,0x8480,0x843e,0x8483,0x8471,0x0000,0x844a,
-0x8455,0x8458,0x0000,0x0000,0x0000,0x86fc,0x86fd,0x8715,
-0x0000,0x8716,0x86ff,0x0000,0x0000,0x0000,0x8858,0x88cf,
-0x88e0,0x0000,0x0000,0x0000,0x0000,0x89e7,0x8a6a,0x8a80,
-0x0000,0x8a6f,0x8a65,0x0000,0x8a78,0x8a7d,0x8a88,0x0000,
-0x0000,0x8a64,0x8a7e,0x0000,0x8a67,0x8c63,0x8c88,0x0000,
-0x8ccd,0x0000,0x8cc9,0x0000,0x8ded,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x8eb1,0x0000,0x0000,0x8f04,
-0x8f9e,0x8fa0,0x9043,0x9046,0x9048,0x9045,0x9040,0x904c,
-0x0000,0x0000,0x910c,0x9113,0x9115,0x0000,0x916b,0x9167,
-0x925d,0x9255,0x9235,0x0000,0x9259,0x922f,0x923c,0x928f,
-0x925c,0x926a,0x9262,0x925f,0x926b,0x926e,0x923b,0x9244,
-0x9241,0x959a,0x0000,0x9599,0x0000,0x0000,0x0000,0x968f,
-0x0000,0x9696,0x0000,0x0000,0x0000,0x96f4,0x96fc,0x0000,
-0x9755,0x0000,0x9779,0x0000,0x0000,0x0000,0x97ee,0x97f5,
-0x0000,0x980b,0x0000,0x98f3,0x0000,0x0000,0x98f7,0x98ff,
-0x98f5,0x0000,0x98ec,0x98f1,0x0000,0x0000,0x999a,0x0000,
-0x9ae2,0x9b3d,0x9b5d,0x9ce8,0x0000,0x9ceb,0x9cef,0x9cee,
-0x9e81,0x9f14,0x50d0,0x50d9,0x50dc,0x50d8,0x0000,0x50e1,
-0x50eb,0x0000,0x0000,0x50f4,0x50e2,0x50de,0x0000,0x0000,
-0x0000,0x51f4,0x0000,0x0000,0x0000,0x52ed,0x52ea,0x0000,
-0x5332,0x0000,0x53ae,0x53b0,0x0000,0x55fb,0x5603,0x560b,
-0x0000,0x5607,0x0000,0x55f8,0x0000,0x5628,0x561e,0x0000,
-0x5618,0x5611,0x5651,0x5605,0x5717,0x5892,0x0000,0x588c,
-0x0000,0x5878,0x5884,0x5873,0x58ad,0x5897,0x5895,0x5877,
-0x5872,0x5896,0x588d,0x5910,0x0000,0x596c,0x0000,0x5ae7,
-0x0000,0x5ae4,0x0000,0x0000,0x5aef,0x5626,0x0000,0x0000,
-0x5af0,0x5d7b,0x0000,0x5d83,0x0000,0x0000,0x5d8b,0x5d8c,
-0x0000,0x5d78,0x5e52,0x0000,0x0000,0x5ed0,0x5ecf,0x0000,
-0x5fb3,0x5fb4,0x0000,0x0000,0x0000,0x617b,0x0000,0x616f,
-0x6181,0x613c,0x6142,0x6138,0x6133,0x0000,0x6160,0x6169,
-0x617d,0x6186,0x622c,0x6228,0x0000,0x644c,0x0000,0x6457,
-0x647c,0x0000,0x0000,0x6455,0x6462,0x6471,0x646a,0x6456,
-0x643b,0x6481,0x0000,0x644f,0x647e,0x6464,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x6571,0x0000,0x0000,0x66a5,0x669a,
-0x669c,0x0000,0x66a6,0x0000,0x66a4,0x698f,0x69c5,0x69c8,
-0x6992,0x69b2,0x0000,0x0000,0x0000,0x69e3,0x69c0,0x69d6,
-0x69d1,0x699f,0x69a2,0x69d2,0x0000,0x0000,0x0000,0x69e1,
-0x69d5,0x699d,0x0000,0x0000,0x6998,0x0000,0x6b74,0x6ba1,
-0x0000,0x6ef0,0x6ef3,0x0000,0x0000,0x6f1b,0x6f0c,0x6f1d,
-0x6f34,0x6f28,0x6f17,0x0000,0x6f44,0x6f42,0x6f04,0x6f11,
-0x6efa,0x6f4a,0x7191,0x718e,0x0000,0x718b,0x718d,0x717f,
-0x718c,0x717e,0x717c,0x7183,0x0000,0x7188,0x0000,0x0000,
-0x7294,0x0000,0x7355,0x7353,0x734f,0x7354,0x746c,0x7465,
-0x7466,0x7461,0x746b,0x7468,0x7476,0x0000,0x7460,0x0000,
-0x7474,0x7506,0x760e,0x0000,0x7607,0x0000,0x0000,0x76b9,
-0x0000,0x76b7,0x76e2,0x0000,0x7774,0x7777,0x7776,0x7775,
-0x0000,0x7778,0x7771,0x0000,0x777a,0x715b,0x777b,0x78a6,
-0x78ae,0x78b8,0x0000,0x0000,0x0000,0x78b1,0x78af,0x0000,
-0x7989,0x7987,0x0000,0x0000,0x7a29,0x0000,0x7a2a,0x0000,
-0x7a2d,0x7a2c,0x0000,0x7a32,0x0000,0x7aec,0x7af0,0x7b81,
-0x7b9e,0x7b83,0x0000,0x7b92,0x0000,0x7ba3,0x7b9f,0x7b93,
-0x0000,0x7b86,0x7cb8,0x7cb7,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x7dc8,0x7db6,0x0000,0x7dd1,0x0000,0x7da8,0x7dab,
-0x0000,0x7db3,0x7dcd,0x0000,0x7dcf,0x7da4,0x0000,0x0000,
-0x7f41,0x7f6f,0x7f71,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x8023,0x805b,0x0000,0x8061,0x805f,0x8181,0x0000,
-0x0000,0x8184,0x8213,0x0000,0x824a,0x824c,0x0000,0x0000,
-0x0000,0x84bd,0x8495,0x0000,0x8492,0x84c3,0x0000,0x8496,
-0x84a5,0x84b5,0x84b3,0x84a3,0x84e4,0x84d8,0x84d5,0x0000,
-0x84b7,0x84ad,0x84da,0x8493,0x8736,0x0000,0x0000,0x0000,
-0x873d,0x872b,0x8747,0x8739,0x0000,0x8745,0x871d,0x0000,
-0x88ff,0x88ea,0x0000,0x88f5,0x0000,0x8900,0x88ed,0x8903,
-0x88e9,0x0000,0x0000,0x89ea,0x0000,0x8a9b,0x8a8e,0x8aa2,
-0x0000,0x8a9c,0x8a94,0x8a90,0x8aa9,0x8aac,0x0000,0x8a9f,
-0x0000,0x0000,0x8a9d,0x0000,0x8c67,0x0000,0x0000,0x8cd0,
-0x8cd6,0x8cd4,0x8d98,0x8d9a,0x8d97,0x0000,0x0000,0x0000,
-0x8e0b,0x8e08,0x8e01,0x8eb4,0x8eb3,0x0000,0x8fa1,0x8fa2,
-0x0000,0x905a,0x0000,0x9061,0x905f,0x0000,0x0000,0x9125,
-0x917b,0x9176,0x917c,0x0000,0x9289,0x92f6,0x92b1,0x92ad,
-0x9292,0x9281,0x9284,0x0000,0x92ae,0x9290,0x929e,0x0000,
-0x0000,0x0000,0x95a2,0x95a7,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x96a0,0x969d,0x969f,0x96d0,0x0000,0x96d1,0x0000,
-0x0000,0x9759,0x0000,0x9764,0x0000,0x0000,0x0000,0x9819,
-0x0000,0x9814,0x9815,0x981a,0x0000,0x0000,0x0000,0x0000,
-0x9906,0x0000,0x98f8,0x9901,0x0000,0x99be,0x99bc,0x99b7,
-0x99b6,0x99c0,0x0000,0x99b8,0x0000,0x0000,0x0000,0x99c4,
-0x0000,0x99bf,0x0000,0x9ada,0x9ae4,0x9ae9,0x9ae8,0x9aea,
-0x9ae5,0x0000,0x9b26,0x0000,0x0000,0x9b40,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x9ebd,0x0000,0x0000,
-0x0000,0x0000,0x510e,0x0000,0x50f7,0x0000,0x50fc,0x510d,
-0x5101,0x51da,0x51d9,0x51db,0x5286,0x528e,0x52ee,0x5333,
-0x53b1,0x0000,0x5647,0x562d,0x5654,0x0000,0x564b,0x5652,
-0x5631,0x5644,0x5656,0x5650,0x562b,0x0000,0x564d,0x5637,
-0x564f,0x58a2,0x58b7,0x0000,0x58b2,0x0000,0x58aa,0x58b5,
-0x58b0,0x0000,0x58b4,0x58a4,0x58a7,0x0000,0x5926,0x5afe,
-0x0000,0x5b04,0x0000,0x5afc,0x0000,0x5b06,0x5b0a,0x5afa,
-0x5b0d,0x5b00,0x5b0e,0x0000,0x0000,0x0000,0x5d91,0x0000,
-0x5d8f,0x5d90,0x5d98,0x5da4,0x5d9b,0x5da3,0x5d96,0x5de4,
-0x5e5a,0x0000,0x0000,0x5e5e,0x0000,0x5fb8,0x6157,0x615c,
-0x61a6,0x6195,0x6188,0x0000,0x61a3,0x618f,0x0000,0x6164,
-0x0000,0x6159,0x6178,0x0000,0x6185,0x6187,0x619e,0x0000,
-0x0000,0x6198,0x619c,0x0000,0x0000,0x622f,0x6480,0x649b,
-0x648e,0x648d,0x6494,0x64c6,0x0000,0x64a8,0x6483,0x0000,
-0x64b9,0x6486,0x64b4,0x64af,0x6491,0x0000,0x64aa,0x64a1,
-0x64a7,0x66b6,0x66b3,0x0000,0x66bc,0x66ac,0x0000,0x66ad,
-0x6a0e,0x0000,0x6a1c,0x6a1a,0x0000,0x0000,0x6a0b,0x0000,
-0x69ef,0x6a0c,0x69f0,0x6a22,0x0000,0x69d8,0x0000,0x6a12,
-0x69fa,0x0000,0x6a2a,0x0000,0x6a10,0x0000,0x0000,0x6a29,
-0x69f9,0x69ea,0x6a2c,0x6a24,0x0000,0x69e9,0x6b52,0x6b4f,
-0x6b53,0x0000,0x0000,0x6f10,0x6f65,0x6f75,0x0000,0x0000,
-0x0000,0x0000,0x6fd0,0x0000,0x6f5c,0x6f3d,0x6f71,0x0000,
-0x6f91,0x6f0b,0x6f79,0x6f81,0x6f8f,0x0000,0x6f59,0x6f74,
-0x0000,0x71ae,0x0000,0x71a3,0x71ad,0x0000,0x0000,0x71ab,
-0x71a6,0x71a2,0x0000,0x52f2,0x7257,0x7255,0x7299,0x734b,
-0x747a,0x0000,0x0000,0x0000,0x748c,0x7484,0x0000,0x0000,
-0x7482,0x7493,0x747b,0x0000,0x7509,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x778a,0x0000,0x7790,0x0000,0x78c6,
-0x78d3,0x78c0,0x78d2,0x78c7,0x78c2,0x0000,0x799f,0x799d,
-0x799e,0x0000,0x7a41,0x0000,0x7a38,0x7a3a,0x7a42,0x0000,
-0x0000,0x7a3e,0x7ab0,0x7bae,0x7bb3,0x0000,0x0000,0x7bbf,
-0x0000,0x0000,0x7bcd,0x0000,0x7bb2,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x7cc4,0x7ccd,0x7cc2,0x7cc6,
-0x7cc3,0x7cc9,0x7cc7,0x0000,0x7df8,0x0000,0x7ded,0x7de2,
-0x0000,0x0000,0x0000,0x7ddc,0x7e02,0x7e01,0x0000,0x7dd6,
-0x0000,0x7de4,0x7dfe,0x0000,0x7e00,0x7dfc,0x7dfd,0x0000,
-0x7df5,0x7dff,0x0000,0x7deb,0x7de5,0x7f78,0x7fae,0x7fe7,
-0x0000,0x8065,0x806a,0x8066,0x8068,0x806b,0x8194,0x81a1,
-0x8192,0x8196,0x8193,0x0000,0x0000,0x8501,0x0000,0x84f8,
-0x0000,0x84f5,0x0000,0x8504,0x0000,0x0000,0x0000,0x0000,
-0x851b,0x8503,0x8533,0x8534,0x84ed,0x0000,0x0000,0x8535,
-0x0000,0x8505,0x0000,0x0000,0x0000,0x0000,0x877d,0x0000,
-0x0000,0x0000,0x8771,0x0000,0x885c,0x88e6,0x890f,0x891b,
-0x0000,0x89a9,0x89a5,0x89ee,0x8ab1,0x0000,0x8acc,0x8ace,
-0x0000,0x8ab7,0x0000,0x8ab5,0x8ae9,0x8ab4,0x0000,0x8ab3,
-0x8ac1,0x8aaf,0x8aca,0x8ad0,0x0000,0x0000,0x0000,0x8c8e,
-0x0000,0x0000,0x8ce9,0x8cdb,0x0000,0x8ceb,0x8da4,0x0000,
-0x8da2,0x8d9d,0x0000,0x0000,0x0000,0x0000,0x8e2a,0x8e28,
-0x0000,0x0000,0x8eb8,0x8eb6,0x8eb9,0x8eb7,0x8f22,0x8f2b,
-0x8f27,0x8f19,0x8fa4,0x0000,0x8fb3,0x0000,0x9071,0x906a,
-0x0000,0x0000,0x9188,0x918c,0x92bf,0x92b8,0x92be,0x92dc,
-0x92e5,0x0000,0x0000,0x92d4,0x92d6,0x0000,0x92da,0x92ed,
-0x92f3,0x92db,0x0000,0x92b9,0x92e2,0x92eb,0x95af,0x0000,
-0x95b2,0x95b3,0x0000,0x0000,0x0000,0x96a3,0x96a5,0x0000,
-0x0000,0x0000,0x0000,0x970a,0x0000,0x9787,0x9789,0x978c,
-0x97ef,0x982a,0x9822,0x0000,0x981f,0x0000,0x9919,0x0000,
-0x99ca,0x99da,0x0000,0x0000,0x0000,0x99de,0x99c8,0x99e0,
-0x0000,0x9ab6,0x9ab5,0x0000,0x9af4,0x0000,0x9b6b,0x9b69,
-0x9b72,0x9b63,0x0000,0x9d0d,0x0000,0x9d01,0x9d0c,0x0000,
-0x9cf8,0x0000,0x0000,0x9cfe,0x9d02,0x9e84,0x0000,0x9eab,
-0x9eaa,0x511d,0x5116,0x0000,0x512b,0x511e,0x511b,0x5290,
-0x5294,0x5314,0x0000,0x0000,0x5667,0x0000,0x567b,0x0000,
-0x565f,0x5661,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x58c3,0x58ca,0x58bb,0x58c0,0x58c4,0x5901,0x5b1f,
-0x5b18,0x5b11,0x5b15,0x0000,0x5b12,0x5b1c,0x0000,0x5b22,
-0x5b79,0x5da6,0x0000,0x5db3,0x5dab,0x5eea,0x0000,0x5f5b,
-0x0000,0x0000,0x61b7,0x61ce,0x61b9,0x61bd,0x61cf,0x61c0,
-0x6199,0x6197,0x0000,0x61bb,0x61d0,0x61c4,0x6231,0x0000,
-0x64d3,0x64c0,0x0000,0x0000,0x0000,0x0000,0x64dc,0x64d1,
-0x64c8,0x0000,0x64d5,0x66c3,0x0000,0x0000,0x66bf,0x66c5,
-0x0000,0x66cd,0x66c1,0x6706,0x0000,0x6724,0x6a63,0x6a42,
-0x6a52,0x0000,0x6a43,0x6a33,0x0000,0x6a6c,0x6a57,0x0000,
-0x6a4c,0x6a6e,0x0000,0x0000,0x0000,0x0000,0x0000,0x6a37,
-0x0000,0x6a71,0x6a4a,0x6a36,0x0000,0x6a53,0x0000,0x6a45,
-0x6a70,0x0000,0x0000,0x6a5c,0x6b58,0x6b57,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x6fbb,0x0000,0x0000,0x6fbe,
-0x0000,0x0000,0x0000,0x6fb5,0x6fd3,0x6f9f,0x0000,0x6fb7,
-0x6ff5,0x71b7,0x0000,0x71bb,0x0000,0x71d1,0x0000,0x71ba,
-0x0000,0x71b6,0x71cc,0x0000,0x0000,0x71d3,0x749b,0x0000,
-0x0000,0x7496,0x74a2,0x749d,0x750a,0x750e,0x0000,0x7581,
-0x762c,0x7637,0x7636,0x763b,0x0000,0x76a1,0x0000,0x0000,
-0x7798,0x0000,0x7796,0x0000,0x0000,0x0000,0x78d6,0x78eb,
-0x0000,0x78dc,0x0000,0x79a5,0x79a9,0x9834,0x7a53,0x7a45,
-0x0000,0x7a4f,0x0000,0x7abd,0x7abb,0x7af1,0x0000,0x0000,
-0x7bec,0x7bed,0x0000,0x0000,0x7cd3,0x0000,0x7ce1,0x0000,
-0x7e19,0x0000,0x0000,0x0000,0x7e27,0x7e26,0x0000,0x0000,
-0x806e,0x81af,0x0000,0x0000,0x81ad,0x0000,0x81aa,0x8218,
-0x0000,0x0000,0x0000,0x0000,0x856f,0x854c,0x0000,0x8542,
-0x0000,0x855c,0x8570,0x855f,0x0000,0x855a,0x854b,0x853f,
-0x878a,0x0000,0x878b,0x87a1,0x878e,0x0000,0x0000,0x8799,
-0x885e,0x885f,0x8924,0x89a7,0x8aea,0x8afd,0x8af9,0x8ae3,
-0x8ae5,0x0000,0x0000,0x8aec,0x0000,0x0000,0x0000,0x0000,
-0x8cf2,0x0000,0x8cef,0x0000,0x8da6,0x0000,0x0000,0x0000,
-0x8e3b,0x8e43,0x0000,0x8e32,0x8f31,0x8f30,0x0000,0x8f2d,
-0x8f3c,0x8fa7,0x8fa5,0x0000,0x0000,0x0000,0x9137,0x9195,
-0x918e,0x0000,0x9196,0x0000,0x9345,0x930a,0x0000,0x0000,
-0x92fd,0x9317,0x931c,0x9307,0x9331,0x9332,0x932c,0x9330,
-0x9303,0x9305,0x0000,0x95c2,0x0000,0x95b8,0x0000,0x95c1,
-0x0000,0x0000,0x0000,0x96ab,0x96b7,0x0000,0x0000,0x9715,
-0x9714,0x0000,0x0000,0x970c,0x9717,0x0000,0x9793,0x0000,
-0x97d2,0x0000,0x0000,0x9836,0x9831,0x9833,0x983c,0x982e,
-0x983a,0x0000,0x983d,0x0000,0x98b5,0x9922,0x9923,0x9920,
-0x991c,0x991d,0x0000,0x99a0,0x0000,0x99ef,0x99e8,0x99eb,
-0x0000,0x0000,0x0000,0x99e1,0x99e6,0x0000,0x0000,0x9af8,
-0x9af5,0x0000,0x0000,0x9b83,0x9b94,0x9b84,0x0000,0x9b8b,
-0x9b8f,0x0000,0x9b8c,0x0000,0x9b89,0x0000,0x9b8e,0x0000,
-0x0000,0x0000,0x9d24,0x9d0f,0x0000,0x9d13,0x9d0a,0x0000,
-0x0000,0x0000,0x0000,0x9d2a,0x9d1a,0x0000,0x9d27,0x9d16,
-0x9d21,0x0000,0x9e85,0x9eac,0x9ec6,0x9ec5,0x9ed7,0x9f53,
-0x0000,0x5128,0x5127,0x51df,0x0000,0x5335,0x53b3,0x0000,
-0x568a,0x567d,0x5689,0x0000,0x58cd,0x58d0,0x0000,0x5b2b,
-0x5b33,0x5b29,0x5b35,0x5b31,0x5b37,0x5c36,0x5dbe,0x0000,
-0x5db9,0x0000,0x5dbb,0x0000,0x61e2,0x61db,0x61dd,0x61dc,
-0x61da,0x0000,0x61d9,0x0000,0x0000,0x64df,0x0000,0x0000,
-0x64e1,0x0000,0x64ee,0x0000,0x65b5,0x66d4,0x66d5,0x0000,
-0x66d0,0x66d1,0x66ce,0x66d7,0x0000,0x0000,0x6a7d,0x6a8a,
-0x0000,0x6aa7,0x0000,0x6a99,0x6a82,0x6a88,0x0000,0x0000,
-0x6a86,0x0000,0x6a98,0x6a9d,0x0000,0x0000,0x6a8f,0x0000,
-0x6aaa,0x0000,0x6b5d,0x0000,0x6c0a,0x0000,0x6fd7,0x6fd6,
-0x6fe5,0x0000,0x0000,0x0000,0x6fd9,0x6fda,0x6fea,0x0000,
-0x6ff6,0x0000,0x0000,0x71e3,0x0000,0x71e9,0x0000,0x71eb,
-0x71ef,0x71f3,0x71ea,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x7371,0x0000,0x74ae,0x0000,0x74b3,0x0000,0x74ac,0x0000,
-0x0000,0x7583,0x7645,0x764e,0x7644,0x76a3,0x76a5,0x77a6,
-0x77a4,0x0000,0x77a9,0x77af,0x0000,0x0000,0x0000,0x78f0,
-0x78f8,0x78f1,0x0000,0x7a49,0x0000,0x0000,0x0000,0x7ac2,
-0x7af2,0x7af3,0x7bfa,0x0000,0x7bf6,0x7bfc,0x7c18,0x7c08,
-0x7c12,0x0000,0x0000,0x7cdb,0x7cda,0x0000,0x0000,0x0000,
-0x7e2c,0x7e4d,0x0000,0x0000,0x7f46,0x7ff6,0x802b,0x8074,
-0x81b8,0x81c8,0x0000,0x0000,0x0000,0x8592,0x8593,0x0000,
-0x857f,0x85ab,0x8597,0x0000,0x0000,0x85ac,0x0000,0x0000,
-0x0000,0x87ce,0x0000,0x87cd,0x0000,0x0000,0x87c1,0x87b1,
-0x87c7,0x0000,0x8940,0x0000,0x893f,0x8939,0x0000,0x8943,
-0x0000,0x0000,0x0000,0x89ab,0x0000,0x8b1f,0x8b09,0x8b0c,
-0x0000,0x0000,0x8c40,0x0000,0x8c96,0x0000,0x8cf6,0x8cf7,
-0x0000,0x8e46,0x8e4f,0x0000,0x0000,0x0000,0x8f3d,0x8f41,
-0x9366,0x9378,0x935d,0x9369,0x9374,0x937d,0x936e,0x9372,
-0x9373,0x9362,0x9348,0x9353,0x935f,0x9368,0x0000,0x937f,
-0x936b,0x0000,0x95c4,0x0000,0x96af,0x96ad,0x96b2,0x0000,
-0x0000,0x971a,0x971b,0x0000,0x0000,0x0000,0x0000,0x979b,
-0x979f,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x9840,0x0000,0x9847,0x0000,0x98b7,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x99a2,0x0000,0x0000,0x9a00,0x99f3,
-0x0000,0x0000,0x99f5,0x0000,0x0000,0x9abd,0x9b00,0x9b02,
-0x0000,0x9b34,0x9b49,0x9b9f,0x0000,0x9ba3,0x9bcd,0x9b99,
-0x9b9d,0x0000,0x0000,0x9d39,0x0000,0x9d44,0x0000,0x0000,
-0x9d35,0x0000,0x0000,0x9eaf,0x0000,0x512f,0x0000,0x0000,
-0x9f8e,0x0000,0x569f,0x569b,0x569e,0x5696,0x5694,0x56a0,
-0x0000,0x5b3b,0x0000,0x0000,0x5b3a,0x5dc1,0x5f4d,0x5f5d,
-0x61f3,0x0000,0x0000,0x0000,0x0000,0x64f6,0x64e5,0x64ea,
-0x64e7,0x6505,0x0000,0x64f9,0x0000,0x0000,0x0000,0x6aab,
-0x6aed,0x6ab2,0x6ab0,0x6ab5,0x6abe,0x6ac1,0x6ac8,0x0000,
-0x6ac0,0x6abc,0x6ab1,0x6ac4,0x6abf,0x0000,0x0000,0x7008,
-0x7003,0x6ffd,0x7010,0x7002,0x7013,0x0000,0x71fa,0x7200,
-0x74b9,0x74bc,0x0000,0x765b,0x7651,0x764f,0x76eb,0x77b8,
-0x0000,0x77b9,0x77c1,0x77c0,0x77be,0x790b,0x0000,0x7907,
-0x790a,0x7908,0x0000,0x790d,0x7906,0x7915,0x79af,0x0000,
-0x0000,0x0000,0x7af5,0x0000,0x0000,0x7c2e,0x0000,0x7c1b,
-0x0000,0x7c1a,0x7c24,0x0000,0x0000,0x7ce6,0x7ce3,0x0000,
-0x0000,0x7e5d,0x7e4f,0x7e66,0x7e5b,0x7f47,0x7fb4,0x0000,
-0x0000,0x0000,0x7ffa,0x802e,0x0000,0x0000,0x81ce,0x0000,
-0x0000,0x8219,0x0000,0x0000,0x85cc,0x85b2,0x0000,0x85bb,
-0x85c1,0x0000,0x0000,0x0000,0x87e9,0x87ee,0x87f0,0x87d6,
-0x880e,0x87da,0x8948,0x894a,0x894e,0x894d,0x89b1,0x89b0,
-0x89b3,0x0000,0x8b38,0x8b32,0x0000,0x8b2d,0x0000,0x8b34,
-0x0000,0x8b29,0x8c74,0x0000,0x0000,0x8d03,0x0000,0x0000,
-0x8da9,0x8e58,0x0000,0x0000,0x8ebf,0x8ec1,0x8f4a,0x8fac,
-0x0000,0x9089,0x913d,0x913c,0x91a9,0x93a0,0x0000,0x9390,
-0x0000,0x9393,0x938b,0x93ad,0x93bb,0x93b8,0x0000,0x0000,
-0x939c,0x95d8,0x95d7,0x0000,0x0000,0x0000,0x975d,0x97a9,
-0x97da,0x0000,0x0000,0x0000,0x0000,0x9854,0x0000,0x9855,
-0x984b,0x0000,0x983f,0x98b9,0x0000,0x0000,0x0000,0x0000,
-0x9938,0x9936,0x9940,0x0000,0x993b,0x9939,0x99a4,0x0000,
-0x0000,0x9a08,0x9a0c,0x0000,0x9a10,0x0000,0x9b07,0x0000,
-0x9bd2,0x0000,0x9bc2,0x9bbb,0x9bcc,0x9bcb,0x0000,0x0000,
-0x9d4d,0x9d63,0x9d4e,0x0000,0x9d50,0x9d55,0x0000,0x9d5e,
-0x0000,0x9e90,0x9eb2,0x9eb1,0x0000,0x9eca,0x9f02,0x9f27,
-0x9f26,0x0000,0x56af,0x58e0,0x58dc,0x0000,0x5b39,0x0000,
-0x0000,0x5b7c,0x5bf3,0x0000,0x0000,0x5c6b,0x5dc4,0x650b,
-0x6508,0x650a,0x0000,0x0000,0x65dc,0x0000,0x0000,0x66e1,
-0x66df,0x6ace,0x6ad4,0x6ae3,0x6ad7,0x6ae2,0x0000,0x0000,
-0x0000,0x0000,0x6ad8,0x6ad5,0x6ad2,0x0000,0x0000,0x701e,
-0x702c,0x7025,0x6ff3,0x7204,0x7208,0x7215,0x0000,0x74c4,
-0x74c9,0x74c7,0x74c8,0x76a9,0x77c6,0x77c5,0x7918,0x791a,
-0x7920,0x0000,0x7a66,0x7a64,0x7a6a,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x7c35,0x7c34,0x0000,0x0000,0x7e6c,
-0x0000,0x7e6e,0x7e71,0x0000,0x81d4,0x81d6,0x821a,0x8262,
-0x8265,0x8276,0x85db,0x85d6,0x0000,0x85e7,0x0000,0x0000,
-0x85f4,0x0000,0x87fd,0x87d5,0x8807,0x0000,0x880f,0x87f8,
-0x0000,0x0000,0x8987,0x0000,0x89b5,0x89f5,0x0000,0x8b3f,
-0x8b43,0x8b4c,0x0000,0x8d0b,0x8e6b,0x8e68,0x8e70,0x8e75,
-0x8e77,0x0000,0x8ec3,0x0000,0x93e9,0x93ea,0x93cb,0x93c5,
-0x93c6,0x0000,0x93ed,0x93d3,0x0000,0x93e5,0x0000,0x0000,
-0x93db,0x93eb,0x93e0,0x93c1,0x0000,0x0000,0x95dd,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x97b2,0x97b4,0x97b1,0x97b5,0x97f2,0x0000,0x0000,0x0000,
-0x9856,0x0000,0x0000,0x0000,0x9944,0x0000,0x9a26,0x9a1f,
-0x9a18,0x9a21,0x9a17,0x0000,0x9b09,0x0000,0x0000,0x9bc5,
-0x9bdf,0x0000,0x9be3,0x0000,0x9be9,0x9bee,0x0000,0x0000,
-0x9d66,0x9d7a,0x0000,0x9d6e,0x9d91,0x9d83,0x9d76,0x9d7e,
-0x9d6d,0x0000,0x9e95,0x9ee3,0x0000,0x0000,0x9f03,0x9f04,
-0x0000,0x9f17,0x0000,0x5136,0x0000,0x5336,0x0000,0x5b42,
-0x0000,0x0000,0x5b44,0x5b46,0x5b7e,0x5dca,0x5dc8,0x5dcc,
-0x5ef0,0x0000,0x6585,0x66e5,0x66e7,0x0000,0x0000,0x0000,
-0x6af4,0x0000,0x6ae9,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x703d,0x0000,0x7036,0x0000,0x7216,0x0000,0x7212,0x720f,
-0x7217,0x7211,0x720b,0x0000,0x0000,0x74cd,0x74d0,0x74cc,
-0x74ce,0x74d1,0x0000,0x7589,0x0000,0x7a6f,0x7c4b,0x7c44,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x7e7f,0x8b71,0x0000,
-0x802f,0x807a,0x807b,0x807c,0x0000,0x0000,0x0000,0x85fc,
-0x8610,0x8602,0x0000,0x0000,0x85ee,0x8603,0x0000,0x860d,
-0x8613,0x8608,0x860f,0x8818,0x8812,0x0000,0x0000,0x8967,
-0x8965,0x89bb,0x8b69,0x8b62,0x0000,0x8b6e,0x0000,0x8b61,
-0x0000,0x8b64,0x8b4d,0x8c51,0x0000,0x0000,0x8e83,0x8ec6,
-0x0000,0x941f,0x0000,0x9404,0x9417,0x9408,0x9405,0x0000,
-0x93f3,0x941e,0x9402,0x941a,0x941b,0x9427,0x941c,0x0000,
-0x96b5,0x0000,0x0000,0x9733,0x0000,0x9734,0x9731,0x97b8,
-0x97ba,0x0000,0x97fc,0x0000,0x0000,0x98c3,0x0000,0x994d,
-0x0000,0x9a2f,0x0000,0x0000,0x0000,0x9ac9,0x0000,0x9ac8,
-0x9ac4,0x9b2a,0x9b38,0x9b50,0x0000,0x9c0a,0x9bfb,0x9c04,
-0x9bfc,0x9bfe,0x0000,0x0000,0x0000,0x9c02,0x9bf6,0x9c1b,
-0x9bf9,0x9c15,0x9c10,0x9bff,0x9c00,0x9c0c,0x0000,0x0000,
-0x9d95,0x9da5,0x0000,0x0000,0x0000,0x0000,0x9e98,0x9ec1,
-0x0000,0x9f5a,0x5164,0x56bb,0x0000,0x58e6,0x5b49,0x5bf7,
-0x0000,0x0000,0x5dd0,0x0000,0x5fc2,0x0000,0x6511,0x0000,
-0x6aff,0x6afe,0x6afd,0x0000,0x6b01,0x0000,0x0000,0x704b,
-0x704d,0x7047,0x74d3,0x7668,0x7667,0x0000,0x0000,0x77d1,
-0x7930,0x7932,0x792e,0x0000,0x9f9d,0x7ac9,0x7ac8,0x0000,
-0x7c56,0x7c51,0x0000,0x0000,0x0000,0x7e85,0x7e89,0x7e8e,
-0x7e84,0x0000,0x826a,0x862b,0x862f,0x8628,0x0000,0x8616,
-0x8615,0x861d,0x881a,0x0000,0x0000,0x0000,0x89bc,0x8b75,
-0x8b7c,0x0000,0x8d11,0x8d12,0x8f5c,0x91bb,0x0000,0x93f4,
-0x0000,0x0000,0x942d,0x0000,0x0000,0x96e4,0x9737,0x9736,
-0x9767,0x97be,0x97bd,0x97e2,0x9868,0x9866,0x98c8,0x98ca,
-0x98c7,0x98dc,0x0000,0x994f,0x99a9,0x9a3c,0x0000,0x9a3b,
-0x9ace,0x0000,0x9b14,0x9b53,0x0000,0x9c2e,0x0000,0x9c1f,
-0x0000,0x0000,0x0000,0x0000,0x9db0,0x9dbd,0x0000,0x0000,
-0x9dae,0x9dc4,0x9e7b,0x0000,0x0000,0x9e9e,0x0000,0x9f05,
-0x0000,0x9f69,0x9fa1,0x56c7,0x571d,0x5b4a,0x5dd3,0x0000,
-0x5f72,0x6202,0x0000,0x6235,0x6527,0x651e,0x651f,0x0000,
-0x0000,0x6b07,0x6b06,0x0000,0x0000,0x7054,0x721c,0x7220,
-0x7af8,0x0000,0x7c5d,0x7c58,0x0000,0x7e92,0x7f4e,0x0000,
-0x0000,0x0000,0x8827,0x0000,0x8b81,0x8b83,0x0000,0x8c44,
-0x0000,0x0000,0x0000,0x0000,0x9442,0x944d,0x9454,0x944e,
-0x0000,0x9443,0x0000,0x0000,0x973c,0x9740,0x97c0,0x0000,
-0x0000,0x0000,0x0000,0x995a,0x9a51,0x0000,0x9add,0x0000,
-0x0000,0x9c38,0x0000,0x9c45,0x9c3a,0x0000,0x9c35,0x0000,
-0x0000,0x0000,0x9ef1,0x0000,0x9f93,0x529a,0x0000,0x0000,
-0x8641,0x5dd7,0x0000,0x6528,0x0000,0x0000,0x0000,0x7053,
-0x7059,0x0000,0x7221,0x0000,0x766f,0x7937,0x79b5,0x7c62,
-0x7c5e,0x7cf5,0x0000,0x0000,0x863d,0x0000,0x882d,0x8989,
-0x8b8d,0x8b87,0x8b90,0x8d1a,0x8e99,0x0000,0x0000,0x0000,
-0x945f,0x0000,0x0000,0x9456,0x9461,0x945b,0x945a,0x945c,
-0x9465,0x0000,0x9741,0x0000,0x0000,0x986e,0x986c,0x986d,
-0x0000,0x99aa,0x9a5c,0x9a58,0x9ade,0x0000,0x9c4f,0x9c51,
-0x0000,0x9c53,0x0000,0x0000,0x0000,0x9dfc,0x9f39,0x0000,
-0x513e,0x0000,0x56d2,0x0000,0x5b4f,0x6b14,0x0000,0x7a72,
-0x7a73,0x0000,0x0000,0x0000,0x8b91,0x0000,0x0000,0x91bf,
-0x0000,0x946c,0x0000,0x0000,0x96e6,0x9745,0x0000,0x97c8,
-0x97e4,0x995d,0x0000,0x9b21,0x0000,0x9b2c,0x9b57,0x0000,
-0x0000,0x9c5d,0x9c61,0x9c65,0x9e08,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x9f45,0x0000,0x0000,0x6205,0x66ef,0x6b1b,
-0x6b1d,0x7225,0x7224,0x7c6d,0x0000,0x8642,0x8649,0x0000,
-0x8978,0x898a,0x8b97,0x0000,0x8c9b,0x8d1c,0x0000,0x8ea2,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x9c6c,0x0000,0x9c6f,0x0000,0x9e0e,0x0000,0x9f08,0x9f1d,
-0x9fa3,0x0000,0x0000,0x5f60,0x6b1c,0x0000,0x0000,0x0000,
-0x7cf3,0x0000,0x8b9b,0x8ea7,0x91c4,0x0000,0x947a,0x0000,
-0x0000,0x9a61,0x9a63,0x9ad7,0x9c76,0x0000,0x9fa5,0x0000,
-0x7067,0x0000,0x72ab,0x864a,0x897d,0x8b9d,0x8c53,0x8f65,
-0x947b,0x0000,0x98cd,0x98dd,0x0000,0x9b30,0x9e16,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x96e7,0x9e18,0x9ea2,0x0000,
-0x9f7c,0x0000,0x7e9e,0x9484,0x0000,0x9e1c,0x0000,0x7c71,
-0x97ca,0x0000,0x0000,0x0000,0x9ea3,0x0000,0x9c7b,0x9f97,
-0x0000,0x0000,0x9750,0x0000,0x0000,0x0000,0x5727,0x5c13,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x5fc8,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x6765,0x0000,0x0000,0x52bd,
-0x0000,0x5b66,0x0000,0x65f9,0x6788,0x6ce6,0x6ccb,0x0000,
-0x4fbd,0x5f8d,0x0000,0x6018,0x6048,0x0000,0x6b29,0x70a6,
-0x0000,0x7706,0x0000,0x0000,0x0000,0x5a10,0x5cfc,0x5cfe,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x70c9,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x9579,0x0000,
-0x96ba,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x7b29,0x8128,0x0000,0x8a2e,0x0000,0x0000,0x0000,0x9ad9,
-0x0000,0x582b,0x5845,0x0000,0x63fa,0x0000,0x0000,0x0000,
-0x6e86,0x0000,0x0000,0x0000,0x0000,0x0000,0x5867,0x0000,
-0x5bdd,0x656e,0x0000,0x0000,0x0000,0x8c87,0x0000,0x50d2,
-0x50df,0x0000,0x0000,0x0000,0x0000,0x69ba,0x0000,0x6b9d,
-0x0000,0x8059,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x6f8a,0x0000,
-0x0000,0x7bc3,0x7bc2,0x0000,0x0000,0x0000,0x0000,0x90f6,
-0x0000,0x9823,0x0000,0x0000,0x0000,0x0000,0x0000,0x71cd,
-0x7499,0x0000,0x0000,0x0000,0x0000,0x0000,0x9842,0x0000,
-0x0000,0x0000,0x0000,0x7f84,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x8d0e,0x0000,0x9861,0x0000,0x0000,0x8b73,0x0000,
-0x9c27,0x0000,0x9458,0x77d6,0x9b2d,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x4f66,0x4f68,0x4fe7,0x503f,0x0000,0x50a6,0x510f,
-0x523e,0x5324,0x5365,0x539b,0x517f,0x54cb,0x5573,0x5571,
-0x556b,0x55f4,0x5622,0x5620,0x5692,0x56ba,0x5691,0x56b0,
-0x5759,0x578a,0x580f,0x5812,0x5813,0x5847,0x589b,0x5900,
-0x594d,0x5ad1,0x5ad3,0x5b67,0x5c57,0x5c77,0x5cd5,0x5d75,
-0x5d8e,0x5da5,0x5db6,0x5dbf,0x5e65,0x5ecd,0x5eed,0x5f94,
-0x5f9a,0x5fba,0x6125,0x6150,0x62a3,0x6360,0x6364,0x63b6,
-0x6403,0x64b6,0x651a,0x7a25,0x5c21,0x66e2,0x6702,0x67a4,
-0x67ac,0x6810,0x6806,0x685e,0x685a,0x692c,0x6929,0x6a2d,
-0x6a77,0x6a7a,0x6aca,0x6ae6,0x6af5,0x6b0d,0x6b0e,0x6bdc,
-0x6bdd,0x6bf6,0x6c1e,0x6c63,0x6da5,0x6e0f,0x6e8a,0x6e84,
-0x6e8b,0x6e7c,0x6f4c,0x6f48,0x6f49,0x6f9d,0x6f99,0x6ff8,
-0x702e,0x702d,0x705c,0x79cc,0x70bf,0x70ea,0x70e5,0x7111,
-0x7112,0x713f,0x7139,0x713b,0x713d,0x7177,0x7175,0x7176,
-0x7171,0x7196,0x7193,0x71b4,0x71dd,0x71de,0x720e,0x5911,
-0x7218,0x7347,0x7348,0x73ef,0x7412,0x743b,0x74a4,0x748d,
-0x74b4,0x7673,0x7677,0x76bc,0x7819,0x781b,0x783d,0x7853,
-0x7854,0x7858,0x78b7,0x78d8,0x78ee,0x7922,0x794d,0x7986,
-0x7999,0x79a3,0x79bc,0x7aa7,0x7b37,0x7b59,0x7bd0,0x7c2f,
-0x7c32,0x7c42,0x7c4e,0x7c68,0x7ca9,0x7ced,0x7dd0,0x7e07,
-0x7dd3,0x7e64,0x7f40,0x0000,0x8041,0x8063,0x80bb,0x6711,
-0x6725,0x8248,0x8310,0x8362,0x8312,0x8421,0x841e,0x84e2,
-0x84de,0x84e1,0x8573,0x85d4,0x85f5,0x8637,0x8645,0x8672,
-0x874a,0x87a9,0x87a5,0x87f5,0x8834,0x8850,0x8887,0x8954,
-0x8984,0x8b03,0x8c52,0x8cd8,0x8d0c,0x8d18,0x8db0,0x8ebc,
-0x8ed5,0x8faa,0x909c,0x0000,0x915c,0x922b,0x9221,0x9273,
-0x92f4,0x92f5,0x933f,0x9342,0x9386,0x93be,0x93bc,0x93bd,
-0x93f1,0x93f2,0x93ef,0x9422,0x9423,0x9424,0x9467,0x9466,
-0x9597,0x95ce,0x95e7,0x973b,0x974d,0x98e4,0x9942,0x9b1d,
-0x9b98,0x0000,0x9d49,0x6449,0x5e71,0x5e85,0x61d3,0x990e,
-0x8002,0x781e,0x0000,0x0000,0x5528,0x5572,0x55ba,0x55f0,
-0x55ee,0x56b8,0x56b9,0x56c4,0x8053,0x92b0};
-
-static const int cns11643_14_ucs_table_size = (sizeof(cns11643_14_ucs_table)/sizeof(unsigned short));
-
-/* UCS -> CNS11643 */
-static const unsigned int ucs_a1_cns11643_table[] = {
-/* 0x0000 */
-0x00000,0x00001,0x00002,0x00003,0x00004,0x00005,0x00006,0x00007,
-0x00008,0x00009,0x0000a,0x0000b,0x0000c,0x0000d,0x0000e,0x0000f,
-0x00010,0x00011,0x00012,0x00013,0x00014,0x00015,0x00016,0x00017,
-0x00018,0x00019,0x0001a,0x0001b,0x0001c,0x0001d,0x0001e,0x0001f,
-0x00020,0x00021,0x00022,0x00023,0x00024,0x00025,0x00026,0x00027,
-0x00028,0x00029,0x0002a,0x0002b,0x0002c,0x0002d,0x0002e,0x0002f,
-0x00030,0x00031,0x00032,0x00033,0x00034,0x00035,0x00036,0x00037,
-0x00038,0x00039,0x0003a,0x0003b,0x0003c,0x0003d,0x0003e,0x0003f,
-0x00040,0x00041,0x00042,0x00043,0x00044,0x00045,0x00046,0x00047,
-0x00048,0x00049,0x0004a,0x0004b,0x0004c,0x0004d,0x0004e,0x0004f,
-0x00050,0x00051,0x00052,0x00053,0x00054,0x00055,0x00056,0x00057,
-0x00058,0x00059,0x0005a,0x0005b,0x0005c,0x0005d,0x0005e,0x0005f,
-0x00060,0x00061,0x00062,0x00063,0x00064,0x00065,0x00066,0x00067,
-0x00068,0x00069,0x0006a,0x0006b,0x0006c,0x0006d,0x0006e,0x0006f,
-0x00070,0x00071,0x00072,0x00073,0x00074,0x00075,0x00076,0x00077,
-0x00078,0x00079,0x0007a,0x0007b,0x0007c,0x0007d,0x0007e,0x0007f,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x12170,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x12278,0x12234,0x00000,0x00000,0x00000,0x00000,0x00000,0x12131,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x12232,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x12233,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-/* 0x0100 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-/* 0x0200 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x1256f,
-0x00000,0x1256d,0x1256e,0x12570,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x1256c,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-/* 0x0300 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x12475,0x12476,0x12477,0x12478,0x12479,0x1247a,0x1247b,
-0x1247c,0x1247d,0x1247e,0x12521,0x12522,0x12523,0x12524,0x12525,
-0x12526,0x12527,0x00000,0x12528,0x12529,0x1252a,0x1252b,0x1252c,
-0x1252d,0x1252e,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x1252f,0x12530,0x12531,0x12532,0x12533,0x12534,0x12535,
-0x12536,0x12537,0x12538,0x12539,0x1253a,0x1253b,0x1253c,0x1253d,
-0x1253e,0x1253f,0x00000,0x12540,0x12541,0x12542,0x12543,0x12544,
-0x12545,0x12546};
-
-static const int ucs_a1_cns11643_table_min = 0x0000;
-static const int ucs_a1_cns11643_table_max = 0x0000 + (sizeof (ucs_a1_cns11643_table) / sizeof (unsigned int));
-
-static const unsigned int ucs_a2_cns11643_table[] = {
-/* 0x2000 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x12139,0x12137,0x00000,0x1225d,0x00000,
-0x12164,0x12165,0x00000,0x00000,0x12166,0x12167,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x1212d,0x1212c,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x1216a,0x00000,0x00000,0x1216b,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x1216f,0x00000,0x00000,0x12223,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-/* 0x2100 */
-0x00000,0x00000,0x00000,0x1226a,0x00000,0x12222,0x00000,0x00000,
-0x00000,0x1226b,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x1242b,0x1242c,0x1242d,0x1242e,0x1242f,0x12430,0x12431,0x12432,
-0x12433,0x12434,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x12635,0x12636,0x12637,0x12638,0x12639,0x1263a,0x1263b,0x1263c,
-0x1263d,0x1263e,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x12258,0x12255,0x12257,0x12256,0x00000,0x00000,0x12259,0x1225a,
-0x1225c,0x1225b,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-/* 0x2200 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x12261,0x00000,0x00000,
-0x00000,0x00000,0x12235,0x00000,0x00000,0x00000,0x1223c,0x12249,
-0x12248,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x12245,0x12246,0x1224d,0x00000,0x00000,0x1224e,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x12250,0x1224f,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x12244,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x1223d,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x1223b,0x1223e,0x00000,0x00000,0x00000,0x00000,0x12239,0x1223a,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x12247,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x1224a,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-/* 0x2300 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x14221,0x14222,0x14223,0x14224,0x14225,0x14226,0x14227,0x14228,
-0x14229,0x1422a,0x1422b,0x1422c,0x1422d,0x1422e,0x1422f,0x14230,
-0x14231,0x14232,0x14233,0x14234,0x14235,0x14236,0x14237,0x14238,
-0x14239,0x1423a,0x1423b,0x1423c,0x1423d,0x1423e,0x1423f,0x14240,
-0x00000,0x14241,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x12621,0x12622,0x12623,0x12624,0x12625,0x12626,0x12627,0x12628,
-0x12629,0x1262a,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x1262b,0x1262c,0x1262d,0x1262e,
-0x1262f,0x12630,0x12631,0x12632,0x12633,0x12634,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x12339,0x00000,0x1233a,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x1233c,0x00000,0x00000,0x00000,
-0x1233d,0x00000,0x00000,0x00000,0x1233e,0x00000,0x00000,0x00000,
-0x1233f,0x00000,0x00000,0x00000,0x12337,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x12336,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x12335,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x12334,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x12333,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x12344,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x12345,0x00000,
-0x00000,0x12347,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x12346,0x00000,0x00000,0x12340,0x12341,0x12343,
-0x12342,0x1234c,0x1234d,0x1234e,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x12324,0x12325,0x12326,0x12327,0x12328,0x12329,0x1232a,
-0x1232b,0x12332,0x12331,0x12330,0x1232f,0x1232e,0x1232d,0x1232c,
-0x00000,0x00000,0x00000,0x00000,0x12338,0x1233b,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x1217c,0x1217b,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x12175,0x12174,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x1217e,0x1217d,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x1217a,0x12179,
-0x00000,0x00000,0x00000,0x12172,0x00000,0x00000,0x12176,0x12173,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x12348,0x12349,0x1234b,0x1234a,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-/* 0x2600 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x12178,0x12177,0x00000,
-0x00000,0x12254,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x12251,0x12253,0x12252};
-
-static const int ucs_a2_cns11643_table_min = 0x2000;
-static const int ucs_a2_cns11643_table_max = 0x2000 + (sizeof (ucs_a1_cns11643_table) / sizeof (unsigned int));
-
-static const unsigned int ucs_a3_cns11643_table[] = {
-/* 0x2f00 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x12121,0x12123,0x12124,0x12171,0x00000,0x00000,0x00000,0x00000,
-0x12152,0x12153,0x1214e,0x1214f,0x12156,0x12157,0x1215a,0x1215b,
-0x1214a,0x1214b,0x12265,0x00000,0x12146,0x12147,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x12168,0x12169,0x00000,
-0x00000,0x12435,0x12436,0x12437,0x12438,0x12439,0x1243a,0x1243b,
-0x1243c,0x1243d,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x12126,0x00000,0x00000,0x00000,0x00000,
-/* 0x3100 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x12547,0x12548,0x12549,
-0x1254a,0x1254b,0x1254c,0x1254d,0x1254e,0x1254f,0x12550,0x12551,
-0x12552,0x12553,0x12554,0x12555,0x12556,0x12557,0x12558,0x12559,
-0x1255a,0x1255b,0x1255c,0x1255d,0x1255e,0x1255f,0x12560,0x12561,
-0x12562,0x12563,0x12564,0x12565,0x12566,0x12567,0x12568,0x12569,
-0x1256a,0x1256b,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-/* 0x3200 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x12221,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-/* 0x3300 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x12275,0x12276,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x12270,0x12271,0x12272,0x00000,
-0x00000,0x12274,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x12277,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x12273,0x00000,
-0x00000,0x1224c,0x1224b,0x00000,0x00000,0x1226f};
-
-static const int ucs_a3_cns11643_table_min = 0x2f00;
-static const int ucs_a3_cns11643_table_max = 0x2f00 + (sizeof (ucs_a3_cns11643_table) / sizeof (unsigned int));
-
-static const unsigned int ucs_i_cns11643_table[] = {
-/* 0x4d00 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x14421,0x14423,0x00000,0x14424,0xe2126,0xe2125,0x00000,0x22126,
-0x14437,0x14435,0x14438,0x14436,0x22127,0x14462,0x2212f,0x2212d,
-0x14461,0x14460,0x00000,0x00000,0x14562,0x14561,0x14560,0x00000,
-0x14563,0x1455f,0x00000,0x00000,0x00000,0x00000,0x14722,0x14723,
-0xe2262,0xe2261,0xe2263,0x00000,0xe243f,0x00000,0x14b64,0x00000,
-0xe2121,0x00000,0xe212c,0x14439,0x00000,0x14463,0x22130,0x00000,
-0x14464,0x22143,0x1486b,0x22531,0x00000,0x00000,0xe2122,0x00000,
-0x1443a,0x14465,0x00000,0x14564,0x22144,0xe2740,0x00000,0xe2123,
-0x00000,0x00000,0x22121,0x14425,0x00000,0x1443c,0xe2130,0x22128,
-0x1443d,0xe212e,0x00000,0x14466,0x00000,0x14565,0x14567,0x14566,
-0x00000,0x00000,0x14724,0x14725,0xe2345,0x00000,0x14b65,0xe2b22,
-0x1537d,0x14422,0x00000,0x00000,0x22122,0x14426,0x1443f,0x1443e,
-0x00000,0x00000,0xe2146,0xe2145,0x00000,0x00000,0x00000,0x00000,
-0xe2264,0x14726,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0xe2440,0x00000,0x14b66,0x00000,0x00000,0x00000,0x00000,
-0x00000,0xe2b23,0x00000,0x00000,0x00000,0x00000,0x15871,0x2334e,
-0xe396c,0xe396e,0x1632a,0x24156,0x24157,0xe2124,0x14427,0xe212d,
-0x14468,0xe2265,0x00000,0x14b67,0x14428,0x22129,0x14440,0xe2131,
-0x00000,0x14469,0x1446b,0x22131,0x1446c,0x1446a,0x00000,0xe216c,
-0xe2266,0x14727,0x00000,0x14b68,0xe2442,0xe2742,0x14b69,0x14f67,
-0x00000,0x14441,0x1446d,0xe2147,0x14728,0x1472a,0x14729,0x00000,
-0x1486c,0x00000,0x00000,0x14b6a,0x14b6b,0x14f68,0x14f69,0xe2b26,
-0xe2b25,0xe2b27,0xe2b24,0x1537e,0x00000,0x00000,0x24158,0xe4033,
-0x00000,0x26d44,0x14429,0x00000,0xe2132,0x00000,0xe2133,0x00000,
-0x1446f,0x1446e,0x22132,0x14470,0x14476,0xe2149,0x14471,0x14472,
-0x22134,0x22133,0x14474,0x14475,0xe214c,0x14473,0xe214b,0xe214a,
-0x00000,0x00000,0x00000,0x00000,0x1456a,0x1456b,0x1456c,0x1456d,
-0x14569,0x14570,0x2214a,0x00000,0x22146,0x22149,0x14571,0x14623,
-0xe216d,0x22148,0x00000,0x1456e,0x1456f,0x14568,0xe2172,0xe2170,
-0x22145,0x22147,0x00000,0x00000,0x00000,0x00000,0xe226f,0xe2268,
-0x14737,0x2216f,0x14734,0x14738,0x22179,0x2216d,0x14735,0x22171,
-0xe226b,0xe2267,0xe2276,0x14736,0xe226e,0x14739,0x00000,0x1472b,
-0x22170,0x1473a,0x22174,0xe226d,0x22178,0x22175,0xe226c,0xe2274,
-0x22172,0x1472c,0x1472e,0x1473b,0x00000,0x14730,0x2216a,0x14733,
-0x14731,0x14732,0x2217a,0x22177,0x2216e,0x1472f,0xe2270,0xe2277,
-0x2216b,0x1472d,0xe2275,0x00000,0xe2273,0x22173,0x00000,0x00000,
-0x00000,0x00000,0x22176,0x00000,0x00000,0x00000,0x00000,0x00000,
-0xe2272,0x00000,0x00000,0x00000,0x2216c,0x22328,0x00000,0x14924,
-0x14875,0xe2450,0xe2448,0x22329,0x14872,0xe244f,0x14926,0xe2446,
-0x1487a,0xe2445,0x14879,0x2227b,0x1487d,0x14878,0x22322,0x2232a,
-0xe244e,0x22326,0xe2449,0x1487b,0xe244b,0xe2443,0x1487e,0x1486f,
-0x14929,0x2227d,0xe2444,0xe244c,0x2253d,0x1486d,0x14925,0x1486e,
-0x14876,0x14877,0x22324,0x2227e,0x1487c,0x14874,0x2227a,0x14870,
-0x22327,0x14927,0x1492a,0x14873,0x14922,0x14928,0x14871,0x22325,
-0x14923,0x2232b,0x2227c,0x14921,0x22321,0x00000,0xe6448,0x22323,
-0xe6449,0x14b79,0x2253f,0x2254b,0x14b71,0xe2747,0x2254c,0x14b6c,
-0x14b76,0x00000,0xe274f,0x14b6f,0x22539,0x14b77,0x22538,0x2253c,
-0x22543,0x22541,0x14c21,0x14b7a,0x22533,0x22535,0x14b7c,0x14b70,
-0x22536,0x22542,0x22549,0x14b75,0x2253b,0x22534,0x14b74,0x22537,
-0x14b78,0x2253a,0xe2744,0x14b73,0xe2751,0x14b6e,0xe2748,0x14b7d,
-0x22544,0x14b7e,0x22548,0xe2743,0x22546,0x2254a,0x14b7b,0x2253e,
-0x22532,0x00000,0x22540,0x14b72,0x22545,0x14b6d,0x22547,0xe274c,
-0xe2749,0xe274b,0xe274a,0xe274d,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x14f78,0x14f6c,
-0xe2b2d,0xe2b2e,0x22922,0x2292a,0xe2b36,0x14f6b,0x14f73,0x15021,
-0xe2b2c,0x22930,0x2292e,0x22929,0x00000,0xe6263,0xe2b2b,0x14f6d,
-0x2292f,0x22925,0x14f7b,0x14f72,0x14f7a,0x2287e,0xe2b32,0x2292c,
-0xe2b2f,0x22923,0x14f76,0x22924,0xe2b33,0x2287d,0x14f7d,0x14f70,
-0x14f79,0x14f6f,0xe2b28,0x22921,0x22926,0xe2b29,0x2292d,0x14f77,
-0x14f74,0x22928,0x14f7c,0x2292b,0x22927,0x14f71,0x14f7e,0x14f75,
-0x14f6e,0x14f6a,0x00000,0xe2b35,0x00000,0xe2b34,0x00000,0xe644a,
-0x00000,0x00000,0x00000,0x00000,0x22931,0x00000,0x1543a,0x15424,
-0xe2f48,0x15434,0xe2f4d,0x15439,0x22d71,0x22d70,0x22d75,0x22d76,
-0x15427,0xe2f44,0x15430,0xe2f58,0xe2f4c,0xe2f56,0x1543d,0xe2f46,
-0x15431,0x00000,0xe2f4b,0xe2f49,0xe2f47,0x22d6a,0x1542a,0x22d6b,
-0xe2f4f,0x1543f,0x00000,0x15436,0x15421,0x15422,0x22d7e,0x15924,
-0xe2f53,0x1542f,0x1542e,0x22d6c,0x15432,0x2335e,0x15429,0x22d77,
-0x15438,0x15437,0x1542d,0x22d6f,0x22d78,0xe2f45,0x22d69,0x1542c,
-0x22d79,0x15435,0x22d6d,0x15423,0xe2f4e,0x15426,0x15425,0x22d7a,
-0x15433,0x15428,0x1543c,0x1543e,0x22d74,0x1543b,0xe2f51,0x22d7c,
-0x22d6e,0x22d7d,0xe2f43,0x22d72,0x00000,0x22d7b,0xe2f50,0x22d73,
-0xe2f54,0xe2f55,0x00000,0x00000,0x1542b,0x00000,0x00000,0xe644b,
-0x23366,0x2335a,0xe343c,0x15876,0xe343f,0x2335f,0x23365,0x15875,
-0x23358,0x15879,0x2335c,0x23355,0x15877,0x23359,0x1587c,0x15923,
-0xe3444,0x2336a,0xe3441,0x23354,0xe3442,0x1587d,0xe2f57,0x23369,
-0xe3447,0xe343d,0x15878,0x2335b,0x15874,0x23356,0x23352,0x23360,
-0x23353,0x23351,0x2335d,0x23363,0x23364,0x1587a,0xe3440,0x00000,
-0x23a3f,0x23361,0x23350,0x23362,0xe344b,0x15926,0x23367,0x15925,
-0x2334f,0xe3443,0x23357,0x23368,0x15921,0x1587e,0x1587b,0x15922,
-0xe344c,0xe344a,0x15872,0xe3445,0xe3446,0x15873,0x00000,0x00000,
-0x15e2e,0xe3975,0x23a42,0x23a3b,0x00000,0x15e2b,0x00000,0x23a43,
-0xe3971,0xe3972,0x00000,0x23a39,0x23a3c,0x15e2a,0x23a3d,0xe396f,
-0x00000,0x15e2d,0x23a41,0x00000,0x23a37,0x23a36,0x15e2f,0xe3970,
-0x15e30,0x15e2c,0x15e31,0x23a35,0x23a40,0x23a3e,0x23a38,0x00000,
-0x00000,0x00000,0x15e29,0x23a3a,0x00000,0x00000,0xe644d,0x00000,
-0x00000,0x00000,0xe4039,0xe403c,0x16331,0x1632b,0x2415c,0x16334,
-0x24162,0x24165,0x1632d,0x1632e,0x2415f,0x1632c,0x24168,0x16332,
-0x24169,0xe403a,0x24164,0x16333,0xe4037,0x24159,0x16330,0x2415a,
-0x00000,0x24163,0x24161,0xe403d,0x2415d,0x1632f,0x2415b,0x16335,
-0x24160,0x24167,0x2415e,0x24166,0xe4036,0xe403e,0x1677c,0x16779,
-0xe456b,0x1677a,0xe634c,0x24921,0x24877,0x16778,0x16775,0x24878,
-0xe456e,0xe456c,0x16777,0x2487b,0xe456d,0x2487d,0xe4576,0xe634d,
-0x24926,0xe4570,0xe4575,0x24925,0x2487e,0x16774,0x24876,0x16772,
-0x24879,0x1677d,0x2487c,0xe4571,0x24922,0x16776,0x16773,0x24924,
-0x24923,0x1677b,0x00000,0x2487a,0xe4574,0x16c23,0x24f54,0xe4b29,
-0x24f51,0x16c24,0x00000,0x16c22,0xe4b2b,0x24f58,0x24f55,0x24f4e,
-0x16c21,0xe4b2d,0x16c25,0x24f4f,0x16b7e,0x16c28,0x24f52,0x24f53,
-0x16c26,0x16c27,0x24f59,0x24f56,0x24f57,0xe4b2c,0xe4b27,0xe644e,
-0x17033,0x25643,0x17030,0x25640,0x17032,0x17034,0xe5031,0x25641,
-0x17031,0x00000,0x25642,0xe5035,0x2563f,0xe5030,0xe5034,0x17341,
-0x25c49,0x17342,0x25c47,0x00000,0x25c48,0x25c46,0x25c45,0xe5441,
-0xe5440,0x25c4a,0x17340,0xe5033,0x00000,0x26144,0x26145,0xe5752,
-0x24f50,0x26143,0x17343,0x1782b,0x26537,0x26538,0xe5c32,0x17a62,
-0x17a63,0x26b4f,0x26b4e,0x17b58,0x17b57,0x26e7d,0xe606f,0x1442a,
-0x14442,0x14478,0x00000,0x14477,0x14573,0x14572,0x1473e,0x1473d,
-0x1473f,0x1473c,0xe2278,0x1492c,0x1492b,0x1492d,0xe2454,0x00000,
-0xe2453,0xe2451,0x14c23,0x00000,0x14c22,0x14c24,0xe2752,0x15022,
-0x00000,0x12279,0x22e21,0x1227a,0x15927,0x1227c,0x1227b,0x23a44,
-0xe3976,0x1227d,0x1677e,0x1227e,0xe5e25,0x1442b,0xe2134,0x14479,
-0x14740,0x14c25,0xe2b37,0x1442c,0x1447c,0x1447a,0x1447b,0x00000,
-0x00000,0x14741,0xe227a,0x00000,0x00000,0x1492e,0x14c27,0x14c26,
-0x14c28,0xe2e7b,0x00000,0x00000,0x15440,0x00000,0xe403f,0xe6453,
-0x17035,0x00000,0xe2127,0x00000,0xe214d,0xe2148,0xe214e,0x2212e,
-0x00000,0x14574,0x14575,0xe2178,0xe2179,0x14742,0x00000,0x2232c,
-0xe2755,0x15024,0x15023,0x22e23,0x22e22,0x15928,0xe2128,0x1447d,
-0x22135,0xe217a,0x00000,0x00000,0x00000,0xe2457,0x2254d,0xe2b39,
-0x15025,0xe2f5b,0x15443,0xe2f59,0x15441,0x15442,0xe2f5a,0x00000,
-0xe344d,0x00000,0x17036,0x00000,0x14576,0x00000,0x00000,0x00000,
-0x14743,0x2217b,0xe227e,0xe227d,0xe227c,0xe2459,0x1492f,0x14930,
-0xe245a,0x2232d,0x00000,0x00000,0x2254e,0x14c29,0x2254f,0x00000,
-0x00000,0xe2b3b,0xe2b3d,0xe2b3e,0x22e25,0x22e26,0x15446,0xe2f5e,
-0x22e27,0xe2f5f,0x22e24,0x15447,0x15445,0x15444,0x22e28,0xe344f,
-0x2336b,0xe344e,0xe397d,0xe397a,0x23a45,0x00000,0xe397e,0x2416a,
-0x24927,0xe4b2f,0xe4b2e,0xe4b30,0x16c29,0x17037,0x25644,0xe5442,
-0x1442d,0x1443b,0xe212f,0xe2135,0xe2151,0xe217b,0x00000,0x00000,
-0xe2322,0x00000,0x00000,0x00000,0xe245b,0xe2759,0x00000,0x00000,
-0x15929,0x15e33,0x00000,0x16821,0xe457a,0x22123,0x1447e,0x00000,
-0x14579,0x14577,0x14578,0x00000,0x00000,0x14c2a,0xe275a,0x00000,
-0x1442e,0x1442f,0x00000,0x14443,0xe2136,0xe2152,0x14521,0x14522,
-0x14523,0x2214c,0x1457a,0xe217d,0x2214b,0x00000,0x14747,0xe2325,
-0x2217d,0x14745,0x14746,0x2217c,0xe2324,0xe2326,0x14748,0x14744,
-0xe2327,0x00000,0x00000,0x00000,0x2232e,0x14f4f,0x2232f,0xe245f,
-0xe2461,0x22330,0x00000,0xe245c,0x14932,0x14931,0xe245e,0xe245d,
-0x14935,0x14933,0x14934,0xe2460,0x00000,0x00000,0x14c30,0xe275b,
-0x14c2f,0x22554,0x22551,0x22552,0xe275e,0x22550,0x14c31,0x14c2d,
-0x14c2c,0xe275f,0x14c2e,0x14c2b,0xe275d,0x00000,0xe644f,0x00000,
-0x00000,0x14c32,0x00000,0x15027,0x22932,0xe2b3f,0x22553,0x1502c,
-0xe2b40,0x22933,0x15028,0x1502b,0x1502a,0x15029,0x15026,0xe2b43,
-0x00000,0x00000,0x22e2b,0xe2f68,0x1544a,0x22e2e,0x15448,0xe2f65,
-0x00000,0xe2f62,0x22e2a,0x1544b,0x15449,0x1544c,0x22e2c,0x22e2d,
-0xe2f60,0x22e29,0x22e2f,0xe2f66,0xe2f61,0xe2f63,0x00000,0xe2f64,
-0xe3450,0x15e37,0x1592a,0x2336c,0x2336e,0x2336d,0x2336f,0x1592b,
-0xe3a23,0x00000,0x15e34,0xe3a21,0x15e35,0x15e36,0xe3451,0x16337,
-0x2416c,0xe4041,0x2416b,0x2416d,0x2416e,0x16338,0xe4040,0x16336,
-0x24928,0x24929,0x16823,0x16822,0x24c61,0x00000,0xe4b31,0x16c2a,
-0x16c2b,0x16c2c,0x16c2e,0x24f5a,0x24f5b,0x16c2d,0xe4b32,0x00000,
-0xe5036,0x17038,0x00000,0x17039,0xe5037,0x00000,0x26539,0x26b51,
-0x26b50,0x26e7e,0xe602c,0x14430,0xe2137,0xe2154,0xe2153,0x1457c,
-0x1457b,0x00000,0x00000,0x14749,0x00000,0x00000,0x2217e,0x00000,
-0xe2328,0x14937,0x14938,0x14936,0x14939,0x22331,0x22332,0x00000,
-0x00000,0x00000,0x00000,0xe2463,0xe2462,0xe2761,0x00000,0x00000,
-0x00000,0xe2760,0x00000,0x14c34,0x22555,0xe625a,0x14c33,0xe2762,
-0x22934,0x15030,0x22935,0x1502f,0xe2b48,0xe2b46,0x00000,0x1502d,
-0x00000,0x1502e,0xe2b47,0x00000,0xe2f6f,0x22e30,0xe2f6c,0xe2f6a,
-0xe2f6d,0xe2f6e,0x1592c,0x23371,0xe3452,0x1592f,0x23370,0x15b2b,
-0x1592e,0x1592d,0x00000,0x15e3a,0x00000,0x15e39,0x15e38,0x16339,
-0xe4045,0xe4044,0x1633c,0x1633d,0x1633b,0x00000,0x1633a,0xe4046,
-0x00000,0x2492a,0xe4621,0x2492b,0x00000,0xe457e,0xe4b33,0x24f5d,
-0x16c2f,0x24f5c,0xe4d2c,0x1703a,0x25c4b,0x17344,0x00000,0x2653a,
-0x17961,0x00000,0x14444,0x14524,0x22136,0xe2155,0x14525,0x14526,
-0xe2156,0x00000,0x00000,0xe2223,0xe2222,0x1457d,0x1457e,0xe2224,
-0x1474a,0x22333,0x22556,0x22557,0x00000,0x15031,0x22e31,0x15931,
-0x15930,0x23a47,0x23a46,0x00000,0xe5038,0x14431,0x14527,0x14621,
-0x00000,0x15932,0x22124,0x00000,0x2214d,0x14622,0xe2226,0x22222,
-0x1474c,0x1474b,0x22221,0x1493a,0xe6450,0xe2465,0x00000,0xe2b49,
-0x00000,0x00000,0x1544d,0x00000,0x00000,0x23372,0x00000,0x1633e,
-0x2492c,0x16824,0xe4623,0xe4b34,0x25645,0xe5444,0xe5c34,0x2686a,
-0xe2129,0x14528,0xe2157,0xe2466,0x22558,0x22936,0x15935,0x15933,
-0x15934,0x14432,0x00000,0x14445,0x1243f,0x1452b,0xe2159,0x1452a,
-0x14529,0x14625,0x14624,0xe232a,0x2214e,0x22223,0x00000,0xe232b,
-0xe232d,0x14c38,0x14c35,0x14c37,0x14c36,0xe2763,0x00000,0x15032,
-0xe2b4a,0x00000,0x15e3b,0x00000,0x14433,0xe215a,0x1452c,0xe2227,
-0x14627,0x14626,0x00000,0x22334,0x00000,0xe6451,0x14c39,0xe2a5c,
-0x00000,0xe212a,0x00000,0x00000,0x22137,0xe2228,0x14629,0x14628,
-0x1474d,0x1474e,0x22335,0x1493b,0xe2467,0x1493c,0xe2765,0x14c3a,
-0x14c3b,0x14c3c,0xe2766,0x15033,0x22937,0xe2b4b,0x00000,0x1544e,
-0xe4047,0x00000,0x22125,0x00000,0x1452d,0x00000,0xe215b,0x00000,
-0x00000,0xe2229,0x22224,0xe232f,0x00000,0x00000,0x22336,0x22337,
-0x00000,0x00000,0x22559,0xe2767,0x2255a,0x00000,0x22939,0x22938,
-0x2293b,0x2293a,0x15034,0xe6452,0x23373,0x15450,0x22e32,0x1544f,
-0xe3454,0x00000,0x00000,0x00000,0x23a48,0x15e3c,0xe3a28,0x23a49,
-0xe3a27,0xe404a,0xe4049,0xe4048,0x2492d,0x16825,0xe4625,0x00000,
-0xe4626,0xe4b35,0x16c30,0xe5445,0x2653b,0x00000,0xe212b,0xe215c,
-0x00000,0x22138,0xe222a,0x1462a,0x00000,0x00000,0xe2331,0x00000,
-0x00000,0xe2769,0xe276a,0x15936,0xe3455,0xe3a29,0x00000,0x00000,
-0x14434,0x14446,0x1452f,0x1452e,0xe215e,0x14530,0xe2160,0x00000,
-0xe222b,0x00000,0xe2333,0x00000,0x14c3e,0xe276b,0x14c3d,0x14c3f,
-0x00000,0xe2b50,0xe2b4f,0x15035,0xe2b4e,0xe2b4d,0x00000,0x15451,
-0xe404b,0x25646,0x1763b,0x14447,0x1462c,0x1463b,0x14636,0x00000,
-0x14631,0x14630,0x14637,0x14635,0x1462e,0x1463c,0x1462f,0x1462b,
-0x1463a,0x14639,0x14638,0x1462d,0xe2231,0x14634,0xe222d,0xe222e,
-0x14633,0xe222f,0x00000,0x1463d,0x14632,0x00000,0x00000,0xe2335,
-0xe2337,0x14754,0x00000,0x1475a,0x14756,0xe2339,0x1475c,0x22225,
-0x14759,0x1474f,0x14752,0x14755,0x14751,0x14758,0x1475b,0x14750,
-0x14753,0x14757,0x1475d,0xe233a,0x00000,0xe233b,0xe2334,0x00000,
-0x22340,0x2233d,0xe2476,0x14949,0x2233e,0x1493d,0x1493f,0x14957,
-0x14952,0xe2479,0xe247e,0xe2475,0x22345,0x2233f,0x14941,0x14943,
-0x22344,0x1494a,0x2233a,0x14956,0x14958,0x1493e,0x1494f,0xe2524,
-0x22338,0x14955,0xe2477,0x14946,0xe247b,0x14950,0x14951,0x22339,
-0x1494e,0x1494c,0xe2470,0x1494d,0x14953,0x22341,0x14940,0xe2521,
-0x14954,0x22343,0x14948,0x14945,0xe2473,0x2233c,0x14944,0x22346,
-0x14947,0xe247c,0x1494b,0xe2478,0xe2474,0xe246d,0x14942,0x22342,
-0xe247d,0xe2522,0x00000,0x00000,0x2233b,0x00000,0x00000,0x00000,
-0x00000,0x00000,0xe2523,0x00000,0x00000,0x00000,0x00000,0xe276e,
-0x2256b,0x2256a,0x14c51,0x2256d,0x2256f,0x22564,0x22567,0x2256e,
-0x14c52,0xe2774,0xe2778,0x22561,0x22565,0xe2775,0x00000,0x22569,
-0x2294a,0x14c4d,0x2294e,0x14c40,0x22566,0x14c41,0x14c4e,0x14c47,
-0x14c43,0xe2771,0x22562,0x14c46,0x14c4b,0x14c54,0x22563,0x2255c,
-0x14c45,0x2255d,0x2255f,0x00000,0x14c48,0xe276c,0x14c4a,0x2255b,
-0x22560,0xe2770,0xe2779,0x14c53,0x14c4f,0x22568,0x14c55,0xe2773,
-0x14c4c,0x2255e,0x14c49,0xe276f,0xe2777,0x14c44,0x14c42,0x00000,
-0x2256c,0x00000,0x14c50,0x00000,0x00000,0x00000,0xe2b5c,0xe2b5d,
-0x22949,0x2293d,0x2294c,0xe2b57,0xe2b59,0x2293f,0x1503c,0x1504a,
-0x15038,0x15049,0x15041,0x15046,0x15036,0x2293e,0x22944,0x15045,
-0x22950,0x15047,0xe2b5b,0x1503d,0xe2b54,0xe2b5e,0x22946,0x22943,
-0x1503b,0xe2b51,0x2293c,0x15048,0x2294b,0x15040,0x2294d,0x1504b,
-0x15037,0x15042,0x1503f,0x22941,0x15043,0x22947,0x22948,0x1503e,
-0x15044,0x1503a,0xe2b55,0xe6454,0xe2b63,0xe2b61,0x15039,0x22940,
-0xe2b53,0x00000,0x00000,0x00000,0x00000,0x00000,0x22945,0x00000,
-0x00000,0x00000,0xe2b58,0x00000,0x00000,0x00000,0x2294f,0x00000,
-0x22e46,0x1545e,0x22e34,0x00000,0x22e39,0x15457,0x15462,0x22e37,
-0x15452,0x1545c,0x15461,0x22e3e,0x00000,0x1545d,0x15460,0xe2f77,
-0xe3021,0x22e41,0x15458,0x22e38,0xe2f74,0xe2f78,0xe3022,0x22e44,
-0x22e45,0xe2f79,0x1545a,0x22e43,0x15456,0x15465,0x00000,0x22e3b,
-0xe2f7b,0x15454,0xe2f7a,0x22e48,0x22e3c,0x22e40,0x15459,0x15464,
-0x22e3d,0x1545f,0x22e42,0x22e49,0x23424,0xe2f73,0x22e47,0x15466,
-0x15453,0x22e3f,0x22e36,0xe2f76,0x1545b,0x00000,0x00000,0x22e35,
-0xe2f7e,0xe3025,0x22e3a,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x22e33,0x15463,
-0xe6721,0xe345f,0x2337a,0xe3468,0x15949,0x2342a,0x15947,0x15944,
-0x23421,0x15940,0x23425,0x1594b,0x23379,0x2337e,0x2337d,0x15455,
-0x15946,0x23428,0xe3466,0x2342b,0x23376,0x00000,0x15e4e,0xe3467,
-0x2342c,0x1594c,0x00000,0x1593e,0x1593b,0x23423,0x15938,0x00000,
-0x23429,0xe345b,0x1593f,0x2342d,0xe3458,0x23377,0x23427,0x15942,
-0x23378,0x2337b,0x23422,0xe3462,0xe3461,0x15943,0x15941,0x1594d,
-0xe3457,0xe3a36,0xe3464,0x00000,0x15948,0xe345e,0x1593c,0x15a76,
-0x00000,0x1593d,0x2337c,0x1594a,0x15945,0x23426,0x1593a,0x00000,
-0xe3459,0x00000,0x15939,0xe6457,0x00000,0x00000,0x00000,0x00000,
-0x00000,0xe6456,0xe6722,0xe6455,0x00000,0x23374,0x23375,0x23a4e,
-0x00000,0x00000,0xe3a3c,0x15e3d,0x15e40,0x23a59,0x15e54,0x23a5c,
-0x15e3e,0x23a55,0x15e44,0x15e4a,0x16143,0xe3a31,0xe3a38,0x15e48,
-0x23a52,0x15e55,0x15e41,0x15e49,0x23a5a,0x2417c,0x23a5f,0x23a53,
-0x00000,0x23a4a,0x23a57,0x23a51,0x15e47,0x23a5d,0xe3a2e,0xe3a2a,
-0x15e43,0x15e57,0x15e50,0xe3a33,0x15e45,0x15e42,0xe3a40,0x15e4d,
-0xe3a34,0x23a5e,0x23a50,0x23a56,0x23a58,0x23a4c,0x23a5b,0x15e3f,
-0x23a4b,0xe3a42,0x15e46,0x15e56,0x15e52,0x23a4d,0x15e4c,0xe3a3b,
-0x00000,0x15e53,0x15e4f,0x15e4b,0xe3a2f,0x23a54,0x00000,0x00000,
-0x00000,0x00000,0xe6723,0x15e51,0x00000,0x00000,0x00000,0x2417a,
-0x24176,0xe4051,0x24227,0x2416f,0x24178,0x1634c,0x1634d,0x16345,
-0x24223,0x1634f,0x24174,0x24173,0x24171,0x24225,0x16343,0x2417d,
-0x24172,0x16346,0x2417b,0x16341,0x24177,0x2417e,0x24222,0xe404e,
-0x00000,0x24226,0x1634a,0x24170,0x16344,0x24175,0xe3a2b,0x1633f,
-0x00000,0x1634b,0x24221,0x16347,0x16348,0x1634e,0x16342,0x12321,
-0x16340,0x24179,0xe404c,0x00000,0x00000,0x00000,0xe6725,0x16349,
-0xe6724,0x00000,0x24224,0x00000,0xe6458,0x00000,0x16835,0x16830,
-0xe462e,0x2493c,0x24938,0xe4628,0x24932,0x1682a,0x16826,0x2493b,
-0x16827,0x24935,0x24937,0xe4629,0x2493a,0xe4636,0x1682c,0xe462c,
-0x16833,0x1682d,0x00000,0xe462a,0x24930,0x1682e,0x1682f,0x24933,
-0x16834,0xe4634,0x24931,0x24936,0x1682b,0x2492f,0x16831,0x16829,
-0xe4633,0x00000,0x00000,0x16828,0x24934,0x24939,0xe4631,0x16832,
-0xe645a,0x00000,0xe6459,0x00000,0x00000,0x00000,0xe4650,0x2492e,
-0xe4630,0x16c37,0x24f6e,0xe4b41,0x24f6b,0xe4b38,0x16c31,0x16c3d,
-0x16c3e,0xe4b3d,0x16c34,0x24f69,0x16c36,0x24f61,0x16c3c,0xe4b44,
-0x24f6d,0x16c33,0x24f6f,0x16c32,0x00000,0x24f6a,0x24f6c,0x16c35,
-0x24f68,0x24f62,0x24f5f,0x00000,0xe4b3e,0x23a4f,0x24f65,0xe4b37,
-0x24f5e,0x24f64,0x24f63,0xe4b3b,0x24f60,0xe4b43,0x16c39,0xe4b45,
-0xe4b40,0xe4635,0xe4b3c,0x16c38,0xe4b39,0x00000,0xe4b3f,0x16c3a,
-0x24f66,0x1703b,0x24f67,0x00000,0x00000,0x00000,0x2564f,0xe503f,
-0x25648,0xe5040,0x17047,0x2564c,0x1703f,0x17043,0x2564b,0xe503b,
-0x17042,0x1703e,0x17041,0x1703c,0x17046,0x2564d,0x25649,0x17045,
-0x25647,0x17044,0x2564e,0x2564a,0x16c3b,0x00000,0x17048,0x25650,
-0x17040,0x1703d,0x00000,0xe503d,0x00000,0xe5448,0x25c52,0x25c54,
-0x17346,0x25c55,0x25c53,0x25c51,0x25c50,0x17348,0x25c4f,0x17349,
-0x00000,0xe5449,0xe5447,0x00000,0x25c4d,0x25c4e,0x17345,0x1734a,
-0x17347,0xe645d,0xe645b,0x25c4c,0xe575b,0x1763c,0xe575a,0x26148,
-0x26146,0x2614b,0x26149,0xe5758,0x26147,0x2614a,0xe5759,0xe5757,
-0xe575c,0x00000,0x00000,0x00000,0x00000,0x1782c,0x2653e,0x2653f,
-0x1782d,0x00000,0x26540,0x2653c,0x26541,0x2653d,0x1763d,0xe5a2d,
-0xe645e,0x00000,0x2686b,0x2686d,0x17964,0x2686c,0x17963,0x17962,
-0xe6726,0xe6727,0xe645c,0xe5e26,0x17965,0x26b53,0x26b54,0x00000,
-0x17a65,0x17a64,0x17a66,0x26b52,0xe6728,0x26d46,0x26d45,0xe5f40,
-0x17b59,0x17b5b,0x17b5a,0x26d47,0x17c34,0x27034,0x00000,0x00000,
-0x00000,0x17c5d,0xe6071,0x27033,0x2707c,0x00000,0x00000,0x2212a,
-0xe2177,0x00000,0x1463f,0x1463e,0x00000,0x14760,0x1475f,0x22227,
-0x1475e,0x22226,0x00000,0xe233e,0x1495b,0x22349,0xe252c,0x22348,
-0x00000,0xe2526,0x14959,0x1495c,0xe252b,0xe252a,0x22347,0xe2529,
-0x1495a,0xe2548,0xe2527,0xe2528,0x00000,0x00000,0xe2822,0x22570,
-0xe277d,0x22571,0x14c56,0xe277c,0xe2821,0xe277b,0x00000,0x1504c,
-0xe2b65,0x22e4a,0x22e4b,0x15467,0x15468,0xe3027,0x00000,0x2342f,
-0x1594e,0x15950,0x2342e,0x1594f,0x23a60,0x15e58,0xe3a44,0xe3a43,
-0x00000,0x00000,0x16350,0x16351,0x24228,0xe4052,0x16837,0xe4637,
-0x16836,0x00000,0x24f70,0x25652,0x25651,0xe5f41,0x2715a,0x14448,
-0x22139,0xe2161,0x2214f,0x22150,0xe2234,0x00000,0x00000,0xe6249,
-0x14763,0x14767,0x22229,0x00000,0x14765,0x14764,0x22228,0x14766,
-0x14762,0xe2341,0xe2342,0x14761,0x2222a,0xe233f,0xe2340,0x00000,
-0x00000,0x00000,0x00000,0x14966,0xe2531,0xe253e,0x14963,0xe2530,
-0x1495f,0x2234a,0xe2540,0xe2536,0xe252f,0x2234b,0xe253c,0x14961,
-0xe252d,0x2234d,0x1495d,0x2234e,0x2234c,0x14960,0x14962,0x14965,
-0x14964,0x1495e,0x2234f,0xe2532,0xe2541,0xe2542,0xe2533,0xe2538,
-0xe2537,0xe645f,0x00000,0x00000,0x00000,0x00000,0x00000,0xe2535,
-0x00000,0x14c5b,0x2257e,0xe2825,0x14c5d,0xe2823,0x14c5c,0xe2826,
-0x22621,0x14c5a,0x14c59,0x22575,0x00000,0x22574,0xe2828,0x22572,
-0x22577,0x22576,0x22573,0x2257c,0x2257d,0x2257a,0x22578,0x14c58,
-0xe2829,0x00000,0x00000,0x2257b,0x14c5e,0x22622,0x00000,0xe282a,
-0x22579,0xe2824,0x1504d,0x14c57,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0xe6460,0x1504e,0x22955,0xe2b69,0xe2b68,0x2295b,
-0xe2b6c,0xe2b67,0xe2b6a,0x15054,0x22959,0x2295f,0xe2b71,0x22956,
-0x2295a,0x2295c,0x2295e,0x22958,0xe2b70,0x22957,0x22952,0x22953,
-0x1504f,0xe2b6b,0x15051,0x15050,0x22954,0x2295d,0xe2b6d,0xe2b72,
-0xe2b6e,0x00000,0x00000,0x00000,0xe2b66,0x00000,0x15053,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x22951,0x22e55,0xe302a,
-0x22e54,0x22e59,0x22e50,0xe3030,0x22e53,0x22e52,0xe302f,0x22e56,
-0xe3038,0x22e5a,0x15469,0x1546c,0xe3034,0xe3035,0x22e51,0x22e57,
-0xe3033,0xe3028,0xe3037,0x1546b,0x22e4c,0xe302b,0x15052,0x2343d,
-0x22e58,0xe3036,0x22e4f,0x00000,0x1546a,0x22e4e,0x00000,0x00000,
-0x00000,0x00000,0x00000,0xe3032,0x23434,0xe346e,0xe3471,0x15951,
-0x15955,0x23444,0x23432,0x23440,0x15956,0x23442,0xe3472,0x23448,
-0xe3474,0x2344c,0xe3469,0x00000,0x23443,0x23437,0x2343f,0xe346b,
-0x2344d,0x2344b,0x23441,0x2343c,0x23435,0x23a68,0x23433,0x1595a,
-0x2343a,0x1595b,0x15957,0x23430,0x23446,0x23438,0xe346f,0xe3475,
-0x23436,0x23449,0x15958,0xe3476,0x2344f,0x15952,0x15954,0x2343e,
-0x23439,0x1546d,0x15953,0x2343b,0x2344a,0x2344e,0x23445,0xe6461,
-0x23447,0x00000,0xe6462,0xe6463,0x23431,0x00000,0x00000,0x00000,
-0xe3a4a,0x23a63,0xe3a45,0x23a6c,0x23a6b,0x15e60,0x23a64,0xe3a47,
-0x15e61,0x15e5f,0xe3a50,0x23a66,0x15e5c,0x23a6a,0xe3a4c,0x23a65,
-0x23a67,0x23a61,0x15e5a,0xe6336,0x23a74,0x23a73,0x23a70,0x15e59,
-0x15e5d,0x15e5e,0x22e4d,0x23a6d,0x15e5b,0x15959,0x23a6f,0x23a62,
-0x23a72,0x23a71,0xe3a4e,0x23a75,0xe3a49,0x24236,0xe3a4b,0x23a6e,
-0x00000,0x00000,0x00000,0x00000,0x00000,0xe6337,0x00000,0xe6464,
-0x23a69,0x2422e,0x1635b,0x1635e,0x16359,0x2422d,0x24231,0x2422c,
-0xe4057,0x16353,0x1635d,0x24229,0x16357,0x24230,0xe405b,0x16355,
-0x16354,0x24233,0x16356,0x24235,0xe4056,0x24232,0x16352,0xe405e,
-0xe405c,0xe4058,0x1635c,0x24237,0x2422b,0x24234,0xe405d,0xe6343,
-0x2422a,0xe405a,0xe4059,0x16358,0xe4054,0x1635a,0x00000,0x2422f,
-0x00000,0x24238,0xe4643,0xe463e,0x24944,0x16838,0x2494a,0xe4642,
-0xe463c,0x1683d,0x24946,0x2494d,0x2493e,0x1683f,0x16839,0x24943,
-0x16c3f,0x24942,0x2494b,0x1683a,0xe463d,0x1683e,0x24941,0x24947,
-0x2494c,0x2493d,0x1683c,0x24945,0xe463a,0xe4645,0x24949,0x2494f,
-0x2493f,0x24948,0xe4638,0x1683b,0x2494e,0xe4641,0xe4644,0xe4640,
-0x24940,0x00000,0x00000,0xe6465,0x16c43,0x24f72,0x16c41,0x16c40,
-0x24f74,0x24f79,0xe4b46,0x24f75,0xe4b50,0x24f78,0x16c46,0xe4b51,
-0x1702e,0x16c45,0xe4b4b,0x24f71,0x24f77,0xe463f,0x16c44,0x24f76,
-0xe4b4d,0x24f73,0xe4b49,0x16c42,0xe4b4f,0xe4b4c,0x00000,0xe4b47,
-0x00000,0x00000,0x25657,0xe504a,0x25659,0x25654,0x1704a,0x25656,
-0xe504b,0x17049,0x25658,0xe5048,0xe504c,0x1704c,0x2565a,0x1704b,
-0x25653,0x25655,0xe5049,0x00000,0x00000,0xe544b,0x1734e,0x25c58,
-0xe544c,0x1734d,0x25c59,0x1734c,0x25c57,0x1734b,0x25c56,0x00000,
-0x1763f,0x1763e,0x26542,0x26544,0xe5a2f,0x26543,0x1782e,0x1782f,
-0xe5a2e,0x00000,0x17830,0x2686e,0x17966,0x00000,0xe5e28,0x26f22,
-0x26f21,0x17c5e,0x00000,0x14449,0x14531,0x00000,0xe2343,0x14967,
-0xe2545,0xe2543,0xe2544,0xe282d,0x22960,0xe2b77,0x00000,0xe3477,
-0x00000,0x15e62,0x15e63,0xe3a52,0x24239,0x16840,0x24950,0x24f7a,
-0xe6466,0xe504d,0xe2139,0x2213a,0xe2235,0xe2344,0x22350,0x00000,
-0xe2b7a,0xe2b79,0xe213a,0xe2546,0x22623,0x22961,0x22e5b,0x1546e,
-0xe4646,0xe6560,0x26545,0x00000,0x17a67,0x1444a,0x14640,0x22151,
-0xe2236,0x14768,0x14769,0x00000,0x14c5f,0x00000,0x00000,0xe3479,
-0x1595c,0x00000,0x16842,0xe405f,0x16843,0x16841,0xe4b53,0x1444b,
-0x00000,0x14532,0x14534,0x14533,0x2213b,0x14535,0x14641,0x22152,
-0xe2238,0x14642,0xe2237,0x00000,0xe2239,0x00000,0xe2347,0x1476a,
-0x1476b,0x00000,0x00000,0x00000,0x2222b,0xe2549,0x14968,0x00000,
-0x22351,0x00000,0x00000,0x00000,0x14c63,0x22624,0x00000,0x14c61,
-0x14c62,0x14c60,0x22e5c,0xe282e,0xe282f,0xe6467,0x15058,0x15057,
-0x15059,0x15056,0xe2b7c,0x22962,0x14c64,0x15055,0x00000,0x1546f,
-0x15470,0x00000,0x15471,0xe347b,0x23450,0xe347c,0xe347d,0x00000,
-0x15e64,0x23a76,0x1595d,0xe3a53,0xe3a54,0x00000,0xe4060,0x1635f,
-0xe4061,0x16845,0x16844,0x24951,0xe4648,0x16c47,0x1704d,0x00000,
-0x2614c,0x26d48,0x26f23,0x1444c,0x14643,0xe223b,0x14644,0x22231,
-0x1476d,0x14770,0xe234b,0x2222f,0x2222d,0x1476f,0x22230,0x22232,
-0x2222c,0x14772,0x14771,0x1476e,0x1476c,0x2222e,0xe234d,0x00000,
-0x00000,0xe2555,0x14973,0x00000,0xe254c,0x14970,0x22356,0x22359,
-0x22358,0x00000,0x1496a,0x14972,0xe254b,0x00000,0x1496f,0x22355,
-0x22353,0x1496e,0xe2556,0xe2553,0xe254e,0x14969,0x1496c,0xe2551,
-0x22354,0x2235b,0x22357,0x1496d,0x14971,0x14974,0x22352,0x2235a,
-0x1496b,0x00000,0x00000,0x00000,0xe2841,0xe2833,0x14c69,0x14c71,
-0xe2838,0x22630,0x22629,0x14c72,0x22634,0x22625,0x2262c,0xe2845,
-0xe2840,0x14c68,0x22626,0x14c66,0x2262d,0x22631,0x14c65,0xe283d,
-0x22632,0x2262b,0xe2837,0x2262e,0xe2835,0x14c74,0x14c6b,0x22635,
-0x22633,0xe283f,0x14c70,0x14c6e,0x2262a,0x14c6d,0x22628,0x22627,
-0x14c6c,0x14c6a,0x14c73,0x14c6f,0x14c67,0xe2c26,0x2262f,0xe2846,
-0x1505b,0xe2c2d,0x15062,0x22970,0x1505a,0x22968,0x22964,0xe2c21,
-0x22974,0x22963,0xe2c2c,0x1505d,0x2296d,0x15060,0x15063,0xe2c2e,
-0x1505e,0x22971,0x15061,0xe2c23,0x15478,0x22977,0x22965,0xe2c24,
-0xe2c25,0x22967,0x2296e,0x22972,0x22976,0x22973,0x2296c,0x2296f,
-0xe2c2b,0xe2c29,0x22969,0x15065,0x2296b,0x2296a,0x22975,0x1505c,
-0x22966,0x15064,0xe2c2a,0x1505f,0xe2c28,0x00000,0x00000,0x00000,
-0x00000,0x1547e,0x22e64,0xe3040,0x1547d,0xe2c27,0x00000,0x22e62,
-0xe6270,0x15472,0xe304f,0x15477,0xe304a,0x22e61,0x22e5e,0x22e63,
-0x15473,0x22e5d,0xe304e,0x15476,0x15474,0xe303e,0x22e65,0x15475,
-0x15479,0xe303b,0xe3045,0x1547a,0xe3048,0x1547c,0xe3052,0x00000,
-0x00000,0x1547b,0xe303c,0xe3522,0xe3538,0x22e5f,0x22e60,0xe304d,
-0x00000,0xe304b,0x00000,0x22e66,0x00000,0x23457,0x1595e,0x23b26,
-0x23456,0x23469,0xe3528,0xe3524,0x15964,0xe3531,0x23467,0xe3533,
-0x15963,0x1595f,0x23470,0x23460,0x23463,0xe352e,0x15967,0x2346d,
-0x23465,0x15960,0x15968,0xe352a,0x2346a,0x23468,0xe352f,0xe353b,
-0x23459,0x2346e,0x23462,0x2345d,0xe353a,0x23453,0x2346f,0x2345f,
-0x23452,0xe3539,0x15966,0x23464,0x23471,0x23461,0x23455,0x2345a,
-0x23451,0xe3527,0x15965,0xe353c,0x2345e,0x2345b,0x15961,0x23454,
-0xe3530,0x2346c,0x15962,0xe352b,0x2345c,0x23458,0xe3529,0xe3534,
-0x2346b,0xe3532,0x00000,0xe3537,0x00000,0xe3535,0x00000,0x15e65,
-0x23a7d,0xe3a75,0x23a7a,0x23b2d,0x23b21,0x23b2e,0xe3a7c,0x15e67,
-0xe3a63,0xe3a61,0xe3a58,0x23b2a,0x23b27,0xe3a5b,0xe3a77,0xe3a72,
-0xe3a59,0xe3a60,0x23b28,0x23b2b,0x23b2f,0xe3a7b,0x23466,0x23b31,
-0x2424d,0xe3a66,0x15e68,0x23b32,0x23a78,0x23b24,0xe3a62,0x23b29,
-0xe3a5c,0xe3a5e,0x15e66,0x15e69,0x23b30,0x23b33,0x23a7c,0x23a79,
-0xe3a73,0xe3a5a,0x23a7b,0xe3a57,0xe3a7a,0x23b22,0x23a7e,0x15e6a,
-0xe3a56,0x23b2c,0xe3a79,0xe3a78,0x23b23,0x00000,0x23b25,0x23a77,
-0x24241,0x2423f,0x16368,0x16366,0x24249,0x24240,0x2424a,0x24246,
-0x2423e,0x2424c,0x2423d,0x24244,0x16365,0x16364,0x16363,0x24242,
-0x24247,0x16360,0x16367,0xe4067,0x2423b,0xe4066,0x24245,0x2423a,
-0x24243,0x16361,0x24248,0x2423c,0x16362,0x2424b,0xe4064,0xe3a6b,
-0xe406a,0xe6468,0x00000,0xe6469,0x00000,0x24955,0x1684a,0x16849,
-0x1684b,0x24961,0x24957,0x2495d,0x24952,0x24960,0x2495f,0x24963,
-0x2495c,0x16846,0x2495b,0x1684c,0xe464c,0x24954,0x16847,0xe464a,
-0x24962,0x16848,0x24956,0x24959,0x2495e,0x24958,0x24953,0xe464f,
-0xe4653,0x00000,0x00000,0x2495a,0x24f7c,0x16c4b,0x25021,0x24f7e,
-0x25023,0x25025,0xe4b5c,0x16c49,0xe4b58,0x24f7d,0xe4b54,0x24f7b,
-0xe4b5e,0x25026,0x25024,0x25022,0xe4b56,0x25028,0xe4b5a,0x25027,
-0x16c4d,0x16c48,0xe4b5b,0x16c4a,0x16c4c,0xe4b5d,0xe4b5f,0x25029,
-0x25661,0xe5050,0xe5053,0x25660,0x2565f,0xe5051,0x25662,0x2565b,
-0xe504f,0x2565c,0x25664,0x2565d,0xe5054,0x1704e,0x25666,0xe504e,
-0x25665,0x2565e,0xe5056,0x25c5d,0x17351,0x25c5b,0x25c60,0x25c5f,
-0x25663,0xe5450,0x17350,0xe544e,0x25c5e,0x25c5a,0x25c62,0x25c61,
-0x1734f,0xe5452,0x25c5c,0xe544f,0x1704f,0xe5451,0x00000,0xe5453,
-0x17640,0xe5a31,0xe5761,0xe575e,0x2614d,0x26546,0x26547,0x26548,
-0x17967,0x00000,0xe5c36,0x17968,0xe5c39,0x2686f,0xe5c3a,0x26b56,
-0x26b55,0xe5e29,0xe5f42,0x26d49,0x26d4a,0x26f24,0x27035,0xe6073,
-0x1444d,0x1444e,0x00000,0x1444f,0x14536,0x14645,0x22233,0x14773,
-0x14774,0x00000,0x14977,0x14978,0x14976,0x14975,0x00000,0x14c75,
-0xe2848,0x00000,0x22636,0x14c77,0x14c76,0x22637,0xe625c,0xe646a,
-0x00000,0x15066,0xe2c2f,0x15521,0x22e67,0x00000,0x23473,0x00000,
-0x15969,0x15e6c,0x23472,0x15e6b,0xe4071,0x1684d,0xe4072,0x24964,
-0x17050,0xe5057,0x17352,0x25c63,0xe5a34,0x17969,0xe5c3b,0x17b5c,
-0xe213b,0x22153,0xe223d,0x14646,0x22154,0x14777,0xe2350,0x14775,
-0x14776,0x14778,0x00000,0x1497a,0x14979,0xe255a,0x2235c,0x1497b,
-0x00000,0x00000,0x2235d,0x22638,0xe284c,0x22639,0xe284a,0x14c78,
-0x14c7a,0x14c7c,0x14c79,0x14c7d,0x14c7b,0xe284e,0xe284b,0xe284d,
-0x00000,0x00000,0x1506a,0x15067,0x15069,0x1506b,0x15068,0x22e68,
-0x22978,0x00000,0x00000,0xe2c32,0x22e6a,0x22e69,0x15527,0x00000,
-0x15523,0x00000,0x00000,0x15524,0x15526,0x15528,0x15525,0xe3057,
-0x1552a,0x15529,0x00000,0xe3056,0xe3055,0x00000,0x00000,0x1596e,
-0x23475,0x23474,0x1596d,0xe3541,0x1596c,0x1596b,0x1596f,0x1596a,
-0xe353f,0x00000,0x23b39,0x23b36,0x15e6e,0x23b35,0x23b3a,0x00000,
-0x15e70,0x23b38,0x15e6d,0x15e6f,0x23b37,0xe3a7e,0x2424e,0xe4074,
-0x2424f,0x24250,0xe4075,0xe4076,0xe4073,0xe6345,0x1684e,0x16856,
-0x24965,0x16850,0x16854,0x24966,0x16855,0x16851,0x16852,0x1684f,
-0x16853,0x16c50,0x23b34,0x16c51,0x16c4f,0x00000,0x16c4e,0x25667,
-0x17051,0x25c64,0x25c65,0xe5a35,0x00000,0x17831,0x1796a,0xe5e2a,
-0x14450,0xe223e,0x14779,0x00000,0x00000,0xe255e,0xe255c,0xe255d,
-0xe2850,0x1506c,0x00000,0x22e6b,0x1552b,0xe3058,0xe3059,0x15972,
-0x15971,0x15970,0x15e71,0x15e72,0x23b3b,0x16857,0x17052,0x14451,
-0x2213c,0x14537,0x22155,0xe624a,0xe223f,0x22234,0x1477a,0x00000,
-0xe2352,0xe2851,0x14c7e,0xe2c34,0x00000,0x00000,0xe3b24,0x24251,
-0xe4078,0xe6525,0x14452,0x00000,0x14538,0x22235,0x00000,0x00000,
-0x2235e,0x00000,0x2235f,0xe255f,0x1497c,0x00000,0x00000,0xe2c35,
-0x23b3c,0x15e73,0x00000,0x24252,0x00000,0x00000,0xe5454,0x17353,
-0x14453,0x14467,0x14539,0x22156,0x14647,0xe2354,0x14a22,0x14a21,
-0x1497d,0x1497e,0x00000,0x00000,0x2263a,0x14d22,0x14d23,0x2263b,
-0x14d21,0xe2854,0xe2855,0x15070,0x22979,0x1506f,0x1506d,0x1506e,
-0x1552e,0x1552c,0xe305a,0xe305b,0x22e6d,0x1552d,0x22e6c,0xe646b,
-0x15522,0x23476,0x00000,0xe3543,0x15974,0x15975,0xe3b26,0xe3b25,
-0x15973,0xe3544,0x16858,0x24967,0x16c52,0x16c53,0x00000,0x2502a,
-0x17354,0x2614e,0x2614f,0xe5a38,0x17a68,0x27036,0x2212b,0x1453a,
-0x00000,0x14454,0x00000,0x22158,0x22157,0x00000,0x00000,0xe646c,
-0xe2355,0x1477b,0x22237,0x22238,0x22236,0x00000,0x22239,0x00000,
-0xe235a,0x00000,0x00000,0x00000,0xe2561,0xe2566,0x22367,0x00000,
-0x22362,0x22364,0x22366,0x22363,0x14a26,0x22360,0xe2562,0x22361,
-0x14a23,0x14a24,0x22365,0x22368,0x14a25,0x22369,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0xe2563,0x22649,0xe285d,0x22643,
-0x2263e,0x14d25,0x22646,0x22644,0x2263d,0x2264a,0x2264d,0x22648,
-0x22641,0x14d27,0x22647,0x14d28,0x22642,0x22645,0x2263c,0x22640,
-0x2264c,0x14d29,0x00000,0x14d2a,0xe285e,0x2263f,0x2264b,0x14d24,
-0x14d26,0xe285c,0xe285f,0xe2857,0x00000,0x00000,0x00000,0x00000,
-0x00000,0xe2858,0x00000,0x00000,0x00000,0x00000,0x22a2c,0x22a25,
-0x22a2b,0x22a24,0x22a26,0x2297e,0x2297c,0xe2c3f,0x22a2d,0x22a2a,
-0x2297a,0xe2c3b,0x15072,0x22a28,0x22a29,0xe646d,0x22a27,0x2297d,
-0x2297b,0x15071,0x22a23,0x22a21,0xe2c3c,0xe2c42,0x22a22,0x22a2e,
-0x00000,0xe2c3e,0xe2c41,0x00000,0x00000,0xe2c43,0xe2c3d,0x00000,
-0x15533,0xe3063,0x15532,0xe305f,0x22e6e,0x1552f,0x22e70,0xe3064,
-0x15534,0x22e71,0x00000,0xe3061,0x15537,0xe3062,0x15535,0x22e72,
-0x22a2f,0x22e74,0xe305e,0x15531,0xe6271,0x15530,0xe6272,0x22e6f,
-0x22e73,0x15536,0x00000,0x00000,0x00000,0x00000,0x15977,0x15976,
-0xe354b,0xe3548,0xe3547,0x23478,0x2347c,0x2347e,0x15978,0x23523,
-0xe3551,0x1597c,0x23525,0xe3552,0x1597e,0xe354f,0x1597a,0x15a24,
-0xe3555,0x15a21,0x2347a,0x15979,0xe3b2b,0x23479,0x23477,0x23527,
-0x2347b,0xe3546,0x1597b,0x23526,0x15a22,0x23522,0x23521,0x15a23,
-0x2347d,0x1597d,0xe354e,0x00000,0xe354a,0x00000,0x23528,0xe3554,
-0x23524,0x23b4b,0x23b52,0x23b47,0x15e76,0x23b43,0x23b53,0x23b3d,
-0x23b50,0x23b4e,0x23b48,0xe3b36,0x23b51,0x23b4a,0xe3b28,0x23b42,
-0x23b54,0x23b40,0x23b4d,0x23b3e,0xe3b27,0x23b55,0xe3b37,0x15e77,
-0xe3b2a,0x23b4f,0x24255,0x23b41,0x15e74,0xe3b2e,0x23b45,0xe3b34,
-0x15e75,0x23b44,0x23b49,0xe3b33,0x00000,0x23b46,0x00000,0xe3b31,
-0x00000,0x23b4c,0x00000,0xe3b2d,0x00000,0x00000,0x24259,0x00000,
-0xe4121,0x00000,0x2425c,0x24254,0xe407c,0x24256,0xe407a,0x2425b,
-0x2425a,0x16369,0x00000,0x23b3f,0x24258,0xe4079,0xe407d,0x1636a,
-0x00000,0x24253,0x24257,0x00000,0x00000,0xe646e,0x00000,0x2496e,
-0xe465c,0x24975,0x2496c,0xe4654,0x24973,0x2496a,0x24972,0x24976,
-0x24969,0x2496d,0x24968,0xe4656,0x16859,0x00000,0x2496b,0x1685a,
-0x24971,0x24970,0x2496f,0xe4659,0xe465a,0x24974,0xe646f,0xe4b65,
-0xe4b66,0xe4b63,0x2502e,0x25030,0x16c55,0x25031,0xe4b6b,0x2502c,
-0xe4b67,0x2502b,0x25035,0xe4b69,0x25033,0x16c54,0x25036,0x2502d,
-0x25032,0x25034,0x2502f,0xe4b6a,0xe4b68,0xe6470,0xe5058,0x2566b,
-0x25670,0x2566a,0x2566f,0xe505b,0x25668,0x25672,0x2566e,0x25673,
-0x2566d,0x25669,0x25671,0xe505a,0x25674,0x2566c,0xe6471,0x25c66,
-0x17358,0xe5457,0x17356,0xe5459,0x17355,0x17357,0xe5455,0xe6472,
-0x26150,0xe5762,0x2643e,0x26549,0xe5a39,0x00000,0x26870,0x26871,
-0xe5c3d,0x1796b,0xe5c3c,0x26b57,0xe5c3e,0x17a69,0x00000,0x26b58,
-0xe5e2d,0x26d4c,0x17b5e,0xe5f43,0x17b5d,0x26d4b,0x17c35,0xe6030,
-0x26f25,0x00000,0x00000,0xe213c,0x00000,0x14455,0x1477c,0x2223a,
-0x2236a,0x14b56,0x15a25,0xe3557,0xe4b6c,0x14456,0x1464a,0x14649,
-0x14648,0x00000,0x00000,0x14a27,0x00000,0x00000,0x15538,0x00000,
-0x2425d,0x14457,0x14458,0x14459,0x1453b,0xe2567,0xe2860,0x15073,
-0x00000,0x22a30,0xe2c45,0xe2c44,0x00000,0x15e78,0x1445a,0x2213d,
-0xe2163,0x00000,0x1464b,0x1464c,0x22159,0x00000,0x1477d,0x00000,
-0xe235c,0xe2568,0x2236b,0xe256b,0x14a28,0x00000,0x2236c,0x00000,
-0x00000,0x14d30,0xe2862,0xe2861,0x2264f,0x14d2e,0x14d2d,0x2264e,
-0x14d2b,0x22650,0x14d2c,0x14d2f,0x00000,0x15074,0xe2c46,0x15076,
-0x22a34,0x22a31,0x22a32,0x22a33,0x22a35,0x15075,0x00000,0x00000,
-0x22e76,0x22e75,0xe3066,0x1553a,0xe3069,0x15539,0xe3068,0xe306a,
-0xe3067,0x00000,0xe355b,0x15a28,0x2352a,0xe3559,0x15a27,0x15a29,
-0x15a26,0xe3558,0xe355a,0x00000,0x00000,0x15e7a,0x23529,0x00000,
-0x15e7b,0x23b57,0xe3979,0x15e7c,0x23b56,0x15e79,0xe3b3a,0xe3b3b,
-0xe3b3d,0x00000,0x24260,0x24262,0x1636b,0x24261,0x2425f,0x2425e,
-0x00000,0x00000,0xe465d,0x24979,0x1685f,0x1685d,0x00000,0x1685e,
-0x24977,0x24978,0xe4b6d,0x1685b,0x2503a,0x25038,0xe4b70,0x16c57,
-0x25039,0x16c58,0x16c56,0x1685c,0x00000,0xe6473,0x25677,0x25675,
-0x25676,0x25037,0x25c68,0x17359,0x25c67,0x26151,0x26152,0x25678,
-0x2654a,0xe6677,0x1445b,0x1464d,0x14821,0x2223b,0x1477e,0xe2863,
-0x14d31,0x1636c,0xe213d,0x1453c,0x1464e,0x15077,0x15e7d,0xe213e,
-0x2215a,0xe2247,0x2215b,0xe2248,0x2223c,0xe6678,0x00000,0x14a2a,
-0x22370,0x2236e,0x14a2b,0x2236d,0x2236f,0x22371,0x00000,0x14a29,
-0xe256e,0x00000,0xe256d,0x00000,0x00000,0x14d35,0x14d36,0x14d33,
-0xe2865,0xe2867,0x14d32,0x22a39,0x14d34,0xe2868,0x00000,0x00000,
-0x15078,0xe2c48,0x22a38,0x22a3a,0x22a37,0x22a3b,0x15079,0x1553d,
-0x22e77,0xe306c,0x22e79,0x1553b,0x22e7a,0x1553c,0x22e78,0xe306b,
-0x22a36,0x2352b,0x2352e,0x2352f,0x2352c,0x15a2d,0x15a2c,0x15a2a,
-0x15a2b,0x2352d,0xe3561,0xe3560,0x00000,0xe3b3f,0x15a2e,0xe3b40,
-0xe3b3e,0x15f21,0x15f22,0x00000,0x15f23,0x24263,0x24265,0x24267,
-0x1636e,0x1636d,0x15e7e,0x24266,0x24264,0xe6474,0x2497d,0xe4661,
-0xe4660,0x2497b,0x24a23,0x16860,0x24a24,0x24a21,0x16861,0x2497c,
-0x2497a,0x24a22,0x16c5a,0x2503c,0x2497e,0x16c5c,0x2503d,0x16c5b,
-0x16c5e,0x2503e,0x16c59,0x16c5d,0x00000,0x2567d,0x2567b,0x2567a,
-0x2567c,0x25679,0xe505c,0x00000,0x17833,0xe6475,0x26872,0x26873,
-0xe5c3f,0x26b59,0x26d4d,0x17d22,0xe213f,0xe2361,0x14d37,0x14a2c,
-0xe2869,0xe286b,0x1507a,0xe2c4c,0xe2c4b,0xe306e,0x1445c,0x1453d,
-/* 0x5f00 */
-0x00000,0x1464f,0x2223d,0xe256f,0x14a2d,0x22372,0xe286d,0x22a3c,
-0x1507b,0x00000,0x16862,0x1445d,0xe2164,0xe2249,0xe2362,0x14822,
-0x00000,0xe3b42,0x1636f,0x1445e,0x1453e,0x1453f,0x00000,0x14651,
-0x14650,0x00000,0x2223e,0x14823,0x00000,0x22373,0xe2571,0x14a2e,
-0x00000,0xe286e,0x22652,0x22653,0x22654,0xe2870,0x14d38,0x14d39,
-0x22651,0x14d3a,0x00000,0x00000,0x00000,0x1507c,0x22a3d,0xe2c4d,
-0x22e7c,0x1553e,0xe306f,0x22e7b,0xe3562,0x15a2f,0x23530,0x15a30,
-0x23531,0xe3563,0xe3b47,0xe3b45,0x15f24,0x00000,0xe3b44,0x00000,
-0x24268,0x00000,0xe4122,0x24a26,0x24a25,0x00000,0x16863,0x00000,
-0x16c5f,0x2503f,0x17053,0x2567e,0x1735a,0xe5763,0x17b5f,0x26f27,
-0xe2140,0xe2141,0xe224a,0xe2351,0x22655,0xe2871,0x22a3e,0x15a31,
-0x23b58,0x16370,0xe4123,0xe505e,0x00000,0xe5764,0x17641,0x00000,
-0xe6164,0xe2142,0x14a30,0xe2572,0x14a2f,0x1507d,0xe2c50,0x22e7d,
-0x00000,0x15a33,0x15d29,0x15a34,0x15a32,0x15f25,0xe4124,0x24a27,
-0x16864,0x16c60,0xe5f45,0x2212c,0x2223f,0x00000,0x22375,0x14a31,
-0x22374,0x14a32,0x00000,0x00000,0x14d3e,0x22658,0x22657,0x14d3d,
-0x14d3b,0x14d3c,0x22656,0xe2876,0xe2875,0x15121,0x22a3f,0x15124,
-0x1507e,0x15126,0x15122,0x15123,0x15125,0xe6264,0xe3070,0xe3072,
-0x15541,0x15540,0x1553f,0xe3071,0xe6476,0x00000,0x23533,0x15a35,
-0x15a38,0x15a36,0xe6477,0x23532,0x15a3b,0x00000,0x15a37,0x23534,
-0x15a3a,0x15a39,0x00000,0x00000,0x00000,0x23b5a,0x23b59,0xe3b4b,
-0x15f28,0x15f26,0x15f27,0x23b5b,0x16371,0x2426a,0x16372,0x24269,
-0x00000,0x00000,0x25040,0xe4663,0xe4664,0x16c62,0x24a28,0x16c61,
-0xe4b72,0x16865,0xe6478,0x25722,0x25721,0x1735b,0x25c69,0x2654b,
-0x26874,0x26875,0xe5e2f,0x14540,0x00000,0x14652,0x00000,0xe224d,
-0xe6251,0x2215c,0xe224c,0x00000,0x14a34,0x14a36,0xe2578,0x22242,
-0x22378,0x22377,0x22376,0xe2366,0x22241,0x22240,0x14825,0x14a35,
-0x14a33,0x14824,0xe2367,0xe2369,0xe2577,0x14d3f,0x22659,0xe257b,
-0x14d40,0x2237d,0x00000,0x22421,0x2237e,0x2265a,0xe2576,0xe2574,
-0x2237a,0xe287e,0x14a3a,0x14a38,0xe257c,0x22379,0x2237b,0x22423,
-0xe2622,0x14a37,0xe2621,0x2237c,0x22427,0x14d42,0xe257d,0x22424,
-0x14a39,0xe2623,0x22422,0x22425,0xe257a,0x14d41,0xe2575,0x14d43,
-0x22426,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0xe2878,
-0xe2922,0x2266e,0x22661,0x2265f,0x2266d,0x22668,0x1512b,0x14d44,
-0x22669,0x2266c,0x15127,0x2266b,0x14d45,0x14d4a,0x14d48,0x22662,
-0xe6266,0x2265d,0x22664,0x14d4f,0x2266f,0x15128,0x22665,0x00000,
-0x15129,0x14d4b,0x22667,0xe2c5a,0x22a4e,0x1512a,0x2265c,0x14d4c,
-0x1512c,0x14d4d,0x14d49,0x14d4e,0x22666,0x2265b,0x2266a,0x14d46,
-0xe2877,0xe2c5b,0x2265e,0x22663,0x22660,0x14d47,0xe287a,0x22a40,
-0x00000,0x22a41,0x00000,0x00000,0x00000,0xe2921,0x00000,0x00000,
-0x22a4b,0x22f23,0x22a4c,0x15132,0x22a4f,0x22a45,0x15131,0x22a47,
-0xe6267,0x22a48,0xe2c60,0xe3079,0x22a4a,0x1512d,0xe2c56,0xe3073,
-0x15545,0xe2c57,0xe2c5d,0x22a46,0x22a42,0x15546,0xe307e,0x00000,
-0x22a50,0x15542,0x22f21,0x22a49,0xe2c54,0x22e7e,0x22a44,0x22a4d,
-0xe2c5f,0xe2c61,0x15130,0x15543,0x15136,0x15544,0x22a51,0x22f22,
-0x1512f,0x15548,0x15135,0x15134,0x15133,0x15547,0x22a52,0x15549,
-0x1512e,0x00000,0x22a43,0xe307a,0xe3078,0xe307b,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0xe2c5c,0x00000,0xe3076,0x15a3c,
-0x22f26,0x22f28,0x00000,0x22f2a,0x1554a,0x15550,0x23537,0x22f2e,
-0x22f25,0x15a3e,0x23535,0xe3122,0x1554f,0x1554d,0x22f30,0x00000,
-0x23536,0x00000,0x22f27,0xe3125,0x1554e,0x22f2b,0x15551,0x22f2d,
-0xe3568,0xe3074,0x1554c,0x22f2c,0x22f2f,0x22f29,0xe3127,0x1554b,
-0x15a3f,0xe3571,0x22f24,0x15a3d,0xe3572,0x00000,0xe3123,0xe3128,
-0x15a40,0xe3121,0xe356f,0x00000,0x00000,0x00000,0xe3126,0x00000,
-0x23539,0x23542,0x15f2b,0xe3b54,0x15a42,0x15a47,0x15f2c,0x23544,
-0x15a4e,0x23b5d,0x2353a,0x15a46,0x15a49,0x15a44,0x23538,0x23546,
-0x23549,0x23b6c,0x00000,0x23547,0x23b61,0x15a45,0x15a4c,0x15a50,
-0x23541,0x23b5c,0x23545,0x15a41,0x23b5e,0x23548,0x23b60,0x2353d,
-0xe356a,0x15f29,0xe3b56,0x2353b,0x2353c,0x15a4b,0xe3b55,0xe356e,
-0x15a4a,0x2353f,0x15a4f,0x23543,0x15a48,0x23540,0xe3579,0x15a4d,
-0x15f2d,0x15f2a,0x23b5f,0xe3b58,0x2353e,0xe3b59,0x15a43,0xe3576,
-0x00000,0xe3b5a,0xe3b4d,0x00000,0x00000,0x00000,0xe3574,0x00000,
-0x15f32,0x15f36,0x23b63,0x16377,0x15f34,0x23b67,0x15f38,0x2426b,
-0x23b69,0x16379,0x15f30,0x15f33,0x23b6a,0xe3b5e,0x23b6b,0x23b71,
-0x15f3a,0x1637a,0x00000,0x23b6d,0x23b72,0x23b66,0x16426,0xe3b4f,
-0x1637b,0x15f39,0x23b64,0x23b73,0xe3b51,0x16425,0x15f37,0x16374,
-0x23b70,0xe3b5d,0x15f3b,0x23b68,0x23b62,0x15f31,0x23b65,0x00000,
-0x23b6e,0xe412b,0x16373,0x16378,0x15f2e,0x23b6f,0xe3b61,0x16376,
-0xe3b62,0xe3b63,0xe3b50,0x15f2f,0x00000,0xe6479,0x00000,0x16424,
-0x24a2a,0x24276,0xe4129,0x2426e,0x24a29,0x00000,0x24272,0x24274,
-0xe4127,0xe412c,0x24271,0xe466f,0x16423,0x00000,0x24270,0x16427,
-0xe466e,0x00000,0xe4128,0x24a39,0xe466c,0xe412e,0x16422,0x16867,
-0x24277,0x24a2b,0xe466d,0xe412a,0x1637e,0x2426f,0x24273,0x16866,
-0x16375,0x2426c,0x2426d,0x16868,0x1637d,0x16421,0x1637c,0x24275,
-0xe647a,0x00000,0x24a2f,0x24a30,0x24a35,0x16c67,0x24a3c,0xe4b73,
-0x1686e,0xe4b7e,0x1686d,0x24a37,0xe4b74,0x16c66,0x24a2c,0x1686c,
-0xe4671,0x24a3b,0x1686a,0x1686b,0xe4b7c,0x24a38,0x25051,0x16c64,
-0x15f35,0xe4672,0x24a3a,0x16c6b,0x24a32,0x00000,0x16c65,0xe466a,
-0x16c6a,0x24a2d,0x24a31,0x24a2e,0x24a34,0x1686f,0x16c63,0x16869,
-0xe4c21,0x25043,0x24a36,0xe4668,0x16c69,0xe4673,0x16c6c,0x00000,
-0x24a33,0xe466b,0x16c68,0x25042,0x00000,0xe4c23,0xe4674,0xe4c24,
-0xe4b77,0x25047,0x17057,0x25041,0x2572e,0x25050,0x16c70,0xe4b7a,
-0x16c6e,0x17055,0x2504d,0x25049,0x16c74,0xe4b76,0x25725,0xe5068,
-0xe4c28,0xe5067,0x16c72,0x25048,0xe4c29,0x25723,0xe4c25,0x2504c,
-0x00000,0x2504f,0x25046,0xe4b79,0x16c73,0x00000,0xe4b75,0x16c6d,
-0x25724,0x17056,0x2504e,0x16c6f,0x16c71,0x2504b,0x16c75,0x2504a,
-0x25045,0x25044,0x17054,0x25052,0x25727,0x25c6b,0x17059,0xe5061,
-0x2572d,0xe5063,0x2572b,0xe506a,0x25c6c,0xe5064,0x1705a,0x2572c,
-0xe5066,0x25729,0x1735d,0x25c6a,0xe506c,0x25726,0x25728,0x1735e,
-0x1705c,0x1735c,0x1705b,0x17360,0x2572a,0x17058,0xe5062,0xe5065,
-0xe506b,0x00000,0x00000,0xe6679,0x00000,0x00000,0x2615b,0x00000,
-0x26153,0xe5461,0xe545f,0xe545c,0xe545e,0xe545d,0x25c72,0x26154,
-0x25c6e,0x00000,0xe545b,0x17642,0x25c70,0x25c6f,0x1735f,0x25c6d,
-0x25c71,0x2615c,0x26158,0x2615a,0x00000,0x26155,0x26156,0x00000,
-0x26159,0x26157,0x17834,0xe5765,0x00000,0x17837,0x17836,0x17835,
-0x1796c,0x26876,0x1796d,0x2654c,0x17a6a,0x26b5a,0x17a6b,0x17b60,
-0x17c36,0x26f28,0xe5f46,0x26f29,0x26f2a,0xe613e,0x00000,0x2722a,
-0x14541,0x2215d,0x14653,0x00000,0x14827,0x14828,0x14826,0xe236b,
-0x14829,0x14a3c,0x14a3b,0xe2625,0x22670,0x14d51,0x14d50,0x00000,
-0xe2c63,0x22f31,0x15a51,0x15a52,0x00000,0x00000,0xe3b64,0x15f3c,
-0x24278,0x16428,0x16429,0x2427a,0x2427c,0x2427b,0x00000,0x24a3e,
-0xe4676,0x24a3d,0x16870,0x24a3f,0xe4675,0x25053,0x16c76,0xe4c2c,
-0x1705d,0xe506d,0x17361,0x17643,0x17362,0xe5f48,0x14542,0xe2165,
-0xe2166,0xe224e,0x22428,0xe2628,0xe2629,0x22671,0x14d53,0x14d52,
-0x14d54,0x15137,0x22a53,0x22a54,0x00000,0xe3129,0x22f32,0x15552,
-0x15a53,0x15f3d,0x23b74,0x14543,0x00000,0x1445f,0x14544,0xe2250,
-0x2215e,0x14657,0x14656,0x14654,0x14655,0x00000,0x00000,0xe236f,
-0x1482c,0x22249,0x2224b,0x1482b,0x22243,0xe236c,0x22244,0xe236d,
-0x2224a,0x22246,0x22248,0x1482a,0x22245,0x2224c,0x22247,0xe236e,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x14a43,0x14a4c,0x14a4a,
-0x22432,0x2242f,0x22437,0x14a48,0x22438,0xe2639,0x14a41,0x22435,
-0xe262e,0x14a47,0x22431,0x22430,0x14a45,0x22436,0x14a46,0x14d55,
-0x14a40,0x22433,0xe262a,0x22429,0x14a3d,0xe2637,0x14a50,0x2242e,
-0x22434,0x14a42,0x14a44,0xe262f,0x2242a,0xe2636,0x2242b,0x2242c,
-0x00000,0x14a4f,0x14a49,0x14a4e,0x2242d,0x14a4d,0x14a3f,0x14a3e,
-0x14a4b,0xe2635,0x00000,0xe2633,0xe2634,0xe2638,0xe2631,0x00000,
-0x00000,0x00000,0x00000,0xe647b,0x00000,0xe2632,0xe2931,0xe292a,
-0x14d63,0x2267d,0x22676,0x14d5e,0x14d71,0x22672,0x22679,0x2267b,
-0x2267e,0x14d6c,0xe2926,0x2267a,0x22673,0x14d6a,0x22677,0xe2928,
-0x22721,0x14d5b,0xe2925,0x2267c,0x14d65,0x14d64,0x22675,0x14d59,
-0xe2934,0xe2932,0x14d5a,0x00000,0x14d58,0xe2933,0x14d70,0x14d68,
-0x14d62,0x14d56,0x22678,0x14d61,0x14d57,0x14d69,0x14d72,0x22a55,
-0x14d66,0x22674,0x14d5c,0x14d5f,0x14d60,0xe292e,0x14d6e,0x14d6f,
-0x14d6d,0x14d67,0x14d6b,0x14d5d,0x15138,0xe2930,0xe2937,0xe2935,
-0xe2936,0xe292f,0x00000,0x00000,0xe2929,0x00000,0x00000,0x00000,
-0x00000,0x00000,0xe2c6d,0x22a5b,0x15144,0x1513c,0x1513e,0x15143,
-0x22a67,0x15141,0x22f33,0x15553,0x15146,0x22a58,0x22a60,0x15142,
-0x22a5f,0x22a5c,0x22a64,0x22a66,0x1513b,0x1513f,0x15145,0x15555,
-0x22a61,0x1513d,0x15148,0x22a5a,0xe2c6f,0xe2c70,0x00000,0x15140,
-0x15554,0x1513a,0x00000,0x22a57,0x22a5e,0x22a56,0x22a59,0x22a5d,
-0x22f34,0x15147,0x00000,0x22a62,0x22a63,0x22a65,0x15139,0xe2c6c,
-0x00000,0xe3132,0x00000,0xe3133,0x00000,0x00000,0x00000,0xe2c6b,
-0x00000,0xe2c6e,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x15563,0x22f40,0x15561,0x15562,0x22f36,0x22f46,0xe312c,0x15558,
-0xe312f,0xe3135,0x2354a,0x22f48,0x22f42,0xe3138,0x22f39,0xe3137,
-0x22f4b,0x22f3c,0x1555e,0x23561,0x22f3f,0x15560,0x15557,0xe313c,
-0x22f4d,0x22f41,0x1555a,0x22f3a,0x22f37,0x22f38,0x1555b,0x22f47,
-0x22f4e,0x1555d,0x22f3e,0x22f3d,0x15565,0x15564,0x15556,0x1555c,
-0x1555f,0x22f4a,0xe312e,0xe3139,0x22f44,0x15559,0x22f35,0x22f4c,
-0x22f43,0x22f45,0x22f49,0xe3130,0xe313b,0xe3136,0x00000,0x00000,
-0xe647c,0x00000,0x00000,0x00000,0xe647d,0x2354b,0xe3631,0x15a5b,
-0x15a6f,0x15a6e,0xe3627,0x15a63,0xe3629,0x2355d,0x23559,0x23556,
-0x23568,0x15a5e,0x15a56,0xe3626,0xe3632,0x2355b,0x15f4d,0x15a5a,
-0x23563,0xe3622,0x15a70,0x15a6d,0x2355f,0x2354e,0xe357c,0xe362b,
-0x15a6c,0x23565,0x2354d,0x15a61,0x15a65,0x23564,0xe3623,0x23557,
-0x15a66,0x15a60,0x2354c,0xe357d,0x15f3f,0x23567,0x23555,0x15a6b,
-0x23558,0x23566,0x15a6a,0xe3624,0x23b75,0x00000,0x15a57,0x23553,
-0x15a5c,0x15a67,0x00000,0x15a62,0x2355c,0x23552,0x23550,0x23562,
-0x15a54,0x15a68,0x15a58,0x15f3e,0x23560,0x15a59,0x00000,0x15a55,
-0x15a64,0x15a5f,0x15a5d,0x23554,0x15a69,0x23551,0x2355e,0x2355a,
-0x23b77,0x23b76,0xe362d,0x00000,0x00000,0x00000,0xe647e,0x00000,
-0x00000,0x00000,0xe362e,0x00000,0x00000,0x2354f,0x23c29,0xe3b71,
-0x15f41,0xe3b70,0x23c2f,0x23b7c,0x23c2c,0x2427d,0x15f44,0x23c30,
-0x23c33,0x15f43,0x23c21,0x23c32,0x23c31,0x15f45,0x23b78,0x15f40,
-0x15f48,0xe3b73,0x15f46,0x23c2e,0x00000,0x23c24,0x15f4a,0x23c35,
-0x23c2d,0x23c36,0x15f52,0x15f50,0x23c2b,0x23c2a,0xe3b67,0x23c28,
-0x23c22,0x15f49,0xe3b66,0x15f47,0x22f3b,0x23b79,0xe3b68,0x2433d,
-0x23b7a,0x15f42,0x15f4f,0x24321,0x00000,0x15f4b,0x15f4c,0x23b7b,
-0x23c34,0x2427e,0x23c25,0x23b7e,0x15f4e,0x23c26,0x23c23,0xe3b72,
-0xe3b6d,0x15f53,0xe6339,0x00000,0x00000,0x00000,0xe3b6f,0x00000,
-/* 0x6400 */
-0x00000,0x00000,0x00000,0xe6521,0x00000,0x00000,0x16438,0xe4149,
-0xe4132,0x24324,0x24337,0x2433c,0x24330,0x16434,0x24341,0x16431,
-0x24322,0xe413a,0x24323,0x1642a,0x16433,0x2432a,0x16436,0x16437,
-0x2432b,0xe4138,0x24338,0x2433e,0x16432,0xe413e,0x1642c,0x24329,
-0x24325,0x24340,0x2432e,0x2432f,0x24326,0x2433a,0x24331,0x2433b,
-0x24333,0xe413d,0x1642d,0x24a40,0x16430,0x1642e,0x2433f,0x24336,
-0x24332,0xe4136,0xe4133,0x24327,0x1687a,0x24335,0x16435,0x2432d,
-0xe4134,0x2432c,0xe4148,0xe4725,0xe4142,0x1642f,0x1642b,0x24a55,
-0x24339,0x24334,0x00000,0x24328,0x00000,0x00000,0xe4144,0xe4145,
-0x00000,0xe6676,0x00000,0x24a50,0xe4678,0x24a41,0x24a4c,0xe4728,
-0x24a53,0x16878,0x15f51,0x24a51,0x16873,0xe467e,0xe4724,0xe467a,
-0x16872,0x24a58,0x00000,0x24a42,0x24a4f,0x24a43,0x24a4e,0x16876,
-0x24a52,0x23c27,0xe4721,0x00000,0xe472a,0x24a59,0x24a4a,0x16879,
-0x25061,0x16c77,0xe4723,0x24a57,0x24a56,0x1687b,0x25054,0x16c78,
-0x25055,0xe4722,0x24a46,0x24a47,0x24a44,0x24a49,0x24a45,0x24a5a,
-0x16875,0x16c79,0x16877,0x1687c,0xe467b,0x24a48,0xe4729,0x24a54,
-0xe4c2d,0xe4726,0x24a4d,0xe4c35,0x00000,0x25058,0xe4c38,0x16871,
-0x16c7c,0x25735,0x2505d,0x2505c,0x2505e,0xe4c30,0xe4c2f,0x2505b,
-0x16c7d,0xe4c3b,0x16d25,0x16d22,0xe4c31,0x16d23,0x25056,0x25059,
-0x25063,0x16d2b,0x16d29,0xe4c2e,0x2505a,0x23b7d,0x16c7a,0x25060,
-0x25057,0xe4c3e,0x16d2c,0x2505f,0x16874,0x16d21,0x24a4b,0xe4c3f,
-0xe4c34,0x16d24,0xe4c3d,0x16d28,0x16d2a,0x16d27,0x16d26,0xe4c3a,
-0x16c7e,0x25062,0x16c7b,0x16d2d,0xe4c39,0x00000,0xe6522,0x00000,
-0x00000,0xe4c37,0x00000,0x17061,0x17062,0x25734,0x1706b,0x17068,
-0xe5070,0x1705f,0x17066,0x25736,0x17064,0x1705e,0xe4c32,0x17065,
-0xe5077,0x25733,0x17364,0x17060,0x00000,0x17067,0x17363,0x25732,
-0x25731,0xe5076,0x17069,0xe506f,0x1706a,0xe5079,0x25730,0x2572f,
-0x17365,0x25739,0x17063,0x25737,0xe5075,0x00000,0x00000,0xe5464,
-0x17366,0xe5467,0x1736b,0x25c75,0x25c77,0xe576b,0x17368,0xe576d,
-0x25c78,0x25c74,0xe576c,0x25c76,0x17369,0x1736c,0xe5469,0x25c73,
-0x17367,0x1736a,0x17645,0x25738,0x17644,0x00000,0xe576a,0x1764a,
-0x26160,0xe5770,0x17648,0x17649,0x26163,0x2615f,0x17646,0x2615d,
-0x17838,0x26161,0x00000,0x26162,0x2615e,0xe576e,0x17647,0x2654d,
-0xe5a3b,0x26550,0xe5a3c,0xe5a3a,0x26551,0x2654f,0x26552,0x17839,
-0x2654e,0xe5e31,0x00000,0x2687a,0x1796f,0x26879,0x26878,0x26877,
-0x1796e,0x17970,0xe6523,0x26b5b,0x17a6d,0x17a6c,0xe5f4a,0xe5f4b,
-0x26d4f,0x26d4e,0x26d51,0x17c37,0x17b61,0x26f2c,0x26d50,0xe5f49,
-0xe6032,0x26f2b,0x17c39,0x17c38,0x17c5f,0x27037,0x2707d,0x14545,
-0x00000,0xe2c72,0x23c37,0x2573a,0xe2167,0xe2168,0x1482d,0x2224d,
-0x14a53,0x14a51,0x00000,0x14a52,0x00000,0x22722,0x14d73,0x15149,
-0xe2c74,0x22a68,0xe2c76,0x22a69,0xe2c73,0x1514a,0x22f50,0x00000,
-0x15566,0x15567,0x22f4f,0xe313d,0x00000,0xe3637,0xe3636,0x15a77,
-0x00000,0x15a73,0x00000,0x23569,0x15a7a,0x15a79,0x15a72,0x15a75,
-0x15a78,0x15a74,0xe3634,0x00000,0x23c3b,0x15a71,0x15f54,0xe3b74,
-0xe3b75,0xe3b76,0x15f56,0x15f57,0x23c3a,0x23c3d,0x15f55,0x23c38,
-0x23c3c,0x00000,0x23c39,0xe414b,0x16439,0xe414e,0xe6346,0x24342,
-0xe414d,0xe4730,0x1687d,0x24a5b,0x1706c,0x16d2e,0x25064,0x16d2f,
-0x16d30,0x25066,0x25065,0x25067,0x2573c,0x00000,0x00000,0x2573b,
-0x25c7a,0x25c79,0x1736d,0x1736e,0x26553,0xe5c41,0x00000,0x14546,
-0xe2558,0xe2939,0x00000,0xe3140,0x23c3e,0xe3638,0xe3639,0x00000,
-0x15f59,0x15f58,0x24343,0x00000,0x26164,0x17a6e,0x26f2d,0x14547,
-0x00000,0x15568,0xe3142,0x15a7c,0x15a7b,0x23c3f,0x23c40,0x1643a,
-0x24a5c,0x1687e,0x2573d,0x00000,0x14548,0x14658,0xe293b,0x14d74,
-0x22723,0x00000,0x22a6a,0x1514b,0x15a7d,0xe363a,0x23c41,0x15f5a,
-0x1643b,0x00000,0x25068,0x25069,0x00000,0xe546b,0x25c7b,0x1764b,
-0x2707e,0x14549,0xe293c,0x22724,0x14d75,0x1514c,0xe2c77,0x22a6b,
-0x00000,0x15569,0x22f54,0x22f52,0x22f53,0x1556a,0x22f51,0xe363c,
-0x00000,0xe363f,0xe363d,0x15b21,0x15b22,0x2356a,0x15b23,0x15a7e,
-0x23c42,0xe3b79,0x23c43,0x24344,0x00000,0x00000,0x16922,0x16921,
-0x00000,0x00000,0x25c7c,0x26165,0xe5a3f,0x26555,0x26554,0x2687b,
-0xe2169,0x2213e,0x1514d,0xe3641,0xe4150,0x1454a,0x14659,0xe2251,
-0x1482f,0x1482e,0xe2373,0xe2372,0x14830,0x14831,0x2224f,0x2224e,
-0x22439,0x14a54,0x2243c,0x2243b,0x2243a,0x2243d,0xe263d,0x00000,
-0x00000,0xe625e,0x14d76,0x2272a,0x22726,0x2272f,0xe2943,0xe293e,
-0x14d7d,0xe2942,0x14d7b,0x2272b,0x22727,0x2272e,0x14d7a,0x14e23,
-0x22729,0x22725,0x14e22,0x2272c,0x14d79,0x2272d,0x14d7c,0x14d7e,
-0x22731,0x22730,0x22728,0x14d78,0x14d77,0x14e21,0x00000,0xe2940,
-0xe2941,0x00000,0xe2c7e,0xe2c7a,0x22a70,0x22a76,0xe2d23,0x15153,
-0x15150,0x22a6d,0x22a72,0xe2c7c,0x15156,0x1514e,0x22a71,0x15151,
-0x15154,0xe2c79,0x00000,0x22a74,0xe2c7d,0x1514f,0x22a79,0x15152,
-0xe2d21,0x15155,0x22a6e,0x22a73,0x22a77,0x22a6f,0x22a6c,0xe2d24,
-0xe2d25,0x22a78,0x22a75,0xe2d22,0xe2c37,0x00000,0x00000,0x00000,
-0xe3146,0x15572,0x1556b,0x1556e,0xe314c,0x15571,0xe3144,0x22f57,
-0xe3149,0x1556c,0x22f55,0xe3148,0x15570,0xe314d,0xe3145,0x1556d,
-0xe3143,0x22f58,0x1556f,0x00000,0x00000,0x00000,0x00000,0xe3642,
-0x00000,0x2356e,0x15b25,0x2356d,0x2356f,0x15b24,0x15b29,0x22f56,
-0xe314b,0x2356c,0x23570,0xe3644,0x15b26,0x2356b,0x15b28,0xe3645,
-0x15b27,0xe3c26,0x23c4a,0xe3b7d,0x23c45,0xe3c25,0x15f5b,0x15f5f,
-0x15f5c,0x23c48,0x23c4b,0xe3c23,0x15f5d,0x00000,0x15f5e,0x15f63,
-0x2434d,0x23c49,0x15f61,0x23c46,0x23c44,0xe3b7c,0x15f62,0xe3b7e,
-0x23c47,0xe3c24,0x00000,0x00000,0x16441,0x00000,0x24345,0x1643e,
-0x1643f,0x1643d,0x2434a,0x24349,0x24346,0x16443,0xe415b,0xe4156,
-0x24348,0x15f60,0xe4159,0xe4151,0x2434c,0x24347,0x16440,0x1643c,
-0x16442,0x2434b,0xe4734,0x00000,0xe4735,0x16925,0x00000,0x24a5f,
-0x24a5e,0x24a5d,0x16923,0x00000,0xe4739,0xe4733,0xe4737,0x00000,
-0x16924,0x2506c,0x2506f,0x16d32,0xe4c44,0xe4c46,0x16d31,0x25070,
-0x2506b,0x16d34,0x2506d,0xe4c41,0x16d33,0x2506a,0xe4c40,0x2506e,
-0x17072,0x1706f,0x25746,0x25745,0xe4c43,0x25744,0x2573f,0xe507d,
-0x25740,0xe5123,0x00000,0xe507a,0x17070,0xe507e,0x1706d,0x17071,
-0x2573e,0x1706e,0x25741,0x25742,0x25747,0xe5122,0xe5471,0x25743,
-0xe546f,0xe5470,0x25c7d,0x00000,0xe546c,0xe546d,0x17370,0xe5472,
-0x26168,0x1736f,0x26166,0x26167,0x1764c,0x1783b,0x26556,0xe5a43,
-0x1783a,0xe5a42,0xe6526,0x2687d,0x2687e,0xe5c42,0x17971,0xe5c43,
-0x2687c,0x17a6f,0x00000,0x26f2e,0x17c3a,0x27038,0x27039,0xe613f,
-0x1454b,0x00000,0x14832,0x14833,0x14a55,0xe2641,0x22732,0x15157,
-0x15573,0x15b2a,0x00000,0x00000,0x15937,0x00000,0x15f64,0x15f65,
-0x15e32,0x23c4c,0xe6527,0x16444,0x24a61,0x24a60,0xe5124,0x00000,
-0x1454c,0x14834,0x22733,0x14e25,0xe2945,0x14e24,0xe2d27,0x22a7a,
-0x22a7b,0xe6632,0x22f59,0x22f5a,0x15574,0x15575,0xe3648,0x15576,
-0x23571,0xe3647,0xe3646,0x15b2c,0x00000,0x15f67,0xe3c29,0x15f66,
-0x2434e,0x24641,0x24a62,0x25748,0xe5126,0xe6633,0x1764d,0x17972,
-0x1454d,0x00000,0x1465c,0x1465d,0x1465b,0x1465e,0x1465a,0xe2252,
-0x00000,0x14837,0xe2377,0x22257,0x14836,0x14838,0xe2378,0xe2375,
-0x22252,0x22251,0x22254,0x22253,0x22256,0x14835,0x22250,0x22255,
-0x00000,0x00000,0x00000,0x00000,0xe2648,0x2243e,0x14a5f,0x2243f,
-0x22443,0x14a5e,0xe2649,0x22447,0x22442,0x22445,0x14a57,0x14a58,
-0x14a59,0x14a5a,0xe2645,0x14a61,0xe2644,0x22441,0x14a5c,0x14a62,
-0xe2647,0x22440,0x22446,0xe2642,0x14a5b,0x22444,0x14a5d,0x14a56,
-0x14a60,0xe264a,0x00000,0x00000,0x00000,0xe6257,0x00000,0x00000,
-0x00000,0x00000,0x14e3a,0xe2947,0x22735,0x14e26,0x00000,0x14e30,
-0x14e31,0x14e29,0x14e3b,0x14e2b,0x2273d,0x14e36,0x22738,0x14e2c,
-0x22747,0x22748,0x22740,0x22739,0x14e39,0x22745,0x14e34,0x14e32,
-0xe2952,0x22746,0xe2949,0x22744,0x2273c,0x22734,0x2273b,0x14e2d,
-0xe625f,0x14e33,0xe294a,0x14e27,0x2273f,0x2273e,0x22736,0xe294f,
-0x14e35,0x22742,0x22737,0x14e38,0x22749,0x14e28,0xe2948,0x14e2f,
-0x2273a,0x22743,0x14e37,0x00000,0x14e2a,0x14e2e,0x00000,0x22741,
-0x00000,0x00000,0xe294e,0xe294c,0xe6528,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0xe6529,0x00000,0x22b3d,0x1515f,
-0x1516c,0xe2d36,0x22b38,0x22b2e,0x15165,0x22b2c,0x1515e,0x22b27,
-0x15168,0x22b34,0x22b21,0x22b23,0xe2d2e,0x00000,0x00000,0xe2d30,
-0x22b26,0x22a7c,0x22b33,0x22b43,0x15163,0x22b28,0x22b3a,0xe2d2d,
-0x22a7e,0x22b41,0x22b42,0x22b45,0x22b3c,0x22b2d,0x22b35,0x15169,
-0x1515c,0x15164,0x15170,0x15159,0x1515b,0xe2d31,0xe2d2b,0xe2d3a,
-0x22b25,0x1516d,0x15166,0x22b3f,0x22b22,0x1516f,0x1516a,0x22b2b,
-0x00000,0x00000,0x1516e,0x22b32,0x22b2a,0x15167,0x22b3e,0x22b36,
-0xe2d2a,0x15161,0x22b44,0x22b29,0x1515d,0x22b3b,0x22b31,0x15162,
-0x22b37,0x1515a,0x22a7d,0x1516b,0x15627,0x15160,0x22b30,0x22b2f,
-0x22b24,0xe2951,0x22b40,0xe2d34,0x22b39,0x00000,0xe2d32,0x15158,
-0xe2d39,0xe2d37,0x00000,0x00000,0x00000,0xe2d38,0xe652b,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0xe652a,0x00000,0x22f6e,0x1562e,0x22f6f,0xe315d,0x22f63,0x15623,
-0x1562f,0xe3157,0x22f5c,0xe3153,0x22f65,0x22f6d,0xe315b,0x22f5b,
-0x22f76,0x15577,0xe315e,0xe3164,0xe3150,0x22f75,0x22f70,0xe315f,
-0x22f71,0x15621,0x1562c,0x22f67,0xe3156,0x22f68,0x22f72,0x22f69,
-0xe3163,0x22f64,0x22f5e,0x22f5f,0x22f6c,0x22f66,0xe3154,0xe314f,
-0x15578,0x1557c,0x22f74,0x22f60,0x1562a,0x15626,0xe315a,0x00000,
-0x15629,0x15630,0x1557d,0x1562b,0x22f6b,0x1562d,0x1557a,0xe3159,
-0x15579,0x22f5d,0x00000,0x22f61,0x15624,0x22f73,0x22f6a,0x22f62,
-0x15628,0x15625,0xe2d2f,0x1557b,0x1557e,0xe3162,0xe3158,0x00000,
-0xe3161,0xe3160,0xe652d,0x00000,0x00000,0x00000,0xe652c,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x23628,0xe3655,0x23576,0x23577,0x2357b,
-0xe3660,0x2362c,0x23629,0xe364e,0x23622,0x23621,0x15b33,0x23625,
-0x23634,0x23572,0xe365b,0x23635,0x23627,0x23639,0x2362d,0x15b32,
-0x2362b,0x15b2d,0x15b42,0x15b38,0xe3657,0x15b3c,0x15b3b,0x23573,
-0x00000,0x23632,0x23638,0x23630,0x23637,0x00000,0xe3651,0x23624,
-0x23574,0x23636,0x23626,0x15b30,0x15b3d,0xe365a,0x2362f,0x15b36,
-0xe364d,0xe365c,0xe3650,0x2362e,0x23575,0x15b3e,0xe364b,0x15b40,
-0x23631,0x15b41,0x15b2f,0x2357c,0x23633,0xe3654,0xe3478,0x15b35,
-0x15b3f,0x2357e,0x2362a,0x23579,0x2357d,0x15b3a,0x23578,0x15b2e,
-0x15b37,0x15b34,0x23623,0x15622,0x23c63,0x15b31,0xe364c,0xe3652,
-0xe365e,0xe365f,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0xe3656,0x00000,0xe3c45,0x15b39,0xe3c41,0x23c66,0x23c7c,
-0x23c71,0x15f7b,0xe3c38,0x15f76,0x23c60,0x15f77,0x23c70,0xe3c3e,
-0x23c69,0x23c76,0x15f73,0x23c4e,0x23c78,0x15f69,0x23c56,0x15f6c,
-0x15f6b,0x00000,0x15f7c,0xe3653,0x23c50,0x23c72,0x23c73,0x15f6e,
-0x15f6a,0x23c5e,0xe3c3d,0x15f75,0x23c59,0xe3c32,0x23c74,0x15f71,
-0x23c6c,0x23c79,0x23c53,0x23c58,0x23c52,0xe3c2a,0x15f70,0x23c65,
-0x24364,0x23c54,0x15f74,0x23c5d,0x23c75,0x15f6f,0x23c5a,0x23c57,
-0x23c68,0x15f72,0x15f68,0x15f7e,0x23c6b,0x23c6a,0xe3c31,0xe3c42,
-0xe3c39,0xe3c3b,0xe3c34,0xe3c2f,0x23c4f,0x15f6d,0x23c77,0x23c5f,
-0x23c61,0xe3c37,0x23c6e,0x23c6d,0x23c4d,0x15f78,0x15f7a,0x23c55,
-0x23c5c,0x23c64,0x15f79,0x23c5b,0x23c67,0x23c7a,0x00000,0x23c6f,
-0xe3c3c,0x00000,0x00000,0x00000,0xe3c44,0x00000,0xe3c33,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x23c7b,0x00000,0x00000,
-0x00000,0xe652f,0x23c51,0x00000,0xe652e,0x00000,0xe3c40,0x24378,
-0x1644c,0xe4165,0x24376,0x24361,0x24366,0x2435f,0xe4177,0x24372,
-0x24351,0x24358,0x00000,0x24370,0x2437a,0x24362,0xe4168,0x24355,
-0x24368,0x2436d,0x24359,0xe416b,0x2436a,0x24356,0xe415d,0xe4175,
-0x2435d,0x2435e,0x1644e,0x24371,0x2436f,0xe4173,0x24352,0x24374,
-0xe4174,0x24375,0x24377,0x16452,0x1644a,0xe416f,0x2357a,0x2435a,
-0x2436c,0x2435b,0x16447,0x16457,0x24373,0x16455,0x16451,0x24350,
-0x16449,0xe4179,0x24353,0x16456,0xe4178,0x24363,0x2434f,0xe4176,
-0x1644f,0x24367,0x24357,0x16450,0x24360,0x16446,0x15f7d,0x24369,
-0x23c62,0x24354,0x00000,0xe416d,0x2436e,0x1644b,0x2436b,0x16448,
-0x24365,0x16453,0x2435c,0x24379,0xe416a,0xe417b,0x00000,0x00000,
-0x00000,0x00000,0x1644d,0x2452c,0x00000,0xe4172,0x16454,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x24a70,0x24a6e,0xe473a,
-0x24b26,0x24a6c,0xe473d,0x24a7e,0x16445,0x16928,0x24a68,0x24b25,
-0xe4751,0x24a6d,0x24a7b,0x1692d,0x16926,0xe474e,0x24b23,0xe4746,
-0x24a66,0x24b22,0xe4747,0x16938,0x24a77,0x24b29,0x16936,0x24a6f,
-0x16927,0x24a71,0x24b21,0x16930,0x24a6a,0x16934,0x1692a,0x24a73,
-0x24a69,0x24a63,0xe473e,0x24a7d,0x16931,0x24b28,0x24a64,0x1692e,
-0x00000,0x24a79,0xe6352,0x1692f,0x24a6b,0x24a76,0x24a72,0x24a74,
-0xe4743,0x16929,0x24b27,0x16937,0x24a75,0xe473b,0x24b2a,0x00000,
-0xe473c,0x24a65,0x24a7a,0x1692c,0x16935,0x16933,0x24a67,0x24a7c,
-0x16932,0xe4745,0xe4748,0x1692b,0x24a78,0xe474d,0xe4744,0x00000,
-0xe4c54,0x24b24,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0xe474c,0x2507c,0xe4742,0x25078,0x25074,0x2512a,0x25127,
-0x16d37,0xe4c64,0xe4c60,0x2512e,0x2507b,0x16d42,0x25124,0xe4c4f,
-0xe4c51,0x25077,0x25123,0x16d3f,0x25137,0x00000,0x25134,0x25126,
-0x25075,0xe4c5f,0xe4c57,0x2512b,0x2512d,0x16d3b,0x25121,0x2507a,
-0x25071,0x16d38,0x16d40,0x00000,0x25130,0x16d41,0x25072,0x25136,
-0x25129,0x2512f,0x16d3e,0xe4c4d,0xe4c50,0x2512c,0xe4c47,0x25133,
-0xe4c5b,0x16d43,0xe4c56,0x16d3d,0x25125,0x25076,0x25138,0x25073,
-0x25131,0x16d3a,0xe4c4a,0x2507d,0xe4c49,0x2507e,0x16d39,0x16d36,
-0x25079,0x16d3c,0xe4c52,0x16d35,0xe4c62,0x25132,0x25135,0x25122,
-0x25755,0xe4c5e,0xe4c59,0x00000,0xe4c61,0xe6530,0x00000,0x00000,
-0x00000,0x00000,0x2574d,0xe512c,0x25749,0x17121,0xe513c,0xe5138,
-0x17074,0x17079,0x17075,0x25757,0x25762,0x17073,0x2574f,0x25758,
-0x25128,0x25759,0xe5128,0xe512b,0x1707a,0xe5140,0x25768,0x1707e,
-0x17123,0x2574b,0xe513b,0x1707d,0xe5131,0x25766,0x25767,0x2575d,
-0x2575c,0x25754,0xe5129,0xe513e,0x2575e,0x25765,0x25764,0xe512f,
-0x17078,0x17076,0x25756,0x25753,0xe5144,0x25750,0x25763,0x17122,
-0x25761,0x1707c,0x1707b,0xe5127,0x2575b,0x00000,0x2574a,0x2574c,
-0x2574e,0x25760,0x2575a,0x17077,0xe512e,0x25751,0xe5132,0x2575f,
-0xe5141,0xe513a,0x00000,0x00000,0x00000,0x00000,0x25752,0xe6531,
-0x00000,0x00000,0xe6532,0x00000,0x00000,0xe5475,0x17378,0x25d31,
-0x17371,0x25d22,0xe547b,0x25d2d,0x17373,0x25d34,0xe5521,0x25d29,
-0xe547c,0x25d24,0xe5476,0x00000,0x25d35,0x25c7e,0x25d2b,0xe5527,
-0x1737a,0x25d30,0x25d36,0x25d2a,0x17372,0x25d2c,0x25d21,0x17379,
-0xe5523,0xe547a,0x25d33,0x25d26,0x17375,0xe5524,0x25d28,0x25d25,
-0x1737b,0x25d27,0x17374,0x17377,0x25d2f,0x25d23,0x25d32,0xe5478,
-0x25d2e,0x00000,0xe5529,0xe5774,0x1764f,0x26173,0x17654,0x17655,
-0xe5777,0xe5821,0xe5776,0x1764e,0x26172,0xe5778,0x2616f,0x26170,
-0x17652,0x2616a,0x2616e,0x17651,0xe577e,0x2616b,0xe5779,0xe5823,
-0xe577d,0xe577a,0x17653,0x17650,0xe5822,0x26169,0x2616d,0x26171,
-0xe577b,0x00000,0xe6533,0x2655c,0x26559,0x26562,0xe5a44,0x26561,
-0x2655f,0x2655a,0xe5a4f,0x1783f,0xe5a45,0xe5a4e,0x00000,0xe5a47,
-0xe5a4d,0x2655b,0x1783e,0x17376,0x2655e,0x1783d,0x26563,0x2655d,
-0x26558,0x2616c,0xe5a48,0xe5a46,0x00000,0x1783c,0xe6534,0x26557,
-0x26924,0xe5c49,0x26923,0x26560,0x17973,0xe5775,0x26927,0x26928,
-0x26922,0x26926,0x00000,0x26921,0xe5c47,0xe6535,0x00000,0x00000,
-0x26b5f,0x26925,0x17a72,0x17a70,0x26b5d,0xe5e35,0xe5e34,0xe5e33,
-0x26b60,0xe5e37,0x26b5c,0x26b5e,0x17a71,0x00000,0xe5f4f,0xe5f4e,
-0x26d53,0x26d54,0x17b62,0x26d52,0x00000,0xe6536,0xe6537,0x26f31,
-0x17c3b,0x26f2f,0x26f30,0x2703a,0xe6074,0x00000,0x17d23,0x27123,
-0x27121,0x27122,0x27124,0xe6140,0xe6165,0xe6141,0x2722b,0x00000,
-0x1454e,0x14839,0xe2379,0x14e3c,0x00000,0x2274a,0xe2953,0xe2954,
-0x22b46,0xe6269,0xe2d3c,0xe3166,0x22f77,0x22f79,0xe3165,0x22f78,
-0xe3167,0x22f7a,0x15b43,0x2363b,0x22f7b,0xe3662,0x2363a,0x2363c,
-0x2363d,0x23c7d,0x16022,0x23c7e,0x23d22,0x16023,0x16021,0x23d21,
-0xe417d,0x24422,0x2437e,0x2437d,0xe417c,0x2437c,0x2437b,0x16458,
-0x24421,0x16939,0x24b2b,0x24b2d,0x1693a,0x24b2c,0x16d45,0xe4c66,
-0x16d44,0x25139,0xe4c65,0xe4c67,0x2576a,0x25769,0x2576b,0xe5146,
-0xe5145,0x17124,0x00000,0x25d37,0x1737c,0xe552b,0x26174,0x17656,
-0x26564,0x17b63,0x1454f,0x1465f,0x1483a,0x14a63,0x14e3d,0x14e3e,
-0xe2955,0xe2956,0x15171,0xe2d3d,0xe3168,0x22f7c,0xe3c49,0xe3c47,
-0x00000,0xe417e,0x16459,0xe4221,0xe4753,0x00000,0x25259,0x17125,
-0x17657,0x14550,0xe2253,0x1483b,0x00000,0x00000,0x2274c,0x14e3f,
-0x2274b,0xe2958,0x22b47,0x15172,0x22b48,0x00000,0x15173,0x00000,
-0x22f7e,0x15632,0x15631,0xe316a,0x23642,0x23640,0x23641,0x2363f,
-0xe3664,0x2363e,0x00000,0x00000,0x23d23,0x23d26,0x16025,0x23d24,
-0x16024,0x23d25,0x00000,0x24423,0xe4222,0xe6354,0x24b2e,0x24b2f,
-0x24b30,0xe4754,0x2513c,0x2513b,0x16d46,0x2513a,0x2513d,0x2576c,
-0x00000,0x00000,0x2576d,0x2576e,0x00000,0x25d38,0x1737d,0x17658,
-0x26565,0x00000,0x17a73,0x2213f,0xe2959,0x15174,0x22b49,0x15633,
-0x00000,0x00000,0x15b44,0xe3665,0x16026,0x23d27,0xe3c4b,0x1645b,
-0x1645a,0xe4226,0x00000,0x24b31,0x24b32,0x16d47,0x16d48,0x25770,
-0x2576f,0x26175,0x26f32,0x14551,0x22140,0x14660,0xe237a,0x14a64,
-0x22448,0xe295a,0x15175,0x1645c,0x14552,0x00000,0x22b4a,0x15176,
-0x22b4b,0x00000,0x1737e,0x14553,0xe6538,0xe6539,0x2274d,0x00000,
-0x22b4c,0xe2d42,0x23025,0x23024,0x23022,0xe316e,0x23021,0x23026,
-0x23023,0xe316c,0xe316d,0x15b45,0x15b46,0xe3666,0x00000,0x16027,
-0x23d28,0x00000,0x23d29,0x23d2a,0xe3c4d,0x00000,0xe653a,0x24427,
-0x24428,0x24426,0xe4228,0x24424,0x24425,0x1645d,0x24b33,0x25140,
-0x2513f,0x2513e,0x25141,0x25772,0x25771,0x17126,0x25773,0x00000,
-0x17421,0x25d39,0xe552d,0x26176,0x26566,0x26d55,0x00000,0x14554,
-0x14662,0x14661,0x00000,0x14e40,0x22141,0x2215f,0x1483c,0x00000,
-0x22258,0x22449,0x2244a,0x14e41,0xe295d,0x2274e,0xe653b,0x15177,
-0x22b4d,0x22b4e,0x00000,0x15634,0x15638,0x23027,0x15637,0x15635,
-0x15636,0x00000,0x23643,0x15b47,0x1602a,0xe3c4e,0x16028,0x16029,
-0x23d2b,0xe4229,0xe422a,0x1693b,0x14555,0x00000,0x22160,0xe2257,
-0x14663,0xe2254,0x00000,0x22163,0xe2421,0x00000,0x14666,0x22162,
-0x14665,0x14664,0x14a65,0x22161,0xe2258,0xe2259,0x22259,0x00000,
-0x00000,0x00000,0x2225d,0x2225f,0x22260,0x14846,0x14847,0x2225c,
-0x14842,0xe237d,0x2225a,0xe2425,0x2225e,0x14843,0xe2655,0x1483e,
-0xe237c,0x1483f,0xe2423,0x14845,0x2225b,0x1483d,0x14a66,0x14840,
-0x14841,0x14844,0x00000,0xe653c,0x00000,0x2245b,0x22459,0x2244c,
-0x14a72,0x22453,0x14a6d,0x2244d,0xe2964,0x22455,0xe2650,0x22452,
-0x14a70,0x22451,0x14a77,0x2245a,0x14a79,0xe2653,0x14a7b,0xe237e,
-0x2244b,0xe2657,0x14a6e,0x2245c,0xe2651,0x14a75,0x14a78,0xe264c,
-0x22765,0x14a68,0x14b21,0x14a76,0x2244e,0x14a6b,0x14a7a,0x22456,
-0x14a69,0x14a6a,0x22763,0x2244f,0x14a71,0x14a7c,0x2245d,0x22450,
-0x14a6f,0xe264d,0x14a74,0x2274f,0x14a7d,0x22457,0x14a73,0xe2963,
-0x14a7e,0x14a67,0x22454,0x14a6c,0x22458,0x22764,0xe264e,0xe2652,
-0xe265c,0xe2659,0xe2656,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0xe265b,0x14e4d,0x14e5d,0x22756,0x14e54,0xe2d4e,
-0x2276b,0x14e45,0xe296b,0x14e48,0x22762,0x00000,0x22754,0x22758,
-0x14e50,0x14e52,0x2275b,0x14e59,0x14e4b,0x14e49,0x14e4a,0x14e58,
-0x22767,0x14e53,0x2275a,0x2275c,0x14e51,0x14e56,0x2275d,0x2276a,
-0xe296d,0x15178,0x14e5c,0xe6261,0x14e46,0x22769,0xe296c,0x2276d,
-0x22759,0x2276f,0x22760,0x14e4f,0x22755,0x14e4e,0x14e60,0x14e55,
-0xe296a,0x22753,0x22b57,0x14e5b,0x14e5f,0x22761,0x22766,0xe2965,
-0x14e61,0x14e5a,0x14e4c,0x14e42,0xe2969,0x14e47,0xe6260,0x22757,
-0x14e43,0x2276e,0xe2967,0x22751,0x22750,0x2275e,0x22752,0x14e5e,
-0x15639,0x14e57,0x2275f,0x14e44,0xe2d4f,0x15229,0x00000,0x00000,
-0x00000,0x2276c,0x00000,0x00000,0x00000,0x00000,0x00000,0xe2d46,
-0x22b5e,0x22b61,0xe2d50,0x22b64,0x22b59,0xe2d48,0xe2d4a,0x22b67,
-0x22b6a,0x22b6c,0x22b56,0x15179,0x1517e,0x2302c,0x15230,0x22b65,
-0x22b6d,0x22b5d,0x22b55,0xe2d49,0xe2d47,0xe2d4d,0x23047,0x15223,
-0x22b62,0x22b5a,0x22b5c,0x15228,0xe317a,0x22b5f,0x15222,0x22b52,
-0x22b68,0xe2d4b,0x22b6b,0xe2d45,0xe2d57,0x1517d,0xe2d53,0x1522b,
-0x22b4f,0x1522d,0x1517b,0x15231,0x22b69,0x22b51,0x1522e,0x23041,
-0x22768,0x15221,0x1517a,0x22b58,0x22b50,0x1522f,0x15227,0x22b63,
-0x1522c,0x1522a,0x22b5b,0x15224,0x22b53,0x15225,0x15226,0x22b54,
-0x22b66,0x1517c,0x22b60,0x00000,0xe2d55,0xe2d51,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0xe3177,0xe3173,
-0x2302f,0x15641,0x15646,0xe3179,0xe3226,0xe3176,0x23038,0x2303e,
-0x2303a,0x2302d,0x23030,0x23029,0x2302a,0x1564d,0x1563e,0x23039,
-0x23042,0x15648,0x1563a,0xe316f,0x15643,0x23031,0x15645,0x23032,
-0x2303c,0xe3222,0xe3225,0xe3172,0x15647,0x2304b,0x2302b,0x15640,
-0x1563f,0x1564b,0x23028,0x23049,0x2303d,0x2304a,0x23044,0x23036,
-0x23045,0xe3221,0x2303f,0x23048,0x23046,0x1564c,0x23037,0x1563d,
-0x1563c,0x15644,0x1564a,0x23043,0x15649,0x23034,0x15b48,0xe3178,
-0x2304c,0x23033,0x2302e,0x15642,0x1564e,0x1563b,0xe3227,0x2303b,
-0x23040,0xe317d,0xe317b,0xe317c,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0xe653d,0x00000,0x00000,
-0x00000,0x00000,0x15b6a,0x23645,0x23649,0xe366f,0x15b57,0x15b55,
-0xe367a,0xe3721,0x15b4c,0x23647,0x23646,0x15b60,0xe3c50,0x2364c,
-0x15b5a,0xe3672,0x2365e,0x2366a,0x15b49,0x2365b,0x23654,0x15b6c,
-0x23644,0xe366a,0x23660,0xe366b,0x15b69,0x15b5d,0x15b68,0x15b53,
-0x23650,0x23662,0x2365a,0x15b54,0x15b4e,0x23668,0xe366c,0x23661,
-0x23663,0x15b56,0x15b5e,0x23665,0x2364e,0x2365f,0x23653,0x23667,
-0x15b63,0x15b4b,0x15b61,0x23658,0x23656,0x23657,0x15b58,0x23652,
-0x23651,0x15b4d,0x2364b,0x23669,0x15b4f,0x23655,0x15b6d,0xe3674,
-0x15b67,0x2364a,0x15b64,0x15b62,0x15b6b,0x2365c,0x15b66,0x23035,
-0x2365d,0x15b65,0x23664,0x15b4a,0x23659,0x15b5c,0x2364d,0x15b5b,
-0xe367c,0x15b59,0x15b51,0x15b50,0x23d2c,0x23666,0xe3c5d,0xe3728,
-0x2364f,0xe3726,0xe3723,0x23d41,0xe3670,0x15b52,0xe3677,0xe3724,
-0xe3676,0xe3725,0xe3679,0x00000,0xe367d,0x00000,0x00000,0xe653e,
-0x00000,0x00000,0xe3729,0x00000,0x00000,0x00000,0x00000,0xe3727,
-0xe3c54,0x16047,0x15b5f,0x16035,0x23d3b,0x16043,0xe3c52,0x23d2f,
-0x16032,0x1602e,0x23d4d,0x16034,0x16038,0x16033,0x1603c,0x23d51,
-0x23d48,0xe3c6b,0xe3c6d,0x23d36,0x16041,0x1603b,0x23d42,0x1602b,
-0x23d4e,0x23d47,0x1602f,0x23d3c,0x1603e,0x23d59,0x23d5a,0x00000,
-0x1602c,0x23d4c,0x16040,0x23d40,0x23d32,0x23d33,0x16044,0x23d37,
-0x23d3e,0x23d38,0xe3c5a,0x16042,0x1604a,0x23d34,0x23d2d,0x23d2e,
-0xe3c56,0x23d30,0x16031,0x23d3d,0xe3c6e,0x1603f,0x16048,0xe3c58,
-0xe3c69,0x23d3f,0x23d57,0x23d4f,0x1602d,0x23d55,0x16039,0xe3c66,
-0x16037,0xe3c64,0x23d5b,0x16036,0x23d45,0x23d39,0x23d43,0x1604d,
-0x23d49,0x23d46,0x23d35,0x16049,0x23d53,0x23d50,0x23d58,0x16030,
-0x23d44,0x1604c,0xe3c5b,0x23d4b,0xe423a,0xe3c60,0x1603a,0x1603d,
-0xe3c5c,0x23d4a,0x1604b,0x23d3a,0x23648,0xe3c51,0xe3c6c,0x23d54,
-0x23d52,0x23d56,0x00000,0xe3c62,0xe6542,0x00000,0xe3c63,0x00000,
-0xe3c68,0x00000,0x00000,0x00000,0xe6540,0x00000,0xe633d,0x00000,
-0x23d31,0x16046,0xe653f,0xe6541,0x00000,0x24447,0x24446,0x2442c,
-0x16463,0xe4230,0x24445,0x2442f,0x24430,0x00000,0x1646d,0x2444e,
-0x16468,0x24444,0xe4233,0x24429,0x1646e,0x16464,0x24438,0x2442e,
-0x24431,0x24449,0x1645e,0x24450,0x24448,0x16467,0x2443d,0x16472,
-0xe422e,0xe4236,0x16471,0x1646b,0xe4240,0x00000,0x2444f,0x1645f,
-0x2443b,0x24432,0x2443f,0x2444b,0x16473,0xe4239,0x16461,0x2443a,
-0xe422d,0x24433,0x1646a,0xe4231,0x16469,0x24436,0x24440,0x2444a,
-0x2442d,0x24437,0x16462,0x24441,0x1646f,0x16466,0x24434,0x16465,
-0x2442b,0x24439,0x2444d,0x16045,0x16957,0x2443c,0x24b34,0x2443e,
-0x2444c,0x1646c,0x24435,0x16460,0x16470,0x16d5a,0x2442a,0x00000,
-0x24443,0xe4244,0xe423e,0xe4247,0x24442,0xe423d,0x00000,0x00000,
-0x00000,0x00000,0x00000,0xe4245,0x00000,0x00000,0xe423f,0x00000,
-0xe423b,0xe4246,0x00000,0x24b50,0x16954,0x24b45,0x24b4a,0x16949,
-0xe4756,0x24b36,0x16956,0xe4757,0x16940,0x24b35,0x24b56,0x16958,
-0x24b39,0x24b49,0xe4765,0x24b3b,0x24b59,0x24b55,0x1693e,0x16948,
-0x2515b,0x16955,0x16946,0x24b37,0xe4763,0x24b54,0x1694a,0x24b51,
-0x24b5e,0x24b3d,0x24b46,0xe4c78,0xe475b,0x24b5c,0x24b52,0x16945,
-0xe4c6a,0xe4764,0x24b44,0x1693f,0x1693d,0x1694f,0x00000,0xe475f,
-0x24b42,0x24b3f,0x24b40,0xe475a,0x24b58,0xe475c,0x24b5d,0x24b5b,
-0x16943,0x24b5f,0x16947,0x1694e,0x00000,0x24b38,0x25143,0x24b41,
-0xe475e,0x16941,0x16953,0x16950,0x16944,0x24b4b,0x24b3c,0x16951,
-0x24b4d,0x1694b,0x1694d,0x1693c,0xe475d,0x24b4f,0x24b47,0x24b3a,
-0x1694c,0x24b57,0x24b5a,0x24b43,0x24b4e,0xe4c74,0x16942,0x16d49,
-0x24b4c,0x25142,0xe4762,0x24b53,0xe4761,0x00000,0x00000,0x00000,
-0xe6544,0xe6545,0xe4766,0x00000,0xe6543,0x00000,0x24b3e,0x2514c,
-0x25156,0x16d4c,0x25155,0x25161,0x16d4e,0x25153,0x00000,0x25157,
-0x16d59,0xe4c7d,0x2514e,0x16d51,0xe4c73,0x2515a,0x2577b,0x16d5d,
-0x16d5c,0x2515c,0x2514b,0x25166,0x16d57,0xe4c6b,0x16d4d,0x2515f,
-0x00000,0x25163,0x25168,0x2515d,0x25151,0x16d50,0x16d53,0x16d5b,
-0x16d56,0xe4c75,0x25154,0x24b48,0xe4c7e,0xe4c6c,0x25150,0x25167,
-0x16d52,0xe4c79,0x16d55,0x25169,0x16d4a,0x2515e,0x25144,0x25164,
-0x1742a,0xe4c7a,0x25152,0x00000,0x16d4b,0x2514d,0x16d4f,0x25145,
-0x16952,0x25149,0xe6363,0x25162,0x2514a,0x25148,0x16d54,0xe4c7b,
-0x25160,0xe4c77,0x25147,0x25159,0x25158,0x25165,0x2514f,0x16d58,
-0x00000,0xe6547,0x00000,0x00000,0x00000,0xe6546,0x2577e,0xe5156,
-0x17133,0x17129,0x2582c,0x25776,0x1712b,0x25824,0x17132,0x1712d,
-0x25822,0x25d3b,0x25828,0x2582e,0x25827,0x25774,0x25825,0x25830,
-0x25832,0x17128,0x25831,0x1712e,0x17134,0xe5154,0x17131,0xe5158,
-0x2582b,0x17130,0x25826,0xe514d,0x25778,0x2577d,0xe5150,0x2582a,
-0x1712f,0x1712c,0x17127,0x1712a,0x2577c,0x00000,0x25146,0x25777,
-0x2577a,0x2582d,0x25821,0x25775,0x25d3a,0x2582f,0x25779,0x25829,
-0xe4c71,0x00000,0x00000,0xe5155,0x25d3d,0x1742e,0xe5530,0xe552f,
-0x17422,0xe5535,0xe5536,0x17426,0x25d3f,0x25d45,0x25d43,0x17424,
-0x17425,0x1742c,0x25d46,0x25d3e,0x17427,0xe5531,0x25d42,0x25d41,
-0x25d47,0x1742d,0xe5537,0x17428,0x1742b,0x25d40,0x1742f,0x17429,
-0x17430,0x17423,0x25d44,0xe5a55,0x25d3c,0xe5159,0xe5539,0x26225,
-0xe6548,0x00000,0x1765d,0x26222,0x26224,0xe5828,0x1765b,0x2617e,
-0x26221,0x2617a,0xe582a,0xe5827,0x25823,0x2617b,0x1765c,0x26177,
-0xe5826,0x17659,0x26226,0x1765a,0x26178,0x26179,0x2617d,0x1765f,
-0xe5829,0x1765e,0x00000,0xe582b,0x2617c,0x17845,0x2656a,0x26570,
-0x17846,0x26567,0x17843,0x17840,0x26572,0x17844,0xe5a52,0x17841,
-0x26569,0x2656c,0x2656d,0x2656e,0x26571,0xe5a54,0x26223,0x26568,
-0x17842,0x2656f,0x26934,0x2656b,0xe5a53,0xe654a,0xe6549,0x2692b,
-0x17975,0x2692e,0x17976,0x26937,0x2692d,0x2692a,0xe5c51,0x2692c,
-0x26930,0x26933,0x26932,0x26936,0x26929,0xe5c4f,0x17974,0x26931,
-0x26935,0x26938,0x2692f,0x26b61,0x26b62,0x26b66,0x26b67,0xe5e3c,
-0x26b64,0x26b65,0x26b63,0xe5e3a,0x17a74,0xe5e3b,0x00000,0x00000,
-0x00000,0x17b64,0x26d59,0xe6036,0xe5f52,0x26d56,0x26d57,0x26d58,
-0x17b65,0xe6037,0x26f34,0x26f33,0xe654b,0x2703d,0x17c60,0x2703b,
-0x2703e,0x2703c,0x27125,0x17d24,0x17d32,0x27171,0x2715b,0xe6179,
-0x27170,0x2723e,0x2723f,0x14556,0x00000,0x00000,0xe2428,0xe2426,
-0x14848,0x22261,0xe2427,0xe242b,0x2245e,0xe2662,0x14b22,0xe265f,
-0x14b25,0xe265e,0x2245f,0xe2663,0x14b23,0x14b24,0xe2660,0x00000,
-0x00000,0xe2977,0x22778,0x2277a,0x22775,0x22772,0x22774,0xe2974,
-0xe2970,0xe2975,0x14e65,0xe296f,0xe2979,0xe2976,0x14e63,0xe2972,
-0xe2971,0x22776,0x14e64,0x22773,0x22770,0x14e62,0x22777,0x00000,
-0x22771,0x14e66,0x22779,0x00000,0x00000,0x00000,0x00000,0x22b6f,
-0xe2d5e,0x22b73,0xe2d5c,0xe2d5a,0x1523a,0xe2d58,0xe626a,0xe2d65,
-0xe2d62,0x22b76,0xe2d5f,0x15232,0x15235,0x15237,0x15239,0x15236,
-0x22b72,0x22b71,0xe2d64,0x15234,0x22b74,0x22b75,0xe2d63,0x22b6e,
-0x15238,0xe2d68,0x15233,0xe2d5d,0x00000,0x00000,0x22b70,0xe654d,
-0x00000,0x00000,0x00000,0x00000,0xe3228,0x2305a,0x2305b,0x2305c,
-0x15653,0xe6279,0x1564f,0x23051,0xe322a,0x23059,0x2305e,0x15654,
-0xe322b,0x2304f,0x23055,0x2304e,0x23058,0xe3231,0xe322f,0x23054,
-0x15650,0x15652,0x2305d,0xe3229,0x2304d,0x23050,0x23056,0xe322d,
-0x23057,0x2305f,0x23053,0xe322c,0x15651,0xe654f,0x00000,0x00000,
-0x00000,0x00000,0xe654e,0x00000,0x00000,0x00000,0xe3230,0x15b72,
-0x23671,0xe3730,0xe3732,0x23673,0x2366f,0xe372f,0x2367b,0x2366d,
-0x2367a,0x15b6e,0x2366b,0x23d5f,0x23675,0x15b71,0xe3735,0x23676,
-0x23679,0xe372e,0x2367d,0xe372c,0x23672,0x00000,0x23677,0xe372d,
-0xe3731,0x15b6f,0x15b70,0x2367c,0x23670,0x2366c,0x2367e,0xe3733,
-0x23674,0xe6550,0xe6551,0x23678,0x00000,0x00000,0x00000,0x2366e,
-0x00000,0x1604e,0x1604f,0x23d69,0x16055,0xe3c74,0x23d5d,0x23d66,
-0x23d5c,0x16052,0x23d64,0x23d62,0xe3c7d,0x23d63,0x16050,0xe3c7c,
-0x23d67,0x00000,0xe3c6f,0xe3c7a,0xe3c72,0xe3d21,0x23d60,0x23d5e,
-0x16051,0x23d61,0x23d65,0xe3c7b,0xe3c79,0xe3c71,0x16053,0xe3c73,
-0xe3c77,0xe6553,0x23d68,0xe6554,0x00000,0xe6555,0x00000,0xe6552,
-0x00000,0x24456,0x2445d,0x2445f,0x24465,0xe4257,0x16522,0x24451,
-0xe424c,0x16478,0xe424e,0x24460,0x1647d,0x24466,0x16474,0xe4251,
-0x24463,0xe4258,0x24453,0x24464,0x24452,0x00000,0x16524,0xe4252,
-0x2445e,0x16475,0x24467,0xe483c,0x1647a,0x24457,0x16521,0x24462,
-0x24455,0x2445c,0x24458,0x24454,0x16477,0x1647e,0x1647c,0x16479,
-0x16523,0x16476,0x2445b,0xe424f,0x1647b,0xe4259,0x16054,0xe4249,
-0x24461,0xe6559,0x24459,0x00000,0xe4253,0xe6557,0xe6558,0xe6556,
-0x2445a,0x00000,0x00000,0x24b67,0xe476f,0x1695b,0xe476e,0xe476c,
-0x24b63,0x24b69,0x24b65,0xe4770,0x1695d,0x24b64,0x24b68,0x24b60,
-0xe4772,0x24b62,0x1695c,0xe476a,0xe476d,0xe476b,0xe4768,0x24b66,
-0x24b61,0xe4767,0x1695e,0xe655b,0x16959,0x00000,0xe655a,0x24b6a,
-0x00000,0x1695a,0x2516f,0x2516c,0x25178,0x25172,0x25174,0x16d5e,
-0x2516e,0x25176,0xe4d2a,0xe4d24,0x25175,0x25173,0xe4d29,0x25179,
-0x16d61,0x25170,0x25177,0xe4d28,0x16d5f,0xe4d25,0xe4d22,0x2516b,
-0x2516d,0x16d60,0x2516a,0x2517a,0xe655c,0x25171,0xe5162,0xe515a,
-0x25836,0x1713b,0xe5160,0xe515c,0x25841,0x2583f,0x17135,0x25835,
-0x25838,0x25839,0x25834,0x1713f,0x17140,0x25833,0x25842,0x2583d,
-0x17139,0x17136,0x2583c,0x2583a,0xe5163,0xe6374,0x1713c,0x2583e,
-0x17137,0xe515e,0x17138,0xe5166,0x2583b,0x1713a,0x25837,0x00000,
-0x25840,0x1713d,0x25843,0x25844,0x1713e,0xe655d,0xe655e,0x17432,
-0x17439,0x25d48,0x25d4e,0xe553c,0x25d4c,0x17435,0x17434,0x17431,
-0x25d4a,0xe553e,0xe5543,0xe5540,0x17437,0x17436,0x17433,0xe5541,
-0x25d4d,0x25d49,0x25d4b,0xe5542,0x17438,0x00000,0x00000,0x00000,
-0x17663,0x26229,0xe582d,0x17660,0x17661,0x2622b,0x17662,0x26228,
-0xe582e,0x26227,0x26576,0x2622a,0xe5a56,0x26577,0x17847,0x26575,
-0xe5a57,0x00000,0x26574,0xe5c59,0x26573,0x17848,0xe655f,0xe5c56,
-0x17977,0xe5c58,0xe5c55,0x26939,0x2693a,0xe5a58,0xe5c53,0xe5c57,
-0xe6561,0x26b6a,0x26b69,0x17a75,0xe5f53,0x26b68,0x26d5a,0x26d5b,
-0xe5f54,0xe6039,0x26f35,0x2703f,0xe6143,0xe6142,0x27126,0x2722c,
-0x17d46,0x27240,0x14557,0x00000,0x14e67,0x14e68,0xe2d69,0x00000,
-0x1523b,0x00000,0xe3d22,0x00000,0x00000,0x1743a,0x14558,0x00000,
-0x14e69,0x15655,0x16525,0x14559,0xe2d6b,0x15b73,0x1695f,0x22142,
-0xe297c,0x22b77,0x23060,0x00000,0x24b6b,0x00000,0x1743b,0x1455a,
-0x14e6a,0x22b78,0x22b79,0x23d6a,0x16056,0x00000,0xe425d,0x24468,
-0xe425c,0xe425b,0x16526,0x24b6c,0x00000,0xe4d2e,0x16d62,0xe4d2d,
-0x17849,0x1455b,0x23d6b,0x1455c,0x00000,0x1484a,0x22262,0x14849,
-0x14b28,0x14b27,0x14b26,0x22460,0xe2664,0xe2a21,0xe2a22,0x14e6b,
-0xe2a23,0x14e6c,0x2277b,0x00000,0x22b7a,0xe2d6d,0x22b7d,0x1523d,
-0x22b7b,0x00000,0x1523c,0x22b7c,0x1523e,0x00000,0x23063,0x23062,
-0x23061,0x15656,0xe3236,0x23722,0x23723,0x15b74,0x23721,0x23724,
-0x16058,0x15b75,0xe3d24,0xe3d23,0x16057,0x23d6f,0x23d6e,0xe3d25,
-0x23d6c,0x23d6d,0x00000,0x23d70,0x2446a,0x24469,0x2446d,0x00000,
-0x2446c,0x2446b,0x16960,0x24b6f,0xe4775,0x24b6e,0x16961,0x24b6d,
-0x2517b,0xe4d2f,0x2517c,0x16d63,0x00000,0x25845,0x25846,0x00000,
-0x00000,0x2657c,0x1784a,0x2657b,0x2657a,0x26578,0x26579,0x17a76,
-0x2693b,0x26d5c,0x27127,0xe617b,0x1455d,0x00000,0x22164,0x14667,
-0x22165,0xe242c,0xe242d,0x00000,0x22263,0x22264,0xe266b,0x00000,
-0x00000,0xe2669,0x22466,0xe2666,0xe2667,0x22462,0xe266a,0x22461,
-0x14e6d,0x22465,0x14b2a,0x22463,0x14b29,0x22467,0x22464,0xe2668,
-0x00000,0x22821,0x22b7e,0x2277d,0x22826,0xe2a26,0x14e6e,0xe2a2a,
-0x14e71,0x22827,0x22823,0xe2a27,0x22824,0x00000,0x2277c,0x14e70,
-0x2277e,0x14e6f,0x22825,0xe2a28,0x22822,0x00000,0x00000,0x22c24,
-0x15240,0x15241,0xe2d75,0x22c27,0x22c21,0xe2d74,0x22c26,0xe2d70,
-0x22c22,0x1523f,0x22c25,0x22c23,0xe2d73,0xe2d71,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x23069,0x23066,0xe3238,0x23068,0x1565b,
-0x1565a,0x15658,0x23065,0x2306a,0x15657,0x15659,0x23067,0x2372c,
-0x23064,0x2306b,0xe3239,0x00000,0x00000,0x00000,0xe3d26,0x23727,
-0x2372b,0x00000,0x2372a,0x23d72,0x23d7d,0x00000,0xe373b,0x2372d,
-0xe373a,0x23728,0x23d71,0x15b79,0x00000,0x00000,0x15b78,0x23726,
-0x23729,0x15b7a,0xe3739,0x15b77,0x15b76,0x23725,0x2372e,0x00000,
-0x00000,0x00000,0x23d74,0x23d7b,0xe3d27,0x1605a,0x23d7a,0x23d77,
-0xe3d2e,0x1605c,0xe3d29,0xe3d2b,0xe3d2a,0x23d79,0xe4261,0xe3d2d,
-0x23d73,0x23d75,0x23d78,0x23d76,0x1605b,0x23d7c,0x16059,0x16527,
-0xe3d28,0x00000,0x24471,0x24470,0x2446e,0x00000,0x1652a,0x16529,
-0x24472,0xe425f,0x2446f,0x24b70,0x16962,0x16528,0xe4262,0xe6562,
-0xe6563,0x24474,0x24473,0xe4d30,0x24b73,0x24b71,0x16d64,0xe4779,
-0x16963,0x24b72,0x2517e,0xe4778,0xe477a,0xe4777,0x00000,0x16d65,
-0x2517d,0x25228,0x25227,0x25225,0x00000,0x25224,0x25221,0x25222,
-0x25223,0x25226,0x25229,0x00000,0x00000,0x2584b,0x25848,0x25849,
-0x17141,0x25847,0x2584d,0x2584c,0x2584a,0x00000,0x25d50,0x25d51,
-0x1743c,0xe5549,0x1743d,0x25d4f,0x00000,0x17665,0x2622c,0x17664,
-0x1784b,0x00000,0x1784c,0x17978,0x2693d,0x2693c,0x26b6b,0x26d5d,
-0x17b66,0x26f37,0x26f36,0x26f38,0x14668,0x22c28,0x1565c,0x15b7b,
-0x2372f,0x14669,0x22166,0x1455e,0xe225a,0xe216b,0x22265,0xe242f,
-0x00000,0x00000,0x2246c,0x2246a,0x2246b,0x22468,0x14b2b,0x22469,
-0xe266e,0x00000,0x00000,0x00000,0xe2a33,0x2282f,0xe2a2d,0x14e74,
-0x2282d,0x22829,0x2282c,0xe2a2c,0x22828,0x14e76,0x2282b,0xe2a2b,
-0x14e73,0x14e72,0xe2a32,0x14e75,0x2282e,0x2282a,0x00000,0xe2a2f,
-0x00000,0x00000,0x15245,0x15248,0x22c30,0x22c2f,0x22c2e,0x15242,
-0x22c37,0x22c2d,0x00000,0x15244,0x23070,0xe2d78,0x22c34,0x22c32,
-0x15247,0xe2d7b,0x22c2a,0x22c35,0xe2d77,0x22c2c,0x22c36,0x22c33,
-0x22c2b,0xe2d7a,0x15243,0x22c38,0x22c29,0x15246,0xe2d7e,0xe2d79,
-0xe2d7c,0x00000,0x23075,0x2306c,0x23077,0xe323e,0x2306f,0x2307a,
-0x2307b,0x2306d,0x23079,0x23076,0x23074,0x23078,0x15662,0xe3240,
-0x15660,0xe3247,0xe323c,0x23072,0xe3246,0x2306e,0xe3241,0x23071,
-0x2307c,0x23073,0x15661,0x22c31,0xe323d,0x1565d,0x1565f,0xe6564,
-0x00000,0x00000,0x00000,0xe373d,0x2373d,0x23732,0x23730,0xe3d38,
-0x23731,0xe323f,0x23738,0xe3740,0x23739,0x23735,0x15c22,0x2373a,
-0x23737,0x23734,0xe373c,0x15b7e,0x23733,0x15b7c,0x15c21,0x23736,
-0x2373e,0x1565e,0x15b7d,0x2373c,0x2373b,0x15c23,0x00000,0x00000,
-0x00000,0x00000,0xe6565,0x00000,0xe3d36,0xe3d3a,0x23e24,0xe3d2f,
-0xe3d3b,0xe3d32,0x23e25,0x16066,0xe3d39,0x23e2b,0xe426d,0xe3d35,
-0x23e2d,0x23e26,0x16060,0x23e2a,0x23e29,0x16061,0x16067,0xe4264,
-0x16068,0x23e2c,0x1605e,0x23e23,0x23e21,0x23e27,0x23d7e,0x16065,
-0x23e22,0x23e28,0x23e2e,0x1605f,0x16064,0x16062,0x16063,0x00000,
-0xe3d33,0xe3d3c,0x1605d,0xe6566,0xe3d37,0xe4268,0xe4275,0x16531,
-0x2447b,0x16530,0x24521,0xe426f,0x24475,0xe4274,0x24522,0xe426e,
-0xe4266,0xe4271,0x24476,0x24477,0xe4273,0x24523,0x2447e,0x2447c,
-0x2447d,0x24479,0x24478,0xe4267,0x24524,0x1652d,0xe426b,0x2447a,
-0xe4270,0x16532,0x1652c,0x16533,0x16534,0xe426a,0x1652f,0x1652e,
-0xe4825,0xe477e,0x24b74,0x16965,0x16964,0xe477c,0xe477d,0x24b79,
-0xe4822,0x16d66,0x16966,0xe4821,0xe477b,0x16968,0x24b7a,0x1652b,
-0x16967,0x24b76,0x24b78,0x24b75,0xe4827,0x24b77,0xe4823,0x00000,
-0x00000,0x25233,0xe4d31,0xe4d3b,0x25232,0x2522f,0x16d69,0x2584e,
-0x16d6a,0x2522e,0xe4d39,0x16d68,0xe4d36,0x25230,0x2522d,0x2522a,
-0x25231,0x2522b,0x2522c,0x16d67,0xe4d35,0xe6568,0x00000,0x00000,
-0x25d55,0x00000,0x25852,0xe4d3a,0x25851,0x25853,0xe516a,0x25d52,
-0x17144,0xe6375,0x2584f,0xe5167,0x17142,0xe516c,0x17146,0x17145,
-0x25850,0x25854,0xe516b,0x17143,0xe6567,0x25d59,0x17440,0x17666,
-0x17441,0x1743e,0x25d56,0x25d54,0xe554f,0x25d57,0xe554b,0x25d5a,
-0x1743f,0x25d58,0x25d53,0xe554d,0xe6569,0x2622f,0x26232,0x26621,
-0x2622d,0xe582f,0x2693e,0x26233,0xe5830,0x1784d,0x26231,0x17667,
-0x2622e,0x26230,0x26234,0x26622,0xe5a5a,0x2657e,0x00000,0xe5a5c,
-0xe5a5d,0xe5a5b,0x1784e,0x2657d,0xe5c5e,0xe5c5c,0xe5c5f,0x17979,
-0xe5c5d,0xe5c60,0x00000,0xe5e3d,0x17a78,0x26d5f,0x17a77,0x26d61,
-0x26d5e,0x26d60,0x17c3c,0x27040,0x1466a,0x22830,0x2307d,0x2307e,
-0x15c24,0x24525,0x17147,0x1784f,0x17b67,0x27041,0x1466b,0x00000,
-0x22831,0x12322,0x00000,0xe2e22,0x22c39,0xe2e21,0x22c3a,0xe2e24,
-0x00000,0x00000,0x00000,0xe3248,0x23121,0x23122,0x15c25,0x15c26,
-0x00000,0xe3d3d,0x00000,0x23e2f,0x00000,0x24528,0x24527,0x24526,
-0x24b7b,0xe4277,0x24b7c,0x24b7d,0x16969,0x00000,0xe4828,0x25235,
-0x25234,0xe4d3d,0xe516d,0x25855,0x17148,0x17149,0xe516e,0x25d5e,
-0x25d5b,0x25d5c,0x25d5d,0x26236,0x26235,0x17668,0x26623,0x26b6c,
-0x1466c,0x00000,0x15249,0xe3744,0x15c27,0x24529,0xe4278,0x1466d,
-0x00000,0x23123,0x15c28,0xe3745,0xe3d3e,0x16069,0x1606a,0x00000,
-0x1466e,0x1466f,0x22266,0x14b2d,0x14b2c,0x1524a,0x22c3b,0x23e30,
-0x14670,0x14671,0x14672,0x14673,0x00000,0x00000,0x00000,0x14b2e,
-0x14b2f,0x2246e,0x2246d,0xe2a37,0x00000,0x14e77,0x22834,0x22832,
-0x22833,0xe2a38,0xe2a35,0x00000,0xe2a36,0x00000,0xe2e27,0x22c3c,
-0x22c3d,0xe2e25,0xe2e28,0x1524e,0x1524c,0xe2e2a,0x1524d,0x1524b,
-0xe2e26,0x00000,0x00000,0x00000,0x15663,0xe324e,0xe324d,0xe3250,
-0xe324f,0x15667,0x15666,0x23124,0x15665,0x15664,0xe3251,0x23125,
-0x00000,0xe3746,0x15c2b,0x23740,0x2373f,0x15c29,0x15c2a,0xe3749,
-0xe3747,0x00000,0x1606c,0x1606b,0x23e32,0xe3d43,0xe3d42,0x23e31,
-0x15c2c,0xe3d44,0x00000,0x00000,0x00000,0x00000,0x16535,0x2452b,
-0x16536,0x2452a,0xe427b,0x00000,0x00000,0x24b7e,0x25236,0x16d6b,
-0x25856,0xe5170,0x00000,0xe5552,0x25d5f,0x00000,0x17851,0x17850,
-0x00000,0xe5c62,0x17b68,0x14674,0x22835,0x00000,0xe3d45,0x15c2d,
-0x24c21,0x1696a,0xe225b,0xe2673,0x2246f,0x22470,0x00000,0x00000,
-0x22836,0x14e79,0x14e7a,0xe2a3a,0x00000,0x14e78,0xe2a3b,0x00000,
-0x00000,0x00000,0x15252,0x15253,0x15250,0x15251,0xe2e2b,0x22c3e,
-0xe2e2f,0x00000,0x22c3f,0x1524f,0x00000,0x00000,0x00000,0x00000,
-0x23126,0xe3257,0x1566b,0x1566c,0xe3255,0x15c30,0x2312c,0x00000,
-0x15671,0x1566f,0x2312d,0x23128,0x1566e,0x1566d,0x15668,0x2312b,
-0x2312a,0x23127,0x15670,0xe3252,0x23129,0x15669,0x00000,0x1566a,
-0x00000,0x00000,0x15c31,0x23744,0x23745,0x15c32,0x23741,0x23743,
-0x23747,0x23746,0x23742,0xe374a,0x15c2e,0x15c2f,0x00000,0x23e3a,
-0x16071,0x16070,0x23e34,0x1606e,0x00000,0x23e37,0x16072,0x23e38,
-0x16073,0x23e35,0x1606d,0x1606f,0x23e39,0xe3d47,0x23e36,0x23e33,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x24538,0xe427c,0x2452d,
-0x16538,0x1653b,0x1653a,0x1653f,0x1653e,0x24539,0x24537,0x24530,
-0x24534,0x24533,0x1653c,0x24536,0x24532,0x2453a,0x24531,0x1653d,
-0x16537,0x16539,0xe427d,0x2452f,0x00000,0x00000,0x00000,0xe482b,
-0x24c23,0x1696e,0x24c27,0x1696d,0x24c24,0x1696c,0xe4829,0x2452e,
-0x24535,0x24c26,0x00000,0x1696f,0x24c28,0x24c25,0x24c22,0x00000,
-0x00000,0x25239,0x2523d,0x2523f,0x2523b,0x2523a,0x25238,0x16d6e,
-0x16d6c,0x16d71,0x16d72,0x2523c,0x16d6f,0x25237,0x16d70,0x1696b,
-0x2523e,0x16d6d,0x00000,0x00000,0xe5171,0x25858,0x00000,0x25857,
-0x2585f,0x25859,0x2585e,0x2585b,0x1714a,0x2585d,0xe5173,0xe5172,
-0x1714b,0x00000,0x1714c,0xe5174,0x2585c,0x2585a,0x00000,0x00000,
-0x00000,0x00000,0x17443,0x25d60,0xe5555,0xe5553,0x17442,0x25d63,
-0x25d61,0x25d62,0x00000,0x00000,0x17444,0x00000,0xe5554,0xe5834,
-0x2623a,0xe5833,0x1766b,0x2623b,0x00000,0x00000,0x17669,0x2623c,
-0x1766a,0x26239,0x2623d,0xe5832,0x26237,0x00000,0x00000,0x17852,
-0x26624,0x17853,0x1797a,0x00000,0x26238,0x1797b,0x00000,0xe5e3f,
-0xe5e3e,0x17a79,0x26b6d,0x00000,0x17b6a,0x26d62,0x17b69,0xe603b,
-0x26f39,0x17c61,0x17c62,0xe656a,0x00000,0x2723a,0xe225c,0xe656b,
-0x15254,0x22c40,0x00000,0x16074,0x16075,0x14675,0x1484b,0x22267,
-0xe2674,0x22471,0x14b30,0xe2676,0x14e7b,0x00000,0x15255,0x15256,
-0x15257,0x23749,0x2312e,0x15672,0x00000,0x00000,0x15c33,0x23748,
-0xe374d,0x00000,0x23e3c,0x16077,0xe3d4c,0x23e3b,0x16076,0xe427e,
-0xe4321,0x2453b,0x16d73,0x25243,0x25240,0x25241,0x25242,0x00000,
-0x00000,0xe5176,0x00000,0xe5556,0x25d64,0xe5557,0x2623e,0x00000,
-0x00000,0xe5a5e,0x26940,0x2693f,0x00000,0x26d63,0x14676,0x22837,
-0x15673,0x00000,0x00000,0xe3d4d,0x16078,0x2453c,0x00000,0xe4830,
-0x24c29,0xe482e,0x16d74,0x25860,0xe656c,0x2623f,0x26941,0x14677,
-0xe2677,0xe2678,0x14e7c,0x1525a,0x22c41,0x1525b,0x15259,0xe2e32,
-0x15258,0x2312f,0x15674,0xe325a,0xe325b,0x15675,0x15676,0x00000,
-0x00000,0x00000,0x15c35,0x2374a,0x15c34,0xe3750,0xe3752,0xe3751,
-0x00000,0xe3d4f,0x23e3d,0x15c36,0x16079,0x2453d,0x16540,0x16541,
-0x00000,0x16970,0xe4831,0x16971,0x16d75,0x1714e,0x25861,0x1714d,
-0x00000,0x25d65,0x17445,0xe5835,0x26240,0x26942,0x14678,0x14b31,
-0x2283a,0x22839,0x14e7d,0x22838,0x14e7e,0x2283b,0x00000,0x22c47,
-0x1525e,0x1525d,0x22c49,0x22c48,0x15262,0xe2e35,0x15261,0xe2e33,
-/* 0x7700 */
-0x00000,0x1525c,0x00000,0x22c43,0x22c44,0x22c45,0xe626c,0x15263,
-0x22c42,0x1525f,0x22c46,0x15260,0x00000,0x00000,0xe3264,0xe325f,
-0x23132,0x23136,0x23134,0x23133,0x00000,0x23137,0xe325e,0x00000,
-0xe3268,0x23138,0x23139,0x23131,0x00000,0x23130,0xe3759,0x15678,
-0x15679,0xe3267,0x2313a,0x23135,0xe3265,0x23753,0xe3755,0x2313b,
-0x1567a,0x15677,0xe325c,0xe3263,0x00000,0x2374d,0x00000,0x2374c,
-0xe3753,0x2374e,0x2374f,0x23751,0x23750,0x23755,0x15c3a,0x15c37,
-0x15c3b,0x2374b,0x15c3c,0x23754,0x15c39,0x23752,0x15c38,0xe3262,
-0xe3757,0x00000,0xe3d56,0xe3d53,0x23e40,0x23e42,0x23e3e,0x23e3f,
-0xe3d51,0xe3d52,0x23e43,0x23e45,0x23e46,0x23e41,0x23e44,0x1607a,
-0x00000,0x00000,0x24541,0xe4327,0x24546,0x2453e,0x24542,0x00000,
-0xe4328,0x24547,0x24543,0x16542,0x1654a,0xe4325,0x16545,0x2453f,
-0x24540,0x16975,0x1654d,0x16546,0xe4326,0x1654b,0x16544,0x24545,
-0x1654c,0x24544,0x16548,0x16543,0x16549,0x24548,0x24c2e,0x24c30,
-0x00000,0xe4839,0x00000,0x00000,0xe4833,0xe4836,0xe4835,0xe4834,
-0xe4838,0x16547,0xe483b,0xe483d,0x24c2b,0x16973,0x24c31,0x16974,
-0x24c2f,0x24c2a,0x24c2d,0x24c32,0x16972,0x24c2c,0x00000,0x16d77,
-0x25247,0x25246,0xe4d44,0x16d7a,0x16d78,0x25244,0x16d76,0x25245,
-0xe4d46,0x16d79,0x00000,0x00000,0x00000,0x25869,0xe517b,0x2586b,
-0xe5179,0x2586a,0x25862,0x25866,0x25865,0x25863,0x17150,0x17151,
-0x1714f,0x25864,0x25867,0x25868,0xe5559,0x17152,0xe5558,0x1744a,
-0x25d6d,0xe555b,0x17447,0x25d67,0x17449,0x1744b,0x00000,0xe555c,
-0x17448,0x25d6c,0x25d68,0x17446,0x25d6b,0x25d66,0x25d6a,0x25d69,
-0xe5836,0xe5838,0x26242,0x1766e,0x1766f,0x1766c,0xe583b,0x1766d,
-0xe583a,0xe5839,0x26241,0x00000,0x26627,0xe5a60,0xe5a5f,0x17854,
-0x00000,0x26625,0x26626,0x00000,0x26943,0x26946,0x26944,0x26945,
-0x26b6e,0xe5e42,0x00000,0x17a7a,0x26f3a,0x27042,0xe6432,0x17c63,
-0x27128,0x27129,0x17d33,0x14679,0x15264,0xe3269,0x23e47,0xe3d57,
-0x24549,0x00000,0x1467a,0x14b32,0x00000,0x14f21,0xe2e36,0x22c4a,
-0x22c4b,0x1567b,0x00000,0x00000,0x23e48,0x1607b,0x1654e,0x1744c,
-0x25d6e,0x26628,0x26947,0x1467b,0xe267b,0xe267c,0x00000,0x22841,
-0x2283c,0x2283e,0x22840,0x2283f,0x2283d,0x14f22,0x00000,0x00000,
-/* 0x7800 */
-0x00000,0x00000,0x15265,0x22c54,0xe2e39,0x22c4f,0x22c4c,0xe2e3b,
-0xe2e3e,0x22c53,0xe2e37,0xe2e3a,0x15267,0x15268,0x22c52,0x22c51,
-0x22c50,0x22c4d,0x22c4e,0x22c55,0x15266,0xe2e3d,0x00000,0x00000,
-0x00000,0xe656d,0x00000,0xe656e,0x00000,0x15721,0xe667c,0x15727,
-0x15726,0x23144,0x2313e,0x2313c,0xe326c,0x15724,0x2375c,0x1567d,
-0x23141,0x23145,0x23147,0x23143,0x2313d,0x15725,0x23142,0x23140,
-0x1567c,0x23148,0x15728,0x23146,0x15722,0x2313f,0xe326d,0x15723,
-0x1567e,0x00000,0x00000,0x00000,0x00000,0xe656f,0x00000,0x00000,
-0x00000,0x00000,0xe3762,0x15c3e,0x00000,0x2375d,0xe3763,0xe375d,
-0x23756,0x23758,0x2375a,0xe375f,0x2375b,0x23759,0x15c3f,0xe3761,
-0x2375e,0xe3760,0x23757,0xe6570,0xe6571,0x00000,0x00000,0x00000,
-0xe6572,0x00000,0x00000,0x00000,0x23e4c,0x1607c,0x23e54,0xe3d5c,
-0x23e49,0x00000,0x23e55,0xe3d59,0x23e4a,0x23e4b,0xe3d5d,0x00000,
-0x23e53,0x23e52,0x23e4f,0x15c3d,0x1607d,0x23e4d,0x23e50,0x1607e,
-0x23e51,0x23e4e,0x00000,0x00000,0x00000,0x00000,0xe3d5a,0x00000,
-0xe4331,0x24554,0xe432d,0x24558,0x16555,0xe432e,0x24c38,0x16558,
-0x24556,0xe4337,0xe4329,0x24553,0x2454e,0x24550,0x24551,0x2454a,
-0xe4335,0x16554,0xe432b,0xe4330,0x16553,0xe4334,0x1654f,0x2454d,
-0xe432a,0x16556,0xe4336,0x16557,0x2454c,0x2454f,0x24557,0x16551,
-0x16552,0x24555,0x2454b,0x00000,0x00000,0x00000,0x24c3a,0x16977,
-0x24c3c,0x24552,0x24c3e,0x1697b,0x24c3f,0x24c3b,0xe483e,0x16978,
-0x24c37,0x1697a,0x24c34,0x24c39,0x24c3d,0x24c36,0xe483f,0xe4845,
-0x16550,0xe4844,0x24c33,0x16979,0x24c35,0x00000,0x00000,0xe6573,
-0xe4840,0x00000,0x16d7d,0x25249,0x16e23,0x00000,0x16e21,0x00000,
-0xe4d4a,0x16976,0xe4d4d,0x25250,0x25251,0x16d7c,0xe4d48,0xe4d4c,
-0x2524f,0x25252,0x16d7e,0x16d7b,0x2524b,0x25248,0x2524d,0x2524a,
-0x16e24,0x2524c,0xe4d4b,0xe4d49,0x2524e,0x16e22,0xe5221,0x00000,
-0xe6574,0x00000,0x17154,0x25872,0xe5224,0x2586c,0x25870,0x25876,
-0x25877,0x25873,0x25874,0x25871,0x00000,0x2586e,0x00000,0x17156,
-0x17153,0x2586d,0x2586f,0xe5222,0x17155,0x25875,0xe6575,0x17450,
-0xe5560,0xe5562,0x25d75,0x25d6f,0x1744f,0x00000,0x00000,0x1744d,
-0xe5561,0x25d77,0x1744e,0x25d72,0x25d73,0x25d70,0x25d78,0x25d74,
-/* 0x7900 */
-0x00000,0x17451,0x25d71,0x00000,0x25d79,0x25d76,0xe5843,0xe583e,
-0xe5840,0x26246,0xe583f,0xe583c,0x26243,0xe5842,0x17670,0x00000,
-0x26247,0x26249,0x26248,0x26244,0x26245,0xe5844,0x00000,0x2662d,
-0xe5a61,0x17855,0xe5a62,0x2662a,0x2662c,0x26629,0x2662e,0x00000,
-0xe5a63,0x2662b,0xe6576,0x26949,0x2694c,0x26948,0x1797c,0x2694a,
-0x2694b,0x2694d,0x1797d,0x17a21,0x1797e,0x26b6f,0xe5e45,0x26b71,
-0xe5e43,0x26b70,0xe5e44,0x00000,0x00000,0x26d64,0x00000,0xe603c,
-0x27043,0x2712a,0x1467c,0x00000,0xe2433,0x22472,0x14f23,0x22843,
-0x14f24,0x14f25,0x22842,0x00000,0x22c5a,0x22c59,0x15269,0x1526c,
-0x1526b,0x1526a,0x22c56,0x22c58,0x22c57,0xe6577,0x00000,0x2314b,
-0x1572a,0x2314f,0x2314e,0x2314d,0x23149,0x15729,0x1572d,0x15730,
-0xe326f,0xe3270,0x15731,0x2314a,0x2314c,0x1572f,0x1572e,0x1572c,
-0x1572b,0x23765,0xe3272,0x23763,0x2375f,0x15c40,0xe3d5e,0x23760,
-0x15c41,0x23761,0x23762,0x23764,0xe3766,0x15c42,0xe3765,0x00000,
-0x23e59,0xe3d5f,0x23e58,0x23e57,0x23e56,0xe3d64,0xe3d62,0x00000,
-0x00000,0x2455c,0x16559,0x00000,0x24559,0x2455b,0xe4338,0x1655a,
-0xe433d,0x1655b,0x2455a,0xe4339,0xe3d63,0x00000,0xe6578,0xe4848,
-0x24c48,0xe4847,0x24c41,0x24c42,0x00000,0x1697e,0x1697c,0x1697d,
-0x24c4a,0x00000,0x24c49,0x24c46,0x24c45,0x24c44,0x24c43,0x24c47,
-0x24c40,0xe6579,0x25253,0x25258,0x25256,0xe4d50,0xe4d51,0xe4d4f,
-0x25255,0x25254,0x25257,0xe657a,0x25878,0xe5226,0x17157,0x17452,
-0x25d7b,0xe5227,0x17453,0x25d7a,0x2624b,0x2624a,0x17671,0xe5845,
-0x2662f,0x17856,0x2694e,0x17b6b,0x26d65,0xe603d,0x27045,0x27044,
-0x22167,0x1526d,0x1526e,0x23766,0xe657b,0x1655d,0x1467d,0x14b35,
-0x14b34,0x14b33,0x00000,0xe2a3e,0xe2a3d,0x22844,0xe2a3f,0xe2a42,
-0x14f27,0x14f26,0xe2a44,0x15271,0xe654c,0x22c5c,0x22c5f,0x22c5d,
-0xe2e42,0x1526f,0x15270,0xe2e40,0xe2e41,0x22c5b,0x22c5e,0xe2e43,
-0x15738,0xe3274,0xe3273,0xe3279,0x23156,0x23158,0x23157,0x15735,
-0x23152,0xe3276,0xe327b,0x15733,0x15732,0xe3277,0x15736,0x15734,
-0xe3278,0x15737,0x23155,0x23150,0x23151,0x23154,0x23153,0x00000,
-0xe327c,0xe3769,0xe3767,0xe376b,0x00000,0xe376a,0x23769,0x2376a,
-0x23768,0xe376c,0x23767,0x15c43,0x00000,0x00000,0x00000,0xe3d65,
-0x16125,0x00000,0x23e5a,0x23e5c,0x23e5e,0x16124,0x00000,0xe3d66,
-0x16122,0xe3d69,0x23e5b,0x16123,0x23e5d,0x16121,0xe3d68,0xe4341,
-0x24566,0x2455d,0x24560,0x24564,0x16561,0x24562,0x00000,0x24561,
-0x2455e,0x2455f,0x1655f,0x24565,0x1655e,0xe4344,0x16563,0x16562,
-0x16560,0x00000,0x24563,0x00000,0x00000,0xe6524,0x24c50,0x00000,
-0x24c4f,0xe484b,0xe484d,0x24c4b,0xe4850,0xe484f,0x16a21,0x24c4e,
-0x24c4d,0x16a22,0xe4852,0x00000,0x00000,0x00000,0x00000,0x16e29,
-0xe4d55,0x2525a,0xe4d56,0x16e2a,0x16e26,0x16e28,0xe4d5a,0x16e25,
-0x16e27,0xe4d53,0xe4d57,0x00000,0x25879,0xe522a,0x1715a,0x2587b,
-0x2587a,0xe5564,0x24c4c,0x1715c,0x1715b,0x17158,0x17159,0xe522c,
-0x00000,0x00000,0x00000,0xe5229,0x25e22,0x00000,0x25d7e,0x17454,
-0x25e21,0x00000,0x25e23,0x25d7d,0x25d7c,0x00000,0x00000,0x2624c,
-0x17674,0x17672,0x17673,0x00000,0xe5a66,0x00000,0xe5a65,0x26630,
-0x26631,0x17858,0xe5a67,0x17857,0x26950,0x26951,0x2694f,0xe5c64,
-0x26d66,0x26d67,0xe6076,0xe6077,0x1467e,0x22268,0x14b36,0x00000,
-0x22845,0x14f29,0x14f28,0x22846,0xe2e44,0xe2e47,0x22c61,0x15272,
-0x22c60,0x15273,0xe2e49,0xe2e48,0x15739,0x2315b,0x23159,0x2315f,
-0x1573a,0x2315a,0x2315e,0x2315c,0x2315d,0x00000,0x00000,0x2376b,
-0x2376d,0xe3772,0x15c44,0xe3771,0x2376c,0x15c45,0x16128,0x16127,
-0x16126,0x23e5f,0xe3770,0x00000,0x00000,0x00000,0x24569,0x16564,
-0x16565,0xe4346,0x24568,0x24567,0xe4347,0x00000,0x00000,0xe657c,
-0x24c51,0x16a24,0x16a23,0x24c52,0x24c53,0x00000,0x16e2c,0x16e2b,
-0xe4d5b,0x25921,0x2525b,0x2525d,0x2525c,0x2587e,0x2587c,0x25922,
-0x2587d,0x00000,0x1715d,0xe522f,0x00000,0xe522e,0x25e24,0x17455,
-0x25e25,0x25e26,0xe5568,0x00000,0x17675,0x17676,0x00000,0x17a22,
-0xe5e49,0xe5e48,0x17c3d,0x14721,0xe267e,0xe2721,0x00000,0xe2a47,
-0xe2e4e,0x22c62,0xe2e4f,0xe2e4d,0xe2e4b,0xe2e4c,0x00000,0x00000,
-0x23160,0x1573b,0xe3323,0xe3326,0xe3327,0xe3324,0x00000,0x15d7e,
-0x15d7d,0xe3773,0xe3d71,0x1612a,0x23e61,0x16129,0x23e60,0xe3d70,
-0x00000,0xe4349,0xe434a,0x2456a,0xe4854,0x16a25,0x24c54,0x16a26,
-0xe4855,0xe5230,0xe5569,0xe556a,0x00000,0xe5849,0x17a23,0x26952,
-0xe5f55,0x1484c,0x14f2a,0x22847,0xe2e51,0x15275,0xe2e50,0x15274,
-0x22c63,0x22c64,0x00000,0x00000,0x23162,0x23164,0x1573c,0x00000,
-0x23166,0x23169,0x23167,0xe332b,0x00000,0xe332a,0x23168,0x23165,
-0x23161,0x1573d,0x2316a,0x23163,0xe332c,0x00000,0xe3778,0xe3779,
-0x23776,0x15c4b,0x23821,0x15c48,0xe3777,0x23778,0x15c4c,0xe377b,
-0x15c46,0xe3776,0x23773,0x23822,0x23774,0x23771,0x15c4a,0x00000,
-0x15c47,0xe632d,0x23777,0x2377a,0x15c49,0x2377b,0x15c4d,0x2377c,
-0x23772,0x23779,0x2377d,0x23775,0x23770,0x2376e,0xe377a,0xe657d,
-0x2377e,0x00000,0x00000,0x2376f,0x00000,0x00000,0x00000,0x00000,
-0x23e68,0xe3d7b,0xe3d78,0xe3d75,0x23e64,0x23e6a,0x1612d,0x23e63,
-0x23e65,0x1612b,0x23e62,0x16132,0x23e66,0x16131,0x23e67,0x16133,
-0x1612e,0x16134,0x1612f,0xe3d79,0x16130,0xe3d72,0x1612c,0xe3d76,
-0x23e69,0xe657e,0x00000,0x00000,0x00000,0x00000,0xe434f,0x00000,
-0x16568,0x24575,0xe434c,0x24578,0x2456c,0x24571,0x2456b,0x1656a,
-0xe4355,0x2456f,0x00000,0xe434d,0xe3d77,0x2456d,0x16569,0xe4354,
-0x24574,0x24573,0x24570,0x24572,0x2456e,0x16a2a,0x24577,0x16566,
-0x24576,0xe4351,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0xe4856,0x24c64,0xe4858,0x16a31,0x24c5f,0xe4860,0x16a30,
-0x24c55,0x00000,0x24c57,0x16a29,0x24c5c,0x24c5b,0x24c5e,0x16a2e,
-0x24c59,0x24c58,0xe485a,0xe485e,0x16a2d,0x16a28,0x24c5a,0x16a2b,
-0x24c60,0x24c62,0x00000,0x24c5d,0x24c56,0x16a2c,0xe4857,0xe485d,
-0x16e34,0x16a27,0x00000,0xe485c,0x24c63,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x25261,0x16e2d,0xe4d5c,0x25263,
-0x00000,0x16e2e,0xe4d65,0xe4d5d,0x16e30,0x25266,0x00000,0x2525e,
-0x16a2f,0x25264,0x00000,0x00000,0x00000,0x00000,0x25260,0xe4d60,
-0x16567,0x16e33,0xe6367,0xe6366,0x16e2f,0x00000,0x16e31,0x16e32,
-0x00000,0x17160,0x25265,0x2525f,0x16e35,0xe4d63,0x25262,0x00000,
-0xe6621,0x00000,0x00000,0x00000,0x2592c,0x25927,0x00000,0x00000,
-0x25931,0x1715e,0x25929,0x17162,0x2592f,0x25926,0x25923,0x25932,
-0x1745b,0x17163,0x2592e,0x25924,0x17161,0x25928,0x17165,0x25925,
-0x2592a,0x17164,0x2592d,0x25930,0xe5233,0xe5234,0x00000,0x00000,
-0x25e38,0x25e39,0x25e29,0x25e30,0x25e2e,0x00000,0xe556d,0x17459,
-0x25e35,0x2592b,0xe556b,0x25e2c,0xe556e,0x25e36,0x17458,0x25e2b,
-0x25e2a,0x25e34,0x25e31,0x25e33,0x00000,0x25e27,0x25e37,0x17456,
-0xe5570,0x25e32,0x25e3b,0x25e2f,0x1745a,0x17457,0x25e2d,0x25e28,
-0x25e3a,0x1715f,0xe5571,0x00000,0x00000,0x00000,0x00000,0x00000,
-0xe556f,0x2624f,0xe5850,0xe584e,0x2624d,0x26253,0x1767a,0x26251,
-0x26250,0x1767c,0x26256,0x1767b,0xe5851,0x26257,0x26254,0x17678,
-0x26255,0x2624e,0x17679,0x17677,0x26635,0x26252,0xe584c,0xe6622,
-0x26258,0x00000,0xe6623,0x26632,0xe5a6f,0xe5a6e,0x00000,0x1785d,
-0x1785b,0x26634,0x00000,0x26636,0x26633,0x1785c,0x17859,0x1785a,
-0x1785e,0x00000,0xe6624,0x17a25,0xe5c66,0x26957,0x00000,0x26956,
-0x26954,0x26953,0x26955,0xe5c65,0x17a24,0x17a26,0xe6625,0x00000,
-0x17a7b,0xe5e4c,0x00000,0x26b73,0x26b72,0x00000,0xe5e4b,0x26d68,
-0xe5f58,0x26d6a,0x26d6c,0x26d6b,0x26d69,0xe5f57,0xe603f,0x17b6d,
-0x17b6c,0x00000,0xe603e,0x17c3f,0x17c3e,0x17c40,0x26f3c,0x26f3b,
-0xe6626,0x2712b,0x27046,0x2712c,0x17d25,0xe6144,0x17d26,0x2715c,
-0x00000,0xe623a,0x17d4b,0x1484d,0xe2a49,0x22848,0xe2a48,0xe2e52,
-0x22c66,0x22c67,0x22c65,0xe2e54,0xe2e53,0x15276,0x00000,0x22c68,
-0x22c69,0x22c6a,0x00000,0xe3331,0x2316b,0x23171,0xe332e,0xe3330,
-0x2316f,0x1573e,0x2316d,0xe3332,0x2316e,0x23170,0xe332d,0x00000,
-0x00000,0x2316c,0x15c4e,0xe377d,0x23823,0x15c50,0x23825,0x15c4f,
-0x23824,0xe377e,0xe3821,0xe383e,0xe3822,0x00000,0x23e6c,0x16135,
-0xe3e21,0x23e6e,0x23e6b,0x23826,0xe3e23,0x16136,0xe3e22,0xe3d7e,
-0x23e6d,0xe6627,0x00000,0x00000,0x00000,0x00000,0xe4358,0x2457b,
-0xe435c,0x1656b,0x24579,0x1656c,0x2457a,0x1656d,0x00000,0xe4862,
-0xe4861,0x16a32,0x24c68,0x24c65,0x24c67,0x16a33,0x16a34,0x24c66,
-0x00000,0x00000,0xe4d6f,0xe4d71,0xe4d6d,0x25267,0xe4d70,0xe4d73,
-0x25268,0xe4d72,0x16e36,0x2526a,0x25269,0xe4d6e,0x12323,0x00000,
-0x25936,0x25937,0x25933,0xe5237,0x25934,0x17166,0x17167,0x25935,
-0x00000,0x17461,0xe5575,0xe5574,0x1745d,0x17462,0x1745e,0x17460,
-0x1745c,0xe5239,0x1745f,0xe5855,0x00000,0x00000,0xe5854,0x1767d,
-0x25e3c,0x00000,0x26638,0x00000,0x26637,0xe6628,0x26958,0x17a27,
-0x17a28,0x26d6e,0x26b74,0xe6169,0x26d6d,0xe6040,0x2712d,0x27172,
-0x1484e,0x00000,0xe2722,0x14b37,0xe2a4b,0x22849,0x14f2b,0xe2a4a,
-0x15279,0x22c6d,0x15277,0x22c6b,0x1527c,0x15278,0x1527d,0x1527b,
-0x22c6c,0x1527a,0x15742,0x15741,0x2317c,0x1574a,0x23175,0x2317b,
-0x15746,0x23174,0x2317a,0x23178,0x15745,0x15747,0x23177,0x15740,
-0x23176,0x1574b,0x15748,0x1574c,0x15749,0x23173,0x23172,0x23179,
-0x15743,0x1573f,0x15744,0x00000,0xe3337,0xe333b,0x00000,0x00000,
-0x23835,0x2382e,0x00000,0x1613b,0x2382d,0xe3829,0x15c54,0x15c5b,
-0x15c58,0x15c5e,0x15c5d,0x15c59,0xe3826,0x23827,0x2382a,0xe3827,
-0x23829,0x15c55,0x2382b,0x23834,0x15c56,0x23828,0x23831,0x23832,
-0x15c57,0x2382f,0x15c5c,0x15c52,0x15c5a,0x2382c,0x15c51,0x23830,
-0xe382e,0xe3824,0x23833,0x00000,0xe382b,0xe3e34,0x23f21,0x23e76,
-0x16138,0x23e7d,0x23e7a,0x23e72,0x23e7b,0x1613a,0x23e73,0xe3e29,
-0x23e6f,0xe3e26,0xe3e2e,0x16573,0x23e78,0xe3e2f,0x16137,0x23e7e,
-0xe3e28,0x1613e,0x16140,0x23e71,0xe3e2c,0x00000,0x1613f,0x23e74,
-0x16139,0x23e7c,0x23e75,0x23e79,0xe3e2a,0x23e77,0x1613c,0x23e70,
-0x16141,0x15c53,0x1613d,0x16142,0xe3e24,0xe3e35,0xe3e33,0x00000,
-0xe4367,0x1656f,0x24624,0x24626,0x24628,0x2462c,0xe3e2b,0x24622,
-0x2457e,0x16571,0x00000,0x24627,0x2462b,0x24623,0x2457d,0xe4366,
-0x2457c,0xe4369,0xe4360,0xe4362,0x24629,0x24621,0x24625,0x16572,
-0xe435e,0x16570,0x2462d,0x1656e,0x2462a,0xe4364,0x24c79,0xe4368,
-0xe436a,0xe4363,0x00000,0x00000,0x16a37,0x24c71,0x16e43,0x24c7b,
-0x16a3a,0x24d21,0x16a40,0x24c6c,0xe4874,0x00000,0x24c7c,0x24c69,
-0xe486d,0x24c7e,0x24c6d,0xe486e,0x16a47,0x16a44,0x24c7d,0x24c77,
-0x16a36,0x16a3e,0x16a3d,0xe4870,0x16a3c,0x16a42,0xe4869,0x24c6a,
-0x16a43,0x24c78,0x16a3f,0x16a35,0x24c7a,0x16a38,0x16a39,0x16a41,
-0x24c6f,0x24c6e,0x24c6b,0x00000,0x24c73,0x24c70,0x24c74,0x16a46,
-0xe4868,0x24d22,0x16a3b,0x24c75,0x24c76,0xe4871,0x24c72,0xe4873,
-0xe6629,0xe486b,0x16a45,0xe662b,0x00000,0x00000,0xe4e22,0x2526f,
-0x16e3b,0x16e44,0x16e40,0x2526c,0xe4d7c,0x16e3d,0x16e41,0x25278,
-0x16e37,0x25270,0xe4d78,0x16e3f,0xe4e24,0xe4e2f,0x25273,0x2526e,
-0x16e3e,0x16e42,0x2526d,0xe4e2e,0x16e3c,0xe4d77,0x25277,0x16e39,
-0x25276,0x25275,0x16e45,0x2503b,0x16e38,0xe4e2b,0x25274,0x2526b,
-0xe4d75,0x16e46,0x25272,0x16e3a,0xe4e28,0xe4e29,0xe4e25,0xe4e2c,
-0xe4e27,0xe4d7e,0xe4d7d,0x25271,0x00000,0x00000,0x00000,0xe662a,
-0x1716a,0x1716f,0x17168,0x25944,0x2593b,0x25947,0x2593f,0x25945,
-0x17170,0x17169,0x25938,0x2593e,0x25948,0x25941,0x25946,0x2593a,
-0x00000,0xe523b,0x25942,0x1716b,0x25940,0x1716e,0x1716d,0x2593c,
-0x2593d,0x25939,0x25943,0x1716c,0x2594a,0x25949,0xe5240,0xe523f,
-0x00000,0x25e47,0x25e43,0x17469,0xe5579,0x25e3d,0x17463,0x17473,
-0x25e49,0x1746b,0x17467,0x25e40,0x1746e,0x17471,0x25e4b,0x17466,
-0x25e42,0x1746f,0x25e4d,0x25e4a,0x25e3e,0x1746a,0x17464,0x17472,
-0x25e45,0x1746d,0x25e3f,0x17468,0x25e4c,0x1746c,0x17465,0x25e46,
-0x17470,0x25e44,0x00000,0x00000,0x25e48,0xe557a,0x00000,0xe5859,
-0x2625a,0x26260,0x17725,0x26263,0x1767e,0x17721,0x2625b,0x26262,
-0x2625d,0x17726,0x17723,0xe585b,0x26259,0xe5858,0x17722,0x2625f,
-0x26261,0x17724,0x2625e,0x2625c,0xe662c,0x00000,0xe585a,0x00000,
-0x26642,0x17862,0x17863,0x1785f,0xe5a72,0x17860,0xe5a74,0x2663e,
-0x2663c,0xe5a75,0x26640,0x17864,0x26641,0x2663a,0x26639,0x2663d,
-0x2663b,0x17861,0x2663f,0x26959,0x17a2b,0x17a2a,0x2695a,0xe5c6c,
-0x2695c,0x2695b,0x17a2c,0x00000,0xe5e53,0xe5e50,0x26b79,0x26b76,
-0x26b77,0xe5e51,0x26b75,0x26b78,0x17a7d,0x26b7a,0xe5e52,0x17a7c,
-0x00000,0x26d6f,0xe5f5a,0x17c41,0x17c43,0x26f3d,0x17c42,0x27047,
-0x2712f,0x27131,0x2712e,0x27130,0x17d39,0x00000,0xe6235,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-/* 0x7f00 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x1484f,0x00000,
-0x1527e,0x23052,0x1574d,0xe3831,0x00000,0x15c5f,0x23f22,0x23f23,
-0xe662d,0xe4877,0x00000,0x2594b,0x17474,0x25e4e,0xe557d,0xe585c,
-0x17727,0x00000,0x26644,0x26643,0x17a2d,0x26b7b,0xe5f5b,0x26d70,
-0x17c64,0x22269,0x00000,0x00000,0x14f2c,0x14b38,0x00000,0x00000,
-0x22c6e,0xe2a4e,0x00000,0x23224,0x2317d,0x23223,0x23221,0x1574e,
-0x23222,0x2317e,0xe333c,0x23836,0x00000,0x23f24,0x23f25,0x24630,
-0x24631,0x16575,0x16576,0x2462f,0x24632,0x2462e,0x16574,0xe4878,
-0x16a48,0xe4879,0x16577,0x24d23,0x00000,0x16e47,0x25279,0x16e48,
-0xe4e30,0x17171,0x2594e,0x2594c,0x2594d,0x25e51,0x25e50,0x25e4f,
-0x00000,0x00000,0x00000,0x26645,0xe6422,0x17865,0x26646,0x26d71,
-0x17c65,0x27048,0x14850,0x14f2e,0x14f2d,0x22c70,0x15321,0xe2e5d,
-0x00000,0x22c6f,0x23226,0xe333d,0x1574f,0x23837,0x23225,0xe333f,
-0x00000,0xe333e,0x15c61,0x2383a,0x23838,0x23839,0x15c60,0x00000,
-0x23f27,0x23f28,0x23f26,0xe436e,0x1657a,0x24634,0x24633,0x24635,
-0x16579,0x16578,0x00000,0x00000,0x2527a,0x2527c,0xe4e31,0x16e49,
-0x2527b,0x2594f,0x17172,0x26265,0xe585d,0x26264,0x17866,0x26647,
-0x17868,0x17867,0x2695d,0x26b7c,0x17a7e,0x14851,0x22c71,0x15322,
-0x23229,0x15751,0x23228,0x23227,0xe3342,0x15750,0xe3343,0x23840,
-0x00000,0x23842,0x2383b,0x2383c,0x15c62,0x2383d,0x15c63,0x23841,
-0x2383e,0x2383f,0x15c64,0xe3e37,0x16144,0x16145,0xe3e38,0x23f29,
-0x00000,0x00000,0x00000,0x24636,0x24637,0xe4372,0x24d27,0x16a4b,
-0x16a49,0x16a4a,0x24d24,0x24d25,0x00000,0x24d26,0x25323,0xe4e32,
-0x25324,0x16e4a,0x25321,0x2527e,0x25322,0x2527d,0x17175,0x25950,
-0x17173,0x17174,0x25e53,0x17475,0x25e52,0x26134,0xe557e,0x26266,
-0x26267,0x17728,0xe5861,0x17729,0x17476,0x26648,0x26649,0x2695e,
-0x17a2e,0x14852,0xe667b,0x14853,0x15753,0x14f2f,0x15752,0x22c72,
-0xe3836,0x00000,0xe3344,0x16146,0x14854,0x15324,0x22c73,0x22c74,
-0x15323,0x15325,0x14855,0x00000,0x22c75,0x15755,0x2322a,0x15757,
-0x15754,0x15756,0xe3837,0x23845,0x15c65,0xe3839,0x23844,0x23843,
-0x00000,0x24638,0x00000,0xe4922,0x24d28,0x00000,0x16e4b,0x00000,
-0x17176,0x25952,0x25951,0xe5621,0x25e54,0x00000,0xe5862,0xe5c6f,
-0x26b7d,0x00000,0x00000,0x14856,0x22473,0x2284a,0x15326,0x22c76,
-0x00000,0x2322c,0x00000,0xe3349,0xe3348,0x15758,0x2322b,0x15759,
-0xe3347,0xe662f,0x00000,0x23847,0xe383d,0xe383c,0x15c67,0x23846,
-0x23848,0xe383b,0x15c66,0x00000,0x00000,0x00000,0xe3e3c,0x23f2b,
-0x23f2c,0x23f2a,0x16147,0xe6729,0x00000,0x00000,0x1657b,0xe4373,
-0x1657c,0xe6356,0x16a4d,0xe4923,0x24d2a,0x24d29,0x16a4c,0xe4926,
-0xe3e3b,0xe4925,0x00000,0xe6630,0x25325,0xe4e34,0xe4e36,0x25326,
-0xe4e37,0x00000,0xe4e35,0xe4e38,0x25953,0x00000,0xe5243,0x1747a,
-0x17479,0x17477,0x17478,0x1747b,0xe5622,0x26268,0x1772b,0x1772a,
-0x2664a,0x2695f,0xe5c70,0xe5c71,0xe5c72,0x17b6f,0x17b6e,0x14857,
-0x00000,0x00000,0x22f7d,0x00000,0x1657e,0x16148,0x1657d,0x16a4e,
-0x00000,0x14858,0x22168,0x14859,0x1485a,0xe2435,0xe2436,0x2284b,
-0x22476,0xe2724,0x22477,0x14b3a,0xe2726,0x22474,0x14b39,0xe2725,
-0x14b3c,0x22475,0x14b3e,0x14b3d,0x22478,0x14b3b,0x00000,0xe2723,
-0x00000,0x14f34,0x14f32,0x2284d,0xe2a56,0x14f31,0xe2a5b,0xe2a58,
-0xe2a4f,0x14f36,0x14f38,0x14f35,0xe2a59,0x22850,0x2284c,0x14f39,
-0xe2a52,0x14f33,0x14b3f,0xe2a54,0x14f37,0x2284f,0xe2a57,0x00000,
-0x2284e,0x00000,0x14f30,0xe6631,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x22c7c,0x1532a,0x1532b,0x22c7e,0xe2e66,0x22c78,
-0x22c7b,0x22d26,0x22d24,0xe2e60,0x1532c,0x22d2a,0x1532f,0x22d27,
-0x22c7d,0x22c7a,0xe2e61,0xe2e5e,0x23f2e,0x22d25,0x15327,0x22d28,
-0x22c77,0x22d22,0x15329,0x1532e,0x22d23,0x15332,0x15330,0xe2e65,
-0x22c79,0x1532d,0xe2e64,0x22d21,0x15331,0x15328,0x22d29,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x1575e,0xe334c,0x15767,
-0x1575c,0x1575a,0x2322e,0x15762,0x1575f,0x23230,0xe334a,0xe3352,
-0x15761,0x2322f,0x2322d,0x23232,0x15766,0x15764,0x23f2d,0xe334b,
-0x23233,0x23231,0x1575b,0xe334e,0xe334d,0x1575d,0x15760,0xe334f,
-0x15763,0xe2e63,0x15765,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0xe3e44,0x23852,0x15c69,0xe3849,
-0x23849,0x2384b,0xe3847,0x2384c,0x00000,0x23854,0x23850,0x2384e,
-0x00000,0x23851,0x23855,0x15c6a,0x15c6e,0x2384a,0x00000,0x23853,
-0xe632e,0x15c6c,0xe3841,0x15c6b,0x2384f,0x2384d,0xe3842,0x15c68,
-0x15c6d,0xe3845,0x00000,0x00000,0xe3848,0x00000,0x00000,0x00000,
-0x00000,0x1614e,0x23f36,0xe3e3e,0x00000,0x23f34,0x16150,0x00000,
-0xe3e43,0xe3e45,0xe3e41,0x23f2f,0x24646,0xe3e3d,0x1614f,0x23f33,
-0xe3e40,0xe3e42,0x23f30,0x1614b,0x16151,0x23f35,0x1614d,0x23f32,
-0x16a4f,0x1614c,0x23f31,0x16152,0x1614a,0x16149,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x2463e,0x2463c,0xe437b,0x24642,0xe437e,
-0x2463a,0x24647,0x2463f,0xe4375,0x24639,0x16624,0x1662a,0x24644,
-0x00000,0x2463d,0xe4376,0x16627,0xe4377,0xe4423,0x16625,0x24645,
-0x16622,0x16621,0x24640,0x16626,0x16153,0xe437c,0x24643,0x2463b,
-0x16623,0x16628,0x16629,0x00000,0x00000,0xe4422,0x00000,0x16a54,
-0x16a50,0xe4927,0x16a55,0x24d2d,0xe492a,0x00000,0x24d2c,0x24d2e,
-0x16a52,0x24d2b,0x16a53,0x24d31,0x24d30,0x24d2f,0x00000,0x16a51,
-0x00000,0x00000,0xe4e3b,0xe4e3d,0xe4e39,0x2532a,0xe4e3c,0x2532d,
-0x16e51,0x2532c,0x16e50,0x16e4c,0x16e4d,0x16e4e,0x25329,0x25328,
-0x16e4f,0xe4e3a,0x2532b,0x25327,0x00000,0x00000,0x25955,0x2595f,
-0x17179,0x17178,0xe5249,0x25959,0x2595b,0xe5247,0x25956,0xe5244,
-0x2595a,0x25954,0x2595d,0x17177,0x2595c,0x25958,0x00000,0x2595e,
-0xe5623,0x25957,0x1747e,0x25e55,0x25e5b,0x17524,0x17526,0x17523,
-0x17522,0x00000,0x17521,0x1747d,0x25e56,0x25e59,0x1747c,0x25e5a,
-0xe5624,0x17525,0x25e58,0x00000,0x25e57,0x1772c,0xe5865,0x1772d,
-0x2626b,0x26269,0x2626a,0x00000,0xe5a77,0x2664c,0xe5a78,0x2664b,
-0x17869,0x26961,0x17a2f,0x26960,0x00000,0x26b7e,0x26d72,0x17b70,
-0x27132,0x27133,0x17c44,0x1485b,0x00000,0x14f3a,0x23f37,0x16a56,
-0x17527,0x25e5c,0x1485c,0x00000,0x15769,0x15768,0x23f38,0xe3e47,
-0x00000,0x00000,0x25960,0x1485d,0x15333,0x00000,0xe3e48,0x23f39,
-0x23f3a,0x23f3b,0x16a57,0x1717a,0x1485e,0x00000,0x14f3b,0x22d2b,
-0x1576a,0x23234,0x15c6f,0xe3e49,0x23f3c,0x1662b,0x00000,0x16a58,
-0x1717b,0x17528,0x1772e,0x2664d,0x1485f,0x14f3c,0xe2a5d,0x00000,
-0x1576b,0x23856,0x16154,0xe492b,0x16a59,0x24d32,0x2532e,0x00000,
-0xe524a,0xe5868,0xe5a79,0x14860,0x16155,0x24648,0x16a5a,0x14861,
-0x22851,0x22d2c,0x15334,0x00000,0xe2e68,0x23236,0x00000,0xe3357,
-0x1576e,0xe3358,0x1576c,0x1576d,0x1576f,0xe3355,0x00000,0x23235,
-0x00000,0x00000,0x2385b,0x23858,0x2385a,0x15c70,0x15c72,0x15c71,
-0x23857,0x15c73,0x23859,0x00000,0x23f3d,0x23f3e,0x00000,0x23f3f,
-0x2464b,0xe4426,0x2464c,0x00000,0x2464a,0x2464d,0x00000,0x1662c,
-0xe6634,0x24649,0xe492d,0x16a5b,0xe492e,0x00000,0x25333,0x2532f,
-0x25332,0x25334,0x25331,0x25330,0x00000,0x25961,0x25962,0x25963,
-0x1717c,0x1717d,0x25e5e,0x25e5d,0x25e5f,0x00000,0x2626d,0x2626c,
-0x00000,0x2664f,0xe5a7a,0x26650,0x2664e,0xe5a7b,0x17a30,0x00000,
-0x26962,0x26963,0xe5e55,0x26d73,0x26f3e,0x27049,0x14862,0x14b40,
-0x00000,0x17529,0x14863,0x00000,0x2385c,0x23f40,0xe5a7c,0x17c6c,
-0x2226a,0x00000,0x00000,0xe2438,0x2226b,0x2226d,0x14864,0x2226e,
-0x2226c,0x00000,0x00000,0x22522,0x22523,0x2247b,0xe2728,0x00000,
-0x00000,0x00000,0x22521,0x14b42,0xe2729,0x14b43,0x2247c,0x2247a,
-0x22479,0x2247d,0x14b41,0x2247e,0x22d2d,0xe272b,0x00000,0x00000,
-0x22856,0x14f3f,0x22855,0x22857,0xe2a60,0x14f3e,0x2285c,0x14f42,
-0x22852,0x22860,0x22866,0x14f49,0x22863,0x14f46,0xe2a6b,0x22859,
-0x2285f,0x22861,0xe2a66,0x22854,0x14f45,0x14f40,0x2285a,0x14f47,
-0x14f4a,0x14f44,0xe2a6c,0x14f3d,0x2285e,0x22858,0x22865,0x14f4c,
-0x14f48,0x14f43,0x2285d,0x15770,0x2285b,0x14f41,0x14f4b,0x00000,
-0x22853,0x00000,0x22862,0x22864,0xe2a5e,0x00000,0x00000,0x00000,
-0x00000,0xe2a68,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0xe2e76,0x15345,0x1533f,0x15347,0x15344,0x22d34,0x22d37,0x15340,
-0xe2e6a,0x22d2e,0x00000,0x15339,0x15343,0xe2e6b,0x15346,0x15348,
-0x22d43,0x22d3a,0xe2e78,0x15338,0x22d42,0x1533c,0x1533a,0x15335,
-0x22d32,0xe2e72,0x22d41,0x22d36,0x22d39,0x22d46,0xe2e74,0x15349,
-0x22d40,0x15341,0x22d3b,0x22d45,0x22d38,0x22d3c,0x22d3f,0xe2e69,
-0xe2e6e,0x22d30,0x22d44,0x22d3e,0xe2e6f,0xe2e7a,0x22d2f,0x00000,
-0x22d33,0x15342,0x1533d,0x15336,0x1533b,0x15337,0x1534a,0x22d31,
-0x23247,0x1533e,0x00000,0xe2e79,0x22d3d,0x22942,0xe2e77,0x00000,
-0xe6635,0x00000,0xe6637,0x00000,0x00000,0x00000,0x2324a,0x1577e,
-0xe3362,0x2323a,0x00000,0x23245,0x23241,0xe384d,0x23254,0xe3359,
-0x2324c,0xe335f,0x23242,0xe385b,0x2324b,0x2323c,0x23240,0x23257,
-0x15823,0x2324f,0x23246,0x15771,0x23255,0x23238,0x00000,0x2324e,
-0x00000,0x15822,0x1577b,0x23237,0x15779,0x15778,0x1577d,0x2324d,
-0x15775,0x1577c,0x22d35,0x23f41,0x23248,0x00000,0xe2a5f,0x2323e,
-0x15821,0x2323f,0x23243,0x15824,0x23239,0x23251,0xe3e57,0x23250,
-0x23258,0x15777,0x15774,0x23256,0x23252,0x23249,0x23244,0x1577a,
-0x15776,0x2323b,0x15772,0x23253,0x15773,0x00000,0x2323d,0xe335a,
-0xe3363,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0xe6636,0xe2d33,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0xe384e,0xe3851,0x23862,0x23864,0x23869,0x2387d,0x15d23,
-0x15c77,0xe3854,0x23861,0x15d24,0x15d25,0x2386c,0x23873,0x23879,
-0xe3850,0x23866,0x00000,0x2386d,0xe384f,0xe385d,0x15d26,0x2387b,
-0x23876,0x15d21,0x15c7d,0x23872,0x2386e,0x23860,0x15c74,0x23865,
-0x2385d,0xe3855,0x15c7c,0x15c7e,0x2386a,0x23867,0x15c79,0x23877,
-0x15c76,0x23868,0x23f6a,0x23870,0xe385e,0x2386f,0x15c75,0xe3857,
-0x15d22,0xe3852,0x15c78,0x2385e,0x23863,0x23874,0x2387a,0x15d27,
-0x2385f,0x2386b,0x23871,0x15c7b,0x00000,0xe3858,0x2387c,0x23875,
-0x23878,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0xe385f,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x15c7a,0x00000,0x23f51,
-0x23f45,0x1615d,0x23f62,0x23f6b,0x23f6e,0x1615b,0x23f4d,0x23f66,
-0x23f4e,0x23f5c,0x16168,0x23f58,0x16165,0xe3e5e,0x23f59,0x23f42,
-0x00000,0x23f67,0xe3e4f,0xe3e59,0x1616e,0x23f64,0x23f5a,0x23f70,
-0x23f55,0x2466d,0xe3e4d,0x23f73,0x1616c,0x23f53,0x23f5f,0x1616f,
-0x1615a,0x23f57,0x23f71,0x23f50,0x23f49,0x23f54,0xe3e5f,0x23f48,
-0x23f46,0x16156,0x23f68,0x23f4f,0x23f6c,0xe3e4b,0x23f6d,0x1615e,
-0x16163,0x1615f,0x16167,0x23f63,0x16160,0x23f5b,0x23f4b,0x00000,
-0x16158,0x23f43,0x23f65,0x23f6f,0x23f4a,0x16166,0x23f74,0x23f56,
-0xe3e52,0x23f52,0xe3e5c,0x16157,0x1616b,0xe3e5a,0x23f61,0x1616d,
-0xe3e50,0x23f5d,0x16162,0x1615c,0x16164,0x16159,0x1616a,0x23f5e,
-0x23f4c,0x23f60,0x23f47,0x23f69,0xe3e58,0x00000,0xe3e5d,0xe3e56,
-0xe3e4e,0x00000,0x00000,0x23f72,0x00000,0x00000,0xe6639,0xe3e5b,
-0x00000,0xe6638,0x00000,0x23f44,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x2466c,0xe442d,0x24724,0x1655c,0x24671,0xe4431,0x2466f,
-0x2465a,0x16630,0x2466a,0x2467e,0x24666,0x16638,0x2467d,0x24664,
-0x16169,0x24674,0x24665,0x2467b,0x16637,0x1662f,0xe443a,0x2464f,
-0x24657,0xe4435,0x24670,0x24668,0x24723,0x2466b,0x1663d,0x2467c,
-0xe442c,0x16634,0xe443e,0x2466e,0x24676,0x2465b,0x24675,0xe4427,
-0x24728,0x24656,0x24677,0xe4433,0x24726,0xe443f,0x24650,0x16161,
-0xe4440,0x2465e,0x2465d,0x16636,0xe4432,0x24661,0x24663,0x24672,
-0x24725,0x16639,0xe4438,0x1663a,0xe4430,0x24655,0x16632,0x24659,
-0x24721,0x1663b,0x00000,0x16633,0x16635,0x1663c,0x24727,0x24678,
-0x24673,0xe443c,0xe442f,0x24660,0x2465f,0x16631,0x24651,0x1662e,
-0x24669,0x24652,0x24667,0xe442e,0x00000,0x2465c,0x24722,0xe442a,
-0xe4439,0x00000,0x1662d,0xe443b,0xe4428,0x00000,0x24658,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x24654,0x2467a,0x24653,
-0x16a68,0x24d5a,0xe4935,0xe4944,0x24d49,0xe4933,0xe4938,0x24d33,
-0x24d51,0x16a60,0x24d42,0x24d4c,0x16a63,0x24d45,0x16a61,0x24d36,
-0x24d54,0x24d35,0x24d48,0xe493c,0x24d34,0xe4939,0x00000,0x24d46,
-0x24d4f,0x24d4d,0x24d41,0x24d3c,0x24d3a,0xe4942,0x24d3b,0x24d4e,
-0x24d59,0x24d43,0x16a62,0xe493b,0x24d3e,0xe493a,0x24d52,0xe4941,
-0x16a65,0x24d3d,0x24d37,0x24d47,0x16a69,0xe4932,0x00000,0x16a5d,
-0x16a66,0x24d3f,0x24d39,0xe4936,0x16a5f,0x24679,0x16a5e,0x24d4a,
-0xe4436,0x16a5c,0x16a6b,0x16a64,0x24d4b,0x24d40,0x24d38,0x24d53,
-0x24d44,0x16a6a,0x24d57,0x16a67,0x24d56,0xe493f,0x24d50,0x24d55,
-0xe493e,0x00000,0xe4943,0x24d58,0x00000,0x00000,0xe663b,0x00000,
-0x00000,0xe663c,0xe663a,0x00000,0xe493d,0x00000,0x00000,0x2535c,
-0x2535d,0x25350,0x2534f,0x2534b,0x16e5d,0xe4e4f,0x16e55,0x2535f,
-0x2535e,0x2464e,0x25348,0x2534c,0x25346,0xe4e44,0x25359,0x2534a,
-0xe4e42,0x25360,0x25343,0x25341,0x2534d,0x25357,0x25352,0x16e5f,
-0x25338,0xe4e40,0x25356,0xe4e4c,0xe4e46,0xe4e54,0x16e60,0x24662,
-0x25344,0x2533b,0x2533e,0x25364,0x25345,0x2533c,0x2533a,0x25337,
-0x00000,0x16e59,0x2534e,0x16e58,0x16e5c,0x25349,0x25351,0x16e52,
-0x25361,0x25365,0x16e54,0xe4e4b,0x25340,0x25354,0x25358,0x2533d,
-0x25362,0x16e5b,0x00000,0x16e5a,0x25335,0x16e5e,0x2535b,0x2533f,
-0x25353,0x25339,0x25347,0x25342,0x16e56,0x16e57,0x25355,0x25366,
-0x25363,0x2535a,0x00000,0xe4e4d,0xe4e4e,0xe4e52,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x25336,0x00000,0x16e53,0x25974,0xe525a,
-0x2596b,0x2596e,0xe5252,0x17225,0x25970,0x25965,0x2596c,0x25972,
-0x17222,0x17226,0x1717e,0xe5259,0xe5250,0x25967,0x25977,0x00000,
-0x00000,0x25971,0x00000,0x25968,0x25a22,0x2597a,0x25964,0x25e72,
-0x2596a,0x17221,0xe5258,0x25975,0xe5254,0x25a21,0x17229,0xe5256,
-0x2597c,0x25969,0x2596f,0x25973,0x2596d,0x25a23,0x2597e,0x2597b,
-0x17223,0x17224,0x17228,0x25966,0x25a24,0x17227,0x25978,0xe524f,
-0xe5255,0x25976,0x00000,0xe663d,0x00000,0x25979,0x25f21,0x25e6c,
-0x25e71,0x25e7e,0x25e70,0x25e68,0x25e6d,0x00000,0x1752c,0xe562b,
-0x25e61,0x25e79,0x25e7b,0x25e60,0x1752b,0x25e7d,0x25e75,0x17532,
-0x25e7c,0x25e6e,0x17534,0x25e66,0x2597d,0x25e76,0x25e73,0x25e62,
-0x25f23,0x1752e,0xe5628,0xe5629,0x1752f,0x25e64,0x25e74,0xe562d,
-0x25f22,0x25e77,0x25e6a,0x17531,0x1752d,0x25e78,0x25e6b,0x25f24,
-0x25e65,0x25e6f,0x25e7a,0x25e67,0x25e69,0x00000,0x17535,0x25e63,
-0x17533,0x17730,0x1752a,0xe562c,0xe5630,0x00000,0x00000,0x17530,
-0x17734,0x2627d,0xe586c,0x26273,0x2626e,0x26274,0x2627e,0x26324,
-0x26323,0x17736,0x17735,0xe586e,0x00000,0x26275,0x26325,0x26278,
-0x26270,0xe586f,0x26272,0x26271,0x26277,0x2627c,0x2626f,0x26276,
-0x2627b,0x17733,0x00000,0x26279,0xe586b,0x17731,0x2627a,0x1772f,
-0x17732,0x26660,0x26321,0x00000,0xe663e,0x1786d,0xe5a7e,0x26658,
-0x2665c,0x26654,0x26657,0xe5a7d,0x2665f,0x1786b,0x26664,0x2665d,
-0x00000,0x26655,0x26665,0x2665e,0x1786e,0x1786f,0x26662,0xe5b22,
-0x26656,0x1786a,0x1786c,0x26651,0x26659,0x26653,0xe5c7b,0x26663,
-0x26661,0x26652,0x2665a,0x00000,0xe5b25,0xe663f,0x2696a,0x17870,
-0x2665b,0x17a32,0x17a34,0x17a31,0xe5c76,0x2696f,0x26967,0x26965,
-0x26969,0x26966,0xe5c78,0xe5c7c,0x2696b,0x2696d,0x17a35,0x17a37,
-0xe5d22,0x2696c,0x17a38,0x17a36,0x2696e,0xe5c7e,0x00000,0xe5d23,
-0xe5c77,0x17a33,0x00000,0xe5d21,0x00000,0xe5e5b,0xe5e5a,0x17b21,
-0x26c21,0x26c27,0x17b23,0x26968,0x26c26,0xe5e5c,0x26c2d,0x26c24,
-0x26c2b,0x26c2a,0x26964,0x26c25,0x26322,0x26c2e,0x26c23,0x26c28,
-0xe5e58,0x26c2c,0x26c22,0xe5e56,0x26d77,0x17b22,0x26c29,0xe5e57,
-0x00000,0x26f43,0x26d78,0x26d76,0x26d74,0x26d75,0x26d79,0xe6640,
-0x17c45,0x26f41,0x26f3f,0x26f44,0x26f42,0xe6043,0x26f45,0x17c46,
-0x26f40,0xe602f,0xe6146,0x2704a,0x00000,0xe6641,0x27134,0x27135,
-0x27136,0xe6147,0xe617c,0x27235,0x2722d,0x2226f,0x14f4d,0x00000,
-0x1534b,0x00000,0x2325a,0x23259,0x15825,0x15d28,0x23921,0xe3863,
-0xe3860,0x2387e,0xe3861,0x16170,0x1663f,0xe3e61,0x1663e,0x16640,
-0x00000,0x24d5b,0x25367,0x25a25,0x25a27,0x25a26,0x00000,0x17536,
-0x25f25,0x26326,0x27173,0x14865,0xe272d,0x22869,0x2286a,0x22868,
-0x22867,0x14f4e,0xe6642,0x22d4a,0x22d48,0xe2f23,0xe2e7c,0x22d47,
-0xe2e7e,0x1534c,0x1534e,0x1534d,0x22d49,0xe2f24,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0xe3369,0x23266,0x23263,0x23261,
-0x00000,0xe336c,0x15826,0x23264,0x1582b,0x2325e,0x2326d,0xe336f,
-0x2326f,0x2325f,0xe336e,0x15828,0x23270,0x2326b,0x2325d,0x23262,
-0x2326c,0x23268,0x23265,0xe336b,0x1582d,0x2326e,0x23260,0xe336a,
-0xe3370,0x23269,0x2325b,0x1582c,0x15829,0x23267,0xe336d,0x2326a,
-0x2325c,0x1582a,0x15827,0x00000,0x00000,0x00000,0xe3866,0x15d32,
-0x23928,0x15d31,0xe3864,0x2392b,0x2392e,0x15d2e,0x15d2c,0x23923,
-0x2392c,0x2392a,0x23927,0x2392f,0x23930,0x23932,0x23933,0x23922,
-0x15d2b,0x23925,0x23924,0x23931,0x15d2d,0x23926,0x15d2f,0x15d2a,
-0x23929,0x15d33,0x00000,0x15d30,0x2392d,0x00000,0x00000,0x00000,
-0x16177,0x24025,0x00000,0x23f78,0x16174,0xe3e62,0x2472e,0x24023,
-0x23f75,0x16172,0x23f7a,0x16175,0x23f7e,0x23f7c,0x16178,0x16171,
-0x00000,0xe3e63,0x23f76,0x23f79,0x16176,0x00000,0x23f77,0x00000,
-0x24024,0x24022,0x23f7b,0x23f7d,0x24021,0x16173,0xe3e68,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x2472f,0x24735,0x2472b,
-0x24731,0x16641,0x2472d,0x16647,0xe4444,0xe4445,0x16646,0xe4449,
-0x16645,0x24734,0x16648,0x16649,0x2472a,0x24737,0x1664a,0x16644,
-0x16643,0x24733,0x1664b,0x24729,0x2472c,0x24736,0x24732,0x00000,
-0x00000,0x24d7b,0x24d70,0x16642,0x00000,0xe4446,0xe4448,0x00000,
-0x16a72,0x24d64,0x24d79,0x24d65,0x16a6d,0xe494f,0x24d62,0x00000,
-0x24d6b,0x24d63,0x16a6f,0x24d5d,0x24d78,0x16a70,0x24d75,0x24d76,
-0x24d5e,0x16a75,0x24d6d,0xe494a,0x24d67,0x24d6e,0x24d61,0x00000,
-0x24d7a,0x24d72,0x24d6c,0x24d5c,0x16a71,0x24d73,0xe4945,0x16a74,
-0x24d77,0xe494c,0x24d71,0x16a6e,0x24d6f,0xe4949,0x24d69,0x16a6c,
-0x24d60,0x24d68,0x24d74,0x24d66,0x00000,0xe494e,0x24d6a,0xe494b,
-0x00000,0x00000,0xe6643,0x00000,0x16e6a,0x24730,0x25379,0x25424,
-0x25378,0x25374,0x25371,0x16e6b,0x2536f,0x16a73,0x25368,0x16e69,
-0x2536e,0x16e68,0x25373,0x25370,0x25422,0x2537b,0x25375,0x2537a,
-0x16e64,0x25372,0x25427,0x25369,0x2536a,0x25423,0x16e65,0x25428,
-0x16e67,0x25429,0x25377,0x24d5f,0x2537d,0x25376,0x25421,0x2537c,
-0x00000,0xe4e5d,0x00000,0x2536d,0x16e62,0x25426,0x16e63,0x2536b,
-0x16e66,0x25a32,0x2537e,0x25425,0x00000,0xe4e59,0x00000,0x00000,
-0x00000,0x25a2f,0x16e61,0x1722a,0x25a39,0x25a35,0x00000,0x25a33,
-0x25a2e,0x25a3d,0xe525b,0xe525d,0x00000,0x1722e,0xe525f,0x25a2a,
-0x25a36,0x25a37,0x25a2d,0x25a2c,0x25a3a,0x00000,0x25a30,0x25a2b,
-0x25a31,0xe5262,0x25a3c,0x25a29,0x25a3b,0x25a38,0x1722c,0x1722b,
-0x00000,0xe525e,0x1722d,0x25a34,0x25a28,0xe6645,0x00000,0x00000,
-0x00000,0xe6644,0x25f27,0x1753c,0x25f2b,0x25f28,0x25f2f,0x25f35,
-0x25f2a,0xe563a,0x25f3e,0x17539,0x25f38,0x25f2d,0x25f39,0x25f34,
-0x25f3b,0x25f2c,0x1753e,0x1753d,0x25f2e,0x25f3c,0x25f26,0x25f3a,
-0x17537,0xe5639,0x25f32,0x25f31,0x25f36,0x25f29,0x1753b,0xe563b,
-0x1753f,0x25f30,0x25f37,0x17540,0x25f33,0xe5636,0xe5634,0x00000,
-0x00000,0x17538,0x1753a,0x26333,0x26331,0xe5b28,0xe5876,0x26337,
-0x26335,0x26338,0xe5878,0x2632a,0x26332,0x2633c,0x25f3d,0x2632e,
-0x1773a,0x2536c,0x26329,0x26336,0x26330,0x2632d,0x26328,0x26327,
-0x2633b,0xe5873,0x2632c,0x2632b,0x17738,0x26334,0xe5874,0x17737,
-0xe5875,0x00000,0x17739,0x2632f,0x2633a,0xe6646,0x26669,0x2666a,
-0xe5b2c,0x17874,0x26667,0x17871,0x2666f,0xe5b27,0x17875,0x26671,
-0x26666,0x26339,0x26673,0x26668,0x00000,0x17872,0x2666e,0xe5b29,
-0x26670,0x2666b,0x26672,0x2666d,0x2666c,0x17873,0xe5877,0xe5b2b,
-0x26971,0x26972,0xe5d25,0x26974,0x17a39,0x17a3a,0x26975,0x26973,
-0xe5d24,0x26970,0xe5e5d,0x26c31,0x26c34,0x26c30,0x00000,0x17b27,
-0x26c32,0x17b26,0x17b25,0x17b24,0x26c33,0x26d7e,0x26d7c,0xe5f5f,
-0x26d7b,0x26c2f,0x26d7d,0x26c35,0x26d7a,0xe6045,0x26f48,0x26f26,
-0x26f46,0x17c47,0x26f47,0x26f49,0xe6647,0x2704d,0x17c66,0x2704c,
-0x2704b,0x17c67,0x00000,0x17d27,0x2715d,0x27175,0x27174,0x27176,
-0x14866,0x22d4b,0xe2f26,0x23271,0x23272,0xe386a,0xe3e6a,0xe3e69,
-0x24026,0x00000,0x26c36,0x2704e,0x14867,0x1534f,0x22d4c,0xe3371,
-0xe6648,0x00000,0x23934,0x15d34,0x00000,0x24028,0x24027,0x16179,
-0xe444d,0x1664c,0x2542a,0x16e6c,0xe4e5f,0x16e6d,0xe5263,0xe5264,
-0x00000,0x1722f,0x17c68,0x14868,0x00000,0x00000,0xe2f27,0x22d4d,
-0x14f50,0x22d4f,0x22d4e,0x15350,0x00000,0x23273,0xe3374,0x2327a,
-0x1582e,0x23278,0x23276,0xe3377,0x2327d,0x23274,0x23275,0x1582f,
-0xe3372,0x15833,0xe3373,0xe3375,0x2327e,0x15832,0x2327c,0x23279,
-0x23277,0x15830,0x15831,0x2327b,0xe3376,0x00000,0x00000,0xe6649,
-0x15d36,0x23935,0xe3872,0x15d3b,0x23945,0x15d3a,0x23947,0xe386e,
-0xe3874,0x2393b,0x15d38,0x23946,0xe386c,0x23936,0x15d39,0x23942,
-0x2393e,0x23940,0x2393a,0x23941,0xe386b,0x00000,0x15d35,0x2393d,
-0xe3873,0x2393c,0x23938,0xe386d,0x23943,0xe386f,0xe3871,0x2393f,
-0x23937,0xe3870,0x23939,0x15d37,0x23944,0x00000,0x00000,0x00000,
-0x00000,0x1617c,0x24033,0x00000,0xe3e70,0xe3e72,0x2402f,0x24031,
-0x2402c,0x2402b,0x24029,0xe3e6d,0x24030,0x24032,0x2402e,0xe3e6f,
-0x2402d,0x1617a,0x1617b,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x24035,0x16654,0x24739,0x2473f,0x2473a,0x2473b,0xe444e,
-0x24740,0x00000,0x16656,0x00000,0x1664e,0x16655,0x24738,0x2402a,
-0x16651,0x1664f,0x2473e,0x2473d,0x16650,0x16652,0x2473c,0x1664d,
-0xe444f,0x16653,0x00000,0x00000,0x00000,0x00000,0xe4e60,0x24d7d,
-0x16a7c,0xe4959,0xe4952,0x24e2a,0x24e29,0xe4957,0x24e24,0x16a7e,
-0x24e28,0x24d7e,0x24e21,0x16a76,0x16a78,0xe4954,0x24e26,0x24d7c,
-0x16a7a,0x16a79,0x24e22,0x24e27,0x24e25,0x16a7b,0x24e23,0xe4951,
-0xe4956,0x24034,0x16a77,0xe4958,0x00000,0x2542b,0x25432,0x16e6f,
-0x00000,0x25436,0x16e73,0x2542e,0x2542c,0x00000,0x25435,0xe4e61,
-0x16e6e,0x25434,0x16e70,0x16e71,0x2542d,0x16e72,0x25433,0x2542f,
-0x25430,0x25431,0x16a7d,0xe4e62,0x00000,0x00000,0x25a3e,0x25a4a,
-0x00000,0x17234,0x25a45,0x25a47,0xe5265,0x17232,0x25a3f,0x25a43,
-0x00000,0x25a46,0x17230,0x17233,0x25a49,0x25a41,0x25a42,0x25a48,
-0x25a40,0x25a44,0x17231,0x25f40,0x00000,0x25f3f,0x17542,0x25f45,
-0x17544,0xe5640,0x00000,0x17541,0x25f41,0x17545,0x25f42,0xe563f,
-0xe563d,0x25f43,0x25f46,0xe5642,0x17543,0x00000,0x26341,0x00000,
-0xe5879,0x26344,0xe587a,0x2633e,0x26340,0xe587c,0xe587b,0x2633f,
-0x26342,0x26343,0x25f44,0x2633d,0xe664a,0x00000,0x17878,0x26677,
-0x2667a,0x2667c,0x26675,0x26676,0x26679,0x2667b,0x17879,0x17877,
-0x17876,0x26678,0x26674,0x26976,0x17a3b,0xe5d29,0x26977,0xe5d28,
-0x00000,0x26c38,0x17b28,0x26c3a,0x17b29,0x26c37,0x26c39,0x17b72,
-0x00000,0x26e21,0x17b71,0x26f4c,0x26f4b,0x00000,0x26f4a,0x00000,
-0xe6149,0x27137,0x27138,0x2713a,0x27139,0xe617d,0x22270,0x14869,
-0x00000,0x15351,0x23948,0x1617d,0xe664b,0x24741,0x1773b,0xe5b2f,
-0x2667d,0xe6046,0xe614a,0x14b44,0xe2f29,0x00000,0x00000,0x15d3d,
-0x00000,0xe3876,0xe3875,0x15d3c,0xe3877,0x24036,0x1617e,0x24038,
-0x24037,0x00000,0xe3e74,0x24742,0x16657,0x24e2b,0x24e2e,0x24e2d,
-0x00000,0x24e2c,0x25437,0x25439,0x25438,0xe4e65,0x17236,0xe5266,
-0x00000,0xe4e64,0x17235,0xe5646,0x17546,0x25f47,0x25f49,0x25f48,
-0xe587e,0xe587d,0x1773c,0xe5921,0x00000,0xe5b31,0x26721,0x2667e,
-0x00000,0x26978,0x17a3c,0xe5d2a,0xe5e61,0x17b2a,0x26e23,0x26e22,
-0x17d28,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x14b45,0x22d50,0x15352,0x2394b,0x23949,0x00000,
-0x00000,0x2394a,0x2403a,0x2403b,0x24749,0x24039,0x00000,0x24743,
-0x24747,0x24746,0x24748,0x16658,0x24745,0x24744,0x2474a,0xe4454,
-0x24e31,0x24e2f,0xe495c,0x24e30,0x2543c,0x2543a,0xe4e66,0x00000,
-0x2543b,0x25a4b,0x25f4a,0x25f4b,0x1773d,0xe5b32,0x26722,0x26979,
-0x17a3d,0x00000,0x26c3b,0x26e24,0x17b73,0x00000,0x26f4d,0x2713b,
-0x14b46,0x00000,0x15354,0x15355,0x22d51,0xe2f2a,0xe2f2c,0x22d52,
-0x15353,0x00000,0x15839,0xe337b,0x15837,0xe337a,0x15836,0x1583d,
-0x15835,0x1583e,0x23321,0x1583b,0x00000,0x15838,0x1583c,0x1583a,
-0x15834,0xe337c,0x00000,0x15d45,0xe387e,0x15d3f,0x2394f,0x15d44,
-0xe3923,0xe3929,0x15d46,0x15d40,0x00000,0x15d41,0xe3879,0x2394d,
-0xe387b,0xe3925,0x15d3e,0xe3922,0x2394e,0x15d43,0xe6330,0x00000,
-0x2394c,0x15d42,0xe387a,0x00000,0x1622b,0xe3e7c,0x1622d,0x00000,
-0xe3e7d,0x2403e,0x1622c,0x16221,0x16225,0xe3f24,0x1666b,0x2474f,
-0x24040,0x16226,0xe3e7e,0xe3e75,0x24043,0x24044,0x1622a,0x00000,
-0x24046,0xe3f21,0x24048,0xe3f23,0x24049,0x2403d,0x2403c,0x2404a,
-0x16229,0x24047,0x24045,0x00000,0x16227,0x16223,0x1622e,0x24041,
-0x24042,0x2403f,0xe3e78,0x16228,0x00000,0xe3f22,0x16224,0x00000,
-0x16222,0x2474e,0x16666,0x16661,0xe4460,0xe4459,0x1665c,0xe4463,
-0x1666c,0x1665d,0xe4455,0x16659,0x16668,0x16665,0x16667,0xe4458,
-0x1665e,0x16663,0x1665a,0x1665b,0x24756,0x24753,0x2474b,0x24750,
-0xe445b,0x16669,0x24757,0x1666a,0x16660,0xe445c,0xe4461,0x2474d,
-0xe4456,0x24755,0x24751,0x24754,0x24752,0x16664,0x2474c,0x1665f,
-0xe445d,0x00000,0x00000,0x24e34,0x16b22,0x16b25,0xe495f,0x24e36,
-0xe4964,0x16b2d,0x24e35,0x16b27,0xe4963,0x16e78,0x24e37,0x00000,
-0x16b2c,0x24e33,0x16b2e,0xe495e,0xe4962,0xe496b,0x16b23,0xe4968,
-0x16662,0x16b26,0xe4960,0x16b24,0x16b28,0x16b2a,0x16b21,0x16b2f,
-0x16b2b,0xe4965,0x16b29,0x24e32,0xe4966,0x00000,0x00000,0xe4e74,
-0x16f21,0xe4e67,0x16e7b,0xe4e72,0xe4e70,0xe4e6e,0x16f24,0xe4e6c,
-0x2543f,0x16f25,0x2544b,0x25444,0x16e74,0x2544c,0x25446,0x16e7e,
-0x25447,0xe4e73,0x16e7d,0x2544a,0x16e77,0x25448,0x2543e,0x16e76,
-0x25a56,0x16e7c,0xe4e75,0x16e79,0xe4e69,0x16f23,0xe4e6a,0x2543d,
-0xe4e76,0x25441,0x16e75,0x25440,0x25442,0x25443,0x16f22,0x25445,
-0x25449,0x2544d,0x00000,0x16f26,0x1723c,0x25a51,0x25a57,0x25a54,
-0x25a4c,0x25a58,0x25a4d,0xe526a,0x25a53,0xe526b,0x17237,0x1723d,
-0x25a59,0xe4e6f,0xe5267,0x17239,0xe526e,0x17243,0x1723e,0x25a5b,
-0x25a55,0x1723a,0x25a4e,0x17244,0x25a4f,0x25a50,0x17245,0x17242,
-0x16e7a,0xe5269,0x17238,0x25a5c,0x17246,0xe5268,0x1723f,0x25a5a,
-0x1723b,0x17240,0x17241,0xe664c,0x1754e,0x25f50,0x25f59,0x25f56,
-0x25f58,0xe5649,0x1754b,0x25f51,0xe564a,0x25f57,0x17547,0x25f53,
-0x1754f,0x25f4f,0x25f54,0x25f5b,0x25a52,0x25f55,0x25f4e,0x17548,
-0x25f4d,0x17549,0x25f5c,0x1754a,0x25f5a,0x1754d,0x25f4c,0xe5648,
-0x1754c,0x00000,0x25f52,0x26347,0x26355,0x26350,0x26352,0x26346,
-0x1773e,0xe592a,0x26345,0x17741,0x17740,0xe5926,0x26354,0x2634c,
-0x26349,0x2634f,0xe5924,0x26348,0xe5928,0x2634a,0x26353,0x26351,
-0xe5923,0x1773f,0x26358,0x26356,0x2634d,0x26357,0x2634e,0xe5b34,
-0x26726,0x1787a,0x2672d,0xe5b35,0x00000,0x26c3e,0x17923,0x2634b,
-0x26724,0x1787d,0x26725,0x2672a,0xe5b36,0xe5d33,0x17921,0x17922,
-0x26723,0x2672c,0x2672e,0x26727,0x26729,0x2672b,0x26728,0x2672f,
-0x1787c,0x17924,0x1787e,0x00000,0x1787b,0x2697c,0x00000,0x17a42,
-0x2697a,0xe5d30,0xe5d2c,0x2697e,0xe5d32,0x26a21,0x17a40,0x26a22,
-0x2697d,0xe5d2b,0x2697b,0x17a43,0x17a3f,0x26a23,0xe5d2e,0x17a41,
-0x17a3e,0xe5c6d,0x00000,0xe642d,0x17b2b,0xe5e62,0x00000,0x17b2c,
-0x26c3d,0x26c3c,0x26c3f,0x26c40,0xe5e63,0x17b2d,0x26e25,0x26e2a,
-0x17b74,0xe5f61,0x26e27,0xe5f62,0x26e26,0x26e29,0x26e28,0xe6048,
-0x26f51,0x00000,0x17c48,0x26f50,0x26f4e,0xe6047,0x26f4f,0x00000,
-0xe6049,0xe607b,0x17c6a,0x17c69,0x2704f,0x27050,0x17c6b,0xe614b,
-0x2713c,0x2713d,0x17d34,0xe616b,0x17d3a,0xe617e,0x27177,0x27236,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-/* 0x8c00 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x14b47,
-0x00000,0x23950,0xe392a,0x23951,0x24758,0x24e38,0x2544e,0x17551,
-0xe564d,0x17550,0x26359,0x26730,0xe5f64,0x26f52,0x14b48,0x23322,
-0x1583f,0x15d47,0x2475a,0x24759,0x16f27,0x2544f,0x16f28,0x25f5d,
-0x17742,0xe5d34,0xe664d,0xe6221,0x17d43,0x14b49,0x2286b,0x23323,
-0xe392d,0x00000,0x15d48,0xe392c,0x23952,0x23953,0xe3f2a,0x2404b,
-0xe3f29,0x1622f,0x1666d,0xe4464,0x2475c,0x2475b,0x2475d,0xe496d,
-0x24e39,0x24e3a,0x16b30,0x17247,0x16f29,0x17248,0x00000,0x25f61,
-0x25f5e,0x25f60,0x25f5f,0x17552,0xe592b,0x2635a,0x26732,0x26731,
-0x22524,0x15841,0x15840,0x23324,0xe392e,0x23954,0xe3f2c,0xe3f2b,
-0x2404d,0x2404c,0x16230,0xe3f2d,0x2475f,0x24760,0x2475e,0xe634a,
-0xe4465,0x1666f,0x1666e,0x00000,0x16b32,0x16b31,0xe4e7a,0x25450,
-0x25a5f,0x25a5d,0x25a5e,0x17249,0x25f63,0x25f62,0xe564f,0x2635d,
-0x2635c,0x2635b,0x26733,0xe614d,0x27178,0x14b4a,0x15356,0xe2f2e,
-0x15357,0x15842,0x15843,0x23326,0x23325,0x23955,0xe3930,0x15d4e,
-0x15d4c,0x15d49,0x15d4d,0x15d4b,0x15d4a,0xe3932,0xe3931,0x16231,
-0x24050,0xe3f2f,0x16674,0x16233,0x16238,0x24052,0x1623a,0x16239,
-0x1623c,0x24051,0x2404e,0x16236,0x16232,0x16234,0x2404f,0x1623b,
-0x16237,0x16235,0x16676,0x16675,0x16673,0x16677,0x00000,0x16671,
-0x16672,0xe4469,0x16670,0x00000,0x24761,0xe4467,0x00000,0x24e3c,
-0xe4970,0x16b34,0x16b35,0x16b33,0xe4972,0x24e3b,0xe4971,0x24e3d,
-0xe664e,0x25453,0x25455,0xe4e7e,0x16f32,0x25456,0x16f2b,0x25452,
-0x16f2a,0x16f34,0x16f30,0x16f31,0x16f2d,0x25451,0x16f2c,0x25457,
-0x25454,0xe4e7d,0x16f33,0xe4f22,0x16f2e,0x16f2f,0x25a61,0xe5275,
-0x25a63,0x25a62,0xe5273,0x25a64,0x1724a,0x25a60,0xe5651,0xe5652,
-0x17556,0x25f64,0x17553,0x17557,0x17555,0x17554,0x2635e,0x00000,
-0x26361,0x00000,0x26360,0xe592e,0x2635f,0x17743,0x26734,0x26735,
-0x17925,0x26736,0x17926,0xe5b38,0xe664f,0x17a45,0xe6428,0x17a44,
-0x26c41,0xe5e65,0xe5e66,0x17b2e,0x26c42,0x26e2b,0x17b75,0x17b76,
-0xe6650,0x26f53,0xe604a,0x17c6d,0xe614e,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x14b4b,0xe3933,0x15d50,0x15d4f,
-0x24762,0x24763,0x00000,0x16b36,0x25a65,0x16f35,0x25a66,0x25f65,
-0x14b4c,0xe243a,0x22d53,0x15359,0x15358,0x00000,0x23327,0x15844,
-0x23328,0x23958,0xe3939,0x23957,0xe3937,0x23956,0xe3935,0xe3938,
-0x24054,0x1623f,0xe3f39,0xe3f34,0x24053,0x1623e,0xe3f37,0xe3f30,
-0xe3f33,0x24055,0x1623d,0xe3f38,0x24765,0x24768,0x24766,0x24767,
-0x2476b,0x24764,0x2476c,0x24769,0x2476a,0x16b38,0x24e3e,0xe4975,
-0xe4973,0x16b37,0xe4974,0x2545b,0x25459,0xe4f26,0x00000,0x16f36,
-0x25458,0x2545a,0xe4f25,0x16f37,0xe4f23,0x25a67,0xe5277,0x25a68,
-0x17558,0xe5931,0x26738,0x2673a,0x26737,0x26739,0x26a24,0x26c43,
-0xe6651,0x00000,0x2715e,0x14b4d,0x1535a,0x23329,0x2332b,0x2332a,
-0x00000,0x2395b,0x15d52,0xe393e,0x23959,0xe393a,0x15d51,0x2395c,
-0xe393d,0x2395d,0x2395a,0x00000,0x00000,0x24061,0x16247,0x24059,
-0x2405f,0xe3f3f,0xe3f3a,0x16242,0x16245,0x24058,0x16240,0x2405c,
-0x24772,0x16244,0xe3f3b,0x24057,0xe3f3e,0x2405d,0x2405a,0x24060,
-0x24056,0x2405e,0x16243,0x16246,0x2405b,0x16241,0x00000,0x16679,
-0x2476e,0x16678,0x24775,0x24774,0x16721,0x00000,0x16722,0x24776,
-0x1667a,0x24773,0x1667e,0x24778,0x2476f,0xe446b,0x24771,0x1667b,
-0x2476d,0x24770,0x24777,0x1667c,0x24779,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x1667d,0x00000,0x16b39,0x24e43,0x24e49,0x24e41,
-0x24e4a,0xe497b,0x24e40,0x24e45,0x24e4b,0x24e48,0x24e47,0x24e46,
-0xe497a,0x24e3f,0x24e44,0xe4979,0x00000,0x24e42,0x00000,0x16f3c,
-0x16f39,0x25464,0x25469,0x2546b,0x25468,0x25461,0x25463,0x2546d,
-0x2546a,0x25465,0x2546e,0x25462,0x2546c,0x16f3a,0x16f40,0x16f3e,
-0x2545c,0x16f3f,0x16f3b,0x2545d,0x2545f,0x2545e,0x25466,0x25467,
-0xe4f2c,0x16f3d,0xe4f2b,0x16f38,0x00000,0x00000,0x25460,0x00000,
-0x25a72,0x1724c,0xe527e,0x25a69,0x1724d,0x17250,0x25a6e,0x00000,
-0x25a6b,0x1724f,0x00000,0xe527b,0x25a6f,0x25a70,0x25a6a,0x25a73,
-0x25a6c,0x25a71,0x1724e,0xe527c,0x1724b,0x25a6d,0xe5654,0x25f6b,
-0x1755b,0x17559,0x1755c,0x1755a,0x25f6a,0x25f67,0x25f66,0xe5655,
-0x25f69,0x00000,0x00000,0x25f68,0x2636f,0x17749,0x26366,0x26365,
-0xe5932,0x17744,0x2636b,0x2636a,0x26362,0x2636d,0x26367,0x17748,
-0x26364,0x2636c,0x26363,0x17745,0x17747,0x26368,0x17746,0x26369,
-0xe5b3a,0x2636e,0x2673e,0xe5b39,0x1792b,0x2673b,0x00000,0x2673f,
-0xe5b3b,0x00000,0x17928,0x2673d,0x1792d,0xe5b3c,0x1792a,0xe5b3d,
-0x2673c,0x00000,0x1792c,0x26740,0x17927,0x00000,0x00000,0x00000,
-0x00000,0x17a47,0x17a49,0xe5d37,0x26a27,0x17a48,0x26a25,0x17929,
-0x26a26,0x17a46,0x17b2f,0x17b31,0x26c45,0x17b30,0x26c44,0x00000,
-0x26e30,0x17b77,0x26e2f,0x17b78,0x26e2d,0x26e2c,0x26e31,0x26e32,
-0x26f54,0xe604b,0x26e2e,0x00000,0x00000,0x27054,0x27051,0x27052,
-0x27053,0x17d29,0xe6150,0x27140,0x2713f,0x2713e,0x2715f,0xe616c,
-0x2722e,0x27179,0x17d3b,0x14b4e,0x15845,0xe393f,0x00000,0xe3940,
-0xe3f40,0xe4473,0x16723,0xe497d,0xe497c,0x00000,0xe4f30,0xe4f32,
-0xe4f2f,0xe4f31,0x16f41,0x00000,0xe6652,0x25a74,0x00000,0xe5935,
-0x1774a,0xe5936,0x26741,0xe5b3f,0x00000,0x00000,0xe5d38,0x00000,
-0x00000,0x2717a,0x14b4f,0x14f51,0x1535c,0x1535b,0x00000,0x15848,
-0x00000,0x2332c,0x15846,0x2332d,0x15847,0xe6653,0xe3941,0x23962,
-0x2395e,0xe3947,0x00000,0x15d53,0x23961,0x23960,0x2395f,0x15d54,
-0x23963,0x23964,0x00000,0x00000,0xe3f45,0x24068,0x24066,0x2406a,
-0x2406b,0x24071,0xe3f47,0x2406d,0x2406f,0x00000,0x24067,0x24062,
-0x00000,0x2406e,0xe3f44,0xe3f46,0x24070,0x24069,0x2406c,0x24063,
-0x16249,0x24065,0x24064,0x16248,0x1624a,0xe3f49,0x16726,0x2477b,
-0x2477d,0x2477c,0x24823,0x16724,0xe4476,0x2477e,0x2477a,0x24821,
-0x24822,0x16725,0x16727,0x24824,0x00000,0x24e4f,0x24e4e,0x00000,
-0x24e4c,0x24e4d,0x16b3b,0x16b3d,0x16b3a,0x16b3c,0x25475,0x25476,
-0x25471,0xe4f36,0x25472,0x16f43,0x16f48,0x16f42,0x16f49,0x16f44,
-0x25473,0x00000,0xe4f33,0x25474,0x25470,0x16f4a,0x16f46,0xe4f35,
-0x00000,0x16f45,0x16f47,0xe4f34,0x2546f,0xe5324,0x25a76,0x17252,
-0xe5322,0xe5321,0x25a78,0x17254,0x25a7b,0x25a77,0x25a75,0x25a7a,
-0x17253,0x25a79,0x00000,0x17251,0xe5325,0xe5659,0x1755e,0x17561,
-0x25f6d,0xe565a,0x1755f,0x25f6c,0x1755d,0x17560,0x26370,0x26371,
-0x26372,0x1774b,0xe5937,0x26373,0x00000,0x1774c,0x1792f,0x26744,
-0x26745,0x26743,0x26742,0x26746,0x1792e,0x26a2b,0x26a29,0x26a2a,
-0x26a2c,0x26a28,0x26a2d,0x26c47,0xe5e67,0x26c48,0x26c46,0x17b32,
-0x26e33,0x17b79,0x26e34,0x26f56,0x26f55,0xe6222,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x14b50,0x1624b,0xe3f4b,0xe4477,0x16728,
-0xe4478,0xe4a21,0xe4a22,0x16b3e,0xe4f37,0xe5327,0x17256,0xe5326,
-0x17255,0x00000,0xe6654,0x00000,0xe5938,0x17930,0x17a29,0x17b33,
-0x14b51,0x15849,0x16729,0xe4f39,0x26747,0xe272f,0x00000,0x00000,
-0x00000,0xe243b,0x00000,0x00000,0x00000,0x00000,0xe2730,0x22526,
-0x00000,0xe2733,0x14b52,0x00000,0x14b55,0x14b54,0x14b53,0xe2731,
-0x00000,0x22525,0xe2a72,0x2286d,0xe2a70,0x2286f,0x14f52,0xe2a74,
-0x00000,0x14f54,0x2286c,0x2286e,0x14f53,0x22871,0x22870,0x22872,
-0xe2a73,0xe2a71,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x22d57,0x22d55,0x1535f,0x22d54,0x15364,0x15361,0x1535e,0xe2f31,
-0x15365,0xe2f32,0x15360,0x15363,0x00000,0x15362,0x22d56,0xe2f33,
-0x1535d,0xe2f30,0x00000,0x00000,0x1584f,0x2332f,0x23335,0x1584c,
-0x15853,0xe3425,0x1584e,0x23332,0x23334,0x15851,0x2332e,0x23331,
-0x1584d,0x1584a,0x23330,0x15850,0x23333,0x15852,0x1584b,0x00000,
-0xe3427,0xe3426,0x00000,0x23966,0x23969,0x15d56,0xe394b,0x15d60,
-0x15d5c,0x23967,0xe394a,0xe394e,0x15d64,0x15d5d,0x15d62,0x15d58,
-0x00000,0x15d55,0x15d57,0x15d63,0x23968,0x15d5b,0x15d5e,0x15d5a,
-0x15d5f,0x2396a,0x15d61,0x15d59,0x23965,0xe394c,0x00000,0x00000,
-0xe3f4f,0xe3f50,0xe3f4d,0xe3f4c,0xe3f51,0x24072,0x1624c,0x24074,
-0xe3f55,0x1624e,0x16250,0x00000,0x24073,0x1624d,0x16251,0xe3f56,
-0x1624f,0x00000,0xe3f54,0xe3f57,0x1672f,0x24829,0x16737,0x24826,
-0xe447d,0x16738,0x1672d,0xe4479,0x24827,0xe447c,0xe447a,0x16732,
-0xe447b,0x24828,0x1672b,0x1672a,0xe447e,0x16735,0x16734,0x16733,
-0x16731,0x16736,0x24825,0x1672c,0x1672e,0x16730,0x00000,0x00000,
-0x16b40,0x16b43,0xe4a24,0x16b47,0x16b41,0x16b46,0x16b44,0xe4a27,
-0x16b3f,0xe4a26,0x16b45,0x16b42,0x00000,0x00000,0x00000,0x2547a,
-0x16f4d,0x16f4b,0xe4f3c,0x2547b,0x00000,0x16f4e,0x16f4c,0x25479,
-0x25478,0xe4f3b,0x1725a,0x25477,0x17258,0x17257,0x25a7c,0x16f4f,
-0x17259,0x25a7d,0x1725c,0x25a7e,0x1725b,0x17563,0x25f6f,0x17562,
-0x17567,0x17565,0x17566,0x1774e,0x17564,0x25f6e,0x25b21,0x1774d,
-0x1774f,0xe593a,0x17931,0x17932,0x00000,0x26a2e,0x00000,0x17c4a,
-0x17c49,0x14b57,0xe225e,0xe225d,0x22275,0x15854,0xe243c,0x22272,
-0x22273,0x22271,0xe243d,0x22274,0xe6655,0x00000,0x2252a,0x22527,
-0x2252c,0x22528,0x14b58,0x14b5b,0xe2735,0x22529,0x14b5a,0x2252b,
-0xe2739,0xe2734,0x14b59,0xe3951,0x00000,0xe2a77,0x00000,0x22875,
-0x22877,0x14f57,0x22873,0x22876,0x22874,0x14f55,0x14f58,0xe2a75,
-0x14f56,0xe2a78,0x00000,0x00000,0xe2f35,0x22d59,0x22d5d,0x22d5a,
-0xe2f38,0x15368,0xe2f34,0x15369,0xe2f3e,0x22d5c,0xe2f37,0x22d5e,
-0x22d60,0xe2f3c,0x15366,0x22d5f,0x00000,0xe2f3b,0x15367,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x23971,0x22d5b,0x23336,0x2333f,
-0x2333d,0x23338,0x23339,0x2333e,0x23340,0x15856,0xe3429,0x2333b,
-0x23337,0x15855,0x15857,0x2333a,0x23341,0x2333c,0x00000,0x00000,
-0x15d65,0x23974,0x2396c,0x23972,0x23973,0x15d66,0xe394f,0x2396b,
-0x2396d,0x22d58,0x2396f,0x23970,0x2396e,0x16253,0xe636c,0xe3952,
-0x00000,0x2407b,0x25b22,0x2407c,0x24079,0x15d67,0x16255,0x24078,
-0x2407e,0x2407d,0x16252,0x24123,0x24077,0x24122,0x24075,0x24121,
-0x2407a,0x16254,0xe3f59,0x24830,0xe4523,0x2482b,0x24831,0x2482c,
-0x2482a,0x2482d,0x16739,0xe4524,0x2482f,0xe4525,0x2482e,0x1673a,
-0x16b49,0x16b48,0x24e56,0x24e59,0x24e51,0x24e55,0x16b4a,0x24e54,
-0x24e52,0x24e58,0x24e53,0x24e50,0x24e57,0xe4a2a,0x25523,0x16f52,
-0x26374,0x2547e,0x25521,0x2547d,0x24076,0x16f51,0x25524,0x2547c,
-0x16f50,0x16f53,0x25522,0x25b23,0x1725d,0x25b24,0x25b25,0xe532b,
-0x25f70,0x17568,0x26375,0x26376,0xe593c,0xe593b,0x26377,0x26749,
-0x26748,0x26a30,0x00000,0x26a2f,0x26c4a,0x26c4b,0x26c49,0x26e35,
-0x17b7a,0x14b5c,0x1536b,0x1536a,0x1585a,0x15859,0x23343,0x23344,
-0x23342,0xe342a,0x15858,0x23978,0xe3955,0x23979,0x23975,0x15d68,
-0x23976,0xe3954,0x23977,0x00000,0xe6657,0x00000,0x00000,0x24126,
-0x24128,0x24124,0x24127,0x16256,0x24125,0x16257,0x00000,0xe4528,
-0x24279,0x1673d,0x1673c,0xe4527,0x1673b,0x00000,0x24832,0x24833,
-0x00000,0x00000,0x24e5b,0x24e5d,0x16b4e,0x16b4b,0xe4a2c,0x16b4d,
-0x16b4c,0x24e5c,0x24e5a,0xe4a2b,0xe4a2d,0x00000,0x00000,0x00000,
-0x2552b,0x25528,0x25529,0x16f57,0x2552a,0x25525,0x25526,0x16f54,
-0xe4f3f,0x16f55,0x25527,0x16f56,0xe4f40,0x25b29,0xe532d,0x25b2a,
-0x25b27,0x25b28,0x1725e,0x25b26,0x00000,0xe532c,0xe532f,0x00000,
-0x00000,0x25f74,0x25f71,0x25f73,0x1756b,0x25f77,0x1756a,0x25f75,
-0x25f78,0x25f76,0x25f72,0x17569,0x00000,0x26379,0x00000,0x2637a,
-0x26378,0xe593d,0x2637c,0x17750,0x17751,0x2674b,0x17934,0x2637b,
-0x2674a,0x17933,0x26a33,0x26a34,0x17a4a,0x26a32,0x00000,0x26a31,
-0x00000,0x26c4c,0x17b34,0xe5e68,0x26f57,0x27056,0x27055,0xe607e,
-0x17c6e,0x17d2a,0x27057,0x27160,0xe616d,0x17d3c,0x14b5d,0x14f59,
-0x00000,0x1673e,0x00000,0x17a4b,0x14b5e,0x1536c,0x15d69,0x16258,
-0x17752,0x14f5a,0x00000,0x22d62,0x22d61,0x23345,0xe3430,0x1585d,
-0x1585b,0x1585f,0x23347,0xe342d,0x1585e,0x1585c,0xe342f,0xe342e,
-0xe3431,0x00000,0x23346,0x15d6c,0x23a21,0xe3958,0x15d6b,0x15d6d,
-0x23a26,0x15d6f,0x23a23,0x23a24,0x2397a,0x15d6e,0x23a27,0x00000,
-0xe3957,0x2397c,0xe3956,0x2397d,0x2397b,0x15d6a,0xe3959,0x23a25,
-0x2397e,0x23a22,0x00000,0x00000,0x00000,0x24134,0xe3f5d,0x24133,
-0x24131,0x24129,0x24138,0x2412c,0x24136,0x2413d,0x24135,0x16260,
-0xe3f66,0x1625c,0x2412a,0xe3f60,0x24130,0x1625e,0xe3f68,0x2412f,
-0x1625f,0x16261,0x24132,0xe3f69,0x16259,0x1625a,0x2413e,0x2413c,
-0xe3f62,0x2413b,0x2412d,0xe3f65,0x24139,0x00000,0x1625d,0x00000,
-0xe3f5e,0xe6659,0xe3f63,0x1625b,0x2413a,0x2412b,0x2412e,0x24137,
-0x00000,0x00000,0x00000,0xe6658,0x00000,0x24f22,0x2483d,0xe452e,
-0x24836,0x24849,0x24852,0x24839,0x16749,0xe452b,0x24846,0x1673f,
-0x16741,0x1674d,0x24837,0xe4537,0xe452f,0x16742,0x16744,0x1674e,
-0x16743,0xe4539,0x00000,0x00000,0xe4538,0x1674c,0x2483f,0x00000,
-0x24834,0x1674a,0x2483e,0x16746,0x24850,0x1674b,0x2484e,0x24842,
-0x2484c,0x16748,0x24835,0x2484f,0x2484a,0xe452a,0x24851,0x16740,
-0x00000,0xe452d,0x1674f,0x16745,0xe4531,0xe4529,0x2483b,0xe4534,
-0x24843,0x24847,0xe4533,0x2484b,0x16747,0x2483a,0x24838,0x24844,
-0x00000,0x00000,0xe4532,0xe4535,0x24841,0x24840,0xe4536,0x24845,
-0x24848,0x00000,0x2484d,0xe665a,0x00000,0x00000,0x24e60,0x00000,
-0x16b4f,0x24e6a,0x24e62,0x16b55,0x16b59,0x24e73,0x24e7b,0x24e6c,
-0x16b51,0xe4a34,0x24e70,0x2483c,0xe4a35,0x16b52,0x24e77,0x24e7c,
-0x24e74,0xe4a2f,0x24e76,0x24f21,0x24e78,0x24e66,0x24e6f,0xe4530,
-0xe4a38,0x16b5a,0xe4a33,0x16b56,0x24e64,0x24e71,0x16b54,0x24e6b,
-0x16b53,0x24e79,0x24e68,0x24e61,0x16b57,0x24e7e,0xe4a39,0x00000,
-0x24e63,0x24e75,0x24e72,0x24e6d,0x24e5f,0x24e5e,0x24e67,0x24e7a,
-0x16b58,0x24e7d,0x24e65,0x24e69,0x16b50,0xe4a32,0xe4a37,0x00000,
-0xe672a,0xe4a31,0x16f63,0x16f5e,0x2554d,0x25549,0x25531,0x16f5a,
-0xe4f42,0xe4f50,0x00000,0x16f59,0x16f5f,0x00000,0xe4f43,0xe4f41,
-0x2552f,0x16f5d,0x2553b,0x2552d,0x2552e,0x16f58,0x2554c,0x16f61,
-0x2553e,0x25543,0x2553d,0x25b3c,0x25539,0x25541,0x2553f,0x25532,
-0x2552c,0x25547,0x16f60,0x25548,0xe4f48,0x25542,0xe4f49,0x25537,
-0x25535,0x25530,0xe4f4b,0xe4f4e,0xe4f44,0x25538,0x25545,0x25534,
-0x25544,0x2554a,0xe4f51,0x00000,0x16f5c,0xe4f45,0x25540,0x25546,
-0x2553c,0x25536,0x16f5b,0xe4f52,0x00000,0xe4f4c,0x24e6e,0x2553a,
-0x16f62,0x25533,0x00000,0xe4f4d,0xe665b,0xe665c,0xe4a30,0x25b41,
-0x17261,0x25b40,0x25b3e,0x25b50,0x17265,0xe5335,0x25b4d,0x25b45,
-0x25b4f,0x25b37,0x25b43,0xe533d,0x17267,0xe533e,0x25b2f,0xe5338,
-0x25b2d,0x25b4e,0xe5332,0x25b4c,0x25b4b,0x25b3b,0x25b3a,0x25b30,
-0x17269,0x00000,0x25b36,0x25b3f,0x25b4a,0x1726c,0x25b51,0xe5336,
-0x17573,0x1726e,0x17268,0x25b34,0xe5337,0x25b3d,0x25b2c,0x25b2e,
-0x1725f,0x1726b,0x17264,0x25b35,0x25b44,0x2554b,0x1726a,0x25b2b,
-0x1756e,0x25b46,0x25b49,0x17266,0xe533b,0x25b39,0x1726d,0x17263,
-0xe533c,0xe5339,0xe533a,0x17262,0x25b42,0x25b48,0x17260,0x00000,
-0x25b32,0x25b47,0x00000,0x00000,0x25b33,0x00000,0x00000,0xe665d,
-0x00000,0x00000,0xe665e,0x00000,0x00000,0xe5331,0x25b38,0x25f7e,
-0xe5665,0x26025,0x17570,0x17572,0x2602b,0x1756c,0x26039,0x26031,
-0x26026,0x26027,0x26030,0xe5666,0x17579,0x2602f,0x25f7d,0x2602e,
-0x26022,0x2603a,0x17578,0x17576,0x26023,0xe565d,0x26036,0xe5667,
-0x26028,0x26035,0xe5664,0x26037,0x25f7c,0x17571,0xe565b,0x26038,
-0xe5668,0xe565e,0x2602c,0xe566b,0x17575,0x26029,0xe5661,0x00000,
-0x17577,0x26032,0xe5662,0xe5663,0xe565f,0x1756f,0x26024,0x26033,
-0xe565c,0x2602d,0x25b31,0x26034,0x26021,0xe5660,0x17574,0xe566a,
-0x2642f,0x00000,0x1756d,0x25f7a,0x00000,0x00000,0xe665f,0x00000,
-0x2642c,0x26425,0x17754,0xe5943,0x2637e,0x26430,0x26427,0x2602a,
-0xe5940,0x26432,0x26421,0xe5942,0x17753,0x2642b,0x17755,0x1775d,
-0x1775b,0x2642d,0x1775c,0x26423,0xe5949,0x26424,0x26429,0x2642e,
-0xe593e,0x25f79,0x17756,0x26437,0x26434,0x26761,0x2642a,0x26426,
-0x26435,0x26756,0x26428,0x00000,0x17759,0xe5944,0x17758,0x25f7b,
-0x1775a,0x26431,0x26433,0x17757,0x26436,0x2637d,0x00000,0x26422,
-0xe5946,0x00000,0x00000,0xe5945,0xe6661,0xe6662,0xe6660,0x00000,
-0x2675f,0xe5b50,0x2674f,0x17938,0x2675d,0xe5b44,0xe5b45,0x2674d,
-0x17939,0x00000,0x26758,0xe5b43,0x26754,0x1793e,0x2675e,0x2674e,
-0x26751,0x17936,0x26760,0xe5b48,0x26759,0x2675c,0x1793c,0x17941,
-0x1793f,0x26755,0x26750,0xe5b4d,0x1793a,0x1793b,0x2674c,0x17937,
-0xe5b4f,0x17935,0x1793d,0x2675b,0x17940,0xe5b4a,0x26757,0x26762,
-0x17942,0xe5b41,0xe5b42,0xe5b4e,0x26753,0xe5b47,0x2675a,0xe6665,
-0x00000,0xe6663,0xe6664,0xe5d41,0xe5e6a,0x26a41,0x26a50,0x26a43,
-0x26a4a,0x26752,0x26a48,0x26a37,0x26a4e,0x17a4e,0x26a3b,0x26a4d,
-0x26a42,0x00000,0xe5d43,0x17a4d,0xe5d3c,0xe5d3f,0x26a52,0x26a44,
-0xe5d3e,0x26a49,0x26a4c,0x26a35,0x26a4f,0x26a40,0x26a45,0x26a39,
-0x26a3d,0x26a51,0x26a47,0x26a36,0x26a3a,0x26a3c,0x26a46,0xe5d3d,
-0x17a4c,0x26a3f,0xe5d44,0xe5d45,0xe5d47,0x00000,0xe5d42,0xe5d3a,
-0x26a38,0x00000,0xe6666,0xe6667,0xe6668,0x00000,0x00000,0xe5d46,
-0x26a3e,0x26c50,0x26c54,0x17b3b,0x26c56,0xe5e6d,0x17b35,0x00000,
-0x26c52,0x26c58,0x17b3a,0x17b36,0x00000,0x17b37,0x26c4f,0x26c55,
-0x17b39,0x26c53,0x17b38,0x26c4e,0x26a4b,0x26c51,0x00000,0x26c4d,
-0x26c57,0x00000,0xe5f69,0xe5f6e,0x17b7b,0x26e3c,0x26e3f,0x26e3b,
-0x26e3d,0x26e3e,0x26e38,0x26e39,0x26e36,0xe5f6a,0xe5f6c,0x26e3a,
-0x26e37,0x17b7c,0x17b7d,0x00000,0xe5f6b,0x26f59,0xe6052,0x26f5b,
-0xe6431,0x00000,0xe6055,0xe6054,0xe6056,0x26f5a,0x26f5c,0xe604f,
-0x17c4c,0xe6053,0x26f58,0x17c4b,0x17c4d,0xe6057,0xe666a,0xe6669,
-0x27059,0x2705a,0x17c6f,0x27058,0xe6122,0x27142,0x27141,0x27143,
-0x17d2c,0x27144,0x17d2b,0x27145,0x27161,0x27164,0x27163,0x17d35,
-0x27162,0x00000,0xe616f,0xe6223,0x17d3f,0x17d3d,0x17d3e,0x17d44,
-0x27230,0x27231,0x2722f,0x27237,0xe6236,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-/* 0x9500 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x14f5b,
-0x00000,0xe6323,0x23a28,0x2413f,0x2554e,0x26763,0x00000,0x00000,
-0x14f5c,0xe2f40,0x1536d,0x15860,0x00000,0xe3432,0x23a29,0xe395c,
-0x23a2a,0x15d70,0x00000,0x16264,0x24141,0x24140,0x16268,0x16263,
-0x24142,0x16265,0x16267,0x16266,0x16262,0xe3f6c,0x00000,0xe666b,
-0x16750,0xe453c,0xe453a,0x24856,0x24854,0x00000,0x24855,0x24853,
-0x00000,0x16b5b,0xe4a3d,0x16b5e,0x16b60,0x16b5f,0x00000,0xe4a3e,
-0x16b5c,0x16b5d,0x00000,0x25550,0x2554f,0x16f64,0x25551,0xe4f53,
-0x25552,0x16f65,0xe4f55,0xe4f56,0x00000,0x25b59,0x25b57,0x26040,
-0xe5342,0x25b55,0x25b56,0x1726f,0x25b52,0x25b5a,0x25b54,0x25b58,
-0x2603c,0xe5344,0xe5340,0x2603e,0xe566d,0x2603f,0x1757e,0x2603b,
-0x1757d,0x2603d,0x1757a,0x1757b,0x1757c,0x25b53,0xe666c,0x00000,
-0x17760,0x2643a,0x26438,0x26439,0x1775e,0x17761,0x1775f,0xe594b,
-0xe594a,0x00000,0x26764,0x26765,0x17943,0xe5b53,0x26a53,0x26a55,
-0x26a54,0x17a4f,0x17b3c,0x26c5b,0x26c5a,0x26c59,0x00000,0xe666d,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-/* 0x9600 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x14f5d,0xe2143,0x22169,0x00000,
-0x22278,0x1486a,0x22276,0x22279,0x22277,0x00000,0xe273b,0xe273a,
-0x2252e,0xe273f,0x14b62,0xe273c,0x14b63,0x22530,0x14b60,0x2252f,
-0x2252d,0x14b61,0x14b5f,0xe273d,0xe273e,0x00000,0x00000,0xe2a79,
-0x00000,0x22878,0x2287b,0x14f60,0x2287a,0x22879,0xe2a7c,0x14f5f,
-0x14f5e,0xe2a7b,0x14f62,0x2287c,0x14f61,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x22d67,0x1536f,0x15370,0x15371,0x22d68,0x22d64,
-0x1536e,0x22d65,0x00000,0x22d66,0x22d63,0x00000,0xe3436,0x00000,
-0x15867,0xe3434,0xe395e,0x15864,0x23348,0x15865,0x15868,0x23349,
-0xe3433,0x15863,0x15861,0x15862,0x15866,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x15d71,0x23a2d,0x15d79,0x23a2c,0xe3961,0x23a2f,
-0x15d75,0x23a2e,0x16270,0x15d73,0x15d76,0x15d72,0x15d77,0x15d78,
-0x15d74,0xe3965,0x00000,0xe3f71,0x23a2b,0x1626c,0x24144,0xe3f72,
-0x24148,0xe3f73,0xe3f75,0x24147,0x16271,0x1626d,0x1626e,0x24143,
-0x24145,0x24146,0x16269,0x1626b,0xe3f70,0x1626f,0x1626a,0xe4540,
-0x00000,0x24859,0x24857,0x24858,0x16752,0x16753,0xe4542,0x2485a,
-0x16751,0x16b61,0x00000,0x16b63,0x16b62,0xe4a45,0x24f23,0xe4a46,
-0xe4a44,0x24f24,0x25554,0xe4f5a,0x25553,0xe4f5b,0x00000,0x17270,
-0x17271,0x25b5b,0x17272,0xe5348,0x26043,0xe5670,0x26041,0xe566f,
-0x26042,0x17621,0xe5671,0x2643b,0x17944,0xe5d49,0xe2a7d,0xe5349,
-0x17622,0x14f63,0xe6325,0x15869,0x2334a,0xe3439,0x00000,0x23a30,
-0x15d7a,0x16272,0x24149,0x2414b,0x16274,0x16273,0x16275,0x16276,
-0x2414a,0x16756,0x16757,0x16755,0x16b64,0x16754,0x2485b,0x00000,
-0xe4a47,0xe4a49,0x16b65,0x25555,0x25b5c,0x17273,0x17623,0x2643c,
-0x26440,0x17764,0x2643d,0x17765,0x17763,0x26441,0x17766,0x2643f,
-0x00000,0x26766,0x17762,0x17945,0xe5e70,0x2705b,0xe6125,0xe622f,
-0x14f64,0x15d7c,0x15d7b,0x00000,0xe3f7e,0xe3f7c,0xe3f7b,0x16277,
-0x2414d,0x2414c,0x16278,0x00000,0xe4546,0x2485f,0x1675b,0x16758,
-0x2485e,0x1675a,0x2485c,0x16759,0xe4547,0x2485d,0x00000,0x24f25,
-0x16b66,0x00000,0x25558,0x00000,0x16f66,0x25556,0x16f67,0x16f68,
-0x25557,0x16f69,0xe4f60,0x25b5d,0xe5350,0x17277,0x17274,0x17279,
-0x25b5f,0x17275,0x25b5e,0x17278,0xe534d,0xe534c,0x17276,0xe5351,
-0x26046,0x26048,0xe5674,0xe5675,0x17624,0x26047,0x17625,0x26045,
-0x26044,0x00000,0x26443,0x26442,0x17767,0x26444,0x2676b,0x17947,
-0x2676a,0x26767,0x17946,0x26768,0x26769,0x00000,0x26a56,0x26a57,
-0x17a50,0xe5d4f,0x17b3f,0xe5d4c,0xe5d4e,0x26c5c,0xe5e72,0xe5e71,
-0x17b3d,0x17b3e,0x26c5d,0xe666e,0xe5f71,0x17b7e,0x17c21,0x26e40,
-0xe5f72,0xe6059,0x17c70,0x2705d,0x17c72,0xe6126,0x2705c,0x2705e,
-0x17c71,0x27146,0x00000,0x2717b,0x00000,0xe666f,0x00000,0x00000,
-0xe6245,0xe2a7e,0x14f65,0x00000,0x00000,0xe4549,0x1675c,0x00000,
-0x24f26,0xe4a4c,0x25559,0x1727a,0x1727b,0xe594f,0x14f66,0xe4021,
-0x16f6a,0x17948,0x15372,0xe2b21,0xe4a4e,0x00000,0x1727c,0xe5e73,
-0x17c4e,0x15373,0x23a31,0x00000,0x2414e,0xe4024,0x24150,0xe4022,
-0x2414f,0x00000,0x24863,0x24860,0x1675d,0x00000,0x1675e,0x24861,
-0x24862,0xe454b,0x24f28,0x24f2d,0x16b67,0x24f27,0x24f29,0x24f30,
-0x24f2b,0x24f2f,0x24f2c,0x24f2a,0x24f2e,0x16b68,0x00000,0xe4f62,
-0x2555c,0xe4f63,0x2555a,0x16f6c,0xe4f64,0x16f6b,0x2555b,0x16f6d,
-0x00000,0x00000,0x00000,0xe5353,0x25b62,0x00000,0x00000,0x25b61,
-0x1727d,0x25b60,0x26049,0xe567a,0x2604b,0x2604d,0x2604c,0xe567b,
-0x17626,0x2604a,0x2644b,0x17768,0x26449,0x2644c,0x17769,0x00000,
-0x26447,0xe5950,0x2644a,0x26448,0x26445,0x1776a,0x26446,0x00000,
-0x00000,0xe5b5f,0xe5b5d,0x2676c,0xe5b5e,0xe5b60,0x2676e,0x2676d,
-0xe5d50,0x26a58,0xe5d51,0x26a59,0x00000,0xe5e75,0xe5e74,0x26c5e,
-0xe5f73,0x17c23,0x00000,0x17c22,0x26f5d,0x26f5e,0x17c73,0x2705f,
-0xe6128,0x17d36,0xe623b,0x15374,0x16279,0x24f32,0x24f31,0x2555e,
-0x2555d,0x00000,0xe5355,0x17627,0x2604f,0x2604e,0x2644f,0x2644d,
-0x26450,0x2644e,0xe5951,0x00000,0x17949,0x2676f,0x26770,0x26771,
-0x00000,0x26c5f,0xe5e76,0x26e41,0xe6129,0x27060,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x15375,0xe454f,0xe4f65,
-0x25b63,0x26050,0xe5b61,0x15376,0x00000,0xe4550,0x16b69,0x00000,
-0x25b64,0x1776b,0x26451,0x1794a,0xe5d53,0x26a5a,0x26a5b,0x17b40,
-0x26f5f,0x15377,0x15e21,0x15e22,0x23a32,0x1627a,0x1627b,0x24151,
-0x1627c,0x00000,0x16762,0xe4552,0x16764,0x24865,0x24866,0x24864,
-0x1675f,0x16760,0x16763,0x16761,0xe4a54,0xe4a55,0x24f33,0x16b6a,
-0x16b6b,0xe4a52,0xe4a56,0x25565,0x16f70,0x25560,0x2555f,0xe4f69,
-0x25564,0x16f6e,0xe4f67,0xe636e,0x17326,0x00000,0x25561,0x25566,
-0x25563,0x25562,0xe4f66,0x16f6f,0x00000,0x17324,0xe535c,0x25b66,
-0x1727e,0xe5359,0x25b67,0xe535a,0xe5228,0x25b65,0xe5358,0x17323,
-0x17321,0x17325,0xe535d,0x17322,0xe535b,0xe535f,0x00000,0xe595b,
-0xe5726,0x26051,0xe637b,0x26056,0x26052,0x26055,0x17628,0xe5728,
-0x25e41,0x26054,0x26053,0xe5959,0x1776e,0x1776c,0x1776f,0x1776d,
-0x26452,0x26453,0x26454,0x17770,0xe5956,0xe5958,0xe5b65,0x26775,
-0x1794c,0x26773,0x00000,0x1794d,0x26772,0x26774,0x1794b,0x26a5f,
-0x26a5c,0xe642a,0x26a5d,0x26a5e,0x26c60,0x17b42,0xe5e78,0x17b41,
-0xe5e77,0x26e43,0x26e42,0x17c24,0xe605d,0xe605e,0xe605c,0x17c4f,
-0x17c74,0x17d2d,0x27147,0x2717c,0x2717d,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x15378,0x24152,0x00000,0x00000,0x24867,0x24f34,0x24f35,0x16b6c,
-0x00000,0x16b6d,0x25567,0x16f71,0x00000,0xe5361,0x17629,0xe572a,
-0x26455,0xe595c,0x17771,0x26778,0x1794e,0x26777,0x26779,0x26776,
-0x26c63,0x26a60,0x26a61,0xe5d56,0x17a51,0x00000,0x26c62,0xe5e7b,
-0xe5e79,0x26c61,0xe5e7a,0x26e44,0x2717e,0xe6225,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x15379,0xe5e7c,0xe6226,0x00000,0x1537a,
-0x00000,0xe3967,0x1586a,0x2334b,0xe6670,0x23a33,0xe3968,0x1627d,
-0x00000,0x16322,0x1627e,0x24153,0xe455b,0x16324,0x00000,0x16321,
-0xe402b,0xe455c,0x16323,0xe4554,0x16766,0xe4559,0x24868,0xe4557,
-0xe4a5d,0x24869,0x25569,0x00000,0x16765,0x16767,0x16768,0xe4558,
-0x24f37,0xe4a5e,0x24f36,0x16b6e,0x00000,0x16b6f,0xe4a5b,0x24f38,
-0x25568,0x16b71,0x16f72,0x00000,0x16b70,0x00000,0xe667a,0x00000,
-0x17327,0x2556a,0x16f74,0x16f73,0x2556b,0x2556e,0x2556c,0x2556d,
-0x16f75,0xe4f6b,0x1732c,0x1732a,0xe5365,0xe5366,0x17329,0x25b69,
-0xe5364,0x1732b,0xe5362,0xe5363,0x25b68,0x26057,0x00000,0x25b6a,
-0x17328,0x25b6b,0x2605a,0x26058,0x26059,0x2605e,0x17775,0x2605d,
-0x26060,0x2605f,0x2605c,0x2605b,0x00000,0x1762a,0xe5962,0x00000,
-0xe5961,0xe5966,0x26458,0xe5965,0x26457,0x17774,0x17772,0x17773,
-0xe5963,0x26456,0xe6671,0x2677c,0xe5b69,0x1794f,0x00000,0x2677b,
-0x2677a,0x17950,0x00000,0x26a66,0x26a65,0xe5d58,0x26a63,0xe5e7e,
-0x26a62,0x17a53,0x17a52,0x26a67,0x26e45,0x17c25,0x26c65,0x17b43,
-0x26c64,0x26a64,0xe5f78,0x26e46,0x17c50,0xe612a,0x17d2e,0x27148,
-0x00000,0x27221,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x1537b,0x23a34,
-0x26061,0x1537c,0xe455f,0x00000,0x24f3a,0x24f39,0x25b6c,0x00000,
-0xe5368,0x26063,0xe5730,0x26062,0xe5967,0x17776,0x2677d,0x2677e,
-0x17a54,0xe5f21,0xe6060,0x27222,0x1586b,0x16326,0x16325,0x2486a,
-0x2486c,0x1676a,0x2486b,0x16769,0x1676b,0x2486d,0xe4a63,0xe4a62,
-0xe4a66,0x24f3c,0x24f3e,0x24f3d,0xe4a61,0x24f40,0xe4a60,0xe4a6c,
-0xe4a64,0x16b72,0x24f3f,0x24f3b,0xe4a6a,0x00000,0x00000,0x24f41,
-0xe4f73,0x25575,0xe4f6d,0x25578,0x2557a,0x25570,0x25574,0x25571,
-0x16f77,0x16f7a,0x16f7c,0x25572,0x25573,0x16f7b,0x25576,0x25579,
-0x25577,0x16f7d,0xe4f6e,0x16f79,0x2556f,0x16f76,0xe4f72,0x16f78,
-0xe4f74,0xe5370,0x1732e,0x25b72,0x25b70,0x25b6f,0xe5371,0x25b75,
-0xe536b,0x25b74,0x25b73,0xe536c,0x25b6e,0x1732d,0x25b6d,0xe536a,
-0x25b71,0x1732f,0x00000,0xe5734,0x26066,0xe5737,0x2606a,0x26067,
-0x26069,0x26068,0x26065,0x2606b,0x2606e,0x2606c,0x2606d,0x1762c,
-0xe5733,0x1762b,0x26064,0x2606f,0x2645d,0x26460,0x26462,0x26461,
-0xe596a,0x2645b,0x2645f,0x2645a,0xe596b,0x2645c,0x17777,0x26459,
-0xe596d,0x2645e,0x00000,0x00000,0x2682d,0x26822,0x17951,0xe5b6f,
-0xe5b6d,0x17952,0x26821,0x26826,0x2682c,0x26824,0x2682b,0xe5b6c,
-0x26828,0xe5b6e,0x26827,0x2682a,0x26825,0x26823,0xe5b6b,0x26829,
-0x00000,0x26a6e,0x26a6c,0x17a55,0x26a6b,0x26a71,0x26a6f,0xe5d5a,
-0x17a56,0x26a6a,0x26a68,0x00000,0x26a69,0x17a58,0x26a6d,0x17a57,
-0x26a70,0x26c66,0x26c6c,0xe5f24,0xe5f22,0x26c67,0x17b47,0x26c6d,
-0x17b46,0x26c6b,0x26c6a,0x17b45,0x26c69,0x17b44,0x26c68,0x00000,
-0x26e4c,0x26e4e,0x26e4d,0x00000,0x26e4a,0x17c27,0x26e47,0x26e4b,
-0x26e50,0xe5f79,0x26e4f,0x26e48,0x26e49,0x17c26,0x26f60,0x17c53,
-0xe6062,0x26f61,0x17c51,0x17c52,0xe6061,0x00000,0x27061,0x17c75,
-0x27165,0xe6172,0x17d37,0xe6173,0x27223,0x17d38,0x27224,0x27225,
-0x27233,0x27232,0x17d47,0x2723b,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x1586c,0xe402f,0x00000,0x2486f,0x00000,0x2486e,0x00000,0x16b73,
-0x16b74,0x24f42,0x00000,0x2557b,0x25b78,0xe4f77,0xe4f76,0x16f7e,
-0x17330,0x25b76,0x00000,0x25b79,0x17331,0xe573a,0x26070,0x25b77,
-0x26463,0x17778,0x2682e,0x00000,0xe5d61,0x00000,0x26a74,0x26a72,
-0xe5d60,0xe5d5e,0x26a73,0x00000,0x00000,0x26c6e,0xe5f25,0x17b48,
-0x26e51,0x17c56,0x17c28,0x17c54,0x17c55,0x27062,0x17d2f,0xe6174,
-0x1586d,0xe6334,0xe4a6e,0x00000,0x26464,0xe5f7b,0xe6063,0x2334c,
-0xe4032,0x1676c,0xe4561,0x24f43,0xe4a6f,0xe4a73,0x16b75,0x24f44,
-0xe4a71,0xe4a70,0xe4a72,0x2557d,0x2557c,0x17333,0x17021,0x17022,
-0x00000,0x25622,0x25621,0x2557e,0xe4f79,0xe5375,0x25b7a,0x25b7d,
-0xe5374,0x25b7c,0x25b7b,0x17332,0x26074,0x26072,0x26071,0x00000,
-0xe573b,0x26073,0xe573c,0x17779,0x26466,0x26467,0x1777a,0xe596f,
-0x26465,0xe5b71,0x26830,0x2682f,0x26832,0x17953,0x26831,0x00000,
-0x26a75,0x26a77,0x26a76,0x00000,0xe5f27,0x26c6f,0x26c72,0x26c70,
-0x26c71,0x26e52,0x17c29,0x00000,0x00000,0xe6672,0x26f62,0x26f63,
-0x26f64,0xe612c,0x17c76,0x17d30,0x27226,0x1586e,0xe4a75,0x17023,
-0x17334,0x26468,0xe5d62,0x26e53,0xe612e,0xe6433,0x27166,0x2334d,
-0xe6228,0x17d48,0x1586f,0x25b7e,0xe573e,0x26469,0x00000,0x26833,
-0xe5d63,0x00000,0x26c73,0x26e54,0x15870,0xe4562,0x24f45,0x24f46,
-0xe4a78,0x16b76,0x16b77,0x25624,0x17025,0x17024,0x25623,0x00000,
-0x26075,0xe573f,0x2646a,0x2646c,0x2646b,0x1777d,0x1777c,0x1777b,
-0xe5d64,0x17b4a,0x26c74,0xe5f28,0x17b49,0x26e56,0x26e55,0xe612f,
-0x17c77,0x27063,0x15e23,0x24870,0x00000,0xe4563,0x00000,0x24f49,
-0x24f47,0x24f48,0x00000,0xe4f7e,0x2562d,0x00000,0x25628,0x25625,
-0x2562c,0xe4f7c,0x00000,0xe4f7b,0x2562e,0x00000,0x00000,0x17027,
-0x2562b,0x25627,0xe4f7d,0x00000,0x25626,0x2562a,0x25629,0x17026,
-0x00000,0x00000,0x25c2b,0x25c26,0x25c24,0x25c2d,0x25c25,0x00000,
-0x25c21,0x00000,0x25c27,0xe5378,0xe537a,0x25c22,0x2607e,0x25c23,
-0x25c2e,0xe5423,0x00000,0xe537c,0xe5421,0x00000,0xe5425,0xe537d,
-0x25c2a,0x17335,0x25c29,0x25c28,0xe5379,0x25c2c,0x00000,0x00000,
-0xe6673,0xe5744,0x26076,0x26079,0x00000,0xe5745,0x26078,0xe5740,
-0x26122,0x2607b,0x26121,0xe5742,0x2607d,0x2607c,0x2607a,0x00000,
-0x26077,0x00000,0x1762f,0x1762e,0x00000,0x17630,0x1762d,0x26123,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x26472,0x26475,0x00000,
-0x26473,0x26477,0x00000,0xe5974,0x00000,0x26478,0x00000,0x26470,
-0x17824,0x26471,0xe5973,0x2646f,0x26476,0xe5b74,0x2646e,0x2646d,
-0x17823,0x17821,0x1777e,0xe5976,0xe5975,0xe5743,0x00000,0x00000,
-0x00000,0x00000,0xe5971,0x26474,0x2683c,0x26842,0x17956,0x2683d,
-0x00000,0x26840,0x26844,0x17957,0x2683f,0x00000,0x26837,0xe5b75,
-0x26836,0x26843,0x2683a,0xe5b77,0x26838,0x26841,0x26839,0x17955,
-0x17954,0xe5b79,0x26834,0x26835,0x2683e,0x00000,0xe5b7a,0x00000,
-0x2683b,0x00000,0x00000,0x00000,0x00000,0x00000,0xe5d6f,0x26a7a,
-0x26a7d,0xe5d71,0x00000,0xe5d67,0xe5d69,0x17822,0xe5d6a,0xe5d74,
-0xe5d75,0x00000,0xe5d6e,0x00000,0xe5d68,0x26a7b,0x26b23,0x26b21,
-0x26a79,0x26b26,0xe5d66,0x26a78,0xe5d76,0x17a5a,0x26b22,0x00000,
-0xe5d73,0x00000,0x26a7c,0x17a59,0x26b25,0xe5d72,0x00000,0x26b24,
-0x00000,0x00000,0x00000,0xe5d70,0x26c77,0x26c76,0x00000,0xe5f2c,
-0x00000,0x26c7d,0x00000,0x26c79,0x26c7c,0x17b4c,0x00000,0xe642f,
-0x26c7a,0x26c7b,0x00000,0x26c75,0x26c78,0x17b4b,0xe5f2a,0x00000,
-0x00000,0x17c2b,0x26e61,0x26e5c,0x26e60,0xe6025,0x26e63,0x26e5f,
-0xe5f7e,0x26e5b,0xe6023,0x17c2d,0x26e5e,0x26e62,0x17c2c,0x26e59,
-0x26a7e,0x26e5d,0x00000,0x00000,0x26e5a,0xe6022,0x26e57,0x00000,
-0x26e58,0x17c2a,0x26f68,0x26f6a,0x26f6d,0x26f69,0x26f6e,0xe6065,
-0x26f67,0xe6066,0x26f65,0xe6068,0x17c57,0x26f6b,0x17c59,0x17c58,
-0x26f66,0x26f6c,0x00000,0x00000,0x00000,0xe6132,0x27068,0x17c78,
-0x27069,0xe6133,0x27067,0x27064,0x00000,0xe6134,0x27066,0x27065,
-0x27149,0x00000,0x00000,0x00000,0xe6159,0x2714b,0x2714a,0xe615b,
-0x00000,0x27169,0x00000,0x27168,0x27167,0x2716a,0xe6175,0x17d40,
-0x17d41,0x27238,0x2723c,0xe6241,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x15e24,0x24154,0x24873,
-0xe4564,0x1676d,0x24871,0xe4566,0xe2f42,0x24872,0xe4568,0xe4567,
-0x00000,0x24f4a,0x24f4b,0x16b7a,0x16b78,0x24f4c,0x16b79,0x25633,
-0xe5027,0x25636,0x25630,0x25637,0x2562f,0x25631,0xe502a,0x25632,
-0x25635,0xe5024,0xe502b,0x1702a,0x2563a,0x25639,0x17028,0x25634,
-0x25638,0x17029,0xe542d,0x00000,0xe5025,0xe5022,0x00000,0xe542a,
-0x25c38,0x00000,0x1733a,0xe542c,0x25c33,0x17336,0xe5436,0x25c30,
-0x25c36,0x25c39,0xe5433,0x1733b,0x00000,0x25c35,0x25c32,0x25c3a,
-0x25c31,0xe5437,0x25c37,0x17337,0xe5429,0x25c2f,0x17338,0xe5435,
-0x17339,0x25c34,0xe5432,0x00000,0x00000,0x26135,0x26128,0x26129,
-0x2612c,0x2612a,0x00000,0x26124,0x00000,0xe574d,0x26127,0x26131,
-0x2612b,0xe5748,0x00000,0x17631,0x00000,0x26133,0x26130,0x17632,
-0x26132,0x26125,0x2612e,0x2612f,0xe574a,0x2612d,0x00000,0x00000,
-0x00000,0xe6675,0x2647c,0x2647e,0x26523,0xe5979,0xe597b,0x2647b,
-0xe597d,0x17825,0x26525,0x2647a,0x26526,0xe597e,0x26522,0x26524,
-0x26528,0x26521,0x26529,0x2647d,0x26479,0x17826,0xe5a22,0x26527,
-0x17827,0x17959,0x00000,0xe597a,0x00000,0x00000,0xe5b7d,0x26126,
-0x2685e,0x26855,0x1795b,0x26851,0x1795c,0xe5c27,0xe5c22,0x2685a,
-0x26854,0x2684a,0x1795a,0x26857,0x26852,0x26853,0xe5c25,0x26845,
-0x2684c,0x2685b,0xe5b7e,0x26858,0x00000,0x26850,0xe5c26,0x2685c,
-0x2684b,0x26846,0x26859,0xe5c24,0x26848,0x26856,0x2684d,0x2685d,
-0x26849,0x17958,0x26847,0x2684e,0x2684f,0x00000,0x00000,0x00000,
-0x26b2d,0xe5c23,0x26b2b,0x00000,0x26b30,0xe5d79,0x26b3c,0x26b33,
-0x26b2c,0x26b28,0x26b35,0x26b2e,0x26b31,0x26b2a,0x26b38,0x26b27,
-0x26b2f,0x26b34,0x26b36,0x26b39,0x26b29,0xe5d7a,0x26b3d,0x26b3e,
-0x26b37,0x26b3b,0x26b32,0x00000,0x26d2f,0x26d32,0xe5f35,0x17b4d,
-0xe5f31,0x26d31,0x26d36,0x26d34,0x17b4e,0x26d2b,0x26d21,0x26c7e,
-0x17b50,0x26d2d,0x26d2e,0x26d2a,0x26d22,0xe5f32,0x26d27,0x26b3a,
-0x00000,0x26d23,0x17b4f,0x26d29,0xe5f36,0x26d28,0x00000,0x26d24,
-0x26d30,0x00000,0x26d25,0x26e68,0x26d33,0x26d35,0x26d2c,0x26d26,
-0x26e69,0x26e6b,0x26e65,0x17c2e,0x00000,0x26e72,0x26e70,0x17c2f,
-0x26e6f,0x26e6e,0x26e67,0x26e64,0x26e6a,0x26e73,0x26e66,0x26e6c,
-0x00000,0x26f77,0x26f7c,0x26f72,0x26f75,0x17c5a,0x26f79,0x00000,
-0x27022,0x26e6d,0x00000,0x26f73,0x26f7d,0x27023,0x26f78,0x26f71,
-0x26f7b,0x00000,0x26f7a,0x27021,0x26f7e,0x26e71,0x26f76,0x26f70,
-0x26f74,0x17c79,0x17c7a,0x26f6f,0xe606c,0x27074,0x2706b,0x27073,
-0x27070,0x27071,0x2706a,0x2706d,0x27075,0x2706f,0x2706e,0x2706c,
-0xe6135,0x27072,0x00000,0x2714c,0x00000,0x2714d,0xe615d,0x2714f,
-0x2714e,0x27151,0x27150,0x2716c,0x2716b,0x27227,0xe6229,0x27228,
-0xe6230,0x27234,0x17d45,0x17d49,0xe6238,0x2723d,0x17d4a,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x15e25,0x00000,0x00000,
-0x00000,0x17a5b,0x26d37,0xe5f37,0x17c7b,0x17c7c,0x00000,0x15e26,
-0x24874,0xe4569,0x1676e,0x2563b,0xe502c,0xe5439,0x25c3c,0x25c3d,
-0x25c3b,0x26137,0x26136,0x17633,0x2652b,0x26138,0x2652a,0x00000,
-0xe5a24,0x26860,0x1795d,0x1795f,0x2685f,0xe5c29,0x00000,0x1795e,
-0xe5e21,0x26b3f,0x26b41,0x26b40,0x26d38,0x17b51,0xe5f3a,0x17c5b,
-0x27076,0x27152,0xe6231,0xe623f,0x27241,0x15e27,0xe2547,0x24f4d,
-0x00000,0x1702b,0xe502f,0xe502e,0xe543a,0x25c3f,0x25c3e,0xe5750,
-0x26139,0xe5a26,0xe5a25,0x00000,0x17960,0x17a5c,0x26e74,0x27239,
-0x00000,0x00000,0x00000,0x15e28,0x16b7b,0xe4b22,0x1702c,0x00000,
-0x26861,0xe5e22,0x27024,0x16327,0xe396a,0xe543c,0xe543b,0x00000,
-0x2613a,0x00000,0xe5a28,0x00000,0x17d31,0x16328,0x1702d,0x17634,
-0x27025,0x16329,0xe396b,0x2563c,0x1733d,0x25c40,0x25c41,0xe543d,
-0x1733c,0x00000,0x2613b,0x17638,0x17636,0x17637,0x17635,0x2652c,
-0x17828,0x00000,0x00000,0xe5c2a,0x26b43,0x26b42,0x26b45,0x26b44,
-0x17a5d,0x00000,0x00000,0x26d39,0x00000,0x26d3b,0x26d3a,0x17b52,
-0x26e75,0xe6029,0x27026,0x27027,0x17c5c,0x27153,0x2716d,0x17d42,
-0x00000,0x24155,0x25c42,0x2613c,0x26862,0x24875,0xe2772,0x2613d,
-0x2652e,0x2652d,0xe5a29,0xe5c2d,0xe5c2e,0xe5f3c,0x27028,0x17c7d,
-0xe615f,0x27154,0x2716e,0x00000,0x00000,0x00000,0x1676f,0x2563d,
-0x2563e,0x00000,0x25c43,0x16770,0xe456a,0x17829,0x2652f,0xe5c30,
-0x26d3d,0x17b53,0x26d3e,0x26d3c,0x27029,0xe6160,0x27077,0x00000,
-0x16771,0x00000,0x26140,0x2613f,0x2613e,0x26530,0xe5a2b,0xe5a2a,
-0x26534,0x26533,0x26532,0x26531,0x1782a,0x26863,0x26b47,0x17a5e,
-0x26b46,0x26d3f,0x26e78,0x26e77,0x17c30,0x26e76,0x2702c,0x2702b,
-0x2702a,0xe606d,0x00000,0x16b7c,0x00000,0x25c44,0x17639,0x00000,
-0x26864,0x26865,0x26e79,0x2702d,0x00000,0xe613b,0x27078,0x27155,
-0x27229,0x27243,0x16b7d,0x1763a,0x26535,0x26866,0x26d40,0x2702e,
-0xe2370,0x00000,0x1702f,0xe543e,0x26141,0x26536,0x26867,0x26868,
-0x26869,0x26b4c,0xe5e24,0x26b48,0x17b54,0x26b4b,0x26b4a,0x17a5f,
-0x26b49,0x17a61,0x00000,0x17a60,0x26d42,0x26d41,0x17b55,0x17b56,
-0x00000,0xe5f3e,0x17c32,0x26e7a,0x17c31,0x00000,0x27031,0x27032,
-0x27030,0x2702f,0x17d21,0x00000,0x27079,0x2707a,0x2707b,0x17c7e,
-0x27156,0x27159,0x27158,0x27157,0xe6233,0x00000,0x27242,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x1733e,0xe5755,0x00000,
-0x17832,0x26b4d,0x26d43,0xe602b,0x17c33,0x26e7b,0x00000,0xe6242,
-0x27244,0x00000,0x00000,0x00000,0x1733f,0xe5e47,0x00000,0x00000,
-0x26142,0xe5f3f,0x26e7c,0xe6161,0x2716f,0xe6177};
-
-static const int ucs_i_cns11643_table_min = 0x4d00;
-static const int ucs_i_cns11643_table_max = 0x4d00 + (sizeof (ucs_i_cns11643_table) / sizeof (unsigned int));
-
-static const unsigned int ucs_r_cns11643_table[] = {
-/* 0xfe00 */
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x1212b,0x12136,0x12138,0x00000,0x00000,0x12140,0x12141,0x12144,
-0x12145,0x12148,0x12149,0x1214c,0x1214d,0x12150,0x12151,0x12154,
-0x12155,0x12158,0x12159,0x1215c,0x1215d,0x00000,0x00000,0x00000,
-0x00000,0x12227,0x12228,0x1222b,0x1222c,0x12229,0x1222a,0x00000,
-0x1212e,0x1212f,0x12130,0x00000,0x12132,0x12133,0x12134,0x12135,
-0x00000,0x1215e,0x1215f,0x12160,0x12161,0x12162,0x12163,0x1222d,
-0x1222e,0x1222f,0x1223f,0x12240,0x12241,0x12243,0x12242,0x00000,
-0x12262,0x1226c,0x1226d,0x1226e,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-/* 0xff00 */
-0x00000,0x1212a,0x00000,0x1216c,0x12263,0x12268,0x1216d,0x00000,
-0x1213e,0x1213f,0x1216e,0x12230,0x12122,0x12231,0x12125,0x1225f,
-0x12421,0x12422,0x12423,0x12424,0x12425,0x12426,0x12427,0x12428,
-0x12429,0x1242a,0x12128,0x12127,0x12236,0x12238,0x12237,0x12129,
-0x12269,0x12441,0x12442,0x12443,0x12444,0x12445,0x12446,0x12447,
-0x12448,0x12449,0x1244a,0x1244b,0x1244c,0x1244d,0x1244e,0x1244f,
-0x12450,0x12451,0x12452,0x12453,0x12454,0x12455,0x12456,0x12457,
-0x12458,0x12459,0x1245a,0x00000,0x12260,0x00000,0x00000,0x12225,
-0x00000,0x1245b,0x1245c,0x1245d,0x1245e,0x1245f,0x12460,0x12461,
-0x12462,0x12463,0x12464,0x12465,0x12466,0x12467,0x12468,0x12469,
-0x1246a,0x1246b,0x1246c,0x1246d,0x1246e,0x1246f,0x12470,0x12471,
-0x12472,0x12473,0x12474,0x12142,0x1225e,0x12143,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,
-0x12266,0x12267,0x00000,0x00000,0x00000,0x12264};
-
-static const int ucs_r_cns11643_table_min = 0xfe00;
-static const int ucs_r_cns11643_table_max = 0xfe00 + (sizeof (ucs_r_cns11643_table) / sizeof (unsigned int));
-
-
-/* Big5 -> UCS */
-static const unsigned short big5_ucs_table[] = {
-0x3000,0xff0c,0x3001,0x3002,0xff0e,0x2027,0xff1b,0xff1a,
-0xff1f,0xff01,0xfe30,0x2026,0x2025,0xfe50,0xfe51,0xfe52,
-0x00b7,0xfe54,0xfe55,0xfe56,0xfe57,0xff5c,0x2013,0xfe31,
-0x2014,0xfe33,0x2574,0xfe34,0xfe4f,0xff08,0xff09,0xfe35,
-0xfe36,0xff5b,0xff5d,0xfe37,0xfe38,0x3014,0x3015,0xfe39,
-0xfe3a,0x3010,0x3011,0xfe3b,0xfe3c,0x300a,0x300b,0xfe3d,
-0xfe3e,0x3008,0x3009,0xfe3f,0xfe40,0x300c,0x300d,0xfe41,
-0xfe42,0x300e,0x300f,0xfe43,0xfe44,0xfe59,0xfe5a,0xfe5b,
-0xfe5c,0xfe5d,0xfe5e,0x2018,0x2019,0x201c,0x201d,0x301d,
-0x301e,0x2035,0x2032,0xff03,0xff06,0xff0a,0x203b,0x00a7,
-0x3003,0x25cb,0x25cf,0x25b3,0x25b2,0x25ce,0x2606,0x2605,
-0x25c7,0x25c6,0x25a1,0x25a0,0x25bd,0x25bc,0x32a3,0x2105,
-0x00af,0xffe3,0xff3f,0x02cd,0xfe49,0xfe4a,0xfe4d,0xfe4e,
-0xfe4b,0xfe4c,0xfe5f,0xfe60,0xfe61,0xff0b,0xff0d,0x00d7,
-0x00f7,0x00b1,0x221a,0xff1c,0xff1e,0xff1d,0x2266,0x2267,
-0x2260,0x221e,0x2252,0x2261,0xfe62,0xfe63,0xfe64,0xfe65,
-0xfe66,0xff5e,0x2229,0x222a,0x22a5,0x2220,0x221f,0x22bf,
-0x33d2,0x33d1,0x222b,0x222e,0x2235,0x2234,0x2640,0x2642,
-0x2295,0x2299,0x2191,0x2193,0x2190,0x2192,0x2196,0x2197,
-0x2199,0x2198,0x2225,0x2223,0xff0f,0xff3c,0x2215,0xfe68,
-0xff04,0xffe5,0x3012,0xffe0,0xffe1,0xff05,0xff20,0x2103,
-0x2109,0xfe69,0xfe6a,0xfe6b,0x33d5,0x339c,0x339d,0x339e,
-0x33ce,0x33a1,0x338e,0x338f,0x33c4,0x00b0,0x5159,0x515b,
-0x515e,0x515d,0x5161,0x5163,0x55e7,0x74e9,0x7cce,0x2581,
-0x2582,0x2583,0x2584,0x2585,0x2586,0x2587,0x2588,0x258f,
-0x258e,0x258d,0x258c,0x258b,0x258a,0x2589,0x253c,0x2534,
-0x252c,0x2524,0x251c,0x2594,0x2500,0x2502,0x2595,0x250c,
-0x2510,0x2514,0x2518,0x256d,0x256e,0x2570,0x256f,0x2550,
-0x255e,0x256a,0x2561,0x25e2,0x25e3,0x25e5,0x25e4,0x2571,
-0x2572,0x2573,0xff10,0xff11,0xff12,0xff13,0xff14,0xff15,
-0xff16,0xff17,0xff18,0xff19,0x2160,0x2161,0x2162,0x2163,
-0x2164,0x2165,0x2166,0x2167,0x2168,0x2169,0x3021,0x3022,
-0x3023,0x3024,0x3025,0x3026,0x3027,0x3028,0x3029,0x5341,
-0x5344,0x5345,0xff21,0xff22,0xff23,0xff24,0xff25,0xff26,
-0xff27,0xff28,0xff29,0xff2a,0xff2b,0xff2c,0xff2d,0xff2e,
-0xff2f,0xff30,0xff31,0xff32,0xff33,0xff34,0xff35,0xff36,
-0xff37,0xff38,0xff39,0xff3a,0xff41,0xff42,0xff43,0xff44,
-0xff45,0xff46,0xff47,0xff48,0xff49,0xff4a,0xff4b,0xff4c,
-0xff4d,0xff4e,0xff4f,0xff50,0xff51,0xff52,0xff53,0xff54,
-0xff55,0xff56,0xff57,0xff58,0xff59,0xff5a,0x0391,0x0392,
-0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,0x0399,0x039a,
-0x039b,0x039c,0x039d,0x039e,0x039f,0x03a0,0x03a1,0x03a3,
-0x03a4,0x03a5,0x03a6,0x03a7,0x03a8,0x03a9,0x03b1,0x03b2,
-0x03b3,0x03b4,0x03b5,0x03b6,0x03b7,0x03b8,0x03b9,0x03ba,
-0x03bb,0x03bc,0x03bd,0x03be,0x03bf,0x03c0,0x03c1,0x03c3,
-0x03c4,0x03c5,0x03c6,0x03c7,0x03c8,0x03c9,0x3105,0x3106,
-0x3107,0x3108,0x3109,0x310a,0x310b,0x310c,0x310d,0x310e,
-0x310f,0x3110,0x3111,0x3112,0x3113,0x3114,0x3115,0x3116,
-0x3117,0x3118,0x3119,0x311a,0x311b,0x311c,0x311d,0x311e,
-0x311f,0x3120,0x3121,0x3122,0x3123,0x3124,0x3125,0x3126,
-0x3127,0x3128,0x3129,0x02d9,0x02c9,0x02ca,0x02c7,0x02cb,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x20ac,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x4e00,
-0x4e59,0x4e01,0x4e03,0x4e43,0x4e5d,0x4e86,0x4e8c,0x4eba,
-0x513f,0x5165,0x516b,0x51e0,0x5200,0x5201,0x529b,0x5315,
-0x5341,0x535c,0x53c8,0x4e09,0x4e0b,0x4e08,0x4e0a,0x4e2b,
-0x4e38,0x51e1,0x4e45,0x4e48,0x4e5f,0x4e5e,0x4e8e,0x4ea1,
-0x5140,0x5203,0x52fa,0x5343,0x53c9,0x53e3,0x571f,0x58eb,
-0x5915,0x5927,0x5973,0x5b50,0x5b51,0x5b53,0x5bf8,0x5c0f,
-0x5c22,0x5c38,0x5c71,0x5ddd,0x5de5,0x5df1,0x5df2,0x5df3,
-0x5dfe,0x5e72,0x5efe,0x5f0b,0x5f13,0x624d,0x4e11,0x4e10,
-0x4e0d,0x4e2d,0x4e30,0x4e39,0x4e4b,0x5c39,0x4e88,0x4e91,
-0x4e95,0x4e92,0x4e94,0x4ea2,0x4ec1,0x4ec0,0x4ec3,0x4ec6,
-0x4ec7,0x4ecd,0x4eca,0x4ecb,0x4ec4,0x5143,0x5141,0x5167,
-0x516d,0x516e,0x516c,0x5197,0x51f6,0x5206,0x5207,0x5208,
-0x52fb,0x52fe,0x52ff,0x5316,0x5339,0x5348,0x5347,0x5345,
-0x535e,0x5384,0x53cb,0x53ca,0x53cd,0x58ec,0x5929,0x592b,
-0x592a,0x592d,0x5b54,0x5c11,0x5c24,0x5c3a,0x5c6f,0x5df4,
-0x5e7b,0x5eff,0x5f14,0x5f15,0x5fc3,0x6208,0x6236,0x624b,
-0x624e,0x652f,0x6587,0x6597,0x65a4,0x65b9,0x65e5,0x66f0,
-0x6708,0x6728,0x6b20,0x6b62,0x6b79,0x6bcb,0x6bd4,0x6bdb,
-0x6c0f,0x6c34,0x706b,0x722a,0x7236,0x723b,0x7247,0x7259,
-0x725b,0x72ac,0x738b,0x4e19,0x4e16,0x4e15,0x4e14,0x4e18,
-0x4e3b,0x4e4d,0x4e4f,0x4e4e,0x4ee5,0x4ed8,0x4ed4,0x4ed5,
-0x4ed6,0x4ed7,0x4ee3,0x4ee4,0x4ed9,0x4ede,0x5145,0x5144,
-0x5189,0x518a,0x51ac,0x51f9,0x51fa,0x51f8,0x520a,0x52a0,
-0x529f,0x5305,0x5306,0x5317,0x531d,0x4edf,0x534a,0x5349,
-0x5361,0x5360,0x536f,0x536e,0x53bb,0x53ef,0x53e4,0x53f3,
-0x53ec,0x53ee,0x53e9,0x53e8,0x53fc,0x53f8,0x53f5,0x53eb,
-0x53e6,0x53ea,0x53f2,0x53f1,0x53f0,0x53e5,0x53ed,0x53fb,
-0x56db,0x56da,0x5916,0x592e,0x5931,0x5974,0x5976,0x5b55,
-0x5b83,0x5c3c,0x5de8,0x5de7,0x5de6,0x5e02,0x5e03,0x5e73,
-0x5e7c,0x5f01,0x5f18,0x5f17,0x5fc5,0x620a,0x6253,0x6254,
-0x6252,0x6251,0x65a5,0x65e6,0x672e,0x672c,0x672a,0x672b,
-0x672d,0x6b63,0x6bcd,0x6c11,0x6c10,0x6c38,0x6c41,0x6c40,
-0x6c3e,0x72af,0x7384,0x7389,0x74dc,0x74e6,0x7518,0x751f,
-0x7528,0x7529,0x7530,0x7531,0x7532,0x7533,0x758b,0x767d,
-0x76ae,0x76bf,0x76ee,0x77db,0x77e2,0x77f3,0x793a,0x79be,
-0x7a74,0x7acb,0x4e1e,0x4e1f,0x4e52,0x4e53,0x4e69,0x4e99,
-0x4ea4,0x4ea6,0x4ea5,0x4eff,0x4f09,0x4f19,0x4f0a,0x4f15,
-0x4f0d,0x4f10,0x4f11,0x4f0f,0x4ef2,0x4ef6,0x4efb,0x4ef0,
-0x4ef3,0x4efd,0x4f01,0x4f0b,0x5149,0x5147,0x5146,0x5148,
-0x5168,0x5171,0x518d,0x51b0,0x5217,0x5211,0x5212,0x520e,
-0x5216,0x52a3,0x5308,0x5321,0x5320,0x5370,0x5371,0x5409,
-0x540f,0x540c,0x540a,0x5410,0x5401,0x540b,0x5404,0x5411,
-0x540d,0x5408,0x5403,0x540e,0x5406,0x5412,0x56e0,0x56de,
-0x56dd,0x5733,0x5730,0x5728,0x572d,0x572c,0x572f,0x5729,
-0x5919,0x591a,0x5937,0x5938,0x5984,0x5978,0x5983,0x597d,
-0x5979,0x5982,0x5981,0x5b57,0x5b58,0x5b87,0x5b88,0x5b85,
-0x5b89,0x5bfa,0x5c16,0x5c79,0x5dde,0x5e06,0x5e76,0x5e74,
-0x5f0f,0x5f1b,0x5fd9,0x5fd6,0x620e,0x620c,0x620d,0x6210,
-0x6263,0x625b,0x6258,0x6536,0x65e9,0x65e8,0x65ec,0x65ed,
-0x66f2,0x66f3,0x6709,0x673d,0x6734,0x6731,0x6735,0x6b21,
-0x6b64,0x6b7b,0x6c16,0x6c5d,0x6c57,0x6c59,0x6c5f,0x6c60,
-0x6c50,0x6c55,0x6c61,0x6c5b,0x6c4d,0x6c4e,0x7070,0x725f,
-0x725d,0x767e,0x7af9,0x7c73,0x7cf8,0x7f36,0x7f8a,0x7fbd,
-0x8001,0x8003,0x800c,0x8012,0x8033,0x807f,0x8089,0x808b,
-0x808c,0x81e3,0x81ea,0x81f3,0x81fc,0x820c,0x821b,0x821f,
-0x826e,0x8272,0x827e,0x866b,0x8840,0x884c,0x8863,0x897f,
-0x9621,0x4e32,0x4ea8,0x4f4d,0x4f4f,0x4f47,0x4f57,0x4f5e,
-0x4f34,0x4f5b,0x4f55,0x4f30,0x4f50,0x4f51,0x4f3d,0x4f3a,
-0x4f38,0x4f43,0x4f54,0x4f3c,0x4f46,0x4f63,0x4f5c,0x4f60,
-0x4f2f,0x4f4e,0x4f36,0x4f59,0x4f5d,0x4f48,0x4f5a,0x514c,
-0x514b,0x514d,0x5175,0x51b6,0x51b7,0x5225,0x5224,0x5229,
-0x522a,0x5228,0x52ab,0x52a9,0x52aa,0x52ac,0x5323,0x5373,
-0x5375,0x541d,0x542d,0x541e,0x543e,0x5426,0x544e,0x5427,
-0x5446,0x5443,0x5433,0x5448,0x5442,0x541b,0x5429,0x544a,
-0x5439,0x543b,0x5438,0x542e,0x5435,0x5436,0x5420,0x543c,
-0x5440,0x5431,0x542b,0x541f,0x542c,0x56ea,0x56f0,0x56e4,
-0x56eb,0x574a,0x5751,0x5740,0x574d,0x5747,0x574e,0x573e,
-0x5750,0x574f,0x573b,0x58ef,0x593e,0x599d,0x5992,0x59a8,
-0x599e,0x59a3,0x5999,0x5996,0x598d,0x59a4,0x5993,0x598a,
-0x59a5,0x5b5d,0x5b5c,0x5b5a,0x5b5b,0x5b8c,0x5b8b,0x5b8f,
-0x5c2c,0x5c40,0x5c41,0x5c3f,0x5c3e,0x5c90,0x5c91,0x5c94,
-0x5c8c,0x5deb,0x5e0c,0x5e8f,0x5e87,0x5e8a,0x5ef7,0x5f04,
-0x5f1f,0x5f64,0x5f62,0x5f77,0x5f79,0x5fd8,0x5fcc,0x5fd7,
-0x5fcd,0x5ff1,0x5feb,0x5ff8,0x5fea,0x6212,0x6211,0x6284,
-0x6297,0x6296,0x6280,0x6276,0x6289,0x626d,0x628a,0x627c,
-0x627e,0x6279,0x6273,0x6292,0x626f,0x6298,0x626e,0x6295,
-0x6293,0x6291,0x6286,0x6539,0x653b,0x6538,0x65f1,0x66f4,
-0x675f,0x674e,0x674f,0x6750,0x6751,0x675c,0x6756,0x675e,
-0x6749,0x6746,0x6760,0x6753,0x6757,0x6b65,0x6bcf,0x6c42,
-0x6c5e,0x6c99,0x6c81,0x6c88,0x6c89,0x6c85,0x6c9b,0x6c6a,
-0x6c7a,0x6c90,0x6c70,0x6c8c,0x6c68,0x6c96,0x6c92,0x6c7d,
-0x6c83,0x6c72,0x6c7e,0x6c74,0x6c86,0x6c76,0x6c8d,0x6c94,
-0x6c98,0x6c82,0x7076,0x707c,0x707d,0x7078,0x7262,0x7261,
-0x7260,0x72c4,0x72c2,0x7396,0x752c,0x752b,0x7537,0x7538,
-0x7682,0x76ef,0x77e3,0x79c1,0x79c0,0x79bf,0x7a76,0x7cfb,
-0x7f55,0x8096,0x8093,0x809d,0x8098,0x809b,0x809a,0x80b2,
-0x826f,0x8292,0x828b,0x828d,0x898b,0x89d2,0x8a00,0x8c37,
-0x8c46,0x8c55,0x8c9d,0x8d64,0x8d70,0x8db3,0x8eab,0x8eca,
-0x8f9b,0x8fb0,0x8fc2,0x8fc6,0x8fc5,0x8fc4,0x5de1,0x9091,
-0x90a2,0x90aa,0x90a6,0x90a3,0x9149,0x91c6,0x91cc,0x9632,
-0x962e,0x9631,0x962a,0x962c,0x4e26,0x4e56,0x4e73,0x4e8b,
-0x4e9b,0x4e9e,0x4eab,0x4eac,0x4f6f,0x4f9d,0x4f8d,0x4f73,
-0x4f7f,0x4f6c,0x4f9b,0x4f8b,0x4f86,0x4f83,0x4f70,0x4f75,
-0x4f88,0x4f69,0x4f7b,0x4f96,0x4f7e,0x4f8f,0x4f91,0x4f7a,
-0x5154,0x5152,0x5155,0x5169,0x5177,0x5176,0x5178,0x51bd,
-0x51fd,0x523b,0x5238,0x5237,0x523a,0x5230,0x522e,0x5236,
-0x5241,0x52be,0x52bb,0x5352,0x5354,0x5353,0x5351,0x5366,
-0x5377,0x5378,0x5379,0x53d6,0x53d4,0x53d7,0x5473,0x5475,
-0x5496,0x5478,0x5495,0x5480,0x547b,0x5477,0x5484,0x5492,
-0x5486,0x547c,0x5490,0x5471,0x5476,0x548c,0x549a,0x5462,
-0x5468,0x548b,0x547d,0x548e,0x56fa,0x5783,0x5777,0x576a,
-0x5769,0x5761,0x5766,0x5764,0x577c,0x591c,0x5949,0x5947,
-0x5948,0x5944,0x5954,0x59be,0x59bb,0x59d4,0x59b9,0x59ae,
-0x59d1,0x59c6,0x59d0,0x59cd,0x59cb,0x59d3,0x59ca,0x59af,
-0x59b3,0x59d2,0x59c5,0x5b5f,0x5b64,0x5b63,0x5b97,0x5b9a,
-0x5b98,0x5b9c,0x5b99,0x5b9b,0x5c1a,0x5c48,0x5c45,0x5c46,
-0x5cb7,0x5ca1,0x5cb8,0x5ca9,0x5cab,0x5cb1,0x5cb3,0x5e18,
-0x5e1a,0x5e16,0x5e15,0x5e1b,0x5e11,0x5e78,0x5e9a,0x5e97,
-0x5e9c,0x5e95,0x5e96,0x5ef6,0x5f26,0x5f27,0x5f29,0x5f80,
-0x5f81,0x5f7f,0x5f7c,0x5fdd,0x5fe0,0x5ffd,0x5ff5,0x5fff,
-0x600f,0x6014,0x602f,0x6035,0x6016,0x602a,0x6015,0x6021,
-0x6027,0x6029,0x602b,0x601b,0x6216,0x6215,0x623f,0x623e,
-0x6240,0x627f,0x62c9,0x62cc,0x62c4,0x62bf,0x62c2,0x62b9,
-0x62d2,0x62db,0x62ab,0x62d3,0x62d4,0x62cb,0x62c8,0x62a8,
-0x62bd,0x62bc,0x62d0,0x62d9,0x62c7,0x62cd,0x62b5,0x62da,
-0x62b1,0x62d8,0x62d6,0x62d7,0x62c6,0x62ac,0x62ce,0x653e,
-0x65a7,0x65bc,0x65fa,0x6614,0x6613,0x660c,0x6606,0x6602,
-0x660e,0x6600,0x660f,0x6615,0x660a,0x6607,0x670d,0x670b,
-0x676d,0x678b,0x6795,0x6771,0x679c,0x6773,0x6777,0x6787,
-0x679d,0x6797,0x676f,0x6770,0x677f,0x6789,0x677e,0x6790,
-0x6775,0x679a,0x6793,0x677c,0x676a,0x6772,0x6b23,0x6b66,
-0x6b67,0x6b7f,0x6c13,0x6c1b,0x6ce3,0x6ce8,0x6cf3,0x6cb1,
-0x6ccc,0x6ce5,0x6cb3,0x6cbd,0x6cbe,0x6cbc,0x6ce2,0x6cab,
-0x6cd5,0x6cd3,0x6cb8,0x6cc4,0x6cb9,0x6cc1,0x6cae,0x6cd7,
-0x6cc5,0x6cf1,0x6cbf,0x6cbb,0x6ce1,0x6cdb,0x6cca,0x6cac,
-0x6cef,0x6cdc,0x6cd6,0x6ce0,0x7095,0x708e,0x7092,0x708a,
-0x7099,0x722c,0x722d,0x7238,0x7248,0x7267,0x7269,0x72c0,
-0x72ce,0x72d9,0x72d7,0x72d0,0x73a9,0x73a8,0x739f,0x73ab,
-0x73a5,0x753d,0x759d,0x7599,0x759a,0x7684,0x76c2,0x76f2,
-0x76f4,0x77e5,0x77fd,0x793e,0x7940,0x7941,0x79c9,0x79c8,
-0x7a7a,0x7a79,0x7afa,0x7cfe,0x7f54,0x7f8c,0x7f8b,0x8005,
-0x80ba,0x80a5,0x80a2,0x80b1,0x80a1,0x80ab,0x80a9,0x80b4,
-0x80aa,0x80af,0x81e5,0x81fe,0x820d,0x82b3,0x829d,0x8299,
-0x82ad,0x82bd,0x829f,0x82b9,0x82b1,0x82ac,0x82a5,0x82af,
-0x82b8,0x82a3,0x82b0,0x82be,0x82b7,0x864e,0x8671,0x521d,
-0x8868,0x8ecb,0x8fce,0x8fd4,0x8fd1,0x90b5,0x90b8,0x90b1,
-0x90b6,0x91c7,0x91d1,0x9577,0x9580,0x961c,0x9640,0x963f,
-0x963b,0x9644,0x9642,0x96b9,0x96e8,0x9752,0x975e,0x4e9f,
-0x4ead,0x4eae,0x4fe1,0x4fb5,0x4faf,0x4fbf,0x4fe0,0x4fd1,
-0x4fcf,0x4fdd,0x4fc3,0x4fb6,0x4fd8,0x4fdf,0x4fca,0x4fd7,
-0x4fae,0x4fd0,0x4fc4,0x4fc2,0x4fda,0x4fce,0x4fde,0x4fb7,
-0x5157,0x5192,0x5191,0x51a0,0x524e,0x5243,0x524a,0x524d,
-0x524c,0x524b,0x5247,0x52c7,0x52c9,0x52c3,0x52c1,0x530d,
-0x5357,0x537b,0x539a,0x53db,0x54ac,0x54c0,0x54a8,0x54ce,
-0x54c9,0x54b8,0x54a6,0x54b3,0x54c7,0x54c2,0x54bd,0x54aa,
-0x54c1,0x54c4,0x54c8,0x54af,0x54ab,0x54b1,0x54bb,0x54a9,
-0x54a7,0x54bf,0x56ff,0x5782,0x578b,0x57a0,0x57a3,0x57a2,
-0x57ce,0x57ae,0x5793,0x5955,0x5951,0x594f,0x594e,0x5950,
-0x59dc,0x59d8,0x59ff,0x59e3,0x59e8,0x5a03,0x59e5,0x59ea,
-0x59da,0x59e6,0x5a01,0x59fb,0x5b69,0x5ba3,0x5ba6,0x5ba4,
-0x5ba2,0x5ba5,0x5c01,0x5c4e,0x5c4f,0x5c4d,0x5c4b,0x5cd9,
-0x5cd2,0x5df7,0x5e1d,0x5e25,0x5e1f,0x5e7d,0x5ea0,0x5ea6,
-0x5efa,0x5f08,0x5f2d,0x5f65,0x5f88,0x5f85,0x5f8a,0x5f8b,
-0x5f87,0x5f8c,0x5f89,0x6012,0x601d,0x6020,0x6025,0x600e,
-0x6028,0x604d,0x6070,0x6068,0x6062,0x6046,0x6043,0x606c,
-0x606b,0x606a,0x6064,0x6241,0x62dc,0x6316,0x6309,0x62fc,
-0x62ed,0x6301,0x62ee,0x62fd,0x6307,0x62f1,0x62f7,0x62ef,
-0x62ec,0x62fe,0x62f4,0x6311,0x6302,0x653f,0x6545,0x65ab,
-0x65bd,0x65e2,0x6625,0x662d,0x6620,0x6627,0x662f,0x661f,
-0x6628,0x6631,0x6624,0x66f7,0x67ff,0x67d3,0x67f1,0x67d4,
-0x67d0,0x67ec,0x67b6,0x67af,0x67f5,0x67e9,0x67ef,0x67c4,
-0x67d1,0x67b4,0x67da,0x67e5,0x67b8,0x67cf,0x67de,0x67f3,
-0x67b0,0x67d9,0x67e2,0x67dd,0x67d2,0x6b6a,0x6b83,0x6b86,
-0x6bb5,0x6bd2,0x6bd7,0x6c1f,0x6cc9,0x6d0b,0x6d32,0x6d2a,
-0x6d41,0x6d25,0x6d0c,0x6d31,0x6d1e,0x6d17,0x6d3b,0x6d3d,
-0x6d3e,0x6d36,0x6d1b,0x6cf5,0x6d39,0x6d27,0x6d38,0x6d29,
-0x6d2e,0x6d35,0x6d0e,0x6d2b,0x70ab,0x70ba,0x70b3,0x70ac,
-0x70af,0x70ad,0x70b8,0x70ae,0x70a4,0x7230,0x7272,0x726f,
-0x7274,0x72e9,0x72e0,0x72e1,0x73b7,0x73ca,0x73bb,0x73b2,
-0x73cd,0x73c0,0x73b3,0x751a,0x752d,0x754f,0x754c,0x754e,
-0x754b,0x75ab,0x75a4,0x75a5,0x75a2,0x75a3,0x7678,0x7686,
-0x7687,0x7688,0x76c8,0x76c6,0x76c3,0x76c5,0x7701,0x76f9,
-0x76f8,0x7709,0x770b,0x76fe,0x76fc,0x7707,0x77dc,0x7802,
-0x7814,0x780c,0x780d,0x7946,0x7949,0x7948,0x7947,0x79b9,
-0x79ba,0x79d1,0x79d2,0x79cb,0x7a7f,0x7a81,0x7aff,0x7afd,
-0x7c7d,0x7d02,0x7d05,0x7d00,0x7d09,0x7d07,0x7d04,0x7d06,
-0x7f38,0x7f8e,0x7fbf,0x8004,0x8010,0x800d,0x8011,0x8036,
-0x80d6,0x80e5,0x80da,0x80c3,0x80c4,0x80cc,0x80e1,0x80db,
-0x80ce,0x80de,0x80e4,0x80dd,0x81f4,0x8222,0x82e7,0x8303,
-0x8305,0x82e3,0x82db,0x82e6,0x8304,0x82e5,0x8302,0x8309,
-0x82d2,0x82d7,0x82f1,0x8301,0x82dc,0x82d4,0x82d1,0x82de,
-0x82d3,0x82df,0x82ef,0x8306,0x8650,0x8679,0x867b,0x867a,
-0x884d,0x886b,0x8981,0x89d4,0x8a08,0x8a02,0x8a03,0x8c9e,
-0x8ca0,0x8d74,0x8d73,0x8db4,0x8ecd,0x8ecc,0x8ff0,0x8fe6,
-0x8fe2,0x8fea,0x8fe5,0x8fed,0x8feb,0x8fe4,0x8fe8,0x90ca,
-0x90ce,0x90c1,0x90c3,0x914b,0x914a,0x91cd,0x9582,0x9650,
-0x964b,0x964c,0x964d,0x9762,0x9769,0x97cb,0x97ed,0x97f3,
-0x9801,0x98a8,0x98db,0x98df,0x9996,0x9999,0x4e58,0x4eb3,
-0x500c,0x500d,0x5023,0x4fef,0x5026,0x5025,0x4ff8,0x5029,
-0x5016,0x5006,0x503c,0x501f,0x501a,0x5012,0x5011,0x4ffa,
-0x5000,0x5014,0x5028,0x4ff1,0x5021,0x500b,0x5019,0x5018,
-0x4ff3,0x4fee,0x502d,0x502a,0x4ffe,0x502b,0x5009,0x517c,
-0x51a4,0x51a5,0x51a2,0x51cd,0x51cc,0x51c6,0x51cb,0x5256,
-0x525c,0x5254,0x525b,0x525d,0x532a,0x537f,0x539f,0x539d,
-0x53df,0x54e8,0x5510,0x5501,0x5537,0x54fc,0x54e5,0x54f2,
-0x5506,0x54fa,0x5514,0x54e9,0x54ed,0x54e1,0x5509,0x54ee,
-0x54ea,0x54e6,0x5527,0x5507,0x54fd,0x550f,0x5703,0x5704,
-0x57c2,0x57d4,0x57cb,0x57c3,0x5809,0x590f,0x5957,0x5958,
-0x595a,0x5a11,0x5a18,0x5a1c,0x5a1f,0x5a1b,0x5a13,0x59ec,
-0x5a20,0x5a23,0x5a29,0x5a25,0x5a0c,0x5a09,0x5b6b,0x5c58,
-0x5bb0,0x5bb3,0x5bb6,0x5bb4,0x5bae,0x5bb5,0x5bb9,0x5bb8,
-0x5c04,0x5c51,0x5c55,0x5c50,0x5ced,0x5cfd,0x5cfb,0x5cea,
-0x5ce8,0x5cf0,0x5cf6,0x5d01,0x5cf4,0x5dee,0x5e2d,0x5e2b,
-0x5eab,0x5ead,0x5ea7,0x5f31,0x5f92,0x5f91,0x5f90,0x6059,
-0x6063,0x6065,0x6050,0x6055,0x606d,0x6069,0x606f,0x6084,
-0x609f,0x609a,0x608d,0x6094,0x608c,0x6085,0x6096,0x6247,
-0x62f3,0x6308,0x62ff,0x634e,0x633e,0x632f,0x6355,0x6342,
-0x6346,0x634f,0x6349,0x633a,0x6350,0x633d,0x632a,0x632b,
-0x6328,0x634d,0x634c,0x6548,0x6549,0x6599,0x65c1,0x65c5,
-0x6642,0x6649,0x664f,0x6643,0x6652,0x664c,0x6645,0x6641,
-0x66f8,0x6714,0x6715,0x6717,0x6821,0x6838,0x6848,0x6846,
-0x6853,0x6839,0x6842,0x6854,0x6829,0x68b3,0x6817,0x684c,
-0x6851,0x683d,0x67f4,0x6850,0x6840,0x683c,0x6843,0x682a,
-0x6845,0x6813,0x6818,0x6841,0x6b8a,0x6b89,0x6bb7,0x6c23,
-0x6c27,0x6c28,0x6c26,0x6c24,0x6cf0,0x6d6a,0x6d95,0x6d88,
-0x6d87,0x6d66,0x6d78,0x6d77,0x6d59,0x6d93,0x6d6c,0x6d89,
-0x6d6e,0x6d5a,0x6d74,0x6d69,0x6d8c,0x6d8a,0x6d79,0x6d85,
-0x6d65,0x6d94,0x70ca,0x70d8,0x70e4,0x70d9,0x70c8,0x70cf,
-0x7239,0x7279,0x72fc,0x72f9,0x72fd,0x72f8,0x72f7,0x7386,
-0x73ed,0x7409,0x73ee,0x73e0,0x73ea,0x73de,0x7554,0x755d,
-0x755c,0x755a,0x7559,0x75be,0x75c5,0x75c7,0x75b2,0x75b3,
-0x75bd,0x75bc,0x75b9,0x75c2,0x75b8,0x768b,0x76b0,0x76ca,
-0x76cd,0x76ce,0x7729,0x771f,0x7720,0x7728,0x77e9,0x7830,
-0x7827,0x7838,0x781d,0x7834,0x7837,0x7825,0x782d,0x7820,
-0x781f,0x7832,0x7955,0x7950,0x7960,0x795f,0x7956,0x795e,
-0x795d,0x7957,0x795a,0x79e4,0x79e3,0x79e7,0x79df,0x79e6,
-0x79e9,0x79d8,0x7a84,0x7a88,0x7ad9,0x7b06,0x7b11,0x7c89,
-0x7d21,0x7d17,0x7d0b,0x7d0a,0x7d20,0x7d22,0x7d14,0x7d10,
-0x7d15,0x7d1a,0x7d1c,0x7d0d,0x7d19,0x7d1b,0x7f3a,0x7f5f,
-0x7f94,0x7fc5,0x7fc1,0x8006,0x8018,0x8015,0x8019,0x8017,
-0x803d,0x803f,0x80f1,0x8102,0x80f0,0x8105,0x80ed,0x80f4,
-0x8106,0x80f8,0x80f3,0x8108,0x80fd,0x810a,0x80fc,0x80ef,
-0x81ed,0x81ec,0x8200,0x8210,0x822a,0x822b,0x8228,0x822c,
-0x82bb,0x832b,0x8352,0x8354,0x834a,0x8338,0x8350,0x8349,
-0x8335,0x8334,0x834f,0x8332,0x8339,0x8336,0x8317,0x8340,
-0x8331,0x8328,0x8343,0x8654,0x868a,0x86aa,0x8693,0x86a4,
-0x86a9,0x868c,0x86a3,0x869c,0x8870,0x8877,0x8881,0x8882,
-0x887d,0x8879,0x8a18,0x8a10,0x8a0e,0x8a0c,0x8a15,0x8a0a,
-0x8a17,0x8a13,0x8a16,0x8a0f,0x8a11,0x8c48,0x8c7a,0x8c79,
-0x8ca1,0x8ca2,0x8d77,0x8eac,0x8ed2,0x8ed4,0x8ecf,0x8fb1,
-0x9001,0x9006,0x8ff7,0x9000,0x8ffa,0x8ff4,0x9003,0x8ffd,
-0x9005,0x8ff8,0x9095,0x90e1,0x90dd,0x90e2,0x9152,0x914d,
-0x914c,0x91d8,0x91dd,0x91d7,0x91dc,0x91d9,0x9583,0x9662,
-0x9663,0x9661,0x965b,0x965d,0x9664,0x9658,0x965e,0x96bb,
-0x98e2,0x99ac,0x9aa8,0x9ad8,0x9b25,0x9b32,0x9b3c,0x4e7e,
-0x507a,0x507d,0x505c,0x5047,0x5043,0x504c,0x505a,0x5049,
-0x5065,0x5076,0x504e,0x5055,0x5075,0x5074,0x5077,0x504f,
-0x500f,0x506f,0x506d,0x515c,0x5195,0x51f0,0x526a,0x526f,
-0x52d2,0x52d9,0x52d8,0x52d5,0x5310,0x530f,0x5319,0x533f,
-0x5340,0x533e,0x53c3,0x66fc,0x5546,0x556a,0x5566,0x5544,
-0x555e,0x5561,0x5543,0x554a,0x5531,0x5556,0x554f,0x5555,
-0x552f,0x5564,0x5538,0x552e,0x555c,0x552c,0x5563,0x5533,
-0x5541,0x5557,0x5708,0x570b,0x5709,0x57df,0x5805,0x580a,
-0x5806,0x57e0,0x57e4,0x57fa,0x5802,0x5835,0x57f7,0x57f9,
-0x5920,0x5962,0x5a36,0x5a41,0x5a49,0x5a66,0x5a6a,0x5a40,
-0x5a3c,0x5a62,0x5a5a,0x5a46,0x5a4a,0x5b70,0x5bc7,0x5bc5,
-0x5bc4,0x5bc2,0x5bbf,0x5bc6,0x5c09,0x5c08,0x5c07,0x5c60,
-0x5c5c,0x5c5d,0x5d07,0x5d06,0x5d0e,0x5d1b,0x5d16,0x5d22,
-0x5d11,0x5d29,0x5d14,0x5d19,0x5d24,0x5d27,0x5d17,0x5de2,
-0x5e38,0x5e36,0x5e33,0x5e37,0x5eb7,0x5eb8,0x5eb6,0x5eb5,
-0x5ebe,0x5f35,0x5f37,0x5f57,0x5f6c,0x5f69,0x5f6b,0x5f97,
-0x5f99,0x5f9e,0x5f98,0x5fa1,0x5fa0,0x5f9c,0x607f,0x60a3,
-0x6089,0x60a0,0x60a8,0x60cb,0x60b4,0x60e6,0x60bd,0x60c5,
-0x60bb,0x60b5,0x60dc,0x60bc,0x60d8,0x60d5,0x60c6,0x60df,
-0x60b8,0x60da,0x60c7,0x621a,0x621b,0x6248,0x63a0,0x63a7,
-0x6372,0x6396,0x63a2,0x63a5,0x6377,0x6367,0x6398,0x63aa,
-0x6371,0x63a9,0x6389,0x6383,0x639b,0x636b,0x63a8,0x6384,
-0x6388,0x6399,0x63a1,0x63ac,0x6392,0x638f,0x6380,0x637b,
-0x6369,0x6368,0x637a,0x655d,0x6556,0x6551,0x6559,0x6557,
-0x555f,0x654f,0x6558,0x6555,0x6554,0x659c,0x659b,0x65ac,
-0x65cf,0x65cb,0x65cc,0x65ce,0x665d,0x665a,0x6664,0x6668,
-0x6666,0x665e,0x66f9,0x52d7,0x671b,0x6881,0x68af,0x68a2,
-0x6893,0x68b5,0x687f,0x6876,0x68b1,0x68a7,0x6897,0x68b0,
-0x6883,0x68c4,0x68ad,0x6886,0x6885,0x6894,0x689d,0x68a8,
-0x689f,0x68a1,0x6882,0x6b32,0x6bba,0x6beb,0x6bec,0x6c2b,
-0x6d8e,0x6dbc,0x6df3,0x6dd9,0x6db2,0x6de1,0x6dcc,0x6de4,
-0x6dfb,0x6dfa,0x6e05,0x6dc7,0x6dcb,0x6daf,0x6dd1,0x6dae,
-0x6dde,0x6df9,0x6db8,0x6df7,0x6df5,0x6dc5,0x6dd2,0x6e1a,
-0x6db5,0x6dda,0x6deb,0x6dd8,0x6dea,0x6df1,0x6dee,0x6de8,
-0x6dc6,0x6dc4,0x6daa,0x6dec,0x6dbf,0x6de6,0x70f9,0x7109,
-0x710a,0x70fd,0x70ef,0x723d,0x727d,0x7281,0x731c,0x731b,
-0x7316,0x7313,0x7319,0x7387,0x7405,0x740a,0x7403,0x7406,
-0x73fe,0x740d,0x74e0,0x74f6,0x74f7,0x751c,0x7522,0x7565,
-0x7566,0x7562,0x7570,0x758f,0x75d4,0x75d5,0x75b5,0x75ca,
-0x75cd,0x768e,0x76d4,0x76d2,0x76db,0x7737,0x773e,0x773c,
-0x7736,0x7738,0x773a,0x786b,0x7843,0x784e,0x7965,0x7968,
-0x796d,0x79fb,0x7a92,0x7a95,0x7b20,0x7b28,0x7b1b,0x7b2c,
-0x7b26,0x7b19,0x7b1e,0x7b2e,0x7c92,0x7c97,0x7c95,0x7d46,
-0x7d43,0x7d71,0x7d2e,0x7d39,0x7d3c,0x7d40,0x7d30,0x7d33,
-0x7d44,0x7d2f,0x7d42,0x7d32,0x7d31,0x7f3d,0x7f9e,0x7f9a,
-0x7fcc,0x7fce,0x7fd2,0x801c,0x804a,0x8046,0x812f,0x8116,
-0x8123,0x812b,0x8129,0x8130,0x8124,0x8202,0x8235,0x8237,
-0x8236,0x8239,0x838e,0x839e,0x8398,0x8378,0x83a2,0x8396,
-0x83bd,0x83ab,0x8392,0x838a,0x8393,0x8389,0x83a0,0x8377,
-0x837b,0x837c,0x8386,0x83a7,0x8655,0x5f6a,0x86c7,0x86c0,
-0x86b6,0x86c4,0x86b5,0x86c6,0x86cb,0x86b1,0x86af,0x86c9,
-0x8853,0x889e,0x8888,0x88ab,0x8892,0x8896,0x888d,0x888b,
-0x8993,0x898f,0x8a2a,0x8a1d,0x8a23,0x8a25,0x8a31,0x8a2d,
-0x8a1f,0x8a1b,0x8a22,0x8c49,0x8c5a,0x8ca9,0x8cac,0x8cab,
-0x8ca8,0x8caa,0x8ca7,0x8d67,0x8d66,0x8dbe,0x8dba,0x8edb,
-0x8edf,0x9019,0x900d,0x901a,0x9017,0x9023,0x901f,0x901d,
-0x9010,0x9015,0x901e,0x9020,0x900f,0x9022,0x9016,0x901b,
-0x9014,0x90e8,0x90ed,0x90fd,0x9157,0x91ce,0x91f5,0x91e6,
-0x91e3,0x91e7,0x91ed,0x91e9,0x9589,0x966a,0x9675,0x9673,
-0x9678,0x9670,0x9674,0x9676,0x9677,0x966c,0x96c0,0x96ea,
-0x96e9,0x7ae0,0x7adf,0x9802,0x9803,0x9b5a,0x9ce5,0x9e75,
-0x9e7f,0x9ea5,0x9ebb,0x50a2,0x508d,0x5085,0x5099,0x5091,
-0x5080,0x5096,0x5098,0x509a,0x6700,0x51f1,0x5272,0x5274,
-0x5275,0x5269,0x52de,0x52dd,0x52db,0x535a,0x53a5,0x557b,
-0x5580,0x55a7,0x557c,0x558a,0x559d,0x5598,0x5582,0x559c,
-0x55aa,0x5594,0x5587,0x558b,0x5583,0x55b3,0x55ae,0x559f,
-0x553e,0x55b2,0x559a,0x55bb,0x55ac,0x55b1,0x557e,0x5589,
-0x55ab,0x5599,0x570d,0x582f,0x582a,0x5834,0x5824,0x5830,
-0x5831,0x5821,0x581d,0x5820,0x58f9,0x58fa,0x5960,0x5a77,
-0x5a9a,0x5a7f,0x5a92,0x5a9b,0x5aa7,0x5b73,0x5b71,0x5bd2,
-0x5bcc,0x5bd3,0x5bd0,0x5c0a,0x5c0b,0x5c31,0x5d4c,0x5d50,
-0x5d34,0x5d47,0x5dfd,0x5e45,0x5e3d,0x5e40,0x5e43,0x5e7e,
-0x5eca,0x5ec1,0x5ec2,0x5ec4,0x5f3c,0x5f6d,0x5fa9,0x5faa,
-0x5fa8,0x60d1,0x60e1,0x60b2,0x60b6,0x60e0,0x611c,0x6123,
-0x60fa,0x6115,0x60f0,0x60fb,0x60f4,0x6168,0x60f1,0x610e,
-0x60f6,0x6109,0x6100,0x6112,0x621f,0x6249,0x63a3,0x638c,
-0x63cf,0x63c0,0x63e9,0x63c9,0x63c6,0x63cd,0x63d2,0x63e3,
-0x63d0,0x63e1,0x63d6,0x63ed,0x63ee,0x6376,0x63f4,0x63ea,
-0x63db,0x6452,0x63da,0x63f9,0x655e,0x6566,0x6562,0x6563,
-0x6591,0x6590,0x65af,0x666e,0x6670,0x6674,0x6676,0x666f,
-0x6691,0x667a,0x667e,0x6677,0x66fe,0x66ff,0x671f,0x671d,
-0x68fa,0x68d5,0x68e0,0x68d8,0x68d7,0x6905,0x68df,0x68f5,
-0x68ee,0x68e7,0x68f9,0x68d2,0x68f2,0x68e3,0x68cb,0x68cd,
-0x690d,0x6912,0x690e,0x68c9,0x68da,0x696e,0x68fb,0x6b3e,
-0x6b3a,0x6b3d,0x6b98,0x6b96,0x6bbc,0x6bef,0x6c2e,0x6c2f,
-0x6c2c,0x6e2f,0x6e38,0x6e54,0x6e21,0x6e32,0x6e67,0x6e4a,
-0x6e20,0x6e25,0x6e23,0x6e1b,0x6e5b,0x6e58,0x6e24,0x6e56,
-0x6e6e,0x6e2d,0x6e26,0x6e6f,0x6e34,0x6e4d,0x6e3a,0x6e2c,
-0x6e43,0x6e1d,0x6e3e,0x6ecb,0x6e89,0x6e19,0x6e4e,0x6e63,
-0x6e44,0x6e72,0x6e69,0x6e5f,0x7119,0x711a,0x7126,0x7130,
-0x7121,0x7136,0x716e,0x711c,0x724c,0x7284,0x7280,0x7336,
-0x7325,0x7334,0x7329,0x743a,0x742a,0x7433,0x7422,0x7425,
-0x7435,0x7436,0x7434,0x742f,0x741b,0x7426,0x7428,0x7525,
-0x7526,0x756b,0x756a,0x75e2,0x75db,0x75e3,0x75d9,0x75d8,
-0x75de,0x75e0,0x767b,0x767c,0x7696,0x7693,0x76b4,0x76dc,
-0x774f,0x77ed,0x785d,0x786c,0x786f,0x7a0d,0x7a08,0x7a0b,
-0x7a05,0x7a00,0x7a98,0x7a97,0x7a96,0x7ae5,0x7ae3,0x7b49,
-0x7b56,0x7b46,0x7b50,0x7b52,0x7b54,0x7b4d,0x7b4b,0x7b4f,
-0x7b51,0x7c9f,0x7ca5,0x7d5e,0x7d50,0x7d68,0x7d55,0x7d2b,
-0x7d6e,0x7d72,0x7d61,0x7d66,0x7d62,0x7d70,0x7d73,0x5584,
-0x7fd4,0x7fd5,0x800b,0x8052,0x8085,0x8155,0x8154,0x814b,
-0x8151,0x814e,0x8139,0x8146,0x813e,0x814c,0x8153,0x8174,
-0x8212,0x821c,0x83e9,0x8403,0x83f8,0x840d,0x83e0,0x83c5,
-0x840b,0x83c1,0x83ef,0x83f1,0x83f4,0x8457,0x840a,0x83f0,
-0x840c,0x83cc,0x83fd,0x83f2,0x83ca,0x8438,0x840e,0x8404,
-0x83dc,0x8407,0x83d4,0x83df,0x865b,0x86df,0x86d9,0x86ed,
-0x86d4,0x86db,0x86e4,0x86d0,0x86de,0x8857,0x88c1,0x88c2,
-0x88b1,0x8983,0x8996,0x8a3b,0x8a60,0x8a55,0x8a5e,0x8a3c,
-0x8a41,0x8a54,0x8a5b,0x8a50,0x8a46,0x8a34,0x8a3a,0x8a36,
-0x8a56,0x8c61,0x8c82,0x8caf,0x8cbc,0x8cb3,0x8cbd,0x8cc1,
-0x8cbb,0x8cc0,0x8cb4,0x8cb7,0x8cb6,0x8cbf,0x8cb8,0x8d8a,
-0x8d85,0x8d81,0x8dce,0x8ddd,0x8dcb,0x8dda,0x8dd1,0x8dcc,
-0x8ddb,0x8dc6,0x8efb,0x8ef8,0x8efc,0x8f9c,0x902e,0x9035,
-0x9031,0x9038,0x9032,0x9036,0x9102,0x90f5,0x9109,0x90fe,
-0x9163,0x9165,0x91cf,0x9214,0x9215,0x9223,0x9209,0x921e,
-0x920d,0x9210,0x9207,0x9211,0x9594,0x958f,0x958b,0x9591,
-0x9593,0x9592,0x958e,0x968a,0x968e,0x968b,0x967d,0x9685,
-0x9686,0x968d,0x9672,0x9684,0x96c1,0x96c5,0x96c4,0x96c6,
-0x96c7,0x96ef,0x96f2,0x97cc,0x9805,0x9806,0x9808,0x98e7,
-0x98ea,0x98ef,0x98e9,0x98f2,0x98ed,0x99ae,0x99ad,0x9ec3,
-0x9ecd,0x9ed1,0x4e82,0x50ad,0x50b5,0x50b2,0x50b3,0x50c5,
-0x50be,0x50ac,0x50b7,0x50bb,0x50af,0x50c7,0x527f,0x5277,
-0x527d,0x52df,0x52e6,0x52e4,0x52e2,0x52e3,0x532f,0x55df,
-0x55e8,0x55d3,0x55e6,0x55ce,0x55dc,0x55c7,0x55d1,0x55e3,
-0x55e4,0x55ef,0x55da,0x55e1,0x55c5,0x55c6,0x55e5,0x55c9,
-0x5712,0x5713,0x585e,0x5851,0x5858,0x5857,0x585a,0x5854,
-0x586b,0x584c,0x586d,0x584a,0x5862,0x5852,0x584b,0x5967,
-0x5ac1,0x5ac9,0x5acc,0x5abe,0x5abd,0x5abc,0x5ab3,0x5ac2,
-0x5ab2,0x5d69,0x5d6f,0x5e4c,0x5e79,0x5ec9,0x5ec8,0x5f12,
-0x5f59,0x5fac,0x5fae,0x611a,0x610f,0x6148,0x611f,0x60f3,
-0x611b,0x60f9,0x6101,0x6108,0x614e,0x614c,0x6144,0x614d,
-0x613e,0x6134,0x6127,0x610d,0x6106,0x6137,0x6221,0x6222,
-0x6413,0x643e,0x641e,0x642a,0x642d,0x643d,0x642c,0x640f,
-0x641c,0x6414,0x640d,0x6436,0x6416,0x6417,0x6406,0x656c,
-0x659f,0x65b0,0x6697,0x6689,0x6687,0x6688,0x6696,0x6684,
-0x6698,0x668d,0x6703,0x6994,0x696d,0x695a,0x6977,0x6960,
-0x6954,0x6975,0x6930,0x6982,0x694a,0x6968,0x696b,0x695e,
-0x6953,0x6979,0x6986,0x695d,0x6963,0x695b,0x6b47,0x6b72,
-0x6bc0,0x6bbf,0x6bd3,0x6bfd,0x6ea2,0x6eaf,0x6ed3,0x6eb6,
-0x6ec2,0x6e90,0x6e9d,0x6ec7,0x6ec5,0x6ea5,0x6e98,0x6ebc,
-0x6eba,0x6eab,0x6ed1,0x6e96,0x6e9c,0x6ec4,0x6ed4,0x6eaa,
-0x6ea7,0x6eb4,0x714e,0x7159,0x7169,0x7164,0x7149,0x7167,
-0x715c,0x716c,0x7166,0x714c,0x7165,0x715e,0x7146,0x7168,
-0x7156,0x723a,0x7252,0x7337,0x7345,0x733f,0x733e,0x746f,
-0x745a,0x7455,0x745f,0x745e,0x7441,0x743f,0x7459,0x745b,
-0x745c,0x7576,0x7578,0x7600,0x75f0,0x7601,0x75f2,0x75f1,
-0x75fa,0x75ff,0x75f4,0x75f3,0x76de,0x76df,0x775b,0x776b,
-0x7766,0x775e,0x7763,0x7779,0x776a,0x776c,0x775c,0x7765,
-0x7768,0x7762,0x77ee,0x788e,0x78b0,0x7897,0x7898,0x788c,
-0x7889,0x787c,0x7891,0x7893,0x787f,0x797a,0x797f,0x7981,
-0x842c,0x79bd,0x7a1c,0x7a1a,0x7a20,0x7a14,0x7a1f,0x7a1e,
-0x7a9f,0x7aa0,0x7b77,0x7bc0,0x7b60,0x7b6e,0x7b67,0x7cb1,
-0x7cb3,0x7cb5,0x7d93,0x7d79,0x7d91,0x7d81,0x7d8f,0x7d5b,
-0x7f6e,0x7f69,0x7f6a,0x7f72,0x7fa9,0x7fa8,0x7fa4,0x8056,
-0x8058,0x8086,0x8084,0x8171,0x8170,0x8178,0x8165,0x816e,
-0x8173,0x816b,0x8179,0x817a,0x8166,0x8205,0x8247,0x8482,
-0x8477,0x843d,0x8431,0x8475,0x8466,0x846b,0x8449,0x846c,
-0x845b,0x843c,0x8435,0x8461,0x8463,0x8469,0x846d,0x8446,
-0x865e,0x865c,0x865f,0x86f9,0x8713,0x8708,0x8707,0x8700,
-0x86fe,0x86fb,0x8702,0x8703,0x8706,0x870a,0x8859,0x88df,
-0x88d4,0x88d9,0x88dc,0x88d8,0x88dd,0x88e1,0x88ca,0x88d5,
-0x88d2,0x899c,0x89e3,0x8a6b,0x8a72,0x8a73,0x8a66,0x8a69,
-0x8a70,0x8a87,0x8a7c,0x8a63,0x8aa0,0x8a71,0x8a85,0x8a6d,
-0x8a62,0x8a6e,0x8a6c,0x8a79,0x8a7b,0x8a3e,0x8a68,0x8c62,
-0x8c8a,0x8c89,0x8cca,0x8cc7,0x8cc8,0x8cc4,0x8cb2,0x8cc3,
-0x8cc2,0x8cc5,0x8de1,0x8ddf,0x8de8,0x8def,0x8df3,0x8dfa,
-0x8dea,0x8de4,0x8de6,0x8eb2,0x8f03,0x8f09,0x8efe,0x8f0a,
-0x8f9f,0x8fb2,0x904b,0x904a,0x9053,0x9042,0x9054,0x903c,
-0x9055,0x9050,0x9047,0x904f,0x904e,0x904d,0x9051,0x903e,
-0x9041,0x9112,0x9117,0x916c,0x916a,0x9169,0x91c9,0x9237,
-0x9257,0x9238,0x923d,0x9240,0x923e,0x925b,0x924b,0x9264,
-0x9251,0x9234,0x9249,0x924d,0x9245,0x9239,0x923f,0x925a,
-0x9598,0x9698,0x9694,0x9695,0x96cd,0x96cb,0x96c9,0x96ca,
-0x96f7,0x96fb,0x96f9,0x96f6,0x9756,0x9774,0x9776,0x9810,
-0x9811,0x9813,0x980a,0x9812,0x980c,0x98fc,0x98f4,0x98fd,
-0x98fe,0x99b3,0x99b1,0x99b4,0x9ae1,0x9ce9,0x9e82,0x9f0e,
-0x9f13,0x9f20,0x50e7,0x50ee,0x50e5,0x50d6,0x50ed,0x50da,
-0x50d5,0x50cf,0x50d1,0x50f1,0x50ce,0x50e9,0x5162,0x51f3,
-0x5283,0x5282,0x5331,0x53ad,0x55fe,0x5600,0x561b,0x5617,
-0x55fd,0x5614,0x5606,0x5609,0x560d,0x560e,0x55f7,0x5616,
-0x561f,0x5608,0x5610,0x55f6,0x5718,0x5716,0x5875,0x587e,
-0x5883,0x5893,0x588a,0x5879,0x5885,0x587d,0x58fd,0x5925,
-0x5922,0x5924,0x596a,0x5969,0x5ae1,0x5ae6,0x5ae9,0x5ad7,
-0x5ad6,0x5ad8,0x5ae3,0x5b75,0x5bde,0x5be7,0x5be1,0x5be5,
-0x5be6,0x5be8,0x5be2,0x5be4,0x5bdf,0x5c0d,0x5c62,0x5d84,
-0x5d87,0x5e5b,0x5e63,0x5e55,0x5e57,0x5e54,0x5ed3,0x5ed6,
-0x5f0a,0x5f46,0x5f70,0x5fb9,0x6147,0x613f,0x614b,0x6177,
-0x6162,0x6163,0x615f,0x615a,0x6158,0x6175,0x622a,0x6487,
-0x6458,0x6454,0x64a4,0x6478,0x645f,0x647a,0x6451,0x6467,
-0x6434,0x646d,0x647b,0x6572,0x65a1,0x65d7,0x65d6,0x66a2,
-0x66a8,0x669d,0x699c,0x69a8,0x6995,0x69c1,0x69ae,0x69d3,
-0x69cb,0x699b,0x69b7,0x69bb,0x69ab,0x69b4,0x69d0,0x69cd,
-0x69ad,0x69cc,0x69a6,0x69c3,0x69a3,0x6b49,0x6b4c,0x6c33,
-0x6f33,0x6f14,0x6efe,0x6f13,0x6ef4,0x6f29,0x6f3e,0x6f20,
-0x6f2c,0x6f0f,0x6f02,0x6f22,0x6eff,0x6eef,0x6f06,0x6f31,
-0x6f38,0x6f32,0x6f23,0x6f15,0x6f2b,0x6f2f,0x6f88,0x6f2a,
-0x6eec,0x6f01,0x6ef2,0x6ecc,0x6ef7,0x7194,0x7199,0x717d,
-0x718a,0x7184,0x7192,0x723e,0x7292,0x7296,0x7344,0x7350,
-0x7464,0x7463,0x746a,0x7470,0x746d,0x7504,0x7591,0x7627,
-0x760d,0x760b,0x7609,0x7613,0x76e1,0x76e3,0x7784,0x777d,
-0x777f,0x7761,0x78c1,0x789f,0x78a7,0x78b3,0x78a9,0x78a3,
-0x798e,0x798f,0x798d,0x7a2e,0x7a31,0x7aaa,0x7aa9,0x7aed,
-0x7aef,0x7ba1,0x7b95,0x7b8b,0x7b75,0x7b97,0x7b9d,0x7b94,
-0x7b8f,0x7bb8,0x7b87,0x7b84,0x7cb9,0x7cbd,0x7cbe,0x7dbb,
-0x7db0,0x7d9c,0x7dbd,0x7dbe,0x7da0,0x7dca,0x7db4,0x7db2,
-0x7db1,0x7dba,0x7da2,0x7dbf,0x7db5,0x7db8,0x7dad,0x7dd2,
-0x7dc7,0x7dac,0x7f70,0x7fe0,0x7fe1,0x7fdf,0x805e,0x805a,
-0x8087,0x8150,0x8180,0x818f,0x8188,0x818a,0x817f,0x8182,
-0x81e7,0x81fa,0x8207,0x8214,0x821e,0x824b,0x84c9,0x84bf,
-0x84c6,0x84c4,0x8499,0x849e,0x84b2,0x849c,0x84cb,0x84b8,
-0x84c0,0x84d3,0x8490,0x84bc,0x84d1,0x84ca,0x873f,0x871c,
-0x873b,0x8722,0x8725,0x8734,0x8718,0x8755,0x8737,0x8729,
-0x88f3,0x8902,0x88f4,0x88f9,0x88f8,0x88fd,0x88e8,0x891a,
-0x88ef,0x8aa6,0x8a8c,0x8a9e,0x8aa3,0x8a8d,0x8aa1,0x8a93,
-0x8aa4,0x8aaa,0x8aa5,0x8aa8,0x8a98,0x8a91,0x8a9a,0x8aa7,
-0x8c6a,0x8c8d,0x8c8c,0x8cd3,0x8cd1,0x8cd2,0x8d6b,0x8d99,
-0x8d95,0x8dfc,0x8f14,0x8f12,0x8f15,0x8f13,0x8fa3,0x9060,
-0x9058,0x905c,0x9063,0x9059,0x905e,0x9062,0x905d,0x905b,
-0x9119,0x9118,0x911e,0x9175,0x9178,0x9177,0x9174,0x9278,
-0x9280,0x9285,0x9298,0x9296,0x927b,0x9293,0x929c,0x92a8,
-0x927c,0x9291,0x95a1,0x95a8,0x95a9,0x95a3,0x95a5,0x95a4,
-0x9699,0x969c,0x969b,0x96cc,0x96d2,0x9700,0x977c,0x9785,
-0x97f6,0x9817,0x9818,0x98af,0x98b1,0x9903,0x9905,0x990c,
-0x9909,0x99c1,0x9aaf,0x9ab0,0x9ae6,0x9b41,0x9b42,0x9cf4,
-0x9cf6,0x9cf3,0x9ebc,0x9f3b,0x9f4a,0x5104,0x5100,0x50fb,
-0x50f5,0x50f9,0x5102,0x5108,0x5109,0x5105,0x51dc,0x5287,
-0x5288,0x5289,0x528d,0x528a,0x52f0,0x53b2,0x562e,0x563b,
-0x5639,0x5632,0x563f,0x5634,0x5629,0x5653,0x564e,0x5657,
-0x5674,0x5636,0x562f,0x5630,0x5880,0x589f,0x589e,0x58b3,
-0x589c,0x58ae,0x58a9,0x58a6,0x596d,0x5b09,0x5afb,0x5b0b,
-0x5af5,0x5b0c,0x5b08,0x5bee,0x5bec,0x5be9,0x5beb,0x5c64,
-0x5c65,0x5d9d,0x5d94,0x5e62,0x5e5f,0x5e61,0x5ee2,0x5eda,
-0x5edf,0x5edd,0x5ee3,0x5ee0,0x5f48,0x5f71,0x5fb7,0x5fb5,
-0x6176,0x6167,0x616e,0x615d,0x6155,0x6182,0x617c,0x6170,
-0x616b,0x617e,0x61a7,0x6190,0x61ab,0x618e,0x61ac,0x619a,
-0x61a4,0x6194,0x61ae,0x622e,0x6469,0x646f,0x6479,0x649e,
-0x64b2,0x6488,0x6490,0x64b0,0x64a5,0x6493,0x6495,0x64a9,
-0x6492,0x64ae,0x64ad,0x64ab,0x649a,0x64ac,0x6499,0x64a2,
-0x64b3,0x6575,0x6577,0x6578,0x66ae,0x66ab,0x66b4,0x66b1,
-0x6a23,0x6a1f,0x69e8,0x6a01,0x6a1e,0x6a19,0x69fd,0x6a21,
-0x6a13,0x6a0a,0x69f3,0x6a02,0x6a05,0x69ed,0x6a11,0x6b50,
-0x6b4e,0x6ba4,0x6bc5,0x6bc6,0x6f3f,0x6f7c,0x6f84,0x6f51,
-0x6f66,0x6f54,0x6f86,0x6f6d,0x6f5b,0x6f78,0x6f6e,0x6f8e,
-0x6f7a,0x6f70,0x6f64,0x6f97,0x6f58,0x6ed5,0x6f6f,0x6f60,
-0x6f5f,0x719f,0x71ac,0x71b1,0x71a8,0x7256,0x729b,0x734e,
-0x7357,0x7469,0x748b,0x7483,0x747e,0x7480,0x757f,0x7620,
-0x7629,0x761f,0x7624,0x7626,0x7621,0x7622,0x769a,0x76ba,
-0x76e4,0x778e,0x7787,0x778c,0x7791,0x778b,0x78cb,0x78c5,
-0x78ba,0x78ca,0x78be,0x78d5,0x78bc,0x78d0,0x7a3f,0x7a3c,
-0x7a40,0x7a3d,0x7a37,0x7a3b,0x7aaf,0x7aae,0x7bad,0x7bb1,
-0x7bc4,0x7bb4,0x7bc6,0x7bc7,0x7bc1,0x7ba0,0x7bcc,0x7cca,
-0x7de0,0x7df4,0x7def,0x7dfb,0x7dd8,0x7dec,0x7ddd,0x7de8,
-0x7de3,0x7dda,0x7dde,0x7de9,0x7d9e,0x7dd9,0x7df2,0x7df9,
-0x7f75,0x7f77,0x7faf,0x7fe9,0x8026,0x819b,0x819c,0x819d,
-0x81a0,0x819a,0x8198,0x8517,0x853d,0x851a,0x84ee,0x852c,
-0x852d,0x8513,0x8511,0x8523,0x8521,0x8514,0x84ec,0x8525,
-0x84ff,0x8506,0x8782,0x8774,0x8776,0x8760,0x8766,0x8778,
-0x8768,0x8759,0x8757,0x874c,0x8753,0x885b,0x885d,0x8910,
-0x8907,0x8912,0x8913,0x8915,0x890a,0x8abc,0x8ad2,0x8ac7,
-0x8ac4,0x8a95,0x8acb,0x8af8,0x8ab2,0x8ac9,0x8ac2,0x8abf,
-0x8ab0,0x8ad6,0x8acd,0x8ab6,0x8ab9,0x8adb,0x8c4c,0x8c4e,
-0x8c6c,0x8ce0,0x8cde,0x8ce6,0x8ce4,0x8cec,0x8ced,0x8ce2,
-0x8ce3,0x8cdc,0x8cea,0x8ce1,0x8d6d,0x8d9f,0x8da3,0x8e2b,
-0x8e10,0x8e1d,0x8e22,0x8e0f,0x8e29,0x8e1f,0x8e21,0x8e1e,
-0x8eba,0x8f1d,0x8f1b,0x8f1f,0x8f29,0x8f26,0x8f2a,0x8f1c,
-0x8f1e,0x8f25,0x9069,0x906e,0x9068,0x906d,0x9077,0x9130,
-0x912d,0x9127,0x9131,0x9187,0x9189,0x918b,0x9183,0x92c5,
-0x92bb,0x92b7,0x92ea,0x92ac,0x92e4,0x92c1,0x92b3,0x92bc,
-0x92d2,0x92c7,0x92f0,0x92b2,0x95ad,0x95b1,0x9704,0x9706,
-0x9707,0x9709,0x9760,0x978d,0x978b,0x978f,0x9821,0x982b,
-0x981c,0x98b3,0x990a,0x9913,0x9912,0x9918,0x99dd,0x99d0,
-0x99df,0x99db,0x99d1,0x99d5,0x99d2,0x99d9,0x9ab7,0x9aee,
-0x9aef,0x9b27,0x9b45,0x9b44,0x9b77,0x9b6f,0x9d06,0x9d09,
-0x9d03,0x9ea9,0x9ebe,0x9ece,0x58a8,0x9f52,0x5112,0x5118,
-0x5114,0x5110,0x5115,0x5180,0x51aa,0x51dd,0x5291,0x5293,
-0x52f3,0x5659,0x566b,0x5679,0x5669,0x5664,0x5678,0x566a,
-0x5668,0x5665,0x5671,0x566f,0x566c,0x5662,0x5676,0x58c1,
-0x58be,0x58c7,0x58c5,0x596e,0x5b1d,0x5b34,0x5b78,0x5bf0,
-0x5c0e,0x5f4a,0x61b2,0x6191,0x61a9,0x618a,0x61cd,0x61b6,
-0x61be,0x61ca,0x61c8,0x6230,0x64c5,0x64c1,0x64cb,0x64bb,
-0x64bc,0x64da,0x64c4,0x64c7,0x64c2,0x64cd,0x64bf,0x64d2,
-0x64d4,0x64be,0x6574,0x66c6,0x66c9,0x66b9,0x66c4,0x66c7,
-0x66b8,0x6a3d,0x6a38,0x6a3a,0x6a59,0x6a6b,0x6a58,0x6a39,
-0x6a44,0x6a62,0x6a61,0x6a4b,0x6a47,0x6a35,0x6a5f,0x6a48,
-0x6b59,0x6b77,0x6c05,0x6fc2,0x6fb1,0x6fa1,0x6fc3,0x6fa4,
-0x6fc1,0x6fa7,0x6fb3,0x6fc0,0x6fb9,0x6fb6,0x6fa6,0x6fa0,
-0x6fb4,0x71be,0x71c9,0x71d0,0x71d2,0x71c8,0x71d5,0x71b9,
-0x71ce,0x71d9,0x71dc,0x71c3,0x71c4,0x7368,0x749c,0x74a3,
-0x7498,0x749f,0x749e,0x74e2,0x750c,0x750d,0x7634,0x7638,
-0x763a,0x76e7,0x76e5,0x77a0,0x779e,0x779f,0x77a5,0x78e8,
-0x78da,0x78ec,0x78e7,0x79a6,0x7a4d,0x7a4e,0x7a46,0x7a4c,
-0x7a4b,0x7aba,0x7bd9,0x7c11,0x7bc9,0x7be4,0x7bdb,0x7be1,
-0x7be9,0x7be6,0x7cd5,0x7cd6,0x7e0a,0x7e11,0x7e08,0x7e1b,
-0x7e23,0x7e1e,0x7e1d,0x7e09,0x7e10,0x7f79,0x7fb2,0x7ff0,
-0x7ff1,0x7fee,0x8028,0x81b3,0x81a9,0x81a8,0x81fb,0x8208,
-0x8258,0x8259,0x854a,0x8559,0x8548,0x8568,0x8569,0x8543,
-0x8549,0x856d,0x856a,0x855e,0x8783,0x879f,0x879e,0x87a2,
-0x878d,0x8861,0x892a,0x8932,0x8925,0x892b,0x8921,0x89aa,
-0x89a6,0x8ae6,0x8afa,0x8aeb,0x8af1,0x8b00,0x8adc,0x8ae7,
-0x8aee,0x8afe,0x8b01,0x8b02,0x8af7,0x8aed,0x8af3,0x8af6,
-0x8afc,0x8c6b,0x8c6d,0x8c93,0x8cf4,0x8e44,0x8e31,0x8e34,
-0x8e42,0x8e39,0x8e35,0x8f3b,0x8f2f,0x8f38,0x8f33,0x8fa8,
-0x8fa6,0x9075,0x9074,0x9078,0x9072,0x907c,0x907a,0x9134,
-0x9192,0x9320,0x9336,0x92f8,0x9333,0x932f,0x9322,0x92fc,
-0x932b,0x9304,0x931a,0x9310,0x9326,0x9321,0x9315,0x932e,
-0x9319,0x95bb,0x96a7,0x96a8,0x96aa,0x96d5,0x970e,0x9711,
-0x9716,0x970d,0x9713,0x970f,0x975b,0x975c,0x9766,0x9798,
-0x9830,0x9838,0x983b,0x9837,0x982d,0x9839,0x9824,0x9910,
-0x9928,0x991e,0x991b,0x9921,0x991a,0x99ed,0x99e2,0x99f1,
-0x9ab8,0x9abc,0x9afb,0x9aed,0x9b28,0x9b91,0x9d15,0x9d23,
-0x9d26,0x9d28,0x9d12,0x9d1b,0x9ed8,0x9ed4,0x9f8d,0x9f9c,
-0x512a,0x511f,0x5121,0x5132,0x52f5,0x568e,0x5680,0x5690,
-0x5685,0x5687,0x568f,0x58d5,0x58d3,0x58d1,0x58ce,0x5b30,
-0x5b2a,0x5b24,0x5b7a,0x5c37,0x5c68,0x5dbc,0x5dba,0x5dbd,
-0x5db8,0x5e6b,0x5f4c,0x5fbd,0x61c9,0x61c2,0x61c7,0x61e6,
-0x61cb,0x6232,0x6234,0x64ce,0x64ca,0x64d8,0x64e0,0x64f0,
-0x64e6,0x64ec,0x64f1,0x64e2,0x64ed,0x6582,0x6583,0x66d9,
-0x66d6,0x6a80,0x6a94,0x6a84,0x6aa2,0x6a9c,0x6adb,0x6aa3,
-0x6a7e,0x6a97,0x6a90,0x6aa0,0x6b5c,0x6bae,0x6bda,0x6c08,
-0x6fd8,0x6ff1,0x6fdf,0x6fe0,0x6fdb,0x6fe4,0x6feb,0x6fef,
-0x6f80,0x6fec,0x6fe1,0x6fe9,0x6fd5,0x6fee,0x6ff0,0x71e7,
-0x71df,0x71ee,0x71e6,0x71e5,0x71ed,0x71ec,0x71f4,0x71e0,
-0x7235,0x7246,0x7370,0x7372,0x74a9,0x74b0,0x74a6,0x74a8,
-0x7646,0x7642,0x764c,0x76ea,0x77b3,0x77aa,0x77b0,0x77ac,
-0x77a7,0x77ad,0x77ef,0x78f7,0x78fa,0x78f4,0x78ef,0x7901,
-0x79a7,0x79aa,0x7a57,0x7abf,0x7c07,0x7c0d,0x7bfe,0x7bf7,
-0x7c0c,0x7be0,0x7ce0,0x7cdc,0x7cde,0x7ce2,0x7cdf,0x7cd9,
-0x7cdd,0x7e2e,0x7e3e,0x7e46,0x7e37,0x7e32,0x7e43,0x7e2b,
-0x7e3d,0x7e31,0x7e45,0x7e41,0x7e34,0x7e39,0x7e48,0x7e35,
-0x7e3f,0x7e2f,0x7f44,0x7ff3,0x7ffc,0x8071,0x8072,0x8070,
-0x806f,0x8073,0x81c6,0x81c3,0x81ba,0x81c2,0x81c0,0x81bf,
-0x81bd,0x81c9,0x81be,0x81e8,0x8209,0x8271,0x85aa,0x8584,
-0x857e,0x859c,0x8591,0x8594,0x85af,0x859b,0x8587,0x85a8,
-0x858a,0x8667,0x87c0,0x87d1,0x87b3,0x87d2,0x87c6,0x87ab,
-0x87bb,0x87ba,0x87c8,0x87cb,0x893b,0x8936,0x8944,0x8938,
-0x893d,0x89ac,0x8b0e,0x8b17,0x8b19,0x8b1b,0x8b0a,0x8b20,
-0x8b1d,0x8b04,0x8b10,0x8c41,0x8c3f,0x8c73,0x8cfa,0x8cfd,
-0x8cfc,0x8cf8,0x8cfb,0x8da8,0x8e49,0x8e4b,0x8e48,0x8e4a,
-0x8f44,0x8f3e,0x8f42,0x8f45,0x8f3f,0x907f,0x907d,0x9084,
-0x9081,0x9082,0x9080,0x9139,0x91a3,0x919e,0x919c,0x934d,
-0x9382,0x9328,0x9375,0x934a,0x9365,0x934b,0x9318,0x937e,
-0x936c,0x935b,0x9370,0x935a,0x9354,0x95ca,0x95cb,0x95cc,
-0x95c8,0x95c6,0x96b1,0x96b8,0x96d6,0x971c,0x971e,0x97a0,
-0x97d3,0x9846,0x98b6,0x9935,0x9a01,0x99ff,0x9bae,0x9bab,
-0x9baa,0x9bad,0x9d3b,0x9d3f,0x9e8b,0x9ecf,0x9ede,0x9edc,
-0x9edd,0x9edb,0x9f3e,0x9f4b,0x53e2,0x5695,0x56ae,0x58d9,
-0x58d8,0x5b38,0x5f5d,0x61e3,0x6233,0x64f4,0x64f2,0x64fe,
-0x6506,0x64fa,0x64fb,0x64f7,0x65b7,0x66dc,0x6726,0x6ab3,
-0x6aac,0x6ac3,0x6abb,0x6ab8,0x6ac2,0x6aae,0x6aaf,0x6b5f,
-0x6b78,0x6baf,0x7009,0x700b,0x6ffe,0x7006,0x6ffa,0x7011,
-0x700f,0x71fb,0x71fc,0x71fe,0x71f8,0x7377,0x7375,0x74a7,
-0x74bf,0x7515,0x7656,0x7658,0x7652,0x77bd,0x77bf,0x77bb,
-0x77bc,0x790e,0x79ae,0x7a61,0x7a62,0x7a60,0x7ac4,0x7ac5,
-0x7c2b,0x7c27,0x7c2a,0x7c1e,0x7c23,0x7c21,0x7ce7,0x7e54,
-0x7e55,0x7e5e,0x7e5a,0x7e61,0x7e52,0x7e59,0x7f48,0x7ff9,
-0x7ffb,0x8077,0x8076,0x81cd,0x81cf,0x820a,0x85cf,0x85a9,
-0x85cd,0x85d0,0x85c9,0x85b0,0x85ba,0x85b9,0x85a6,0x87ef,
-0x87ec,0x87f2,0x87e0,0x8986,0x89b2,0x89f4,0x8b28,0x8b39,
-0x8b2c,0x8b2b,0x8c50,0x8d05,0x8e59,0x8e63,0x8e66,0x8e64,
-0x8e5f,0x8e55,0x8ec0,0x8f49,0x8f4d,0x9087,0x9083,0x9088,
-0x91ab,0x91ac,0x91d0,0x9394,0x938a,0x9396,0x93a2,0x93b3,
-0x93ae,0x93ac,0x93b0,0x9398,0x939a,0x9397,0x95d4,0x95d6,
-0x95d0,0x95d5,0x96e2,0x96dc,0x96d9,0x96db,0x96de,0x9724,
-0x97a3,0x97a6,0x97ad,0x97f9,0x984d,0x984f,0x984c,0x984e,
-0x9853,0x98ba,0x993e,0x993f,0x993d,0x992e,0x99a5,0x9a0e,
-0x9ac1,0x9b03,0x9b06,0x9b4f,0x9b4e,0x9b4d,0x9bca,0x9bc9,
-0x9bfd,0x9bc8,0x9bc0,0x9d51,0x9d5d,0x9d60,0x9ee0,0x9f15,
-0x9f2c,0x5133,0x56a5,0x58de,0x58df,0x58e2,0x5bf5,0x9f90,
-0x5eec,0x61f2,0x61f7,0x61f6,0x61f5,0x6500,0x650f,0x66e0,
-0x66dd,0x6ae5,0x6add,0x6ada,0x6ad3,0x701b,0x701f,0x7028,
-0x701a,0x701d,0x7015,0x7018,0x7206,0x720d,0x7258,0x72a2,
-0x7378,0x737a,0x74bd,0x74ca,0x74e3,0x7587,0x7586,0x765f,
-0x7661,0x77c7,0x7919,0x79b1,0x7a6b,0x7a69,0x7c3e,0x7c3f,
-0x7c38,0x7c3d,0x7c37,0x7c40,0x7e6b,0x7e6d,0x7e79,0x7e69,
-0x7e6a,0x7f85,0x7e73,0x7fb6,0x7fb9,0x7fb8,0x81d8,0x85e9,
-0x85dd,0x85ea,0x85d5,0x85e4,0x85e5,0x85f7,0x87fb,0x8805,
-0x880d,0x87f9,0x87fe,0x8960,0x895f,0x8956,0x895e,0x8b41,
-0x8b5c,0x8b58,0x8b49,0x8b5a,0x8b4e,0x8b4f,0x8b46,0x8b59,
-0x8d08,0x8d0a,0x8e7c,0x8e72,0x8e87,0x8e76,0x8e6c,0x8e7a,
-0x8e74,0x8f54,0x8f4e,0x8fad,0x908a,0x908b,0x91b1,0x91ae,
-0x93e1,0x93d1,0x93df,0x93c3,0x93c8,0x93dc,0x93dd,0x93d6,
-0x93e2,0x93cd,0x93d8,0x93e4,0x93d7,0x93e8,0x95dc,0x96b4,
-0x96e3,0x972a,0x9727,0x9761,0x97dc,0x97fb,0x985e,0x9858,
-0x985b,0x98bc,0x9945,0x9949,0x9a16,0x9a19,0x9b0d,0x9be8,
-0x9be7,0x9bd6,0x9bdb,0x9d89,0x9d61,0x9d72,0x9d6a,0x9d6c,
-0x9e92,0x9e97,0x9e93,0x9eb4,0x52f8,0x56a8,0x56b7,0x56b6,
-0x56b4,0x56bc,0x58e4,0x5b40,0x5b43,0x5b7d,0x5bf6,0x5dc9,
-0x61f8,0x61fa,0x6518,0x6514,0x6519,0x66e6,0x6727,0x6aec,
-0x703e,0x7030,0x7032,0x7210,0x737b,0x74cf,0x7662,0x7665,
-0x7926,0x792a,0x792c,0x792b,0x7ac7,0x7af6,0x7c4c,0x7c43,
-0x7c4d,0x7cef,0x7cf0,0x8fae,0x7e7d,0x7e7c,0x7e82,0x7f4c,
-0x8000,0x81da,0x8266,0x85fb,0x85f9,0x8611,0x85fa,0x8606,
-0x860b,0x8607,0x860a,0x8814,0x8815,0x8964,0x89ba,0x89f8,
-0x8b70,0x8b6c,0x8b66,0x8b6f,0x8b5f,0x8b6b,0x8d0f,0x8d0d,
-0x8e89,0x8e81,0x8e85,0x8e82,0x91b4,0x91cb,0x9418,0x9403,
-0x93fd,0x95e1,0x9730,0x98c4,0x9952,0x9951,0x99a8,0x9a2b,
-0x9a30,0x9a37,0x9a35,0x9c13,0x9c0d,0x9e79,0x9eb5,0x9ee8,
-0x9f2f,0x9f5f,0x9f63,0x9f61,0x5137,0x5138,0x56c1,0x56c0,
-0x56c2,0x5914,0x5c6c,0x5dcd,0x61fc,0x61fe,0x651d,0x651c,
-0x6595,0x66e9,0x6afb,0x6b04,0x6afa,0x6bb2,0x704c,0x721b,
-0x72a7,0x74d6,0x74d4,0x7669,0x77d3,0x7c50,0x7e8f,0x7e8c,
-0x7fbc,0x8617,0x862d,0x861a,0x8823,0x8822,0x8821,0x881f,
-0x896a,0x896c,0x89bd,0x8b74,0x8b77,0x8b7d,0x8d13,0x8e8a,
-0x8e8d,0x8e8b,0x8f5f,0x8faf,0x91ba,0x942e,0x9433,0x9435,
-0x943a,0x9438,0x9432,0x942b,0x95e2,0x9738,0x9739,0x9732,
-0x97ff,0x9867,0x9865,0x9957,0x9a45,0x9a43,0x9a40,0x9a3e,
-0x9acf,0x9b54,0x9b51,0x9c2d,0x9c25,0x9daf,0x9db4,0x9dc2,
-0x9db8,0x9e9d,0x9eef,0x9f19,0x9f5c,0x9f66,0x9f67,0x513c,
-0x513b,0x56c8,0x56ca,0x56c9,0x5b7f,0x5dd4,0x5dd2,0x5f4e,
-0x61ff,0x6524,0x6b0a,0x6b61,0x7051,0x7058,0x7380,0x74e4,
-0x758a,0x766e,0x766c,0x79b3,0x7c60,0x7c5f,0x807e,0x807d,
-0x81df,0x8972,0x896f,0x89fc,0x8b80,0x8d16,0x8d17,0x8e91,
-0x8e93,0x8f61,0x9148,0x9444,0x9451,0x9452,0x973d,0x973e,
-0x97c3,0x97c1,0x986b,0x9955,0x9a55,0x9a4d,0x9ad2,0x9b1a,
-0x9c49,0x9c31,0x9c3e,0x9c3b,0x9dd3,0x9dd7,0x9f34,0x9f6c,
-0x9f6a,0x9f94,0x56cc,0x5dd6,0x6200,0x6523,0x652b,0x652a,
-0x66ec,0x6b10,0x74da,0x7aca,0x7c64,0x7c63,0x7c65,0x7e93,
-0x7e96,0x7e94,0x81e2,0x8638,0x863f,0x8831,0x8b8a,0x9090,
-0x908f,0x9463,0x9460,0x9464,0x9768,0x986f,0x995c,0x9a5a,
-0x9a5b,0x9a57,0x9ad3,0x9ad4,0x9ad1,0x9c54,0x9c57,0x9c56,
-0x9de5,0x9e9f,0x9ef4,0x56d1,0x58e9,0x652c,0x705e,0x7671,
-0x7672,0x77d7,0x7f50,0x7f88,0x8836,0x8839,0x8862,0x8b93,
-0x8b92,0x8b96,0x8277,0x8d1b,0x91c0,0x946a,0x9742,0x9748,
-0x9744,0x97c6,0x9870,0x9a5f,0x9b22,0x9b58,0x9c5f,0x9df9,
-0x9dfa,0x9e7c,0x9e7d,0x9f07,0x9f77,0x9f72,0x5ef3,0x6b16,
-0x7063,0x7c6c,0x7c6e,0x883b,0x89c0,0x8ea1,0x91c1,0x9472,
-0x9470,0x9871,0x995e,0x9ad6,0x9b23,0x9ecc,0x7064,0x77da,
-0x8b9a,0x9477,0x97c9,0x9a62,0x9a65,0x7e9c,0x8b9c,0x8eaa,
-0x91c5,0x947d,0x947e,0x947c,0x9c77,0x9c78,0x9ef7,0x8c54,
-0x947f,0x9e1a,0x7228,0x9a6a,0x9b31,0x9e1b,0x9e1e,0x7c72,
-0xf6b1,0xf6b2,0xf6b3,0xf6b4,0xf6b5,0xf6b6,0xf6b7,0xf6b8,
-0xf6b9,0xf6ba,0xf6bb,0xf6bc,0xf6bd,0xf6be,0xf6bf,0xf6c0,
-0xf6c1,0xf6c2,0xf6c3,0xf6c4,0xf6c5,0xf6c6,0xf6c7,0xf6c8,
-0xf6c9,0xf6ca,0xf6cb,0xf6cc,0xf6cd,0xf6ce,0xf6cf,0xf6d0,
-0xf6d1,0xf6d2,0xf6d3,0xf6d4,0xf6d5,0xf6d6,0xf6d7,0xf6d8,
-0xf6d9,0xf6da,0xf6db,0xf6dc,0xf6dd,0xf6de,0xf6df,0xf6e0,
-0xf6e1,0xf6e2,0xf6e3,0xf6e4,0xf6e5,0xf6e6,0xf6e7,0xf6e8,
-0xf6e9,0xf6ea,0xf6eb,0xf6ec,0xf6ed,0xf6ee,0xf6ef,0xf6f0,
-0xf6f1,0xf6f2,0xf6f3,0xf6f4,0xf6f5,0xf6f6,0xf6f7,0xf6f8,
-0xf6f9,0xf6fa,0xf6fb,0xf6fc,0xf6fd,0xf6fe,0xf6ff,0xf700,
-0xf701,0xf702,0xf703,0xf704,0xf705,0xf706,0xf707,0xf708,
-0xf709,0xf70a,0xf70b,0xf70c,0xf70d,0xf70e,0xf70f,0xf710,
-0xf711,0xf712,0xf713,0xf714,0xf715,0xf716,0xf717,0xf718,
-0xf719,0xf71a,0xf71b,0xf71c,0xf71d,0xf71e,0xf71f,0xf720,
-0xf721,0xf722,0xf723,0xf724,0xf725,0xf726,0xf727,0xf728,
-0xf729,0xf72a,0xf72b,0xf72c,0xf72d,0xf72e,0xf72f,0xf730,
-0xf731,0xf732,0xf733,0xf734,0xf735,0xf736,0xf737,0xf738,
-0xf739,0xf73a,0xf73b,0xf73c,0xf73d,0xf73e,0xf73f,0xf740,
-0xf741,0xf742,0xf743,0xf744,0xf745,0xf746,0xf747,0xf748,
-0xf749,0xf74a,0xf74b,0xf74c,0xf74d,0xf74e,0xf74f,0xf750,
-0xf751,0xf752,0xf753,0xf754,0xf755,0xf756,0xf757,0xf758,
-0xf759,0xf75a,0xf75b,0xf75c,0xf75d,0xf75e,0xf75f,0xf760,
-0xf761,0xf762,0xf763,0xf764,0xf765,0xf766,0xf767,0xf768,
-0xf769,0xf76a,0xf76b,0xf76c,0xf76d,0xf76e,0xf76f,0xf770,
-0xf771,0xf772,0xf773,0xf774,0xf775,0xf776,0xf777,0xf778,
-0xf779,0xf77a,0xf77b,0xf77c,0xf77d,0xf77e,0xf77f,0xf780,
-0xf781,0xf782,0xf783,0xf784,0xf785,0xf786,0xf787,0xf788,
-0xf789,0xf78a,0xf78b,0xf78c,0xf78d,0xf78e,0xf78f,0xf790,
-0xf791,0xf792,0xf793,0xf794,0xf795,0xf796,0xf797,0xf798,
-0xf799,0xf79a,0xf79b,0xf79c,0xf79d,0xf79e,0xf79f,0xf7a0,
-0xf7a1,0xf7a2,0xf7a3,0xf7a4,0xf7a5,0xf7a6,0xf7a7,0xf7a8,
-0xf7a9,0xf7aa,0xf7ab,0xf7ac,0xf7ad,0xf7ae,0xf7af,0xf7b0,
-0xf7b1,0xf7b2,0xf7b3,0xf7b4,0xf7b5,0xf7b6,0xf7b7,0xf7b8,
-0xf7b9,0xf7ba,0xf7bb,0xf7bc,0xf7bd,0xf7be,0xf7bf,0xf7c0,
-0xf7c1,0xf7c2,0xf7c3,0xf7c4,0xf7c5,0xf7c6,0xf7c7,0xf7c8,
-0xf7c9,0xf7ca,0xf7cb,0xf7cc,0xf7cd,0xf7ce,0xf7cf,0xf7d0,
-0xf7d1,0xf7d2,0xf7d3,0xf7d4,0xf7d5,0xf7d6,0xf7d7,0xf7d8,
-0xf7d9,0xf7da,0xf7db,0xf7dc,0xf7dd,0xf7de,0xf7df,0xf7e0,
-0xf7e1,0xf7e2,0xf7e3,0xf7e4,0xf7e5,0xf7e6,0xf7e7,0xf7e8,
-0xf7e9,0xf7ea,0xf7eb,0xf7ec,0xf7ed,0xf7ee,0xf7ef,0xf7f0,
-0xf7f1,0xf7f2,0xf7f3,0xf7f4,0xf7f5,0xf7f6,0xf7f7,0xf7f8,
-0xf7f9,0xf7fa,0xf7fb,0xf7fc,0xf7fd,0xf7fe,0xf7ff,0xf800,
-0xf801,0xf802,0xf803,0xf804,0xf805,0xf806,0xf807,0xf808,
-0xf809,0xf80a,0xf80b,0xf80c,0xf80d,0xf80e,0xf80f,0xf810,
-0xf811,0xf812,0xf813,0xf814,0xf815,0xf816,0xf817,0xf818,
-0xf819,0xf81a,0xf81b,0xf81c,0xf81d,0xf81e,0xf81f,0xf820,
-0xf821,0xf822,0xf823,0xf824,0xf825,0xf826,0xf827,0xf828,
-0xf829,0xf82a,0xf82b,0xf82c,0xf82d,0xf82e,0xf82f,0xf830,
-0xf831,0xf832,0xf833,0xf834,0xf835,0xf836,0xf837,0xf838,
-0xf839,0xf83a,0xf83b,0xf83c,0xf83d,0xf83e,0xf83f,0xf840,
-0xf841,0xf842,0xf843,0xf844,0xf845,0xf846,0xf847,0xf848,
-0x4e42,0x4e5c,0x51f5,0x531a,0x5382,0x4e07,0x4e0c,0x4e47,
-0x4e8d,0x56d7,0xfa0c,0x5c6e,0x5f73,0x4e0f,0x5187,0x4e0e,
-0x4e2e,0x4e93,0x4ec2,0x4ec9,0x4ec8,0x5198,0x52fc,0x536c,
-0x53b9,0x5720,0x5903,0x592c,0x5c10,0x5dff,0x65e1,0x6bb3,
-0x6bcc,0x6c14,0x723f,0x4e31,0x4e3c,0x4ee8,0x4edc,0x4ee9,
-0x4ee1,0x4edd,0x4eda,0x520c,0x531c,0x534c,0x5722,0x5723,
-0x5917,0x592f,0x5b81,0x5b84,0x5c12,0x5c3b,0x5c74,0x5c73,
-0x5e04,0x5e80,0x5e82,0x5fc9,0x6209,0x6250,0x6c15,0x6c36,
-0x6c43,0x6c3f,0x6c3b,0x72ae,0x72b0,0x738a,0x79b8,0x808a,
-0x961e,0x4f0e,0x4f18,0x4f2c,0x4ef5,0x4f14,0x4ef1,0x4f00,
-0x4ef7,0x4f08,0x4f1d,0x4f02,0x4f05,0x4f22,0x4f13,0x4f04,
-0x4ef4,0x4f12,0x51b1,0x5213,0x5209,0x5210,0x52a6,0x5322,
-0x531f,0x534d,0x538a,0x5407,0x56e1,0x56df,0x572e,0x572a,
-0x5734,0x593c,0x5980,0x597c,0x5985,0x597b,0x597e,0x5977,
-0x597f,0x5b56,0x5c15,0x5c25,0x5c7c,0x5c7a,0x5c7b,0x5c7e,
-0x5ddf,0x5e75,0x5e84,0x5f02,0x5f1a,0x5f74,0x5fd5,0x5fd4,
-0x5fcf,0x625c,0x625e,0x6264,0x6261,0x6266,0x6262,0x6259,
-0x6260,0x625a,0x6265,0x65ef,0x65ee,0x673e,0x6739,0x6738,
-0x673b,0x673a,0x673f,0x673c,0x6733,0x6c18,0x6c46,0x6c52,
-0x6c5c,0x6c4f,0x6c4a,0x6c54,0x6c4b,0x6c4c,0x7071,0x725e,
-0x72b4,0x72b5,0x738e,0x752a,0x767f,0x7a75,0x7f51,0x8278,
-0x827c,0x8280,0x827d,0x827f,0x864d,0x897e,0x9099,0x9097,
-0x9098,0x909b,0x9094,0x9622,0x9624,0x9620,0x9623,0x4f56,
-0x4f3b,0x4f62,0x4f49,0x4f53,0x4f64,0x4f3e,0x4f67,0x4f52,
-0x4f5f,0x4f41,0x4f58,0x4f2d,0x4f33,0x4f3f,0x4f61,0x518f,
-0x51b9,0x521c,0x521e,0x5221,0x52ad,0x52ae,0x5309,0x5363,
-0x5372,0x538e,0x538f,0x5430,0x5437,0x542a,0x5454,0x5445,
-0x5419,0x541c,0x5425,0x5418,0x543d,0x544f,0x5441,0x5428,
-0x5424,0x5447,0x56ee,0x56e7,0x56e5,0x5741,0x5745,0x574c,
-0x5749,0x574b,0x5752,0x5906,0x5940,0x59a6,0x5998,0x59a0,
-0x5997,0x598e,0x59a2,0x5990,0x598f,0x59a7,0x59a1,0x5b8e,
-0x5b92,0x5c28,0x5c2a,0x5c8d,0x5c8f,0x5c88,0x5c8b,0x5c89,
-0x5c92,0x5c8a,0x5c86,0x5c93,0x5c95,0x5de0,0x5e0a,0x5e0e,
-0x5e8b,0x5e89,0x5e8c,0x5e88,0x5e8d,0x5f05,0x5f1d,0x5f78,
-0x5f76,0x5fd2,0x5fd1,0x5fd0,0x5fed,0x5fe8,0x5fee,0x5ff3,
-0x5fe1,0x5fe4,0x5fe3,0x5ffa,0x5fef,0x5ff7,0x5ffb,0x6000,
-0x5ff4,0x623a,0x6283,0x628c,0x628e,0x628f,0x6294,0x6287,
-0x6271,0x627b,0x627a,0x6270,0x6281,0x6288,0x6277,0x627d,
-0x6272,0x6274,0x6537,0x65f0,0x65f4,0x65f3,0x65f2,0x65f5,
-0x6745,0x6747,0x6759,0x6755,0x674c,0x6748,0x675d,0x674d,
-0x675a,0x674b,0x6bd0,0x6c19,0x6c1a,0x6c78,0x6c67,0x6c6b,
-0x6c84,0x6c8b,0x6c8f,0x6c71,0x6c6f,0x6c69,0x6c9a,0x6c6d,
-0x6c87,0x6c95,0x6c9c,0x6c66,0x6c73,0x6c65,0x6c7b,0x6c8e,
-0x7074,0x707a,0x7263,0x72bf,0x72bd,0x72c3,0x72c6,0x72c1,
-0x72ba,0x72c5,0x7395,0x7397,0x7393,0x7394,0x7392,0x753a,
-0x7539,0x7594,0x7595,0x7681,0x793d,0x8034,0x8095,0x8099,
-0x8090,0x8092,0x809c,0x8290,0x828f,0x8285,0x828e,0x8291,
-0x8293,0x828a,0x8283,0x8284,0x8c78,0x8fc9,0x8fbf,0x909f,
-0x90a1,0x90a5,0x909e,0x90a7,0x90a0,0x9630,0x9628,0x962f,
-0x962d,0x4e33,0x4f98,0x4f7c,0x4f85,0x4f7d,0x4f80,0x4f87,
-0x4f76,0x4f74,0x4f89,0x4f84,0x4f77,0x4f4c,0x4f97,0x4f6a,
-0x4f9a,0x4f79,0x4f81,0x4f78,0x4f90,0x4f9c,0x4f94,0x4f9e,
-0x4f92,0x4f82,0x4f95,0x4f6b,0x4f6e,0x519e,0x51bc,0x51be,
-0x5235,0x5232,0x5233,0x5246,0x5231,0x52bc,0x530a,0x530b,
-0x533c,0x5392,0x5394,0x5487,0x547f,0x5481,0x5491,0x5482,
-0x5488,0x546b,0x547a,0x547e,0x5465,0x546c,0x5474,0x5466,
-0x548d,0x546f,0x5461,0x5460,0x5498,0x5463,0x5467,0x5464,
-0x56f7,0x56f9,0x576f,0x5772,0x576d,0x576b,0x5771,0x5770,
-0x5776,0x5780,0x5775,0x577b,0x5773,0x5774,0x5762,0x5768,
-0x577d,0x590c,0x5945,0x59b5,0x59ba,0x59cf,0x59ce,0x59b2,
-0x59cc,0x59c1,0x59b6,0x59bc,0x59c3,0x59d6,0x59b1,0x59bd,
-0x59c0,0x59c8,0x59b4,0x59c7,0x5b62,0x5b65,0x5b93,0x5b95,
-0x5c44,0x5c47,0x5cae,0x5ca4,0x5ca0,0x5cb5,0x5caf,0x5ca8,
-0x5cac,0x5c9f,0x5ca3,0x5cad,0x5ca2,0x5caa,0x5ca7,0x5c9d,
-0x5ca5,0x5cb6,0x5cb0,0x5ca6,0x5e17,0x5e14,0x5e19,0x5f28,
-0x5f22,0x5f23,0x5f24,0x5f54,0x5f82,0x5f7e,0x5f7d,0x5fde,
-0x5fe5,0x602d,0x6026,0x6019,0x6032,0x600b,0x6034,0x600a,
-0x6017,0x6033,0x601a,0x601e,0x602c,0x6022,0x600d,0x6010,
-0x602e,0x6013,0x6011,0x600c,0x6009,0x601c,0x6214,0x623d,
-0x62ad,0x62b4,0x62d1,0x62be,0x62aa,0x62b6,0x62ca,0x62ae,
-0x62b3,0x62af,0x62bb,0x62a9,0x62b0,0x62b8,0x653d,0x65a8,
-0x65bb,0x6609,0x65fc,0x6604,0x6612,0x6608,0x65fb,0x6603,
-0x660b,0x660d,0x6605,0x65fd,0x6611,0x6610,0x66f6,0x670a,
-0x6785,0x676c,0x678e,0x6792,0x6776,0x677b,0x6798,0x6786,
-0x6784,0x6774,0x678d,0x678c,0x677a,0x679f,0x6791,0x6799,
-0x6783,0x677d,0x6781,0x6778,0x6779,0x6794,0x6b25,0x6b80,
-0x6b7e,0x6bde,0x6c1d,0x6c93,0x6cec,0x6ceb,0x6cee,0x6cd9,
-0x6cb6,0x6cd4,0x6cad,0x6ce7,0x6cb7,0x6cd0,0x6cc2,0x6cba,
-0x6cc3,0x6cc6,0x6ced,0x6cf2,0x6cd2,0x6cdd,0x6cb4,0x6c8a,
-0x6c9d,0x6c80,0x6cde,0x6cc0,0x6d30,0x6ccd,0x6cc7,0x6cb0,
-0x6cf9,0x6ccf,0x6ce9,0x6cd1,0x7094,0x7098,0x7085,0x7093,
-0x7086,0x7084,0x7091,0x7096,0x7082,0x709a,0x7083,0x726a,
-0x72d6,0x72cb,0x72d8,0x72c9,0x72dc,0x72d2,0x72d4,0x72da,
-0x72cc,0x72d1,0x73a4,0x73a1,0x73ad,0x73a6,0x73a2,0x73a0,
-0x73ac,0x739d,0x74dd,0x74e8,0x753f,0x7540,0x753e,0x758c,
-0x7598,0x76af,0x76f3,0x76f1,0x76f0,0x76f5,0x77f8,0x77fc,
-0x77f9,0x77fb,0x77fa,0x77f7,0x7942,0x793f,0x79c5,0x7a78,
-0x7a7b,0x7afb,0x7c75,0x7cfd,0x8035,0x808f,0x80ae,0x80a3,
-0x80b8,0x80b5,0x80ad,0x8220,0x82a0,0x82c0,0x82ab,0x829a,
-0x8298,0x829b,0x82b5,0x82a7,0x82ae,0x82bc,0x829e,0x82ba,
-0x82b4,0x82a8,0x82a1,0x82a9,0x82c2,0x82a4,0x82c3,0x82b6,
-0x82a2,0x8670,0x866f,0x866d,0x866e,0x8c56,0x8fd2,0x8fcb,
-0x8fd3,0x8fcd,0x8fd6,0x8fd5,0x8fd7,0x90b2,0x90b4,0x90af,
-0x90b3,0x90b0,0x9639,0x963d,0x963c,0x963a,0x9643,0x4fcd,
-0x4fc5,0x4fd3,0x4fb2,0x4fc9,0x4fcb,0x4fc1,0x4fd4,0x4fdc,
-0x4fd9,0x4fbb,0x4fb3,0x4fdb,0x4fc7,0x4fd6,0x4fba,0x4fc0,
-0x4fb9,0x4fec,0x5244,0x5249,0x52c0,0x52c2,0x533d,0x537c,
-0x5397,0x5396,0x5399,0x5398,0x54ba,0x54a1,0x54ad,0x54a5,
-0x54cf,0x54c3,0x830d,0x54b7,0x54ae,0x54d6,0x54b6,0x54c5,
-0x54c6,0x54a0,0x5470,0x54bc,0x54a2,0x54be,0x5472,0x54de,
-0x54b0,0x57b5,0x579e,0x579f,0x57a4,0x578c,0x5797,0x579d,
-0x579b,0x5794,0x5798,0x578f,0x5799,0x57a5,0x579a,0x5795,
-0x58f4,0x590d,0x5953,0x59e1,0x59de,0x59ee,0x5a00,0x59f1,
-0x59dd,0x59fa,0x59fd,0x59fc,0x59f6,0x59e4,0x59f2,0x59f7,
-0x59db,0x59e9,0x59f3,0x59f5,0x59e0,0x59fe,0x59f4,0x59ed,
-0x5ba8,0x5c4c,0x5cd0,0x5cd8,0x5ccc,0x5cd7,0x5ccb,0x5cdb,
-0x5cde,0x5cda,0x5cc9,0x5cc7,0x5cca,0x5cd6,0x5cd3,0x5cd4,
-0x5ccf,0x5cc8,0x5cc6,0x5cce,0x5cdf,0x5cf8,0x5df9,0x5e21,
-0x5e22,0x5e23,0x5e20,0x5e24,0x5eb0,0x5ea4,0x5ea2,0x5e9b,
-0x5ea3,0x5ea5,0x5f07,0x5f2e,0x5f56,0x5f86,0x6037,0x6039,
-0x6054,0x6072,0x605e,0x6045,0x6053,0x6047,0x6049,0x605b,
-0x604c,0x6040,0x6042,0x605f,0x6024,0x6044,0x6058,0x6066,
-0x606e,0x6242,0x6243,0x62cf,0x630d,0x630b,0x62f5,0x630e,
-0x6303,0x62eb,0x62f9,0x630f,0x630c,0x62f8,0x62f6,0x6300,
-0x6313,0x6314,0x62fa,0x6315,0x62fb,0x62f0,0x6541,0x6543,
-0x65aa,0x65bf,0x6636,0x6621,0x6632,0x6635,0x661c,0x6626,
-0x6622,0x6633,0x662b,0x663a,0x661d,0x6634,0x6639,0x662e,
-0x670f,0x6710,0x67c1,0x67f2,0x67c8,0x67ba,0x67dc,0x67bb,
-0x67f8,0x67d8,0x67c0,0x67b7,0x67c5,0x67eb,0x67e4,0x67df,
-0x67b5,0x67cd,0x67b3,0x67f7,0x67f6,0x67ee,0x67e3,0x67c2,
-0x67b9,0x67ce,0x67e7,0x67f0,0x67b2,0x67fc,0x67c6,0x67ed,
-0x67cc,0x67ae,0x67e6,0x67db,0x67fa,0x67c9,0x67ca,0x67c3,
-0x67ea,0x67cb,0x6b28,0x6b82,0x6b84,0x6bb6,0x6bd6,0x6bd8,
-0x6be0,0x6c20,0x6c21,0x6d28,0x6d34,0x6d2d,0x6d1f,0x6d3c,
-0x6d3f,0x6d12,0x6d0a,0x6cda,0x6d33,0x6d04,0x6d19,0x6d3a,
-0x6d1a,0x6d11,0x6d00,0x6d1d,0x6d42,0x6d01,0x6d18,0x6d37,
-0x6d03,0x6d0f,0x6d40,0x6d07,0x6d20,0x6d2c,0x6d08,0x6d22,
-0x6d09,0x6d10,0x70b7,0x709f,0x70be,0x70b1,0x70b0,0x70a1,
-0x70b4,0x70b5,0x70a9,0x7241,0x7249,0x724a,0x726c,0x7270,
-0x7273,0x726e,0x72ca,0x72e4,0x72e8,0x72eb,0x72df,0x72ea,
-0x72e6,0x72e3,0x7385,0x73cc,0x73c2,0x73c8,0x73c5,0x73b9,
-0x73b6,0x73b5,0x73b4,0x73eb,0x73bf,0x73c7,0x73be,0x73c3,
-0x73c6,0x73b8,0x73cb,0x74ec,0x74ee,0x752e,0x7547,0x7548,
-0x75a7,0x75aa,0x7679,0x76c4,0x7708,0x7703,0x7704,0x7705,
-0x770a,0x76f7,0x76fb,0x76fa,0x77e7,0x77e8,0x7806,0x7811,
-0x7812,0x7805,0x7810,0x780f,0x780e,0x7809,0x7803,0x7813,
-0x794a,0x794c,0x794b,0x7945,0x7944,0x79d5,0x79cd,0x79cf,
-0x79d6,0x79ce,0x7a80,0x7a7e,0x7ad1,0x7b00,0x7b01,0x7c7a,
-0x7c78,0x7c79,0x7c7f,0x7c80,0x7c81,0x7d03,0x7d08,0x7d01,
-0x7f58,0x7f91,0x7f8d,0x7fbe,0x8007,0x800e,0x800f,0x8014,
-0x8037,0x80d8,0x80c7,0x80e0,0x80d1,0x80c8,0x80c2,0x80d0,
-0x80c5,0x80e3,0x80d9,0x80dc,0x80ca,0x80d5,0x80c9,0x80cf,
-0x80d7,0x80e6,0x80cd,0x81ff,0x8221,0x8294,0x82d9,0x82fe,
-0x82f9,0x8307,0x82e8,0x8300,0x82d5,0x833a,0x82eb,0x82d6,
-0x82f4,0x82ec,0x82e1,0x82f2,0x82f5,0x830c,0x82fb,0x82f6,
-0x82f0,0x82ea,0x82e4,0x82e0,0x82fa,0x82f3,0x82ed,0x8677,
-0x8674,0x867c,0x8673,0x8841,0x884e,0x8867,0x886a,0x8869,
-0x89d3,0x8a04,0x8a07,0x8d72,0x8fe3,0x8fe1,0x8fee,0x8fe0,
-0x90f1,0x90bd,0x90bf,0x90d5,0x90c5,0x90be,0x90c7,0x90cb,
-0x90c8,0x91d4,0x91d3,0x9654,0x964f,0x9651,0x9653,0x964a,
-0x964e,0x501e,0x5005,0x5007,0x5013,0x5022,0x5030,0x501b,
-0x4ff5,0x4ff4,0x5033,0x5037,0x502c,0x4ff6,0x4ff7,0x5017,
-0x501c,0x5020,0x5027,0x5035,0x502f,0x5031,0x500e,0x515a,
-0x5194,0x5193,0x51ca,0x51c4,0x51c5,0x51c8,0x51ce,0x5261,
-0x525a,0x5252,0x525e,0x525f,0x5255,0x5262,0x52cd,0x530e,
-0x539e,0x5526,0x54e2,0x5517,0x5512,0x54e7,0x54f3,0x54e4,
-0x551a,0x54ff,0x5504,0x5508,0x54eb,0x5511,0x5505,0x54f1,
-0x550a,0x54fb,0x54f7,0x54f8,0x54e0,0x550e,0x5503,0x550b,
-0x5701,0x5702,0x57cc,0x5832,0x57d5,0x57d2,0x57ba,0x57c6,
-0x57bd,0x57bc,0x57b8,0x57b6,0x57bf,0x57c7,0x57d0,0x57b9,
-0x57c1,0x590e,0x594a,0x5a19,0x5a16,0x5a2d,0x5a2e,0x5a15,
-0x5a0f,0x5a17,0x5a0a,0x5a1e,0x5a33,0x5b6c,0x5ba7,0x5bad,
-0x5bac,0x5c03,0x5c56,0x5c54,0x5cec,0x5cff,0x5cee,0x5cf1,
-0x5cf7,0x5d00,0x5cf9,0x5e29,0x5e28,0x5ea8,0x5eae,0x5eaa,
-0x5eac,0x5f33,0x5f30,0x5f67,0x605d,0x605a,0x6067,0x6041,
-0x60a2,0x6088,0x6080,0x6092,0x6081,0x609d,0x6083,0x6095,
-0x609b,0x6097,0x6087,0x609c,0x608e,0x6219,0x6246,0x62f2,
-0x6310,0x6356,0x632c,0x6344,0x6345,0x6336,0x6343,0x63e4,
-0x6339,0x634b,0x634a,0x633c,0x6329,0x6341,0x6334,0x6358,
-0x6354,0x6359,0x632d,0x6347,0x6333,0x635a,0x6351,0x6338,
-0x6357,0x6340,0x6348,0x654a,0x6546,0x65c6,0x65c3,0x65c4,
-0x65c2,0x664a,0x665f,0x6647,0x6651,0x6712,0x6713,0x681f,
-0x681a,0x6849,0x6832,0x6833,0x683b,0x684b,0x684f,0x6816,
-0x6831,0x681c,0x6835,0x682b,0x682d,0x682f,0x684e,0x6844,
-0x6834,0x681d,0x6812,0x6814,0x6826,0x6828,0x682e,0x684d,
-0x683a,0x6825,0x6820,0x6b2c,0x6b2f,0x6b2d,0x6b31,0x6b34,
-0x6b6d,0x8082,0x6b88,0x6be6,0x6be4,0x6be8,0x6be3,0x6be2,
-0x6be7,0x6c25,0x6d7a,0x6d63,0x6d64,0x6d76,0x6d0d,0x6d61,
-0x6d92,0x6d58,0x6d62,0x6d6d,0x6d6f,0x6d91,0x6d8d,0x6def,
-0x6d7f,0x6d86,0x6d5e,0x6d67,0x6d60,0x6d97,0x6d70,0x6d7c,
-0x6d5f,0x6d82,0x6d98,0x6d2f,0x6d68,0x6d8b,0x6d7e,0x6d80,
-0x6d84,0x6d16,0x6d83,0x6d7b,0x6d7d,0x6d75,0x6d90,0x70dc,
-0x70d3,0x70d1,0x70dd,0x70cb,0x7f39,0x70e2,0x70d7,0x70d2,
-0x70de,0x70e0,0x70d4,0x70cd,0x70c5,0x70c6,0x70c7,0x70da,
-0x70ce,0x70e1,0x7242,0x7278,0x7277,0x7276,0x7300,0x72fa,
-0x72f4,0x72fe,0x72f6,0x72f3,0x72fb,0x7301,0x73d3,0x73d9,
-0x73e5,0x73d6,0x73bc,0x73e7,0x73e3,0x73e9,0x73dc,0x73d2,
-0x73db,0x73d4,0x73dd,0x73da,0x73d7,0x73d8,0x73e8,0x74de,
-0x74df,0x74f4,0x74f5,0x7521,0x755b,0x755f,0x75b0,0x75c1,
-0x75bb,0x75c4,0x75c0,0x75bf,0x75b6,0x75ba,0x768a,0x76c9,
-0x771d,0x771b,0x7710,0x7713,0x7712,0x7723,0x7711,0x7715,
-0x7719,0x771a,0x7722,0x7727,0x7823,0x782c,0x7822,0x7835,
-0x782f,0x7828,0x782e,0x782b,0x7821,0x7829,0x7833,0x782a,
-0x7831,0x7954,0x795b,0x794f,0x795c,0x7953,0x7952,0x7951,
-0x79eb,0x79ec,0x79e0,0x79ee,0x79ed,0x79ea,0x79dc,0x79de,
-0x79dd,0x7a86,0x7a89,0x7a85,0x7a8b,0x7a8c,0x7a8a,0x7a87,
-0x7ad8,0x7b10,0x7b04,0x7b13,0x7b05,0x7b0f,0x7b08,0x7b0a,
-0x7b0e,0x7b09,0x7b12,0x7c84,0x7c91,0x7c8a,0x7c8c,0x7c88,
-0x7c8d,0x7c85,0x7d1e,0x7d1d,0x7d11,0x7d0e,0x7d18,0x7d16,
-0x7d13,0x7d1f,0x7d12,0x7d0f,0x7d0c,0x7f5c,0x7f61,0x7f5e,
-0x7f60,0x7f5d,0x7f5b,0x7f96,0x7f92,0x7fc3,0x7fc2,0x7fc0,
-0x8016,0x803e,0x8039,0x80fa,0x80f2,0x80f9,0x80f5,0x8101,
-0x80fb,0x8100,0x8201,0x822f,0x8225,0x8333,0x832d,0x8344,
-0x8319,0x8351,0x8325,0x8356,0x833f,0x8341,0x8326,0x831c,
-0x8322,0x8342,0x834e,0x831b,0x832a,0x8308,0x833c,0x834d,
-0x8316,0x8324,0x8320,0x8337,0x832f,0x8329,0x8347,0x8345,
-0x834c,0x8353,0x831e,0x832c,0x834b,0x8327,0x8348,0x8653,
-0x8652,0x86a2,0x86a8,0x8696,0x868d,0x8691,0x869e,0x8687,
-0x8697,0x8686,0x868b,0x869a,0x8685,0x86a5,0x8699,0x86a1,
-0x86a7,0x8695,0x8698,0x868e,0x869d,0x8690,0x8694,0x8843,
-0x8844,0x886d,0x8875,0x8876,0x8872,0x8880,0x8871,0x887f,
-0x886f,0x8883,0x887e,0x8874,0x887c,0x8a12,0x8c47,0x8c57,
-0x8c7b,0x8ca4,0x8ca3,0x8d76,0x8d78,0x8db5,0x8db7,0x8db6,
-0x8ed1,0x8ed3,0x8ffe,0x8ff5,0x9002,0x8fff,0x8ffb,0x9004,
-0x8ffc,0x8ff6,0x90d6,0x90e0,0x90d9,0x90da,0x90e3,0x90df,
-0x90e5,0x90d8,0x90db,0x90d7,0x90dc,0x90e4,0x9150,0x914e,
-0x914f,0x91d5,0x91e2,0x91da,0x965c,0x965f,0x96bc,0x98e3,
-0x9adf,0x9b2f,0x4e7f,0x5070,0x506a,0x5061,0x505e,0x5060,
-0x5053,0x504b,0x505d,0x5072,0x5048,0x504d,0x5041,0x505b,
-0x504a,0x5062,0x5015,0x5045,0x505f,0x5069,0x506b,0x5063,
-0x5064,0x5046,0x5040,0x506e,0x5073,0x5057,0x5051,0x51d0,
-0x526b,0x526d,0x526c,0x526e,0x52d6,0x52d3,0x532d,0x539c,
-0x5575,0x5576,0x553c,0x554d,0x5550,0x5534,0x552a,0x5551,
-0x5562,0x5536,0x5535,0x5530,0x5552,0x5545,0x550c,0x5532,
-0x5565,0x554e,0x5539,0x5548,0x552d,0x553b,0x5540,0x554b,
-0x570a,0x5707,0x57fb,0x5814,0x57e2,0x57f6,0x57dc,0x57f4,
-0x5800,0x57ed,0x57fd,0x5808,0x57f8,0x580b,0x57f3,0x57cf,
-0x5807,0x57ee,0x57e3,0x57f2,0x57e5,0x57ec,0x57e1,0x580e,
-0x57fc,0x5810,0x57e7,0x5801,0x580c,0x57f1,0x57e9,0x57f0,
-0x580d,0x5804,0x595c,0x5a60,0x5a58,0x5a55,0x5a67,0x5a5e,
-0x5a38,0x5a35,0x5a6d,0x5a50,0x5a5f,0x5a65,0x5a6c,0x5a53,
-0x5a64,0x5a57,0x5a43,0x5a5d,0x5a52,0x5a44,0x5a5b,0x5a48,
-0x5a8e,0x5a3e,0x5a4d,0x5a39,0x5a4c,0x5a70,0x5a69,0x5a47,
-0x5a51,0x5a56,0x5a42,0x5a5c,0x5b72,0x5b6e,0x5bc1,0x5bc0,
-0x5c59,0x5d1e,0x5d0b,0x5d1d,0x5d1a,0x5d20,0x5d0c,0x5d28,
-0x5d0d,0x5d26,0x5d25,0x5d0f,0x5d30,0x5d12,0x5d23,0x5d1f,
-0x5d2e,0x5e3e,0x5e34,0x5eb1,0x5eb4,0x5eb9,0x5eb2,0x5eb3,
-0x5f36,0x5f38,0x5f9b,0x5f96,0x5f9f,0x608a,0x6090,0x6086,
-0x60be,0x60b0,0x60ba,0x60d3,0x60d4,0x60cf,0x60e4,0x60d9,
-0x60dd,0x60c8,0x60b1,0x60db,0x60b7,0x60ca,0x60bf,0x60c3,
-0x60cd,0x60c0,0x6332,0x6365,0x638a,0x6382,0x637d,0x63bd,
-0x639e,0x63ad,0x639d,0x6397,0x63ab,0x638e,0x636f,0x6387,
-0x6390,0x636e,0x63af,0x6375,0x639c,0x636d,0x63ae,0x637c,
-0x63a4,0x633b,0x639f,0x6378,0x6385,0x6381,0x6391,0x638d,
-0x6370,0x6553,0x65cd,0x6665,0x6661,0x665b,0x6659,0x665c,
-0x6662,0x6718,0x6879,0x6887,0x6890,0x689c,0x686d,0x686e,
-0x68ae,0x68ab,0x6956,0x686f,0x68a3,0x68ac,0x68a9,0x6875,
-0x6874,0x68b2,0x688f,0x6877,0x6892,0x687c,0x686b,0x6872,
-0x68aa,0x6880,0x6871,0x687e,0x689b,0x6896,0x688b,0x68a0,
-0x6889,0x68a4,0x6878,0x687b,0x6891,0x688c,0x688a,0x687d,
-0x6b36,0x6b33,0x6b37,0x6b38,0x6b91,0x6b8f,0x6b8d,0x6b8e,
-0x6b8c,0x6c2a,0x6dc0,0x6dab,0x6db4,0x6db3,0x6e74,0x6dac,
-0x6de9,0x6de2,0x6db7,0x6df6,0x6dd4,0x6e00,0x6dc8,0x6de0,
-0x6ddf,0x6dd6,0x6dbe,0x6de5,0x6ddc,0x6ddd,0x6ddb,0x6df4,
-0x6dca,0x6dbd,0x6ded,0x6df0,0x6dba,0x6dd5,0x6dc2,0x6dcf,
-0x6dc9,0x6dd0,0x6df2,0x6dd3,0x6dfd,0x6dd7,0x6dcd,0x6de3,
-0x6dbb,0x70fa,0x710d,0x70f7,0x7117,0x70f4,0x710c,0x70f0,
-0x7104,0x70f3,0x7110,0x70fc,0x70ff,0x7106,0x7113,0x7100,
-0x70f8,0x70f6,0x710b,0x7102,0x710e,0x727e,0x727b,0x727c,
-0x727f,0x731d,0x7317,0x7307,0x7311,0x7318,0x730a,0x7308,
-0x72ff,0x730f,0x731e,0x7388,0x73f6,0x73f8,0x73f5,0x7404,
-0x7401,0x73fd,0x7407,0x7400,0x73fa,0x73fc,0x73ff,0x740c,
-0x740b,0x73f4,0x7408,0x7564,0x7563,0x75ce,0x75d2,0x75cf,
-0x75cb,0x75cc,0x75d1,0x75d0,0x768f,0x7689,0x76d3,0x7739,
-0x772f,0x772d,0x7731,0x7732,0x7734,0x7733,0x773d,0x7725,
-0x773b,0x7735,0x7848,0x7852,0x7849,0x784d,0x784a,0x784c,
-0x7826,0x7845,0x7850,0x7964,0x7967,0x7969,0x796a,0x7963,
-0x796b,0x7961,0x79bb,0x79fa,0x79f8,0x79f6,0x79f7,0x7a8f,
-0x7a94,0x7a90,0x7b35,0x7b47,0x7b34,0x7b25,0x7b30,0x7b22,
-0x7b24,0x7b33,0x7b18,0x7b2a,0x7b1d,0x7b31,0x7b2b,0x7b2d,
-0x7b2f,0x7b32,0x7b38,0x7b1a,0x7b23,0x7c94,0x7c98,0x7c96,
-0x7ca3,0x7d35,0x7d3d,0x7d38,0x7d36,0x7d3a,0x7d45,0x7d2c,
-0x7d29,0x7d41,0x7d47,0x7d3e,0x7d3f,0x7d4a,0x7d3b,0x7d28,
-0x7f63,0x7f95,0x7f9c,0x7f9d,0x7f9b,0x7fca,0x7fcb,0x7fcd,
-0x7fd0,0x7fd1,0x7fc7,0x7fcf,0x7fc9,0x801f,0x801e,0x801b,
-0x8047,0x8043,0x8048,0x8118,0x8125,0x8119,0x811b,0x812d,
-0x811f,0x812c,0x811e,0x8121,0x8115,0x8127,0x811d,0x8122,
-0x8211,0x8238,0x8233,0x823a,0x8234,0x8232,0x8274,0x8390,
-0x83a3,0x83a8,0x838d,0x837a,0x8373,0x83a4,0x8374,0x838f,
-0x8381,0x8395,0x8399,0x8375,0x8394,0x83a9,0x837d,0x8383,
-0x838c,0x839d,0x839b,0x83aa,0x838b,0x837e,0x83a5,0x83af,
-0x8388,0x8397,0x83b0,0x837f,0x83a6,0x8387,0x83ae,0x8376,
-0x839a,0x8659,0x8656,0x86bf,0x86b7,0x86c2,0x86c1,0x86c5,
-0x86ba,0x86b0,0x86c8,0x86b9,0x86b3,0x86b8,0x86cc,0x86b4,
-0x86bb,0x86bc,0x86c3,0x86bd,0x86be,0x8852,0x8889,0x8895,
-0x88a8,0x88a2,0x88aa,0x889a,0x8891,0x88a1,0x889f,0x8898,
-0x88a7,0x8899,0x889b,0x8897,0x88a4,0x88ac,0x888c,0x8893,
-0x888e,0x8982,0x89d6,0x89d9,0x89d5,0x8a30,0x8a27,0x8a2c,
-0x8a1e,0x8c39,0x8c3b,0x8c5c,0x8c5d,0x8c7d,0x8ca5,0x8d7d,
-0x8d7b,0x8d79,0x8dbc,0x8dc2,0x8db9,0x8dbf,0x8dc1,0x8ed8,
-0x8ede,0x8edd,0x8edc,0x8ed7,0x8ee0,0x8ee1,0x9024,0x900b,
-0x9011,0x901c,0x900c,0x9021,0x90ef,0x90ea,0x90f0,0x90f4,
-0x90f2,0x90f3,0x90d4,0x90eb,0x90ec,0x90e9,0x9156,0x9158,
-0x915a,0x9153,0x9155,0x91ec,0x91f4,0x91f1,0x91f3,0x91f8,
-0x91e4,0x91f9,0x91ea,0x91eb,0x91f7,0x91e8,0x91ee,0x957a,
-0x9586,0x9588,0x967c,0x966d,0x966b,0x9671,0x966f,0x96bf,
-0x976a,0x9804,0x98e5,0x9997,0x509b,0x5095,0x5094,0x509e,
-0x508b,0x50a3,0x5083,0x508c,0x508e,0x509d,0x5068,0x509c,
-0x5092,0x5082,0x5087,0x515f,0x51d4,0x5312,0x5311,0x53a4,
-0x53a7,0x5591,0x55a8,0x55a5,0x55ad,0x5577,0x5645,0x55a2,
-0x5593,0x5588,0x558f,0x55b5,0x5581,0x55a3,0x5592,0x55a4,
-0x557d,0x558c,0x55a6,0x557f,0x5595,0x55a1,0x558e,0x570c,
-0x5829,0x5837,0x5819,0x581e,0x5827,0x5823,0x5828,0x57f5,
-0x5848,0x5825,0x581c,0x581b,0x5833,0x583f,0x5836,0x582e,
-0x5839,0x5838,0x582d,0x582c,0x583b,0x5961,0x5aaf,0x5a94,
-0x5a9f,0x5a7a,0x5aa2,0x5a9e,0x5a78,0x5aa6,0x5a7c,0x5aa5,
-0x5aac,0x5a95,0x5aae,0x5a37,0x5a84,0x5a8a,0x5a97,0x5a83,
-0x5a8b,0x5aa9,0x5a7b,0x5a7d,0x5a8c,0x5a9c,0x5a8f,0x5a93,
-0x5a9d,0x5bea,0x5bcd,0x5bcb,0x5bd4,0x5bd1,0x5bca,0x5bce,
-0x5c0c,0x5c30,0x5d37,0x5d43,0x5d6b,0x5d41,0x5d4b,0x5d3f,
-0x5d35,0x5d51,0x5d4e,0x5d55,0x5d33,0x5d3a,0x5d52,0x5d3d,
-0x5d31,0x5d59,0x5d42,0x5d39,0x5d49,0x5d38,0x5d3c,0x5d32,
-0x5d36,0x5d40,0x5d45,0x5e44,0x5e41,0x5f58,0x5fa6,0x5fa5,
-0x5fab,0x60c9,0x60b9,0x60cc,0x60e2,0x60ce,0x60c4,0x6114,
-0x60f2,0x610a,0x6116,0x6105,0x60f5,0x6113,0x60f8,0x60fc,
-0x60fe,0x60c1,0x6103,0x6118,0x611d,0x6110,0x60ff,0x6104,
-0x610b,0x624a,0x6394,0x63b1,0x63b0,0x63ce,0x63e5,0x63e8,
-0x63ef,0x63c3,0x649d,0x63f3,0x63ca,0x63e0,0x63f6,0x63d5,
-0x63f2,0x63f5,0x6461,0x63df,0x63be,0x63dd,0x63dc,0x63c4,
-0x63d8,0x63d3,0x63c2,0x63c7,0x63cc,0x63cb,0x63c8,0x63f0,
-0x63d7,0x63d9,0x6532,0x6567,0x656a,0x6564,0x655c,0x6568,
-0x6565,0x658c,0x659d,0x659e,0x65ae,0x65d0,0x65d2,0x667c,
-0x666c,0x667b,0x6680,0x6671,0x6679,0x666a,0x6672,0x6701,
-0x690c,0x68d3,0x6904,0x68dc,0x692a,0x68ec,0x68ea,0x68f1,
-0x690f,0x68d6,0x68f7,0x68eb,0x68e4,0x68f6,0x6913,0x6910,
-0x68f3,0x68e1,0x6907,0x68cc,0x6908,0x6970,0x68b4,0x6911,
-0x68ef,0x68c6,0x6914,0x68f8,0x68d0,0x68fd,0x68fc,0x68e8,
-0x690b,0x690a,0x6917,0x68ce,0x68c8,0x68dd,0x68de,0x68e6,
-0x68f4,0x68d1,0x6906,0x68d4,0x68e9,0x6915,0x6925,0x68c7,
-0x6b39,0x6b3b,0x6b3f,0x6b3c,0x6b94,0x6b97,0x6b99,0x6b95,
-0x6bbd,0x6bf0,0x6bf2,0x6bf3,0x6c30,0x6dfc,0x6e46,0x6e47,
-0x6e1f,0x6e49,0x6e88,0x6e3c,0x6e3d,0x6e45,0x6e62,0x6e2b,
-0x6e3f,0x6e41,0x6e5d,0x6e73,0x6e1c,0x6e33,0x6e4b,0x6e40,
-0x6e51,0x6e3b,0x6e03,0x6e2e,0x6e5e,0x6e68,0x6e5c,0x6e61,
-0x6e31,0x6e28,0x6e60,0x6e71,0x6e6b,0x6e39,0x6e22,0x6e30,
-0x6e53,0x6e65,0x6e27,0x6e78,0x6e64,0x6e77,0x6e55,0x6e79,
-0x6e52,0x6e66,0x6e35,0x6e36,0x6e5a,0x7120,0x711e,0x712f,
-0x70fb,0x712e,0x7131,0x7123,0x7125,0x7122,0x7132,0x711f,
-0x7128,0x713a,0x711b,0x724b,0x725a,0x7288,0x7289,0x7286,
-0x7285,0x728b,0x7312,0x730b,0x7330,0x7322,0x7331,0x7333,
-0x7327,0x7332,0x732d,0x7326,0x7323,0x7335,0x730c,0x742e,
-0x742c,0x7430,0x742b,0x7416,0x741a,0x7421,0x742d,0x7431,
-0x7424,0x7423,0x741d,0x7429,0x7420,0x7432,0x74fb,0x752f,
-0x756f,0x756c,0x75e7,0x75da,0x75e1,0x75e6,0x75dd,0x75df,
-0x75e4,0x75d7,0x7695,0x7692,0x76da,0x7746,0x7747,0x7744,
-0x774d,0x7745,0x774a,0x774e,0x774b,0x774c,0x77de,0x77ec,
-0x7860,0x7864,0x7865,0x785c,0x786d,0x7871,0x786a,0x786e,
-0x7870,0x7869,0x7868,0x785e,0x7862,0x7974,0x7973,0x7972,
-0x7970,0x7a02,0x7a0a,0x7a03,0x7a0c,0x7a04,0x7a99,0x7ae6,
-0x7ae4,0x7b4a,0x7b3b,0x7b44,0x7b48,0x7b4c,0x7b4e,0x7b40,
-0x7b58,0x7b45,0x7ca2,0x7c9e,0x7ca8,0x7ca1,0x7d58,0x7d6f,
-0x7d63,0x7d53,0x7d56,0x7d67,0x7d6a,0x7d4f,0x7d6d,0x7d5c,
-0x7d6b,0x7d52,0x7d54,0x7d69,0x7d51,0x7d5f,0x7d4e,0x7f3e,
-0x7f3f,0x7f65,0x7f66,0x7fa2,0x7fa0,0x7fa1,0x7fd7,0x8051,
-0x804f,0x8050,0x80fe,0x80d4,0x8143,0x814a,0x8152,0x814f,
-0x8147,0x813d,0x814d,0x813a,0x81e6,0x81ee,0x81f7,0x81f8,
-0x81f9,0x8204,0x823c,0x823d,0x823f,0x8275,0x833b,0x83cf,
-0x83f9,0x8423,0x83c0,0x83e8,0x8412,0x83e7,0x83e4,0x83fc,
-0x83f6,0x8410,0x83c6,0x83c8,0x83eb,0x83e3,0x83bf,0x8401,
-0x83dd,0x83e5,0x83d8,0x83ff,0x83e1,0x83cb,0x83ce,0x83d6,
-0x83f5,0x83c9,0x8409,0x840f,0x83de,0x8411,0x8406,0x83c2,
-0x83f3,0x83d5,0x83fa,0x83c7,0x83d1,0x83ea,0x8413,0x83c3,
-0x83ec,0x83ee,0x83c4,0x83fb,0x83d7,0x83e2,0x841b,0x83db,
-0x83fe,0x86d8,0x86e2,0x86e6,0x86d3,0x86e3,0x86da,0x86ea,
-0x86dd,0x86eb,0x86dc,0x86ec,0x86e9,0x86d7,0x86e8,0x86d1,
-0x8848,0x8856,0x8855,0x88ba,0x88d7,0x88b9,0x88b8,0x88c0,
-0x88be,0x88b6,0x88bc,0x88b7,0x88bd,0x88b2,0x8901,0x88c9,
-0x8995,0x8998,0x8997,0x89dd,0x89da,0x89db,0x8a4e,0x8a4d,
-0x8a39,0x8a59,0x8a40,0x8a57,0x8a58,0x8a44,0x8a45,0x8a52,
-0x8a48,0x8a51,0x8a4a,0x8a4c,0x8a4f,0x8c5f,0x8c81,0x8c80,
-0x8cba,0x8cbe,0x8cb0,0x8cb9,0x8cb5,0x8d84,0x8d80,0x8d89,
-0x8dd8,0x8dd3,0x8dcd,0x8dc7,0x8dd6,0x8ddc,0x8dcf,0x8dd5,
-0x8dd9,0x8dc8,0x8dd7,0x8dc5,0x8eef,0x8ef7,0x8efa,0x8ef9,
-0x8ee6,0x8eee,0x8ee5,0x8ef5,0x8ee7,0x8ee8,0x8ef6,0x8eeb,
-0x8ef1,0x8eec,0x8ef4,0x8ee9,0x902d,0x9034,0x902f,0x9106,
-0x912c,0x9104,0x90ff,0x90fc,0x9108,0x90f9,0x90fb,0x9101,
-0x9100,0x9107,0x9105,0x9103,0x9161,0x9164,0x915f,0x9162,
-0x9160,0x9201,0x920a,0x9225,0x9203,0x921a,0x9226,0x920f,
-0x920c,0x9200,0x9212,0x91ff,0x91fd,0x9206,0x9204,0x9227,
-0x9202,0x921c,0x9224,0x9219,0x9217,0x9205,0x9216,0x957b,
-0x958d,0x958c,0x9590,0x9687,0x967e,0x9688,0x9689,0x9683,
-0x9680,0x96c2,0x96c8,0x96c3,0x96f1,0x96f0,0x976c,0x9770,
-0x976e,0x9807,0x98a9,0x98eb,0x9ce6,0x9ef9,0x4e83,0x4e84,
-0x4eb6,0x50bd,0x50bf,0x50c6,0x50ae,0x50c4,0x50ca,0x50b4,
-0x50c8,0x50c2,0x50b0,0x50c1,0x50ba,0x50b1,0x50cb,0x50c9,
-0x50b6,0x50b8,0x51d7,0x527a,0x5278,0x527b,0x527c,0x55c3,
-0x55db,0x55cc,0x55d0,0x55cb,0x55ca,0x55dd,0x55c0,0x55d4,
-0x55c4,0x55e9,0x55bf,0x55d2,0x558d,0x55cf,0x55d5,0x55e2,
-0x55d6,0x55c8,0x55f2,0x55cd,0x55d9,0x55c2,0x5714,0x5853,
-0x5868,0x5864,0x584f,0x584d,0x5849,0x586f,0x5855,0x584e,
-0x585d,0x5859,0x5865,0x585b,0x583d,0x5863,0x5871,0x58fc,
-0x5ac7,0x5ac4,0x5acb,0x5aba,0x5ab8,0x5ab1,0x5ab5,0x5ab0,
-0x5abf,0x5ac8,0x5abb,0x5ac6,0x5ab7,0x5ac0,0x5aca,0x5ab4,
-0x5ab6,0x5acd,0x5ab9,0x5a90,0x5bd6,0x5bd8,0x5bd9,0x5c1f,
-0x5c33,0x5d71,0x5d63,0x5d4a,0x5d65,0x5d72,0x5d6c,0x5d5e,
-0x5d68,0x5d67,0x5d62,0x5df0,0x5e4f,0x5e4e,0x5e4a,0x5e4d,
-0x5e4b,0x5ec5,0x5ecc,0x5ec6,0x5ecb,0x5ec7,0x5f40,0x5faf,
-0x5fad,0x60f7,0x6149,0x614a,0x612b,0x6145,0x6136,0x6132,
-0x612e,0x6146,0x612f,0x614f,0x6129,0x6140,0x6220,0x9168,
-0x6223,0x6225,0x6224,0x63c5,0x63f1,0x63eb,0x6410,0x6412,
-0x6409,0x6420,0x6424,0x6433,0x6443,0x641f,0x6415,0x6418,
-0x6439,0x6437,0x6422,0x6423,0x640c,0x6426,0x6430,0x6428,
-0x6441,0x6435,0x642f,0x640a,0x641a,0x6440,0x6425,0x6427,
-0x640b,0x63e7,0x641b,0x642e,0x6421,0x640e,0x656f,0x6592,
-0x65d3,0x6686,0x668c,0x6695,0x6690,0x668b,0x668a,0x6699,
-0x6694,0x6678,0x6720,0x6966,0x695f,0x6938,0x694e,0x6962,
-0x6971,0x693f,0x6945,0x696a,0x6939,0x6942,0x6957,0x6959,
-0x697a,0x6948,0x6949,0x6935,0x696c,0x6933,0x693d,0x6965,
-0x68f0,0x6978,0x6934,0x6969,0x6940,0x696f,0x6944,0x6976,
-0x6958,0x6941,0x6974,0x694c,0x693b,0x694b,0x6937,0x695c,
-0x694f,0x6951,0x6932,0x6952,0x692f,0x697b,0x693c,0x6b46,
-0x6b45,0x6b43,0x6b42,0x6b48,0x6b41,0x6b9b,0xfa0d,0x6bfb,
-0x6bfc,0x6bf9,0x6bf7,0x6bf8,0x6e9b,0x6ed6,0x6ec8,0x6e8f,
-0x6ec0,0x6e9f,0x6e93,0x6e94,0x6ea0,0x6eb1,0x6eb9,0x6ec6,
-0x6ed2,0x6ebd,0x6ec1,0x6e9e,0x6ec9,0x6eb7,0x6eb0,0x6ecd,
-0x6ea6,0x6ecf,0x6eb2,0x6ebe,0x6ec3,0x6edc,0x6ed8,0x6e99,
-0x6e92,0x6e8e,0x6e8d,0x6ea4,0x6ea1,0x6ebf,0x6eb3,0x6ed0,
-0x6eca,0x6e97,0x6eae,0x6ea3,0x7147,0x7154,0x7152,0x7163,
-0x7160,0x7141,0x715d,0x7162,0x7172,0x7178,0x716a,0x7161,
-0x7142,0x7158,0x7143,0x714b,0x7170,0x715f,0x7150,0x7153,
-0x7144,0x714d,0x715a,0x724f,0x728d,0x728c,0x7291,0x7290,
-0x728e,0x733c,0x7342,0x733b,0x733a,0x7340,0x734a,0x7349,
-0x7444,0x744a,0x744b,0x7452,0x7451,0x7457,0x7440,0x744f,
-0x7450,0x744e,0x7442,0x7446,0x744d,0x7454,0x74e1,0x74ff,
-0x74fe,0x74fd,0x751d,0x7579,0x7577,0x6983,0x75ef,0x760f,
-0x7603,0x75f7,0x75fe,0x75fc,0x75f9,0x75f8,0x7610,0x75fb,
-0x75f6,0x75ed,0x75f5,0x75fd,0x7699,0x76b5,0x76dd,0x7755,
-0x775f,0x7760,0x7752,0x7756,0x775a,0x7769,0x7767,0x7754,
-0x7759,0x776d,0x77e0,0x7887,0x789a,0x7894,0x788f,0x7884,
-0x7895,0x7885,0x7886,0x78a1,0x7883,0x7879,0x7899,0x7880,
-0x7896,0x787b,0x797c,0x7982,0x797d,0x7979,0x7a11,0x7a18,
-0x7a19,0x7a12,0x7a17,0x7a15,0x7a22,0x7a13,0x7a1b,0x7a10,
-0x7aa3,0x7aa2,0x7a9e,0x7aeb,0x7b66,0x7b64,0x7b6d,0x7b74,
-0x7b69,0x7b72,0x7b65,0x7b73,0x7b71,0x7b70,0x7b61,0x7b78,
-0x7b76,0x7b63,0x7cb2,0x7cb4,0x7caf,0x7d88,0x7d86,0x7d80,
-0x7d8d,0x7d7f,0x7d85,0x7d7a,0x7d8e,0x7d7b,0x7d83,0x7d7c,
-0x7d8c,0x7d94,0x7d84,0x7d7d,0x7d92,0x7f6d,0x7f6b,0x7f67,
-0x7f68,0x7f6c,0x7fa6,0x7fa5,0x7fa7,0x7fdb,0x7fdc,0x8021,
-0x8164,0x8160,0x8177,0x815c,0x8169,0x815b,0x8162,0x8172,
-0x6721,0x815e,0x8176,0x8167,0x816f,0x8144,0x8161,0x821d,
-0x8249,0x8244,0x8240,0x8242,0x8245,0x84f1,0x843f,0x8456,
-0x8476,0x8479,0x848f,0x848d,0x8465,0x8451,0x8440,0x8486,
-0x8467,0x8430,0x844d,0x847d,0x845a,0x8459,0x8474,0x8473,
-0x845d,0x8507,0x845e,0x8437,0x843a,0x8434,0x847a,0x8443,
-0x8478,0x8432,0x8445,0x8429,0x83d9,0x844b,0x842f,0x8442,
-0x842d,0x845f,0x8470,0x8439,0x844e,0x844c,0x8452,0x846f,
-0x84c5,0x848e,0x843b,0x8447,0x8436,0x8433,0x8468,0x847e,
-0x8444,0x842b,0x8460,0x8454,0x846e,0x8450,0x870b,0x8704,
-0x86f7,0x870c,0x86fa,0x86d6,0x86f5,0x874d,0x86f8,0x870e,
-0x8709,0x8701,0x86f6,0x870d,0x8705,0x88d6,0x88cb,0x88cd,
-0x88ce,0x88de,0x88db,0x88da,0x88cc,0x88d0,0x8985,0x899b,
-0x89df,0x89e5,0x89e4,0x89e1,0x89e0,0x89e2,0x89dc,0x89e6,
-0x8a76,0x8a86,0x8a7f,0x8a61,0x8a3f,0x8a77,0x8a82,0x8a84,
-0x8a75,0x8a83,0x8a81,0x8a74,0x8a7a,0x8c3c,0x8c4b,0x8c4a,
-0x8c65,0x8c64,0x8c66,0x8c86,0x8c84,0x8c85,0x8ccc,0x8d68,
-0x8d69,0x8d91,0x8d8c,0x8d8e,0x8d8f,0x8d8d,0x8d93,0x8d94,
-0x8d90,0x8d92,0x8df0,0x8de0,0x8dec,0x8df1,0x8dee,0x8dd0,
-0x8de9,0x8de3,0x8de2,0x8de7,0x8df2,0x8deb,0x8df4,0x8f06,
-0x8eff,0x8f01,0x8f00,0x8f05,0x8f07,0x8f08,0x8f02,0x8f0b,
-0x9052,0x903f,0x9044,0x9049,0x903d,0x9110,0x910d,0x910f,
-0x9111,0x9116,0x9114,0x910b,0x910e,0x916e,0x916f,0x9248,
-0x9252,0x9230,0x923a,0x9266,0x9233,0x9265,0x925e,0x9283,
-0x922e,0x924a,0x9246,0x926d,0x926c,0x924f,0x9260,0x9267,
-0x926f,0x9236,0x9261,0x9270,0x9231,0x9254,0x9263,0x9250,
-0x9272,0x924e,0x9253,0x924c,0x9256,0x9232,0x959f,0x959c,
-0x959e,0x959b,0x9692,0x9693,0x9691,0x9697,0x96ce,0x96fa,
-0x96fd,0x96f8,0x96f5,0x9773,0x9777,0x9778,0x9772,0x980f,
-0x980d,0x980e,0x98ac,0x98f6,0x98f9,0x99af,0x99b2,0x99b0,
-0x99b5,0x9aad,0x9aab,0x9b5b,0x9cea,0x9ced,0x9ce7,0x9e80,
-0x9efd,0x50e6,0x50d4,0x50d7,0x50e8,0x50f3,0x50db,0x50ea,
-0x50dd,0x50e4,0x50d3,0x50ec,0x50f0,0x50ef,0x50e3,0x50e0,
-0x51d8,0x5280,0x5281,0x52e9,0x52eb,0x5330,0x53ac,0x5627,
-0x5615,0x560c,0x5612,0x55fc,0x560f,0x561c,0x5601,0x5613,
-0x5602,0x55fa,0x561d,0x5604,0x55ff,0x55f9,0x5889,0x587c,
-0x5890,0x5898,0x5886,0x5881,0x587f,0x5874,0x588b,0x587a,
-0x5887,0x5891,0x588e,0x5876,0x5882,0x5888,0x587b,0x5894,
-0x588f,0x58fe,0x596b,0x5adc,0x5aee,0x5ae5,0x5ad5,0x5aea,
-0x5ada,0x5aed,0x5aeb,0x5af3,0x5ae2,0x5ae0,0x5adb,0x5aec,
-0x5ade,0x5add,0x5ad9,0x5ae8,0x5adf,0x5b77,0x5be0,0x5be3,
-0x5c63,0x5d82,0x5d80,0x5d7d,0x5d86,0x5d7a,0x5d81,0x5d77,
-0x5d8a,0x5d89,0x5d88,0x5d7e,0x5d7c,0x5d8d,0x5d79,0x5d7f,
-0x5e58,0x5e59,0x5e53,0x5ed8,0x5ed1,0x5ed7,0x5ece,0x5edc,
-0x5ed5,0x5ed9,0x5ed2,0x5ed4,0x5f44,0x5f43,0x5f6f,0x5fb6,
-0x612c,0x6128,0x6141,0x615e,0x6171,0x6173,0x6152,0x6153,
-0x6172,0x616c,0x6180,0x6174,0x6154,0x617a,0x615b,0x6165,
-0x613b,0x616a,0x6161,0x6156,0x6229,0x6227,0x622b,0x642b,
-0x644d,0x645b,0x645d,0x6474,0x6476,0x6472,0x6473,0x647d,
-0x6475,0x6466,0x64a6,0x644e,0x6482,0x645e,0x645c,0x644b,
-0x6453,0x6460,0x6450,0x647f,0x643f,0x646c,0x646b,0x6459,
-0x6465,0x6477,0x6573,0x65a0,0x66a1,0x66a0,0x669f,0x6705,
-0x6704,0x6722,0x69b1,0x69b6,0x69c9,0x69a0,0x69ce,0x6996,
-0x69b0,0x69ac,0x69bc,0x6991,0x6999,0x698e,0x69a7,0x698d,
-0x69a9,0x69be,0x69af,0x69bf,0x69c4,0x69bd,0x69a4,0x69d4,
-0x69b9,0x69ca,0x699a,0x69cf,0x69b3,0x6993,0x69aa,0x69a1,
-0x699e,0x69d9,0x6997,0x6990,0x69c2,0x69b5,0x69a5,0x69c6,
-0x6b4a,0x6b4d,0x6b4b,0x6b9e,0x6b9f,0x6ba0,0x6bc3,0x6bc4,
-0x6bfe,0x6ece,0x6ef5,0x6ef1,0x6f03,0x6f25,0x6ef8,0x6f37,
-0x6efb,0x6f2e,0x6f09,0x6f4e,0x6f19,0x6f1a,0x6f27,0x6f18,
-0x6f3b,0x6f12,0x6eed,0x6f0a,0x6f36,0x6f73,0x6ef9,0x6eee,
-0x6f2d,0x6f40,0x6f30,0x6f3c,0x6f35,0x6eeb,0x6f07,0x6f0e,
-0x6f43,0x6f05,0x6efd,0x6ef6,0x6f39,0x6f1c,0x6efc,0x6f3a,
-0x6f1f,0x6f0d,0x6f1e,0x6f08,0x6f21,0x7187,0x7190,0x7189,
-0x7180,0x7185,0x7182,0x718f,0x717b,0x7186,0x7181,0x7197,
-0x7244,0x7253,0x7297,0x7295,0x7293,0x7343,0x734d,0x7351,
-0x734c,0x7462,0x7473,0x7471,0x7475,0x7472,0x7467,0x746e,
-0x7500,0x7502,0x7503,0x757d,0x7590,0x7616,0x7608,0x760c,
-0x7615,0x7611,0x760a,0x7614,0x76b8,0x7781,0x777c,0x7785,
-0x7782,0x776e,0x7780,0x776f,0x777e,0x7783,0x78b2,0x78aa,
-0x78b4,0x78ad,0x78a8,0x787e,0x78ab,0x789e,0x78a5,0x78a0,
-0x78ac,0x78a2,0x78a4,0x7998,0x798a,0x798b,0x7996,0x7995,
-0x7994,0x7993,0x7997,0x7988,0x7992,0x7990,0x7a2b,0x7a4a,
-0x7a30,0x7a2f,0x7a28,0x7a26,0x7aa8,0x7aab,0x7aac,0x7aee,
-0x7b88,0x7b9c,0x7b8a,0x7b91,0x7b90,0x7b96,0x7b8d,0x7b8c,
-0x7b9b,0x7b8e,0x7b85,0x7b98,0x5284,0x7b99,0x7ba4,0x7b82,
-0x7cbb,0x7cbf,0x7cbc,0x7cba,0x7da7,0x7db7,0x7dc2,0x7da3,
-0x7daa,0x7dc1,0x7dc0,0x7dc5,0x7d9d,0x7dce,0x7dc4,0x7dc6,
-0x7dcb,0x7dcc,0x7daf,0x7db9,0x7d96,0x7dbc,0x7d9f,0x7da6,
-0x7dae,0x7da9,0x7da1,0x7dc9,0x7f73,0x7fe2,0x7fe3,0x7fe5,
-0x7fde,0x8024,0x805d,0x805c,0x8189,0x8186,0x8183,0x8187,
-0x818d,0x818c,0x818b,0x8215,0x8497,0x84a4,0x84a1,0x849f,
-0x84ba,0x84ce,0x84c2,0x84ac,0x84ae,0x84ab,0x84b9,0x84b4,
-0x84c1,0x84cd,0x84aa,0x849a,0x84b1,0x84d0,0x849d,0x84a7,
-0x84bb,0x84a2,0x8494,0x84c7,0x84cc,0x849b,0x84a9,0x84af,
-0x84a8,0x84d6,0x8498,0x84b6,0x84cf,0x84a0,0x84d7,0x84d4,
-0x84d2,0x84db,0x84b0,0x8491,0x8661,0x8733,0x8723,0x8728,
-0x876b,0x8740,0x872e,0x871e,0x8721,0x8719,0x871b,0x8743,
-0x872c,0x8741,0x873e,0x8746,0x8720,0x8732,0x872a,0x872d,
-0x873c,0x8712,0x873a,0x8731,0x8735,0x8742,0x8726,0x8727,
-0x8738,0x8724,0x871a,0x8730,0x8711,0x88f7,0x88e7,0x88f1,
-0x88f2,0x88fa,0x88fe,0x88ee,0x88fc,0x88f6,0x88fb,0x88f0,
-0x88ec,0x88eb,0x899d,0x89a1,0x899f,0x899e,0x89e9,0x89eb,
-0x89e8,0x8aab,0x8a99,0x8a8b,0x8a92,0x8a8f,0x8a96,0x8c3d,
-0x8c68,0x8c69,0x8cd5,0x8ccf,0x8cd7,0x8d96,0x8e09,0x8e02,
-0x8dff,0x8e0d,0x8dfd,0x8e0a,0x8e03,0x8e07,0x8e06,0x8e05,
-0x8dfe,0x8e00,0x8e04,0x8f10,0x8f11,0x8f0e,0x8f0d,0x9123,
-0x911c,0x9120,0x9122,0x911f,0x911d,0x911a,0x9124,0x9121,
-0x911b,0x917a,0x9172,0x9179,0x9173,0x92a5,0x92a4,0x9276,
-0x929b,0x927a,0x92a0,0x9294,0x92aa,0x928d,0x92a6,0x929a,
-0x92ab,0x9279,0x9297,0x927f,0x92a3,0x92ee,0x928e,0x9282,
-0x9295,0x92a2,0x927d,0x9288,0x92a1,0x928a,0x9286,0x928c,
-0x9299,0x92a7,0x927e,0x9287,0x92a9,0x929d,0x928b,0x922d,
-0x969e,0x96a1,0x96ff,0x9758,0x977d,0x977a,0x977e,0x9783,
-0x9780,0x9782,0x977b,0x9784,0x9781,0x977f,0x97ce,0x97cd,
-0x9816,0x98ad,0x98ae,0x9902,0x9900,0x9907,0x999d,0x999c,
-0x99c3,0x99b9,0x99bb,0x99ba,0x99c2,0x99bd,0x99c7,0x9ab1,
-0x9ae3,0x9ae7,0x9b3e,0x9b3f,0x9b60,0x9b61,0x9b5f,0x9cf1,
-0x9cf2,0x9cf5,0x9ea7,0x50ff,0x5103,0x5130,0x50f8,0x5106,
-0x5107,0x50f6,0x50fe,0x510b,0x510c,0x50fd,0x510a,0x528b,
-0x528c,0x52f1,0x52ef,0x5648,0x5642,0x564c,0x5635,0x5641,
-0x564a,0x5649,0x5646,0x5658,0x565a,0x5640,0x5633,0x563d,
-0x562c,0x563e,0x5638,0x562a,0x563a,0x571a,0x58ab,0x589d,
-0x58b1,0x58a0,0x58a3,0x58af,0x58ac,0x58a5,0x58a1,0x58ff,
-0x5aff,0x5af4,0x5afd,0x5af7,0x5af6,0x5b03,0x5af8,0x5b02,
-0x5af9,0x5b01,0x5b07,0x5b05,0x5b0f,0x5c67,0x5d99,0x5d97,
-0x5d9f,0x5d92,0x5da2,0x5d93,0x5d95,0x5da0,0x5d9c,0x5da1,
-0x5d9a,0x5d9e,0x5e69,0x5e5d,0x5e60,0x5e5c,0x7df3,0x5edb,
-0x5ede,0x5ee1,0x5f49,0x5fb2,0x618b,0x6183,0x6179,0x61b1,
-0x61b0,0x61a2,0x6189,0x619b,0x6193,0x61af,0x61ad,0x619f,
-0x6192,0x61aa,0x61a1,0x618d,0x6166,0x61b3,0x622d,0x646e,
-0x6470,0x6496,0x64a0,0x6485,0x6497,0x649c,0x648f,0x648b,
-0x648a,0x648c,0x64a3,0x649f,0x6468,0x64b1,0x6498,0x6576,
-0x657a,0x6579,0x657b,0x65b2,0x65b3,0x66b5,0x66b0,0x66a9,
-0x66b2,0x66b7,0x66aa,0x66af,0x6a00,0x6a06,0x6a17,0x69e5,
-0x69f8,0x6a15,0x69f1,0x69e4,0x6a20,0x69ff,0x69ec,0x69e2,
-0x6a1b,0x6a1d,0x69fe,0x6a27,0x69f2,0x69ee,0x6a14,0x69f7,
-0x69e7,0x6a40,0x6a08,0x69e6,0x69fb,0x6a0d,0x69fc,0x69eb,
-0x6a09,0x6a04,0x6a18,0x6a25,0x6a0f,0x69f6,0x6a26,0x6a07,
-0x69f4,0x6a16,0x6b51,0x6ba5,0x6ba3,0x6ba2,0x6ba6,0x6c01,
-0x6c00,0x6bff,0x6c02,0x6f41,0x6f26,0x6f7e,0x6f87,0x6fc6,
-0x6f92,0x6f8d,0x6f89,0x6f8c,0x6f62,0x6f4f,0x6f85,0x6f5a,
-0x6f96,0x6f76,0x6f6c,0x6f82,0x6f55,0x6f72,0x6f52,0x6f50,
-0x6f57,0x6f94,0x6f93,0x6f5d,0x6f00,0x6f61,0x6f6b,0x6f7d,
-0x6f67,0x6f90,0x6f53,0x6f8b,0x6f69,0x6f7f,0x6f95,0x6f63,
-0x6f77,0x6f6a,0x6f7b,0x71b2,0x71af,0x719b,0x71b0,0x71a0,
-0x719a,0x71a9,0x71b5,0x719d,0x71a5,0x719e,0x71a4,0x71a1,
-0x71aa,0x719c,0x71a7,0x71b3,0x7298,0x729a,0x7358,0x7352,
-0x735e,0x735f,0x7360,0x735d,0x735b,0x7361,0x735a,0x7359,
-0x7362,0x7487,0x7489,0x748a,0x7486,0x7481,0x747d,0x7485,
-0x7488,0x747c,0x7479,0x7508,0x7507,0x757e,0x7625,0x761e,
-0x7619,0x761d,0x761c,0x7623,0x761a,0x7628,0x761b,0x769c,
-0x769d,0x769e,0x769b,0x778d,0x778f,0x7789,0x7788,0x78cd,
-0x78bb,0x78cf,0x78cc,0x78d1,0x78ce,0x78d4,0x78c8,0x78c3,
-0x78c4,0x78c9,0x799a,0x79a1,0x79a0,0x799c,0x79a2,0x799b,
-0x6b76,0x7a39,0x7ab2,0x7ab4,0x7ab3,0x7bb7,0x7bcb,0x7bbe,
-0x7bac,0x7bce,0x7baf,0x7bb9,0x7bca,0x7bb5,0x7cc5,0x7cc8,
-0x7ccc,0x7ccb,0x7df7,0x7ddb,0x7dea,0x7de7,0x7dd7,0x7de1,
-0x7e03,0x7dfa,0x7de6,0x7df6,0x7df1,0x7df0,0x7dee,0x7ddf,
-0x7f76,0x7fac,0x7fb0,0x7fad,0x7fed,0x7feb,0x7fea,0x7fec,
-0x7fe6,0x7fe8,0x8064,0x8067,0x81a3,0x819f,0x819e,0x8195,
-0x81a2,0x8199,0x8197,0x8216,0x824f,0x8253,0x8252,0x8250,
-0x824e,0x8251,0x8524,0x853b,0x850f,0x8500,0x8529,0x850e,
-0x8509,0x850d,0x851f,0x850a,0x8527,0x851c,0x84fb,0x852b,
-0x84fa,0x8508,0x850c,0x84f4,0x852a,0x84f2,0x8515,0x84f7,
-0x84eb,0x84f3,0x84fc,0x8512,0x84ea,0x84e9,0x8516,0x84fe,
-0x8528,0x851d,0x852e,0x8502,0x84fd,0x851e,0x84f6,0x8531,
-0x8526,0x84e7,0x84e8,0x84f0,0x84ef,0x84f9,0x8518,0x8520,
-0x8530,0x850b,0x8519,0x852f,0x8662,0x8756,0x8763,0x8764,
-0x8777,0x87e1,0x8773,0x8758,0x8754,0x875b,0x8752,0x8761,
-0x875a,0x8751,0x875e,0x876d,0x876a,0x8750,0x874e,0x875f,
-0x875d,0x876f,0x876c,0x877a,0x876e,0x875c,0x8765,0x874f,
-0x877b,0x8775,0x8762,0x8767,0x8769,0x885a,0x8905,0x890c,
-0x8914,0x890b,0x8917,0x8918,0x8919,0x8906,0x8916,0x8911,
-0x890e,0x8909,0x89a2,0x89a4,0x89a3,0x89ed,0x89f0,0x89ec,
-0x8acf,0x8ac6,0x8ab8,0x8ad3,0x8ad1,0x8ad4,0x8ad5,0x8abb,
-0x8ad7,0x8abe,0x8ac0,0x8ac5,0x8ad8,0x8ac3,0x8aba,0x8abd,
-0x8ad9,0x8c3e,0x8c4d,0x8c8f,0x8ce5,0x8cdf,0x8cd9,0x8ce8,
-0x8cda,0x8cdd,0x8ce7,0x8da0,0x8d9c,0x8da1,0x8d9b,0x8e20,
-0x8e23,0x8e25,0x8e24,0x8e2e,0x8e15,0x8e1b,0x8e16,0x8e11,
-0x8e19,0x8e26,0x8e27,0x8e14,0x8e12,0x8e18,0x8e13,0x8e1c,
-0x8e17,0x8e1a,0x8f2c,0x8f24,0x8f18,0x8f1a,0x8f20,0x8f23,
-0x8f16,0x8f17,0x9073,0x9070,0x906f,0x9067,0x906b,0x912f,
-0x912b,0x9129,0x912a,0x9132,0x9126,0x912e,0x9185,0x9186,
-0x918a,0x9181,0x9182,0x9184,0x9180,0x92d0,0x92c3,0x92c4,
-0x92c0,0x92d9,0x92b6,0x92cf,0x92f1,0x92df,0x92d8,0x92e9,
-0x92d7,0x92dd,0x92cc,0x92ef,0x92c2,0x92e8,0x92ca,0x92c8,
-0x92ce,0x92e6,0x92cd,0x92d5,0x92c9,0x92e0,0x92de,0x92e7,
-0x92d1,0x92d3,0x92b5,0x92e1,0x92c6,0x92b4,0x957c,0x95ac,
-0x95ab,0x95ae,0x95b0,0x96a4,0x96a2,0x96d3,0x9705,0x9708,
-0x9702,0x975a,0x978a,0x978e,0x9788,0x97d0,0x97cf,0x981e,
-0x981d,0x9826,0x9829,0x9828,0x9820,0x981b,0x9827,0x98b2,
-0x9908,0x98fa,0x9911,0x9914,0x9916,0x9917,0x9915,0x99dc,
-0x99cd,0x99cf,0x99d3,0x99d4,0x99ce,0x99c9,0x99d6,0x99d8,
-0x99cb,0x99d7,0x99cc,0x9ab3,0x9aec,0x9aeb,0x9af3,0x9af2,
-0x9af1,0x9b46,0x9b43,0x9b67,0x9b74,0x9b71,0x9b66,0x9b76,
-0x9b75,0x9b70,0x9b68,0x9b64,0x9b6c,0x9cfc,0x9cfa,0x9cfd,
-0x9cff,0x9cf7,0x9d07,0x9d00,0x9cf9,0x9cfb,0x9d08,0x9d05,
-0x9d04,0x9e83,0x9ed3,0x9f0f,0x9f10,0x511c,0x5113,0x5117,
-0x511a,0x5111,0x51de,0x5334,0x53e1,0x5670,0x5660,0x566e,
-0x5673,0x5666,0x5663,0x566d,0x5672,0x565e,0x5677,0x571c,
-0x571b,0x58c8,0x58bd,0x58c9,0x58bf,0x58ba,0x58c2,0x58bc,
-0x58c6,0x5b17,0x5b19,0x5b1b,0x5b21,0x5b14,0x5b13,0x5b10,
-0x5b16,0x5b28,0x5b1a,0x5b20,0x5b1e,0x5bef,0x5dac,0x5db1,
-0x5da9,0x5da7,0x5db5,0x5db0,0x5dae,0x5daa,0x5da8,0x5db2,
-0x5dad,0x5daf,0x5db4,0x5e67,0x5e68,0x5e66,0x5e6f,0x5ee9,
-0x5ee7,0x5ee6,0x5ee8,0x5ee5,0x5f4b,0x5fbc,0x619d,0x61a8,
-0x6196,0x61c5,0x61b4,0x61c6,0x61c1,0x61cc,0x61ba,0x61bf,
-0x61b8,0x618c,0x64d7,0x64d6,0x64d0,0x64cf,0x64c9,0x64bd,
-0x6489,0x64c3,0x64db,0x64f3,0x64d9,0x6533,0x657f,0x657c,
-0x65a2,0x66c8,0x66be,0x66c0,0x66ca,0x66cb,0x66cf,0x66bd,
-0x66bb,0x66ba,0x66cc,0x6723,0x6a34,0x6a66,0x6a49,0x6a67,
-0x6a32,0x6a68,0x6a3e,0x6a5d,0x6a6d,0x6a76,0x6a5b,0x6a51,
-0x6a28,0x6a5a,0x6a3b,0x6a3f,0x6a41,0x6a6a,0x6a64,0x6a50,
-0x6a4f,0x6a54,0x6a6f,0x6a69,0x6a60,0x6a3c,0x6a5e,0x6a56,
-0x6a55,0x6a4d,0x6a4e,0x6a46,0x6b55,0x6b54,0x6b56,0x6ba7,
-0x6baa,0x6bab,0x6bc8,0x6bc7,0x6c04,0x6c03,0x6c06,0x6fad,
-0x6fcb,0x6fa3,0x6fc7,0x6fbc,0x6fce,0x6fc8,0x6f5e,0x6fc4,
-0x6fbd,0x6f9e,0x6fca,0x6fa8,0x7004,0x6fa5,0x6fae,0x6fba,
-0x6fac,0x6faa,0x6fcf,0x6fbf,0x6fb8,0x6fa2,0x6fc9,0x6fab,
-0x6fcd,0x6faf,0x6fb2,0x6fb0,0x71c5,0x71c2,0x71bf,0x71b8,
-0x71d6,0x71c0,0x71c1,0x71cb,0x71d4,0x71ca,0x71c7,0x71cf,
-0x71bd,0x71d8,0x71bc,0x71c6,0x71da,0x71db,0x729d,0x729e,
-0x7369,0x7366,0x7367,0x736c,0x7365,0x736b,0x736a,0x747f,
-0x749a,0x74a0,0x7494,0x7492,0x7495,0x74a1,0x750b,0x7580,
-0x762f,0x762d,0x7631,0x763d,0x7633,0x763c,0x7635,0x7632,
-0x7630,0x76bb,0x76e6,0x779a,0x779d,0x77a1,0x779c,0x779b,
-0x77a2,0x77a3,0x7795,0x7799,0x7797,0x78dd,0x78e9,0x78e5,
-0x78ea,0x78de,0x78e3,0x78db,0x78e1,0x78e2,0x78ed,0x78df,
-0x78e0,0x79a4,0x7a44,0x7a48,0x7a47,0x7ab6,0x7ab8,0x7ab5,
-0x7ab1,0x7ab7,0x7bde,0x7be3,0x7be7,0x7bdd,0x7bd5,0x7be5,
-0x7bda,0x7be8,0x7bf9,0x7bd4,0x7bea,0x7be2,0x7bdc,0x7beb,
-0x7bd8,0x7bdf,0x7cd2,0x7cd4,0x7cd7,0x7cd0,0x7cd1,0x7e12,
-0x7e21,0x7e17,0x7e0c,0x7e1f,0x7e20,0x7e13,0x7e0e,0x7e1c,
-0x7e15,0x7e1a,0x7e22,0x7e0b,0x7e0f,0x7e16,0x7e0d,0x7e14,
-0x7e25,0x7e24,0x7f43,0x7f7b,0x7f7c,0x7f7a,0x7fb1,0x7fef,
-0x802a,0x8029,0x806c,0x81b1,0x81a6,0x81ae,0x81b9,0x81b5,
-0x81ab,0x81b0,0x81ac,0x81b4,0x81b2,0x81b7,0x81a7,0x81f2,
-0x8255,0x8256,0x8257,0x8556,0x8545,0x856b,0x854d,0x8553,
-0x8561,0x8558,0x8540,0x8546,0x8564,0x8541,0x8562,0x8544,
-0x8551,0x8547,0x8563,0x853e,0x855b,0x8571,0x854e,0x856e,
-0x8575,0x8555,0x8567,0x8560,0x858c,0x8566,0x855d,0x8554,
-0x8565,0x856c,0x8663,0x8665,0x8664,0x879b,0x878f,0x8797,
-0x8793,0x8792,0x8788,0x8781,0x8796,0x8798,0x8779,0x8787,
-0x87a3,0x8785,0x8790,0x8791,0x879d,0x8784,0x8794,0x879c,
-0x879a,0x8789,0x891e,0x8926,0x8930,0x892d,0x892e,0x8927,
-0x8931,0x8922,0x8929,0x8923,0x892f,0x892c,0x891f,0x89f1,
-0x8ae0,0x8ae2,0x8af2,0x8af4,0x8af5,0x8add,0x8b14,0x8ae4,
-0x8adf,0x8af0,0x8ac8,0x8ade,0x8ae1,0x8ae8,0x8aff,0x8aef,
-0x8afb,0x8c91,0x8c92,0x8c90,0x8cf5,0x8cee,0x8cf1,0x8cf0,
-0x8cf3,0x8d6c,0x8d6e,0x8da5,0x8da7,0x8e33,0x8e3e,0x8e38,
-0x8e40,0x8e45,0x8e36,0x8e3c,0x8e3d,0x8e41,0x8e30,0x8e3f,
-0x8ebd,0x8f36,0x8f2e,0x8f35,0x8f32,0x8f39,0x8f37,0x8f34,
-0x9076,0x9079,0x907b,0x9086,0x90fa,0x9133,0x9135,0x9136,
-0x9193,0x9190,0x9191,0x918d,0x918f,0x9327,0x931e,0x9308,
-0x931f,0x9306,0x930f,0x937a,0x9338,0x933c,0x931b,0x9323,
-0x9312,0x9301,0x9346,0x932d,0x930e,0x930d,0x92cb,0x931d,
-0x92fa,0x9325,0x9313,0x92f9,0x92f7,0x9334,0x9302,0x9324,
-0x92ff,0x9329,0x9339,0x9335,0x932a,0x9314,0x930c,0x930b,
-0x92fe,0x9309,0x9300,0x92fb,0x9316,0x95bc,0x95cd,0x95be,
-0x95b9,0x95ba,0x95b6,0x95bf,0x95b5,0x95bd,0x96a9,0x96d4,
-0x970b,0x9712,0x9710,0x9799,0x9797,0x9794,0x97f0,0x97f8,
-0x9835,0x982f,0x9832,0x9924,0x991f,0x9927,0x9929,0x999e,
-0x99ee,0x99ec,0x99e5,0x99e4,0x99f0,0x99e3,0x99ea,0x99e9,
-0x99e7,0x9ab9,0x9abf,0x9ab4,0x9abb,0x9af6,0x9afa,0x9af9,
-0x9af7,0x9b33,0x9b80,0x9b85,0x9b87,0x9b7c,0x9b7e,0x9b7b,
-0x9b82,0x9b93,0x9b92,0x9b90,0x9b7a,0x9b95,0x9b7d,0x9b88,
-0x9d25,0x9d17,0x9d20,0x9d1e,0x9d14,0x9d29,0x9d1d,0x9d18,
-0x9d22,0x9d10,0x9d19,0x9d1f,0x9e88,0x9e86,0x9e87,0x9eae,
-0x9ead,0x9ed5,0x9ed6,0x9efa,0x9f12,0x9f3d,0x5126,0x5125,
-0x5122,0x5124,0x5120,0x5129,0x52f4,0x5693,0x568c,0x568d,
-0x5686,0x5684,0x5683,0x567e,0x5682,0x567f,0x5681,0x58d6,
-0x58d4,0x58cf,0x58d2,0x5b2d,0x5b25,0x5b32,0x5b23,0x5b2c,
-0x5b27,0x5b26,0x5b2f,0x5b2e,0x5b7b,0x5bf1,0x5bf2,0x5db7,
-0x5e6c,0x5e6a,0x5fbe,0x5fbb,0x61c3,0x61b5,0x61bc,0x61e7,
-0x61e0,0x61e5,0x61e4,0x61e8,0x61de,0x64ef,0x64e9,0x64e3,
-0x64eb,0x64e4,0x64e8,0x6581,0x6580,0x65b6,0x65da,0x66d2,
-0x6a8d,0x6a96,0x6a81,0x6aa5,0x6a89,0x6a9f,0x6a9b,0x6aa1,
-0x6a9e,0x6a87,0x6a93,0x6a8e,0x6a95,0x6a83,0x6aa8,0x6aa4,
-0x6a91,0x6a7f,0x6aa6,0x6a9a,0x6a85,0x6a8c,0x6a92,0x6b5b,
-0x6bad,0x6c09,0x6fcc,0x6fa9,0x6ff4,0x6fd4,0x6fe3,0x6fdc,
-0x6fed,0x6fe7,0x6fe6,0x6fde,0x6ff2,0x6fdd,0x6fe2,0x6fe8,
-0x71e1,0x71f1,0x71e8,0x71f2,0x71e4,0x71f0,0x71e2,0x7373,
-0x736e,0x736f,0x7497,0x74b2,0x74ab,0x7490,0x74aa,0x74ad,
-0x74b1,0x74a5,0x74af,0x7510,0x7511,0x7512,0x750f,0x7584,
-0x7643,0x7648,0x7649,0x7647,0x76a4,0x76e9,0x77b5,0x77ab,
-0x77b2,0x77b7,0x77b6,0x77b4,0x77b1,0x77a8,0x77f0,0x78f3,
-0x78fd,0x7902,0x78fb,0x78fc,0x78f2,0x7905,0x78f9,0x78fe,
-0x7904,0x79ab,0x79a8,0x7a5c,0x7a5b,0x7a56,0x7a58,0x7a54,
-0x7a5a,0x7abe,0x7ac0,0x7ac1,0x7c05,0x7c0f,0x7bf2,0x7c00,
-0x7bff,0x7bfb,0x7c0e,0x7bf4,0x7c0b,0x7bf3,0x7c02,0x7c09,
-0x7c03,0x7c01,0x7bf8,0x7bfd,0x7c06,0x7bf0,0x7bf1,0x7c10,
-0x7c0a,0x7ce8,0x7e2d,0x7e3c,0x7e42,0x7e33,0x9848,0x7e38,
-0x7e2a,0x7e49,0x7e40,0x7e47,0x7e29,0x7e4c,0x7e30,0x7e3b,
-0x7e36,0x7e44,0x7e3a,0x7f45,0x7f7f,0x7f7e,0x7f7d,0x7ff4,
-0x7ff2,0x802c,0x81bb,0x81c4,0x81cc,0x81ca,0x81c5,0x81c7,
-0x81bc,0x81e9,0x825b,0x825a,0x825c,0x8583,0x8580,0x858f,
-0x85a7,0x8595,0x85a0,0x858b,0x85a3,0x857b,0x85a4,0x859a,
-0x859e,0x8577,0x857c,0x8589,0x85a1,0x857a,0x8578,0x8557,
-0x858e,0x8596,0x8586,0x858d,0x8599,0x859d,0x8581,0x85a2,
-0x8582,0x8588,0x8585,0x8579,0x8576,0x8598,0x8590,0x859f,
-0x8668,0x87be,0x87aa,0x87ad,0x87c5,0x87b0,0x87ac,0x87b9,
-0x87b5,0x87bc,0x87ae,0x87c9,0x87c3,0x87c2,0x87cc,0x87b7,
-0x87af,0x87c4,0x87ca,0x87b4,0x87b6,0x87bf,0x87b8,0x87bd,
-0x87de,0x87b2,0x8935,0x8933,0x893c,0x893e,0x8941,0x8952,
-0x8937,0x8942,0x89ad,0x89af,0x89ae,0x89f2,0x89f3,0x8b1e,
-0x8b18,0x8b16,0x8b11,0x8b05,0x8b0b,0x8b22,0x8b0f,0x8b12,
-0x8b15,0x8b07,0x8b0d,0x8b08,0x8b06,0x8b1c,0x8b13,0x8b1a,
-0x8c4f,0x8c70,0x8c72,0x8c71,0x8c6f,0x8c95,0x8c94,0x8cf9,
-0x8d6f,0x8e4e,0x8e4d,0x8e53,0x8e50,0x8e4c,0x8e47,0x8f43,
-0x8f40,0x9085,0x907e,0x9138,0x919a,0x91a2,0x919b,0x9199,
-0x919f,0x91a1,0x919d,0x91a0,0x93a1,0x9383,0x93af,0x9364,
-0x9356,0x9347,0x937c,0x9358,0x935c,0x9376,0x9349,0x9350,
-0x9351,0x9360,0x936d,0x938f,0x934c,0x936a,0x9379,0x9357,
-0x9355,0x9352,0x934f,0x9371,0x9377,0x937b,0x9361,0x935e,
-0x9363,0x9367,0x9380,0x934e,0x9359,0x95c7,0x95c0,0x95c9,
-0x95c3,0x95c5,0x95b7,0x96ae,0x96b0,0x96ac,0x9720,0x971f,
-0x9718,0x971d,0x9719,0x979a,0x97a1,0x979c,0x979e,0x979d,
-0x97d5,0x97d4,0x97f1,0x9841,0x9844,0x984a,0x9849,0x9845,
-0x9843,0x9925,0x992b,0x992c,0x992a,0x9933,0x9932,0x992f,
-0x992d,0x9931,0x9930,0x9998,0x99a3,0x99a1,0x9a02,0x99fa,
-0x99f4,0x99f7,0x99f9,0x99f8,0x99f6,0x99fb,0x99fd,0x99fe,
-0x99fc,0x9a03,0x9abe,0x9afe,0x9afd,0x9b01,0x9afc,0x9b48,
-0x9b9a,0x9ba8,0x9b9e,0x9b9b,0x9ba6,0x9ba1,0x9ba5,0x9ba4,
-0x9b86,0x9ba2,0x9ba0,0x9baf,0x9d33,0x9d41,0x9d67,0x9d36,
-0x9d2e,0x9d2f,0x9d31,0x9d38,0x9d30,0x9d45,0x9d42,0x9d43,
-0x9d3e,0x9d37,0x9d40,0x9d3d,0x7ff5,0x9d2d,0x9e8a,0x9e89,
-0x9e8d,0x9eb0,0x9ec8,0x9eda,0x9efb,0x9eff,0x9f24,0x9f23,
-0x9f22,0x9f54,0x9fa0,0x5131,0x512d,0x512e,0x5698,0x569c,
-0x5697,0x569a,0x569d,0x5699,0x5970,0x5b3c,0x5c69,0x5c6a,
-0x5dc0,0x5e6d,0x5e6e,0x61d8,0x61df,0x61ed,0x61ee,0x61f1,
-0x61ea,0x61f0,0x61eb,0x61d6,0x61e9,0x64ff,0x6504,0x64fd,
-0x64f8,0x6501,0x6503,0x64fc,0x6594,0x65db,0x66da,0x66db,
-0x66d8,0x6ac5,0x6ab9,0x6abd,0x6ae1,0x6ac6,0x6aba,0x6ab6,
-0x6ab7,0x6ac7,0x6ab4,0x6aad,0x6b5e,0x6bc9,0x6c0b,0x7007,
-0x700c,0x700d,0x7001,0x7005,0x7014,0x700e,0x6fff,0x7000,
-0x6ffb,0x7026,0x6ffc,0x6ff7,0x700a,0x7201,0x71ff,0x71f9,
-0x7203,0x71fd,0x7376,0x74b8,0x74c0,0x74b5,0x74c1,0x74be,
-0x74b6,0x74bb,0x74c2,0x7514,0x7513,0x765c,0x7664,0x7659,
-0x7650,0x7653,0x7657,0x765a,0x76a6,0x76bd,0x76ec,0x77c2,
-0x77ba,0x78ff,0x790c,0x7913,0x7914,0x7909,0x7910,0x7912,
-0x7911,0x79ad,0x79ac,0x7a5f,0x7c1c,0x7c29,0x7c19,0x7c20,
-0x7c1f,0x7c2d,0x7c1d,0x7c26,0x7c28,0x7c22,0x7c25,0x7c30,
-0x7e5c,0x7e50,0x7e56,0x7e63,0x7e58,0x7e62,0x7e5f,0x7e51,
-0x7e60,0x7e57,0x7e53,0x7fb5,0x7fb3,0x7ff7,0x7ff8,0x8075,
-0x81d1,0x81d2,0x81d0,0x825f,0x825e,0x85b4,0x85c6,0x85c0,
-0x85c3,0x85c2,0x85b3,0x85b5,0x85bd,0x85c7,0x85c4,0x85bf,
-0x85cb,0x85ce,0x85c8,0x85c5,0x85b1,0x85b6,0x85d2,0x8624,
-0x85b8,0x85b7,0x85be,0x8669,0x87e7,0x87e6,0x87e2,0x87db,
-0x87eb,0x87ea,0x87e5,0x87df,0x87f3,0x87e4,0x87d4,0x87dc,
-0x87d3,0x87ed,0x87d8,0x87e3,0x87a4,0x87d7,0x87d9,0x8801,
-0x87f4,0x87e8,0x87dd,0x8953,0x894b,0x894f,0x894c,0x8946,
-0x8950,0x8951,0x8949,0x8b2a,0x8b27,0x8b23,0x8b33,0x8b30,
-0x8b35,0x8b47,0x8b2f,0x8b3c,0x8b3e,0x8b31,0x8b25,0x8b37,
-0x8b26,0x8b36,0x8b2e,0x8b24,0x8b3b,0x8b3d,0x8b3a,0x8c42,
-0x8c75,0x8c99,0x8c98,0x8c97,0x8cfe,0x8d04,0x8d02,0x8d00,
-0x8e5c,0x8e62,0x8e60,0x8e57,0x8e56,0x8e5e,0x8e65,0x8e67,
-0x8e5b,0x8e5a,0x8e61,0x8e5d,0x8e69,0x8e54,0x8f46,0x8f47,
-0x8f48,0x8f4b,0x9128,0x913a,0x913b,0x913e,0x91a8,0x91a5,
-0x91a7,0x91af,0x91aa,0x93b5,0x938c,0x9392,0x93b7,0x939b,
-0x939d,0x9389,0x93a7,0x938e,0x93aa,0x939e,0x93a6,0x9395,
-0x9388,0x9399,0x939f,0x938d,0x93b1,0x9391,0x93b2,0x93a4,
-0x93a8,0x93b4,0x93a3,0x93a5,0x95d2,0x95d3,0x95d1,0x96b3,
-0x96d7,0x96da,0x5dc2,0x96df,0x96d8,0x96dd,0x9723,0x9722,
-0x9725,0x97ac,0x97ae,0x97a8,0x97ab,0x97a4,0x97aa,0x97a2,
-0x97a5,0x97d7,0x97d9,0x97d6,0x97d8,0x97fa,0x9850,0x9851,
-0x9852,0x98b8,0x9941,0x993c,0x993a,0x9a0f,0x9a0b,0x9a09,
-0x9a0d,0x9a04,0x9a11,0x9a0a,0x9a05,0x9a07,0x9a06,0x9ac0,
-0x9adc,0x9b08,0x9b04,0x9b05,0x9b29,0x9b35,0x9b4a,0x9b4c,
-0x9b4b,0x9bc7,0x9bc6,0x9bc3,0x9bbf,0x9bc1,0x9bb5,0x9bb8,
-0x9bd3,0x9bb6,0x9bc4,0x9bb9,0x9bbd,0x9d5c,0x9d53,0x9d4f,
-0x9d4a,0x9d5b,0x9d4b,0x9d59,0x9d56,0x9d4c,0x9d57,0x9d52,
-0x9d54,0x9d5f,0x9d58,0x9d5a,0x9e8e,0x9e8c,0x9edf,0x9f01,
-0x9f00,0x9f16,0x9f25,0x9f2b,0x9f2a,0x9f29,0x9f28,0x9f4c,
-0x9f55,0x5134,0x5135,0x5296,0x52f7,0x53b4,0x56ab,0x56ad,
-0x56a6,0x56a7,0x56aa,0x56ac,0x58da,0x58dd,0x58db,0x5912,
-0x5b3d,0x5b3e,0x5b3f,0x5dc3,0x5e70,0x5fbf,0x61fb,0x6507,
-0x6510,0x650d,0x6509,0x650c,0x650e,0x6584,0x65de,0x65dd,
-0x66de,0x6ae7,0x6ae0,0x6acc,0x6ad1,0x6ad9,0x6acb,0x6adf,
-0x6adc,0x6ad0,0x6aeb,0x6acf,0x6acd,0x6ade,0x6b60,0x6bb0,
-0x6c0c,0x7019,0x7027,0x7020,0x7016,0x702b,0x7021,0x7022,
-0x7023,0x7029,0x7017,0x7024,0x701c,0x702a,0x720c,0x720a,
-0x7207,0x7202,0x7205,0x72a5,0x72a6,0x72a4,0x72a3,0x72a1,
-0x74cb,0x74c5,0x74b7,0x74c3,0x7516,0x7660,0x77c9,0x77ca,
-0x77c4,0x77f1,0x791d,0x791b,0x7921,0x791c,0x7917,0x791e,
-0x79b0,0x7a67,0x7a68,0x7c33,0x7c3c,0x7c39,0x7c2c,0x7c3b,
-0x7cec,0x7cea,0x7e76,0x7e75,0x7e78,0x7e70,0x7e77,0x7e6f,
-0x7e7a,0x7e72,0x7e74,0x7e68,0x7f4b,0x7f4a,0x7f83,0x7f86,
-0x7fb7,0x7ffd,0x7ffe,0x8078,0x81d7,0x81d5,0x8264,0x8261,
-0x8263,0x85eb,0x85f1,0x85ed,0x85d9,0x85e1,0x85e8,0x85da,
-0x85d7,0x85ec,0x85f2,0x85f8,0x85d8,0x85df,0x85e3,0x85dc,
-0x85d1,0x85f0,0x85e6,0x85ef,0x85de,0x85e2,0x8800,0x87fa,
-0x8803,0x87f6,0x87f7,0x8809,0x880c,0x880b,0x8806,0x87fc,
-0x8808,0x87ff,0x880a,0x8802,0x8962,0x895a,0x895b,0x8957,
-0x8961,0x895c,0x8958,0x895d,0x8959,0x8988,0x89b7,0x89b6,
-0x89f6,0x8b50,0x8b48,0x8b4a,0x8b40,0x8b53,0x8b56,0x8b54,
-0x8b4b,0x8b55,0x8b51,0x8b42,0x8b52,0x8b57,0x8c43,0x8c77,
-0x8c76,0x8c9a,0x8d06,0x8d07,0x8d09,0x8dac,0x8daa,0x8dad,
-0x8dab,0x8e6d,0x8e78,0x8e73,0x8e6a,0x8e6f,0x8e7b,0x8ec2,
-0x8f52,0x8f51,0x8f4f,0x8f50,0x8f53,0x8fb4,0x9140,0x913f,
-0x91b0,0x91ad,0x93de,0x93c7,0x93cf,0x93c2,0x93da,0x93d0,
-0x93f9,0x93ec,0x93cc,0x93d9,0x93a9,0x93e6,0x93ca,0x93d4,
-0x93ee,0x93e3,0x93d5,0x93c4,0x93ce,0x93c0,0x93d2,0x93e7,
-0x957d,0x95da,0x95db,0x96e1,0x9729,0x972b,0x972c,0x9728,
-0x9726,0x97b3,0x97b7,0x97b6,0x97dd,0x97de,0x97df,0x985c,
-0x9859,0x985d,0x9857,0x98bf,0x98bd,0x98bb,0x98be,0x9948,
-0x9947,0x9943,0x99a6,0x99a7,0x9a1a,0x9a15,0x9a25,0x9a1d,
-0x9a24,0x9a1b,0x9a22,0x9a20,0x9a27,0x9a23,0x9a1e,0x9a1c,
-0x9a14,0x9ac2,0x9b0b,0x9b0a,0x9b0e,0x9b0c,0x9b37,0x9bea,
-0x9beb,0x9be0,0x9bde,0x9be4,0x9be6,0x9be2,0x9bf0,0x9bd4,
-0x9bd7,0x9bec,0x9bdc,0x9bd9,0x9be5,0x9bd5,0x9be1,0x9bda,
-0x9d77,0x9d81,0x9d8a,0x9d84,0x9d88,0x9d71,0x9d80,0x9d78,
-0x9d86,0x9d8b,0x9d8c,0x9d7d,0x9d6b,0x9d74,0x9d75,0x9d70,
-0x9d69,0x9d85,0x9d73,0x9d7b,0x9d82,0x9d6f,0x9d79,0x9d7f,
-0x9d87,0x9d68,0x9e94,0x9e91,0x9ec0,0x9efc,0x9f2d,0x9f40,
-0x9f41,0x9f4d,0x9f56,0x9f57,0x9f58,0x5337,0x56b2,0x56b5,
-0x56b3,0x58e3,0x5b45,0x5dc6,0x5dc7,0x5eee,0x5eef,0x5fc0,
-0x5fc1,0x61f9,0x6517,0x6516,0x6515,0x6513,0x65df,0x66e8,
-0x66e3,0x66e4,0x6af3,0x6af0,0x6aea,0x6ae8,0x6af9,0x6af1,
-0x6aee,0x6aef,0x703c,0x7035,0x702f,0x7037,0x7034,0x7031,
-0x7042,0x7038,0x703f,0x703a,0x7039,0x7040,0x703b,0x7033,
-0x7041,0x7213,0x7214,0x72a8,0x737d,0x737c,0x74ba,0x76ab,
-0x76aa,0x76be,0x76ed,0x77cc,0x77ce,0x77cf,0x77cd,0x77f2,
-0x7925,0x7923,0x7927,0x7928,0x7924,0x7929,0x79b2,0x7a6e,
-0x7a6c,0x7a6d,0x7af7,0x7c49,0x7c48,0x7c4a,0x7c47,0x7c45,
-0x7cee,0x7e7b,0x7e7e,0x7e81,0x7e80,0x7fba,0x7fff,0x8079,
-0x81db,0x81d9,0x820b,0x8268,0x8269,0x8622,0x85ff,0x8601,
-0x85fe,0x861b,0x8600,0x85f6,0x8604,0x8609,0x8605,0x860c,
-0x85fd,0x8819,0x8810,0x8811,0x8817,0x8813,0x8816,0x8963,
-0x8966,0x89b9,0x89f7,0x8b60,0x8b6a,0x8b5d,0x8b68,0x8b63,
-0x8b65,0x8b67,0x8b6d,0x8dae,0x8e86,0x8e88,0x8e84,0x8f59,
-0x8f56,0x8f57,0x8f55,0x8f58,0x8f5a,0x908d,0x9143,0x9141,
-0x91b7,0x91b5,0x91b2,0x91b3,0x940b,0x9413,0x93fb,0x9420,
-0x940f,0x9414,0x93fe,0x9415,0x9410,0x9428,0x9419,0x940d,
-0x93f5,0x9400,0x93f7,0x9407,0x940e,0x9416,0x9412,0x93fa,
-0x9409,0x93f8,0x940a,0x93ff,0x93fc,0x940c,0x93f6,0x9411,
-0x9406,0x95de,0x95e0,0x95df,0x972e,0x972f,0x97b9,0x97bb,
-0x97fd,0x97fe,0x9860,0x9862,0x9863,0x985f,0x98c1,0x98c2,
-0x9950,0x994e,0x9959,0x994c,0x994b,0x9953,0x9a32,0x9a34,
-0x9a31,0x9a2c,0x9a2a,0x9a36,0x9a29,0x9a2e,0x9a38,0x9a2d,
-0x9ac7,0x9aca,0x9ac6,0x9b10,0x9b12,0x9b11,0x9c0b,0x9c08,
-0x9bf7,0x9c05,0x9c12,0x9bf8,0x9c40,0x9c07,0x9c0e,0x9c06,
-0x9c17,0x9c14,0x9c09,0x9d9f,0x9d99,0x9da4,0x9d9d,0x9d92,
-0x9d98,0x9d90,0x9d9b,0x9da0,0x9d94,0x9d9c,0x9daa,0x9d97,
-0x9da1,0x9d9a,0x9da2,0x9da8,0x9d9e,0x9da3,0x9dbf,0x9da9,
-0x9d96,0x9da6,0x9da7,0x9e99,0x9e9b,0x9e9a,0x9ee5,0x9ee4,
-0x9ee7,0x9ee6,0x9f30,0x9f2e,0x9f5b,0x9f60,0x9f5e,0x9f5d,
-0x9f59,0x9f91,0x513a,0x5139,0x5298,0x5297,0x56c3,0x56bd,
-0x56be,0x5b48,0x5b47,0x5dcb,0x5dcf,0x5ef1,0x61fd,0x651b,
-0x6b02,0x6afc,0x6b03,0x6af8,0x6b00,0x7043,0x7044,0x704a,
-0x7048,0x7049,0x7045,0x7046,0x721d,0x721a,0x7219,0x737e,
-0x7517,0x766a,0x77d0,0x792d,0x7931,0x792f,0x7c54,0x7c53,
-0x7cf2,0x7e8a,0x7e87,0x7e88,0x7e8b,0x7e86,0x7e8d,0x7f4d,
-0x7fbb,0x8030,0x81dd,0x8618,0x862a,0x8626,0x861f,0x8623,
-0x861c,0x8619,0x8627,0x862e,0x8621,0x8620,0x8629,0x861e,
-0x8625,0x8829,0x881d,0x881b,0x8820,0x8824,0x881c,0x882b,
-0x884a,0x896d,0x8969,0x896e,0x896b,0x89fa,0x8b79,0x8b78,
-0x8b45,0x8b7a,0x8b7b,0x8d10,0x8d14,0x8daf,0x8e8e,0x8e8c,
-0x8f5e,0x8f5b,0x8f5d,0x9146,0x9144,0x9145,0x91b9,0x943f,
-0x943b,0x9436,0x9429,0x943d,0x943c,0x9430,0x9439,0x942a,
-0x9437,0x942c,0x9440,0x9431,0x95e5,0x95e4,0x95e3,0x9735,
-0x973a,0x97bf,0x97e1,0x9864,0x98c9,0x98c6,0x98c0,0x9958,
-0x9956,0x9a39,0x9a3d,0x9a46,0x9a44,0x9a42,0x9a41,0x9a3a,
-0x9a3f,0x9acd,0x9b15,0x9b17,0x9b18,0x9b16,0x9b3a,0x9b52,
-0x9c2b,0x9c1d,0x9c1c,0x9c2c,0x9c23,0x9c28,0x9c29,0x9c24,
-0x9c21,0x9db7,0x9db6,0x9dbc,0x9dc1,0x9dc7,0x9dca,0x9dcf,
-0x9dbe,0x9dc5,0x9dc3,0x9dbb,0x9db5,0x9dce,0x9db9,0x9dba,
-0x9dac,0x9dc8,0x9db1,0x9dad,0x9dcc,0x9db3,0x9dcd,0x9db2,
-0x9e7a,0x9e9c,0x9eeb,0x9eee,0x9eed,0x9f1b,0x9f18,0x9f1a,
-0x9f31,0x9f4e,0x9f65,0x9f64,0x9f92,0x4eb9,0x56c6,0x56c5,
-0x56cb,0x5971,0x5b4b,0x5b4c,0x5dd5,0x5dd1,0x5ef2,0x6521,
-0x6520,0x6526,0x6522,0x6b0b,0x6b08,0x6b09,0x6c0d,0x7055,
-0x7056,0x7057,0x7052,0x721e,0x721f,0x72a9,0x737f,0x74d8,
-0x74d5,0x74d9,0x74d7,0x766d,0x76ad,0x7935,0x79b4,0x7a70,
-0x7a71,0x7c57,0x7c5c,0x7c59,0x7c5b,0x7c5a,0x7cf4,0x7cf1,
-0x7e91,0x7f4f,0x7f87,0x81de,0x826b,0x8634,0x8635,0x8633,
-0x862c,0x8632,0x8636,0x882c,0x8828,0x8826,0x882a,0x8825,
-0x8971,0x89bf,0x89be,0x89fb,0x8b7e,0x8b84,0x8b82,0x8b86,
-0x8b85,0x8b7f,0x8d15,0x8e95,0x8e94,0x8e9a,0x8e92,0x8e90,
-0x8e96,0x8e97,0x8f60,0x8f62,0x9147,0x944c,0x9450,0x944a,
-0x944b,0x944f,0x9447,0x9445,0x9448,0x9449,0x9446,0x973f,
-0x97e3,0x986a,0x9869,0x98cb,0x9954,0x995b,0x9a4e,0x9a53,
-0x9a54,0x9a4c,0x9a4f,0x9a48,0x9a4a,0x9a49,0x9a52,0x9a50,
-0x9ad0,0x9b19,0x9b2b,0x9b3b,0x9b56,0x9b55,0x9c46,0x9c48,
-0x9c3f,0x9c44,0x9c39,0x9c33,0x9c41,0x9c3c,0x9c37,0x9c34,
-0x9c32,0x9c3d,0x9c36,0x9ddb,0x9dd2,0x9dde,0x9dda,0x9dcb,
-0x9dd0,0x9ddc,0x9dd1,0x9ddf,0x9de9,0x9dd9,0x9dd8,0x9dd6,
-0x9df5,0x9dd5,0x9ddd,0x9eb6,0x9ef0,0x9f35,0x9f33,0x9f32,
-0x9f42,0x9f6b,0x9f95,0x9fa2,0x513d,0x5299,0x58e8,0x58e7,
-0x5972,0x5b4d,0x5dd8,0x882f,0x5f4f,0x6201,0x6203,0x6204,
-0x6529,0x6525,0x6596,0x66eb,0x6b11,0x6b12,0x6b0f,0x6bca,
-0x705b,0x705a,0x7222,0x7382,0x7381,0x7383,0x7670,0x77d4,
-0x7c67,0x7c66,0x7e95,0x826c,0x863a,0x8640,0x8639,0x863c,
-0x8631,0x863b,0x863e,0x8830,0x8832,0x882e,0x8833,0x8976,
-0x8974,0x8973,0x89fe,0x8b8c,0x8b8e,0x8b8b,0x8b88,0x8c45,
-0x8d19,0x8e98,0x8f64,0x8f63,0x91bc,0x9462,0x9455,0x945d,
-0x9457,0x945e,0x97c4,0x97c5,0x9800,0x9a56,0x9a59,0x9b1e,
-0x9b1f,0x9b20,0x9c52,0x9c58,0x9c50,0x9c4a,0x9c4d,0x9c4b,
-0x9c55,0x9c59,0x9c4c,0x9c4e,0x9dfb,0x9df7,0x9def,0x9de3,
-0x9deb,0x9df8,0x9de4,0x9df6,0x9de1,0x9dee,0x9de6,0x9df2,
-0x9df0,0x9de2,0x9dec,0x9df4,0x9df3,0x9de8,0x9ded,0x9ec2,
-0x9ed0,0x9ef2,0x9ef3,0x9f06,0x9f1c,0x9f38,0x9f37,0x9f36,
-0x9f43,0x9f4f,0x9f71,0x9f70,0x9f6e,0x9f6f,0x56d3,0x56cd,
-0x5b4e,0x5c6d,0x652d,0x66ed,0x66ee,0x6b13,0x705f,0x7061,
-0x705d,0x7060,0x7223,0x74db,0x74e5,0x77d5,0x7938,0x79b7,
-0x79b6,0x7c6a,0x7e97,0x7f89,0x826d,0x8643,0x8838,0x8837,
-0x8835,0x884b,0x8b94,0x8b95,0x8e9e,0x8e9f,0x8ea0,0x8e9d,
-0x91be,0x91bd,0x91c2,0x946b,0x9468,0x9469,0x96e5,0x9746,
-0x9743,0x9747,0x97c7,0x97e5,0x9a5e,0x9ad5,0x9b59,0x9c63,
-0x9c67,0x9c66,0x9c62,0x9c5e,0x9c60,0x9e02,0x9dfe,0x9e07,
-0x9e03,0x9e06,0x9e05,0x9e00,0x9e01,0x9e09,0x9dff,0x9dfd,
-0x9e04,0x9ea0,0x9f1e,0x9f46,0x9f74,0x9f75,0x9f76,0x56d4,
-0x652e,0x65b8,0x6b18,0x6b19,0x6b17,0x6b1a,0x7062,0x7226,
-0x72aa,0x77d8,0x77d9,0x7939,0x7c69,0x7c6b,0x7cf6,0x7e9a,
-0x7e98,0x7e9b,0x7e99,0x81e0,0x81e1,0x8646,0x8647,0x8648,
-0x8979,0x897a,0x897c,0x897b,0x89ff,0x8b98,0x8b99,0x8ea5,
-0x8ea4,0x8ea3,0x946e,0x946d,0x946f,0x9471,0x9473,0x9749,
-0x9872,0x995f,0x9c68,0x9c6e,0x9c6d,0x9e0b,0x9e0d,0x9e10,
-0x9e0f,0x9e12,0x9e11,0x9ea1,0x9ef5,0x9f09,0x9f47,0x9f78,
-0x9f7b,0x9f7a,0x9f79,0x571e,0x7066,0x7c6f,0x883c,0x8db2,
-0x8ea6,0x91c3,0x9474,0x9478,0x9476,0x9475,0x9a60,0x9c74,
-0x9c73,0x9c71,0x9c75,0x9e14,0x9e13,0x9ef6,0x9f0a,0x9fa4,
-0x7068,0x7065,0x7cf7,0x866a,0x883e,0x883d,0x883f,0x8b9e,
-0x8c9c,0x8ea9,0x8ec9,0x974b,0x9873,0x9874,0x98cc,0x9961,
-0x99ab,0x9a64,0x9a66,0x9a67,0x9b24,0x9e15,0x9e17,0x9f48,
-0x6207,0x6b1e,0x7227,0x864c,0x8ea8,0x9482,0x9480,0x9481,
-0x9a69,0x9a68,0x9b2e,0x9e19,0x7229,0x864b,0x8b9f,0x9483,
-0x9c79,0x9eb7,0x7675,0x9a6b,0x9c7a,0x9e1d,0x7069,0x706a,
-0x9ea4,0x9f7e,0x9f49,0x9f98,0x7881,0x92b9,0x88cf,0x58bb,
-0x6052,0x7ca7,0x5afa,0x2554,0x2566,0x2557,0x2560,0x256c,
-0x2563,0x255a,0x2569,0x255d,0x2552,0x2564,0x2555,0x255e,
-0x256a,0x2561,0x2558,0x2567,0x255b,0x2553,0x2565,0x2556,
-0x255f,0x256b,0x2562,0x2559,0x2568,0x255c,0x2551,0x2550,
-0x256d,0x256e,0x2570,0x256f,0x2593};
-
-static const int big5_ucs_table_size = sizeof(big5_ucs_table)/sizeof(unsigned short);
-
-/* UCS -> Big5 */
-static const unsigned short ucs_a1_big5_table[] = {
-/* 0x0000 */
-0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
-0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
-0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
-0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
-0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
-0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
-0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
-0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
-0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
-0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
-0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
-0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
-0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
-0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
-0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
-0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1b1,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1c2,
-0xa258,0xa1d3,0x0000,0x0000,0x0000,0x0000,0x0000,0xa150,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1d1,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1d2,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x0100 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x0200 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa3be,
-0x0000,0xa3bc,0xa3bd,0xa3bf,0x0000,0xa1c5,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa3bb,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x0300 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa344,0xa345,0xa346,0xa347,0xa348,0xa349,0xa34a,
-0xa34b,0xa34c,0xa34d,0xa34e,0xa34f,0xa350,0xa351,0xa352,
-0xa353,0xa354,0x0000,0xa355,0xa356,0xa357,0xa358,0xa359,
-0xa35a,0xa35b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa35c,0xa35d,0xa35e,0xa35f,0xa360,0xa361,0xa362,
-0xa363,0xa364,0xa365,0xa366,0xa367,0xa368,0xa369,0xa36a,
-0xa36b,0xa36c,0x0000,0xa36d,0xa36e,0xa36f,0xa370,0xa371,
-0xa372,0xa373};
-
-static const int ucs_a1_big5_table_min = 0x0000;
-static const int ucs_a1_big5_table_max = 0x0000 + (sizeof (ucs_a1_big5_table) / sizeof (unsigned short));
-
-
-static const unsigned short ucs_a2_big5_table[] = {
-/* 0x2000 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa156,0xa158,0x0000,0x0000,0x0000,
-0xa1a5,0xa1a6,0x0000,0x0000,0xa1a7,0xa1a8,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa14c,0xa14b,0xa145,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa1ac,0x0000,0x0000,0xa1ab,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa1b0,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa3e1,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x2100 */
-0x0000,0x0000,0x0000,0xa24a,0x0000,0xa1c1,0x0000,0x0000,
-0x0000,0xa24b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa2b9,0xa2ba,0xa2bb,0xa2bc,0xa2bd,0xa2be,0xa2bf,0xa2c0,
-0xa2c1,0xa2c2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1f6,0xa1f4,0xa1f7,0xa1f5,0x0000,0x0000,0xa1f8,0xa1f9,
-0xa1fb,0xa1fa,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x2200 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa241,0x0000,0x0000,
-0x0000,0x0000,0xa1d4,0x0000,0x0000,0x0000,0xa1db,0xa1e8,
-0xa1e7,0x0000,0x0000,0xa1fd,0x0000,0xa1fc,0x0000,0x0000,
-0x0000,0xa1e4,0xa1e5,0xa1ec,0x0000,0x0000,0xa1ed,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa1ef,0xa1ee,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa1dc,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1da,0xa1dd,0x0000,0x0000,0x0000,0x0000,0xa1d8,0xa1d9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa1f2,0x0000,0x0000,
-0x0000,0xa1f3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa1e6,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1e9,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x2300 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x2400 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa277,0x0000,0xa278,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa27a,0x0000,0x0000,0x0000,
-0xa27b,0x0000,0x0000,0x0000,0xa27c,0x0000,0x0000,0x0000,
-0xa27d,0x0000,0x0000,0x0000,0xa275,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa274,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa273,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa272,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa271,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf9f9,0xf9f8,0xf9e6,0xf9ef,0xf9dd,0xf9e8,0xf9f1,0xf9df,
-0xf9ec,0xf9f5,0xf9e3,0xf9ee,0xf9f7,0xf9e5,0xf9e9,0xf9f2,
-0xf9e0,0xf9eb,0xf9f4,0xf9e2,0xf9e7,0xf9f0,0xf9de,0xf9ed,
-0xf9f6,0xf9e4,0xf9ea,0xf9f3,0xf9e1,0xf9fa,0xf9fb,0xf9fd,
-0xf9fc,0xa2ac,0xa2ad,0xa2ae,0xa15a,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa262,0xa263,0xa264,0xa265,0xa266,0xa267,0xa268,
-0xa269,0xa270,0xa26f,0xa26e,0xa26d,0xa26c,0xa26b,0xa26a,
-0x0000,0x0000,0x0000,0xf9fe,0xa276,0xa279,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1bd,0xa1bc,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa1b6,0xa1b5,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa1bf,0xa1be,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1bb,0xa1ba,
-0x0000,0x0000,0x0000,0xa1b3,0x0000,0x0000,0xa1b7,0xa1b4,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa2a8,0xa2a9,0xa2ab,0xa2aa,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x2600 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa1b9,0xa1b8,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa1f0,0x0000,0xa1f1};
-
-static const int ucs_a2_big5_table_min = 0x2000;
-static const int ucs_a2_big5_table_max = 0x2000 + (sizeof (ucs_a2_big5_table) / sizeof (unsigned short));
-
-
-static const unsigned short ucs_a3_big5_table[] = {
-/* 0x2f00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa140,0xa142,0xa143,0xa1b2,0x0000,0x0000,0x0000,0x0000,
-0xa171,0xa172,0xa16d,0xa16e,0xa175,0xa176,0xa179,0xa17a,
-0xa169,0xa16a,0xa245,0x0000,0xa165,0xa166,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa1a9,0xa1aa,0x0000,
-0x0000,0xa2c3,0xa2c4,0xa2c5,0xa2c6,0xa2c7,0xa2c8,0xa2c9,
-0xa2ca,0xa2cb,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x3100 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa374,0xa375,0xa376,
-0xa377,0xa378,0xa379,0xa37a,0xa37b,0xa37c,0xa37d,0xa37e,
-0xa3a1,0xa3a2,0xa3a3,0xa3a4,0xa3a5,0xa3a6,0xa3a7,0xa3a8,
-0xa3a9,0xa3aa,0xa3ab,0xa3ac,0xa3ad,0xa3ae,0xa3af,0xa3b0,
-0xa3b1,0xa3b2,0xa3b3,0xa3b4,0xa3b5,0xa3b6,0xa3b7,0xa3b8,
-0xa3b9,0xa3ba,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x3200 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa1c0,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x3300 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa255,0xa256,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa250,0xa251,0xa252,0x0000,
-0x0000,0xa254,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa257,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa253,0x0000,
-0x0000,0xa1eb,0xa1ea,0x0000,0x0000,0xa24f};
-
-static const int ucs_a3_big5_table_min = 0x2f00;
-static const int ucs_a3_big5_table_max = 0x2f00 + (sizeof (ucs_a3_big5_table) / sizeof (unsigned short));
-
-static const unsigned short ucs_i_big5_table[] = {
-/* 0x4d00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa440,0xa442,0x0000,0xa443,0x0000,0x0000,0x0000,0xc945,
-0xa456,0xa454,0xa457,0xa455,0xc946,0xa4a3,0xc94f,0xc94d,
-0xa4a2,0xa4a1,0x0000,0x0000,0xa542,0xa541,0xa540,0x0000,
-0xa543,0xa4fe,0x0000,0x0000,0x0000,0x0000,0xa5e0,0xa5e1,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa8c3,0x0000,
-0x0000,0x0000,0x0000,0xa458,0x0000,0xa4a4,0xc950,0x0000,
-0xa4a5,0xc963,0xa6ea,0xcbb1,0x0000,0x0000,0x0000,0x0000,
-0xa459,0xa4a6,0x0000,0xa544,0xc964,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xc940,0xa444,0x0000,0xa45b,0x0000,0xc947,
-0xa45c,0x0000,0x0000,0xa4a7,0x0000,0xa545,0xa547,0xa546,
-0x0000,0x0000,0xa5e2,0xa5e3,0x0000,0x0000,0xa8c4,0x0000,
-0xadbc,0xa441,0x0000,0x0000,0xc941,0xa445,0xa45e,0xa45d,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa5e4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa8c5,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb0ae,0xd44b,
-0x0000,0x0000,0xb6c3,0xdcb1,0xdcb2,0x0000,0xa446,0x0000,
-0xa4a9,0x0000,0x0000,0xa8c6,0xa447,0xc948,0xa45f,0x0000,
-0x0000,0xa4aa,0xa4ac,0xc951,0xa4ad,0xa4ab,0x0000,0x0000,
-0x0000,0xa5e5,0x0000,0xa8c7,0x0000,0x0000,0xa8c8,0xab45,
-0x0000,0xa460,0xa4ae,0x0000,0xa5e6,0xa5e8,0xa5e7,0x0000,
-0xa6eb,0x0000,0x0000,0xa8c9,0xa8ca,0xab46,0xab47,0x0000,
-0x0000,0x0000,0x0000,0xadbd,0x0000,0x0000,0xdcb3,0x0000,
-0x0000,0xf6d6,0xa448,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa4b0,0xa4af,0xc952,0xa4b1,0xa4b7,0x0000,0xa4b2,0xa4b3,
-0xc954,0xc953,0xa4b5,0xa4b6,0x0000,0xa4b4,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa54a,0xa54b,0xa54c,0xa54d,
-0xa549,0xa550,0xc96a,0x0000,0xc966,0xc969,0xa551,0xa561,
-0x0000,0xc968,0x0000,0xa54e,0xa54f,0xa548,0x0000,0x0000,
-0xc965,0xc967,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa5f5,0xc9b0,0xa5f2,0xa5f6,0xc9ba,0xc9ae,0xa5f3,0xc9b2,
-0x0000,0x0000,0x0000,0xa5f4,0x0000,0xa5f7,0x0000,0xa5e9,
-0xc9b1,0xa5f8,0xc9b5,0x0000,0xc9b9,0xc9b6,0x0000,0x0000,
-0xc9b3,0xa5ea,0xa5ec,0xa5f9,0x0000,0xa5ee,0xc9ab,0xa5f1,
-0xa5ef,0xa5f0,0xc9bb,0xc9b8,0xc9af,0xa5ed,0x0000,0x0000,
-0xc9ac,0xa5eb,0x0000,0x0000,0x0000,0xc9b4,0x0000,0x0000,
-0x0000,0x0000,0xc9b7,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xc9ad,0xca66,0x0000,0xa742,
-0xa6f4,0x0000,0x0000,0xca67,0xa6f1,0x0000,0xa744,0x0000,
-0xa6f9,0x0000,0xa6f8,0xca5b,0xa6fc,0xa6f7,0xca60,0xca68,
-0x0000,0xca64,0x0000,0xa6fa,0x0000,0x0000,0xa6fd,0xa6ee,
-0xa747,0xca5d,0x0000,0x0000,0xcbbd,0xa6ec,0xa743,0xa6ed,
-0xa6f5,0xa6f6,0xca62,0xca5e,0xa6fb,0xa6f3,0xca5a,0xa6ef,
-0xca65,0xa745,0xa748,0xa6f2,0xa740,0xa746,0xa6f0,0xca63,
-0xa741,0xca69,0xca5c,0xa6fe,0xca5f,0x0000,0x0000,0xca61,
-0x0000,0xa8d8,0xcbbf,0xcbcb,0xa8d0,0x0000,0xcbcc,0xa8cb,
-0xa8d5,0x0000,0x0000,0xa8ce,0xcbb9,0xa8d6,0xcbb8,0xcbbc,
-0xcbc3,0xcbc1,0xa8de,0xa8d9,0xcbb3,0xcbb5,0xa8db,0xa8cf,
-0xcbb6,0xcbc2,0xcbc9,0xa8d4,0xcbbb,0xcbb4,0xa8d3,0xcbb7,
-0xa8d7,0xcbba,0x0000,0xa8d2,0x0000,0xa8cd,0x0000,0xa8dc,
-0xcbc4,0xa8dd,0xcbc8,0x0000,0xcbc6,0xcbca,0xa8da,0xcbbe,
-0xcbb2,0x0000,0xcbc0,0xa8d1,0xcbc5,0xa8cc,0xcbc7,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xab56,0xab4a,
-0x0000,0x0000,0xcde0,0xcde8,0x0000,0xab49,0xab51,0xab5d,
-0x0000,0xcdee,0xcdec,0xcde7,0x0000,0x0000,0x0000,0xab4b,
-0xcded,0xcde3,0xab59,0xab50,0xab58,0xcdde,0x0000,0xcdea,
-0x0000,0xcde1,0xab54,0xcde2,0x0000,0xcddd,0xab5b,0xab4e,
-0xab57,0xab4d,0x0000,0xcddf,0xcde4,0x0000,0xcdeb,0xab55,
-0xab52,0xcde6,0xab5a,0xcde9,0xcde5,0xab4f,0xab5c,0xab53,
-0xab4c,0xab48,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcdef,0x0000,0xadd7,0xadc1,
-0x0000,0xadd1,0x0000,0xadd6,0xd0d0,0xd0cf,0xd0d4,0xd0d5,
-0xadc4,0x0000,0xadcd,0x0000,0x0000,0x0000,0xadda,0x0000,
-0xadce,0x0000,0x0000,0x0000,0x0000,0xd0c9,0xadc7,0xd0ca,
-0x0000,0xaddc,0x0000,0xadd3,0xadbe,0xadbf,0xd0dd,0xb0bf,
-0x0000,0xadcc,0xadcb,0xd0cb,0xadcf,0xd45b,0xadc6,0xd0d6,
-0xadd5,0xadd4,0xadca,0xd0ce,0xd0d7,0x0000,0xd0c8,0xadc9,
-0xd0d8,0xadd2,0xd0cc,0xadc0,0x0000,0xadc3,0xadc2,0xd0d9,
-0xadd0,0xadc5,0xadd9,0xaddb,0xd0d3,0xadd8,0x0000,0xd0db,
-0xd0cd,0xd0dc,0x0000,0xd0d1,0x0000,0xd0da,0x0000,0xd0d2,
-0x0000,0x0000,0x0000,0x0000,0xadc8,0x0000,0x0000,0x0000,
-0xd463,0xd457,0x0000,0xb0b3,0x0000,0xd45c,0xd462,0xb0b2,
-0xd455,0xb0b6,0xd459,0xd452,0xb0b4,0xd456,0xb0b9,0xb0be,
-0x0000,0xd467,0x0000,0xd451,0x0000,0xb0ba,0x0000,0xd466,
-0x0000,0x0000,0xb0b5,0xd458,0xb0b1,0xd453,0xd44f,0xd45d,
-0xd450,0xd44e,0xd45a,0xd460,0xd461,0xb0b7,0x0000,0x0000,
-0xd85b,0xd45e,0xd44d,0xd45f,0x0000,0xb0c1,0xd464,0xb0c0,
-0xd44c,0x0000,0xd454,0xd465,0xb0bc,0xb0bb,0xb0b8,0xb0bd,
-0x0000,0x0000,0xb0af,0x0000,0x0000,0xb0b0,0x0000,0x0000,
-0xb3c8,0x0000,0xd85e,0xd857,0x0000,0xb3c5,0x0000,0xd85f,
-0x0000,0x0000,0x0000,0xd855,0xd858,0xb3c4,0xd859,0x0000,
-0x0000,0xb3c7,0xd85d,0x0000,0xd853,0xd852,0xb3c9,0x0000,
-0xb3ca,0xb3c6,0xb3cb,0xd851,0xd85c,0xd85a,0xd854,0x0000,
-0x0000,0x0000,0xb3c3,0xd856,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xb6ca,0xb6c4,0xdcb7,0xb6cd,
-0xdcbd,0xdcc0,0xb6c6,0xb6c7,0xdcba,0xb6c5,0xdcc3,0xb6cb,
-0xdcc4,0x0000,0xdcbf,0xb6cc,0x0000,0xdcb4,0xb6c9,0xdcb5,
-0x0000,0xdcbe,0xdcbc,0x0000,0xdcb8,0xb6c8,0xdcb6,0xb6ce,
-0xdcbb,0xdcc2,0xdcb9,0xdcc1,0x0000,0x0000,0xb9b6,0xb9b3,
-0x0000,0xb9b4,0x0000,0xe0f9,0xe0f1,0xb9b2,0xb9af,0xe0f2,
-0x0000,0x0000,0xb9b1,0xe0f5,0x0000,0xe0f7,0x0000,0x0000,
-0xe0fe,0x0000,0x0000,0xe0fd,0xe0f8,0xb9ae,0xe0f0,0xb9ac,
-0xe0f3,0xb9b7,0xe0f6,0x0000,0xe0fa,0xb9b0,0xb9ad,0xe0fc,
-0xe0fb,0xb9b5,0x0000,0xe0f4,0x0000,0xbbf8,0xe4ec,0x0000,
-0xe4e9,0xbbf9,0x0000,0xbbf7,0x0000,0xe4f0,0xe4ed,0xe4e6,
-0xbbf6,0x0000,0xbbfa,0xe4e7,0xbbf5,0xbbfd,0xe4ea,0xe4eb,
-0xbbfb,0xbbfc,0xe4f1,0xe4ee,0xe4ef,0x0000,0x0000,0x0000,
-0xbeaa,0xe8f8,0xbea7,0xe8f5,0xbea9,0xbeab,0x0000,0xe8f6,
-0xbea8,0x0000,0xe8f7,0x0000,0xe8f4,0x0000,0x0000,0xc076,
-0xecbd,0xc077,0xecbb,0x0000,0xecbc,0xecba,0xecb9,0x0000,
-0x0000,0xecbe,0xc075,0x0000,0x0000,0xefb8,0xefb9,0x0000,
-0xe4e8,0xefb7,0xc078,0xc35f,0xf1eb,0xf1ec,0x0000,0xc4d7,
-0xc4d8,0xf5c1,0xf5c0,0xc56c,0xc56b,0xf7d0,0x0000,0xa449,
-0xa461,0xa4b9,0x0000,0xa4b8,0xa553,0xa552,0xa5fc,0xa5fb,
-0xa5fd,0xa5fa,0x0000,0xa74a,0xa749,0xa74b,0x0000,0x0000,
-0x0000,0x0000,0xa8e0,0x0000,0xa8df,0xa8e1,0x0000,0xab5e,
-0x0000,0xa259,0xd0de,0xa25a,0xb0c2,0xa25c,0xa25b,0xd860,
-0x0000,0xa25d,0xb9b8,0xa25e,0x0000,0xa44a,0x0000,0xa4ba,
-0xa5fe,0xa8e2,0x0000,0xa44b,0xa4bd,0xa4bb,0xa4bc,0x0000,
-0x0000,0xa640,0x0000,0x0000,0x0000,0xa74c,0xa8e4,0xa8e3,
-0xa8e5,0x0000,0x0000,0x0000,0xaddd,0x0000,0x0000,0x0000,
-0xbeac,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc94e,
-0x0000,0xa554,0xa555,0x0000,0x0000,0xa641,0x0000,0xca6a,
-0x0000,0xab60,0xab5f,0xd0e0,0xd0df,0xb0c3,0x0000,0xa4be,
-0xc955,0x0000,0x0000,0x0000,0x0000,0x0000,0xcbcd,0x0000,
-0xab61,0x0000,0xade0,0x0000,0xadde,0xaddf,0x0000,0x0000,
-0x0000,0x0000,0xbead,0x0000,0xa556,0x0000,0x0000,0x0000,
-0xa642,0xc9bc,0x0000,0x0000,0x0000,0x0000,0xa74d,0xa74e,
-0x0000,0xca6b,0x0000,0x0000,0xcbce,0xa8e6,0xcbcf,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd0e2,0xd0e3,0xade3,0x0000,
-0xd0e4,0x0000,0xd0e1,0xade4,0xade2,0xade1,0xd0e5,0x0000,
-0xd468,0x0000,0x0000,0x0000,0xd861,0x0000,0x0000,0xdcc5,
-0xe140,0x0000,0x0000,0x0000,0xbbfe,0xbeae,0xe8f9,0x0000,
-0xa44c,0xa45a,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xb0c4,0xb3cd,0x0000,0xb9b9,0x0000,0xc942,0xa4bf,0x0000,
-0xa559,0xa557,0xa558,0x0000,0x0000,0xa8e7,0x0000,0x0000,
-0xa44d,0xa44e,0x0000,0xa462,0x0000,0x0000,0xa4c0,0xa4c1,
-0xa4c2,0xc9be,0xa55a,0x0000,0xc96b,0x0000,0xa646,0x0000,
-0xc9bf,0xa644,0xa645,0xc9bd,0x0000,0x0000,0xa647,0xa643,
-0x0000,0x0000,0x0000,0x0000,0xca6c,0xaaec,0xca6d,0x0000,
-0x0000,0xca6e,0x0000,0x0000,0xa750,0xa74f,0x0000,0x0000,
-0xa753,0xa751,0xa752,0x0000,0x0000,0x0000,0xa8ed,0x0000,
-0xa8ec,0xcbd4,0xcbd1,0xcbd2,0x0000,0xcbd0,0xa8ee,0xa8ea,
-0xa8e9,0x0000,0xa8eb,0xa8e8,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa8ef,0x0000,0xab63,0xcdf0,0x0000,0xcbd3,0xab68,
-0x0000,0xcdf1,0xab64,0xab67,0xab66,0xab65,0xab62,0x0000,
-0x0000,0x0000,0xd0e8,0x0000,0xade7,0xd0eb,0xade5,0x0000,
-0x0000,0x0000,0xd0e7,0xade8,0xade6,0xade9,0xd0e9,0xd0ea,
-0x0000,0xd0e6,0xd0ec,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xb3d1,0xb0c5,0xd469,0xd46b,0xd46a,0xd46c,0xb0c6,
-0x0000,0x0000,0xb3ce,0x0000,0xb3cf,0xb3d0,0x0000,0xb6d0,
-0xdcc7,0x0000,0xdcc6,0xdcc8,0xdcc9,0xb6d1,0x0000,0xb6cf,
-0xe141,0xe142,0xb9bb,0xb9ba,0xe35a,0x0000,0x0000,0xbc40,
-0xbc41,0xbc42,0xbc44,0xe4f2,0xe4f3,0xbc43,0x0000,0x0000,
-0x0000,0xbeaf,0x0000,0xbeb0,0x0000,0x0000,0xf1ed,0xf5c3,
-0xf5c2,0xf7d1,0x0000,0xa44f,0x0000,0x0000,0x0000,0xa55c,
-0xa55b,0x0000,0x0000,0xa648,0x0000,0x0000,0xc9c0,0x0000,
-0x0000,0xa755,0xa756,0xa754,0xa757,0xca6f,0xca70,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa8f1,0xcbd5,0x0000,0xa8f0,0x0000,
-0xcdf2,0xab6c,0xcdf3,0xab6b,0x0000,0x0000,0x0000,0xab69,
-0x0000,0xab6a,0x0000,0x0000,0x0000,0xd0ed,0x0000,0x0000,
-0x0000,0x0000,0xb0c7,0xd46e,0x0000,0xb0ca,0xd46d,0xb1e5,
-0xb0c9,0xb0c8,0x0000,0xb3d4,0x0000,0xb3d3,0xb3d2,0xb6d2,
-0x0000,0x0000,0xb6d5,0xb6d6,0xb6d4,0x0000,0xb6d3,0x0000,
-0x0000,0xe143,0x0000,0xe144,0x0000,0x0000,0x0000,0xe4f5,
-0xbc45,0xe4f4,0x0000,0xbeb1,0xecbf,0xc079,0x0000,0xf1ee,
-0xc455,0x0000,0xa463,0xa4c3,0xc956,0x0000,0xa4c4,0xa4c5,
-/* 0x5300 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa55d,0xa55e,0x0000,
-0xa649,0xca71,0xcbd6,0xcbd7,0x0000,0xab6d,0xd0ee,0xb0cc,
-0xb0cb,0xd863,0xd862,0x0000,0x0000,0xa450,0xa4c6,0xa55f,
-0x0000,0xb0cd,0xc943,0x0000,0xc96c,0xa560,0x0000,0xc9c2,
-0xa64b,0xa64a,0xc9c1,0xa758,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xadea,0x0000,0x0000,0xd46f,0x0000,0xb6d7,
-0xe145,0xb9bc,0x0000,0x0000,0xe8fa,0x0000,0x0000,0xf3fd,
-0x0000,0xa4c7,0x0000,0x0000,0xcbd8,0xcdf4,0xb0d0,0xb0ce,
-0xb0cf,0xa451,0x0000,0xa464,0xa2cd,0xa4ca,0x0000,0xa4c9,
-0xa4c8,0xa563,0xa562,0x0000,0xc96d,0xc9c3,0x0000,0x0000,
-0x0000,0xa8f5,0xa8f2,0xa8f4,0xa8f3,0x0000,0x0000,0xab6e,
-0x0000,0x0000,0xb3d5,0x0000,0xa452,0x0000,0xa4cb,0x0000,
-0xa565,0xa564,0x0000,0xca72,0x0000,0x0000,0xa8f6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xc957,0x0000,0xa567,0xa566,
-0xa64c,0xa64d,0xca73,0xa759,0x0000,0xa75a,0x0000,0xa8f7,
-0xa8f8,0xa8f9,0x0000,0xab6f,0xcdf5,0x0000,0x0000,0xadeb,
-0x0000,0x0000,0xc944,0x0000,0xa4cc,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xc9c4,0x0000,0x0000,0x0000,0xca74,0xca75,
-0x0000,0x0000,0xcbd9,0x0000,0xcbda,0x0000,0xcdf7,0xcdf6,
-0xcdf9,0xcdf8,0xab70,0x0000,0xd470,0xaded,0xd0ef,0xadec,
-0x0000,0x0000,0x0000,0x0000,0xd864,0xb3d6,0x0000,0xd865,
-0x0000,0x0000,0x0000,0x0000,0xe146,0xb9bd,0x0000,0x0000,
-0x0000,0x0000,0xbc46,0x0000,0xf1ef,0x0000,0x0000,0x0000,
-0x0000,0xc958,0x0000,0xa568,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xb0d1,0x0000,0x0000,0x0000,0x0000,
-0xa453,0xa465,0xa4ce,0xa4cd,0x0000,0xa4cf,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa8fb,0x0000,0xa8fa,0xa8fc,
-0x0000,0x0000,0x0000,0xab71,0x0000,0x0000,0x0000,0xadee,
-0x0000,0xe8fb,0xc24f,0xa466,0xa56a,0xa579,0xa574,0x0000,
-0xa56f,0xa56e,0xa575,0xa573,0xa56c,0xa57a,0xa56d,0xa569,
-0xa578,0xa577,0xa576,0xa56b,0x0000,0xa572,0x0000,0x0000,
-0xa571,0x0000,0x0000,0xa57b,0xa570,0x0000,0x0000,0x0000,
-/* 0x5400 */
-0x0000,0xa653,0x0000,0xa659,0xa655,0x0000,0xa65b,0xc9c5,
-0xa658,0xa64e,0xa651,0xa654,0xa650,0xa657,0xa65a,0xa64f,
-0xa652,0xa656,0xa65c,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xca7e,0xca7b,0x0000,0xa767,0xca7c,0xa75b,0xa75d,0xa775,
-0xa770,0x0000,0x0000,0x0000,0xcaa5,0xca7d,0xa75f,0xa761,
-0xcaa4,0xa768,0xca78,0xa774,0xa776,0xa75c,0xa76d,0x0000,
-0xca76,0xa773,0x0000,0xa764,0x0000,0xa76e,0xa76f,0xca77,
-0xa76c,0xa76a,0x0000,0xa76b,0xa771,0xcaa1,0xa75e,0x0000,
-0xa772,0xcaa3,0xa766,0xa763,0x0000,0xca7a,0xa762,0xcaa6,
-0xa765,0x0000,0xa769,0x0000,0x0000,0x0000,0xa760,0xcaa2,
-0x0000,0x0000,0x0000,0x0000,0xca79,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcbeb,0xcbea,0xa94f,0xcbed,0xcbef,0xcbe4,0xcbe7,0xcbee,
-0xa950,0x0000,0x0000,0xcbe1,0xcbe5,0x0000,0x0000,0xcbe9,
-0xce49,0xa94b,0xce4d,0xa8fd,0xcbe6,0xa8fe,0xa94c,0xa945,
-0xa941,0x0000,0xcbe2,0xa944,0xa949,0xa952,0xcbe3,0xcbdc,
-0xa943,0xcbdd,0xcbdf,0x0000,0xa946,0x0000,0xa948,0xcbdb,
-0xcbe0,0x0000,0x0000,0xa951,0xa94d,0xcbe8,0xa953,0x0000,
-0xa94a,0xcbde,0xa947,0x0000,0x0000,0xa942,0xa940,0x0000,
-0xcbec,0x0000,0xa94e,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xce48,0xcdfb,0xce4b,0x0000,0x0000,0xcdfd,0xab78,0xaba8,
-0xab74,0xaba7,0xab7d,0xaba4,0xab72,0xcdfc,0xce43,0xaba3,
-0xce4f,0xaba5,0x0000,0xab79,0x0000,0x0000,0xce45,0xce42,
-0xab77,0x0000,0xcdfa,0xaba6,0xce4a,0xab7c,0xce4c,0xaba9,
-0xab73,0xab7e,0xab7b,0xce40,0xaba1,0xce46,0xce47,0xab7a,
-0xaba2,0xab76,0x0000,0x0000,0x0000,0x0000,0xab75,0xcdfe,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xce44,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xce4e,0x0000,
-0xd144,0xadfb,0xd0f1,0x0000,0xd0f6,0xadf4,0xae40,0xd0f4,
-0xadef,0xadf9,0xadfe,0xd0fb,0x0000,0xadfa,0xadfd,0x0000,
-0x0000,0xd0fe,0xadf5,0xd0f5,0x0000,0x0000,0x0000,0xd142,
-0xd143,0x0000,0xadf7,0xd141,0xadf3,0xae43,0x0000,0xd0f8,
-/* 0x5500 */
-0x0000,0xadf1,0x0000,0xd146,0xd0f9,0xd0fd,0xadf6,0xae42,
-0xd0fa,0xadfc,0xd140,0xd147,0xd4a1,0x0000,0xd145,0xae44,
-0xadf0,0xd0fc,0xd0f3,0x0000,0xadf8,0x0000,0x0000,0xd0f2,
-0x0000,0x0000,0xd0f7,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd0f0,0xae41,
-0x0000,0x0000,0xd477,0x0000,0xb0e4,0xd4a7,0xb0e2,0xb0df,
-0xd47c,0xb0db,0xd4a2,0xb0e6,0xd476,0xd47b,0xd47a,0xadf2,
-0xb0e1,0xd4a5,0x0000,0xd4a8,0xd473,0x0000,0xb3e8,0x0000,
-0xd4a9,0xb0e7,0x0000,0xb0d9,0xb0d6,0xd47e,0xb0d3,0x0000,
-0xd4a6,0x0000,0xb0da,0xd4aa,0x0000,0xd474,0xd4a4,0xb0dd,
-0xd475,0xd478,0xd47d,0x0000,0x0000,0xb0de,0xb0dc,0xb0e8,
-0x0000,0x0000,0x0000,0x0000,0xb0e3,0x0000,0xb0d7,0xb1d2,
-0x0000,0xb0d8,0xd479,0xb0e5,0xb0e0,0xd4a3,0xb0d5,0x0000,
-0x0000,0x0000,0xb0d4,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd471,0xd472,0xd86a,
-0x0000,0x0000,0x0000,0xb3d7,0xb3da,0xd875,0xb3ee,0xd878,
-0xb3d8,0xd871,0xb3de,0xb3e4,0xb5bd,0x0000,0x0000,0xb3e2,
-0xd86e,0xb3ef,0xb3db,0xb3e3,0xd876,0xdcd7,0xd87b,0xd86f,
-0x0000,0xd866,0xd873,0xd86d,0xb3e1,0xd879,0x0000,0x0000,
-0xb3dd,0xb3f1,0xb3ea,0x0000,0xb3df,0xb3dc,0x0000,0xb3e7,
-0x0000,0xd87a,0xd86c,0xd872,0xd874,0xd868,0xd877,0xb3d9,
-0xd867,0x0000,0xb3e0,0xb3f0,0xb3ec,0xd869,0xb3e6,0x0000,
-0x0000,0xb3ed,0xb3e9,0xb3e5,0x0000,0xd870,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xb3eb,0x0000,0x0000,0x0000,0xdcd5,
-0xdcd1,0x0000,0xdce0,0xdcca,0xdcd3,0xb6e5,0xb6e6,0xb6de,
-0xdcdc,0xb6e8,0xdccf,0xdcce,0xdccc,0xdcde,0xb6dc,0xdcd8,
-0xdccd,0xb6df,0xdcd6,0xb6da,0xdcd2,0xdcd9,0xdcdb,0x0000,
-0x0000,0xdcdf,0xb6e3,0xdccb,0xb6dd,0xdcd0,0x0000,0xb6d8,
-0x0000,0xb6e4,0xdcda,0xb6e0,0xb6e1,0xb6e7,0xb6db,0xa25f,
-0xb6d9,0xdcd4,0x0000,0x0000,0x0000,0x0000,0x0000,0xb6e2,
-0x0000,0x0000,0xdcdd,0x0000,0x0000,0x0000,0xb9cd,0xb9c8,
-0x0000,0xe155,0xe151,0x0000,0xe14b,0xb9c2,0xb9be,0xe154,
-0xb9bf,0xe14e,0xe150,0x0000,0xe153,0x0000,0xb9c4,0x0000,
-0xb9cb,0xb9c5,0x0000,0x0000,0xe149,0xb9c6,0xb9c7,0xe14c,
-0xb9cc,0x0000,0xe14a,0xe14f,0xb9c3,0xe148,0xb9c9,0xb9c1,
-0x0000,0x0000,0x0000,0xb9c0,0xe14d,0xe152,0x0000,0xb9ca,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe147,
-0x0000,0xbc4d,0xe547,0x0000,0xe544,0x0000,0xbc47,0xbc53,
-0xbc54,0x0000,0xbc4a,0xe542,0xbc4c,0xe4f9,0xbc52,0x0000,
-0xe546,0xbc49,0xe548,0xbc48,0x0000,0xe543,0xe545,0xbc4b,
-0xe541,0xe4fa,0xe4f7,0x0000,0x0000,0xd86b,0xe4fd,0x0000,
-0xe4f6,0xe4fc,0xe4fb,0x0000,0xe4f8,0x0000,0xbc4f,0x0000,
-0x0000,0x0000,0x0000,0xbc4e,0x0000,0x0000,0x0000,0xbc50,
-0xe4fe,0xbeb2,0xe540,0x0000,0x0000,0x0000,0xe945,0x0000,
-0xe8fd,0x0000,0xbebe,0xe942,0xbeb6,0xbeba,0xe941,0x0000,
-0xbeb9,0xbeb5,0xbeb8,0xbeb3,0xbebd,0xe943,0xe8fe,0xbebc,
-0xe8fc,0xbebb,0xe944,0xe940,0xbc51,0x0000,0xbebf,0xe946,
-0xbeb7,0xbeb4,0x0000,0x0000,0x0000,0x0000,0xecc6,0xecc8,
-0xc07b,0xecc9,0xecc7,0xecc5,0xecc4,0xc07d,0xecc3,0xc07e,
-0x0000,0x0000,0x0000,0x0000,0xecc1,0xecc2,0xc07a,0xc0a1,
-0xc07c,0x0000,0x0000,0xecc0,0x0000,0xc250,0x0000,0xefbc,
-0xefba,0xefbf,0xefbd,0x0000,0xefbb,0xefbe,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xc360,0xf1f2,0xf1f3,
-0xc456,0x0000,0xf1f4,0xf1f0,0xf1f5,0xf1f1,0xc251,0x0000,
-0x0000,0x0000,0xf3fe,0xf441,0xc459,0xf440,0xc458,0xc457,
-0x0000,0x0000,0x0000,0x0000,0xc45a,0xf5c5,0xf5c6,0x0000,
-0xc4da,0xc4d9,0xc4db,0xf5c4,0x0000,0xf6d8,0xf6d7,0x0000,
-0xc56d,0xc56f,0xc56e,0xf6d9,0xc5c8,0xf8a6,0x0000,0x0000,
-0x0000,0xc5f1,0x0000,0xf8a5,0xf8ee,0x0000,0x0000,0xc949,
-0x0000,0x0000,0xa57d,0xa57c,0x0000,0xa65f,0xa65e,0xc9c7,
-0xa65d,0xc9c6,0x0000,0x0000,0xa779,0xcaa9,0x0000,0xcaa8,
-0x0000,0x0000,0xa777,0xa77a,0x0000,0x0000,0xcaa7,0x0000,
-0xa778,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcbf0,
-0x0000,0xcbf1,0xa954,0x0000,0x0000,0x0000,0x0000,0xabaa,
-/* 0x5700 */
-0x0000,0xd148,0xd149,0xae45,0xae46,0x0000,0x0000,0xd4ac,
-0xb0e9,0xb0eb,0xd4ab,0xb0ea,0xd87c,0xb3f2,0x0000,0x0000,
-0x0000,0x0000,0xb6e9,0xb6ea,0xdce1,0x0000,0xb9cf,0x0000,
-0xb9ce,0x0000,0xe549,0xe948,0xe947,0x0000,0xf96b,0xa467,
-0xc959,0x0000,0xc96e,0xc96f,0x0000,0x0000,0x0000,0x0000,
-0xa662,0xa666,0xc9c9,0x0000,0xa664,0xa663,0xc9c8,0xa665,
-0xa661,0x0000,0x0000,0xa660,0xc9ca,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa7a6,0x0000,0x0000,0xa7a3,0x0000,
-0xa77d,0xcaaa,0x0000,0x0000,0x0000,0xcaab,0x0000,0xa7a1,
-0x0000,0xcaad,0xa77b,0xcaae,0xcaac,0xa77e,0xa7a2,0xa7a5,
-0xa7a4,0xa77c,0xcaaf,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xa959,0xcbfe,0x0000,0xa95b,0x0000,0xa95a,0x0000,
-0xcc40,0xa958,0xa957,0xcbf5,0x0000,0xcbf4,0x0000,0xcbf2,
-0xcbf7,0xcbf6,0xcbf3,0xcbfc,0xcbfd,0xcbfa,0xcbf8,0xa956,
-0x0000,0x0000,0x0000,0xcbfb,0xa95c,0xcc41,0x0000,0x0000,
-0xcbf9,0x0000,0xabab,0xa955,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xabac,0xce54,0x0000,0x0000,0xce5a,
-0x0000,0x0000,0x0000,0xabb2,0xce58,0xce5e,0x0000,0xce55,
-0xce59,0xce5b,0xce5d,0xce57,0x0000,0xce56,0xce51,0xce52,
-0xabad,0x0000,0xabaf,0xabae,0xce53,0xce5c,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xabb1,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xce50,0xd153,0x0000,
-0xd152,0xd157,0xd14e,0x0000,0xd151,0xd150,0x0000,0xd154,
-0x0000,0xd158,0xae47,0xae4a,0x0000,0x0000,0xd14f,0xd155,
-0x0000,0x0000,0x0000,0xae49,0xd14a,0x0000,0xabb0,0xd4ba,
-0xd156,0x0000,0xd14d,0x0000,0xae48,0xd14c,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd4b1,0x0000,0x0000,0xb0ec,
-0xb0f0,0xd4c1,0xd4af,0xd4bd,0xb0f1,0xd4bf,0x0000,0xd4c5,
-0x0000,0xd4c9,0x0000,0x0000,0xd4c0,0xd4b4,0xd4bc,0x0000,
-0xd4ca,0xd4c8,0xd4be,0xd4b9,0xd4b2,0xd8a6,0xd4b0,0xb0f5,
-0xd4b7,0xb0f6,0xb0f2,0xd4ad,0xd4c3,0xd4b5,0x0000,0x0000,
-0xd4b3,0xd4c6,0xb0f3,0x0000,0xd4cc,0xb0ed,0xb0ef,0xd4bb,
-0xd4b6,0xae4b,0xb0ee,0xd4b8,0xd4c7,0xd4cb,0xd4c2,0x0000,
-0xd4c4,0x0000,0x0000,0x0000,0xd4ae,0x0000,0x0000,0x0000,
-0x0000,0xd8a1,0x0000,0xd8aa,0xd8a9,0xb3fa,0xd8a2,0x0000,
-0xb3fb,0xb3f9,0x0000,0xd8a4,0xb3f6,0xd8a8,0x0000,0xd8a3,
-0xd8a5,0xd87d,0xb3f4,0x0000,0xd8b2,0xd8b1,0xd8ae,0xb3f3,
-0xb3f7,0xb3f8,0xd14b,0xd8ab,0xb3f5,0xb0f4,0xd8ad,0xd87e,
-0xd8b0,0xd8af,0x0000,0xd8b3,0x0000,0xdcef,0x0000,0xd8ac,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd8a7,0xdce7,0xb6f4,0xb6f7,0xb6f2,0xdce6,0xdcea,0xdce5,
-0x0000,0xb6ec,0xb6f6,0xdce2,0xb6f0,0xdce9,0x0000,0xb6ee,
-0xb6ed,0xdcec,0xb6ef,0xdcee,0x0000,0xdceb,0xb6eb,0x0000,
-0x0000,0x0000,0xb6f5,0xdcf0,0xdce4,0xdced,0x0000,0x0000,
-0xdce3,0x0000,0x0000,0xb6f1,0x0000,0xb6f3,0x0000,0xdce8,
-0x0000,0xdcf1,0x0000,0x0000,0xe15d,0xb9d0,0xe163,0x0000,
-0x0000,0xb9d5,0xe15f,0xe166,0xe157,0xb9d7,0xb9d1,0xe15c,
-0xbc55,0xe15b,0xe164,0xb9d2,0x0000,0xb9d6,0xe15a,0xe160,
-0xe165,0xe156,0xb9d4,0xe15e,0x0000,0x0000,0xe162,0xe168,
-0xe158,0xe161,0x0000,0xb9d3,0xe167,0x0000,0x0000,0x0000,
-0xe159,0x0000,0x0000,0x0000,0xbc59,0xe54b,0xbc57,0xbc56,
-0xe54d,0xe552,0x0000,0xe54e,0x0000,0xe551,0xbc5c,0x0000,
-0xbea5,0xbc5b,0x0000,0xe54a,0xe550,0x0000,0xbc5a,0xe54f,
-0x0000,0xe54c,0x0000,0xbc58,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe94d,0xf9d9,0xe94f,0xe94a,0xbec1,0xe94c,
-0x0000,0xbec0,0xe94e,0x0000,0x0000,0xbec3,0xe950,0xbec2,
-0xe949,0xe94b,0x0000,0x0000,0x0000,0x0000,0xc0a5,0xeccc,
-0x0000,0xc0a4,0xeccd,0xc0a3,0xeccb,0xc0a2,0xecca,0x0000,
-0xc253,0xc252,0xf1f6,0xf1f8,0x0000,0xf1f7,0xc361,0xc362,
-0x0000,0x0000,0xc363,0xf442,0xc45b,0x0000,0x0000,0xf7d3,
-0xf7d2,0xc5f2,0x0000,0xa468,0xa4d0,0x0000,0x0000,0xa7a7,
-0x0000,0x0000,0x0000,0x0000,0xce5f,0x0000,0x0000,0x0000,
-0x0000,0xb3fc,0xb3fd,0x0000,0xdcf2,0xb9d8,0xe169,0xe553,
-/* 0x5900 */
-0x0000,0x0000,0x0000,0xc95a,0x0000,0x0000,0xcab0,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xcc42,0xce60,0xd159,0xae4c,
-0x0000,0x0000,0xf1f9,0x0000,0xc4dc,0xa469,0xa57e,0xc970,
-0x0000,0xa667,0xa668,0x0000,0xa95d,0x0000,0x0000,0x0000,
-0xb0f7,0x0000,0xb9da,0x0000,0xb9db,0xb9d9,0x0000,0xa46a,
-0x0000,0xa4d1,0xa4d3,0xa4d2,0xc95b,0xa4d4,0xa5a1,0xc971,
-0x0000,0xa5a2,0x0000,0x0000,0x0000,0x0000,0x0000,0xa669,
-0xa66a,0x0000,0x0000,0x0000,0xc9cb,0x0000,0xa7a8,0x0000,
-0xcab1,0x0000,0x0000,0x0000,0xa961,0xcc43,0x0000,0xa95f,
-0xa960,0xa95e,0xd15a,0x0000,0x0000,0x0000,0xabb6,0xabb5,
-0xabb7,0xabb4,0x0000,0xce61,0xa962,0xabb3,0x0000,0xae4d,
-0xae4e,0x0000,0xae4f,0x0000,0xd4cd,0x0000,0x0000,0x0000,
-0xb3fe,0xd8b4,0xb0f8,0x0000,0x0000,0x0000,0x0000,0xb6f8,
-0x0000,0xb9dd,0xb9dc,0xe16a,0x0000,0xbc5d,0xbec4,0x0000,
-0xefc0,0xf6da,0xf7d4,0xa46b,0xa5a3,0x0000,0xa5a4,0xc9d1,
-0xa66c,0xa66f,0x0000,0xc9cf,0xc9cd,0xa66e,0xc9d0,0xc9d2,
-0xc9cc,0xa671,0xa670,0xa66d,0xa66b,0xc9ce,0x0000,0x0000,
-0x0000,0x0000,0xa7b3,0x0000,0x0000,0xa7b0,0xcab6,0xcab9,
-0xcab8,0x0000,0xa7aa,0xa7b2,0x0000,0x0000,0xa7af,0xcab5,
-0xcab3,0xa7ae,0x0000,0x0000,0x0000,0xa7a9,0xa7ac,0x0000,
-0xcab4,0xcabb,0xcab7,0xa7ad,0xa7b1,0xa7b4,0xcab2,0xcaba,
-0xa7ab,0x0000,0x0000,0x0000,0x0000,0x0000,0xa967,0xa96f,
-0x0000,0xcc4f,0xcc48,0xa970,0xcc53,0xcc44,0xcc4b,0x0000,
-0x0000,0xa966,0xcc45,0xa964,0xcc4c,0xcc50,0xa963,0x0000,
-0xcc51,0xcc4a,0x0000,0xcc4d,0x0000,0xa972,0xa969,0xcc54,
-0xcc52,0x0000,0xa96e,0xa96c,0xcc49,0xa96b,0xcc47,0xcc46,
-0xa96a,0xa968,0xa971,0xa96d,0xa965,0x0000,0xcc4e,0x0000,
-0xabb9,0x0000,0xabc0,0xce6f,0xabb8,0xce67,0xce63,0x0000,
-0xce73,0xce62,0x0000,0xabbb,0xce6c,0xabbe,0xabc1,0x0000,
-0xabbc,0xce70,0xabbf,0x0000,0xae56,0xce76,0xce64,0x0000,
-0x0000,0xce66,0xce6d,0xce71,0xce75,0xce72,0xce6b,0xce6e,
-0x0000,0x0000,0xce68,0xabc3,0xce6a,0xce69,0xce74,0xabba,
-0xce65,0xabc2,0x0000,0xabbd,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xae5c,0xd162,0x0000,0xae5b,0x0000,0x0000,0xd160,
-0x0000,0xae50,0x0000,0xae55,0x0000,0xd15f,0xd15c,0xd161,
-0xae51,0xd15b,0x0000,0xae54,0xae52,0x0000,0xd163,0xae53,
-0xae57,0x0000,0x0000,0xae58,0x0000,0xae5a,0x0000,0x0000,
-0x0000,0xae59,0x0000,0x0000,0x0000,0xd15d,0xd15e,0x0000,
-0x0000,0x0000,0x0000,0xd164,0x0000,0xd4d4,0xb0f9,0xd8c2,
-0xd4d3,0xd4e6,0x0000,0x0000,0xb140,0x0000,0xd4e4,0x0000,
-0xb0fe,0xb0fa,0xd4ed,0xd4dd,0xd4e0,0x0000,0xb143,0xd4ea,
-0xd4e2,0xb0fb,0xb144,0x0000,0xd4e7,0xd4e5,0x0000,0x0000,
-0xd4d6,0xd4eb,0xd4df,0xd4da,0x0000,0xd4d0,0xd4ec,0xd4dc,
-0xd4cf,0x0000,0xb142,0xd4e1,0xd4ee,0xd4de,0xd4d2,0xd4d7,
-0xd4ce,0x0000,0xb141,0x0000,0xd4db,0xd4d8,0xb0fc,0xd4d1,
-0x0000,0xd4e9,0xb0fd,0x0000,0xd4d9,0xd4d5,0x0000,0x0000,
-0xd4e8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb440,
-0xd8bb,0x0000,0xd8b8,0xd8c9,0xd8bd,0xd8ca,0x0000,0xb442,
-0x0000,0x0000,0x0000,0xd8c6,0xd8c3,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd8c4,0xd8c7,0xd8cb,0x0000,0xd4e3,0xd8cd,
-0xdd47,0x0000,0xb443,0xd8ce,0xd8b6,0xd8c0,0x0000,0xd8c5,
-0x0000,0x0000,0xb441,0xb444,0xd8cc,0xd8cf,0xd8ba,0xd8b7,
-0x0000,0x0000,0xd8b9,0x0000,0x0000,0xd8be,0xd8bc,0xb445,
-0x0000,0xd8c8,0x0000,0x0000,0xd8bf,0x0000,0xd8c1,0xd8b5,
-0xdcfa,0xdcf8,0xb742,0xb740,0xdd43,0xdcf9,0xdd44,0xdd40,
-0xdcf7,0xdd46,0xdcf6,0xdcfd,0xb6fe,0xb6fd,0xb6fc,0xdcfb,
-0xdd41,0xb6f9,0xb741,0x0000,0xdcf4,0x0000,0xdcfe,0xdcf3,
-0xdcfc,0xb6fa,0xdd42,0xdcf5,0xb6fb,0xdd45,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe16e,0xb9e2,0xb9e1,
-0xb9e3,0xe17a,0xe170,0xe176,0xe16b,0xe179,0xe178,0xe17c,
-0xe175,0xb9de,0xe174,0xb9e4,0x0000,0xe16d,0xb9df,0x0000,
-0xe17b,0xb9e0,0xe16f,0xe172,0xe177,0xe171,0xe16c,0x0000,
-0x0000,0x0000,0x0000,0xe173,0xe555,0xbc61,0xe558,0xe557,
-0xe55a,0xe55c,0xf9dc,0xbc5f,0x0000,0xe556,0x0000,0xe554,
-/* 0x5b00 */
-0x0000,0xe55d,0xe55b,0xe559,0x0000,0xe55f,0x0000,0xe55e,
-0xbc63,0xbc5e,0x0000,0xbc60,0xbc62,0x0000,0x0000,0xe560,
-0xe957,0x0000,0x0000,0xe956,0xe955,0x0000,0xe958,0xe951,
-0x0000,0xe952,0xe95a,0xe953,0x0000,0xbec5,0xe95c,0x0000,
-0xe95b,0xe954,0x0000,0xecd1,0xc0a8,0xeccf,0xecd4,0xecd3,
-0xe959,0x0000,0xc0a7,0x0000,0xecd2,0xecce,0xecd6,0xecd5,
-0xc0a6,0x0000,0xecd0,0x0000,0xbec6,0x0000,0x0000,0x0000,
-0xc254,0x0000,0x0000,0x0000,0xefc1,0xf1fa,0xf1fb,0xf1fc,
-0xc45c,0x0000,0x0000,0xc45d,0x0000,0xf443,0x0000,0xf5c8,
-0xf5c7,0x0000,0x0000,0xf6db,0xf6dc,0xf7d5,0xf8a7,0x0000,
-0xa46c,0xa46d,0x0000,0xa46e,0xa4d5,0xa5a5,0xc9d3,0xa672,
-0xa673,0x0000,0xa7b7,0xa7b8,0xa7b6,0xa7b5,0x0000,0xa973,
-0x0000,0x0000,0xcc55,0xa975,0xa974,0xcc56,0x0000,0x0000,
-0x0000,0xabc4,0x0000,0xae5d,0xd165,0x0000,0xd4f0,0x0000,
-0xb145,0xb447,0xd4ef,0xb446,0x0000,0xb9e5,0x0000,0xe17d,
-0xbec7,0x0000,0xc0a9,0xecd7,0x0000,0xc45e,0x0000,0xc570,
-0x0000,0xc972,0x0000,0xa5a6,0xc973,0xa676,0x0000,0xa674,
-0xa675,0xa677,0x0000,0xa7ba,0xa7b9,0x0000,0xcabc,0xa7bb,
-0x0000,0x0000,0xcabd,0xcc57,0x0000,0xcc58,0x0000,0xa976,
-0xa978,0xa97a,0xa977,0xa97b,0xa979,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xabc8,0xabc5,0xabc7,0xabc9,0xabc6,0xd166,
-0xce77,0x0000,0x0000,0x0000,0xd168,0xd167,0xae63,0x0000,
-0xae5f,0x0000,0x0000,0xae60,0xae62,0xae64,0xae61,0x0000,
-0xae66,0xae65,0x0000,0x0000,0x0000,0x0000,0x0000,0xb14a,
-0xd4f2,0xd4f1,0xb149,0x0000,0xb148,0xb147,0xb14b,0xb146,
-0x0000,0x0000,0xd8d5,0xd8d2,0xb449,0xd8d1,0xd8d6,0x0000,
-0xb44b,0xd8d4,0xb448,0xb44a,0xd8d3,0x0000,0xdd48,0x0000,
-0xdd49,0xdd4a,0x0000,0x0000,0x0000,0x0000,0xb9e6,0xb9ee,
-0xe17e,0xb9e8,0xb9ec,0xe1a1,0xb9ed,0xb9e9,0xb9ea,0xb9e7,
-0xb9eb,0xbc66,0xd8d0,0xbc67,0xbc65,0x0000,0xbc64,0xe95d,
-0xbec8,0xecd8,0xecd9,0x0000,0x0000,0xc364,0xc45f,0x0000,
-0xa46f,0x0000,0xa678,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x5c00 */
-0x0000,0xabca,0x0000,0xd169,0xae67,0x0000,0x0000,0xb14e,
-0xb14d,0xb14c,0xb44c,0xb44d,0xd8d7,0xb9ef,0xbec9,0xa470,
-0xc95c,0xa4d6,0xc974,0x0000,0x0000,0xc9d4,0xa679,0x0000,
-0x0000,0x0000,0xa97c,0x0000,0x0000,0x0000,0x0000,0xdd4b,
-0x0000,0x0000,0xa471,0x0000,0xa4d7,0xc9d5,0x0000,0x0000,
-0xcabe,0x0000,0xcabf,0x0000,0xa7bc,0x0000,0x0000,0x0000,
-0xd8d8,0xb44e,0x0000,0xdd4c,0x0000,0x0000,0x0000,0xc0aa,
-0xa472,0xa4a8,0xa4d8,0xc975,0xa5a7,0x0000,0xa7c0,0xa7bf,
-0xa7bd,0xa7be,0x0000,0x0000,0xcc59,0xa97e,0xa9a1,0xcc5a,
-0xa97d,0x0000,0x0000,0xabce,0xce78,0xabcd,0xabcb,0xabcc,
-0xae6a,0xae68,0x0000,0x0000,0xd16b,0xae69,0xd16a,0x0000,
-0xae5e,0xd4f3,0x0000,0x0000,0xb150,0xb151,0x0000,0x0000,
-0xb14f,0x0000,0xb9f0,0xe1a2,0xbc68,0xbc69,0x0000,0xe561,
-0xc0ab,0xefc2,0xefc3,0x0000,0xc4dd,0xf8a8,0xc94b,0xa4d9,
-0x0000,0xa473,0x0000,0xc977,0xc976,0x0000,0x0000,0x0000,
-0x0000,0xa67a,0xc9d7,0xc9d8,0xc9d6,0x0000,0xc9d9,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcac7,0x0000,
-0xcac2,0xcac4,0xcac6,0xcac3,0xa7c4,0xcac0,0x0000,0xcac1,
-0xa7c1,0xa7c2,0xcac5,0xcac8,0xa7c3,0xcac9,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xcc68,0x0000,0xcc62,
-0xcc5d,0xa9a3,0xcc65,0xcc63,0xcc5c,0xcc69,0xcc6c,0xcc67,
-0xcc60,0xa9a5,0xcc66,0xa9a6,0xcc61,0xcc64,0xcc5b,0xcc5f,
-0xcc6b,0xa9a7,0x0000,0xa9a8,0x0000,0xcc5e,0xcc6a,0xa9a2,
-0xa9a4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xceab,0xcea4,
-0xceaa,0xcea3,0xcea5,0xce7d,0xce7b,0x0000,0xceac,0xcea9,
-0xce79,0x0000,0xabd0,0xcea7,0xcea8,0x0000,0xcea6,0xce7c,
-0xce7a,0xabcf,0xcea2,0xce7e,0x0000,0x0000,0xcea1,0xcead,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xae6f,0x0000,0xae6e,0x0000,0xd16c,0xae6b,0xd16e,0x0000,
-0xae70,0xd16f,0x0000,0x0000,0xae73,0x0000,0xae71,0xd170,
-0xceae,0xd172,0x0000,0xae6d,0x0000,0xae6c,0x0000,0xd16d,
-0xd171,0xae72,0x0000,0x0000,0x0000,0x0000,0xb153,0xb152,
-0x0000,0x0000,0x0000,0xd4f5,0xd4f9,0xd4fb,0xb154,0xd4fe,
-0x0000,0xb158,0xd541,0x0000,0xb15a,0x0000,0xb156,0xb15e,
-0x0000,0xb15b,0xd4f7,0xb155,0x0000,0xd4f6,0xd4f4,0xd543,
-0xd4f8,0x0000,0xb157,0xd542,0xb15c,0xd4fd,0xd4fc,0xb15d,
-0xd4fa,0xb159,0x0000,0x0000,0x0000,0x0000,0xd544,0x0000,
-0xd540,0xd8e7,0xd8ee,0xd8e3,0xb451,0xd8df,0xd8ef,0xd8d9,
-0xd8ec,0xd8ea,0xd8e4,0x0000,0xd8ed,0xd8e6,0x0000,0xd8de,
-0xd8f0,0xd8dc,0xd8e9,0xd8da,0x0000,0xd8f1,0x0000,0xb452,
-0x0000,0xd8eb,0xdd4f,0xd8dd,0xb44f,0x0000,0xd8e1,0x0000,
-0xb450,0xd8e0,0xd8e5,0x0000,0x0000,0xd8e2,0x0000,0x0000,
-0x0000,0xd8e8,0x0000,0x0000,0x0000,0x0000,0xdd53,0x0000,
-0x0000,0x0000,0xdd56,0xdd4e,0x0000,0xdd50,0x0000,0xdd55,
-0xdd54,0xb743,0x0000,0xd8db,0xdd52,0x0000,0x0000,0xb744,
-0x0000,0xdd4d,0xdd51,0x0000,0x0000,0x0000,0x0000,0xe1a9,
-0x0000,0xe1b0,0xe1a7,0x0000,0xe1ae,0xe1a5,0xe1ad,0xe1b1,
-0xe1a4,0xe1a8,0xe1a3,0x0000,0xb9f1,0x0000,0xe1a6,0xb9f2,
-0xe1ac,0xe1ab,0xe1aa,0x0000,0x0000,0xe1af,0x0000,0x0000,
-0x0000,0x0000,0xe565,0xe567,0xbc6b,0xe568,0x0000,0xe563,
-0x0000,0xe562,0xe56c,0x0000,0xe56a,0xbc6a,0xe56d,0xe564,
-0xe569,0xe56b,0xe566,0x0000,0x0000,0x0000,0x0000,0xe961,
-0xe966,0xe960,0xe965,0x0000,0xe95e,0xe968,0xe964,0xe969,
-0xe963,0xe95f,0xe967,0x0000,0xe96a,0xe962,0x0000,0xecda,
-0xc0af,0x0000,0xc0ad,0x0000,0xc0ac,0xc0ae,0x0000,0x0000,
-0xefc4,0x0000,0xf172,0xf1fd,0x0000,0x0000,0xf444,0xf445,
-0x0000,0xc460,0x0000,0xf5c9,0x0000,0xc4de,0x0000,0xf5ca,
-0x0000,0xf6de,0xc572,0x0000,0xc571,0xf6dd,0xc5c9,0x0000,
-0xf7d6,0x0000,0x0000,0x0000,0x0000,0xa474,0xa67b,0xc9da,
-0xcaca,0xa8b5,0xb15f,0x0000,0x0000,0xa475,0xa5aa,0xa5a9,
-0xa5a8,0x0000,0x0000,0xa7c5,0x0000,0x0000,0xae74,0x0000,
-0xdd57,0xa476,0xa477,0xa478,0xa4da,0x0000,0x0000,0xabd1,
-0x0000,0xceaf,0x0000,0x0000,0x0000,0xb453,0xa479,0xc95d,
-/* 0x5e00 */
-0x0000,0x0000,0xa5ab,0xa5ac,0xc978,0x0000,0xa67c,0x0000,
-0x0000,0x0000,0xcacb,0x0000,0xa7c6,0x0000,0xcacc,0x0000,
-0x0000,0xa9ae,0x0000,0x0000,0xcc6e,0xa9ac,0xa9ab,0xcc6d,
-0xa9a9,0xcc6f,0xa9aa,0xa9ad,0x0000,0xabd2,0x0000,0xabd4,
-0xceb3,0xceb0,0xceb1,0xceb2,0xceb4,0xabd3,0x0000,0x0000,
-0xd174,0xd173,0x0000,0xae76,0x0000,0xae75,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xb162,0xd546,0x0000,0xb161,0xb163,
-0xb160,0x0000,0x0000,0x0000,0x0000,0xb455,0xd545,0x0000,
-0xb456,0xd8f3,0x0000,0xb457,0xd8f2,0xb454,0x0000,0x0000,
-0x0000,0x0000,0xdd5a,0xdd5c,0xb745,0xdd5b,0xdd59,0xdd58,
-0x0000,0x0000,0x0000,0xe1b4,0xb9f7,0xb9f5,0x0000,0xb9f6,
-0xe1b2,0xe1b3,0x0000,0xb9f3,0xe571,0xe56f,0x0000,0xbc6d,
-0xe570,0xbc6e,0xbc6c,0xb9f4,0x0000,0x0000,0xe96d,0xe96b,
-0xe96c,0xe56e,0xecdc,0xc0b0,0xecdb,0xefc5,0xefc6,0xe96e,
-0xf1fe,0x0000,0xa47a,0xa5ad,0xa67e,0xc9db,0xa67d,0x0000,
-0xa9af,0xb746,0x0000,0xa4db,0xa5ae,0xabd5,0xb458,0x0000,
-0xc979,0x0000,0xc97a,0x0000,0xc9dc,0x0000,0x0000,0xa7c8,
-0xcad0,0xcace,0xa7c9,0xcacd,0xcacf,0xcad1,0x0000,0xa7c7,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa9b3,0xa9b4,0xa9b1,
-0x0000,0x0000,0xa9b0,0xceb8,0xa9b2,0x0000,0x0000,0x0000,
-0xabd6,0x0000,0xceb7,0xceb9,0xceb6,0xceba,0xabd7,0xae79,
-0xd175,0x0000,0xd177,0xae77,0xd178,0xae78,0xd176,0x0000,
-0xceb5,0xd547,0xd54a,0xd54b,0xd548,0xb167,0xb166,0xb164,
-0xb165,0xd549,0x0000,0x0000,0x0000,0x0000,0xb168,0x0000,
-0x0000,0xb45a,0xb45b,0x0000,0xb45c,0xdd5d,0xdd5f,0xdd61,
-0xb748,0xb747,0xb459,0xdd60,0xdd5e,0x0000,0xe1b8,0x0000,
-0x0000,0xe1b6,0xe1bc,0xb9f8,0xe1bd,0xe1ba,0xb9f9,0xe1b7,
-0xe1b5,0xe1bb,0xbc70,0xe573,0xe1b9,0xbc72,0xe574,0xbc71,
-0xbc74,0xe575,0xbc6f,0xbc73,0x0000,0xe973,0xe971,0xe970,
-0xe972,0xe96f,0x0000,0x0000,0xc366,0x0000,0xf446,0xf447,
-0x0000,0xf5cb,0xf6df,0xc655,0x0000,0x0000,0xa9b5,0xa7ca,
-0x0000,0x0000,0xabd8,0x0000,0x0000,0x0000,0xa47b,0xa4dc,
-/* 0x5f00 */
-0x0000,0xa5af,0xc9dd,0x0000,0xa7cb,0xcad2,0x0000,0xcebb,
-0xabd9,0x0000,0xb9fa,0xa47c,0x0000,0x0000,0x0000,0xa6a1,
-0x0000,0x0000,0xb749,0xa47d,0xa4dd,0xa4de,0x0000,0xa5b1,
-0xa5b0,0x0000,0xc9de,0xa6a2,0x0000,0xcad3,0x0000,0xa7cc,
-0x0000,0x0000,0xcc71,0xcc72,0xcc73,0x0000,0xa9b6,0xa9b7,
-0xcc70,0xa9b8,0x0000,0x0000,0x0000,0xabda,0xcebc,0x0000,
-0xd17a,0xae7a,0x0000,0xd179,0x0000,0xb169,0xd54c,0xb16a,
-0xd54d,0x0000,0x0000,0x0000,0xb45d,0x0000,0x0000,0x0000,
-0xdd62,0x0000,0x0000,0xe1bf,0xe1be,0x0000,0xb9fb,0x0000,
-0xbc75,0xe576,0xbeca,0xe974,0xc0b1,0x0000,0xc573,0xf7d8,
-0x0000,0x0000,0x0000,0x0000,0xcc74,0x0000,0xcebd,0xb16b,
-0xd8f4,0xb74a,0x0000,0x0000,0x0000,0xc255,0x0000,0x0000,
-0x0000,0x0000,0xa7ce,0x0000,0xa7cd,0xabdb,0x0000,0xd17b,
-0x0000,0xb16d,0xb343,0xb16e,0xb16c,0xb45e,0x0000,0xe1c0,
-0xb9fc,0xbc76,0x0000,0xc94c,0xc9df,0x0000,0xcad5,0xa7cf,
-0xcad4,0xa7d0,0x0000,0x0000,0xa9bc,0xcc77,0xcc76,0xa9bb,
-0xa9b9,0xa9ba,0xcc75,0x0000,0x0000,0xabdd,0xcebe,0xabe0,
-0xabdc,0xabe2,0xabde,0xabdf,0xabe1,0x0000,0x0000,0x0000,
-0xae7d,0xae7c,0xae7b,0x0000,0x0000,0x0000,0xd54f,0xb16f,
-0xb172,0xb170,0x0000,0xd54e,0xb175,0x0000,0xb171,0xd550,
-0xb174,0xb173,0x0000,0x0000,0x0000,0xd8f6,0xd8f5,0x0000,
-0xb461,0xb45f,0xb460,0xd8f7,0xb74b,0xdd64,0xb74c,0xdd63,
-0x0000,0x0000,0xe577,0x0000,0x0000,0xbc78,0xe1c1,0xbc77,
-0x0000,0xb9fd,0x0000,0xecde,0xe975,0xc0b2,0xecdd,0xf240,
-0xf448,0xf449,0x0000,0xa4df,0x0000,0xa5b2,0x0000,0x0000,
-0x0000,0xc97b,0x0000,0x0000,0xa7d2,0xa7d4,0x0000,0xc9e2,
-0xcad8,0xcad7,0xcad6,0x0000,0xc9e1,0xc9e0,0xa6a4,0xa7d3,
-0xa7d1,0xa6a3,0x0000,0x0000,0x0000,0xa9bd,0xcc78,0x0000,
-0xa9be,0xcadd,0x0000,0xcadf,0xcade,0xcc79,0x0000,0x0000,
-0xcada,0x0000,0xa7d8,0xa7d6,0x0000,0xcad9,0xcadb,0xcae1,
-0x0000,0xa7d5,0x0000,0xcadc,0xcae5,0xa9c0,0x0000,0xcae2,
-0xa7d7,0x0000,0xcae0,0xcae3,0x0000,0xa9bf,0x0000,0xa9c1,
-0xcae4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xccaf,0xcca2,0xcc7e,0xccae,0xcca9,0xabe7,0xa9c2,
-0xccaa,0xccad,0xabe3,0xccac,0xa9c3,0xa9c8,0xa9c6,0xcca3,
-0x0000,0xcc7c,0xcca5,0xa9cd,0xccb0,0xabe4,0xcca6,0x0000,
-0xabe5,0xa9c9,0xcca8,0x0000,0xcecd,0xabe6,0xcc7b,0xa9ca,
-0xabe8,0xa9cb,0xa9c7,0xa9cc,0xcca7,0xcc7a,0xccab,0xa9c4,
-0x0000,0x0000,0xcc7d,0xcca4,0xcca1,0xa9c5,0x0000,0xcebf,
-0x0000,0xcec0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xceca,0xd1a1,0xcecb,0xabee,0xcece,0xcec4,0xabed,0xcec6,
-0x0000,0xcec7,0x0000,0x0000,0xcec9,0xabe9,0x0000,0x0000,
-0xaea3,0x0000,0xf9da,0xcec5,0xcec1,0xaea4,0x0000,0x0000,
-0xcecf,0xae7e,0xd17d,0xcec8,0x0000,0xd17c,0xcec3,0xcecc,
-0x0000,0x0000,0xabec,0xaea1,0xabf2,0xaea2,0xced0,0xd17e,
-0xabeb,0xaea6,0xabf1,0xabf0,0xabef,0xaea5,0xced1,0xaea7,
-0xabea,0x0000,0xcec2,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb176,
-0xd1a4,0xd1a6,0x0000,0xd1a8,0xaea8,0xaeae,0xd553,0xd1ac,
-0xd1a3,0xb178,0xd551,0x0000,0xaead,0xaeab,0xd1ae,0x0000,
-0xd552,0x0000,0xd1a5,0x0000,0xaeac,0xd1a9,0xaeaf,0xd1ab,
-0x0000,0x0000,0xaeaa,0xd1aa,0xd1ad,0xd1a7,0x0000,0xaea9,
-0xb179,0x0000,0xd1a2,0xb177,0x0000,0x0000,0x0000,0x0000,
-0xb17a,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd555,0xd55e,0xb464,0x0000,0xb17c,0xb1a3,0xb465,0xd560,
-0xb1aa,0xd8f9,0xd556,0xb1a2,0xb1a5,0xb17e,0xd554,0xd562,
-0xd565,0xd949,0x0000,0xd563,0xd8fd,0xb1a1,0xb1a8,0xb1ac,
-0xd55d,0xd8f8,0xd561,0xb17b,0xd8fa,0xd564,0xd8fc,0xd559,
-0x0000,0xb462,0x0000,0xd557,0xd558,0xb1a7,0x0000,0x0000,
-0xb1a6,0xd55b,0xb1ab,0xd55f,0xb1a4,0xd55c,0x0000,0xb1a9,
-0xb466,0xb463,0xd8fb,0x0000,0xd55a,0x0000,0xb17d,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xb46b,0xb46f,0xd940,0xb751,0xb46d,0xd944,0xb471,0xdd65,
-0xd946,0xb753,0xb469,0xb46c,0xd947,0x0000,0xd948,0xd94e,
-0xb473,0xb754,0x0000,0xd94a,0xd94f,0xd943,0xb75e,0x0000,
-0xb755,0xb472,0xd941,0xd950,0x0000,0xb75d,0xb470,0xb74e,
-0xd94d,0x0000,0xb474,0xd945,0xd8fe,0xb46a,0xd942,0x0000,
-0xd94b,0x0000,0xb74d,0xb752,0xb467,0xd94c,0x0000,0xb750,
-0x0000,0x0000,0x0000,0xb468,0x0000,0x0000,0x0000,0xb75c,
-0xe1c3,0xdd70,0x0000,0xdd68,0xe1c2,0x0000,0xdd6c,0xdd6e,
-0x0000,0x0000,0xdd6b,0x0000,0xb75b,0x0000,0xdd6a,0xb75f,
-0x0000,0x0000,0x0000,0xe1d2,0x0000,0x0000,0xb75a,0xba40,
-0xdd71,0xe1c4,0x0000,0x0000,0xb758,0xdd69,0xdd6d,0xb9fe,
-0xb74f,0xdd66,0xdd67,0xba41,0xb757,0xb759,0xb756,0xdd6f,
-0x0000,0x0000,0xe1c8,0xe1c9,0xe1ce,0xbc7d,0xe1d5,0x0000,
-0xba47,0x0000,0xba46,0xe1d0,0x0000,0xbc7c,0xe1c5,0xba45,
-0x0000,0xe1d4,0xba43,0xba44,0x0000,0xe1d1,0xe5aa,0xbc7a,
-0xb46e,0x0000,0xe1d3,0xbca3,0xe1cb,0x0000,0xbc7b,0x0000,
-0xbca2,0xe1c6,0xe1ca,0xe1c7,0xe1cd,0xba48,0xbc79,0xba42,
-0x0000,0xe57a,0xe1cf,0x0000,0xbca1,0x0000,0xbca4,0x0000,
-0xe1cc,0x0000,0xbc7e,0xe579,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xe57e,0xbece,0xe578,0xe9a3,0xe5a9,0xbca8,0x0000,
-0xbca6,0xbecc,0xe5a6,0xe5a2,0xbcac,0x0000,0xe978,0x0000,
-0x0000,0x0000,0xbcaa,0xe5a1,0x0000,0xe976,0x0000,0xe5a5,
-0x0000,0xe5a8,0xe57d,0x0000,0xbcab,0x0000,0x0000,0xbca5,
-0xe977,0xbecd,0xe5a7,0xbca7,0xbca9,0xe5a4,0xbcad,0xe5a3,
-0xe57c,0xe57b,0xbecb,0xe5ab,0xe97a,0xece0,0xbed0,0x0000,
-0xe9a2,0x0000,0xe97e,0x0000,0xece1,0x0000,0xbed1,0xe9a1,
-0x0000,0xe97c,0xc0b4,0xecdf,0x0000,0xe979,0xe97b,0xc0b5,
-0xbed3,0xc0b3,0xbed2,0xc0b7,0xe97d,0xbecf,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xefcf,0x0000,
-0xefc7,0x0000,0x0000,0x0000,0x0000,0x0000,0xece7,0xefc8,
-0xece3,0x0000,0x0000,0xc256,0xece5,0xece4,0xc0b6,0xece2,
-0xece6,0xefd0,0xefcc,0xefce,0x0000,0xefc9,0xefca,0x0000,
-0xefcd,0xefcb,0xc367,0x0000,0x0000,0xc36a,0xc369,0xc368,
-0xc461,0xf44a,0xc462,0xf241,0xc4df,0xf5cc,0xc4e0,0xc574,
-0xc5ca,0xf7d9,0x0000,0xf7da,0xf7db,0x0000,0x0000,0xf9ba,
-0xa4e0,0xc97c,0xa5b3,0x0000,0xa6a6,0xa6a7,0xa6a5,0x0000,
-0xa6a8,0xa7da,0xa7d9,0x0000,0xccb1,0xa9cf,0xa9ce,0x0000,
-0x0000,0xd1af,0xb1ad,0xb1ae,0x0000,0x0000,0x0000,0xb475,
-0xdd72,0xb760,0xb761,0xdd74,0xdd76,0xdd75,0x0000,0xe1d7,
-0x0000,0xe1d6,0xba49,0xe1d8,0x0000,0xe5ac,0xbcae,0x0000,
-0xbed4,0x0000,0xc0b8,0xc257,0xc0b9,0x0000,0xa4e1,0x0000,
-0x0000,0x0000,0xcae6,0x0000,0x0000,0xccb2,0xa9d1,0xa9d0,
-0xa9d2,0xabf3,0xced2,0xced3,0x0000,0x0000,0xd1b0,0xaeb0,
-0xb1af,0xb476,0xd951,0xa4e2,0x0000,0xa47e,0xa4e3,0x0000,
-0xc97d,0xa5b7,0xa5b6,0xa5b4,0xa5b5,0x0000,0x0000,0x0000,
-0xa6ab,0xc9e9,0xc9eb,0xa6aa,0xc9e3,0x0000,0xc9e4,0x0000,
-0xc9ea,0xc9e6,0xc9e8,0xa6a9,0xc9e5,0xc9ec,0xc9e7,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xa7e1,0xa7ea,0xa7e8,
-0xcaf0,0xcaed,0xcaf5,0xa7e6,0xcaf6,0x0000,0xa7df,0xcaf3,
-0x0000,0xa7e5,0xcaef,0xcaee,0xa7e3,0xcaf4,0xa7e4,0xa9d3,
-0xa7de,0xcaf1,0x0000,0xcae7,0xa7db,0x0000,0xa7ee,0xcaec,
-0xcaf2,0xa7e0,0xa7e2,0x0000,0xcae8,0x0000,0xcae9,0xcaea,
-0x0000,0xa7ed,0xa7e7,0xa7ec,0xcaeb,0xa7eb,0xa7dd,0xa7dc,
-0xa7e9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa9e1,0xccbe,0xccb7,0xa9dc,0xa9ef,0xccb3,0xccba,0xccbc,
-0xccbf,0xa9ea,0x0000,0xccbb,0xccb4,0xa9e8,0xccb8,0x0000,
-0xccc0,0xa9d9,0x0000,0xccbd,0xa9e3,0xa9e2,0xccb6,0xa9d7,
-0x0000,0x0000,0xa9d8,0x0000,0xa9d6,0x0000,0xa9ee,0xa9e6,
-0xa9e0,0xa9d4,0xccb9,0xa9df,0xa9d5,0xa9e7,0xa9f0,0xced4,
-0xa9e4,0xccb5,0xa9da,0xa9dd,0xa9de,0x0000,0xa9ec,0xa9ed,
-0xa9eb,0xa9e5,0xa9e9,0xa9db,0xabf4,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xceda,0xac41,0xabf8,0xabfa,0xac40,
-0xcee6,0xabfd,0xd1b1,0xaeb1,0xac43,0xced7,0xcedf,0xabfe,
-0xcede,0xcedb,0xcee3,0xcee5,0xabf7,0xabfb,0xac42,0xaeb3,
-0xcee0,0xabf9,0xac45,0xced9,0x0000,0x0000,0x0000,0xabfc,
-0xaeb2,0xabf6,0x0000,0xced6,0xcedd,0xced5,0xced8,0xcedc,
-0xd1b2,0xac44,0x0000,0xcee1,0xcee2,0xcee4,0xabf5,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xaec1,0xd1be,0xaebf,0xaec0,0xd1b4,0xd1c4,0x0000,0xaeb6,
-0x0000,0x0000,0xd566,0xd1c6,0xd1c0,0x0000,0xd1b7,0x0000,
-0xd1c9,0xd1ba,0xaebc,0xd57d,0xd1bd,0xaebe,0xaeb5,0x0000,
-0xd1cb,0xd1bf,0xaeb8,0xd1b8,0xd1b5,0xd1b6,0xaeb9,0xd1c5,
-0xd1cc,0xaebb,0xd1bc,0xd1bb,0xaec3,0xaec2,0xaeb4,0xaeba,
-0xaebd,0xd1c8,0x0000,0x0000,0xd1c2,0xaeb7,0xd1b3,0xd1ca,
-0xd1c1,0xd1c3,0xd1c7,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd567,0x0000,0xb1b7,
-0xb1cb,0xb1ca,0x0000,0xb1bf,0x0000,0xd579,0xd575,0xd572,
-0xd5a6,0xb1ba,0xb1b2,0x0000,0x0000,0xd577,0xb4a8,0xb1b6,
-0xd5a1,0x0000,0xb1cc,0xb1c9,0xd57b,0xd56a,0x0000,0x0000,
-0xb1c8,0xd5a3,0xd569,0xb1bd,0xb1c1,0xd5a2,0x0000,0xd573,
-0xb1c2,0xb1bc,0xd568,0x0000,0xb478,0xd5a5,0xd571,0xb1c7,
-0xd574,0xd5a4,0xb1c6,0x0000,0xd952,0x0000,0xb1b3,0xd56f,
-0xb1b8,0xb1c3,0x0000,0xb1be,0xd578,0xd56e,0xd56c,0xd57e,
-0xb1b0,0xb1c4,0xb1b4,0xb477,0xd57c,0xb1b5,0x0000,0xb1b1,
-0xb1c0,0xb1bb,0xb1b9,0xd570,0xb1c5,0xd56d,0xd57a,0xd576,
-0xd954,0xd953,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd56b,0xd964,0x0000,
-0xb47a,0x0000,0xd96a,0xd959,0xd967,0xdd77,0xb47d,0xd96b,
-0xd96e,0xb47c,0xd95c,0xd96d,0xd96c,0xb47e,0xd955,0xb479,
-0xb4a3,0x0000,0xb4a1,0xd969,0x0000,0xd95f,0xb4a5,0xd970,
-0xd968,0xd971,0xb4ad,0xb4ab,0xd966,0xd965,0x0000,0xd963,
-0xd95d,0xb4a4,0x0000,0xb4a2,0xd1b9,0xd956,0x0000,0xddb7,
-0xd957,0xb47b,0xb4aa,0xdd79,0x0000,0xb4a6,0xb4a7,0xd958,
-0xd96f,0xdd78,0xd960,0xd95b,0xb4a9,0xd961,0xd95e,0x0000,
-0x0000,0xb4ae,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x6400 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb770,0x0000,
-0x0000,0xdd7c,0xddb1,0xddb6,0xddaa,0xb76c,0xddbb,0xb769,
-0xdd7a,0x0000,0xdd7b,0xb762,0xb76b,0xdda4,0xb76e,0xb76f,
-0xdda5,0x0000,0xddb2,0xddb8,0xb76a,0x0000,0xb764,0xdda3,
-0xdd7d,0xddba,0xdda8,0xdda9,0xdd7e,0xddb4,0xddab,0xddb5,
-0xddad,0x0000,0xb765,0xe1d9,0xb768,0xb766,0xddb9,0xddb0,
-0xddac,0x0000,0x0000,0xdda1,0xba53,0xddaf,0xb76d,0xdda7,
-0x0000,0xdda6,0x0000,0x0000,0x0000,0xb767,0xb763,0xe1ee,
-0xddb3,0xddae,0x0000,0xdda2,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe1e9,0x0000,0xe1da,0xe1e5,0x0000,
-0xe1ec,0xba51,0xb4ac,0xe1ea,0xba4c,0x0000,0x0000,0x0000,
-0xba4b,0xe1f1,0x0000,0xe1db,0xe1e8,0xe1dc,0xe1e7,0xba4f,
-0xe1eb,0xd962,0x0000,0x0000,0x0000,0xe1f2,0xe1e3,0xba52,
-0xe5ba,0xbcaf,0x0000,0xe1f0,0xe1ef,0xba54,0xe5ad,0xbcb0,
-0xe5ae,0x0000,0xe1df,0xe1e0,0xe1dd,0xe1e2,0xe1de,0xe1f3,
-0xba4e,0xbcb1,0xba50,0xba55,0x0000,0xe1e1,0x0000,0xe1ed,
-0x0000,0x0000,0xe1e6,0x0000,0x0000,0xe5b1,0x0000,0xba4a,
-0xbcb4,0xe9aa,0xe5b6,0xe5b5,0xe5b7,0x0000,0x0000,0xe5b4,
-0xbcb5,0x0000,0xbcbb,0xbcb8,0x0000,0xbcb9,0xe5af,0xe5b2,
-0xe5bc,0xbcc1,0xbcbf,0x0000,0xe5b3,0xd95a,0xbcb2,0xe5b9,
-0xe5b0,0x0000,0xbcc2,0xe5b8,0xba4d,0xbcb7,0xe1e4,0x0000,
-0x0000,0xbcba,0x0000,0xbcbe,0xbcc0,0xbcbd,0xbcbc,0x0000,
-0xbcb6,0xe5bb,0xbcb3,0xbcc3,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xbed8,0xbed9,0xe9a9,0xbee2,0xbedf,
-0x0000,0xbed6,0xbedd,0xe9ab,0xbedb,0xbed5,0x0000,0xbedc,
-0x0000,0xe9a8,0xc0bb,0xbed7,0x0000,0xbede,0xc0ba,0xe9a7,
-0xe9a6,0x0000,0xbee0,0x0000,0xbee1,0x0000,0xe9a5,0xe9a4,
-0xc0bc,0xe9ae,0xbeda,0xe9ac,0x0000,0x0000,0x0000,0x0000,
-0xc0bd,0x0000,0xc0c2,0xecea,0xecec,0x0000,0xc0bf,0x0000,
-0xeced,0xece9,0x0000,0xeceb,0xc0c0,0xc0c3,0x0000,0xece8,
-0xc0be,0xc0c1,0xc259,0xe9ad,0xc258,0x0000,0x0000,0xc25e,
-0xefd4,0x0000,0xc25c,0xc25d,0xefd7,0xefd3,0xc25a,0xefd1,
-0xc36b,0xefd5,0x0000,0xefd6,0xefd2,0x0000,0xc25b,0xf242,
-0x0000,0xf245,0x0000,0x0000,0xf246,0xf244,0xf247,0xc36c,
-0xf243,0x0000,0x0000,0xf44e,0xc464,0xf44d,0xf44c,0xf44b,
-0xc463,0xc465,0x0000,0xf5cd,0xc4e2,0xc4e1,0x0000,0x0000,
-0xf6e1,0xf6e0,0xf6e3,0xc5cb,0xc575,0xf7dd,0xf6e2,0x0000,
-0x0000,0xf7dc,0xc5cd,0xc5cc,0xc5f3,0xf8a9,0xf8ef,0xa4e4,
-0x0000,0x0000,0xd972,0xe9af,0x0000,0x0000,0xa6ac,0xcaf7,
-0xa7f1,0xa7ef,0x0000,0xa7f0,0x0000,0xccc1,0xa9f1,0xac46,
-0x0000,0xcee7,0x0000,0xcee8,0x0000,0xac47,0xd1ce,0x0000,
-0xaec4,0xaec5,0xd1cd,0x0000,0x0000,0x0000,0x0000,0xb1d3,
-0x0000,0xb1cf,0x0000,0xd5a7,0xb1d6,0xb1d5,0xb1ce,0xb1d1,
-0xb1d4,0xb1d0,0x0000,0x0000,0xd976,0xb1cd,0xb4af,0x0000,
-0x0000,0x0000,0xb4b1,0xb4b2,0xd975,0xd978,0xb4b0,0xd973,
-0xd977,0x0000,0xd974,0x0000,0xb771,0x0000,0x0000,0xddbc,
-0x0000,0x0000,0xba56,0xe1f4,0xbee3,0xbcc4,0xe5bd,0xbcc5,
-0xbcc6,0xe5bf,0xe5be,0xe5c0,0xe9b1,0x0000,0x0000,0xe9b0,
-0xecef,0xecee,0xc0c4,0xc0c5,0xf248,0x0000,0x0000,0xa4e5,
-0x0000,0x0000,0x0000,0x0000,0xd979,0x0000,0x0000,0x0000,
-0xb4b4,0xb4b3,0xddbd,0x0000,0xefd8,0xc4e3,0xf7de,0xa4e6,
-0x0000,0xaec6,0x0000,0xb1d8,0xb1d7,0xd97a,0xd97b,0xb772,
-0xe1f5,0xba57,0xe9b2,0x0000,0xa4e7,0xa5b8,0x0000,0xa9f2,
-0xccc2,0x0000,0xcee9,0xac48,0xb1d9,0x0000,0xd97c,0xb4b5,
-0xb773,0x0000,0xe5c1,0xe5c2,0x0000,0x0000,0xecf0,0xc25f,
-0xf8f0,0xa4e8,0x0000,0xccc3,0xa9f3,0xac49,0x0000,0xceea,
-0x0000,0xaec7,0xd1d2,0xd1d0,0xd1d1,0xaec8,0xd1cf,0x0000,
-0x0000,0x0000,0x0000,0xb1db,0xb1dc,0xd5a8,0xb1dd,0xb1da,
-0xd97d,0x0000,0xd97e,0xddbe,0x0000,0x0000,0xba59,0xba58,
-0x0000,0x0000,0xecf1,0xefd9,0x0000,0xf24a,0xf249,0xf44f,
-0x0000,0xc95e,0xac4a,0x0000,0x0000,0xa4e9,0xa5b9,0x0000,
-0xa6ae,0xa6ad,0x0000,0x0000,0xa6af,0xa6b0,0xc9ee,0xc9ed,
-0xcaf8,0xa7f2,0xcafb,0xcafa,0xcaf9,0xcafc,0x0000,0x0000,
-0x0000,0x0000,0xa9f4,0xccc9,0xccc5,0xccce,0x0000,0x0000,
-0xa9fb,0x0000,0xa9f9,0xccca,0xccc6,0xcccd,0xa9f8,0xaa40,
-0xccc8,0xccc4,0xa9fe,0xcccb,0xa9f7,0xcccc,0xa9fa,0xa9fc,
-0xccd0,0xcccf,0xccc7,0xa9f6,0xa9f5,0xa9fd,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xceef,0xcef5,0x0000,0xac50,
-0xac4d,0xceec,0xcef1,0x0000,0xac53,0xac4b,0xcef0,0xac4e,
-0xac51,0x0000,0x0000,0xcef3,0x0000,0xac4c,0xcef8,0xac4f,
-0x0000,0xac52,0xceed,0xcef2,0xcef6,0xceee,0xceeb,0x0000,
-0x0000,0xcef7,0xcef4,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xaed0,0xaec9,0xaecc,0x0000,0xaecf,0x0000,0xd1d5,
-0x0000,0xaeca,0xd1d3,0x0000,0xaece,0x0000,0x0000,0xaecb,
-0x0000,0xd1d6,0xaecd,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd5ac,0xb1df,0xd5ab,0xd5ad,0xb1de,0xb1e3,0xd1d4,
-0x0000,0xd5aa,0xd5ae,0x0000,0xb1e0,0xd5a9,0xb1e2,0x0000,
-0xb1e1,0x0000,0xd9a7,0x0000,0xd9a2,0x0000,0xb4b6,0xb4ba,
-0xb4b7,0xd9a5,0xd9a8,0x0000,0xb4b8,0x0000,0xb4b9,0xb4be,
-0xddc7,0xd9a6,0xb4bc,0xd9a3,0xd9a1,0x0000,0xb4bd,0x0000,
-0xd9a4,0x0000,0x0000,0x0000,0xb779,0x0000,0xddbf,0xb776,
-0xb777,0xb775,0xddc4,0xddc3,0xddc0,0xb77b,0x0000,0x0000,
-0xddc2,0xb4bb,0x0000,0x0000,0xddc6,0xddc1,0xb778,0xb774,
-0xb77a,0xddc5,0x0000,0x0000,0x0000,0xba5c,0x0000,0xe1f8,
-0xe1f7,0xe1f6,0xba5a,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xba5b,0xe5c5,0xe5c8,0xbcc8,0x0000,0x0000,0xbcc7,0xe5c9,
-0xe5c4,0xbcca,0xe5c6,0x0000,0xbcc9,0xe5c3,0x0000,0xe5c7,
-0xbee9,0xbee6,0xe9bb,0xe9ba,0x0000,0xe9b9,0xe9b4,0x0000,
-0xe9b5,0x0000,0x0000,0x0000,0xbee7,0x0000,0xbee4,0xbee8,
-0xe9b3,0xbee5,0xe9b6,0xe9b7,0xe9bc,0x0000,0x0000,0xe9b8,
-0x0000,0x0000,0xecf2,0x0000,0x0000,0x0000,0xc0c7,0x0000,
-0xefdc,0xc0c6,0xefda,0xefdb,0xc260,0xc36e,0xf24b,0x0000,
-0xc36d,0x0000,0x0000,0xf451,0xf452,0x0000,0xc466,0x0000,
-0xf450,0xc4e4,0x0000,0xf7df,0xc5ce,0xf8aa,0xf8ab,0x0000,
-0xa4ea,0x0000,0xa6b1,0xa6b2,0xa7f3,0x0000,0xccd1,0xac54,
-0xaed1,0xb1e4,0x0000,0x0000,0xb0d2,0x0000,0xb4bf,0xb4c0,
-0xb3cc,0xd9a9,0x0000,0xb77c,0xe1fa,0xe1f9,0x0000,0x0000,
-0xa4eb,0xa6b3,0xccd2,0xaa42,0x0000,0xaa41,0x0000,0xcef9,
-0xcefa,0x0000,0xd1d7,0xd1d8,0xaed2,0xaed3,0x0000,0xaed4,
-0xd5af,0x0000,0x0000,0xb1e6,0x0000,0xb4c2,0x0000,0xb4c1,
-0xddc8,0xdf7a,0xe1fb,0xe9bd,0x0000,0x0000,0xc261,0xc467,
-0xa4ec,0x0000,0xa5bc,0xa5bd,0xa5bb,0xa5be,0xa5ba,0x0000,
-0x0000,0xa6b6,0x0000,0xc9f6,0xa6b5,0xa6b7,0x0000,0x0000,
-0xc9f1,0xc9f0,0xc9f3,0xc9f2,0xc9f5,0xa6b4,0xc9ef,0xc9f4,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xcafd,0xa7fd,0xcafe,
-0xcb43,0xa7fc,0x0000,0xcb47,0xcb42,0xcb45,0xa7f5,0xa7f6,
-0xa7f7,0xa7f8,0x0000,0xa840,0x0000,0xcb41,0xa7fa,0xa841,
-0x0000,0xcb40,0xcb46,0x0000,0xa7f9,0xcb44,0xa7fb,0xa7f4,
-0xa7fe,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xaa57,0x0000,0xccd4,0xaa43,0x0000,0xaa4d,
-0xaa4e,0xaa46,0xaa58,0xaa48,0xccdc,0xaa53,0xccd7,0xaa49,
-0xcce6,0xcce7,0xccdf,0xccd8,0xaa56,0xcce4,0xaa51,0xaa4f,
-0x0000,0xcce5,0x0000,0xcce3,0xccdb,0xccd3,0xccda,0xaa4a,
-0x0000,0xaa50,0x0000,0xaa44,0xccde,0xccdd,0xccd5,0x0000,
-0xaa52,0xcce1,0xccd6,0xaa55,0xcce8,0xaa45,0x0000,0xaa4c,
-0xccd9,0xcce2,0xaa54,0x0000,0xaa47,0xaa4b,0x0000,0xcce0,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcf5b,0xac5c,
-0xac69,0x0000,0xcf56,0xcf4c,0xac62,0xcf4a,0xac5b,0xcf45,
-0xac65,0xcf52,0xcefe,0xcf41,0x0000,0x0000,0x0000,0x0000,
-0xcf44,0xcefb,0xcf51,0xcf61,0xac60,0xcf46,0xcf58,0x0000,
-0xcefd,0xcf5f,0xcf60,0xcf63,0xcf5a,0xcf4b,0xcf53,0xac66,
-0xac59,0xac61,0xac6d,0xac56,0xac58,0x0000,0x0000,0x0000,
-0xcf43,0xac6a,0xac63,0xcf5d,0xcf40,0xac6c,0xac67,0xcf49,
-0x0000,0x0000,0xac6b,0xcf50,0xcf48,0xac64,0xcf5c,0xcf54,
-0x0000,0xac5e,0xcf62,0xcf47,0xac5a,0xcf59,0xcf4f,0xac5f,
-0xcf55,0xac57,0xcefc,0xac68,0xaee3,0xac5d,0xcf4e,0xcf4d,
-0xcf42,0x0000,0xcf5e,0x0000,0xcf57,0x0000,0x0000,0xac55,
-/* 0x6800 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd1ec,0xaeea,0xd1ed,0x0000,0xd1e1,0xaedf,
-0xaeeb,0x0000,0xd1da,0x0000,0xd1e3,0xd1eb,0x0000,0xd1d9,
-0xd1f4,0xaed5,0x0000,0x0000,0x0000,0xd1f3,0xd1ee,0x0000,
-0xd1ef,0xaedd,0xaee8,0xd1e5,0x0000,0xd1e6,0xd1f0,0xd1e7,
-0x0000,0xd1e2,0xd1dc,0xd1dd,0xd1ea,0xd1e4,0x0000,0x0000,
-0xaed6,0xaeda,0xd1f2,0xd1de,0xaee6,0xaee2,0x0000,0x0000,
-0xaee5,0xaeec,0xaedb,0xaee7,0xd1e9,0xaee9,0xaed8,0x0000,
-0xaed7,0xd1db,0x0000,0xd1df,0xaee0,0xd1f1,0xd1e8,0xd1e0,
-0xaee4,0xaee1,0x0000,0xaed9,0xaedc,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd5c4,0x0000,0xd5b4,0xd5b5,0xd5b9,
-0x0000,0xd5c8,0xd5c5,0x0000,0xd5be,0xd5bd,0xb1ed,0xd5c1,
-0xd5d0,0xd5b0,0x0000,0xd5d1,0xd5c3,0xd5d5,0xd5c9,0xb1ec,
-0xd5c7,0xb1e7,0xb1fc,0xb1f2,0x0000,0xb1f6,0xb1f5,0xd5b1,
-0x0000,0xd5ce,0xd5d4,0xd5cc,0xd5d3,0x0000,0x0000,0xd5c0,
-0xd5b2,0xd5d2,0xd5c2,0xb1ea,0xb1f7,0x0000,0xd5cb,0xb1f0,
-0x0000,0x0000,0x0000,0xd5ca,0xd5b3,0xb1f8,0x0000,0xb1fa,
-0xd5cd,0xb1fb,0xb1e9,0xd5ba,0xd5cf,0x0000,0x0000,0xb1ef,
-0xb1f9,0xd5bc,0xd5c6,0xd5b7,0xd5bb,0xb1f4,0xd5b6,0xb1e8,
-0xb1f1,0xb1ee,0xd5bf,0xaede,0xd9c0,0xb1eb,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xb1f3,0x0000,0xd9c3,0xd9d9,
-0xd9ce,0xb4d6,0x0000,0xb4d1,0xd9bd,0xb4d2,0xd9cd,0x0000,
-0xd9c6,0xd9d3,0xb4ce,0xd9ab,0xd9d5,0xb4c4,0xd9b3,0xb4c7,
-0xb4c6,0x0000,0xb4d7,0x0000,0xd9ad,0xd9cf,0xd9d0,0xb4c9,
-0xb4c5,0xd9bb,0x0000,0xb4d0,0xd9b6,0x0000,0xd9d1,0xb4cc,
-0xd9c9,0xd9d6,0xd9b0,0xd9b5,0xd9af,0x0000,0xb4cb,0xd9c2,
-0xddde,0xd9b1,0xb4cf,0xd9ba,0xd9d2,0xb4ca,0xd9b7,0xd9b4,
-0xd9c5,0xb4cd,0xb4c3,0xb4d9,0xd9c8,0xd9c7,0x0000,0x0000,
-/* 0x6900 */
-0x0000,0x0000,0x0000,0x0000,0xd9ac,0xb4c8,0xd9d4,0xd9bc,
-0xd9be,0x0000,0xd9cb,0xd9ca,0xd9aa,0xb4d3,0xb4d5,0xd9b2,
-0xd9b9,0xd9c1,0xb4d4,0xd9b8,0xd9c4,0xd9d7,0x0000,0xd9cc,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd9d8,0x0000,0x0000,
-0x0000,0x0000,0xd9ae,0x0000,0x0000,0x0000,0x0000,0xddf2,
-0xb7a6,0x0000,0xddf0,0xdddb,0xdde0,0xddd9,0x0000,0xddec,
-0xddcb,0xddd2,0x0000,0xddea,0xddf4,0xdddc,0x0000,0xddcf,
-0xdde2,0xdde7,0xddd3,0x0000,0xdde4,0xddd0,0x0000,0x0000,
-0xddd7,0xddd8,0xb7a8,0xddeb,0xdde9,0x0000,0xddcc,0xddee,
-0x0000,0xddef,0xddf1,0xb7ac,0xb7a4,0x0000,0xd5b8,0xddd4,
-0xdde6,0xddd5,0xb7a1,0xb7b1,0xdded,0xb7af,0xb7ab,0xddca,
-0xb7a3,0x0000,0xddcd,0xb7b0,0x0000,0xdddd,0xddc9,0x0000,
-0xb7a9,0xdde1,0xddd1,0xb7aa,0xddda,0xb77e,0xb4d8,0xdde3,
-0xd9bf,0xddce,0x0000,0x0000,0xdde8,0xb7a5,0xdde5,0xb7a2,
-0xdddf,0xb7ad,0xddd6,0xddf3,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xb7a7,0xdec6,0x0000,0x0000,0xb7ae,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe24a,0xe248,0x0000,
-0xe25e,0xe246,0x0000,0xe258,0xb77d,0xba5f,0xe242,0xe25d,
-0x0000,0xe247,0xe255,0xba64,0xba5d,0x0000,0xe25b,0x0000,
-0xe240,0xe25a,0x0000,0xba6f,0xe251,0xe261,0xba6d,0xe249,
-0xba5e,0xe24b,0xe259,0xba67,0xe244,0xba6b,0xba61,0xe24d,
-0xe243,0xe1fc,0x0000,0xe257,0xba68,0xe260,0xe1fd,0xba65,
-0x0000,0xe253,0x0000,0xba66,0xe245,0xe250,0xe24c,0xe24e,
-0x0000,0xba60,0xe25f,0xba6e,0xe24f,0x0000,0xe262,0x0000,
-0x0000,0xe1fe,0xe254,0xba63,0xba6c,0xba6a,0xe241,0xe256,
-0xba69,0x0000,0x0000,0xba62,0xe252,0x0000,0x0000,0x0000,
-0x0000,0xe25c,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe5d5,0x0000,0xe5d1,0xe5cd,0xe5e1,0xe5de,
-0xbccd,0x0000,0x0000,0xe5e5,0xe5d4,0xbcd8,0xe5db,0x0000,
-0x0000,0xe5d0,0xe5da,0xbcd5,0xe5ee,0x0000,0xe5eb,0xe5dd,
-0xe5ce,0x0000,0x0000,0xe5e2,0xe5e4,0xbcd1,0xe5d8,0xe5d3,
-0xe5ca,0xbcce,0xbcd6,0x0000,0xe5e7,0xbcd7,0xe5cb,0xe5ed,
-0xe5e0,0xe5e6,0xbcd4,0x0000,0x0000,0xe5e3,0x0000,0xe5ea,
-0x0000,0xbcd9,0x0000,0xbcd3,0xe5dc,0xe5cf,0xe5ef,0xe5cc,
-0xe5e8,0xbcd0,0x0000,0xe5d6,0x0000,0xe5d7,0xbccf,0xbccc,
-0xe5d2,0xbcd2,0x0000,0xbccb,0x0000,0xe5e9,0xe5ec,0xe5d9,
-0xe9ca,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe9c2,0x0000,0xe9be,0xbef6,0x0000,0x0000,
-0xbeeb,0xbef0,0xbeec,0xe9cc,0xe9d7,0xbeea,0xe9c4,0xe9cd,
-0xe5df,0xe9ce,0x0000,0x0000,0xbef1,0x0000,0xe9dd,0xbef5,
-0xbef8,0xe9c0,0x0000,0xbef4,0x0000,0xe9db,0xe9dc,0xe9d2,
-0xe9d1,0xe9c9,0x0000,0x0000,0xe9d3,0xe9da,0xe9d9,0x0000,
-0xbeef,0xbeed,0xe9cb,0xe9c8,0x0000,0xe9c5,0xe9d8,0xbef7,
-0xe9d6,0xbef3,0xbef2,0x0000,0xe9d0,0x0000,0xe9bf,0xe9c1,
-0xe9c3,0xe9d5,0xe9cf,0xbeee,0x0000,0xe9c6,0x0000,0xe9d4,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe9c7,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc0cf,0xed45,
-0xc0c8,0xecf5,0x0000,0xed41,0xc0ca,0xed48,0x0000,0xecfc,
-0x0000,0xecf7,0x0000,0x0000,0xed49,0xecf3,0xecfe,0x0000,
-0xc0d1,0xed44,0xed4a,0xecfd,0xc0c9,0xed40,0xecf4,0xc0d0,
-0x0000,0x0000,0xed47,0xecf9,0xc0cc,0x0000,0xecfb,0xecf8,
-0xc0d2,0xecfa,0xc0cb,0xc0ce,0xed43,0xecf6,0xed46,0x0000,
-0xed42,0x0000,0x0000,0x0000,0xc263,0xefe7,0xc268,0xc269,
-0x0000,0x0000,0x0000,0xc262,0xefe6,0x0000,0xefe3,0xefe4,
-0xc266,0xefde,0xefe2,0xc265,0x0000,0xefdf,0x0000,0x0000,
-0x0000,0x0000,0xc267,0xc264,0x0000,0xefdd,0xefe1,0xefe5,
-0x0000,0x0000,0x0000,0xf251,0xf24e,0xf257,0x0000,0xf256,
-0xf254,0xf24f,0x0000,0xc372,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf250,0xc371,0xc0cd,0xf253,0xc370,0xf258,0xf252,
-0xf24d,0xefe0,0x0000,0x0000,0x0000,0xc36f,0x0000,0xf24c,
-0xf456,0x0000,0xf455,0xf255,0xc468,0x0000,0xf459,0xf45a,
-0xf454,0xf458,0x0000,0xf453,0x0000,0x0000,0x0000,0x0000,
-0xf5d1,0xf457,0xc4e7,0xc4e5,0xf5cf,0x0000,0x0000,0x0000,
-0xf5d2,0x0000,0xf5ce,0xf5d0,0xc4e6,0x0000,0x0000,0x0000,
-0xf6e5,0xf6e6,0xc576,0xf6e4,0x0000,0x0000,0x0000,0xf7e2,
-0xc5cf,0xf7e0,0xf7e1,0xf8ac,0x0000,0x0000,0xc656,0xf8f3,
-0xf8f1,0xf8f2,0xf8f4,0x0000,0x0000,0x0000,0xf9bb,0x0000,
-0xa4ed,0xa6b8,0x0000,0xaa59,0x0000,0xcce9,0x0000,0x0000,
-0xcf64,0x0000,0x0000,0x0000,0xd1f5,0xd1f7,0x0000,0xd1f6,
-0x0000,0xd1f8,0xb1fd,0xd5d7,0xd1f9,0x0000,0xd5d6,0xd5d8,
-0xd5d9,0xd9da,0xb4db,0xd9db,0xd9dd,0xb4dc,0xb4da,0xd9dc,
-0x0000,0xddfa,0xddf8,0xddf7,0x0000,0xddf6,0xddf5,0xb7b2,
-0xddf9,0xba70,0xe263,0xe265,0xba71,0xe264,0xbcdb,0x0000,
-0xbcda,0xe5f0,0x0000,0x0000,0xe9df,0xe9de,0xe9e0,0x0000,
-0x0000,0xbef9,0x0000,0xed4b,0xc0d3,0x0000,0xefe8,0xc26a,
-0xf259,0xc577,0xa4ee,0xa5bf,0xa6b9,0xa842,0xaa5a,0xaa5b,
-0x0000,0x0000,0xac6e,0x0000,0x0000,0xd1fa,0x0000,0x0000,
-0x0000,0x0000,0xb7b3,0x0000,0x0000,0x0000,0xe6d1,0xbefa,
-0xc26b,0xa4ef,0x0000,0xa6ba,0x0000,0x0000,0xcceb,0xaa5c,
-0xccea,0x0000,0xcf65,0xac6f,0xcf66,0x0000,0xac70,0x0000,
-0xd1fc,0xaeee,0xaeed,0x0000,0xd5de,0xd5dc,0xd5dd,0xd5db,
-0x0000,0xd5da,0x0000,0x0000,0xd9de,0xd9e1,0xb4de,0xd9df,
-0xb4dd,0xd9e0,0x0000,0xddfb,0x0000,0x0000,0xe266,0xe267,
-0xe268,0x0000,0xe5f3,0xe5f2,0xbcdc,0xe5f1,0xe5f4,0xe9e1,
-0x0000,0x0000,0xe9e2,0xe9e3,0x0000,0xed4c,0xc0d4,0xc26c,
-0xf25a,0x0000,0xc4e8,0xc95f,0x0000,0xac71,0xcf67,0xaeef,
-0x0000,0x0000,0xb1fe,0x0000,0xb4df,0xd9e2,0x0000,0xb7b5,
-0xb7b4,0x0000,0x0000,0xe269,0xe26a,0xbcdd,0xbcde,0xe9e5,
-0xe9e4,0xefe9,0xf7e3,0xa4f0,0xc960,0xa5c0,0x0000,0xa843,
-0xcb48,0x0000,0xac72,0xb7b6,0xa4f1,0x0000,0xcf68,0xac73,
-0xcf69,0x0000,0xc0d5,0xa4f2,0x0000,0x0000,0xccec,0x0000,
-0xcf6a,0x0000,0xd242,0xd241,0xd1fe,0x0000,0xd1fd,0xd243,
-0xd240,0x0000,0x0000,0xb240,0xb241,0x0000,0x0000,0xb4e0,
-0xd9e3,0x0000,0xd9e4,0xd9e5,0x0000,0x0000,0x0000,0xde41,
-0xde42,0xde40,0x0000,0xddfd,0xddfe,0xb7b7,0xe26b,0xe5f7,
-0xe5f6,0xe5f5,0xe5f8,0xe9e7,0xe9e6,0xbefb,0xe9e8,0x0000,
-0xc0d6,0xed4d,0x0000,0xefea,0xf25b,0xf6e7,0x0000,0xa4f3,
-0xa5c2,0xa5c1,0x0000,0xaa5d,0xc961,0xc97e,0xa6bb,0x0000,
-0xc9f7,0xcb49,0xcb4a,0xaa5e,0x0000,0xcced,0x0000,0xac74,
-0xcf6b,0xcf6c,0x0000,0xaef0,0xaef4,0xd244,0xaef3,0xaef1,
-0xaef2,0x0000,0xd5df,0xb242,0xb4e3,0x0000,0xb4e1,0xb4e2,
-0xd9e6,0x0000,0x0000,0xba72,0xa4f4,0x0000,0xc9a1,0x0000,
-0xa5c3,0x0000,0x0000,0xc9a4,0x0000,0x0000,0xa5c6,0xc9a3,
-0xa5c5,0xa5c4,0xa844,0xc9a2,0x0000,0x0000,0xc9f8,0x0000,
-0x0000,0x0000,0xc9fc,0xc9fe,0xca40,0xa6c5,0xa6c6,0xc9fb,
-0xa6c1,0x0000,0xc9f9,0x0000,0xc9fd,0xa6c2,0x0000,0xa6bd,
-0x0000,0xa6be,0x0000,0xa6c4,0xc9fa,0xa6bc,0xa845,0xa6bf,
-0xa6c0,0xa6c3,0x0000,0x0000,0x0000,0xcb5b,0xcb59,0xcb4c,
-0xa851,0xcb53,0xa84c,0xcb4d,0x0000,0xcb55,0x0000,0xcb52,
-0xa84f,0xcb51,0xa856,0xcb5a,0xa858,0x0000,0xa85a,0x0000,
-0xcb4b,0x0000,0xa84d,0xcb5c,0x0000,0xa854,0xa857,0x0000,
-0xcd45,0xa847,0xa85e,0xa855,0xcb4e,0xa84a,0xa859,0xcb56,
-0xa848,0xa849,0xcd43,0xcb4f,0xa850,0xa85b,0xcb5d,0xcb50,
-0xa84e,0x0000,0xa853,0xccee,0xa85c,0xcb57,0xa852,0x0000,
-0xa85d,0xa846,0xcb54,0xa84b,0xcb58,0xcd44,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xaa6a,0xaa7a,0xccf5,0xaa71,0x0000,
-0xcd4b,0xaa62,0x0000,0xaa65,0xcd42,0x0000,0xccf3,0xccf7,
-0xaa6d,0xaa6f,0xccfa,0xaa76,0xaa68,0xaa66,0xaa67,0xaa75,
-0xcd47,0xaa70,0xccf9,0xccfb,0xaa6e,0xaa73,0xccfc,0xcd4a,
-0x0000,0xac75,0xaa79,0x0000,0xaa63,0xcd49,0x0000,0xcd4d,
-0xccf8,0xcd4f,0xcd40,0xaa6c,0xccf4,0xaa6b,0xaa7d,0xaa72,
-0x0000,0xccf2,0xcf75,0xaa78,0xaa7c,0xcd41,0xcd46,0x0000,
-0xaa7e,0xaa77,0xaa69,0xaa5f,0x0000,0xaa64,0x0000,0xccf6,
-0xaa60,0xcd4e,0x0000,0xccf0,0xccef,0xccfd,0xccf1,0xaa7b,
-0xaef5,0xaa74,0xccfe,0xaa61,0x0000,0xaca6,0x0000,0x0000,
-0x0000,0xcd4c,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xcf7c,0xcfa1,0x0000,0xcfa4,0xcf77,0x0000,0x0000,0xcfa7,
-0xcfaa,0xcfac,0xcf74,0xac76,0xac7b,0xd249,0xacad,0xcfa5,
-0xcfad,0xcf7b,0xcf73,0x0000,0x0000,0x0000,0xd264,0xac7e,
-0xcfa2,0xcf78,0xcf7a,0xaca5,0x0000,0xcf7d,0xac7d,0xcf70,
-0xcfa8,0x0000,0xcfab,0x0000,0x0000,0xac7a,0x0000,0xaca8,
-0xcf6d,0xacaa,0xac78,0xacae,0xcfa9,0xcf6f,0xacab,0xd25e,
-0xcd48,0xac7c,0xac77,0xcf76,0xcf6e,0xacac,0xaca4,0xcfa3,
-0xaca9,0xaca7,0xcf79,0xaca1,0xcf71,0xaca2,0xaca3,0xcf72,
-0xcfa6,0xac79,0xcf7e,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd24c,0xaefd,0xaf43,0x0000,0x0000,0x0000,0xd255,0xd25b,
-0xd257,0xd24a,0xd24d,0xd246,0xd247,0xaf4a,0xaefa,0xd256,
-0xd25f,0xaf45,0xaef6,0x0000,0xaf40,0xd24e,0xaf42,0xd24f,
-0xd259,0x0000,0x0000,0x0000,0xaf44,0xd268,0xd248,0xaefc,
-0xaefb,0xaf48,0xd245,0xd266,0xd25a,0xd267,0xd261,0xd253,
-0xd262,0x0000,0xd25c,0xd265,0xd263,0xaf49,0xd254,0xaef9,
-0xaef8,0xaf41,0xaf47,0xd260,0xaf46,0xd251,0xb243,0x0000,
-0xd269,0xd250,0xd24b,0xaefe,0xaf4b,0xaef7,0x0000,0xd258,
-0xd25d,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xb265,0xd5e1,0xd5e5,0x0000,0xb252,0xb250,
-0x0000,0x0000,0xb247,0xd5e3,0xd5e2,0xb25b,0x0000,0xd5e8,
-0xb255,0x0000,0xd5fa,0xd647,0xb244,0xd5f7,0xd5f0,0xb267,
-0xd5e0,0x0000,0xd5fc,0x0000,0xb264,0xb258,0xb263,0xb24e,
-0xd5ec,0xd5fe,0xd5f6,0xb24f,0xb249,0xd645,0x0000,0xd5fd,
-0xd640,0xb251,0xb259,0xd642,0xd5ea,0xd5fb,0xd5ef,0xd644,
-0xb25e,0xb246,0xb25c,0xd5f4,0xd5f2,0xd5f3,0xb253,0xd5ee,
-0xd5ed,0xb248,0xd5e7,0xd646,0xb24a,0xd5f1,0xb268,0x0000,
-0xb262,0xd5e6,0xb25f,0xb25d,0xb266,0xd5f8,0xb261,0xd252,
-0xd5f9,0xb260,0xd641,0xb245,0xd5f5,0xb257,0xd5e9,0xb256,
-0x0000,0xb254,0xb24c,0xb24b,0xd9e7,0xd643,0x0000,0x0000,
-0xd5eb,0x0000,0x0000,0xd9fc,0x0000,0xb24d,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xb541,0xb25a,0xb4ee,0xd9f6,0xb4fc,0x0000,0xd9ea,
-0xb4eb,0xb4e7,0xda49,0xb4ed,0xb4f1,0xb4ec,0xb4f5,0xda4d,
-0xda44,0x0000,0x0000,0xd9f1,0xb4fa,0xb4f4,0xd9fd,0xb4e4,
-0xda4a,0xda43,0xb4e8,0xd9f7,0xb4f7,0xda55,0xda56,0x0000,
-0xb4e5,0xda48,0xb4f9,0xd9fb,0xd9ed,0xd9ee,0xb4fd,0xd9f2,
-0xd9f9,0xd9f3,0x0000,0xb4fb,0xb544,0xd9ef,0xd9e8,0xd9e9,
-0x0000,0xd9eb,0xb4ea,0xd9f8,0x0000,0xb4f8,0xb542,0x0000,
-0x0000,0xd9fa,0xda53,0xda4b,0xb4e6,0xda51,0xb4f2,0x0000,
-0xb4f0,0x0000,0xda57,0xb4ef,0xda41,0xd9f4,0xd9fe,0xb547,
-0xda45,0xda42,0xd9f0,0xb543,0xda4f,0xda4c,0xda54,0xb4e9,
-0xda40,0xb546,0x0000,0xda47,0x0000,0x0000,0xb4f3,0xb4f6,
-0x0000,0xda46,0xb545,0xd9f5,0xd5e4,0x0000,0x0000,0xda50,
-0xda4e,0xda52,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd9ec,0xb540,0x0000,0x0000,0x0000,0xde61,0xde60,0xde46,
-0xb7bd,0x0000,0xde5f,0xde49,0xde4a,0x0000,0xb7c7,0xde68,
-0xb7c2,0xde5e,0x0000,0xde43,0xb7c8,0xb7be,0xde52,0xde48,
-0xde4b,0xde63,0xb7b8,0xde6a,0xde62,0xb7c1,0xde57,0xb7cc,
-0x0000,0x0000,0xb7cb,0xb7c5,0x0000,0x0000,0xde69,0xb7b9,
-0xde55,0xde4c,0xde59,0xde65,0xb7cd,0x0000,0xb7bb,0xde54,
-0x0000,0xde4d,0xb7c4,0x0000,0xb7c3,0xde50,0xde5a,0xde64,
-0xde47,0xde51,0xb7bc,0xde5b,0xb7c9,0xb7c0,0xde4e,0xb7bf,
-0xde45,0xde53,0xde67,0xb4fe,0xbab0,0xde56,0xe26c,0xde58,
-0xde66,0xb7c6,0xde4f,0xb7ba,0xb7ca,0xbcf0,0xde44,0x0000,
-0xde5d,0x0000,0x0000,0x0000,0xde5c,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe2aa,0xbaad,0xe27d,0xe2a4,0xbaa2,
-0x0000,0xe26e,0xbaaf,0x0000,0xba77,0xe26d,0xe2b0,0xbab1,
-0xe271,0xe2a3,0x0000,0xe273,0xe2b3,0xe2af,0xba75,0xbaa1,
-0xe653,0xbaae,0xba7d,0xe26f,0x0000,0xe2ae,0xbaa3,0xe2ab,
-0xe2b8,0xe275,0xe27e,0x0000,0x0000,0xe2b6,0xe2ac,0xba7c,
-0x0000,0x0000,0xe27c,0xba76,0xba74,0xbaa8,0x0000,0x0000,
-0xe27a,0xe277,0xe278,0x0000,0xe2b2,0x0000,0xe2b7,0xe2b5,
-0xba7a,0xe2b9,0xba7e,0xbaa7,0x0000,0xe270,0xe5fa,0xe279,
-0x0000,0xba78,0xbaac,0xbaa9,0xba7b,0xe2a5,0xe274,0xbaaa,
-0xe2a7,0xbaa4,0xbaa6,0xba73,0x0000,0xe2a9,0xe2a1,0xe272,
-0xbaa5,0xe2b1,0xe2b4,0xe27b,0xe2a8,0x0000,0xba79,0xbcdf,
-0xe2a6,0xe5f9,0x0000,0xe2ad,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe276,0xe644,
-0xe64e,0xbce2,0xe64d,0xe659,0xbce4,0xe64b,0x0000,0xe64f,
-0xbcef,0x0000,0xe646,0xbce7,0x0000,0xe652,0xe9f0,0xbcf3,
-0xbcf2,0xe654,0xe643,0xe65e,0xbced,0x0000,0xbce3,0xe657,
-0x0000,0xe65b,0xe660,0xe655,0xe649,0xbce6,0xbce9,0xbcf1,
-0xbcec,0x0000,0xe64c,0xe2a2,0x0000,0x0000,0xe648,0xe65f,
-0xbce8,0x0000,0xbceb,0xe661,0xbce0,0xe656,0xe5fb,0xe65c,
-0xc0df,0x0000,0xe64a,0x0000,0xbce1,0xe645,0xbce5,0xe5fc,
-0xbaab,0xe641,0x0000,0xe65a,0xe642,0xe640,0xbcea,0x0000,
-0xe658,0x0000,0xe5fe,0xe651,0xe650,0xe65d,0xe647,0xbcee,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe9f3,0x0000,
-0xbf49,0xbefe,0xea40,0xe9eb,0xbf41,0xe9f7,0xbf48,0xbf43,
-0xe9f5,0xed4f,0xe9fb,0xea42,0xe9fa,0xe9e9,0xe9f8,0xea44,
-0xea46,0xbefd,0xea45,0xbf44,0xbf4a,0x0000,0xbf47,0x0000,
-0xe9fe,0xbf46,0xe9f9,0x0000,0xe9ed,0xe9f2,0x0000,0xe9fd,
-0xbf45,0xbf42,0xbefc,0xbf40,0xe9f1,0x0000,0xe5fd,0xe9ec,
-0xe9ef,0xea41,0xe9f4,0xe9ea,0xed4e,0xea43,0xe9ee,0xe9fc,
-0x0000,0x0000,0x0000,0x0000,0xed51,0xc0e3,0x0000,0x0000,
-0xc0d7,0x0000,0x0000,0xc0db,0xed53,0xed59,0xed57,0xc0d9,
-0xc0da,0xc0e1,0xed5a,0xed52,0xc0dc,0x0000,0xed56,0xed55,
-0xed5b,0xc0e2,0x0000,0xc0dd,0xc0e0,0xed54,0xc0e4,0xc0de,
-0xc0e5,0xc0d8,0xed58,0x0000,0xed50,0x0000,0x0000,0xeff7,
-0x0000,0x0000,0xc271,0xeff4,0xeff6,0x0000,0xc26f,0xeff2,
-0xeff3,0xefee,0x0000,0x0000,0xe9f6,0xefef,0xc270,0xefeb,
-0x0000,0xc26d,0xeff8,0xc26e,0xefec,0xefed,0xeff1,0xc273,
-0x0000,0xc272,0x0000,0x0000,0xeff0,0xc378,0xf25f,0xf265,
-0xc379,0xf25c,0xc376,0xc373,0xf267,0xc377,0x0000,0xc374,
-0xf25e,0xf261,0xf262,0xf263,0xf266,0x0000,0xeff5,0xf25d,
-0xc375,0xf264,0xf268,0xf260,0x0000,0x0000,0x0000,0xf45d,
-0xc46a,0xf460,0xc46b,0xf468,0xf45f,0xf45c,0x0000,0xf45e,
-0xf462,0xf465,0xf464,0xf467,0xf45b,0x0000,0xc469,0xf463,
-0xf466,0xf469,0xf461,0xf5d3,0xf5d4,0xf5d8,0xf5d9,0x0000,
-0xf5d6,0xf5d7,0xf5d5,0x0000,0xc4e9,0x0000,0x0000,0x0000,
-0x0000,0xc578,0xf6eb,0x0000,0x0000,0xf6e8,0xf6e9,0xf6ea,
-0xc579,0x0000,0xf7e5,0xf7e4,0x0000,0xf8af,0xc5f4,0xf8ad,
-0xf8b0,0xf8ae,0xf8f5,0xc657,0xc665,0xf9a3,0xf96c,0x0000,
-0xf9a2,0xf9d0,0xf9d1,0xa4f5,0x0000,0x0000,0x0000,0x0000,
-0xa6c7,0xca41,0x0000,0x0000,0xcb5e,0x0000,0xa85f,0x0000,
-0xa862,0x0000,0xcb5f,0x0000,0xa860,0xa861,0x0000,0x0000,
-0x0000,0x0000,0xcd58,0xcd5a,0xcd55,0xcd52,0xcd54,0x0000,
-0x0000,0x0000,0xaaa4,0x0000,0x0000,0x0000,0xaaa2,0x0000,
-0x0000,0xcd56,0xaaa3,0xcd53,0xcd50,0xaaa1,0xcd57,0x0000,
-0xcd51,0xaaa5,0xcd59,0x0000,0x0000,0x0000,0x0000,0xcfaf,
-0x0000,0xcfb3,0x0000,0x0000,0xacb7,0x0000,0x0000,0x0000,
-0x0000,0xcfb6,0x0000,0xacaf,0xacb2,0xacb4,0xacb6,0xacb3,
-0xcfb2,0xcfb1,0x0000,0xacb1,0xcfb4,0xcfb5,0x0000,0xcfae,
-0xacb5,0x0000,0xacb0,0x0000,0x0000,0x0000,0xcfb0,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd277,0xd278,0xd279,
-0xaf50,0x0000,0xaf4c,0xd26e,0x0000,0xd276,0xd27b,0xaf51,
-0x0000,0xd26c,0xd272,0xd26b,0xd275,0x0000,0x0000,0xd271,
-0xaf4d,0xaf4f,0xd27a,0x0000,0xd26a,0xd26d,0xd273,0x0000,
-0xd274,0xd27c,0xd270,0x0000,0xaf4e,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb26d,
-0xd64e,0x0000,0x0000,0xd650,0xd64c,0x0000,0xd658,0xd64a,
-0xd657,0xb269,0xd648,0xda5b,0xd652,0xb26c,0x0000,0xd653,
-0xd656,0x0000,0xd65a,0x0000,0xd64f,0x0000,0xd654,0x0000,
-0x0000,0xb26a,0xb26b,0xd659,0xd64d,0xd649,0xd65b,0x0000,
-0xd651,0x0000,0x0000,0xd655,0x0000,0x0000,0x0000,0xd64b,
-0x0000,0xb548,0xb549,0xda65,0xb54f,0x0000,0xda59,0xda62,
-0xda58,0xb54c,0xda60,0xda5e,0x0000,0xda5f,0xb54a,0x0000,
-0xda63,0x0000,0x0000,0x0000,0x0000,0x0000,0xda5c,0xda5a,
-0xb54b,0xda5d,0xda61,0x0000,0x0000,0x0000,0xb54d,0x0000,
-0x0000,0x0000,0xda64,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xde70,0xde77,0xde79,0xdea1,0x0000,0xb7da,0xde6b,
-0x0000,0xb7d2,0x0000,0xde7a,0xb7d7,0xdea2,0xb7ce,0x0000,
-0xde7d,0x0000,0xde6d,0xde7e,0xde6c,0x0000,0xb7dc,0x0000,
-0xde78,0xb7cf,0xdea3,0x0000,0xb7d4,0xde71,0xb7d9,0xde7c,
-0xde6f,0xde76,0xde72,0xde6e,0xb7d1,0xb7d8,0xb7d6,0xb7d3,
-0xb7db,0xb7d0,0xde75,0x0000,0xb7d5,0x0000,0xb54e,0x0000,
-0xde7b,0x0000,0xde73,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xde74,0x0000,0x0000,0xe2c1,0x0000,0xbab4,0x0000,0x0000,
-0xe2bd,0xe2c3,0xe2bf,0x0000,0xbab6,0xe2be,0xe2c2,0xe2ba,
-0x0000,0xe2bc,0xbab5,0x0000,0x0000,0x0000,0x0000,0xe2c0,
-0xe2bb,0x0000,0xbab7,0x0000,0xbab2,0x0000,0x0000,0xe2c4,
-0x0000,0xbab3,0xe667,0xe664,0xe670,0xe66a,0xe66c,0xbcf4,
-0xe666,0xe66e,0x0000,0x0000,0xe66d,0xe66b,0x0000,0xe671,
-0xbcf7,0xe668,0xe66f,0x0000,0xbcf5,0x0000,0x0000,0xe663,
-0xe665,0xbcf6,0xe662,0xe672,0x0000,0xe669,0x0000,0x0000,
-0xea4a,0xbf51,0x0000,0x0000,0xea55,0xea53,0xbf4b,0xea49,
-0xea4c,0xea4d,0xea48,0xbf55,0xbf56,0xea47,0xea56,0xea51,
-0xbf4f,0xbf4c,0xea50,0xea4e,0x0000,0x0000,0xbf52,0xea52,
-0xbf4d,0x0000,0xbf4e,0x0000,0xea4f,0xbf50,0xea4b,0x0000,
-0xea54,0xbf53,0xea57,0xea58,0xbf54,0x0000,0x0000,0xc0e7,
-0xc0ee,0xed5c,0xed62,0x0000,0xed60,0xc0ea,0xc0e9,0xc0e6,
-0xed5e,0x0000,0x0000,0x0000,0xc0ec,0xc0eb,0xc0e8,0x0000,
-0xed61,0xed5d,0xed5f,0x0000,0xc0ed,0x0000,0x0000,0x0000,
-0xc277,0xeffb,0x0000,0xc274,0xc275,0xeffd,0xc276,0xeffa,
-/* 0x7200 */
-0x0000,0xeff9,0xf26c,0xeffc,0x0000,0xf26d,0xc37a,0xf26b,
-0x0000,0x0000,0xf26a,0x0000,0xf269,0xc37b,0x0000,0x0000,
-0xc46c,0x0000,0x0000,0xf46a,0xf46b,0x0000,0x0000,0x0000,
-0x0000,0xf5dc,0xf5db,0xc4ea,0x0000,0xf5da,0xf6ec,0xf6ed,
-0x0000,0x0000,0xf7e6,0xf8b1,0x0000,0x0000,0xf8f6,0xf9bc,
-0xc679,0xf9c6,0xa4f6,0x0000,0xaaa6,0xaaa7,0x0000,0x0000,
-0xacb8,0x0000,0x0000,0x0000,0x0000,0xc0ef,0xa4f7,0x0000,
-0xaaa8,0xaf52,0xb7dd,0xa4f8,0x0000,0xb26e,0xbab8,0xc962,
-0x0000,0xcfb7,0xd27d,0x0000,0xe2c5,0x0000,0xc0f0,0xa4f9,
-0xaaa9,0xcfb8,0xcfb9,0xda66,0xb550,0x0000,0x0000,0xdea4,
-0x0000,0x0000,0xb7de,0xe2c6,0x0000,0x0000,0xbcf8,0x0000,
-0xc37c,0xa4fa,0xda67,0xa4fb,0x0000,0xa6c9,0xca42,0xa6c8,
-0xa865,0xa864,0xa863,0xcb60,0x0000,0x0000,0x0000,0xaaaa,
-0x0000,0xaaab,0xcd5b,0x0000,0xcfba,0x0000,0xcfbd,0xacba,
-0xcfbb,0x0000,0xacb9,0xcfbc,0xacbb,0x0000,0xd2a2,0xd2a1,
-0xd27e,0xaf53,0x0000,0xd65d,0xd65e,0xb26f,0xd65c,0xd65f,
-0xb552,0xb270,0x0000,0x0000,0xb551,0xda6b,0xda6a,0x0000,
-0xda68,0xda69,0x0000,0xda6c,0xdea6,0xdea5,0xdea9,0x0000,
-0xdea8,0xdea7,0xbab9,0xe2c9,0x0000,0xe2c8,0xbaba,0xe2c7,
-0xe673,0x0000,0xe674,0xbcf9,0x0000,0xea59,0xea5a,0x0000,
-0x0000,0xf272,0xc37d,0xf271,0xf270,0xf26e,0xf26f,0xc4eb,
-0xf46c,0xf6ee,0xf8f7,0x0000,0xa4fc,0x0000,0xc9a5,0xa5c7,
-0xc9a6,0x0000,0x0000,0x0000,0xca43,0xca44,0x0000,0x0000,
-0x0000,0x0000,0xcb66,0x0000,0x0000,0xcb62,0x0000,0xcb61,
-0xaaac,0xcb65,0xa867,0xcb63,0xa866,0xcb67,0xcb64,0x0000,
-0x0000,0xcd5f,0xcfbe,0xcd5d,0xcd64,0x0000,0xaaad,0x0000,
-0xaab0,0xcd65,0xcd61,0x0000,0xcd62,0x0000,0xcd5c,0xaaaf,
-0xcd5e,0xaaae,0xcd63,0x0000,0xcd60,0x0000,0x0000,0xcfc2,
-0xacbd,0xacbe,0x0000,0xcfc5,0xcfbf,0x0000,0xcfc4,0x0000,
-0xcfc0,0xacbc,0xcfc3,0xcfc1,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd2a8,0xd2a5,0x0000,0xd2a7,0xaf58,
-0xaf57,0xaf55,0xd2a4,0xd2a9,0xaf54,0xaf56,0xd2a6,0xd667,
-0xd2a3,0xd2aa,0x0000,0x0000,0x0000,0x0000,0x0000,0xd662,
-0xd666,0x0000,0xd665,0xda6e,0xda79,0x0000,0x0000,0xd668,
-0x0000,0xd663,0xda6d,0xb274,0x0000,0x0000,0xb273,0xd661,
-0xd664,0xb275,0x0000,0xb272,0xb271,0xd660,0xd669,0x0000,
-0x0000,0x0000,0xda70,0xda77,0x0000,0xb554,0xda76,0xda73,
-0x0000,0xb556,0x0000,0x0000,0x0000,0xda75,0x0000,0x0000,
-0xda6f,0xda71,0xda74,0xda72,0xb555,0xda78,0xb553,0xb7df,
-0x0000,0x0000,0xdead,0xdeac,0xdeaa,0x0000,0xb7e2,0xb7e1,
-0xdeae,0x0000,0xdeab,0xe2ca,0xbabb,0xb7e0,0x0000,0x0000,
-0x0000,0xdeb0,0xdeaf,0x0000,0xe2cd,0xe2cb,0xbcfa,0x0000,
-0xbabc,0xe2cc,0xe676,0x0000,0x0000,0x0000,0x0000,0xbcfb,
-0xe675,0xe67e,0xe67d,0xe67b,0x0000,0xe67a,0xe677,0xe678,
-0xe679,0xe67c,0xe6a1,0x0000,0x0000,0xea5f,0xea5c,0xea5d,
-0xbf57,0xea5b,0xea61,0xea60,0xea5e,0x0000,0xed64,0xed65,
-0xc0f1,0x0000,0xc0f2,0xed63,0x0000,0xc279,0xeffe,0xc278,
-0xc37e,0x0000,0xc3a1,0xc46d,0xf46e,0xf46d,0xf5dd,0xf6ef,
-0xc57a,0xf7e8,0xf7e7,0xf7e9,0xa5c8,0xcfc6,0xaf59,0xb276,
-0xd66a,0xa5c9,0xc9a7,0xa4fd,0x0000,0x0000,0xca45,0x0000,
-0x0000,0x0000,0xcb6c,0xcb6a,0xcb6b,0xcb68,0xa868,0xcb69,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xcd6d,0x0000,0xaab3,
-0xcd6b,0xcd67,0xcd6a,0x0000,0xcd66,0xaab5,0xcd69,0x0000,
-0xaab2,0xaab1,0x0000,0xaab4,0xcd6c,0xcd68,0x0000,0x0000,
-0x0000,0x0000,0xacc2,0xacc5,0xcfce,0xcfcd,0xcfcc,0xacbf,
-0xcfd5,0xcfcb,0x0000,0xacc1,0xd2af,0x0000,0xcfd2,0xcfd0,
-0xacc4,0x0000,0xcfc8,0xcfd3,0x0000,0xcfca,0xcfd4,0xcfd1,
-0xcfc9,0x0000,0xacc0,0xcfd6,0xcfc7,0xacc3,0x0000,0x0000,
-0x0000,0x0000,0xd2b4,0xd2ab,0xd2b6,0x0000,0xd2ae,0xd2b9,
-0xd2ba,0xd2ac,0xd2b8,0xd2b5,0xd2b3,0xd2b7,0xaf5f,0x0000,
-0xaf5d,0x0000,0x0000,0xd2b1,0x0000,0xd2ad,0x0000,0xd2b0,
-0xd2bb,0xd2b2,0xaf5e,0xcfcf,0x0000,0xaf5a,0xaf5c,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd678,0xd66d,0xd66b,0x0000,
-0xd66c,0x0000,0xd673,0x0000,0xd674,0xd670,0xb27b,0xd675,
-0xd672,0xd66f,0x0000,0xb279,0xd66e,0xb277,0xb27a,0xd671,
-0xd679,0xaf5b,0xb278,0xd677,0xd676,0xb27c,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xda7e,0x0000,
-0x0000,0x0000,0xdaa1,0xb560,0x0000,0xdaa7,0x0000,0x0000,
-0xdaa9,0xdaa2,0xb55a,0xdaa6,0xdaa5,0xb55b,0xb561,0x0000,
-0xb562,0xdaa8,0xb558,0xda7d,0xda7b,0xdaa3,0xda7a,0xb55f,
-0xda7c,0xdaa4,0xdaaa,0xb559,0xb55e,0xb55c,0xb55d,0x0000,
-0x0000,0x0000,0xb557,0x0000,0x0000,0x0000,0x0000,0xb7e9,
-0xdeb7,0xb7e8,0xdebb,0x0000,0xdeb1,0x0000,0xdebc,0x0000,
-0x0000,0x0000,0xdeb2,0xdeb3,0x0000,0xdebd,0xdeba,0xdeb8,
-0xdeb9,0xdeb5,0xdeb4,0x0000,0xdebe,0xb7e5,0x0000,0xdeb6,
-0x0000,0xb7ea,0xb7e4,0xb7eb,0xb7ec,0x0000,0xb7e7,0xb7e6,
-0x0000,0x0000,0xe2ce,0xbabe,0xbabd,0x0000,0x0000,0xe2d3,
-0x0000,0xbcfc,0xbabf,0x0000,0x0000,0xbac1,0xe2d4,0xb7e3,
-0xbac0,0xe2d0,0xe2d2,0xe2cf,0x0000,0xe2d1,0x0000,0x0000,
-0x0000,0xe6ab,0x0000,0x0000,0xe6aa,0xe6a7,0xbd40,0xea62,
-0xbd41,0xe6a6,0x0000,0xbcfe,0x0000,0xe6a8,0xe6a5,0xe6a2,
-0xe6a9,0xe6a3,0xe6a4,0xbcfd,0x0000,0x0000,0x0000,0x0000,
-0xed69,0x0000,0xea66,0x0000,0xea65,0xea67,0x0000,0xed66,
-0xbf5a,0x0000,0xea63,0x0000,0xbf58,0x0000,0xbf5c,0xbf5b,
-0xea64,0xea68,0x0000,0xbf59,0x0000,0xed6d,0xc0f5,0xc27a,
-0xc0f6,0xc0f3,0xed6a,0xed68,0x0000,0xed6b,0x0000,0xed6e,
-0xc0f4,0xed6c,0xed67,0x0000,0x0000,0xf042,0xf045,0xf275,
-0xf040,0x0000,0xf46f,0xf046,0x0000,0xc3a2,0xf044,0xc27b,
-0xf041,0xf043,0xf047,0xf276,0x0000,0xf274,0x0000,0x0000,
-0x0000,0x0000,0xc3a3,0xf273,0x0000,0x0000,0x0000,0xc46e,
-0x0000,0x0000,0x0000,0x0000,0xc4ed,0xf6f1,0xc4ec,0xf6f3,
-0xf6f0,0xf6f2,0xc5d0,0xf8b2,0xa5ca,0xcd6e,0xd2bc,0xd2bd,
-0xb27d,0xdebf,0xbf5d,0xc3a4,0xc57b,0xf8b3,0xa5cb,0x0000,
-0xcd6f,0xa260,0x0000,0x0000,0xcfd7,0x0000,0xcfd8,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd2be,0xd2bf,0xb27e,0xb2a1,
-0x0000,0x0000,0x0000,0xdaab,0x0000,0xdec2,0xdec1,0xdec0,
-0xe2d5,0x0000,0xe2d6,0xe2d7,0xbac2,0x0000,0x0000,0xe6ad,
-0xe6ac,0x0000,0x0000,0xea69,0xbf5e,0xbf5f,0x0000,0xed72,
-0xed6f,0xed70,0xed71,0xf049,0xf048,0xc27c,0xf277,0xf5de,
-0xa5cc,0x0000,0xacc6,0x0000,0xb2a2,0xdec3,0x0000,0xa5cd,
-0x0000,0xd2c0,0xb2a3,0x0000,0x0000,0xb563,0xb564,0x0000,
-0xa5ce,0xa5cf,0xca46,0xa86a,0xa869,0xacc7,0xcfd9,0xdaac,
-0xa5d0,0xa5d1,0xa5d2,0xa5d3,0x0000,0x0000,0x0000,0xa86b,
-0xa86c,0xcb6e,0xcb6d,0x0000,0x0000,0xaab6,0xcd72,0xcd70,
-0xcd71,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcfda,
-0xcfdb,0x0000,0x0000,0xaccb,0xacc9,0x0000,0xacca,0xacc8,
-0x0000,0x0000,0x0000,0x0000,0xaf60,0x0000,0x0000,0x0000,
-0x0000,0xaf64,0xaf63,0xd2c1,0xaf62,0xaf61,0x0000,0xd2c2,
-0x0000,0x0000,0xb2a6,0xd67b,0xd67a,0xb2a4,0xb2a5,0x0000,
-0x0000,0x0000,0xb566,0xb565,0xdaae,0x0000,0x0000,0xdaad,
-0xb2a7,0x0000,0x0000,0x0000,0x0000,0x0000,0xb7ed,0xdec5,
-0xb7ee,0xdec4,0x0000,0x0000,0x0000,0xe2d8,0xe6ae,0xbd42,
-0xea6a,0x0000,0x0000,0x0000,0xed73,0x0000,0xc3a6,0xc3a5,
-0x0000,0x0000,0xc57c,0xa5d4,0xcd73,0x0000,0x0000,0xb2a8,
-0xe2d9,0xbac3,0x0000,0x0000,0xcb6f,0xcb70,0x0000,0x0000,
-0xcd74,0xaab8,0xaab9,0x0000,0x0000,0xaab7,0x0000,0x0000,
-0x0000,0x0000,0xaccf,0xacd0,0xaccd,0xacce,0x0000,0xcfdc,
-0x0000,0x0000,0xcfdd,0xaccc,0x0000,0x0000,0x0000,0x0000,
-0xd2c3,0x0000,0xaf68,0xaf69,0x0000,0xb2ab,0xd2c9,0x0000,
-0xaf6e,0xaf6c,0xd2ca,0xd2c5,0xaf6b,0xaf6a,0xaf65,0xd2c8,
-0xd2c7,0xd2c4,0xaf6d,0x0000,0xd2c6,0xaf66,0x0000,0xaf67,
-0x0000,0x0000,0xb2ac,0xd6a1,0xd6a2,0xb2ad,0xd67c,0xd67e,
-0xd6a4,0xd6a3,0xd67d,0x0000,0xb2a9,0xb2aa,0x0000,0xdab6,
-0xb56b,0xb56a,0xdab0,0xb568,0x0000,0xdab3,0xb56c,0xdab4,
-0xb56d,0xdab1,0xb567,0xb569,0xdab5,0x0000,0xdab2,0xdaaf,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xded2,0x0000,0xdec7,
-0xb7f0,0xb7f3,0xb7f2,0xb7f7,0xb7f6,0xded3,0xded1,0xdeca,
-0xdece,0xdecd,0xb7f4,0xded0,0xdecc,0xded4,0xdecb,0xb7f5,
-0xb7ef,0xb7f1,0x0000,0xdec9,0x0000,0x0000,0x0000,0x0000,
-0xe2db,0xbac7,0xe2df,0xbac6,0xe2dc,0xbac5,0x0000,0xdec8,
-0xdecf,0xe2de,0x0000,0xbac8,0xe2e0,0xe2dd,0xe2da,0x0000,
-0x0000,0xe6b1,0xe6b5,0xe6b7,0xe6b3,0xe6b2,0xe6b0,0xbd45,
-0xbd43,0xbd48,0xbd49,0xe6b4,0xbd46,0xe6af,0xbd47,0xbac4,
-0xe6b6,0xbd44,0x0000,0x0000,0x0000,0xea6c,0x0000,0xea6b,
-0xea73,0xea6d,0xea72,0xea6f,0xbf60,0xea71,0x0000,0x0000,
-0xbf61,0x0000,0xbf62,0x0000,0xea70,0xea6e,0x0000,0x0000,
-0x0000,0x0000,0xc0f8,0xed74,0x0000,0x0000,0xc0f7,0xed77,
-0xed75,0xed76,0x0000,0x0000,0xc0f9,0x0000,0x0000,0x0000,
-0xf04d,0x0000,0xc2a1,0xf04e,0x0000,0x0000,0xc27d,0xf04f,
-0xc27e,0xf04c,0xf050,0x0000,0xf04a,0x0000,0x0000,0xc3a7,
-0xf278,0xc3a8,0xc46f,0x0000,0xf04b,0xc470,0x0000,0x0000,
-0x0000,0xc4ee,0xf5df,0x0000,0xc57e,0xf6f4,0xc57d,0x0000,
-0xf7ea,0xc5f5,0xc5f6,0x0000,0x0000,0xf9cc,0x0000,0x0000,
-0xacd1,0xcfde,0x0000,0xb56e,0xb56f,0xa5d5,0xa6ca,0xca47,
-0x0000,0xcb71,0xa86d,0x0000,0xaaba,0x0000,0xacd2,0xacd3,
-0xacd4,0xd6a6,0xd2cb,0xaf6f,0x0000,0x0000,0xb2ae,0xd6a5,
-0x0000,0x0000,0xdab8,0xb571,0x0000,0xdab7,0xb570,0x0000,
-0x0000,0xded5,0xbd4a,0xe6bb,0xe6b8,0xe6b9,0xe6ba,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xed78,0x0000,0xf051,0x0000,
-0x0000,0x0000,0xf471,0xf470,0x0000,0xf6f5,0xa5d6,0xcd75,
-0xaf70,0x0000,0x0000,0x0000,0xb572,0xded6,0x0000,0x0000,
-0xe2e1,0x0000,0xbd4b,0xea74,0x0000,0xf052,0xf472,0xa5d7,
-0x0000,0x0000,0xaabb,0xacd7,0xcfdf,0xacd8,0xacd6,0x0000,
-0xacd5,0xd2cc,0xaf71,0x0000,0x0000,0xaf72,0xaf73,0x0000,
-0x0000,0x0000,0xb2b0,0xd6a7,0xb2af,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xdab9,0xb2b1,0xb573,0xded7,0xb7f8,0xb7f9,
-0x0000,0xbac9,0x0000,0xbaca,0xbd4c,0xbf64,0xea75,0xbf63,
-0x0000,0xed79,0xc0fa,0x0000,0xf053,0xf473,0xa5d8,0xa86e,
-0xcd78,0xcd77,0xaabc,0xcd76,0xaabd,0xcd79,0x0000,0xcfe5,
-0xacdb,0xacda,0xcfe7,0xcfe6,0xacdf,0x0000,0xacde,0x0000,
-/* 0x7700 */
-0x0000,0xacd9,0x0000,0xcfe1,0xcfe2,0xcfe3,0x0000,0xace0,
-0xcfe0,0xacdc,0xcfe4,0xacdd,0x0000,0x0000,0x0000,0x0000,
-0xd2cf,0xd2d3,0xd2d1,0xd2d0,0x0000,0xd2d4,0x0000,0x0000,
-0x0000,0xd2d5,0xd2d6,0xd2ce,0x0000,0xd2cd,0x0000,0xaf75,
-0xaf76,0x0000,0xd2d7,0xd2d2,0x0000,0xd6b0,0x0000,0xd2d8,
-0xaf77,0xaf74,0x0000,0x0000,0x0000,0xd6aa,0x0000,0xd6a9,
-0x0000,0xd6ab,0xd6ac,0xd6ae,0xd6ad,0xd6b2,0xb2b5,0xb2b2,
-0xb2b6,0xd6a8,0xb2b7,0xd6b1,0xb2b4,0xd6af,0xb2b3,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xdabc,0xdabe,0xdaba,0xdabb,
-0x0000,0x0000,0xdabf,0xdac1,0xdac2,0xdabd,0xdac0,0xb574,
-0x0000,0x0000,0xdedb,0x0000,0xdee0,0xded8,0xdedc,0x0000,
-0x0000,0xdee1,0xdedd,0xb7fa,0xb843,0x0000,0xb7fd,0xded9,
-0xdeda,0xbace,0xb846,0xb7fe,0x0000,0xb844,0xb7fc,0xdedf,
-0xb845,0xdede,0xb841,0xb7fb,0xb842,0xdee2,0xe2e6,0xe2e8,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xb840,0x0000,0x0000,0xe2e3,0xbacc,0xe2e9,0xbacd,
-0xe2e7,0xe2e2,0xe2e5,0xe2ea,0xbacb,0xe2e4,0x0000,0xbd4e,
-0xe6bf,0xe6be,0x0000,0xbd51,0xbd4f,0xe6bc,0xbd4d,0xe6bd,
-0x0000,0xbd50,0x0000,0x0000,0x0000,0xea7d,0x0000,0xeaa1,
-0x0000,0xea7e,0xea76,0xea7a,0xea79,0xea77,0xbf66,0xbf67,
-0xbf65,0xea78,0xea7b,0xea7c,0x0000,0xbf68,0x0000,0xc140,
-0xeda3,0x0000,0xc0fc,0xed7b,0xc0fe,0xc141,0x0000,0x0000,
-0xc0fd,0xeda2,0xed7c,0xc0fb,0xeda1,0xed7a,0xed7e,0xed7d,
-0x0000,0x0000,0xf055,0xc2a4,0xc2a5,0xc2a2,0x0000,0xc2a3,
-0x0000,0x0000,0xf054,0x0000,0xf27b,0x0000,0x0000,0xc3a9,
-0x0000,0xf279,0xf27a,0x0000,0xf474,0xf477,0xf475,0xf476,
-0xf5e0,0x0000,0x0000,0xc4ef,0xf7eb,0xf8b4,0x0000,0xc5f7,
-0xf8f8,0xf8f9,0xc666,0xa5d9,0xace1,0x0000,0xdac3,0x0000,
-0xdee3,0x0000,0xa5da,0xa86f,0x0000,0xaabe,0x0000,0xcfe8,
-0xcfe9,0xaf78,0x0000,0x0000,0xdac4,0xb575,0xb847,0xc142,
-0xeda4,0xf27c,0xf478,0xa5db,0x0000,0x0000,0x0000,0xcda1,
-0xcd7a,0xcd7c,0xcd7e,0xcd7d,0xcd7b,0xaabf,0x0000,0x0000,
-/* 0x7800 */
-0x0000,0x0000,0xace2,0xcff2,0x0000,0xcfed,0xcfea,0x0000,
-0x0000,0xcff1,0x0000,0x0000,0xace4,0xace5,0xcff0,0xcfef,
-0xcfee,0xcfeb,0xcfec,0xcff3,0xace3,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xaf7c,0x0000,0xafa4,
-0xafa3,0xd2e1,0xd2db,0xd2d9,0x0000,0xafa1,0xd6b9,0xaf7a,
-0xd2de,0xd2e2,0xd2e4,0xd2e0,0xd2da,0xafa2,0xd2df,0xd2dd,
-0xaf79,0xd2e5,0xafa5,0xd2e3,0xaf7d,0xd2dc,0x0000,0xaf7e,
-0xaf7b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xb2b9,0x0000,0xd6ba,0x0000,0x0000,
-0xd6b3,0xd6b5,0xd6b7,0x0000,0xd6b8,0xd6b6,0xb2ba,0x0000,
-0xd6bb,0x0000,0xd6b4,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xdac8,0xb576,0xdad0,0x0000,
-0xdac5,0x0000,0xdad1,0x0000,0xdac6,0xdac7,0x0000,0x0000,
-0xdacf,0xdace,0xdacb,0xb2b8,0xb577,0xdac9,0xdacc,0xb578,
-0xdacd,0xdaca,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xdeee,0x0000,0xdef2,0xb84e,0x0000,0xe2f0,0xb851,
-0xdef0,0xf9d6,0x0000,0xdeed,0xdee8,0xdeea,0xdeeb,0xdee4,
-0x0000,0xb84d,0x0000,0x0000,0xb84c,0x0000,0xb848,0xdee7,
-0x0000,0xb84f,0x0000,0xb850,0xdee6,0xdee9,0xdef1,0xb84a,
-0xb84b,0xdeef,0xdee5,0x0000,0x0000,0x0000,0xe2f2,0xbad0,
-0xe2f4,0xdeec,0xe2f6,0xbad4,0xe2f7,0xe2f3,0x0000,0xbad1,
-0xe2ef,0xbad3,0xe2ec,0xe2f1,0xe2f5,0xe2ee,0x0000,0x0000,
-0xb849,0x0000,0xe2eb,0xbad2,0xe2ed,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xbd54,0xe6c1,0xbd58,0x0000,0xbd56,0x0000,
-0x0000,0xbacf,0x0000,0xe6c8,0xe6c9,0xbd53,0x0000,0x0000,
-0xe6c7,0xe6ca,0xbd55,0xbd52,0xe6c3,0xe6c0,0xe6c5,0xe6c2,
-0xbd59,0xe6c4,0x0000,0x0000,0xe6c6,0xbd57,0x0000,0x0000,
-0x0000,0x0000,0xbf6a,0xeaa8,0x0000,0xeaa2,0xeaa6,0xeaac,
-0xeaad,0xeaa9,0xeaaa,0xeaa7,0x0000,0xeaa4,0x0000,0xbf6c,
-0xbf69,0xeaa3,0xeaa5,0x0000,0xbf6b,0xeaab,0x0000,0xc146,
-0x0000,0x0000,0xedaa,0xeda5,0xc145,0x0000,0x0000,0xc143,
-0x0000,0xedac,0xc144,0xeda8,0xeda9,0xeda6,0xedad,0xf056,
-/* 0x7900 */
-0x0000,0xc147,0xeda7,0x0000,0xedae,0xedab,0x0000,0x0000,
-0x0000,0xf05a,0x0000,0x0000,0xf057,0x0000,0xc2a6,0x0000,
-0xf05b,0xf05d,0xf05c,0xf058,0xf059,0x0000,0x0000,0xf2a3,
-0x0000,0xc3aa,0x0000,0xf27e,0xf2a2,0xf27d,0xf2a4,0x0000,
-0x0000,0xf2a1,0x0000,0xf47a,0xf47d,0xf479,0xc471,0xf47b,
-0xf47c,0xf47e,0xc472,0xc474,0xc473,0xf5e1,0x0000,0xf5e3,
-0x0000,0xf5e2,0x0000,0x0000,0x0000,0xf6f6,0x0000,0x0000,
-0xf8b5,0xf8fa,0xa5dc,0x0000,0x0000,0xcb72,0xaac0,0xcda3,
-0xaac1,0xaac2,0xcda2,0x0000,0xcff8,0xcff7,0xace6,0xace9,
-0xace8,0xace7,0xcff4,0xcff6,0xcff5,0x0000,0x0000,0xd2e8,
-0xafa7,0xd2ec,0xd2eb,0xd2ea,0xd2e6,0xafa6,0xafaa,0xafad,
-0x0000,0x0000,0xafae,0xd2e7,0xd2e9,0xafac,0xafab,0xafa9,
-0xafa8,0xd6c2,0x0000,0xd6c0,0xd6bc,0xb2bb,0x0000,0xd6bd,
-0xb2bc,0xd6be,0xd6bf,0xd6c1,0x0000,0xb2bd,0x0000,0x0000,
-0xdad5,0x0000,0xdad4,0xdad3,0xdad2,0x0000,0x0000,0x0000,
-0x0000,0xdef6,0xb852,0x0000,0xdef3,0xdef5,0x0000,0xb853,
-0x0000,0xb854,0xdef4,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe341,0x0000,0xe2f9,0xe2fa,0x0000,0xbad7,0xbad5,0xbad6,
-0xe343,0x0000,0xe342,0xe2fe,0xe2fd,0xe2fc,0xe2fb,0xe340,
-0xe2f8,0x0000,0xe6cb,0xe6d0,0xe6ce,0x0000,0x0000,0x0000,
-0xe6cd,0xe6cc,0xe6cf,0x0000,0xeaae,0x0000,0xbf6d,0xc148,
-0xedb0,0x0000,0xc149,0xedaf,0xf05f,0xf05e,0xc2a7,0x0000,
-0xf2a5,0xc3ab,0xf4a1,0xc5a1,0xf6f7,0x0000,0xf8b7,0xf8b6,
-0xc9a8,0xacea,0xaceb,0xd6c3,0x0000,0xb856,0xa5dd,0xa872,
-0xa871,0xa870,0x0000,0x0000,0x0000,0xcda4,0x0000,0x0000,
-0xaac4,0xaac3,0x0000,0xacee,0x0000,0xcffa,0xcffd,0xcffb,
-0x0000,0xacec,0xaced,0x0000,0x0000,0xcff9,0xcffc,0x0000,
-0xafb5,0x0000,0x0000,0x0000,0xd2f3,0xd2f5,0xd2f4,0xafb2,
-0xd2ef,0x0000,0x0000,0xafb0,0xafaf,0x0000,0xafb3,0xafb1,
-0x0000,0xafb4,0xd2f2,0xd2ed,0xd2ee,0xd2f1,0xd2f0,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd6c6,0xd6c7,
-0xd6c5,0x0000,0xd6c4,0xb2be,0x0000,0x0000,0x0000,0x0000,
-0xb57d,0x0000,0xdad6,0xdad8,0xdada,0xb57c,0x0000,0x0000,
-0xb57a,0x0000,0xdad7,0xb57b,0xdad9,0xb579,0x0000,0x0000,
-0xdf41,0xdef7,0xdefa,0xdefe,0xb85a,0xdefc,0x0000,0xdefb,
-0xdef8,0xdef9,0xb858,0xdf40,0xb857,0x0000,0xb85c,0xb85b,
-0xb859,0x0000,0xdefd,0x0000,0x0000,0x0000,0xe349,0x0000,
-0xe348,0x0000,0x0000,0xe344,0x0000,0x0000,0xbad8,0xe347,
-0xe346,0xbad9,0x0000,0x0000,0x0000,0x0000,0x0000,0xbd5e,
-0x0000,0xe6d2,0x0000,0xbd5f,0xbd5b,0xbd5d,0x0000,0xbd5a,
-0xbd5c,0x0000,0x0000,0x0000,0xeaaf,0x0000,0xbf70,0xeab1,
-0xeab0,0x0000,0xe345,0xbf72,0xbf71,0xbf6e,0xbf6f,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xedb5,0x0000,0xedb3,0xc14a,
-0xedb4,0x0000,0xedb6,0xedb2,0xedb1,0x0000,0x0000,0xf060,
-0xc2aa,0xc2a8,0xc2a9,0x0000,0x0000,0x0000,0x0000,0xf2a6,
-0xf2a7,0xc3ad,0x0000,0xc3ac,0xf4a3,0xf4a4,0xf4a2,0x0000,
-0xf6f8,0xf6f9,0x0000,0x0000,0xa5de,0xca48,0xa873,0x0000,
-0xcda5,0xaac6,0xaac5,0xcda6,0x0000,0x0000,0xd040,0xacef,
-0xcffe,0xacf0,0x0000,0x0000,0xafb6,0xd2f8,0xd2f6,0xd2fc,
-0xafb7,0xd2f7,0xd2fb,0xd2f9,0xd2fa,0x0000,0x0000,0xd6c8,
-0xd6ca,0x0000,0xb2bf,0x0000,0xd6c9,0xb2c0,0xb5a2,0xb5a1,
-0xb57e,0xdadb,0x0000,0x0000,0x0000,0x0000,0xdf44,0xb85d,
-0xb85e,0x0000,0xdf43,0xdf42,0x0000,0x0000,0x0000,0x0000,
-0xe34a,0xbadb,0xbada,0xe34b,0xe34c,0x0000,0xbd61,0xbd60,
-0x0000,0xeab5,0xe6d3,0xe6d5,0xe6d4,0xeab4,0xeab2,0xeab6,
-0xeab3,0x0000,0xbf73,0x0000,0x0000,0x0000,0xedb7,0xc14b,
-0xedb8,0xedb9,0x0000,0x0000,0xc2ab,0xc2ac,0x0000,0xc475,
-0x0000,0x0000,0xc5d1,0xa5df,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xd041,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd2fd,0xafb8,0x0000,0x0000,0x0000,0x0000,0x0000,0xb3ba,
-0xb3b9,0x0000,0x0000,0xb5a4,0xdadd,0xb5a3,0xdadc,0x0000,
-0x0000,0x0000,0x0000,0xdf45,0x0000,0xbadc,0xe34d,0xbadd,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc476,0xf4a5,
-0x0000,0xa6cb,0xaac7,0xcda7,0x0000,0xacf2,0x0000,0xacf1,
-0xd042,0xd043,0x0000,0x0000,0xd340,0xd342,0xafb9,0x0000,
-0xd344,0xd347,0xd345,0x0000,0x0000,0x0000,0xd346,0xd343,
-0xd2fe,0xafba,0xd348,0xd341,0x0000,0x0000,0x0000,0x0000,
-0xd6d3,0xb2c6,0xd6dc,0xb2c3,0x0000,0xd6d5,0xb2c7,0x0000,
-0xb2c1,0x0000,0xd6d0,0xd6dd,0xd6d1,0xd6ce,0xb2c5,0x0000,
-0xb2c2,0x0000,0xd6d4,0xd6d7,0xb2c4,0xd6d8,0xb2c8,0xd6d9,
-0xd6cf,0xd6d6,0xd6da,0xd6d2,0xd6cd,0xd6cb,0x0000,0x0000,
-0xd6db,0x0000,0x0000,0xdadf,0x0000,0x0000,0x0000,0x0000,
-0xdae4,0x0000,0x0000,0x0000,0xdae0,0xdae6,0xb5a7,0xd6cc,
-0xdae1,0xb5a5,0xdade,0xb5ac,0xdae2,0xb5ab,0xdae3,0xb5ad,
-0xb5a8,0xb5ae,0xb5a9,0x0000,0xb5aa,0x0000,0xb5a6,0x0000,
-0xdae5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xb861,0xdf50,0x0000,0xdf53,0xdf47,0xdf4c,0xdf46,0xb863,
-0x0000,0xdf4a,0x0000,0x0000,0x0000,0xdf48,0xb862,0x0000,
-0xdf4f,0xdf4e,0xdf4b,0xdf4d,0xdf49,0xbae1,0xdf52,0xb85f,
-0xdf51,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xe35d,0x0000,0xbae8,0xe358,0x0000,0xbae7,
-0xe34e,0x0000,0xe350,0xbae0,0xe355,0xe354,0xe357,0xbae5,
-0xe352,0xe351,0x0000,0x0000,0xbae4,0xbadf,0xe353,0xbae2,
-0xe359,0xe35b,0x0000,0xe356,0xe34f,0xbae3,0x0000,0x0000,
-0xbd69,0xbade,0x0000,0x0000,0xe35c,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe6d9,0xbd62,0x0000,0xe6db,
-0x0000,0xbd63,0x0000,0x0000,0xbd65,0xe6de,0x0000,0xe6d6,
-0xbae6,0xe6dc,0x0000,0x0000,0x0000,0x0000,0xe6d8,0x0000,
-0xb860,0xbd68,0x0000,0x0000,0xbd64,0x0000,0xbd66,0xbd67,
-0x0000,0xbf76,0xe6dd,0xe6d7,0xbd6a,0x0000,0xe6da,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xeac0,0xeabb,0x0000,0x0000,
-0xeac5,0xbf74,0xeabd,0xbf78,0xeac3,0xeaba,0xeab7,0xeac6,
-0xc151,0xbf79,0xeac2,0xeab8,0xbf77,0xeabc,0xbf7b,0xeab9,
-0xeabe,0xbf7a,0xeac1,0xeac4,0x0000,0x0000,0x0000,0x0000,
-0xedcb,0xedcc,0xedbc,0xedc3,0xedc1,0x0000,0x0000,0xc14f,
-0xedc8,0xeabf,0x0000,0xedbf,0x0000,0xedc9,0xc14e,0xedbe,
-0xedbd,0xedc7,0xedc4,0xedc6,0x0000,0xedba,0xedca,0xc14c,
-0x0000,0xedc5,0xedce,0xedc2,0xc150,0xc14d,0xedc0,0xedbb,
-0xedcd,0xbf75,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf063,0x0000,0x0000,0xf061,0xf067,0xc2b0,0xf065,
-0xf064,0xc2b2,0xf06a,0xc2b1,0x0000,0xf06b,0xf068,0xc2ae,
-0xf069,0xf062,0xc2af,0xc2ad,0xf2ab,0xf066,0x0000,0x0000,
-0xf06c,0x0000,0x0000,0xf2a8,0x0000,0x0000,0x0000,0xc3b2,
-0xc3b0,0xf2aa,0x0000,0xf2ac,0xf2a9,0xc3b1,0xc3ae,0xc3af,
-0xc3b3,0x0000,0x0000,0xc478,0x0000,0xf4aa,0x0000,0xf4a9,
-0xf4a7,0xf4a6,0xf4a8,0x0000,0xc477,0xc479,0x0000,0x0000,
-0xc4f0,0x0000,0x0000,0xf5e5,0xf5e4,0x0000,0x0000,0xf6fa,
-0x0000,0xf6fc,0xf6fe,0xf6fd,0xf6fb,0x0000,0x0000,0xc5a3,
-0xc5a2,0x0000,0x0000,0xc5d3,0xc5d2,0xc5d4,0xf7ed,0xf7ec,
-0x0000,0xf8fb,0xf8b8,0xf8fc,0xc658,0x0000,0xc659,0xf96d,
-0x0000,0x0000,0xc67e,0xa6cc,0x0000,0xcda8,0x0000,0x0000,
-0xd045,0xd046,0xd044,0x0000,0x0000,0xacf3,0x0000,0xd047,
-0xd048,0xd049,0x0000,0x0000,0xd349,0xd34f,0x0000,0x0000,
-0xd34d,0xafbb,0xd34b,0x0000,0xd34c,0xd34e,0x0000,0x0000,
-0x0000,0xd34a,0xb2c9,0x0000,0xd6de,0xb2cb,0xd6e0,0xb2ca,
-0xd6df,0x0000,0x0000,0x0000,0x0000,0x0000,0xdae8,0xb5af,
-0x0000,0xdaea,0xdae7,0xd6e1,0x0000,0xb5b0,0x0000,0xf9db,
-0xdae9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdf56,
-0x0000,0xb864,0xdf54,0xb865,0xdf55,0xb866,0x0000,0x0000,
-0x0000,0xbae9,0xe361,0xe35e,0xe360,0xbaea,0xbaeb,0xe35f,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe6df,0x0000,0x0000,
-0xe6e0,0x0000,0xbd6b,0xe6e2,0xe6e1,0x0000,0xa261,0x0000,
-0xeaca,0xeacb,0xeac7,0x0000,0xeac8,0xbf7c,0xbf7d,0xeac9,
-0x0000,0xc157,0x0000,0x0000,0xc153,0xc158,0xc154,0xc156,
-0xc152,0x0000,0xc155,0x0000,0x0000,0x0000,0x0000,0xc2b3,
-0xedcf,0x0000,0xf2ae,0x0000,0xf2ad,0x0000,0xf4ab,0xc47a,
-0xc47b,0xf741,0xf5e6,0x0000,0xf740,0x0000,0xf8fd,0xf9a4,
-0xa6cd,0x0000,0x0000,0xa874,0x0000,0xcda9,0xaac8,0x0000,
-0xacf6,0xd04c,0xacf4,0xd04a,0xacf9,0xacf5,0xacfa,0xacf8,
-0xd04b,0xacf7,0xafbf,0xafbe,0xd35a,0xafc7,0xd353,0xd359,
-0xafc3,0xd352,0xd358,0xd356,0xafc2,0xafc4,0xd355,0xafbd,
-0xd354,0xafc8,0xafc5,0xafc9,0xafc6,0xd351,0xd350,0xd357,
-0xafc0,0xafbc,0xafc1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd6f0,0xd6e9,0x0000,0xb5b5,0xd6e8,0x0000,0xb2cf,0xb2d6,
-0xb2d3,0xb2d9,0xb2d8,0xb2d4,0x0000,0xd6e2,0xd6e5,0x0000,
-0xd6e4,0xb2d0,0xd6e6,0xd6ef,0xb2d1,0xd6e3,0xd6ec,0xd6ed,
-0xb2d2,0xd6ea,0xb2d7,0xb2cd,0xb2d5,0xd6e7,0xb2cc,0xd6eb,
-0x0000,0x0000,0xd6ee,0x0000,0x0000,0x0000,0xdafb,0xdaf2,
-0xb5b2,0xdaf9,0xdaf6,0xdaee,0xdaf7,0xb5b4,0xdaef,0x0000,
-0xdaeb,0x0000,0x0000,0xb86c,0xdaf4,0x0000,0xb5b1,0xdafa,
-0x0000,0xb5b8,0xb5ba,0xdaed,0x0000,0x0000,0xb5b9,0xdaf0,
-0xb5b3,0xdaf8,0xdaf1,0xdaf5,0x0000,0xdaf3,0xb5b6,0xdaec,
-0xb5bb,0xb2ce,0xb5b7,0xb5bc,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xb868,0xdf5d,0xdf5f,0xdf61,0xdf65,0x0000,0xdf5b,
-0xdf59,0xb86a,0x0000,0xdf60,0xdf64,0xdf5c,0xdf58,0x0000,
-0xdf57,0x0000,0x0000,0x0000,0xdf62,0xdf5a,0xdf5e,0xb86b,
-0x0000,0xb869,0xdf66,0xb867,0xdf63,0x0000,0xe372,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xbaee,0xe36a,0xbd78,0xe374,
-0xbaf1,0xe378,0xbaf7,0xe365,0x0000,0x0000,0xe375,0xe362,
-0x0000,0xe377,0xe366,0x0000,0xbafe,0xbafb,0xe376,0xe370,
-0xbaed,0xbaf5,0xbaf4,0x0000,0xbaf3,0xbaf9,0x0000,0xe363,
-0xbafa,0xe371,0xbaf6,0xbaec,0xe373,0xbaef,0xbaf0,0xbaf8,
-0xe368,0xe367,0xe364,0x0000,0xe36c,0xe369,0xe36d,0xbafd,
-0x0000,0xe379,0xbaf2,0xe36e,0xe36f,0x0000,0xe36b,0x0000,
-0x0000,0x0000,0xbafc,0x0000,0x0000,0x0000,0x0000,0xe6e7,
-0xbd70,0xbd79,0xbd75,0xe6e4,0x0000,0xbd72,0xbd76,0xe6f0,
-0xbd6c,0xe6e8,0x0000,0xbd74,0x0000,0x0000,0xe6eb,0xe6e6,
-0xbd73,0xbd77,0xe6e5,0x0000,0xbd71,0x0000,0xe6ef,0xbd6e,
-0xe6ee,0xe6ed,0xbd7a,0xe572,0xbd6d,0x0000,0xe6ec,0xe6e3,
-0x0000,0xbd7b,0xe6ea,0xbd6f,0x0000,0x0000,0x0000,0x0000,
-/* 0x7e00 */
-0x0000,0x0000,0x0000,0xe6e9,0x0000,0x0000,0x0000,0x0000,
-0xbfa2,0xbfa7,0xbf7e,0xead8,0xeacf,0xeadb,0xead3,0xead9,
-0xbfa8,0xbfa1,0xeacc,0xead2,0xeadc,0xead5,0xeada,0xeace,
-0x0000,0x0000,0xead6,0xbfa3,0xead4,0xbfa6,0xbfa5,0xead0,
-0xead1,0xeacd,0xead7,0xbfa4,0xeade,0xeadd,0x0000,0x0000,
-0x0000,0xedda,0xedd6,0xc15f,0x0000,0xedd0,0xc159,0xc169,
-0xeddc,0xc161,0xc15d,0xedd3,0xc164,0xc167,0xedde,0xc15c,
-0xedd5,0xc165,0xede0,0xeddd,0xedd1,0xc160,0xc15a,0xc168,
-0xedd8,0xc163,0xedd2,0xc15e,0xeddf,0xc162,0xc15b,0xedd9,
-0xc166,0xedd7,0x0000,0x0000,0xeddb,0x0000,0x0000,0x0000,
-0xf06e,0xf074,0xc2b9,0xf077,0xc2b4,0xc2b5,0xf06f,0xf076,
-0xf071,0xc2ba,0xc2b7,0x0000,0xf06d,0x0000,0xc2b6,0xf073,
-0xf075,0xc2b8,0xf072,0xf070,0x0000,0x0000,0x0000,0x0000,
-0xf2b8,0xc3b7,0xc3b8,0xc3b4,0x0000,0xc3b5,0x0000,0xf2b4,
-0xf2b2,0x0000,0xf2b6,0xc3ba,0xf2b7,0xf2b0,0xf2af,0xf2b3,
-0xf2b1,0xc3b6,0xf2b5,0xf4ac,0xc47e,0xc47d,0xf4ad,0x0000,
-0xf4af,0xf4ae,0xc4a1,0x0000,0x0000,0x0000,0xf5eb,0xf5e8,
-0xf5e9,0x0000,0xf5e7,0xf5ea,0xc4f2,0xf5ec,0x0000,0xc4f1,
-0x0000,0xf742,0x0000,0xc5d5,0xc5d7,0xf7ee,0xc5d6,0xf8b9,
-0xf940,0xf942,0xf8fe,0xf941,0xc66c,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x7f00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa6ce,0x0000,
-0xacfb,0xd26f,0xafca,0x0000,0x0000,0xb2da,0xdafc,0xdafd,
-0x0000,0x0000,0x0000,0xeadf,0xc16a,0xede1,0x0000,0x0000,
-0xc2bb,0x0000,0xf2ba,0xf2b9,0xc4a2,0xf5ed,0x0000,0xf743,
-0xc5f8,0xca49,0x0000,0x0000,0xaac9,0xa875,0x0000,0x0000,
-0xd04d,0x0000,0x0000,0xd360,0xd35b,0xd35f,0xd35d,0xafcb,
-0xd35e,0xd35c,0x0000,0xd6f1,0x0000,0xdafe,0xdb40,0xdf69,
-0xdf6a,0xb86e,0xb86f,0xdf68,0xdf6b,0xdf67,0xb86d,0x0000,
-0xbb40,0x0000,0xb870,0xe37a,0x0000,0xbd7c,0xe6f1,0xbd7d,
-0x0000,0xbfa9,0xeae2,0xeae0,0xeae1,0xede4,0xede3,0xede2,
-0x0000,0x0000,0x0000,0xf2bb,0x0000,0xc3b9,0xf2bc,0xf744,
-0xc5f9,0xf8ba,0xa6cf,0xaacb,0xaaca,0xd04f,0xacfc,0x0000,
-0x0000,0xd04e,0xd362,0x0000,0xafcc,0xd6f2,0xd361,0x0000,
-0x0000,0x0000,0xb2dc,0xd6f5,0xd6f3,0xd6f4,0xb2db,0x0000,
-0xdb42,0xdb43,0xdb41,0x0000,0xb873,0xdf6d,0xdf6c,0xdf6e,
-0xb872,0xb871,0x0000,0x0000,0xe6f2,0xe6f4,0x0000,0xbd7e,
-0xe6f3,0xeae3,0xbfaa,0xf079,0x0000,0xf078,0xc3bb,0xf2bd,
-0xc3bd,0xc3bc,0xf4b0,0xf5ee,0xc4f3,0xa6d0,0xd050,0xacfd,
-0xd365,0xafce,0xd364,0xd363,0x0000,0xafcd,0x0000,0xd6fb,
-0x0000,0xd6fd,0xd6f6,0xd6f7,0xb2dd,0xd6f8,0xb2de,0xd6fc,
-0xd6f9,0xd6fa,0xb2df,0x0000,0xb5be,0xb5bf,0x0000,0xdb44,
-0x0000,0x0000,0x0000,0xdf6f,0xdf70,0x0000,0xe37e,0xbb43,
-0xbb41,0xbb42,0xe37b,0xe37c,0x0000,0xe37d,0xe6f9,0x0000,
-0xe6fa,0xbda1,0xe6f7,0xe6f6,0xe6f8,0xe6f5,0xbfad,0xeae4,
-0xbfab,0xbfac,0xede6,0xc16b,0xede5,0xefa8,0x0000,0xf07a,
-0xf07b,0xc2bc,0x0000,0xc2bd,0xc16c,0xf2be,0xf2bf,0xf4b1,
-0xc4a3,0xa6d1,0x0000,0xa6d2,0xacfe,0xaacc,0xafcf,0xd051,
-0x0000,0x0000,0x0000,0xb5c0,0xa6d3,0xad41,0xd052,0xd053,
-0xad40,0xad42,0xa6d4,0x0000,0xd054,0xafd1,0xd366,0xafd3,
-0xafd0,0xafd2,0x0000,0xd741,0xb2e0,0x0000,0xd740,0xd6fe,
-0x0000,0xdf71,0x0000,0x0000,0xe3a1,0x0000,0xbda2,0x0000,
-0xbfae,0xeae6,0xeae5,0x0000,0xede7,0x0000,0x0000,0x0000,
-0xf5ef,0x0000,0x0000,0xa6d5,0xcb73,0xcdaa,0xad43,0xd055,
-0x0000,0xd368,0x0000,0x0000,0x0000,0xafd4,0xd367,0xafd5,
-0x0000,0x0000,0x0000,0xd743,0x0000,0x0000,0xb2e2,0xd742,
-0xd744,0x0000,0xb2e1,0x0000,0x0000,0x0000,0x0000,0xdb46,
-0xdb47,0xdb45,0xb5c1,0x0000,0x0000,0x0000,0xb874,0x0000,
-0xb875,0x0000,0xbb45,0x0000,0xe3a3,0xe3a2,0xbb44,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xe6fb,0x0000,0x0000,0xe6fc,
-0x0000,0x0000,0x0000,0x0000,0xeae7,0x0000,0x0000,0xc170,
-0xc16f,0xc16d,0xc16e,0xc171,0x0000,0xf07c,0xc2bf,0xc2be,
-0xf2c0,0xf4b2,0x0000,0x0000,0x0000,0xc5a5,0xc5a4,0xa6d6,
-0x0000,0x0000,0xd1fb,0x0000,0xb877,0xb5c2,0xb876,0xbb46,
-0x0000,0xa6d7,0xc9a9,0xa6d8,0xa6d9,0x0000,0x0000,0xcdab,
-0xcb76,0x0000,0xcb77,0xa877,0x0000,0xcb74,0xa876,0x0000,
-0xa879,0xcb75,0xa87b,0xa87a,0xcb78,0xa878,0x0000,0x0000,
-0x0000,0xaad1,0xaacf,0xcdad,0x0000,0xaace,0x0000,0x0000,
-0x0000,0xaad3,0xaad5,0xaad2,0x0000,0xcdb0,0xcdac,0xaad6,
-0x0000,0xaad0,0xa87c,0x0000,0xaad4,0xcdaf,0x0000,0x0000,
-0xcdae,0x0000,0xaacd,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd05b,0xad47,0xad48,0xd05d,0x0000,0xd057,
-0xd05a,0xd063,0xd061,0x0000,0xad49,0xd067,0xad4c,0xd064,
-0xd05c,0xd059,0x0000,0x0000,0xdb49,0xd062,0xad44,0xd065,
-0xd056,0xd05f,0xad46,0xad4b,0xd060,0xad4f,0xad4d,0x0000,
-0xd058,0xad4a,0x0000,0xd05e,0xad4e,0xad45,0xd066,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xafda,0x0000,0xafe3,
-0xafd8,0xafd6,0xd36a,0xafde,0xafdb,0xd36c,0x0000,0x0000,
-0xafdd,0xd36b,0xd369,0xd36e,0xafe2,0xafe0,0xdb48,0x0000,
-0xd36f,0xd36d,0xafd7,0x0000,0x0000,0xafd9,0xafdc,0x0000,
-0xafdf,0x0000,0xafe1,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd74e,0xb2e4,0x0000,
-0xd745,0xd747,0x0000,0xd748,0x0000,0xd750,0xd74c,0xd74a,
-0x0000,0xd74d,0xd751,0xb2e5,0xb2e9,0xd746,0x0000,0xd74f,
-0x0000,0xb2e7,0x0000,0xb2e6,0xd74b,0xd749,0x0000,0xb2e3,
-0xb2e8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xb5c8,0xdb51,0x0000,0x0000,0xdb4f,0xb5ca,0x0000,
-0x0000,0x0000,0x0000,0xdb4a,0xdfa1,0x0000,0xb5c9,0xdb4e,
-0x0000,0x0000,0xdb4b,0xb5c5,0xb5cb,0xdb50,0xb5c7,0xdb4d,
-0xbb47,0xb5c6,0xdb4c,0xb5cc,0xb5c4,0xb5c3,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xdf77,0xdf75,0x0000,0xdf7b,0x0000,
-0xdf73,0xdfa2,0xdf78,0x0000,0xdf72,0xb87b,0xb8a3,0xdf7d,
-0x0000,0xdf76,0x0000,0xb87e,0x0000,0x0000,0xb87c,0xdf7e,
-0xb879,0xb878,0xdf79,0xb87d,0xb5cd,0x0000,0xdf7c,0xdf74,
-0xb87a,0xb8a1,0xb8a2,0x0000,0x0000,0x0000,0x0000,0xbb4c,
-0xbb48,0x0000,0xbb4d,0xe3a6,0x0000,0x0000,0xe3a5,0xe3a7,
-0xbb4a,0xe3a4,0xbb4b,0xe3aa,0xe3a9,0xe3a8,0x0000,0xbb49,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe741,0x0000,0xe744,
-0xbda8,0xe743,0xbda7,0xbda3,0xbda4,0xbda5,0xe740,0xe6fe,
-0xbda6,0x0000,0xe742,0xe6fd,0x0000,0x0000,0xeae9,0xeaf3,
-0xbfb1,0xbfb0,0x0000,0xeaed,0xeaef,0x0000,0xeaea,0x0000,
-0xeaee,0xeae8,0xeaf1,0xbfaf,0xeaf0,0xeaec,0x0000,0xeaf2,
-0x0000,0xeaeb,0xc174,0xede8,0xedee,0xc178,0xc17a,0xc177,
-0xc176,0x0000,0xc175,0xc173,0xede9,0xedec,0xc172,0xeded,
-0x0000,0xc179,0xedeb,0x0000,0xedea,0xc2c0,0x0000,0xc2c1,
-0xf0a1,0xf07d,0xf07e,0x0000,0x0000,0xf2c2,0x0000,0xf2c1,
-0xc3be,0xf4b4,0xc4a4,0xf4b3,0x0000,0xf5f0,0xf745,0xc5a6,
-0xf943,0xf944,0xc5d8,0xa6da,0x0000,0xaad7,0xdb52,0xbb4e,
-0xc17b,0xedef,0xa6db,0x0000,0xafe5,0xafe4,0xdb53,0x0000,
-0x0000,0x0000,0xeaf4,0xa6dc,0xad50,0x0000,0x0000,0xdb54,
-0xdb55,0xdb56,0xbb4f,0xbfb2,0xa6dd,0x0000,0xaad8,0xd068,
-0xafe6,0xd370,0xb2ea,0x0000,0xdb57,0xb8a4,0x0000,0xbb50,
-0xbfb3,0xc17c,0xc2c2,0xf4b5,0xa6de,0xaad9,0x0000,0x0000,
-0xafe7,0xd752,0xb5ce,0x0000,0xbb51,0xe3ab,0xe745,0x0000,
-0x0000,0x0000,0x0000,0xa6df,0xb5cf,0xdfa3,0xbb52,0xa6e0,
-0xcdb1,0xd069,0xad51,0x0000,0x0000,0xd372,0x0000,0x0000,
-0xafea,0x0000,0xafe8,0xafe9,0xafeb,0x0000,0x0000,0xd371,
-0x0000,0x0000,0xd757,0xd754,0xd756,0xb2eb,0xb2ed,0xb2ec,
-0xd753,0xb2ee,0xd755,0x0000,0xdb58,0xdb59,0x0000,0xdb5a,
-0xdfa6,0x0000,0xdfa7,0x0000,0xdfa5,0xdfa8,0x0000,0xb8a5,
-0x0000,0xdfa4,0x0000,0xbb53,0x0000,0x0000,0xe74a,0xe746,
-0xe749,0xe74b,0xe748,0xe747,0x0000,0xeaf5,0xeaf6,0xeaf7,
-0xbfb4,0xbfb5,0xedf1,0xedf0,0xedf2,0x0000,0xf0a3,0xf0a2,
-0x0000,0xf2c4,0x0000,0xf2c5,0xf2c3,0x0000,0xc4a5,0x0000,
-0xf4b6,0xf4b7,0x0000,0xf746,0xf7ef,0xf8bb,0xa6e1,0xa87d,
-0x0000,0xc17d,0xa6e2,0x0000,0xd758,0xdb5b,0x0000,0xc641,
-0xca4a,0x0000,0x0000,0x0000,0xca4b,0xca4d,0xa6e3,0xca4e,
-0xca4c,0x0000,0x0000,0xcba2,0xcba3,0xcb7b,0x0000,0x0000,
-0x0000,0x0000,0xcba1,0xa8a1,0x0000,0xa8a2,0xcb7c,0xcb7a,
-0xcb79,0xcb7d,0xa87e,0xcb7e,0xd06a,0x0000,0x0000,0x0000,
-0xcdb6,0xaadc,0xcdb5,0xcdb7,0x0000,0xaadb,0xcdbc,0xaadf,
-0xcdb2,0xcdc0,0xcdc6,0xaae6,0xcdc3,0xaae3,0x0000,0xcdb9,
-0xcdbf,0xcdc1,0x0000,0xcdb4,0xaae2,0xaadd,0xcdba,0xaae4,
-0xaae7,0xaae1,0x0000,0xaada,0xcdbe,0xcdb8,0xcdc5,0xaae9,
-0xaae5,0xaae0,0xcdbd,0xafec,0xcdbb,0xaade,0xaae8,0x0000,
-0xcdb3,0x0000,0xcdc2,0xcdc4,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xad62,0xad5c,0xad64,0xad61,0xd071,0xd074,0xad5d,
-0x0000,0xd06b,0x0000,0xad56,0xad60,0x0000,0xad63,0xad65,
-0xd0a2,0xd077,0x0000,0xad55,0xd0a1,0xad59,0xad57,0xad52,
-0xd06f,0x0000,0xd07e,0xd073,0xd076,0xd0a5,0x0000,0xad66,
-0xd07d,0xad5e,0xd078,0xd0a4,0xd075,0xd079,0xd07c,0x0000,
-0x0000,0xd06d,0xd0a3,0xd07b,0x0000,0x0000,0xd06c,0x0000,
-0xd070,0xad5f,0xad5a,0xad53,0xad58,0xad54,0xad67,0xd06e,
-0xd3a5,0xad5b,0x0000,0x0000,0xd07a,0xce41,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd3a8,0xaffa,
-0x0000,0xd376,0x0000,0xd3a3,0xd37d,0x0000,0xd3b2,0x0000,
-0xd3aa,0x0000,0xd37e,0x0000,0xd3a9,0xd378,0xd37c,0xd3b5,
-0xaffd,0xd3ad,0xd3a4,0xafed,0xd3b3,0xd374,0x0000,0xd3ac,
-0x0000,0xaffc,0xaff7,0xd373,0xaff5,0xaff4,0xaff9,0xd3ab,
-0xaff1,0xaff8,0xd072,0xdb5c,0xd3a6,0x0000,0x0000,0xd37a,
-0xaffb,0xd37b,0xd3a1,0xaffe,0xd375,0xd3af,0x0000,0xd3ae,
-0xd3b6,0xaff3,0xaff0,0xd3b4,0xd3b0,0xd3a7,0xd3a2,0xaff6,
-0xaff2,0xd377,0xafee,0xd3b1,0xafef,0x0000,0xd379,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xd75e,0xd760,0xd765,0xd779,0xb2fc,
-0xb2f2,0x0000,0xd75d,0xb2fd,0xb2fe,0xd768,0xd76f,0xd775,
-0x0000,0xd762,0x0000,0xd769,0x0000,0x0000,0xb340,0xd777,
-0xd772,0xb2fa,0xb2f8,0xd76e,0xd76a,0xd75c,0xb2ef,0xd761,
-0xd759,0x0000,0xb2f7,0xb2f9,0xd766,0xd763,0xb2f4,0xd773,
-0xb2f1,0xd764,0xd77a,0xd76c,0x0000,0xd76b,0xb2f0,0x0000,
-0xb2fb,0x0000,0xb2f3,0xd75a,0xd75f,0xd770,0xd776,0xb341,
-0xd75b,0xd767,0xd76d,0xb2f6,0x0000,0x0000,0xd778,0xd771,
-0xd774,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xb2f5,0x0000,0xdb6c,
-0xdb60,0xb5d7,0xdb7d,0xdba7,0xdbaa,0xb5d5,0xdb68,0xdba3,
-0xdb69,0xdb77,0xb5e2,0xdb73,0xb5df,0x0000,0xdb74,0xdb5d,
-0x0000,0xdba4,0x0000,0x0000,0xb5e8,0xdba1,0xdb75,0xdbac,
-0xdb70,0xdfc8,0x0000,0xdbaf,0xb5e6,0xdb6e,0xdb7a,0xb5e9,
-0xb5d4,0xdb72,0xdbad,0xdb6b,0xdb64,0xdb6f,0x0000,0xdb63,
-0xdb61,0xb5d0,0xdba5,0xdb6a,0xdba8,0x0000,0xdba9,0xb5d8,
-0xb5dd,0xb5d9,0xb5e1,0xdb7e,0xb5da,0xdb76,0xdb66,0x0000,
-0xb5d2,0xdb5e,0xdba2,0xdbab,0xdb65,0xb5e0,0xdbb0,0xdb71,
-/* 0x8400 */
-0x0000,0xdb6d,0x0000,0xb5d1,0xb5e5,0x0000,0xdb7c,0xb5e7,
-0x0000,0xdb78,0xb5dc,0xb5d6,0xb5de,0xb5d3,0xb5e4,0xdb79,
-0xdb67,0xdb7b,0xdb62,0xdba6,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xdbae,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xdb5f,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xdfc7,0x0000,0xdfdd,0xb855,0xdfcc,0x0000,0xdfca,
-0xdfb5,0xb8a9,0xdfc5,0xdfd9,0xdfc1,0xb8b1,0xdfd8,0xdfbf,
-0xb5e3,0xdfcf,0xdfc0,0xdfd6,0xb8b0,0xb8a8,0x0000,0xdfaa,
-0xdfb2,0x0000,0xdfcb,0xdfc3,0xdfdc,0xdfc6,0xb8b6,0xdfd7,
-0x0000,0xb8ad,0x0000,0xdfc9,0xdfd1,0xdfb6,0xdfd0,0x0000,
-0xdfe1,0xdfb1,0xdfd2,0x0000,0xdfdf,0x0000,0xdfab,0xb5db,
-0x0000,0xdfb9,0xdfb8,0xb8af,0x0000,0xdfbc,0xdfbe,0xdfcd,
-0xdfde,0xb8b2,0x0000,0xb8b3,0x0000,0xdfb0,0xb8ab,0xdfb4,
-0xdfda,0xb8b4,0x0000,0xb8ac,0xb8ae,0xb8b5,0xdfe0,0xdfd3,
-0xdfce,0x0000,0x0000,0xdfbb,0xdfba,0xb8aa,0xdfac,0xb8a7,
-0xdfc4,0xdfad,0xdfc2,0x0000,0x0000,0xdfb7,0xdfdb,0x0000,
-0x0000,0x0000,0xb8a6,0x0000,0x0000,0x0000,0xdfb3,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xdfaf,0xdfd5,0xdfae,
-0xbb60,0xe3d3,0x0000,0x0000,0xe3c2,0x0000,0x0000,0xe3ac,
-0xe3ca,0xbb58,0xe3bb,0xe3c5,0xbb5b,0xe3be,0xbb59,0xe3af,
-0xe3cd,0xe3ae,0xe3c1,0x0000,0xe3ad,0x0000,0x0000,0xe3bf,
-0xe3c8,0xe3c6,0xe3ba,0xe3b5,0xe3b3,0x0000,0xe3b4,0xe3c7,
-0xe3d2,0xe3bc,0xbb5a,0x0000,0xe3b7,0x0000,0xe3cb,0x0000,
-0xbb5d,0xe3b6,0xe3b0,0xe3c0,0xbb61,0x0000,0x0000,0xbb55,
-0xbb5e,0xe3b8,0xe3b2,0x0000,0xbb57,0xdfd4,0xbb56,0xe3c3,
-0x0000,0xbb54,0xbb63,0xbb5c,0xe3c4,0xe3b9,0xe3b1,0xe3cc,
-0xe3bd,0xbb62,0xe3d0,0xbb5f,0xe3cf,0x0000,0xe3c9,0xe3ce,
-0x0000,0x0000,0x0000,0xe3d1,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe773,
-0xe774,0xe767,0xe766,0xe762,0xbdb4,0x0000,0xbdac,0xe776,
-0xe775,0xdfa9,0xe75f,0xe763,0xe75d,0x0000,0xe770,0xe761,
-0x0000,0xe777,0xe75a,0xe758,0xe764,0xe76e,0xe769,0xbdb6,
-0xe74f,0x0000,0xe76d,0x0000,0x0000,0x0000,0xbdb7,0xdfbd,
-0xe75b,0xe752,0xe755,0xe77b,0xe75c,0xe753,0xe751,0xe74e,
-0x0000,0xbdb0,0xe765,0xbdaf,0xbdb3,0xe760,0xe768,0xbda9,
-0xe778,0xe77c,0xbdab,0x0000,0xe757,0xe76b,0xe76f,0xe754,
-0xe779,0xbdb2,0x0000,0xbdb1,0xe74c,0xbdb5,0xe772,0xe756,
-0xe76a,0xe750,0xe75e,0xe759,0xbdad,0xbdae,0xe76c,0xe77d,
-0xe77a,0xe771,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xe74d,0x0000,0xbdaa,0xeb49,0x0000,
-0xeb40,0xeb43,0x0000,0xbfbb,0xeb45,0xeaf9,0xeb41,0xeb47,
-0xbfb8,0xbfbc,0xbfb6,0x0000,0x0000,0xeafb,0xeb4c,0x0000,
-0x0000,0xeb46,0x0000,0xeafc,0xeb55,0xeb4f,0xeaf8,0xee46,
-0xeafe,0xbfb7,0x0000,0xeb4a,0x0000,0xeb54,0xbfbf,0x0000,
-0xeb51,0xeafd,0xeb44,0xeb48,0xeb42,0xeb56,0xeb53,0xeb50,
-0xbfb9,0xbfba,0xbfbe,0xeafa,0xeb57,0xbfbd,0xeb4d,0x0000,
-0x0000,0xeb4b,0x0000,0x0000,0x0000,0xeb4e,0xee53,0xee40,
-0xee45,0xee52,0xee44,0xedfb,0xee41,0x0000,0xc1a2,0x0000,
-0xedf4,0xee4d,0xee4f,0xedf3,0xc1a1,0xee51,0xee49,0xc1a8,
-0xee50,0xee42,0xc1aa,0xedf9,0xeb52,0xee4a,0xee47,0xedf5,
-0xee55,0xc1a4,0x0000,0x0000,0xc1a5,0xedf7,0xee48,0x0000,
-0xee54,0xee4b,0xedfd,0xc1a7,0xc1a3,0xee4c,0xedfe,0xee56,
-0xedf8,0xee43,0xee4e,0xedfa,0xedfc,0x0000,0xc2cb,0xedf6,
-0xc1a9,0xc2c4,0xc17e,0x0000,0x0000,0x0000,0x0000,0xc1a6,
-0xc2c8,0xf0b3,0x0000,0xf0a9,0xf0a4,0xf0aa,0xf0b4,0xf0b8,
-0xf0b7,0xc2ca,0xc2c9,0x0000,0x0000,0xf0ab,0xf0b9,0xf0ae,
-0xf0a6,0x0000,0xf0a8,0xf0a7,0xf0ad,0xf0b2,0xf0a5,0xf0ac,
-0xf0b1,0xc2c7,0x0000,0xf0af,0x0000,0xc2c5,0xf0b0,0xc2c3,
-0xc2c6,0xf2d5,0xf0b5,0x0000,0x0000,0xc3c2,0x0000,0xf2cd,
-0xf2d1,0xf2c9,0xf2cc,0x0000,0xf2d4,0xc3c0,0xf2d9,0xf2d2,
-0x0000,0xf2ca,0xf2da,0xf2d3,0xc3c3,0xc3c4,0xf2d7,0x0000,
-0xf2cb,0xc3bf,0xc3c1,0xf2c6,0xf2ce,0xf2c8,0x0000,0xf2d8,
-0xf2d6,0xf2c7,0xf2cf,0x0000,0x0000,0x0000,0xf4be,0xc3c5,
-0xf2d0,0xc4a7,0xc4a9,0xc4a6,0x0000,0xf4c3,0xf4bb,0xf4b9,
-0xf4bd,0xf4ba,0x0000,0x0000,0xf4bf,0xf4c1,0xc4aa,0xc4ac,
-0x0000,0xf4c0,0xc4ad,0xc4ab,0xf4c2,0x0000,0x0000,0x0000,
-0x0000,0xc4a8,0x0000,0x0000,0x0000,0x0000,0x0000,0xc4f4,
-0xf5f1,0xf5f7,0xc4f6,0xf4bc,0xf5f6,0x0000,0xf5fd,0xf5f4,
-0xf5fb,0xf5fa,0xf4b8,0xf5f5,0xf0b6,0xf5fe,0xf5f3,0xf5f8,
-0x0000,0xf5fc,0xf5f2,0x0000,0xf74a,0xc4f5,0xf5f9,0x0000,
-0x0000,0xf7f4,0xf74b,0xf749,0xf747,0xf748,0xf74c,0x0000,
-0xc5d9,0xf7f2,0xf7f0,0xf7f5,0xf7f3,0x0000,0xf7f6,0xc5da,
-0xf7f1,0x0000,0x0000,0xf8bc,0x0000,0x0000,0xf945,0xf946,
-0xf947,0x0000,0x0000,0xf9c7,0xf9bd,0xca4f,0xaaea,0x0000,
-0xad68,0x0000,0xd3b8,0xd3b7,0xb040,0xb342,0xd77c,0x0000,
-0x0000,0xd77b,0x0000,0xb5ea,0xb8b8,0x0000,0xb8b7,0xb8b9,
-0x0000,0xe3d4,0xe77e,0xeb58,0xeb5a,0xeb59,0x0000,0xc1ab,
-0xee57,0xf0ba,0xf9a5,0xa6e4,0x0000,0xcdc9,0xcdca,0xcdc8,
-0xcdc7,0xaaeb,0x0000,0xd0a9,0xd0a7,0x0000,0x0000,0xd0a6,
-0x0000,0xad69,0xad6b,0xad6a,0xd0a8,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xd3c4,0xd3c1,0xd3bf,
-0x0000,0x0000,0xb041,0xd3c2,0xb046,0xd3bc,0xd3cb,0x0000,
-0xd3cd,0xd3bd,0x0000,0xb043,0xd3ce,0xd3c9,0xd3bb,0xd3c0,
-0xd3ca,0xd3c6,0xd3c3,0x0000,0xb048,0xd3cc,0xd3be,0x0000,
-0x0000,0xd3c7,0xd3b9,0xb047,0xb044,0xd3c5,0x0000,0xd3c8,
-0xd3ba,0xb045,0xb042,0x0000,0x0000,0x0000,0x0000,0xb34c,
-0xd7a5,0xb34b,0x0000,0xd7a8,0xd7ab,0xb348,0xb346,0xd77e,
-0xd7a9,0xd7a7,0xd7a4,0xd7ac,0xd7ad,0xd7af,0xd7b0,0xd77d,
-0xb345,0xd7a2,0xd7a1,0xd7ae,0xb347,0xd7a3,0xb349,0xb344,
-0xd7a6,0xb34d,0x0000,0xb34a,0xd7aa,0x0000,0x0000,0x0000,
-0xb5f1,0xdbbf,0x0000,0xdbb4,0xb5ee,0x0000,0xdfe7,0xdbbd,
-0xdbb1,0xb5ec,0xdbb6,0xb5ef,0xdbba,0xdbb8,0xb5f2,0xb5eb,
-0x0000,0x0000,0xdbb2,0xdbb5,0xb5f0,0x0000,0xdbb3,0x0000,
-0xdbbe,0xdbbc,0xdbb7,0xdbb9,0xdbbb,0xb5ed,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xdfe8,0xdfee,0xdfe4,
-0xdfea,0xb8ba,0xdfe6,0xb8c0,0x0000,0x0000,0xb8bf,0x0000,
-0xb8be,0xdfed,0xb8c1,0xb8c2,0xdfe3,0xdff0,0xb8c3,0xb8bd,
-0xb8bc,0xdfec,0xb8c4,0xdfe2,0xdfe5,0xdfef,0xdfeb,0x0000,
-0x0000,0xe3f4,0xe3e9,0xb8bb,0x0000,0x0000,0x0000,0x0000,
-0xbb6a,0xe3dd,0xe3f2,0xe3de,0xbb65,0x0000,0xe3db,0x0000,
-0xe3e4,0xe3dc,0xbb67,0xe3d6,0xe3f1,0xbb68,0xe3ee,0xe3ef,
-0xe3d7,0xbb6d,0xe3e6,0x0000,0xe3e0,0xe3e7,0xe3da,0x0000,
-0xe3f3,0xe3eb,0xe3e5,0xe3d5,0xbb69,0xe3ec,0x0000,0xbb6c,
-0xe3f0,0x0000,0xe3ea,0xbb66,0xe3e8,0x0000,0xe3e2,0xbb64,
-0xe3d9,0xe3e1,0xe3ed,0xe3df,0x0000,0x0000,0xe3e3,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xbdc1,0xdfe9,0xe7b2,0xe7bb,
-0xe7b1,0xe7ad,0xe7aa,0xbdc2,0xe7a8,0xbb6b,0xe7a1,0xbdc0,
-0xe7a7,0xbdbf,0xe7ac,0xe7a9,0xe7b9,0xe7b4,0xe7ae,0xe7b3,
-0xbdbb,0xe7ab,0xe7be,0xe7a2,0xe7a3,0xe7ba,0xbdbc,0xe7bf,
-0xbdbe,0xe7c0,0xe7b0,0xe3d8,0xe7b6,0xe7af,0xe7b8,0xe7b5,
-0x0000,0x0000,0x0000,0xe7a6,0xbdb9,0xe7bd,0xbdba,0xe7a4,
-0xbdbd,0xeb64,0xe7b7,0xe7bc,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xeb61,0xbdb8,0xbfc0,0xeb6b,0xeb67,0x0000,0xeb65,
-0xeb60,0xeb6f,0x0000,0x0000,0x0000,0xbfc4,0x0000,0xeb5c,
-0xeb68,0xeb69,0xeb5f,0xeb5e,0xeb6c,0x0000,0xeb62,0xeb5d,
-0xeb63,0x0000,0xeb6e,0xeb5b,0xeb6d,0xeb6a,0xbfc2,0xbfc1,
-0x0000,0x0000,0xbfc3,0xeb66,0xf0cb,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xee59,0xc1b1,0xee5d,0xee5a,0xee61,0xee67,
-0xee5c,0x0000,0xee70,0xc1ae,0xee6a,0xee5f,0xee6b,0xee66,
-0xee6d,0xee5e,0xc1b3,0xc1b2,0xee60,0xee6e,0xee58,0xee6c,
-0xc1ac,0x0000,0xee64,0xee63,0xee68,0xee5b,0xc1b0,0x0000,
-0xc1b4,0xee62,0xee69,0xc1b5,0xee65,0x0000,0x0000,0x0000,
-0x0000,0xc1ad,0xc1af,0xf0c7,0xf0c5,0x0000,0x0000,0xf0cc,
-0xf0c9,0xf0cd,0x0000,0xf0be,0xf0c6,0xf0d1,0xee6f,0xf0c2,
-0xc2cf,0xe7a5,0xf0bd,0xf0ca,0xf0c4,0xf0c1,0xf0bc,0xf0bb,
-0xf0d0,0x0000,0xf0c0,0xf0bf,0xc2cd,0xf0c8,0x0000,0xc2cc,
-0x0000,0x0000,0xc2ce,0xf0c3,0xf0cf,0x0000,0xf2de,0xf2df,
-0x0000,0xc3c9,0xf2dc,0xc3c6,0xf2e4,0x0000,0xc3ca,0xf2e6,
-0xf2db,0xf0ce,0xf2e8,0xf2dd,0x0000,0xc3c7,0xf2e3,0x0000,
-0xf2e5,0xf2e0,0xf2e7,0xf2e2,0xf2e1,0xc3c8,0x0000,0x0000,
-0xf4c5,0xf4c6,0x0000,0xf4c8,0xc4ae,0xc4af,0xf4c9,0xf4c7,
-0x0000,0xf4c4,0x0000,0xf642,0xf645,0xf641,0x0000,0xc4fa,
-0xf643,0xc4f9,0xc4f8,0xc4f7,0xf644,0xf751,0xf74f,0x0000,
-0xf74e,0xf640,0xf750,0xf646,0xf74d,0x0000,0xf7f9,0xf7d7,
-0xf7f7,0xc5db,0xf7f8,0xf7fa,0x0000,0xf8bf,0xc5fa,0xf8be,
-0xf8bd,0xc5fb,0x0000,0xc65a,0xf96e,0xf9a7,0xf9a6,0xf9a8,
-0xa6e5,0xd0aa,0x0000,0xd3cf,0xd3d0,0x0000,0x0000,0x0000,
-0xdbc0,0x0000,0xf647,0xf8c0,0xa6e6,0xad6c,0xd0ab,0x0000,
-0x0000,0x0000,0xd7b1,0xb34e,0x0000,0xdbc2,0xdbc1,0xb5f3,
-0x0000,0xb8c5,0xe7c1,0xbdc3,0x0000,0xbdc4,0x0000,0x0000,
-0x0000,0xbfc5,0xc5fc,0xa6e7,0x0000,0x0000,0x0000,0xd0ac,
-0xaaed,0xd0ae,0xd0ad,0xad6d,0x0000,0xd3d1,0x0000,0xd3d8,
-0xb049,0xd3d6,0xd3d4,0x0000,0xd3db,0xd3d2,0xd3d3,0xb04a,
-0x0000,0xb04e,0x0000,0x0000,0xd3dc,0xb04d,0xd3da,0xd3d7,
-0xd3d5,0xb04b,0xb04c,0xd3d9,0x0000,0x0000,0x0000,0x0000,
-0xb350,0xd7b2,0x0000,0xb355,0xd7c2,0xb354,0xd7c4,0x0000,
-0x0000,0xd7b8,0xb352,0xd7c3,0x0000,0xd7b3,0xb353,0xd7bf,
-0xd7bb,0xd7bd,0xd7b7,0xd7be,0x0000,0x0000,0xb34f,0xd7ba,
-0x0000,0xd7b9,0xd7b5,0x0000,0xd7c0,0x0000,0x0000,0xd7bc,
-0xd7b4,0x0000,0xd7b6,0xb351,0xd7c1,0x0000,0x0000,0x0000,
-0x0000,0xb5f6,0xdbcd,0x0000,0x0000,0x0000,0xdbc9,0xdbcb,
-0xdbc6,0xdbc5,0xdbc3,0x0000,0xdbca,0xdbcc,0xdbc8,0x0000,
-0xdbc7,0xb5f4,0xb5f5,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xdbcf,0xb8cd,0xdff2,0xdff8,0xdff3,0xdff4,0xf9d8,
-0xdff9,0x0000,0xb8cf,0x0000,0xb8c7,0xb8ce,0xdff1,0xdbc4,
-0xb8ca,0xb8c8,0xdff7,0xdff6,0xb8c9,0xb8cb,0xdff5,0xb8c6,
-0x0000,0xb8cc,0x0000,0x0000,0x0000,0x0000,0x0000,0xe3f6,
-0xbb74,0x0000,0x0000,0xe442,0xe441,0x0000,0xe3fb,0xbb76,
-0xe440,0xe3f7,0xe3f8,0xbb6e,0xbb70,0x0000,0xe3fd,0xe3f5,
-0xbb72,0xbb71,0xe3f9,0xe3fe,0xe3fc,0xbb73,0xe3fa,0x0000,
-/* 0x8900 */
-0x0000,0xdbce,0xbb6f,0x0000,0x0000,0xe7c2,0xe7c9,0xbdc6,
-0x0000,0xe7cd,0xbdca,0xe7c5,0xe7c3,0x0000,0xe7cc,0x0000,
-0xbdc5,0xe7cb,0xbdc7,0xbdc8,0xe7c4,0xbdc9,0xe7ca,0xe7c6,
-0xe7c7,0xe7c8,0xbb75,0x0000,0x0000,0x0000,0xeb70,0xeb7c,
-0x0000,0xbfca,0xeb77,0xeb79,0x0000,0xbfc8,0xeb71,0xeb75,
-0x0000,0xeb78,0xbfc6,0xbfc9,0xeb7b,0xeb73,0xeb74,0xeb7a,
-0xeb72,0xeb76,0xbfc7,0xee72,0x0000,0xee71,0xc1b7,0xee77,
-0xc1b9,0x0000,0x0000,0xc1b6,0xee73,0xc1ba,0xee74,0x0000,
-0x0000,0xee75,0xee78,0x0000,0xc1b8,0x0000,0xf0d6,0x0000,
-0x0000,0xf0d9,0x0000,0xf0d3,0xf0d5,0x0000,0x0000,0xf0d4,
-0xf0d7,0xf0d8,0xee76,0xf0d2,0x0000,0x0000,0xc3cd,0xf2ec,
-0xf2ef,0xf2f1,0xf2ea,0xf2eb,0xf2ee,0xf2f0,0xc3ce,0xc3cc,
-0xc3cb,0xf2ed,0xf2e9,0xf4ca,0xc4b0,0x0000,0xf4cb,0x0000,
-0x0000,0xf649,0xc4fb,0xf64b,0xc4fc,0xf648,0xf64a,0xc5a8,
-0x0000,0xf752,0xc5a7,0xf7fd,0xf7fc,0x0000,0xf7fb,0x0000,
-0x0000,0xf948,0xf949,0xf94b,0xf94a,0x0000,0xca50,0xa6e8,
-0x0000,0xad6e,0xd7c5,0xb5f7,0x0000,0xdffa,0xc2d0,0x0000,
-0xf2f2,0x0000,0x0000,0xa8a3,0x0000,0x0000,0x0000,0xb357,
-0x0000,0x0000,0x0000,0xb356,0x0000,0xdbd0,0xb5f8,0xdbd2,
-0xdbd1,0x0000,0x0000,0xdffb,0xb8d0,0xe443,0xe446,0xe445,
-0x0000,0xe444,0xe7ce,0xe7d0,0xe7cf,0x0000,0xbfcc,0x0000,
-0x0000,0x0000,0xbfcb,0x0000,0xc1bb,0xee79,0xee7b,0xee7a,
-0x0000,0x0000,0xc2d1,0x0000,0x0000,0x0000,0xf2f4,0xf2f3,
-0x0000,0xf4cc,0xc4b1,0x0000,0x0000,0xc4fd,0xf754,0xf753,
-0xc65b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xa8a4,0xd0af,0xad6f,0xd7c8,0xd7c6,0x0000,
-0x0000,0xd7c7,0xdbd4,0xdbd5,0xe043,0xdbd3,0x0000,0xdffc,
-0xe041,0xe040,0xe042,0xb8d1,0xdffe,0xdffd,0xe044,0x0000,
-0xe449,0xe447,0x0000,0xe448,0xe7d3,0xe7d1,0x0000,0x0000,
-0xe7d2,0xeb7d,0xee7c,0xee7d,0xc2d2,0x0000,0xf2f5,0xf4cd,
-0xc4b2,0x0000,0xf64c,0xf755,0xc5a9,0x0000,0xf7fe,0xf94c,
-0xa8a5,0x0000,0xad71,0xad72,0xd0b0,0x0000,0x0000,0xd0b1,
-0xad70,0x0000,0xb054,0x0000,0xb052,0x0000,0xb051,0xb058,
-0xb050,0xb059,0xd3dd,0xb056,0x0000,0xb053,0xb057,0xb055,
-0xb04f,0x0000,0x0000,0xb35f,0x0000,0xb359,0xd7cc,0xb35e,
-0x0000,0x0000,0xb360,0xb35a,0x0000,0xb35b,0x0000,0xd7ca,
-0x0000,0x0000,0xb358,0x0000,0xd7cb,0xb35d,0x0000,0x0000,
-0xd7c9,0xb35c,0x0000,0x0000,0xb644,0x0000,0xb646,0x0000,
-0x0000,0xdbd8,0xb645,0xb5f9,0xb5fd,0x0000,0xb8e4,0xe049,
-0xdbda,0xb5fe,0x0000,0x0000,0xdbdd,0xdbde,0xb643,0x0000,
-0xdbe0,0x0000,0xdbe2,0x0000,0xdbe3,0xdbd7,0xdbd6,0xdbe4,
-0xb642,0xdbe1,0xdbdf,0x0000,0xb640,0xb5fb,0xb647,0xdbdb,
-0xdbdc,0xdbd9,0x0000,0xb641,0x0000,0x0000,0xb5fc,0x0000,
-0xb5fa,0xe048,0xb8df,0xb8da,0x0000,0x0000,0xb8d5,0x0000,
-0xb8e5,0xb8d6,0x0000,0xb8d2,0xb8e1,0xb8de,0xb8e0,0x0000,
-0xb8d7,0xb8dc,0xb8d3,0xb8d4,0xe050,0xe04d,0xe045,0xe04a,
-0x0000,0xb8e2,0xe051,0xb8e3,0xb8d9,0x0000,0x0000,0xe047,
-0x0000,0xe04f,0xe04b,0xe04e,0xe04c,0xb8dd,0xe046,0xb8d8,
-0x0000,0x0000,0x0000,0xe44c,0xbb78,0xbb7b,0x0000,0xe44e,
-0x0000,0xbba5,0xe44d,0xbb7d,0x0000,0xbdcf,0xe44f,0x0000,
-0xbba4,0xe44b,0xbba6,0x0000,0x0000,0x0000,0xbb79,0x0000,
-0xb8db,0xbb7c,0x0000,0xbb7a,0xbb7e,0xbba2,0xbb77,0xbba7,
-0xbba3,0x0000,0xbba1,0xe44a,0x0000,0x0000,0x0000,0x0000,
-0xbdd6,0x0000,0xbdd2,0x0000,0x0000,0x0000,0xbdd9,0x0000,
-0xe7d6,0xbdda,0xe7e2,0xe7db,0xbdcb,0xe7e3,0xe7dd,0xbdd5,
-0xe7de,0x0000,0xbdd4,0xe7e1,0xbdce,0xe7df,0xe7d5,0xbdcd,
-0xebaa,0xbdd3,0x0000,0xbdd0,0x0000,0xbdd8,0x0000,0xe7d4,
-0x0000,0xe7d8,0xbdcc,0xe7d7,0xe7d9,0xe7da,0xbdd7,0xe7dc,
-0xe7e0,0xe7e4,0x0000,0xbddb,0xbfd2,0xeba5,0xebab,0xeba8,
-0xeb7e,0xebac,0xeba1,0x0000,0xeba7,0x0000,0xbfcd,0xbfd3,
-0xebad,0x0000,0x0000,0xbfcf,0x0000,0xbfd9,0xbfd4,0xebaf,
-0xeba9,0xbfd0,0xeba2,0xbfda,0xeba3,0xeba4,0xbfdb,0xbfd8,
-0xbdd1,0x0000,0xbfce,0xebb0,0xbfdc,0x0000,0xbfd5,0xebae,
-0xbfd1,0xbfd6,0xbfd7,0x0000,0xc1c3,0xeea4,0xeead,0xeeaa,
-0xeeac,0x0000,0xc1c0,0xeea5,0x0000,0xeeab,0xc1bc,0xeea7,
-0xc1c4,0xeea3,0xeea8,0xeeaf,0xeba6,0xeea9,0xeea2,0xc1bd,
-0xeea1,0xc1be,0xeeb0,0xc1bf,0xeeae,0xc1c2,0xee7e,0x0000,
-0xc1c1,0x0000,0xeea6,0xf0dc,0xf0ea,0xf0e5,0xf0e7,0xf0db,
-0xc2d3,0x0000,0xf0da,0xc2d6,0xc2d5,0x0000,0xf0e9,0xf0e1,
-0xf0de,0xf0e4,0x0000,0xf0dd,0x0000,0xf0df,0xf0e8,0xf0e6,
-0x0000,0xc2d4,0xf0ed,0xf0eb,0xf0e2,0xf0ec,0xf0e3,0x0000,
-0xf2f9,0xc3cf,0xf341,0x0000,0x0000,0xf64f,0xc3d6,0xf0e0,
-0xf2f7,0xc3d2,0xf2f8,0xf2fd,0x0000,0x0000,0xc3d4,0xc3d5,
-0xf2f6,0xf340,0xf342,0xf2fa,0xf2fc,0xf2fe,0xf2fb,0xf343,
-0xc3d1,0xc3d7,0xc3d3,0x0000,0xc3d0,0xf4d0,0x0000,0xc4b7,
-0xf4ce,0x0000,0x0000,0xf4d2,0x0000,0xf4d3,0xc4b5,0xf4d4,
-0xf4d1,0x0000,0xf4cf,0xc4b8,0xc4b4,0xf4d5,0x0000,0xc4b6,
-0xc4b3,0x0000,0x0000,0x0000,0xc4fe,0x0000,0x0000,0xc540,
-0xf64e,0xf64d,0xf650,0xf651,0x0000,0xc541,0xf756,0xf75b,
-0xc5aa,0x0000,0xf758,0x0000,0xf757,0xf75a,0xf759,0x0000,
-0xf843,0x0000,0xc5dc,0xf842,0xf840,0x0000,0xf841,0x0000,
-0x0000,0x0000,0xc5fe,0xc5fd,0xf8c1,0xf8c2,0xc640,0x0000,
-0xf94d,0xf94e,0xc667,0x0000,0xc66d,0x0000,0xf9a9,0xf9c8,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x8c00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa8a6,
-0x0000,0xd7cd,0x0000,0xd7ce,0xe052,0xe450,0xe7e5,0xc1c6,
-0x0000,0xc1c5,0xf0ee,0xf344,0x0000,0xf844,0xa8a7,0xd3de,
-0xb05a,0xb361,0xe054,0xe053,0xbddc,0xe7e6,0xbddd,0xeeb1,
-0xc2d7,0x0000,0x0000,0x0000,0xc676,0xa8a8,0xcdcb,0xd3df,
-0x0000,0x0000,0xb362,0x0000,0xd7cf,0xd7d0,0x0000,0xdbe5,
-0x0000,0xb648,0xb8e6,0x0000,0xe056,0xe055,0xe057,0x0000,
-0xe451,0xe452,0xbba8,0xbfdd,0xbdde,0xbfde,0x0000,0xeeb5,
-0xeeb2,0xeeb4,0xeeb3,0xc1c7,0x0000,0xf0ef,0xf346,0xf345,
-0xcba4,0xb05c,0xb05b,0xd3e0,0x0000,0xd7d1,0x0000,0x0000,
-0xdbe7,0xdbe6,0xb649,0x0000,0xe059,0xe05a,0xe058,0x0000,
-0x0000,0xb8e8,0xb8e7,0x0000,0xbbaa,0xbba9,0x0000,0xe7e7,
-0xebb3,0xebb1,0xebb2,0xbfdf,0xeeb7,0xeeb6,0x0000,0xf0f2,
-0xf0f1,0xf0f0,0xf347,0x0000,0xf9aa,0xa8a9,0xad73,0x0000,
-0xad74,0xb05d,0xb05e,0xd3e2,0xd3e1,0xd7d2,0x0000,0xb368,
-0xb366,0xb363,0xb367,0xb365,0xb364,0x0000,0x0000,0xb64a,
-0xdbea,0x0000,0xb8ed,0xb64c,0xb651,0xdbec,0xb653,0xb652,
-0xb655,0xdbeb,0xdbe8,0xb64f,0xb64b,0xb64d,0xdbe9,0xb654,
-0xb650,0xb64e,0xb8ef,0xb8ee,0xb8ec,0xb8f0,0x0000,0xb8ea,
-0xb8eb,0x0000,0xb8e9,0x0000,0xe05b,0x0000,0x0000,0xe454,
-0x0000,0xbbac,0xbbad,0xbbab,0x0000,0xe453,0x0000,0xe455,
-0x0000,0xe7ea,0xe7ec,0x0000,0xbde7,0xe7ed,0xbde0,0xe7e9,
-0xbddf,0xbde9,0xbde5,0xbde6,0xbde2,0xe7e8,0xbde1,0xe7ee,
-0xe7eb,0x0000,0xbde8,0x0000,0xbde3,0xbde4,0xebb5,0x0000,
-0xebb7,0xebb6,0x0000,0xebb8,0xbfe0,0xebb4,0x0000,0x0000,
-0xc1cb,0xeeb8,0xc1c8,0xc1cc,0xc1ca,0xc1c9,0xf0f3,0x0000,
-0xf0f6,0x0000,0xf0f5,0x0000,0xf0f4,0xc2d8,0xf348,0xf349,
-0xc3d8,0xf34a,0xc3d9,0x0000,0x0000,0xc4ba,0x0000,0xc4b9,
-0xf652,0x0000,0x0000,0xc542,0xf653,0xf75c,0xc5ab,0xc5ac,
-0x0000,0xf845,0x0000,0xc642,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xa8aa,0x0000,0xb36a,0xb369,
-0xe05c,0xe05d,0x0000,0xbbae,0xebb9,0xbdea,0xebba,0xeeb9,
-0xa8ab,0x0000,0xd0b2,0xad76,0xad75,0x0000,0xd3e3,0xb05f,
-0xd3e4,0xd7d5,0x0000,0xd7d4,0x0000,0xd7d3,0x0000,0x0000,
-0xdbee,0xb658,0x0000,0x0000,0xdbed,0xb657,0x0000,0x0000,
-0x0000,0xdbef,0xb656,0x0000,0xe05f,0xe062,0xe060,0xe061,
-0xe065,0xe05e,0xe066,0xe063,0xe064,0xbbb0,0xe456,0x0000,
-0x0000,0xbbaf,0x0000,0xe7f2,0xe7f0,0x0000,0x0000,0xbdeb,
-0xe7ef,0xe7f1,0x0000,0xbdec,0x0000,0xebbb,0x0000,0xebbc,
-0xc1cd,0x0000,0xf34c,0xf34e,0xf34b,0xf34d,0xf4d6,0xf654,
-0x0000,0x0000,0xf96f,0xa8ac,0xad77,0xd3e5,0xd3e7,0xd3e6,
-0x0000,0xd7d8,0xb36c,0x0000,0xd7d6,0x0000,0xb36b,0xd7d9,
-0x0000,0xd7da,0xd7d7,0x0000,0x0000,0xdbfb,0xb660,0xdbf3,
-0xdbf9,0x0000,0x0000,0xb65b,0xb65e,0xdbf2,0xb659,0xdbf6,
-0xe06c,0xb65d,0x0000,0xdbf1,0x0000,0xdbf7,0xdbf4,0xdbfa,
-0xdbf0,0xdbf8,0xb65c,0xb65f,0xdbf5,0xb65a,0x0000,0xb8f2,
-0xe068,0xb8f1,0xe06f,0xe06e,0xb8f8,0x0000,0xb8f9,0xe070,
-0xb8f3,0xe06d,0xb8f7,0xe072,0xe069,0x0000,0xe06b,0xb8f4,
-0xe067,0xe06a,0xe071,0xb8f5,0xe073,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xb8f6,0x0000,0xbbb1,0xe45b,0xe461,0xe459,
-0xe462,0x0000,0xe458,0xe45d,0xe463,0xe460,0xe45f,0xe45e,
-0x0000,0xe457,0xe45c,0x0000,0x0000,0xe45a,0x0000,0xbdf1,
-0xbdee,0xe7fb,0xe841,0xe843,0xe840,0xe7f8,0xe7fa,0xe845,
-0xe842,0xe7fc,0xe846,0xe7f9,0xe844,0xbdef,0xbdf5,0xbdf3,
-0xe7f3,0xbdf4,0xbdf0,0xe7f4,0xe7f6,0xe7f5,0xe7fd,0xe7fe,
-0x0000,0xbdf2,0x0000,0xbded,0x0000,0x0000,0xe7f7,0x0000,
-0xebc6,0xbfe2,0x0000,0xebbd,0xbfe3,0xbfe6,0xebc2,0x0000,
-0xebbf,0xbfe5,0x0000,0x0000,0xebc3,0xebc4,0xebbe,0xebc7,
-0xebc0,0xebc5,0xbfe4,0x0000,0xbfe1,0xebc1,0x0000,0xeebf,
-0xc1d0,0xc1ce,0xc1d1,0xc1cf,0xeebe,0xeebb,0xeeba,0x0000,
-0xeebd,0x0000,0x0000,0xeebc,0xf145,0xc2de,0xf0fb,0xf0fa,
-0x0000,0xc2d9,0xf141,0xf140,0xf0f7,0xf143,0xf0fc,0xc2dd,
-0xf0f9,0xf142,0xf0f8,0xc2da,0xc2dc,0xf0fd,0xc2db,0xf0fe,
-0x0000,0xf144,0xf352,0x0000,0xc3de,0xf34f,0x0000,0xf353,
-0x0000,0x0000,0xc3db,0xf351,0xc3e0,0x0000,0xc3dd,0x0000,
-0xf350,0x0000,0xc3df,0xf354,0xc3da,0x0000,0x0000,0x0000,
-0x0000,0xc4bc,0xc4be,0x0000,0xf4d9,0xc4bd,0xf4d7,0xc3dc,
-0xf4d8,0xc4bb,0xc543,0xc545,0xf656,0xc544,0xf655,0x0000,
-0xf761,0xc5ad,0xf760,0xc5ae,0xf75e,0xf75d,0xf762,0xf763,
-0xf846,0x0000,0xf75f,0x0000,0x0000,0xf8c6,0xf8c3,0xf8c4,
-0xf8c5,0xc65c,0x0000,0xf951,0xf950,0xf94f,0xf970,0x0000,
-0xf9be,0xf9ab,0xc66e,0xa8ad,0xb060,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xb8fa,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xbdf6,0x0000,0x0000,0xebc8,0x0000,0x0000,
-0xc2df,0x0000,0xf355,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xf9ac,0xa8ae,0xaaee,0xad79,0xad78,0x0000,0xb063,
-0x0000,0xd3e8,0xb061,0xd3e9,0xb062,0x0000,0x0000,0xd7df,
-0xd7db,0x0000,0x0000,0xb36d,0xd7de,0xd7dd,0xd7dc,0xb36e,
-0xd7e0,0xd7e1,0x0000,0x0000,0x0000,0xdc43,0xdc41,0xdc45,
-0xdc46,0xdc4c,0x0000,0xdc48,0xdc4a,0x0000,0xdc42,0xdbfc,
-0x0000,0xdc49,0x0000,0x0000,0xdc4b,0xdc44,0xdc47,0xdbfd,
-0xb662,0xdc40,0xdbfe,0xb661,0xb663,0x0000,0xb8fd,0xe075,
-0xe077,0xe076,0xe07b,0xb8fb,0x0000,0xe078,0xe074,0xe079,
-0xe07a,0xb8fc,0xb8fe,0xe07c,0x0000,0xe467,0xe466,0x0000,
-0xe464,0xe465,0xbbb3,0xbbb5,0xbbb2,0xbbb4,0xe84d,0xe84e,
-0xe849,0x0000,0xe84a,0xbdf8,0xbdfd,0xbdf7,0xbdfe,0xbdf9,
-0xe84b,0x0000,0x0000,0xe84c,0xe848,0xbe40,0xbdfb,0x0000,
-0x0000,0xbdfa,0xbdfc,0x0000,0xe847,0x0000,0xebca,0xbfe8,
-0x0000,0x0000,0xebcc,0xbfea,0xebcf,0xebcb,0xebc9,0xebce,
-0xbfe9,0xebcd,0x0000,0xbfe7,0x0000,0x0000,0xc1d3,0xc1d6,
-0xeec1,0x0000,0xc1d4,0xeec0,0xc1d2,0xc1d5,0xf146,0xf147,
-0xf148,0xc2e0,0x0000,0xf149,0x0000,0xc2e1,0xc3e2,0xf358,
-0xf359,0xf357,0xf356,0xf35a,0xc3e1,0xf4dd,0xf4db,0xf4dc,
-0xf4de,0xf4da,0xf4df,0xf658,0x0000,0xf659,0xf657,0xc546,
-0xf764,0xc5af,0xf765,0xf848,0xf847,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xa8af,0xb664,0x0000,0x0000,0xb940,
-0x0000,0x0000,0x0000,0xbbb6,0x0000,0x0000,0xbfec,0x0000,
-0xbfeb,0x0000,0x0000,0x0000,0x0000,0xc3e3,0xc47c,0xc547,
-0xa8b0,0xb064,0xb941,0x0000,0xf35b,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcba6,
-0x0000,0x0000,0xa8b1,0x0000,0xa8b4,0xa8b3,0xa8b2,0x0000,
-0x0000,0xcba5,0x0000,0xcdcd,0x0000,0xcdcf,0xaaef,0x0000,
-0x0000,0xaaf1,0xcdcc,0xcdce,0xaaf0,0xcdd1,0xcdd0,0xcdd2,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xd0b6,0xd0b4,0xad7c,0xd0b3,0xada3,0xad7e,0xad7b,0x0000,
-0xada4,0x0000,0xad7d,0xada2,0x0000,0xada1,0xd0b5,0x0000,
-0xad7a,0x0000,0x0000,0x0000,0xb06a,0xd3eb,0xd3f1,0xb067,
-0xb06e,0x0000,0xb069,0xd3ee,0xd3f0,0xb06c,0xd3ea,0xd3ed,
-0xb068,0xb065,0xd3ec,0xb06b,0xd3ef,0xb06d,0xb066,0x0000,
-0x0000,0x0000,0x0000,0xd7e3,0xd7e6,0xb370,0x0000,0xb37a,
-0xb376,0xd7e4,0x0000,0x0000,0xb37e,0xb377,0xb37c,0xb372,
-0x0000,0xb36f,0xb371,0xb37d,0xd7e5,0xb375,0xb378,0xb374,
-0xb379,0xd7e7,0xb37b,0xb373,0xd7e2,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xdc4d,0xb665,0xdc4f,
-0x0000,0xb667,0xb669,0x0000,0xdc4e,0xb666,0xb66a,0x0000,
-0xb668,0x0000,0x0000,0x0000,0xb947,0xe0a3,0xb94f,0xe07e,
-0x0000,0xb950,0xb945,0x0000,0xe0a1,0x0000,0x0000,0xb94a,
-0x0000,0xe0a2,0xb943,0xb942,0x0000,0xb94d,0xb94c,0xb94b,
-0xb949,0xb94e,0xe07d,0xb944,0xb946,0xb948,0x0000,0x0000,
-0xbbb8,0xbbbb,0x0000,0xbbbf,0xbbb9,0xbbbe,0xbbbc,0x0000,
-0xbbb7,0x0000,0xbbbd,0xbbba,0x0000,0x0000,0x0000,0xe852,
-0xbe43,0xbe41,0x0000,0xe853,0x0000,0xbe44,0xbe42,0xe851,
-0xe850,0x0000,0xbff0,0xe84f,0xbfee,0xbfed,0xebd0,0xbe45,
-0xbfef,0xebd1,0xbff2,0xebd2,0xbff1,0xc1d8,0xeec3,0xc1d7,
-0xc1dc,0xc1da,0xc1db,0xc2e3,0xc1d9,0xeec2,0xebd3,0xc2e2,
-0xc2e4,0x0000,0xc3e4,0xc3e5,0x0000,0xf4e0,0x0000,0xc5de,
-0xc5dd,0xa8b6,0x0000,0x0000,0xca55,0xb06f,0x0000,0xca52,
-0xca53,0xca51,0x0000,0xca54,0x0000,0x0000,0xcbaa,0xcba7,
-0xcbac,0xcba8,0xa8b7,0xa8ba,0x0000,0xcba9,0xa8b9,0xcbab,
-0x0000,0x0000,0xa8b8,0x0000,0x0000,0x0000,0x0000,0xcdd5,
-0xcdd7,0xaaf4,0xcdd3,0xcdd6,0xcdd4,0xaaf2,0xaaf5,0x0000,
-0xaaf3,0x0000,0x0000,0x0000,0x0000,0xd0b8,0xd0bc,0xd0b9,
-0x0000,0xada7,0x0000,0xada8,0x0000,0xd0bb,0x0000,0xd0bd,
-0xd0bf,0x0000,0xada5,0xd0be,0x0000,0x0000,0xada6,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xd7ee,0xd0ba,0xd3f2,0xd3fb,
-0xd3f9,0xd3f4,0xd3f5,0xd3fa,0xd3fc,0xb071,0x0000,0xd3f7,
-0xd3f3,0xb070,0xb072,0xd3f6,0xd3fd,0xd3f8,0x0000,0x0000,
-0xb3a1,0xd7f1,0xd7e9,0xd7ef,0xd7f0,0xb3a2,0x0000,0xd7e8,
-0xd7ea,0xd0b7,0xd7ec,0xd7ed,0xd7eb,0xb66c,0x0000,0x0000,
-0x0000,0xdc56,0xebd4,0xdc57,0xdc54,0xb3a3,0xb66e,0xdc53,
-0xdc59,0xdc58,0xb66b,0xdc5c,0xdc52,0xdc5b,0xdc50,0xdc5a,
-0xdc55,0xb66d,0x0000,0xe0aa,0x0000,0xe0a5,0xe0ab,0xe0a6,
-0xe0a4,0xe0a7,0xb951,0x0000,0xe0a9,0x0000,0xe0a8,0xb952,
-0xbbc1,0xbbc0,0xe46e,0xe471,0xe469,0xe46d,0xbbc2,0xe46c,
-0xe46a,0xe470,0xe46b,0xe468,0xe46f,0x0000,0xe859,0xbe48,
-0xf14a,0xe856,0xe857,0xe855,0xdc51,0xbe47,0xe85a,0xe854,
-0xbe46,0xbe49,0xe858,0xebd5,0xbff3,0xebd6,0xebd7,0x0000,
-0xeec4,0xc1dd,0xf14b,0xf14c,0x0000,0x0000,0xf14d,0xf35d,
-0xf35c,0xf4e2,0x0000,0xf4e1,0xf65b,0xf65c,0xf65a,0xf766,
-0xc5b0,0xa8bb,0xadaa,0xada9,0xb075,0xb074,0xd440,0xd441,
-0xd3fe,0x0000,0xb073,0xd7f5,0x0000,0xd7f6,0xd7f2,0xb3a4,
-0xd7f3,0x0000,0xd7f4,0x0000,0x0000,0x0000,0x0000,0xdc5f,
-0xdc61,0xdc5d,0xdc60,0xb66f,0xdc5e,0xb670,0x0000,0x0000,
-0xdd73,0xb955,0xb954,0x0000,0xb953,0x0000,0xe0ac,0xe0ad,
-0x0000,0x0000,0xe473,0xe475,0xbbc6,0xbbc3,0x0000,0xbbc5,
-0xbbc4,0xe474,0xe472,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xe861,0xe85e,0xe85f,0xbe4d,0xe860,0xe85b,0xe85c,0xbe4a,
-0x0000,0xbe4b,0xe85d,0xbe4c,0x0000,0xebdb,0x0000,0xebdc,
-0xebd9,0xebda,0xbff4,0xebd8,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xeec8,0xeec5,0xeec7,0xc1e0,0xeecb,0xc1df,0xeec9,
-0xeecc,0xeeca,0xeec6,0xc1de,0x0000,0xf14f,0x0000,0xf150,
-0xf14e,0x0000,0xf152,0xc2e5,0xc2e6,0xf35f,0xc3e7,0xf151,
-0xf35e,0xc3e6,0xf4e5,0xf4e6,0xc4bf,0xf4e4,0x0000,0xf4e3,
-0x0000,0xf65d,0xc548,0x0000,0xf849,0xf8c8,0xf8c7,0x0000,
-0xc643,0xc65d,0xf8c9,0xf971,0x0000,0xc66f,0xa8bc,0xaaf6,
-0x0000,0xb956,0x0000,0xc4c0,0xa8bd,0xadab,0xb3a5,0xb671,
-0xc2e7,0xaaf7,0x0000,0xd0c1,0xd0c0,0xd442,0x0000,0xb078,
-0xb076,0xb07a,0xd444,0x0000,0xb079,0xb077,0x0000,0x0000,
-0x0000,0x0000,0xd443,0xb3a8,0xd7fc,0x0000,0xb3a7,0xb3a9,
-0xd842,0xb3ab,0xd7fe,0xd840,0xd7f7,0xb3aa,0xd843,0x0000,
-0x0000,0xd7f9,0x0000,0xd7fa,0xd7f8,0xb3a6,0x0000,0xd841,
-0xd7fb,0xd7fd,0x0000,0x0000,0x0000,0xdc6d,0x0000,0xdc6c,
-0xdc6a,0xdc62,0xdc71,0xdc65,0xdc6f,0xdc76,0xdc6e,0xb679,
-0x0000,0xb675,0xdc63,0x0000,0xdc69,0xb677,0x0000,0xdc68,
-0xb678,0xb67a,0xdc6b,0x0000,0xb672,0xb673,0xdc77,0xdc75,
-0x0000,0xdc74,0xdc66,0x0000,0xdc72,0x0000,0xb676,0x0000,
-0x0000,0x0000,0x0000,0xb674,0xdc73,0xdc64,0xdc67,0xdc70,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xe4ba,0xe0b7,0x0000,
-0xe0b0,0xe0c3,0xe0cc,0xe0b3,0xb961,0x0000,0xe0c0,0xb957,
-0xb959,0xb965,0xe0b1,0x0000,0x0000,0xb95a,0xb95c,0xb966,
-0xb95b,0x0000,0x0000,0x0000,0x0000,0xb964,0xe0b9,0x0000,
-0xe0ae,0xb962,0xe0b8,0xb95e,0xe0ca,0xb963,0xe0c8,0xe0bc,
-0xe0c6,0xb960,0xe0af,0xe0c9,0xe0c4,0x0000,0xe0cb,0xb958,
-0x0000,0x0000,0xb967,0xb95d,0x0000,0x0000,0xe0b5,0x0000,
-0xe0bd,0xe0c1,0x0000,0xe0c5,0xb95f,0xe0b4,0xe0b2,0xe0be,
-0x0000,0x0000,0x0000,0x0000,0xe0bb,0xe0ba,0x0000,0xe0bf,
-0xe0c2,0x0000,0xe0c7,0x0000,0x0000,0x0000,0xe478,0x0000,
-0xbbc7,0xe4a4,0xe47a,0xbbcc,0xbbd0,0xe4ad,0xe4b5,0xe4a6,
-0xbbc8,0x0000,0xe4aa,0xe0b6,0x0000,0xbbc9,0xe4b1,0xe4b6,
-0xe4ae,0x0000,0xe4b0,0xe4b9,0xe4b2,0xe47e,0xe4a9,0x0000,
-0x0000,0xbbd1,0x0000,0xbbcd,0xe47c,0xe4ab,0xbbcb,0xe4a5,
-0xbbca,0xe4b3,0xe4a2,0xe479,0xbbce,0xe4b8,0x0000,0x0000,
-0xe47b,0xe4af,0xe4ac,0xe4a7,0xe477,0xe476,0xe4a1,0xe4b4,
-0xbbcf,0xe4b7,0xe47d,0xe4a3,0xbe52,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xbe5a,0xbe55,0xe8a4,0xe8a1,0xe867,0xbe50,
-0x0000,0xf9d7,0x0000,0xbe4f,0xbe56,0x0000,0x0000,0x0000,
-0xe865,0xbe54,0xe871,0xe863,0xe864,0xbe4e,0xe8a3,0xbe58,
-0xe874,0xe879,0xe873,0xebee,0xe86f,0xe877,0xe875,0xe868,
-0xe862,0xe87d,0xbe57,0xe87e,0x0000,0xe878,0x0000,0xe86d,
-0xe86b,0xe866,0x0000,0x0000,0x0000,0xe86e,0xe87b,0xe86a,
-0xe87a,0xe8a2,0x0000,0x0000,0xbe53,0x0000,0xe876,0xe87c,
-0xe872,0xe86c,0xbe51,0x0000,0x0000,0x0000,0xe4a8,0xe870,
-0xbe59,0xe869,0x0000,0x0000,0x0000,0x0000,0x0000,0xebf4,
-0xbff7,0xebf3,0xebf0,0xec44,0xbffb,0x0000,0xec41,0xebf8,
-0xec43,0xebe9,0xebf6,0x0000,0xbffd,0x0000,0xebe1,0x0000,
-0xebdf,0xec42,0x0000,0xec40,0xebfe,0xebed,0xebec,0xebe2,
-0xc040,0x0000,0xebe8,0xebf2,0xebfd,0xc043,0xec45,0x0000,
-0xc1e8,0xc045,0xbffe,0xebe6,0x0000,0xebef,0xebde,0xebe0,
-0xbff5,0xc042,0xbffa,0xebe7,0xebf7,0xebf1,0xc041,0xebdd,
-0xc1e3,0xebf9,0xebfc,0xbffc,0x0000,0xebeb,0xc044,0xbff9,
-0x0000,0x0000,0x0000,0xbff8,0xebf5,0xebfb,0xbff6,0x0000,
-0xebe4,0xebfa,0x0000,0x0000,0xebe5,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xebea,0xeed2,
-0x0000,0xeed7,0xc1e5,0xc1e7,0xeedd,0xc1e1,0xeeec,0xeee3,
-0xeed8,0xeed9,0xeee2,0x0000,0xc1ee,0xeee1,0xeed1,0xeee0,
-0xeed4,0xeeed,0xc1ed,0xc1eb,0xeed5,0x0000,0xeee8,0x0000,
-0xeeda,0xeee7,0x0000,0xeee9,0xeed0,0xc1e6,0x0000,0xeeea,
-0x0000,0x0000,0xeede,0x0000,0xc1ea,0xeedb,0x0000,0x0000,
-0xc1ec,0xeee4,0x0000,0x0000,0x0000,0xc1e4,0xeed6,0xeee5,
-0x0000,0xeedf,0xebe3,0xeee6,0xeed3,0x0000,0xc1e9,0x0000,
-0xeeeb,0x0000,0xc1e2,0xeece,0x0000,0x0000,0x0000,0x0000,
-0xf160,0xf159,0xc2e9,0x0000,0xf154,0xf163,0xf15b,0xeedc,
-0x0000,0xf165,0xf155,0x0000,0xc2e8,0xf15f,0xc2ea,0xc2f2,
-0xc2f0,0xf161,0xc2f1,0xf157,0x0000,0xf158,0xf15d,0xf162,
-0x0000,0xeecd,0xc2eb,0xf16a,0xf167,0xf16b,0xf15e,0xf15a,
-0xf168,0xf36a,0xf15c,0x0000,0xc2ee,0x0000,0xc2ed,0xeecf,
-0xc2ef,0xf164,0xf166,0xc2ec,0xf169,0xf153,0x0000,0xf156,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf373,0x0000,0xf363,0xc3eb,0xf371,0x0000,0x0000,0xf361,
-0xc3ec,0x0000,0xf36c,0x0000,0xf368,0xc3f1,0xf372,0xf362,
-0xf365,0xc3e9,0xf374,0x0000,0xf36d,0xf370,0xc3ef,0xc3f4,
-0xc3f2,0xf369,0xf364,0x0000,0xc3ed,0xc3ee,0xf360,0xc3ea,
-0x0000,0xc3e8,0xc3f0,0xf36f,0xc3f3,0x0000,0xf36b,0xf375,
-0xc3f5,0x0000,0x0000,0x0000,0xf367,0x0000,0xf36e,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf4f3,0xf542,0xf4f5,
-0xf4fc,0xf366,0xf4fa,0xf4e9,0xf540,0xc4c3,0xf4ed,0xf4fe,
-0xf4f4,0x0000,0x0000,0xc4c2,0x0000,0x0000,0xf544,0xf4f6,
-0x0000,0xf4fb,0xf4fd,0xf4e7,0xf541,0xf4f2,0xf4f7,0xf4eb,
-0xf4ef,0xf543,0xf4f9,0xf4e8,0xf4ec,0xf4ee,0xf4f8,0x0000,
-0xc4c1,0xf4f1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf4ea,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xf4f0,0xf661,0xf666,0xc54f,0xf668,0x0000,0xc549,0x0000,
-0xf664,0xf66a,0xc54e,0xc54a,0x0000,0xc54b,0xf660,0xf667,
-0xc54d,0xf665,0xc54c,0xf65f,0xf663,0xf662,0x0000,0xf65e,
-0xf669,0x0000,0x0000,0x0000,0xc5b1,0xf76d,0xf770,0xf76c,
-0xf76e,0xf76f,0xf769,0xf76a,0xf767,0x0000,0x0000,0xf76b,
-0xf768,0xc5b2,0xc5b3,0x0000,0x0000,0xf84b,0x0000,0xf84d,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf84c,0xf84e,0x0000,
-0xc5e0,0x0000,0xf84a,0xc5df,0xc5e1,0x0000,0x0000,0x0000,
-0xf8cb,0xf8cc,0xc644,0xf8ca,0x0000,0xf953,0xf952,0xf954,
-0xc65f,0xf955,0xc65e,0xf956,0xf972,0xf975,0xf974,0xc668,
-0xf973,0x0000,0x0000,0x0000,0xc672,0xc670,0xc671,0xc677,
-0xf9c0,0xf9c1,0xf9bf,0xf9c9,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x9500 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xaaf8,
-0x0000,0x0000,0xd844,0xdc78,0xe8a5,0xf376,0x0000,0x0000,
-0xaaf9,0x0000,0xadac,0xb07b,0x0000,0x0000,0xd845,0x0000,
-0xd846,0xb3ac,0x0000,0xb67d,0xdc7a,0xdc79,0xb6a3,0xb67c,
-0xdc7b,0xb67e,0xb6a2,0xb6a1,0xb67b,0x0000,0x0000,0x0000,
-0xb968,0x0000,0x0000,0xe0d0,0xe0ce,0x0000,0xe0cf,0xe0cd,
-0x0000,0xbbd2,0x0000,0xbbd5,0xbbd7,0xbbd6,0x0000,0x0000,
-0xbbd3,0xbbd4,0x0000,0xe8a7,0xe8a6,0xbe5b,0xe8a8,0x0000,
-0xe8a9,0xbe5c,0x0000,0x0000,0x0000,0xec4d,0xec4b,0xeef3,
-0x0000,0xec49,0xec4a,0xc046,0xec46,0xec4e,0xec48,0xec4c,
-0xeeef,0x0000,0x0000,0xeef1,0x0000,0xeef2,0xc1f3,0xeeee,
-0xc1f2,0xeef0,0xc1ef,0xc1f0,0xc1f1,0xec47,0x0000,0x0000,
-0xc2f5,0xf16e,0xf16c,0xf16d,0xc2f3,0xc2f6,0xc2f4,0x0000,
-0x0000,0x0000,0xf377,0xf378,0xc3f6,0x0000,0xf545,0xf547,
-0xf546,0xc4c4,0xc550,0xf66d,0xf66c,0xf66b,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0x9600 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xaafa,0x0000,0xc9aa,0x0000,
-0xca58,0xa6e9,0xca56,0xca59,0xca57,0x0000,0x0000,0x0000,
-0xcbae,0x0000,0xa8c1,0x0000,0xa8c2,0xcbb0,0xa8bf,0xcbaf,
-0xcbad,0xa8c0,0xa8be,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xcdd8,0xcddb,0xaafd,0xcdda,0xcdd9,0x0000,0xaafc,
-0xaafb,0x0000,0xab40,0xcddc,0xaafe,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xd0c6,0xadae,0xadaf,0xadb0,0xd0c7,0xd0c3,
-0xadad,0xd0c4,0x0000,0xd0c5,0xd0c2,0x0000,0x0000,0x0000,
-0xb0a4,0x0000,0x0000,0xb0a1,0xd445,0xb0a2,0xb0a5,0xd446,
-0x0000,0xb07e,0xb07c,0xb07d,0xb0a3,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xb3ad,0xd849,0xb3b5,0xd848,0x0000,0xd84b,
-0xb3b1,0xd84a,0xb6ab,0xb3af,0xb3b2,0xb3ae,0xb3b3,0xb3b4,
-0xb3b0,0x0000,0x0000,0x0000,0xd847,0xb6a7,0xdc7d,0x0000,
-0xdca3,0x0000,0x0000,0xdca2,0xb6ac,0xb6a8,0xb6a9,0xdc7c,
-0xdc7e,0xdca1,0xb6a4,0xb6a6,0x0000,0xb6aa,0xb6a5,0x0000,
-0x0000,0xe0d3,0xe0d1,0xe0d2,0xb96a,0xb96b,0x0000,0xe0d4,
-0xb969,0xbbd8,0x0000,0xbbda,0xbbd9,0x0000,0xe4bb,0x0000,
-0x0000,0xe4bc,0xe8ab,0x0000,0xe8aa,0x0000,0x0000,0xc047,
-0xc048,0xec4f,0xc049,0x0000,0xeef6,0x0000,0xeef4,0x0000,
-0xeef5,0xc1f4,0x0000,0xf16f,0xc3f7,0x0000,0x0000,0x0000,
-0xc1f5,0xab41,0x0000,0xb0a6,0xd447,0x0000,0x0000,0xd84c,
-0xb3b6,0xb6ad,0xdca4,0xdca6,0xb6af,0xb6ae,0xb6b0,0xb6b1,
-0xdca5,0xb96e,0xb96f,0xb96d,0xbbdb,0xb96c,0xe0d5,0x0000,
-0x0000,0x0000,0xbbdc,0xe8ac,0xec50,0xc04a,0xc1f6,0xf170,
-0xf174,0xc2f9,0xf171,0xc2fa,0xc2f8,0xf175,0xc2fb,0xf173,
-0x0000,0xf379,0xc2f7,0xc3f8,0x0000,0xf8cd,0x0000,0x0000,
-0xab42,0xb3b8,0xb3b7,0x0000,0x0000,0x0000,0x0000,0xb6b2,
-0xdca8,0xdca7,0xb6b3,0x0000,0x0000,0xe0d9,0xb973,0xb970,
-0xe0d8,0xb972,0xe0d6,0xb971,0x0000,0xe0d7,0x0000,0xe4bd,
-0xbbdd,0x0000,0xe8af,0x0000,0xbe5d,0xe8ad,0xbe5e,0xbe5f,
-0xe8ae,0xbe60,0x0000,0xec51,0x0000,0xc04e,0xc04b,0xc050,
-0xec53,0xc04c,0xec52,0xc04f,0x0000,0x0000,0xc04d,0x0000,
-0xeef9,0xeefb,0x0000,0x0000,0xc1f7,0xeefa,0xc1f8,0xeef8,
-0xeef7,0x0000,0xf177,0xf176,0xc2fc,0xf178,0xf37e,0xc3fa,
-0xf37d,0xf37a,0xc3f9,0xf37b,0xf37c,0x0000,0xf548,0xf549,
-0xc4c5,0x0000,0xc553,0x0000,0x0000,0xf66e,0x0000,0x0000,
-0xc551,0xc552,0xf66f,0x0000,0x0000,0xc5b4,0xc5b5,0xf771,
-0x0000,0x0000,0xc645,0xf8cf,0xc647,0x0000,0xf8ce,0xf8d0,
-0xc646,0xf957,0x0000,0xf9ad,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0xab43,0x0000,0x0000,0x0000,0xb974,0x0000,
-0xe4be,0x0000,0xe8b0,0xc051,0xc052,0x0000,0xab44,0x0000,
-0xbe61,0xc3fb,0xadb1,0x0000,0x0000,0x0000,0xc053,0x0000,
-0xc5e2,0xadb2,0xd84d,0x0000,0xdca9,0x0000,0xdcab,0x0000,
-0xdcaa,0x0000,0xe0dd,0xe0da,0xb975,0x0000,0xb976,0xe0db,
-0xe0dc,0x0000,0xe4c0,0xe4c5,0xbbde,0xe4bf,0xe4c1,0xe4c8,
-0xe4c3,0xe4c7,0xe4c4,0xe4c2,0xe4c6,0xbbdf,0x0000,0x0000,
-0xe8b3,0x0000,0xe8b1,0xbe63,0x0000,0xbe62,0xe8b2,0xbe64,
-0x0000,0x0000,0x0000,0x0000,0xec56,0x0000,0x0000,0xec55,
-0xc054,0xec54,0xeefc,0x0000,0xeefe,0xef41,0xef40,0x0000,
-0xc1f9,0xeefd,0xf1a1,0xc2fd,0xf17d,0xf1a2,0xc2fe,0x0000,
-0xf17b,0x0000,0xf17e,0xf17c,0xf179,0xc340,0xf17a,0x0000,
-0x0000,0x0000,0x0000,0xf3a1,0x0000,0x0000,0xf3a3,0xf3a2,
-0x0000,0xf54a,0x0000,0xf54b,0x0000,0x0000,0x0000,0xf670,
-0x0000,0xc5b7,0x0000,0xc5b6,0xf84f,0xf850,0xc648,0xf8d1,
-0x0000,0xc669,0x0000,0xadb3,0xb6b4,0xe4ca,0xe4c9,0xe8b5,
-0xe8b4,0x0000,0x0000,0xc1fa,0xef43,0xef42,0xf1a5,0xf1a3,
-0xf1a6,0xf1a4,0x0000,0x0000,0xc3fc,0xf3a4,0xf3a5,0xf3a6,
-0x0000,0xf671,0x0000,0xf772,0x0000,0xf8d2,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xadb4,0x0000,0x0000,
-0xec57,0xef44,0x0000,0xadb5,0x0000,0x0000,0xbbe0,0x0000,
-0xec58,0xc341,0xf1a7,0xc3fd,0x0000,0xf54c,0xf54d,0xc554,
-0xf851,0xadb6,0xb3bb,0xb3bc,0xd84e,0xb6b5,0xb6b6,0xdcac,
-0xb6b7,0x0000,0xb97a,0x0000,0xb97c,0xe0df,0xe0e0,0xe0de,
-0xb977,0xb978,0xb97b,0xb979,0x0000,0x0000,0xe4cb,0xbbe1,
-0xbbe2,0x0000,0x0000,0xe8bc,0xbe67,0xe8b7,0xe8b6,0x0000,
-0xe8bb,0xbe65,0x0000,0x0000,0xc05b,0x0000,0xe8b8,0xe8bd,
-0xe8ba,0xe8b9,0x0000,0xbe66,0x0000,0xc059,0x0000,0xec5a,
-0xc055,0x0000,0xec5b,0x0000,0x0000,0xec59,0x0000,0xc058,
-0xc056,0xc05a,0x0000,0xc057,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xef45,0x0000,0xef4a,0xef46,0xef49,0xc1fb,0x0000,
-0xedd4,0xef48,0xef47,0x0000,0xc344,0xc342,0xc345,0xc343,
-0xf1a8,0xf1a9,0xf1aa,0xc346,0x0000,0x0000,0x0000,0xf3aa,
-0xc440,0xf3a8,0x0000,0xc441,0xf3a7,0xf3a9,0xc3fe,0xf551,
-0xf54e,0x0000,0xf54f,0xf550,0xf672,0xc556,0x0000,0xc555,
-0x0000,0xf774,0xf773,0xc5b8,0x0000,0x0000,0x0000,0xc5e3,
-0xc649,0xc660,0xf958,0xf9ae,0xf9af,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xadb7,0xdcad,0x0000,0x0000,0xe0e1,0xe4cc,0xe4cd,0xbbe3,
-0x0000,0xbbe4,0xe8be,0xbe68,0x0000,0x0000,0xc1fc,0x0000,
-0xf1ab,0x0000,0xc347,0xf3ad,0xc442,0xf3ac,0xf3ae,0xf3ab,
-0xf675,0xf552,0xf553,0x0000,0xc4c6,0x0000,0xf674,0x0000,
-0x0000,0xf673,0x0000,0xf775,0xf9b0,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xadb8,0x0000,0x0000,0x0000,0xadb9,
-0x0000,0x0000,0xb0a7,0xd448,0x0000,0xd84f,0x0000,0xb6b8,
-0x0000,0xb6bb,0xb6b9,0xdcae,0x0000,0xb6bd,0x0000,0xb6ba,
-0x0000,0x0000,0xb6bc,0x0000,0xb97e,0x0000,0xe0e2,0x0000,
-0x0000,0xe0e3,0xe8c0,0x0000,0xb97d,0xb9a1,0xb9a2,0x0000,
-0xe4cf,0x0000,0xe4ce,0xbbe5,0x0000,0xbbe6,0x0000,0xe4d0,
-0xe8bf,0xbbe8,0xbe69,0x0000,0xbbe7,0x0000,0x0000,0x0000,
-0xc05c,0xe8c1,0xbe6b,0xbe6a,0xe8c2,0xe8c5,0xe8c3,0xe8c4,
-0xbe6c,0x0000,0xc061,0xc05f,0x0000,0x0000,0xc05e,0xec5d,
-0x0000,0xc060,0x0000,0x0000,0xec5c,0xef4b,0x0000,0xec5e,
-0xc05d,0xec5f,0xef4e,0xef4c,0xef4d,0xef52,0xc34b,0xef51,
-0xef54,0xef53,0xef50,0xef4f,0x0000,0xc1fd,0x0000,0x0000,
-0x0000,0x0000,0xf1ae,0x0000,0xf1ad,0xc34a,0xc348,0xc349,
-0x0000,0xf1ac,0x0000,0xf3b1,0x0000,0xc443,0x0000,0xf3b0,
-0xf3af,0xc444,0x0000,0xf558,0xf557,0x0000,0xf555,0x0000,
-0xf554,0xc4c8,0xc4c7,0xf559,0xf776,0xc5b9,0xf677,0xc557,
-0xf676,0xf556,0x0000,0xf777,0xc5e4,0x0000,0xc661,0xf959,
-0x0000,0xf9b1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xadba,0xd850,
-0xef55,0xadbb,0x0000,0x0000,0xe4d2,0xe4d1,0xec60,0x0000,
-0x0000,0xef57,0x0000,0xef56,0x0000,0xc34c,0xf3b2,0xf3b3,
-0xc4c9,0x0000,0x0000,0xf9b2,0xb0a8,0xb6bf,0xb6be,0xe0e4,
-0xe0e6,0xb9a4,0xe0e5,0xb9a3,0xb9a5,0xe0e7,0x0000,0x0000,
-0x0000,0xe4d4,0xe4d6,0xe4d5,0x0000,0xe4d8,0x0000,0x0000,
-0x0000,0xbbe9,0xe4d7,0xe4d3,0x0000,0x0000,0x0000,0xe4d9,
-0x0000,0xe8cc,0x0000,0xe8cf,0xe8d1,0xe8c7,0xe8cb,0xe8c8,
-0xbe6e,0xbe71,0xbe73,0xe8c9,0xe8ca,0xbe72,0xe8cd,0xe8d0,
-0xe8ce,0xbe74,0x0000,0xbe70,0xe8c6,0xbe6d,0x0000,0xbe6f,
-0x0000,0x0000,0xc063,0xec66,0xec64,0xec63,0x0000,0xec69,
-0x0000,0xec68,0xec67,0x0000,0xec62,0xc062,0xec61,0x0000,
-0xec65,0xc064,0x0000,0x0000,0xef5a,0x0000,0xef5e,0xef5b,
-0xef5d,0xef5c,0xef59,0xef5f,0xef62,0xef60,0xef61,0xc240,
-/* 0x9a00 */
-0x0000,0xc1fe,0xef58,0xef63,0xf1b3,0xf1b6,0xf1b8,0xf1b7,
-0x0000,0xf1b1,0xf1b5,0xf1b0,0x0000,0xf1b2,0xc34d,0xf1af,
-0x0000,0xf1b4,0x0000,0x0000,0xf3c0,0xf3b5,0xc445,0x0000,
-0x0000,0xc446,0xf3b4,0xf3b9,0xf3bf,0xf3b7,0xf3be,0x0000,
-0xf3bb,0x0000,0xf3ba,0xf3bd,0xf3b8,0xf3b6,0x0000,0xf3bc,
-0x0000,0xf560,0xf55e,0xc4ca,0xf55d,0xf563,0xf561,0x0000,
-0xc4cb,0xf55c,0xf55a,0x0000,0xf55b,0xc4cd,0xf55f,0xc4cc,
-0xf562,0xf678,0xf67e,0x0000,0x0000,0xf679,0xc55b,0xf6a1,
-0xc55a,0xf67d,0xf67c,0xc559,0xf67b,0xc558,0xf67a,0x0000,
-0xf77d,0xf7a1,0xf77e,0x0000,0xf77b,0xc5bb,0xf778,0xf77c,
-0xf7a3,0x0000,0xf7a2,0xf779,0xf77a,0xc5ba,0xf852,0xc5e7,
-0x0000,0xf853,0xc5e5,0xc5e6,0x0000,0x0000,0xf8d3,0xc64a,
-0xf976,0x0000,0xc66a,0x0000,0xf9b3,0xc66b,0xf9b4,0xf9b5,
-0xf9c3,0xf9c2,0xc67a,0xf9cd,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xb0a9,0x0000,0x0000,0xe0e9,0x0000,0xe0e8,0x0000,0xbbea,
-0xbbeb,0xe4da,0x0000,0xe8d2,0xec6c,0x0000,0x0000,0xbe75,
-0xc065,0xec6a,0x0000,0xec6d,0xc066,0x0000,0xef64,0xec6b,
-0xf1b9,0xc34e,0xf3c1,0x0000,0x0000,0x0000,0xf566,0xf564,
-0x0000,0x0000,0xf565,0x0000,0x0000,0xf6a2,0x0000,0xc55c,
-0xf7a4,0xc5ea,0xc5bc,0xc5e8,0xc5e9,0xf8d4,0xc662,0x0000,
-0xb0aa,0x0000,0x0000,0x0000,0xf1ba,0x0000,0x0000,0xd449,
-0x0000,0xb9a6,0x0000,0xe4db,0x0000,0x0000,0xbbec,0xe4dc,
-0x0000,0x0000,0x0000,0xe8d4,0xe8d3,0xc068,0xbe76,0xbe77,
-0x0000,0xe8d7,0xe8d6,0xe8d5,0x0000,0x0000,0xec6e,0xec71,
-0x0000,0xec70,0xec6f,0xc067,0xef68,0xef66,0xef65,0x0000,
-/* 0x9b00 */
-0x0000,0xef67,0x0000,0xc34f,0xf1bc,0xf1bd,0xc350,0x0000,
-0xf1bb,0x0000,0xf3c3,0xf3c2,0xf3c5,0xc447,0xf3c4,0x0000,
-0xf567,0xf569,0xf568,0x0000,0x0000,0xf6a3,0xf6a6,0xf6a4,
-0xf6a5,0xf7a5,0xc5bd,0x0000,0x0000,0x0000,0xf854,0xf855,
-0xf856,0x0000,0xc64b,0xc663,0xf9b6,0xb0ab,0x0000,0xbe78,
-0xc069,0xf1be,0x0000,0xf7a6,0x0000,0x0000,0xf9c4,0xd44a,
-0x0000,0xc67b,0xb0ac,0xec72,0x0000,0xf1bf,0x0000,0xf3c6,
-0x0000,0x0000,0xf6a7,0xf7a7,0xb0ad,0x0000,0xe4dd,0xe4de,
-0x0000,0xbbed,0xbbee,0xe8d9,0xbe7a,0xbe79,0xe8d8,0x0000,
-0xef69,0x0000,0xf1c0,0xf1c2,0xf1c1,0xc353,0xc352,0xc351,
-0x0000,0xc55e,0xf6a8,0x0000,0xc55d,0xf7a9,0xf7a8,0x0000,
-0xc64c,0xf8d5,0xb3bd,0xe0ea,0x0000,0x0000,0x0000,0xe4e1,
-0xe4df,0xe4e0,0x0000,0x0000,0xe8e2,0x0000,0xe8dd,0xe8da,
-0xe8e1,0x0000,0x0000,0x0000,0xe8e3,0x0000,0x0000,0xbe7c,
-0xe8e0,0xe8dc,0x0000,0x0000,0xe8db,0xe8df,0xe8de,0xbe7b,
-0x0000,0x0000,0xec7d,0xec78,0xec76,0xeca1,0xec77,0x0000,
-0xec73,0x0000,0xec79,0x0000,0x0000,0xec74,0xef72,0xec75,
-0xeca2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xec7c,0xc06a,0xec7b,0xec7a,0x0000,0xec7e,0x0000,0x0000,
-0x0000,0x0000,0xef6a,0xef6d,0x0000,0x0000,0xef6c,0x0000,
-0xef74,0xef6f,0xef73,0x0000,0xef71,0xef70,0xef6e,0x0000,
-0xef6b,0x0000,0xc243,0xc242,0x0000,0xc244,0xc241,0xef75,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf1c8,0xf1cb,0x0000,
-0xf1c9,0xf1cd,0x0000,0x0000,0x0000,0xf1ce,0x0000,0xf1c6,
-0xc358,0xf1c7,0x0000,0xf1c5,0xf1cc,0x0000,0xf1c4,0xf1c3,
-0xc357,0xc355,0xc354,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0xf1ca,0xf3cf,0xf3d5,0xc44a,0xf3d0,
-0x0000,0xf3d3,0xf3d7,0xc44b,0xf3d2,0x0000,0xf3ca,0x0000,
-0xf3c9,0xf3d6,0xf3cd,0x0000,0xf3cb,0xf3d4,0xf3cc,0xc449,
-0xc448,0x0000,0xf3c7,0xf3c8,0xf3d1,0x0000,0x0000,0x0000,
-0xf3ce,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf56c,
-0xf56f,0x0000,0x0000,0x0000,0x0000,0xc356,0x0000,0x0000,
-/* 0x9c00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0xf56d,0xf573,0xf571,
-0xf56b,0xf576,0x0000,0xf56a,0x0000,0xc4cf,0xf572,0x0000,
-0x0000,0x0000,0xf56e,0xc4ce,0xf575,0x0000,0x0000,0xf574,
-0x0000,0x0000,0x0000,0x0000,0xf6ab,0xf6aa,0x0000,0x0000,
-0x0000,0xf6b1,0x0000,0xf6ad,0xf6b0,0xc560,0x0000,0x0000,
-0xf6ae,0xf6af,0x0000,0xf6a9,0xf6ac,0xc55f,0x0000,0x0000,
-0x0000,0xc5bf,0xf7b4,0xf7af,0xf7b3,0x0000,0xf7b6,0xf7b2,
-0x0000,0xf7ae,0x0000,0xc5c1,0xf7b1,0xf7b5,0xc5c0,0xf7ac,
-0xf570,0xf7b0,0x0000,0x0000,0xf7ad,0x0000,0xf7aa,0x0000,
-0xf7ab,0xc5be,0xf85a,0xf85c,0xf85f,0xf85b,0xf860,0x0000,
-0xf859,0x0000,0xf857,0x0000,0xc5eb,0xf85d,0xc5ed,0xc5ec,
-0xf858,0xf85e,0x0000,0x0000,0x0000,0x0000,0xf8da,0xc64d,
-0xf8db,0x0000,0xf8d9,0xf8d6,0x0000,0x0000,0xf8d8,0xf8d7,
-0xf95a,0x0000,0x0000,0x0000,0x0000,0xf95c,0xf95b,0x0000,
-0x0000,0xf979,0x0000,0xf978,0xf977,0xf97a,0x0000,0xc673,
-0xc674,0xf9ca,0xf9ce,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xb3be,0xdcaf,0xe0ed,
-0x0000,0xb9a7,0xe0eb,0x0000,0x0000,0xe0ec,0x0000,0x0000,
-0x0000,0xe4e2,0xe4e3,0xbbf1,0xbbef,0xe4e4,0xbbf0,0xe8e8,
-0x0000,0xe8eb,0xe8e5,0xe8ec,0xe8e4,0xe8e6,0x0000,0xe8e7,
-0xe8ea,0x0000,0x0000,0xbea1,0xe8ef,0xe8ee,0xbe7d,0xe8e9,
-0xe8ed,0xbe7e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xecac,0x0000,0xc06f,0x0000,0xeca7,0xc06b,0x0000,0xeca4,
-0xecaa,0xecad,0x0000,0xc070,0x0000,0xeca9,0xeca6,0xecae,
-0xeca5,0x0000,0xecab,0xc06c,0x0000,0xeca3,0xc06d,0x0000,
-0xc06e,0xeca8,0x0000,0x0000,0x0000,0xefa9,0xef7a,0xef7b,
-0xef7e,0xef7c,0x0000,0xef76,0x0000,0x0000,0xef79,0xefa5,
-0xef7d,0x0000,0x0000,0xc245,0x0000,0xefa7,0xefa4,0xc246,
-0xefa6,0xef77,0xefa2,0xefa3,0x0000,0xefa1,0x0000,0x0000,
-0x0000,0x0000,0xf1d2,0xf1d4,0xf1d7,0x0000,0x0000,0xf1d1,
-0x0000,0xc359,0xf1d9,0xf1d0,0xf1da,0x0000,0xf1d6,0xf1d8,
-0xf1dc,0xf1d5,0xf1dd,0xf1d3,0xf1cf,0xc35a,0x0000,0xf1db,
-0xc35b,0xc44d,0x0000,0x0000,0x0000,0x0000,0x0000,0xef78,
-0xf3f1,0xf3e8,0xc44f,0xf3e4,0xc450,0x0000,0x0000,0xf3ed,
-0xf3e7,0xf3dd,0xc44e,0xf3ea,0xf3e5,0xf3e6,0x0000,0xf3d8,
-0xf3df,0xf3ee,0x0000,0xf3eb,0x0000,0xf3e3,0x0000,0xf3ef,
-0xf3de,0xf3d9,0xf3ec,0x0000,0xf3db,0xf3e9,0xf3e0,0xf3f0,
-0xf3dc,0xc44c,0xf3da,0xf3e1,0xf3e2,0x0000,0x0000,0x0000,
-0xf57d,0x0000,0xf57b,0x0000,0xf5a2,0x0000,0xf5ae,0xf5a5,
-0xf57c,0xf578,0xf5a7,0xf57e,0xf5a3,0xf57a,0xf5aa,0xf577,
-0xf5a1,0xf5a6,0xf5a8,0xf5ab,0xf579,0x0000,0xf5af,0xf5b0,
-0xf5a9,0xf5ad,0xf5a4,0x0000,0xf6c1,0xf6c4,0x0000,0xc561,
-0x0000,0xf6c3,0xf6c8,0xf6c6,0xc562,0xf6bd,0xf6b3,0xf6b2,
-0xc564,0xf6bf,0xf6c0,0xf6bc,0xf6b4,0x0000,0xf6b9,0xf5ac,
-0x0000,0xf6b5,0xc563,0xf6bb,0x0000,0xf6ba,0x0000,0xf6b6,
-0xf6c2,0x0000,0xf6b7,0xf7bb,0xf6c5,0xf6c7,0xf6be,0xf6b8,
-0xf7bc,0xf7be,0xf7b8,0xc5c2,0x0000,0xf7c5,0xf7c3,0xc5c3,
-0xf7c2,0xf7c1,0xf7ba,0xf7b7,0xf7bd,0xf7c6,0xf7b9,0xf7bf,
-0x0000,0xf869,0xf86e,0xf864,0xf867,0xc5ee,0xf86b,0x0000,
-0xf872,0xf7c0,0x0000,0xf865,0xf86f,0xf873,0xf86a,0xf863,
-0xf86d,0x0000,0xf86c,0xf871,0xf870,0xf7c4,0xf868,0xf862,
-0xf866,0xc64e,0xc64f,0xf861,0x0000,0xf8e6,0xf8dd,0xf8e5,
-0xf8e2,0xf8e3,0xf8dc,0xf8df,0xf8e7,0xf8e1,0xf8e0,0xf8de,
-0x0000,0xf8e4,0x0000,0xf95d,0x0000,0xf95e,0x0000,0xf960,
-0xf95f,0xf962,0xf961,0xf97c,0xf97b,0xf9b7,0x0000,0xf9b8,
-0x0000,0xf9c5,0xc678,0xc67c,0x0000,0xf9cf,0xc67d,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xb3bf,0x0000,0x0000,
-0x0000,0xc4d0,0xf6c9,0x0000,0xc650,0xc651,0x0000,0xb3c0,
-0xe0ee,0x0000,0xb9a8,0xe8f0,0x0000,0x0000,0xecb0,0xecb1,
-0xecaf,0xefab,0xefaa,0xc247,0xf1df,0xefac,0xf1de,0x0000,
-0x0000,0xf3f3,0xc451,0xc453,0xf3f2,0x0000,0x0000,0xc452,
-0x0000,0xf5b1,0xf5b3,0xf5b2,0xf6ca,0xc565,0x0000,0xc5ef,
-0xf8e8,0xf963,0x0000,0x0000,0xf9d2,0xb3c1,0x0000,0xe4e5,
-0x0000,0xbea2,0x0000,0x0000,0x0000,0xecb3,0xecb2,0x0000,
-0xefad,0x0000,0x0000,0x0000,0xc454,0xc4d1,0xf7c7,0xf9cb,
-0x0000,0x0000,0x0000,0xb3c2,0xbbf2,0x0000,0xbea3,0x0000,
-0xf3f4,0x0000,0xf874,0xb6c0,0x0000,0x0000,0x0000,0x0000,
-0xefae,0x0000,0x0000,0x0000,0xc664,0xb6c1,0xbea4,0xc248,
-0xf875,0xb6c2,0x0000,0xe8f1,0xc072,0xecb4,0xecb5,0x0000,
-0xc071,0x0000,0xefaf,0xc24c,0xc24a,0xc24b,0xc249,0xf1e0,
-0xc35c,0x0000,0x0000,0x0000,0xf5b5,0xf5b4,0xf5b7,0xf5b6,
-0xc4d2,0x0000,0x0000,0xf6cb,0x0000,0xf6cd,0xf6cc,0xc566,
-0xf7c8,0x0000,0xf876,0xf877,0xc5f0,0xf964,0xf97d,0xc675,
-0x0000,0xdcb0,0xecb6,0xefb0,0xf3f5,0xe0ef,0x0000,0xefb1,
-0xf1e2,0xf1e1,0x0000,0x0000,0x0000,0x0000,0xf878,0xc652,
-0x0000,0xf965,0xf97e,0x0000,0x0000,0x0000,0xb9a9,0xe8f2,
-0xe8f3,0x0000,0xecb7,0xb9aa,0x0000,0xc35d,0xf1e3,0x0000,
-0xf6cf,0xc567,0xf6d0,0xf6ce,0xf879,0x0000,0xf8e9,0x0000,
-0xb9ab,0x0000,0xefb4,0xefb3,0xefb2,0xf1e4,0x0000,0x0000,
-0xf1e8,0xf1e7,0xf1e6,0xf1e5,0xc35e,0xf3f6,0xf5b9,0xc4d3,
-0xf5b8,0xf6d1,0xf7cb,0xf7ca,0xc5c4,0xf7c9,0xf87c,0xf87b,
-0xf87a,0x0000,0x0000,0xbbf3,0x0000,0xecb8,0xc24d,0x0000,
-0xf3f7,0xf3f8,0xf7cc,0xf87d,0x0000,0x0000,0xf8ea,0xf966,
-0xf9b9,0xf9d4,0xbbf4,0xc24e,0xf1e9,0xf3f9,0xf6d2,0xf87e,
-0x0000,0x0000,0xbea6,0x0000,0xefb5,0xf1ea,0xf3fa,0xf3fb,
-0xf3fc,0xf5be,0x0000,0xf5ba,0xc568,0xf5bd,0xf5bc,0xc4d4,
-0xf5bb,0xc4d6,0x0000,0xc4d5,0xf6d4,0xf6d3,0xc569,0xc56a,
-0x0000,0x0000,0xc5c6,0xf7cd,0xc5c5,0x0000,0xf8a3,0xf8a4,
-0xf8a2,0xf8a1,0xc654,0x0000,0xf8eb,0xf8ec,0xf8ed,0xc653,
-0xf967,0xf96a,0xf969,0xf968,0x0000,0x0000,0xf9d3,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0xc073,0x0000,0x0000,
-0xc365,0xf5bf,0xf6d5,0x0000,0xc5c7,0xf7ce,0x0000,0x0000,
-0xf9d5,0x0000,0x0000,0x0000,0xc074,0x0000,0x0000,0x0000,
-0xefb6,0x0000,0xf7cf,0x0000,0xf9a1};
-
-static const int ucs_i_big5_table_min = 0x4d00;
-static const int ucs_i_big5_table_max = 0x4d00 + (sizeof (ucs_i_big5_table) / sizeof (unsigned short));
-
-static const unsigned short ucs_pua_big5_table[] = {
-/* 0xf600 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0xc6a1,0xc6a2,0xc6a3,0xc6a4,0xc6a5,0xc6a6,0xc6a7,
-0xc6a8,0xc6a9,0xc6aa,0xc6ab,0xc6ac,0xc6ad,0xc6ae,0xc6af,
-0xc6b0,0xc6b1,0xc6b2,0xc6b3,0xc6b4,0xc6b5,0xc6b6,0xc6b7,
-0xc6b8,0xc6b9,0xc6ba,0xc6bb,0xc6bc,0xc6bd,0xc6be,0xc6bf,
-0xc6c0,0xc6c1,0xc6c2,0xc6c3,0xc6c4,0xc6c5,0xc6c6,0xc6c7,
-0xc6c8,0xc6c9,0xc6ca,0xc6cb,0xc6cc,0xc6cd,0xc6ce,0xc6cf,
-0xc6d0,0xc6d1,0xc6d2,0xc6d3,0xc6d4,0xc6d5,0xc6d6,0xc6d7,
-0xc6d8,0xc6d9,0xc6da,0xc6db,0xc6dc,0xc6dd,0xc6de,0xc6df,
-0xc6e0,0xc6e1,0xc6e2,0xc6e3,0xc6e4,0xc6e5,0xc6e6,0xc6e7,
-0xc6e8,0xc6e9,0xc6ea,0xc6eb,0xc6ec,0xc6ed,0xc6ee,0xc6ef,
-0xc6f0,0xc6f1,0xc6f2,0xc6f3,0xc6f4,0xc6f5,0xc6f6,0xc6f7,
-0xc6f8,0xc6f9,0xc6fa,0xc6fb,0xc6fc,0xc6fd,0xc6fe,0xc740,
-0xc741,0xc742,0xc743,0xc744,0xc745,0xc746,0xc747,0xc748,
-0xc749,0xc74a,0xc74b,0xc74c,0xc74d,0xc74e,0xc74f,0xc750,
-0xc751,0xc752,0xc753,0xc754,0xc755,0xc756,0xc757,0xc758,
-0xc759,0xc75a,0xc75b,0xc75c,0xc75d,0xc75e,0xc75f,0xc760,
-0xc761,0xc762,0xc763,0xc764,0xc765,0xc766,0xc767,0xc768,
-0xc769,0xc76a,0xc76b,0xc76c,0xc76d,0xc76e,0xc76f,0xc770,
-0xc771,0xc772,0xc773,0xc774,0xc775,0xc776,0xc777,0xc778,
-0xc779,0xc77a,0xc77b,0xc77c,0xc77d,0xc77e,0xc7a1,0xc7a2,
-0xc7a3,0xc7a4,0xc7a5,0xc7a6,0xc7a7,0xc7a8,0xc7a9,0xc7aa,
-0xc7ab,0xc7ac,0xc7ad,0xc7ae,0xc7af,0xc7b0,0xc7b1,0xc7b2,
-0xc7b3,0xc7b4,0xc7b5,0xc7b6,0xc7b7,0xc7b8,0xc7b9,0xc7ba,
-0xc7bb,0xc7bc,0xc7bd,0xc7be,0xc7bf,0xc7c0,0xc7c1,0xc7c2,
-0xc7c3,0xc7c4,0xc7c5,0xc7c6,0xc7c7,0xc7c8,0xc7c9,0xc7ca,
-0xc7cb,0xc7cc,0xc7cd,0xc7ce,0xc7cf,0xc7d0,0xc7d1,0xc7d2,
-0xc7d3,0xc7d4,0xc7d5,0xc7d6,0xc7d7,0xc7d8,0xc7d9,0xc7da,
-0xc7db,0xc7dc,0xc7dd,0xc7de,0xc7df,0xc7e0,0xc7e1,0xc7e2,
-0xc7e3,0xc7e4,0xc7e5,0xc7e6,0xc7e7,0xc7e8,0xc7e9,0xc7ea,
-0xc7eb,0xc7ec,0xc7ed,0xc7ee,0xc7ef,0xc7f0,0xc7f1,0xc7f2,
-0xc7f3,0xc7f4,0xc7f5,0xc7f6,0xc7f7,0xc7f8,0xc7f9,0xc7fa,
-0xc7fb,0xc7fc,0xc7fd,0xc7fe,0xc840,0xc841,0xc842,0xc843,
-0xc844,0xc845,0xc846,0xc847,0xc848,0xc849,0xc84a,0xc84b,
-0xc84c,0xc84d,0xc84e,0xc84f,0xc850,0xc851,0xc852,0xc853,
-0xc854,0xc855,0xc856,0xc857,0xc858,0xc859,0xc85a,0xc85b,
-0xc85c,0xc85d,0xc85e,0xc85f,0xc860,0xc861,0xc862,0xc863,
-0xc864,0xc865,0xc866,0xc867,0xc868,0xc869,0xc86a,0xc86b,
-0xc86c,0xc86d,0xc86e,0xc86f,0xc870,0xc871,0xc872,0xc873,
-0xc874,0xc875,0xc876,0xc877,0xc878,0xc879,0xc87a,0xc87b,
-0xc87c,0xc87d,0xc87e,0xc8a1,0xc8a2,0xc8a3,0xc8a4,0xc8a5,
-0xc8a6,0xc8a7,0xc8a8,0xc8a9,0xc8aa,0xc8ab,0xc8ac,0xc8ad,
-0xc8ae,0xc8af,0xc8b0,0xc8b1,0xc8b2,0xc8b3,0xc8b4,0xc8b5,
-0xc8b6,0xc8b7,0xc8b8,0xc8b9,0xc8ba,0xc8bb,0xc8bc,0xc8bd,
-0xc8be,0xc8bf,0xc8c0,0xc8c1,0xc8c2,0xc8c3,0xc8c4,0xc8c5,
-0xc8c6,0xc8c7,0xc8c8,0xc8c9,0xc8ca,0xc8cb,0xc8cc,0xc8cd,
-0xc8ce,0xc8cf,0xc8d0,0xc8d1,0xc8d2,0xc8d3,0xc8d4,0xc8d5,
-0xc8d6,0xc8d7,0xc8d8,0xc8d9,0xc8da,0xc8db,0xc8dc,0xc8dd,
-0xc8de,0xc8df,0xc8e0,0xc8e1,0xc8e2,0xc8e3,0xc8e4,0xc8e5,
-0xc8e6,0xc8e7,0xc8e8,0xc8e9,0xc8ea,0xc8eb,0xc8ec,0xc8ed,
-0xc8ee,0xc8ef,0xc8f0,0xc8f1,0xc8f2,0xc8f3,0xc8f4,0xc8f5,
-0xc8f6,0xc8f7,0xc8f8,0xc8f9,0xc8fa,0xc8fb,0xc8fc,0xc8fd,
-0xc8fe};
-
-static const int ucs_pua_big5_table_min = 0xf600;
-static const int ucs_pua_big5_table_max = 0xf600 + (sizeof (ucs_pua_big5_table) / sizeof (unsigned short));
-
-static const unsigned short ucs_r1_big5_table[] = {
-/* 0xfa00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0xc94a,0xddfc};
-
-static const int ucs_r1_big5_table_min = 0xfa00;
-static const int ucs_r1_big5_table_max = 0xfa00 + (sizeof (ucs_r1_big5_table) / sizeof (unsigned short));
-
-static const unsigned short ucs_r2_big5_table[] = {
-/* 0xfe00 */
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa14a,0xa157,0x0000,0xa159,0xa15b,0xa15f,0xa160,0xa163,
-0xa164,0xa167,0xa168,0xa16b,0xa16c,0xa16f,0xa170,0xa173,
-0xa174,0xa177,0xa178,0xa17b,0xa17c,0x0000,0x0000,0x0000,
-0x0000,0xa1c6,0xa1c7,0xa1ca,0xa1cb,0xa1c8,0xa1c9,0xa15c,
-0xa14d,0xa14e,0xa14f,0x0000,0xa151,0xa152,0xa153,0xa154,
-0x0000,0xa17d,0xa17e,0xa1a1,0xa1a2,0xa1a3,0xa1a4,0xa1cc,
-0xa1cd,0xa1ce,0xa1de,0xa1df,0xa1e0,0xa1e1,0xa1e2,0x0000,
-0xa242,0xa24c,0xa24d,0xa24e,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-/* 0xff00 */
-0x0000,0xa149,0x0000,0xa1ad,0xa243,0xa248,0xa1ae,0x0000,
-0xa15d,0xa15e,0xa1af,0xa1cf,0xa141,0xa1d0,0xa144,0xa1fe,
-0xa2af,0xa2b0,0xa2b1,0xa2b2,0xa2b3,0xa2b4,0xa2b5,0xa2b6,
-0xa2b7,0xa2b8,0xa147,0xa146,0xa1d5,0xa1d7,0xa1d6,0xa148,
-0xa249,0xa2cf,0xa2d0,0xa2d1,0xa2d2,0xa2d3,0xa2d4,0xa2d5,
-0xa2d6,0xa2d7,0xa2d8,0xa2d9,0xa2da,0xa2db,0xa2dc,0xa2dd,
-0xa2de,0xa2df,0xa2e0,0xa2e1,0xa2e2,0xa2e3,0xa2e4,0xa2e5,
-0xa2e6,0xa2e7,0xa2e8,0x0000,0xa240,0x0000,0x0000,0xa1c4,
-0x0000,0xa2e9,0xa2ea,0xa2eb,0xa2ec,0xa2ed,0xa2ee,0xa2ef,
-0xa2f0,0xa2f1,0xa2f2,0xa2f3,0xa2f4,0xa2f5,0xa2f6,0xa2f7,
-0xa2f8,0xa2f9,0xa2fa,0xa2fb,0xa2fc,0xa2fd,0xa2fe,0xa340,
-0xa341,0xa342,0xa343,0xa161,0xa155,0xa162,0xa1e3,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-0xa246,0xa247,0x0000,0xa1c3,0x0000,0xa244};
-
-static const int ucs_r2_big5_table_min = 0xfe00;
-static const int ucs_r2_big5_table_max = 0xfe00 + (sizeof (ucs_r2_big5_table) / sizeof (unsigned short));
diff --git a/ext/mcal/CREDITS b/ext/mcal/CREDITS
deleted file mode 100644
index 7d9c3a1290..0000000000
--- a/ext/mcal/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-MCAL
-Mark Musone, Chuck Hagenbuch
diff --git a/ext/mcal/config.m4 b/ext/mcal/config.m4
deleted file mode 100644
index c2f119c5e6..0000000000
--- a/ext/mcal/config.m4
+++ /dev/null
@@ -1,45 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(mcal,for MCAL support,
-[ --with-mcal[=DIR] Include MCAL support.])
-
-if test "$PHP_MCAL" != "no"; then
- MCAL_DEFAULT_SEARCH=/usr/local
- if test "$PHP_MCAL" = "yes"; then
- MCAL_DIR=$MCAL_DEFAULT_SEARCH
- else
- PHP_EXPAND_PATH($PHP_MCAL, MCAL_DIR)
- fi
-
- for i in $MCAL_DIR $MCAL_DIR/mcal $MCAL_DIR/mcal/include $MCAL_DIR/include/mcal $MCAL_DIR/include; do
- if test -r "$i/mcal.h"; then
- MCAL_INCLUDE=$i
- fi
- done
-
- for i in $MCAL_DIR $MCAL_DIR/mcal $MCAL_DIR/mcal/lib $MCAL_DIR/lib/mcal $MCAL_DIR/lib; do
- if test -r "$i/libmcal.a"; then
- MCAL_LIBRARY=$i
- fi
- done
-
- for i in mcal cal_misc icalroutines; do
- if test ! -f "$MCAL_INCLUDE/$i.h"; then
- AC_MSG_ERROR(Unable to locate your libmcal header files - $i.h should be in the directory you specify or in the include/ subdirectory below it - default search location is $MCAL_DEFAULT_SEARCH)
- fi
- done
-
- if test ! -f "$MCAL_LIBRARY/libmcal.a"; then
- AC_MSG_ERROR(Unable to locate your libmcal library files - libmcal.a should be in the directory you specify or in the lib/ subdirectory below it - default search location is $MCAL_DEFAULT_SEARCH)
- fi
-
- PHP_ADD_INCLUDE($MCAL_INCLUDE)
- PHP_ADD_LIBPATH($MCAL_LIBRARY,MCAL_SHARED_LIBADD)
- PHP_ADD_LIBRARY_DEFER(mcal,[],MCAL_SHARED_LIBADD)
- PHP_SUBST(MCAL_SHARED_LIBADD)
- AC_DEFINE(HAVE_MCAL,1,[ ])
- PHP_NEW_EXTENSION(mcal, php_mcal.c, $ext_shared)
-fi
-
diff --git a/ext/mcal/php_mcal.c b/ext/mcal/php_mcal.c
deleted file mode 100644
index 3ef97c5683..0000000000
--- a/ext/mcal/php_mcal.c
+++ /dev/null
@@ -1,1625 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Mark Musone <musone@chek.com> |
- | Chuck Hagenbuch <chuck@horde.org> |
- +----------------------------------------------------------------------+
-*/
-
-#define MCAL1
-
-#ifdef ERROR
-#undef ERROR
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_MCAL
-
-#include <time.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <signal.h>
-#include <stdarg.h>
-#include "mcal.h"
-#include "php_mcal.h"
-#include "zend_modules.h"
-#include "ext/standard/info.h"
-#include "ext/standard/basic_functions.h"
-#ifdef PHP_WIN32
-#include "winsock2.h"
-#endif
-
-static void cal_close_it(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-
-typedef struct _php_mcal_le_struct {
- CALSTREAM *mcal_stream;
- long public;
- CALEVENT *event;
- long flags;
-} pils;
-
-
-typedef struct cal_list {
- php_uint32 uid;
- struct cal_list *next;
-} cal_list_t;
-
-static cal_list_t *g_cal_list=NULL;
-static cal_list_t *g_cal_list_end=NULL;
-/*
- * this array should be set up as:
- * {"PHPScriptFunctionName",dllFunctionName,1}
- */
-
-function_entry mcal_functions[] = {
- PHP_FE(mcal_open,NULL)
- PHP_FE(mcal_close,NULL)
- PHP_FE(mcal_popen,NULL)
- PHP_FE(mcal_reopen,NULL)
- PHP_FE(mcal_fetch_event,NULL)
- PHP_FE(mcal_list_events,NULL)
- PHP_FE(mcal_list_alarms,NULL)
- PHP_FE(mcal_create_calendar,NULL)
- PHP_FE(mcal_rename_calendar,NULL)
- PHP_FE(mcal_delete_calendar,NULL)
- PHP_FE(mcal_delete_event,NULL)
- PHP_FE(mcal_append_event,NULL)
- PHP_FE(mcal_store_event,NULL)
- PHP_FE(mcal_snooze,NULL)
- PHP_FE(mcal_event_set_category,NULL)
- PHP_FE(mcal_event_set_title,NULL)
- PHP_FE(mcal_event_set_description,NULL)
- PHP_FE(mcal_event_set_start,NULL)
- PHP_FE(mcal_event_set_end,NULL)
- PHP_FE(mcal_event_set_alarm,NULL)
- PHP_FE(mcal_event_set_class,NULL)
- PHP_FE(mcal_event_add_attribute,NULL)
- PHP_FE(mcal_is_leap_year,NULL)
- PHP_FE(mcal_days_in_month,NULL)
- PHP_FE(mcal_date_valid,NULL)
- PHP_FE(mcal_time_valid,NULL)
- PHP_FE(mcal_day_of_week,NULL)
- PHP_FE(mcal_day_of_year,NULL)
- PHP_FE(mcal_week_of_year,NULL)
- PHP_FE(mcal_date_compare,NULL)
- PHP_FE(mcal_event_init,NULL)
- PHP_FE(mcal_next_recurrence,NULL)
- PHP_FE(mcal_event_set_recur_none,NULL)
- PHP_FE(mcal_event_set_recur_daily,NULL)
- PHP_FE(mcal_event_set_recur_weekly,NULL)
- PHP_FE(mcal_event_set_recur_monthly_mday,NULL)
- PHP_FE(mcal_event_set_recur_monthly_wday,NULL)
- PHP_FE(mcal_event_set_recur_yearly,NULL)
- PHP_FE(mcal_fetch_current_stream_event,NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry php_mcal_module_entry = {
- STANDARD_MODULE_HEADER,
- "mcal",
- mcal_functions,
- PHP_MINIT(mcal),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(mcal),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_MCAL
-ZEND_GET_MODULE(php_mcal)
-#endif
-
-/*
- I believe since this global is used ONLY within this module,
- and nothing will link to this module, we can use the simple
- thread local_ storage
-*/
-static int le_mcal;
-char *mcal_user;
-char *mcal_password;
-
-
-static void cal_close_it (zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- pils *mcal_le_struct = (pils *)rsrc->ptr;
-
- cal_close(mcal_le_struct->mcal_stream,0);
- efree(mcal_le_struct);
-}
-
-
-PHP_MINFO_FUNCTION(mcal)
-{
- char tmp[128];
-
- php_info_print_table_start();
- php_info_print_table_row(2, "MCAL Support", "enabled" );
-#ifdef MCALVER
- snprintf(tmp, 128, "%s - %d", CALVER, MCALVER);
-#else
- snprintf(tmp, 128, "%s", CALVER );
-#endif
- php_info_print_table_row(2, "MCAL Version", tmp );
- php_info_print_table_end();
-}
-
-PHP_MINIT_FUNCTION(mcal)
-{
- le_mcal = zend_register_list_destructors_ex(cal_close_it, NULL, "mcal", module_number);
-
- REGISTER_LONG_CONSTANT("MCAL_SUNDAY", SUNDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_MONDAY", MONDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_TUESDAY", TUESDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_WEDNESDAY", WEDNESDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_THURSDAY", THURSDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_FRIDAY", FRIDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_SATURDAY", SATURDAY, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_LONG_CONSTANT("MCAL_JANUARY", JANUARY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_FEBRUARY", FEBRUARY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_MARCH", MARCH, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_APRIL", APRIL, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_MAY", MAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_JUNE", JUNE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_JULY", JULY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_AUGUST", AUGUST, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_SEPTEMBER", SEPTEMBER, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_OCTOBER", OCTOBER, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_NOVEMBER", NOVEMBER, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_LONG_CONSTANT("MCAL_RECUR_NONE", RECUR_NONE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_RECUR_DAILY", RECUR_DAILY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_RECUR_WEEKLY", RECUR_WEEKLY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_RECUR_MONTHLY_MDAY", RECUR_MONTHLY_MDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_RECUR_MONTHLY_WDAY", RECUR_MONTHLY_WDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_RECUR_YEARLY", RECUR_YEARLY, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_LONG_CONSTANT("MCAL_M_SUNDAY", M_SUNDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_M_MONDAY", M_MONDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_M_TUESDAY", M_TUESDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_M_WEDNESDAY", M_WEDNESDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_M_THURSDAY", M_THURSDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_M_FRIDAY", M_FRIDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_M_SATURDAY", M_SATURDAY, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_LONG_CONSTANT("MCAL_M_WEEKDAYS", M_WEEKDAYS, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_M_WEEKEND", M_WEEKEND, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("MCAL_M_ALLDAYS", M_ALLDAYS, CONST_PERSISTENT | CONST_CS);
-
- return SUCCESS;
-}
-
-static int add_assoc_object(zval *arg, char *key, zval *tmp TSRMLS_DC)
-{
- HashTable *symtable;
-
- if (Z_TYPE_P(arg) == IS_OBJECT) {
- symtable = Z_OBJPROP_P(arg);
- } else {
- symtable = Z_ARRVAL_P(arg);
- }
- return zend_hash_update(symtable, key, strlen(key)+1, (void *)&tmp, sizeof(zval *), NULL);
-}
-
-static void php_mcal_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- zval **calendar, **user, **passwd, **options;
- CALSTREAM *mcal_stream;
- pils *mcal_le_struct;
- long flags=0;
- int ind;
-
- int myargc = ZEND_NUM_ARGS();
- if (myargc < 3 || myargc > 4 || zend_get_parameters_ex(myargc, &calendar, &user, &passwd, &options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(calendar);
- convert_to_string_ex(user);
- convert_to_string_ex(passwd);
- mcal_user = estrndup(Z_STRVAL_PP(user), Z_STRLEN_PP(user));
- mcal_password = estrndup(Z_STRVAL_PP(passwd), Z_STRLEN_PP(passwd));
- if (myargc == 4) {
- convert_to_long_ex(options);
- flags = Z_LVAL_PP(options);
- }
- mcal_stream = cal_open(NULL, Z_STRVAL_PP(calendar), 0);
- efree(mcal_user);
- efree(mcal_password);
-
- if (!mcal_stream) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't open stream %s\n", Z_STRVAL_PP(calendar));
- RETURN_FALSE;
- }
-
- mcal_le_struct = emalloc(sizeof(pils));
- mcal_le_struct->mcal_stream = mcal_stream;
- mcal_le_struct->event=calevent_new();
-
- ind = zend_list_insert(mcal_le_struct, le_mcal);
- RETURN_LONG(ind);
-}
-
-static void php_mcal_event_init(struct _php_mcal_le_struct *mystruct)
-{
- calevent_free(mystruct->event);
- mystruct->event=calevent_new();
-}
-
-static void _php_make_event_object(zval *myzvalue, CALEVENT *event TSRMLS_DC)
-{
- zval *start, *end, *recurend, *attrlist;
- CALATTR *attr;
-
- object_init(myzvalue);
- add_property_long(myzvalue,"id",event->id);
- add_property_long(myzvalue,"public",event->public);
-
- MAKE_STD_ZVAL(start);
- object_init(start);
- if (event->start.has_date) {
- add_property_long(start,"year",event->start.year);
- add_property_long(start,"month",event->start.mon);
- add_property_long(start,"mday",event->start.mday);
- }
- if (event->start.has_time) {
- add_property_long(start,"hour",event->start.hour);
- add_property_long(start,"min",event->start.min);
- add_property_long(start,"sec",event->start.sec);
- }
- add_assoc_object(myzvalue, "start", start TSRMLS_CC);
-
- MAKE_STD_ZVAL(end);
- object_init(end);
- if (event->end.has_date) {
- add_property_long(end,"year",event->end.year);
- add_property_long(end,"month",event->end.mon);
- add_property_long(end,"mday",event->end.mday);
- }
- if (event->end.has_time) {
- add_property_long(end,"hour",event->end.hour);
- add_property_long(end,"min",event->end.min);
- add_property_long(end,"sec",event->end.sec);
- }
- add_assoc_object(myzvalue, "end", end TSRMLS_CC);
-
- if (event->category)
- add_property_string(myzvalue,"category",event->category,1);
- if (event->title)
- add_property_string(myzvalue,"title",event->title,1);
- if (event->description)
- add_property_string(myzvalue,"description",event->description,1);
- add_property_long(myzvalue,"alarm",event->alarm);
- add_property_long(myzvalue,"recur_type",event->recur_type);
- add_property_long(myzvalue,"recur_interval",event->recur_interval);
-
- MAKE_STD_ZVAL(recurend);
- object_init(recurend);
- if (event->recur_enddate.has_date) {
- add_property_long(recurend,"year",event->recur_enddate.year);
- add_property_long(recurend,"month",event->recur_enddate.mon);
- add_property_long(recurend,"mday",event->recur_enddate.mday);
- }
- if (event->recur_enddate.has_time) {
- add_property_long(recurend,"hour",event->recur_enddate.hour);
- add_property_long(recurend,"min",event->recur_enddate.min);
- add_property_long(recurend,"sec",event->recur_enddate.sec);
- }
- add_assoc_object(myzvalue, "recur_enddate", recurend TSRMLS_CC);
-
- add_property_long(myzvalue,"recur_data",event->recur_data.weekly_wday);
-
- if (event->attrlist) {
- MAKE_STD_ZVAL(attrlist);
- object_init(attrlist);
- array_init(attrlist);
- for (attr = event->attrlist; attr; attr = attr->next) {
- add_assoc_string(attrlist, attr->name, attr->value, 1);
- }
- add_assoc_object(myzvalue, "attrlist", attrlist TSRMLS_CC);
- }
-}
-
-/* {{{ proto int mcal_close(int stream_id [, int options])
- Close an MCAL stream */
-PHP_FUNCTION(mcal_close)
-{
- zval **options, **streamind;
- int ind, ind_type;
- pils *mcal_le_struct=NULL;
- int myargcount=ZEND_NUM_ARGS();
- long flags = 0;
-
- if (myargcount < 1 || myargcount > 2 || zend_get_parameters_ex(myargcount, &streamind, &options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- if (myargcount==2) {
- convert_to_long_ex(options);
- flags = Z_LVAL_PP(options);
- mcal_le_struct->flags = flags;
- }
- zend_list_delete(ind);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mcal_open(string calendar, string user, string password [, int options])
- Open an MCAL stream to a calendar */
-PHP_FUNCTION(mcal_open)
-{
- php_mcal_do_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string mcal_popen(string calendar, string user, string password [, int options])
- Open a persistent MCAL stream to a calendar */
-PHP_FUNCTION(mcal_popen)
-{
- php_mcal_do_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-
-/* {{{ proto int mcal_reopen(int stream_id, string calendar [, int options])
- Reopen MCAL stream to a new calendar */
-PHP_FUNCTION(mcal_reopen)
-{
- zval **streamind, **calendar, **options;
- CALSTREAM *mcal_stream=NULL;
- pils *mcal_le_struct;
- int ind, ind_type;
- long flags=0;
- long cl_flags=0;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &calendar, &options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- convert_to_string_ex(calendar);
- if (myargc == 3) {
- convert_to_long_ex(options);
- flags = Z_LVAL_PP(options);
- mcal_le_struct->flags = cl_flags;
- }
- if (mcal_stream == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Couldn't re-open stream\n");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mcal_expunge(int stream_id)
- Delete all events marked for deletion */
-PHP_FUNCTION(mcal_expunge)
-{
- zval **streamind;
- int ind, ind_type;
- pils *mcal_le_struct;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = Z_LVAL_PP(streamind);
-
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- /* cal_expunge (mcal_le_struct->mcal_stream);
- */
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mcal_fetch_event(int stream_id, int eventid [, int options])
- Fetch an event */
-PHP_FUNCTION(mcal_fetch_event)
-{
- zval **streamind, **eventid, **options=NULL;
- int ind, ind_type;
- pils *mcal_le_struct=NULL;
- CALEVENT *myevent;
- int myargcount=ZEND_NUM_ARGS();
-
- if (myargcount < 1 || myargcount > 3 || zend_get_parameters_ex(myargcount, &streamind, &eventid, &options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(streamind);
- convert_to_long_ex(eventid);
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- if (myargcount == 3) {
- convert_to_long_ex(options);
- }
- cal_fetch(mcal_le_struct->mcal_stream, Z_LVAL_PP(eventid), &myevent);
- if (myevent == NULL) {
- RETURN_FALSE;
- }
- calevent_free(mcal_le_struct->event);
- mcal_le_struct->event = myevent;
- _php_make_event_object(return_value, mcal_le_struct->event TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto object mcal_fetch_current_stream_event(int stream_id)
- Fetch the current event stored in the stream's event structure */
-PHP_FUNCTION(mcal_fetch_current_stream_event)
-{
- zval **streamind;
- int ind, ind_type;
- pils *mcal_le_struct=NULL;
- int myargcount=ZEND_NUM_ARGS();
-
- if (myargcount != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(streamind);
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- _php_make_event_object(return_value, mcal_le_struct->event TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto array mcal_list_events(int stream_id, object begindate [, object enddate])
- Returns list of UIDs for that day or range of days */
-PHP_FUNCTION(mcal_list_events)
-{
- zval **streamind, **startyear, **startmonth, **startday;
- zval **endyear, **endmonth, **endday;
- int ind, ind_type;
- pils *mcal_le_struct;
- cal_list_t *my_cal_list;
- int myargc;
- datetime_t startdate=DT_INIT;
- datetime_t enddate=DT_INIT;
-
- myargc = ZEND_NUM_ARGS();
- if ((myargc != 1 && myargc != 7) || zend_get_parameters_ex(myargc, &streamind, &startyear, &startmonth, &startday, &endyear, &endmonth, &endday) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- /* Initialize return array */
- array_init(return_value);
-
- if (myargc == 7) {
- convert_to_long_ex(startyear);
- convert_to_long_ex(startmonth);
- convert_to_long_ex(startday);
- convert_to_long_ex(endyear);
- convert_to_long_ex(endmonth);
- convert_to_long_ex(endday);
- dt_setdate(&startdate, Z_LVAL_PP(startyear), Z_LVAL_PP(startmonth), Z_LVAL_PP(startday));
- dt_setdate(&enddate, Z_LVAL_PP(endyear), Z_LVAL_PP(endmonth), Z_LVAL_PP(endday));
- }
- else {
- startdate = mcal_le_struct->event->start;
- enddate = mcal_le_struct->event->end;
- }
-
- g_cal_list = NULL;
- cal_search_range(mcal_le_struct->mcal_stream, &startdate, &enddate);
- my_cal_list = g_cal_list;
- while (my_cal_list != NULL) {
- add_next_index_long(return_value, my_cal_list->uid);
- my_cal_list = my_cal_list->next;
- free(g_cal_list);
- g_cal_list = my_cal_list;
- }
-}
-/* }}} */
-
-/* {{{ proto string mcal_create_calendar(int stream_id, string calendar)
- Create a new calendar */
-PHP_FUNCTION(mcal_create_calendar)
-{
- zval **streamind, **calendar;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc = ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &calendar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(calendar);
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- /*
- if (mcal_create(mcal_le_struct->mcal_stream,Z_STRVAL_P(calendar)))
- {
- RETURN_TRUE;
- }
- else
- {
- RETURN_FALSE;
- }
- */
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string mcal_rename_calendar(int stream_id, string src_calendar, string dest_calendar)
- Rename a calendar */
-PHP_FUNCTION(mcal_rename_calendar)
-{
- zval **streamind, **src_calendar, **dest_calendar;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc=ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &streamind, &src_calendar, &dest_calendar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(src_calendar);
- convert_to_string_ex(dest_calendar);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- /*
- if(mcal_rename(mcal_le_struct->mcal_stream,Z_STRVAL_P(src_calendar),Z_STRVAL_P(dest_calendar))) {RETURN_TRUE;}
- else {RETURN_FALSE; }
- */
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mcal_list_alarms(int stream_id, int year, int month, int day, int hour, int min, int sec)
- List alarms for a given time */
-PHP_FUNCTION(mcal_list_alarms)
-{
- zval **streamind, **year, **month, **day, **hour, **min, **sec;
- datetime_t mydate=DT_INIT;
- int ind, ind_type;
- pils *mcal_le_struct;
- cal_list_t *my_cal_list;
- int myargc=ZEND_NUM_ARGS();
- if ((myargc != 1 && myargc != 7) || zend_get_parameters_ex(myargc, &streamind, &year, &month, &day, &hour, &min, &sec) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- if (myargc == 7) {
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(hour);
- convert_to_long_ex(min);
- convert_to_long_ex(sec);
- dt_setdate(&mydate, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day));
- dt_settime(&mydate, Z_LVAL_PP(hour), Z_LVAL_PP(min), Z_LVAL_PP(sec));
- }
- else {
- mydate = mcal_le_struct->event->start;
- }
- g_cal_list = NULL;
- cal_search_alarm(mcal_le_struct->mcal_stream, &mydate);
- my_cal_list = g_cal_list;
- while (my_cal_list != NULL) {
- add_next_index_long(return_value, my_cal_list->uid);
- my_cal_list = my_cal_list->next;
- free(g_cal_list);
- g_cal_list = my_cal_list;
- }
-}
-/* }}} */
-
-/* {{{ proto string mcal_delete_calendar(int stream_id, string calendar)
- Delete calendar */
-PHP_FUNCTION(mcal_delete_calendar)
-{
- zval **streamind, **calendar;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc=ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &calendar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(calendar);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- /* if (mcal_delete_calendar(mcal_le_struct->mcal_stream,Z_STRVAL_P(calendar)))
- {
- RETURN_TRUE;
- }
- else
- {
- RETURN_FALSE;
- }
- */
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string mcal_delete_event(int stream_id, int event_id)
- Delete an event */
-PHP_FUNCTION(mcal_delete_event)
-{
- zval **streamind, **event_id;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc=ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &event_id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(event_id);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if (cal_remove(mcal_le_struct->mcal_stream, Z_LVAL_PP(event_id))) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string mcal_append_event(int stream_id)
- Append a new event to the calendar stream */
-PHP_FUNCTION(mcal_append_event)
-{
- zval **streamind;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- unsigned long event_id;
- CALEVENT *myevent=NULL;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- myevent = mcal_le_struct->event;
- cal_append(mcal_le_struct->mcal_stream, "INBOX", &event_id, myevent);
- calevent_free(myevent);
- RETURN_LONG(event_id);
-}
-/* }}} */
-
-/* {{{ proto string mcal_store_event(int stream_id)
- Store changes to an event */
-PHP_FUNCTION(mcal_store_event)
-{
- zval **streamind;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- CALEVENT *myevent=NULL;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- myevent = mcal_le_struct->event;
- cal_store(mcal_le_struct->mcal_stream, myevent);
- RETURN_LONG(myevent->id);
-}
-/* }}} */
-
-/* {{{ proto string mcal_snooze(int stream_id, int uid)
- Snooze an alarm */
-PHP_FUNCTION(mcal_snooze)
-{
- zval **streamind, **uid;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- myargc = ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &uid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(uid);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if (cal_snooze(mcal_le_struct->mcal_stream, Z_LVAL_PP(uid))) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_category(int stream_id, string category)
- Attach a category to an event */
-PHP_FUNCTION(mcal_event_set_category)
-{
- zval **streamind, **category;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &category) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(category);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- mcal_le_struct->event->category = strdup(Z_STRVAL_PP(category));
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_title(int stream_id, string title)
- Attach a title to an event */
-PHP_FUNCTION(mcal_event_set_title)
-{
- zval **streamind, **title;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &title) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(title);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- mcal_le_struct->event->title = strdup(Z_STRVAL_PP(title));
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_description(int stream_id, string description)
- Attach a description to an event */
-PHP_FUNCTION(mcal_event_set_description)
-{
- zval **streamind, **description;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &description) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(description);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- mcal_le_struct->event->description = strdup(Z_STRVAL_PP(description));
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_start(int stream_id, int year,int month, int day [[[, int hour], int min], int sec])
- Attach a start datetime to an event */
-PHP_FUNCTION(mcal_event_set_start)
-{
- zval **streamind, **year, **month, **date, **hour, **min, **sec;
- int ind, ind_type;
- int myhour=0, mymin=0, mysec=0;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc < 4 || myargc > 7 || zend_get_parameters_ex(myargc, &streamind, &year, &month, &date, &hour, &min, &sec) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(date);
- if (myargc > 4) convert_to_long_ex(hour);
- if (myargc > 5) convert_to_long_ex(min);
- if (myargc > 6) convert_to_long_ex(sec);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- dt_setdate(&(mcal_le_struct->event->start), Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(date));
-
- if (myargc > 4) myhour = Z_LVAL_PP(hour);
- if (myargc > 5) mymin = Z_LVAL_PP(min);
- if (myargc > 6) mysec = Z_LVAL_PP(sec);
- if (myargc > 4) dt_settime(&(mcal_le_struct->event->start), myhour, mymin, mysec);
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_end(int stream_id, int year,int month, int day [[[, int hour], int min], int sec])
- Attach an end datetime to an event */
-PHP_FUNCTION(mcal_event_set_end)
-{
- zval **streamind, **year, **month, **date, **hour, **min, **sec;
- int ind, ind_type;
- /* initialize these to zero to make sure we don't use them
- uninitialized (and to avoid the gcc warning) */
- int myhour = 0; int mymin = 0; int mysec = 0;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc < 4 || myargc > 7 || zend_get_parameters_ex(myargc, &streamind, &year, &month, &date, &hour, &min, &sec) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(date);
- if (myargc > 4) convert_to_long_ex(hour);
- if (myargc > 5) convert_to_long_ex(min);
- if (myargc > 6) convert_to_long_ex(sec);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- dt_setdate(&(mcal_le_struct->event->end), Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(date));
-
- if (myargc > 4) myhour = Z_LVAL_PP(hour);
- if (myargc > 5) mymin = Z_LVAL_PP(min);
- if (myargc > 6) mysec = Z_LVAL_PP(sec);
- if (myargc > 4) dt_settime(&(mcal_le_struct->event->end), myhour, mymin, mysec);
-}
-/* }}} */
-
-/* {{{ proto int mcal_event_set_alarm(int stream_id, int alarm)
- Add an alarm to the streams global event */
-PHP_FUNCTION(mcal_event_set_alarm)
-{
- zval **streamind, **alarm;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- myargc=ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &alarm) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(alarm);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- mcal_le_struct->event->alarm = Z_LVAL_PP(alarm);
-}
-/* }}} */
-
-/* {{{ proto int mcal_event_init(int stream_id)
- Initialize a streams global event */
-PHP_FUNCTION(mcal_event_init)
-{
- zval **streamind;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- php_mcal_event_init(mcal_le_struct);
-}
-/* }}} */
-
-/* {{{ proto int mcal_event_set_class(int stream_id, int class)
- Add an class to the streams global event */
-PHP_FUNCTION(mcal_event_set_class)
-{
- zval **streamind, **class;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &class) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(class);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- mcal_le_struct->event->public = Z_LVAL_PP(class);
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_add_attribute(int stream_id, string attribute, string value)
- Add an attribute and value to an event */
-PHP_FUNCTION(mcal_event_add_attribute)
-{
- zval **streamind, **attribute, **val;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &streamind, &attribute, &val) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(attribute);
- convert_to_string_ex(val);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-#if MCALVER >= 20000121
- if (calevent_setattr(mcal_le_struct->event, Z_STRVAL_PP(attribute), Z_STRVAL_PP(val))) {
- RETURN_TRUE;
- }
- else
-#endif
- {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool mcal_is_leap_year(int year)
- Returns true if year is a leap year, false if not */
-PHP_FUNCTION(mcal_is_leap_year)
-{
- zval **year;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 1 || zend_get_parameters_ex(1, &year) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(year);
-
- if (isleapyear(Z_LVAL_PP(year))) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int mcal_days_in_month(int month, bool leap_year)
- Returns the number of days in the given month, needs to know if the year is a leap year or not */
-PHP_FUNCTION(mcal_days_in_month)
-{
- zval **month, **leap;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &month, &leap) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(month);
- convert_to_long_ex(leap);
- convert_to_boolean_ex(leap);
-
- RETURN_LONG(daysinmonth(Z_LVAL_PP(month), Z_LVAL_PP(leap)));
-}
-/* }}} */
-
-/* {{{ proto bool mcal_date_valid(int year, int month, int day)
- Returns true if the date is a valid date */
-PHP_FUNCTION(mcal_date_valid)
-{
- zval **year, **month, **day;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &year, &month, &day) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
-
- if (datevalid(Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day))) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool mcal_time_valid(int hour, int min, int sec)
- Returns true if the time is a valid time */
-PHP_FUNCTION(mcal_time_valid)
-{
- zval **hour, **min, **sec;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &hour, &min, &sec) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(hour);
- convert_to_long_ex(min);
- convert_to_long_ex(sec);
-
- if (timevalid(Z_LVAL_PP(hour), Z_LVAL_PP(min), Z_LVAL_PP(sec))) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int mcal_day_of_week(int year, int month, int day)
- Returns the day of the week of the given date */
-PHP_FUNCTION(mcal_day_of_week)
-{
- zval **year, **month, **day;
- int myargc;
- datetime_t mydate;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &year, &month, &day) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
-
- dt_init(&mydate);
- dt_setdate(&mydate, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day));
-
- RETURN_LONG(dt_dayofweek(&mydate));
-}
-/* }}} */
-
-/* {{{ proto int mcal_day_of_year(int year, int month, int day)
- Returns the day of the year of the given date */
-PHP_FUNCTION(mcal_day_of_year)
-{
- zval **year, **month, **day;
- int myargc;
- datetime_t mydate;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &year, &month, &day) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
-
- dt_init(&mydate);
- dt_setdate(&mydate, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day));
-
- RETURN_LONG(dt_dayofyear(&mydate));
-}
-/* }}} */
-
-/* {{{ proto int mcal_week_of_year(int day, int month, int year)
- Returns the week number of the given date */
-PHP_FUNCTION(mcal_week_of_year)
-{
- zval **year, **month, **day;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &day, &month, &year) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
-
- if (datevalid(Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day))) {
- RETURN_LONG(dt_weekofyear(Z_LVAL_PP(day), Z_LVAL_PP(month), Z_LVAL_PP(year)));
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int mcal_date_compare(int ayear, int amonth, int aday, int byear, int bmonth, int bday)
- Returns <0, 0, >0 if a<b, a==b, a>b respectively */
-PHP_FUNCTION(mcal_date_compare)
-{
- zval **ayear, **amonth, **aday;
- zval **byear, **bmonth, **bday;
- int myargc;
- datetime_t myadate, mybdate;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 6 || zend_get_parameters_ex(6, &ayear, &amonth, &aday, &byear, &bmonth, &bday) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(ayear);
- convert_to_long_ex(amonth);
- convert_to_long_ex(aday);
- convert_to_long_ex(byear);
- convert_to_long_ex(bmonth);
- convert_to_long_ex(bday);
-
- dt_init(&myadate);
- dt_init(&mybdate);
- dt_setdate(&myadate, Z_LVAL_PP(ayear), Z_LVAL_PP(amonth), Z_LVAL_PP(aday));
- dt_setdate(&mybdate, Z_LVAL_PP(byear), Z_LVAL_PP(bmonth), Z_LVAL_PP(bday));
-
- RETURN_LONG(dt_compare(&myadate, &mybdate));
-}
-/* }}} */
-
-/* {{{ proto object mcal_next_recurrence(int stream_id, int weekstart, array next)
- Returns an object filled with the next date the event occurs, on or after the supplied date. Returns empty date field if event does not occur or something is invalid. */
-PHP_FUNCTION(mcal_next_recurrence)
-{
- zval **streamind, **weekstart, **next, **zvalue;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- datetime_t mydate;
-
- myargc=ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &streamind, &weekstart, &next) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(weekstart);
- convert_to_array_ex(next);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if (zend_hash_find(Z_ARRVAL_PP(next), "year", sizeof("year"), (void **) &zvalue) == SUCCESS) {
- SEPARATE_ZVAL(zvalue);
- convert_to_long_ex(zvalue);
- mydate.year = Z_LVAL_PP(zvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(next), "month", sizeof("month"), (void **) &zvalue) == SUCCESS) {
- SEPARATE_ZVAL(zvalue);
- convert_to_long_ex(zvalue);
- mydate.mon = Z_LVAL_PP(zvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(next), "mday", sizeof("mday"), (void **) &zvalue) == SUCCESS) {
- SEPARATE_ZVAL(zvalue);
- convert_to_long_ex(zvalue);
- mydate.mday = Z_LVAL_PP(zvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(next), "hour", sizeof("hour"), (void **) &zvalue) == SUCCESS) {
- SEPARATE_ZVAL(zvalue);
- convert_to_long_ex(zvalue);
- mydate.hour = Z_LVAL_PP(zvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(next), "min", sizeof("min"), (void **) &zvalue) == SUCCESS) {
- SEPARATE_ZVAL(zvalue);
- convert_to_long_ex(zvalue);
- mydate.min = Z_LVAL_PP(zvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(next), "sec", sizeof("sec"), (void **) &zvalue) == SUCCESS) {
- SEPARATE_ZVAL(zvalue);
- convert_to_long_ex(zvalue);
- mydate.sec = Z_LVAL_PP(zvalue);
- }
-
- calevent_next_recurrence(mcal_le_struct->event, &mydate, Z_LVAL_PP(weekstart));
-
- object_init(return_value);
-
- if (mydate.has_date) {
- add_property_long(return_value, "year", mydate.year);
- add_property_long(return_value, "month", mydate.mon);
- add_property_long(return_value, "mday", mydate.mday);
- }
- if (mydate.has_time) {
- add_property_long(return_value, "hour", mydate.hour);
- add_property_long(return_value, "min", mydate.min);
- add_property_long(return_value, "sec", mydate.sec);
- }
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_recur_none(int stream_id)
- Create a daily recurrence */
-PHP_FUNCTION(mcal_event_set_recur_none)
-{
- zval **streamind;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- calevent_recur_none(mcal_le_struct->event);
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_recur_daily(int stream_id, int year, int month, int day, int interval)
- Create a daily recurrence */
-PHP_FUNCTION(mcal_event_set_recur_daily)
-{
- zval **streamind, **year, **month, **day, **interval;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- datetime_t endtime = DT_INIT;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 5 || zend_get_parameters_ex(5, &streamind, &year, &month, &day, &interval) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(interval);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- dt_setdate(&endtime, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day));
- calevent_recur_daily(mcal_le_struct->event, &endtime, Z_LVAL_PP(interval));
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_recur_weekly(int stream_id, int year, int month, int day, int interval, int weekdays)
- Create a weekly recurrence */
-PHP_FUNCTION(mcal_event_set_recur_weekly)
-{
- zval **streamind, **year, **month, **day, **interval, **weekdays;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- datetime_t endtime=DT_INIT;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 6 || zend_get_parameters_ex(6, &streamind, &year, &month, &day, &interval, &weekdays) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(interval);
- convert_to_long_ex(weekdays);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- dt_setdate(&endtime, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day));
- calevent_recur_weekly(mcal_le_struct->event, &endtime, Z_LVAL_PP(interval), Z_LVAL_PP(weekdays));
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_recur_monthly_mday(int stream_id, int year, int month, int day, int interval)
- Create a monthly by day recurrence */
-PHP_FUNCTION(mcal_event_set_recur_monthly_mday)
-{
- zval **streamind, **year, **month, **day, **interval;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- datetime_t endtime=DT_INIT;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 5 || zend_get_parameters_ex(5, &streamind, &year, &month, &day, &interval) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(interval);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- dt_setdate(&endtime, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day));
- calevent_recur_monthly_mday(mcal_le_struct->event, &endtime, Z_LVAL_PP(interval));
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_recur_monthly_wday(int stream_id, int year, int month, int day, int interval)
- Create a monthly by week recurrence */
-PHP_FUNCTION(mcal_event_set_recur_monthly_wday)
-{
- zval **streamind, **year, **month, **day, **interval;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- datetime_t endtime=DT_INIT;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 5 || zend_get_parameters_ex(5, &streamind, &year, &month, &day, &interval) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(interval);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- dt_setdate(&endtime, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day));
- calevent_recur_monthly_wday(mcal_le_struct->event, &endtime, Z_LVAL_PP(interval));
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_recur_yearly(int stream_id, int year, int month, int day, int interval)
- Create a yearly recurrence */
-PHP_FUNCTION(mcal_event_set_recur_yearly)
-{
- zval **streamind, **year, **month, **day, **interval;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- datetime_t endtime=DT_INIT;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 5 || zend_get_parameters_ex(5, &streamind, &year, &month, &day, &interval) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(interval);
-
- ind = Z_LVAL_PP(streamind);
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- dt_setdate(&endtime, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day));
- calevent_recur_yearly(mcal_le_struct->event, &endtime, Z_LVAL_PP(interval));
-}
-/* }}} */
-
-
-/* Interfaces to callbacks */
-void cc_searched (unsigned long cal_uid)
-{
- if (g_cal_list == NULL) {
- g_cal_list = malloc(sizeof(struct cal_list));
- g_cal_list->uid = cal_uid;
- g_cal_list->next = NULL;
- g_cal_list_end = g_cal_list;
- }
- else {
- g_cal_list_end->next = malloc(sizeof(struct cal_list));
- g_cal_list_end = g_cal_list_end->next;
- g_cal_list_end->uid = cal_uid;
- g_cal_list_end->next = NULL;
- }
-}
-
-void cc_appended(php_uint32 uid)
-{
-}
-
-void cc_fetched(const CALEVENT *event)
-{
-}
-
-void cc_login(const char **user, const char **pwd)
-{
- *user=mcal_user;
- *pwd=mcal_password;
-}
-
-void cc_vlog(const char *fmt,va_list ap)
-{
-}
-
-void cc_vdlog(const char *fmt,va_list ap)
-{
-}
-
-#endif
-
-/*
- * Local_ variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/mcal/php_mcal.h b/ext/mcal/php_mcal.h
deleted file mode 100644
index 1845b4cfd1..0000000000
--- a/ext/mcal/php_mcal.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $Id$ */
-
-#ifndef PHP_MCAL_H
-#define PHP_MCAL_H
-
-#if HAVE_MCAL
-
-/* Functions accessable to PHP */
-extern zend_module_entry php_mcal_module_entry;
-#define php_mcal_module_ptr &php_mcal_module_entry
-
-extern int mcal_init_request(INIT_FUNC_ARGS);
-extern int mcal_end_request(void);
-
-PHP_MINIT_FUNCTION(mcal);
-PHP_MINFO_FUNCTION(mcal);
-
-PHP_FUNCTION(mcal_open);
-PHP_FUNCTION(mcal_popen);
-PHP_FUNCTION(mcal_reopen);
-PHP_FUNCTION(mcal_close);
-PHP_FUNCTION(mcal_fetch_event);
-PHP_FUNCTION(mcal_list_events);
-PHP_FUNCTION(mcal_create_calendar);
-PHP_FUNCTION(mcal_rename_calendar);
-PHP_FUNCTION(mcal_delete_calendar);
-PHP_FUNCTION(mcal_append_event);
-PHP_FUNCTION(mcal_store_event);
-PHP_FUNCTION(mcal_delete_event);
-PHP_FUNCTION(mcal_snooze);
-PHP_FUNCTION(mcal_list_alarms);
-PHP_FUNCTION(mcal_event_set_category);
-PHP_FUNCTION(mcal_event_set_title);
-PHP_FUNCTION(mcal_event_set_description);
-PHP_FUNCTION(mcal_event_set_start);
-PHP_FUNCTION(mcal_event_set_end);
-PHP_FUNCTION(mcal_event_set_alarm);
-PHP_FUNCTION(mcal_event_set_class);
-PHP_FUNCTION(mcal_event_add_attribute);
-PHP_FUNCTION(mcal_is_leap_year);
-PHP_FUNCTION(mcal_days_in_month);
-PHP_FUNCTION(mcal_date_valid);
-PHP_FUNCTION(mcal_time_valid);
-PHP_FUNCTION(mcal_day_of_week);
-PHP_FUNCTION(mcal_day_of_year);
-PHP_FUNCTION(mcal_week_of_year);
-PHP_FUNCTION(mcal_date_compare);
-PHP_FUNCTION(mcal_event_init);
-PHP_FUNCTION(mcal_next_recurrence);
-PHP_FUNCTION(mcal_event_set_recur_none);
-PHP_FUNCTION(mcal_event_set_recur_daily);
-PHP_FUNCTION(mcal_event_set_recur_weekly);
-PHP_FUNCTION(mcal_event_set_recur_monthly_mday);
-PHP_FUNCTION(mcal_event_set_recur_monthly_wday);
-PHP_FUNCTION(mcal_event_set_recur_yearly);
-PHP_FUNCTION(mcal_fetch_current_stream_event);
-
-#else
-#define php_mcal_module_ptr NULL
-#endif /* HAVE_MCAL */
-
-#define phpext_mcal_ptr php_mcal_module_ptr
-
-#endif
diff --git a/ext/mcrypt/CREDITS b/ext/mcrypt/CREDITS
deleted file mode 100644
index 00f871b171..0000000000
--- a/ext/mcrypt/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-mcrypt
-Sascha Schumann, Derick Rethans
diff --git a/ext/mcrypt/TODO b/ext/mcrypt/TODO
deleted file mode 100644
index ca743a4b10..0000000000
--- a/ext/mcrypt/TODO
+++ /dev/null
@@ -1,6 +0,0 @@
-/* $Id$ */
-
-TODO:
-- Convert to zend_parse_parameters
-- Unify error handling
-- Implement encryption streams
diff --git a/ext/mcrypt/config.m4 b/ext/mcrypt/config.m4
deleted file mode 100644
index 183cc324f6..0000000000
--- a/ext/mcrypt/config.m4
+++ /dev/null
@@ -1,63 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_DEFUN(PHP_MCRYPT_CHECK_VERSION,[
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS=-I$MCRYPT_DIR/include
- AC_MSG_CHECKING(for libmcrypt version)
- AC_EGREP_CPP(yes,[
-#include <mcrypt.h>
-#if MCRYPT_API_VERSION >= 20021217
- yes
-#endif
- ],[
- AC_MSG_RESULT(>= 2.5.6)
- ],[
- AC_MSG_ERROR(libmcrypt version 2.5.6 or greater required.)
- ])
- CPPFLAGS=$old_CPPFLAGS
-])
-
-
-PHP_ARG_WITH(mcrypt, for mcrypt support,
-[ --with-mcrypt[=DIR] Include mcrypt support.])
-
-if test "$PHP_MCRYPT" != "no"; then
- for i in /usr/local /usr $PHP_MCRYPT; do
- if test -f $i/include/mcrypt.h; then
- MCRYPT_DIR=$i
- fi
- done
-
- if test -z "$MCRYPT_DIR"; then
- AC_MSG_ERROR(mcrypt.h not found. Please reinstall libmcrypt.)
- fi
-
- PHP_MCRYPT_CHECK_VERSION
-
- PHP_CHECK_LIBRARY(mcrypt, mcrypt_module_open,
- [
- PHP_ADD_LIBRARY(ltdl,, MCRYPT_SHARED_LIBADD)
- AC_DEFINE(HAVE_LIBMCRYPT,1,[ ])
- ],[
- unset found
- unset ac_cv_lib_mcrypt_mcrypt_module_open
- PHP_CHECK_LIBRARY(mcrypt, mcrypt_module_open,
- [
- AC_DEFINE(HAVE_LIBMCRYPT,1,[ ])
- ],[
- AC_MSG_ERROR([Sorry, I was not able to diagnose which libmcrypt version you have installed.])
- ],[
- -L$MCRYPT_DIR/lib
- ])
- ],[
- -L$MCRYPT_DIR/lib -lltdl
- ])
-
- PHP_ADD_LIBRARY_WITH_PATH(mcrypt, $MCRYPT_DIR/lib, MCRYPT_SHARED_LIBADD)
- PHP_ADD_INCLUDE($MCRYPT_DIR/include)
-
- PHP_SUBST(MCRYPT_SHARED_LIBADD)
- PHP_NEW_EXTENSION(mcrypt, mcrypt.c, $ext_shared)
-fi
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
deleted file mode 100644
index d98b965e79..0000000000
--- a/ext/mcrypt/mcrypt.c
+++ /dev/null
@@ -1,1273 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- | Derick Rethans <d.rethans@jdimedia.nl> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_LIBMCRYPT
-
-#include "php_mcrypt.h"
-#include "fcntl.h"
-
-#define NON_FREE
-#define MCRYPT2
-#include "mcrypt.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-
-static int le_mcrypt;
-
-function_entry mcrypt_functions[] = {
- PHP_FE(mcrypt_ecb, NULL)
- PHP_FE(mcrypt_cbc, NULL)
- PHP_FE(mcrypt_cfb, NULL)
- PHP_FE(mcrypt_ofb, NULL)
- PHP_FE(mcrypt_get_key_size, NULL)
- PHP_FE(mcrypt_get_block_size, NULL)
- PHP_FE(mcrypt_get_cipher_name, NULL)
- PHP_FE(mcrypt_create_iv, NULL)
-
- PHP_FE(mcrypt_list_algorithms, NULL)
- PHP_FE(mcrypt_list_modes, NULL)
- PHP_FE(mcrypt_get_iv_size, NULL)
- PHP_FE(mcrypt_encrypt, NULL)
- PHP_FE(mcrypt_decrypt, NULL)
-
- PHP_FE(mcrypt_module_open, NULL)
- PHP_FE(mcrypt_generic_init, NULL)
- PHP_FE(mcrypt_generic, NULL)
- PHP_FE(mdecrypt_generic, NULL)
- PHP_FE(mcrypt_generic_end, NULL)
- PHP_FE(mcrypt_generic_deinit, NULL)
-
- PHP_FE(mcrypt_enc_self_test, NULL)
- PHP_FE(mcrypt_enc_is_block_algorithm_mode, NULL)
- PHP_FE(mcrypt_enc_is_block_algorithm, NULL)
- PHP_FE(mcrypt_enc_is_block_mode, NULL)
- PHP_FE(mcrypt_enc_get_block_size, NULL)
- PHP_FE(mcrypt_enc_get_key_size, NULL)
- PHP_FE(mcrypt_enc_get_supported_key_sizes, NULL)
- PHP_FE(mcrypt_enc_get_iv_size, NULL)
- PHP_FE(mcrypt_enc_get_algorithms_name, NULL)
- PHP_FE(mcrypt_enc_get_modes_name, NULL)
- PHP_FE(mcrypt_module_self_test, NULL)
-
- PHP_FE(mcrypt_module_is_block_algorithm_mode, NULL)
- PHP_FE(mcrypt_module_is_block_algorithm, NULL)
- PHP_FE(mcrypt_module_is_block_mode, NULL)
- PHP_FE(mcrypt_module_get_algo_block_size, NULL)
- PHP_FE(mcrypt_module_get_algo_key_size, NULL)
- PHP_FE(mcrypt_module_get_supported_key_sizes, NULL)
-
- PHP_FE(mcrypt_module_close, NULL)
- {NULL, NULL, NULL}
-};
-
-static PHP_MINFO_FUNCTION(mcrypt);
-static PHP_MINIT_FUNCTION(mcrypt);
-static PHP_MSHUTDOWN_FUNCTION(mcrypt);
-
-zend_module_entry mcrypt_module_entry = {
- STANDARD_MODULE_HEADER,
- "mcrypt",
- mcrypt_functions,
- PHP_MINIT(mcrypt), PHP_MSHUTDOWN(mcrypt),
- NULL, NULL,
- PHP_MINFO(mcrypt),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES,
-};
-
-ZEND_DECLARE_MODULE_GLOBALS(mcrypt)
-
-#ifdef COMPILE_DL_MCRYPT
-ZEND_GET_MODULE(mcrypt)
-#endif
-
-#define MCRYPT_ARGS2 \
- zval **cipher, **data, **key, **mode; \
- int td; \
- char *ndata; \
- size_t bsize; \
- size_t nr; \
- size_t nsize
-
-#define MCRYPT_ARGS \
- MCRYPT_ARGS2; \
- zval **iv
-
-#define MCRYPT_CONVERT \
- convert_to_string_ex(cipher); \
- convert_to_string_ex(mode); \
- convert_to_string_ex(data); \
- convert_to_string_ex(key)
-#define MCRYPT_CONVERT_WO_MODE \
- convert_to_string_ex(cipher); \
- convert_to_string_ex(data); \
- convert_to_string_ex(key)
-
-#define MCRYPT_SIZE \
- bsize = mcrypt_get_block_size(Z_LVAL_PP(cipher)); \
- nr = (Z_STRLEN_PP(data) + bsize - 1) / bsize; \
- nsize = nr * bsize
-
-#define MCRYPT_CHECK_TD_CPY \
- if (td < 0) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_FAILED); \
- RETURN_FALSE; \
- } \
- ndata = ecalloc(nr, bsize); \
- memcpy(ndata, Z_STRVAL_PP(data), Z_STRLEN_PP(data))
-
-#define MCRYPT_CHECK_IV \
- convert_to_string_ex(iv); \
- if (Z_STRLEN_PP(iv) != bsize) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_IV_WRONG_SIZE); \
- RETURN_FALSE; \
- }
-
-#define MCRYPT_ACTION(x) \
- if (Z_LVAL_PP(mode) == 0) { \
- mcrypt_##x(td, ndata, nsize); \
- } else { \
- mdecrypt_##x(td, ndata, nsize); \
- } \
- end_mcrypt_##x(td)
-
-#define MCRYPT_IV_WRONG_SIZE "The IV parameter must be as long as the blocksize"
-
-#define MCRYPT_ENCRYPT 0
-#define MCRYPT_DECRYPT 1
-
-#define MCRYPT_GET_INI \
- cipher_dir_string = MCG(algorithms_dir); \
- module_dir_string = MCG(modes_dir);
-
-#define MCRYPT_CHECK_PARAM_COUNT(a,b) \
- if (argc < (a) || argc > (b)) { \
- WRONG_PARAM_COUNT; \
- }
-/*
- * #warning is not ANSI C
- * #warning Invalidate resource if the param count is wrong, or other problems
- * #warning occurred during functions.
- */
-
-#define MCRYPT_GET_CRYPT_ARGS \
- switch (argc) { \
- case 5: \
- if (zend_get_parameters_ex(5, &cipher, &key, &data, &mode, &iv) == FAILURE) { \
- WRONG_PARAM_COUNT; \
- } \
- convert_to_string_ex(iv); \
- break; \
- case 4: \
- if (zend_get_parameters_ex(4, &cipher, &key, &data, &mode) == FAILURE) { \
- WRONG_PARAM_COUNT; \
- } \
- iv = NULL; \
- break; \
- default: \
- WRONG_PARAM_COUNT; \
- }
-
-#define MCRYPT_GET_TD_ARG \
- zval **mcryptind; \
- MCRYPT td; \
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &mcryptind) == FAILURE) { \
- WRONG_PARAM_COUNT \
- } \
- ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", le_mcrypt);
-
-#define MCRYPT_GET_MODE_DIR_ARGS(DIRECTORY) \
- char *dir = NULL; \
- int dir_len; \
- char *module; \
- int module_len; \
- if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, \
- "s|s", &module, &module_len, &dir, &dir_len) == FAILURE) { \
- return; \
- }
-
-#define MCRYPT_OPEN_MODULE_FAILED "Module initialization failed"
-
-#define MCRYPT_ENTRY2_2_4(a,b) REGISTER_STRING_CONSTANT("MCRYPT_" #a, b, CONST_PERSISTENT)
-#define MCRYPT_ENTRY2_4(a) MCRYPT_ENTRY_NAMED(a, a)
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("mcrypt.algorithms_dir", NULL, PHP_INI_ALL, OnUpdateString, algorithms_dir, zend_mcrypt_globals, mcrypt_globals)
- STD_PHP_INI_ENTRY("mcrypt.modes_dir", NULL, PHP_INI_ALL, OnUpdateString, modes_dir, zend_mcrypt_globals, mcrypt_globals)
-PHP_INI_END()
-
-static void php_mcrypt_module_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- MCRYPT td = (MCRYPT) rsrc->ptr;
- mcrypt_module_close (td);
-}
-
-
-static PHP_MINIT_FUNCTION(mcrypt)
-{
-#if defined(ZTS)
- ZEND_INIT_MODULE_GLOBALS(mcrypt, NULL, NULL);
- Z_TYPE(mcrypt_module_entry) = type;
-#endif
-
- le_mcrypt = zend_register_list_destructors_ex(php_mcrypt_module_dtor, NULL, "mcrypt", module_number);
-
- /* modes for mcrypt_??? routines */
- REGISTER_LONG_CONSTANT("MCRYPT_ENCRYPT", 0, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MCRYPT_DECRYPT", 1, CONST_PERSISTENT);
-
- /* sources for mcrypt_create_iv */
- REGISTER_LONG_CONSTANT("MCRYPT_DEV_RANDOM", 0, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MCRYPT_DEV_URANDOM", 1, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MCRYPT_RAND", 2, CONST_PERSISTENT);
-
- /* ciphers */
- MCRYPT_ENTRY2_2_4(3DES, "tripledes");
- MCRYPT_ENTRY2_2_4(ARCFOUR_IV, "arcfour-iv");
- MCRYPT_ENTRY2_2_4(ARCFOUR, "arcfour");
- MCRYPT_ENTRY2_2_4(BLOWFISH, "blowfish");
- MCRYPT_ENTRY2_2_4(BLOWFISH_COMPAT, "blowfish-compat");
- MCRYPT_ENTRY2_2_4(CAST_128, "cast-128");
- MCRYPT_ENTRY2_2_4(CAST_256, "cast-256");
- MCRYPT_ENTRY2_2_4(CRYPT, "crypt");
- MCRYPT_ENTRY2_2_4(DES, "des");
- MCRYPT_ENTRY2_2_4(ENIGNA, "crypt");
- MCRYPT_ENTRY2_2_4(GOST, "gost");
- MCRYPT_ENTRY2_2_4(LOKI97, "loki97");
- MCRYPT_ENTRY2_2_4(PANAMA, "panama");
- MCRYPT_ENTRY2_2_4(RC2, "rc2");
- MCRYPT_ENTRY2_2_4(RIJNDAEL_128, "rijndael-128");
- MCRYPT_ENTRY2_2_4(RIJNDAEL_192, "rijndael-192");
- MCRYPT_ENTRY2_2_4(RIJNDAEL_256, "rijndael-256");
- MCRYPT_ENTRY2_2_4(SAFER64, "safer-sk64");
- MCRYPT_ENTRY2_2_4(SAFER128, "safer-sk128");
- MCRYPT_ENTRY2_2_4(SAFERPLUS, "saferplus");
- MCRYPT_ENTRY2_2_4(SERPENT, "serpent");
- MCRYPT_ENTRY2_2_4(THREEWAY, "threeway");
- MCRYPT_ENTRY2_2_4(TRIPLEDES, "tripledes");
- MCRYPT_ENTRY2_2_4(TWOFISH, "twofish");
- MCRYPT_ENTRY2_2_4(WAKE, "wake");
- MCRYPT_ENTRY2_2_4(XTEA, "xtea");
-
- MCRYPT_ENTRY2_2_4(IDEA, "idea");
- MCRYPT_ENTRY2_2_4(MARS, "mars");
- MCRYPT_ENTRY2_2_4(RC6, "rc6");
- MCRYPT_ENTRY2_2_4(SKIPJACK, "skipjack");
-/* modes */
- MCRYPT_ENTRY2_2_4(MODE_CBC, "cbc");
- MCRYPT_ENTRY2_2_4(MODE_CFB, "cfb");
- MCRYPT_ENTRY2_2_4(MODE_ECB, "ecb");
- MCRYPT_ENTRY2_2_4(MODE_NOFB, "nofb");
- MCRYPT_ENTRY2_2_4(MODE_OFB, "ofb");
- MCRYPT_ENTRY2_2_4(MODE_STREAM, "stream");
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-static PHP_MSHUTDOWN_FUNCTION(mcrypt)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-#include "ext/standard/php_smart_str.h"
-
-PHP_MINFO_FUNCTION(mcrypt)
-{
- char **modules;
- char mcrypt_api_no[16];
- int i, count;
- smart_str tmp1 = {0};
- smart_str tmp2 = {0};
-
- modules = mcrypt_list_algorithms(MCG(algorithms_dir), &count);
- if (count == 0) {
- smart_str_appends(&tmp1, "none");
- }
- for (i = 0; i < count; i++) {
- smart_str_appends(&tmp1, modules[i]);
- smart_str_appendc(&tmp1, ' ');
- }
- smart_str_0(&tmp1);
- mcrypt_free_p(modules, count);
-
- modules = mcrypt_list_modes(MCG(modes_dir), &count);
- if (count == 0) {
- smart_str_appends(&tmp2, "none");
- }
- for (i = 0; i < count; i++) {
- smart_str_appends(&tmp2, modules[i]);
- smart_str_appendc(&tmp2, ' ');
- }
- smart_str_0 (&tmp2);
- mcrypt_free_p (modules, count);
-
- snprintf (mcrypt_api_no, 16, "%d", MCRYPT_API_VERSION);
-
- php_info_print_table_start();
- php_info_print_table_header(2, "mcrypt support", "enabled");
- php_info_print_table_row(2, "Version", LIBMCRYPT_VERSION);
- php_info_print_table_row(2, "Api No", mcrypt_api_no);
- php_info_print_table_row(2, "Supported ciphers", tmp1.c);
- php_info_print_table_row(2, "Supported modes", tmp2.c);
- smart_str_free(&tmp1);
- smart_str_free(&tmp2);
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-typedef enum {
- RANDOM = 0,
- URANDOM,
- RAND
-} iv_source;
-
-/* {{{ proto resource mcrypt_module_open(string cipher, string cipher_directory, string mode, string mode_directory)
- Opens the module of the algorithm and the mode to be used */
-PHP_FUNCTION(mcrypt_module_open)
-{
- char *cipher, *cipher_dir;
- char *mode, *mode_dir;
- int cipher_len, cipher_dir_len;
- int mode_len, mode_dir_len;
- MCRYPT td;
-
- if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "ssss",
- &cipher, &cipher_len, &cipher_dir, &cipher_dir_len,
- &mode, &mode_len, &mode_dir, &mode_dir_len)) {
- return;
- }
-
- td = mcrypt_module_open (
- cipher,
- cipher_dir_len > 0 ? cipher_dir : MCG(algorithms_dir),
- mode,
- mode_dir_len > 0 ? mode_dir : MCG(modes_dir)
- );
-
- if (td == MCRYPT_FAILED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not open encryption module");
- RETURN_FALSE;
- } else {
- ZEND_REGISTER_RESOURCE(return_value, td, le_mcrypt);
- }
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_generic_init(resource td, string key, string iv)
- This function initializes all buffers for the specific module */
-PHP_FUNCTION(mcrypt_generic_init)
-{
- zval **key, **iv;
- zval **mcryptind;
- unsigned char *key_s, *iv_s;
- int max_key_size, key_size, iv_size;
- MCRYPT td;
- int argc;
- int result = 0;
-
- argc = ZEND_NUM_ARGS();
- MCRYPT_CHECK_PARAM_COUNT (3,3)
-
- zend_get_parameters_ex(3, &mcryptind, &key, &iv);
- ZEND_FETCH_RESOURCE(td, MCRYPT, mcryptind, -1, "MCrypt", le_mcrypt);
- convert_to_string_ex(key);
- convert_to_string_ex(iv);
-
- max_key_size = mcrypt_enc_get_key_size(td);
- iv_size = mcrypt_enc_get_iv_size(td);
-
- if (Z_STRLEN_PP(key) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Key size is 0");
- }
-
- key_s = emalloc(Z_STRLEN_PP(key));
- memset(key_s, 0, Z_STRLEN_PP(key));
-
- iv_s = emalloc(iv_size + 1);
- memset(iv_s, 0, iv_size + 1);
-
- if (Z_STRLEN_PP(key) > max_key_size) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Key size too large; supplied length: %d, max: %d", Z_STRLEN_PP(key), max_key_size);
- key_size = max_key_size;
- } else {
- key_size = Z_STRLEN_PP(key);
- }
- memcpy(key_s, Z_STRVAL_PP(key), Z_STRLEN_PP(key));
-
- if (Z_STRLEN_PP(iv) != iv_size) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Iv size incorrect; supplied length: %d, needed: %d", Z_STRLEN_PP(iv), iv_size);
- }
- memcpy(iv_s, Z_STRVAL_PP(iv), iv_size);
-
- result = mcrypt_generic_init(td, key_s, key_size, iv_s);
-
- /* If this function fails, close the mcrypt module to prevent crashes
- * when further functions want to access this resource */
- if (result < 0) {
- zend_list_delete(Z_LVAL_PP(mcryptind));
- switch (result) {
- case -3:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Key length incorrect");
- break;
- case -4:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Memory allocation error");
- break;
- case -1:
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error");
- break;
- }
- }
- RETVAL_LONG(result);
-
- efree(iv_s);
- efree(key_s);
-}
-/* }}} */
-
-
-/* {{{ proto string mcrypt_generic(resource td, string data)
- This function encrypts the plaintext */
-PHP_FUNCTION(mcrypt_generic)
-{
- zval **data, **mcryptind;
- MCRYPT td;
- int argc;
- unsigned char* data_s;
- int block_size, data_size;
-
- argc = ZEND_NUM_ARGS();
- MCRYPT_CHECK_PARAM_COUNT (2,2)
-
- zend_get_parameters_ex(2, &mcryptind, &data);
- ZEND_FETCH_RESOURCE(td, MCRYPT, mcryptind, -1, "MCrypt", le_mcrypt);
- convert_to_string_ex(data);
-
- /* Check blocksize */
- if (mcrypt_enc_is_block_mode(td) == 1) { /* It's a block algorithm */
- block_size = mcrypt_enc_get_block_size(td);
- data_size = (((Z_STRLEN_PP(data) - 1) / block_size) + 1) * block_size;
- data_s = emalloc(data_size + 1);
- memset(data_s, 0, data_size);
- memcpy(data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- } else { /* It's not a block algorithm */
- data_size = Z_STRLEN_PP(data);
- data_s = emalloc(data_size + 1);
- memset(data_s, 0, data_size);
- memcpy(data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- }
-
- mcrypt_generic(td, data_s, data_size);
- data_s[data_size] = '\0';
-
- RETVAL_STRINGL(data_s, data_size, 1);
- efree(data_s);
-}
-/* }}} */
-
-
-/* {{{ proto string mdecrypt_generic(resource td, string data)
- This function decrypts the plaintext */
-PHP_FUNCTION(mdecrypt_generic)
-{
- zval **data, **mcryptind;
- MCRYPT td;
- int argc;
- char* data_s;
- int block_size, data_size;
-
- argc = ZEND_NUM_ARGS();
- MCRYPT_CHECK_PARAM_COUNT (2,2)
-
- zend_get_parameters_ex(2, &mcryptind, &data);
- ZEND_FETCH_RESOURCE(td, MCRYPT, mcryptind, -1, "MCrypt", le_mcrypt);
- convert_to_string_ex(data);
-
- /* Check blocksize */
- if (mcrypt_enc_is_block_mode(td) == 1) { /* It's a block algorithm */
- block_size = mcrypt_enc_get_block_size(td);
- data_size = (((Z_STRLEN_PP(data) - 1) / block_size) + 1) * block_size;
- data_s = emalloc(data_size + 1);
- memset(data_s, 0, data_size);
- memcpy(data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- } else { /* It's not a block algorithm */
- data_size = Z_STRLEN_PP(data);
- data_s = emalloc(data_size + 1);
- memset(data_s, 0, data_size);
- memcpy(data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- }
-
- mdecrypt_generic(td, data_s, data_size);
-
- RETVAL_STRINGL(data_s, data_size, 1);
- efree(data_s);
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_enc_get_supported_key_sizes(resource td)
- This function decrypts the crypttext */
-PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes)
-{
- int i, count = 0;
- int *key_sizes;
-
- MCRYPT_GET_TD_ARG
- array_init(return_value);
-
- key_sizes = mcrypt_enc_get_supported_key_sizes(td, &count);
-
- for (i = 0; i < count; i++) {
- add_index_long(return_value, i, key_sizes[i]);
- }
-
- mcrypt_free(key_sizes);
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_enc_self_test(resource td)
- This function runs the self test on the algorithm specified by the descriptor td */
-PHP_FUNCTION(mcrypt_enc_self_test)
-{
- MCRYPT_GET_TD_ARG
- RETURN_LONG(mcrypt_enc_self_test(td));
-}
-/* }}} */
-
-/* {{{ proto bool mcrypt_module_close(resource td)
- Free the descriptor td */
-PHP_FUNCTION(mcrypt_module_close)
-{
- MCRYPT_GET_TD_ARG
- zend_list_delete(Z_LVAL_PP(mcryptind));
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_generic_end(resource td)
- This function terminates encrypt specified by the descriptor td */
-PHP_FUNCTION(mcrypt_generic_end)
-{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This function is deprecated, please use mcrypt_generic_deinit()");
- zif_mcrypt_generic_deinit(INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_generic_deinit(resource td)
- This function terminates encrypt specified by the descriptor td */
-PHP_FUNCTION(mcrypt_generic_deinit)
-{
- MCRYPT_GET_TD_ARG
-
- if (mcrypt_generic_deinit(td) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not terminate encryption specifier");
- RETURN_FALSE
- }
- RETURN_TRUE
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_enc_is_block_algorithm_mode(resource td)
- Returns TRUE if the mode is for use with block algorithms */
-PHP_FUNCTION(mcrypt_enc_is_block_algorithm_mode)
-{
- MCRYPT_GET_TD_ARG
-
- if (mcrypt_enc_is_block_algorithm_mode(td) == 1) {
- RETURN_TRUE
- } else {
- RETURN_FALSE
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_enc_is_block_algorithm(resource td)
- Returns TRUE if the alrogithm is a block algorithms */
-PHP_FUNCTION(mcrypt_enc_is_block_algorithm)
-{
- MCRYPT_GET_TD_ARG
-
- if (mcrypt_enc_is_block_algorithm(td) == 1) {
- RETURN_TRUE
- } else {
- RETURN_FALSE
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_enc_is_block_mode(resource td)
- Returns TRUE if the mode outputs blocks */
-PHP_FUNCTION(mcrypt_enc_is_block_mode)
-{
- MCRYPT_GET_TD_ARG
-
- if (mcrypt_enc_is_block_mode(td) == 1) {
- RETURN_TRUE
- } else {
- RETURN_FALSE
- }
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_enc_get_block_size(resource td)
- Returns the block size of the cipher specified by the descriptor td */
-PHP_FUNCTION(mcrypt_enc_get_block_size)
-{
- MCRYPT_GET_TD_ARG
- RETURN_LONG(mcrypt_enc_get_block_size(td));
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_enc_get_key_size(resource td)
- Returns the maximum supported key size in bytes of the algorithm specified by the descriptor td */
-PHP_FUNCTION(mcrypt_enc_get_key_size)
-{
- MCRYPT_GET_TD_ARG
- RETURN_LONG(mcrypt_enc_get_key_size(td));
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_enc_get_iv_size(resource td)
- Returns the size of the IV in bytes of the algorithm specified by the descriptor td */
-PHP_FUNCTION(mcrypt_enc_get_iv_size)
-{
- MCRYPT_GET_TD_ARG
- RETURN_LONG(mcrypt_enc_get_iv_size(td));
-}
-/* }}} */
-
-
-/* {{{ proto string mcrypt_enc_get_algorithms_name(resource td)
- Returns the name of the algorithm specified by the descriptor td */
-PHP_FUNCTION(mcrypt_enc_get_algorithms_name)
-{
- char *name;
- MCRYPT_GET_TD_ARG
-
- name = mcrypt_enc_get_algorithms_name(td);
- RETVAL_STRING(name, 1);
- mcrypt_free(name);
-}
-/* }}} */
-
-
-/* {{{ proto string mcrypt_enc_get_modes_name(resource td)
- Returns the name of the mode specified by the descriptor td */
-PHP_FUNCTION(mcrypt_enc_get_modes_name)
-{
- char *name;
- MCRYPT_GET_TD_ARG
-
- name = mcrypt_enc_get_modes_name(td);
- RETVAL_STRING(name, 1);
- mcrypt_free(name);
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_module_self_test(string algorithm [, string lib_dir])
- Does a self test of the module "module" */
-PHP_FUNCTION(mcrypt_module_self_test)
-{
- MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir);
-
- if (mcrypt_module_self_test(module, dir) == 0) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_module_is_block_algorithm_mode(string mode [, string lib_dir])
- Returns TRUE if the mode is for use with block algorithms */
-PHP_FUNCTION(mcrypt_module_is_block_algorithm_mode)
-{
- MCRYPT_GET_MODE_DIR_ARGS(modes_dir)
-
- if (mcrypt_module_is_block_algorithm_mode(module, dir) == 1) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_module_is_block_algorithm(string algorithm [, string lib_dir])
- Returns TRUE if the algorithm is a block algorithm */
-PHP_FUNCTION(mcrypt_module_is_block_algorithm)
-{
- MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)
-
- if (mcrypt_module_is_block_algorithm(module, dir) == 1) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_module_is_block_mode(string mode [, string lib_dir])
- Returns TRUE if the mode outputs blocks of bytes */
-PHP_FUNCTION(mcrypt_module_is_block_mode)
-{
- MCRYPT_GET_MODE_DIR_ARGS(modes_dir)
-
- if (mcrypt_module_is_block_mode(module, dir) == 1) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_module_get_algo_block_size(string algorithm [, string lib_dir])
- Returns the block size of the algorithm */
-PHP_FUNCTION(mcrypt_module_get_algo_block_size)
-{
- MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)
-
- RETURN_LONG(mcrypt_module_get_algo_block_size(module, dir));
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_module_get_algo_key_size(string algorithm [, string lib_dir])
- Returns the maximum supported key size of the algorithm */
-PHP_FUNCTION(mcrypt_module_get_algo_key_size)
-{
- MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir);
-
- RETURN_LONG(mcrypt_module_get_algo_key_size(module, dir));
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_module_get_supported_key_sizes(string algorithm [, string lib_dir])
- This function decrypts the crypttext */
-PHP_FUNCTION(mcrypt_module_get_supported_key_sizes)
-{
- int i, count = 0;
- int *key_sizes;
-
- MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)
- array_init(return_value);
-
- key_sizes = mcrypt_module_get_algo_supported_key_sizes(module, dir, &count);
-
- for (i = 0; i < count; i++) {
- add_index_long(return_value, i, key_sizes[i]);
- }
- mcrypt_free(key_sizes);
-}
-/* }}} */
-
-
-/* {{{ proto array mcrypt_list_algorithms([string lib_dir])
- List all algorithms in "module_dir" */
-PHP_FUNCTION(mcrypt_list_algorithms)
-{
- char **modules;
- char *lib_dir = MCG(algorithms_dir);
- int lib_dir_len;
- int i, count;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s",
- &lib_dir, &lib_dir_len) == FAILURE) {
- return;
- }
-
- array_init(return_value);
- modules = mcrypt_list_algorithms(lib_dir, &count);
-
- if (count == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No algorithms found in module dir");
- }
- for (i = 0; i < count; i++) {
- add_index_string(return_value, i, modules[i], 1);
- }
- mcrypt_free_p(modules, count);
-}
-/* }}} */
-
-
-/* {{{ proto array mcrypt_list_modes([string lib_dir])
- List all modes "module_dir" */
-PHP_FUNCTION(mcrypt_list_modes)
-{
- char **modules;
- char *lib_dir = MCG(modes_dir);
- int lib_dir_len;
- int i, count;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s",
- &lib_dir, &lib_dir_len) == FAILURE) {
- return;
- }
-
- array_init(return_value);
- modules = mcrypt_list_modes(lib_dir, &count);
-
- if (count == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No modes found in module dir");
- }
- for (i = 0; i < count; i++) {
- add_index_string(return_value, i, modules[i], 1);
- }
- mcrypt_free_p(modules, count);
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_get_key_size(string cipher, string module)
- Get the key size of cipher */
-PHP_FUNCTION(mcrypt_get_key_size)
-{
- char *cipher;
- char *module;
- int cipher_len, module_len;
- char *cipher_dir_string;
- char *module_dir_string;
- MCRYPT td;
-
- MCRYPT_GET_INI
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss",
- &cipher, &cipher_len, &module, &module_len) == FAILURE) {
- return;
- }
-
- td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string);
- if (td != MCRYPT_FAILED) {
- RETVAL_LONG(mcrypt_enc_get_key_size(td));
- mcrypt_module_close(td);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_get_block_size(string cipher, string module)
- Get the key size of cipher */
-PHP_FUNCTION(mcrypt_get_block_size)
-{
- char *cipher;
- char *module;
- int cipher_len, module_len;
- char *cipher_dir_string;
- char *module_dir_string;
- MCRYPT td;
-
- MCRYPT_GET_INI
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss",
- &cipher, &cipher_len, &module, &module_len) == FAILURE) {
- return;
- }
-
- td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string);
- if (td != MCRYPT_FAILED) {
- RETVAL_LONG(mcrypt_enc_get_block_size(td));
- mcrypt_module_close(td);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_get_iv_size(string cipher, string module)
- Get the IV size of cipher (Usually the same as the blocksize) */
-PHP_FUNCTION(mcrypt_get_iv_size)
-{
- char *cipher;
- char *module;
- int cipher_len, module_len;
- char *cipher_dir_string;
- char *module_dir_string;
- MCRYPT td;
-
- MCRYPT_GET_INI
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss",
- &cipher, &cipher_len, &module, &module_len) == FAILURE) {
- return;
- }
-
- td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string);
- if (td != MCRYPT_FAILED) {
- RETVAL_LONG(mcrypt_enc_get_iv_size(td));
- mcrypt_module_close(td);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto string mcrypt_get_cipher_name(string cipher)
- Get the key size of cipher */
-PHP_FUNCTION(mcrypt_get_cipher_name)
-{
- char *cipher_dir_string;
- char *module_dir_string;
- char *cipher_name;
- char *cipher;
- int cipher_len;
- MCRYPT td;
-
- MCRYPT_GET_INI
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
- &cipher, &cipher_len) == FAILURE) {
- return;
- }
-
- /* The code below is actually not very nice, but I didn't see a better
- * method */
- td = mcrypt_module_open(cipher, cipher_dir_string, "ecb", module_dir_string);
- if (td != MCRYPT_FAILED) {
- cipher_name = mcrypt_enc_get_algorithms_name(td);
- mcrypt_module_close(td);
- RETVAL_STRING(cipher_name,1);
- mcrypt_free(cipher_name);
- } else {
- td = mcrypt_module_open(cipher, cipher_dir_string, "stream", module_dir_string);
- if (td != MCRYPT_FAILED) {
- cipher_name = mcrypt_enc_get_algorithms_name(td);
- mcrypt_module_close(td);
- RETVAL_STRING(cipher_name,1);
- mcrypt_free(cipher_name);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
- RETURN_FALSE;
- }
- }
-}
-/* }}} */
-
-
-static void php_mcrypt_do_crypt (char* cipher, zval **key, zval **data, char *mode, zval **iv, int argc, int dencrypt, zval* return_value TSRMLS_DC)
-{
- char *cipher_dir_string;
- char *module_dir_string;
- int block_size, max_key_length, use_key_length, i, count, iv_size;
- unsigned long int data_size;
- int *key_length_sizes;
- char *key_s = NULL, *iv_s;
- char *data_s;
- MCRYPT td;
-
- MCRYPT_GET_INI
-
- td = mcrypt_module_open(cipher, cipher_dir_string, mode, module_dir_string);
- if (td == MCRYPT_FAILED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
- RETURN_FALSE;
- }
- /* Checking for key-length */
- max_key_length = mcrypt_enc_get_key_size(td);
- if (Z_STRLEN_PP(key) > max_key_length) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Size of key is too large for this algorithm");
- }
- key_length_sizes = mcrypt_enc_get_supported_key_sizes(td, &count);
- if (count == 0 && key_length_sizes == NULL) { /* all lengths 1 - k_l_s = OK */
- use_key_length = Z_STRLEN_PP(key);
- key_s = emalloc(use_key_length);
- memset(key_s, 0, use_key_length);
- memcpy(key_s, Z_STRVAL_PP(key), use_key_length);
- } else if (count == 1) { /* only m_k_l = OK */
- key_s = emalloc(key_length_sizes[0]);
- memset(key_s, 0, key_length_sizes[0]);
- memcpy(key_s, Z_STRVAL_PP(key), MIN(Z_STRLEN_PP(key), key_length_sizes[0]));
- use_key_length = key_length_sizes[0];
- } else { /* dertermine smallest supported key > length of requested key */
- use_key_length = max_key_length; /* start with max key length */
- for (i = 0; i < count; i++) {
- if (key_length_sizes[i] >= Z_STRLEN_PP(key) &&
- key_length_sizes[i] < use_key_length)
- {
- use_key_length = key_length_sizes[i];
- }
- }
- key_s = emalloc(use_key_length);
- memset(key_s, 0, use_key_length);
- memcpy(key_s, Z_STRVAL_PP(key), MIN(Z_STRLEN_PP(key), use_key_length));
- }
- mcrypt_free (key_length_sizes);
-
- /* Check IV */
- iv_s = NULL;
- iv_size = mcrypt_enc_get_iv_size (td);
- if (argc == 5) {
- if (iv_size != Z_STRLEN_PP(iv)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_IV_WRONG_SIZE);
- } else {
- iv_s = emalloc(iv_size + 1);
- memcpy(iv_s, Z_STRVAL_PP(iv), iv_size);
- }
- } else if (argc == 4) {
- if (iv_size != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempt to use an empty IV, which is NOT recommend");
- iv_s = emalloc(iv_size + 1);
- memset(iv_s, 0, iv_size + 1);
- }
- }
-
- /* Check blocksize */
- if (mcrypt_enc_is_block_mode(td) == 1) { /* It's a block algorithm */
- block_size = mcrypt_enc_get_block_size(td);
- data_size = (((Z_STRLEN_PP(data) - 1) / block_size) + 1) * block_size;
- data_s = emalloc(data_size);
- memset(data_s, 0, data_size);
- memcpy(data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- } else { /* It's not a block algorithm */
- data_size = Z_STRLEN_PP(data);
- data_s = emalloc(data_size);
- memset(data_s, 0, data_size);
- memcpy(data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- }
-
- if (mcrypt_generic_init(td, key_s, use_key_length, iv_s) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Mcrypt initialisation failed");
- }
- if (dencrypt == MCRYPT_ENCRYPT) {
- mcrypt_generic(td, data_s, data_size);
- } else {
- mdecrypt_generic(td, data_s, data_size);
- }
-
- RETVAL_STRINGL(data_s, data_size, 1);
-
- /* freeing vars */
- mcrypt_generic_end(td);
- if (key_s != NULL) {
- efree (key_s);
- }
- if (iv_s != NULL) {
- efree (iv_s);
- }
- efree (data_s);
-}
-
-/* {{{ proto string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)
- OFB crypt/decrypt data using key key with cipher cipher starting with iv */
-PHP_FUNCTION(mcrypt_encrypt)
-{
- zval **cipher, **key, **data, **mode, **iv;
- int argc;
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_CHECK_PARAM_COUNT(4, 5)
- MCRYPT_GET_CRYPT_ARGS
-
- MCRYPT_CONVERT;
-
- php_mcrypt_do_crypt(Z_STRVAL_PP(cipher), key, data, Z_STRVAL_PP(mode), iv, argc, MCRYPT_ENCRYPT, return_value TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv)
- OFB crypt/decrypt data using key key with cipher cipher starting with iv */
-PHP_FUNCTION(mcrypt_decrypt)
-{
- zval **cipher, **key, **data, **mode, **iv;
- int argc;
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_CHECK_PARAM_COUNT(4, 5)
- MCRYPT_GET_CRYPT_ARGS
-
- MCRYPT_CONVERT;
-
- php_mcrypt_do_crypt(Z_STRVAL_PP(cipher), key, data, Z_STRVAL_PP(mode), iv, argc, MCRYPT_DECRYPT, return_value TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto string mcrypt_ecb(int cipher, string key, string data, int mode, string iv)
- ECB crypt/decrypt data using key key with cipher cipher starting with iv */
-PHP_FUNCTION(mcrypt_ecb)
-{
- zval **cipher, **key, **data, **mode, **iv;
- int argc;
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_CHECK_PARAM_COUNT(4, 5)
- MCRYPT_GET_CRYPT_ARGS
-
- MCRYPT_CONVERT_WO_MODE;
- convert_to_long_ex(mode);
-
- php_mcrypt_do_crypt(Z_STRVAL_PP(cipher), key, data, "ecb", iv, argc, Z_LVAL_PP(mode), return_value TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto string mcrypt_cbc(int cipher, string key, string data, int mode, string iv)
- CBC crypt/decrypt data using key key with cipher cipher starting with iv */
-PHP_FUNCTION(mcrypt_cbc)
-{
- zval **cipher, **key, **data, **mode, **iv;
- int argc;
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_CHECK_PARAM_COUNT(4, 5)
- MCRYPT_GET_CRYPT_ARGS
-
- MCRYPT_CONVERT_WO_MODE;
- convert_to_long_ex(mode);
-
- php_mcrypt_do_crypt(Z_STRVAL_PP(cipher), key, data, "cbc", iv, argc, Z_LVAL_PP(mode), return_value TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto string mcrypt_cfb(int cipher, string key, string data, int mode, string iv)
- CFB crypt/decrypt data using key key with cipher cipher starting with iv */
-PHP_FUNCTION(mcrypt_cfb)
-{
- zval **cipher, **key, **data, **mode, **iv;
- int argc;
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_CHECK_PARAM_COUNT(4, 5)
- MCRYPT_GET_CRYPT_ARGS
-
- MCRYPT_CONVERT_WO_MODE;
- convert_to_long_ex(mode);
-
- php_mcrypt_do_crypt(Z_STRVAL_PP(cipher), key, data, "cfb", iv, argc, Z_LVAL_PP(mode), return_value TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto string mcrypt_ofb(int cipher, string key, string data, int mode, string iv)
- OFB crypt/decrypt data using key key with cipher cipher starting with iv */
-PHP_FUNCTION(mcrypt_ofb)
-{
- zval **cipher, **key, **data, **mode, **iv;
- int argc;
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_CHECK_PARAM_COUNT(4, 5)
- MCRYPT_GET_CRYPT_ARGS
-
- MCRYPT_CONVERT_WO_MODE;
- convert_to_long_ex(mode);
-
- php_mcrypt_do_crypt(Z_STRVAL_PP(cipher), key, data, "ofb", iv, argc, Z_LVAL_PP(mode), return_value TSRMLS_CC);
-}
-/* }}} */
-
-
-/* {{{ proto string mcrypt_create_iv(int size, int source)
- Create an initialization vector (IV) */
-PHP_FUNCTION(mcrypt_create_iv)
-{
- char *iv;
- long source = RANDOM;
- long size;
- int n = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &size, &source) == FAILURE) {
- return;
- }
-
- if (size <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not create an IV with size 0 or smaller");
- RETURN_FALSE;
- }
-
- iv = ecalloc(size + 1, 1);
-
- if (source == RANDOM || source == URANDOM) {
- int fd;
- size_t read_bytes = 0;
-
- fd = open(source == RANDOM ? "/dev/random" : "/dev/urandom", O_RDONLY);
- if (fd < 0) {
- efree(iv);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot open source device");
- RETURN_FALSE;
- }
- while (read_bytes < size) {
- n = read(fd, iv + read_bytes, size - read_bytes);
- if (n < 0) {
- break;
- }
- read_bytes += n;
- }
- n = read_bytes;
- close(fd);
- if (n < size) {
- efree(iv);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not gather sufficient random data");
- RETURN_FALSE;
- }
- } else {
- n = size;
- while (size) {
- iv[--size] = 255.0 * rand() / RAND_MAX;
- }
- }
- RETURN_STRINGL(iv, n, 0);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/mcrypt/mcrypt.dsp b/ext/mcrypt/mcrypt.dsp
deleted file mode 100644
index 2df6ed5557..0000000000
--- a/ext/mcrypt/mcrypt.dsp
+++ /dev/null
@@ -1,117 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mcrypt" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mcrypt - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mcrypt.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mcrypt.mak" CFG="mcrypt - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mcrypt - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mcrypt - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mcrypt - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MCRYPT" /D "DBNTWIN32" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\mcrypt\include" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MCRYPT_EXPORTS" /D "COMPILE_DL_MCRYPT" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LIBMCRYPT=1 /D HAVE_LIBMCRYPT24=1 /D HAVE_MCRYPT_GENERIC_DEINIT /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"MSSQL_65_Release/php_mssql.dll" /libpath:"..\..\Release_TS"
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmcrypt.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mcrypt.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\mcrypt" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\TSRM\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "mcrypt - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "mssql-70" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MCRYPT" /D "DBNTWIN32" /D ZTS=1 /D MSSQL70=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\mcrypt\include" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MCRYPT_EXPORTS" /D "COMPILE_DL_MCRYPT" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LIBMCRYPT=1 /D HAVE_LIBMCRYPT24=1 /D HAVE_MCRYPT_GENERIC_DEINIT /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"MSSQL_65_Release/php_mssql.dll" /libpath:"..\..\Release_TS" /libpath:"mssql-70"
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmcrypt.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_mcrypt.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\mcrypt\lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "mcrypt - Win32 Release_TS"
-# Name "mcrypt - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mcrypt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\win32\readdir.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mcrypt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\win32\readdir.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/mcrypt/php_mcrypt.h b/ext/mcrypt/php_mcrypt.h
deleted file mode 100644
index 5846a77411..0000000000
--- a/ext/mcrypt/php_mcrypt.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- | Derick Rethans <d.rethans@jdimedia.nl> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef PHP_MCRYPT_H
-#define PHP_MCRYPT_H
-
-#if HAVE_LIBMCRYPT
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-extern zend_module_entry mcrypt_module_entry;
-#define mcrypt_module_ptr &mcrypt_module_entry
-
-/* Functions for both old and new API */
-PHP_FUNCTION(mcrypt_ecb);
-PHP_FUNCTION(mcrypt_cbc);
-PHP_FUNCTION(mcrypt_cfb);
-PHP_FUNCTION(mcrypt_ofb);
-PHP_FUNCTION(mcrypt_get_cipher_name);
-PHP_FUNCTION(mcrypt_get_block_size);
-PHP_FUNCTION(mcrypt_get_key_size);
-PHP_FUNCTION(mcrypt_create_iv);
-
-/* Support functions for old API */
-PHP_FUNCTION(mcrypt_list_algorithms);
-PHP_FUNCTION(mcrypt_list_modes);
-PHP_FUNCTION(mcrypt_get_iv_size);
-PHP_FUNCTION(mcrypt_encrypt);
-PHP_FUNCTION(mcrypt_decrypt);
-
-/* Functions for new API */
-PHP_FUNCTION(mcrypt_module_open);
-PHP_FUNCTION(mcrypt_generic_init);
-PHP_FUNCTION(mcrypt_generic);
-PHP_FUNCTION(mdecrypt_generic);
-PHP_FUNCTION(mcrypt_generic_end);
-PHP_FUNCTION(mcrypt_generic_deinit);
-
-PHP_FUNCTION(mcrypt_enc_self_test);
-PHP_FUNCTION(mcrypt_enc_is_block_algorithm_mode);
-PHP_FUNCTION(mcrypt_enc_is_block_algorithm);
-PHP_FUNCTION(mcrypt_enc_is_block_mode);
-PHP_FUNCTION(mcrypt_enc_get_block_size);
-PHP_FUNCTION(mcrypt_enc_get_key_size);
-PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes);
-PHP_FUNCTION(mcrypt_enc_get_iv_size);
-PHP_FUNCTION(mcrypt_enc_get_algorithms_name);
-PHP_FUNCTION(mcrypt_enc_get_modes_name);
-PHP_FUNCTION(mcrypt_module_self_test);
-PHP_FUNCTION(mcrypt_module_is_block_algorithm_mode);
-PHP_FUNCTION(mcrypt_module_is_block_algorithm);
-PHP_FUNCTION(mcrypt_module_is_block_mode);
-PHP_FUNCTION(mcrypt_module_get_algo_block_size);
-PHP_FUNCTION(mcrypt_module_get_algo_key_size);
-PHP_FUNCTION(mcrypt_module_get_supported_key_sizes);
-PHP_FUNCTION(mcrypt_module_close);
-
-ZEND_BEGIN_MODULE_GLOBALS(mcrypt)
- int le_h;
- char *modes_dir;
- char *algorithms_dir;
-ZEND_END_MODULE_GLOBALS(mcrypt)
-
-#ifdef ZTS
-# define MCG(v) TSRMG(mcrypt_globals_id, zend_mcrypt_globals *, v)
-#else
-# define MCG(v) (mcrypt_globals.v)
-#endif
-
-#else
-#define mcrypt_module_ptr NULL
-#endif
-
-#define phpext_mcrypt_ptr mcrypt_module_ptr
-
-#endif
diff --git a/ext/mcrypt/tests/blowfish.phpt b/ext/mcrypt/tests/blowfish.phpt
deleted file mode 100644
index c2273c165d..0000000000
--- a/ext/mcrypt/tests/blowfish.phpt
+++ /dev/null
@@ -1,77 +0,0 @@
---TEST--
-Test for blowfish compatibility
---SKIPIF--
-<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-function hex2bin($data) {
- $len = strlen($data);
- return pack("H" . $len, $data);
-}
-
-print "key plain crypt guess stat\n";
-$null = "\0\0\0\0\0\0\0\0";
-$vectors = file("ext/mcrypt/tests/vectors.txt");
-
-$td = mcrypt_module_open ("blowfish", "", MCRYPT_MODE_ECB, "");
-
-foreach($vectors as $data) {
- $data = trim($data);
- if ($data) {
- list($key,$plain,$crypt) = split("[[:space:]]+",$data);
- printf("%s %s ",
- $key,
- $plain
- );
- $key = hex2bin(trim($key));
- $plain = hex2bin(($plain));
- $crypt = strtolower(trim($crypt));
-
- mcrypt_generic_init ($td, $key, $null);
- $guess = mcrypt_generic ($td, $plain);
- $guess = bin2hex($guess);
- printf("%s %s %s\n",
- $crypt,
- $guess,
- ($crypt==$guess ? "OK" : "BAD")
- );
- }
-}
-?>
---EXPECT--
-key plain crypt guess stat
-0000000000000000 0000000000000000 4ef997456198dd78 4ef997456198dd78 OK
-FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF 51866fd5b85ecb8a 51866fd5b85ecb8a OK
-3000000000000000 1000000000000001 7d856f9a613063f2 7d856f9a613063f2 OK
-1111111111111111 1111111111111111 2466dd878b963c9d 2466dd878b963c9d OK
-0123456789ABCDEF 1111111111111111 61f9c3802281b096 61f9c3802281b096 OK
-1111111111111111 0123456789ABCDEF 7d0cc630afda1ec7 7d0cc630afda1ec7 OK
-FEDCBA9876543210 0123456789ABCDEF 0aceab0fc6a0a28d 0aceab0fc6a0a28d OK
-7CA110454A1A6E57 01A1D6D039776742 59c68245eb05282b 59c68245eb05282b OK
-0131D9619DC1376E 5CD54CA83DEF57DA b1b8cc0b250f09a0 b1b8cc0b250f09a0 OK
-07A1133E4A0B2686 0248D43806F67172 1730e5778bea1da4 1730e5778bea1da4 OK
-3849674C2602319E 51454B582DDF440A a25e7856cf2651eb a25e7856cf2651eb OK
-04B915BA43FEB5B6 42FD443059577FA2 353882b109ce8f1a 353882b109ce8f1a OK
-0113B970FD34F2CE 059B5E0851CF143A 48f4d0884c379918 48f4d0884c379918 OK
-0170F175468FB5E6 0756D8E0774761D2 432193b78951fc98 432193b78951fc98 OK
-43297FAD38E373FE 762514B829BF486A 13f04154d69d1ae5 13f04154d69d1ae5 OK
-07A7137045DA2A16 3BDD119049372802 2eedda93ffd39c79 2eedda93ffd39c79 OK
-04689104C2FD3B2F 26955F6835AF609A d887e0393c2da6e3 d887e0393c2da6e3 OK
-37D06BB516CB7546 164D5E404F275232 5f99d04f5b163969 5f99d04f5b163969 OK
-1F08260D1AC2465E 6B056E18759F5CCA 4a057a3b24d3977b 4a057a3b24d3977b OK
-584023641ABA6176 004BD6EF09176062 452031c1e4fada8e 452031c1e4fada8e OK
-025816164629B007 480D39006EE762F2 7555ae39f59b87bd 7555ae39f59b87bd OK
-49793EBC79B3258F 437540C8698F3CFA 53c55f9cb49fc019 53c55f9cb49fc019 OK
-4FB05E1515AB73A7 072D43A077075292 7a8e7bfa937e89a3 7a8e7bfa937e89a3 OK
-49E95D6D4CA229BF 02FE55778117F12A cf9c5d7a4986adb5 cf9c5d7a4986adb5 OK
-018310DC409B26D6 1D9D5C5018F728C2 d1abb290658bc778 d1abb290658bc778 OK
-1C587F1C13924FEF 305532286D6F295A 55cb3774d13ef201 55cb3774d13ef201 OK
-0101010101010101 0123456789ABCDEF fa34ec4847b268b2 fa34ec4847b268b2 OK
-1F1F1F1F0E0E0E0E 0123456789ABCDEF a790795108ea3cae a790795108ea3cae OK
-E0FEE0FEF1FEF1FE 0123456789ABCDEF c39e072d9fac631d c39e072d9fac631d OK
-0000000000000000 FFFFFFFFFFFFFFFF 014933e0cdaff6e4 014933e0cdaff6e4 OK
-FFFFFFFFFFFFFFFF 0000000000000000 f21e9a77b71c49bc f21e9a77b71c49bc OK
-0123456789ABCDEF 0000000000000000 245946885754369a 245946885754369a OK
-FEDCBA9876543210 FFFFFFFFFFFFFFFF 6b5c5a9c5d9e0a5a 6b5c5a9c5d9e0a5a OK
diff --git a/ext/mcrypt/tests/bug8040.phpt b/ext/mcrypt/tests/bug8040.phpt
deleted file mode 100644
index e2d8c15b41..0000000000
--- a/ext/mcrypt/tests/bug8040.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-Bug #8040
---SKIPIF--
-<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
- error_reporting (E_ALL ^ E_NOTICE);
- echo MCRYPT_TWOFISH."\n";
- echo MCRYPT_MODE_CBC."\n";
-
- define ("MODE1", MCRYPT_MODE_CBC);
- echo MODE1."\n";
-
- define ("CIPHER", MCRYPT_TWOFISH);
- define ("MODE2", MCRYPT_MODE_CBC);
- define ("MODE3", MCRYPT_CBC);
-
- printf ("cipher=".CIPHER. " mode1=".MODE2. " mode2=". MODE3."\n");
-?>
---EXPECT--
-twofish
-cbc
-cbc
-cipher=twofish mode1=cbc mode2=MCRYPT_CBC
diff --git a/ext/mcrypt/tests/vectors.txt b/ext/mcrypt/tests/vectors.txt
deleted file mode 100644
index 3624ed6d69..0000000000
--- a/ext/mcrypt/tests/vectors.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-0000000000000000 0000000000000000 4EF997456198DD78
-FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF 51866FD5B85ECB8A
-3000000000000000 1000000000000001 7D856F9A613063F2
-1111111111111111 1111111111111111 2466DD878B963C9D
-0123456789ABCDEF 1111111111111111 61F9C3802281B096
-1111111111111111 0123456789ABCDEF 7D0CC630AFDA1EC7
-FEDCBA9876543210 0123456789ABCDEF 0ACEAB0FC6A0A28D
-7CA110454A1A6E57 01A1D6D039776742 59C68245EB05282B
-0131D9619DC1376E 5CD54CA83DEF57DA B1B8CC0B250F09A0
-07A1133E4A0B2686 0248D43806F67172 1730E5778BEA1DA4
-3849674C2602319E 51454B582DDF440A A25E7856CF2651EB
-04B915BA43FEB5B6 42FD443059577FA2 353882B109CE8F1A
-0113B970FD34F2CE 059B5E0851CF143A 48F4D0884C379918
-0170F175468FB5E6 0756D8E0774761D2 432193B78951FC98
-43297FAD38E373FE 762514B829BF486A 13F04154D69D1AE5
-07A7137045DA2A16 3BDD119049372802 2EEDDA93FFD39C79
-04689104C2FD3B2F 26955F6835AF609A D887E0393C2DA6E3
-37D06BB516CB7546 164D5E404F275232 5F99D04F5B163969
-1F08260D1AC2465E 6B056E18759F5CCA 4A057A3B24D3977B
-584023641ABA6176 004BD6EF09176062 452031C1E4FADA8E
-025816164629B007 480D39006EE762F2 7555AE39F59B87BD
-49793EBC79B3258F 437540C8698F3CFA 53C55F9CB49FC019
-4FB05E1515AB73A7 072D43A077075292 7A8E7BFA937E89A3
-49E95D6D4CA229BF 02FE55778117F12A CF9C5D7A4986ADB5
-018310DC409B26D6 1D9D5C5018F728C2 D1ABB290658BC778
-1C587F1C13924FEF 305532286D6F295A 55CB3774D13EF201
-0101010101010101 0123456789ABCDEF FA34EC4847B268B2
-1F1F1F1F0E0E0E0E 0123456789ABCDEF A790795108EA3CAE
-E0FEE0FEF1FEF1FE 0123456789ABCDEF C39E072D9FAC631D
-0000000000000000 FFFFFFFFFFFFFFFF 014933E0CDAFF6E4
-FFFFFFFFFFFFFFFF 0000000000000000 F21E9A77B71C49BC
-0123456789ABCDEF 0000000000000000 245946885754369A
-FEDCBA9876543210 FFFFFFFFFFFFFFFF 6B5C5A9C5D9E0A5A
diff --git a/ext/mcve/CREDITS b/ext/mcve/CREDITS
deleted file mode 100644
index 9111acffab..0000000000
--- a/ext/mcve/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-MCVE
-Brad House, Chris Faulhaber, Steven Schoch
diff --git a/ext/mcve/config.m4 b/ext/mcve/config.m4
deleted file mode 100644
index 6a5ad4eb73..0000000000
--- a/ext/mcve/config.m4
+++ /dev/null
@@ -1,25 +0,0 @@
-dnl config.m4 for PHP4 MCVE Extension
-
-PHP_ARG_WITH(mcve, for MCVE support,
-[ --with-mcve[=DIR] Include MCVE support])
-
-if test "$PHP_MCVE" != "no"; then
- if test -r $PHP_MCVE/include/mcve.h; then
- MCVE_DIR=$PHP_MCVE
- else
- for i in /usr /usr/local /usr/local/mcve ; do
- if test -r $i/include/mcve.h; then
- MCVE_DIR=$i
- fi
- done
- fi
-
- if test -z "$MCVE_DIR"; then
- AC_MSG_ERROR(not found. Please check your MCVE installation; mcve.h NOT FOUND)
- fi
-
- PHP_ADD_INCLUDE($MCVE_DIR/include)
- PHP_ADD_LIBRARY_WITH_PATH(mcve, $MCVE_DIR/lib, MCVE_SHARED_LIBADD)
- PHP_NEW_EXTENSION(mcve, mcve.c, $ext_shared)
- PHP_SUBST(MCVE_SHARED_LIBADD)
-fi
diff --git a/ext/mcve/mcve.c b/ext/mcve/mcve.c
deleted file mode 100644
index e2140b95be..0000000000
--- a/ext/mcve/mcve.c
+++ /dev/null
@@ -1,2103 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Brad House <brad@mainstreetsoftworks.com> |
- | Chris Faulhaber <jedgar@fxp.org> |
- +----------------------------------------------------------------------+
-*/
-
-/* standard php include(s) */
-#include "php.h"
-#include "ext/standard/head.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-
-/* local include(s) */
-#include <mcve.h>
-
-/* local php include(s) */
-#include "php_mcve.h"
-
-/* {{{ globals */
-static int le_conn; /* connection resource */
-static int le_user; /* store add/edit/get user information */
-
-static int mcve_init; /* For Safe Memory Deallocation */
-/* }}} */
-
-/* {{{ extension definition structures */
-static unsigned char second_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
-
-function_entry php_mcve_functions[] = {
- PHP_FE(mcve_initengine, NULL)
- PHP_FE(mcve_initconn, NULL)
- PHP_FE(mcve_deleteresponse, NULL)
- PHP_FE(mcve_destroyconn, NULL)
- PHP_FE(mcve_setdropfile, NULL)
- PHP_FE(mcve_setip, NULL)
- PHP_FE(mcve_setssl, NULL)
- PHP_FE(mcve_settimeout, NULL)
- PHP_FE(mcve_setblocking, NULL)
- PHP_FE(mcve_verifyconnection, NULL)
- PHP_FE(mcve_verifysslcert, NULL)
- PHP_FE(mcve_maxconntimeout, NULL)
- PHP_FE(mcve_connectionerror, NULL)
- PHP_FE(mcve_deletetrans, NULL)
- PHP_FE(mcve_connect, NULL)
- PHP_FE(mcve_transnew, NULL)
- PHP_FE(mcve_transparam, NULL)
- PHP_FE(mcve_transsend, NULL)
- PHP_FE(mcve_ping, NULL)
- PHP_FE(mcve_responseparam, NULL)
- PHP_FE(mcve_returnstatus, NULL)
- PHP_FE(mcve_returncode, NULL)
- PHP_FE(mcve_transactionssent, NULL)
- PHP_FE(mcve_transactionitem, NULL)
- PHP_FE(mcve_transactionbatch, NULL)
- PHP_FE(mcve_transactionid, NULL)
- PHP_FE(mcve_transactionauth, NULL)
- PHP_FE(mcve_transactiontext, NULL)
- PHP_FE(mcve_transactionavs, NULL)
- PHP_FE(mcve_transactioncv, NULL)
- PHP_FE(mcve_getuserparam, NULL)
- PHP_FE(mcve_monitor, NULL)
- PHP_FE(mcve_transinqueue, NULL)
- PHP_FE(mcve_checkstatus, NULL)
- PHP_FE(mcve_completeauthorizations, second_arg_force_ref)
- PHP_FE(mcve_sale, NULL)
- PHP_FE(mcve_preauth, NULL)
- PHP_FE(mcve_void, NULL)
- PHP_FE(mcve_preauthcompletion, NULL)
- PHP_FE(mcve_force, NULL)
- PHP_FE(mcve_override, NULL)
- PHP_FE(mcve_return, NULL)
- PHP_FE(mcve_iscommadelimited, NULL)
- PHP_FE(mcve_parsecommadelimited, NULL)
- PHP_FE(mcve_getcommadelimited, NULL)
- PHP_FE(mcve_getcell, NULL)
- PHP_FE(mcve_getcellbynum, NULL)
- PHP_FE(mcve_numcolumns, NULL)
- PHP_FE(mcve_numrows, NULL)
- PHP_FE(mcve_getheader, NULL)
- PHP_FE(mcve_destroyengine, NULL)
- PHP_FE(mcve_settle, NULL)
- PHP_FE(mcve_gut, NULL)
- PHP_FE(mcve_gl, NULL)
- PHP_FE(mcve_gft, NULL)
- PHP_FE(mcve_qc, NULL)
- PHP_FE(mcve_ub, NULL)
- PHP_FE(mcve_chkpwd, NULL)
- PHP_FE(mcve_bt, NULL)
- PHP_FE(mcve_uwait, NULL)
- PHP_FE(mcve_text_code, NULL)
- PHP_FE(mcve_text_avs, NULL)
- PHP_FE(mcve_text_cv, NULL)
-/* Administrator Functions */
- PHP_FE(mcve_chngpwd, NULL)
- PHP_FE(mcve_listusers, NULL)
- PHP_FE(mcve_adduser, NULL)
- PHP_FE(mcve_enableuser, NULL)
- PHP_FE(mcve_disableuser, NULL)
- PHP_FE(mcve_getuserarg, NULL)
- PHP_FE(mcve_adduserarg, NULL)
- PHP_FE(mcve_deleteusersetup, NULL)
- PHP_FE(mcve_initusersetup, NULL)
- PHP_FE(mcve_deluser, NULL)
- PHP_FE(mcve_edituser, NULL)
- PHP_FE(mcve_liststats, NULL)
-
- { NULL, NULL, NULL }
-};
-
-zend_module_entry php_mcve_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
- "mcve", /* module name */
- php_mcve_functions, /* struct of functions (see above) */
- PHP_MINIT(mcve), /* module initialization functions */
- NULL, /* module shutdown functions */
- NULL, /* request initialization functions */
- NULL, /* request shutdown functions */
- PHP_MINFO(mcve), /* declare the info function for phpinfo() */
-#if ZEND_MODULE_API_NO >= 20010901
- PHP_MCVE_VERSION, /* declare MCVE version number */
-#endif
- STANDARD_MODULE_PROPERTIES
-};
-
-/* }}} */
-
-/* declare the module for dynamic loading */
-#ifdef COMPILE_DL_MCVE
-ZEND_GET_MODULE(mcve)
-#endif
-
-/* {{{ MCVE_CONN destructor */
-static void _free_mcve_conn(zend_rsrc_list_entry *rsrc)
-{
- MCVE_CONN *conn;
-
- conn = (MCVE_CONN *)rsrc->ptr;
- MCVE_DestroyConn(conn);
- efree(conn);
-}
-/* }}} */
-
-/* {{{ module initialization */
-PHP_MINIT_FUNCTION(mcve)
-{
- /* register the MCVE_CONN destructor */
- le_conn = zend_register_list_destructors_ex(_free_mcve_conn, NULL, "mcve connection", module_number);
-
- /* Key definitions for Transaction Parameters */
- REGISTER_LONG_CONSTANT("MC_TRANTYPE", MC_TRANTYPE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USERNAME", MC_USERNAME, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_PASSWORD", MC_PASSWORD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ACCOUNT", MC_ACCOUNT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRACKDATA", MC_TRACKDATA, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EXPDATE", MC_EXPDATE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_STREET", MC_STREET, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ZIP", MC_ZIP, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CV", MC_CV, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_COMMENTS", MC_COMMENTS, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CLERKID", MC_CLERKID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_STATIONID", MC_STATIONID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_APPRCODE", MC_APPRCODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_AMOUNT", MC_AMOUNT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_PTRANNUM", MC_PTRANNUM, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TTID", MC_TTID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER", MC_USER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_PWD", MC_PWD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ACCT", MC_ACCT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_BDATE", MC_BDATE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EDATE", MC_EDATE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_BATCH", MC_BATCH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_FILE", MC_FILE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN", MC_ADMIN, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_AUDITTYPE", MC_AUDITTYPE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CUSTOM", MC_CUSTOM, MCVE_CONST);
-
- /* Args for adding a user */
- REGISTER_LONG_CONSTANT("MC_USER_PROC", MC_USER_PROC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_USER", MC_USER_USER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_PWD", MC_USER_PWD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_INDCODE", MC_USER_INDCODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_MERCHID", MC_USER_MERCHID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_BANKID", MC_USER_BANKID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_TERMID", MC_USER_TERMID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_CLIENTNUM", MC_USER_CLIENTNUM, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_STOREID", MC_USER_STOREID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_AGENTID", MC_USER_AGENTID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_CHAINID", MC_USER_CHAINID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_ZIPCODE", MC_USER_ZIPCODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_TIMEZONE", MC_USER_TIMEZONE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_MERCHCAT", MC_USER_MERCHCAT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_MERNAME", MC_USER_MERNAME, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_MERCHLOC", MC_USER_MERCHLOC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_STATECODE", MC_USER_STATECODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_PHONE", MC_USER_PHONE, MCVE_CONST);
-
- /* Value definitions for Transaction Types */
- REGISTER_LONG_CONSTANT("MC_TRAN_SALE", MC_TRAN_SALE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_PREAUTH", MC_TRAN_PREAUTH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_VOID", MC_TRAN_VOID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_PREAUTHCOMPLETE", MC_TRAN_PREAUTHCOMPLETE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_FORCE", MC_TRAN_FORCE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_OVERRIDE", MC_TRAN_OVERRIDE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_RETURN", MC_TRAN_RETURN, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_SETTLE", MC_TRAN_SETTLE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_ADMIN", MC_TRAN_ADMIN, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_PING", MC_TRAN_PING, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_CHKPWD", MC_TRAN_CHKPWD, MCVE_CONST);
-
- /* Engine Admin Transaction Types */
- REGISTER_LONG_CONSTANT("MC_TRAN_CHNGPWD", MC_TRAN_CHNGPWD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_LISTSTATS", MC_TRAN_LISTSTATS, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_LISTUSERS", MC_TRAN_LISTUSERS, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_GETUSERINFO", MC_TRAN_GETUSERINFO, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_ADDUSER", MC_TRAN_ADDUSER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_EDITUSER", MC_TRAN_EDITUSER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_DELUSER", MC_TRAN_DELUSER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_ENABLEUSER", MC_TRAN_ENABLEUSER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_DISABLEUSER", MC_TRAN_DISABLEUSER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_IMPORT", MC_TRAN_IMPORT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_EXPORT", MC_TRAN_EXPORT, MCVE_CONST);
-
- /* Value definitions for Admin Types */
- REGISTER_LONG_CONSTANT("MC_ADMIN_GUT", MC_ADMIN_GUT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_GL", MC_ADMIN_GL, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_GFT", MC_ADMIN_GFT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_BT", MC_ADMIN_BT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_UB", MC_ADMIN_UB, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_QC", MC_ADMIN_QC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_RS", MC_ADMIN_RS, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_CTH", MC_ADMIN_CTH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_CFH", MC_ADMIN_CFH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_FORCESETTLE", MC_ADMIN_FORCESETTLE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_SETBATCHNUM", MC_ADMIN_SETBATCHNUM, MCVE_CONST);
-
- /* set up the mcve defines */
- REGISTER_LONG_CONSTANT("MCVE_UNUSED", MCVE_UNUSED, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_NEW", MCVE_NEW, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_PENDING", MCVE_PENDING, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_DONE", MCVE_DONE, MCVE_CONST);
-
- REGISTER_LONG_CONSTANT("MCVE_GOOD", MCVE_GOOD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_BAD", MCVE_BAD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_STREET", MCVE_STREET, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_ZIP", MCVE_ZIP, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_UNKNOWN", MCVE_UNKNOWN, MCVE_CONST);
-
- REGISTER_LONG_CONSTANT("MCVE_ERROR", MCVE_ERROR, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_FAIL", MCVE_FAIL, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_SUCCESS", MCVE_SUCCESS, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_AUTH", MCVE_AUTH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_DENY", MCVE_DENY, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_CALL", MCVE_CALL, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_DUPL", MCVE_DUPL, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_PKUP", MCVE_PKUP, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_RETRY", MCVE_RETRY, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_SETUP", MCVE_SETUP, MCVE_CONST);
-
- REGISTER_LONG_CONSTANT("MCVE_SALE", MCVE_SALE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_PREAUTH", MCVE_PREAUTH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_FORCE", MCVE_FORCE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_OVERRIDE", MCVE_OVERRIDE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_RETURN", MCVE_RETURN, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_SETTLE", MCVE_SETTLE, MCVE_CONST);
-
- REGISTER_LONG_CONSTANT("MCVE_PROC", MCVE_PROC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_USER", MCVE_USER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_PWD", MCVE_PWD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_INDCODE", MCVE_INDCODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_MERCHID", MCVE_MERCHID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_BANKID", MCVE_BANKID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_TERMID", MCVE_TERMID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_CLIENTNUM", MCVE_CLIENTNUM, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_STOREID", MCVE_STOREID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_AGENTID", MCVE_AGENTID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_CHAINID", MCVE_CHAINID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_ZIPCODE", MCVE_ZIPCODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_TIMEZONE", MCVE_TIMEZONE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_MERCHCAT", MCVE_MERCHCAT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_MERNAME", MCVE_MERNAME, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_MERCHLOC", MCVE_MERCHLOC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_STATECODE", MCVE_STATECODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_SERVICEPHONE", MCVE_SERVICEPHONE, MCVE_CONST);
-
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ module information */
-PHP_MINFO_FUNCTION(mcve)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "mcve support", "enabled");
- php_info_print_table_row(2, "version", PHP_MCVE_VERSION);
- php_info_print_table_end();
-}
-/* }}} */
-
-
-/* {{{ proto int mcve_initengine(string location)
- Ready the client for IP/SSL Communication */
-PHP_FUNCTION(mcve_initengine)
-{
- int ret;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(arg);
-
- if (mcve_init) {
- MCVE_DestroyEngine();
- }
- ret = MCVE_InitEngine(Z_STRVAL_PP(arg));
- mcve_init = 1;
-
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto resource mcve_initconn(void)
- Create and initialize an MCVE_CONN structure */
-PHP_FUNCTION(mcve_initconn)
-{
- MCVE_CONN *conn;
-
- conn = emalloc(sizeof(MCVE_CONN));
-
- MCVE_InitConn(conn);
-
- ZEND_REGISTER_RESOURCE(return_value, conn, le_conn);
-}
-/* }}} */
-
-
-/* {{{ proto bool mcve_deleteresponse(resource conn, int identifier)
- Delete specified transaction from MCVE_CONN structure */
-PHP_FUNCTION(mcve_deleteresponse)
-{
- MCVE_CONN *conn;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- MCVE_DeleteResponse(conn, Z_LVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mcve_deletetrans(resource conn, int identifier)
- Delete specified transaction from MCVE_CONN structure */
-PHP_FUNCTION(mcve_deletetrans)
-{
- MCVE_CONN *conn;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection",
- le_conn);
-
- convert_to_long_ex(arg2);
-
- MCVE_DeleteTrans(conn, Z_LVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void mcve_destroyconn(resource conn)
- Destroy the connection and MCVE_CONN structure */
-PHP_FUNCTION(mcve_destroyconn)
-{
- MCVE_CONN *conn;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- MCVE_DestroyConn(conn);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mcve_setdropfile(resource conn, string directory)
- Set the connection method to Drop-File */
-PHP_FUNCTION(mcve_setdropfile)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
-
- retval = MCVE_SetDropFile(conn, Z_STRVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_setip(resource conn, string host, int port)
- Set the connection method to IP */
-PHP_FUNCTION(mcve_setip)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
-
- retval = MCVE_SetIP(conn, Z_STRVAL_PP(arg2), Z_LVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_setssl(resource conn, string host, int port)
- Set the connection method to SSL */
-PHP_FUNCTION(mcve_setssl)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
-
- retval = MCVE_SetSSL(conn, Z_STRVAL_PP(arg2), Z_LVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_settimeout(resource conn, int seconds)
- Set maximum transaction time (per trans)
-*/
-PHP_FUNCTION(mcve_settimeout)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_SetTimeout(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_setblocking(resource conn, int tf)
- Set blocking/non-blocking mode for connection
-*/
-PHP_FUNCTION(mcve_setblocking)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_SetBlocking(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto bool mcve_verifyconnection(resource conn, int tf)
- Set whether or not to PING upon connect to verify connection
-*/
-PHP_FUNCTION(mcve_verifyconnection)
-{
- MCVE_CONN *conn;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- MCVE_VerifyConnection(conn, Z_LVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mcve_verifysslcert(resource conn, int tf)
- Set whether or not to verify the server ssl certificate
-*/
-PHP_FUNCTION(mcve_verifysslcert)
-{
- MCVE_CONN *conn;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- MCVE_VerifySSLCert(conn, Z_LVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mcve_maxconntimeout(resource conn, int secs)
- The maximum amount of time the API will attempt a connection to MCVE
-*/
-PHP_FUNCTION(mcve_maxconntimeout)
-{
- MCVE_CONN *conn;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- MCVE_MaxConnTimeout(conn, Z_LVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mcve_connect(resource conn)
- Establish the connection to MCVE */
-PHP_FUNCTION(mcve_connect)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- retval = MCVE_Connect(conn);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto string mcve_connectionerror(resource conn)
- Get a textual representation of why a connection failed */
-PHP_FUNCTION(mcve_connectionerror)
-{
- MCVE_CONN *conn;
- char *retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- retval = MCVE_ConnectionError(conn);
-
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(retval, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto int mcve_transactionssent(resource conn)
- Check to see if outgoing buffer is clear */
-PHP_FUNCTION(mcve_transactionssent)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- retval = MCVE_TransactionsSent(conn);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_ping(resource conn)
- Send a ping request to MCVE */
-PHP_FUNCTION(mcve_ping)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- retval = MCVE_Ping(conn);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_transnew(resource conn)
- Start a new transaction */
-PHP_FUNCTION(mcve_transnew)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- retval = MCVE_TransNew(conn);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_transparam(resource conn, long identifier, int key, ...)
- Add a parameter to a transaction */
-PHP_FUNCTION(mcve_transparam)
-{
- MCVE_CONN *conn;
- int retval;
- int key;
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
-
- if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- WRONG_PARAM_COUNT;
- } else if (ZEND_NUM_ARGS() == 5) {
- if (zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE)
- WRONG_PARAM_COUNT;
- } else {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg3);
-
- key = Z_LVAL_PP(arg3);
-
- if (key == MC_CUSTOM && ZEND_NUM_ARGS() != 5)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- switch (key) {
- case MC_TRANTYPE:
- case MC_PTRANNUM:
- case MC_TTID:
- case MC_ADMIN:
- case MC_AUDITTYPE:
- convert_to_long_ex(arg4);
- retval = MCVE_TransParam(conn, Z_LVAL_PP(arg2), key, Z_LVAL_PP(arg4));
- break;
-
- case MC_AMOUNT:
- convert_to_double_ex(arg4);
- retval = MCVE_TransParam(conn, Z_LVAL_PP(arg2), key, Z_DVAL_PP(arg4));
- break;
-
- case MC_CUSTOM:
- convert_to_string_ex(arg4);
- convert_to_string_ex(arg5);
- retval = MCVE_TransParam(conn, Z_LVAL_PP(arg2), key, Z_STRVAL_PP(arg4), Z_STRVAL_PP(arg5));
- break;
-
- default:
- convert_to_string_ex(arg4);
- retval = MCVE_TransParam(conn, Z_LVAL_PP(arg2), key, Z_STRVAL_PP(arg4));
- break;
- }
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_transsend(resource conn, long identifier)
- Finalize and send the transaction */
-PHP_FUNCTION(mcve_transsend)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransSend(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto string mcve_responseparam(resource conn, long identifier, string key)
- Get a custom response parameter */
-PHP_FUNCTION(mcve_responseparam)
-{
- MCVE_CONN *conn;
- char *retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_ResponseParam(conn, Z_LVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(retval, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto string mcve_getuserparam(resource conn, long identifier, int key)
- Get a user response parameter */
-PHP_FUNCTION(mcve_getuserparam)
-{
- MCVE_CONN *conn;
- char *retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
-
- retval = MCVE_GetUserParam(conn, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3));
-
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(retval, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto int mcve_returnstatus(resource conn, int identifier)
- Check to see if the transaction was successful */
-PHP_FUNCTION(mcve_returnstatus)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_ReturnStatus(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_returncode(resource conn, int identifier)
- Grab the exact return code from the transaction */
-PHP_FUNCTION(mcve_returncode)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_ReturnCode(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_transactionitem(resource conn, int identifier)
- Get the ITEM number in the associated batch for this transaction */
-PHP_FUNCTION(mcve_transactionitem)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransactionItem(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_transactionavs(resource conn, int identifier)
- Get the Address Verification return status */
-PHP_FUNCTION(mcve_transactionavs)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransactionAVS(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-
-/* {{{ proto int mcve_transactioncv(resource conn, int identifier)
- Get the CVC2/CVV2/CID return status */
-PHP_FUNCTION(mcve_transactioncv)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransactionCV(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_transactionbatch(resource conn, int identifier)
- Get the batch number associated with the transaction */
-PHP_FUNCTION(mcve_transactionbatch)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransactionBatch(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_transactionid(resource conn, int identifier)
- Get the unique system id for the transaction
-*/
-PHP_FUNCTION(mcve_transactionid)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransactionID(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto string mcve_transactionauth(resource conn, int identifier)
- Get the authorization number returned for the transaction (alpha-numeric) */
-PHP_FUNCTION(mcve_transactionauth)
-{
- MCVE_CONN *conn;
- char *retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransactionAuth(conn, Z_LVAL_PP(arg2));
-
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(retval, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto string mcve_transactiontext(resource conn, int identifier)
- Get verbiage (text) return from MCVE or processing institution */
-PHP_FUNCTION(mcve_transactiontext)
-{
- MCVE_CONN *conn;
- char *retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransactionText(conn, Z_LVAL_PP(arg2));
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(retval, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto int mcve_monitor(resource conn)
- Perform communication with MCVE (send/receive data) Non-blocking */
-PHP_FUNCTION(mcve_monitor)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- retval = MCVE_Monitor(conn);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_transinqueue(resource conn)
- Number of transactions in client-queue */
-PHP_FUNCTION(mcve_transinqueue)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- retval = MCVE_TransInQueue(conn);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_checkstatus(resource conn, int identifier)
- Check to see if a transaction has completed */
-PHP_FUNCTION(mcve_checkstatus)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_CheckStatus(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_completeauthorizations(resource conn, int &array)
- Number of complete authorizations in queue, returning an array of their identifiers */
-PHP_FUNCTION(mcve_completeauthorizations)
-{
- MCVE_CONN *conn;
- long i, *list, listnum;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2))
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- listnum = MCVE_CompleteAuthorizations(conn, &list);
-
- if (listnum) {
- /* should use ZVAL_DESTRUCTOR */
- pval_destructor(*arg2);
- array_init(*arg2);
- for (i = 0; i < listnum; i++)
- add_index_long(*arg2, i, list[i]);
- free(list);
- }
-
- RETURN_LONG(listnum);
-}
-/* }}} */
-
-/* {{{ proto int mcve_sale(resource conn, string username, string password, string trackdata, string account, string expdate, float amount, string street, string zip, string cv, string comments, string clerkid, string stationid, int ptrannum)
- Send a SALE to MCVE */
-PHP_FUNCTION(mcve_sale)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8;
- zval **arg9, **arg10, **arg11, **arg12, **arg13, **arg14;
-
- if (ZEND_NUM_ARGS() != 14 || zend_get_parameters_ex(14, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11,
- &arg12, &arg13, &arg14) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_double_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_string_ex(arg9);
- convert_to_string_ex(arg10);
- convert_to_string_ex(arg11);
- convert_to_string_ex(arg12);
- convert_to_string_ex(arg13);
- convert_to_long_ex(arg14);
-
- retval = MCVE_Sale(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3),
- Z_STRVAL_PP(arg4), Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6),
- Z_DVAL_PP(arg7), Z_STRVAL_PP(arg8), Z_STRVAL_PP(arg9),
- Z_STRVAL_PP(arg10), Z_STRVAL_PP(arg11), Z_STRVAL_PP(arg12),
- Z_STRVAL_PP(arg13), Z_LVAL_PP(arg14));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_preauth(resource conn, string username, string password, string trackdata, string account, string expdate, float amount, string street, string zip, string cv, string comments, string clerkid, string stationid, int ptrannum)
- Send a PREAUTHORIZATION to MCVE */
-PHP_FUNCTION(mcve_preauth)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8;
- zval **arg9, **arg10, **arg11, **arg12, **arg13, **arg14;
-
- if (ZEND_NUM_ARGS() != 14 || zend_get_parameters_ex(14, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11,
- &arg12, &arg13, &arg14) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_double_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_string_ex(arg9);
- convert_to_string_ex(arg10);
- convert_to_string_ex(arg11);
- convert_to_string_ex(arg12);
- convert_to_string_ex(arg13);
- convert_to_long_ex(arg14);
-
- retval = MCVE_PreAuth(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3),
- Z_STRVAL_PP(arg4), Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6),
- Z_DVAL_PP(arg7), Z_STRVAL_PP(arg8), Z_STRVAL_PP(arg9),
- Z_STRVAL_PP(arg10), Z_STRVAL_PP(arg11), Z_STRVAL_PP(arg12),
- Z_STRVAL_PP(arg13), Z_LVAL_PP(arg14));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_override(resource conn, string username, string password, string trackdata, string account, string expdate, float amount, string street, string zip, string cv, string comments, string clerkid, string stationid, int ptrannum)
- Send an OVERRIDE to MCVE */
-PHP_FUNCTION(mcve_override)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8;
- zval **arg9, **arg10, **arg11, **arg12, **arg13, **arg14;
-
- if (ZEND_NUM_ARGS() != 14 || zend_get_parameters_ex(14, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11,
- &arg12, &arg13, &arg14) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_double_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_string_ex(arg9);
- convert_to_string_ex(arg10);
- convert_to_string_ex(arg11);
- convert_to_string_ex(arg12);
- convert_to_string_ex(arg13);
- convert_to_long_ex(arg14);
-
- retval = MCVE_Override(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3),
- Z_STRVAL_PP(arg4), Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6),
- Z_DVAL_PP(arg7), Z_STRVAL_PP(arg8), Z_STRVAL_PP(arg9),
- Z_STRVAL_PP(arg10), Z_STRVAL_PP(arg11), Z_STRVAL_PP(arg12),
- Z_STRVAL_PP(arg13), Z_LVAL_PP(arg14));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_void(resource conn, string username, string password, int sid, int ptrannum)
- VOID a transaction in the settlement queue */
-PHP_FUNCTION(mcve_void)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
-
- if (ZEND_NUM_ARGS() != 5 ||
- zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_long_ex(arg5);
-
- retval = MCVE_Void(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3), Z_LVAL_PP(arg4), Z_LVAL_PP(arg5));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_preauthcompletion(resource conn, string username, string password, float finalamount, int sid, int ptrannum)
- Complete a PREAUTHORIZATION... Ready it for settlement */
-PHP_FUNCTION(mcve_preauthcompletion)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
-
- if (ZEND_NUM_ARGS() != 6 ||
- zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_long_ex(arg5);
- convert_to_long_ex(arg6);
-
- retval = MCVE_PreAuthCompletion(conn, Z_STRVAL_PP(arg2),
- Z_STRVAL_PP(arg3), Z_DVAL_PP(arg4), Z_LVAL_PP(arg5), Z_LVAL_PP(arg6));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_force(resiurce conn, string username, string password, string trackdata, string account, string expdate, float amount, string authcode, string comments, string clerkid, string stationid, int ptrannum)
- Send a FORCE to MCVE. (typically, a phone-authorization) */
-PHP_FUNCTION(mcve_force)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8;
- zval **arg9, **arg10, **arg11, **arg12;
-
- if (ZEND_NUM_ARGS() != 12 || zend_get_parameters_ex(12, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11, &arg12) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_double_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_string_ex(arg9);
- convert_to_string_ex(arg10);
- convert_to_string_ex(arg11);
- convert_to_long_ex(arg12);
-
- retval = MCVE_Force(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3),
- Z_STRVAL_PP(arg4), Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6),
- Z_DVAL_PP(arg7), Z_STRVAL_PP(arg8), Z_STRVAL_PP(arg9),
- Z_STRVAL_PP(arg10), Z_STRVAL_PP(arg11), Z_LVAL_PP(arg12));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_return(int conn, string username, string password, string trackdata, string account, string expdate, float amount, string comments, string clerkid, string stationid, int ptrannum)
- Issue a RETURN or CREDIT to MCVE */
-PHP_FUNCTION(mcve_return)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8;
- zval **arg9, **arg10, **arg11;
-
- if (ZEND_NUM_ARGS() != 11 || zend_get_parameters_ex(11, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_double_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_string_ex(arg9);
- convert_to_string_ex(arg10);
- convert_to_long_ex(arg11);
-
- retval = MCVE_Return(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3),
- Z_STRVAL_PP(arg4), Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6),
- Z_DVAL_PP(arg7), Z_STRVAL_PP(arg8), Z_STRVAL_PP(arg9),
- Z_STRVAL_PP(arg10), Z_LVAL_PP(arg11));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-
-/* {{{ proto int mcve_settle(resource conn, string username, string password, string batch)
- Issue a settlement command to do a batch deposit */
-PHP_FUNCTION(mcve_settle)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
-
- retval = MCVE_Settle(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3), Z_STRVAL_PP(arg4));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_ub(resource conn, string username, string password)
- Get a list of all Unsettled batches */
-PHP_FUNCTION(mcve_ub)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_Ub(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_qc(resource conn, string username, string password, string clerkid, string stationid, string comments, int ptrannum)
- Audit MCVE for a list of transactions in the outgoing queue */
-PHP_FUNCTION(mcve_qc)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
-
- if (ZEND_NUM_ARGS() != 7 ||
- zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_long_ex(arg7);
-
- retval = MCVE_Qc(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3), Z_STRVAL_PP(arg4),
- Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6), Z_LVAL_PP(arg7));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_gut(resource conn, string username, string password, int type, string account, string clerkid, string stationid, string comments, int ptrannum, string startdate, string enddate)
- Audit MCVE for Unsettled Transactions */
-PHP_FUNCTION(mcve_gut)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8, **arg9, **arg10, **arg11;
-
- if (ZEND_NUM_ARGS() != 11 || zend_get_parameters_ex(11, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_string_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_long_ex(arg9);
- convert_to_string_ex(arg10);
- convert_to_string_ex(arg11);
-
- retval = MCVE_Gut(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3), Z_LVAL_PP(arg4),
- Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6), Z_STRVAL_PP(arg7), Z_STRVAL_PP(arg8),
- Z_LVAL_PP(arg9), Z_STRVAL_PP(arg10),Z_STRVAL_PP(arg11));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_gl(int conn, string username, string password, int type, string account, string batch, string clerkid, string stationid, string comments, int ptrannum, string startdate, string enddate)
- Audit MCVE for settled transactions */
-PHP_FUNCTION(mcve_gl)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8, **arg9, **arg10, **arg11, **arg12;
-
- if (ZEND_NUM_ARGS() != 12 || zend_get_parameters_ex(12, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11, &arg12) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_string_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_string_ex(arg9);
- convert_to_long_ex(arg10);
- convert_to_string_ex(arg11);
- convert_to_string_ex(arg12);
-
- retval = MCVE_Gl(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3), Z_LVAL_PP(arg4),
- Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6), Z_STRVAL_PP(arg7), Z_STRVAL_PP(arg8),
- Z_STRVAL_PP(arg9), Z_LVAL_PP(arg10), Z_STRVAL_PP(arg11), Z_STRVAL_PP(arg12));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_gft(resource conn, string username, string password, int type, string account, string clerkid, string stationid, string comments, int ptrannum, string startdate, string enddate)
- Audit MCVE for Failed transactions
-*/
-PHP_FUNCTION(mcve_gft)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8, **arg9, **arg10, **arg11;
-
- if (ZEND_NUM_ARGS() != 11 || zend_get_parameters_ex(11, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_string_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_long_ex(arg9);
- convert_to_string_ex(arg10);
- convert_to_string_ex(arg11);
-
- retval = MCVE_Gft(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3), Z_LVAL_PP(arg4),
- Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6), Z_STRVAL_PP(arg7), Z_STRVAL_PP(arg8),
- Z_LVAL_PP(arg9), Z_STRVAL_PP(arg10), Z_STRVAL_PP(arg11));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_chkpwd(resource conn, string username, string password)
- Verify Password */
-PHP_FUNCTION(mcve_chkpwd)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_Chkpwd(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_bt(resource conn, string username, string password)
- Get unsettled batch totals */
-PHP_FUNCTION(mcve_bt)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_Bt(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto string mcve_getcell(resource conn, int identifier, string column, int row)
- Get a specific cell from a comma delimited response by column name */
-PHP_FUNCTION(mcve_getcell)
-{
- MCVE_CONN *conn;
- char *retval;
- zval **arg1, **arg2, **arg3, **arg4;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
-
- retval = MCVE_GetCell(conn, Z_LVAL_PP(arg2), Z_STRVAL_PP(arg3), Z_LVAL_PP(arg4));
-
- if (retval == NULL) {
- RETURN_STRING("", 1);
- } else {
- RETURN_STRING(retval, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto string mcve_getcellbynum(resource conn, int identifier, int column, int row)
- Get a specific cell from a comma delimited response by column number */
-PHP_FUNCTION(mcve_getcellbynum)
-{
- MCVE_CONN *conn;
- char *retval;
- zval **arg1, **arg2, **arg3, **arg4;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
- convert_to_long_ex(arg4);
-
- retval = MCVE_GetCellByNum(conn, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3), Z_LVAL_PP(arg4));
-
- if (retval == NULL) {
- RETURN_STRING("", 1);
- } else {
- RETURN_STRING(retval, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto int mcve_numcolumns(resource conn, int identifier)
- Number of columns returned in a comma delimited response */
-PHP_FUNCTION(mcve_numcolumns)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_NumColumns(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_numrows(resource conn, int identifier)
- Number of rows returned in a comma delimited response */
-PHP_FUNCTION(mcve_numrows)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_NumRows(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_iscommadelimited(resource conn, int identifier)
- Checks to see if response is comma delimited */
-PHP_FUNCTION(mcve_iscommadelimited)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_IsCommaDelimited(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_parsecommadelimited(resource conn, int identifier)
- Parse the comma delimited response so mcve_getcell, etc will work */
-PHP_FUNCTION(mcve_parsecommadelimited)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_ParseCommaDelimited(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto string mcve_getcommadelimited(resource conn, int identifier)
- Get the RAW comma delimited data returned from MCVE */
-PHP_FUNCTION(mcve_getcommadelimited)
-{
- MCVE_CONN *conn;
- char *retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_GetCommaDelimited(conn, Z_LVAL_PP(arg2));
-
- RETURN_STRING(retval, 1);
-}
-/* }}} */
-
-/* {{{ proto string mcve_getheader(resource conn, int identifier, int column_num)
- Get the name of the column in a comma-delimited response */
-PHP_FUNCTION(mcve_getheader)
-{
- MCVE_CONN *conn;
- char *retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
-
- retval = MCVE_GetHeader(conn, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3));
-
- RETURN_STRING(retval, 1);
-}
-/* }}} */
-
-/* {{{ proto void mcve_destroyengine(void)
- Free memory associated with IP/SSL connectivity */
-PHP_FUNCTION(mcve_destroyengine)
-{
- MCVE_DestroyEngine();
- mcve_init = 0;
-}
-/* }}} */
-
-/* {{{ proto int mcve_chngpwd(resource conn, string admin_password, string new_password)
- Change the system administrator's password */
-PHP_FUNCTION(mcve_chngpwd)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_Chngpwd(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_listusers(resource conn, string admin_password)
- List all users on MCVE system */
-PHP_FUNCTION(mcve_listusers)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
-
- retval = MCVE_ListUsers(conn, Z_STRVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_enableuser(resource conn, string admin_password, string username)
- Enable an inactive MCVE user account */
-PHP_FUNCTION(mcve_enableuser)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_EnableUser(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_disableuser(resource conn, string admin_password, string username)
- Disable an active MCVE user account */
-PHP_FUNCTION(mcve_disableuser)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_DisableUser(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_deluser(resource conn, string admin_password, string username)
- Delete an MCVE user account */
-PHP_FUNCTION(mcve_deluser)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_DelUser(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_liststats(resource conn, string admin_password)
- List statistics for all users on MCVE system */
-PHP_FUNCTION(mcve_liststats)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
-
- retval = MCVE_ListStats(conn, Z_STRVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto resource mcve_initusersetup(void)
- Initialize structure to store user data */
-PHP_FUNCTION(mcve_initusersetup)
-{
- MCVE_UserSetup *usersetup;
-
- usersetup = emalloc(sizeof(MCVE_UserSetup));
-
- MCVE_InitUserSetup(usersetup);
-
- ZEND_REGISTER_RESOURCE(return_value, usersetup, le_user);
-}
-/* }}} */
-
-/* {{{ proto void mcve_deleteusersetup(resource usersetup)
- Deallocate data associated with usersetup structure */
-PHP_FUNCTION(mcve_deleteusersetup)
-{
- MCVE_UserSetup *usersetup;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(usersetup, MCVE_UserSetup *, arg, -1, "mcve user setup", le_user);
-
- MCVE_DeleteUserSetup(usersetup);
- efree(usersetup);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mcve_adduserarg(resource usersetup, int argtype, string argval)
- Add a value to user configuration structure */
-PHP_FUNCTION(mcve_adduserarg)
-{
- MCVE_UserSetup *usersetup;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(usersetup, MCVE_UserSetup *, arg1, -1, "mcve user setup", le_user);
-
- convert_to_long_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_AddUserArg(usersetup, Z_LVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto string mcve_getuserarg(resource usersetup, int argtype)
- Grab a value from usersetup structure */
-PHP_FUNCTION(mcve_getuserarg)
-{
- MCVE_UserSetup *usersetup;
- char *retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(usersetup, MCVE_UserSetup *, arg1, -1, "mcve user setup", le_user);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_GetUserArg(usersetup, Z_LVAL_PP(arg2));
-
- RETURN_STRING(retval, 1);
-}
-/* }}} */
-
-/* {{{ proto int mcve_adduser(resource conn, string admin_password, int usersetup)
- Add an MCVE user using usersetup structure */
-PHP_FUNCTION(mcve_adduser)
-{
- MCVE_CONN *conn;
- MCVE_UserSetup *usersetup;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
- ZEND_FETCH_RESOURCE(usersetup, MCVE_UserSetup *, arg3, -1, "mcve user setup", le_user);
-
- convert_to_string_ex(arg2);
-
- retval = MCVE_AddUser(conn, Z_STRVAL_PP(arg2), usersetup);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int mcve_edituser(resource conn, string admin_password, int usersetup)
- Edit MCVE user using usersetup structure */
-PHP_FUNCTION(mcve_edituser)
-{
- MCVE_CONN *conn;
- MCVE_UserSetup *usersetup;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
- ZEND_FETCH_RESOURCE(usersetup, MCVE_UserSetup *, arg3, -1, "mcve user setup", le_user);
-
- convert_to_string_ex(arg2);
-
- retval = MCVE_EditUser(conn, Z_STRVAL_PP(arg2), usersetup);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-
-/* {{{ proto int mcve_uwait(long microsecs)
- Wait x microsecs */
-PHP_FUNCTION(mcve_uwait)
-{
- long retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(arg);
-
- retval = MCVE_uwait(Z_LVAL_PP(arg));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto string mcve_text_code(string code)
- Get a textual representation of the return_code */
-PHP_FUNCTION(mcve_text_code)
-{
- char *retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(arg);
-
- retval = MCVE_TEXT_AVS(Z_LVAL_PP(arg));
-
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(retval, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto string mcve_text_avs(string code)
- Get a textual representation of the return_avs */
-PHP_FUNCTION(mcve_text_avs)
-{
- char *retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(arg);
-
- retval = MCVE_TEXT_AVS(Z_LVAL_PP(arg));
-
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(retval, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto string mcve_text_cv(int code)
- Get a textual representation of the return_cv */
-PHP_FUNCTION(mcve_text_cv)
-{
- char *retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(arg);
-
- retval = MCVE_TEXT_CV(Z_LVAL_PP(arg));
-
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(retval, 1);
- }
-}
-/* }}} */
-
-/* END OF MCVE PHP EXTENSION */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
-
diff --git a/ext/mcve/mcve.php b/ext/mcve/mcve.php
deleted file mode 100644
index f749220b32..0000000000
--- a/ext/mcve/mcve.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?
-$module = 'MCVE';
-if(!extension_loaded($module)) {
- dl('mcve.so');
-}
-$functions = get_extension_funcs($module);
-echo "Functions available in the $module extension:<br>\n";
-foreach($functions as $func) {
- echo $func."<br>\n";
-}
-echo "<br>\n";
-?>
diff --git a/ext/mcve/mcve_simple_test.php b/ext/mcve/mcve_simple_test.php
deleted file mode 100644
index 3a1c4f0601..0000000000
--- a/ext/mcve/mcve_simple_test.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
- MCVE_InitEngine(NULL);
- $conn=MCVE_InitConn();
- if (MCVE_SetIP($conn, "testbox.mcve.com", 8333)) {
- echo "Set connection Properly";
- } else {
- echo "Failed Setting method";
- exit();
- }
- if (!MCVE_Connect($conn)) {
- echo "<BR>Could not connect<BR>";
- } else {
- echo "<BR>Connection Established<BR>";
- }
- MCVE_DestroyConn($conn);
- MCVE_DestroyEngine();
-
-?>
diff --git a/ext/mcve/mcve_test1.php b/ext/mcve/mcve_test1.php
deleted file mode 100644
index a4f7dba8d6..0000000000
--- a/ext/mcve/mcve_test1.php
+++ /dev/null
@@ -1,83 +0,0 @@
-<HTML>
-<BODY>
-<?php
-
-// MCVE Config stuff
-$username="vitale";
-$password="test";
-// 1:IP or 2:SSL
-$method=2;
-$host="testbox.mcve.com";
-$port=8444; //8444 is typically SSL and 8333 is standard
-// End config stuff
-
-
-if (!$account)
- $account="4012888888881";
-if (!$exp)
- $exp="0512";
-if (!$amount)
- $amount=12.00;
-
-function flush_buffer()
-{
- for ($i=0; $i<2048; $i++) {
- echo " ";
- }
- flush();
-}
-
-
-dl("./php_mcve.so");
-
- echo "Initializing MCVE<BR>";
- flush_buffer();
- mcve_initengine("./CAfile.pem");
- $conn=mcve_initconn();
- if ($method == 1)
- $ret=mcve_setip($conn, $host, $port);
- else if ($method == 2)
- $ret=mcve_setssl($conn, $host, $port);
-
- if (!$ret) {
- echo "Could not set method<BR>";
- exit(1);
- }
- echo "Connection method and location set<BR>";
- flush_buffer();
- if (!mcve_connect($conn)) {
- echo "Connection Failed<BR>";
- exit(1);
- }
- echo "Connection Established<BR>";
- flush_buffer();
- $identifier=mcve_sale($conn, $username, $password, NULL, $account, $exp,
- $amount, NULL, NULL, NULL, NULL, NULL, NULL, 001);
- echo "Transaction Sent: CC: $account EXP: $exp AMOUNT: $amount<BR>";
- flush_buffer();
- while (mcve_checkstatus($conn, $identifier) != MCVE_DONE) {
- mcve_monitor($conn);
- }
- echo "Transaction Complete<BR>";
- flush_buffer();
- $status=mcve_returnstatus($conn, $identifier);
- if ($status == MCVE_SUCCESS) {
- $text=mcve_transactiontext($conn, $identifier);
- $auth=mcve_transactionauth($conn, $identifier);
- echo "Transaction Authorized<BR>";
- echo "Auth: $auth<BR>";
- echo "Text: $text<BR>";
- } else if ($status == MCVE_FAIL) {
- $text=mcve_transactiontext($conn, $identifier);
- echo "Transaction Denied<BR>";
- echo "Text: $text<BR>";
- } else
- echo "Transaction error<BR>";
- flush_buffer();
- mcve_destroyconn($conn);
- mcve_destroyengine();
-
-?>
-</BODY>
-</HTML>
-
diff --git a/ext/mcve/mcve_test2.php b/ext/mcve/mcve_test2.php
deleted file mode 100644
index 4cb251b538..0000000000
--- a/ext/mcve/mcve_test2.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?
- #
- # $Id$
- #
-
-$connect_type = "IP";
-
-dl("php_mcve.so");
-
-$conn = MCVE_InitConn();
-print "MCVE_InitConn() returned $conn<br>\n";
-
-if ($connect_type == "IP") {
- MCVE_SetIP($conn, "localhost", 8333) or
- die("MCVE_SetIP() failed");
- print "MCVE_SetIP() successful<br>\n";
-} else {
- MCVE_SetDropFile($conn, "/var/mcve/trans") or
- die("MCVE_SetDropFile() failed");
- print "MCVE_SetDropFile() successful<br>\n";
-}
-
-MCVE_Connect($conn) or
- die("MCVE_Connect() failed");
-print "MCVE_Connect() successful<br>\n";
-
-# send a request
-$ident = MCVE_Sale($conn, "test", "test", NULL, "5454545454545454",
- "1205", 11.00, NULL, NULL, NULL, NULL, "me", NULL, 54321);
-if ($ident == -1)
- die("MCVE_Sale() failed");
-else
- print "Identifier: $ident<br>\n";
-
-$ident = MCVE_Sale($conn, "test", "test", NULL, "5454545454545454",
- "1205", 12.00, NULL, NULL, NULL, NULL, "me", NULL, 54321);
-if ($ident == -1)
- die("MCVE_Sale() failed");
-else
- print "Identifier: $ident<br>\n";
-
-$pending = 0;
-$complete = -1;
-while ($pending != $complete) {
- sleep(2);
-
- MCVE_Monitor($conn);
-
- $pending = MCVE_TransInQueue($conn);
- print "Transactions pending: $pending<br>\n";
-
- $complete = MCVE_CompleteAuthorizations($conn, &$list);
- print "Authorizations complete: $complete<br>\n";
-
- flush();
-}
-
-for ($i = 0; $i < $complete; $i++) {
- $status = MCVE_CheckStatus($conn, $i);
- print "Transaction #" . $list[$i] . " complete: $status<br>\n";
-}
-
-MCVE_DestroyConn($conn);
-print "MCVE_DestroyConn() completed<br>\n";
-
-#phpinfo();
-
-?>
diff --git a/ext/mcve/php_mcve.h b/ext/mcve/php_mcve.h
deleted file mode 100644
index bc4b8bfac2..0000000000
--- a/ext/mcve/php_mcve.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Brad House <brad@mainstreetsoftworks.com> |
- | Chris Faulhaber <jedgar@fxp.org> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _PHP_MCVE_H
-#define _PHP_MCVE_H
-
-extern zend_module_entry php_mcve_module_entry;
-
-#define mcve_module_ptr &php_mcve_module_entry
-#define phpext_mcve_ptr mcve_module_ptr
-
-#define PHP_MCVE_VERSION "3.0"
-
-#define MCVE_CONST (CONST_CS | CONST_PERSISTENT)
-
-PHP_MINIT_FUNCTION(mcve);
-PHP_MINFO_FUNCTION(mcve);
-
-PHP_FUNCTION(mcve_initengine);
-PHP_FUNCTION(mcve_initconn);
-PHP_FUNCTION(mcve_deleteresponse);
-PHP_FUNCTION(mcve_destroyconn);
-PHP_FUNCTION(mcve_setdropfile);
-PHP_FUNCTION(mcve_setip);
-PHP_FUNCTION(mcve_setssl);
-PHP_FUNCTION(mcve_setblocking);
-PHP_FUNCTION(mcve_settimeout);
-PHP_FUNCTION(mcve_verifyconnection);
-PHP_FUNCTION(mcve_verifysslcert);
-PHP_FUNCTION(mcve_maxconntimeout);
-PHP_FUNCTION(mcve_connectionerror);
-PHP_FUNCTION(mcve_deletetrans);
-PHP_FUNCTION(mcve_connect);
-PHP_FUNCTION(mcve_transnew);
-PHP_FUNCTION(mcve_transparam);
-PHP_FUNCTION(mcve_transsend);
-PHP_FUNCTION(mcve_ping);
-PHP_FUNCTION(mcve_responseparam);
-PHP_FUNCTION(mcve_returnstatus);
-PHP_FUNCTION(mcve_returncode);
-PHP_FUNCTION(mcve_transactionssent);
-PHP_FUNCTION(mcve_transactionitem);
-PHP_FUNCTION(mcve_transactionbatch);
-PHP_FUNCTION(mcve_transactionid);
-PHP_FUNCTION(mcve_transactionauth);
-PHP_FUNCTION(mcve_transactionavs);
-PHP_FUNCTION(mcve_transactioncv);
-PHP_FUNCTION(mcve_transactiontext);
-PHP_FUNCTION(mcve_getuserparam);
-PHP_FUNCTION(mcve_monitor);
-PHP_FUNCTION(mcve_transinqueue);
-PHP_FUNCTION(mcve_checkstatus);
-PHP_FUNCTION(mcve_completeauthorizations);
-PHP_FUNCTION(mcve_sale);
-PHP_FUNCTION(mcve_preauth);
-PHP_FUNCTION(mcve_override);
-PHP_FUNCTION(mcve_void);
-PHP_FUNCTION(mcve_preauthcompletion);
-PHP_FUNCTION(mcve_force);
-PHP_FUNCTION(mcve_return);
-PHP_FUNCTION(mcve_iscommadelimited);
-PHP_FUNCTION(mcve_parsecommadelimited);
-PHP_FUNCTION(mcve_getcommadelimited);
-PHP_FUNCTION(mcve_getcell);
-PHP_FUNCTION(mcve_getcellbynum);
-PHP_FUNCTION(mcve_numcolumns);
-PHP_FUNCTION(mcve_numrows);
-PHP_FUNCTION(mcve_getheader);
-PHP_FUNCTION(mcve_destroyengine);
-PHP_FUNCTION(mcve_settle);
-PHP_FUNCTION(mcve_qc);
-PHP_FUNCTION(mcve_gut);
-PHP_FUNCTION(mcve_gft);
-PHP_FUNCTION(mcve_ub);
-PHP_FUNCTION(mcve_gl);
-PHP_FUNCTION(mcve_chkpwd);
-PHP_FUNCTION(mcve_bt);
-PHP_FUNCTION(mcve_uwait);
-PHP_FUNCTION(mcve_text_code);
-PHP_FUNCTION(mcve_text_avs);
-PHP_FUNCTION(mcve_text_cv);
-PHP_FUNCTION(mcve_chngpwd);
-PHP_FUNCTION(mcve_listusers);
-PHP_FUNCTION(mcve_adduser);
-PHP_FUNCTION(mcve_enableuser);
-PHP_FUNCTION(mcve_disableuser);
-PHP_FUNCTION(mcve_getuserarg);
-PHP_FUNCTION(mcve_adduserarg);
-PHP_FUNCTION(mcve_deleteusersetup);
-PHP_FUNCTION(mcve_initusersetup);
-PHP_FUNCTION(mcve_deluser);
-PHP_FUNCTION(mcve_edituser);
-PHP_FUNCTION(mcve_liststats);
-#endif /* _PHP_MCVE_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/mcve/tests/001.phpt b/ext/mcve/tests/001.phpt
deleted file mode 100644
index c41eaa18ca..0000000000
--- a/ext/mcve/tests/001.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Check for mcve presence
---SKIPIF--
-<?php if (!extension_loaded("MCVE")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "mcve extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php4/tests/README for further information on
- writing regression tests
-*/
-?>
---EXPECT--
-mcve extension is available
diff --git a/ext/mhash/CREDITS b/ext/mhash/CREDITS
deleted file mode 100644
index 54851e1ac7..0000000000
--- a/ext/mhash/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-mhash
-Sascha Schumann
diff --git a/ext/mhash/config.m4 b/ext/mhash/config.m4
deleted file mode 100644
index e53bd28f61..0000000000
--- a/ext/mhash/config.m4
+++ /dev/null
@@ -1,25 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(mhash, for mhash support,
-[ --with-mhash[=DIR] Include mhash support.])
-
-if test "$PHP_MHASH" != "no"; then
- for i in /usr/local /usr /opt/mhash $PHP_MHASH; do
- if test -f $i/include/mhash.h; then
- MHASH_DIR=$i
- fi
- done
-
- if test -z "$MHASH_DIR"; then
- AC_MSG_ERROR(Please reinstall libmhash - I cannot find mhash.h)
- fi
- PHP_ADD_INCLUDE($MHASH_DIR/include)
- PHP_ADD_LIBRARY_WITH_PATH(mhash, $MHASH_DIR/lib, MHASH_SHARED_LIBADD)
- PHP_SUBST(MHASH_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_LIBMHASH,1,[ ])
-
- PHP_NEW_EXTENSION(mhash, mhash.c, $ext_shared)
-fi
diff --git a/ext/mhash/mhash.c b/ext/mhash/mhash.c
deleted file mode 100644
index 7be388bd16..0000000000
--- a/ext/mhash/mhash.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- | Nikos Mavroyanopoulos <nmav@hellug.gr> (HMAC, KEYGEN) |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_LIBMHASH
-
-#include "fcntl.h"
-#include "php_mhash.h"
-#include "mhash.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-
-function_entry mhash_functions[] = {
- PHP_FE(mhash_get_block_size, NULL)
- PHP_FE(mhash_get_hash_name, NULL)
- PHP_FE(mhash_keygen_s2k, NULL)
- PHP_FE(mhash_count, NULL)
- PHP_FE(mhash, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry mhash_module_entry = {
- STANDARD_MODULE_HEADER,
- "mhash",
- mhash_functions,
- PHP_MINIT(mhash), NULL,
- NULL, NULL,
- PHP_MINFO(mhash),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES,
-};
-
-#ifdef COMPILE_DL_MHASH
-ZEND_GET_MODULE(mhash)
-#endif
-
-/* SALTED S2K uses a fixed salt */
-#define SALT_SIZE 8
-
-PHP_MINIT_FUNCTION(mhash)
-{
- int i, n, l;
- char *name;
- char buf[128];
-
- n = mhash_count() + 1;
-
- for (i=0; i<n; i++) {
- if ((name = mhash_get_hash_name(i))) {
- l = snprintf(buf, 127, "MHASH_%s", name);
- zend_register_long_constant(buf, l + 1, i, CONST_PERSISTENT, module_number TSRMLS_CC);
- free(name);
- }
- }
-
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(mhash)
-{
- char version[32];
-
- sprintf(version,"%d", MHASH_API_VERSION);
-
- php_info_print_table_start();
- php_info_print_table_row(2, "MHASH support", "Enabled");
- php_info_print_table_row(2, "MHASH API Version", version);
- php_info_print_table_end();
-}
-
-/* {{{ proto int mhash_count(void)
- Gets the number of available hashes */
-PHP_FUNCTION(mhash_count)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_LONG(mhash_count());
-}
-
-/* }}} */
-
-/* {{{ proto int mhash_get_block_size(int hash)
- Gets the block size of hash */
-PHP_FUNCTION(mhash_get_block_size)
-{
- long hash;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &hash) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_LONG(mhash_get_block_size(hash));
-}
-
-/* }}} */
-
-/* {{{ proto string mhash_get_hash_name(int hash)
- Gets the name of hash */
-PHP_FUNCTION(mhash_get_hash_name)
-{
- char *name;
- long hash;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &hash) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- name = mhash_get_hash_name(hash);
- if (name) {
- RETVAL_STRING(name, 1);
- free(name);
- } else {
- RETVAL_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto string mhash(int hash, string data [, string key])
- Hash data with hash */
-PHP_FUNCTION(mhash)
-{
- MHASH td;
- int bsize;
- unsigned char *hash_data;
- long hash;
- int data_len, key_len=0;
- char *data, *key=NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls|s", &hash, &data, &data_len, &key, &key_len) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- bsize = mhash_get_block_size(hash);
-
- if (key_len) {
- if (mhash_get_hash_pblock(hash) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "mhash initialization failed");
- RETURN_FALSE;
- }
- td = mhash_hmac_init(hash, key, key_len, mhash_get_hash_pblock(hash));
- } else {
- td = mhash_init(hash);
- }
-
- if (td == MHASH_FAILED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "mhash initialization failed");
- RETURN_FALSE;
- }
-
- mhash(td, data, data_len);
-
- if (key_len) {
- hash_data = (unsigned char *) mhash_hmac_end(td);
- } else {
- hash_data = (unsigned char *) mhash_end(td);
- }
-
- if (hash_data) {
- RETVAL_STRINGL(hash_data, bsize, 1);
- mhash_free(hash_data);
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto string mhash_keygen_s2k(int hash, string input_password, string salt, int bytes)
- Generates a key using hash functions */
-PHP_FUNCTION(mhash_keygen_s2k)
-{
- KEYGEN keystruct;
- char salt[SALT_SIZE], *ret;
- long hash, bytes;
- char *password, *in_salt;
- int password_len, salt_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lssl", &hash, &password, &password_len, &in_salt, &salt_len, &bytes) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (bytes <= 0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "the byte parameter must be greater then 0");
- RETURN_FALSE;
- }
-
- salt_len = MIN(salt_len, SALT_SIZE);
-
- if (salt_len > mhash_get_keygen_salt_size(KEYGEN_S2K_SALTED)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "The specified salt [%d] is more bytes than the required by the algorithm [%d]\n",
- salt_len, mhash_get_keygen_salt_size(KEYGEN_S2K_SALTED));
- }
-
- memcpy(salt, in_salt, salt_len);
- if (salt_len < SALT_SIZE) {
- memset(salt + salt_len, 0, SALT_SIZE - salt_len);
- }
- salt_len = SALT_SIZE;
-
- keystruct.hash_algorithm[0] = hash;
- keystruct.hash_algorithm[1] = hash;
- keystruct.count = 0;
- keystruct.salt = salt;
- keystruct.salt_size = salt_len;
-
- ret = emalloc(bytes + 1);
-
- if (mhash_keygen_ext(KEYGEN_S2K_SALTED, keystruct, ret, bytes, password, password_len) >= 0) {
- ret[bytes] = '\0';
- RETVAL_STRINGL(ret, bytes, 0);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "mhash key generation failed");
- efree(ret);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/mhash/mhash.dsp b/ext/mhash/mhash.dsp
deleted file mode 100644
index 12525935d8..0000000000
--- a/ext/mhash/mhash.dsp
+++ /dev/null
@@ -1,115 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mhash" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mhash - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mhash.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mhash.mak" CFG="mhash - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mhash - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mhash - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mhash - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_MHASH" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /D "WIN32" /D "MHASH_EXPORTS" /D "COMPILE_DL_MHASH" /D HAVE_LIBMHASH=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZTS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib libmhash.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mhash.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "mhash - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_MHASH" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MHASH_EXPORTS" /D "COMPILE_DL_MHASH" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MHASH=1 /D ZTS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib libmhash.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_mhash.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "mhash - Win32 Release_TS"
-# Name "mhash - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mhash.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mhash.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/mhash/php_mhash.h b/ext/mhash/php_mhash.h
deleted file mode 100644
index c92a47cee7..0000000000
--- a/ext/mhash/php_mhash.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef PHP_MHASH_H
-#define PHP_MHASH_H
-
-#if HAVE_LIBMHASH
-
-#if PHP_API_VERSION < 19990421
-#define zend_module_entry zend_module_entry
-#include "zend_modules.h"
-#include "internal_functions.h"
-#endif
-
-extern zend_module_entry mhash_module_entry;
-#define mhash_module_ptr &mhash_module_entry
-
-PHP_MINIT_FUNCTION(mhash);
-PHP_MINFO_FUNCTION(mhash);
-PHP_FUNCTION(mhash_get_block_size);
-PHP_FUNCTION(mhash_get_hash_name);
-PHP_FUNCTION(mhash_count);
-PHP_FUNCTION(mhash_keygen_s2k);
-PHP_FUNCTION(mhash);
-
-#else
-#define mhash_module_ptr NULL
-#endif
-
-#define phpext_mhash_ptr mhash_module_ptr
-
-#endif
diff --git a/ext/mhash/tests/001.phpt b/ext/mhash/tests/001.phpt
deleted file mode 100644
index 13c16a2263..0000000000
--- a/ext/mhash/tests/001.phpt
+++ /dev/null
@@ -1,74 +0,0 @@
---TEST--
-mhash() test
---INI--
-magic_quotes_runtime=0
---SKIPIF--
-<?php
- include "skip.inc";
-?>
---FILE--
-<?php
-
-$supported_hash_al = array(
-"MHASH_MD5" => "-›Û‘ùN–ÙÄâ®S*Ì“j",
-"MHASH_SHA1" => "/“AåZƒíõI{ø;£Û*}à£",
-"MHASH_HAVAL256" => "²Uþÿ­d'5Ǜƕ¡ü¥;Ýýúñ ²u’‡“¯",
-"MHASH_HAVAL192" => "Lè7ÞH0 *²Æp”Ɉß×ÛÍ",
-"MHASH_HAVAL224" => "SbÑ…gR¿,›²Öý×r¹ÅÈÎ^È&•&K…á",
-"MHASH_HAVAL160" => "Ƴo‡u Wi¼´ò\"q”{ùË",
-"MHASH_RIPEMD160" => "lGCZ¡ÓYķƯF4Ÿ\x0C>XX=",
-"MHASH_GOST" => "\x0A%Rνõ|­ñQGòU¶C)5»œ,Çâ‹-ž",
-"MHASH_TIGER" => "ý¹šyÃ:•g~ —«®‘ë
-à 0T»\9",
-"MHASH_CRC32" => "ƒ¸",
-"MHASH_CRC32B" => "¤·Zß"
-);
-
-$data = "This is the test of the mhash extension...";
-
-foreach ($supported_hash_al as $hash=>$wanted) {
- $result = mhash(constant($hash), $data);
- if ($result==$wanted) {
- echo "$hash\nok\n";
- } else {
- echo "$hash: ";
- var_dump($wanted);
- echo "$hash: ";
- var_dump($result);
- }
- echo "\n";
-}
-?>
---EXPECT--
-MHASH_MD5
-ok
-
-MHASH_SHA1
-ok
-
-MHASH_HAVAL256
-ok
-
-MHASH_HAVAL192
-ok
-
-MHASH_HAVAL224
-ok
-
-MHASH_HAVAL160
-ok
-
-MHASH_RIPEMD160
-ok
-
-MHASH_GOST
-ok
-
-MHASH_TIGER
-ok
-
-MHASH_CRC32
-ok
-
-MHASH_CRC32B
-ok
diff --git a/ext/mhash/tests/002.phpt b/ext/mhash/tests/002.phpt
deleted file mode 100644
index 6f89bc2272..0000000000
--- a/ext/mhash/tests/002.phpt
+++ /dev/null
@@ -1,64 +0,0 @@
---TEST--
-mhash_get_block_size() & mhash_get_hash_name() test
---SKIPIF--
-<?php
- include "skip.inc";
-?>
---FILE--
-<?php
-$supported_hash_al = array(
-"MD5" => 16,
-"MD4" => 16,
-"SHA1" => 20,
-"SHA256" => 32,
-"HAVAL256" => 32,
-"HAVAL192" => 24,
-"HAVAL224" => 28,
-"HAVAL160" => 20,
-"HAVAL128" => 16,
-"RIPEMD160" => 20,
-"GOST" => 32,
-"TIGER" => 24,
-"TIGER160" => 20,
-"TIGER128" => 16,
-"CRC32" => 4,
-"CRC32B" => 4,
-"ADLER32" => 4,
-"NA_XYZ" => 0 /* verify that the algorythm works */
-);
-
-$hc = mhash_count() + 1;
-
-$known_hash_al = array();
-for ($i=0; $i < $hc; $i++) {
- $known_hash_al[mhash_get_hash_name($i)] = $i;
-}
-
-foreach ($supported_hash_al as $name => $len) {
- if (array_key_exists($name, $known_hash_al)) {
- $len = mhash_get_block_size($known_hash_al[$name]);
- echo "$name = $len\n";
- } else {
- echo "$name ? $len\n";
- }
-}
-?>
---EXPECTREGEX--
-MD5 . 16
-MD4 . 16
-SHA1 . 20
-SHA256 . 32
-HAVAL256 . 32
-HAVAL192 . 24
-HAVAL224 . 28
-HAVAL160 . 20
-HAVAL128 . 16
-RIPEMD160 . 20
-GOST . 32
-TIGER . 24
-TIGER160 . 20
-TIGER128 . 16
-CRC32 . 4
-CRC32B . 4
-ADLER32 . 4
-NA_XYZ . 0
diff --git a/ext/mhash/tests/003.phpt b/ext/mhash/tests/003.phpt
deleted file mode 100644
index e5995f2a02..0000000000
--- a/ext/mhash/tests/003.phpt
+++ /dev/null
@@ -1,73 +0,0 @@
---TEST--
-mhash_keygen_s2k() test
---SKIPIF--
-<?php
- include "skip.inc";
-?>
---FILE--
-<?php
-
-$supported_hash_al = array(
-"MHASH_MD5" => "†\x15N¯”2Íé4z¡P”¹ÀFë\x06æ ”\x0CTyªzcg®hµààt^W\x09þÞ-Ÿésš­A7Yú§:Ìí‚\x10w´Ý²x€dãqëS³©Õ^Òƒš«&UÈ,þÛè: „aÇ™Ù×zä\x06\x1CS›\x01",
-"MHASH_SHA1" => "Ý1\\p\x06\x1D\x07E]SÂû\x0B\x08ß\x0Caªf\\\x1A±§\x01ú\x10•T#\$‹¨2¥­ä\x06³›xc\x0Aº=\x16ˆæ\"IJ\x0E®'NΚԽ÷n‡Ë\x08J3É\x15<+H\x13\x1D0§[\x00§À[‘ñÿê¿Y»\x12qÄØ¡\x19¸K¯mI",
-"MHASH_HAVAL256" => "ÞG\x00Ÿ‡Õé¢NÏPwÖ\x0CH6W¥Ù„«+·€õ‡,Êö\x1C\x0DgdZ„ŽUþá\x07)oAiÉ[Nað®îú²d…TÁ\x17\x1F°¢ü2ªZîÓÕÁUÓ46}IYb,ÚÞþC®\x17½\x1AuùÔþ÷{ñ’¾[x",
-"MHASH_HAVAL224" => "\\Jÿ=‚ZÖ\x08ö\x08Èêçyî8ha Æ\x0A˜ó×p³¦g|yÂÚÜ«qÝàÀ\x19\x1E\x06ƒ—«)
-å˼l¼ÐÇŒ¨G\x0CB@kwèºQ“ù‚v52O¸P¬-0·5\x00L m`G-2ÃI",
-"MHASH_HAVAL192" => "\"àÂq&\x02<….ùA\x07»/\x1Eá2°d\x17‹Ëû\x1C2æXv\x0Bp½Å±Å%™\x03\x16(ÂC;î+\x08p«z8®²\x12\x15\x13NÁ\x08‰u¹©d‡d)qïž³Ù‡ºùv_ÙæÖMINª„¯çà xLt—žº±Ç‡",
-"MHASH_HAVAL160" => "Öåðï\x07óúÌídní¶6GXìÞmÆû\x06\x1E\x00¤–õη#÷Ž¡5ˆM–‚\"míiÁ\x1D„1\$\x0Eù|­X<O)Y;¿=ÓÊ°¸y.³Ø`\"Ê`\x02ëÐÙ´B™ Ô¯…¾Òµ©k>G¹¸ÊÉ\x19Á\x17~Ä\x0D~",
-"MHASH_RIPEMD160" => "äÕÛFšòŸxâ¹\x0DÇ5ÉÏ\x02\x0a\x1D[\x19¦gDXgw”ÔÜ¡DÔ&Åb¯ùŽ†jŠ’B™ëö°êš7ù‡¡û]é¶GíÃ[\x14G`^\x1B«Ã\x08Kç “\x11\x17ë3C-ABâ%ß\x04K\x03??öK´¡†‚¤ù",
-"MHASH_GOST" => "ÀDöi½~†C•=wÆ‚ý\x17’BÙß\x15}­øs¾M–\x01äd|\x01‚4h“Yç\"\x0A°I*b@Ñ„Äxc@sÞ¨y¾†ýN%d÷×\x09¶ŠFD\x0a\x12\x12Pà\x0FÇÕ}E©À~â:pOôŒ\x0D­pwìR{\x19M‡",
-"MHASH_TIGER" => "gêÉ{Ê\nG±ö&/3däÎ#7`þ2UöBQ/Óy)ºÌñçX#k'h¤ÂÀÀn‹ä/¥÷E‚¸©›ÛÀ˜p*M1 VÄÉKÚyºO`Õ ×ø•M¨¢——6Ô|\"ª",
-"MHASH_CRC32" => "H@Œ&_šYïèoQÅÒÐ1[Fq\"®\x08ÁÌÝfŸéVÈ8\x08ã¥EöîE<¤™M¼:Ⱥ…¥r„ðk*±HœÚu±è/}›ßÛh3iW»ñžJ?vu
-i…¥=ÕW\"üó",
-"MHASH_CRC32B" => "µl«e¦>}û*©]¶F×›6\x13ŠbCÍË. I¯\x0F–jœÎ¥0ÐÛ\x0D\x1F<˜Æ.Qyç–¾¶tiý°xbØ\$}ƒ\x0Bõ˜È´“ ×ϬȌDÅDK…\x13é1uLðÝ6§¡`÷æÉ|Ecñ\x04°",
-);
-
-foreach ($supported_hash_al as $hash=>$wanted) {
- $passwd = str_repeat($hash, 10);
- $salt = str_repeat($hash, 2);
- $result = mhash_keygen_s2k(constant($hash), $passwd, $salt, 100);
- if (!strcmp($result, $wanted)) {
- echo "$hash\nok\n";
- } else {
- echo "$hash: ";
- var_dump(bin2hex($wanted));
- echo "$hash: ";
- var_dump(bin2hex($result));
- }
- echo "\n";
-}
-?>
---EXPECT--
-MHASH_MD5
-ok
-
-MHASH_SHA1
-ok
-
-MHASH_HAVAL256
-ok
-
-MHASH_HAVAL224
-ok
-
-MHASH_HAVAL192
-ok
-
-MHASH_HAVAL160
-ok
-
-MHASH_RIPEMD160
-ok
-
-MHASH_GOST
-ok
-
-MHASH_TIGER
-ok
-
-MHASH_CRC32
-ok
-
-MHASH_CRC32B
-ok
diff --git a/ext/mhash/tests/skip.inc b/ext/mhash/tests/skip.inc
deleted file mode 100644
index 81912d21c8..0000000000
--- a/ext/mhash/tests/skip.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-if (!extension_loaded("mhash")) {
- die("skip mhash extension is not avaliable");
-}
-?> \ No newline at end of file
diff --git a/ext/mime_magic/CREDITS b/ext/mime_magic/CREDITS
deleted file mode 100644
index ce54609ecc..0000000000
--- a/ext/mime_magic/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-mime_magic
-Hartmut Holzgraefe
diff --git a/ext/mime_magic/EXPERIMENTAL b/ext/mime_magic/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/mime_magic/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/mime_magic/TODO b/ext/mime_magic/TODO
deleted file mode 100644
index 1ea9c17745..0000000000
--- a/ext/mime_magic/TODO
+++ /dev/null
@@ -1,3 +0,0 @@
-- general cleanup
-- support for content-encoding / compressed files
-- nuke all TSRMLS_FETCH() calls where possible
diff --git a/ext/mime_magic/config.m4 b/ext/mime_magic/config.m4
deleted file mode 100644
index b47b1ba97b..0000000000
--- a/ext/mime_magic/config.m4
+++ /dev/null
@@ -1,37 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(mime-magic, whether to include mime_magic support,
-[ --with-mime-magic[=FILE] Include mime_magic support. FILE is the optional
- pathname to the magic.mime file.])
-
-if test "$PHP_MIME_MAGIC" != "no"; then
-
- PHP_NEW_EXTENSION(mime_magic, mime_magic.c, $ext_shared)
-
- PHP_MIME_MAGIC_FILE_PATH=
-
- dnl
- dnl Try to see if we can find the path of the magic file in its default locations.
- dnl
- if test "$PHP_MIME_MAGIC" != "yes"; then
- if test -f $PHP_MIME_MAGIC; then
- PHP_MIME_MAGIC_FILE_PATH=$PHP_MIME_MAGIC
- else
- AC_MSG_ERROR([File '$PHP_MIME_MAGIC' not found!])
- fi
- else
- MAGIC_MIME_LOCATIONS="/usr/local/apache/conf/magic /usr/local/etc/apache/conf/magic /etc/apache/magic /etc/httpd/conf/magic /usr/share/magic.mime /usr/share/misc/magic.mime /etc/magic.mime"
-
- for i in $MAGIC_MIME_LOCATIONS; do
- if test -f $i; then
- PHP_MIME_MAGIC_FILE_PATH=$i
- break
- fi
- done
- fi
-
- AC_DEFINE_UNQUOTED(PHP_MIME_MAGIC_FILE_PATH,"$PHP_MIME_MAGIC_FILE_PATH",[magic file path])
-
-fi
diff --git a/ext/mime_magic/mime_magic.c b/ext/mime_magic/mime_magic.c
deleted file mode 100644
index 7df87f1f6f..0000000000
--- a/ext/mime_magic/mime_magic.c
+++ /dev/null
@@ -1,1909 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
-
- $Id$
-
- This module contains a lot of stuff taken from Apache mod_mime_magic,
- so the license section is a little bit longer than usual:
-
- ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
- */
-
-/*
- * mod_mime_magic: MIME type lookup via file magic numbers
- * Copyright (c) 1996-1997 Cisco Systems, Inc.
- *
- * This software was submitted by Cisco Systems to the Apache Group in July
- * 1997. Future revisions and derivatives of this source code must
- * acknowledge Cisco Systems as the original contributor of this module.
- * All other licensing and usage conditions are those of the Apache Group.
- *
- * Some of this code is derived from the free version of the file command
- * originally posted to comp.sources.unix. Copyright info for that program
- * is included below as required.
- * ---------------------------------------------------------------------------
- * - Copyright (c) Ian F. Darwin, 1987. Written by Ian F. Darwin.
- *
- * This software is not subject to any license of the American Telephone and
- * Telegraph Company or of the Regents of the University of California.
- *
- * Permission is granted to anyone to use this software for any purpose on any
- * computer system, and to alter it and redistribute it freely, subject to
- * the following restrictions:
- *
- * 1. The author is not responsible for the consequences of use of this
- * software, no matter how awful, even if they arise from flaws in it.
- *
- * 2. The origin of this software must not be misrepresented, either by
- * explicit claim or by omission. Since few users ever read sources, credits
- * must appear in the documentation.
- *
- * 3. Altered versions must be plainly marked as such, and must not be
- * misrepresented as being the original software. Since few users ever read
- * sources, credits must appear in the documentation.
- *
- * 4. This notice may not be removed or altered.
- * -------------------------------------------------------------------------
- *
- * For compliance with Mr Darwin's terms: this has been very significantly
- * modified from the free "file" command.
- * - all-in-one file for compilation convenience when moving from one
- * version of Apache to the next.
- * - Memory allocation is done through the Apache API's pool structure.
- * - All functions have had necessary Apache API request or server
- * structures passed to them where necessary to call other Apache API
- * routines. (i.e. usually for logging, files, or memory allocation in
- * itself or a called function.)
- * - struct magic has been converted from an array to a single-ended linked
- * list because it only grows one record at a time, it's only accessed
- * sequentially, and the Apache API has no equivalent of realloc().
- * - Functions have been changed to get their parameters from the server
- * configuration instead of globals. (It should be reentrant now but has
- * not been tested in a threaded environment.)
- * - Places where it used to print results to stdout now saves them in a
- * list where they're used to set the MIME type in the Apache request
- * record.
- * - Command-line flags have been removed since they will never be used here.
- *
- * Ian Kluft <ikluft@cisco.com>
- * Engineering Information Framework
- * Central Engineering
- * Cisco Systems, Inc.
- * San Jose, CA, USA
- *
- * Initial installation July/August 1996
- * Misc bug fixes May 1997
- * Submission to Apache Group July 1997
- *
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_streams.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_mime_magic.h"
-
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef PHP_WIN32
-#define PHP_MIME_MAGIC_FILE_PATH PHP_PREFIX "\\magic.mime"
-#endif
-
-static int apprentice(void);
-static int ascmagic(unsigned char *, int);
-static int is_tar(unsigned char *, int);
-static int softmagic(unsigned char *, int);
-static void tryit(unsigned char *, int, int);
-
-static int getvalue(struct magic *, char **);
-static int hextoint(int);
-static char *getstr(char *, char *, int, int *);
-static int parse(char *, int);
-
-static int match(unsigned char *, int);
-static int mget(union VALUETYPE *, unsigned char *,
- struct magic *, int);
-static int mcheck(union VALUETYPE *, struct magic *);
-static void mprint(union VALUETYPE *, struct magic *);
-static int mconvert(union VALUETYPE *, struct magic *);
-static int magic_rsl_get(char **, char **);
-static int magic_process(char * TSRMLS_DC);
-
-static long from_oct(int, char *);
-static int fsmagic(char *fn TSRMLS_DC);
-
-
-#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
-static int zmagic(unsigned char *, int);
-#endif
-
-static magic_req_rec *magic_set_config(void);
-static void magic_free_config(magic_req_rec *);
-
-ZEND_DECLARE_MODULE_GLOBALS(mime_magic)
-
-
-/* True global resources - no need for thread safety here */
-static magic_server_config_rec mime_global;
-
-/* {{{ mime_magic_functions[] */
-function_entry mime_magic_functions[] = {
- PHP_FE(mime_content_type, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ mime_magic_module_entry
- */
-zend_module_entry mime_magic_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
- "mime_magic",
- mime_magic_functions,
- PHP_MINIT(mime_magic),
- PHP_MSHUTDOWN(mime_magic),
- NULL,
- NULL,
- PHP_MINFO(mime_magic),
-#if ZEND_MODULE_API_NO >= 20010901
- "0.1",
-#endif
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_MIME_MAGIC
-ZEND_GET_MODULE(mime_magic)
-#endif
-
-/* {{{ PHP_INI
- */
-PHP_INI_BEGIN()
-STD_PHP_INI_ENTRY("mime_magic.magicfile", PHP_MIME_MAGIC_FILE_PATH, PHP_INI_SYSTEM, OnUpdateString, magicfile, zend_mime_magic_globals, mime_magic_globals)
-STD_PHP_INI_ENTRY("mime_magic.debug", "0", PHP_INI_SYSTEM, OnUpdateBool, debug, zend_mime_magic_globals, mime_magic_globals)
-PHP_INI_END()
-/* }}} */
-
-/* {{{ php_mime_magic_init_globals
- */
-static void php_mime_magic_init_globals(zend_mime_magic_globals *mime_magic_globals)
-{
- mime_global.magicfile = NULL;
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(mime_magic)
-{
- ZEND_INIT_MODULE_GLOBALS(mime_magic, php_mime_magic_init_globals, NULL);
- REGISTER_INI_ENTRIES();
-
- mime_global.magicfile = MIME_MAGIC_G(magicfile);
-
- if(mime_global.magicfile) {
- if(apprentice()) {
- MIME_MAGIC_G(status) = "invalid magic file, disabled";
- } else {
- MIME_MAGIC_G(status) = "enabled";
- }
- } else {
- MIME_MAGIC_G(status) = "no magic file given, disabled";
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(mime_magic)
-{
- UNREGISTER_INI_ENTRIES();
- if (mime_global.magic != NULL && mime_global.magic != (struct magic *) -1) {
- struct magic *iter = mime_global.magic;
- while (iter != NULL) {
- struct magic *iter_next = iter->next;
- free(iter);
- iter = iter_next;
- }
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(mime_magic)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "mime_magic support", MIME_MAGIC_G(status));
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-/* }}} */
-
-
-/* {{{ proto string mime_content_type(string filename)
- Return content-type for file */
-PHP_FUNCTION(mime_content_type)
-{
- char *filename = NULL;
- int filename_len;
- magic_server_config_rec *conf = &mime_global;
- char *content_type=NULL, *content_encoding=NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
- return;
- }
-
- if (conf->magic == (struct magic *)-1) {
- if(MIME_MAGIC_G(debug))
- php_error_docref("http://www.php.net/mime_magic" TSRMLS_CC, E_ERROR, "mime_magic could not be initialized, magic file %s is not avaliable", conf->magicfile);
- RETURN_FALSE;
- }
-
- if(!conf->magic) {
- if(MIME_MAGIC_G(debug))
- php_error_docref("http://www.php.net/mime_magic" TSRMLS_CC, E_WARNING, "mime_magic not initialized");
- RETURN_FALSE;
- }
-
- MIME_MAGIC_G(req_dat) = magic_set_config();
-
- if(MIME_MAGIC_OK != magic_process(filename TSRMLS_CC)) {
- RETVAL_FALSE;
- } else if(MIME_MAGIC_OK != magic_rsl_get(&content_type, &content_encoding)) {
- RETVAL_FALSE;
- } else {
- RETVAL_STRING(content_type, 1);
- }
-
- if(content_type) efree(content_type);
- if(content_encoding) efree(content_encoding);
-
- magic_free_config(MIME_MAGIC_G(req_dat));
-}
-/* }}} */
-
-#define EATAB {while (isspace((unsigned char) *l)) ++l;}
-
-/*
- * apprentice - load configuration from the magic file r
- * API request record
- */
-static int apprentice(void)
-{
- FILE *f;
- char line[BUFSIZ + 1];
- int errs = 0;
- int lineno;
- char *fname;
- magic_server_config_rec *conf = &mime_global;
- TSRMLS_FETCH();
-
- fname = conf->magicfile; /* todo cwd? */
- f = fopen(fname, "rb");
- if (f == NULL) {
- conf->magic = (struct magic *)-1;
- return -1;
- }
-
- /* set up the magic list (empty) */
- conf->magic = conf->last = NULL;
-
- /* parse it */
- for (lineno = 1; fgets(line, BUFSIZ, f) != NULL; lineno++) {
- int ws_offset;
-
- /* delete newline */
- if (line[0]) {
- line[strlen(line) - 1] = '\0';
- }
-
- /* skip leading whitespace */
- ws_offset = 0;
- while (line[ws_offset] && isspace(line[ws_offset])) {
- ws_offset++;
- }
-
- /* skip blank lines */
- if (line[ws_offset] == 0) {
- continue;
- }
-
- /* comment, do not parse */
- if (line[ws_offset] == '#')
- continue;
-
- /* parse it */
- if (parse(line + ws_offset, lineno) != 0)
- ++errs;
-
- if(errs && !MIME_MAGIC_G(debug))
- break;
- }
-
- (void) fclose(f);
-
- return (errs ? -1 : 0);
-}
-
-/*
- * extend the sign bit if the comparison is to be signed
- */
-static unsigned long signextend(struct magic *m, unsigned long v)
-{
- if (!(m->flag & UNSIGNED))
- switch (m->type) {
- /*
- * Do not remove the casts below. They are vital. When later
- * compared with the data, the sign extension must have happened.
- */
- case BYTE:
- v = (char) v;
- break;
- case SHORT:
- case BESHORT:
- case LESHORT:
- v = (short) v;
- break;
- case DATE:
- case BEDATE:
- case LEDATE:
- case LONG:
- case BELONG:
- case LELONG:
- v = (long) v;
- break;
- case STRING:
- break;
- default:
- {
- TSRMLS_FETCH();
- if(MIME_MAGIC_G(debug))
- php_error_docref("http://www.php.net/mime_magic" TSRMLS_CC, E_WARNING, ": can't happen: m->type=%d", m->type);
- return -1;
- }
- }
- return v;
-}
-
-/*
- *
- */
-static int is_valid_mimetype(char *p)
-{
- do {
- if(!isalnum(*p) && (*p != '-')) return 0;
- } while(*(++p) != '/');
- ++p;
- do {
- if(!isalnum(*p) && (*p != '-')) return 0;
- } while(*(++p));
- return 1;
-}
-
-/*
- * parse one line from magic file, put into magic[index++] if valid
- */
-static int parse(char *l, int lineno)
-{
- struct magic *m;
- char *t, *s;
- magic_server_config_rec *conf = &mime_global;
- TSRMLS_FETCH();
-
- /* allocate magic structure entry */
- m = (struct magic *) calloc(1, sizeof(struct magic));
-
- /* append to linked list */
- m->next = NULL;
- if (!conf->magic || !conf->last) {
- conf->magic = conf->last = m;
- }
- else {
- conf->last->next = m;
- conf->last = m;
- }
-
- /* set values in magic structure */
- m->flag = 0;
- m->cont_level = 0;
- m->lineno = lineno;
-
- while (*l == '>') {
- ++l; /* step over */
- m->cont_level++;
- }
-
- if (m->cont_level != 0 && *l == '(') {
- ++l; /* step over */
- m->flag |= INDIR;
- }
-
- /* get offset, then skip over it */
- m->offset = (int) strtol(l, &t, 0);
- if (l == t) {
- if(MIME_MAGIC_G(debug))
- php_error_docref("http://www.php.net/mime_magic" TSRMLS_CC, E_WARNING, ": (%s:%d) offset `%s' invalid", MIME_MAGIC_G(magicfile), lineno, l);
- }
- l = t;
-
- if (m->flag & INDIR) {
- m->in.type = LONG;
- m->in.offset = 0;
- /*
- * read [.lbs][+-]nnnnn)
- */
- if (*l == '.') {
- switch (*++l) {
- case 'l':
- m->in.type = LONG;
- break;
- case 's':
- m->in.type = SHORT;
- break;
- case 'b':
- m->in.type = BYTE;
- break;
- default:
- if(MIME_MAGIC_G(debug))
- php_error_docref("http://www.php.net/mime_magic" TSRMLS_CC, E_WARNING, ": (%s:%d) indirect offset type %c invalid", MIME_MAGIC_G(magicfile), lineno, *l);
- break;
- }
- l++;
- }
- s = l;
- if (*l == '+' || *l == '-')
- l++;
- if (isdigit((unsigned char) *l)) {
- m->in.offset = strtol(l, &t, 0);
- if (*s == '-')
- m->in.offset = -m->in.offset;
- }
- else
- t = l;
- if (*t++ != ')') {
- if(MIME_MAGIC_G(debug))
- php_error_docref("http://www.php.net/mime_magic" TSRMLS_CC, E_WARNING, ": (%s:%s) missing ')' in indirect offset", MIME_MAGIC_G(magicfile), lineno);
- }
- l = t;
- }
-
-
- while (isdigit((unsigned char) *l))
- ++l;
- EATAB;
-
-#define NBYTE 4
-#define NSHORT 5
-#define NLONG 4
-#define NSTRING 6
-#define NDATE 4
-#define NBESHORT 7
-#define NBELONG 6
-#define NBEDATE 6
-#define NLESHORT 7
-#define NLELONG 6
-#define NLEDATE 6
-
- if (*l == 'u') {
- ++l;
- m->flag |= UNSIGNED;
- }
-
- /* get type, skip it */
- if (strncmp(l, "byte", NBYTE) == 0) {
- m->type = BYTE;
- l += NBYTE;
- }
- else if (strncmp(l, "short", NSHORT) == 0) {
- m->type = SHORT;
- l += NSHORT;
- }
- else if (strncmp(l, "long", NLONG) == 0) {
- m->type = LONG;
- l += NLONG;
- }
- else if (strncmp(l, "string", NSTRING) == 0) {
- m->type = STRING;
- l += NSTRING;
- }
- else if (strncmp(l, "date", NDATE) == 0) {
- m->type = DATE;
- l += NDATE;
- }
- else if (strncmp(l, "beshort", NBESHORT) == 0) {
- m->type = BESHORT;
- l += NBESHORT;
- }
- else if (strncmp(l, "belong", NBELONG) == 0) {
- m->type = BELONG;
- l += NBELONG;
- }
- else if (strncmp(l, "bedate", NBEDATE) == 0) {
- m->type = BEDATE;
- l += NBEDATE;
- }
- else if (strncmp(l, "leshort", NLESHORT) == 0) {
- m->type = LESHORT;
- l += NLESHORT;
- }
- else if (strncmp(l, "lelong", NLELONG) == 0) {
- m->type = LELONG;
- l += NLELONG;
- }
- else if (strncmp(l, "ledate", NLEDATE) == 0) {
- m->type = LEDATE;
- l += NLEDATE;
- }
- else {
- if(MIME_MAGIC_G(debug))
- php_error_docref("http://www.php.net/mime_magic" TSRMLS_CC, E_WARNING, ": (%s:%d) type %s invalid", MIME_MAGIC_G(magicfile), lineno, l);
- return -1;
- }
- /* New-style anding: "0 byte&0x80 =0x80 dynamically linked" */
- if (*l == '&') {
- ++l;
- m->mask = signextend(m, strtol(l, &l, 0));
- }
- else
- m->mask = ~0L;
- EATAB;
-
- switch (*l) {
- case '>':
- case '<':
- /* Old-style anding: "0 byte &0x80 dynamically linked" */
- case '&':
- case '^':
- case '=':
- m->reln = *l;
- ++l;
- break;
- case '!':
- if (m->type != STRING) {
- m->reln = *l;
- ++l;
- break;
- }
- /* FALL THROUGH */
- default:
- if (*l == 'x' && isspace((unsigned char) l[1])) {
- m->reln = *l;
- ++l;
- goto GetDesc; /* Bill The Cat */
- }
- m->reln = '=';
- break;
- }
- EATAB;
-
- if (getvalue(m, &l))
- return -1;
- /*
- * now get last part - the description
- */
- GetDesc:
- EATAB;
- if (l[0] == '\b') {
- ++l;
- m->nospflag = 1;
- }
- else if ((l[0] == '\\') && (l[1] == 'b')) {
- ++l;
- ++l;
- m->nospflag = 1;
- }
- else
- m->nospflag = 0;
-
- if(!is_valid_mimetype(l)) {
- if(MIME_MAGIC_G(debug))
- php_error_docref("http://www.php.net/mime_magic" TSRMLS_CC, E_WARNING, ": (%s:%d) '%s' is not a valid mimetype, etry skipped", MIME_MAGIC_G(magicfile), lineno, l);
- return -1;
- }
-
- strncpy(m->desc, l, sizeof(m->desc) - 1);
- m->desc[sizeof(m->desc) - 1] = '\0';
-
- return 0;
-}
-
-/*
- * Read a numeric value from a pointer, into the value union of a magic
- * pointer, according to the magic type. Update the string pointer to point
- * just after the number read. Return 0 for success, non-zero for failure.
- */
-static int getvalue(struct magic *m, char **p)
-{
- int slen;
-
- if (m->type == STRING) {
- *p = getstr(*p, m->value.s, sizeof(m->value.s), &slen);
- m->vallen = slen;
- }
- else if (m->reln != 'x')
- m->value.l = signextend(m, strtol(*p, p, 0));
- return 0;
-}
-
-/*
- * Convert a string containing C character escapes. Stop at an unescaped
- * space or tab. Copy the converted version to "p", returning its length in
- * *slen. Return updated scan pointer as function result.
- */
-static char *getstr(register char *s, register char *p,
- int plen, int *slen)
-{
- char *origs = s, *origp = p;
- char *pmax = p + plen - 1;
- register int c;
- register int val;
-
- while ((c = *s++) != '\0') {
- if (isspace((unsigned char) c))
- break;
- if (p >= pmax) {
- TSRMLS_FETCH();
- if(MIME_MAGIC_G(debug))
- php_error_docref("http://www.php.net/mime_magic" TSRMLS_CC, E_WARNING, "string too long: %s", origs);
- break;
- }
- if (c == '\\') {
- switch (c = *s++) {
-
- case '\0':
- goto out;
-
- default:
- *p++ = (char) c;
- break;
-
- case 'n':
- *p++ = '\n';
- break;
-
- case 'r':
- *p++ = '\r';
- break;
-
- case 'b':
- *p++ = '\b';
- break;
-
- case 't':
- *p++ = '\t';
- break;
-
- case 'f':
- *p++ = '\f';
- break;
-
- case 'v':
- *p++ = '\v';
- break;
-
- /* \ and up to 3 octal digits */
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- val = c - '0';
- c = *s++; /* try for 2 */
- if (c >= '0' && c <= '7') {
- val = (val << 3) | (c - '0');
- c = *s++; /* try for 3 */
- if (c >= '0' && c <= '7')
- val = (val << 3) | (c - '0');
- else
- --s;
- }
- else
- --s;
- *p++ = (char) val;
- break;
-
- /* \x and up to 3 hex digits */
- case 'x':
- val = 'x'; /* Default if no digits */
- c = hextoint(*s++); /* Get next char */
- if (c >= 0) {
- val = c;
- c = hextoint(*s++);
- if (c >= 0) {
- val = (val << 4) + c;
- c = hextoint(*s++);
- if (c >= 0) {
- val = (val << 4) + c;
- }
- else
- --s;
- }
- else
- --s;
- }
- else
- --s;
- *p++ = (char) val;
- break;
- }
- }
- else
- *p++ = (char) c;
- }
- out:
- *p = '\0';
- *slen = p - origp;
- return s;
-}
-
-/* Single hex char to int; -1 if not a hex char. */
-static int hextoint(int c)
-{
- if (isdigit((unsigned char) c))
- return c - '0';
- if ((c >= 'a') && (c <= 'f'))
- return c + 10 - 'a';
- if ((c >= 'A') && (c <= 'F'))
- return c + 10 - 'A';
- return -1;
-}
-
-
-/*
- * RSL (result string list) processing routines
- *
- * These collect strings that would have been printed in fragments by file(1)
- * into a list of magic_rsl structures with the strings. When complete,
- * they're concatenated together to become the MIME content and encoding
- * types.
- *
- * return value conventions for these functions: functions which return int:
- * failure = -1, other = result functions which return pointers: failure = 0,
- * other = result
- */
-
-/* allocate a per-request structure and put it in the request record */
-static magic_req_rec *magic_set_config(void)
-{
- magic_req_rec *req_dat = (magic_req_rec *) emalloc(sizeof(magic_req_rec));
-
- req_dat->head = req_dat->tail = (magic_rsl *) NULL;
- return req_dat;
-}
-
-static void magic_free_config(magic_req_rec *req_dat) {
- magic_rsl *curr, *next;
-
- if(!req_dat) return;
-
- curr = req_dat->head;
- while(curr) {
- next = curr->next;
- efree(curr->str);
- efree(curr);
- curr = next;
- }
-
- efree(req_dat);
-}
-
-/* add a string to the result string list for this request */
-/* it is the responsibility of the caller to allocate "str" */
-static int magic_rsl_add(char *str)
-{
- magic_req_rec *req_dat;
- magic_rsl *rsl;
- TSRMLS_FETCH();
-
- req_dat = MIME_MAGIC_G(req_dat);
-
- /* make sure we have a list to put it in */
- if (!req_dat) {
- if(MIME_MAGIC_G(debug))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "request config should not be NULL");
- if (!(req_dat = magic_set_config())) {
- /* failure */
- return -1;
- }
- }
-
- /* allocate the list entry */
- rsl = (magic_rsl *) emalloc(sizeof(magic_rsl));
-
- /* fill it */
- rsl->str = estrdup(str);
- rsl->next = (magic_rsl *) NULL;
-
- /* append to the list */
- if (req_dat->head && req_dat->tail) {
- req_dat->tail->next = rsl;
- req_dat->tail = rsl;
- }
- else {
- req_dat->head = req_dat->tail = rsl;
- }
-
- /* success */
- return 0;
-}
-
-/* RSL hook for puts-type functions */
-static int magic_rsl_puts(char *str)
-{
- return magic_rsl_add(str);
-}
-
-/* RSL hook for printf-type functions */
-static int magic_rsl_printf(char *str,...)
-{
- va_list ap;
-
- char buf[MAXMIMESTRING];
-
- /* assemble the string into the buffer */
- va_start(ap, str);
- vsnprintf(buf, sizeof(buf), str, ap);
- va_end(ap);
-
- /* add the buffer to the list */
- return magic_rsl_add(buf);
-}
-
-/* RSL hook for putchar-type functions */
-static int magic_rsl_putchar(char c)
-{
- char str[2];
-
- /* high overhead for 1 char - just hope they don't do this much */
- str[0] = c;
- str[1] = '\0';
- return magic_rsl_add(str);
-}
-
-/* allocate and copy a contiguous string from a result string list */
-static char *rsl_strdup(int start_frag, int start_pos, int len)
-{
- char *result; /* return value */
- int cur_frag, /* current fragment number/counter */
- cur_pos, /* current position within fragment */
- res_pos; /* position in result string */
- magic_rsl *frag; /* list-traversal pointer */
- magic_req_rec *req_dat;
- TSRMLS_FETCH();
-
- req_dat = MIME_MAGIC_G(req_dat);
-
- /* allocate the result string */
- result = (char *) emalloc(len + 1);
-
- /* loop through and collect the string */
- res_pos = 0;
- for (frag = req_dat->head, cur_frag = 0;
- frag->next;
- frag = frag->next, cur_frag++) {
- /* loop to the first fragment */
- if (cur_frag < start_frag)
- continue;
-
- /* loop through and collect chars */
- for (cur_pos = (cur_frag == start_frag) ? start_pos : 0;
- frag->str[cur_pos];
- cur_pos++) {
- if (cur_frag >= start_frag
- && cur_pos >= start_pos
- && res_pos <= len) {
- result[res_pos++] = frag->str[cur_pos];
- if (res_pos > len) {
- break;
- }
- }
- }
- }
-
- /* clean up and return */
- result[res_pos] = 0;
-
- return result;
-}
-
-/*
- * magic_process - process input file r Apache API request record
- * (formerly called "process" in file command, prefix added for clarity) Opens
- * the file and reads a fixed-size buffer to begin processing the contents.
- */
-static int magic_process(char *filename TSRMLS_DC)
-{
- php_stream *stream;
- unsigned char buf[HOWMANY + 1]; /* one extra for terminating '\0' */
- int nbytes = 0; /* number of bytes read from a datafile */
- int result;
-
- /*
- * first try judging the file based on its filesystem status
- */
- switch ((result = fsmagic(filename TSRMLS_CC))) {
- case MIME_MAGIC_DONE:
- magic_rsl_putchar('\n');
- return MIME_MAGIC_OK;
- case MIME_MAGIC_OK:
- break;
- default:
- /* fatal error, bail out */
- return result;
- }
-
- stream = php_stream_open_wrapper(filename, "rb", IGNORE_PATH | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
-
- if (stream == NULL) {
- /* We can't open it, but we were able to stat it. */
- if(MIME_MAGIC_G(debug))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "can't read `%s'", filename);
- /* let some other handler decide what the problem is */
- return MIME_MAGIC_DECLINED;
- }
-
- /*
- * try looking at the first HOWMANY bytes
- */
- if ((nbytes = php_stream_read(stream, (char *) buf, sizeof(buf) - 1)) == -1) {
- if(MIME_MAGIC_G(debug))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "read failed: %s", filename);
- return MIME_MAGIC_ERROR;
- }
-
- if (nbytes == 0)
- magic_rsl_puts(MIME_TEXT_UNKNOWN);
- else {
- buf[nbytes++] = '\0'; /* null-terminate it */
- tryit(buf, nbytes, 1);
- }
-
- (void) php_stream_close(stream);
- (void) magic_rsl_putchar('\n');
-
- return MIME_MAGIC_OK;
-}
-
-static void tryit(unsigned char *buf, int nb, int checkzmagic)
-{
- /*
- * Try compression stuff
- */
-#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
- if (checkzmagic == 1) {
- if (zmagic(buf, nb) == 1)
- return;
- }
-#endif
-
- /*
- * try tests in /etc/magic (or surrogate magic file)
- */
- if (softmagic(buf, nb) == 1)
- return;
-
- /*
- * try known keywords, check for ascii-ness too.
- */
- if (ascmagic(buf, nb) == 1)
- return;
-
- /*
- * abandon hope, all ye who remain here
- */
- magic_rsl_puts(MIME_BINARY_UNKNOWN);
-}
-
-
-/*
- * return MIME_MAGIC_DONE to indicate it's been handled
- * return MIME_MAGIC_OK to indicate it's a regular file still needing handling
- * other returns indicate a failure of some sort
- */
-static int fsmagic(char *filename TSRMLS_DC)
-{
- php_stream_statbuf stat_ssb;
-
- if(!php_stream_stat_path(filename, &stat_ssb)) {
- return MIME_MAGIC_OK;
- }
-
- switch (stat_ssb.sb.st_mode & S_IFMT) {
- case S_IFDIR:
- magic_rsl_puts(DIR_MAGIC_TYPE);
- return MIME_MAGIC_DONE;
- case S_IFCHR:
- /*
- * (void) magic_rsl_printf(r,"character special (%d/%d)",
- * major(sb->st_rdev), minor(sb->st_rdev));
- */
- (void) magic_rsl_puts(MIME_BINARY_UNKNOWN);
- return MIME_MAGIC_DONE;
-#ifdef S_IFBLK
- case S_IFBLK:
- /*
- * (void) magic_rsl_printf(r,"block special (%d/%d)",
- * major(sb->st_rdev), minor(sb->st_rdev));
- */
- (void) magic_rsl_puts(MIME_BINARY_UNKNOWN);
- return MIME_MAGIC_DONE;
- /* TODO add code to handle V7 MUX and Blit MUX files */
-#endif
-#ifdef S_IFIFO
- case S_IFIFO:
- /*
- * magic_rsl_puts(r,"fifo (named pipe)");
- */
- (void) magic_rsl_puts(MIME_BINARY_UNKNOWN);
- return MIME_MAGIC_DONE;
-#endif
-#ifdef S_IFLNK
- case S_IFLNK:
- /* We used stat(), the only possible reason for this is that the
- * symlink is broken.
- */
- if(MIME_MAGIC_G(debug))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "broken symlink (%s)", filename);
- return MIME_MAGIC_ERROR;
-#endif
-#ifdef S_IFSOCK
-#ifndef __COHERENT__
- case S_IFSOCK:
- magic_rsl_puts(MIME_BINARY_UNKNOWN);
- return MIME_MAGIC_DONE;
-#endif
-#endif
- case S_IFREG:
- break;
- case 0:
- break;
- default:
- if(MIME_MAGIC_G(debug))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid mode 0%o.", (unsigned int)stat_ssb.sb.st_mode);
- return MIME_MAGIC_ERROR;
- }
-
- /*
- * regular file, check next possibility
- */
- if (stat_ssb.sb.st_size == 0) {
- magic_rsl_puts(MIME_TEXT_UNKNOWN);
- return MIME_MAGIC_DONE;
- }
- return MIME_MAGIC_OK;
-}
-
-/*
- * softmagic - lookup one file in database (already read from /etc/magic by
- * apprentice.c). Passed the name and FILE * of one file to be typed.
- */
-/* ARGSUSED1 *//* nbytes passed for regularity, maybe need later */
-static int softmagic(unsigned char *buf, int nbytes)
-{
- if (match(buf, nbytes))
- return 1;
-
- return 0;
-}
-
-/*
- * Go through the whole list, stopping if you find a match. Process all the
- * continuations of that match before returning.
- *
- * We support multi-level continuations:
- *
- * At any time when processing a successful top-level match, there is a current
- * continuation level; it represents the level of the last successfully
- * matched continuation.
- *
- * Continuations above that level are skipped as, if we see one, it means that
- * the continuation that controls them - i.e, the lower-level continuation
- * preceding them - failed to match.
- *
- * Continuations below that level are processed as, if we see one, it means
- * we've finished processing or skipping higher-level continuations under the
- * control of a successful or unsuccessful lower-level continuation, and are
- * now seeing the next lower-level continuation and should process it. The
- * current continuation level reverts to the level of the one we're seeing.
- *
- * Continuations at the current level are processed as, if we see one, there's
- * no lower-level continuation that may have failed.
- *
- * If a continuation matches, we bump the current continuation level so that
- * higher-level continuations are processed.
- */
-static int match(unsigned char *s, int nbytes)
-{
- int cont_level = 0;
- int need_separator = 0;
- union VALUETYPE p;
- magic_server_config_rec *conf = &mime_global;
- struct magic *m;
-
- for (m = conf->magic; m; m = m->next) {
- /* check if main entry matches */
- if (!mget(&p, s, m, nbytes) ||
- !mcheck(&p, m)) {
- struct magic *m_cont;
-
- /*
- * main entry didn't match, flush its continuations
- */
- if (!m->next || (m->next->cont_level == 0)) {
- continue;
- }
-
- m_cont = m->next;
- while (m_cont && (m_cont->cont_level != 0)) {
- /*
- * this trick allows us to keep *m in sync when the continue
- * advances the pointer
- */
- m = m_cont;
- m_cont = m_cont->next;
- }
- continue;
- }
-
- /* if we get here, the main entry rule was a match */
- /* this will be the last run through the loop */
-
- /* print the match */
- mprint(&p, m);
-
- /*
- * If we printed something, we'll need to print a blank before we
- * print something else.
- */
- if (m->desc[0])
- need_separator = 1;
- /* and any continuations that match */
- cont_level++;
- /*
- * while (m && m->next && m->next->cont_level != 0 && ( m = m->next
- * ))
- */
- m = m->next;
- while (m && (m->cont_level != 0)) {
- if (cont_level >= m->cont_level) {
- if (cont_level > m->cont_level) {
- /*
- * We're at the end of the level "cont_level"
- * continuations.
- */
- cont_level = m->cont_level;
- }
- if (mget(&p, s, m, nbytes) &&
- mcheck(&p, m)) {
- /*
- * This continuation matched. Print its message, with a
- * blank before it if the previous item printed and this
- * item isn't empty.
- */
- /* space if previous printed */
- if (need_separator
- && (m->nospflag == 0)
- && (m->desc[0] != '\0')
- ) {
- (void) magic_rsl_putchar(' ');
- need_separator = 0;
- }
- mprint(&p, m);
- if (m->desc[0])
- need_separator = 1;
-
- /*
- * If we see any continuations at a higher level, process
- * them.
- */
- cont_level++;
- }
- }
-
- /* move to next continuation record */
- m = m->next;
- }
- return 1; /* all through */
- }
- return 0; /* no match at all */
-}
-
-/* an optimization over plain strcmp() */
-#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0)
-
-static int ascmagic(unsigned char *buf, int nbytes)
-{
- int has_escapes = 0;
- unsigned char *s;
- char nbuf[HOWMANY + 1]; /* one extra for terminating '\0' */
- char *token;
- register struct names *p;
- int small_nbytes;
-
- /* these are easy, do them first */
-
- /*
- * for troff, look for . + letter + letter or .\"; this must be done to
- * disambiguate tar archives' ./file and other trash from real troff
- * input.
- */
- if (*buf == '.') {
- unsigned char *tp = buf + 1;
-
- while (isspace(*tp))
- ++tp; /* skip leading whitespace */
- if ((isalnum(*tp) || *tp == '\\') &&
- (isalnum(*(tp + 1)) || *tp == '"')) {
- magic_rsl_puts("application/x-troff");
- return 1;
- }
- }
- if ((*buf == 'c' || *buf == 'C') && isspace(*(buf + 1))) {
- /* Fortran */
- magic_rsl_puts("text/plain");
- return 1;
- }
-
- /* look for tokens from names.h - this is expensive!, so we'll limit
- * ourselves to only SMALL_HOWMANY bytes */
- small_nbytes = (nbytes > SMALL_HOWMANY) ? SMALL_HOWMANY : nbytes;
- /* make a copy of the buffer here because strtok() will destroy it */
- s = (unsigned char *) memcpy(nbuf, buf, small_nbytes);
- s[small_nbytes] = '\0';
- has_escapes = (memchr(s, '\033', small_nbytes) != NULL);
- /* XXX: not multithread safe */
- while ((token = strtok((char *) s, " \t\n\r\f")) != NULL) {
- s = NULL; /* make strtok() keep on tokin' */
- for (p = names; p < names + NNAMES; p++) {
- if (STREQ(p->name, token)) {
- magic_rsl_puts(types[p->type]);
- if (has_escapes)
- magic_rsl_puts(" (with escape sequences)");
- return 1;
- }
- }
- }
-
- switch (is_tar(buf, nbytes)) {
- case 1:
- /* V7 tar archive */
- magic_rsl_puts("application/x-tar");
- return 1;
- case 2:
- /* POSIX tar archive */
- magic_rsl_puts("application/x-tar");
- return 1;
- }
-
- /* all else fails, but it is ascii... */
- if (has_escapes) {
- /* text with escape sequences */
- /* we leave this open for further differentiation later */
- magic_rsl_puts("text/plain");
- }
- else {
- /* plain text */
- magic_rsl_puts("text/plain");
- }
- return 1;
-}
-
-/*
- * is_tar() -- figure out whether file is a tar archive.
- *
- * Stolen (by author of file utility) from the public domain tar program: Public
- * Domain version written 26 Aug 1985 John Gilmore (ihnp4!hoptoad!gnu).
- *
- * @(#)list.c 1.18 9/23/86 Public Domain - gnu $Id: mod_mime_magic.c,v 1.7
- * 1997/06/24 00:41:02 ikluft Exp ikluft $
- *
- * Comments changed and some code/comments reformatted for file command by Ian
- * Darwin.
- */
-
-#define isodigit(c) ( ((c) >= '0') && ((c) <= '7') )
-
-/*
- * Return 0 if the checksum is bad (i.e., probably not a tar archive), 1 for
- * old UNIX tar file, 2 for Unix Std (POSIX) tar file.
- */
-
-static int is_tar(unsigned char *buf, int nbytes)
-{
- register union record *header = (union record *) buf;
- register int i;
- register long sum, recsum;
- register char *p;
-
- if (nbytes < sizeof(union record))
- return 0;
-
- recsum = from_oct(8, header->header.chksum);
-
- sum = 0;
- p = header->charptr;
- for (i = sizeof(union record); --i >= 0;) {
- /*
- * We can't use unsigned char here because of old compilers, e.g. V7.
- */
- sum += 0xFF & *p++;
- }
-
- /* Adjust checksum to count the "chksum" field as blanks. */
- for (i = sizeof(header->header.chksum); --i >= 0;)
- sum -= 0xFF & header->header.chksum[i];
- sum += ' ' * sizeof header->header.chksum;
-
- if (sum != recsum)
- return 0; /* Not a tar archive */
-
- if (0 == strcmp(header->header.magic, TMAGIC))
- return 2; /* Unix Standard tar archive */
-
- return 1; /* Old fashioned tar archive */
-}
-
-
-/*
- * Quick and dirty octal conversion.
- *
- * Result is -1 if the field is invalid (all blank, or nonoctal).
- */
-static long from_oct(int digs, char *where)
-{
- register long value;
-
- while (isspace(*where)) { /* Skip spaces */
- where++;
- if (--digs <= 0)
- return -1; /* All blank field */
- }
- value = 0;
- while (digs > 0 && isodigit(*where)) { /* Scan til nonoctal */
- value = (value << 3) | (*where++ - '0');
- --digs;
- }
-
- if (digs > 0 && *where && !isspace(*where))
- return -1; /* Ended on non-space/nul */
-
- return value;
-}
-
-static int mget(union VALUETYPE *p, unsigned char *s,
- struct magic *m, int nbytes)
-{
- long offset = m->offset;
-
- if (offset + (long)sizeof(union VALUETYPE) > nbytes)
- return 0;
-
- memcpy(p, s + offset, sizeof(union VALUETYPE));
-
- if (!mconvert(p, m))
- return 0;
-
- if (m->flag & INDIR) {
-
- switch (m->in.type) {
- case BYTE:
- offset = p->b + m->in.offset;
- break;
- case SHORT:
- offset = p->h + m->in.offset;
- break;
- case LONG:
- offset = p->l + m->in.offset;
- break;
- }
-
- if (offset + (long)sizeof(union VALUETYPE) > nbytes)
- return 0;
-
- memcpy(p, s + offset, sizeof(union VALUETYPE));
-
- if (!mconvert(p, m))
- return 0;
- }
- return 1;
-}
-
-static int mcheck(union VALUETYPE *p, struct magic *m)
-{
- register unsigned long l = m->value.l;
- register unsigned long v;
- int matched;
- TSRMLS_FETCH();
-
- if ((m->value.s[0] == 'x') && (m->value.s[1] == '\0')) {
- if(MIME_MAGIC_G(debug))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "BOINK");
- return 1;
- }
-
- switch (m->type) {
- case BYTE:
- v = p->b;
- break;
-
- case SHORT:
- case BESHORT:
- case LESHORT:
- v = p->h;
- break;
-
- case LONG:
- case BELONG:
- case LELONG:
- case DATE:
- case BEDATE:
- case LEDATE:
- v = p->l;
- break;
-
- case STRING:
- l = 0;
- /*
- * What we want here is: v = strncmp(m->value.s, p->s, m->vallen);
- * but ignoring any nulls. bcmp doesn't give -/+/0 and isn't
- * universally available anyway.
- */
- v = 0;
- {
- register unsigned char *a = (unsigned char *) m->value.s;
- register unsigned char *b = (unsigned char *) p->s;
- register int len = m->vallen;
-
- while (--len >= 0)
- if ((v = *b++ - *a++) != 0)
- break;
- }
- break;
- default:
- /* bogosity, pretend that it just wasn't a match */
- if(MIME_MAGIC_G(debug))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid type %d in mcheck().", m->type);
- return 0;
- }
-
- v = signextend(m, v) & m->mask;
-
- switch (m->reln) {
- case 'x':
- matched = 1;
- break;
-
- case '!':
- matched = v != l;
- break;
-
- case '=':
- matched = v == l;
- break;
-
- case '>':
- if (m->flag & UNSIGNED) {
- matched = v > l;
- }
- else {
- matched = (long) v > (long) l;
- }
- break;
-
- case '<':
- if (m->flag & UNSIGNED) {
- matched = v < l;
- }
- else {
- matched = (long) v < (long) l;
- }
- break;
-
- case '&':
- matched = (v & l) == l;
- break;
-
- case '^':
- matched = (v & l) != l;
- break;
-
- default:
- /* bogosity, pretend it didn't match */
- matched = 0;
- if(MIME_MAGIC_G(debug))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "mcheck: can't happen: invalid relation %d.", m->reln);
- break;
- }
-
- return matched;
-}
-
-#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
-/*
- * compress routines: zmagic() - returns 0 if not recognized, uncompresses
- * and prints information if recognized uncompress(s, method, old, n, newch)
- * - uncompress old into new, using method, return sizeof new
- */
-
-static int zmagic(unsigned char *buf, int nbytes)
-{
- if (buf[0] != 0x1f) return 0;
-
- switch(buf[1]) {
- case 0x9d: /* .Z "x-compress" */
- break; /* not yet supportet */
-
- case 0x8b: /* .gz "x-gzip" */
-#if 0
- if ((newsize = magic_uncompress(i, &newbuf, nbytes)) > 0) {
- tryit(newbuf, newsize, 0);
-
- /* set encoding type in the request record */
- /* TODO r->content_encoding = compr[i].encoding; */
- }
-#endif
- break; /* not yet supported */
-
- case 0x1e: /* simply packed ? */
- break; /* not yet supported */
- }
-
- return 0;
-}
-#endif
-
-static void mprint(union VALUETYPE *p, struct magic *m)
-{
- char *pp, *rt;
- unsigned long v;
-
- switch (m->type) {
- case BYTE:
- v = p->b;
- break;
-
- case SHORT:
- case BESHORT:
- case LESHORT:
- v = p->h;
- break;
-
- case LONG:
- case BELONG:
- case LELONG:
- v = p->l;
- break;
-
- case STRING:
- if (m->reln == '=') {
- (void) magic_rsl_printf(m->desc, m->value.s);
- }
- else {
- (void) magic_rsl_printf(m->desc, p->s);
- }
- return;
-
- case DATE:
- case BEDATE:
- case LEDATE:
- /* XXX: not multithread safe */
- pp = ctime((time_t *) & p->l);
- if ((rt = strchr(pp, '\n')) != NULL)
- *rt = '\0';
- (void) magic_rsl_printf(m->desc, pp);
- return;
- default:
- {
- TSRMLS_FETCH();
- if(MIME_MAGIC_G(debug))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid m->type (%d) in mprint().", m->type);
- return;
- }
- }
-
- v = signextend(m, v) & m->mask;
- (void) magic_rsl_printf(m->desc, (unsigned long) v);
-}
-
-/*
- * Convert the byte order of the data we are looking at
- */
-static int mconvert(union VALUETYPE *p, struct magic *m)
-{
- char *rt;
-
- switch (m->type) {
- case BYTE:
- case SHORT:
- case LONG:
- case DATE:
- return 1;
- case STRING:
- /* Null terminate and eat the return */
- p->s[sizeof(p->s) - 1] = '\0';
- if ((rt = strchr(p->s, '\n')) != NULL)
- *rt = '\0';
- return 1;
- case BESHORT:
- p->h = (short) ((p->hs[0] << 8) | (p->hs[1]));
- return 1;
- case BELONG:
- case BEDATE:
- p->l = (long)
- ((p->hl[0] << 24) | (p->hl[1] << 16) | (p->hl[2] << 8) | (p->hl[3]));
- return 1;
- case LESHORT:
- p->h = (short) ((p->hs[1] << 8) | (p->hs[0]));
- return 1;
- case LELONG:
- case LEDATE:
- p->l = (long)
- ((p->hl[3] << 24) | (p->hl[2] << 16) | (p->hl[1] << 8) | (p->hl[0]));
- return 1;
- default:
- {
- TSRMLS_FETCH();
- if(MIME_MAGIC_G(debug))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid type %d in mconvert().", m->type);
- return 0;
- }
- }
-}
-
-
-/* states for the state-machine algorithm in magic_rsl_to_request() */
-typedef enum {
- rsl_leading_space, rsl_type, rsl_subtype, rsl_separator, rsl_encoding
-} rsl_states;
-
-/* process the RSL and set the MIME info in the request record */
-static int magic_rsl_get(char **content_type, char **content_encoding)
-{
- int cur_frag, /* current fragment number/counter */
- cur_pos, /* current position within fragment */
- type_frag, /* content type starting point: fragment */
- type_pos, /* content type starting point: position */
- type_len, /* content type length */
- encoding_frag, /* content encoding starting point: fragment */
- encoding_pos, /* content encoding starting point: position */
- encoding_len; /* content encoding length */
-
- magic_rsl *frag; /* list-traversal pointer */
- rsl_states state;
-
- magic_req_rec *req_dat;
-
- TSRMLS_FETCH();
-
- req_dat = MIME_MAGIC_G(req_dat);
-
- /* check if we have a result */
- if (!req_dat || !req_dat->head) {
- /* empty - no match, we defer to other Apache modules */
- return MIME_MAGIC_DECLINED;
- }
-
- /* start searching for the type and encoding */
- state = rsl_leading_space;
- type_frag = type_pos = type_len = 0;
- encoding_frag = encoding_pos = encoding_len = 0;
- for (frag = req_dat->head, cur_frag = 0;
- frag && frag->next;
- frag = frag->next, cur_frag++) {
- /* loop through the characters in the fragment */
- for (cur_pos = 0; frag->str[cur_pos]; cur_pos++) {
- if (isspace(frag->str[cur_pos])) {
- /* process whitespace actions for each state */
- if (state == rsl_leading_space) {
- /* eat whitespace in this state */
- continue;
- }
- else if (state == rsl_type) {
- /* whitespace: type has no slash! */
- return MIME_MAGIC_DECLINED;
- }
- else if (state == rsl_subtype) {
- /* whitespace: end of MIME type */
- state++;
- continue;
- }
- else if (state == rsl_separator) {
- /* eat whitespace in this state */
- continue;
- }
- else if (state == rsl_encoding) {
- /* whitespace: end of MIME encoding */
- /* we're done */
- frag = req_dat->tail;
- break;
- }
- else {
- /* should not be possible */
- /* abandon malfunctioning module */
- if(MIME_MAGIC_G(debug))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, ": bad state %d (ws)", state);
- return MIME_MAGIC_DECLINED;
- }
- /* NOTREACHED */
- }
- else if (state == rsl_type &&
- frag->str[cur_pos] == '/') {
- /* copy the char and go to rsl_subtype state */
- type_len++;
- state++;
- }
- else {
- /* process non-space actions for each state */
- if (state == rsl_leading_space) {
- /* non-space: begin MIME type */
- state++;
- type_frag = cur_frag;
- type_pos = cur_pos;
- type_len = 1;
- continue;
- }
- else if (state == rsl_type ||
- state == rsl_subtype) {
- /* non-space: adds to type */
- type_len++;
- continue;
- }
- else if (state == rsl_separator) {
- /* non-space: begin MIME encoding */
- state++;
- encoding_frag = cur_frag;
- encoding_pos = cur_pos;
- encoding_len = 1;
- continue;
- }
- else if (state == rsl_encoding) {
- /* non-space: adds to encoding */
- encoding_len++;
- continue;
- }
- else {
- /* should not be possible */
- /* abandon malfunctioning module */
- if(MIME_MAGIC_G(debug))
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "bad state %d (ns)", state);
- return MIME_MAGIC_DECLINED;
- }
- /* NOTREACHED */
- }
- /* NOTREACHED */
- }
- }
-
- /* if we ended prior to state rsl_subtype, we had incomplete info */
- if (state != rsl_subtype && state != rsl_separator &&
- state != rsl_encoding) {
- /* defer to other modules */
- return MIME_MAGIC_DECLINED;
- }
-
- /* save the info in the request record */
- if (state == rsl_subtype || state == rsl_encoding ||
- state == rsl_encoding) {
- char *tmp;
- tmp = rsl_strdup(type_frag, type_pos, type_len);
- /* XXX: this could be done at config time I'm sure... but I'm
- * confused by all this magic_rsl stuff. -djg */
- /* TODO ap_content_type_tolower(tmp); */
- *content_type = tmp;
- }
- if (state == rsl_encoding) {
- char *tmp;
- tmp = rsl_strdup(encoding_frag,
- encoding_pos, encoding_len);
- /* XXX: this could be done at config time I'm sure... but I'm
- * confused by all this magic_rsl stuff. -djg */
- /* TODO ap_str_tolower(tmp); */
- *content_encoding = tmp;
- }
-
- /* detect memory allocation errors */
- if (!content_type ||
- (state == rsl_encoding && !*content_encoding)) {
- return MIME_MAGIC_ERROR;
- }
-
- /* success! */
- return MIME_MAGIC_OK;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/mime_magic/mime_magic.dsp b/ext/mime_magic/mime_magic.dsp
deleted file mode 100644
index af83e44b5e..0000000000
--- a/ext/mime_magic/mime_magic.dsp
+++ /dev/null
@@ -1,108 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mime_magic" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mime_magic - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mime_magic.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mime_magic.mak" CFG="mime_magic - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mime_magic - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mime_magic - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mime_magic - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MIME_MAGIC_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MIME_MAGIC" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "PHP_MIME_MAGIC_EXPORTS" /D "HAVE_ZLIB" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mime_magic.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\release"
-
-!ELSEIF "$(CFG)" == "mime_magic - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MIME_MAGIC_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MIME_MAGIC" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "PHP_MIME_MAGIC_EXPORTS" /D "HAVE_ZLIB" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_mime_magic.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\release"
-
-!ENDIF
-
-# Begin Target
-
-# Name "mime_magic - Win32 Release_TS"
-# Name "mime_magic - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mime_magic.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mime_magic.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/mime_magic/php_mime_magic.h b/ext/mime_magic/php_mime_magic.h
deleted file mode 100644
index 3b7edf1a86..0000000000
--- a/ext/mime_magic/php_mime_magic.h
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-
- $Id$
-*/
-
-#ifndef PHP_MIME_MAGIC_H
-#define PHP_MIME_MAGIC_H
-
-#define MIME_MAGIC_DEBUG 0
-
-#define MIME_BINARY_UNKNOWN "application/octet-stream"
-#define MIME_TEXT_UNKNOWN "text/plain"
-
-#define MAXMIMESTRING 256
-
-#define MIME_MAGIC_OK 0
-#define MIME_MAGIC_DECLINED -1
-#define MIME_MAGIC_DONE -2
-#define MIME_MAGIC_ERROR -3
-
-#define DIR_MAGIC_TYPE "httpd/unix-directory"
-
-/* HOWMANY must be at least 4096 to make gzip -dcq work */
-#define HOWMANY 4096
-/* SMALL_HOWMANY limits how much work we do to figure out text files */
-#define SMALL_HOWMANY 1024
-#define MAXDESC 50 /* max leng of text description */
-#define MAXstring 64 /* max leng of "string" types */
-
-struct magic {
- struct magic *next; /* link to next entry */
- int lineno; /* line number from magic file */
-
- short flag;
-#define INDIR 1 /* if '>(...)' appears, */
-#define UNSIGNED 2 /* comparison is unsigned */
- short cont_level; /* level of ">" */
- struct {
- char type; /* byte short long */
- long offset; /* offset from indirection */
- } in;
- long offset; /* offset to magic number */
- unsigned char reln; /* relation (0=eq, '>'=gt, etc) */
- char type; /* int, short, long or string. */
- char vallen; /* length of string value, if any */
-#define BYTE 1
-#define SHORT 2
-#define LONG 4
-#define STRING 5
-#define DATE 6
-#define BESHORT 7
-#define BELONG 8
-#define BEDATE 9
-#define LESHORT 10
-#define LELONG 11
-#define LEDATE 12
- union VALUETYPE {
- unsigned char b;
- unsigned short h;
- unsigned long l;
- char s[MAXstring];
- unsigned char hs[2]; /* 2 bytes of a fixed-endian "short" */
- unsigned char hl[4]; /* 2 bytes of a fixed-endian "long" */
- } value; /* either number or string */
- unsigned long mask; /* mask before comparison with value */
- char nospflag; /* supress space character */
-
- /* NOTE: this string is suspected of overrunning - find it! */
- char desc[MAXDESC]; /* description */
-};
-
-/*
- * data structures for tar file recognition
- * --------------------------------------------------------------------------
- * Header file for public domain tar (tape archive) program.
- *
- * @(#)tar.h 1.20 86/10/29 Public Domain. Created 25 August 1985 by John
- * Gilmore, ihnp4!hoptoad!gnu.
- *
- * Header block on tape.
- *
- * I'm going to use traditional DP naming conventions here. A "block" is a big
- * chunk of stuff that we do I/O on. A "record" is a piece of info that we
- * care about. Typically many "record"s fit into a "block".
- */
-#define RECORDSIZE 512
-#define NAMSIZ 100
-#define TUNMLEN 32
-#define TGNMLEN 32
-
-union record {
- char charptr[RECORDSIZE];
- struct header {
- char name[NAMSIZ];
- char mode[8];
- char uid[8];
- char gid[8];
- char size[12];
- char mtime[12];
- char chksum[8];
- char linkflag;
- char linkname[NAMSIZ];
- char magic[8];
- char uname[TUNMLEN];
- char gname[TGNMLEN];
- char devmajor[8];
- char devminor[8];
- } header;
-};
-
-/* The magic field is filled with this if uname and gname are valid. */
-#define TMAGIC "ustar " /* 7 chars and a null */
-
-/*
- * file-function prototypes
- */
-/*TODO*/
-#define request_rec void
-#define server_rec void
-#define pool void
-#define cmd_parms void
-
-/*
- * includes for ASCII substring recognition formerly "names.h" in file
- * command
- *
- * Original notes: names and types used by ascmagic in file(1). These tokens are
- * here because they can appear anywhere in the first HOWMANY bytes, while
- * tokens in /etc/magic must appear at fixed offsets into the file. Don't
- * make HOWMANY too high unless you have a very fast CPU.
- */
-
-/* these types are used to index the table 'types': keep em in sync! */
-/* HTML inserted in first because this is a web server module now */
-#define L_HTML 0 /* HTML */
-#define L_C 1 /* first and foremost on UNIX */
-#define L_FORT 2 /* the oldest one */
-#define L_MAKE 3 /* Makefiles */
-#define L_PLI 4 /* PL/1 */
-#define L_MACH 5 /* some kinda assembler */
-#define L_ENG 6 /* English */
-#define L_PAS 7 /* Pascal */
-#define L_MAIL 8 /* Electronic mail */
-#define L_NEWS 9 /* Usenet Netnews */
-
-static char *types[] =
- {
- "text/html", /* HTML */
- "text/plain", /* "c program text", */
- "text/plain", /* "fortran program text", */
- "text/plain", /* "make commands text", */
- "text/plain", /* "pl/1 program text", */
- "text/plain", /* "assembler program text", */
- "text/plain", /* "English text", */
- "text/plain", /* "pascal program text", */
- "message/rfc822", /* "mail text", */
- "message/news", /* "news text", */
- "application/binary", /* "can't happen error on names.h/types", */
- 0
- };
-
-static struct names {
- char *name;
- short type;
-} names[] = {
-
- /* These must be sorted by eye for optimal hit rate */
- /* Add to this list only after substantial meditation */
- {
- "<html>", L_HTML
- },
- {
- "<HTML>", L_HTML
- },
- {
- "<head>", L_HTML
- },
- {
- "<HEAD>", L_HTML
- },
- {
- "<title>", L_HTML
- },
- {
- "<TITLE>", L_HTML
- },
- {
- "<h1>", L_HTML
- },
- {
- "<H1>", L_HTML
- },
- {
- "<!--", L_HTML
- },
- {
- "<!DOCTYPE HTML", L_HTML
- },
- {
- "/*", L_C
- }, /* must precede "The", "the", etc. */
- {
- "#include", L_C
- },
- {
- "char", L_C
- },
- {
- "The", L_ENG
- },
- {
- "the", L_ENG
- },
- {
- "double", L_C
- },
- {
- "extern", L_C
- },
- {
- "float", L_C
- },
- {
- "real", L_C
- },
- {
- "struct", L_C
- },
- {
- "union", L_C
- },
- {
- "CFLAGS", L_MAKE
- },
- {
- "LDFLAGS", L_MAKE
- },
- {
- "all:", L_MAKE
- },
- {
- ".PRECIOUS", L_MAKE
- },
- /*
- * Too many files of text have these words in them. Find another way to
- * recognize Fortrash.
- */
-#ifdef NOTDEF
- {
- "subroutine", L_FORT
- },
- {
- "function", L_FORT
- },
- {
- "block", L_FORT
- },
- {
- "common", L_FORT
- },
- {
- "dimension", L_FORT
- },
- {
- "integer", L_FORT
- },
- {
- "data", L_FORT
- },
-#endif /* NOTDEF */
- {
- ".ascii", L_MACH
- },
- {
- ".asciiz", L_MACH
- },
- {
- ".byte", L_MACH
- },
- {
- ".even", L_MACH
- },
- {
- ".globl", L_MACH
- },
- {
- "clr", L_MACH
- },
- {
- "(input,", L_PAS
- },
- {
- "dcl", L_PLI
- },
- {
- "Received:", L_MAIL
- },
- {
- ">From", L_MAIL
- },
- {
- "Return-Path:", L_MAIL
- },
- {
- "Cc:", L_MAIL
- },
- {
- "Newsgroups:", L_NEWS
- },
- {
- "Path:", L_NEWS
- },
- {
- "Organization:", L_NEWS
- },
- {
- NULL, 0
- }
-};
-
-#define NNAMES ((sizeof(names)/sizeof(struct names)) - 1)
-
-/*
- * Result String List (RSL)
- *
- * The file(1) command prints its output. Instead, we store the various
- * "printed" strings in a list (allocating memory as we go) and concatenate
- * them at the end when we finally know how much space they'll need.
- */
-
-typedef struct magic_rsl_s {
- char *str; /* string, possibly a fragment */
- struct magic_rsl_s *next; /* pointer to next fragment */
-} magic_rsl;
-
-/*
- * Apache module configuration structures
- */
-
-/* per-server info */
-typedef struct {
- char *magicfile; /* where magic be found */
- struct magic *magic; /* head of magic config list */
- struct magic *last;
-} magic_server_config_rec;
-
-/* per-request info */
-typedef struct {
- magic_rsl *head; /* result string list */
- magic_rsl *tail;
- unsigned suf_recursion; /* recursion depth in suffix check */
-} magic_req_rec;
-
-
-
-
-extern zend_module_entry mime_magic_module_entry;
-#define phpext_mime_magic_ptr &mime_magic_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_MIME_MAGIC_API __declspec(dllexport)
-#else
-#define PHP_MIME_MAGIC_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-PHP_MINIT_FUNCTION(mime_magic);
-PHP_MSHUTDOWN_FUNCTION(mime_magic);
-PHP_RINIT_FUNCTION(mime_magic);
-PHP_RSHUTDOWN_FUNCTION(mime_magic);
-PHP_MINFO_FUNCTION(mime_magic);
-
-PHP_FUNCTION(mime_content_type);
-
-ZEND_BEGIN_MODULE_GLOBALS(mime_magic)
- char *magicfile;
- magic_req_rec *req_dat;
- int debug; /* shall magic file parser errors be shown? */
- char *status; /* status message for phpinfo() */
-ZEND_END_MODULE_GLOBALS(mime_magic)
-
-/* In every utility function you add that needs to use variables
- in php_mime_magic_globals, call TSRM_FETCH(); after declaring other
- variables used by that function, or better yet, pass in TSRMG_CC
- after the last function argument and declare your utility function
- with TSRMG_DC after the last declared argument. Always refer to
- the globals in your function as MIME_MAGIC_G(variable). You are
- encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define MIME_MAGIC_G(v) TSRMG(mime_magic_globals_id, zend_mime_magic_globals *, v)
-#else
-#define MIME_MAGIC_G(v) (mime_magic_globals.v)
-#endif
-
-
-
-
-#endif /* PHP_MIME_MAGIC_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/ming/CREDITS b/ext/ming/CREDITS
deleted file mode 100644
index 56058457f6..0000000000
--- a/ext/ming/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-MING
-Dave Hayden
diff --git a/ext/ming/EXPERIMENTAL b/ext/ming/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/ming/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/ming/config.m4 b/ext/ming/config.m4
deleted file mode 100644
index 4478aaac24..0000000000
--- a/ext/ming/config.m4
+++ /dev/null
@@ -1,62 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(ming, for MING support,
-[ --with-ming[=DIR] Include MING support])
-
-if test "$PHP_MING" != "no"; then
- AC_CHECK_LIB(m, sin)
-
- for i in $PHP_MING /usr/local /usr; do
- if test -f $i/lib/libming.$SHLIB_SUFFIX_NAME -o -f $i/lib/libming.a; then
- MING_DIR=$i
- fi
- done
-
- if test -z "$MING_DIR"; then
- AC_MSG_ERROR(Please reinstall ming distribution. libming.(a|so) not found.)
- fi
-
- for i in $MING_DIR/include $MING_DIR/include/ming $MING_DIR/ming/include; do
- if test -f $i/ming.h; then
- MING_INC_DIR=$i
- fi
- done
-
- if test -z "$MING_INC_DIR"; then
- AC_MSG_ERROR(Please reinstall ming distribution. ming.h not found.)
- fi
-
- PHP_CHECK_LIBRARY(ming, Ming_useSWFVersion, [
- AC_DEFINE(HAVE_MING,1,[ ])
- ],[
- AC_MSG_ERROR([Ming library 0.2a or greater required.])
- ],[
- -L$MING_DIR/lib
- ])
-
- PHP_ADD_INCLUDE($MING_INC_DIR)
- PHP_ADD_LIBRARY_WITH_PATH(ming, $MING_DIR/lib, MING_SHARED_LIBADD)
-
- AC_MSG_CHECKING([for destroySWFBlock])
- AC_TRY_RUN([
-#include "ming.h"
-int destroySWFBlock(int a, int b) {
- return a+b;
-}
-int main() {
- return destroySWFBlock(-1,1); /* returns 0 only if function is not yet defined */
-}
- ],[
- AC_MSG_RESULT([missing])
- ],[
- AC_DEFINE(HAVE_DESTROY_SWF_BLOCK,1,[ ])
- AC_MSG_RESULT([ok])
- ],[
- AC_MSG_RESULT([unknown])
- ])
-
- PHP_NEW_EXTENSION(ming, ming.c, $ext_shared)
- PHP_SUBST(MING_SHARED_LIBADD)
-fi
diff --git a/ext/ming/ming.c b/ext/ming/ming.c
deleted file mode 100644
index 3b718315a9..0000000000
--- a/ext/ming/ming.c
+++ /dev/null
@@ -1,2853 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_01.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: dave@opaque.net |
- +----------------------------------------------------------------------+
-*/
-
-#include <stdio.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ming.h"
-#include "ext/standard/info.h"
-#include "ext/standard/file.h"
-#include "ext/standard/fsock.h"
-#include "php_streams.h"
-
-#if HAVE_MING
-
-#define FLOAT_Z_DVAL_PP(x) ((float)Z_DVAL_PP(x))
-#define BYTE_Z_LVAL_PP(x) ((byte)Z_LVAL_PP(x))
-
-#ifndef HAVE_DESTROY_SWF_BLOCK
-void destroySWFBlock(SWFBlock block);
-#endif
-
-static zend_function_entry ming_functions[] = {
- PHP_FALIAS(ming_setcubicthreshold, ming_setCubicThreshold, NULL)
- PHP_FALIAS(ming_setscale, ming_setScale, NULL)
- PHP_FALIAS(ming_useswfversion, ming_useSWFVersion, NULL)
- PHP_FALIAS(swfbutton_keypress, swfbutton_keypress, NULL)
- { NULL, NULL, NULL }
-};
-
-static SWFMovie getMovie(zval *id TSRMLS_DC);
-static SWFFill getFill(zval *id TSRMLS_DC);
-static SWFGradient getGradient(zval *id TSRMLS_DC);
-static SWFBitmap getBitmap(zval *id TSRMLS_DC);
-static SWFShape getShape(zval *id TSRMLS_DC);
-static SWFFont getFont(zval *id TSRMLS_DC);
-static SWFText getText(zval *id TSRMLS_DC);
-static SWFTextField getTextField(zval *id TSRMLS_DC);
-static SWFDisplayItem getDisplayItem(zval *id TSRMLS_DC);
-static SWFButton getButton(zval *id TSRMLS_DC);
-static SWFAction getAction(zval *id TSRMLS_DC);
-static SWFMorph getMorph(zval *id TSRMLS_DC);
-static SWFMovieClip getSprite(zval *id TSRMLS_DC);
-
-/* {{{ proto void ming_setcubicthreshold (int threshold)
- Set cubic threshold (?) */
-PHP_FUNCTION(ming_setCubicThreshold)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(num);
- Ming_setCubicThreshold(Z_LVAL_PP(num));
-}
-/* }}} */
-
-/* {{{ proto void ming_setscale(int scale)
- Set scale (?) */
-PHP_FUNCTION(ming_setScale)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Ming_setScale(FLOAT_Z_DVAL_PP(num));
-}
-/* }}} */
-
-/* {{{ proto void ming_useswfversion(int version)
- Use SWF version (?) */
-PHP_FUNCTION(ming_useSWFVersion)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(num);
- Ming_useSWFVersion(Z_LVAL_PP(num));
-}
-/* }}} */
-
-static int le_swfmoviep;
-static int le_swfshapep;
-static int le_swffillp;
-static int le_swfgradientp;
-static int le_swfbitmapp;
-static int le_swffontp;
-static int le_swftextp;
-static int le_swftextfieldp;
-static int le_swfdisplayitemp;
-static int le_swfbuttonp;
-static int le_swfactionp;
-static int le_swfmorphp;
-static int le_swfspritep;
-static int le_swfinputp;
-
-zend_class_entry movie_class_entry;
-zend_class_entry shape_class_entry;
-zend_class_entry fill_class_entry;
-zend_class_entry gradient_class_entry;
-zend_class_entry bitmap_class_entry;
-zend_class_entry font_class_entry;
-zend_class_entry text_class_entry;
-zend_class_entry textfield_class_entry;
-zend_class_entry displayitem_class_entry;
-zend_class_entry button_class_entry;
-zend_class_entry action_class_entry;
-zend_class_entry morph_class_entry;
-zend_class_entry sprite_class_entry;
-
-/* {{{ internal function SWFgetProperty
- */
-static void *SWFgetProperty(zval *id, char *name, int namelen, int proptype TSRMLS_DC)
-{
- zval **tmp;
- int id_to_find;
- void *property;
- int type;
-
- if (id) {
- if (zend_hash_find(Z_OBJPROP_P(id), name, namelen+1, (void **)&tmp) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find property %s", name);
- return NULL;
- }
- id_to_find = Z_LVAL_PP(tmp);
- } else {
- return NULL;
- }
-
- property = zend_list_find(id_to_find, &type);
-
- if (!property || type != proptype) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find identifier (%d)", id_to_find);
- return NULL;
- }
-
- return property;
-}
-/* }}} */
-
-/* {{{ SWFCharacter - not a real class
-*/
-
-/* {{{ internal function SWFCharacter getCharacter(zval *id)
- Returns the SWFCharacter contained in zval *id */
-static SWFCharacter getCharacter(zval *id TSRMLS_DC)
-{
- if (Z_OBJCE_P(id) == &shape_class_entry)
- return (SWFCharacter)getShape(id TSRMLS_CC);
- else if (Z_OBJCE_P(id) == &font_class_entry)
- return (SWFCharacter)getFont(id TSRMLS_CC);
- else if (Z_OBJCE_P(id) == &text_class_entry)
- return (SWFCharacter)getText(id TSRMLS_CC);
- else if (Z_OBJCE_P(id) == &textfield_class_entry)
- return (SWFCharacter)getTextField(id TSRMLS_CC);
- else if (Z_OBJCE_P(id) == &button_class_entry)
- return (SWFCharacter)getButton(id TSRMLS_CC);
- else if (Z_OBJCE_P(id) == &morph_class_entry)
- return (SWFCharacter)getMorph(id TSRMLS_CC);
- else if (Z_OBJCE_P(id) == &sprite_class_entry)
- return (SWFCharacter)getSprite(id TSRMLS_CC);
- else if (Z_OBJCE_P(id) == &bitmap_class_entry)
- return (SWFCharacter)getBitmap(id TSRMLS_CC);
- else
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFCharacter");
- return NULL;
-}
-/* }}} */
-/* }}} */
-
-/* {{{ getInput - utility func for making an SWFInput from an fopened resource
-*/
-static void destroy_SWFInput_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
-{
- destroySWFInput((SWFInput)resource->ptr);
-}
-
-static SWFInput getInput(zval **zfile TSRMLS_DC)
-{
- FILE *file;
- php_stream *stream;
- SWFInput input;
-
- php_stream_from_zval_no_verify(stream, zfile);
-
- if (stream == NULL)
- return NULL;
-
- if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void *) &file, REPORT_ERRORS) != SUCCESS) {
- return NULL;
- }
-
- input = newSWFInput_file(file);
- zend_list_addref(Z_LVAL_PP(zfile));
- zend_list_addref(zend_list_insert(input, le_swfinputp));
- return input;
-}
-/* }}} */
-
-/* {{{ SWFAction
-*/
-static zend_function_entry swfaction_functions[] = {
- PHP_FALIAS(swfaction, swfaction_init, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto object swfaction_init(string)
- Returns a new SWFAction object, compiling the given script */
-PHP_FUNCTION(swfaction_init)
-{
- SWFAction action;
- zval **script;
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &script) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(script);
- action = compileSWFActionCode(Z_STRVAL_PP(script));
-
- if (!action) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Couldn't compile actionscript");
- }
-
- ret = zend_list_insert(action, le_swfactionp);
-
- object_init_ex(getThis(), &action_class_entry);
- add_property_resource(getThis(), "action", ret);
- zend_list_addref(ret);
-}
-/* no destructor for SWFAction, it's not a character */
-/* }}} */
-
-/* {{{ internal function getAction
- Returns the SWFAction object contained in zval *id */
-static SWFAction getAction(zval *id TSRMLS_DC)
-{
- void *action = SWFgetProperty(id, "action", 6, le_swfactionp TSRMLS_CC);
-
- if (!action) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFAction");
- }
- return (SWFAction)action;
-}
-/* }}} */
-/* }}} */
-
-/* {{{ SWFBitmap
-*/
-static zend_function_entry swfbitmap_functions[] = {
- PHP_FALIAS(swfbitmap, swfbitmap_init, NULL)
- PHP_FALIAS(getwidth, swfbitmap_getWidth, NULL)
- PHP_FALIAS(getheight, swfbitmap_getHeight, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto class swfbitmap_init(file [, maskfile])
- Returns a new SWFBitmap object from jpg (with optional mask) or dbl file */
-PHP_FUNCTION(swfbitmap_init)
-{
- zval **zfile, **zmask = NULL;
- SWFBitmap bitmap;
- SWFInput input, maskinput;
- int ret;
-
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &zfile) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 2) {
- if (zend_get_parameters_ex(2, &zfile, &zmask) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(zfile) != IS_RESOURCE) {
- convert_to_string_ex(zfile);
- input = newSWFInput_buffer(Z_STRVAL_PP(zfile), Z_STRLEN_PP(zfile));
- zend_list_addref(zend_list_insert(input, le_swfinputp));
- } else {
- input = getInput(zfile TSRMLS_CC);
- }
-
- if (zmask != NULL) {
- if (Z_TYPE_PP(zmask) != IS_RESOURCE) {
- convert_to_string_ex(zmask);
- maskinput = newSWFInput_buffer(Z_STRVAL_PP(zmask), Z_STRLEN_PP(zmask));
- zend_list_addref(zend_list_insert(maskinput, le_swfinputp));
- } else {
- maskinput = getInput(zmask TSRMLS_CC);
- }
- bitmap = newSWFJpegWithAlpha_fromInput(input, maskinput);
- } else {
- bitmap = newSWFBitmap_fromInput(input);
- }
-
- ret = zend_list_insert(bitmap, le_swfbitmapp);
- object_init_ex(getThis(), &bitmap_class_entry);
- add_property_resource(getThis(), "bitmap", ret);
- zend_list_addref(ret);
-}
-
-static void destroy_SWFBitmap_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
-{
- destroySWFBitmap((SWFBitmap)resource->ptr);
-}
-/* }}} */
-
-/* {{{ internal function getBitmap
- Returns the SWFBitmap object contained in zval *id */
-static SWFBitmap getBitmap(zval *id TSRMLS_DC)
-{
- void *bitmap = SWFgetProperty(id, "bitmap", 6, le_swfbitmapp TSRMLS_CC);
-
- if (!bitmap) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFBitmap");
- }
- return (SWFBitmap)bitmap;
-}
-/* }}} */
-
-/* {{{ proto void swfbitmap_getWidth(void)
- Returns the width of this bitmap */
-PHP_FUNCTION(swfbitmap_getWidth)
-{
- RETURN_DOUBLE(SWFBitmap_getWidth(getBitmap(getThis() TSRMLS_CC)));
-}
-/* }}} */
-
-/* {{{ proto void swfbitmap_getHeight(void)
- Returns the height of this bitmap */
-PHP_FUNCTION(swfbitmap_getHeight)
-{
- RETURN_DOUBLE(SWFBitmap_getHeight(getBitmap(getThis() TSRMLS_CC)));
-}
-/* }}} */
-/* }}} */
-
-/* {{{ SWFButton
-*/
-static zend_function_entry swfbutton_functions[] = {
- PHP_FALIAS(swfbutton, swfbutton_init, NULL)
- PHP_FALIAS(sethit, swfbutton_setHit, NULL)
- PHP_FALIAS(setover, swfbutton_setOver, NULL)
- PHP_FALIAS(setup, swfbutton_setUp, NULL)
- PHP_FALIAS(setdown, swfbutton_setDown, NULL)
- PHP_FALIAS(setaction, swfbutton_setAction, NULL)
- PHP_FALIAS(addshape, swfbutton_addShape, NULL)
- PHP_FALIAS(addaction, swfbutton_addAction, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto object swfbutton_init(void)
- Returns a new SWFButton object */
-PHP_FUNCTION(swfbutton_init)
-{
- SWFButton button = newSWFButton();
- int ret = zend_list_insert(button, le_swfbuttonp);
-
- object_init_ex(getThis(), &button_class_entry);
- add_property_resource(getThis(), "button", ret);
- zend_list_addref(ret);
-}
-
-static void destroy_SWFButton_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
-{
- destroySWFButton((SWFButton)resource->ptr);
-}
-/* }}} */
-
-/* {{{ internal function getButton
- Returns the SWFButton object contained in zval *id */
-static SWFButton getButton(zval *id TSRMLS_DC)
-{
- void *button = SWFgetProperty(id, "button", 6, le_swfbuttonp TSRMLS_CC);
-
- if(!button) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFButton");
- }
- return (SWFButton)button;
-}
-/* }}} */
-
-/* {{{ proto void swfbutton_setHit(SWFCharacter)
- Sets the character for this button's hit test state */
-PHP_FUNCTION(swfbutton_setHit)
-{
- zval **zchar;
- SWFButton button = getButton(getThis() TSRMLS_CC);
- SWFCharacter character;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_object_ex(zchar);
- character = getCharacter(*zchar TSRMLS_CC);
- SWFButton_addShape(button, character, SWFBUTTONRECORD_HITSTATE);
-}
-/* }}} */
-
-/* {{{ proto void swfbutton_setOver(SWFCharacter)
- Sets the character for this button's over state */
-PHP_FUNCTION(swfbutton_setOver)
-{
- zval **zchar;
- SWFButton button = getButton(getThis() TSRMLS_CC);
- SWFCharacter character;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_object_ex(zchar);
- character = getCharacter(*zchar TSRMLS_CC);
- SWFButton_addShape(button, character, SWFBUTTONRECORD_OVERSTATE);
-}
-/* }}} */
-
-/* {{{ proto void swfbutton_setUp(SWFCharacter)
- Sets the character for this button's up state */
-PHP_FUNCTION(swfbutton_setUp)
-{
- zval **zchar;
- SWFButton button = getButton(getThis() TSRMLS_CC);
- SWFCharacter character;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_object_ex(zchar);
- character = getCharacter(*zchar TSRMLS_CC);
- SWFButton_addShape(button, character, SWFBUTTONRECORD_UPSTATE);
-}
-/* }}} */
-
-/* {{{ proto void swfbutton_setDown(SWFCharacter)
- Sets the character for this button's down state */
-PHP_FUNCTION(swfbutton_setDown)
-{
- zval **zchar;
- SWFButton button = getButton(getThis() TSRMLS_CC);
- SWFCharacter character;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_object_ex(zchar);
- character = getCharacter(*zchar TSRMLS_CC);
- SWFButton_addShape(button, character, SWFBUTTONRECORD_DOWNSTATE);
-}
-/* }}} */
-
-/* {{{ proto void swfbutton_addShape(SWFCharacter character, int flags)
- Sets the character to display for the condition described in flags */
-PHP_FUNCTION(swfbutton_addShape)
-{
- zval **zchar, **flags;
- SWFButton button = getButton(getThis() TSRMLS_CC);
- SWFCharacter character;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &zchar, &flags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_object_ex(zchar);
- character = getCharacter(*zchar TSRMLS_CC);
- convert_to_long_ex(flags);
- SWFButton_addShape(button, character, BYTE_Z_LVAL_PP(flags));
-}
-/* }}} */
-
-/* {{{ proto void swfbutton_setAction(SWFAction)
- Sets the action to perform when button is pressed */
-PHP_FUNCTION(swfbutton_setAction)
-{
- zval **zaction;
- SWFButton button = getButton(getThis() TSRMLS_CC);
- SWFAction action;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zaction) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_object_ex(zaction);
- action = getAction(*zaction TSRMLS_CC);
- SWFButton_addAction(button, action, SWFBUTTON_OVERDOWNTOOVERUP);
-}
-/* }}} */
-
-/* {{{ proto void swfbutton_addAction(SWFAction action, int flags)
- Sets the action to perform when conditions described in flags is met */
-PHP_FUNCTION(swfbutton_addAction)
-{
- zval **zaction, **flags;
- SWFButton button = getButton(getThis() TSRMLS_CC);
- SWFAction action;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &zaction, &flags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_object_ex(zaction);
- action = getAction(*zaction TSRMLS_CC);
- convert_to_long_ex(flags);
- SWFButton_addAction(button, action, Z_LVAL_PP(flags));
-}
-/* }}} */
-
-/* {{{ proto int swfbutton_keypress(string str)
- Returns the action flag for keyPress(char) */
-PHP_FUNCTION(swfbutton_keypress)
-{
- zval **key;
- char c;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(key);
-
- if (Z_STRLEN_PP(key) > 1) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Only one character expected");
- }
-
- c = Z_STRVAL_PP(key)[0];
- RETURN_LONG((c&0x7f)<<9);
-}
-/* }}} */
-/* }}} */
-
-/* {{{ SWFDisplayitem
-*/
-static zend_function_entry swfdisplayitem_functions[] = {
- PHP_FALIAS(moveto, swfdisplayitem_moveTo, NULL)
- PHP_FALIAS(move, swfdisplayitem_move, NULL)
- PHP_FALIAS(scaleto, swfdisplayitem_scaleTo, NULL)
- PHP_FALIAS(scale, swfdisplayitem_scale, NULL)
- PHP_FALIAS(rotateto, swfdisplayitem_rotateTo, NULL)
- PHP_FALIAS(rotate, swfdisplayitem_rotate, NULL)
- PHP_FALIAS(skewxto, swfdisplayitem_skewXTo, NULL)
- PHP_FALIAS(skewx, swfdisplayitem_skewX, NULL)
- PHP_FALIAS(skewyto, swfdisplayitem_skewYTo, NULL)
- PHP_FALIAS(skewy, swfdisplayitem_skewY, NULL)
- PHP_FALIAS(setmatrix, swfdisplayitem_setMatrix, NULL)
- PHP_FALIAS(setdepth, swfdisplayitem_setDepth, NULL)
- PHP_FALIAS(setratio, swfdisplayitem_setRatio, NULL)
- PHP_FALIAS(addcolor, swfdisplayitem_addColor, NULL)
- PHP_FALIAS(multcolor, swfdisplayitem_multColor, NULL)
- PHP_FALIAS(setname, swfdisplayitem_setName, NULL)
- PHP_FALIAS(addaction, swfdisplayitem_addAction, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ internal function getDisplayItem
- Returns the SWFDisplayItem contained in zval *id */
-static SWFDisplayItem getDisplayItem(zval *id TSRMLS_DC)
-{
- void *item = SWFgetProperty(id, "displayitem", 11, le_swfdisplayitemp TSRMLS_CC);
-
- if (!item) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFDisplayItem");
- }
-
- return (SWFDisplayItem)item;
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_moveTo(int x, int y)
- Moves this SWFDisplayItem to movie coordinates (x, y) */
-PHP_FUNCTION(swfdisplayitem_moveTo)
-{
- zval **x, **y;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFDisplayItem_moveTo(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_move(int dx, int dy)
- Displaces this SWFDisplayItem by (dx, dy) in movie coordinates */
-PHP_FUNCTION(swfdisplayitem_move)
-{
- zval **x, **y;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFDisplayItem_move(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_scaleTo(float xScale [, float yScale])
- Scales this SWFDisplayItem by xScale in the x direction, yScale in the y, or both to xScale if only one arg */
-PHP_FUNCTION(swfdisplayitem_scaleTo)
-{
- zval **x, **y;
-
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &x) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- SWFDisplayItem_scaleTo(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(x));
- } else if (ZEND_NUM_ARGS() == 2) {
- if (zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFDisplayItem_scaleTo(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
- } else {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_scale(float xScale, float yScale)
- Multiplies this SWFDisplayItem's current x scale by xScale, its y scale by yScale */
-PHP_FUNCTION(swfdisplayitem_scale)
-{
- zval **x, **y;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFDisplayItem_scale(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_rotateTo(float degrees)
- Rotates this SWFDisplayItem the given (clockwise) degrees from its original orientation */
-PHP_FUNCTION(swfdisplayitem_rotateTo)
-{
- zval **degrees;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &degrees) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(degrees);
- SWFDisplayItem_rotateTo(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(degrees));
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_rotate(float degrees)
- Rotates this SWFDisplayItem the given (clockwise) degrees from its current orientation */
-PHP_FUNCTION(swfdisplayitem_rotate)
-{
- zval **degrees;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &degrees) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(degrees);
- SWFDisplayItem_rotate(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(degrees));
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_skewXTo(float xSkew)
- Sets this SWFDisplayItem's x skew value to xSkew */
-PHP_FUNCTION(swfdisplayitem_skewXTo)
-{
- zval **x;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &x) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(x);
- SWFDisplayItem_skewXTo(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x));
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_skewX(float xSkew)
- Adds xSkew to this SWFDisplayItem's x skew value */
-PHP_FUNCTION(swfdisplayitem_skewX)
-{
- zval **x;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &x) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(x);
- SWFDisplayItem_skewX(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x));
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_skewYTo(float ySkew)
- Sets this SWFDisplayItem's y skew value to ySkew */
-PHP_FUNCTION(swfdisplayitem_skewYTo)
-{
- zval **y;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(y);
- SWFDisplayItem_skewYTo(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(y));
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_skewY(float ySkew)
- Adds ySkew to this SWFDisplayItem's y skew value */
-PHP_FUNCTION(swfdisplayitem_skewY)
-{
- zval **y;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(y);
- SWFDisplayItem_skewY(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(y));
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_setMatrix(float a, float b, float c, float d, float x, float y)
- Sets the item's transform matrix */
-PHP_FUNCTION(swfdisplayitem_setMatrix)
-{
- zval **a, **b, **c, **d, **x, **y;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &a, &b, &c, &d, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(a);
- convert_to_double_ex(b);
- convert_to_double_ex(c);
- convert_to_double_ex(d);
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- SWFDisplayItem_setMatrix( getDisplayItem(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(a), FLOAT_Z_DVAL_PP(b), FLOAT_Z_DVAL_PP(c), FLOAT_Z_DVAL_PP(d), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y)
- );
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_setDepth(int depth)
- Sets this SWFDisplayItem's z-depth to depth. Items with higher depth values are drawn on top of those with lower values */
-PHP_FUNCTION(swfdisplayitem_setDepth)
-{
- zval **depth;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &depth) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(depth);
- SWFDisplayItem_setDepth(getDisplayItem(getThis() TSRMLS_CC), Z_LVAL_PP(depth));
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_setRatio(float ratio)
- Sets this SWFDisplayItem's ratio to ratio. Obviously only does anything if displayitem was created from an SWFMorph */
-PHP_FUNCTION(swfdisplayitem_setRatio)
-{
- zval **ratio;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &ratio) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(ratio);
- SWFDisplayItem_setRatio(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(ratio));
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_addColor(int r, int g, int b [, int a])
- Sets the add color part of this SWFDisplayItem's CXform to (r, g, b [, a]), a defaults to 0 */
-PHP_FUNCTION(swfdisplayitem_addColor)
-{
- zval **r, **g, **b, **za;
- int a = 0;
-
- if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &r, &g, &b, &za) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(za);
- a = Z_LVAL_PP(za);
- } else if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- SWFDisplayItem_setColorAdd(getDisplayItem(getThis() TSRMLS_CC), Z_LVAL_PP(r), Z_LVAL_PP(g), Z_LVAL_PP(b), a);
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_multColor(float r, float g, float b [, float a])
- Sets the multiply color part of this SWFDisplayItem's CXform to (r, g, b [, a]), a defaults to 1.0 */
-PHP_FUNCTION(swfdisplayitem_multColor)
-{
- zval **r, **g, **b, **za;
- float a = 1.0f;
-
- if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &r, &g, &b, &za) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(za);
- a = FLOAT_Z_DVAL_PP(za);
- } else if(ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(r);
- convert_to_double_ex(g);
- convert_to_double_ex(b);
-
- SWFDisplayItem_setColorMult(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(r), FLOAT_Z_DVAL_PP(g), FLOAT_Z_DVAL_PP(b), a);
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_setName(string name)
- Sets this SWFDisplayItem's name to name */
-PHP_FUNCTION(swfdisplayitem_setName)
-{
- zval **name;
- SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(name);
- SWFDisplayItem_setName(item, Z_STRVAL_PP(name));
-}
-/* }}} */
-
-/* {{{ proto void swfdisplayitem_addAction(SWFAction action, int flags)
- Adds this SWFAction to the given SWFSprite instance */
-PHP_FUNCTION(swfdisplayitem_addAction)
-{
- zval **zaction, **flags;
- SWFAction action;
- SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &zaction, &flags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_object_ex(zaction);
- convert_to_long_ex(flags);
- action = (SWFBlock)getAction(*zaction TSRMLS_CC);
- SWFDisplayItem_addAction(item, action, Z_LVAL_PP(flags));
-}
-/* }}} */
-/* }}} */
-
-/* {{{ SWFFill
-*/
-static zend_function_entry swffill_functions[] = {
- PHP_FALIAS(swffill, swffill_init, NULL)
- PHP_FALIAS(moveto, swffill_moveTo, NULL)
- PHP_FALIAS(scaleto, swffill_scaleTo, NULL)
- PHP_FALIAS(rotateto, swffill_rotateTo, NULL)
- PHP_FALIAS(skewxto, swffill_skewXTo, NULL)
- PHP_FALIAS(skewyto, swffill_skewYTo, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto class swffill_init(void)
- Returns a new SWFFill object */
-PHP_FUNCTION(swffill_init)
-{
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Instantiating SWFFill won't do any good- use SWFShape::addFill() instead");
-}
-
-static void destroy_SWFFill_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
-{
- /* this only destroys the shallow wrapper for SWFFillStyle,
- which SWFShape destroys. So everything's okay. I hope. */
-
- destroySWFFill((SWFFill)resource->ptr);
-}
-/* }}} */
-
-/* {{{ internal function getFill
- Returns the SWFFill object contained in zval *id */
-static SWFFill getFill(zval *id TSRMLS_DC)
-{
- void *fill = SWFgetProperty(id, "fill", 4, le_swffillp TSRMLS_CC);
-
- if (!fill) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFFill");
- }
- return (SWFFill)fill;
-}
-/* }}} */
-
-/* {{{ proto void swffill_moveTo(int x, int y)
- Moves this SWFFill to shape coordinates (x,y) */
-PHP_FUNCTION(swffill_moveTo)
-{
- zval **x, **y;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFFill_moveTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
-}
-/* }}} */
-
-/* {{{ proto void swffill_scaleTo(float xScale [, float yScale])
- Scales this SWFFill by xScale in the x direction, yScale in the y, or both to xScale if only one arg */
-PHP_FUNCTION(swffill_scaleTo)
-{
- zval **x, **y;
-
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &x) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- SWFFill_scaleXYTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(x));
- } else if (ZEND_NUM_ARGS() == 2) {
- if (zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFFill_scaleXYTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
- } else {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-/* {{{ proto void swffill_rotateTo(float degrees)
- Rotates this SWFFill the given (clockwise) degrees from its original orientation */
-PHP_FUNCTION(swffill_rotateTo)
-{
- zval **degrees;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &degrees) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(degrees);
- SWFFill_rotateTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(degrees));
-}
-/* }}} */
-
-/* {{{ proto void swffill_skewXTo(float xSkew)
- Sets this SWFFill's x skew value to xSkew */
-PHP_FUNCTION(swffill_skewXTo)
-{
- zval **x;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &x) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- SWFFill_skewXTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x));
-}
-/* }}} */
-
-/* {{{ proto void swffill_skewYTo(float ySkew)
- Sets this SWFFill's y skew value to ySkew */
-PHP_FUNCTION(swffill_skewYTo)
-{
- zval **y;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(y);
- SWFFill_skewYTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(y));
-}
-/* }}} */
-/* }}} */
-
-/* {{{ SWFFont
-*/
-static zend_function_entry swffont_functions[] = {
- PHP_FALIAS(swffont, swffont_init, NULL)
- PHP_FALIAS(getwidth, swffont_getWidth, NULL)
- PHP_FALIAS(getascent, swffont_getAscent, NULL)
- PHP_FALIAS(getdescent, swffont_getDescent, NULL)
- PHP_FALIAS(getleading, swffont_getLeading, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ internal function SWFText getFont(zval *id)
- Returns the Font object in zval *id */
-static SWFFont getFont(zval *id TSRMLS_DC)
-{
- void *font = SWFgetProperty(id, "font", 4, le_swffontp TSRMLS_CC);
-
- if (!font) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFFont");
- }
- return (SWFFont)font;
-}
-/* }}} */
-
-/* {{{ proto class swffont_init(string filename)
- Returns a new SWFFont object from given file */
-PHP_FUNCTION(swffont_init)
-{
- zval **zfile;
- SWFFont font;
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zfile) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(zfile);
-
- if (strcmp(Z_STRVAL_PP(zfile)+Z_STRLEN_PP(zfile)-4, ".fdb") == 0) {
- php_stream * stream;
- FILE * file;
-
- stream = php_stream_open_wrapper(Z_STRVAL_PP(zfile), "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL);
-
- if (stream == NULL) {
- RETURN_FALSE;
- }
-
- if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void*)&file, REPORT_ERRORS)) {
- php_stream_close(stream);
- RETURN_FALSE;
- }
-
- font = loadSWFFontFromFile(file);
- php_stream_close(stream);
- } else {
- font = newSWFBrowserFont(Z_STRVAL_PP(zfile));
- }
-
- ret = zend_list_insert(font, le_swffontp);
-
- object_init_ex(getThis(), &font_class_entry);
- add_property_resource(getThis(), "font", ret);
- zend_list_addref(ret);
-}
-
-static void destroy_SWFFont_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
-{
- destroySWFBlock((SWFBlock)resource->ptr);
-}
-/* }}} */
-
-/* {{{ proto int swffont_getWidth(string)
- Calculates the width of the given string in this font at full height */
-PHP_FUNCTION(swffont_getWidth)
-{
- zval **zstring;
- float width;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(zstring);
- width = SWFFont_getStringWidth(getFont(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring));
- RETURN_DOUBLE(width);
-}
-/* }}} */
-
-/* {{{ proto int swffont_getAscent(void)
- Returns the ascent of the font, or 0 if not available */
-PHP_FUNCTION(swffont_getAscent)
-{
- RETURN_DOUBLE(SWFFont_getAscent(getFont(getThis() TSRMLS_CC)));
-}
-/* }}} */
-
-/* {{{ proto int swffont_getDescent(void)
- Returns the descent of the font, or 0 if not available */
-PHP_FUNCTION(swffont_getDescent)
-{
- RETURN_DOUBLE(SWFFont_getDescent(getFont(getThis() TSRMLS_CC)));
-}
-/* }}} */
-
-/* {{{ proto int swffont_getLeading(void)
- Returns the leading of the font, or 0 if not available */
-PHP_FUNCTION(swffont_getLeading)
-{
- RETURN_DOUBLE(SWFFont_getLeading(getFont(getThis() TSRMLS_CC)));
-}
-/* }}} */
-/* }}} */
-
-/* {{{ SWFGradient
-*/
-static zend_function_entry swfgradient_functions[] = {
- PHP_FALIAS(swfgradient, swfgradient_init, NULL)
- PHP_FALIAS(addentry, swfgradient_addEntry, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto class swfgradient_init(void)
- Returns a new SWFGradient object */
-PHP_FUNCTION(swfgradient_init)
-{
- SWFGradient gradient = newSWFGradient();
- int ret = zend_list_insert(gradient, le_swfgradientp);
-
- object_init_ex(getThis(), &gradient_class_entry);
- add_property_resource(getThis(), "gradient", ret);
- zend_list_addref(ret);
-}
-
-static void destroy_SWFGradient_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
-{
- destroySWFGradient((SWFGradient)resource->ptr);
-}
-/* }}} */
-
-/* {{{ internal function getGradient
- Returns the SWFGradient object contained in zval *id */
-static SWFGradient getGradient(zval *id TSRMLS_DC)
-{
- void *gradient = SWFgetProperty(id, "gradient", 8, le_swfgradientp TSRMLS_CC);
-
- if (!gradient) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFGradient");
- }
- return (SWFGradient)gradient;
-}
-/* }}} */
-
-/* {{{ proto void swfgradient_addEntry(float ratio, string r, string g, string b [, string a])
- Adds given entry to the gradient */
-PHP_FUNCTION(swfgradient_addEntry)
-{
- zval **ratio, **r, **g, **b;
- byte a = 0xff;
-
- if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &ratio, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 5) {
- zval **za;
-
- if (zend_get_parameters_ex(5, &ratio, &r, &g, &b, &za) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(za);
- a = BYTE_Z_LVAL_PP(za);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(ratio);
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- SWFGradient_addEntry( getGradient(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(ratio), BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), a
- );
-}
-/* }}} */
-/* }}} */
-
-/* {{{ SWFMorph
-*/
-static zend_function_entry swfmorph_functions[] = {
- PHP_FALIAS(swfmorph, swfmorph_init, NULL)
- PHP_FALIAS(getshape1, swfmorph_getShape1, NULL)
- PHP_FALIAS(getshape2, swfmorph_getShape2, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto object swfmorph_init(void)
- Returns a new SWFMorph object */
-PHP_FUNCTION(swfmorph_init)
-{
- SWFMorph morph = newSWFMorphShape();
- int ret = zend_list_insert(morph, le_swfmorphp);
-
- object_init_ex(getThis(), &morph_class_entry);
- add_property_resource(getThis(), "morph", ret);
- zend_list_addref(ret);
-}
-
-static void destroy_SWFMorph_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
-{
- destroySWFMorph((SWFMorph)resource->ptr);
-}
-/* }}} */
-
-/* {{{ internal function getMorph
- Returns the SWFMorph object contained in zval *id */
-static SWFMorph getMorph(zval *id TSRMLS_DC)
-{
- void *morph = SWFgetProperty(id, "morph", 5, le_swfmorphp TSRMLS_CC);
-
- if (!morph) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFMorph");
- }
- return (SWFMorph)morph;
-}
-/* }}} */
-
-/* {{{ proto object swfmorph_getShape1(void)
- Return's this SWFMorph's start shape object */
-PHP_FUNCTION(swfmorph_getShape1)
-{
- SWFMorph morph = getMorph(getThis() TSRMLS_CC);
- SWFShape shape = SWFMorph_getShape1(morph);
- int ret = zend_list_insert(shape, le_swfshapep);
-
- object_init_ex(return_value, &shape_class_entry);
- add_property_resource(return_value, "shape", ret);
- zend_list_addref(ret);
-}
-/* }}} */
-
-/* {{{ proto object swfmorph_getShape2(void)
- Return's this SWFMorph's start shape object */
-PHP_FUNCTION(swfmorph_getShape2)
-{
- SWFMorph morph = getMorph(getThis() TSRMLS_CC);
- SWFShape shape = SWFMorph_getShape2(morph);
- int ret = zend_list_insert(shape, le_swfshapep);
-
- object_init_ex(return_value, &shape_class_entry);
- add_property_resource(return_value, "shape", ret);
- zend_list_addref(ret);
-}
-/* }}} */
-/* }}} */
-
-/* {{{ SWFMovie
-*/
-static zend_function_entry swfmovie_functions[] = {
- PHP_FALIAS(swfmovie, swfmovie_init, NULL)
- PHP_FALIAS(nextframe, swfmovie_nextFrame, NULL)
- PHP_FALIAS(labelframe, swfmovie_labelFrame, NULL)
- PHP_FALIAS(add, swfmovie_add, NULL)
- PHP_FALIAS(remove, swfmovie_remove, NULL)
- PHP_FALIAS(output, swfmovie_output, NULL)
- PHP_FALIAS(save, swfmovie_save, NULL)
- PHP_FALIAS(savetofile, swfmovie_saveToFile, NULL)
- PHP_FALIAS(setbackground, swfmovie_setBackground, NULL)
- PHP_FALIAS(setrate, swfmovie_setRate, NULL)
- PHP_FALIAS(setdimension, swfmovie_setDimension, NULL)
- PHP_FALIAS(setframes, swfmovie_setFrames, NULL)
- PHP_FALIAS(streammp3, swfmovie_streamMp3, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ swfmovie_init
-*/
-PHP_FUNCTION(swfmovie_init)
-{
- zval **version;
- SWFMovie movie;
- int ret;
-
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &version) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(version);
- movie = newSWFMovie(Z_LVAL_PP(version));
- } else {
- movie = newSWFMovie(4); /* default version 4 */
- }
-
- ret = zend_list_insert(movie, le_swfmoviep);
-
- object_init_ex(getThis(), &movie_class_entry);
- add_property_resource(getThis(), "movie", ret);
- zend_list_addref(ret);
-}
-
-static void destroy_SWFMovie_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
-{
- destroySWFMovie((SWFMovie)resource->ptr);
-}
-/* }}} */
-
-/* {{{ getMovie
-*/
-static SWFMovie getMovie(zval *id TSRMLS_DC)
-{
- void *movie = SWFgetProperty(id, "movie", 5, le_swfmoviep TSRMLS_CC);
-
- if (!movie) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFMovie");
- }
- return (SWFMovie)movie;
-}
-/* }}} */
-
-/* {{{ swfmovie_nextframe
-*/
-PHP_FUNCTION(swfmovie_nextFrame)
-{
- SWFMovie_nextFrame(getMovie(getThis() TSRMLS_CC));
-}
-/* }}} */
-
-/* {{{ swfmovie_labelframe
-*/
-PHP_FUNCTION(swfmovie_labelFrame)
-{
- zval **label;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &label) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(label);
- SWFMovie_labelFrame(getMovie(getThis() TSRMLS_CC), Z_STRVAL_PP(label));
-}
-/* }}} */
-
-/* {{{ swfmovie_add
-*/
-PHP_FUNCTION(swfmovie_add)
-{
- zval **zchar;
- int ret;
- SWFBlock block;
- SWFDisplayItem item;
- SWFMovie movie = getMovie(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_object_ex(zchar);
-
- /* XXX - SWFMovie_add deals w/ all block types. Probably will need to add that.. */
- if (Z_OBJCE_PP(zchar) == &action_class_entry) {
- block = (SWFBlock) getAction(*zchar TSRMLS_CC);
- } else {
- block = (SWFBlock) getCharacter(*zchar TSRMLS_CC);
- }
-
- item = SWFMovie_add(movie, block);
-
- if(item != NULL) {
- /* try and create a displayitem object */
- ret = zend_list_insert(item, le_swfdisplayitemp);
- object_init_ex(return_value, &displayitem_class_entry);
- add_property_resource(return_value, "displayitem", ret);
- }
-}
-/* }}} */
-
-/* {{{ swfmovie_remove
-*/
-PHP_FUNCTION(swfmovie_remove)
-{
- zval **zchar;
- SWFDisplayItem item;
- SWFMovie movie = getMovie(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_object_ex(zchar);
- item = getDisplayItem(*zchar TSRMLS_CC);
- SWFMovie_remove(movie, item);
-}
-/* }}} */
-
-/* {{{ swfmovie_output
-*/
-static void phpByteOutputMethod(byte b, void *data)
-{
- TSRMLS_FETCH();
-
- php_write(&b, 1 TSRMLS_CC);
-}
-
-PHP_FUNCTION(swfmovie_output)
-{
- SWFMovie movie = getMovie(getThis() TSRMLS_CC);
-
- RETURN_LONG(SWFMovie_output(movie, &phpByteOutputMethod, NULL));
-}
-/* }}} */
-
-/* {{{ swfmovie_saveToFile
-*/
-static void phpStreamOutputMethod(byte b, void * data)
-{
- TSRMLS_FETCH();
-
- php_stream_write((php_stream*)data, &b, 1);
-}
-
-PHP_FUNCTION(swfmovie_saveToFile)
-{
- zval **x;
- SWFMovie movie = getMovie(getThis() TSRMLS_CC);
- php_stream *what;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &x) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- php_stream_from_zval(what, x);
- RETURN_LONG(SWFMovie_output(movie, &phpStreamOutputMethod, what));
-}
-/* }}} */
-
-/* {{{ swfmovie_save
-*/
-PHP_FUNCTION(swfmovie_save)
-{
- zval **x;
- long retval;
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &x) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(x) == IS_RESOURCE) {
- php_stream_from_zval(stream, x);
- RETURN_LONG(SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, stream));
- }
-
- convert_to_string_ex(x);
- stream = php_stream_open_wrapper(Z_STRVAL_PP(x), "wb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL);
-
- if (stream == NULL) {
- RETURN_FALSE;
- }
-
- retval = SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, (void *)stream);
- php_stream_close(stream);
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ swfmovie_setbackground
-*/
-PHP_FUNCTION(swfmovie_setBackground)
-{
- zval **r, **g, **b;
- SWFMovie movie = getMovie(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
- SWFMovie_setBackground(movie, Z_LVAL_PP(r), Z_LVAL_PP(g), Z_LVAL_PP(b));
-}
-/* }}} */
-
-/* {{{ swfmovie_setrate
-*/
-PHP_FUNCTION(swfmovie_setRate)
-{
- zval **rate;
- SWFMovie movie = getMovie(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &rate) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(rate);
- SWFMovie_setRate(movie, FLOAT_Z_DVAL_PP(rate));
-}
-/* }}} */
-
-/* {{{ swfmovie_setDimension
-*/
-PHP_FUNCTION(swfmovie_setDimension)
-{
- zval **x, **y;
- SWFMovie movie = getMovie(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFMovie_setDimension(movie, FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
-}
-/* }}} */
-
-/* {{{ swfmovie_setframes
-*/
-PHP_FUNCTION(swfmovie_setFrames)
-{
- zval **frames;
- SWFMovie movie = getMovie(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &frames) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(frames);
- SWFMovie_setNumberOfFrames(movie, Z_LVAL_PP(frames));
-}
-/* }}} */
-
-/* {{{ swfmovie_streamMp3
-*/
-PHP_FUNCTION(swfmovie_streamMp3)
-{
- zval **zfile;
- SWFSound sound;
- SWFInput input;
- SWFMovie movie = getMovie(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zfile) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(zfile) != IS_RESOURCE) {
- convert_to_string_ex(zfile);
- input = newSWFInput_buffer(Z_STRVAL_PP(zfile), Z_STRLEN_PP(zfile));
- zend_list_addref(zend_list_insert(input, le_swfinputp));
- } else {
- input = getInput(zfile TSRMLS_CC);
- }
-
- sound = newSWFSound_fromInput(input);
- SWFMovie_setSoundStream(movie, sound);
-}
-/* }}} */
-/* }}} */
-
-/* {{{ SWFShape
-*/
-static zend_function_entry swfshape_functions[] = {
- PHP_FALIAS(swfshape, swfshape_init, NULL)
- PHP_FALIAS(setline, swfshape_setline, NULL)
- PHP_FALIAS(addfill, swfshape_addfill, NULL)
- PHP_FALIAS(setleftfill, swfshape_setleftfill, NULL)
- PHP_FALIAS(setrightfill, swfshape_setrightfill, NULL)
- PHP_FALIAS(movepento, swfshape_movepento, NULL)
- PHP_FALIAS(movepen, swfshape_movepen, NULL)
- PHP_FALIAS(drawlineto, swfshape_drawlineto, NULL)
- PHP_FALIAS(drawline, swfshape_drawline, NULL)
- PHP_FALIAS(drawcurveto, swfshape_drawcurveto, NULL)
- PHP_FALIAS(drawcurve, swfshape_drawcurve, NULL)
- PHP_FALIAS(drawglyph, swfshape_drawglyph, NULL)
- PHP_FALIAS(drawcircle, swfshape_drawcircle, NULL)
- PHP_FALIAS(drawarc, swfshape_drawarc, NULL)
- PHP_FALIAS(drawcubic, swfshape_drawcubic, NULL)
- PHP_FALIAS(drawcubicto, swfshape_drawcubicto, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto class swfshape_init(void)
- Returns a new SWFShape object */
-PHP_FUNCTION(swfshape_init)
-{
- SWFShape shape = newSWFShape();
- int ret = zend_list_insert(shape, le_swfshapep);
-
- object_init_ex(getThis(), &shape_class_entry);
- add_property_resource(getThis(), "shape", ret);
- zend_list_addref(ret);
-}
-
-static void destroy_SWFShape_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
-{
- destroySWFShape((SWFShape)resource->ptr);
-}
-/* }}} */
-
-/* {{{ internal function getShape
- Returns the SWFShape object contained in zval *id */
-static SWFShape getShape(zval *id TSRMLS_DC)
-{
- void *shape = SWFgetProperty(id, "shape", 5, le_swfshapep TSRMLS_CC);
-
- if (!shape) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFShape");
- }
- return (SWFShape)shape;
-}
-/* }}} */
-
-/* {{{ proto void swfshape_setline(int width, int r, int g, int b [, int a])
- Sets the current line style for this SWFShape */
-PHP_FUNCTION(swfshape_setline)
-{
- zval **w, **r, **g, **b, **a;
-
- if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &w, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 5) {
- if (zend_get_parameters_ex(5, &w, &r, &g, &b, &a) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(a);
- } else if (ZEND_NUM_ARGS() == 1) {
- SWFShape_setLine(getShape(getThis() TSRMLS_CC), 0, 0, 0, 0, 0);
- return;
- } else {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(w);
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- if (ZEND_NUM_ARGS() == 4) {
- SWFShape_setLine(getShape(getThis() TSRMLS_CC),
- (unsigned short)Z_LVAL_PP(w), BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), 0xff
- );
- } else {
- SWFShape_setLine(getShape(getThis() TSRMLS_CC),
- (unsigned short)Z_LVAL_PP(w), BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), BYTE_Z_LVAL_PP(a)
- );
- }
-}
-/* }}} */
-
-/* {{{ proto int swfshape_addfill(int fill, int flags)
- Returns a fill object, for use with swfshape_setleftfill and swfshape_setrightfill */
-PHP_FUNCTION(swfshape_addfill)
-{
- SWFFill fill=NULL;
- int ret;
-
- if (ZEND_NUM_ARGS() == 1 || ZEND_NUM_ARGS() == 2) {
- /* it's a gradient or bitmap */
- zval **arg1;
- unsigned char flags = 0;
-
- if (ZEND_NUM_ARGS() == 2) {
- zval **arg2;
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg2);
- flags = (unsigned char)Z_LVAL_PP(arg2);
- } else {
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- }
-
- convert_to_object_ex(arg1);
-
- if (Z_OBJCE_PP(arg1) == &gradient_class_entry) {
- if (flags == 0) {
- flags = SWFFILL_LINEAR_GRADIENT;
- }
- fill = SWFShape_addGradientFill(getShape(getThis() TSRMLS_CC), getGradient(*arg1 TSRMLS_CC), flags);
- } else if (Z_OBJCE_PP(arg1) == &bitmap_class_entry) {
- if (flags == 0) {
- flags = SWFFILL_TILED_BITMAP;
- }
- fill = SWFShape_addBitmapFill(getShape(getThis() TSRMLS_CC), getBitmap(*arg1 TSRMLS_CC), flags);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Argument is not a bitmap nor a gradient");
- }
-
- } else if (ZEND_NUM_ARGS() == 3 || ZEND_NUM_ARGS() == 4) {
- /* it's a solid fill */
- zval **r, **g, **b, **za;
- byte a = 0xff;
-
- if (ZEND_NUM_ARGS() == 3) {
- if(zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if(ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &r, &g, &b, &za) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(za);
- a = BYTE_Z_LVAL_PP(za);
- } else {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC), BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), a);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- if (!fill) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error adding fill to shape");
- }
-
- /* return an SWFFill object */
- ret = zend_list_insert(fill, le_swffillp);
- object_init_ex(return_value, &fill_class_entry);
- add_property_resource(return_value, "fill", ret);
-}
-/* }}} */
-
-/* {{{ proto void swfshape_setleftfill(int fill)
- Sets the left side fill style to fill */
-PHP_FUNCTION(swfshape_setleftfill)
-{
- zval **zfill, **r, **g, **b, **a;
- SWFFill fill;
-
- if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC),
- BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), 0xff
- );
-
- } else if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
- convert_to_long_ex(a);
-
- fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC),
- BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), BYTE_Z_LVAL_PP(a)
- );
-
- } else if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &zfill) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_LVAL_PP(zfill) != 0) {
- convert_to_object_ex(zfill);
- fill = getFill(*zfill TSRMLS_CC);
- } else {
- fill = NULL;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-
- SWFShape_setLeftFill(getShape(getThis() TSRMLS_CC), fill);
-}
-/* }}} */
-
-/* {{{ proto void swfshape_setrightfill(int fill)
- Sets the right side fill style to fill */
-PHP_FUNCTION(swfshape_setrightfill)
-{
- zval **zfill, **r, **g, **b, **a;
- SWFFill fill;
-
- if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC),
- BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), 0xff
- );
-
- } else if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
- convert_to_long_ex(a);
-
- fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC),
- BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), BYTE_Z_LVAL_PP(a)
- );
- } else if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &zfill) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if (Z_LVAL_PP(zfill) != 0) {
- convert_to_object_ex(zfill);
- fill = getFill(*zfill TSRMLS_CC);
- } else {
- fill = NULL;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-
- SWFShape_setRightFill(getShape(getThis() TSRMLS_CC), fill);
-}
-/* }}} */
-
-/* {{{ proto void swfshape_movepento(float x, float y)
- Moves the pen to shape coordinates (x, y) */
-PHP_FUNCTION(swfshape_movepento)
-{
- zval **x, **y;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFShape_movePenTo(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
-}
-/* }}} */
-
-/* {{{ proto void swfshape_movepen(float x, float y)
- Moves the pen from its current location by vector (x, y) */
-PHP_FUNCTION(swfshape_movepen)
-{
- zval **x, **y;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFShape_movePen(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
-}
-/* }}} */
-
-/* {{{ proto void swfshape_drawlineto(float x, float y)
- Draws a line from the current pen position to shape coordinates (x, y) in the current line style */
-PHP_FUNCTION(swfshape_drawlineto)
-{
- zval **x, **y;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFShape_drawLineTo(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
-}
-/* }}} */
-
-/* {{{ proto void swfshape_drawline(float dx, float dy)
- Draws a line from the current pen position (x, y) to the point (x+dx, y+dy) in the current line style */
-PHP_FUNCTION(swfshape_drawline)
-{
- zval **x, **y;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFShape_drawLine(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
-}
-/* }}} */
-
-/* {{{ proto void swfshape_drawcurveto(float ax, float ay, float bx, float by [, float dx, float dy])
- Draws a curve from the current pen position (x,y) to the point (bx, by) in the current line style, using point (ax, ay) as a control point. Or draws a cubic bezier to point (dx, dy) with control points (ax, ay) and (bx, by) */
-PHP_FUNCTION(swfshape_drawcurveto)
-{
- if (ZEND_NUM_ARGS() == 4) {
- zval **cx, **cy, **ax, **ay;
-
- if (zend_get_parameters_ex(4, &cx, &cy, &ax, &ay) == FAILURE){
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(ax);
- convert_to_double_ex(ay);
-
- SWFShape_drawCurveTo(getShape(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(ax), FLOAT_Z_DVAL_PP(ay)
- );
-
- } else if (ZEND_NUM_ARGS() == 6) {
- zval **bx, **by, **cx, **cy, **dx, **dy;
-
- if (zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(bx);
- convert_to_double_ex(by);
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(dx);
- convert_to_double_ex(dy);
-
- RETURN_LONG(SWFShape_drawCubicTo(getShape(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(bx), FLOAT_Z_DVAL_PP(by), FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(dx), FLOAT_Z_DVAL_PP(dy))
- );
- } else {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-/* {{{ proto void swfshape_drawcurve(float adx, float ady, float bdx, float bdy [, float cdx, float cdy])
- Draws a curve from the current pen position (x, y) to the point (x+bdx, y+bdy) in the current line style, using point (x+adx, y+ady) as a control point or draws a cubic bezier to point (x+cdx, x+cdy) with control points (x+adx, y+ady) and (x+bdx, y+bdy) */
-PHP_FUNCTION(swfshape_drawcurve)
-{
- if (ZEND_NUM_ARGS() == 4) {
- zval **cx, **cy, **ax, **ay;
-
- if (zend_get_parameters_ex(4, &cx, &cy, &ax, &ay) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(ax);
- convert_to_double_ex(ay);
-
- SWFShape_drawCurve(getShape(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(ax), FLOAT_Z_DVAL_PP(ay)
- );
-
- } else if(ZEND_NUM_ARGS() == 6) {
- zval **bx, **by, **cx, **cy, **dx, **dy;
-
- if (zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(bx);
- convert_to_double_ex(by);
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(dx);
- convert_to_double_ex(dy);
-
- RETURN_LONG( SWFShape_drawCubic(getShape(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(bx), FLOAT_Z_DVAL_PP(by), FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(dx), FLOAT_Z_DVAL_PP(dy))
- );
- } else {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-/* {{{ proto void swfshape_drawglyph(SWFFont font, string character [, int size])
- Draws the first character in the given string into the shape using the glyph definition from the given font */
-PHP_FUNCTION(swfshape_drawglyph)
-{
- zval **font, **c, **zsize;
- int size=0;
-
- if (ZEND_NUM_ARGS() == 2) {
- if (zend_get_parameters_ex(2, &font, &c) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- size = (int)(1024.0f/Ming_getScale());
-
- } else if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &font, &c, &zsize) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(zsize);
- size = Z_LVAL_PP(zsize);
- }
- convert_to_string_ex(c);
- SWFShape_drawSizedGlyph(getShape(getThis() TSRMLS_CC), getFont(*font TSRMLS_CC), Z_STRVAL_PP(c)[0], size);
-}
-/* }}} */
-
-/* {{{ proto void swfshape_drawcircle(int r)
- Draws a circle of radius r centered at the current location, in a counter-clockwise fashion */
-PHP_FUNCTION(swfshape_drawcircle)
-{
- zval **r;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &r) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(r);
- SWFShape_drawCircle(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(r));
-}
-/* }}} */
-
-/* {{{ proto void swfshape_drawarc(int r, float startAngle, float endAngle)
- Draws an arc of radius r centered at the current location, from angle startAngle to angle endAngle measured counterclockwise from 12 o'clock */
-PHP_FUNCTION(swfshape_drawarc)
-{
- zval **r, **start, **end;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &r, &start, &end) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(r);
- convert_to_double_ex(start);
- convert_to_double_ex(end);
-
- /* convert angles to radians, since that's what php uses elsewhere */
- SWFShape_drawArc(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(r), (float)(Z_DVAL_PP(start)*M_PI/180.0), (float)(Z_DVAL_PP(end)*M_PI/180.0));
-}
-/* }}} */
-
-/* {{{ proto void swfshape_drawcubic(float bx, float by, float cx, float cy, float dx, float dy)
- Draws a cubic bezier curve using the current position and the three given points as control points */
-PHP_FUNCTION(swfshape_drawcubic)
-{
- zval **bx, **by, **cx, **cy, **dx, **dy;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(bx);
- convert_to_double_ex(by);
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(dx);
- convert_to_double_ex(dy);
-
- RETURN_LONG( SWFShape_drawCubic(getShape(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(bx), FLOAT_Z_DVAL_PP(by), FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(dx), FLOAT_Z_DVAL_PP(dy))
- );
-}
-/* }}} */
-
-/* {{{ proto void swfshape_drawcubic(float bx, float by, float cx, float cy, float dx, float dy)
- Draws a cubic bezier curve using the current position and the three given points as control points */
-PHP_FUNCTION(swfshape_drawcubicto)
-{
- zval **bx, **by, **cx, **cy, **dx, **dy;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(bx);
- convert_to_double_ex(by);
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(dx);
- convert_to_double_ex(dy);
-
- RETURN_LONG( SWFShape_drawCubicTo(getShape(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(bx), FLOAT_Z_DVAL_PP(by), FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(dx), FLOAT_Z_DVAL_PP(dy))
- );
-}
-/* }}} */
-/* }}} */
-
-/* {{{ SWFSprite
-*/
-static zend_function_entry swfsprite_functions[] = {
- PHP_FALIAS(swfsprite, swfsprite_init, NULL)
- PHP_FALIAS(add, swfsprite_add, NULL)
- PHP_FALIAS(remove, swfsprite_remove, NULL)
- PHP_FALIAS(nextframe, swfsprite_nextFrame, NULL)
- PHP_FALIAS(labelframe, swfsprite_labelFrame, NULL)
- PHP_FALIAS(setframes, swfsprite_setFrames, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto class swfsprite_init(void)
- Returns a new SWFSprite object */
-PHP_FUNCTION(swfsprite_init)
-{
- SWFMovieClip sprite = newSWFMovieClip();
- int ret = zend_list_insert(sprite, le_swfspritep);
-
- object_init_ex(getThis(), &sprite_class_entry);
- add_property_resource(getThis(), "sprite", ret);
- zend_list_addref(ret);
-}
-
-static void destroy_SWFSprite_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
-{
- destroySWFMovieClip((SWFMovieClip)resource->ptr);
-}
-/* }}} */
-
-/* {{{ internal function SWFSprite getSprite(zval *id)
- Returns the SWFSprite object in zval *id */
-static SWFMovieClip getSprite(zval *id TSRMLS_DC)
-{
- void *sprite = SWFgetProperty(id, "sprite", 6, le_swfspritep TSRMLS_CC);
-
- if (!sprite) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFSprite");
- }
- return (SWFMovieClip)sprite;
-}
-/* }}} */
-
-/* {{{ proto object swfsprite_add(SWFCharacter)
- Adds the character to the sprite, returns a displayitem object */
-PHP_FUNCTION(swfsprite_add)
-{
- zval **zchar;
- int ret;
- SWFBlock block;
- SWFDisplayItem item;
- SWFMovieClip sprite = getSprite(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_object_ex(zchar);
-
- if (Z_OBJCE_PP(zchar) == &action_class_entry) {
- block = (SWFBlock)getAction(*zchar TSRMLS_CC);
- } else {
- block = (SWFBlock)getCharacter(*zchar TSRMLS_CC);
- }
-
- item = SWFMovieClip_add(sprite, block);
-
- if (item != NULL) {
- /* try and create a displayitem object */
- ret = zend_list_insert(item, le_swfdisplayitemp);
- object_init_ex(return_value, &displayitem_class_entry);
- add_property_resource(return_value, "displayitem", ret);
- }
-}
-/* }}} */
-
-/* {{{ proto void swfsprite_remove(SWFDisplayItem)
- Remove the named character from the sprite's display list */
-PHP_FUNCTION(swfsprite_remove)
-{
- zval **zchar;
- SWFDisplayItem item;
- SWFMovieClip movie = getSprite(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_object_ex(zchar);
- item = getDisplayItem(*zchar TSRMLS_CC);
- SWFMovieClip_remove(movie, item);
-}
-/* }}} */
-
-/* {{{ proto void swfsprite_nextFrame(void)
- Moves the sprite to the next frame */
-PHP_FUNCTION(swfsprite_nextFrame)
-{
- SWFMovieClip_nextFrame(getSprite(getThis() TSRMLS_CC));
-}
-/* }}} */
-
-/* {{{ swfmovie_labelframe
-*/
-PHP_FUNCTION(swfsprite_labelFrame)
-{
- zval **label;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &label) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(label);
- SWFMovieClip_labelFrame(getSprite(getThis() TSRMLS_CC), Z_STRVAL_PP(label));
-}
-/* }}} */
-
-/* {{{ proto void swfsprite_setFrames(int frames)
- Sets the number of frames in this SWFSprite */
-PHP_FUNCTION(swfsprite_setFrames)
-{
- zval **frames;
- SWFMovieClip sprite = getSprite(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &frames) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(frames);
- SWFMovieClip_setNumberOfFrames(sprite, Z_LVAL_PP(frames));
-}
-/* }}} */
-/* }}} */
-
-/* {{{ SWFText
-*/
-static zend_function_entry swftext_functions[] = {
- PHP_FALIAS(swftext, swftext_init, NULL)
- PHP_FALIAS(setfont, swftext_setFont, NULL)
- PHP_FALIAS(setheight, swftext_setHeight, NULL)
- PHP_FALIAS(setspacing, swftext_setSpacing, NULL)
- PHP_FALIAS(setcolor, swftext_setColor, NULL)
- PHP_FALIAS(moveto, swftext_moveTo, NULL)
- PHP_FALIAS(addstring, swftext_addString, NULL)
- PHP_FALIAS(getwidth, swftext_getWidth, NULL)
- PHP_FALIAS(getascent, swftext_getAscent, NULL)
- PHP_FALIAS(getdescent, swftext_getDescent, NULL)
- PHP_FALIAS(getleading, swftext_getLeading, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto class swftext_init(void)
- Returns new SWFText object */
-PHP_FUNCTION(swftext_init)
-{
- SWFText text = newSWFText2();
- int ret = zend_list_insert(text, le_swftextp);
-
- object_init_ex(getThis(), &text_class_entry);
- add_property_resource(getThis(), "text", ret);
- zend_list_addref(ret);
-}
-
-static void destroy_SWFText_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
-{
- destroySWFText((SWFText)resource->ptr);
-}
-/* }}} */
-
-/* {{{ internal function SWFText getText(zval *id)
- Returns the SWFText contained in zval *id */
-static SWFText getText(zval *id TSRMLS_DC)
-{
- void *text = SWFgetProperty(id, "text", 4, le_swftextp TSRMLS_CC);
-
- if (!text) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFText");
- }
- return (SWFText)text;
-}
-/* }}} */
-
-/* {{{ proto void swftext_setFont(class font)
- Sets this SWFText object's current font to given font */
-PHP_FUNCTION(swftext_setFont)
-{
- zval **zfont;
- SWFText text = getText(getThis() TSRMLS_CC);
- SWFFont font;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zfont) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_object_ex(zfont);
- font = getFont(*zfont TSRMLS_CC);
- SWFText_setFont(text, font);
-}
-/* }}} */
-
-/* {{{ proto void swftext_setHeight(float height)
- Sets this SWFText object's current height to given height */
-PHP_FUNCTION(swftext_setHeight)
-{
- zval **height;
- SWFText text = getText(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &height) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(height);
- SWFText_setHeight(text, FLOAT_Z_DVAL_PP(height));
-}
-/* }}} */
-
-/* {{{ proto void swftext_setSpacing(float spacing)
- Sets this SWFText object's current letterspacing to given spacing */
-PHP_FUNCTION(swftext_setSpacing)
-{
- zval **spacing;
- SWFText text = getText(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &spacing) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(spacing);
- SWFText_setSpacing(text, FLOAT_Z_DVAL_PP(spacing));
-}
-/* }}} */
-
-/* {{{ proto void swftext_setColor(int r, int g, int b [, int a])
- Sets this SWFText object's current color to the given color */
-PHP_FUNCTION(swftext_setColor)
-{
- zval **r, **g, **b, **a;
- SWFText text = getText(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(a);
- } else {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- if (ZEND_NUM_ARGS() == 4) {
- SWFText_setColor(text, BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), BYTE_Z_LVAL_PP(a));
- } else {
- SWFText_setColor(text, BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), 0xff);
- }
-}
-/* }}} */
-
-/* {{{ proto void swftext_moveTo(float x, float y)
- Moves this SWFText object's current pen position to (x, y) in text coordinates */
-PHP_FUNCTION(swftext_moveTo)
-{
- zval **x, **y;
- SWFText text = getText(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFText_setXY(text, FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
-}
-/* }}} */
-
-/* {{{ proto void swftext_addString(string text)
- Writes the given text into this SWFText object at the current pen position, using the current font, height, spacing, and color */
-PHP_FUNCTION(swftext_addString)
-{
- zval **s;
- SWFText text = getText(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &s) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(s);
- SWFText_addString(text, Z_STRVAL_PP(s), NULL);
-}
-/* }}} */
-
-/* {{{ proto float swftext_getWidth(string str)
- Calculates the width of the given string in this text objects current font and size */
-PHP_FUNCTION(swftext_getWidth)
-{
- zval **zstring;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(zstring);
- RETURN_DOUBLE(SWFText_getStringWidth(getText(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring)));
-}
-/* }}} */
-
-/* {{{ proto float swftext_getAscent(void)
- Returns the ascent of the current font at its current size, or 0 if not available */
-PHP_FUNCTION(swftext_getAscent)
-{
- RETURN_DOUBLE(SWFText_getAscent(getText(getThis() TSRMLS_CC)));
-}
-/* }}} */
-
-/* {{{ proto float swftext_getDescent(void)
- Returns the descent of the current font at its current size, or 0 if not available */
-PHP_FUNCTION(swftext_getDescent)
-{
- RETURN_DOUBLE(SWFText_getDescent(getText(getThis() TSRMLS_CC)));
-}
-/* }}} */
-
-/* {{{ proto float swftext_getLeading(void)
- Returns the leading of the current font at its current size, or 0 if not available */
-PHP_FUNCTION(swftext_getLeading)
-{
- RETURN_DOUBLE(SWFText_getLeading(getText(getThis() TSRMLS_CC)));
-}
-/* }}} */
-/* }}} */
-
-/* {{{ SWFTextField
-*/
-static zend_function_entry swftextfield_functions[] = {
- PHP_FALIAS(swftextfield, swftextfield_init, NULL)
- PHP_FALIAS(setfont, swftextfield_setFont, NULL)
- PHP_FALIAS(setbounds, swftextfield_setBounds, NULL)
- PHP_FALIAS(align, swftextfield_align, NULL)
- PHP_FALIAS(setheight, swftextfield_setHeight, NULL)
- PHP_FALIAS(setleftmargin, swftextfield_setLeftMargin, NULL)
- PHP_FALIAS(setrightmargin, swftextfield_setRightMargin, NULL)
- PHP_FALIAS(setmargins, swftextfield_setMargins, NULL)
- PHP_FALIAS(setindentation, swftextfield_setIndentation, NULL)
- PHP_FALIAS(setlinespacing, swftextfield_setLineSpacing, NULL)
- PHP_FALIAS(setcolor, swftextfield_setColor, NULL)
- PHP_FALIAS(setname, swftextfield_setName, NULL)
- PHP_FALIAS(addstring, swftextfield_addString, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto object swftextfield_init([int flags])
- Returns a new SWFTextField object */
-PHP_FUNCTION(swftextfield_init)
-{
- zval **flags;
- SWFTextField field = newSWFTextField();
- int ret = zend_list_insert(field, le_swftextfieldp);
-
- object_init_ex(getThis(), &textfield_class_entry);
- add_property_resource(getThis(), "textfield", ret);
- zend_list_addref(ret);
-
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &flags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(flags);
- SWFTextField_setFlags(field, Z_LVAL_PP(flags));
- }
-}
-
-static void destroy_SWFTextField_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
-{
- destroySWFTextField((SWFTextField)resource->ptr);
-}
-/* }}} */
-
-/* {{{ internal function getTextField
- Returns the SWFTextField object contained in zval *id */
-static SWFTextField getTextField(zval *id TSRMLS_DC)
-{
- void *field = SWFgetProperty(id, "textfield", 9, le_swftextfieldp TSRMLS_CC);
-
- if (!field) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFTextField");
- }
- return (SWFTextField)field;
-}
-/* }}} */
-
-/* {{{ proto void swftextfield_setFont(int font)
- Sets the font for this textfield */
-PHP_FUNCTION(swftextfield_setFont)
-{
- zval **font;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &font) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_object_ex(font);
- SWFTextField_setFont(field, getFont(*font TSRMLS_CC));
-}
-/* }}} */
-
-/* {{{ proto void swftextfield_setBounds(float width, float height)
- Sets the width and height of this textfield */
-PHP_FUNCTION(swftextfield_setBounds)
-{
- zval **width, **height;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &width, &height) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(width);
- convert_to_double_ex(height);
- SWFTextField_setBounds(field, FLOAT_Z_DVAL_PP(width), FLOAT_Z_DVAL_PP(height));
-}
-/* }}} */
-
-/* {{{ proto void swftextfield_align(int alignment)
- Sets the alignment of this textfield */
-PHP_FUNCTION(swftextfield_align)
-{
- zval **align;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &align) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(align);
- SWFTextField_setAlignment(field, Z_LVAL_PP(align));
-}
-/* }}} */
-
-/* {{{ proto void swftextfield_setHeight(float height)
- Sets the font height of this textfield */
-PHP_FUNCTION(swftextfield_setHeight)
-{
- zval **height;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &height) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(height);
- SWFTextField_setHeight(field, FLOAT_Z_DVAL_PP(height));
-}
-/* }}} */
-
-/* {{{ proto void swftextfield_setLeftMargin(float)
- Sets the left margin of this textfield */
-PHP_FUNCTION(swftextfield_setLeftMargin)
-{
- zval **margin;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &margin) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(margin);
- SWFTextField_setLeftMargin(field, FLOAT_Z_DVAL_PP(margin));
-}
-/* }}} */
-
-/* {{{ proto void swftextfield_setRightMargin(float margin)
- Sets the right margin of this textfield */
-PHP_FUNCTION(swftextfield_setRightMargin)
-{
- zval **margin;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &margin) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(margin);
- SWFTextField_setRightMargin(field, FLOAT_Z_DVAL_PP(margin));
-}
-/* }}} */
-
-/* {{{ proto void swftextfield_setMargins(float left, float right)
- Sets both margins of this textfield */
-PHP_FUNCTION(swftextfield_setMargins)
-{
- zval **left, **right;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &left, &right) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(left);
- convert_to_double_ex(right);
- SWFTextField_setLeftMargin(field, FLOAT_Z_DVAL_PP(left));
- SWFTextField_setRightMargin(field, FLOAT_Z_DVAL_PP(right));
-}
-/* }}} */
-
-/* {{{ proto void swftextfield_setIndentation(float indentation)
- Sets the indentation of the first line of this textfield */
-PHP_FUNCTION(swftextfield_setIndentation)
-{
- zval **indent;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &indent) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(indent);
- SWFTextField_setIndentation(field, FLOAT_Z_DVAL_PP(indent));
-}
-/* }}} */
-
-/* {{{ proto void swftextfield_setLineSpacing(float space)
- Sets the line spacing of this textfield */
-PHP_FUNCTION(swftextfield_setLineSpacing)
-{
- zval **spacing;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &spacing) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(spacing);
- SWFTextField_setLineSpacing(field, FLOAT_Z_DVAL_PP(spacing));
-}
-/* }}} */
-
-/* {{{ proto void swftextfield_setColor(int r, int g, int b [, int a])
- Sets the color of this textfield */
-PHP_FUNCTION(swftextfield_setColor)
-{
- zval **r, **g, **b, **a;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
- byte alpha = 0xff;
-
- if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(a);
- alpha = BYTE_Z_LVAL_PP(a);
- } else {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
- SWFTextField_setColor(field, BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), (byte)alpha);
-}
-/* }}} */
-
-/* {{{ proto void swftextfield_setName(string var_name)
- Sets the variable name of this textfield */
-PHP_FUNCTION(swftextfield_setName)
-{
- zval **name;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(name);
- SWFTextField_setVariableName(field, Z_STRVAL_PP(name));
-}
-/* }}} */
-
-/* {{{ proto void swftextfield_addString(string str)
- Adds the given string to this textfield */
-PHP_FUNCTION(swftextfield_addString)
-{
- zval **string;
- SWFTextField field = getTextField(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &string) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(string);
- SWFTextField_addString(field, Z_STRVAL_PP(string));
-}
-/* }}} */
-/* }}} */
-
-zend_module_entry ming_module_entry = {
- STANDARD_MODULE_HEADER,
- "ming",
- ming_functions,
- PHP_MINIT(ming), /* module init function */
- NULL, /* module shutdown function */
- PHP_RINIT(ming), /* request init function */
- NULL, /* request shutdown function */
- PHP_MINFO(ming), /* module info function */
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_MING
-ZEND_GET_MODULE(ming)
-#endif
-
-/* {{{ todo PHP_MINFO_FUNCTION(ming)
-*/
-PHP_MINFO_FUNCTION(ming)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Ming SWF output library", "enabled");
- php_info_print_table_row(2, "Version", MING_VERSION_TEXT);
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ todo PHP_MINIT_FUNCTION(ming)
-*/
-
-/* custom error handler propagates ming errors up to php */
-static void php_ming_error(char *msg, ...)
-{
- va_list args;
- char *buffer;
-
- TSRMLS_FETCH();
-
- va_start(args, msg);
- vspprintf(&buffer, 0, msg, args);
- va_end(args);
-
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "%s", buffer);
- efree(buffer);
-}
-
-PHP_RINIT_FUNCTION(ming)
-{
- /* XXX - this didn't work so well last I tried.. */
-
- if (Ming_init() != 0) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error initializing Ming module");
- return FAILURE;
- }
- return SUCCESS;
-}
-
-PHP_MINIT_FUNCTION(ming)
-{
- Ming_setErrorFunction(php_ming_error);
-
-#define CONSTANT(s,c) REGISTER_LONG_CONSTANT((s), (c), CONST_CS | CONST_PERSISTENT)
-
- /* flags for SWFButton_addShape */
- CONSTANT("SWFBUTTON_HIT", SWFBUTTONRECORD_HITSTATE);
- CONSTANT("SWFBUTTON_DOWN", SWFBUTTONRECORD_DOWNSTATE);
- CONSTANT("SWFBUTTON_OVER", SWFBUTTONRECORD_OVERSTATE);
- CONSTANT("SWFBUTTON_UP", SWFBUTTONRECORD_UPSTATE);
-
- /* flags for SWFButton_addAction */
- CONSTANT("SWFBUTTON_MOUSEUPOUTSIDE", SWFBUTTON_MOUSEUPOUTSIDE);
- CONSTANT("SWFBUTTON_DRAGOVER", SWFBUTTON_DRAGOVER);
- CONSTANT("SWFBUTTON_DRAGOUT", SWFBUTTON_DRAGOUT);
- CONSTANT("SWFBUTTON_MOUSEUP", SWFBUTTON_MOUSEUP);
- CONSTANT("SWFBUTTON_MOUSEDOWN", SWFBUTTON_MOUSEDOWN);
- CONSTANT("SWFBUTTON_MOUSEOUT", SWFBUTTON_MOUSEOUT);
- CONSTANT("SWFBUTTON_MOUSEOVER", SWFBUTTON_MOUSEOVER);
-
- /* flags for SWFFill */
- CONSTANT("SWFFILL_RADIAL_GRADIENT", SWFFILL_RADIAL_GRADIENT);
- CONSTANT("SWFFILL_LINEAR_GRADIENT", SWFFILL_LINEAR_GRADIENT);
- CONSTANT("SWFFILL_TILED_BITMAP", SWFFILL_TILED_BITMAP);
- CONSTANT("SWFFILL_CLIPPED_BITMAP", SWFFILL_CLIPPED_BITMAP);
-
- /* flags for SWFTextField_init */
- CONSTANT("SWFTEXTFIELD_HASLENGTH", SWFTEXTFIELD_HASLENGTH);
- CONSTANT("SWFTEXTFIELD_NOEDIT", SWFTEXTFIELD_NOEDIT);
- CONSTANT("SWFTEXTFIELD_PASSWORD", SWFTEXTFIELD_PASSWORD);
- CONSTANT("SWFTEXTFIELD_MULTILINE", SWFTEXTFIELD_MULTILINE);
- CONSTANT("SWFTEXTFIELD_WORDWRAP", SWFTEXTFIELD_WORDWRAP);
- CONSTANT("SWFTEXTFIELD_DRAWBOX", SWFTEXTFIELD_DRAWBOX);
- CONSTANT("SWFTEXTFIELD_NOSELECT", SWFTEXTFIELD_NOSELECT);
- CONSTANT("SWFTEXTFIELD_HTML", SWFTEXTFIELD_HTML);
-
- /* flags for SWFTextField_align */
- CONSTANT("SWFTEXTFIELD_ALIGN_LEFT", SWFTEXTFIELD_ALIGN_LEFT);
- CONSTANT("SWFTEXTFIELD_ALIGN_RIGHT", SWFTEXTFIELD_ALIGN_RIGHT);
- CONSTANT("SWFTEXTFIELD_ALIGN_CENTER", SWFTEXTFIELD_ALIGN_CENTER);
- CONSTANT("SWFTEXTFIELD_ALIGN_JUSTIFY", SWFTEXTFIELD_ALIGN_JUSTIFY);
-
- /* flags for SWFDisplayItem_addAction */
- CONSTANT("SWFACTION_ONLOAD", SWFACTION_ONLOAD);
- CONSTANT("SWFACTION_ENTERFRAME", SWFACTION_ENTERFRAME);
- CONSTANT("SWFACTION_UNLOAD", SWFACTION_UNLOAD);
- CONSTANT("SWFACTION_MOUSEMOVE", SWFACTION_MOUSEMOVE);
- CONSTANT("SWFACTION_MOUSEDOWN", SWFACTION_MOUSEDOWN);
- CONSTANT("SWFACTION_MOUSEUP", SWFACTION_MOUSEUP);
- CONSTANT("SWFACTION_KEYDOWN", SWFACTION_KEYDOWN);
- CONSTANT("SWFACTION_KEYUP", SWFACTION_KEYUP);
- CONSTANT("SWFACTION_DATA", SWFACTION_DATA);
-
- le_swfmoviep = zend_register_list_destructors_ex(destroy_SWFMovie_resource, NULL, "SWFMovie", module_number);
- le_swfshapep = zend_register_list_destructors_ex(destroy_SWFShape_resource, NULL, "SWFShape", module_number);
- le_swffillp = zend_register_list_destructors_ex(destroy_SWFFill_resource, NULL, "SWFFill", module_number);
- le_swfgradientp = zend_register_list_destructors_ex(destroy_SWFGradient_resource, NULL, "SWFGradient", module_number);
- le_swfbitmapp = zend_register_list_destructors_ex(destroy_SWFBitmap_resource, NULL, "SWFBitmap", module_number);
- le_swftextp = zend_register_list_destructors_ex(destroy_SWFText_resource, NULL, "SWFText", module_number);
- le_swftextfieldp = zend_register_list_destructors_ex(destroy_SWFTextField_resource, NULL, "SWFTextField", module_number);
- le_swffontp = zend_register_list_destructors_ex(destroy_SWFFont_resource, NULL, "SWFFont", module_number);
- le_swfbuttonp = zend_register_list_destructors_ex(destroy_SWFButton_resource, NULL, "SWFButton", module_number);
- le_swfmorphp = zend_register_list_destructors_ex(destroy_SWFMorph_resource, NULL, "SWFMorph", module_number);
- le_swfspritep = zend_register_list_destructors_ex(destroy_SWFSprite_resource, NULL, "SWFSprite", module_number);
- le_swfdisplayitemp = zend_register_list_destructors_ex(NULL, NULL, "SWFDisplayItem", module_number);
- le_swfactionp = zend_register_list_destructors_ex(NULL, NULL, "SWFAction", module_number);
- le_swfinputp = zend_register_list_destructors_ex(destroy_SWFInput_resource, NULL, "SWFInput", module_number);
-
- INIT_CLASS_ENTRY(shape_class_entry, "swfshape", swfshape_functions);
- INIT_CLASS_ENTRY(fill_class_entry, "swffill", swffill_functions);
- INIT_CLASS_ENTRY(gradient_class_entry, "swfgradient", swfgradient_functions);
- INIT_CLASS_ENTRY(bitmap_class_entry, "swfbitmap", swfbitmap_functions);
- INIT_CLASS_ENTRY(text_class_entry, "swftext", swftext_functions);
- INIT_CLASS_ENTRY(textfield_class_entry, "swftextfield", swftextfield_functions);
- INIT_CLASS_ENTRY(font_class_entry, "swffont", swffont_functions);
- INIT_CLASS_ENTRY(displayitem_class_entry, "swfdisplayitem", swfdisplayitem_functions);
- INIT_CLASS_ENTRY(movie_class_entry, "swfmovie", swfmovie_functions);
- INIT_CLASS_ENTRY(button_class_entry, "swfbutton", swfbutton_functions);
- INIT_CLASS_ENTRY(action_class_entry, "swfaction", swfaction_functions);
- INIT_CLASS_ENTRY(morph_class_entry, "swfmorph", swfmorph_functions);
- INIT_CLASS_ENTRY(sprite_class_entry, "swfsprite", swfsprite_functions);
-
- zend_register_internal_class(&shape_class_entry TSRMLS_CC);
- zend_register_internal_class(&fill_class_entry TSRMLS_CC);
- zend_register_internal_class(&gradient_class_entry TSRMLS_CC);
- zend_register_internal_class(&bitmap_class_entry TSRMLS_CC);
- zend_register_internal_class(&text_class_entry TSRMLS_CC);
- zend_register_internal_class(&textfield_class_entry TSRMLS_CC);
- zend_register_internal_class(&font_class_entry TSRMLS_CC);
- zend_register_internal_class(&displayitem_class_entry TSRMLS_CC);
- zend_register_internal_class(&movie_class_entry TSRMLS_CC);
- zend_register_internal_class(&button_class_entry TSRMLS_CC);
- zend_register_internal_class(&action_class_entry TSRMLS_CC);
- zend_register_internal_class(&morph_class_entry TSRMLS_CC);
- zend_register_internal_class(&sprite_class_entry TSRMLS_CC);
-
- return SUCCESS;
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/ming/ming.dsp b/ext/ming/ming.dsp
deleted file mode 100644
index af72ff2522..0000000000
--- a/ext/ming/ming.dsp
+++ /dev/null
@@ -1,107 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ming" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ming - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ming.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ming.mak" CFG="ming - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ming - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ming - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ming - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MING_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /I "..\..\..\bindlib_w32" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_MING" /D "HAVE_MING" /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZTS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib libming.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ming.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ming - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MING_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /I "..\..\..\bindlib_w32" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_MING" /D "ZEND_WIN32" /D "PHP_WIN32" /D "HAVE_MING" /D ZTS=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib libming.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ming.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "ming - Win32 Release_TS"
-# Name "ming - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ming.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_ming.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/ming/php_ming.h b/ext/ming/php_ming.h
deleted file mode 100644
index ae08142e18..0000000000
--- a/ext/ming/php_ming.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_01.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: dave@opaque.net |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _PHP_MING_H
-#define _PHP_MING_H
-
-#if HAVE_MING
-
-extern zend_module_entry ming_module_entry;
-#define ming_module_ptr &ming_module_entry
-
-#include <ming.h>
-
-PHP_RINIT_FUNCTION(ming);
-PHP_MINIT_FUNCTION(ming);
-PHP_MINFO_FUNCTION(ming);
-
-PHP_FUNCTION(swfbitmap_init);
-PHP_FUNCTION(swfbitmap_getWidth);
-PHP_FUNCTION(swfbitmap_getHeight);
-
-PHP_FUNCTION(swffill_init);
-PHP_FUNCTION(swffill_moveTo);
-PHP_FUNCTION(swffill_scaleTo);
-PHP_FUNCTION(swffill_rotateTo);
-PHP_FUNCTION(swffill_skewXTo);
-PHP_FUNCTION(swffill_skewYTo);
-
-PHP_FUNCTION(swfgradient_init);
-PHP_FUNCTION(swfgradient_addEntry);
-
-PHP_FUNCTION(swfshape_init);
-PHP_FUNCTION(swfshape_addfill);
-PHP_FUNCTION(swfshape_setrightfill);
-PHP_FUNCTION(swfshape_setleftfill);
-PHP_FUNCTION(swfshape_setline);
-PHP_FUNCTION(swfshape_movepento);
-PHP_FUNCTION(swfshape_movepen);
-PHP_FUNCTION(swfshape_drawlineto);
-PHP_FUNCTION(swfshape_drawline);
-PHP_FUNCTION(swfshape_drawcurveto);
-PHP_FUNCTION(swfshape_drawcurve);
-PHP_FUNCTION(swfshape_drawglyph);
-PHP_FUNCTION(swfshape_drawarc);
-PHP_FUNCTION(swfshape_drawcircle);
-PHP_FUNCTION(swfshape_drawcubic);
-PHP_FUNCTION(swfshape_drawcubicto);
-
-PHP_FUNCTION(swfmovie_init);
-PHP_FUNCTION(swfmovie_output);
-PHP_FUNCTION(swfmovie_saveToFile);
-PHP_FUNCTION(swfmovie_save);
-PHP_FUNCTION(swfmovie_add);
-PHP_FUNCTION(swfmovie_remove);
-PHP_FUNCTION(swfmovie_nextFrame);
-PHP_FUNCTION(swfmovie_labelFrame);
-PHP_FUNCTION(swfmovie_setBackground);
-PHP_FUNCTION(swfmovie_setRate);
-PHP_FUNCTION(swfmovie_setDimension);
-PHP_FUNCTION(swfmovie_setFrames);
-PHP_FUNCTION(swfmovie_streamMp3);
-
-PHP_FUNCTION(swfsprite_init);
-PHP_FUNCTION(swfsprite_add);
-PHP_FUNCTION(swfsprite_remove);
-PHP_FUNCTION(swfsprite_nextFrame);
-PHP_FUNCTION(swfsprite_labelFrame);
-PHP_FUNCTION(swfsprite_setFrames);
-
-PHP_FUNCTION(swffont_init);
-PHP_FUNCTION(swffont_getWidth);
-PHP_FUNCTION(swffont_getAscent);
-PHP_FUNCTION(swffont_getDescent);
-PHP_FUNCTION(swffont_getLeading);
-
-PHP_FUNCTION(swftext_init);
-PHP_FUNCTION(swftext_setFont);
-PHP_FUNCTION(swftext_setHeight);
-PHP_FUNCTION(swftext_setSpacing);
-PHP_FUNCTION(swftext_setColor);
-PHP_FUNCTION(swftext_moveTo);
-PHP_FUNCTION(swftext_addString);
-PHP_FUNCTION(swftext_getWidth);
-PHP_FUNCTION(swftext_getAscent);
-PHP_FUNCTION(swftext_getDescent);
-PHP_FUNCTION(swftext_getLeading);
-
-PHP_FUNCTION(swftextfield_init);
-PHP_FUNCTION(swftextfield_setFont);
-PHP_FUNCTION(swftextfield_setBounds);
-PHP_FUNCTION(swftextfield_align);
-PHP_FUNCTION(swftextfield_setHeight);
-PHP_FUNCTION(swftextfield_setLeftMargin);
-PHP_FUNCTION(swftextfield_setRightMargin);
-PHP_FUNCTION(swftextfield_setMargins);
-PHP_FUNCTION(swftextfield_setIndentation);
-PHP_FUNCTION(swftextfield_setLineSpacing);
-PHP_FUNCTION(swftextfield_setColor);
-PHP_FUNCTION(swftextfield_setName);
-PHP_FUNCTION(swftextfield_addString);
-
-PHP_FUNCTION(swfdisplayitem_move);
-PHP_FUNCTION(swfdisplayitem_moveTo);
-PHP_FUNCTION(swfdisplayitem_scale);
-PHP_FUNCTION(swfdisplayitem_scaleTo);
-PHP_FUNCTION(swfdisplayitem_rotate);
-PHP_FUNCTION(swfdisplayitem_rotateTo);
-PHP_FUNCTION(swfdisplayitem_skewX);
-PHP_FUNCTION(swfdisplayitem_skewXTo);
-PHP_FUNCTION(swfdisplayitem_skewY);
-PHP_FUNCTION(swfdisplayitem_skewYTo);
-PHP_FUNCTION(swfdisplayitem_setMatrix);
-PHP_FUNCTION(swfdisplayitem_setDepth);
-PHP_FUNCTION(swfdisplayitem_setRatio);
-PHP_FUNCTION(swfdisplayitem_addColor);
-PHP_FUNCTION(swfdisplayitem_multColor);
-PHP_FUNCTION(swfdisplayitem_setName);
-PHP_FUNCTION(swfdisplayitem_addAction);
-
-PHP_FUNCTION(swfbutton_init);
-PHP_FUNCTION(swfbutton_setHit);
-PHP_FUNCTION(swfbutton_setOver);
-PHP_FUNCTION(swfbutton_setUp);
-PHP_FUNCTION(swfbutton_setDown);
-PHP_FUNCTION(swfbutton_setAction);
-PHP_FUNCTION(swfbutton_addShape);
-PHP_FUNCTION(swfbutton_addAction);
-
-PHP_FUNCTION(swfbutton_keypress);
-
-PHP_FUNCTION(swfaction_init);
-
-PHP_FUNCTION(swfmorph_init);
-PHP_FUNCTION(swfmorph_getShape1);
-PHP_FUNCTION(swfmorph_getShape2);
-
-PHP_FUNCTION(ming_setCubicThreshold);
-PHP_FUNCTION(ming_setScale);
-PHP_FUNCTION(ming_useSWFVersion);
-
-#else
-#define ming_module_ptr NULL
-#endif /* HAVE_MING */
-#define phpext_ming_ptr ming_module_ptr
-#endif /* _PHP_MING_H */
diff --git a/ext/mnogosearch/CREDITS b/ext/mnogosearch/CREDITS
deleted file mode 100644
index 3ab998a1da..0000000000
--- a/ext/mnogosearch/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-mnoGoSearch
-Sergey Kartashoff, Alex Barkov, Ramil Kalimullin
diff --git a/ext/mnogosearch/README b/ext/mnogosearch/README
deleted file mode 100644
index 8151c949f7..0000000000
--- a/ext/mnogosearch/README
+++ /dev/null
@@ -1,11 +0,0 @@
-$Source$
-$Id$
-
-mnoGoSearch extension module for PHP4.
-
-For details please refer to http://www.mnogosearch.org/
-
-If used with mysql you should not use bundled mysql library
-in the php distribution. You should use native mysql
-library. To do this you should compile php with specefying mysql-dir
-(for example --with-mysql=/usr, not --with-mysql).
diff --git a/ext/mnogosearch/config.m4 b/ext/mnogosearch/config.m4
deleted file mode 100644
index d029412440..0000000000
--- a/ext/mnogosearch/config.m4
+++ /dev/null
@@ -1,54 +0,0 @@
-dnl
-dnl $Source$
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(mnogosearch,for mnoGoSearch support,
-[ --with-mnogosearch[=DIR]
- Include mnoGoSearch support. DIR is the mnoGoSearch
- base install directory, defaults to
- /usr/local/mnogosearch.])
-
- if test "$PHP_MNOGOSEARCH" != "no"; then
-
- if test "$PHP_MNOGOSEARCH" = "yes"; then
- MNOGOSEARCH_BINDIR=/usr/local/mnogosearch/bin
- MNOGOSEARCH_INCDIR=/usr/local/mnogosearch/include
- MNOGOSEARCH_LIBDIR=/usr/local/mnogosearch/lib
- else
- MNOGOSEARCH_BINDIR=$PHP_MNOGOSEARCH/bin
- MNOGOSEARCH_INCDIR=$PHP_MNOGOSEARCH/include
- MNOGOSEARCH_LIBDIR=$PHP_MNOGOSEARCH/lib
- fi
-
- AC_MSG_CHECKING(for mnoGoSearch version)
-
- if test -x "$MNOGOSEARCH_BINDIR/udm-config"; then
- MNOGOSEARCH_VERSION=`$MNOGOSEARCH_BINDIR/udm-config --version`
- MNOGOSEARCH_VERSION_ID=`$MNOGOSEARCH_BINDIR/udm-config --version-id`
-
- if test $? -ne 0; then
- AC_MSG_RESULT(<= 3.1.9)
- AC_MSG_ERROR(mnoGoSearch 3.1.10 at least required)
- fi
-
- if test "$MNOGOSEARCH_VERSION_ID" -lt 30110; then
- AC_MSG_RESULT(<= 3.1.9)
- AC_MSG_ERROR(mnoGoSearch 3.1.10 at least required)
- fi
-
- AC_MSG_RESULT($MNOGOSEARCH_VERSION)
-
- PHP_EVAL_LIBLINE(`$MNOGOSEARCH_BINDIR/udm-config --libs`, MNOGOSEARCH_SHARED_LIBADD)
- else
- AC_MSG_ERROR(udm-config script not found in $MNOGOSEARCH_BINDIR)
- fi
-
- PHP_ADD_INCLUDE($MNOGOSEARCH_INCDIR)
-
- AC_DEFINE(HAVE_MNOGOSEARCH,1,[ ])
-
- PHP_SUBST(MNOGOSEARCH_SHARED_LIBADD)
- PHP_NEW_EXTENSION(mnogosearch, php_mnogo.c, $ext_shared)
-
- fi
diff --git a/ext/mnogosearch/index.php b/ext/mnogosearch/index.php
deleted file mode 100644
index 62f1d62fb7..0000000000
--- a/ext/mnogosearch/index.php
+++ /dev/null
@@ -1,1055 +0,0 @@
-<?
-
-/*
- $Source$
- $Id$
-*/
-
-/* mnoGoSearch-php-lite v.1.4
- * for mnoGoSearch ( formely known as UdmSearch ) free web search engine
- * (C) 2001-2002 by Sergey Kartashoff <gluke@mail.ru>,
- * mnoGoSearch Developers Team <devel@mnogosearch.org>
- */
-
-if (!extension_loaded('mnogosearch')) {
- print "<b>This script requires PHP4.0.5+ with mnoGoSearch extension</b>";
- exit;
-}
-
-// maximal page number to view
-$MAX_NP=1000;
-
-// maximum results per page
-$MAX_PS=100;
-
-// (optional) Enable autowild feature for url limits
-// 'yes' - default value, can be 'yes' or 'no'
-// $auto_wild='yes';
-
-/* variables section */
-
-if (Udm_Api_Version() >= 30204) {
- $dbaddr='mysql://mnogo:mnogo@/mnogo/?dbmode=single';
-} else {
- $dbaddr='mysql://mnogo:mnogo@/mnogo/';
- $dbmode='single';
-}
-
-$localcharset='koi8-r';
-$browsercharset='utf-8';
-$phrase=$cache=$crosswords='no';
-$ispelluseprefixes=$trackquery='no';
-$spell_host=$vardir=$datadir='';
-$ispellmode='text';
-
-$affix_file=array();
-$spell_file=array();
-$stopwordtable_arr=array();
-$stopwordfile_arr=array();
-$synonym_arr=array();
-$searchd_arr=array();
-
-// $affix_file['en']='/opt/udm/ispell/en.aff';
-// $affix_file['ru']='/opt/udm/ispell/ru.aff';
-// $spell_file['en']='/opt/udm/ispell/en.dict';
-// $spell_file['ru']='/opt/udm/ispell/ru.dict';
- $stopwordtable_arr[]='stopword';
-// $stopwordfile_arr[]='stopwords.txt';
-// $synonym_arr[]='/opt/udm/synonym/english.syn';
-$searchd_arr[]='localhost';
-
-$minwordlength=1;
-$maxwordlength=32;
-
-$storedocurl="/cgi-bin/storedoc.cgi";
-
-/* initialisation section */
-
-if(isset($HTTP_GET_VARS)){
- while(list($var, $val)=each($HTTP_GET_VARS)){
- $$var=$val;
- }
-}
-if(isset($HTTP_POST_VARS)){
- while(list($var, $val)=each($HTTP_POST_VARS)){
- $$var=$val;
- }
-}
-if(isset($HTTP_COOKIE_VARS)){
- while(list($var, $val)=each($HTTP_COOKIE_VARS)){
- $$var=$val;
- }
-}
-if(isset($HTTP_SERVER_VARS)){
- while(list($var, $val)=each($HTTP_SERVER_VARS)){
- $$var=$val;
- }
-}
-
-$self=$PHP_SELF;
-
-if ($ps=="") $ps=20;
-if ($np=="") $np=0;
-if ($o=="") $o=0;
-
-if (($dt!='back') && ($dt!='er') && ($dt!='range')) $dt='back';
-if ($dp=="") $dp=0;
-if (($dx!=0) && ($dx!=-1) && ($dx!=1)) $dx=0;
-if ($dy<1970) $dy=1970;
-if (($dm<0) || ($dm>11)) $dm=0;
-if (($dd<=0) || ($dd>31)) $dd="01";
-
-$db=urldecode($db);
-$de=urldecode($de);
-
-if ($db=="") $db='01/01/1970';
-if ($de=="") $de='31/12/2020';
-
-// define this to enable stored support
-// $storedaddr="localhost";
-$storedocurl='/cgi-bin/storedoc.cgi';
-
-if (isset($q)) {
- $q=urldecode($q);
- $have_query_flag=1;
-} else {
- $have_query_flag=0;
-}
-
-$ul=urldecode($ul);
-$tag=urldecode($t);
-$lang=urldecode($lang);
-
-$query_orig=$q;
-
-if (isset($CHARSET_SAVED_QUERY_STRING)) {
- $q_local=urldecode($CHARSET_SAVED_QUERY_STRING);
- if (preg_match('/q=([^&]*)\&/',$q_local,$param)) {
- $q_local=urlencode($param[1]);
- } elseif (preg_match('/q=(.*)$/',$q_local,$param)) {
- $q_local=urlencode($param[1]);
- } else {
- $q_local=urlencode($q);
- }
-} else {
- $q_local=urlencode($q);
-}
-
-$ul_local=urlencode($ul);
-$t_local=urlencode($tag);
-$db_local=urlencode($db);
-$de_local=urlencode($de);
-$lang_local=urlencode($lang);
-
-if (($MAX_NP > 0) && ($np>$MAX_NP)) $np=$MAX_NP;
-if (($MAX_PS > 0) && ($ps>$MAX_PS)) $ps=$MAX_PS;
-
-// -----------------------------------------------
-// print_bottom()
-// -----------------------------------------------
-function print_bottom(){
- print ("<HR><center><img src=\"http://mnogosearch.org/img/mnogo.gif\">\n");
- print ("<font size=\"-1\">Powered by <a href=\"http://mnogosearch.org/\">mnoGoSearch</a></font><br>\n");
- print ("<p></BODY></HTML>\n");
-}
-
-
-// -----------------------------------------------
-// print_error_local($str)
-// -----------------------------------------------
-function print_error_local($str){
- print ("<CENTER><FONT COLOR=\"#FF0000\">An error occured!</FONT>\n");
- print ("<P><B>$str</B></CENTER>\n");
- print_bottom();
- exit;
-}
-
-// -----------------------------------------------
-// exit_local()
-// -----------------------------------------------
-function exit_local($print_err = 1) {
- drop_temp_table($print_err);
- exit;
-}
-
-// -----------------------------------------------
-// format_lastmod($lastmod)
-// -----------------------------------------------
-function format_lastmod($lastmod) {
- $temp=$lastmod;
- if (!$temp) $temp = 'undefined';
- else $temp = strftime('%a, %d %b %Y %H:%M:%S %Z',$temp);
-
- return $temp;
-}
-
-// -----------------------------------------------
-// format_dp($dp)
-// -----------------------------------------------
-function format_dp($dp) {
- $result=0;
-
- while ($dp != '') {
- if (preg_match('/^([\-\+]?\d+)([sMhdmy]?)/',$dp,$param)) {
- switch ($param[2]) {
- case 's': $multiplier=1; break;
- case 'M': $multiplier=60; break;
- case 'h': $multiplier=3600; break;
- case 'd': $multiplier=3600*24; break;
- case 'm': $multiplier=3600*24*31; break;
- case 'y': $multiplier=3600*24*365; break;
- default: $multiplier=1;
- }
-
- $result += $param[1]*$multiplier;
- $dp=preg_replace("/^[\-\+]?\d+$param[2]/",'',$dp);
- } else {
- return 0;
- }
- }
-
- return $result;
-}
-
-// -----------------------------------------------
-// format_userdate($date)
-// -----------------------------------------------
-function format_userdate($date) {
- $result=0;
-
- if (preg_match('/^(\d+)\/(\d+)\/(\d+)$/',$date,$param)) {
- $day=$param[1];
- $mon=$param[2];
- $year=$param[3];
-
- $result=mktime(0,0,0,$mon,$day,$year);
- }
-
- return $result;
-}
-
-// -----------------------------------------------
-// ParseDocText($text)
-// -----------------------------------------------
-function ParseDocText($text){
- global $all_words;
- global $hlbeg, $hlend;
-
- $str=$text;
-
- if (Udm_Api_Version() < 30200) {
- for ($i=0; $i<count($all_words); $i++) {
- $word=$all_words[$i];
- $str = preg_replace("/([\s\t\r\n\~\!\@\#\$\%\^\&\*\(\)\-\_\=\+\\\|\{\}\[\]\;\:\'\"\<\>\?\/\,\.]+)($word)/i","\\1$hlbeg\\2$hlend",$str);
- $str = preg_replace("/^($word)/i","$hlbeg\\1$hlend",$str);
- }
- } else {
- $str = str_replace("\2",$hlbeg,$str);
- $str = str_replace("\3",$hlend,$str);
- }
-
- return $str;
-}
-
-// -----------------------------------------------
-// print_template($t,$echo=1)
-// -----------------------------------------------
-function print_template($t,$echo=1){
- global $templates, $udm_agent;
- global $first_doc, $last_doc, $found, $query_orig, $error, $self;
- global $nav, $wordinfo;
- global $url, $ue, $o, $cat;
- global $clones, $searchtime;
- global $title, $rating, $desc, $contype, $lastmod, $docsize, $ndoc;
- global $keyw, $text, $category;
- global $crc, $Randoms, $rec_id, $DEBUG;
- global $lang_url_translation, $phpver;
-
-
- $str=$templates["$t"][$o];
- if ($str == '') $str=$templates["$t"][0];
-
- $str=ereg_replace('\$f', "$first_doc", $str);
- $str=ereg_replace('\$l', "$last_doc", $str);
- $str=ereg_replace('\$t', "$found", $str);
- $str=ereg_replace('\$A', $self, $str);
-
- $str=ereg_replace('\$Q', HtmlSpecialChars(StripSlashes($query_orig)), $str);
- $str=ereg_replace('\$q', urlencode($query_orig), $str);
- $str=eregi_replace('\$UE', $ue, $str);
-
- $str=ereg_replace('\$E', $error, $str);
- $str=ereg_replace('\$W', $wordinfo, $str);
-
- $str=ereg_replace('\$V', $nav, $str);
-
- if ($lang_url_translation == 'yes') {
- $nolangurl = ereg_replace("\.[a-z]{2}\.[a-z]{2,4}$", "", $url);
- $str=ereg_replace('\$DU', $nolangurl, $str);
- } else {
- $str=ereg_replace('\$DU', $url, $str);
- }
-
- $str=ereg_replace('\$DT', $title, $str);
- $str=ereg_replace('\$DR', "$rating", $str);
- $str=ereg_replace('\$DX', $text, $str);
- $str=ereg_replace('\$DE', ($desc != '')?$desc:$text, $str);
- $str=ereg_replace('\$DC', $contype, $str);
- $str=ereg_replace('\$DM', $lastmod, $str);
- $str=ereg_replace('\$DS', "$docsize", $str);
- $str=ereg_replace('\$DN', "$ndoc", $str);
- $str=ereg_replace('\$DD', $desc, $str);
- $str=ereg_replace('\$DK', $keyw, $str);
- $str=ereg_replace('\$SearchTime', "$searchtime", $str);
-
- if ($phpver >= 40006) {
- if (ereg('\$CP',$str)) {
- if ($temp_cp_arr=Udm_Cat_Path($udm_agent,$cat)) {
- reset($temp_cp_arr);
- $temp_cp='';
- for ($i=0; $i<count($temp_cp_arr); $i+=2) {
- $cp_path=$temp_cp_arr[$i];
- $cp_name=$temp_cp_arr[$i+1];
- $temp_cp .= " &gt; <a href=\"$PHP_SELF?cat=$cp_path\">$cp_name</a> ";
- }
- $str=ereg_replace('\$CP', $temp_cp, $str);
- } else $str=ereg_replace('\$CP', '', $str);
- }
-
- if (ereg('\$CS',$str)) {
- if ($temp_cp_arr=Udm_Cat_List($udm_agent,$cat)) {
- reset($temp_cp_arr);
- $temp_cp='';
- for ($i=0; $i<count($temp_cp_arr); $i+=2) {
- $cp_path=$temp_cp_arr[$i];
- $cp_name=$temp_cp_arr[$i+1];
- $temp_cp .= "<a href=\"$PHP_SELF?cat=$cp_path\">$cp_name</a><br>";
- }
- $str=ereg_replace('\$CS', $temp_cp, $str);
- } else $str=ereg_replace('\$CS', '', $str);
- }
-
- if (ereg('\$DY',$str)) {
- if ($temp_cp_arr=Udm_Cat_Path($udm_agent,$category)) {
- reset($temp_cp_arr);
- $temp_cp='';
- for ($i=0; $i<count($temp_cp_arr); $i+=2) {
- $cp_path=$temp_cp_arr[$i];
- $cp_name=$temp_cp_arr[$i+1];
- $temp_cp .= " &gt; <a href=\"$PHP_SELF?cat=$cp_path\">$cp_name</a> ";
- }
- $str=ereg_replace('\$DY', $temp_cp, $str);
- } else $str=ereg_replace('\$DY', '', $str);
- }
- } else {
- $str=ereg_replace('\$CP', '', $str);
- $str=ereg_replace('\$CS', '', $str);
- $str=ereg_replace('\$DY', '', $str);
- }
-
- $sub=$str;
- while($sub=strstr($sub,'$r')){
- $sub=substr($sub,2);
- $pos=0;
- $num='';
-
- while(($sub[$pos]>='0')&&($sub[$pos]<='9')){
- $num.=$sub[$pos++];
- }
-
- $str=ereg_replace('\$r'.$num, ''.$Randoms[$num], $str);
- }
-
-// if (strstr($str,'$CL')&&($t=='res')) {
-// if (strtolower($clones) == 'no') {
-// $str=ereg_replace('\$CL', '', $str);
-// } elseif ($crc<>'') {
-// }
- $str=ereg_replace('\$CL', $clon, $str);
-// }
-
- if($echo) echo $str; else return $str;
-}
-
-// -----------------------------------------------
-// make_nav($query_orig)
-// -----------------------------------------------
-function make_nav($query_orig){
- global $found,$np,$isnext,$ps,$tag,$ul,$self,$o,$m,$cat;
- global $dt, $dp, $dx, $dm, $dy, $dd, $db, $de, $lang, $wm, $wf;
- global $q_local,$ul_local,$t_local,$db_local,$de_local,$lang_local;
-
- if($np>0){
- $prevp=$np-1;
- $prev_href="$self?q=$q_local&np=$prevp&m=$m".
- ($ps==20?'':"&ps=$ps").
- ($tag==''?'':"&t=$t_local").
- ($ul==''?'':"&ul=$ul_local").
- ($wm==''?'':"&wm=$wm").
- ($wf==''?'':"&wf=$wf").
- (!$o?'':"&o=$o").
- ($dt=='back'?'':"&dt=$dt").
- (!$dp?'':"&dp=$dp").
- (!$dx?'':"&dx=$dx").
- ($dd=='01'?'':"&dd=$dd").
- (!$dm?'':"&dm=$dm").
- ($dy=='1970'?'':"&dy=$dy").
- ($db=='01/01/1970'?'':"&db=$db_local").
- ($de=='31/12/2020'?'':"&de=$de_local").
- ($cat==''?'':"&cat=$cat").
- ($lang==''?'':"&lang=$lang_local");
-
- $nav_left="<TD><A HREF=\"$prev_href\">Prev</A></TD>\n";
- } elseif ($np==0) {
- $nav_left="<TD><FONT COLOR=\"#707070\">Prev</FONT></TD>\n";
- }
-
- if($isnext==1) {
- $nextp=$np+1;
- $next_href="$self?q=$q_local&np=$nextp&m=$m".
- ($ps==20?'':"&ps=$ps").
- ($tag==''?'':"&t=$t_local").
- ($ul==''?'':"&ul=$ul_local").
- ($wm==''?'':"&wm=$wm").
- ($wf==''?'':"&wf=$wf").
- (!$o?'':"&o=$o").
- ($dt=='back'?'':"&dt=$dt").
- (!$dp?'':"&dp=$dp").
- (!$dx?'':"&dx=$dx").
- ($dd=='01'?'':"&dd=$dd").
- (!$dm?'':"&dm=$dm").
- ($dy=='1970'?'':"&dy=$dy").
- ($db=='01/01/1970'?'':"&db=$db_local").
- ($de=='31/12/2020'?'':"&de=$de_local").
- ($cat==''?'':"&cat=$cat").
- ($lang==''?'':"&lang=$lang_local");
-
- $nav_right="<TD><A HREF=\"$next_href\">Next</TD>\n";
- } else {
- $nav_right="<TD><FONT COLOR=\"#707070\">Next</FONT></TD>\n";
- }
-
- $nav_bar0='<TD>$NP</TD>';
- $nav_bar1='<TD><A HREF="$NH">$NP</A></TD>';
-
- $tp=ceil($found/$ps);
-
- $cp=$np+1;
-
- if ($cp>5) {
- $lp=$cp-5;
- } else {
- $lp=1;
- }
-
- $rp=$lp+10-1;
- if ($rp>$tp) {
- $rp=$tp;
- $lp=$rp-10+1;
- if ($lp<1) $lp=1;
- }
-
-
- if ($lp!=$rp) {
- for ($i=$lp; $i<=$rp;$i++) {
- $realp=$i-1;
-
- if ($i==$cp) {
- $nav_bar=$nav_bar.$nav_bar0;
- } else {
- $nav_bar=$nav_bar.$nav_bar1;
- }
-
- $href="$self?q=$q_local&np=$realp&m=$m".
- ($ps==20?'':"&ps=$ps").
- ($tag==''?'':"&t=$t_local").
- ($ul==''?'':"&ul=$ul_local").
- ($wm==''?'':"&wm=$wm").
- ($wf==''?'':"&wf=$wf").
- (!$o?'':"&o=$o").
- ($dt=='back'?'':"&dt=$dt").
- (!$dp?'':"&dp=$dp").
- (!$dx?'':"&dx=$dx").
- ($dd=='01'?'':"&dd=$dd").
- (!$dm?'':"&dm=$dm").
- ($dy=='1970'?'':"&dy=$dy").
- ($db=='01/01/1970'?'':"&db=$db_local").
- ($de=='31/12/2020'?'':"&de=$de_local").
- ($cat==''?'':"&cat=$cat").
- ($lang==''?'':"&lang=$lang_local");
-
- $nav_bar=ereg_replace('\$NP',"$i",$nav_bar);
- $nav_bar=ereg_replace('\$NH',"$href",$nav_bar);
- }
-
- $nav="<TABLE BORDER=0><TR>$nav_left $nav_bar $nav_right</TR></TABLE>\n";
- } elseif ($found) {
- $nav="<TABLE BORDER=0><TR>$nav_left $nav_right</TR></TABLE>\n";
- }
-
- return $nav;
-}
-
-// -----------------------------------------------
-// M A I N
-// -----------------------------------------------
-
- if (preg_match("/^(\d+)\.(\d+)\.(\d+)/",phpversion(),$param)) {
- $phpver=$param[1];
- if ($param[2] < 9) {
- $phpver .= "0$param[2]";
- } else {
- $phpver .= "$param[2]";
- }
- if ($param[3] < 9) {
- $phpver .= "0$param[3]";
- } else {
- $phpver .= "$param[3]";
- }
- } else {
- print "Cannot determine php version: <b>".phpversion()."</b>\n";
- exit;
- }
-
- $have_spell_flag=0;
-
- if (Udm_Api_Version() >= 30204) {
- $udm_agent=Udm_Alloc_Agent($dbaddr);
- } else {
- $udm_agent=Udm_Alloc_Agent($dbaddr,$dbmode);
- }
-
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_PAGE_SIZE,$ps);
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_PAGE_NUM,$np);
-
- if ($phpver >= 40006) {
- if ($temp_cp_arr=Udm_Cat_Path($udm_agent,$cat)) {
- reset($temp_cp_arr);
- $temp_cp='';
- for ($i=0; $i<count($temp_cp_arr); $i+=2) {
- $cp_path=$temp_cp_arr[$i];
- $cp_name=$temp_cp_arr[$i+1];
- $temp_cp .= " &gt; <a href=\"$PHP_SELF?cat=$cp_path\">$cp_name</a> ";
- }
- $t_CP=$temp_cp;
- }
-
- if ($temp_cp_arr=Udm_Cat_List($udm_agent,$cat)) {
- reset($temp_cp_arr);
- $temp_cp='';
- for ($i=0; $i<count($temp_cp_arr); $i+=2) {
- $cp_path=$temp_cp_arr[$i];
- $cp_name=$temp_cp_arr[$i+1];
- $temp_cp .= "<a href=\"$PHP_SELF?cat=$cp_path\">$cp_name</a><br>";
- }
- $t_CS=$temp_cp;
- }
-
- if ($temp_cp_arr=Udm_Cat_Path($udm_agent,$category)) {
- reset($temp_cp_arr);
- $temp_cp='';
- for ($i=0; $i<count($temp_cp_arr); $i+=2) {
- $cp_path=$temp_cp_arr[$i];
- $cp_name=$temp_cp_arr[$i+1];
- $temp_cp .= " &gt; <a href=\"$PHP_SELF?cat=$cp_path\">$cp_name</a> ";
- }
- $t_DY=$temp_cp;
- }
- }
-
- $trackquery=strtolower($trackquery);
- if ($trackquery == 'yes') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_TRACK_MODE,UDM_TRACK_ENABLED);
- } else {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_TRACK_MODE,UDM_TRACK_DISABLED);
- }
-
- $phrase=strtolower($phrase);
- if ($phrase == 'yes') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_PHRASE_MODE,UDM_PHRASE_ENABLED);
- } else {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_PHRASE_MODE,UDM_PHRASE_DISABLED);
- }
-
- $cache=strtolower($cache);
- if ($cache == 'yes') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_CACHE_MODE,UDM_CACHE_ENABLED);
- } else {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_CACHE_MODE,UDM_CACHE_DISABLED);
- }
-
- $ispelluseprefixes=strtolower($ispelluseprefixes);
- if ($ispelluseprefixes == 'yes') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_ISPELL_PREFIXES,UDM_PREFIXES_ENABLED);
- } else {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_ISPELL_PREFIXES,UDM_PREFIXES_DISABLED);
- }
-
- if (Udm_Api_Version() >= 30111) {
- $crosswords=strtolower($crosswords);
- if ($crosswords == 'yes') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_CROSS_WORDS,UDM_CROSS_WORDS_ENABLED);
- } else {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_CROSS_WORDS,UDM_CROSS_WORDS_DISABLED);
- }
- }
-
- if ($localcharset != '') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_CHARSET,$localcharset);
- }
-
- if (Udm_Api_Version() >= 30200) {
- if ($localcharset == '') Udm_Set_Agent_Param($udm_agent,UDM_PARAM_CHARSET,'utf-8');
- if ($browsercharset != '') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_BROWSER_CHARSET,$browsercharset);
- Header ("Content-Type: text/html; charset=$browsercharset");
- } else {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_BROWSER_CHARSET,'utf-8');
- Header ("Content-Type: text/html; charset=utf-8");
- }
- if ($hlbeg != '') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_HLBEG,$hlbeg);
- } else {
- $hlbeg='<font color="000088"><b>';
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_HLBEG,'<font color="000088"><b>');
- }
- if ($hlend != '') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_HLEND,$hlend);
- } else {
- $hlend='</b></font>';
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_HLEND,'</b></font>');
- }
- }
-
-
- for ($i=0; $i < count($stopwordtable_arr); $i++) {
- if ($stopwordtable_arr[$i] != '') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_STOPTABLE,$stopwordtable_arr[$i]);
- }
- }
-
- for ($i=0; $i < count($stopwordfile_arr); $i++) {
- if ($stopwordfile_arr[$i] != '') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_STOPFILE,$stopwordfile_arr[$i]);
- }
- }
-
- if (Udm_Api_Version() >= 30203) {
- for ($i=0; $i < count($synonym_arr); $i++) {
- if ($synonym_arr[$i] != '') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_SYNONYM,$synonym_arr[$i]);
- }
- }
-
- for ($i=0; $i < count($searchd_arr); $i++) {
- if ($searchd_arr[$i] != '') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_SEARCHD,$searchd_arr[$i]);
- }
- }
-
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_QSTRING,$QUERY_STRING);
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_REMOTE_ADDR,$REMOTE_ADDR);
- }
-
- if (Udm_Api_Version() >= 30204) {
- if ($have_query_flag)Udm_Set_Agent_Param($udm_agent,UDM_PARAM_QUERY,$query_orig);
- if ($storedaddr != '') Udm_Set_Agent_Param($udm_agent,UDM_PARAM_STORED,$storedaddr);
- }
-
- if ($m=='any') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_SEARCH_MODE,UDM_MODE_ANY);
- } elseif ($m=='all') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_SEARCH_MODE,UDM_MODE_ALL);
- } elseif ($m=='bool') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_SEARCH_MODE,UDM_MODE_BOOL);
- } elseif ($m=='phrase') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_SEARCH_MODE,UDM_MODE_PHRASE);
- } else {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_SEARCH_MODE,UDM_MODE_ALL);
- }
-
- if ($wm=='wrd') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_WORD_MATCH,UDM_MATCH_WORD);
- } elseif ($wm=='beg') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_WORD_MATCH,UDM_MATCH_BEGIN);
- } elseif ($wm=='end') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_WORD_MATCH,UDM_MATCH_END);
- } elseif ($wm=='sub') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_WORD_MATCH,UDM_MATCH_SUBSTR);
- } else {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_WORD_MATCH,UDM_MATCH_WORD);
- }
-
- if ($minwordlength >= 0) {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_MIN_WORD_LEN,$minwordlength);
- }
-
- if ($maxwordlength >= 0) {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_MAX_WORD_LEN,$maxwordlength);
- }
-
- if ($phpver >= 40007) {
- if ($vardir != '') Udm_Set_Agent_Param($udm_agent,UDM_PARAM_VARDIR,$vardir);
- if ($datadir != '') Udm_Set_Agent_Param($udm_agent,UDM_PARAM_VARDIR,$datadir);
- }
-
- if ($wf != '') {
- Udm_Set_Agent_Param($udm_agent,UDM_PARAM_WEIGHT_FACTOR,$wf);
- }
-
- if ($ul != '') {
- $auto_wild=strtolower($auto_wild);
- if (($auto_wild == 'yes') ||
- ($auto_wild == '')) {
- if ((substr($ul,0,7) == 'http://') ||
- (substr($ul,0,8) == 'https://') ||
- (substr($ul,0,7) == 'news://') ||
- (substr($ul,0,6) == 'ftp://')) {
- Udm_Add_Search_Limit($udm_agent,UDM_LIMIT_URL,"$ul%");
- } else {
- Udm_Add_Search_Limit($udm_agent,UDM_LIMIT_URL,"%$ul%");
- }
- } else {
- Udm_Add_Search_Limit($udm_agent,UDM_LIMIT_URL,$ul);
- }
- }
-
- if ($tag != '') Udm_Add_Search_Limit($udm_agent,UDM_LIMIT_TAG,$tag);
- if ($cat != '') Udm_Add_Search_Limit($udm_agent,UDM_LIMIT_CAT,$cat);
- if ($lang != '')Udm_Add_Search_Limit($udm_agent,UDM_LIMIT_LANG,$lang);
-
- if (($dt == 'back') && ($dp != '0')) {
- $recent_time=format_dp($dp);
- if ($recent_time != 0) {
- $dl=time()-$recent_time;
- Udm_Add_Search_Limit($udm_agent,UDM_LIMIT_DATE,">$dl");
- }
- } elseif ($dt=='er') {
- $recent_time=mktime(0,0,0,($dm+1),$dd,$dy);
- if ($dx == -1) {
- Udm_Add_Search_Limit($udm_agent,UDM_LIMIT_DATE,"<$recent_time");
- } elseif ($dx == 1) {
- Udm_Add_Search_Limit($udm_agent,UDM_LIMIT_DATE,">$recent_time");
- }
- } elseif ($dt=='range') {
- $begin_time=format_userdate($db);
- if ($begin_time) Udm_Add_Search_Limit($udm_agent,UDM_LIMIT_DATE,">$begin_time");
-
- $end_time=format_userdate($de);
- if ($end_time) Udm_Add_Search_Limit($udm_agent,UDM_LIMIT_DATE,"<$end_time");
- }
-
-// if ($have_query_flag) $q=ParseQ($q);
-
-?>
-
-<HTML>
-<HEAD>
- <TITLE>mnoGoSearch: <? echo HtmlSpecialChars(StripSlashes($query_orig)); ?></TITLE>
-</HEAD>
-
-<body BGCOLOR="#FFFFFF" LINK="#0050A0" VLINK="#0050A0" ALINK="#0050A0">
-<center>
-
-<FORM METHOD=GET ACTION="<? echo $self; ?>">
-<table bgcolor=#eeeee0 border=0 width=100%>
-<tr><td>
-<BR>
-<INPUT TYPE="hidden" NAME="ps" VALUE="10">
-Search for: <INPUT TYPE="text" NAME="q" SIZE=50 VALUE="<? echo HtmlSpecialChars(StripSlashes($query_orig)); ?>">
-<INPUT TYPE="submit" VALUE="Search!"><BR>
-
-Results per page:
-<SELECT NAME="ps">
-<OPTION VALUE="10" <? if ($ps==10) echo 'SELECTED';?>>10
-<OPTION VALUE="20" <? if ($ps==20) echo 'SELECTED';?>>20
-<OPTION VALUE="50" <? if ($ps==50) echo 'SELECTED';?>>50
-</SELECT>
-
-Match:
-<SELECT NAME="m">
-<OPTION VALUE="all" <? if ($m=='all') echo 'SELECTED';?>>All
-<OPTION VALUE="any" <? if ($m=='any') echo 'SELECTED';?>>Any
-<OPTION VALUE="bool" <? if ($m=='bool') echo 'SELECTED';?>>Boolean
-<OPTION VALUE="phrase" <? if ($m=='phrase') echo 'SELECTED';?>>Full phrase
-</SELECT>
-
-
-Search for:
-<SELECT NAME="wm">
-<OPTION VALUE="wrd" <? if ($wm=='wrd') echo 'SELECTED';?>>Whole word
-<OPTION VALUE="beg" <? if ($wm=='beg') echo 'SELECTED';?>>Beginning
-<OPTION VALUE="end" <? if ($wm=='end') echo 'SELECTED';?>>Ending
-<OPTION VALUE="sub" <? if ($wm=='sub') echo 'SELECTED';?>>Substring
-</SELECT>
-
-<br>
-
-Search through:
-<SELECT NAME="ul">
-<OPTION VALUE="" <? if ($ul=='') echo 'SELECTED';?>>Entire site
-<OPTION VALUE="/docs/" <? if ($ul=='/docs/') echo 'SELECTED';?>>Docs
-<OPTION VALUE="/files/" <? if ($ul=='/files') echo 'SELECTED';?>>Files
-<OPTION VALUE="/servers/" <? if ($ul=='/servers/') echo 'SELECTED';?>>Servers
-</SELECT>
-
-in:
-<SELECT NAME="wf">
-<OPTION VALUE="222211" <? if ($wf=='222211') echo 'SELECTED';?>>all sections
-<OPTION VALUE="220000" <? if ($wf=='220000') echo 'SELECTED';?>>Description
-<OPTION VALUE="202000" <? if ($wf=='202000') echo 'SELECTED';?>>Keywords
-<OPTION VALUE="200200" <? if ($wf=='200200') echo 'SELECTED';?>>Title
-<OPTION VALUE="200010" <? if ($wf=='200010') echo 'SELECTED';?>>Body
-</SELECT>
-
-Language:
-<SELECT NAME="lang">
-<OPTION VALUE="" <? if ($lang=='222211') echo 'SELECTED';?>>Any
-<OPTION VALUE="en" <? if ($lang=='en') echo 'SELECTED';?>>English
-<OPTION VALUE="ru" <? if ($lang=='ru') echo 'SELECTED';?>>Russian
-</SELECT>
-
-Restrict search:
-<SELECT NAME="t">
-<OPTION VALUE="" <? if ($t=='') echo 'SELECTED';?>>All sites
-<OPTION VALUE="AA" <? if ($t=='AA') echo 'SELECTED';?>>Sport
-<OPTION VALUE="BB" <? if ($t=='BB') echo 'SELECTED';?>>Shopping
-<OPTION VALUE="CC" <? if ($t=='CC') echo 'SELECTED';?>>Internet
-</SELECT>
-
-</td></tr>
-
-<!-- 'search with time limits' options -->
-<TR><TD>
-<TABLE CELLPADDING=2 CELLSPACING=0 BORDER=0>
-<CAPTION>
-Limit results to pages published within a specified period of time.<BR>
-<FONT SIZE=-1><I>(Please select only one option)</I></FONT>
-</CAPTION>
-<TR>
-<TD VALIGN=center><INPUT TYPE=radio NAME="dt" VALUE="back" <? if ($dt=='back') echo 'checked';?>></TD>
-<TD><SELECT NAME="dp">
-<OPTION VALUE="0" <? if ($dp=='0') echo 'SELECTED';?>>anytime
-<OPTION VALUE="10M" <? if ($dp=='10M') echo 'SELECTED';?>>in the last ten minutes
-<OPTION VALUE="1h" <? if ($dp=='1h') echo 'SELECTED';?>>in the last hour
-<OPTION VALUE="7d" <? if ($dp=='7d') echo 'SELECTED';?>>in the last week
-<OPTION VALUE="14d" <? if ($dp=='14d') echo 'SELECTED';?>>in the last 2 weeks
-<OPTION VALUE="1m" <? if ($dp=='1m') echo 'SELECTED';?>>in the last month
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD VALIGN=center><INPUT type=radio NAME="dt" VALUE="er" <? if ($dt=='er') echo 'checked';?>>
-</TD>
-<TD><SELECT NAME="dx">
-<OPTION VALUE="1" <? if ($dx=='1') echo 'SELECTED';?>>After
-<OPTION VALUE="-1" <? if ($dx=='-1') echo 'SELECTED';?>>Before
-</SELECT>
-
-or on
-
-<SELECT NAME="dm">
-<OPTION VALUE="0" <? if ($dm=='0') echo 'SELECTED';?>>January
-<OPTION VALUE="1" <? if ($dm=='1') echo 'SELECTED';?>>February
-<OPTION VALUE="2" <? if ($dm=='2') echo 'SELECTED';?>>March
-<OPTION VALUE="3" <? if ($dm=='3') echo 'SELECTED';?>>April
-<OPTION VALUE="4" <? if ($dm=='4') echo 'SELECTED';?>>May
-<OPTION VALUE="5" <? if ($dm=='5') echo 'SELECTED';?>>June
-<OPTION VALUE="6" <? if ($dm=='6') echo 'SELECTED';?>>July
-<OPTION VALUE="7" <? if ($dm=='7') echo 'SELECTED';?>>August
-<OPTION VALUE="8" <? if ($dm=='8') echo 'SELECTED';?>>September
-<OPTION VALUE="9" <? if ($dm=='9') echo 'SELECTED';?>>October
-<OPTION VALUE="10" <? if ($dm=='10') echo 'SELECTED';?>>November
-<OPTION VALUE="11" <? if ($dm=='11') echo 'SELECTED';?>>December
-</SELECT>
-<INPUT TYPE=text NAME="dd" VALUE="<? echo $dd; ?>" SIZE=2 maxlength=2>
-,
-<SELECT NAME="dy" >
-<OPTION VALUE="1999" <? if ($dy=='1999') echo 'SELECTED';?>>1999
-<OPTION VALUE="2000" <? if ($dy=='2000') echo 'SELECTED';?>>2000
-<OPTION VALUE="2001" <? if ($dy=='2001') echo 'SELECTED';?>>2001
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD VALIGN=center><INPUT TYPE=radio NAME="dt" VALUE="range" <? if ($dt=='range') echo 'checked';?>>
-</TD>
-<TD>
-Between
-<INPUT TYPE=text NAME="db" VALUE="<? echo $db; ?>" SIZE=11 MAXLENGTH=11>
-and
-<INPUT TYPE=text NAME="de" VALUE="<? echo $de; ?>" SIZE=11 MAXLENGTH=11>
-</TD>
-</TR>
-</TABLE>
-
-</TD></TR>
-<!-- end of stl options -->
-
-<!-- categories stuff -->
-<tr><td><? echo $t_CP; ?></td></tr>
-<tr><td><? echo $t_CS; ?></td></tr>
-<input type=hidden name=cat value="<? echo $cat; ?>">
-<!-- categories stuff end -->
-
-</table>
-</form>
-</center>
-
-
-<?
-
- $ispellmode=strtolower($ispellmode);
- if ($ispellmode == 'db') {
- if (! Udm_Load_Ispell_Data($udm_agent,UDM_ISPELL_TYPE_DB,'','',1)) {
- print_error_local(Udm_Error($udm_agent));
- } else $have_spell_flag=1;
- } elseif ($ispellmode == 'server') {
- if (Udm_Api_Version() >= 30112) {
- if (! Udm_Load_Ispell_Data($udm_agent,UDM_ISPELL_TYPE_SERVER,$spell_host,'',1)) {
- print_error_local("Error loading ispell data from server $spell_host");
- } else $have_spell_flag=1;
- }
- } elseif ($ispellmode == 'text') {
- reset($affix_file);
- while (list($t_lang,$file)=each($affix_file)) {
- if (! Udm_Load_Ispell_Data($udm_agent,UDM_ISPELL_TYPE_AFFIX,$t_lang,$file,0)) {
- print_error_local("Error loading ispell data from file");
- } else $have_spell_flag=1;
-
- $temp=$spell_file[$t_lang];
- for ($i=0; $i<count($temp); $i++) {
- if (! Udm_Load_Ispell_Data($udm_agent,UDM_ISPELL_TYPE_SPELL,$t_lang,$temp[$i],1)) {
- print_error_local("Error loading ispell data from file");
- } else $have_spell_flag=1;
- }
- }
- }
-
-if (! $have_query_flag) {
- print_bottom();
- return;
-} elseif ($have_query_flag && ($q=='')) {
- print ("<FONT COLOR=red>You should give at least one word to search for.</FONT>\n");
- print_bottom();
- return;
-}
-
-$res=Udm_Find($udm_agent,$q);
-
-if(($errno=Udm_Errno($udm_agent))>0){
- print_error_local(Udm_Error($udm_agent));
-} else {
- $found=Udm_Get_Res_Param($res,UDM_PARAM_FOUND);
- $rows=Udm_Get_Res_Param($res,UDM_PARAM_NUM_ROWS);
- $wordinfo=Udm_Get_Res_Param($res,UDM_PARAM_WORDINFO);
- $searchtime=Udm_Get_Res_Param($res,UDM_PARAM_SEARCHTIME);
- $first_doc=Udm_Get_Res_Param($res,UDM_PARAM_FIRST_DOC);
- $last_doc=Udm_Get_Res_Param($res,UDM_PARAM_LAST_DOC);
-
- if (!$found) {
- print ("Search Time: $searchtime<br>Search results:\n");
- print ("<small>$wordinfo</small><HR><CENTER>Sorry, but search returned no results.<P>\n");
- print ("<I>Try to produce less restrictive search query.</I></CENTER>\n");
-
- print_bottom();
- return;
- }
-
- $from=IntVal($np)*IntVal($ps);
- $to=IntVal($np+1)*IntVal($ps);
-
- if($to>$found) $to=$found;
- if (($from+$ps)<$found) $isnext=1;
- $nav=make_nav($query_orig);
-
- print("Search Time: $searchtime<br>Search results: <small>$wordinfo</small><HR>\n");
- print("Displaying documents $first_doc-$last_doc of total <B>$found</B> found.\n");
-
- $stored_link=-1;
- if ((Udm_Api_Version() == 30203) && ($storedaddr != '')) {
- $stored_link=Udm_Open_Stored($udm_agent,$storedaddr);
- }
-
- for($i=0;$i<$rows;$i++){
- $excerpt_flag=0;
- if (Udm_Api_Version() >= 30204) {
- $excerpt_flag=Udm_Make_Excerpt($udm_agent, $res, $i);
- }
-
- $ndoc=Udm_Get_Res_Field($res,$i,UDM_FIELD_ORDER);
- $rating=Udm_Get_Res_Field($res,$i,UDM_FIELD_RATING);
- $url=Udm_Get_Res_Field($res,$i,UDM_FIELD_URL);
- $contype=Udm_Get_Res_Field($res,$i,UDM_FIELD_CONTENT);
- $docsize=Udm_Get_Res_Field($res,$i,UDM_FIELD_SIZE);
- $lastmod=format_lastmod(Udm_Get_Res_Field($res,$i,UDM_FIELD_MODIFIED));
-
- $title=Udm_Get_Res_Field($res,$i,UDM_FIELD_TITLE);
- $title=($title) ? htmlspecialChars($title):'No title';
-
- $title=ParseDocText($title);
- $text=ParseDocText(htmlspecialChars(Udm_Get_Res_Field($res,$i,UDM_FIELD_TEXT)));
- $keyw=ParseDocText(htmlspecialChars(Udm_Get_Res_Field($res,$i,UDM_FIELD_KEYWORDS)));
- $desc=ParseDocText(htmlspecialChars(Udm_Get_Res_Field($res,$i,UDM_FIELD_DESC)));
-
- $crc=Udm_Get_Res_Field($res,$i,UDM_FIELD_CRC);
- $rec_id=Udm_Get_Res_Field($res,$i,UDM_FIELD_URLID);
-
- if (Udm_Api_Version() >= 30203) {
- $doclang=Udm_Get_Res_Field($res,$i,UDM_FIELD_LANG);
- $doccharset=Udm_Get_Res_Field($res,$i,UDM_FIELD_CHARSET);
- }
-
- if ($phpver >= 40006) {
- $category=Udm_Get_Res_Field($res,$i,UDM_FIELD_CATEGORY);
- } else {
- $category='';
- }
-
- print ("<DL><DT><b>$ndoc.</b><a href=\"$url\" TARGET=\"_blank\"><b>$title</b></a>\n");
- print ("[<b>$rating</b>]<DD>\n");
- print (($desc != '')?$desc:$text."...<BR>$t_DY<UL><li>\n");
- print ("<A HREF=\"$url\" TARGET=\"_blank\">$url</A>\n");
- print ("($contype) $lastmod, $docsize bytes</UL></DL>\n");
-
- if (Udm_Api_Version() == 30203) {
- if ((($stored_link>0) && (Udm_Check_Stored($udm_agent,$stored_link,Udm_CRC32($udm_agent,$url)))) ||
- ($stored_link==-1)) {
- $storedstr="$storedocurl?rec_id=".Udm_CRC32($udm_agent,$url).
- "&DM=".urlencode($lastmod).
- "&DS=$docsize".
- "&L=$doclang".
- "&CS=$doccharset".
- "&DU=".urlencode($url).
- "&q=".urlencode($query_orig);
- print ("<DD><a href=\"$storedstr\">Cached copy</a>\n");
- }
- } elseif (Udm_Api_Version() >= 30204) {
- if ($excerpt_flag) {
- $storedstr="$storedocurl?rec_id=".Udm_CRC32($udm_agent,$save_url).
- "&DM=".urlencode($lastmod).
- "&DS=$docsize".
- "&L=$doclang".
- "&CS=$doccharset".
- "&DU=".urlencode($save_url).
- "&q=".urlencode($query_orig);
- print_template('stored');
- }
- }
- }
-
- if ((Udm_Api_Version() == 30203) &&
- ($stored_link>0)) {
- Udm_Close_Stored($udm_agent, $stored_link);
- }
-
- print("<HR><CENTER> $nav </CENTER>\n");
- print_bottom();
-
- // Free result
- Udm_Free_Res($res);
-}
-
- if ($have_spell_flag) Udm_Free_Ispell_Data($udm_agent);
- Udm_Free_Agent($udm_agent);
-?>
diff --git a/ext/mnogosearch/php_mnogo.c b/ext/mnogosearch/php_mnogo.c
deleted file mode 100644
index 7ea7a37a93..0000000000
--- a/ext/mnogosearch/php_mnogo.c
+++ /dev/null
@@ -1,2521 +0,0 @@
-/* $Source$ */
-/* $Id$ */
-
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | Initial version by Alex Barkov <bar@izhcom.ru> |
- | and Ramil Kalimullin <ram@izhcom.ru> |
- | Further development by Sergey Kartashoff <gluke@mail.ru> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_mnogo.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-#include "php_globals.h"
-
-#ifdef HAVE_MNOGOSEARCH
-
-#define UDMSTRSIZ 1024*5
-
-#define UDM_FIELD_URLID 1
-#define UDM_FIELD_URL 2
-#define UDM_FIELD_CONTENT 3
-#define UDM_FIELD_TITLE 4
-#define UDM_FIELD_KEYWORDS 5
-#define UDM_FIELD_DESC 6
-#define UDM_FIELD_TEXT 7
-#define UDM_FIELD_SIZE 8
-#define UDM_FIELD_RATING 9
-#define UDM_FIELD_MODIFIED 10
-#define UDM_FIELD_ORDER 11
-#define UDM_FIELD_CRC 12
-#define UDM_FIELD_CATEGORY 13
-#define UDM_FIELD_LANG 14
-#define UDM_FIELD_CHARSET 15
-#define UDM_FIELD_SITEID 16
-#define UDM_FIELD_POP_RANK 17
-#define UDM_FIELD_ORIGINID 18
-
-/* udm_set_agent_param constants */
-#define UDM_PARAM_PAGE_SIZE 1
-#define UDM_PARAM_PAGE_NUM 2
-#define UDM_PARAM_SEARCH_MODE 3
-#define UDM_PARAM_CACHE_MODE 4
-#define UDM_PARAM_TRACK_MODE 5
-#define UDM_PARAM_CHARSET 6
-#define UDM_PARAM_STOPTABLE 7
-#define UDM_PARAM_STOPFILE 8
-#define UDM_PARAM_WEIGHT_FACTOR 9
-#define UDM_PARAM_WORD_MATCH 10
-#define UDM_PARAM_PHRASE_MODE 11
-#define UDM_PARAM_MIN_WORD_LEN 12
-#define UDM_PARAM_MAX_WORD_LEN 13
-#define UDM_PARAM_ISPELL_PREFIXES 14
-#define UDM_PARAM_CROSS_WORDS 15
-#define UDM_PARAM_VARDIR 16
-#define UDM_PARAM_LOCAL_CHARSET 17
-#define UDM_PARAM_BROWSER_CHARSET 18
-#define UDM_PARAM_HLBEG 19
-#define UDM_PARAM_HLEND 20
-#define UDM_PARAM_SYNONYM 21
-#define UDM_PARAM_SEARCHD 22
-#define UDM_PARAM_QSTRING 23
-#define UDM_PARAM_REMOTE_ADDR 24
-#define UDM_PARAM_QUERY 25
-#define UDM_PARAM_STORED 26
-#define UDM_PARAM_GROUPBYSITE 27
-#define UDM_PARAM_SITEID 28
-#define UDM_PARAM_DETECT_CLONES 29
-
-/* udm_add_search_limit constants */
-#define UDM_LIMIT_URL 1
-#define UDM_LIMIT_TAG 2
-#define UDM_LIMIT_LANG 3
-#define UDM_LIMIT_CAT 4
-#define UDM_LIMIT_DATE 5
-#define UDM_LIMIT_TYPE 6
-
-/* word match type */
-#define UDM_MATCH_WORD 0
-#define UDM_MATCH_BEGIN 1
-#define UDM_MATCH_SUBSTR 2
-#define UDM_MATCH_END 3
-
-/* track modes */
-#define UDM_TRACK_ENABLED 1
-#define UDM_TRACK_DISABLED 0
-
-/* cache modes */
-#define UDM_CACHE_ENABLED 1
-#define UDM_CACHE_DISABLED 0
-
-/* phrase modes */
-#define UDM_PHRASE_ENABLED 1
-#define UDM_PHRASE_DISABLED 0
-
-/* prefix modes */
-#define UDM_PREFIXES_ENABLED 1
-#define UDM_PREFIXES_DISABLED 0
-
-/* crosswords modes */
-#define UDM_CROSS_WORDS_ENABLED 1
-#define UDM_CROSS_WORDS_DISABLED 0
-
-/* General modes */
-#define UDM_ENABLED 1
-#define UDM_DISABLED 0
-
-/* udm_get_res_param constants */
-#define UDM_PARAM_NUM_ROWS 256
-#define UDM_PARAM_FOUND 257
-#define UDM_PARAM_WORDINFO 258
-#define UDM_PARAM_SEARCHTIME 259
-#define UDM_PARAM_FIRST_DOC 260
-#define UDM_PARAM_LAST_DOC 261
-#define UDM_PARAM_WORDINFO_ALL 262
-
-/* udm_load_ispell_data constants */
-#define UDM_ISPELL_TYPE_AFFIX 1
-#define UDM_ISPELL_TYPE_SPELL 2
-#define UDM_ISPELL_TYPE_DB 3
-#define UDM_ISPELL_TYPE_SERVER 4
-
-/* True globals, no need for thread safety */
-static int le_link,le_res;
-
-#include <udm_config.h>
-#include <udmsearch.h>
-
-/* {{{ mnogosearch_functions[]
- */
-function_entry mnogosearch_functions[] = {
- PHP_FE(udm_api_version, NULL)
-
-#if UDM_VERSION_ID >= 30200
- PHP_FE(udm_check_charset, NULL)
-#if UDM_VERSION_ID == 30203
- PHP_FE(udm_open_stored, NULL)
- PHP_FE(udm_check_stored,NULL)
- PHP_FE(udm_close_stored,NULL)
-#endif
-#if UDM_VERSION_ID >= 30203
- PHP_FE(udm_crc32, NULL)
-#endif
-#if UDM_VERSION_ID >= 30204
- PHP_FE(udm_parse_query_string, NULL)
- PHP_FE(udm_make_excerpt, NULL)
- PHP_FE(udm_set_agent_param_ex, NULL)
- PHP_FE(udm_get_res_field_ex, NULL)
-#endif
-#if UDM_VERSION_ID >= 30211
- PHP_FE(udm_hash32, NULL)
- PHP_FE(udm_alloc_agent_array, NULL)
-#endif
-#endif
-
- PHP_FE(udm_alloc_agent, NULL)
- PHP_FE(udm_set_agent_param, NULL)
-
- PHP_FE(udm_load_ispell_data, NULL)
- PHP_FE(udm_free_ispell_data, NULL)
-
- PHP_FE(udm_add_search_limit, NULL)
- PHP_FE(udm_clear_search_limits, NULL)
-
- PHP_FE(udm_errno, NULL)
- PHP_FE(udm_error, NULL)
-
- PHP_FE(udm_find, NULL)
- PHP_FE(udm_get_res_param, NULL)
- PHP_FE(udm_get_res_field, NULL)
-
- PHP_FE(udm_cat_list, NULL)
- PHP_FE(udm_cat_path, NULL)
-
- PHP_FE(udm_free_res, NULL)
- PHP_FE(udm_free_agent, NULL)
-
-#if UDM_VERSION_ID > 30110
- PHP_FE(udm_get_doc_count, NULL)
-#endif
-
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry mnogosearch_module_entry = {
- STANDARD_MODULE_HEADER,
- "mnogosearch",
- mnogosearch_functions,
- PHP_MINIT(mnogosearch),
- PHP_MSHUTDOWN(mnogosearch),
- PHP_RINIT(mnogosearch),
- NULL,
- PHP_MINFO(mnogosearch),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-
-#ifdef COMPILE_DL_MNOGOSEARCH
-ZEND_GET_MODULE(mnogosearch)
-#endif
-
-static void _free_udm_agent(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- UDM_AGENT * Agent = (UDM_AGENT *)rsrc->ptr;
-#if UDM_VERSION_ID >= 30204
- UdmEnvFree(Agent->Conf);
- UdmAgentFree(Agent);
-#else
- UdmFreeEnv(Agent->Conf);
- UdmFreeAgent(Agent);
-#endif
-}
-
-static void _free_udm_res(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- UDM_RESULT * Res = (UDM_RESULT *)rsrc->ptr;
-
-#if UDM_VERSION_ID >= 30204
- UdmResultFree(Res);
-#else
- UdmFreeResult(Res);
-#endif
-}
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-DLEXPORT PHP_MINIT_FUNCTION(mnogosearch)
-{
- UdmInit();
- le_link = zend_register_list_destructors_ex(_free_udm_agent,NULL,"mnogosearch agent",module_number);
- le_res = zend_register_list_destructors_ex(_free_udm_res,NULL,"mnogosearch result",module_number);
-
- REGISTER_LONG_CONSTANT("UDM_FIELD_URLID", UDM_FIELD_URLID,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_URL", UDM_FIELD_URL,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_CONTENT", UDM_FIELD_CONTENT,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_TITLE", UDM_FIELD_TITLE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_KEYWORDS", UDM_FIELD_KEYWORDS,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_DESC", UDM_FIELD_DESC,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_DESCRIPTION", UDM_FIELD_DESC,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_TEXT", UDM_FIELD_TEXT,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_SIZE", UDM_FIELD_SIZE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_RATING", UDM_FIELD_RATING,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_SCORE", UDM_FIELD_RATING,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_MODIFIED", UDM_FIELD_MODIFIED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_ORDER", UDM_FIELD_ORDER,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_CRC", UDM_FIELD_CRC,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_CATEGORY", UDM_FIELD_CATEGORY,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_LANG", UDM_FIELD_LANG,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_CHARSET", UDM_FIELD_CHARSET,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_SITEID", UDM_FIELD_SITEID,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_POP_RANK", UDM_FIELD_POP_RANK,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_ORIGINID", UDM_FIELD_ORIGINID,CONST_CS | CONST_PERSISTENT);
-
- /* udm_set_agent_param constants */
- REGISTER_LONG_CONSTANT("UDM_PARAM_PAGE_SIZE", UDM_PARAM_PAGE_SIZE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_PAGE_NUM", UDM_PARAM_PAGE_NUM,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_SEARCH_MODE", UDM_PARAM_SEARCH_MODE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_CACHE_MODE", UDM_PARAM_CACHE_MODE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_TRACK_MODE", UDM_PARAM_TRACK_MODE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_PHRASE_MODE", UDM_PARAM_PHRASE_MODE,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_CHARSET", UDM_PARAM_CHARSET,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_LOCAL_CHARSET",UDM_PARAM_LOCAL_CHARSET,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_BROWSER_CHARSET",UDM_PARAM_BROWSER_CHARSET,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_STOPTABLE", UDM_PARAM_STOPTABLE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_STOP_TABLE", UDM_PARAM_STOPTABLE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_STOPFILE", UDM_PARAM_STOPFILE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_STOP_FILE", UDM_PARAM_STOPFILE,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_WEIGHT_FACTOR",UDM_PARAM_WEIGHT_FACTOR,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_WORD_MATCH", UDM_PARAM_WORD_MATCH,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_MAX_WORD_LEN",UDM_PARAM_MAX_WORD_LEN,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_MAX_WORDLEN", UDM_PARAM_MAX_WORD_LEN,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_MIN_WORD_LEN",UDM_PARAM_MIN_WORD_LEN,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_MIN_WORDLEN", UDM_PARAM_MIN_WORD_LEN,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_ISPELL_PREFIXES",UDM_PARAM_ISPELL_PREFIXES,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_ISPELL_PREFIX",UDM_PARAM_ISPELL_PREFIXES,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_PREFIXES", UDM_PARAM_ISPELL_PREFIXES,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_PREFIX", UDM_PARAM_ISPELL_PREFIXES,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_CROSS_WORDS", UDM_PARAM_CROSS_WORDS,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_CROSSWORDS", UDM_PARAM_CROSS_WORDS,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_VARDIR", UDM_PARAM_VARDIR,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_DATADIR", UDM_PARAM_VARDIR,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_HLBEG", UDM_PARAM_HLBEG,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_HLEND", UDM_PARAM_HLEND,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_SYNONYM", UDM_PARAM_SYNONYM,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_SEARCHD", UDM_PARAM_SEARCHD,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_STORED", UDM_PARAM_STORED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_GROUPBYSITE", UDM_PARAM_GROUPBYSITE,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_QSTRING", UDM_PARAM_QSTRING,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_REMOTE_ADDR", UDM_PARAM_REMOTE_ADDR,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_QUERY", UDM_PARAM_QUERY,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_SITEID", UDM_PARAM_SITEID,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_DETECT_CLONES",UDM_PARAM_DETECT_CLONES,CONST_CS | CONST_PERSISTENT);
-
- /* udm_add_search_limit constants */
- REGISTER_LONG_CONSTANT("UDM_LIMIT_CAT", UDM_LIMIT_CAT,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_LIMIT_URL", UDM_LIMIT_URL,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_LIMIT_TAG", UDM_LIMIT_TAG,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_LIMIT_LANG", UDM_LIMIT_LANG,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_LIMIT_DATE", UDM_LIMIT_DATE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_LIMIT_TYPE", UDM_LIMIT_TYPE,CONST_CS | CONST_PERSISTENT);
-
- /* udm_get_res_param constants */
- REGISTER_LONG_CONSTANT("UDM_PARAM_FOUND", UDM_PARAM_FOUND,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_NUM_ROWS", UDM_PARAM_NUM_ROWS,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_WORDINFO", UDM_PARAM_WORDINFO,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_WORDINFO_ALL",UDM_PARAM_WORDINFO_ALL,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_WORD_INFO", UDM_PARAM_WORDINFO,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_SEARCHTIME", UDM_PARAM_SEARCHTIME,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_SEARCH_TIME", UDM_PARAM_SEARCHTIME,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_FIRST_DOC", UDM_PARAM_FIRST_DOC,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_LAST_DOC", UDM_PARAM_LAST_DOC,CONST_CS | CONST_PERSISTENT);
-
- /* search modes */
- REGISTER_LONG_CONSTANT("UDM_MODE_ALL", UDM_MODE_ALL,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_MODE_ANY", UDM_MODE_ANY,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_MODE_BOOL", UDM_MODE_BOOL,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_MODE_PHRASE", UDM_MODE_PHRASE,CONST_CS | CONST_PERSISTENT);
-
- /* search cache params */
- REGISTER_LONG_CONSTANT("UDM_CACHE_ENABLED", UDM_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_CACHE_DISABLED", UDM_DISABLED,CONST_CS | CONST_PERSISTENT);
-
- /* track mode params */
- REGISTER_LONG_CONSTANT("UDM_TRACK_ENABLED", UDM_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_TRACK_DISABLED", UDM_DISABLED,CONST_CS | CONST_PERSISTENT);
-
- /* phrase mode params */
- REGISTER_LONG_CONSTANT("UDM_PHRASE_ENABLED", UDM_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PHRASE_DISABLED", UDM_DISABLED,CONST_CS | CONST_PERSISTENT);
-
- /* general params */
- REGISTER_LONG_CONSTANT("UDM_ENABLED", UDM_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_DISABLED", UDM_DISABLED,CONST_CS | CONST_PERSISTENT);
-
- /* crosswords mode params */
- REGISTER_LONG_CONSTANT("UDM_CROSS_WORDS_ENABLED",UDM_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_CROSSWORDS_ENABLED",UDM_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_CROSS_WORDS_DISABLED",UDM_DISABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_CROSSWORDS_DISABLED",UDM_DISABLED,CONST_CS | CONST_PERSISTENT);
-
- /* prefixes mode params */
- REGISTER_LONG_CONSTANT("UDM_PREFIXES_ENABLED", UDM_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PREFIX_ENABLED", UDM_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_ISPELL_PREFIXES_ENABLED",UDM_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_ISPELL_PREFIX_ENABLED",UDM_ENABLED,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PREFIXES_DISABLED", UDM_DISABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PREFIX_DISABLED", UDM_DISABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_ISPELL_PREFIXES_DISABLED",UDM_DISABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_ISPELL_PREFIX_DISABLED",UDM_DISABLED,CONST_CS | CONST_PERSISTENT);
-
- /* ispell type params */
- REGISTER_LONG_CONSTANT("UDM_ISPELL_TYPE_AFFIX", UDM_ISPELL_TYPE_AFFIX,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_ISPELL_TYPE_SPELL", UDM_ISPELL_TYPE_SPELL,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_ISPELL_TYPE_DB", UDM_ISPELL_TYPE_DB,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_ISPELL_TYPE_SERVER",UDM_ISPELL_TYPE_SERVER,CONST_CS | CONST_PERSISTENT);
-
- /* word match mode params */
- REGISTER_LONG_CONSTANT("UDM_MATCH_WORD", UDM_MATCH_WORD,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_MATCH_BEGIN", UDM_MATCH_BEGIN,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_MATCH_SUBSTR", UDM_MATCH_SUBSTR,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_MATCH_END", UDM_MATCH_END,CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-DLEXPORT PHP_MSHUTDOWN_FUNCTION(mnogosearch)
-{
- return SUCCESS;
-}
-
-
-DLEXPORT PHP_RINIT_FUNCTION(mnogosearch)
-{
- return SUCCESS;
-}
-
-
-DLEXPORT PHP_MINFO_FUNCTION(mnogosearch)
-{
- char buf[32];
-
- php_info_print_table_start();
- php_info_print_table_row(2, "mnoGoSearch Support", "enabled" );
-
- sprintf(buf,"%d", UDM_VERSION_ID);
- php_info_print_table_row(2, "mnoGoSearch library version", buf );
- php_info_print_table_end();
-}
-
-static char* MyRemoveHiLightDup(const char *s){
- size_t len=strlen(s)+1;
- char *res=malloc(len);
- char *d;
-
- for(d=res;s[0];s++){
- switch(s[0]){
- case '\2':
- case '\3':
- break;
- default:
- *d++=*s;
- }
- }
- *d='\0';
- return res;
-}
-
-/* {{{ proto int udm_alloc_agent(string dbaddr [, string dbmode])
- Allocate mnoGoSearch session */
-DLEXPORT PHP_FUNCTION(udm_alloc_agent)
-{
- switch(ZEND_NUM_ARGS()){
-
- case 1: {
- pval **yydbaddr;
- char *dbaddr;
- UDM_ENV * Env;
- UDM_AGENT * Agent;
-
- if(zend_get_parameters_ex(1,&yydbaddr)==FAILURE){
- RETURN_FALSE;
- }
- convert_to_string_ex(yydbaddr);
- dbaddr = Z_STRVAL_PP(yydbaddr);
-
-#if UDM_VERSION_ID >= 30204
- Env=UdmEnvInit(NULL);
- UdmVarListReplaceStr(&Env->Vars,"SyslogFacility","local7");
- UdmSetLogLevel(Env,0);
- UdmOpenLog("mnoGoSearch-php",Env,0);
-#if UDM_VERSION_ID <= 30210
- if(!memcmp(dbaddr,"searchd:",8)){
- UDM_URL Url;
- UdmURLParse(&Url,dbaddr);
- UdmDBListAdd(&Env->sdcl,Url.hostinfo);
- }
-
- UdmVarListReplaceStr(&Env->Vars,"DBAddr",dbaddr);
-
- if(UDM_OK!=UdmDBSetAddr(Env->db,dbaddr,UDM_OPEN_MODE_READ)){
- sprintf(Env->errstr,"Invalid DBAddr: '%s'",dbaddr);
-#if UDM_VERSION_ID <= 30207
- Env->errcode=1;
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Invalid DBAddr");
- RETURN_FALSE;
- }
-#else
- UdmDBListAdd(&Env->dbl,dbaddr, UDM_OPEN_MODE_WRITE);
-#endif
- Agent=UdmAgentInit(NULL,Env,0);
-#elif UDM_VERSION_ID >= 30200
- Env=UdmAllocEnv();
- Env->vars=UdmAllocVarList();
- Env->DBAddr=strdup(dbaddr);
- UdmEnvSetDBMode(Env,"single");
- Agent=UdmAllocAgent(Env,0,UDM_OPEN_MODE_READ);
-#else
- Env=UdmAllocEnv();
- UdmEnvSetDBAddr(Env,dbaddr);
- Agent=UdmAllocAgent(Env,0,UDM_OPEN_MODE_READ);
-#endif
- ZEND_REGISTER_RESOURCE(return_value,Agent,le_link);
- }
- break;
-
- case 2: {
- pval **yydbaddr;
- pval **yydbmode;
- char *dbaddr;
- char *dbmode;
- UDM_ENV * Env;
- UDM_AGENT * Agent;
-
- if(zend_get_parameters_ex(2,&yydbaddr,&yydbmode)==FAILURE){
- RETURN_FALSE;
- }
- convert_to_string_ex(yydbaddr);
- convert_to_string_ex(yydbmode);
- dbaddr = Z_STRVAL_PP(yydbaddr);
- dbmode = Z_STRVAL_PP(yydbmode);
-
-#if UDM_VERSION_ID >= 30204
- Env=UdmEnvInit(NULL);
- UdmVarListReplaceStr(&Env->Vars,"SyslogFacility","local7");
- UdmSetLogLevel(Env,0);
- UdmOpenLog("mnoGoSearch-php",Env,0);
-#if UDM_VERSION_ID <= 30210
- if(!memcmp(dbaddr,"searchd:",8)){
- UDM_URL Url;
- UdmURLParse(&Url,dbaddr);
- UdmDBListAdd(&Env->sdcl,Url.hostinfo);
- }
- UdmVarListReplaceStr(&Env->Vars,"DBAddr",dbaddr);
- if(UDM_OK!=UdmDBSetAddr(Env->db,dbaddr,UDM_OPEN_MODE_READ)){
- sprintf(Env->errstr,"Invalid DBAddr: '%s'",dbaddr);
-#if UDM_VERSION_ID <= 30207
- Env->errcode=1;
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Invalid DBAddr");
- RETURN_FALSE;
- }
-#else
- UdmDBListAdd(&Env->dbl,dbaddr, UDM_OPEN_MODE_WRITE);
-#endif
- Agent=UdmAgentInit(NULL,Env,0);
-#elif UDM_VERSION_ID >= 30200
- Env=UdmAllocEnv();
- Env->vars=UdmAllocVarList();
- Env->DBAddr=strdup(dbaddr);
- UdmEnvSetDBMode(Env,dbmode);
- Agent=UdmAllocAgent(Env,0,UDM_OPEN_MODE_READ);
-#else
- Env=UdmAllocEnv();
- UdmEnvSetDBAddr(Env,dbaddr);
- UdmEnvSetDBMode(Env,dbmode);
- Agent=UdmAllocAgent(Env,0,UDM_OPEN_MODE_READ);
-#endif
- ZEND_REGISTER_RESOURCE(return_value,Agent,le_link);
- }
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto int udm_set_agent_param(int agent, int var, string val)
- Set mnoGoSearch agent session parameters */
-DLEXPORT PHP_FUNCTION(udm_set_agent_param)
-{
- pval **yyagent, **yyvar, **yyval;
- char *val;
- int var;
- UDM_AGENT * Agent;
-
- switch(ZEND_NUM_ARGS()){
-
- case 3:
- if(zend_get_parameters_ex(3,&yyagent,&yyvar,&yyval)==FAILURE){
- RETURN_FALSE;
- }
- convert_to_long_ex(yyvar);
- convert_to_string_ex(yyval);
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-agent", le_link);
- var = Z_LVAL_PP(yyvar);
- val = Z_STRVAL_PP(yyval);
-
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- switch(var){
- case UDM_PARAM_PAGE_SIZE:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"ps",val);
-#else
- Agent->page_size=atoi(val);
- if(Agent->page_size<1)Agent->page_size=20;
-#endif
- break;
-
- case UDM_PARAM_PAGE_NUM:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"np",val);
-#else
- Agent->page_number=atoi(val);
- if(Agent->page_number<0)Agent->page_number=0;
-#endif
- break;
-
- case UDM_PARAM_SEARCH_MODE:
- switch (atoi(val)){
- case UDM_MODE_ALL:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"m","all");
-#else
- Agent->search_mode=UDM_MODE_ALL;
-#endif
- break;
-
- case UDM_MODE_ANY:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"m","any");
-#else
- Agent->search_mode=UDM_MODE_ANY;
-#endif
- break;
-
- case UDM_MODE_BOOL:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"m","bool");
-#else
- Agent->search_mode=UDM_MODE_BOOL;
-#endif
- break;
-
- case UDM_MODE_PHRASE:
-#if UDM_VERSION_ID >= 30200
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown search mode");
- RETURN_FALSE;
-#else
- Agent->search_mode=UDM_MODE_PHRASE;
-#endif
- break;
-
- default:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"m","all");
-#else
- Agent->search_mode=UDM_MODE_ALL;
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown search mode");
- RETURN_FALSE;
- break;
- }
- break;
-
- case UDM_PARAM_WORD_MATCH:
- switch (atoi(val)){
- case UDM_MATCH_WORD:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"wm","wrd");
-#else
- Agent->word_match=UDM_MATCH_WORD;
-#endif
- break;
-
- case UDM_MATCH_BEGIN:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"wm","beg");
-#else
- Agent->word_match=UDM_MATCH_BEGIN;
-#endif
- break;
-
- case UDM_MATCH_END:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"wm","end");
-#else
- Agent->word_match=UDM_MATCH_END;
-#endif
- break;
-
- case UDM_MATCH_SUBSTR:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"wm","sub");
-#else
- Agent->word_match=UDM_MATCH_SUBSTR;
-#endif
- break;
-
- default:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"wm","wrd");
-#else
- Agent->word_match=UDM_MATCH_WORD;
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown word match mode");
- RETURN_FALSE;
- break;
- }
- break;
- case UDM_PARAM_CACHE_MODE:
- switch (atoi(val)){
- case UDM_ENABLED:
-#if UDM_VERSION_ID < 30200
- Agent->cache_mode=UDM_ENABLED;
-#elif UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"Cache","yes");
-#else
- UdmReplaceStrVar(Agent->Conf->vars,"Cache","yes",UDM_VARSRC_GLOBAL);
-#endif
- break;
-
- case UDM_DISABLED:
-#if UDM_VERSION_ID < 30200
- Agent->cache_mode=UDM_DISABLED;
-#elif UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"Cache","no");
-#else
- UdmReplaceStrVar(Agent->Conf->vars,"Cache","no",UDM_VARSRC_GLOBAL);
-#endif
- break;
-
- default:
-#if UDM_VERSION_ID < 30200
- Agent->cache_mode=UDM_DISABLED;
-#elif UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"Cache","no");
-#else
- UdmReplaceStrVar(Agent->Conf->vars,"Cache","no",UDM_VARSRC_GLOBAL);
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown cache mode");
- RETURN_FALSE;
- break;
- }
-
- break;
-
- case UDM_PARAM_TRACK_MODE:
- switch (atoi(val)){
- case UDM_ENABLED:
-#if UDM_VERSION_ID < 30200
- Agent->track_mode|=UDM_TRACK_QUERIES;
-#elif UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"TrackQuery","yes");
-#else
- UdmReplaceStrVar(Agent->Conf->vars,"TrackQuery","yes",UDM_VARSRC_GLOBAL);
-#endif
- break;
-
- case UDM_DISABLED:
-#if UDM_VERSION_ID < 30200
- Agent->track_mode &= ~(UDM_TRACK_QUERIES);
-#elif UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"TrackQuery","no");
-#else
- UdmReplaceStrVar(Agent->Conf->vars,"TrackQuery","no",UDM_VARSRC_GLOBAL);
-#endif
-
- break;
-
- default:
-#if UDM_VERSION_ID < 30200
- Agent->track_mode &= ~(UDM_TRACK_QUERIES);
-#elif UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"TrackQuery","no");
-#else
- UdmReplaceStrVar(Agent->Conf->vars,"TrackQuery","no",UDM_VARSRC_GLOBAL);
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown track mode");
- RETURN_FALSE;
- break;
- }
-
- break;
-
- case UDM_PARAM_PHRASE_MODE:
-#if UDM_VERSION_ID < 30200
- switch (atoi(val)){
- case UDM_ENABLED:
- Agent->Conf->use_phrases=UDM_ENABLED;
- break;
-
- case UDM_DISABLED:
- Agent->Conf->use_phrases=UDM_DISABLED;
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown phrase mode");
- RETURN_FALSE;
- break;
- }
-#endif
- break;
-
- case UDM_PARAM_ISPELL_PREFIXES:
- switch (atoi(val)){
- case UDM_ENABLED:
-#if UDM_VERSION_ID < 30200
- Agent->Conf->ispell_mode |= UDM_ISPELL_USE_PREFIXES;
-#elif UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"IspellUsePrefixes","1");
-#else
- UdmAddIntVar(Agent->Conf->vars, "IspellUsePrefixes", 1, UDM_VARSRC_GLOBAL);
-#endif
- break;
-
- case UDM_DISABLED:
-#if UDM_VERSION_ID < 30200
- Agent->Conf->ispell_mode &= ~UDM_ISPELL_USE_PREFIXES;
-#elif UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"IspellUsePrefixes","0");
-#else
- UdmAddIntVar(Agent->Conf->vars, "IspellUsePrefixes", 0, UDM_VARSRC_GLOBAL);
-#endif
- break;
-
-
- default:
-#if UDM_VERSION_ID < 30200
- Agent->Conf->ispell_mode |= UDM_ISPELL_USE_PREFIXES;
-#elif UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"IspellUsePrefixes","0");
-#else
- UdmAddIntVar(Agent->Conf->vars, "IspellUsePrefixes", 1, UDM_VARSRC_GLOBAL);
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown ispell prefixes mode");
- RETURN_FALSE;
- break;
- }
-
- break;
-
- case UDM_PARAM_CHARSET:
- case UDM_PARAM_LOCAL_CHARSET:
-#if UDM_VERSION_ID < 30200
- Agent->Conf->local_charset=UdmGetCharset(val);
- Agent->charset=Agent->Conf->local_charset;
-#elif UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"LocalCharset",val);
- {
- const char * charset=UdmVarListFindStr(&Agent->Conf->Vars,"LocalCharset","iso-8859-1");
- Agent->Conf->lcs=UdmGetCharSet(charset);
- }
-#else
- Agent->Conf->local_charset=strdup(val);
- UdmReplaceStrVar(Agent->Conf->vars,"LocalCharset",val,UDM_VARSRC_GLOBAL);
-#endif
-
- break;
-
-#if UDM_VERSION_ID >= 30200
- case UDM_PARAM_BROWSER_CHARSET:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"BrowserCharset",val);
- {
- const char * charset=UdmVarListFindStr(&Agent->Conf->Vars,"BrowserCharset","iso-8859-1");
- Agent->Conf->bcs=UdmGetCharSet(charset);
- }
-#else
- Agent->Conf->browser_charset=strdup(val);
- UdmReplaceStrVar(Agent->Conf->vars,"BrowserCharset",val,UDM_VARSRC_GLOBAL);
-#endif
- break;
-
- case UDM_PARAM_HLBEG:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"HlBeg",val);
-#else
- UdmReplaceStrVar(Agent->Conf->vars,"HlBeg",val,UDM_VARSRC_GLOBAL);
-#endif
- break;
-
- case UDM_PARAM_HLEND:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"HlEnd",val);
-#else
- UdmReplaceStrVar(Agent->Conf->vars,"HlEnd",val,UDM_VARSRC_GLOBAL);
-#endif
- break;
-
- case UDM_PARAM_SYNONYM:
- if (UdmSynonymListLoad(Agent->Conf,val)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s",Agent->Conf->errstr);
- RETURN_FALSE;
-#if UDM_VERSION_ID >= 30204
- } else UdmSynonymListSort(&(Agent->Conf->Synonyms));
-#else
- } else UdmSynonymListSort(&(Agent->Conf->SynList));
-#endif
- break;
-
- case UDM_PARAM_SEARCHD:
-#if UDM_VERSION_ID <= 30203
- UdmSDCLientListAdd(&(Agent->Conf->sdcl),val);
- {
- size_t i;
- for(i=0;i<Agent->Conf->sdcl.nclients;i++){
- UdmSDCLientListAdd(&Agent->sdcl,Agent->Conf->sdcl.Clients[i].addr);
- }
- }
-#endif
- break;
-
- case UDM_PARAM_QSTRING:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"QUERY_STRING",val);
-#else
- UdmReplaceStrVar(Agent->Conf->vars,"QUERY_STRING",val,UDM_VARSRC_GLOBAL);
-#endif
- break;
-
-
- case UDM_PARAM_REMOTE_ADDR:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"IP",val);
-#else
- UdmReplaceStrVar(Agent->Conf->vars,"IP",val,UDM_VARSRC_GLOBAL);
-#endif
- break;
-#endif
-
- case UDM_PARAM_STOPTABLE:
-#if UDM_VERSION_ID < 30200
- strcat(Agent->Conf->stop_tables," ");
- strcat(Agent->Conf->stop_tables,val);
-#endif
- break;
-
- case UDM_PARAM_STOPFILE:
-#if UDM_VERSION_ID >= 30204
- if (UdmStopListLoad(Agent->Conf,val)) {
-#else
- if (UdmFileLoadStopList(Agent->Conf,val)) {
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", Agent->Conf->errstr);
- RETURN_FALSE;
- }
- break;
-
- case UDM_PARAM_WEIGHT_FACTOR:
-#if UDM_VERSION_ID < 30200
- Agent->weight_factor=strdup(val);
-#elif UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"wf",val);
-#else
- UdmReplaceStrVar(Agent->Conf->vars,"wf",val,UDM_VARSRC_GLOBAL);
- {
- size_t len;
-
- len=strlen(val);
- if((len>0)&&(len<256)){
- const char *sec;
- int sn;
-
- for(sn=0;sn<256;sn++){
- Agent->wf[sn]=0;
- }
-
- for(sec=val+len-1;sec>=val;sec--){
- Agent->wf[len-(sec-val)]=UdmHex2Int(*sec);
- }
- }
- }
-#endif
- break;
-
- case UDM_PARAM_MIN_WORD_LEN:
-#if UDM_VERSION_ID >= 30204
- Agent->Conf->WordParam.min_word_len=atoi(val);
-#else
- Agent->Conf->min_word_len=atoi(val);
-#endif
- break;
-
- case UDM_PARAM_MAX_WORD_LEN:
-#if UDM_VERSION_ID >= 30204
- Agent->Conf->WordParam.max_word_len=atoi(val);
-#else
- Agent->Conf->max_word_len=atoi(val);
-#endif
- break;
-
- case UDM_PARAM_CROSS_WORDS:
- switch (atoi(val)){
- case UDM_ENABLED:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"CrossWords","yes");
-#else
- Agent->Conf->use_crossword=UDM_ENABLED;
-#endif
- break;
-
- case UDM_DISABLED:
-#if UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"CrossWords","no");
-#else
- Agent->Conf->use_crossword=UDM_DISABLED;
-#endif
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown crosswords mode");
- RETURN_FALSE;
- break;
- }
-
- break;
-
-#if UDM_VERSION_ID > 30112
-
- case UDM_PARAM_VARDIR:
-#if UDM_VERSION_ID < 30200
- udm_snprintf(Agent->Conf->vardir,sizeof(Agent->Conf->vardir)-1,"%s%s",val,UDMSLASHSTR);
-#elif UDM_VERSION_ID >= 30208
- UdmVarListReplaceStr(&Agent->Conf->Vars,"Vardir",val);
-#elif UDM_VERSION_ID >= 30204
- UdmVarListReplaceStr(&Agent->Conf->Vars,"Vardir",val);
- snprintf(Agent->Conf->vardir,sizeof(Agent->Conf->vardir)-1,"%s%s",val,UDMSLASHSTR);
-#else
- snprintf(Agent->Conf->vardir,sizeof(Agent->Conf->vardir)-1,"%s%s",val,UDMSLASHSTR);
-#endif
- break;
-#endif
-
-#if UDM_VERSION_ID >= 30204
- case UDM_PARAM_QUERY:
- UdmVarListReplaceStr(&Agent->Conf->Vars,"q",val);
-
- break;
-
- case UDM_PARAM_STORED:
- UdmVarListReplaceStr(&Agent->Conf->Vars,"StoredAddr",val);
-
- break;
-#endif
-
-#if UDM_VERSION_ID >= 30207
- case UDM_PARAM_GROUPBYSITE:
- switch (atoi(val)){
- case UDM_ENABLED:
- UdmVarListReplaceStr(&Agent->Conf->Vars,"GroupBySite","yes");
-
- break;
-
- case UDM_DISABLED:
- UdmVarListReplaceStr(&Agent->Conf->Vars,"GroupBySite","no");
-
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown groupbysite mode");
- RETURN_FALSE;
- break;
- }
-
- break;
-
- case UDM_PARAM_SITEID:
- UdmVarListReplaceStr(&Agent->Conf->Vars,"site",val);
-
- break;
-
- case UDM_PARAM_DETECT_CLONES:
- switch (atoi(val)){
- case UDM_ENABLED:
- UdmVarListReplaceStr(&Agent->Conf->Vars,"DetectClones","yes");
-
- break;
-
- case UDM_DISABLED:
- UdmVarListReplaceStr(&Agent->Conf->Vars,"DetectClones","no");
-
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown clones mode");
- RETURN_FALSE;
- break;
- }
-
- break;
-#endif
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown agent session parameter");
- RETURN_FALSE;
- break;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_load_ispell_data(int agent, int var, string val1, [string charset], string val2, int flag)
- Load ispell data */
-DLEXPORT PHP_FUNCTION(udm_load_ispell_data)
-{
- pval **yyagent, **yyvar, **yyval1, **yyval2, **yyflag, **yycharset ;
- char *val1, *val2, *charset;
- int var, flag;
- UDM_AGENT * Agent;
-
- switch(ZEND_NUM_ARGS()){
-
- case 5:
- if(zend_get_parameters_ex(5,&yyagent,&yyvar,&yyval1,&yyval2,&yyflag)==FAILURE){
- RETURN_FALSE;
- }
- convert_to_long_ex(yyvar);
- convert_to_long_ex(yyflag);
- convert_to_string_ex(yyval1);
- convert_to_string_ex(yyval2);
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-agent", le_link);
- var = Z_LVAL_PP(yyvar);
- flag = Z_LVAL_PP(yyflag);
- val1 = Z_STRVAL_PP(yyval1);
- val2 = Z_STRVAL_PP(yyval2);
- charset = "us-ascii";
-
- break;
-
- case 6:
- if(zend_get_parameters_ex(6,&yyagent,&yyvar,&yyval1,&yycharset,&yyval2,&yyflag)==FAILURE){
- RETURN_FALSE;
- }
- convert_to_long_ex(yyvar);
- convert_to_long_ex(yyflag);
- convert_to_string_ex(yyval1);
- convert_to_string_ex(yyval2);
- convert_to_string_ex(yycharset);
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-agent", le_link);
- var = Z_LVAL_PP(yyvar);
- flag = Z_LVAL_PP(yyflag);
- val1 = Z_STRVAL_PP(yyval1);
- val2 = Z_STRVAL_PP(yyval2);
- charset = Z_STRVAL_PP(yycharset);
-
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
-
- switch(var){
-#if UDM_VERSION_ID < 30200
- case UDM_ISPELL_TYPE_DB:
- Agent->Conf->ispell_mode |= UDM_ISPELL_MODE_DB;
-
- if (UdmDBImportAffixes(Agent,Agent->charset) ||
- UdmImportDictionaryFromDB(Agent)) {
- RETURN_FALSE;
- }
-
- break;
-
-#if UDM_VERSION_ID > 30111
-
- case UDM_ISPELL_TYPE_SERVER:
- Agent->Conf->ispell_mode &= ~UDM_ISPELL_MODE_DB;
- Agent->Conf->ispell_mode |= UDM_ISPELL_MODE_SERVER;
-
- Agent->Conf->spellhost = strdup(val1);
-
- break;
-
-#endif
-#endif
-
- case UDM_ISPELL_TYPE_AFFIX:
-#if UDM_VERSION_ID < 30200
- Agent->Conf->ispell_mode &= ~UDM_ISPELL_MODE_DB;
-
-#if UDM_VERSION_ID > 30111
- Agent->Conf->ispell_mode &= ~UDM_ISPELL_MODE_SERVER;
-#endif
-
- if (UdmImportAffixes(Agent->Conf,val1,val2,NULL,0)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot load affix file %s",val2);
- RETURN_FALSE;
- }
-#else
- if (UdmImportAffixes(Agent->Conf,val1,charset,val2)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot load affix file %s",val2);
- RETURN_FALSE;
- }
-
-#endif
- break;
-
- case UDM_ISPELL_TYPE_SPELL:
-#if UDM_VERSION_ID < 30200
- Agent->Conf->ispell_mode &= ~UDM_ISPELL_MODE_DB;
-
-#if UDM_VERSION_ID > 30111
- Agent->Conf->ispell_mode &= ~UDM_ISPELL_MODE_SERVER;
-#endif
-
- if (UdmImportDictionary(Agent->Conf,val1,val2,1,"")) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot load spell file %s",val2);
- RETURN_FALSE;
- }
-#else
- if (UdmImportDictionary(Agent->Conf,val1,charset,val2,0,"")) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot load spell file %s",val2);
- RETURN_FALSE;
- }
-#endif
- break;
-
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown ispell type parameter");
- RETURN_FALSE;
- break;
- }
-
- if (flag) {
-#if UDM_VERSION_ID >= 30204
- if(Agent->Conf->Spells.nspell) {
- UdmSortDictionary(&Agent->Conf->Spells);
- UdmSortAffixes(&Agent->Conf->Affixes,&Agent->Conf->Spells);
- }
-#else
- if(Agent->Conf->nspell) {
- UdmSortDictionary(Agent->Conf);
- UdmSortAffixes(Agent->Conf);
- }
-#endif
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_free_ispell_data(int agent)
- Free memory allocated for ispell data */
-DLEXPORT PHP_FUNCTION(udm_free_ispell_data)
-{
- pval ** yyagent;
- UDM_AGENT * Agent;
- switch(ZEND_NUM_ARGS()){
- case 1: {
- if (zend_get_parameters_ex(1, &yyagent)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-Agent", le_link);
-
-#if UDM_VERSION_ID >= 30204
- UdmSpellListFree(&Agent->Conf->Spells);
- UdmAffixListFree(&Agent->Conf->Affixes);
-#elif UDM_VERSION_ID > 30111
- UdmFreeIspell(Agent->Conf);
-#endif
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_add_search_limit(int agent, int var, string val)
- Add mnoGoSearch search restrictions */
-DLEXPORT PHP_FUNCTION(udm_add_search_limit)
-{
- pval **yyagent, **yyvar, **yyval;
- char *val;
- int var;
- UDM_AGENT * Agent;
-
- switch(ZEND_NUM_ARGS()){
-
- case 3:
- if(zend_get_parameters_ex(3,&yyagent,&yyvar,&yyval)==FAILURE){
- RETURN_FALSE;
- }
- convert_to_long_ex(yyvar);
- convert_to_string_ex(yyval);
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-agent", le_link);
- var = Z_LVAL_PP(yyvar);
- val = Z_STRVAL_PP(yyval);
-
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- switch(var){
- case UDM_LIMIT_URL:
-#if UDM_VERSION_ID >= 30204
- UdmVarListAddStr(&Agent->Conf->Vars,"ul",val);
-#else
- UdmAddURLLimit(Agent->Conf,val);
-#endif
- break;
-
- case UDM_LIMIT_TAG:
-#if UDM_VERSION_ID >= 30204
- UdmVarListAddStr(&Agent->Conf->Vars,"t",val);
-#else
- UdmAddTagLimit(Agent->Conf,val);
-#endif
- break;
-
- case UDM_LIMIT_LANG:
-#if UDM_VERSION_ID >= 30204
- UdmVarListAddStr(&Agent->Conf->Vars,"lang",val);
-#else
- UdmAddLangLimit(Agent->Conf,val);
-#endif
- break;
-
- case UDM_LIMIT_CAT:
-#if UDM_VERSION_ID >= 30204
- UdmVarListAddStr(&Agent->Conf->Vars,"cat",val);
-#else
- UdmAddCatLimit(Agent->Conf,val);
-#endif
- break;
-
- case UDM_LIMIT_TYPE:
-#if UDM_VERSION_ID >= 30207
- UdmVarListAddStr(&Agent->Conf->Vars,"type",val);
-#endif
- break;
-
- case UDM_LIMIT_DATE:
-#if UDM_VERSION_ID < 30200
- {
- struct udm_stl_info_t stl_info = { 0, 0, 0 };
- char *edate;
-
- if (val[0] == '>') {
- Z_TYPE(stl_info)=1;
- } else if (val[0] == '<') {
- Z_TYPE(stl_info)=-1;
- } else if((val[0]=='#')&&(edate=strchr(val,','))){
- Z_TYPE(stl_info)=2;
- stl_info.t2=(time_t)(atol(edate+1));
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Incorrect date limit format");
- RETURN_FALSE;
- }
-
- stl_info.t1=(time_t)(atol(val+1));
- UdmAddTimeLimit(Agent->Conf,&stl_info);
- }
-#endif
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown search limit parameter");
- RETURN_FALSE;
- break;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_clear_search_limits(int agent)
- Clear all mnoGoSearch search restrictions */
-DLEXPORT PHP_FUNCTION(udm_clear_search_limits)
-{
- pval ** yyagent;
- UDM_AGENT * Agent;
- int i;
-
- switch(ZEND_NUM_ARGS()){
- case 1: {
- if (zend_get_parameters_ex(1, &yyagent)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-Agent", le_link);
-#if UDM_VERSION_ID >= 30204
- for(i=0;i<Agent->Conf->Vars.nvars;i++){
- if ((!strcasecmp("ul",Agent->Conf->Vars.Var[i].name))||
- (!strcasecmp("cat",Agent->Conf->Vars.Var[i].name))||
- (!strcasecmp("t",Agent->Conf->Vars.Var[i].name))||
- (!strcasecmp("lang",Agent->Conf->Vars.Var[i].name))) {
- UDM_FREE(Agent->Conf->Vars.Var[i].name);
- UDM_FREE(Agent->Conf->Vars.Var[i].val);
- Agent->Conf->Vars.nvars--;
- }
- }
-#else
- UdmClearLimits(Agent->Conf);
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-#if UDM_VERSION_ID >= 30200
-/* {{{ proto int udm_check_charset(int agent, string charset)
- Check if the given charset is known to mnogosearch */
-DLEXPORT PHP_FUNCTION(udm_check_charset)
-{
- pval ** yycharset, ** yyagent;
- UDM_AGENT * Agent;
- int id=-1;
-
- switch(ZEND_NUM_ARGS()){
- case 2: {
- if (zend_get_parameters_ex(2, &yyagent,&yycharset)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
- convert_to_string_ex(yycharset);
-
-
- if (UdmGetCharSet(Z_STRVAL_PP(yycharset))) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-#endif
-
-#if UDM_VERSION_ID >= 30203
-/* {{{ proto int udm_crc32(int agent, string str)
- Return CRC32 checksum of gived string */
-DLEXPORT PHP_FUNCTION(udm_crc32)
-{
- pval ** yystr, ** yyagent;
- char *str;
- int crc32;
- char buf[32];
- UDM_AGENT * Agent;
- int id=-1;
-
- switch(ZEND_NUM_ARGS()){
- case 2: {
- if (zend_get_parameters_ex(2, &yyagent,&yystr)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
- convert_to_string_ex(yystr);
- str = Z_STRVAL_PP(yystr);
-
- crc32=UdmCRC32((str),strlen(str));
- snprintf(buf,sizeof(buf)-1,"%u",crc32);
-
- RETURN_STRING(buf,1);
-}
-/* }}} */
-#endif
-
-#if UDM_VERSION_ID == 30203
-
-static ssize_t UdmRecvAll(int s, void *buf, size_t len, int flags) {
- size_t received = 0, r;
- char *b = buf;
- while ( (received < len) && ((r = recv(s, &b[received], len - received, flags)) >= 0 ) ) {
- received += r;
- }
- return received;
-}
-
-
-/* {{{ proto int udm_open_stored(int agent, string storedaddr)
- Open connection to stored */
-DLEXPORT PHP_FUNCTION(udm_open_stored)
-{
- pval ** yyagent, ** yyaddr;
-
- int s;
- char * addr;
- const char *hello = "F\0";
-
- UDM_AGENT * Agent;
- int id=-1;
-
- switch(ZEND_NUM_ARGS()){
- case 2: {
- if (zend_get_parameters_ex(2, &yyagent, &yyaddr)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
-
- convert_to_string_ex(yyaddr);
- addr = Z_STRVAL_PP(yyaddr);
-
- UdmReplaceStrVar(Agent->Conf->vars,"StoredAddr",addr,UDM_VARSRC_GLOBAL);
- Agent->Conf->stored_addr = strdup(UdmFindStrVar(Agent->Conf->vars, "StoredAddr", "localhost"));
-
- s = UdmStoreOpen(Agent->Conf);
-
- if (s >= 0) {
- send(s, hello, 1, 0);
- RETURN_LONG(s);
- } else RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int udm_close_stored(int agent, int link)
- Open connection to stored */
-DLEXPORT PHP_FUNCTION(udm_close_stored)
-{
- pval ** yylink, ** yyagent;
-
- int s;
- unsigned int rec_id = 0;
-
- UDM_AGENT * Agent;
- int id=-1;
-
- switch(ZEND_NUM_ARGS()){
- case 2: {
- if (zend_get_parameters_ex(2, &yyagent, &yylink)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
-
- convert_to_long_ex(yylink);
- s = Z_LVAL_PP(yylink);
-
-
- send(s, &rec_id, sizeof(rec_id), 0);
- closesocket(s);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_check_stored(int agent, int link, string doc_id)
- Open connection to stored */
-DLEXPORT PHP_FUNCTION(udm_check_stored)
-{
- pval ** yyid, ** yylink, ** yyagent;
-
- int s;
- unsigned int rec_id = 0;
- int store_found;
-
- UDM_AGENT * Agent;
- int id=-1;
-
- switch(ZEND_NUM_ARGS()){
- case 3: {
- if (zend_get_parameters_ex(3, &yyagent, &yylink, &yyid)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
-
- convert_to_long_ex(yylink);
- s = Z_LVAL_PP(yylink);
-
- convert_to_string_ex(yyid);
-
- rec_id=strtoul(Z_STRVAL_PP(yyid),NULL,10);
-
- send(s, &rec_id, sizeof(rec_id), 0);
- if (UdmRecvAll(s, &store_found, sizeof(store_found), MSG_WAITALL) < 0) {
- RETURN_LONG(store_found);
- } else RETURN_FALSE;
-}
-/* }}} */
-#endif
-
-#if UDM_VERSION_ID >= 30204
-/* {{{ proto int udm_parse_query_string(int agent, string str)
- Parses query string, initialises variables and search limits taken from it */
-DLEXPORT PHP_FUNCTION(udm_parse_query_string)
-{
- pval ** yystr, ** yyagent;
- char *str;
- UDM_AGENT * Agent;
- int id=-1;
-
- switch(ZEND_NUM_ARGS()){
- case 2: {
- if (zend_get_parameters_ex(2, &yyagent,&yystr)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
- convert_to_string_ex(yystr);
- str = Z_STRVAL_PP(yystr);
-
- UdmParseQueryString(Agent,&Agent->Conf->Vars,str);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_make_excerpt(int agent, int res, int row)
- Perform search */
-DLEXPORT PHP_FUNCTION(udm_make_excerpt)
-{
- pval ** yyagent, **yyres, **yyrow_num;
- UDM_RESULT * Res;
- UDM_AGENT * Agent;
- int id=-1, row;
-
- switch(ZEND_NUM_ARGS()){
- case 3: {
- if (zend_get_parameters_ex(3, &yyagent, &yyres, &yyrow_num)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(yyrow_num);
- row=atoi(Z_STRVAL_PP(yyrow_num));
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
- ZEND_FETCH_RESOURCE(Res, UDM_RESULT *, yyres, -1, "mnoGoSearch-Result", le_res);
-
- if(row<Res->num_rows){
- char *al;
- char *Excerpt;
-
- al = (char *)MyRemoveHiLightDup((const char *)(UdmVarListFindStr(&(Res->Doc[row].Sections), "URL", "")));
- UdmVarListReplaceInt(&(Res->Doc[row].Sections), "STORED_ID", UdmCRC32(al, strlen(al)));
- free(al);
-
- Excerpt = UdmExcerptDoc(Agent, Res, &(Res->Doc[row]), 256);
-
- if ((Excerpt != NULL) && (strlen(Excerpt) > 6)) {
- char *HlExcerpt = UdmHlConvert(&Res->WWList, Excerpt, Agent->Conf->lcs, Agent->Conf->bcs);
- UdmVarListReplaceStr(&(Res->Doc[row].Sections),"Body",HlExcerpt);
- UDM_FREE(HlExcerpt);
- }
- if (Excerpt != NULL && (UdmVarListFindStr(&(Res->Doc[row].Sections), "Z", NULL) == NULL)) {
- UdmVarListReplaceInt(&(Res->Doc[row].Sections),"ST",1);
- UDM_FREE(Excerpt);
- } else {
- UdmVarListReplaceInt(&(Res->Doc[row].Sections),"ST",0);
- RETURN_FALSE;
- }
- }else{
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"row number too large");
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_set_agent_param_ex(int agent, string var, string val)
- Set mnoGoSearch agent session parameters extended */
-DLEXPORT PHP_FUNCTION(udm_set_agent_param_ex)
-{
- pval **yyagent, **yyvar, **yyval;
- char *val, *var;
- UDM_AGENT * Agent;
-
- switch(ZEND_NUM_ARGS()){
-
- case 3:
- if(zend_get_parameters_ex(3,&yyagent,&yyvar,&yyval)==FAILURE){
- RETURN_FALSE;
- }
- convert_to_string_ex(yyvar);
- convert_to_string_ex(yyval);
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-agent", le_link);
- var = Z_STRVAL_PP(yyvar);
- val = Z_STRVAL_PP(yyval);
-
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- UdmVarListReplaceStr(&Agent->Conf->Vars,var,val);
-
- if (!strcasecmp(var,"LocalCharset")) {
- const char * charset=UdmVarListFindStr(&Agent->Conf->Vars,"LocalCharset","iso-8859-1");
- Agent->Conf->lcs=UdmGetCharSet(charset);
- } else if (!strcasecmp(var,"BrowserCharset")) {
- const char * charset=UdmVarListFindStr(&Agent->Conf->Vars,"BrowserCharset","iso-8859-1");
- Agent->Conf->bcs=UdmGetCharSet(charset);
- } else if (!strcasecmp(var,"Synonym")) {
- if (UdmSynonymListLoad(Agent->Conf,val)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s",Agent->Conf->errstr);
- RETURN_FALSE;
- } else UdmSynonymListSort(&(Agent->Conf->Synonyms));
- } else if (!strcasecmp(var,"Stopwordfile")) {
- if (UdmStopListLoad(Agent->Conf,val)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", Agent->Conf->errstr);
- RETURN_FALSE;
- }
- } else if (!strcasecmp(var,"MinWordLen")) {
- Agent->Conf->WordParam.min_word_len=atoi(val);
- } else if (!strcasecmp(var,"MaxWordLen")) {
- Agent->Conf->WordParam.max_word_len=atoi(val);
-#if UDM_VERSION_ID <= 30207
- } else if (!strcasecmp(var,"VarDir")) {
- snprintf(Agent->Conf->vardir,sizeof(Agent->Conf->vardir)-1,"%s%s",val,UDMSLASHSTR);
-#endif
- }
-
- RETURN_TRUE;
-}
-
-/* {{{ proto string udm_get_res_field_ex(int res, int row, string field)
- Fetch mnoGoSearch result field */
-DLEXPORT PHP_FUNCTION(udm_get_res_field_ex)
-{
- pval **yyres, **yyrow_num, **yyfield_name;
-
- UDM_RESULT * Res;
- int row;
- char *field;
-
- switch(ZEND_NUM_ARGS()){
- case 3: {
- if (zend_get_parameters_ex(3, &yyres,&yyrow_num,&yyfield_name)==FAILURE){
- RETURN_FALSE;
- }
- convert_to_string_ex(yyrow_num);
- convert_to_string_ex(yyfield_name);
- field = Z_STRVAL_PP(yyfield_name);
- row = atoi(Z_STRVAL_PP(yyrow_num));
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(Res, UDM_RESULT *, yyres, -1, "mnoGoSearch-Result", le_res);
- if(row<Res->num_rows){
- if (!strcasecmp(field,"URL")) {
- char *al;
- al = (char *)MyRemoveHiLightDup((const char *)(UdmVarListFindStr(&(Res->Doc[row].Sections), field, "")));
- UdmVarListReplaceStr(&Res->Doc[row].Sections,field,al);
- free(al);
- }
- RETURN_STRING((char *)UdmVarListFindStr(&Res->Doc[row].Sections,field,""),1);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"row number too large");
- RETURN_FALSE;
- }
-}
-/* }}} */
-#endif
-
-#if UDM_VERSION_ID >= 30211
-/* {{{ proto int udm_alloc_agent_array(array dbaddr)
- Allocate mnoGoSearch session */
-DLEXPORT PHP_FUNCTION(udm_alloc_agent_array)
-{
- switch(ZEND_NUM_ARGS()){
-
- case 1: {
- pval **yydbaddr;
- zval **tmp;
- char *dbaddr;
- UDM_ENV * Env;
- UDM_AGENT * Agent;
- HashPosition pos;
-
- if(zend_get_parameters_ex(1,&yydbaddr)==FAILURE){
- RETURN_FALSE;
- }
-
- if (Z_TYPE_PP(yydbaddr) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument DBAddr must be an array.");
- RETURN_FALSE;
- }
- convert_to_array_ex(yydbaddr);
-
- Env=UdmEnvInit(NULL);
- UdmVarListReplaceStr(&Env->Vars,"SyslogFacility","local7");
- UdmSetLogLevel(Env,0);
- UdmOpenLog("mnoGoSearch-php",Env,0);
-
- zend_hash_internal_pointer_reset_ex(HASH_OF(*yydbaddr), &pos);
-
- while (zend_hash_get_current_data_ex(HASH_OF(*yydbaddr), (void **)&tmp, &pos) == SUCCESS) {
- convert_to_string_ex(tmp);
- dbaddr = Z_STRVAL_PP(tmp);
- UdmDBListAdd(&Env->dbl,dbaddr, UDM_OPEN_MODE_WRITE);
-
- zend_hash_move_forward_ex(HASH_OF(*yydbaddr), &pos);
- }
-
- Agent=UdmAgentInit(NULL,Env,0);
- ZEND_REGISTER_RESOURCE(return_value,Agent,le_link);
- }
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto int udm_hash32(int agent, string str)
- Return Hash32 checksum of gived string */
-DLEXPORT PHP_FUNCTION(udm_hash32)
-{
- pval ** yystr, ** yyagent;
- char *str;
- udmhash32_t hash32;
- char buf[32];
- UDM_AGENT * Agent;
- int id=-1;
-
- switch(ZEND_NUM_ARGS()){
- case 2: {
- if (zend_get_parameters_ex(2, &yyagent,&yystr)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
- convert_to_string_ex(yystr);
- str = Z_STRVAL_PP(yystr);
-
- hash32=UdmHash32((str),strlen(str));
- snprintf(buf,sizeof(buf)-1,"%u",hash32);
-
- RETURN_STRING(buf,1);
-}
-/* }}} */
-#endif
-
-/* {{{ proto int udm_find(int agent, string query)
- Perform search */
-DLEXPORT PHP_FUNCTION(udm_find)
-{
- pval ** yyquery, ** yyagent;
- UDM_RESULT * Res;
- UDM_AGENT * Agent;
- int id=-1;
-
- switch(ZEND_NUM_ARGS()){
- case 2: {
- if (zend_get_parameters_ex(2, &yyagent,&yyquery)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
- convert_to_string_ex(yyquery);
-
-#if UDM_VERSION_ID < 30200
- if ((Res=UdmFind(Agent,UdmTolower(Z_STRVAL_PP(yyquery),Agent->charset)))) {
-#else
- if ((Res=UdmFind(Agent,Z_STRVAL_PP(yyquery)))) {
-#endif
- ZEND_REGISTER_RESOURCE(return_value,Res,le_res);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string udm_get_res_field(int res, int row, int field)
- Fetch mnoGoSearch result field */
-DLEXPORT PHP_FUNCTION(udm_get_res_field)
-{
- pval **yyres, **yyrow_num, **yyfield_name;
-
- UDM_RESULT * Res;
- int row,field;
-
- switch(ZEND_NUM_ARGS()){
- case 3: {
- if (zend_get_parameters_ex(3, &yyres,&yyrow_num,&yyfield_name)==FAILURE){
- RETURN_FALSE;
- }
- convert_to_string_ex(yyrow_num);
- convert_to_string_ex(yyfield_name);
- field=atoi(Z_STRVAL_PP(yyfield_name));
- row=atoi(Z_STRVAL_PP(yyrow_num));
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Res, UDM_RESULT *, yyres, -1, "mnoGoSearch-Result", le_res);
- if(row<Res->num_rows){
- switch(field){
- case UDM_FIELD_URL:
-#if UDM_VERSION_ID >= 30204
- {
- char *al;
- al = (char *)MyRemoveHiLightDup((const char *)(UdmVarListFindStr(&(Res->Doc[row].Sections), "URL", "")));
- UdmVarListReplaceStr(&Res->Doc[row].Sections,"URL",al);
- free(al);
-
- RETURN_STRING((char *)UdmVarListFindStr(&Res->Doc[row].Sections,"URL",""),1);
- }
-#else
- RETURN_STRING((Res->Doc[row].url)?(Res->Doc[row].url):"",1);
-#endif
- break;
-
- case UDM_FIELD_CONTENT:
-#if UDM_VERSION_ID >= 30204
- RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Content-Type",""),1);
-#else
- RETURN_STRING((Res->Doc[row].content_type)?(Res->Doc[row].content_type):"",1);
-#endif
- break;
-
- case UDM_FIELD_TITLE:
-#if UDM_VERSION_ID >= 30204
- RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Title",""),1);
-#else
- RETURN_STRING((Res->Doc[row].title)?(Res->Doc[row].title):"",1);
-#endif
- break;
-
- case UDM_FIELD_KEYWORDS:
-#if UDM_VERSION_ID >= 30204
- RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Meta.Keywords",""),1);
-#else
- RETURN_STRING((Res->Doc[row].keywords)?(Res->Doc[row].keywords):"",1);
-#endif
- break;
-
- case UDM_FIELD_DESC:
-#if UDM_VERSION_ID >= 30204
- RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Meta.Description",""),1);
-#else
- RETURN_STRING((Res->Doc[row].description)?(Res->Doc[row].description):"",1);
-#endif
- break;
-
- case UDM_FIELD_TEXT:
-#if UDM_VERSION_ID >= 30204
- RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Body",""),1);
-#else
- RETURN_STRING((Res->Doc[row].text)?(Res->Doc[row].text):"",1);
-#endif
- break;
-
- case UDM_FIELD_SIZE:
-#if UDM_VERSION_ID >= 30204
- RETURN_LONG(UdmVarListFindInt(&(Res->Doc[row].Sections),"Content-Length",0));
-#else
- RETURN_LONG((Res->Doc[row].size));
-#endif
- break;
-
- case UDM_FIELD_URLID:
-#if UDM_VERSION_ID >= 30204
- RETURN_LONG(UdmVarListFindInt(&(Res->Doc[row].Sections),"ID",0));
-#else
- RETURN_LONG((Res->Doc[row].url_id));
-#endif
- break;
-
- case UDM_FIELD_RATING:
-#if UDM_VERSION_ID >= 30204
- RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Score",""),1);
-#else
- RETURN_LONG((Res->Doc[row].rating));
-#endif
- break;
-
- case UDM_FIELD_MODIFIED:
-#if UDM_VERSION_ID >= 30204
- RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Last-Modified",""),1);
-#else
- RETURN_LONG((Res->Doc[row].last_mod_time));
-#endif
- break;
-
- case UDM_FIELD_ORDER:
-#if UDM_VERSION_ID >= 30204
- RETURN_LONG(UdmVarListFindInt(&(Res->Doc[row].Sections),"Order",0));
-#else
- RETURN_LONG((Res->Doc[row].order));
-#endif
- break;
-
- case UDM_FIELD_CRC:
-#if UDM_VERSION_ID >= 30204
- RETURN_LONG(UdmVarListFindInt(&(Res->Doc[row].Sections),"crc32",0));
-#else
- RETURN_LONG((Res->Doc[row].crc32));
-#endif
- break;
-
- case UDM_FIELD_CATEGORY:
-#if UDM_VERSION_ID >= 30204
- RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Category",""),1);
-#else
- RETURN_STRING((Res->Doc[row].category)?(Res->Doc[row].category):"",1);
-#endif
- break;
-
-#if UDM_VERSION_ID >= 30203
- case UDM_FIELD_LANG:
-#if UDM_VERSION_ID >= 30204
- RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Content-Language",""),1);
-#else
- RETURN_STRING((Res->Doc[row].lang)?(Res->Doc[row].lang):"",1);
-#endif
- break;
-
- case UDM_FIELD_CHARSET:
-#if UDM_VERSION_ID >= 30204
- RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Charset",""),1);
-#else
- RETURN_STRING((Res->Doc[row].charset)?(Res->Doc[row].charset):"",1);
-#endif
- break;
-#endif
-
-#if UDM_VERSION_ID >= 30207
- case UDM_FIELD_SITEID:
- RETURN_LONG(UdmVarListFindInt(&(Res->Doc[row].Sections),"Site_id",0));
-
- break;
-
- case UDM_FIELD_POP_RANK:
- RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Pop_Rank",""),1);
-
- break;
-
- case UDM_FIELD_ORIGINID:
- RETURN_LONG(UdmVarListFindInt(&(Res->Doc[row].Sections),"Origin-Id",0));
-
- break;
-#endif
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown mnoGoSearch field name");
- RETURN_FALSE;
- break;
- }
- }else{
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"row number too large");
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string udm_get_res_param(int res, int param)
- Get mnoGoSearch result parameters */
-DLEXPORT PHP_FUNCTION(udm_get_res_param)
-{
- pval ** yyres, ** yyparam;
- int param;
- UDM_RESULT * Res;
- switch(ZEND_NUM_ARGS()){
- case 2: {
- if (zend_get_parameters_ex(2, &yyres, &yyparam)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(yyparam);
- param=(Z_LVAL_PP(yyparam));
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Res, UDM_RESULT *, yyres, -1, "mnoGoSearch-Result", le_res);
- switch(param){
- case UDM_PARAM_NUM_ROWS:
- RETURN_LONG(Res->num_rows);
- break;
-
- case UDM_PARAM_FOUND:
- RETURN_LONG(Res->total_found);
- break;
-
- case UDM_PARAM_WORDINFO:
-#if UDM_VERSION_ID >= 30204
- {
- int len,i;
- for(len = i = 0; i < Res->WWList.nwords; i++)
- len += Res->WWList.Word[i].len;
- {
- size_t wsize=(1+len*15)*sizeof(char);
- char *wordinfo = (char*) malloc(wsize);
-
- *wordinfo = '\0';
-
- for(i = 0; i < Res->WWList.nwords; i++){
- if ((Res->WWList.Word[i].count > 0) || (Res->WWList.Word[i].origin == UDM_WORD_ORIGIN_QUERY)) {
- if(wordinfo[0]) strcat(wordinfo,", ");
- sprintf(UDM_STREND(wordinfo)," %s : %d", Res->WWList.Word[i].word, Res->WWList.Word[i].count);
- } else if (Res->WWList.Word[i].origin == UDM_WORD_ORIGIN_STOP) {
- if(wordinfo[0]) strcat(wordinfo,", ");
- sprintf(UDM_STREND(wordinfo)," %s : stopword", Res->WWList.Word[i].word);
- }
- }
- RETURN_STRING(wordinfo,1);
- }
- }
-#else
- RETURN_STRING((Res->wordinfo)?(Res->wordinfo):"",1);
-#endif
- break;
-
-#if UDM_VERSION_ID >= 30204
- case UDM_PARAM_WORDINFO_ALL:
- {
- int len,i;
- for(len = i = 0; i < Res->WWList.nwords; i++)
- len += Res->WWList.Word[i].len;
- {
- size_t wsize=(1+len*15)*sizeof(char);
- char *wordinfo = (char*) malloc(wsize);
- int corder = (size_t)-1, ccount = 0;
-
- *wordinfo = '\0';
-
- for(i = 0; i < Res->WWList.nwords; i++){
- if (Res->WWList.Word[i].order != corder) {
- if(wordinfo[0]) {
- sprintf(UDM_STREND(wordinfo)," / %d, ", ccount);
- }
- ccount = Res->WWList.Word[i].count;
- if (Res->WWList.Word[i].origin == UDM_WORD_ORIGIN_STOP) {
- sprintf(UDM_STREND(wordinfo)," %s : stopword", Res->WWList.Word[i].word);
- } else {
- sprintf(UDM_STREND(wordinfo)," %s : %d", Res->WWList.Word[i].word, Res->WWList.Word[i].count);
- corder = Res->WWList.Word[i].order;
- }
- } else {
- ccount += Res->WWList.Word[i].count;
- }
- }
- if (Res->WWList.nwords) {
- sprintf(UDM_STREND(wordinfo)," / %d", ccount);
- }
- RETURN_STRING(wordinfo,1);
- }
- }
- break;
-#endif
-
- case UDM_PARAM_SEARCHTIME:
- RETURN_DOUBLE(((double)Res->work_time)/1000);
- break;
-
- case UDM_PARAM_FIRST_DOC:
- RETURN_LONG(Res->first);
- break;
-
- case UDM_PARAM_LAST_DOC:
- RETURN_LONG(Res->last);
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown mnoGoSearch param name");
- RETURN_FALSE;
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto int udm_free_res(int res)
- mnoGoSearch free result */
-DLEXPORT PHP_FUNCTION(udm_free_res)
-{
- pval ** yyres;
- UDM_RESULT * Res;
- switch(ZEND_NUM_ARGS()){
- case 1: {
- if (zend_get_parameters_ex(1, &yyres)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Res, UDM_RESULT *, yyres, -1, "mnoGoSearch-Result", le_res);
- zend_list_delete(Z_LVAL_PP(yyres));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_free_agent(int agent)
- Free mnoGoSearch session */
-DLEXPORT PHP_FUNCTION(udm_free_agent)
-{
- pval ** yyagent;
- UDM_RESULT * Agent;
- switch(ZEND_NUM_ARGS()){
- case 1: {
- if (zend_get_parameters_ex(1, &yyagent)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_RESULT *, yyagent, -1, "mnoGoSearch-agent", le_link);
- zend_list_delete(Z_LVAL_PP(yyagent));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_errno(int agent)
- Get mnoGoSearch error number */
-DLEXPORT PHP_FUNCTION(udm_errno)
-{
- pval ** yyagent;
- UDM_AGENT * Agent;
- switch(ZEND_NUM_ARGS()){
- case 1: {
- if (zend_get_parameters_ex(1, &yyagent)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-Agent", le_link);
-#if UDM_VERSION_ID >= 30208
- if (UdmEnvErrMsg(Agent->Conf) && strlen(UdmEnvErrMsg(Agent->Conf))) {
- RETURN_LONG(1);
- } else {
- RETURN_LONG(0);
- }
-#elif UDM_VERSION_ID >= 30204
- RETURN_LONG(UdmEnvErrCode(Agent->Conf));
-#else
- RETURN_LONG(UdmDBErrorCode(Agent->db));
-#endif
-}
-/* }}} */
-
-/* {{{ proto string udm_error(int agent)
- Get mnoGoSearch error message */
-DLEXPORT PHP_FUNCTION(udm_error)
-{
- pval ** yyagent;
- UDM_AGENT * Agent;
-
- switch(ZEND_NUM_ARGS()){
- case 1: {
- if (zend_get_parameters_ex(1, &yyagent)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-Agent", le_link);
-#if UDM_VERSION_ID >= 30204
- RETURN_STRING((UdmEnvErrMsg(Agent->Conf))?(UdmEnvErrMsg(Agent->Conf)):"",1);
-#else
- RETURN_STRING((UdmDBErrorMsg(Agent->db))?(UdmDBErrorMsg(Agent->db)):"",1);
-#endif
-}
-/* }}} */
-
-/* {{{ proto int udm_api_version()
- Get mnoGoSearch API version */
-DLEXPORT PHP_FUNCTION(udm_api_version)
-{
- RETURN_LONG(UDM_VERSION_ID);
-}
-/* }}} */
-
-/* {{{ proto array udm_cat_list(int agent, string category)
- Get mnoGoSearch categories list with the same root */
-DLEXPORT PHP_FUNCTION(udm_cat_list)
-{
- pval ** yycat, ** yyagent;
- UDM_AGENT * Agent;
- char *cat;
-#if UDM_VERSION_ID >= 30204
- UDM_CATEGORY C;
-#else
- UDM_CATEGORY *c=NULL;
-#endif
- char *buf=NULL;
- int id=-1;
-
- switch(ZEND_NUM_ARGS()){
- case 2: {
- if (zend_get_parameters_ex(2, &yyagent,&yycat)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
- convert_to_string_ex(yycat);
- cat = Z_STRVAL_PP(yycat);
-
-#if UDM_VERSION_ID >= 30204
- bzero(&C,sizeof(C));
- strncpy(C.addr,cat,sizeof(C.addr)-1);
-#if UDM_VERSION_ID <= 30210
- if(!UdmCatAction(Agent,&C,UDM_CAT_ACTION_LIST,Agent->Conf->db)){
-#else
- if(UDM_OK == UdmCatAction(Agent,&C,UDM_CAT_ACTION_LIST)){
-#endif
-#else
- if((c=UdmCatList(Agent,cat))){
-#endif
- array_init(return_value);
-
- if (!(buf=calloc(1,UDMSTRSIZ+1))) {
- RETURN_FALSE;
- }
-
-#if UDM_VERSION_ID >= 30204
- {
- int i;
- if (C.ncategories) {
- for(i=0;i<C.ncategories;i++){
- add_next_index_stringl(return_value, C.Category[i].path,strlen(C.Category[i].path),1);
- add_next_index_stringl(return_value, C.Category[i].name,strlen(C.Category[i].name),1);
- }
- } else {
- RETURN_FALSE;
- }
- }
-#else
- while(c->rec_id){
- snprintf(buf, UDMSTRSIZ, "%s%s",c->link[0]?"@ ":"", c->name);
- add_next_index_string(return_value, c->link[0]?c->link:c->path, 1);
- add_next_index_string(return_value, buf, 1);
- c++;
- }
-#endif
- free(buf);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array udm_cat_path(int agent, string category)
- Get mnoGoSearch categories path from the root to the given catgory */
-DLEXPORT PHP_FUNCTION(udm_cat_path)
-{
- pval ** yycat, ** yyagent;
- UDM_AGENT * Agent;
- char *cat;
-#if UDM_VERSION_ID >= 30204
- UDM_CATEGORY C;
-#else
- UDM_CATEGORY *c=NULL;
-#endif
- char *buf=NULL;
- int id=-1;
-
- switch(ZEND_NUM_ARGS()){
- case 2: {
- if (zend_get_parameters_ex(2, &yyagent,&yycat)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
- convert_to_string_ex(yycat);
- cat = Z_STRVAL_PP(yycat);
-
-#if UDM_VERSION_ID >= 30204
- bzero(&C,sizeof(C));
- strncpy(C.addr,cat,sizeof(C.addr)-1);
-#if UDM_VERSION_ID <= 30210
- if(!UdmCatAction(Agent,&C,UDM_CAT_ACTION_PATH,Agent->Conf->db)){
-#else
- if(UDM_OK == UdmCatAction(Agent,&C,UDM_CAT_ACTION_PATH)){
-#endif
-#else
- if((c=UdmCatPath(Agent,cat))){
-#endif
- array_init(return_value);
-
- if (!(buf=calloc(1,UDMSTRSIZ+1))) {
- RETURN_FALSE;
- }
-
-#if UDM_VERSION_ID >= 30204
- {
- int i;
- if (C.ncategories) {
- for(i=0;i<C.ncategories;i++){
- add_next_index_stringl(return_value, C.Category[i].path,strlen(C.Category[i].path),1);
- add_next_index_stringl(return_value, C.Category[i].name,strlen(C.Category[i].name),1);
- }
- } else {
- RETURN_FALSE;
- }
- }
-#else
- while(c->rec_id){
- snprintf(buf, UDMSTRSIZ, "%s%s",c->link[0]?"@ ":"", c->name);
- add_next_index_string(return_value, c->link[0]?c->link:c->path, 1);
- add_next_index_string(return_value, buf, 1);
- c++;
- }
-#endif
- free(buf);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-#if UDM_VERSION_ID > 30110
-/* {{{ proto int udm_get_doc_count(int agent)
- Get total number of documents in database */
-DLEXPORT PHP_FUNCTION(udm_get_doc_count)
-{
- pval ** yyagent;
- UDM_AGENT * Agent;
- int id=-1;
-
- switch(ZEND_NUM_ARGS()){
- case 1: {
- if (zend_get_parameters_ex(1, &yyagent)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
-#if UDM_VERSION_ID >= 30204
-#if UDM_VERSION_ID <= 30210
- if (!Agent->doccount) UdmURLAction(Agent,NULL,UDM_URL_ACTION_DOCCOUNT,Agent->Conf->db);
-#else
- if (!Agent->doccount) UdmURLAction(Agent,NULL,UDM_URL_ACTION_DOCCOUNT);
-#endif
- RETURN_LONG(Agent->doccount);
-#else
- RETURN_LONG(UdmGetDocCount(Agent));
-#endif
-}
-/* }}} */
-#endif
-
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/mnogosearch/php_mnogo.h b/ext/mnogosearch/php_mnogo.h
deleted file mode 100644
index 574e299d8d..0000000000
--- a/ext/mnogosearch/php_mnogo.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* $Source$ */
-/* $Id$ */
-
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | Initial version by Alex Barkov <bar@izhcom.ru> |
- | and Ramil Kalimullin <ram@izhcom.ru> |
- | Further development by Sergey Kartashoff <gluke@mail.ru> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef _PHP_MNOGO_H
-#define _PHP_MNOGO_H
-
-#if HAVE_MNOGOSEARCH
-
-#include <udm_config.h>
-#include <udmsearch.h>
-
-#if UDM_VERSION_ID >= 30203
-#include <udm_crc32.h>
-#include <udm_store.h>
-#endif
-
-extern zend_module_entry mnogosearch_module_entry;
-#define mnogosearch_module_ptr &mnogosearch_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_MNOGO_API __declspec(dllexport)
-#else
-#define PHP_MNOGO_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-/* mnoGoSearch functions */
-DLEXPORT PHP_MINIT_FUNCTION(mnogosearch);
-DLEXPORT PHP_RINIT_FUNCTION(mnogosearch);
-DLEXPORT PHP_MSHUTDOWN_FUNCTION(mnogosearch);
-DLEXPORT PHP_MINFO_FUNCTION(mnogosearch);
-
-DLEXPORT PHP_FUNCTION(udm_api_version);
-#if UDM_VERSION_ID >= 30200
-DLEXPORT PHP_FUNCTION(udm_check_charset);
-#if UDM_VERSION_ID == 30203
-DLEXPORT PHP_FUNCTION(udm_open_stored);
-DLEXPORT PHP_FUNCTION(udm_check_stored);
-DLEXPORT PHP_FUNCTION(udm_close_stored);
-#endif
-#if UDM_VERSION_ID >= 30203
-DLEXPORT PHP_FUNCTION(udm_crc32);
-#endif
-#if UDM_VERSION_ID >= 30204
-DLEXPORT PHP_FUNCTION(udm_parse_query_string);
-DLEXPORT PHP_FUNCTION(udm_make_excerpt);
-DLEXPORT PHP_FUNCTION(udm_set_agent_param_ex);
-DLEXPORT PHP_FUNCTION(udm_get_res_field_ex);
-#endif
-#if UDM_VERSION_ID >= 30211
-DLEXPORT PHP_FUNCTION(udm_hash32);
-DLEXPORT PHP_FUNCTION(udm_alloc_agent_array);
-#endif
-#endif
-
-DLEXPORT PHP_FUNCTION(udm_alloc_agent);
-DLEXPORT PHP_FUNCTION(udm_set_agent_param);
-
-DLEXPORT PHP_FUNCTION(udm_load_ispell_data);
-DLEXPORT PHP_FUNCTION(udm_free_ispell_data);
-
-DLEXPORT PHP_FUNCTION(udm_add_search_limit);
-DLEXPORT PHP_FUNCTION(udm_clear_search_limits);
-
-DLEXPORT PHP_FUNCTION(udm_error);
-DLEXPORT PHP_FUNCTION(udm_errno);
-
-DLEXPORT PHP_FUNCTION(udm_find);
-DLEXPORT PHP_FUNCTION(udm_get_res_field);
-DLEXPORT PHP_FUNCTION(udm_get_res_param);
-
-DLEXPORT PHP_FUNCTION(udm_cat_list);
-DLEXPORT PHP_FUNCTION(udm_cat_path);
-
-DLEXPORT PHP_FUNCTION(udm_free_res);
-DLEXPORT PHP_FUNCTION(udm_free_agent);
-
-#if UDM_VERSION_ID > 30110
-DLEXPORT PHP_FUNCTION(udm_get_doc_count);
-#endif
-
-#else
-
-#define mnogosearch_module_ptr NULL
-
-#endif
-
-#define phpext_mnogosearch_ptr mnogosearch_module_ptr
-
-#endif /* _PHP_MNOGO_H */
diff --git a/ext/msession/CREDITS b/ext/msession/CREDITS
deleted file mode 100644
index 4703783a74..0000000000
--- a/ext/msession/CREDITS
+++ /dev/null
@@ -1,3 +0,0 @@
-msession
-Mark L. Woodward
-mailto:mlwmohawk@mohawksoft.com
diff --git a/ext/msession/README b/ext/msession/README
deleted file mode 100644
index a4ed70faed..0000000000
--- a/ext/msession/README
+++ /dev/null
@@ -1,33 +0,0 @@
-This is msession, it is an interface to a stand-alone session
-management system. The msession daemon can be found at
-Mohawk Software's web site.
-
-http://www.mohawksoft.com
-
-Requirements:
-Mohawk Software's Phoenix library.
-Mohawk Software's msession daemon.
-
-Building:
-In the config.m4 file you will need to specify the include
-and library directories for Phoenix. The setting in config.m4
-is probably wrong.
-
-You will need phoenix installed and built to compile this
-module.
-
-To use msession-test.php, msession must be the default session
-handler in PHP. The easiest way to do that is in the php.ini
-file as:
-
-[Session]
-session.save_handler = msession
-session.save_path = localhost
-
-The session.save.path is the host name of the server running
-msessiond.
-
-12/22/2001
-Changed msession_getdata(...) to msession_get_data(...)
-Changed msession_setdata(...) to msession_set_data(...)
-(docs to follow)
diff --git a/ext/msession/config.m4 b/ext/msession/config.m4
deleted file mode 100644
index f41d018c6d..0000000000
--- a/ext/msession/config.m4
+++ /dev/null
@@ -1,36 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(msession, for msession support,
-[ --with-msession[=DIR] Include msession support])
-
-if test "$PHP_MSESSION" != "no"; then
- if test -r $PHP_MSESSION/lib/libphoenix.a; then
- PHOENIX_DIR=$PHP_MSESSION
- else
- AC_MSG_CHECKING(for msession in default path)
- for i in /usr/local/phoenix /usr/local /usr; do
- if test -r $i/lib/libphoenix.a; then
- PHOENIX_DIR=$i
- AC_MSG_RESULT(found in $i)
- fi
- done
- fi
-
- if test -z "$PHOENIX_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the Phoenix / msession distribution)
- fi
-
-
- AC_DEFINE(HAVE_MSESSION, 1, [ ])
- PHP_ADD_LIBRARY_WITH_PATH(phoenix, "$PHOENIX_DIR/lib", PHOENIX_LIB)
- PHOENIX_INCLUDE="-I$PHOENIX_DIR"
- PHP_SUBST(PHOENIX_LIB)
-
- PHP_REQUIRE_CXX
- PHP_NEW_EXTENSION(msession, msession.c, $ext_shared)
- PHP_ADD_LIBRARY(stdc++)
-fi
-
diff --git a/ext/msession/msession-test.php b/ext/msession/msession-test.php
deleted file mode 100644
index e591fcca70..0000000000
--- a/ext/msession/msession-test.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?
-# msession-test.php
-# This is a test page for msession functions.
-# most msession functions are used in this page with
-# the exception of msession_get_data, and msession_set_data
-# which are used implicitly with the PHP session
-# extension.
-#
-#
-#
-
-# Start the session system, this will connect to msession
-# as configured in PHP.INI.
-#
-# Start sessions, this will set a cookie.
-session_start();
-
-# Now, optional, use msession_uniq() to create a guarenteed
-# uniq session name.
-#
-if(!$HTTP_COOKIE_VARS["PHPSESSID"])
-{
- # Use uniq to create the session. This is guarenteed to be
- # uniq in the server.
- $sid = msession_uniq(32);
- setcookie ("PHPSESSID", $sid);
- session_id($sid);
- $HTTP_COOKIE_VARS["PHPSESSID"] = $sid;
- # New session, set some variables
- if(0) // One at a time
- {
- echo "Set Variable: " . msession_set($sid, 'time',time()) ."<p>\n";
- echo "Set Variable: " . msession_set($sid, 'name1','test1') ."<p>\n";
- echo "Set Variable: " . msession_set($sid, 'name2','test2') ."<p>\n";
- echo "Set Variable: " . msession_set($sid, 'name3','test3') ."<p>\n";
- echo "Set Variable: " . msession_set($sid, 'name4','test4') ."<p>\n";
- echo "Set Variable: " . msession_set($sid, 'name5','test5') ."<p>\n";
- echo "Set Variable: " . msession_set($sid, 'name6','test6') ."<p>\n";
- echo "Set Variable: " . msession_set($sid, 'name7','test7') ."<p>\n";
- }
- else // All at once in an array
- {
- $setarray = array();
- $setarray['time']=time();
- $setarray['name1'] = 'test1';
- $setarray['name2'] = 'test2';
- $setarray['name3'] = 'test3';
- $setarray['name4'] = 'test4';
- $setarray['name5'] = 'test5';
- $setarray['name6'] = 'test6';
- $setarray['name7'] = 'test7';
- msession_set_array($sid, $setarray);
- }
-}
-else
-{
- $sid = $HTTP_COOKIE_VARS["PHPSESSID"];
-}
-
-#This makes a link between the variable $count and the
-# session variable "count"
-session_register("count");
-
-$count ++;
-
-# Output some information.
-echo "sid: " . $sid . "<br>\n";
-echo "Session Count: " . $count . "<br>\n";
-
-# Use msession_randstr() to produce a random string.
-# A valid string of n characters of jibberish is returned.
-echo "Random String: " . msession_randstr(32) . "<br>\n";
-
-# This is a thread safe increment, unlike PHP's session, many web servers
-# can be updating this variable and collisions are managed.
-# (for this to work, older versions of msessiond must be started with "-g globals"
-# newer versions create it by default)
-echo "Global Count: " . msession_inc(globals, "counter") . "<br>\n";
-
-# This gets a count of active sessions.
-echo "Total active sessions: " . msession_count() . "<br>\n";
-
-# This gets all the variables for a user in an associative array.
-$varray = msession_get_array($sid);
-
-if(!$varray)
- echo "Get variable array: Failed<br>\n";
-
-# Display all the user's variables
-$arraykeys = array_keys($varray);
-for($i=0; $arraykeys[$i]; $i++)
- echo "Key: " . $arraykeys[ $i ] ." = " .$varray[$arraykeys[$i]] ."<br>\n";
-
-
-# Find a list of all sessions with same name/value pair
-$array = msession_find('name1', 'test1');
-
-#display the sessions
-for($i=0; $array[$i]; $i++)
- echo "Similar Sessions: " . $i . " " . $array[$i] . "<br>\n";
-
-# Find all the sessions which have the variable "time" set.
-$vararray = msession_listvar('time');
-
-$arraykeys = array_keys($vararray);
-
-for($i=0; $arraykeys[$i]; $i++)
- echo "Key: " . $arraykeys[ $i ] ." = " .$vararray[$arraykeys[$i]] ."<br>\n";
-
-# msession can support a personality plugin, this is an escape call directly
-# into the plugin's REQ_ESCAPE function.
-echo "Call the plugin: " . msession_plugin($sid, 3, "test"). "<br>\n";
-
-# msession also supprts function-only plugins. this is a call into the demo
-# plugin (funct.so) which returns the uptime of the msessiond process.
-echo "Call the function: " . msession_call('fntest', "1","2", "3", "4") ."<br>\n";
-
-#List ALL sessions on the system
-$sarray = msession_list();
-
-for($i=0; $sarray[$i]; $i++)
- echo "Sessions: " . $i . " " . $sarray[$i] . "<br>\n";
-
-?>
-
diff --git a/ext/msession/msession.c b/ext/msession/msession.c
deleted file mode 100644
index 609d929273..0000000000
--- a/ext/msession/msession.c
+++ /dev/null
@@ -1,1384 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | msession 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2002 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Mark Woodward <markw@mohawksoft.com> |
- | Portions copyright the PHP group. |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_msession.h"
-#include "reqclient.h"
-#include "ext/standard/info.h"
-#include "ext/session/php_session.h"
-
-
-/* Macros and such */
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-#ifndef SID_LEN
-#define SID_LEN 32
-#endif
-
-
-/* Uncomment to get debugging messages */
-/* #define ERR_DEBUG */
-
-#ifdef ERR_DEBUG
-#define ELOG( str ) php_log_err( str )
-#else
-#define ELOG( str )
-#endif
-
-/* Test if system is OK fror use. */
-/* Macros may be ugly, but I can globaly add debuging when needed. */
-#define IFCONNECT_BEGIN if(s_reqb && s_conn) {
-#define IFCONNECT_ENDVAL(V) } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Msession not initialized"); return V; }
-#define IFCONNECT_END } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Msession not initialized"); RETURN_FALSE; }
-
-#ifndef HAVE_PHP_SESSION
-#error HAVE_PHP_SESSION not defined
-#endif
-
-/* Test if session module contains custom sesson ID patch */
-#ifdef PHP_SESSION_API
-#if (PHP_SESSION_API >= 20020330)
-#define HAVE_PHP_SESSION_CREATESID
-#endif
-#endif
-
-/* This sets the PHP API version used in the file. */
-/* If this module does not compile on the version of PHP you are using, look for */
-/* this value in Zend/zend_modules.h, and set appropriately */
-#if (ZEND_MODULE_API_NO <= 20001222)
-#define PHP_4_0
-#define TSRMLS_CC
-#define TSRMLS_DC
-#define TSRMLS_FETCH()
-/* Comment out this line if you wish to have msession without php sessions */
-#define HAVE_PHP_SESSION
-#warning Backward compatible msession extension requires PHP sessions. If PHP compiles and links, you can ignore this warning.
-#elif (ZEND_MODULE_API_NO >= 20010901)
-#define PHP_4_1
-#else
-#warning ZEND_MODULE_API_NO not defined
-#define PHP_4_1
-#endif
-
-/*
- * Please do not remove backward compatibility from this module.
- * this same source must also work with the 4.0.6 version of PHP.
- *
- * Module Variable naming hints:
- * All global scope variables begin with "g_" for global.
- * All static file scoped variables begin with "s_" for static.
- * Zero terminated strings generally start with "sz" for "string followed by zero."
- * integers that hold string or data lengths generally start with "cb" for "count of bytes."
- * Also, please to not reformat braces ;-)
- * -MLW
- */
-#if HAVE_MSESSION
-#ifdef HAVE_PHP_SESSION
-#ifdef HAVE_PHP_SESSION_CREATESID
-/* If the PHP Session module is compiled or available, include support */
-PS_FUNCS_SID(msession);
-ps_module ps_mod_msession = {
- PS_MOD_SID(msession)
-};
-#else
-PS_FUNCS(msession);
-ps_module ps_mod_msession = {
- PS_MOD(msession)
-};
-#endif
-#endif
-
-/* Per-process variables need by msession */
-static char s_szdefhost[]="localhost";
-static char * s_szhost=s_szdefhost;
-static int s_port=8086;
-static void * s_conn=NULL;
-static REQB * s_reqb=NULL;
-
-function_entry msession_functions[] = {
- PHP_FE(msession_connect,NULL)
- PHP_FE(msession_disconnect,NULL)
- PHP_FE(msession_lock,NULL)
- PHP_FE(msession_unlock,NULL)
- PHP_FE(msession_count,NULL)
- PHP_FE(msession_create,NULL)
- PHP_FE(msession_destroy,NULL)
- PHP_FE(msession_set,NULL)
- PHP_FE(msession_get,NULL)
- PHP_FE(msession_find,NULL)
- PHP_FE(msession_get_array,NULL)
- PHP_FE(msession_set_array,NULL)
- PHP_FE(msession_timeout,NULL)
- PHP_FE(msession_inc,NULL)
- PHP_FE(msession_set_data,NULL)
- PHP_FE(msession_get_data,NULL)
- PHP_FE(msession_listvar,NULL)
- PHP_FE(msession_list,NULL)
- PHP_FE(msession_uniq,NULL)
- PHP_FE(msession_randstr,NULL)
- PHP_FE(msession_plugin,NULL)
- PHP_FE(msession_call,NULL)
- PHP_FE(msession_ctl,NULL)
- PHP_FE(msession_exec,NULL)
- PHP_FE(msession_ping,NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry msession_module_entry = {
-#ifdef PHP_4_1
- STANDARD_MODULE_HEADER,
-#endif
- "msession",
- msession_functions,
- PHP_MINIT(msession),
- PHP_MSHUTDOWN(msession),
- PHP_RINIT(msession),
- PHP_RSHUTDOWN(msession),
- PHP_MINFO(msession),
-#ifdef PHP_4_1
- NO_VERSION_YET,
-#endif
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_MSESSION
-ZEND_GET_MODULE(msession)
-#endif
-
-PHP_MINIT_FUNCTION(msession)
-{
- s_conn = NULL;
- s_szhost = s_szdefhost;
-
-#ifdef HAVE_PHP_SESSION
- php_session_register_module(&ps_mod_msession);
-#endif
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(msession)
-{
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(msession)
-{
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(msession)
-{
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(msession)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "msession support", "enabled");
- php_info_print_table_end();
-}
-#define RPT_CONN_ERR
-#ifdef ERR_DEBUG
-#undef RPT_CONN_ERR
-#define RPT_CONN_ERR if(s_reqb->req.stat == REQ_ERR && (result == REQE_BADCONN || result == REQE_NOSEND)) \
- ELOG("Socket reports closed"); \
- else if(s_reqb->req.stat == REQ_ERR)\
- ELOG("MSession call failed");\
-#else
-#endif
-
-#define CONN_ERR(reqb)\
- (reqb->req.stat == REQ_ERR) && (reqb->req.param == REQE_BADCONN || reqb->req.param == REQE_NOSEND)
-
-int PHPExecRequest(int req, char *session, char *d1, char *d2,int param)
-{
- int result;
- FormatRequest(&s_reqb, req, session, d1, d2, param);
- result = DoRequest(s_conn, &s_reqb);
-
- /* Server closed the connection! */
- if(CONN_ERR(s_reqb))
- {
- ELOG("Connection was closed by server");
- if(ReopenReqConn(s_conn))
- {
- FormatRequest(&s_reqb, req, session, d1, d2, param);
- result = DoRequest(s_conn, &s_reqb);
- }
- }
- RPT_CONN_ERR
- return result;
-}
-int PHPExecRequestMulti(int req, char *session, int n, char **pairs, int param)
-{
- int result;
- FormatRequestMulti(&s_reqb, req, session, n, pairs, param);
- result = DoRequest(s_conn, &s_reqb);
-
- /* Server closed the connection! */
- if(CONN_ERR(s_reqb))
- {
- ELOG("Connection was closed by server");
- if(ReopenReqConn(s_conn))
- {
- FormatRequestMulti(&s_reqb, req, session, n, pairs, param);
- result = DoRequest(s_conn, &s_reqb);
- }
- }
- RPT_CONN_ERR
- return result;
-}
-int PHPExecRequestStrings(int req, char *session, int n, char **strings)
-{
- int result;
- FormatRequestStrings(&s_reqb, req, session, n, strings);
- result = DoRequest(s_conn, &s_reqb);
- /* Server closed the connection! */
- if(CONN_ERR(s_reqb))
- {
- ELOG("Connection was closed by server");
- if(ReopenReqConn(s_conn))
- {
- FormatRequestStrings(&s_reqb, req, session, n, strings);
- result = DoRequest(s_conn, &s_reqb);
- }
- }
- RPT_CONN_ERR
- return result;
-}
-
-
-int PHPMsessionConnect(const char *szhost, int nport)
-{
- int fNewHost=FALSE;
-
- if(!s_reqb)
- s_reqb = AllocateRequestBuffer(2048);
-
- if(!s_reqb) /* no buffer, it won't work! */
- return 0;
-
- if(strcmp(s_szhost, szhost))
- {
- if(s_szhost != s_szdefhost)
- free(s_szhost);
- s_szhost = strdup(szhost);
- fNewHost = TRUE;
- }
- if(nport && nport != s_port)
- {
- fNewHost = TRUE;
- s_port = nport;
- }
-
- ELOG("PHPMsessionConnect:new");
- if(s_conn && fNewHost)
- {
- ELOG("Closing old connection, opening new");
- CloseReqConn(s_conn);
- s_conn = NULL;
- }
- if(!s_conn)
- s_conn = OpenReqConn(s_szhost, s_port);
-#ifdef ERR_DEBUG
- else
- {
- ELOG("Reusing old connection");
- }
-#endif
-
-
-#ifdef ERR_DEBUG
-{
- char buffer[256];
- sprintf(buffer,"Connect: %s [%d] = %d (%X)\n",
- s_szhost, s_port, (s_conn != NULL), (unsigned)s_conn);
- php_log_err(buffer);
-}
-#endif
- return (s_conn) ? 1 : 0;
-}
-
-void PHPMsessionDisconnect()
-{
-}
-
-char *PHPMsessionGetData(char *session TSRMLS_DC)
-{
- char *ret = NULL;
- ELOG("PHPMsessionGetData");
-
- IFCONNECT_BEGIN
-
- PHPExecRequest(REQ_DATAGET, (char *)session,"","",0);
-
- if(s_reqb->req.stat==REQ_OK)
- ret = safe_estrdup(s_reqb->req.datum);
- IFCONNECT_ENDVAL(0)
-
- return ret;
-}
-int PHPMsessionSetData(char *session, char *data TSRMLS_DC)
-{
- ELOG("PHPMsessionSetData");
- IFCONNECT_BEGIN
- int ret=0;
-
- PHPExecRequest(REQ_DATASET, session,"",data,0);
- ret = (s_reqb->req.stat==REQ_OK);
- if(s_reqb->req.stat!=REQ_OK)
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
-
- return ret;
-
- IFCONNECT_ENDVAL(0)
-}
-int PHPMsessionDestroy(char *session TSRMLS_DC)
-{
- ELOG("PHPMsessionDestroy");
- IFCONNECT_BEGIN
-
- int ret=0;
- PHPExecRequest( REQ_DROP, session, "","",0);
- ret = (s_reqb->req.stat==REQ_OK);
- if(s_reqb->req.stat!=REQ_OK)
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- return ret;
-
- IFCONNECT_ENDVAL(0)
-}
-
-/* {{{ proto bool msession_connect(string host, string port)
- Connect to msession sever */
-PHP_FUNCTION(msession_connect)
-{
- char *szhost;
- int nport;
-
- zval **zhost;
- zval **zport;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &zhost, &zport) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(zhost);
- convert_to_string_ex(zport);
-
- szhost = Z_STRVAL_PP(zhost);
- nport = atoi(Z_STRVAL_PP(zport));
-
- if(PHPMsessionConnect(szhost,nport))
- {
- RETURN_TRUE;
- }
- else
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "MSession connect failed");
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto void msession_disconnect(void)
- Disconnect from msession server */
-PHP_FUNCTION(msession_disconnect)
-{
- PHPMsessionDisconnect();
- RETURN_NULL();
-}
-/* }}} */
-
-/* {{{ proto int msession_count(void)
- Get session count */
-PHP_FUNCTION(msession_count)
-{
- IFCONNECT_BEGIN
-
- int count;
- PHPExecRequest( REQ_COUNT, "", "","",0);
-
- count = (s_reqb->req.stat == REQ_OK) ? s_reqb->req.param : 0;
-
- RETURN_LONG(count);
-
- IFCONNECT_END
-}
-/* }}} */
-
-/* {{{ proto bool msession_create(string session)
- Create a session */
-PHP_FUNCTION(msession_create)
-{
- IFCONNECT_BEGIN
-/* int stat; */
- char *szsession;
- zval **session;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &session) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(session);
- szsession = Z_STRVAL_PP(session);
- PHPExecRequest( REQ_CREATE, szsession, "","",0);
- if(s_reqb->req.stat==REQ_OK)
- {
- RETURN_TRUE;
- }
- else
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_FALSE;
- }
- IFCONNECT_END
-}
-/* }}} */
-
-/* {{{ proto bool msession_destroy(string name)
- Destroy a session */
-PHP_FUNCTION(msession_destroy)
-{
- char *szsession;
- zval **session;
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &session) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(session);
- szsession = Z_STRVAL_PP(session);
- PHPMsessionDestroy(szsession TSRMLS_CC);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int msession_lock(string name)
- Lock a session */
-PHP_FUNCTION(msession_lock)
-{
- IFCONNECT_BEGIN
- char *szsession;
- zval **session;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &session) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(session);
- szsession = Z_STRVAL_PP(session);
- PHPExecRequest( REQ_SLOCK, szsession, "","",0);
-
- if(s_reqb->req.stat==REQ_OK)
- {
- RETURN_LONG(s_reqb->req.param);
- }
- else
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_FALSE;
- }
-
- IFCONNECT_END
-
-}
-/* }}} */
-/* {{{ proto int msession_ctl(string name)
- Lock a session */
-PHP_FUNCTION(msession_ctl)
-{
- static char *parray[] =
- { "EXIST",
- "TTL",
- "AGE",
- "TLA",
- "CTIME",
- "TOUCH",
- "NOW",
- NULL
- };
- IFCONNECT_BEGIN
- char *szsession;
- zval **session;
- zval **which;
- int fn = REQ_STAT_EXIST;
-
-
- int n = ZEND_NUM_ARGS();
-
- if(n != 1 && n != 2)
- {
- WRONG_PARAM_COUNT;
- }
-
- if(zend_get_parameters_ex(n,&session,&which) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(session);
- szsession = Z_STRVAL_PP(session);
-
- if(n > 1)
- {
- char *szwhich;
- int i;
- convert_to_string_ex(which);
- szwhich = Z_STRVAL_PP(which);
- for(i=0; parray[i]; i++)
- {
- if(strcasecmp(parray[i], szwhich) == 0)
- {
- ELOG(szwhich);
-
- fn = i;
- break;
- }
- }
- }
-
- PHPExecRequest( REQ_CTL, szsession, "","",fn);
-
- if(s_reqb->req.stat==REQ_OK)
- {
-#ifdef ERR_DEBUG
- char buffer[128];
- sprintf(buffer, "ret:%s", s_reqb->req.datum);
- ELOG(buffer);
-#endif
- s_reqb->req.param = atoi(s_reqb->req.datum);
- RETURN_LONG(s_reqb->req.param);
- }
- else
- {
- ELOG("msession_ctl failed");
- RETURN_FALSE;
- }
- IFCONNECT_END
-}
-
-/* {{{ proto int msession_unlock(string session, int key)
- Unlock a session */
-PHP_FUNCTION(msession_unlock)
-{
- IFCONNECT_BEGIN
- char *szsession;
- long lkey;
- zval **session;
- zval **key;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &session, &key) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(session);
- szsession = Z_STRVAL_PP(session);
- convert_to_long_ex(key);
- lkey = Z_LVAL_PP(key);
- PHPExecRequest( REQ_SUNLOCK, szsession, "","",lkey);
-
- if(s_reqb->req.stat==REQ_OK)
- {
- RETURN_LONG(s_reqb->req.param);
- }
- else
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_FALSE;
- }
- IFCONNECT_END
-}
-/* }}} */
-
-/* {{{ proto bool msession_set(string session, string name, string value)
- Set value in session */
-PHP_FUNCTION(msession_set)
-{
- IFCONNECT_BEGIN
-
- char *szsession;
- char *szname;
- char *szvalue;
- zval **session;
- zval **name;
- zval **value;
-
- if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3,&session,&name,&value) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(session);
- convert_to_string_ex(name);
- convert_to_string_ex(value);
-
- szsession = Z_STRVAL_PP(session);
- szname = Z_STRVAL_PP(name);
- szvalue = Z_STRVAL_PP(value);
-
- PHPExecRequest( REQ_SETVAL, szsession, szname, szvalue, 0);
-
- if(s_reqb->req.stat==REQ_OK)
- {
- RETURN_TRUE;
- }
- else
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_FALSE;
- }
- IFCONNECT_END
-}
-/* }}} */
-
-/* {{{ proto string msession_get(string session, string name, string default_value)
- Get value from session */
-PHP_FUNCTION(msession_get)
-{
- IFCONNECT_BEGIN
- char *szsession;
- char *szname;
- char *szvalue;
- zval **session;
- zval **name;
- zval **value;
-
- if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3,&session,&name,&value) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(session);
- convert_to_string_ex(name);
- convert_to_string_ex(value);
- szsession = Z_STRVAL_PP(session);
- szname = Z_STRVAL_PP(name);
- szvalue = Z_STRVAL_PP(value);
-
- PHPExecRequest( REQ_GETVAL, szsession, szname, szvalue,0);
-
- if(s_reqb->req.stat==REQ_OK)
- {
- szvalue = safe_estrdup(s_reqb->req.datum);
- RETURN_STRING(szvalue, 0)
- }
- else
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_NULL();
- }
- IFCONNECT_END
-}
-/* }}} */
-
-/* {{{ proto string msession_uniq(int num_chars)
- Get uniq id */
-PHP_FUNCTION(msession_uniq)
-{
- IFCONNECT_BEGIN
-
- long val;
- zval **param;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1,&param) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(param);
- val = Z_LVAL_PP(param);
-
- PHPExecRequest( REQ_UNIQ,"", "", "",val);
-
- if(s_reqb->req.stat==REQ_OK)
- {
- char *szval = safe_estrdup(s_reqb->req.datum);
- RETURN_STRING(szval, 0)
- }
- else
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_NULL();
- }
- IFCONNECT_END
-
-}
-/* }}} */
-
-/* {{{ proto string msession_randstr(int num_chars)
- Get random string */
-PHP_FUNCTION(msession_randstr)
-{
- IFCONNECT_BEGIN
- long val;
- zval **param;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1,&param) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(param);
- val = Z_LVAL_PP(param);
-
- PHPExecRequest( REQ_RANDSTR,"", "", "",val);
-
- if(s_reqb->req.stat==REQ_OK)
- {
- char *szval = safe_estrdup(s_reqb->req.datum);
- RETURN_STRING(szval, 0)
- }
- else
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_NULL();
- }
- IFCONNECT_END
-}
-/* }}} */
-
-/* {{{ proto array msession_find(string name, string value)
- Find all sessions with name and value */
-PHP_FUNCTION(msession_find)
-{
- IFCONNECT_BEGIN
-
- char *szname;
- char *szvalue;
- zval **name;
- zval **value;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &name, &value) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(name);
- convert_to_string_ex(value);
- szname = Z_STRVAL_PP(name);
- szvalue = Z_STRVAL_PP(value);
-
- PHPExecRequest( REQ_FIND, "", szname, szvalue,0);
-
- if(s_reqb->req.stat==REQ_OK && s_reqb->req.param)
- {
- int i;
- char *str = s_reqb->req.datum;
- array_init(return_value);
-
- for(i=0; i < s_reqb->req.param; i++)
- {
- int cbstr = strlen(str);
- char *data = safe_estrdup(str);
- add_index_string(return_value, i, data, 0);
- str += (cbstr+1);
- }
- }
- else if(s_reqb->req.stat != REQ_OK)
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_NULL();
- }
- IFCONNECT_END
-}
-/* }}} */
-
-/* {{{ proto array msession_list(void)
- List all sessions */
-PHP_FUNCTION(msession_list)
-{
- IFCONNECT_BEGIN
- PHPExecRequest( REQ_LIST, "", "", "",0);
-
- if(s_reqb->req.stat==REQ_OK && s_reqb->req.param)
- {
- int i;
- char *str = s_reqb->req.datum;
- array_init(return_value);
-
- for(i=0; i < s_reqb->req.param; i++)
- {
- int cbstr = strlen(str);
- char *data = safe_estrdup(str);
- add_index_string(return_value, i, data, 0);
- str += (cbstr+1);
- }
- }
- else if(s_reqb->req.stat != REQ_OK)
- {
- /* May this should be an error? */
- if(s_reqb->req.param != REQE_NOSESSION)
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_NULL();
- }
- IFCONNECT_END
-}
-/* }}} */
-
-/* {{{ proto array msession_get_array(string session)
- Get array of msession variables */
-PHP_FUNCTION(msession_get_array)
-{
- IFCONNECT_BEGIN
- char *szsession;
- zval **session;
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &session) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(session);
- szsession = Z_STRVAL_PP(session);
- PHPExecRequest( REQ_GETALL, szsession, "", "",0);
-
- array_init(return_value);
-
- if(s_reqb->req.stat == REQ_OK)
- {
- int i;
- char *str = s_reqb->req.datum;
- int num = s_reqb->req.param*2;
-
- for(i=0; i < num; i+=2)
- {
- int cbvalue;
- int cbname;
- char *szvalue;
- char *szname;
-
- cbname = strlen(str);
- szname = safe_estrndup(str,cbname);
- str += (cbname+1);
-
- cbvalue = strlen(str);
- szvalue = safe_estrndup(str,cbvalue);
- str += (cbvalue+1);
- add_assoc_string(return_value, szname, szvalue, 0);
- }
- }
- else
- {
- if(s_reqb->req.param != REQE_NOSESSION)
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_NULL();
- }
- IFCONNECT_END
-}
-/* }}} */
-
-/* {{{ proto bool msession_set_array(string session, array tuples)
- Set msession variables from an array*/
-PHP_FUNCTION(msession_set_array)
-{
- IFCONNECT_BEGIN
- zval **session;
- zval **tuples;
- HashPosition pos;
- zval **entry;
- char *key;
-#ifdef PHP_4_1
- uint keylen;
-#endif
-#ifdef PHP_4_0
- ulong keylen;
-#endif
- ulong numndx;
- int ndx=0;
- char **pairs;
- HashTable *htTuples;
- int i;
-
- int countpair;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &session, &tuples) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- htTuples = Z_ARRVAL_PP(tuples);
-
- countpair = zend_hash_num_elements(htTuples);
-
- pairs = (char **)emalloc(sizeof(char *) * countpair * 2);
-
- ELOG("have pairs");
-
- /* Initializes pos */
- zend_hash_internal_pointer_reset_ex(htTuples, &pos);
-
- ELOG("reset pointer");
-
- for(i=0; i < countpair; i++)
- {
- if(zend_hash_get_current_data_ex(htTuples, (void **)&entry, &pos) != SUCCESS)
- break;
-
- if(entry)
- {
- char *szentry;
- convert_to_string_ex(entry);
- szentry = Z_STRVAL_PP(entry);
-
- if(zend_hash_get_current_key_ex(htTuples,&key,&keylen,&numndx,0,&pos)== HASH_KEY_IS_STRING)
- {
-#ifdef ERR_DEBUG
-{
- char buffer [256];
- sprintf(buffer, "%s=%s\n", key, szentry);
- ELOG(buffer);
-}
-#endif
- pairs[ndx++] = key;
- pairs[ndx++] = szentry;
- }
- }
- zend_hash_move_forward_ex(htTuples, &pos);
- }
-
- PHPExecRequestMulti(REQ_SETVAL, Z_STRVAL_PP(session), countpair, pairs,0);
-
- if(s_reqb->req.stat != REQ_OK)
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- efree((void *)pairs);
- IFCONNECT_END
-}
-/* }}} */
-
-/* {{{ proto array msession_listvar(string name)
- return associative array of value:session for all sessions with a variable named 'name' */
-PHP_FUNCTION(msession_listvar)
-{
- IFCONNECT_BEGIN
- zval **name;
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &name) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(name);
- PHPExecRequest( REQ_LISTVAR, "", Z_STRVAL_PP(name), "",0);
-
- array_init(return_value);
-
- if(s_reqb->req.stat == REQ_OK)
- {
- int i;
- char *str = s_reqb->req.datum;
- int num = s_reqb->req.param*2;
-
- for(i=0; i < num; i+=2)
- {
- int cbvalue;
- int cbname;
- char *szvalue;
- char *szname;
-
- cbname= strlen(str);
- szname= safe_estrndup(str,cbname);
- str += (cbname+1);
-
- cbvalue = strlen(str);
- szvalue = safe_estrndup(str,cbvalue);
- str += (cbvalue+1);
- add_assoc_string(return_value, szname, szvalue, 0);
- }
- }
- else
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_NULL();
- }
- IFCONNECT_END
-}
-/* }}} */
-
-/* {{{ proto int msession_timeout(string session [, int param ])
- Set/get session timeout */
-PHP_FUNCTION(msession_timeout)
-{
- IFCONNECT_BEGIN
- zval **session;
- int ac = ZEND_NUM_ARGS();
- int zstat = FAILURE;
- int timeout = 0;
- if(ac == 1)
- {
- zstat = zend_get_parameters_ex(1, &session);
- }
- else if(ac == 2)
- {
- zval **param;
- zstat = zend_get_parameters_ex(2, &session, &param);
- convert_to_long_ex(param);
- timeout = Z_LVAL_PP(param);
- }
- if(zstat == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(session);
- PHPExecRequest( REQ_TIMEOUT, Z_STRVAL_PP(session), "","",timeout);
-
- if(s_reqb->req.stat == REQ_OK)
- {
- RETURN_LONG( s_reqb->req.param);
- }
- else
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_NULL();
- }
- IFCONNECT_END
-}
-/* }}} */
-
-/* {{{ proto string msession_inc(string session, string name)
- Increment value in session */
-PHP_FUNCTION(msession_inc)
-{
- IFCONNECT_BEGIN
- char *val;
- zval **session;
- zval **name;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &session, &name) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(session);
- convert_to_string_ex(name);
-
- PHPExecRequest( REQ_INC, Z_STRVAL_PP(session), Z_STRVAL_PP(name),0,0);
-
- if(s_reqb->req.stat==REQ_OK)
- {
- val = safe_estrdup(s_reqb->req.datum);
- RETURN_STRING(val, 0)
- }
- else
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_FALSE;
- }
- IFCONNECT_END
-}
-/* }}} */
-
-/* {{{ proto string msession_get_data(string session)
- Get data session unstructured data. (PHP sessions use this) */
-PHP_FUNCTION(msession_get_data)
-{
- IFCONNECT_BEGIN
- char *val;
- zval **session;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &session) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(session);
-
- val = PHPMsessionGetData(Z_STRVAL_PP(session) TSRMLS_CC);
-
- if(val)
- {
- RETURN_STRING(val, 0)
- }
- else
- {
- RETURN_NULL();
- }
- IFCONNECT_END
-}
-/* }}} */
-
-/* {{{ proto bool msession_set_data(string session, string value)
- Set data session unstructured data. (PHP sessions use this) */
-PHP_FUNCTION(msession_set_data)
-{
- IFCONNECT_BEGIN
- zval **session;
- zval **value;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &session, &value) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(session);
- convert_to_string_ex(value);
-
- if(PHPMsessionSetData(Z_STRVAL_PP(session), Z_STRVAL_PP(value) TSRMLS_CC))
- {
- RETURN_TRUE;
- }
- else
- {
- RETURN_FALSE;
- }
- IFCONNECT_END
-}
-/* }}} */
-
-/* {{{ proto string msession_plugin(string session, string val [, string param ])
- Call the personality plugin escape function */
-PHP_FUNCTION(msession_plugin)
-{
- IFCONNECT_BEGIN
- int ret;
- char *retval;
- zval **session;
- zval **val;
- zval **param=NULL;
-
- if(ZEND_NUM_ARGS() == 3)
- {
- ret = zend_get_parameters_ex(3, &session, &val, &param);
- convert_to_string_ex(param);
- }
- else if(ZEND_NUM_ARGS() == 2)
- {
- ret = zend_get_parameters_ex(2, &session, &val);
- }
- else
- {
- WRONG_PARAM_COUNT;
- }
- if(ret == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(session);
- convert_to_string_ex(val);
-
- ret = atoi(Z_STRVAL_PP(val));
-
- PHPExecRequest( REQ_PLUGIN, Z_STRVAL_PP(session), Z_STRVAL_PP(val), param ? Z_STRVAL_PP(param) : "",ret);
-
- if(s_reqb->req.stat==REQ_OK && s_reqb->req.len)
- {
- retval = safe_estrdup(s_reqb->req.datum);
- RETURN_STRING(retval, 0)
- }
- else if(s_reqb->req.stat != REQ_OK)
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_FALSE;
-
- }
- IFCONNECT_END
-}
-/* }}} */
-#define MAX_EXT_VAL 5
-/* {{{ proto string msession_call(string fn_name, [, string param1 ], ... [,string param4])
- Call the plugin function named fn_name */
-PHP_FUNCTION(msession_call)
-{
- IFCONNECT_BEGIN
- int n;
- int i;
- int ret;
- char *retval;
- zval **val[MAX_EXT_VAL];
- char *strings[MAX_EXT_VAL+1];
-/* zval **param=NULL; */
-
- n = ZEND_NUM_ARGS();
-
- if((n < 1) || (n > MAX_EXT_VAL))
- {
- WRONG_PARAM_COUNT;
- }
-
- ret = zend_get_parameters_ex(ZEND_NUM_ARGS(), &val[0],&val[1],&val[2],&val[3],&val[4]);
-
- if(ret == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- for(i=0; i < n; i++)
- {
- convert_to_string_ex(val[i]);
- strings[i] = Z_STRVAL_PP(val[i]);
- }
-
- PHPExecRequestStrings(REQ_CALL, NULL , n, strings);
-
- if(s_reqb->req.stat==REQ_OK && s_reqb->req.len)
- {
- retval = safe_estrdup(s_reqb->req.datum);
- RETURN_STRING(retval, 0)
- }
- else if(s_reqb->req.stat != REQ_OK)
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_FALSE;
- }
- IFCONNECT_END
-}
-/* }}} */
-/* {{{ proto string msession_exec(string cmdline)
- executes a program on msession system */
-PHP_FUNCTION(msession_exec)
-{
- IFCONNECT_BEGIN
- char *val;
- zval **cmdline;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &cmdline) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(cmdline);
-
- PHPExecRequest( REQ_EXEC, Z_STRVAL_PP(cmdline), "","",0);
-
- if(s_reqb->req.stat == REQ_OK)
- {
- val = safe_estrdup(s_reqb->req.datum);
- RETURN_STRING(val, 0)
- }
- else
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_NULL();
- }
- IFCONNECT_END
-}
-/* }}} */
-/* {{{ proto bool msession_ping(void)
- returns non-zero if msession is alive*/
-PHP_FUNCTION(msession_ping)
-{
- IFCONNECT_BEGIN
-
- PHPExecRequest(REQ_PING,"","","", 0);
-
- if(s_reqb->req.stat==REQ_OK)
- {
- RETURN_TRUE;
- }
- else
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- RETURN_FALSE;
- }
- IFCONNECT_END
-}
-/* }}} */
-
-#ifdef HAVE_PHP_SESSION
-
-PS_OPEN_FUNC(msession)
-{
- int port;
- int len = strlen(save_path)+1;
- char * path = alloca(len);
- char * szport;
-
- strcpy(path, save_path);
-
- szport = strchr(path, ':');
-
- if(szport)
- {
- *szport++=0;
- port = atoi(szport);
- }
- else
- {
- port = s_port;
- }
-
- ELOG( "ps_open_msession");
- PS_SET_MOD_DATA((void *)1); /* session.c needs a non-zero here! */
- return PHPMsessionConnect(path, port) ? SUCCESS : FAILURE;
-}
-
-PS_CLOSE_FUNC(msession)
-{
- ELOG( "ps_close_msession");
- PHPMsessionDisconnect();
- return SUCCESS;
-}
-
-PS_READ_FUNC(msession)
-{
- ELOG( "ps_read_msession");
- *val = PHPMsessionGetData((char *)key TSRMLS_CC);
- if(*val)
- {
- *vallen = strlen(*val);
- }
- else
- {
- *val = emalloc(1);
- **val=0;
- *vallen = 0;
- }
- return SUCCESS;
-}
-
-PS_WRITE_FUNC(msession)
-{
- ELOG( "ps_write_msession");
- return (PHPMsessionSetData((char *)key, (char *)val TSRMLS_CC)) ? SUCCESS : FAILURE;
-}
-
-PS_DESTROY_FUNC(msession)
-{
- ELOG( "ps_destroy_msession");
- return (PHPMsessionDestroy((char *)key TSRMLS_CC)) ? SUCCESS : FAILURE;
-}
-
-PS_GC_FUNC(msession)
-{
- ELOG( "ps_gc_msession");
- return SUCCESS;
-}
-
-#ifdef HAVE_PHP_SESSION_CREATESID
-PS_CREATE_SID_FUNC(msession)
-{
- if(s_reqb && s_conn)
- {
- ELOG("Should create a new session");
- PHPExecRequest( REQ_UNIQ,"", "", "",SID_LEN);
-
- if(s_reqb->req.stat==REQ_OK)
- {
- ELOG("Reports UNIQ success");
- if(newlen)
- *newlen = SID_LEN;
- return safe_estrdup(s_reqb->req.datum);
- }
- else
- {
- ELOG("Reports that UNIQ failed");
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ReqbErr(s_reqb));
- }
- }
- ELOG("Yikes, could not get sid from msession 2003");
- return php_session_create_id(mod_data, newlen TSRMLS_CC);
-}
-#endif /* HAVE_PHP_SESSION_CREATESID */
-#endif /* HAVE_PHP_SESSION */
-#endif /* HAVE_MSESSION */
-
diff --git a/ext/msession/msession.php b/ext/msession/msession.php
deleted file mode 100644
index 4eb9d9b6cd..0000000000
--- a/ext/msession/msession.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?
-$module = 'msession';
-$function = 'confirm_' . $module . '_compiled';
-if (extension_loaded($module)) {
- $str = $function($module);
-} else {
- $str = "Module $module is not compiled into PHP";
-}
-echo "$str\n";
-?>
diff --git a/ext/msession/php_msession.h b/ext/msession/php_msession.h
deleted file mode 100644
index 4884157cd6..0000000000
--- a/ext/msession/php_msession.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | msession 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2002 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Mark Woodward <markw@mohawksoft.com> |
- | Portions copyright the PHP group. |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_MSESSION_H
-#define PHP_MSESSION_H
-
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined.
-*/
-#if HAVE_MSESSION
-
-extern zend_module_entry msession_module_entry;
-#define phpext_msession_ptr &msession_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_MSESSION_API __declspec(dllexport)
-#else
-#define PHP_MSESSION_API
-#endif
-
-PHP_MINIT_FUNCTION(msession);
-PHP_MSHUTDOWN_FUNCTION(msession);
-PHP_RINIT_FUNCTION(msession);
-PHP_RSHUTDOWN_FUNCTION(msession);
-PHP_MINFO_FUNCTION(msession);
-
-PHP_FUNCTION(msession_connect);
-PHP_FUNCTION(msession_disconnect);
-PHP_FUNCTION(msession_lock);
-PHP_FUNCTION(msession_unlock);
-PHP_FUNCTION(msession_ctl);
-PHP_FUNCTION(msession_count);
-PHP_FUNCTION(msession_create);
-PHP_FUNCTION(msession_destroy);
-PHP_FUNCTION(msession_exec);
-PHP_FUNCTION(msession_set);
-PHP_FUNCTION(msession_get);
-PHP_FUNCTION(msession_find);
-PHP_FUNCTION(msession_get_array);
-PHP_FUNCTION(msession_set_array);
-PHP_FUNCTION(msession_timeout);
-PHP_FUNCTION(msession_inc);
-PHP_FUNCTION(msession_set_data);
-PHP_FUNCTION(msession_get_data);
-PHP_FUNCTION(msession_listvar);
-PHP_FUNCTION(msession_list);
-PHP_FUNCTION(msession_uniq);
-PHP_FUNCTION(msession_randstr);
-PHP_FUNCTION(msession_plugin);
-PHP_FUNCTION(msession_call);
-PHP_FUNCTION(msession_ping);
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-
-ZEND_BEGIN_MODULE_GLOBALS(msession)
- int global_variable;
- void *conn;
- char *host;
-ZEND_END_MODULE_GLOBALS(msession)
-
-*/
-/* In every function that needs to use variables in php_msession_globals,
- do call MSESSIONLS_FETCH(); after declaring other variables used by
- that function, and always refer to them as MSESSIONG(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define MSESSIONG(v) (msession_globals->v)
-#define MSESSIONLS_FETCH() php_msession_globals *msession_globals = ts_resource(msession_globals_id)
-#else
-#define MSESSIONG(v) (msession_globals.v)
-#define MSESSIONLS_FETCH()
-#endif
-
-#else
-
-#define phpext_msession_ptr NULL
-
-#endif
-
-#endif /* PHP_MSESSION_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/msession/reqclient.h b/ext/msession/reqclient.h
deleted file mode 100644
index daf460017c..0000000000
--- a/ext/msession/reqclient.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | msession 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Mark Woodward <markw@mohawksoft.com> |
- | Portions copyright the PHP group. |
- +----------------------------------------------------------------------+
- */
-
-/*
---------------------------------------------------------------------------
- These are definitions are pulled from Phoenix.
- It would probably be easier to maintain one file,
- but some phoenix header files conflict with other
- project header files common to PHP. Besides, this
- allows this header to be PHP license and Phoenix to
- be LGPL with no conflicts.
-
- MAKE NO CHANGES TO THIS FILE IT. MUST REMAIN CONSTANT
- WITH PHOENIX OR IT WILL NOT WORK.
---------------------------------------------------------------------------
-*/
-/* Required to use the new version of Phoenix 1.2 */
-
-#ifndef REQCLIENT_VER
-#define REQCLIENT_VER 030113
-#endif
-
-enum REQ_TYPES
-{
- REQ_ERR,
- REQ_OK,
- REQ_CTL,
- REQ_SETVAL,
- REQ_GETVAL,
- REQ_CREATE,
- REQ_DROP,
- REQ_GETALL,
- REQ_FIND,
- REQ_COUNT,
- REQ_FLUSH,
- REQ_SLOCK,
- REQ_SUNLOCK,
- REQ_TIMEOUT,
- REQ_INC,
- REQ_DATAGET,
- REQ_DATASET,
- REQ_LIST,
- REQ_LISTVAR,
- REQ_UNIQ,
- REQ_RANDSTR,
- REQ_PLUGIN,
- REQ_CALL,
- REQ_SERIALIZE,
- REQ_RESTORE,
- REQ_EXEC,
- REQ_LAST,
- REQ_INTERNAL_BEGIN=1023,
- REQ_INTERNALLAST,
-};
-enum REQ_ERRORS
-{
- REQE_NOERROR=0,
- REQE_NOSESSION,
- REQE_DUPSESSION,
- REQE_NOWLOCK,
- REQE_NOVALUE,
- REQE_LOCKED,
- REQE_NOSEND,
- REQE_NOCONNECT,
- REQE_BADCONN,
- REQE_BADHDR,
- REQE_BADVER,
- REQE_BADLEN,
- REQE_BUFFER,
- REQE_DENIED,
- REQE_NOFN,
- REQE_UNKNOWN
-};
-
-
-#define REQ_POPEN 1024
-#define REQ_PCLOSE 1025
-#define REQ_PING 1026
-
-typedef struct _requestPacket
-{
- int version;
- int stat;
- int len;
- int session;
- int name;
- int value;
- int param;
- char datum[0];
-}REQ;
-
-typedef struct _requestBuf
-{
- unsigned int type; // Type of packet, dynamic/static
- unsigned int size; // size of memory block
-#if (REQCLIENT_VER >= 030113)
- unsigned int fmt; // format, binary/ascii
- unsigned int reserved; // Just in case
-#else
-#warning You are using an old Phoenix definition, this will have problems with a newer version
-#endif
- REQ req;
-}REQB;
-
-#define MAX_REQ 16384
-
-#define REQB_STATIC 1
-#define REQB_DYNAMIC 2
-
-#define REQ_STAT_EXIST 0
-#define REQ_STAT_TTL 1
-#define REQ_STAT_AGE 2
-#define REQ_STAT_TLA 3
-#define REQ_STAT_CTIM 4
-#define REQ_STAT_TOUCH 5
-#define REQ_STAT_NOW 6
-
-
-#define STATIC_REQB( len ) \
- char buffer [ len ]; \
- REQB *preq = StaticRequestBuffer(buffer, len);
-
-#if defined (__cplusplus)
-extern "C" {
-#endif
-
-#define SIZEREQB(REQB,SIZE) (((REQB)->size >= (unsigned int) SIZE) ? REQB : SizeRequestBuffer(REQB,SIZE))
-REQB *AllocateRequestBuffer(unsigned size);
-void FreeRequestBuffer(REQB *req);
-REQB *SizeRequestBuffer(REQB *req, unsigned int size);
-REQB *StaticRequestBuffer(char *buffer, unsigned int cb);
-
-int FormatRequest(REQB **buffer, int stat, const char *session, const char *name, const char *value, int param);
-int FormatRequestMulti(REQB **buffer, int stat, char *session, int n, char **pairs, int param);
-int FormatRequestStrings(REQB **ppreq, int stat, char *session, int n, char **strings);
-int DoSingleRequest(char *hostname, int port, REQB **preq);
-void *OpenReqConn(char *hostname, int port);
-void CloseReqConn(void *conn);
-void DeleteReqConn(void *conn);
-unsigned char ReopenReqConn(void *conn);
-int DoRequest(void *conn, REQB **preq);
-char *ReqbErr(REQB *reqb);
-
-#define ASSERT_STAT(PREQ) if(PREQ->stat != REQ_OK) \
- {fprintf(stderr, "Error in Request %s %d %s\n", \
- __FILE__,__LINE__, ReqErr(PREQ->param)); exit(-1); }
-
-#if defined (__cplusplus)
- /* C API but with class definitions */
- int ReadRequestTimeout(REQB **ppreq, MSock *sock, int timeout);
- int ReadRequest(REQB **preq, MSock *sock);
- int WriteRequest(REQB *preq, MSock *sock);
-}
-#endif
-
diff --git a/ext/msql/CREDITS b/ext/msql/CREDITS
deleted file mode 100644
index 31ad918eaf..0000000000
--- a/ext/msql/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-mSQL
-Zeev Suraski
diff --git a/ext/msql/config.m4 b/ext/msql/config.m4
deleted file mode 100644
index 093dfa54e9..0000000000
--- a/ext/msql/config.m4
+++ /dev/null
@@ -1,42 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-dnl
-dnl Test mSQL version by checking if msql.h has "IDX_TYPE" defined.
-dnl
-AC_DEFUN(PHP_MSQL_VERSION,[
- AC_MSG_CHECKING([mSQL version])
- ac_php_oldcppflags=$CPPFLAGS
- CPPFLAGS="$INCLUDES $CPPFLAGS"
- AC_TRY_COMPILE([#include <sys/types.h>
-#include "msql.h"],[int i = IDX_TYPE],[
- AC_DEFINE(MSQL1,0,[ ])
- MSQL_VERSION="2.0 or newer"
- ],[
- AC_DEFINE(MSQL1,1,[ ])
- MSQL_VERSION=1.0
- ])
- CPPFLAGS=$ac_php_oldcppflags
- AC_MSG_RESULT($MSQL_VERSION)
-])
-
-PHP_ARG_WITH(msql,for mSQL support,
-[ --with-msql[=DIR] Include mSQL support. DIR is the mSQL base
- install directory, defaults to /usr/local/Hughes.])
-
- if test "$PHP_MSQL" != "no"; then
- if test "$PHP_MSQL" = "yes"; then
- MSQL_INCDIR=/usr/local/Hughes/include
- MSQL_LIBDIR=/usr/local/Hughes/lib
- else
- MSQL_INCDIR=$PHP_MSQL/include
- MSQL_LIBDIR=$PHP_MSQL/lib
- fi
- PHP_ADD_LIBRARY_WITH_PATH(msql, $MSQL_LIBDIR, MSQL_SHARED_LIBADD)
- PHP_ADD_INCLUDE($MSQL_INCDIR)
- AC_DEFINE(HAVE_MSQL,1,[ ])
- PHP_SUBST(MSQL_SHARED_LIBADD)
- PHP_NEW_EXTENSION(msql, php_msql.c, $ext_shared)
- PHP_MSQL_VERSION
- fi
diff --git a/ext/msql/msql.dsp b/ext/msql/msql.dsp
deleted file mode 100644
index 7b77d36edd..0000000000
--- a/ext/msql/msql.dsp
+++ /dev/null
@@ -1,107 +0,0 @@
-# Microsoft Developer Studio Project File - Name="msql" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=msql - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "msql.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "msql.mak" CFG="msql - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "msql - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "msql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "msql - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSQL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\win32" /D "WIN32" /D "COMPILE_DL_MSQL" /D ZTS=1 /D HAVE_MSQL=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib php4ts.lib msql_dll.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_msql.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "msql - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSQL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSQL=1 /D COMPILE_DL_MSQL=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib php4ts_debug.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_msql.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "msql - Win32 Release_TS"
-# Name "msql - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_msql.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_msql.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/msql/php_msql.c b/ext/msql/php_msql.c
deleted file mode 100644
index f4736f5df1..0000000000
--- a/ext/msql/php_msql.c
+++ /dev/null
@@ -1,1317 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_msql.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-#include "php_globals.h"
-
-#if HAVE_MSQL
-
-#define OS_UNIX 1
-
-#if defined(WIN32) && defined(MSQL1)
-#include <msql1.h>
-#else
-#include <msql.h>
-#endif
-
-static php_msql_globals msql_globals;
-
-#define MSQL_ASSOC 1<<0
-#define MSQL_NUM 1<<1
-#define MSQL_BOTH (MSQL_ASSOC|MSQL_NUM)
-
-/* {{{ msql_functions[]
- */
-function_entry msql_functions[] = {
- PHP_FE(msql_connect, NULL)
- PHP_FE(msql_pconnect, NULL)
- PHP_FE(msql_close, NULL)
- PHP_FE(msql_select_db, NULL)
- PHP_FE(msql_create_db, NULL)
- PHP_FE(msql_drop_db, NULL)
- PHP_FE(msql_query, NULL)
- PHP_FE(msql_db_query, NULL)
- PHP_FE(msql_list_dbs, NULL)
- PHP_FE(msql_list_tables, NULL)
- PHP_FE(msql_list_fields, NULL)
- PHP_FE(msql_error, NULL)
- PHP_FE(msql_result, NULL)
- PHP_FE(msql_num_rows, NULL)
- PHP_FE(msql_num_fields, NULL)
- PHP_FE(msql_fetch_row, NULL)
- PHP_FE(msql_fetch_array, NULL)
- PHP_FE(msql_fetch_object, NULL)
- PHP_FE(msql_data_seek, NULL)
- PHP_FE(msql_fetch_field, NULL)
- PHP_FE(msql_field_seek, NULL)
- PHP_FE(msql_free_result, NULL)
- PHP_FE(msql_field_name, NULL)
- PHP_FE(msql_field_table, NULL)
- PHP_FE(msql_field_len, NULL)
- PHP_FE(msql_field_type, NULL)
- PHP_FE(msql_field_flags, NULL)
-
- PHP_FALIAS(msql_fieldname, msql_field_name, NULL)
- PHP_FALIAS(msql_fieldtable, msql_field_table, NULL)
- PHP_FALIAS(msql_fieldlen, msql_field_len, NULL)
- PHP_FALIAS(msql_fieldtype, msql_field_type, NULL)
- PHP_FALIAS(msql_fieldflags, msql_field_flags, NULL)
-
- PHP_FALIAS(msql_regcase, sql_regcase, NULL)
-
- PHP_FALIAS(msql_affected_rows, msql_affected_rows, NULL)
-
- /* for downwards compatability */
- PHP_FALIAS(msql, msql_db_query, NULL)
- PHP_FALIAS(msql_selectdb, msql_select_db, NULL)
- PHP_FALIAS(msql_createdb, msql_create_db, NULL)
- PHP_FALIAS(msql_dropdb, msql_drop_db, NULL)
- PHP_FALIAS(msql_freeresult, msql_free_result, NULL)
- PHP_FALIAS(msql_numfields, msql_num_fields, NULL)
- PHP_FALIAS(msql_numrows, msql_num_rows, NULL)
- PHP_FALIAS(msql_listdbs, msql_list_dbs, NULL)
- PHP_FALIAS(msql_listtables, msql_list_tables, NULL)
- PHP_FALIAS(msql_listfields, msql_list_fields, NULL)
- PHP_FALIAS(msql_dbname, msql_result, NULL)
- PHP_FALIAS(msql_tablename, msql_result, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry msql_module_entry = {
- STANDARD_MODULE_HEADER,
- "msql", msql_functions, PHP_MINIT(msql), NULL, PHP_RINIT(msql), NULL,
- PHP_MINFO(msql), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES
-};
-
-
-#ifdef COMPILE_DL_MSQL
-ZEND_GET_MODULE(msql)
-#endif
-
-typedef struct {
- m_result *result;
- int af_rows;
-} m_query;
-
-#define MSQL_GET_QUERY(res) \
- ZEND_FETCH_RESOURCE(msql_query, m_query *, &res, -1, "mSQL result", msql_globals.le_query); \
- msql_result = msql_query->result
-
-static void _delete_query(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- m_query *query = (m_query *)rsrc->ptr;
-
- if(query->result) msqlFreeResult(query->result);
- efree(query);
-}
-
-static m_query *php_msql_query_wrapper(m_result *res, int af_rows)
-{
- m_query *query = (m_query *) emalloc(sizeof(m_query));
-
- query->result = res;
- query->af_rows = af_rows;
-
- return query;
-}
-
-static void _close_msql_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- int link = (int)rsrc->ptr;
-
- msqlClose(link);
- msql_globals.num_links--;
-}
-
-
-static void _close_msql_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- int link = (int)rsrc->ptr;
-
- msqlClose(link);
- msql_globals.num_persistent--;
- msql_globals.num_links--;
-}
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(msql)
-{
- if (cfg_get_long("msql.allow_persistent",&msql_globals.allow_persistent)==FAILURE) {
- msql_globals.allow_persistent=1;
- }
- if (cfg_get_long("msql.max_persistent",&msql_globals.max_persistent)==FAILURE) {
- msql_globals.max_persistent=-1;
- }
- if (cfg_get_long("msql.max_links",&msql_globals.max_links)==FAILURE) {
- msql_globals.max_links=-1;
- }
- msql_globals.num_persistent=0;
- msql_globals.le_query = zend_register_list_destructors_ex(_delete_query, NULL, "msql query", module_number);
- msql_globals.le_link = zend_register_list_destructors_ex(_close_msql_link, NULL, "msql link", module_number);
- msql_globals.le_plink = zend_register_list_destructors_ex(NULL, _close_msql_plink, "msql link persistent", module_number);
-
- Z_TYPE(msql_module_entry) = type;
-
- REGISTER_LONG_CONSTANT("MSQL_ASSOC", MSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSQL_NUM", MSQL_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSQL_BOTH", MSQL_BOTH, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(msql)
-{
- msql_globals.default_link=-1;
- msql_globals.num_links = msql_globals.num_persistent;
- msqlErrMsg[0]=0;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(msql)
-{
- char maxp[32],maxl[32];
-
- if (msql_globals.max_persistent==-1) {
- snprintf(maxp, 31, "%d/unlimited", msql_globals.num_persistent );
- } else {
- snprintf(maxp, 31, "%d/%ld", msql_globals.num_persistent, msql_globals.max_persistent);
- }
- maxp[31]=0;
-
- if (msql_globals.max_links==-1) {
- snprintf(maxl, 15, "%d/unlimited", msql_globals.num_links );
- } else {
- snprintf(maxl, 15, "%d/%ld", msql_globals.num_links, msql_globals.max_links);
- }
- maxl[31]=0;
-
- php_info_print_table_start();
- php_info_print_table_row(2, "MSQL Support", "enabled" );
- php_info_print_table_row(2, "Allow Persistent Links", (msql_globals.allow_persistent?"yes":"no") );
- php_info_print_table_row(2, "Persistent Links", maxp );
- php_info_print_table_row(2, "Total Links", maxl );
- php_info_print_table_end();
-
-}
-/* }}} */
-
-/* {{{ php_msql_do_connect
- */
-static void php_msql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
-{
- char *host;
- char *hashed_details;
- int hashed_details_length;
- int msql;
-
- switch(ZEND_NUM_ARGS()) {
- case 0: /* defaults */
- host=NULL;
- hashed_details=estrndup("msql_",5);
- hashed_details_length=4+1;
- break;
- case 1: {
- pval *yyhost;
-
- if (getParameters(ht, 1, &yyhost) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(yyhost);
- host = Z_STRVAL_P(yyhost);
- hashed_details_length = Z_STRLEN_P(yyhost)+4+1;
- hashed_details = emalloc(hashed_details_length+1);
- sprintf(hashed_details,"msql_%s",Z_STRVAL_P(yyhost)); /* SAFE */
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (!msql_globals.allow_persistent) {
- persistent=0;
- }
- if (persistent) {
- list_entry *le;
-
- if (msql_globals.max_links!=-1 && msql_globals.num_links>=msql_globals.max_links) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)", msql_globals.num_links);
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (msql_globals.max_persistent!=-1 && msql_globals.num_persistent>=msql_globals.max_persistent) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%d)", msql_globals.num_persistent);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
-
- /* create the link */
- if ((msql=msqlConnect(host))==-1) {
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* hash it up */
- Z_TYPE(new_le) = msql_globals.le_plink;
- new_le.ptr = (void *) msql;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- msql_globals.num_persistent++;
- msql_globals.num_links++;
- } else { /* we do */
- if (Z_TYPE_P(le) != msql_globals.le_plink) {
- efree(hashed_details);
- RETURN_FALSE;
- }
-#if 0
- /* ensure that the link did not die */
- /* still have to find a way to do this nicely with mSQL */
- if (msql_stat(le->ptr)==NULL) { /* the link died */
- if (msql_connect(le->ptr,host,user,passwd)==NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "mSQL link lost, unable to reconnect");
- zend_hash_del(&EG(persistent_list),hashed_details,hashed_details_length+1);
- efree(hashed_details);
- RETURN_FALSE;
- }
- }
-#endif
- msql = (int) le->ptr;
- }
- ZEND_REGISTER_RESOURCE(return_value, (void *) msql, msql_globals.le_plink);
- } else {
- list_entry *index_ptr,new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual msql link sits.
- * if it doesn't, open a new msql link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list),hashed_details,hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
- int type,link;
- void *ptr;
-
- if (Z_TYPE_P(index_ptr) != le_index_ptr) {
- RETURN_FALSE;
- }
- link = (int) index_ptr->ptr;
- ptr = zend_list_find(link,&type); /* check if the link is still there */
- if (ptr && (type==msql_globals.le_link || type==msql_globals.le_plink)) {
- Z_LVAL_P(return_value) = msql_globals.default_link = link;
- Z_TYPE_P(return_value) = IS_RESOURCE;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list),hashed_details,hashed_details_length+1);
- }
- }
- if (msql_globals.max_links!=-1 && msql_globals.num_links>=msql_globals.max_links) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)",msql_globals.num_links);
- efree(hashed_details);
- RETURN_FALSE;
- }
- if ((msql=msqlConnect(host))==-1) {
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* add it to the list */
- ZEND_REGISTER_RESOURCE(return_value, (void *) msql, msql_globals.le_link);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
- Z_TYPE(new_index_ptr) = le_index_ptr;
- if (zend_hash_update(&EG(regular_list),hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- msql_globals.num_links++;
- }
- efree(hashed_details);
- msql_globals.default_link=Z_LVAL_P(return_value);
-}
-/* }}} */
-
-/* {{{ php_msql_get_default_link
- */
-static int php_msql_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
-{
- if (msql_globals.default_link==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_msql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
- }
- return msql_globals.default_link;
-}
-/* }}} */
-
-/* {{{ proto int msql_connect([string hostname[:port]] [, string username] [, string password])
- Open a connection to an mSQL Server */
-PHP_FUNCTION(msql_connect)
-{
- php_msql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-/* }}} */
-
-/* {{{ proto int msql_pconnect([string hostname[:port]] [, string username] [, string password])
- Open a persistent connection to an mSQL Server */
-PHP_FUNCTION(msql_pconnect)
-{
- php_msql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ proto int msql_close([int link_identifier])
- Close an mSQL connection */
-PHP_FUNCTION(msql_close)
-{
- pval *msql_link;
- int id;
- int msql;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = msql_globals.default_link;
- break;
- case 1:
- if (getParameters(ht, 1, &msql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- if (id==-1) { /* explicit resource number */
- zend_list_delete(Z_RESVAL_P(msql_link));
- }
-
- if (id!=-1
- || (msql_link && Z_RESVAL_P(msql_link)==msql_globals.default_link)) {
- zend_list_delete(msql_globals.default_link);
- msql_globals.default_link = -1;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int msql_select_db(string database_name [, int link_identifier])
- Select an mSQL database */
-PHP_FUNCTION(msql_select_db)
-{
- pval *db,*msql_link;
- int id;
- int msql;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 2:
- if (getParameters(ht, 2, &db, &msql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- convert_to_string(db);
-
- if (msqlSelectDB(msql,Z_STRVAL_P(db))==-1) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto int msql_create_db(string database_name [, int link_identifier])
- Create an mSQL database */
-PHP_FUNCTION(msql_create_db)
-{
- pval *db,*msql_link;
- int id;
- int msql;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &db)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 2:
- if (getParameters(ht, 2, &db, &msql_link)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- convert_to_string(db);
- if (msqlCreateDB(msql,Z_STRVAL_P(db))<0) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto int msql_drop_db(string database_name [, int link_identifier])
- Drop (delete) an mSQL database */
-PHP_FUNCTION(msql_drop_db)
-{
- pval *db,*msql_link;
- int id;
- int msql;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &db)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 2:
- if (getParameters(ht, 2, &db, &msql_link)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- convert_to_string(db);
- if (msqlDropDB(msql,Z_STRVAL_P(db))<0) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto int msql_query(string query [, int link_identifier])
- Send an SQL query to mSQL */
-PHP_FUNCTION(msql_query)
-{
- pval *query,*msql_link;
- int id;
- int msql;
- int af_rows;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &query)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = msql_globals.default_link;
- break;
- case 2:
- if (getParameters(ht, 2, &query, &msql_link)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- convert_to_string(query);
- if ((af_rows = msqlQuery(msql,Z_STRVAL_P(query)))==-1) {
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msqlStoreResult(), af_rows), msql_globals.le_query);
-}
-/* }}} */
-
-/* {{{ proto int msql_db_query(string database_name, string query [, int link_identifier])
- Send an SQL query to mSQL */
-PHP_FUNCTION(msql_db_query)
-{
- pval *db,*query,*msql_link;
- int id;
- int msql;
- int af_rows;
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (getParameters(ht, 2, &db, &query)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 3:
- if (getParameters(ht, 3, &db, &query, &msql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- convert_to_string(db);
- if (msqlSelectDB(msql,Z_STRVAL_P(db))==-1) {
- RETURN_FALSE;
- }
-
- convert_to_string(query);
- if ((af_rows = msqlQuery(msql,Z_STRVAL_P(query)))==-1) {
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msqlStoreResult(), af_rows), msql_globals.le_query);
-}
-/* }}} */
-
-/* {{{ proto int msql_list_dbs([int link_identifier])
- List databases available on an mSQL server */
-PHP_FUNCTION(msql_list_dbs)
-{
- pval *msql_link;
- int id;
- int msql;
- m_result *msql_result;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 1:
- if (getParameters(ht, 1, &msql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- if ((msql_result=msqlListDBs(msql))==NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to save mSQL query result");
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msql_result, 0), msql_globals.le_query);
-}
-/* }}} */
-
-/* {{{ proto int msql_list_tables(string database_name [, int link_identifier])
- List tables in an mSQL database */
-PHP_FUNCTION(msql_list_tables)
-{
- pval *db,*msql_link;
- int id;
- int msql;
- m_result *msql_result;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 2:
- if (getParameters(ht, 2, &db, &msql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- convert_to_string(db);
- if (msqlSelectDB(msql,Z_STRVAL_P(db))==-1) {
- RETURN_FALSE;
- }
- if ((msql_result=msqlListTables(msql))==NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to save mSQL query result");
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msql_result, 0), msql_globals.le_query);
-}
-/* }}} */
-
-/* {{{ proto int msql_list_fields(string database_name, string table_name [, int link_identifier])
- List mSQL result fields */
-PHP_FUNCTION(msql_list_fields)
-{
- pval *db,*table,*msql_link;
- int id;
- int msql;
- m_result *msql_result;
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (getParameters(ht, 2, &db, &table)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 3:
- if (getParameters(ht, 3, &db, &table, &msql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- convert_to_string(db);
- if (msqlSelectDB(msql,Z_STRVAL_P(db))==-1) {
- RETURN_FALSE;
- }
- convert_to_string(table);
- if ((msql_result=msqlListFields(msql,Z_STRVAL_P(table)))==NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to save mSQL query result");
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msql_result, 0), msql_globals.le_query);
-}
-/* }}} */
-
-/* {{{ proto string msql_error([int link_identifier])
- Returns the text of the error message from previous mSQL operation */
-PHP_FUNCTION(msql_error)
-{
- if (ZEND_NUM_ARGS()) {
- WRONG_PARAM_COUNT;
- }
- RETURN_STRING(msqlErrMsg,1);
-}
-/* }}} */
-
-/* {{{ proto int msql_result(int query, int row [, mixed field])
- Get result data */
-PHP_FUNCTION(msql_result)
-{
- pval *result, *row, *field=NULL;
- m_result *msql_result;
- m_query *msql_query;
- m_row sql_row;
- int field_offset=0;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (getParameters(ht, 2, &result, &row)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3:
- if (getParameters(ht, 3, &result, &row, &field)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- MSQL_GET_QUERY(result);
-
- convert_to_long(row);
- if (Z_LVAL_P(row)<0 || Z_LVAL_P(row)>=msqlNumRows(msql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %d on mSQL query index %d",Z_LVAL_P(row),Z_LVAL_P(result));
- RETURN_FALSE;
- }
- msqlDataSeek(msql_result,Z_LVAL_P(row));
- if ((sql_row=msqlFetchRow(msql_result))==NULL) { /* shouldn't happen? */
- RETURN_FALSE;
- }
-
- if (field) {
- switch(Z_TYPE_P(field)) {
- case IS_STRING: {
- int i=0;
- m_field *tmp_field;
- char *table_name,*field_name,*tmp;
-
- if ((tmp=strchr(Z_STRVAL_P(field),'.'))) {
- *tmp = 0;
- table_name = estrdup(Z_STRVAL_P(field));
- field_name = estrdup(tmp+1);
- } else {
- table_name = NULL;
- field_name = estrndup(Z_STRVAL_P(field),Z_STRLEN_P(field));
- }
- msqlFieldSeek(msql_result,0);
- while ((tmp_field=msqlFetchField(msql_result))) {
- if ((!table_name || !strcasecmp(tmp_field->table,table_name)) && !strcasecmp(tmp_field->name,field_name)) {
- field_offset = i;
- break;
- }
- i++;
- }
- if (!tmp_field) { /* no match found */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s%s%s not found in mSQL query index %d",
- (table_name?table_name:""), (table_name?".":""), field_name, Z_LVAL_P(result));
- efree(field_name);
- if (table_name) {
- efree(table_name);
- }
- RETURN_FALSE;
- }
- efree(field_name);
- if (table_name) {
- efree(table_name);
- }
- }
- break;
- default:
- convert_to_long(field);
- field_offset = Z_LVAL_P(field);
- if (field_offset<0 || field_offset>=msqlNumFields(msql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
- RETURN_FALSE;
- }
- break;
- }
- }
-
- if (sql_row[field_offset]) {
- if (PG(magic_quotes_runtime)) {
- Z_STRVAL_P(return_value) = php_addslashes(sql_row[field_offset],0,&Z_STRLEN_P(return_value),0 TSRMLS_CC);
- } else {
- Z_STRLEN_P(return_value) = (sql_row[field_offset]?strlen(sql_row[field_offset]):0);
- Z_STRVAL_P(return_value) = (char *) safe_estrndup(sql_row[field_offset],Z_STRLEN_P(return_value));
- }
- Z_TYPE_P(return_value) = IS_STRING;
- } else {
- ZVAL_FALSE(return_value);
- }
-}
-/* }}} */
-
-/* {{{ proto int msql_num_rows(int query)
- Get number of rows in a result */
-PHP_FUNCTION(msql_num_rows)
-{
- pval *result;
- m_result *msql_result;
- m_query *msql_query;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- MSQL_GET_QUERY(result);
- RETVAL_LONG(msql_result ? msqlNumRows(msql_result) : 0);
-}
-/* }}} */
-
-/* {{{ proto int msql_num_fields(int query)
- Get number of fields in a result */
-PHP_FUNCTION(msql_num_fields)
-{
- pval *result;
- m_result *msql_result;
- m_query *msql_query;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- MSQL_GET_QUERY(result);
- RETVAL_LONG(msql_result ? msqlNumFields(msql_result) : 0);
-}
-/* }}} */
-
-/* {{{ php_msql_fetch_hash
- */
-static void php_msql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
-{
- pval *result, *arg2;
- m_result *msql_result;
- m_row msql_row;
- m_field *msql_field;
- m_query *msql_query;
- int num_fields;
- int i;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- if (!result_type) {
- result_type = MSQL_BOTH;
- }
- break;
- case 2:
- if (getParameters(ht, 2, &result, &arg2)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(arg2);
- result_type = Z_LVAL_P(arg2);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- MSQL_GET_QUERY(result);
- if (!msql_result || (msql_row=msqlFetchRow(msql_result))==NULL) {
- RETURN_FALSE;
- }
-
- num_fields = msqlNumFields(msql_result);
-
- array_init(return_value);
-
- msqlFieldSeek(msql_result,0);
- for (msql_field=msqlFetchField(msql_result),i=0; msql_field; msql_field=msqlFetchField(msql_result),i++) {
- if (msql_row[i]) {
- char *data;
- int data_len;
- int should_copy;
-
- if (PG(magic_quotes_runtime)) {
- data = php_addslashes(msql_row[i], 0, &data_len, 0 TSRMLS_CC);
- should_copy = 0;
- } else {
- data = msql_row[i];
- data_len = strlen(data);
- should_copy = 1;
- }
-
- if (result_type & MSQL_NUM) {
- add_index_stringl(return_value, i, data, data_len, should_copy);
- should_copy = 1;
- }
-
- if (result_type & MSQL_ASSOC) {
- add_assoc_stringl(return_value, msql_field->name, data, data_len, should_copy);
- }
- } else {
- /*
- add_get_index_stringl(return_value, i, empty_string, 0, (void **) &pval_ptr, 1);
- */
- }
- }
-}
-/* }}} */
-
-/* {{{ proto array msql_fetch_row(int query)
- Get a result row as an enumerated array */
-PHP_FUNCTION(msql_fetch_row)
-{
- php_msql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSQL_NUM);
-}
-/* }}} */
-
-/* {{{ proto object msql_fetch_object(int query [, int result_type])
- Fetch a result row as an object */
-PHP_FUNCTION(msql_fetch_object)
-{
- php_msql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
- if (Z_TYPE_P(return_value)==IS_ARRAY) {
- object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value));
- }
-}
-/* }}} */
-
-/* {{{ proto array msql_fetch_array(int query [, int result_type])
- Fetch a result row as an associative array */
-PHP_FUNCTION(msql_fetch_array)
-{
- php_msql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int msql_data_seek(int query, int row_number)
- Move internal result pointer */
-PHP_FUNCTION(msql_data_seek)
-{
- pval *result,*offset;
- m_result *msql_result;
- m_query *msql_query;
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &result, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- MSQL_GET_QUERY(result);
- convert_to_long(offset);
- if (!msql_result ||
- Z_LVAL_P(offset)<0 ||
- Z_LVAL_P(offset)>=msqlNumRows(msql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is invalid for mSQL query index %d",Z_LVAL_P(offset),Z_LVAL_P(result));
- RETURN_FALSE;
- }
- msqlDataSeek(msql_result,Z_LVAL_P(offset));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ php_msql_get_field_name
- */
-static char *php_msql_get_field_name(int field_type)
-{
- switch (field_type) {
-#if MSQL1
- case INT_TYPE:
- return "int";
- break;
- case CHAR_TYPE:
- return "char";
- break;
- case REAL_TYPE:
- return "real";
- break;
- case IDENT_TYPE:
- return "ident";
- break;
- case NULL_TYPE:
- return "null";
- break;
-#else
- case INT_TYPE:
- case UINT_TYPE:
- case CHAR_TYPE:
- case TEXT_TYPE:
- case REAL_TYPE:
- case NULL_TYPE:
- case DATE_TYPE:
- case TIME_TYPE:
- case MONEY_TYPE:
- return msqlTypeNames[field_type];
- break;
-#endif
- default:
- return "unknown";
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto object msql_fetch_field(int query [, int field_offset])
- Get column information from a result and return as an object */
-PHP_FUNCTION(msql_fetch_field)
-{
- pval *result, *field=NULL;
- m_result *msql_result;
- m_field *msql_field;
- m_query *msql_query;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (getParameters(ht, 2, &result, &field)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(field);
- default:
- WRONG_PARAM_COUNT;
- }
-
- MSQL_GET_QUERY(result);
-
- if (field) {
- if (Z_LVAL_P(field)<0 || Z_LVAL_P(field)>=msqlNumRows(msql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Bad field offset specified");
- RETURN_FALSE;
- }
- msqlFieldSeek(msql_result,Z_LVAL_P(field));
- }
- if (!msql_result || (msql_field=msqlFetchField(msql_result))==NULL) {
- RETURN_FALSE;
- }
- object_init(return_value);
-
- add_property_string(return_value, "name",(msql_field->name?msql_field->name:empty_string), 1);
- add_property_string(return_value, "table",(msql_field->table?msql_field->table:empty_string), 1);
- add_property_long(return_value, "not_null",IS_NOT_NULL(msql_field->flags));
-#if MSQL1
- add_property_long(return_value, "primary_key",(msql_field->flags&PRI_KEY_FLAG?1:0));
-#else
- add_property_long(return_value, "unique",(msql_field->flags&UNIQUE_FLAG?1:0));
-#endif
-
- add_property_string(return_value, "type",php_msql_get_field_name(Z_TYPE_P(msql_field)), 1);
-}
-/* }}} */
-
-/* {{{ proto int msql_field_seek(int query, int field_offset)
- Set result pointer to a specific field offset */
-PHP_FUNCTION(msql_field_seek)
-{
- pval *result, *offset;
- m_result *msql_result;
- m_query *msql_query;
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &result, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- MSQL_GET_QUERY(result);
- convert_to_long(offset);
- if(!msql_result) {
- RETURN_FALSE;
- }
- if (Z_LVAL_P(offset)<0 || Z_LVAL_P(offset)>=msqlNumFields(msql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Field %d is invalid for mSQL query index %d",
- Z_LVAL_P(offset),Z_LVAL_P(result));
- RETURN_FALSE;
- }
- msqlFieldSeek(msql_result,Z_LVAL_P(offset));
- RETURN_TRUE;
-}
-/* }}} */
-
-#define PHP_MSQL_FIELD_NAME 1
-#define PHP_MSQL_FIELD_TABLE 2
-#define PHP_MSQL_FIELD_LEN 3
-#define PHP_MSQL_FIELD_TYPE 4
-#define PHP_MSQL_FIELD_FLAGS 5
-
-/* {{{ php_msql_field_info
- */
-static void php_msql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
-{
- pval *result, *field;
- m_result *msql_result;
- m_field *msql_field;
- m_query *msql_query;
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &result, &field)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- MSQL_GET_QUERY(result);
- if(!msql_result) {
- RETURN_FALSE;
- }
- convert_to_long(field);
- if (Z_LVAL_P(field)<0 || Z_LVAL_P(field)>=msqlNumFields(msql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Field %d is invalid for mSQL query index %d",Z_LVAL_P(field),Z_LVAL_P(result));
- RETURN_FALSE;
- }
- msqlFieldSeek(msql_result,Z_LVAL_P(field));
- if ((msql_field=msqlFetchField(msql_result))==NULL) {
- RETURN_FALSE;
- }
-
- switch (entry_type) {
- case PHP_MSQL_FIELD_NAME:
- Z_STRLEN_P(return_value) = strlen(msql_field->name);
- Z_STRVAL_P(return_value) = estrndup(msql_field->name,Z_STRLEN_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- break;
- case PHP_MSQL_FIELD_TABLE:
- Z_STRLEN_P(return_value) = strlen(msql_field->table);
- Z_STRVAL_P(return_value) = estrndup(msql_field->table,Z_STRLEN_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- break;
- case PHP_MSQL_FIELD_LEN:
- Z_LVAL_P(return_value) = msql_field->length;
- Z_TYPE_P(return_value) = IS_LONG;
- break;
- case PHP_MSQL_FIELD_TYPE:
- Z_STRVAL_P(return_value) = estrdup(php_msql_get_field_name(Z_TYPE_P(msql_field)));
- Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- break;
- case PHP_MSQL_FIELD_FLAGS:
-#if MSQL1
- if ((msql_field->flags&NOT_NULL_FLAG) && (msql_field->flags&PRI_KEY_FLAG)) {
- Z_STRVAL_P(return_value) = estrndup("primary key not null",20);
- Z_STRLEN_P(return_value) = 20;
- Z_TYPE_P(return_value) = IS_STRING;
- } else if (msql_field->flags&NOT_NULL_FLAG) {
- Z_STRVAL_P(return_value) = estrndup("not null",8);
- Z_STRLEN_P(return_value) = 8;
- Z_TYPE_P(return_value) = IS_STRING;
- } else if (msql_field->flags&PRI_KEY_FLAG) {
- Z_STRVAL_P(return_value) = estrndup("primary key",11);
- Z_STRLEN_P(return_value) = 11;
- Z_TYPE_P(return_value) = IS_STRING;
- } else {
- ZVAL_FALSE(return_value);
- }
-#else
- if ((msql_field->flags&NOT_NULL_FLAG) && (msql_field->flags&UNIQUE_FLAG)) {
- Z_STRVAL_P(return_value) = estrndup("unique not null",15);
- Z_STRLEN_P(return_value) = 15;
- Z_TYPE_P(return_value) = IS_STRING;
- } else if (msql_field->flags&NOT_NULL_FLAG) {
- Z_STRVAL_P(return_value) = estrndup("not null",8);
- Z_STRLEN_P(return_value) = 8;
- Z_TYPE_P(return_value) = IS_STRING;
- } else if (msql_field->flags&UNIQUE_FLAG) {
- Z_STRVAL_P(return_value) = estrndup("unique",6);
- Z_STRLEN_P(return_value) = 6;
- Z_TYPE_P(return_value) = IS_STRING;
- } else {
- ZVAL_FALSE(return_value);
- }
-#endif
- break;
- default:
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string msql_field_name(int query, int field_index)
- Get the name of the specified field in a result */
-PHP_FUNCTION(msql_field_name)
-{
- php_msql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MSQL_FIELD_NAME);
-}
-/* }}} */
-
-/* {{{ proto string msql_field_table(int query, int field_offset)
- Get name of the table the specified field is in */
-PHP_FUNCTION(msql_field_table)
-{
- php_msql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MSQL_FIELD_TABLE);
-}
-/* }}} */
-
-/* {{{ proto int msql_field_len(int query, int field_offet)
- Returns the length of the specified field */
-PHP_FUNCTION(msql_field_len)
-{
- php_msql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MSQL_FIELD_LEN);
-}
-/* }}} */
-
-/* {{{ proto string msql_field_type(int query, int field_offset)
- Get the type of the specified field in a result */
-PHP_FUNCTION(msql_field_type)
-{
- php_msql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MSQL_FIELD_TYPE);
-}
-/* }}} */
-
-/* {{{ proto string msql_field_flags(int query, int field_offset)
- Get the flags associated with the specified field in a result */
-PHP_FUNCTION(msql_field_flags)
-{
- php_msql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MSQL_FIELD_FLAGS);
-}
-/* }}} */
-
-/* {{{ proto int msql_free_result(int query)
- Free result memory */
-PHP_FUNCTION(msql_free_result)
-{
- pval *result;
- m_result *msql_result;
- m_query *msql_query;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- MSQL_GET_QUERY(result);
- zend_list_delete(Z_LVAL_P(result));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int msql_affected_rows(int query)
- Return number of affected rows */
-PHP_FUNCTION(msql_affected_rows)
-{
- pval *result;
- m_result *msql_result;
- m_query *msql_query;
-
- if(ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- MSQL_GET_QUERY(result);
- RETVAL_LONG(msql_query->af_rows);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/msql/php_msql.h b/ext/msql/php_msql.h
deleted file mode 100644
index 46b90b1f07..0000000000
--- a/ext/msql/php_msql.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_MSQL_H
-#define PHP_MSQL_H
-
-#if HAVE_MSQL
-
-extern zend_module_entry msql_module_entry;
-#define msql_module_ptr &msql_module_entry
-
-/* mSQL functions */
-PHP_MINIT_FUNCTION(msql);
-PHP_RINIT_FUNCTION(msql);
-PHP_MSHUTDOWN_FUNCTION(msql);
-PHP_MINFO_FUNCTION(msql);
-
-PHP_FUNCTION(msql_connect);
-PHP_FUNCTION(msql_pconnect);
-PHP_FUNCTION(msql_close);
-PHP_FUNCTION(msql_select_db);
-PHP_FUNCTION(msql_create_db);
-PHP_FUNCTION(msql_drop_db);
-PHP_FUNCTION(msql_list_dbs);
-PHP_FUNCTION(msql_list_tables);
-PHP_FUNCTION(msql_list_fields);
-PHP_FUNCTION(msql_error);
-PHP_FUNCTION(msql_affected_rows);
-PHP_FUNCTION(msql_query);
-PHP_FUNCTION(msql_db_query);
-PHP_FUNCTION(msql_result);
-PHP_FUNCTION(msql_num_rows);
-PHP_FUNCTION(msql_num_fields);
-PHP_FUNCTION(msql_fetch_row);
-PHP_FUNCTION(msql_data_seek);
-PHP_FUNCTION(msql_fetch_field);
-PHP_FUNCTION(msql_field_seek);
-PHP_FUNCTION(msql_free_result);
-PHP_FUNCTION(msql_field_name);
-PHP_FUNCTION(msql_field_table);
-PHP_FUNCTION(msql_field_len);
-PHP_FUNCTION(msql_field_type);
-PHP_FUNCTION(msql_field_flags);
-PHP_FUNCTION(msql_fetch_array);
-PHP_FUNCTION(msql_fetch_object);
-
-typedef struct {
- long default_link;
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
- int le_query;
- int le_link;
- int le_plink;
-} php_msql_globals;
-
-#else
-
-#define msql_module_ptr NULL
-
-#endif
-
-#define phpext_msql_ptr msql_module_ptr
-
-#endif /* PHP_MSQL_H */
diff --git a/ext/mssql/CREDITS b/ext/mssql/CREDITS
deleted file mode 100644
index 548684afca..0000000000
--- a/ext/mssql/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-MS SQL
-Frank M. Kromann
diff --git a/ext/mssql/config.m4 b/ext/mssql/config.m4
deleted file mode 100644
index 7007b1b94c..0000000000
--- a/ext/mssql/config.m4
+++ /dev/null
@@ -1,52 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(mssql,for MSSQL support via FreeTDS,
-[ --with-mssql[=DIR] Include MSSQL-DB support. DIR is the FreeTDS home
- directory, defaults to /usr/local/freetds.])
-
-
-if test "$PHP_MSSQL" != "no"; then
-
- FREETDS_INSTALLATION_DIR=""
- if test "$PHP_MSSQL" = "yes"; then
-
- for i in /usr/local /usr; do
- if test -f $i/include/tds.h; then
- FREETDS_INSTALLATION_DIR=$i
- break
- fi
- done
-
- if test -z "$FREETDS_INSTALLATION_DIR"; then
- AC_MSG_ERROR(Cannot find FreeTDS in known installation directories)
- fi
-
- elif test "$PHP_MSSQL" != "no"; then
-
- if test -f $PHP_MSSQL/include/tds.h; then
- FREETDS_INSTALLATION_DIR=$PHP_MSSQL
- else
- AC_MSG_ERROR(Directory $PHP_MSSQL is not a FreeTDS installation directory)
- fi
- fi
-
- if test ! -r "$FREETDS_INSTALLATION_DIR/lib/libtds.a"; then
- AC_MSG_ERROR(Could not find $FREETDS_INSTALLATION_DIR/lib/libtds.a)
- fi
-
- MSSQL_INCDIR=$FREETDS_INSTALLATION_DIR/include
- MSSQL_LIBDIR=$FREETDS_INSTALLATION_DIR/lib
-
- PHP_ADD_INCLUDE($MSSQL_INCDIR)
- PHP_ADD_LIBRARY_WITH_PATH(sybdb, $MSSQL_LIBDIR, MSSQL_SHARED_LIBADD)
- PHP_NEW_EXTENSION(mssql, php_mssql.c, $ext_shared)
- AC_CHECK_LIB(dnet_stub, dnet_addr,
- [ PHP_ADD_LIBRARY_WITH_PATH(dnet_stub,,MSSQL_SHARED_LIBADD)
- AC_DEFINE(HAVE_LIBDNET_STUB,1,[ ])
- ])
- AC_DEFINE(HAVE_MSSQL,1,[ ])
- AC_DEFINE(HAVE_FREETDS,1,[ ])
- PHP_SUBST(MSSQL_SHARED_LIBADD)
-fi
diff --git a/ext/mssql/mssql.dsp b/ext/mssql/mssql.dsp
deleted file mode 100644
index ea79d3ba4e..0000000000
--- a/ext/mssql/mssql.dsp
+++ /dev/null
@@ -1,117 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mssql" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mssql - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mssql.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mssql.mak" CFG="mssql - Win32 MSSQL 70 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mssql - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mssql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mssql - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D MSSQL70=1 /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSSQL=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D MSSQL70=1 /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSSQL=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mssql70.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\mssql-70\lib" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mssql.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\mssql-70\lib" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "mssql - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D MSSQL70=1 /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSSQL=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D MSSQL70=1 /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSSQL=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_mssql70.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\mssql-70\lib"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_mssql.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\mssql-70\lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "mssql - Win32 Release_TS"
-# Name "mssql - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_mssql.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mssql.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\mssql_win32_howto.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/mssql/mssql_win32_howto.txt b/ext/mssql/mssql_win32_howto.txt
deleted file mode 100644
index 901099fb64..0000000000
--- a/ext/mssql/mssql_win32_howto.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-Rules for building MSSQL
-------------------------
-
-The MSSQL project contains 2 configurations.
-
-The files needed for each configurations are:
-
-Win32 Release_TS
-Win32 Debug_TS
-
- php_build\mssql-70\include\sqldb.h
- php_build\mssql-70\include\sqlfront.h
- php_build\mssql-70\lib\ntwdblib.lib
-
-php_build is a directory at the same level as php4.
-
-Start Visual Studio, load php_modules.dsw, select the MSSQL projects,
-configuration and build it.
-
-This module requires ntwdblib.dll and one or more of the following dll's
-
-dbmsadsn.dll
-dbmsrpcn.dll
-dbmsshrn.dll
-dbmssocn.dll for tcp/ip connections
-dbmsspxn.dll for ipx/spx connections
-dbmsvinn.dll
-dbnmpntw.dll for netbios connections
-
-All these files are installed while installing MS SQL Server. If the SQL Server
-is installed on another maschine you need to install the client tools on
-the web server as well.
-
-
- \ No newline at end of file
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c
deleted file mode 100644
index 4e0d2a667e..0000000000
--- a/ext/mssql/php_mssql.c
+++ /dev/null
@@ -1,2210 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Frank M. Kromann <frank@frontbase.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef COMPILE_DL_MSSQL
-#define HAVE_MSSQL 1
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-#include "php_mssql.h"
-#include "php_ini.h"
-
-#if HAVE_MSSQL
-#define SAFE_STRING(s) ((s)?(s):"")
-
-#define MSSQL_ASSOC 1<<0
-#define MSSQL_NUM 1<<1
-#define MSSQL_BOTH (MSSQL_ASSOC|MSSQL_NUM)
-
-static int le_result, le_link, le_plink, le_statement;
-
-static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int offset,zval *result, int column_type TSRMLS_DC);
-static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int offset,zval *result, int column_type TSRMLS_DC);
-
-static void _mssql_bind_hash_dtor(void *data);
-static unsigned char a3_arg_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-
-function_entry mssql_functions[] = {
- PHP_FE(mssql_connect, NULL)
- PHP_FE(mssql_pconnect, NULL)
- PHP_FE(mssql_close, NULL)
- PHP_FE(mssql_select_db, NULL)
- PHP_FE(mssql_query, NULL)
- PHP_FE(mssql_fetch_batch, NULL)
- PHP_FE(mssql_rows_affected, NULL)
- PHP_FE(mssql_free_result, NULL)
- PHP_FE(mssql_get_last_message, NULL)
- PHP_FE(mssql_num_rows, NULL)
- PHP_FE(mssql_num_fields, NULL)
- PHP_FE(mssql_fetch_field, NULL)
- PHP_FE(mssql_fetch_row, NULL)
- PHP_FE(mssql_fetch_array, NULL)
- PHP_FE(mssql_fetch_assoc, NULL)
- PHP_FE(mssql_fetch_object, NULL)
- PHP_FE(mssql_field_length, NULL)
- PHP_FE(mssql_field_name, NULL)
- PHP_FE(mssql_field_type, NULL)
- PHP_FE(mssql_data_seek, NULL)
- PHP_FE(mssql_field_seek, NULL)
- PHP_FE(mssql_result, NULL)
- PHP_FE(mssql_next_result, NULL)
- PHP_FE(mssql_min_error_severity, NULL)
- PHP_FE(mssql_min_message_severity, NULL)
- PHP_FE(mssql_init, NULL)
- PHP_FE(mssql_bind, a3_arg_force_ref)
- PHP_FE(mssql_execute, NULL)
- PHP_FE(mssql_free_statement, NULL)
- PHP_FE(mssql_guid_string, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry mssql_module_entry =
-{
- STANDARD_MODULE_HEADER,
- "mssql",
- mssql_functions,
- PHP_MINIT(mssql),
- PHP_MSHUTDOWN(mssql),
- PHP_RINIT(mssql),
- PHP_RSHUTDOWN(mssql),
- PHP_MINFO(mssql),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-ZEND_DECLARE_MODULE_GLOBALS(mssql)
-
-#ifdef COMPILE_DL_MSSQL
-ZEND_GET_MODULE(mssql)
-#endif
-
-#define CHECK_LINK(link) { if (link==-1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A link to the server could not be established"); RETURN_FALSE; } }
-
-static PHP_INI_DISP(display_text_size)
-{
- char *value;
- TSRMLS_FETCH();
-
- if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
-
- if (atoi(value) == -1) {
- PUTS("Server default");
- } else {
- php_printf("%s", value);
- }
-}
-
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("mssql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateBool, allow_persistent, zend_mssql_globals, mssql_globals)
- STD_PHP_INI_ENTRY_EX("mssql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_persistent, zend_mssql_globals, mssql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("mssql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_links, zend_mssql_globals, mssql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("mssql.min_error_severity", "10", PHP_INI_ALL, OnUpdateLong, cfg_min_error_severity, zend_mssql_globals, mssql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("mssql.min_message_severity", "10", PHP_INI_ALL, OnUpdateLong, cfg_min_message_severity, zend_mssql_globals, mssql_globals, display_link_numbers)
- STD_PHP_INI_BOOLEAN("mssql.compatability_mode", "0", PHP_INI_ALL, OnUpdateBool, compatability_mode, zend_mssql_globals, mssql_globals)
- STD_PHP_INI_ENTRY_EX("mssql.connect_timeout", "5", PHP_INI_ALL, OnUpdateLong, connect_timeout, zend_mssql_globals, mssql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("mssql.timeout", "60", PHP_INI_ALL, OnUpdateLong, timeout, zend_mssql_globals, mssql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("mssql.textsize", "-1", PHP_INI_ALL, OnUpdateLong, textsize, zend_mssql_globals, mssql_globals, display_text_size)
- STD_PHP_INI_ENTRY_EX("mssql.textlimit", "-1", PHP_INI_ALL, OnUpdateLong, textlimit, zend_mssql_globals, mssql_globals, display_text_size)
- STD_PHP_INI_ENTRY_EX("mssql.batchsize", "0", PHP_INI_ALL, OnUpdateLong, batchsize, zend_mssql_globals, mssql_globals, display_link_numbers)
- STD_PHP_INI_BOOLEAN("mssql.datetimeconvert", "1", PHP_INI_ALL, OnUpdateBool, datetimeconvert, zend_mssql_globals, mssql_globals)
- STD_PHP_INI_BOOLEAN("mssql.secure_connection", "0", PHP_INI_SYSTEM, OnUpdateBool, secure_connection, zend_mssql_globals, mssql_globals)
- STD_PHP_INI_ENTRY_EX("mssql.max_procs", "25", PHP_INI_ALL, OnUpdateLong, max_procs, zend_mssql_globals, mssql_globals, display_link_numbers)
-PHP_INI_END()
-
-/* error handler */
-static int php_mssql_error_handler(DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr)
-{
- TSRMLS_FETCH();
-
- if (severity >= MS_SQL_G(min_error_severity)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (severity %d)", dberrstr, severity);
- }
- return INT_CANCEL;
-}
-
-/* message handler */
-static int php_mssql_message_handler(DBPROCESS *dbproc, DBINT msgno,int msgstate, int severity,char *msgtext,char *srvname, char *procname,DBUSMALLINT line)
-{
- TSRMLS_FETCH();
-
- if (severity >= MS_SQL_G(min_message_severity)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "message: %s (severity %d)", msgtext, severity);
- }
- if (MS_SQL_G(server_message)) {
- STR_FREE(MS_SQL_G(server_message));
- }
- MS_SQL_G(server_message) = estrdup(msgtext);
- return 0;
-}
-
-static int _clean_invalid_results(list_entry *le TSRMLS_DC)
-{
- if (Z_TYPE_P(le) == le_result) {
- mssql_link *mssql_ptr = ((mssql_result *) le->ptr)->mssql_ptr;
-
- if (!mssql_ptr->valid) {
- return 1;
- }
- }
- return 0;
-}
-
-static void _free_result(mssql_result *result, int free_fields)
-{
- int i,j;
-
- if (result->data) {
- for (i=0; i<result->num_rows; i++) {
- if (result->data[i]) {
- for (j=0; j<result->num_fields; j++) {
- zval_dtor(&result->data[i][j]);
- }
- efree(result->data[i]);
- }
- }
- efree(result->data);
- result->data = NULL;
- result->blocks_initialized = 0;
- }
-
- if (free_fields && result->fields) {
- for (i=0; i<result->num_fields; i++) {
- STR_FREE(result->fields[i].name);
- STR_FREE(result->fields[i].column_source);
- }
- efree(result->fields);
- }
-}
-
-static void _free_mssql_statement(mssql_statement *statement)
-{
- if (statement->binds) {
- zend_hash_destroy(statement->binds);
- efree(statement->binds);
- }
-
- efree(statement);
-}
-
-static void _free_mssql_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- mssql_result *result = (mssql_result *)rsrc->ptr;
-
- _free_result(result, 1);
- efree(result);
-}
-
-static void php_mssql_set_default_link(int id TSRMLS_DC)
-{
- if (MS_SQL_G(default_link)!=-1) {
- zend_list_delete(MS_SQL_G(default_link));
- }
- MS_SQL_G(default_link) = id;
- zend_list_addref(id);
-}
-
-static void _close_mssql_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- mssql_link *mssql_ptr = (mssql_link *)rsrc->ptr;
-
- mssql_ptr->valid = 0;
- zend_hash_apply(&EG(regular_list),(apply_func_t) _clean_invalid_results TSRMLS_CC);
- dbclose(mssql_ptr->link);
- dbfreelogin(mssql_ptr->login);
- efree(mssql_ptr);
- MS_SQL_G(num_links)--;
-}
-
-
-static void _close_mssql_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- mssql_link *mssql_ptr = (mssql_link *)rsrc->ptr;
-
- dbclose(mssql_ptr->link);
- dbfreelogin(mssql_ptr->login);
- free(mssql_ptr);
- MS_SQL_G(num_persistent)--;
- MS_SQL_G(num_links)--;
-}
-
-static void _mssql_bind_hash_dtor(void *data)
-{
- mssql_bind *bind= (mssql_bind *) data;
-
- zval_ptr_dtor(&(bind->zval));
-}
-
-static void php_mssql_init_globals(zend_mssql_globals *mssql_globals)
-{
- long compatability_mode;
-
- mssql_globals->num_persistent = 0;
- if (cfg_get_long("mssql.compatability_mode", &compatability_mode) == SUCCESS) {
- if (compatability_mode) {
- mssql_globals->get_column_content = php_mssql_get_column_content_without_type;
- } else {
- mssql_globals->get_column_content = php_mssql_get_column_content_with_type;
- }
- } else {
- mssql_globals->get_column_content = php_mssql_get_column_content_with_type;
- }
-}
-
-PHP_MINIT_FUNCTION(mssql)
-{
- ZEND_INIT_MODULE_GLOBALS(mssql, php_mssql_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
-
- le_statement = register_list_destructors(_free_mssql_statement, NULL);
- le_result = zend_register_list_destructors_ex(_free_mssql_result, NULL, "mssql result", module_number);
- le_link = zend_register_list_destructors_ex(_close_mssql_link, NULL, "mssql link", module_number);
- le_plink = zend_register_list_destructors_ex(NULL, _close_mssql_plink, "mssql link persistent", module_number);
- Z_TYPE(mssql_module_entry) = type;
-
- if (dbinit()==FAIL) {
- return FAILURE;
- }
-
- /* BEGIN MSSQL data types for mssql_bind */
- REGISTER_LONG_CONSTANT("MSSQL_ASSOC", MSSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSSQL_NUM", MSSQL_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSSQL_BOTH", MSSQL_BOTH, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("SQLTEXT",SQLTEXT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLVARCHAR",SQLVARCHAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLCHAR",SQLCHAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLINT1",SQLINT1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLINT2",SQLINT2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLINT4",SQLINT4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLBIT",SQLBIT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLFLT4",SQLFLT4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLFLT8",SQLFLT8, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLFLTN",SQLFLTN, CONST_CS | CONST_PERSISTENT);
- /* END MSSQL data types for mssql_sp_bind */
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(mssql)
-{
- UNREGISTER_INI_ENTRIES();
- dbexit();
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(mssql)
-{
- MS_SQL_G(default_link) = -1;
- MS_SQL_G(num_links) = MS_SQL_G(num_persistent);
- MS_SQL_G(appname) = estrndup("PHP 4.0",7);
- MS_SQL_G(server_message) = empty_string;
- MS_SQL_G(min_error_severity) = MS_SQL_G(cfg_min_error_severity);
- MS_SQL_G(min_message_severity) = MS_SQL_G(cfg_min_message_severity);
- if (MS_SQL_G(connect_timeout) < 1) MS_SQL_G(connect_timeout) = 1;
- dbsetlogintime(MS_SQL_G(connect_timeout));
- if (MS_SQL_G(timeout) < 0) MS_SQL_G(timeout) = 60;
- dbsettime(MS_SQL_G(timeout));
- dbsetmaxprocs((SHORT)MS_SQL_G(max_procs));
-
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(mssql)
-{
- STR_FREE(MS_SQL_G(appname));
- if (MS_SQL_G(server_message)) {
- STR_FREE(MS_SQL_G(server_message));
- }
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(mssql)
-{
- char buf[32];
-
- php_info_print_table_start();
- php_info_print_table_header(2, "MSSQL Support", "enabled");
-
- sprintf(buf, "%ld", MS_SQL_G(num_persistent));
- php_info_print_table_row(2, "Active Persistent Links", buf);
- sprintf(buf, "%ld", MS_SQL_G(num_links));
- php_info_print_table_row(2, "Active Links", buf);
-
- php_info_print_table_row(2, "Library version", MSSQL_VERSION);
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-
-}
-
-static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- char *user, *passwd, *host;
- char *hashed_details;
- int hashed_details_length;
- mssql_link mssql, *mssql_ptr;
- char buffer[32];
-
- switch(ZEND_NUM_ARGS()) {
- case 0: /* defaults */
- host=user=passwd=NULL;
- hashed_details_length=5+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- strcpy(hashed_details,"mssql___");
- break;
- case 1: {
- zval **yyhost;
-
- if (zend_get_parameters_ex(1, &yyhost)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(yyhost);
- host = Z_STRVAL_PP(yyhost);
- user=passwd=NULL;
- hashed_details_length = Z_STRLEN_PP(yyhost)+5+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"mssql_%s__",Z_STRVAL_PP(yyhost));
- }
- break;
- case 2: {
- zval **yyhost,**yyuser;
-
- if (zend_get_parameters_ex(2, &yyhost, &yyuser)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(yyhost);
- convert_to_string_ex(yyuser);
- host = Z_STRVAL_PP(yyhost);
- user = Z_STRVAL_PP(yyuser);
- passwd=NULL;
- hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+5+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"mssql_%s_%s_",Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser));
- }
- break;
- case 3: {
- zval **yyhost,**yyuser,**yypasswd;
-
- if (zend_get_parameters_ex(3, &yyhost, &yyuser, &yypasswd) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(yyhost);
- convert_to_string_ex(yyuser);
- convert_to_string_ex(yypasswd);
- host = Z_STRVAL_PP(yyhost);
- user = Z_STRVAL_PP(yyuser);
- passwd = Z_STRVAL_PP(yypasswd);
- hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+Z_STRLEN_PP(yypasswd)+5+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"mssql_%s_%s_%s",Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser),Z_STRVAL_PP(yypasswd)); /* SAFE */
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (hashed_details == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- /* set a DBLOGIN record */
- if ((mssql.login = dblogin()) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate login record");
- RETURN_FALSE;
- }
-
- DBERRHANDLE(mssql.login, (EHANDLEFUNC) php_mssql_error_handler);
- DBMSGHANDLE(mssql.login, (MHANDLEFUNC) php_mssql_message_handler);
-
-#ifndef HAVE_FREETDS
- if (MS_SQL_G(secure_connection)){
- DBSETLSECURE(mssql.login);
- }
- else {
-#endif
- if (user) {
- DBSETLUSER(mssql.login,user);
- }
- if (passwd) {
- DBSETLPWD(mssql.login,passwd);
- }
-#ifndef HAVE_FREETDS
- }
-#endif
- DBSETLAPP(mssql.login,MS_SQL_G(appname));
- mssql.valid = 1;
-
-#ifndef HAVE_FREETDS
- DBSETLVERSION(mssql.login, DBVER60);
-#endif
-/* DBSETLTIME(mssql.login, TIMEOUT_INFINITE); */
-
- if (!MS_SQL_G(allow_persistent)) {
- persistent=0;
- }
- if (persistent) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length + 1, (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
-
- if (MS_SQL_G(max_links) != -1 && MS_SQL_G(num_links) >= MS_SQL_G(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)", MS_SQL_G(num_links));
- efree(hashed_details);
- dbfreelogin(mssql.login);
- RETURN_FALSE;
- }
- if (MS_SQL_G(max_persistent) != -1 && MS_SQL_G(num_persistent) >= MS_SQL_G(max_persistent)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%d)", MS_SQL_G(num_persistent));
- efree(hashed_details);
- dbfreelogin(mssql.login);
- RETURN_FALSE;
- }
- /* create the link */
- if ((mssql.link = dbopen(mssql.login, host)) == FAIL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect to server: %s", host);
- efree(hashed_details);
- dbfreelogin(mssql.login);
- RETURN_FALSE;
- }
-
- if (DBSETOPT(mssql.link, DBBUFFER, "2")==FAIL) {
- efree(hashed_details);
- dbfreelogin(mssql.login);
- dbclose(mssql.link);
- RETURN_FALSE;
- }
-
- if (MS_SQL_G(textlimit) != -1) {
- sprintf(buffer, "%li", MS_SQL_G(textlimit));
- if (DBSETOPT(mssql.link, DBTEXTLIMIT, buffer)==FAIL) {
- efree(hashed_details);
- dbfreelogin(mssql.login);
- RETURN_FALSE;
- }
- }
- if (MS_SQL_G(textsize) != -1) {
- sprintf(buffer, "SET TEXTSIZE %li", MS_SQL_G(textsize));
- dbcmd(mssql.link, buffer);
- dbsqlexec(mssql.link);
- dbresults(mssql.link);
- }
-
- /* hash it up */
- mssql_ptr = (mssql_link *) malloc(sizeof(mssql_link));
- memcpy(mssql_ptr, &mssql, sizeof(mssql_link));
- Z_TYPE(new_le) = le_plink;
- new_le.ptr = mssql_ptr;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length + 1, &new_le, sizeof(list_entry), NULL)==FAILURE) {
- free(mssql_ptr);
- efree(hashed_details);
- dbfreelogin(mssql.login);
- RETURN_FALSE;
- }
- MS_SQL_G(num_persistent)++;
- MS_SQL_G(num_links)++;
- } else { /* we do */
- if (Z_TYPE_P(le) != le_plink) {
-#if BROKEN_MSSQL_PCONNECTS
- log_error("PHP/MS SQL: Hashed persistent link is not a MS SQL link!",php_rqst->server);
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Hashed persistent link is not a MS SQL link!");
- RETURN_FALSE;
- }
-
- mssql_ptr = (mssql_link *) le->ptr;
- /* test that the link hasn't died */
- if (DBDEAD(mssql_ptr->link) == TRUE) {
-#if BROKEN_MSSQL_PCONNECTS
- log_error("PHP/MS SQL: Persistent link died, trying to reconnect...",php_rqst->server);
-#endif
- if ((mssql_ptr->link=dbopen(mssql_ptr->login,host))==FAIL) {
-#if BROKEN_MSSQL_PCONNECTS
- log_error("PHP/MS SQL: Unable to reconnect!",php_rqst->server);
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Link to server lost, unable to reconnect");
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1);
- efree(hashed_details);
- RETURN_FALSE;
- }
-#if BROKEN_MSSQL_PCONNECTS
- log_error("PHP/MS SQL: Reconnect successful!",php_rqst->server);
-#endif
- if (DBSETOPT(mssql_ptr->link, DBBUFFER, "2")==FAIL) {
-#if BROKEN_MSSQL_PCONNECTS
- log_error("PHP/MS SQL: Unable to set required options",php_rqst->server);
-#endif
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length + 1);
- efree(hashed_details);
- RETURN_FALSE;
- }
- }
- }
- ZEND_REGISTER_RESOURCE(return_value, mssql_ptr, le_plink);
- } else { /* non persistent */
- list_entry *index_ptr, new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual mssql link sits.
- * if it doesn't, open a new mssql link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length + 1,(void **) &index_ptr)==SUCCESS) {
- int type,link;
- void *ptr;
-
- if (Z_TYPE_P(index_ptr) != le_index_ptr) {
- RETURN_FALSE;
- }
- link = (int) index_ptr->ptr;
- ptr = zend_list_find(link,&type); /* check if the link is still there */
- if (ptr && (type==le_link || type==le_plink)) {
- zend_list_addref(link);
- Z_LVAL_P(return_value) = link;
- php_mssql_set_default_link(link TSRMLS_CC);
- Z_TYPE_P(return_value) = IS_RESOURCE;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length + 1);
- }
- }
- if (MS_SQL_G(max_links) != -1 && MS_SQL_G(num_links) >= MS_SQL_G(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)", MS_SQL_G(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if ((mssql.link=dbopen(mssql.login, host))==NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect to server: %s", host);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if (DBSETOPT(mssql.link, DBBUFFER,"2")==FAIL) {
- efree(hashed_details);
- dbfreelogin(mssql.login);
- dbclose(mssql.link);
- RETURN_FALSE;
- }
-
- if (MS_SQL_G(textlimit) != -1) {
- sprintf(buffer, "%li", MS_SQL_G(textlimit));
- if (DBSETOPT(mssql.link, DBTEXTLIMIT, buffer)==FAIL) {
- efree(hashed_details);
- dbfreelogin(mssql.login);
- RETURN_FALSE;
- }
- }
- if (MS_SQL_G(textsize) != -1) {
- sprintf(buffer, "SET TEXTSIZE %li", MS_SQL_G(textsize));
- dbcmd(mssql.link, buffer);
- dbsqlexec(mssql.link);
- dbresults(mssql.link);
- }
-
- /* add it to the list */
- mssql_ptr = (mssql_link *) emalloc(sizeof(mssql_link));
- memcpy(mssql_ptr, &mssql, sizeof(mssql_link));
- ZEND_REGISTER_RESOURCE(return_value, mssql_ptr, le_link);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
- Z_TYPE(new_index_ptr) = le_index_ptr;
- if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length + 1,(void *) &new_index_ptr, sizeof(list_entry),NULL)==FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- MS_SQL_G(num_links)++;
- }
- efree(hashed_details);
- php_mssql_set_default_link(Z_LVAL_P(return_value) TSRMLS_CC);
-}
-
-
-static int php_mssql_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
-{
- if (MS_SQL_G(default_link)==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_mssql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
- }
- return MS_SQL_G(default_link);
-}
-
-/* {{{ proto int mssql_connect([string servername [, string username [, string password]]])
- Establishes a connection to a MS-SQL server */
-PHP_FUNCTION(mssql_connect)
-{
- php_mssql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-
-/* }}} */
-
-/* {{{ proto int mssql_pconnect([string servername [, string username [, string password]]])
- Establishes a persistent connection to a MS-SQL server */
-PHP_FUNCTION(mssql_pconnect)
-{
- php_mssql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-
-/* }}} */
-
-/* {{{ proto int mssql_close([int connectionid])
- Closes a connection to a MS-SQL server */
-PHP_FUNCTION(mssql_close)
-{
- zval **mssql_link_index=NULL;
- int id;
- mssql_link *mssql_ptr;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mssql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(mssql_ptr, mssql_link *, mssql_link_index, id, "MS SQL-Link", le_link, le_plink);
-
- if (mssql_link_index)
- zend_list_delete(Z_RESVAL_PP(mssql_link_index));
- else
- zend_list_delete(id);
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto bool mssql_select_db(string database_name [, int conn_id])
- Select a MS-SQL database */
-PHP_FUNCTION(mssql_select_db)
-{
- zval **db, **mssql_link_index;
- int id;
- mssql_link *mssql_ptr;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &db, &mssql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mssql_ptr, mssql_link *, mssql_link_index, id, "MS SQL-Link", le_link, le_plink);
-
- convert_to_string_ex(db);
-
- if (dbuse(mssql_ptr->link, Z_STRVAL_PP(db))==FAIL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to select database: %s", Z_STRVAL_PP(db));
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-
-/* }}} */
-
-static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int offset,zval *result, int column_type TSRMLS_DC)
-{
- if (dbdatlen(mssql_ptr->link,offset) == 0) {
- ZVAL_NULL(result);
- return;
- }
-
- switch (column_type)
- {
- case SQLBIT:
- case SQLINT1:
- case SQLINT2:
- case SQLINT4:
- case SQLINTN: {
- Z_LVAL_P(result) = (long) anyintcol(offset);
- Z_TYPE_P(result) = IS_LONG;
- break;
- }
- case SQLCHAR:
- case SQLVARCHAR:
- case SQLTEXT: {
- int length;
- char *data = charcol(offset);
-
- length=dbdatlen(mssql_ptr->link,offset);
- while (length>0 && data[length-1] == ' ') { /* nuke trailing whitespace */
- length--;
- }
- Z_STRVAL_P(result) = estrndup(data,length);
- Z_STRLEN_P(result) = length;
- Z_TYPE_P(result) = IS_STRING;
- break;
- }
- case SQLFLT4:
- Z_DVAL_P(result) = (double) floatcol4(offset);
- Z_TYPE_P(result) = IS_DOUBLE;
- break;
- case SQLFLT8:
- Z_DVAL_P(result) = (double) floatcol8(offset);
- Z_TYPE_P(result) = IS_DOUBLE;
- break;
- case SQLVARBINARY:
- case SQLBINARY:
- case SQLIMAGE: {
- DBBINARY *bin;
- unsigned char *res_buf;
- int res_length = dbdatlen(mssql_ptr->link, offset);
-
- res_buf = (unsigned char *) emalloc(res_length+1);
- bin = ((DBBINARY *)dbdata(mssql_ptr->link, offset));
- memcpy(res_buf,bin,res_length);
- res_buf[res_length] = '\0';
- Z_STRLEN_P(result) = res_length;
- Z_STRVAL_P(result) = res_buf;
- Z_TYPE_P(result) = IS_STRING;
- }
- break;
- case SQLNUMERIC:
- default: {
- if (dbwillconvert(column_type,SQLCHAR)) {
- char *res_buf;
- DBDATEREC dateinfo;
- int res_length = dbdatlen(mssql_ptr->link,offset);
-
- if ((column_type != SQLDATETIME && column_type != SQLDATETIM4) || MS_SQL_G(datetimeconvert)) {
-
- if (column_type == SQLDATETIM4) res_length += 14;
- if (column_type == SQLDATETIME) res_length += 10;
-
- res_buf = (unsigned char *) emalloc(res_length+1);
- res_length = dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR,res_buf,-1);
- } else {
- if (column_type == SQLDATETIM4) {
- DBDATETIME temp;
-
- dbconvert(NULL, SQLDATETIM4, dbdata(mssql_ptr->link,offset), -1, SQLDATETIME, (LPBYTE) &temp, -1);
- dbdatecrack(mssql_ptr->link, &dateinfo, &temp);
- } else {
- dbdatecrack(mssql_ptr->link, &dateinfo, (DBDATETIME *) dbdata(mssql_ptr->link,offset));
- }
-
- res_length = 19;
- res_buf = (unsigned char *) emalloc(res_length+1);
- sprintf(res_buf, "%d-%02d-%02d %02d:%02d:%02d" , dateinfo.year, dateinfo.month, dateinfo.day, dateinfo.hour, dateinfo.minute, dateinfo.second);
- }
-
- Z_STRVAL_P(result) = res_buf;
- Z_STRLEN_P(result) = res_length;
- Z_TYPE_P(result) = IS_STRING;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "column %d has unknown data type (%d)", offset, coltype(offset));
- ZVAL_FALSE(result);
- }
- }
- }
-}
-
-static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int offset,zval *result, int column_type TSRMLS_DC)
-{
- if (dbdatlen(mssql_ptr->link,offset) == 0) {
- ZVAL_NULL(result);
- return;
- }
-
- if (column_type == SQLVARBINARY ||
- column_type == SQLBINARY ||
- column_type == SQLIMAGE) {
- DBBINARY *bin;
- unsigned char *res_buf;
- int res_length = dbdatlen(mssql_ptr->link, offset);
-
- res_buf = (unsigned char *) emalloc(res_length+1);
- bin = ((DBBINARY *)dbdata(mssql_ptr->link, offset));
- memcpy(res_buf, bin, res_length);
- res_buf[res_length] = '\0';
- Z_STRLEN_P(result) = res_length;
- Z_STRVAL_P(result) = res_buf;
- Z_TYPE_P(result) = IS_STRING;
- }
- else if (dbwillconvert(coltype(offset),SQLCHAR)) {
- unsigned char *res_buf;
- DBDATEREC dateinfo;
- int res_length = dbdatlen(mssql_ptr->link,offset);
-
- if ((column_type != SQLDATETIME && column_type != SQLDATETIM4) || MS_SQL_G(datetimeconvert)) {
-
- if (column_type == SQLDATETIM4) res_length += 14;
- if (column_type == SQLDATETIME) res_length += 10;
-
- res_buf = (unsigned char *) emalloc(res_length+1);
- res_length = dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR, res_buf, -1);
-
- } else {
- if (column_type == SQLDATETIM4) {
- DBDATETIME temp;
-
- dbconvert(NULL, SQLDATETIM4, dbdata(mssql_ptr->link,offset), -1, SQLDATETIME, (LPBYTE) &temp, -1);
- dbdatecrack(mssql_ptr->link, &dateinfo, &temp);
- } else {
- dbdatecrack(mssql_ptr->link, &dateinfo, (DBDATETIME *) dbdata(mssql_ptr->link,offset));
- }
-
- res_length = 19;
- res_buf = (unsigned char *) emalloc(res_length+1);
- sprintf(res_buf, "%d-%02d-%02d %02d:%02d:%02d" , dateinfo.year, dateinfo.month, dateinfo.day, dateinfo.hour, dateinfo.minute, dateinfo.second);
- }
-
- Z_STRVAL_P(result) = res_buf;
- Z_STRLEN_P(result) = res_length;
- Z_TYPE_P(result) = IS_STRING;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "column %d has unknown data type (%d)", offset, coltype(offset));
- ZVAL_FALSE(result);
- }
-}
-
-static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *statement TSRMLS_DC)
-{
- int i, num_rets, type;
- char *parameter;
- mssql_bind *bind;
-
- /* Now to fetch RETVAL and OUTPUT values*/
- num_rets = dbnumrets(mssql_ptr->link);
-
- if (num_rets!=0) {
- for (i = 1; i <= num_rets; i++) {
- parameter = (char*)dbretname(mssql_ptr->link, i);
- type = dbrettype(mssql_ptr->link, i);
-
- if (statement->binds != NULL) { /* Maybe a non-parameter sp */
- if (zend_hash_find(statement->binds, parameter, strlen(parameter), (void**)&bind)==SUCCESS) {
- switch (type) {
- case SQLBIT:
- case SQLINT1:
- case SQLINT2:
- case SQLINT4:
- convert_to_long_ex(&bind->zval);
- Z_LVAL_P(bind->zval) = *((int *)(dbretdata(mssql_ptr->link,i)));
- break;
-
- case SQLFLT4:
- case SQLFLT8:
- case SQLFLTN:
- convert_to_double_ex(&bind->zval);
- Z_DVAL_P(bind->zval) = *((double *)(dbretdata(mssql_ptr->link,i)));
- break;
-
- case SQLCHAR:
- case SQLVARCHAR:
- case SQLTEXT:
- convert_to_string_ex(&bind->zval);
- Z_STRLEN_P(bind->zval) = dbretlen(mssql_ptr->link,i);
- Z_STRVAL_P(bind->zval) = estrndup(dbretdata(mssql_ptr->link,i),Z_STRLEN_P(bind->zval));
- break;
- }
- }
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "An output parameter variable was not provided");
- }
- }
- }
- }
- if (statement->binds != NULL) { /* Maybe a non-parameter sp */
- if (zend_hash_find(statement->binds, "RETVAL", 6, (void**)&bind)==SUCCESS) {
- if (dbhasretstat(mssql_ptr->link)) {
- convert_to_long_ex(&bind->zval);
- Z_LVAL_P(bind->zval)=dbretstatus(mssql_ptr->link);
- }
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "stored procedure has no return value. Nothing was returned into RETVAL");
- }
- }
- }
-}
-
-static int _mssql_fetch_batch(mssql_link *mssql_ptr, mssql_result *result, int retvalue TSRMLS_DC)
-{
- int i, j = 0;
- int *column_types;
- char computed_buf[16];
-
- column_types = (int *) emalloc(sizeof(int) * result->num_fields);
- for (i=0; i<result->num_fields; i++) {
- char *fname = (char *)dbcolname(mssql_ptr->link,i+1);
-
- if (*fname) {
- result->fields[i].name = estrdup(fname);
- } else {
- if (j>0) {
- snprintf(computed_buf,16,"computed%d",j);
- } else {
- strcpy(computed_buf,"computed");
- }
- result->fields[i].name = estrdup(computed_buf);
- j++;
- }
- result->fields[i].max_length = dbcollen(mssql_ptr->link,i+1);
- result->fields[i].column_source = estrdup(dbcolsource(mssql_ptr->link,i+1));
- if (!result->fields[i].column_source) {
- result->fields[i].column_source = empty_string;
- }
-
- column_types[i] = coltype(i+1);
-
- Z_TYPE(result->fields[i]) = column_types[i];
- /* set numeric flag */
- switch (column_types[i]) {
- case SQLINT1:
- case SQLINT2:
- case SQLINT4:
- case SQLINTN:
- case SQLFLT4:
- case SQLFLT8:
- case SQLNUMERIC:
- case SQLDECIMAL:
- result->fields[i].numeric = 1;
- break;
- case SQLCHAR:
- case SQLVARCHAR:
- case SQLTEXT:
- default:
- result->fields[i].numeric = 0;
- break;
- }
- }
-
- i=0;
- if (!result->data) {
- result->data = (zval **) emalloc(sizeof(zval *)*MSSQL_ROWS_BLOCK*(++result->blocks_initialized));
- }
- while (retvalue!=FAIL && retvalue!=NO_MORE_ROWS) {
- result->num_rows++;
- if (result->num_rows > result->blocks_initialized*MSSQL_ROWS_BLOCK) {
- result->data = (zval **) erealloc(result->data,sizeof(zval *)*MSSQL_ROWS_BLOCK*(++result->blocks_initialized));
- }
- result->data[i] = (zval *) emalloc(sizeof(zval)*result->num_fields);
- for (j=0; j<result->num_fields; j++) {
- INIT_ZVAL(result->data[i][j]);
- MS_SQL_G(get_column_content(mssql_ptr, j+1, &result->data[i][j], column_types[j] TSRMLS_CC));
- }
- if (i<result->batchsize || result->batchsize==0) {
- i++;
- dbclrbuf(mssql_ptr->link,DBLASTROW(mssql_ptr->link));
- retvalue=dbnextrow(mssql_ptr->link);
- }
- else
- break;
- result->lastresult = retvalue;
- }
- efree(column_types);
- return i;
-}
-
-/* {{{ proto int mssql_fetch_batch(resource result_index)
- Returns the next batch of records */
-PHP_FUNCTION(mssql_fetch_batch)
-{
- zval **mssql_result_index;
- mssql_result *result;
- mssql_link *mssql_ptr;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(mssql_result_index)==IS_RESOURCE && Z_LVAL_PP(mssql_result_index)==0) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
- mssql_ptr = result->mssql_ptr;
- _free_result(result, 0);
- result->cur_row=result->num_rows=0;
- result->num_rows = _mssql_fetch_batch(mssql_ptr, result, result->lastresult TSRMLS_CC);
- RETURN_LONG(result->num_rows);
-}
-/* }}} */
-
-/* {{{ proto int mssql_query(string query [, int conn_id [, int batch_size]])
- Perform an SQL query on a MS-SQL server database */
-PHP_FUNCTION(mssql_query)
-{
- zval **query, **mssql_link_index, **zbatchsize;
- int retvalue;
- mssql_link *mssql_ptr;
- mssql_result *result;
- int id, num_fields;
- int batchsize;
-
- batchsize = MS_SQL_G(batchsize);
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &query)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &query, &mssql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &query, &mssql_link_index, &zbatchsize)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- convert_to_long_ex(zbatchsize);
- batchsize = Z_LVAL_PP(zbatchsize);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mssql_ptr, mssql_link *, mssql_link_index, id, "MS SQL-Link", le_link, le_plink);
-
- convert_to_string_ex(query);
-
- if (dbcmd(mssql_ptr->link, Z_STRVAL_PP(query))==FAIL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to set query");
- RETURN_FALSE;
- }
- if (dbsqlexec(mssql_ptr->link)==FAIL || (retvalue = dbresults(mssql_ptr->link))==FAIL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Query failed");
- RETURN_FALSE;
- }
-
- /* Skip results not returning any columns */
- while ((num_fields = dbnumcols(mssql_ptr->link)) <= 0 && retvalue == SUCCEED) {
- retvalue = dbresults(mssql_ptr->link);
- }
- if ((num_fields = dbnumcols(mssql_ptr->link)) <= 0) {
- RETURN_TRUE;
- }
-
- retvalue=dbnextrow(mssql_ptr->link);
- if (retvalue==FAIL) {
- RETURN_FALSE;
- }
-
- result = (mssql_result *) emalloc(sizeof(mssql_result));
- result->statement = NULL;
- result->num_fields = num_fields;
- result->blocks_initialized = 1;
-
- result->batchsize = batchsize;
- result->data = NULL;
- result->blocks_initialized = 0;
- result->mssql_ptr = mssql_ptr;
- result->cur_field=result->cur_row=result->num_rows=0;
-
- if (num_fields > 0) {
- result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*result->num_fields);
- result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC);
- }
- else
- result->fields = NULL;
-
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-
-/* {{{ proto int mssql_rows_affected(int conn_id)
- Returns the number of records affected by the query */
-PHP_FUNCTION(mssql_rows_affected)
-{
- zval **mssql_link_index;
- mssql_link *mssql_ptr;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_link_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(mssql_ptr, mssql_link *, mssql_link_index, -1, "MS SQL-Link", le_link, le_plink);
- RETURN_LONG(DBCOUNT(mssql_ptr->link));
-}
-/* }}} */
-
-
-/* {{{ proto int mssql_free_result(resource result_index)
- Free a MS-SQL result index */
-PHP_FUNCTION(mssql_free_result)
-{
- zval **mssql_result_index;
- mssql_result *result;
- int retvalue;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(mssql_result_index)==IS_RESOURCE && Z_LVAL_PP(mssql_result_index)==0) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
- /* Release remaining results */
- do {
- dbcanquery(result->mssql_ptr->link);
- retvalue = dbresults(result->mssql_ptr->link);
- } while (retvalue == SUCCEED);
-
- zend_list_delete(Z_RESVAL_PP(mssql_result_index));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string mssql_get_last_message(void)
- Gets the last message from the MS-SQL server */
-PHP_FUNCTION(mssql_get_last_message)
-{
- if (MS_SQL_G(server_message)) {
- RETURN_STRING(MS_SQL_G(server_message),1);
- }
- else {
- RETURN_STRING(empty_string,1);
- }
-}
-
-/* }}} */
-
-/* {{{ proto int mssql_num_rows(int mssql_result_index)
- Returns the number of rows fetched in from the result id specified */
-PHP_FUNCTION(mssql_num_rows)
-{
- zval **mssql_result_index;
- mssql_result *result;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- Z_LVAL_P(return_value) = result->num_rows;
- Z_TYPE_P(return_value) = IS_LONG;
-}
-
-/* }}} */
-
-/* {{{ proto int mssql_num_fields(int mssql_result_index)
- Returns the number of fields fetched in from the result id specified */
-PHP_FUNCTION(mssql_num_fields)
-{
- zval **mssql_result_index;
- mssql_result *result;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- Z_LVAL_P(return_value) = result->num_fields;
- Z_TYPE_P(return_value) = IS_LONG;
-}
-
-/* }}} */
-
-static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
-{
- zval **mssql_result_index, **resulttype = NULL;
- mssql_result *result;
- int i;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- if (!result_type) {
- result_type = MSSQL_BOTH;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &mssql_result_index, &resulttype)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(resulttype);
- result_type = Z_LVAL_PP(resulttype);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- if (MS_SQL_G(server_message)) {
- STR_FREE(MS_SQL_G(server_message));
- MS_SQL_G(server_message) = NULL;
- }
-
- if (result->cur_row >= result->num_rows) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- for (i=0; i<result->num_fields; i++) {
- if (Z_TYPE(result->data[result->cur_row][i]) != IS_NULL) {
- char *data;
- int data_len;
- int should_copy;
-
- if (Z_TYPE(result->data[result->cur_row][i]) == IS_STRING) {
- if (PG(magic_quotes_runtime)) {
- data = php_addslashes(Z_STRVAL(result->data[result->cur_row][i]), Z_STRLEN(result->data[result->cur_row][i]), &data_len, 0 TSRMLS_CC);
- should_copy = 0;
- }
- else
- {
- data = Z_STRVAL(result->data[result->cur_row][i]);
- data_len = Z_STRLEN(result->data[result->cur_row][i]);
- should_copy = 1;
- }
-
- if (result_type & MSSQL_NUM) {
- add_index_stringl(return_value, i, data, data_len, should_copy);
- should_copy = 1;
- }
-
- if (result_type & MSSQL_ASSOC) {
- add_assoc_stringl(return_value, result->fields[i].name, data, data_len, should_copy);
- }
- }
- else if (Z_TYPE(result->data[result->cur_row][i]) == IS_LONG) {
- if (result_type & MSSQL_NUM)
- add_index_long(return_value, i, Z_LVAL(result->data[result->cur_row][i]));
-
- if (result_type & MSSQL_ASSOC)
- add_assoc_long(return_value, result->fields[i].name, Z_LVAL(result->data[result->cur_row][i]));
- }
- else if (Z_TYPE(result->data[result->cur_row][i]) == IS_DOUBLE) {
- if (result_type & MSSQL_NUM)
- add_index_double(return_value, i, Z_DVAL(result->data[result->cur_row][i]));
-
- if (result_type & MSSQL_ASSOC)
- add_assoc_double(return_value, result->fields[i].name, Z_DVAL(result->data[result->cur_row][i]));
- }
- }
- else
- {
- if (result_type & MSSQL_NUM)
- add_index_null(return_value, i);
- if (result_type & MSSQL_ASSOC)
- add_assoc_null(return_value, result->fields[i].name);
- }
- }
- result->cur_row++;
-}
-
-/* {{{ proto array mssql_fetch_row(int result_id [, int result_type])
- Returns an array of the current row in the result set specified by result_id */
-PHP_FUNCTION(mssql_fetch_row)
-{
- php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_NUM);
-}
-
-/* }}} */
-
-/* {{{ proto object mssql_fetch_object(int result_id [, int result_type])
- Returns a psuedo-object of the current row in the result set specified by result_id */
-PHP_FUNCTION(mssql_fetch_object)
-{
- php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_ASSOC);
- if (Z_TYPE_P(return_value)==IS_ARRAY) {
- object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value));
- }
-}
-
-/* }}} */
-
-/* {{{ proto array mssql_fetch_array(int result_id [, int result_type])
- Returns an associative array of the current row in the result set specified by result_id */
-PHP_FUNCTION(mssql_fetch_array)
-{
- php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_BOTH);
-}
-
-/* }}} */
-
-/* {{{ proto array mssql_fetch_assoc(int result_id [, int result_type])
- Returns an associative array of the current row in the result set specified by result_id */
-PHP_FUNCTION(mssql_fetch_assoc)
-{
- php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_ASSOC);
-}
-
-/* }}} */
-
-/* {{{ proto int mssql_data_seek(int result_id, int offset)
- Moves the internal row pointer of the MS-SQL result associated with the specified result identifier to pointer to the specified row number */
-PHP_FUNCTION(mssql_data_seek)
-{
- zval **mssql_result_index, **offset;
- mssql_result *result;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &mssql_result_index, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- convert_to_long_ex(offset);
- if (Z_LVAL_PP(offset)<0 || Z_LVAL_PP(offset)>=result->num_rows) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad row offset");
- RETURN_FALSE;
- }
-
- result->cur_row = Z_LVAL_PP(offset);
- RETURN_TRUE;
-}
-
-/* }}} */
-
-static char *php_mssql_get_field_name(int type)
-{
- switch (type) {
- case SQLBINARY:
- case SQLVARBINARY:
- return "blob";
- break;
- case SQLCHAR:
- case SQLVARCHAR:
- return "char";
- break;
- case SQLTEXT:
- return "text";
- break;
- case SQLDATETIME:
- case SQLDATETIM4:
- case SQLDATETIMN:
- return "datetime";
- break;
- case SQLDECIMAL:
- case SQLFLT4:
- case SQLFLT8:
- case SQLFLTN:
- return "real";
- break;
- case SQLINT1:
- case SQLINT2:
- case SQLINT4:
- case SQLINTN:
- return "int";
- break;
- case SQLNUMERIC:
- return "numeric";
- break;
- case SQLMONEY:
- case SQLMONEY4:
- case SQLMONEYN:
- return "money";
- break;
- case SQLBIT:
- return "bit";
- break;
- case SQLIMAGE:
- return "image";
- break;
- default:
- return "unknown";
- break;
- }
-}
-
-/* {{{ proto object mssql_fetch_field(int result_id [, int offset])
- Gets information about certain fields in a query result */
-PHP_FUNCTION(mssql_fetch_field)
-{
- zval **mssql_result_index, **offset;
- int field_offset;
- mssql_result *result;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- field_offset=-1;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &mssql_result_index, &offset)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(offset);
- field_offset = Z_LVAL_PP(offset);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- if (field_offset==-1) {
- field_offset = result->cur_field;
- result->cur_field++;
- }
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset");
- }
- RETURN_FALSE;
- }
-
- object_init(return_value);
-
- add_property_string(return_value, "name",result->fields[field_offset].name, 1);
- add_property_long(return_value, "max_length",result->fields[field_offset].max_length);
- add_property_string(return_value, "column_source",result->fields[field_offset].column_source, 1);
- add_property_long(return_value, "numeric", result->fields[field_offset].numeric);
- add_property_string(return_value, "type", php_mssql_get_field_name(Z_TYPE(result->fields[field_offset])), 1);
-}
-
-/* }}} */
-
-/* {{{ proto int mssql_field_length(int result_id [, int offset])
- Get the length of a MS-SQL field */
-PHP_FUNCTION(mssql_field_length)
-{
- zval **mssql_result_index, **offset;
- int field_offset;
- mssql_result *result;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- field_offset=-1;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &mssql_result_index, &offset)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(offset);
- field_offset = Z_LVAL_PP(offset);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- if (field_offset==-1) {
- field_offset = result->cur_field;
- result->cur_field++;
- }
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset");
- }
- RETURN_FALSE;
- }
-
- Z_LVAL_P(return_value) = result->fields[field_offset].max_length;
- Z_TYPE_P(return_value) = IS_LONG;
-}
-
-/* }}} */
-
-/* {{{ proto string mssql_field_name(int result_id [, int offset])
- Returns the name of the field given by offset in the result set given by result_id */
-PHP_FUNCTION(mssql_field_name)
-{
- zval **mssql_result_index, **offset;
- int field_offset;
- mssql_result *result;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- field_offset=-1;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &mssql_result_index, &offset)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(offset);
- field_offset = Z_LVAL_PP(offset);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- if (field_offset==-1) {
- field_offset = result->cur_field;
- result->cur_field++;
- }
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset");
- }
- RETURN_FALSE;
- }
-
- Z_STRVAL_P(return_value) = estrdup(result->fields[field_offset].name);
- Z_STRLEN_P(return_value) = strlen(result->fields[field_offset].name);
- Z_TYPE_P(return_value) = IS_STRING;
-}
-
-/* }}} */
-
-/* {{{ proto string mssql_field_type(int result_id [, int offset])
- Returns the type of a field */
-PHP_FUNCTION(mssql_field_type)
-{
- zval **mssql_result_index, **offset;
- int field_offset;
- mssql_result *result;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- field_offset=-1;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &mssql_result_index, &offset)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(offset);
- field_offset = Z_LVAL_PP(offset);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- if (field_offset==-1) {
- field_offset = result->cur_field;
- result->cur_field++;
- }
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset");
- }
- RETURN_FALSE;
- }
-
- Z_STRVAL_P(return_value) = estrdup(php_mssql_get_field_name(Z_TYPE(result->fields[field_offset])));
- Z_STRLEN_P(return_value) = strlen(php_mssql_get_field_name(Z_TYPE(result->fields[field_offset])));
- Z_TYPE_P(return_value) = IS_STRING;
-}
-
-/* }}} */
-
-/* {{{ proto bool mssql_field_seek(int result_id, int offset)
- Seeks to the specified field offset */
-PHP_FUNCTION(mssql_field_seek)
-{
- zval **mssql_result_index, **offset;
- int field_offset;
- mssql_result *result;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &mssql_result_index, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- convert_to_long_ex(offset);
- field_offset = Z_LVAL_PP(offset);
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset");
- RETURN_FALSE;
- }
-
- result->cur_field = field_offset;
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string mssql_result(int result_id, int row, mixed field)
- Returns the contents of one cell from a MS-SQL result set */
-PHP_FUNCTION(mssql_result)
-{
- zval **row, **field, **mssql_result_index;
- int field_offset=0;
- mssql_result *result;
-
- if (ZEND_NUM_ARGS()!=3 || zend_get_parameters_ex(3, &mssql_result_index, &row, &field)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- convert_to_long_ex(row);
- if (Z_LVAL_PP(row) < 0 || Z_LVAL_PP(row) >= result->num_rows) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad row offset (%d)", Z_LVAL_PP(row));
- RETURN_FALSE;
- }
-
- switch(Z_TYPE_PP(field)) {
- case IS_STRING: {
- int i;
-
- for (i=0; i<result->num_fields; i++) {
- if (!strcasecmp(result->fields[i].name, Z_STRVAL_PP(field))) {
- field_offset = i;
- break;
- }
- }
- if (i>=result->num_fields) { /* no match found */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s field not found in result", Z_STRVAL_PP(field));
- RETURN_FALSE;
- }
- break;
- }
- default:
- convert_to_long_ex(field);
- field_offset = Z_LVAL_PP(field);
- if (field_offset<0 || field_offset>=result->num_fields) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
- RETURN_FALSE;
- }
- break;
- }
-
- *return_value = result->data[Z_LVAL_PP(row)][field_offset];
- ZVAL_COPY_CTOR(return_value);
-}
-/* }}} */
-
-/* {{{ proto bool mssql_next_result(int result_id)
- Move the internal result pointer to the next result */
-PHP_FUNCTION(mssql_next_result)
-{
- zval **mssql_result_index;
- int retvalue;
- mssql_result *result;
- mssql_link *mssql_ptr;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- mssql_ptr = result->mssql_ptr;
- retvalue = dbresults(mssql_ptr->link);
- if (retvalue == FAIL) {
- RETURN_FALSE;
- }
- else if (retvalue == NO_MORE_RESULTS || retvalue == NO_MORE_RPC_RESULTS) {
- if (result->statement) {
- _mssql_get_sp_result(result->mssql_ptr, result->statement TSRMLS_CC);
- }
- RETURN_FALSE;
- }
- else {
- _free_result(result, 1);
- result->cur_row=result->num_fields=result->num_rows=0;
- dbclrbuf(mssql_ptr->link,DBLASTROW(mssql_ptr->link));
- retvalue = dbnextrow(mssql_ptr->link);
-
- result->num_fields = dbnumcols(mssql_ptr->link);
- result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*result->num_fields);
- result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC);
- RETURN_TRUE;
- }
-
-}
-/* }}} */
-
-
-/* {{{ proto void mssql_min_error_severity(int severity)
- Sets the lower error severity */
-PHP_FUNCTION(mssql_min_error_severity)
-{
- zval **severity;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &severity)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(severity);
- MS_SQL_G(min_error_severity) = Z_LVAL_PP(severity);
-}
-
-/* }}} */
-
-/* {{{ proto void mssql_min_message_severity(int severity)
- Sets the lower message severity */
-PHP_FUNCTION(mssql_min_message_severity)
-{
- zval **severity;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &severity)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(severity);
- MS_SQL_G(min_message_severity) = Z_LVAL_PP(severity);
-}
-/* }}} */
-
-/* {{{ proto int mssql_init(string sp_name [, int conn_id])
- Initializes a stored procedure or a remote stored procedure */
-PHP_FUNCTION(mssql_init)
-{
- zval **sp_name, **mssql_link_index;
- mssql_link *mssql_ptr;
- mssql_statement *statement;
- int id;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &sp_name)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
-
- case 2:
- if (zend_get_parameters_ex(2, &sp_name, &mssql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mssql_ptr, mssql_link *, mssql_link_index, id, "MS SQL-Link", le_link, le_plink);
-
- convert_to_string_ex(sp_name);
-
- if (dbrpcinit(mssql_ptr->link, Z_STRVAL_PP(sp_name),0)==FAIL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to init stored procedure");
- RETURN_FALSE;
- }
-
- statement=NULL;
- statement = ecalloc(1,sizeof(mssql_statement));
- statement->link = mssql_ptr;
- statement->executed=FALSE;
-
- statement->id = zend_list_insert(statement,le_statement);
-
- RETURN_RESOURCE(statement->id);
-}
-/* }}} */
-
-/* {{{ proto int mssql_bind(int stmt, string param_name, mixed var, int type
- [, int is_output[, int is_null[, int maxlen]]])
- Adds a parameter to a stored procedure or a remote stored procedure */
-PHP_FUNCTION(mssql_bind)
-{
- int type, is_output, is_null, datalen, maxlen = -1;
- zval **stmt, **param_name, **var, **yytype;
- mssql_link *mssql_ptr;
- mssql_statement *statement;
- mssql_bind bind,*bindp;
- int id = 0, status = 0;
- LPBYTE value = NULL;
-
- /* BEGIN input validation */
- switch(ZEND_NUM_ARGS()) {
- case 4:
- if (zend_get_parameters_ex(4, &stmt, &param_name, &var, &yytype)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(yytype);
- type=Z_LVAL_PP(yytype);
- is_null=FALSE;
- is_output=FALSE;
- break;
-
- case 5: {
- zval **yyis_output;
-
- if (zend_get_parameters_ex(5, &stmt, &param_name, &var, &yytype, &yyis_output)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(yytype);
- convert_to_long_ex(yyis_output);
- type=Z_LVAL_PP(yytype);
- is_null=FALSE;
- is_output=Z_LVAL_PP(yyis_output);
- }
- break;
-
- case 6: {
- zval **yyis_output, **yyis_null;
-
- if (zend_get_parameters_ex(6, &stmt, &param_name, &var, &yytype, &yyis_output, &yyis_null)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(yytype);
- convert_to_long_ex(yyis_output);
- convert_to_long_ex(yyis_null);
- type=Z_LVAL_PP(yytype);
- is_output=Z_LVAL_PP(yyis_output);
- is_null=Z_LVAL_PP(yyis_null);
- }
- break;
-
- case 7: {
- zval **yyis_output, **yyis_null, **yymaxlen;
-
- if (zend_get_parameters_ex(7, &stmt, &param_name, &var, &yytype, &yyis_output, &yyis_null, &yymaxlen)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(yytype);
- convert_to_long_ex(yyis_output);
- convert_to_long_ex(yyis_null);
- convert_to_long_ex(yymaxlen);
- type=Z_LVAL_PP(yytype);
- is_output=Z_LVAL_PP(yyis_output);
- is_null=Z_LVAL_PP(yyis_null);
- maxlen=Z_LVAL_PP(yymaxlen);
- }
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- /* END input validation */
-
- ZEND_FETCH_RESOURCE(statement, mssql_statement *, stmt, -1, "MS SQL-Statement", le_statement);
- if (statement==NULL) {
- RETURN_FALSE;
- }
- mssql_ptr=statement->link;
-
- /* modify datalen and maxlen according to dbrpcparam documentation */
- if ( (type==SQLVARCHAR) || (type==SQLCHAR) || (type==SQLTEXT) ) { /* variable-length type */
- if (is_null) {
- maxlen=0;
- datalen=0;
- }
- else {
- convert_to_string_ex(var);
- datalen=Z_STRLEN_PP(var);
- value=(LPBYTE)Z_STRVAL_PP(var);
- }
- }
- else { /* fixed-length type */
- if (is_null) {
- datalen=0;
- }
- else {
- datalen=-1;
- }
- maxlen=-1;
-
- switch (type) {
-
- case SQLFLT4:
- case SQLFLT8:
- case SQLFLTN:
- convert_to_double_ex(var);
- value=(LPBYTE)(&Z_DVAL_PP(var));
- break;
-
- case SQLBIT:
- case SQLINT1:
- case SQLINT2:
- case SQLINT4:
- convert_to_long_ex(var);
- value=(LPBYTE)(&Z_LVAL_PP(var));
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unsupported type");
- RETURN_FALSE;
- break;
- }
- }
-
- convert_to_string_ex(param_name);
-
- if (is_output) {
- status=DBRPCRETURN;
- }
-
- /* hashtable of binds */
- if (! statement->binds) {
- ALLOC_HASHTABLE(statement->binds);
- zend_hash_init(statement->binds, 13, NULL, _mssql_bind_hash_dtor, 0);
- }
-
- memset((void*)&bind,0,sizeof(mssql_bind));
- zend_hash_add(statement->binds,Z_STRVAL_PP(param_name),Z_STRLEN_PP(param_name),&bind,sizeof(mssql_bind),(void **)&bindp);
- bindp->zval=*var;
- zval_add_ref(var);
-
- /* no call to dbrpcparam if RETVAL */
- if ( strcmp("RETVAL",Z_STRVAL_PP(param_name))!=0 ) {
- if (dbrpcparam(mssql_ptr->link, Z_STRVAL_PP(param_name), (BYTE)status, type, maxlen, datalen, (LPBYTE)value)==FAIL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to set parameter");
- RETURN_FALSE;
- }
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mssql_execute(int stmt [, bool skip_results = false])
- Executes a stored procedure on a MS-SQL server database */
-PHP_FUNCTION(mssql_execute)
-{
- zval **stmt, **skip;
- zend_bool skip_results = 0;
- int retvalue, retval_results;
- mssql_link *mssql_ptr;
- mssql_statement *statement;
- mssql_result *result;
- int num_fields;
- int blocks_initialized=1;
- int batchsize;
- int ac = ZEND_NUM_ARGS();
-
- batchsize = MS_SQL_G(batchsize);
- if (ac < 1 || ac > 2 || zend_get_parameters_ex(ac, &stmt, &skip)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (ac == 2) {
- skip_results = Z_BVAL_PP(skip);
- }
-
- ZEND_FETCH_RESOURCE(statement, mssql_statement *, stmt, -1, "MS SQL-Statement", le_statement);
-
- mssql_ptr=statement->link;
-
- if (dbrpcexec(mssql_ptr->link)==FAIL || dbsqlok(mssql_ptr->link)==FAIL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "stored procedure execution failed");
- RETURN_FALSE;
- }
-
- retval_results=dbresults(mssql_ptr->link);
-
- if (retval_results==FAIL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not retrieve results");
- RETURN_FALSE;
- }
-
- /* The following is just like mssql_query, fetch all rows from the first result
- * set into the row buffer.
- */
- result=NULL;
- if (retval_results == SUCCEED) {
- if (skip_results) {
- do {
- dbcanquery(mssql_ptr->link);
- retval_results = dbresults(mssql_ptr->link);
- } while (retval_results == SUCCEED);
-
- _mssql_get_sp_result(mssql_ptr, statement TSRMLS_CC);
- }
- else {
- /* Skip results not returning any columns */
- while ((num_fields = dbnumcols(mssql_ptr->link)) <= 0 && retval_results == SUCCEED) {
- retval_results = dbresults(mssql_ptr->link);
- }
- if ((num_fields = dbnumcols(mssql_ptr->link)) > 0) {
- retvalue = dbnextrow(mssql_ptr->link);
- result = (mssql_result *) emalloc(sizeof(mssql_result));
- result->batchsize = batchsize;
- result->blocks_initialized = 1;
- result->data = (zval **) emalloc(sizeof(zval *)*MSSQL_ROWS_BLOCK);
- result->mssql_ptr = mssql_ptr;
- result->cur_field=result->cur_row=result->num_rows=0;
- result->num_fields = num_fields;
-
- result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*num_fields);
- result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC);
- result->statement = statement;
- }
- else {
- _mssql_get_sp_result(mssql_ptr, statement TSRMLS_CC);
- }
- }
- }
- else if (retval_results == NO_MORE_RESULTS || retval_results == NO_MORE_RPC_RESULTS) {
- _mssql_get_sp_result(mssql_ptr, statement TSRMLS_CC);
- }
-
- if (result==NULL) {
- RETURN_TRUE; /* no recordset returned ...*/
- }
- else {
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
- }
-}
-/* }}} */
-
-/* {{{ proto int mssql_free_statement(resource result_index)
- Free a MS-SQL statement index */
-PHP_FUNCTION(mssql_free_statement)
-{
- zval **mssql_statement_index;
- mssql_statement *statement;
- int retvalue;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_statement_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(mssql_statement_index)==IS_RESOURCE && Z_LVAL_PP(mssql_statement_index)==0) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(statement, mssql_statement *, mssql_statement_index, -1, "MS SQL-statement", le_statement);
- /* Release remaining results */
- do {
- dbcanquery(statement->link->link);
- retvalue = dbresults(statement->link->link);
- } while (retvalue == SUCCEED);
-
- zend_list_delete(Z_RESVAL_PP(mssql_statement_index));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string mssql_guid_string(string binary [,int short_format])
- Converts a 16 byte binary GUID to a string */
-PHP_FUNCTION(mssql_guid_string)
-{
- zval **binary, **short_format;
- int sf = 0;
- char buffer[32+1];
- char buffer2[36+1];
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &binary)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(binary);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &binary, &short_format)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(binary);
- convert_to_long_ex(short_format);
- sf = Z_LVAL_PP(short_format);
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- dbconvert(NULL, SQLBINARY, (BYTE*)Z_STRVAL_PP(binary), 16, SQLCHAR, buffer, -1);
-
- if (sf) {
- php_strtoupper(buffer, 32);
- RETURN_STRING(buffer, 1);
- }
- else {
- int i;
- for (i=0; i<4; i++) {
- buffer2[2*i] = buffer[6-2*i];
- buffer2[2*i+1] = buffer[7-2*i];
- }
- buffer2[8] = '-';
- for (i=0; i<2; i++) {
- buffer2[9+2*i] = buffer[10-2*i];
- buffer2[10+2*i] = buffer[11-2*i];
- }
- buffer2[13] = '-';
- for (i=0; i<2; i++) {
- buffer2[14+2*i] = buffer[14-2*i];
- buffer2[15+2*i] = buffer[15-2*i];
- }
- buffer2[18] = '-';
- for (i=0; i<4; i++) {
- buffer2[19+i] = buffer[16+i];
- }
- buffer2[23] = '-';
- for (i=0; i<12; i++) {
- buffer2[24+i] = buffer[20+i];
- }
- buffer2[36] = 0;
-
- php_strtoupper(buffer2, 36);
- RETURN_STRING(buffer2, 1);
- }
-}
-/* }}} */
-
-#endif
diff --git a/ext/mssql/php_mssql.h b/ext/mssql/php_mssql.h
deleted file mode 100644
index 3da8c08c38..0000000000
--- a/ext/mssql/php_mssql.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Frank M. Kromann <frank@frontbase.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef PHP_MSSQL_H
-#define PHP_MSSQL_H
-
-
-#if HAVE_MSSQL
-#define MSDBLIB
-#ifdef PHP_WIN32
-#define PHP_MSSQL_API __declspec(dllexport)
-#else
-#define PHP_MSSQL_API
-#endif
-
-
-#define MSSQL_VERSION "7.0"
-#include "sqlfront.h"
-#include "sqldb.h"
-
-#if HAVE_FREETDS
-#define SQLTEXT SYBTEXT
-#define SQLCHAR SYBCHAR
-#define SQLVARCHAR SYBVARCHAR
-#define SQLINT1 SYBINT1
-#define SQLINT2 SYBINT2
-#define SQLINT4 SYBINT4
-#define SQLINTN SYBINTN
-#define SQLBIT SYBBIT
-#define SQLFLT4 SYBREAL
-#define SQLFLT8 SYBFLT8
-#define SQLFLTN SYBFLTN
-#define SQLDECIMAL SYBDECIMAL
-#define SQLNUMERIC SYBNUMERIC
-#define SQLDATETIME SYBDATETIME
-#define SQLDATETIM4 SYBDATETIME4
-#define SQLDATETIMN SYBDATETIMN
-#define SQLMONEY SYBMONEY
-#define SQLMONEY4 SYBMONEY4
-#define SQLMONEYN SYBMONEYN
-#define SQLIMAGE SYBIMAGE
-#define SQLBINARY SYBBINARY
-#define SQLVARBINARY SYBVARBINARY
-#define DBERRHANDLE(a, b) dberrhandle(b)
-#define DBMSGHANDLE(a, b) dbmsghandle(b)
-#define DBSETOPT(a, b, c) dbsetopt(a, b, c, -1)
-#define NO_MORE_RPC_RESULTS 3
-#define dbfreelogin dbloginfree
-#define dbrpcexec dbrpcsend
-typedef unsigned char *LPBYTE;
-typedef float DBFLT4;
-#else
-#define DBERRHANDLE(a, b) dbprocerrhandle(a, b)
-#define DBMSGHANDLE(a, b) dbprocmsghandle(a, b)
-#define EHANDLEFUNC DBERRHANDLE_PROC
-#define MHANDLEFUNC DBMSGHANDLE_PROC
-#define DBSETOPT(a, b, c) dbsetopt(a, b, c)
-#endif
-
-#define coltype(j) dbcoltype(mssql_ptr->link,j)
-#define intcol(i) ((int) *(DBINT *) dbdata(mssql_ptr->link,i))
-#define smallintcol(i) ((int) *(DBSMALLINT *) dbdata(mssql_ptr->link,i))
-#define tinyintcol(i) ((int) *(DBTINYINT *) dbdata(mssql_ptr->link,i))
-#define anyintcol(j) (coltype(j)==SQLINT4?intcol(j):(coltype(j)==SQLINT2?smallintcol(j):tinyintcol(j)))
-#define charcol(i) ((DBCHAR *) dbdata(mssql_ptr->link,i))
-#define floatcol4(i) (*(DBFLT4 *) dbdata(mssql_ptr->link,i))
-#define floatcol8(i) (*(DBFLT8 *) dbdata(mssql_ptr->link,i))
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-extern zend_module_entry mssql_module_entry;
-#define mssql_module_ptr &mssql_module_entry
-
-PHP_MINIT_FUNCTION(mssql);
-PHP_MSHUTDOWN_FUNCTION(mssql);
-PHP_RINIT_FUNCTION(mssql);
-PHP_RSHUTDOWN_FUNCTION(mssql);
-PHP_MINFO_FUNCTION(mssql);
-
-PHP_FUNCTION(mssql_connect);
-PHP_FUNCTION(mssql_pconnect);
-PHP_FUNCTION(mssql_close);
-PHP_FUNCTION(mssql_select_db);
-PHP_FUNCTION(mssql_query);
-PHP_FUNCTION(mssql_fetch_batch);
-PHP_FUNCTION(mssql_rows_affected);
-PHP_FUNCTION(mssql_free_result);
-PHP_FUNCTION(mssql_get_last_message);
-PHP_FUNCTION(mssql_num_rows);
-PHP_FUNCTION(mssql_num_fields);
-PHP_FUNCTION(mssql_fetch_field);
-PHP_FUNCTION(mssql_fetch_row);
-PHP_FUNCTION(mssql_fetch_array);
-PHP_FUNCTION(mssql_fetch_assoc);
-PHP_FUNCTION(mssql_fetch_object);
-PHP_FUNCTION(mssql_field_length);
-PHP_FUNCTION(mssql_field_name);
-PHP_FUNCTION(mssql_field_type);
-PHP_FUNCTION(mssql_data_seek);
-PHP_FUNCTION(mssql_field_seek);
-PHP_FUNCTION(mssql_result);
-PHP_FUNCTION(mssql_next_result);
-PHP_FUNCTION(mssql_min_error_severity);
-PHP_FUNCTION(mssql_min_message_severity);
-PHP_FUNCTION(mssql_init);
-PHP_FUNCTION(mssql_bind);
-PHP_FUNCTION(mssql_execute);
-PHP_FUNCTION(mssql_free_statement);
-PHP_FUNCTION(mssql_guid_string);
-
-typedef struct mssql_link {
- LOGINREC *login;
- DBPROCESS *link;
- int valid;
-} mssql_link;
-
-typedef struct mssql_statement {
- int id;
- mssql_link *link;
- HashTable *binds;
- int executed;
-} mssql_statement;
-
-typedef struct {
-
- zval *zval;
- /* TODO: more data for special types (BLOBS, NUMERIC...) */
-} mssql_bind;
-
-ZEND_BEGIN_MODULE_GLOBALS(mssql)
- long default_link;
- long num_links,num_persistent;
- long max_links,max_persistent;
- zend_bool allow_persistent;
- char *appname;
- char *server_message;
- long min_error_severity, min_message_severity;
- long cfg_min_error_severity, cfg_min_message_severity;
- long connect_timeout, timeout;
- zend_bool compatability_mode;
- void (*get_column_content)(mssql_link *mssql_ptr,int offset,pval *result,int column_type TSRMLS_DC);
- long textsize, textlimit, batchsize;
- zend_bool datetimeconvert;
- HashTable *resource_list, *resource_plist;
- zend_bool secure_connection;
- long max_procs;
-ZEND_END_MODULE_GLOBALS(mssql)
-
-#define MSSQL_ROWS_BLOCK 128
-
-typedef struct mssql_field {
- char *name,*column_source;
- long max_length;
- int numeric;
- int type;
-} mssql_field;
-
-typedef struct mssql_result {
- pval **data;
- mssql_field *fields;
- mssql_link *mssql_ptr;
- mssql_statement * statement;
- int batchsize;
- int lastresult;
- int blocks_initialized;
- int cur_row,cur_field;
- int num_rows,num_fields;
-} mssql_result;
-
-
-#ifdef ZTS
-# define MS_SQL_G(v) TSRMG(mssql_globals_id, zend_mssql_globals *, v)
-#else
-# define MS_SQL_G(v) (mssql_globals.v)
-#endif
-
-#else
-
-#define mssql_module_ptr NULL
-
-#endif /* HAVE_MSSQL */
-
-#define phpext_mssql_ptr mssql_module_ptr
-
-#endif /* PHP_MSSQL_H */
diff --git a/ext/mysql/CREDITS b/ext/mysql/CREDITS
deleted file mode 100644
index e5a6208bab..0000000000
--- a/ext/mysql/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-MySQL
-Zeev Suraski, Zak Greant, Georg Richter
diff --git a/ext/mysql/config.m4 b/ext/mysql/config.m4
deleted file mode 100644
index 95c40b8982..0000000000
--- a/ext/mysql/config.m4
+++ /dev/null
@@ -1,160 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-sinclude(ext/mysql/libmysql/acinclude.m4)
-sinclude(ext/mysql/libmysql/mysql.m4)
-sinclude(libmysql/acinclude.m4)
-sinclude(libmysql/mysql.m4)
-
-AC_DEFUN(MYSQL_LIB_CHK, [
- str="$MYSQL_DIR/$1/libmysqlclient.*"
- for j in `echo $str`; do
- if test -r $j; then
- MYSQL_LIB_DIR=$MYSQL_DIR/$1
- break 2
- fi
- done
-])
-
-AC_DEFUN(PHP_MYSQL_SOCKET_SEARCH, [
- for i in \
- /var/run/mysqld/mysqld.sock \
- /var/tmp/mysql.sock \
- /var/run/mysql/mysql.sock \
- /var/lib/mysql/mysql.sock \
- /var/mysql/mysql.sock \
- /usr/local/mysql/var/mysql.sock \
- /Private/tmp/mysql.sock \
- /tmp/mysql.sock \
- ; do
- if test -r $i; then
- MYSQL_SOCK=$i
- break 2
- fi
- done
-
- if test -n "$MYSQL_SOCK"; then
- AC_DEFINE_UNQUOTED(MYSQL_UNIX_ADDR, "$MYSQL_SOCK", [ ])
- AC_MSG_RESULT([$MYSQL_SOCK])
- else
- AC_MSG_RESULT([no])
- fi
-])
-
-
-PHP_ARG_WITH(mysql, for MySQL support,
-[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base directory.
- If unspecified, the bundled MySQL library will be used.], yes)
-
-PHP_ARG_WITH(mysql-sock, for specified location of the MySQL UNIX socket,
-[ --with-mysql-sock[=DIR] MySQL: Location of the MySQL unix socket pointer.
- If unspecified, the default locations are searched.], no, no)
-
-if test -z "$PHP_ZLIB_DIR"; then
- PHP_ARG_WITH(zlib-dir, for the location of libz,
- [ --with-zlib-dir[=DIR] MySQL: Set the path to libz install prefix.], no, no)
-fi
-
-
-if test "$PHP_MYSQL" != "no"; then
- AC_DEFINE(HAVE_MYSQL, 1, [Whether you have MySQL])
-
- AC_MSG_CHECKING(for MySQL UNIX socket location)
- if test "$PHP_MYSQL_SOCK" != "no" && test "$PHP_MYSQL_SOCK" != "yes"; then
- MYSQL_SOCK=$PHP_MYSQL_SOCK
- AC_DEFINE_UNQUOTED(MYSQL_UNIX_ADDR, "$MYSQL_SOCK", [ ])
- AC_MSG_RESULT([$MYSQL_SOCK])
- elif test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL_SOCK" = "yes"; then
- PHP_MYSQL_SOCKET_SEARCH
- else
- AC_MSG_RESULT([no])
- fi
-fi
-
-if test "$PHP_MYSQL" = "yes"; then
- MYSQL_MODULE_TYPE=builtin
- MYSQL_CHECKS
- sources="libmysql/libmysql.c libmysql/errmsg.c libmysql/net.c libmysql/violite.c libmysql/password.c \
- libmysql/my_init.c libmysql/my_lib.c libmysql/my_static.c libmysql/my_malloc.c libmysql/my_realloc.c libmysql/my_create.c \
- libmysql/my_delete.c libmysql/my_tempnam.c libmysql/my_open.c libmysql/mf_casecnv.c libmysql/my_read.c \
- libmysql/my_write.c libmysql/errors.c libmysql/my_error.c libmysql/my_getwd.c libmysql/my_div.c libmysql/mf_pack.c \
- libmysql/my_messnc.c libmysql/mf_dirname.c libmysql/mf_fn_ext.c libmysql/mf_wcomp.c libmysql/typelib.c libmysql/safemalloc.c \
- libmysql/my_alloc.c libmysql/mf_format.c libmysql/mf_path.c libmysql/mf_unixpath.c libmysql/my_fopen.c libmysql/mf_loadpath.c \
- libmysql/my_pthread.c libmysql/my_thr_init.c libmysql/thr_mutex.c libmysql/mulalloc.c libmysql/string.c libmysql/default.c \
- libmysql/my_compress.c libmysql/array.c libmysql/my_once.c libmysql/list.c libmysql/my_net.c libmysql/dbug.c \
- libmysql/strmov.c libmysql/strxmov.c libmysql/strnmov.c libmysql/strmake.c libmysql/strend.c libmysql/strfill.c \
- libmysql/is_prefix.c libmysql/int2str.c libmysql/str2int.c libmysql/strinstr.c \
- libmysql/strcont.c libmysql/strcend.c libmysql/bchange.c libmysql/bmove.c libmysql/bmove_upp.c \
- libmysql/longlong2str.c libmysql/strtoull.c libmysql/strtoll.c libmysql/charset.c libmysql/ctype.c"
-
- PHP_NEW_EXTENSION(mysql, php_mysql.c $sources, $ext_shared,,-I@ext_srcdir@/libmysql)
- PHP_ADD_BUILD_DIR($ext_builddir/libmysql)
-
-elif test "$PHP_MYSQL" != "no"; then
-
- MYSQL_TYPE_CHECKS
-
- PHP_NEW_EXTENSION(mysql, php_mysql.c, $ext_shared)
-
- for i in $PHP_MYSQL; do
- if test -r $i/include/mysql/mysql.h; then
- MYSQL_DIR=$i
- MYSQL_INC_DIR=$i/include/mysql
- elif test -r $i/include/mysql.h; then
- MYSQL_DIR=$i
- MYSQL_INC_DIR=$i/include
- fi
- done
-
- if test -z "$MYSQL_DIR"; then
- AC_MSG_ERROR(Cannot find MySQL header files under $PHP_MYSQL)
- fi
-
- MYSQL_MODULE_TYPE=external
-
- for i in lib lib/mysql; do
- MYSQL_LIB_CHK($i)
- done
-
- if test -z "$MYSQL_LIB_DIR"; then
- AC_MSG_ERROR(Cannot find mysqlclient library under $MYSQL_DIR)
- fi
-
- PHP_CHECK_LIBRARY(mysqlclient, mysql_close, [ ],
- [
- if test "$PHP_ZLIB_DIR" != "no"; then
- PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR, MYSQL_SHARED_LIBADD)
- PHP_CHECK_LIBRARY(mysqlclient, mysql_error, [], [
- AC_MSG_ERROR([mysql configure failed. Please check config.log for more information.])
- ], [
- -L$PHP_ZLIB_DIR/lib -L$MYSQL_LIB_DIR
- ])
- MYSQL_LIBS="-L$PHP_ZLIB_DIR/lib -lz"
- else
- PHP_ADD_LIBRARY(z,, MYSQL_SHARED_LIBADD)
- PHP_CHECK_LIBRARY(mysqlclient, mysql_errno, [], [
- AC_MSG_ERROR([Try adding --with-zlib-dir=<DIR>. Please check config.log for more information.])
- ], [
- -L$MYSQL_LIB_DIR
- ])
- MYSQL_LIBS="-lz"
- fi
- ], [
- -L$MYSQL_LIB_DIR
- ])
-
- PHP_ADD_LIBRARY_WITH_PATH(mysqlclient, $MYSQL_LIB_DIR, MYSQL_SHARED_LIBADD)
- MYSQL_LIBS="-L$MYSQL_LIB_DIR -lmysqlclient $MYSQL_LIBS"
-
- PHP_ADD_INCLUDE($MYSQL_INC_DIR)
- MYSQL_INCLUDE=-I$MYSQL_INC_DIR
-
-else
- MYSQL_MODULE_TYPE=none
-fi
-
-PHP_SUBST(MYSQL_SHARED_LIBADD)
-PHP_SUBST_OLD(MYSQL_MODULE_TYPE)
-PHP_SUBST_OLD(MYSQL_LIBS)
-PHP_SUBST_OLD(MYSQL_INCLUDE)
diff --git a/ext/mysql/libmysql/acinclude.m4 b/ext/mysql/libmysql/acinclude.m4
deleted file mode 100644
index 1f2b42649d..0000000000
--- a/ext/mysql/libmysql/acinclude.m4
+++ /dev/null
@@ -1,382 +0,0 @@
-# Local macros for automake & autoconf
-
-AC_DEFUN(MYSQL_FUNCTION_CHECKS,[
-
-# Standard MySQL list
-AC_CHECK_FUNCS(alarm bmove \
- chsize ftruncate rint finite fpsetmask fpresetsticky\
- cuserid fcntl fconvert \
- getrusage getpwuid getcwd getrlimit getwd index locking longjmp \
- perror pread realpath rename \
- socket strnlen madvise \
- strtoll strtoul strtoull snprintf tempnam thr_setconcurrency \
- gethostbyaddr_r gethostbyname_r getpwnam \
- bfill bzero bcmp strstr strpbrk strerror\
- tell atod memcpy memmove \
- setupterm strcasecmp sighold \
- vidattr setupterm lrand48 localtime_r \
- sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \
- pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \
- pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
- pthread_condattr_create rwlock_init \
- crypt dlopen dlerror fchmod getpass getpassphrase)
-
-# This is special for libmysql
-AC_CHECK_FUNCS(strtok_r)
-
-MYSQL_CHECK_GETHOSTNAME_R
-])
-
-AC_DEFUN(MYSQL_CHECK_GETHOSTNAME_R,[
-# Check definition of gethostbyname_r (glibc2.0.100 is different from Solaris)
-ac_save_CXXFLAGS="$CXXFLAGS"
-AC_CACHE_CHECK([style of gethostname_r routines], mysql_cv_gethostname_style,
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-if test "$ac_cv_prog_gxx" = "yes"
-then
- CXXFLAGS="$CXXFLAGS -Werror"
-fi
-AC_TRY_COMPILE(
-[#if !defined(SCO) && !defined(__osf__)
-#define _REENTRANT
-#endif
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>],
-[int skr;
-
- skr = gethostbyname_r((const char *) 0,
- (struct hostent*) 0, (char*) 0, 0, (struct hostent **) 0, &skr);],
-mysql_cv_gethostname_style=glibc2, mysql_cv_gethostname_style=other))
-AC_LANG_RESTORE
-CXXFLAGS="$ac_save_CXXFLAGS"
-if test "$mysql_cv_gethostname_style" = "glibc2"
-then
- AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE, , [ ])
-fi
-
-# Check 3rd argument of getthostbyname_r
-ac_save_CXXFLAGS="$CXXFLAGS"
-AC_CACHE_CHECK([3 argument to gethostname_r routines], mysql_cv_gethostname_arg,
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-if test "$ac_cv_prog_gxx" = "yes"
-then
- CXXFLAGS="$CXXFLAGS -Werror"
-fi
-AC_TRY_COMPILE(
-[#if !defined(SCO) && !defined(__osf__)
-#define _REENTRANT
-#endif
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>],
-[int skr;
-
- skr = gethostbyname_r((const char *) 0, (struct hostent*) 0, (hostent_data*) 0);],
-mysql_cv_gethostname_arg=hostent_data, mysql_cv_gethostname_arg=char))
-AC_LANG_RESTORE
-CXXFLAGS="$ac_save_CXXFLAGS"
-if test "$mysql_cv_gethostname_arg" = "hostent_data"
-then
- AC_DEFINE(HAVE_GETHOSTBYNAME_R_RETURN_INT, , [ ])
-fi
-])
-
-AC_DEFUN(MYSQL_CHECK_SIGWAIT_STYLE,[
-# Check definition av posix sigwait()
-AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
-AC_TRY_LINK(
-[#ifndef SCO
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h>
-#include <signal.h>],
-[#ifndef _AIX
-sigset_t set;
-int sig;
-sigwait(&set,&sig);
-#endif],
-mysql_cv_sigwait=POSIX, mysql_cv_sigwait=other))
-if test "$mysql_cv_sigwait" = "POSIX"
-then
- AC_DEFINE(HAVE_SIGWAIT,,[ ])
-fi
-
-if test "$mysql_cv_sigwait" != "POSIX"
-then
-unset mysql_cv_sigwait
-# Check definition av posix sigwait()
-AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
-AC_TRY_LINK(
-[#ifndef SCO
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h>
-#include <signal.h>],
-[sigset_t set;
-int sig;
-sigwait(&set);],
-mysql_cv_sigwait=NONPOSIX, mysql_cv_sigwait=other))
-if test "$mysql_cv_sigwait" = "NONPOSIX"
-then
- AC_DEFINE(HAVE_NONPOSIX_SIGWAIT,,[ ])
-fi
-fi
-])
-
-AC_DEFUN(MYSQL_CHECK_READDIR_R_ARGS,[
-# Check definition of readdir_r
-AC_CACHE_CHECK("args to readdir_r", mysql_cv_readdir_r,
-AC_TRY_LINK(
-[#ifndef SCO
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h>
-#include <dirent.h>],
-[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
-readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ],
-mysql_cv_readdir_r=POSIX, mysql_cv_readdir_r=other))
-if test "$mysql_cv_readdir_r" = "POSIX"
-then
- AC_DEFINE(HAVE_READDIR_R,,[ ])
-fi
-])
-
-AC_DEFUN(MYSQL_CHECK_PTHREAD_MUTEX_INIT,[
- # Check definition of pthread_mutex_init
- AC_CACHE_CHECK("args to pthread_mutex_init", mysql_cv_mutex_init_args,
- AC_TRY_COMPILE(
-[#ifndef SCO
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h> ],
-[
- pthread_mutexattr_t attr;
- pthread_mutex_t mp;
- pthread_mutex_init(&mp,&attr); ],
-mysql_cv_mutex_init_args=POSIX, mysql_cv_mutex_init_args=other))
- if test "$mysql_cv_mutex_init_args" = "other"
- then
- AC_DEFINE(HAVE_NONPOSIX_PTHREAD_MUTEX_INIT,,[ ])
- fi
-])
-
-AC_DEFUN(MYSQL_CHECK_PTHREAD_GETSPECIFIC,[
- # Check definition of pthread_getspecific
- AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
- AC_TRY_COMPILE(
-[#ifndef SCO
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h> ],
-[ void *pthread_getspecific(pthread_key_t key);
-pthread_getspecific((pthread_key_t) NULL); ],
-mysql_cv_getspecific_args=POSIX, mysql_cv_getspecific_args=other))
- if test "$mysql_cv_getspecific_args" = "other"
- then
- AC_DEFINE(HAVE_NONPOSIX_PTHREAD_GETSPECIFIC,,[ ])
- fi
-])
-
-AC_DEFUN(MYSQL_TYPE_ACCEPT,
-[ac_save_CXXFLAGS="$CXXFLAGS"
-AC_CACHE_CHECK([base type of last arg to accept], mysql_cv_btype_last_arg_accept,
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-if test "$ac_cv_prog_gxx" = "yes"
-then
- CXXFLAGS="$CXXFLAGS -Werror"
-fi
-mysql_cv_btype_last_arg_accept=none
-[AC_TRY_COMPILE([#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-],
-[int a = accept(1, (struct sockaddr *) 0, (socklen_t *) 0);],
-mysql_cv_btype_last_arg_accept=socklen_t)]
-if test $mysql_cv_btype_last_arg_accept = none; then
-[AC_TRY_COMPILE([#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-],
-[int a = accept(1, (struct sockaddr *) 0, (size_t *) 0);],
-mysql_cv_btype_last_arg_accept=size_t)]
-fi
-if test $mysql_cv_btype_last_arg_accept = none; then
-mysql_cv_btype_last_arg_accept=int
-fi)
-AC_LANG_RESTORE
-AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $mysql_cv_btype_last_arg_accept,[ ])
-CXXFLAGS="$ac_save_CXXFLAGS"
-])
-
-dnl Find type of qsort
-AC_DEFUN(MYSQL_TYPE_QSORT,
-[AC_CACHE_CHECK([return type of qsort], mysql_cv_type_qsort,
-[AC_TRY_COMPILE([#include <stdlib.h>
-#ifdef __cplusplus
-extern "C"
-#endif
-void qsort(void *base, size_t nel, size_t width,
- int (*compar) (const void *, const void *));
-],
-[int i;], mysql_cv_type_qsort=void, mysql_cv_type_qsort=int)])
-AC_DEFINE_UNQUOTED(RETQSORTTYPE, $mysql_cv_type_qsort, [ ])
-if test "$mysql_cv_type_qsort" = "void"
-then
- AC_DEFINE_UNQUOTED(QSORT_TYPE_IS_VOID, 1, [ ])
-fi
-])
-
-
-#---START: Used in for client configure
-AC_DEFUN(MYSQL_CHECK_ULONG,
-[AC_MSG_CHECKING(for type ulong)
-AC_CACHE_VAL(ac_cv_ulong,
-[AC_TRY_RUN([#include <stdio.h>
-#include <sys/types.h>
-main()
-{
- ulong foo;
- foo++;
- exit(0);
-}], ac_cv_ulong=yes, ac_cv_ulong=no, ac_cv_ulong=no)])
-AC_MSG_RESULT($ac_cv_ulong)
-if test "$ac_cv_ulong" = "yes"
-then
- AC_DEFINE(HAVE_ULONG,,[ ])
-fi
-])
-
-AC_DEFUN(MYSQL_CHECK_UCHAR,
-[AC_MSG_CHECKING(for type uchar)
-AC_CACHE_VAL(ac_cv_uchar,
-[AC_TRY_RUN([#include <stdio.h>
-#include <sys/types.h>
-main()
-{
- uchar foo;
- foo++;
- exit(0);
-}], ac_cv_uchar=yes, ac_cv_uchar=no, ac_cv_uchar=no)])
-AC_MSG_RESULT($ac_cv_uchar)
-if test "$ac_cv_uchar" = "yes"
-then
- AC_DEFINE(HAVE_UCHAR,,[ ])
-fi
-])
-
-AC_DEFUN(MYSQL_CHECK_UINT,
-[AC_MSG_CHECKING(for type uint)
-AC_CACHE_VAL(ac_cv_uint,
-[AC_TRY_RUN([#include <stdio.h>
-#include <sys/types.h>
-main()
-{
- uint foo;
- foo++;
- exit(0);
-}], ac_cv_uint=yes, ac_cv_uint=no, ac_cv_uint=no)])
-AC_MSG_RESULT($ac_cv_uint)
-if test "$ac_cv_uint" = "yes"
-then
- AC_DEFINE(HAVE_UINT,,[ ])
-fi
-])
-
-AC_DEFUN(MYSQL_CHECK_USHORT,
-[AC_MSG_CHECKING(for type ushort)
-AC_CACHE_VAL(ac_cv_ushort,
-[AC_TRY_RUN([#include <stdio.h>
-#include <sys/types.h>
-main()
-{
- ushort foo;
- foo++;
- exit(0);
-}], ac_cv_ushort=yes, ac_cv_ushort=no, ac_cv_ushort=no)])
-AC_MSG_RESULT($ac_cv_ushort)
-if test "$ac_cv_ushort" = "yes"
-then
- AC_DEFINE(HAVE_USHORT,,[ ])
-fi
-])
-
-AC_DEFUN(MYSQL_CHECK_INT_8_16_32,
-[AC_MSG_CHECKING([for int8])
-AC_CACHE_VAL(ac_cv_int8,
-[AC_TRY_RUN([
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef HAVE_STDDEF_H
-#include <stddef.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-int main()
-{
- int8 i;
- return 0;
-}
-], ac_cv_int8=yes, ac_cv_int8=no, ac_cv_int8=no)])
-AC_MSG_RESULT($ac_cv_int8)
-if test "$ac_cv_int8" = "yes"
-then
- AC_DEFINE(HAVE_INT_8_16_32,,[ ])
-fi
-])
-
-
-AC_DEFUN(MYSQL_HEADER_CHECKS,[
-AC_HEADER_STDC
-AC_CHECK_HEADERS(sgtty.h sys/ioctl.h \
- fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
- memory.h pwd.h select.h \
- stdlib.h stddef.h \
- strings.h string.h synch.h sys/mman.h sys/socket.h \
- sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
- unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h)
-])
-
-AC_DEFUN(MYSQL_TYPE_CHECKS,[
-
-AC_REQUIRE([AC_C_CONST])
-AC_REQUIRE([AC_C_INLINE])
-AC_CHECK_SIZEOF(char, 1)
-
-AC_CHECK_SIZEOF(int, 4)
-AC_CHECK_SIZEOF(long, 4)
-AC_CHECK_SIZEOF(long long, 8)
-AC_TYPE_SIZE_T
-AC_HEADER_TIME
-AC_TYPE_UID_T
-
-MYSQL_CHECK_ULONG
-MYSQL_CHECK_UCHAR
-MYSQL_CHECK_UINT
-MYSQL_CHECK_USHORT
-MYSQL_CHECK_INT_8_16_32
-
-MYSQL_TYPE_ACCEPT
-MYSQL_TYPE_QSORT
-
-AC_REQUIRE([AC_TYPE_SIGNAL])
-])
diff --git a/ext/mysql/libmysql/array.c b/ext/mysql/libmysql/array.c
deleted file mode 100644
index dcf1cb07b4..0000000000
--- a/ext/mysql/libmysql/array.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Handling of arrays that can grow dynamicly. */
-
-#if defined(WIN32) || defined(__WIN__)
-#undef SAFEMALLOC /* Problems with threads */
-#endif
-
-#include "mysys_priv.h"
-#include "m_string.h"
-
-/*
- Initiate array and alloc space for init_alloc elements. Array is usable
- even if space allocation failed
-*/
-
-my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
- uint init_alloc, uint alloc_increment)
-{
- DBUG_ENTER("init_dynamic_array");
- if (!alloc_increment)
- {
- alloc_increment=max((8192-MALLOC_OVERHEAD)/element_size,16);
- if (init_alloc > 8 && alloc_increment > init_alloc * 2)
- alloc_increment=init_alloc*2;
- }
-
- if (!init_alloc)
- init_alloc=alloc_increment;
- array->elements=0;
- array->max_element=init_alloc;
- array->alloc_increment=alloc_increment;
- array->size_of_element=element_size;
- if (!(array->buffer=(char*) my_malloc(element_size*init_alloc,MYF(MY_WME))))
- {
- array->max_element=0;
- DBUG_RETURN(TRUE);
- }
- DBUG_RETURN(FALSE);
-}
-
-
-my_bool insert_dynamic(DYNAMIC_ARRAY *array, gptr element)
-{
- gptr buffer;
- if (array->elements == array->max_element)
- { /* Call only when nessesary */
- if (!(buffer=alloc_dynamic(array)))
- return TRUE;
- }
- else
- {
- buffer=array->buffer+(array->elements * array->size_of_element);
- array->elements++;
- }
- memcpy(buffer,element,(size_t) array->size_of_element);
- return FALSE;
-}
-
-
- /* Alloc room for one element */
-
-byte *alloc_dynamic(DYNAMIC_ARRAY *array)
-{
- if (array->elements == array->max_element)
- {
- char *new_ptr;
- if (!(new_ptr=(char*) my_realloc(array->buffer,(array->max_element+
- array->alloc_increment)*
- array->size_of_element,
- MYF(MY_WME | MY_ALLOW_ZERO_PTR))))
- return 0;
- array->buffer=new_ptr;
- array->max_element+=array->alloc_increment;
- }
- return array->buffer+(array->elements++ * array->size_of_element);
-}
-
-
- /* remove last element from array and return it */
-
-byte *pop_dynamic(DYNAMIC_ARRAY *array)
-{
- if (array->elements)
- return array->buffer+(--array->elements * array->size_of_element);
- return 0;
-}
-
-
-my_bool set_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
-{
- if (idx >= array->elements)
- {
- if (idx >= array->max_element)
- {
- uint size;
- char *new_ptr;
- size=(idx+array->alloc_increment)/array->alloc_increment;
- size*= array->alloc_increment;
- if (!(new_ptr=(char*) my_realloc(array->buffer,size*
- array->size_of_element,
- MYF(MY_WME | MY_ALLOW_ZERO_PTR))))
- return TRUE;
- array->buffer=new_ptr;
- array->max_element=size;
- }
- bzero((gptr) (array->buffer+array->elements*array->size_of_element),
- (idx - array->elements)*array->size_of_element);
- array->elements=idx+1;
- }
- memcpy(array->buffer+(idx * array->size_of_element),element,
- (size_t) array->size_of_element);
- return FALSE;
-}
-
-
-void get_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
-{
- if (idx >= array->elements)
- {
- DBUG_PRINT("warning",("To big array idx: %d, array size is %d",
- idx,array->elements));
- bzero(element,array->size_of_element);
- return;
- }
- memcpy(element,array->buffer+idx*array->size_of_element,
- (size_t) array->size_of_element);
-}
-
-
-void delete_dynamic(DYNAMIC_ARRAY *array)
-{
- if (array->buffer)
- {
- my_free(array->buffer,MYF(MY_WME));
- array->buffer=0;
- array->elements=array->max_element=0;
- }
-}
-
-
-void delete_dynamic_element(DYNAMIC_ARRAY *array, uint idx)
-{
- char *ptr=array->buffer+array->size_of_element*idx;
- array->elements--;
- memmove(ptr,ptr+array->size_of_element,
- (array->elements-idx)*array->size_of_element);
-}
-
-
-void freeze_size(DYNAMIC_ARRAY *array)
-{
- uint elements=max(array->elements,1);
-
- if (array->buffer && array->max_element != elements)
- {
- array->buffer=(char*) my_realloc(array->buffer,
- elements*array->size_of_element,
- MYF(MY_WME));
- array->max_element=elements;
- }
-}
diff --git a/ext/mysql/libmysql/bchange.c b/ext/mysql/libmysql/bchange.c
deleted file mode 100644
index 95d363d52d..0000000000
--- a/ext/mysql/libmysql/bchange.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : bchange.c
- Author : Michael widenius
- Updated: 1987-03-20
- Defines: bchange()
-
- bchange(dst, old_length, src, new_length, tot_length)
- replaces old_length characters at dst to new_length characters from
- src in a buffer with tot_length bytes.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-void bchange(register char *dst, uint old_length, register const char *src, uint new_length, uint tot_length)
-{
- uint rest=tot_length-old_length;
- if (old_length < new_length)
- bmove_upp(dst+rest+new_length,dst+tot_length,rest);
- else
- bmove(dst+new_length,dst+old_length,rest);
- memcpy(dst,src,new_length);
-}
diff --git a/ext/mysql/libmysql/bmove.c b/ext/mysql/libmysql/bmove.c
deleted file mode 100644
index f63ff0bd4f..0000000000
--- a/ext/mysql/libmysql/bmove.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* File : bmove.c
- Author : Richard A. O'Keefe.
- Michael Widenius; ifdef MC68000
- Updated: 23 April 1984
- Defines: bmove()
-
- bmove(dst, src, len) moves exactly "len" bytes from the source "src"
- to the destination "dst". It does not check for NUL characters as
- strncpy() and strnmov() do. Thus if your C compiler doesn't support
- structure assignment, you can simulate it with
- bmove(&to, &from, sizeof from);
- The standard 4.2bsd routine for this purpose is bcopy. But as bcopy
- has its first two arguments the other way around you may find this a
- bit easier to get right.
- No value is returned.
-
- Note: the "b" routines are there to exploit certain VAX order codes,
- but the MOVC3 instruction will only move 65535 characters. The asm
- code is presented for your interest and amusement.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-#if !defined(HAVE_BMOVE) && !defined(bmove)
-
-#if VaxAsm
-
-void bmove(dst, src, len)
- char *dst, *src;
- uint len;
- {
- asm("movc3 12(ap),*8(ap),*4(ap)");
- }
-
-#else
-#if defined(MC68000) && defined(DS90)
-
-void bmove(dst, src, len)
-char *dst,*src;
-uint len; /* 0 <= len <= 65535 */
-{
-asm(" movl 12(a7),d0 ");
-asm(" subql #1,d0 ");
-asm(" blt .L5 ");
-asm(" movl 4(a7),a1 ");
-asm(" movl 8(a7),a0 ");
-asm(".L4: movb (a0)+,(a1)+ ");
-asm(" dbf d0,.L4 ");
-asm(".L5: ");
-}
-#else
-
-void bmove(dst, src, len)
-register char *dst;
-register const char *src;
-register uint len;
-{
- while (len-- != 0) *dst++ = *src++;
-}
-#endif
-#endif
-#endif
diff --git a/ext/mysql/libmysql/bmove_upp.c b/ext/mysql/libmysql/bmove_upp.c
deleted file mode 100644
index e10f6978f7..0000000000
--- a/ext/mysql/libmysql/bmove_upp.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : bmove.c
- Author : Michael widenius
- Updated: 1987-03-20
- Defines: bmove_upp()
-
- bmove_upp(dst, src, len) moves exactly "len" bytes from the source
- "src-len" to the destination "dst-len" counting downwards.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-#if defined(MC68000) && defined(DS90)
-
-/* 0 <= len <= 65535 */
-void bmove_upp(byte *dst, const byte *src,uint len)
-{
-asm(" movl 12(a7),d0 ");
-asm(" subql #1,d0 ");
-asm(" blt .L5 ");
-asm(" movl 4(a7),a1 ");
-asm(" movl 8(a7),a0 ");
-asm(".L4: movb -(a0),-(a1) ");
-asm(" dbf d0,.L4 ");
-asm(".L5: ");
-}
-#else
-
-void bmove_upp(register char *dst, register const char *src, register uint len)
-{
- while (len-- != 0) *--dst = *--src;
-}
-
-#endif
diff --git a/ext/mysql/libmysql/charset.c b/ext/mysql/libmysql/charset.c
deleted file mode 100644
index 29df5c5bdf..0000000000
--- a/ext/mysql/libmysql/charset.c
+++ /dev/null
@@ -1,550 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-#include <m_ctype.h>
-#include <m_string.h>
-#include <my_dir.h>
-
-typedef struct cs_id_st {
- char *name;
- uint number;
-} CS_ID;
-
-const char *charsets_dir = NULL;
-static DYNAMIC_ARRAY cs_info_table;
-static CS_ID **available_charsets;
-static int charset_initialized=0;
-
-#define MAX_LINE 1024
-
-#define CTYPE_TABLE_SIZE 257
-#define TO_LOWER_TABLE_SIZE 256
-#define TO_UPPER_TABLE_SIZE 256
-#define SORT_ORDER_TABLE_SIZE 256
-
-struct simpleconfig_buf_st {
- FILE *f;
- char buf[MAX_LINE];
- char *p;
-};
-
-/* Defined in strings/ctype.c */
-
-CHARSET_INFO *find_compiled_charset(uint cs_number);
-uint compiled_charset_number(const char *name);
-const char *compiled_charset_name(uint charset_number);
-
-
-static uint num_from_csname(CS_ID **cs, const char *name)
-{
- CS_ID **c;
- for (c = cs; *c; ++c)
- if (!strcmp((*c)->name, name))
- return (*c)->number;
- return 0; /* this mimics find_type() */
-}
-
-static char *name_from_csnum(CS_ID **cs, uint number)
-{
- CS_ID **c;
- if(cs)
- for (c = cs; *c; ++c)
- if ((*c)->number == number)
- return (*c)->name;
- return (char*) "?"; /* this mimics find_type() */
-}
-
-static my_bool get_word(struct simpleconfig_buf_st *fb, char *buf)
-{
- char *endptr=fb->p;
-
- for (;;)
- {
- while (isspace(*endptr))
- ++endptr;
- if (*endptr && *endptr != '#') /* Not comment */
- break; /* Found something */
- if ((fgets(fb->buf, sizeof(fb->buf), fb->f)) == NULL)
- return TRUE; /* end of file */
- endptr = fb->buf;
- }
-
- while (!isspace(*endptr))
- *buf++= *endptr++;
- *buf=0;
- fb->p = endptr;
-
- return FALSE;
-}
-
-
-char *get_charsets_dir(char *buf)
-{
- const char *sharedir = SHAREDIR;
- DBUG_ENTER("get_charsets_dir");
-
- if (charsets_dir != NULL)
- strmake(buf, charsets_dir, FN_REFLEN-1);
- else
- {
- if (test_if_hard_path(sharedir) ||
- is_prefix(sharedir, DEFAULT_CHARSET_HOME))
- strxmov(buf, sharedir, "/", CHARSET_DIR, NullS);
- else
- strxmov(buf, DEFAULT_CHARSET_HOME, "/", sharedir, "/", CHARSET_DIR,
- NullS);
- }
- convert_dirname(buf);
- DBUG_PRINT("info",("charsets dir='%s'", buf));
- DBUG_RETURN(strend(buf));
-}
-
-
-static my_bool read_charset_index(CS_ID ***charsets, myf myflags)
-{
- struct simpleconfig_buf_st fb;
- char buf[MAX_LINE], num_buf[MAX_LINE];
- DYNAMIC_ARRAY cs;
- CS_ID *csid;
-
- strmov(get_charsets_dir(buf), "Index");
-
- if ((fb.f = my_fopen(buf, O_RDONLY, myflags)) == NULL)
- return TRUE;
- fb.buf[0] = '\0';
- fb.p = fb.buf;
-
- if (init_dynamic_array(&cs, sizeof(CS_ID *), 32, 32))
- return TRUE;
-
- while (!get_word(&fb, buf) && !get_word(&fb, num_buf))
- {
- uint csnum;
- uint length;
-
- if (!(csnum = atoi(num_buf)))
- {
- /* corrupt Index file */
- my_fclose(fb.f,myflags);
- return TRUE;
- }
-
- if (!(csid = (CS_ID*) my_once_alloc(sizeof(CS_ID), myflags)) ||
- !(csid->name=
- (char*) my_once_alloc(length= (uint) strlen(buf)+1, myflags)))
- {
- my_fclose(fb.f,myflags);
- return TRUE;
- }
- memcpy(csid->name,buf,length);
- csid->number = csnum;
-
- insert_dynamic(&cs, (gptr) &csid);
- }
- my_fclose(fb.f,myflags);
-
-
- if (!(*charsets =
- (CS_ID **) my_once_alloc((cs.elements + 1) * sizeof(CS_ID *), myflags)))
- return TRUE;
- /* unwarranted chumminess with dynamic_array implementation? */
- memcpy((byte *) *charsets, cs.buffer, cs.elements * sizeof(CS_ID *));
- (*charsets)[cs.elements] = NULL;
- delete_dynamic(&cs);
-
- return FALSE;
-}
-
-
-static my_bool init_available_charsets(myf myflags)
-{
- my_bool error=0;
- /*
- We have to use charset_initialized to not lock on THR_LOCK_charset
- inside get_internal_charset...
- */
- if (!charset_initialized)
- {
- /*
- To make things thread safe we are not allowing other threads to interfere
- while we may changing the cs_info_table
- */
- pthread_mutex_lock(&THR_LOCK_charset);
- if (!cs_info_table.buffer) /* If not initialized */
- {
- init_dynamic_array(&cs_info_table, sizeof(CHARSET_INFO*), 16, 8);
- error = read_charset_index(&available_charsets, myflags);
- }
- charset_initialized=1;
- pthread_mutex_unlock(&THR_LOCK_charset);
- }
- if(!available_charsets || !available_charsets[0])
- error = TRUE;
- return error;
-}
-
-
-void free_charsets(void)
-{
- delete_dynamic(&cs_info_table);
-}
-
-
-static my_bool fill_array(uchar *array, int sz, struct simpleconfig_buf_st *fb)
-{
- char buf[MAX_LINE];
- while (sz--)
- {
- if (get_word(fb, buf))
- {
- DBUG_PRINT("error",("get_word failed, expecting %d more words", sz + 1));
- return 1;
- }
- *array++ = (uchar) strtol(buf, NULL, 16);
- }
- return 0;
-}
-
-
-static void get_charset_conf_name(uint cs_number, char *buf)
-{
- strxmov(get_charsets_dir(buf),
- name_from_csnum(available_charsets, cs_number), ".conf", NullS);
-}
-
-
-static my_bool read_charset_file(uint cs_number, CHARSET_INFO *set,
- myf myflags)
-{
- struct simpleconfig_buf_st fb;
- char buf[FN_REFLEN];
- my_bool result;
- DBUG_ENTER("read_charset_file");
- DBUG_PRINT("enter",("cs_number: %d", cs_number));
-
- if (cs_number <= 0)
- DBUG_RETURN(TRUE);
-
- get_charset_conf_name(cs_number, buf);
- DBUG_PRINT("info",("file name: %s", buf));
-
- if ((fb.f = my_fopen(buf, O_RDONLY, myflags)) == NULL)
- DBUG_RETURN(TRUE);
-
- fb.buf[0] = '\0'; /* Init for get_word */
- fb.p = fb.buf;
-
- result=FALSE;
- if (fill_array(set->ctype, CTYPE_TABLE_SIZE, &fb) ||
- fill_array(set->to_lower, TO_LOWER_TABLE_SIZE, &fb) ||
- fill_array(set->to_upper, TO_UPPER_TABLE_SIZE, &fb) ||
- fill_array(set->sort_order, SORT_ORDER_TABLE_SIZE, &fb))
- result=TRUE;
-
- my_fclose(fb.f, MYF(0));
- DBUG_RETURN(result);
-}
-
-
-uint get_charset_number(const char *charset_name)
-{
- my_bool error;
- error = init_available_charsets(MYF(0)); /* If it isn't initialized */
- if (error)
- return compiled_charset_number(charset_name);
- else
- return num_from_csname(available_charsets, charset_name);
-}
-
-const char *get_charset_name(uint charset_number)
-{
- my_bool error;
- error = init_available_charsets(MYF(0)); /* If it isn't initialized */
- if (error)
- return compiled_charset_name(charset_number);
- else
- return name_from_csnum(available_charsets, charset_number);
-}
-
-
-static CHARSET_INFO *find_charset(CHARSET_INFO **table, uint cs_number,
- size_t tablesz)
-{
- uint i;
- for (i = 0; i < tablesz; ++i)
- if (table[i]->number == cs_number)
- return table[i];
- return NULL;
-}
-
-static CHARSET_INFO *find_charset_by_name(CHARSET_INFO **table, const char *name,
- size_t tablesz)
-{
- uint i;
- for (i = 0; i < tablesz; ++i)
- if (!strcmp(table[i]->name,name))
- return table[i];
- return NULL;
-}
-
-static CHARSET_INFO *add_charset(uint cs_number, const char *cs_name)
-{
- CHARSET_INFO tmp_cs,*cs;
- uchar tmp_ctype[CTYPE_TABLE_SIZE];
- uchar tmp_to_lower[TO_LOWER_TABLE_SIZE];
- uchar tmp_to_upper[TO_UPPER_TABLE_SIZE];
- uchar tmp_sort_order[SORT_ORDER_TABLE_SIZE];
-
- /* Don't allocate memory if we are not sure we can find the char set */
- cs= &tmp_cs;
- bzero((char*) cs, sizeof(*cs));
- cs->ctype=tmp_ctype;
- cs->to_lower=tmp_to_lower;
- cs->to_upper=tmp_to_upper;
- cs->sort_order=tmp_sort_order;
- if (read_charset_file(cs_number, cs, MYF(MY_WME)))
- return NULL;
-
- cs = (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),
- MYF(MY_WME));
- *cs=tmp_cs;
- cs->name = (char *) my_once_alloc((uint) strlen(cs_name)+1, MYF(MY_WME));
- cs->ctype = (uchar*) my_once_alloc(CTYPE_TABLE_SIZE, MYF(MY_WME));
- cs->to_lower = (uchar*) my_once_alloc(TO_LOWER_TABLE_SIZE, MYF(MY_WME));
- cs->to_upper = (uchar*) my_once_alloc(TO_UPPER_TABLE_SIZE, MYF(MY_WME));
- cs->sort_order=(uchar*) my_once_alloc(SORT_ORDER_TABLE_SIZE, MYF(MY_WME));
- cs->number = cs_number;
- memcpy((char*) cs->name, (char*) cs_name, strlen(cs_name) + 1);
- memcpy((char*) cs->ctype, (char*) tmp_ctype, sizeof(tmp_ctype));
- memcpy((char*) cs->to_lower, (char*) tmp_to_lower, sizeof(tmp_to_lower));
- memcpy((char*) cs->to_upper, (char*) tmp_to_upper, sizeof(tmp_to_upper));
- memcpy((char*) cs->sort_order, (char*) tmp_sort_order,
- sizeof(tmp_sort_order));
- insert_dynamic(&cs_info_table, (gptr) &cs);
- return cs;
-}
-
-static CHARSET_INFO *get_internal_charset(uint cs_number)
-{
- CHARSET_INFO *cs;
- /*
- To make things thread safe we are not allowing other threads to interfere
- while we may changing the cs_info_table
- */
- pthread_mutex_lock(&THR_LOCK_charset);
- if (!(cs = find_charset((CHARSET_INFO**) cs_info_table.buffer, cs_number,
- cs_info_table.elements)))
- if (!(cs = find_compiled_charset(cs_number)))
- cs=add_charset(cs_number, get_charset_name(cs_number));
- pthread_mutex_unlock(&THR_LOCK_charset);
- return cs;
-}
-
-
-static CHARSET_INFO *get_internal_charset_by_name(const char *name)
-{
- CHARSET_INFO *cs;
- /*
- To make things thread safe we are not allowing other threads to interfere
- while we may changing the cs_info_table
- */
- pthread_mutex_lock(&THR_LOCK_charset);
- if (!(cs = find_charset_by_name((CHARSET_INFO**) cs_info_table.buffer, name,
- cs_info_table.elements)))
- if (!(cs = find_compiled_charset_by_name(name)))
- cs=add_charset(get_charset_number(name), name);
- pthread_mutex_unlock(&THR_LOCK_charset);
- return cs;
-}
-
-
-CHARSET_INFO *get_charset(uint cs_number, myf flags)
-{
- CHARSET_INFO *cs;
- (void) init_available_charsets(MYF(0)); /* If it isn't initialized */
- cs=get_internal_charset(cs_number);
-
- if (!cs && (flags & MY_WME))
- {
- char index_file[FN_REFLEN], cs_string[23];
- strmov(get_charsets_dir(index_file), "Index");
- cs_string[0]='#';
- int10_to_str(cs_number, cs_string+1, 10);
- my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_string, index_file);
- }
- return cs;
-}
-
-my_bool set_default_charset(uint cs, myf flags)
-{
- CHARSET_INFO *new_charset;
- DBUG_ENTER("set_default_charset");
- DBUG_PRINT("enter",("character set: %d",(int) cs));
- new_charset = get_charset(cs, flags);
- if (!new_charset)
- {
- DBUG_PRINT("error",("Couldn't set default character set"));
- DBUG_RETURN(TRUE); /* error */
- }
- default_charset_info = new_charset;
- DBUG_RETURN(FALSE);
-}
-
-CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags)
-{
- CHARSET_INFO *cs;
- (void) init_available_charsets(MYF(0)); /* If it isn't initialized */
- cs=get_internal_charset_by_name(cs_name);
-
- if (!cs && (flags & MY_WME))
- {
- char index_file[FN_REFLEN];
- strmov(get_charsets_dir(index_file), "Index");
- my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_name, index_file);
- }
-
- return cs;
-}
-
-my_bool set_default_charset_by_name(const char *cs_name, myf flags)
-{
- CHARSET_INFO *new_charset;
- DBUG_ENTER("set_default_charset_by_name");
- DBUG_PRINT("enter",("character set: %s", cs_name));
- new_charset = get_charset_by_name(cs_name, flags);
- if (!new_charset)
- {
- DBUG_PRINT("error",("Couldn't set default character set"));
- DBUG_RETURN(TRUE); /* error */
- }
-
- default_charset_info = new_charset;
- DBUG_RETURN(FALSE);
-}
-
-/* Only append name if it doesn't exist from before */
-
-static my_bool charset_in_string(const char *name, DYNAMIC_STRING *s)
-{
- uint length= (uint) strlen(name);
- const char *pos;
- for (pos=s->str ; (pos=strstr(pos,name)) ; pos++)
- {
- if (! pos[length] || pos[length] == ' ')
- return TRUE; /* Already existed */
- }
-
- return FALSE;
-}
-
-static void charset_append(DYNAMIC_STRING *s, const char *name)
-{
- if (!charset_in_string(name, s)) {
- dynstr_append(s, name);
- dynstr_append(s, " ");
- }
-}
-
-
-/* Returns a dynamically-allocated string listing the character sets
- requested. The caller is responsible for freeing the memory. */
-
-char * list_charsets(myf want_flags)
-{
- DYNAMIC_STRING s;
- char *p;
-
- (void)init_available_charsets(MYF(0));
- init_dynamic_string(&s, NullS, 256, 1024);
-
- if (want_flags & MY_COMPILED_SETS)
- {
- CHARSET_INFO *cs;
- for (cs = compiled_charsets; cs->number > 0; cs++)
- {
- dynstr_append(&s, cs->name);
- dynstr_append(&s, " ");
- }
- }
-
- if (want_flags & MY_CONFIG_SETS)
- {
- CS_ID **c;
- char buf[FN_REFLEN];
- MY_STAT status;
-
- if((c=available_charsets))
- for (; *c; ++c)
- {
- if (charset_in_string((*c)->name, &s))
- continue;
- get_charset_conf_name((*c)->number, buf);
- if (!my_stat(buf, &status, MYF(0)))
- continue; /* conf file doesn't exist */
- dynstr_append(&s, (*c)->name);
- dynstr_append(&s, " ");
- }
- }
-
- if (want_flags & MY_INDEX_SETS)
- {
- CS_ID **c;
- for (c = available_charsets; *c; ++c)
- charset_append(&s, (*c)->name);
- }
-
- if (want_flags & MY_LOADED_SETS)
- {
- uint i;
- for (i = 0; i < cs_info_table.elements; i++)
- charset_append(&s,
- dynamic_element(&cs_info_table, i, CHARSET_INFO *)->name);
- }
- s.str[s.length - 1] = '\0'; /* chop trailing space */
- p = my_strdup(s.str, MYF(MY_WME));
- dynstr_free(&s);
-
- return p;
-}
-
-/****************************************************************************
-* Code for debugging.
-****************************************************************************/
-
-
-static void _print_array(uint8 *data, uint size)
-{
- uint i;
- for (i = 0; i < size; ++i)
- {
- if (i == 0 || i % 16 == size % 16) printf(" ");
- printf(" %02x", data[i]);
- if ((i+1) % 16 == size % 16) printf("\n");
- }
-}
-
-/* _print_csinfo is called from test_charset.c */
-void _print_csinfo(CHARSET_INFO *cs)
-{
- printf("%s #%d\n", cs->name, cs->number);
- printf("ctype:\n"); _print_array(cs->ctype, 257);
- printf("to_lower:\n"); _print_array(cs->to_lower, 256);
- printf("to_upper:\n"); _print_array(cs->to_upper, 256);
- printf("sort_order:\n"); _print_array(cs->sort_order, 256);
- printf("collate: %3s (%d, %p, %p, %p, %p, %p)\n",
- cs->strxfrm_multiply ? "yes" : "no",
- cs->strxfrm_multiply,
- cs->strcoll,
- cs->strxfrm,
- cs->strnncoll,
- cs->strnxfrm,
- cs->like_range);
- printf("multi-byte: %3s (%d, %p, %p, %p)\n",
- cs->mbmaxlen ? "yes" : "no",
- cs->mbmaxlen,
- cs->ismbchar,
- cs->ismbhead,
- cs->mbcharlen);
-}
diff --git a/ext/mysql/libmysql/config-win.h b/ext/mysql/libmysql/config-win.h
deleted file mode 100644
index 363daab39a..0000000000
--- a/ext/mysql/libmysql/config-win.h
+++ /dev/null
@@ -1,293 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Defines for Win32 to make it compatible for MySQL */
-
-#include <sys/locking.h>
-#include <windows.h>
-#include <math.h> /* Because of rint() */
-#include <fcntl.h>
-#include <io.h>
-#include <malloc.h>
-
-#if defined(__NT__)
-#define SYSTEM_TYPE "NT"
-#elif defined(__WIN2000__)
-#define SYSTEM_TYPE "WIN2000"
-#else
-#define SYSTEM_TYPE "Win95/Win98"
-#endif
-
-#ifdef _WIN64
-#define MACHINE_TYPE "ia64" /* Define to machine type name */
-#else
-#define MACHINE_TYPE "i32" /* Define to machine type name */
-#ifndef _WIN32
-#define _WIN32 /* Compatible with old source */
-#endif
-#ifndef __WIN32__
-#define __WIN32__
-#endif
-#endif /* _WIN64 */
-#ifndef __WIN__
-#define __WIN__ /* To make it easier in VC++ */
-#endif
-
-/* File and lock constants */
-#define O_SHARE 0x1000 /* Open file in sharing mode */
-#ifdef __BORLANDC__
-#define F_RDLCK LK_NBLCK /* read lock */
-#define F_WRLCK LK_NBRLCK /* write lock */
-#define F_UNLCK LK_UNLCK /* remove lock(s) */
-#else
-#define F_RDLCK _LK_NBLCK /* read lock */
-#define F_WRLCK _LK_NBRLCK /* write lock */
-#define F_UNLCK _LK_UNLCK /* remove lock(s) */
-#endif
-
-#define F_EXCLUSIVE 1 /* We have only exclusive locking */
-#define F_TO_EOF (INT_MAX32/2) /* size for lock of all file */
-#define F_OK 0 /* parameter to access() */
-
-#define S_IROTH S_IREAD /* for my_lib */
-
-#ifdef __BORLANDC__
-#define FILE_BINARY O_BINARY /* my_fopen in binary mode */
-#define O_TEMPORARY 0
-#define O_SHORT_LIVED 0
-#define SH_DENYNO _SH_DENYNO
-#else
-#define O_BINARY _O_BINARY /* compability with MSDOS */
-#define FILE_BINARY _O_BINARY /* my_fopen in binary mode */
-#define O_TEMPORARY _O_TEMPORARY
-#define O_SHORT_LIVED _O_SHORT_LIVED
-#define SH_DENYNO _SH_DENYNO
-#endif
-#define NO_OPEN_3 /* For my_create() */
-
-#define SIGQUIT SIGTERM /* No SIGQUIT */
-
-#undef _REENTRANT /* Crashes something for win32 */
-#undef SAFE_MUTEX /* Can't be used on windows */
-
-#define LONGLONG_MIN ((__int64) 0x8000000000000000)
-#define LONGLONG_MAX ((__int64) 0x7FFFFFFFFFFFFFFF)
-#define LL(A) ((__int64) A)
-
-/* Type information */
-
-typedef unsigned short ushort;
-typedef unsigned int uint;
-typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */
-typedef __int64 longlong;
-typedef int sigset_t;
-#define longlong_defined
-/* off_t should not be __int64 because of conflicts in header files;
- Use my_off_t or os_off_t instead */
-typedef long off_t;
-typedef __int64 os_off_t;
-#ifdef _WIN64
-typedef UINT_PTR rf_SetTimer;
-#else
-typedef unsigned int size_t;
-typedef uint rf_SetTimer;
-#endif
-
-#define Socket_defined
-#define my_socket SOCKET
-#define bool BOOL
-#define SIGPIPE SIGINT
-#define RETQSORTTYPE void
-#define QSORT_TYPE_IS_VOID
-#define RETSIGTYPE void
-#define SOCKET_SIZE_TYPE int
-#define my_socket_defined
-#define bool_defined
-#define byte_defined
-#define HUGE_PTR
-#define STDCALL __stdcall /* Used by libmysql.dll */
-
-#ifndef UNDEF_THREAD_HACK
-#define THREAD
-#endif
-#define VOID_SIGHANDLER
-#define SIZEOF_CHAR 1
-#define SIZEOF_LONG 4
-#define SIZEOF_LONG_LONG 8
-#define SIZEOF_OFF_T 8
-#define HAVE_BROKEN_NETINET_INCLUDES
-#ifdef __NT__
-#define HAVE_NAMED_PIPE /* We can only create pipes on NT */
-#endif
-
-/* Use all character sets in MySQL */
-#define USE_MB 1
-#define USE_MB_IDENT 1
-#define USE_STRCOLL 1
-
-/* Convert some simple functions to Posix */
-
-#define sigset(A,B) signal((A),(B))
-#define finite(A) _finite(A)
-#define sleep(A) Sleep((A)*1000)
-
-#ifndef __BORLANDC__
-#define access(A,B) _access(A,B)
-#endif
-
-#if defined(__cplusplus)
-
-inline double rint(double nr)
-{
- double f = floor(nr);
- double c = ceil(nr);
- return (((c-nr) >= (nr-f)) ? f :c);
-}
-
-#ifdef _WIN64
-#define ulonglong2double(A) ((double) (A))
-#define my_off_t2double(A) ((double) (A))
-
-#else
-inline double ulonglong2double(ulonglong value)
-{
- longlong nr=(longlong) value;
- if (nr >= 0)
- return (double) nr;
- return (18446744073709551616.0 + (double) nr);
-}
-#define my_off_t2double(A) ulonglong2double(A)
-#endif /* _WIN64 */
-#else
-#define inline __inline
-#endif /* __cplusplus */
-
-#if SIZEOF_OFF_T > 4
-#define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C))
-#define tell(A) _telli64(A)
-#endif
-
-#define STACK_DIRECTION -1
-
-/* Optimized store functions for Intel x86 */
-
-#define sint2korr(A) (*((int16 *) (A)))
-#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
- (((uint32) 255L << 24) | \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])) : \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])))
-#define sint4korr(A) (*((long *) (A)))
-#define uint2korr(A) (*((uint16 *) (A)))
-#define uint3korr(A) (long) (*((unsigned long *) (A)) & 0xFFFFFF)
-#define uint4korr(A) (*((unsigned long *) (A)))
-#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24)) +\
- (((ulonglong) ((uchar) (A)[4])) << 32))
-#define uint8korr(A) (*((ulonglong *) (A)))
-#define sint8korr(A) (*((longlong *) (A)))
-#define int2store(T,A) *((uint16*) (T))= (uint16) (A)
-#define int3store(T,A) { *(T)= (uchar) ((A));\
- *(T+1)=(uchar) (((uint) (A) >> 8));\
- *(T+2)=(uchar) (((A) >> 16)); }
-#define int4store(T,A) *((long *) (T))= (long) (A)
-#define int5store(T,A) { *(T)= (uchar)((A));\
- *((T)+1)=(uchar) (((A) >> 8));\
- *((T)+2)=(uchar) (((A) >> 16));\
- *((T)+3)=(uchar) (((A) >> 24)); \
- *((T)+4)=(uchar) (((A) >> 32)); }
-#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
-
-#define doubleget(V,M) { *((long *) &V) = *((long*) M); \
- *(((long *) &V)+1) = *(((long*) M)+1); }
-#define doublestore(T,V) { *((long *) T) = *((long*) &V); \
- *(((long *) T)+1) = *(((long*) &V)+1); }
-#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); }
-#define float8get(V,M) doubleget((V),(M))
-#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
-#define float8store(V,M) doublestore((V),(M))
-
-
-#define HAVE_PERROR
-#define HAVE_VFPRINT
-#define HAVE_CHSIZE /* System has chsize() function */
-#define HAVE_RENAME /* Have rename() as function */
-#define HAVE_BINARY_STREAMS /* Have "b" flag in streams */
-#define HAVE_LONG_JMP /* Have long jump function */
-#define HAVE_LOCKING /* have locking() call */
-#define HAVE_ERRNO_AS_DEFINE /* errno is a define */
-#define HAVE_STDLIB /* everything is include in this file */
-#define HAVE_MEMCPY
-#define HAVE_MEMMOVE
-#define HAVE_GETCWD
-#define HAVE_TELL
-#define HAVE_TZNAME
-#define HAVE_PUTENV
-#define HAVE_SELECT
-#define HAVE_SETLOCALE
-#define HAVE_SOCKET /* Giangi */
-#define HAVE_FLOAT_H
-#define HAVE_LIMITS_H
-#define HAVE_STDDEF_H
-#define HAVE_RINT /* defined in this file */
-#define NO_FCNTL_NONBLOCK /* No FCNTL */
-#define HAVE_ALLOCA
-#define HAVE_STRPBRK
-#define HAVE_STRSTR
-/* #define HAVE_COMPRESS -- not with PHP, please */
-
-#ifdef NOT_USED
-#define HAVE_SNPRINTF /* Gave link error */
-#define _snprintf snprintf
-#endif
-
-#ifdef _MSC_VER
-#define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */
-#define HAVE_ANSI_INCLUDE
-#define HAVE_SYS_UTIME_H
-#define HAVE_STRTOUL
-#endif
-#define my_reinterpret_cast(A) reinterpret_cast <A>
-#define my_const_cast(A) const_cast<A>
-
-/* MYSQL OPTIONS */
-
-#ifdef _CUSTOMCONFIG_
-#include <custom_conf.h>
-#else
-#define DEFAULT_MYSQL_HOME "c:\\mysql"
-#define PACKAGE "mysql"
-#define DEFAULT_BASEDIR "C:\\"
-#define SHAREDIR "share"
-#define DEFAULT_CHARSET_HOME "C:/mysql"
-#endif
-
-/* File name handling */
-
-#define FN_LIBCHAR '\\'
-#define FN_ROOTDIR "\\"
-#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */
-#define FN_NO_CASE_SENCE /* Files are not case-sensitive */
-#define FN_LOWER_CASE TRUE /* Files are represented in lower case */
-#define MY_NFILE 1024
-
-#define DO_NOT_REMOVE_THREAD_WRAPPERS
-#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
-/* The following is only used for statistics, so it should be good enough */
-#ifdef __NT__ /* This should also work on Win98 but .. */
-#define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C))
-#define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C))
-#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
-#else
-#define thread_safe_add(V,C,L) \
- pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
-#define thread_safe_sub(V,C,L) \
- pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
-#define statistic_add(V,C,L) (V)+=(C)
-#endif
-#define statistic_increment(V,L) thread_safe_increment((V),(L))
diff --git a/ext/mysql/libmysql/ctype.c b/ext/mysql/libmysql/ctype.c
deleted file mode 100644
index 49827a16ab..0000000000
--- a/ext/mysql/libmysql/ctype.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include <global.h>
-#include <m_ctype.h>
-#include <m_string.h>
-
-/* generated by make, using conf_to_src */
-#include "ctype_extra_sources.c"
-
-/* generated by configure */
-#include "ctype_autoconf.c"
-
-CHARSET_INFO *default_charset_info = &compiled_charsets[0];
-
-CHARSET_INFO *find_compiled_charset(uint cs_number)
-{
- CHARSET_INFO *cs;
- for (cs = compiled_charsets; cs->number > 0; cs++)
- if (cs->number == cs_number)
- return cs;
-
- return NULL;
-}
-
-CHARSET_INFO *find_compiled_charset_by_name(const char *name)
-{
- CHARSET_INFO *cs;
- for (cs = compiled_charsets; cs->number > 0; cs++)
- if (!strcmp(cs->name, name))
- return cs;
-
- return NULL;
-}
-
-uint compiled_charset_number(const char *name)
-{
- CHARSET_INFO *cs;
- for (cs = compiled_charsets; cs->number > 0; cs++)
- if (!strcmp(cs->name, name))
- return cs->number;
-
- return 0; /* this mimics find_type() */
-}
-
-const char *compiled_charset_name(uint charset_number)
-{
- CHARSET_INFO *cs;
- for (cs = compiled_charsets; cs->number > 0; cs++)
- if (cs->number == charset_number)
- return cs->name;
-
- return "?"; /* this mimics get_type() */
-}
diff --git a/ext/mysql/libmysql/ctype_autoconf.c b/ext/mysql/libmysql/ctype_autoconf.c
deleted file mode 100644
index 22da693433..0000000000
--- a/ext/mysql/libmysql/ctype_autoconf.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* This file is generated automatically by configure. */
-
-CHARSET_INFO compiled_charsets[] = {
-
- /* this information is filled in by configure */
- {
- 8, /* number */
- "latin1", /* name */
- ctype_latin1,
- to_lower_latin1,
- to_upper_latin1,
- sort_order_latin1,
- 0, /* strxfrm_multiply */
- NULL, /* strcoll */
- NULL, /* strxfrm */
- NULL, /* strnncoll */
- NULL, /* strnxfrm */
- NULL, /* like_range */
- 0, /* mbmaxlen */
- NULL, /* ismbchar */
- NULL, /* ismbhead */
- NULL /* mbcharlen */
- },
-
- /* this information is filled in by configure */
- {
- 0, /* end-of-list marker */
- NullS,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- NULL,
- NULL,
- NULL
- }
-};
diff --git a/ext/mysql/libmysql/ctype_extra_sources.c b/ext/mysql/libmysql/ctype_extra_sources.c
deleted file mode 100644
index 97f0d38646..0000000000
--- a/ext/mysql/libmysql/ctype_extra_sources.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* The latin1 character set. Generated automatically by configure and
- * the ./conf_to_src program
- */
-
-uchar ctype_latin1[] = {
- 0,
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
- 72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 132,132,132,132,132,132,132,132,132,132, 16, 16, 16, 16, 16, 16,
- 16,129,129,129,129,129,129, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16,
- 16,130,130,130,130,130,130, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 32,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 16, 1, 1, 1, 1, 1, 1, 1, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2, 2
-};
-
-uchar to_lower_latin1[] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
- 112,113,114,115,116,117,118,119,120,121,122, 91, 92, 93, 94, 95,
- 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
- 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
- 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
- 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
- 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
- 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
- 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
- 240,241,242,243,244,245,246,215,248,249,250,251,252,253,254,223,
- 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
- 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
-};
-
-uchar to_upper_latin1[] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127,
- 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
- 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
- 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
- 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
- 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
- 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
- 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
- 208,209,210,211,212,213,214,247,216,217,218,219,220,221,222,255
-};
-
-uchar sort_order_latin1[] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127,
- 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
- 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
- 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
- 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
- 65, 65, 65, 65, 92, 91, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73,
- 68, 78, 79, 79, 79, 79, 93,215,216, 85, 85, 85, 89, 89,222,223,
- 65, 65, 65, 65, 92, 91, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73,
- 68, 78, 79, 79, 79, 79, 93,247,216, 85, 85, 85, 89, 89,222,255
-};
-
-
diff --git a/ext/mysql/libmysql/dbug.c b/ext/mysql/libmysql/dbug.c
deleted file mode 100644
index cfe4ca161c..0000000000
--- a/ext/mysql/libmysql/dbug.c
+++ /dev/null
@@ -1,2069 +0,0 @@
-/******************************************************************************
- * *
- * N O T I C E *
- * *
- * Copyright Abandoned, 1987, Fred Fish *
- * *
- * *
- * This previously copyrighted work has been placed into the public *
- * domain by the author and may be freely used for any purpose, *
- * private or commercial. *
- * *
- * Because of the number of inquiries I was receiving about the use *
- * of this product in commercially developed works I have decided to *
- * simply make it public domain to further its unrestricted use. I *
- * specifically would be most happy to see this material become a *
- * part of the standard Unix distributions by AT&T and the Berkeley *
- * Computer Science Research Group, and a standard part of the GNU *
- * system from the Free Software Foundation. *
- * *
- * I would appreciate it, as a courtesy, if this notice is left in *
- * all copies and derivative works. Thank you. *
- * *
- * The author makes no warranty of any kind with respect to this *
- * product and explicitly disclaims any implied warranties of mer- *
- * chantability or fitness for any particular purpose. *
- * *
- ******************************************************************************
- */
-
-
-/*
- * FILE
- *
- * dbug.c runtime support routines for dbug package
- *
- * SCCS
- *
- * @(#)dbug.c 1.25 7/25/89
- *
- * DESCRIPTION
- *
- * These are the runtime support routines for the dbug package.
- * The dbug package has two main components; the user include
- * file containing various macro definitions, and the runtime
- * support routines which are called from the macro expansions.
- *
- * Externally visible functions in the runtime support module
- * use the naming convention pattern "_db_xx...xx_", thus
- * they are unlikely to collide with user defined function names.
- *
- * AUTHOR(S)
- *
- * Fred Fish (base code)
- * Enhanced Software Technologies, Tempe, AZ
- * asuvax!mcdphx!estinc!fnf
- *
- * Binayak Banerjee (profiling enhancements)
- * seismo!bpa!sjuvax!bbanerje
- *
- * Michael Widenius:
- * DBUG_DUMP - To dump a pice of memory.
- * PUSH_FLAG "O" - To be used insted of "o" if we don't
- * want flushing (for slow systems)
- * PUSH_FLAG "A" - as 'O', but we will append to the out file instead
- * of creating a new one.
- * Check of malloc on entry/exit (option "S")
- */
-
-#ifdef DBUG_OFF
-#undef DBUG_OFF
-#endif
-#include <global.h>
-#include <m_string.h>
-#include <errno.h>
-#if defined(MSDOS) || defined(__WIN__)
-#include <process.h>
-#endif
-
-#ifdef _DBUG_CONDITION_
-#define _DBUG_START_CONDITION_ "d:t"
-#else
-#define _DBUG_START_CONDITION_ ""
-#endif
-
-/*
- * Manifest constants that should not require any changes.
- */
-
-#define EOS '\000' /* End Of String marker */
-
-/*
- * Manifest constants which may be "tuned" if desired.
- */
-
-#define PRINTBUF 1024 /* Print buffer size */
-#define INDENT 2 /* Indentation per trace level */
-#define MAXDEPTH 200 /* Maximum trace depth default */
-
-/*
- * The following flags are used to determine which
- * capabilities the user has enabled with the state
- * push macro.
- */
-
-#define TRACE_ON 000001 /* Trace enabled */
-#define DEBUG_ON 000002 /* Debug enabled */
-#define FILE_ON 000004 /* File name print enabled */
-#define LINE_ON 000010 /* Line number print enabled */
-#define DEPTH_ON 000020 /* Function nest level print enabled */
-#define PROCESS_ON 000040 /* Process name print enabled */
-#define NUMBER_ON 000100 /* Number each line of output */
-#define PROFILE_ON 000200 /* Print out profiling code */
-#define PID_ON 000400 /* Identify each line with process id */
-#define SANITY_CHECK_ON 001000 /* Check safemalloc on DBUG_ENTER */
-#define FLUSH_ON_WRITE 002000 /* Flush on every write */
-
-#define TRACING (stack -> flags & TRACE_ON)
-#define DEBUGGING (stack -> flags & DEBUG_ON)
-#define PROFILING (stack -> flags & PROFILE_ON)
-#define STREQ(a,b) (strcmp(a,b) == 0)
-
-/*
- * Typedefs to make things more obvious.
- */
-
-#ifndef __WIN__
-typedef int BOOLEAN;
-#else
-#define BOOLEAN BOOL
-#endif
-
-/*
- * Make it easy to change storage classes if necessary.
- */
-
-#define IMPORT extern /* Names defined externally */
-#define EXPORT /* Allocated here, available globally */
-#define AUTO auto /* Names to be allocated on stack */
-#define REGISTER register /* Names to be placed in registers */
-
-/*
- * The default file for profiling. Could also add another flag
- * (G?) which allowed the user to specify this.
- *
- * If the automatic variables get allocated on the stack in
- * reverse order from their declarations, then define AUTOS_REVERSE.
- * This is used by the code that keeps track of stack usage. For
- * forward allocation, the difference in the dbug frame pointers
- * represents stack used by the callee function. For reverse allocation,
- * the difference represents stack used by the caller function.
- *
- */
-
-#define PROF_FILE "dbugmon.out"
-#define PROF_EFMT "E\t%ld\t%s\n"
-#define PROF_SFMT "S\t%lx\t%lx\t%s\n"
-#define PROF_XFMT "X\t%ld\t%s\n"
-
-#ifdef M_I386 /* predefined by xenix 386 compiler */
-#define AUTOS_REVERSE 1
-#endif
-
-/*
- * Variables which are available externally but should only
- * be accessed via the macro package facilities.
- */
-
-EXPORT FILE *_db_fp_ = (FILE *) 0; /* Output stream, default stderr */
-EXPORT char *_db_process_ = (char*) "dbug"; /* Pointer to process name; argv[0] */
-EXPORT FILE *_db_pfp_ = (FILE *)0; /* Profile stream, 'dbugmon.out' */
-EXPORT BOOLEAN _db_on_ = FALSE; /* TRUE if debugging currently on */
-EXPORT BOOLEAN _db_pon_ = FALSE; /* TRUE if profile currently on */
-EXPORT BOOLEAN _no_db_ = FALSE; /* TRUE if no debugging at all */
-
-/*
- * Externally supplied functions.
- */
-
-#ifndef HAVE_PERROR
-static void perror (); /* Fake system/library error print routine */
-#endif
-
-IMPORT int _sanity(const char *file,uint line);
-
-/*
- * The user may specify a list of functions to trace or
- * debug. These lists are kept in a linear linked list,
- * a very simple implementation.
- */
-
-struct link {
- char *str; /* Pointer to link's contents */
- struct link *next_link; /* Pointer to the next link */
-};
-
-/*
- * Debugging states can be pushed or popped off of a
- * stack which is implemented as a linked list. Note
- * that the head of the list is the current state and the
- * stack is pushed by adding a new state to the head of the
- * list or popped by removing the first link.
- */
-
-struct state {
- int flags; /* Current state flags */
- int maxdepth; /* Current maximum trace depth */
- uint delay; /* Delay after each output line */
- int sub_level; /* Sub this from code_state->level */
- FILE *out_file; /* Current output stream */
- FILE *prof_file; /* Current profiling stream */
- char name[FN_REFLEN]; /* Name of output file */
- struct link *functions; /* List of functions */
- struct link *p_functions; /* List of profiled functions */
- struct link *keywords; /* List of debug keywords */
- struct link *processes; /* List of process names */
- struct state *next_state; /* Next state in the list */
-};
-
-
-/*
- * Local variables not seen by user.
- */
-
-
-static my_bool init_done = FALSE; /* Set to TRUE when initialization done */
-static struct state *stack=0;
-
-typedef struct st_code_state {
- int lineno; /* Current debugger output line number */
- int level; /* Current function nesting level */
- const char *func; /* Name of current user function */
- const char *file; /* Name of current user file */
- char **framep; /* Pointer to current frame */
- int jmplevel; /* Remember nesting level at setjmp () */
- const char *jmpfunc; /* Remember current function for setjmp */
- const char *jmpfile; /* Remember current file for setjmp */
-
-/*
- * The following variables are used to hold the state information
- * between the call to _db_pargs_() and _db_doprnt_(), during
- * expansion of the DBUG_PRINT macro. This is the only macro
- * that currently uses these variables.
- *
- * These variables are currently used only by _db_pargs_() and
- * _db_doprnt_().
- */
-
- uint u_line; /* User source code line number */
- const char *u_keyword; /* Keyword for current macro */
- int locked; /* If locked with _db_lock_file */
-} CODE_STATE;
-
- /* Parse a debug command string */
-static struct link *ListParse(char *ctlp);
- /* Make a fresh copy of a string */
-static char *StrDup(const char *str);
- /* Open debug output stream */
-static void DBUGOpenFile(const char *name, int append);
-#ifndef THREAD
- /* Open profile output stream */
-static FILE *OpenProfile(const char *name);
- /* Profile if asked for it */
-static BOOLEAN DoProfile(void);
-#endif
- /* Return current user time (ms) */
-#ifndef THREAD
-static unsigned long Clock (void);
-#endif
- /* Close debug output stream */
-static void CloseFile(FILE *fp);
- /* Push current debug state */
-static void PushState(void);
- /* Test for tracing enabled */
-static BOOLEAN DoTrace(CODE_STATE *state);
- /* Test to see if file is writable */
-#if !(!defined(HAVE_ACCESS) || defined(MSDOS))
-static BOOLEAN Writable(char *pathname);
- /* Change file owner and group */
-static void ChangeOwner(char *pathname);
- /* Allocate memory for runtime support */
-#endif
-static char *DbugMalloc(int size);
- /* Remove leading pathname components */
-static char *BaseName(const char *pathname);
-static void DoPrefix(uint line);
-static void FreeList(struct link *linkp);
-static void Indent(int indent);
-static BOOLEAN InList(struct link *linkp,const char *cp);
-static void dbug_flush(CODE_STATE *);
-static void DbugExit(const char *why);
-static int DelayArg(int value);
- /* Supplied in Sys V runtime environ */
- /* Break string into tokens */
-static char *static_strtok(char *s1,pchar chr);
-
-/*
- * Miscellaneous printf format strings.
- */
-
-#define ERR_MISSING_RETURN "%s: missing DBUG_RETURN or DBUG_VOID_RETURN macro in function \"%s\"\n"
-#define ERR_OPEN "%s: can't open debug output stream \"%s\": "
-#define ERR_CLOSE "%s: can't close debug file: "
-#define ERR_ABORT "%s: debugger aborting because %s\n"
-#define ERR_CHOWN "%s: can't change owner/group of \"%s\": "
-
-/*
- * Macros and defines for testing file accessibility under UNIX and MSDOS.
- */
-
-#undef EXISTS
-#if !defined(HAVE_ACCESS) || defined(MSDOS)
-#define EXISTS(pathname) (FALSE) /* Assume no existance */
-#define Writable(name) (TRUE)
-#else
-#define EXISTS(pathname) (access (pathname, F_OK) == 0)
-#define WRITABLE(pathname) (access (pathname, W_OK) == 0)
-#endif
-#ifndef MSDOS
-#define ChangeOwner(name)
-#endif
-
-/*
- * Translate some calls among different systems.
- */
-
-#if defined(unix) || defined(xenix) || defined(VMS) || defined(__NetBSD__)
-# define Delay(A) sleep((uint) A)
-#elif defined(AMIGA)
-IMPORT int Delay (); /* Pause for given number of ticks */
-#else
-static int Delay(int ticks);
-#endif
-
-
-/*
-** Macros to allow dbugging with threads
-*/
-
-#ifdef THREAD
-#include <my_pthread.h>
-pthread_mutex_t THR_LOCK_dbug;
-
-static void init_dbug_state(void)
-{
- pthread_mutex_init(&THR_LOCK_dbug,MY_MUTEX_INIT_FAST);
-}
-
-static CODE_STATE *code_state(void)
-{
- CODE_STATE *state=0;
- struct st_my_thread_var *tmp=my_thread_var;
- if (tmp)
- {
- if (!(state=(CODE_STATE *) tmp->dbug))
- {
- state=(CODE_STATE*) DbugMalloc(sizeof(*state));
- bzero((char*) state,sizeof(*state));
- state->func="?func";
- state->file="?file";
- tmp->dbug=(gptr) state;
- }
- }
- return state;
-}
-
-#else /* !THREAD */
-
-#define init_dbug_state()
-#define code_state() (&static_code_state)
-#define pthread_mutex_lock(A) {}
-#define pthread_mutex_unlock(A) {}
-static CODE_STATE static_code_state = { 0,0,"?func","?file",NULL,0,NULL,
- NULL,0,"?",0};
-#endif
-
-
-/*
- * FUNCTION
- *
- * _db_push_ push current debugger state and set up new one
- *
- * SYNOPSIS
- *
- * VOID _db_push_ (control)
- * char *control;
- *
- * DESCRIPTION
- *
- * Given pointer to a debug control string in "control", pushes
- * the current debug state, parses the control string, and sets
- * up a new debug state.
- *
- * The only attribute of the new state inherited from the previous
- * state is the current function nesting level. This can be
- * overridden by using the "r" flag in the control string.
- *
- * The debug control string is a sequence of colon separated fields
- * as follows:
- *
- * <field_1>:<field_2>:...:<field_N>
- *
- * Each field consists of a mandatory flag character followed by
- * an optional "," and comma separated list of modifiers:
- *
- * flag[,modifier,modifier,...,modifier]
- *
- * The currently recognized flag characters are:
- *
- * d Enable output from DBUG_<N> macros for
- * for the current state. May be followed
- * by a list of keywords which selects output
- * only for the DBUG macros with that keyword.
- * A null list of keywords implies output for
- * all macros.
- *
- * D Delay after each debugger output line.
- * The argument is the number of tenths of seconds
- * to delay, subject to machine capabilities.
- * I.E. -#D,20 is delay two seconds.
- *
- * f Limit debugging and/or tracing, and profiling to the
- * list of named functions. Note that a null list will
- * disable all functions. The appropriate "d" or "t"
- * flags must still be given, this flag only limits their
- * actions if they are enabled.
- *
- * F Identify the source file name for each
- * line of debug or trace output.
- *
- * i Identify the process with the pid for each line of
- * debug or trace output.
- *
- * g Enable profiling. Create a file called 'dbugmon.out'
- * containing information that can be used to profile
- * the program. May be followed by a list of keywords
- * that select profiling only for the functions in that
- * list. A null list implies that all functions are
- * considered.
- *
- * L Identify the source file line number for
- * each line of debug or trace output.
- *
- * n Print the current function nesting depth for
- * each line of debug or trace output.
- *
- * N Number each line of dbug output.
- *
- * o Redirect the debugger output stream to the
- * specified file. The default output is stderr.
- *
- * O As O but the file is really flushed between each
- * write. When neaded the file is closed and reopened
- * between each write.
- *
- * p Limit debugger actions to specified processes.
- * A process must be identified with the
- * DBUG_PROCESS macro and match one in the list
- * for debugger actions to occur.
- *
- * P Print the current process name for each
- * line of debug or trace output.
- *
- * r When pushing a new state, do not inherit
- * the previous state's function nesting level.
- * Useful when the output is to start at the
- * left margin.
- *
- * S Do function _sanity(_file_,_line_) at each
- * debugged function until _sanity() returns
- * something that differs from 0.
- * (Moustly used with safemalloc)
- *
- * t Enable function call/exit trace lines.
- * May be followed by a list (containing only
- * one modifier) giving a numeric maximum
- * trace level, beyond which no output will
- * occur for either debugging or tracing
- * macros. The default is a compile time
- * option.
- *
- * Some examples of debug control strings which might appear
- * on a shell command line (the "-#" is typically used to
- * introduce a control string to an application program) are:
- *
- * -#d:t
- * -#d:f,main,subr1:F:L:t,20
- * -#d,input,output,files:n
- *
- * For convenience, any leading "-#" is stripped off.
- *
- */
-
-void _db_push_ (const char *control)
-{
- reg1 char *scan;
- reg2 struct link *temp;
- CODE_STATE *state;
- char *new_str;
-
- if (! _db_fp_)
- _db_fp_= stderr; /* Output stream, default stderr */
-
- if (control && *control == '-')
- {
- if (*++control == '#')
- control++;
- }
- if (*control)
- _no_db_=0; /* We are using dbug after all */
-
- new_str = StrDup (control);
- PushState ();
- state=code_state();
-
- scan = static_strtok (new_str, ':');
- for (; scan != NULL; scan = static_strtok ((char *)NULL, ':')) {
- switch (*scan++) {
- case 'd':
- _db_on_ = TRUE;
- stack -> flags |= DEBUG_ON;
- if (*scan++ == ',') {
- stack -> keywords = ListParse (scan);
- }
- break;
- case 'D':
- stack -> delay = 0;
- if (*scan++ == ',') {
- temp = ListParse (scan);
- stack -> delay = DelayArg (atoi (temp -> str));
- FreeList (temp);
- }
- break;
- case 'f':
- if (*scan++ == ',') {
- stack -> functions = ListParse (scan);
- }
- break;
- case 'F':
- stack -> flags |= FILE_ON;
- break;
- case 'i':
- stack -> flags |= PID_ON;
- break;
-#ifndef THREAD
- case 'g':
- _db_pon_ = TRUE;
- if (OpenProfile(PROF_FILE))
- {
- stack -> flags |= PROFILE_ON;
- if (*scan++ == ',')
- stack -> p_functions = ListParse (scan);
- }
- break;
-#endif
- case 'L':
- stack -> flags |= LINE_ON;
- break;
- case 'n':
- stack -> flags |= DEPTH_ON;
- break;
- case 'N':
- stack -> flags |= NUMBER_ON;
- break;
- case 'A':
- case 'O':
- stack -> flags |= FLUSH_ON_WRITE;
- case 'a':
- case 'o':
- if (*scan++ == ',') {
- temp = ListParse (scan);
- DBUGOpenFile(temp -> str, (int) (scan[-2] == 'A' || scan[-2] == 'a'));
- FreeList (temp);
- } else {
- DBUGOpenFile ("-",0);
- }
- break;
- case 'p':
- if (*scan++ == ',') {
- stack -> processes = ListParse (scan);
- }
- break;
- case 'P':
- stack -> flags |= PROCESS_ON;
- break;
- case 'r':
- stack->sub_level= state->level;
- break;
- case 't':
- stack -> flags |= TRACE_ON;
- if (*scan++ == ',') {
- temp = ListParse (scan);
- stack -> maxdepth = atoi (temp -> str);
- FreeList (temp);
- }
- break;
- case 'S':
- stack -> flags |= SANITY_CHECK_ON;
- break;
- }
- }
- free (new_str);
-}
-
-
-/*
- * FUNCTION
- *
- * _db_pop_ pop the debug stack
- *
- * DESCRIPTION
- *
- * Pops the debug stack, returning the debug state to its
- * condition prior to the most recent _db_push_ invocation.
- * Note that the pop will fail if it would remove the last
- * valid state from the stack. This prevents user errors
- * in the push/pop sequence from screwing up the debugger.
- * Maybe there should be some kind of warning printed if the
- * user tries to pop too many states.
- *
- */
-
-void _db_pop_ ()
-{
- reg1 struct state *discard;
- discard = stack;
- if (discard != NULL && discard -> next_state != NULL) {
- stack = discard -> next_state;
- _db_fp_ = stack -> out_file;
- _db_pfp_ = stack -> prof_file;
- if (discard -> keywords != NULL) {
- FreeList (discard -> keywords);
- }
- if (discard -> functions != NULL) {
- FreeList (discard -> functions);
- }
- if (discard -> processes != NULL) {
- FreeList (discard -> processes);
- }
- if (discard -> p_functions != NULL) {
- FreeList (discard -> p_functions);
- }
- CloseFile (discard -> out_file);
- if (discard -> prof_file)
- CloseFile (discard -> prof_file);
- free ((char *) discard);
- if (!(stack->flags & DEBUG_ON))
- _db_on_=0;
- }
- else
- {
- _db_on_=0;
- }
-}
-
-
-/*
- * FUNCTION
- *
- * _db_enter_ process entry point to user function
- *
- * SYNOPSIS
- *
- * VOID _db_enter_ (_func_, _file_, _line_,
- * _sfunc_, _sfile_, _slevel_, _sframep_)
- * char *_func_; points to current function name
- * char *_file_; points to current file name
- * int _line_; called from source line number
- * char **_sfunc_; save previous _func_
- * char **_sfile_; save previous _file_
- * int *_slevel_; save previous nesting level
- * char ***_sframep_; save previous frame pointer
- *
- * DESCRIPTION
- *
- * Called at the beginning of each user function to tell
- * the debugger that a new function has been entered.
- * Note that the pointers to the previous user function
- * name and previous user file name are stored on the
- * caller's stack (this is why the ENTER macro must be
- * the first "executable" code in a function, since it
- * allocates these storage locations). The previous nesting
- * level is also stored on the callers stack for internal
- * self consistency checks.
- *
- * Also prints a trace line if tracing is enabled and
- * increments the current function nesting depth.
- *
- * Note that this mechanism allows the debugger to know
- * what the current user function is at all times, without
- * maintaining an internal stack for the function names.
- *
- */
-
-void _db_enter_ (
-const char *_func_,
-const char *_file_,
-uint _line_,
-const char **_sfunc_,
-const char **_sfile_,
-uint *_slevel_,
-char ***_sframep_ __attribute__((unused)))
-{
- reg1 CODE_STATE *state;
-
- if (!_no_db_)
- {
- int save_errno=errno;
- if (!init_done)
- _db_push_ (_DBUG_START_CONDITION_);
- state=code_state();
-
- *_sfunc_ = state->func;
- *_sfile_ = state->file;
- state->func =(char*) _func_;
- state->file = (char*) _file_; /* BaseName takes time !! */
- *_slevel_ = ++state->level;
-#ifndef THREAD
- *_sframep_ = state->framep;
- state->framep = (char **) _sframep_;
- if (DoProfile ())
- {
- long stackused;
- if (*state->framep == NULL) {
- stackused = 0;
- } else {
- stackused = ((long)(*state->framep)) - ((long)(state->framep));
- stackused = stackused > 0 ? stackused : -stackused;
- }
- (void) fprintf (_db_pfp_, PROF_EFMT , Clock (), state->func);
-#ifdef AUTOS_REVERSE
- (void) fprintf (_db_pfp_, PROF_SFMT, state->framep, stackused, *_sfunc_);
-#else
- (void) fprintf (_db_pfp_, PROF_SFMT, (ulong) state->framep, stackused,
- state->func);
-#endif
- (void) fflush (_db_pfp_);
- }
-#endif
- if (DoTrace (state))
- {
- if (!state->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
- DoPrefix (_line_);
- Indent (state -> level);
- (void) fprintf (_db_fp_, ">%s\n", state->func);
- dbug_flush (state); /* This does a unlock */
- }
-#ifdef SAFEMALLOC
- if (stack -> flags & SANITY_CHECK_ON)
- if (_sanity(_file_,_line_)) /* Check of safemalloc */
- stack -> flags &= ~SANITY_CHECK_ON;
-#endif
- errno=save_errno;
- }
-}
-
-/*
- * FUNCTION
- *
- * _db_return_ process exit from user function
- *
- * SYNOPSIS
- *
- * VOID _db_return_ (_line_, _sfunc_, _sfile_, _slevel_)
- * int _line_; current source line number
- * char **_sfunc_; where previous _func_ is to be retrieved
- * char **_sfile_; where previous _file_ is to be retrieved
- * int *_slevel_; where previous level was stashed
- *
- * DESCRIPTION
- *
- * Called just before user function executes an explicit or implicit
- * return. Prints a trace line if trace is enabled, decrements
- * the current nesting level, and restores the current function and
- * file names from the defunct function's stack.
- *
- */
-
-void _db_return_ (
-uint _line_,
-const char **_sfunc_,
-const char **_sfile_,
-uint *_slevel_)
-{
- CODE_STATE *state;
-
- if (!_no_db_)
- {
- int save_errno=errno;
- if (!init_done)
- _db_push_ ("");
- if (!(state=code_state()))
- return; /* Only happens at end of program */
- if (stack->flags & (TRACE_ON | DEBUG_ON | PROFILE_ON))
- {
- if (!state->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
- if (state->level != (int) *_slevel_)
- (void) fprintf (_db_fp_, ERR_MISSING_RETURN, _db_process_,
- state->func);
- else
- {
-#ifdef SAFEMALLOC
- if (stack -> flags & SANITY_CHECK_ON)
- if (_sanity(*_sfile_,_line_))
- stack->flags &= ~SANITY_CHECK_ON;
-#endif
-#ifndef THREAD
- if (DoProfile ())
- (void) fprintf (_db_pfp_, PROF_XFMT, Clock(), state->func);
-#endif
- if (DoTrace (state))
- {
- DoPrefix (_line_);
- Indent (state->level);
- (void) fprintf (_db_fp_, "<%s\n", state->func);
- }
- }
- dbug_flush(state);
- }
- state->level = *_slevel_-1;
- state->func = *_sfunc_;
- state->file = *_sfile_;
-#ifndef THREAD
- if (state->framep != NULL)
- state->framep = (char **) *state->framep;
-#endif
- errno=save_errno;
- }
-}
-
-
-/*
- * FUNCTION
- *
- * _db_pargs_ log arguments for subsequent use by _db_doprnt_()
- *
- * SYNOPSIS
- *
- * VOID _db_pargs_ (_line_, keyword)
- * int _line_;
- * char *keyword;
- *
- * DESCRIPTION
- *
- * The new universal printing macro DBUG_PRINT, which replaces
- * all forms of the DBUG_N macros, needs two calls to runtime
- * support routines. The first, this function, remembers arguments
- * that are used by the subsequent call to _db_doprnt_().
- *
- */
-
-void _db_pargs_ (
-uint _line_,
-const char *keyword)
-{
- CODE_STATE *state=code_state();
- state->u_line = _line_;
- state->u_keyword = (char*) keyword;
-}
-
-
-/*
- * FUNCTION
- *
- * _db_doprnt_ handle print of debug lines
- *
- * SYNOPSIS
- *
- * VOID _db_doprnt_ (format, va_alist)
- * char *format;
- * va_dcl;
- *
- * DESCRIPTION
- *
- * When invoked via one of the DBUG macros, tests the current keyword
- * set by calling _db_pargs_() to see if that macro has been selected
- * for processing via the debugger control string, and if so, handles
- * printing of the arguments via the format string. The line number
- * of the DBUG macro in the source is found in u_line.
- *
- * Note that the format string SHOULD NOT include a terminating
- * newline, this is supplied automatically.
- *
- */
-
-#include <stdarg.h>
-
-void _db_doprnt_ (const char *format,...)
-{
- va_list args;
- CODE_STATE *state;
- state=code_state();
-
- va_start(args,format);
-
- if (_db_keyword_ (state->u_keyword)) {
- int save_errno=errno;
- if (!state->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
- DoPrefix (state->u_line);
- if (TRACING) {
- Indent (state->level + 1);
- } else {
- (void) fprintf (_db_fp_, "%s: ", state->func);
- }
- (void) fprintf (_db_fp_, "%s: ", state->u_keyword);
- (void) vfprintf (_db_fp_, format, args);
- va_end(args);
- (void) fputc('\n',_db_fp_);
- dbug_flush(state);
- errno=save_errno;
- }
- va_end(args);
-}
-
-
-/*
- * FUNCTION
- *
- * _db_dump_ dump a string until '\0' is found
- *
- * SYNOPSIS
- *
- * void _db_dump_ (_line_,keyword,memory,length)
- * int _line_; current source line number
- * char *keyword;
- * char *memory; Memory to print
- * int length; Bytes to print
- *
- * DESCRIPTION
- * Dump N characters in a binary array.
- * Is used to examine corrputed memory or arrays.
- */
-
-void _db_dump_(
-uint _line_,
-const char *keyword,
-const char *memory,
-uint length)
-{
- int pos;
- char dbuff[90];
- CODE_STATE *state;
- state=code_state();
-
- if (_db_keyword_ ((char*) keyword))
- {
- if (!state->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
- DoPrefix (_line_);
- if (TRACING)
- {
- Indent (state->level + 1);
- pos= min(max(state->level-stack->sub_level,0)*INDENT,80);
- }
- else
- {
- fprintf(_db_fp_, "%s: ", state->func);
- }
- sprintf(dbuff,"%s: Memory: %lx Bytes: (%d)\n",
- keyword,(ulong) memory, length);
- (void) fputs(dbuff,_db_fp_);
-
- pos=0;
- while (length-- > 0)
- {
- uint tmp= *((unsigned char*) memory++);
- if ((pos+=3) >= 80)
- {
- fputc('\n',_db_fp_);
- pos=3;
- }
- fputc(_dig_vec[((tmp >> 4) & 15)], _db_fp_);
- fputc(_dig_vec[tmp & 15], _db_fp_);
- fputc(' ',_db_fp_);
- }
- (void) fputc('\n',_db_fp_);
- dbug_flush(state);
- }
-}
-
-/*
- * FUNCTION
- *
- * ListParse parse list of modifiers in debug control string
- *
- * SYNOPSIS
- *
- * static struct link *ListParse (ctlp)
- * char *ctlp;
- *
- * DESCRIPTION
- *
- * Given pointer to a comma separated list of strings in "cltp",
- * parses the list, building a list and returning a pointer to it.
- * The original comma separated list is destroyed in the process of
- * building the linked list, thus it had better be a duplicate
- * if it is important.
- *
- * Note that since each link is added at the head of the list,
- * the final list will be in "reverse order", which is not
- * significant for our usage here.
- *
- */
-
-static struct link *ListParse (
-char *ctlp)
-{
- REGISTER char *start;
- REGISTER struct link *new_malloc;
- REGISTER struct link *head;
-
- head = NULL;
- while (*ctlp != EOS) {
- start = ctlp;
- while (*ctlp != EOS && *ctlp != ',') {
- ctlp++;
- }
- if (*ctlp == ',') {
- *ctlp++ = EOS;
- }
- new_malloc = (struct link *) DbugMalloc (sizeof (struct link));
- new_malloc -> str = StrDup (start);
- new_malloc -> next_link = head;
- head = new_malloc;
- }
- return (head);
-}
-
-/*
- * FUNCTION
- *
- * InList test a given string for member of a given list
- *
- * SYNOPSIS
- *
- * static BOOLEAN InList (linkp, cp)
- * struct link *linkp;
- * char *cp;
- *
- * DESCRIPTION
- *
- * Tests the string pointed to by "cp" to determine if it is in
- * the list pointed to by "linkp". Linkp points to the first
- * link in the list. If linkp is NULL then the string is treated
- * as if it is in the list (I.E all strings are in the null list).
- * This may seem rather strange at first but leads to the desired
- * operation if no list is given. The net effect is that all
- * strings will be accepted when there is no list, and when there
- * is a list, only those strings in the list will be accepted.
- *
- */
-
-static BOOLEAN InList (
-struct link *linkp,
-const char *cp)
-{
- REGISTER struct link *scan;
- REGISTER BOOLEAN result;
-
- if (linkp == NULL) {
- result = TRUE;
- } else {
- result = FALSE;
- for (scan = linkp; scan != NULL; scan = scan -> next_link) {
- if (STREQ (scan -> str, cp)) {
- result = TRUE;
- break;
- }
- }
- }
- return (result);
-}
-
-
-/*
- * FUNCTION
- *
- * PushState push current state onto stack and set up new one
- *
- * SYNOPSIS
- *
- * static VOID PushState ()
- *
- * DESCRIPTION
- *
- * Pushes the current state on the state stack, and initializes
- * a new state. The only parameter inherited from the previous
- * state is the function nesting level. This action can be
- * inhibited if desired, via the "r" flag.
- *
- * The state stack is a linked list of states, with the new
- * state added at the head. This allows the stack to grow
- * to the limits of memory if necessary.
- *
- */
-
-static void PushState ()
-{
- REGISTER struct state *new_malloc;
-
- if (!init_done)
- {
- init_dbug_state();
- init_done=TRUE;
- }
- (void) code_state(); /* Alloc memory */
- new_malloc = (struct state *) DbugMalloc (sizeof (struct state));
- new_malloc -> flags = 0;
- new_malloc -> delay = 0;
- new_malloc -> maxdepth = MAXDEPTH;
- new_malloc -> sub_level=0;
- new_malloc -> out_file = stderr;
- new_malloc -> prof_file = (FILE*) 0;
- new_malloc -> functions = NULL;
- new_malloc -> p_functions = NULL;
- new_malloc -> keywords = NULL;
- new_malloc -> processes = NULL;
- new_malloc -> next_state = stack;
- stack=new_malloc;
-}
-
-
-/*
- * FUNCTION
- *
- * DoTrace check to see if tracing is current enabled
- *
- * SYNOPSIS
- *
- * static BOOLEAN DoTrace (stack)
- *
- * DESCRIPTION
- *
- * Checks to see if tracing is enabled based on whether the
- * user has specified tracing, the maximum trace depth has
- * not yet been reached, the current function is selected,
- * and the current process is selected. Returns TRUE if
- * tracing is enabled, FALSE otherwise.
- *
- */
-
-static BOOLEAN DoTrace (CODE_STATE *state)
-{
- reg2 BOOLEAN trace=FALSE;
-
- if (TRACING &&
- state->level <= stack -> maxdepth &&
- InList (stack -> functions, state->func) &&
- InList (stack -> processes, _db_process_))
- trace = TRUE;
- return (trace);
-}
-
-
-/*
- * FUNCTION
- *
- * DoProfile check to see if profiling is current enabled
- *
- * SYNOPSIS
- *
- * static BOOLEAN DoProfile ()
- *
- * DESCRIPTION
- *
- * Checks to see if profiling is enabled based on whether the
- * user has specified profiling, the maximum trace depth has
- * not yet been reached, the current function is selected,
- * and the current process is selected. Returns TRUE if
- * profiling is enabled, FALSE otherwise.
- *
- */
-
-#ifndef THREAD
-static BOOLEAN DoProfile ()
-{
- REGISTER BOOLEAN profile;
- CODE_STATE *state;
- state=code_state();
-
- profile = FALSE;
- if (PROFILING &&
- state->level <= stack -> maxdepth &&
- InList (stack -> p_functions, state->func) &&
- InList (stack -> processes, _db_process_))
- profile = TRUE;
- return (profile);
-}
-#endif
-
-
-/*
- * FUNCTION
- *
- * _db_keyword_ test keyword for member of keyword list
- *
- * SYNOPSIS
- *
- * BOOLEAN _db_keyword_ (keyword)
- * char *keyword;
- *
- * DESCRIPTION
- *
- * Test a keyword to determine if it is in the currently active
- * keyword list. As with the function list, a keyword is accepted
- * if the list is null, otherwise it must match one of the list
- * members. When debugging is not on, no keywords are accepted.
- * After the maximum trace level is exceeded, no keywords are
- * accepted (this behavior subject to change). Additionally,
- * the current function and process must be accepted based on
- * their respective lists.
- *
- * Returns TRUE if keyword accepted, FALSE otherwise.
- *
- */
-
-BOOLEAN _db_keyword_ (
-const char *keyword)
-{
- REGISTER BOOLEAN result;
- CODE_STATE *state;
-
- if (!init_done)
- _db_push_ ("");
- state=code_state();
- result = FALSE;
- if (DEBUGGING &&
- state->level <= stack -> maxdepth &&
- InList (stack -> functions, state->func) &&
- InList (stack -> keywords, keyword) &&
- InList (stack -> processes, _db_process_))
- result = TRUE;
- return (result);
-}
-
-/*
- * FUNCTION
- *
- * Indent indent a line to the given indentation level
- *
- * SYNOPSIS
- *
- * static VOID Indent (indent)
- * int indent;
- *
- * DESCRIPTION
- *
- * Indent a line to the given level. Note that this is
- * a simple minded but portable implementation.
- * There are better ways.
- *
- * Also, the indent must be scaled by the compile time option
- * of character positions per nesting level.
- *
- */
-
-static void Indent (
-int indent)
-{
- REGISTER int count;
-
- indent= max(indent-1-stack->sub_level,0)*INDENT;
- for (count = 0; count < indent ; count++)
- {
- if ((count % INDENT) == 0)
- fputc('|',_db_fp_);
- else
- fputc(' ',_db_fp_);
- }
-}
-
-
-/*
- * FUNCTION
- *
- * FreeList free all memory associated with a linked list
- *
- * SYNOPSIS
- *
- * static VOID FreeList (linkp)
- * struct link *linkp;
- *
- * DESCRIPTION
- *
- * Given pointer to the head of a linked list, frees all
- * memory held by the list and the members of the list.
- *
- */
-
-static void FreeList (
-struct link *linkp)
-{
- REGISTER struct link *old;
-
- while (linkp != NULL) {
- old = linkp;
- linkp = linkp -> next_link;
- if (old -> str != NULL) {
- free (old -> str);
- }
- free ((char *) old);
- }
-}
-
-
-/*
- * FUNCTION
- *
- * StrDup make a duplicate of a string in new memory
- *
- * SYNOPSIS
- *
- * static char *StrDup (my_string)
- * char *string;
- *
- * DESCRIPTION
- *
- * Given pointer to a string, allocates sufficient memory to make
- * a duplicate copy, and copies the string to the newly allocated
- * memory. Failure to allocated sufficient memory is immediately
- * fatal.
- *
- */
-
-
-static char *StrDup (
-const char *str)
-{
- reg1 char *new_malloc;
- new_malloc = DbugMalloc ((int) strlen (str) + 1);
- (void) strcpy (new_malloc, str);
- return (new_malloc);
-}
-
-
-/*
- * FUNCTION
- *
- * DoPrefix print debugger line prefix prior to indentation
- *
- * SYNOPSIS
- *
- * static VOID DoPrefix (_line_)
- * int _line_;
- *
- * DESCRIPTION
- *
- * Print prefix common to all debugger output lines, prior to
- * doing indentation if necessary. Print such information as
- * current process name, current source file name and line number,
- * and current function nesting depth.
- *
- */
-
-static void DoPrefix (
-uint _line_)
-{
- CODE_STATE *state;
- state=code_state();
-
- state->lineno++;
- if (stack -> flags & PID_ON) {
-#ifdef THREAD
- (void) fprintf (_db_fp_, "%-7s: ", my_thread_name());
-#else
- (void) fprintf (_db_fp_, "%5d: ", (int) getpid ());
-#endif
- }
- if (stack -> flags & NUMBER_ON) {
- (void) fprintf (_db_fp_, "%5d: ", state->lineno);
- }
- if (stack -> flags & PROCESS_ON) {
- (void) fprintf (_db_fp_, "%s: ", _db_process_);
- }
- if (stack -> flags & FILE_ON) {
- (void) fprintf (_db_fp_, "%14s: ", BaseName(state->file));
- }
- if (stack -> flags & LINE_ON) {
- (void) fprintf (_db_fp_, "%5d: ", _line_);
- }
- if (stack -> flags & DEPTH_ON) {
- (void) fprintf (_db_fp_, "%4d: ", state->level);
- }
-}
-
-
-/*
- * FUNCTION
- *
- * DBUGOpenFile open new output stream for debugger output
- *
- * SYNOPSIS
- *
- * static VOID DBUGOpenFile (name)
- * char *name;
- *
- * DESCRIPTION
- *
- * Given name of a new file (or "-" for stdout) opens the file
- * and sets the output stream to the new file.
- *
- */
-
-static void DBUGOpenFile (const char *name,int append)
-{
- REGISTER FILE *fp;
- REGISTER BOOLEAN newfile;
-
- if (name != NULL)
- {
- strmov(stack->name,name);
- if (strcmp (name, "-") == 0)
- {
- _db_fp_ = stdout;
- stack -> out_file = _db_fp_;
- stack -> flags |= FLUSH_ON_WRITE;
- }
- else
- {
- if (!Writable((char*)name))
- {
- (void) fprintf (stderr, ERR_OPEN, _db_process_, name);
- perror ("");
- fflush(stderr);
- }
- else
- {
- newfile= !EXISTS (name);
- if (!(fp = fopen(name, append ? "a+" : "w")))
- {
- (void) fprintf (stderr, ERR_OPEN, _db_process_, name);
- perror ("");
- fflush(stderr);
- }
- else
- {
- _db_fp_ = fp;
- stack -> out_file = fp;
- if (newfile) {
- ChangeOwner (name);
- }
- }
- }
- }
- }
-}
-
-
-/*
- * FUNCTION
- *
- * OpenProfile open new output stream for profiler output
- *
- * SYNOPSIS
- *
- * static FILE *OpenProfile (name)
- * char *name;
- *
- * DESCRIPTION
- *
- * Given name of a new file, opens the file
- * and sets the profiler output stream to the new file.
- *
- * It is currently unclear whether the prefered behavior is
- * to truncate any existing file, or simply append to it.
- * The latter behavior would be desirable for collecting
- * accumulated runtime history over a number of separate
- * runs. It might take some changes to the analyzer program
- * though, and the notes that Binayak sent with the profiling
- * diffs indicated that append was the normal mode, but this
- * does not appear to agree with the actual code. I haven't
- * investigated at this time [fnf; 24-Jul-87].
- */
-
-#ifndef THREAD
-static FILE *OpenProfile (const char *name)
-{
- REGISTER FILE *fp;
- REGISTER BOOLEAN newfile;
-
- fp=0;
- if (!Writable (name))
- {
- (void) fprintf (_db_fp_, ERR_OPEN, _db_process_, name);
- perror ("");
- dbug_flush(0);
- (void) Delay (stack -> delay);
- }
- else
- {
- newfile= !EXISTS (name);
- if (!(fp = fopen (name, "w")))
- {
- (void) fprintf (_db_fp_, ERR_OPEN, _db_process_, name);
- perror ("");
- dbug_flush(0);
- }
- else
- {
- _db_pfp_ = fp;
- stack -> prof_file = fp;
- if (newfile)
- {
- ChangeOwner (name);
- }
- }
- }
- return fp;
-}
-#endif
-
-/*
- * FUNCTION
- *
- * CloseFile close the debug output stream
- *
- * SYNOPSIS
- *
- * static VOID CloseFile (fp)
- * FILE *fp;
- *
- * DESCRIPTION
- *
- * Closes the debug output stream unless it is standard output
- * or standard error.
- *
- */
-
-static void CloseFile (
-FILE *fp)
-{
- if (fp != stderr && fp != stdout) {
- if (fclose (fp) == EOF) {
- pthread_mutex_lock(&THR_LOCK_dbug);
- (void) fprintf (_db_fp_, ERR_CLOSE, _db_process_);
- perror ("");
- dbug_flush(0);
- }
- }
-}
-
-
-/*
- * FUNCTION
- *
- * DbugExit print error message and exit
- *
- * SYNOPSIS
- *
- * static VOID DbugExit (why)
- * char *why;
- *
- * DESCRIPTION
- *
- * Prints error message using current process name, the reason for
- * aborting (typically out of memory), and exits with status 1.
- * This should probably be changed to use a status code
- * defined in the user's debugger include file.
- *
- */
-
-static void DbugExit (const char *why)
-{
- (void) fprintf (stderr, ERR_ABORT, _db_process_, why);
- (void) fflush (stderr);
- exit (1);
-}
-
-
-/*
- * FUNCTION
- *
- * DbugMalloc allocate memory for debugger runtime support
- *
- * SYNOPSIS
- *
- * static long *DbugMalloc (size)
- * int size;
- *
- * DESCRIPTION
- *
- * Allocate more memory for debugger runtime support functions.
- * Failure to to allocate the requested number of bytes is
- * immediately fatal to the current process. This may be
- * rather unfriendly behavior. It might be better to simply
- * print a warning message, freeze the current debugger state,
- * and continue execution.
- *
- */
-
-static char *DbugMalloc (
-int size)
-{
- register char *new_malloc;
-
- if (!(new_malloc = (char*) malloc ((unsigned int) size)))
- DbugExit ("out of memory");
- return (new_malloc);
-}
-
-
-/*
- * As strtok but two separators in a row are changed to one
- * separator (to allow directory-paths in dos).
- */
-
-static char *static_strtok (
-char *s1,
-pchar separator)
-{
- static char *end = NULL;
- reg1 char *rtnval,*cpy;
-
- rtnval = NULL;
- if (s1 != NULL)
- end = s1;
- if (end != NULL && *end != EOS)
- {
- rtnval=cpy=end;
- do
- {
- if ((*cpy++ = *end++) == separator)
- {
- if (*end != separator)
- {
- cpy--; /* Point at separator */
- break;
- }
- end++; /* Two separators in a row, skipp one */
- }
- } while (*end != EOS);
- *cpy=EOS; /* Replace last separator */
- }
- return (rtnval);
-}
-
-
-/*
- * FUNCTION
- *
- * BaseName strip leading pathname components from name
- *
- * SYNOPSIS
- *
- * static char *BaseName (pathname)
- * char *pathname;
- *
- * DESCRIPTION
- *
- * Given pointer to a complete pathname, locates the base file
- * name at the end of the pathname and returns a pointer to
- * it.
- *
- */
-
-static char *BaseName (const char *pathname)
-{
- register const char *base;
-
- base = strrchr (pathname, FN_LIBCHAR);
- if (base++ == NullS)
- base = pathname;
- return ((char*) base);
-}
-
-
-/*
- * FUNCTION
- *
- * Writable test to see if a pathname is writable/creatable
- *
- * SYNOPSIS
- *
- * static BOOLEAN Writable (pathname)
- * char *pathname;
- *
- * DESCRIPTION
- *
- * Because the debugger might be linked in with a program that
- * runs with the set-uid-bit (suid) set, we have to be careful
- * about opening a user named file for debug output. This consists
- * of checking the file for write access with the real user id,
- * or checking the directory where the file will be created.
- *
- * Returns TRUE if the user would normally be allowed write or
- * create access to the named file. Returns FALSE otherwise.
- *
- */
-
-
-#ifndef Writable
-
-static BOOLEAN Writable (
-char *pathname)
-{
- REGISTER BOOLEAN granted;
- REGISTER char *lastslash;
-
- granted = FALSE;
- if (EXISTS (pathname)) {
- if (WRITABLE (pathname)) {
- granted = TRUE;
- }
- } else {
- lastslash = strrchr (pathname, '/');
- if (lastslash != NULL) {
- *lastslash = EOS;
- } else {
- pathname = ".";
- }
- if (WRITABLE (pathname)) {
- granted = TRUE;
- }
- if (lastslash != NULL) {
- *lastslash = '/';
- }
- }
- return (granted);
-}
-#endif
-
-
-/*
- * FUNCTION
- *
- * ChangeOwner change owner to real user for suid programs
- *
- * SYNOPSIS
- *
- * static VOID ChangeOwner (pathname)
- *
- * DESCRIPTION
- *
- * For unix systems, change the owner of the newly created debug
- * file to the real owner. This is strictly for the benefit of
- * programs that are running with the set-user-id bit set.
- *
- * Note that at this point, the fact that pathname represents
- * a newly created file has already been established. If the
- * program that the debugger is linked to is not running with
- * the suid bit set, then this operation is redundant (but
- * harmless).
- *
- */
-
-#ifndef ChangeOwner
-static void ChangeOwner (
-char *pathname)
-{
- if (chown (pathname, getuid (), getgid ()) == -1)
- {
- (void) fprintf (stderr, ERR_CHOWN, _db_process_, pathname);
- perror ("");
- (void) fflush (stderr);
- }
-}
-#endif
-
-
-/*
- * FUNCTION
- *
- * _db_setjmp_ save debugger environment
- *
- * SYNOPSIS
- *
- * VOID _db_setjmp_ ()
- *
- * DESCRIPTION
- *
- * Invoked as part of the user's DBUG_SETJMP macro to save
- * the debugger environment in parallel with saving the user's
- * environment.
- *
- */
-
-#ifdef HAVE_LONGJMP
-
-EXPORT void _db_setjmp_ ()
-{
- CODE_STATE *state;
- state=code_state();
-
- state->jmplevel = state->level;
- state->jmpfunc = state->func;
- state->jmpfile = state->file;
-}
-
-/*
- * FUNCTION
- *
- * _db_longjmp_ restore previously saved debugger environment
- *
- * SYNOPSIS
- *
- * VOID _db_longjmp_ ()
- *
- * DESCRIPTION
- *
- * Invoked as part of the user's DBUG_LONGJMP macro to restore
- * the debugger environment in parallel with restoring the user's
- * previously saved environment.
- *
- */
-
-EXPORT void _db_longjmp_ ()
-{
- CODE_STATE *state;
- state=code_state();
-
- state->level = state->jmplevel;
- if (state->jmpfunc) {
- state->func = state->jmpfunc;
- }
- if (state->jmpfile) {
- state->file = state->jmpfile;
- }
-}
-#endif
-
-/*
- * FUNCTION
- *
- * DelayArg convert D flag argument to appropriate value
- *
- * SYNOPSIS
- *
- * static int DelayArg (value)
- * int value;
- *
- * DESCRIPTION
- *
- * Converts delay argument, given in tenths of a second, to the
- * appropriate numerical argument used by the system to delay
- * that that many tenths of a second. For example, on the
- * amiga, there is a system call "Delay()" which takes an
- * argument in ticks (50 per second). On unix, the sleep
- * command takes seconds. Thus a value of "10", for one
- * second of delay, gets converted to 50 on the amiga, and 1
- * on unix. Other systems will need to use a timing loop.
- *
- */
-
-#ifdef AMIGA
-#define HZ (50) /* Probably in some header somewhere */
-#endif
-
-static int DelayArg (
-int value)
-{
- uint delayarg = 0;
-
-#if (unix || xenix)
- delayarg = value / 10; /* Delay is in seconds for sleep () */
-#endif
-#ifdef AMIGA
- delayarg = (HZ * value) / 10; /* Delay in ticks for Delay () */
-#endif
- return (delayarg);
-}
-
-
-/*
- * A dummy delay stub for systems that do not support delays.
- * With a little work, this can be turned into a timing loop.
- */
-
-#if ! defined(Delay) && ! defined(AMIGA)
-static int Delay (
-int ticks)
-{
- return ticks;
-}
-#endif
-
-
-/*
- * FUNCTION
- *
- * perror perror simulation for systems that don't have it
- *
- * SYNOPSIS
- *
- * static VOID perror (s)
- * char *s;
- *
- * DESCRIPTION
- *
- * Perror produces a message on the standard error stream which
- * provides more information about the library or system error
- * just encountered. The argument string s is printed, followed
- * by a ':', a blank, and then a message and a newline.
- *
- * An undocumented feature of the unix perror is that if the string
- * 's' is a null string (NOT a NULL pointer!), then the ':' and
- * blank are not printed.
- *
- * This version just complains about an "unknown system error".
- *
- */
-
-#ifndef HAVE_PERROR
-static void perror (s)
-char *s;
-{
- if (s && *s != EOS) {
- (void) fprintf (stderr, "%s: ", s);
- }
- (void) fprintf (stderr, "<unknown system error>\n");
-}
-#endif /* HAVE_PERROR */
-
-
- /* flush dbug-stream, free mutex lock & wait delay */
- /* This is because some systems (MSDOS!!) dosn't flush fileheader */
- /* and dbug-file isn't readable after a system crash !! */
-
-static void dbug_flush(CODE_STATE *state)
-{
-#ifndef THREAD
- if (stack->flags & FLUSH_ON_WRITE)
-#endif
- {
-#if defined(MSDOS) || defined(__WIN__)
- if (_db_fp_ != stdout && _db_fp_ != stderr)
- {
- if (!(freopen(stack->name,"a",_db_fp_)))
- {
- (void) fprintf(stderr, ERR_OPEN, _db_process_);
- fflush(stderr);
- _db_fp_ = stdout;
- stack -> out_file = _db_fp_;
- stack -> flags|=FLUSH_ON_WRITE;
- }
- }
- else
-#endif
- {
- (void) fflush (_db_fp_);
- if (stack->delay)
- (void) Delay (stack->delay);
- }
- }
- if (!state || !state->locked)
- pthread_mutex_unlock(&THR_LOCK_dbug);
-} /* dbug_flush */
-
-
-void _db_lock_file()
-{
- CODE_STATE *state;
- state=code_state();
- pthread_mutex_lock(&THR_LOCK_dbug);
- state->locked=1;
-}
-
-void _db_unlock_file()
-{
- CODE_STATE *state;
- state=code_state();
- state->locked=0;
- pthread_mutex_unlock(&THR_LOCK_dbug);
-}
-
-/*
- * Here we need the definitions of the clock routine. Add your
- * own for whatever system that you have.
- */
-
-#ifndef THREAD
-#if defined(HAVE_GETRUSAGE)
-
-#include <sys/param.h>
-#include <sys/resource.h>
-
-/* extern int getrusage(int, struct rusage *); */
-
-/*
- * Returns the user time in milliseconds used by this process so
- * far.
- */
-
-static unsigned long Clock ()
-{
- struct rusage ru;
-
- (void) getrusage (RUSAGE_SELF, &ru);
- return ((ru.ru_utime.tv_sec * 1000) + (ru.ru_utime.tv_usec / 1000));
-}
-
-#elif defined(MSDOS) || defined(__WIN__) || defined(OS2)
-
-static ulong Clock()
-{
- return clock()*(1000/CLOCKS_PER_SEC);
-}
-#elif defined (amiga)
-
-struct DateStamp { /* Yes, this is a hack, but doing it right */
- long ds_Days; /* is incredibly ugly without splitting this */
- long ds_Minute; /* off into a separate file */
- long ds_Tick;
-};
-
-static int first_clock = TRUE;
-static struct DateStamp begin;
-static struct DateStamp elapsed;
-
-static unsigned long Clock ()
-{
- register struct DateStamp *now;
- register unsigned long millisec = 0;
- extern VOID *AllocMem ();
-
- now = (struct DateStamp *) AllocMem ((long) sizeof (struct DateStamp), 0L);
- if (now != NULL) {
- if (first_clock == TRUE) {
- first_clock = FALSE;
- (void) DateStamp (now);
- begin = *now;
- }
- (void) DateStamp (now);
- millisec = 24 * 3600 * (1000 / HZ) * (now -> ds_Days - begin.ds_Days);
- millisec += 60 * (1000 / HZ) * (now -> ds_Minute - begin.ds_Minute);
- millisec += (1000 / HZ) * (now -> ds_Tick - begin.ds_Tick);
- (void) FreeMem (now, (long) sizeof (struct DateStamp));
- }
- return (millisec);
-}
-#else
-static unsigned long Clock ()
-{
- return (0);
-}
-#endif /* RUSAGE */
-#endif /* THREADS */
-
-#ifdef NO_VARARGS
-
-/*
- * Fake vfprintf for systems that don't support it. If this
- * doesn't work, you are probably SOL...
- */
-
-static int vfprintf (stream, format, ap)
-FILE *stream;
-char *format;
-va_list ap;
-{
- int rtnval;
- ARGS_DCL;
-
- ARG0 = va_arg (ap, ARGS_TYPE);
- ARG1 = va_arg (ap, ARGS_TYPE);
- ARG2 = va_arg (ap, ARGS_TYPE);
- ARG3 = va_arg (ap, ARGS_TYPE);
- ARG4 = va_arg (ap, ARGS_TYPE);
- ARG5 = va_arg (ap, ARGS_TYPE);
- ARG6 = va_arg (ap, ARGS_TYPE);
- ARG7 = va_arg (ap, ARGS_TYPE);
- ARG8 = va_arg (ap, ARGS_TYPE);
- ARG9 = va_arg (ap, ARGS_TYPE);
- rtnval = fprintf (stream, format, ARGS_LIST);
- return (rtnval);
-}
-
-#endif /* NO_VARARGS */
diff --git a/ext/mysql/libmysql/dbug.h b/ext/mysql/libmysql/dbug.h
deleted file mode 100644
index aa45079eab..0000000000
--- a/ext/mysql/libmysql/dbug.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#ifndef _dbug_h
-#define _dbug_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-#if !defined(DBUG_OFF) && !defined(_lint)
-extern int _db_on_,_no_db_;
-extern FILE *_db_fp_;
-extern char *_db_process_;
-extern int _db_keyword_(const char *keyword);
-extern void _db_setjmp_(void);
-extern void _db_longjmp_(void);
-extern void _db_push_(const char *control);
-extern void _db_pop_(void);
-extern void _db_enter_(const char *_func_,const char *_file_,uint _line_,
- const char **_sfunc_,const char **_sfile_,
- uint *_slevel_, char ***);
-extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_,
- uint *_slevel_);
-extern void _db_pargs_(uint _line_,const char *keyword);
-extern void _db_doprnt_ _VARARGS((const char *format,...));
-extern void _db_dump_(uint _line_,const char *keyword,const char *memory,
- uint length);
-extern void _db_lock_file();
-extern void _db_unlock_file();
-
-#define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \
- char **_db_framep_; \
- _db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \
- &_db_framep_)
-#define DBUG_LEAVE \
- (_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_))
-#define DBUG_RETURN(a1) {DBUG_LEAVE; return(a1);}
-#define DBUG_VOID_RETURN {DBUG_LEAVE; return;}
-#define DBUG_EXECUTE(keyword,a1) \
- {if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}}
-#define DBUG_PRINT(keyword,arglist) \
- {if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}}
-#define DBUG_PUSH(a1) _db_push_ (a1)
-#define DBUG_POP() _db_pop_ ()
-#define DBUG_PROCESS(a1) (_db_process_ = a1)
-#define DBUG_FILE (_db_fp_)
-#define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1))
-#define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2))
-#define DBUG_DUMP(keyword,a1,a2)\
- {if (_db_on_) {_db_dump_(__LINE__,keyword,a1,a2);}}
-#define DBUG_IN_USE (_db_fp_ && _db_fp_ != stderr)
-#define DEBUGGER_OFF _no_db_=1;_db_on_=0;
-#define DEBUGGER_ON _no_db_=0
-#define DBUG_LOCK_FILE { _db_lock_file(); }
-#define DBUG_UNLOCK_FILE { _db_unlock_file(); }
-#define DBUG_ASSERT(A) assert(A)
-#else /* No debugger */
-
-#define DBUG_ENTER(a1)
-#define DBUG_RETURN(a1) return(a1)
-#define DBUG_VOID_RETURN return
-#define DBUG_EXECUTE(keyword,a1) {}
-#define DBUG_PRINT(keyword,arglist) {}
-#define DBUG_PUSH(a1) {}
-#define DBUG_POP() {}
-#define DBUG_PROCESS(a1) {}
-#define DBUG_FILE (stderr)
-#define DBUG_SETJMP setjmp
-#define DBUG_LONGJMP longjmp
-#define DBUG_DUMP(keyword,a1,a2) {}
-#define DBUG_IN_USE 0
-#define DEBUGGER_OFF
-#define DEBUGGER_ON
-#define DBUG_LOCK_FILE
-#define DBUG_UNLOCK_FILE
-#define DBUG_ASSERT(A) {}
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/ext/mysql/libmysql/default.c b/ext/mysql/libmysql/default.c
deleted file mode 100644
index 63aea98212..0000000000
--- a/ext/mysql/libmysql/default.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/****************************************************************************
-** Add all options from files named "group".cnf from the default_directories
-** before the command line arguments.
-** On Windows defaults will also search in the Windows directory for a file
-** called 'group'.ini
-** As long as the program uses the last argument for conflicting
-** options one only have to add a call to "load_defaults" to enable
-** use of default values.
-** pre- and end 'blank space' are removed from options and values. The
-** following escape sequences are recognized in values: \b \t \n \r \\
-**
-** The following arguments are handled automaticly; If used, they must be
-** first argument on the command line!
-** --no-defaults ; no options are read.
-** --defaults-file=full-path-to-default-file ; Only this file will be read.
-** --defaults-extra-file=full-path-to-default-file ; Read this file before ~/
-** --print-defaults ; Print the modified command line and exit
-****************************************************************************/
-
-#undef SAFEMALLOC /* safe_malloc is not yet initailized */
-
-#include "mysys_priv.h"
-#include "m_string.h"
-#include "m_ctype.h"
-
-char *defaults_extra_file=0;
-
-/* Which directories are searched for options (and in which order) */
-
-const char *default_directories[]= {
-#ifdef __WIN__
-"C:/",
-#else
-"/etc/",
-#endif
-#ifdef DATADIR
-DATADIR,
-#endif
-"", /* Place for defaults_extra_dir */
-#ifndef __WIN__
-"~/",
-#endif
-NullS,
-};
-
-#define default_ext ".cnf" /* extension for config file */
-#ifdef __WIN__
-#include <winbase.h>
-#define windows_ext ".ini"
-#endif
-
-static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
- const char *dir, const char *config_file,
- const char *ext, TYPELIB *group);
-
-
-void load_defaults(const char *conf_file, const char **groups,
- int *argc, char ***argv)
-{
- DYNAMIC_ARRAY args;
- const char **dirs, *forced_default_file;
- TYPELIB group;
- my_bool found_print_defaults=0;
- uint args_used=0;
- MEM_ROOT alloc;
- char *ptr,**res;
- DBUG_ENTER("load_defaults");
-
- init_alloc_root(&alloc,128,0);
- if (*argc >= 2 && !strcmp(argv[0][1],"--no-defaults"))
- {
- /* remove the --no-defaults argument and return only the other arguments */
- uint i;
- if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+
- (*argc + 1)*sizeof(char*))))
- goto err;
- res= (char**) (ptr+sizeof(alloc));
- res[0]= **argv; /* Copy program name */
- for (i=2 ; i < (uint) *argc ; i++)
- res[i-1]=argv[0][i];
- (*argc)--;
- *argv=res;
- *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
- DBUG_VOID_RETURN;
- }
-
- /* Check if we want to force the use a specific default file */
- forced_default_file=0;
- if (*argc >= 2)
- {
- if (is_prefix(argv[0][1],"--defaults-file="))
- {
- forced_default_file=strchr(argv[0][1],'=')+1;
- args_used++;
- }
- else if (is_prefix(argv[0][1],"--defaults-extra-file="))
- {
- defaults_extra_file=strchr(argv[0][1],'=')+1;
- args_used++;
- }
- }
-
- group.count=0;
- group.name= "defaults";
- group.type_names= groups;
- for (; *groups ; groups++)
- group.count++;
-
- if (init_dynamic_array(&args, sizeof(char*),*argc, 32))
- goto err;
- if (forced_default_file)
- {
- if (search_default_file(&args, &alloc, "", forced_default_file, "",
- &group))
- goto err;
- }
- else if (dirname_length(conf_file))
- {
- if (search_default_file(&args, &alloc, NullS, conf_file, default_ext,
- &group))
- goto err;
- }
- else
- {
-#ifdef __WIN__
- char system_dir[FN_REFLEN];
- GetWindowsDirectory(system_dir,sizeof(system_dir));
- if (search_default_file(&args, &alloc, system_dir, conf_file, windows_ext,
- &group))
- goto err;
-#endif
-#if defined(__EMX__) || defined(OS2)
- if (getenv("ETC") &&
- search_default_file(&args, &alloc, getenv("ETC"), conf_file,
- default_ext, &group))
- goto err;
-#endif
- for (dirs=default_directories ; *dirs; dirs++)
- {
- int error=0;
- if (**dirs)
- error=search_default_file(&args, &alloc, *dirs, conf_file,
- default_ext, &group);
- else if (defaults_extra_file)
- error=search_default_file(&args, &alloc, NullS, defaults_extra_file,
- default_ext, &group);
- if (error)
- goto err;
- }
- }
- if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+
- (args.elements + *argc +1) *sizeof(char*))))
- goto err;
- res= (char**) (ptr+sizeof(alloc));
-
- /* copy name + found arguments + command line arguments to new array */
- res[0]=argv[0][0];
- memcpy((gptr) (res+1), args.buffer, args.elements*sizeof(char*));
- /* Skipp --defaults-file and --defaults-extra-file */
- (*argc)-= args_used;
- (*argv)+= args_used;
-
- /* Check if we wan't to see the new argument list */
- if (*argc >= 2 && !strcmp(argv[0][1],"--print-defaults"))
- {
- found_print_defaults=1;
- --*argc; ++*argv; /* skipp argument */
- }
-
- memcpy((gptr) (res+1+args.elements), (char*) ((*argv)+1),
- (*argc-1)*sizeof(char*));
- res[args.elements+ *argc]=0; /* last null */
-
- (*argc)+=args.elements;
- *argv= (char**) res;
- *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
- delete_dynamic(&args);
- if (found_print_defaults)
- {
- int i;
- printf("%s would have been started with the following arguments:\n",
- **argv);
- for (i=1 ; i < *argc ; i++)
- printf("%s ", (*argv)[i]);
- puts("");
- exit(1);
- }
- DBUG_VOID_RETURN;
-
- err:
- fprintf(stderr,"Program aborted\n");
- exit(1);
-}
-
-
-void free_defaults(char **argv)
-{
- MEM_ROOT ptr;
- memcpy_fixed((char*) &ptr,(char *) argv - sizeof(ptr), sizeof(ptr));
- free_root(&ptr,MYF(0));
-}
-
-
-static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
- const char *dir, const char *config_file,
- const char *ext, TYPELIB *group)
-{
- char name[FN_REFLEN+10],buff[4096],*ptr,*end,*value,*tmp;
- FILE *fp;
- uint line=0;
- my_bool read_values=0,found_group=0;
-
- if ((dir ? strlen(dir) : 0 )+strlen(config_file) >= FN_REFLEN-3)
- return 0; /* Ignore wrong paths */
- if (dir)
- {
- strmov(name,dir);
- convert_dirname(name);
- if (dir[0] == FN_HOMELIB) /* Add . to filenames in home */
- strcat(name,".");
- strxmov(strend(name),config_file,ext,NullS);
- }
- else
- {
- strmov(name,config_file);
- }
- if (!(fp = my_fopen(fn_format(name,name,"","",4),O_RDONLY,MYF(0))))
- return 0; /* Ignore wrong files */
-
- while (fgets(buff,sizeof(buff)-1,fp))
- {
- line++;
- /* Ignore comment and empty lines */
- for (ptr=buff ; isspace(*ptr) ; ptr++ ) ;
- if (*ptr == '#' || *ptr == ';' || !*ptr)
- continue;
- if (*ptr == '[') /* Group name */
- {
- found_group=1;
- if (!(end=(char *) strchr(++ptr,']')))
- {
- fprintf(stderr,
- "error: Wrong group definition in config file: %s at line %d\n",
- name,line);
- goto err;
- }
- for ( ; isspace(end[-1]) ; end--) ; /* Remove end space */
- end[0]=0;
- read_values=find_type(ptr,group,3) > 0;
- continue;
- }
- if (!found_group)
- {
- fprintf(stderr,
- "error: Found option without preceding group in config file: %s at line: %d\n",
- name,line);
- goto err;
- }
- if (!read_values)
- continue;
- if (!(end=value=strchr(ptr,'=')))
- end=strend(ptr); /* Option without argument */
- for ( ; isspace(end[-1]) ; end--) ;
- if (!value)
- {
- if (!(tmp=alloc_root(alloc,(uint) (end-ptr)+3)))
- goto err;
- strmake(strmov(tmp,"--"),ptr,(uint) (end-ptr));
- if (insert_dynamic(args,(gptr) &tmp))
- goto err;
- }
- else
- {
- /* Remove pre- and end space */
- char *value_end;
- for (value++ ; isspace(*value); value++) ;
- value_end=strend(value);
- for ( ; isspace(value_end[-1]) ; value_end--) ;
- if (value_end < value) /* Empty string */
- value_end=value;
- if (!(tmp=alloc_root(alloc,(uint) (end-ptr)+3 +
- (uint) (value_end-value)+1)))
- goto err;
- if (insert_dynamic(args,(gptr) &tmp))
- goto err;
- ptr=strnmov(strmov(tmp,"--"),ptr,(uint) (end-ptr));
- *ptr++= '=';
- for ( ; value != value_end; value++)
- {
- if (*value == '\\' && value != value_end-1)
- {
- switch(*++value) {
- case 'n':
- *ptr++='\n';
- break;
- case 't':
- *ptr++= '\t';
- break;
- case 'r':
- *ptr++ = '\r';
- break;
- case 'b':
- *ptr++ = '\b';
- break;
- case 's':
- *ptr++= ' '; /* space */
- break;
- case '\\':
- *ptr++= '\\';
- break;
- default: /* Unknown; Keep '\' */
- *ptr++= '\\';
- *ptr++= *value;
- break;
- }
- }
- else
- *ptr++= *value;
- }
- *ptr=0;
- }
- }
- my_fclose(fp,MYF(0));
- return(0);
-
- err:
- my_fclose(fp,MYF(0));
- return 1;
-}
-
-
-void print_defaults(const char *conf_file, const char **groups)
-{
-#ifdef __WIN__
- bool have_ext=fn_ext(conf_file)[0] != 0;
-#endif
- char name[FN_REFLEN];
- const char **dirs;
- puts("\nDefault options are read from the following files in the given order:");
-
- if (dirname_length(conf_file))
- fputs(conf_file,stdout);
- else
- {
-#ifdef __WIN__
- GetWindowsDirectory(name,sizeof(name));
- printf("%s\\%s%s ",name,conf_file,have_ext ? "" : windows_ext);
-#endif
-#if defined(__EMX__) || defined(OS2)
- if (getenv("ETC"))
- printf("%s\\%s%s ", getenv("ETC"), conf_file, default_ext);
-#endif
- for (dirs=default_directories ; *dirs; dirs++)
- {
- if (**dirs)
- strmov(name,*dirs);
- else if (defaults_extra_file)
- strmov(name,defaults_extra_file);
- else
- continue;
- convert_dirname(name);
- if (name[0] == FN_HOMELIB) /* Add . to filenames in home */
- strcat(name,".");
- strxmov(strend(name),conf_file,default_ext," ",NullS);
- fputs(name,stdout);
- }
- puts("");
- }
- fputs("The following groups are read:",stdout);
- for ( ; *groups ; groups++)
- {
- fputc(' ',stdout);
- fputs(*groups,stdout);
- }
- puts("\nThe following options may be given as the first argument:\n\
---print-defaults Print the program argument list and exit\n\
---no-defaults Don't read default options from any options file\n\
---defaults-file=# Only read default options from the given file #\n\
---defaults-extra-file=# Read this file after the global files are read");
-}
-
diff --git a/ext/mysql/libmysql/dll.c b/ext/mysql/libmysql/dll.c
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/mysql/libmysql/dll.c
+++ /dev/null
diff --git a/ext/mysql/libmysql/errmsg.c b/ext/mysql/libmysql/errmsg.c
deleted file mode 100644
index 18e13b9c11..0000000000
--- a/ext/mysql/libmysql/errmsg.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Error messages for MySQL clients */
-/* error messages for the demon is in share/language/errmsg.sys */
-
-#include <global.h>
-#include <my_sys.h>
-#include "errmsg.h"
-
-#ifdef GERMAN
-const char *client_errors[]=
-{
- "Unbekannter MySQL Fehler",
- "Kann UNIX-Socket nicht anlegen (%d)",
- "Keine Verbindung zu lokalem MySQL Server, socket: '%-.64s' (%d)",
- "Keine Verbindung zu MySQL Server auf %-.64s (%d)",
- "Kann TCP/IP-Socket nicht anlegen (%d)",
- "Unbekannter MySQL Server Host (%-.64s) (%d)",
- "MySQL Server nicht vorhanden",
- "Protokolle ungleich. Server Version = % d Client Version = %d",
- "MySQL client got out of memory",
- "Wrong host info",
- "Localhost via UNIX socket",
- "%-.64s via TCP/IP",
- "Error in server handshake",
- "Lost connection to MySQL server during query",
- "Commands out of sync; You can't run this command now",
- "Verbindung ueber Named Pipe; Host: %-.64s",
- "Kann nicht auf Named Pipe warten. Host: %-.64s pipe: %-.32s (%lu)",
- "Kann Named Pipe nicht oeffnen. Host: %-.64s pipe: %-.32s (%lu)",
- "Kann den Status der Named Pipe nicht setzen. Host: %-.64s pipe: %-.32s (%lu)",
- "Can't initialize character set %-.64s (path: %-.64s)",
- "Got packet bigger than 'max_allowed_packet'"
-};
-
-/* Start of code added by Roberto M. Serqueira - martinsc@uol.com.br - 05.24.2001 */
-
-#elif defined PORTUGUESE
-const char *client_errors[]=
-{
- "Erro desconhecido do MySQL",
- "Não pode criar 'UNIX socket' (%d)",
- "Não pode se conectar ao servidor MySQL local através do 'socket' '%-.64s' (%d)",
- "Não pode se conectar ao servidor MySQL em '%-.64s' (%d)",
- "Não pode criar 'socket TCP/IP' (%d)",
- "'Host' servidor MySQL '%-.64s' (%d) desconhecido",
- "Servidor MySQL desapareceu",
- "Incompatibilidade de protocolos. Versão do Servidor: %d - Versão do Cliente: %d",
- "Cliente do MySQL com falta de memória",
- "Informação inválida de 'host'",
- "Localhost via 'UNIX socket'",
- "%-.64s via 'TCP/IP'",
- "Erro na negociação de acesso ao servidor",
- "Conexão perdida com servidor MySQL durante 'query'",
- "Comandos fora de sincronismo. Você não pode executar este comando agora",
- "%-.64s via 'named pipe'",
- "Não pode esperar pelo 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)",
- "Não pode abrir 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)",
- "Não pode estabelecer o estado do 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)",
- "Não pode inicializar conjunto de caracteres %-.64s (caminho %-.64s)",
- "Obteve pacote maior do que 'max_allowed_packet'"
-};
-
-#else /* ENGLISH */
-const char *client_errors[]=
-{
- "Unknown MySQL error",
- "Can't create UNIX socket (%d)",
- "Can't connect to local MySQL server through socket '%-.64s' (%d)",
- "Can't connect to MySQL server on '%-.64s' (%d)",
- "Can't create TCP/IP socket (%d)",
- "Unknown MySQL Server Host '%-.64s' (%d)",
- "MySQL server has gone away",
- "Protocol mismatch. Server Version = %d Client Version = %d",
- "MySQL client run out of memory",
- "Wrong host info",
- "Localhost via UNIX socket",
- "%-.64s via TCP/IP",
- "Error in server handshake",
- "Lost connection to MySQL server during query",
- "Commands out of sync; You can't run this command now",
- "%-.64s via named pipe",
- "Can't wait for named pipe to host: %-.64s pipe: %-.32s (%lu)",
- "Can't open named pipe to host: %-.64s pipe: %-.32s (%lu)",
- "Can't set state of named pipe to host: %-.64s pipe: %-.32s (%lu)",
- "Can't initialize character set %-.64s (path: %-.64s)",
- "Got packet bigger than 'max_allowed_packet'"
-};
-#endif
-
-
-void init_client_errs(void)
-{
- my_errmsg[CLIENT_ERRMAP] = &client_errors[0];
-}
diff --git a/ext/mysql/libmysql/errmsg.h b/ext/mysql/libmysql/errmsg.h
deleted file mode 100644
index 233abfca59..0000000000
--- a/ext/mysql/libmysql/errmsg.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Error messages for mysql clients */
-/* error messages for the demon is in share/language/errmsg.sys */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-void init_client_errs(void);
-extern const char *client_errors[]; /* Error messages */
-#ifdef __cplusplus
-}
-#endif
-
-#define CR_MIN_ERROR 2000 /* For easier client code */
-#define CR_MAX_ERROR 2999
-#if defined(OS2) && defined( MYSQL_SERVER)
-#define CER(X) client_errors[(X)-CR_MIN_ERROR]
-#else
-#define ER(X) client_errors[(X)-CR_MIN_ERROR]
-#endif
-#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */
-
-#define CR_UNKNOWN_ERROR 2000
-#define CR_SOCKET_CREATE_ERROR 2001
-#define CR_CONNECTION_ERROR 2002
-#define CR_CONN_HOST_ERROR 2003
-#define CR_IPSOCK_ERROR 2004
-#define CR_UNKNOWN_HOST 2005
-#define CR_SERVER_GONE_ERROR 2006
-#define CR_VERSION_ERROR 2007
-#define CR_OUT_OF_MEMORY 2008
-#define CR_WRONG_HOST_INFO 2009
-#define CR_LOCALHOST_CONNECTION 2010
-#define CR_TCP_CONNECTION 2011
-#define CR_SERVER_HANDSHAKE_ERR 2012
-#define CR_SERVER_LOST 2013
-#define CR_COMMANDS_OUT_OF_SYNC 2014
-#define CR_NAMEDPIPE_CONNECTION 2015
-#define CR_NAMEDPIPEWAIT_ERROR 2016
-#define CR_NAMEDPIPEOPEN_ERROR 2017
-#define CR_NAMEDPIPESETSTATE_ERROR 2018
-#define CR_CANT_READ_CHARSET 2019
-#define CR_NET_PACKET_TOO_LARGE 2020
diff --git a/ext/mysql/libmysql/errors.c b/ext/mysql/libmysql/errors.c
deleted file mode 100644
index 9b11bfb47a..0000000000
--- a/ext/mysql/libmysql/errors.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-
-#ifndef SHARED_LIBRARY
-
-const char * NEAR globerrs[GLOBERRS]=
-{
- "File '%s' not found (Errcode: %d)",
- "Can't create/write to file '%s' (Errcode: %d)",
- "Error reading file '%s' (Errcode: %d)",
- "Error writing file '%s' (Errcode: %d)",
- "Error on close of '%s' (Errcode: %d)",
- "Out of memory (Needed %u bytes)",
- "Error on delete of '%s' (Errcode: %d)",
- "Error on rename of '%s' to '%s' (Errcode: %d)",
- "",
- "Unexpected eof found when reading file '%s' (Errcode: %d)",
- "Can't lock file (Errcode: %d)",
- "Can't unlock file (Errcode: %d)",
- "Can't read dir of '%s' (Errcode: %d)",
- "Can't get stat of '%s' (Errcode: %d)",
- "Can't change size of file (Errcode: %d)",
- "Can't open stream from handle (Errcode: %d)",
- "Can't get working dirctory (Errcode: %d)",
- "Can't change dir to '%s' (Errcode: %d)",
- "Warning: '%s' had %d links",
- "%d files and %d streams is left open\n",
- "Disk is full writing '%s'. Waiting for someone to free space...",
- "Can't create directory '%s' (Errcode: %d)",
- "Character set '%s' is not a compiled character set and is not specified in the '%s' file",
- "Out of resources when opening file '%s' (Errcode: %d)",
- "Can't read value for symlink '%s' (Error %d)",
- "Can't create symlink '%s' pointing at '%s' (Error %d)",
- "Error on realpath() on '%s' (Error %d)",
-};
-
-void init_glob_errs(void)
-{
- my_errmsg[GLOB] = & globerrs[0];
-} /* init_glob_errs */
-
-#else
-
-void init_glob_errs()
-{
- my_errmsg[GLOB] = & globerrs[0];
-
- EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
- EE(EE_CANTCREATEFILE) = "Can't create/write to file '%s' (Errcode: %d)";
- EE(EE_READ) = "Error reading file '%s' (Errcode: %d)";
- EE(EE_WRITE) = "Error writing file '%s' (Errcode: %d)";
- EE(EE_BADCLOSE) = "Error on close of '%'s (Errcode: %d)";
- EE(EE_OUTOFMEMORY) = "Out of memory (Needed %u bytes)";
- EE(EE_DELETE) = "Error on delete of '%s' (Errcode: %d)";
- EE(EE_LINK) = "Error on rename of '%s' to '%s' (Errcode: %d)";
- EE(EE_EOFERR) = "Unexpected eof found when reading file '%s' (Errcode: %d)";
- EE(EE_CANTLOCK) = "Can't lock file (Errcode: %d)";
- EE(EE_CANTUNLOCK) = "Can't unlock file (Errcode: %d)";
- EE(EE_DIR) = "Can't read dir of '%s' (Errcode: %d)";
- EE(EE_STAT) = "Can't get stat of '%s' (Errcode: %d)";
- EE(EE_CANT_CHSIZE) = "Can't change size of file (Errcode: %d)";
- EE(EE_CANT_OPEN_STREAM)= "Can't open stream from handle (Errcode: %d)";
- EE(EE_GETWD) = "Can't get working dirctory (Errcode: %d)";
- EE(EE_SETWD) = "Can't change dir to '%s' (Errcode: %d)";
- EE(EE_LINK_WARNING) = "Warning: '%s' had %d links";
- EE(EE_OPEN_WARNING) = "%d files and %d streams is left open\n";
- EE(EE_DISK_FULL) = "Disk is full writing '%s'. Waiting for someone to free space...";
- EE(EE_CANT_MKDIR) ="Can't create directory '%s' (Errcode: %d)";
- EE(EE_UNKNOWN_CHARSET)= "Character set is not a compiled character set and is not specified in the %s file";
- EE(EE_OUT_OF_FILERESOURCES)="Out of resources when opening file '%s' (Errcode: %d)";
- EE(EE_CANT_READLINK)="Can't read value for symlink '%s' (Error %d)";
- EE(EE_CANT_SYMLINK)="Can't create symlink '%s' pointing at '%s' (Error %d)";
- EE(EE_REALPATH)="Error on realpath() on '%s' (Error %d)";
-}
-#endif
diff --git a/ext/mysql/libmysql/fix_copyright b/ext/mysql/libmysql/fix_copyright
deleted file mode 100755
index a4d479ecc0..0000000000
--- a/ext/mysql/libmysql/fix_copyright
+++ /dev/null
@@ -1,35 +0,0 @@
-#! /bin/sh
-#
-# This script removes the Copyright messages and inserts
-# Copyright Abandoned messages.
-#
-
-
-if test -z "$1"; then
- echo "Usage: $0 files"
- echo
- echo 'Usual parameters: *.c *.h'
- exit 1
-fi
-
-
-for i in $@; do
- sed \
- -e '/Copyright Abandoned.*MySQL.*/,/NO WARRANTY of any kind/c\
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB \
-This file is public domain and comes with NO WARRANTY of any kind */' \
- -e '/Copyright.*MySQL.*/,/MA 02111/c\
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB \
-This file is public domain and comes with NO WARRANTY of any kind */' \
- -e '/Copyright (C) .*MySQL.*TCX/,/For a more info/c\
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB \
-This file is public domain and comes with NO WARRANTY of any kind */' \
- -e '/Copyright (C) .*TCX.*Monty/,/For a more info/c\
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB \
-This file is public domain and comes with NO WARRANTY of any kind */' \
- -e '/Copyright (C) .... Monty.*/,/be preserved on all copies/c\
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB \
-This file is public domain and comes with NO WARRANTY of any kind */' \
- < $i > tmp
- cp tmp $i
-done
diff --git a/ext/mysql/libmysql/get_password.c b/ext/mysql/libmysql/get_password.c
deleted file mode 100644
index 9d39beac01..0000000000
--- a/ext/mysql/libmysql/get_password.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
-** Ask for a password from tty
-** This is an own file to avoid conflicts with curses
-*/
-#include <global.h>
-#include <my_sys.h>
-#include "mysql.h"
-#include <m_string.h>
-#include <m_ctype.h>
-#include <dbug.h>
-
-#if defined(HAVE_BROKEN_GETPASS) && !defined(HAVE_GETPASSPHRASE)
-#undef HAVE_GETPASS
-#endif
-
-#ifdef HAVE_GETPASS
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif /* HAVE_PWD_H */
-#else /* ! HAVE_GETPASS */
-#if !defined( __WIN__) && !defined(OS2)
-#include <sys/ioctl.h>
-#ifdef HAVE_TERMIOS_H /* For tty-password */
-#include <termios.h>
-#define TERMIO struct termios
-#else
-#ifdef HAVE_TERMIO_H /* For tty-password */
-#include <termio.h>
-#define TERMIO struct termio
-#else
-#include <sgtty.h>
-#define TERMIO struct sgttyb
-#endif
-#endif
-#ifdef alpha_linux_port
-#include <asm/ioctls.h> /* QQ; Fix this in configure */
-#include <asm/termiobits.h>
-#endif
-#else
-#include <conio.h>
-#endif /* __WIN__ */
-#endif /* HAVE_GETPASS */
-
-#ifdef HAVE_GETPASSPHRASE /* For Solaris */
-#define getpass(A) getpassphrase(A)
-#endif
-
-#if defined( __WIN__) || defined(OS2)
-/* were just going to fake it here and get input from the keyboard */
-
-char *get_tty_password(char *opt_message)
-{
- char to[80];
- char *pos=to,*end=to+sizeof(to)-1;
- int i=0;
- DBUG_ENTER("get_tty_password");
- fprintf(stdout,opt_message ? opt_message : "Enter password: ");
- for (;;)
- {
- char tmp;
- tmp=_getch();
- if (tmp == '\b' || (int) tmp == 127)
- {
- if (pos != to)
- {
- _cputs("\b \b");
- pos--;
- continue;
- }
- }
- if (tmp == '\n' || tmp == '\r' || tmp == 3)
- break;
- if (iscntrl(tmp) || pos == end)
- continue;
- _cputs("*");
- *(pos++) = tmp;
- }
- while (pos != to && isspace(pos[-1]) == ' ')
- pos--; /* Allow dummy space at end */
- *pos=0;
- _cputs("\n");
- DBUG_RETURN(my_strdup(to,MYF(MY_FAE)));
-}
-
-#else
-
-
-#ifndef HAVE_GETPASS
-/*
-** Can't use fgets, because readline will get confused
-** length is max number of chars in to, not counting \0
-* to will not include the eol characters.
-*/
-
-static void get_password(char *to,uint length,int fd,bool echo)
-{
- char *pos=to,*end=to+length;
-
- for (;;)
- {
- char tmp;
- if (my_read(fd,&tmp,1,MYF(0)) != 1)
- break;
- if (tmp == '\b' || (int) tmp == 127)
- {
- if (pos != to)
- {
- if (echo)
- {
- fputs("\b \b",stdout);
- fflush(stdout);
- }
- pos--;
- continue;
- }
- }
- if (tmp == '\n' || tmp == '\r' || tmp == 3)
- break;
- if (iscntrl(tmp) || pos == end)
- continue;
- if (echo)
- {
- fputc('*',stdout);
- fflush(stdout);
- }
- *(pos++) = tmp;
- }
- while (pos != to && isspace(pos[-1]) == ' ')
- pos--; /* Allow dummy space at end */
- *pos=0;
- return;
-}
-#endif /* ! HAVE_GETPASS */
-
-
-char *get_tty_password(char *opt_message)
-{
-#ifdef HAVE_GETPASS
- char *passbuff;
-#else /* ! HAVE_GETPASS */
- TERMIO org,tmp;
-#endif /* HAVE_GETPASS */
- char buff[80];
-
- DBUG_ENTER("get_tty_password");
-
-#ifdef HAVE_GETPASS
- passbuff = getpass(opt_message ? opt_message : "Enter password: ");
-
- /* copy the password to buff and clear original (static) buffer */
- strnmov(buff, passbuff, sizeof(buff) - 1);
-#ifdef _PASSWORD_LEN
- memset(passbuff, 0, _PASSWORD_LEN);
-#endif
-#else
- if (isatty(fileno(stdout)))
- {
- fputs(opt_message ? opt_message : "Enter password: ",stdout);
- fflush(stdout);
- }
-#if defined(HAVE_TERMIOS_H)
- tcgetattr(fileno(stdin), &org);
- tmp = org;
- tmp.c_lflag &= ~(ECHO | ISIG | ICANON);
- tmp.c_cc[VMIN] = 1;
- tmp.c_cc[VTIME] = 0;
- tcsetattr(fileno(stdin), TCSADRAIN, &tmp);
- get_password(buff, sizeof(buff)-1, fileno(stdin), isatty(fileno(stdout)));
- tcsetattr(fileno(stdin), TCSADRAIN, &org);
-#elif defined(HAVE_TERMIO_H)
- ioctl(fileno(stdin), (int) TCGETA, &org);
- tmp=org;
- tmp.c_lflag &= ~(ECHO | ISIG | ICANON);
- tmp.c_cc[VMIN] = 1;
- tmp.c_cc[VTIME]= 0;
- ioctl(fileno(stdin),(int) TCSETA, &tmp);
- get_password(buff,sizeof(buff)-1,fileno(stdin),isatty(fileno(stdout)));
- ioctl(fileno(stdin),(int) TCSETA, &org);
-#else
- gtty(fileno(stdin), &org);
- tmp=org;
- tmp.sg_flags &= ~ECHO;
- tmp.sg_flags |= RAW;
- stty(fileno(stdin), &tmp);
- get_password(buff,sizeof(buff)-1,fileno(stdin),isatty(fileno(stdout)));
- stty(fileno(stdin), &org);
-#endif
- if (isatty(fileno(stdout)))
- fputc('\n',stdout);
-#endif /* HAVE_GETPASS */
-
- DBUG_RETURN(my_strdup(buff,MYF(MY_FAE)));
-}
-#endif /*__WIN__*/
diff --git a/ext/mysql/libmysql/global.h b/ext/mysql/libmysql/global.h
deleted file mode 100644
index 968c2bddb6..0000000000
--- a/ext/mysql/libmysql/global.h
+++ /dev/null
@@ -1,952 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* This is the main include file that should included 'first' in every
- C file. */
-
-#ifndef _global_h
-#define _global_h
-
-#if defined( __EMX__) && !defined( MYSQL_SERVER)
-/* moved here to use below VOID macro redefinition */
-#define INCL_BASE
-#define INCL_NOPMAPI
-#include <os2.h>
-#endif /* __EMX__ */
-
-#ifdef __CYGWIN__
-/* We use a Unix API, so pretend it's not Windows */
-#undef WIN
-#undef WIN32
-#undef _WIN
-#undef _WIN32
-#undef _WIN64
-#undef __WIN__
-#undef __WIN32__
-#define HAVE_ERRNO_AS_DEFINE
-#endif /* __CYGWIN__ */
-
-
-#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
-#include <config-win.h>
-#elif defined(OS2)
-#include <config-os2.h>
-#else
-#include <my_config.h>
-#if defined(__cplusplus) && defined(inline)
-#undef inline /* fix configure problem */
-#endif
-#endif /* _WIN32... */
-
-/* Fix problem with S_ISLNK() on Linux */
-#if defined(HAVE_LINUXTHREADS)
-#undef _GNU_SOURCE
-#define _GNU_SOURCE 1
-#endif
-
-/* The client defines this to avoid all thread code */
-#if defined(UNDEF_THREADS_HACK)
-#undef THREAD
-#undef HAVE_mit_thread
-#undef HAVE_LINUXTHREADS
-#undef HAVE_UNIXWARE7_THREADS
-#endif
-
-#ifdef HAVE_THREADS_WITHOUT_SOCKETS
-/* MIT pthreads does not work with unix sockets */
-#undef HAVE_SYS_UN_H
-#endif
-
-#define __EXTENSIONS__ 1 /* We want some extension */
-#ifndef __STDC_EXT__
-#define __STDC_EXT__ 1 /* To get large file support on hpux */
-#endif
-
-#if defined(THREAD) && !defined(__WIN__) && !defined(OS2)
-#ifndef _POSIX_PTHREAD_SEMANTICS
-#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */
-#endif
-/* was #if defined(HAVE_LINUXTHREADS) || defined(HAVE_DEC_THREADS) || defined(HPUX) */
-#if !defined(SCO)
-#define _REENTRANT 1 /* Some thread libraries require this */
-#endif
-#if !defined(_THREAD_SAFE) && !defined(_AIX)
-#define _THREAD_SAFE /* Required for OSF1 */
-#endif
-#ifndef HAVE_mit_thread
-#ifdef HAVE_UNIXWARE7_THREADS
-#include <thread.h>
-#else
-#include <pthread.h> /* AIX must have this included first */
-#endif /* HAVE_UNIXWARE7_THREADS */
-#endif /* HAVE_mit_thread */
-#if !defined(SCO) && !defined(_REENTRANT)
-#define _REENTRANT 1 /* Threads requires reentrant code */
-#endif
-#endif /* THREAD */
-
-/* Go around some bugs in different OS and compilers */
-#ifdef _AIX /* By soren@t.dk */
-#define _H_STRINGS
-#define _SYS_STREAM_H
-#define _AIX32_CURSES
-#endif
-
-#ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */
-#undef HAVE_SNPRINTF
-#endif
-#ifdef HAVE_BROKEN_PREAD /* These doesn't work on HPUX 11.x */
-#undef HAVE_PREAD
-#undef HAVE_PWRITE
-#endif
-
-#ifdef UNDEF_HAVE_GETHOSTBYNAME_R /* For OSF4.x */
-#undef HAVE_GETHOSTBYNAME_R
-#endif
-#ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */
-#undef HAVE_INITGROUPS
-#endif
-
-/* Fix a bug in gcc 2.8.0 on IRIX 6.2 */
-#if SIZEOF_LONG == 4 && defined(__LONG_MAX__)
-#undef __LONG_MAX__ /* Is a longlong value in gcc 2.8.0 ??? */
-#define __LONG_MAX__ 2147483647
-#endif
-
-/* egcs 1.1.2 has a problem with memcpy on Alpha */
-#if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
-#define BAD_MEMCPY
-#endif
-
-/* In Linux-alpha we have atomic.h if we are using gcc */
-#if defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && defined(__alpha__) && (__GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95)) && !defined(HAVE_ATOMIC_ADD)
-#define HAVE_ATOMIC_ADD
-#define HAVE_ATOMIC_SUB
-#endif
-
-/* In Linux-ia64 including atomic.h will give us an error */
-#if (defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && defined(__ia64__)) || !defined(THREAD)
-#undef HAVE_ATOMIC_ADD
-#undef HAVE_ATOMIC_SUB
-#endif
-
-#if defined(_lint) && !defined(lint)
-#define lint
-#endif
-#if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG)
-#define _LONG_LONG 1 /* For AIX string library */
-#endif
-
-#ifndef stdin
-#include <stdio.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_STDDEF_H
-#include <stddef.h>
-#endif
-
-#include <math.h>
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
-#ifdef HAVE_FLOAT_H
-#include <float.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_SYS_TIMEB_H
-#include <sys/timeb.h> /* Avoid warnings on SCO */
-#endif
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-#endif /* TIME_WITH_SYS_TIME */
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if defined(__cplusplus) && defined(NO_CPLUSPLUS_ALLOCA)
-#undef HAVE_ALLOCA
-#undef HAVE_ALLOCA_H
-#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-#ifdef HAVE_ATOMIC_ADD
-#define __SMP__
-#include <asm/atomic.h>
-#endif
-
-/* Go around some bugs in different OS and compilers */
-#if defined(_HPUX_SOURCE) && defined(HAVE_SYS_STREAM_H)
-#include <sys/stream.h> /* HPUX 10.20 defines ulong here. UGLY !!! */
-#define HAVE_ULONG
-#endif
-#ifdef DONT_USE_FINITE /* HPUX 11.x has is_finite() */
-#undef HAVE_FINITE
-#endif
-#if defined(HPUX) && defined(_LARGEFILE64_SOURCE) && defined(THREAD)
-/* Fix bug in setrlimit */
-#undef setrlimit
-#define setrlimit cma_setrlimit64
-#endif
-
-/* We can not live without these */
-
-#define USE_MYFUNC 1 /* Must use syscall indirection */
-#define MASTER 1 /* Compile without unireg */
-#define ENGLISH 1 /* Messages in English */
-#define POSIX_MISTAKE 1 /* regexp: Fix stupid spec error */
-#define USE_REGEX 1 /* We want the use the regex library */
-/* Do not define for ultra sparcs */
-#ifndef OS2
-#define USE_BMOVE512 1 /* Use this unless the system bmove is faster */
-#endif
-
-/* Paranoid settings. Define I_AM_PARANOID if you are paranoid */
-#ifdef I_AM_PARANOID
-#define DONT_ALLOW_USER_CHANGE 1
-#define DONT_USE_MYSQL_PWD 1
-#endif
-
-/* #define USE_some_charset 1 was deprecated by changes to configure */
-/* my_ctype my_to_upper, my_to_lower, my_sort_order gain theit right value */
-/* automagically during configuration */
-
-/* Does the system remember a signal handler after a signal ? */
-#ifndef HAVE_BSD_SIGNALS
-#define DONT_REMEMBER_SIGNAL
-#endif
-
-/* Define void to stop lint from generating "null effekt" comments */
-#ifndef DONT_DEFINE_VOID
-#ifdef _lint
-int __void__;
-#define VOID(X) (__void__ = (int) (X))
-#else
-#undef VOID
-#define VOID(X) (X)
-#endif
-#endif /* DONT_DEFINE_VOID */
-
-#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
-#define LINT_INIT(var) var=0 /* No uninitialize-warning */
-#else
-#define LINT_INIT(var)
-#endif
-
-/* Define som useful general macros */
-#if defined(__cplusplus) && defined(__GNUC__)
-#define max(a, b) ((a) >? (b))
-#define min(a, b) ((a) <? (b))
-#elif !defined(max)
-#define max(a, b) ((a) > (b) ? (a) : (b))
-#define min(a, b) ((a) < (b) ? (a) : (b))
-#endif
-
-#if defined(__EMX__) || !defined(HAVE_UINT)
-typedef unsigned int uint;
-typedef unsigned short ushort;
-#endif
-
-#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0)
-#define swap(t,a,b) { register t dummy; dummy = a; a = b; b = dummy; }
-#define test(a) ((a) ? 1 : 0)
-#define set_if_bigger(a,b) { if ((a) < (b)) (a)=(b); }
-#define set_if_smaller(a,b) { if ((a) > (b)) (a)=(b); }
-#define test_all_bits(a,b) (((a) & (b)) == (b))
-#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
-#ifndef HAVE_RINT
-#define rint(A) floor((A)+0.5)
-#endif
-
-/* Define som general constants */
-#ifndef TRUE
-#define TRUE (1) /* Logical true */
-#define FALSE (0) /* Logical false */
-#endif
-
-#if defined(__GNUC__)
-#define function_volatile volatile
-#define my_reinterpret_cast(A) reinterpret_cast<A>
-#define my_const_cast(A) const_cast<A>
-#elif !defined(my_reinterpret_cast)
-#define my_reinterpret_cast(A) (A)
-#define my_const_cast(A) (A)
-#endif
-#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
-#define __attribute__(A)
-#endif
-
-/* From old s-system.h */
-
-/* Support macros for non ansi & other old compilers. Since such
- things are no longer supported we do nothing. We keep then since
- some of our code may still be needed to upgrade old customers. */
-#define _VARARGS(X) X
-#define _STATIC_VARARGS(X) X
-#define _PC(X) X
-
-#if defined(DBUG_ON) && defined(DBUG_OFF)
-#undef DBUG_OFF
-#endif
-
-#if defined(_lint) && !defined(DBUG_OFF)
-#define DBUG_OFF
-#endif
-
-#include <dbug.h>
-#ifndef DBUG_OFF
-#define dbug_assert(A) assert(A)
-#else
-#define dbug_assert(A)
-#endif
-
-#define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/
-#define ASCII_BITS_USED 8 /* Bit char used */
-#define NEAR_F /* No near function handling */
-
-/* Some types that is different between systems */
-
-typedef int File; /* File descriptor */
-#ifndef Socket_defined
-typedef int my_socket; /* File descriptor for sockets */
-#define INVALID_SOCKET -1
-#endif
-/* Type for fuctions that handles signals */
-#define sig_handler RETSIGTYPE
-typedef void (*sig_return)();/* Returns type from signal */
-#if defined(__GNUC__) && !defined(_lint)
-typedef char pchar; /* Mixed prototypes can take char */
-typedef char puchar; /* Mixed prototypes can take char */
-typedef char pbool; /* Mixed prototypes can take char */
-typedef short pshort; /* Mixed prototypes can take short int */
-typedef float pfloat; /* Mixed prototypes can take float */
-#else
-typedef int pchar; /* Mixed prototypes can't take char */
-typedef uint puchar; /* Mixed prototypes can't take char */
-typedef int pbool; /* Mixed prototypes can't take char */
-typedef int pshort; /* Mixed prototypes can't take short int */
-typedef double pfloat; /* Mixed prototypes can't take float */
-#endif
-typedef int (*qsort_cmp)(const void *,const void *);
-#ifdef HAVE_mit_thread
-#define qsort_t void
-#undef QSORT_TYPE_IS_VOID
-#define QSORT_TYPE_IS_VOID
-#else
-#define qsort_t RETQSORTTYPE /* Broken GCC cant handle typedef !!!! */
-#endif
-#ifdef HAVE_mit_thread
-#define size_socket socklen_t /* Type of last arg to accept */
-#else
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-typedef SOCKET_SIZE_TYPE size_socket;
-#endif
-
-#ifndef SOCKOPT_OPTLEN_TYPE
-#define SOCKOPT_OPTLEN_TYPE size_socket
-#endif
-
-/* file create flags */
-
-#ifndef O_SHARE
-#define O_SHARE 0 /* Flag to my_open for shared files */
-#ifndef O_BINARY
-#define O_BINARY 0 /* Flag to my_open for binary files */
-#endif
-#define FILE_BINARY 0 /* Flag to my_fopen for binary streams */
-#ifdef HAVE_FCNTL
-#define HAVE_FCNTL_LOCK
-#define F_TO_EOF 0L /* Param to lockf() to lock rest of file */
-#endif
-#endif /* O_SHARE */
-#ifndef O_TEMPORARY
-#define O_TEMPORARY 0
-#endif
-#ifndef O_SHORT_LIVED
-#define O_SHORT_LIVED 0
-#endif
-
-/* #define USE_RECORD_LOCK */
-
- /* Unsigned types supported by the compiler */
-#define UNSINT8 /* unsigned int8 (char) */
-#define UNSINT16 /* unsigned int16 */
-#define UNSINT32 /* unsigned int32 */
-
- /* General constants */
-#define SC_MAXWIDTH 256 /* Max width of screen (for error messages) */
-#define FN_LEN 256 /* Max file name len */
-#define FN_HEADLEN 253 /* Max length of filepart of file name */
-#define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN) */
-#define FN_REFLEN 512 /* Max length of full path-name */
-#define FN_EXTCHAR '.'
-#define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */
-#define FN_CURLIB '.' /* ./ is used as abbrev for current dir */
-#define FN_PARENTDIR ".." /* Parentdirectory; Must be a string */
-#define FN_DEVCHAR ':'
-
-#ifndef FN_LIBCHAR
-#ifdef __EMX__
-#define FN_LIBCHAR '\\'
-#define FN_ROOTDIR "\\"
-#else
-#define FN_LIBCHAR '/'
-#define FN_ROOTDIR "/"
-#endif
-#define MY_NFILE 1024 /* This is only used to save filenames */
-#endif
-
-/* #define EXT_IN_LIBNAME */
-/* #define FN_NO_CASE_SENCE */
-/* #define FN_UPPER_CASE TRUE */
-
-/* Io buffer size; Must be a power of 2 and a multiple of 512. May be
- smaller what the disk page size. This influences the speed of the
- isam btree library. eg to big to slow. */
-#define IO_SIZE 4096
-/* How much overhead does malloc have. The code often allocates
- something like 1024-MALLOC_OVERHEAD bytes */
-#ifdef SAFEMALLOC
-#define MALLOC_OVERHEAD (8+24+4)
-#else
-#define MALLOC_OVERHEAD 8
-#endif
- /* get memory in huncs */
-#define ONCE_ALLOC_INIT (uint) (4096-MALLOC_OVERHEAD)
- /* Typical record cash */
-#define RECORD_CACHE_SIZE (uint) (64*1024-MALLOC_OVERHEAD)
- /* Typical key cash */
-#define KEY_CACHE_SIZE (uint) (8*1024*1024-MALLOC_OVERHEAD)
-
- /* Some things that this system doesn't have */
-
-#define ONLY_OWN_DATABASES /* We are using only databases by monty */
-#define NO_PISAM /* Not needed anymore */
-#define NO_MISAM /* Not needed anymore */
-#define NO_HASH /* Not needed anymore */
-#ifdef __WIN__
-#define NO_DIR_LIBRARY /* Not standar dir-library */
-#define USE_MY_STAT_STRUCT /* For my_lib */
-#endif
-
-/* Some things that this system does have */
-
-#ifndef HAVE_ITOA
-#define USE_MY_ITOA /* There is no itoa */
-#endif
-
-/* Some defines of functions for portability */
-
-#ifndef HAVE_ATOD
-#define atod atof
-#endif
-#ifdef USE_MY_ATOF
-#define atof my_atof
-extern void init_my_atof(void);
-extern double my_atof(const char*);
-#endif
-#undef remove /* Crashes MySQL on SCO 5.0.0 */
-#ifndef __WIN__
-#ifdef OS2
-#define closesocket(A) soclose(A)
-#else
-#define closesocket(A) close(A)
-#endif
-#ifndef ulonglong2double
-#define ulonglong2double(A) ((double) (A))
-#define my_off_t2double(A) ((double) (A))
-#endif
-#endif
-
-#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-#define ulong_to_double(X) ((double) (ulong) (X))
-#define SET_STACK_SIZE(X) /* Not needed on real machines */
-
-#if !defined(HAVE_mit_thread) && !defined(HAVE_STRTOK_R)
-#define strtok_r(A,B,C) strtok((A),(B))
-#endif
-
-#ifdef HAVE_LINUXTHREADS
-/* #define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) */
-/* #define sigset(A,B) signal((A),(B)) */
-#endif
-
-/* Remove some things that mit_thread break or doesn't support */
-#if defined(HAVE_mit_thread) && defined(THREAD)
-#undef HAVE_PREAD
-#undef HAVE_REALPATH
-#undef HAVE_MLOCK
-#undef HAVE_TEMPNAM /* Use ours */
-#undef HAVE_PTHREAD_SETPRIO
-#undef HAVE_FTRUNCATE
-#undef HAVE_READLINK
-#endif
-
-/* This is from the old m-machine.h file */
-
-#if SIZEOF_LONG_LONG > 4
-#define HAVE_LONG_LONG 1
-#endif
-
-#if defined(HAVE_LONG_LONG) && !defined(LONGLONG_MIN)
-#define LONGLONG_MIN ((long long) 0x8000000000000000LL)
-#define LONGLONG_MAX ((long long) 0x7FFFFFFFFFFFFFFFLL)
-#endif
-
-#if SIZEOF_LONG == 4
-#define INT_MIN32 (long) 0x80000000L
-#define INT_MAX32 (long) 0x7FFFFFFFL
-#define INT_MIN24 ((long) 0xff800000L)
-#define INT_MAX24 0x007fffffL
-#define INT_MIN16 ((short int) 0x8000)
-#define INT_MAX16 0x7FFF
-#define INT_MIN8 ((char) 0x80)
-#define INT_MAX8 ((char) 0x7F)
-#else /* Probably Alpha */
-#define INT_MIN32 ((long) (int) 0x80000000)
-#define INT_MAX32 ((long) (int) 0x7FFFFFFF)
-#define INT_MIN24 ((long) (int) 0xff800000)
-#define INT_MAX24 ((long) (int) 0x007fffff)
-#define INT_MIN16 ((short int) 0xffff8000)
-#define INT_MAX16 ((short int) 0x00007FFF)
-#endif
-
-/* From limits.h instead */
-#ifndef DBL_MIN
-#define DBL_MIN 4.94065645841246544e-324
-#define FLT_MIN ((float)1.40129846432481707e-45)
-#endif
-#ifndef DBL_MAX
-#define DBL_MAX 1.79769313486231470e+308
-#define FLT_MAX ((float)3.40282346638528860e+38)
-#endif
-
-/* Max size that must be added to a so that we know Size to make
- adressable obj. */
-typedef long my_ptrdiff_t;
-#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1))
-#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double))
-/* Size to make adressable obj. */
-#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t)))
- /* Offset of filed f in structure t */
-#define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f)
-#define ADD_TO_PTR(ptr,size,type) (type) ((byte*) (ptr)+size)
-#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((byte*) (A) - (byte*) (B))
-
-#define NullS (char *) 0
-/* Nowdays we do not support MessyDos */
-#ifndef NEAR
-#define NEAR /* Who needs segments ? */
-#define FAR /* On a good machine */
-#ifndef HUGE_PTR
-#define HUGE_PTR
-#endif
-#endif
-#if defined(__IBMC__) || defined(__IBMCPP__)
-#define STDCALL _System _Export
-#elif !defined( STDCALL)
-#define STDCALL
-#endif
-
-/* Typdefs for easyier portability */
-
-#if defined(VOIDTYPE)
-typedef void *gptr; /* Generic pointer */
-#else
-typedef char *gptr; /* Generic pointer */
-#endif
-#ifndef HAVE_INT_8_16_32
-typedef char int8; /* Signed integer >= 8 bits */
-typedef short int16; /* Signed integer >= 16 bits */
-#endif
-#ifndef HAVE_UCHAR
-typedef unsigned char uchar; /* Short for unsigned char */
-#endif
-typedef unsigned char uint8; /* Short for unsigned integer >= 8 bits */
-typedef unsigned short uint16; /* Short for unsigned integer >= 16 bits */
-
-#if SIZEOF_INT == 4
-#ifndef HAVE_INT_8_16_32
-typedef int int32;
-#endif
-typedef unsigned int uint32; /* Short for unsigned integer >= 32 bits */
-#elif SIZEOF_LONG == 4
-#ifndef HAVE_INT_8_16_32
-typedef long int32;
-#endif
-typedef unsigned long uint32; /* Short for unsigned integer >= 32 bits */
-#else
-error "Neither int or long is of 4 bytes width"
-#endif
-
-#if !defined(HAVE_ULONG) && !defined(HAVE_LINUXTHREADS) && !defined(__USE_MISC)
-typedef unsigned long ulong; /* Short for unsigned long */
-#endif
-#ifndef longlong_defined
-#if defined(HAVE_LONG_LONG) && SIZEOF_LONG != 8
-typedef unsigned long long int ulonglong; /* ulong or unsigned long long */
-typedef long long int longlong;
-#else
-typedef unsigned long ulonglong; /* ulong or unsigned long long */
-typedef long longlong;
-#endif
-#endif
-
-#ifdef USE_RAID
-/* The following is done with a if to not get problems with pre-processors
- with late define evaluation */
-#if SIZEOF_OFF_T == 4
-#define SYSTEM_SIZEOF_OFF_T 4
-#else
-#define SYSTEM_SIZEOF_OFF_T 8
-#endif
-#undef SIZEOF_OFF_T
-#define SIZEOF_OFF_T 8
-#else
-#define SYSTEM_SIZEOF_OFF_T SIZEOF_OFF_T
-#endif /* USE_RAID */
-
-#if SIZEOF_OFF_T > 4
-typedef ulonglong my_off_t;
-#else
-typedef unsigned long my_off_t;
-#endif
-#define MY_FILEPOS_ERROR (~(my_off_t) 0)
-#if !defined(__WIN__) && !defined(OS2)
-typedef off_t os_off_t;
-#endif
-
-#if defined(__WIN__)
-#define socket_errno WSAGetLastError()
-#define SOCKET_EINTR WSAEINTR
-#define SOCKET_EAGAIN WSAEINPROGRESS
-#define SOCKET_ENFILE ENFILE
-#define SOCKET_EMFILE EMFILE
-#elif defined(OS2)
-#define socket_errno sock_errno()
-#define SOCKET_EINTR SOCEINTR
-#define SOCKET_EAGAIN SOCEINPROGRESS
-#define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK
-#define SOCKET_ENFILE SOCENFILE
-#define SOCKET_EMFILE SOCEMFILE
-#define closesocket(A) soclose(A)
-#else /* Unix */
-#define socket_errno errno
-#define closesocket(A) close(A)
-#define SOCKET_EINTR EINTR
-#define SOCKET_EAGAIN EAGAIN
-#define SOCKET_EWOULDBLOCK EWOULDBLOCK
-#define SOCKET_ENFILE ENFILE
-#define SOCKET_EMFILE EMFILE
-#endif
-
-typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */
-typedef short int15; /* Most effective integer 0 <= x <= 32767 */
-typedef char *my_string; /* String of characters */
-typedef unsigned long size_s; /* Size of strings (In string-funcs) */
-typedef int myf; /* Type of MyFlags in my_funcs */
-#ifndef byte_defined
-typedef char byte; /* Smallest addressable unit */
-#endif
-typedef char my_bool; /* Small bool */
-#if !defined(bool) && !defined(bool_defined) && (!defined(HAVE_BOOL) || !defined(__cplusplus))
-typedef char bool; /* Ordinary boolean values 0 1 */
-#endif
- /* Macros for converting *constants* to the right type */
-#define INT8(v) (int8) (v)
-#define INT16(v) (int16) (v)
-#define INT32(v) (int32) (v)
-#define MYF(v) (myf) (v)
-
-/* Defines to make it possible to prioritize register assignments. No
- longer needed with moder compilers */
-#ifndef USING_X
-#define reg1 register
-#define reg2 register
-#define reg3 register
-#define reg4 register
-#define reg5 register
-#define reg6 register
-#define reg7 register
-#define reg8 register
-#define reg9 register
-#define reg10 register
-#define reg11 register
-#define reg12 register
-#define reg13 register
-#define reg14 register
-#define reg15 register
-#define reg16 register
-#endif
-
-/* Defines for time function */
-#define SCALE_SEC 100
-#define SCALE_USEC 10000
-#define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */
-#define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */
-
-/*
-** Define-funktions for reading and storing in machine independent format
-** (low byte first)
-*/
-
-/* Optimized store functions for Intel x86 */
-#ifdef __i386__
-#define sint2korr(A) (*((int16 *) (A)))
-#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
- (((uint32) 255L << 24) | \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])) : \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])))
-#define sint4korr(A) (*((long *) (A)))
-#define uint2korr(A) (*((uint16 *) (A)))
-#define uint3korr(A) (long) (*((unsigned long *) (A)) & 0xFFFFFF)
-#define uint4korr(A) (*((unsigned long *) (A)))
-#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24)) +\
- (((ulonglong) ((uchar) (A)[4])) << 32))
-#define uint8korr(A) (*((ulonglong *) (A)))
-#define sint8korr(A) (*((longlong *) (A)))
-#define int2store(T,A) *((uint16*) (T))= (uint16) (A)
-#define int3store(T,A) { *(T)= (uchar) ((A));\
- *(T+1)=(uchar) (((uint) (A) >> 8));\
- *(T+2)=(uchar) (((A) >> 16)); }
-#define int4store(T,A) *((long *) (T))= (long) (A)
-#define int5store(T,A) { *(T)= (uchar)((A));\
- *((T)+1)=(uchar) (((A) >> 8));\
- *((T)+2)=(uchar) (((A) >> 16));\
- *((T)+3)=(uchar) (((A) >> 24)); \
- *((T)+4)=(uchar) (((A) >> 32)); }
-#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
-
-typedef union {
- double v;
- long m[2];
-} doubleget_union;
-#define doubleget(V,M) { ((doubleget_union *)&V)->m[0] = *((long*) M); \
- ((doubleget_union *)&V)->m[1] = *(((long*) M)+1); }
-#define doublestore(T,V) { *((long *) T) = ((doubleget_union *)&V)->m[0]; \
- *(((long *) T)+1) = ((doubleget_union *)&V)->m[1]; }
-#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); }
-#define float8get(V,M) doubleget((V),(M))
-#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
-#define float8store(V,M) doublestore((V),(M))
-#endif /* __i386__ */
-
-#ifndef sint2korr
-#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) +\
- ((int16) ((int16) (A)[1]) << 8))
-#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
- (((uint32) 255L << 24) | \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])) : \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])))
-#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) +\
- (((int32) ((uchar) (A)[1]) << 8)) +\
- (((int32) ((uchar) (A)[2]) << 16)) +\
- (((int32) ((int16) (A)[3]) << 24)))
-#define sint8korr(A) (longlong) uint8korr(A)
-#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) +\
- ((uint16) ((uchar) (A)[1]) << 8))
-#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16))
-#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24))
-#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24)) +\
- (((ulonglong) ((uchar) (A)[4])) << 32))
-#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24)) +\
- (((ulonglong) (((uint32) ((uchar) (A)[4])) +\
- (((uint32) ((uchar) (A)[5])) << 8) +\
- (((uint32) ((uchar) (A)[6])) << 16) +\
- (((uint32) ((uchar) (A)[7])) << 24))) <<\
- 32))
-#define int2store(T,A) { uint def_temp= (uint) (A) ;\
- *((uchar*) (T))= (uchar)(def_temp); \
- *((uchar*) (T+1))=(uchar)((def_temp >> 8)); }
-#define int3store(T,A) { /*lint -save -e734 */\
- *((T))=(char) ((A));\
- *((T)+1)=(char) (((A) >> 8));\
- *((T)+2)=(char) (((A) >> 16)); \
- /*lint -restore */}
-#define int4store(T,A) { *(T)=(char) ((A));\
- *((T)+1)=(char) (((A) >> 8));\
- *((T)+2)=(char) (((A) >> 16));\
- *((T)+3)=(char) (((A) >> 24)); }
-#define int5store(T,A) { *(T)=((A));\
- *((T)+1)=(((A) >> 8));\
- *((T)+2)=(((A) >> 16));\
- *((T)+3)=(((A) >> 24)); \
- *((T)+4)=(((A) >> 32)); }
-#define int8store(T,A) { uint def_temp= (uint) (A), def_temp2= (uint) ((A) >> 32); \
- int4store((T),def_temp); \
- int4store((T+4),def_temp2); \
- }
-#ifdef WORDS_BIGENDIAN
-#define float4store(T,A) { *(T)= ((byte *) &A)[3];\
- *((T)+1)=(char) ((byte *) &A)[2];\
- *((T)+2)=(char) ((byte *) &A)[1];\
- *((T)+3)=(char) ((byte *) &A)[0]; }
-
-#define float4get(V,M) { float def_temp;\
- ((byte*) &def_temp)[0]=(M)[3];\
- ((byte*) &def_temp)[1]=(M)[2];\
- ((byte*) &def_temp)[2]=(M)[1];\
- ((byte*) &def_temp)[3]=(M)[0];\
- (V)=def_temp; }
-#define float8store(T,V) { *(T)= ((byte *) &V)[7];\
- *((T)+1)=(char) ((byte *) &V)[6];\
- *((T)+2)=(char) ((byte *) &V)[5];\
- *((T)+3)=(char) ((byte *) &V)[4];\
- *((T)+4)=(char) ((byte *) &V)[3];\
- *((T)+5)=(char) ((byte *) &V)[2];\
- *((T)+6)=(char) ((byte *) &V)[1];\
- *((T)+7)=(char) ((byte *) &V)[0]; }
-
-#define float8get(V,M) { double def_temp;\
- ((byte*) &def_temp)[0]=(M)[7];\
- ((byte*) &def_temp)[1]=(M)[6];\
- ((byte*) &def_temp)[2]=(M)[5];\
- ((byte*) &def_temp)[3]=(M)[4];\
- ((byte*) &def_temp)[4]=(M)[3];\
- ((byte*) &def_temp)[5]=(M)[2];\
- ((byte*) &def_temp)[6]=(M)[1];\
- ((byte*) &def_temp)[7]=(M)[0];\
- (V) = def_temp; }
-#else
-#define float4get(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float))
-#define float4store(V,M) memcpy_fixed((byte*) V,(byte*) (&M),sizeof(float))
-
-#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
-#define doublestore(T,V) { *(T)= ((byte *) &V)[4];\
- *((T)+1)=(char) ((byte *) &V)[5];\
- *((T)+2)=(char) ((byte *) &V)[6];\
- *((T)+3)=(char) ((byte *) &V)[7];\
- *((T)+4)=(char) ((byte *) &V)[0];\
- *((T)+5)=(char) ((byte *) &V)[1];\
- *((T)+6)=(char) ((byte *) &V)[2];\
- *((T)+7)=(char) ((byte *) &V)[3]; }
-#define doubleget(V,M) { double def_temp;\
- ((byte*) &def_temp)[0]=(M)[4];\
- ((byte*) &def_temp)[1]=(M)[5];\
- ((byte*) &def_temp)[2]=(M)[6];\
- ((byte*) &def_temp)[3]=(M)[7];\
- ((byte*) &def_temp)[4]=(M)[0];\
- ((byte*) &def_temp)[5]=(M)[1];\
- ((byte*) &def_temp)[6]=(M)[2];\
- ((byte*) &def_temp)[7]=(M)[3];\
- (V) = def_temp; }
-#endif /* __FLOAT_WORD_ORDER */
-
-#define float8get(V,M) doubleget((V),(M))
-#define float8store(V,M) doublestore((V),(M))
-#endif /* WORDS_BIGENDIAN */
-
-#endif /* sint2korr */
-
-/* Define-funktions for reading and storing in machine format from/to
- short/long to/from some place in memory V should be a (not
- register) variable, M is a pointer to byte */
-
-#ifdef WORDS_BIGENDIAN
-
-#define ushortget(V,M) { V = (uint16) (((uint16) ((uchar) (M)[1]))+\
- ((uint16) ((uint16) (M)[0]) << 8)); }
-#define shortget(V,M) { V = (short) (((short) ((uchar) (M)[1]))+\
- ((short) ((short) (M)[0]) << 8)); }
-#define longget(V,M) { int32 def_temp;\
- ((byte*) &def_temp)[0]=(M)[0];\
- ((byte*) &def_temp)[1]=(M)[1];\
- ((byte*) &def_temp)[2]=(M)[2];\
- ((byte*) &def_temp)[3]=(M)[3];\
- (V)=def_temp; }
-#define ulongget(V,M) { uint32 def_temp;\
- ((byte*) &def_temp)[0]=(M)[0];\
- ((byte*) &def_temp)[1]=(M)[1];\
- ((byte*) &def_temp)[2]=(M)[2];\
- ((byte*) &def_temp)[3]=(M)[3];\
- (V)=def_temp; }
-#define shortstore(T,A) { uint def_temp=(uint) (A) ;\
- *(T+1)=(char)(def_temp); \
- *(T+0)=(char)(def_temp >> 8); }
-#define longstore(T,A) { *((T)+3)=((A));\
- *((T)+2)=(((A) >> 8));\
- *((T)+1)=(((A) >> 16));\
- *((T)+0)=(((A) >> 24)); }
-
-#define doubleget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(double))
-#define doublestore(T,V) memcpy((byte*) (T),(byte*) &V,sizeof(double))
-#define longlongget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(ulonglong))
-#define longlongstore(T,V) memcpy((byte*) (T),(byte*) &V,sizeof(ulonglong))
-
-#else
-
-#define ushortget(V,M) { V = uint2korr(M); }
-#define shortget(V,M) { V = sint2korr(M); }
-#define longget(V,M) { V = sint4korr(M); }
-#define ulongget(V,M) { V = uint4korr(M); }
-#define shortstore(T,V) int2store(T,V)
-#define longstore(T,V) int4store(T,V)
-#ifndef doubleget
-#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
-#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double))
-#endif /* doubleget */
-#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong))
-#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong))
-
-#endif /* WORDS_BIGENDIAN */
-
-/* sprintf does not always return the number of bytes :- */
-#ifdef SPRINTF_RETURNS_INT
-#define my_sprintf(buff,args) sprintf args
-#else
-#ifdef SPRINTF_RETURNS_PTR
-#define my_sprintf(buff,args) ((int)(sprintf args - buff))
-#else
-#define my_sprintf(buff,args) sprintf args,strlen(buff)
-#endif
-#endif
-
-#ifndef THREAD
-#define thread_safe_increment(V,L) (V)++
-#define thread_safe_add(V,C,L) (V)+=(C)
-#define thread_safe_sub(V,C,L) (V)-=(C)
-#define statistic_increment(V,L) (V)++
-#define statistic_add(V,C,L) (V)+=(C)
-#endif
-
-#endif /* _global_h */
diff --git a/ext/mysql/libmysql/int2str.c b/ext/mysql/libmysql/int2str.c
deleted file mode 100644
index bb12b00cdc..0000000000
--- a/ext/mysql/libmysql/int2str.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Defines: int2str(), itoa(), ltoa()
-
- int2str(dst, radix, val)
- converts the (long) integer "val" to character form and moves it to
- the destination string "dst" followed by a terminating NUL. The
- result is normally a pointer to this NUL character, but if the radix
- is dud the result will be NullS and nothing will be changed.
-
- If radix is -2..-36, val is taken to be SIGNED.
- If radix is 2.. 36, val is taken to be UNSIGNED.
- That is, val is signed if and only if radix is. You will normally
- use radix -10 only through itoa and ltoa, for radix 2, 8, or 16
- unsigned is what you generally want.
-
- _dig_vec is public just in case someone has a use for it.
- The definitions of itoa and ltoa are actually macros in m_string.h,
- but this is where the code is.
-
- Note: The standard itoa() returns a pointer to the argument, when int2str
- returns the pointer to the end-null.
- itoa assumes that 10 -base numbers are allways signed and other arn't.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-char NEAR _dig_vec[] =
- "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
-
-char *int2str(register long int val, register char *dst, register int radix)
-{
- char buffer[65];
- register char *p;
- long int new_val;
-
- if (radix < 0) {
- if (radix < -36 || radix > -2) return NullS;
- if (val < 0) {
- *dst++ = '-';
- val = -val;
- }
- radix = -radix;
- } else {
- if (radix > 36 || radix < 2) return NullS;
- }
- /* The slightly contorted code which follows is due to the
- fact that few machines directly support unsigned long / and %.
- Certainly the VAX C compiler generates a subroutine call. In
- the interests of efficiency (hollow laugh) I let this happen
- for the first digit only; after that "val" will be in range so
- that signed integer division will do. Sorry 'bout that.
- CHECK THE CODE PRODUCED BY YOUR C COMPILER. The first % and /
- should be unsigned, the second % and / signed, but C compilers
- tend to be extraordinarily sensitive to minor details of style.
- This works on a VAX, that's all I claim for it.
- */
- p = &buffer[sizeof(buffer)-1];
- *p = '\0';
- new_val=(ulong) val / (ulong) radix;
- *--p = _dig_vec[(uchar) ((ulong) val- (ulong) new_val*(ulong) radix)];
- val = new_val;
-#ifdef HAVE_LDIV
- while (val != 0)
- {
- ldiv_t res;
- res=ldiv(val,radix);
- *--p = _dig_vec[res.rem];
- val= res.quot;
- }
-#else
- while (val != 0)
- {
- new_val=val/radix;
- *--p = _dig_vec[(uchar) (val-new_val*radix)];
- val= new_val;
- }
-#endif
- while ((*dst++ = *p++) != 0) ;
- return dst-1;
-}
-
-
-/*
- This is a faster version of the above optimized for the normal case of
- radix 10 / -10
-*/
-
-char *int10_to_str(long int val,char *dst,int radix)
-{
- char buffer[65];
- register char *p;
- long int new_val;
-
- if (radix < 0) /* -10 */
- {
- if (val < 0)
- {
- *dst++ = '-';
- val = -val;
- }
- }
-
- p = &buffer[sizeof(buffer)-1];
- *p = '\0';
- new_val= (long) ((unsigned long int) val / 10);
- *--p = '0'+ (char) ((unsigned long int) val - (unsigned long) new_val * 10);
- val = new_val;
-
- while (val != 0)
- {
- new_val=val/10;
- *--p = '0' + (char) (val-new_val*10);
- val= new_val;
- }
- while ((*dst++ = *p++) != 0) ;
- return dst-1;
-}
-
-
-#ifdef USE_MY_ITOA
-
- /* Change to less general itoa interface */
-
-char *my_itoa(int val, char *dst, int radix)
-{
- VOID(int2str((long) val,dst,(radix == 10 ? -10 : radix)));
- return dst;
-}
-
-char *my_ltoa(long int val, char *dst, int radix)
-{
- VOID(int2str((long) val,dst,(radix == 10 ? -10 : radix)));
- return dst;
-}
-
-#endif
diff --git a/ext/mysql/libmysql/is_prefix.c b/ext/mysql/libmysql/is_prefix.c
deleted file mode 100644
index c0ed472103..0000000000
--- a/ext/mysql/libmysql/is_prefix.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : is_prefix.c
- Author : Michael Widenius
- Defines: is_prefix()
-
- is_prefix(s, t) returns 1 if s starts with t.
- A empty t is allways a prefix.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-int is_prefix(register const char *s, register const char *t)
-{
- while (*t)
- if (*s++ != *t++) return 0;
- return 1; /* WRONG */
-}
diff --git a/ext/mysql/libmysql/libmysql.c b/ext/mysql/libmysql/libmysql.c
deleted file mode 100644
index 05558cf3ee..0000000000
--- a/ext/mysql/libmysql/libmysql.c
+++ /dev/null
@@ -1,2604 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include <global.h>
-#if defined(__WIN__) || defined(_WIN32) || defined(_WIN64)
-#include <winsock.h>
-#include <odbcinst.h>
-#endif
-#include <my_sys.h>
-#include <mysys_err.h>
-#include <m_string.h>
-#include <m_ctype.h>
-#include "mysql.h"
-#include "mysql_version.h"
-#include "mysqld_error.h"
-#include "errmsg.h"
-#include <violite.h>
-#include <sys/stat.h>
-#include <signal.h>
-#include <time.h>
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-#if !defined(MSDOS) && !defined(__WIN__)
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#ifdef HAVE_SELECT_H
-# include <select.h>
-#endif
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#endif
-#ifdef HAVE_SYS_UN_H
-# include <sys/un.h>
-#endif
-#if defined(THREAD) && !defined(__WIN__)
-#include <my_pthread.h> /* because of signal() */
-#endif
-#ifndef INADDR_NONE
-#define INADDR_NONE -1
-#endif
-
-static my_bool mysql_client_init=0;
-uint mysql_port=0;
-my_string mysql_unix_port=0;
-
-#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_TRANSACTIONS)
-
-#ifdef __WIN__
-#define CONNECT_TIMEOUT 20
-#else
-#define CONNECT_TIMEOUT 0
-#endif
-
-#if defined(MSDOS) || defined(__WIN__)
-/* socket_errno is defined in global.h for all platforms */
-#define perror(A)
-#else
-#include <errno.h>
-#define SOCKET_ERROR -1
-#endif /* __WIN__ */
-
-static void mysql_once_init(void);
-static MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields,
- uint field_count);
-static int read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row,
- ulong *lengths);
-static void end_server(MYSQL *mysql);
-static void read_user_name(char *name);
-static void append_wild(char *to,char *end,const char *wild);
-static my_bool mysql_reconnect(MYSQL *mysql);
-static int send_file_to_server(MYSQL *mysql,const char *filename);
-static sig_handler pipe_sig_handler(int sig);
-static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
- const char *from, ulong length);
-
-/*
- Let the user specify that we don't want SIGPIPE; This doesn't however work
- with threaded applications as we can have multiple read in progress.
-*/
-
-#if !defined(__WIN__) && defined(SIGPIPE) && !defined(THREAD)
-#define init_sigpipe_variables sig_return old_signal_handler=(sig_return) 0;
-#define set_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) old_signal_handler=signal(SIGPIPE,pipe_sig_handler)
-#define reset_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) signal(SIGPIPE,old_signal_handler);
-#else
-#define init_sigpipe_variables
-#define set_sigpipe(mysql)
-#define reset_sigpipe(mysql)
-#endif
-
-/****************************************************************************
-* A modified version of connect(). connect2() allows you to specify
-* a timeout value, in seconds, that we should wait until we
-* derermine we can't connect to a particular host. If timeout is 0,
-* connect2() will behave exactly like connect().
-*
-* Base version coded by Steve Bernacki, Jr. <steve@navinet.net>
-*****************************************************************************/
-
-static int connect2(my_socket s, const struct sockaddr *name, uint namelen,
- uint timeout)
-{
-#if defined(__WIN__) || defined(OS2)
- return connect(s, (struct sockaddr*) name, namelen);
-#else
- int flags, res, s_err;
- SOCKOPT_OPTLEN_TYPE s_err_size = sizeof(uint);
- fd_set sfds;
- struct timeval tv;
- time_t start_time, now_time;
-
- /* If they passed us a timeout of zero, we should behave
- * exactly like the normal connect() call does.
- */
-
- if (timeout == 0)
- return connect(s, (struct sockaddr*) name, namelen);
-
- flags = fcntl(s, F_GETFL, 0); /* Set socket to not block */
-#ifdef O_NONBLOCK
- fcntl(s, F_SETFL, flags | O_NONBLOCK); /* and save the flags.. */
-#endif
-
- res = connect(s, (struct sockaddr*) name, namelen);
- s_err = errno; /* Save the error... */
- fcntl(s, F_SETFL, flags);
- if ((res != 0) && (s_err != EINPROGRESS))
- {
- errno = s_err; /* Restore it */
- return(-1);
- }
- if (res == 0) /* Connected quickly! */
- return(0);
-
- /* Otherwise, our connection is "in progress." We can use
- * the select() call to wait up to a specified period of time
- * for the connection to suceed. If select() returns 0
- * (after waiting howevermany seconds), our socket never became
- * writable (host is probably unreachable.) Otherwise, if
- * select() returns 1, then one of two conditions exist:
- *
- * 1. An error occured. We use getsockopt() to check for this.
- * 2. The connection was set up sucessfully: getsockopt() will
- * return 0 as an error.
- *
- * Thanks goes to Andrew Gierth <andrew@erlenstar.demon.co.uk>
- * who posted this method of timing out a connect() in
- * comp.unix.programmer on August 15th, 1997.
- */
-
- FD_ZERO(&sfds);
- FD_SET(s, &sfds);
- /*
- * select could be interrupted by a signal, and if it is,
- * the timeout should be adjusted and the select restarted
- * to work around OSes that don't restart select and
- * implementations of select that don't adjust tv upon
- * failure to reflect the time remaining
- */
- start_time = time(NULL);
- for (;;)
- {
- tv.tv_sec = (long) timeout;
- tv.tv_usec = 0;
- if ((res = select(s+1, NULL, &sfds, NULL, &tv)) >= 0)
- break;
- now_time=time(NULL);
- timeout-= (uint) (now_time - start_time);
- if (errno != EINTR || (int) timeout <= 0)
- return -1;
- }
-
- /* select() returned something more interesting than zero, let's
- * see if we have any errors. If the next two statements pass,
- * we've got an open socket!
- */
-
- s_err=0;
- if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char*) &s_err, &s_err_size) != 0)
- return(-1);
-
- if (s_err)
- { /* getsockopt could succeed */
- errno = s_err;
- return(-1); /* but return an error... */
- }
- return(0); /* It's all good! */
-#endif
-}
-
-/*
-** Create a named pipe connection
-*/
-
-#ifdef __WIN__
-
-HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host,
- char **arg_unix_socket)
-{
- HANDLE hPipe=INVALID_HANDLE_VALUE;
- char szPipeName [ 257 ];
- DWORD dwMode;
- int i;
- my_bool testing_named_pipes=0;
- char *host= *arg_host, *unix_socket= *arg_unix_socket;
-
- if ( ! unix_socket || (unix_socket)[0] == 0x00)
- unix_socket = mysql_unix_port;
- if (!host || !strcmp(host,LOCAL_HOST))
- host=LOCAL_HOST_NAMEDPIPE;
-
- sprintf( szPipeName, "\\\\%s\\pipe\\%s", host, unix_socket);
- DBUG_PRINT("info",("Server name: '%s'. Named Pipe: %s",
- host, unix_socket));
-
- for (i=0 ; i < 100 ; i++) /* Don't retry forever */
- {
- if ((hPipe = CreateFile(szPipeName,
- GENERIC_READ | GENERIC_WRITE,
- 0,
- NULL,
- OPEN_EXISTING,
- 0,
- NULL )) != INVALID_HANDLE_VALUE)
- break;
- if (GetLastError() != ERROR_PIPE_BUSY)
- {
- net->last_errno=CR_NAMEDPIPEOPEN_ERROR;
- sprintf(net->last_error,ER(net->last_errno),host, unix_socket,
- (ulong) GetLastError());
- return INVALID_HANDLE_VALUE;
- }
- /* wait for for an other instance */
- if (! WaitNamedPipe(szPipeName, connect_timeout*1000) )
- {
- net->last_errno=CR_NAMEDPIPEWAIT_ERROR;
- sprintf(net->last_error,ER(net->last_errno),host, unix_socket,
- (ulong) GetLastError());
- return INVALID_HANDLE_VALUE;
- }
- }
- if (hPipe == INVALID_HANDLE_VALUE)
- {
- net->last_errno=CR_NAMEDPIPEOPEN_ERROR;
- sprintf(net->last_error,ER(net->last_errno),host, unix_socket,
- (ulong) GetLastError());
- return INVALID_HANDLE_VALUE;
- }
- dwMode = PIPE_READMODE_BYTE | PIPE_WAIT;
- if ( !SetNamedPipeHandleState(hPipe, &dwMode, NULL, NULL) )
- {
- CloseHandle( hPipe );
- net->last_errno=CR_NAMEDPIPESETSTATE_ERROR;
- sprintf(net->last_error,ER(net->last_errno),host, unix_socket,
- (ulong) GetLastError());
- return INVALID_HANDLE_VALUE;
- }
- *arg_host=host ; *arg_unix_socket=unix_socket; /* connect arg */
- return (hPipe);
-}
-#endif
-
-
-/*****************************************************************************
-** read a packet from server. Give error message if socket was down
-** or packet is an error message
-*****************************************************************************/
-
-uint
-net_safe_read(MYSQL *mysql)
-{
- NET *net= &mysql->net;
- uint len=0;
- init_sigpipe_variables
-
- /* Don't give sigpipe errors if the client doesn't want them */
- set_sigpipe(mysql);
- if (net->vio != 0)
- len=my_net_read(net);
- reset_sigpipe(mysql);
-
- if (len == packet_error || len == 0)
- {
- DBUG_PRINT("error",("Wrong connection or packet. fd: %s len: %d",
- vio_description(net->vio),len));
- end_server(mysql);
- net->last_errno=(net->last_errno == ER_NET_PACKET_TOO_LARGE ?
- CR_NET_PACKET_TOO_LARGE:
- CR_SERVER_LOST);
- strmov(net->last_error,ER(net->last_errno));
- return(packet_error);
- }
- if (net->read_pos[0] == 255)
- {
- if (len > 3)
- {
- char *pos=(char*) net->read_pos+1;
- if (mysql->protocol_version > 9)
- { /* New client protocol */
- net->last_errno=uint2korr(pos);
- pos+=2;
- len-=2;
- }
- else
- {
- net->last_errno=CR_UNKNOWN_ERROR;
- len--;
- }
- (void) strmake(net->last_error,(char*) pos,
- min(len,sizeof(net->last_error)-1));
- }
- else
- {
- net->last_errno=CR_UNKNOWN_ERROR;
- (void) strmov(net->last_error,ER(net->last_errno));
- }
- DBUG_PRINT("error",("Got error: %d (%s)", net->last_errno,
- net->last_error));
- return(packet_error);
- }
- return len;
-}
-
-
-/* Get the length of next field. Change parameter to point at fieldstart */
-static ulong
-net_field_length(uchar **packet)
-{
- reg1 uchar *pos= *packet;
- if (*pos < 251)
- {
- (*packet)++;
- return (ulong) *pos;
- }
- if (*pos == 251)
- {
- (*packet)++;
- return NULL_LENGTH;
- }
- if (*pos == 252)
- {
- (*packet)+=3;
- return (ulong) uint2korr(pos+1);
- }
- if (*pos == 253)
- {
- (*packet)+=4;
- return (ulong) uint3korr(pos+1);
- }
- (*packet)+=9; /* Must be 254 when here */
- return (ulong) uint4korr(pos+1);
-}
-
-/* Same as above, but returns ulonglong values */
-
-static my_ulonglong
-net_field_length_ll(uchar **packet)
-{
- reg1 uchar *pos= *packet;
- if (*pos < 251)
- {
- (*packet)++;
- return (my_ulonglong) *pos;
- }
- if (*pos == 251)
- {
- (*packet)++;
- return (my_ulonglong) NULL_LENGTH;
- }
- if (*pos == 252)
- {
- (*packet)+=3;
- return (my_ulonglong) uint2korr(pos+1);
- }
- if (*pos == 253)
- {
- (*packet)+=4;
- return (my_ulonglong) uint3korr(pos+1);
- }
- (*packet)+=9; /* Must be 254 when here */
-#ifdef NO_CLIENT_LONGLONG
- return (my_ulonglong) uint4korr(pos+1);
-#else
- return (my_ulonglong) uint8korr(pos+1);
-#endif
-}
-
-
-static void free_rows(MYSQL_DATA *cur)
-{
- if (cur)
- {
- free_root(&cur->alloc,MYF(0));
- my_free((gptr) cur,MYF(0));
- }
-}
-
-
-int
-simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
- uint length, my_bool skipp_check)
-{
- NET *net= &mysql->net;
- int result= -1;
- init_sigpipe_variables
-
- /* Don't give sigpipe errors if the client doesn't want them */
- set_sigpipe(mysql);
- if (mysql->net.vio == 0)
- { /* Do reconnect if possible */
- if (mysql_reconnect(mysql))
- {
- net->last_errno=CR_SERVER_GONE_ERROR;
- strmov(net->last_error,ER(net->last_errno));
- goto end;
- }
- }
- if (mysql->status != MYSQL_STATUS_READY)
- {
- strmov(net->last_error,ER(mysql->net.last_errno=CR_COMMANDS_OUT_OF_SYNC));
- goto end;
- }
-
- mysql->net.last_error[0]=0;
- mysql->net.last_errno=0;
- mysql->info=0;
- mysql->affected_rows= ~(my_ulonglong) 0;
- net_clear(net); /* Clear receive buffer */
- if (!arg)
- arg="";
-
- if (net_write_command(net,(uchar) command,arg,
- length ? length : (ulong) strlen(arg)))
- {
- DBUG_PRINT("error",("Can't send command to server. Error: %d",socket_errno));
- end_server(mysql);
- if (mysql_reconnect(mysql) ||
- net_write_command(net,(uchar) command,arg,
- length ? length : (ulong) strlen(arg)))
- {
- net->last_errno=CR_SERVER_GONE_ERROR;
- strmov(net->last_error,ER(net->last_errno));
- goto end;
- }
- }
- result=0;
- if (!skipp_check)
- result= ((mysql->packet_length=net_safe_read(mysql)) == packet_error ?
- -1 : 0);
- end:
- reset_sigpipe(mysql);
- return result;
-}
-
-
-static void free_old_query(MYSQL *mysql)
-{
- DBUG_ENTER("free_old_query");
- if (mysql->fields)
- free_root(&mysql->field_alloc,MYF(0));
- init_alloc_root(&mysql->field_alloc,8192,0); /* Assume rowlength < 8192 */
- mysql->fields=0;
- mysql->field_count=0; /* For API */
- DBUG_VOID_RETURN;
-}
-
-#if defined(HAVE_GETPWUID) && defined(NO_GETPWUID_DECL)
-struct passwd *getpwuid(uid_t);
-char* getlogin(void);
-#endif
-
-#if !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) && !defined(OS2)
-static void read_user_name(char *name)
-{
- DBUG_ENTER("read_user_name");
- if (geteuid() == 0)
- (void) strmov(name,"root"); /* allow use of surun */
- else
- {
-#ifdef HAVE_GETPWUID
- struct passwd *skr;
- const char *str;
- if ((str=getlogin()) == NULL)
- {
- if ((skr=getpwuid(geteuid())) != NULL)
- str=skr->pw_name;
- else if (!(str=getenv("USER")) && !(str=getenv("LOGNAME")) &&
- !(str=getenv("LOGIN")))
- str="UNKNOWN_USER";
- }
- (void) strmake(name,str,USERNAME_LENGTH);
-#elif HAVE_CUSERID
- (void) cuserid(name);
-#else
- strmov(name,"UNKNOWN_USER");
-#endif
- }
- DBUG_VOID_RETURN;
-}
-
-#else /* If MSDOS || VMS */
-
-static void read_user_name(char *name)
-{
- char *str=getenv("USER"); /* ODBC will send user variable */
- strmake(name,str ? str : "ODBC", USERNAME_LENGTH);
-}
-
-#endif
-
-#ifdef __WIN__
-static my_bool is_NT(void)
-{
- char *os=getenv("OS");
- return (os && !strcmp(os, "Windows_NT")) ? 1 : 0;
-}
-#endif
-
-/*
-** Expand wildcard to a sql string
-*/
-
-static void
-append_wild(char *to, char *end, const char *wild)
-{
- end-=5; /* Some extra */
- if (wild && wild[0])
- {
- to=strmov(to," like '");
- while (*wild && to < end)
- {
- if (*wild == '\\' || *wild == '\'')
- *to++='\\';
- *to++= *wild++;
- }
- if (*wild) /* Too small buffer */
- *to++='%'; /* Nicer this way */
- to[0]='\'';
- to[1]=0;
- }
-}
-
-
-
-/**************************************************************************
-** Init debugging if MYSQL_DEBUG environment variable is found
-**************************************************************************/
-
-void STDCALL
-mysql_debug(const char *debug __attribute__((unused)))
-{
-#ifndef DBUG_OFF
- char *env;
- if (_db_on_)
- return; /* Already using debugging */
- if (debug)
- {
- DEBUGGER_ON;
- DBUG_PUSH(debug);
- }
- else if ((env = getenv("MYSQL_DEBUG")))
- {
- DEBUGGER_ON;
- DBUG_PUSH(env);
-#if !defined(_WINVER) && !defined(WINVER)
- puts("\n-------------------------------------------------------");
- puts("MYSQL_DEBUG found. libmysql started with the following:");
- puts(env);
- puts("-------------------------------------------------------\n");
-#else
- {
- char buff[80];
- strmov(strmov(buff,"libmysql: "),env);
- MessageBox((HWND) 0,"Debugging variable MYSQL_DEBUG used",buff,MB_OK);
- }
-#endif
- }
-#endif
-}
-
-
-/**************************************************************************
-** Close the server connection if we get a SIGPIPE
- ARGSUSED
-**************************************************************************/
-
-static sig_handler
-pipe_sig_handler(int sig __attribute__((unused)))
-{
- DBUG_PRINT("info",("Hit by signal %d",sig));
-#ifdef DONT_REMEMBER_SIGNAL
- (void) signal(SIGPIPE,pipe_sig_handler);
-#endif
-}
-
-
-/**************************************************************************
-** Shut down connection
-**************************************************************************/
-
-static void
-end_server(MYSQL *mysql)
-{
- DBUG_ENTER("end_server");
- if (mysql->net.vio != 0)
- {
- init_sigpipe_variables
- DBUG_PRINT("info",("Net: %s", vio_description(mysql->net.vio)));
- set_sigpipe(mysql);
- vio_delete(mysql->net.vio);
- reset_sigpipe(mysql);
- mysql->net.vio= 0; /* Marker */
- }
- net_end(&mysql->net);
- free_old_query(mysql);
- DBUG_VOID_RETURN;
-}
-
-
-void STDCALL
-mysql_free_result(MYSQL_RES *result)
-{
- DBUG_ENTER("mysql_free_result");
- DBUG_PRINT("enter",("mysql_res: %lx",result));
- if (result)
- {
- if (result->handle && result->handle->status == MYSQL_STATUS_USE_RESULT)
- {
- DBUG_PRINT("warning",("Not all rows in set were read; Ignoring rows"));
- for (;;)
- {
- uint pkt_len;
- if ((pkt_len=(uint) net_safe_read(result->handle)) == packet_error)
- break;
- if (pkt_len == 1 && result->handle->net.read_pos[0] == 254)
- break; /* End of data */
- }
- result->handle->status=MYSQL_STATUS_READY;
- }
- free_rows(result->data);
- if (result->fields)
- free_root(&result->field_alloc,MYF(0));
- if (result->row)
- my_free((gptr) result->row,MYF(0));
- my_free((gptr) result,MYF(0));
- }
- DBUG_VOID_RETURN;
-}
-
-
-/****************************************************************************
-** Get options from my.cnf
-****************************************************************************/
-
-static const char *default_options[]=
-{
- "port","socket","compress","password","pipe", "timeout", "user",
- "init-command", "host", "database", "debug", "return-found-rows",
- "ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath",
- "character-set-dir", "default-character-set", "interactive-timeout",
- "connect-timeout", "local-infile", "disable-local-infile",
- NullS
-};
-
-static TYPELIB option_types={array_elements(default_options)-1,
- "options",default_options};
-
-static void mysql_read_default_options(struct st_mysql_options *options,
- const char *filename,const char *group)
-{
- int argc;
- char *argv_buff[1],**argv;
- const char *groups[3];
- DBUG_ENTER("mysql_read_default_options");
- DBUG_PRINT("enter",("file: %s group: %s",filename,group ? group :"NULL"));
-
- argc=1; argv=argv_buff; argv_buff[0]= (char*) "client";
- groups[0]= (char*) "client"; groups[1]= (char*) group; groups[2]=0;
-
- load_defaults(filename, groups, &argc, &argv);
- if (argc != 1) /* If some default option */
- {
- char **option=argv;
- while (*++option)
- {
- /* DBUG_PRINT("info",("option: %s",option[0])); */
- if (option[0][0] == '-' && option[0][1] == '-')
- {
- char *end=strcend(*option,'=');
- char *opt_arg=0;
- if (*end)
- {
- opt_arg=end+1;
- *end=0; /* Remove '=' */
- }
- /* Change all '_' in variable name to '-' */
- for (end= *option ; (end= strcend(end,'_')) ; )
- *end= '-';
- switch (find_type(*option+2,&option_types,2)) {
- case 1: /* port */
- if (opt_arg)
- options->port=atoi(opt_arg);
- break;
- case 2: /* socket */
- if (opt_arg)
- {
- my_free(options->unix_socket,MYF(MY_ALLOW_ZERO_PTR));
- options->unix_socket=my_strdup(opt_arg,MYF(MY_WME));
- }
- break;
- case 3: /* compress */
- options->compress=1;
- break;
- case 4: /* password */
- if (opt_arg)
- {
- my_free(options->password,MYF(MY_ALLOW_ZERO_PTR));
- options->password=my_strdup(opt_arg,MYF(MY_WME));
- }
- break;
- case 5: /* pipe */
- options->named_pipe=1; /* Force named pipe */
- break;
- case 20: /* connect_timeout */
- case 6: /* timeout */
- if (opt_arg)
- options->connect_timeout=atoi(opt_arg);
- break;
- case 7: /* user */
- if (opt_arg)
- {
- my_free(options->user,MYF(MY_ALLOW_ZERO_PTR));
- options->user=my_strdup(opt_arg,MYF(MY_WME));
- }
- break;
- case 8: /* init-command */
- if (opt_arg)
- {
- my_free(options->init_command,MYF(MY_ALLOW_ZERO_PTR));
- options->init_command=my_strdup(opt_arg,MYF(MY_WME));
- }
- break;
- case 9: /* host */
- if (opt_arg)
- {
- my_free(options->host,MYF(MY_ALLOW_ZERO_PTR));
- options->host=my_strdup(opt_arg,MYF(MY_WME));
- }
- break;
- case 10: /* database */
- if (opt_arg)
- {
- my_free(options->db,MYF(MY_ALLOW_ZERO_PTR));
- options->db=my_strdup(opt_arg,MYF(MY_WME));
- }
- break;
- case 11: /* debug */
- mysql_debug(opt_arg ? opt_arg : "d:t:o,/tmp/client.trace");
- break;
- case 12: /* return-found-rows */
- options->client_flag|=CLIENT_FOUND_ROWS;
- break;
-#ifdef HAVE_OPENSSL
- case 13: /* ssl_key */
- my_free(options->ssl_key, MYF(MY_ALLOW_ZERO_PTR));
- options->ssl_key = my_strdup(opt_arg, MYF(MY_WME));
- break;
- case 14: /* ssl_cert */
- my_free(options->ssl_cert, MYF(MY_ALLOW_ZERO_PTR));
- options->ssl_cert = my_strdup(opt_arg, MYF(MY_WME));
- break;
- case 15: /* ssl_ca */
- my_free(options->ssl_ca, MYF(MY_ALLOW_ZERO_PTR));
- options->ssl_ca = my_strdup(opt_arg, MYF(MY_WME));
- break;
- case 16: /* ssl_capath */
- my_free(options->ssl_capath, MYF(MY_ALLOW_ZERO_PTR));
- options->ssl_capath = my_strdup(opt_arg, MYF(MY_WME));
- break;
-#else
- case 13: /* Ignore SSL options */
- case 14:
- case 15:
- case 16:
- break;
-#endif /* HAVE_OPENSSL */
- case 17: /* charset-lib */
- my_free(options->charset_dir,MYF(MY_ALLOW_ZERO_PTR));
- options->charset_dir = my_strdup(opt_arg, MYF(MY_WME));
- break;
- case 18:
- my_free(options->charset_name,MYF(MY_ALLOW_ZERO_PTR));
- options->charset_name = my_strdup(opt_arg, MYF(MY_WME));
- break;
- case 19: /* Interactive-timeout */
- options->client_flag|= CLIENT_INTERACTIVE;
- break;
- case 21:
- if (!opt_arg || atoi(opt_arg) != 0)
- options->client_flag|= CLIENT_LOCAL_FILES;
- else
- options->client_flag&= ~CLIENT_LOCAL_FILES;
- break;
- case 22:
- options->client_flag&= CLIENT_LOCAL_FILES;
- break;
- default:
- DBUG_PRINT("warning",("unknown option: %s",option[0]));
- }
- }
- }
- }
- free_defaults(argv);
- DBUG_VOID_RETURN;
-}
-
-
-/***************************************************************************
-** Change field rows to field structs
-***************************************************************************/
-
-static MYSQL_FIELD *
-unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
- my_bool default_value, my_bool long_flag_protocol)
-{
- MYSQL_ROWS *row;
- MYSQL_FIELD *field,*result;
- DBUG_ENTER("unpack_fields");
-
- field=result=(MYSQL_FIELD*) alloc_root(alloc,sizeof(MYSQL_FIELD)*fields);
- if (!result)
- DBUG_RETURN(0);
-
- for (row=data->data; row ; row = row->next,field++)
- {
- field->table= strdup_root(alloc,(char*) row->data[0]);
- field->name= strdup_root(alloc,(char*) row->data[1]);
- field->length= (uint) uint3korr(row->data[2]);
- field->type= (enum enum_field_types) (uchar) row->data[3][0];
- if (long_flag_protocol)
- {
- field->flags= uint2korr(row->data[4]);
- field->decimals=(uint) (uchar) row->data[4][2];
- }
- else
- {
- field->flags= (uint) (uchar) row->data[4][0];
- field->decimals=(uint) (uchar) row->data[4][1];
- }
- if (INTERNAL_NUM_FIELD(field))
- field->flags|= NUM_FLAG;
- if (default_value && row->data[5])
- field->def=strdup_root(alloc,(char*) row->data[5]);
- else
- field->def=0;
- field->max_length= 0;
- }
- free_rows(data); /* Free old data */
- DBUG_RETURN(result);
-}
-
-
-/* Read all rows (fields or data) from server */
-
-static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
- uint fields)
-{
- uint field,pkt_len;
- ulong len;
- uchar *cp;
- char *to, *end_to;
- MYSQL_DATA *result;
- MYSQL_ROWS **prev_ptr,*cur;
- NET *net = &mysql->net;
- DBUG_ENTER("read_rows");
-
- if ((pkt_len=(uint) net_safe_read(mysql)) == packet_error)
- DBUG_RETURN(0);
- if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
- MYF(MY_WME | MY_ZEROFILL))))
- {
- net->last_errno=CR_OUT_OF_MEMORY;
- strmov(net->last_error,ER(net->last_errno));
- DBUG_RETURN(0);
- }
- init_alloc_root(&result->alloc,8192,0); /* Assume rowlength < 8192 */
- result->alloc.min_malloc=sizeof(MYSQL_ROWS);
- prev_ptr= &result->data;
- result->rows=0;
- result->fields=fields;
-
- while (*(cp=net->read_pos) != 254 || pkt_len != 1)
- {
- result->rows++;
- if (!(cur= (MYSQL_ROWS*) alloc_root(&result->alloc,
- sizeof(MYSQL_ROWS))) ||
- !(cur->data= ((MYSQL_ROW)
- alloc_root(&result->alloc,
- (fields+1)*sizeof(char *)+pkt_len))))
- {
- free_rows(result);
- net->last_errno=CR_OUT_OF_MEMORY;
- strmov(net->last_error,ER(net->last_errno));
- DBUG_RETURN(0);
- }
- *prev_ptr=cur;
- prev_ptr= &cur->next;
- to= (char*) (cur->data+fields+1);
- end_to = to + pkt_len - 1;
- for (field=0 ; field < fields ; field++)
- {
- if ((len=(ulong) net_field_length(&cp)) == NULL_LENGTH)
- { /* null field */
- cur->data[field] = 0;
- }
- else
- {
- cur->data[field] = to;
- if (len > end_to - to)
- {
- free_rows(result);
- net->last_errno = CR_UNKNOWN_ERROR;
- strmov(net->last_error, ER(net->last_errno));
- DBUG_RETURN(0);
- }
- memcpy(to,(char*) cp,len); to[len]=0;
- to+=len+1;
- cp+=len;
- if (mysql_fields)
- {
- if (mysql_fields[field].max_length < len)
- mysql_fields[field].max_length=len;
- }
- }
- }
- cur->data[field]=to; /* End of last field */
- if ((pkt_len=net_safe_read(mysql)) == packet_error)
- {
- free_rows(result);
- DBUG_RETURN(0);
- }
- }
- *prev_ptr=0; /* last pointer is null */
- DBUG_PRINT("exit",("Got %d rows",result->rows));
- DBUG_RETURN(result);
-}
-
-
-/*
-** Read one row. Uses packet buffer as storage for fields.
-** When next packet is read, the previous field values are destroyed
-*/
-
-
-static int
-read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
-{
- uint field;
- ulong pkt_len,len;
- uchar *pos,*prev_pos,*end_pos;
-
- if ((pkt_len=(uint) net_safe_read(mysql)) == packet_error)
- return -1;
- if (pkt_len == 1 && mysql->net.read_pos[0] == 254)
- return 1; /* End of data */
- prev_pos= 0; /* allowed to write at packet[-1] */
- pos=mysql->net.read_pos;
- end_pos=pos+pkt_len;
- for (field=0 ; field < fields ; field++)
- {
- if ((len=(ulong) net_field_length(&pos)) == NULL_LENGTH)
- { /* null field */
- row[field] = 0;
- *lengths++=0;
- }
- else
- {
- if (len > end_pos - pos)
- {
- mysql->net.last_errno=CR_UNKNOWN_ERROR;
- strmov(mysql->net.last_error, ER(mysql->net.last_errno));
- return -1;
- }
- row[field] = (char*) pos;
- pos+=len;
- *lengths++=len;
- }
- if (prev_pos)
- *prev_pos=0; /* Terminate prev field */
- prev_pos=pos;
- }
- row[field]=(char*) prev_pos+1; /* End of last field */
- *prev_pos=0; /* Terminate last field */
- return 0;
-}
-
-/****************************************************************************
-** Init MySQL structure or allocate one
-****************************************************************************/
-
-MYSQL * STDCALL
-mysql_init(MYSQL *mysql)
-{
- mysql_once_init();
- if (!mysql)
- {
- if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL))))
- return 0;
- mysql->free_me=1;
- mysql->net.vio = 0;
- }
- else
- bzero((char*) (mysql),sizeof(*(mysql)));
- mysql->options.connect_timeout=CONNECT_TIMEOUT;
-#if defined(SIGPIPE) && defined(THREAD) && !defined(__WIN__)
- if (!((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE))
- (void) signal(SIGPIPE,pipe_sig_handler);
-#endif
-
-/*
- Only enable LOAD DATA INFILE by default if configured with
- --with-enabled-local-inflile
-*/
-#ifdef ENABLED_LOCAL_INFILE
- mysql->options.client_flag|= CLIENT_LOCAL_FILES;
-#endif
- return mysql;
-}
-
-
-static void mysql_once_init()
-{
- if (!mysql_client_init)
- {
- mysql_client_init=1;
- my_init(); /* Will init threads */
- init_client_errs();
- if (!mysql_port)
- {
- mysql_port = MYSQL_PORT;
-#ifndef MSDOS
- {
- struct servent *serv_ptr;
- char *env;
- if ((serv_ptr = getservbyname("mysql", "tcp")))
- mysql_port = (uint) ntohs((ushort) serv_ptr->s_port);
- if ((env = getenv("MYSQL_TCP_PORT")))
- mysql_port =(uint) atoi(env);
- }
-#endif
- }
- if (!mysql_unix_port)
- {
- char *env;
-#ifdef __WIN__
- mysql_unix_port = (char*) MYSQL_NAMEDPIPE;
-#else
- mysql_unix_port = (char*) MYSQL_UNIX_ADDR;
-#endif
- if ((env = getenv("MYSQL_UNIX_PORT")))
- mysql_unix_port = env;
- }
- mysql_debug(NullS);
-#if defined(SIGPIPE) && !defined(THREAD) && !defined(__WIN__)
- (void) signal(SIGPIPE,SIG_IGN);
-#endif
- }
-#ifdef THREAD
- else
- my_thread_init(); /* Init if new thread */
-#endif
-}
-
-#ifdef HAVE_OPENSSL
-/**************************************************************************
-** Fill in SSL part of MYSQL structure and set 'use_ssl' flag.
-** NB! Errors are not reported until you do mysql_real_connect.
-**************************************************************************/
-
-int STDCALL
-mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert,
- const char *ca, const char *capath)
-{
- mysql->options.ssl_key = key==0 ? 0 : my_strdup(key,MYF(0));
- mysql->options.ssl_cert = cert==0 ? 0 : my_strdup(cert,MYF(0));
- mysql->options.ssl_ca = ca==0 ? 0 : my_strdup(ca,MYF(0));
- mysql->options.ssl_capath = capath==0 ? 0 : my_strdup(capath,MYF(0));
- mysql->options.use_ssl = true;
- mysql->connector_fd = new_VioSSLConnectorFd(key, cert, ca, capath);
- return 0;
-}
-
-/**************************************************************************
-**************************************************************************/
-
-char * STDCALL
-mysql_ssl_cipher(MYSQL *mysql)
-{
- return (char *)mysql->net.vio->cipher_description();
-}
-
-
-/**************************************************************************
-** Free strings in the SSL structure and clear 'use_ssl' flag.
-** NB! Errors are not reported until you do mysql_real_connect.
-**************************************************************************/
-
-int STDCALL
-mysql_ssl_clear(MYSQL *mysql)
-{
- my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.ssl_cert, MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.ssl_ca, MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.ssl_capath, MYF(MY_ALLOW_ZERO_PTR));
- mysql->options.ssl_key = 0;
- mysql->options.ssl_cert = 0;
- mysql->options.ssl_ca = 0;
- mysql->options.ssl_capath = 0;
- mysql->options.use_ssl = false;
- mysql->connector_fd->delete();
- mysql->connector_fd = 0;
- return 0;
-}
-#endif /* HAVE_OPENSSL */
-
-/**************************************************************************
-** Connect to sql server
-** If host == 0 then use localhost
-**************************************************************************/
-
-MYSQL * STDCALL
-mysql_connect(MYSQL *mysql,const char *host,
- const char *user, const char *passwd)
-{
- MYSQL *res;
- mysql=mysql_init(mysql); /* Make it thread safe */
- {
- DBUG_ENTER("mysql_connect");
- if (!(res=mysql_real_connect(mysql,host,user,passwd,NullS,0,NullS,0)))
- {
- if (mysql->free_me)
- my_free((gptr) mysql,MYF(0));
- }
- DBUG_RETURN(res);
- }
-}
-
-
-/*
-** Note that the mysql argument must be initialized with mysql_init()
-** before calling mysql_real_connect !
-*/
-
-MYSQL * STDCALL
-mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
- const char *passwd, const char *db,
- uint port, const char *unix_socket,uint client_flag)
-{
- char buff[NAME_LEN+USERNAME_LENGTH+100],charset_name_buff[16];
- char *end,*host_info,*charset_name;
- my_socket sock;
- uint32 ip_addr;
- struct sockaddr_in sock_addr;
- uint pkt_length;
- NET *net= &mysql->net;
-#ifdef __WIN__
- HANDLE hPipe=INVALID_HANDLE_VALUE;
-#endif
-#ifdef HAVE_SYS_UN_H
- struct sockaddr_un UNIXaddr;
-#endif
- init_sigpipe_variables
- DBUG_ENTER("mysql_real_connect");
-
- DBUG_PRINT("enter",("host: %s db: %s user: %s",
- host ? host : "(Null)",
- db ? db : "(Null)",
- user ? user : "(Null)"));
-
- /* Don't give sigpipe errors if the client doesn't want them */
- set_sigpipe(mysql);
- net->vio = 0; /* If something goes wrong */
- /* use default options */
- if (mysql->options.my_cnf_file || mysql->options.my_cnf_group)
- {
- mysql_read_default_options(&mysql->options,
- (mysql->options.my_cnf_file ?
- mysql->options.my_cnf_file : "my"),
- mysql->options.my_cnf_group);
- my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
- mysql->options.my_cnf_file=mysql->options.my_cnf_group=0;
- }
-
- /* Some empty-string-tests are done because of ODBC */
- if (!host || !host[0])
- host=mysql->options.host;
- if (!user || !user[0])
- user=mysql->options.user;
- if (!passwd)
- {
- passwd=mysql->options.password;
-#ifndef DONT_USE_MYSQL_PWD
- if (!passwd)
- passwd=getenv("MYSQL_PWD"); /* get it from environment (haneke) */
-#endif
- }
- if (!db || !db[0])
- db=mysql->options.db;
- if (!port)
- port=mysql->options.port;
- if (!unix_socket)
- unix_socket=mysql->options.unix_socket;
-
- mysql->reconnect=1; /* Reconnect as default */
- mysql->server_status=SERVER_STATUS_AUTOCOMMIT;
-
- /*
- ** Grab a socket and connect it to the server
- */
-
-#if defined(HAVE_SYS_UN_H)
- if ((!host || !strcmp(host,LOCAL_HOST)) && (unix_socket || mysql_unix_port))
- {
- host=LOCAL_HOST;
- if (!unix_socket)
- unix_socket=mysql_unix_port;
- host_info=(char*) ER(CR_LOCALHOST_CONNECTION);
- DBUG_PRINT("info",("Using UNIX sock '%s'",unix_socket));
- if ((sock = socket(AF_UNIX,SOCK_STREAM,0)) == SOCKET_ERROR)
- {
- net->last_errno=CR_SOCKET_CREATE_ERROR;
- sprintf(net->last_error,ER(net->last_errno),socket_errno);
- goto error;
- }
- net->vio = vio_new(sock, VIO_TYPE_SOCKET, TRUE);
- bzero((char*) &UNIXaddr,sizeof(UNIXaddr));
- UNIXaddr.sun_family = AF_UNIX;
- strmov(UNIXaddr.sun_path, unix_socket);
- if (connect2(sock,(struct sockaddr *) &UNIXaddr, sizeof(UNIXaddr),
- mysql->options.connect_timeout) <0)
- {
- DBUG_PRINT("error",("Got error %d on connect to local server",socket_errno));
- net->last_errno=CR_CONNECTION_ERROR;
- sprintf(net->last_error,ER(net->last_errno),unix_socket,socket_errno);
- goto error;
- }
- }
- else
-#elif defined(__WIN__)
- {
- if ((unix_socket ||
- !host && is_NT() ||
- host && !strcmp(host,LOCAL_HOST_NAMEDPIPE) ||
- mysql->options.named_pipe || !have_tcpip))
- {
- sock=0;
- if ((hPipe=create_named_pipe(net, mysql->options.connect_timeout,
- (char**) &host, (char**) &unix_socket)) ==
- INVALID_HANDLE_VALUE)
- {
- DBUG_PRINT("error",
- ("host: '%s' socket: '%s' named_pipe: %d have_tcpip: %d",
- host ? host : "<null>",
- unix_socket ? unix_socket : "<null>",
- (int) mysql->options.named_pipe,
- (int) have_tcpip));
- if (mysql->options.named_pipe ||
- (host && !strcmp(host,LOCAL_HOST_NAMEDPIPE)) ||
- (unix_socket && !strcmp(unix_socket,MYSQL_NAMEDPIPE)))
- goto error; /* User only requested named pipes */
- /* Try also with TCP/IP */
- }
- else
- {
- net->vio=vio_new_win32pipe(hPipe);
- sprintf(host_info=buff, ER(CR_NAMEDPIPE_CONNECTION), host,
- unix_socket);
- }
- }
- }
- if (hPipe == INVALID_HANDLE_VALUE)
-#endif
- {
- unix_socket=0; /* This is not used */
- if (!port)
- port=mysql_port;
- if (!host)
- host=LOCAL_HOST;
- sprintf(host_info=buff,ER(CR_TCP_CONNECTION),host);
- DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host,port));
- /* _WIN64 ; Assume that the (int) range is enough for socket() */
- if ((sock = (my_socket) socket(AF_INET,SOCK_STREAM,0)) == SOCKET_ERROR)
- {
- net->last_errno=CR_IPSOCK_ERROR;
- sprintf(net->last_error,ER(net->last_errno),socket_errno);
- goto error;
- }
- net->vio = vio_new(sock,VIO_TYPE_TCPIP,FALSE);
- bzero((char*) &sock_addr,sizeof(sock_addr));
- sock_addr.sin_family = AF_INET;
-
- /*
- ** The server name may be a host name or IP address
- */
-
- if ((int) (ip_addr = inet_addr(host)) != (int) INADDR_NONE)
- {
- memcpy_fixed(&sock_addr.sin_addr,&ip_addr,sizeof(ip_addr));
- }
- else
-#if defined(HAVE_GETHOSTBYNAME_R) && defined(_REENTRANT) && defined(THREAD)
- {
- int tmp_errno;
- struct hostent tmp_hostent,*hp;
- char buff2[GETHOSTBYNAME_BUFF_SIZE];
- hp = my_gethostbyname_r(host,&tmp_hostent,buff2,sizeof(buff2),
- &tmp_errno);
- if (!hp)
- {
- net->last_errno=CR_UNKNOWN_HOST;
- sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, tmp_errno);
- goto error;
- }
- memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length);
- }
-#else
- {
- struct hostent *hp;
- if (!(hp=gethostbyname(host)))
- {
- net->last_errno=CR_UNKNOWN_HOST;
- sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, socket_errno);
- goto error;
- }
- memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length);
- }
-#endif
- sock_addr.sin_port = (ushort) htons((ushort) port);
- if (connect2(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr),
- mysql->options.connect_timeout) <0)
- {
- DBUG_PRINT("error",("Got error %d on connect to '%s'",socket_errno,host));
- net->last_errno= CR_CONN_HOST_ERROR;
- sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, socket_errno);
- goto error;
- }
- }
-
- if (!net->vio || my_net_init(net, net->vio))
- {
- vio_delete(net->vio);
- net->vio = 0;
- net->last_errno=CR_OUT_OF_MEMORY;
- strmov(net->last_error,ER(net->last_errno));
- goto error;
- }
- vio_keepalive(net->vio,TRUE);
-
- /* Get version info */
- mysql->protocol_version= PROTOCOL_VERSION; /* Assume this */
- if (mysql->options.connect_timeout &&
- vio_poll_read(net->vio, mysql->options.connect_timeout))
- {
- net->last_errno= CR_SERVER_LOST;
- strmov(net->last_error,ER(net->last_errno));
- goto error;
- }
- if ((pkt_length=net_safe_read(mysql)) == packet_error)
- goto error;
-
- /* Check if version of protocoll matches current one */
-
- mysql->protocol_version= net->read_pos[0];
- DBUG_DUMP("packet",(char*) net->read_pos,10);
- DBUG_PRINT("info",("mysql protocol version %d, server=%d",
- PROTOCOL_VERSION, mysql->protocol_version));
- if (mysql->protocol_version != PROTOCOL_VERSION &&
- mysql->protocol_version != PROTOCOL_VERSION-1)
- {
- net->last_errno= CR_VERSION_ERROR;
- sprintf(net->last_error, ER(CR_VERSION_ERROR), mysql->protocol_version,
- PROTOCOL_VERSION);
- goto error;
- }
- end=strend((char*) net->read_pos+1);
- mysql->thread_id=uint4korr(end+1);
- end+=5;
- strmake(mysql->scramble_buff,end,8);
- end+=9;
- if (pkt_length >= (uint) (end+1 - (char*) net->read_pos))
- mysql->server_capabilities=uint2korr(end);
- if (pkt_length >= (uint) (end+18 - (char*) net->read_pos))
- {
- /* New protocol with 16 bytes to describe server characteristics */
- mysql->server_language=end[2];
- mysql->server_status=uint2korr(end+3);
- }
-
- /* Set character set */
- if ((charset_name=mysql->options.charset_name))
- {
- const char *save=charsets_dir;
- if (mysql->options.charset_dir)
- charsets_dir=mysql->options.charset_dir;
- mysql->charset=get_charset_by_name(mysql->options.charset_name,
- MYF(MY_WME));
- charsets_dir=save;
- }
- else if (mysql->server_language)
- {
- charset_name=charset_name_buff;
- sprintf(charset_name,"%d",mysql->server_language); /* In case of errors */
- if (!(mysql->charset =
- get_charset((uint8) mysql->server_language, MYF(MY_WME))))
- mysql->charset = default_charset_info; /* shouldn't be fatal */
-
- }
- else
- mysql->charset=default_charset_info;
-
- if (!mysql->charset)
- {
- net->last_errno=CR_CANT_READ_CHARSET;
- if (mysql->options.charset_dir)
- sprintf(net->last_error,ER(net->last_errno),
- charset_name ? charset_name : "unknown",
- mysql->options.charset_dir);
- else
- {
- char cs_dir_name[FN_REFLEN];
- get_charsets_dir(cs_dir_name);
- sprintf(net->last_error,ER(net->last_errno),
- charset_name ? charset_name : "unknown",
- cs_dir_name);
- }
- goto error;
- }
-
- /* Save connection information */
- if (!user) user="";
- if (!passwd) passwd="";
- if (!my_multi_malloc(MYF(0),
- &mysql->host_info, (uint) strlen(host_info)+1,
- &mysql->host, (uint) strlen(host)+1,
- &mysql->unix_socket,unix_socket ?
- (uint) strlen(unix_socket)+1 : (uint) 1,
- &mysql->server_version,
- (uint) (end - (char*) net->read_pos),
- NullS) ||
- !(mysql->user=my_strdup(user,MYF(0))) ||
- !(mysql->passwd=my_strdup(passwd,MYF(0))))
- {
- strmov(net->last_error, ER(net->last_errno=CR_OUT_OF_MEMORY));
- goto error;
- }
- strmov(mysql->host_info,host_info);
- strmov(mysql->host,host);
- if (unix_socket)
- strmov(mysql->unix_socket,unix_socket);
- else
- mysql->unix_socket=0;
- strmov(mysql->server_version,(char*) net->read_pos+1);
- mysql->port=port;
- client_flag|=mysql->options.client_flag;
-
- /* Send client information for access check */
- client_flag|=CLIENT_CAPABILITIES;
-
-#ifdef HAVE_OPENSSL
- if (mysql->options.use_ssl)
- client_flag|=CLIENT_SSL;
-#endif /* HAVE_OPENSSL */
- if (db)
- client_flag|=CLIENT_CONNECT_WITH_DB;
-#ifdef HAVE_COMPRESS
- if ((mysql->server_capabilities & CLIENT_COMPRESS) &&
- (mysql->options.compress || (client_flag & CLIENT_COMPRESS)))
- client_flag|=CLIENT_COMPRESS; /* We will use compression */
- else
-#endif
- client_flag&= ~CLIENT_COMPRESS;
-
-#ifdef HAVE_OPENSSL
- if ((mysql->server_capabilities & CLIENT_SSL) &&
- (mysql->options.use_ssl || (client_flag & CLIENT_SSL)))
- {
- DBUG_PRINT("info", ("Changing IO layer to SSL"));
- client_flag |= CLIENT_SSL;
- }
- else
- {
- if (client_flag & CLIENT_SSL)
- {
- DBUG_PRINT("info", ("Leaving IO layer intact because server doesn't support SSL"));
- }
- client_flag &= ~CLIENT_SSL;
- }
-#endif /* HAVE_OPENSSL */
-
- int2store(buff,client_flag);
- mysql->client_flag=client_flag;
-
-#ifdef HAVE_OPENSSL
- /* Oops.. are we careful enough to not send ANY information */
- /* without encryption? */
- if (client_flag & CLIENT_SSL)
- {
- if (my_net_write(net,buff,(uint) (2)) || net_flush(net))
- goto error;
- /* Do the SSL layering. */
- DBUG_PRINT("info", ("IO layer change in progress..."));
- VioSSLConnectorFd* connector_fd = (VioSSLConnectorFd*)
- (mysql->connector_fd);
- VioSocket* vio_socket = (VioSocket*)(mysql->net.vio);
- VioSSL* vio_ssl = connector_fd->connect(vio_socket);
- mysql->net.vio = (NetVio*)(vio_ssl);
- }
-#endif /* HAVE_OPENSSL */
-
- DBUG_PRINT("info",("Server version = '%s' capabilites: %ld status: %d client_flag: %d",
- mysql->server_version,mysql->server_capabilities,
- mysql->server_status, client_flag));
-
- int3store(buff+2,max_allowed_packet);
- if (user && user[0])
- strmake(buff+5,user,32); /* Max user name */
- else
- read_user_name((char*) buff+5);
-#ifdef _CUSTOMCONFIG_
-#include "_cust_libmysql.h";
-#endif
- DBUG_PRINT("info",("user: %s",buff+5));
- end=scramble(strend(buff+5)+1, mysql->scramble_buff, passwd,
- (my_bool) (mysql->protocol_version == 9));
- if (db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB))
- {
- end=strmake(end+1,db,NAME_LEN);
- mysql->db=my_strdup(db,MYF(MY_WME));
- db=0;
- }
- if (my_net_write(net,buff,(uint) (end-buff)) || net_flush(net) ||
- net_safe_read(mysql) == packet_error)
- goto error;
- if (client_flag & CLIENT_COMPRESS) /* We will use compression */
- net->compress=1;
- if (db && mysql_select_db(mysql,db))
- goto error;
- if (mysql->options.init_command)
- {
- my_bool reconnect=mysql->reconnect;
- mysql->reconnect=0;
- if (mysql_query(mysql,mysql->options.init_command))
- goto error;
- mysql_free_result(mysql_use_result(mysql));
- mysql->reconnect=reconnect;
- }
-
- DBUG_PRINT("exit",("Mysql handler: %lx",mysql));
- reset_sigpipe(mysql);
- DBUG_RETURN(mysql);
-
-error:
- reset_sigpipe(mysql);
- DBUG_PRINT("error",("message: %u (%s)",net->last_errno,net->last_error));
- {
- /* Free alloced memory */
- my_bool free_me=mysql->free_me;
- end_server(mysql);
- mysql->free_me=0;
- mysql_close(mysql);
- mysql->free_me=free_me;
- }
- DBUG_RETURN(0);
-}
-
-
-static my_bool mysql_reconnect(MYSQL *mysql)
-{
- MYSQL tmp_mysql;
- DBUG_ENTER("mysql_reconnect");
-
- if (!mysql->reconnect ||
- (mysql->server_status & SERVER_STATUS_IN_TRANS) || !mysql->host_info)
- {
- /* Allov reconnect next time */
- mysql->server_status&= ~SERVER_STATUS_IN_TRANS;
- DBUG_RETURN(1);
- }
- mysql_init(&tmp_mysql);
- tmp_mysql.options=mysql->options;
- bzero((char*) &mysql->options,sizeof(mysql->options));
- if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,
- mysql->db, mysql->port, mysql->unix_socket,
- mysql->client_flag))
- DBUG_RETURN(1);
- tmp_mysql.free_me=mysql->free_me;
- mysql->free_me=0;
- mysql_close(mysql);
- *mysql=tmp_mysql;
- net_clear(&mysql->net);
- mysql->affected_rows= ~(my_ulonglong) 0;
- DBUG_RETURN(0);
-}
-
-
-/**************************************************************************
-** Change user and database
-**************************************************************************/
-
-my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
- const char *passwd, const char *db)
-{
- char buff[512],*pos=buff;
- DBUG_ENTER("mysql_change_user");
-
- if (!user)
- user="";
- if (!passwd)
- passwd="";
-
- pos=strmov(pos,user)+1;
- pos=scramble(pos, mysql->scramble_buff, passwd,
- (my_bool) (mysql->protocol_version == 9));
- pos=strmov(pos+1,db ? db : "");
- if (simple_command(mysql,COM_CHANGE_USER, buff,(uint) (pos-buff),0))
- DBUG_RETURN(1);
-
- my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
-
- mysql->user= my_strdup(user,MYF(MY_WME));
- mysql->passwd=my_strdup(passwd,MYF(MY_WME));
- mysql->db= db ? my_strdup(db,MYF(MY_WME)) : 0;
- DBUG_RETURN(0);
-}
-
-
-/**************************************************************************
-** Set current database
-**************************************************************************/
-
-int STDCALL
-mysql_select_db(MYSQL *mysql, const char *db)
-{
- int error;
- DBUG_ENTER("mysql_select_db");
- DBUG_PRINT("enter",("db: '%s'",db));
-
- if ((error=simple_command(mysql,COM_INIT_DB,db,(uint) strlen(db),0)))
- DBUG_RETURN(error);
- my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
- mysql->db=my_strdup(db,MYF(MY_WME));
- DBUG_RETURN(0);
-}
-
-
-/*************************************************************************
-** Send a QUIT to the server and close the connection
-** If handle is alloced by mysql connect free it.
-*************************************************************************/
-
-void STDCALL
-mysql_close(MYSQL *mysql)
-{
- DBUG_ENTER("mysql_close");
- if (mysql) /* Some simple safety */
- {
- if (mysql->net.vio != 0)
- {
- free_old_query(mysql);
- mysql->status=MYSQL_STATUS_READY; /* Force command */
- mysql->reconnect=0;
- simple_command(mysql,COM_QUIT,NullS,0,1);
- end_server(mysql);
- }
- my_free((gptr) mysql->host_info,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.init_command,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.user,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.host,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.password,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.unix_socket,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.db,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
- /* Clear pointers for better safety */
- mysql->host_info=mysql->user=mysql->passwd=mysql->db=0;
- bzero((char*) &mysql->options,sizeof(mysql->options));
- mysql->net.vio = 0;
-#ifdef HAVE_OPENSSL
- ((VioConnectorFd*)(mysql->connector_fd))->delete();
- mysql->connector_fd = 0;
-#endif /* HAVE_OPENSSL */
- if (mysql->free_me)
- my_free((gptr) mysql,MYF(0));
- }
- DBUG_VOID_RETURN;
-}
-
-
-/**************************************************************************
-** Do a query. If query returned rows, free old rows.
-** Read data by mysql_store_result or by repeat call of mysql_fetch_row
-**************************************************************************/
-
-int STDCALL
-mysql_query(MYSQL *mysql, const char *query)
-{
- return mysql_real_query(mysql,query, (uint) strlen(query));
-}
-
-/*
- Send the query and return so we can do something else.
- Needs to be followed by mysql_read_query_result() when we want to
- finish processing it.
-*/
-
-int STDCALL
-mysql_send_query(MYSQL* mysql, const char* query, uint length)
-{
- return simple_command(mysql, COM_QUERY, query, length, 1);
-}
-
-int STDCALL mysql_read_query_result(MYSQL *mysql)
-{
- uchar *pos;
- ulong field_count;
- MYSQL_DATA *fields;
- uint length;
- DBUG_ENTER("mysql_read_query_result");
-
- if ((length = net_safe_read(mysql)) == packet_error)
- DBUG_RETURN(-1);
- free_old_query(mysql); /* Free old result */
-get_info:
- pos=(uchar*) mysql->net.read_pos;
- if ((field_count= net_field_length(&pos)) == 0)
- {
- mysql->affected_rows= net_field_length_ll(&pos);
- mysql->insert_id= net_field_length_ll(&pos);
- if (mysql->server_capabilities & CLIENT_TRANSACTIONS)
- {
- mysql->server_status=uint2korr(pos); pos+=2;
- }
- if (pos < mysql->net.read_pos+length && net_field_length(&pos))
- mysql->info=(char*) pos;
- DBUG_RETURN(0);
- }
- if (field_count == NULL_LENGTH) /* LOAD DATA LOCAL INFILE */
- {
- int error=send_file_to_server(mysql,(char*) pos);
- if ((length=net_safe_read(mysql)) == packet_error || error)
- DBUG_RETURN(-1);
- goto get_info; /* Get info packet */
- }
- if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT))
- mysql->server_status|= SERVER_STATUS_IN_TRANS;
-
- mysql->extra_info= net_field_length_ll(&pos); /* Maybe number of rec */
- if (!(fields=read_rows(mysql,(MYSQL_FIELD*) 0,5)))
- DBUG_RETURN(-1);
- if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,
- (uint) field_count,0,
- (my_bool) test(mysql->server_capabilities &
- CLIENT_LONG_FLAG))))
- DBUG_RETURN(-1);
- mysql->status=MYSQL_STATUS_GET_RESULT;
- mysql->field_count=field_count;
- DBUG_RETURN(0);
-}
-
-int STDCALL
-mysql_real_query(MYSQL *mysql, const char *query, uint length)
-{
- DBUG_ENTER("mysql_real_query");
- DBUG_PRINT("enter",("handle: %lx",mysql));
- DBUG_PRINT("query",("Query = \"%s\"",query));
- if (simple_command(mysql,COM_QUERY,query,length,1))
- DBUG_RETURN(-1);
- DBUG_RETURN(mysql_read_query_result(mysql));
-}
-
-static int
-send_file_to_server(MYSQL *mysql, const char *filename)
-{
- int fd, readcount;
- char buf[IO_SIZE*15],*tmp_name;
- DBUG_ENTER("send_file_to_server");
-
- fn_format(buf,filename,"","",4); /* Convert to client format */
- if (!(tmp_name=my_strdup(buf,MYF(0))))
- {
- strmov(mysql->net.last_error, ER(mysql->net.last_errno=CR_OUT_OF_MEMORY));
- DBUG_RETURN(-1);
- }
- if ((fd = my_open(tmp_name,O_RDONLY, MYF(0))) < 0)
- {
- mysql->net.last_errno=EE_FILENOTFOUND;
- sprintf(buf,EE(mysql->net.last_errno),tmp_name,errno);
- strmake(mysql->net.last_error,buf,sizeof(mysql->net.last_error)-1);
- my_net_write(&mysql->net,"",0); net_flush(&mysql->net);
- my_free(tmp_name,MYF(0));
- DBUG_RETURN(-1);
- }
-
- while ((readcount = (int) my_read(fd,buf,sizeof(buf),MYF(0))) > 0)
- {
- if (my_net_write(&mysql->net,buf,readcount))
- {
- mysql->net.last_errno=CR_SERVER_LOST;
- strmov(mysql->net.last_error,ER(mysql->net.last_errno));
- DBUG_PRINT("error",("Lost connection to MySQL server during LOAD DATA of local file"));
- (void) my_close(fd,MYF(0));
- my_free(tmp_name,MYF(0));
- DBUG_RETURN(-1);
- }
- }
- (void) my_close(fd,MYF(0));
- /* Send empty packet to mark end of file */
- if (my_net_write(&mysql->net,"",0) || net_flush(&mysql->net))
- {
- mysql->net.last_errno=CR_SERVER_LOST;
- sprintf(mysql->net.last_error,ER(mysql->net.last_errno),socket_errno);
- my_free(tmp_name,MYF(0));
- DBUG_RETURN(-1);
- }
- if (readcount < 0)
- {
- mysql->net.last_errno=EE_READ; /* the errmsg for not entire file read */
- sprintf(buf,EE(mysql->net.last_errno),tmp_name,errno);
- strmake(mysql->net.last_error,buf,sizeof(mysql->net.last_error)-1);
- my_free(tmp_name,MYF(0));
- DBUG_RETURN(-1);
- }
- DBUG_RETURN(0);
-}
-
-
-/**************************************************************************
-** Alloc result struct for buffered results. All rows are read to buffer.
-** mysql_data_seek may be used.
-**************************************************************************/
-
-MYSQL_RES * STDCALL
-mysql_store_result(MYSQL *mysql)
-{
- MYSQL_RES *result;
- DBUG_ENTER("mysql_store_result");
-
- if (!mysql->fields)
- DBUG_RETURN(0);
- if (mysql->status != MYSQL_STATUS_GET_RESULT)
- {
- strmov(mysql->net.last_error,
- ER(mysql->net.last_errno=CR_COMMANDS_OUT_OF_SYNC));
- DBUG_RETURN(0);
- }
- mysql->status=MYSQL_STATUS_READY; /* server is ready */
- if (!(result=(MYSQL_RES*) my_malloc(sizeof(MYSQL_RES)+
- sizeof(ulong)*mysql->field_count,
- MYF(MY_WME | MY_ZEROFILL))))
- {
- mysql->net.last_errno=CR_OUT_OF_MEMORY;
- strmov(mysql->net.last_error, ER(mysql->net.last_errno));
- DBUG_RETURN(0);
- }
- result->eof=1; /* Marker for buffered */
- result->lengths=(ulong*) (result+1);
- if (!(result->data=read_rows(mysql,mysql->fields,mysql->field_count)))
- {
- my_free((gptr) result,MYF(0));
- DBUG_RETURN(0);
- }
- mysql->affected_rows= result->row_count= result->data->rows;
- result->data_cursor= result->data->data;
- result->fields= mysql->fields;
- result->field_alloc= mysql->field_alloc;
- result->field_count= mysql->field_count;
- result->current_field=0;
- result->current_row=0; /* Must do a fetch first */
- mysql->fields=0; /* fields is now in result */
- DBUG_RETURN(result); /* Data fetched */
-}
-
-
-/**************************************************************************
-** Alloc struct for use with unbuffered reads. Data is fetched by domand
-** when calling to mysql_fetch_row.
-** mysql_data_seek is a noop.
-**
-** No other queries may be specified with the same MYSQL handle.
-** There shouldn't be much processing per row because mysql server shouldn't
-** have to wait for the client (and will not wait more than 30 sec/packet).
-**************************************************************************/
-
-MYSQL_RES * STDCALL
-mysql_use_result(MYSQL *mysql)
-{
- MYSQL_RES *result;
- DBUG_ENTER("mysql_use_result");
-
- if (!mysql->fields)
- DBUG_RETURN(0);
- if (mysql->status != MYSQL_STATUS_GET_RESULT)
- {
- strmov(mysql->net.last_error,
- ER(mysql->net.last_errno=CR_COMMANDS_OUT_OF_SYNC));
- DBUG_RETURN(0);
- }
- if (!(result=(MYSQL_RES*) my_malloc(sizeof(*result)+
- sizeof(ulong)*mysql->field_count,
- MYF(MY_WME | MY_ZEROFILL))))
- DBUG_RETURN(0);
- result->lengths=(ulong*) (result+1);
- if (!(result->row=(MYSQL_ROW)
- my_malloc(sizeof(result->row[0])*(mysql->field_count+1), MYF(MY_WME))))
- { /* Ptrs: to one row */
- my_free((gptr) result,MYF(0));
- DBUG_RETURN(0);
- }
- result->fields= mysql->fields;
- result->field_alloc= mysql->field_alloc;
- result->field_count= mysql->field_count;
- result->current_field=0;
- result->handle= mysql;
- result->current_row= 0;
- mysql->fields=0; /* fields is now in result */
- mysql->status=MYSQL_STATUS_USE_RESULT;
- DBUG_RETURN(result); /* Data is read to be fetched */
-}
-
-
-
-/**************************************************************************
-** Return next field of the query results
-**************************************************************************/
-
-MYSQL_FIELD * STDCALL
-mysql_fetch_field(MYSQL_RES *result)
-{
- if (result->current_field >= result->field_count)
- return(NULL);
- return &result->fields[result->current_field++];
-}
-
-
-/**************************************************************************
-** Return next row of the query results
-**************************************************************************/
-
-MYSQL_ROW STDCALL
-mysql_fetch_row(MYSQL_RES *res)
-{
- DBUG_ENTER("mysql_fetch_row");
- if (!res->data)
- { /* Unbufferred fetch */
- if (!res->eof)
- {
- if (!(read_one_row(res->handle,res->field_count,res->row, res->lengths)))
- {
- res->row_count++;
- DBUG_RETURN(res->current_row=res->row);
- }
- else
- {
- DBUG_PRINT("info",("end of data"));
- res->eof=1;
- res->handle->status=MYSQL_STATUS_READY;
- /* Don't clear handle in mysql_free_results */
- res->handle=0;
- }
- }
- DBUG_RETURN((MYSQL_ROW) NULL);
- }
- {
- MYSQL_ROW tmp;
- if (!res->data_cursor)
- {
- DBUG_PRINT("info",("end of data"));
- DBUG_RETURN(res->current_row=(MYSQL_ROW) NULL);
- }
- tmp = res->data_cursor->data;
- res->data_cursor = res->data_cursor->next;
- DBUG_RETURN(res->current_row=tmp);
- }
-}
-
-/**************************************************************************
-** Get column lengths of the current row
-** If one uses mysql_use_result, res->lengths contains the length information,
-** else the lengths are calculated from the offset between pointers.
-**************************************************************************/
-
-ulong * STDCALL
-mysql_fetch_lengths(MYSQL_RES *res)
-{
- ulong *lengths,*prev_length;
- byte *start;
- MYSQL_ROW column,end;
-
- if (!(column=res->current_row))
- return 0; /* Something is wrong */
- if (res->data)
- {
- start=0;
- prev_length=0; /* Keep gcc happy */
- lengths=res->lengths;
- for (end=column+res->field_count+1 ; column != end ; column++,lengths++)
- {
- if (!*column)
- {
- *lengths=0; /* Null */
- continue;
- }
- if (start) /* Found end of prev string */
- *prev_length= (uint) (*column-start-1);
- start= *column;
- prev_length=lengths;
- }
- }
- return res->lengths;
-}
-
-/**************************************************************************
-** Move to a specific row and column
-**************************************************************************/
-
-void STDCALL
-mysql_data_seek(MYSQL_RES *result, my_ulonglong row)
-{
- MYSQL_ROWS *tmp=0;
- DBUG_PRINT("info",("mysql_data_seek(%ld)",(long) row));
- if (result->data)
- for (tmp=result->data->data; row-- && tmp ; tmp = tmp->next) ;
- result->current_row=0;
- result->data_cursor = tmp;
-}
-
-/*************************************************************************
-** put the row or field cursor one a position one got from mysql_row_tell()
-** This doesn't restore any data. The next mysql_fetch_row or
-** mysql_fetch_field will return the next row or field after the last used
-*************************************************************************/
-
-MYSQL_ROW_OFFSET STDCALL
-mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET row)
-{
- MYSQL_ROW_OFFSET return_value=result->data_cursor;
- result->current_row= 0;
- result->data_cursor= row;
- return return_value;
-}
-
-
-MYSQL_FIELD_OFFSET STDCALL
-mysql_field_seek(MYSQL_RES *result, MYSQL_FIELD_OFFSET field_offset)
-{
- MYSQL_FIELD_OFFSET return_value=result->current_field;
- result->current_field=field_offset;
- return return_value;
-}
-
-/*****************************************************************************
-** List all databases
-*****************************************************************************/
-
-MYSQL_RES * STDCALL
-mysql_list_dbs(MYSQL *mysql, const char *wild)
-{
- char buff[255];
- DBUG_ENTER("mysql_list_dbs");
-
- append_wild(strmov(buff,"show databases"),buff+sizeof(buff),wild);
- if (mysql_query(mysql,buff))
- DBUG_RETURN(0);
- DBUG_RETURN (mysql_store_result(mysql));
-}
-
-
-/*****************************************************************************
-** List all tables in a database
-** If wild is given then only the tables matching wild is returned
-*****************************************************************************/
-
-MYSQL_RES * STDCALL
-mysql_list_tables(MYSQL *mysql, const char *wild)
-{
- char buff[255];
- DBUG_ENTER("mysql_list_tables");
-
- append_wild(strmov(buff,"show tables"),buff+sizeof(buff),wild);
- if (mysql_query(mysql,buff))
- DBUG_RETURN(0);
- DBUG_RETURN (mysql_store_result(mysql));
-}
-
-
-/**************************************************************************
-** List all fields in a table
-** If wild is given then only the fields matching wild is returned
-** Instead of this use query:
-** show fields in 'table' like "wild"
-**************************************************************************/
-
-MYSQL_RES * STDCALL
-mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
-{
- MYSQL_RES *result;
- MYSQL_DATA *query;
- char buff[257],*end;
- DBUG_ENTER("mysql_list_fields");
- DBUG_PRINT("enter",("table: '%s' wild: '%s'",table,wild ? wild : ""));
-
- LINT_INIT(query);
-
- end=strmake(strmake(buff, table,128)+1,wild ? wild : "",128);
- if (simple_command(mysql,COM_FIELD_LIST,buff,(uint) (end-buff),1) ||
- !(query = read_rows(mysql,(MYSQL_FIELD*) 0,6)))
- DBUG_RETURN(NULL);
-
- free_old_query(mysql);
- if (!(result = (MYSQL_RES *) my_malloc(sizeof(MYSQL_RES),
- MYF(MY_WME | MY_ZEROFILL))))
- {
- free_rows(query);
- DBUG_RETURN(NULL);
- }
- result->field_alloc=mysql->field_alloc;
- mysql->fields=0;
- result->field_count = (uint) query->rows;
- result->fields= unpack_fields(query,&result->field_alloc,
- result->field_count,1,
- (my_bool) test(mysql->server_capabilities &
- CLIENT_LONG_FLAG));
- result->eof=1;
- DBUG_RETURN(result);
-}
-
-/* List all running processes (threads) in server */
-
-MYSQL_RES * STDCALL
-mysql_list_processes(MYSQL *mysql)
-{
- MYSQL_DATA *fields;
- uint field_count;
- uchar *pos;
- DBUG_ENTER("mysql_list_processes");
-
- LINT_INIT(fields);
- if (simple_command(mysql,COM_PROCESS_INFO,0,0,0))
- DBUG_RETURN(0);
- free_old_query(mysql);
- pos=(uchar*) mysql->net.read_pos;
- field_count=(uint) net_field_length(&pos);
- if (!(fields = read_rows(mysql,(MYSQL_FIELD*) 0,5)))
- DBUG_RETURN(NULL);
- if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,field_count,0,
- (my_bool) test(mysql->server_capabilities &
- CLIENT_LONG_FLAG))))
- DBUG_RETURN(0);
- mysql->status=MYSQL_STATUS_GET_RESULT;
- mysql->field_count=field_count;
- DBUG_RETURN(mysql_store_result(mysql));
-}
-
-
-int STDCALL
-mysql_create_db(MYSQL *mysql, const char *db)
-{
- DBUG_ENTER("mysql_createdb");
- DBUG_PRINT("enter",("db: %s",db));
- DBUG_RETURN(simple_command(mysql,COM_CREATE_DB,db, (uint) strlen(db),0));
-}
-
-
-int STDCALL
-mysql_drop_db(MYSQL *mysql, const char *db)
-{
- DBUG_ENTER("mysql_drop_db");
- DBUG_PRINT("enter",("db: %s",db));
- DBUG_RETURN(simple_command(mysql,COM_DROP_DB,db,(uint) strlen(db),0));
-}
-
-
-int STDCALL
-mysql_shutdown(MYSQL *mysql)
-{
- DBUG_ENTER("mysql_shutdown");
- DBUG_RETURN(simple_command(mysql,COM_SHUTDOWN,0,0,0));
-}
-
-
-int STDCALL
-mysql_refresh(MYSQL *mysql,uint options)
-{
- uchar bits[1];
- DBUG_ENTER("mysql_refresh");
- bits[0]= (uchar) options;
- DBUG_RETURN(simple_command(mysql,COM_REFRESH,(char*) bits,1,0));
-}
-
-int STDCALL
-mysql_kill(MYSQL *mysql,ulong pid)
-{
- char buff[12];
- DBUG_ENTER("mysql_kill");
- int4store(buff,pid);
- DBUG_RETURN(simple_command(mysql,COM_PROCESS_KILL,buff,4,0));
-}
-
-
-int STDCALL
-mysql_dump_debug_info(MYSQL *mysql)
-{
- DBUG_ENTER("mysql_dump_debug_info");
- DBUG_RETURN(simple_command(mysql,COM_DEBUG,0,0,0));
-}
-
-char * STDCALL
-mysql_stat(MYSQL *mysql)
-{
- DBUG_ENTER("mysql_stat");
- if (simple_command(mysql,COM_STATISTICS,0,0,0))
- return mysql->net.last_error;
- mysql->net.read_pos[mysql->packet_length]=0; /* End of stat string */
- if (!mysql->net.read_pos[0])
- {
- mysql->net.last_errno=CR_WRONG_HOST_INFO;
- strmov(mysql->net.last_error, ER(mysql->net.last_errno));
- return mysql->net.last_error;
- }
- DBUG_RETURN((char*) mysql->net.read_pos);
-}
-
-
-int STDCALL
-mysql_ping(MYSQL *mysql)
-{
- DBUG_ENTER("mysql_ping");
- DBUG_RETURN(simple_command(mysql,COM_PING,0,0,0));
-}
-
-
-char * STDCALL
-mysql_get_server_info(MYSQL *mysql)
-{
- return((char*) mysql->server_version);
-}
-
-
-char * STDCALL
-mysql_get_host_info(MYSQL *mysql)
-{
- return(mysql->host_info);
-}
-
-
-uint STDCALL
-mysql_get_proto_info(MYSQL *mysql)
-{
- return (mysql->protocol_version);
-}
-
-char * STDCALL
-mysql_get_client_info(void)
-{
- return (char*) MYSQL_SERVER_VERSION;
-}
-
-
-int STDCALL
-mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
-{
- DBUG_ENTER("mysql_option");
- DBUG_PRINT("enter",("option: %d",(int) option));
- switch (option) {
- case MYSQL_OPT_CONNECT_TIMEOUT:
- mysql->options.connect_timeout= *(uint*) arg;
- break;
- case MYSQL_OPT_COMPRESS:
- mysql->options.compress= 1; /* Remember for connect */
- break;
- case MYSQL_OPT_NAMED_PIPE:
- mysql->options.named_pipe=1; /* Force named pipe */
- break;
- case MYSQL_OPT_LOCAL_INFILE: /* Allow LOAD DATA LOCAL ?*/
- if (!arg || test(*(uint*) arg))
- mysql->options.client_flag|= CLIENT_LOCAL_FILES;
- else
- mysql->options.client_flag&= ~CLIENT_LOCAL_FILES;
- break;
- case MYSQL_INIT_COMMAND:
- my_free(mysql->options.init_command,MYF(MY_ALLOW_ZERO_PTR));
- mysql->options.init_command=my_strdup(arg,MYF(MY_WME));
- break;
- case MYSQL_READ_DEFAULT_FILE:
- my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR));
- mysql->options.my_cnf_file=my_strdup(arg,MYF(MY_WME));
- break;
- case MYSQL_READ_DEFAULT_GROUP:
- my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
- mysql->options.my_cnf_group=my_strdup(arg,MYF(MY_WME));
- break;
- case MYSQL_SET_CHARSET_DIR:
- my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR));
- mysql->options.charset_dir=my_strdup(arg,MYF(MY_WME));
- break;
- case MYSQL_SET_CHARSET_NAME:
- my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
- mysql->options.charset_name=my_strdup(arg,MYF(MY_WME));
- break;
- default:
- DBUG_RETURN(-1);
- }
- DBUG_RETURN(0);
-}
-
-/****************************************************************************
-** Functions to get information from the MySQL structure
-** These are functions to make shared libraries more usable.
-****************************************************************************/
-
-/* MYSQL_RES */
-my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res)
-{
- return res->row_count;
-}
-
-unsigned int STDCALL mysql_num_fields(MYSQL_RES *res)
-{
- return res->field_count;
-}
-
-my_bool STDCALL mysql_eof(MYSQL_RES *res)
-{
- return res->eof;
-}
-
-MYSQL_FIELD * STDCALL mysql_fetch_field_direct(MYSQL_RES *res,uint fieldnr)
-{
- return &(res)->fields[fieldnr];
-}
-
-MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res)
-{
- return (res)->fields;
-}
-
-MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res)
-{
- return res->data_cursor;
-}
-
-uint STDCALL mysql_field_tell(MYSQL_RES *res)
-{
- return (res)->current_field;
-}
-
-/* MYSQL */
-
-unsigned int STDCALL mysql_field_count(MYSQL *mysql)
-{
- return mysql->field_count;
-}
-
-my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql)
-{
- return (mysql)->affected_rows;
-}
-
-my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql)
-{
- return (mysql)->insert_id;
-}
-
-uint STDCALL mysql_errno(MYSQL *mysql)
-{
- return (mysql)->net.last_errno;
-}
-
-char * STDCALL mysql_error(MYSQL *mysql)
-{
- return (mysql)->net.last_error;
-}
-
-char *STDCALL mysql_info(MYSQL *mysql)
-{
- return (mysql)->info;
-}
-
-ulong STDCALL mysql_thread_id(MYSQL *mysql)
-{
- return (mysql)->thread_id;
-}
-
-const char * STDCALL mysql_character_set_name(MYSQL *mysql)
-{
- return mysql->charset->name;
-}
-
-
-uint STDCALL mysql_thread_safe(void)
-{
-#ifdef THREAD
- return 1;
-#else
- return 0;
-#endif
-}
-
-/****************************************************************************
-** Some support functions
-****************************************************************************/
-
-/*
-** Add escape characters to a string (blob?) to make it suitable for a insert
-** to should at least have place for length*2+1 chars
-** Returns the length of the to string
-*/
-
-ulong STDCALL
-mysql_escape_string(char *to,const char *from,ulong length)
-{
- return mysql_sub_escape_string(default_charset_info,to,from,length);
-}
-
-ulong STDCALL
-mysql_real_escape_string(MYSQL *mysql, char *to,const char *from,
- ulong length)
-{
- return mysql_sub_escape_string(mysql->charset,to,from,length);
-}
-
-
-static ulong
-mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
- const char *from, ulong length)
-{
- const char *to_start=to;
- const char *end;
-#ifdef USE_MB
- my_bool use_mb_flag=use_mb(charset_info);
-#endif
- for (end=from+length; from != end ; from++)
- {
-#ifdef USE_MB
- int l;
- if (use_mb_flag && (l = my_ismbchar(charset_info, from, end)))
- {
- while (l--)
- *to++ = *from++;
- from--;
- continue;
- }
-#endif
- switch (*from) {
- case 0: /* Must be escaped for 'mysql' */
- *to++= '\\';
- *to++= '0';
- break;
- case '\n': /* Must be escaped for logs */
- *to++= '\\';
- *to++= 'n';
- break;
- case '\r':
- *to++= '\\';
- *to++= 'r';
- break;
- case '\\':
- *to++= '\\';
- *to++= '\\';
- break;
- case '\'':
- *to++= '\\';
- *to++= '\'';
- break;
- case '"': /* Better safe than sorry */
- *to++= '\\';
- *to++= '"';
- break;
- case '\032': /* This gives problems on Win32 */
- *to++= '\\';
- *to++= 'Z';
- break;
- default:
- *to++= *from;
- }
- }
- *to=0;
- return (ulong) (to-to_start);
-}
-
-
-char * STDCALL
-mysql_odbc_escape_string(MYSQL *mysql,
- char *to, ulong to_length,
- const char *from, ulong from_length,
- void *param,
- char * (*extend_buffer)
- (void *, char *, ulong *))
-{
- char *to_end=to+to_length-5;
- const char *end;
-#ifdef USE_MB
- my_bool use_mb_flag=use_mb(mysql->charset);
-#endif
-
- for (end=from+from_length; from != end ; from++)
- {
- if (to >= to_end)
- {
- to_length = (ulong) (end-from)+512; /* We want this much more */
- if (!(to=(*extend_buffer)(param, to, &to_length)))
- return to;
- to_end=to+to_length-5;
- }
-#ifdef USE_MB
- {
- int l;
- if (use_mb_flag && (l = my_ismbchar(mysql->charset, from, end)))
- {
- while (l--)
- *to++ = *from++;
- from--;
- continue;
- }
- }
-#endif
- switch (*from) {
- case 0: /* Must be escaped for 'mysql' */
- *to++= '\\';
- *to++= '0';
- break;
- case '\n': /* Must be escaped for logs */
- *to++= '\\';
- *to++= 'n';
- break;
- case '\r':
- *to++= '\\';
- *to++= 'r';
- break;
- case '\\':
- *to++= '\\';
- *to++= '\\';
- break;
- case '\'':
- *to++= '\\';
- *to++= '\'';
- break;
- case '"': /* Better safe than sorry */
- *to++= '\\';
- *to++= '"';
- break;
- case '\032': /* This gives problems on Win32 */
- *to++= '\\';
- *to++= 'Z';
- break;
- default:
- *to++= *from;
- }
- }
- return to;
-}
-
-void STDCALL
-myodbc_remove_escape(MYSQL *mysql,char *name)
-{
- char *to;
-#ifdef USE_MB
- my_bool use_mb_flag=use_mb(mysql->charset);
- char *end;
- LINT_INIT(end);
- if (use_mb_flag)
- for (end=name; *end ; end++) ;
-#endif
-
- for (to=name ; *name ; name++)
- {
-#ifdef USE_MB
- int l;
- if (use_mb_flag && (l = my_ismbchar( mysql->charset, name , end ) ) )
- {
- while (l--)
- *to++ = *name++;
- name--;
- continue;
- }
-#endif
- if (*name == '\\' && name[1])
- name++;
- *to++= *name;
- }
- *to=0;
-}
diff --git a/ext/mysql/libmysql/libmysql.dsp b/ext/mysql/libmysql/libmysql.dsp
deleted file mode 100644
index 4525a51ab8..0000000000
--- a/ext/mysql/libmysql/libmysql.dsp
+++ /dev/null
@@ -1,585 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libmysql" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=libmysql - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libmysql.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libmysql.mak" CFG="libmysql - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libmysql - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "libmysql - Win32 Release_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "libmysql - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library")
-!MESSAGE "libmysql - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE "libmysql - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "libmysql - Win32 Release_inline" (based on "Win32 (x86) Static Library")
-!MESSAGE "libmysql - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libmysql - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "__WIN32__" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "libmysql - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "__WIN32__" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "libmysql - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS_inline"
-# PROP BASE Intermediate_Dir "Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "__WIN32__" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "libmysql - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "libmysql___Win32_Debug"
-# PROP BASE Intermediate_Dir "libmysql___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "libmysql - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "libmysql___Win32_Release"
-# PROP BASE Intermediate_Dir "libmysql___Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "libmysql - Win32 Release_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "libmysql___Win32_Release_inline"
-# PROP BASE Intermediate_Dir "libmysql___Win32_Release_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_inline"
-# PROP Intermediate_Dir "Release_inline"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "libmysql - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "libmysql___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "libmysql___Win32_Release_TSDbg"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "libmysql - Win32 Debug_TS"
-# Name "libmysql - Win32 Release_TS"
-# Name "libmysql - Win32 Release_TS_inline"
-# Name "libmysql - Win32 Debug"
-# Name "libmysql - Win32 Release"
-# Name "libmysql - Win32 Release_inline"
-# Name "libmysql - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\array.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\bchange.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\bmove.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\bmove_upp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\charset.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ctype.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbug.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\default.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dll.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\errmsg.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\errors.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\get_password.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\int2str.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\is_prefix.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmysql.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\list.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\longlong2str.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_casecnv.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_dirname.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_fn_ext.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_format.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_loadpath.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_pack.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_path.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_unixpath.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_wcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mulalloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_alloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_compress.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_create.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_delete.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_div.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_error.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_fopen.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_getwd.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_init.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_lib.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_malloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_messnc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_net.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_once.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_open.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_pthread.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_read.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_realloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_static.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_tempnam.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_thr_init.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_wincond.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_winthread.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_write.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\net.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\password.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\safemalloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\str2int.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strcend.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strcont.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strend.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strfill.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\string.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strinstr.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strmake.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strmov.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strnmov.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strtoll.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strtoull.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strxmov.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\thr_mutex.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\typelib.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\violite.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\acconfig.h
-# End Source File
-# Begin Source File
-
-SOURCE=".\config-win.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbug.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\errmsg.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\global.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\m_ctype.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\m_string.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_alarm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_dir.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_list.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_net.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_pthread.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_static.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_sys.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysql.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysql_com.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysql_version.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysqld_error.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysys_err.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysys_priv.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\thr_alarm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\violite.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/mysql/libmysql/list.c b/ext/mysql/libmysql/list.c
deleted file mode 100644
index fce5455ab8..0000000000
--- a/ext/mysql/libmysql/list.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Code for handling dubble-linked lists in C
-*/
-
-#include "mysys_priv.h"
-#include <my_list.h>
-
-
-
- /* Add a element to start of list */
-
-LIST *list_add(LIST *root, LIST *element)
-{
- DBUG_ENTER("list_add");
- DBUG_PRINT("enter",("root: %lx element: %lx", root, element));
- if (root)
- {
- if (root->prev) /* If add in mid of list */
- root->prev->next= element;
- element->prev=root->prev;
- root->prev=element;
- }
- else
- element->prev=0;
- element->next=root;
- DBUG_RETURN(element); /* New root */
-}
-
-
-LIST *list_delete(LIST *root, LIST *element)
-{
- if (element->prev)
- element->prev->next=element->next;
- else
- root=element->next;
- if (element->next)
- element->next->prev=element->prev;
- return root;
-}
-
-
-void list_free(LIST *root, pbool free_data)
-{
- LIST *next;
- while (root)
- {
- next=root->next;
- if (free_data)
- my_free((gptr) root->data,MYF(0));
- my_free((gptr) root,MYF(0));
- root=next;
- }
-}
-
-
-LIST *list_cons(void *data, LIST *list)
-{
- LIST *new_charset=(LIST*) my_malloc(sizeof(LIST),MYF(MY_FAE));
- if (!new_charset)
- return 0;
- new_charset->data=data;
- return list_add(list,new_charset);
-}
-
-
-LIST *list_reverse(LIST *root)
-{
- LIST *last;
-
- last=root;
- while (root)
- {
- last=root;
- root=root->next;
- last->next=last->prev;
- last->prev=root;
- }
- return last;
-}
-
-uint list_length(LIST *list)
-{
- uint count;
- for (count=0 ; list ; list=list->next, count++) ;
- return count;
-}
-
-
-int list_walk(LIST *list, list_walk_action action, gptr argument)
-{
- int error=0;
- while (list)
- {
- if ((error = (*action)(list->data,argument)))
- return error;
- list=rest(list);
- }
- return 0;
-}
diff --git a/ext/mysql/libmysql/longlong2str.c b/ext/mysql/libmysql/longlong2str.c
deleted file mode 100644
index 1899386862..0000000000
--- a/ext/mysql/libmysql/longlong2str.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Defines: longlong2str();
-
- longlong2str(dst, radix, val)
- converts the (longlong) integer "val" to character form and moves it to
- the destination string "dst" followed by a terminating NUL. The
- result is normally a pointer to this NUL character, but if the radix
- is dud the result will be NullS and nothing will be changed.
-
- If radix is -2..-36, val is taken to be SIGNED.
- If radix is 2.. 36, val is taken to be UNSIGNED.
- That is, val is signed if and only if radix is. You will normally
- use radix -10 only through itoa and ltoa, for radix 2, 8, or 16
- unsigned is what you generally want.
-
- _dig_vec is public just in case someone has a use for it.
- The definitions of itoa and ltoa are actually macros in m_string.h,
- but this is where the code is.
-
- Note: The standard itoa() returns a pointer to the argument, when int2str
- returns the pointer to the end-null.
- itoa assumes that 10 -base numbers are allways signed and other arn't.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-#if defined(HAVE_LONG_LONG) && !defined(longlong2str) && !defined(HAVE_LONGLONG2STR)
-
-extern char NEAR _dig_vec[];
-
-/*
- This assumes that longlong multiplication is faster than longlong division.
-*/
-
-char *longlong2str(longlong val,char *dst,int radix)
-{
- char buffer[65];
- register char *p;
- long long_val;
-
- if (radix < 0)
- {
- if (radix < -36 || radix > -2) return (char*) 0;
- if (val < 0) {
- *dst++ = '-';
- val = -val;
- }
- radix = -radix;
- }
- else
- {
- if (radix > 36 || radix < 2) return (char*) 0;
- }
- if (val == 0)
- {
- *dst++='0';
- *dst='\0';
- return dst;
- }
- p = &buffer[sizeof(buffer)-1];
- *p = '\0';
-
- while ((ulonglong) val > (ulonglong) LONG_MAX)
- {
- ulonglong quo=(ulonglong) val/(uint) radix;
- uint rem= (uint) (val- quo* (uint) radix);
- *--p = _dig_vec[rem];
- val= quo;
- }
- long_val= (long) val;
- while (long_val != 0)
- {
- long quo= long_val/radix;
- *--p = _dig_vec[(uchar) (long_val - quo*radix)];
- long_val= quo;
- }
- while ((*dst++ = *p++) != 0) ;
- return dst-1;
-}
-
-#endif
-
-#ifndef longlong10_to_str
-char *longlong10_to_str(longlong val,char *dst,int radix)
-{
- char buffer[65];
- register char *p;
- long long_val;
-
- if (radix < 0)
- {
- if (val < 0)
- {
- *dst++ = '-';
- val = -val;
- }
- }
-
- if (val == 0)
- {
- *dst++='0';
- *dst='\0';
- return dst;
- }
- p = &buffer[sizeof(buffer)-1];
- *p = '\0';
-
- while ((ulonglong) val > (ulonglong) LONG_MAX)
- {
- ulonglong quo=(ulonglong) val/(uint) 10;
- uint rem= (uint) (val- quo* (uint) 10);
- *--p = _dig_vec[rem];
- val= quo;
- }
- long_val= (long) val;
- while (long_val != 0)
- {
- long quo= long_val/10;
- *--p = _dig_vec[(uchar) (long_val - quo*10)];
- long_val= quo;
- }
- while ((*dst++ = *p++) != 0) ;
- return dst-1;
-}
-#endif
diff --git a/ext/mysql/libmysql/m_ctype.h b/ext/mysql/libmysql/m_ctype.h
deleted file mode 100644
index e322ac8f1a..0000000000
--- a/ext/mysql/libmysql/m_ctype.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- A better inplementation of the UNIX ctype(3) library.
- Notes: global.h should be included before ctype.h
-*/
-
-#ifndef _m_ctype_h
-#define _m_ctype_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define CHARSET_DIR "charsets/"
-
-typedef struct charset_info_st
-{
- uint number;
- const char *name;
- uchar *ctype;
- uchar *to_lower;
- uchar *to_upper;
- uchar *sort_order;
-
- uint strxfrm_multiply;
- int (*strcoll)(const uchar *, const uchar *);
- int (*strxfrm)(uchar *, const uchar *, int);
- int (*strnncoll)(const uchar *, int, const uchar *, int);
- int (*strnxfrm)(uchar *, const uchar *, int, int);
- my_bool (*like_range)(const char *, uint, pchar, uint,
- char *, char *, uint *, uint *);
-
- uint mbmaxlen;
- int (*ismbchar)(const char *, const char *);
- my_bool (*ismbhead)(uint);
- int (*mbcharlen)(uint);
-} CHARSET_INFO;
-
-/* strings/ctype.c */
-extern CHARSET_INFO *default_charset_info;
-extern CHARSET_INFO *find_compiled_charset(uint cs_number);
-extern CHARSET_INFO *find_compiled_charset_by_name(const char *name);
-extern CHARSET_INFO compiled_charsets[];
-
-#define MY_CHARSET_UNDEFINED 0
-#define MY_CHARSET_CURRENT (default_charset_info->number)
-
-#ifdef __WIN__
-#include <ctype.h>
-#endif
-/* Don't include std ctype.h when this is included */
-#define _CTYPE_H
-#define _CTYPE_H_
-#define _CTYPE_INCLUDED
-#define __CTYPE_INCLUDED
-#define _CTYPE_USING /* Don't put names in global namespace. */
-
-#define _U 01 /* Upper case */
-#define _L 02 /* Lower case */
-#define _N 04 /* Numeral (digit) */
-#define _S 010 /* Spacing character */
-#define _P 020 /* Punctuation */
-#define _C 040 /* Control character */
-#define _B 0100 /* Blank */
-#define _X 0200 /* heXadecimal digit */
-
-#define my_ctype (default_charset_info->ctype)
-#define my_to_upper (default_charset_info->to_upper)
-#define my_to_lower (default_charset_info->to_lower)
-#define my_sort_order (default_charset_info->sort_order)
-
-#ifndef __WIN__
-#define _toupper(c) (char) my_to_upper[(uchar) (c)]
-#define _tolower(c) (char) my_to_lower[(uchar) (c)]
-#define toupper(c) (char) my_to_upper[(uchar) (c)]
-#define tolower(c) (char) my_to_lower[(uchar) (c)]
-
-#define isalpha(c) ((my_ctype+1)[(uchar) (c)] & (_U | _L))
-#define isupper(c) ((my_ctype+1)[(uchar) (c)] & _U)
-#define islower(c) ((my_ctype+1)[(uchar) (c)] & _L)
-#define isdigit(c) ((my_ctype+1)[(uchar) (c)] & _N)
-#define isxdigit(c) ((my_ctype+1)[(uchar) (c)] & _X)
-#define isalnum(c) ((my_ctype+1)[(uchar) (c)] & (_U | _L | _N))
-#define isspace(c) ((my_ctype+1)[(uchar) (c)] & _S)
-#define ispunct(c) ((my_ctype+1)[(uchar) (c)] & _P)
-#define isprint(c) ((my_ctype+1)[(uchar) (c)] & (_P | _U | _L | _N | _B))
-#define isgraph(c) ((my_ctype+1)[(uchar) (c)] & (_P | _U | _L | _N))
-#define iscntrl(c) ((my_ctype+1)[(uchar) (c)] & _C)
-#define isascii(c) (!((c) & ~0177))
-#define toascii(c) ((c) & 0177)
-
-#ifdef ctype
-#undef ctype
-#endif /* ctype */
-
-#endif /* __WIN__ */
-
-#define my_isalpha(s, c) (((s)->ctype+1)[(uchar) (c)] & (_U | _L))
-#define my_isupper(s, c) (((s)->ctype+1)[(uchar) (c)] & _U)
-#define my_islower(s, c) (((s)->ctype+1)[(uchar) (c)] & _L)
-#define my_isdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _N)
-#define my_isxdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _X)
-#define my_isalnum(s, c) (((s)->ctype+1)[(uchar) (c)] & (_U | _L | _N))
-#define my_isspace(s, c) (((s)->ctype+1)[(uchar) (c)] & _S)
-#define my_ispunct(s, c) (((s)->ctype+1)[(uchar) (c)] & _P)
-#define my_isprint(s, c) (((s)->ctype+1)[(uchar) (c)] & (_P | _U | _L | _N | _B))
-#define my_isgraph(s, c) (((s)->ctype+1)[(uchar) (c)] & (_P | _U | _L | _N))
-#define my_iscntrl(s, c) (((s)->ctype+1)[(uchar) (c)] & _C)
-
-#define use_strcoll(s) ((s)->strcoll != NULL)
-#define MY_STRXFRM_MULTIPLY (default_charset_info->strxfrm_multiply)
-#define my_strnxfrm(s, a, b, c, d) ((s)->strnxfrm((a), (b), (c), (d)))
-#define my_strnncoll(s, a, b, c, d) ((s)->strnncoll((a), (b), (c), (d)))
-#define my_strxfrm(s, a, b, c, d) ((s)->strnxfrm((a), (b), (c)))
-#define my_strcoll(s, a, b) ((s)->strcoll((a), (b)))
-#define my_like_range(s, a, b, c, d, e, f, g, h) \
- ((s)->like_range((a), (b), (c), (d), (e), (f), (g), (h)))
-
-#define use_mb(s) ((s)->ismbchar != NULL)
-#define MBMAXLEN (default_charset_info->mbmaxlen)
-#define my_ismbchar(s, a, b) ((s)->ismbchar((a), (b)))
-#define my_ismbhead(s, a) ((s)->ismbhead((a)))
-#define my_mbcharlen(s, a) ((s)->mbcharlen((a)))
-
-/* Some macros that should be cleaned up a little */
-#define isvar(c) (isalnum(c) || (c) == '_')
-#define isvar_start(c) (isalpha(c) || (c) == '_')
-#define tocntrl(c) ((c) & 31)
-#define toprint(c) ((c) | 64)
-
-/* XXX: still need to take care of this one */
-#ifdef MY_CHARSET_TIS620
-#error The TIS620 charset is broken at the moment. Tell tim to fix it.
-#define USE_TIS620
-#include "t_ctype.h"
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _m_ctype_h */
diff --git a/ext/mysql/libmysql/m_string.h b/ext/mysql/libmysql/m_string.h
deleted file mode 100644
index 64aa183a7d..0000000000
--- a/ext/mysql/libmysql/m_string.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* There may be prolems include all of theese. Try to test in
- configure with ones are needed? */
-
-/* This is needed for the definitions of strchr... on solaris */
-
-#ifndef _m_string_h
-#define _m_string_h
-#ifndef __USE_GNU
-#define __USE_GNU /* We want to use stpcpy */
-#endif
-#if defined(HAVE_STRINGS_H)
-#include <strings.h>
-#endif
-#if defined(HAVE_STRING_H)
-#include <string.h>
-#endif
-
-/* Correct some things for UNIXWARE7 */
-#ifdef HAVE_UNIXWARE7_THREADS
-#undef HAVE_STRINGS_H
-#undef HAVE_MEMORY_H
-#define HAVE_MEMCPY
-#ifndef HAVE_MEMMOVE
-#define HAVE_MEMMOVE
-#endif
-#undef HAVE_BCMP
-#undef bcopy
-#undef bcmp
-#undef bzero
-#endif /* HAVE_UNIXWARE7_THREADS */
-#ifdef _AIX
-#undef HAVE_BCMP
-#endif
-
-/* This is needed for the definitions of bzero... on solaris */
-#if defined(HAVE_STRINGS_H) && !defined(HAVE_mit_thread)
-#include <strings.h>
-#endif
-
-/* This is needed for the definitions of memcpy... on solaris */
-#if defined(HAVE_MEMORY_H) && !defined(__cplusplus)
-#include <memory.h>
-#endif
-
-#if !defined(HAVE_MEMCPY) && !defined(HAVE_MEMMOVE)
-# define memcpy(d, s, n) bcopy ((s), (d), (n))
-# define memset(A,C,B) bfill((A),(B),(C))
-# define memmove(d, s, n) bmove ((d), (s), (n))
-#elif defined(HAVE_MEMMOVE)
-# define bmove(d, s, n) memmove((d), (s), (n))
-#else
-# define memmove(d, s, n) bmove((d), (s), (n)) /* our bmove */
-#endif
-
-/* Unixware 7 */
-#if !defined(HAVE_BFILL)
-# define bfill(A,B,C) memset((A),(C),(B))
-# define bmove_allign(A,B,C) memcpy((A),(B),(C))
-#endif
-
-#if !defined(HAVE_BCMP)
-# define bcopy(s, d, n) memcpy((d), (s), (n))
-# define bcmp(A,B,C) memcmp((A),(B),(C))
-# define bzero(A,B) memset((A),0,(B))
-# define bmove_allign(A,B,C) memcpy((A),(B),(C))
-#endif
-
-#if defined(__cplusplus) && !defined(OS2)
-extern "C" {
-#endif
-
-#if defined(HAVE_STPCPY) && !defined(HAVE_mit_thread)
-#define strmov(A,B) stpcpy((A),(B))
-#ifndef stpcpy
-extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
-#endif
-#endif
-
-extern char NEAR _dig_vec[]; /* Declared in int2str() */
-
-#ifdef BAD_STRING_COMPILER
-#define strmov(A,B) (memccpy(A,B,0,INT_MAX)-1)
-#else
-#define strmov_overlapp(A,B) strmov(A,B)
-#define strmake_overlapp(A,B,C) strmake(A,B,C)
-#endif
-
-#ifdef BAD_MEMCPY /* Problem with gcc on Alpha */
-#define memcpy_fixed(A,B,C) bmove((A),(B),(C))
-#else
-#define memcpy_fixed(A,B,C) memcpy((A),(B),(C))
-#endif
-
-#ifdef MSDOS
-#undef bmove_allign
-#define bmove512(A,B,C) bmove_allign(A,B,C)
-#define my_itoa(A,B,C) itoa(A,B,C)
-#define my_ltoa(A,B,C) ltoa(A,B,C)
-extern void bmove_allign(gptr dst,const gptr src,uint len);
-#endif
-
-#if (!defined(USE_BMOVE512) || defined(HAVE_purify)) && !defined(bmove512)
-#define bmove512(A,B,C) memcpy(A,B,C)
-#endif
-
- /* Prototypes for string functions */
-
-#if !defined(bfill) && !defined(HAVE_BFILL)
-extern void bfill(gptr dst,uint len,pchar fill);
-#endif
-
-#if !defined(bzero) && !defined(HAVE_BZERO)
-extern void bzero(gptr dst,uint len);
-#endif
-
-#if !defined(bcmp) && !defined(HAVE_BCMP)
-extern int bcmp(const char *s1,const char *s2,uint len);
-#ifdef HAVE_purify
-extern int my_bcmp(const char *s1,const char *s2,uint len);
-#define bcmp(A,B,C) my_bcmp((A),(B),(C))
-#endif
-#endif
-
-#ifndef bmove512
-extern void bmove512(gptr dst,const gptr src,uint len);
-#endif
-
-#if !defined(HAVE_BMOVE) && !defined(bmove)
-extern void bmove(char *dst, const char *src,uint len);
-#endif
-
-extern void bmove_upp(char *dst,const char *src,uint len);
-extern void bchange(char *dst,uint old_len,const char *src,
- uint new_len,uint tot_len);
-extern void strappend(char *s,uint len,pchar fill);
-extern char *strend(const char *s);
-extern char *strcend(const char *, pchar);
-extern char *strfield(char *src,int fields,int chars,int blanks,
- int tabch);
-extern char *strfill(my_string s,uint len,pchar fill);
-extern uint strinstr(const char *str,const char *search);
-extern uint r_strinstr(reg1 my_string str,int from, reg4 my_string search);
-extern char *strkey(char *dst,char *head,char *tail,char *flags);
-extern char *strmake(char *dst,const char *src,uint length);
-#ifndef strmake_overlapp
-extern char *strmake_overlapp(char *dst,const char *src, uint length);
-#endif
-
-#ifndef strmov
-extern char *strmov(char *dst,const char *src);
-#endif
-extern char *strnmov(char *dst,const char *src,uint n);
-extern char *strsuff(const char *src,const char *suffix);
-extern char *strcont(const char *src,const char *set);
-extern char *strxcat _VARARGS((char *dst,const char *src, ...));
-extern char *strxmov _VARARGS((char *dst,const char *src, ...));
-extern char *strxcpy _VARARGS((char *dst,const char *src, ...));
-extern char *strxncat _VARARGS((char *dst,uint len, const char *src, ...));
-extern char *strxnmov _VARARGS((char *dst,uint len, const char *src, ...));
-extern char *strxncpy _VARARGS((char *dst,uint len, const char *src, ...));
-
-/* Prototypes of normal stringfunctions (with may ours) */
-
-#ifdef WANT_STRING_PROTOTYPES
-extern char *strcat(char *, const char *);
-extern char *strchr(const char *, pchar);
-extern char *strrchr(const char *, pchar);
-extern char *strcpy(char *, const char *);
-extern int strcmp(const char *, const char *);
-#ifndef __GNUC__
-extern size_t strlen(const char *);
-#endif
-#endif
-#ifndef HAVE_STRNLEN
-extern uint strnlen(const char *s, uint n);
-#endif
-
-#if !defined(__cplusplus)
-#ifndef HAVE_STRPBRK
-extern char *strpbrk(const char *, const char *);
-#endif
-#ifndef HAVE_STRSTR
-extern char *strstr(const char *, const char *);
-#endif
-#endif
-extern int is_prefix(const char *, const char *);
-
-/* Conversion rutins */
-
-#ifdef USE_MY_ITOA
-extern char *my_itoa(int val,char *dst,int radix);
-extern char *my_ltoa(long val,char *dst,int radix);
-#endif
-
-extern char *llstr(longlong value,char *buff);
-#ifndef HAVE_STRTOUL
-extern long strtol(const char *str, char **ptr, int base);
-extern ulong strtoul(const char *str, char **ptr, int base);
-#endif
-
-extern char *int2str(long val,char *dst,int radix);
-extern char *int10_to_str(long val,char *dst,int radix);
-extern char *str2int(const char *src,int radix,long lower,long upper,
- long *val);
-#if SIZEOF_LONG == SIZEOF_LONG_LONG
-#define longlong2str(A,B,C) int2str((A),(B),(C))
-#define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C))
-#define strtoll(A,B,C) strtol((A),(B),(C))
-#define strtoull(A,B,C) strtoul((A),(B),(C))
-#ifndef HAVE_STRTOULL
-#define HAVE_STRTOULL
-#endif
-#else
-#ifdef HAVE_LONG_LONG
-extern char *longlong2str(longlong val,char *dst,int radix);
-extern char *longlong10_to_str(longlong val,char *dst,int radix);
-#if (!defined(HAVE_STRTOULL) || defined(HAVE_mit_thread)) || defined(NO_STRTOLL_PROTO)
-extern longlong strtoll(const char *str, char **ptr, int base);
-extern ulonglong strtoull(const char *str, char **ptr, int base);
-#endif
-#endif
-#endif
-
-#if defined(__cplusplus) && !defined(OS2)
-}
-#endif
-#endif
diff --git a/ext/mysql/libmysql/mf_casecnv.c b/ext/mysql/libmysql/mf_casecnv.c
deleted file mode 100644
index 3abc6ae0f0..0000000000
--- a/ext/mysql/libmysql/mf_casecnv.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Functions to convert to lover_case and to upper_case in scandinavia.
-
- case_sort converts a character string to a representaion that can
- be compared by strcmp to find with is alfabetical bigger.
- (lower- and uppercase letters is compared as the same)
-*/
-
-#include "mysys_priv.h"
-#include <m_ctype.h>
-#include <m_string.h>
-
- /* string to uppercase */
-
-void caseup_str(my_string str)
-{
-#ifdef USE_MB
- if (use_mb(default_charset_info))
- {
- register uint32 l;
- register char *end=str+(uint) strlen(str);
- while (*str)
- {
- if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
- else *str=toupper(*str),++str;
- }
- }
- else
-#endif
- while ((*str = toupper(*str)) != 0)
- str++;
-} /* caseup_str */
-
- /* string to lowercase */
-
-void casedn_str(my_string str)
-{
-#ifdef USE_MB
- if (use_mb(default_charset_info))
- {
- register uint32 l;
- register char *end=str+(uint) strlen(str);
- while (*str)
- {
- if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
- else *str=tolower(*str),++str;
- }
- }
- else
-#endif
- while ((*str= tolower(*str)) != 0)
- str++;
-} /* casedn_str */
-
-
- /* to uppercase */
-
-void caseup(my_string str, uint length)
-{
-#ifdef USE_MB
- if (use_mb(default_charset_info))
- {
- register uint32 l;
- register char *end=str+length;
- while (str<end)
- {
- if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
- else *str=toupper(*str),++str;
- }
- }
- else
-#endif
- for ( ; length>0 ; length--, str++)
- *str= toupper(*str);
-} /* caseup */
-
- /* to lowercase */
-
-void casedn(my_string str, uint length)
-{
-#ifdef USE_MB
- if (use_mb(default_charset_info))
- {
- register uint32 l;
- register char *end=str+length;
- while (str<end)
- {
- if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
- else *str=tolower(*str),++str;
- }
- }
- else
-#endif
- for ( ; length>0 ; length--, str++)
- *str= tolower(*str);
-} /* casedn */
-
- /* to sort-string that can be compared to get text in order */
-
-void case_sort(my_string str, uint length)
-{
- for ( ; length>0 ; length--, str++)
- *str= (char) my_sort_order[(uchar) *str];
-} /* case_sort */
-
- /* find string in another with no case_sensivity */
-
-/* ToDo: This function should be modified to support multibyte charset.
- However it is not used untill 3.23.5.
- Wei He (hewei@mail.ied.ac.cn)
-*/
-
-my_string my_strcasestr(const char *str, const char *search)
-{
- uchar *i,*j,*pos;
-
- pos=(uchar*) str;
-skipp:
- while (*pos != '\0')
- {
- if (toupper((uchar) *pos++) == toupper((uchar) *search))
- {
- i=(uchar*) pos; j=(uchar*) search+1;
- while (*j)
- if (toupper(*i++) != toupper(*j++)) goto skipp;
- return ((char*) pos-1);
- }
- }
- return ((my_string) 0);
-} /* strcstr */
-
-
- /* compare strings without regarding to case */
-
-int my_strcasecmp(const char *s, const char *t)
-{
-#ifdef USE_MB
- if (use_mb(default_charset_info))
- {
- register uint32 l;
- register const char *end=s+(uint) strlen(s);
- while (s<end)
- {
- if ((l=my_ismbchar(default_charset_info, s,end)))
- {
- while (l--)
- if (*s++ != *t++) return 1;
- }
- else if (my_ismbhead(default_charset_info, *t)) return 1;
- else if (toupper((uchar) *s++) != toupper((uchar) *t++)) return 1;
- }
- return *t;
- }
- else
-#endif
- {
- while (toupper((uchar) *s) == toupper((uchar) *t++))
- if (!*s++) return 0;
- return ((int) toupper((uchar) s[0]) - (int) toupper((uchar) t[-1]));
- }
-}
-
-
-int my_casecmp(const char *s, const char *t, uint len)
-{
-#ifdef USE_MB
- if (use_mb(default_charset_info))
- {
- register uint32 l;
- register const char *end=s+len;
- while (s<end)
- {
- if ((l=my_ismbchar(default_charset_info, s,end)))
- {
- while (l--)
- if (*s++ != *t++) return 1;
- }
- else if (my_ismbhead(default_charset_info, *t)) return 1;
- else if (toupper((uchar) *s++) != toupper((uchar) *t++)) return 1;
- }
- return 0;
- }
- else
-#endif
- {
- while (len-- != 0 && toupper(*s++) == toupper(*t++)) ;
- return (int) len+1;
- }
-}
-
-
-int my_strsortcmp(const char *s, const char *t)
-{
-#ifdef USE_STRCOLL
- if (use_strcoll(default_charset_info))
- return my_strcoll(default_charset_info, (uchar *)s, (uchar *)t);
- else
-#endif
- {
- while (my_sort_order[(uchar) *s] == my_sort_order[(uchar) *t++])
- if (!*s++) return 0;
- return ((int) my_sort_order[(uchar) s[0]] -
- (int) my_sort_order[(uchar) t[-1]]);
- }
-}
-
-int my_sortcmp(const char *s, const char *t, uint len)
-{
-#ifdef USE_STRCOLL
- if (use_strcoll(default_charset_info))
- return my_strnncoll(default_charset_info,
- (uchar *)s, len, (uchar *)t, len);
- else
-#endif
- {
- while (len--)
- {
- if (my_sort_order[(uchar) *s++] != my_sort_order[(uchar) *t++])
- return ((int) my_sort_order[(uchar) s[-1]] -
- (int) my_sort_order[(uchar) t[-1]]);
- }
- return 0;
- }
-}
-
-int my_sortncmp(const char *s, uint s_len, const char *t, uint t_len)
-{
-#ifdef USE_STRCOLL
- if (use_strcoll(default_charset_info))
- return my_strnncoll(default_charset_info,
- (uchar *)s, s_len, (uchar *)t, t_len);
- else
-#endif
- {
- uint len= min(s_len,t_len);
- while (len--)
- {
- if (my_sort_order[(uchar) *s++] != my_sort_order[(uchar) *t++])
- return ((int) my_sort_order[(uchar) s[-1]] -
- (int) my_sort_order[(uchar) t[-1]]);
- }
- return (int) (s_len - t_len);
- }
-}
diff --git a/ext/mysql/libmysql/mf_dirname.c b/ext/mysql/libmysql/mf_dirname.c
deleted file mode 100644
index 88f6101cbe..0000000000
--- a/ext/mysql/libmysql/mf_dirname.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
- /* Functions definied in this file */
-
-uint dirname_length(const char *name)
-{
- register my_string pos,gpos;
-#ifdef FN_DEVCHAR
- if ((pos=(char*)strrchr(name,FN_DEVCHAR)) == 0)
-#endif
- pos=(char*) name-1;
-
- gpos= pos++;
- for ( ; *pos ; pos++) /* Find last FN_LIBCHAR */
- if (*pos == FN_LIBCHAR || *pos == '/'
-#ifdef FN_C_AFTER_DIR
- || *pos == FN_C_AFTER_DIR || *pos == FN_C_AFTER_DIR_2
-#endif
- )
- gpos=pos;
- return ((uint) (uint) (gpos+1-(char*) name));
-}
-
-
- /* Gives directory part of filename. Directory ends with '/' */
- /* Returns length of directory part */
-
-uint dirname_part(my_string to, const char *name)
-{
- uint length;
- DBUG_ENTER("dirname_part");
- DBUG_PRINT("enter",("'%s'",name));
-
- length=dirname_length(name);
- (void) strmake(to,(char*) name,min(length,FN_REFLEN-2));
- convert_dirname(to); /* Convert chars */
- DBUG_RETURN(length);
-} /* dirname */
-
-
- /* convert dirname to use under this system */
- /* If MSDOS converts '/' to '\' */
- /* If VMS converts '<' to '[' and '>' to ']' */
- /* Adds a '/' to end if there isn't one and the last isn't a dev_char */
- /* ARGSUSED */
-
-#ifndef FN_DEVCHAR
-#define FN_DEVCHAR '\0' /* For easier code */
-#endif
-
-char *convert_dirname(my_string to)
-{
- reg1 char *pos;
-#ifdef FN_UPPER_CASE
- caseup_str(to);
-#endif
-#ifdef FN_LOWER_CASE
- casedn_str(to);
-#endif
-#if FN_LIBCHAR != '/'
- {
- pos=to-1; /* Change from '/' */
- while ((pos=strchr(pos+1,'/')) != 0)
- *pos=FN_LIBCHAR;
- }
-#endif
-#ifdef FN_C_BEFORE_DIR_2
- {
- for (pos=to ; *pos ; pos++)
- {
- if (*pos == FN_C_BEFORE_DIR_2)
- *pos=FN_C_BEFORE_DIR;
- if (*pos == FN_C_AFTER_DIR_2)
- *pos=FN_C_AFTER_DIR;
- }
- }
-#else
- { /* Append FN_LIBCHAR if not there */
- pos=strend(to);
- if (pos != to && (pos[-1] != FN_LIBCHAR && pos[-1] != FN_DEVCHAR))
- {
- *pos++=FN_LIBCHAR;
- *pos=0;
- }
- }
-#endif
- return pos; /* Pointer to end of dir */
-} /* convert_dirname */
diff --git a/ext/mysql/libmysql/mf_fn_ext.c b/ext/mysql/libmysql/mf_fn_ext.c
deleted file mode 100644
index 71a10108b7..0000000000
--- a/ext/mysql/libmysql/mf_fn_ext.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Returnerar en pekare till filnamnets extension. */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
- /* Return a pointerto the extension of the filename
- The pointer points at the extension character (normally '.'))
- If there isn't any extension, the pointer points at the end
- NULL of the filename
- */
-
-my_string fn_ext(const char *name)
-{
- register my_string pos,gpos;
- DBUG_ENTER("fn_ext");
- DBUG_PRINT("mfunkt",("name: '%s'",name));
-
-#if defined(FN_DEVCHAR) || defined(FN_C_AFTER_DIR)
- {
- char buff[FN_REFLEN];
- gpos=(my_string) name+dirname_part(buff,(char*) name);
- }
-#else
- if (!(gpos=strrchr(name,FNLIBCHAR)))
- gpos=name;
-#endif
- pos=strrchr(gpos,FN_EXTCHAR);
- DBUG_RETURN (pos ? pos : strend(gpos));
-} /* fn_ext */
diff --git a/ext/mysql/libmysql/mf_format.c b/ext/mysql/libmysql/mf_format.c
deleted file mode 100644
index 7b2336e36e..0000000000
--- a/ext/mysql/libmysql/mf_format.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-#ifdef HAVE_REALPATH
-#include <sys/param.h>
-#include <sys/stat.h>
-#endif
-
- /* format a filename with replace of library and extension */
- /* params to and name may be identicall */
- /* function doesn't change name if name != to */
- /* Flag may be: 1 replace filenames library with 'dsk' */
- /* 2 replace extension with 'form' */
- /* 4 Unpack filename (replace ~ with home) */
- /* 8 Pack filename as short as possibly */
- /* 16 Resolve symbolic links for filename */
- /* 32 Resolve filename to full path */
- /* 64 Return NULL if too long path */
-
-#ifdef SCO
-#define BUFF_LEN 4097
-#else
-#ifdef MAXPATHLEN
-#define BUFF_LEN MAXPATHLEN
-#else
-#define BUFF_LEN FN_LEN
-#endif
-#endif
-
-my_string fn_format(my_string to, const char *name, const char *dsk,
- const char *form, int flag)
-{
- reg1 uint length;
- char dev[FN_REFLEN], buff[BUFF_LEN], *pos, *startpos;
- const char *ext;
- DBUG_ENTER("fn_format");
- DBUG_PRINT("enter",("name: %s dsk: %s form: %s flag: %d",
- name,dsk,form,flag));
-
- /* Kopiera & skippa enheten */
- name+=(length=dirname_part(dev,(startpos=(my_string) name)));
- if (length == 0 || flag & 1)
- {
- (void) strmake(dev,dsk, sizeof(dev) - 2);
- /* Use given directory */
- convert_dirname(dev); /* Fix to this OS */
- }
- if (flag & 8)
- pack_dirname(dev,dev); /* Put in ./.. and ~/.. */
- if (flag & 4)
- (void) unpack_dirname(dev,dev); /* Replace ~/.. with dir */
- if ((pos=(char*)strchr(name,FN_EXTCHAR)) != NullS)
- {
- if ((flag & 2) == 0) /* Skall vi byta extension ? */
- {
- length=strlength(name); /* Old extension */
- ext = "";
- }
- else
- {
- length=(uint) (pos-(char*) name); /* Change extension */
- ext= form;
- }
- }
- else
- {
- length=strlength(name); /* Har ingen ext- tag nya */
- ext=form;
- }
-
- if (strlen(dev)+length+strlen(ext) >= FN_REFLEN || length >= FN_LEN )
- { /* To long path, return original */
- uint tmp_length;
- if (flag & 64)
- return 0;
- tmp_length=strlength(startpos);
- DBUG_PRINT("error",("dev: '%s' ext: '%s' length: %d",dev,ext,length));
- (void) strmake(to,startpos,min(tmp_length,FN_REFLEN-1));
- }
- else
- {
- if (to == startpos)
- {
- bmove(buff,(char*) name,length); /* Save name for last copy */
- name=buff;
- }
- pos=strmake(strmov(to,dev),name,length);
-#ifdef FN_UPPER_CASE
- caseup_str(to);
-#endif
-#ifdef FN_LOWER_CASE
- casedn_str(to);
-#endif
- (void) strmov(pos,ext); /* Don't convert extension */
- }
- /* Purify gives a lot of UMR errors when using realpath */
-#if defined(HAVE_REALPATH) && !defined(HAVE_purify) && !defined(HAVE_BROKEN_REALPATH)
- if (flag & 16)
- {
- struct stat stat_buff;
- if (flag & 32 || (!lstat(to,&stat_buff) && S_ISLNK(stat_buff.st_mode)))
- {
- if (realpath(to,buff))
- strmake(to,buff,FN_REFLEN-1);
- }
- }
-#endif
- DBUG_RETURN (to);
-} /* fn_format */
-
-
- /*
- strlength(const string str)
- Return length of string with end-space:s not counted.
- */
-
-size_s strlength(const char *str)
-{
- reg1 my_string pos;
- reg2 my_string found;
- DBUG_ENTER("strlength");
-
- pos=found=(char*) str;
-
- while (*pos)
- {
- if (*pos != ' ')
- {
- while (*++pos && *pos != ' ') {};
- if (!*pos)
- {
- found=pos; /* String ends here */
- break;
- }
- }
- found=pos;
- while (*++pos == ' ') {};
- }
- DBUG_RETURN((size_s) (found-(char*) str));
-} /* strlength */
diff --git a/ext/mysql/libmysql/mf_loadpath.c b/ext/mysql/libmysql/mf_loadpath.c
deleted file mode 100644
index 4a1c250b3d..0000000000
--- a/ext/mysql/libmysql/mf_loadpath.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
- /* Returns full load-path for a file. to may be = path */
- /* if path is a hard-path return path */
- /* if path starts with home-dir return path */
- /* if path starts with current dir or parent-dir unpack path */
- /* if there is no path, prepend with own_path_prefix if given */
- /* else unpack path according to current dir */
-
-my_string my_load_path(my_string to, const char *path,
- const char *own_path_prefix)
-{
- char buff[FN_REFLEN];
- DBUG_ENTER("my_load_path");
- DBUG_PRINT("enter",("path: %s prefix: %s",path,
- own_path_prefix ? own_path_prefix : ""));
-
- if ((path[0] == FN_HOMELIB && path[1] == FN_LIBCHAR) ||
- test_if_hard_path(path))
- VOID(strmov(buff,path));
- else if ((path[0] == FN_CURLIB && path[1] == FN_LIBCHAR) ||
- (is_prefix((gptr) path,FN_PARENTDIR) &&
- path[strlen(FN_PARENTDIR)] == FN_LIBCHAR) ||
- ! own_path_prefix)
- {
- if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)),MYF(0)))
- VOID(strcat(buff,path));
- else
- VOID(strmov(buff,path));
- }
- else
- VOID(strxmov(buff,own_path_prefix,path,NullS));
- strmov(to,buff);
- DBUG_PRINT("exit",("to: %s",to));
- DBUG_RETURN(to);
-} /* my_load_path */
diff --git a/ext/mysql/libmysql/mf_pack.c b/ext/mysql/libmysql/mf_pack.c
deleted file mode 100644
index b6b079bdac..0000000000
--- a/ext/mysql/libmysql/mf_pack.c
+++ /dev/null
@@ -1,518 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-#ifdef VMS
-#include <rms.h>
-#include <iodef.h>
-#include <descrip.h>
-#endif /* VMS */
-
-static my_string NEAR_F expand_tilde(my_string *path);
-
- /* Pack a dirname ; Changes HOME to ~/ and current dev to ./ */
- /* from is a dirname (from dirname() ?) ending with FN_LIBCHAR */
- /* to may be == from */
-
-void pack_dirname(my_string to, const char *from)
-{
- int cwd_err;
- uint d_length,length,buff_length;
- my_string start;
- char buff[FN_REFLEN];
- DBUG_ENTER("pack_dirname");
-
- (void) intern_filename(to,from); /* Change to intern name */
-
-#ifdef FN_DEVCHAR
- if ((start=strrchr(to,FN_DEVCHAR)) != 0) /* Skipp device part */
- start++;
- else
-#endif
- start=to;
-
- LINT_INIT(buff_length);
- if (!(cwd_err= my_getwd(buff,FN_REFLEN,MYF(0))))
- {
- buff_length= (uint) strlen(buff);
- d_length=(uint) (start-to);
- if ((start == to ||
- (buff_length == d_length && !bcmp(buff,start,d_length))) &&
- *start != FN_LIBCHAR && *start)
- { /* Put current dir before */
- bchange(to,d_length,buff,buff_length,(uint) strlen(to)+1);
- }
- }
-
- if ((d_length= cleanup_dirname(to,to)) != 0)
- {
- length=0;
- if (home_dir)
- {
- length= (uint) strlen(home_dir);
- if (home_dir[length-1] == FN_LIBCHAR)
- length--; /* Don't test last '/' */
- }
- if (length > 1 && length < d_length)
- { /* test if /xx/yy -> ~/yy */
- if (bcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR)
- {
- to[0]=FN_HOMELIB; /* Filename begins with ~ */
- (void) strmov_overlapp(to+1,to+length);
- }
- }
- if (! cwd_err)
- { /* Test if cwd is ~/... */
- if (length > 1 && length < buff_length)
- {
- if (bcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR)
- {
- buff[0]=FN_HOMELIB;
- (void) strmov_overlapp(buff+1,buff+length);
- }
- }
- if (is_prefix(to,buff))
- {
- length= (uint) strlen(buff);
- if (to[length])
- (void) strmov_overlapp(to,to+length); /* Remove everything before */
- else
- {
- to[0]= FN_CURLIB; /* Put ./ instead of cwd */
- to[1]= FN_LIBCHAR;
- to[2]= '\0';
- }
- }
- }
- }
- DBUG_PRINT("exit",("to: '%s'",to));
- DBUG_VOID_RETURN;
-} /* pack_dirname */
-
-
- /* remove unwanted chars from dirname */
- /* if "/../" removes prev dir; "/~/" removes all before ~ */
- /* "//" is same as "/", except on Win32 at start of a file */
- /* "/./" is removed */
- /* Unpacks home_dir if "~/.." used */
- /* Unpacks current dir if if "./.." used */
-
-uint cleanup_dirname(register my_string to, const char *from)
- /* to may be == from */
-
-{
- reg5 uint length;
- reg2 my_string pos;
- reg3 my_string from_ptr;
- reg4 my_string start;
- char parent[5], /* for "FN_PARENTDIR" */
- buff[FN_REFLEN+1],*end_parentdir;
- DBUG_ENTER("cleanup_dirname");
- DBUG_PRINT("enter",("from: '%s'",from));
-
- start=buff;
- from_ptr=(my_string) from;
-#ifdef FN_DEVCHAR
- if ((pos=strrchr(from_ptr,FN_DEVCHAR)) != 0)
- { /* Skipp device part */
- length=(uint) (pos-from_ptr)+1;
- start=strnmov(buff,from_ptr,length); from_ptr+=length;
- }
-#endif
-
- parent[0]=FN_LIBCHAR;
- length=(uint) (strmov(parent+1,FN_PARENTDIR)-parent);
- for (pos=start ; (*pos= *from_ptr++) != 0 ; pos++)
- {
- if (*pos == '/')
- *pos = FN_LIBCHAR;
- if (*pos == FN_LIBCHAR)
- {
- if ((uint) (pos-start) > length && bcmp(pos-length,parent,length) == 0)
- { /* If .../../; skipp prev */
- pos-=length;
- if (pos != start)
- { /* not /../ */
- pos--;
- if (*pos == FN_HOMELIB && (pos == start || pos[-1] == FN_LIBCHAR))
- {
- if (!home_dir)
- {
- pos+=length+1; /* Don't unpack ~/.. */
- continue;
- }
- pos=strmov(buff,home_dir)-1; /* Unpacks ~/.. */
- if (*pos == FN_LIBCHAR)
- pos--; /* home ended with '/' */
- }
- if (*pos == FN_CURLIB && (pos == start || pos[-1] == FN_LIBCHAR))
- {
- if (my_getwd(curr_dir,FN_REFLEN,MYF(0)))
- {
- pos+=length+1; /* Don't unpack ./.. */
- continue;
- }
- pos=strmov(buff,curr_dir)-1; /* Unpacks ./.. */
- if (*pos == FN_LIBCHAR)
- pos--; /* home ended with '/' */
- }
- end_parentdir=pos;
- while (pos >= start && *pos != FN_LIBCHAR) /* remove prev dir */
- pos--;
- if (pos[1] == FN_HOMELIB || bcmp(pos,parent,length) == 0)
- { /* Don't remove ~user/ */
- pos=strmov(end_parentdir+1,parent);
- *pos=FN_LIBCHAR;
- continue;
- }
- }
- }
- else if ((uint) (pos-start) == length-1 &&
- !bcmp(start,parent+1,length-1))
- start=pos; /* Starts with "../" */
- else if (pos-start > 0 && pos[-1] == FN_LIBCHAR)
- {
-#ifdef FN_NETWORK_DRIVES
- if (pos-start != 1)
-#endif
- pos--; /* Remove dupplicate '/' */
- }
- else if (pos-start > 1 && pos[-1] == FN_CURLIB && pos[-2] == FN_LIBCHAR)
- pos-=2; /* Skipp /./ */
- else if (pos > buff+1 && pos[-1] == FN_HOMELIB && pos[-2] == FN_LIBCHAR)
- { /* Found ..../~/ */
- buff[0]=FN_HOMELIB;
- buff[1]=FN_LIBCHAR;
- start=buff; pos=buff+1;
- }
- }
- }
- (void) strmov(to,buff);
- DBUG_PRINT("exit",("to: '%s'",to));
- DBUG_RETURN((uint) (pos-buff));
-} /* cleanup_dirname */
-
-
- /*
- On system where you don't have symbolic links, the following
- code will allow you to create a file:
- directory-name.lnk that should contain the real path
- to the directory. This will be used if the directory name
- doesn't exists
- */
-
-
-my_bool my_use_symdir=0; /* Set this if you want to use symdirs */
-
-#ifdef USE_SYMDIR
-void symdirget(char *dir)
-{
- char buff[FN_REFLEN];
- char *pos=strend(dir);
- if (dir[0] && pos[-1] != FN_DEVCHAR && access(dir, F_OK))
- {
- FILE *fp;
- char temp= *(--pos); /* May be "/" or "\" */
- strmov(pos,".sym");
- fp = my_fopen(dir, O_RDONLY,MYF(0));
- *pos++=temp; *pos=0; /* Restore old filename */
- if (fp)
- {
- if (fgets(buff, sizeof(buff)-1, fp))
- {
- for (pos=strend(buff);
- pos > buff && (iscntrl(pos[-1]) || isspace(pos[-1])) ;
- pos --);
-
- /* Ensure that the symlink ends with the directory symbol */
- if (pos == buff || pos[-1] != FN_LIBCHAR)
- *pos++=FN_LIBCHAR;
-
- strmake(dir,buff, (uint) (pos-buff));
- }
- my_fclose(fp,MYF(0));
- }
- }
-}
-#endif /* USE_SYMDIR */
-
- /* Unpacks dirname to name that can be used by open... */
- /* Make that last char of to is '/' if from not empty and
- from doesn't end in FN_DEVCHAR */
- /* Uses cleanup_dirname and changes ~/.. to home_dir/.. */
- /* Returns length of new directory */
-
-uint unpack_dirname(my_string to, const char *from)
-
- /* to may be == from */
-{
- uint length,h_length;
- char buff[FN_REFLEN+1+4],*suffix,*tilde_expansion;
- DBUG_ENTER("unpack_dirname");
-
- (void) intern_filename(buff,from); /* Change to intern name */
- length= (uint) strlen(buff); /* Fix that '/' is last */
- if (length &&
-#ifdef FN_DEVCHAR
- buff[length-1] != FN_DEVCHAR &&
-#endif
- buff[length-1] != FN_LIBCHAR && buff[length-1] != '/')
- {
- buff[length]=FN_LIBCHAR;
- buff[length+1]= '\0';
- }
-
- length=cleanup_dirname(buff,buff);
- if (buff[0] == FN_HOMELIB)
- {
- suffix=buff+1; tilde_expansion=expand_tilde(&suffix);
- if (tilde_expansion)
- {
- length-=(uint) (suffix-buff)-1;
- if (length+(h_length= (uint) strlen(tilde_expansion)) <= FN_REFLEN)
- {
- if (tilde_expansion[h_length-1] == FN_LIBCHAR)
- h_length--;
- if (buff+h_length < suffix)
- bmove(buff+h_length,suffix,length);
- else
- bmove_upp(buff+h_length+length,suffix+length,length);
- bmove(buff,tilde_expansion,h_length);
- }
- }
- }
-#ifdef USE_SYMDIR
- if (my_use_symdir)
- symdirget(buff);
-#endif
- DBUG_RETURN(system_filename(to,buff)); /* Fix for open */
-} /* unpack_dirname */
-
-
- /* Expand tilde to home or user-directory */
- /* Path is reset to point at FN_LIBCHAR after ~xxx */
-
-static my_string NEAR_F expand_tilde(my_string *path)
-{
- if (path[0][0] == FN_LIBCHAR)
- return home_dir; /* ~/ expanded to home */
-#ifdef HAVE_GETPWNAM
- {
- char *str,save;
- struct passwd *user_entry;
-
- if (!(str=strchr(*path,FN_LIBCHAR)))
- str=strend(*path);
- save= *str; *str= '\0';
- user_entry=getpwnam(*path);
- *str=save;
- endpwent();
- if (user_entry)
- {
- *path=str;
- return user_entry->pw_dir;
- }
- }
-#endif
- return (my_string) 0;
-}
-
- /* fix filename so it can be used by open, create .. */
- /* to may be == from */
- /* Returns to */
-
-my_string unpack_filename(my_string to, const char *from)
-{
- uint length,n_length;
- char buff[FN_REFLEN];
- DBUG_ENTER("unpack_filename");
-
- length=dirname_part(buff,from); /* copy & convert dirname */
- n_length=unpack_dirname(buff,buff);
- if (n_length+strlen(from+length) < FN_REFLEN)
- {
- (void) strmov(buff+n_length,from+length);
- (void) system_filename(to,buff); /* Fix to usably filename */
- }
- else
- (void) system_filename(to,from); /* Fix to usably filename */
- DBUG_RETURN(to);
-} /* unpack_filename */
-
-
- /* Convert filename (unix standard) to system standard */
- /* Used before system command's like open(), create() .. */
- /* Returns to */
-
-uint system_filename(my_string to, const char *from)
-{
-#ifndef FN_C_BEFORE_DIR
- return (uint) (strmake(to,from,FN_REFLEN-1)-to);
-#else /* VMS */
-
- /* change 'dev:lib/xxx' to 'dev:[lib]xxx' */
- /* change 'dev:xxx' to 'dev:xxx' */
- /* change './xxx' to 'xxx' */
- /* change './lib/' or lib/ to '[.lib]' */
- /* change '/x/y/z to '[x.y]x' */
- /* change 'dev:/x' to 'dev:[000000]x' */
-
- int libchar_found,length;
- my_string to_pos,from_pos,pos;
- char buff[FN_REFLEN];
- DBUG_ENTER("system_filename");
-
- libchar_found=0;
- (void) strmov(buff,from); /* If to == from */
- from_pos= buff;
- if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skipp device part */
- {
- pos++;
- to_pos=strnmov(to,from_pos,(size_s) (pos-from_pos));
- from_pos=pos;
- }
- else
- to_pos=to;
-
- if (from_pos[0] == FN_CURLIB && from_pos[1] == FN_LIBCHAR)
- from_pos+=2; /* Skipp './' */
- if (strchr(from_pos,FN_LIBCHAR))
- {
- *(to_pos++) = FN_C_BEFORE_DIR;
- if (strinstr(from_pos,FN_ROOTDIR) == 1)
- {
- from_pos+=strlen(FN_ROOTDIR); /* Actually +1 but... */
- if (! strchr(from_pos,FN_LIBCHAR))
- { /* No dir, use [000000] */
- to_pos=strmov(to_pos,FN_C_ROOT_DIR);
- libchar_found++;
- }
- }
- else
- *(to_pos++)=FN_C_DIR_SEP; /* '.' gives current dir */
-
- while ((pos=strchr(from_pos,FN_LIBCHAR)))
- {
- if (libchar_found++)
- *(to_pos++)=FN_C_DIR_SEP; /* Add '.' between dirs */
- if (strinstr(from_pos,FN_PARENTDIR) == 1 &&
- from_pos+strlen(FN_PARENTDIR) == pos)
- to_pos=strmov(to_pos,FN_C_PARENT_DIR); /* Found '../' */
- else
- to_pos=strnmov(to_pos,from_pos,(size_s) (pos-from_pos));
- from_pos=pos+1;
- }
- *(to_pos++)=FN_C_AFTER_DIR;
- }
- length=(int) (strmov(to_pos,from_pos)-to);
- DBUG_PRINT("exit",("name: '%s'",to));
- DBUG_RETURN((uint) length);
-#endif
-} /* system_filename */
-
-
- /* Fix a filename to intern (UNIX format) */
-
-my_string intern_filename(my_string to, const char *from)
-{
-#ifndef VMS
- {
- uint length;
- char buff[FN_REFLEN];
- if (from == to)
- { /* Dirname may destroy from */
- strmov(buff,from);
- from=buff;
- }
- length=dirname_part(to,from); /* Copy dirname & fix chars */
- (void) strcat(to,from+length);
- return (to);
- }
-#else /* VMS */
-
- /* change 'dev:[lib]xxx' to 'dev:lib/xxx' */
- /* change 'dev:xxx' to 'dev:xxx' */
- /* change 'dev:x/y/[.lib]' to 'dev:x/y/lib/ */
- /* change '[.lib]' to './lib/' */
- /* change '[x.y]' or '[x.][y]' or '[x][.y]' to '/x/y/' */
- /* change '[000000.x] or [x.000000]' to '/x/' */
-
- int par_length,root_length;
- my_string pos,from_pos,to_pos,end_pos;
- char buff[FN_REFLEN];
-
- (void) strmov(buff,from);
- convert_dirname(buff); /* change '<>' to '[]' */
- from_pos=buff;
- if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skipp device part */
- {
- pos++;
- to_pos=strnmov(to,from_pos,(size_s) (pos-from_pos));
- from_pos=pos;
- }
- else
- to_pos=to;
-
- root_length=strlen(FN_C_ROOT_DIR);
- if ((pos = strchr(from_pos,FN_C_BEFORE_DIR)) &&
- (end_pos = strrchr(pos+1,FN_C_AFTER_DIR)))
- {
- to_pos=strnmov(to_pos,from_pos,(size_s) (pos-from_pos));
- /* Copy all between ':' and '[' */
- from_pos=pos+1;
- if (strinstr(from_pos,FN_C_ROOT_DIR) == 1 &&
- (from_pos[root_length] == FN_C_DIR_SEP ||
- from_pos[root_length] == FN_C_AFTER_DIR))
- {
- from_pos+=root_length+1;
- }
- else if (*from_pos == FN_C_DIR_SEP)
- *(to_pos++) = FN_CURLIB; /* Set ./ first */
- *(to_pos++) = FN_LIBCHAR;
-
- par_length=strlen(FN_C_PARENT_DIR);
- pos=to_pos;
- for (; from_pos <= end_pos ; from_pos++)
- {
- switch (*from_pos) {
- case FN_C_DIR_SEP:
- case FN_C_AFTER_DIR:
- if (pos != to_pos)
- {
- if ((int) (to_pos-pos) == root_length &&
- is_suffix(pos,FN_C_ROOT_DIR))
- to_pos=pos; /* remove root-pos */
- else
- {
- *(to_pos++)=FN_LIBCHAR; /* Find lib */
- pos=to_pos;
- }
- }
- break;
- case FN_C_BEFORE_DIR:
- break;
- case '-': /* *(FN_C_PARENT_DIR): */
- if (to_pos[-1] == FN_LIBCHAR &&
- strncmp(from_pos,FN_C_PARENT_DIR,par_length) == 0)
- { /* Change '-' to '..' */
- to_pos=strmov(to_pos,FN_PARENTDIR);
- *(to_pos++)=FN_LIBCHAR;
- pos=to_pos;
- from_pos+=par_length-1;
- break;
- }
- /* Fall through */
- default:
- *(to_pos++)= *from_pos;
- break;
- }
- }
- }
- (void) strmov(to_pos,from_pos);
- return (to);
-#endif /* VMS */
-} /* intern_filename */
diff --git a/ext/mysql/libmysql/mf_path.c b/ext/mysql/libmysql/mf_path.c
deleted file mode 100644
index 6258c28df9..0000000000
--- a/ext/mysql/libmysql/mf_path.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
-static char *find_file_in_path(char *to,const char *name);
-
- /* Finds where program can find it's files.
- pre_pathname is found by first locking at progname (argv[0]).
- if progname contains path the path is returned.
- else if progname is found in path, return it
- else if progname is given and POSIX environment variable "_" is set
- then path is taken from "_".
- If filename doesn't contain a path append MY_BASEDIR_VERSION or
- MY_BASEDIR if defined, else append "/my/running".
- own_path_name_part is concatinated to result.
- my_path puts result in to and returns to */
-
-my_string my_path(my_string to, const char *progname,
- const char *own_pathname_part)
-{
- my_string start,end,prog;
- DBUG_ENTER("my_path");
-
- start=to; /* Return this */
- if (progname && (dirname_part(to, progname) ||
- find_file_in_path(to,progname) ||
- ((prog=getenv("_")) != 0 && dirname_part(to,prog))))
- {
- VOID(intern_filename(to,to));
- if (!test_if_hard_path(to))
- {
- if (!my_getwd(curr_dir,FN_REFLEN,MYF(0)))
- bchange(to,0,curr_dir, (uint) strlen(curr_dir), (uint) strlen(to)+1);
- }
- }
- else
- {
- if ((end = getenv("MY_BASEDIR_VERSION")) == 0 &&
- (end = getenv("MY_BASEDIR")) == 0)
- {
-#ifdef DEFAULT_BASEDIR
- end= (char*) DEFAULT_BASEDIR;
-#else
- end= (char*) "/my/";
-#endif
- }
- VOID(intern_filename(to,end));
- to=strend(to);
- if (to != start && to[-1] != FN_LIBCHAR)
- *to++ = FN_LIBCHAR;
- VOID(strmov(to,own_pathname_part));
- }
- DBUG_PRINT("exit",("to: '%s'",start));
- DBUG_RETURN(start);
-} /* my_path */
-
-
- /* test if file without filename is found in path */
- /* Returns to if found and to has dirpart if found, else NullS */
-
-#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
-#define F_OK 0
-#define PATH_SEP ';'
-#define PROGRAM_EXTENSION ".exe"
-#else
-#define PATH_SEP ':'
-#endif
-
-static char *find_file_in_path(char *to, const char *name)
-{
- char *path,*pos,dir[2];
- const char *ext="";
-
- if (!(path=getenv("PATH")))
- return NullS;
- dir[0]=FN_LIBCHAR; dir[1]=0;
-#ifdef PROGRAM_EXTENSION
- if (!fn_ext(name)[0])
- ext=PROGRAM_EXTENSION;
-#endif
-
- for (pos=path ; (pos=strchr(pos,PATH_SEP)) ; path= ++pos)
- {
- if (path != pos)
- {
- strxmov(strnmov(to,path,(uint) (pos-path)),dir,name,ext,NullS);
- if (!access(to,F_OK))
- {
- to[(uint) (pos-path)+1]=0; /* Return path only */
- return to;
- }
- }
- }
-#ifdef __WIN__
- to[0]=FN_CURLIB;
- strxmov(to+1,dir,name,ext,NullS);
- if (!access(to,F_OK)) /* Test in current dir */
- {
- to[2]=0; /* Leave ".\" */
- return to;
- }
-#endif
- return NullS; /* File not found */
-}
diff --git a/ext/mysql/libmysql/mf_unixpath.c b/ext/mysql/libmysql/mf_unixpath.c
deleted file mode 100644
index 79a99b4323..0000000000
--- a/ext/mysql/libmysql/mf_unixpath.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
- /* convert filename to unix style filename */
- /* If MSDOS converts '\' to '/' */
-
-void to_unix_path(my_string to __attribute__((unused)))
-{
-#if FN_LIBCHAR != '/'
- {
- to--;
- while ((to=strchr(to+1,FN_LIBCHAR)) != 0)
- *to='/';
- }
-#endif
-}
diff --git a/ext/mysql/libmysql/mf_wcomp.c b/ext/mysql/libmysql/mf_wcomp.c
deleted file mode 100644
index 73e847f1c4..0000000000
--- a/ext/mysql/libmysql/mf_wcomp.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Funktions for comparing with wild-cards */
-
-#include "mysys_priv.h"
-
- /* Test if a string is "comparable" to a wild-card string */
- /* returns 0 if the strings are "comparable" */
-
-char wild_many='*';
-char wild_one='?';
-char wild_prefix=0;
-
-int wild_compare(register const char *str, register const char *wildstr)
-{
- reg3 int flag;
- DBUG_ENTER("wild_compare");
-
- while (*wildstr)
- {
- while (*wildstr && *wildstr != wild_many && *wildstr != wild_one)
- {
- if (*wildstr == wild_prefix && wildstr[1])
- wildstr++;
- if (*wildstr++ != *str++) DBUG_RETURN(1);
- }
- if (! *wildstr ) DBUG_RETURN (*str != 0);
- if (*wildstr++ == wild_one)
- {
- if (! *str++) DBUG_RETURN (1); /* One char; skipp */
- }
- else
- { /* Found '*' */
- if (!*wildstr) DBUG_RETURN(0); /* '*' as last char: OK */
- flag=(*wildstr != wild_many && *wildstr != wild_one);
- do
- {
- if (flag)
- {
- char cmp;
- if ((cmp= *wildstr) == wild_prefix && wildstr[1])
- cmp=wildstr[1];
- while (*str && *str != cmp)
- str++;
- if (!*str) DBUG_RETURN (1);
- }
- if (wild_compare(str,wildstr) == 0) DBUG_RETURN (0);
- } while (*str++ && wildstr[0] != wild_many);
- DBUG_RETURN(1);
- }
- }
- DBUG_RETURN (*str != '\0');
-} /* wild_compare */
diff --git a/ext/mysql/libmysql/mulalloc.c b/ext/mysql/libmysql/mulalloc.c
deleted file mode 100644
index 793858afd4..0000000000
--- a/ext/mysql/libmysql/mulalloc.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
- /* Malloc many pointers at the same time */
- /* format myFlags,ptr,length,ptr,length ... until null ptr */
-
-#include "mysys_priv.h"
-#include <stdarg.h>
-
-gptr my_multi_malloc(myf myFlags, ...)
-{
- va_list args;
- char **ptr,*start,*res;
- uint tot_length,length;
- DBUG_ENTER("my_multi_malloc");
-
- va_start(args,myFlags);
- tot_length=0;
- while ((ptr=va_arg(args, char **)))
- {
- length=va_arg(args,uint);
- tot_length+=ALIGN_SIZE(length);
- }
- va_end(args);
-
- if (!(start=(char *) my_malloc(tot_length,myFlags)))
- DBUG_RETURN(0); /* purecov: inspected */
-
- va_start(args,myFlags);
- res=start;
- while ((ptr=va_arg(args, char **)))
- {
- *ptr=res;
- length=va_arg(args,uint);
- res+=ALIGN_SIZE(length);
- }
- va_end(args);
- DBUG_RETURN((gptr) start);
-}
diff --git a/ext/mysql/libmysql/my_alarm.h b/ext/mysql/libmysql/my_alarm.h
deleted file mode 100644
index b0fc91d74f..0000000000
--- a/ext/mysql/libmysql/my_alarm.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- File to include when we want to use alarm or a loop_counter to display
- some information when a program is running
-*/
-#ifndef _my_alarm_h
-#define _my_alarm_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern int volatile my_have_got_alarm;
-extern ulong my_time_to_wait_for_lock;
-
-#if defined(HAVE_ALARM) && !defined(NO_ALARM_LOOP)
-#include <signal.h>
-#define ALARM_VARIABLES uint alarm_old=0; \
- sig_return alarm_signal=0
-#define ALARM_INIT my_have_got_alarm=0 ; \
- alarm_old=(uint) alarm(MY_HOW_OFTEN_TO_ALARM); \
- alarm_signal=signal(SIGALRM,my_set_alarm_variable);
-#define ALARM_END VOID(signal(SIGALRM,alarm_signal)); \
- VOID(alarm(alarm_old));
-#define ALARM_TEST my_have_got_alarm
-#ifdef DONT_REMEMBER_SIGNAL
-#define ALARM_REINIT VOID(alarm(MY_HOW_OFTEN_TO_ALARM)); \
- VOID(signal(SIGALRM,my_set_alarm_variable));\
- my_have_got_alarm=0;
-#else
-#define ALARM_REINIT VOID(alarm((uint) MY_HOW_OFTEN_TO_ALARM)); \
- my_have_got_alarm=0;
-#endif /* DONT_REMEMBER_SIGNAL */
-#else
-#define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1
-#define ALARM_INIT
-#define ALARM_END
-#define ALARM_TEST (alarm_pos++ >= alarm_end_pos)
-#define ALARM_REINIT alarm_end_pos+=MY_HOW_OFTEN_TO_WRITE
-#endif /* HAVE_ALARM */
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/ext/mysql/libmysql/my_alloc.c b/ext/mysql/libmysql/my_alloc.c
deleted file mode 100644
index a33f86fa00..0000000000
--- a/ext/mysql/libmysql/my_alloc.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Routines to handle mallocing of results which will be freed the same time */
-
-#include <global.h>
-#include <my_sys.h>
-#include <m_string.h>
-
-void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size)
-{
- mem_root->free=mem_root->used=0;
- mem_root->min_malloc=32;
- mem_root->block_size=block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8;
- mem_root->error_handler=0;
-#if !(defined(HAVE_purify) && defined(EXTRA_DEBUG))
- if (pre_alloc_size)
- {
- if ((mem_root->free = mem_root->pre_alloc=
- (USED_MEM*) my_malloc(pre_alloc_size+ ALIGN_SIZE(sizeof(USED_MEM)),
- MYF(0))))
- {
- mem_root->free->size=pre_alloc_size+ALIGN_SIZE(sizeof(USED_MEM));
- mem_root->free->left=pre_alloc_size;
- mem_root->free->next=0;
- }
- }
-#endif
-}
-
-gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size)
-{
-#if defined(HAVE_purify) && defined(EXTRA_DEBUG)
- reg1 USED_MEM *next;
- Size+=ALIGN_SIZE(sizeof(USED_MEM));
-
- if (!(next = (USED_MEM*) my_malloc(Size,MYF(MY_WME))))
- {
- if (mem_root->error_handler)
- (*mem_root->error_handler)();
- return((gptr) 0); /* purecov: inspected */
- }
- next->next=mem_root->used;
- mem_root->used=next;
- return (gptr) (((char*) next)+ALIGN_SIZE(sizeof(USED_MEM)));
-#else
- uint get_size,max_left;
- gptr point;
- reg1 USED_MEM *next;
- reg2 USED_MEM **prev;
-
- Size= ALIGN_SIZE(Size);
- prev= &mem_root->free;
- max_left=0;
- for (next= *prev ; next && next->left < Size ; next= next->next)
- {
- if (next->left > max_left)
- max_left=next->left;
- prev= &next->next;
- }
- if (! next)
- { /* Time to alloc new block */
- get_size= Size+ALIGN_SIZE(sizeof(USED_MEM));
- if (max_left*4 < mem_root->block_size && get_size < mem_root->block_size)
- get_size=mem_root->block_size; /* Normal alloc */
-
- if (!(next = (USED_MEM*) my_malloc(get_size,MYF(MY_WME))))
- {
- if (mem_root->error_handler)
- (*mem_root->error_handler)();
- return((gptr) 0); /* purecov: inspected */
- }
- next->next= *prev;
- next->size= get_size;
- next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM));
- *prev=next;
- }
- point= (gptr) ((char*) next+ (next->size-next->left));
- if ((next->left-= Size) < mem_root->min_malloc)
- { /* Full block */
- *prev=next->next; /* Remove block from list */
- next->next=mem_root->used;
- mem_root->used=next;
- }
- return(point);
-#endif
-}
-
- /* deallocate everything used by alloc_root */
-
-void free_root(MEM_ROOT *root, myf MyFlags)
-{
- reg1 USED_MEM *next,*old;
- DBUG_ENTER("free_root");
-
- if (!root)
- DBUG_VOID_RETURN; /* purecov: inspected */
- if (!(MyFlags & MY_KEEP_PREALLOC))
- root->pre_alloc=0;
-
- for ( next=root->used; next ;)
- {
- old=next; next= next->next ;
- if (old != root->pre_alloc)
- my_free((gptr) old,MYF(0));
- }
- for (next= root->free ; next ; )
- {
- old=next; next= next->next ;
- if (old != root->pre_alloc)
- my_free((gptr) old,MYF(0));
- }
- root->used=root->free=0;
- if (root->pre_alloc)
- {
- root->free=root->pre_alloc;
- root->free->left=root->pre_alloc->size-ALIGN_SIZE(sizeof(USED_MEM));
- root->free->next=0;
- }
- DBUG_VOID_RETURN;
-}
-
-
-char *strdup_root(MEM_ROOT *root,const char *str)
-{
- uint len= (uint) strlen(str)+1;
- char *pos;
- if ((pos=alloc_root(root,len)))
- memcpy(pos,str,len);
- return pos;
-}
-
-
-char *memdup_root(MEM_ROOT *root,const char *str,uint len)
-{
- char *pos;
- if ((pos=alloc_root(root,len)))
- memcpy(pos,str,len);
- return pos;
-}
diff --git a/ext/mysql/libmysql/my_compress.c b/ext/mysql/libmysql/my_compress.c
deleted file mode 100644
index 79e8ceac7c..0000000000
--- a/ext/mysql/libmysql/my_compress.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Written by Sinisa Milivojevic <sinisa@coresinc.com> */
-
-#include <global.h>
-#ifdef HAVE_COMPRESS
-#include <my_sys.h>
-#include <m_string.h>
-#include <zlib.h>
-
-/*
-** This replaces the packet with a compressed packet
-** Returns 1 on error
-** *complen is 0 if the packet wasn't compressed
-*/
-
-my_bool my_compress(byte *packet, ulong *len, ulong *complen)
-{
- if (*len < MIN_COMPRESS_LENGTH)
- *complen=0;
- else
- {
- byte *compbuf=my_compress_alloc(packet,len,complen);
- if (!compbuf)
- return *complen ? 0 : 1;
- memcpy(packet,compbuf,*len);
- my_free(compbuf,MYF(MY_WME)); }
- return 0;
-}
-
-
-byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen)
-{
- byte *compbuf;
- *complen = *len * 120 / 100 + 12;
- if (!(compbuf = (byte *) my_malloc(*complen,MYF(MY_WME))))
- return 0; /* Not enough memory */
- if (compress((Bytef*) compbuf,(ulong *) complen, (Bytef*) packet,
- (uLong) *len ) != Z_OK)
- {
- my_free(compbuf,MYF(MY_WME));
- return 0;
- }
- if (*complen >= *len)
- {
- *complen=0;
- my_free(compbuf,MYF(MY_WME));
- return 0;
- }
- swap(ulong,*len,*complen); /* *len is now packet length */
- return compbuf;
-}
-
-
-my_bool my_uncompress (byte *packet, ulong *len, ulong *complen)
-{
- if (*complen) /* If compressed */
- {
- byte *compbuf = (byte *) my_malloc (*complen,MYF(MY_WME));
- if (!compbuf)
- return 1; /* Not enough memory */
- if (uncompress((Bytef*) compbuf, complen, (Bytef*) packet, *len) != Z_OK)
- { /* Probably wrong packet */
- my_free (compbuf,MYF(MY_WME));
- return 1;
- }
- *len = *complen;
- memcpy(packet,compbuf,*len);
- my_free(compbuf,MYF(MY_WME));
- }
- return 0;
-}
-#endif /* HAVE_COMPRESS */
diff --git a/ext/mysql/libmysql/my_config.h b/ext/mysql/libmysql/my_config.h
deleted file mode 100644
index 73a3f6d66e..0000000000
--- a/ext/mysql/libmysql/my_config.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <php_config.h>
-
-/* PHP might define ulong, but we want to use our own typedef */
-#ifdef ulong
-#undef ulong
-#endif
-
-/* The client doesn't use multiple charsets, so only the compiled-in
- default is really needed */
-#define SHAREDIR "NONEXISTENT"
-#define DEFAULT_CHARSET_HOME SHAREDIR
diff --git a/ext/mysql/libmysql/my_create.c b/ext/mysql/libmysql/my_create.c
deleted file mode 100644
index a779b3f142..0000000000
--- a/ext/mysql/libmysql/my_create.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#define USES_TYPES
-#include "mysys_priv.h"
-#include <my_dir.h>
-#include "mysys_err.h"
-#include <errno.h>
-#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
-#include <share.h>
-#endif
-
- /*
- ** Create a new file
- ** Arguments:
- ** Path-name of file
- ** Read | write on file (umask value)
- ** Read & Write on open file
- ** Special flags
- */
-
-
-File my_create(const char *FileName, int CreateFlags, int access_flags,
- myf MyFlags)
-{
- int fd;
- DBUG_ENTER("my_create");
- DBUG_PRINT("my",("Name: '%s' CreateFlags: %d AccessFlags: %d MyFlags: %d",
- FileName, CreateFlags, access_flags, MyFlags));
-
-#if !defined(NO_OPEN_3) && !defined(__EMX__)
- fd = open((my_string) FileName, access_flags | O_CREAT,
- CreateFlags ? CreateFlags : my_umask);
-#elif defined(VMS)
- fd = open((my_string) FileName, access_flags | O_CREAT, 0,
- "ctx=stm","ctx=bin");
-#elif defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
- if (access_flags & O_SHARE)
- fd = sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY,
- SH_DENYNO, MY_S_IREAD | MY_S_IWRITE);
- else
- fd = open((my_string) FileName, access_flags | O_CREAT | O_BINARY,
- MY_S_IREAD | MY_S_IWRITE);
-#else
- fd = open(FileName, access_flags);
-#endif
-
- DBUG_RETURN(my_register_filename(fd, FileName, FILE_BY_CREATE,
- EE_CANTCREATEFILE, MyFlags));
-} /* my_create */
diff --git a/ext/mysql/libmysql/my_delete.c b/ext/mysql/libmysql/my_delete.c
deleted file mode 100644
index f1ffada90f..0000000000
--- a/ext/mysql/libmysql/my_delete.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-
-#include "mysys_err.h"
-
-int my_delete(const char *name, myf MyFlags)
-{
- int err;
- DBUG_ENTER("my_delete");
- DBUG_PRINT("my",("name %s MyFlags %d", name, MyFlags));
-
- if ((err = unlink(name)) == -1)
- {
- my_errno=errno;
- if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_DELETE,MYF(ME_BELL+ME_WAITTANG+(MyFlags & ME_NOINPUT)),
- name,errno);
- }
- DBUG_RETURN(err);
-} /* my_delete */
diff --git a/ext/mysql/libmysql/my_dir.h b/ext/mysql/libmysql/my_dir.h
deleted file mode 100644
index e0c79dadfe..0000000000
--- a/ext/mysql/libmysql/my_dir.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#ifndef _my_dir_h
-#define _my_dir_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef MY_DIR_H
-#define MY_DIR_H
-
-#include <sys/stat.h>
-
- /* Defines for my_dir and my_stat */
-
-#define MY_S_IFMT S_IFMT /* type of file */
-#define MY_S_IFDIR S_IFDIR /* directory */
-#define MY_S_IFCHR S_IFCHR /* character special */
-#define MY_S_IFBLK S_IFBLK /* block special */
-#define MY_S_IFREG S_IFREG /* regular */
-#define MY_S_IFIFO S_IFIFO /* fifo */
-#define MY_S_ISUID S_ISUID /* set user id on execution */
-#define MY_S_ISGID S_ISGID /* set group id on execution */
-#define MY_S_ISVTX S_ISVTX /* save swapped text even after use */
-#define MY_S_IREAD S_IREAD /* read permission, owner */
-#define MY_S_IWRITE S_IWRITE /* write permission, owner */
-#define MY_S_IEXEC S_IEXEC /* execute/search permission, owner */
-
-#define MY_S_ISDIR(m) (((m) & MY_S_IFMT) == MY_S_IFDIR)
-#define MY_S_ISCHR(m) (((m) & MY_S_IFMT) == MY_S_IFCHR)
-#define MY_S_ISBLK(m) (((m) & MY_S_IFMT) == MY_S_IFBLK)
-#define MY_S_ISREG(m) (((m) & MY_S_IFMT) == MY_S_IFREG)
-#define MY_S_ISFIFO(m) (((m) & MY_S_IFMT) == MY_S_IFIFO)
-
-#define MY_DONT_SORT 512 /* my_lib; Don't sort files */
-#define MY_WANT_STAT 1024 /* my_lib; stat files */
-
- /* typedefs for my_dir & my_stat */
-
-#ifdef USE_MY_STAT_STRUCT
-
-typedef struct my_stat
-{
- dev_t st_dev; /* major & minor device numbers */
- ino_t st_ino; /* inode number */
- ushort st_mode; /* file permissons (& suid sgid .. bits) */
- short st_nlink; /* number of links to file */
- ushort st_uid; /* user id */
- ushort st_gid; /* group id */
- dev_t st_rdev; /* more major & minor device numbers (???) */
- off_t st_size; /* size of file */
- time_t st_atime; /* time for last read */
- time_t st_mtime; /* time for last contens modify */
- time_t st_ctime; /* time for last inode or contents modify */
-} MY_STAT;
-
-#else
-
-#define MY_STAT struct stat /* Orginal struct have what we need */
-
-#endif /* USE_MY_STAT_STRUCT */
-
-typedef struct fileinfo /* Struct returned from my_dir & my_stat */
-{
- char *name;
- MY_STAT mystat;
-} FILEINFO;
-
-typedef struct st_my_dir /* Struct returned from my_dir */
-{
- struct fileinfo *dir_entry;
- uint number_off_files;
-} MY_DIR;
-
-extern MY_DIR *my_dir(const char *path,myf MyFlags);
-extern void my_dirend(MY_DIR *buffer);
-extern MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags);
-extern int my_fstat(int filenr, MY_STAT *stat_area, myf MyFlags);
-
-#endif /* MY_DIR_H */
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/ext/mysql/libmysql/my_div.c b/ext/mysql/libmysql/my_div.c
deleted file mode 100644
index fc3ad59b4a..0000000000
--- a/ext/mysql/libmysql/my_div.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-
-my_string my_filename(File fd)
-{
- DBUG_ENTER("my_filename");
- if (fd >= MY_NFILE)
- DBUG_RETURN((char*) "UNKNOWN");
- if (fd >= 0 && my_file_info[fd].type != UNOPEN)
- {
- DBUG_RETURN(my_file_info[fd].name);
- }
- else
- DBUG_RETURN((char*) "UNOPENED"); /* Debug message */
-}
diff --git a/ext/mysql/libmysql/my_error.c b/ext/mysql/libmysql/my_error.c
deleted file mode 100644
index 21dc3ec268..0000000000
--- a/ext/mysql/libmysql/my_error.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-#include <m_string.h>
-#include <stdarg.h>
-#include <m_ctype.h>
-
-/* Define some external variables for error handling */
-
-const char ** NEAR my_errmsg[MAXMAPS]={0,0,0,0};
-char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
-
-/* Error message to user */
-/*VARARGS2*/
-
-int my_error(int nr,myf MyFlags, ...)
-{
- va_list ap;
- uint olen, plen;
- reg1 const char *tpos;
- reg2 char *endpos;
- char * par;
- char ebuff[ERRMSGSIZE+20];
- DBUG_ENTER("my_error");
-
- va_start(ap,MyFlags);
- DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno));
-
- if (nr / ERRMOD == GLOB && my_errmsg[GLOB] == 0)
- init_glob_errs();
-
- olen=(uint) strlen(tpos=my_errmsg[nr / ERRMOD][nr % ERRMOD]);
- endpos=ebuff;
-
- while (*tpos)
- {
- if (tpos[0] != '%')
- {
- *endpos++= *tpos++; /* Copy ordinary char */
- olen++;
- continue;
- }
- if (*++tpos == '%') /* test if %% */
- {
- olen--;
- }
- else
- {
- /* Skipp if max size is used (to be compatible with printf) */
- while (isdigit(*tpos) || *tpos == '.' || *tpos == '-')
- tpos++;
- if (*tpos == 'l') /* Skipp 'l' argument */
- tpos++;
- if (*tpos == 's') /* String parameter */
- {
- par = va_arg(ap, char *);
- plen = (uint) strlen(par);
- if (olen + plen < ERRMSGSIZE+2) /* Replace if possible */
- {
- endpos=strmov(endpos,par);
- tpos++;
- olen+=plen-2;
- continue;
- }
- }
- else if (*tpos == 'd' || *tpos == 'u') /* Integer parameter */
- {
- register int iarg;
- iarg = va_arg(ap, int);
- if (*tpos == 'd')
- plen= (uint) (int2str((long) iarg,endpos, -10) - endpos);
- else
- plen= (uint) (int2str((long) (uint) iarg,endpos,10)- endpos);
- if (olen + plen < ERRMSGSIZE+2) /* Replace parameter if possible */
- {
- endpos+=plen;
- tpos++;
- olen+=plen-2;
- continue;
- }
- }
- }
- *endpos++='%'; /* % used as % or unknown code */
- }
- *endpos='\0'; /* End of errmessage */
- va_end(ap);
- DBUG_RETURN((*error_handler_hook)(nr, ebuff, MyFlags));
-}
-
- /* Error as printf */
-
-int my_printf_error (uint error, const char *format, myf MyFlags, ...)
-{
- va_list args;
- char ebuff[ERRMSGSIZE+20];
-
- va_start(args,MyFlags);
- (void) vsprintf (ebuff,format,args);
- va_end(args);
- return (*error_handler_hook)(error, ebuff, MyFlags);
-}
-
- /* Give message using error_handler_hook */
-
-int my_message(uint error, const char *str, register myf MyFlags)
-{
- return (*error_handler_hook)(error, str, MyFlags);
-}
diff --git a/ext/mysql/libmysql/my_fopen.c b/ext/mysql/libmysql/my_fopen.c
deleted file mode 100644
index 5e6cd6682a..0000000000
--- a/ext/mysql/libmysql/my_fopen.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include "my_static.h"
-#include <errno.h>
-#include "mysys_err.h"
-
-static void make_ftype(my_string to,int flag);
-
- /* Open a file as stream */
-
-FILE *my_fopen(const char *FileName, int Flags, myf MyFlags)
- /* Path-name of file */
- /* Read | write .. */
- /* Special flags */
-{
- FILE *fd;
- char type[5];
- DBUG_ENTER("my_fopen");
- DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d",
- FileName, Flags, MyFlags));
-
- make_ftype(type,Flags);
- if ((fd = fopen(FileName, type)) != 0)
- {
- /*
- The test works if MY_NFILE < 128. The problem is that fileno() is char
- on some OS (SUNOS). Actually the filename save isn't that important
- so we can ignore if this doesn't work.
- */
- if ((uint) fileno(fd) >= MY_NFILE)
- {
- thread_safe_increment(my_stream_opened,&THR_LOCK_open);
- DBUG_RETURN(fd); /* safeguard */
- }
- pthread_mutex_lock(&THR_LOCK_open);
- if ((my_file_info[fileno(fd)].name = (char*)
- my_strdup(FileName,MyFlags)))
- {
- my_stream_opened++;
- my_file_info[fileno(fd)].type = STREAM_BY_FOPEN;
- pthread_mutex_unlock(&THR_LOCK_open);
- DBUG_PRINT("exit",("stream: %lx",fd));
- DBUG_RETURN(fd);
- }
- pthread_mutex_unlock(&THR_LOCK_open);
- (void) my_fclose(fd,MyFlags);
- my_errno=ENOMEM;
- }
- else
- my_errno=errno;
- DBUG_PRINT("error",("Got error %d on open",my_errno));
- if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
- my_error((Flags & O_RDONLY) || (Flags == O_RDONLY ) ? EE_FILENOTFOUND :
- EE_CANTCREATEFILE,
- MYF(ME_BELL+ME_WAITTANG), FileName,my_errno);
- DBUG_RETURN((FILE*) 0);
-} /* my_fopen */
-
-
- /* Close a stream */
-
-int my_fclose(FILE *fd, myf MyFlags)
-{
- int err,file;
- DBUG_ENTER("my_fclose");
- DBUG_PRINT("my",("stream: %lx MyFlags: %d",fd, MyFlags));
-
- pthread_mutex_lock(&THR_LOCK_open);
- file=fileno(fd);
- if ((err = fclose(fd)) < 0)
- {
- my_errno=errno;
- if (MyFlags & (MY_FAE | MY_WME))
- my_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG),
- my_filename(file),errno);
- }
- else
- my_stream_opened--;
- if ((uint) file < MY_NFILE && my_file_info[file].type != UNOPEN)
- {
- my_file_info[file].type = UNOPEN;
- my_free(my_file_info[file].name, MYF(MY_ALLOW_ZERO_PTR));
- }
- pthread_mutex_unlock(&THR_LOCK_open);
- DBUG_RETURN(err);
-} /* my_fclose */
-
-
- /* Make a stream out of a file handle */
- /* Name may be 0 */
-
-FILE *my_fdopen(File Filedes, const char *name, int Flags, myf MyFlags)
-{
- FILE *fd;
- char type[5];
- DBUG_ENTER("my_fdopen");
- DBUG_PRINT("my",("Fd: %d Flags: %d MyFlags: %d",
- Filedes, Flags, MyFlags));
-
- make_ftype(type,Flags);
- if ((fd = fdopen(Filedes, type)) == 0)
- {
- my_errno=errno;
- if (MyFlags & (MY_FAE | MY_WME))
- my_error(EE_CANT_OPEN_STREAM, MYF(ME_BELL+ME_WAITTANG),errno);
- }
- else
- {
- pthread_mutex_lock(&THR_LOCK_open);
- my_stream_opened++;
- if (Filedes < MY_NFILE)
- {
- if (my_file_info[Filedes].type != UNOPEN)
- {
- my_file_opened--; /* File is opened with my_open ! */
- }
- else
- {
- my_file_info[Filedes].name= my_strdup(name,MyFlags);
- }
- my_file_info[Filedes].type = STREAM_BY_FDOPEN;
- }
- pthread_mutex_unlock(&THR_LOCK_open);
- }
-
- DBUG_PRINT("exit",("stream: %lx",fd));
- DBUG_RETURN(fd);
-} /* my_fdopen */
-
-
- /* Make a filehandler-open-typestring from ordinary inputflags */
-
-static void make_ftype(register my_string to, register int flag)
-{
-#if FILE_BINARY /* If we have binary-files */
- reg3 int org_flag=flag;
-#endif
- flag&= ~FILE_BINARY; /* remove binary bit */
- if (flag == O_RDONLY)
- *to++= 'r';
- else if (flag == O_WRONLY)
- *to++= 'w';
- else
- { /* Add '+' after theese */
- if (flag == O_RDWR)
- *to++= 'r';
- else if (flag & O_APPEND)
- *to++= 'a';
- else
- *to++= 'w'; /* Create file */
- *to++= '+';
- }
-#if FILE_BINARY /* If we have binary-files */
- if (org_flag & FILE_BINARY)
- *to++='b';
-#endif
- *to='\0';
-} /* make_ftype */
diff --git a/ext/mysql/libmysql/my_getwd.c b/ext/mysql/libmysql/my_getwd.c
deleted file mode 100644
index 0797db25f5..0000000000
--- a/ext/mysql/libmysql/my_getwd.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* my_setwd() and my_getwd() works with intern_filenames !! */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-#include "mysys_err.h"
-#ifdef HAVE_GETWD
-#include <sys/param.h>
-#endif
-#if defined(MSDOS) || defined(__WIN__)
-#include <m_ctype.h>
-#include <dos.h>
-#include <direct.h>
-#endif
-#if defined(OS2)
-#include <direct.h>
-#endif
-
-#ifdef __EMX__
-/* chdir2 support also drive change */
-#define chdir _chdir2
-#endif
-
- /* Gets current working directory in buff. Directory is allways ended
- with FN_LIBCHAR */
- /* One must pass a buffer to my_getwd. One can allways use
- curr_dir[] */
-
-int my_getwd(my_string buf, uint size, myf MyFlags)
-{
- my_string pos;
- DBUG_ENTER("my_getwd");
- DBUG_PRINT("my",("buf: %lx size: %d MyFlags %d", buf,size,MyFlags));
-
-#if ! defined(MSDOS)
- if (curr_dir[0]) /* Current pos is saved here */
- VOID(strmake(buf,&curr_dir[0],size-1));
- else
-#endif
- {
-#if defined(HAVE_GETCWD)
- if (!getcwd(buf,size-2) && MyFlags & MY_WME)
- {
- my_errno=errno;
- my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno);
- return(-1);
- }
-#elif defined(HAVE_GETWD)
- {
- char pathname[MAXPATHLEN];
- getwd(pathname);
- strmake(buf,pathname,size-1);
- }
-#elif defined(VMS)
- if (!getcwd(buf,size-2,1) && MyFlags & MY_WME)
- {
- my_errno=errno;
- my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno);
- return(-1);
- }
- intern_filename(buf,buf);
-#else
-#error "No way to get current directory"
-#endif
- if (*((pos=strend(buf))-1) != FN_LIBCHAR) /* End with FN_LIBCHAR */
- {
- pos[0]= FN_LIBCHAR;
- pos[1]=0;
- }
- (void) strmake(&curr_dir[0],buf,(size_s) (FN_REFLEN-1));
- }
- DBUG_RETURN(0);
-} /* my_getwd */
-
-
- /* Set new working directory */
-
-int my_setwd(const char *dir, myf MyFlags)
-{
- int res;
- size_s length;
- my_string start,pos;
-#if defined(VMS) || defined(MSDOS) || defined(OS2)
- char buff[FN_REFLEN];
-#endif
- DBUG_ENTER("my_setwd");
- DBUG_PRINT("my",("dir: '%s' MyFlags %d", dir, MyFlags));
-
- start=(my_string) dir;
-#if defined(MSDOS) || defined(OS2) /* OS2/MSDOS chdir can't change drive */
-#if !defined(_DDL) && !defined(WIN32)
- if ((pos=(char*) strchr(dir,FN_DEVCHAR)) != 0)
- {
- uint drive,drives;
-
- pos++; /* Skipp FN_DEVCHAR */
- drive=(uint) (toupper(dir[0])-'A'+1); drives= (uint) -1;
- if ((pos-(byte*) dir) == 2 && drive > 0 && drive < 32)
- {
-#ifdef OS2
- _chdrive(drive);
- drives = _getdrive();
-#else
- _dos_setdrive(drive,&drives);
- _dos_getdrive(&drives);
-#endif
- }
- if (drive != drives)
- {
- *pos='\0'; /* Dir is now only drive */
- my_errno=errno;
- my_error(EE_SETWD,MYF(ME_BELL+ME_WAITTANG),dir,ENOENT);
- DBUG_RETURN(-1);
- }
- dir=pos; /* drive changed, change now path */
- }
-#endif
- if (*((pos=strend(dir)-1)) == FN_LIBCHAR && pos != dir)
- {
- strmov(buff,dir)[-1]=0; /* Remove last '/' */
- dir=buff;
- }
-#endif /* MSDOS*/
- if (! dir[0] || (dir[0] == FN_LIBCHAR && dir[1] == 0))
- dir=FN_ROOTDIR;
-#ifdef VMS
- {
- pos=strmov(buff,dir);
- if (pos[-1] != FN_LIBCHAR)
- {
- pos[0]=FN_LIBCHAR; /* Mark as directory */
- pos[1]=0;
- }
- system_filename(buff,buff); /* Change to VMS format */
- dir=buff;
- }
-#endif /* VMS */
- if ((res=chdir((char*) dir)) != 0)
- {
- my_errno=errno;
- if (MyFlags & MY_WME)
- my_error(EE_SETWD,MYF(ME_BELL+ME_WAITTANG),start,errno);
- }
- else
- {
- if (test_if_hard_path(start))
- { /* Hard pathname */
- pos=strmake(&curr_dir[0],start,(size_s) FN_REFLEN-1);
- if (pos[-1] != FN_LIBCHAR)
- {
- length=(uint) (pos-(char*) curr_dir);
- curr_dir[length]=FN_LIBCHAR; /* must end with '/' */
- curr_dir[length+1]='\0';
- }
- }
- else
- curr_dir[0]='\0'; /* Don't save name */
- }
- DBUG_RETURN(res);
-} /* my_setwd */
-
-
-
- /* Test if hard pathname */
- /* Returns 1 if dirname is a hard path */
-
-int test_if_hard_path(register const char *dir_name)
-{
- if (dir_name[0] == FN_HOMELIB && dir_name[1] == FN_LIBCHAR)
- return (home_dir != NullS && test_if_hard_path(home_dir));
- if (dir_name[0] == FN_LIBCHAR)
- return (TRUE);
-#ifdef FN_DEVCHAR
- return (strchr(dir_name,FN_DEVCHAR) != 0);
-#else
- return FALSE;
-#endif
-} /* test_if_hard_path */
diff --git a/ext/mysql/libmysql/my_init.c b/ext/mysql/libmysql/my_init.c
deleted file mode 100644
index 472721c952..0000000000
--- a/ext/mysql/libmysql/my_init.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include "my_static.h"
-#include "mysys_err.h"
-#include "m_ctype.h"
-#include <m_string.h>
-#include <m_ctype.h>
-#ifdef THREAD
-#include <my_pthread.h>
-#endif
-#ifdef HAVE_GETRUSAGE
-#include <sys/resource.h>
-/* extern int getrusage(int, struct rusage *); */
-#endif
-#include <signal.h>
-#ifdef VMS
-#include <my_static.c>
-#include <m_ctype.h>
-#endif
-#ifdef __WIN__
-#ifdef _MSC_VER
-#include <locale.h>
-#include <crtdbg.h>
-#endif
-my_bool have_tcpip=0;
-static void my_win_init(void);
-static my_bool win32_have_tcpip(void);
-static my_bool win32_init_tcp_ip();
-#else
-#define my_win_init()
-#endif
-static my_bool my_init_done=0;
-
-
-
-static ulong atoi_octal(const char *str)
-{
- long int tmp;
- while (*str && isspace(*str))
- str++;
- str2int(str,
- (*str == '0' ? 8 : 10), /* Octalt or decimalt */
- 0, INT_MAX, &tmp);
- return (ulong) tmp;
-}
-
-
- /* Init my_sys functions and my_sys variabels */
-
-void my_init(void)
-{
- my_string str;
- if (my_init_done)
- return;
- my_init_done=1;
-#ifdef THREAD
-#if defined(HAVE_PTHREAD_INIT)
- pthread_init(); /* Must be called before DBUG_ENTER */
-#endif
- my_thread_global_init();
-#if !defined( __WIN__) && !defined(OS2)
- sigfillset(&my_signals); /* signals blocked by mf_brkhant */
-#endif
-#endif /* THREAD */
-#ifdef UNIXWARE_7
- (void) isatty(0); /* Go around connect() bug in UW7 */
-#endif
- {
- DBUG_ENTER("my_init");
- DBUG_PROCESS(my_progname ? my_progname : (char*) "unknown");
- if (!home_dir)
- { /* Don't initialize twice */
- my_win_init();
- if ((home_dir=getenv("HOME")) != 0)
- home_dir=intern_filename(home_dir_buff,home_dir);
-#ifndef VMS
- /* Default creation of new files */
- if ((str=getenv("UMASK")) != 0)
- my_umask=(int) (atoi_octal(str) | 0600);
- /* Default creation of new dir's */
- if ((str=getenv("UMASK_DIR")) != 0)
- my_umask_dir=(int) (atoi_octal(str) | 0700);
-#endif
-#ifdef VMS
- init_ctype(); /* Stupid linker don't link _ctype.c */
-#endif
- DBUG_PRINT("exit",("home: '%s'",home_dir));
- }
-#ifdef __WIN__
- win32_init_tcp_ip();
-#endif
- DBUG_VOID_RETURN;
- }
-} /* my_init */
-
-
- /* End my_sys */
-
-void my_end(int infoflag)
-{
- FILE *info_file;
- if (!(info_file=DBUG_FILE))
- info_file=stderr;
- if (infoflag & MY_CHECK_ERROR || info_file != stderr)
- { /* Test if some file is left open */
- if (my_file_opened | my_stream_opened)
- {
- sprintf(errbuff[0],EE(EE_OPEN_WARNING),my_file_opened,my_stream_opened);
- (void) my_message_no_curses(EE_OPEN_WARNING,errbuff[0],ME_BELL);
- DBUG_PRINT("error",("%s",errbuff[0]));
- }
- }
- free_charsets();
- if (infoflag & MY_GIVE_INFO || info_file != stderr)
- {
-#ifdef HAVE_GETRUSAGE
- struct rusage rus;
- if (!getrusage(RUSAGE_SELF, &rus))
- fprintf(info_file,"\n\
-User time %.2f, System time %.2f\n\
-Maximum resident set size %ld, Integral resident set size %ld\n\
-Non-physical pagefaults %ld, Physical pagefaults %ld, Swaps %ld\n\
-Blocks in %ld out %ld, Messages in %ld out %ld, Signals %ld\n\
-Voluntary context switches %ld, Involuntary context switches %ld\n",
- (rus.ru_utime.tv_sec * SCALE_SEC +
- rus.ru_utime.tv_usec / SCALE_USEC) / 100.0,
- (rus.ru_stime.tv_sec * SCALE_SEC +
- rus.ru_stime.tv_usec / SCALE_USEC) / 100.0,
- rus.ru_maxrss, rus.ru_idrss,
- rus.ru_minflt, rus.ru_majflt,
- rus.ru_nswap, rus.ru_inblock, rus.ru_oublock,
- rus.ru_msgsnd, rus.ru_msgrcv, rus.ru_nsignals,
- rus.ru_nvcsw, rus.ru_nivcsw);
-#endif
-#if defined(MSDOS) && !defined(__WIN__)
- fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC);
-#endif
-#if defined(SAFEMALLOC)
- TERMINATE(stderr); /* Give statistic on screen */
-#elif defined(__WIN__) && defined(_MSC_VER)
- _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
- _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR );
- _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
- _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDERR );
- _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
- _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
- _CrtCheckMemory();
- _CrtDumpMemoryLeaks();
-#endif
- }
-#ifdef THREAD
- pthread_mutex_destroy(&THR_LOCK_keycache);
- pthread_mutex_destroy(&THR_LOCK_malloc);
- pthread_mutex_destroy(&THR_LOCK_open);
- DBUG_POP(); /* Must be done before my_thread_end */
- my_thread_end();
- my_thread_global_end();
-#endif
-#ifdef __WIN__
- if (have_tcpip);
- WSACleanup( );
-#endif /* __WIN__ */
- my_init_done=0;
-} /* my_end */
-
-#ifdef __WIN__
-
-/*
- This code is specially for running MySQL, but it should work in
- other cases too.
-
- Inizializzazione delle variabili d'ambiente per Win a 32 bit.
-
- Vengono inserite nelle variabili d'ambiente (utilizzando cosi'
- le funzioni getenv e putenv) i valori presenti nelle chiavi
- del file di registro:
-
- HKEY_LOCAL_MACHINE\software\MySQL
-
- Se la kiave non esiste nonn inserisce nessun valore
-*/
-
-/* Crea la stringa d'ambiente */
-
-void setEnvString(char *ret, const char *name, const char *value)
-{
- DBUG_ENTER("setEnvString");
- strxmov(ret, name,"=",value,NullS);
- DBUG_VOID_RETURN ;
-}
-
-static void my_win_init(void)
-{
- HKEY hSoftMysql ;
- DWORD dimName = 256 ;
- DWORD dimData = 1024 ;
- DWORD dimNameValueBuffer = 256 ;
- DWORD dimDataValueBuffer = 1024 ;
- DWORD indexValue = 0 ;
- long retCodeEnumValue ;
- char NameValueBuffer[256] ;
- char DataValueBuffer[1024] ;
- char EnvString[1271] ;
- const char *targetKey = "Software\\MySQL" ;
- DBUG_ENTER("my_win_init");
-
- setlocale(LC_CTYPE, ""); /* To get right sortorder */
-
- /* apre la chiave HKEY_LOCAL_MACHINES\software\MySQL */
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,(LPCTSTR)targetKey,0,
- KEY_READ,&hSoftMysql) != ERROR_SUCCESS)
- DBUG_VOID_RETURN;
-
- /*
- ** Ne legge i valori e li inserisce nell'ambiente
- ** suppone che tutti i valori letti siano di tipo stringa + '\0'
- ** Legge il valore con indice 0 e lo scarta
- */
- retCodeEnumValue = RegEnumValue(hSoftMysql, indexValue++,
- (LPTSTR)NameValueBuffer, &dimNameValueBuffer,
- NULL, NULL, (LPBYTE)DataValueBuffer,
- &dimDataValueBuffer) ;
-
- while (retCodeEnumValue != ERROR_NO_MORE_ITEMS)
- {
- char *my_env;
- /* Crea la stringa d'ambiente */
- setEnvString(EnvString, NameValueBuffer, DataValueBuffer) ;
-
- /* Inserisce i dati come variabili d'ambiente */
- my_env=strdup(EnvString); /* variable for putenv must be allocated ! */
- putenv(EnvString) ;
-
- dimNameValueBuffer = dimName ;
- dimDataValueBuffer = dimData ;
-
- retCodeEnumValue = RegEnumValue(hSoftMysql, indexValue++,
- NameValueBuffer, &dimNameValueBuffer,
- NULL, NULL, (LPBYTE)DataValueBuffer,
- &dimDataValueBuffer) ;
- }
-
- /* chiude la chiave */
- RegCloseKey(hSoftMysql) ;
- DBUG_VOID_RETURN ;
-}
-
-
-/*------------------------------------------------------------------
-** Name: CheckForTcpip| Desc: checks if tcpip has been installed on system
-** According to Microsoft Developers documentation the first registry
-** entry should be enough to check if TCP/IP is installed, but as expected
-** this doesn't work on all Win32 machines :(
-------------------------------------------------------------------*/
-
-#define TCPIPKEY "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
-#define WINSOCK2KEY "SYSTEM\\CurrentControlSet\\Services\\Winsock2\\Parameters"
-#define WINSOCKKEY "SYSTEM\\CurrentControlSet\\Services\\Winsock\\Parameters"
-
-static my_bool win32_have_tcpip(void)
-{
- HKEY hTcpipRegKey;
- if (RegOpenKeyEx ( HKEY_LOCAL_MACHINE, TCPIPKEY, 0, KEY_READ,
- &hTcpipRegKey) != ERROR_SUCCESS)
- {
- if (RegOpenKeyEx ( HKEY_LOCAL_MACHINE, WINSOCK2KEY, 0, KEY_READ,
- &hTcpipRegKey) != ERROR_SUCCESS)
- {
- if (RegOpenKeyEx ( HKEY_LOCAL_MACHINE, WINSOCKKEY, 0, KEY_READ,
- &hTcpipRegKey) != ERROR_SUCCESS)
- if (!getenv("HAVE_TCPIP") || have_tcpip) /* Provide a workaround */
- return (FALSE);
- }
- }
- RegCloseKey ( hTcpipRegKey);
- return (TRUE);
-}
-
-static my_bool win32_init_tcp_ip()
-{
- if (win32_have_tcpip())
- {
- WORD wVersionRequested = MAKEWORD( 2, 0 );
- WSADATA wsaData;
- /* Be a good citizen: maybe another lib has already initialised
- sockets, so dont clobber them unless necessary */
- if (WSAStartup( wVersionRequested, &wsaData ))
- {
- /* Load failed, maybe because of previously loaded
- incompatible version; try again */
- WSACleanup( );
- if (!WSAStartup( wVersionRequested, &wsaData ))
- have_tcpip=1;
- }
- else
- {
- if (wsaData.wVersion != wVersionRequested)
- {
- /* Version is no good, try again */
- WSACleanup( );
- if (!WSAStartup( wVersionRequested, &wsaData ))
- have_tcpip=1;
- }
- else
- have_tcpip=1;
- }
- }
- return(0);
-}
-#endif
diff --git a/ext/mysql/libmysql/my_lib.c b/ext/mysql/libmysql/my_lib.c
deleted file mode 100644
index 259a7222b4..0000000000
--- a/ext/mysql/libmysql/my_lib.c
+++ /dev/null
@@ -1,600 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* TODO: check for overun of memory for names. */
-/* Convert MSDOS-TIME to standar time_t */
-
-#define USES_TYPES /* sys/types is included */
-#include "mysys_priv.h"
-#include <m_string.h>
-#include <my_dir.h> /* Structs used by my_dir,includes sys/types */
-#include "mysys_err.h"
-#if defined(HAVE_DIRENT_H)
-# include <dirent.h>
-# define NAMLEN(dirent) strlen((dirent)->d_name)
-#else
-#ifndef OS2
-# define dirent direct
-#endif
-# define NAMLEN(dirent) (dirent)->d_namlen
-# if defined(HAVE_SYS_NDIR_H)
-# include <sys/ndir.h>
-# endif
-# if defined(HAVE_SYS_DIR_H)
-# include <sys/dir.h>
-# endif
-# if defined(HAVE_NDIR_H)
-# include <ndir.h>
-# endif
-# if defined(MSDOS) || defined(__WIN__)
-# include <dos.h>
-# ifdef __BORLANDC__
-# include <dir.h>
-# endif
-# endif
-#endif
-#ifdef VMS
-#include <rms.h>
-#include <iodef.h>
-#include <descrip.h>
-#endif
-
-#ifdef OS2
-#include "my_os2dirsrch.h"
-#endif
-
-#if defined(THREAD) && defined(HAVE_READDIR_R)
-#define READDIR(A,B,C) ((errno=readdir_r(A,B,&C)) != 0 || !C)
-#else
-#define READDIR(A,B,C) (!(C=readdir(A)))
-#endif
-
-
-#define STARTSIZE ONCE_ALLOC_INIT*8 /* some mallocmargin */
-
-static int comp_names(struct fileinfo *a,struct fileinfo *b);
-
-
- /* We need this because program don't know with malloc we used */
-
-void my_dirend(MY_DIR *buffer)
-{
- DBUG_ENTER("my_dirend");
- if (buffer)
- my_free((gptr) buffer,MYF(0));
- DBUG_VOID_RETURN;
-} /* my_dirend */
-
-
- /* Compare in sort of filenames */
-
-static int comp_names(struct fileinfo *a, struct fileinfo *b)
-{
- return (strcmp(a->name,b->name));
-} /* comp_names */
-
-
-#if !defined(MSDOS) && !defined(__WIN__)
-
-MY_DIR *my_dir(const char *path, myf MyFlags)
-{
- DIR *dirp;
- struct dirent *dp;
- struct fileinfo *fnames;
- char *buffer, *obuffer, *tempptr;
- uint fcnt,i,size,firstfcnt, maxfcnt,length;
- char tmp_path[FN_REFLEN+1],*tmp_file;
- my_ptrdiff_t diff;
- bool eof;
-#ifdef THREAD
- char dirent_tmp[sizeof(struct dirent)+_POSIX_PATH_MAX+1];
-#endif
- DBUG_ENTER("my_dir");
- DBUG_PRINT("my",("path: '%s' stat: %d MyFlags: %d",path,MyFlags));
-
-#if defined(THREAD) && !defined(HAVE_READDIR_R)
- pthread_mutex_lock(&THR_LOCK_open);
-#endif
-
- dirp = opendir(directory_file_name(tmp_path,(my_string) path));
- size = STARTSIZE;
- if (dirp == NULL || ! (buffer = (char *) my_malloc(size, MyFlags)))
- goto error;
-
- fcnt = 0;
- tmp_file=strend(tmp_path);
- firstfcnt = maxfcnt = (size - sizeof(MY_DIR)) /
- (sizeof(struct fileinfo) + FN_LEN);
- fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
- tempptr = (char *) (fnames + maxfcnt);
-
-#ifdef THREAD
- dp= (struct dirent*) dirent_tmp;
-#else
- dp=0;
-#endif
- eof=0;
- for (;;)
- {
- while (fcnt < maxfcnt &&
- !(eof= READDIR(dirp,(struct dirent*) dirent_tmp,dp)))
- {
- bzero((gptr) (fnames+fcnt),sizeof(fnames[0])); /* for purify */
- fnames[fcnt].name = tempptr;
- tempptr = strmov(tempptr,dp->d_name) + 1;
- if (MyFlags & MY_WANT_STAT)
- {
- VOID(strmov(tmp_file,dp->d_name));
- VOID(my_stat(tmp_path, &fnames[fcnt].mystat, MyFlags));
- }
- ++fcnt;
- }
- if (eof)
- break;
- size += STARTSIZE; obuffer = buffer;
- if (!(buffer = (char *) my_realloc((gptr) buffer, size,
- MyFlags | MY_FREE_ON_ERROR)))
- goto error; /* No memory */
- length= (uint) (sizeof(struct fileinfo ) * firstfcnt);
- diff= PTR_BYTE_DIFF(buffer , obuffer) + (int) length;
- fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
- tempptr= ADD_TO_PTR(tempptr,diff,char*);
- for (i = 0; i < maxfcnt; i++)
- fnames[i].name = ADD_TO_PTR(fnames[i].name,diff,char*);
-
- /* move filenames upp a bit */
- maxfcnt += firstfcnt;
- bmove_upp(tempptr,tempptr-length,
- (uint) (tempptr- (char*) (fnames+maxfcnt)));
- }
-
- (void) closedir(dirp);
- {
- MY_DIR * s = (MY_DIR *) buffer;
- s->number_off_files = (uint) fcnt;
- s->dir_entry = fnames;
- }
- if (!(MyFlags & MY_DONT_SORT))
- qsort((void *) fnames, (size_s) fcnt, sizeof(struct fileinfo),
- (qsort_cmp) comp_names);
-#if defined(THREAD) && !defined(HAVE_READDIR_R)
- pthread_mutex_unlock(&THR_LOCK_open);
-#endif
- DBUG_RETURN((MY_DIR *) buffer);
-
- error:
-#if defined(THREAD) && !defined(HAVE_READDIR_R)
- pthread_mutex_unlock(&THR_LOCK_open);
-#endif
- my_errno=errno;
- if (dirp)
- (void) closedir(dirp);
- if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,my_errno);
- DBUG_RETURN((MY_DIR *) NULL);
-} /* my_dir */
-
-
-/*
- * Convert from directory name to filename.
- * On VMS:
- * xyzzy:[mukesh.emacs] => xyzzy:[mukesh]emacs.dir.1
- * xyzzy:[mukesh] => xyzzy:[000000]mukesh.dir.1
- * On UNIX, it's simple: just make sure there is a terminating /
-
- * Returns pointer to dst;
- */
-
-my_string directory_file_name (my_string dst, const char *src)
-{
-#ifndef VMS
-
- /* Process as Unix format: just remove test the final slash. */
-
- my_string end;
-
- if (src[0] == 0)
- src= (char*) "."; /* Use empty as current */
- end=strmov(dst, src);
- if (end[-1] != FN_LIBCHAR)
- {
- end[0]=FN_LIBCHAR; /* Add last '/' */
- end[1]='\0';
- }
- return dst;
-
-#else /* VMS */
-
- long slen;
- long rlen;
- my_string ptr, rptr;
- char bracket;
- struct FAB fab = cc$rms_fab;
- struct NAM nam = cc$rms_nam;
- char esa[NAM$C_MAXRSS];
-
- if (! src[0])
- src="[.]"; /* Empty is == current dir */
-
- slen = strlen (src) - 1;
- if (src[slen] == FN_C_AFTER_DIR || src[slen] == FN_C_AFTER_DIR_2 ||
- src[slen] == FN_DEVCHAR)
- {
- /* VMS style - convert [x.y.z] to [x.y]z, [x] to [000000]x */
- fab.fab$l_fna = src;
- fab.fab$b_fns = slen + 1;
- fab.fab$l_nam = &nam;
- fab.fab$l_fop = FAB$M_NAM;
-
- nam.nam$l_esa = esa;
- nam.nam$b_ess = sizeof esa;
- nam.nam$b_nop |= NAM$M_SYNCHK;
-
- /* We call SYS$PARSE to handle such things as [--] for us. */
- if (SYS$PARSE(&fab, 0, 0) == RMS$_NORMAL)
- {
- slen = nam.nam$b_esl - 1;
- if (esa[slen] == ';' && esa[slen - 1] == '.')
- slen -= 2;
- esa[slen + 1] = '\0';
- src = esa;
- }
- if (src[slen] != FN_C_AFTER_DIR && src[slen] != FN_C_AFTER_DIR_2)
- {
- /* what about when we have logical_name:???? */
- if (src[slen] == FN_DEVCHAR)
- { /* Xlate logical name and see what we get */
- VOID(strmov(dst,src));
- dst[slen] = 0; /* remove colon */
- if (!(src = getenv (dst)))
- return dst; /* Can't translate */
-
- /* should we jump to the beginning of this procedure?
- Good points: allows us to use logical names that xlate
- to Unix names,
- Bad points: can be a problem if we just translated to a device
- name...
- For now, I'll punt and always expect VMS names, and hope for
- the best! */
-
- slen = strlen (src) - 1;
- if (src[slen] != FN_C_AFTER_DIR && src[slen] != FN_C_AFTER_DIR_2)
- { /* no recursion here! */
- VOID(strmov(dst, src));
- return(dst);
- }
- }
- else
- { /* not a directory spec */
- VOID(strmov(dst, src));
- return(dst);
- }
- }
-
- bracket = src[slen]; /* End char */
- if (!(ptr = strchr (src, bracket - 2)))
- { /* no opening bracket */
- VOID(strmov (dst, src));
- return dst;
- }
- if (!(rptr = strrchr (src, '.')))
- rptr = ptr;
- slen = rptr - src;
- VOID(strmake (dst, src, slen));
-
- if (*rptr == '.')
- { /* Put bracket and add */
- dst[slen++] = bracket; /* (rptr+1) after this */
- }
- else
- {
- /* If we have the top-level of a rooted directory (i.e. xx:[000000]),
- then translate the device and recurse. */
-
- if (dst[slen - 1] == ':'
- && dst[slen - 2] != ':' /* skip decnet nodes */
- && strcmp(src + slen, "[000000]") == 0)
- {
- dst[slen - 1] = '\0';
- if ((ptr = getenv (dst))
- && (rlen = strlen (ptr) - 1) > 0
- && (ptr[rlen] == FN_C_AFTER_DIR || ptr[rlen] == FN_C_AFTER_DIR_2)
- && ptr[rlen - 1] == '.')
- {
- VOID(strmov(esa,ptr));
- esa[rlen - 1] = FN_C_AFTER_DIR;
- esa[rlen] = '\0';
- return (directory_file_name (dst, esa));
- }
- else
- dst[slen - 1] = ':';
- }
- VOID(strmov(dst+slen,"[000000]"));
- slen += 8;
- }
- VOID(strmov(strmov(dst+slen,rptr+1)-1,".DIR.1"));
- return dst;
- }
- VOID(strmov(dst, src));
- if (dst[slen] == '/' && slen > 1)
- dst[slen] = 0;
- return dst;
-#endif /* VMS */
-} /* directory_file_name */
-
-#elif defined(WIN32)
-
-/*
-*****************************************************************************
-** Read long filename using windows rutines
-*****************************************************************************
-*/
-
-MY_DIR *my_dir(const char *path, myf MyFlags)
-{
- struct fileinfo *fnames;
- char *buffer, *obuffer, *tempptr;
- int eof,i,fcnt,firstfcnt,length,maxfcnt;
- uint size;
-#ifdef __BORLANDC__
- struct ffblk find;
-#else
- struct _finddata_t find;
-#endif
- ushort mode;
- char tmp_path[FN_REFLEN],*tmp_file,attrib;
- my_ptrdiff_t diff;
-#ifdef _WIN64
- __int64 handle;
-#else
- long handle;
-#endif
- DBUG_ENTER("my_dir");
- DBUG_PRINT("my",("path: '%s' stat: %d MyFlags: %d",path,MyFlags));
-
- /* Put LIB-CHAR as last path-character if not there */
-
- tmp_file=tmp_path;
- if (!*path)
- *tmp_file++ ='.'; /* From current dir */
- tmp_file= strmov(tmp_file,path);
- if (tmp_file[-1] == FN_DEVCHAR)
- *tmp_file++= '.'; /* From current dev-dir */
- if (tmp_file[-1] != FN_LIBCHAR)
- *tmp_file++ =FN_LIBCHAR;
- tmp_file[0]='*'; /* MSDOS needs this !??? */
- tmp_file[1]='.';
- tmp_file[2]='*';
- tmp_file[3]='\0';
-
-#ifdef __BORLANDC__
- if ((handle= findfirst(tmp_path,&find,0)) == -1L)
- goto error;
-#else
- if ((handle=_findfirst(tmp_path,&find)) == -1L)
- goto error;
-#endif
-
- size = STARTSIZE;
- firstfcnt = maxfcnt = (size - sizeof(MY_DIR)) /
- (sizeof(struct fileinfo) + FN_LEN);
- if ((buffer = (char *) my_malloc(size, MyFlags)) == 0)
- goto error;
- fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
- tempptr = (char *) (fnames + maxfcnt);
-
- fcnt = 0;
- for (;;)
- {
- do
- {
- fnames[fcnt].name = tempptr;
-#ifdef __BORLANDC__
- tempptr = strmov(tempptr,find.ff_name) + 1;
- fnames[fcnt].mystat.st_size=find.ff_fsize;
- fnames[fcnt].mystat.st_uid=fnames[fcnt].mystat.st_gid=0;
- mode=MY_S_IREAD; attrib=find.ff_attrib;
-#else
- tempptr = strmov(tempptr,find.name) + 1;
- fnames[fcnt].mystat.st_size=find.size;
- fnames[fcnt].mystat.st_uid=fnames[fcnt].mystat.st_gid=0;
- mode=MY_S_IREAD; attrib=find.attrib;
-#endif
- if (!(attrib & _A_RDONLY))
- mode|=MY_S_IWRITE;
- if (attrib & _A_SUBDIR)
- mode|=MY_S_IFDIR;
- fnames[fcnt].mystat.st_mode=mode;
-#ifdef __BORLANDC__
- fnames[fcnt].mystat.st_mtime=((uint32) find.ff_ftime);
-#else
- fnames[fcnt].mystat.st_mtime=((uint32) find.time_write);
-#endif
- ++fcnt;
-#ifdef __BORLANDC__
- } while ((eof= findnext(&find)) == 0 && fcnt < maxfcnt);
-#else
- } while ((eof= _findnext(handle,&find)) == 0 && fcnt < maxfcnt);
-#endif
-
- DBUG_PRINT("test",("eof: %d errno: %d",eof,errno));
- if (eof)
- break;
- size += STARTSIZE; obuffer = buffer;
- if (!(buffer = (char *) my_realloc((gptr) buffer, size,
- MyFlags | MY_FREE_ON_ERROR)))
- goto error;
- length= sizeof(struct fileinfo ) * firstfcnt;
- diff= PTR_BYTE_DIFF(buffer , obuffer) +length;
- fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
- tempptr= ADD_TO_PTR(tempptr,diff,char*);
- for (i = 0; i < maxfcnt; i++)
- fnames[i].name = ADD_TO_PTR(fnames[i].name,diff,char*);
-
- /* move filenames upp a bit */
- maxfcnt += firstfcnt;
- bmove_upp(tempptr,ADD_TO_PTR(tempptr,-length,char*),
- (int) PTR_BYTE_DIFF(tempptr,fnames+maxfcnt));
- }
- {
- MY_DIR * s = (MY_DIR *) buffer;
- s->number_off_files = (uint) fcnt;
- s->dir_entry = fnames;
- }
- if (!(MyFlags & MY_DONT_SORT))
- qsort(fnames,fcnt,sizeof(struct fileinfo),(qsort_cmp) comp_names);
-#ifndef __BORLANDC__
- _findclose(handle);
-#endif
- DBUG_RETURN((MY_DIR *) buffer);
-
-error:
- my_errno=errno;
-#ifndef __BORLANDC__
- if (handle != -1)
- _findclose(handle);
-#endif
- if (MyFlags & MY_FAE+MY_WME)
- my_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,errno);
- DBUG_RETURN((MY_DIR *) NULL);
-} /* my_dir */
-
-#else /* MSDOS and not WIN32 */
-
-
-/******************************************************************************
-** At MSDOS you always get stat of files, but time is in packed MSDOS-format
-******************************************************************************/
-
-MY_DIR *my_dir(const char* path, myf MyFlags)
-{
- struct fileinfo *fnames;
- char *buffer, *obuffer, *tempptr;
- int eof,i,fcnt,firstfcnt,length,maxfcnt;
- uint size;
- struct find_t find;
- ushort mode;
- char tmp_path[FN_REFLEN],*tmp_file,attrib;
- my_ptrdiff_t diff;
- DBUG_ENTER("my_dir");
- DBUG_PRINT("my",("path: '%s' stat: %d MyFlags: %d",path,MyFlags));
-
- /* Put LIB-CHAR as last path-character if not there */
-
- tmp_file=tmp_path;
- if (!*path)
- *tmp_file++ ='.'; /* From current dir */
- tmp_file= strmov(tmp_file,path);
- if (tmp_file[-1] == FN_DEVCHAR)
- *tmp_file++= '.'; /* From current dev-dir */
- if (tmp_file[-1] != FN_LIBCHAR)
- *tmp_file++ =FN_LIBCHAR;
- tmp_file[0]='*'; /* MSDOS needs this !??? */
- tmp_file[1]='.';
- tmp_file[2]='*';
- tmp_file[3]='\0';
-
- if (_dos_findfirst(tmp_path,_A_NORMAL | _A_SUBDIR, &find))
- goto error;
-
- size = STARTSIZE;
- firstfcnt = maxfcnt = (size - sizeof(MY_DIR)) /
- (sizeof(struct fileinfo) + FN_LEN);
- if ((buffer = (char *) my_malloc(size, MyFlags)) == 0)
- goto error;
- fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
- tempptr = (char *) (fnames + maxfcnt);
-
- fcnt = 0;
- for (;;)
- {
- do
- {
- fnames[fcnt].name = tempptr;
- tempptr = strmov(tempptr,find.name) + 1;
- fnames[fcnt].mystat.st_size=find.size;
- fnames[fcnt].mystat.st_uid=fnames[fcnt].mystat.st_gid=0;
- mode=MY_S_IREAD; attrib=find.attrib;
- if (!(attrib & _A_RDONLY))
- mode|=MY_S_IWRITE;
- if (attrib & _A_SUBDIR)
- mode|=MY_S_IFDIR;
- fnames[fcnt].mystat.st_mode=mode;
- fnames[fcnt].mystat.st_mtime=((uint32) find.wr_date << 16) +
- find.wr_time;
- ++fcnt;
- } while ((eof= _dos_findnext(&find)) == 0 && fcnt < maxfcnt);
-
- DBUG_PRINT("test",("eof: %d errno: %d",eof,errno));
- if (eof)
- break;
- size += STARTSIZE; obuffer = buffer;
- if (!(buffer = (char *) my_realloc((gptr) buffer, size,
- MyFlags | MY_FREE_ON_ERROR)))
- goto error;
- length= sizeof(struct fileinfo ) * firstfcnt;
- diff= PTR_BYTE_DIFF(buffer , obuffer) +length;
- fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
- tempptr= ADD_TO_PTR(tempptr,diff,char*);
- for (i = 0; i < maxfcnt; i++)
- fnames[i].name = ADD_TO_PTR(fnames[i].name,diff,char*);
-
- /* move filenames upp a bit */
- maxfcnt += firstfcnt;
- bmove_upp(tempptr,ADD_TO_PTR(tempptr,-length,char*),
- (int) PTR_BYTE_DIFF(tempptr,fnames+maxfcnt));
- }
- {
- MY_DIR * s = (MY_DIR *) buffer;
- s->number_off_files = (uint) fcnt;
- s->dir_entry = fnames;
- }
- if (!(MyFlags & MY_DONT_SORT))
- qsort(fnames,fcnt,sizeof(struct fileinfo),(qsort_cmp) comp_names);
- DBUG_RETURN((MY_DIR *) buffer);
-
-error:
- if (MyFlags & MY_FAE+MY_WME)
- my_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,errno);
- DBUG_RETURN((MY_DIR *) NULL);
-} /* my_dir */
-
-#endif /* WIN32 && MSDOS */
-
-/****************************************************************************
-** File status
-** Note that MY_STAT is assumed to be same as struct stat
-****************************************************************************/
-
-int my_fstat(int Filedes, MY_STAT *stat_area, myf MyFlags )
-{
- DBUG_ENTER("my_fstat");
- DBUG_PRINT("my",("fd: %d MyFlags: %d",Filedes,MyFlags));
- DBUG_RETURN(fstat(Filedes, (struct stat *) stat_area));
-}
-
-MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags)
-{
- int m_used;
- DBUG_ENTER("my_stat");
- DBUG_PRINT("my", ("path: '%s', stat_area: %lx, MyFlags: %d", path,
- (byte *) stat_area, my_flags));
-
- if ((m_used= (stat_area == NULL)))
- if (!(stat_area = (MY_STAT *) my_malloc(sizeof(MY_STAT), my_flags)))
- goto error;
- if ( ! stat((my_string) path, (struct stat *) stat_area) )
- DBUG_RETURN(stat_area);
- my_errno=errno;
- if (m_used) /* Free if new area */
- my_free((gptr) stat_area,MYF(0));
-
-error:
- if (my_flags & (MY_FAE+MY_WME))
- {
- my_error(EE_STAT, MYF(ME_BELL+ME_WAITTANG),path,my_errno);
- DBUG_RETURN((MY_STAT *) NULL);
- }
- DBUG_RETURN((MY_STAT *) NULL);
-} /* my_stat */
-
diff --git a/ext/mysql/libmysql/my_list.h b/ext/mysql/libmysql/my_list.h
deleted file mode 100644
index 46a6a8f65f..0000000000
--- a/ext/mysql/libmysql/my_list.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#ifndef _list_h_
-#define _list_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct st_list {
- struct st_list *prev,*next;
- void *data;
-} LIST;
-
-typedef int (*list_walk_action)(void *,void *);
-
-extern LIST *list_add(LIST *root,LIST *element);
-extern LIST *list_delete(LIST *root,LIST *element);
-extern LIST *list_cons(void *data,LIST *root);
-extern LIST *list_reverse(LIST *root);
-extern void list_free(LIST *root,pbool free_data);
-extern uint list_length(LIST *list);
-extern int list_walk(LIST *list,list_walk_action action,gptr argument);
-
-#define rest(a) ((a)->next)
-#define list_push(a,b) (a)=list_cons((b),(a))
-#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((gptr) old,MYF(MY_FAE)); }
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/ext/mysql/libmysql/my_malloc.c b/ext/mysql/libmysql/my_malloc.c
deleted file mode 100644
index cb006e31e4..0000000000
--- a/ext/mysql/libmysql/my_malloc.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */
-#undef SAFEMALLOC
-#endif
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-#include <m_string.h>
-
- /* My memory allocator */
-
-gptr my_malloc(unsigned int Size, myf MyFlags)
-{
- gptr point;
- DBUG_ENTER("my_malloc");
- DBUG_PRINT("my",("Size: %u MyFlags: %d",Size, MyFlags));
-
- if (!Size)
- Size=1; /* Safety */
- if ((point = (char*)malloc(Size)) == NULL)
- {
- my_errno=errno;
- if (MyFlags & MY_FAE)
- error_handler_hook=fatal_error_handler_hook;
- if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),Size);
- if (MyFlags & MY_FAE)
- exit(1);
- }
- else if (MyFlags & MY_ZEROFILL)
- bzero(point,Size);
- DBUG_PRINT("exit",("ptr: %lx",point));
- DBUG_RETURN(point);
-} /* my_malloc */
-
-
- /* Free memory allocated with my_malloc */
- /*ARGSUSED*/
-
-void my_no_flags_free(gptr ptr)
-{
- DBUG_ENTER("my_free");
- DBUG_PRINT("my",("ptr: %lx",ptr));
- if (ptr)
- free(ptr);
- DBUG_VOID_RETURN;
-} /* my_free */
-
-
- /* malloc and copy */
-
-gptr my_memdup(const byte *from, uint length, myf MyFlags)
-{
- gptr ptr;
- if ((ptr=my_malloc(length,MyFlags)) != 0)
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
- return(ptr);
-}
-
-
-my_string my_strdup(const char *from, myf MyFlags)
-{
- gptr ptr;
- uint length=(uint) strlen(from)+1;
- if ((ptr=my_malloc(length,MyFlags)) != 0)
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
- return((my_string) ptr);
-}
diff --git a/ext/mysql/libmysql/my_messnc.c b/ext/mysql/libmysql/my_messnc.c
deleted file mode 100644
index 48ed852f39..0000000000
--- a/ext/mysql/libmysql/my_messnc.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-
-int my_message_no_curses(uint error __attribute__((unused)),
- const char *str, myf MyFlags)
-{
- DBUG_ENTER("my_message_no_curses");
- DBUG_PRINT("enter",("message: %s",str));
- (void) fflush(stdout);
- if (MyFlags & ME_BELL)
- (void) fputc('\007',stderr); /* Bell */
- if (my_progname)
- {
- (void)fputs(my_progname,stderr); (void)fputs(": ",stderr);
- }
- (void)fputs(str,stderr);
- (void)fputc('\n',stderr);
- (void)fflush(stderr);
- DBUG_RETURN(0);
-}
diff --git a/ext/mysql/libmysql/my_net.c b/ext/mysql/libmysql/my_net.c
deleted file mode 100644
index 6fad295a22..0000000000
--- a/ext/mysql/libmysql/my_net.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* thread safe version of some common functions */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
-/* for thread safe my_inet_ntoa */
-#if !defined(MSDOS) && !defined(__WIN__)
-#include <netdb.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif /* !defined(MSDOS) && !defined(__WIN__) */
-
-#ifndef THREAD
-#define pthread_mutex_lock(A)
-#define pthread_mutex_unlock(A)
-#endif
-
-void my_inet_ntoa(struct in_addr in, char *buf)
-{
- char *ptr;
- pthread_mutex_lock(&THR_LOCK_net);
- ptr=inet_ntoa(in);
- strmov(buf,ptr);
- pthread_mutex_unlock(&THR_LOCK_net);
-}
diff --git a/ext/mysql/libmysql/my_net.h b/ext/mysql/libmysql/my_net.h
deleted file mode 100644
index 4633f3dfbd..0000000000
--- a/ext/mysql/libmysql/my_net.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* thread safe version of some common functions */
-
-/* for thread safe my_inet_ntoa */
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#if !defined(MSDOS) && !defined(__WIN__) && !defined(__BEOS__)
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif /* !defined(MSDOS) && !defined(__WIN__) */
-
-void my_inet_ntoa(struct in_addr in, char *buf);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/ext/mysql/libmysql/my_once.c b/ext/mysql/libmysql/my_once.c
deleted file mode 100644
index 99aad4d4e7..0000000000
--- a/ext/mysql/libmysql/my_once.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Not MT-SAFE */
-
-#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */
-#undef SAFEMALLOC
-#endif
-
-#include "mysys_priv.h"
-#include "my_static.h"
-#include "mysys_err.h"
-
- /* alloc for things we don't nead to free */
- /* No DBUG_ENTER... here to get smaller dbug-startup */
-
-gptr my_once_alloc(unsigned int Size, myf MyFlags)
-{
- uint get_size,max_left;
- gptr point;
- reg1 USED_MEM *next;
- reg2 USED_MEM **prev;
-
- Size= ALIGN_SIZE(Size);
- prev= &my_once_root_block;
- max_left=0;
- for (next=my_once_root_block ; next && next->left < Size ; next= next->next)
- {
- if (next->left > max_left)
- max_left=next->left;
- prev= &next->next;
- }
- if (! next)
- { /* Time to alloc new block */
- get_size= Size+ALIGN_SIZE(sizeof(USED_MEM));
- if (max_left*4 < my_once_extra && get_size < my_once_extra)
- get_size=my_once_extra; /* Normal alloc */
-
- if ((next = (USED_MEM*) malloc(get_size)) == 0)
- {
- my_errno=errno;
- if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),get_size);
- return((gptr) 0);
- }
- DBUG_PRINT("test",("my_once_malloc %u byte malloced",get_size));
- next->next= 0;
- next->size= get_size;
- next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM));
- *prev=next;
- }
- point= (gptr) ((char*) next+ (next->size-next->left));
- next->left-= Size;
-
- return(point);
-} /* my_once_alloc */
-
-
- /* deallocate everything used by my_once_alloc */
-
-void my_once_free(void)
-{
- reg1 USED_MEM *next,*old;
- DBUG_ENTER("my_once_free");
-
- for (next=my_once_root_block ; next ; )
- {
- old=next; next= next->next ;
- free((gptr) old);
- }
- my_once_root_block=0;
-
- DBUG_VOID_RETURN;
-} /* my_once_free */
diff --git a/ext/mysql/libmysql/my_open.c b/ext/mysql/libmysql/my_open.c
deleted file mode 100644
index 901f0122c8..0000000000
--- a/ext/mysql/libmysql/my_open.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#define USES_TYPES
-#include "mysys_priv.h"
-#include "mysys_err.h"
-#include <my_dir.h>
-#include <errno.h>
-#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
-#include <share.h>
-#endif
-
- /* Open a file */
-
-File my_open(const char *FileName, int Flags, myf MyFlags)
- /* Path-name of file */
- /* Read | write .. */
- /* Special flags */
-{
- File fd;
- DBUG_ENTER("my_open");
- DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d",
- FileName, Flags, MyFlags));
-#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
- if (Flags & O_SHARE)
- fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO,
- MY_S_IREAD | MY_S_IWRITE);
- else
- fd = open((my_string) FileName, Flags | O_BINARY,
- MY_S_IREAD | MY_S_IWRITE);
-#elif !defined(NO_OPEN_3)
- fd = open(FileName, Flags, my_umask); /* Normal unix */
-#else
- fd = open((my_string) FileName, Flags);
-#endif
- DBUG_RETURN(my_register_filename(fd, FileName, FILE_BY_OPEN,
- EE_FILENOTFOUND, MyFlags));
-} /* my_open */
-
-
- /* Close a file */
-
-int my_close(File fd, myf MyFlags)
-{
- int err;
- DBUG_ENTER("my_close");
- DBUG_PRINT("my",("fd: %d MyFlags: %d",fd, MyFlags));
-
- pthread_mutex_lock(&THR_LOCK_open);
- if ((err = close(fd)))
- {
- DBUG_PRINT("error",("Got error %d on close",err));
- my_errno=errno;
- if (MyFlags & (MY_FAE | MY_WME))
- my_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG),my_filename(fd),errno);
- }
- if ((uint) fd < MY_NFILE && my_file_info[fd].type != UNOPEN)
- {
- my_free(my_file_info[fd].name, MYF(0));
-#if defined(THREAD) && !defined(HAVE_PREAD)
- pthread_mutex_destroy(&my_file_info[fd].mutex);
-#endif
- my_file_info[fd].type = UNOPEN;
- }
- my_file_opened--;
- pthread_mutex_unlock(&THR_LOCK_open);
- DBUG_RETURN(err);
-} /* my_close */
-
-
-File my_register_filename(File fd, const char *FileName, enum file_type
- type_of_file, uint error_message_number, myf MyFlags)
-{
- if ((int) fd >= 0)
- {
- if ((int) fd >= MY_NFILE)
- {
-#if defined(THREAD) && !defined(HAVE_PREAD)
- (void) my_close(fd,MyFlags);
- my_errno=EMFILE;
- if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
- my_error(EE_OUT_OF_FILERESOURCES, MYF(ME_BELL+ME_WAITTANG),
- FileName, my_errno);
- return(-1);
-#endif
- thread_safe_increment(my_file_opened,&THR_LOCK_open);
- return(fd); /* safeguard */
- }
- pthread_mutex_lock(&THR_LOCK_open);
- if ((my_file_info[fd].name = (char*) my_strdup(FileName,MyFlags)))
- {
- my_file_opened++;
- my_file_info[fd].type = type_of_file;
-#if defined(THREAD) && !defined(HAVE_PREAD)
- pthread_mutex_init(&my_file_info[fd].mutex,MY_MUTEX_INIT_FAST);
-#endif
- pthread_mutex_unlock(&THR_LOCK_open);
- DBUG_PRINT("exit",("fd: %d",fd));
- return(fd);
- }
- pthread_mutex_unlock(&THR_LOCK_open);
- (void) my_close(fd, MyFlags);
- my_errno=ENOMEM;
- }
- else
- my_errno=errno;
- DBUG_PRINT("error",("Got error %d on open",my_errno));
- if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
- my_error(error_message_number, MYF(ME_BELL+ME_WAITTANG),
- FileName, my_errno);
- return(fd);
-}
diff --git a/ext/mysql/libmysql/my_pthread.c b/ext/mysql/libmysql/my_pthread.c
deleted file mode 100644
index d1f580071b..0000000000
--- a/ext/mysql/libmysql/my_pthread.c
+++ /dev/null
@@ -1,462 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Functions to get threads more portable */
-
-#include "mysys_priv.h"
-#ifdef THREAD
-#include <signal.h>
-#include <m_string.h>
-#include <thr_alarm.h>
-#include <assert.h>
-#if !defined(MSDOS) && !defined(__WIN__)
-#include <netdb.h>
-#endif
-
-#if (defined(__BSD__) || defined(_BSDI_VERSION)) && !defined(HAVE_mit_thread)
-#define SCHED_POLICY SCHED_RR
-#else
-#define SCHED_POLICY SCHED_OTHER
-#endif
-
-#ifndef my_pthread_setprio
-void my_pthread_setprio(pthread_t thread_id,int prior)
-{
-#ifdef HAVE_PTHREAD_SETSCHEDPARAM
- struct sched_param tmp_sched_param;
- bzero((char*) &tmp_sched_param,sizeof(tmp_sched_param));
- tmp_sched_param.sched_priority=prior;
- VOID(pthread_setschedparam(thread_id,SCHED_POLICY,&tmp_sched_param));
-#endif
-}
-#endif
-
-#ifndef my_pthread_getprio
-int my_pthread_getprio(pthread_t thread_id)
-{
-#ifdef HAVE_PTHREAD_SETSCHEDPARAM
- struct sched_param tmp_sched_param;
- int policy;
- if (!pthread_getschedparam(thread_id,&policy,&tmp_sched_param))
- {
- DBUG_PRINT("thread",("policy: %d priority: %d",
- policy,tmp_sched_param.sched_priority));
- return tmp_sched_param.sched_priority;
- }
-#endif
- return -1;
-}
-#endif
-
-#ifndef my_pthread_attr_setprio
-void my_pthread_attr_setprio(pthread_attr_t *attr, int priority)
-{
-#ifdef HAVE_PTHREAD_SETSCHEDPARAM
- struct sched_param tmp_sched_param;
- bzero((char*) &tmp_sched_param,sizeof(tmp_sched_param));
- tmp_sched_param.sched_priority=priority;
- VOID(pthread_attr_setschedparam(attr,&tmp_sched_param));
-#endif
-}
-#endif
-
-
-/* To allow use of pthread_getspecific with two arguments */
-
-#ifdef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC
-#undef pthread_getspecific
-#ifdef HAVE_UNIXWARE7_THREADS
-#define pthread_getspecific thr_getspecific
-#endif
-
-void *my_pthread_getspecific_imp(pthread_key_t key)
-{
- void *value;
- if (pthread_getspecific(key,(void *) &value))
- return 0;
- return value;
-}
-#endif
-
-
-/* Some functions for RTS threads, AIX, Siemens Unix and UnixWare 7
- (and DEC OSF/1 3.2 too) */
-
-int my_pthread_create_detached=1;
-
-#if defined(HAVE_NONPOSIX_SIGWAIT) || defined(HAVE_DEC_3_2_THREADS)
-
-int my_sigwait(const sigset_t *set,int *sig)
-{
- int signal=sigwait((sigset_t*) set);
- if (signal < 0)
- return errno;
- *sig=signal;
- return 0;
-}
-#endif
-
-/* localtime_r for SCO 3.2V4.2 */
-
-#ifndef HAVE_LOCALTIME_R
-
-extern pthread_mutex_t LOCK_localtime_r;
-
-struct tm *localtime_r(const time_t *clock, struct tm *res)
-{
- struct tm *tmp;
- pthread_mutex_lock(&LOCK_localtime_r);
- tmp=localtime(clock);
- *res= *tmp;
- pthread_mutex_unlock(&LOCK_localtime_r);
- return res;
-}
-#endif
-
-
-/****************************************************************************
-** Replacement of sigwait if the system doesn't have one (like BSDI 3.0)
-**
-** Note:
-** This version of sigwait() is assumed to called in a loop so the signalmask
-** is permanently modified to reflect the signal set. This is done to get
-** a much faster implementation.
-**
-** This implementation isn't thread safe: It assumes that only one
-** thread is using sigwait.
-**
-** If one later supplies a different signal mask, all old signals that
-** was used before are unblocked and set to SIGDFL.
-**
-** Author: Gary Wisniewski <garyw@spidereye.com.au>, much modified by Monty
-****************************************************************************/
-
-#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(OS2)
-
-#if !defined(DONT_USE_SIGSUSPEND)
-
-static sigset_t sigwait_set,rev_sigwait_set,px_recd;
-
-void px_handle_sig(int sig)
-{
- sigaddset(&px_recd, sig);
-}
-
-
-void sigwait_setup(sigset_t *set)
-{
- int i;
- struct sigaction sact,sact1;
- sigset_t unblock_mask;
-
- sact.sa_flags = 0;
- sact.sa_handler = px_handle_sig;
- memcpy_fixed(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */
- sigemptyset(&unblock_mask);
- pthread_sigmask(SIG_UNBLOCK,(sigset_t*) 0,&rev_sigwait_set);
-
- for (i = 1; i <= sizeof(sigwait_set)*8; i++)
- {
- if (sigismember(set,i))
- {
- sigdelset(&rev_sigwait_set,i);
- if (!sigismember(&sigwait_set,i))
- sigaction(i, &sact, (struct sigaction*) 0);
- }
- else
- {
- sigdelset(&px_recd,i); /* Don't handle this */
- if (sigismember(&sigwait_set,i))
- { /* Remove the old handler */
- sigaddset(&unblock_mask,i);
- sigdelset(&rev_sigwait_set,i);
- sact1.sa_flags = 0;
- sact1.sa_handler = SIG_DFL;
- sigemptyset(&sact1.sa_mask);
- sigaction(i, &sact1, 0);
- }
- }
- }
- memcpy_fixed(&sigwait_set,set,sizeof(*set));
- pthread_sigmask(SIG_BLOCK,(sigset_t*) set,(sigset_t*) 0);
- pthread_sigmask(SIG_UNBLOCK,&unblock_mask,(sigset_t*) 0);
-}
-
-
-int sigwait(sigset_t *setp, int *sigp)
-{
- if (memcmp(setp,&sigwait_set,sizeof(sigwait_set)))
- sigwait_setup(setp); /* Init or change of set */
-
- for (;;)
- {
- /*
- This is a fast, not 100% portable implementation to find the signal.
- Because the handler is blocked there should be at most 1 bit set, but
- the specification on this is somewhat shady so we use a set instead a
- single variable.
- */
-
- ulong *ptr= (ulong*) &px_recd;
- ulong *end=ptr+sizeof(px_recd)/sizeof(ulong);
-
- for ( ; ptr != end ; ptr++)
- {
- if (*ptr)
- {
- ulong set= *ptr;
- int found= (int) ((char*) ptr - (char*) &px_recd)*8+1;
- while (!(set & 1))
- {
- found++;
- set>>=1;
- }
- *sigp=found;
- sigdelset(&px_recd,found);
- return 0;
- }
- }
- sigsuspend(&rev_sigwait_set);
- }
- return 0;
-}
-#else /* !DONT_USE_SIGSUSPEND */
-
-/****************************************************************************
-** Replacement of sigwait if the system doesn't have one (like BSDI 3.0)
-**
-** Note:
-** This version of sigwait() is assumed to called in a loop so the signalmask
-** is permanently modified to reflect the signal set. This is done to get
-** a much faster implementation.
-**
-** This implementation uses a extra thread to handle the signals and one
-** must always call sigwait() with the same signal mask!
-**
-** BSDI 3.0 NOTE:
-**
-** pthread_kill() doesn't work on a thread in a select() or sleep() loop?
-** After adding the sleep to sigwait_thread, all signals are checked and
-** delivered every second. This isn't that terrible performance vice, but
-** someone should report this to BSDI and ask for a fix!
-** Another problem is that when the sleep() ends, every select() in other
-** threads are interrupted!
-****************************************************************************/
-
-static sigset_t pending_set;
-static bool inited=0;
-static pthread_cond_t COND_sigwait;
-static pthread_mutex_t LOCK_sigwait;
-
-
-void sigwait_handle_sig(int sig)
-{
- pthread_mutex_lock(&LOCK_sigwait);
- sigaddset(&pending_set, sig);
- VOID(pthread_cond_signal(&COND_sigwait)); /* inform sigwait() about signal */
- pthread_mutex_unlock(&LOCK_sigwait);
-}
-
-extern pthread_t alarm_thread;
-
-void *sigwait_thread(void *set_arg)
-{
- sigset_t *set=(sigset_t*) set_arg;
-
- int i;
- struct sigaction sact;
- sact.sa_flags = 0;
- sact.sa_handler = sigwait_handle_sig;
- memcpy_fixed(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */
- sigemptyset(&pending_set);
-
- for (i = 1; i <= sizeof(pending_set)*8; i++)
- {
- if (sigismember(set,i))
- {
- sigaction(i, &sact, (struct sigaction*) 0);
- }
- }
- sigaddset(set,THR_CLIENT_ALARM);
- pthread_sigmask(SIG_UNBLOCK,(sigset_t*) set,(sigset_t*) 0);
- alarm_thread=pthread_self(); /* For thr_alarm */
-
- for (;;)
- { /* Wait for signals */
-#ifdef HAVE_NOT_BROKEN_SELECT
- fd_set fd;
- FD_ZERO(&fd);
- select(0,&fd,0,0,0);
-#else
- sleep(1); /* Because of broken BSDI */
-#endif
- }
-}
-
-
-int sigwait(sigset_t *setp, int *sigp)
-{
- if (!inited)
- {
- pthread_attr_t thr_attr;
- pthread_t sigwait_thread_id;
- inited=1;
- sigemptyset(&pending_set);
- pthread_mutex_init(&LOCK_sigwait,MY_MUTEX_INIT_FAST);
- pthread_cond_init(&COND_sigwait,NULL);
-
- pthread_attr_init(&thr_attr);
- pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS);
- pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED);
- pthread_attr_setstacksize(&thr_attr,8196);
- my_pthread_attr_setprio(&thr_attr,100); /* Very high priority */
- VOID(pthread_create(&sigwait_thread_id,&thr_attr,sigwait_thread,setp));
- VOID(pthread_attr_destroy(&thr_attr));
- }
-
- pthread_mutex_lock(&LOCK_sigwait);
- for (;;)
- {
- ulong *ptr= (ulong*) &pending_set;
- ulong *end=ptr+sizeof(pending_set)/sizeof(ulong);
-
- for ( ; ptr != end ; ptr++)
- {
- if (*ptr)
- {
- ulong set= *ptr;
- int found= (int) ((char*) ptr - (char*) &pending_set)*8+1;
- while (!(set & 1))
- {
- found++;
- set>>=1;
- }
- *sigp=found;
- sigdelset(&pending_set,found);
- pthread_mutex_unlock(&LOCK_sigwait);
- return 0;
- }
- }
- VOID(pthread_cond_wait(&COND_sigwait,&LOCK_sigwait));
- }
- return 0;
-}
-
-#endif /* DONT_USE_SIGSUSPEND */
-#endif /* HAVE_SIGWAIT */
-
-/*****************************************************************************
-** Implement pthread_signal for systems that can't use signal() with threads
-** Currently this is only used with BSDI 3.0
-*****************************************************************************/
-
-#ifdef USE_PTHREAD_SIGNAL
-
-int pthread_signal(int sig, void (*func)())
-{
- struct sigaction sact;
- sact.sa_flags= 0;
- sact.sa_handler= func;
- sigemptyset(&sact.sa_mask);
- sigaction(sig, &sact, (struct sigaction*) 0);
- return 0;
-}
-
-#endif
-
-/*****************************************************************************
-** Patches for AIX and DEC OSF/1 3.2
-*****************************************************************************/
-
-#if (defined(HAVE_NONPOSIX_PTHREAD_MUTEX_INIT) && !defined(HAVE_UNIXWARE7_THREADS)) || defined(HAVE_DEC_3_2_THREADS)
-#undef pthread_mutex_init
-#undef pthread_cond_init
-
-#include <netdb.h>
-
-int my_pthread_mutex_init(pthread_mutex_t *mp, const pthread_mutexattr_t *attr)
-{
- int error;
- if (!attr)
- error=pthread_mutex_init(mp,pthread_mutexattr_default);
- else
- error=pthread_mutex_init(mp,*attr);
- return error;
-}
-
-int my_pthread_cond_init(pthread_cond_t *mp, const pthread_condattr_t *attr)
-{
- int error;
- if (!attr)
- error=pthread_cond_init(mp,pthread_condattr_default);
- else
- error=pthread_cond_init(mp,*attr);
- return error;
-}
-
-#endif
-
-/*
-** Emulate SOLARIS style calls, not because it's better, but just to make the
-** usage of getbostbyname_r simpler.
-*/
-
-#if !defined(my_gethostbyname_r) && defined(HAVE_GETHOSTBYNAME_R)
-
-#if defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
-
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop)
-{
- struct hostent *hp;
- dbug_assert((size_t) buflen >= sizeof(*result));
- if (gethostbyname_r(name,result, buffer, (size_t) buflen, &hp, h_errnop))
- return 0;
- return hp;
-}
-
-#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT)
-
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop)
-{
- dbug_assert(buflen >= sizeof(struct hostent_data));
- if (gethostbyname_r(name,result,(struct hostent_data *) buffer) == -1)
- {
- *h_errnop= errno;
- return 0;
- }
- return result;
-}
-
-#else
-
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop)
-{
- struct hostent *hp;
- dbug_assert(buflen >= sizeof(struct hostent_data));
- hp= gethostbyname_r(name,result,(struct hostent_data *) buffer);
- *h_errnop= errno;
- return hp;
-}
-
-#endif /* GLIBC2_STYLE_GETHOSTBYNAME_R */
-#endif
-
-
-/* Some help functions */
-
-int pthread_no_free(void *not_used __attribute__((unused)))
-{
- return 0;
-}
-
-int pthread_dummy(int ret)
-{
- return ret;
-}
-#endif /* THREAD */
diff --git a/ext/mysql/libmysql/my_pthread.h b/ext/mysql/libmysql/my_pthread.h
deleted file mode 100644
index 655ebbf703..0000000000
--- a/ext/mysql/libmysql/my_pthread.h
+++ /dev/null
@@ -1,613 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Defines to make different thread packages compatible */
-
-#ifndef _my_pthread_h
-#define _my_pthread_h
-
-#include <errno.h>
-#ifndef ETIME
-#define ETIME ETIMEDOUT /* For FreeBSD */
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#if defined(__WIN__) || defined(OS2)
-
-#ifdef OS2
-typedef ULONG HANDLE;
-typedef ULONG DWORD;
-typedef int sigset_t;
-#endif
-
-#ifdef OS2
-typedef HMTX pthread_mutex_t;
-#else
-typedef CRITICAL_SECTION pthread_mutex_t;
-#endif
-typedef HANDLE pthread_t;
-typedef struct thread_attr {
- DWORD dwStackSize ;
- DWORD dwCreatingFlag ;
- int priority ;
-} pthread_attr_t ;
-
-typedef struct { int dummy; } pthread_condattr_t;
-
-/* Implementation of posix conditions */
-
-typedef struct st_pthread_link {
- DWORD thread_id;
- struct st_pthread_link *next;
-} pthread_link;
-
-typedef struct {
- uint32 waiting;
-#ifdef OS2
- HEV semaphore;
-#else
- HANDLE semaphore;
-#endif
-} pthread_cond_t;
-
-
-#ifndef OS2
-struct timespec { /* For pthread_cond_timedwait() */
- time_t tv_sec;
- long tv_nsec;
-};
-#endif
-
-typedef int pthread_mutexattr_t;
-#define win_pthread_self my_thread_var->pthread_self
-#ifdef OS2
-#define pthread_handler_decl(A,B) void * _Optlink A(void *B)
-typedef void * (_Optlink *pthread_handler)(void *);
-#else
-#define pthread_handler_decl(A,B) void * __cdecl A(void *B)
-typedef void * (__cdecl *pthread_handler)(void *);
-#endif
-
-void win_pthread_init(void);
-int win_pthread_setspecific(void *A,void *B,uint length);
-int pthread_create(pthread_t *,pthread_attr_t *,pthread_handler,void *);
-int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr);
-int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
-int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
- struct timespec *abstime);
-int pthread_cond_signal(pthread_cond_t *cond);
-int pthread_cond_broadcast(pthread_cond_t *cond);
-int pthread_cond_destroy(pthread_cond_t *cond);
-int pthread_attr_init(pthread_attr_t *connect_att);
-int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack);
-int pthread_attr_setprio(pthread_attr_t *connect_att,int priority);
-int pthread_attr_destroy(pthread_attr_t *connect_att);
-struct tm *localtime_r(const time_t *timep,struct tm *tmp);
-
-void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
-
-#ifndef OS2
-#define ETIMEDOUT 145 /* Win32 doesn't have this */
-#define getpid() GetCurrentThreadId()
-#endif
-#define pthread_self() win_pthread_self
-#define HAVE_LOCALTIME_R 1
-#define _REENTRANT 1
-#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
-
-#ifdef USE_TLS /* For LIBMYSQL.DLL */
-#undef SAFE_MUTEX /* This will cause conflicts */
-#define pthread_key(T,V) DWORD V
-#define pthread_key_create(A,B) ((*A=TlsAlloc())==0xFFFFFFFF)
-#define pthread_getspecific(A) (TlsGetValue(A))
-#define my_pthread_getspecific(T,A) ((T) TlsGetValue(A))
-#define my_pthread_getspecific_ptr(T,V) ((T) TlsGetValue(V))
-#define my_pthread_setspecific_ptr(T,V) (!TlsSetValue((T),(V)))
-#define pthread_setspecific(A,B) (!TlsSetValue((A),(B)))
-#else
-#define pthread_key(T,V) __declspec(thread) T V
-#define pthread_key_create(A,B) pthread_dummy(0)
-#define pthread_getspecific(A) (&(A))
-#define my_pthread_getspecific(T,A) (&(A))
-#define my_pthread_getspecific_ptr(T,V) (V)
-#define my_pthread_setspecific_ptr(T,V) ((T)=(V),0)
-#define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A))
-#endif /* USE_TLS */
-
-#define pthread_equal(A,B) ((A) == (B))
-#ifdef OS2
-int pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *);
-int pthread_mutex_lock (pthread_mutex_t *);
-int pthread_mutex_unlock (pthread_mutex_t *);
-int pthread_mutex_destroy (pthread_mutex_t *);
-#define my_pthread_setprio(A,B) DosSetPriority(PRTYS_THREAD,PRTYC_NOCHANGE, B, A)
-#define pthread_kill(A,B) raise(B)
-#define pthread_exit(A) pthread_dummy()
-#else
-#define pthread_mutex_init(A,B) InitializeCriticalSection(A)
-#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
-#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
-#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
-#define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B))
-#define pthread_kill(A,B) pthread_dummy(0)
-#endif /* OS2 */
-
-/* Dummy defines for easier code */
-#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
-#define my_pthread_attr_setprio(A,B) pthread_attr_setprio(A,B)
-#define pthread_attr_setscope(A,B)
-#define pthread_detach_this_thread()
-#define pthread_condattr_init(A)
-#define pthread_condattr_destroy(A)
-
-/*Irena: compiler does not like this: */
-/*#define my_pthread_getprio(pthread_t thread_id) pthread_dummy(0) */
-#define my_pthread_getprio(thread_id) pthread_dummy(0)
-
-#elif defined(HAVE_UNIXWARE7_THREADS)
-
-#include <thread.h>
-#include <synch.h>
-
-#ifndef _REENTRANT
-#define _REENTRANT
-#endif
-
-#define HAVE_NONPOSIX_SIGWAIT
-#define pthread_t thread_t
-#define pthread_cond_t cond_t
-#define pthread_mutex_t mutex_t
-#define pthread_key_t thread_key_t
-typedef int pthread_attr_t; /* Needed by Unixware 7.0.0 */
-
-#define pthread_key_create(A,B) thr_keycreate((A),(B))
-
-#define pthread_handler_decl(A,B) void *A(void *B)
-#define pthread_key(T,V) pthread_key_t V
-
-void * my_pthread_getspecific_imp(pthread_key_t key);
-#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B))
-#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,V)
-
-#define pthread_setspecific(A,B) thr_setspecific(A,B)
-#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,V)
-
-#define pthread_create(A,B,C,D) thr_create(NULL,65536L,(C),(D),THR_DETACHED,(A))
-#define pthread_cond_init(a,b) cond_init((a),USYNC_THREAD,NULL)
-#define pthread_cond_destroy(a) cond_destroy(a)
-#define pthread_cond_signal(a) cond_signal(a)
-#define pthread_cond_wait(a,b) cond_wait((a),(b))
-#define pthread_cond_timedwait(a,b,c) cond_timedwait((a),(b),(c))
-#define pthread_cond_broadcast(a) cond_broadcast(a)
-
-#define pthread_mutex_init(a,b) mutex_init((a),USYNC_THREAD,NULL)
-#define pthread_mutex_lock(a) mutex_lock(a)
-#define pthread_mutex_unlock(a) mutex_unlock(a)
-#define pthread_mutex_destroy(a) mutex_destroy(a)
-
-#define pthread_self() thr_self()
-#define pthread_exit(A) thr_exit(A)
-#define pthread_equal(A,B) (((A) == (B)) ? 1 : 0)
-#define pthread_kill(A,B) thr_kill((A),(B))
-#define HAVE_PTHREAD_KILL
-
-#define pthread_sigmask(A,B,C) thr_sigsetmask((A),(B),(C))
-
-extern int my_sigwait(const sigset_t *set,int *sig);
-
-#define pthread_detach_this_thread() pthread_dummy(0)
-
-#define pthread_attr_init(A) pthread_dummy(0)
-#define pthread_attr_destroy(A) pthread_dummy(0)
-#define pthread_attr_setscope(A,B) pthread_dummy(0)
-#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
-#define my_pthread_setprio(A,B) pthread_dummy (0)
-#define my_pthread_getprio(A) pthread_dummy (0)
-#define my_pthread_attr_setprio(A,B) pthread_dummy(0)
-
-#else /* Normal threads */
-
-#ifdef HAVE_rts_threads
-#define sigwait org_sigwait
-#include <signal.h>
-#undef sigwait
-#endif
-#undef _REENTRANT /* Fix if _REENTRANT is in pthread.h */
-#include <pthread.h>
-#ifndef _REENTRANT
-#define _REENTRANT
-#endif
-#ifdef HAVE_THR_SETCONCURRENCY
-#include <thread.h> /* Probably solaris */
-#endif
-#ifdef HAVE_SCHED_H
-#include <sched.h>
-#endif
-#ifdef HAVE_SYNCH_H
-#include <synch.h>
-#endif
-#if defined(__EMX__) && (!defined(EMX_PTHREAD_REV) || (EMX_PTHREAD_REV < 2))
-#error Requires at least rev 2 of EMX pthreads library.
-#endif
-
-extern int my_pthread_getprio(pthread_t thread_id);
-
-#define pthread_key(T,V) pthread_key_t V
-#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V))
-#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V))
-#define pthread_detach_this_thread()
-#define pthread_handler_decl(A,B) void *A(void *B)
-typedef void *(* pthread_handler)(void *);
-
-/* Test first for RTS or FSU threads */
-
-#if defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM)
-#define HAVE_rts_threads
-extern int my_pthread_create_detached;
-#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
-#define PTHREAD_CREATE_DETACHED &my_pthread_create_detached
-#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_GLOBAL
-#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_LOCAL
-#define USE_ALARM_THREAD
-#elif defined(HAVE_mit_thread)
-#define USE_ALARM_THREAD
-#undef HAVE_LOCALTIME_R
-#define HAVE_LOCALTIME_R
-#undef HAVE_PTHREAD_ATTR_SETSCOPE
-#define HAVE_PTHREAD_ATTR_SETSCOPE
-#undef HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE /* If we are running linux */
-#undef HAVE_RWLOCK_T
-#undef HAVE_RWLOCK_INIT
-#undef HAVE_PTHREAD_RWLOCK_RDLOCK
-#undef HAVE_SNPRINTF
-
-#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
-#define signal(A,B) pthread_signal((A),(void (*)(int)) (B))
-#define my_pthread_attr_setprio(A,B)
-#endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */
-
-#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199910
-int sigwait(sigset_t *set, int *sig);
-#endif
-
-#if defined(HAVE_UNIXWARE7_POSIX)
-#undef HAVE_NONPOSIX_SIGWAIT
-#define HAVE_NONPOSIX_SIGWAIT /* sigwait takes only 1 argument */
-#endif
-
-#ifndef HAVE_NONPOSIX_SIGWAIT
-#define my_sigwait(A,B) sigwait((A),(B))
-#else
-int my_sigwait(const sigset_t *set,int *sig);
-#endif
-
-#ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT
-#ifndef SAFE_MUTEX
-#define pthread_mutex_init(a,b) my_pthread_mutex_init((a),(b))
-extern int my_pthread_mutex_init(pthread_mutex_t *mp,
- const pthread_mutexattr_t *attr);
-#endif /* SAFE_MUTEX */
-#define pthread_cond_init(a,b) my_pthread_cond_init((a),(b))
-extern int my_pthread_cond_init(pthread_cond_t *mp,
- const pthread_condattr_t *attr);
-#endif /* HAVE_NONPOSIX_PTHREAD_MUTEX_INIT */
-
-#if defined(HAVE_SIGTHREADMASK) && !defined(HAVE_PTHREAD_SIGMASK)
-#define pthread_sigmask(A,B,C) sigthreadmask((A),(B),(C))
-#endif
-
-#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
-int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
-#endif
-#if !defined(HAVE_SIGSET) && !defined(HAVE_mit_thread) && !defined(sigset)
-#define sigset(A,B) do { struct sigaction s; sigset_t set; \
- sigemptyset(&set); \
- s.sa_handler = (B); \
- s.sa_mask = set; \
- s.sa_flags = 0; \
- sigaction((A), &s, (struct sigaction *) NULL); \
- } while (0)
-#endif
-
-#ifndef my_pthread_setprio
-#if defined(HAVE_PTHREAD_SETPRIO_NP) /* FSU threads */
-#define my_pthread_setprio(A,B) pthread_setprio_np((A),(B))
-#elif defined(HAVE_PTHREAD_SETPRIO)
-#define my_pthread_setprio(A,B) pthread_setprio((A),(B))
-#else
-extern void my_pthread_setprio(pthread_t thread_id,int prior);
-#endif
-#endif
-
-#ifndef my_pthread_attr_setprio
-#ifdef HAVE_PTHREAD_ATTR_SETPRIO
-#define my_pthread_attr_setprio(A,B) pthread_attr_setprio((A),(B))
-#else
-extern void my_pthread_attr_setprio(pthread_attr_t *attr, int priority);
-#endif
-#endif
-
-#if !defined(HAVE_PTHREAD_ATTR_SETSCOPE) || defined(HAVE_DEC_3_2_THREADS)
-#define pthread_attr_setscope(A,B)
-#undef HAVE_GETHOSTBYADDR_R /* No definition */
-#endif
-
-#if defined(OS2)
-#define my_pthread_getspecific(T,A) ((T) &(A))
-#define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A))
-#elif !defined( HAVE_NONPOSIX_PTHREAD_GETSPECIFIC)
-#define my_pthread_getspecific(A,B) ((A) pthread_getspecific(B))
-#else
-#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B))
-void *my_pthread_getspecific_imp(pthread_key_t key);
-#endif /* OS2 */
-
-#ifndef HAVE_LOCALTIME_R
-struct tm *localtime_r(const time_t *clock, struct tm *res);
-#endif
-
-#ifdef HAVE_PTHREAD_CONDATTR_CREATE
-/* DCE threads on HPUX 10.20 */
-#define pthread_condattr_init pthread_condattr_create
-#define pthread_condattr_destroy pthread_condattr_delete
-#endif
-
-#ifdef HAVE_CTHREADS_WRAPPER /* For MacOSX */
-#define pthread_cond_destroy(A) pthread_dummy(0)
-#define pthread_mutex_destroy(A) pthread_dummy(0)
-#define pthread_attr_delete(A) pthread_dummy(0)
-#define pthread_condattr_delete(A) pthread_dummy(0)
-#define pthread_attr_setstacksize(A,B) pthread_dummy(0)
-#define pthread_equal(A,B) ((A) == (B))
-#define pthread_cond_timedwait(a,b,c) pthread_cond_wait((a),(b))
-#define pthread_attr_init(A) pthread_attr_create(A)
-#define pthread_attr_destroy(A) pthread_attr_delete(A)
-#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
-#define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D))
-#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
-#define pthread_kill(A,B) pthread_dummy(0)
-#undef pthread_detach_this_thread
-#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
-#endif
-
-#ifdef HAVE_DARWIN_THREADS
-#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
-#define pthread_kill(A,B) pthread_dummy(0)
-#define pthread_condattr_init(A) pthread_dummy(0)
-#define pthread_condattr_destroy(A) pthread_dummy(0)
-#define pthread_signal(A,B) pthread_dummy(0)
-#undef pthread_detach_this_thread
-#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
-#undef sigset
-#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
-#endif
-
-#if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)
-/* This is set on AIX_3_2 and Siemens unix (and DEC OSF/1 3.2 too) */
-#define pthread_key_create(A,B) \
- pthread_keycreate(A,(B) ?\
- (pthread_destructor_t) (B) :\
- (pthread_destructor_t) pthread_dummy)
-#define pthread_attr_init(A) pthread_attr_create(A)
-#define pthread_attr_destroy(A) pthread_attr_delete(A)
-#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
-#define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D))
-#ifndef pthread_sigmask
-#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
-#endif
-#define pthread_kill(A,B) pthread_dummy(0)
-#undef pthread_detach_this_thread
-#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
-#else /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */
-#define HAVE_PTHREAD_KILL
-#endif
-
-#if defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
-#if !defined(HPUX)
-struct hostent;
-#endif /* HPUX */
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop);
-#if defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
-#define GETHOSTBYNAME_BUFF_SIZE 2048
-#else
-#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
-#endif /* defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
-
-#else
-#ifdef HAVE_GETHOSTBYNAME_R_RETURN_INT
-#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop);
-#else
-#define GETHOSTBYNAME_BUFF_SIZE 2048
-#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
-#endif /* HAVE_GETHOSTBYNAME_R_RETURN_INT */
-#endif /* defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
-
-#endif /* defined(__WIN__) */
-
- /* safe_mutex adds checking to mutex for easier debugging */
-
-typedef struct st_safe_mutex_t
-{
- pthread_mutex_t global,mutex;
- char *file;
- uint line,count;
- pthread_t thread;
-} safe_mutex_t;
-
-int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr);
-int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line);
-int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line);
-int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line);
-int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
- uint line);
-int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
- struct timespec *abstime, const char *file, uint line);
-
- /* Wrappers if safe mutex is actually used */
-#ifdef SAFE_MUTEX
-#undef pthread_mutex_init
-#undef pthread_mutex_lock
-#undef pthread_mutex_unlock
-#undef pthread_mutex_destroy
-#undef pthread_mutex_wait
-#undef pthread_mutex_timedwait
-#undef pthread_mutex_t
-#undef pthread_cond_wait
-#undef pthread_cond_timedwait
-#define pthread_mutex_init(A,B) safe_mutex_init((A),(B))
-#define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__)
-#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__)
-#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__)
-#define pthread_cond_wait(A,B) safe_cond_wait((A),(B),__FILE__,__LINE__)
-#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__)
-#define pthread_mutex_trylock(A) pthread_mutex_lock(A)
-#define pthread_mutex_t safe_mutex_t
-#endif /* SAFE_MUTEX */
-
- /* READ-WRITE thread locking */
-
-#if defined(USE_MUTEX_INSTEAD_OF_RW_LOCKS)
-/* use these defs for simple mutex locking */
-#define rw_lock_t pthread_mutex_t
-#define my_rwlock_init(A,B) pthread_mutex_init((A),(B))
-#define rw_rdlock(A) pthread_mutex_lock((A))
-#define rw_wrlock(A) pthread_mutex_lock((A))
-#define rw_unlock(A) pthread_mutex_unlock((A))
-#define rwlock_destroy(A) pthread_mutex_destroy((A))
-#elif defined(HAVE_PTHREAD_RWLOCK_RDLOCK)
-#define rw_lock_t pthread_rwlock_t
-#define my_rwlock_init(A,B) pthread_rwlock_init((A),(B))
-#define rw_rdlock(A) pthread_rwlock_rdlock(A)
-#define rw_wrlock(A) pthread_rwlock_wrlock(A)
-#define rw_unlock(A) pthread_rwlock_unlock(A)
-#define rwlock_destroy(A) pthread_rwlock_destroy(A)
-#elif defined(HAVE_RWLOCK_INIT)
-#ifdef HAVE_RWLOCK_T /* For example Solaris 2.6-> */
-#define rw_lock_t rwlock_t
-#endif
-#define my_rwlock_init(A,B) rwlock_init((A),USYNC_THREAD,0)
-#else
-/* Use our own version of read/write locks */
-typedef struct _my_rw_lock_t {
- pthread_mutex_t lock; /* lock for structure */
- pthread_cond_t readers; /* waiting readers */
- pthread_cond_t writers; /* waiting writers */
- int state; /* -1:writer,0:free,>0:readers */
- int waiters; /* number of waiting writers */
-} my_rw_lock_t;
-
-#define rw_lock_t my_rw_lock_t
-#define rw_rdlock(A) my_rw_rdlock((A))
-#define rw_wrlock(A) my_rw_wrlock((A))
-#define rw_unlock(A) my_rw_unlock((A))
-#define rwlock_destroy(A) my_rwlock_destroy((A))
-
-extern int my_rwlock_init( my_rw_lock_t *, void * );
-extern int my_rwlock_destroy( my_rw_lock_t * );
-extern int my_rw_rdlock( my_rw_lock_t * );
-extern int my_rw_wrlock( my_rw_lock_t * );
-extern int my_rw_unlock( my_rw_lock_t * );
-#endif /* USE_MUTEX_INSTEAD_OF_RW_LOCKS */
-
-#define GETHOSTBYADDR_BUFF_SIZE 2048
-
-#ifndef HAVE_THR_SETCONCURRENCY
-#define thr_setconcurrency(A) pthread_dummy(0)
-#endif
-#if !defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && ! defined(pthread_attr_setstacksize)
-#define pthread_attr_setstacksize(A,B) pthread_dummy(0)
-#endif
-
-/* Define mutex types */
-#define MY_MUTEX_INIT_SLOW NULL
-#define MY_MUTEX_INIT_FAST NULL
-#define MY_MUTEX_INIT_ERRCHK NULL
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
-extern pthread_mutexattr_t my_fast_mutexattr;
-#undef MY_MUTEX_INIT_FAST
-#define MY_MUTEX_INIT_FAST &my_fast_mutexattr
-#endif
-#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
-extern pthread_mutexattr_t my_errchk_mutexattr;
-#undef MY_INIT_MUTEX_ERRCHK
-#define MY_INIT_MUTEX_ERRCHK &my_errchk_mutexattr
-#endif
-
-extern my_bool my_thread_global_init(void);
-extern void my_thread_global_end(void);
-extern my_bool my_thread_init(void);
-extern void my_thread_end(void);
-extern const char *my_thread_name(void);
-extern long my_thread_id(void);
-extern int pthread_no_free(void *);
-extern int pthread_dummy(int);
-
-/* All thread specific variables are in the following struct */
-
-#define THREAD_NAME_SIZE 10
-#if defined(__ia64__)
-#define DEFAULT_THREAD_STACK (128*1024)
-#else
-#define DEFAULT_THREAD_STACK (64*1024)
-#endif
-
-struct st_my_thread_var
-{
- int thr_errno;
- pthread_cond_t suspend;
- pthread_mutex_t mutex;
- pthread_mutex_t * volatile current_mutex;
- pthread_cond_t * volatile current_cond;
- pthread_t pthread_self;
- long id;
- int cmp_length;
- int volatile abort;
-#ifndef DBUG_OFF
- gptr dbug;
- char name[THREAD_NAME_SIZE+1];
-#endif
-};
-
-extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
-#define my_thread_var (_my_thread_var())
-#define my_errno my_thread_var->thr_errno
-
- /* statistics_xxx functions are for not essential statistic */
-
-#ifndef thread_safe_increment
-#ifdef HAVE_ATOMIC_ADD
-#define thread_safe_increment(V,L) atomic_add(1,(atomic_t*) &V);
-#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V);
-#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V);
-#define statistic_increment(V,L) thread_safe_increment((V),(L))
-#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
-#else
-#define thread_safe_increment(V,L) \
- pthread_mutex_lock((L)); (V)++; pthread_mutex_unlock((L));
-#define thread_safe_add(V,C,L) \
- pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
-#define thread_safe_sub(V,C,L) \
- pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
-#ifdef SAFE_STATISTICS
-#define statistic_increment(V,L) thread_safe_increment((V),(L))
-#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
-#else
-#define statistic_increment(V,L) (V)++
-#define statistic_add(V,C,L) (V)+=(C)
-#endif /* SAFE_STATISTICS */
-#endif /* HAVE_ATOMIC_ADD */
-#endif /* thread_safe_increment */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _my_ptread_h */
diff --git a/ext/mysql/libmysql/my_read.c b/ext/mysql/libmysql/my_read.c
deleted file mode 100644
index 3ca5bfb95a..0000000000
--- a/ext/mysql/libmysql/my_read.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-#include <errno.h>
-
-
- /* Read a chunk of bytes from a file */
-
-uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags)
- /* File descriptor */
- /* Buffer must be at least count bytes */
- /* Max number of bytes returnd */
- /* Flags on what to do on error */
-{
- uint readbytes;
- DBUG_ENTER("my_read");
- DBUG_PRINT("my",("Fd: %d Buffer: %lx Count: %u MyFlags: %d",
- Filedes, Buffer, Count, MyFlags));
-
- for (;;)
- {
- errno=0; /* Linux doesn't reset this */
- if ((readbytes = (uint) read(Filedes, Buffer, Count)) != Count)
- {
- my_errno=errno ? errno : -1;
- DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
- readbytes,Count,Filedes,my_errno));
-#ifdef THREAD
- if (readbytes == 0 && errno == EINTR)
- continue; /* Interrupted */
-#endif
- if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
- {
- if ((int) readbytes == -1)
- my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
- my_filename(Filedes),my_errno);
- else if (MyFlags & (MY_NABP | MY_FNABP))
- my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
- my_filename(Filedes),my_errno);
- }
- if ((int) readbytes == -1 || (MyFlags & (MY_FNABP | MY_NABP)))
- DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
- }
-
- if (MyFlags & (MY_NABP | MY_FNABP))
- readbytes=0; /* Ok on read */
- break;
- }
- DBUG_RETURN(readbytes);
-} /* my_read */
diff --git a/ext/mysql/libmysql/my_realloc.c b/ext/mysql/libmysql/my_realloc.c
deleted file mode 100644
index 7e85c1c861..0000000000
--- a/ext/mysql/libmysql/my_realloc.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */
-#undef SAFEMALLOC
-#endif
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-
- /* My memory re allocator */
-
-gptr my_realloc(gptr oldpoint, uint Size, myf MyFlags)
-{
- gptr point;
- DBUG_ENTER("my_realloc");
- DBUG_PRINT("my",("ptr: %lx Size: %u MyFlags: %d",oldpoint, Size, MyFlags));
-
- if (!oldpoint && (MyFlags & MY_ALLOW_ZERO_PTR))
- DBUG_RETURN(my_malloc(Size,MyFlags));
-#ifdef USE_HALLOC
- if (!(point = malloc(Size)))
- {
- if (MyFlags & MY_FREE_ON_ERROR)
- my_free(oldpoint,MyFlags);
- if (MyFlags & MY_HOLD_ON_ERROR)
- DBUG_RETURN(oldpoint);
- my_errno=errno;
- if (MyFlags & MY_FAE+MY_WME)
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),Size);
- }
- else
- {
- memcpy(point,oldpoint,Size);
- free(oldpoint);
- }
-#else
- if ((point = (char*)realloc(oldpoint,Size)) == NULL)
- {
- if (MyFlags & MY_FREE_ON_ERROR)
- my_free(oldpoint,MyFLAGS);
- if (MyFlags & MY_HOLD_ON_ERROR)
- DBUG_RETURN(oldpoint);
- my_errno=errno;
- if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), Size);
- }
-#endif
- DBUG_PRINT("exit",("ptr: %lx",point));
- DBUG_RETURN(point);
-} /* my_realloc */
diff --git a/ext/mysql/libmysql/my_static.c b/ext/mysql/libmysql/my_static.c
deleted file mode 100644
index 92cdac6d93..0000000000
--- a/ext/mysql/libmysql/my_static.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Static variables for mysys library. All definied here for easy making of
- a shared library
-*/
-
-#if !defined(stdin) || defined(OS2)
-#include "mysys_priv.h"
-#include "my_static.h"
-#include "my_alarm.h"
-#endif
-
- /* from my_init */
-my_string home_dir=0,my_progname=0;
-char NEAR curr_dir[FN_REFLEN]= {0},
- NEAR home_dir_buff[FN_REFLEN]= {0};
-ulong my_stream_opened=0,my_file_opened=0, my_tmp_file_created=0;
-int NEAR my_umask=0664, NEAR my_umask_dir=0777;
-#ifndef THREAD
-int NEAR my_errno=0;
-#endif
-struct my_file_info my_file_info[MY_NFILE]= {{0,UNOPEN}};
-
- /* From mf_brkhant */
-int NEAR my_dont_interrupt=0;
-volatile int _my_signals=0;
-struct st_remember _my_sig_remember[MAX_SIGNALS]={{0,0}};
-#ifdef THREAD
-sigset_t my_signals; /* signals blocked by mf_brkhant */
-#endif
-
- /* from mf_keycache.c */
-my_bool key_cache_inited=0;
-
- /* from mf_reccache.c */
-ulong my_default_record_cache_size=RECORD_CACHE_SIZE;
-
- /* from soundex.c */
- /* ABCDEFGHIJKLMNOPQRSTUVWXYZ */
- /* :::::::::::::::::::::::::: */
-const char *soundex_map= "01230120022455012623010202";
-
- /* from my_malloc */
-USED_MEM* my_once_root_block=0; /* pointer to first block */
-uint my_once_extra=ONCE_ALLOC_INIT; /* Memory to alloc / block */
-
- /* from my_tempnam */
-#ifndef HAVE_TEMPNAM
-int _my_tempnam_used=0;
-#endif
-
- /* from safe_malloc */
-uint sf_malloc_prehunc=0, /* If you have problem with core- */
- sf_malloc_endhunc=0, /* dump when malloc-message.... */
- /* set theese to 64 or 128 */
- sf_malloc_quick=0; /* set if no calls to sanity */
-long lCurMemory = 0L; /* Current memory usage */
-long lMaxMemory = 0L; /* Maximum memory usage */
-uint cNewCount = 0; /* Number of times NEW() was called */
-byte *sf_min_adress= (byte*) ~(unsigned long) 0L,
- *sf_max_adress= (byte*) 0L;
-
-/* Root of the linked list of remembers */
-struct remember *pRememberRoot = NULL;
-
- /* from my_alarm */
-int volatile my_have_got_alarm=0; /* declare variable to reset */
-ulong my_time_to_wait_for_lock=2; /* In seconds */
-
- /* from errors.c */
-#ifdef SHARED_LIBRARY
-char * NEAR globerrs[GLOBERRS]; /* my_error_messages is here */
-#endif
-void (*my_abort_hook)(int) = (void(*)(int)) exit;
-int (*error_handler_hook)(uint error,const char *str,myf MyFlags)=
- my_message_no_curses;
-int (*fatal_error_handler_hook)(uint error,const char *str,myf MyFlags)=
- my_message_no_curses;
-
- /* How to disable options */
-my_bool NEAR my_disable_locking=0;
-my_bool NEAR my_disable_async_io=0;
-my_bool NEAR my_disable_flush_key_blocks=0;
-my_bool NEAR my_disable_symlinks=0;
-my_bool NEAR mysys_uses_curses=0;
diff --git a/ext/mysql/libmysql/my_static.h b/ext/mysql/libmysql/my_static.h
deleted file mode 100644
index 29a9b74026..0000000000
--- a/ext/mysql/libmysql/my_static.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Static variables for mysys library. All definied here for easy making of
- a shared library
-*/
-
-#include "mysys_priv.h"
-#include <signal.h>
-
-#define MAX_SIGNALS 10 /* Max signals under a dont-allow */
-#define MIN_KEYBLOCK (min(IO_SIZE,1024))
-#define MAX_KEYBLOCK 8192 /* Max keyblocklength == 8*IO_SIZE */
-#define MAX_BLOCK_TYPES MAX_KEYBLOCK/MIN_KEYBLOCK
-
-struct st_remember {
- int number;
- sig_handler (*func)(int number);
-};
-
-struct irem {
- struct remember *_pNext; /* Linked list of structures */
- struct remember *_pPrev; /* Other link */
- my_string _sFileName; /* File in which memory was new'ed */
- uint _uLineNum; /* Line number in above file */
- uint _uDataSize; /* Size requested */
- long _lSpecialValue; /* Underrun marker value */
-};
-
-struct remember {
- struct irem tInt;
- char aData[1];
-};
-
-extern char NEAR curr_dir[FN_REFLEN],NEAR home_dir_buff[FN_REFLEN];
-
-extern volatile int _my_signals;
-extern struct st_remember _my_sig_remember[MAX_SIGNALS];
-
-extern const char *soundex_map;
-
-extern USED_MEM* my_once_root_block;
-extern uint my_once_extra;
-
-#ifndef HAVE_TEMPNAM
-extern int _my_tempnam_used;
-#endif
-
-extern byte *sf_min_adress,*sf_max_adress;
-extern uint cNewCount;
-extern struct remember *pRememberRoot;
-
-#if defined(THREAD) && !defined(__WIN__)
-extern sigset_t my_signals; /* signals blocked by mf_brkhant */
-#endif
diff --git a/ext/mysql/libmysql/my_sys.h b/ext/mysql/libmysql/my_sys.h
deleted file mode 100644
index 8f9f0c35fd..0000000000
--- a/ext/mysql/libmysql/my_sys.h
+++ /dev/null
@@ -1,592 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#ifndef _my_sys_h
-#define _my_sys_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef HAVE_AIOWAIT
-#include <sys/asynch.h> /* Used by record-cache */
-typedef struct my_aio_result {
- aio_result_t result;
- int pending;
-} my_aio_result;
-#endif
-
-#ifndef THREAD
-extern int NEAR my_errno; /* Last error in mysys */
-#else
-#include <my_pthread.h>
-#endif
-
-#ifndef _m_ctype_h
-#include <m_ctype.h> /* for CHARSET_INFO */
-#endif
-
-#include <stdarg.h>
-
-#define MYSYS_PROGRAM_USES_CURSES() { error_handler_hook = my_message_curses; mysys_uses_curses=1; }
-#define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;}
-#define MY_INIT(name); { my_progname= name; my_init(); }
-
-#define MAXMAPS (4) /* Number of error message maps */
-#define ERRMOD (1000) /* Max number of errors in a map */
-#define ERRMSGSIZE (SC_MAXWIDTH) /* Max length of a error message */
-#define NRERRBUFFS (2) /* Buffers for parameters */
-#define MY_FILE_ERROR ((uint) ~0)
-
- /* General bitmaps for my_func's */
-#define MY_FFNF 1 /* Fatal if file not found */
-#define MY_FNABP 2 /* Fatal if not all bytes read/writen */
-#define MY_NABP 4 /* Error if not all bytes read/writen */
-#define MY_FAE 8 /* Fatal if any error */
-#define MY_WME 16 /* Write message on error */
-#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */
-#define MY_RAID 64 /* Support for RAID (not the "Johnson&Johnson"-s one ;) */
-#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
-#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
-#define MY_COPYTIME 64 /* my_redel() copys time */
-#define MY_DELETE_OLD 256 /* my_create_with_symlink() */
-#define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */
-#define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */
-#define MY_REDEL_MAKE_BACKUP 256
-#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */
-#define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */
-#define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */
-#define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */
-#define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */
-#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */
-#define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */
-
-#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
-#define MY_GIVE_INFO 2 /* Give time info about process*/
-
-#define ME_HIGHBYTE 8 /* Shift for colours */
-#define ME_NOCUR 1 /* Don't use curses message */
-#define ME_OLDWIN 2 /* Use old window */
-#define ME_BELL 4 /* Ring bell then printing message */
-#define ME_HOLDTANG 8 /* Don't delete last keys */
-#define ME_WAITTOT 16 /* Wait for errtime secs of for a action */
-#define ME_WAITTANG 32 /* Wait for a user action */
-#define ME_NOREFRESH 64 /* Dont refresh screen */
-#define ME_NOINPUT 128 /* Dont use the input libary */
-#define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */
-#define ME_COLOUR2 ((2 << ME_HIGHBYTE))
-#define ME_COLOUR3 ((3 << ME_HIGHBYTE))
-
- /* My seek flags */
-#define MY_SEEK_SET 0
-#define MY_SEEK_CUR 1
-#define MY_SEEK_END 2
-
- /* My charsets_list flags */
-#define MY_NO_SETS 0
-#define MY_COMPILED_SETS 1 /* show compiled-in sets */
-#define MY_CONFIG_SETS 2 /* sets that have a *.conf file */
-#define MY_INDEX_SETS 4 /* all sets listed in the Index file */
-#define MY_LOADED_SETS 8 /* the sets that are currently loaded */
-
- /* Some constants */
-#define MY_WAIT_FOR_USER_TO_FIX_PANIC 60 /* in seconds */
-#define MY_WAIT_GIVE_USER_A_MESSAGE 10 /* Every 10 times of prev */
-#define MIN_COMPRESS_LENGTH 50 /* Don't compress small bl. */
-#define KEYCACHE_BLOCK_SIZE 1024
-
- /* root_alloc flags */
-#define MY_KEEP_PREALLOC 1
-
- /* defines when allocating data */
-
-#ifdef SAFEMALLOC
-#define my_malloc(SZ,FLAG) _mymalloc( SZ, __FILE__, __LINE__, FLAG )
-#define my_realloc(PTR,SZ,FLAG) _myrealloc( PTR, SZ, __FILE__, __LINE__, FLAG )
-#define my_checkmalloc() _sanity( __FILE__, __LINE__ )
-#define my_free(PTR,FLAG) _myfree( PTR, __FILE__, __LINE__,FLAG)
-#define my_memdup(A,B,C) _my_memdup(A,B,__FILE__,__LINE__,C)
-#define my_strdup(A,C) _my_strdup(A,__FILE__,__LINE__,C)
-#define QUICK_SAFEMALLOC sf_malloc_quick=1
-#define NORMAL_SAFEMALLOC sf_malloc_quick=0
-extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick;
-extern ulonglong safemalloc_mem_limit;
-#else
-#define my_checkmalloc() (0)
-#undef TERMINATE
-#define TERMINATE(A) {}
-#define QUICK_SAFEMALLOC
-#define NORMAL_SAFEMALLOC
-extern gptr my_malloc(uint Size,myf MyFlags);
-extern gptr my_realloc(gptr oldpoint,uint Size,myf MyFlags);
-extern void my_no_flags_free(gptr ptr);
-extern gptr my_memdup(const byte *from,uint length,myf MyFlags);
-extern my_string my_strdup(const char *from,myf MyFlags);
-#define my_free(PTR,FG) my_no_flags_free(PTR)
-#endif
-#ifdef HAVE_ALLOCA
-#define my_alloca(SZ) alloca((size_t) (SZ))
-#define my_afree(PTR) {}
-#else
-#define my_alloca(SZ) my_malloc(SZ,MYF(0))
-#define my_afree(PTR) my_free(PTR,MYF(MY_WME))
-#endif /* HAVE_ALLOCA */
-#ifdef MSDOS
-#ifdef __ZTC__
-void * __CDECL halloc(long count,size_t length);
-void __CDECL hfree(void *ptr);
-#endif
-#if defined(USE_HALLOC)
-#if defined(_VCM_) || defined(M_IC80386)
-#undef USE_HALLOC
-#endif
-#endif
-#ifdef USE_HALLOC
-#define malloc(a) halloc((long) (a),1)
-#define free(a) hfree(a)
-#endif
-#endif /* MSDOS */
-
-#ifdef HAVE_ERRNO_AS_DEFINE
-#include <errno.h> /* errno is a define */
-#else
-extern int errno; /* declare errno */
-#endif
-extern const char ** NEAR my_errmsg[];
-extern char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
-extern char *home_dir; /* Home directory for user */
-extern char *my_progname; /* program-name (printed in errors) */
-extern char NEAR curr_dir[]; /* Current directory for user */
-extern int (*error_handler_hook)(uint my_err, const char *str,myf MyFlags);
-extern int (*fatal_error_handler_hook)(uint my_err, const char *str,
- myf MyFlags);
-
-/* charsets */
-extern uint get_charset_number(const char *cs_name);
-extern const char *get_charset_name(uint cs_number);
-extern CHARSET_INFO *get_charset(uint cs_number, myf flags);
-extern my_bool set_default_charset(uint cs, myf flags);
-extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags);
-extern my_bool set_default_charset_by_name(const char *cs_name, myf flags);
-extern void free_charsets(void);
-extern char *list_charsets(myf want_flags); /* my_free() this string... */
-extern char *get_charsets_dir(char *buf);
-
-
-/* statistics */
-extern ulong _my_cache_w_requests,_my_cache_write,_my_cache_r_requests,
- _my_cache_read;
-extern ulong _my_blocks_used,_my_blocks_changed;
-extern ulong my_file_opened,my_stream_opened, my_tmp_file_created;
-extern my_bool key_cache_inited;
-
- /* Point to current my_message() */
-extern void (*my_sigtstp_cleanup)(void),
- /* Executed before jump to shell */
- (*my_sigtstp_restart)(void),
- (*my_abort_hook)(int);
- /* Executed when comming from shell */
-extern int NEAR my_umask, /* Default creation mask */
- NEAR my_umask_dir,
- NEAR my_recived_signals, /* Signals we have got */
- NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */
- NEAR my_dont_interrupt; /* call remember_intr when set */
-extern my_bool NEAR mysys_uses_curses, my_use_symdir;
-extern long lCurMemory,lMaxMemory; /* from safemalloc */
-
-extern ulong my_default_record_cache_size;
-extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io,
- NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks;
-extern char wild_many,wild_one,wild_prefix;
-extern const char *charsets_dir;
-extern char *defaults_extra_file;
-
-typedef struct wild_file_pack /* Struct to hold info when selecting files */
-{
- uint wilds; /* How many wildcards */
- uint not_pos; /* Start of not-theese-files */
- my_string *wild; /* Pointer to wildcards */
-} WF_PACK;
-
-typedef struct st_typelib { /* Different types saved here */
- uint count; /* How many types */
- const char *name; /* Name of typelib */
- const char **type_names;
-} TYPELIB;
-
-enum cache_type {READ_CACHE,WRITE_CACHE,READ_FIFO,READ_NET,WRITE_NET};
-enum flush_type { FLUSH_KEEP, FLUSH_RELEASE, FLUSH_IGNORE_CHANGED,
- FLUSH_FORCE_WRITE};
-
-typedef struct st_record_cache /* Used when cacheing records */
-{
- File file;
- int rc_seek,error,inited;
- uint rc_length,read_length,reclength;
- my_off_t rc_record_pos,end_of_file;
- byte *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos;
-#ifdef HAVE_AIOWAIT
- int use_async_io;
- my_aio_result aio_result;
-#endif
- enum cache_type type;
-} RECORD_CACHE;
-
-enum file_type { UNOPEN = 0, FILE_BY_OPEN, FILE_BY_CREATE,
- STREAM_BY_FOPEN, STREAM_BY_FDOPEN, FILE_BY_MKSTEMP };
-
-extern struct my_file_info
-{
- my_string name;
- enum file_type type;
-#if defined(THREAD) && !defined(HAVE_PREAD)
- pthread_mutex_t mutex;
-#endif
-} my_file_info[MY_NFILE];
-
-
-typedef struct st_dynamic_array {
- char *buffer;
- uint elements,max_element;
- uint alloc_increment;
- uint size_of_element;
-} DYNAMIC_ARRAY;
-
-typedef struct st_dynamic_string {
- char *str;
- uint length,max_length,alloc_increment;
-} DYNAMIC_STRING;
-
-
-typedef struct st_io_cache /* Used when cacheing files */
-{
- my_off_t pos_in_file,end_of_file;
- byte *rc_pos,*rc_end,*buffer,*rc_request_pos;
- int (*read_function)(struct st_io_cache *,byte *,uint);
- char *file_name; /* if used with 'open_cached_file' */
- char *dir,*prefix;
- File file;
- int seek_not_done,error;
- uint buffer_length,read_length;
- myf myflags; /* Flags used to my_read/my_write */
- enum cache_type type;
-#ifdef HAVE_AIOWAIT
- uint inited;
- my_off_t aio_read_pos;
- my_aio_result aio_result;
-#endif
-} IO_CACHE;
-
-typedef int (*qsort2_cmp)(const void *, const void *, const void *);
-
- /* defines for mf_iocache */
-
- /* Test if buffer is inited */
-#define my_b_clear(info) (info)->buffer=0
-#define my_b_inited(info) (info)->buffer
-#define my_b_EOF INT_MIN
-
-#define my_b_read(info,Buffer,Count) \
- ((info)->rc_pos + (Count) <= (info)->rc_end ?\
- (memcpy(Buffer,(info)->rc_pos,(size_t) (Count)), \
- ((info)->rc_pos+=(Count)),0) :\
- (*(info)->read_function)((info),Buffer,Count))
-
-#define my_b_get(info) \
- ((info)->rc_pos != (info)->rc_end ?\
- ((info)->rc_pos++, (int) (uchar) (info)->rc_pos[-1]) :\
- _my_b_get(info))
-
-#define my_b_write(info,Buffer,Count) \
- ((info)->rc_pos + (Count) <= (info)->rc_end ?\
- (memcpy((info)->rc_pos,Buffer,(size_t) (Count)), \
- ((info)->rc_pos+=(Count)),0) :\
- _my_b_write(info,Buffer,Count))
-
- /* my_b_write_byte dosn't have any err-check */
-#define my_b_write_byte(info,chr) \
- (((info)->rc_pos < (info)->rc_end) ?\
- ((*(info)->rc_pos++)=(chr)) :\
- (_my_b_write(info,0,0) , ((*(info)->rc_pos++)=(chr))))
-
-#define my_b_fill_cache(info) \
- (((info)->rc_end=(info)->rc_pos),(*(info)->read_function)(info,0,0))
-
-#define my_b_tell(info) ((info)->pos_in_file + \
- ((info)->rc_pos - (info)->rc_request_pos))
-
-#define my_b_bytes_in_cache(info) ((uint) ((info)->rc_end - (info)->rc_pos))
-
-typedef struct st_changeable_var {
- const char *name; /* Name of variable */
- long *varptr; /* Pointer to variable */
- long def_value, /* Default value */
- min_value, /* Min allowed value */
- max_value, /* Max allowed value */
- sub_size, /* Subtract this from given value */
- block_size; /* Value should be a mult. of this */
-} CHANGEABLE_VAR;
-
-
-/* structs for alloc_root */
-
-#ifndef ST_USED_MEM_DEFINED
-#define ST_USED_MEM_DEFINED
-typedef struct st_used_mem { /* struct for once_alloc */
- struct st_used_mem *next; /* Next block in use */
- unsigned int left; /* memory left in block */
- unsigned int size; /* Size of block */
-} USED_MEM;
-
-typedef struct st_mem_root {
- USED_MEM *free;
- USED_MEM *used;
- USED_MEM *pre_alloc;
- unsigned int min_malloc;
- unsigned int block_size;
-
- void (*error_handler)(void);
-} MEM_ROOT;
-#endif
-
- /* Prototypes for mysys and my_func functions */
-
-extern int my_copy(const char *from,const char *to,myf MyFlags);
-extern int my_append(const char *from,const char *to,myf MyFlags);
-extern int my_delete(const char *name,myf MyFlags);
-extern int my_getwd(my_string buf,uint size,myf MyFlags);
-extern int my_setwd(const char *dir,myf MyFlags);
-extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFlags);
-extern gptr my_once_alloc(uint Size,myf MyFlags);
-extern void my_once_free(void);
-extern my_string my_tempnam(const char *dir,const char *pfx,myf MyFlags);
-extern File my_open(const char *FileName,int Flags,myf MyFlags);
-extern File my_register_filename(File fd, const char *FileName,
- enum file_type type_of_file,
- uint error_message_number, myf MyFlags);
-extern File my_create(const char *FileName,int CreateFlags,
- int AccsesFlags, myf MyFlags);
-extern int my_close(File Filedes,myf MyFlags);
-extern int my_mkdir(const char *dir, int Flags, myf MyFlags);
-extern int my_readlink(char *to, const char *filename, myf MyFlags);
-extern int my_realpath(char *to, const char *filename, myf MyFlags);
-extern File my_create_with_symlink(const char *linkname, const char *filename,
- int createflags, int access_flags,
- myf MyFlags);
-extern int my_delete_with_symlink(const char *name, myf MyFlags);
-extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags);
-extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
-extern uint my_read(File Filedes,byte *Buffer,uint Count,myf MyFlags);
-extern uint my_pread(File Filedes,byte *Buffer,uint Count,my_off_t offset,
- myf MyFlags);
-extern int my_rename(const char *from,const char *to,myf MyFlags);
-extern my_off_t my_seek(File fd,my_off_t pos,int whence,myf MyFlags);
-extern my_off_t my_tell(File fd,myf MyFlags);
-extern uint my_write(File Filedes,const byte *Buffer,uint Count,
- myf MyFlags);
-extern uint my_pwrite(File Filedes,const byte *Buffer,uint Count,
- my_off_t offset,myf MyFlags);
-extern uint my_fread(FILE *stream,byte *Buffer,uint Count,myf MyFlags);
-extern uint my_fwrite(FILE *stream,const byte *Buffer,uint Count,
- myf MyFlags);
-extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags);
-extern my_off_t my_ftell(FILE *stream,myf MyFlags);
-extern gptr _mymalloc(uint uSize,const char *sFile,
- uint uLine, myf MyFlag);
-extern gptr _myrealloc(gptr pPtr,uint uSize,const char *sFile,
- uint uLine, myf MyFlag);
-extern gptr my_multi_malloc _VARARGS((myf MyFlags, ...));
-extern void _myfree(gptr pPtr,const char *sFile,uint uLine, myf MyFlag);
-extern int _sanity(const char *sFile,unsigned int uLine);
-extern gptr _my_memdup(const byte *from,uint length,
- const char *sFile, uint uLine,myf MyFlag);
-extern my_string _my_strdup(const char *from, const char *sFile, uint uLine,
- myf MyFlag);
-#ifndef TERMINATE
-extern void TERMINATE(FILE *file);
-#endif
-extern void init_glob_errs(void);
-extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
-extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
-extern int my_fclose(FILE *fd,myf MyFlags);
-extern int my_chsize(File fd,my_off_t newlength,myf MyFlags);
-extern int my_error _VARARGS((int nr,myf MyFlags, ...));
-extern int my_printf_error _VARARGS((uint my_err, const char *format,
- myf MyFlags, ...)
- __attribute__ ((format (printf, 2, 4))));
-extern int my_vsnprintf( char *str, size_t n,
- const char *format, va_list ap );
-extern int my_snprintf(char* to, size_t n, const char* fmt, ...);
-extern int my_message(uint my_err, const char *str,myf MyFlags);
-extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags);
-extern int my_message_curses(uint my_err, const char *str,myf MyFlags);
-extern void my_init(void);
-extern void my_end(int infoflag);
-extern int my_redel(const char *from, const char *to, int MyFlags);
-extern int my_copystat(const char *from, const char *to, int MyFlags);
-extern my_string my_filename(File fd);
-
-#ifndef THREAD
-extern void dont_break(void);
-extern void allow_break(void);
-#else
-#define dont_break()
-#define allow_break()
-#endif
-
-extern void my_remember_signal(int signal_number,sig_handler (*func)(int));
-extern void caseup(my_string str,uint length);
-extern void casedn(my_string str,uint length);
-extern void caseup_str(my_string str);
-extern void casedn_str(my_string str);
-extern void case_sort(my_string str,uint length);
-extern uint dirname_part(my_string to,const char *name);
-extern uint dirname_length(const char *name);
-#define base_name(A) (A+dirname_length(A))
-extern int test_if_hard_path(const char *dir_name);
-extern char *convert_dirname(my_string name);
-extern void to_unix_path(my_string name);
-extern my_string fn_ext(const char *name);
-extern my_string fn_same(my_string toname,const char *name,int flag);
-extern my_string fn_format(my_string to,const char *name,const char *dsk,
- const char *form,int flag);
-extern size_s strlength(const char *str);
-extern void pack_dirname(my_string to,const char *from);
-extern uint unpack_dirname(my_string to,const char *from);
-extern uint cleanup_dirname(my_string to,const char *from);
-extern uint system_filename(my_string to,const char *from);
-extern my_string unpack_filename(my_string to,const char *from);
-extern my_string intern_filename(my_string to,const char *from);
-extern my_string directory_file_name(my_string dst, const char *src);
-extern int pack_filename(my_string to, const char *name, size_s max_length);
-extern my_string my_path(my_string to,const char *progname,
- const char *own_pathname_part);
-extern my_string my_load_path(my_string to, const char *path,
- const char *own_path_prefix);
-extern int wild_compare(const char *str,const char *wildstr);
-extern my_string my_strcasestr(const char *src,const char *suffix);
-extern int my_strcasecmp(const char *s,const char *t);
-extern int my_strsortcmp(const char *s,const char *t);
-extern int my_casecmp(const char *s,const char *t,uint length);
-extern int my_sortcmp(const char *s,const char *t,uint length);
-extern int my_sortncmp(const char *s,uint s_len, const char *t,uint t_len);
-extern WF_PACK *wf_comp(my_string str);
-extern int wf_test(struct wild_file_pack *wf_pack,const char *name);
-extern void wf_end(struct wild_file_pack *buffer);
-extern size_s stripp_sp(my_string str);
-extern void get_date(my_string to,int timeflag,time_t use_time);
-extern void soundex(my_string out_pntr, my_string in_pntr,pbool remove_garbage);
-extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file,
- uint reclength,enum cache_type type,
- pbool use_async_io);
-extern int read_cache_record(RECORD_CACHE *info,byte *to);
-extern int end_record_cache(RECORD_CACHE *info);
-extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos,
- const byte *record,uint length);
-extern int flush_write_cache(RECORD_CACHE *info);
-extern long my_clock(void);
-extern sig_handler sigtstp_handler(int signal_number);
-extern void handle_recived_signals(void);
-extern int init_key_cache(ulong use_mem,ulong leave_this_much_mem);
-extern byte *key_cache_read(File file,my_off_t filepos,byte* buff,uint length,
- uint block_length,int return_buffer);
-extern int key_cache_write(File file,my_off_t filepos,byte* buff,uint length,
- uint block_length,int force_write);
-extern int flush_key_blocks(int file, enum flush_type type);
-extern void end_key_cache(void);
-extern sig_handler my_set_alarm_variable(int signo);
-extern void my_string_ptr_sort(void *base,uint items,size_s size);
-extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements,
- size_s size_of_element,uchar *buffer[]);
-extern qsort_t qsort2(void *base_ptr, size_t total_elems, size_t size,
- qsort2_cmp cmp, void *cmp_argument);
-extern qsort2_cmp get_ptr_compare(uint);
-extern int init_io_cache(IO_CACHE *info,File file,uint cachesize,
- enum cache_type type,my_off_t seek_offset,
- pbool use_async_io, myf cache_myflags);
-extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type,
- my_off_t seek_offset,pbool use_async_io,
- pbool clear_cache);
-extern int _my_b_read(IO_CACHE *info,byte *Buffer,uint Count);
-extern int _my_b_net_read(IO_CACHE *info,byte *Buffer,uint Count);
-extern int _my_b_get(IO_CACHE *info);
-extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count);
-extern int _my_b_write(IO_CACHE *info,const byte *Buffer,uint Count);
-extern int my_block_write(IO_CACHE *info, const byte *Buffer,
- uint Count, my_off_t pos);
-extern int flush_io_cache(IO_CACHE *info);
-extern int end_io_cache(IO_CACHE *info);
-extern uint my_b_fill(IO_CACHE *info);
-extern void my_b_seek(IO_CACHE *info,my_off_t pos);
-extern uint my_b_gets(IO_CACHE *info, char *to, uint max_length);
-extern uint my_b_printf(IO_CACHE *info, const char* fmt, ...);
-extern uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap);
-extern my_bool open_cached_file(IO_CACHE *cache,const char *dir,
- const char *prefix, uint cache_size,
- myf cache_myflags);
-extern my_bool real_open_cached_file(IO_CACHE *cache);
-extern void close_cached_file(IO_CACHE *cache);
-File create_temp_file(char *to, const char *dir, const char *pfx,
- int mode, myf MyFlags);
-extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size,
- uint init_alloc,uint alloc_increment);
-extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,gptr element);
-extern byte *alloc_dynamic(DYNAMIC_ARRAY *array);
-extern byte *pop_dynamic(DYNAMIC_ARRAY*);
-extern my_bool set_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index);
-extern void get_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index);
-extern void delete_dynamic(DYNAMIC_ARRAY *array);
-extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index);
-extern void freeze_size(DYNAMIC_ARRAY *array);
-#define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element)
-#define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index))
-#define push_dynamic(A,B) insert_dynamic(A,B)
-
-extern int find_type(my_string x,TYPELIB *typelib,uint full_name);
-extern void make_type(my_string to,uint nr,TYPELIB *typelib);
-extern const char *get_type(TYPELIB *typelib,uint nr);
-extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
- uint init_alloc,uint alloc_increment);
-extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append);
-my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
- uint length);
-extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str);
-extern my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size);
-extern void dynstr_free(DYNAMIC_STRING *str);
-void set_all_changeable_vars(CHANGEABLE_VAR *vars);
-my_bool set_changeable_var(my_string str,CHANGEABLE_VAR *vars);
-my_bool set_changeable_varval(const char *var, ulong val,
- CHANGEABLE_VAR *vars);
-#ifdef HAVE_MLOCK
-extern byte *my_malloc_lock(uint length,myf flags);
-extern void my_free_lock(byte *ptr,myf flags);
-#else
-#define my_malloc_lock(A,B) my_malloc((A),(B))
-#define my_free_lock(A,B) my_free((A),(B))
-#endif
-#define alloc_root_inited(A) ((A)->min_malloc != 0)
-void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size);
-gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size);
-void free_root(MEM_ROOT *root, myf MyFLAGS);
-char *strdup_root(MEM_ROOT *root,const char *str);
-char *memdup_root(MEM_ROOT *root,const char *str,uint len);
-void load_defaults(const char *conf_file, const char **groups,
- int *argc, char ***argv);
-void free_defaults(char **argv);
-void print_defaults(const char *conf_file, const char **groups);
-my_bool my_compress(byte *, ulong *, ulong *);
-my_bool my_uncompress(byte *, ulong *, ulong *);
-byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen);
-ulong checksum(const byte *mem, uint count);
-
-#if defined(_MSC_VER) && !defined(__WIN__)
-extern void sleep(int sec);
-#endif
-#ifdef __WIN__
-extern my_bool have_tcpip; /* Is set if tcpip is used */
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#include "raid.h"
-#endif /* _my_sys_h */
diff --git a/ext/mysql/libmysql/my_tempnam.c b/ext/mysql/libmysql/my_tempnam.c
deleted file mode 100644
index 1daca61f85..0000000000
--- a/ext/mysql/libmysql/my_tempnam.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- This function is only used by some old ISAM code.
- When we remove ISAM support from MySQL, we should also delete this file
-
- One should instead use the functions in mf_tempfile.c
-*/
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
-/* HPUX 11.0 doesn't allow us to change the environ pointer */
-#ifdef HPUX11
-#undef HAVE_TEMPNAM
-#endif
-
-#include "my_static.h"
-#include "mysys_err.h"
-
-#define TMP_EXT ".tmp" /* Extension of tempfile */
-#if ! defined(P_tmpdir)
-#define P_tmpdir ""
-#endif
-
-#ifdef HAVE_TEMPNAM
-#if !defined( MSDOS) && !defined(OS2) && !defined(__NETWARE__)
-extern char **environ;
-#endif
-#endif
-
-/* Make a uniq temp file name by using dir and adding something after
- pfx to make name uniq. Name is made by adding a uniq 8 length-string and
- TMP_EXT after pfx.
- Returns pointer to malloced area for filename. Should be freed by
- free().
- The name should be uniq, but it isn't checked if it file allready exists.
- Uses tempnam() if function exist on system.
- This function fixes that if dir is given it's used. For example
- MSDOS tempnam() uses always TMP environment-variable if it exists.
-*/
- /* ARGSUSED */
-
-my_string my_tempnam(const char *dir, const char *pfx,
- myf MyFlags __attribute__((unused)))
-{
-#ifdef _MSC_VER
- char temp[FN_REFLEN],*end,*res,**old_env,*temp_env[1];
- old_env=environ;
- if (dir)
- {
- end=strend(dir)-1;
- if (!dir[0])
- { /* Change empty string to current dir */
- temp[0]= FN_CURLIB;
- temp[1]= 0;
- dir=temp;
- }
- else if (*end == FN_DEVCHAR)
- { /* Get current dir for drive */
- _fullpath(temp,dir,FN_REFLEN);
- dir=temp;
- }
- else if (*end == FN_LIBCHAR && dir < end && end[-1] != FN_DEVCHAR)
- {
- strmake(temp,dir,(uint) (end-dir)); /* Copy and remove last '\' */
- dir=temp;
- }
- environ=temp_env; /* Force use of dir (dir not checked) */
- temp_env[0]=0;
- }
- res=tempnam((char*) dir,(my_string) pfx);
- environ=old_env;
- return res;
-#else
-#ifdef __ZTC__
- if (!dir)
- { /* If empty test first if TMP can be used */
- dir=getenv("TMP");
- }
- return tempnam((char*) dir,(my_string) pfx); /* Use stand. dir with prefix */
-#else
-#ifdef HAVE_TEMPNAM
- char temp[2],*res,**old_env,*temp_env[1];
-
- if (dir && !dir[0])
- { /* Change empty string to current dir */
- temp[0]= FN_CURLIB;
- temp[1]= 0;
- dir=temp;
- }
-#ifdef OS2
- /* changing environ variable doesn't work with VACPP */
- char buffer[256];
- sprintf( buffer, "TMP=%s", dir);
- /* remove ending backslash */
- if (buffer[strlen(buffer)-1] == '\\')
- buffer[strlen(buffer)-1] = '\0';
- putenv( buffer);
-#elif !defined(__NETWARE__)
- old_env=(char**)environ;
- if (dir)
- { /* Don't use TMPDIR if dir is given */
- /*
- The following strange cast is required because the IBM compiler on AIX
- doesn't allow us to cast the value of environ.
- The cast of environ is needed as some systems doesn't allow us to
- update environ with a char ** pointer. (const mismatch)
- */
- (*(char***) &environ)=(char**) temp_env;
- temp_env[0]=0;
- }
-#endif
- res=tempnam((char*) dir,(my_string) pfx); /* Use stand. dir with prefix */
-#if !defined(OS2) && !defined(__NETWARE__)
- (*(char***) &environ)=(char**) old_env;
-#endif
- if (!res)
- DBUG_PRINT("error",("Got error: %d from tempnam",errno));
- return res;
-#else
- register long uniq;
- register int length;
- my_string pos,end_pos;
- DBUG_ENTER("my_tempnam");
- /* Make a uniq nummber */
- pthread_mutex_lock(&THR_LOCK_open);
- uniq= ((long) getpid() << 20) + (long) _my_tempnam_used++ ;
- pthread_mutex_unlock(&THR_LOCK_open);
- if (!dir && !(dir=getenv("TMPDIR"))) /* Use this if possibly */
- dir=P_tmpdir; /* Use system default */
- length=strlen(dir)+strlen(pfx)+1;
-
- DBUG_PRINT("test",("mallocing %d byte",length+8+sizeof(TMP_EXT)+1));
- if (!(pos=(char*) malloc(length+8+sizeof(TMP_EXT)+1)))
- {
- if (MyFlags & MY_FAE+MY_WME)
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),
- length+8+sizeof(TMP_EXT)+1);
- DBUG_RETURN(NullS);
- }
- end_pos=strmov(pos,dir);
- if (end_pos != pos && end_pos[-1] != FN_LIBCHAR)
- *end_pos++=FN_LIBCHAR;
- end_pos=strmov(end_pos,pfx);
-
- for (length=0 ; length < 8 && uniq ; length++)
- {
- *end_pos++= _dig_vec[(int) (uniq & 31)];
- uniq >>= 5;
- }
- VOID(strmov(end_pos,TMP_EXT));
- DBUG_PRINT("exit",("tempnam: '%s'",pos));
- DBUG_RETURN(pos);
-#endif /* HAVE_TEMPNAM */
-#endif /* __ZTC__ */
-#endif /* _MSC_VER */
-} /* my_tempnam */
diff --git a/ext/mysql/libmysql/my_thr_init.c b/ext/mysql/libmysql/my_thr_init.c
deleted file mode 100644
index a5b40a2d61..0000000000
--- a/ext/mysql/libmysql/my_thr_init.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
-** Functions to handle initializating and allocationg of all mysys & debug
-** thread variables.
-*/
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
-#ifdef THREAD
-#ifdef USE_TLS
-pthread_key(struct st_my_thread_var*, THR_KEY_mysys);
-#else
-pthread_key(struct st_my_thread_var, THR_KEY_mysys);
-#endif /* USE_TLS */
-pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
- THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_myisam,THR_LOCK_heap,
- THR_LOCK_net, THR_LOCK_charset;
-#ifndef HAVE_LOCALTIME_R
-pthread_mutex_t LOCK_localtime_r;
-#endif
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
-pthread_mutexattr_t my_fast_mutexattr;
-#endif
-#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
-pthread_mutexattr_t my_errchk_mutexattr;
-#endif
-
-/* FIXME Note. TlsAlloc does not set an auto destructor, so
- the function my_thread_global_free must be called from
- somewhere before final exit of the library */
-
-my_bool my_thread_global_init(void)
-{
- if (pthread_key_create(&THR_KEY_mysys,free))
- {
- fprintf(stderr,"Can't initialize threads: error %d\n",errno);
- exit(1);
- }
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
- pthread_mutexattr_init(&my_fast_mutexattr);
- pthread_mutexattr_setkind_np(&my_fast_mutexattr,PTHREAD_MUTEX_ADAPTIVE_NP);
-#endif
-#ifdef PPTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
- pthread_mutexattr_init(&my_errchk_mutexattr);
- pthread_mutexattr_setkind_np(&my_errchk_mutexattr,
- PTHREAD_MUTEX_ERRORCHECK_NP);
-#endif
-
- pthread_mutex_init(&THR_LOCK_malloc,MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&THR_LOCK_open,MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&THR_LOCK_keycache,MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&THR_LOCK_lock,MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&THR_LOCK_isam,MY_MUTEX_INIT_SLOW);
- pthread_mutex_init(&THR_LOCK_myisam,MY_MUTEX_INIT_SLOW);
- pthread_mutex_init(&THR_LOCK_heap,MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&THR_LOCK_net,MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&THR_LOCK_charset,MY_MUTEX_INIT_FAST);
-#if defined( __WIN__) || defined(OS2)
- win_pthread_init();
-#endif
-#ifndef HAVE_LOCALTIME_R
- pthread_mutex_init(&LOCK_localtime_r,MY_MUTEX_INIT_SLOW);
-#endif
- return my_thread_init();
-}
-
-void my_thread_global_end(void)
-{
-#if defined(USE_TLS)
- (void) TlsFree(THR_KEY_mysys);
-#endif
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
- pthread_mutexattr_destroy(&my_fast_mutexattr);
-#endif
-#ifdef PPTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
- pthread_mutexattr_destroy(&my_errchk_mutexattr);
-#endif
-}
-
-static long thread_id=0;
-
-/*
- We can't use mutex_locks here if we are using windows as
- we may have compiled the program with SAFE_MUTEX, in which
- case the checking of mutex_locks will not work until
- the pthread_self thread specific variable is initialized.
-*/
-
-my_bool my_thread_init(void)
-{
- struct st_my_thread_var *tmp;
-#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
- pthread_mutex_lock(&THR_LOCK_lock);
-#endif
-#if !defined(__WIN__) || defined(USE_TLS)
- if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys))
- {
- pthread_mutex_unlock(&THR_LOCK_lock);
- return 0; /* Safequard */
- }
- /* We must have many calloc() here because these are freed on
- pthread_exit */
- if (!(tmp=(struct st_my_thread_var *)
- calloc(1,sizeof(struct st_my_thread_var))))
- {
- pthread_mutex_unlock(&THR_LOCK_lock);
- return 1;
- }
- pthread_setspecific(THR_KEY_mysys,tmp);
-
-#else
- if (THR_KEY_mysys.id) /* Already initialized */
- {
-#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
- pthread_mutex_unlock(&THR_LOCK_lock);
-#endif
- return 0;
- }
- tmp= &THR_KEY_mysys;
-#endif
- tmp->id= ++thread_id;
- pthread_mutex_init(&tmp->mutex,MY_MUTEX_INIT_FAST);
- pthread_cond_init(&tmp->suspend, NULL);
-#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
- pthread_mutex_unlock(&THR_LOCK_lock);
-#endif
- return 0;
-}
-
-void my_thread_end(void)
-{
- struct st_my_thread_var *tmp=my_thread_var;
- if (tmp)
- {
-#if !defined(DBUG_OFF)
- if (tmp->dbug)
- {
- free(tmp->dbug);
- tmp->dbug=0;
- }
-#endif
-#if !defined(__bsdi__) || defined(HAVE_mit_thread) /* bsdi dumps core here */
- pthread_cond_destroy(&tmp->suspend);
-#endif
- pthread_mutex_destroy(&tmp->mutex);
-#if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS)
- free(tmp);
-#endif
- }
-#if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS)
- pthread_setspecific(THR_KEY_mysys,0);
-#endif
-}
-
-struct st_my_thread_var *_my_thread_var(void)
-{
- struct st_my_thread_var *tmp=
- my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
-#if defined(USE_TLS)
- /* This can only happen in a .DLL */
- if (!tmp)
- {
- my_thread_init();
- tmp=my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
- }
-#endif
- return tmp;
-}
-
-/****************************************************************************
-** Get name of current thread.
-****************************************************************************/
-
-#define UNKNOWN_THREAD -1
-
-long my_thread_id()
-{
-#if defined(HAVE_PTHREAD_GETSEQUENCE_NP)
- return pthread_getsequence_np(pthread_self());
-#elif (defined(__sun) || defined(__sgi) || defined(__linux__)) && !defined(HAVE_mit_thread)
- return pthread_self();
-#else
- return my_thread_var->id;
-#endif
-}
-
-#ifdef DBUG_OFF
-const char *my_thread_name(void)
-{
- return "no_name";
-}
-
-#else
-
-const char *my_thread_name(void)
-{
- char name_buff[100];
- struct st_my_thread_var *tmp=my_thread_var;
- if (!tmp->name[0])
- {
- long id=my_thread_id();
- sprintf(name_buff,"T@%ld", id);
- strmake(tmp->name,name_buff,THREAD_NAME_SIZE);
- }
- return tmp->name;
-}
-#endif /* DBUG_OFF */
-
-#endif /* THREAD */
diff --git a/ext/mysql/libmysql/my_wincond.c b/ext/mysql/libmysql/my_wincond.c
deleted file mode 100644
index 555ab3bcf7..0000000000
--- a/ext/mysql/libmysql/my_wincond.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*****************************************************************************
-** The following is a simple implementation of posix conditions
-*****************************************************************************/
-
-#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */
-#include "mysys_priv.h"
-#if defined(THREAD) && defined(__WIN__)
-#include <m_string.h>
-#undef getpid
-#include <process.h>
-#include <sys/timeb.h>
-
-int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
-{
- cond->waiting=0;
- cond->semaphore=CreateSemaphore(NULL,0,0x7FFFFFFF,NullS);
- if (!cond->semaphore)
- return ENOMEM;
- return 0;
-}
-
-int pthread_cond_destroy(pthread_cond_t *cond)
-{
- return CloseHandle(cond->semaphore) ? 0 : EINVAL;
-}
-
-
-int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
-{
- InterlockedIncrement(&cond->waiting);
- LeaveCriticalSection(mutex);
- WaitForSingleObject(cond->semaphore,INFINITE);
- InterlockedDecrement(&cond->waiting);
- EnterCriticalSection(mutex);
- return 0 ;
-}
-
-int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
- struct timespec *abstime)
-{
- struct _timeb curtime;
- int result;
- long timeout;
- _ftime(&curtime);
- timeout= ((long) (abstime->tv_sec - curtime.time)*1000L +
- (long)((abstime->tv_nsec/1000) - curtime.millitm)/1000L);
- if (timeout < 0) /* Some safety */
- timeout = 0L;
- InterlockedIncrement(&cond->waiting);
- LeaveCriticalSection(mutex);
- result=WaitForSingleObject(cond->semaphore,timeout);
- InterlockedDecrement(&cond->waiting);
- EnterCriticalSection(mutex);
-
- return result == WAIT_TIMEOUT ? ETIMEDOUT : 0;
-}
-
-
-int pthread_cond_signal(pthread_cond_t *cond)
-{
- long prev_count;
- if (cond->waiting)
- ReleaseSemaphore(cond->semaphore,1,&prev_count);
- return 0;
-}
-
-
-int pthread_cond_broadcast(pthread_cond_t *cond)
-{
- long prev_count;
- if (cond->waiting)
- ReleaseSemaphore(cond->semaphore,cond->waiting,&prev_count);
- return 0 ;
-}
-
-
-int pthread_attr_init(pthread_attr_t *connect_att)
-{
- connect_att->dwStackSize = 0;
- connect_att->dwCreatingFlag = 0;
- connect_att->priority = 0;
- return 0;
-}
-
-int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack)
-{
- connect_att->dwStackSize=stack;
- return 0;
-}
-
-int pthread_attr_setprio(pthread_attr_t *connect_att,int priority)
-{
- connect_att->priority=priority;
- return 0;
-}
-
-int pthread_attr_destroy(pthread_attr_t *connect_att)
-{
- bzero((gptr) connect_att,sizeof(*connect_att));
- return 0;
-}
-
-/****************************************************************************
-** Fix localtime_r() to be a bit safer
-****************************************************************************/
-
-struct tm *localtime_r(const time_t *timep,struct tm *tmp)
-{
- if (*timep == (time_t) -1) /* This will crash win32 */
- {
- bzero(tmp,sizeof(*tmp));
- }
- else
- {
- struct tm *res=localtime(timep);
- if (!res) /* Wrong date */
- {
- bzero(tmp,sizeof(*tmp)); /* Keep things safe */
- return 0;
- }
- *tmp= *res;
- }
- return tmp;
-}
-#endif /* __WIN__ */
diff --git a/ext/mysql/libmysql/my_winthread.c b/ext/mysql/libmysql/my_winthread.c
deleted file mode 100644
index 5d06b698ee..0000000000
--- a/ext/mysql/libmysql/my_winthread.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*****************************************************************************
-** Simulation of posix threads calls for WIN95 and NT
-*****************************************************************************/
-
-/* SAFE_MUTEX will not work until the thread structure is up to date */
-#undef SAFE_MUTEX
-
-#include "mysys_priv.h"
-#if defined(THREAD) && defined(__WIN__)
-#include <m_string.h>
-#undef getpid
-#include <process.h>
-
-static pthread_mutex_t THR_LOCK_thread;
-
-struct pthread_map
-{
- HANDLE pthreadself;
- pthread_handler func;
- void *param;
-};
-
-void win_pthread_init(void)
-{
- pthread_mutex_init(&THR_LOCK_thread,MY_MUTEX_INIT_FAST);
-}
-
-/*
-** We have tried to use '_beginthreadex' instead of '_beginthread' here
-** but in this case the program leaks about 512 characters for each
-** created thread !
-** As we want to save the created thread handler for other threads to
-** use and to be returned by pthread_self() (instead of the Win32 pseudo
-** handler), we have to go trough pthread_start() to catch the returned handler
-** in the new thread.
-*/
-
-static pthread_handler_decl(pthread_start,param)
-{
- pthread_handler func=((struct pthread_map *) param)->func;
- void *func_param=((struct pthread_map *) param)->param;
- my_thread_init(); /* Will always succeed in windows */
- pthread_mutex_lock(&THR_LOCK_thread); /* Wait for beginthread to return */
- win_pthread_self=((struct pthread_map *) param)->pthreadself;
- pthread_mutex_unlock(&THR_LOCK_thread);
- free((char*) param); /* Free param from create */
- pthread_exit((void*) (*func)(func_param));
- return 0; /* Safety */
-}
-
-
-int pthread_create(pthread_t *thread_id, pthread_attr_t *attr,
- pthread_handler func, void *param)
-{
- HANDLE hThread;
- struct pthread_map *map;
- DBUG_ENTER("pthread_create");
-
- if (!(map=malloc(sizeof(*map))))
- DBUG_RETURN(-1);
- map->func=func;
- map->param=param;
- pthread_mutex_lock(&THR_LOCK_thread);
-#ifdef __BORLANDC__
- hThread=(HANDLE)_beginthread((void(_USERENTRY *)(void *)) pthread_start,
- attr->dwStackSize ? attr->dwStackSize :
- 65535, (void*) map);
-#else
- hThread=(HANDLE)_beginthread((void( __cdecl *)(void *)) pthread_start,
- attr->dwStackSize ? attr->dwStackSize :
- 65535, (void*) map);
-#endif
- DBUG_PRINT("info", ("hThread=%lu",(long) hThread));
- *thread_id=map->pthreadself=hThread;
- pthread_mutex_unlock(&THR_LOCK_thread);
-
- if (hThread == (HANDLE) -1)
- {
- int error=errno;
- DBUG_PRINT("error",
- ("Can't create thread to handle request (error %d)",error));
- DBUG_RETURN(error ? error : -1);
- }
- VOID(SetThreadPriority(hThread, attr->priority)) ;
- DBUG_RETURN(0);
-}
-
-
-void pthread_exit(void *a)
-{
- _endthread();
-}
-
-/* This is neaded to get the macro pthread_setspecific to work */
-
-int win_pthread_setspecific(void *a,void *b,uint length)
-{
- memcpy(a,b,length);
- return 0;
-}
-
-#endif
diff --git a/ext/mysql/libmysql/my_write.c b/ext/mysql/libmysql/my_write.c
deleted file mode 100644
index 0aec283acc..0000000000
--- a/ext/mysql/libmysql/my_write.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-#include <errno.h>
-
-
- /* Write a chunk of bytes to a file */
-
-uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags)
-{
- uint writenbytes,errors;
- ulong written;
- DBUG_ENTER("my_write");
- DBUG_PRINT("my",("Fd: %d Buffer: %lx Count: %d MyFlags: %d",
- Filedes, Buffer, Count, MyFlags));
- errors=0; written=0L;
-
- for (;;)
- {
- if ((writenbytes = (uint) write(Filedes, Buffer, Count)) == Count)
- break;
- if ((int) writenbytes != -1)
- { /* Safeguard */
- written+=writenbytes;
- Buffer+=writenbytes;
- Count-=writenbytes;
- }
- my_errno=errno;
- DBUG_PRINT("error",("Write only %d bytes, error: %d",
- writenbytes,my_errno));
-#ifndef NO_BACKGROUND
-#ifdef THREAD
- if (my_thread_var->abort)
- MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */
-#endif
- if (my_errno == ENOSPC && (MyFlags & MY_WAIT_IF_FULL) &&
- (uint) writenbytes != (uint) -1)
- {
- if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
- my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
- my_filename(Filedes));
- VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
- continue;
- }
- if (!writenbytes)
- {
- /* We may come here on an interrupt or if the file quote is exeeded */
- if (my_errno == EINTR)
- continue;
- if (!errors++) /* Retry once */
- {
- errno=EFBIG; /* Assume this is the error */
- continue;
- }
- }
- else if ((uint) writenbytes != (uint) -1)
- continue; /* Retry */
-#endif
- if (MyFlags & (MY_NABP | MY_FNABP))
- {
- if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
- {
- my_error(EE_WRITE, MYF(ME_BELL+ME_WAITTANG),
- my_filename(Filedes),my_errno);
- }
- DBUG_RETURN(MY_FILE_ERROR); /* Error on read */
- }
- else
- break; /* Return bytes written */
- }
- if (MyFlags & (MY_NABP | MY_FNABP))
- DBUG_RETURN(0); /* Want only errors */
- DBUG_RETURN(writenbytes+written);
-} /* my_write */
diff --git a/ext/mysql/libmysql/mysql.h b/ext/mysql/libmysql/mysql.h
deleted file mode 100644
index 11e099e531..0000000000
--- a/ext/mysql/libmysql/mysql.h
+++ /dev/null
@@ -1,298 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* defines for the libmysql library */
-
-#ifndef _mysql_h
-#define _mysql_h
-
-#ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */
-#undef WIN
-#undef _WIN
-#undef _WIN32
-#undef _WIN64
-#undef __WIN__
-#endif
-
-#ifndef MYSQL_SERVER
-#ifdef __cplusplus
-extern "C" {
-#endif
-#endif
-
-#ifndef _global_h /* If not standard header */
-#include <sys/types.h>
-#ifdef __LCC__
-#include <winsock.h> /* For windows */
-#endif
-typedef char my_bool;
-#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__)
-#define __WIN__
-#endif
-#if !defined(__WIN__)
-#define STDCALL
-#else
-#define STDCALL __stdcall
-#endif
-typedef char * gptr;
-
-#ifndef ST_USED_MEM_DEFINED
-#define ST_USED_MEM_DEFINED
-typedef struct st_used_mem { /* struct for once_alloc */
- struct st_used_mem *next; /* Next block in use */
- unsigned int left; /* memory left in block */
- unsigned int size; /* size of block */
-} USED_MEM;
-typedef struct st_mem_root {
- USED_MEM *free;
- USED_MEM *used;
- USED_MEM *pre_alloc;
- unsigned int min_malloc;
- unsigned int block_size;
-
- void (*error_handler)(void);
-} MEM_ROOT;
-#endif
-
-#ifndef my_socket_defined
-#ifdef __WIN__
-#define my_socket SOCKET
-#else
-typedef int my_socket;
-#endif
-#endif
-#endif
-#include "mysql_com.h"
-#include "mysql_version.h"
-
-extern unsigned int mysql_port;
-extern char *mysql_unix_port;
-
-#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG)
-#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG)
-#define IS_BLOB(n) ((n) & BLOB_FLAG)
-#define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR)
-#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
-#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR)
-
-typedef struct st_mysql_field {
- char *name; /* Name of column */
- char *table; /* Table of column if column was a field */
- char *def; /* Default value (set by mysql_list_fields) */
- enum enum_field_types type; /* Type of field. Se mysql_com.h for types */
- unsigned int length; /* Width of column */
- unsigned int max_length; /* Max width of selected set */
- unsigned int flags; /* Div flags */
- unsigned int decimals; /* Number of decimals in field */
-} MYSQL_FIELD;
-
-typedef char **MYSQL_ROW; /* return data as array of strings */
-typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
-
-#if defined(NO_CLIENT_LONG_LONG)
-typedef unsigned long my_ulonglong;
-#elif defined (__WIN__)
-typedef unsigned __int64 my_ulonglong;
-#else
-typedef unsigned long long my_ulonglong;
-#endif
-
-#define MYSQL_COUNT_ERROR (~(my_ulonglong) 0)
-
-typedef struct st_mysql_rows {
- struct st_mysql_rows *next; /* list of rows */
- MYSQL_ROW data;
-} MYSQL_ROWS;
-
-typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */
-
-typedef struct st_mysql_data {
- my_ulonglong rows;
- unsigned int fields;
- MYSQL_ROWS *data;
- MEM_ROOT alloc;
-} MYSQL_DATA;
-
-struct st_mysql_options {
- unsigned int connect_timeout,client_flag;
- my_bool compress,named_pipe;
- unsigned int port;
- char *host,*init_command,*user,*password,*unix_socket,*db;
- char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name;
- my_bool use_ssl; /* if to use SSL or not */
- char *ssl_key; /* PEM key file */
- char *ssl_cert; /* PEM cert file */
- char *ssl_ca; /* PEM CA file */
- char *ssl_capath; /* PEM directory of CA-s? */
-};
-
-enum mysql_option { MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS,
- MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND,
- MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,
- MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME,
- MYSQL_OPT_LOCAL_INFILE};
-
-enum mysql_status { MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,
- MYSQL_STATUS_USE_RESULT};
-
-typedef struct st_mysql {
- NET net; /* Communication parameters */
- gptr connector_fd; /* ConnectorFd for SSL */
- char *host,*user,*passwd,*unix_socket,*server_version,*host_info,
- *info,*db;
- unsigned int port,client_flag,server_capabilities;
- unsigned int protocol_version;
- unsigned int field_count;
- unsigned int server_status;
- unsigned long thread_id; /* Id for connection in server */
- my_ulonglong affected_rows;
- my_ulonglong insert_id; /* id if insert on table with NEXTNR */
- my_ulonglong extra_info; /* Used by mysqlshow */
- unsigned long packet_length;
- enum mysql_status status;
- MYSQL_FIELD *fields;
- MEM_ROOT field_alloc;
- my_bool free_me; /* If free in mysql_close */
- my_bool reconnect; /* set to 1 if automatic reconnect */
- struct st_mysql_options options;
- char scramble_buff[9];
- struct charset_info_st *charset;
- unsigned int server_language;
-} MYSQL;
-
-
-typedef struct st_mysql_res {
- my_ulonglong row_count;
- unsigned int field_count, current_field;
- MYSQL_FIELD *fields;
- MYSQL_DATA *data;
- MYSQL_ROWS *data_cursor;
- MEM_ROOT field_alloc;
- MYSQL_ROW row; /* If unbuffered read */
- MYSQL_ROW current_row; /* buffer to current row */
- unsigned long *lengths; /* column lengths of current row */
- MYSQL *handle; /* for unbuffered reads */
- my_bool eof; /* Used my mysql_fetch_row */
-} MYSQL_RES;
-
-/* Functions to get information from the MYSQL and MYSQL_RES structures */
-/* Should definitely be used if one uses shared libraries */
-
-my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res);
-unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
-my_bool STDCALL mysql_eof(MYSQL_RES *res);
-MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res,
- unsigned int fieldnr);
-MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res);
-MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res);
-unsigned int STDCALL mysql_field_tell(MYSQL_RES *res);
-
-unsigned int STDCALL mysql_field_count(MYSQL *mysql);
-my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql);
-my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql);
-unsigned int STDCALL mysql_errno(MYSQL *mysql);
-char * STDCALL mysql_error(MYSQL *mysql);
-char * STDCALL mysql_info(MYSQL *mysql);
-unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
-const char * STDCALL mysql_character_set_name(MYSQL *mysql);
-
-MYSQL * STDCALL mysql_init(MYSQL *mysql);
-#ifdef HAVE_OPENSSL
-int STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
- const char *cert, const char *ca,
- const char *capath);
-char * STDCALL mysql_ssl_cipher(MYSQL *mysql);
-int STDCALL mysql_ssl_clear(MYSQL *mysql);
-#endif /* HAVE_OPENSSL */
-MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host,
- const char *user, const char *passwd);
-my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
- const char *passwd, const char *db);
-#if MYSQL_VERSION_ID >= 32200
-MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
- const char *user,
- const char *passwd,
- const char *db,
- unsigned int port,
- const char *unix_socket,
- unsigned int clientflag);
-#else
-MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
- const char *user,
- const char *passwd,
- unsigned int port,
- const char *unix_socket,
- unsigned int clientflag);
-#endif
-void STDCALL mysql_close(MYSQL *sock);
-int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
-int STDCALL mysql_query(MYSQL *mysql, const char *q);
-int STDCALL mysql_send_query(MYSQL *mysql, const char *q,
- unsigned int length);
-int STDCALL mysql_read_query_result(MYSQL *mysql);
-int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
- unsigned int length);
-int STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
-int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
-int STDCALL mysql_shutdown(MYSQL *mysql);
-int STDCALL mysql_dump_debug_info(MYSQL *mysql);
-int STDCALL mysql_refresh(MYSQL *mysql,
- unsigned int refresh_options);
-int STDCALL mysql_kill(MYSQL *mysql,unsigned long pid);
-int STDCALL mysql_ping(MYSQL *mysql);
-char * STDCALL mysql_stat(MYSQL *mysql);
-char * STDCALL mysql_get_server_info(MYSQL *mysql);
-char * STDCALL mysql_get_client_info(void);
-char * STDCALL mysql_get_host_info(MYSQL *mysql);
-unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql);
-MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
-MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
-MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
- const char *wild);
-MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql);
-MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql);
-MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql);
-int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
- const char *arg);
-void STDCALL mysql_free_result(MYSQL_RES *result);
-void STDCALL mysql_data_seek(MYSQL_RES *result,
- my_ulonglong offset);
-MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET);
-MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
- MYSQL_FIELD_OFFSET offset);
-MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result);
-unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result);
-MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result);
-unsigned long STDCALL mysql_escape_string(char *to,const char *from,
- unsigned long from_length);
-unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
- char *to,const char *from,
- unsigned long length);
-void STDCALL mysql_debug(const char *debug);
-char * STDCALL mysql_odbc_escape_string(MYSQL *mysql,
- char *to,
- unsigned long to_length,
- const char *from,
- unsigned long from_length,
- void *param,
- char *
- (*extend_buffer)
- (void *, char *to,
- unsigned long *length));
-void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
-unsigned int STDCALL mysql_thread_safe(void);
-
-
-#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
-
-/* new api functions */
-
-#define HAVE_MYSQL_REAL_CONNECT
-
-#ifndef MYSQL_SERVER
-#ifdef __cplusplus
-}
-#endif
-#endif
-
-#endif
diff --git a/ext/mysql/libmysql/mysql.m4 b/ext/mysql/libmysql/mysql.m4
deleted file mode 100644
index 23143e36a8..0000000000
--- a/ext/mysql/libmysql/mysql.m4
+++ /dev/null
@@ -1,16 +0,0 @@
-AC_DEFUN(MYSQL_CHECKS,[
-
-AC_REQUIRE([AC_PROG_CC])
-AC_REQUIRE([AC_PROG_LN_S])
-AC_REQUIRE([AC_PROG_RANLIB])
-
-AC_DEFINE(UNDEF_THREADS_HACK,,[ ])
-
-MYSQL_HEADER_CHECKS
-MYSQL_TYPE_CHECKS
-MYSQL_FUNCTION_CHECKS
-MYSQL_CHECK_PTHREAD_GETSPECIFIC
-MYSQL_CHECK_PTHREAD_MUTEX_INIT
-MYSQL_CHECK_READDIR_R_ARGS
-MYSQL_CHECK_SIGWAIT_STYLE
-])
diff --git a/ext/mysql/libmysql/mysql_com.h b/ext/mysql/libmysql/mysql_com.h
deleted file mode 100644
index 75a07202c7..0000000000
--- a/ext/mysql/libmysql/mysql_com.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
-** Common definition between mysql server & client
-*/
-
-#ifndef _mysql_com_h
-#define _mysql_com_h
-
-
-#define NAME_LEN 64 /* Field/table name length */
-#define HOSTNAME_LENGTH 60
-#define USERNAME_LENGTH 16
-#define SERVER_VERSION_LENGTH 60
-
-#define LOCAL_HOST "localhost"
-#define LOCAL_HOST_NAMEDPIPE "."
-
-#if defined(__WIN__) && !defined( _CUSTOMCONFIG_)
-#define MYSQL_NAMEDPIPE "MySQL"
-#define MYSQL_SERVICENAME "MySql"
-#endif /* __WIN__ */
-
-enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY,
- COM_FIELD_LIST,COM_CREATE_DB,COM_DROP_DB,COM_REFRESH,
- COM_SHUTDOWN,COM_STATISTICS,
- COM_PROCESS_INFO,COM_CONNECT,COM_PROCESS_KILL,
- COM_DEBUG,COM_PING,COM_TIME,COM_DELAYED_INSERT,
- COM_CHANGE_USER, COM_BINLOG_DUMP,
- COM_TABLE_DUMP, COM_CONNECT_OUT};
-
-#define NOT_NULL_FLAG 1 /* Field can't be NULL */
-#define PRI_KEY_FLAG 2 /* Field is part of a primary key */
-#define UNIQUE_KEY_FLAG 4 /* Field is part of a unique key */
-#define MULTIPLE_KEY_FLAG 8 /* Field is part of a key */
-#define BLOB_FLAG 16 /* Field is a blob */
-#define UNSIGNED_FLAG 32 /* Field is unsigned */
-#define ZEROFILL_FLAG 64 /* Field is zerofill */
-#define BINARY_FLAG 128
-/* The following are only sent to new clients */
-#define ENUM_FLAG 256 /* field is an enum */
-#define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */
-#define TIMESTAMP_FLAG 1024 /* Field is a timestamp */
-#define SET_FLAG 2048 /* field is a set */
-#define NUM_FLAG 32768 /* Field is num (for clients) */
-#define PART_KEY_FLAG 16384 /* Intern; Part of some key */
-#define GROUP_FLAG 32768 /* Intern: Group field */
-#define UNIQUE_FLAG 65536 /* Intern: Used by sql_yacc */
-
-#define REFRESH_GRANT 1 /* Refresh grant tables */
-#define REFRESH_LOG 2 /* Start on new log file */
-#define REFRESH_TABLES 4 /* close all tables */
-#define REFRESH_HOSTS 8 /* Flush host cache */
-#define REFRESH_STATUS 16 /* Flush status variables */
-#define REFRESH_THREADS 32 /* Flush status variables */
-#define REFRESH_SLAVE 64 /* Reset master info and restart slave
- thread */
-#define REFRESH_MASTER 128 /* Remove all bin logs in the index
- and truncate the index */
-
-/* The following can't be set with mysql_refresh() */
-#define REFRESH_READ_LOCK 16384 /* Lock tables for read */
-#define REFRESH_FAST 32768 /* Intern flag */
-
-#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
-#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
-#define CLIENT_LONG_FLAG 4 /* Get all column flags */
-#define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */
-#define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */
-#define CLIENT_COMPRESS 32 /* Can use compression protocol */
-#define CLIENT_ODBC 64 /* Odbc client */
-#define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */
-#define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */
-#define CLIENT_CHANGE_USER 512 /* Support the mysql_change_user() */
-#define CLIENT_INTERACTIVE 1024 /* This is an interactive client */
-#define CLIENT_SSL 2048 /* Switch to SSL after handshake */
-#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */
-#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */
-
-#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
-#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
-
-#define MYSQL_ERRMSG_SIZE 200
-#define NET_READ_TIMEOUT 30 /* Timeout on read */
-#define NET_WRITE_TIMEOUT 60 /* Timeout on write */
-#define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */
-
-#ifndef Vio_defined
-#define Vio_defined
-#ifdef HAVE_VIO
-class Vio; /* Fill Vio class in C++ */
-#else
-struct st_vio; /* Only C */
-typedef struct st_vio Vio;
-#endif
-#endif
-
-typedef struct st_net {
- Vio* vio;
- my_socket fd; /* For Perl DBI/dbd */
- int fcntl;
- unsigned char *buff,*buff_end,*write_pos,*read_pos;
- char last_error[MYSQL_ERRMSG_SIZE];
- unsigned int last_errno,max_packet,timeout,pkt_nr;
- unsigned char error;
- my_bool return_errno,compress;
- my_bool no_send_ok; /* needed if we are doing several
- queries in one command ( as in LOAD TABLE ... FROM MASTER ),
- and do not want to confuse the client with OK at the wrong time
- */
- unsigned long remain_in_buf,length, buf_length, where_b;
- unsigned int *return_status;
- unsigned char reading_or_writing;
- char save_char;
-} NET;
-
-#define packet_error ((unsigned int) -1)
-
-enum enum_field_types { FIELD_TYPE_DECIMAL, FIELD_TYPE_TINY,
- FIELD_TYPE_SHORT, FIELD_TYPE_LONG,
- FIELD_TYPE_FLOAT, FIELD_TYPE_DOUBLE,
- FIELD_TYPE_NULL, FIELD_TYPE_TIMESTAMP,
- FIELD_TYPE_LONGLONG,FIELD_TYPE_INT24,
- FIELD_TYPE_DATE, FIELD_TYPE_TIME,
- FIELD_TYPE_DATETIME, FIELD_TYPE_YEAR,
- FIELD_TYPE_NEWDATE,
- FIELD_TYPE_ENUM=247,
- FIELD_TYPE_SET=248,
- FIELD_TYPE_TINY_BLOB=249,
- FIELD_TYPE_MEDIUM_BLOB=250,
- FIELD_TYPE_LONG_BLOB=251,
- FIELD_TYPE_BLOB=252,
- FIELD_TYPE_VAR_STRING=253,
- FIELD_TYPE_STRING=254
-};
-
-#define FIELD_TYPE_CHAR FIELD_TYPE_TINY /* For compability */
-#define FIELD_TYPE_INTERVAL FIELD_TYPE_ENUM /* For compability */
-
-extern unsigned long max_allowed_packet;
-extern unsigned long net_buffer_length;
-
-#define net_new_transaction(net) ((net)->pkt_nr=0)
-
-int my_net_init(NET *net, Vio* vio);
-void net_end(NET *net);
-void net_clear(NET *net);
-int net_flush(NET *net);
-int my_net_write(NET *net,const char *packet,unsigned long len);
-int net_write_command(NET *net,unsigned char command,const char *packet,
- unsigned long len);
-int net_real_write(NET *net,const char *packet,unsigned long len);
-unsigned int my_net_read(NET *net);
-
-struct rand_struct {
- unsigned long seed1,seed2,max_value;
- double max_value_dbl;
-};
-
- /* The following is for user defined functions */
-
-enum Item_result {STRING_RESULT,REAL_RESULT,INT_RESULT};
-
-typedef struct st_udf_args
-{
- unsigned int arg_count; /* Number of arguments */
- enum Item_result *arg_type; /* Pointer to item_results */
- char **args; /* Pointer to argument */
- unsigned long *lengths; /* Length of string arguments */
- char *maybe_null; /* Set to 1 for all maybe_null args */
-} UDF_ARGS;
-
- /* This holds information about the result */
-
-typedef struct st_udf_init
-{
- my_bool maybe_null; /* 1 if function can return NULL */
- unsigned int decimals; /* for real functions */
- unsigned int max_length; /* For string functions */
- char *ptr; /* free pointer for function data */
- my_bool const_item; /* 0 if result is independent of arguments */
-} UDF_INIT;
-
- /* Constants when using compression */
-#define NET_HEADER_SIZE 4 /* standard header size */
-#define COMP_HEADER_SIZE 3 /* compression header extra size */
-
- /* Prototypes to password functions */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void randominit(struct rand_struct *,unsigned long seed1,
- unsigned long seed2);
-double rnd(struct rand_struct *);
-void make_scrambled_password(char *to,const char *password);
-void get_salt_from_password(unsigned long *res,const char *password);
-void make_password_from_salt(char *to, unsigned long *hash_res);
-char *scramble(char *to,const char *message,const char *password,
- my_bool old_ver);
-my_bool check_scramble(const char *, const char *message,
- unsigned long *salt,my_bool old_ver);
-char *get_tty_password(char *opt_message);
-void hash_password(unsigned long *result, const char *password);
-
-/* Some other useful functions */
-
-void my_init(void);
-void load_defaults(const char *conf_file, const char **groups,
- int *argc, char ***argv);
-my_bool my_thread_init(void);
-void my_thread_end(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */
-
-#endif
diff --git a/ext/mysql/libmysql/mysql_version.h b/ext/mysql/libmysql/mysql_version.h
deleted file mode 100644
index 0ebbae1191..0000000000
--- a/ext/mysql/libmysql/mysql_version.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Version numbers for protocol & mysqld */
-
-#ifdef _CUSTOMCONFIG_
-#include <custom_conf.h>
-#else
-#define PROTOCOL_VERSION 10
-#define MYSQL_SERVER_VERSION "3.23.49"
-#define MYSQL_SERVER_SUFFIX ""
-#define FRM_VER 6
-#define MYSQL_VERSION_ID 32349
-#define MYSQL_PORT 3306
-
-#ifndef MYSQL_UNIX_ADDR
-#define MYSQL_UNIX_ADDR "/tmp/mysql.sock"
-#endif
-
-/* mysqld compile time options */
-#ifndef MYSQL_CHARSET
-#define MYSQL_CHARSET "latin1"
-#endif
-#endif
diff --git a/ext/mysql/libmysql/mysqld_error.h b/ext/mysql/libmysql/mysqld_error.h
deleted file mode 100644
index 81e0dd1d06..0000000000
--- a/ext/mysql/libmysql/mysqld_error.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/* Definefile for errormessagenumbers */
-
-#define ER_HASHCHK 1000
-#define ER_NISAMCHK 1001
-#define ER_NO 1002
-#define ER_YES 1003
-#define ER_CANT_CREATE_FILE 1004
-#define ER_CANT_CREATE_TABLE 1005
-#define ER_CANT_CREATE_DB 1006
-#define ER_DB_CREATE_EXISTS 1007
-#define ER_DB_DROP_EXISTS 1008
-#define ER_DB_DROP_DELETE 1009
-#define ER_DB_DROP_RMDIR 1010
-#define ER_CANT_DELETE_FILE 1011
-#define ER_CANT_FIND_SYSTEM_REC 1012
-#define ER_CANT_GET_STAT 1013
-#define ER_CANT_GET_WD 1014
-#define ER_CANT_LOCK 1015
-#define ER_CANT_OPEN_FILE 1016
-#define ER_FILE_NOT_FOUND 1017
-#define ER_CANT_READ_DIR 1018
-#define ER_CANT_SET_WD 1019
-#define ER_CHECKREAD 1020
-#define ER_DISK_FULL 1021
-#define ER_DUP_KEY 1022
-#define ER_ERROR_ON_CLOSE 1023
-#define ER_ERROR_ON_READ 1024
-#define ER_ERROR_ON_RENAME 1025
-#define ER_ERROR_ON_WRITE 1026
-#define ER_FILE_USED 1027
-#define ER_FILSORT_ABORT 1028
-#define ER_FORM_NOT_FOUND 1029
-#define ER_GET_ERRNO 1030
-#define ER_ILLEGAL_HA 1031
-#define ER_KEY_NOT_FOUND 1032
-#define ER_NOT_FORM_FILE 1033
-#define ER_NOT_KEYFILE 1034
-#define ER_OLD_KEYFILE 1035
-#define ER_OPEN_AS_READONLY 1036
-#define ER_OUTOFMEMORY 1037
-#define ER_OUT_OF_SORTMEMORY 1038
-#define ER_UNEXPECTED_EOF 1039
-#define ER_CON_COUNT_ERROR 1040
-#define ER_OUT_OF_RESOURCES 1041
-#define ER_BAD_HOST_ERROR 1042
-#define ER_HANDSHAKE_ERROR 1043
-#define ER_DBACCESS_DENIED_ERROR 1044
-#define ER_ACCESS_DENIED_ERROR 1045
-#define ER_NO_DB_ERROR 1046
-#define ER_UNKNOWN_COM_ERROR 1047
-#define ER_BAD_NULL_ERROR 1048
-#define ER_BAD_DB_ERROR 1049
-#define ER_TABLE_EXISTS_ERROR 1050
-#define ER_BAD_TABLE_ERROR 1051
-#define ER_NON_UNIQ_ERROR 1052
-#define ER_SERVER_SHUTDOWN 1053
-#define ER_BAD_FIELD_ERROR 1054
-#define ER_WRONG_FIELD_WITH_GROUP 1055
-#define ER_WRONG_GROUP_FIELD 1056
-#define ER_WRONG_SUM_SELECT 1057
-#define ER_WRONG_VALUE_COUNT 1058
-#define ER_TOO_LONG_IDENT 1059
-#define ER_DUP_FIELDNAME 1060
-#define ER_DUP_KEYNAME 1061
-#define ER_DUP_ENTRY 1062
-#define ER_WRONG_FIELD_SPEC 1063
-#define ER_PARSE_ERROR 1064
-#define ER_EMPTY_QUERY 1065
-#define ER_NONUNIQ_TABLE 1066
-#define ER_INVALID_DEFAULT 1067
-#define ER_MULTIPLE_PRI_KEY 1068
-#define ER_TOO_MANY_KEYS 1069
-#define ER_TOO_MANY_KEY_PARTS 1070
-#define ER_TOO_LONG_KEY 1071
-#define ER_KEY_COLUMN_DOES_NOT_EXITS 1072
-#define ER_BLOB_USED_AS_KEY 1073
-#define ER_TOO_BIG_FIELDLENGTH 1074
-#define ER_WRONG_AUTO_KEY 1075
-#define ER_READY 1076
-#define ER_NORMAL_SHUTDOWN 1077
-#define ER_GOT_SIGNAL 1078
-#define ER_SHUTDOWN_COMPLETE 1079
-#define ER_FORCING_CLOSE 1080
-#define ER_IPSOCK_ERROR 1081
-#define ER_NO_SUCH_INDEX 1082
-#define ER_WRONG_FIELD_TERMINATORS 1083
-#define ER_BLOBS_AND_NO_TERMINATED 1084
-#define ER_TEXTFILE_NOT_READABLE 1085
-#define ER_FILE_EXISTS_ERROR 1086
-#define ER_LOAD_INFO 1087
-#define ER_ALTER_INFO 1088
-#define ER_WRONG_SUB_KEY 1089
-#define ER_CANT_REMOVE_ALL_FIELDS 1090
-#define ER_CANT_DROP_FIELD_OR_KEY 1091
-#define ER_INSERT_INFO 1092
-#define ER_INSERT_TABLE_USED 1093
-#define ER_NO_SUCH_THREAD 1094
-#define ER_KILL_DENIED_ERROR 1095
-#define ER_NO_TABLES_USED 1096
-#define ER_TOO_BIG_SET 1097
-#define ER_NO_UNIQUE_LOGFILE 1098
-#define ER_TABLE_NOT_LOCKED_FOR_WRITE 1099
-#define ER_TABLE_NOT_LOCKED 1100
-#define ER_BLOB_CANT_HAVE_DEFAULT 1101
-#define ER_WRONG_DB_NAME 1102
-#define ER_WRONG_TABLE_NAME 1103
-#define ER_TOO_BIG_SELECT 1104
-#define ER_UNKNOWN_ERROR 1105
-#define ER_UNKNOWN_PROCEDURE 1106
-#define ER_WRONG_PARAMCOUNT_TO_PROCEDURE 1107
-#define ER_WRONG_PARAMETERS_TO_PROCEDURE 1108
-#define ER_UNKNOWN_TABLE 1109
-#define ER_FIELD_SPECIFIED_TWICE 1110
-#define ER_INVALID_GROUP_FUNC_USE 1111
-#define ER_UNSUPPORTED_EXTENSION 1112
-#define ER_TABLE_MUST_HAVE_COLUMNS 1113
-#define ER_RECORD_FILE_FULL 1114
-#define ER_UNKNOWN_CHARACTER_SET 1115
-#define ER_TOO_MANY_TABLES 1116
-#define ER_TOO_MANY_FIELDS 1117
-#define ER_TOO_BIG_ROWSIZE 1118
-#define ER_STACK_OVERRUN 1119
-#define ER_WRONG_OUTER_JOIN 1120
-#define ER_NULL_COLUMN_IN_INDEX 1121
-#define ER_CANT_FIND_UDF 1122
-#define ER_CANT_INITIALIZE_UDF 1123
-#define ER_UDF_NO_PATHS 1124
-#define ER_UDF_EXISTS 1125
-#define ER_CANT_OPEN_LIBRARY 1126
-#define ER_CANT_FIND_DL_ENTRY 1127
-#define ER_FUNCTION_NOT_DEFINED 1128
-#define ER_HOST_IS_BLOCKED 1129
-#define ER_HOST_NOT_PRIVILEGED 1130
-#define ER_PASSWORD_ANONYMOUS_USER 1131
-#define ER_PASSWORD_NOT_ALLOWED 1132
-#define ER_PASSWORD_NO_MATCH 1133
-#define ER_UPDATE_INFO 1134
-#define ER_CANT_CREATE_THREAD 1135
-#define ER_WRONG_VALUE_COUNT_ON_ROW 1136
-#define ER_CANT_REOPEN_TABLE 1137
-#define ER_INVALID_USE_OF_NULL 1138
-#define ER_REGEXP_ERROR 1139
-#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS 1140
-#define ER_NONEXISTING_GRANT 1141
-#define ER_TABLEACCESS_DENIED_ERROR 1142
-#define ER_COLUMNACCESS_DENIED_ERROR 1143
-#define ER_ILLEGAL_GRANT_FOR_TABLE 1144
-#define ER_GRANT_WRONG_HOST_OR_USER 1145
-#define ER_NO_SUCH_TABLE 1146
-#define ER_NONEXISTING_TABLE_GRANT 1147
-#define ER_NOT_ALLOWED_COMMAND 1148
-#define ER_SYNTAX_ERROR 1149
-#define ER_DELAYED_CANT_CHANGE_LOCK 1150
-#define ER_TOO_MANY_DELAYED_THREADS 1151
-#define ER_ABORTING_CONNECTION 1152
-#define ER_NET_PACKET_TOO_LARGE 1153
-#define ER_NET_READ_ERROR_FROM_PIPE 1154
-#define ER_NET_FCNTL_ERROR 1155
-#define ER_NET_PACKETS_OUT_OF_ORDER 1156
-#define ER_NET_UNCOMPRESS_ERROR 1157
-#define ER_NET_READ_ERROR 1158
-#define ER_NET_READ_INTERRUPTED 1159
-#define ER_NET_ERROR_ON_WRITE 1160
-#define ER_NET_WRITE_INTERRUPTED 1161
-#define ER_TOO_LONG_STRING 1162
-#define ER_TABLE_CANT_HANDLE_BLOB 1163
-#define ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 1164
-#define ER_DELAYED_INSERT_TABLE_LOCKED 1165
-#define ER_WRONG_COLUMN_NAME 1166
-#define ER_WRONG_KEY_COLUMN 1167
-#define ER_WRONG_MRG_TABLE 1168
-#define ER_DUP_UNIQUE 1169
-#define ER_BLOB_KEY_WITHOUT_LENGTH 1170
-#define ER_PRIMARY_CANT_HAVE_NULL 1171
-#define ER_TOO_MANY_ROWS 1172
-#define ER_REQUIRES_PRIMARY_KEY 1173
-#define ER_NO_RAID_COMPILED 1174
-#define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175
-#define ER_KEY_DOES_NOT_EXITS 1176
-#define ER_CHECK_NO_SUCH_TABLE 1177
-#define ER_CHECK_NOT_IMPLEMENTED 1178
-#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179
-#define ER_ERROR_DURING_COMMIT 1180
-#define ER_ERROR_DURING_ROLLBACK 1181
-#define ER_ERROR_DURING_FLUSH_LOGS 1182
-#define ER_ERROR_DURING_CHECKPOINT 1183
-#define ER_NEW_ABORTING_CONNECTION 1184
-#define ER_DUMP_NOT_IMPLEMENTED 1185
-#define ER_FLUSH_MASTER_BINLOG_CLOSED 1186
-#define ER_INDEX_REBUILD 1187
-#define ER_MASTER 1188
-#define ER_MASTER_NET_READ 1189
-#define ER_MASTER_NET_WRITE 1190
-#define ER_FT_MATCHING_KEY_NOT_FOUND 1191
-#define ER_LOCK_OR_ACTIVE_TRANSACTION 1192
-#define ER_UNKNOWN_SYSTEM_VARIABLE 1193
-#define ER_CRASHED_ON_USAGE 1194
-#define ER_CRASHED_ON_REPAIR 1195
-#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196
-#define ER_TRANS_CACHE_FULL 1197
-#define ER_SLAVE_MUST_STOP 1198
-#define ER_SLAVE_NOT_RUNNING 1199
-#define ER_BAD_SLAVE 1200
-#define ER_MASTER_INFO 1201
-#define ER_SLAVE_THREAD 1202
-#define ER_TOO_MANY_USER_CONNECTIONS 1203
-#define ER_SET_CONSTANTS_ONLY 1204
-#define ER_LOCK_WAIT_TIMEOUT 1205
-#define ER_LOCK_TABLE_FULL 1206
-#define ER_READ_ONLY_TRANSACTION 1207
-#define ER_DROP_DB_WITH_READ_LOCK 1208
-#define ER_CREATE_DB_WITH_READ_LOCK 1209
-#define ER_WRONG_ARGUMENTS 1210
-#define ER_NO_PERMISSION_TO_CREATE_USER 1211
-#define ER_UNION_TABLES_IN_DIFFERENT_DIR 1212
-#define ER_LOCK_DEADLOCK 1213
-#define ER_TABLE_CANT_HANDLE_FULLTEXT 1214
-#define ER_CANNOT_ADD_FOREIGN 1215
-#define ER_NO_REFERENCED_ROW 1216
-#define ER_ROW_IS_REFERENCED 1217
-#define ER_ERROR_MESSAGES 218
diff --git a/ext/mysql/libmysql/mysys_err.h b/ext/mysql/libmysql/mysys_err.h
deleted file mode 100644
index 650bfd4de9..0000000000
--- a/ext/mysql/libmysql/mysys_err.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#ifndef _mysys_err_h
-#define _mysys_err_h
-
-#include <errno.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define GLOB 0 /* Error maps */
-#define GLOBERRS 27 /* Max number of error messages in map's */
-#define EE(X) globerrs[ X ] /* Defines to add error to right map */
-
-extern const char * NEAR globerrs[]; /* my_error_messages is here */
-
-/* Error message numbers in global map */
-#define EE_FILENOTFOUND 0
-#define EE_CANTCREATEFILE 1
-#define EE_READ 2
-#define EE_WRITE 3
-#define EE_BADCLOSE 4
-#define EE_OUTOFMEMORY 5
-#define EE_DELETE 6
-#define EE_LINK 7
-#define EE_EOFERR 9
-#define EE_CANTLOCK 10
-#define EE_CANTUNLOCK 11
-#define EE_DIR 12
-#define EE_STAT 13
-#define EE_CANT_CHSIZE 14
-#define EE_CANT_OPEN_STREAM 15
-#define EE_GETWD 16
-#define EE_SETWD 17
-#define EE_LINK_WARNING 18
-#define EE_OPEN_WARNING 19
-#define EE_DISK_FULL 20
-#define EE_CANT_MKDIR 21
-#define EE_UNKNOWN_CHARSET 22
-#define EE_OUT_OF_FILERESOURCES 23
-#define EE_CANT_READLINK 24
-#define EE_CANT_SYMLINK 25
-#define EE_REALPATH 26
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/ext/mysql/libmysql/mysys_priv.h b/ext/mysql/libmysql/mysys_priv.h
deleted file mode 100644
index a0131ea77e..0000000000
--- a/ext/mysql/libmysql/mysys_priv.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include <global.h>
-#include <my_sys.h>
-
-#ifdef USE_SYSTEM_WRAPPERS
-#include "system_wrappers.h"
-#endif
-
-#ifdef THREAD
-extern pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
- THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_net,THR_LOCK_charset;
-extern pthread_mutex_t LOCK_bitmap;
-#else /* THREAD */
-#define pthread_mutex_lock(A)
-#define pthread_mutex_unlock(A)
-#endif
diff --git a/ext/mysql/libmysql/net.c b/ext/mysql/libmysql/net.c
deleted file mode 100644
index 161fba4ace..0000000000
--- a/ext/mysql/libmysql/net.c
+++ /dev/null
@@ -1,671 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Write and read of logical packets to/from socket
-** Writes are cached into net_buffer_length big packets.
-** Read packets are reallocated dynamicly when reading big packets.
-** Each logical packet has the following pre-info:
-** 3 byte length & 1 byte package-number.
-*/
-
-#ifdef __WIN__
-#include <winsock.h>
-#endif
-#include <global.h>
-#include <violite.h>
-#include <my_sys.h>
-#include <m_string.h>
-#include "mysql.h"
-#include "mysqld_error.h"
-#include <signal.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <violite.h>
-
-#ifdef MYSQL_SERVER
-ulong max_allowed_packet=65536;
-extern ulong net_read_timeout,net_write_timeout;
-extern uint test_flags;
-#else
-ulong max_allowed_packet=16*1024*1024L;
-ulong net_read_timeout= NET_READ_TIMEOUT;
-ulong net_write_timeout= NET_WRITE_TIMEOUT;
-#endif
-ulong net_buffer_length=8192; /* Default length. Enlarged if necessary */
-
-#if !defined(__WIN__) && !defined(MSDOS)
-#include <sys/socket.h>
-#else
-#undef MYSQL_SERVER /* Win32 can't handle interrupts */
-#endif
-#if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__)
-#include <netinet/in_systm.h>
-#include <netinet/in.h>
-#include <netinet/ip.h>
-#if !defined(alpha_linux_port)
-#include <netinet/tcp.h>
-#endif
-#endif
-#include "mysqld_error.h"
-#ifdef MYSQL_SERVER
-#include "my_pthread.h"
-#include "thr_alarm.h"
-void sql_print_error(const char *format,...);
-#define RETRY_COUNT mysqld_net_retry_count
-extern ulong mysqld_net_retry_count;
-#else
-
-#ifdef OS2 /* avoid name conflict */
-#define thr_alarm_t thr_alarm_t_net
-#define ALARM ALARM_net
-#endif
-
-typedef my_bool thr_alarm_t;
-typedef my_bool ALARM;
-#define thr_alarm_init(A) (*(A))=0
-#define thr_alarm_in_use(A) (*(A)!= 0)
-#define thr_end_alarm(A)
-#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C))
-inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
-{
- *A=1;
- return 0;
-}
-#define thr_got_alarm(A) 0
-#define RETRY_COUNT 1
-#endif
-
-#ifdef MYSQL_SERVER
-extern ulong bytes_sent, bytes_received;
-extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received;
-#else
-#undef statistic_add
-#define statistic_add(A,B,C)
-#endif
-
-/*
-** Give error if a too big packet is found
-** The server can change this with the -O switch, but because the client
-** can't normally do this the client should have a bigger max-buffer.
-*/
-
-#define TEST_BLOCKING 8
-static int net_write_buff(NET *net,const char *packet,uint len);
-
-
- /* Init with packet info */
-
-int my_net_init(NET *net, Vio* vio)
-{
- if (!(net->buff=(uchar*) my_malloc(net_buffer_length,MYF(MY_WME))))
- return 1;
- if (net_buffer_length > max_allowed_packet)
- max_allowed_packet=net_buffer_length;
- net->buff_end=net->buff+(net->max_packet=net_buffer_length);
- net->vio = vio;
- net->no_send_ok = 0;
- net->error=0; net->return_errno=0; net->return_status=0;
- net->timeout=(uint) net_read_timeout; /* Timeout for read */
- net->pkt_nr=0;
- net->write_pos=net->read_pos = net->buff;
- net->last_error[0]=0;
- net->compress=0; net->reading_or_writing=0;
- net->where_b = net->remain_in_buf=0;
- net->last_errno=0;
-
- if (vio != 0) /* If real connection */
- {
- net->fd = vio_fd(vio); /* For perl DBI/DBD */
-#if defined(MYSQL_SERVER) && !defined(___WIN__) && !defined(__EMX__) && !defined(OS2)
- if (!(test_flags & TEST_BLOCKING))
- vio_blocking(vio, FALSE);
-#endif
- vio_fastsend(vio);
- }
- return 0;
-}
-
-void net_end(NET *net)
-{
- my_free((gptr) net->buff,MYF(MY_ALLOW_ZERO_PTR));
- net->buff=0;
-}
-
-/* Realloc the packet buffer */
-
-static my_bool net_realloc(NET *net, ulong length)
-{
- uchar *buff;
- ulong pkt_length;
- if (length >= max_allowed_packet)
- {
- DBUG_PRINT("error",("Packet too large (%lu)", length));
- net->error=1;
- net->last_errno=ER_NET_PACKET_TOO_LARGE;
- return 1;
- }
- pkt_length = (length+IO_SIZE-1) & ~(IO_SIZE-1);
- if (!(buff=(uchar*) my_realloc((char*) net->buff, pkt_length, MYF(MY_WME))))
- {
- net->error=1;
-#ifdef MYSQL_SERVER
- net->last_errno=ER_OUT_OF_RESOURCES;
-#endif
- return 1;
- }
- net->buff=net->write_pos=buff;
- net->buff_end=buff+(net->max_packet=pkt_length);
- return 0;
-}
-
- /* Remove unwanted characters from connection */
-
-void net_clear(NET *net)
-{
-#ifndef EXTRA_DEBUG
- int count;
- bool is_blocking=vio_is_blocking(net->vio);
- if (is_blocking)
- vio_blocking(net->vio, FALSE);
- if (!vio_is_blocking(net->vio)) /* Safety if SSL */
- {
- while ( (count = vio_read(net->vio, (char*) (net->buff),
- net->max_packet)) > 0)
- DBUG_PRINT("info",("skipped %d bytes from file: %s",
- count,vio_description(net->vio)));
- if (is_blocking)
- vio_blocking(net->vio, TRUE);
- }
-#endif /* EXTRA_DEBUG */
- net->pkt_nr=0; /* Ready for new command */
- net->write_pos=net->buff;
-}
-
- /* Flush write_buffer if not empty. */
-
-int net_flush(NET *net)
-{
- int error=0;
- DBUG_ENTER("net_flush");
- if (net->buff != net->write_pos)
- {
- error=net_real_write(net,(char*) net->buff,
- (uint) (net->write_pos - net->buff));
- net->write_pos=net->buff;
- }
- DBUG_RETURN(error);
-}
-
-
-/*****************************************************************************
-** Write something to server/client buffer
-*****************************************************************************/
-
-
-/*
-** Write a logical packet with packet header
-** Format: Packet length (3 bytes), packet number(1 byte)
-** When compression is used a 3 byte compression length is added
-** NOTE: If compression is used the original package is destroyed!
-*/
-
-int
-my_net_write(NET *net,const char *packet,ulong len)
-{
- uchar buff[NET_HEADER_SIZE];
- int3store(buff,len);
- buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
- if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE))
- return 1;
- return net_write_buff(net,packet,len);
-}
-
-int
-net_write_command(NET *net,uchar command,const char *packet,ulong len)
-{
- uchar buff[NET_HEADER_SIZE+1];
- uint length=len+1; /* 1 extra byte for command */
-
- int3store(buff,length);
- buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
- buff[4]=command;
- if (net_write_buff(net,(char*) buff,5))
- return 1;
- return test(net_write_buff(net,packet,len) || net_flush(net));
-}
-
-
-static int
-net_write_buff(NET *net,const char *packet,uint len)
-{
- uint left_length=(uint) (net->buff_end - net->write_pos);
-
- while (len > left_length)
- {
- memcpy((char*) net->write_pos,packet,left_length);
- if (net_real_write(net,(char*) net->buff,net->max_packet))
- return 1;
- net->write_pos=net->buff;
- packet+=left_length;
- len-=left_length;
- left_length=net->max_packet;
- }
- memcpy((char*) net->write_pos,packet,len);
- net->write_pos+=len;
- return 0;
-}
-
-/* Read and write using timeouts */
-
-int
-net_real_write(NET *net,const char *packet,ulong len)
-{
- int length;
- char *pos,*end;
- thr_alarm_t alarmed;
-#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
- ALARM alarm_buff;
-#endif
- uint retry_count=0;
- my_bool net_blocking = vio_is_blocking(net->vio);
- DBUG_ENTER("net_real_write");
-
- if (net->error == 2)
- DBUG_RETURN(-1); /* socket can't be used */
-
- net->reading_or_writing=2;
-#ifdef HAVE_COMPRESS
- if (net->compress)
- {
- ulong complen;
- uchar *b;
- uint header_length=NET_HEADER_SIZE+COMP_HEADER_SIZE;
- if (!(b=(uchar*) my_malloc(len + NET_HEADER_SIZE + COMP_HEADER_SIZE,
- MYF(MY_WME))))
- {
-#ifdef MYSQL_SERVER
- net->last_errno=ER_OUT_OF_RESOURCES;
- net->error=2;
-#endif
- net->reading_or_writing=0;
- DBUG_RETURN(1);
- }
- memcpy(b+header_length,packet,len);
-
- if (my_compress((byte*) b+header_length,&len,&complen))
- {
- DBUG_PRINT("warning",
- ("Compression error; Continuing without compression"));
- complen=0;
- }
- int3store(&b[NET_HEADER_SIZE],complen);
- int3store(b,len);
- b[3]=(uchar) (net->pkt_nr++);
- len+= header_length;
- packet= (char*) b;
- }
-#endif /* HAVE_COMPRESS */
-
- /* DBUG_DUMP("net",packet,len); */
-#ifdef MYSQL_SERVER
- thr_alarm_init(&alarmed);
- if (net_blocking)
- thr_alarm(&alarmed,(uint) net_write_timeout,&alarm_buff);
-#else
- alarmed=0;
-#endif /* MYSQL_SERVER */
-
- pos=(char*) packet; end=pos+len;
- while (pos != end)
- {
- if ((int) (length=vio_write(net->vio,pos,(int) (end-pos))) <= 0)
- {
- my_bool interrupted = vio_should_retry(net->vio);
-#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2))
- if ((interrupted || length==0) && !thr_alarm_in_use(&alarmed))
- {
- if (!thr_alarm(&alarmed,(uint) net_write_timeout,&alarm_buff))
- { /* Always true for client */
- if (!vio_is_blocking(net->vio))
- {
- while (vio_blocking(net->vio, TRUE) < 0)
- {
- if (vio_should_retry(net->vio) && retry_count++ < RETRY_COUNT)
- continue;
-#ifdef EXTRA_DEBUG
- fprintf(stderr,
- "%s: my_net_write: fcntl returned error %d, aborting thread\n",
- my_progname,vio_errno(net->vio));
-#endif /* EXTRA_DEBUG */
- net->error=2; /* Close socket */
- goto end;
- }
- }
- retry_count=0;
- continue;
- }
- }
- else
-#endif /* (!defined(__WIN__) && !defined(__EMX__)) */
- if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) &&
- interrupted)
- {
- if (retry_count++ < RETRY_COUNT)
- continue;
-#ifdef EXTRA_DEBUG
- fprintf(stderr, "%s: write looped, aborting thread\n",
- my_progname);
-#endif /* EXTRA_DEBUG */
- }
-#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER)
- if (vio_errno(net->vio) == SOCKET_EINTR)
- {
- DBUG_PRINT("warning",("Interrupted write. Retrying..."));
- continue;
- }
-#endif /* defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) */
- net->error=2; /* Close socket */
-#ifdef MYSQL_SERVER
- net->last_errno= (interrupted ? ER_NET_WRITE_INTERRUPTED :
- ER_NET_ERROR_ON_WRITE);
-#endif /* MYSQL_SERVER */
- break;
- }
- pos+=length;
- statistic_add(bytes_sent,length,&LOCK_bytes_sent);
- }
-#ifndef __WIN__
- end:
-#endif
-#ifdef HAVE_COMPRESS
- if (net->compress)
- my_free((char*) packet,MYF(0));
-#endif
- if (thr_alarm_in_use(&alarmed))
- {
- thr_end_alarm(&alarmed);
- vio_blocking(net->vio, net_blocking);
- }
- net->reading_or_writing=0;
- DBUG_RETURN(((int) (pos != end)));
-}
-
-
-/*****************************************************************************
-** Read something from server/clinet
-*****************************************************************************/
-
-#ifdef MYSQL_SERVER
-
-/*
- Help function to clear the commuication buffer when we get a too
- big packet
-*/
-
-static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
-{
- ALARM alarm_buff;
- uint retry_count=0;
- if (!thr_alarm_in_use(&alarmed))
- {
- if (!thr_alarm(alarmed,net->timeout,&alarm_buff) ||
- (!vio_is_blocking(net->vio) && vio_blocking(net->vio,TRUE) < 0))
- return; /* Can't setup, abort */
- }
- while (remain > 0)
- {
- ulong length;
- if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L)
- {
- my_bool interrupted = vio_should_retry(net->vio);
- if (!thr_got_alarm(alarmed) && interrupted)
- { /* Probably in MIT threads */
- if (retry_count++ < RETRY_COUNT)
- continue;
- }
- return;
- }
- remain -=(ulong) length;
- statistic_add(bytes_received,(ulong) length,&LOCK_bytes_received);
- }
-}
-#endif /* MYSQL_SERVER */
-
-
-static uint
-my_real_read(NET *net, ulong *complen)
-{
- uchar *pos;
- long length;
- uint i,retry_count=0;
- ulong len=packet_error;
- thr_alarm_t alarmed;
-#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2)) || defined(MYSQL_SERVER)
- ALARM alarm_buff;
-#endif
- my_bool net_blocking=vio_is_blocking(net->vio);
- ulong remain= (net->compress ? NET_HEADER_SIZE+COMP_HEADER_SIZE :
- NET_HEADER_SIZE);
- *complen = 0;
-
- net->reading_or_writing=1;
- thr_alarm_init(&alarmed);
-#ifdef MYSQL_SERVER
- if (net_blocking)
- thr_alarm(&alarmed,net->timeout,&alarm_buff);
-#endif /* MYSQL_SERVER */
-
- pos = net->buff + net->where_b; /* net->packet -4 */
- for (i=0 ; i < 2 ; i++)
- {
- while (remain > 0)
- {
- /* First read is done with non blocking mode */
- if ((int) (length=vio_read(net->vio,(char*) pos,remain)) <= 0L)
- {
- my_bool interrupted = vio_should_retry(net->vio);
-
- DBUG_PRINT("info",("vio_read returned %d, errno: %d",
- length, vio_errno(net->vio)));
-#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2)) || defined(MYSQL_SERVER)
- /*
- We got an error that there was no data on the socket. We now set up
- an alarm to not 'read forever', change the socket to non blocking
- mode and try again
- */
- if ((interrupted || length == 0) && !thr_alarm_in_use(&alarmed))
- {
- if (!thr_alarm(&alarmed,net->timeout,&alarm_buff)) /* Don't wait too long */
- {
- if (!vio_is_blocking(net->vio))
- {
- while (vio_blocking(net->vio,TRUE) < 0)
- {
- if (vio_should_retry(net->vio) &&
- retry_count++ < RETRY_COUNT)
- continue;
- DBUG_PRINT("error",
- ("fcntl returned error %d, aborting thread",
- vio_errno(net->vio)));
-#ifdef EXTRA_DEBUG
- fprintf(stderr,
- "%s: read: fcntl returned error %d, aborting thread\n",
- my_progname,vio_errno(net->vio));
-#endif /* EXTRA_DEBUG */
- len= packet_error;
- net->error=2; /* Close socket */
-#ifdef MYSQL_SERVER
- net->last_errno=ER_NET_FCNTL_ERROR;
-#endif
- goto end;
- }
- }
- retry_count=0;
- continue;
- }
- }
-#endif /* (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER) */
- if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) &&
- interrupted)
- { /* Probably in MIT threads */
- if (retry_count++ < RETRY_COUNT)
- continue;
-#ifdef EXTRA_DEBUG
- fprintf(stderr, "%s: read looped with error %d, aborting thread\n",
- my_progname,vio_errno(net->vio));
-#endif /* EXTRA_DEBUG */
- }
-#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER)
- if (vio_should_retry(net->vio))
- {
- DBUG_PRINT("warning",("Interrupted read. Retrying..."));
- continue;
- }
-#endif
- DBUG_PRINT("error",("Couldn't read packet: remain: %d errno: %d length: %d alarmed: %d", remain,vio_errno(net->vio),length,alarmed));
- len= packet_error;
- net->error=2; /* Close socket */
-#ifdef MYSQL_SERVER
- net->last_errno= (interrupted ? ER_NET_READ_INTERRUPTED :
- ER_NET_READ_ERROR);
-#endif
- goto end;
- }
- remain -= (ulong) length;
- pos+= (ulong) length;
- statistic_add(bytes_received,(ulong) length,&LOCK_bytes_received);
- }
- if (i == 0)
- { /* First parts is packet length */
- ulong helping;
- if (net->buff[net->where_b + 3] != (uchar) net->pkt_nr)
- {
- if (net->buff[net->where_b] != (uchar) 255)
- {
- DBUG_PRINT("error",
- ("Packets out of order (Found: %d, expected %d)",
- (int) net->buff[net->where_b + 3],
- (uint) (uchar) net->pkt_nr));
-#ifdef EXTRA_DEBUG
- fprintf(stderr,"Packets out of order (Found: %d, expected %d)\n",
- (int) net->buff[net->where_b + 3],
- (uint) (uchar) net->pkt_nr);
-#endif
- }
- len= packet_error;
-#ifdef MYSQL_SERVER
- net->last_errno=ER_NET_PACKETS_OUT_OF_ORDER;
-#endif
- goto end;
- }
- net->pkt_nr++;
-#ifdef HAVE_COMPRESS
- if (net->compress)
- {
- /* complen is > 0 if package is really compressed */
- *complen=uint3korr(&(net->buff[net->where_b + NET_HEADER_SIZE]));
- }
-#endif
-
- len=uint3korr(net->buff+net->where_b);
- helping = max(len,*complen) + net->where_b;
- /* The necessary size of net->buff */
- if (helping >= net->max_packet)
- {
- /* We must allocate one extra byte for the end null */
- if (net_realloc(net,helping+1))
- {
-#ifdef MYSQL_SERVER
- if (i == 1)
- my_net_skip_rest(net, len, &alarmed);
-#endif
- len= packet_error; /* Return error */
- goto end;
- }
- }
- pos=net->buff + net->where_b;
- remain = len;
- }
- }
-
-end:
- if (thr_alarm_in_use(&alarmed))
- {
- thr_end_alarm(&alarmed);
- vio_blocking(net->vio, net_blocking);
- }
- net->reading_or_writing=0;
- return(len);
-}
-
-uint
-my_net_read(NET *net)
-{
- ulong len,complen;
-
-#ifdef HAVE_COMPRESS
- if (!net->compress)
- {
-#endif
- len = my_real_read (net,&complen);
- net->read_pos = net->buff + net->where_b;
- if (len != packet_error)
- net->read_pos[len]=0; /* Safeguard for mysql_use_result */
- return len;
-#ifdef HAVE_COMPRESS
- }
- if (net->remain_in_buf)
- net->buff[net->buf_length - net->remain_in_buf]=net->save_char;
- for (;;)
- {
- if (net->remain_in_buf)
- {
- uchar *pos = net->buff + net->buf_length - net->remain_in_buf;
- if (net->remain_in_buf >= 4)
- {
- net->length = uint3korr(pos);
- if (net->length <= net->remain_in_buf - 4)
- {
- /* We have a full packet */
- len=net->length;
- net->remain_in_buf -= net->length + 4;
- net->read_pos=pos + 4;
- break; /* We have a full packet */
- }
- }
- /* Move data down to read next data packet after current one */
- if (net->buf_length != net->remain_in_buf)
- {
- memmove(net->buff,pos,net->remain_in_buf);
- net->buf_length=net->remain_in_buf;
- }
- net->where_b=net->buf_length;
- }
- else
- {
- net->where_b=0;
- net->buf_length=0;
- }
-
- if ((len = my_real_read(net,&complen)) == packet_error)
- break;
- if (my_uncompress((byte*) net->buff + net->where_b, &len, &complen))
- {
- len= packet_error;
- net->error=2; /* caller will close socket */
-#ifdef MYSQL_SERVER
- net->last_errno=ER_NET_UNCOMPRESS_ERROR;
-#endif
- break;
- }
- net->buf_length+=len;
- net->remain_in_buf+=len;
- }
- if (len != packet_error)
- {
- net->save_char= net->read_pos[len]; /* Must be saved */
- net->read_pos[len]=0; /* Safeguard for mysql_use_result */
- }
- return len;
-#endif
-}
diff --git a/ext/mysql/libmysql/password.c b/ext/mysql/libmysql/password.c
deleted file mode 100644
index eb40825401..0000000000
--- a/ext/mysql/libmysql/password.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* password checking routines */
-/*****************************************************************************
- The main idea is that no password are sent between client & server on
- connection and that no password are saved in mysql in a decodable form.
-
- On connection a random string is generated and sent to the client.
- The client generates a new string with a random generator inited with
- the hash values from the password and the sent string.
- This 'check' string is sent to the server where it is compared with
- a string generated from the stored hash_value of the password and the
- random string.
-
- The password is saved (in user.password) by using the PASSWORD() function in
- mysql.
-
- Example:
- update user set password=PASSWORD("hello") where user="test"
- This saves a hashed number as a string in the password field.
-*****************************************************************************/
-
-#include <global.h>
-#include <my_sys.h>
-#include <m_string.h>
-#include "mysql.h"
-
-
-void randominit(struct rand_struct *rand_st,ulong seed1, ulong seed2)
-{ /* For mysql 3.21.# */
-#ifdef HAVE_purify
- bzero((char*) rand_st,sizeof(*rand_st)); /* Avoid UMC varnings */
-#endif
- rand_st->max_value= 0x3FFFFFFFL;
- rand_st->max_value_dbl=(double) rand_st->max_value;
- rand_st->seed1=seed1%rand_st->max_value ;
- rand_st->seed2=seed2%rand_st->max_value;
-}
-
-static void old_randominit(struct rand_struct *rand_st,ulong seed1)
-{ /* For mysql 3.20.# */
- rand_st->max_value= 0x01FFFFFFL;
- rand_st->max_value_dbl=(double) rand_st->max_value;
- seed1%=rand_st->max_value;
- rand_st->seed1=seed1 ; rand_st->seed2=seed1/2;
-}
-
-double rnd(struct rand_struct *rand_st)
-{
- rand_st->seed1=(rand_st->seed1*3+rand_st->seed2) % rand_st->max_value;
- rand_st->seed2=(rand_st->seed1+rand_st->seed2+33) % rand_st->max_value;
- return (((double) rand_st->seed1)/rand_st->max_value_dbl);
-}
-
-void hash_password(ulong *result, const char *password)
-{
- register ulong nr=1345345333L, add=7, nr2=0x12345671L;
- ulong tmp;
- for (; *password ; password++)
- {
- if (*password == ' ' || *password == '\t')
- continue; /* skipp space in password */
- tmp= (ulong) (uchar) *password;
- nr^= (((nr & 63)+add)*tmp)+ (nr << 8);
- nr2+=(nr2 << 8) ^ nr;
- add+=tmp;
- }
- result[0]=nr & (((ulong) 1L << 31) -1L); /* Don't use sign bit (str2int) */;
- result[1]=nr2 & (((ulong) 1L << 31) -1L);
- return;
-}
-
-void make_scrambled_password(char *to,const char *password)
-{
- ulong hash_res[2];
- hash_password(hash_res,password);
- sprintf(to,"%08lx%08lx",hash_res[0],hash_res[1]);
-}
-
-static inline uint char_val(char X)
-{
- return (uint) (X >= '0' && X <= '9' ? X-'0' :
- X >= 'A' && X <= 'Z' ? X-'A'+10 :
- X-'a'+10);
-}
-
-/*
-** This code assumes that len(password) is divideable with 8 and that
-** res is big enough (2 in mysql)
-*/
-
-void get_salt_from_password(ulong *res,const char *password)
-{
- res[0]=res[1]=0;
- if (password)
- {
- while (*password)
- {
- ulong val=0;
- uint i;
- for (i=0 ; i < 8 ; i++)
- val=(val << 4)+char_val(*password++);
- *res++=val;
- }
- }
- return;
-}
-
-void make_password_from_salt(char *to, ulong *hash_res)
-{
- sprintf(to,"%08lx%08lx",hash_res[0],hash_res[1]);
-}
-
-
-/*
- * Genererate a new message based on message and password
- * The same thing is done in client and server and the results are checked.
- */
-
-char *scramble(char *to,const char *message,const char *password,
- my_bool old_ver)
-{
- struct rand_struct rand_st;
- ulong hash_pass[2],hash_message[2];
- if (password && password[0])
- {
- char *to_start=to;
- hash_password(hash_pass,password);
- hash_password(hash_message,message);
- if (old_ver)
- old_randominit(&rand_st,hash_pass[0] ^ hash_message[0]);
- else
- randominit(&rand_st,hash_pass[0] ^ hash_message[0],
- hash_pass[1] ^ hash_message[1]);
- while (*message++)
- *to++= (char) (floor(rnd(&rand_st)*31)+64);
- if (!old_ver)
- { /* Make it harder to break */
- char extra=(char) (floor(rnd(&rand_st)*31));
- while (to_start != to)
- *(to_start++)^=extra;
- }
- }
- *to=0;
- return to;
-}
-
-
-my_bool check_scramble(const char *scrambled, const char *message,
- ulong *hash_pass, my_bool old_ver)
-{
- struct rand_struct rand_st;
- ulong hash_message[2];
- char buff[16],*to,extra; /* Big enough for check */
- const char *pos;
-
- hash_password(hash_message,message);
- if (old_ver)
- old_randominit(&rand_st,hash_pass[0] ^ hash_message[0]);
- else
- randominit(&rand_st,hash_pass[0] ^ hash_message[0],
- hash_pass[1] ^ hash_message[1]);
- to=buff;
- for (pos=scrambled ; *pos ; pos++)
- *to++=(char) (floor(rnd(&rand_st)*31)+64);
- if (old_ver)
- extra=0;
- else
- extra=(char) (floor(rnd(&rand_st)*31));
- to=buff;
- while (*scrambled)
- {
- if (*scrambled++ != (char) (*to++ ^ extra))
- return 1; /* Wrong password */
- }
- return 0;
-}
diff --git a/ext/mysql/libmysql/raid.h b/ext/mysql/libmysql/raid.h
deleted file mode 100644
index caa9f743c6..0000000000
--- a/ext/mysql/libmysql/raid.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Parser needs these defines always, even if USE_RAID is not defined */
-#define RAID_TYPE_0 1 /* Striping */
-#define RAID_TYPE_x 2 /* Some new modes */
-#define RAID_TYPE_y 3
-
-#define RAID_DEFAULT_CHUNKS 4
-#define RAID_DEFAULT_CHUNKSIZE 256*1024 /* 256kB */
-
-extern const char *raid_type_string[];
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-const char *my_raid_type(int raid_type);
-#ifdef __cplusplus
-}
-#endif
-
-#if defined(USE_RAID) && !defined(DONT_USE_RAID)
-
-#ifdef __GNUC__
-#pragma interface /* gcc class implementation */
-#endif
-#include "my_dir.h"
-
-/* Trap all occurences of my_...() in source and use our wrapper around this function */
-
-#ifdef MAP_TO_USE_RAID
-#define my_read(A,B,C,D) my_raid_read(A,B,C,D)
-#define my_write(A,B,C,D) my_raid_write(A,B,C,D)
-#define my_pwrite(A,B,C,D,E) my_raid_pwrite(A,B,C,D,E)
-#define my_pread(A,B,C,D,E) my_raid_pread(A,B,C,D,E)
-#define my_chsize(A,B,C) my_raid_chsize(A,B,C)
-#define my_close(A,B) my_raid_close(A,B)
-#define my_tell(A,B) my_raid_tell(A,B)
-#define my_seek(A,B,C,D) my_raid_seek(A,B,C,D)
-#define my_lock(A,B,C,D,E) my_raid_lock(A,B,C,D,E)
-#define my_fstat(A,B,C) my_raid_fstat(A,B,C)
-#endif /* MAP_TO_USE_RAID */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- void init_raid(void);
- void end_raid(void);
-
- bool is_raid(File fd);
- File my_raid_create(const char *FileName, int CreateFlags, int access_flags,
- uint raid_type, uint raid_chunks, ulong raid_chunksize,
- myf MyFlags);
- File my_raid_open(const char *FileName, int Flags,
- uint raid_type, uint raid_chunks, ulong raid_chunksize,
- myf MyFlags);
- int my_raid_rename(const char *from, const char *to, uint raid_chunks,
- myf MyFlags);
- int my_raid_delete(const char *from, uint raid_chunks, myf MyFlags);
- int my_raid_redel(const char *old_name, const char *new_name,
- uint raid_chunks, myf MyFlags);
-
- my_off_t my_raid_seek(File fd, my_off_t pos, int whence, myf MyFlags);
- my_off_t my_raid_tell(File fd, myf MyFlags);
-
- uint my_raid_write(File,const byte *Buffer, uint Count, myf MyFlags);
- uint my_raid_read(File Filedes, byte *Buffer, uint Count, myf MyFlags);
-
- uint my_raid_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset,
- myf MyFlags);
- uint my_raid_pwrite(int Filedes, const byte *Buffer, uint Count,
- my_off_t offset, myf MyFlags);
-
- int my_raid_lock(File,int locktype, my_off_t start, my_off_t length,
- myf MyFlags);
- int my_raid_chsize(File fd, my_off_t newlength, myf MyFlags);
- int my_raid_close(File, myf MyFlags);
- int my_raid_fstat(int Filedes, struct stat *buf, myf MyFlags);
-
-#ifdef __cplusplus
-}
-
-class RaidName {
- public:
- RaidName(const char *FileName);
- ~RaidName();
- bool IsRaid();
- int Rename(const char * from, const char * to, myf MyFlags);
- private:
- uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */
- uint _raid_chunks; /* 1..n */
- ulong _raid_chunksize; /* 1..n in bytes */
-};
-
-class RaidFd {
- public:
- RaidFd(uint raid_type, uint raid_chunks , ulong raid_chunksize);
- ~RaidFd();
- File Create(const char *FileName, int CreateFlags, int access_flags,
- myf MyFlags);
- File Open(const char *FileName, int Flags, myf MyFlags);
- my_off_t Seek(my_off_t pos,int whence,myf MyFlags);
- my_off_t Tell(myf MyFlags);
- int Write(const byte *Buffer, uint Count, myf MyFlags);
- int Read(const byte *Buffer, uint Count, myf MyFlags);
- int Lock(int locktype, my_off_t start, my_off_t length, myf MyFlags);
- int Chsize(File fd, my_off_t newlength, myf MyFlags);
- int Fstat(int fd, MY_STAT *stat_area, myf MyFlags );
- int Close(myf MyFlags);
- static bool IsRaid(File fd);
- static DYNAMIC_ARRAY _raid_map; /* Map of RaidFD* */
- private:
-
- uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */
- uint _raid_chunks; /* 1..n */
- ulong _raid_chunksize; /* 1..n in bytes */
-
- ulong _total_block; /* We are operating with block no x (can be 0..many). */
- uint _this_block; /* can be 0.._raid_chunks */
- uint _remaining_bytes; /* Maximum bytes that can be written in this block */
-
- my_off_t _position;
- my_off_t _size; /* Cached file size for faster seek(SEEK_END) */
- File _fd;
- File *_fd_vector; /* Array of File */
- off_t *_seek_vector; /* Array of cached seek positions */
-
- inline void Calculate()
- {
- DBUG_ENTER("RaidFd::_Calculate");
- DBUG_PRINT("info",("_position: %lu _raid_chunksize: %d, _size: %lu",
- (ulong) _position, _raid_chunksize, (ulong) _size));
-
- _total_block = (ulong) (_position / _raid_chunksize);
- _this_block = _total_block % _raid_chunks; /* can be 0.._raid_chunks */
- _remaining_bytes = (uint) (_raid_chunksize -
- (_position - _total_block * _raid_chunksize));
- DBUG_PRINT("info",
- ("_total_block: %d this_block: %d _remaining_bytes:%d",
- _total_block, _this_block, _remaining_bytes));
- DBUG_VOID_RETURN;
- }
-};
-
-#endif /* __cplusplus */
-#endif /* USE_RAID */
diff --git a/ext/mysql/libmysql/safemalloc.c b/ext/mysql/libmysql/safemalloc.c
deleted file mode 100644
index 1918034c19..0000000000
--- a/ext/mysql/libmysql/safemalloc.c
+++ /dev/null
@@ -1,510 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- * [This posting refers to an article entitled "oops, corrupted memory
- * again!" in net.lang.c. I am posting it here because it is source.]
- *
- * My tool for approaching this problem is to build another level of data
- * abstraction on top of malloc() and free() that implements some checking.
- * This does a number of things for you:
- * - Checks for overruns and underruns on allocated data
- * - Keeps track of where in the program the memory was malloc'ed
- * - Reports on pieces of memory that were not free'ed
- * - Records some statistics such as maximum memory used
- * - Marks newly malloc'ed and newly free'ed memory with special values
- * You can use this scheme to:
- * - Find bugs such as overrun, underrun, etc because you know where
- * a piece of data was malloc'ed and where it was free'ed
- * - Find bugs where memory was not free'ed
- * - Find bugs where newly malloc'ed memory is used without initializing
- * - Find bugs where newly free'ed memory is still used
- * - Determine how much memory your program really uses
- * - and other things
- */
-
-/*
- * To implement my scheme you must have a C compiler that has __LINE__ and
- * __FILE__ macros. If your compiler doesn't have these then (a) buy another:
- * compilers that do are available on UNIX 4.2bsd based systems and the PC,
- * and probably on other machines; or (b) change my scheme somehow. I have
- * recomendations on both these points if you would like them (e-mail please).
- *
- * There are 4 functions in my package:
- * char *NEW( uSize ) Allocate memory of uSize bytes
- * (equivalent to malloc())
- * char *REA( pPtr, uSize) Allocate memory of uSize bytes, move data and
- * free pPtr.
- * (equivalent to realloc())
- * FREE( pPtr ) Free memory allocated by NEW
- * (equivalent to free())
- * TERMINATE(file) End system, report errors and stats on file
- * I personally use two more functions, but have not included them here:
- * char *STRSAVE( sPtr ) Save a copy of the string in dynamic memory
- * char *RENEW( pPtr, uSize )
- * (equivalent to realloc())
- */
-
-/*
- * Memory sub-system, written by Bjorn Benson
- Fixed to use my_sys scheme by Michael Widenius
- */
-
-#ifndef SAFEMALLOC
-#define SAFEMALLOC /* Get protos from my_sys */
-#endif
-
-#include "mysys_priv.h"
-#include <m_string.h>
-#include "my_static.h"
-#include "mysys_err.h"
-
-ulonglong safemalloc_mem_limit = ~(ulonglong)0;
-
-#define pNext tInt._pNext
-#define pPrev tInt._pPrev
-#define sFileName tInt._sFileName
-#define uLineNum tInt._uLineNum
-#define uDataSize tInt._uDataSize
-#define lSpecialValue tInt._lSpecialValue
-
- /* Static functions prototypes */
-
-static int check_ptr(const char *where, byte *ptr, const char *sFile,
- uint uLine);
-static int _checkchunk(struct remember *pRec, const char *sFile, uint uLine);
-
-/*
- * Note: both these refer to the NEW'ed
- * data only. They do not include
- * malloc() roundoff or the extra
- * space required by the remember
- * structures.
- */
-
-#define ALLOC_VAL (uchar) 0xA5 /* NEW'ed memory is filled with this */
- /* value so that references to it will */
- /* end up being very strange. */
-#define FREE_VAL (uchar) 0x8F /* FREE'ed memory is filled with this */
- /* value so that references to it will */
- /* also end up being strange. */
-
-#define MAGICKEY 0x14235296 /* A magic value for underrun key */
-#define MAGICEND0 0x68 /* Magic values for overrun keys */
-#define MAGICEND1 0x34 /* " */
-#define MAGICEND2 0x7A /* " */
-#define MAGICEND3 0x15 /* " */
-
- /* Warning: do not change the MAGICEND? values to */
- /* something with the high bit set. Various C */
- /* compilers (like the 4.2bsd one) do not do the */
- /* sign extension right later on in this code and */
- /* you will get erroneous errors. */
-
-
-/*
- * gptr _mymalloc( uint uSize, my_string sFile, uint uLine, MyFlags )
- * Allocate some memory.
- */
-
-gptr _mymalloc (uint uSize, const char *sFile, uint uLine, myf MyFlags)
-{
- struct remember *pTmp;
- DBUG_ENTER("_mymalloc");
- DBUG_PRINT("enter",("Size: %u",uSize));
-
-
- if (!sf_malloc_quick)
- (void) _sanity (sFile, uLine);
-
- if(uSize + lCurMemory > safemalloc_mem_limit)
- pTmp = 0;
- else
- /* Allocate the physical memory */
- pTmp = (struct remember *) malloc (
- sizeof (struct irem) /* remember data */
- + sf_malloc_prehunc
- + uSize /* size requested */
- + 4 /* overrun mark */
- + sf_malloc_endhunc
- );
-
- /* Check if there isn't anymore memory avaiable */
- if (pTmp == NULL)
- {
- if (MyFlags & MY_FAE)
- error_handler_hook=fatal_error_handler_hook;
- if (MyFlags & (MY_FAE+MY_WME))
- {
- char buff[SC_MAXWIDTH];
- my_errno=errno;
- sprintf(buff,"Out of memory at line %d, '%s'", uLine, sFile);
- my_message(EE_OUTOFMEMORY,buff,MYF(ME_BELL+ME_WAITTANG));
- sprintf(buff,"needed %d byte (%ldk), memory in use: %ld bytes (%ldk)",
- uSize, (uSize + 1023L) / 1024L,
- lMaxMemory, (lMaxMemory + 1023L) / 1024L);
- my_message(EE_OUTOFMEMORY,buff,MYF(ME_BELL+ME_WAITTANG));
- }
- DBUG_PRINT("error",("Out of memory, in use: %ld at line %d, '%s'",
- lMaxMemory,uLine, sFile));
- if (MyFlags & MY_FAE)
- exit(1);
- DBUG_RETURN ((gptr) NULL);
- }
-
- /* Fill up the structure */
- *((long*) ((char*) &pTmp -> lSpecialValue+sf_malloc_prehunc)) = MAGICKEY;
- pTmp -> aData[uSize + sf_malloc_prehunc+0] = MAGICEND0;
- pTmp -> aData[uSize + sf_malloc_prehunc+1] = MAGICEND1;
- pTmp -> aData[uSize + sf_malloc_prehunc+2] = MAGICEND2;
- pTmp -> aData[uSize + sf_malloc_prehunc+3] = MAGICEND3;
- pTmp -> sFileName = (my_string) sFile;
- pTmp -> uLineNum = uLine;
- pTmp -> uDataSize = uSize;
- pTmp -> pPrev = NULL;
-
- /* Add this remember structure to the linked list */
- pthread_mutex_lock(&THR_LOCK_malloc);
- if ((pTmp->pNext=pRememberRoot))
- {
- pRememberRoot -> pPrev = pTmp;
- }
- pRememberRoot = pTmp;
-
- /* Keep the statistics */
- lCurMemory += uSize;
- if (lCurMemory > lMaxMemory) {
- lMaxMemory = lCurMemory;
- }
- cNewCount++;
- pthread_mutex_unlock(&THR_LOCK_malloc);
-
- /* Set the memory to the aribtrary wierd value */
-#ifdef HAVE_purify
- if (MyFlags & MY_ZEROFILL)
-#endif
- bfill(&pTmp -> aData[sf_malloc_prehunc],uSize,
- (char) (MyFlags & MY_ZEROFILL ? 0 : ALLOC_VAL));
- /* Return a pointer to the real data */
- DBUG_PRINT("exit",("ptr: %lx",&(pTmp -> aData[sf_malloc_prehunc])));
- if (sf_min_adress > &(pTmp -> aData[sf_malloc_prehunc]))
- sf_min_adress = &(pTmp -> aData[sf_malloc_prehunc]);
- if (sf_max_adress < &(pTmp -> aData[sf_malloc_prehunc]))
- sf_max_adress = &(pTmp -> aData[sf_malloc_prehunc]);
- DBUG_RETURN ((gptr) &(pTmp -> aData[sf_malloc_prehunc]));
-}
-
-/*
- * Allocate some new memory and move old memoryblock there.
- * Free then old memoryblock
- */
-
-gptr _myrealloc (register gptr pPtr, register uint uSize,
- const char *sFile, uint uLine, myf MyFlags)
-{
- struct remember *pRec;
- gptr ptr;
- DBUG_ENTER("_myrealloc");
-
- if (!pPtr && (MyFlags & MY_ALLOW_ZERO_PTR))
- DBUG_RETURN(_mymalloc(uSize,sFile,uLine,MyFlags));
-
- if (!sf_malloc_quick)
- (void) _sanity (sFile, uLine);
-
- if (check_ptr("Reallocating",(byte*) pPtr,sFile,uLine))
- DBUG_RETURN((gptr) NULL);
-
- pRec = (struct remember *) ((char*) pPtr - sizeof (struct irem)-
- sf_malloc_prehunc);
- if (*((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc))
- != MAGICKEY)
- {
- fprintf (stderr, "Reallocating unallocated data at line %d, '%s'\n",
- uLine, sFile);
- DBUG_PRINT("safe",("Reallocating unallocated data at line %d, '%s'",
- uLine, sFile));
- (void) fflush(stderr);
- DBUG_RETURN((gptr) NULL);
- }
-
- if ((ptr=_mymalloc(uSize,sFile,uLine,MyFlags))) /* Allocate new area */
- {
- uSize=min(uSize,pRec-> uDataSize); /* Move as much as possibly */
- memcpy((byte*) ptr,pPtr,(size_t) uSize); /* Copy old data */
- _myfree(pPtr,sFile,uLine,0); /* Free not needed area */
- }
- else
- {
- if (MyFlags & MY_HOLD_ON_ERROR)
- DBUG_RETURN(pPtr);
- if (MyFlags & MY_FREE_ON_ERROR)
- _myfree(pPtr,sFile,uLine,0);
- }
- DBUG_RETURN(ptr);
-} /* _myrealloc */
-
-
-/*
- * void _myfree( my_string pPtr, my_string sFile, uint uLine, myf myflags)
- * Deallocate some memory.
- */
-
-void _myfree (gptr pPtr, const char *sFile, uint uLine, myf myflags)
-{
- struct remember *pRec;
- DBUG_ENTER("_myfree");
- DBUG_PRINT("enter",("ptr: %lx",pPtr));
-
- if (!sf_malloc_quick)
- (void) _sanity (sFile, uLine);
-
- if ((!pPtr && (myflags & MY_ALLOW_ZERO_PTR)) ||
- check_ptr("Freeing",(byte*) pPtr,sFile,uLine))
- DBUG_VOID_RETURN;
-
- /* Calculate the address of the remember structure */
- pRec = (struct remember *) ((byte*) pPtr-sizeof(struct irem)-
- sf_malloc_prehunc);
-
- /* Check to make sure that we have a real remember structure */
- /* Note: this test could fail for four reasons: */
- /* (1) The memory was already free'ed */
- /* (2) The memory was never new'ed */
- /* (3) There was an underrun */
- /* (4) A stray pointer hit this location */
-
- if (*((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc))
- != MAGICKEY)
- {
- fprintf (stderr, "Freeing unallocated data at line %d, '%s'\n",
- uLine, sFile);
- DBUG_PRINT("safe",("Unallocated data at line %d, '%s'",uLine,sFile));
- (void) fflush(stderr);
- DBUG_VOID_RETURN;
- }
-
- /* Remove this structure from the linked list */
- pthread_mutex_lock(&THR_LOCK_malloc);
- if (pRec -> pPrev) {
- pRec -> pPrev -> pNext = pRec -> pNext;
- } else {
- pRememberRoot = pRec -> pNext;
- }
- if (pRec -> pNext) {
- pRec -> pNext -> pPrev = pRec -> pPrev;
- }
- /* Handle the statistics */
- lCurMemory -= pRec -> uDataSize;
- cNewCount--;
- pthread_mutex_unlock(&THR_LOCK_malloc);
-
-#ifndef HAVE_purify
- /* Mark this data as free'ed */
- bfill(&pRec->aData[sf_malloc_prehunc],pRec->uDataSize,(pchar) FREE_VAL);
-#endif
- *((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc)) = ~MAGICKEY;
-
- /* Actually free the memory */
- free ((my_string ) pRec);
- DBUG_VOID_RETURN;
-}
-
- /* Check if we have a wrong pointer */
-
-static int check_ptr(const char *where, byte *ptr, const char *sFile,
- uint uLine)
-{
- if (!ptr)
- {
- fprintf (stderr, "%s NULL pointer at line %d, '%s'\n",
- where,uLine, sFile);
- DBUG_PRINT("safe",("Null pointer at line %d '%s'", uLine, sFile));
- (void) fflush(stderr);
- return 1;
- }
-#ifndef _MSC_VER
- if ((long) ptr & (MY_ALIGN(1,sizeof(char *))-1))
- {
- fprintf (stderr, "%s wrong aligned pointer at line %d, '%s'\n",
- where,uLine, sFile);
- DBUG_PRINT("safe",("Wrong aligned pointer at line %d, '%s'",
- uLine,sFile));
- (void) fflush(stderr);
- return 1;
- }
-#endif
- if (ptr < sf_min_adress || ptr > sf_max_adress)
- {
- fprintf (stderr, "%s pointer out of range at line %d, '%s'\n",
- where,uLine, sFile);
- DBUG_PRINT("safe",("Pointer out of range at line %d '%s'",
- uLine,sFile));
- (void) fflush(stderr);
- return 1;
- }
- return 0;
-}
-
-
-/*
- * TERMINATE(FILE *file)
- * Report on all the memory pieces that have not been
- * free'ed as well as the statistics.
- */
-
-void TERMINATE (FILE *file)
-{
- struct remember *pPtr;
- DBUG_ENTER("TERMINATE");
- pthread_mutex_lock(&THR_LOCK_malloc);
-
- /* Report the difference between number of calls to */
- /* NEW and the number of calls to FREE. >0 means more */
- /* NEWs than FREEs. <0, etc. */
-
- if (cNewCount)
- {
- if (file)
- {
- fprintf (file, "cNewCount: %d\n", cNewCount);
- (void) fflush(file);
- }
- DBUG_PRINT("safe",("cNewCount: %d",cNewCount));
- }
-
- /* Report on all the memory that was allocated with NEW */
- /* but not free'ed with FREE. */
-
- if ((pPtr=pRememberRoot))
- {
- if (file)
- {
- fprintf(file, "Memory that was not free'ed (%ld bytes):\n",lCurMemory);
- (void) fflush(file);
- }
- DBUG_PRINT("safe",("Memory that was not free'ed (%ld bytes):",lCurMemory));
- while (pPtr)
- {
- if (file)
- {
- fprintf (file,
- "\t%6u bytes at 0x%09lx, allocated at line %4u in '%s'\n",
- pPtr -> uDataSize,
- (ulong) &(pPtr -> aData[sf_malloc_prehunc]),
- pPtr -> uLineNum, pPtr -> sFileName);
- (void) fflush(file);
- }
- DBUG_PRINT("safe",
- ("%6u bytes at 0x%09lx, allocated at line %4d in '%s'",
- pPtr -> uDataSize, &(pPtr -> aData[sf_malloc_prehunc]),
- pPtr -> uLineNum, pPtr -> sFileName));
- pPtr = pPtr -> pNext;
- }
- }
- /* Report the memory usage statistics */
- if (file)
- {
- fprintf (file, "Maximum memory usage: %ld bytes (%ldk)\n",
- lMaxMemory, (lMaxMemory + 1023L) / 1024L);
- (void) fflush(file);
- }
- DBUG_PRINT("safe",("Maximum memory usage: %ld bytes (%ldk)",
- lMaxMemory, (lMaxMemory + 1023L) / 1024L));
- pthread_mutex_unlock(&THR_LOCK_malloc);
- DBUG_VOID_RETURN;
-}
-
-
- /* Returns 0 if chunk is ok */
-
-static int _checkchunk (register struct remember *pRec, const char *sFile,
- uint uLine)
-{
- reg1 uint uSize;
- reg2 my_string magicp;
- reg3 int flag=0;
-
- /* Check for a possible underrun */
- if (*((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc))
- != MAGICKEY)
- {
- fprintf (stderr, "Memory allocated at %s:%d was underrun,",
- pRec -> sFileName, pRec -> uLineNum);
- fprintf (stderr, " discovered at %s:%d\n", sFile, uLine);
- (void) fflush(stderr);
- DBUG_PRINT("safe",("Underrun at %lx, allocated at %s:%d",
- &(pRec -> aData[sf_malloc_prehunc]),
- pRec -> sFileName,
- pRec -> uLineNum));
- flag=1;
- }
-
- /* Check for a possible overrun */
- uSize = pRec -> uDataSize;
- magicp = &(pRec -> aData[uSize+sf_malloc_prehunc]);
- if (*magicp++ != MAGICEND0 ||
- *magicp++ != MAGICEND1 ||
- *magicp++ != MAGICEND2 ||
- *magicp++ != MAGICEND3)
- {
- fprintf (stderr, "Memory allocated at %s:%d was overrun,",
- pRec -> sFileName, pRec -> uLineNum);
- fprintf (stderr, " discovered at '%s:%d'\n", sFile, uLine);
- (void) fflush(stderr);
- DBUG_PRINT("safe",("Overrun at %lx, allocated at %s:%d",
- &(pRec -> aData[sf_malloc_prehunc]),
- pRec -> sFileName,
- pRec -> uLineNum));
- flag=1;
- }
- return(flag);
-}
-
-
- /* Returns how many wrong chunks */
-
-int _sanity (const char *sFile, uint uLine)
-{
- reg1 struct remember *pTmp;
- reg2 int flag=0;
- uint count=0;
-
- pthread_mutex_lock(&THR_LOCK_malloc);
- count=cNewCount;
- for (pTmp = pRememberRoot; pTmp != NULL && count-- ; pTmp = pTmp -> pNext)
- flag+=_checkchunk (pTmp, sFile, uLine);
- pthread_mutex_unlock(&THR_LOCK_malloc);
- if (count || pTmp)
- {
- const char *format="Safemalloc link list destroyed, discovered at '%s:%d'";
- fprintf (stderr, format, sFile, uLine); fputc('\n',stderr);
- (void) fflush(stderr);
- DBUG_PRINT("safe",(format, sFile, uLine));
- flag=1;
- }
- return flag;
-} /* _sanity */
-
-
- /* malloc and copy */
-
-gptr _my_memdup(const byte *from, uint length, const char *sFile, uint uLine,
- myf MyFlags)
-{
- gptr ptr;
- if ((ptr=_mymalloc(length,sFile,uLine,MyFlags)) != 0)
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
- return(ptr);
-} /*_my_memdup */
-
-
-my_string _my_strdup(const char *from, const char *sFile, uint uLine,
- myf MyFlags)
-{
- gptr ptr;
- uint length=(uint) strlen(from)+1;
- if ((ptr=_mymalloc(length,sFile,uLine,MyFlags)) != 0)
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
- return((my_string) ptr);
-} /* _my_strdup */
diff --git a/ext/mysql/libmysql/stamp-h.in b/ext/mysql/libmysql/stamp-h.in
deleted file mode 100644
index 9788f70238..0000000000
--- a/ext/mysql/libmysql/stamp-h.in
+++ /dev/null
@@ -1 +0,0 @@
-timestamp
diff --git a/ext/mysql/libmysql/str2int.c b/ext/mysql/libmysql/str2int.c
deleted file mode 100644
index a9cb9911fc..0000000000
--- a/ext/mysql/libmysql/str2int.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- str2int(src, radix, lower, upper, &val)
- converts the string pointed to by src to an integer and stores it in
- val. It skips leading spaces and tabs (but not newlines, formfeeds,
- backspaces), then it accepts an optional sign and a sequence of digits
- in the specified radix. The result should satisfy lower <= *val <= upper.
- The result is a pointer to the first character after the number;
- trailing spaces will NOT be skipped.
-
- If an error is detected, the result will be NullS, the value put
- in val will be 0, and errno will be set to
- EDOM if there are no digits
- ERANGE if the result would overflow or otherwise fail to lie
- within the specified bounds.
- Check that the bounds are right for your machine.
- This looks amazingly complicated for what you probably thought was an
- easy task. Coping with integer overflow and the asymmetric range of
- twos complement machines is anything but easy.
-
- So that users of atoi and atol can check whether an error occured,
- I have taken a wholly unprecedented step: errno is CLEARED if this
- call has no problems.
-*/
-
-#include <global.h>
-#include "m_string.h"
-#include "m_ctype.h"
-#include "my_sys.h" /* defines errno */
-#include <errno.h>
-
-#define char_val(X) (X >= '0' && X <= '9' ? X-'0' :\
- X >= 'A' && X <= 'Z' ? X-'A'+10 :\
- X >= 'a' && X <= 'z' ? X-'a'+10 :\
- '\177')
-
-char *str2int(register const char *src, register int radix, long int lower, long int upper, long int *val)
-{
- int sign; /* is number negative (+1) or positive (-1) */
- int n; /* number of digits yet to be converted */
- long limit; /* "largest" possible valid input */
- long scale; /* the amount to multiply next digit by */
- long sofar; /* the running value */
- register int d; /* (negative of) next digit */
- char *start;
- int digits[32]; /* Room for numbers */
-
- /* Make sure *val is sensible in case of error */
-
- *val = 0;
-
- /* Check that the radix is in the range 2..36 */
-
-#ifndef DBUG_OFF
- if (radix < 2 || radix > 36) {
- errno=EDOM;
- return NullS;
- }
-#endif
-
- /* The basic problem is: how do we handle the conversion of
- a number without resorting to machine-specific code to
- check for overflow? Obviously, we have to ensure that
- no calculation can overflow. We are guaranteed that the
- "lower" and "upper" arguments are valid machine integers.
- On sign-and-magnitude, twos-complement, and ones-complement
- machines all, if +|n| is representable, so is -|n|, but on
- twos complement machines the converse is not true. So the
- "maximum" representable number has a negative representative.
- Limit is set to min(-|lower|,-|upper|); this is the "largest"
- number we are concerned with. */
-
- /* Calculate Limit using Scale as a scratch variable */
-
- if ((limit = lower) > 0) limit = -limit;
- if ((scale = upper) > 0) scale = -scale;
- if (scale < limit) limit = scale;
-
- /* Skip leading spaces and check for a sign.
- Note: because on a 2s complement machine MinLong is a valid
- integer but |MinLong| is not, we have to keep the current
- converted value (and the scale!) as *negative* numbers,
- so the sign is the opposite of what you might expect.
- */
- while (isspace(*src)) src++;
- sign = -1;
- if (*src == '+') src++; else
- if (*src == '-') src++, sign = 1;
-
- /* Skip leading zeros so that we never compute a power of radix
- in scale that we won't have a need for. Otherwise sticking
- enough 0s in front of a number could cause the multiplication
- to overflow when it neededn't.
- */
- start=(char*) src;
- while (*src == '0') src++;
-
- /* Move over the remaining digits. We have to convert from left
- to left in order to avoid overflow. Answer is after last digit.
- */
-
- for (n = 0; (digits[n]=char_val(*src)) < radix && n < 20; n++,src++) ;
-
- /* Check that there is at least one digit */
-
- if (start == src) {
- errno=EDOM;
- return NullS;
- }
-
- /* The invariant we want to maintain is that src is just
- to the right of n digits, we've converted k digits to
- sofar, scale = -radix**k, and scale < sofar < 0. Now
- if the final number is to be within the original
- Limit, we must have (to the left)*scale+sofar >= Limit,
- or (to the left)*scale >= Limit-sofar, i.e. the digits
- to the left of src must form an integer <= (Limit-sofar)/(scale).
- In particular, this is true of the next digit. In our
- incremental calculation of Limit,
-
- IT IS VITAL that (-|N|)/(-|D|) = |N|/|D|
- */
-
- for (sofar = 0, scale = -1; --n >= 1;)
- {
- if ((long) -(d=digits[n]) < limit) {
- errno=ERANGE;
- return NullS;
- }
- limit = (limit+d)/radix, sofar += d*scale; scale *= radix;
- }
- if (n == 0)
- {
- if ((long) -(d=digits[n]) < limit) /* get last digit */
- {
- errno=ERANGE;
- return NullS;
- }
- sofar+=d*scale;
- }
-
- /* Now it might still happen that sofar = -32768 or its equivalent,
- so we can't just multiply by the sign and check that the result
- is in the range lower..upper. All of this caution is a right
- pain in the neck. If only there were a standard routine which
- says generate thus and such a signal on integer overflow...
- But not enough machines can do it *SIGH*.
- */
- if (sign < 0)
- {
- if (sofar < -LONG_MAX || (sofar= -sofar) > upper)
- {
- errno=ERANGE;
- return NullS;
- }
- }
- else if (sofar < lower)
- {
- errno=ERANGE;
- return NullS;
- }
- *val = sofar;
- errno=0; /* indicate that all went well */
- return (char*) src;
-}
-
- /* Theese are so slow compared with ordinary, optimized atoi */
-
-#ifdef WANT_OUR_ATOI
-
-int atoi(const char *src)
-{
- long val;
- str2int(src, 10, (long) INT_MIN, (long) INT_MAX, &val);
- return (int) val;
-}
-
-
-long atol(const char *src)
-{
- long val;
- str2int(src, 10, LONG_MIN, LONG_MAX, &val);
- return val;
-}
-
-#endif /* WANT_OUR_ATOI */
diff --git a/ext/mysql/libmysql/strcend.c b/ext/mysql/libmysql/strcend.c
deleted file mode 100644
index ef4fb95d5c..0000000000
--- a/ext/mysql/libmysql/strcend.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : strcend.c
- Author : Michael Widenius: ifdef MC68000
- Updated: 20 April 1984
- Defines: strcend()
-
- strcend(s, c) returns a pointer to the first place in s where c
- occurs, or a pointer to the end-null of s if c does not occur in s.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-#if defined(MC68000) && defined(DS90)
-
-char *strcend(const char *s, pchar c)
-{
-asm(" movl 4(a7),a0 ");
-asm(" movl 8(a7),d1 ");
-asm(".L2: movb (a0)+,d0 ");
-asm(" cmpb d0,d1 ");
-asm(" beq .L1 ");
-asm(" tstb d0 ");
-asm(" bne .L2 ");
-asm(".L1: movl a0,d0 ");
-asm(" subql #1,d0 ");
-}
-
-#else
-
-char *strcend(register const char *s, register pchar c)
-{
- for (;;)
- {
- if (*s == (char) c) return (char*) s;
- if (!*s++) return (char*) s-1;
- }
-}
-
-#endif
diff --git a/ext/mysql/libmysql/strcont.c b/ext/mysql/libmysql/strcont.c
deleted file mode 100644
index cc75ec450e..0000000000
--- a/ext/mysql/libmysql/strcont.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : strcont.c
- Author : Monty
- Updated: 1988.07.27
- Defines: strcont()
-
- strcont(str, set) if str contanies any character in the string set.
- The result is the position of the first found character in str, or NullS
- if there isn't anything found.
-
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-my_string strcont(reg1 const char *str,reg2 const char *set)
-{
- reg3 my_string start = (my_string) set;
-
- while (*str)
- {
- while (*set)
- {
- if (*set++ == *str)
- return ((char*) str);
- }
- set=start; str++;
- }
- return (NullS);
-} /* strcont */
diff --git a/ext/mysql/libmysql/strend.c b/ext/mysql/libmysql/strend.c
deleted file mode 100644
index 18b9d1fbd0..0000000000
--- a/ext/mysql/libmysql/strend.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* File : strend.c
- Author : Richard A. O'Keefe.
- Updated: 23 April 1984
- Defines: strend()
-
- strend(s) returns a character pointer to the NUL which ends s. That
- is, strend(s)-s == strlen(s). This is useful for adding things at
- the end of strings. It is redundant, because strchr(s,'\0') could
- be used instead, but this is clearer and faster.
- Beware: the asm version works only if strlen(s) < 65535.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-#if VaxAsm
-
-char *strend(s)
-const char *s;
-{
- asm("locc $0,$65535,*4(ap)");
- asm("movl r1,r0");
-}
-
-#else /* ~VaxAsm */
-
-char *strend(register const char *s)
-{
- while (*s++);
- return (char*) (s-1);
-}
-
-#endif /* VaxAsm */
diff --git a/ext/mysql/libmysql/strfill.c b/ext/mysql/libmysql/strfill.c
deleted file mode 100644
index 2a8496b8b1..0000000000
--- a/ext/mysql/libmysql/strfill.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : strfill.c
- Author : Monty
- Updated: 1987.04.16
- Defines: strfill()
-
- strfill(dest, len, fill) makes a string of fill-characters. The result
- string is of length == len. The des+len character is allways set to NULL.
- strfill() returns pointer to dest+len;
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-my_string strfill(my_string s,uint len,pchar fill)
-{
- while (len--) *s++ = fill;
- *(s) = '\0';
- return(s);
-} /* strfill */
diff --git a/ext/mysql/libmysql/string.c b/ext/mysql/libmysql/string.c
deleted file mode 100644
index 5de6428242..0000000000
--- a/ext/mysql/libmysql/string.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Code for handling strings with can grow dynamicly.
- Copyright Monty Program KB.
- By monty.
-*/
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
-my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
- uint init_alloc, uint alloc_increment)
-{
- uint length;
- DBUG_ENTER("init_dynamic_string");
-
- if (!alloc_increment)
- alloc_increment=128;
- length=1;
- if (init_str && (length= (uint) strlen(init_str)+1) < init_alloc)
- init_alloc=((length+alloc_increment-1)/alloc_increment)*alloc_increment;
- if (!init_alloc)
- init_alloc=alloc_increment;
-
- if (!(str->str=(char*) my_malloc(init_alloc,MYF(MY_WME))))
- DBUG_RETURN(TRUE);
- str->length=length-1;
- if (init_str)
- memcpy(str->str,init_str,length);
- str->max_length=init_alloc;
- str->alloc_increment=alloc_increment;
- DBUG_RETURN(FALSE);
-}
-
-
-my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str)
-{
- uint length=0;
- DBUG_ENTER("dynstr_set");
-
- if (init_str && (length= (uint) strlen(init_str)+1) > str->max_length)
- {
- str->max_length=((length+str->alloc_increment-1)/str->alloc_increment)*
- str->alloc_increment;
- if (!str->max_length)
- str->max_length=str->alloc_increment;
- if (!(str->str=(char*) my_realloc(str->str,str->max_length,MYF(MY_WME))))
- DBUG_RETURN(TRUE);
- }
- if (init_str)
- {
- str->length=length-1;
- memcpy(str->str,init_str,length);
- }
- else
- str->length=0;
- DBUG_RETURN(FALSE);
-}
-
-
-my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size)
-{
- DBUG_ENTER("dynstr_realloc");
-
- if (!additional_size) DBUG_RETURN(FALSE);
- if (str->length + additional_size > str->max_length)
- {
- str->max_length=((str->length + additional_size+str->alloc_increment-1)/
- str->alloc_increment)*str->alloc_increment;
- if (!(str->str=(char*) my_realloc(str->str,str->max_length,MYF(MY_WME))))
- DBUG_RETURN(TRUE);
- }
- DBUG_RETURN(FALSE);
-}
-
-
-my_bool dynstr_append(DYNAMIC_STRING *str, const char *append)
-{
- return dynstr_append_mem(str,append,strlen(append));
-}
-
-
-my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
- uint length)
-{
- char *new_ptr;
- if (str->length+length >= str->max_length)
- {
- uint new_length=(str->length+length+str->alloc_increment)/
- str->alloc_increment;
- new_length*=str->alloc_increment;
- if (!(new_ptr=(char*) my_realloc(str->str,new_length,MYF(MY_WME))))
- return TRUE;
- str->str=new_ptr;
- str->max_length=new_length;
- }
- memcpy(str->str + str->length,append,length);
- str->length+=length;
- str->str[str->length]=0; /* Safety for C programs */
- return FALSE;
-}
-
-
-void dynstr_free(DYNAMIC_STRING *str)
-{
- if (str->str)
- {
- my_free(str->str,MYF(MY_WME));
- str->str=0;
- }
-}
diff --git a/ext/mysql/libmysql/strinstr.c b/ext/mysql/libmysql/strinstr.c
deleted file mode 100644
index ed165b9ce9..0000000000
--- a/ext/mysql/libmysql/strinstr.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : strinstr.c
- Author : Monty & David
- Updated: 1986.12.08
- Defines: strinstr()
-
- strinstr(src, pat) looks for an instance of pat in src. pat is not a
- regex(3) pattern, it is a literal string which must be matched exactly.
- The result 0 if the pattern was not found else it is the start char of
- the pattern counted from the beginning of the string, where the first
- char is 1.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-uint strinstr(reg1 const char *str,reg4 const char *search)
-{
- reg2 my_string i,j;
- my_string start = (my_string) str;
-
- skipp:
- while (*str != '\0')
- {
- if (*str++ == *search)
- {
- i=(my_string) str; j= (my_string) search+1;
- while (*j)
- if (*i++ != *j++) goto skipp;
- return ((uint) (str - start));
- }
- }
- return (0);
-}
diff --git a/ext/mysql/libmysql/strmake.c b/ext/mysql/libmysql/strmake.c
deleted file mode 100644
index 8bfe104aa5..0000000000
--- a/ext/mysql/libmysql/strmake.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : strmake.c
- Author : Michael Widenius
- Updated: 20 Jul 1984
- Defines: strmake()
-
- strmake(dst,src,length) moves length characters, or until end, of src to
- dst and appends a closing NUL to dst.
- Note that is strlen(src) >= length then dst[length] will be set to \0
- strmake() returns pointer to closing null
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-#ifdef BAD_STRING_COMPILER
-
-char *strmake(char *dst,const char *src,uint length)
-{
- reg1 char *res;
-
- if ((res=memccpy(dst,src,0,length)))
- return res-1;
- dst[length]=0;
- return dst+length;
-}
-
-#define strmake strmake_overlapp /* Use orginal for overlapping str */
-#endif
-
-char *strmake(register char *dst, register const char *src, uint length)
-{
- while (length--)
- if (! (*dst++ = *src++))
- return dst-1;
- *dst=0;
- return dst;
-}
diff --git a/ext/mysql/libmysql/strmov.c b/ext/mysql/libmysql/strmov.c
deleted file mode 100644
index 66e90a8d6c..0000000000
--- a/ext/mysql/libmysql/strmov.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- strmov(dst, src) moves all the characters of src (including the
- closing NUL) to dst, and returns a pointer to the new closing NUL in
- dst. The similar UNIX routine strcpy returns the old value of dst,
- which I have never found useful. strmov(strmov(dst,a),b) moves a//b
- into dst, which seems useful.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-#ifdef BAD_STRING_COMPILER
-#undef strmov
-#define strmov strmov_overlapp
-#endif
-
-#ifndef strmov
-
-#if !defined(MC68000) && !defined(DS90)
-
-char *strmov(register char *dst, register const char *src)
-{
- while ((*dst++ = *src++)) ;
- return dst-1;
-}
-
-#else
-
-char *strmov(dst, src)
- char *dst, *src;
-{
- asm(" movl 4(a7),a1 ");
- asm(" movl 8(a7),a0 ");
- asm(".L4: movb (a0)+,(a1)+ ");
- asm(" jne .L4 ");
- asm(" movl a1,d0 ");
- asm(" subql #1,d0 ");
-}
-
-#endif
-
-#endif /* strmov */
diff --git a/ext/mysql/libmysql/strnmov.c b/ext/mysql/libmysql/strnmov.c
deleted file mode 100644
index fd521fedea..0000000000
--- a/ext/mysql/libmysql/strnmov.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- strnmov(dst,src,length) moves length characters, or until end, of src to
- dst and appends a closing NUL to dst if src is shorter than length.
- The result is a pointer to the first NUL in dst, or is dst+n if dst was
- truncated.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-char *strnmov(register char *dst, register const char *src, uint n)
-{
- while (n-- != 0) {
- if (!(*dst++ = *src++)) {
- return (char*) dst-1;
- }
- }
- return dst;
-}
diff --git a/ext/mysql/libmysql/strto.c b/ext/mysql/libmysql/strto.c
deleted file mode 100644
index b858ef19ea..0000000000
--- a/ext/mysql/libmysql/strto.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- strtol,strtoul,strtoll,strtoull
- convert string to long, unsigned long, long long or unsigned long long.
- strtoxx(char *src,char **ptr,int base)
- converts the string pointed to by src to an long of appropriate long and
- returnes it. It skips leading spaces and tabs (but not newlines, formfeeds,
- backspaces), then it accepts an optional sign and a sequence of digits
- in the specified radix.
- If the value of ptr is not (char **)NULL, a pointer to the character
- terminating the scan is returned in the location pointed to by ptr.
- Trailing spaces will NOT be skipped.
-
- If an error is detected, the result will be LONG_MIN, 0 or LONG_MAX,
- (or LONGLONG..) and errno will be set to
- EDOM if there are no digits
- ERANGE if the result would overflow.
- the ptr will be set to src.
- This file is based on the strtol from the the GNU C Library.
- it can be compiled with the UNSIGNED and/or LONGLONG flag set
-*/
-
-#include <global.h>
-#include "m_string.h"
-#include "m_ctype.h"
-#include "my_sys.h" /* defines errno */
-#include <errno.h>
-
-#undef strtoull
-#undef strtoll
-#undef strtoul
-#undef strtol
-#ifdef USE_LONGLONG
-#define UTYPE_MAX (~(ulonglong) 0)
-#define TYPE_MIN LONGLONG_MIN
-#define TYPE_MAX LONGLONG_MAX
-#define longtype longlong
-#define ulongtype ulonglong
-#ifdef USE_UNSIGNED
-#define function ulongtype strtoull
-#else
-#define function longtype strtoll
-#endif
-#else
-#define UTYPE_MAX (ulong) ~0L
-#define TYPE_MIN LONG_MIN
-#define TYPE_MAX LONG_MAX
-#define longtype long
-#define ulongtype unsigned long
-#ifdef USE_UNSIGNED
-#define function ulongtype strtoul
-#else
-#define function longtype strtol
-#endif
-#endif
-
-
-/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
- If BASE is 0 the base is determined by the presence of a leading
- zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
- If BASE is < 2 or > 36, it is reset to 10.
- If ENDPTR is not NULL, a pointer to the character after the last
- one converted is stored in *ENDPTR. */
-
-
-function (const char *nptr,char **endptr,int base)
-{
- int negative;
- register ulongtype cutoff;
- register unsigned int cutlim;
- register ulongtype i;
- register const char *s;
- register unsigned char c;
- const char *save;
- int overflow;
-
- if (base < 0 || base == 1 || base > 36)
- base = 10;
-
- s = nptr;
-
- /* Skip white space. */
- while (isspace (*s))
- ++s;
- if (*s == '\0')
- {
- goto noconv;
- }
-
- /* Check for a sign. */
- if (*s == '-')
- {
- negative = 1;
- ++s;
- }
- else if (*s == '+')
- {
- negative = 0;
- ++s;
- }
- else
- negative = 0;
-
- if (base == 16 && s[0] == '0' && toupper (s[1]) == 'X')
- s += 2;
-
- /* If BASE is zero, figure it out ourselves. */
- if (base == 0)
- {
- if (*s == '0')
- {
- if (toupper (s[1]) == 'X')
- {
- s += 2;
- base = 16;
- }
- else
- base = 8;
- }
- else
- base = 10;
- }
-
- /* Save the pointer so we can check later if anything happened. */
- save = s;
-
- cutoff = UTYPE_MAX / (unsigned long int) base;
- cutlim = (uint) (UTYPE_MAX % (unsigned long int) base);
-
- overflow = 0;
- i = 0;
- for (c = *s; c != '\0'; c = *++s)
- {
- if (isdigit (c))
- c -= '0';
- else if (isalpha (c))
- c = toupper (c) - 'A' + 10;
- else
- break;
- if (c >= base)
- break;
- /* Check for overflow. */
- if (i > cutoff || (i == cutoff && c > cutlim))
- overflow = 1;
- else
- {
- i *= (ulongtype) base;
- i += c;
- }
- }
-
- /* Check if anything actually happened. */
- if (s == save)
- goto noconv;
-
- /* Store in ENDPTR the address of one character
- past the last character we converted. */
- if (endptr != NULL)
- *endptr = (char *) s;
-
-#ifndef USE_UNSIGNED
- /* Check for a value that is within the range of
- `unsigned long int', but outside the range of `long int'. */
- if (negative)
- {
- if (i > (ulongtype) TYPE_MIN)
- overflow = 1;
- }
- else if (i > (ulongtype) TYPE_MAX)
- overflow = 1;
-#endif
-
- if (overflow)
- {
- my_errno=ERANGE;
-#ifdef USE_UNSIGNED
- return UTYPE_MAX;
-#else
- return negative ? TYPE_MIN : TYPE_MAX;
-#endif
- }
-
- /* Return the result of the appropriate sign. */
- return (negative ? -((longtype) i) : (longtype) i);
-
-noconv:
- /* There was no number to convert. */
- my_errno=EDOM;
- if (endptr != NULL)
- *endptr = (char *) nptr;
- return 0L;
-}
diff --git a/ext/mysql/libmysql/strtoll.c b/ext/mysql/libmysql/strtoll.c
deleted file mode 100644
index d1d1e1e8b6..0000000000
--- a/ext/mysql/libmysql/strtoll.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* This is defines strtoll() if neaded */
-
-#include <global.h>
-#include <m_string.h>
-#if !defined(HAVE_STRTOLL) && defined(HAVE_LONG_LONG)
-#define USE_LONGLONG
-#include "strto.c"
-#endif
diff --git a/ext/mysql/libmysql/strtoull.c b/ext/mysql/libmysql/strtoull.c
deleted file mode 100644
index 9dea75fd28..0000000000
--- a/ext/mysql/libmysql/strtoull.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* This is defines strtoull() */
-
-#include <global.h>
-#include <m_string.h>
-#if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG)
-#define USE_UNSIGNED
-#define USE_LONGLONG
-#include "strto.c"
-#endif
diff --git a/ext/mysql/libmysql/strxmov.c b/ext/mysql/libmysql/strxmov.c
deleted file mode 100644
index 7ee1d303ee..0000000000
--- a/ext/mysql/libmysql/strxmov.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* File : strxmov.c
- Author : Richard A. O'Keefe.
- Updated: 25 may 1984
- Defines: strxmov()
-
- strxmov(dst, src1, ..., srcn, NullS)
- moves the concatenation of src1,...,srcn to dst, terminates it
- with a NUL character, and returns a pointer to the terminating NUL.
- It is just like strmov except that it concatenates multiple sources.
- Beware: the last argument should be the null character pointer.
- Take VERY great care not to omit it! Also be careful to use NullS
- and NOT to use 0, as on some machines 0 is not the same size as a
- character pointer, or not the same bit pattern as NullS.
-*/
-
-#include <global.h>
-#include "m_string.h"
-#include <stdarg.h>
-
-char *strxmov(char *dst,const char *src, ...)
-{
- va_list pvar;
-
- va_start(pvar,src);
- while (src != NullS) {
- while ((*dst++ = *src++)) ;
- dst--;
- src = va_arg(pvar, char *);
- }
- va_end(pvar);
- *dst = 0; /* there might have been no sources! */
- return dst;
-}
diff --git a/ext/mysql/libmysql/thr_alarm.h b/ext/mysql/libmysql/thr_alarm.h
deleted file mode 100644
index c6d70029c5..0000000000
--- a/ext/mysql/libmysql/thr_alarm.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Prototypes when using thr_alarm library functions */
-
-#ifndef _thr_alarm_h
-#define _thr_alarm_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef USE_ALARM_THREAD
-#define USE_ONE_SIGNAL_HAND /* One must call process_alarm */
-#endif
-#ifdef HAVE_LINUXTHREADS
-#define THR_CLIENT_ALARM SIGALRM
-#else
-#define THR_CLIENT_ALARM SIGUSR1
-#endif
-#ifdef HAVE_rts_threads
-#undef USE_ONE_SIGNAL_HAND
-#define USE_ALARM_THREAD
-#define THR_SERVER_ALARM SIGUSR1
-#else
-#define THR_SERVER_ALARM SIGALRM
-#endif
-
-#if defined(DONT_USE_THR_ALARM)
-
-#define USE_ALARM_THREAD
-#undef USE_ONE_SIGNAL_HAND
-
-typedef struct st_thr_alarm_entry
-{
- uint crono;
-} thr_alarm_entry;
-
-#define thr_alarm_init(A) (A)->crono=0
-#define thr_alarm_in_use(A) (A)->crono
-#define init_thr_alarm(A)
-#define thr_alarm_kill(A)
-#define end_thr_alarm()
-#define thr_alarm(A,B) (((A)->crono=1)-1)
-#define thr_got_alarm(A) (A)->crono
-#define thr_end_alarm(A)
-
-#else
-#if defined(__WIN__)
-typedef struct st_thr_alarm_entry
-{
- rf_SetTimer crono;
-} thr_alarm_entry;
-
-#elif defined(__EMX__) || defined(OS2)
-
-typedef struct st_thr_alarm_entry
-{
- uint crono;
- uint event;
-} thr_alarm_entry;
-
-#else /* System with posix threads */
-
-typedef int thr_alarm_entry;
-
-#define thr_got_alarm(thr_alarm) (**(thr_alarm))
-
-#endif /* __WIN__ */
-
-typedef thr_alarm_entry* thr_alarm_t;
-
-typedef struct st_alarm {
- ulong expire_time;
- thr_alarm_entry alarmed; /* set when alarm is due */
- pthread_t thread;
- my_bool malloced;
-} ALARM;
-
-#define thr_alarm_init(A) (*(A))=0
-#define thr_alarm_in_use(A) (*(A)!= 0)
-void init_thr_alarm(uint max_alarm);
-bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
-void thr_alarm_kill(pthread_t thread_id);
-void thr_end_alarm(thr_alarm_t *alarmed);
-void end_thr_alarm(void);
-sig_handler process_alarm(int);
-#ifndef thr_got_alarm
-bool thr_got_alarm(thr_alarm_t *alrm);
-#endif
-
-
-#endif /* DONT_USE_THR_ALARM */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* _thr_alarm_h */
-
diff --git a/ext/mysql/libmysql/thr_mutex.c b/ext/mysql/libmysql/thr_mutex.c
deleted file mode 100644
index 7ec8bfb59a..0000000000
--- a/ext/mysql/libmysql/thr_mutex.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* This makes a wrapper for mutex handling to make it easier to debug mutex */
-
-#include <global.h>
-#if defined(HAVE_LINUXTHREADS) && !defined (__USE_UNIX98)
-#define __USE_UNIX98 /* To get rw locks under Linux */
-#endif
-#include <m_string.h>
-#if defined(THREAD) && defined(SAFE_MUTEX)
-#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */
-#include <my_pthread.h>
-
-#ifndef DO_NOT_REMOVE_THREAD_WRAPPERS
-/* Remove wrappers */
-#undef pthread_mutex_init
-#undef pthread_mutex_lock
-#undef pthread_mutex_unlock
-#undef pthread_mutex_destroy
-#undef pthread_cond_wait
-#undef pthread_cond_timedwait
-#ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT
-#define pthread_mutex_init(a,b) my_pthread_mutex_init((a),(b))
-#endif
-#endif /* DO_NOT_REMOVE_THREAD_WRAPPERS */
-
-int safe_mutex_init(safe_mutex_t *mp,
- const pthread_mutexattr_t *attr __attribute__((unused)))
-{
- bzero((char*) mp,sizeof(*mp));
- pthread_mutex_init(&mp->global,MY_MUTEX_INIT_ERRCHK);
- pthread_mutex_init(&mp->mutex,attr);
- return 0;
-}
-
-int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line)
-{
- int error;
- pthread_mutex_lock(&mp->global);
- if (mp->count > 0 && pthread_equal(pthread_self(),mp->thread))
- {
- fprintf(stderr,"safe_mutex: Trying to lock mutex at %s, line %d, when the mutex was already locked at %s, line %d\n",
- file,line,mp->file,mp->line);
- fflush(stderr);
- abort();
- }
- pthread_mutex_unlock(&mp->global);
- error=pthread_mutex_lock(&mp->mutex);
- if (error || (error=pthread_mutex_lock(&mp->global)))
- {
- fprintf(stderr,"Got error %d when trying to lock mutex at %s, line %d\n",
- error, file, line);
- fflush(stderr);
- abort();
- }
- if (mp->count++)
- {
- fprintf(stderr,"safe_mutex: Error in thread libray: Got mutex at %s, line %d more than 1 time\n", file,line);
- fflush(stderr);
- abort();
- }
- mp->thread=pthread_self();
- mp->file= (char*) file;
- mp->line=line;
- pthread_mutex_unlock(&mp->global);
- return error;
-}
-
-
-int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line)
-{
- int error;
- pthread_mutex_lock(&mp->global);
- if (mp->count == 0)
- {
- fprintf(stderr,"safe_mutex: Trying to unlock mutex that wasn't locked at %s, line %d\n Last used at %s, line: %d\n",
- file,line,mp->file ? mp->file : "",mp->line);
- fflush(stderr);
- abort();
- }
- if (!pthread_equal(pthread_self(),mp->thread))
- {
- fprintf(stderr,"safe_mutex: Trying to unlock mutex at %s, line %d that was locked by another thread at: %s, line: %d\n",
- file,line,mp->file,mp->line);
- fflush(stderr);
- abort();
- }
- mp->count--;
-#ifdef __WIN__
- pthread_mutex_unlock(&mp->mutex);
- error=0;
-#else
- error=pthread_mutex_unlock(&mp->mutex);
- if (error)
- {
- fprintf(stderr,"safe_mutex: Got error: %d when trying to unlock mutex at %s, line %d\n", error, file, line);
- fflush(stderr);
- abort();
- }
-#endif /* __WIN__ */
- pthread_mutex_unlock(&mp->global);
- return error;
-}
-
-
-int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file,
- uint line)
-{
- int error;
- pthread_mutex_lock(&mp->global);
- if (mp->count == 0)
- {
- fprintf(stderr,"safe_mutex: Trying to cond_wait on a unlocked mutex at %s, line %d\n",file,line);
- fflush(stderr);
- abort();
- }
- if (!pthread_equal(pthread_self(),mp->thread))
- {
- fprintf(stderr,"safe_mutex: Trying to cond_wait on a mutex at %s, line %d that was locked by another thread at: %s, line: %d\n",
- file,line,mp->file,mp->line);
- fflush(stderr);
- abort();
- }
-
- if (mp->count-- != 1)
- {
- fprintf(stderr,"safe_mutex: Count was %d on locked mutex at %s, line %d\n",
- mp->count+1, file, line);
- fflush(stderr);
- abort();
- }
- pthread_mutex_unlock(&mp->global);
- error=pthread_cond_wait(cond,&mp->mutex);
- pthread_mutex_lock(&mp->global);
- if (error)
- {
- fprintf(stderr,"safe_mutex: Got error: %d when doing a safe_mutex_wait at %s, line %d\n", error, file, line);
- fflush(stderr);
- abort();
- }
- if (mp->count++)
- {
- fprintf(stderr,
- "safe_mutex: Count was %d in thread %lx when locking mutex at %s, line %d\n",
- mp->count-1, my_thread_id(), file, line);
- fflush(stderr);
- abort();
- }
- mp->thread=pthread_self();
- mp->file= (char*) file;
- mp->line=line;
- pthread_mutex_unlock(&mp->global);
- return error;
-}
-
-
-int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
- struct timespec *abstime,
- const char *file, uint line)
-{
- int error;
- pthread_mutex_lock(&mp->global);
- if (mp->count != 1 || !pthread_equal(pthread_self(),mp->thread))
- {
- fprintf(stderr,"safe_mutex: Trying to cond_wait at %s, line %d on a not hold mutex\n",file,line);
- fflush(stderr);
- abort();
- }
- mp->count--; /* Mutex will be released */
- pthread_mutex_unlock(&mp->global);
- error=pthread_cond_timedwait(cond,&mp->mutex,abstime);
-#ifdef EXTRA_DEBUG
- if (error && (error != EINTR && error != ETIMEDOUT))
- {
- fprintf(stderr,"safe_mutex: Got error: %d when doing a safe_mutex_timedwait at %s, line %d\n", error, file, line);
- }
-#endif
- pthread_mutex_lock(&mp->global);
- if (mp->count++)
- {
- fprintf(stderr,
- "safe_mutex: Count was %d in thread %lx when locking mutex at %s, line %d (error: %d)\n",
- mp->count-1, my_thread_id(), file, line, error);
- fflush(stderr);
- abort();
- }
- mp->thread=pthread_self();
- mp->file= (char*) file;
- mp->line=line;
- pthread_mutex_unlock(&mp->global);
- return error;
-}
-
-int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line)
-{
- int error=0;
- if (mp->count != 0)
- {
- fprintf(stderr,"safe_mutex: Trying to destroy a mutex that was locked at %s, line %d at %s, line %d\n",
- mp->file,mp->line, file, line);
- fflush(stderr);
- abort();
- }
-#ifdef __WIN__
- pthread_mutex_destroy(&mp->global);
- pthread_mutex_destroy(&mp->mutex);
-#else
- if (pthread_mutex_destroy(&mp->global))
- error=1;
- if (pthread_mutex_destroy(&mp->mutex))
- error=1;
-#endif
- return error;
-}
-
-#endif /* THREAD && SAFE_MUTEX */
diff --git a/ext/mysql/libmysql/typelib.c b/ext/mysql/libmysql/typelib.c
deleted file mode 100644
index 0fd4415b2c..0000000000
--- a/ext/mysql/libmysql/typelib.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Functions to handle typelib */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-#include <m_ctype.h>
-
-/***************************************************************************
-** Search after a fieldtype. Endspace in x is not compared.
-** If part, uniq field is found and full_name == 0 then x is expanded
-** to full field.
-** full_name has the following bit values:
-** If & 1 accept only whole names
-** If & 2 don't expand if half field
-** If & 4 allow #number# as type
-****************************************************************************/
-
-int find_type(my_string x, TYPELIB *typelib, uint full_name)
-{
- int find,pos,findpos;
- reg1 my_string i;
- reg2 const char *j;
- DBUG_ENTER("find_type");
- DBUG_PRINT("enter",("x: '%s' lib: %lx",x,typelib));
-
- if (!typelib->count)
- {
- DBUG_PRINT("exit",("no count"));
- DBUG_RETURN(0);
- }
- LINT_INIT(findpos);
- find=0;
- for (pos=0 ; (j=typelib->type_names[pos]) ; pos++)
- {
- for (i=x ; *i && toupper(*i) == toupper(*j) ; i++, j++) ;
- if (! *j)
- {
- while (*i == ' ')
- i++; /* skipp_end_space */
- if (! *i)
- DBUG_RETURN(pos+1);
- }
- if (! *i && (!*j || !(full_name & 1)))
- {
- find++;
- findpos=pos;
- }
- }
- if (find == 0 && (full_name & 4) && x[0] == '#' && strend(x)[-1] == '#' &&
- (findpos=atoi(x+1)-1) >= 0 && (uint) findpos < typelib->count)
- find=1;
- else if (find == 0 || ! x[0])
- {
- DBUG_PRINT("exit",("Couldn't find type"));
- DBUG_RETURN(0);
- }
- else if (find != 1 || (full_name & 1))
- {
- DBUG_PRINT("exit",("Too many possybilities"));
- DBUG_RETURN(-1);
- }
- if (!(full_name & 2))
- (void) strmov(x,typelib->type_names[findpos]);
- DBUG_RETURN(findpos+1);
-} /* find_type */
-
-
- /* Get name of type nr 'nr' */
- /* Warning first type is 1, 0 = empty field */
-
-void make_type(register my_string to, register uint nr, register TYPELIB *typelib)
-{
- DBUG_ENTER("make_type");
- if (!nr)
- to[0]=0;
- else
- (void) strmov(to,get_type(typelib,nr-1));
- DBUG_VOID_RETURN;
-} /* make_type */
-
-
- /* Get type */
- /* Warning first type is 0 */
-
-const char *get_type(TYPELIB *typelib, uint nr)
-{
- if (nr < (uint) typelib->count && typelib->type_names)
- return(typelib->type_names[nr]);
- return "?";
-}
diff --git a/ext/mysql/libmysql/update_sources b/ext/mysql/libmysql/update_sources
deleted file mode 100755
index 87547e483e..0000000000
--- a/ext/mysql/libmysql/update_sources
+++ /dev/null
@@ -1,103 +0,0 @@
-#! /usr/bin/perl -w
-
-# Maybe I should have used PHP instead? ;)
-
-use strict;
-$| = 1;
-
--f "libmysql.c" or die "$0 must be run from the libmysql directory\n";
-
-my $command = shift || usage();
-$command =~ /^--(?:update|huh|restore)$/ or usage();
-
-my $from = shift || '/my/mysql';
-my @source_dirs = qw/dbug strings mysys libmysql include/;
-my $source_re = qr/\.(?:cc?|h)$/;
-my %skip = (
- 'ctype_autoconf.c' => 1, # PHP uses a pre-made one
- 'ctype_extra_sources.c' => 1, # same here
- 'my_config.h' => 1, # we use php_config.h
-);
-
-opendir D, "."
- or die "can't opendir .: $!\n";
-my @files = grep { /$source_re/ and !$skip{$_} } readdir D;
-closedir D;
-
-if ($command eq '--restore')
-{
- foreach (@files)
- {
- -f "$_.orig" and
- system("mv -f $_.orig $_") and die "can't restore $_: $!\n";
- }
- exit 0;
-}
-
-if ($command eq '--huh')
-{
- diff_files();
- exit 0;
-}
-
-my %sources;
-foreach my $d (@source_dirs)
-{
- opendir D, "$from/$d" or die "opendir $from/$d: $!\n";
- foreach (grep { /$source_re/ } readdir D)
- {
- $sources{$_} ||= "$d/$_";
- }
- closedir D;
-}
-
-foreach my $f (@files)
-{
- my $s = $sources{$f} or die "can't find source file for $f\n";
- unlink "$f.orig";
- system("mv $f $f.orig") and die "can't move $f: $!\n";
- #print ">> ", scalar(`ls -l $from/$s`), "\n";
- print ">> $s\n";
- system("cp $from/$s $f") and die "can't copy $from/$s: $!\n";
- #print "]] ", scalar(`ls -l $f`), "\n";
-}
-
-system("chmod u+w @files") and die "can't set perms on files: $!\n";
-system("./fix_copyright @files") and die "can't fix copyright: $!\n";
-diff_files();
-
-exit 0;
-
-
-sub usage
-{
- die <<"EOF";
-usage: $0 --update [mysql-source-dir]
- $0 --huh
- $0 --restore
-
- Typical use is:
- \$ $0 --update 2>&1 > /tmp/php-update.diff
- \$ @{[$ENV{EDITOR}||'vi']} /tmp/php-update.diff #does it look okay?
- \$ Monkey around a bit
- \$ cvs diff -u | less # does this look okay?
- \$ rm *.orig
-EOF
-}
-
-sub diff_files {
- foreach my $f (@files)
- {
- if (!-f "$f.orig" or !system("diff -u $f.orig $f"))
- {
- print STDERR "SAME: $f\n";
- unlink "$f.orig";
- }
- else
- {
- print STDERR "DIFF: $f\n";
- $f eq 'config-win.h' and
- print STDERR "/n/nDon't forget to undefine HAVE_COMPRESS in $f/n/n/n";
- }
- }
-}
diff --git a/ext/mysql/libmysql/violite.c b/ext/mysql/libmysql/violite.c
deleted file mode 100644
index 957f8400ac..0000000000
--- a/ext/mysql/libmysql/violite.c
+++ /dev/null
@@ -1,429 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Note that we can't have assertion on file descriptors; The reason for
- this is that during mysql shutdown, another thread can close a file
- we are working on. In this case we should just return read errors from
- the file descriptior.
-*/
-
-#include <global.h>
-
-#ifndef HAVE_VIO /* is Vio suppored by the Vio lib ? */
-
-#include <errno.h>
-#include <assert.h>
-#include <violite.h>
-#include <my_sys.h>
-#include <my_net.h>
-#include <m_string.h>
-#ifdef HAVE_POLL
-#include <sys/poll.h>
-#endif
-#ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-
-#if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) && !defined(__FreeBSD__)
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#if !defined(alpha_linux_port)
-#include <netinet/tcp.h>
-#endif
-#endif
-
-#if defined(__EMX__) || defined(OS2)
-#define ioctlsocket ioctl
-#endif /* defined(__EMX__) */
-
-#if defined(MSDOS) || defined(__WIN__)
-#define O_NONBLOCK 1 /* For emulation of fcntl() */
-#endif
-#ifndef EWOULDBLOCK
-#define SOCKET_EWOULDBLOCK SOCKET_EAGAIN
-#endif
-
-#ifndef __WIN__
-#define HANDLE void *
-#endif
-
-struct st_vio
-{
- my_socket sd; /* my_socket - real or imaginary */
- HANDLE hPipe;
- my_bool localhost; /* Are we from localhost? */
- int fcntl_mode; /* Buffered fcntl(sd,F_GETFL) */
- struct sockaddr_in local; /* Local internet address */
- struct sockaddr_in remote; /* Remote internet address */
- enum enum_vio_type type; /* Type of connection */
- char desc[30]; /* String description */
-};
-
-typedef void *vio_ptr;
-typedef char *vio_cstring;
-
-/*
- * Helper to fill most of the Vio* with defaults.
- */
-
-static void vio_reset(Vio* vio, enum enum_vio_type type,
- my_socket sd, HANDLE hPipe,
- my_bool localhost)
-{
- bzero((char*) vio, sizeof(*vio));
- vio->type = type;
- vio->sd = sd;
- vio->hPipe = hPipe;
- vio->localhost= localhost;
-}
-
-/* Open the socket or TCP/IP connection and read the fnctl() status */
-
-Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
-{
- Vio *vio;
- DBUG_ENTER("vio_new");
- DBUG_PRINT("enter", ("sd=%d", sd));
- if ((vio = (Vio*) my_malloc(sizeof(*vio),MYF(MY_WME))))
- {
- vio_reset(vio, type, sd, 0, localhost);
- sprintf(vio->desc,
- (vio->type == VIO_TYPE_SOCKET ? "socket (%d)" : "TCP/IP (%d)"),
- vio->sd);
-#if !defined(___WIN__) && !defined(__EMX__) && !defined(OS2)
-#if !defined(NO_FCNTL_NONBLOCK)
- vio->fcntl_mode = fcntl(sd, F_GETFL);
-#elif defined(HAVE_SYS_IOCTL_H) /* hpux */
- /* Non blocking sockets doesn't work good on HPUX 11.0 */
- (void) ioctl(sd,FIOSNBIO,0);
-#endif
-#else /* !defined(__WIN__) && !defined(__EMX__) */
- {
- /* set to blocking mode by default */
- ulong arg=0, r;
- r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg, sizeof(arg));
- }
-#endif
- }
- DBUG_RETURN(vio);
-}
-
-
-#ifdef __WIN__
-
-Vio *vio_new_win32pipe(HANDLE hPipe)
-{
- Vio *vio;
- DBUG_ENTER("vio_new_handle");
- if ((vio = (Vio*) my_malloc(sizeof(Vio),MYF(MY_WME))))
- {
- vio_reset(vio, VIO_TYPE_NAMEDPIPE, 0, hPipe, TRUE);
- strmov(vio->desc, "named pipe");
- }
- DBUG_RETURN(vio);
-}
-
-#endif
-
-void vio_delete(Vio * vio)
-{
- /* It must be safe to delete null pointers. */
- /* This matches the semantics of C++'s delete operator. */
- if (vio)
- {
- if (vio->type != VIO_CLOSED)
- vio_close(vio);
- my_free((gptr) vio,MYF(0));
- }
-}
-
-int vio_errno(Vio *vio __attribute__((unused)))
-{
- return socket_errno; /* On Win32 this mapped to WSAGetLastError() */
-}
-
-
-int vio_read(Vio * vio, gptr buf, int size)
-{
- int r;
- DBUG_ENTER("vio_read");
- DBUG_PRINT("enter", ("sd=%d size=%d", vio->sd, size));
-#if defined( __WIN__) || defined(OS2)
- if (vio->type == VIO_TYPE_NAMEDPIPE)
- {
- DWORD length;
-#ifdef OS2
- if (!DosRead((HFILE)vio->hPipe, buf, size, &length))
- DBUG_RETURN(-1);
-#else
- if (!ReadFile(vio->hPipe, buf, size, &length, NULL))
- DBUG_RETURN(-1);
-#endif
- DBUG_RETURN(length);
- }
- r = recv(vio->sd, buf, size,0);
-#else
- errno=0; /* For linux */
- r = read(vio->sd, buf, size);
-#endif /* __WIN__ */
-#ifndef DBUG_OFF
- if (r < 0)
- {
- DBUG_PRINT("vio_error", ("Got error %d during read",socket_errno));
- }
-#endif /* DBUG_OFF */
- DBUG_PRINT("exit", ("%d", r));
- DBUG_RETURN(r);
-}
-
-
-int vio_write(Vio * vio, const gptr buf, int size)
-{
- int r;
- DBUG_ENTER("vio_write");
- DBUG_PRINT("enter", ("sd=%d size=%d", vio->sd, size));
-#if defined( __WIN__) || defined(OS2)
- if ( vio->type == VIO_TYPE_NAMEDPIPE)
- {
- DWORD length;
-#ifdef OS2
- if (!DosWrite((HFILE)vio->hPipe, (char*) buf, size, &length))
- DBUG_RETURN(-1);
-#else
- if (!WriteFile(vio->hPipe, (char*) buf, size, &length, NULL))
- DBUG_RETURN(-1);
-#endif
- DBUG_RETURN(length);
- }
- r = send(vio->sd, buf, size,0);
-#else
- r = write(vio->sd, buf, size);
-#endif /* __WIN__ */
-#ifndef DBUG_OFF
- if (r < 0)
- {
- DBUG_PRINT("vio_error", ("Got error on write: %d",socket_errno));
- }
-#endif /* DBUG_OFF */
- DBUG_PRINT("exit", ("%d", r));
- DBUG_RETURN(r);
-}
-
-
-int vio_blocking(Vio * vio, my_bool set_blocking_mode)
-{
- int r=0;
- DBUG_ENTER("vio_blocking");
- DBUG_PRINT("enter", ("set_blocking_mode: %d", (int) set_blocking_mode));
-
-#if !defined(___WIN__) && !defined(__EMX__) && !defined(OS2)
-#if !defined(NO_FCNTL_NONBLOCK)
-
- if (vio->sd >= 0)
- {
- int old_fcntl=vio->fcntl_mode;
- if (set_blocking_mode)
- vio->fcntl_mode &= ~O_NONBLOCK; /* clear bit */
- else
- vio->fcntl_mode |= O_NONBLOCK; /* set bit */
- if (old_fcntl != vio->fcntl_mode)
- r = fcntl(vio->sd, F_SETFL, vio->fcntl_mode);
- }
-#endif /* !defined(NO_FCNTL_NONBLOCK) */
-#else /* !defined(__WIN__) && !defined(__EMX__) */
-#ifndef __EMX__
- if (vio->type != VIO_TYPE_NAMEDPIPE)
-#endif
- {
- ulong arg;
- int old_fcntl=vio->fcntl_mode;
- if (set_blocking_mode)
- {
- arg = 0;
- vio->fcntl_mode &= ~O_NONBLOCK; /* clear bit */
- }
- else
- {
- arg = 1;
- vio->fcntl_mode |= O_NONBLOCK; /* set bit */
- }
- if (old_fcntl != vio->fcntl_mode)
- r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg, sizeof(arg));
- }
-#endif /* !defined(__WIN__) && !defined(__EMX__) */
- DBUG_RETURN(r);
-}
-
-my_bool
-vio_is_blocking(Vio * vio)
-{
- my_bool r;
- DBUG_ENTER("vio_is_blocking");
- r = !(vio->fcntl_mode & O_NONBLOCK);
- DBUG_PRINT("exit", ("%d", (int) r));
- DBUG_RETURN(r);
-}
-
-
-int vio_fastsend(Vio * vio __attribute__((unused)))
-{
- int r=0;
- DBUG_ENTER("vio_fastsend");
-
-#ifdef IPTOS_THROUGHPUT
- {
-#ifndef __EMX__
- int tos = IPTOS_THROUGHPUT;
- if (!setsockopt(vio->sd, IPPROTO_IP, IP_TOS, (void *) &tos, sizeof(tos)))
-#endif /* !__EMX__ */
- {
- int nodelay = 1;
- if (setsockopt(vio->sd, IPPROTO_TCP, TCP_NODELAY, (void *) &nodelay,
- sizeof(nodelay))) {
- DBUG_PRINT("warning",
- ("Couldn't set socket option for fast send"));
- r= -1;
- }
- }
- }
-#endif /* IPTOS_THROUGHPUT */
- DBUG_PRINT("exit", ("%d", r));
- DBUG_RETURN(r);
-}
-
-int vio_keepalive(Vio* vio, my_bool set_keep_alive)
-{
- int r=0;
- uint opt = 0;
- DBUG_ENTER("vio_keepalive");
- DBUG_PRINT("enter", ("sd=%d set_keep_alive=%d", vio->sd, (int)
- set_keep_alive));
- if (vio->type != VIO_TYPE_NAMEDPIPE)
- {
- if (set_keep_alive)
- opt = 1;
- r = setsockopt(vio->sd, SOL_SOCKET, SO_KEEPALIVE, (char *) &opt,
- sizeof(opt));
- }
- DBUG_RETURN(r);
-}
-
-
-my_bool
-vio_should_retry(Vio * vio __attribute__((unused)))
-{
- int en = socket_errno;
- return en == SOCKET_EAGAIN || en == SOCKET_EINTR || en == SOCKET_EWOULDBLOCK;
-}
-
-
-int vio_close(Vio * vio)
-{
- int r;
- DBUG_ENTER("vio_close");
-#ifdef __WIN__
- if (vio->type == VIO_TYPE_NAMEDPIPE)
- {
-#if defined(__NT__) && defined(MYSQL_SERVER)
- CancelIo(vio->hPipe);
- DisconnectNamedPipe(vio->hPipe);
-#endif
- r=CloseHandle(vio->hPipe);
- }
- else if (vio->type != VIO_CLOSED)
-#endif /* __WIN__ */
- {
- r=0;
- if (shutdown(vio->sd,2))
- r= -1;
- if (closesocket(vio->sd))
- r= -1;
- }
- if (r)
- {
- DBUG_PRINT("vio_error", ("close() failed, error: %d",socket_errno));
- /* FIXME: error handling (not critical for MySQL) */
- }
- vio->type= VIO_CLOSED;
- vio->sd= -1;
- DBUG_RETURN(r);
-}
-
-
-const char *vio_description(Vio * vio)
-{
- return vio->desc;
-}
-
-enum enum_vio_type vio_type(Vio* vio)
-{
- return vio->type;
-}
-
-my_socket vio_fd(Vio* vio)
-{
- return vio->sd;
-}
-
-
-my_bool vio_peer_addr(Vio * vio, char *buf)
-{
- DBUG_ENTER("vio_peer_addr");
- DBUG_PRINT("enter", ("sd=%d", vio->sd));
- if (vio->localhost)
- {
- strmov(buf,"127.0.0.1");
- }
- else
- {
- size_socket addrLen = sizeof(struct sockaddr);
- if (getpeername(vio->sd, (struct sockaddr *) (& (vio->remote)),
- &addrLen) != 0)
- {
- DBUG_PRINT("exit", ("getpeername, error: %d", socket_errno));
- DBUG_RETURN(1);
- }
- my_inet_ntoa(vio->remote.sin_addr,buf);
- }
- DBUG_PRINT("exit", ("addr=%s", buf));
- DBUG_RETURN(0);
-}
-
-
-void vio_in_addr(Vio *vio, struct in_addr *in)
-{
- DBUG_ENTER("vio_in_addr");
- if (vio->localhost)
- bzero((char*) in, sizeof(*in)); /* This should never be executed */
- else
- *in=vio->remote.sin_addr;
- DBUG_VOID_RETURN;
-}
-
-
-/* Return 0 if there is data to be read */
-
-my_bool vio_poll_read(Vio *vio,uint timeout)
-{
-#ifndef HAVE_POLL
- return 0;
-#else
- struct pollfd fds;
- int res;
- DBUG_ENTER("vio_poll");
- fds.fd=vio->sd;
- fds.events=POLLIN;
- fds.revents=0;
- if ((res=poll(&fds,1,(int) timeout*1000)) <= 0)
- {
- DBUG_RETURN(res < 0 ? 0 : 1); /* Don't return 1 on errors */
- }
- DBUG_RETURN(fds.revents & POLLIN ? 0 : 1);
-#endif
-}
-
-#endif /* HAVE_VIO */
diff --git a/ext/mysql/libmysql/violite.h b/ext/mysql/libmysql/violite.h
deleted file mode 100644
index e764ca02bd..0000000000
--- a/ext/mysql/libmysql/violite.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- * Vio Lite.
- * Purpose: include file for Vio that will work with C and C++
- */
-
-#ifndef vio_violite_h_
-#define vio_violite_h_
-
-#include "my_net.h" /* needed because of struct in_addr */
-
-#ifdef HAVE_VIO
-#include <Vio.h> /* Full VIO interface */
-#else
-
-/* Simple vio interface in C; The functions are implemented in violite.c */
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#ifndef Vio_defined
-#define Vio_defined
-struct st_vio; /* Only C */
-typedef struct st_vio Vio;
-#endif
-
-enum enum_vio_type { VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET,
- VIO_TYPE_NAMEDPIPE, VIO_TYPE_SSL};
-
-Vio* vio_new(my_socket sd,
- enum enum_vio_type type,
- my_bool localhost);
-#ifdef __WIN__
-Vio* vio_new_win32pipe(HANDLE hPipe);
-#endif
-void vio_delete(Vio* vio);
-
-/*
- * vio_read and vio_write should have the same semantics
- * as read(2) and write(2).
- */
-int vio_read( Vio* vio,
- gptr buf, int size);
-int vio_write( Vio* vio,
- const gptr buf,
- int size);
-/*
- * Whenever the socket is set to blocking mode or not.
- */
-int vio_blocking( Vio* vio,
- my_bool onoff);
-my_bool vio_is_blocking( Vio* vio);
-/*
- * setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible.
- */
- int vio_fastsend( Vio* vio);
-/*
- * setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible.
- */
-int vio_keepalive( Vio* vio,
- my_bool onoff);
-/*
- * Whenever we should retry the last read/write operation.
- */
-my_bool vio_should_retry( Vio* vio);
-/*
- * When the workday is over...
- */
-int vio_close( Vio* vio);
-/*
- * Short text description of the socket for those, who are curious..
- */
-const char* vio_description( Vio* vio);
-
-/* Return the type of the connection */
- enum enum_vio_type vio_type(Vio* vio);
-
-/* Return last error number */
-int vio_errno(Vio *vio);
-
-/* Get socket number */
-my_socket vio_fd(Vio *vio);
-
-/*
- * Remote peer's address and name in text form.
- */
-my_bool vio_peer_addr(Vio * vio, char *buf);
-
-/* Remotes in_addr */
-
-void vio_in_addr(Vio *vio, struct in_addr *in);
-
- /* Return 1 if there is data to be read */
-my_bool vio_poll_read(Vio *vio,uint timeout);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* HAVE_VIO */
-#endif /* vio_violite_h_ */
diff --git a/ext/mysql/mysql.dsp b/ext/mysql/mysql.dsp
deleted file mode 100644
index 896de36309..0000000000
--- a/ext/mysql/mysql.dsp
+++ /dev/null
@@ -1,171 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mysql" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mysql - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mysql.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mysql.mak" CFG="mysql - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mysql - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mysql - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mysql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mysql - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mysql - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4nts.lib /nologo /dll /machine:I386 /out:"Release/php_mysql.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "mysql - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4nts_debug.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_mysql.dll" /pdbtype:sept /libpath:"..\..\..\MySQL\lib\Debug" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "mysql - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4ts.lib /nologo /dll /debug /machine:I386 /out:"Debug_TS/php_mysql.dll" /pdbtype:sept /libpath:"..\..\..\MySQL\lib\Debug" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "mysql - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4ts.lib /nologo /dll /machine:I386 /out:"Release_TS/php_mysql.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "mysql - Win32 Release"
-# Name "mysql - Win32 Debug"
-# Name "mysql - Win32 Debug_TS"
-# Name "mysql - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_mysql.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mysql.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\Readme_w32.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/mysql/mysql.mak b/ext/mysql/mysql.mak
deleted file mode 100644
index 2ed0f82228..0000000000
--- a/ext/mysql/mysql.mak
+++ /dev/null
@@ -1,169 +0,0 @@
-# Temporarily here -- later may go into some batch file
-# which will set this as an environment variable
-PROJECT_ROOT = ..\..
-
-# Module details
-MODULE_NAME = phpmysql
-MODULE_DESC = "PHP 4.3 - MySQL Extension"
-VMAJ = 3
-VMIN = 0
-VREV = 0
-
-#include the common settings
-include $(PROJECT_ROOT)/netware/common.mif
-
-# MYSQL stuff
-MYSQL_DIR = P:/APPS/script/sw/mysql
-
-# Build type defaults to 'release'
-ifndef BUILD
-BUILD = release
-endif
-
-# Extensions of all input and output files
-.SUFFIXES:
-.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d
-
-# Source files
-C_SRC = php_mysql.c \
- start.c
-
-CPP_SRC_NODIR = $(notdir $(CPP_SRC))
-C_SRC_NODIR = $(notdir $(C_SRC))
-SRC_DIR = $(dir $(CPP_SRC) $(C_SRC))
-
-# Library files
-LIBRARY = $(MYSQL_DIR)/lib/libmysqlclient.lib
-
-# Destination directories and files
-OBJ_DIR = $(BUILD)
-FINAL_DIR = $(BUILD)
-OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.obj) $(C_SRC_NODIR:.c=.obj))
-DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.d) $(C_SRC_NODIR:.c=.d))
-
-# Binary file
-ifndef BINARY
- BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm
-endif
-
-# Compile flags
-C_FLAGS = -c -maxerrors 25 -msgstyle gcc -wchar_t on -bool on -processor Pentium
-C_FLAGS += -nostdinc -nosyspath
-C_FLAGS += -relax_pointers # To remove type-casting errors
-C_FLAGS += -DNETWARE -DZTS -DNEW_LIBC -DUSE_OLD_FUNCTIONS -DCOMPILE_DL_MYSQL=1
-C_FLAGS += -I. -I- -I$(PROJECT_ROOT) -I$(PROJECT_ROOT)/main
-C_FLAGS += -I$(PROJECT_ROOT)/ext/standard -I$(PROJECT_ROOT)/netware
-C_FLAGS += -I$(PROJECT_ROOT)/zend -I$(PROJECT_ROOT)/tsrm
-C_FLAGS += -I$(SDK_DIR)/include -I$(MWCIncludes)
-C_FLAGS += -I$(MYSQL_DIR)/include
-C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include
-
-
-# Extra stuff based on debug / release builds
-ifeq '$(BUILD)' 'debug'
- SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym
- C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -DDEBUGGING -DDKFBPON
- C_FLAGS += -exc cw -DZEND_DEBUG=1
- LD_FLAGS += -sym on -sym codeview4 -osym $(SYM_FILE)
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib
-else
- C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off -opt intrinsics
- C_FLAGS += -opt level=4 -DZEND_DEBUG=0
- LD_FLAGS += -sym off
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
-endif
-
-
-# Dependencies
-MODULE = LibC \
- phplib
-IMPORT = @$(SDK_DIR)/imports/libc.imp \
- @$(SDK_DIR)/imports/ws2nlm.imp \
- @$(MPK_DIR)/import/mpkOrg.imp \
- @$(PROJECT_ROOT)/netware/phplib.imp
-EXPORT = ($(MODULE_NAME)) get_module
-API = OutputToScreen
-
-# Virtual paths
-vpath %.cpp .
-vpath %.c . ..\..\netware
-vpath %.obj $(OBJ_DIR)
-
-
-all: prebuild project
-
-.PHONY: all
-
-prebuild:
- @if not exist $(OBJ_DIR) md $(OBJ_DIR)
-
-project: $(BINARY)
- @echo Build complete.
-
-$(OBJ_DIR)/%.d: %.cpp
- @echo Building Dependencies for $(<F)
- @$(CC) -M $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.d: %.c
- @echo Building Dependencies for $(<F)
- @$(CC) -M $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.obj: %.cpp
- @echo Compiling $?...
- @$(CC) $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.obj: %.c
- @echo Compiling $?...
- @$(CC) $< $(C_FLAGS) -o $@
-
-
-$(BINARY): $(OBJECTS)
- @echo Import $(IMPORT) > $(basename $@).def
-ifdef API
- @echo Import $(API) >> $(basename $@).def
-endif
- @echo Module $(MODULE) >> $(basename $@).def
-ifdef EXPORT
- @echo Export $(EXPORT) >> $(basename $@).def
-endif
- @echo AutoUnload >> $(basename $@).def
-ifeq '$(BUILD)' 'debug'
- @echo Debug >> $(basename $@).def
-endif
- @echo Flag_On 0x00000008 >> $(basename $@).def
- @echo Start _LibCPrelude >> $(basename $@).def
- @echo Exit _LibCPostlude >> $(basename $@).def
-
- $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc
- @echo xdcdata $(basename $@).xdc >> $(basename $@).def
-
- @echo Linking $@...
- @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link
- @echo $(LIBRARY) $(OBJECTS) >> $(basename $@).link
- @$(LINK) @$(basename $@).link
-
-
-.PHONY: clean
-clean: cleanobj cleanbin
-
-.PHONY: cleand
-cleand:
- @echo Deleting all dependency files...
- -@del "$(OBJ_DIR)\*.d"
-
-.PHONY: cleanobj
-cleanobj:
- @echo Deleting all object files...
- -@del "$(OBJ_DIR)\*.obj"
-
-.PHONY: cleanbin
-cleanbin:
- @echo Deleting binary files...
- -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm"
- @echo Deleting MAP, DEF files, etc....
- -@del "$(FINAL_DIR)\$(MODULE_NAME).map"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).def"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).link"
-ifeq '$(BUILD)' 'debug'
- -@del $(FINAL_DIR)\$(MODULE_NAME).sym
-endif
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
deleted file mode 100644
index f2bd945493..0000000000
--- a/ext/mysql/php_mysql.c
+++ /dev/null
@@ -1,2382 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- | Zak Greant <zak@mysql.com> |
- | Georg Richter <georg@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* TODO:
- *
- * ? Safe mode implementation
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-
-#if HAVE_MYSQL
-
-#ifdef PHP_WIN32
-# include <winsock2.h>
-# define signal(a, b) NULL
-#elif defined(NETWARE)
-# include <sys/socket.h>
-# define signal(a, b) NULL
-#else
-# if HAVE_SIGNAL_H
-# include <signal.h>
-# endif
-# if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-# endif
-# include <netdb.h>
-# include <netinet/in.h>
-#endif
-
-#include <mysql.h>
-#include "php_ini.h"
-#include "php_mysql.h"
-
-/* True globals, no need for thread safety */
-static int le_result, le_link, le_plink;
-
-#ifdef HAVE_MYSQL_REAL_CONNECT
-# ifdef HAVE_ERRMSG_H
-# include <errmsg.h>
-# endif
-#endif
-
-#define SAFE_STRING(s) ((s)?(s):"")
-
-#if MYSQL_VERSION_ID > 32199
-# define mysql_row_length_type unsigned long
-# define HAVE_MYSQL_ERRNO
-#else
-# define mysql_row_length_type unsigned int
-# ifdef mysql_errno
-# define HAVE_MYSQL_ERRNO
-# endif
-#endif
-
-#if MYSQL_VERSION_ID >= 32032
-#define HAVE_GETINFO_FUNCS
-#endif
-
-#if MYSQL_VERSION_ID > 32133 || defined(FIELD_TYPE_TINY)
-#define MYSQL_HAS_TINY
-#endif
-
-#if MYSQL_VERSION_ID >= 32200
-#define MYSQL_HAS_YEAR
-#endif
-
-#define MYSQL_ASSOC 1<<0
-#define MYSQL_NUM 1<<1
-#define MYSQL_BOTH (MYSQL_ASSOC|MYSQL_NUM)
-
-#define MYSQL_USE_RESULT 0
-#define MYSQL_STORE_RESULT 1
-
-#if MYSQL_VERSION_ID < 32224
-#define PHP_MYSQL_VALID_RESULT(mysql) \
- (mysql_num_fields(mysql)>0)
-#else
-#define PHP_MYSQL_VALID_RESULT(mysql) \
- (mysql_field_count(mysql)>0)
-#endif
-
-typedef struct _php_mysql_conn {
- MYSQL conn;
- int active_result_id;
-} php_mysql_conn;
-
-/* {{{ mysql_functions[]
- */
-function_entry mysql_functions[] = {
- PHP_FE(mysql_connect, NULL)
- PHP_FE(mysql_pconnect, NULL)
- PHP_FE(mysql_close, NULL)
- PHP_FE(mysql_select_db, NULL)
-#ifndef NETWARE /* The below two functions not supported on NetWare */
-#if MYSQL_VERSION_ID < 40000
- PHP_FE(mysql_create_db, NULL)
- PHP_FE(mysql_drop_db, NULL)
-#endif
-#endif /* NETWARE */
- PHP_FE(mysql_query, NULL)
- PHP_FE(mysql_unbuffered_query, NULL)
- PHP_FE(mysql_db_query, NULL)
- PHP_FE(mysql_list_dbs, NULL)
- PHP_FE(mysql_list_tables, NULL)
- PHP_FE(mysql_list_fields, NULL)
- PHP_FE(mysql_list_processes, NULL)
- PHP_FE(mysql_error, NULL)
-#ifdef HAVE_MYSQL_ERRNO
- PHP_FE(mysql_errno, NULL)
-#endif
- PHP_FE(mysql_affected_rows, NULL)
- PHP_FE(mysql_insert_id, NULL)
- PHP_FE(mysql_result, NULL)
- PHP_FE(mysql_num_rows, NULL)
- PHP_FE(mysql_num_fields, NULL)
- PHP_FE(mysql_fetch_row, NULL)
- PHP_FE(mysql_fetch_array, NULL)
- PHP_FE(mysql_fetch_assoc, NULL)
- PHP_FE(mysql_fetch_object, NULL)
- PHP_FE(mysql_data_seek, NULL)
- PHP_FE(mysql_fetch_lengths, NULL)
- PHP_FE(mysql_fetch_field, NULL)
- PHP_FE(mysql_field_seek, NULL)
- PHP_FE(mysql_free_result, NULL)
- PHP_FE(mysql_field_name, NULL)
- PHP_FE(mysql_field_table, NULL)
- PHP_FE(mysql_field_len, NULL)
- PHP_FE(mysql_field_type, NULL)
- PHP_FE(mysql_field_flags, NULL)
- PHP_FE(mysql_escape_string, NULL)
- PHP_FE(mysql_real_escape_string, NULL)
- PHP_FE(mysql_stat, NULL)
- PHP_FE(mysql_thread_id, NULL)
- PHP_FE(mysql_client_encoding, NULL)
- PHP_FE(mysql_ping, NULL)
-#ifdef HAVE_GETINFO_FUNCS
- PHP_FE(mysql_get_client_info, NULL)
- PHP_FE(mysql_get_host_info, NULL)
- PHP_FE(mysql_get_proto_info, NULL)
- PHP_FE(mysql_get_server_info, NULL)
-#endif
-
- PHP_FE(mysql_info, NULL)
-
- /* for downwards compatability */
- PHP_FALIAS(mysql, mysql_db_query, NULL)
- PHP_FALIAS(mysql_fieldname, mysql_field_name, NULL)
- PHP_FALIAS(mysql_fieldtable, mysql_field_table, NULL)
- PHP_FALIAS(mysql_fieldlen, mysql_field_len, NULL)
- PHP_FALIAS(mysql_fieldtype, mysql_field_type, NULL)
- PHP_FALIAS(mysql_fieldflags, mysql_field_flags, NULL)
- PHP_FALIAS(mysql_selectdb, mysql_select_db, NULL)
-#ifndef NETWARE /* The below two functions not supported on NetWare */
-#if MYSQL_VERSION_ID < 40000
- PHP_FALIAS(mysql_createdb, mysql_create_db, NULL)
- PHP_FALIAS(mysql_dropdb, mysql_drop_db, NULL)
-#endif
-#endif /* NETWARE */
- PHP_FALIAS(mysql_freeresult, mysql_free_result, NULL)
- PHP_FALIAS(mysql_numfields, mysql_num_fields, NULL)
- PHP_FALIAS(mysql_numrows, mysql_num_rows, NULL)
- PHP_FALIAS(mysql_listdbs, mysql_list_dbs, NULL)
- PHP_FALIAS(mysql_listtables, mysql_list_tables, NULL)
- PHP_FALIAS(mysql_listfields, mysql_list_fields, NULL)
- PHP_FALIAS(mysql_db_name, mysql_result, NULL)
- PHP_FALIAS(mysql_dbname, mysql_result, NULL)
- PHP_FALIAS(mysql_tablename, mysql_result, NULL)
- PHP_FALIAS(mysql_table_name, mysql_result, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ mysql_module_entry
- */
-zend_module_entry mysql_module_entry = {
- STANDARD_MODULE_HEADER,
- "mysql",
- mysql_functions,
- ZEND_MODULE_STARTUP_N(mysql),
- PHP_MSHUTDOWN(mysql),
- PHP_RINIT(mysql),
- PHP_RSHUTDOWN(mysql),
- PHP_MINFO(mysql),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-ZEND_DECLARE_MODULE_GLOBALS(mysql)
-
-#ifdef COMPILE_DL_MYSQL
-ZEND_GET_MODULE(mysql)
-#endif
-
-void timeout(int sig);
-
-#define CHECK_LINK(link) { if (link==-1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A link to the server could not be established"); RETURN_FALSE; } }
-
-/* {{{ _free_mysql_result
- * This wrapper is required since mysql_free_result() returns an integer, and
- * thus, cannot be used directly
- */
-static void _free_mysql_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- MYSQL_RES *mysql_result = (MYSQL_RES *)rsrc->ptr;
-
- mysql_free_result(mysql_result);
- MySG(result_allocated)--;
-}
-/* }}} */
-
-/* {{{ php_mysql_set_default_link
- */
-static void php_mysql_set_default_link(int id TSRMLS_DC)
-{
- if (MySG(default_link)!=-1) {
- zend_list_delete(MySG(default_link));
- }
- MySG(default_link) = id;
- zend_list_addref(id);
-}
-/* }}} */
-
-/* {{{ _close_mysql_link
- */
-static void _close_mysql_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- php_mysql_conn *link = (php_mysql_conn *)rsrc->ptr;
- void (*handler) (int);
-
- handler = signal(SIGPIPE, SIG_IGN);
- mysql_close(&link->conn);
- signal(SIGPIPE, handler);
- efree(link);
- MySG(num_links)--;
-}
-/* }}} */
-
-/* {{{ _close_mysql_plink
- */
-static void _close_mysql_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- php_mysql_conn *link = (php_mysql_conn *)rsrc->ptr;
- void (*handler) (int);
-
- handler = signal(SIGPIPE, SIG_IGN);
- mysql_close(&link->conn);
- signal(SIGPIPE, handler);
-
- free(link);
- MySG(num_persistent)--;
- MySG(num_links)--;
-}
-/* }}} */
-
-/* {{{ PHP_INI_MH
- */
-static PHP_INI_MH(OnMySQLPort)
-{
- if (new_value==NULL) { /* default port */
-#if !defined(PHP_WIN32) && !defined(NETWARE)
- struct servent *serv_ptr;
- char *env;
-
- MySG(default_port) = MYSQL_PORT;
- if ((serv_ptr = getservbyname("mysql", "tcp"))) {
- MySG(default_port) = (uint) ntohs((ushort) serv_ptr->s_port);
- }
- if ((env = getenv("MYSQL_TCP_PORT"))) {
- MySG(default_port) = (uint) atoi(env);
- }
-#else
- MySG(default_port) = MYSQL_PORT;
-#endif
- } else {
- MySG(default_port) = atoi(new_value);
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_INI */
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("mysql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong, allow_persistent, zend_mysql_globals, mysql_globals)
- STD_PHP_INI_ENTRY_EX("mysql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_persistent, zend_mysql_globals, mysql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("mysql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_links, zend_mysql_globals, mysql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY("mysql.default_host", NULL, PHP_INI_ALL, OnUpdateString, default_host, zend_mysql_globals, mysql_globals)
- STD_PHP_INI_ENTRY("mysql.default_user", NULL, PHP_INI_ALL, OnUpdateString, default_user, zend_mysql_globals, mysql_globals)
- STD_PHP_INI_ENTRY("mysql.default_password", NULL, PHP_INI_ALL, OnUpdateString, default_password, zend_mysql_globals, mysql_globals)
- PHP_INI_ENTRY("mysql.default_port", NULL, PHP_INI_ALL, OnMySQLPort)
- STD_PHP_INI_ENTRY("mysql.default_socket", NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_socket, zend_mysql_globals, mysql_globals)
- STD_PHP_INI_ENTRY("mysql.connect_timeout", "-1", PHP_INI_SYSTEM, OnUpdateLong, connect_timeout, zend_mysql_globals, mysql_globals)
- STD_PHP_INI_BOOLEAN("mysql.trace_mode", "0", PHP_INI_ALL, OnUpdateLong, trace_mode, zend_mysql_globals, mysql_globals)
-PHP_INI_END()
-/* }}} */
-
-/* {{{ php_mysql_init_globals
- */
-static void php_mysql_init_globals(zend_mysql_globals *mysql_globals)
-{
- mysql_globals->num_persistent = 0;
- mysql_globals->default_socket = NULL;
- mysql_globals->default_host = NULL;
- mysql_globals->default_user = NULL;
- mysql_globals->default_password = NULL;
- mysql_globals->connect_errno = 0;
- mysql_globals->connect_error = NULL;
- mysql_globals->connect_timeout = 0;
- mysql_globals->trace_mode = 0;
- mysql_globals->result_allocated = 0;
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-ZEND_MODULE_STARTUP_D(mysql)
-{
- ZEND_INIT_MODULE_GLOBALS(mysql, php_mysql_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
- le_result = zend_register_list_destructors_ex(_free_mysql_result, NULL, "mysql result", module_number);
- le_link = zend_register_list_destructors_ex(_close_mysql_link, NULL, "mysql link", module_number);
- le_plink = zend_register_list_destructors_ex(NULL, _close_mysql_plink, "mysql link persistent", module_number);
- Z_TYPE(mysql_module_entry) = type;
-
- REGISTER_LONG_CONSTANT("MYSQL_ASSOC", MYSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQL_NUM", MYSQL_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQL_BOTH", MYSQL_BOTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQL_CLIENT_COMPRESS", CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT);
-#if MYSQL_VERSION_ID >= 40000
- REGISTER_LONG_CONSTANT("MYSQL_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_LONG_CONSTANT("MYSQL_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT);
-
-
-#ifdef ZTS
-# if MYSQL_VERSION_ID >= 40000
- mysql_thread_init();
-# endif
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(mysql)
-{
-#ifdef ZTS
-# if MYSQL_VERSION_ID >= 40000
- mysql_thread_end();
-# endif
-#endif
-
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(mysql)
-{
- MySG(default_link)=-1;
- MySG(num_links) = MySG(num_persistent);
- /* Reset connect error/errno on every request */
- MySG(connect_error) = NULL;
- MySG(connect_errno) =0;
- MySG(trace_mode) = 0;
- MySG(result_allocated) = 0;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(mysql)
-{
- if (MySG(trace_mode)) {
- if (MySG(result_allocated)){
- char tmp[128];
- sprintf((char *)&tmp, "%lu result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query()", MySG(result_allocated));
- php_error_docref("function.mysql-free-result" TSRMLS_CC, E_WARNING, tmp);
- }
- }
-
- if (MySG(connect_error)!=NULL) {
- efree(MySG(connect_error));
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(mysql)
-{
- char buf[32];
-
- php_info_print_table_start();
- php_info_print_table_header(2, "MySQL Support", "enabled");
- sprintf(buf, "%ld", MySG(num_persistent));
- php_info_print_table_row(2, "Active Persistent Links", buf);
- sprintf(buf, "%ld", MySG(num_links));
- php_info_print_table_row(2, "Active Links", buf);
- php_info_print_table_row(2, "Client API version", mysql_get_client_info());
-#if !defined (PHP_WIN32) && !defined (NETWARE)
- php_info_print_table_row(2, "MYSQL_MODULE_TYPE", PHP_MYSQL_TYPE);
- php_info_print_table_row(2, "MYSQL_SOCKET", MYSQL_UNIX_ADDR);
- php_info_print_table_row(2, "MYSQL_INCLUDE", PHP_MYSQL_INCLUDE);
- php_info_print_table_row(2, "MYSQL_LIBS", PHP_MYSQL_LIBS);
-#endif
-
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-
-}
-/* }}} */
-
-/* {{{ php_mysql_do_connect
- */
-#define MYSQL_DO_CONNECT_CLEANUP() \
- if (free_host) { \
- efree(host); \
- }
-
-#define MYSQL_DO_CONNECT_RETURN_FALSE() \
- MYSQL_DO_CONNECT_CLEANUP(); \
- RETURN_FALSE;
-
-static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- char *user=NULL, *passwd=NULL, *host_and_port=NULL, *socket=NULL, *tmp=NULL, *host=NULL;
- char *hashed_details=NULL;
- int hashed_details_length, port = MYSQL_PORT;
- int client_flags = 0;
- php_mysql_conn *mysql=NULL;
-#if MYSQL_VERSION_ID <= 32230
- void (*handler) (int);
-#endif
- zval **z_host=NULL, **z_user=NULL, **z_passwd=NULL, **z_new_link=NULL, **z_client_flags=NULL;
- zend_bool free_host=0, new_link=0;
- long connect_timeout;
-
-
- connect_timeout = MySG(connect_timeout);
-
- socket = MySG(default_socket);
-
- if (PG(sql_safe_mode)) {
- if (ZEND_NUM_ARGS()>0) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "SQL safe mode in effect - ignoring host/user/password information");
- }
- host_and_port=passwd=NULL;
- user=php_get_current_user();
- hashed_details_length = strlen(user)+5+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "mysql__%s_", user);
- client_flags = CLIENT_INTERACTIVE;
- } else {
- host_and_port = MySG(default_host);
- user = MySG(default_user);
- passwd = MySG(default_password);
-
- switch(ZEND_NUM_ARGS()) {
- case 0: /* defaults */
- break;
- case 1: {
- if (zend_get_parameters_ex(1, &z_host)==FAILURE) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- }
- break;
- case 2: {
- if (zend_get_parameters_ex(2, &z_host, &z_user)==FAILURE) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- convert_to_string_ex(z_user);
- user = Z_STRVAL_PP(z_user);
- }
- break;
- case 3: {
- if (zend_get_parameters_ex(3, &z_host, &z_user, &z_passwd) == FAILURE) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- convert_to_string_ex(z_user);
- convert_to_string_ex(z_passwd);
- user = Z_STRVAL_PP(z_user);
- passwd = Z_STRVAL_PP(z_passwd);
- }
- break;
- case 4: {
- if (!persistent) {
- if (zend_get_parameters_ex(4, &z_host, &z_user, &z_passwd, &z_new_link) == FAILURE) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- convert_to_string_ex(z_user);
- convert_to_string_ex(z_passwd);
- user = Z_STRVAL_PP(z_user);
- passwd = Z_STRVAL_PP(z_passwd);
- new_link = Z_BVAL_PP(z_new_link);
- }
- else {
- if (zend_get_parameters_ex(4, &z_host, &z_user, &z_passwd, &z_client_flags) == FAILURE) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- convert_to_string_ex(z_user);
- convert_to_string_ex(z_passwd);
- user = Z_STRVAL_PP(z_user);
- passwd = Z_STRVAL_PP(z_passwd);
- client_flags = Z_LVAL_PP(z_client_flags);
- }
- }
- break;
- case 5: {
- if (zend_get_parameters_ex(5, &z_host, &z_user, &z_passwd, &z_new_link, &z_client_flags) == FAILURE) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- convert_to_string_ex(z_user);
- convert_to_string_ex(z_passwd);
- user = Z_STRVAL_PP(z_user);
- passwd = Z_STRVAL_PP(z_passwd);
- new_link = Z_BVAL_PP(z_new_link);
- client_flags = Z_LVAL_PP(z_client_flags);
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- if (z_host) {
- SEPARATE_ZVAL(z_host); /* We may modify z_host if it contains a port, separate */
- convert_to_string_ex(z_host);
- host_and_port = Z_STRVAL_PP(z_host);
- if (z_user) {
- convert_to_string_ex(z_user);
- user = Z_STRVAL_PP(z_user);
- if (z_passwd) {
- convert_to_string_ex(z_passwd);
- passwd = Z_STRVAL_PP(z_passwd);
- }
- }
- }
-
- hashed_details_length = sizeof("mysql___")-1 + strlen(SAFE_STRING(host_and_port))+strlen(SAFE_STRING(user))+strlen(SAFE_STRING(passwd));
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "mysql_%s_%s_%s", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd));
- }
-
- /* We cannot use mysql_port anymore in windows, need to use
- * mysql_real_connect() to set the port.
- */
- if (host_and_port && (tmp=strchr(host_and_port, ':'))) {
- host = estrndup(host_and_port, tmp-host_and_port);
- free_host = 1;
- tmp++;
- if (tmp[0] != '/') {
- port = atoi(tmp);
- if ((tmp=strchr(tmp, ':'))) {
- tmp++;
- socket=tmp;
- }
- } else {
- socket = tmp;
- }
- } else {
- host = host_and_port;
- port = MySG(default_port);
- }
-
-#if MYSQL_VERSION_ID < 32200
- mysql_port = port;
-#endif
-
- if (!MySG(allow_persistent)) {
- persistent=0;
- }
- if (persistent) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
-
- if (MySG(max_links)!=-1 && MySG(num_links)>=MySG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)", MySG(num_links));
- efree(hashed_details);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- if (MySG(max_persistent)!=-1 && MySG(num_persistent)>=MySG(max_persistent)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%d)", MySG(num_persistent));
- efree(hashed_details);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- /* create the link */
- mysql = (php_mysql_conn *) malloc(sizeof(php_mysql_conn));
- mysql->active_result_id = 0;
-#if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
- mysql_init(&mysql->conn);
-
- if (connect_timeout != -1)
- mysql_options(&mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout);
-
- if (mysql_real_connect(&mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL) {
-#else
- if (mysql_connect(&mysql->conn, host, user, passwd)==NULL) {
-#endif
- /* Populate connect error globals so that the error functions can read them */
- if (MySG(connect_error)!=NULL) efree(MySG(connect_error));
- MySG(connect_error)=estrdup(mysql_error(&mysql->conn));
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", MySG(connect_error));
-#if defined(HAVE_MYSQL_ERRNO)
- MySG(connect_errno)=mysql_errno(&mysql->conn);
-#endif
- free(mysql);
- efree(hashed_details);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
-
- /* hash it up */
- Z_TYPE(new_le) = le_plink;
- new_le.ptr = mysql;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
- free(mysql);
- efree(hashed_details);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- MySG(num_persistent)++;
- MySG(num_links)++;
- } else { /* The link is in our list of persistent connections */
- if (Z_TYPE_P(le) != le_plink) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- /* ensure that the link did not die */
-#if MYSQL_VERSION_ID > 32230 /* Use mysql_ping to ensure link is alive (and to reconnect if needed) */
- if (mysql_ping(le->ptr)) {
-#else /* Use mysql_stat() to check if server is alive */
- handler=signal(SIGPIPE, SIG_IGN);
-#if defined(HAVE_MYSQL_ERRNO) && defined(CR_SERVER_GONE_ERROR)
- mysql_stat(le->ptr);
- if (mysql_errno(&((php_mysql_conn *) le->ptr)->conn) == CR_SERVER_GONE_ERROR) {
-#else
- if (!strcasecmp(mysql_stat(le->ptr), "mysql server has gone away")) { /* the link died */
-#endif
- signal(SIGPIPE, handler);
-#endif /* end mysql_ping */
-#if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
- if (mysql_real_connect(le->ptr, host, user, passwd, NULL, port, socket, client_flags)==NULL) {
-#else
- if (mysql_connect(le->ptr, host, user, passwd)==NULL) {
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Link to server lost, unable to reconnect");
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1);
- efree(hashed_details);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- }
-#if MYSQL_VERSION_ID < 32231
- signal(SIGPIPE, handler);
-#endif
-
- mysql = (php_mysql_conn *) le->ptr;
- }
- ZEND_REGISTER_RESOURCE(return_value, mysql, le_plink);
- } else { /* non persistent */
- list_entry *index_ptr, new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual mysql link sits.
- * if it doesn't, open a new mysql link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (!new_link && zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
- int type;
- long link;
- void *ptr;
-
- if (Z_TYPE_P(index_ptr) != le_index_ptr) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- link = (long) index_ptr->ptr;
- ptr = zend_list_find(link,&type); /* check if the link is still there */
- if (ptr && (type==le_link || type==le_plink)) {
- zend_list_addref(link);
- Z_LVAL_P(return_value) = link;
- php_mysql_set_default_link(link TSRMLS_CC);
- Z_TYPE_P(return_value) = IS_RESOURCE;
- efree(hashed_details);
- MYSQL_DO_CONNECT_CLEANUP();
- return;
- } else {
- zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length+1);
- }
- }
- if (MySG(max_links)!=-1 && MySG(num_links)>=MySG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)", MySG(num_links));
- efree(hashed_details);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
-
- mysql = (php_mysql_conn *) emalloc(sizeof(php_mysql_conn));
- mysql->active_result_id = 0;
-#if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
- mysql_init(&mysql->conn);
-
- if (connect_timeout != -1)
- mysql_options(&mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout);
-
- if (mysql_real_connect(&mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL) {
-#else
- if (mysql_connect(&mysql->conn, host, user, passwd)==NULL) {
-#endif
- /* Populate connect error globals so that the error functions can read them */
- if (MySG(connect_error)!=NULL) efree(MySG(connect_error));
- MySG(connect_error)=estrdup(mysql_error(&mysql->conn));
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", MySG(connect_error));
-#if defined(HAVE_MYSQL_ERRNO)
- MySG(connect_errno)=mysql_errno(&mysql->conn);
-#endif
- efree(hashed_details);
- efree(mysql);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
-
- /* add it to the list */
- ZEND_REGISTER_RESOURCE(return_value, mysql, le_link);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
- Z_TYPE(new_index_ptr) = le_index_ptr;
- if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
- efree(hashed_details);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- MySG(num_links)++;
- }
-
- efree(hashed_details);
- php_mysql_set_default_link(Z_LVAL_P(return_value) TSRMLS_CC);
- MYSQL_DO_CONNECT_CLEANUP();
-}
-/* }}} */
-
-/* {{{ php_mysql_get_default_link
- */
-static int php_mysql_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
-{
- if (MySG(default_link)==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_mysql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
- }
- return MySG(default_link);
-}
-/* }}} */
-
-/* {{{ proto resource mysql_connect([string hostname[:port][:/path/to/socket] [, string username [, string password [, bool new [, int flags]]]]])
- Opens a connection to a MySQL Server */
-PHP_FUNCTION(mysql_connect)
-{
- php_mysql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto resource mysql_pconnect([string hostname[:port][:/path/to/socket] [, string username [, string password [, int flags]]]])
- Opens a persistent connection to a MySQL Server */
-PHP_FUNCTION(mysql_pconnect)
-{
- php_mysql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto bool mysql_close([int link_identifier])
- Close a MySQL connection */
-PHP_FUNCTION(mysql_close)
-{
- zval **mysql_link=NULL;
- int id;
- php_mysql_conn *mysql;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = MySG(default_link);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- if (id==-1) { /* explicit resource number */
- zend_list_delete(Z_RESVAL_PP(mysql_link));
- }
-
- if (id!=-1
- || (mysql_link && Z_RESVAL_PP(mysql_link)==MySG(default_link))) {
- zend_list_delete(MySG(default_link));
- MySG(default_link) = -1;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mysql_select_db(string database_name [, int link_identifier])
- Selects a MySQL database */
-PHP_FUNCTION(mysql_select_db)
-{
- zval **db, **mysql_link;
- int id;
- php_mysql_conn *mysql;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &db, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- convert_to_string_ex(db);
-
- if (mysql_select_db(&mysql->conn, Z_STRVAL_PP(db))!=0) {
- RETVAL_FALSE;
- } else {
- RETVAL_TRUE;
- }
-}
-/* }}} */
-
-#ifdef HAVE_GETINFO_FUNCS
-
-/* {{{ proto string mysql_get_client_info(void)
- Returns a string that represents the client library version */
-PHP_FUNCTION(mysql_get_client_info)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_STRING((char *)mysql_get_client_info(),1);
-}
-/* }}} */
-
-/* {{{ proto string mysql_get_host_info([int link_identifier])
- Returns a string describing the type of connection in use, including the server host name */
-PHP_FUNCTION(mysql_get_host_info)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1,&mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- RETURN_STRING((char *)mysql_get_host_info(&mysql->conn),1);
-}
-/* }}} */
-
-/* {{{ proto int mysql_get_proto_info([int link_identifier])
- Returns the protocol version used by current connection */
-PHP_FUNCTION(mysql_get_proto_info)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1,&mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- RETURN_LONG(mysql_get_proto_info(&mysql->conn));
-}
-/* }}} */
-
-/* {{{ proto string mysql_get_server_info([int link_identifier])
- Returns a string that represents the server version number */
-PHP_FUNCTION(mysql_get_server_info)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1,&mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- RETURN_STRING((char *)mysql_get_server_info(&mysql->conn),1);
-}
-/* }}} */
-
-/* {{{ proto string mysql_info([int link_identifier])
- Returns a string containing information about the most recent query */
-PHP_FUNCTION(mysql_info)
-{
- zval *mysql_link;
- int id = -1;
- char *str;
- php_mysql_conn *mysql;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link) == FAILURE) {
- return;
- }
-
- if (ZEND_NUM_ARGS() == 0) {
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- if ((str = (char *)mysql_info(&mysql->conn))) {
- RETURN_STRING(str,1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int mysql_thread_id([int link_identifier])
- Returns the thread id of current connection */
-PHP_FUNCTION(mysql_thread_id)
-{
- zval *mysql_link = NULL;
- int id = -1;
- php_mysql_conn *mysql;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link) == FAILURE) {
- return;
- }
-
- if (ZEND_NUM_ARGS() == 0) {
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- }
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- RETURN_LONG(mysql_thread_id(&mysql->conn));
-}
-/* }}} */
-
-/* {{{ proto string mysql_stat([int link_identifier])
- Returns a string containing status information */
-PHP_FUNCTION(mysql_stat)
-{
- zval *mysql_link = NULL;
- int id = -1;
- php_mysql_conn *mysql;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link) == FAILURE) {
- return;
- }
-
- if (ZEND_NUM_ARGS() == 0) {
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- }
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- RETURN_STRING((char *)mysql_stat(&mysql->conn), 1);
-}
-/* }}} */
-
-/* {{{ proto string mysql_client_encoding([int link_identifier])
- Returns the default character set for the current connection */
-PHP_FUNCTION(mysql_client_encoding)
-{
- zval *mysql_link = NULL;
- int id = -1;
- php_mysql_conn *mysql;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link) == FAILURE) {
- return;
- }
-
- if (ZEND_NUM_ARGS() == 0) {
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- RETURN_STRING((char *)mysql_character_set_name(&mysql->conn), 1);
-}
-/* }}} */
-#endif
-
-#ifndef NETWARE /* The below two functions not supported on NetWare */
-#if MYSQL_VERSION_ID < 40000
-/* {{{ proto bool mysql_create_db(string database_name [, int link_identifier])
- Create a MySQL database */
-PHP_FUNCTION(mysql_create_db)
-{
- zval **db, **mysql_link;
- int id;
- php_mysql_conn *mysql;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &db, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "This function is deprecated, please use mysql_query() to issue a SQL CREATE DATABASE statement instead.");
-
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- convert_to_string_ex(db);
-
- if (mysql_create_db(&mysql->conn, Z_STRVAL_PP(db))==0) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool mysql_drop_db(string database_name [, int link_identifier])
- Drops (delete) a MySQL database */
-PHP_FUNCTION(mysql_drop_db)
-{
- zval **db, **mysql_link;
- int id;
- php_mysql_conn *mysql;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &db, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "This function is deprecated, please use mysql_query() to issue a SQL DROP DATABASE statement instead.");
-
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- convert_to_string_ex(db);
-
- if (mysql_drop_db(&mysql->conn, Z_STRVAL_PP(db))==0) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-#endif
-#endif /* NETWARE */
-
-/* {{{ php_mysql_do_query_general
- */
-static void php_mysql_do_query_general(zval **query, zval **mysql_link, int link_id, zval **db, int use_store, zval *return_value TSRMLS_DC)
-{
- php_mysql_conn *mysql;
- MYSQL_RES *mysql_result;
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, link_id, "MySQL-Link", le_link, le_plink);
-
- if (db) {
- convert_to_string_ex(db);
- if (mysql_select_db(&mysql->conn, Z_STRVAL_PP(db))!=0) {
- RETURN_FALSE;
- }
- }
-
-
- if (mysql->active_result_id) do {
- int type;
- MYSQL_RES *mysql_result;
-
- mysql_result = (MYSQL_RES *) zend_list_find(mysql->active_result_id, &type);
- if (mysql_result && type==le_result) {
- if (!mysql_eof(mysql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Function called without first fetching all rows from a previous unbuffered query");
- while (mysql_fetch_row(mysql_result));
- }
- zend_list_delete(mysql->active_result_id);
- mysql->active_result_id = 0;
- }
- } while(0);
-
- convert_to_string_ex(query);
-
- /* check explain */
- if (MySG(trace_mode)) {
- if (!strncasecmp("select", Z_STRVAL_PP(query), 6)){
- MYSQL_ROW row;
-
- char *newquery = (char *)emalloc(Z_STRLEN_PP(query) + 10);
- sprintf ((char *)newquery, "EXPLAIN %s", Z_STRVAL_PP(query));
- mysql_real_query(&mysql->conn, newquery, strlen(newquery));
- efree (newquery);
- if (mysql_errno(&mysql->conn)) {
- php_error_docref("http://www.mysql.com/doc" TSRMLS_CC, E_WARNING, mysql_error(&mysql->conn));
- RETURN_FALSE;
- }
- else {
- mysql_result = mysql_use_result(&mysql->conn);
- while ((row = mysql_fetch_row(mysql_result))) {
- if (!strcmp("ALL", row[1])) {
- php_error_docref("http://www.mysql.com/doc" TSRMLS_CC, E_WARNING, "Your query requires a full tablescan (table %s, %s rows affected). Use EXPLAIN to optimize your query.", row[0], row[6]);
- } else if (!strcmp("INDEX", row[1])) {
- php_error_docref("http://www.mysql.com/doc" TSRMLS_CC, E_WARNING, "Your query requires a full indexscan (table %s, %s rows affected). Use EXPLAIN to optimize your query.", row[0], row[6]);
- }
- }
- mysql_free_result(mysql_result);
- }
- }
- } /* end explain */
-
- /* mysql_query is binary unsafe, use mysql_real_query */
-#if MYSQL_VERSION_ID > 32199
- if (mysql_real_query(&mysql->conn, Z_STRVAL_PP(query), Z_STRLEN_PP(query))!=0) {
- /* check possible error */
- if (MySG(trace_mode)){
- if (mysql_errno(&mysql->conn)){
- php_error_docref("http://www.mysql.com/doc" TSRMLS_CC, E_WARNING, mysql_error(&mysql->conn));
- }
- }
- RETURN_FALSE;
- }
-#else
- if (mysql_query(&mysql->conn, Z_STRVAL_PP(query))!=0) {
- /* check possible error */
- if (MySG(trace_mode)){
- if (mysql_errno(&mysql->conn)){
- php_error_docref("http://www.mysql.com/doc" TSRMLS_CC, E_WARNING, mysql_error(&mysql->conn));
- }
- }
- RETURN_FALSE;
- }
-#endif
- if(use_store == MYSQL_USE_RESULT) {
- mysql_result=mysql_use_result(&mysql->conn);
- } else {
- mysql_result=mysql_store_result(&mysql->conn);
- }
- if (!mysql_result) {
- if (PHP_MYSQL_VALID_RESULT(&mysql->conn)) { /* query should have returned rows */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to save result set");
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
- }
- MySG(result_allocated)++;
- ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result);
- if (use_store == MYSQL_USE_RESULT) {
- mysql->active_result_id = Z_LVAL_P(return_value);
- }
-}
-/* }}} */
-
-/* {{{ php_mysql_do_query
- */
-static void php_mysql_do_query(INTERNAL_FUNCTION_PARAMETERS, int use_store)
-{
- zval **query, **mysql_link;
- int id;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &query)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &query, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- php_mysql_do_query_general(query, mysql_link, id, NULL, use_store, return_value TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto resource mysql_query(string query [, int link_identifier])
- Sends an SQL query to MySQL */
-PHP_FUNCTION(mysql_query)
-{
- php_mysql_do_query(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_STORE_RESULT);
-}
-/* }}} */
-
-
-/* {{{ proto resource mysql_unbuffered_query(string query [, int link_identifier])
- Sends an SQL query to MySQL, without fetching and buffering the result rows */
-PHP_FUNCTION(mysql_unbuffered_query)
-{
- php_mysql_do_query(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_USE_RESULT);
-}
-/* }}} */
-
-
-/* {{{ proto resource mysql_db_query(string database_name, string query [, int link_identifier])
- Sends an SQL query to MySQL */
-PHP_FUNCTION(mysql_db_query)
-{
- zval **db, **query, **mysql_link;
- int id;
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &db, &query)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 3:
- if (zend_get_parameters_ex(3, &db, &query, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (MySG(trace_mode) || !strcasecmp(get_active_function_name(TSRMLS_C), "mysql")) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "This function is deprecated; use mysql_query() instead.");
- }
-
- php_mysql_do_query_general(query, mysql_link, id, db, MYSQL_STORE_RESULT, return_value TSRMLS_CC);
-}
-/* }}} */
-
-
-/* {{{ proto resource mysql_list_dbs([int link_identifier])
- List databases available on a MySQL server */
-PHP_FUNCTION(mysql_list_dbs)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MYSQL_RES *mysql_result;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- if ((mysql_result=mysql_list_dbs(&mysql->conn, NULL))==NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to save MySQL query result");
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result);
-}
-/* }}} */
-
-
-/* {{{ proto resource mysql_list_tables(string database_name [, int link_identifier])
- List tables in a MySQL database */
-PHP_FUNCTION(mysql_list_tables)
-{
- zval **db, **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MYSQL_RES *mysql_result;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &db, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- convert_to_string_ex(db);
- if (mysql_select_db(&mysql->conn, Z_STRVAL_PP(db))!=0) {
- RETURN_FALSE;
- }
- if ((mysql_result=mysql_list_tables(&mysql->conn, NULL))==NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to save MySQL query result");
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result);
-}
-/* }}} */
-
-
-/* {{{ proto resource mysql_list_fields(string database_name, string table_name [, int link_identifier])
- List MySQL result fields */
-PHP_FUNCTION(mysql_list_fields)
-{
- zval **db, **table, **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MYSQL_RES *mysql_result;
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &db, &table)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 3:
- if (zend_get_parameters_ex(3, &db, &table, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- convert_to_string_ex(db);
- if (mysql_select_db(&mysql->conn, Z_STRVAL_PP(db))!=0) {
- RETURN_FALSE;
- }
- convert_to_string_ex(table);
- if ((mysql_result=mysql_list_fields(&mysql->conn, Z_STRVAL_PP(table), NULL))==NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to save MySQL query result");
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result);
-}
-/* }}} */
-
-/* {{{ proto resource mysql_list_processes([int link_identifier])
- Returns a result set describing the current server threads */
-PHP_FUNCTION(mysql_list_processes)
-{
- zval *mysql_link = NULL;
- int id = -1;
- php_mysql_conn *mysql;
- MYSQL_RES *mysql_result;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link) == FAILURE) {
- return;
- }
-
- if (ZEND_NUM_ARGS() == 0) {
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- mysql_result = mysql_list_processes(&mysql->conn);
- if (mysql_result == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to save MySQL query result");
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result);
-}
-/* }}} */
-
-
-/* {{{ proto string mysql_error([int link_identifier])
- Returns the text of the error message from previous MySQL operation */
-PHP_FUNCTION(mysql_error)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = MySG(default_link);
- if (id==-1) {
- if (MySG(connect_error)!=NULL){
- RETURN_STRING(MySG(connect_error),1);
- } else {
- RETURN_FALSE;
- }
- }
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- RETURN_STRING((char *)mysql_error(&mysql->conn), 1);
-}
-/* }}} */
-
-
-/* {{{ proto int mysql_errno([int link_identifier])
- Returns the number of the error message from previous MySQL operation */
-#ifdef HAVE_MYSQL_ERRNO
-PHP_FUNCTION(mysql_errno)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = MySG(default_link);
- if (id==-1) {
- if (MySG(connect_errno)!=0){
- RETURN_LONG(MySG(connect_errno));
- } else {
- RETURN_FALSE;
- }
- }
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- RETURN_LONG(mysql_errno(&mysql->conn));
-}
-#endif
-/* }}} */
-
-
-/* {{{ proto int mysql_affected_rows([int link_identifier])
- Gets number of affected rows in previous MySQL operation */
-PHP_FUNCTION(mysql_affected_rows)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = MySG(default_link);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- /* conversion from int64 to long happing here */
- Z_LVAL_P(return_value) = (long) mysql_affected_rows(&mysql->conn);
- Z_TYPE_P(return_value) = IS_LONG;
-}
-/* }}} */
-
-
-/* {{{ proto string mysql_escape_string(string to_be_escaped)
- Escape string for mysql query */
-PHP_FUNCTION(mysql_escape_string)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(str);
- /* assume worst case situation, which is 2x of the original string.
- * we don't realloc() down to the real size since it'd most probably not
- * be worth it
- */
-
- Z_STRVAL_P(return_value) = (char *) emalloc(Z_STRLEN_PP(str)*2+1);
- Z_STRLEN_P(return_value) = mysql_escape_string(Z_STRVAL_P(return_value), Z_STRVAL_PP(str), Z_STRLEN_PP(str));
- Z_TYPE_P(return_value) = IS_STRING;
-
- if (MySG(trace_mode)){
- php_error_docref("function.mysql-real-escape-string" TSRMLS_CC, E_WARNING, "This function is deprecated; use mysql_real_escape_string() instead.");
- }
-
-}
-/* }}} */
-
-/* {{{ proto string mysql_real_escape_string(string to_be_escaped [, int link_identifier])
- Escape special characters in a string for use in a SQL statement, taking into account the current charset of the connection */
-PHP_FUNCTION(mysql_real_escape_string)
-{
- zval *mysql_link = NULL;
- char *str;
- char *new_str;
- int id = -1, str_len, new_str_len;
- php_mysql_conn *mysql;
-
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r", &str, &str_len, &mysql_link) == FAILURE) {
- return;
- }
-
- if (ZEND_NUM_ARGS() == 1) {
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- new_str = emalloc(str_len * 2 + 1);
- new_str_len = mysql_real_escape_string(&mysql->conn, new_str, str, str_len);
- new_str = erealloc(new_str, new_str_len + 1);
-
- RETURN_STRINGL(new_str, new_str_len, 0);
-}
-/* }}} */
-
-/* {{{ proto int mysql_insert_id([int link_identifier])
- Gets the ID generated from the previous INSERT operation */
-PHP_FUNCTION(mysql_insert_id)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = MySG(default_link);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- /* conversion from int64 to long happing here */
- Z_LVAL_P(return_value) = (long) mysql_insert_id(&mysql->conn);
- Z_TYPE_P(return_value) = IS_LONG;
-}
-/* }}} */
-
-
-/* {{{ proto mixed mysql_result(int result, int row [, mixed field])
- Gets result data */
-PHP_FUNCTION(mysql_result)
-{
- zval **result, **row, **field=NULL;
- MYSQL_RES *mysql_result;
- MYSQL_ROW sql_row;
- mysql_row_length_type *sql_row_lengths;
- int field_offset=0;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &result, &row)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &result, &row, &field)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- convert_to_long_ex(row);
- if (Z_LVAL_PP(row)<0 || Z_LVAL_PP(row)>=(int)mysql_num_rows(mysql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %d on MySQL result index %d", Z_LVAL_PP(row), Z_LVAL_PP(result));
- RETURN_FALSE;
- }
- mysql_data_seek(mysql_result, Z_LVAL_PP(row));
- if ((sql_row=mysql_fetch_row(mysql_result))==NULL
- || (sql_row_lengths=mysql_fetch_lengths(mysql_result))==NULL) { /* shouldn't happen? */
- RETURN_FALSE;
- }
-
- if (field) {
- switch(Z_TYPE_PP(field)) {
- case IS_STRING: {
- int i=0;
- MYSQL_FIELD *tmp_field;
- char *table_name, *field_name, *tmp;
-
- if ((tmp=strchr(Z_STRVAL_PP(field), '.'))) {
- table_name = estrndup(Z_STRVAL_PP(field), tmp-Z_STRVAL_PP(field));
- field_name = estrdup(tmp+1);
- } else {
- table_name = NULL;
- field_name = estrndup(Z_STRVAL_PP(field),Z_STRLEN_PP(field));
- }
- mysql_field_seek(mysql_result, 0);
- while ((tmp_field=mysql_fetch_field(mysql_result))) {
- if ((!table_name || !strcasecmp(tmp_field->table, table_name)) && !strcasecmp(tmp_field->name, field_name)) {
- field_offset = i;
- break;
- }
- i++;
- }
- if (!tmp_field) { /* no match found */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s%s%s not found in MySQL result index %d",
- (table_name?table_name:""), (table_name?".":""), field_name, Z_LVAL_PP(result));
- efree(field_name);
- if (table_name) {
- efree(table_name);
- }
- RETURN_FALSE;
- }
- efree(field_name);
- if (table_name) {
- efree(table_name);
- }
- }
- break;
- default:
- convert_to_long_ex(field);
- field_offset = Z_LVAL_PP(field);
- if (field_offset<0 || field_offset>=(int)mysql_num_fields(mysql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
- RETURN_FALSE;
- }
- break;
- }
- }
-
- if (sql_row[field_offset]) {
- Z_TYPE_P(return_value) = IS_STRING;
-
- if (PG(magic_quotes_runtime)) {
- Z_STRVAL_P(return_value) = php_addslashes(sql_row[field_offset], sql_row_lengths[field_offset],&Z_STRLEN_P(return_value), 0 TSRMLS_CC);
- } else {
- Z_STRLEN_P(return_value) = sql_row_lengths[field_offset];
- Z_STRVAL_P(return_value) = (char *) safe_estrndup(sql_row[field_offset], Z_STRLEN_P(return_value));
- }
- } else {
- Z_TYPE_P(return_value) = IS_NULL;
- }
-}
-/* }}} */
-
-
-/* {{{ proto int mysql_num_rows(int result)
- Gets number of rows in a result */
-PHP_FUNCTION(mysql_num_rows)
-{
- zval **result;
- MYSQL_RES *mysql_result;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- /* conversion from int64 to long happing here */
- Z_LVAL_P(return_value) = (long) mysql_num_rows(mysql_result);
- Z_TYPE_P(return_value) = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto int mysql_num_fields(int result)
- Gets number of fields in a result */
-PHP_FUNCTION(mysql_num_fields)
-{
- zval **result;
- MYSQL_RES *mysql_result;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- Z_LVAL_P(return_value) = mysql_num_fields(mysql_result);
- Z_TYPE_P(return_value) = IS_LONG;
-}
-/* }}} */
-
-/* {{{ php_mysql_fetch_hash
- */
-static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type, int expected_args)
-{
- zval **result, **arg2;
- MYSQL_RES *mysql_result;
- MYSQL_ROW mysql_row;
- MYSQL_FIELD *mysql_field;
- mysql_row_length_type *mysql_row_lengths;
- int i;
-
- if (ZEND_NUM_ARGS() > expected_args) {
- WRONG_PARAM_COUNT;
- }
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- if (!result_type) {
- result_type = MYSQL_BOTH;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &result, &arg2)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(arg2);
- result_type = Z_LVAL_PP(arg2);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- if ((mysql_row=mysql_fetch_row(mysql_result))==NULL
- || (mysql_row_lengths=mysql_fetch_lengths(mysql_result))==NULL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- mysql_field_seek(mysql_result, 0);
- for (mysql_field=mysql_fetch_field(mysql_result), i=0; mysql_field; mysql_field=mysql_fetch_field(mysql_result), i++) {
- if (mysql_row[i]) {
- char *data;
- int data_len;
- int should_copy;
-
- if (PG(magic_quotes_runtime)) {
- data = php_addslashes(mysql_row[i], mysql_row_lengths[i],&data_len, 0 TSRMLS_CC);
- should_copy = 0;
- } else {
- data = mysql_row[i];
- data_len = mysql_row_lengths[i];
- should_copy = 1;
- }
-
- if (result_type & MYSQL_NUM) {
- add_index_stringl(return_value, i, data, data_len, should_copy);
- should_copy = 1;
- }
-
- if (result_type & MYSQL_ASSOC) {
- add_assoc_stringl(return_value, mysql_field->name, data, data_len, should_copy);
- }
- } else {
- /* NULL value. */
- if (result_type & MYSQL_NUM) {
- add_index_null(return_value, i);
- }
-
- if (result_type & MYSQL_ASSOC) {
- add_assoc_null(return_value, mysql_field->name);
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ proto array mysql_fetch_row(int result)
- Gets a result row as an enumerated array */
-PHP_FUNCTION(mysql_fetch_row)
-{
- php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_NUM, 1);
-}
-/* }}} */
-
-
-/* {{{ proto object mysql_fetch_object(int result [, int result_type])
- Fetch a result row as an object */
-PHP_FUNCTION(mysql_fetch_object)
-{
- php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_ASSOC, 2);
-
- if (Z_TYPE_P(return_value) == IS_ARRAY) {
- object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value));
- }
-}
-/* }}} */
-
-
-/* {{{ proto array mysql_fetch_array(int result [, int result_type])
- Fetch a result row as an array (associative, numeric or both) */
-PHP_FUNCTION(mysql_fetch_array)
-{
- php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0, 2);
-}
-/* }}} */
-
-
-/* {{{ proto array mysql_fetch_assoc(int result)
- Fetch a result row as an associative array */
-PHP_FUNCTION(mysql_fetch_assoc)
-{
- php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_ASSOC, 1);
-}
-/* }}} */
-
-/* {{{ proto bool mysql_data_seek(int result, int row_number)
- Move internal result pointer */
-PHP_FUNCTION(mysql_data_seek)
-{
- zval **result, **offset;
- MYSQL_RES *mysql_result;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &result, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- convert_to_long_ex(offset);
- if (Z_LVAL_PP(offset)<0 || Z_LVAL_PP(offset)>=(int)mysql_num_rows(mysql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset %d is invalid for MySQL result index %d (or the query data is unbuffered)", Z_LVAL_PP(offset), Z_LVAL_PP(result));
- RETURN_FALSE;
- }
- mysql_data_seek(mysql_result, Z_LVAL_PP(offset));
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto array mysql_fetch_lengths(int result)
- Gets max data size of each column in a result */
-PHP_FUNCTION(mysql_fetch_lengths)
-{
- zval **result;
- MYSQL_RES *mysql_result;
- mysql_row_length_type *lengths;
- int num_fields;
- int i;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- if ((lengths=mysql_fetch_lengths(mysql_result))==NULL) {
- RETURN_FALSE;
- }
- array_init(return_value);
- num_fields = mysql_num_fields(mysql_result);
-
- for (i=0; i<num_fields; i++) {
- add_index_long(return_value, i, lengths[i]);
- }
-}
-/* }}} */
-
-/* {{{ php_mysql_get_field_name
- */
-static char *php_mysql_get_field_name(int field_type)
-{
- switch(field_type) {
- case FIELD_TYPE_STRING:
- case FIELD_TYPE_VAR_STRING:
- return "string";
- break;
-#ifdef MYSQL_HAS_TINY
- case FIELD_TYPE_TINY:
-#endif
- case FIELD_TYPE_SHORT:
- case FIELD_TYPE_LONG:
- case FIELD_TYPE_LONGLONG:
- case FIELD_TYPE_INT24:
- return "int";
- break;
- case FIELD_TYPE_FLOAT:
- case FIELD_TYPE_DOUBLE:
- case FIELD_TYPE_DECIMAL:
- return "real";
- break;
- case FIELD_TYPE_TIMESTAMP:
- return "timestamp";
- break;
-#ifdef MYSQL_HAS_YEAR
- case FIELD_TYPE_YEAR:
- return "year";
- break;
-#endif
- case FIELD_TYPE_DATE:
- return "date";
- break;
- case FIELD_TYPE_TIME:
- return "time";
- break;
- case FIELD_TYPE_DATETIME:
- return "datetime";
- break;
- case FIELD_TYPE_TINY_BLOB:
- case FIELD_TYPE_MEDIUM_BLOB:
- case FIELD_TYPE_LONG_BLOB:
- case FIELD_TYPE_BLOB:
- return "blob";
- break;
- case FIELD_TYPE_NULL:
- return "null";
- break;
- default:
- return "unknown";
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto object mysql_fetch_field(int result [, int field_offset])
- Gets column information from a result and return as an object */
-PHP_FUNCTION(mysql_fetch_field)
-{
- zval **result, **field=NULL;
- MYSQL_RES *mysql_result;
- MYSQL_FIELD *mysql_field;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &result, &field)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(field);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- if (field) {
- if (Z_LVAL_PP(field)<0 || Z_LVAL_PP(field)>=(int)mysql_num_fields(mysql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad field offset");
- RETURN_FALSE;
- }
- mysql_field_seek(mysql_result, Z_LVAL_PP(field));
- }
- if ((mysql_field=mysql_fetch_field(mysql_result))==NULL) {
- RETURN_FALSE;
- }
- object_init(return_value);
-
- add_property_string(return_value, "name",(mysql_field->name?mysql_field->name:empty_string), 1);
- add_property_string(return_value, "table",(mysql_field->table?mysql_field->table:empty_string), 1);
- add_property_string(return_value, "def",(mysql_field->def?mysql_field->def:empty_string), 1);
- add_property_long(return_value, "max_length", mysql_field->max_length);
- add_property_long(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0);
- add_property_long(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0);
- add_property_long(return_value, "multiple_key",(mysql_field->flags&MULTIPLE_KEY_FLAG?1:0));
- add_property_long(return_value, "unique_key",(mysql_field->flags&UNIQUE_KEY_FLAG?1:0));
- add_property_long(return_value, "numeric", IS_NUM(Z_TYPE_P(mysql_field))?1:0);
- add_property_long(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0);
- add_property_string(return_value, "type", php_mysql_get_field_name(Z_TYPE_P(mysql_field)), 1);
- add_property_long(return_value, "unsigned",(mysql_field->flags&UNSIGNED_FLAG?1:0));
- add_property_long(return_value, "zerofill",(mysql_field->flags&ZEROFILL_FLAG?1:0));
-}
-/* }}} */
-
-
-/* {{{ proto bool mysql_field_seek(int result, int field_offset)
- Sets result pointer to a specific field offset */
-PHP_FUNCTION(mysql_field_seek)
-{
- zval **result, **offset;
- MYSQL_RES *mysql_result;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &result, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- convert_to_long_ex(offset);
- if (Z_LVAL_PP(offset)<0 || Z_LVAL_PP(offset)>=(int)mysql_num_fields(mysql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %d is invalid for MySQL result index %d", Z_LVAL_PP(offset), Z_LVAL_PP(result));
- RETURN_FALSE;
- }
- mysql_field_seek(mysql_result, Z_LVAL_PP(offset));
- RETURN_TRUE;
-}
-/* }}} */
-
-
-#define PHP_MYSQL_FIELD_NAME 1
-#define PHP_MYSQL_FIELD_TABLE 2
-#define PHP_MYSQL_FIELD_LEN 3
-#define PHP_MYSQL_FIELD_TYPE 4
-#define PHP_MYSQL_FIELD_FLAGS 5
-
-/* {{{ php_mysql_field_info
- */
-static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
-{
- zval **result, **field;
- MYSQL_RES *mysql_result;
- MYSQL_FIELD *mysql_field;
- char buf[512];
- int len;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &result, &field)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- convert_to_long_ex(field);
- if (Z_LVAL_PP(field)<0 || Z_LVAL_PP(field)>=(int)mysql_num_fields(mysql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %d is invalid for MySQL result index %d", Z_LVAL_PP(field), Z_LVAL_PP(result));
- RETURN_FALSE;
- }
- mysql_field_seek(mysql_result, Z_LVAL_PP(field));
- if ((mysql_field=mysql_fetch_field(mysql_result))==NULL) {
- RETURN_FALSE;
- }
-
- switch (entry_type) {
- case PHP_MYSQL_FIELD_NAME:
- Z_STRLEN_P(return_value) = strlen(mysql_field->name);
- Z_STRVAL_P(return_value) = estrndup(mysql_field->name, Z_STRLEN_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- break;
- case PHP_MYSQL_FIELD_TABLE:
- Z_STRLEN_P(return_value) = strlen(mysql_field->table);
- Z_STRVAL_P(return_value) = estrndup(mysql_field->table, Z_STRLEN_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- break;
- case PHP_MYSQL_FIELD_LEN:
- Z_LVAL_P(return_value) = mysql_field->length;
- Z_TYPE_P(return_value) = IS_LONG;
- break;
- case PHP_MYSQL_FIELD_TYPE:
- Z_STRVAL_P(return_value) = php_mysql_get_field_name(Z_TYPE_P(mysql_field));
- Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
- Z_STRVAL_P(return_value) = estrndup(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- break;
- case PHP_MYSQL_FIELD_FLAGS:
- memcpy(buf, "", sizeof(""));
-#ifdef IS_NOT_NULL
- if (IS_NOT_NULL(mysql_field->flags)) {
- strcat(buf, "not_null ");
- }
-#endif
-#ifdef IS_PRI_KEY
- if (IS_PRI_KEY(mysql_field->flags)) {
- strcat(buf, "primary_key ");
- }
-#endif
-#ifdef UNIQUE_KEY_FLAG
- if (mysql_field->flags&UNIQUE_KEY_FLAG) {
- strcat(buf, "unique_key ");
- }
-#endif
-#ifdef MULTIPLE_KEY_FLAG
- if (mysql_field->flags&MULTIPLE_KEY_FLAG) {
- strcat(buf, "multiple_key ");
- }
-#endif
-#ifdef IS_BLOB
- if (IS_BLOB(mysql_field->flags)) {
- strcat(buf, "blob ");
- }
-#endif
-#ifdef UNSIGNED_FLAG
- if (mysql_field->flags&UNSIGNED_FLAG) {
- strcat(buf, "unsigned ");
- }
-#endif
-#ifdef ZEROFILL_FLAG
- if (mysql_field->flags&ZEROFILL_FLAG) {
- strcat(buf, "zerofill ");
- }
-#endif
-#ifdef BINARY_FLAG
- if (mysql_field->flags&BINARY_FLAG) {
- strcat(buf, "binary ");
- }
-#endif
-#ifdef ENUM_FLAG
- if (mysql_field->flags&ENUM_FLAG) {
- strcat(buf, "enum ");
- }
-#endif
-#ifdef SET_FLAG
- if (mysql_field->flags&SET_FLAG) {
- strcat(buf, "set ");
- }
-#endif
-#ifdef AUTO_INCREMENT_FLAG
- if (mysql_field->flags&AUTO_INCREMENT_FLAG) {
- strcat(buf, "auto_increment ");
- }
-#endif
-#ifdef TIMESTAMP_FLAG
- if (mysql_field->flags&TIMESTAMP_FLAG) {
- strcat(buf, "timestamp ");
- }
-#endif
- len = strlen(buf);
- /* remove trailing space, if present */
- if (len && buf[len-1] == ' ') {
- buf[len-1] = 0;
- len--;
- }
-
- Z_STRLEN_P(return_value) = len;
- Z_STRVAL_P(return_value) = estrndup(buf, len);
- Z_TYPE_P(return_value) = IS_STRING;
- break;
-
- default:
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string mysql_field_name(int result, int field_index)
- Gets the name of the specified field in a result */
-PHP_FUNCTION(mysql_field_name)
-{
- php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_NAME);
-}
-/* }}} */
-
-
-/* {{{ proto string mysql_field_table(int result, int field_offset)
- Gets name of the table the specified field is in */
-PHP_FUNCTION(mysql_field_table)
-{
- php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_TABLE);
-}
-/* }}} */
-
-
-/* {{{ proto int mysql_field_len(int result, int field_offset)
- Returns the length of the specified field */
-PHP_FUNCTION(mysql_field_len)
-{
- php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_LEN);
-}
-/* }}} */
-
-
-/* {{{ proto string mysql_field_type(int result, int field_offset)
- Gets the type of the specified field in a result */
-PHP_FUNCTION(mysql_field_type)
-{
- php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_TYPE);
-}
-/* }}} */
-
-
-/* {{{ proto string mysql_field_flags(int result, int field_offset)
- Gets the flags associated with the specified field in a result */
-PHP_FUNCTION(mysql_field_flags)
-{
- php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_FLAGS);
-}
-/* }}} */
-
-
-/* {{{ proto bool mysql_free_result(int result)
- Free result memory */
-PHP_FUNCTION(mysql_free_result)
-{
- zval **result;
- MYSQL_RES *mysql_result;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(result)==IS_RESOURCE && Z_LVAL_PP(result)==0) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- zend_list_delete(Z_LVAL_PP(result));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mysql_ping([int link_identifier])
- Ping a server connection. If no connection then reconnect. */
-PHP_FUNCTION(mysql_ping)
-{
- zval *mysql_link = NULL;
- int id = -1;
- php_mysql_conn *mysql;
-
- if (0 == ZEND_NUM_ARGS()) {
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &mysql_link)==FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id, "MySQL-Link", le_link, le_plink);
- RETURN_BOOL(! mysql_ping(&mysql->conn));
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/mysql/php_mysql.h b/ext/mysql/php_mysql.h
deleted file mode 100644
index 43789b2ce7..0000000000
--- a/ext/mysql/php_mysql.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-/* $Id$ */
-
-#ifndef PHP_MYSQL_H
-#define PHP_MYSQL_H
-
-#ifdef PHP_WIN32
-#define PHP_MYSQL_API __declspec(dllexport)
-#else
-#define PHP_MYSQL_API
-#endif
-
-#if HAVE_MYSQL
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-extern zend_module_entry mysql_module_entry;
-
-#define mysql_module_ptr &mysql_module_entry
-
-PHP_MINIT_FUNCTION(mysql);
-PHP_RINIT_FUNCTION(mysql);
-PHP_MSHUTDOWN_FUNCTION(mysql);
-PHP_RSHUTDOWN_FUNCTION(mysql);
-PHP_MINFO_FUNCTION(mysql);
-
-PHP_FUNCTION(mysql_connect);
-PHP_FUNCTION(mysql_pconnect);
-PHP_FUNCTION(mysql_close);
-PHP_FUNCTION(mysql_select_db);
-#if MYSQL_VERSION_ID < 40000
-PHP_FUNCTION(mysql_create_db);
-PHP_FUNCTION(mysql_drop_db);
-#endif
-PHP_FUNCTION(mysql_query);
-PHP_FUNCTION(mysql_unbuffered_query);
-PHP_FUNCTION(mysql_db_query);
-PHP_FUNCTION(mysql_list_dbs);
-PHP_FUNCTION(mysql_list_tables);
-PHP_FUNCTION(mysql_list_fields);
-PHP_FUNCTION(mysql_list_processes);
-PHP_FUNCTION(mysql_error);
-PHP_FUNCTION(mysql_errno);
-PHP_FUNCTION(mysql_affected_rows);
-PHP_FUNCTION(mysql_insert_id);
-PHP_FUNCTION(mysql_result);
-PHP_FUNCTION(mysql_num_rows);
-PHP_FUNCTION(mysql_num_fields);
-PHP_FUNCTION(mysql_fetch_row);
-PHP_FUNCTION(mysql_fetch_array);
-PHP_FUNCTION(mysql_fetch_assoc);
-PHP_FUNCTION(mysql_fetch_object);
-PHP_FUNCTION(mysql_data_seek);
-PHP_FUNCTION(mysql_fetch_lengths);
-PHP_FUNCTION(mysql_fetch_field);
-PHP_FUNCTION(mysql_field_seek);
-PHP_FUNCTION(mysql_free_result);
-PHP_FUNCTION(mysql_field_name);
-PHP_FUNCTION(mysql_field_table);
-PHP_FUNCTION(mysql_field_len);
-PHP_FUNCTION(mysql_field_type);
-PHP_FUNCTION(mysql_field_flags);
-PHP_FUNCTION(mysql_escape_string);
-PHP_FUNCTION(mysql_real_escape_string);
-PHP_FUNCTION(mysql_get_client_info);
-PHP_FUNCTION(mysql_get_host_info);
-PHP_FUNCTION(mysql_get_proto_info);
-PHP_FUNCTION(mysql_get_server_info);
-PHP_FUNCTION(mysql_info);
-PHP_FUNCTION(mysql_stat);
-PHP_FUNCTION(mysql_thread_id);
-PHP_FUNCTION(mysql_client_encoding);
-PHP_FUNCTION(mysql_ping);
-
-ZEND_BEGIN_MODULE_GLOBALS(mysql)
- long default_link;
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
- long default_port;
- char *default_host, *default_user, *default_password;
- char *default_socket;
- char *connect_error;
- long connect_errno;
- long connect_timeout;
- long result_allocated;
- long trace_mode;
-ZEND_END_MODULE_GLOBALS(mysql)
-
-#ifdef ZTS
-# define MySG(v) TSRMG(mysql_globals_id, zend_mysql_globals *, v)
-#else
-# define MySG(v) (mysql_globals.v)
-#endif
-
-
-#else
-
-#define mysql_module_ptr NULL
-
-#endif
-
-#define phpext_mysql_ptr mysql_module_ptr
-
-#endif /* PHP_MYSQL_H */
diff --git a/ext/mysqli/CREDITS b/ext/mysqli/CREDITS
deleted file mode 100644
index 68cfa8a4ae..0000000000
--- a/ext/mysqli/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-MySQLi
-Zak Greant, Georg Richter
diff --git a/ext/mysqli/EXPERIMENTAL b/ext/mysqli/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/mysqli/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/mysqli/TODO b/ext/mysqli/TODO
deleted file mode 100644
index 6b457571f6..0000000000
--- a/ext/mysqli/TODO
+++ /dev/null
@@ -1,13 +0,0 @@
-- review/code inspection of the bind stuff
-- test
-- documentation
-- benchmarks /ext/mysql vs. ext/mysqli
-- testing/compiling under windows
-- migration guide:
- diffrences between ext/mysql and mysqli
- not supported functions from ext/mysql (mysql_db_query)
-- ini-settings
-- phpinfo output (Status: mostly done, maybe some more information could be interesting)
-- blob support for mysql_prepare
-- multi query support (still open until there is a decision (MySQL AB))
-- bundled libmysql 4.1
diff --git a/ext/mysqli/config.m4 b/ext/mysqli/config.m4
deleted file mode 100644
index 2c32818e50..0000000000
--- a/ext/mysqli/config.m4
+++ /dev/null
@@ -1,45 +0,0 @@
-dnl
-dnl $Id$
-dnl config.m4 for extension mysqli
-
-PHP_ARG_WITH(mysqli, for MySQLi support,
-[ --with-mysqli[=FILE] Include MySQLi support. FILE is the optional
- pathname to mysql_config.])
-
-if test "$PHP_MYSQLI" != "no"; then
-
- if test "$PHP_MYSQL" = "yes"; then
- AC_MSG_ERROR([--with-mysql (using bundled libs) can not be used together with --with-mysqli.])
- fi
-
- if test "$PHP_MYSQLI" = "yes"; then
- MYSQL_CONFIG=`$php_shtool path mysql_config`
- else
- MYSQL_CONFIG=$PHP_MYSQLI
- fi
-
- if test -x "$MYSQL_CONFIG" && $MYSQL_CONFIG --libs > /dev/null 2>&1; then
- MYSQLI_INCLINE=`$MYSQL_CONFIG --cflags | sed -e "s/'//g"`
- MYSQLI_LIBLINE=`$MYSQL_CONFIG --libs | sed -e "s/'//g"`
- else
- AC_MSG_RESULT([mysql_config not found])
- AC_MSG_ERROR([Please reinstall the mysql distribution])
- fi
-
- dnl
- dnl Check the library
- dnl
- PHP_CHECK_LIBRARY(mysqlclient, mysql_bind_param,
- [
- PHP_EVAL_INCLINE($MYSQLI_INCLINE)
- PHP_EVAL_LIBLINE($MYSQLI_LIBLINE, MYSQLI_SHARED_LIBADD)
- AC_DEFINE(HAVE_MYSQLILIB,1,[ ])
- ],[
- AC_MSG_ERROR([wrong mysql library version or lib not found. Check config.log for more information.])
- ],[
- $MYSQLI_LIBLINE
- ])
-
- PHP_SUBST(MYSQLI_SHARED_LIBADD)
- PHP_NEW_EXTENSION(mysqli, mysqli.c mysqli_api.c mysqli_nonapi.c mysqli_fe.c mysqli_profiler.c mysqli_profiler_com.c, $ext_shared)
-fi
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
deleted file mode 100644
index f5b856c08c..0000000000
--- a/ext/mysqli/mysqli.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Georg Richter <georg@php.net> |
- +----------------------------------------------------------------------+
-
- $Id$
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <signal.h>
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-#include "php_mysqli.h"
-
-#define MYSQLI_STORE_RESULT 0
-#define MYSQLI_USE_RESULT 1
-
-ZEND_DECLARE_MODULE_GLOBALS(mysqli)
-static zend_object_handlers mysqli_object_handlers;
-PR_MAIN *prmain;
-
-/* {{{ php_clear_stmt_bind */
-void php_clear_stmt_bind(STMT *stmt)
-{
- unsigned int i;
-
- if (stmt->stmt) {
- mysql_stmt_close(stmt->stmt);
- }
-
- if (stmt->var_cnt) {
- for (i = 0; i < stmt->var_cnt; i++) {
- if (stmt->type == FETCH_RESULT) {
- if (stmt->bind[i].type == IS_STRING) {
- efree(stmt->bind[i].buffer);
- }
- }
- if (stmt->vars[i]) {
- ZVAL_DELREF(stmt->vars[i]);
- }
- }
- if (stmt->type == FETCH_RESULT) {
- efree(stmt->bind);
- }
- efree(stmt->vars);
- efree(stmt->is_null);
- }
- efree(stmt);
- return;
-}
-/* }}} */
-
-/* {{{ mysqli_objects_dtor
- */
-static void mysqli_objects_dtor(void *object, zend_object_handle handle TSRMLS_DC)
-{
- mysqli_object *intern = (mysqli_object *)object;
- MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern->ptr;
-
- /* link object */
- if (intern->zo.ce == mysqli_link_class_entry) {
- if (my_res && my_res->ptr) {
- mysql_close(my_res->ptr);
- }
- } else if (intern->zo.ce == mysqli_stmt_class_entry) { /* stmt object */
- if (my_res && my_res->ptr) {
- php_clear_stmt_bind((STMT *)my_res->ptr);
- }
- } else if (intern->zo.ce == mysqli_result_class_entry) { /* result object */
- if (my_res && my_res->ptr) {
- mysql_free_result(my_res->ptr);
- }
- }
- my_efree(my_res);
- zend_objects_destroy_object(object, handle TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ mysqli_objects_clone
- */
-static void mysqli_objects_clone(void *object, void **object_clone TSRMLS_DC)
-{
- /* TODO */
-}
-/* }}} */
-
-/* {{{ mysqli_objects_new
- */
-PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry *class_type TSRMLS_DC)
-{
- zend_object_value retval;
- mysqli_object *intern;
- zval *tmp;
-
- intern = emalloc(sizeof(mysqli_object));
- intern->zo.ce = class_type;
- intern->zo.in_get = 0;
- intern->zo.in_set = 0;
- intern->ptr = NULL;
-
- ALLOC_HASHTABLE(intern->zo.properties);
- zend_hash_init(intern->zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
-
- retval.handle = zend_objects_store_put(intern, mysqli_objects_dtor, mysqli_objects_clone TSRMLS_CC);
- retval.handlers = &mysqli_object_handlers;
-
- return retval;
-}
-/* }}} */
-
-/* {{{ mysqli_module_entry
- */
-zend_module_entry mysqli_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
- "mysqli",
- mysqli_functions,
- PHP_MINIT(mysqli),
- PHP_MSHUTDOWN(mysqli),
- PHP_RINIT(mysqli), /* Replace with NULL if there's nothing to do at request start */
- PHP_RSHUTDOWN(mysqli), /* Replace with NULL if there's nothing to do at request end */
- PHP_MINFO(mysqli),
-#if ZEND_MODULE_API_NO >= 20010901
- "0.1", /* Replace with version number for your extension */
-#endif
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_MYSQLI
-ZEND_GET_MODULE(mysqli)
-#endif
-
-/* {{{ PHP_INI_BEGIN
-*/
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY_EX("mysqli.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_links, zend_mysqli_globals, mysqli_globals, display_link_numbers)
- STD_PHP_INI_ENTRY("mysqli.default_host", NULL, PHP_INI_ALL, OnUpdateString, default_host, zend_mysqli_globals, mysqli_globals)
- STD_PHP_INI_ENTRY("mysqli.default_user", NULL, PHP_INI_ALL, OnUpdateString, default_user, zend_mysqli_globals, mysqli_globals)
- STD_PHP_INI_ENTRY("mysqli.default_pw", NULL, PHP_INI_ALL, OnUpdateString, default_pw, zend_mysqli_globals, mysqli_globals)
- STD_PHP_INI_ENTRY("mysqli.default_port", "3306", PHP_INI_ALL, OnUpdateLong, default_port, zend_mysqli_globals, mysqli_globals)
- STD_PHP_INI_ENTRY("mysqli.default_socket", NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_socket, zend_mysqli_globals, mysqli_globals)
-PHP_INI_END()
-
-/* }}} */
-
-/* {{{ php_mysqli_init_globals
- */
-static void php_mysqli_init_globals(zend_mysqli_globals *mysqli_globals)
-{
- mysqli_globals->num_links = 0;
- mysqli_globals->max_links = 0;
- mysqli_globals->default_port = 0;
- mysqli_globals->default_host = NULL;
- mysqli_globals->default_user = NULL;
- mysqli_globals->default_pw = NULL;
- mysqli_globals->default_socket = NULL;
- mysqli_globals->profiler = 0;
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(mysqli)
-{
-
- ZEND_INIT_MODULE_GLOBALS(mysqli, php_mysqli_init_globals, NULL);
- REGISTER_INI_ENTRIES();
-
- memcpy(&mysqli_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
- mysqli_object_handlers.clone_obj = zend_objects_store_clone_obj;
-
- REGISTER_MYSQLI_CLASS_ENTRY("mysqli", mysqli_link_class_entry, mysqli_link_methods);
- REGISTER_MYSQLI_CLASS_ENTRY("mysqli_result", mysqli_result_class_entry, mysqli_result_methods);
- REGISTER_MYSQLI_CLASS_ENTRY("mysqli_stmt", mysqli_stmt_class_entry, mysqli_stmt_methods);
-
- /* mysqli_options */
- REGISTER_LONG_CONSTANT("MYSQLI_READ_DEFAULT_GROUP", MYSQL_READ_DEFAULT_GROUP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_READ_DEFAULT_FILE", MYSQL_READ_DEFAULT_FILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_OPT_CONNECT_TIMEOUT", MYSQL_OPT_CONNECT_TIMEOUT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_OPT_LOCAL_INFILE", MYSQL_OPT_LOCAL_INFILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_INIT_COMMAND", MYSQL_INIT_COMMAND, CONST_CS | CONST_PERSISTENT);
-
- /* mysqli_real_connect flags */
- REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_COMPRESS",CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_NO_SCHEMA", CLIENT_NO_SCHEMA, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_MULTI_QUERIES", CLIENT_MULTI_QUERIES, CONST_CS | CONST_PERSISTENT);
-
-
- /* for mysqli_query */
- REGISTER_LONG_CONSTANT("MYSQLI_STORE_RESULT", 0, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_USE_RESULT", 1, CONST_CS | CONST_PERSISTENT);
-
- /* for mysqli_fetch_assoc */
- REGISTER_LONG_CONSTANT("MYSQLI_ASSOC", MYSQLI_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_NUM", MYSQLI_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_BOTH", MYSQLI_BOTH, CONST_CS | CONST_PERSISTENT);
-
-
- /* column information */
- REGISTER_LONG_CONSTANT("MYSQLI_NOT_NULL_FLAG", NOT_NULL_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_PRI_KEY_FLAG", PRI_KEY_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_UNIQUE_KEY_FLAG", UNIQUE_KEY_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_MULTIPLE_KEY_FLAG", MULTIPLE_KEY_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_BLOB_FLAG", BLOB_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_UNSIGNED_FLAG", UNSIGNED_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_ZEROFILL_FLAG", ZEROFILL_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_AUTO_INCREMENT_FLAG", AUTO_INCREMENT_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TIMESTAMP_FLAG", TIMESTAMP_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_SET_FLAG", SET_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_NUM_FLAG", NUM_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_PART_KEY_FLAG", PART_KEY_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_GROUP_FLAG", GROUP_FLAG, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DECIMAL", FIELD_TYPE_DECIMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TINY", FIELD_TYPE_TINY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_SHORT", FIELD_TYPE_SHORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONG", FIELD_TYPE_LONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_FLOAD", FIELD_TYPE_FLOAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DOUBLE", FIELD_TYPE_DOUBLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NULL", FIELD_TYPE_NULL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TIMESTAMP", FIELD_TYPE_TIMESTAMP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONGLONG", FIELD_TYPE_LONGLONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_INT24", FIELD_TYPE_INT24, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DATE", FIELD_TYPE_DATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TIME", FIELD_TYPE_TIME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DATETIME", FIELD_TYPE_DATETIME , CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_YEAR", FIELD_TYPE_YEAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NEWDATE", FIELD_TYPE_NEWDATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_ENUM", FIELD_TYPE_ENUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_SET", FIELD_TYPE_SET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TINY_BLOB", FIELD_TYPE_TINY_BLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_MEDIUM_BLOB", FIELD_TYPE_MEDIUM_BLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONG_BLOB", FIELD_TYPE_LONG_BLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_BLOB", FIELD_TYPE_BLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_VAR_STRING", FIELD_TYPE_VAR_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_STRING", FIELD_TYPE_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_CHAR", FIELD_TYPE_CHAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_INTERVAL", FIELD_TYPE_INTERVAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_TYPE_GEOMETRY", FIELD_TYPE_GEOMETRY, CONST_CS | CONST_PERSISTENT);
-
- /* bindtypes for mysqli_bind_result */
- REGISTER_LONG_CONSTANT("MYSQLI_BIND_STRING", MYSQLI_BIND_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_BIND_INT", MYSQLI_BIND_INT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_BIND_DOUBLE", MYSQLI_BIND_DOUBLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_BIND_SEND_DATA", MYSQLI_BIND_SEND_DATA, CONST_CS | CONST_PERSISTENT);
-
- /* replication */
- REGISTER_LONG_CONSTANT("MYSQLI_RPL_MASTER", MYSQL_RPL_MASTER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_RPL_SLAVE", MYSQL_RPL_SLAVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_RPL_ADMIN", MYSQL_RPL_ADMIN, CONST_CS | CONST_PERSISTENT);
-
- /* bind blob support */
- REGISTER_LONG_CONSTANT("MYSQLI_NEED_DATA", MYSQL_NEED_DATA, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_NO_DATA", MYSQL_NO_DATA, CONST_CS | CONST_PERSISTENT);
-
- /* profiler support */
- REGISTER_LONG_CONSTANT("MYSQLI_PR_REPORT_STDERR", 1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_PR_REPORT_PORT", 2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQLI_PR_REPORT_FILE", 3, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(mysqli)
-{
- /* uncomment this line if you have INI entries
- UNREGISTER_INI_ENTRIES();
- */
- return SUCCESS;
-}
-/* }}} */
-
-/* Remove if there's nothing to do at request start */
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(mysqli)
-{
- MyG(error_msg) = NULL;
- MyG(error_no) = 0;
-
- return SUCCESS;
-}
-/* }}} */
-
-/* Remove if there's nothing to do at request end */
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(mysqli)
-{
- if (MyG(error_msg)) {
- efree(MyG(error_msg));
- }
-
- if (MyG(profiler)) {
- if (prmain->header.child) {
- php_mysqli_profiler_report((PR_COMMON *)prmain, 0);
- }
- switch (prmain->mode) {
- case MYSQLI_PR_REPORT_FILE:
- fclose(prmain->fp);
- efree(prmain->name);
- break;
- }
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(mysqli)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "MysqlI Support", "enabled");
- php_info_print_table_row(2, "Client API version", mysql_get_client_info());
- php_info_print_table_row(2, "MYSQLI_SOCKET", MYSQL_UNIX_ADDR);
-
-
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-/* }}} */
-
-/* {{{ php_mysqli_fetch_into_hash
- */
-void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags)
-{
- MYSQL_RES *result;
- zval *mysql_result;
- int fetchtype;
- int copyflag;
- unsigned int i;
- MYSQL_FIELD *fields;
- MYSQL_ROW row;
- unsigned long *field_len;
- PR_RESULT *prresult;
- PR_COMMAND *prcommand;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &mysql_result, mysqli_result_class_entry, &fetchtype) == FAILURE) {
- return;
- }
-
- if (ZEND_NUM_ARGS() < 2 && !override_flags) {
- fetchtype = MYSQLI_BOTH;
- }
-
- if (override_flags) {
- fetchtype = override_flags;
- }
-
- MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, prresult, PR_RESULT *, &mysql_result, "mysqli_result");
-
- MYSQLI_PROFILER_COMMAND_START(prcommand, prresult);
-
- fields = mysql_fetch_fields(result);
- if (!(row = mysql_fetch_row(result))) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- field_len = mysql_fetch_lengths(result);
-
- for (i = 0; i < mysql_num_fields(result); i++) {
- if (row[i]) {
- char *column;
- int column_len;
-
- /* check if we need magic quotes */
- if (PG(magic_quotes_runtime)) {
- column = php_addslashes(row[i], field_len[i], &column_len, 0 TSRMLS_CC);
- copyflag = 0;
- } else {
- column = row[i];
- column_len = field_len[i];
- copyflag = 1;
- }
- if (fetchtype & MYSQLI_NUM) {
- add_index_stringl(return_value, i, column, column_len, copyflag);
- copyflag = 1;
- }
- if (fetchtype & MYSQLI_ASSOC) {
- add_assoc_stringl(return_value, fields[i].name, column, column_len, copyflag);
- }
- } else {
- if (fetchtype & MYSQLI_NUM) {
- add_index_null(return_value, i);
- }
- if (fetchtype & MYSQLI_ASSOC) {
- add_assoc_null(return_value, fields[i].name);
- }
- }
- }
-
- if (MyG(profiler)) {
- char tmp[10];
- sprintf ((char *)&tmp,"row[%d]", mysql_num_fields(result));
- MYSQLI_PROFILER_COMMAND_RETURNSTRING(prcommand, tmp);
- prresult->fetched_rows++;
- }
-}
-/* }}} */
-
-/* {{{ php_mysqli_set_error
- */
-PHP_MYSQLI_API void php_mysqli_set_error(long mysql_errno, char *mysql_err TSRMLS_DC)
-{
- MyG(error_no) = mysql_errno;
- if (MyG(error_msg)) {
- efree(MyG(error_msg));
- }
- MyG(error_msg) = estrdup(mysql_err);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/mysqli/mysqli.dsp b/ext/mysqli/mysqli.dsp
deleted file mode 100755
index fc4ec4c5b8..0000000000
--- a/ext/mysqli/mysqli.dsp
+++ /dev/null
@@ -1,120 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mysqli" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mysqli - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mysqli.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mysqli.mak" CFG="mysqli - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mysqli - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mysqli - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mysqli - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQLI_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\include" /I "..\..\..\php_build\include\mysqli" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MYSQLI" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "PHP_MYSQLI_EXPORTS" /D "HAVE_ZLIB" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib zlib.lib libmySQL.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mysqli.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\release"
-
-!ELSEIF "$(CFG)" == "mysqli - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQLI_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\include" /I "..\..\..\php_build\include\mysqli" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MYSQLI" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "PHP_MYSQLI_EXPORTS" /D "HAVE_ZLIB" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib zlib.lib libmySQL.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_mysqli.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\release"
-
-!ENDIF
-
-# Begin Target
-
-# Name "mysqli - Win32 Release_TS"
-# Name "mysqli - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mysqli.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysqli_api.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysqli_fe.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysqli_nonapi.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mysqli.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
deleted file mode 100644
index c4638ac71c..0000000000
--- a/ext/mysqli/mysqli_api.c
+++ /dev/null
@@ -1,1913 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Georg Richter <georg@php.net> |
- +----------------------------------------------------------------------+
-
- $Id$
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <signal.h>
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_mysqli.h"
-
-
-/* {{{ proto mixed mysqli_affected_rows(resource link)
- Get number of affected rows in previous MySQL operation */
-PHP_FUNCTION(mysqli_affected_rows)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
- my_ulonglong rc;
- PR_COMMAND *prcommand;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return; /* Should this be RETURN_FALSE? */
- }
-
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- MYSQLI_PROFILER_COMMAND_START(prcommand, prmysql);
- rc = mysql_affected_rows(mysql);
- MYSQLI_PROFILER_COMMAND_RETURNLONG(prcommand, (long)rc);
- MYSQLI_RETURN_LONG_LONG(rc);
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_autocommit(resource link, bool mode)
- Turn auto commit on or of */
-PHP_FUNCTION(mysqli_autocommit)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
- PR_COMMAND *prcommand;
- unsigned long rc;
- unsigned long automode;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ob", &mysql_link, mysqli_link_class_entry, &automode) == FAILURE) {
- return; /* Should this be RETURN_FALSE? */
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- MYSQLI_PROFILER_COMMAND_START(prcommand, prmysql);
- rc = (long) mysql_autocommit(mysql, automode);
- MYSQLI_PROFILER_COMMAND_RETURNLONG(prcommand, rc);
-
- RETURN_BOOL(rc);
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_bind_param(resource stmt, mixed variable, int type [,mixed,....])
- Bind variables to a prepared statement as parameters */
-PHP_FUNCTION(mysqli_bind_param)
-{
- zval ***args;
- int argc = ZEND_NUM_ARGS();
- int i;
- int num_vars;
- int start = 0;
- int ofs;
- STMT *stmt;
- MYSQL_BIND *bind;
- zval **object;
- PR_STMT *prstmt;
- PR_COMMAND *prcommand;
- unsigned long rc;
-
- /* calculate and check number of parameters */
- num_vars = argc;
- if (!getThis()) {
- /* ignore handle parameter in procedural interface*/
- --num_vars;
- }
- if (num_vars % 2) {
- /* we need variable/type pairs */
- WRONG_PARAM_COUNT;
- }
- if (num_vars < 2) {
- /* there has to be at least one pair */
- WRONG_PARAM_COUNT;
- }
- num_vars /= 2;
-
-
- args = (zval ***)emalloc(argc * sizeof(zval **));
-
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- if (!getThis()) {
- if (Z_TYPE_PP(args[0]) != IS_OBJECT) {
- efree(args);
- RETURN_FALSE;
- }
- MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, args[0], "mysqli_stmt");
- start = 1;
- } else {
- object = &(getThis());
- MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, object, "mysqli_stmt");
- }
-
-
- /* prevent leak if variables are already bound */
-#if HHOLZGRA_0
- /* this would prevent using both bind_param and bind_result on SELECT
- queries so it is disabled for now */
- if (stmt->var_cnt) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variables already bound");
- efree(args);
- RETURN_FALSE;
- }
-#endif
-
- stmt->is_null = ecalloc(num_vars, sizeof(char));
- bind = (MYSQL_BIND *)ecalloc(num_vars, sizeof(MYSQL_BIND));
-
- for (i=start; i < num_vars * 2 + start; i+=2) {
- ofs = (i - start) / 2;
- if (!PZVAL_IS_REF(*args[i]) && Z_LVAL_PP(args[i+1]) != MYSQLI_BIND_SEND_DATA) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter %d wasn't passed by reference", i+1);
- efree(bind);
- efree(args);
- RETURN_FALSE;
- }
-
- /* set specified type */
- switch (Z_LVAL_PP(args[i+1])) {
- case MYSQLI_BIND_DOUBLE:
- bind[ofs].buffer_type = MYSQL_TYPE_DOUBLE;
- bind[ofs].buffer = (gptr)&Z_DVAL_PP(args[i]);
- bind[ofs].is_null = &stmt->is_null[ofs];
- break;
-
- case MYSQLI_BIND_INT:
- bind[ofs].buffer_type = MYSQL_TYPE_LONG;
- bind[ofs].buffer = (gptr)&Z_LVAL_PP(args[i]);
- bind[ofs].is_null = &stmt->is_null[ofs];
- break;
-
- case MYSQLI_BIND_SEND_DATA:
- bind[ofs].buffer_type = MYSQL_TYPE_VAR_STRING;
- bind[ofs].is_null = 0;
- bind[ofs].length = 0;
- break;
-
- case MYSQLI_BIND_STRING:
- bind[ofs].buffer_type = MYSQL_TYPE_VAR_STRING;
- bind[ofs].buffer = NULL;
- bind[ofs].buffer_length = 0;
- bind[ofs].is_null = &stmt->is_null[ofs];
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Undefined fieldtype %d (parameter %d)", Z_LVAL_PP(args[i]), i+1);
- efree(args);
- efree(bind);
- RETURN_FALSE;
- break;
- }
- }
-
- MYSQLI_PROFILER_COMMAND_START(prcommand, prstmt);
- rc = mysql_bind_param(stmt->stmt, bind);
- MYSQLI_PROFILER_COMMAND_RETURNLONG(prcommand, rc);
-
- if (rc) {
- efree(args);
- efree(bind);
- RETURN_FALSE;
- }
-
- stmt->var_cnt = num_vars;
- stmt->type = FETCH_SIMPLE;
- stmt->vars = (zval **)emalloc(num_vars * sizeof(zval));
- for (i = 0; i < num_vars*2; i+=2) {
- if (Z_LVAL_PP(args[i+1+start]) != MYSQLI_BIND_SEND_DATA) {
- ZVAL_ADDREF(*args[i+start]);
- stmt->vars[i/2] = *args[i+start];
- } else {
- stmt->vars[i/2] = NULL;
- }
- }
- efree(args);
- efree(bind);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_bind_result(resource stmt, mixed var, int len [,mixed,int....])
- Bind variables to a prepared statement for result storage */
-
-/* TODO:
- do_alloca, free_alloca
-*/
-
-PHP_FUNCTION(mysqli_bind_result)
-{
- zval ***args;
- int argc = ZEND_NUM_ARGS();
- zval **object;
- int i;
- int start = 0;
- int var_cnt;
- int ofs;
- long col_type;
- ulong rc;
- STMT *stmt;
- MYSQL_BIND *bind;
- PR_STMT *prstmt;
- PR_COMMAND *prcommand;
-
- if (argc < (getThis() ? 1 : 2)) {
- WRONG_PARAM_COUNT;
- }
-
- args = (zval ***)emalloc(argc * sizeof(zval **));
-
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- if (!getThis()) {
- if (Z_TYPE_PP(args[0]) != IS_OBJECT) {
- efree(args);
- RETURN_FALSE;
- }
- MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, args[0], "mysqli_stmt");
- start = 1;
- } else {
- object = &(getThis());
- MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, object, "mysqli_stmt");
- }
-
- var_cnt = argc - start;
-
- /* prevent leak if variables are already bound */
-#if HHOLZGRA_0
- /* this would prevent using both bind_param and bind_result on SELECT
- queries so it is disabled for now */
- if (stmt->var_cnt) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variables already bound");
- efree(args);
- RETURN_FALSE;
- }
-#endif
-
- bind = (MYSQL_BIND *)ecalloc(var_cnt, sizeof(MYSQL_BIND));
- stmt->bind = (BIND_BUFFER *)ecalloc(var_cnt,sizeof(BIND_BUFFER));
- stmt->is_null = (char *)ecalloc(var_cnt, sizeof(char));
- stmt->type = FETCH_RESULT;
-
- for (i=start; i < var_cnt + start ; i++) {
- ofs = i - start;
- stmt->is_null[ofs] = 0;
- if (!PZVAL_IS_REF(*args[i])) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter %d wasn't passed by reference", i);
- efree(bind);
- efree(args);
- php_clear_stmt_bind(stmt);
- RETURN_FALSE;
- }
-
- col_type = (stmt->stmt->fields) ? stmt->stmt->fields[ofs].type : MYSQL_TYPE_STRING;
-
- switch (col_type) {
- case MYSQL_TYPE_DECIMAL:
- case MYSQL_TYPE_DOUBLE:
- case MYSQL_TYPE_FLOAT:
- convert_to_double_ex(args[i]);
- stmt->bind[ofs].type = IS_DOUBLE;
- stmt->bind[ofs].buflen = 0;
- bind[ofs].buffer_type = MYSQL_TYPE_DOUBLE;
- bind[ofs].buffer = (gptr)&Z_DVAL_PP(args[i]);
- bind[ofs].is_null = &stmt->is_null[ofs];
- break;
-
- case MYSQL_TYPE_SHORT:
- case MYSQL_TYPE_TINY:
- case MYSQL_TYPE_LONG:
- case MYSQL_TYPE_INT24:
- case MYSQL_TYPE_YEAR:
- convert_to_long_ex(args[i]);
- stmt->bind[ofs].type = IS_LONG;
- stmt->bind[ofs].buflen = 0;
- bind[ofs].buffer_type = MYSQL_TYPE_LONG;
- bind[ofs].buffer = (gptr)&Z_LVAL_PP(args[i]);
- bind[ofs].is_null = &stmt->is_null[ofs];
- break;
-
- case MYSQL_TYPE_LONGLONG:
- stmt->bind[ofs].type = IS_STRING;
- stmt->bind[ofs].buflen = sizeof(my_ulonglong);
- stmt->bind[ofs].buffer = (char *)emalloc(stmt->bind[ofs].buflen);
- bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG;
- bind[ofs].buffer = stmt->bind[ofs].buffer;
- bind[ofs].is_null = &stmt->is_null[ofs];
- bind[ofs].buffer_length = stmt->bind[ofs].buflen;
- break;
- case MYSQL_TYPE_DATE:
- case MYSQL_TYPE_TIME:
- case MYSQL_TYPE_DATETIME:
- case MYSQL_TYPE_NEWDATE:
- case MYSQL_TYPE_VAR_STRING:
- case MYSQL_TYPE_STRING:
- case MYSQL_TYPE_BLOB:
- case MYSQL_TYPE_TIMESTAMP:
- stmt->bind[ofs].type = IS_STRING;
- stmt->bind[ofs].buflen = (stmt->stmt->fields) ? stmt->stmt->fields[ofs].length + 1: 256;
- stmt->bind[ofs].buffer = (char *)emalloc(stmt->bind[ofs].buflen);
- bind[ofs].buffer_type = MYSQL_TYPE_STRING;
- bind[ofs].buffer = stmt->bind[ofs].buffer;
- bind[ofs].is_null = &stmt->is_null[ofs];
- bind[ofs].buffer_length = stmt->bind[ofs].buflen;
- bind[ofs].length = &stmt->bind[ofs].buflen;
- break;
- }
- }
-
- MYSQLI_PROFILER_COMMAND_START(prcommand, prstmt);
- rc = mysql_bind_result(stmt->stmt, bind);
- MYSQLI_PROFILER_COMMAND_RETURNLONG(prcommand, rc);
-
- if (rc) {
- efree(bind);
- efree(args);
- php_clear_stmt_bind(stmt);
- RETURN_FALSE;
- }
-
- stmt->var_cnt = var_cnt;
- stmt->vars = (zval **)emalloc((var_cnt) * sizeof(zval));
- for (i = start; i < var_cnt+start; i++) {
- ofs = i-start;
- ZVAL_ADDREF(*args[i]);
- stmt->vars[ofs] = *args[i];
- }
-
- efree(args);
- efree(bind);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_change_user(resource link, string user, string password, string database)
- Change logged-in user of the active connection */
-PHP_FUNCTION(mysqli_change_user)
-{
- MYSQL *mysql;
- zval *mysql_link = NULL;
- char *user, *password, *dbname;
- int user_len, password_len, dbname_len;
- ulong rc;
- PR_COMMAND *prcommand;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osss", &mysql_link, mysqli_link_class_entry, &user, &user_len, &password, &password_len, &dbname, &dbname_len) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- MYSQLI_PROFILER_COMMAND_START(prcommand, prmysql);
- rc = mysql_change_user(mysql, user, password, dbname);
- MYSQLI_PROFILER_COMMAND_RETURNLONG(prcommand, rc);
- if (rc) {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string mysqli_character_set_name(resource link)
- Returns the name of the character set used for this connection */
-PHP_FUNCTION(mysqli_character_set_name)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
- char *charsetname;
- PR_COMMAND *prcommand;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
-
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- MYSQLI_PROFILER_COMMAND_START(prcommand, prmysql);
- charsetname = (char *)mysql_character_set_name(mysql);
- MYSQLI_PROFILER_COMMAND_RETURNSTRING(prcommand, charsetname);
-
- RETURN_STRING(charsetname, 1);
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_close(resource link)
- Close connection */
-PHP_FUNCTION(mysqli_close)
-{
- zval *mysql_link;
- PR_MYSQL *prmysql;
- MYSQL *mysql;
- PR_COMMON *current;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
-
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- mysql_close(mysql);
-
- if (MyG(profiler)) {
- prmysql->closed = 1;
- }
- current = (PR_COMMON *)prmysql;
- if (MyG(profiler)) {
- php_mysqli_profiler_report(current, 0);
- }
- MYSQLI_CLEAR_RESOURCE(&mysql_link);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_commit(resource link)
- Commit outstanding actions and close transaction */
-PHP_FUNCTION(mysqli_commit)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
- PR_COMMAND *prcommand;
- ulong rc;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
- MYSQLI_PROFILER_COMMAND_START(prcommand, prmysql);
- rc = mysql_commit(mysql);
- MYSQLI_PROFILER_COMMAND_RETURNLONG(prcommand, rc);
- RETURN_BOOL(rc);
-}
-/* }}} */
-
-/* {{{ proto void mysqli_data_seek(resource result)
- Move internal result pointer */
-PHP_FUNCTION(mysqli_data_seek)
-{
- MYSQL_RES *result;
- zval *mysql_result;
- PR_RESULT *prresult;
- PR_COMMAND *prcommand;
- long offset;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Orl", &mysql_result, mysqli_result_class_entry, &mysql_result, &offset) == FAILURE) {
- return;
- }
-
- MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, prresult, PR_RESULT *, &mysql_result, "mysqli_result");
-
- if (result->handle && result->handle->status == MYSQL_STATUS_USE_RESULT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function cannot be used with MYSQL_USE_RESULT");
- RETURN_LONG(0);
- }
-
- MYSQLI_PROFILER_COMMAND_START(prcommand, prresult);
- mysql_data_seek(result, offset);
- MYSQLI_PROFILER_COMMAND_RETURNSTRING(prcommand, NULL);
- return;
-}
-/* }}} */
-
-/* {{{ proto void mysqli_debug(string debug)
-*/
-PHP_FUNCTION(mysqli_debug)
-{
- char *debug;
- int debug_len;
- PR_COMMAND *prcommand;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &debug, &debug_len) == FAILURE) {
- return;
- }
-
- MYSQLI_PROFILER_COMMAND_START(prcommand, prmain);
- mysql_debug(debug);
- MYSQLI_PROFILER_COMMAND_RETURNSTRING(prcommand, NULL);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void mysqli_disable_reads_from_master(resource link)
-*/
-PHP_FUNCTION(mysqli_disable_reads_from_master)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
- PR_COMMAND *prcommand;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
- MYSQLI_PROFILER_COMMAND_START(prcommand, prmysql);
- mysql_disable_reads_from_master(mysql);
- MYSQLI_PROFILER_COMMAND_RETURNSTRING(prcommand, NULL);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void mysqli_disable_rpl_parse(resource link)
-*/
-PHP_FUNCTION(mysqli_disable_rpl_parse)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
- PR_COMMAND *prcommand;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
- MYSQLI_PROFILER_COMMAND_START(prcommand, prmysql);
- mysql_disable_rpl_parse(mysql);
- MYSQLI_PROFILER_COMMAND_RETURNSTRING(prcommand, NULL);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_dump_debug_info(resource link)
-*/
-PHP_FUNCTION(mysqli_dump_debug_info)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
- PR_COMMAND *prcommand;
- ulong rc;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- MYSQLI_PROFILER_COMMAND_START(prcommand, prmysql);
- rc = mysql_dump_debug_info(mysql);
- MYSQLI_PROFILER_COMMAND_RETURNLONG(prcommand, rc);
-
- if (rc) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void mysqli_enable_reads_from_master(resource link)
-*/
-PHP_FUNCTION(mysqli_enable_reads_from_master)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
- PR_COMMAND *prcommand;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- MYSQLI_PROFILER_COMMAND_START(prcommand, prmysql);
- mysql_enable_reads_from_master(mysql);
- MYSQLI_PROFILER_COMMAND_RETURNSTRING(prcommand, NULL);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void mysqli_enable_rpl_parse(resource link)
-*/
-PHP_FUNCTION(mysqli_enable_rpl_parse)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
- PR_COMMAND *prcommand;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- MYSQLI_PROFILER_COMMAND_START(prcommand, prmysql);
- mysql_enable_rpl_parse(mysql);
- MYSQLI_PROFILER_COMMAND_RETURNSTRING(prcommand, NULL);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mysqli_errno(resource link)
- Returns the numerical value of the error message from previous MySQL operation */
-PHP_FUNCTION(mysqli_errno)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
- RETURN_LONG(mysql_errno(mysql));
-}
-/* }}} */
-
-/* {{{ proto string mysqli_error(resource link)
- Returns the text of the error message from previous MySQL operation */
-PHP_FUNCTION(mysqli_error)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
- RETURN_STRING((char *)mysql_error(mysql),1);
-}
-/* }}} */
-
-/* {{{ proto int mysqli_execute(resource stmt)
- Execute a prepared statement */
-PHP_FUNCTION(mysqli_execute)
-{
- STMT *stmt;
- zval *mysql_stmt;
- unsigned int i;
- PR_STMT *prstmt;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
-
- if (stmt->type == FETCH_SIMPLE) {
- for (i = 0; i < stmt->var_cnt; i++) {
- if (stmt->vars[i]) {
- stmt->is_null[i] = (stmt->vars[i]->type == IS_NULL);
-
- switch (stmt->stmt->params[i].buffer_type) {
- case MYSQL_TYPE_VAR_STRING:
- convert_to_string_ex(&stmt->vars[i]);
- stmt->stmt->params[i].buffer = Z_STRVAL_PP(&stmt->vars[i]);
- stmt->stmt->params[i].buffer_length = strlen(Z_STRVAL_PP(&stmt->vars[i]));
- break;
- case MYSQL_TYPE_DOUBLE:
- convert_to_double_ex(&stmt->vars[i]);
- stmt->stmt->params[i].buffer = (gptr)&Z_LVAL_PP(&stmt->vars[i]);
- break;
- case MYSQL_TYPE_LONG:
- convert_to_long_ex(&stmt->vars[i]);
- stmt->stmt->params[i].buffer = (gptr)&Z_LVAL_PP(&stmt->vars[i]);
- break;
- default:
- break;
- }
- }
- }
- }
-
- RETURN_LONG(mysql_execute(stmt->stmt));
-}
-/* }}} */
-
-/* {{{ proto int mysqli_fetch(resource stmt)
- Fetch results from a prepared statement into the bound variables */
-PHP_FUNCTION(mysqli_fetch)
-{
- STMT *stmt;
- zval *mysql_stmt;
- unsigned int i;
- ulong ret;
- PR_STMT *prstmt;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
-
- /* reset buffers */
-
-
- for (i = 0; i < stmt->var_cnt; i++) {
- if (stmt->bind[i].type == IS_STRING) {
- memset(stmt->bind[i].buffer, 0, stmt->bind[i].buflen);
- }
- }
-
- if (!(ret = mysql_fetch(stmt->stmt))) {
-
- for (i = 0; i < stmt->var_cnt; i++) {
- if (!stmt->is_null[i]) {
- switch (stmt->bind[i].type) {
- case IS_LONG:
- stmt->vars[i]->type = IS_LONG;
- break;
- case IS_DOUBLE:
- stmt->vars[i]->type = IS_DOUBLE;
- break;
- case IS_STRING:
- if (stmt->stmt->bind[i].buffer_type == MYSQL_TYPE_LONGLONG) {
- char tmp[50];
- my_ulonglong lval;
- memcpy (&lval, stmt->bind[i].buffer, sizeof(my_ulonglong));
- if (lval != (long)lval) {
- /* even though lval is declared as unsigned, the value
- * may be negative. Therefor we cannot use %llu and must
- * user %lld.
- */
- sprintf((char *)&tmp, "%lld", lval);
- ZVAL_STRING(stmt->vars[i], tmp, 1);
- } else {
- ZVAL_LONG(stmt->vars[i], lval);
- }
- } else {
- if (stmt->vars[i]->type == IS_STRING) {
- efree(stmt->vars[i]->value.str.val);
- }
- ZVAL_STRING(stmt->vars[i], stmt->bind[i].buffer, 1);
- }
- break;
- default:
- break;
- }
- } else {
- stmt->vars[i]->type = IS_NULL;
- }
- }
- }
-
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto int mysqli_fetch_field (resource result)
- Get column information from a result and return as an object */
-PHP_FUNCTION(mysqli_fetch_field)
-{
- MYSQL_RES *result;
- zval *mysql_result;
- MYSQL_FIELD *field;
- PR_RESULT *prresult;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
- return;
- }
-
- MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, prresult, PR_RESULT *, &mysql_result, "mysqli_result");
-
- if (!(field = mysql_fetch_field(result))) {
- RETURN_FALSE;
- }
-
- object_init(return_value);
-
- add_property_string(return_value, "name",(field->name ? field->name : ""), 1);
- add_property_string(return_value, "orgname",(field->org_name ? field->org_name : ""), 1);
- add_property_string(return_value, "table",(field->table ? field->table : ""), 1);
- add_property_string(return_value, "orgtable",(field->org_table ? field->org_table : ""), 1);
- add_property_string(return_value, "def",(field->def ? field->def : ""), 1);
- add_property_long(return_value, "max_length", field->max_length);
- add_property_long(return_value, "flags", field->flags);
- add_property_long(return_value, "type", field->type);
- add_property_long(return_value, "decimals", field->decimals);
-}
-/* }}} */
-
-/* {{{ proto int mysqli_fetch_fields (resource result)
- Return array of objects containing field meta-data */
-PHP_FUNCTION(mysqli_fetch_fields)
-{
- MYSQL_RES *result;
- zval *mysql_result;
- MYSQL_FIELD *field;
- zval *obj;
- PR_RESULT *prresult;
-
- unsigned int i;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
- return;
- }
-
- MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, prresult, PR_RESULT *, &mysql_result, "mysqli_result");
-
- if (!(field = mysql_fetch_field(result))) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- for (i = 0; i < mysql_num_fields(result); i++) {
- field = mysql_fetch_field_direct(result, i);
-
-
- MAKE_STD_ZVAL(obj);
- object_init(obj);
-
- add_property_string(obj, "name",(field->name ? field->name : ""), 1);
- add_property_string(obj, "orgname",(field->org_name ? field->org_name : ""), 1);
- add_property_string(obj, "table",(field->table ? field->table : ""), 1);
- add_property_string(obj, "orgtable",(field->org_table ? field->org_table : ""), 1);
- add_property_string(obj, "def",(field->def ? field->def : ""), 1);
- add_property_long(obj, "max_length", field->max_length);
- add_property_long(obj, "flags", field->flags);
- add_property_long(obj, "type", field->type);
- add_property_long(obj, "decimals", field->decimals);
-
- add_index_zval(return_value, i, obj);
- }
-}
-/* }}} */
-
-/* {{{ proto int mysqli_fetch_field_direct (resource result, int offset)
- Fetch meta-data for a single field */
-PHP_FUNCTION(mysqli_fetch_field_direct)
-{
- MYSQL_RES *result;
- zval *mysql_result;
- MYSQL_FIELD *field;
- int offset;
- PR_RESULT *prresult;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
- return;
- }
-
- MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, prresult, PR_RESULT *, &mysql_result, "mysqli_result");
-
- if (!(field = mysql_fetch_field_direct(result,offset))) {
- RETURN_FALSE;
- }
-
- object_init(return_value);
-
- add_property_string(return_value, "name",(field->name ? field->name : ""), 1);
- add_property_string(return_value, "orgname",(field->org_name ? field->org_name : ""), 1);
- add_property_string(return_value, "table",(field->table ? field->table : ""), 1);
- add_property_string(return_value, "orgtable",(field->org_table ? field->org_table : ""), 1);
- add_property_string(return_value, "def",(field->def ? field->def : ""), 1);
- add_property_long(return_value, "max_length", field->max_length);
- add_property_long(return_value, "flags", field->flags);
- add_property_long(return_value, "type", field->type);
- add_property_long(return_value, "decimals", field->decimals);
-}
-/* }}} */
-
-/* {{{ proto array mysqli_fetch_lengths (resource result)
- Get the length of each output in a result */
-PHP_FUNCTION(mysqli_fetch_lengths)
-{
- MYSQL_RES *result;
- zval *mysql_result;
- unsigned int i;
- unsigned long *ret;
- PR_RESULT *prresult;
-
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
- return;
- }
-
- MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, prresult, PR_RESULT *, &mysql_result, "mysqli_result");
-
- if (!(ret = mysql_fetch_lengths(result))) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- for (i = 0; i < mysql_num_fields(result); i++) {
- add_index_long(return_value, i, ret[i]);
- }
-}
-/* }}} */
-
-/* {{{ proto array mysqli_fetch_row (resource result)
- Get a result row as an enumerated array */
-PHP_FUNCTION(mysqli_fetch_row)
-{
- php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQLI_NUM);
-}
-/* }}} */
-
-/* {{{ proto int mysqli_field_count(resource link)
- Fetch the number of fields returned by the last query for the given link
-*/
-PHP_FUNCTION(mysqli_field_count)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- RETURN_LONG(mysql_field_count(mysql));
-}
-/* }}} */
-
-/* {{{ proto int mysqli_field_seek(resource link, int fieldnr)
- Set result pointer to a specified field offset
-*/
-PHP_FUNCTION(mysqli_field_seek)
-{
- MYSQL_RES *result;
- zval *mysql_result;
- unsigned int fieldnr;
- PR_RESULT *prresult;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &fieldnr) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, prresult, PR_RESULT *, &mysql_result, "mysqli_result");
-
- if (fieldnr < 0 || fieldnr >= mysql_num_fields(result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field offset is invalid for resultset");
- RETURN_FALSE;
- }
-
- mysql_field_seek(result, fieldnr);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mysqli_field_tell(resource result)
- Get current field offset of result pointer */
-PHP_FUNCTION(mysqli_field_tell)
-{
- MYSQL_RES *result;
- zval *mysql_result;
- PR_RESULT *prresult;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, prresult, PR_RESULT *, &mysql_result, "mysqli_result");
-
- RETURN_LONG(mysql_field_tell(result));
-}
-/* }}} */
-
-/* {{{ proto int mysqli_free_result(resource result)
- Free query result memory for the given result handle */
-PHP_FUNCTION(mysqli_free_result)
-{
- MYSQL_RES *result;
- zval *mysql_result;
- PR_RESULT *prresult;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, prresult, PR_RESULT *, &mysql_result, "mysqli_result");
-
- mysql_free_result(result);
- if (MyG(profiler)) {
- prresult->closed = 1;
- }
- MYSQLI_CLEAR_RESOURCE(&mysql_result);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string mysqli_get_client_info(void)
- Get MySQL client info */
-PHP_FUNCTION(mysqli_get_client_info)
-{
- RETURN_STRING((char *)mysql_get_client_info(), 1);
-}
-/* }}} */
-
-/* {{{ proto string mysqli_get_host_info (resource link)
- Get MySQL host info */
-PHP_FUNCTION(mysqli_get_host_info)
-{
- MYSQL *mysql;
- zval *mysql_link = NULL;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- RETURN_STRING((char *)mysql_get_host_info(mysql), 1);
-}
-/* }}} */
-
-/* {{{ proto int mysqli_get_proto_info
- Get MySQL protocol information */
-PHP_FUNCTION(mysqli_get_proto_info)
-{
- MYSQL *mysql;
- zval *mysql_link = NULL;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- RETURN_LONG(mysql_get_proto_info(mysql));
-}
-/* }}} */
-
-/* {{{ proto string mysqli_get_server_info(resource link)
- Get MySQL server info */
-PHP_FUNCTION(mysqli_get_server_info)
-{
- MYSQL *mysql;
- zval *mysql_link = NULL;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- RETURN_STRING((char *)mysql_get_server_info(mysql), 1);
-}
-
-/* }}} */
-
-/* {{{ proto int mysqli_get_server_version(resource link)
- Return the MySQL version for the server referenced by the given link */
-PHP_FUNCTION(mysqli_get_server_version)
-{
- MYSQL *mysql;
- zval *mysql_link = NULL;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- RETURN_LONG(mysql_get_server_version(mysql));
-}
-
-/* }}} */
-
-/* {{{ proto string mysqli_info(resource link)
- Get information about the most recent query */
-PHP_FUNCTION(mysqli_info)
-{
- MYSQL *mysql;
- char *info = NULL;
- zval *mysql_link = NULL;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- if (!(info = (char *)mysql_info(mysql))) {
- RETURN_FALSE;
- }
-
- RETURN_STRING(info, 1);
-}
-/* }}} */
-
-/* {{{ proto resource mysqli_init(void)
- Initialize mysqli and return a resource for use with mysql_real_connect */
-PHP_FUNCTION(mysqli_init)
-{
- MYSQLI_RESOURCE *mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
- mysqli_resource->ptr = (void *)mysql_init(NULL);
- MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_link_class_entry);
-}
-/* }}} */
-
-/* {{{ proto mixed mysqli_insert_id(resource link)
- Get the ID generated from the previous INSERT operation */
-PHP_FUNCTION(mysqli_insert_id)
-{
- MYSQL *mysql;
- my_ulonglong rc;
- zval *mysql_link;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
- rc = mysql_insert_id(mysql);
- MYSQLI_RETURN_LONG_LONG(rc)
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_kill(resource link, int processid)
- Kill a mysql process on the server */
-PHP_FUNCTION(mysqli_kill)
-{
- MYSQL *mysql;
- zval *mysql_link;
- int processid;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- if (mysql_kill(mysql, processid)) {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_master_query(resource link, string query)
- Enforce execution of a query on the master in a master/slave setup */
-PHP_FUNCTION(mysqli_master_query) {
- MYSQL *mysql;
- zval *mysql_link;
- char *query = NULL;
- unsigned int query_len;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- if (mysql_master_query(mysql, query, query_len)) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mysqli_num_fields(resource result)
- Get number of fields in result */
-PHP_FUNCTION(mysqli_num_fields)
-{
- MYSQL_RES *result;
- zval *mysql_result;
- PR_RESULT *prresult;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, prresult, PR_RESULT *, &mysql_result, "mysqli_result");
-
-
- RETURN_LONG(mysql_num_fields(result));
-}
-/* }}} */
-
-/* {{{ proto int mysqli_num_rows(resource result)
- Get number of rows in result */
-PHP_FUNCTION(mysqli_num_rows)
-{
- MYSQL_RES *result;
- zval *mysql_result;
- PR_RESULT *prresult;
- PR_COMMAND *prcommand;
- ulong rc;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, prresult, PR_RESULT *, &mysql_result, "mysqli_result");
-
- if (result->handle && result->handle->status == MYSQL_STATUS_USE_RESULT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function cannot be used with MYSQL_USE_RESULT");
- RETURN_LONG(0);
- }
-
- MYSQLI_PROFILER_COMMAND_START(prcommand, prresult);
- rc = mysql_num_rows(result);
- MYSQLI_PROFILER_COMMAND_RETURNLONG(prcommand, rc);
- RETURN_LONG(rc);
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_options(resource link, int flags, mixed values)
- Set options */
-PHP_FUNCTION(mysqli_options)
-{
- MYSQL *mysql;
- zval *mysql_link = NULL;
- zval *mysql_value;
- long mysql_option;
- unsigned int l_value;
- long ret;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oslz", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- switch (Z_TYPE_PP(&mysql_value)) {
- case IS_STRING:
- ret = mysql_options(mysql, mysql_option, Z_STRVAL_PP(&mysql_value));
- break;
- default:
- convert_to_long_ex(&mysql_value);
- l_value = Z_LVAL_PP(&mysql_value);
- ret = mysql_options(mysql, mysql_option, (char *)&l_value);
- break;
- }
-
- if (ret != 0) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto int mysqli_param_count(resource stmt) {
- Return the number of parameter for the given statement */
-PHP_FUNCTION(mysqli_param_count)
-{
- STMT *stmt;
- zval *mysql_stmt;
- PR_STMT *prstmt;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
-
- RETURN_LONG(mysql_param_count(stmt->stmt));
-}
-/* }}} */
-
-/* {{{ proto int mysqli_ping(resource link)
- Ping a server connection or reconnect if there is no connection */
-PHP_FUNCTION(mysqli_ping)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
- RETURN_LONG(mysql_ping(mysql));
-}
-/* }}} */
-
-/* {{{ proto resource mysqli_prepare(resource link, string query)
- Prepare a SQL statement for execution */
-PHP_FUNCTION(mysqli_prepare)
-{
- MYSQL *mysql;
- STMT *stmt;
- PR_MYSQL *prmysql;
- PR_STMT *prstmt;
- char *query = NULL;
- unsigned int query_len;
- zval *mysql_link;
- MYSQLI_RESOURCE *mysqli_resource;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os",&mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- stmt = (STMT *)ecalloc(1,sizeof(STMT));
- stmt->var_cnt = 0;
-
- /* profiling information */
- if (MyG(profiler)) {
- prstmt = (PR_STMT *)MYSQLI_PROFILER_NEW(prmysql, MYSQLI_PR_STMT, 1);
- prstmt->explain.query = my_estrdup(query);
- if (!strncasecmp("select", query, 6)){
- if (!(MYSQLI_PROFILER_EXPLAIN(&prstmt->explain, &prstmt->header, mysql, query))) {
- RETURN_FALSE;
- }
- }
- }
- stmt->stmt = mysql_prepare(mysql, query, query_len);
-
- if (MyG(profiler)) {
- MYSQLI_PROFILER_ELAPSEDTIME(prstmt);
- if (!stmt->stmt) {
- prstmt->header.error = mysql_errno(mysql);
- prstmt->header.errormsg = my_estrdup(mysql_error(mysql));
- } else {
- prstmt->param_cnt = mysql_param_count(stmt->stmt);
- prstmt->field_cnt = stmt->stmt->field_count;
- }
- }
-
- if (!stmt->stmt) {
- efree(stmt);
- RETURN_FALSE;
- }
-
- mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
- mysqli_resource->ptr = (void *)stmt;
- MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_stmt_class_entry);
-}
-/* }}} */
-
-/* {{{ proto resource mysqli_prepare_result(resource stmt)
- */
-PHP_FUNCTION(mysqli_prepare_result)
-{
- STMT *stmt;
- MYSQL_RES *result;
- zval *mysql_stmt;
- PR_STMT *prstmt = NULL;
- MYSQLI_RESOURCE *mysqli_resource;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
-
- if (!(result = mysql_prepare_result(stmt->stmt))){
- RETURN_FALSE;
- }
-
- mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
- mysqli_resource->ptr = (void *)result;
- mysqli_resource->prinfo = (void *)prstmt;
- MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry);
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_read_query_result(resource link)
-*/
-PHP_FUNCTION(mysqli_read_query_result)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- if (mysql_read_query_result(mysql)) {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_real_connect(resource link [,string hostname [,string username [,string passwd [,string dbname [,int port [,string socket [,int flags]]]]]]])
- Open a connection to a mysql server */
-PHP_FUNCTION(mysqli_real_connect)
-{
- MYSQL *mysql;
- char *hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL;
- unsigned int hostname_len, username_len, passwd_len, dbname_len, socket_len;
- unsigned int port=0, flags=0;
- zval *mysql_link;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|sssslsl", &mysql_link, mysqli_link_class_entry,
- &hostname, &hostname_len, &username, &username_len, &passwd, &passwd_len, &dbname, &dbname_len, &port, &socket, &socket_len,
- &flags) == FAILURE) {
- return;
- }
-
- if (!socket_len) {
- socket = NULL;
- }
-
- /* TODO: safe mode handling */
- if (PG(sql_safe_mode)) {
- } else {
- if (!passwd) {
- passwd = MyG(default_pw);
- if (!username){
- username = MyG(default_user);
- if (!hostname) {
- hostname = MyG(default_host);
- }
- }
- }
- }
-
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- if (mysql_real_connect(mysql,hostname,username,passwd,dbname,port,socket,flags) == NULL) {
- /* Save error messages */
- php_mysqli_set_error(mysql_errno(mysql), (char *)mysql_error(mysql) TSRMLS_CC);
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", mysql_error(mysql));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_real_query(resource link, string query)
- Binary-safe version of mysql_query() */
-PHP_FUNCTION(mysqli_real_query)
-{
- MYSQL *mysql;
- zval *mysql_link;
- char *query = NULL;
- unsigned int query_len;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- if (mysql_real_query(mysql, query, query_len)) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string mysqli_real_escape_string(resource link, string escapestr)
- Escapes special characters in a string for use in a SQL statement, taking into account the current charset of the connection */
-PHP_FUNCTION(mysqli_real_escape_string) {
- MYSQL *mysql;
- zval *mysql_link = NULL;
- char *escapestr, *newstr;
- int escapestr_len, newstr_len;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &escapestr, &escapestr_len) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- newstr = emalloc(2 * escapestr_len + 1);
- newstr_len = mysql_real_escape_string(mysql, newstr, escapestr, escapestr_len);
- newstr = erealloc(newstr, newstr_len + 1);
-
- RETURN_STRING(newstr, 0);
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_reload (resource link)
-*/
-PHP_FUNCTION(mysqli_reload)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- RETURN_BOOL(!mysql_reload(mysql));
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_rollback(resource link)
- Undo actions from current transaction */
-PHP_FUNCTION(mysqli_rollback)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- RETURN_BOOL(mysql_rollback(mysql));
-}
-/* }}} */
-
-/* {{{ proto int mysqli_rpl_parse_enabled(resource link)
-*/
-PHP_FUNCTION(mysqli_rpl_parse_enabled)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- RETURN_LONG(mysql_rpl_parse_enabled(mysql));
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_rpl_probe(resource link)
-*/
-PHP_FUNCTION(mysqli_rpl_probe)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
-
- if (mysql_rpl_probe(mysql)) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mysqli_rpl_query_type(string query)
-*/
-PHP_FUNCTION(mysqli_rpl_query_type)
-{
- MYSQL *mysql;
- zval *mysql_link;
- char *query;
- int query_len;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- RETURN_LONG(mysql_rpl_query_type(query, query_len));
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_send_long_data(resource stmt, int param_nr, string data)
-*/
-PHP_FUNCTION(mysqli_send_long_data)
-{
- STMT *stmt;
- zval *mysql_stmt;
- PR_STMT *prstmt;
- char *data;
- long param_nr, data_len;
-
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &mysql_stmt, mysqli_stmt_class_entry, &param_nr, &data, &data_len) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
-
- if (!param_nr) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter number");
- RETURN_FALSE;
- }
- param_nr--;
-
- if (mysql_send_long_data(stmt->stmt, param_nr, data, data_len)) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_send_query(resource link, string query)
-*/
-PHP_FUNCTION(mysqli_send_query)
-{
- MYSQL *mysql;
- zval *mysql_link;
- char *query = NULL;
- unsigned int query_len;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- if (mysql_send_query(mysql, query, query_len)) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_slave_query(resource link, string query)
- Enforce execution of a query on a slave in a master/slave setup */
-PHP_FUNCTION(mysqli_slave_query)
-{
- MYSQL *mysql;
- zval *mysql_link;
- char *query = NULL;
- unsigned int query_len;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- if (mysql_slave_query(mysql, query, query_len)) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto mixed mysqli_stmt_affected_rows(resource stmt)
- Return the number of rows affected in the last query for the given link */
-PHP_FUNCTION(mysqli_stmt_affected_rows)
-{
- STMT *stmt;
- zval *mysql_stmt;
- my_ulonglong rc;
- PR_STMT *prstmt;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
-
- rc = mysql_stmt_affected_rows(stmt->stmt);
- MYSQLI_RETURN_LONG_LONG(rc)
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_stmt_close(resource stmt)
- Close statement */
-PHP_FUNCTION(mysqli_stmt_close)
-{
- STMT *stmt;
- zval *mysql_stmt;
- PR_STMT *prstmt;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
- mysql_stmt_close(stmt->stmt);
- stmt->stmt = NULL;
- php_clear_stmt_bind(stmt);
- MYSQLI_CLEAR_RESOURCE(&mysql_stmt);
- RETURN_TRUE;
-
-}
-/* }}} */
-
-/* {{{ proto string mysqli_select_db(resource link, string dbname)
- Select a MySQL database */
-PHP_FUNCTION(mysqli_select_db)
-{
- MYSQL *mysql;
- zval *mysql_link;
- char *dbname;
- int dbname_len;
- PR_MYSQL *prmysql;
-
-// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os", &mysql_link, mysqli_link_class_entry, &dbname, &dbname_len) == FAILURE) {
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &dbname, &dbname_len) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- if (!mysql_select_db(mysql, dbname)) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string mysqli_ssl_set(resource link [,string key [,string cert [,string ca [,string capath [,string cipher]]]]])
-*/
-PHP_FUNCTION(mysqli_ssl_set)
-{
- MYSQL *mysql;
- zval *mysql_link;
- char *key=NULL, *cert=NULL, *ca=NULL, *capath=NULL, *cipher=NULL;
- int key_len, cert_len, ca_len, capath_len, cipher_len;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osssss", &mysql_link, mysqli_link_class_entry,
- &key, &key_len, &cert, &cert_len, &ca, &ca_len, &capath, &capath_len, &cipher, &cipher_len) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- mysql_ssl_set(mysql, key, cert, ca, capath, cipher);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string mysqli_stat(resource link)
- Get current system status */
-PHP_FUNCTION(mysqli_stat)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- RETURN_STRING((char *)mysql_stat(mysql), 1);
-}
-
-/* }}} */
-
-/* {{{ proto int mysqli_stmt_errno(resource stmt)
-*/
-PHP_FUNCTION(mysqli_stmt_errno)
-{
- STMT *stmt;
- zval *mysql_stmt;
- PR_STMT *prstmt;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
-
- RETURN_LONG(mysql_stmt_errno(stmt->stmt));
-}
-/* }}} */
-
-/* {{{ proto string mysqli_stmt_error(resource stmt)
-*/
-PHP_FUNCTION(mysqli_stmt_error)
-{
- STMT *stmt;
- zval *mysql_stmt;
- PR_STMT *prstmt;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
-
- RETURN_STRING((char *)mysql_stmt_error(stmt->stmt),1);
-}
-/* }}} */
-
-/* {{{ proto resource mysqli_stmt_store_result(stmt)
-*/
-PHP_FUNCTION(mysqli_stmt_store_result)
-{
- STMT *stmt;
- zval *mysql_stmt;
- PR_STMT *prstmt;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
-
- if (mysql_stmt_store_result(stmt->stmt)){
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto resource mysqli_store_result(resource link)
- Buffer result set on client */
-PHP_FUNCTION(mysqli_store_result)
-{
- MYSQL *mysql;
- MYSQL_RES *result;
- zval *mysql_link;
- PR_MYSQL *prmysql;
- MYSQLI_RESOURCE *mysqli_resource;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- if (!(result = mysql_store_result(mysql))) {
- RETURN_FALSE;
- }
- mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
- mysqli_resource->ptr = (void *)result;
- MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry);
-}
-/* }}} */
-
-/* {{{ proto int mysqli_thread_id(resource link)
- Return the current thread ID */
-PHP_FUNCTION(mysqli_thread_id)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- RETURN_LONG(mysql_thread_id(mysql));
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_thread_safe(void)
- Return whether thread safety is given or not */
-PHP_FUNCTION(mysqli_thread_safe)
-{
- RETURN_BOOL(mysql_thread_safe());
-}
-
-/* }}} */
-
-/* {{{ proto resource mysqli_use_result(resource link)
- Directly retrieve query results - do not buffer results on client side */
-PHP_FUNCTION(mysqli_use_result)
-{
- MYSQL *mysql;
- MYSQL_RES *result;
- zval *mysql_link;
- PR_MYSQL *prmysql;
- MYSQLI_RESOURCE *mysqli_resource;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- if (!(result = mysql_use_result(mysql))) {
- RETURN_FALSE;
- }
- mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
- mysqli_resource->ptr = (void *)result;
- MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry);
-}
-/* }}} */
-
-/* {{{ proto resource mysqli_warning_count (resource link)
- Return number of warnings from the last query for the given link */
-PHP_FUNCTION(mysqli_warning_count)
-{
- MYSQL *mysql;
- zval *mysql_link;
- PR_MYSQL *prmysql;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- RETURN_LONG(mysql_warning_count(mysql));
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/mysqli/mysqli_fe.c b/ext/mysqli/mysqli_fe.c
deleted file mode 100644
index 82e4a681b2..0000000000
--- a/ext/mysqli/mysqli_fe.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2002 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Georg Richter <georg@php.net> |
- +----------------------------------------------------------------------+
-
- $Id$
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <signal.h>
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_mysqli.h"
-
-
-/* {{{ mysqli_functions[]
- *
- * Every user visible function must have an entry in mysqli_functions[].
- */
-function_entry mysqli_functions[] = {
- PHP_FE(mysqli_affected_rows, NULL)
- PHP_FE(mysqli_autocommit, NULL)
- PHP_FE(mysqli_bind_param, NULL)
- PHP_FE(mysqli_bind_result, NULL)
- PHP_FE(mysqli_change_user, NULL)
- PHP_FE(mysqli_character_set_name, NULL)
- PHP_FALIAS(mysqli_client_encoding,
- mysqli_character_set_name, NULL)
- PHP_FE(mysqli_close, NULL)
- PHP_FE(mysqli_commit, NULL)
- PHP_FE(mysqli_connect, NULL)
- PHP_FE(mysqli_data_seek, NULL)
- PHP_FE(mysqli_debug, NULL)
- PHP_FE(mysqli_disable_reads_from_master, NULL)
- PHP_FE(mysqli_disable_rpl_parse, NULL)
- PHP_FE(mysqli_dump_debug_info, NULL)
- PHP_FE(mysqli_enable_reads_from_master, NULL)
- PHP_FE(mysqli_enable_rpl_parse, NULL)
- PHP_FE(mysqli_errno, NULL)
- PHP_FE(mysqli_error, NULL)
- PHP_FE(mysqli_execute, NULL)
- PHP_FE(mysqli_fetch, NULL)
- PHP_FE(mysqli_fetch_field, NULL)
- PHP_FE(mysqli_fetch_fields, NULL)
- PHP_FE(mysqli_fetch_field_direct, NULL)
- PHP_FE(mysqli_fetch_lengths, NULL)
- PHP_FE(mysqli_fetch_array, NULL)
- PHP_FE(mysqli_fetch_assoc, NULL)
- PHP_FE(mysqli_fetch_object, NULL)
- PHP_FE(mysqli_fetch_row, NULL)
- PHP_FE(mysqli_field_count, NULL)
- PHP_FE(mysqli_field_seek, NULL)
- PHP_FE(mysqli_field_tell, NULL)
- PHP_FE(mysqli_free_result, NULL)
- PHP_FE(mysqli_get_client_info, NULL)
- PHP_FE(mysqli_get_host_info, NULL)
- PHP_FE(mysqli_get_proto_info, NULL)
- PHP_FE(mysqli_get_server_info, NULL)
- PHP_FE(mysqli_get_server_version, NULL)
- PHP_FE(mysqli_init, NULL)
- PHP_FE(mysqli_info, NULL)
- PHP_FE(mysqli_insert_id, NULL)
- PHP_FE(mysqli_kill, NULL)
- PHP_FE(mysqli_master_query, NULL)
- PHP_FE(mysqli_num_fields, NULL)
- PHP_FE(mysqli_num_rows, NULL)
- PHP_FE(mysqli_options, NULL)
- PHP_FE(mysqli_param_count, NULL)
- PHP_FE(mysqli_ping, NULL)
- PHP_FE(mysqli_prepare, NULL)
- PHP_FE(mysqli_prepare_result, NULL)
- PHP_FE(mysqli_profiler, NULL)
- PHP_FE(mysqli_query, NULL)
- PHP_FE(mysqli_read_query_result, NULL)
- PHP_FE(mysqli_real_connect, NULL)
- PHP_FE(mysqli_real_escape_string, NULL)
- PHP_FALIAS(mysqli_escape_string,
- mysqli_real_escape_string, NULL)
- PHP_FE(mysqli_real_query, NULL)
- PHP_FE(mysqli_reload, NULL)
- PHP_FE(mysqli_rollback, NULL)
- PHP_FE(mysqli_rpl_parse_enabled, NULL)
- PHP_FE(mysqli_rpl_probe, NULL)
- PHP_FE(mysqli_rpl_query_type, NULL)
- PHP_FE(mysqli_select_db, NULL)
- PHP_FE(mysqli_send_long_data, NULL)
- PHP_FE(mysqli_send_query, NULL)
- PHP_FALIAS(mysqli_set_opt, mysqli_options, NULL)
- PHP_FE(mysqli_slave_query, NULL)
- PHP_FE(mysqli_ssl_set, NULL)
- PHP_FE(mysqli_stat, NULL)
- PHP_FE(mysqli_stmt_affected_rows, NULL)
- PHP_FE(mysqli_stmt_close, NULL)
- PHP_FE(mysqli_stmt_errno, NULL)
- PHP_FE(mysqli_stmt_error, NULL)
- PHP_FE(mysqli_store_result, NULL)
- PHP_FE(mysqli_stmt_store_result, NULL)
- PHP_FE(mysqli_thread_id, NULL)
- PHP_FE(mysqli_thread_safe, NULL)
- PHP_FE(mysqli_use_result, NULL)
- PHP_FE(mysqli_warning_count, NULL)
- {NULL, NULL, NULL} /* Must be the last line in mysqli_functions[] */
-};
-/* }}} */
-
-/* {{{ mysqli_link_methods[]
- *
- * Every user visible function must have an entry in mysqli_functions[].
- */
-function_entry mysqli_link_methods[] = {
- PHP_FALIAS(affected_rows,mysqli_affected_rows,NULL)
- PHP_FALIAS(autocommit,mysqli_autocommit,NULL)
- PHP_FALIAS(change_user,mysqli_change_user,NULL)
- PHP_FALIAS(character_set_name,mysqli_character_set_name,NULL)
- PHP_FALIAS(client_encoding, mysqli_character_set_name,NULL)
- PHP_FALIAS(close,mysqli_close,NULL)
- PHP_FALIAS(commit,mysqli_commit,NULL)
- PHP_FALIAS(connect,mysqli_connect,NULL)
- PHP_FALIAS(debug,mysqli_debug,NULL)
- PHP_FALIAS(disable_reads_from_master,mysqli_disable_reads_from_master,NULL)
- PHP_FALIAS(disable_rpl_parse,mysqli_disable_rpl_parse,NULL)
- PHP_FALIAS(dump_debug_info,mysqli_dump_debug_info,NULL)
- PHP_FALIAS(enable_reads_from_master,mysqli_enable_reads_from_master,NULL)
- PHP_FALIAS(enable_rpl_parse,mysqli_enable_rpl_parse,NULL)
- PHP_FALIAS(errno,mysqli_errno,NULL)
- PHP_FALIAS(error,mysqli_error,NULL)
- PHP_FALIAS(get_client_info,mysqli_get_client_info,NULL)
- PHP_FALIAS(get_host_info,mysqli_get_host_info,NULL)
- PHP_FALIAS(get_proto_info,mysqli_get_proto_info,NULL)
- PHP_FALIAS(get_server_info,mysqli_get_server_info,NULL)
- PHP_FALIAS(get_server_version,mysqli_get_server_version,NULL)
- PHP_FALIAS(init,mysqli_init,NULL)
- PHP_FALIAS(info,mysqli_info,NULL)
- PHP_FALIAS(insert_id,mysqli_insert_id,NULL)
- PHP_FALIAS(kill,mysqli_kill,NULL)
- PHP_FALIAS(master_query,mysqli_master_query,NULL)
- PHP_FALIAS(options,mysqli_options,NULL)
- PHP_FALIAS(ping,mysqli_ping,NULL)
- PHP_FALIAS(prepare,mysqli_prepare,NULL)
- PHP_FALIAS(query,mysqli_query,NULL)
- PHP_FALIAS(read_query_result,mysqli_read_query_result,NULL)
- PHP_FALIAS(real_connect,mysqli_real_connect,NULL)
- PHP_FALIAS(real_escape_string,mysqli_real_escape_string,NULL)
- PHP_FALIAS(escape_string, mysqli_real_escape_string,NULL)
- PHP_FALIAS(real_query,mysqli_real_query,NULL)
- PHP_FALIAS(reload,mysqli_reload,NULL)
- PHP_FALIAS(rollback,mysqli_rollback,NULL)
- PHP_FALIAS(rpl_parse_enabled,mysqli_rpl_parse_enabled,NULL)
- PHP_FALIAS(rpl_probe,mysqli_rpl_probe,NULL)
- PHP_FALIAS(rpl_query_type,mysqli_rpl_query_type,NULL)
- PHP_FALIAS(select_db,mysqli_select_db,NULL)
- PHP_FALIAS(set_opt, mysqli_options,NULL)
- PHP_FALIAS(slave_query,mysqli_slave_query,NULL)
- PHP_FALIAS(ssl_set,mysqli_ssl_set,NULL)
- PHP_FALIAS(stat,mysqli_stat,NULL)
- PHP_FALIAS(store_result,mysqli_store_result,NULL)
- PHP_FALIAS(thread_id, mysqli_thread_id,NULL)
- PHP_FALIAS(thread_safe,mysqli_thread_safe,NULL)
- PHP_FALIAS(use_result,mysqli_use_result,NULL)
- PHP_FALIAS(warning_count,mysqli_warning_count,NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ mysqli_result_methods[]
- *
- * Every user visible function must have an entry in mysqli_result_functions[].
- */
-function_entry mysqli_result_methods[] = {
- PHP_FALIAS(close,mysqli_free_result,NULL)
- PHP_FALIAS(free,mysqli_free_result,NULL)
- PHP_FALIAS(data_seek,mysqli_data_seek,NULL)
- PHP_FALIAS(fetch_field,mysqli_fetch_field,NULL)
- PHP_FALIAS(fetch_fields,mysqli_fetch_fields,NULL)
- PHP_FALIAS(fetvh_field_direct,mysqli_fetch_field_direct,NULL)
- PHP_FALIAS(fetch_lengths,mysqli_fetch_lengths,NULL)
- PHP_FALIAS(fetch_array,mysqli_fetch_array,NULL)
- PHP_FALIAS(fetch_assoc,mysqli_fetch_assoc,NULL)
- PHP_FALIAS(fetch_object,mysqli_fetch_object,NULL)
- PHP_FALIAS(fetch_row,mysqli_fetch_row,NULL)
- PHP_FALIAS(field_count,mysqli_field_count,NULL)
- PHP_FALIAS(field_seek,mysqli_field_seek,NULL)
- PHP_FALIAS(field_tell,mysqli_field_tell,NULL)
- PHP_FALIAS(free_result,mysqli_free_result,NULL)
- PHP_FALIAS(num_fields,mysqli_num_fields,NULL)
- PHP_FALIAS(num_rows,mysqli_num_rows,NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ mysqli_stmt_methods[]
- *
- * Every user visible function must have an entry in mysqli_stmt_functions[].
- */
-function_entry mysqli_stmt_methods[] = {
- PHP_FALIAS(affected_rows,mysqli_stmt_affected_rows,NULL)
- PHP_FALIAS(bind_param,mysqli_bind_param,NULL)
- PHP_FALIAS(bind_result,mysqli_bind_result,NULL)
- PHP_FALIAS(execute,mysqli_execute,NULL)
- PHP_FALIAS(fetch,mysqli_fetch,NULL)
- PHP_FALIAS(param_count,mysqli_param_count,NULL)
- PHP_FALIAS(send_long_data,mysqli_send_long_data,NULL)
- PHP_FALIAS(store_result,mysqli_stmt_store_result,NULL)
- PHP_FALIAS(close,mysqli_stmt_close,NULL)
- PHP_FALIAS(errno,mysqli_stmt_errno,NULL)
- PHP_FALIAS(error,mysqli_stmt_error,NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c
deleted file mode 100644
index 6cfbac1639..0000000000
--- a/ext/mysqli/mysqli_nonapi.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Georg Richter <georg@php.net> |
- +----------------------------------------------------------------------+
-
- $Id$
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <signal.h>
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_mysqli.h"
-
-/* {{{ proto resource mysqli_connect([string hostname [,string username [,string passwd [,string dbname [,int port [,string socket]]]]]])
- Open a connection to a mysql server */
-PHP_FUNCTION(mysqli_connect)
-{
- MYSQL *mysql;
- MYSQLI_RESOURCE *mysqli_resource;
- PR_MYSQL *prmysql = NULL;
- zval *object = getThis();
- char *hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL;
- unsigned int hostname_len, username_len, passwd_len, dbname_len, socket_len;
- unsigned int port=0;
- struct timeval starttime;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssssls", &hostname, &hostname_len, &username, &username_len,
- &passwd, &passwd_len, &dbname, &dbname_len, &port, &socket, &socket_len) == FAILURE) {
- return;
- }
-
- /* TODO: safe mode handling */
- if (PG(sql_safe_mode)){
- } else {
- if (!passwd) {
- passwd = MyG(default_pw);
- if (!username){
- username = MyG(default_user);
- if (!hostname) {
- hostname = MyG(default_host);
- }
- }
- }
- }
- mysql = mysql_init(NULL);
-
- if (MyG(profiler)){
- gettimeofday(&starttime, NULL);
- }
-
- if (mysql_real_connect(mysql,hostname,username,passwd,dbname,port,socket,0) == NULL) {
- /* Save error messages */
-
- php_mysqli_set_error(mysql_errno(mysql), (char *) mysql_error(mysql) TSRMLS_CC);
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", mysql_error(mysql));
- /* free mysql structure */
- mysql_close(mysql);
- RETURN_FALSE;
- }
-
- if (MyG(profiler)) {
- prmysql = (PR_MYSQL *)MYSQLI_PROFILER_NEW(prmain, MYSQLI_PR_MYSQL, 0);
- php_mysqli_profiler_timediff(starttime, &prmysql->header.elapsedtime);
- MYSQLI_PROFILER_STARTTIME(prmysql);
- prmysql->hostname = estrdup(hostname);
- prmysql->username = estrdup(username);
- prmysql->thread_id = mysql->thread_id;
- }
-
- mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
- mysqli_resource->ptr = (void *)mysql;
- mysqli_resource->prinfo = prmysql;
-
-
- if (!object) {
- MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_link_class_entry);
- } else {
- ((mysqli_object *) zend_object_store_get_object(object TSRMLS_CC))->ptr = mysqli_resource;
- }
-}
-/* }}} */
-
-/* {{{ proto array mysqli_fetch_array (resource result [,int resulttype])
- Fetch a result row as an associative array, a numeric array, or both */
-PHP_FUNCTION(mysqli_fetch_array)
-{
- php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto array mysqli_fetch_assoc (resource result)
- Fetch a result row as an associative array */
-PHP_FUNCTION(mysqli_fetch_assoc)
-{
- php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQLI_ASSOC);
-}
-/* }}} */
-
-/* {{{ proto array mysqli_fetch_object (resource result)
- Fetch a result row as an object */
-PHP_FUNCTION(mysqli_fetch_object)
-{
- php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQLI_ASSOC);
-
- if (Z_TYPE_P(return_value) == IS_ARRAY) {
- object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value));
- }
-}
-/* }}} */
-
-/* {{{ proto resource mysqli_query(resource link, string query [,int resultmode])
- Send a MySQL query */
-PHP_FUNCTION(mysqli_query) {
- MYSQL *mysql;
- zval *mysql_link;
- MYSQLI_RESOURCE *mysqli_resource;
- MYSQL_RES *result;
- PR_MYSQL *prmysql;
- PR_QUERY *prquery;
- PR_RESULT *prresult;
- char *query = NULL;
- unsigned int query_len;
- unsigned int resultmode = 0;
- struct timeval starttime;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) {
- return;
- }
- MYSQLI_FETCH_RESOURCE(mysql, MYSQL*, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link");
-
- /* profiling information */
- if (MyG(profiler)) {
- prquery = (PR_QUERY *)MYSQLI_PROFILER_NEW(prmysql, MYSQLI_PR_QUERY, 1);
- prquery->explain.query = my_estrdup(query);
- if (!strncasecmp("select", query, 6)){
- if (!(MYSQLI_PROFILER_EXPLAIN(&prquery->explain, &prquery->header, mysql, query))) {
- RETURN_FALSE;
- }
- }
- }
-
- if (mysql_real_query(mysql, query, query_len)) {
- RETURN_FALSE;
- }
-
- if (MyG(profiler)) {
- MYSQLI_PROFILER_ELAPSEDTIME(prquery);
- prquery->insertid = mysql_insert_id(mysql);
- prquery->affectedrows = mysql_affected_rows(mysql);
- }
-
- if (!mysql_field_count(mysql)) {
- RETURN_FALSE;
- }
-
- /* profiler result information */
- if (MyG(profiler)) {
- gettimeofday(&starttime, NULL);
- prresult = (PR_RESULT *)MYSQLI_PROFILER_NEW(prquery, MYSQLI_PR_RESULT, 1);
- }
-
- result = (resultmode == MYSQLI_USE_RESULT) ? mysql_use_result(mysql) : mysql_store_result(mysql);
-
- if (result && MyG(profiler)) {
- MYSQLI_PROFILER_ELAPSEDTIME(prresult);
- prresult->rows = result->row_count;
- prresult->columns = result->field_count;
- }
-
- if (!result) {
- RETURN_FALSE;
- }
-
- mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
- mysqli_resource->ptr = (void *)result;
- mysqli_resource->prinfo = (void *)prresult;
- MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/mysqli/mysqli_profiler.c b/ext/mysqli/mysqli_profiler.c
deleted file mode 100644
index c839e40c64..0000000000
--- a/ext/mysqli/mysqli_profiler.c
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Georg Richter <georg@php.net> |
- +----------------------------------------------------------------------+
-
- $Id$
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_mysqli.h"
-#include "mysqli_profiler_com.h"
-
-/* {{{ PR_COMMON *php_mysqli_profiler_new_object(PR_COMMON *parent, unsigned int type, unsigned int settime) */
-PR_COMMON *php_mysqli_profiler_new_object(PR_COMMON *parent, unsigned int type, unsigned int settime)
-{
- PR_COMMON *prnew, *child;
- TSRMLS_FETCH();
-
- switch (type) {
- case MYSQLI_PR_MYSQL:
- prnew = (PR_COMMON *)ecalloc(1, sizeof(PR_MYSQL));
- break;
- case MYSQLI_PR_QUERY:
- prnew = (PR_COMMON *)ecalloc(1, sizeof(PR_QUERY));
- break;
- case MYSQLI_PR_STMT:
- prnew = (PR_COMMON *)ecalloc(1, sizeof(PR_STMT));
- break;
- case MYSQLI_PR_COMMAND:
- prnew = (PR_COMMON *)ecalloc(1, sizeof(PR_COMMAND));
- break;
- case MYSQLI_PR_RESULT:
- prnew = (PR_COMMON *)ecalloc(1, sizeof(PR_RESULT));
- break;
- }
- prnew->header.type = type;
- prnew->header.filename = estrdup(zend_get_executed_filename(TSRMLS_C));
- prnew->header.lineno = zend_get_executed_lineno(TSRMLS_C);
- prnew->header.functionname = estrdup(get_active_function_name(TSRMLS_C));
- if (settime) {
- gettimeofday(&prnew->header.starttime, NULL);
- }
-
- if (!parent) {
- return prnew;
- }
-
- if (!parent->header.child) {
- parent->header.child = (void *)prnew;
- return (prnew);
- }
- child = parent->header.child;
- while (child->header.next != NULL) {
- child = child->header.next;
- }
- child->header.next = (void *)prnew;
- return (prnew);
-}
-/* }}} */
-
-/* {{{ int *php_mysqli_profiler_explain(PR_EXPLAIN *, PR_HEADER *, MYSQL *, char *) */
-int php_mysqli_profiler_explain(PR_EXPLAIN *explain, PR_HEADER *header, MYSQL *mysql, char *query)
-{
- MYSQL_RES *res;
- unsigned int i,j;
- MYSQL_FIELD *fields;
- MYSQL_ROW row;
- char *newquery = (char *)emalloc(strlen(query) + 10);
-
- sprintf (newquery, "EXPLAIN %s", query);
-
- mysql_real_query(mysql, newquery, strlen(newquery));
- efree (newquery);
-
- if (mysql_errno(mysql)) {
- header->error = mysql_errno(mysql);
- header->errormsg = my_estrdup(mysql_error(mysql));
- return 0;
- }
-
- res = mysql_store_result(mysql);
-
- if (!(explain->exp_cnt = mysql_num_rows(res))) {
- return 0;
- }
-
- explain->columns = mysql_num_fields(res);
-
- explain->row = (PR_ROW *)emalloc(sizeof(PR_ROW) * explain->exp_cnt);
- explain->fields = (char **)emalloc(sizeof(char *) * explain->columns);
-
- fields = mysql_fetch_fields(res);
-
- for (j=0; j < explain->columns; j++) {
- explain->fields[j] = estrdup(fields[j].name);
- }
-
- for (i=0; i < explain->exp_cnt; i++) {
- explain->row[i].value = (char **)emalloc(sizeof(char *) * explain->columns);
- row = mysql_fetch_row(res);
- for (j=0; j < explain->columns; j++) {
- explain->row[i].value[j] = my_estrdup(row[j]);
- }
- }
-
- mysql_free_result(res);
- return 1;
-}
-/* }}} */
-
-/* {{{ void php_mysqli_profiler_timediff(struct timeval, struct timeval *) */
-void php_mysqli_profiler_timediff(struct timeval starttime, struct timeval *elapsed)
-{
- struct timeval end;
-
- gettimeofday(&end, NULL);
-
- elapsed->tv_sec = end.tv_sec - starttime.tv_sec;
- elapsed->tv_usec = end.tv_usec - starttime.tv_usec;
- if (elapsed->tv_usec < 0) {
- --(elapsed->tv_sec);
- elapsed->tv_usec = 1000000;
- }
- return;
-}
-/* }}} */
-
-/* {{{ char *php_mysqli_profiler_indent(int) */
-char *php_mysqli_profiler_indent(int i)
-{
- char *ret = (char *)ecalloc(i*4+1, sizeof(char));
- memset(ret, 0x20, i*4);
- return ret;
-}
-/* }}} */
-
-/* {{{ void php_mysqli_profiler_report_header(PR_HEADER, char *, char *) */
-void php_mysqli_profiler_report_header(PR_HEADER header, char *ident)
-{
- char buffer[8192];
- switch (header.type) {
- case MYSQLI_PR_MYSQL:
- php_mysqli_profiler_timediff(header.starttime, &header.lifetime);
- break;
- case MYSQLI_PR_STMT:
- php_mysqli_profiler_timediff(header.starttime, &header.lifetime);
- break;
- case MYSQLI_PR_RESULT:
- php_mysqli_profiler_timediff(header.starttime, &header.lifetime);
- break;
- }
- MYSQLI_PROFILER_ADD_ATTR_STRING(buffer, "functionname", header.functionname);
-
- MYSQLI_PROFILER_ADD_STARTTAG(buffer, "fileinfo",0);
- MYSQLI_PROFILER_ADD_ATTR_STRING(buffer, "filename", header.filename);
- MYSQLI_PROFILER_ADD_ATTR_LONG(buffer, "line", header.lineno);
- MYSQLI_PROFILER_ADD_ENDTAG(buffer, "fileinfo");
- MYSQLI_PROFILER_ADD_STARTTAG(buffer, "timeinfo",0);
- MYSQLI_PROFILER_ADD_ATTR_TIME(buffer, "execution_time", header.elapsedtime.tv_sec, header.elapsedtime.tv_usec);
- if (header.lifetime.tv_sec + header.lifetime.tv_usec) {
- MYSQLI_PROFILER_ADD_ATTR_TIME(buffer, "life_time", header.lifetime.tv_sec, header.lifetime.tv_usec);
- }
- MYSQLI_PROFILER_ADD_ENDTAG(buffer, "timeinfo");
- if (header.error) {
- MYSQLI_PROFILER_ADD_STARTTAG(buffer, "errors",0);
- MYSQLI_PROFILER_ADD_ATTR_LONG(buffer, "errno", header.error);
- MYSQLI_PROFILER_ADD_ATTR_STRING(buffer, "errmsg", header.errormsg);
- MYSQLI_PROFILER_ADD_ENDTAG(buffer, "errors");
- }
-
- /* free header */
- my_efree(header.functionname);
- my_efree(header.filename);
- my_efree(header.errormsg);
-}
-/* }}} */
-
-/* {{{ void php_mysqli_profiler_report_explain(PR_EXPLAIN, char *, char *) */
-void php_mysqli_profiler_report_explain(PR_EXPLAIN explain, char *ident)
-{
- int i, j;
- char buffer[8192];
-
- if (explain.query) {
- MYSQLI_PROFILER_ADD_ATTR_STRING(buffer, "query_string", explain.query);
- }
-
- if (explain.exp_cnt) {
- MYSQLI_PROFILER_ADD_STARTTAG(buffer, "explain", 1);
- for (i=0; i < explain.exp_cnt; i++) {
- for (j=0; j < explain.columns; j++) {
- MYSQLI_PROFILER_ADD_ATTR_STRING(buffer, explain.fields[j], explain.row[i].value[j]);
- my_efree(explain.row[i].value[j]);
- }
- efree(explain.row[i].value);
- }
- MYSQLI_PROFILER_ADD_ENDTAG(buffer, "explain");
- }
- efree(explain.row);
- for (j=0; j < explain.columns; j++) {
- my_efree(explain.fields[j]);
- }
- efree(explain.fields);
-
- /* free explain */
- my_efree(explain.query);
-}
-/* }}} */
-
-/* {{{ php_mysqli_profiler_report_mysql(PR_MYSQL *, int) */
-void php_mysqli_profiler_report_mysql(PR_MYSQL *prmysql, int depth)
-{
- char *ident = php_mysqli_profiler_indent(depth);
- char buffer[8192];
-
- php_mysqli_profiler_report_header(prmysql->header, ident);
-
- MYSQLI_PROFILER_ADD_ATTR_STRING(buffer, "hostname", prmysql->hostname);
- MYSQLI_PROFILER_ADD_ATTR_STRING(buffer, "user", prmysql->username);
- MYSQLI_PROFILER_ADD_ATTR_LONG(buffer, "thread_id", prmysql->thread_id);
-
- if (!prmysql->closed) {
- MYSQLI_PROFILER_ADD_STARTTAG(buffer, "warnings",0);
- MYSQLI_PROFILER_ADD_ATTR_STRING(buffer, "warning", "connection wasn't closed by mysqli_close()");
- MYSQLI_PROFILER_ADD_ENDTAG(buffer, "warnings");
- }
-
- my_efree(prmysql->hostname);
- my_efree(prmysql->username);
-
- efree(ident);
-}
-/* }}} */
-
-/* {{{ void php_mysqli_profiler_report_query(PR_QUERY *, int) */
-void php_mysqli_profiler_report_query(PR_QUERY *prquery, int depth)
-{
- char buffer[8192];
- char *ident = php_mysqli_profiler_indent(depth);
-
- php_mysqli_profiler_report_header(prquery->header, ident);
- php_mysqli_profiler_report_explain(prquery->explain, ident);
-
- if (prquery->affectedrows > 0) {
- MYSQLI_PROFILER_ADD_ATTR_LONG(buffer, "affected_rows", prquery->affectedrows);
- }
- if (prquery->insertid) {
- MYSQLI_PROFILER_ADD_ATTR_LONG(buffer, "insert_id", prquery->insertid);
- }
-
- efree(ident);
-}
-/* }}} */
-
-/* {{{ void php_mysqli_profiler_report_stmt(PR_STMT *, int) */
-void php_mysqli_profiler_report_stmt(PR_STMT *prstmt, int depth)
-{
- char *ident = php_mysqli_profiler_indent(depth);
- char buffer[8192];
-
- buffer[0] = '\0';
- php_mysqli_profiler_report_header(prstmt->header, ident);
- php_mysqli_profiler_report_explain(prstmt->explain, ident);
-
- printf("\n");
- MYSQLI_PROFILER_OUT(buffer);
- efree(ident);
-}
-/* }}} */
-
-/* {{{ void php_mysqli_profiler_report_result(PR_RESULT *, int) */
-void php_mysqli_profiler_report_result(PR_RESULT *prresult, int depth)
-{
- char *ident = php_mysqli_profiler_indent(depth);
- char buffer[8192];
-
- buffer[0] = '\0';
- php_mysqli_profiler_report_header(prresult->header, ident);
-
- MYSQLI_PROFILER_ADD_ATTR_LONG(buffer, "columns", prresult->columns);
- MYSQLI_PROFILER_ADD_ATTR_LONG(buffer, "rows", prresult->rows);
- MYSQLI_PROFILER_ADD_ATTR_LONG(buffer, "fetched_rows", prresult->fetched_rows);
- if (!prresult->closed || prresult->fetched_rows != prresult->rows) {
- MYSQLI_PROFILER_ADD_STARTTAG(buffer, "warnings",0);
- if (!prresult->closed) {
- MYSQLI_PROFILER_ADD_ATTR_STRING(buffer, "warning", "resultset wasn't closed by mysqli_free_result()");
- }
- if (prresult->fetched_rows != prresult->rows) {
- MYSQLI_PROFILER_ADD_ATTR_STRING(buffer, "warning", "Not all rows from resultset were fetched.");
- }
- MYSQLI_PROFILER_ADD_ENDTAG(buffer, "warnings");
- }
- efree(ident);
-}
-/* }}} */
-
-/* {{{ void php_mysqli_profiler_report_command(PR_COMMAND *, int) */
-void php_mysqli_profiler_report_command(PR_COMMAND *prcommand, int depth)
-{
- char *ident = php_mysqli_profiler_indent(depth);
- char buffer[8192];
-
- buffer[0] = '\0';
- php_mysqli_profiler_report_header(prcommand->header, ident);
-
- if (prcommand->returnvalue) {
- MYSQLI_PROFILER_ADD_ATTR_STRING(buffer, "return_value", prcommand->returnvalue);
- efree(prcommand->returnvalue);
- }
- efree(ident);
-}
-/* }}} */
-
-/* {{{ php_mysqli_profiler_report(PR_COMMON *, int) */
-void php_mysqli_profiler_report(PR_COMMON *current, int depth)
-{
- PR_COMMON *child;
- PR_COMMON *next;
- char buffer[8192];
- char tag[50];
- char *ident = php_mysqli_profiler_indent(depth);
-
- buffer[0] = '\0';
-
- switch (current->header.type) {
- case MYSQLI_PR_MAIN:
- {
- MYSQLI_PROFILER_ADD_STARTTAG(buffer,"?xml version=\"1.0\" ?", 0);
- sprintf((char *)&tag, "protocol origin='PHP5' version='%2.1f'", MYSQLI_PROFILER_PROTOCOL_VERSION);
- MYSQLI_PROFILER_ADD_STARTTAG(buffer, tag, 0);
- strcpy (tag, "protocol");
- }
- break;
- case MYSQLI_PR_MYSQL:
- {
- PR_MYSQL *prmysql = (PR_MYSQL *)current;
- strcpy(tag, "connection");
- MYSQLI_PROFILER_ADD_STARTTAG(buffer, tag, 1);
- php_mysqli_profiler_report_mysql(prmysql, depth);
- }
- break;
- case MYSQLI_PR_COMMAND:
- {
- PR_COMMAND *prcommand = (PR_COMMAND *)current;
- strcpy(tag, "command");
- MYSQLI_PROFILER_ADD_STARTTAG(buffer, tag, 1);
- php_mysqli_profiler_report_command(prcommand, depth);
- }
- break;
- case MYSQLI_PR_RESULT:
- {
- PR_RESULT *prresult = (PR_RESULT *)current;
- strcpy(tag, "resultset");
- MYSQLI_PROFILER_ADD_STARTTAG(buffer, tag, 1);
- php_mysqli_profiler_report_result(prresult, depth);
- }
- break;
- case MYSQLI_PR_STMT:
- case MYSQLI_PR_STMT_RESULT:
- {
- PR_STMT *prstmt = (PR_STMT *)current;
- strcpy(tag, "statement");
- MYSQLI_PROFILER_ADD_STARTTAG(buffer, tag, 1);
- php_mysqli_profiler_report_stmt(prstmt, depth);
- }
- break;
- case MYSQLI_PR_QUERY:
- case MYSQLI_PR_QUERY_RESULT:
- {
- PR_QUERY *prquery = (PR_QUERY *)current;
- strcpy(tag, "query");
- MYSQLI_PROFILER_ADD_STARTTAG(buffer, tag, 1);
- php_mysqli_profiler_report_query(prquery, depth);
- }
- break;
- }
- child = current->header.child;
- if (child) {
- php_mysqli_profiler_report(child, depth+1);
- }
-
- MYSQLI_PROFILER_ADD_ENDTAG(buffer, tag);
- next = (current->header.next) ? current->header.next : NULL;
-
- if (next) {
- php_mysqli_profiler_report(next, depth);
- }
-
- if (current->header.type == MYSQLI_PR_MAIN) {
- PR_MAIN *prmain = (PR_MAIN *)current;
- my_efree(prmain->name);
- }
- efree(current);
- efree(ident);
- return;
-}
-/* }}} */
-
-/* {{{ proto bool mysqli_profiler (int flags, string info, int port)
-*/
-PHP_FUNCTION(mysqli_profiler)
-{
- int flag;
- char *name;
- int name_len = 0, port = 0;
- int connection;
-
- if (MyG(profiler)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Profiler was already started.");
- RETURN_FALSE;
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|sl", &flag, &name, &name_len, &port) == FAILURE) {
- return;
- }
-
- switch (flag) {
- case MYSQLI_PR_REPORT_STDERR:
- prmain = ecalloc(1, sizeof(PR_MAIN));
- prmain->mode = flag;
- break;
- case MYSQLI_PR_REPORT_PORT:
- if (!name_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Hostname not specified.");
- RETURN_FALSE;
- }
- if (!port) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Portnumber not specified.");
- RETURN_FALSE;
- }
- if (!(connection = php_mysqli_create_socket(name, port))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to host %s on port %d, name, port");
- RETURN_FALSE;
- }
- prmain = ecalloc(1, sizeof(PR_MAIN));
- prmain->mode = flag;
- prmain->port = port;
- prmain->name = my_estrdup(name);
- prmain->connection = connection;
- break;
- case MYSQLI_PR_REPORT_FILE:
- if (!name_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Filename not specified.");
- RETURN_FALSE;
- }
- prmain = ecalloc(1, sizeof(PR_MAIN));
- if (!(prmain->fp = fopen(name, "w"))){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't write to file %s.", name);
- efree(prmain);
- RETURN_FALSE;
- }
- prmain->mode = flag;
- prmain->name = my_estrdup(name);
-
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported flag: %d", flag);
- RETURN_FALSE;
- }
-
-
-/* PR_SSEND(port,"<application>");
- php_mysqli_close_socket(prmain.connection);
-*/
- MyG(profiler) = flag;
- RETURN_TRUE;
-}
-/* }}} */
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/mysqli/mysqli_profiler.h b/ext/mysqli/mysqli_profiler.h
deleted file mode 100644
index 24b45133b2..0000000000
--- a/ext/mysqli/mysqli_profiler.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Georg Richter <georg@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef __HAVE_MYSQLI_PROFILER_H__
-#define __HAVE_MYSQLI_PROFILER_H__
-
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#else
-#include "sys/time.h"
-#endif
-
-#define MYSQLI_PROFILER_PROTOCOL_VERSION 1.0
-
-/* common profiler header struct */
-typedef struct {
- unsigned int type;
- void *child;
- void *next;
- char *filename;
- unsigned int lineno;
- char *functionname;
- struct timeval starttime;
- struct timeval elapsedtime;
- struct timeval lifetime;
- char *errormsg;
- ulong error;
-} PR_HEADER;
-
-typedef struct {
- char **value;
-} PR_ROW;
-
-/* explain output */
-typedef struct {
- char *query;
- unsigned int exp_cnt;
- unsigned int columns;
- char **fields;
- PR_ROW *row;
-} PR_EXPLAIN;
-
-/* main profiler */
-typedef struct {
- PR_HEADER header;
- unsigned int mode;
- char *name;
- int port;
- char *info;
- int connection;
- FILE *fp;
-} PR_MAIN;
-
-/* common */
-typedef struct {
- PR_HEADER header;
-} PR_COMMON;
-
-/* connection */
-typedef struct {
- PR_HEADER header;
- unsigned int thread_id;
- char *hostname;
- char *username;
- unsigned int closed;
-} PR_MYSQL;
-
-/* resultset */
-typedef struct {
- PR_HEADER header;
- unsigned int columns;
- ulong rows;
- ulong fields;
- ulong fetched_rows;
- unsigned int closed;
-} PR_RESULT;
-
-/* command */
-/* TODO: return values */
-typedef struct {
- PR_HEADER header;
- ulong returntype;
- char *returnvalue;
-} PR_COMMAND;
-
-/* query */
-typedef struct {
- PR_HEADER header;
- PR_EXPLAIN explain;
- ulong affectedrows;
- ulong insertid;
-} PR_QUERY;
-
-/* statement */
-typedef struct {
- PR_HEADER header;
- PR_EXPLAIN explain;
- unsigned int param_cnt;
- unsigned int field_cnt;
-} PR_STMT;
-
-/* Profiler protofypes */
-extern void php_mysqli_profiler_report(PR_COMMON *, int);
-extern PR_COMMON *php_mysqli_profiler_new_object(PR_COMMON *parent, unsigned int type, unsigned int settime);
-extern void php_mysqli_profiler_result_info(MYSQL_RES *res);
-extern int php_mysqli_profiler_explain(PR_EXPLAIN *explain, PR_HEADER *header, MYSQL *mysql, char *query);
-extern void php_mysqli_profiler_timediff(struct timeval start, struct timeval *elapsed);
-extern PR_MAIN *prmain;
-
-/*** PROFILER MODES ***/
-#define MYSQLI_PR_REPORT_STDERR 1
-#define MYSQLI_PR_REPORT_PORT 2
-#define MYSQLI_PR_REPORT_FILE 3
-
-/*** PROFILER CONSTANTS ***/
-#define MYSQLI_PR_MAIN 0
-#define MYSQLI_PR_MYSQL 1
-#define MYSQLI_PR_QUERY 2
-#define MYSQLI_PR_QUERY_RESULT 3
-#define MYSQLI_PR_STMT 4
-#define MYSQLI_PR_STMT_RESULT 5
-#define MYSQLI_PR_RESULT 6
-
-/*** PROFILER MACROS ***/
-#define MYSQLI_PROFILER_STARTTIME(ptr) gettimeofday(&ptr##->header.starttime, NULL)
-#define MYSQLI_PROFILER_ELAPSEDTIME(ptr) php_mysqli_profiler_timediff(ptr##->header.starttime, &ptr##->header.elapsedtime)
-#define MYSQLI_PROFILER_LIFETIME(ptr) php_mysqli_profiler_timediff((ptr)->starttime, &(ptr)->lifetime)
-#define MYSQLI_PROFILER_NEW(parent, type, time) php_mysqli_profiler_new_object((PR_COMMON *)parent, type, time)
-#define MYSQLI_PROFILER_COMMAND_START(cmd,parent)\
-if (MyG(profiler))\
-{\
- cmd = (PR_COMMAND *)php_mysqli_profiler_new_object((PR_COMMON *)parent, MYSQLI_PR_COMMAND,1);\
-}
-
-#define MYSQLI_PROFILER_COMMAND_RETURNLONG(cmd, value)\
-if (MyG(profiler))\
-{\
- char tmp[30];\
- sprintf ((char *)&tmp, "%ld", value);\
- MYSQLI_PROFILER_ELAPSEDTIME(cmd);\
- cmd->returnvalue = my_estrdup(tmp);\
-}
-
-#define MYSQLI_PROFILER_COMMAND_RETURNSTRING(cmd, value)\
-if (MyG(profiler))\
-{\
- MYSQLI_PROFILER_ELAPSEDTIME(cmd);\
- cmd->returnvalue = my_estrdup(value);\
-}
-#define MYSQLI_PROFILER_EXPLAIN(explain,header,mysql,query) php_mysqli_profiler_explain(explain,header, mysql, query)
-
-#define MYSQLI_PROFILER_OUT(buffer)\
- switch (prmain->mode) {\
- case MYSQLI_PR_REPORT_STDERR:\
- fprintf(stderr, "%s", buffer);\
- break;\
- case MYSQLI_PR_REPORT_FILE:\
- fprintf(prmain->fp, "%s", buffer);\
- break;\
- case MYSQLI_PR_REPORT_PORT:\
- PR_SSEND(prmain->port,buffer);\
- break;\
- }\
- buffer[0] = '\0';
-
-#define MYSQLI_PROFILER_ADD_STARTTAG(buffer, str, out)\
- if (prmain->mode == MYSQLI_PR_REPORT_STDERR) {\
- if (out) { \
- sprintf((char *)&buffer, "%s[%s]\n", ident, str);\
- } \
- }\
- else {\
- sprintf((char *)&buffer, "<%s>\n", str);\
- }\
- MYSQLI_PROFILER_OUT(buffer);
-
-#define MYSQLI_PROFILER_ADD_ATTR_STRING(buffer, tag, value)\
- if (prmain->mode == MYSQLI_PR_REPORT_STDERR) {\
- sprintf((char *)&buffer, "%s%s: %s\n", ident, tag, value);\
- }\
- else {\
- sprintf((char *)&buffer, "<%s>%s</%s>\n", tag, value, tag);\
- }\
- MYSQLI_PROFILER_OUT(buffer);
-
-#define MYSQLI_PROFILER_ADD_ATTR_LONG(buffer, tag, value)\
- if (prmain->mode == MYSQLI_PR_REPORT_STDERR) {\
- sprintf((char *)&buffer, "%s%s: %ld\n", ident, tag, (long)value);\
- }\
- else {\
- sprintf((char *)&buffer, "<%s>%ld</%s>\n", tag, (long)value, tag);\
- }\
- MYSQLI_PROFILER_OUT(buffer);
-
-#define MYSQLI_PROFILER_ADD_ATTR_TIME(buffer, tag, sec, usec)\
- if (prmain->mode == MYSQLI_PR_REPORT_STDERR) {\
- sprintf((char *)&buffer, "%s%s: %ld.%06ld\n", ident, tag, sec, usec);\
- }\
- else {\
- sprintf((char *)&buffer, "<%s>%ld.%06ld</%s>\n", tag, sec, usec, tag);\
- }\
- MYSQLI_PROFILER_OUT(buffer);
-
-#define MYSQLI_PROFILER_ADD_ENDTAG(buffer, tag)\
- if (prmain->mode == MYSQLI_PR_REPORT_STDERR) {\
- fprintf(stderr, "\n"); \
- } else { \
- sprintf((char *)&buffer, "</%s>\n", tag);\
- }\
- MYSQLI_PROFILER_OUT(buffer);
-#endif
diff --git a/ext/mysqli/mysqli_profiler_com.c b/ext/mysqli/mysqli_profiler_com.c
deleted file mode 100644
index 8a4f18d2d9..0000000000
--- a/ext/mysqli/mysqli_profiler_com.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Georg Richter <georg@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#include <string.h>
-#include <sys/types.h>
-#include <errno.h>
-#ifndef PHP_WIN32
-#include <unistd.h>
-#endif
-
-#ifdef PHP_WIN32
-# include <winsock.h>
-# include <process.h>
-# include <direct.h>
-# include "win32/time.h"
-#define PATH_MAX MAX_PATH
-#else
-# include <sys/socket.h>
-# include <netinet/in.h>
-# include <arpa/inet.h>
-# include <netdb.h>
-#endif
-
-#include "mysqli_profiler_com.h"
-
-#ifdef PHP_WIN32
-int inet_aton(const char *cp, struct in_addr *inp)
-{
- inp->s_addr = inet_addr(cp);
- if (inp->s_addr == INADDR_NONE) {
- return 0;
- }
- return 1;
-}
-#endif
-
-/*
- * Converts a host name to an IP address. */
-static int lookup_hostname (const char *addr, struct in_addr *in)
-{
- struct hostent *host_info;
-
- if (!inet_aton(addr, in)) {
- host_info = gethostbyname(addr);
- if (host_info == 0) {
- /* Error: unknown host */
- return -1;
- }
- *in = *((struct in_addr *) host_info->h_addr);
- }
- return 0;
-}
-/* }}} */
-
-int php_mysqli_create_socket(const char *hostname, int dport)
-{
- struct sockaddr_in address;
- int err = -1;
- int sockfd;
-
- memset(&address, 0, sizeof(address));
- lookup_hostname(hostname, &address.sin_addr);
- address.sin_family = AF_INET;
- address.sin_port = htons((unsigned short)dport);
-
- sockfd = socket(address.sin_family, SOCK_STREAM, 0);
- if (sockfd == SOCK_ERR) {
- return -1;
- }
- while ((err = connect(sockfd, (struct sockaddr *) &address,
- sizeof(address))) == SOCK_ERR && errno == EAGAIN);
-
- if (err < 0) {
- PR_SCLOSE(sockfd);
- return -1;
- }
- return sockfd;
-}
-
-void php_mysqli_close_socket(int socket)
-{
- PR_SCLOSE(socket);
-}
diff --git a/ext/mysqli/mysqli_profiler_com.h b/ext/mysqli/mysqli_profiler_com.h
deleted file mode 100644
index 0ea7f4fbc8..0000000000
--- a/ext/mysqli/mysqli_profiler_com.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Georg Richter <georg@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef __HAVE_MYSQLI_PROFILER_COM_H__
-#define __HAVE_MYSQLI_PROFILER_COM_H__
-
-#ifdef PHP_WIN32
-int inet_aton(const char *cp, struct in_addr *inp);
-#endif
-
-#if WIN32|WINNT
-# define SOCK_ERR INVALID_SOCKET
-# define SOCK_CONN_ERR SOCKET_ERROR
-# define SOCK_RECV_ERR SOCKET_ERROR
-#else
-# define SOCK_ERR -1
-# define SOCK_CONN_ERR -1
-# define SOCK_RECV_ERR -1
-#endif
-
-#if WIN32|WINNT
-#define PR_SREAD(a,b,c) recv(a,b,c,0)
-#define PR_SCLOSE(a) closesocket(a)
-#define PR_SSENDL(a,b,c) send(a,b,c,0)
-#define PR_SSEND(a,b) send(a,b,strlen(b),0)
-#else
-#define PR_SREAD(a,b,c) read(a,b,c)
-#define PR_SCLOSE(a) close(a)
-#define PR_SSENDL(a,b,c) write(a,b,c)
-#define PR_SSEND(a,b) write(a,b,strlen(b))
-#endif
-
-/* function prototypes */
-int php_mysqli_create_socket(const char *hostname, int dport);
-void php_mysqli_close_socket(int socket);
-
-#endif
-
diff --git a/ext/mysqli/php_mysqli.h b/ext/mysqli/php_mysqli.h
deleted file mode 100644
index c823e64527..0000000000
--- a/ext/mysqli/php_mysqli.h
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Georg Richter <georg@php.net> |
- +----------------------------------------------------------------------+
-
- $Id$
-*/
-
-/* A little hack to prevent build break, when mysql is used together with
- * c-client, which also defines LIST.
- */
-#ifdef LIST
-#undef LIST
-#endif
-
-#include <mysql.h>
-#include "mysqli_profiler.h"
-
-#ifndef PHP_MYSQLI_H
-#define PHP_MYSQLI_H
-
-
-typedef struct {
- ulong buflen;
- char *buffer;
- ulong type;
-} BIND_BUFFER;
-
-typedef struct {
- MYSQL_STMT *stmt;
- unsigned int var_cnt;
- zval **vars;
- BIND_BUFFER *bind;
- char *is_null;
- char type;
-} STMT;
-
-typedef struct {
- void *prinfo; /* profiler info */
- void *ptr; /* resource: (mysql, result, stmt) */
-} MYSQLI_RESOURCE;
-
-typedef struct _mysqli_object {
- zend_object zo;
- void *ptr;
-} mysqli_object; /* extends zend_object */
-
-#define MYSQLI_PR_MAIN 0
-#define MYSQLI_PR_MYSQL 1
-#define MYSQLI_PR_QUERY 2
-#define MYSQLI_PR_QUERY_RESULT 3
-#define MYSQLI_PR_STMT 4
-#define MYSQLI_PR_STMT_RESULT 5
-#define MYSQLI_PR_RESULT 6
-#define MYSQLI_PR_COMMAND 7
-
-
-#define phpext_mysqli_ptr &mysqli_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_MYSQLI_API __declspec(dllexport)
-#else
-#define PHP_MYSQLI_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-#define PHP_MYSQLI_EXPORT(__type) PHP_MYSQLI_API __type
-
-extern zend_module_entry mysqli_module_entry;
-extern function_entry mysqli_functions[];
-extern function_entry mysqli_link_methods[];
-extern function_entry mysqli_stmt_methods[];
-extern function_entry mysqli_result_methods[];
-extern void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int flag);
-extern void php_clear_stmt_bind(STMT *stmt);
-
-zend_class_entry *mysqli_link_class_entry;
-zend_class_entry *mysqli_stmt_class_entry;
-zend_class_entry *mysqli_result_class_entry;
-
-zend_class_entry _mysqli_link_class_entry;
-zend_class_entry _mysqli_stmt_class_entry;
-zend_class_entry _mysqli_result_class_entry;
-
-PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry * TSRMLS_DC);
-
-#define REGISTER_MYSQLI_CLASS_ENTRY(name, mysqli_entry, class_functions) { \
- INIT_CLASS_ENTRY(_##mysqli_entry,name,class_functions); \
- _##mysqli_entry.create_object = mysqli_objects_new; \
- mysqli_entry = zend_register_internal_class(&_##mysqli_entry TSRMLS_CC); \
-} \
-
-#define MYSQLI_REGISTER_RESOURCE_EX(__ptr, __zval, __ce) \
- ((mysqli_object *) zend_object_store_get_object(__zval TSRMLS_CC))->ptr = __ptr;
-
-#define MYSQLI_RETURN_RESOURCE(__ptr, __ce) \
- Z_TYPE_P(return_value) = IS_OBJECT; \
- (return_value)->value.obj = mysqli_objects_new(__ce TSRMLS_CC); \
- MYSQLI_REGISTER_RESOURCE_EX(__ptr, return_value, __ce)
-
-#define MYSQLI_REGISTER_RESOURCE(__ptr, __ce) \
-{\
- zval *object = getThis();\
- if (!object) {\
- object = return_value;\
- Z_TYPE_P(object) = IS_OBJECT;\
- (object)->value.obj = mysqli_objects_new(__ce TSRMLS_CC);\
- }\
- MYSQLI_REGISTER_RESOURCE_EX(__ptr, object, __ce)\
-}
-
-#define MYSQLI_FETCH_RESOURCE(__ptr, __type, __prptr, __prtype, __id, __name) \
-{ \
- MYSQLI_RESOURCE *my_res; \
- mysqli_object *intern = (mysqli_object *)zend_object_store_get_object(*(__id) TSRMLS_CC);\
- if (!(my_res = (MYSQLI_RESOURCE *)intern->ptr)) {\
- php_error(E_WARNING, "Couldn't fetch %s", intern->zo.ce->name);\
- RETURN_NULL();\
- }\
- __ptr = (__type)my_res->ptr; \
- __prptr = (__prtype)my_res->prinfo; \
- if (!strcmp((char *)__name, "mysqli_stmt")) {\
- if (!((STMT *)__ptr)->stmt->mysql) {\
- php_error(E_WARNING, "Statement isn't valid anymore");\
- RETURN_NULL();\
- }\
- }\
-}
-
-#define MYSQLI_CLEAR_RESOURCE(__id) \
-{ \
- mysqli_object *intern = (mysqli_object *)zend_object_store_get_object(*(__id) TSRMLS_CC);\
- efree(intern->ptr); \
- intern->ptr = NULL; \
-}
-
-#define MYSQLI_RETURN_LONG_LONG(__val) \
-{ \
- if ((__val) < LONG_MAX) { \
- RETURN_LONG((__val)); \
- } else { \
- char ret[40]; \
- sprintf(ret, "%llu", (__val)); \
- RETURN_STRING(ret,1); \
- } \
-}
-
-#define MYSQLI_STORE_RESULT 0
-#define MYSQLI_USE_RESULT 1
-
-/* for mysqli_fetch_assoc */
-#define MYSQLI_ASSOC 1
-#define MYSQLI_NUM 2
-#define MYSQLI_BOTH 3
-
-/* for mysqli_bind_param */
-#define MYSQLI_BIND_INT 1
-#define MYSQLI_BIND_DOUBLE 2
-#define MYSQLI_BIND_STRING 3
-#define MYSQLI_BIND_SEND_DATA 4
-
-/* fetch types */
-#define FETCH_SIMPLE 1
-#define FETCH_RESULT 2
-
-PHP_MYSQLI_API void mysqli_register_link(zval *return_value, void *link TSRMLS_DC);
-PHP_MYSQLI_API void mysqli_register_stmt(zval *return_value, void *stmt TSRMLS_DC);
-PHP_MYSQLI_API void mysqli_register_result(zval *return_value, void *result TSRMLS_DC);
-PHP_MYSQLI_API void php_mysqli_set_error(long mysql_errno, char *mysql_err TSRMLS_DC);
-
-PHP_MINIT_FUNCTION(mysqli);
-PHP_MSHUTDOWN_FUNCTION(mysqli);
-PHP_RINIT_FUNCTION(mysqli);
-PHP_RSHUTDOWN_FUNCTION(mysqli);
-PHP_MINFO_FUNCTION(mysqli);
-
-PHP_FUNCTION(mysqli_affected_rows);
-PHP_FUNCTION(mysqli_autocommit);
-PHP_FUNCTION(mysqli_bind_param);
-PHP_FUNCTION(mysqli_bind_result);
-PHP_FUNCTION(mysqli_change_user);
-PHP_FUNCTION(mysqli_character_set_name);
-PHP_FUNCTION(mysqli_close);
-PHP_FUNCTION(mysqli_commit);
-PHP_FUNCTION(mysqli_connect);
-PHP_FUNCTION(mysqli_data_seek);
-PHP_FUNCTION(mysqli_debug);
-PHP_FUNCTION(mysqli_disable_reads_from_master);
-PHP_FUNCTION(mysqli_disable_rpl_parse);
-PHP_FUNCTION(mysqli_dump_debug_info);
-PHP_FUNCTION(mysqli_enable_reads_from_master);
-PHP_FUNCTION(mysqli_enable_rpl_parse);
-PHP_FUNCTION(mysqli_errno);
-PHP_FUNCTION(mysqli_error);
-PHP_FUNCTION(mysqli_execute);
-PHP_FUNCTION(mysqli_fetch);
-PHP_FUNCTION(mysqli_fetch_array);
-PHP_FUNCTION(mysqli_fetch_assoc);
-PHP_FUNCTION(mysqli_fetch_object);
-PHP_FUNCTION(mysqli_fetch_field);
-PHP_FUNCTION(mysqli_fetch_fields);
-PHP_FUNCTION(mysqli_fetch_field_direct);
-PHP_FUNCTION(mysqli_fetch_lengths);
-PHP_FUNCTION(mysqli_fetch_row);
-PHP_FUNCTION(mysqli_field_count);
-PHP_FUNCTION(mysqli_field_seek);
-PHP_FUNCTION(mysqli_field_tell);
-PHP_FUNCTION(mysqli_free_result);
-PHP_FUNCTION(mysqli_get_client_info);
-PHP_FUNCTION(mysqli_get_host_info);
-PHP_FUNCTION(mysqli_get_proto_info);
-PHP_FUNCTION(mysqli_get_server_info);
-PHP_FUNCTION(mysqli_get_server_version);
-PHP_FUNCTION(mysqli_info);
-PHP_FUNCTION(mysqli_insert_id);
-PHP_FUNCTION(mysqli_init);
-PHP_FUNCTION(mysqli_kill);
-PHP_FUNCTION(mysqli_master_query);
-PHP_FUNCTION(mysqli_num_fields);
-PHP_FUNCTION(mysqli_num_rows);
-PHP_FUNCTION(mysqli_options);
-PHP_FUNCTION(mysqli_param_count);
-PHP_FUNCTION(mysqli_ping);
-PHP_FUNCTION(mysqli_prepare);
-PHP_FUNCTION(mysqli_query);
-PHP_FUNCTION(mysqli_prepare_result);
-PHP_FUNCTION(mysqli_profiler);
-PHP_FUNCTION(mysqli_read_query_result);
-PHP_FUNCTION(mysqli_real_connect);
-PHP_FUNCTION(mysqli_real_query);
-PHP_FUNCTION(mysqli_real_escape_string);
-PHP_FUNCTION(mysqli_reload);
-PHP_FUNCTION(mysqli_rollback);
-PHP_FUNCTION(mysqli_row_seek);
-PHP_FUNCTION(mysqli_rpl_parse_enabled);
-PHP_FUNCTION(mysqli_rpl_probe);
-PHP_FUNCTION(mysqli_rpl_query_type);
-PHP_FUNCTION(mysqli_select_db);
-PHP_FUNCTION(mysqli_send_long_data);
-PHP_FUNCTION(mysqli_send_query);
-PHP_FUNCTION(mysqli_slave_query);
-PHP_FUNCTION(mysqli_ssl_set);
-PHP_FUNCTION(mysqli_stat);
-PHP_FUNCTION(mysqli_stmt_affected_rows);
-PHP_FUNCTION(mysqli_stmt_close);
-PHP_FUNCTION(mysqli_stmt_errno);
-PHP_FUNCTION(mysqli_stmt_error);
-PHP_FUNCTION(mysqli_stmt_store_result);
-PHP_FUNCTION(mysqli_store_result);
-PHP_FUNCTION(mysqli_thread_id);
-PHP_FUNCTION(mysqli_thread_safe);
-PHP_FUNCTION(mysqli_use_result);
-PHP_FUNCTION(mysqli_warning_count);
-
-ZEND_BEGIN_MODULE_GLOBALS(mysqli)
- long default_link;
- long num_links;
- long max_links;
- unsigned int default_port;
- char *default_host;
- char *default_user;
- char *default_pw;
- char *default_socket;
- long error_no;
- char *error_msg;
- unsigned int profiler;
-ZEND_END_MODULE_GLOBALS(mysqli)
-
-#ifdef ZTS
-#define MyG(v) TSRMG(mysqli_globals_id, zend_mysqli_globals *, v)
-#else
-#define MyG(v) (mysqli_globals.v)
-#endif
-
-#define my_estrdup(x) (x) ? estrdup(x) : NULL
-#define my_efree(x) if (x) efree(x)
-
-ZEND_EXTERN_MODULE_GLOBALS(mysqli);
-
-#endif /* PHP_MYSQLI.H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/mysqli/tests/001.phpt b/ext/mysqli/tests/001.phpt
deleted file mode 100644
index fca937cf5d..0000000000
--- a/ext/mysqli/tests/001.phpt
+++ /dev/null
@@ -1,54 +0,0 @@
---TEST--
-mysqli connect
---FILE--
-<?
- $user = "root";
- $passwd = "";
- $dbname = "test";
- $test = "";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("127.0.0.1", $user, $passwd);
- $test .= ($link) ? "1" : "0";
- mysqli_close($link);
-
- /*** test mysqli_connect localhost ***/
- $link = mysqli_connect("localhost", $user, $passwd);
- $test .= ($link) ? "1" : "0";
- mysqli_close($link);
-
- /*** test mysqli_connect localhost:port ***/
- $link = mysqli_connect("localhost", $user, $passwd, "", 3306);
- $test .= ($link) ? "1" : "0";
- mysqli_close($link);
-
- /*** test mysqli_real_connect ***/
- $link = mysqli_init();
- $test.= (mysqli_real_connect($link, "localhost", $user, $passwd))
- ? "1" : "0";
- mysqli_close($link);
-
- /*** test mysqli_real_connect with db ***/
- $link = mysqli_init();
- $test .= (mysqli_real_connect($link, "localhost", $user, $passwd, $dbname))
- ? "1" : "0";
- mysqli_close($link);
-
- /*** test mysqli_real_connect with port ***/
- $link = mysqli_init();
- $test .= (mysqli_real_connect($link, "localhost", $user, $passwd, $dbname, 3306))
- ? "1":"0";
- mysqli_close($link);
-
- /*** test mysqli_real_connect compressed ***/
- $link = mysqli_init();
- $test .= (mysqli_real_connect($link, "localhost", $user, $passwd, $dbname, 0, NULL, MYSQLI_CLIENT_COMPRESS))
- ? "1" : "0";
- mysqli_close($link);
-
- /* todo ssl connections */
-
- var_dump($test);
-?>
---EXPECT--
-string(7) "1111111"
diff --git a/ext/mysqli/tests/002.phpt b/ext/mysqli/tests/002.phpt
deleted file mode 100644
index bbf5808641..0000000000
--- a/ext/mysqli/tests/002.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-mysqli bind_result 1
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
- $rc = mysqli_query($link,"DROP TABLE IF EXISTS test_fetch_null");
-
- $rc = mysqli_query($link,"CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint,
- col3 int, col4 bigint,
- col5 float, col6 double,
- col7 date, col8 time,
- col9 varbinary(10),
- col10 varchar(50),
- col11 char(20))");
-
- $rc = mysqli_query($link,"INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
-
- $stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null");
- mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7, &$c8, &$c9, &$c10, &$c11);
- mysqli_execute($stmt);
-
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(11) {
- [0]=>
- int(1)
- [1]=>
- NULL
- [2]=>
- NULL
- [3]=>
- NULL
- [4]=>
- NULL
- [5]=>
- NULL
- [6]=>
- NULL
- [7]=>
- NULL
- [8]=>
- NULL
- [9]=>
- string(4) "foo1"
- [10]=>
- string(4) "1000"
-}
diff --git a/ext/mysqli/tests/003.phpt b/ext/mysqli/tests/003.phpt
deleted file mode 100644
index 6baae8a481..0000000000
--- a/ext/mysqli/tests/003.phpt
+++ /dev/null
@@ -1,56 +0,0 @@
---TEST--
-mysqli connect
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
- mysqli_query($link,"CREATE TABLE test_bind_result(c1 date, c2 time,
- c3 timestamp(14),
- c4 year,
- c5 datetime,
- c6 timestamp(4),
- c7 timestamp(6))");
-
- mysqli_query($link,"INSERT INTO test_bind_result VALUES('2002-01-02',
- '12:49:00',
- '2002-01-02 17:46:59',
- 2010,
- '2010-07-10',
- '2020','1999-12-29')");
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
-
- mysqli_bind_result($stmt,&$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(7) {
- [0]=>
- string(10) "2002-01-02"
- [1]=>
- string(8) "12:49:00"
- [2]=>
- string(19) "2002-01-02 17:46:59"
- [3]=>
- int(2010)
- [4]=>
- string(19) "2010-07-10 00:00:00"
- [5]=>
- string(0) ""
- [6]=>
- string(19) "1999-12-29 00:00:00"
-}
diff --git a/ext/mysqli/tests/004.phpt b/ext/mysqli/tests/004.phpt
deleted file mode 100644
index 1469bb566f..0000000000
--- a/ext/mysqli/tests/004.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-mysqli fetch char/text
---FILE--
-<?php
- include ("connect.inc");
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
-
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', 'this is a test')");
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_bind_result($stmt, &$c1, &$c2);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(2) {
- [0]=>
- string(10) "1234567890"
- [1]=>
- string(14) "this is a test"
-}
diff --git a/ext/mysqli/tests/005.phpt b/ext/mysqli/tests/005.phpt
deleted file mode 100644
index 5688770fe0..0000000000
--- a/ext/mysqli/tests/005.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-mysqli fetch char/text long
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
-
- $a = str_repeat("A1", 32000);
-
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', '$a')");
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_bind_result($stmt, &$c1, &$c2);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test[] = $c1;
- $test[] = ($a == $c2) ? "32K String ok" : "32K String failed";
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(2) {
- [0]=>
- string(10) "1234567890"
- [1]=>
- string(13) "32K String ok"
-}
diff --git a/ext/mysqli/tests/006.phpt b/ext/mysqli/tests/006.phpt
deleted file mode 100644
index 059ce147a7..0000000000
--- a/ext/mysqli/tests/006.phpt
+++ /dev/null
@@ -1,51 +0,0 @@
---TEST--
-mysqli fetch long values
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
- c2 int unsigned,
- c3 int,
- c4 int,
- c5 int,
- c6 int unsigned,
- c7 int)");
-
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,-0,0)");
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(7) {
- [0]=>
- int(0)
- [1]=>
- int(35999)
- [2]=>
- NULL
- [3]=>
- int(-500)
- [4]=>
- int(-9999999)
- [5]=>
- int(0)
- [6]=>
- int(0)
-}
diff --git a/ext/mysqli/tests/007.phpt b/ext/mysqli/tests/007.phpt
deleted file mode 100644
index 89d1959752..0000000000
--- a/ext/mysqli/tests/007.phpt
+++ /dev/null
@@ -1,51 +0,0 @@
---TEST--
-mysqli fetch short values
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
- c2 smallint unsigned,
- c3 smallint,
- c4 smallint,
- c5 smallint,
- c6 smallint unsigned,
- c7 smallint)");
-
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,+30,0)");
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(7) {
- [0]=>
- int(0)
- [1]=>
- int(35999)
- [2]=>
- NULL
- [3]=>
- int(-500)
- [4]=>
- int(-32768)
- [5]=>
- int(30)
- [6]=>
- int(0)
-}
diff --git a/ext/mysqli/tests/008.phpt b/ext/mysqli/tests/008.phpt
deleted file mode 100644
index 92498da44c..0000000000
--- a/ext/mysqli/tests/008.phpt
+++ /dev/null
@@ -1,53 +0,0 @@
---TEST--
-mysqli fetch tinyint values
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint,
- c2 tinyint unsigned,
- c3 tinyint not NULL,
- c4 tinyint,
- c5 tinyint,
- c6 tinyint unsigned,
- c7 tinyint)");
-
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)");
-
- $c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL;
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(7) {
- [0]=>
- int(-23)
- [1]=>
- int(255)
- [2]=>
- int(0)
- [3]=>
- int(-100)
- [4]=>
- int(-127)
- [5]=>
- int(30)
- [6]=>
- int(0)
-}
diff --git a/ext/mysqli/tests/009.phpt b/ext/mysqli/tests/009.phpt
deleted file mode 100644
index 942b443ebb..0000000000
--- a/ext/mysqli/tests/009.phpt
+++ /dev/null
@@ -1,51 +0,0 @@
---TEST--
-mysqli fetch bigint values
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 bigint default 5,
- c2 bigint,
- c3 bigint not NULL,
- c4 bigint unsigned,
- c5 bigint unsigned,
- c6 bigint unsigned,
- c7 bigint unsigned)");
-
- mysqli_query($link, "INSERT INTO test_bind_fetch (c2,c3,c4,c5,c6,c7) VALUES (-23,4.0,33333333333333,0,-333333333333,99.9)");
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(7) {
- [0]=>
- int(5)
- [1]=>
- int(-23)
- [2]=>
- int(4)
- [3]=>
- string(14) "33333333333333"
- [4]=>
- int(0)
- [5]=>
- string(13) "-333333333333"
- [6]=>
- int(100)
-}
diff --git a/ext/mysqli/tests/010.phpt b/ext/mysqli/tests/010.phpt
deleted file mode 100644
index 2986277fb4..0000000000
--- a/ext/mysqli/tests/010.phpt
+++ /dev/null
@@ -1,54 +0,0 @@
---TEST--
-mysqli fetch float values
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
-
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 float(3),
- c2 float,
- c3 float unsigned,
- c4 float,
- c5 float,
- c6 float,
- c7 float(10) unsigned)");
-
-
- mysqli_query($link, "INSERT INTO test_bind_fetch (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999,
- sin(0.6), 1.00000000000001, 888888888888888)");
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(7) {
- [0]=>
- float(3.1415927410126)
- [1]=>
- float(-9.9999999747524E-7)
- [2]=>
- float(0)
- [3]=>
- float(999999995904)
- [4]=>
- float(0.56464248895645)
- [5]=>
- float(1)
- [6]=>
- float(888888914608130)
-}
diff --git a/ext/mysqli/tests/011.phpt b/ext/mysqli/tests/011.phpt
deleted file mode 100644
index 5735e2f1dd..0000000000
--- a/ext/mysqli/tests/011.phpt
+++ /dev/null
@@ -1,53 +0,0 @@
---TEST--
-mysqli fetch mixed values
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
-
- mysqli_query($link,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
- c3 int, c4 bigint,
- c5 float, c6 double,
- c7 varbinary(10),
- c8 varchar(50))");
-
- mysqli_query($link,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999,
- 2345.6,5678.89563,
- 'foobar','mysql rulez')");
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
- mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7, &$c8);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(8) {
- [0]=>
- int(19)
- [1]=>
- int(2999)
- [2]=>
- int(3999)
- [3]=>
- int(4999999)
- [4]=>
- float(2345.6000976563)
- [5]=>
- float(5678.89563)
- [6]=>
- string(6) "foobar"
- [7]=>
- string(11) "mysql rulez"
-}
diff --git a/ext/mysqli/tests/012.phpt b/ext/mysqli/tests/012.phpt
deleted file mode 100644
index 38ef311d59..0000000000
--- a/ext/mysqli/tests/012.phpt
+++ /dev/null
@@ -1,54 +0,0 @@
---TEST--
-mysqli fetch mixed values 2
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
-
- mysqli_query($link,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
- c3 int, c4 bigint,
- c5 float, c6 double,
- c7 varbinary(10),
- c8 varchar(10))");
-
- mysqli_query($link,"INSERT INTO test_bind_result VALUES(120,2999,3999,54,
- 2.6,58.89,
- '206','6.7')");
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
- mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7, &$c8);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(8) {
- [0]=>
- int(120)
- [1]=>
- int(2999)
- [2]=>
- int(3999)
- [3]=>
- int(54)
- [4]=>
- float(2.5999999046326)
- [5]=>
- float(58.89)
- [6]=>
- string(3) "206"
- [7]=>
- string(3) "6.7"
-}
diff --git a/ext/mysqli/tests/013.phpt b/ext/mysqli/tests/013.phpt
deleted file mode 100644
index dafc9bba9b..0000000000
--- a/ext/mysqli/tests/013.phpt
+++ /dev/null
@@ -1,45 +0,0 @@
---TEST--
-mysqli fetch mixed / mysql_query
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
-
- mysqli_query($link,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
- c3 int, c4 bigint,
- c5 decimal(4,2), c6 double,
- c7 varbinary(10),
- c8 varchar(10))");
-
- mysqli_query($link,"INSERT INTO test_bind_result VALUES(120,2999,3999,54,
- 2.6,58.89,
- '206','6.7')");
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
-
- $c = array(0,0,0,0,0,0,0,0);
- mysqli_bind_result($stmt, &$c[0], &$c[1], &$c[2], &$c[3], &$c[4], &$c[5], &$c[6], &$c[7]);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
- mysqli_fetch($stmt);
- mysqli_stmt_close($stmt);
-
- $result = mysqli_query($link, "select * from test_bind_result");
- $d = mysqli_fetch_row($result);
- mysqli_free_result($result);
-
- $test = "";
- for ($i=0; $i < count($c); $i++)
- $test .= ($c[0] == $d[0]) ? "1" : "0";
-
- var_dump($test);
-
- mysqli_close($link);
-?>
---EXPECT--
-string(8) "11111111"
diff --git a/ext/mysqli/tests/014.phpt b/ext/mysqli/tests/014.phpt
deleted file mode 100644
index 8a72c42c7f..0000000000
--- a/ext/mysqli/tests/014.phpt
+++ /dev/null
@@ -1,66 +0,0 @@
---TEST--
-mysqli autocommit/commit/rollback
---SKIPIF--
-<?php
- include "connect.inc";
- $link = mysqli_connect("localhost", $user, $passwd);
- $result = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'");
- $row = mysqli_fetch_row($result);
- mysqli_free_result($result);
- mysqli_close($link);
-
- if ($row[1] == "DISABLED" || $row[1] == "NO") {
- printf ("skip innodb support is not installed or enabled.");
- }
-?>
---FILE--
-<?php
- include "connect.inc";
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_autocommit($link, TRUE);
-
- mysqli_query($link,"DROP TABLE IF EXISTS ac_01");
-
- mysqli_query($link,"CREATE TABLE ac_01(a int, b varchar(10)) type=InnoDB");
-
- mysqli_query($link, "INSERT INTO ac_01 VALUES (1, 'foobar')");
- mysqli_autocommit($link, FALSE);
- mysqli_query($link, "DELETE FROM ac_01");
- mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')");
-
- mysqli_rollback($link);
-
- $result = mysqli_query($link, "SELECT * FROM ac_01");
- $row = mysqli_fetch_row($result);
- mysqli_free_result($result);
-
- var_dump($row);
-
- mysqli_query($link, "DELETE FROM ac_01");
- mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')");
- mysqli_commit($link);
-
- $result = mysqli_query($link, "SELECT * FROM ac_01");
- $row = mysqli_fetch_row($result);
- mysqli_free_result($result);
-
- var_dump($row);
-
- mysqli_close($link);
-?>
---EXPECT--
-array(2) {
- [0]=>
- string(1) "1"
- [1]=>
- string(6) "foobar"
-}
-array(2) {
- [0]=>
- string(1) "2"
- [1]=>
- string(4) "egon"
-}
diff --git a/ext/mysqli/tests/015.phpt b/ext/mysqli/tests/015.phpt
deleted file mode 100644
index 96864e8854..0000000000
--- a/ext/mysqli/tests/015.phpt
+++ /dev/null
@@ -1,68 +0,0 @@
---TEST--
-mysqli autocommit/commit/rollback with myisam
---SKIPIF--
-<?php
- include "connect.inc";
- $link = mysqli_connect("localhost", $user, $passwd);
- $result = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'");
- $row = mysqli_fetch_row($result);
- mysqli_free_result($result);
- mysqli_close($link);
-
- if ($row[1] == "NO") {
- printf ("skip innodb support not installed.");
- }
-?>
---FILE--
-<?php
- include "connect.inc";
-
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_autocommit($link, TRUE);
-
- mysqli_query($link,"DROP TABLE IF EXISTS ac_01");
-
- mysqli_query($link,"CREATE TABLE ac_01(a int, b varchar(10))");
-
- mysqli_query($link, "INSERT INTO ac_01 VALUES (1, 'foobar')");
- mysqli_autocommit($link, FALSE);
-
- mysqli_query($link, "DELETE FROM ac_01");
- mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')");
-
- mysqli_rollback($link);
-
- $result = mysqli_query($link, "SELECT * FROM ac_01");
- $row = mysqli_fetch_row($result);
- mysqli_free_result($result);
-
- var_dump($row);
-
- mysqli_query($link, "DELETE FROM ac_01");
- mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')");
- mysqli_commit($link);
-
- $result = mysqli_query($link, "SELECT * FROM ac_01");
- $row = mysqli_fetch_row($result);
- mysqli_free_result($result);
-
- var_dump($row);
-
- mysqli_close($link);
-?>
---EXPECT--
-array(2) {
- [0]=>
- string(1) "2"
- [1]=>
- string(4) "egon"
-}
-array(2) {
- [0]=>
- string(1) "2"
- [1]=>
- string(4) "egon"
-}
diff --git a/ext/mysqli/tests/016.phpt b/ext/mysqli/tests/016.phpt
deleted file mode 100644
index 7d84c29655..0000000000
--- a/ext/mysqli/tests/016.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-mysqli fetch user variable
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link, "SET @dummy='foobar'");
-
- $stmt = mysqli_prepare($link, "SELECT @dummy");
- mysqli_bind_result($stmt, &$dummy);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- var_dump($dummy);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-string(6) "foobar"
diff --git a/ext/mysqli/tests/017.phpt b/ext/mysqli/tests/017.phpt
deleted file mode 100644
index e7aaf746cf..0000000000
--- a/ext/mysqli/tests/017.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-mysqli fetch functions
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- $stmt = mysqli_prepare($link, "SELECT current_user(), database()");
- mysqli_bind_result($stmt, &$c0, &$c1);
- mysqli_execute($stmt);
-
- mysqli_fetch($stmt);
-
- $test = array($c0, $c1);
-
- var_dump($test);
-
- mysqli_close($link);
-?>
---EXPECT--
-array(2) {
- [0]=>
- string(14) "root@localhost"
- [1]=>
- string(4) "test"
-}
diff --git a/ext/mysqli/tests/018.phpt b/ext/mysqli/tests/018.phpt
deleted file mode 100644
index 8fb0d44dc5..0000000000
--- a/ext/mysqli/tests/018.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-mysqli fetch system variables
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link, "SET AUTOCOMMIT=0");
-
- $stmt = mysqli_prepare($link, "SELECT @@autocommit");
- mysqli_bind_result($stmt, &$c0);
- mysqli_execute($stmt);
-
- mysqli_fetch($stmt);
-
- var_dump($c0);
-
- mysqli_close($link);
-?>
---EXPECT--
-int(0)
diff --git a/ext/mysqli/tests/019.phpt b/ext/mysqli/tests/019.phpt
deleted file mode 100644
index 0e13f7520a..0000000000
--- a/ext/mysqli/tests/019.phpt
+++ /dev/null
@@ -1,68 +0,0 @@
---TEST--
-mysqli fetch (bind_param + bind_result)
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
- $rc = mysqli_query($link,"DROP TABLE IF EXISTS insert_read");
-
- $rc = mysqli_query($link,"CREATE TABLE insert_read(col1 tinyint, col2 smallint,
- col3 int, col4 bigint,
- col5 float, col6 double,
- col7 date, col8 time,
- col9 varbinary(10),
- col10 varchar(50),
- col11 char(20))");
-
- $stmt= mysqli_prepare($link,"INSERT INTO insert_read(col1,col10, col11) VALUES(?,?,?)");
- mysqli_bind_param($stmt, &$c1, MYSQLI_BIND_INT, &$c2, MYSQLI_BIND_STRING, &$c3, MYSQLI_BIND_STRING);
-
- $c1 = 1;
- $c2 = "foo";
- $c3 = "foobar";
-
- mysqli_execute($stmt);
- mysqli_stmt_close($stmt);
-
- $stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from insert_read");
- mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7, &$c8, &$c9, &$c10, &$c11);
- mysqli_execute($stmt);
-
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(11) {
- [0]=>
- int(1)
- [1]=>
- NULL
- [2]=>
- NULL
- [3]=>
- NULL
- [4]=>
- NULL
- [5]=>
- NULL
- [6]=>
- NULL
- [7]=>
- NULL
- [8]=>
- NULL
- [9]=>
- string(3) "foo"
- [10]=>
- string(6) "foobar"
-}
diff --git a/ext/mysqli/tests/020.phpt b/ext/mysqli/tests/020.phpt
deleted file mode 100644
index 53827d0be3..0000000000
--- a/ext/mysqli/tests/020.phpt
+++ /dev/null
@@ -1,70 +0,0 @@
---TEST--
-mysqli bind_param/bind_result date
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
- mysqli_query($link,"CREATE TABLE test_bind_result(c1 date, c2 time,
- c3 timestamp(14),
- c4 year,
- c5 datetime,
- c6 timestamp(4),
- c7 timestamp(6))");
-
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_result VALUES (?,?,?,?,?,?,?)");
- mysqli_bind_param($stmt, &$d1, MYSQLI_BIND_STRING,
- &$d2, MYSQLI_BIND_STRING,
- &$d3, MYSQLI_BIND_STRING,
- &$d4, MYSQLI_BIND_STRING,
- &$d5, MYSQLI_BIND_STRING,
- &$d6, MYSQLI_BIND_STRING,
- &$d7, MYSQLI_BIND_STRING);
-
- $d1 = '2002-01-02';
- $d2 = '12:49:00';
- $d3 = '2002-01-02 17:46:59';
- $d4 = 2010;
- $d5 ='2010-07-10';
- $d6 = '2020';
- $d7 = '1999-12-29';
-
- mysqli_execute($stmt);
- mysqli_stmt_close($stmt);
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
-
- mysqli_bind_result($stmt,&$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
-
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(7) {
- [0]=>
- string(10) "2002-01-02"
- [1]=>
- string(8) "12:49:00"
- [2]=>
- string(19) "2002-01-02 17:46:59"
- [3]=>
- int(2010)
- [4]=>
- string(19) "2010-07-10 00:00:00"
- [5]=>
- string(0) ""
- [6]=>
- string(19) "1999-12-29 00:00:00"
-}
diff --git a/ext/mysqli/tests/021.phpt b/ext/mysqli/tests/021.phpt
deleted file mode 100644
index deabef6933..0000000000
--- a/ext/mysqli/tests/021.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-mysqli bind_param+bind_result char/text
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
-
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
- mysqli_bind_param($stmt, &$q1, MYSQLI_BIND_STRING, &$q2, MYSQLI_BIND_STRING);
- $q1 = "1234567890";
- $q2 = "this is a test";
- mysqli_execute($stmt);
- mysqli_stmt_close($stmt);
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_bind_result($stmt, &$c1, &$c2);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(2) {
- [0]=>
- string(10) "1234567890"
- [1]=>
- string(14) "this is a test"
-}
diff --git a/ext/mysqli/tests/022.phpt b/ext/mysqli/tests/022.phpt
deleted file mode 100644
index efd2fef8bd..0000000000
--- a/ext/mysqli/tests/022.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-mysqli bind_param/bind_result char/text long
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
-
-
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
- mysqli_bind_param($stmt, &$a1, MYSQLI_BIND_STRING, &$a2, MYSQLI_BIND_STRING);
-
- $a1 = "1234567890";
- $a2 = str_repeat("A1", 32000);
-
- mysqli_execute($stmt);
- mysqli_stmt_close($stmt);
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_bind_result($stmt, &$c1, &$c2);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test[] = $c1;
- $test[] = ($a2 == $c2) ? "32K String ok" : "32K String failed";
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(2) {
- [0]=>
- string(10) "1234567890"
- [1]=>
- string(13) "32K String ok"
-}
diff --git a/ext/mysqli/tests/023.phpt b/ext/mysqli/tests/023.phpt
deleted file mode 100644
index fcbd4b2cfc..0000000000
--- a/ext/mysqli/tests/023.phpt
+++ /dev/null
@@ -1,64 +0,0 @@
---TEST--
-mysqli bind_param/bind_prepare fetch long values
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
- c2 int unsigned,
- c3 int,
- c4 int,
- c5 int,
- c6 int unsigned,
- c7 int)");
-
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
- mysqli_bind_param($stmt, &$c1,MYSQLI_BIND_INT,&$c2,MYSQLI_BIND_INT,&$c3,MYSQLI_BIND_INT,
- &$c4,MYSQLI_BIND_INT,&$c5,MYSQLI_BIND_INT,&$c6,MYSQLI_BIND_INT,
- &$c7, MYSQLI_BIND_INT);
- $c1 = -23;
- $c2 = 35999;
- $c3 = NULL;
- $c4 = -500;
- $c5 = -9999999;
- $c6 = -0;
- $c7 = 0;
-
- mysqli_execute($stmt);
- mysqli_stmt_close($stmt);
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(7) {
- [0]=>
- int(0)
- [1]=>
- int(35999)
- [2]=>
- NULL
- [3]=>
- int(-500)
- [4]=>
- int(-9999999)
- [5]=>
- int(0)
- [6]=>
- int(0)
-}
diff --git a/ext/mysqli/tests/024.phpt b/ext/mysqli/tests/024.phpt
deleted file mode 100644
index e31064a02a..0000000000
--- a/ext/mysqli/tests/024.phpt
+++ /dev/null
@@ -1,65 +0,0 @@
---TEST--
-mysqli bind_param/bind_result short values
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
- c2 smallint unsigned,
- c3 smallint,
- c4 smallint,
- c5 smallint,
- c6 smallint unsigned,
- c7 smallint)");
-
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
- mysqli_bind_param($stmt, &$c1,MYSQLI_BIND_INT,&$c2,MYSQLI_BIND_INT,&$c3,MYSQLI_BIND_INT,
- &$c4,MYSQLI_BIND_INT,&$c5,MYSQLI_BIND_INT,&$c6,MYSQLI_BIND_INT,
- &$c7, MYSQLI_BIND_INT);
-
- $c1 = -23;
- $c2 = 35999;
- $c3 = NULL;
- $c4 = -500;
- $c5 = -9999999;
- $c6 = -0;
- $c7 = 0;
-
- mysqli_execute($stmt);
- mysqli_stmt_close($stmt);
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(7) {
- [0]=>
- int(0)
- [1]=>
- int(35999)
- [2]=>
- NULL
- [3]=>
- int(-500)
- [4]=>
- int(-32768)
- [5]=>
- int(0)
- [6]=>
- int(0)
-}
diff --git a/ext/mysqli/tests/025.phpt b/ext/mysqli/tests/025.phpt
deleted file mode 100644
index f32ef143f2..0000000000
--- a/ext/mysqli/tests/025.phpt
+++ /dev/null
@@ -1,68 +0,0 @@
---TEST--
-mysqli bind_param/bind_result tinyint values
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint,
- c2 tinyint unsigned,
- c3 tinyint not NULL,
- c4 tinyint,
- c5 tinyint,
- c6 tinyint unsigned,
- c7 tinyint)");
-
- $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)");
- mysqli_bind_param($stmt,&$c1, MYSQLI_BIND_INT,&$c2, MYSQLI_BIND_INT,&$c3, MYSQLI_BIND_INT,&$c4, MYSQLI_BIND_INT,
- &$c5, MYSQLI_BIND_INT,&$c6, MYSQLI_BIND_INT,&$c7, MYSQLI_BIND_INT);
-
- $c1 = -23;
- $c2 = 300;
- $c3 = 0;
- $c4 = -100;
- $c5 = -127;
- $c6 = 30;
- $c7 = 0;
-
- mysqli_execute($stmt);
- mysqli_stmt_close($stmt);
-
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)");
-
- $c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL;
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-array(7) {
- [0]=>
- int(-23)
- [1]=>
- int(255)
- [2]=>
- int(0)
- [3]=>
- int(-100)
- [4]=>
- int(-127)
- [5]=>
- int(30)
- [6]=>
- int(0)
-}
diff --git a/ext/mysqli/tests/026.phpt b/ext/mysqli/tests/026.phpt
deleted file mode 100644
index ef1b66862d..0000000000
--- a/ext/mysqli/tests/026.phpt
+++ /dev/null
@@ -1,48 +0,0 @@
---TEST--
-mysqli bind_param/bind_result with send_long_data
---FILE--
-<?php
- $user = "root";
- $passwd = "";
-
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 varchar(10), c2 text)");
-
- $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
- mysqli_bind_param($stmt,&$c1, MYSQLI_BIND_STRING, &$c2, MYSQLI_BIND_SEND_DATA);
-
- $c1 = "Hello World";
-
- mysqli_send_long_data($stmt, 2, "This is the first sentence.");
- mysqli_send_long_data($stmt, 2, " And this is the second sentence.");
- mysqli_send_long_data($stmt, 2, " And finally this is the last sentence.");
-
- mysqli_execute($stmt);
- mysqli_stmt_close($stmt);
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_bind_result($stmt, &$d1, &$d2);
- mysqli_execute($stmt);
- mysqli_fetch($stmt);
-
- $test = array($d1,$d2);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
-
- mysqli_close($link);
-?>
---EXPECT--
-array(2) {
- [0]=>
- string(10) "Hello Worl"
- [1]=>
- string(99) "This is the first sentence. And this is the second sentence. And finally this is the last sentence."
-}
diff --git a/ext/mysqli/tests/027.phpt b/ext/mysqli/tests/027.phpt
deleted file mode 100644
index ae3657487d..0000000000
--- a/ext/mysqli/tests/027.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-function test: mysqli_stat
---FILE--
-<?php
- $user = "root";
- $passwd = "";
-
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- $status = mysqli_stat($link);
-
- $x = explode(' ', $status);
-
- var_dump(count($x));
-
- mysqli_close($link);
-?>
---EXPECT--
-int(10)
diff --git a/ext/mysqli/tests/028.phpt b/ext/mysqli/tests/028.phpt
deleted file mode 100644
index d9e848f2ba..0000000000
--- a/ext/mysqli/tests/028.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-function test: mysqli_character_set_name
---FILE--
-<?php
- $user = "root";
- $passwd = "";
-
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- $cset = substr(mysqli_character_set_name($link),0,6);
-
- var_dump($cset);
-
- mysqli_close($link);
-?>
---EXPECT--
-string(6) "latin1"
diff --git a/ext/mysqli/tests/029.phpt b/ext/mysqli/tests/029.phpt
deleted file mode 100644
index 7680b228e9..0000000000
--- a/ext/mysqli/tests/029.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-function test: mysqli_affected_rows
---FILE--
-<?php
- $user = "root";
- $passwd = "";
-
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link, "drop table if exists general_test");
- mysqli_query($link, "create table general_test (a int)");
- mysqli_query($link, "insert into general_test values (1),(2),(3)");
-
- $afc = mysqli_affected_rows($link);
-
- var_dump($afc);
-
- mysqli_close($link);
-?>
---EXPECT--
-int(3)
diff --git a/ext/mysqli/tests/030.phpt b/ext/mysqli/tests/030.phpt
deleted file mode 100644
index da87218627..0000000000
--- a/ext/mysqli/tests/030.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-function test: mysqli_errno
---FILE--
-<?php
- $user = "root";
- $passwd = "";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
- $errno = mysqli_errno($link);
- var_dump($errno);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link, "select * from non_exisiting_table");
- $errno = mysqli_errno($link);
-
- var_dump($errno);
-
- mysqli_close($link);
-?>
---EXPECT--
-int(0)
-int(1146)
diff --git a/ext/mysqli/tests/031.phpt b/ext/mysqli/tests/031.phpt
deleted file mode 100644
index 61bfb5bb32..0000000000
--- a/ext/mysqli/tests/031.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-function test: mysqli_error
---FILE--
-<?php
- $user = "root";
- $passwd = "";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
- $error = mysqli_error($link);
- var_dump($error);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link, "select * from non_exisiting_table");
- $error = mysqli_error($link);
-
- var_dump($error);
-
- mysqli_close($link);
-?>
---EXPECT--
-string(0) ""
-string(46) "Table 'test.non_exisiting_table' doesn't exist"
diff --git a/ext/mysqli/tests/032.phpt b/ext/mysqli/tests/032.phpt
deleted file mode 100644
index 02564834d8..0000000000
--- a/ext/mysqli/tests/032.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-function test: mysqli_info
---FILE--
-<?php
- $user = "root";
- $passwd = "";
-
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link, "drop table if exists general_test");
- mysqli_query($link, "create table general_test (a int)");
- mysqli_query($link, "insert into general_test values (1),(2),(3)");
-
- $afc = mysqli_info($link);
-
- var_dump($afc);
-
- mysqli_close($link);
-?>
---EXPECT--
-string(38) "Records: 3 Duplicates: 0 Warnings: 0"
diff --git a/ext/mysqli/tests/033.phpt b/ext/mysqli/tests/033.phpt
deleted file mode 100644
index e3d8d159d0..0000000000
--- a/ext/mysqli/tests/033.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-function test: mysqli_get_host_info
---FILE--
-<?php
- $user = "root";
- $passwd = "";
-
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- $hinfo = mysqli_get_host_info($link);
-
- var_dump($hinfo);
-
- mysqli_close($link);
-?>
---EXPECT--
-string(25) "Localhost via UNIX socket"
diff --git a/ext/mysqli/tests/034.phpt b/ext/mysqli/tests/034.phpt
deleted file mode 100644
index e347586a36..0000000000
--- a/ext/mysqli/tests/034.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-function test: mysqli_get_proto_info
---FILE--
-<?php
- $user = "root";
- $passwd = "";
-
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- $pinfo = mysqli_get_proto_info($link);
-
- var_dump($pinfo);
-
- mysqli_close($link);
-?>
---EXPECT--
-int(10)
diff --git a/ext/mysqli/tests/035.phpt b/ext/mysqli/tests/035.phpt
deleted file mode 100644
index 34af7c0a56..0000000000
--- a/ext/mysqli/tests/035.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-function test: mysqli_get_server_info
---FILE--
-<?php
- $user = "root";
- $passwd = "";
-
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- $sinfo = substr(mysqli_get_server_info($link),0,1);
-
- var_dump($sinfo);
-
- mysqli_close($link);
-?>
---EXPECT--
-string(1) "4"
diff --git a/ext/mysqli/tests/036.phpt b/ext/mysqli/tests/036.phpt
deleted file mode 100644
index 080c6e32e4..0000000000
--- a/ext/mysqli/tests/036.phpt
+++ /dev/null
@@ -1,43 +0,0 @@
---TEST--
-function test: mysqli_insert_id()
---FILE--
-<?php
-
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link, "DROP TABLE IF EXISTS t036");
-
- mysqli_query($link, "CREATE TABLE t036 (a bigint not null auto_increment primary key, b varchar(10))");
-
-
- mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo1')");
- $test[] = mysqli_insert_id($link);
-
- /* we have to insert more values, cause lexer sets auto_increment to max_int
- see mysql bug #54. So we don't check for the value, only for type (which must
- be type string)
- */
-
- mysqli_query($link, "ALTER TABLE t036 AUTO_INCREMENT=9999999999999998");
- mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo2')");
- mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo3')");
- mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo4')");
- $x = mysqli_insert_id($link);
- $test[] = is_string($x);
-
- var_dump($test);
-
- mysqli_close($link);
-?>
---EXPECT--
-array(2) {
- [0]=>
- int(1)
- [1]=>
- bool(true)
-}
diff --git a/ext/mysqli/tests/037.phpt b/ext/mysqli/tests/037.phpt
deleted file mode 100644
index f8b8a13f1a..0000000000
--- a/ext/mysqli/tests/037.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-function test: mysqli_field_count()
---FILE--
-<?php
-
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link, "DROP TABLE IF EXISTS test_result");
-
- mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10))");
-
- mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
- $ir[] = mysqli_field_count($link);
-
- mysqli_real_query($link, "SELECT * FROM test_result");
- $ir[] = mysqli_field_count($link);
-
-
- var_dump($ir);
-
- mysqli_close($link);
-?>
---EXPECT--
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(2)
-}
diff --git a/ext/mysqli/tests/038.phpt b/ext/mysqli/tests/038.phpt
deleted file mode 100644
index 858b3e3393..0000000000
--- a/ext/mysqli/tests/038.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-function test: mysqli_num_fields()
---FILE--
-<?php
-
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link, "DROP TABLE IF EXISTS test_result");
-
- mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10))");
-
- mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
-
- mysqli_real_query($link, "SELECT * FROM test_result");
- if (mysqli_field_count($link)) {
- $result = mysqli_store_result($link);
- $num = mysqli_num_fields($result);
- mysqli_free_result($result);
- }
-
- var_dump($num);
-
- mysqli_close($link);
-?>
---EXPECT--
-int(2)
diff --git a/ext/mysqli/tests/039.phpt b/ext/mysqli/tests/039.phpt
deleted file mode 100644
index 6ddb37bc5f..0000000000
--- a/ext/mysqli/tests/039.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-function test: mysqli_num_fields() 2
---FILE--
-<?php
-
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_real_query($link, "SHOW VARIABLES");
-
- if (mysqli_field_count($link)) {
- $result = mysqli_store_result($link);
- $num = mysqli_num_fields($result);
- mysqli_free_result($result);
- }
-
- var_dump($num);
-
- mysqli_close($link);
-?>
---EXPECT--
-int(2)
diff --git a/ext/mysqli/tests/040.phpt b/ext/mysqli/tests/040.phpt
deleted file mode 100644
index 477e2a5274..0000000000
--- a/ext/mysqli/tests/040.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-function test: mysqli_num_rows()
---FILE--
-<?php
-
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link, "DROP TABLE IF EXISTS test_result");
-
- mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10))");
-
- mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
-
- mysqli_real_query($link, "SELECT * FROM test_result");
- if (mysqli_field_count($link)) {
- $result = mysqli_store_result($link);
- $num = mysqli_num_rows($result);
- mysqli_free_result($result);
- }
-
- var_dump($num);
-
- mysqli_close($link);
-?>
---EXPECT--
-int(1)
diff --git a/ext/mysqli/tests/041.phpt b/ext/mysqli/tests/041.phpt
deleted file mode 100644
index 6fb8ee7e3f..0000000000
--- a/ext/mysqli/tests/041.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-function test: mysqli_warning_count()
---FILE--
-<?php
-
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link, "DROP TABLE IF EXISTS test_warnings");
-
- mysqli_query($link, "CREATE TABLE test_warnings (a int not null");
-
- mysqli_query($link, "INSERT INTO test_warnings VALUES (1),(2),(NULL)");
- $num = mysqli_warning_count($link);
- var_dump($num);
-
- mysqli_close($link);
-?>
---EXPECT--
-int(1)
diff --git a/ext/mysqli/tests/042.phpt b/ext/mysqli/tests/042.phpt
deleted file mode 100644
index 58580c631a..0000000000
--- a/ext/mysqli/tests/042.phpt
+++ /dev/null
@@ -1,61 +0,0 @@
---TEST--
-mysqli_fetch_object
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
- c2 smallint unsigned,
- c3 smallint,
- c4 smallint,
- c5 smallint,
- c6 smallint unsigned,
- c7 smallint)");
-
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
- mysqli_bind_param($stmt, &$c1,MYSQLI_BIND_INT,&$c2,MYSQLI_BIND_INT,&$c3,MYSQLI_BIND_INT,
- &$c4,MYSQLI_BIND_INT,&$c5,MYSQLI_BIND_INT,&$c6,MYSQLI_BIND_INT,
- &$c7, MYSQLI_BIND_INT);
-
- $c1 = -23;
- $c2 = 35999;
- $c3 = NULL;
- $c4 = -500;
- $c5 = -9999999;
- $c6 = -0;
- $c7 = 0;
-
- mysqli_execute($stmt);
- mysqli_stmt_close($stmt);
-
- $result = mysqli_query($link, "SELECT * FROM test_bind_fetch");
- $test = mysqli_fetch_object($result);
- mysqli_free_result($result);
-
- var_dump($test);
-
- mysqli_close($link);
-?>
---EXPECTF--
-object(stdClass)#%d (7) {
- ["c1"]=>
- string(1) "0"
- ["c2"]=>
- string(5) "35999"
- ["c3"]=>
- NULL
- ["c4"]=>
- string(4) "-500"
- ["c5"]=>
- string(6) "-32768"
- ["c6"]=>
- string(1) "0"
- ["c7"]=>
- string(1) "0"
-}
diff --git a/ext/mysqli/tests/043.phpt b/ext/mysqli/tests/043.phpt
deleted file mode 100644
index 9c02c32c1a..0000000000
--- a/ext/mysqli/tests/043.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-mysqli_bind_param (UPDATE)
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_update");
- mysqli_query($link,"CREATE TABLE test_update(a varchar(10),
- b int)");
-
- mysqli_query($link, "INSERT INTO test_update VALUES ('foo', 2)");
-
- $stmt = mysqli_prepare($link, "UPDATE test_update SET a=?,b=? WHERE b=?");
- mysqli_bind_param($stmt, &$c1,MYSQLI_BIND_STRING,&$c2,MYSQLI_BIND_INT, &$c3, MYSQLI_BIND_INT);
-
- $c1 = "Rasmus";
- $c2 = 1;
- $c3 = 2;
-
- mysqli_execute($stmt);
- mysqli_stmt_close($stmt);
-
- $result = mysqli_query($link, "SELECT concat(a, ' is No. ', b) FROM test_update");
- $test = mysqli_fetch_row($result);
- mysqli_free_result($result);
-
- var_dump($test);
-
- mysqli_close($link);
-?>
---EXPECT--
-array(1) {
- [0]=>
- string(15) "Rasmus is No. 1"
-}
diff --git a/ext/mysqli/tests/044.phpt b/ext/mysqli/tests/044.phpt
deleted file mode 100644
index 5f72f65e38..0000000000
--- a/ext/mysqli/tests/044.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-mysqli_get_server_version
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- $i = mysqli_get_server_version($link);
-
- $test = $i / $i;
-
- var_dump($test);
-
- mysqli_close($link);
-?>
---EXPECT--
-int(1)
diff --git a/ext/mysqli/tests/045.phpt b/ext/mysqli/tests/045.phpt
deleted file mode 100644
index 5ca0f2ae02..0000000000
--- a/ext/mysqli/tests/045.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-mysqli_bind_result (SHOW)
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- $stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'");
-
- mysqli_execute($stmt);
- mysqli_bind_result($stmt, &$c1, &$c2);
- mysqli_fetch($stmt);
- mysqli_stmt_close($stmt);
- $test = array ($c1,$c2);
-
- var_dump($test);
-
- mysqli_close($link);
-?>
---EXPECT--
-array(2) {
- [0]=>
- string(4) "port"
- [1]=>
- string(4) "3306"
-}
diff --git a/ext/mysqli/tests/046.phpt b/ext/mysqli/tests/046.phpt
deleted file mode 100644
index d4a93ca277..0000000000
--- a/ext/mysqli/tests/046.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-mysqli_stmt_affected_rows (delete)
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
- mysqli_query($link, "CREATE TABLE test_affected (foo int)");
-
- mysqli_query($link, "INSERT INTO test_affected VALUES (1),(2),(3),(4),(5)");
-
- $stmt = mysqli_prepare($link, "DELETE FROM test_affected WHERE foo=?");
- mysqli_bind_param($stmt, &$c1, MYSQLI_BIND_INT);
-
- $c1 = 2;
-
- mysqli_execute($stmt);
- $x = mysqli_stmt_affected_rows($stmt);
-
- mysqli_stmt_close($stmt);
- var_dump($x==1);
-
- mysqli_close($link);
-?>
---EXPECT--
-bool(true)
diff --git a/ext/mysqli/tests/047.phpt b/ext/mysqli/tests/047.phpt
deleted file mode 100644
index 0a11e0cf02..0000000000
--- a/ext/mysqli/tests/047.phpt
+++ /dev/null
@@ -1,73 +0,0 @@
---TEST--
-mysqli_prepare_result
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
- mysqli_query($link, "CREATE TABLE test_affected (foo int, bar varchar(10))");
-
- mysqli_query($link, "INSERT INTO test_affected VALUES (1, 'Zak'),(2, 'Greant')");
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_affected");
- mysqli_execute($stmt);
- $result = mysqli_prepare_result($stmt);
-
- $fields = mysqli_fetch_fields($result);
- mysqli_free_result($result);
-
- var_dump($fields);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECTF--
-array(2) {
- [0]=>
- object(stdClass)#%d (9) {
- ["name"]=>
- string(3) "foo"
- ["orgname"]=>
- string(3) "foo"
- ["table"]=>
- string(13) "test_affected"
- ["orgtable"]=>
- string(13) "test_affected"
- ["def"]=>
- string(0) ""
- ["max_length"]=>
- int(0)
- ["flags"]=>
- int(32768)
- ["type"]=>
- int(3)
- ["decimals"]=>
- int(0)
- }
- [1]=>
- object(stdClass)#%d (9) {
- ["name"]=>
- string(3) "bar"
- ["orgname"]=>
- string(3) "bar"
- ["table"]=>
- string(13) "test_affected"
- ["orgtable"]=>
- string(13) "test_affected"
- ["def"]=>
- string(0) ""
- ["max_length"]=>
- int(0)
- ["flags"]=>
- int(0)
- ["type"]=>
- int(253)
- ["decimals"]=>
- int(0)
- }
-}
diff --git a/ext/mysqli/tests/048.phpt b/ext/mysqli/tests/048.phpt
deleted file mode 100644
index d8baf2041c..0000000000
--- a/ext/mysqli/tests/048.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-mysqli bind_result (OO-Style)
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $mysql = mysqli_connect("localhost", $user, $passwd);
-
- $mysql->select_db("test");
- $mysql->query("DROP TABLE IF EXISTS test_fetch_null");
-
- $mysql->query("CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint,
- col3 int, col4 bigint,
- col5 float, col6 double,
- col7 date, col8 time,
- col9 varbinary(10),
- col10 varchar(50),
- col11 char(20))");
-
- $mysql->query("INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
-
- $stmt = $mysql->prepare("SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null");
- $stmt->bind_result(&$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7, &$c8, &$c9, &$c10, &$c11);
- $stmt->execute();
-
- $stmt->fetch();
-
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
-
- var_dump($test);
-
- $stmt->close();
- $mysql->close();
-?>
---EXPECT--
-array(11) {
- [0]=>
- int(1)
- [1]=>
- NULL
- [2]=>
- NULL
- [3]=>
- NULL
- [4]=>
- NULL
- [5]=>
- NULL
- [6]=>
- NULL
- [7]=>
- NULL
- [8]=>
- NULL
- [9]=>
- string(4) "foo1"
- [10]=>
- string(4) "1000"
-}
diff --git a/ext/mysqli/tests/049.phpt b/ext/mysqli/tests/049.phpt
deleted file mode 100644
index 04e705de6e..0000000000
--- a/ext/mysqli/tests/049.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-mysql_fetch_row (OO-Style)
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $mysql = mysqli_connect("localhost", $user, $passwd);
-
- $mysql->select_db("test");
- $result = $mysql->query("SELECT CURRENT_USER()");
- $row = $result->fetch_row();
- $result->close();
-
- var_dump($row);
-
- $mysql->close();
-?>
---EXPECT--
-array(1) {
- [0]=>
- string(14) "root@localhost"
-}
diff --git a/ext/mysqli/tests/050.phpt b/ext/mysqli/tests/050.phpt
deleted file mode 100644
index 9ab5d346f8..0000000000
--- a/ext/mysqli/tests/050.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-non freed statement test
---FILE--
-<?php
- include "connect.inc";
-
- /************************
- * non freed stamement
- ************************/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- $stmt = mysqli_prepare($link, "SELECT CURRENT_USER()");
- mysqli_execute($stmt);
-
- mysqli_close($link);
- printf("Ok\n");
-?>
---EXPECT--
-Ok
diff --git a/ext/mysqli/tests/051.phpt b/ext/mysqli/tests/051.phpt
deleted file mode 100644
index dde734a1e0..0000000000
--- a/ext/mysqli/tests/051.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-free statement after close
---FILE--
-<?php
- include "connect.inc";
-
- /************************
- * free statement after close
- ************************/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- $stmt1 = mysqli_prepare($link, "SELECT CURRENT_USER()");
- mysqli_execute($stmt1);
-
- mysqli_close($link);
- @mysqli_stmt_close($stmt1);
- printf("Ok\n");
-?>
---EXPECT--
-Ok
diff --git a/ext/mysqli/tests/052.phpt b/ext/mysqli/tests/052.phpt
deleted file mode 100644
index 4ae9b12c50..0000000000
--- a/ext/mysqli/tests/052.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-call statement after close
---FILE--
-<?php
- include "connect.inc";
-
- /************************
- * statement call after close
- ************************/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()");
-
- mysqli_close($link);
- @mysqli_execute($stmt2);
- @mysqli_stmt_close($stmt2);
- printf("Ok\n");
-?>
---EXPECT--
-Ok
diff --git a/ext/mysqli/tests/053.phpt b/ext/mysqli/tests/053.phpt
deleted file mode 100644
index f542d0f099..0000000000
--- a/ext/mysqli/tests/053.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-not freed resultset
---FILE--
-<?php
- include "connect.inc";
-
- /************************
- * non freed resultset
- ************************/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- $result = mysqli_query($link, "SELECT CURRENT_USER()");
- mysqli_close($link);
- printf("Ok\n");
-
-?>
---EXPECT--
-Ok
diff --git a/ext/mysqli/tests/054.phpt b/ext/mysqli/tests/054.phpt
deleted file mode 100644
index eab207db4d..0000000000
--- a/ext/mysqli/tests/054.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-free resultset after close
---FILE--
-<?php
- include "connect.inc";
-
- /************************
- * free resultset after close
- ************************/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- $result1 = mysqli_query($link, "SELECT CURRENT_USER()");
- mysqli_close($link);
- mysqli_free_result($result1);
- printf("Ok\n");
-?>
---EXPECT--
-Ok
diff --git a/ext/mysqli/tests/055.phpt b/ext/mysqli/tests/055.phpt
deleted file mode 100644
index e777bcfc99..0000000000
--- a/ext/mysqli/tests/055.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-free nothing
---FILE--
-<?php
- include "connect.inc";
-
- /************************
- * don't free anything
- ************************/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- $result2 = mysqli_query($link, "SELECT CURRENT_USER()");
- $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()");
- printf("Ok\n");
-?>
---EXPECT--
-Ok
diff --git a/ext/mysqli/tests/056.phpt b/ext/mysqli/tests/056.phpt
deleted file mode 100644
index cee7df1e5f..0000000000
--- a/ext/mysqli/tests/056.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-extend mysqli
---FILE--
-<?php
- include "connect.inc";
-
- class foobar extends mysqli {
- function test () {
- return ("I like MySQL 4.1");
- }
- }
-
- $foo = new foobar();
- $foo->connect("localhost", $user, $passwd);
- $foo->close();
- printf("%s\n", $foo->test());
-?>
---EXPECT--
-I like MySQL 4.1
diff --git a/ext/mysqli/tests/057.phpt b/ext/mysqli/tests/057.phpt
deleted file mode 100644
index a7333a0d93..0000000000
--- a/ext/mysqli/tests/057.phpt
+++ /dev/null
@@ -1,52 +0,0 @@
---TEST--
-mysqli_prepare_result
---FILE--
-<?php
- include "connect.inc";
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect("localhost", $user, $passwd);
-
- mysqli_select_db($link, "test");
-
- mysqli_query($link,"DROP TABLE IF EXISTS test_store_result");
- mysqli_query($link,"CREATE TABLE test_store_result (a int)");
-
- mysqli_query($link, "INSERT INTO test_store_result VALUES (1),(2),(3)");
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
- mysqli_execute($stmt);
-
- /* this should produce an out of sync error */
- if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) {
- mysqli_free_result($result);
- printf ("Query ok\n");
- }
- mysqli_stmt_close($stmt);
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
- mysqli_execute($stmt);
- $result1 = mysqli_prepare_result($stmt);
- mysqli_stmt_store_result($stmt);
-
- printf ("Rows: %d\n", mysqli_stmt_affected_rows($stmt));
-
- /* this should show an error, cause results are not buffered */
- if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) {
- $row = mysqli_fetch_row($result);
- mysqli_free_result($result);
- }
-
-
- var_dump($row);
-
- mysqli_free_result($result1);
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-?>
---EXPECT--
-Rows: 3
-array(1) {
- [0]=>
- string(1) "1"
-}
diff --git a/ext/mysqli/tests/connect.inc b/ext/mysqli/tests/connect.inc
deleted file mode 100644
index aa1d30a17e..0000000000
--- a/ext/mysqli/tests/connect.inc
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
- /* default values are localhost, root and empty password
- Change the values if you use another configuration */
-
- $host = "localhost";
- $user = "root";
- $passwd = "";
-
-?>
diff --git a/ext/ncurses/CREDITS b/ext/ncurses/CREDITS
deleted file mode 100644
index 312b522ef7..0000000000
--- a/ext/ncurses/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-ncurses
-Ilia Alshanetsky, Wez Furlong, Hartmut Holzgraefe, Georg Richter
diff --git a/ext/ncurses/EXPERIMENTAL b/ext/ncurses/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/ncurses/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/ncurses/c-prototypes b/ext/ncurses/c-prototypes
deleted file mode 100644
index c98bd29730..0000000000
--- a/ext/ncurses/c-prototypes
+++ /dev/null
@@ -1,263 +0,0 @@
-+ int addch(int);
-+ int addchnstr(int *,int);
-+ int addchstr(int *);
-+ int addnstr(string,int);
-+ int addstr(string);
-+ int assume_default_colors (int,int);
-- int attr_get(int *,int *,void *);
-- int attr_off(int,void *);
-- int attr_on(int,void *);
-- int attr_set(int,int,void *);
-+ int attroff(int);
-+ int attron(int);
-+ int attrset(int);
-+ int baudrate(void);
-+ int beep(void);
-+ int bkgd(int);
-+ void bkgdset(int);
-+ int border(int,int,int,int,int,int,int,int);
-- int box(resource,int,int);
-+ bool can_change_color(void);
-+ int cbreak(void);
-- int chgat(int,int,int,void *);
-+ int clear(void);
-- int clearok(resource,bool);
-+ int clrtobot(void);
-+ int clrtoeol(void);
-- int color_content(int,int*,int*,int*);
-+ int color_set(int,void*);
-- int copywin(resource,resource,int,int,int,int,int,int,int);
-+ int curs_set(int);
-+ int def_prog_mode(void);
-+ int def_shell_mode(void);
-+ int define_key (string,int);
-+ int delay_output(int);
-+ int delch(void);
-+ int deleteln(void);
-- void delscreen(SCREEN *);
-+ int delwin(resource);
-+ int doupdate(void);
-+ int echo(void);
-+ int echochar(int);
-+ int endwin(void);
-+ int erase(void);
-+ char erasechar(void);
-+ void filter(void);
-+ int flash(void);
-+ int flushinp(void);
-- int getbkgd(resource);
-+ int getch(void);
-- int getmouse(MEVENT *);
-- int getnstr(string,int);
-- int getstr(string);
-+ int halfdelay(int);
-+ bool has_colors(void);
-+ bool has_ic(void);
-+ bool has_il(void);
-+ int has_key(int); /* do we have given key? */
-+ int hline(int,int);
-- void idcok(resource,bool);
-- int idlok(resource,bool);
-- void immedok(resource,bool);
-+ int inch(void);
--ma int inchnstr(int *,int);
-- int inchstr(int *);
-+ int init_color(int,int,int,int);
-+ int init_pair(int,int,int);
-- int innstr(string,int);
-+ int insch(int);
-+ int insdelln(int);
-+ int insertln(void);
-- int insnstr(string,int);
-+ int insstr(string);
-+ int instr(string);
-- int intrflush(resource,bool);
-- bool is_linetouched(resource,int);
-- bool is_wintouched(resource);
-+ bool isendwin(void);
-- int keyok (int,bool);
-- int keypad(resource,bool);
-+ char killchar(void);
-- int leaveok(resource,bool);
-- int mcprint(string,int); /* direct data to printer */
-- int meta(resource,bool);
-+ int mouseinterval(int);
-- mmask_t mousemask(mmask_t,mmask_t *);
-+ int move(int,int);
-+ int mvaddch(int,int,int);
-+ int mvaddchnstr(int,int,int *,int);
-+ int mvaddchstr(int,int,int *);
-+ int mvaddnstr(int,int,string,int);
-+ int mvaddstr(int,int,string);
-- int mvchgat(int,int,int,int,int,void *);
-+ int mvcur(int,int,int,int);
-+ int mvdelch(int,int);
-- int mvderwin(resource,int,int);
-+ int mvgetch(int,int);
-- int mvgetnstr(int,int,string,int);
-- int mvgetstr(int,int,string);
-+ int mvhline(int,int,int,int);
-+ int mvinch(int,int);
-- int mvinchnstr(int,int,int *,int);
-- int mvinchstr(int,int,int *);
-- int mvinnstr(int,int,string,int);
-- int mvinsch(int,int,int);
-- int mvinsnstr(int,int,string,int);
-- int mvinsstr(int,int,string);
-- int mvinstr(int,int,string);
-- int mvprintw(int,int, string,...);
-- int mvscanw(int,int, string,...);
-- int mvwaddch(resource,int,int,int);
-- int mvwaddchnstr(resource,int,int,int *,int);
-- int mvwaddchstr(resource,int,int,int *);
-- int mvwaddnstr(resource,int,int,string,int);
-- int mvwaddstr(resource,int,int,string);
-- int mvwchgat(resource,int,int,int,int,int,void *);
-- int mvwdelch(resource,int,int);
-- int mvwgetch(resource,int,int);
-- int mvwgetnstr(resource,int,int,string,int);
-- int mvwgetstr(resource,int,int,string);
-- int mvwhline(resource,int,int,int,int);
-- int mvwin(resource,int,int);
-- int mvwinch(resource,int,int);
-- int mvwinchstr(resource,int,int,int *);
-- int mvwinnstr(resource,int,int,string,int);
-- int mvwinsch(resource,int,int,int);
-- int mvwinsnstr(resource,int,int,string,int);
-- int mvwinsstr(resource,int,int,string);
-- int mvwinstr(resource,int,int,string);
-- int mvwinchnstr(resource,int,int,int *,int);
-- int mvwprintw(resource,int,int, string,...);
-- int mvwscanw(resource,int,int, string,...);
-- int mvwvline(resource,int,int,int,int);
-+ int napms(int);
-+ int nl(void);
-+ int nocbreak(void);
-- int nodelay(resource,bool);
-+ int noecho(void);
-+ int nonl(void);
-+ void noqiflush(void);
-+ int noraw(void);
-- int notimeout(resource,bool);
-- int overlay(resource,resource);
-- int overwrite(resource,resource);
-- int pair_content(int,int*,int*);
-- int pechochar(resource,int);
-- int pnoutrefresh(resource,int,int,int,int,int,int);
-- int prefresh(resource,int,int,int,int,int,int);
-- int printw( string,...);
-+ int putp(string);
-- int putwin(resource,FILE *);
-+ void qiflush(void);
-+ int raw(void);
-- int redrawwin(resource);
-+ int refresh(void);
-- int reset_prog_mode(void);
-- int reset_shell_mode(void);
-+ int resetty(void);
-- int resizeterm (int,int);
-- int ripoffline(int,int (*init)(resource,int));
-+ int savetty(void);
-- int scanw( string,...);
-+ int scr_dump(string);
-+ int scr_init(string);
-+ int scr_restore(string);
-+ int scr_set(string);
-+ int scrl(int);
-- int scroll(resource);
-- int scrollok(resource,bool);
-- int setscrreg(int,int);
-+ int slk_attroff(int);
-- int slk_attr_off(int,void *); /* generated:WIDEC */
-+ int slk_attron(int);
-- int slk_attr_on(int,void*); /* generated:WIDEC */
-+ int slk_attrset(int);
-+ int slk_attr(void);
-- int slk_attr_set(int,int,void*);
-+ int slk_clear(void);
-+ int slk_color(int);
-+ int slk_init(int);
-+ int slk_noutrefresh(void);
-- int slk_refresh(void);
-- int slk_restore(void);
-- int slk_set(int,string,int);
-- int slk_touch(void);
-+ int standend(void);
-+ int standout(void);
-+ int start_color(void);
-- int syncok(resource,bool);
-+ int termattrs(void);
-- int tigetflag( string);
-- int tigetnum( string);
-+ void timeout(int);
-+ int typeahead(int);
-+ int ungetch(int);
-- int ungetmouse(MEVENT *);
-- int untouchwin(resource);
-+ int use_default_colors (void);
-+ void use_env(bool);
-+ int use_extended_names (bool);
-+ int vidattr(int);
-- int vidputs(int,int (*)(int));
-- int vline(int,int);
-- int vw_printw(resource, string,va_list);
-- int vw_scanw(resource, string,va_list);
-- int vwprintw(resource, string,va_list);
-- int vwscanw(resource, string,va_list);
-- int waddch(resource,int);
-- int waddchnstr(resource,int *const,int);
-- int waddchstr(resource,int *);
-- int waddnstr(resource,stringconst,int);
-- int waddstr(resource,string);
-- int wattr_get(resource,int *,int *,void *);
-- int wattr_off(resource, int,void *);
-- int wattr_on(resource, int,void *);
-- int wattr_set(resource,int,int,void *);
-- int wattroff(resource,int);
-- int wattron(resource,int);
-- int wattrset(resource,int);
-- int wbkgd(resource,int);
-- void wbkgdset(resource,int);
-- int wborder(resource,int,int,int,int,int,int,int,int);
-- int wchgat(resource,int,int,int,void *);
-- int wclear(resource);
-- int wclrtobot(resource);
-- int wclrtoeol(resource);
-- int wcolor_set(resource,int,void*);
-- void wcursyncup(resource);
-- int wdelch(resource);
-- int wdeleteln(resource);
-- int wechochar(resource,int);
-- bool wenclose(resource,int,int);
-- int werase(resource);
-- int wgetch(resource);
-- int wgetnstr(resource,string,int);
-- int wgetstr(resource,string);
-- int whline(resource,int,int);
-- int winch(resource);
-- int winchnstr(resource,int *,int);
-- int winchstr(resource,int *);
-- int winnstr(resource,string,int);
-- int winsch(resource,int);
-- int winsdelln(resource,int);
-- int winsertln(resource);
-- int winsnstr(resource,string,int);
-- int winsstr(resource,string);
-- int winstr(resource,string);
-- bool wmouse_trafo(resource win,int* y,int* x,bool to_screen);
-- int wmove(resource,int,int);
-- int wnoutrefresh(resource);
-- int wprintw(resource, string,...);
-- int wredrawln(resource,int,int);
-- int wrefresh(resource);
-- int wresize (resource,int,int);
-- int wscanw(resource,string,...);
-- int wscrl(resource,int);
-- int wsetscrreg(resource,int,int);
-- int wstandend(resource);
-- int wstandout(resource);
-- void wsyncdown(resource);
-- void wsyncup(resource);
-- void wtimeout(resource,int);
-- int wtouchln(resource,int,int,int);
-- int wvline(resource,int,int);
diff --git a/ext/ncurses/config.m4 b/ext/ncurses/config.m4
deleted file mode 100644
index 1bcab68f37..0000000000
--- a/ext/ncurses/config.m4
+++ /dev/null
@@ -1,65 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(ncurses, for ncurses support,
-[ --with-ncurses[=DIR] Include ncurses support (CLI/CGI only).])
-
-if test "$PHP_NCURSES" != "no"; then
-
- # --with-ncurses -> check with-path
- SEARCH_PATH="/usr/local /usr"
- SEARCH_FOR="/include/curses.h"
-
- if test -r $PHP_NCURSES/; then # path given as parameter
- NCURSES_DIR=$PHP_NCURSES
- else # search default path list
- AC_MSG_CHECKING(for ncurses files in default path)
- for i in $SEARCH_PATH ; do
- if test -r $i/$SEARCH_FOR; then
- NCURSES_DIR=$i
- AC_MSG_RESULT(found in $i)
- fi
- done
- fi
-
- if test -z "$NCURSES_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the ncurses distribution)
- fi
-
- # --with-ncurses -> add include path
- PHP_ADD_INCLUDE($NCURSES_DIR/include)
-
- # --with-ncurses -> chech for lib and symbol presence
- LIBNAME=ncurses
- LIBSYMBOL=initscr
-
- PHP_CHECK_LIBRARY($LIBNAME, $LIBSYMBOL, [
- AC_DEFINE(HAVE_NCURSESLIB,1,[ ])
-
- PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $NCURSES_DIR/lib, NCURSES_SHARED_LIBADD)
-
- PHP_CHECK_LIBRARY(panel, new_panel, [
- AC_DEFINE(HAVE_NCURSES_PANEL,1,[ ])
- PHP_ADD_LIBRARY_WITH_PATH(panel, $NCURSES_DIR/lib, NCURSES_SHARED_LIBADD)
- ], [
- ], [ -L$NCURSES_DIR/lib -l$LIBNAME -lm
- ])
-
-
- ], [
- AC_MSG_ERROR(Wrong ncurses lib version or lib not found)
- ], [
- -L$NCURSES_DIR/lib -lm
- ])
-
- AC_CHECK_LIB($LIBNAME, color_set, [AC_DEFINE(HAVE_NCURSES_COLOR_SET, 1, [ ])])
- AC_CHECK_LIB($LIBNAME, slk_color, [AC_DEFINE(HAVE_NCURSES_SLK_COLOR, 1, [ ])])
- AC_CHECK_LIB($LIBNAME, asume_default_colors, [AC_DEFINE(HAVE_NCURSES_ASSUME_DEFAULT_COLORS, 1, [ ])])
- AC_CHECK_LIB($LIBNAME, use_extended_names, [AC_DEFINE(HAVE_NCURSES_USE_EXTENDED_NAMES, 1, [ ])])
-
- PHP_NEW_EXTENSION(ncurses, ncurses.c ncurses_fe.c ncurses_functions.c, $ext_shared, cli)
- PHP_SUBST(NCURSES_SHARED_LIBADD)
-
-fi
diff --git a/ext/ncurses/example1.php b/ext/ncurses/example1.php
deleted file mode 100644
index ca6977d95e..0000000000
--- a/ext/ncurses/example1.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-$n=0;
-ncurses_init();
-if(ncurses_has_colors()){
-ncurses_start_color();
- ncurses_init_pair(1,NCURSES_COLOR_RED,NCURSES_COLOR_BLACK);
- ncurses_init_pair(2,NCURSES_COLOR_GREEN,NCURSES_COLOR_BLACK);
- ncurses_init_pair(3,NCURSES_COLOR_YELLOW,NCURSES_COLOR_BLACK);
- ncurses_init_pair(4,NCURSES_COLOR_BLUE,NCURSES_COLOR_BLACK);
- ncurses_init_pair(5,NCURSES_COLOR_MAGENTA,NCURSES_COLOR_BLACK);
- ncurses_init_pair(6,NCURSES_COLOR_CYAN,NCURSES_COLOR_BLACK);
- ncurses_init_pair(7,NCURSES_COLOR_WHITE,NCURSES_COLOR_BLACK);
-}
-while(1){
-for ($x=0; $x<80; $x++) {
-for ($y=0; $y<24; $y++) {
- $n++;
- ncurses_move($y,$x);
- ncurses_addch($n+64);
- ncurses_color_set($n%8);
- ncurses_refresh();
- if($n>26)$n=0;
-}
-}
-ncurses_getch();
-}
-?>
-
diff --git a/ext/ncurses/ncurses.c b/ext/ncurses/ncurses.c
deleted file mode 100644
index 58096c80cf..0000000000
--- a/ext/ncurses/ncurses.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_ncurses.h"
-#include "ext/standard/info.h"
-
-ZEND_DECLARE_MODULE_GLOBALS(ncurses)
-
-/* True global resources - no need for thread safety here */
-int le_ncurses_windows;
-#if HAVE_NCURSES_PANEL
-int le_ncurses_panels;
-#endif
-
-static void ncurses_destruct_window(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- WINDOW **pwin = (WINDOW **)rsrc->ptr;
-
- delwin(*pwin);
- efree(pwin);
-}
-
-#if HAVE_NCURSES_PANEL
-static void ncurses_destruct_panel(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- PANEL **ppanel = (PANEL **)rsrc->ptr;
-
- del_panel(*ppanel);
- efree(ppanel);
-}
-#endif
-
-/* {{{ ncurses_module_entry
- */
-zend_module_entry ncurses_module_entry = {
- STANDARD_MODULE_HEADER,
- "ncurses",
- ncurses_functions,
- PHP_MINIT(ncurses),
- PHP_MSHUTDOWN(ncurses),
- PHP_RINIT(ncurses), /* Replace with NULL if there's nothing to do at request start */
- PHP_RSHUTDOWN(ncurses), /* Replace with NULL if there's nothing to do at request end */
- PHP_MINFO(ncurses),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_NCURSES
-ZEND_GET_MODULE(ncurses)
-#endif
-
-/* {{{ PHP_INI
- */
-/* Remove comments and fill if you need to have entries in php.ini
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("ncurses.value", "42", PHP_INI_ALL, OnUpdateLong, global_value, zend_ncurses_globals, ncurses_globals)
- STD_PHP_INI_ENTRY("ncurses.string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_ncurses_globals, ncurses_globals)
-PHP_INI_END()
-*/
-/* }}} */
-
-#define PHP_NCURSES_CONST(x) REGISTER_LONG_CONSTANT("NCURSES_"#x, x, CONST_CS | CONST_PERSISTENT)
-#define PHP_NCURSES_FKEY_CONST(x) REGISTER_LONG_CONSTANT("NCURSES_KEY_F"#x, KEY_F0 + x, CONST_CS | CONST_PERSISTENT)
-
-static void php_ncurses_init_globals(zend_ncurses_globals *ncurses_globals)
-{
- memset(ncurses_globals, 0, sizeof(*ncurses_globals));
-}
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(ncurses)
-{
- /* color constants */
- PHP_NCURSES_CONST(COLOR_BLACK);
- PHP_NCURSES_CONST(COLOR_RED);
- PHP_NCURSES_CONST(COLOR_GREEN);
- PHP_NCURSES_CONST(COLOR_YELLOW);
- PHP_NCURSES_CONST(COLOR_BLUE);
- PHP_NCURSES_CONST(COLOR_MAGENTA);
- PHP_NCURSES_CONST(COLOR_CYAN);
- PHP_NCURSES_CONST(COLOR_WHITE);
-
- /* keyboard constants */
- PHP_NCURSES_CONST(KEY_DOWN);
- PHP_NCURSES_CONST(KEY_UP);
- PHP_NCURSES_CONST(KEY_LEFT);
- PHP_NCURSES_CONST(KEY_RIGHT);
- PHP_NCURSES_CONST(KEY_BACKSPACE);
- PHP_NCURSES_CONST(KEY_MOUSE);
- PHP_NCURSES_CONST(KEY_F0);
-
-
- /* TODO:this macro sux, we have 65 function key,
- so we need a little loop */
- PHP_NCURSES_FKEY_CONST(1);
- PHP_NCURSES_FKEY_CONST(2);
- PHP_NCURSES_FKEY_CONST(3);
- PHP_NCURSES_FKEY_CONST(4);
- PHP_NCURSES_FKEY_CONST(5);
- PHP_NCURSES_FKEY_CONST(6);
- PHP_NCURSES_FKEY_CONST(7);
- PHP_NCURSES_FKEY_CONST(8);
- PHP_NCURSES_FKEY_CONST(9);
- PHP_NCURSES_FKEY_CONST(10);
- PHP_NCURSES_FKEY_CONST(11);
- PHP_NCURSES_FKEY_CONST(12);
-
- PHP_NCURSES_CONST(KEY_DL);
- PHP_NCURSES_CONST(KEY_IL);
- PHP_NCURSES_CONST(KEY_DC);
- PHP_NCURSES_CONST(KEY_IC);
- PHP_NCURSES_CONST(KEY_EIC);
- PHP_NCURSES_CONST(KEY_CLEAR);
- PHP_NCURSES_CONST(KEY_EOS);
- PHP_NCURSES_CONST(KEY_EOL);
- PHP_NCURSES_CONST(KEY_SF);
- PHP_NCURSES_CONST(KEY_SR);
- PHP_NCURSES_CONST(KEY_NPAGE);
- PHP_NCURSES_CONST(KEY_PPAGE);
- PHP_NCURSES_CONST(KEY_STAB);
- PHP_NCURSES_CONST(KEY_CTAB);
- PHP_NCURSES_CONST(KEY_CATAB);
- PHP_NCURSES_CONST(KEY_ENTER);
- PHP_NCURSES_CONST(KEY_SRESET);
- PHP_NCURSES_CONST(KEY_RESET);
- PHP_NCURSES_CONST(KEY_PRINT);
- PHP_NCURSES_CONST(KEY_LL);
- PHP_NCURSES_CONST(KEY_A1);
- PHP_NCURSES_CONST(KEY_A3);
- PHP_NCURSES_CONST(KEY_B2);
- PHP_NCURSES_CONST(KEY_C1);
- PHP_NCURSES_CONST(KEY_C3);
- PHP_NCURSES_CONST(KEY_BTAB);
- PHP_NCURSES_CONST(KEY_BEG);
- PHP_NCURSES_CONST(KEY_CANCEL);
- PHP_NCURSES_CONST(KEY_CLOSE);
- PHP_NCURSES_CONST(KEY_COMMAND);
- PHP_NCURSES_CONST(KEY_COPY);
- PHP_NCURSES_CONST(KEY_CREATE);
- PHP_NCURSES_CONST(KEY_END);
- PHP_NCURSES_CONST(KEY_EXIT);
- PHP_NCURSES_CONST(KEY_FIND);
- PHP_NCURSES_CONST(KEY_HELP);
- PHP_NCURSES_CONST(KEY_MARK);
- PHP_NCURSES_CONST(KEY_MESSAGE);
- PHP_NCURSES_CONST(KEY_MOVE);
- PHP_NCURSES_CONST(KEY_NEXT);
- PHP_NCURSES_CONST(KEY_OPEN);
- PHP_NCURSES_CONST(KEY_OPTIONS);
- PHP_NCURSES_CONST(KEY_PREVIOUS);
- PHP_NCURSES_CONST(KEY_REDO);
- PHP_NCURSES_CONST(KEY_REFERENCE);
- PHP_NCURSES_CONST(KEY_REFRESH);
- PHP_NCURSES_CONST(KEY_REPLACE);
- PHP_NCURSES_CONST(KEY_RESTART);
- PHP_NCURSES_CONST(KEY_RESUME);
- PHP_NCURSES_CONST(KEY_SAVE);
- PHP_NCURSES_CONST(KEY_SBEG);
- PHP_NCURSES_CONST(KEY_SCANCEL);
- PHP_NCURSES_CONST(KEY_SCOMMAND);
- PHP_NCURSES_CONST(KEY_SCOPY);
- PHP_NCURSES_CONST(KEY_SCREATE);
- PHP_NCURSES_CONST(KEY_SDC);
- PHP_NCURSES_CONST(KEY_SDL);
- PHP_NCURSES_CONST(KEY_SELECT);
- PHP_NCURSES_CONST(KEY_SEND);
- PHP_NCURSES_CONST(KEY_SEOL);
- PHP_NCURSES_CONST(KEY_SEXIT);
- PHP_NCURSES_CONST(KEY_SFIND);
- PHP_NCURSES_CONST(KEY_SHELP);
- PHP_NCURSES_CONST(KEY_SHOME);
- PHP_NCURSES_CONST(KEY_SIC);
- PHP_NCURSES_CONST(KEY_SLEFT);
- PHP_NCURSES_CONST(KEY_SMESSAGE);
- PHP_NCURSES_CONST(KEY_SMOVE);
- PHP_NCURSES_CONST(KEY_SNEXT);
- PHP_NCURSES_CONST(KEY_SOPTIONS);
- PHP_NCURSES_CONST(KEY_SPREVIOUS);
- PHP_NCURSES_CONST(KEY_SPRINT);
- PHP_NCURSES_CONST(KEY_SREDO);
- PHP_NCURSES_CONST(KEY_SREPLACE);
- PHP_NCURSES_CONST(KEY_SRIGHT);
- PHP_NCURSES_CONST(KEY_SRSUME);
- PHP_NCURSES_CONST(KEY_SSAVE);
- PHP_NCURSES_CONST(KEY_SSUSPEND);
- PHP_NCURSES_CONST(KEY_SUNDO);
- PHP_NCURSES_CONST(KEY_SUSPEND);
- PHP_NCURSES_CONST(KEY_UNDO);
- PHP_NCURSES_CONST(KEY_RESIZE);
-
- /* screen attribute constants */
- PHP_NCURSES_CONST(A_NORMAL);
- PHP_NCURSES_CONST(A_STANDOUT);
- PHP_NCURSES_CONST(A_UNDERLINE);
- PHP_NCURSES_CONST(A_REVERSE);
- PHP_NCURSES_CONST(A_BLINK);
- PHP_NCURSES_CONST(A_DIM);
- PHP_NCURSES_CONST(A_BOLD);
- PHP_NCURSES_CONST(A_PROTECT);
- PHP_NCURSES_CONST(A_INVIS);
- PHP_NCURSES_CONST(A_ALTCHARSET);
- PHP_NCURSES_CONST(A_CHARTEXT);
-
- /* mouse constants */
- PHP_NCURSES_CONST(BUTTON1_PRESSED);
- PHP_NCURSES_CONST(BUTTON1_RELEASED);
- PHP_NCURSES_CONST(BUTTON1_CLICKED);
- PHP_NCURSES_CONST(BUTTON1_DOUBLE_CLICKED);
- PHP_NCURSES_CONST(BUTTON1_TRIPLE_CLICKED);
- PHP_NCURSES_CONST(BUTTON2_PRESSED);
- PHP_NCURSES_CONST(BUTTON2_RELEASED);
- PHP_NCURSES_CONST(BUTTON2_CLICKED);
- PHP_NCURSES_CONST(BUTTON2_DOUBLE_CLICKED);
- PHP_NCURSES_CONST(BUTTON2_TRIPLE_CLICKED);
- PHP_NCURSES_CONST(BUTTON3_PRESSED);
- PHP_NCURSES_CONST(BUTTON3_RELEASED);
- PHP_NCURSES_CONST(BUTTON3_CLICKED);
- PHP_NCURSES_CONST(BUTTON3_DOUBLE_CLICKED);
- PHP_NCURSES_CONST(BUTTON3_TRIPLE_CLICKED);
- PHP_NCURSES_CONST(BUTTON4_PRESSED);
- PHP_NCURSES_CONST(BUTTON4_RELEASED);
- PHP_NCURSES_CONST(BUTTON4_CLICKED);
- PHP_NCURSES_CONST(BUTTON4_DOUBLE_CLICKED);
- PHP_NCURSES_CONST(BUTTON4_TRIPLE_CLICKED);
- PHP_NCURSES_CONST(BUTTON_SHIFT);
- PHP_NCURSES_CONST(BUTTON_CTRL);
- PHP_NCURSES_CONST(BUTTON_ALT);
- PHP_NCURSES_CONST(ALL_MOUSE_EVENTS);
- PHP_NCURSES_CONST(REPORT_MOUSE_POSITION);
-
- ZEND_INIT_MODULE_GLOBALS(ncurses, php_ncurses_init_globals, NULL);
-
- le_ncurses_windows = zend_register_list_destructors_ex(ncurses_destruct_window, NULL, "ncurses_window", module_number);
-#if HAVE_NCURSES_PANEL
- le_ncurses_panels = zend_register_list_destructors_ex(ncurses_destruct_panel, NULL, "ncurses_panel", module_number);
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(ncurses)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* Remove if there's nothing to do at request start */
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(ncurses)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* Remove if there's nothing to do at request end */
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(ncurses)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(ncurses)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "ncurses support", "enabled");
- php_info_print_table_row(2, "ncurses library version", NCURSES_VERSION);
-#ifdef HAVE_NCURSES_COLOR_SET
- php_info_print_table_row(2, "color support", "yes");
-#else
- php_info_print_table_row(2, "color support", "no");
-#endif
- php_info_print_table_end();
-
- /* Remove comments if you have entries in php.ini
- DISPLAY_INI_ENTRIES();
- */
-}
-/* }}} */
-
-/* Remove the following function when you have succesfully modified config.m4
- so that your module can be compiled into PHP, it exists only for testing
- purposes. */
-
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/ncurses/ncurses.php b/ext/ncurses/ncurses.php
deleted file mode 100644
index 416b1087e7..0000000000
--- a/ext/ncurses/ncurses.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?
-$module = 'ncurses';
-$function = 'confirm_' . $module . '_compiled';
-if (extension_loaded($module)) {
- $str = $function($module);
-} else {
- $str = "Module $module is not compiled into PHP";
-}
-echo "$str\n";
-?>
diff --git a/ext/ncurses/ncurses_fe.c b/ext/ncurses/ncurses_fe.c
deleted file mode 100644
index 136c1d8bec..0000000000
--- a/ext/ncurses/ncurses_fe.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Hartmut Holzgraefe <hholzgra@php.net> |
- | Georg Richter <georg.richter@php-ev.de> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_ncurses.h"
-
-static unsigned char first_args_force_ref[] = {1, BYREF_FORCE};
-static unsigned char firstandsecond_args_force_ref[] = {2, BYREF_FORCE, BYREF_FORCE};
-static unsigned char second_args_force_ref[] = {2, BYREF_NONE, BYREF_FORCE};
-static unsigned char secondandthird_args_force_ref[] = {3, BYREF_NONE, BYREF_FORCE, BYREF_FORCE};
-static unsigned char second_thru_fourth_args_force_ref[] = {4, BYREF_NONE, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE};
-
-/* ncurses_functions[]
- *
- * Every user visible function must have an entry in ncurses_functions[].
- */
-function_entry ncurses_functions[] = {
- PHP_FE(ncurses_addch, NULL)
-#ifdef HAVE_NCURSES_COLOR_SET
- PHP_FE(ncurses_color_set, NULL)
-#endif
- PHP_FE(ncurses_delwin, NULL)
- PHP_FE(ncurses_end, NULL)
- PHP_FE(ncurses_getch, NULL)
- PHP_FE(ncurses_has_colors, NULL)
- PHP_FE(ncurses_init, NULL)
- PHP_FE(ncurses_init_pair, NULL)
- PHP_FE(ncurses_color_content, second_thru_fourth_args_force_ref)
- PHP_FE(ncurses_pair_content, secondandthird_args_force_ref)
- PHP_FE(ncurses_move, NULL)
- PHP_FE(ncurses_newwin, NULL)
- PHP_FE(ncurses_refresh, NULL)
- PHP_FE(ncurses_start_color, NULL)
- PHP_FE(ncurses_standout, NULL)
- PHP_FE(ncurses_standend, NULL)
- PHP_FE(ncurses_baudrate, NULL)
- PHP_FE(ncurses_beep, NULL)
- PHP_FE(ncurses_can_change_color, NULL)
- PHP_FE(ncurses_cbreak, NULL)
- PHP_FE(ncurses_clear, NULL)
- PHP_FE(ncurses_clrtobot, NULL)
- PHP_FE(ncurses_clrtoeol, NULL)
- PHP_FE(ncurses_def_prog_mode, NULL)
- PHP_FE(ncurses_reset_prog_mode, NULL)
- PHP_FE(ncurses_def_shell_mode, NULL)
- PHP_FE(ncurses_reset_shell_mode, NULL)
- PHP_FE(ncurses_delch, NULL)
- PHP_FE(ncurses_deleteln, NULL)
- PHP_FE(ncurses_doupdate, NULL)
- PHP_FE(ncurses_echo, NULL)
- PHP_FE(ncurses_erase, NULL)
- PHP_FE(ncurses_werase, NULL)
- PHP_FE(ncurses_erasechar, NULL)
- PHP_FE(ncurses_flash, NULL)
- PHP_FE(ncurses_flushinp, NULL)
- PHP_FE(ncurses_has_ic, NULL)
- PHP_FE(ncurses_has_il, NULL)
- PHP_FE(ncurses_inch, NULL)
- PHP_FE(ncurses_insertln, NULL)
- PHP_FE(ncurses_isendwin, NULL)
- PHP_FE(ncurses_killchar, NULL)
- PHP_FE(ncurses_nl, NULL)
- PHP_FE(ncurses_nocbreak, NULL)
- PHP_FE(ncurses_noecho, NULL)
- PHP_FE(ncurses_nonl, NULL)
- PHP_FE(ncurses_noraw, NULL)
- PHP_FE(ncurses_raw, NULL)
- PHP_FE(ncurses_meta, NULL)
- PHP_FE(ncurses_resetty, NULL)
- PHP_FE(ncurses_savetty, NULL)
- PHP_FE(ncurses_termattrs, NULL)
- PHP_FE(ncurses_use_default_colors, NULL)
- PHP_FE(ncurses_slk_attr, NULL)
- PHP_FE(ncurses_slk_clear, NULL)
- PHP_FE(ncurses_slk_noutrefresh, NULL)
- PHP_FE(ncurses_slk_refresh, NULL)
- PHP_FE(ncurses_slk_restore, NULL)
- PHP_FE(ncurses_slk_touch, NULL)
- PHP_FE(ncurses_attroff, NULL)
- PHP_FE(ncurses_attron, NULL)
- PHP_FE(ncurses_attrset, NULL)
- PHP_FE(ncurses_bkgd, NULL)
- PHP_FE(ncurses_curs_set, NULL)
- PHP_FE(ncurses_delay_output, NULL)
- PHP_FE(ncurses_echochar, NULL)
- PHP_FE(ncurses_halfdelay, NULL)
- PHP_FE(ncurses_has_key, NULL)
- PHP_FE(ncurses_insch, NULL)
- PHP_FE(ncurses_insdelln, NULL)
- PHP_FE(ncurses_mouseinterval, NULL)
- PHP_FE(ncurses_napms, NULL)
- PHP_FE(ncurses_scrl, NULL)
- PHP_FE(ncurses_slk_attroff, NULL)
- PHP_FE(ncurses_slk_attron, NULL)
- PHP_FE(ncurses_slk_attrset, NULL)
-#ifdef HAVE_NCURSES_SLK_COLOR
- PHP_FE(ncurses_slk_color, NULL)
-#endif
- PHP_FE(ncurses_slk_init, NULL)
- PHP_FE(ncurses_slk_set, NULL)
- PHP_FE(ncurses_typeahead, NULL)
- PHP_FE(ncurses_ungetch, NULL)
- PHP_FE(ncurses_vidattr, NULL)
- PHP_FE(ncurses_wrefresh, NULL)
-#ifdef HAVE_NCURSES_USE_EXTENDED_NAMES
- PHP_FE(ncurses_use_extended_names, NULL)
-#endif
- PHP_FE(ncurses_bkgdset, NULL)
- PHP_FE(ncurses_filter, NULL)
- PHP_FE(ncurses_noqiflush, NULL)
- PHP_FE(ncurses_qiflush, NULL)
- PHP_FE(ncurses_timeout, NULL)
- PHP_FE(ncurses_use_env, NULL)
- PHP_FE(ncurses_addstr, NULL)
- PHP_FE(ncurses_putp, NULL)
- PHP_FE(ncurses_scr_dump, NULL)
- PHP_FE(ncurses_scr_init, NULL)
- PHP_FE(ncurses_scr_restore, NULL)
- PHP_FE(ncurses_scr_set, NULL)
- PHP_FE(ncurses_mvaddch, NULL)
- PHP_FE(ncurses_mvaddchnstr, NULL)
- PHP_FE(ncurses_addchnstr, NULL)
- PHP_FE(ncurses_mvaddchstr, NULL)
- PHP_FE(ncurses_addchstr, NULL)
- PHP_FE(ncurses_mvaddnstr, NULL)
- PHP_FE(ncurses_addnstr, NULL)
- PHP_FE(ncurses_mvaddstr, NULL)
- PHP_FE(ncurses_mvdelch, NULL)
- PHP_FE(ncurses_mvgetch, NULL)
- PHP_FE(ncurses_mvinch, NULL)
- PHP_FE(ncurses_mvwaddstr, NULL)
- PHP_FE(ncurses_insstr, NULL)
- PHP_FE(ncurses_instr, first_args_force_ref)
- PHP_FE(ncurses_mvhline, NULL)
- PHP_FE(ncurses_mvcur, NULL)
- PHP_FE(ncurses_init_color, NULL)
- PHP_FE(ncurses_border, NULL)
-#ifdef HAVE_NCURSES_ASSUME_DEFAULT_COLORS
- PHP_FE(ncurses_assume_default_colors, NULL)
-#endif
- PHP_FE(ncurses_define_key, NULL)
- PHP_FE(ncurses_hline, NULL)
- PHP_FE(ncurses_vline, NULL)
- PHP_FE(ncurses_keyok, NULL)
- PHP_FE(ncurses_termname, NULL)
- PHP_FE(ncurses_longname, NULL)
- PHP_FE(ncurses_mousemask, second_args_force_ref)
- PHP_FE(ncurses_getmouse, first_args_force_ref)
- PHP_FE(ncurses_ungetmouse, NULL)
- PHP_FE(ncurses_mouse_trafo, firstandsecond_args_force_ref)
- PHP_FE(ncurses_wmouse_trafo, secondandthird_args_force_ref)
- PHP_FE(ncurses_waddstr, NULL)
- PHP_FE(ncurses_wnoutrefresh, NULL)
- PHP_FE(ncurses_wclear, NULL)
-#ifdef HAVE_NCURSES_COLOR_SET
- PHP_FE(ncurses_wcolor_set, NULL)
-#endif
- PHP_FE(ncurses_wgetch, NULL)
- PHP_FE(ncurses_keypad, NULL)
- PHP_FE(ncurses_wmove, NULL)
-
- PHP_FE(ncurses_newpad, NULL)
- PHP_FE(ncurses_prefresh, NULL)
- PHP_FE(ncurses_pnoutrefresh, NULL)
- PHP_FE(ncurses_wstandout, NULL)
- PHP_FE(ncurses_wstandend, NULL)
- PHP_FE(ncurses_wattrset, NULL)
- PHP_FE(ncurses_wattron, NULL)
- PHP_FE(ncurses_wattroff, NULL)
- PHP_FE(ncurses_waddch, NULL)
- PHP_FE(ncurses_wborder, NULL)
- PHP_FE(ncurses_whline, NULL)
- PHP_FE(ncurses_wvline, NULL)
- PHP_FE(ncurses_getyx, secondandthird_args_force_ref)
- PHP_FE(ncurses_getmaxyx, secondandthird_args_force_ref)
-
-#if HAVE_NCURSES_PANEL
- PHP_FE(ncurses_update_panels, NULL)
- PHP_FE(ncurses_panel_window, NULL)
- PHP_FE(ncurses_panel_below, NULL)
- PHP_FE(ncurses_panel_above, NULL)
- PHP_FE(ncurses_replace_panel, NULL)
- PHP_FE(ncurses_move_panel, NULL)
- PHP_FE(ncurses_bottom_panel, NULL)
- PHP_FE(ncurses_top_panel, NULL)
- PHP_FE(ncurses_show_panel, NULL)
- PHP_FE(ncurses_hide_panel, NULL)
- PHP_FE(ncurses_del_panel, NULL)
- PHP_FE(ncurses_new_panel, NULL)
-#endif
-
- {NULL, NULL, NULL} /* Must be the last line in ncurses_functions[] */
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/ncurses/ncurses_functions.c b/ext/ncurses/ncurses_functions.c
deleted file mode 100644
index a03c9fa3a2..0000000000
--- a/ext/ncurses/ncurses_functions.c
+++ /dev/null
@@ -1,2460 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Hartmut Holzgraefe <hholzgra@php.net> |
- | Georg Richter <georg.richter@php-ev.de> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_ncurses.h"
-
-#define FETCH_WINRES(r, z) ZEND_FETCH_RESOURCE(r, WINDOW **, z, -1, "ncurses_window", le_ncurses_windows)
-#if HAVE_NCURSES_PANEL
-# define FETCH_PANEL(r, z) ZEND_FETCH_RESOURCE(r, PANEL **, z, -1, "ncurses_panel", le_ncurses_panels)
-#endif
-
-#define IS_NCURSES_INITIALIZED() \
- if (!NCURSES_G(registered_constants)) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must initialize ncruses via ncurses_init(), before calling any ncurses functions."); \
- RETURN_FALSE; \
- }
-
-/* {{{ proto int ncurses_addch(int ch)
- Adds character at current position and advance cursor */
-PHP_FUNCTION(ncurses_addch)
-{
- long ch;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ch) == FAILURE) {
- return;
- }
-
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(addch(ch));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_waddch(resource window, int ch)
- Adds character at current position in a window and advance cursor */
-PHP_FUNCTION(ncurses_waddch)
-{
- long ch;
- zval *handle;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &handle, &ch) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(waddch(*win, ch));
-}
-/* }}} */
-
-#ifdef HAVE_NCURSES_COLOR_SET
-/* {{{ proto int ncurses_color_set(int pair)
- Sets fore- and background color */
-PHP_FUNCTION(ncurses_color_set)
-{
- long pair;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pair) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(color_set(pair,NULL));
-}
-/* }}} */
-#endif
-
-/* {{{ proto int ncurses_delwin(resource window)
- Deletes a ncurses window */
-PHP_FUNCTION(ncurses_delwin)
-{
- zval *handle;
- WINDOW **w;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(w, &handle);
-
- zend_list_delete(Z_LVAL_P(handle));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_end(void)
- Stops using ncurses, clean up the screen */
-PHP_FUNCTION(ncurses_end)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(endwin()); /* endialize the curses library */
-}
-/* }}} */
-
-/* {{{ proto int ncurses_getch(void)
- Reads a character from keyboard */
-PHP_FUNCTION(ncurses_getch)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(getch());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_has_colors(void)
- Checks if terminal has colors */
-PHP_FUNCTION(ncurses_has_colors)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_BOOL(has_colors());
-}
-/* }}} */
-
-/* {{{ proto int ncurses_init(void)
- Initializes ncurses */
-PHP_FUNCTION(ncurses_init)
-{
- initscr(); /* initialize the curses library */
- keypad(stdscr, TRUE); /* enable keyboard mapping */
- (void) nonl(); /* tell curses not to do NL->CR/NL on output */
- (void) cbreak(); /* take input chars one at a time, no wait for \n */
-
- if (!NCURSES_G(registered_constants)) {
- zend_constant c;
-
- WINDOW **pscr = (WINDOW**)emalloc(sizeof(WINDOW *));
- zval *zscr;
-
- *pscr = stdscr;
- MAKE_STD_ZVAL(zscr);
- ZEND_REGISTER_RESOURCE(zscr, pscr, le_ncurses_windows);
- c.value = *zscr;
- zval_copy_ctor(&c.value);
- c.flags = CONST_CS;
- c.name = zend_strndup("STDSCR", 7);
- c.name_len = 7;
- zend_register_constant(&c TSRMLS_CC);
-
- /* we need this "interesting" arrangement because the
- * underlying values of the ACS_XXX defines are not
- * initialized until after ncurses has been initialized */
-
-#define PHP_NCURSES_DEF_CONST(x) \
- ZVAL_LONG(zscr, x); \
- c.value = *zscr; \
- zval_copy_ctor(&c.value); \
- c.flags = CONST_CS; \
- c.name = zend_strndup("NCURSES_" #x, sizeof("NCURSES_" #x)); \
- c.name_len = sizeof("NCURSES_" #x); \
- zend_register_constant(&c TSRMLS_CC)
-
- PHP_NCURSES_DEF_CONST(ACS_ULCORNER);
- PHP_NCURSES_DEF_CONST(ACS_LLCORNER);
- PHP_NCURSES_DEF_CONST(ACS_URCORNER);
- PHP_NCURSES_DEF_CONST(ACS_LRCORNER);
- PHP_NCURSES_DEF_CONST(ACS_LTEE);
- PHP_NCURSES_DEF_CONST(ACS_RTEE);
- PHP_NCURSES_DEF_CONST(ACS_BTEE);
- PHP_NCURSES_DEF_CONST(ACS_TTEE);
- PHP_NCURSES_DEF_CONST(ACS_HLINE);
- PHP_NCURSES_DEF_CONST(ACS_VLINE);
- PHP_NCURSES_DEF_CONST(ACS_PLUS);
- PHP_NCURSES_DEF_CONST(ACS_S1);
- PHP_NCURSES_DEF_CONST(ACS_S9);
- PHP_NCURSES_DEF_CONST(ACS_DIAMOND);
- PHP_NCURSES_DEF_CONST(ACS_CKBOARD);
- PHP_NCURSES_DEF_CONST(ACS_DEGREE);
- PHP_NCURSES_DEF_CONST(ACS_PLMINUS);
- PHP_NCURSES_DEF_CONST(ACS_BULLET);
- PHP_NCURSES_DEF_CONST(ACS_LARROW);
- PHP_NCURSES_DEF_CONST(ACS_RARROW);
- PHP_NCURSES_DEF_CONST(ACS_DARROW);
- PHP_NCURSES_DEF_CONST(ACS_UARROW);
- PHP_NCURSES_DEF_CONST(ACS_BOARD);
- PHP_NCURSES_DEF_CONST(ACS_LANTERN);
- PHP_NCURSES_DEF_CONST(ACS_BLOCK);
-
- FREE_ZVAL(zscr);
- NCURSES_G(registered_constants) = 1;
- }
-}
-/* }}} */
-
-/* {{{ proto int ncurses_init_pair(int pair, int fg, int bg)
- Allocates a color pair */
-PHP_FUNCTION(ncurses_init_pair)
-{
- long pair, fg, bg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &pair, &fg, &bg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(init_pair(pair,fg,bg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_move(int y, int x)
- Moves output position */
-PHP_FUNCTION(ncurses_move)
-{
- long x, y;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &y, &x) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(move(y,x));
-}
-/* }}} */
-
-/* {{{ proto resource ncurses_newpad(int rows, int cols)
- Creates a new pad (window) */
-PHP_FUNCTION(ncurses_newpad)
-{
- long rows,cols;
- WINDOW **pwin;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &rows, &cols) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
-
- pwin = (WINDOW **)emalloc(sizeof(WINDOW *));
- *pwin = newpad(rows,cols);
-
- if(!*pwin) {
- efree(pwin);
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, pwin, le_ncurses_windows);
-
-}
-/* }}} */
-
-/* {{{ proto int ncurses_prefresh(resource pad, int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol)
- Copys a region from a pad into the virtual screen */
-PHP_FUNCTION(ncurses_prefresh)
-{
- WINDOW **pwin;
- zval *phandle;
- long pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllll", &phandle, &pminrow,
- &pmincol, &sminrow, &smincol, &smaxrow, &smaxcol) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(pwin, &phandle);
-
- RETURN_LONG(prefresh(*pwin, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_pnoutrefresh(resource pad, int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol)
- Copys a region from a pad into the virtual screen */
-PHP_FUNCTION(ncurses_pnoutrefresh)
-{
- WINDOW **pwin;
- zval *phandle;
- long pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllll", &phandle, &pminrow,
- &pmincol, &sminrow, &smincol, &smaxrow, &smaxcol) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(pwin, &phandle);
-
- RETURN_LONG(pnoutrefresh(*pwin, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol));
-}
-/* }}} */
-
-
-
-/* {{{ proto int ncurses_newwin(int rows, int cols, int y, int x)
- Creates a new window */
-PHP_FUNCTION(ncurses_newwin)
-{
- long rows,cols,y,x;
- WINDOW **pwin;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &rows, &cols, &y, &x) == FAILURE) {
- return;
- }
-
- IS_NCURSES_INITIALIZED();
- pwin = (WINDOW **)emalloc(sizeof(WINDOW *));
- *pwin=newwin(rows,cols,y,x);
-
- if(!*pwin) {
- efree(pwin);
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, pwin, le_ncurses_windows);
-}
-/* }}} */
-
-/* {{{ proto int ncurses_refresh(int ch)
- Refresh screen */
-PHP_FUNCTION(ncurses_refresh)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(refresh());
-}
-/* }}} */
-
-/* {{{ proto int ncurses_start_color(void)
- Starts using colors */
-PHP_FUNCTION(ncurses_start_color)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(start_color());
-}
-/* }}} */
-
-/* {{{ proto int ncurses_standout(void)
- Starts using 'standout' attribute */
-PHP_FUNCTION(ncurses_standout)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(standout());
-}
-/* }}} */
-
-/* {{{ proto int ncurses_standend(void)
- Stops using 'standout' attribute */
-PHP_FUNCTION(ncurses_standend)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(standend());
-}
-/* }}} */
-
-/* {{{ proto int ncurses_baudrate(void)
- Returns baudrate of terminal */
-PHP_FUNCTION(ncurses_baudrate)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(baudrate());
-}
-/* }}} */
-
-/* {{{ proto int ncurses_beep(void)
- Let the terminal beep */
-PHP_FUNCTION(ncurses_beep)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(beep());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_can_change_color(void)
- Checks if we can change terminals colors */
-PHP_FUNCTION(ncurses_can_change_color)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(can_change_color());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_cbreak(void)
- Switches of input buffering */
-PHP_FUNCTION(ncurses_cbreak)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(cbreak());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_clear(void)
- Clears screen */
-PHP_FUNCTION(ncurses_clear)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(clear());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_clrtobot(void)
- Clears screen from current position to bottom */
-PHP_FUNCTION(ncurses_clrtobot)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(clrtobot());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_clrtoeol(void)
- Clears screen from current position to end of line */
-PHP_FUNCTION(ncurses_clrtoeol)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(clrtoeol());
-}
-/* }}} */
-
-/* {{{ proto int ncurses_reset_prog_mode(void)
- Resets the prog mode saved by def_prog_mode */
-PHP_FUNCTION(ncurses_reset_prog_mode)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(reset_prog_mode());
-}
-/* }}} */
-
-/* {{{ proto int ncurses_reset_shell_mode(void)
- Resets the shell mode saved by def_shell_mode */
-PHP_FUNCTION(ncurses_reset_shell_mode)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(reset_shell_mode());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_def_prog_mode(void)
- Saves terminals (program) mode */
-PHP_FUNCTION(ncurses_def_prog_mode)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(def_prog_mode());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_def_shell_mode(void)
- Saves terminal (shell) mode*/
-PHP_FUNCTION(ncurses_def_shell_mode)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(def_shell_mode());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_delch(void)
- Deletes character at current position, move rest of line left */
-PHP_FUNCTION(ncurses_delch)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(delch());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_deleteln(void)
- Deletes line at current position, move rest of screen up */
-PHP_FUNCTION(ncurses_deleteln)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(deleteln());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_doupdate(void)
- Writes all prepared refreshes to terminal */
-PHP_FUNCTION(ncurses_doupdate)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(doupdate());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_echo(void)
- Activates keyboard input echo */
-PHP_FUNCTION(ncurses_echo)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(echo());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_erase(void)
- Erases terminal screen */
-PHP_FUNCTION(ncurses_erase)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(erase());
-}
-/* }}} */
-
-/* {{{ proto string ncurses_erasechar(void)
- Returns current erase character */
-PHP_FUNCTION(ncurses_erasechar)
-{
- char temp[2];
-
- IS_NCURSES_INITIALIZED();
- temp[0] = erasechar();
- temp[1] = '\0';
-
- RETURN_STRINGL (temp, 1, 1);
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_flash(void)
- Flashes terminal screen (visual bell) */
-PHP_FUNCTION(ncurses_flash)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(flash());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_flushinp(void)
- Flushes keyboard input buffer */
-PHP_FUNCTION(ncurses_flushinp)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(flushinp());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_has_ic(void)
- Checks for insert- and delete-capabilities */
-PHP_FUNCTION(ncurses_has_ic)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(has_ic());
-}
-/* }}} */
-
-
-/* {{{ proto bool ncurses_has_il(void)
- Checks for line insert- and delete-capabilities */
-PHP_FUNCTION(ncurses_has_il)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(has_il());
-}
-/* }}} */
-
-/* {{{ proto string ncurses_inch(void)
- Gets character and attribute at current position */
-PHP_FUNCTION(ncurses_inch)
-{
- char temp[2];
-
- IS_NCURSES_INITIALIZED();
- temp[0] = inch();
- temp[1] = '\0';
-
- RETURN_STRINGL (temp, 1, 1);
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_insertln(void)
- Inserts a line, move rest of screen down */
-PHP_FUNCTION(ncurses_insertln)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(insertln());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_isendwin(void)
- Ncurses is in endwin mode, normal screen output may be performed */
-PHP_FUNCTION(ncurses_isendwin)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(isendwin());
-}
-/* }}} */
-
-/* {{{ proto string ncurses_killchar(void)
- Returns current line kill character */
-PHP_FUNCTION(ncurses_killchar)
-{
- char temp[2];
-
- IS_NCURSES_INITIALIZED();
- temp[0] = killchar();
- temp[1] = '\0';
-
- RETURN_STRINGL (temp, 1, 1);
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_nl(void)
- Translates newline and carriage return / line feed */
-PHP_FUNCTION(ncurses_nl)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(nl());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_nocbreak(void)
- Switches terminal to cooked mode */
-PHP_FUNCTION(ncurses_nocbreak)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(nocbreak());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_noecho(void)
- Switches off keyboard input echo */
-PHP_FUNCTION(ncurses_noecho)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(noecho());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_nonl(void)
- Do not ranslate newline and carriage return / line feed */
-PHP_FUNCTION(ncurses_nonl)
-{
- RETURN_LONG(nonl());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_noraw(void)
- Switches terminal out of raw mode */
-PHP_FUNCTION(ncurses_noraw)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(noraw());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_raw(void)
- Switches terminal into raw mode */
-PHP_FUNCTION(ncurses_raw)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(raw());
-}
-/* }}} */
-
-/* {{{ proto long ncurses_meta(resource window, bool 8bit)
- Enables/Disable 8-bit meta key information */
-PHP_FUNCTION(ncurses_meta)
-{
- zend_bool enable;
- zval *handle;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &handle, &enable) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(meta(*win, enable));
-}
-/* }}} */
-
-/* {{{ proto long ncurses_werase(resource window)
- Erase window contents */
-PHP_FUNCTION(ncurses_werase)
-{
- zval *handle;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(werase(*win));
-}
-/* }}} */
-
-
-/* {{{ proto bool ncurses_resetty(void)
- Restores saved terminal state */
-PHP_FUNCTION(ncurses_resetty)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(resetty());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_savetty(void)
- Saves terminal state */
-PHP_FUNCTION(ncurses_savetty)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(savetty());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_termattrs(void)
- Returns a logical OR of all attribute flags supported by terminal */
-PHP_FUNCTION(ncurses_termattrs)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(termattrs());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_use_default_colors(void)
- Assigns terminal default colors to color id -1 */
-PHP_FUNCTION(ncurses_use_default_colors)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(use_default_colors());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_slk_attr(void)
- Returns current soft label keys attribute */
-PHP_FUNCTION(ncurses_slk_attr)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(slk_attr());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_slk_clear(void)
- Clears soft label keys from screen */
-PHP_FUNCTION(ncurses_slk_clear)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(slk_clear());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_slk_noutrefresh(void)
- Copies soft label keys to virtual screen */
-PHP_FUNCTION(ncurses_slk_noutrefresh)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(slk_noutrefresh());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_slk_refresh(void)
- Copies soft label keys to screen */
-PHP_FUNCTION(ncurses_slk_refresh)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(slk_refresh());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_slk_restore(void)
- Restores soft label keys */
-PHP_FUNCTION(ncurses_slk_restore)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(slk_restore());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_slk_touch(void)
- Forces output when ncurses_slk_noutrefresh is performed */
-PHP_FUNCTION(ncurses_slk_touch)
-{
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(slk_touch());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_slk_set(int labelnr, string label, int format)
- Sets function key labels */
-PHP_FUNCTION(ncurses_slk_set)
-{
- char *str;
- int len;
- long labelnr;
- long format;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsl", &labelnr, &str, &len, &format) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_BOOL(slk_set(labelnr, str, format));
-}
-/* }}} */
-
-
-/* {{{ proto int ncurses_attroff(int attributes)
- Turns off the given attributes */
-PHP_FUNCTION(ncurses_attroff)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(attroff(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_attron(int attributes)
- Turns on the given attributes */
-PHP_FUNCTION(ncurses_attron)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(attron(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_attrset(int attributes)
- Sets given attributes */
-PHP_FUNCTION(ncurses_attrset)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(attrset(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_bkgd(int attrchar)
- Sets background property for terminal screen */
-PHP_FUNCTION(ncurses_bkgd)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(bkgd(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_curs_set(int visibility)
- Sets cursor state */
-PHP_FUNCTION(ncurses_curs_set)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(curs_set(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_delay_output(int milliseconds)
- Delays output on terminal using padding characters */
-PHP_FUNCTION(ncurses_delay_output)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(delay_output(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_echochar(int character)
- Single character output including refresh */
-PHP_FUNCTION(ncurses_echochar)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(echochar(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_halfdelay(int tenth)
- Puts terminal into halfdelay mode */
-PHP_FUNCTION(ncurses_halfdelay)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(halfdelay(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_has_key(int keycode)
- Checks for presence of a function key on terminal keyboard */
-PHP_FUNCTION(ncurses_has_key)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(has_key(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_insch(int character)
- Inserts character moving rest of line including character at current position */
-PHP_FUNCTION(ncurses_insch)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(insch(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_insdelln(int count)
- Inserts lines before current line scrolling down (negative numbers delete and scroll up) */
-PHP_FUNCTION(ncurses_insdelln)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(insdelln(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_mouseinterval(int milliseconds)
- Sets timeout for mouse button clicks */
-PHP_FUNCTION(ncurses_mouseinterval)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(mouseinterval(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_napms(int milliseconds)
- Sleep */
-PHP_FUNCTION(ncurses_napms)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(napms(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_scrl(int count)
- Scrolls window content up or down without changing current position */
-PHP_FUNCTION(ncurses_scrl)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(scrl(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_slk_attroff(int intarg)
- ??? */
-PHP_FUNCTION(ncurses_slk_attroff)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(slk_attroff(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_slk_attron(int intarg)
- ??? */
-PHP_FUNCTION(ncurses_slk_attron)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(slk_attron(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_slk_attrset(int intarg)
- ??? */
-PHP_FUNCTION(ncurses_slk_attrset)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(slk_attrset(intarg));
-}
-/* }}} */
-
-#ifdef HAVE_NCURSES_SLK_COLOR
-/* {{{ proto int ncurses_slk_color(int intarg)
- Sets color for soft label keys*/
-PHP_FUNCTION(ncurses_slk_color)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(slk_color(intarg));
-}
-/* }}} */
-#endif
-
-/* {{{ proto int ncurses_slk_init(int intarg)
- Inits soft label keys */
-PHP_FUNCTION(ncurses_slk_init)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(slk_init(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_typeahead(int fd)
- Specifys different filedescriptor for typeahead checking */
-PHP_FUNCTION(ncurses_typeahead)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(typeahead(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_ungetch(int keycode)
- Puts a character back into the input stream */
-PHP_FUNCTION(ncurses_ungetch)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(ungetch(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_vidattr(int intarg)
- ??? */
-PHP_FUNCTION(ncurses_vidattr)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(vidattr(intarg));
-}
-/* }}} */
-
-#ifdef HAVE_NCURSES_USE_EXTENDED_NAMES
-/* {{{ proto int ncurses_use_extended_names(bool flag)
- Controls use of extended names in terminfo descriptions */
-PHP_FUNCTION(ncurses_use_extended_names)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(use_extended_names(intarg));
-}
-/* }}} */
-#endif
-
-/* {{{ proto void ncurses_bkgdset(int attrchar)
- Controls screen background */
-PHP_FUNCTION(ncurses_bkgdset)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- bkgdset(intarg);
-}
-/* }}} */
-
-/* {{{ proto int ncurses_filter(void)
- */
-PHP_FUNCTION(ncurses_filter)
-{
- IS_NCURSES_INITIALIZED();
- filter();
-}
-/* }}} */
-
-/* {{{ proto int ncurses_noqiflush(void)
- Do not flush on signal characters*/
-PHP_FUNCTION(ncurses_noqiflush)
-{
- IS_NCURSES_INITIALIZED();
- noqiflush();
-}
-/* }}} */
-
-/* {{{ proto int ncurses_qiflush(void)
- Flushes on signal characters */
-PHP_FUNCTION(ncurses_qiflush)
-{
- IS_NCURSES_INITIALIZED();
- qiflush();
-}
-/* }}} */
-
-/* {{{ proto void ncurses_timeout(int millisec)
- Sets timeout for special key sequences */
-PHP_FUNCTION(ncurses_timeout)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- timeout(intarg);
-}
-/* }}} */
-
-/* {{{ proto void ncurses_use_env(bool flag)
- Controls use of environment information about terminal size */
-PHP_FUNCTION(ncurses_use_env)
-{
- long intarg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- use_env(intarg);
-}
-/* }}} */
-
-/* {{{ proto int ncurses_addstr(string text)
- Outputs text at current position */
-PHP_FUNCTION(ncurses_addstr)
-{
- char *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(addstr(str));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_putp(string text)
- ??? */
-PHP_FUNCTION(ncurses_putp)
-{
- char *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(putp(str));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_scr_dump(string filename)
- Dumps screen content to file */
-PHP_FUNCTION(ncurses_scr_dump)
-{
- char *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(scr_dump(str));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_scr_init(string filename)
- Initializes screen from file dump */
-PHP_FUNCTION(ncurses_scr_init)
-{
- char *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(scr_init(str));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_scr_restore(string filename)
- Restores screen from file dump */
-PHP_FUNCTION(ncurses_scr_restore)
-{
- char *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(scr_restore(str));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_scr_set(string filename)
- Inherits screen from file dump */
-PHP_FUNCTION(ncurses_scr_set)
-{
- char *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(scr_set(str));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_mvaddch(int y, int x, int c)
- Moves current position and add character */
-PHP_FUNCTION(ncurses_mvaddch)
-{
- long y,x,c;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &y, &x, &c) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(mvaddch(y,x,c));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_mvaddchnstr(int y, int x, string s, int n)
- Moves position and add attrributed string with specified length */
-PHP_FUNCTION(ncurses_mvaddchnstr)
-{
- long y,x,n;
- char *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llsl", &y, &x, &str, &str_len, &n) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(mvaddchnstr(y,x,(chtype *)str,n));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_addchnstr(string s, int n)
- Adds attributed string with specified length at current position */
-PHP_FUNCTION(ncurses_addchnstr)
-{
- long n;
- char *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &str, &str_len, &n) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(addchnstr((chtype *)str,n));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_mvaddchstr(int y, int x, string s)
- Moves position and add attributed string */
-PHP_FUNCTION(ncurses_mvaddchstr)
-{
- long y,x;
- char *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls", &y, &x, &str, &str_len) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(mvaddchstr(y,x,(chtype *)str));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_addchstr(string s)
- Adds attributed string at current position */
-PHP_FUNCTION(ncurses_addchstr)
-{
- char *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(addchstr((chtype *)str));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_mvaddnstr(int y, int x, string s, int n)
- Moves position and add string with specified length */
-PHP_FUNCTION(ncurses_mvaddnstr)
-{
- long y,x,n;
- char *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llsl", &y, &x, &str, &str_len, &n) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(mvaddnstr(y,x,str,n));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_addnstr(string s, int n)
- Adds string with specified length at current position */
-PHP_FUNCTION(ncurses_addnstr)
-{
- long n;
- char *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &str, &str_len, &n) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(addnstr(str,n));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_mvaddstr(int y, int x, string s)
- Moves position and add string */
-PHP_FUNCTION(ncurses_mvaddstr)
-{
- long y,x;
- char *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls", &y, &x, &str, &str_len) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(mvaddstr(y,x,str));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_mvdelch(int y, int x)
- Moves position and delete character, shift rest of line left */
-PHP_FUNCTION(ncurses_mvdelch)
-{
- long y,x;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls", &y, &x) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(mvdelch(y,x));
-}
-/* }}} */
-
-
-/* {{{ proto int ncurses_mvgetch(int y, int x)
- Moves position and get character at new position */
-PHP_FUNCTION(ncurses_mvgetch)
-{
- long y,x;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls", &y, &x) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(mvgetch(y,x));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_mvinch(int y, int x)
- Moves position and get attributed character at new position */
-PHP_FUNCTION(ncurses_mvinch)
-{
- long y,x;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls", &y, &x) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(mvinch(y,x));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_insstr(string text)
- Inserts string at current position, moving rest of line right */
-PHP_FUNCTION(ncurses_insstr)
-{
- char *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(insstr(str));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_instr(string &buffer)
- Reads string from terminal screen */
-PHP_FUNCTION(ncurses_instr)
-{
- ulong retval;
- zval *param;
- char *str;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &param) == FAILURE ) {
- return;
- }
- IS_NCURSES_INITIALIZED();
-
- str = (char *)emalloc(COLS + 1);
- retval = instr(str);
-
- ZVAL_STRING(param, str, strlen(str));
- efree(str);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int ncurses_mvhline(int y, int x, int attrchar, int n)
- Sets new position and draw a horizontal line using an attributed character and max. n characters long */
-PHP_FUNCTION(ncurses_mvhline)
-{
- long i1,i2,i3,i4;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &i1, &i2, &i3, &i4) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(mvhline(i1,i2,i3,i4));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_mvvline(int y, int x, int attrchar, int n)
- Sets new position and draw a vertical line using an attributed character and max. n characters long */
-PHP_FUNCTION(ncurses_mvvline)
-{
- long i1,i2,i3,i4;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &i1, &i2, &i3, &i4) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(mvvline(i1,i2,i3,i4));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_mvcur(int old_y,int old_x, int new_y, int new_x)
- Moves cursor immediately */
-PHP_FUNCTION(ncurses_mvcur)
-{
- long i1,i2,i3,i4;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &i1, &i2, &i3, &i4) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(mvcur(i1,i2,i3,i4));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_init_color(int color, int r, int g, int b)
- Sets new RGB value for color */
-PHP_FUNCTION(ncurses_init_color)
-{
- long i1,i2,i3,i4;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &i1, &i2, &i3, &i4) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(init_color(i1,i2,i3,i4));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_color_content(int color, int &r, int &g, int &b)
- Gets the RGB value for color */
-PHP_FUNCTION(ncurses_color_content)
-{
- zval *r, *g, *b;
- short rv, gv, bv;
- int retval;
- long c;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lzzz", &c, &r, &g, &b) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
-
- retval = color_content(c, &rv, &gv, &bv);
-
- ZVAL_LONG(r, rv);
- ZVAL_LONG(g, gv);
- ZVAL_LONG(b, bv);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int ncurses_pair_content(int pair, int &f, int &b)
- Gets the RGB value for color */
-PHP_FUNCTION(ncurses_pair_content)
-{
- zval *f, *b;
- short fv, bv;
- int retval;
- long p;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lzz", &p, &f, &b) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
-
- retval = pair_content(p, &fv, &bv);
-
- ZVAL_LONG(f, fv);
- ZVAL_LONG(b, bv);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int ncurses_border(int left, int right, int top, int bottom, int tl_corner, int tr_corner, int bl_corner, int br_corner)
- Draws a border around the screen using attributed characters */
-PHP_FUNCTION(ncurses_border)
-{
- long i1,i2,i3,i4,i5,i6,i7,i8;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llllllll", &i1, &i2, &i3, &i4, &i5, &i6, &i7, &i8) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(border(i1,i2,i3,i4,i5,i6,i7,i8));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_wborder(resource window, int left, int right, int top, int bottom, int tl_corner, int tr_corner, int bl_corner, int br_corner)
- Draws a border around the window using attributed characters */
-PHP_FUNCTION(ncurses_wborder)
-{
- long i1,i2,i3,i4,i5,i6,i7,i8;
- zval *handle;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllllll", &handle, &i1, &i2, &i3, &i4, &i5, &i6, &i7, &i8) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(wborder(*win,i1,i2,i3,i4,i5,i6,i7,i8));
-}
-/* }}} */
-
-#ifdef HAVE_NCURSES_ASSUME_DEFAULT_COLORS
-/* {{{ proto int ncurses_assume_default_colors(int fg, int bg)
- Defines default colors for color 0 */
-PHP_FUNCTION(ncurses_assume_default_colors)
-{
- long i1,i2;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &i1, &i2) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(assume_default_colors(i1,i2));
-}
-/* }}} */
-#endif
-
-/* {{{ proto int ncurses_define_key(string definition, int keycode)
- Defines a keycode */
-PHP_FUNCTION(ncurses_define_key)
-{
- long n;
- char *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &str, &str_len, &n) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(define_key(str,n));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_hline(int charattr, int n)
- Draws a horizontal line at current position using an attributed character and max. n characters long */
-PHP_FUNCTION(ncurses_hline)
-{
- long i1,i2;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &i1, &i2) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(hline(i1,i2));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_vline(int charattr, int n)
- Draws a vertical line at current position using an attributed character and max. n characters long */
-PHP_FUNCTION(ncurses_vline)
-{
- long i1,i2;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &i1, &i2) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(vline(i1,i2));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_whline(resource window, int charattr, int n)
- Draws a horizontal line in a window at current position using an attributed character and max. n characters long */
-PHP_FUNCTION(ncurses_whline)
-{
- long i1,i2;
- zval *handle;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &handle, &i1, &i2) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(whline(*win,i1,i2));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_wvline(resource window, int charattr, int n)
- Draws a vertical line in a window at current position using an attributed character and max. n characters long */
-PHP_FUNCTION(ncurses_wvline)
-{
- long i1,i2;
- zval *handle;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &handle, &i1, &i2) == FAILURE) {
- return;
- }
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(wvline(*win,i1,i2));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_keyok(int keycode, bool enable)
- Enables or disable a keycode */
-PHP_FUNCTION(ncurses_keyok)
-{
- long i,b;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &i, &b) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
- RETURN_LONG(hline(i,b));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_mvwaddstr(resource window, int y, int x, string text)
- Adds string at new position in window */
-PHP_FUNCTION(ncurses_mvwaddstr)
-{
- zval *handle;
- long y, x;
- int text_len;
- char *text;
- WINDOW **w;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlls", &handle, &y, &x, &text, &text_len) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(w, &handle);
-
- RETURN_LONG(mvwaddstr(*w,y,x,text));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_wrefresh(resource window)
- Refreshes window on terminal screen */
-PHP_FUNCTION(ncurses_wrefresh)
-{
- zval *handle;
- WINDOW **w;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(w, &handle);
-
- RETURN_LONG(wrefresh(*w));
-}
-/* }}} */
-
-/* {{{ proto string ncurses_termname(void)
- Returns terminal name */
-PHP_FUNCTION(ncurses_termname)
-{
- char temp[15];
-
- IS_NCURSES_INITIALIZED();
-
- strlcpy(temp, termname(), sizeof(temp));
-
- RETURN_STRINGL (temp, strlen(temp), 1);
-}
-/* }}} */
-
-/* {{{ proto string ncurses_longname(void)
- Returns terminal description */
-PHP_FUNCTION(ncurses_longname)
-{
- char temp[128];
-
- IS_NCURSES_INITIALIZED();
-
- strlcpy(temp, longname(), sizeof(temp));
-
- RETURN_STRINGL (temp, strlen(temp), 1);
-}
-/* }}} */
-
-/* {{{ proto int ncurses_mousemask(int newmask, int &oldmask)
- Returns and sets mouse options */
-PHP_FUNCTION(ncurses_mousemask)
-{
- ulong oldmask;
- ulong retval;
- zval *param;
- long newmask;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz", &newmask, &param) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
-
- retval = mousemask(newmask, &oldmask);
-
- ZVAL_LONG(param, oldmask);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_getmouse(array &mevent)
- Reads mouse event from queue */
-PHP_FUNCTION(ncurses_getmouse)
-{
- zval *arg;
- MEVENT mevent;
- ulong retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
-
- pval_destructor(arg);
- array_init(arg);
-
- retval = getmouse(&mevent);
-
- add_assoc_long(arg, "id", mevent.id);
- add_assoc_long(arg, "x", mevent.x);
- add_assoc_long(arg, "y", mevent.y);
- add_assoc_long(arg, "z", mevent.z);
- add_assoc_long(arg, "mmask", mevent.bstate);
-
- RETURN_BOOL(retval == 0);
-}
-/* }}} */
-
-/* {{{ proto int ncurses_ungetmouse(array mevent)
- Pushes mouse event to queue */
-PHP_FUNCTION(ncurses_ungetmouse)
-{
- zval *arg, **pvalue;
- MEVENT mevent;
- ulong retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &arg) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
-
- if (zend_hash_find(Z_ARRVAL_P(arg), "id", sizeof("id"), (void **) &pvalue) == SUCCESS) {
- convert_to_long_ex(pvalue);
- mevent.id = Z_LVAL_PP(pvalue);
- }
-
- if (zend_hash_find(Z_ARRVAL_P(arg), "x", sizeof("x"), (void **) &pvalue) == SUCCESS) {
- convert_to_long_ex(pvalue);
- mevent.x = Z_LVAL_PP(pvalue);
- }
-
- if (zend_hash_find(Z_ARRVAL_P(arg), "y", sizeof("y"), (void **) &pvalue) == SUCCESS) {
- convert_to_long_ex(pvalue);
- mevent.y = Z_LVAL_PP(pvalue);
- }
-
- if (zend_hash_find(Z_ARRVAL_P(arg), "z", sizeof("z"), (void **) &pvalue) == SUCCESS) {
- convert_to_long_ex(pvalue);
- mevent.z = Z_LVAL_PP(pvalue);
- }
-
- if (zend_hash_find(Z_ARRVAL_P(arg), "mmask", sizeof("mmask"), (void **) &pvalue) == SUCCESS) {
- convert_to_long_ex(pvalue);
- mevent.bstate = Z_LVAL_PP(pvalue);
- }
-
- retval = ungetmouse(&mevent);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_mouse_trafo(int &y, int &x, bool toscreen)
- Transforms coordinates */
-PHP_FUNCTION(ncurses_mouse_trafo)
-{
- zval *x, *y;
- zend_bool toscreen;
- int nx, ny, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzb", &y, &x, &toscreen) == FAILURE) {
- return;
- }
- IS_NCURSES_INITIALIZED();
-
- convert_to_long(y);
- convert_to_long(x);
-
- nx = Z_LVAL_P(x);
- ny = Z_LVAL_P(y);
-
- retval = mouse_trafo(&ny, &nx, toscreen);
-
- ZVAL_LONG(x, nx);
- ZVAL_LONG(y, ny);
-
- RETURN_BOOL(retval);
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_wmouse_trafo(resource window, int &y, int &x, bool toscreen)
- Transforms window/stdscr coordinates */
-PHP_FUNCTION(ncurses_wmouse_trafo)
-{
- zval *handle, *x, *y;
- int nx, ny, retval;
- WINDOW **win;
- zend_bool toscreen;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzzb", &handle, &y, &x, &toscreen) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- convert_to_long(x);
- convert_to_long(y);
-
- nx = Z_LVAL_P(x);
- ny = Z_LVAL_P(y);
-
- retval = wmouse_trafo (*win, &ny, &nx, toscreen);
-
- ZVAL_LONG(x, nx);
- ZVAL_LONG(y, ny);
-
- RETURN_BOOL(retval);
-}
-/* }}} */
-
-/* {{{ proto void ncurses_getyx(resource window, int &y, int &x)
- Returns the current cursor position for a window */
-PHP_FUNCTION(ncurses_getyx)
-{
- zval *handle, *x, *y;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzz", &handle, &y, &x) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- convert_to_long(x);
- convert_to_long(y);
-
- getyx(*win, Z_LVAL_P(y), Z_LVAL_P(x));
-}
-/* }}} */
-
-/* {{{ proto void ncurses_getmaxyx(resource window, int &y, int &x)
- Returns the size of a window */
-PHP_FUNCTION(ncurses_getmaxyx)
-{
- zval *handle, *x, *y;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzz", &handle, &y, &x) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- convert_to_long(x);
- convert_to_long(y);
-
- getmaxyx(*win, Z_LVAL_P(y), Z_LVAL_P(x));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_wmove(resource window, int y, int x)
- Moves windows output position */
-PHP_FUNCTION(ncurses_wmove)
-{
- zval *handle, *x, *y;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzz", &handle, &y, &x) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- convert_to_long(x);
- convert_to_long(y);
-
- RETURN_LONG(wmove(*win, Z_LVAL_P(y), Z_LVAL_P(x)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_keypad(resource window, bool bf)
- Turns keypad on or off */
-PHP_FUNCTION(ncurses_keypad)
-{
- zval *handle;
- zend_bool bf;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &handle, &bf) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(keypad(*win, bf));
-
-}
-/* }}} */
-
-#ifdef HAVE_NCURSES_COLOR_SET
-/* {{{ proto int ncurses_wcolor_set(resource window, int color_pair)
- Sets windows color pairings */
-PHP_FUNCTION(ncurses_wcolor_set)
-{
- zval *handle;
- long color_pair;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &handle, &color_pair) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(wcolor_set(*win, color_pair, 0));
-}
-/* }}} */
-#endif
-
-/* {{{ proto int ncurses_wclear(resource window)
- Clears window */
-PHP_FUNCTION(ncurses_wclear)
-{
- zval *handle;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(wclear(*win));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_wnoutrefresh(resource window)
- Copies window to virtual screen */
-PHP_FUNCTION(ncurses_wnoutrefresh)
-{
- zval *handle;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(wnoutrefresh(*win));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_waddstr(resource window, string str [, int n])
- Outputs text at current postion in window */
-PHP_FUNCTION(ncurses_waddstr)
-{
- zval *handle;
- char *str;
- int str_len;
- long n = 0;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &handle, &str, &str_len, &n) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
- if (!n) {
- RETURN_LONG(waddstr(*win, str));
- } else {
- RETURN_LONG(waddnstr(*win, str, n));
- }
-}
-/* }}} */
-
-/* {{{ proto int ncurses_wgetch(resource window)
- Reads a character from keyboard (window) */
-PHP_FUNCTION(ncurses_wgetch)
-{
- zval *handle;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(wgetch(*win));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_wattroff(resource window, int attrs)
- Turns off attributes for a window */
-PHP_FUNCTION(ncurses_wattroff)
-{
- zval *handle;
- WINDOW **win;
- long attrs;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &handle, &attrs) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(wattroff(*win, attrs));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_wattron(resource window, int attrs)
- Turns on attributes for a window */
-PHP_FUNCTION(ncurses_wattron)
-{
- zval *handle;
- WINDOW **win;
- long attrs;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &handle, &attrs) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(wattron(*win, attrs));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_wattrset(resource window, int attrs)
- Set the attributes for a window */
-PHP_FUNCTION(ncurses_wattrset)
-{
- zval *handle;
- WINDOW **win;
- long attrs;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &handle, &attrs) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(wattrset(*win, attrs));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_wstandend(resource window)
- End standout mode for a window */
-PHP_FUNCTION(ncurses_wstandend)
-{
- zval *handle;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(wstandend(*win));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_wstandout(resource window)
- Enter standout mode for a window */
-PHP_FUNCTION(ncurses_wstandout)
-{
- zval *handle;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- RETURN_LONG(wstandout(*win));
-}
-/* }}} */
-
-#if HAVE_NCURSES_PANEL
-/* {{{ proto resource ncurses_new_panel(resource window)
- Create a new panel and associate it with window */
-PHP_FUNCTION(ncurses_new_panel)
-{
- zval *handle;
- WINDOW **win;
- PANEL **panel;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
- return;
- }
-
- FETCH_WINRES(win, &handle);
-
- panel = (PANEL **)emalloc(sizeof(PANEL *));
- *panel = new_panel(*win);
-
- if (*panel == NULL) {
- efree(panel);
- RETURN_FALSE;
- } else {
- long id = ZEND_REGISTER_RESOURCE(return_value, panel, le_ncurses_panels);
- set_panel_userptr(*panel, (void*)id);
- }
-
-}
-/* }}} */
-
-/* {{{ proto int ncurses_del_panel(resource panel)
- Remove panel from the stack and delete it (but not the associated window) */
-PHP_FUNCTION(ncurses_del_panel)
-{
- zval *handle;
- PANEL **panel;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
- return;
- }
-
- FETCH_PANEL(panel, &handle);
-
- RETURN_LONG(del_panel(*panel));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_hide_panel(resource panel)
- Remove panel from the stack, making it invisible */
-PHP_FUNCTION(ncurses_hide_panel)
-{
- zval *handle;
- PANEL **panel;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
- return;
- }
-
- FETCH_PANEL(panel, &handle);
-
- RETURN_LONG(hide_panel(*panel));
-
-}
-/* }}} */
-
-/* {{{ proto int ncurses_show_panel(resource panel)
- Places an invisible panel on top of the stack, making it visible */
-PHP_FUNCTION(ncurses_show_panel)
-{
- zval *handle;
- PANEL **panel;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
- return;
- }
-
- FETCH_PANEL(panel, &handle);
-
- RETURN_LONG(show_panel(*panel));
-
-}
-/* }}} */
-
-/* {{{ proto int ncurses_top_panel(resource panel)
- Moves a visible panel to the top of the stack */
-PHP_FUNCTION(ncurses_top_panel)
-{
- zval *handle;
- PANEL **panel;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
- return;
- }
-
- FETCH_PANEL(panel, &handle);
-
- RETURN_LONG(top_panel(*panel));
-
-}
-/* }}} */
-
-/* {{{ proto int ncurses_bottom_panel(resource panel)
- Moves a visible panel to the bottom of the stack */
-PHP_FUNCTION(ncurses_bottom_panel)
-{
- zval *handle;
- PANEL **panel;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
- return;
- }
-
- FETCH_PANEL(panel, &handle);
-
- RETURN_LONG(bottom_panel(*panel));
-
-}
-/* }}} */
-
-/* {{{ proto int ncurses_move_panel(resource panel, int startx, int starty)
- Moves a panel so that it's upper-left corner is at [startx, starty] */
-PHP_FUNCTION(ncurses_move_panel)
-{
- zval *handle;
- PANEL **panel;
- long startx, starty;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &handle, &startx, &starty) == FAILURE) {
- return;
- }
-
- FETCH_PANEL(panel, &handle);
-
- RETURN_LONG(move_panel(*panel, startx, starty));
-
-}
-/* }}} */
-
-/* {{{ proto int ncurses_replace_panel(resource panel, resource window)
- Replaces the window associated with panel */
-PHP_FUNCTION(ncurses_replace_panel)
-{
- zval *phandle, *whandle;
- PANEL **panel;
- WINDOW **window;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &phandle, &whandle) == FAILURE) {
- return;
- }
-
- FETCH_PANEL(panel, &phandle);
- FETCH_WINRES(window, &whandle);
-
- RETURN_LONG(replace_panel(*panel, *window));
-
-}
-/* }}} */
-
-/* {{{ proto int ncurses_panel_above(resource panel)
- Returns the panel above panel. If panel is null, returns the bottom panel in the stack */
-PHP_FUNCTION(ncurses_panel_above)
-{
- zval *phandle = NULL;
- PANEL **panel;
- PANEL *above;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r!", &phandle) == FAILURE) {
- return;
- }
-
- if (phandle) {
- FETCH_PANEL(panel, &phandle);
- above = panel_above(*panel);
- } else {
- above = panel_above((PANEL *)0);
- }
-
- if (above) {
- long id = (long)panel_userptr(above);
- zend_list_addref(id);
- RETURN_RESOURCE(id);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int ncurses_panel_below(resource panel)
- Returns the panel below panel. If panel is null, returns the top panel in the stack */
-PHP_FUNCTION(ncurses_panel_below)
-{
- zval *phandle = NULL;
- PANEL **panel;
- PANEL *below;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r!", &phandle) == FAILURE) {
- return;
- }
-
- if (phandle) {
- FETCH_PANEL(panel, &phandle);
- below = panel_below(*panel);
- } else {
- below = panel_below((PANEL *)0);
- }
- if (below) {
- long id = (long)panel_userptr(below);
- zend_list_addref(id);
- RETURN_RESOURCE(id);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int ncurses_panel_window(resource panel)
- Returns the window associated with panel */
-PHP_FUNCTION(ncurses_panel_window)
-{
- zval *phandle = NULL;
- PANEL **panel;
- WINDOW **win;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &phandle) == FAILURE) {
- return;
- }
-
- FETCH_PANEL(panel, &phandle);
-
- win = (WINDOW **)emalloc(sizeof(WINDOW *));
- *win = panel_window(*panel);
-
- if (*win == NULL) {
- efree(win);
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, win, le_ncurses_windows);
-}
-/* }}} */
-
-/* {{{ proto void ncurses_update_panels(void)
- Refreshes the virtual screen to reflect the relations between panels in the stack. */
-PHP_FUNCTION(ncurses_update_panels)
-{
- IS_NCURSES_INITIALIZED();
- update_panels();
-}
-/* }}} */
-#endif /* HAVE_NCURSES_PANEL */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/ncurses/php_ncurses.h b/ext/ncurses/php_ncurses.h
deleted file mode 100644
index c3cb947664..0000000000
--- a/ext/ncurses/php_ncurses.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_NCURSES_H
-#define PHP_NCURSES_H
-
-#include <curses.h>
-
-extern int le_ncurses_windows;
-
-#if HAVE_NCURSES_PANEL
-# include <panel.h>
-extern int le_ncurses_panels;
-#endif
-
-
-extern zend_module_entry ncurses_module_entry;
-#define phpext_ncurses_ptr &ncurses_module_entry
-
-extern function_entry ncurses_functions[];
-#include "php_ncurses_fe.h"
-
-#ifdef PHP_WIN32
-#define PHP_NCURSES_API __declspec(dllexport)
-#else
-#define PHP_NCURSES_API
-#endif
-
-PHP_MINIT_FUNCTION(ncurses);
-PHP_MSHUTDOWN_FUNCTION(ncurses);
-PHP_RINIT_FUNCTION(ncurses);
-PHP_RSHUTDOWN_FUNCTION(ncurses);
-PHP_MINFO_FUNCTION(ncurses);
-
-ZEND_BEGIN_MODULE_GLOBALS(ncurses)
- int registered_constants;
-ZEND_END_MODULE_GLOBALS(ncurses)
-
-/* In every function that needs to use variables in php_ncurses_globals,
- do call NCURSES_LS_FETCH(); after declaring other variables used by
- that function, and always refer to them as NCURSES_G(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define NCURSES_G(v) TSRMG(ncurses_globals_id, zend_ncurses_globals *, v)
-#define NCURSES_LS_FETCH() zend_ncurses_globals *ncurses_globals = ts_resource(ncurses_globals_id)
-#else
-#define NCURSES_G(v) (ncurses_globals.v)
-#define NCURSES_LS_FETCH()
-#endif
-
-ZEND_EXTERN_MODULE_GLOBALS(ncurses);
-
-#endif /* PHP_NCURSES_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/ncurses/php_ncurses_fe.h b/ext/ncurses/php_ncurses_fe.h
deleted file mode 100644
index 0cddea9d24..0000000000
--- a/ext/ncurses/php_ncurses_fe.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Hartmut Holzgraefe <hholzgra@php.net> |
- | Georg Richter <georg.richter@php-ev.de> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_NCURSES_FE_H
-#define PHP_NCURSES_FE_H
-
-PHP_FUNCTION(ncurses_addch);
-PHP_FUNCTION(ncurses_color_set);
-PHP_FUNCTION(ncurses_delwin);
-PHP_FUNCTION(ncurses_end);
-PHP_FUNCTION(ncurses_getch);
-PHP_FUNCTION(ncurses_has_colors);
-PHP_FUNCTION(ncurses_init);
-PHP_FUNCTION(ncurses_init_pair);
-PHP_FUNCTION(ncurses_color_content);
-PHP_FUNCTION(ncurses_pair_content);
-PHP_FUNCTION(ncurses_move);
-PHP_FUNCTION(ncurses_newwin);
-PHP_FUNCTION(ncurses_refresh);
-PHP_FUNCTION(ncurses_start_color);
-PHP_FUNCTION(ncurses_standout);
-PHP_FUNCTION(ncurses_standend);
-PHP_FUNCTION(ncurses_baudrate);
-PHP_FUNCTION(ncurses_beep);
-PHP_FUNCTION(ncurses_can_change_color);
-PHP_FUNCTION(ncurses_cbreak);
-PHP_FUNCTION(ncurses_clear);
-PHP_FUNCTION(ncurses_clrtobot);
-PHP_FUNCTION(ncurses_clrtoeol);
-PHP_FUNCTION(ncurses_def_prog_mode);
-PHP_FUNCTION(ncurses_reset_prog_mode);
-PHP_FUNCTION(ncurses_def_shell_mode);
-PHP_FUNCTION(ncurses_reset_shell_mode);
-PHP_FUNCTION(ncurses_delch);
-PHP_FUNCTION(ncurses_deleteln);
-PHP_FUNCTION(ncurses_doupdate);
-PHP_FUNCTION(ncurses_echo);
-PHP_FUNCTION(ncurses_erase);
-PHP_FUNCTION(ncurses_werase);
-PHP_FUNCTION(ncurses_erasechar);
-PHP_FUNCTION(ncurses_flash);
-PHP_FUNCTION(ncurses_flushinp);
-PHP_FUNCTION(ncurses_has_ic);
-PHP_FUNCTION(ncurses_has_il);
-PHP_FUNCTION(ncurses_inch);
-PHP_FUNCTION(ncurses_insertln);
-PHP_FUNCTION(ncurses_isendwin);
-PHP_FUNCTION(ncurses_killchar);
-PHP_FUNCTION(ncurses_nl);
-PHP_FUNCTION(ncurses_nocbreak);
-PHP_FUNCTION(ncurses_noecho);
-PHP_FUNCTION(ncurses_nonl);
-PHP_FUNCTION(ncurses_noraw);
-PHP_FUNCTION(ncurses_raw);
-PHP_FUNCTION(ncurses_meta);
-PHP_FUNCTION(ncurses_resetty);
-PHP_FUNCTION(ncurses_savetty);
-PHP_FUNCTION(ncurses_termattrs);
-PHP_FUNCTION(ncurses_use_default_colors);
-PHP_FUNCTION(ncurses_slk_attr);
-PHP_FUNCTION(ncurses_slk_clear);
-PHP_FUNCTION(ncurses_slk_noutrefresh);
-PHP_FUNCTION(ncurses_slk_refresh);
-PHP_FUNCTION(ncurses_slk_restore);
-PHP_FUNCTION(ncurses_slk_touch);
-PHP_FUNCTION(ncurses_attroff);
-PHP_FUNCTION(ncurses_attron);
-PHP_FUNCTION(ncurses_attrset);
-PHP_FUNCTION(ncurses_bkgd);
-PHP_FUNCTION(ncurses_curs_set);
-PHP_FUNCTION(ncurses_delay_output);
-PHP_FUNCTION(ncurses_echochar);
-PHP_FUNCTION(ncurses_halfdelay);
-PHP_FUNCTION(ncurses_has_key);
-PHP_FUNCTION(ncurses_insch);
-PHP_FUNCTION(ncurses_insdelln);
-PHP_FUNCTION(ncurses_mouseinterval);
-PHP_FUNCTION(ncurses_napms);
-PHP_FUNCTION(ncurses_scrl);
-PHP_FUNCTION(ncurses_slk_attroff);
-PHP_FUNCTION(ncurses_slk_attron);
-PHP_FUNCTION(ncurses_slk_attrset);
-PHP_FUNCTION(ncurses_slk_color);
-PHP_FUNCTION(ncurses_slk_init);
-PHP_FUNCTION(ncurses_slk_set);
-PHP_FUNCTION(ncurses_typeahead);
-PHP_FUNCTION(ncurses_ungetch);
-PHP_FUNCTION(ncurses_vidattr);
-PHP_FUNCTION(ncurses_wrefresh);
-PHP_FUNCTION(ncurses_use_extended_names);
-PHP_FUNCTION(ncurses_bkgdset);
-PHP_FUNCTION(ncurses_filter);
-PHP_FUNCTION(ncurses_noqiflush);
-PHP_FUNCTION(ncurses_qiflush);
-PHP_FUNCTION(ncurses_timeout);
-PHP_FUNCTION(ncurses_use_env);
-PHP_FUNCTION(ncurses_addstr);
-PHP_FUNCTION(ncurses_putp);
-PHP_FUNCTION(ncurses_scr_dump);
-PHP_FUNCTION(ncurses_scr_init);
-PHP_FUNCTION(ncurses_scr_restore);
-PHP_FUNCTION(ncurses_scr_set);
-PHP_FUNCTION(ncurses_mvaddch);
-PHP_FUNCTION(ncurses_mvaddchnstr);
-PHP_FUNCTION(ncurses_addchnstr);
-PHP_FUNCTION(ncurses_mvaddchstr);
-PHP_FUNCTION(ncurses_addchstr);
-PHP_FUNCTION(ncurses_mvaddnstr);
-PHP_FUNCTION(ncurses_addnstr);
-PHP_FUNCTION(ncurses_mvaddstr);
-PHP_FUNCTION(ncurses_mvdelch);
-PHP_FUNCTION(ncurses_mvgetch);
-PHP_FUNCTION(ncurses_mvinch);
-PHP_FUNCTION(ncurses_mvwaddstr);
-PHP_FUNCTION(ncurses_insstr);
-PHP_FUNCTION(ncurses_instr);
-PHP_FUNCTION(ncurses_mvhline);
-PHP_FUNCTION(ncurses_mvcur);
-PHP_FUNCTION(ncurses_init_color);
-PHP_FUNCTION(ncurses_border);
-PHP_FUNCTION(ncurses_assume_default_colors);
-PHP_FUNCTION(ncurses_define_key);
-PHP_FUNCTION(ncurses_hline);
-PHP_FUNCTION(ncurses_vline);
-PHP_FUNCTION(ncurses_keyok);
-PHP_FUNCTION(ncurses_termname);
-PHP_FUNCTION(ncurses_longname);
-PHP_FUNCTION(ncurses_mousemask);
-PHP_FUNCTION(ncurses_getmouse);
-PHP_FUNCTION(ncurses_ungetmouse);
-PHP_FUNCTION(ncurses_mouse_trafo);
-PHP_FUNCTION(ncurses_wmouse_trafo);
-PHP_FUNCTION(ncurses_waddstr);
-PHP_FUNCTION(ncurses_wnoutrefresh);
-PHP_FUNCTION(ncurses_wclear);
-PHP_FUNCTION(ncurses_wcolor_set);
-PHP_FUNCTION(ncurses_wgetch);
-PHP_FUNCTION(ncurses_keypad);
-PHP_FUNCTION(ncurses_wmove);
-
-PHP_FUNCTION(ncurses_newpad);
-PHP_FUNCTION(ncurses_prefresh);
-PHP_FUNCTION(ncurses_pnoutrefresh);
-
-PHP_FUNCTION(ncurses_wstandout);
-PHP_FUNCTION(ncurses_wstandend);
-PHP_FUNCTION(ncurses_wattrset);
-PHP_FUNCTION(ncurses_wattron);
-PHP_FUNCTION(ncurses_wattroff);
-PHP_FUNCTION(ncurses_waddch);
-PHP_FUNCTION(ncurses_wborder);
-PHP_FUNCTION(ncurses_whline);
-PHP_FUNCTION(ncurses_wvline);
-PHP_FUNCTION(ncurses_getyx);
-PHP_FUNCTION(ncurses_getmaxyx);
-#if HAVE_NCURSES_PANEL
-PHP_FUNCTION(ncurses_update_panels);
-PHP_FUNCTION(ncurses_panel_window);
-PHP_FUNCTION(ncurses_panel_below);
-PHP_FUNCTION(ncurses_panel_above);
-PHP_FUNCTION(ncurses_replace_panel);
-PHP_FUNCTION(ncurses_move_panel);
-PHP_FUNCTION(ncurses_bottom_panel);
-PHP_FUNCTION(ncurses_top_panel);
-PHP_FUNCTION(ncurses_show_panel);
-PHP_FUNCTION(ncurses_hide_panel);
-PHP_FUNCTION(ncurses_del_panel);
-PHP_FUNCTION(ncurses_new_panel);
-#endif
-
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/ncurses/tests/001.phpt b/ext/ncurses/tests/001.phpt
deleted file mode 100644
index 90d9c1452f..0000000000
--- a/ext/ncurses/tests/001.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Check for ncurses presence
---SKIPIF--
-<?php if (!extension_loaded("ncurses")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "ncurses extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php4/tests/README for further information on
- writing regression tests
-*/
-?>
---EXPECT--
-ncurses extension is available \ No newline at end of file
diff --git a/ext/notes/notes.dsp b/ext/notes/notes.dsp
deleted file mode 100644
index 20a51d81ca..0000000000
--- a/ext/notes/notes.dsp
+++ /dev/null
@@ -1,202 +0,0 @@
-# Microsoft Developer Studio Project File - Name="notes" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=notes - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "notes.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "notes.mak" CFG="notes - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "notes - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "notes - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "notes - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "notes - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "notes - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "notes - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D "MYSQL_EXPORTS" /D "COMPILE_DL_NOTES" /D HAVE_NOTES=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4nts.lib /nologo /dll /machine:I386 /out:"Release/php_notes.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "notes - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "MYSQL_EXPORTS" /D "COMPILE_DL_NOTES" /D HAVE_NOTES=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4nts.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_notes.dll" /pdbtype:sept /libpath:"..\..\..\MySQL\lib\Debug" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "notes - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL" /D HAVE_NOTES=1 /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_NOTES" /D HAVE_NOTES=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4ts.lib /nologo /dll /debug /machine:I386 /out:"Debug_TS/php_notes.dll" /pdbtype:sept /libpath:"..\..\..\MySQL\lib\Debug" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "notes - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_NOTES" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_NOTES=1 /D "NT" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib notes.lib /nologo /dll /machine:I386 /out:"Release_TS/php_notes.dll" /libpath:"..\..\Release_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "notes - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "notes___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "notes___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_NOTES" /D HAVE_NOTES=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_NOTES" /D HAVE_NOTES=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4ts.lib /nologo /dll /machine:I386 /out:"Release_TS/php_notes.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4ts.lib /nologo /dll /machine:I386 /out:"Release_TS_inline/php_notes.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release_TS_inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "notes - Win32 Release"
-# Name "notes - Win32 Debug"
-# Name "notes - Win32 Debug_TS"
-# Name "notes - Win32 Release_TS"
-# Name "notes - Win32 Release_TS_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_notes.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_notes.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\Readme_w32.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/notes/notes.dsw b/ext/notes/notes.dsw
deleted file mode 100644
index 372850224a..0000000000
--- a/ext/notes/notes.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "notes"=".\notes.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ext/notes/php_notes.c b/ext/notes/php_notes.c
deleted file mode 100644
index 16a459ceb1..0000000000
--- a/ext/notes/php_notes.c
+++ /dev/null
@@ -1,2722 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_01.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Brad Atkins <brad@youreshop.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef COMPILE_DL_NOTES
-#define HAVE_NOTES 1
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_notes.h"
-#include "ext/standard/info.h"
-
-#ifdef PHP_WIN32
-#include <global.h>
-#else
-#include <notes_global.h>
-#endif
-
-#include <nsfdb.h>
-#include <nsfdata.h>
-#include <osmisc.h>
-#include <miscerr.h>
-#include <nif.h>
-#include <nsfnote.h>
-#include <editods.h>
-#include <osmem.h>
-#include <stdnames.h>
-#include <nsfsearc.h>
-#include <colorid.h>
-#include <names.h>
-#include <stdnames.h>
-#include <nsferr.h>
-
-/* notes_unread */
-
-#include <idtable.h>
-#include <kfm.h>
-
-/* notes_header_info, notes_body */
-
-#include <malloc.h>
-#include <io.h>
-#include <direct.h>
-#include <fcntl.h>
-#include <globerr.h>
-
-#ifdef PHP_WIN32
-#include <mail.h>
-#else
-#include <notes_mail.h>
-#endif
-
-#include <mailserv.h>
-#include <nsf.h>
-#include <osfile.h> /* OSPathNetConstruct */
-#include <osenv.h> /* OSGetEnvironmentString */
-
-/* notes_nav_create */
-#include <vmods.h>
-
-/* notes_search */
-
-#include <ft.h>
-#include <textlist.h>
-
-/* notes_list */
-
-#define STRING_LENGTH 256
-
-function_entry notes_functions[] = {
- PHP_FE(notes_create_db, NULL)
- PHP_FE(notes_drop_db, NULL)
- PHP_FE(notes_version, NULL)
- PHP_FE(notes_create_note, NULL)
- PHP_FE(notes_unread, NULL)
- PHP_FE(notes_mark_read, NULL)
- PHP_FE(notes_mark_unread, NULL)
- PHP_FE(notes_header_info, NULL)
- PHP_FE(notes_body, NULL)
- PHP_FE(notes_find_note, NULL)
- PHP_FE(notes_nav_create, NULL)
- PHP_FE(notes_search, NULL)
- PHP_FE(notes_copy_db, NULL)
- PHP_FE(notes_list_msgs, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry notes_module_entry = {
- STANDARD_MODULE_HEADER,
- "notes",
- notes_functions,
- PHP_MINIT(notes),
- PHP_MSHUTDOWN(notes),
- PHP_RINIT(notes),
- PHP_RSHUTDOWN(notes),
- PHP_MINFO(notes),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_NOTES
-ZEND_GET_MODULE(notes)
-#endif
-
-
-PHP_MINIT_FUNCTION(notes)
-{
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(notes)
-{
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(notes)
-{
- return SUCCESS;
-}
-
-
-PHP_RINIT_FUNCTION(notes)
-{
-
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(notes)
-{
-
- php_info_print_table_start();
- php_info_print_table_row(2, "Lotus Notes Database Support", "enabled");
- php_info_print_table_end();
-}
-
-/* {{{ proto bool notes_create_db(string database_name)
- Creates a Lotus Notes database */
-PHP_FUNCTION(notes_create_db)
-{
-
- int argc;
- pval *argv[1];
- STATUS error;
- pval **db;
- char error_string[200];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if (error) {
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbCreate (Z_STRVAL_PP(db), (USHORT) DBCLASS_NOTEFILE, FALSE)) {
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to create database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-
- NotesTerm();
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool notes_drop_db(string database_name)
- Drops a Lotus Notes database */
-PHP_FUNCTION(notes_drop_db)
-{
-
- int argc;
- pval *argv[1];
- STATUS error;
- pval **db;
- char error_string[200];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if (error) {
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbDelete (Z_STRVAL_PP(db))) {
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to delete database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-
- NotesTerm();
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string notes_version(string database_name)
- Gets the Lotus Notes version */
-PHP_FUNCTION(notes_version)
-{
-
- int argc;
- pval *argv[1];
- STATUS error;
- DBHANDLE db_handle;
- WORD wbuild;
- char error_string[200];
- pval **db;
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
-
- error = NotesInitExtended(argc, (char **) argv);
-
- if (error) {
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen(Z_STRVAL_PP(db), &db_handle)) {
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if (error = NSFDbGetBuildVersion(db_handle, &wbuild)) {
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to get Lotus Notes version: %s", error_string);
- NSFDbClose(db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- NSFDbClose(db_handle);
- NotesTerm();
-
- if(wbuild > 0 && wbuild < 82) {
- RETURN_DOUBLE(1.0);
- } else if (wbuild > 81 && wbuild < 94) {
- RETURN_DOUBLE(2.0);
- } else if (wbuild > 93 && wbuild < 119) {
- RETURN_DOUBLE(3.0);
- } else if (wbuild > 118 && wbuild < 137) {
- RETURN_DOUBLE(4.0);
- } else if (wbuild == 138) {
- RETURN_DOUBLE(4.1);
- } else if (wbuild > 139 && wbuild < 146) {
- RETURN_DOUBLE(4.5);
- } else if (wbuild == 147) {
- RETURN_DOUBLE(4.6);
- } else {
- RETURN_DOUBLE(5.0);
- }
-}
-/* }}} */
-
-/* {{{ proto string notes_create_note(string database_name, string form_name)
- Creates a note using form form_name */
-PHP_FUNCTION(notes_create_note)
-{
-
- int argc;
- pval *argv[2];
- STATUS error;
- DBHANDLE db_handle;
- NOTEHANDLE note_handle;
- char error_string[200];
- pval **db;
- pval **form_name;
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(2, &db, &form_name)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
- convert_to_string_ex(form_name);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if (error) {
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen(Z_STRVAL_PP(db), &db_handle)) {
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if (error = NSFNoteCreate (db_handle, &note_handle)) {
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to create note: error_string");
- NSFDbClose( db_handle );
- RETURN_FALSE;
- }
-
- /* Append the form name item to the new note */
- if (error = NSFItemSetText(note_handle, FIELD_FORM, Z_STRVAL_PP(form_name), MAXWORD)) {
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to use the form: %s", error_string);
- NSFNoteClose (note_handle);
- NSFDbClose( db_handle );
- RETURN_FALSE;
- }
-
- if (error = NSFNoteUpdate (note_handle, 0)) {
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to save the note: %s", error_string);
- NSFNoteClose (note_handle);
- NSFDbClose(db_handle);
- RETURN_FALSE;
- }
-
- error = NSFNoteClose (note_handle);
-
- NSFDbClose(db_handle);
- NotesTerm();
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* Declarations for notes_mark_read and notes_mark_unread */
-
-#define ACTION_COUNT_MAX (16)
-
-
-/* Entries in the action table */
-
-typedef struct {
- BOOL AddFlag; /* TRUE: Add, FALSE: Remove */
- NOTEID NoteID;
-} ACTION_ENTRY;
-
- /* Table of actions to be performed */
-ACTION_ENTRY ActionTable [ACTION_COUNT_MAX] = {FALSE, 0L};
-
-/*
- * Forward references
- */
-
- /* Function to display unread note table */
-STATUS DisplayUnread (
- DBHANDLE db_handle,
- char NOTESPTR pName,
- WORD nameLen
-);
-
- /* Function to apply actions to unread note table */
-STATUS UpdateUnread (
- DBHANDLE db_handle,
- char NOTESPTR pName,
- WORD nameLen,
- ACTION_ENTRY *pActions,
- int actionCount,
- NOTEID *pUndoID
-);
-
- /* Function that updates a note without changing its unread status */
-STATUS UndoUnreadStatus (
- DBHANDLE db_handle,
- char NOTESPTR pName,
- WORD nameLen,
- ACTION_ENTRY *pActions,
- int actionCount,
- NOTEID UndoID);
-
-
-/* {{{ proto string notes_mark_read(string database_name, string user_name, string note_id)
- Marks a note_id as read for the User user_name. Note: user_name must be fully distinguished user name */
-PHP_FUNCTION(notes_mark_read)
-{
-
- int argc;
- int ActionCount;
- pval *argv[3];
- STATUS error;
- DBHANDLE db_handle;
- pval **db;
- pval **note_id;
- pval **user_name;
-
-
-/* Local data declarations */
-
- WORD UserNameLen = 0;
- char *pEnd;
- int curAction;
- int curArg;
- NOTEID UndoID = 0L;
- char error_string[200];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(3, &db, &user_name, &note_id)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
- convert_to_string_ex(note_id);
- convert_to_string_ex(user_name);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if (error) {
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- curArg = 2;
-
- UserNameLen = Z_STRLEN_PP(user_name);
-
- curAction = 0;
- ActionCount = 1;
-
- ActionTable[curAction].AddFlag = FALSE;
-
- ActionTable[curAction].NoteID = strtoul (Z_STRVAL_PP(note_id), &pEnd, 16);
-
- if (error = NSFDbOpen(Z_STRVAL_PP(db), &db_handle)) {
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- error = UpdateUnread (db_handle, Z_STRVAL_PP(user_name), UserNameLen,
- ActionTable, ActionCount, &UndoID);
-
- if ((error == NOERROR) && UndoID) {
- error = UndoUnreadStatus (db_handle, Z_STRVAL_PP(user_name), UserNameLen, ActionTable,
- ActionCount, UndoID);
- }
-
- /* Close the database */
- error = NSFDbClose (db_handle);
-
- if (NOERROR == error) {
- RETURN_TRUE;
- } else {
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to close database: %s", error_string);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string notes_mark_unread(string database_name, string user_name, string note_id)
- Marks a note_id as unread for the User user_name. Note: user_name must be fully distinguished user name */
-PHP_FUNCTION(notes_mark_unread)
-{
-
- int argc;
- int ActionCount;
- pval *argv[3];
- STATUS error;
- DBHANDLE db_handle;
- pval **db;
- pval **note_id;
- pval **user_name;
-
-
-/* Local data declarations */
-
- WORD UserNameLen = 0;
- char *pEnd;
- int curAction;
- int curArg;
- NOTEID UndoID = 0L;
- char error_string[200];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(3, &db, &user_name, &note_id)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
- convert_to_string_ex(note_id);
- convert_to_string_ex(user_name);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- curArg = 2;
-
- UserNameLen = strlen (Z_STRVAL_PP(user_name));
-
- curAction = 0;
- ActionCount = 1;
-
- ActionTable[curAction].AddFlag = TRUE;
-
- ActionTable[curAction].NoteID =
- strtoul (Z_STRVAL_PP(note_id), &pEnd, 16);
-
- if (error = NSFDbOpen (Z_STRVAL_PP(db), &db_handle)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- error = UpdateUnread (db_handle, Z_STRVAL_PP(user_name), UserNameLen,
- ActionTable, ActionCount, &UndoID);
-
- if ( (error == NOERROR) && UndoID ){
-
- error = UndoUnreadStatus (db_handle, Z_STRVAL_PP(user_name), UserNameLen, ActionTable,
- ActionCount, UndoID);
- }
-
- /* Close the database */
- error = NSFDbClose (db_handle);
-
- if (NOERROR == error){
-
- RETURN_TRUE;
- }
- else{
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to close the database: %s", error_string);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/*
- * UpdateUnread - Update the Unread Note list
- */
-
-STATUS UpdateUnread (
- DBHANDLE db_handle,
- char *pName,
- WORD nameLen,
- ACTION_ENTRY *pActions,
- int actionCount,
- NOTEID *pUndoID)
-{
- STATUS error;
- HANDLE table_handle;
- HANDLE hOriginalTable;
- NOTEHANDLE note_handle;
- BOOL gotUndoID = FALSE;
-
- /* Get the unread list */
- error = NSFDbGetUnreadNoteTable (
- db_handle,
- pName,
- nameLen,
- TRUE, /* Create the list if it's not already there */
- &table_handle);
-
- if (NOERROR != error){
-
- return (error);
- }
-
- /* Notes requires the original unread table to merge changes */
- error = IDTableCopy (table_handle, &hOriginalTable);
-
- if (NOERROR != error){
-
- IDDestroyTable (table_handle);
- return (error);
- }
-
- /* Bring table up to date */
- error = NSFDbUpdateUnread (db_handle, table_handle);
- if (NOERROR == error){
-
- if (pActions[0].AddFlag){
-
- /* Adding a Note ID */
- /* (Marks note as Unread) */
- if (IDIsPresent (table_handle, pActions[0].NoteID)){
-
- php_error(E_WARNING,"Note %lX is already marked unread", pActions[0].NoteID);
- }
- else{
- /* make sure we check to see if this note really exists
- at all */
- error = NSFNoteOpen(db_handle, pActions[0].NoteID, OPEN_SUMMARY, &note_handle);
-
- /* if it does we'll add it to the unread list */
- if (error == NOERROR){
-
- NSFNoteClose(note_handle);
- error = IDInsert (table_handle, pActions[0].NoteID,
- (NOTESBOOL NOTESPTR) NULL);
-
- }
- }
- }
- else{
-
- /* Removing a Note ID */
- /* (Marks note as Read) */
-
- if (IDIsPresent (table_handle, pActions[0].NoteID)){
-
- error = IDDelete (table_handle, pActions[0].NoteID,
- (NOTESBOOL NOTESPTR) NULL);
-
- if (NOERROR == error){
-
- if (!gotUndoID){
- *pUndoID = pActions[0].NoteID;
- gotUndoID = TRUE;
- }
- }
- }
- else{
-
- php_error(E_WARNING,"Note %lX is already marked read", pActions[0].NoteID);
- }
- }
-
- if (NOERROR == error){
-
- error = NSFDbSetUnreadNoteTable (db_handle, pName, nameLen,
- FALSE, /* Don't force the
- write to disk */
- hOriginalTable,
- table_handle);
- }
- }
-
- error = IDDestroyTable (hOriginalTable);
- if (NOERROR == error){
-
- error = error;
- }
-
- error = IDDestroyTable (table_handle);
-
- if (NOERROR == error){
-
- error = error;
- }
-
- return (error);
-}
-
-
-/*
- * UndoUnreadStatus - Update a note in the database without
- changing its read/unread mark
- */
-
-STATUS UndoUnreadStatus (
- DBHANDLE db_handle,
- char *pName,
- WORD nameLen,
- ACTION_ENTRY *pActions,
- int actionCount,
- NOTEID UndoID)
-{
- STATUS error;
- HANDLE table_handle;
- HANDLE hOriginalTable;
- DWORD noteID = 0L;
- NOTEHANDLE note_handle;
- BOOL bWasRead = TRUE;
-
-
- /* Get the unread list */
- error = NSFDbGetUnreadNoteTable (db_handle, pName, nameLen,
- TRUE, /* Create the list if it's
- not already there */
- &table_handle);
- if (NOERROR != error){
-
- return (error);
- }
-
- /* Notes requires the original unread table to merge changes */
-
- error = IDTableCopy (table_handle, &hOriginalTable);
-
- if (NOERROR != error){
-
- IDDestroyTable (table_handle);
- return (error);
- }
-
- /* See if note to be modified is marked as read */
- bWasRead = !(IDIsPresent (table_handle, UndoID));
-
- /* Make a change to this note and update it. */
- error = NSFNoteOpen (db_handle, UndoID, 0, &note_handle);
-
- if (error){
-
- IDDestroyTable (table_handle);
- IDDestroyTable (hOriginalTable);
- return (error);
- }
-
- error = NSFItemSetText (note_handle, "plain_text", "Unread undone",
- (WORD) strlen("Unread undone"));
- if (error){
-
- NSFNoteClose (note_handle);
- IDDestroyTable (table_handle);
- IDDestroyTable (hOriginalTable);
- return (error);
- }
-
- error = NSFNoteUpdate (note_handle, 0L);
-
- if (error){
-
- NSFNoteClose (note_handle);
- IDDestroyTable (table_handle);
- IDDestroyTable (hOriginalTable);
- return (error);
- }
-
- error = NSFNoteClose (note_handle);
-
- if (error){
-
- IDDestroyTable (table_handle);
- IDDestroyTable (hOriginalTable);
- return (error);
- }
-
- /* The note just modified is now marked as unread.
- Bring table up to date */
-
- error = NSFDbUpdateUnread (db_handle, table_handle);
-
- if ( (NOERROR == error) && bWasRead ){
-
- /* Remove the Note ID that we just modified to mark it as read*/
-
- error = IDDelete (table_handle, UndoID,
- (NOTESBOOL NOTESPTR) NULL);
-
- if( error != NOERROR ){
-
- php_error(E_NOTICE,"Note %lX is already marked read.", UndoID);
- }
- }
-
- /* Save unread table to disk */
- if (NOERROR == error){
-
- error = NSFDbSetUnreadNoteTable (db_handle, pName, nameLen,
- FALSE, /* Don't force the write
- to disk */
- hOriginalTable, table_handle);
- }
-
- /* Clean up */
- IDDestroyTable (hOriginalTable);
- IDDestroyTable (table_handle);
-
- return (error);
-}
-
-/* {{{ proto string notes_unread(string database_name, string user_name)
- Returns the unread note id's for the current User user_name. Note: user_name must be fully distinguished user name */
-PHP_FUNCTION(notes_unread)
-{
-
- int argc;
- pval *argv[2];
-
- STATUS error;
- DBHANDLE db_handle;
- WORD UserNameLen;
- HANDLE table_handle;
- DWORD noteID;
- BOOL FirstNote;
- char error_string[200];
-
- pval **db;
- pval **user_name;
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(2, &db, &user_name)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
- convert_to_string_ex(user_name);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen (Z_STRVAL_PP(db), &db_handle)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- UserNameLen = strlen(Z_STRVAL_PP(user_name));
-
- /* Get the unread list */
- if( error = NSFDbGetUnreadNoteTable (
- db_handle,
- Z_STRVAL_PP(user_name),
- UserNameLen,
- TRUE, /* Create the list if it's not already there */
- &table_handle) ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to get unread list: %s", error_string );
- NotesTerm();
- RETURN_FALSE;
- }
-
-
- error = NSFDbUpdateUnread (db_handle, table_handle);
- if (NOERROR != error)
- {
- IDDestroyTable (table_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to get unread list: %s", error_string );
- NotesTerm();
- RETURN_FALSE;
- }
-
-
- FirstNote = TRUE;
-
- array_init(return_value);
-
- /* Print the entries in the unread list */
- while (IDScan (table_handle, FirstNote, &noteID)){
-
- FirstNote = FALSE;
-
- add_next_index_long(return_value, (long) noteID );
- }
-
- error = IDDestroyTable (table_handle);
-
- /* Close the database */
- error = NSFDbClose (db_handle);
-
- if( error != NOERROR ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to close database: %s", error_string);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-#define ERR_READMAIL_NOUNIQUE (PKG_ADDIN + 0)
-#define READMAIL_BODY_LINELEN 40
-
-STATUS near pascal GetUniqueFileName(char *Drive, char *Ext, char *FileName);
-
-/* {{{ proto object notes_header_info(string server, string mailbox, int msg_number)
- Opens the message msg_number in the specified mailbox on the specified server (leave server blank for local) */
-/*
- Elements:
-
- originator (Contains orignal message sender. Relevant only when forwarded messages)
- to
- cc
- bcc
- from
- date
- status (blank if delivered, otherwise contains failure reason)
- priority H: High N: Normal L: Low
- receipt 1: Yes 0: No
- subject
-*/
-PHP_FUNCTION(notes_header_info)
-{
-
- int argc;
- pval *argv[3];
-
- pval **server;
- pval **mail_box;
- pval **msg_number;
-
- STATUS error = NOERROR;
- char szMailFilePath[MAXPATH+1];
- HANDLE hMessageFile;
- HANDLE hMessageList = NULLHANDLE, hMessage;
- DARRAY *MessageList;
- WORD MessageCount;
- char Originator[MAXRECIPIENTNAME+1];
- WORD OriginatorLength;
- char String[MAXSPRINTF+1];
- WORD StringLength;
- TIMEDATE Time;
- BOOL NonDeliveryReport;
- char error_string[200];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(3, &server, &mail_box, &msg_number)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(server);
- convert_to_string_ex(mail_box);
- convert_to_long_ex(msg_number);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- OSPathNetConstruct( NULL, /* port name */
- Z_STRVAL_PP(server),
- Z_STRVAL_PP(mail_box),
- szMailFilePath);
-
- /* Open the message file. */
-
- if (error = MailOpenMessageFile(szMailFilePath, &hMessageFile)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error: unable to open '%s': %s", szMailFilePath, error_string);
- RETURN_FALSE;
- }
-
- /* Create message list of messages in the file - just 64K */
-
- if (error = MailCreateMessageList(hMessageFile,
- &hMessageList, &MessageList, &MessageCount)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to create message list: %s", error_string);
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- RETURN_FALSE;
- }
-
-
- /* Print out each of the outbound messages. */
-
- object_init(return_value);
-
- if (error = MailOpenMessage (MessageList, (WORD)Z_LVAL_PP(msg_number), &hMessage)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open message number %d: %s", (WORD)Z_LVAL_PP(msg_number), error_string);
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- RETURN_FALSE;
- }
-
- /* Get the originator's name/address. */
-
- if (error = MailGetMessageOriginator(MessageList, (WORD)Z_LVAL_PP(msg_number),
- Originator, sizeof(Originator), &OriginatorLength)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to get message originator: %s", error_string);
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- RETURN_FALSE;
- }
-
- add_property_string(return_value,"originator",Originator, 1);
-
- /* SendTo */
- MailGetMessageItem (hMessage, MAIL_SENDTO_ITEM_NUM, String,
- MAXSPRINTF, &StringLength);
-
- add_property_string(return_value,"to",String, 1);
-
- /* PostedDate */
- MailGetMessageItemTimeDate(hMessage, MAIL_POSTEDDATE_ITEM_NUM, &Time);
- ConvertTIMEDATEToText(NULL, NULL, &Time, String,
- sizeof(String), &StringLength);
-
- add_property_string(return_value,"date",String, 1);
-
- /* BCC */
- MailGetMessageItem (hMessage, MAIL_BLINDCOPYTO_ITEM_NUM, String,
- MAXSPRINTF, &StringLength);
-
- add_property_string(return_value,"bcc", String, 1);
-
- /* CopyTo */
- MailGetMessageItem (hMessage, MAIL_COPYTO_ITEM_NUM, String,
- MAXSPRINTF, &StringLength);
-
- add_property_string(return_value,"cc", String, 1);
-
- /* From */
- MailGetMessageItem (hMessage, MAIL_FROM_ITEM_NUM, String,
- MAXSPRINTF, &StringLength);
-
- add_property_string(return_value,"from",String, 1);
-
- /* Subject */
-
- MailGetMessageItem (hMessage, MAIL_SUBJECT_ITEM_NUM, String,
- MAXSPRINTF, &StringLength);
-
- add_property_string(return_value,"subject",String, 1);
-
- /* Priority H: High N: Normal L: Low*/
-
- MailGetMessageItem (hMessage, MAIL_DELIVERYPRIORITY_ITEM_NUM, String,
- MAXSPRINTF, &StringLength);
-
- add_property_string(return_value,"priority",String, 1);
-
- /* Return Receipt 1: Yes 0: No*/
-
- MailGetMessageItem (hMessage, MAIL_RETURNRECEIPT_ITEM_NUM, String,
- MAXSPRINTF, &StringLength);
-
- add_property_string(return_value,"receipt",String, 1);
-
- NonDeliveryReport = MailIsNonDeliveryReport(hMessage);
-
- if (NonDeliveryReport)
- {
- MailGetMessageItem(hMessage, MAIL_FAILUREREASON_ITEM_NUM,
- String, sizeof(String), &StringLength);
-
- add_property_string(return_value,"status",String, 1);
- }
- else{
-
- add_property_string(return_value,"status","", 1);
- }
-
- MailCloseMessage (hMessage);
-
- /* Free the message list and close the message file */
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
-}
-/* }}} */
-
-STATUS near pascal GetUniqueFileName(char *Drive, char *Ext,
- char *FileName)
-
-{
- int file;
- WORD Num;
- char Name[17];
- char cwd[MAXPATH];
- char *Dir;
-
- /* Increment through numbered file names until a non-existent one found. */
- getcwd(cwd, MAXPATH);
- Dir = (char *)&cwd;
-
- for (Num = 0; Num <= 32767; Num++)
- {
- _itoa(Num, Name, 10);
- _makepath(FileName, Drive, Dir, Name, Ext);
- if ((file = open(FileName, O_BINARY | O_RDONLY)) == -1)
- return(NOERROR);
- close(file);
- }
- FileName[0] = '\0';
- return(ERR_READMAIL_NOUNIQUE);
-}
-
-/* {{{ proto array notes_body(string server, string mailbox, int msg_number)
- Opens the message msg_number in the specified mailbox on the specified server (leave server blank for local) and returns an array of body text lines */
-PHP_FUNCTION(notes_body)
-{
-
- int argc;
- pval *argv[3];
-
- pval **server;
- pval **mail_box;
- pval **msg_number;
-
- STATUS error = NOERROR;
- char szMailFilePath[MAXPATH+1];
- HANDLE hMessageFile;
- HANDLE hMessageList = NULLHANDLE, hMessage;
- DARRAY *MessageList;
- WORD MessageCount;
- char String[MAXSPRINTF+1];
- DWORD BodyFileSize;
- char BodyFileName[MAXPATH_OLE];
- FILE *BodyFile;
- char error_string[200];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(3, &server, &mail_box, &msg_number)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(server);
- convert_to_string_ex(mail_box);
- convert_to_long_ex(msg_number);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- OSPathNetConstruct( NULL, /* port name */
- Z_STRVAL_PP(server),
- Z_STRVAL_PP(mail_box),
- szMailFilePath);
-
- /* Open the message file. */
-
- if (error = MailOpenMessageFile(szMailFilePath, &hMessageFile)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error: unable to open '%s': %s.", szMailFilePath, error_string);
- RETURN_FALSE;
- }
-
- /* Create message list of messages in the file - just 64K */
-
- if (error = MailCreateMessageList(hMessageFile,
- &hMessageList, &MessageList, &MessageCount)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to create message list: %s", error_string);
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- RETURN_FALSE;
- }
-
- if (error = MailOpenMessage (MessageList, (WORD)Z_LVAL_PP(msg_number), &hMessage)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open message number %d: %s", (WORD)Z_LVAL_PP(msg_number), error_string);
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- RETURN_FALSE;
- }
-
- /* Body */
- if (error = GetUniqueFileName("", "TMP", BodyFileName)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Enable to create temporary file name: %s", error_string);
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- MailCloseMessage (hMessage);
- RETURN_FALSE;
-
- }
-
- /* Using MailGetBodyComposite instead of MailGetBody because it's not limited to 64k */
-
- if (error = MailGetMessageBodyText(hMessage,
- NULL, /* Use standard Body item */
- "\r\n", /* Newline-terminate */
- 80, /* 80 chars per line */
- TRUE, /* Convert TABs */
- BodyFileName,
- &BodyFileSize)){
-
- unlink(BodyFileName);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to get Message body into temporary file: %s", error_string);
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- MailCloseMessage (hMessage);
- RETURN_FALSE;
- }
-
- /* Print each line of body text to the screen. */
-
- if (!(BodyFile = fopen(BodyFileName, "r"))){
-
- unlink(BodyFileName);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open temporary file: %s", error_string);
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- MailCloseMessage (hMessage);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- /* this should probably return the body in one string, but I don't know how */
-
- while (fgets(String, READMAIL_BODY_LINELEN, BodyFile)){
-
- add_next_index_string( return_value, String, 1);
- }
- fclose(BodyFile);
- unlink(BodyFileName);
-
- MailCloseMessage (hMessage);
-
- /* Free the message list and close the message file */
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
-}
-/* }}} */
-
-/* {{{ proto bool notes_find_note(string database_name, string name [, string type])
- Returns a note id found in database_name */
-/*
-Specify the name of the note. Leaving type blank
-will default to all, otherwise specify:
-
- FORM
- VIEW
- FILTER
- FIELD
-*/
-PHP_FUNCTION(notes_find_note)
-{
-
- int argc;
- pval *argv[3];
-
- pval **db;
- pval **name;
- pval **type;
-
- STATUS error = NOERROR;
- DBHANDLE db_handle;
- NOTEID note_id;
-
- char error_string[200];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(3, &db, &name, &type)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
- convert_to_string_ex(name);
- convert_to_string_ex(type);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen (Z_STRVAL_PP(db), &db_handle)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if( strcmp( Z_STRVAL_PP(type), "FORM" ) == 0 ){
-
- if ((error = NIFFindDesignNote(db_handle, Z_STRVAL_PP(name), NOTE_CLASS_FORM, &note_id)) != ERR_NOT_FOUND) {
-
- RETVAL_LONG( (long) note_id );
- }
- } else if( strcmp( Z_STRVAL_PP(type), "VIEW" ) == 0 ){
-
- if ((error = NIFFindDesignNote(db_handle, Z_STRVAL_PP(name), NOTE_CLASS_VIEW, &note_id)) != ERR_NOT_FOUND) {
-
- RETVAL_LONG( (long) note_id );
- }
- } else if( strcmp( Z_STRVAL_PP(type), "FILTER" ) == 0 ){
-
- if ((error = NIFFindDesignNote(db_handle, Z_STRVAL_PP(name), NOTE_CLASS_FILTER, &note_id)) != ERR_NOT_FOUND) {
-
- RETVAL_LONG( (long) note_id );
- }
-
- } else if( strcmp( Z_STRVAL_PP(type), "FIELD" ) == 0 ){
-
- if ((error = NIFFindDesignNote(db_handle, Z_STRVAL_PP(name), NOTE_CLASS_FIELD, &note_id)) != ERR_NOT_FOUND) {
-
- RETVAL_LONG( (long) note_id );
- }
- }
- else{
-
- if ((error = NIFFindDesignNote(db_handle, Z_STRVAL_PP(name), NOTE_CLASS_ALL, &note_id)) != ERR_NOT_FOUND) {
-
- RETVAL_LONG( (long) note_id );
- }
- }
-
- NSFDbClose(db_handle);
- NotesTerm();
-}
-/* }}} */
-
-/* {{{ proto bool notes_nav_create(string database_name, string name)
- Creates a navigator name, in database_name */
-PHP_FUNCTION(notes_nav_create)
-{
-
- int argc;
- pval *argv[2];
-
- pval **db;
- pval **name;
- char error_string[200];
-
- STATUS error = NOERROR;
- DBHANDLE db_handle;
-
- WORD ClassView = NOTE_CLASS_VIEW;
-
- NOTEHANDLE view_handle; /* sample navigator view handle */
-
- char szMainView[] = "MainView"; /* title of view to be used */
-
- VIEWMAP_HEADER_RECORD NavHeader;
-
- WORD wLayoutCount;
- WORD wNavLayoutBufLen;
- HANDLE hNavLayoutBuffer;
- char *pNavLayoutBuffer;
- char *pNLBuf;
-
- char szDFlags[3];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(2, &db, &name)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
- convert_to_string_ex(name);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen (Z_STRVAL_PP(db), &db_handle)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- error = NSFNoteCreate( db_handle, &view_handle );
- if ( error ) {
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to create note in database: %s", error_string);
- NSFDbClose( db_handle );
- NotesTerm();
- RETURN_FALSE;
- }
-
-
- NSFNoteSetInfo( view_handle, _NOTE_CLASS, &ClassView );
-
-/*
- * Set the view name.
- */
- error = NSFItemSetText( view_handle, VIEW_TITLE_ITEM,
- Z_STRVAL_PP(name), MAXWORD );
- if ( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to set text item '%s' in view note: %s", VIEW_TITLE_ITEM, error_string);
- NSFNoteClose( view_handle );
- NSFDbClose( db_handle );
- NotesTerm();
- RETURN_FALSE;
- }
-
-/*
- * Append Design flags for the Navigator view.
- */
- szDFlags[0] = DESIGN_FLAG_VIEWMAP;
- szDFlags[1] = DESIGN_FLAG_HIDE_FROM_V3;
- szDFlags[2] = '\0';
- error = NSFItemAppend( view_handle,
- ITEM_SUMMARY,
- DESIGN_FLAGS,
- (WORD)strlen(DESIGN_FLAGS),
- TYPE_TEXT,
- szDFlags,
- (DWORD)strlen(szDFlags ));
- if ( error ) {
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to append item '%s' to view note: %s", DESIGN_FLAGS, error_string);
-
- NSFNoteClose( view_handle );
- NSFDbClose( db_handle );
- NotesTerm();
- RETURN_FALSE;
- }
-
- wLayoutCount = 0;
- wNavLayoutBufLen = ODSLength( _VIEWMAP_HEADER_RECORD );
-
-/*
- * Allocate and initialize the CD buffer for the entire $ViewMapLayout item.
- */
- if ( error = OSMemAlloc( 0, wNavLayoutBufLen, &hNavLayoutBuffer )){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to allocate %d bytes memory: %s", wNavLayoutBufLen, error_string);
-
- NSFNoteClose( view_handle );
- NSFDbClose( db_handle );
- NotesTerm();
- RETURN_FALSE;
- }
-
- pNavLayoutBuffer = (char*) OSLockObject( hNavLayoutBuffer );
- memset( pNavLayoutBuffer, 0, (size_t) wNavLayoutBufLen );
-
- /*
- * Initialize pNLBuf. pNavLayoutBuffer will remain pointing to the top
- * of the buffer. pNLBuf will move to point to the next available byte.
- */
- pNLBuf = pNavLayoutBuffer;
-
-
- NavHeader.Header.Signature = SIG_CD_VMHEADER;
- NavHeader.Header.Length = (BYTE) ODSLength(_VIEWMAP_HEADER_RECORD );
- NavHeader.Version = VIEWMAP_VERSION;
- NavHeader.NameLen = 0;
-
- ODSWriteMemory( &pNLBuf, _VIEWMAP_HEADER_RECORD, &NavHeader, 1 );
-
- error = NSFItemAppend( view_handle,
- ITEM_SUMMARY,
- VIEWMAP_LAYOUT_ITEM,
- (WORD)strlen(VIEWMAP_LAYOUT_ITEM),
- TYPE_VIEWMAP_LAYOUT,
- pNavLayoutBuffer,
- (DWORD)wNavLayoutBufLen );
-
- OSUnlockObject( hNavLayoutBuffer );
- OSMemFree( hNavLayoutBuffer );
-
- if ( error ) {
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to append item '%s' to view note: %s", VIEWMAP_LAYOUT_ITEM, error_string);
-
- NSFNoteClose( view_handle );
- NSFDbClose( db_handle );
- NotesTerm();
- RETURN_FALSE;
- }
-
-/*
- * Done constructing the view note. Now store the view note
- * in the database.
- */
- error = NSFNoteUpdate( view_handle, 0 );
-
- if ( error) {
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to update note: %s", error_string);
-
- NSFNoteClose( view_handle );
- NSFDbClose( db_handle );
- NotesTerm();
- RETURN_FALSE;
- }
-
- NSFNoteClose( view_handle );
- NSFDbClose( db_handle );
- NotesTerm();
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string notes_search(string database_name, string keywords)
- Finds notes that match keywords in database_name. The note(s) that are returned must be converted to base 16. Example base_convert($note_id, "10", "16") */
-
-STATUS LNPUBLIC file_action (void *, SEARCH_MATCH *, ITEM_TABLE *);
-STATUS LNPUBLIC print_file_summary (ITEM_TABLE *);
-
-
-PHP_FUNCTION(notes_search)
-{
-
- int argc;
- pval *argv[2];
- STATUS error;
- DBHANDLE db_handle;
- HANDLE search_handle; /* handle to a search */
- pval **db;
- pval **keywords;
- char error_string[200];
- FT_INDEX_STATS Stats; /* statistics from FTIndex */
- DWORD RetDocs; /* number of documents returned by the search */
- HANDLE SearchResults_handle; /* handle to the results of the search */
- FT_SEARCH_RESULTS *pSearchResults; /* pointer to the results of the search */
- HANDLE IDTable_handle; /* handle to id table built with found NOTEIDs */
- NOTEID *pNoteID; /* pointer to the NOTEIDs found */
- BYTE *pScores; /* pointer to the scores */
- DWORD i;
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(2, &db, &keywords)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
- convert_to_string_ex(keywords);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen (Z_STRVAL_PP(db), &db_handle)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- error = FTIndex(db_handle, FT_INDEX_AUTOOPTIONS, NULL, &Stats);
- if (error){
-
- NSFDbClose (db_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to search database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if (error = FTOpenSearch(&search_handle)){
-
- NSFDbClose (db_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open search: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- /* do the search on the query */
- error = FTSearch (db_handle, /* database handle */
- &search_handle, /* pointer to previously
- allocated search handle */
- (HCOLLECTION) NULLHANDLE, /* no collection specified -
- query all docs */
- Z_STRVAL_PP(keywords), /* query string */
- FT_SEARCH_SCORES | /* find relevancy scores */
- FT_SEARCH_STEM_WORDS, /* find word variants */
- 0, /* maximum number of docs to
- return; 0 = unlimited */
- NULLHANDLE, /* no refining IDTABLE */
- &RetDocs, /* returned number of docs */
- NULL, /* reserved */
- &SearchResults_handle); /* returned info */
- if (error){
-
- FTCloseSearch (search_handle);
- NSFDbClose (db_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error during searchkkk: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- /* return if no document in the result */
- if (RetDocs == 0 )
- {
- php_printf("\n0 documents returned \n");
- FTCloseSearch (search_handle);
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- pSearchResults = OSLock (FT_SEARCH_RESULTS, SearchResults_handle);
-
- /* Create an IDTABLE to further refine our search */
-
- if (error = IDCreateTable(sizeof(NOTEID), &IDTable_handle))
- {
- FTCloseSearch (search_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error creating ID table: %s", error_string);
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- /* set up a pointer to the array of note id's that occur after
- the FT_SEARCH_RESULTS structure */
-
- pNoteID = (NOTEID *) (((char *) pSearchResults)
- + sizeof(FT_SEARCH_RESULTS));
-
- pScores = (BYTE *) (pNoteID + pSearchResults->NumHits);
- for (i = 0; i < pSearchResults->NumHits; i++, pNoteID++, pScores++)
- {
- /* save the note ids in the IDTABLE */
-
- if (error = IDInsert (IDTable_handle, *pNoteID, NULL))
- {
-
- OSUnlockObject(SearchResults_handle);
- OSMemFree (SearchResults_handle);
- FTCloseSearch (search_handle);
- IDDestroyTable (IDTable_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error saving note to ID table: %s", error_string);
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
- }
-
- OSUnlockObject(SearchResults_handle);
- OSMemFree (SearchResults_handle);
-
- if (error = FTCloseSearch(search_handle))
- {
- IDDestroyTable (IDTable_handle);
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if (error = FTOpenSearch(&search_handle))
- {
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- /* do the refined search on the query with no word variants */
-
- error = FTSearch (db_handle, /* database handle */
- &search_handle, /* pointer to previously
- allocated search handle */
- (HCOLLECTION) NULLHANDLE, /* no collection specified -
- query all docs */
- Z_STRVAL_PP(keywords), /* query string */
- FT_SEARCH_SCORES | /* find relevancy scores */
- FT_SEARCH_REFINE, /* refine the search - use the
- * given id table */
- 0, /* maximum number of docs to
- return; 0 = unlimited */
- IDTable_handle, /* refining IDTABLE */
- &RetDocs, /* returned number of docs */
- NULL, /* reserved */
- &SearchResults_handle); /* returned info */
- if (error)
- {
- FTCloseSearch (search_handle);
- IDDestroyTable (IDTable_handle);
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- /* return if no document in the result */
- if (RetDocs == 0 )
- {
- php_printf("\n0 documents returned \n");
- FTCloseSearch (search_handle);
- IDDestroyTable (IDTable_handle);
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- /* obtain a pointer to the search results */
- pSearchResults = OSLock (FT_SEARCH_RESULTS, SearchResults_handle);
-
- /* set up a pointer to the array of note id's that occur after
- the FT_SEARCH_RESULTS structure */
-
- pNoteID = (NOTEID *) (((char *) pSearchResults)
- + sizeof(FT_SEARCH_RESULTS));
-
- //pSearchResults->NumHits
- array_init(return_value);
-
- pScores = (BYTE *) (pNoteID + pSearchResults->NumHits);
- for (i = 0; i < pSearchResults->NumHits; i++, pNoteID++, pScores++){
-
- add_next_index_long(return_value, (long) *pNoteID );
- //RETVAL_LONG( (long) *pNoteID );
- }
-
- OSUnlockObject (SearchResults_handle);
- OSMemFree (SearchResults_handle);
- IDDestroyTable (IDTable_handle);
-
- if (error = FTCloseSearch(search_handle))
- {
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- NSFDbClose (db_handle);
- NotesTerm();
-}
-/* }}} */
-
-/* {{{ proto string notes_copy_db(string from_database_name, string to_database_name [, string title])
- Creates a note using form form_name */
-PHP_FUNCTION(notes_copy_db)
-{
-
- int argc;
- pval *argv[3];
- STATUS error;
- DBHANDLE input_handle;
- DBHANDLE output_handle;
- char error_string[200];
- pval **db_input;
- pval **db_output;
- pval **title;
- DBREPLICAINFO replica_info; /* replication info for the databases */
- char output_db_info[NSF_INFO_SIZE]; /* database info buffer */
- TIMEDATE start_time; /* time and date used to control what
- notes we copy */
- TIMEDATE last_time; /* returned from
- NSFDbGetModifiedNoteTable */
- DBID input_dbid; /* dbid of input database */
- DBID output_dbid; /* dbid of output database */
- HANDLE idtable_p; /* handle to id table */
- DWORD num_scanned, num_entries;
- NOTEID note_id;
- NOTEHANDLE hIconNote; /* handle to the icon note */
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(3, &db_input, &db_output, &title)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db_input);
- convert_to_string_ex(db_output);
- convert_to_string_ex(title);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
-/* Open the input database. */
-
- if (error = NSFDbOpen (Z_STRVAL_PP(db_input), &input_handle)){
-
- NSFDbClose (input_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open input database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-/* Create and open the output database. */
-
- if (error = NSFDbCreate (Z_STRVAL_PP(db_output), DBCLASS_NOTEFILE, FALSE))
- {
- NSFDbClose (input_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to create database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen (Z_STRVAL_PP(db_output), &output_handle))
- {
- NSFDbClose (input_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error opening output database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-
-/* Copy the replication settings (not the replication history) from
-the input database to the output database. The replication settings
-include the database replica ID. This makes the destination database
-a replica copy of the source database. */
-
- if (error = NSFDbReplicaInfoGet (input_handle, &replica_info))
- {
- NSFDbClose (input_handle);
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error copying replication information: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-/* Copy the ACL from the input database to the output database. */
-
- if (error = NSFDbCopyACL (input_handle, output_handle))
- {
- NSFDbClose (input_handle);
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error copying ACL: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-/* Set a time/date structure that will determine the date of the earliest
-note copied in the next call. Use TimeConstant with TIMEDATE_WILDCARD
-specified to indicate that we do not want any cutoff date. */
-
- TimeConstant (TIMEDATE_WILDCARD, &start_time);
-
-/* Do not use NSFDbCopy to copy all notes in the input database to the
- output database. Such copies are not guaranteed to be replicas of
- the original notes. Instead get an IDTABLE of all notes in the
- database, use IDScan to obtain each NOTEID, and then call
- NSFDbCopyNote to copy each note from one database to the other.
-*/
-
- NSFDbIDGet (input_handle, &input_dbid);
- NSFDbIDGet (output_handle, &output_dbid);
-
-
-/* Get the NoteID table for all notes in the input database */
- if (error = NSFDbGetModifiedNoteTable (input_handle,
- NOTE_CLASS_ALL,
- start_time, &last_time,
- &idtable_p) )
- if (error == ERR_NO_MODIFIED_NOTES){
- NSFDbClose (input_handle);
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_NOTICE,"There are no documents in the Database: %s", error_string);
- NotesTerm();
- RETURN_TRUE;
- }
- else
- {
- NSFDbClose (input_handle);
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error copying replication information: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
- num_scanned = 0L;
- num_entries = IDEntries (idtable_p);
- if (num_entries)
- while (IDScan (idtable_p, (FLAG)(num_scanned++ == 0), &note_id) )
- if (error = NSFDbCopyNote (input_handle, &input_dbid,
- &replica_info.ID, note_id,
- output_handle, &output_dbid,
- &replica_info.ID, NULL,
- NULL) )
- {
- IDDestroyTable (idtable_p);
- NSFDbClose (input_handle);
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error copying notes: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
- IDDestroyTable (idtable_p);
-
-/* Now we can change the title of the output database
- by following these steps:
-
- - Get the info buffer of the database (NSFDbInfoGet);
- - Modify the title information in the buffer (NSFDbInfoModify);
- - Write the modified info buffer into the database (NSFDbInfoSet);
- - If necessary, update the ICON note with the updated database
- information buffer. This is required for databases created from
- a template.
-*/
-
-/* Clear out the database information buffer */
- output_db_info[0] = '\0';
-
-/* Get the output database information buffer. */
-
- if (error = NSFDbInfoGet (output_handle, output_db_info))
- {
- NSFDbClose (input_handle);
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error getting output database information buffer: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-/* Add the database title to the database information buffer */
-
- NSFDbInfoModify (output_db_info, INFOPARSE_TITLE, Z_STRVAL_PP(title));
- if (error = NSFDbInfoSet (output_handle, output_db_info))
- {
- NSFDbClose (input_handle);
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error adding the database title to the buffer: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-/* If creating a new database from a template, in order to change
- the database title or any other component of the database information
- buffer, you also need to update this information in the ICON
- note after updating it in the database information buffer. */
-
- if (!NSFNoteOpen(output_handle, NOTE_ID_SPECIAL+NOTE_CLASS_ICON,
- 0, &hIconNote))
- {
-
- /* Update the FIELD_TITLE ("$TITLE") field if present */
- if (NSFItemIsPresent (hIconNote, FIELD_TITLE, (WORD) strlen (FIELD_TITLE)) )
- {
- NSFItemSetText(hIconNote, FIELD_TITLE, output_db_info, MAXWORD);
- NSFNoteUpdate(hIconNote, 0);
- }
- NSFNoteClose(hIconNote);
- }
-
-
-/* Close the databases. */
-
- if (error = NSFDbClose (input_handle))
- {
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error closing the input database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if (error = NSFDbClose (output_handle)){
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error closing the output database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- NotesTerm();
- RETURN_TRUE;
-}
-/* }}} */
-
-
-
-
-
-
-
-
-
-
-
-STATUS LNPUBLIC ReadSummaryData ( /* called for every document */
- VOID far *,
- SEARCH_MATCH far *,
- ITEM_TABLE far *);
-STATUS PrintSummary (char *);
-STATUS ExtractTextList (char *, char *);
-
-/* Constants */
-/* Notes imposes a 32K max summary buffer total size. Therefore,
- 34K will safely store the printable text rendering of any single
- item.
-*/
-#define MAX_ITEM_LEN 34816
-
-/* The maximum number of items in the summary buffer of a single note
- is limited to the number of ITEM structures that will fit in 32K.
-*/
-#define MAX_ITEMS 32768/sizeof(ITEM)
-
-#define MAX_ITEM_NAME_LEN DESIGN_NAME_MAX
-
-/* Global variables */
-ITEM Items[MAX_ITEMS]; /* Stores the array of ITEMs */
-char ItemText[MAX_ITEM_LEN]; /* Text rendering of item value */
-char ItemName[MAX_ITEM_NAME_LEN];/* Zero terminated item name */
-
-
-/* {{{ proto bool notes_list_msgs(string db)
- ??? */
-PHP_FUNCTION(notes_list_msgs)
-{
-
- int argc;
- pval *argv[1];
-
- STATUS error;
- DBHANDLE db_handle;
- char error_string[200];
-
- pval **db;
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen (Z_STRVAL_PP(db), &db_handle)){
-
- NSFDbClose (db_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- /* Call NSFSearch to find all data notes in the database.
- Specify search flag SEARCH_SUMMARY so that the action
- routine gets passed the summary buffer as input.
- */
-
- if (error = NSFSearch (
- db_handle, /* database handle */
- NULLHANDLE, /* selection formula */
- NULL, /* title of view in selection formula */
- SEARCH_SUMMARY, /* search flags: get summary data! */
- NOTE_CLASS_DATA, /* note class to find */
- NULL, /* starting date (unused) */
- ReadSummaryData, /* action routine for notes found */
- NULL, /* argument to action routine */
- NULL)) /* returned ending date (unused) */
-
- {
- NSFDbClose (db_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to search database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if (error = NSFDbClose (db_handle))
- {
- NSFDbClose (db_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to close database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- RETURN_TRUE
-}
-
-STATUS LNPUBLIC ReadSummaryData
- (VOID far *optional_param,
- SEARCH_MATCH far *search_info,
- ITEM_TABLE far *summary_info)
-{
- SEARCH_MATCH SearchMatch;
- STATUS error;
-
- memcpy ((char*)(&SearchMatch), (char *)search_info, sizeof(SEARCH_MATCH));
-
- if (!(SearchMatch.SERetFlags & SE_FMATCH))
- return (NOERROR);
-
- /* Print the note ID. */
-
- php_printf ("\nNote ID is: %lX.\n<br />", SearchMatch.ID.NoteID);
-
- /* Print the summary data. */
-
- if (error = PrintSummary( (char*)summary_info ))
- return (error);
-
- return (NOERROR);
-}
-
-
-/************************************************************************
-
- FUNCTION: PrintSummary
-
- PURPOSE: Print all the items in a summary buffer.
-
- INPUTS:
- pSummary - a pointer to the summary buffer for one note.
-
- DESCRIPTION:
- The information in a summary buffer consists of an ITEM_TABLE
- structure, followed by an array of ITEM structures, followed by
- a packed sequence of field names and item values.
-
- ITEM_TABLE
- ITEM 1
- ITEM 2
- ...
- ITEM N
- name of item 1
- value of item 1
- name of item 2
- value of item 2
- ...
- name of item N
- value if item N
-
- Item names are not zero terminated. Each item value starts with
- a data type word. The lengths of the item names and item values
- will vary. The NameLength member of the ITEM structure specifies
- the length of the corresponding name, and the ValueLength member
- of the ITEM structure specifies the length of the item value.
- The ValueLength includes the length of the data type word.
-
- Note that this summary buffer differs in format from the buffer
- parsed by sample program VIEWSUMM. VIEWSUMM calls NIFReadEntries
- specifying READ_MASK_SUMMARYVALUES, which yields a buffer with
- format specified by ITEM_VALUE_TABLE rather than ITEM_TABLE.
-
- This function can parse the summary buffer of any data note
- because it does not assume the note contains items with any
- particular names. If you know the item name in advance, use
- either NSFGetSummaryValue() or NSFLocateSummaryValue().
-
-*************************************************************************/
-
-
-STATUS PrintSummary (char *pSummary)
-{
- char *pSummaryPos; /* current position in pSummary */
- ITEM_TABLE ItemTable; /* header at start of pSummary */
- USHORT ItemCount; /* number of items in pSummary */
- USHORT NameLength; /* length of item name w/out terminator*/
- USHORT ValueLength; /* length of item value, incl. type */
- WORD DataType; /* item data type word */
- char *szDataType; /* printable data type name */
- USHORT TextLen; /* length of printable item text */
- NUMBER NumericItem; /* an item of type TYPE_NUMBER */
- NUMBER_PAIR NumberPair; /* part of item of TYPE_NUMBER_RANGE */
- RANGE Range; /* part of item of TYPE_NUMBER_RANGE */
- TIMEDATE TimeItem; /* a time/date item */
- TIMEDATE_PAIR TimePairItem; /* part of time/date list or range */
- WORD TimeStringLen; /* length of ASCII time/date */
- STATUS error; /* return code from API calls */
- USHORT i; /* counter for loop over items */
- USHORT j; /* " " " " multi-valued items */
-
- /* Initialize pSummaryPos to the position of the beginning of
- the summary buffer. Keep pSummary unmodified. Modify pSummaryPos.
- */
-
- pSummaryPos = pSummary;
-
- /* Copy the ITEM_TABLE header at the beginning of the summary buffer
- to a local variable. Advance pSummaryPos to point to the next
- byte in the summary buffer after the ITEM_TABLE.
- */
- memcpy ((char*)(&ItemTable), pSummaryPos, sizeof(ITEM_TABLE));
- pSummaryPos += sizeof(ItemTable);
-
- /* pSummaryPos now points to the first ITEM in an array of ITEM
- structures. Copy this array of ITEM structures into the global
- Items[] array.
- */
-
- ItemCount = ItemTable.Items;
-
- for (i=0; i < ItemCount; i++)
- {
- memcpy((char*)(&Items[i]), pSummaryPos, sizeof(ITEM));
- pSummaryPos += sizeof(ITEM);
- }
-
- /* pSummaryPos now points to the first item name. Loop over each
- item, copying the item name into the ItemName variable and
- converting the item value to printable text in ItemText.
- */
-
- for (i=0; i < ItemCount; i++)
- {
- /* zero out two global arrays that we re-use for each item */
- memset (ItemText, 0, MAX_ITEM_LEN);
- memset (ItemName, 0, MAX_ITEM_NAME_LEN);
-
- NameLength = Items[i].NameLength;
- memcpy (ItemName, pSummaryPos, NameLength);
- ItemName[NameLength] = '\0';
- pSummaryPos += NameLength;
-
- /* Handle the case of a zero length item */
-
- if (Items[i].ValueLength == 0)
- {
- strcpy(ItemName, " * ");
- ItemText[0] = '\0';
- goto PrintItem;
- }
-
- /* pSummaryPos now points to the item value. First get the
- data type. Then step over the data type word to the data
- value and convert the value to printable text. Store the
- text in ItemText.
- */
-
- memcpy ((char*)(&DataType), pSummaryPos, sizeof(WORD));
- pSummaryPos += sizeof(WORD);
-
- ValueLength = Items[i].ValueLength - sizeof(WORD);
-
- /* The way to extract an item depends on the data type. */
-
- switch (DataType)
- {
- case TYPE_TEXT:
- szDataType = "TYPE_TEXT";
- memcpy (ItemText, pSummaryPos, ValueLength);
- ItemText[ValueLength] = '\0';
- pSummaryPos += ValueLength;
- break;
-
- case TYPE_TEXT_LIST:
- szDataType = "TYPE_TEXT_LIST";
- if (error = ExtractTextList (pSummaryPos, ItemText))
- {
- printf ("Error: unable to extract text list.\n");
- ItemText[0] = '\0';
- }
- pSummaryPos += ValueLength;
- break;
-
- case TYPE_NUMBER:
- szDataType = "TYPE_NUMBER";
- memcpy ((char *)(&NumericItem), pSummaryPos, sizeof(NUMBER));
- sprintf (ItemText, "%f", NumericItem);
- pSummaryPos += sizeof(NUMBER);
- break;
-
- case TYPE_NUMBER_RANGE:
- szDataType = "TYPE_NUMBER_RANGE";
- TextLen = 0;
- memcpy ((char*)(&Range), pSummaryPos, sizeof(RANGE));
- pSummaryPos += sizeof(RANGE);
- for (j=0; j < Range.ListEntries; j++)
- {
- memcpy ((char*)(&NumericItem), pSummaryPos,
- sizeof(NUMBER));
- sprintf (ItemText+TextLen, "%f ", NumericItem);
- pSummaryPos += sizeof(NUMBER);
- TextLen = strlen(ItemText);
- }
- if ((Range.ListEntries != 0) && (Range.RangeEntries != 0))
- {
- memcpy (ItemText+TextLen, "; ", 2);
- TextLen += 2;
- }
- for (j=0; j < Range.RangeEntries; j++)
- {
- memcpy ((char*)(&NumberPair), pSummaryPos,
- sizeof(NUMBER_PAIR));
- sprintf (ItemText+TextLen, "%f - %f ", NumberPair.Lower,
- NumberPair.Upper);
- pSummaryPos += sizeof(NUMBER_PAIR);
- TextLen = strlen(ItemText);
- }
- break;
-
-#ifndef APITESTMODE
-
- case TYPE_TIME:
- szDataType = "TYPE_TIME";
- memcpy ((char*)(&TimeItem), pSummaryPos, sizeof(TIMEDATE));
- pSummaryPos += sizeof(TIMEDATE);
- if (error = ConvertTIMEDATEToText (
- NULL, NULL, &TimeItem,
- ItemText, MAXALPHATIMEDATE,
- &TimeStringLen))
- {
- printf ("Error: unable to convert TIMEDATE to text.\n");
- TimeStringLen = 0;
- }
- ItemText[TimeStringLen] = '\0';
- break;
-
- case TYPE_TIME_RANGE:
- szDataType = "TYPE_TIME_RANGE";
- TextLen = 0;
- memcpy ((char*)(&Range), pSummaryPos, sizeof(RANGE));
- pSummaryPos += sizeof(RANGE);
- for (j=0; j < Range.ListEntries; j++)
- {
- if (j != 0)
- {
- memcpy (ItemText+TextLen, ",", 1);
- TextLen++;
- }
- memcpy ((char*)(&TimeItem), pSummaryPos,
- sizeof(TIMEDATE));
- pSummaryPos += sizeof(TIMEDATE);
- if (error = ConvertTIMEDATEToText (
- NULL, NULL,
- &TimeItem,
- ItemText+TextLen,
- MAXALPHATIMEDATE, &TimeStringLen))
- {
- printf("Error: unable to convert TIMEDATE to text.\n");
- TimeStringLen = 0;
- }
- TextLen += TimeStringLen;
- }
-
- if (Range.RangeEntries == 0)
- {
- ItemText[TextLen] = '\0';
- break;
- }
-
- /* Append a space, semicolon, space to separate time/dates
- from time/date ranges.
- */
-
- memcpy (ItemText+TextLen, " ; ", 3);
- TextLen += 3;
-
- for (j=0; j < Range.RangeEntries; j++)
-
- {
- if (j != 0)
- {
- memcpy (ItemText+TextLen, ",", 1);
- TextLen++;
- }
- memcpy ((char*)&TimePairItem, pSummaryPos,
- sizeof(TIMEDATE_PAIR));
- pSummaryPos += sizeof(TIMEDATE_PAIR);
- if (error = ConvertTIMEDATEToText (
- NULL, NULL,
- &TimePairItem.Lower, ItemText+TextLen,
- MAXALPHATIMEDATE, &TimeStringLen))
- {
- printf("Error: unable to convert TIMEDATE to text.\n");
- TimeStringLen = 0;
- }
- TextLen += TimeStringLen;
- memcpy (ItemText+TextLen, "-", 1);
- TextLen++;
- if (error = ConvertTIMEDATEToText (
- NULL, NULL,
- &TimePairItem.Upper, ItemText+TextLen,
- MAXALPHATIMEDATE, &TimeStringLen))
- {
- printf("Error: unable to convert TIMEDATE to text.\n");
- TimeStringLen = 0;
- }
- TextLen += TimeStringLen;
- }
- ItemText[TextLen] = '\0'; /* zero terminate the text */
- break;
-
-#endif
- /* Item is not one of the data types this program handles. */
-
- default:
- szDataType = "Unrecognized";
- ItemText[0] = '\0';
- pSummaryPos += ValueLength;
- break;
- } /* end of switch on data type */
-
-PrintItem:
- /* Print the item name, data type, and value. */
- printf ("\tItem Name = %s\n", ItemName);
- printf ("\tData Type = %s\n", szDataType);
-
-#ifndef APITESTMODE
- printf ("\tItem Value = \"%s\"\n\n", ItemText);
-#else
- if (strcmp(ItemName,"$UpdatedBy")==0)
- printf ("\tItem Value =\n\n", ItemText);
- else
- printf ("\tItem Value = \"%s\"\n\n", ItemText);
-#endif
-
- }/* End of loop over items in the summary. */
-
- /* Print final line feed to end display for this note. */
-
- printf ("\n");
-
- return (NOERROR);
-}
-
-/************************************************************************
-
- FUNCTION: ExtractTextList
-
- PURPOSE: This function extracts an item of TYPE_TEXT_LIST from a
- pSummary buffer.
-
- INPUTS: char *pBuffer
-
- OUTPUTS: char *TextList
-
-*************************************************************************/
-
-STATUS ExtractTextList (char *pBuffer, char *TextList)
-{
- LIST List;
- char *ListEntry; /* pointer to list entry */
- WORD TextLen; /* total length of string output to TextList */
- WORD EntryLen; /* length of one entry */
- STATUS error; /* return code from API calls */
- USHORT i; /* a counter */
-
- /* Initialize the total length of the list. */
-
- TextLen = 0;
-
- /* Clear the string that we'll fill up. */
-
- TextList[0] = '\0';
-
- /* Get the list header structure with the number of entries. */
-
- memcpy ((char*)(&List), pBuffer, sizeof(LIST));
-
- /* Loop over each entry of the list. */
-
- for (i=0; i<List.ListEntries; i++)
- {
- /* Get one entry from the list. */
-
- if (error = ListGetText (
- pBuffer,
- FALSE, /* DataType not prepended to list */
- i,
- &ListEntry,
- &EntryLen))
- {
- return (ERR(error));
- }
-
- /* Copy this entry to the string we are building and move the
- pointer that keeps track of how much we have in the string.
- */
-
- memcpy (TextList+TextLen, ListEntry, EntryLen);
- TextLen += EntryLen;
-
- /* Put a comma after the entry and advance the text length. */
-
- memcpy (TextList+TextLen, ",", 1);
- TextLen++;
-
- } /* End of loop over list entries. */
-
- /* Put a null in place of the last comma */
-
- TextLen--;
- memcpy (TextList+TextLen, "\0", 1);
-
- return (NOERROR);
-}
-
-/* }}} */
-
-
-
-
diff --git a/ext/notes/php_notes.h b/ext/notes/php_notes.h
deleted file mode 100644
index 1595c9d62a..0000000000
--- a/ext/notes/php_notes.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_01.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Brad Atkins <brad@youreshop.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-/* $Id$ */
-
-extern zend_module_entry notes_module_entry;
-
-#define notes_module_ptr &notes_module_entry
-
-PHP_MINIT_FUNCTION(notes);
-PHP_MSHUTDOWN_FUNCTION(notes);
-PHP_RINIT_FUNCTION(notes);
-PHP_RSHUTDOWN_FUNCTION(notes);
-PHP_MINFO_FUNCTION(notes);
-
-PHP_FUNCTION(notes_create_db);
-PHP_FUNCTION(notes_drop_db);
-PHP_FUNCTION(notes_version);
-PHP_FUNCTION(notes_create_note);
-PHP_FUNCTION(notes_unread);
-PHP_FUNCTION(notes_mark_read);
-PHP_FUNCTION(notes_mark_unread);
-PHP_FUNCTION(notes_header_info);
-PHP_FUNCTION(notes_body);
-PHP_FUNCTION(notes_find_note);
-PHP_FUNCTION(notes_nav_create);
-PHP_FUNCTION(notes_search);
-PHP_FUNCTION(notes_copy_db);
-PHP_FUNCTION(notes_list_msgs);
-
-#define phpext_notes_ptr notes_module_ptr
diff --git a/ext/oci8/CREDITS b/ext/oci8/CREDITS
deleted file mode 100644
index 122ed2acdb..0000000000
--- a/ext/oci8/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-OCI8
-Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson, Maxim Maletsky
diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4
deleted file mode 100644
index d689600d52..0000000000
--- a/ext/oci8/config.m4
+++ /dev/null
@@ -1,149 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_DEFUN(PHP_OCI_IF_DEFINED,[
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS=$3
- AC_EGREP_CPP(yes,[
-#include <oci.h>
-#if defined($1)
- yes
-#endif
- ],[
- CPPFLAGS=$old_CPPFLAGS
- $2
- ],[
- CPPFLAGS=$old_CPPFLAGS
- ])
-])
-
-AC_DEFUN(AC_OCI8_VERSION,[
- AC_MSG_CHECKING([Oracle version])
- if test -s "$OCI8_DIR/orainst/unix.rgs"; then
- OCI8_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
- test -z "$OCI8_VERSION" && OCI8_VERSION=7.3
- elif test -f $OCI8_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
- OCI8_VERSION=9.0
- elif test -f $OCI8_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then
- OCI8_VERSION=8.1
- elif test -f $OCI8_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.1.0; then
- OCI8_VERSION=8.0
- elif test -f $OCI8_DIR/lib/libclntsh.a; then
- if test -f $OCI8_DIR/lib/libcore4.a; then
- OCI8_VERSION=8.0
- else
- OCI8_VERSION=8.1
- fi
- else
- AC_MSG_ERROR(Oracle-OCI8 needed libraries not found)
- fi
- AC_MSG_RESULT($OCI8_VERSION)
-])
-
-PHP_ARG_WITH(oci8, for Oracle-OCI8 support,
-[ --with-oci8[=DIR] Include Oracle-oci8 support. Default DIR is
- ORACLE_HOME.])
-
-if test "$PHP_OCI8" != "no"; then
- AC_MSG_CHECKING([Oracle Install-Dir])
- if test "$PHP_OCI8" = "yes"; then
- OCI8_DIR=$ORACLE_HOME
- else
- OCI8_DIR=$PHP_OCI8
- fi
- AC_MSG_RESULT($OCI8_DIR)
-
- if test -d "$OCI8_DIR/rdbms/public"; then
- PHP_ADD_INCLUDE($OCI8_DIR/rdbms/public)
- OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/rdbms/public"
- fi
- if test -d "$OCI8_DIR/rdbms/demo"; then
- PHP_ADD_INCLUDE($OCI8_DIR/rdbms/demo)
- OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/rdbms/demo"
- fi
- if test -d "$OCI8_DIR/network/public"; then
- PHP_ADD_INCLUDE($OCI8_DIR/network/public)
- OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/network/public"
- fi
- if test -d "$OCI8_DIR/plsql/public"; then
- PHP_ADD_INCLUDE($OCI8_DIR/plsql/public)
- OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/plsql/public"
- fi
-
- if test -f "$OCI8_DIR/lib/sysliblist"; then
- PHP_EVAL_LIBLINE(`cat $OCI8_DIR/lib/sysliblist`, OCI8_SYSLIB)
- elif test -f "$OCI8_DIR/rdbms/lib/sysliblist"; then
- PHP_EVAL_LIBLINE(`cat $OCI8_DIR/rdbms/lib/sysliblist`, OCI8_SYSLIB)
- fi
-
- AC_OCI8_VERSION($OCI8_DIR)
- case $OCI8_VERSION in
- 8.0)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, "", OCI8_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(core4, "", OCI8_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(psa, "", OCI8_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(clntsh, $OCI8_DIR/lib, OCI8_SHARED_LIBADD)
- ;;
-
- 8.1)
- PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
- PHP_ADD_LIBPATH($OCI8_DIR/lib, OCI8_SHARED_LIBADD)
-
- dnl
- dnl OCI_ATTR_STATEMENT is not available in all 8.1.x versions
- dnl
- PHP_OCI_IF_DEFINED(OCI_ATTR_STATEMENT, [AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])], $OCI8_INCLUDES)
- ;;
-
- 9.0)
- PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
- PHP_ADD_LIBPATH($OCI8_DIR/lib, OCI8_SHARED_LIBADD)
- AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])
- AC_DEFINE(HAVE_OCI8_SHARED_MODE,1,[ ])
-
- dnl These functions are only available in version >= 9.2
- PHP_CHECK_LIBRARY(clntsh, OCIEnvNlsCreate,
- [
- PHP_CHECK_LIBRARY(clntsh, OCINlsCharSetNameToId,
- [
- AC_DEFINE(HAVE_OCI_9_2,1,[ ])
- OCI8_VERSION=9.2
- ], [], [
- -L$OCI8_DIR/lib $OCI8_SHARED_LIBADD
- ])
- ], [], [
- -L$OCI8_DIR/lib $OCI8_SHARED_LIBADD
- ])
- ;;
-
- *)
- AC_MSG_ERROR(Unsupported Oracle version!)
- ;;
- esac
-
- dnl
- dnl Check if we need to add -locijdbc8
- dnl
- PHP_CHECK_LIBRARY(clntsh, OCILobIsTemporary,
- [
- AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ])
- ], [
- PHP_CHECK_LIBRARY(ocijdbc8, OCILobIsTemporary,
- [
- PHP_ADD_LIBRARY(ocijdbc8, 1, OCI8_SHARED_LIBADD)
- AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ])
- ], [], [
- -L$OCI8_DIR/lib $OCI8_SHARED_LIBADD
- ])
- ], [
- -L$OCI8_DIR/lib $OCI8_SHARED_LIBADD
- ])
-
- PHP_NEW_EXTENSION(oci8, oci8.c, $ext_shared)
- AC_DEFINE(HAVE_OCI8,1,[ ])
-
- PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
- PHP_SUBST_OLD(OCI8_DIR)
- PHP_SUBST_OLD(OCI8_VERSION)
-fi
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
deleted file mode 100644
index b4543bdeac..0000000000
--- a/ext/oci8/oci8.c
+++ /dev/null
@@ -1,5521 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@fast.no> |
- | Thies C. Arntzen <thies@thieso.net> |
- | Maxim Maletsky <maxim@maxim.cx> |
- | |
- | Collection support by Andy Sautins <asautins@veripost.net> |
- | Temporary LOB support by David Benson <dbenson@mancala.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* TODO list:
- *
- * - php.ini flags
- * especialliy important for things like oci_ping
- * - Change return-value for OCIFetch*() (1-row read, 0-Normal end, false-error)
- * - Error mode (print or shut up?)
- * - binding of arrays
- * - Character sets for NCLOBS
- * - split the module into an upper (php-callable) and lower (c-callable) layer!
- * - remove all XXXs
- * - clean up and documentation
- * - make OCIInternalDebug accept a mask of flags....
- * - add some flags to OCIFetchStatement (maxrows etc...)
- * - have one ocifree() call.
- * - make it possible to have persistent statements?
- * - implement connection pooling in ZTS mode.
- * - failover
- * - change all the lob stuff to work without classes (optional)!
- * - make sure that the callbacks terminate the strings with \0
- * - cleanup the ociexecute semantics for refcursors
- * - make $lob->savefile use O_BINARY
- * - line 2728: ub4 length = -1; needs fixing
- * - delay OCIInitialize() as far as we can.
- * - add PHP Array <-> OCICollection conversion
- * - add Collection iterator object for INDEX BY tables
- * - make auto-rollback only happen if we have an outstanding transaction
- * - implement ocidisconnect
- */
-
-/* {{{ includes & stuff */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/info.h"
-
-/* #define HAVE_OCI8_TEMP_LOB 1 */
-#define WITH_COLLECTIONS 1
-
-#if HAVE_OCI8
-
-#include "php_oci8.h"
-
-/* True globals, no need for thread safety */
-static int le_conn;
-static int le_stmt;
-static int le_desc;
-#ifdef WITH_COLLECTIONS
-static int le_coll;
-#endif
-static int le_server;
-static int le_session;
-static zend_class_entry *oci_lob_class_entry_ptr;
-#ifdef WITH_COLLECTIONS
-static zend_class_entry *oci_coll_class_entry_ptr;
-#endif
-
-#ifndef SQLT_BFILEE
-#define SQLT_BFILEE 114
-#endif
-#ifndef SQLT_CFILEE
-#define SQLT_CFILEE 115
-#endif
-
-#define SAFE_STRING(s) ((s)?(s):"")
-
-
-/* dirty marcos to make sure we _never_ call oracle-functions recursivly
- *
- * i'm well aware that we should _never_ call exit directly - this core is for
- * pure testing and commented out - as you can see;-)
- * thies@thieso.net 20010723
- */
-
-#define CALL_OCI(call) \
-{ \
- if (OCI(in_call)) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI8 Recursive call!\n"); \
- exit(-1); \
- } else { \
- OCI(in_call)=1; \
- call; \
- OCI(in_call)=0; \
- } \
-}
-
-#define CALL_OCI_RETURN(retcode,call) \
-{ \
- if (OCI(in_call)) { \
- retcode=-1; \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI8 Recursive call!\n"); \
- exit(-1); \
- } else { \
- OCI(in_call)=1; \
- retcode=call; \
- OCI(in_call)=0; \
- } \
-}
-
-#include <fcntl.h>
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-/* }}} */
-/* {{{ thread safety stuff */
-
-#ifdef ZTS
-int oci_globals_id;
-#else
-PHP_OCI_API php_oci_globals oci_globals;
-#endif
-
-/* }}} */
-/* {{{ dynamically loadable module stuff */
-
-#ifdef COMPILE_DL_OCI8
-ZEND_GET_MODULE(oci8)
-#endif /* COMPILE_DL */
-
-/* }}} */
-/* {{{ startup/shutdown/info/internal function prototypes */
-
-PHP_MINIT_FUNCTION(oci);
-PHP_RINIT_FUNCTION(oci);
-PHP_MSHUTDOWN_FUNCTION(oci);
-PHP_RSHUTDOWN_FUNCTION(oci);
-PHP_MINFO_FUNCTION(oci);
-
-static ub4 oci_handle_error(oci_connection *connection, ub4 errcode);
-static ub4 oci_error(OCIError *err_p, char *what, sword status);
-static int oci_ping(oci_server *server);
-static void oci_debug(const char *format, ...);
-
-static void _oci_conn_list_dtor(oci_connection *connection TSRMLS_DC);
-static void _oci_stmt_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-static void _oci_descriptor_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-#ifdef WITH_COLLECTIONS
-static void _oci_coll_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-#endif
-static void _oci_server_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-static void _oci_session_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-static void php_oci_free_conn_list(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-
-static void _oci_column_hash_dtor(void *data);
-static void _oci_define_hash_dtor(void *data);
-static void _oci_bind_hash_dtor(void *data);
-
-static oci_connection *oci_get_conn(zval ** TSRMLS_DC);
-static oci_statement *oci_get_stmt(zval ** TSRMLS_DC);
-static oci_descriptor *oci_get_desc(int TSRMLS_DC);
-#ifdef WITH_COLLECTIONS
-/* Questionable name. Very close to oci_get_col */
-static oci_collection *oci_get_coll(int TSRMLS_DC);
-#endif
-static oci_out_column *oci_get_col(oci_statement *, int, zval **);
-
-static int _oci_make_zval(zval *, oci_statement *, oci_out_column *, char *, int mode TSRMLS_DC);
-static oci_statement *oci_parse(oci_connection *, char *, int);
-static int oci_execute(oci_statement *, char *, ub4 mode);
-static int oci_fetch(oci_statement *, ub4, char * TSRMLS_DC);
-static int oci_loadlob(oci_connection *, oci_descriptor *, char **, ub4 *length);
-static int oci_setprefetch(oci_statement *statement, int size);
-
-static void oci_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent,int exclusive);
-
-static oci_server *_oci_open_server(char *dbname,int persistent);
-static void _oci_close_server(oci_server *server);
-
-static oci_session *_oci_open_session(oci_server* server,char *username,char *password,int persistent,int exclusive, char *charset);
-static void _oci_close_session(oci_session *session);
-
-static sb4 oci_bind_in_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 *, ub1 *, dvoid **);
-static sb4 oci_bind_out_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **);
-
-#if 0
-static sb4 oci_failover_callback(dvoid *svchp,dvoid* envhp,dvoid *fo_ctx,ub4 fo_type, ub4 fo_event);
-#endif
-
-/* }}} */
-/* {{{ extension function prototypes */
-
-PHP_FUNCTION(ocibindbyname);
-PHP_FUNCTION(ocidefinebyname);
-PHP_FUNCTION(ocicolumnisnull);
-PHP_FUNCTION(ocicolumnname);
-PHP_FUNCTION(ocicolumnsize);
-PHP_FUNCTION(ocicolumnscale);
-PHP_FUNCTION(ocicolumnprecision);
-PHP_FUNCTION(ocicolumntype);
-PHP_FUNCTION(ocicolumntyperaw);
-PHP_FUNCTION(ociexecute);
-PHP_FUNCTION(ocifetch);
-PHP_FUNCTION(ocicancel);
-PHP_FUNCTION(ocifetchinto);
-PHP_FUNCTION(ocifetchstatement);
-PHP_FUNCTION(ocifreestatement);
-PHP_FUNCTION(ociinternaldebug);
-PHP_FUNCTION(ocilogoff);
-PHP_FUNCTION(ocilogon);
-PHP_FUNCTION(ocinlogon);
-PHP_FUNCTION(ociplogon);
-PHP_FUNCTION(ocierror);
-PHP_FUNCTION(ocifreedesc);
-PHP_FUNCTION(ocisavelob);
-PHP_FUNCTION(ocisavelobfile);
-PHP_FUNCTION(ociloadlob);
-PHP_FUNCTION(ociwritelobtofile);
-PHP_FUNCTION(ocicommit);
-PHP_FUNCTION(ocirollback);
-PHP_FUNCTION(ocinewdescriptor);
-PHP_FUNCTION(ocinumcols);
-PHP_FUNCTION(ociparse);
-PHP_FUNCTION(ocinewcursor);
-PHP_FUNCTION(ociresult);
-PHP_FUNCTION(ociserverversion);
-PHP_FUNCTION(ocistatementtype);
-PHP_FUNCTION(ocirowcount);
-PHP_FUNCTION(ocisetprefetch);
-PHP_FUNCTION(ocipasswordchange);
-#ifdef HAVE_OCI8_TEMP_LOB
-PHP_FUNCTION(ociwritetemporarylob);
-PHP_FUNCTION(ocicloselob);
-#endif
-#ifdef WITH_COLLECTIONS
-PHP_FUNCTION(ocinewcollection);
-PHP_FUNCTION(ocifreecollection);
-PHP_FUNCTION(ocicollappend);
-PHP_FUNCTION(ocicollgetelem);
-PHP_FUNCTION(ocicollassignelem);
-PHP_FUNCTION(ocicollassign);
-PHP_FUNCTION(ocicollsize);
-PHP_FUNCTION(ocicollmax);
-PHP_FUNCTION(ocicolltrim);
-#endif
-
-#define OCI_GET_STMT(statement,value) \
- statement = oci_get_stmt(value TSRMLS_CC); \
- if (statement == NULL) { \
- RETURN_FALSE; \
- }
-
-#define OCI_GET_CONN(connection,value) \
- connection = oci_get_conn(value TSRMLS_CC); \
- if (connection == NULL) { \
- RETURN_FALSE; \
- }
-
-#define OCI_GET_DESC(descriptor,index) \
- descriptor = oci_get_desc(index TSRMLS_CC); \
- if (descriptor == NULL) { \
- RETURN_FALSE; \
- }
-
-#ifdef WITH_COLLECTIONS
-#define OCI_GET_COLL(collection,index) \
- collection = oci_get_coll(index TSRMLS_CC); \
- if (collection == NULL) { \
- RETURN_FALSE; \
- }
-#endif
-
-/* }}} */
-/* {{{ extension definition structures */
-
-#define OCI_ASSOC 1<<0
-#define OCI_NUM 1<<1
-#define OCI_BOTH (OCI_ASSOC|OCI_NUM)
-
-#define OCI_RETURN_NULLS 1<<2
-#define OCI_RETURN_LOBS 1<<3
-
-#define OCI_FETCHSTATEMENT_BY_COLUMN 1<<4
-#define OCI_FETCHSTATEMENT_BY_ROW 1<<5
-#define OCI_FETCHSTATEMENT_BY (OCI_FETCHSTATEMENT_BY_COLUMN | OCI_FETCHSTATEMENT_BY_ROW)
-
-static unsigned char a3_arg_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-static unsigned char a2_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
-
-static zend_function_entry php_oci_functions[] = {
- PHP_FE(ocidefinebyname, a3_arg_force_ref)
- PHP_FE(ocibindbyname, a3_arg_force_ref)
- PHP_FE(ocicolumnisnull, NULL)
- PHP_FE(ocicolumnname, NULL)
- PHP_FE(ocicolumnsize, NULL)
- PHP_FE(ocicolumnscale, NULL)
- PHP_FE(ocicolumnprecision, NULL)
- PHP_FE(ocicolumntype, NULL)
- PHP_FE(ocicolumntyperaw, NULL)
- PHP_FE(ociexecute, NULL)
- PHP_FE(ocicancel, NULL)
- PHP_FE(ocifetch, NULL)
- PHP_FE(ocifetchinto, a2_arg_force_ref)
- PHP_FE(ocifetchstatement, a2_arg_force_ref)
- PHP_FE(ocifreestatement, NULL)
- PHP_FE(ociinternaldebug, NULL)
- PHP_FE(ocinumcols, NULL)
- PHP_FE(ociparse, NULL)
- PHP_FE(ocinewcursor, NULL)
- PHP_FE(ociresult, NULL)
- PHP_FE(ociserverversion, NULL)
- PHP_FE(ocistatementtype, NULL)
- PHP_FE(ocirowcount, NULL)
- PHP_FE(ocilogoff, NULL)
- PHP_FE(ocilogon, NULL)
- PHP_FE(ocinlogon, NULL)
- PHP_FE(ociplogon, NULL)
- PHP_FE(ocierror, NULL)
- PHP_FE(ocifreedesc, NULL)
- PHP_FE(ocisavelob, NULL)
- PHP_FE(ocisavelobfile, NULL)
- PHP_FE(ociloadlob, NULL)
- PHP_FE(ociwritelobtofile, NULL)
- PHP_FE(ocicommit, NULL)
- PHP_FE(ocirollback, NULL)
- PHP_FE(ocinewdescriptor, NULL)
- PHP_FE(ocisetprefetch, NULL)
- PHP_FE(ocipasswordchange, NULL)
-#ifdef WITH_COLLECTIONS
- PHP_FE(ocifreecollection, NULL)
- PHP_FE(ocicollappend, NULL)
- PHP_FE(ocicollgetelem, NULL)
- PHP_FE(ocicollassignelem, NULL)
- PHP_FE(ocicollassign, NULL)
- PHP_FE(ocicollsize, NULL)
- PHP_FE(ocicollmax, NULL)
- PHP_FE(ocicolltrim, NULL)
- PHP_FE(ocinewcollection, NULL)
-#endif
-
- PHP_FALIAS(ocifreecursor,ocifreestatement,NULL)
-
- {NULL,NULL,NULL}
-};
-
-static zend_function_entry php_oci_lob_class_functions[] = {
- PHP_FALIAS(load, ociloadlob, NULL)
- PHP_FALIAS(writetofile, ociwritelobtofile, NULL)
-#ifdef HAVE_OCI8_TEMP_LOB
- PHP_FALIAS(writetemporary, ociwritetemporarylob,NULL)
- PHP_FALIAS(close, ocicloselob, NULL)
-#endif
- PHP_FALIAS(save, ocisavelob, NULL)
- PHP_FALIAS(savefile, ocisavelobfile, NULL)
- PHP_FALIAS(free, ocifreedesc, NULL)
- {NULL,NULL,NULL}
-};
-
-#ifdef WITH_COLLECTIONS
-static zend_function_entry php_oci_coll_class_functions[] = {
- PHP_FALIAS(append, ocicollappend, NULL)
- PHP_FALIAS(getelem, ocicollgetelem, NULL)
- PHP_FALIAS(assignelem, ocicollassignelem, NULL)
- PHP_FALIAS(assign, ocicollassign, NULL)
- PHP_FALIAS(size, ocicollsize, NULL)
- PHP_FALIAS(max, ocicollmax, NULL)
- PHP_FALIAS(trim, ocicolltrim, NULL)
- PHP_FALIAS(free, ocifreecollection, NULL)
- {NULL,NULL,NULL}
-};
-#endif
-
-zend_module_entry oci8_module_entry = {
- STANDARD_MODULE_HEADER,
- "oci8", /* extension name */
- php_oci_functions, /* extension function list */
- PHP_MINIT(oci), /* extension-wide startup function */
- PHP_MSHUTDOWN(oci), /* extension-wide shutdown function */
- PHP_RINIT(oci), /* per-request startup function */
- PHP_RSHUTDOWN(oci), /* per-request shutdown function */
- PHP_MINFO(oci), /* information function */
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-/* }}} */
-/* {{{ debug malloc/realloc/free */
-
-#define OCI_USE_EMALLOC 0 /* set this to 1 if you want to use the php memory manager! */
-
-#if OCI_USE_EMALLOC
-CONST dvoid *ocimalloc(dvoid *ctx, size_t size)
-{
- dvoid *ret;
- ret = (dvoid *)malloc(size);
- oci_debug("ocimalloc(%d) = %08x", size,ret);
- return ret;
-}
-
-CONST dvoid *ocirealloc(dvoid *ctx, dvoid *ptr, size_t size)
-{
- dvoid *ret;
- oci_debug("ocirealloc(%08x, %d)", ptr, size);
- ret = (dvoid *)realloc(ptr, size);
- return ptr;
-}
-
-CONST void ocifree(dvoid *ctx, dvoid *ptr)
-{
- oci_debug("ocifree(%08x)", ptr);
- free(ptr);
-}
-#endif
-
-/* }}} */
-/* {{{ startup, shutdown and info functions */
-
-static void php_oci_init_globals(php_oci_globals *oci_globals_p TSRMLS_DC)
-{
- OCI(shutdown) = 0;
- OCI(in_call) = 0;
-
- OCI(user) = malloc(sizeof(HashTable));
- zend_hash_init(OCI(user), 13, NULL, NULL, 1);
-
- OCI(server) = malloc(sizeof(HashTable));
- zend_hash_init(OCI(server), 13, NULL, NULL, 1);
-
- CALL_OCI(OCIEnvInit(
- &OCI(pEnv),
- OCI_DEFAULT,
- 0,
- NULL));
-
- CALL_OCI(OCIHandleAlloc(
- OCI(pEnv),
- (dvoid **)&OCI(pError),
- OCI_HTYPE_ERROR,
- 0,
- NULL));
-}
-
-PHP_MINIT_FUNCTION(oci)
-{
- zend_class_entry oci_lob_class_entry;
-#ifdef WITH_COLLECTIONS
- zend_class_entry oci_coll_class_entry;
-#endif
-
-#ifdef HAVE_OCI8_SHARED_MODE
-
-#ifdef WITH_COLLECTIONS
-#define PHP_OCI_INIT_MODE OCI_SHARED | OCI_OBJECT
-#else
-#define PHP_OCI_INIT_MODE OCI_SHARED
-#endif
-
-#else
-
-#ifdef WITH_COLLECTIONS
-#define PHP_OCI_INIT_MODE OCI_DEFAULT | OCI_OBJECT
-#else
-#define PHP_OCI_INIT_MODE OCI_DEFAULT
-#endif
-
-#endif
-
-#if OCI_USE_EMALLOC
- OCIInitialize(PHP_OCI_INIT_MODE, NULL, ocimalloc, ocirealloc, ocifree);
-#else
- OCIInitialize(PHP_OCI_INIT_MODE, NULL, NULL, NULL, NULL);
-#endif
-
-#ifdef ZTS
- ts_allocate_id(&oci_globals_id, sizeof(php_oci_globals), (ts_allocate_ctor) php_oci_init_globals, NULL);
-#else
- php_oci_init_globals(&oci_globals TSRMLS_CC);
-#endif
-
- le_stmt = zend_register_list_destructors_ex(_oci_stmt_list_dtor, NULL, "oci8 statement", module_number);
- le_conn = zend_register_list_destructors_ex(php_oci_free_conn_list, NULL, "oci8 connection", module_number);
- le_desc = zend_register_list_destructors_ex(_oci_descriptor_list_dtor, NULL, "oci8 descriptor", module_number);
-#ifdef WITH_COLLECTIONS
- le_coll = zend_register_list_destructors_ex(_oci_coll_list_dtor, NULL, "oci8 collection", module_number);
-#endif
- le_server = zend_register_list_destructors_ex(_oci_server_list_dtor, NULL, "oci8 server", module_number);
- le_session = zend_register_list_destructors_ex(_oci_session_list_dtor, NULL, "oci8 session", module_number);
-
- INIT_CLASS_ENTRY(oci_lob_class_entry, "OCI-Lob", php_oci_lob_class_functions);
-#ifdef WITH_COLLECTIONS
- INIT_CLASS_ENTRY(oci_coll_class_entry, "OCI-Collection", php_oci_coll_class_functions);
-#endif
-
- oci_lob_class_entry_ptr = zend_register_internal_class(&oci_lob_class_entry TSRMLS_CC);
-#ifdef WITH_COLLECTIONS
- oci_coll_class_entry_ptr = zend_register_internal_class(&oci_coll_class_entry TSRMLS_CC);
-#endif
-
-/* thies@thieso.net 990203 i do not think that we will need all of them - just in here for completeness for now! */
- REGISTER_LONG_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_DESCRIBE_ONLY",OCI_DESCRIBE_ONLY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_EXACT_FETCH",OCI_EXACT_FETCH, CONST_CS | CONST_PERSISTENT);
-
-/* for OCIBindByName (real "oci" names + short "php" names*/
- REGISTER_LONG_CONSTANT("SQLT_BFILEE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLT_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLT_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLT_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLT_RDD",SQLT_RDD, CONST_CS | CONST_PERSISTENT);
-
-#ifdef WITH_COLLECTIONS
- REGISTER_LONG_CONSTANT("OCI_B_SQLT_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT);
- REGISTER_STRING_CONSTANT("OCI_SYSDATE","SYSDATE",CONST_PERSISTENT);
-#endif
-
- REGISTER_LONG_CONSTANT("OCI_B_BFILE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_B_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_B_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_B_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_B_ROWID",SQLT_RDD, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_B_CURSOR",SQLT_RSET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_B_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT);
-
-/* for OCIFetchStatement */
- REGISTER_LONG_CONSTANT("OCI_FETCHSTATEMENT_BY_COLUMN", OCI_FETCHSTATEMENT_BY_COLUMN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_FETCHSTATEMENT_BY_ROW", OCI_FETCHSTATEMENT_BY_ROW, CONST_CS | CONST_PERSISTENT);
-
-/* for OCIFetchInto & OCIResult */
- REGISTER_LONG_CONSTANT("OCI_ASSOC",OCI_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_NUM",OCI_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_BOTH",OCI_BOTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_RETURN_NULLS",OCI_RETURN_NULLS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_RETURN_LOBS",OCI_RETURN_LOBS, CONST_CS | CONST_PERSISTENT);
-
-/* for OCINewDescriptor (real "oci" names + short "php" names*/
- REGISTER_LONG_CONSTANT("OCI_DTYPE_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_DTYPE_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_DTYPE_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("OCI_D_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_D_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-/* ----------------------------------------------------------------- */
-
-
-PHP_RINIT_FUNCTION(oci)
-{
- /* XXX NYI
- OCI(num_links) =
- OCI(num_persistent);
- */
-
- OCI(debug_mode) = 0; /* start "fresh" */
-/* OCI(in_call) = 0; i don't think we want this! */
-
- oci_debug("php_rinit_oci");
-
- return SUCCESS;
-}
-
-static int _session_pcleanup(oci_session *session TSRMLS_DC)
-{
- _oci_close_session(session);
-
- return 1;
-}
-
-static int _server_pcleanup(oci_server *server TSRMLS_DC)
-{
- _oci_close_server(server);
-
- return 1;
-}
-
-PHP_MSHUTDOWN_FUNCTION(oci)
-{
- OCI(shutdown) = 1;
-
- oci_debug("START php_mshutdown_oci");
-
- zend_hash_apply(OCI(user), (apply_func_t)_session_pcleanup TSRMLS_CC);
- zend_hash_apply(OCI(server), (apply_func_t)_server_pcleanup TSRMLS_CC);
-
- zend_hash_destroy(OCI(user));
- zend_hash_destroy(OCI(server));
-
- free(OCI(user));
- free(OCI(server));
-
- CALL_OCI(OCIHandleFree(
- (dvoid *)OCI(pEnv),
- OCI_HTYPE_ENV));
-
- oci_debug("END php_mshutdown_oci");
-
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(oci)
-{
- oci_debug("START php_rshutdown_oci");
-
-#if 0
- /* XXX free all statements, rollback all outstanding transactions */
-
- zend_hash_apply(OCI(user), (apply_func_t) _session_cleanup TSRMLS_CC);
- zend_hash_apply(OCI(server), (apply_func_t) _server_cleanup TSRMLS_CC);
-#endif
-
- oci_debug("END php_rshutdown_oci");
-
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(oci)
-{
-
- php_info_print_table_start();
- php_info_print_table_row(2, "OCI8 Support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision$");
-#ifndef PHP_WIN32
- php_info_print_table_row(2, "Oracle Version", PHP_OCI8_VERSION );
- php_info_print_table_row(2, "Compile-time ORACLE_HOME", PHP_OCI8_DIR );
- php_info_print_table_row(2, "Libraries Used", PHP_OCI8_SHARED_LIBADD );
-#endif
- php_info_print_table_end();
-
-}
-
-/* }}} */
-/* {{{ _oci_define_hash_dtor() */
-
-static void
-_oci_define_hash_dtor(void *data)
-{
- oci_define *define = (oci_define *) data;
-
- oci_debug("_oci_define_hash_dtor: %s",define->name);
-
- zval_ptr_dtor(&define->zval);
-
- if (define->name) {
- efree(define->name);
- define->name = 0;
- }
-}
-
-/* }}} */
-/* {{{ _oci_bind_hash_dtor() */
-
-static void
-_oci_bind_hash_dtor(void *data)
-{
- oci_bind *bind = (oci_bind *) data;
-
- oci_debug("_oci_bind_hash_dtor:");
-
- zval_ptr_dtor(&(bind->zval));
-}
-
-/* }}} */
-/* {{{ _oci_bind_pre_exec() */
-
-static int
-_oci_bind_pre_exec(void *data TSRMLS_DC)
-{
- oci_bind *bind = (oci_bind *) data;
-
- /* reset all bind stuff to a normal state..-. */
-
- bind->indicator = 0;
-
- return 0;
-}
-
-/* }}} */
-/* {{{ _oci_bind_post_exec() */
-
-static int
-_oci_bind_post_exec(void *data TSRMLS_DC)
-{
- oci_bind *bind = (oci_bind *) data;
-
- if (bind->indicator == -1) { /* NULL */
- zval *val = bind->zval;
- if (Z_TYPE_P(val) == IS_STRING && (Z_STRVAL_P(val) != empty_string)) {
- *Z_STRVAL_P(val) = '\0'; /* XXX avoid warning in debug mode */
- }
- zval_dtor(val);
- ZVAL_NULL(val);
- } else if (Z_TYPE_P(bind->zval) == IS_STRING && (Z_STRVAL_P(bind->zval) != empty_string)) {
- Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRLEN_P(bind->zval)+1);
- Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] = '\0';
- }
-
-
- return 0;
-}
-
-/* }}} */
-/* {{{ _oci_column_hash_dtor() */
-
-static void
-_oci_column_hash_dtor(void *data)
-{
- oci_out_column *column = (oci_out_column *) data;
- TSRMLS_FETCH();
-
- oci_debug("START _oci_column_hash_dtor: %s",column->name);
-
- if (column->stmtid) {
- zend_list_delete(column->stmtid);
- }
-
- if (column->is_descr) {
- zend_list_delete(column->descid);
- } else {
- if (column->data) {
- efree(column->data);
- }
- }
-
- oci_debug("END _oci_column_hash_dtor: %s",column->name);
-
- if (column->name) {
- efree(column->name);
- }
-}
-
-/* }}} */
-/* {{{ _oci_stmt_list_dtor() */
-
-static void
-_oci_stmt_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- oci_statement *statement = (oci_statement *)rsrc->ptr;
- oci_debug("START _oci_stmt_list_dtor: id=%d last_query=\"%s\"",statement->id,SAFE_STRING(statement->last_query));
-
- if (statement->pStmt) {
- CALL_OCI(OCIHandleFree(
- statement->pStmt,
- OCI_HTYPE_STMT));
-
- statement->pStmt = 0;
- }
-
- if (statement->pError) {
- CALL_OCI(OCIHandleFree(
- statement->pError,
- OCI_HTYPE_ERROR));
-
- statement->pError = 0;
- }
-
- if (statement->last_query) {
- efree(statement->last_query);
- }
-
- if (statement->columns) {
- zend_hash_destroy(statement->columns);
- efree(statement->columns);
- }
-
- if (statement->binds) {
- zend_hash_destroy(statement->binds);
- efree(statement->binds);
- }
-
- if (statement->defines) {
- zend_hash_destroy(statement->defines);
- efree(statement->defines);
- }
-
- zend_list_delete(statement->conn->id);
-
- oci_debug("END _oci_stmt_list_dtor: id=%d",statement->id);
-
- efree(statement);
-}
-
-/* }}} */
-/* {{{ _oci_conn_list_dtor() */
-
-static void
-_oci_conn_list_dtor(oci_connection *connection TSRMLS_DC)
-{
- /*
- as the connection is "only" a in memory service context we do not disconnect from oracle.
- */
-
- oci_debug("START _oci_conn_list_dtor: id=%d",connection->id);
-
- if (connection->pServiceContext) {
-
- if (connection->needs_commit) {
- oci_debug("OCITransRollback");
- CALL_OCI_RETURN(connection->error,OCITransRollback(
- connection->pServiceContext,
- connection->pError,
- (ub4)0));
-
- if (connection->error) {
- oci_error(connection->pError, "failed to rollback outstanding transactions!", connection->error);
- }
- connection->needs_commit = 0;
- } else {
- oci_debug("nothing to do..");
- }
-
- CALL_OCI(OCIHandleFree(
- (dvoid *) connection->pServiceContext,
- (ub4) OCI_HTYPE_SVCCTX));
- }
-
- if (connection->session && connection->session->exclusive) {
- /* exclusive connection created via OCINLogon() close their
- associated session when destructed */
- zend_list_delete(connection->session->num);
- }
-
- if (connection->pError) {
- CALL_OCI(OCIHandleFree(
- (dvoid *) connection->pError,
- (ub4) OCI_HTYPE_ERROR));
- }
-
- oci_debug("END _oci_conn_list_dtor: id=%d",connection->id);
-
- efree(connection);
-}
-
-/* }}} */
-
-/* {{{ php_oci_free_conn_list
- */
-static void php_oci_free_conn_list(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- oci_connection *conn = (oci_connection *)rsrc->ptr;
- _oci_conn_list_dtor(conn TSRMLS_CC);
-}
-/* }}} */
-
-#ifdef WITH_COLLECTIONS
-
-/* {{{ _oci_coll_list_dtor()
- */
-
-static void
-_oci_coll_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- oci_collection *coll = (oci_collection *)rsrc->ptr;
- oci_debug("START _oci_coll_list_dtor: %d",coll->id);
-
- zend_list_delete(coll->conn->id);
- /* Note sure if we need to free the object. Have an
- oracle TAR out on this one.
- OCIDescriptorFree(descr->ocidescr, Z_TYPE_P(descr)); */
-
- oci_debug("END _oci_coll_list_dtor: %d",coll->id);
-
- efree(coll);
-}
-/* }}} */
-#endif
-
-/* {{{ _oci_descriptor_list_dtor()
- */
-
-static void
-_oci_descriptor_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- oci_descriptor *descr = (oci_descriptor *)rsrc->ptr;
- oci_debug("START _oci_descriptor_list_dtor: %d",descr->id);
-
- zend_list_delete(descr->conn->id);
-
- CALL_OCI(OCIDescriptorFree(
- descr->ocidescr,
- Z_TYPE_P(descr)));
-
- oci_debug("END _oci_descriptor_list_dtor: %d",descr->id);
-
- efree(descr);
-}
-
-/* }}} */
-/* {{{ _oci_server_list_dtor()
- */
-
-static void
-_oci_server_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- oci_server *server = (oci_server *)rsrc->ptr;
- if (server->persistent)
- return;
-
- _oci_close_server(server);
-}
-
-/* }}} */
-/* {{{ _oci_session_list_dtor()
- */
-
-static void
-_oci_session_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- oci_session *session = (oci_session *)rsrc->ptr;
- if (session->persistent)
- return;
-
- _oci_close_session(session);
-}
-
-/* }}} */
-
-/* {{{ oci_handle_error
- */
-static ub4
-oci_handle_error(oci_connection *connection, ub4 errcode)
-{
- switch (errcode) {
- case 1013: /* user requested cancel of current operation */
- zend_bailout();
- break;
-
- case 22: /* ORA-00022 Invalid session id */
- case 1012: /* ORA-01012: */
- case 3113: /* ORA-03113: end-of-file on communication channel */
- case 604:
- case 1041:
- connection->is_open = 0;
- connection->session->is_open = 0;
- connection->session->server->is_open = 0;
- return 1; /* fatal error */
- }
-
- return 0; /* no fatal error */
-}
-/* }}} */
-
-/* {{{ oci_error() */
-
-static ub4
-oci_error(OCIError *err_p, char *what, sword status)
-{
- text errbuf[512];
- sb4 errcode = 0;
- TSRMLS_FETCH();
-
- switch (status) {
- case OCI_SUCCESS:
- break;
- case OCI_SUCCESS_WITH_INFO:
- CALL_OCI(OCIErrorGet(
- err_p,
- (ub4)1,
- NULL,
- &errcode,
- errbuf,
- (ub4)sizeof(errbuf),
- (ub4)OCI_HTYPE_ERROR));
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: OCI_SUCCESS_WITH_INFO: %s", what, errbuf);
- break;
- case OCI_NEED_DATA:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: OCI_NEED_DATA", what);
- break;
- case OCI_NO_DATA:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: OCI_NO_DATA", what);
- break;
- case OCI_ERROR: {
- CALL_OCI(OCIErrorGet(
- err_p,
- (ub4)1,
- NULL,
- &errcode,
- errbuf,
- (ub4)sizeof(errbuf),
- (ub4)OCI_HTYPE_ERROR));
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: %s", what, errbuf);
- break;
- }
- case OCI_INVALID_HANDLE:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: OCI_INVALID_HANDLE", what);
- break;
- case OCI_STILL_EXECUTING:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: OCI_STILL_EXECUTING", what);
- break;
- case OCI_CONTINUE:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: OCI_CONTINUE", what);
- break;
- default:
- break;
- }
- return errcode;
-}
-
-/* }}} */
-/* {{{ oci_ping() */
-
-static int oci_ping(oci_server *server)
-{
- char version[256];
- TSRMLS_FETCH();
-
- CALL_OCI_RETURN(OCI(error), OCIServerVersion(
- server->pServer,
- OCI(pError),
- (text*)version,
- sizeof(version),
- OCI_HTYPE_SERVER));
-
- if (OCI(error) == OCI_SUCCESS) {
- return 1;
- }
-
- oci_error(OCI(pError), "oci_ping", OCI(error));
-
- return 0;
-}
-
-/* }}} */
-
-/************************* INTERNAL FUNCTIONS *************************/
-
-/* {{{ oci_debug() */
-
-static void oci_debug(const char *format, ...)
-{
- TSRMLS_FETCH();
-
- if (OCI(debug_mode)) {
- char buffer[1024];
- va_list args;
-
- va_start(args, format);
- vsnprintf(buffer, sizeof(buffer)-1, format, args);
- va_end(args);
- buffer[sizeof(buffer)-1] = '\0';
- php_printf("OCIDebug: %s<br />\n", buffer);
- }
-}
-
-/* }}} */
-/* {{{ oci_get_conn() */
-
-static oci_connection *oci_get_conn(zval **conn TSRMLS_DC)
-{
- oci_connection *connection;
-
- connection = (oci_connection *) zend_fetch_resource(conn TSRMLS_CC, -1, "OCI8-Connection", NULL, 1, le_conn);
-
- if (connection && connection->is_open) {
- return connection;
- } else {
- return (oci_connection *) NULL;
- }
-}
-
-/* }}} */
-/* {{{ oci_get_stmt() */
-
-static oci_statement *oci_get_stmt(zval **stmt TSRMLS_DC)
-{
- oci_statement *statement;
-
- statement = (oci_statement *) zend_fetch_resource(stmt TSRMLS_CC, -1, "OCI8-Statement", NULL, 1, le_stmt);
-
- if (statement && statement->conn->is_open) {
- return statement;
- } else {
- return (oci_statement *) NULL;
- }
-}
-
-/* }}} */
-/* {{{ oci_get_desc() */
-
-static oci_descriptor *oci_get_desc(int ind TSRMLS_DC)
-{
- oci_descriptor *descriptor;
- int actual_resource_type;
-
- descriptor = (oci_descriptor *) zend_list_find(ind, &actual_resource_type);
-
- if (descriptor && (actual_resource_type == le_desc)) {
- return descriptor;
- } else {
- return (oci_descriptor *) NULL;
- }
-}
-
-/* }}} */
-/* {{{ oci_get_col() */
-
-static oci_out_column *
-oci_get_col(oci_statement *statement, int col, zval **value)
-{
- oci_out_column *outcol = NULL;
- int i;
- TSRMLS_FETCH();
-
- if (statement->columns == 0) { /* we release the columns at the end of a fetch */
- return NULL;
- }
-
- if (value) {
- if (Z_TYPE_PP(value) == IS_STRING) {
- for (i = 0; i < statement->ncolumns; i++) {
- outcol = oci_get_col(statement, i + 1, 0);
- if (outcol == NULL) {
- continue;
- } else if (((int) outcol->name_len == Z_STRLEN_PP(value))
- && (! strncmp(outcol->name,Z_STRVAL_PP(value),Z_STRLEN_PP(value)))) {
- return outcol;
- }
- }
- } else {
- convert_to_long_ex(value);
- return oci_get_col(statement,Z_LVAL_PP(value),0);
- }
- } else if (col != -1) {
- if (zend_hash_index_find(statement->columns, col, (void **)&outcol) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column %d", col);
- return NULL;
- }
- return outcol;
- }
-
- return NULL;
-}
-
-/* }}} */
-/* {{{ oci_new_desc() */
-
-static oci_descriptor*
-oci_new_desc(int type,oci_connection *connection)
-{
- oci_descriptor *descr;
- TSRMLS_FETCH();
-
- descr = emalloc(sizeof(oci_descriptor));
-
- Z_TYPE_P(descr) = type;
-
- switch (Z_TYPE_P(descr)) {
- case OCI_DTYPE_FILE:
- case OCI_DTYPE_LOB:
- case OCI_DTYPE_ROWID:
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown descriptor type %d.",Z_TYPE_P(descr));
- return 0;
- }
-
- CALL_OCI_RETURN(OCI(error), OCIDescriptorAlloc(
- connection->session->pEnv,
- (dvoid*)&(descr->ocidescr),
- Z_TYPE_P(descr),
- (size_t) 0,
- (dvoid **) 0));
-
- if (OCI(error)) {
- ub4 error;
- error = oci_error(OCI(pError),"OCIDescriptorAlloc %d",OCI(error));
- oci_handle_error(connection, error);
- return 0;
- }
-
- descr->id = zend_list_insert(descr,le_desc);
- descr->conn = connection;
- zend_list_addref(connection->id);
-
- oci_debug("oci_new_desc %d",descr->id);
-
- return descr;
-}
-
-#ifdef WITH_COLLECTIONS
-
-/* {{{ _oci_get_ocicoll() */
-
-static int
-_oci_get_ocicoll(zval *id,oci_collection **collection TSRMLS_DC)
-{
- zval **coll;
-
- if (zend_hash_find(Z_OBJPROP_P(id), "collection", sizeof("collection"), (void **)&coll) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot find collection");
- return 0;
- }
- if ((*collection = oci_get_coll(Z_LVAL_PP(coll) TSRMLS_CC)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "collection not found");
- return 0;
- }
-
- return Z_LVAL_PP(coll);
-}
-
-/* }}} */
-
-#endif
-
-/* }}} */
-/* {{{ _oci_get_ocidesc() */
-
-static int
-_oci_get_ocidesc(zval *id,oci_descriptor **descriptor TSRMLS_DC)
-{
- zval **desc;
-
- if (zend_hash_find(Z_OBJPROP_P(id), "descriptor", sizeof("descriptor"), (void **)&desc) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot find descriptor");
- return 0;
- }
-
- if ((*descriptor = oci_get_desc(Z_LVAL_PP(desc) TSRMLS_CC)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "descriptor not found");
- return 0;
- }
-
- return Z_LVAL_PP(desc);
-}
-
-/* }}} */
-/* {{{ _oci_make_zval() */
-
-static int
-_oci_make_zval(zval *value,oci_statement *statement,oci_out_column *column, char *func, int mode TSRMLS_DC)
-{
- oci_descriptor *descr;
- ub4 loblen;
- int size;
- char *buffer;
-
- if (column->indicator || column->retcode)
- if ((column->indicator != -1) && (column->retcode != 1405))
- oci_debug("_oci_make_zval: %16s,retlen = %4d,retlen4 = %d,storage_size4 = %4d,indicator %4d, retcode = %4d",
- column->name,column->retlen,column->retlen4,column->storage_size4,column->indicator,column->retcode);
-
- if ((! statement->has_data) || (column->indicator == -1)) { /* column is NULL or statment has no current data */
- ZVAL_NULL(value);
- return 0;
- }
-
- if (column->is_cursor) { /* REFCURSOR -> simply return the statement id */
- ZVAL_RESOURCE(value,column->stmtid);
- zend_list_addref(column->stmtid);
- } else if (column->is_descr) {
- if ((column->data_type != SQLT_RDD) && (mode & OCI_RETURN_LOBS)) {
- /* OCI_RETURN_LOBS means that we want the content of the LOB back instead of the locator */
-
- descr = oci_get_desc(column->descid TSRMLS_CC);
- if (! descr) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to find my descriptor %d",column->data);
- return -1;
- }
-
- if (oci_loadlob(statement->conn,descr,&buffer,&loblen)) {
- ZVAL_FALSE(value);
- } else {
- ZVAL_STRINGL(value,buffer,loblen,0);
- }
- } else {
- /* return the locator */
- object_init_ex(value, oci_lob_class_entry_ptr);
- add_property_resource(value, "descriptor", column->descid);
- zend_list_addref(column->descid);
- }
- } else {
- switch (column->retcode) {
- case 0:
- /* intact value */
- if (column->piecewise) {
- size = column->retlen4;
- } else {
- size = column->retlen;
- }
- break;
-
- default:
- /* XXX we SHOULD maybe have a different behaviour for unknown results! */
- ZVAL_FALSE(value);
- return 0;
- }
-
- ZVAL_STRINGL(value,column->data,size,1);
- }
-
- return 0;
-}
-
-/* }}} */
-/* {{{ oci_setprefetch() */
-
-static int
-oci_setprefetch(oci_statement *statement,int size)
-{
- ub4 prefetch;
- sword error;
- TSRMLS_FETCH();
-
- prefetch = size * 1024;
-
- CALL_OCI_RETURN(error, OCIAttrSet(
- statement->pStmt,
- OCI_HTYPE_STMT,
- &prefetch,
- 0,
- OCI_ATTR_PREFETCH_MEMORY,
- statement->pError));
-
- statement->error = oci_error(statement->pError, "OCIAttrSet OCI_ATTR_PREFETCH_MEMORY", error);
-
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- }
-
- prefetch = size;
- CALL_OCI_RETURN(error, OCIAttrSet(
- statement->pStmt,
- OCI_HTYPE_STMT,
- &prefetch,
- 0,
- OCI_ATTR_PREFETCH_ROWS,
- statement->pError));
-
- statement->error = oci_error(statement->pError, "OCIAttrSet OCI_ATTR_PREFETCH_MEMORY", error);
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- }
-
- return 1;
-}
-
-/* }}} */
-/* {{{ oci_parse() */
-
-static oci_statement *oci_parse(oci_connection *connection, char *query, int len)
-{
- oci_statement *statement;
- sword error;
- TSRMLS_FETCH();
-
- statement = ecalloc(1,sizeof(oci_statement));
-
- CALL_OCI(OCIHandleAlloc(
- connection->session->pEnv,
- (dvoid **)&statement->pStmt,
- OCI_HTYPE_STMT,
- 0,
- NULL));
-
- CALL_OCI(OCIHandleAlloc(
- connection->session->pEnv,
- (dvoid **)&statement->pError,
- OCI_HTYPE_ERROR,
- 0,
- NULL));
-
- if (len > 0) {
- CALL_OCI_RETURN(error, OCIStmtPrepare(
- statement->pStmt,
- connection->pError,
- (text*)query,
- len,
- OCI_NTV_SYNTAX,
- OCI_DEFAULT));
-
- connection->error = oci_error(connection->pError, "OCIParse", error);
- if (connection->error) {
- CALL_OCI(OCIHandleFree(
- statement->pStmt,
- OCI_HTYPE_STMT));
-
- CALL_OCI(OCIHandleFree(
- statement->pError,
- OCI_HTYPE_ERROR));
-
- efree(statement);
- oci_handle_error(connection, connection->error);
- return 0;
- }
- }
-
- if (query) {
- statement->last_query = estrdup(query);
- }
-
- statement->conn = connection;
- statement->has_data = 0;
-
- statement->id = zend_list_insert(statement,le_stmt);
-
- oci_debug("oci_parse \"%s\" id=%d conn=%d",
- SAFE_STRING(query),
- statement->id,
- statement->conn->id);
-
- zend_list_addref(statement->conn->id);
-
- return statement;
-}
-
-/* }}} */
-/* {{{ oci_execute() */
-
-static int
-oci_execute(oci_statement *statement, char *func,ub4 mode)
-{
- oci_out_column *outcol;
- oci_out_column column;
- OCIParam *param = 0;
- text *colname;
- ub4 counter;
- ub2 define_type;
- ub4 iters;
- ub4 colcount;
- ub2 dynamic;
- int dtype;
- dvoid *buf;
- oci_descriptor *descr;
- sword error;
- TSRMLS_FETCH();
-
- if (! statement->stmttype) {
- CALL_OCI_RETURN(error, OCIAttrGet(
- (dvoid *)statement->pStmt,
- OCI_HTYPE_STMT,
- (ub2 *)&statement->stmttype,
- (ub4 *)0,
- OCI_ATTR_STMT_TYPE,
- statement->pError));
-
- statement->error = oci_error(statement->pError, "OCIAttrGet OCI_HTYPE_STMT/OCI_ATTR_STMT_TYPE", error);
-
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0;
- }
- }
-
- if (statement->stmttype == OCI_STMT_SELECT) {
- iters = 0;
- } else {
- iters = 1;
- }
-
- if (statement->last_query) {
- /* if we execute refcursors we don't have a query and
- we don't want to execute!!! */
-
- if (statement->binds) {
- zend_hash_apply(statement->binds, (apply_func_t) _oci_bind_pre_exec TSRMLS_CC);
- }
-
- CALL_OCI_RETURN(error, OCIStmtExecute(
- statement->conn->pServiceContext,
- statement->pStmt,
- statement->pError,
- iters,
- 0,
- NULL,
- NULL,
- mode));
-
- statement->error = oci_error(statement->pError, "OCIStmtExecute", error);
-
- if (statement->binds) {
- zend_hash_apply(statement->binds, (apply_func_t) _oci_bind_post_exec TSRMLS_CC);
- }
-
- oci_handle_error(statement->conn, statement->error);
-
- if (statement->error) {
- return 0;
- }
-
- if (mode & OCI_COMMIT_ON_SUCCESS) {
- statement->conn->needs_commit = 0;
- } else {
- statement->conn->needs_commit = 1;
- }
- }
-
- if ((statement->stmttype == OCI_STMT_SELECT) && (statement->executed == 0)) {
- /* we only need to do the define step is this very statement is executed the first time! */
- statement->executed = 1;
-
- ALLOC_HASHTABLE(statement->columns);
- zend_hash_init(statement->columns, 13, NULL, _oci_column_hash_dtor, 0);
-
- counter = 1;
-
- CALL_OCI_RETURN(error, OCIAttrGet(
- (dvoid *)statement->pStmt,
- OCI_HTYPE_STMT,
- (dvoid *)&colcount,
- (ub4 *)0,
- OCI_ATTR_PARAM_COUNT,
- statement->pError));
-
- statement->error = oci_error(statement->pError, "OCIAttrGet OCI_HTYPE_STMT/OCI_ATTR_PARAM_COUNT", error);
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we loose memory!!! */
- }
-
- statement->ncolumns = colcount;
-
- for (counter = 1; counter <= colcount; counter++) {
- memset(&column,0,sizeof(oci_out_column));
-
- if (zend_hash_index_update(statement->columns, counter, &column,
- sizeof(oci_out_column), (void**) &outcol) == FAILURE) {
- efree(statement->columns);
- /* out of memory */
- return 0;
- }
-
- outcol->statement = statement;
-
- CALL_OCI_RETURN(error, OCIParamGet(
- (dvoid *)statement->pStmt,
- OCI_HTYPE_STMT,
- statement->pError,
- (dvoid**)&param,
- counter));
-
- statement->error = oci_error(statement->pError, "OCIParamGet OCI_HTYPE_STMT", error);
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we loose memory!!! */
- }
-
- CALL_OCI_RETURN(error, OCIAttrGet(
- (dvoid *)param,
- OCI_DTYPE_PARAM,
- (dvoid *)&outcol->data_type,
- (ub4 *)0,
- OCI_ATTR_DATA_TYPE,
- statement->pError));
-
- statement->error = oci_error(statement->pError, "OCIAttrGet OCI_DTYPE_PARAM/OCI_ATTR_DATA_TYPE", error);
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we loose memory!!! */
- }
-
- CALL_OCI_RETURN(error, OCIAttrGet(
- (dvoid *)param,
- OCI_DTYPE_PARAM,
- (dvoid *)&outcol->data_size,
- (dvoid *)0,
- OCI_ATTR_DATA_SIZE,
- statement->pError));
-
- statement->error = oci_error(statement->pError, "OCIAttrGet OCI_DTYPE_PARAM/OCI_ATTR_DATA_SIZE", error);
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we loose memory!!! */
- }
-
- outcol->storage_size4 = outcol->data_size;
- outcol->retlen = outcol->data_size;
-
- CALL_OCI_RETURN(error, OCIAttrGet(
- (dvoid *)param,
- OCI_DTYPE_PARAM,
- (dvoid *)&outcol->scale,
- (dvoid *)0,
- OCI_ATTR_SCALE,
- statement->pError));
-
- statement->error = oci_error(statement->pError, "OCIAttrGet OCI_DTYPE_PARAM/OCI_ATTR_SCALE", error);
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we lose memory!!! */
- }
-
- CALL_OCI_RETURN(error, OCIAttrGet(
- (dvoid *)param,
- OCI_DTYPE_PARAM,
- (dvoid *)&outcol->precision,
- (dvoid *)0,
- OCI_ATTR_PRECISION,
- statement->pError));
-
- statement->error = oci_error(statement->pError, "OCIAttrGet OCI_DTYPE_PARAM/OCI_ATTR_PRECISION", error);
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we lose memory!!! */
- }
-
- CALL_OCI_RETURN(error, OCIAttrGet(
- (dvoid *)param,
- OCI_DTYPE_PARAM,
- (dvoid **)&colname, /* XXX this string is NOT zero terminated!!!! */
- (ub4 *)&outcol->name_len,
- (ub4)OCI_ATTR_NAME,
- statement->pError));
-
- statement->error = oci_error(statement->pError, "OCIAttrGet OCI_DTYPE_PARAM/OCI_ATTR_NAME", error);
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we loose memory!!! */
- }
-
- outcol->name = estrndup((char*) colname,outcol->name_len);
-
- /* find a user-setted define */
- if (statement->defines) {
- zend_hash_find(statement->defines,outcol->name,outcol->name_len,(void **) &outcol->define);
- }
-
- buf = 0;
- switch (outcol->data_type) {
- case SQLT_RSET:
- outcol->pstmt = oci_parse(statement->conn,0,0);
- outcol->stmtid = outcol->pstmt->id;
-
- define_type = SQLT_RSET;
- outcol->is_cursor = 1;
- outcol->storage_size4 = -1;
- outcol->retlen = -1;
- dynamic = OCI_DEFAULT;
- buf = &(outcol->pstmt->pStmt);
- break;
-
- case SQLT_RDD: /* ROWID */
- case SQLT_BLOB: /* binary LOB */
- case SQLT_CLOB: /* character LOB */
- case SQLT_BFILE: /* binary file LOB */
- define_type = outcol->data_type;
- outcol->is_descr = 1;
- outcol->storage_size4 = -1;
- dynamic = OCI_DEFAULT;
-
- if (outcol->data_type == SQLT_BFILE) {
- dtype = OCI_DTYPE_FILE;
- } else if (outcol->data_type == SQLT_RDD ) {
- dtype = OCI_DTYPE_ROWID;
- } else {
- dtype = OCI_DTYPE_LOB;
- }
-
- descr = oci_new_desc(dtype,statement->conn);
- if (! descr) {
- /* need better error checking XXX */
- }
- outcol->descid = descr->id;
- buf = &(descr->ocidescr);
- break;
-
- case SQLT_LNG:
- case SQLT_LBI:
- if (outcol->data_type == SQLT_LBI) {
- define_type = SQLT_BIN;
- } else {
- define_type = SQLT_CHR;
- }
- outcol->storage_size4 = OCI_MAX_DATA_SIZE;
- outcol->piecewise = 1;
- dynamic = OCI_DYNAMIC_FETCH;
- break;
-
- case SQLT_BIN:
- default:
- define_type = SQLT_CHR;
- if ((outcol->data_type == SQLT_DAT) || (outcol->data_type == SQLT_NUM)
-#ifdef SQLT_TIMESTAMP
- || (outcol->data_type == SQLT_TIMESTAMP)
-#endif
-#ifdef SQLT_TIMESTAMP_TZ
- || (outcol->data_type == SQLT_TIMESTAMP_TZ)
-#endif
- ) {
- outcol->storage_size4 = 512; /* XXX this should fit "most" NLS date-formats and Numbers */
- } else {
- outcol->storage_size4++; /* add one for string terminator */
- }
- if (outcol->data_type == SQLT_BIN) {
- outcol->storage_size4 *= 3;
- }
- dynamic = OCI_DEFAULT;
- buf = outcol->data = (text *) emalloc(outcol->storage_size4);
- break;
- }
-
- if (dynamic == OCI_DYNAMIC_FETCH) {
- CALL_OCI_RETURN(error, OCIDefineByPos(
- statement->pStmt, /* IN/OUT handle to the requested SQL query */
- (OCIDefine **)&outcol->pDefine, /* IN/OUT pointer to a pointer to a define handle */
- statement->pError, /* IN/OUT An error handle */
- counter, /* IN position in the select list */
- (dvoid *)NULL, /* IN/OUT pointer to a buffer */
- outcol->storage_size4, /* IN The size of each valuep buffer in bytes */
- define_type, /* IN The data type */
- (dvoid *)&outcol->indicator, /* IN pointer to an indicator variable or arr */
- (ub2 *)NULL, /* IN/OUT Pointer to array of length of data fetched */
- (ub2 *)NULL, /* OUT Pointer to array of column-level return codes */
- OCI_DYNAMIC_FETCH)); /* IN mode (OCI_DEFAULT, OCI_DYNAMIC_FETCH) */
-
- statement->error = oci_error(statement->pError, "OCIDefineByPos", error);
- } else {
- CALL_OCI_RETURN(error, OCIDefineByPos(
- statement->pStmt, /* IN/OUT handle to the requested SQL query */
- (OCIDefine **)&outcol->pDefine, /* IN/OUT pointer to a pointer to a define handle */
- statement->pError, /* IN/OUT An error handle */
- counter, /* IN position in the select list */
- (dvoid *)buf, /* IN/OUT pointer to a buffer */
- outcol->storage_size4, /* IN The size of each valuep buffer in bytes */
- define_type, /* IN The data type */
- (dvoid *)&outcol->indicator, /* IN pointer to an indicator variable or arr */
- (ub2 *)&outcol->retlen, /* IN/OUT Pointer to array of length of data fetched */
- (ub2 *)&outcol->retcode, /* OUT Pointer to array of column-level return codes */
- OCI_DEFAULT)); /* IN mode (OCI_DEFAULT, OCI_DYNAMIC_FETCH) */
-
- statement->error = oci_error(statement->pError, "OCIDefineByPos", error);
- }
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we loose memory!!! */
- }
- }
- }
-
- return 1;
-}
-
-/* }}} */
-/* {{{ oci_fetch() */
-
-static int
-_oci_column_pre_fetch(void *data TSRMLS_DC)
-{
- oci_out_column *col = (oci_out_column *) data;
-
- if (col->piecewise) {
- col->retlen4 = 0;
- }
-
- return 0;
-}
-
-
-static int
-oci_fetch(oci_statement *statement, ub4 nrows, char *func TSRMLS_DC)
-{
- int i;
- oci_out_column *column;
-
- if (statement->columns) {
- zend_hash_apply(statement->columns, (apply_func_t) _oci_column_pre_fetch TSRMLS_CC);
- }
-
-
- CALL_OCI_RETURN(statement->error, OCIStmtFetch(
- statement->pStmt,
- statement->pError,
- nrows,
- OCI_FETCH_NEXT,
- OCI_DEFAULT));
-
- if ((statement->error == OCI_NO_DATA) || (nrows == 0)) {
- if (statement->last_query == 0) {
- /* reset define-list for refcursors */
- if (statement->columns) {
- zend_hash_destroy(statement->columns);
- efree(statement->columns);
- statement->columns = 0;
- statement->ncolumns = 0;
- }
- statement->executed = 0;
- }
-
- statement->error = 0; /* OCI_NO_DATA is NO error for us!!! */
- statement->has_data = 0;
-
- return 0;
- }
-
- while (statement->error == OCI_NEED_DATA) {
- for (i = 0; i < statement->ncolumns; i++) {
- column = oci_get_col(statement, i + 1, 0);
- if (column->piecewise) {
- if (! column->data) {
- column->data = (text *) emalloc(OCI_PIECE_SIZE);
- } else {
- column->data = erealloc(column->data,column->retlen4 + OCI_PIECE_SIZE);
- }
-
- column->cb_retlen = OCI_PIECE_SIZE;
-
- CALL_OCI(OCIStmtSetPieceInfo(
- (void *) column->pDefine,
- OCI_HTYPE_DEFINE,
- statement->pError,
- ((char*)column->data) + column->retlen4,
- &(column->cb_retlen),
- OCI_NEXT_PIECE,
- &column->indicator,
- &column->retcode));
- }
- }
-
- CALL_OCI_RETURN(statement->error, OCIStmtFetch(
- statement->pStmt,
- statement->pError,
- nrows,
- OCI_FETCH_NEXT,
- OCI_DEFAULT));
-
- for (i = 0; i < statement->ncolumns; i++) {
- column = oci_get_col(statement, i + 1, 0);
- if (column->piecewise) {
- column->retlen4 += column->cb_retlen;
- }
- }
- }
-
- if (statement->error == OCI_SUCCESS_WITH_INFO || statement->error == OCI_SUCCESS) {
- statement->has_data = 1;
-
- /* do the stuff needed for OCIDefineByName */
- for (i = 0; i < statement->ncolumns; i++) {
- column = oci_get_col(statement, i + 1, 0);
- if (column == NULL) {
- continue;
- }
-
- if (! column->define) {
- continue;
- }
-
- zval_dtor(column->define->zval);
- _oci_make_zval(column->define->zval,statement,column,"OCIFetch",0 TSRMLS_CC);
- }
-
- return 1;
- }
-
- oci_error(statement->pError, func, statement->error);
- oci_handle_error(statement->conn, statement->error);
-
- statement->has_data = 0;
-
- return 0;
-}
-
-/* }}} */
-/* {{{ oci_loadlob() */
-
-#define LOBREADSIZE 1048576l /* 1MB */
-
-static int
-oci_loadlob(oci_connection *connection, oci_descriptor *mydescr, char **buffer,ub4 *loblen)
-{
- ub4 siz = 0;
- ub4 readlen = 0;
- char *buf;
- TSRMLS_FETCH();
-
- *loblen = 0;
-
- if (Z_TYPE_P(mydescr) == OCI_DTYPE_FILE) {
- CALL_OCI_RETURN(connection->error, OCILobFileOpen(
- connection->pServiceContext,
- connection->pError,
- mydescr->ocidescr,
- OCI_FILE_READONLY));
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobFileOpen",connection->error);
- oci_handle_error(connection, connection->error);
- return -1;
- }
- }
-
- CALL_OCI_RETURN(connection->error, OCILobGetLength(
- connection->pServiceContext,
- connection->pError,
- mydescr->ocidescr,
- &readlen));
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobGetLength",connection->error);
- oci_handle_error(connection, connection->error);
- return -1;
- }
-
- buf = emalloc(readlen + 1);
-
- while (readlen > 0) { /* thies loop should not be entered on readlen == 0 */
- CALL_OCI_RETURN(connection->error, OCILobRead(
- connection->pServiceContext,
- connection->pError,
- mydescr->ocidescr,
- &readlen, /* IN/OUT bytes toread/read */
- siz + 1, /* offset (starts with 1) */
- (dvoid *) ((char *) buf + siz),
- readlen, /* size of buffer */
- (dvoid *)0,
- (OCICallbackLobRead) 0, /* callback... */
- (ub2) connection->session->charsetId, /* The character set ID of the buffer data. */
- (ub1) SQLCS_IMPLICIT)); /* The character set form of the buffer data. */
-
- siz += readlen;
- readlen = LOBREADSIZE;
-
- if (connection->error == OCI_NEED_DATA) {
- buf = erealloc(buf,siz + LOBREADSIZE + 1);
- continue;
- } else {
- break;
- }
- }
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobRead", connection->error);
- oci_handle_error(connection, connection->error);
- efree(buf);
- return -1;
- }
-
- if (Z_TYPE_P(mydescr) == OCI_DTYPE_FILE) {
- CALL_OCI_RETURN(connection->error, OCILobFileClose(
- connection->pServiceContext,
- connection->pError,
- mydescr->ocidescr));
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobFileClose", connection->error);
- oci_handle_error(connection, connection->error);
- efree(buf);
- return -1;
- }
- }
-
- buf = erealloc(buf,siz+1);
- buf[ siz ] = 0;
-
- *buffer = buf;
- *loblen = siz;
-
- oci_debug("OCIloadlob: size=%d",siz);
-
- return 0;
-}
-/* }}} */
-/* {{{ oci_failover_callback() */
-#if 0 /* not needed yet ! */
-static sb4
-oci_failover_callback(dvoid *svchp,
- dvoid* envhp,
- dvoid *fo_ctx,
- ub4 fo_type,
- ub4 fo_event)
-{
- /*
- this stuff is from an oci sample - it will get cleaned up as soon as i understand it!!! (thies@thieso.net 990420)
- right now i cant get oracle to even call it;-(((((((((((
- */
-
- switch (fo_event)
- {
- case OCI_FO_BEGIN:
- {
- printf(" Failing Over ... Please stand by \n");
- printf(" Failover type was found to be %s \n",
- ((fo_type==OCI_FO_NONE) ? "NONE"
- :(fo_type==OCI_FO_SESSION) ? "SESSION"
- :(fo_type==OCI_FO_SELECT) ? "SELECT"
- : "UNKNOWN!"));
- printf(" Failover Context is :%s\n",
- (fo_ctx?(char *)fo_ctx:"NULL POINTER!"));
- break;
- }
-
- case OCI_FO_ABORT:
- {
- printf(" Failover aborted. Failover will not take place.\n");
- break;
- }
-
- case OCI_FO_END:
- {
- printf(" Failover ended ...resuming services\n");
- break;
- }
-
- case OCI_FO_REAUTH:
- {
- printf(" Failed over user. Resuming services\n");
-
- /* Application can check the OCI_ATTR_SESSION attribute of
- the service handle to find out the user being
- re-authenticated.
-
- After this, the application can replay any ALTER SESSION
- commands associated with this session. These must have
- been saved by the application in the fo_ctx
- */
- break;
- }
-
-
- case OCI_FO_ERROR:
- {
- printf(" Failover error gotten. Sleeping...\n");
- php_sleep(3);
- /* cannot find this blody define !!! return OCI_FO_RETRY; */
- break;
- }
-
- default:
- {
- printf("Bad Failover Event: %ld.\n", fo_event);
- break;
- }
- }
-
- return 0;
-}
-#endif
-/* }}} */
-/* {{{ oci_bind_in_callback() */
-
-static sb4
-oci_bind_in_callback(dvoid *ictxp, /* context pointer */
- OCIBind *bindp, /* bind handle */
- ub4 iter, /* 0-based execute iteration value */
- ub4 index, /* index of current array for PL/SQL or row index for SQL */
- dvoid **bufpp, /* pointer to data */
- ub4 *alenp, /* size after value/piece has been read */
- ub1 *piecep, /* which piece */
- dvoid **indpp) /* indicator value */
-{
- oci_bind *phpbind;
- zval *val;
- TSRMLS_FETCH();
-
- if (!(phpbind=(oci_bind *)ictxp) || !(val = phpbind->zval)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "!phpbind || !phpbind->val");
- return OCI_ERROR;
- }
-
- if (ZVAL_IS_NULL(val)) {
- /* we're going to insert a NULL column */
- phpbind->indicator = -1;
- *bufpp = 0;
- *alenp = -1;
- *indpp = (dvoid *)&phpbind->indicator;
- } else if ((phpbind->descr == 0) && (phpbind->pStmt == 0)) {
- /* "normal string bind */
- convert_to_string(val);
-
- *bufpp = Z_STRVAL_P(val);
- *alenp = Z_STRLEN_P(val);
- *indpp = (dvoid *)&phpbind->indicator;
- } else if (phpbind->pStmt != 0) {
- /* RSET */
- *bufpp = phpbind->pStmt;
- *alenp = -1; /* seems to be allright */
- *indpp = (dvoid *)&phpbind->indicator;
- } else {
- /* descriptor bind */
- *bufpp = phpbind->descr;
- *alenp = -1; /* seems to be allright */
- *indpp = (dvoid *)&phpbind->indicator;
- }
-
- *piecep = OCI_ONE_PIECE; /* pass all data in one go */
-
- return OCI_CONTINUE;
-}
-
-/* }}} */
-/* {{{ oci_bind_out_callback() */
-
-static sb4
-oci_bind_out_callback(dvoid *octxp, /* context pointer */
- OCIBind *bindp, /* bind handle */
- ub4 iter, /* 0-based execute iteration value */
- ub4 index, /* index of current array for PL/SQL or row index for SQL */
- dvoid **bufpp, /* pointer to data */
- ub4 **alenpp, /* size after value/piece has been read */
- ub1 *piecep, /* which piece */
- dvoid **indpp, /* indicator value */
- ub2 **rcodepp) /* return code */
-{
- oci_bind *phpbind;
- zval *val;
- sb4 retval = OCI_ERROR;
- TSRMLS_FETCH();
-
- if (!(phpbind=(oci_bind *)octxp) || !(val = phpbind->zval)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "!phpbind || !phpbind->val");
- return retval;
- }
-
- if ((Z_TYPE_P(val) == IS_OBJECT) || (Z_TYPE_P(val) == IS_RESOURCE)) {
- retval = OCI_CONTINUE;
- } else {
- convert_to_string(val);
- zval_dtor(val);
-
- Z_STRLEN_P(val) = OCI_PIECE_SIZE; /* 64K-1 is max XXX */
- Z_STRVAL_P(val) = emalloc(Z_STRLEN_P(phpbind->zval));
-
- /* XXX we assume that zend-zval len has 4 bytes */
- *alenpp = (ub4*) &Z_STRLEN_P(phpbind->zval);
- *bufpp = Z_STRVAL_P(phpbind->zval);
- *piecep = OCI_ONE_PIECE;
- *rcodepp = &phpbind->retcode;
- *indpp = &phpbind->indicator;
- retval = OCI_CONTINUE;
- }
-
- return retval;
-}
-
-/* }}} */
-/* {{{ _oci_open_session()
-
- */
-
-static oci_session *_oci_open_session(oci_server* server,char *username,char *password,int persistent,int exclusive,char *charset)
-{
- oci_session *session = 0, *psession = 0;
- OCISvcCtx *svchp = 0;
- char *hashed_details;
-#ifdef HAVE_OCI_9_2
- ub2 charsetid = 0;
-#endif
- TSRMLS_FETCH();
-
- /*
- check if we already have this user authenticated
-
- we will reuse authenticated users within a request no matter if the user requested a persistent
- connections or not!
-
- but only as pesistent requested connections will be kept between requests!
- */
-
- hashed_details = (char *) malloc(strlen(SAFE_STRING(username))+
- strlen(SAFE_STRING(password))+
- strlen(SAFE_STRING(server->dbname))+1);
-
- sprintf(hashed_details,"%s%s%s",
- SAFE_STRING(username),
- SAFE_STRING(password),
- SAFE_STRING(server->dbname));
-
- if (! exclusive) {
- zend_hash_find(OCI(user), hashed_details, strlen(hashed_details)+1, (void **) &session);
-
- if (session) {
- if (session->is_open) {
- if (persistent) {
- session->persistent = 1;
- }
- free(hashed_details);
- return session;
- } else {
- _oci_close_session(session);
- /* breakthru to open */
- }
- }
- }
-
- session = calloc(1,sizeof(oci_session));
-
- if (! session) {
- goto CLEANUP;
- }
-
- session->persistent = persistent;
- session->hashed_details = hashed_details;
- session->server = server;
- session->exclusive = exclusive;
-
-#ifdef HAVE_OCI_9_2
-
- /* following chunk is Oracle 9i+ ONLY */
- if (*charset) {
- /*
- get ub2 charset id based on charset
- this is pretty secure, since if we don't have a valid character set name,
- 0 comes back and we can still use the 0 in all further statements -> OCI uses NLS_LANG
- setting in that case
- */
- CALL_OCI_RETURN(charsetid, OCINlsCharSetNameToId(
- OCI(pEnv),
- charset));
-
- oci_debug("oci_do_connect: using charset id=%d",charsetid);
- }
-
- session->charsetId = charsetid;
-
- /* create an environment using the character set id, Oracle 9i+ ONLY */
- CALL_OCI(OCIEnvNlsCreate(
- &session->pEnv,
- OCI_DEFAULT,
- 0,
- NULL,
- NULL,
- NULL,
- 0,
- NULL,
- charsetid,
- charsetid));
-
-#else
-
- /* fallback solution (simply use global env and charset, same behaviour as always been) */
- session->pEnv = OCI(pEnv);
- session->charsetId = 0;
-
-#endif /* HAVE_OCI_9_2 */
-
- /* allocate temporary Service Context */
- CALL_OCI_RETURN(OCI(error), OCIHandleAlloc(
- session->pEnv,
- (dvoid **)&svchp,
- OCI_HTYPE_SVCCTX,
- 0,
- NULL));
-
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "_oci_open_session: OCIHandleAlloc OCI_HTYPE_SVCCTX", OCI(error));
- goto CLEANUP;
- }
-
- /* allocate private session-handle */
- CALL_OCI_RETURN(OCI(error), OCIHandleAlloc(
- session->pEnv,
- (dvoid **)&session->pSession,
- OCI_HTYPE_SESSION,
- 0,
- NULL));
-
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "_oci_open_session: OCIHandleAlloc OCI_HTYPE_SESSION", OCI(error));
- goto CLEANUP;
- }
-
- /* Set the server handle in service handle */
- CALL_OCI_RETURN(OCI(error), OCIAttrSet(
- svchp,
- OCI_HTYPE_SVCCTX,
- server->pServer,
- 0,
- OCI_ATTR_SERVER,
- OCI(pError)));
-
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "_oci_open_session: OCIAttrSet OCI_ATTR_SERVER", OCI(error));
- goto CLEANUP;
- }
-
- /* set the username in user handle */
- CALL_OCI_RETURN(OCI(error), OCIAttrSet(
- (dvoid *) session->pSession,
- (ub4) OCI_HTYPE_SESSION,
- (dvoid *) username,
- (ub4) strlen(username),
- (ub4) OCI_ATTR_USERNAME,
- OCI(pError)));
-
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "OCIAttrSet OCI_ATTR_USERNAME", OCI(error));
- goto CLEANUP;
- }
-
- /* set the password in user handle */
- CALL_OCI_RETURN(OCI(error), OCIAttrSet(
- (dvoid *) session->pSession,
- (ub4) OCI_HTYPE_SESSION,
- (dvoid *) password,
- (ub4) strlen(password),
- (ub4) OCI_ATTR_PASSWORD,
- OCI(pError)));
-
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "OCIAttrSet OCI_ATTR_PASSWORD", OCI(error));
- goto CLEANUP;
- }
-
- CALL_OCI_RETURN(OCI(error), OCISessionBegin(
- svchp,
- OCI(pError),
- session->pSession,
- (ub4) OCI_CRED_RDBMS,
- (ub4) OCI_DEFAULT));
-
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "OCISessionBegin", OCI(error));
- goto CLEANUP;
- }
-
- /* Free Temporary Service Context */
- CALL_OCI(OCIHandleFree(
- (dvoid *) svchp,
- (ub4) OCI_HTYPE_SVCCTX));
-
- if (exclusive) {
- psession = session;
- } else {
- zend_hash_update(OCI(user),
- session->hashed_details,
- strlen(session->hashed_details)+1,
- (void *)session,
- sizeof(oci_session),
- (void**)&psession);
- }
-
- psession->num = zend_list_insert(psession,le_session);
- psession->is_open = 1;
-
- oci_debug("_oci_open_session new sess=%d user=%s",psession->num,username);
-
- if (! exclusive) free(session);
-
- return psession;
-
-CLEANUP:
- oci_debug("_oci_open_session: FAILURE -> CLEANUP called");
-
- _oci_close_session(session);
-
- return 0;
-}
-
-/* }}} */
-/* {{{ _oci_close_session()
- */
-
-static void
-_oci_close_session(oci_session *session)
-{
- OCISvcCtx *svchp;
- char *hashed_details;
- TSRMLS_FETCH();
-
- if (! session) {
- return;
- }
-
- oci_debug("START _oci_close_session: logging-off sess=%d",session->num);
-
- if (session->is_open) {
- /* Temporary Service Context */
- CALL_OCI_RETURN(OCI(error), OCIHandleAlloc(
- session->pEnv,
- (dvoid **) &svchp,
- (ub4) OCI_HTYPE_SVCCTX,
- (size_t) 0,
- (dvoid **) 0));
-
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "_oci_close_session OCIHandleAlloc OCI_HTYPE_SVCCTX", OCI(error));
- }
-
- /* Set the server handle in service handle */
- CALL_OCI_RETURN(OCI(error), OCIAttrSet(
- svchp,
- OCI_HTYPE_SVCCTX,
- session->server->pServer,
- 0,
- OCI_ATTR_SERVER,
- OCI(pError)));
-
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "_oci_close_session: OCIAttrSet OCI_ATTR_SERVER", OCI(error));
- }
-
- /* Set the Authentication handle in the service handle */
- CALL_OCI_RETURN(OCI(error), OCIAttrSet(
- svchp,
- OCI_HTYPE_SVCCTX,
- session->pSession,
- 0,
- OCI_ATTR_SESSION,
- OCI(pError)));
-
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "_oci_close_session: OCIAttrSet OCI_ATTR_SESSION", OCI(error));
- }
-
- CALL_OCI_RETURN(OCI(error), OCISessionEnd(
- svchp,
- OCI(pError),
- session->pSession,
- (ub4) 0));
-
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "_oci_close_session: OCISessionEnd", OCI(error));
- }
-
- CALL_OCI(OCIHandleFree(
- (dvoid *) svchp,
- (ub4) OCI_HTYPE_SVCCTX));
-
- } else {
- oci_debug("_oci_close_session: logging-off DEAD session");
- }
-
- if (session->pSession) {
- CALL_OCI(OCIHandleFree(
- (dvoid *) session->pSession,
- (ub4) OCI_HTYPE_SESSION));
- }
-
- hashed_details = session->hashed_details;
-
- if (! OCI(shutdown)) {
- zend_hash_del(OCI(user), hashed_details, strlen(hashed_details)+1);
- }
-
- free(hashed_details);
-}
-
-/* }}} */
-/* {{{ _oci_open_server()
- */
-
-static oci_server *_oci_open_server(char *dbname,int persistent)
-{
- oci_server *server, *pserver = 0;
- TSRMLS_FETCH();
-
- /*
- check if we already have this server open
-
- we will reuse servers within a request no matter if the user requested persistent
- connections or not!
-
- but only as pesistent requested connections will be kept between requests!
- */
-
- zend_hash_find(OCI(server), dbname, strlen(dbname)+1, (void **) &pserver);
-
- if (pserver) {
- /* XXX ini-flag */
- /*
- if (! oci_ping(pserver)) {
- pserver->is_open = 0;
- }
- */
- if (pserver->is_open) {
- /* if our new users uses this connection persistent, we're keeping it! */
- if (persistent) {
- pserver->persistent = persistent;
- }
-
- return pserver;
- } else { /* server "died" in the meantime - try to reconnect! */
- _oci_close_server(pserver);
- /* breakthru to open */
- }
- }
-
- server = calloc(1,sizeof(oci_server));
-
- server->persistent = persistent;
- server->dbname = strdup(SAFE_STRING(dbname));
-
- CALL_OCI(OCIHandleAlloc(
- OCI(pEnv),
- (dvoid **)&server->pServer,
- OCI_HTYPE_SERVER,
- 0,
- NULL));
-
- CALL_OCI_RETURN(OCI(error), OCIServerAttach(
- server->pServer,
- OCI(pError),
- (text*)server->dbname,
- strlen(server->dbname),
- (ub4) OCI_DEFAULT));
-
- if (OCI(error)) {
- oci_error(OCI(pError), "_oci_open_server", OCI(error));
- goto CLEANUP;
- }
-
- zend_hash_update(OCI(server),
- server->dbname,
- strlen(server->dbname)+1,
- (void *)server,
- sizeof(oci_server),
- (void**)&pserver);
-
- pserver->num = zend_list_insert(pserver,le_server);
- pserver->is_open = 1;
-
- oci_debug("_oci_open_server new conn=%d dname=%s",server->num,server->dbname);
-
- free(server);
-
- return pserver;
-
-CLEANUP:
- oci_debug("_oci_open_server: FAILURE -> CLEANUP called");
-
- _oci_close_server(server);
-
- return 0;
-}
-
-#if 0
- server->failover.fo_ctx = (dvoid *) server;
- server->failover.callback_function = oci_failover_callback;
-
- error = OCIAttrSet((dvoid *)server->pServer,
- (ub4) OCI_HTYPE_SERVER,
- (dvoid *) &server->failover,
- (ub4) 0,
- (ub4) OCI_ATTR_FOCBK,
- OCI(pError));
-
- if (error) {
- oci_error(OCI(pError), "_oci_open_server OCIAttrSet OCI_ATTR_FOCBK", error);
- goto CLEANUP;
- }
-#endif
-
-
-/* }}} */
-/* {{{ _oci_close_server()
- */
-
-static int _oci_session_cleanup(void *data TSRMLS_DC)
-{
- list_entry *le = (list_entry *) data;
- if (Z_TYPE_P(le) == le_session) {
- oci_server *server = ((oci_session*) le->ptr)->server;
- if (server->is_open == 2)
- return 1;
- }
- return 0;
-}
-
-
-static void
-_oci_close_server(oci_server *server)
-{
- char *dbname;
- int oldopen;
- TSRMLS_FETCH();
-
- oldopen = server->is_open;
- server->is_open = 2;
- if (! OCI(shutdown)) {
- zend_hash_apply(&EG(regular_list), (apply_func_t) _oci_session_cleanup TSRMLS_CC);
- }
- server->is_open = oldopen;
-
- oci_debug("START _oci_close_server: detaching conn=%d dbname=%s",server->num,server->dbname);
-
- /* XXX close server here */
-
- if (server->is_open) {
- if (server->pServer && OCI(pError)) {
- CALL_OCI_RETURN(
- OCI(error),
- OCIServerDetach(server->pServer,
- OCI(pError),
- OCI_DEFAULT));
-
- if (OCI(error)) {
- oci_error(OCI(pError), "oci_close_server OCIServerDetach", OCI(error));
- }
- }
- } else {
- oci_debug("_oci_close_server: closing DEAD server");
- }
-
- if (server->pServer) {
- CALL_OCI(OCIHandleFree(
- (dvoid *) server->pServer,
- (ub4) OCI_HTYPE_SERVER));
- }
-
- dbname = server->dbname;
-
- if (! OCI(shutdown)) {
- zend_hash_del(OCI(server),dbname,strlen(dbname)+1);
- }
-
- free(dbname);
-}
-
-/* }}} */
-/* {{{ oci_do_connect()
- Connect to an Oracle database and log on. returns a new session.
- */
-static void oci_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent,int exclusive)
-{
- char *username, *password, *dbname, *charset;
- zval **userParam, **passParam, **dbParam, **charParam;
- oci_server *server = 0;
- oci_session *session = 0;
- oci_connection *connection = 0;
-
- /* if a forth parameter is handed over, it is the charset identifier (but is only used in Oracle 9i+) */
- if (zend_get_parameters_ex(4, &userParam, &passParam, &dbParam, &charParam) == SUCCESS) {
- convert_to_string_ex(userParam);
- convert_to_string_ex(passParam);
- convert_to_string_ex(dbParam);
- convert_to_string_ex(charParam);
-
- username = Z_STRVAL_PP(userParam);
- password = Z_STRVAL_PP(passParam);
- dbname = Z_STRVAL_PP(dbParam);
- charset = Z_STRVAL_PP(charParam);
- oci_debug("oci_do_connect: using charset=%s",charset);
- } else if (zend_get_parameters_ex(3, &userParam, &passParam, &dbParam) == SUCCESS) {
- convert_to_string_ex(userParam);
- convert_to_string_ex(passParam);
- convert_to_string_ex(dbParam);
-
- username = Z_STRVAL_PP(userParam);
- password = Z_STRVAL_PP(passParam);
- dbname = Z_STRVAL_PP(dbParam);
- charset = "";
- } else if (zend_get_parameters_ex(2, &userParam, &passParam) == SUCCESS) {
- convert_to_string_ex(userParam);
- convert_to_string_ex(passParam);
-
- username = Z_STRVAL_PP(userParam);
- password = Z_STRVAL_PP(passParam);
- dbname = "";
- charset = "";
- } else {
- WRONG_PARAM_COUNT;
- }
-
- connection = (oci_connection *) ecalloc(1,sizeof(oci_connection));
-
- if (! connection) {
- goto CLEANUP;
- }
-
- server = _oci_open_server(dbname,persistent);
-
- if (! server) {
- goto CLEANUP;
- }
-
- if (exclusive) {
- /* exlusive session can never be persistent!*/
- persistent = 0;
- } else {
- /* if our server-context is not persistent we can't */
- persistent = server->persistent;
- }
-
- session = _oci_open_session(server,username,password,persistent,exclusive,charset);
-
- if (! session) {
- goto CLEANUP;
- }
-
- /* set our session */
- connection->session = session;
-
- /* allocate our private error-handle */
- CALL_OCI_RETURN(OCI(error), OCIHandleAlloc(
- connection->session->pEnv,
- (dvoid **)&connection->pError,
- OCI_HTYPE_ERROR,
- 0,
- NULL));
-
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "oci_do_connect: OCIHandleAlloc OCI_HTYPE_ERROR",OCI(error));
- goto CLEANUP;
- }
-
- /* allocate our service-context */
- CALL_OCI_RETURN(OCI(error), OCIHandleAlloc(
- connection->session->pEnv,
- (dvoid **)&connection->pServiceContext,
- OCI_HTYPE_SVCCTX,
- 0,
- NULL));
-
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "oci_do_connect: OCIHandleAlloc OCI_HTYPE_SVCCTX",OCI(error));
- goto CLEANUP;
- }
-
- /* Set the server handle in service handle */
- CALL_OCI_RETURN(connection->error, OCIAttrSet(
- connection->pServiceContext,
- OCI_HTYPE_SVCCTX,
- server->pServer,
- 0,
- OCI_ATTR_SERVER,
- connection->pError));
-
- if (connection->error != OCI_SUCCESS) {
- oci_error(connection->pError, "oci_do_connect: OCIAttrSet OCI_ATTR_SERVER", connection->error);
- goto CLEANUP;
- }
-
- /* Set the Authentication handle in the service handle */
- CALL_OCI_RETURN(connection->error, OCIAttrSet(
- connection->pServiceContext,
- OCI_HTYPE_SVCCTX,
- session->pSession,
- 0,
- OCI_ATTR_SESSION,
- connection->pError));
-
- if (connection->error != OCI_SUCCESS) {
- oci_error(connection->pError, "oci_do_connect: OCIAttrSet OCI_ATTR_SESSION", connection->error);
- goto CLEANUP;
- }
-
- /*
- OCIAttrSet((dvoid *)session->server->pServer,
- OCI_HTYPE_SERVER,
- (dvoid *) "demo",
- 0,
- OCI_ATTR_EXTERNAL_NAME,
- connection->pError);
-
- OCIAttrSet((dvoid *)session->server->pServer,
- OCI_HTYPE_SERVER,
- (dvoid *) "txn demo2",
- 0,
- OCI_ATTR_INTERNAL_NAME,
- connection->pError);
- */
-
- connection->id = zend_list_insert(connection, le_conn);
-
- connection->is_open = 1;
-
- oci_debug("oci_do_connect: id=%d",connection->id);
-
- RETURN_RESOURCE(connection->id);
-
-CLEANUP:
- oci_debug("oci_do_connect: FAILURE -> CLEANUP called");
-
- if (connection->id) {
- zend_list_delete(connection->id);
- } else {
- _oci_conn_list_dtor(connection TSRMLS_CC);
- }
-
- RETURN_FALSE;
-}
-
-/* }}} */
-
-/************************* EXTENSION FUNCTIONS *************************/
-
-/* {{{ proto bool ocidefinebyname(int stmt, string name, mixed &var [, int type])
- Define a PHP variable to an Oracle column by name */
-/* if you want to define a LOB/CLOB etc make sure you allocate it via OCINewDescriptor BEFORE defining!!!
- */
-
-PHP_FUNCTION(ocidefinebyname)
-{
- zval **stmt, **name, **var, **type;
- oci_statement *statement;
- oci_define *define, *tmp_define;
- ub2 ocitype = SQLT_CHR; /* zero terminated string */
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 3 || ac > 4 || zend_get_parameters_ex(ac, &stmt, &name, &var, &type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (ac) {
- case 4:
- convert_to_long_ex(type);
- ocitype = (ub2) Z_LVAL_PP(type);
- /* possible breakthru */
- }
-
- OCI_GET_STMT(statement,stmt);
-
- convert_to_string_ex(name);
-
- if (statement->defines == NULL) {
- ALLOC_HASHTABLE(statement->defines);
- zend_hash_init(statement->defines, 13, NULL, _oci_define_hash_dtor, 0);
- }
-
- define = ecalloc(1,sizeof(oci_define));
-
- if (zend_hash_add(statement->defines,
- Z_STRVAL_PP(name),
- Z_STRLEN_PP(name),
- define,
- sizeof(oci_define),
- (void **)&tmp_define) == SUCCESS) {
- efree(define);
- define = tmp_define;
- } else {
- efree(define);
- RETURN_FALSE;
- }
-
- define->name = (text*) estrndup(Z_STRVAL_PP(name),Z_STRLEN_PP(name));
- define->name_len = Z_STRLEN_PP(name);
- Z_TYPE_P(define) = ocitype;
- define->zval = *var;
- zval_add_ref(var);
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto bool ocibindbyname(int stmt, string name, mixed &var, [, int maxlength] [, int type])
- Bind a PHP variable to an Oracle placeholder by name */
-/* if you want to bind a LOB/CLOB etc make sure you allocate it via OCINewDescriptor BEFORE binding!!!
- */
-
-PHP_FUNCTION(ocibindbyname)
-{
- zval **stmt, **name, **var, **maxlen, **type;
- oci_statement *statement;
- oci_statement *bindstmt;
- oci_bind bind, *bindp;
- oci_descriptor *descr;
-#ifdef WITH_COLLECTIONS
- oci_collection *coll;
- dvoid *mycoll = 0;
-#endif
- int mode = OCI_DATA_AT_EXEC;
- ub2 ocitype = SQLT_CHR; /* unterminated string */
- OCIStmt *mystmt = 0;
- dvoid *mydescr = 0;
- sb4 value_sz = -1;
- int ac = ZEND_NUM_ARGS(), inx;
-
- if (ac < 3 || ac > 5 || zend_get_parameters_ex(ac, &stmt, &name, &var, &maxlen, &type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (ac) {
- case 5:
- convert_to_long_ex(type);
- ocitype = (ub2) Z_LVAL_PP(type);
- /* possible breakthru */
- case 4:
- convert_to_long_ex(maxlen);
- value_sz = Z_LVAL_PP(maxlen);
- /* possible breakthru */
- }
-
- OCI_GET_STMT(statement,stmt);
-
- switch (ocitype) {
-#ifdef WITH_COLLECTIONS
- case SQLT_NTY:
- if(Z_TYPE_PP(var) != IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variable must be allocated using OCINewCollection()");
- RETURN_FALSE;
- }
- if ((inx = _oci_get_ocicoll(*var,&coll TSRMLS_CC)) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variable must be allocated using OCINewCollection()");
- RETURN_FALSE;
- }
- if (! (mycoll = (dvoid *) coll->coll)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Collection empty");
- RETURN_FALSE;
- }
- value_sz = sizeof(void*);
- mode = OCI_DEFAULT;
-break;
-#endif
- case SQLT_BFILEE:
- case SQLT_CFILEE:
- case SQLT_CLOB:
- case SQLT_BLOB:
- case SQLT_RDD:
- if (Z_TYPE_PP(var) != IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variable must be allocated using OCINewDescriptor()");
- RETURN_FALSE;
- }
-
- if ((inx = _oci_get_ocidesc(*var,&descr TSRMLS_CC)) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variable must be allocated using OCINewDescriptor()");
- RETURN_FALSE;
- }
-
- if (! (mydescr = (dvoid *) descr->ocidescr)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Descriptor empty");
- RETURN_FALSE;
- }
- value_sz = sizeof(void*);
- break;
-
- case SQLT_RSET:
- OCI_GET_STMT(bindstmt,var);
-
- if (! (mystmt = bindstmt->pStmt)) {
- RETURN_FALSE;
- }
- value_sz = sizeof(void*);
- break;
- }
-
- if ((ocitype == SQLT_CHR) && (value_sz == -1)) {
- convert_to_string_ex(var);
- value_sz = Z_STRLEN_PP(var);
- }
-
- if (value_sz == 0) {
- value_sz = 1;
- }
-
- convert_to_string_ex(name);
-
- if (! statement->binds) {
- ALLOC_HASHTABLE(statement->binds);
- zend_hash_init(statement->binds, 13, NULL, _oci_bind_hash_dtor, 0);
- }
-
- memset((void*)&bind,0,sizeof(oci_bind));
- zend_hash_next_index_insert(statement->binds,&bind,sizeof(oci_bind),(void **)&bindp);
-
- bindp->descr = mydescr;
- bindp->pStmt = mystmt;
- bindp->zval = *var;
- zval_add_ref(var);
-
- CALL_OCI_RETURN(statement->error, OCIBindByName(
- statement->pStmt, /* statement handle */
- (OCIBind **)&bindp->pBind, /* bind hdl (will alloc) */
- statement->pError, /* error handle */
- (text*) Z_STRVAL_PP(name), /* placeholder name */
- Z_STRLEN_PP(name), /* placeholder length */
- (dvoid *)0, /* in/out data */
- value_sz, /* OCI_MAX_DATA_SIZE, */ /* max size of input/output data */
- (ub2)ocitype, /* in/out data type */
- (dvoid *)&bindp->indicator, /* indicator (ignored) */
- (ub2 *)0, /* size array (ignored) */
- (ub2 *)&bindp->retcode, /* return code (ignored) */
- (ub4)0, /* maxarr_len (PL/SQL only?) */
- (ub4 *)0, /* actual array size (PL/SQL only?) */
- mode /* mode */
- ));
-
- if (statement->error != OCI_SUCCESS) {
- oci_error(statement->pError, "OCIBindByName", statement->error);
- oci_handle_error(statement->conn, statement->error);
- RETURN_FALSE;
- }
-
- if (mode == OCI_DATA_AT_EXEC) {
- CALL_OCI_RETURN(statement->error, OCIBindDynamic(
- bindp->pBind,
- statement->pError,
- (dvoid *)bindp,
- oci_bind_in_callback,
- (dvoid *)bindp,
- oci_bind_out_callback));
-
- if (statement->error != OCI_SUCCESS) {
- oci_error(statement->pError, "OCIBindDynamic", statement->error);
- oci_handle_error(statement->conn, statement->error);
- RETURN_FALSE;
- }
- }
-
-#ifdef WITH_COLLECTIONS
- if (ocitype == SQLT_NTY) {
- /* Bind object */
- CALL_OCI_RETURN(statement->error, OCIBindObject(
- bindp->pBind,
- statement->pError,
- coll->tdo,
- (dvoid **) &(coll->coll),
- (ub4 *) 0,
- (dvoid **) 0,
- (ub4 *) 0));
-
- if (statement->error) {
- oci_error(statement->pError, "OCIBindObject", statement->error);
- RETURN_FALSE;
- }
- }
-#endif
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto bool ocifreedesc(object lob)
- Deletes large object description */
-
-PHP_FUNCTION(ocifreedesc)
-{
- zval *id;
- int inx;
- oci_descriptor *descriptor;
-
- if ((id = getThis()) != 0) {
- inx = _oci_get_ocidesc(id,&descriptor TSRMLS_CC);
- if (inx) {
- oci_debug("OCIfreedesc: descr=%d",inx);
- zend_list_delete(inx);
- RETURN_TRUE;
- }
- }
-
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "OCIFreeDesc() should not be called like this. Use $somelob->free() to free a LOB");
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool ocisavelob(object lob)
- Saves a large object */
-
-PHP_FUNCTION(ocisavelob)
-{
- zval *id, **arg,**oarg;
- OCILobLocator *mylob;
- oci_connection *connection;
- oci_descriptor *descr;
- int offparam,inx;
- ub4 loblen;
- ub4 curloblen;
- ub4 offset;
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocidesc(id,&descr TSRMLS_CC)) == 0) {
- RETURN_FALSE;
- }
-
- mylob = (OCILobLocator *) descr->ocidescr;
-
- if (! mylob) {
- RETURN_FALSE;
- }
-
- connection = descr->conn;
-
- offset = 0;
- if (zend_get_parameters_ex(2, &arg, &oarg) == SUCCESS) {
- convert_to_long_ex(oarg);
- offparam = Z_LVAL_PP(oarg);
-
- CALL_OCI_RETURN(connection->error, OCILobGetLength(
- connection->pServiceContext,
- connection->pError,
- mylob,
- &curloblen));
-
- oci_debug("OCIsavedesc: curloblen=%d",curloblen);
-
- if (offparam == -1) {
- offset = curloblen;
- } else if ((ub4) offparam >= curloblen) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset smaller than current LOB-Size - appending");
- offset = curloblen;
- } else {
- offset = offparam;
- }
- } else if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- offset++;
- convert_to_string_ex(arg);
- loblen = Z_STRLEN_PP(arg);
-
- if (loblen < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot save a lob which size is less than 1 byte");
- RETURN_FALSE;
- }
-
- CALL_OCI_RETURN(connection->error, OCILobWrite(
- connection->pServiceContext,
- connection->pError,
- mylob,
- &loblen,
- (ub4) offset,
- (dvoid *) Z_STRVAL_PP(arg),
- (ub4) loblen,
- OCI_ONE_PIECE,
- (dvoid *)0,
- (OCICallbackLobWrite) 0,
- (ub2) 0,
- (ub1) SQLCS_IMPLICIT));
-
- oci_debug("OCIsavedesc: size=%d offset=%d",loblen,offset);
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobWrite", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-
-/* }}} */
-
-/* {{{ proto bool ocisavelobfile(object lob)
- Saves a large object file */
-
-PHP_FUNCTION(ocisavelobfile)
-{
- zval *id, **arg;
- OCILobLocator *mylob;
- oci_connection *connection;
- oci_descriptor *descr;
- char *filename;
- int fp,inx;
- char buf[8192];
- ub4 offset = 1;
- ub4 loblen;
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocidesc(id,&descr TSRMLS_CC)) == 0) {
- RETURN_FALSE;
- }
-
- mylob = (OCILobLocator *) descr->ocidescr;
-
- if (! mylob) {
- RETURN_FALSE;
- }
-
- connection = descr->conn;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg);
-
- if (php_check_open_basedir(Z_STRVAL_PP(arg) TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- filename = Z_STRVAL_PP(arg);
-
- if ((fp = VCWD_OPEN(filename, O_RDONLY|O_BINARY)) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't open file %s", filename);
- RETURN_FALSE;
- }
-
- while ((loblen = read(fp, &buf, sizeof(buf))) > 0) {
- CALL_OCI_RETURN(connection->error, OCILobWrite(
- connection->pServiceContext,
- connection->pError,
- mylob,
- &loblen,
- (ub4) offset,
- (dvoid *) &buf,
- (ub4) loblen,
- OCI_ONE_PIECE,
- (dvoid *)0,
- (OCICallbackLobWrite) 0,
- (ub2) 0,
- (ub1) SQLCS_IMPLICIT));
-
- oci_debug("OCIsavelob: size=%d",loblen);
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobWrite", connection->error);
- oci_handle_error(connection, connection->error);
- close(fp);
- RETURN_FALSE;
- }
-
- offset += loblen;
- }
- close(fp);
-
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-
-/* }}} */
-
-/* {{{ proto string ociloadlob(object lob)
- Loads a large object */
-
-PHP_FUNCTION(ociloadlob)
-{
- zval *id;
- oci_descriptor *descr;
- char *buffer;
- int inx;
- ub4 loblen;
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocidesc(id,&descr TSRMLS_CC)) == 0) {
- RETURN_FALSE;
- }
-
- if (!oci_loadlob(descr->conn,descr,&buffer,&loblen)) {
- RETURN_STRINGL(buffer,loblen,0);
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool ociwritelobtofile(object lob [, string filename] [, int start] [, int length])
- Writes a large object into a file */
-
-PHP_FUNCTION(ociwritelobtofile)
-{
- zval *id, **zfilename, **zstart, **zlength;
- char *filename = NULL;
- int start = -1;
- ub4 length = -1;
- oci_connection *connection;
- oci_descriptor *descr;
- char *buffer=0;
- ub4 loblen;
- int ac = ZEND_NUM_ARGS();
- int fp = -1,inx;
- OCILobLocator *mylob;
- int coffs;
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocidesc(id,&descr TSRMLS_CC)) == 0) {
- RETURN_FALSE;
- }
-
- mylob = (OCILobLocator *) descr->ocidescr;
-
- if (! mylob) {
- RETURN_FALSE;
- }
-
- connection = descr->conn;
-
- if (ac < 0 || ac > 3 || zend_get_parameters_ex(ac, &zfilename, &zstart, &zlength) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (ac) {
- case 3:
- convert_to_long_ex(zlength);
- length = Z_LVAL_PP(zlength);
- case 2:
- convert_to_long_ex(zstart);
- start = Z_LVAL_PP(zstart);
- case 1:
- convert_to_string_ex(zfilename);
- filename = Z_STRVAL_PP(zfilename);
- }
-
- if (filename && *filename) {
- if (php_check_open_basedir(filename TSRMLS_CC)) {
- goto bail;
- }
-
- if ((fp = VCWD_OPEN_MODE(filename,O_CREAT | O_RDWR | O_BINARY | O_TRUNC, 0600)) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create file %s", filename);
- goto bail;
- }
- }
-
- CALL_OCI_RETURN(connection->error, OCILobGetLength(
- connection->pServiceContext,
- connection->pError,
- descr->ocidescr,
- &loblen));
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobGetLength", connection->error);
- oci_handle_error(connection, connection->error);
- goto bail;
- }
-
- if (Z_TYPE_P(descr) == OCI_DTYPE_FILE) {
- CALL_OCI_RETURN(connection->error, OCILobFileOpen(
- connection->pServiceContext,
- connection->pError,
- descr->ocidescr,
- OCI_FILE_READONLY));
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobFileOpen",connection->error);
- oci_handle_error(connection, connection->error);
- goto bail;
- }
- }
-
- if (start == -1) {
- start = 0;
- }
-
- if (length == -1) {
- length = loblen - start;
- }
-
- if ((start + length) > loblen) {
- length = loblen - start;
- }
-
-#define OCI_LOB_READ_BUFFER 128*1024
-
- buffer = emalloc(OCI_LOB_READ_BUFFER);
-
- coffs = start;
-
- oci_debug("ociwritelobtofile(start = %d, length = %d, loblen = %d",start,length,loblen);
-
- while (length > 0) {
- ub4 toread;
-
- if (length > OCI_LOB_READ_BUFFER) {
- toread = OCI_LOB_READ_BUFFER;
- } else {
- toread = length;
- }
-
- oci_debug("OCILobRead(coffs = %d, toread = %d",coffs,toread);
-
- CALL_OCI_RETURN(connection->error, OCILobRead(
- connection->pServiceContext,
- connection->pError,
- descr->ocidescr,
- &toread, /* IN/OUT bytes toread/read */
- coffs+1, /* offset (starts with 1) */
- (dvoid *) buffer,
- toread, /* size of buffer */
- (dvoid *)0,
- (OCICallbackLobRead) 0, /* callback... */
- (ub2) 0, /* The character set ID of the buffer data. */
- (ub1) SQLCS_IMPLICIT)); /* The character set form of the buffer data. */
-
- oci_debug("OCILobRead(read - %d",toread);
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobRead", connection->error);
- oci_handle_error(connection, connection->error);
- goto bail;
- }
-
- if (fp != -1) {
- if ((ub4) write(fp,buffer,toread) != toread) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot write file!");
- goto bail;
- }
- } else {
- PHPWRITE(buffer,toread);
- }
-
- length -= toread;
- coffs += toread;
- }
-
- efree(buffer);
- buffer = 0;
-
- if (fp != -1) {
- close(fp);
- fp = 0;
- }
-
- if (Z_TYPE_P(descr) == OCI_DTYPE_FILE) {
- CALL_OCI_RETURN(connection->error,OCILobFileClose(
- connection->pServiceContext,
- connection->pError,
- descr->ocidescr));
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobFileClose", connection->error);
- oci_handle_error(connection, connection->error);
- goto bail;
- }
- }
- RETURN_TRUE;
- }
-
-bail:
- if (fp != -1) {
- close(fp);
- }
-
- if (buffer) {
- efree(buffer);
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-#ifdef HAVE_OCI8_TEMP_LOB
-/* {{{ proto bool ociwritetemporarylob(int stmt, int loc, string var)
- Return the row count of an OCI statement */
-
-PHP_FUNCTION(ociwritetemporarylob)
-{
- zval *id, **var;
- OCILobLocator *mylob;
- oci_connection *connection;
- oci_descriptor *descr;
- ub4 offset = 1;
- ub4 loblen;
-
- oci_debug ("oci_write_temporary_lob");
-
- if ((id = getThis()) == 0) {
- RETURN_FALSE;
- }
-
- if (_oci_get_ocidesc(id,&descr TSRMLS_CC) == 0) {
- RETURN_FALSE;
- }
-
- mylob = (OCILobLocator *) descr->ocidescr;
-
- if (! mylob) {
- RETURN_FALSE;
- }
-
- connection = descr->conn;
-
- if (zend_get_parameters_ex(1, &var) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(var);
-
- CALL_OCI_RETURN(connection->error, OCILobCreateTemporary(
- connection->pServiceContext,
- connection->pError,
- mylob,
- OCI_DEFAULT,
- OCI_DEFAULT,
- OCI_TEMP_CLOB,
- OCI_ATTR_NOCACHE,
- OCI_DURATION_SESSION));
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobCreateTemporary", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- CALL_OCI_RETURN(connection->error, OCILobOpen(
- connection->pServiceContext,
- connection->pError,
- mylob,
- OCI_LOB_READWRITE));
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobOpen", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- convert_to_string_ex(var);
- loblen = Z_STRLEN_PP(var);
-
- if (loblen < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot save a lob that is less than 1 byte");
- RETURN_FALSE;
- }
-
- CALL_OCI_RETURN(connection->error, OCILobWrite(
- connection->pServiceContext,
- connection->pError,
- mylob,
- (ub4 *) &loblen,
- (ub4) offset,
- (dvoid *) Z_STRVAL_PP(var),
- (ub4) loblen,
- OCI_ONE_PIECE,
- (dvoid *)0,
- (sb4 (*)(dvoid *, dvoid *, ub4 *, ub1 *)) 0,
- (ub2) 0,
- (ub1) SQLCS_IMPLICIT));
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobWrite", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto bool ocicloselob(object lob)
- Closes lob descriptor */
-
-PHP_FUNCTION(ocicloselob)
-{
- zval *id;
- int inx;
- OCILobLocator *mylob;
- oci_connection *connection;
- oci_descriptor *descriptor;
- int is_temporary;
-
- if ((id = getThis()) != 0) {
- inx = _oci_get_ocidesc(id,&descriptor TSRMLS_CC);
- if (inx) {
-
- mylob = (OCILobLocator *) descriptor->ocidescr;
-
- if (! mylob) {
- RETURN_FALSE;
- }
-
- connection = descriptor->conn;
-
- CALL_OCI_RETURN(connection->error, OCILobClose(
- connection->pServiceContext,
- connection->pError,
- mylob));
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobClose", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- connection->error =
- OCILobIsTemporary(connection->session->pEnv,
- connection->pError,
- mylob,
- &is_temporary);
- if (is_temporary) {
- connection->error =
- OCILobFreeTemporary(connection->pServiceContext,
- connection->pError,
- mylob);
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobFreeTemporary",
- connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
- oci_debug("oci_lob_free_temporary: descr=%d",inx);
- }
-
- oci_debug("oci_close_lob: descr=%d",inx);
- RETURN_TRUE;
- }
- }
-
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "OCICloselob() should not be called like this. Use $somelob->close() to close a LOB");
-
- RETURN_FALSE;
-}
-
-/* }}} */
-#endif
-
-/* {{{ proto string ocinewdescriptor(int connection [, int type])
- Initialize a new empty descriptor LOB/FILE (LOB is default) */
-
-PHP_FUNCTION(ocinewdescriptor)
-{
- zval **conn, **type;
- oci_connection *connection;
- oci_descriptor *descr;
- int dtype;
-
- dtype = OCI_DTYPE_LOB;
-
- if (zend_get_parameters_ex(2, &conn, &type) == SUCCESS) {
- convert_to_long_ex(type);
- dtype = Z_LVAL_PP(type);
- } else if (zend_get_parameters_ex(1, &conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_CONN(connection,conn);
-
- descr = oci_new_desc(dtype,connection);
-
- if (! descr) {
- RETURN_NULL();
- }
-
- object_init_ex(return_value, oci_lob_class_entry_ptr);
- add_property_resource(return_value, "descriptor", descr->id);
-}
-
-/* }}} */
-
-/* {{{ proto bool ocirollback(int conn)
- Rollback the current context */
-
-PHP_FUNCTION(ocirollback)
-{
- zval **conn;
- oci_connection *connection;
-
- if (zend_get_parameters_ex(1, &conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_CONN(connection,conn);
-
- oci_debug("<OCITransRollback");
-
- CALL_OCI_RETURN(connection->error, OCITransRollback(
- connection->pServiceContext,
- connection->pError,
- (ub4) 0));
-
- connection->needs_commit = 0;
-
- oci_debug(">OCITransRollback");
-
- if (connection->error) {
- oci_error(connection->pError, "OCIRollback", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto bool ocicommit(int conn)
- Commit the current context */
-
-PHP_FUNCTION(ocicommit)
-{
- zval **conn;
- oci_connection *connection;
-
- if (zend_get_parameters_ex(1, &conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_CONN(connection,conn);
-
- oci_debug("<OCITransCommit");
-
- CALL_OCI_RETURN(connection->error, OCITransCommit(
- connection->pServiceContext,
- connection->pError,
- (ub4) 0));
-
- connection->needs_commit = 0;
-
- oci_debug(">OCITransCommit");
-
- if (connection->error) {
- oci_error(connection->pError, "OCICommit", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string ocicolumnname(int stmt, int col)
- Tell the name of a column */
-
-PHP_FUNCTION(ocicolumnname)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
- if (outcol == NULL) {
- RETURN_FALSE;
- }
-
- RETURN_STRINGL(outcol->name, outcol->name_len, 1);
-}
-
-/* }}} */
-
-/* {{{ proto int ocicolumnsize(int stmt, int col)
- Tell the maximum data size of a column */
-
-PHP_FUNCTION(ocicolumnsize)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
- if (outcol == NULL) {
- RETURN_FALSE;
- }
-
- oci_debug("ocicolumnsize: %16s, retlen = %4d, retlen4 = %d, data_size = %4d, storage_size4 = %4d, indicator %4d, retcode = %4d",
- outcol->name,outcol->retlen,outcol->retlen4,outcol->data_size,outcol->storage_size4,outcol->indicator,outcol->retcode);
-
- /* Handle data type of LONG */
- if (outcol->data_type == SQLT_LNG){
- RETURN_LONG(outcol->storage_size4);
- } else {
- RETURN_LONG(outcol->data_size);
- }
-}
-
-/* }}} */
-
-/* {{{ proto int ocicolumnscale(int stmt, int col)
- Tell the scale of a column */
-
-PHP_FUNCTION(ocicolumnscale)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
- if (outcol == NULL) {
- RETURN_FALSE;
- }
- RETURN_LONG(outcol->scale);
-}
-
-/* }}} */
-
-/* {{{ proto int ocicolumnprecision(int stmt, int col)
- Tell the precision of a column */
-
-PHP_FUNCTION(ocicolumnprecision)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
- if (outcol == NULL) {
- RETURN_FALSE;
- }
- RETURN_LONG(outcol->precision);
-}
-
-/* }}} */
-
-/* {{{ proto mixed ocicolumntype(int stmt, int col)
- Tell the data type of a column */
-
-PHP_FUNCTION(ocicolumntype)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
- if (outcol == NULL) {
- RETURN_FALSE;
- }
- switch (outcol->data_type) {
-#ifdef SQLT_TIMESTAMP
- case SQLT_TIMESTAMP:
- RETVAL_STRING("TIMESTAMP",1);
- break;
-#endif
-#ifdef SQLT_TIMESTAMP_TZ
- case SQLT_TIMESTAMP_TZ:
- RETVAL_STRING("TIMESTAMP_TZ",1);
- break;
-#endif
- case SQLT_DAT:
- RETVAL_STRING("DATE",1);
- break;
- case SQLT_NUM:
- RETVAL_STRING("NUMBER",1);
- break;
- case SQLT_LNG:
- RETVAL_STRING("LONG",1);
- break;
- case SQLT_BIN:
- RETVAL_STRING("RAW",1);
- break;
- case SQLT_LBI:
- RETVAL_STRING("LONG RAW",1);
- break;
- case SQLT_CHR:
- RETVAL_STRING("VARCHAR",1);
- break;
- case SQLT_RSET:
- RETVAL_STRING("REFCURSOR",1);
- break;
- case SQLT_AFC:
- RETVAL_STRING("CHAR",1);
- break;
- case SQLT_BLOB:
- RETVAL_STRING("BLOB",1);
- break;
- case SQLT_CLOB:
- RETVAL_STRING("CLOB",1);
- break;
- case SQLT_BFILE:
- RETVAL_STRING("BFILE",1);
- break;
- case SQLT_RDD:
- RETVAL_STRING("ROWID",1);
- break;
- default:
- RETVAL_LONG(outcol->data_type);
- }
-}
-
-/* }}} */
-
-/* {{{ proto mixed ocicolumntyperaw(int stmt, int col)
- Tell the raw oracle data type of a column */
-
-PHP_FUNCTION(ocicolumntyperaw)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
- if (outcol == NULL) {
- RETURN_FALSE;
- }
- RETVAL_LONG(outcol->data_type);
-}
-
-/* }}} */
-
-/* {{{ proto bool ocicolumnisnull(int stmt, int col)
- Tell whether a column is NULL */
-
-PHP_FUNCTION(ocicolumnisnull)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
- if (outcol == NULL) {
- RETURN_FALSE;
- }
- if (outcol->indicator == -1) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto void ociinternaldebug(int onoff)
- Toggle internal debugging output for the OCI extension */
-/* Disables or enables the internal debug output.
- * By default it is disabled.
- */
-PHP_FUNCTION(ociinternaldebug)
-{
- zval **arg;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg);
- OCI(debug_mode) = Z_LVAL_PP(arg);
-}
-
-
-/* }}} */
-
-/* {{{ proto bool ociexecute(int stmt [, int mode])
- Execute a parsed statement */
-
-PHP_FUNCTION(ociexecute)
-{
- zval **stmt,**mode;
- oci_statement *statement;
- ub4 execmode;
-
- if (zend_get_parameters_ex(2, &stmt, &mode) == SUCCESS) {
- convert_to_long_ex(mode);
- execmode = Z_LVAL_PP(mode);
- } else if (zend_get_parameters_ex(1, &stmt) == SUCCESS) {
- execmode = OCI_COMMIT_ON_SUCCESS;
- } else {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- if (oci_execute(statement, "OCIExecute",execmode)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto bool ocicancel(int stmt)
- Prepare a new row of data for reading */
-
-PHP_FUNCTION(ocicancel)
-{
- zval **stmt;
- oci_statement *statement;
-
- if (zend_get_parameters_ex(1, &stmt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- if (oci_fetch(statement, 0, "OCICancel" TSRMLS_CC)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto bool ocifetch(int stmt)
- Prepare a new row of data for reading */
-
-PHP_FUNCTION(ocifetch)
-{
- zval **stmt;
- oci_statement *statement;
- ub4 nrows = 1; /* only one row at a time is supported for now */
-
- if (zend_get_parameters_ex(1, &stmt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- if (oci_fetch(statement, nrows, "OCIFetch" TSRMLS_CC)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto int ocifetchinto(int stmt, array &output [, int mode])
- Fetch a row of result data into an array */
-
-PHP_FUNCTION(ocifetchinto)
-{
- zval **stmt, **array, *element, **fmode;
- oci_statement *statement;
- oci_out_column *column;
- ub4 nrows = 1;
- int i, used;
- int mode = OCI_NUM;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 2 || ac > 3 || zend_get_parameters_ex(ac, &stmt, &array, &fmode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (ac) {
- case 3:
- convert_to_long_ex(fmode);
- mode = Z_LVAL_PP(fmode);
- /* possible breakthru */
- }
-
- OCI_GET_STMT(statement,stmt);
-
- if (!oci_fetch(statement, nrows, "OCIFetchInto" TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- zval_dtor(*array);
- array_init(*array);
-
- for (i = 0; i < statement->ncolumns; i++) {
- column = oci_get_col(statement, i + 1, 0);
- if (column == NULL) {
- continue;
- }
-
- if ((column->indicator == -1) && ((mode & OCI_RETURN_NULLS) == 0)) {
- continue;
- }
-
- used = 0;
- MAKE_STD_ZVAL(element);
- _oci_make_zval(element,statement,column,"OCIFetchInto",mode TSRMLS_CC);
-
- if ((mode & OCI_NUM) || (! (mode & OCI_ASSOC))) {
- zend_hash_index_update(Z_ARRVAL_PP(array),i,(void *)&element,sizeof(zval*),NULL);
- used=1;
- }
-
- if (mode & OCI_ASSOC) {
- if (used) {
- element->refcount++;
- }
- zend_hash_update(Z_ARRVAL_PP(array),column->name,column->name_len+1,(void *)&element,sizeof(zval*),NULL);
- }
- }
-
- RETURN_LONG(statement->ncolumns);
-}
-
-/* }}} */
-
-/* {{{ proto int ocifetchstatement(int stmt, array &output[, int skip][, int maxrows][, int flags])
- Fetch all rows of result data into an array */
-
-PHP_FUNCTION(ocifetchstatement)
-{
- zval **stmt, **array, *element, **zskip, **zmaxrows, **zflags, *tmp;
- oci_statement *statement;
- oci_out_column **columns;
- zval ***outarrs;
- ub4 nrows = 1;
- int i;
- int skip = 0, maxrows = -1;
- int flags = 0;
- int rows = 0;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 2 || ac > 5 || zend_get_parameters_ex(ac, &stmt, &array, &zskip, &zmaxrows, &zflags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (ac) {
- case 5:
- convert_to_long_ex(zflags);
- flags = Z_LVAL_PP(zflags);
- case 4:
- convert_to_long_ex(zmaxrows);
- maxrows = Z_LVAL_PP(zmaxrows);
- case 3:
- convert_to_long_ex(zskip);
- skip = Z_LVAL_PP(zskip);
- }
-
- OCI_GET_STMT(statement,stmt);
-
- zval_dtor(*array);
- array_init(*array);
-
- while (skip--) {
- if (! oci_fetch(statement, nrows, "OCIFetchStatement" TSRMLS_CC))
- RETURN_LONG(0);
- }
-
- if (flags & OCI_FETCHSTATEMENT_BY_ROW) {
- columns = emalloc(statement->ncolumns * sizeof(oci_out_column *));
-
- for (i = 0; i < statement->ncolumns; i++) {
- columns[ i ] = oci_get_col(statement, i + 1, 0);
- }
-
- while (oci_fetch(statement, nrows, "OCIFetchStatement" TSRMLS_CC)) {
- zval *row;
-
- MAKE_STD_ZVAL(row);
- array_init(row);
-
- for (i = 0; i < statement->ncolumns; i++) {
- MAKE_STD_ZVAL(element);
-
- _oci_make_zval(element,statement,columns[ i ], "OCIFetchStatement",OCI_RETURN_LOBS TSRMLS_CC);
-
- if (flags & OCI_NUM) {
- zend_hash_next_index_insert(Z_ARRVAL_P(row), &element, sizeof(zval*), NULL);
- } else { /* default to ASSOC */
- zend_hash_update(Z_ARRVAL_P(row),
- columns[ i ]->name, columns[ i ]->name_len+1,
- &element, sizeof(zval*), NULL);
- }
- }
-
- zend_hash_next_index_insert(Z_ARRVAL_PP(array), &row, sizeof(zval*), NULL),
-
- rows++;
-
- if ((maxrows != -1) && (rows == maxrows)) {
- oci_fetch(statement, 0, "OCIFetchStatement" TSRMLS_CC);
- break;
- }
- }
-
- efree(columns);
- } else { /* default to BY_COLUMN */
- columns = emalloc(statement->ncolumns * sizeof(oci_out_column *));
- outarrs = emalloc(statement->ncolumns * sizeof(zval*));
-
- if (flags & OCI_NUM) {
- for (i = 0; i < statement->ncolumns; i++) {
- columns[ i ] = oci_get_col(statement, i + 1, 0);
-
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
-
- zend_hash_next_index_insert(Z_ARRVAL_PP(array),
- &tmp, sizeof(zval*), (void **) &(outarrs[ i ]));
- }
- } else { /* default to ASSOC */
- for (i = 0; i < statement->ncolumns; i++) {
- columns[ i ] = oci_get_col(statement, i + 1, 0);
-
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
-
- zend_hash_update(Z_ARRVAL_PP(array),
- columns[ i ]->name, columns[ i ]->name_len+1,
- (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ]));
- }
- }
-
- while (oci_fetch(statement, nrows, "OCIFetchStatement" TSRMLS_CC)) {
- for (i = 0; i < statement->ncolumns; i++) {
- MAKE_STD_ZVAL(element);
-
- _oci_make_zval(element,statement,columns[ i ], "OCIFetchStatement",OCI_RETURN_LOBS TSRMLS_CC);
-
- zend_hash_index_update((*(outarrs[ i ]))->value.ht, rows, (void *)&element, sizeof(zval*), NULL);
- }
-
- rows++;
-
- if ((maxrows != -1) && (rows == maxrows)) {
- oci_fetch(statement, 0, "OCIFetchStatement" TSRMLS_CC);
- break;
- }
- }
-
- efree(columns);
- efree(outarrs);
- }
-
- RETURN_LONG(rows);
-}
-
-/* }}} */
-
-/* {{{ proto bool ocifreestatement(int stmt)
- Free all resources associated with a statement */
-
-PHP_FUNCTION(ocifreestatement)
-{
- zval **stmt;
- oci_statement *statement;
-
- if (zend_get_parameters_ex(1, &stmt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- zend_list_delete(statement->id);
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto bool ocilogoff(int conn)
- Disconnect from database */
-
-PHP_FUNCTION(ocilogoff)
-{
-#if 0
- this function does nothing any more. server-connections get automagiclly closed on
- request-end. connection handles will "dissappear" as soon as they are no longer
- referenced. as this module makes heavy use of zends reference-counting mechanism
- this is the desired behavior. it has always been a bad idea to close a connection that
- has outstanding transactions. this way we have a nice-clean approach.
- (thies@thieso.net 20000110)
-
- oci_connection *connection;
- zval **conn;
-
- if (zend_get_parameters_ex(1, &conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_CONN(connection,conn);
-
- connection->is_open = 0;
-
- zend_hash_apply(list, (apply_func_t) _stmt_cleanup TSRMLS_CC);
-
- if (zend_list_delete(connection->id) == SUCCESS) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-#endif
-}
-
-/* }}} */
-
-/* {{{ proto int ocinlogon(string user, string pass [, string db])
- Connect to an Oracle database and log on. returns a new session */
-
-/* Connects to an Oracle 8 database and logs on. If the
- * optional third parameter is not specified, PHP uses the environment
- * variable ORACLE_SID to determine which database to connect to.
- */
-PHP_FUNCTION(ocinlogon)
-{
- oci_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0,1);
-}
-
-/* }}} */
-
-/* {{{ proto int ocilogon(string user, string pass [, string db])
- Connect to an Oracle database and log on. Returns a new session.
- */
-
-/* Connects to an Oracle 8 database and logs on. If the
- * optional third parameter is not specified, PHP uses the environment
- * variable ORACLE_SID to determine which database to connect to.
- */
-PHP_FUNCTION(ocilogon)
-{
- oci_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0,0);
-}
-
-/* }}} */
-
-/* {{{ proto int ociplogon(string user, string pass [, string db])
- Connect to an Oracle database using a persistent connection and log on. Returns a new session. */
-
-/* Connects to an Oracle 8 database and logs on. If the
- * optional third parameter is not specified, PHP uses the environment
- * variable ORACLE_SID to determine which database to connect to.
- */
-PHP_FUNCTION(ociplogon)
-{
- oci_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1,0);
-}
-
-/* }}} */
-
-/* {{{ proto array ocierror([int stmt|conn|global])
- Return the last error of stmt|conn|global. If no error happened returns false. */
-
-PHP_FUNCTION(ocierror)
-{
- zval **arg;
- oci_statement *statement;
- oci_connection *connection;
- text errbuf[512];
- sb4 errcode = 0;
- sword error = 0;
- dvoid *errh = NULL;
-#ifdef HAVE_OCI8_ATTR_STATEMENT
- ub2 errorofs = 0;
- text *sqltext = NULL;
-#endif
-
- if (zend_get_parameters_ex(1, &arg) == SUCCESS) {
- statement = (oci_statement *) zend_fetch_resource(arg TSRMLS_CC, -1, NULL, NULL, 1, le_stmt);
- if (statement) {
- errh = statement->pError;
- error = statement->error;
-
-#ifdef HAVE_OCI8_ATTR_STATEMENT
- CALL_OCI_RETURN(statement->error, OCIAttrGet(
- (dvoid *)statement->pStmt,
- OCI_HTYPE_STMT,
- (text *) &sqltext,
- (ub4 *)0,
- OCI_ATTR_STATEMENT,
- statement->pError));
-
- CALL_OCI_RETURN(statement->error, OCIAttrGet(
- (dvoid *)statement->pStmt,
- OCI_HTYPE_STMT,
- (ub2 *)&errorofs,
- (ub4 *)0,
- OCI_ATTR_PARSE_ERROR_OFFSET,
- statement->pError));
-#endif
-
- } else {
- connection = (oci_connection *) zend_fetch_resource(arg TSRMLS_CC, -1, NULL, NULL, 1, le_conn);
- if (connection) {
- errh = connection->pError;
- error = connection->error;
- }
- }
- } else {
- errh = OCI(pError);
- error = OCI(error);
- }
-
- if (! error) { /* no error set in the handle */
- RETURN_FALSE;
- }
-
- if (! errh) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIError: unable to find Error handle");
- RETURN_FALSE;
- }
-
- CALL_OCI(OCIErrorGet(
- errh,
- 1,
- NULL,
- &errcode,
- errbuf,
- (ub4) sizeof(errbuf),
- (ub4) OCI_HTYPE_ERROR));
-
- if (errcode) {
- array_init(return_value);
- add_assoc_long(return_value, "code", errcode);
- add_assoc_string(return_value, "message", (char*) errbuf, 1);
-#ifdef HAVE_OCI8_ATTR_STATEMENT
- add_assoc_long(return_value, "offset", errorofs);
- add_assoc_string(return_value, "sqltext", sqltext ? (char *) sqltext : "", 1);
-#endif
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto int ocinumcols(int stmt)
- Return the number of result columns in a statement */
-
-PHP_FUNCTION(ocinumcols)
-{
- zval **stmt;
- oci_statement *statement;
-
- if (zend_get_parameters_ex(1, &stmt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- RETURN_LONG(statement->ncolumns);
-}
-
-/* }}} */
-
-/* {{{ proto int ociparse(int conn, string query)
- Parse a query and return a statement */
-
-PHP_FUNCTION(ociparse)
-{
- zval **conn, **query;
- oci_connection *connection;
- oci_statement *statement;
-
- if (zend_get_parameters_ex(2, &conn, &query) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_CONN(connection,conn);
-
- convert_to_string_ex(query);
-
- statement = oci_parse(connection,Z_STRVAL_PP(query),Z_STRLEN_PP(query));
-
- if (statement) {
- RETURN_RESOURCE(statement->id);
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto int ocisetprefetch(int stmt, int prefetch_rows)
- sets the number of rows to be prefetched on execute to prefetch_rows for stmt */
-
-PHP_FUNCTION(ocisetprefetch)
-{
- zval **stmt, **size;
- oci_statement *statement;
-
- if (zend_get_parameters_ex(2, &stmt, &size) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(size);
-
- OCI_GET_STMT(statement,stmt);
-
- oci_setprefetch(statement,Z_LVAL_PP(size));
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto bool ocipasswordchange(int conn, string username, string old_password, string new_password)
- changes the password of an account*/
-
-PHP_FUNCTION(ocipasswordchange)
-{
- zval **conn, **user_param, **pass_old_param, **pass_new_param;
- text *user, *pass_old, *pass_new;
- oci_connection *connection;
-
- /* Disable in Safe Mode */
- if (PG(safe_mode)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "is disabled in Safe Mode");
- RETURN_FALSE;
- }
-
- if (zend_get_parameters_ex(4, &conn, &user_param, &pass_old_param, &pass_new_param) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- user = Z_STRVAL_PP(user_param);
- pass_old = Z_STRVAL_PP(pass_old_param);
- pass_new = Z_STRVAL_PP(pass_new_param);
-
- OCI_GET_CONN(connection, conn);
-
- CALL_OCI_RETURN(
- connection->error
- ,OCIPasswordChange(
- connection->pServiceContext
- ,connection->pError
- ,user
- ,strlen(user)+1
- ,pass_old
- ,strlen(pass_old)+1
- ,pass_new
- ,strlen(pass_new)+1
- ,OCI_DEFAULT
- )
- );
-
- if (connection->error == OCI_SUCCESS) {
- RETURN_TRUE;
- }
- else {
- oci_error(connection->pError, "OCIPasswordChange", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto int ocinewcursor(int conn)
- Return a new cursor (Statement-Handle) - use this to bind ref-cursors! */
-
-PHP_FUNCTION(ocinewcursor)
-{
- zval **conn;
- oci_connection *connection;
- oci_statement *statement;
-
- if (zend_get_parameters_ex(1, &conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_CONN(connection,conn);
-
- statement = oci_parse(connection,0,0);
-
- RETURN_RESOURCE(statement->id);
-}
-
-/* }}} */
-
-/* {{{ proto string ociresult(int stmt, mixed column)
- Return a single column of result data */
-
-PHP_FUNCTION(ociresult)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol = NULL;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
-
- if (outcol == NULL) {
- RETURN_FALSE;
- }
-
- _oci_make_zval(return_value,statement,outcol, "OCIResult",0 TSRMLS_CC);
-}
-
-/* }}} */
-
-/* {{{ proto string ociserverversion(int conn)
- Return a string containing server version information */
-
-PHP_FUNCTION(ociserverversion)
-{
- oci_connection *connection;
- zval **conn;
- char version[256];
-
- if (zend_get_parameters_ex(1, &conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_CONN(connection,conn);
-
- CALL_OCI_RETURN(connection->error, OCIServerVersion(
- connection->pServiceContext,
- connection->pError,
- (text*)version,
- sizeof(version),
- OCI_HTYPE_SVCCTX));
-
- if (connection->error != OCI_SUCCESS) {
- oci_error(connection->pError, "OCIServerVersion", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- RETURN_STRING(version,1);
-}
-
-/* }}} */
-
-/* {{{ proto string ocistatementtype(int stmt)
- Return the query type of an OCI statement */
-
-/* XXX it would be better with a general interface to OCIAttrGet() */
-
-PHP_FUNCTION(ocistatementtype)
-{
- zval **stmt;
- oci_statement *statement;
- ub2 stmttype;
-
- if (zend_get_parameters_ex(1, &stmt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- CALL_OCI_RETURN(statement->error, OCIAttrGet(
- (dvoid *)statement->pStmt,
- OCI_HTYPE_STMT,
- (ub2 *)&stmttype,
- (ub4 *)0,
- OCI_ATTR_STMT_TYPE,
- statement->pError));
-
- if (statement->error != OCI_SUCCESS) {
- oci_error(statement->pError, "OCIStatementType", statement->error);
- oci_handle_error(statement->conn, statement->error);
- RETURN_FALSE;
- }
-
- switch (stmttype) {
- case OCI_STMT_SELECT:
- RETVAL_STRING("SELECT",1);
- break;
- case OCI_STMT_UPDATE:
- RETVAL_STRING("UPDATE",1);
- break;
- case OCI_STMT_DELETE:
- RETVAL_STRING("DELETE",1);
- break;
- case OCI_STMT_INSERT:
- RETVAL_STRING("INSERT",1);
- break;
- case OCI_STMT_CREATE:
- RETVAL_STRING("CREATE",1);
- break;
- case OCI_STMT_DROP:
- RETVAL_STRING("DROP",1);
- break;
- case OCI_STMT_ALTER:
- RETVAL_STRING("ALTER",1);
- break;
- case OCI_STMT_BEGIN:
- RETVAL_STRING("BEGIN",1);
- break;
- case OCI_STMT_DECLARE:
- RETVAL_STRING("DECLARE",1);
- break;
- default:
- RETVAL_STRING("UNKNOWN",1);
- }
-}
-/* }}} */
-
-/* {{{ proto int ocirowcount(int stmt)
- Return the row count of an OCI statement */
-
-PHP_FUNCTION(ocirowcount)
-{
- zval **stmt;
- oci_statement *statement;
- ub4 rowcount;
-
- if (zend_get_parameters_ex(1, &stmt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- CALL_OCI_RETURN(statement->error, OCIAttrGet(
- (dvoid *)statement->pStmt,
- OCI_HTYPE_STMT,
- (ub2 *)&rowcount,
- (ub4 *)0,
- OCI_ATTR_ROW_COUNT,
- statement->pError));
-
- if (statement->error != OCI_SUCCESS) {
- oci_error(statement->pError, "OCIRowCount", statement->error);
- oci_handle_error(statement->conn, statement->error);
- RETURN_FALSE;
- }
-
- RETURN_LONG(rowcount);
-}
-
-/* }}} */
-
-#ifdef WITH_COLLECTIONS
-/* {{{ oci_get_coll() */
-
-static oci_collection *oci_get_coll(int ind TSRMLS_DC)
-{
- oci_collection *collection;
- int actual_resource_type;
-
- collection = (oci_collection *) zend_list_find(ind, &actual_resource_type);
-
- if (collection && (actual_resource_type == le_coll)) {
- return collection;
- } else {
- return (oci_collection *) NULL;
- }
-}
-/* }}} */
-
-/* {{{ proto bool ocifreecollection(object lob)
- Deletes collection object*/
-
-PHP_FUNCTION(ocifreecollection)
-{
- zval *id;
- int inx;
- oci_collection *coll;
- oci_connection *connection;
-
- if ((id = getThis()) != 0) {
- inx = _oci_get_ocicoll(id,&coll TSRMLS_CC);
- if (inx) {
- /*
- * Do we need to free the object?
- *
- */
- connection = coll->conn;
- oci_debug("OCIfreecollection: coll=%d",inx);
-
- CALL_OCI_RETURN(connection->error, OCIObjectFree(
- connection->session->pEnv,
- connection->pError,
- (dvoid *)coll->coll,
- (ub2)(OCI_OBJECTFREE_FORCE)));
-
- if (connection->error) {
- oci_error(connection->pError, "OCIObjectFree", connection->error);
- RETURN_FALSE;
- }
-
- zend_list_delete(inx);
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool ocicollappend(object collection,value)
- Append an object to the collection */
-
-PHP_FUNCTION(ocicollappend)
-{
- zval *id, **arg;
- oci_connection *connection;
- oci_collection *coll;
- OCINumber num;
- OCIString *ocistr = (OCIString *)0;
- OCIInd new_ind = OCI_IND_NOTNULL;
- OCIInd null_ind = OCI_IND_NULL;
- OCIDate dt;
- int inx;
- double ndx;
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocicoll(id,&coll TSRMLS_CC)) == 0) {
- RETURN_FALSE;
- }
-
- connection = coll->conn;
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /*
- * Handle NULLS. For consistency with the rest of the OCI8 library, when
- * a value passed in is a 0 length string, consider it a null
- */
- convert_to_string_ex(arg);
- if(Z_STRLEN_PP(arg) == 0) {
- CALL_OCI_RETURN(connection->error, OCICollAppend(
- connection->session->pEnv,
- connection->pError,
- (dword *)0,
- &null_ind,
- coll->coll));
- if (connection->error) {
- oci_error(connection->pError, "OCICollAppend - NULL", connection->error);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
- }
-
- switch(coll->element_typecode) {
- case OCI_TYPECODE_DATE:
- convert_to_string_ex(arg);
-
- CALL_OCI_RETURN(connection->error, OCIDateFromText(
- connection->pError,
- Z_STRVAL_PP(arg),
- Z_STRLEN_PP(arg),
- 0,
- 0,
- 0,
- 0,
- &dt));
-
- if (connection->error) {
- oci_error(connection->pError, "OCIDateFromText", connection->error);
- RETURN_FALSE;
- }
-
- CALL_OCI_RETURN(connection->error, OCICollAppend(
- connection->session->pEnv,
- connection->pError,
- (dvoid *) &dt,
- (dvoid *) &new_ind,
- (OCIColl *) coll->coll));
-
- if (connection->error) {
- oci_error(connection->pError, "OCICollAppend", connection->error);
- RETURN_FALSE;
- }
- RETURN_TRUE;
- break;
- case OCI_TYPECODE_VARCHAR2 :
- convert_to_string_ex(arg);
-
- CALL_OCI_RETURN(connection->error, OCIStringAssignText(
- connection->session->pEnv,
- connection->pError,
- Z_STRVAL_PP(arg),
- Z_STRLEN_PP(arg),
- &ocistr));
-
- if (connection->error) {
- oci_error(connection->pError, "OCIStringAssignText", connection->error);
- RETURN_FALSE;
- }
-
- CALL_OCI_RETURN(connection->error, OCICollAppend(
- connection->session->pEnv,
- connection->pError,
- (dvoid *) ocistr,
- (dvoid *) &new_ind,
- (OCIColl *) coll->coll));
-
- if (connection->error) {
- oci_error(connection->pError, "OCICollAppend", connection->error);
- RETURN_FALSE;
- }
- RETURN_TRUE;
- break;
- case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */
- case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */
- case OCI_TYPECODE_REAL : /* REAL */
- case OCI_TYPECODE_DOUBLE : /* DOUBLE */
- case OCI_TYPECODE_INTEGER : /* INT */
- case OCI_TYPECODE_SIGNED16 : /* SHORT */
- case OCI_TYPECODE_SIGNED32 : /* LONG */
- case OCI_TYPECODE_DECIMAL : /* DECIMAL */
- case OCI_TYPECODE_FLOAT : /* FLOAT */
- case OCI_TYPECODE_NUMBER : /* NUMBER */
- case OCI_TYPECODE_SMALLINT : /* SMALLINT */
- convert_to_double_ex(arg);
- ndx = (double)Z_DVAL_PP(arg);
-
- CALL_OCI_RETURN(connection->error, OCINumberFromReal(
- connection->pError,
- &ndx,
- sizeof(double),&num));
-
- if (connection->error) {
- oci_error(connection->pError, "OCINumberFromReal", connection->error);
- RETURN_FALSE;
- }
-
- CALL_OCI_RETURN(connection->error, OCICollAppend(
- connection->session->pEnv,
- connection->pError,
- (dvoid *) &num,
- (dvoid *) &new_ind,
- (OCIColl *) coll->coll));
-
- RETURN_TRUE;
- break;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string ocicollgetelem(object collection,ndx)
- Retrieve the value at collection index ndx */
-
-PHP_FUNCTION(ocicollgetelem)
-{
- zval *id,**arg;
- oci_connection *connection;
- oci_collection *coll;
- ub4 ndx;
- int inx;
- dvoid *elem;
- OCIInd *elemind;
- boolean exists;
- OCIString *ocistr = (OCIString *)0;
- text *str;
- char buff[1024];
- int len;
- double dnum;
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocicoll(id,&coll TSRMLS_CC)) == 0) {
- RETURN_FALSE;
- }
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg);
- ndx = Z_LVAL_PP(arg);
-
- connection = coll->conn;
-
- CALL_OCI_RETURN(connection->error, OCICollGetElem(
- connection->session->pEnv,
- connection->pError,
- coll->coll,
- ndx,
- &exists,
- &elem,
- (dvoid **)&elemind));
-
- if (connection->error) {
- oci_error(connection->pError, "OCICollGetElem", connection->error);
- RETURN_NULL();
- }
-
- /* Return false if value does not exist at that location */
- if(exists == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCICollGetElem - Invalid index %d", ndx);
- RETURN_FALSE;
- }
-
- /* Return null if the value is null */
- if(*elemind == OCI_IND_NULL) {
- RETURN_FALSE;
- }
-
- switch (coll->element_typecode) {
- case OCI_TYPECODE_DATE:
- len = 1024;
- CALL_OCI(OCIDateToText(
- connection->pError,
- elem,
- 0, /* fmt */
- 0, /* fmt_length */
- 0, /* lang_name */
- 0, /* lang_length */
- &len,
- buff));
-
- RETURN_STRINGL(buff,len,1);
- case OCI_TYPECODE_VARCHAR2 :
- ocistr = *(OCIString **)elem;
- str = OCIStringPtr(connection->session->pEnv,ocistr); /* XXX not protected against recursion! */
- RETURN_STRINGL(str,strlen(str),1);
- break;
- case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */
- case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */
- case OCI_TYPECODE_REAL : /* REAL */
- case OCI_TYPECODE_DOUBLE : /* DOUBLE */
- case OCI_TYPECODE_INTEGER : /* INT */
- case OCI_TYPECODE_SIGNED16 : /* SHORT */
- case OCI_TYPECODE_SIGNED32 : /* LONG */
- case OCI_TYPECODE_DECIMAL : /* DECIMAL */
- case OCI_TYPECODE_FLOAT : /* FLOAT */
- case OCI_TYPECODE_NUMBER : /* NUMBER */
- case OCI_TYPECODE_SMALLINT : /* SMALLINT */
- CALL_OCI_RETURN(connection->error, OCINumberToReal(
- connection->pError,
- (CONST OCINumber *) elem,
- (uword) sizeof(dnum),
- (dvoid *) &dnum));
-
- if (connection->error) {
- oci_error(connection->pError, "OCINumberToReal", connection->error);
- RETURN_FALSE;
- }
- RETURN_DOUBLE(dnum);
- break;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool ocicollassign(object collection,object)
- Assign a collection from another existing collection */
-
-PHP_FUNCTION(ocicollassign)
-{
- zval *id,**from;
- oci_connection *connection;
- oci_collection *coll,*from_coll;
- int inx;
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocicoll(id,&coll TSRMLS_CC)) == 0) {
- RETURN_FALSE;
- }
-
- if (zend_get_parameters_ex(1, &from) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((inx = _oci_get_ocicoll(*from,&from_coll TSRMLS_CC)) == 0) {
- RETURN_FALSE;
- }
-
- connection = coll->conn;
-
- CALL_OCI_RETURN(connection->error, OCICollAssign(
- connection->session->pEnv,
- connection->pError,
- from_coll->coll,
- coll->coll));
-
- if (connection->error) {
- oci_error(connection->pError, "OCICollAssignElem", connection->error);
- RETURN_FALSE;
- }
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool ocicollassignelem(object collection,ndx,val)
- Assign element val to collection at index ndx */
-
-PHP_FUNCTION(ocicollassignelem)
-{
- zval *id,**index,**val;
- oci_connection *connection;
- oci_collection *coll;
- OCINumber num;
- OCIInd new_ind = OCI_IND_NOTNULL;
- OCIInd null_ind = OCI_IND_NULL;
- ub4 ndx;
- int inx;
- OCIString *ocistr = (OCIString *)0;
- OCIDate dt;
- double dnum;
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocicoll(id,&coll TSRMLS_CC)) == 0) {
- RETURN_FALSE;
- }
-
- if (zend_get_parameters_ex(2, &index,&val) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(index);
- ndx = Z_LVAL_PP(index);
-
- connection = coll->conn;
-
- if (connection->error) {
- oci_error(connection->pError, "OCICollAssignElem", connection->error);
- RETURN_FALSE;
- }
-
- /*
- * Handle NULLS. For consistency with the rest of the OCI8 library, when
- * a value passed in is a 0 length string, consider it a null
- */
- convert_to_string_ex(val);
-
- if(Z_STRLEN_PP(val) == 0) {
- CALL_OCI_RETURN(connection->error, OCICollAssignElem(
- connection->session->pEnv,
- connection->pError,
- ndx,
- (dword *)0,
- &null_ind,
- coll->coll));
- if (connection->error) {
- oci_error(connection->pError, "OCICollAssignElem - NULL", connection->error);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
- }
-
- switch(coll->element_typecode) {
- case OCI_TYPECODE_DATE:
- convert_to_string_ex(val);
- CALL_OCI_RETURN(connection->error, OCIDateFromText(
- connection->pError,
- Z_STRVAL_PP(val),
- Z_STRLEN_PP(val),
- 0,
- 0,
- 0,
- 0,
- &dt));
-
- if (connection->error) {
- oci_error(connection->pError, "OCIDateFromText", connection->error);
- RETURN_FALSE;
- }
-
- CALL_OCI_RETURN(connection->error, OCICollAssignElem(
- connection->session->pEnv,
- connection->pError,
- ndx,
- (dword *)&dt,
- &new_ind,
- coll->coll));
-
- if (connection->error) {
- oci_error(connection->pError, "OCICollAssignElem", connection->error);
- RETURN_FALSE;
- }
- break;
- case OCI_TYPECODE_VARCHAR2 :
- convert_to_string_ex(val);
-
- CALL_OCI_RETURN(connection->error, OCIStringAssignText(
- connection->session->pEnv,
- connection->pError,
- Z_STRVAL_PP(val),
- Z_STRLEN_PP(val),
- &ocistr));
-
- if (connection->error) {
- oci_error(connection->pError, "OCIStringAssignText", connection->error);
- RETURN_FALSE;
- }
-
- CALL_OCI_RETURN(connection->error, OCICollAssignElem(
- connection->session->pEnv,
- connection->pError,
- ndx,
- (dword *)ocistr,
- &new_ind,
- coll->coll));
-
- if (connection->error) {
- oci_error(connection->pError, "OCICollAssignElem", connection->error);
- RETURN_FALSE;
- }
- RETURN_TRUE;
- break;
- case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */
- case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */
- case OCI_TYPECODE_REAL : /* REAL */
- case OCI_TYPECODE_DOUBLE : /* DOUBLE */
- case OCI_TYPECODE_INTEGER : /* INT */
- case OCI_TYPECODE_SIGNED16 : /* SHORT */
- case OCI_TYPECODE_SIGNED32 : /* LONG */
- case OCI_TYPECODE_DECIMAL : /* DECIMAL */
- case OCI_TYPECODE_FLOAT : /* FLOAT */
- case OCI_TYPECODE_NUMBER : /* NUMBER */
- case OCI_TYPECODE_SMALLINT : /* SMALLINT */
- convert_to_double_ex(val);
- dnum = (double)Z_DVAL_PP(val);
-
- CALL_OCI_RETURN(connection->error, OCINumberFromReal(
- connection->pError,
- &dnum,
- sizeof(double),
- &num));
-
- if (connection->error) {
- oci_error(connection->pError, "OCINumberFromReal", connection->error);
- RETURN_FALSE;
- }
-
- CALL_OCI_RETURN(connection->error, OCICollAssignElem(
- connection->session->pEnv,
- connection->pError,
- ndx,
- (dword *)&num,
- &new_ind,
- coll->coll));
-
- if (connection->error) {
- oci_error(connection->pError, "OCICollAssignElem", connection->error);
- RETURN_FALSE;
- }
- RETURN_TRUE;
- break;
- }
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int ocicollsize(object collection)
- Return the size of a collection */
-
-PHP_FUNCTION(ocicollsize)
-{
- zval *id;
- oci_connection *connection;
- oci_collection *coll;
- sb4 sz;
- int inx;
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocicoll(id,&coll TSRMLS_CC)) == 0) {
- RETURN_FALSE;
- }
- connection = coll->conn;
-
- CALL_OCI_RETURN(connection->error, OCICollSize(
- connection->session->pEnv,
- coll->conn->pError,
- coll->coll,
- &sz));
-
- if (connection->error) {
- oci_error(connection->pError, "OCICollSize", connection->error);
- RETURN_FALSE;
- }
-
- RETURN_LONG(sz);
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int ocicollmax(object collection)
- Return the max value of a collection. For a varray this is the maximum length of the array */
-
-PHP_FUNCTION(ocicollmax)
-{
- zval *id;
- oci_collection *coll;
- sb4 sz;
- int inx;
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocicoll(id,&coll TSRMLS_CC)) == 0) {
- RETURN_FALSE;
- }
- sz = OCICollMax(OCI(pEnv),coll->coll); /* XXX not protected against recursion */
-
- RETURN_LONG(sz);
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool ocicolltrim(object collection,num)
- Trim num elements from the end of a collection */
-
-PHP_FUNCTION(ocicolltrim)
-{
- zval *id,**arg;
- oci_collection *coll;
- int inx;
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocicoll(id,&coll TSRMLS_CC)) == 0) {
- RETURN_FALSE;
- }
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg);
-
- CALL_OCI_RETURN(coll->conn->error, OCICollTrim(
- OCI(pEnv),
- coll->conn->pError,
- Z_LVAL_PP(arg),
- coll->coll));
-
- if (coll->conn->error) {
- oci_error(coll->conn->pError, "OCICollTrim", coll->conn->error);
- RETURN_FALSE;
- }
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool ocinewcollection(int connection, string tdo,[string schema])
- Initialize a new collection */
-
-PHP_FUNCTION(ocinewcollection)
-{
- dvoid *dschp1;
- dvoid *parmp1;
- dvoid *parmp2;
- zval **conn, **tdo, **schema;
- oci_connection *connection;
- oci_collection *coll;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 2 || ac > 3 || zend_get_parameters_ex(ac, &conn, &tdo, &schema) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(tdo);
-
- if(ac == 3) {
- convert_to_string_ex(schema);
- }
-
- coll = emalloc(sizeof(oci_collection));
-
- OCI_GET_CONN(connection,conn);
-
- coll->conn = connection;
- coll->id = zend_list_insert(coll,le_coll);
- zend_list_addref(connection->id);
-
- CALL_OCI_RETURN(connection->error, OCITypeByName(
- connection->session->pEnv,
- connection->pError,
- connection->pServiceContext,
- ac==3?(text *)Z_STRVAL_PP(schema):(text *)0,
- ac==3?(ub4)Z_STRLEN_PP(schema): (ub4)0,
- (text *) Z_STRVAL_PP(tdo),
- (ub4) Z_STRLEN_PP(tdo),
- (CONST text *) 0,
- (ub4) 0,
- OCI_DURATION_SESSION,
- OCI_TYPEGET_ALL,
- &(coll->tdo)));
-
- if (connection->error) {
- oci_error(connection->pError, "OCITypeByName", connection->error);
- RETURN_FALSE;
- }
-
- CALL_OCI_RETURN(connection->error, OCIHandleAlloc(
- connection->session->pEnv,
- (dvoid **) &dschp1,
- (ub4) OCI_HTYPE_DESCRIBE,
- (size_t) 0,
- (dvoid **) 0));
-
- if (connection->error) {
- oci_error(connection->pError, "OCI_HTYPE_DESCRIBE", connection->error);
- RETURN_FALSE;
- }
-
- CALL_OCI_RETURN(connection->error, OCIDescribeAny(
- connection->pServiceContext,
- connection->pError,
- (dvoid *) coll->tdo,
- (ub4) 0,
- OCI_OTYPE_PTR,
- (ub1)1,
- (ub1) OCI_PTYPE_TYPE,
- dschp1));
-
- if (connection->error) {
- oci_error(connection->pError, "OCI_OTYPE_PTR", connection->error);
- RETURN_FALSE;
- }
-
- CALL_OCI_RETURN(connection->error, OCIAttrGet(
- (dvoid *) dschp1,
- (ub4) OCI_HTYPE_DESCRIBE,
- (dvoid *)&parmp1,
- (ub4 *)0,
- (ub4)OCI_ATTR_PARAM,
- connection->pError));
-
- if (connection->error) {
- oci_error(connection->pError, "OCI_ATTR_PARAM", connection->error);
- RETURN_FALSE;
- }
-
- /* get the collection type code of the attribute */
-
- CALL_OCI_RETURN(connection->error, OCIAttrGet(
- (dvoid*) parmp1,
- (ub4) OCI_DTYPE_PARAM,
- (dvoid*) &(coll->coll_typecode),
- (ub4 *) 0,
- (ub4) OCI_ATTR_COLLECTION_TYPECODE,
- connection->pError));
-
- if (connection->error) {
- oci_error(connection->pError, "OCI_ATTR_COLLECTION_TYPECODE", connection->error);
- RETURN_FALSE;
- }
-
- switch(coll->coll_typecode) {
- case OCI_TYPECODE_TABLE:
- case OCI_TYPECODE_VARRAY:
- CALL_OCI_RETURN(connection->error, OCIAttrGet(
- (dvoid*) parmp1,
- (ub4) OCI_DTYPE_PARAM,
- (dvoid*) &parmp2,
- (ub4 *) 0,
- (ub4) OCI_ATTR_COLLECTION_ELEMENT,
- connection->pError));
-
- if (connection->error) {
- oci_error(connection->pError, "OCI_ATTR_COLLECTION_ELEMENT", connection->error);
- RETURN_FALSE;
- }
-
- CALL_OCI_RETURN(connection->error, OCIAttrGet(
- (dvoid*) parmp2,
- (ub4) OCI_DTYPE_PARAM,
- (dvoid*) &(coll->elem_ref),
- (ub4 *) 0,
- (ub4) OCI_ATTR_REF_TDO,
- connection->pError));
-
- if (connection->error) {
- oci_error(connection->pError, "OCI_ATTR_REF_TDO", connection->error);
- RETURN_FALSE;
- }
-
- CALL_OCI_RETURN(connection->error, OCITypeByRef(
- connection->session->pEnv,
- connection->pError,
- coll->elem_ref,
- OCI_DURATION_SESSION,
- OCI_TYPEGET_HEADER,
- &(coll->element_type)));
-
- if (connection->error) {
- oci_error(connection->pError, "OCI_TYPEGET_HEADER", connection->error);
- RETURN_FALSE;
- }
-
- CALL_OCI_RETURN(connection->error, OCIAttrGet(
- (dvoid*) parmp2,
- (ub4) OCI_DTYPE_PARAM,
- (dvoid*) &(coll->element_typecode),
- (ub4 *) 0,
- (ub4) OCI_ATTR_TYPECODE,
- connection->pError));
-
- if (connection->error) {
- oci_error(connection->pError, "OCI_ATTR_TYPECODE", connection->error);
- RETURN_FALSE;
- }
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCINewCollection - Unknown Type %d", coll->coll_typecode);
- break;
- }
-
- /* Create object to hold return table */
- CALL_OCI_RETURN(connection->error, OCIObjectNew(
- connection->session->pEnv,
- connection->pError,
- connection->pServiceContext,
- OCI_TYPECODE_TABLE,
- coll->tdo,
- (dvoid *)0,
- OCI_DURATION_DEFAULT,
- TRUE,
- (dvoid **) &(coll->coll)));
-
- if (connection->error) {
- oci_error(connection->pError, "OCIObjectNew", connection->error);
- RETURN_FALSE;
- }
-
- object_init_ex(return_value, oci_coll_class_entry_ptr);
- add_property_resource(return_value, "collection",coll->id);
-}
-
-/* }}} */
-
-#endif
-
-#endif /* HAVE_OCI8 */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/oci8/oci8.dsp b/ext/oci8/oci8.dsp
deleted file mode 100644
index ecb892c549..0000000000
--- a/ext/oci8/oci8.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="oci8" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=oci8 - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "oci8.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "oci8.mak" CFG="oci8 - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "oci8 - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "oci8 - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "oci8 - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\oci805\include" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OCI8=1 /D HAVE_OCI8_TEMP_LOB=1 /D HAVE_OCI8_ATTR_STATEMENT=1 /D COMPILE_DL_OCI8=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib oci.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_oci8.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\oci805\lib" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "oci8 - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\include\oci805" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FTP_EXPORTS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OCI8=1 /D HAVE_OCI8_TEMP_LOB=1 /D HAVE_OCI8_ATTR_STATEMENT=1 /D COMPILE_DL_OCI8=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib oci.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_oci8.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\lib\oci805"
-
-!ENDIF
-
-# Begin Target
-
-# Name "oci8 - Win32 Release_TS"
-# Name "oci8 - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\oci8.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_oci8.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/oci8/oci8.dsw b/ext/oci8/oci8.dsw
deleted file mode 100644
index fc18fae34a..0000000000
--- a/ext/oci8/oci8.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "oci8"=.\oci8.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
deleted file mode 100644
index 23054a8a26..0000000000
--- a/ext/oci8/php_oci8.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@php.net> |
- | Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#if HAVE_OCI8
-# ifndef PHP_OCI8_H
-# define PHP_OCI8_H
-# endif
-
-# if (defined(__osf__) && defined(__alpha))
-# ifndef A_OSF
-# define A_OSF
-# endif
-# ifndef OSF1
-# define OSF1
-# endif
-# ifndef _INTRINSICS
-# define _INTRINSICS
-# endif
-# endif /* osf alpha */
-
-#ifdef PHP_WIN32
-#define PHP_OCI_API __declspec(dllexport)
-#else
-#define PHP_OCI_API
-#endif
-
-#if defined(min)
-#undef min
-#endif
-#if defined(max)
-#undef max
-#endif
-
-#include <oci.h>
-
-typedef struct {
- int num;
- int persistent;
- int is_open;
- char *dbname;
- OCIServer *pServer;
-#if 0
- OCIFocbkStruct failover;
-#endif
-} oci_server;
-
-typedef struct {
- int num;
- int persistent;
- int is_open;
- int exclusive;
- char *hashed_details;
- oci_server *server;
- OCISession *pSession;
- OCIEnv *pEnv; /* sessions own environment */
- ub2 charsetId; /* sessions used character set (mostly this will be 0, so NLS_LANG will be used. */
-} oci_session;
-
-typedef struct {
- int id;
- int is_open;
- oci_session *session;
- OCISvcCtx *pServiceContext;
- sword error;
- OCIError *pError;
- int needs_commit;
-} oci_connection;
-
-typedef struct {
- int id;
- oci_connection *conn;
- dvoid *ocidescr;
- ub4 type;
-} oci_descriptor;
-
-typedef struct {
- int id;
- oci_connection *conn;
- OCIType *tdo;
- OCITypeCode coll_typecode;
- OCIRef *elem_ref;
- OCIType *element_type;
- OCITypeCode element_typecode;
- OCIColl *coll;
-} oci_collection;
-
-typedef struct {
- zval *zval;
- text *name;
- ub4 name_len;
- ub4 type;
-} oci_define;
-
-typedef struct {
- int id;
- oci_connection *conn;
- sword error;
- OCIError *pError;
- OCIStmt *pStmt;
- char *last_query;
- HashTable *columns;
- HashTable *binds;
- HashTable *defines;
- int ncolumns;
- int executed;
- int has_data;
- ub2 stmttype;
-} oci_statement;
-
-typedef struct {
- OCIBind *pBind;
- zval *zval;
- dvoid *descr; /* used for binding of LOBS etc */
- OCIStmt *pStmt; /* used for binding REFCURSORs */
- sb2 indicator;
- ub2 retcode;
-} oci_bind;
-
-typedef struct {
- oci_statement *statement;
- OCIDefine *pDefine;
- char *name;
- ub4 name_len;
- ub2 data_type;
- ub2 data_size;
- ub4 storage_size4;
- sb2 indicator;
- ub2 retcode;
- ub2 retlen;
- ub4 retlen4;
- ub2 is_descr;
- ub2 is_cursor;
- int descr;
- oci_statement *pstmt;
- int stmtid;
- int descid;
- void *data;
- oci_define *define;
- int piecewise;
- ub4 cb_retlen;
- ub2 scale;
- ub2 precision;
-} oci_out_column;
-
-typedef struct {
- sword error;
- OCIError *pError;
-
- /*
- char *default_username;
- char *default_password;
- char *default_dbname;
- */
-
- long debug_mode;
-
- int shutdown;
-
- /* XXX NYI
- long allow_persistent;
- long max_persistent;
- long max_links;
- long num_persistent;
- long num_links;
- */
-
- HashTable *server;
- HashTable *user;
-
- OCIEnv *pEnv;
-
- int in_call;
-} php_oci_globals;
-
-extern zend_module_entry oci8_module_entry;
-#define phpext_oci8_ptr &oci8_module_entry
-
-#define OCI_MAX_NAME_LEN 64
-#define OCI_MAX_DATA_SIZE INT_MAX
-#define OCI_PIECE_SIZE (64*1024)-1
-
-#ifdef ZTS
-#define OCI(v) TSRMG(oci_globals_id, php_oci_globals *, v)
-#else
-#define OCI(v) (oci_globals.v)
-#endif
-
-#else /* !HAVE_OCI8 */
-
-# define oci8_module_ptr NULL
-
-#endif /* HAVE_OCI8 */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/odbc/CREDITS b/ext/odbc/CREDITS
deleted file mode 100644
index 238bfb40a1..0000000000
--- a/ext/odbc/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-ODBC
-Stig Bakken, Andreas Karajannis, Frank M. Kromann, Daniel R. Kalowsky
diff --git a/ext/odbc/birdstep.c b/ext/odbc/birdstep.c
deleted file mode 100644
index bf8c665da7..0000000000
--- a/ext/odbc/birdstep.c
+++ /dev/null
@@ -1,652 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Nikolay P. Romanyuk <mag@redcom.ru> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*
- * TODO:
- * birdstep_fetch_into(),
- * Check all on real life apps.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if WIN32
-# include "config.w32.h"
-# include "win95nt.h"
-# ifdef PHP_EXPORTS
-# define PHPAPI __declspec(dllexport)
-# else
-# define PHPAPI __declspec(dllimport)
-# endif
-#else
-# include "php_config.h"
-# define PHPAPI
-# define THREAD_LS
-#endif
-
-#ifdef HAVE_BIRDSTEP
-#include "php_birdstep.h"
-#include "ext/standard/info.h"
-
-function_entry birdstep_functions[] = {
- PHP_FE(birdstep_connect, NULL)
- PHP_FE(birdstep_close, NULL)
- PHP_FE(birdstep_exec, NULL)
- PHP_FE(birdstep_fetch, NULL)
- PHP_FE(birdstep_result, NULL)
- PHP_FE(birdstep_freeresult, NULL)
- PHP_FE(birdstep_autocommit, NULL)
- PHP_FE(birdstep_off_autocommit, NULL)
- PHP_FE(birdstep_commit, NULL)
- PHP_FE(birdstep_rollback, NULL)
- PHP_FE(birdstep_fieldnum, NULL)
- PHP_FE(birdstep_fieldname, NULL)
-/*
- * Temporary Function aliases until the next major upgrade to PHP.
- * These should allow users to continue to use their current scripts,
- * but should in reality warn the user that this functionality is
- * deprecated.
- */
- PHP_FALIAS(velocis_connect, birdstep_connect, NULL)
- PHP_FALIAS(velocis_close, birdstep_close, NULL)
- PHP_FALIAS(velocis_exec, birdstep_exec, NULL)
- PHP_FALIAS(velocis_fetch, birdstep_fetch, NULL)
- PHP_FALIAS(velocis_result, birdstep_result, NULL)
- PHP_FALIAS(velocis_freeresult, birdstep_freeresult, NULL)
- PHP_FALIAS(velocis_autocommit, birdstep_autocommit, NULL)
- PHP_FALIAS(velocis_off_autocommit, birdstep_off_autocommit, NULL)
- PHP_FALIAS(velocis_commit, birdstep_commit, NULL)
- PHP_FALIAS(velocis_rollback, birdstep_rollback, NULL)
- PHP_FALIAS(velocis_fieldnum, birdstep_fieldnum, NULL)
- PHP_FALIAS(velocis_fieldname, birdstep_fieldname, NULL)
-/* End temporary aliases */
- {NULL, NULL, NULL}
-};
-
-zend_module_entry birdstep_module_entry = {
- STANDARD_MODULE_HEADER,
- "birdstep",
- birdstep_functions,
- PHP_MINIT(birdstep),
- PHP_MSHUTDOWN(birdstep),
- PHP_RINIT(birdstep),
- NULL,
- PHP_MINFO(birdstep),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_ODBC
-ZEND_GET_MODULE(birdstep)
-#endif
-
-THREAD_LS birdstep_module php_birdstep_module;
-THREAD_LS static HENV henv;
-
-#define PHP_GET_BIRDSTEP_RES_IDX(id) convert_to_long_ex(id); if (!(res = birdstep_find_result(list, Z_LVAL_PP(id)))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not result index (%d)", Z_LVAL_PP(id)); RETURN_FALSE; }
-#define PHP_BIRDSTEP_CHK_LNK(id) convert_to_long_ex(id); if (!(conn = birdstep_find_conn(list,Z_LVAL_PP(id)))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not connection index (%d)", Z_LVAL_PP(id)); RETURN_FALSE; }
-
-
-static void _close_birdstep_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- VConn *conn = (VConn *)rsrc->ptr;
-
- if ( conn ) {
- efree(conn);
- }
-}
-
-static void _free_birdstep_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- Vresult *res = (Vresult *)rsrc->ptr;
-
- if ( res && res->values ) {
- register int i;
- for ( i=0; i < res->numcols; i++ ) {
- if ( res->values[i].value )
- efree(res->values[i].value);
- }
- efree(res->values);
- }
- if ( res ) {
- efree(res);
- }
-}
-
-PHP_MINIT_FUNCTION(birdstep)
-{
- SQLAllocEnv(&henv);
-
- if ( cfg_get_long("birdstep.max_links",&php_birdstep_module.max_links) == FAILURE ) {
- php_birdstep_module.max_links = -1;
- }
- php_birdstep_module.num_links = 0;
- php_birdstep_module.le_link = zend_register_list_destructors_ex(_close_birdstep_link, NULL, "birdstep link", module_number);
- php_birdstep_module.le_result = zend_register_list_destructors_ex(_free_birdstep_result, NULL, "birdstep result", module_number);
-
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(birdstep)
-{
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(birdstep)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "RAIMA Birdstep Support", "enabled" );
- php_info_print_table_end();
-}
-
-PHP_MSHUTDOWN_FUNCTION(birdstep)
-{
- SQLFreeEnv(henv);
- return SUCCESS;
-}
-
-/* Some internal functions. Connections and result manupulate */
-
-static int birdstep_add_conn(HashTable *list,VConn *conn,HDBC hdbc)
-{
- int ind;
-
- ind = zend_list_insert(conn,php_birdstep_module.le_link);
- conn->hdbc = hdbc;
- conn->index = ind;
-
- return(ind);
-}
-
-static VConn * birdstep_find_conn(HashTable *list,int ind)
-{
- VConn *conn;
- int type;
-
- conn = zend_list_find(ind,&type);
- if ( !conn || type != php_birdstep_module.le_link ) {
- return(NULL);
- }
- return(conn);
-}
-
-static void birdstep_del_conn(HashTable *list,int ind)
-{
- zend_list_delete(ind);
-}
-
-static int birdstep_add_result(HashTable *list,Vresult *res,VConn *conn)
-{
- int ind;
-
- ind = zend_list_insert(res,php_birdstep_module.le_result);
- res->conn = conn;
- res->index = ind;
-
- return(ind);
-}
-
-static Vresult * birdstep_find_result(HashTable *list,int ind)
-{
- Vresult *res;
- int type;
-
- res = zend_list_find(ind,&type);
- if ( !res || type != php_birdstep_module.le_result ) {
- return(NULL);
- }
- return(res);
-}
-
-static void birdstep_del_result(HashTable *list,int ind)
-{
- zend_list_delete(ind);
-}
-
-/* Users functions */
-
-/* {{{ proto int birdstep_connect(string server, string user, sting pass)
- */
-PHP_FUNCTION(birdstep_connect)
-{
- zval **serv,**user,**pass;
- char *Serv = NULL;
- char *User = NULL;
- char *Pass = NULL;
- RETCODE stat;
- HDBC hdbc;
- VConn *new;
- long ind;
-
- if ( php_birdstep_module.max_links != -1 && php_birdstep_module.num_links == php_birdstep_module.max_links ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Too many open connections (%d)",php_birdstep_module.num_links);
- RETURN_FALSE;
- }
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &serv, &user, &pass) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(serv);
- convert_to_string_ex(user);
- convert_to_string_ex(pass);
- Serv = Z_STRVAL_PP(serv);
- User = Z_STRVAL_PP(user);
- Pass = Z_STRVAL_PP(pass);
- stat = SQLAllocConnect(henv,&hdbc);
- if ( stat != SQL_SUCCESS ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Could not allocate connection handle");
- RETURN_FALSE;
- }
- stat = SQLConnect(hdbc,Serv,SQL_NTS,User,SQL_NTS,Pass,SQL_NTS);
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Could not connect to server \"%s\" for %s",Serv,User);
- SQLFreeConnect(hdbc);
- RETURN_FALSE;
- }
- new = (VConn *)emalloc(sizeof(VConn));
- ind = birdstep_add_conn(list,new,hdbc);
- php_birdstep_module.num_links++;
- RETURN_LONG(ind);
-}
-/* }}} */
-
-/* {{{ proto bool birdstep_close(int id)
- */
-PHP_FUNCTION(birdstep_close)
-{
- zval **id;
- VConn *conn;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- PHP_BIRDSTEP_CHK_LNK(id);
-
- SQLDisconnect(conn->hdbc);
- SQLFreeConnect(conn->hdbc);
- birdstep_del_conn(list,Z_LVAL_PP(id));
- php_birdstep_module.num_links--;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int birdstep_exec(int index, string exec_str)
- */
-PHP_FUNCTION(birdstep_exec)
-{
- zval **ind, **exec_str;
- char *query = NULL;
- int indx;
- VConn *conn;
- Vresult *res;
- RETCODE stat;
- SWORD cols,i,colnamelen;
- SDWORD rows,coldesc;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &ind, &exec_str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- PHP_BIRDSTEP_CHK_LNK(ind);
-
- convert_to_string_ex(exec_str);
- query = Z_STRVAL_PP(exec_str);
-
- res = (Vresult *)emalloc(sizeof(Vresult));
- stat = SQLAllocStmt(conn->hdbc,&res->hstmt);
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLAllocStmt return %d",stat);
- efree(res);
- RETURN_FALSE;
- }
- stat = SQLExecDirect(res->hstmt,query,SQL_NTS);
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Can not execute \"%s\" query",query);
- SQLFreeStmt(res->hstmt,SQL_DROP);
- efree(res);
- RETURN_FALSE;
- }
- /* Success query */
- stat = SQLNumResultCols(res->hstmt,&cols);
- if ( stat != SQL_SUCCESS ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLNumResultCols return %d",stat);
- SQLFreeStmt(res->hstmt,SQL_DROP);
- efree(res);
- RETURN_FALSE;
- }
- if ( !cols ) { /* Was INSERT, UPDATE, DELETE, etc. query */
- stat = SQLRowCount(res->hstmt,&rows);
- if ( stat != SQL_SUCCESS ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLNumResultCols return %d",stat);
- SQLFreeStmt(res->hstmt,SQL_DROP);
- efree(res);
- RETURN_FALSE;
- }
- SQLFreeStmt(res->hstmt,SQL_DROP);
- efree(res);
- RETURN_LONG(rows);
- } else { /* Was SELECT query */
- res->values = (VResVal *)emalloc(sizeof(VResVal)*cols);
- res->numcols = cols;
- for ( i = 0; i < cols; i++ ) {
- SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_NAME,
- res->values[i].name,sizeof(res->values[i].name),
- &colnamelen,NULL);
- SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_TYPE,
- NULL,0,NULL,&res->values[i].valtype);
- switch ( res->values[i].valtype ) {
- case SQL_LONGVARBINARY:
- case SQL_LONGVARCHAR:
- res->values[i].value = NULL;
- continue;
- default:
- break;
- }
- SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_DISPLAY_SIZE,
- NULL,0,NULL,&coldesc);
- res->values[i].value = (char *)emalloc(coldesc+1);
- SQLBindCol(res->hstmt,i+1,SQL_C_CHAR, res->values[i].value,coldesc+1, &res->values[i].vallen);
- }
- }
- res->fetched = 0;
- indx = birdstep_add_result(list,res,conn);
- RETURN_LONG(indx);
-}
-/* }}} */
-
-/* {{{ proto bool birdstep_fetch(int index)
- */
-PHP_FUNCTION(birdstep_fetch)
-{
- zval **ind;
- Vresult *res;
- RETCODE stat;
- UDWORD row;
- UWORD RowStat[1];
-
- if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &ind) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- PHP_GET_BIRDSTEP_RES_IDX(ind);
-
- stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat);
- if ( stat == SQL_NO_DATA_FOUND ) {
- SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_LVAL_PP(ind));
- RETURN_FALSE;
- }
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error");
- SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_LVAL_PP(ind));
- RETURN_FALSE;
- }
- res->fetched = 1;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto mixed birdstep_result(int index, int col)
- */
-PHP_FUNCTION(birdstep_result)
-{
- zval **ind, **col;
- Vresult *res;
- RETCODE stat;
- int i,sql_c_type;
- UDWORD row;
- UWORD RowStat[1];
- SWORD indx = -1;
- char *field = NULL;
-
- if ( ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &ind, &col) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- PHP_GET_BIRDSTEP_RES_IDX(ind);
-
- if ( Z_TYPE_PP(col) == IS_STRING ) {
- field = Z_STRVAL_PP(col);
- } else {
- convert_to_long_ex(col);
- indx = Z_LVAL_PP(col);
- }
- if ( field ) {
- for ( i = 0; i < res->numcols; i++ ) {
- if ( !strcasecmp(res->values[i].name,field)) {
- indx = i;
- break;
- }
- }
- if ( indx < 0 ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %s not found",field);
- RETURN_FALSE;
- }
- } else {
- if ( indx < 0 || indx >= res->numcols ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Field index not in range");
- RETURN_FALSE;
- }
- }
- if ( !res->fetched ) {
- stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat);
- if ( stat == SQL_NO_DATA_FOUND ) {
- SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_LVAL_PP(ind));
- RETURN_FALSE;
- }
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error");
- SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_LVAL_PP(ind));
- RETURN_FALSE;
- }
- res->fetched = 1;
- }
- switch ( res->values[indx].valtype ) {
- case SQL_LONGVARBINARY:
- sql_c_type = SQL_C_BINARY;
- goto l1;
- case SQL_LONGVARCHAR:
- sql_c_type = SQL_C_CHAR;
-l1:
- if ( !res->values[indx].value ) {
- res->values[indx].value = emalloc(4096);
- }
- stat = SQLGetData(res->hstmt,indx+1,sql_c_type,
- res->values[indx].value,4095,&res->values[indx].vallen);
- if ( stat == SQL_NO_DATA_FOUND ) {
- SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_LVAL_PP(ind));
- RETURN_FALSE;
- }
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLGetData return error");
- SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_LVAL_PP(ind));
- RETURN_FALSE;
- }
- if ( res->values[indx].valtype == SQL_LONGVARCHAR ) {
- RETURN_STRING(res->values[indx].value,TRUE);
- } else {
- RETURN_LONG((long)res->values[indx].value);
- }
- default:
- if ( res->values[indx].value != NULL ) {
- RETURN_STRING(res->values[indx].value,TRUE);
- }
- }
-}
-/* }}} */
-
-/* {{{ proto bool birdstep_freeresult(int index)
- */
-PHP_FUNCTION(birdstep_freeresult)
-{
- zval **ind;
- Vresult *res;
-
- if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &ind) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- PHP_GET_BIRDSTEP_RES_IDX(ind);
-
- SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_LVAL_PP(ind));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool birdstep_autocommit(int index)
- */
-PHP_FUNCTION(birdstep_autocommit)
-{
- zval **id;
- RETCODE stat;
- VConn *conn;
-
- if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- PHP_BIRDSTEP_CHK_LNK(id);
-
- stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_ON);
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Set autocommit_on option failure");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool birdstep_off_autocommit(int index)
- */
-PHP_FUNCTION(birdstep_off_autocommit)
-{
- zval **id;
- RETCODE stat;
- VConn *conn;
-
- if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- PHP_BIRDSTEP_CHK_LNK(id);
-
- stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_OFF);
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Set autocommit_off option failure");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool birdstep_commit(int index)
- */
-PHP_FUNCTION(birdstep_commit)
-{
- zval **id;
- RETCODE stat;
- VConn *conn;
-
- if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- PHP_BIRDSTEP_CHK_LNK(id)
-
- stat = SQLTransact(NULL,conn->hdbc,SQL_COMMIT);
- if ( stat != SQL_SUCCESS ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Commit failure");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool birdstep_rollback(int index)
- */
-PHP_FUNCTION(birdstep_rollback)
-{
- zval **id;
- RETCODE stat;
- VConn *conn;
-
- if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- PHP_BIRDSTEP_CHK_LNK(id);
-
- stat = SQLTransact(NULL,conn->hdbc,SQL_ROLLBACK);
- if ( stat != SQL_SUCCESS ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Rollback failure");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string birdstep_fieldname(int index, int col)
- */
-PHP_FUNCTION(birdstep_fieldname)
-{
- zval **ind, **col;
- Vresult *res;
- SWORD indx;
-
- if ( ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &ind, &col) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- PHP_GET_BIRDSTEP_RES_IDX(ind);
-
- convert_to_long_ex(col);
- indx = Z_LVAL_PP(col);
- if ( indx < 0 || indx >= res->numcols ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Field index not in range");
- RETURN_FALSE;
- }
- RETURN_STRING(res->values[indx].name,TRUE);
-}
-/* }}} */
-
-/* {{{ proto int birdstep_fieldnum(int index)
- */
-PHP_FUNCTION(birdstep_fieldnum)
-{
- zval **ind;
- Vresult *res;
-
- if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &ind) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- PHP_GET_BIRDSTEP_RES_IDX(ind);
-
- RETURN_LONG(res->numcols);
-}
-/* }}} */
-
-#endif /* HAVE_BIRDSTEP */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/odbc/config.m4 b/ext/odbc/config.m4
deleted file mode 100644
index 20c998dec5..0000000000
--- a/ext/odbc/config.m4
+++ /dev/null
@@ -1,555 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-dnl
-dnl Figure out which library file to link with for the Solid support.
-dnl
-AC_DEFUN(AC_FIND_SOLID_LIBS,[
- AC_MSG_CHECKING([Solid library file])
- ac_solid_uname_r=`uname -r 2>/dev/null`
- ac_solid_uname_s=`uname -s 2>/dev/null`
- case $ac_solid_uname_s in
- AIX) ac_solid_os=a3x;; # a4x for AIX4/ Solid 2.3/3.0 only
- HP-UX) ac_solid_os=h9x;; # h1x for hpux11, h0x for hpux10
- IRIX) ac_solid_os=irx;; # Solid 2.3(?)/ 3.0 only
- Linux)
- if ldd -v /bin/sh | grep GLIBC > /dev/null; then
- AC_DEFINE(SS_LINUX,1,[Needed in sqlunix.h ])
- ac_solid_os=l2x
- else
- AC_DEFINE(SS_LINUX,1,[Needed in sqlunix.h ])
- ac_solid_os=lux
- fi;;
- SunOS)
- ac_solid_os=ssx;; # should we deal with SunOS 4?
- FreeBSD)
- if test `expr $ac_solid_uname_r : '\(.\)'` -gt "2"; then
- AC_DEFINE(SS_FBX,1,[Needed in sqlunix.h for wchar defs ])
- ac_solid_os=fex
- else
- AC_DEFINE(SS_FBX,1,[Needed in sqlunix.h for wchar defs ])
- ac_solid_os=fbx
- fi;;
- esac
-
- if test -f $1/soc${ac_solid_os}35.a; then
- ac_solid_version=35
- ac_solid_prefix=soc
- elif test -f $1/scl${ac_solid_os}30.a; then
- ac_solid_version=30
- ac_solid_prefix=scl
- elif test -f $1/scl${ac_solid_os}23.a; then
- ac_solid_version=23
- ac_solid_prefix=scl
- fi
-
-#
-# Check for the library files, and setup the ODBC_LIBS path...
-#
-if test ! -f $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.so -a \
- ! -f $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.a; then
- #
- # we have an error and should bail out, as we can't find the libs!
- #
- echo ""
- echo "*********************************************************************"
- echo "* Unable to locate $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.so or $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.a"
- echo "* Please correct this by creating the following links and reconfiguring:"
- echo "* $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.a -> $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.a"
- echo "* $1/${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.so -> $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.so"
- echo "*********************************************************************"
-else
- ODBC_LFLAGS=-L$1
- ODBC_LIBS=-l${ac_solid_prefix}${ac_solid_os}${ac_solid_version}
-fi
-
- AC_MSG_RESULT(`echo $ODBC_LIBS | sed -e 's!.*/!!'`)
-])
-
-
-dnl
-dnl Figure out which library file to link with for the Empress support.
-dnl
-AC_DEFUN(AC_FIND_EMPRESS_LIBS,[
- AC_MSG_CHECKING([Empress library file])
- ODBC_LIBS=`echo $1/libempodbccl.so | cut -d' ' -f1`
- if test ! -f $ODBC_LIBS; then
- ODBC_LIBS=`echo $1/libempodbccl.so | cut -d' ' -f1`
- fi
- AC_MSG_RESULT(`echo $ODBC_LIBS | sed -e 's!.*/!!'`)
-])
-
-AC_DEFUN(AC_FIND_EMPRESS_BCS_LIBS,[
- AC_MSG_CHECKING([Empress local access library file])
- ODBCBCS_LIBS=`echo $1/libempodbcbcs.a | cut -d' ' -f1`
- if test ! -f $ODBCBCS_LIBS; then
- ODBCBCS_LIBS=`echo $1/libempodbcbcs.a | cut -d' ' -f1`
- fi
- AC_MSG_RESULT(`echo $ODBCBCS_LIBS | sed -e 's!.*/!!'`)
-])
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Adabas support)
-AC_ARG_WITH(adabas,
-[ --with-adabas[=DIR] Include Adabas D support. DIR is the Adabas base
- install directory, defaults to /usr/local.],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- withval=/usr/local
- fi
- if test "$withval" != "no"; then
- PHP_ADD_INCLUDE($withval/incl)
- PHP_ADD_LIBPATH($withval/lib)
- ODBC_OBJS="$withval/lib/odbclib.a"
- ODBC_LIB="$abs_builddir/ext/odbc/libodbc_adabas.a"
- $srcdir/build/shtool mkdir -f -p ext/odbc
- rm -f "$ODBC_LIB"
- cp "$ODBC_OBJS" "$ODBC_LIB"
- PHP_ADD_LIBRARY(sqlptc)
- PHP_ADD_LIBRARY(sqlrte)
- PHP_ADD_LIBRARY_WITH_PATH(odbc_adabas, $abs_builddir/ext/odbc)
- ODBC_TYPE=adabas
- AC_DEFINE(HAVE_ADABAS,1,[ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for SAP DB support)
-AC_ARG_WITH(sapdb,
-[ --with-sapdb[=DIR] Include SAP DB support. DIR is SAP DB base
- install directory, defaults to /usr/local.],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- withval=/usr/local
- fi
- if test "$withval" != "no"; then
- PHP_ADD_INCLUDE($withval/incl)
- PHP_ADD_LIBPATH($withval/lib)
- PHP_ADD_LIBRARY(sqlod)
- ODBC_TYPE=sapdb
- AC_DEFINE(HAVE_SAPDB,1,[ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Solid support)
-AC_ARG_WITH(solid,
-[ --with-solid[=DIR] Include Solid support. DIR is the Solid base
- install directory, defaults to /usr/local/solid],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- withval=/usr/local/solid
- fi
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_TYPE=solid
- if test -f $ODBC_LIBDIR/soc*35.a; then
- AC_DEFINE(HAVE_SOLID_35,1,[ ])
- elif test -f $ODBC_LIBDIR/scl*30.a; then
- AC_DEFINE(HAVE_SOLID_30,1,[ ])
- elif test -f $ODBC_LIBDIR/scl*23.a; then
- AC_DEFINE(HAVE_SOLID,1,[ ])
- fi
- AC_MSG_RESULT(yes)
- AC_FIND_SOLID_LIBS($ODBC_LIBDIR)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for IBM DB2 support)
-AC_ARG_WITH(ibm-db2,
-[ --with-ibm-db2[=DIR] Include IBM DB2 support. DIR is the DB2 base
- install directory, defaults to /home/db2inst1/sqllib],
-[
- PHP_WITH_SHARED
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- ODBC_INCDIR=/home/db2inst1/sqllib/include
- ODBC_LIBDIR=/home/db2inst1/sqllib/lib
- else
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- fi
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- ODBC_TYPE=db2
- ODBC_LIBS=-ldb2
- AC_DEFINE(HAVE_IBMDB2,1,[ ])
-
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Empress support)
-AC_ARG_WITH(empress,
-[ --with-empress[=DIR] Include Empress support. DIR is the Empress base
- install directory, defaults to \$EMPRESSPATH.
- From PHP4, this option only supports Empress Version
- 8.60 and above],
-[
- PHP_WITH_SHARED
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- ODBC_INCDIR=$EMPRESSPATH/include/odbc
- ODBC_LIBDIR=$EMPRESSPATH/shlib
- else
- ODBC_INCDIR=$withval/include/odbc
- ODBC_LIBDIR=$withval/shlib
- fi
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- ODBC_TYPE=empress
- AC_DEFINE(HAVE_EMPRESS,1,[ ])
- AC_MSG_RESULT(yes)
- AC_FIND_EMPRESS_LIBS($ODBC_LIBDIR)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Empress local access support)
-AC_ARG_WITH(empress-bcs,
-[ --with-empress-bcs[=DIR]
- Include Empress Local Access support. DIR is the
- Empress base install directory, defaults to
- \$EMPRESSPATH. From PHP4, this option only supports
- Empress Version 8.60 and above.],
-[
- PHP_WITH_SHARED
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- ODBC_INCDIR=$EMPRESSPATH/include/odbc
- ODBC_LIBDIR=$EMPRESSPATH/shlib
- else
- ODBC_INCDIR=$withval/include/odbc
- ODBC_LIBDIR=$withval/shlib
- fi
- CC="empocc -bcs";export CC;
- LD="empocc -bcs";export LD;
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- LIST=`empocc -listlines -bcs -o a a.c`
-
- NEWLIST=
- for I in $LIST
- do
- case $I in
- $EMPRESSPATH/odbccl/lib/* | \
- $EMPRESSPATH/rdbms/lib/* | \
- $EMPRESSPATH/common/lib/*)
- NEWLIST="$NEWLIST $I"
- ;;
- esac
- done
- ODBC_LIBS="-lempphpbcs -lms -lmscfg -lbasic -lbasic_os -lnlscstab -lnlsmsgtab -lm -ldl -lcrypt"
- ODBC_TYPE=empress
- AC_DEFINE(HAVE_EMPRESS,1,[ ])
- AC_MSG_RESULT(yes)
- AC_FIND_EMPRESS_BCS_LIBS($ODBC_LIBDIR)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Birdstep support)
-AC_ARG_WITH(birdstep,
-[ --with-birdstep[=DIR] Include Birdstep support. DIR is the Birdstep base
- install directory, defaults to /usr/local/birdstep.],
-[
- PHP_WITH_SHARED
-
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- ODBC_INCDIR=/usr/local/birdstep/include
- ODBC_LIBDIR=/usr/local/birdstep/lib
- else
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- fi
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_TYPE=birdstep
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- ODBC_LIBS="-lCadm -lCdict -lCenc -lCrdm -lCrpc -lCrdbc -lCrm -lCuapi -lutil"
- AC_DEFINE(HAVE_BIRDSTEP,1,[ ])
-
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for a custom ODBC support)
-AC_ARG_WITH(custom-odbc,
-[ --with-custom-odbc[=DIR]
- Include a user defined ODBC support.
- The DIR is ODBC install base directory,
- which defaults to /usr/local.
- Make sure to define CUSTOM_ODBC_LIBS and
- have some odbc.h in your include dirs.
- E.g., you should define following for
- Sybase SQL Anywhere 5.5.00 on QNX, prior to
- run configure script:
- CPPFLAGS=\"-DODBC_QNX -DSQLANY_BUG\"
- LDFLAGS=-lunix
- CUSTOM_ODBC_LIBS=\"-ldblib -lodbc\".],
-[
- if test "$withval" = "yes"; then
- withval=/usr/local
- fi
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LIBS=$CUSTOM_ODBC_LIBS
- ODBC_TYPE=custom
- AC_DEFINE(HAVE_CODBC,1,[ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for iODBC support)
-AC_ARG_WITH(iodbc,
-[ --with-iodbc[=DIR] Include iODBC support. DIR is the iODBC base
- install directory, defaults to /usr/local.],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- withval=/usr/local
- fi
- if test "$withval" != "no"; then
- PHP_ADD_LIBRARY_WITH_PATH(iodbc, $withval/lib)
- PHP_ADD_INCLUDE($withval/include, 1)
- ODBC_TYPE=iodbc
- ODBC_INCLUDE=-I$withval/include
- ODBC_LFLAGS=-L$withval/lib
- ODBC_LIBS=-liodbc
- AC_DEFINE(HAVE_IODBC,1,[ ])
- AC_DEFINE(HAVE_ODBC2,1,[ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Easysoft ODBC-ODBC Bridge support)
-AC_ARG_WITH(esoob,
-[ --with-esoob[=DIR] Include Easysoft OOB support. DIR is the OOB base
- install directory,
- defaults to /usr/local/easysoft/oob/client.],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- withval=/usr/local/easysoft/oob/client
- fi
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LIBS=-lesoobclient
- ODBC_TYPE=ESOOB
- AC_DEFINE(HAVE_ESOOB,1,[ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for unixODBC support)
-AC_ARG_WITH(unixODBC,
-[ --with-unixODBC[=DIR] Include unixODBC support. DIR is the unixODBC base
- install directory, defaults to /usr/local.],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- withval=/usr/local
- fi
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LIBS=-lodbc
- ODBC_TYPE=unixODBC
- AC_DEFINE(HAVE_UNIXODBC,1,[ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for OpenLink ODBC support)
-AC_ARG_WITH(openlink,
-[ --with-openlink[=DIR] Include OpenLink ODBC support. DIR is the
- OpenLink base install directory, defaults to
- /usr/local. This is the same as iODBC.],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- withval=/usr/local
- fi
- if test "$withval" != "no"; then
- PHP_ADD_LIBRARY_WITH_PATH(iodbc, $withval/lib)
- PHP_ADD_INCLUDE($withval/include, 1)
- ODBC_TYPE=iodbc
- ODBC_INCLUDE=-I$withval/include
- ODBC_LFLAGS=-L$withval/lib
- ODBC_LIBS=-liodbc
- AC_DEFINE(HAVE_IODBC,1,[ ])
- AC_MSG_RESULT(yes)
- echo "****************************************************************"
- echo " --with-openlink will not be valid in future releases. Please "
- echo " update your configure script to use --with-iodbc instead. "
- echo "****************************************************************"
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for DBMaker support)
-AC_ARG_WITH(dbmaker,
-[ --with-dbmaker[=DIR] Include DBMaker support. DIR is the DBMaker base
- install directory, defaults to where the latest
- version of DBMaker is installed (such as
- /home/dbmaker/3.6).],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- # find dbmaker's home directory
- DBMAKER_HOME=`grep "^dbmaker:" /etc/passwd | awk -F: '{print $6}'`
-
- # check DBMaker version (from 5.0 to 2.0)
- DBMAKER_VERSION=5.0
-
- while test test ! -d $DBMAKER_HOME/$DBMAKER_VERSION -a \
- "$DBMAKER_VERSION" != "2.9"; do
- DM_VER=`echo $DBMAKER_VERSION | sed -e 's/\.//' | awk '{ print $1-1;}'`
- MAJOR_V=`echo $DM_VER | awk '{ print $1/10; }' \
- | awk -F. '{ print $1; }'`
- MINOR_V=`echo $DM_VER | awk '{ print $1%10; }'`
- DBMAKER_VERSION=$MAJOR_V.$MINOR_V
- done
-
- if test "$DBMAKER_VERSION" = "2.9"; then
- withval=$DBMAKER_HOME
- else
- DBMAKER_PATH=$DBMAKER_HOME/$DBMAKER_VERSION
- fi
-
- withval=$DBMAKER_PATH
- fi
-
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LIBS="-ldmapic -lc"
- ODBC_TYPE=dbmaker
-
- AC_DEFINE(HAVE_DBMAKER,1,[Whether you want DBMaker])
-
- if test "$shared" = "yes"; then
- AC_MSG_RESULT(yes (shared))
- ODBC_LIBS="-ldmapic -lc -lm"
- ODBC_SHARED="odbc.la"
- else
- AC_MSG_RESULT(yes (static))
- PHP_ADD_LIBRARY_WITH_PATH(dmapic, $ODBC_LIBDIR)
- PHP_ADD_INCLUDE($ODBC_INCDIR)
- ODBC_STATIC="libphpext_odbc.la"
- fi
-
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -n "$ODBC_TYPE"; then
- if test "$ODBC_TYPE" != "dbmaker"; then
- ext_shared=$shared
- PHP_EVAL_LIBLINE([$ODBC_LFLAGS $ODBC_LIBS], ODBC_SHARED_LIBADD)
- AC_DEFINE(HAVE_SQLDATASOURCES,1,[ ])
- fi
-
- AC_DEFINE(HAVE_UODBC,1,[ ])
- PHP_SUBST(ODBC_SHARED_LIBADD)
- PHP_SUBST(ODBC_INCDIR)
- PHP_SUBST(ODBC_LIBDIR)
- PHP_SUBST_OLD(ODBC_INCLUDE)
- PHP_SUBST_OLD(ODBC_LIBS)
- PHP_SUBST_OLD(ODBC_LFLAGS)
- PHP_SUBST_OLD(ODBC_TYPE)
-
- PHP_NEW_EXTENSION(odbc, php_odbc.c, $ext_shared,, $ODBC_INCLUDE)
-fi
diff --git a/ext/odbc/php_birdstep.h b/ext/odbc/php_birdstep.h
deleted file mode 100644
index 752cbced5e..0000000000
--- a/ext/odbc/php_birdstep.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Nikolay P. Romanyuk <mag@redcom.ru> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_BIRDSTEP_H
-#define PHP_BIRDSTEP_H
-
-#if defined(HAVE_BIRDSTEP) && !HAVE_UODBC
-#define UNIX
-#include <sql.h>
-#include <sqlext.h>
-
-typedef struct VConn {
- HDBC hdbc;
- long index;
-} VConn;
-
-typedef struct {
- char name[32];
- char *value;
- long vallen;
- SDWORD valtype;
-} VResVal;
-
-typedef struct Vresult {
- HSTMT hstmt;
- VConn *conn;
- long index;
- VResVal *values;
- long numcols;
- int fetched;
-} Vresult;
-
-typedef struct {
- long num_links;
- long max_links;
- int le_link,le_result;
-} birdstep_module;
-
-extern zend_module_entry birdstep_module_entry;
-#define birdstep_module_ptr &birdstep_module_entry
-
-/* birdstep.c functions */
-PHP_MINIT_FUNCTION(birdstep);
-PHP_RINIT_FUNCTION(birdstep);
-PHP_MINFO_FUNCTION(birdstep);
-PHP_MSHUTDOWN_FUNCTION(birdstep);
-
-PHP_FUNCTION(birdstep_connect);
-PHP_FUNCTION(birdstep_close);
-PHP_FUNCTION(birdstep_exec);
-PHP_FUNCTION(birdstep_fetch);
-PHP_FUNCTION(birdstep_result);
-PHP_FUNCTION(birdstep_freeresult);
-PHP_FUNCTION(birdstep_autocommit);
-PHP_FUNCTION(birdstep_off_autocommit);
-PHP_FUNCTION(birdstep_commit);
-PHP_FUNCTION(birdstep_rollback);
-PHP_FUNCTION(birdstep_fieldnum);
-PHP_FUNCTION(birdstep_fieldname);
-
-extern birdstep_module php_birdstep_module;
-
-#else
-
-#define birdstep_module_ptr NULL
-
-#endif /* HAVE_BIRDSTEP */
-#endif /* PHP_BIRDSTEP_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
deleted file mode 100644
index ead26659c2..0000000000
--- a/ext/odbc/php_odbc.c
+++ /dev/null
@@ -1,3630 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@php.net> |
- | Andreas Karajannis <Andreas.Karajannis@gmd.de> |
- | Frank M. Kromann <frank@frontbase.com> Support for DB/2 CLI |
- | Kevin N. Shallow <kshallow@tampabay.rr.com> Birdstep Support|
- | Daniel R. Kalowsky <kalowsky@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-#include "ext/standard/php_standard.h"
-
-#include "php_odbc.h"
-#include "php_odbc_includes.h"
-#include "php_globals.h"
-
-#if HAVE_UODBC
-
-#include <fcntl.h>
-#include "ext/standard/head.h"
-#include "php_ini.h"
-
-#ifdef PHP_WIN32
-#include <winsock2.h>
-
-#define ODBC_TYPE "Win32"
-#define PHP_ODBC_TYPE ODBC_TYPE
-
-#endif
-
-/*
- * not defined elsewhere
- */
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
-void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent);
-
-static int le_result, le_conn, le_pconn;
-
-#define SAFE_SQL_NTS(n) ((SWORD) ((n)?(SQL_NTS):0))
-
-static unsigned char a3_arg3_and_3_force_ref[] = { 3, BYREF_NONE, BYREF_FORCE, BYREF_ALLOW};
-
-/* {{{ odbc_functions[]
- */
-function_entry odbc_functions[] = {
- PHP_FE(odbc_autocommit, NULL)
- PHP_FE(odbc_binmode, NULL)
- PHP_FE(odbc_close, NULL)
- PHP_FE(odbc_close_all, NULL)
- PHP_FE(odbc_columns, NULL)
- PHP_FE(odbc_commit, NULL)
- PHP_FE(odbc_connect, NULL)
- PHP_FE(odbc_cursor, NULL)
-#ifdef HAVE_SQLDATASOURCES
- PHP_FE(odbc_data_source, NULL)
-#endif
- PHP_FE(odbc_execute, NULL)
- PHP_FE(odbc_error, NULL)
- PHP_FE(odbc_errormsg, NULL)
- PHP_FE(odbc_exec, NULL)
-#ifdef PHP_ODBC_HAVE_FETCH_HASH
- PHP_FE(odbc_fetch_array, NULL)
- PHP_FE(odbc_fetch_object, NULL)
-#endif
- PHP_FE(odbc_fetch_row, NULL)
- PHP_FE(odbc_fetch_into, a3_arg3_and_3_force_ref)
- PHP_FE(odbc_field_len, NULL)
- PHP_FE(odbc_field_scale, NULL)
- PHP_FE(odbc_field_name, NULL)
- PHP_FE(odbc_field_type, NULL)
- PHP_FE(odbc_field_num, NULL)
- PHP_FE(odbc_free_result, NULL)
- PHP_FE(odbc_gettypeinfo, NULL)
- PHP_FE(odbc_longreadlen, NULL)
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
- PHP_FE(odbc_next_result, NULL)
-#endif
- PHP_FE(odbc_num_fields, NULL)
- PHP_FE(odbc_num_rows, NULL)
- PHP_FE(odbc_pconnect, NULL)
- PHP_FE(odbc_prepare, NULL)
- PHP_FE(odbc_result, NULL)
- PHP_FE(odbc_result_all, NULL)
- PHP_FE(odbc_rollback, NULL)
- PHP_FE(odbc_setoption, NULL)
- PHP_FE(odbc_specialcolumns, NULL)
- PHP_FE(odbc_statistics, NULL)
- PHP_FE(odbc_tables, NULL)
- PHP_FE(odbc_primarykeys, NULL)
-#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35) && !defined(HAVE_BIRDSTEP) /* not supported now */
- PHP_FE(odbc_columnprivileges, NULL)
- PHP_FE(odbc_tableprivileges, NULL)
-#endif
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) /* not supported */
- PHP_FE(odbc_foreignkeys, NULL)
- PHP_FE(odbc_procedures, NULL)
-#if !defined(HAVE_BIRDSTEP)
- PHP_FE(odbc_procedurecolumns, NULL)
-#endif
-#endif
- PHP_FALIAS(odbc_do, odbc_exec, NULL)
- PHP_FALIAS(odbc_field_precision, odbc_field_len, NULL)
- { NULL, NULL, NULL }
-};
-/* }}} */
-
-/* {{{ odbc_module_entry
- */
-zend_module_entry odbc_module_entry = {
- STANDARD_MODULE_HEADER,
- "odbc",
- odbc_functions,
- PHP_MINIT(odbc),
- PHP_MSHUTDOWN(odbc),
- PHP_RINIT(odbc),
- PHP_RSHUTDOWN(odbc),
- PHP_MINFO(odbc),
- "1.0",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef ZTS
-int odbc_globals_id;
-#else
-ZEND_API php_odbc_globals odbc_globals;
-#endif
-
-#ifdef COMPILE_DL_ODBC
-ZEND_GET_MODULE(odbc)
-#endif
-
-/* {{{ _free_odbc_result
- */
-static void _free_odbc_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- odbc_result *res = (odbc_result *)rsrc->ptr;
- int i;
- RETCODE rc;
-
- if (res) {
- if (res->values) {
- for(i = 0; i < res->numcols; i++) {
- if (res->values[i].value)
- efree(res->values[i].value);
- }
- efree(res->values);
- res->values = NULL;
- }
- if (res->stmt) {
-#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35)
- SQLTransact(res->conn_ptr->henv, res->conn_ptr->hdbc,
- (UWORD)SQL_COMMIT);
-#endif
- rc = SQLFreeStmt(res->stmt,SQL_DROP);
- /* We don't want the connection to be closed after the last statment has been closed
- * Connections will be closed on shutdown
- * zend_list_delete(res->conn_ptr->id);
- */
- }
- efree(res);
- }
-}
-/* }}} */
-
-/* {{{ safe_odbc_disconnect
- * disconnect, and if it fails, then issue a rollback for any pending transaction (lurcher)
- */
-static void safe_odbc_disconnect( void *handle )
-{
- int ret;
-
- ret = SQLDisconnect( handle );
- if ( ret == SQL_ERROR )
- {
- SQLTransact( NULL, handle, SQL_ROLLBACK );
- SQLDisconnect( handle );
- }
-}
-/* }}} */
-
-/* {{{ _close_odbc_conn
- */
-static void _close_odbc_conn(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- int i, nument, type;
- void *ptr;
- odbc_result *res;
-
- odbc_connection *conn = (odbc_connection *)rsrc->ptr;
-
- nument = zend_hash_next_free_element(&EG(regular_list));
- for(i = 1; i < nument; i++) {
- ptr = zend_list_find(i, &type);
- if (ptr && (type == le_result)) {
- res = (odbc_result *)ptr;
- if (res->conn_ptr == conn) {
- zend_list_delete(i);
- }
- }
- }
-
- safe_odbc_disconnect(conn->hdbc);
- SQLFreeConnect(conn->hdbc);
- SQLFreeEnv(conn->henv);
- efree(conn);
- ODBCG(num_links)--;
-}
-/* }}} */
-
-/* {{{ void _close_odbc_pconn
- */
-static void _close_odbc_pconn(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- int i, nument, type;
- void *ptr;
- odbc_result *res;
- odbc_connection *conn = (odbc_connection *)rsrc->ptr;
-
- nument = zend_hash_next_free_element(&EG(regular_list));
- for(i = 1; i < nument; i++) {
- ptr = zend_list_find(i, &type);
- if (ptr && (type == le_result)) {
- res = (odbc_result *)ptr;
- if (res->conn_ptr == conn) {
- zend_list_delete(i);
- }
- }
- }
-
- safe_odbc_disconnect(conn->hdbc);
- SQLFreeConnect(conn->hdbc);
- SQLFreeEnv(conn->henv);
- free(conn);
-
- ODBCG(num_links)--;
- ODBCG(num_persistent)--;
-}
-/* }}} */
-
-/* {{{ PHP_INI_DISP(display_link_nums)
- */
-static PHP_INI_DISP(display_link_nums)
-{
- char *value;
- TSRMLS_FETCH();
-
- if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
-
- if (value) {
- if (atoi(value) == -1) {
- PUTS("Unlimited");
- } else {
- php_printf("%s", value);
- }
- }
-}
-/* }}} */
-
-/* {{{ PHP_INI_DISP(display_defPW)
- */
-static PHP_INI_DISP(display_defPW)
-{
- char *value;
- TSRMLS_FETCH();
-
- if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
-
- if (value) {
-#if PHP_DEBUG
- php_printf("%s", value);
-#else
- PUTS("********");
-#endif
- } else {
- PUTS("<i>no value</i>");
- }
-}
-/* }}} */
-
-/* {{{ PHP_INI_DISP(display_binmode)
- */
-static PHP_INI_DISP(display_binmode)
-{
- char *value;
- TSRMLS_FETCH();
-
- if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
-
- if (value) {
- switch(atoi(value)) {
- case 0:
- PUTS("passthru");
- break;
- case 1:
- PUTS("return as is");
- break;
- case 2:
- PUTS("return as char");
- break;
- }
- }
-}
-/* }}} */
-
-/* {{{ PHP_INI_DISP(display_lrl)
- */
-static PHP_INI_DISP(display_lrl)
-{
- char *value;
- TSRMLS_FETCH();
-
- if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
-
- if (value) {
- if (atoi(value) <= 0) {
- PUTS("Passthru");
- } else {
- php_printf("return up to %s bytes", value);
- }
- }
-}
-/* }}} */
-
-/* {{{ PHP_INI_BEGIN
- */
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("odbc.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong,
- allow_persistent, php_odbc_globals, odbc_globals)
- STD_PHP_INI_ENTRY_EX("odbc.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong,
- max_persistent, php_odbc_globals, odbc_globals, display_link_nums)
- STD_PHP_INI_ENTRY_EX("odbc.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong,
- max_links, php_odbc_globals, odbc_globals, display_link_nums)
- STD_PHP_INI_ENTRY("odbc.default_db", NULL, PHP_INI_ALL, OnUpdateString,
- defDB, php_odbc_globals, odbc_globals)
- STD_PHP_INI_ENTRY("odbc.default_user", NULL, PHP_INI_ALL, OnUpdateString,
- defUser, php_odbc_globals, odbc_globals)
- STD_PHP_INI_ENTRY_EX("odbc.default_pw", NULL, PHP_INI_ALL, OnUpdateString,
- defPW, php_odbc_globals, odbc_globals, display_defPW)
- STD_PHP_INI_ENTRY_EX("odbc.defaultlrl", "4096", PHP_INI_ALL, OnUpdateLong,
- defaultlrl, php_odbc_globals, odbc_globals, display_lrl)
- STD_PHP_INI_ENTRY_EX("odbc.defaultbinmode", "1", PHP_INI_ALL, OnUpdateLong,
- defaultbinmode, php_odbc_globals, odbc_globals, display_binmode)
- STD_PHP_INI_BOOLEAN("odbc.check_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong,
- check_persistent, php_odbc_globals, odbc_globals)
-PHP_INI_END()
-/* }}} */
-
-#ifdef ZTS
-static void php_odbc_init_globals(php_odbc_globals *odbc_globals_p TSRMLS_DC)
-{
- ODBCG(num_persistent) = 0;
-}
-#endif
-
-/* {{{ PHP_MINIT_FUNCTION */
-PHP_MINIT_FUNCTION(odbc)
-{
-#ifdef SQLANY_BUG
- ODBC_SQL_CONN_T foobar;
- RETCODE rc;
-#endif
-
-#ifdef ZTS
- ts_allocate_id(&odbc_globals_id, sizeof(php_odbc_globals), php_odbc_init_globals, NULL);
-#else
- ODBCG(num_persistent) = 0;
-#endif
-
- REGISTER_INI_ENTRIES();
- le_result = zend_register_list_destructors_ex(_free_odbc_result, NULL, "odbc result", module_number);
- le_conn = zend_register_list_destructors_ex(_close_odbc_conn, NULL, "odbc link", module_number);
- le_pconn = zend_register_list_destructors_ex(NULL, _close_odbc_pconn, "odbc link persistent", module_number);
- Z_TYPE(odbc_module_entry) = type;
-
- REGISTER_STRING_CONSTANT("ODBC_TYPE", PHP_ODBC_TYPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ODBC_BINMODE_PASSTHRU", 0, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ODBC_BINMODE_RETURN", 1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ODBC_BINMODE_CONVERT", 2, CONST_CS | CONST_PERSISTENT);
- /* Define Constants for options
- these Constants are defined in <sqlext.h>
- */
- REGISTER_LONG_CONSTANT("SQL_ODBC_CURSORS", SQL_ODBC_CURSORS, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CUR_USE_DRIVER", SQL_CUR_USE_DRIVER, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CUR_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CUR_USE_ODBC", SQL_CUR_USE_ODBC, CONST_PERSISTENT | CONST_CS);
-
-
- REGISTER_LONG_CONSTANT("SQL_CONCURRENCY", SQL_CONCURRENCY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CONCUR_READ_ONLY", SQL_CONCUR_READ_ONLY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CONCUR_LOCK", SQL_CONCUR_LOCK, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CONCUR_ROWVER", SQL_CONCUR_ROWVER, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CONCUR_VALUES", SQL_CONCUR_VALUES, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_LONG_CONSTANT("SQL_CURSOR_TYPE", SQL_CURSOR_TYPE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CURSOR_FORWARD_ONLY", SQL_CURSOR_FORWARD_ONLY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CURSOR_KEYSET_DRIVEN", SQL_CURSOR_KEYSET_DRIVEN, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CURSOR_DYNAMIC", SQL_CURSOR_DYNAMIC, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CURSOR_STATIC", SQL_CURSOR_STATIC, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_LONG_CONSTANT("SQL_KEYSET_SIZE", SQL_KEYSET_SIZE, CONST_PERSISTENT | CONST_CS);
-
- /* these are for the Data Source type */
- REGISTER_LONG_CONSTANT("SQL_FETCH_FIRST", SQL_FETCH_FIRST, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_FETCH_NEXT", SQL_FETCH_NEXT, CONST_PERSISTENT | CONST_CS);
-
- /*
- * register the standard data types
- */
- REGISTER_LONG_CONSTANT("SQL_CHAR", SQL_CHAR, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_VARCHAR", SQL_VARCHAR, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_LONGVARCHAR", SQL_LONGVARCHAR, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_DECIMAL", SQL_DECIMAL, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_NUMERIC", SQL_NUMERIC, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_BIT", SQL_BIT, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_TINYINT", SQL_TINYINT, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_SMALLINT", SQL_SMALLINT, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_INTEGER", SQL_INTEGER, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_BIGINT", SQL_BIGINT, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_REAL", SQL_REAL, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_FLOAT", SQL_FLOAT, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_DOUBLE", SQL_DOUBLE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_BINARY", SQL_BINARY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_VARBINARY", SQL_VARBINARY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_LONGVARBINARY", SQL_LONGVARBINARY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_DATE", SQL_DATE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_TIME", SQL_TIME, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_TIMESTAMP", SQL_TIMESTAMP, CONST_PERSISTENT | CONST_CS);
-#if defined(ODBCVER) && (ODBCVER >= 0x0300)
- REGISTER_LONG_CONSTANT("SQL_TYPE_DATE", SQL_TYPE_DATE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_TYPE_TIME", SQL_TYPE_TIME, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_TYPE_TIMESTAMP", SQL_TYPE_TIMESTAMP, CONST_PERSISTENT | CONST_CS);
-
- /*
- * SQLSpecialColumns values
- */
- REGISTER_LONG_CONSTANT("SQL_BEST_ROWID", SQL_BEST_ROWID, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_ROWVER", SQL_ROWVER, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_SCOPE_CURROW", SQL_SCOPE_CURROW, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_SCOPE_TRANSACTION", SQL_SCOPE_TRANSACTION, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_SCOPE_SESSION", SQL_SCOPE_SESSION, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_NO_NULLS", SQL_NO_NULLS, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_NULLABLE", SQL_NULLABLE, CONST_PERSISTENT | CONST_CS);
-
- /*
- * SQLStatistics values
- */
- REGISTER_LONG_CONSTANT("SQL_INDEX_UNIQUE", SQL_INDEX_UNIQUE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_INDEX_ALL", SQL_INDEX_ALL, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_ENSURE", SQL_ENSURE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_QUICK", SQL_QUICK, CONST_PERSISTENT | CONST_CS);
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION */
-PHP_RINIT_FUNCTION(odbc)
-{
- ODBCG(defConn) = -1;
- ODBCG(num_links) = ODBCG(num_persistent);
- memset(ODBCG(laststate), '\0', 6);
- memset(ODBCG(lasterrormsg), '\0', SQL_MAX_MESSAGE_LENGTH);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION */
-PHP_RSHUTDOWN_FUNCTION(odbc)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION */
-PHP_MSHUTDOWN_FUNCTION(odbc)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION */
-PHP_MINFO_FUNCTION(odbc)
-{
- char buf[32];
-
- php_info_print_table_start();
- php_info_print_table_header(2, "ODBC Support", "enabled");
- sprintf(buf, "%ld", ODBCG(num_persistent));
- php_info_print_table_row(2, "Active Persistent Links", buf);
- sprintf(buf, "%ld", ODBCG(num_links));
- php_info_print_table_row(2, "Active Links", buf);
- php_info_print_table_row(2, "ODBC library", PHP_ODBC_TYPE);
-#ifndef PHP_WIN32
- php_info_print_table_row(2, "ODBC_INCLUDE", PHP_ODBC_INCLUDE);
- php_info_print_table_row(2, "ODBC_LFLAGS", PHP_ODBC_LFLAGS);
- php_info_print_table_row(2, "ODBC_LIBS", PHP_ODBC_LIBS);
-#endif
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-
-}
-/* }}} */
-
-/* {{{ odbc_sql_error */
-void odbc_sql_error(ODBC_SQL_ERROR_PARAMS)
-{
- char state[6];
- SDWORD error; /* Not used */
- char errormsg[SQL_MAX_MESSAGE_LENGTH];
- SWORD errormsgsize; /* Not used */
- RETCODE rc;
- ODBC_SQL_ENV_T henv;
- ODBC_SQL_CONN_T conn;
- TSRMLS_FETCH();
-
- if (conn_resource) {
- henv = conn_resource->henv;
- conn = conn_resource->hdbc;
- } else {
- henv = SQL_NULL_HENV;
- conn = SQL_NULL_HDBC;
- }
-
- /* This leads to an endless loop in many drivers!
- *
- while(henv != SQL_NULL_HENV){
- do {
- */
- rc = SQLError(henv, conn, stmt, state, &error, errormsg, sizeof(errormsg)-1, &errormsgsize);
- if (conn_resource) {
- memcpy(conn_resource->laststate, state, sizeof(state));
- memcpy(conn_resource->lasterrormsg, errormsg, sizeof(errormsg));
- }
- memcpy(ODBCG(laststate), state, sizeof(state));
- memcpy(ODBCG(lasterrormsg), errormsg, sizeof(errormsg));
- if (func) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQL error: %s, SQL state %s in %s", errormsg, state, func);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQL error: %s, SQL state %s", errormsg, state);
- }
- /*
- } while (SQL_SUCCEEDED(rc));
- }
- */
-}
-/* }}} */
-
-/* {{{ php_odbc_fetch_attribs */
-void php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- odbc_result *result;
- pval **pv_res, **pv_flag;
-
- if (zend_get_parameters_ex(2, &pv_res, &pv_flag) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(pv_flag);
-
- if (Z_LVAL_PP(pv_res)) {
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
- if (mode)
- result->longreadlen = Z_LVAL_PP(pv_flag);
- else
- result->binmode = Z_LVAL_PP(pv_flag);
- } else {
- if (mode)
- ODBCG(defaultlrl) = Z_LVAL_PP(pv_flag);
- else
- ODBCG(defaultbinmode) = Z_LVAL_PP(pv_flag);
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ odbc_bindcols */
-int odbc_bindcols(odbc_result *result TSRMLS_DC)
-{
- RETCODE rc;
- int i;
- SWORD colnamelen; /* Not used */
- SDWORD displaysize;
-
- result->values = (odbc_result_value *) emalloc(sizeof(odbc_result_value)*result->numcols);
-
- result->longreadlen = ODBCG(defaultlrl);
- result->binmode = ODBCG(defaultbinmode);
-
- for(i = 0; i < result->numcols; i++) {
- rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_NAME,
- result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0);
- rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_TYPE,
- NULL, 0, NULL, &result->values[i].coltype);
-
- /* Don't bind LONG / BINARY columns, so that fetch behaviour can
- * be controlled by odbc_binmode() / odbc_longreadlen()
- */
-
- switch(result->values[i].coltype) {
- case SQL_BINARY:
- case SQL_VARBINARY:
- case SQL_LONGVARBINARY:
- case SQL_LONGVARCHAR:
- result->values[i].value = NULL;
- break;
-
-#ifdef HAVE_ADABAS
- case SQL_TIMESTAMP:
- result->values[i].value = (char *)emalloc(27);
- SQLBindCol(result->stmt, (UWORD)(i+1), SQL_C_CHAR, result->values[i].value,
- 27, &result->values[i].vallen);
- break;
-#endif /* HAVE_ADABAS */
- default:
- rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_DISPLAY_SIZE,
- NULL, 0, NULL, &displaysize);
- displaysize = displaysize <= result->longreadlen ? displaysize :
- result->longreadlen;
- result->values[i].value = (char *)emalloc(displaysize + 1);
- rc = SQLBindCol(result->stmt, (UWORD)(i+1), SQL_C_CHAR, result->values[i].value,
- displaysize + 1, &result->values[i].vallen);
- break;
- }
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ odbc_transact */
-void odbc_transact(INTERNAL_FUNCTION_PARAMETERS, int type)
-{
- odbc_connection *conn;
- RETCODE rc;
- pval **pv_conn;
-
- if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- rc = SQLTransact(conn->henv, conn->hdbc, (UWORD)((type)?SQL_COMMIT:SQL_ROLLBACK));
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLTransact");
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ _close_pconn_with_id */
-static int _close_pconn_with_id(list_entry *le, int *id TSRMLS_DC)
-{
- if(Z_TYPE_P(le) == le_pconn && (((odbc_connection *)(le->ptr))->id == *id)){
- return 1;
- }else{
- return 0;
- }
-}
-/* }}} */
-
-/* {{{ odbc_column_lengths */
-void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type)
-{
- odbc_result *result;
-#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_OPENLINK)
- /* this seems to be necessary for Solid2.3 ( tested by
- * tammy@synchronis.com) and Solid 3.0 (tested by eric@terra.telemediair.nl)
- * Solid does not seem to declare a SQLINTEGER, but it does declare a
- * SQL_INTEGER which does not work (despite being the same type as a SDWORD.
- * Solid 3.5 does not have this issue.
- */
- SDWORD len;
-#else
- SQLINTEGER len;
-#endif
- pval **pv_res, **pv_num;
-
- if (zend_get_parameters_ex(2, &pv_res, &pv_num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(pv_num);
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- if (Z_LVAL_PP(pv_num) > result->numcols) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field index larger than number of fields");
- RETURN_FALSE;
- }
-
- if (Z_LVAL_PP(pv_num) < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field numbering starts at 1");
- RETURN_FALSE;
- }
-
- SQLColAttributes(result->stmt, (UWORD)Z_LVAL_PP(pv_num),
- (SQLUSMALLINT) (type?SQL_COLUMN_SCALE:SQL_COLUMN_PRECISION),
- NULL, 0, NULL, &len);
-
- RETURN_LONG(len);
-}
-/* }}} */
-
-/* Main User Functions */
-
-/* {{{ proto void odbc_close_all(void)
- Close all ODBC connections */
-PHP_FUNCTION(odbc_close_all)
-{
- void *ptr;
- int type;
- int i;
- int nument;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- nument = zend_hash_next_free_element(&EG(regular_list));
-
- /* Loop through list and close all statements */
- for(i = 1; i < nument; i++) {
- ptr = zend_list_find(i, &type);
- if (ptr && (type == le_result)){
- zend_list_delete(i);
- }
- }
-
- /* Second loop through list, now close all connections */
- nument = zend_hash_next_free_element(&EG(regular_list));
-
- for(i = 1; i < nument; i++) {
- ptr = zend_list_find(i, &type);
- if (ptr){
- if(type == le_conn){
- zend_list_delete(i);
- }else if(type == le_pconn){
- zend_list_delete(i);
- /* Delete the persistent connection */
- zend_hash_apply_with_argument(&EG(persistent_list),
- (apply_func_arg_t) _close_pconn_with_id, (void *) &i TSRMLS_CC);
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ proto int odbc_binmode(int result_id, int mode)
- Handle binary column data */
-PHP_FUNCTION(odbc_binmode)
-{
- php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int odbc_longreadlen(int result_id, int length)
- Handle LONG columns */
-PHP_FUNCTION(odbc_longreadlen)
-{
- php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int odbc_prepare(int connection_id, string query)
- Prepares a statement for execution */
-PHP_FUNCTION(odbc_prepare)
-{
- pval **pv_conn, **pv_query;
- char *query;
- odbc_result *result = NULL;
- odbc_connection *conn;
- RETCODE rc;
-#ifdef HAVE_SQL_EXTENDED_FETCH
- UDWORD scrollopts;
-#endif
-
- if (zend_get_parameters_ex(2, &pv_conn, &pv_query) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- convert_to_string_ex(pv_query);
- query = Z_STRVAL_PP(pv_query);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
-
- result->numparams = 0;
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- /* Solid doesn't have ExtendedFetch, if DriverManager is used, get Info,
- whether Driver supports ExtendedFetch */
- rc = SQLGetInfo(conn->hdbc, SQL_FETCH_DIRECTION, (void *) &scrollopts, sizeof(scrollopts), NULL);
- if (rc == SQL_SUCCESS) {
- if ((result->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE))) {
- /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other
- type if not possible.
- */
- if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC)
- == SQL_ERROR) {
- odbc_sql_error(conn, result->stmt, " SQLSetStmtOption");
- SQLFreeStmt(result->stmt, SQL_DROP);
- efree(result);
- RETURN_FALSE;
- }
- }
- } else {
- result->fetch_abs = 0;
- }
-#endif
-
- rc = SQLPrepare(result->stmt, query, SQL_NTS);
- switch (rc) {
- case SQL_SUCCESS:
- break;
- case SQL_SUCCESS_WITH_INFO:
- odbc_sql_error(conn, result->stmt, "SQLPrepare");
- break;
- default:
- odbc_sql_error(conn, result->stmt, "SQLPrepare");
- RETURN_FALSE;
- }
-
- SQLNumParams(result->stmt, &(result->numparams));
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result TSRMLS_CC)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->id = zend_list_insert(result, le_result);
- zend_list_addref(conn->id);
- result->conn_ptr = conn;
- result->fetched = 0;
- RETURN_RESOURCE(result->id);
-}
-/* }}} */
-
-/*
- * Execute prepared SQL statement. Supports only input parameters.
- */
-
-/* {{{ proto int odbc_execute(int result_id [, array parameters_array])
- Execute a prepared statement */
-PHP_FUNCTION(odbc_execute)
-{
- pval **pv_res, **pv_param_arr, **tmp;
- typedef struct params_t {
- SDWORD vallen;
- int fp;
- } params_t;
- params_t *params = NULL;
- char *filename;
- unsigned char otype;
- SWORD sqltype, ctype, scale;
- SWORD nullable;
- UDWORD precision;
- odbc_result *result;
- int numArgs, i, ne;
- RETCODE rc;
-
- numArgs = ZEND_NUM_ARGS();
- switch(numArgs) {
- case 1:
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &pv_res, &pv_param_arr) == FAILURE)
- WRONG_PARAM_COUNT;
- if (Z_TYPE_PP(pv_param_arr) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No array passed");
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- /* XXX check for already bound parameters*/
- if (result->numparams > 0 && numArgs == 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No parameters to SQL statement given");
- RETURN_FALSE;
- }
-
- if (result->numparams > 0) {
- if ((ne = zend_hash_num_elements(Z_ARRVAL_PP(pv_param_arr))) < result->numparams) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Not enough parameters (%d should be %d) given", ne, result->numparams);
- RETURN_FALSE;
- }
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(pv_param_arr));
- params = (params_t *)emalloc(sizeof(params_t) * result->numparams);
-
- for(i = 1; i <= result->numparams; i++) {
- if (zend_hash_get_current_data(Z_ARRVAL_PP(pv_param_arr), (void **) &tmp) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error getting parameter");
- SQLFreeStmt(result->stmt,SQL_RESET_PARAMS);
- efree(params);
- RETURN_FALSE;
- }
-
- otype = (*tmp)->type;
- convert_to_string(*tmp);
- if (Z_TYPE_PP(tmp) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error converting parameter");
- SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
- efree(params);
- RETURN_FALSE;
- }
-
- SQLDescribeParam(result->stmt, (UWORD)i, &sqltype, &precision,
- &scale, &nullable);
- params[i-1].vallen = Z_STRLEN_PP(tmp);
- params[i-1].fp = -1;
-
- if (IS_SQL_BINARY(sqltype))
- ctype = SQL_C_BINARY;
- else
- ctype = SQL_C_CHAR;
-
- if (Z_STRLEN_PP(tmp) > 2 &&
- Z_STRVAL_PP(tmp)[0] == '\'' &&
- Z_STRVAL_PP(tmp)[Z_STRLEN_PP(tmp) - 1] == '\'') {
- filename = estrndup(&Z_STRVAL_PP(tmp)[1], Z_STRLEN_PP(tmp) - 2);
- filename[strlen(filename)] = '\0';
-
- /* Check for safe mode. */
- if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- /* Check the basedir */
- if (php_check_open_basedir(filename TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if ((params[i-1].fp = open(filename,O_RDONLY)) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Can't open file %s", filename);
- SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
- for(i = 0; i < result->numparams; i++) {
- if (params[i].fp != -1) {
- close(params[i].fp);
- }
- }
- efree(params);
- efree(filename);
- RETURN_FALSE;
- }
-
- efree(filename);
-
- params[i-1].vallen = SQL_LEN_DATA_AT_EXEC(0);
-
- rc = SQLBindParameter(result->stmt, (UWORD)i, SQL_PARAM_INPUT,
- ctype, sqltype, precision, scale,
- (void *)params[i-1].fp, 0,
- &params[i-1].vallen);
- } else {
-#ifdef HAVE_DBMAKER
- precision = params[i-1].vallen;
-#endif
- if (otype == IS_NULL) {
- params[i-1].vallen = SQL_NULL_DATA;
- }
-
- rc = SQLBindParameter(result->stmt, (UWORD)i, SQL_PARAM_INPUT,
- ctype, sqltype, precision, scale,
- Z_STRVAL_PP(tmp), 0,
- &params[i-1].vallen);
- }
- zend_hash_move_forward(Z_ARRVAL_PP(pv_param_arr));
- }
- }
- /* Close cursor, needed for doing multiple selects */
- rc = SQLFreeStmt(result->stmt, SQL_CLOSE);
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLFreeStmt");
- }
-
- rc = SQLExecute(result->stmt);
-
- result->fetched = 0;
- if (rc == SQL_NEED_DATA) {
- char buf[4096];
- int fp, nbytes;
- while(rc == SQL_NEED_DATA) {
- rc = SQLParamData(result->stmt, (void*)&fp);
- if (rc == SQL_NEED_DATA) {
- while((nbytes = read(fp, &buf, 4096)) > 0)
- SQLPutData(result->stmt, (void*)&buf, nbytes);
- }
- }
- } else {
- switch (rc) {
- case SQL_SUCCESS:
- break;
- case SQL_NO_DATA_FOUND:
- case SQL_SUCCESS_WITH_INFO:
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute");
- break;
- default:
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute");
- RETVAL_FALSE;
- }
- }
-
- if (result->numparams > 0) {
- SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
- for(i = 0; i < result->numparams; i++) {
- if (params[i].fp != -1)
- close(params[i].fp);
- }
- efree(params);
- }
-
- if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO || rc == SQL_NO_DATA_FOUND) {
- RETVAL_TRUE;
- }
-
- if (result->numcols == 0) {
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result TSRMLS_CC)) {
- efree(result);
- RETVAL_FALSE;
- }
- } else {
- result->values = NULL;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string odbc_cursor(int result_id)
- Get cursor name */
-PHP_FUNCTION(odbc_cursor)
-{
- pval **pv_res;
- SWORD len, max_len;
- char *cursorname;
- odbc_result *result;
- RETCODE rc;
-
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- rc = SQLGetInfo(result->conn_ptr->hdbc,SQL_MAX_CURSOR_NAME_LEN,
- (void *)&max_len,sizeof(max_len),&len);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- RETURN_FALSE;
- }
-
- if (max_len > 0) {
- cursorname = emalloc(max_len + 1);
- rc = SQLGetCursorName(result->stmt,cursorname,(SWORD)max_len,&len);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- char state[6]; /* Not used */
- SDWORD error; /* Not used */
- char errormsg[255];
- SWORD errormsgsize; /* Not used */
-
- SQLError( result->conn_ptr->henv, result->conn_ptr->hdbc,
- result->stmt, state, &error, errormsg,
- sizeof(errormsg)-1, &errormsgsize);
- if (!strncmp(state,"S1015",5)) {
- sprintf(cursorname,"php_curs_%d", (int)result->stmt);
- if (SQLSetCursorName(result->stmt,cursorname,SQL_NTS) != SQL_SUCCESS) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLSetCursorName");
- RETVAL_FALSE;
- } else {
- RETVAL_STRING(cursorname,1);
- }
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQL error: %s, SQL state %s", errormsg, state);
- RETVAL_FALSE;
- }
- } else {
- RETVAL_STRING(cursorname,1);
- }
- efree(cursorname);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-#ifdef HAVE_SQLDATASOURCES
-/* {{{ proto array odbc_data_source(int connection_id, int fetch_type)
- Return information about the currently connected data source */
-PHP_FUNCTION(odbc_data_source)
-{
- zval **zv_fetch_type, **zv_conn;
- RETCODE rc = 0; /* assume all is good */
- odbc_connection *conn;
- int num_args = ZEND_NUM_ARGS();
- UCHAR server_name[100],
- desc[200];
- SQLSMALLINT len1=0, len2=0, fetch_type;
-
- if (num_args != 2) {
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(2, &zv_conn, &zv_fetch_type) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to get parameters");
- RETURN_FALSE;
- }
-
- convert_to_long_ex(zv_fetch_type);
- fetch_type = (SQLSMALLINT)Z_LVAL_PP(zv_fetch_type);
-
- if (!(fetch_type == SQL_FETCH_FIRST ||
- fetch_type == SQL_FETCH_NEXT)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid fetch type (%d)", fetch_type);
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, zv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- /* now we have the "connection" lets call the DataSource object */
- rc = SQLDataSources(conn->henv,
- fetch_type,
- server_name,
- (SQLSMALLINT)sizeof(server_name),
- &len1,
- desc,
- (SQLSMALLINT)sizeof(desc),
- &len2);
-
- if (rc != SQL_SUCCESS) {
- /* ummm.... he did it */
- odbc_sql_error(conn, NULL, "SQLDataSources");
- RETURN_FALSE;
- }
-
- if (len1 == 0 || len2 == 0) {
- /* we have a non-valid entry... so stop the looping */
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- add_assoc_stringl_ex(return_value, "server", sizeof("server"), server_name, len1, 1);
- add_assoc_stringl_ex(return_value, "description", sizeof("description"), desc, len2, 1);
-
-}
-/* }}} */
-#endif /* HAVE_SQLDATASOURCES *
-
-/* {{{ proto int odbc_exec(int connection_id, string query [, int flags])
- Prepare and execute an SQL statement */
-/* XXX Use flags */
-PHP_FUNCTION(odbc_exec)
-{
- pval **pv_conn, **pv_query, **pv_flags;
- int numArgs;
- char *query;
- odbc_result *result = NULL;
- odbc_connection *conn;
- RETCODE rc;
-#ifdef HAVE_SQL_EXTENDED_FETCH
- UDWORD scrollopts;
-#endif
-
- numArgs = ZEND_NUM_ARGS();
- if (numArgs > 2) {
- if (zend_get_parameters_ex(3, &pv_conn, &pv_query, &pv_flags) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(pv_flags);
- } else {
- if (zend_get_parameters_ex(2, &pv_conn, &pv_query) == FAILURE)
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- convert_to_string_ex(pv_query);
- query = Z_STRVAL_PP(pv_query);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
- efree(result);
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- /* Solid doesn't have ExtendedFetch, if DriverManager is used, get Info,
- whether Driver supports ExtendedFetch */
- rc = SQLGetInfo(conn->hdbc, SQL_FETCH_DIRECTION, (void *) &scrollopts, sizeof(scrollopts), NULL);
- if (rc == SQL_SUCCESS) {
- if ((result->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE))) {
- /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other
- type if not possible.
- */
- if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC)
- == SQL_ERROR) {
- odbc_sql_error(conn, result->stmt, " SQLSetStmtOption");
- SQLFreeStmt(result->stmt, SQL_DROP);
- efree(result);
- RETURN_FALSE;
- }
- }
- } else {
- result->fetch_abs = 0;
- }
-#endif
-
- rc = SQLExecDirect(result->stmt, query, SQL_NTS);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO && rc != SQL_NO_DATA_FOUND) {
- /* XXX FIXME we should really check out SQLSTATE with SQLError
- * in case rc is SQL_SUCCESS_WITH_INFO here.
- */
- odbc_sql_error(conn, result->stmt, "SQLExecDirect");
- SQLFreeStmt(result->stmt, SQL_DROP);
- efree(result);
- RETURN_FALSE;
- }
-
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- /* For insert, update etc. cols == 0 */
- if (result->numcols > 0) {
- if (!odbc_bindcols(result TSRMLS_CC)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->id = zend_list_insert(result, le_result);
- zend_list_addref(conn->id);
- result->conn_ptr = conn;
- result->fetched = 0;
-
- RETURN_RESOURCE(result->id);
-}
-/* }}} */
-
-#ifdef PHP_ODBC_HAVE_FETCH_HASH
-#define ODBC_NUM 1
-#define ODBC_OBJECT 2
-
-/* {{{ php_odbc_fetch_hash */
-static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
-{
- int i;
- odbc_result *result;
- RETCODE rc;
- SWORD sql_c_type;
- char *buf = NULL;
-#ifdef HAVE_SQL_EXTENDED_FETCH
- UDWORD crow;
- UWORD RowStatus[1];
- SDWORD rownum = -1;
- pval **pv_res, **pv_row, *tmp;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &pv_res, &pv_row) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pv_row);
- rownum = Z_LVAL_PP(pv_row);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
-#else
- pval **pv_res, *tmp;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pv_res) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-#endif
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs) {
- if (rownum > 0)
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus);
- else
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
- } else
-#endif
- rc = SQLFetch(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (rownum > 0 && result->fetch_abs)
- result->fetched = rownum;
- else
-#endif
- result->fetched++;
-
- for(i = 0; i < result->numcols; i++) {
- ALLOC_INIT_ZVAL(tmp);
- Z_TYPE_P(tmp) = IS_STRING;
- Z_STRLEN_P(tmp) = 0;
- sql_c_type = SQL_C_CHAR;
-
- switch(result->values[i].coltype) {
- case SQL_BINARY:
- case SQL_VARBINARY:
- case SQL_LONGVARBINARY:
- if (result->binmode <= 0) {
- Z_STRVAL_P(tmp) = empty_string;
- break;
- }
- if (result->binmode == 1) sql_c_type = SQL_C_BINARY;
- case SQL_LONGVARCHAR:
- if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) {
- Z_STRVAL_P(tmp) = empty_string;
- break;
- }
- if (buf == NULL) buf = emalloc(result->longreadlen + 1);
- rc = SQLGetData(result->stmt, (UWORD)(i + 1), sql_c_type,
- buf, result->longreadlen + 1, &result->values[i].vallen);
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData");
- efree(buf);
- RETURN_FALSE;
- }
-
- if (rc == SQL_SUCCESS_WITH_INFO) {
- Z_STRLEN_P(tmp) = result->longreadlen;
- } else if (result->values[i].vallen == SQL_NULL_DATA) {
- Z_STRVAL_P(tmp) = empty_string;
- break;
- } else {
- Z_STRLEN_P(tmp) = result->values[i].vallen;
- }
- Z_STRVAL_P(tmp) = estrndup(buf, Z_STRLEN_P(tmp));
- break;
-
- default:
- if (result->values[i].vallen == SQL_NULL_DATA) {
- Z_STRVAL_P(tmp) = empty_string;
- break;
- }
- Z_STRLEN_P(tmp) = result->values[i].vallen;
- Z_STRVAL_P(tmp) = estrndup(result->values[i].value,Z_STRLEN_P(tmp));
- break;
- }
-
- if (result_type & ODBC_NUM) {
- zend_hash_index_update(Z_ARRVAL_P(return_value), i, &tmp, sizeof(pval *), NULL);
- } else {
- zend_hash_update(Z_ARRVAL_P(return_value), result->values[i].name,
- strlen(result->values[i].name)+1, &tmp, sizeof(pval *), NULL);
- }
- }
- if (buf) efree(buf);
-}
-/* }}} */
-
-
-/* {{{ proto object odbc_fetch_object(int result [, int rownumber])
- Fetch a result row as an object */
-PHP_FUNCTION(odbc_fetch_object)
-{
- php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, ODBC_OBJECT);
- if (Z_TYPE_P(return_value) == IS_ARRAY) {
- object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value));
- }
-}
-/* }}} */
-
-/* {{{ proto array odbc_fetch_array(int result [, int rownumber])
- Fetch a result row as an associative array */
-PHP_FUNCTION(odbc_fetch_array)
-{
- php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, ODBC_OBJECT);
-}
-/* }}} */
-#endif
-
-/* {{{ proto int odbc_fetch_into(int result_id, array result_array, [, int rownumber])
- Fetch one result row into an array */
-PHP_FUNCTION(odbc_fetch_into)
-{
- int numArgs, i;
- odbc_result *result;
- RETCODE rc;
- SWORD sql_c_type;
- char *buf = NULL;
- pval **pv_res, **pv_res_arr, *tmp;
-#ifdef HAVE_SQL_EXTENDED_FETCH
- pval **pv_row;
- UDWORD crow;
- UWORD RowStatus[1];
- SDWORD rownum = -1;
-#endif /* HAVE_SQL_EXTENDED_FETCH */
-
- numArgs = ZEND_NUM_ARGS();
-
- switch(numArgs) {
- case 2:
- if (zend_get_parameters_ex(2, &pv_res, &pv_res_arr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
-#ifdef HAVE_SQL_EXTENDED_FETCH
- case 3:
- if (zend_get_parameters_ex(3, &pv_res, &pv_res_arr, &pv_row) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- SEPARATE_ZVAL(pv_row);
- convert_to_long_ex(pv_row);
- rownum = Z_LVAL_PP(pv_row);
- break;
-#endif /* HAVE_SQL_EXTENDED_FETCH */
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- if (Z_TYPE_PP(pv_res_arr) != IS_ARRAY) {
- array_init(*pv_res_arr);
- }
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs) {
- if (rownum > 0)
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus);
- else
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
- } else
-#endif
- rc = SQLFetch(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
- RETURN_FALSE;
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (rownum > 0 && result->fetch_abs)
- result->fetched = rownum;
- else
-#endif
- result->fetched++;
-
- for(i = 0; i < result->numcols; i++) {
- ALLOC_ZVAL(tmp);
- tmp->refcount = 1;
- Z_TYPE_P(tmp) = IS_STRING;
- Z_STRLEN_P(tmp) = 0;
- sql_c_type = SQL_C_CHAR;
-
- switch(result->values[i].coltype) {
- case SQL_BINARY:
- case SQL_VARBINARY:
- case SQL_LONGVARBINARY:
- if (result->binmode <= 0) {
- Z_STRVAL_P(tmp) = empty_string;
- break;
- }
- if (result->binmode == 1) sql_c_type = SQL_C_BINARY;
- case SQL_LONGVARCHAR:
- if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) {
- Z_STRVAL_P(tmp) = empty_string;
- break;
- }
-
- if (buf == NULL) buf = emalloc(result->longreadlen + 1);
- rc = SQLGetData(result->stmt, (UWORD)(i + 1),sql_c_type,
- buf, result->longreadlen + 1, &result->values[i].vallen);
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData");
- efree(buf);
- RETURN_FALSE;
- }
- if (rc == SQL_SUCCESS_WITH_INFO) {
- Z_STRLEN_P(tmp) = result->longreadlen;
- } else if (result->values[i].vallen == SQL_NULL_DATA) {
- ZVAL_NULL(tmp);
- break;
- } else {
- Z_STRLEN_P(tmp) = result->values[i].vallen;
- }
- Z_STRVAL_P(tmp) = estrndup(buf, Z_STRLEN_P(tmp));
- break;
-
- default:
- if (result->values[i].vallen == SQL_NULL_DATA) {
- ZVAL_NULL(tmp);
- break;
- }
- Z_STRLEN_P(tmp) = result->values[i].vallen;
- Z_STRVAL_P(tmp) = estrndup(result->values[i].value,Z_STRLEN_P(tmp));
- break;
- }
- zend_hash_index_update(Z_ARRVAL_PP(pv_res_arr), i, &tmp, sizeof(pval *), NULL);
- }
- if (buf) efree(buf);
- RETURN_LONG(result->numcols);
-}
-/* }}} */
-
-/* {{{ solid_fetch_prev */
-#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35)
-PHP_FUNCTION(solid_fetch_prev)
-{
- odbc_result *result;
- RETCODE rc;
- pval **pv_res;
-
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
- if (result->numcols == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
- rc = SQLFetchPrev(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- RETURN_FALSE;
- }
-
- if (result->fetched > 1) result->fetched--;
-
- RETURN_TRUE;
-}
-#endif
-/* }}} */
-
-/* {{{ proto int odbc_fetch_row(int result_id [, int row_number])
- Fetch a row */
-PHP_FUNCTION(odbc_fetch_row)
-{
- int numArgs;
- SDWORD rownum = 1;
- odbc_result *result;
- RETCODE rc;
- pval **pv_res, **pv_row;
-#ifdef HAVE_SQL_EXTENDED_FETCH
- UDWORD crow;
- UWORD RowStatus[1];
-#endif
-
- numArgs = ZEND_NUM_ARGS();
- switch (numArgs) {
- case 1:
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &pv_res, &pv_row) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(pv_row);
- rownum = Z_LVAL_PP(pv_row);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs) {
- if (numArgs > 1)
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus);
- else
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
- } else
-#endif
- rc = SQLFetch(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- RETURN_FALSE;
- }
-
- if (numArgs > 1) {
- result->fetched = rownum;
- } else {
- result->fetched++;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string odbc_result(int result_id, mixed field)
- Get result data */
-PHP_FUNCTION(odbc_result)
-{
- char *field;
- int field_ind;
- SWORD sql_c_type = SQL_C_CHAR;
- odbc_result *result;
- int i = 0;
- RETCODE rc;
- SDWORD fieldsize;
- pval **pv_res, **pv_field;
-#ifdef HAVE_SQL_EXTENDED_FETCH
- UDWORD crow;
- UWORD RowStatus[1];
-#endif
-
- field_ind = -1;
- field = NULL;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2 , &pv_res, &pv_field) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(pv_field) == IS_STRING) {
- field = Z_STRVAL_PP(pv_field);
- } else {
- convert_to_long_ex(pv_field);
- field_ind = Z_LVAL_PP(pv_field) - 1;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if ((result->numcols == 0)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- /* get field index if the field parameter was a string */
- if (field != NULL) {
- if (result->values == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Result set contains no data");
- RETURN_FALSE;
- }
-
- for(i = 0; i < result->numcols; i++) {
- if (!strcasecmp(result->values[i].name, field)) {
- field_ind = i;
- break;
- }
- }
-
- if (field_ind < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %s not found", field);
- RETURN_FALSE;
- }
- } else {
- /* check for limits of field_ind if the field parameter was an int */
- if (field_ind >= result->numcols || field_ind < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field index is larger than the number of fields");
- RETURN_FALSE;
- }
- }
-
- if (result->fetched == 0) {
- /* User forgot to call odbc_fetch_row(), or wants to reload the results, do it now */
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs)
- rc = SQLExtendedFetch(result->stmt, SQL_FETCH_NEXT, 1, &crow,RowStatus);
- else
-#endif
- rc = SQLFetch(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
- RETURN_FALSE;
-
- result->fetched++;
- }
-
- switch(result->values[field_ind].coltype) {
- case SQL_BINARY:
- case SQL_VARBINARY:
- case SQL_LONGVARBINARY:
- if (result->binmode <= 1) sql_c_type = SQL_C_BINARY;
- if (result->binmode <= 0) break;
- case SQL_LONGVARCHAR:
- if (IS_SQL_LONG(result->values[field_ind].coltype)) {
- if (result->longreadlen <= 0)
- break;
- else
- fieldsize = result->longreadlen;
- } else {
- SQLColAttributes(result->stmt, (UWORD)(field_ind + 1),
- (UWORD)((sql_c_type == SQL_C_BINARY) ? SQL_COLUMN_LENGTH :
- SQL_COLUMN_DISPLAY_SIZE),
- NULL, 0, NULL, &fieldsize);
- }
- /* For char data, the length of the returned string will be longreadlen - 1 */
- fieldsize = (result->longreadlen <= 0) ? 4096 : result->longreadlen;
- field = emalloc(fieldsize);
-
- /* SQLGetData will truncate CHAR data to fieldsize - 1 bytes and append \0.
- * For binary data it is truncated to fieldsize bytes.
- */
- rc = SQLGetData(result->stmt, (UWORD)(field_ind + 1), sql_c_type,
- field, fieldsize, &result->values[field_ind].vallen);
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData");
- efree(field);
- RETURN_FALSE;
- }
-
- if (result->values[field_ind].vallen == SQL_NULL_DATA || rc == SQL_NO_DATA_FOUND) {
- efree(field);
- RETURN_FALSE;
- }
- /* Reduce fieldlen by 1 if we have char data. One day we might
- have binary strings... */
- if (result->values[field_ind].coltype == SQL_LONGVARCHAR) fieldsize -= 1;
- /* Don't duplicate result, saves one emalloc.
- For SQL_SUCCESS, the length is in vallen.
- */
- RETURN_STRINGL(field, (rc == SQL_SUCCESS_WITH_INFO) ? fieldsize :
- result->values[field_ind].vallen, 0);
- break;
-
- default:
- if (result->values[field_ind].vallen == SQL_NULL_DATA) {
- RETURN_FALSE;
- } else {
- RETURN_STRINGL(result->values[field_ind].value, result->values[field_ind].vallen, 1);
- }
- break;
- }
-
-/* If we come here, output unbound LONG and/or BINARY column data to the client */
-
- /* We emalloc 1 byte more for SQL_C_CHAR (trailing \0) */
- fieldsize = (sql_c_type == SQL_C_CHAR) ? 4096 : 4095;
- field = emalloc(fieldsize);
-
- /* Call SQLGetData() until SQL_SUCCESS is returned */
- while(1) {
- rc = SQLGetData(result->stmt, (UWORD)(field_ind + 1),sql_c_type,
- field, fieldsize, &result->values[field_ind].vallen);
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData");
- efree(field);
- RETURN_FALSE;
- }
-
- if (result->values[field_ind].vallen == SQL_NULL_DATA) {
- efree(field);
- RETURN_FALSE;
- }
- /* chop the trailing \0 by outputing only 4095 bytes */
- PHPWRITE(field,(rc == SQL_SUCCESS_WITH_INFO) ? 4095 :
- result->values[field_ind].vallen);
-
- if (rc == SQL_SUCCESS) { /* no more data avail */
- efree(field);
- RETURN_TRUE;
- }
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int odbc_result_all(int result_id [, string format])
- Print result as HTML table */
-PHP_FUNCTION(odbc_result_all)
-{
- char *buf = NULL;
- int i, numArgs;
- odbc_result *result;
- RETCODE rc;
- pval **pv_res, **pv_format;
- SWORD sql_c_type;
-#ifdef HAVE_SQL_EXTENDED_FETCH
- UDWORD crow;
- UWORD RowStatus[1];
-#endif
-
- numArgs = ZEND_NUM_ARGS();
- if (numArgs == 1) {
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE)
- WRONG_PARAM_COUNT;
- } else {
- if (zend_get_parameters_ex(2, &pv_res, &pv_format) == FAILURE)
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs)
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
- else
-#endif
- rc = SQLFetch(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- php_printf("<h2>No rows found</h2>\n");
- RETURN_LONG(0);
- }
-
- /* Start table tag */
- if (numArgs == 1) {
- php_printf("<table><tr>");
- } else {
- convert_to_string_ex(pv_format);
- php_printf("<table %s ><tr>",Z_STRVAL_PP(pv_format));
- }
-
- for(i = 0; i < result->numcols; i++)
- php_printf("<th>%s</th>", result->values[i].name);
-
- php_printf("</tr>\n");
-
- while(rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) {
- result->fetched++;
- php_printf("<tr>");
- for(i = 0; i < result->numcols; i++) {
- sql_c_type = SQL_C_CHAR;
- switch(result->values[i].coltype) {
- case SQL_BINARY:
- case SQL_VARBINARY:
- case SQL_LONGVARBINARY:
- if (result->binmode <= 0) {
- php_printf("<td>Not printable</td>");
- break;
- }
- if (result->binmode <= 1) sql_c_type = SQL_C_BINARY;
- case SQL_LONGVARCHAR:
- if (IS_SQL_LONG(result->values[i].coltype) &&
- result->longreadlen <= 0) {
- php_printf("<td>Not printable</td>");
- break;
- }
-
- if (buf == NULL) buf = emalloc(result->longreadlen);
-
- rc = SQLGetData(result->stmt, (UWORD)(i + 1),sql_c_type,
- buf, result->longreadlen, &result->values[i].vallen);
-
- php_printf("<td>");
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData");
- php_printf("</td></tr></table>");
- efree(buf);
- RETURN_FALSE;
- }
- if (rc == SQL_SUCCESS_WITH_INFO)
- php_printf(buf,result->longreadlen);
- else if (result->values[i].vallen == SQL_NULL_DATA) {
- php_printf("&nbsp;</td>");
- break;
- } else {
- php_printf(buf, result->values[i].vallen);
- }
- php_printf("</td>");
- break;
- default:
- if (result->values[i].vallen == SQL_NULL_DATA) {
- php_printf("<td>&nbsp;</td>");
- } else {
- php_printf("<td>%s</td>", result->values[i].value);
- }
- break;
- }
- }
- php_printf("</tr>\n");
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs)
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
- else
-#endif
- rc = SQLFetch(result->stmt);
- }
- php_printf("</table>\n");
- if (buf) efree(buf);
- RETURN_LONG(result->fetched);
-}
-/* }}} */
-
-/* {{{ proto int odbc_free_result(int result_id)
- Free resources associated with a result */
-PHP_FUNCTION(odbc_free_result)
-{
- pval **pv_res;
- odbc_result *result;
- int i;
-
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
- if (result->values) {
- for (i = 0; i < result->numcols; i++) {
- if (result->values[i].value) {
- efree(result->values[i].value);
- }
- }
- efree(result->values);
- result->values = NULL;
- }
-
- zend_list_delete(result->id);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int odbc_connect(string DSN, string user, string password [, int cursor_option])
- Connect to a datasource */
-PHP_FUNCTION(odbc_connect)
-{
- odbc_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int odbc_pconnect(string DSN, string user, string password [, int cursor_option])
- Establish a persistent connection to a datasource */
-PHP_FUNCTION(odbc_pconnect)
-{
- odbc_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ odbc_sqlconnect */
-int odbc_sqlconnect(odbc_connection **conn, char *db, char *uid, char *pwd, int cur_opt, int persistent TSRMLS_DC)
-{
- RETCODE rc;
-
- *conn = (odbc_connection *)pemalloc(sizeof(odbc_connection), persistent);
- (*conn)->persistent = persistent;
- SQLAllocEnv(&((*conn)->henv));
- SQLAllocConnect((*conn)->henv, &((*conn)->hdbc));
-
-#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30)
- SQLSetConnectOption((*conn)->hdbc, SQL_TRANSLATE_OPTION,
- SQL_SOLID_XLATOPT_NOCNV);
-#endif
-#ifdef HAVE_OPENLINK
- {
- char dsnbuf[300];
- short dsnbuflen;
-
- rc = SQLDriverConnect((*conn)->hdbc, NULL, db, SQL_NTS,
- dsnbuf, sizeof(dsnbuf) - 1, &dsnbuflen,
- SQL_DRIVER_NOPROMPT);
- }
-#else
- if (cur_opt != SQL_CUR_DEFAULT) {
- rc = SQLSetConnectOption((*conn)->hdbc, SQL_ODBC_CURSORS, cur_opt);
- if (rc != SQL_SUCCESS) { /* && rc != SQL_SUCCESS_WITH_INFO ? */
- odbc_sql_error(*conn, SQL_NULL_HSTMT, "SQLSetConnectOption");
- SQLFreeConnect((*conn)->hdbc);
- pefree(*conn, persistent);
- return FALSE;
- }
- }
-/* Possible fix for bug #10250
- * Needs testing on UnixODBC < 2.0.5 though. */
-#if defined(HAVE_EMPRESS) || defined(HAVE_UNIXODBC) || defined(PHP_WIN32)
-/* * Uncomment the line above, and comment line below to fully test
- * #ifdef HAVE_EMPRESS */
- {
- int direct = 0;
- char dsnbuf[300];
- short dsnbuflen;
- char *ldb = 0;
- int ldb_len = 0;
-
- if (strstr((char*)db, ";")) {
- direct = 1;
- if (uid && !strstr ((char*)db, "uid") && !strstr((char*)db, "UID")) {
- ldb = (char*) emalloc(strlen(db) + strlen(uid) + strlen(pwd) + 12);
- sprintf(ldb, "%s;UID=%s;PWD=%s", db, uid, pwd);
- } else {
- ldb_len = strlen(db)+1;
- ldb = (char*) emalloc(ldb_len);
- memcpy(ldb, db, ldb_len);
- }
- }
-
- if (direct)
- rc = SQLDriverConnect((*conn)->hdbc, NULL, ldb, strlen(ldb), dsnbuf, 300,
- &dsnbuflen, SQL_DRIVER_NOPROMPT);
- else
- rc = SQLConnect((*conn)->hdbc, db, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS);
- if (ldb)
- efree(ldb);
- }
-#else
- rc = SQLConnect((*conn)->hdbc, db, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS);
-#endif
-#endif
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- odbc_sql_error(*conn, SQL_NULL_HSTMT, "SQLConnect");
- SQLFreeConnect((*conn)->hdbc);
- pefree((*conn), persistent);
- return FALSE;
- }
-/* (*conn)->open = 1;*/
- return TRUE;
-}
-/* }}} */
-
-/* Persistent connections: two list-types le_pconn, le_conn and a plist
- * where hashed connection info is stored together with index pointer to
- * the actual link of type le_pconn in the list. Only persistent
- * connections get hashed up. Normal connections use existing pconnections.
- * Maybe this has to change with regard to transactions on pconnections?
- * Possibly set autocommit to on on request shutdown.
- *
- * We do have to hash non-persistent connections, and reuse connections.
- * In the case where two connects were being made, without closing the first
- * connect, access violations were occuring. This is because some of the
- * "globals" in this module should actualy be per-connection variables. I
- * simply fixed things to get them working for now. Shane
- */
-/* {{{ odbc_do_connect */
-void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- char *db = NULL;
- char *uid = NULL;
- char *pwd = NULL;
- pval **pv_db, **pv_uid, **pv_pwd, **pv_opt;
- odbc_connection *db_conn;
- char *hashed_details;
- int hashed_len, cur_opt;
-
- /* Now an optional 4th parameter specifying the cursor type
- * defaulting to the cursors default
- */
- switch(ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &pv_db, &pv_uid, &pv_pwd) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* Use Default: Probably a better way to do this */
- cur_opt = SQL_CUR_DEFAULT;
- break;
- case 4:
- if (zend_get_parameters_ex(4, &pv_db, &pv_uid, &pv_pwd, &pv_opt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pv_opt);
- cur_opt = Z_LVAL_PP(pv_opt);
-
- /* Confirm the cur_opt range */
- if (! (cur_opt == SQL_CUR_USE_IF_NEEDED ||
- cur_opt == SQL_CUR_USE_ODBC ||
- cur_opt == SQL_CUR_USE_DRIVER ||
- cur_opt == SQL_CUR_DEFAULT) ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Cursor type (%d)", cur_opt);
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string_ex(pv_db);
- convert_to_string_ex(pv_uid);
- convert_to_string_ex(pv_pwd);
-
- db = Z_STRVAL_PP(pv_db);
- uid = Z_STRVAL_PP(pv_uid);
- pwd = Z_STRVAL_PP(pv_pwd);
-
- if (ODBCG(allow_persistent) <= 0) {
- persistent = 0;
- }
-
- hashed_len = spprintf(&hashed_details, 0, "%s_%s_%s_%s_%d", ODBC_TYPE, db, uid, pwd, cur_opt);
-
- /* FIXME the idea of checking to see if our connection is already persistent
- is good, but it adds a lot of overhead to non-persistent connections. We
- should look and see if we can fix that somehow */
- /* try to find if we already have this link in our persistent list,
- * no matter if it is to be persistent or not
- */
-
-try_and_get_another_connection:
-
- if (persistent) {
- list_entry *le;
-
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_len + 1, (void **) &le)
- == FAILURE) { /* the link is not in the persistent list */
- list_entry new_le;
-
- if (ODBCG(max_links) != -1 && ODBCG(num_links) >= ODBCG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)", ODBCG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (ODBCG(max_persistent) != -1 && ODBCG(num_persistent) >= ODBCG(max_persistent)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Too many open persistent links (%d)", ODBCG(num_persistent));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if (!odbc_sqlconnect(&db_conn, db, uid, pwd, cur_opt, 1 TSRMLS_CC)) {
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- Z_TYPE(new_le) = le_pconn;
- new_le.ptr = db_conn;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_len + 1, &new_le,
- sizeof(list_entry), NULL) == FAILURE) {
- free(db_conn);
- efree(hashed_details);
- RETURN_FALSE;
- }
- ODBCG(num_persistent)++;
- ODBCG(num_links)++;
- db_conn->id = ZEND_REGISTER_RESOURCE(return_value, db_conn, le_pconn);
- } else { /* found connection */
- if (Z_TYPE_P(le) != le_pconn) {
- RETURN_FALSE;
- }
- /*
- * check to see if the connection is still valid
- */
- db_conn = (odbc_connection *)le->ptr;
-
- /*
- * check to see if the connection is still in place (lurcher)
- */
- if(ODBCG(check_persistent)){
- RETCODE ret;
- UCHAR d_name[32];
- SWORD len;
-
- ret = SQLGetInfo(db_conn->hdbc,
- SQL_DATA_SOURCE_READ_ONLY,
- d_name, sizeof(d_name), &len);
-
- if(ret != SQL_SUCCESS || len == 0) {
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_len + 1);
- /* Commented out to fix a possible double closure error
- * when working with persistent connections as submitted by
- * bug #15758
- *
- * safe_odbc_disconnect(db_conn->hdbc);
- * SQLFreeConnect(db_conn->hdbc);
- */
- goto try_and_get_another_connection;
- }
- }
- }
- db_conn->id = ZEND_REGISTER_RESOURCE(return_value, db_conn, le_pconn);
- } else { /* non persistent */
- list_entry *index_ptr, new_index_ptr;
-
- if (zend_hash_find(&EG(regular_list), hashed_details, hashed_len + 1,
- (void **) &index_ptr) == SUCCESS) {
- int type, conn_id;
- void *ptr;
- if (Z_TYPE_P(index_ptr) != le_index_ptr) {
- RETURN_FALSE;
- }
- conn_id = (int)index_ptr->ptr;
- ptr = zend_list_find(conn_id, &type); /* check if the connection is still there */
- if (ptr && (type == le_conn || type == le_pconn)) {
- zend_list_addref(conn_id);
- Z_LVAL_P(return_value) = conn_id;
- Z_TYPE_P(return_value) = IS_RESOURCE;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list), hashed_details, hashed_len + 1);
- }
- }
- if (ODBCG(max_links) != -1 && ODBCG(num_links) >= ODBCG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Too many open connections (%d)",ODBCG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if (!odbc_sqlconnect(&db_conn, db, uid, pwd, cur_opt, 0 TSRMLS_CC)) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- db_conn->id = ZEND_REGISTER_RESOURCE(return_value, db_conn, le_conn);
- new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
- Z_TYPE(new_index_ptr) = le_index_ptr;
- if (zend_hash_update(&EG(regular_list), hashed_details, hashed_len + 1, (void *) &new_index_ptr,
- sizeof(list_entry), NULL) == FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- /* XXX Free Connection */
- }
- ODBCG(num_links)++;
- }
- efree(hashed_details);
-}
-/* }}} */
-
-/* {{{ proto void odbc_close(int connection_id)
- Close an ODBC connection */
-PHP_FUNCTION(odbc_close)
-{
- pval **pv_conn;
- void *ptr;
- odbc_connection *conn;
- odbc_result *res;
- int nument;
- int i;
- int type;
- int is_pconn = 0;
- int found_resource_type = le_conn;
-
- if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- conn = (odbc_connection *) zend_fetch_resource(pv_conn TSRMLS_CC, -1, "ODBC-Link", &found_resource_type, 2, le_conn, le_pconn);
- if (found_resource_type==le_pconn) {
- is_pconn = 1;
- }
-
- nument = zend_hash_next_free_element(&EG(regular_list));
-
- for(i = 1; i < nument; i++){
- ptr = zend_list_find(i, &type);
- if(ptr && (type == le_result)){
- res = (odbc_result *)ptr;
- if(res->conn_ptr == conn){
- zend_list_delete(i);
- }
- }
- }
-
- zend_list_delete(Z_LVAL_PP(pv_conn));
-
- if(is_pconn){
- zend_hash_apply_with_argument(&EG(persistent_list),
- (apply_func_arg_t) _close_pconn_with_id, (void *) &(Z_LVAL_PP(pv_conn)) TSRMLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ proto int odbc_num_rows(int result_id)
- Get number of rows in a result */
-PHP_FUNCTION(odbc_num_rows)
-{
- odbc_result *result;
- SDWORD rows;
- pval **pv_res;
-
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
- SQLRowCount(result->stmt, &rows);
- RETURN_LONG(rows);
-}
-/* }}} */
-
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
-/* {{{ proto bool odbc_next_result(int result_id)
- Checks if multiple results are avaiable */
-PHP_FUNCTION(odbc_next_result)
-{
- odbc_result *result;
- pval **pv_res;
- int rc, i;
-
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->values) {
- for(i = 0; i < result->numcols; i++) {
- if (result->values[i].value)
- efree(result->values[i].value);
- }
- efree(result->values);
- result->values = NULL;
- }
-
- result->fetched = 0;
- rc = SQLMoreResults(result->stmt);
- if (rc == SQL_SUCCESS) {
- RETURN_TRUE;
- }
- else if (rc == SQL_SUCCESS_WITH_INFO) {
- rc = SQLFreeStmt(result->stmt, SQL_UNBIND);
- SQLNumParams(result->stmt, &(result->numparams));
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result TSRMLS_CC)) {
- efree(result);
- RETVAL_FALSE;
- }
- } else {
- result->values = NULL;
- }
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-#endif
-
-/* {{{ proto int odbc_num_fields(int result_id)
- Get number of columns in a result */
-PHP_FUNCTION(odbc_num_fields)
-{
- odbc_result *result;
- pval **pv_res;
-
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
- RETURN_LONG(result->numcols);
-}
-/* }}} */
-
-/* {{{ proto string odbc_field_name(int result_id, int field_number)
- Get a column name */
-PHP_FUNCTION(odbc_field_name)
-{
- odbc_result *result;
- pval **pv_res, **pv_num;
-
- if (zend_get_parameters_ex(2, &pv_res, &pv_num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(pv_num);
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- if (Z_LVAL_PP(pv_num) > result->numcols) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field index larger than number of fields");
- RETURN_FALSE;
- }
-
- if (Z_LVAL_PP(pv_num) < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field numbering starts at 1");
- RETURN_FALSE;
- }
-
- RETURN_STRING(result->values[Z_LVAL_PP(pv_num) - 1].name, 1)
-}
-/* }}} */
-
-/* {{{ proto string odbc_field_type(int result_id, int field_number)
- Get the datatype of a column */
-PHP_FUNCTION(odbc_field_type)
-{
- odbc_result *result;
- char tmp[32];
- SWORD tmplen;
- pval **pv_res, **pv_num;
-
- if (zend_get_parameters_ex(2, &pv_res, &pv_num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(pv_num);
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- if (Z_LVAL_PP(pv_num) > result->numcols) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field index larger than number of fields");
- RETURN_FALSE;
- }
-
- if (Z_LVAL_PP(pv_num) < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field numbering starts at 1");
- RETURN_FALSE;
- }
-
- SQLColAttributes(result->stmt, (UWORD)Z_LVAL_PP(pv_num),
- SQL_COLUMN_TYPE_NAME, tmp, 31, &tmplen, NULL);
- RETURN_STRING(tmp,1)
-}
-/* }}} */
-
-/* {{{ proto int odbc_field_len(int result_id, int field_number)
- Get the length (precision) of a column */
-PHP_FUNCTION(odbc_field_len)
-{
- odbc_column_lengths(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int odbc_field_scale(int result_id, int field_number)
- Get the scale of a column */
-PHP_FUNCTION(odbc_field_scale)
-{
- odbc_column_lengths(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int odbc_field_num(int result_id, string field_name)
- Return column number */
-PHP_FUNCTION(odbc_field_num)
-{
- int field_ind;
- char *fname;
- odbc_result *result;
- int i;
- pval **pv_res, **pv_name;
-
- if (zend_get_parameters_ex(2, &pv_res, &pv_name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- convert_to_string_ex(pv_name);
- fname = Z_STRVAL_PP(pv_name);
-
- field_ind = -1;
- for(i = 0; i < result->numcols; i++) {
- if (strcasecmp(result->values[i].name, fname) == 0)
- field_ind = i + 1;
- }
-
- if (field_ind == -1)
- RETURN_FALSE;
- RETURN_LONG(field_ind);
-}
-/* }}} */
-
-/* {{{ proto int odbc_autocommit(int connection_id [, int OnOff])
- Toggle autocommit mode or get status */
-/* There can be problems with pconnections!*/
-PHP_FUNCTION(odbc_autocommit)
-{
- odbc_connection *conn;
- RETCODE rc;
- pval **pv_conn, **pv_onoff = NULL;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 2) {
- if (zend_get_parameters_ex(2, &pv_conn, &pv_onoff) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (argc == 1) {
- if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- if (pv_onoff && (*pv_onoff)) {
- convert_to_long_ex(pv_onoff);
- rc = SQLSetConnectOption(conn->hdbc, SQL_AUTOCOMMIT,
- (Z_LVAL_PP(pv_onoff)) ?
- SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "Set autocommit");
- RETURN_FALSE;
- }
- RETVAL_TRUE;
- } else {
- SDWORD status;
-
- rc = SQLGetConnectOption(conn->hdbc, SQL_AUTOCOMMIT, (PTR)&status);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "Get commit status");
- RETURN_FALSE;
- }
- RETVAL_LONG((long)status);
- }
-}
-/* }}} */
-
-/* {{{ proto int odbc_commit(int connection_id)
- Commit an ODBC transaction */
-PHP_FUNCTION(odbc_commit)
-{
- odbc_transact(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int odbc_rollback(int connection_id)
- Rollback a transaction */
-PHP_FUNCTION(odbc_rollback)
-{
- odbc_transact(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ php_odbc_lasterror */
-static void php_odbc_lasterror(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- odbc_connection *conn;
- pval **pv_handle;
- char *ptr;
- int argc, len;
-
- argc = ZEND_NUM_ARGS();
-
- if (argc > 1 || zend_get_parameters_ex(argc, &pv_handle)) {
- WRONG_PARAM_COUNT;
- }
-
- if (mode == 0) { /* last state */
- len = 6;
- } else { /* last error message */
- len = SQL_MAX_MESSAGE_LENGTH;
- }
- ptr = ecalloc(len + 1, 1);
- if (argc == 1) {
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_handle, -1, "ODBC-Link", le_conn, le_pconn);
- if (mode == 0) {
- strlcpy(ptr, conn->laststate, len+1);
- } else {
- strlcpy(ptr, conn->lasterrormsg, len+1);
- }
- } else {
- if (mode == 0) {
- strlcpy(ptr, ODBCG(laststate), len+1);
- } else {
- strlcpy(ptr, ODBCG(lasterrormsg), len+1);
- }
- }
- RETVAL_STRING(ptr, 0);
-}
-/* }}} */
-
-/* {{{ proto string odbc_error([int connection_id])
- Get the last error code */
-PHP_FUNCTION(odbc_error)
-{
- php_odbc_lasterror(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string odbc_errormsg([int connection_id])
- Get the last error message */
-PHP_FUNCTION(odbc_errormsg)
-{
- php_odbc_lasterror(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int odbc_setoption(int conn_id|result_id, int which, int option, int value)
- Sets connection or statement options */
-/* This one has to be used carefully. We can't allow to set connection options for
- persistent connections. I think that SetStmtOption is of little use, since most
- of those can only be specified before preparing/executing statements.
- On the other hand, they can be made connection wide default through SetConnectOption
- - but will be overidden by calls to SetStmtOption() in odbc_prepare/odbc_do
-*/
-PHP_FUNCTION(odbc_setoption)
-{
- odbc_connection *conn;
- odbc_result *result;
- RETCODE rc;
- pval **pv_handle, **pv_which, **pv_opt, **pv_val;
-
- if (zend_get_parameters_ex(4, &pv_handle, &pv_which, &pv_opt, &pv_val) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(pv_which);
- convert_to_long_ex(pv_opt);
- convert_to_long_ex(pv_val);
-
- switch (Z_LVAL_PP(pv_which)) {
- case 1: /* SQLSetConnectOption */
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_handle, -1, "ODBC-Link", le_conn, le_pconn);
- if (conn->persistent) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to set option for persistent connection");
- RETURN_FALSE;
- }
- rc = SQLSetConnectOption(conn->hdbc, (unsigned short)(Z_LVAL_PP(pv_opt)), Z_LVAL_PP(pv_val));
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SetConnectOption");
- RETURN_FALSE;
- }
- break;
- case 2: /* SQLSetStmtOption */
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_handle, -1, "ODBC result", le_result);
-
- rc = SQLSetStmtOption(result->stmt, (unsigned short)(Z_LVAL_PP(pv_opt)), (Z_LVAL_PP(pv_val)));
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SetStmtOption");
- RETURN_FALSE;
- }
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option type");
- RETURN_FALSE;
- break;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/*
- * metadata functions
- */
-
-/* {{{ proto int odbc_tables(int connection_id [, string qualifier, string owner, string name, string table_types])
- Call the SQLTables function */
-PHP_FUNCTION(odbc_tables)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_table, **pv_type;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *table = NULL, *type = NULL;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 5 || zend_get_parameters_ex(argc, &pv_conn, &pv_cat, &pv_schema, &pv_table, &pv_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch (argc) {
- case 5:
- convert_to_string_ex(pv_type);
- type = Z_STRVAL_PP(pv_type);
- case 4:
- convert_to_string_ex(pv_table);
- table = Z_STRVAL_PP(pv_table);
- case 3:
- convert_to_string_ex(pv_schema);
- schema = Z_STRVAL_PP(pv_schema);
- case 2:
- convert_to_string_ex(pv_cat);
- cat = Z_STRVAL_PP(pv_cat);
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- /* This hack is needed to access table information in Access databases (fmk) */
- if (table && strlen(table) && schema && !strlen(schema)) schema = NULL;
-
- rc = SQLTables(result->stmt,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- table, SAFE_SQL_NTS(table),
- type, SAFE_SQL_NTS(type));
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLTables");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result TSRMLS_CC)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-
-/* {{{ proto int odbc_columns(int connection_id, string qualifier, string owner, string table_name, string column_name)
- Returns a result identifier that can be used to fetch a list of column names in specified tables */
-PHP_FUNCTION(odbc_columns)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_table, **pv_column;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *table = NULL, *column = NULL;
- SWORD cat_len=0, schema_len=0, table_len=0, column_len=0;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 5 || zend_get_parameters_ex(argc, &pv_conn, &pv_cat, &pv_schema, &pv_table, &pv_column) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch (argc) {
- case 5:
- convert_to_string_ex(pv_column);
- column = Z_STRVAL_PP(pv_column);
- column_len = Z_STRLEN_PP(pv_column);
- case 4:
- convert_to_string_ex(pv_table);
- table = Z_STRVAL_PP(pv_table);
- table_len = Z_STRLEN_PP(pv_table);
- case 3:
- convert_to_string_ex(pv_schema);
- schema = Z_STRVAL_PP(pv_schema);
- schema_len = Z_STRLEN_PP(pv_schema);
- case 2:
- convert_to_string_ex(pv_cat);
- cat = Z_STRVAL_PP(pv_cat);
- cat_len = Z_STRLEN_PP(pv_cat);
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- /*
- * Needed to make MS Access happy
- */
- if (table && strlen(table) && schema && !strlen(schema)) schema = NULL;
-
- rc = SQLColumns(result->stmt,
- cat, cat_len,
- schema, schema_len,
- table, table_len,
- column, column_len);
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLColumns");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result TSRMLS_CC)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-
-#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) && !defined(HAVE_BIRDSTEP)
-/* {{{ proto int odbc_columnprivileges(int connection_id, string catalog, string schema, string table, string column)
- Returns a result identifier that can be used to fetch a list of columns and associated privileges for the specified table */
-PHP_FUNCTION(odbc_columnprivileges)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_table, **pv_column;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *table = NULL, *column = NULL;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 5) {
- if (zend_get_parameters_ex(5, &pv_conn, &pv_cat, &pv_schema, &pv_table, &pv_column) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(pv_cat);
- cat = Z_STRVAL_PP(pv_cat);
- convert_to_string_ex(pv_schema);
- schema = Z_STRVAL_PP(pv_schema);
- convert_to_string_ex(pv_table);
- table = Z_STRVAL_PP(pv_table);
- convert_to_string_ex(pv_column);
- column = Z_STRVAL_PP(pv_column);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLColumnPrivileges(result->stmt,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- table, SAFE_SQL_NTS(table),
- column, SAFE_SQL_NTS(column));
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLColumnPrivileges");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result TSRMLS_CC)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-#endif /* HAVE_DBMAKER || HAVE_SOLID*/
-
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
-/* {{{ proto int odbc_foreignkeys(int connection_id, string pk_qualifier, string pk_owner, string pk_table, string fk_qualifier, string fk_owner, string fk_table)
- Returns a result identifier to either a list of foreign keys in the specified table or a list of foreign keys in other tables that refer to the primary key in the specified table */
-PHP_FUNCTION(odbc_foreignkeys)
-{
- pval **pv_conn, **pv_pcat, **pv_pschema, **pv_ptable;
- pval **pv_fcat, **pv_fschema, **pv_ftable;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *pcat = NULL, *pschema = NULL, *ptable = NULL;
- char *fcat = NULL, *fschema = NULL, *ftable = NULL;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 7) {
- if (zend_get_parameters_ex(7, &pv_conn, &pv_pcat, &pv_pschema, &pv_ptable,
- &pv_fcat, &pv_fschema, &pv_ftable) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(pv_pcat);
- pcat = Z_STRVAL_PP(pv_pcat);
- convert_to_string_ex(pv_pschema);
- pschema = Z_STRVAL_PP(pv_pschema);
- convert_to_string_ex(pv_ptable);
- ptable = Z_STRVAL_PP(pv_ptable);
- convert_to_string_ex(pv_fcat);
- fcat = Z_STRVAL_PP(pv_fcat);
- convert_to_string_ex(pv_fschema);
- fschema = Z_STRVAL_PP(pv_fschema);
- convert_to_string_ex(pv_ftable);
- ftable = Z_STRVAL_PP(pv_ftable);
-#ifdef HAVE_DBMAKER
-#define EMPTY_TO_NULL(xstr) \
- if ((int)strlen((xstr)) == 0) (xstr) = NULL
-
- EMPTY_TO_NULL(pcat);
- EMPTY_TO_NULL(pschema);
- EMPTY_TO_NULL(ptable);
- EMPTY_TO_NULL(fcat);
- EMPTY_TO_NULL(fschema);
- EMPTY_TO_NULL(ftable);
-#endif
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLForeignKeys(result->stmt,
- pcat, SAFE_SQL_NTS(pcat),
- pschema, SAFE_SQL_NTS(pschema),
- ptable, SAFE_SQL_NTS(ptable),
- fcat, SAFE_SQL_NTS(fcat),
- fschema, SAFE_SQL_NTS(fschema),
- ftable, SAFE_SQL_NTS(ftable) );
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLForeignKeys");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result TSRMLS_CC)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-#endif /* HAVE_SOLID */
-
-/* {{{ proto int odbc_gettypeinfo(int connection_id [, int data_type])
- Returns a result identifier containing information about data types supported by the data source */
-PHP_FUNCTION(odbc_gettypeinfo)
-{
- pval **pv_conn, **pv_data_type;
- odbc_result *result = NULL;
- odbc_connection *conn;
- RETCODE rc;
- int argc;
- SWORD data_type = SQL_ALL_TYPES;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 1) {
- if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (argc == 2) {
- if (zend_get_parameters_ex(2, &pv_conn, &pv_data_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pv_data_type);
- data_type = (SWORD) Z_LVAL_PP(pv_data_type);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLGetTypeInfo(result->stmt, data_type );
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLGetTypeInfo");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result TSRMLS_CC)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-
-/* {{{ proto int odbc_primarykeys(int connection_id, string qualifier, string owner, string table)
- Returns a result identifier listing the column names that comprise the primary key for a table */
-PHP_FUNCTION(odbc_primarykeys)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_table;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *table = NULL;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 4) {
- if (zend_get_parameters_ex(4, &pv_conn, &pv_cat, &pv_schema, &pv_table) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(pv_cat);
- cat = Z_STRVAL_PP(pv_cat);
- convert_to_string_ex(pv_schema);
- schema = Z_STRVAL_PP(pv_schema);
- convert_to_string_ex(pv_table);
- table = Z_STRVAL_PP(pv_table);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLPrimaryKeys(result->stmt,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- table, SAFE_SQL_NTS(table) );
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLPrimaryKeys");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result TSRMLS_CC)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) && !defined(HAVE_BIRDSTEP)
-/* {{{ proto int odbc_procedurecolumns(int connection_id [, string qualifier, string owner, string proc, string column])
- Returns a result identifier containing the list of input and output parameters, as well as the columns that make up the result set for the specified procedures */
-PHP_FUNCTION(odbc_procedurecolumns)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_proc, **pv_col;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *proc = NULL, *col = NULL;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 1) {
- if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (argc == 5) {
- if (zend_get_parameters_ex(5, &pv_conn, &pv_cat, &pv_schema, &pv_proc, &pv_col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(pv_cat);
- cat = Z_STRVAL_PP(pv_cat);
- convert_to_string_ex(pv_schema);
- schema = Z_STRVAL_PP(pv_schema);
- convert_to_string_ex(pv_proc);
- proc = Z_STRVAL_PP(pv_proc);
- convert_to_string_ex(pv_col);
- col = Z_STRVAL_PP(pv_col);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLProcedureColumns(result->stmt,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- proc, SAFE_SQL_NTS(proc),
- col, SAFE_SQL_NTS(col) );
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLProcedureColumns");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result TSRMLS_CC)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-#endif /* HAVE_SOLID */
-
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
-/* {{{ proto int odbc_procedures(int connection_id [, string qualifier, string owner, string name])
- Returns a result identifier containg the list of procedure names in a datasource */
-PHP_FUNCTION(odbc_procedures)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_proc;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *proc = NULL;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 1) {
- if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (argc == 4) {
- if (zend_get_parameters_ex(4, &pv_conn, &pv_cat, &pv_schema, &pv_proc) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(pv_cat);
- cat = Z_STRVAL_PP(pv_cat);
- convert_to_string_ex(pv_schema);
- schema = Z_STRVAL_PP(pv_schema);
- convert_to_string_ex(pv_proc);
- proc = Z_STRVAL_PP(pv_proc);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLProcedures(result->stmt,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- proc, SAFE_SQL_NTS(proc) );
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLProcedures");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result TSRMLS_CC)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-#endif /* HAVE_SOLID */
-
-/* {{{ proto int odbc_specialcolumns(int connection_id, int type, string qualifier, string owner, string table, int scope, int nullable)
- Returns a result identifier containing either the optimal set of columns that uniquely identifies a row in the table or columns that are automatically updated when any value in the row is updated by a transaction */
-PHP_FUNCTION(odbc_specialcolumns)
-{
- pval **pv_conn, **pv_type, **pv_cat, **pv_schema, **pv_name;
- pval **pv_scope, **pv_nullable;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *name = NULL;
- UWORD type;
- UWORD scope, nullable;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 7) {
- if (zend_get_parameters_ex(7, &pv_conn, &pv_type, &pv_cat, &pv_schema,
- &pv_name, &pv_scope, &pv_nullable) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pv_type);
- type = (UWORD) Z_LVAL_PP(pv_type);
- convert_to_string_ex(pv_cat);
- cat = Z_STRVAL_PP(pv_cat);
- convert_to_string_ex(pv_schema);
- schema = Z_STRVAL_PP(pv_schema);
- convert_to_string_ex(pv_name);
- name = Z_STRVAL_PP(pv_name);
- convert_to_long_ex(pv_scope);
- scope = (UWORD) Z_LVAL_PP(pv_scope);
- convert_to_long_ex(pv_nullable);
- nullable = (UWORD) Z_LVAL_PP(pv_nullable);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLSpecialColumns(result->stmt,
- type,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- name, SAFE_SQL_NTS(name),
- scope,
- nullable);
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLSpecialColumns");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result TSRMLS_CC)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-
-/* {{{ proto int odbc_statistics(int connection_id, string qualifier, string owner, string name, int unique, int accuracy)
- Returns a result identifier that contains statistics about a single table and the indexes associated with the table */
-PHP_FUNCTION(odbc_statistics)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_name;
- pval **pv_unique, **pv_reserved;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *name = NULL;
- UWORD unique, reserved;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 6) {
- if (zend_get_parameters_ex(6, &pv_conn, &pv_cat, &pv_schema,
- &pv_name, &pv_unique, &pv_reserved) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(pv_cat);
- cat = Z_STRVAL_PP(pv_cat);
- convert_to_string_ex(pv_schema);
- schema = Z_STRVAL_PP(pv_schema);
- convert_to_string_ex(pv_name);
- name = Z_STRVAL_PP(pv_name);
- convert_to_long_ex(pv_unique);
- unique = (UWORD) Z_LVAL_PP(pv_unique);
- convert_to_long_ex(pv_reserved);
- reserved = (UWORD) Z_LVAL_PP(pv_reserved);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLStatistics(result->stmt,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- name, SAFE_SQL_NTS(name),
- unique,
- reserved);
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLStatistics");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result TSRMLS_CC)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-
-#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) && !defined(HAVE_BIRDSTEP)
-/* {{{ proto int odbc_tableprivileges(int connection_id, string qualifier, string owner, string name)
- Returns a result identifier containing a list of tables and the privileges associated with each table */
-PHP_FUNCTION(odbc_tableprivileges)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_table;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *table = NULL;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 4) {
- if (zend_get_parameters_ex(4, &pv_conn, &pv_cat, &pv_schema, &pv_table) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(pv_cat);
- cat = Z_STRVAL_PP(pv_cat);
- convert_to_string_ex(pv_schema);
- schema = Z_STRVAL_PP(pv_schema);
- convert_to_string_ex(pv_table);
- table = Z_STRVAL_PP(pv_table);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLTablePrivileges(result->stmt,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- table, SAFE_SQL_NTS(table));
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLTablePrivileges");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result TSRMLS_CC)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-#endif /* HAVE_DBMAKER */
-
-#endif /* HAVE_UODBC */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/odbc/php_odbc.h b/ext/odbc/php_odbc.h
deleted file mode 100644
index 2ffc3459a1..0000000000
--- a/ext/odbc/php_odbc.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@php.net> |
- | Andreas Karajannis <Andreas.Karajannis@gmd.de> |
- | Kevin N. Shallow <kshallow@tampabay.rr.com> Birdstep Support |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_ODBC_H
-#define PHP_ODBC_H
-
-#if HAVE_UODBC
-#define ODBCVER 0x0250
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-extern zend_module_entry odbc_module_entry;
-#define odbc_module_ptr &odbc_module_entry
-
-#if defined(HAVE_DBMAKER) || defined(PHP_WIN32) || defined(HAVE_IBMDB2) || defined(HAVE_UNIXODBC)
-# define PHP_ODBC_HAVE_FETCH_HASH 1
-#endif
-
-/* user functions */
-PHP_MINIT_FUNCTION(odbc);
-PHP_MSHUTDOWN_FUNCTION(odbc);
-PHP_RINIT_FUNCTION(odbc);
-PHP_RSHUTDOWN_FUNCTION(odbc);
-PHP_MINFO_FUNCTION(odbc);
-
-PHP_FUNCTION(odbc_error);
-PHP_FUNCTION(odbc_errormsg);
-PHP_FUNCTION(odbc_setoption);
-PHP_FUNCTION(odbc_autocommit);
-PHP_FUNCTION(odbc_close);
-PHP_FUNCTION(odbc_close_all);
-PHP_FUNCTION(odbc_commit);
-PHP_FUNCTION(odbc_connect);
-PHP_FUNCTION(odbc_pconnect);
-PHP_FUNCTION(odbc_cursor);
-#ifdef HAVE_SQLDATASOURCES
-PHP_FUNCTION(odbc_data_source);
-#endif
-PHP_FUNCTION(odbc_do);
-PHP_FUNCTION(odbc_exec);
-PHP_FUNCTION(odbc_execute);
-#ifdef PHP_ODBC_HAVE_FETCH_HASH
-PHP_FUNCTION(odbc_fetch_array);
-PHP_FUNCTION(odbc_fetch_object);
-#endif
-PHP_FUNCTION(odbc_fetch_into);
-PHP_FUNCTION(odbc_fetch_row);
-PHP_FUNCTION(odbc_field_len);
-PHP_FUNCTION(odbc_field_scale);
-PHP_FUNCTION(odbc_field_name);
-PHP_FUNCTION(odbc_field_type);
-PHP_FUNCTION(odbc_field_num);
-PHP_FUNCTION(odbc_free_result);
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
-PHP_FUNCTION(odbc_next_result);
-#endif
-PHP_FUNCTION(odbc_num_fields);
-PHP_FUNCTION(odbc_num_rows);
-PHP_FUNCTION(odbc_prepare);
-PHP_FUNCTION(odbc_result);
-PHP_FUNCTION(odbc_result_all);
-PHP_FUNCTION(odbc_rollback);
-PHP_FUNCTION(odbc_binmode);
-PHP_FUNCTION(odbc_longreadlen);
-PHP_FUNCTION(odbc_tables);
-PHP_FUNCTION(odbc_columns);
-#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_35) /* not supported now */
-PHP_FUNCTION(odbc_columnprivileges);
-PHP_FUNCTION(odbc_tableprivileges);
-#endif
-#if !defined(HAVE_SOLID) || !defined(HAVE_SOLID_35) /* not supported */
-PHP_FUNCTION(odbc_foreignkeys);
-PHP_FUNCTION(odbc_procedures);
-PHP_FUNCTION(odbc_procedurecolumns);
-#endif
-PHP_FUNCTION(odbc_gettypeinfo);
-PHP_FUNCTION(odbc_primarykeys);
-PHP_FUNCTION(odbc_specialcolumns);
-PHP_FUNCTION(odbc_statistics);
-
-#else
-
-#define odbc_module_ptr NULL
-
-#endif /* HAVE_UODBC */
-
-#define phpext_odbc_ptr odbc_module_ptr
-
-#endif /* PHP_ODBC_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/odbc/php_odbc_includes.h b/ext/odbc/php_odbc_includes.h
deleted file mode 100644
index adb64be938..0000000000
--- a/ext/odbc/php_odbc_includes.h
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@php.net> |
- | Andreas Karajannis <Andreas.Karajannis@gmd.de> |
- | Kevin N. Shallow <kshallow@tampabay.rr.com> Birdstep Support|
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_ODBC_INCLUDES_H
-#define PHP_ODBC_INCLUDES_H
-
-#if HAVE_UODBC
-
-#define ODBCVER 0x0250
-/*#ifndef MSVC5
-#define FAR
-#endif
-*/
-
-/* checking in the same order as in configure.in */
-
-#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35) /* Solid Server */
-
-#define ODBC_TYPE "Solid"
-#if defined(HAVE_SOLID)
-# include <cli0core.h>
-# include <cli0ext1.h>
-# include <cli0env.h>
-#elif defined(HAVE_SOLID_30)
-# include <cli0cli.h>
-# include <cli0defs.h>
-# include <cli0env.h>
-#elif defined(HAVE_SOLID_35)
-# if !defined(PHP_WIN32)
-# include <sqlunix.h>
-# endif /* end: #if !defined(PHP_WIN32) */
-# include <sqltypes.h>
-# include <sqlucode.h>
-# include <sqlext.h>
-# include <sql.h>
-#endif /* end: #if defined(HAVE_SOLID) */
-#undef HAVE_SQL_EXTENDED_FETCH
-PHP_FUNCTION(solid_fetch_prev);
-#define SQLSMALLINT SWORD
-#define SQLUSMALLINT UWORD
-#ifndef SQL_SUCCEEDED
-#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0)
-#endif
-
-#elif defined(HAVE_EMPRESS) /* Empress */
-
-#define ODBC_TYPE "Empress"
-#include <sql.h>
-#include <sqlext.h>
-#undef HAVE_SQL_EXTENDED_FETCH
-
-#elif defined(HAVE_ADABAS) /* Adabas D */
-
-#define ODBC_TYPE "Adabas D"
-#include <WINDOWS.H>
-#include <sql.h>
-#include <sqlext.h>
-#define HAVE_SQL_EXTENDED_FETCH 1
-#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0)
-#define SQLINTEGER ULONG
-#define SQLUSMALLINT USHORT
-
-#elif defined(HAVE_SAPDB) /* SAP DB */
-
-#define ODBC_TYPE "SAP DB"
-#include <WINDOWS.H>
-#include <sql.h>
-#include <sqlext.h>
-#define HAVE_SQL_EXTENDED_FETCH 1
-#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0)
-
-#elif defined(HAVE_IODBC) /* iODBC library */
-
-#define ODBC_TYPE "iODBC"
-#include <isql.h>
-#include <isqlext.h>
-#define HAVE_SQL_EXTENDED_FETCH 1
-#define SQL_FD_FETCH_ABSOLUTE 0x00000010L
-#define SQL_CURSOR_DYNAMIC 2UL
-#define SQL_NO_TOTAL (-4)
-#define SQL_SO_DYNAMIC 0x00000004L
-#define SQL_LEN_DATA_AT_EXEC_OFFSET (-100)
-#define SQL_LEN_DATA_AT_EXEC(length) (-(length)+SQL_LEN_DATA_AT_EXEC_OFFSET)
-#ifndef SQL_SUCCEEDED
-#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0)
-#endif
-
-#elif defined(HAVE_UNIXODBC) /* unixODBC library */
-
-#ifdef CHAR
-#undef CHAR
-#endif
-
-#ifdef SQLCHAR
-#undef SQLCHAR
-#endif
-
-#define ODBC_TYPE "unixODBC"
-#include <sql.h>
-#include <sqlext.h>
-#define HAVE_SQL_EXTENDED_FETCH 1
-
-#elif defined(HAVE_ESOOB) /* Easysoft ODBC-ODBC Bridge library */
-
-#define ODBC_TYPE "ESOOB"
-#include <sql.h>
-#include <sqlext.h>
-#define HAVE_SQL_EXTENDED_FETCH 1
-
-#elif defined(HAVE_OPENLINK) /* OpenLink ODBC drivers */
-
-#define ODBC_TYPE "Openlink"
-#include <iodbc.h>
-#include <isql.h>
-#include <isqlext.h>
-#include <udbcext.h>
-#define HAVE_SQL_EXTENDED_FETCH 1
-#define SQLSMALLINT SWORD
-#define SQLUSMALLINT UWORD
-
-#elif defined(HAVE_BIRDSTEP) /* Raima Birdstep */
-
-#define ODBC_TYPE "Birdstep"
-#define UNIX
-/*
- * Extended Fetch in the Birdstep ODBC API is incapable of returning long varchar (memo) fields.
- * So the following line has been commented-out to accomadate. - KNS
- *
- * #define HAVE_SQL_EXTENDED_FETCH 1
- */
-#include <sql.h>
-#include <sqlext.h>
-#define SQLINTEGER SDWORD
-#define SQLSMALLINT SWORD
-#define SQLUSMALLINT UWORD
-
-
-#elif defined(HAVE_DBMAKER) /* DBMaker */
-
-#define ODBC_TYPE "DBMaker"
-#undef ODBCVER
-#define ODBCVER 0x0300
-#define HAVE_SQL_EXTENDED_FETCH 1
-#include <odbc.h>
-
-
-#elif defined(HAVE_CODBC) /* Custom ODBC */
-
-#define ODBC_TYPE "Custom ODBC"
-#define HAVE_SQL_EXTENDED_FETCH 1
-#include <odbc.h>
-
-#elif defined(HAVE_IBMDB2) /* DB2 CLI */
-
-#define ODBC_TYPE "IBM DB2 CLI"
-#define HAVE_SQL_EXTENDED_FETCH 1
-#include <sqlcli1.h>
-#ifdef DB268K
-/* Need to include ASLM for 68K applications */
-#include <LibraryManager.h>
-#endif
-
-#else /* MS ODBC */
-
-#define HAVE_SQL_EXTENDED_FETCH 1
-#include <WINDOWS.H>
-#include <sql.h>
-#include <sqlext.h>
-#endif
-
-
-/* Common defines */
-
-#if defined( HAVE_IBMDB2 ) || defined( HAVE_UNIXODBC )
-#define ODBC_SQL_ENV_T SQLHANDLE
-#define ODBC_SQL_CONN_T SQLHANDLE
-#define ODBC_SQL_STMT_T SQLHANDLE
-#elif defined( HAVE_SOLID_35 ) || defined( HAVE_SAPDB ) || defined ( HAVE_EMPRESS )
-#define ODBC_SQL_ENV_T SQLHENV
-#define ODBC_SQL_CONN_T SQLHDBC
-#define ODBC_SQL_STMT_T SQLHSTMT
-#else
-#define ODBC_SQL_ENV_T HENV
-#define ODBC_SQL_CONN_T HDBC
-#define ODBC_SQL_STMT_T HSTMT
-#endif
-
-typedef struct odbc_connection {
- ODBC_SQL_ENV_T henv;
- ODBC_SQL_CONN_T hdbc;
- char laststate[6];
- char lasterrormsg[SQL_MAX_MESSAGE_LENGTH];
- int id;
- int persistent;
-} odbc_connection;
-
-typedef struct odbc_result_value {
- char name[32];
- char *value;
- long int vallen;
- SDWORD coltype;
-} odbc_result_value;
-
-typedef struct odbc_result {
- ODBC_SQL_STMT_T stmt;
- int id;
- odbc_result_value *values;
- SWORD numcols;
- SWORD numparams;
-# if HAVE_SQL_EXTENDED_FETCH
- int fetch_abs;
-# endif
- long longreadlen;
- int binmode;
- int fetched;
- odbc_connection *conn_ptr;
-} odbc_result;
-
-typedef struct {
- char *defDB;
- char *defUser;
- char *defPW;
- long allow_persistent;
- long check_persistent;
- long max_persistent;
- long max_links;
- long num_persistent;
- long num_links;
- int defConn;
- long defaultlrl;
- long defaultbinmode;
- char laststate[6];
- char lasterrormsg[SQL_MAX_MESSAGE_LENGTH];
- HashTable *resource_list;
- HashTable *resource_plist;
-} php_odbc_globals;
-
-int odbc_add_result(HashTable *list, odbc_result *result);
-odbc_result *odbc_get_result(HashTable *list, int count);
-void odbc_del_result(HashTable *list, int count);
-int odbc_add_conn(HashTable *list, HDBC conn);
-odbc_connection *odbc_get_conn(HashTable *list, int count);
-void odbc_del_conn(HashTable *list, int ind);
-int odbc_bindcols(odbc_result *result TSRMLS_DC);
-
-#define ODBC_SQL_ERROR_PARAMS odbc_connection *conn_resource, ODBC_SQL_STMT_T stmt, char *func
-
-void odbc_sql_error(ODBC_SQL_ERROR_PARAMS);
-
-#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR)
-#define IS_SQL_BINARY(x) (x == SQL_BINARY || x == SQL_VARBINARY || x == SQL_LONGVARBINARY)
-
-#ifdef ZTS
-# define ODBCG(v) TSRMG(odbc_globals_id, php_odbc_globals *, v)
-#else
-# define ODBCG(v) (odbc_globals.v)
-extern ZEND_API php_odbc_globals odbc_globals;
-#endif
-
-#endif /* HAVE_UODBC */
-#endif /* PHP_ODBC_INCLUDES_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/openssl/CREDITS b/ext/openssl/CREDITS
deleted file mode 100644
index c2f50d6308..0000000000
--- a/ext/openssl/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-OpenSSL
-Stig Venaas, Wez Furlong, Sascha Kettler
diff --git a/ext/openssl/README b/ext/openssl/README
deleted file mode 100644
index df3f79d509..0000000000
--- a/ext/openssl/README
+++ /dev/null
@@ -1,321 +0,0 @@
-OpenSSL extension for PHP4
-$Id$
-
-The functions implemented so far make it possible to seal and open data, and
-also create and verify signatures.
-
-NEW: support for S/MIME encrypt/decrypt/sign/verify, as well as more
-flexibility for specifying certificates/keys.
-
-To enable the extension, configure PHP with --with-openssl.
-
-Specifying keys/certificates
-----------------------------
-
-Most of the functions require a key or a certificate as a parameter; to make
-things easy for you to use openssl, this extension allows you
-to specify certificates in the following way:
-
-1. As an X.509 resource returned from openssl_x509_read
-2. As a string in the format file://filename, where filename is the path to the
- certificate file (it will be opened and read automatically)
-3. As a string containing the data from the certificate file
-
-Similarly, you can use the following methods of specifying a public key:
-
-1. As a key resource returned from openssl_get_publickey
-2. An X509 resource - public key only
-3. As a string in the format file://filename
-4. As a string containing the data from the key file
-
-Additionally, for a private key, when the openssl extension function does not
-allow you to enter the passphrase as a parameter you may use the syntax
-array($key, "passphrase") where $key can be a key specified using one of the
-methods listed above.
-
-Certificate Verification
-------------------------
-When calling a function that will verify a signature/certificate, the cainfo
-parameter is an array containing file and directory names that specifiy the
-locations of trusted CA files. If a directory is specified, then it must be a
-correctly hashed directory.
-
-Misc:
------
-
-mixed openssl_error_string()
-
-returns the message from the last error that the OpenSSL library encountered
-and moves it's internal error pointer to the next message. If there are no
-more error messages, returns false.
-
-General Key/Cert Functions:
----------------------------
-
-resource openssl_get_privatekey(mixed key [, string passphrase])
-
-Parses the key data and returns a key resource identifier. If the key is
-encrypted a passphrase is needed. This can be supplied as second argument.
-
-
-resource openssl_get_publickey(mixed cert)
-
-Extracts the public key from the given certificate or public key and returns
-a key resource identifier.
-
-
-void openssl_free_key(resource key)
-
-Frees the resource given by the key resource identifier.
-Note that this function does not accept the extended key specification
-syntax mentioned above, as it doesn't make sense in this case!
-
-array openssl_x509_parse(mixed x509[, bool shortnames=true])
-
-Parses the certificate data and returns an array containing information
-about the certificate, it's intended purposes, subject, issuer, validity
-etc. etc. If shortnames is true (the default) then the fields will be
-keyed by the shortname forms eg: CN as opposed to commonName (shortnames
-= false).
-
-
-bool openssl_x509_checkpurpose(mixed x509cert, int purpose,
- array cainfo[, string untrustedfile])
-
-Verifies if the certificate can be used for a specific purpose.
-Purpose can be one of the following values:
- X509_PURPOSE_SSL_CLIENT
- X509_PURPOSE_SSL_SERVER
- X509_PURPOSE_NS_SSL_SERVER
- X509_PURPOSE_SMIME_SIGN
- X509_PURPOSE_SMIME_ENCRYPT
- X509_PURPOSE_CRL_SIGN
- X509_PURPOSE_ANY
-
-cainfo is an array of CA information (as mentioned above).
-untrusted file specifies a file containing a bunch of certs that
-are not trusted but may be useful in validating the certificate.
-
-
-resource openssl_read_x509(mixed cert)
-
-Parses the cert and returns a resource that can be used with the
-other openssl functions
-
-
-void openssl_free_x509(resource x509)
-
-Frees the resource given by the x509 resource identifier.
-Note that this function does not accept the extended cert specification
-syntax mentioned above, as it doesn't make sense in this case!
-
-
-PKCS7 (S/MIME) Sign/Verify/Encrypt/Decrypt Functions:
------------------------------------------------------
-
-These functions allow you to manipulate S/MIME messages!
-
-They are based on apps/smime.c from the openssl dist, so for information,
-see the documentation for openssl.
-
-You may pass in some flags that affect how these functions work using
-and array containing the following values:
-"detached", "nodetached", "text", "nointern", "noverify", "nochain",
-"nocerts", "noattr", "binary", "nosigs".
-The options correspond to the options of the same name for the
-"openssl smime" command (smime(1)).
-
-
-bool openssl_pkcs7_verify(string filename, array flags[, string signerscerts][,
- array cainfo])
-
-Verifies that the signature on the MIME message contained in the file
-named by filename is valid. If signerscerts is passed in, it holds the
-name of a file into which the certificates of those that signed the
-message will be stored.
-cainfo and flags are CA information and flag information as described
-above.
-
-
-bool openssl_pkcs7_encrypt(string infile, string outfile, array recipcerts,
- array headers[, array flags])
-
-Encrypts the MIME message contained in the file named by infile using
-the certificates held in recipcerts. The result is place in the file
-named outfile.
-recipcerts is an array of certificate identifiers representing the certs
-of the intended recipients of the message.
-headers is an array of headers to prepend to the message: they will
-not be included in the encoded section.
-flags is flag information as described above.
-Hint: you will want to put "To", "From", and "Subject" headers in headers.
-Headers can be either an assoc array keyed by header named, or can be
-and indexed array containing a single header line per value.
-The message will be encoded using a RC2-40 bit cipher.
-TODO: allow user to specify cipher.
-
-bool openssl_pkcs7_sign(string infile, string outfile, mixed signcert, mixed
- signkey, array headers[, array flags][, string extracertsfilename])
-
-Signs the MIME message contained in the file named by infile using the
-certificate and key pair identified by signcert/signkey.
-Signkey must be the private key corresponding to signcert.
-The result is placed in the file named by outfile.
-Headers and flags have the same effects as mentioned above.
-extracertsfilename names a file containing a bunch of additional certificates
-to include in the signature, in order to aid the recipient in verifying the
-message.
-
-
-bool openssl_pkcs7_decrypt(string infilename, string outfilename, mixed
- recipcert, mixed recipkey)
-
-Decrypts the MIME message contained in the file named by infilename
-using the certificate and private key pair recipcert/recipkey.
-The descrypted result is placed in outfilename.
-TODO: add flags parameter, if needed?
-
-
-EVP Sign/Verify/Encrypt/Decrypt Functions:
-------------------------------------------
-
-bool openssl_sign(string data, &string signature, mixed key)
-
-Uses key to create signature for data, returns true on success and false
-on failure. signature is passed by reference and contains the newly created
-signature on success.
-
-
-int openssl_verify(string data, string signature, mixed key)
-
-Uses key to verify that the signature is correct for the given data.
-Returns 1 if correct, 0 if incorrect, and -1 on error.
-
-
-int openssl_seal(string data, &string sealdata, &array ekeys, array pubkeys)
-
-Encrypts data using pubkeys, so that only owners of the respective private
-keys and ekeys can decrypt and read the data. Returns the length of the
-sealed data on success, else false. On success, sealdata and ekeys hold
-the sealed data and envelope keys.
-
-
-bool openssl_open(string data, &string opendata, string ekey, int privkey)
-
-Opens (decrypts) sealed data using a private key and the corresponding
-envelope key. Returns true on success and false on failure. On success,
-opendata will hold the descypted data.
-
-
-See below for more details on usage. Also feel free to mail me at
-venaas@php.net if you have questions. The OpenSSL documentation,
-especially the EVP documentation at
-http://www.openssl.org/docs/crypto/evp.html, might also be of help.
-
-
-HOWTO:
-
-To do anything you need a private key and a certificate containing the
-corresponding public key. This is similar to what you have using say an
-Apache webserver with OpenSSL. For testing you could try keys that come
-with OpenSSL, that's what the sample scripts below do. You can also get
-keys from some CA, or you can create them yourself.
-
-
-Creating private key
-
-To generate an unprotected 1024 bit RSA private key you can do
-
- openssl genrsa -out /tmp/test.key 1024
-
-Private keys should be protected by a passphrase though.
-
-
-Creating a self signed certificate
-
-To generate a self signed certificate from the key that is valid for
-365 days, do
-
- openssl req -new -key /tmp/test.key -out /tmp/test.crt -days 365 -x509
-
-
-Example usage
-
-These examples use keys that come with OpenSSL, you should perhaps test with
-those first.
-
-
-Seal and open
-
- <?php
- $data = "Follow the white rabbit";
-
- // Get certificate into a string
- // this file comes with OpenSSL 0.9.6
- $fp = fopen("/src/openssl-0.9.6/demos/maurice/cert.pem", "r");
- $cert = fread($fp, 8192);
- fclose($fp);
- // get public key from certificate
- $pk1 = openssl_get_publickey($cert);
- // $pk1 is an encryption key resource id if success, else false
- // Repeat if want public keys for multiple parties
-
- $fp = fopen("/src/openssl-0.9.6/demos/sign/cert.pem", "r");
- $cert = fread($fp, 8192);
- fclose($fp);
- $pk2 = openssl_get_publickey($cert);
-
- // seal data, only owners of $pk1 and $pk2 can decrypt $sealed with keys
- // $ekeys[0] and $ekeys[1] respectively.
- openssl_seal($data, $sealed, $ekeys, array($pk1,$pk2));
- openssl_free_key($pk1);
- openssl_free_key($pk2);
-
- // now we try to decrypt data for one of the recipients
- $fp = fopen("/src/openssl-0.9.6/demos/sign/key.pem", "r");
- // Get PEM coded key into $pkey
- $pkey = fread($fp, 8192);
- fclose($fp);
- // $key will be resource id for unpacked $pkey
- $key = openssl_get_privatekey($pkey);
-
- openssl_open($sealed, $open, $ekeys[1], $key);
- openssl_free_key($key);
- echo "$open\n";
- ?>
-
-
-Sign and verify
-
- <?php
- $data = "Follow the white rabbit";
-
- // First we need to have a string containing the private key in PEM format
- // this file comes with OpenSSL 0.9.6
- $fp = fopen("/src/openssl-0.9.6/demos/sign/key.pem", "r");
- $pkey = fread($fp, 8192);
- fclose($fp);
-
- // get private key from the PEM format
- // $key is an encr key resource id if success, else false
- $key = openssl_get_privatekey($pkey);
-
- // calculate signature
- openssl_sign($data, $signature, $key);
- openssl_free_key($key);
-
- // recipient verifies signature
- // read certificate
- $fp = fopen("/src/openssl-0.9.6/demos/sign/cert.pem", "r");
- $cert = fread($fp, 8192);
- fclose($fp);
-
- // Get public key from the certificate
- $pubkey = openssl_get_publickey($cert);
-
- // state whether signature is okay or not
- echo openssl_verify($data, $signature, $pubkey) == 1 ? "ok\n" : "bad\n";
-
- // free key
- openssl_free_key($pubkey);
- ?>
diff --git a/ext/openssl/config.m4 b/ext/openssl/config.m4
deleted file mode 100644
index 6cc9568428..0000000000
--- a/ext/openssl/config.m4
+++ /dev/null
@@ -1,10 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-if test "$PHP_OPENSSL" != "no"; then
- PHP_NEW_EXTENSION(openssl, openssl.c xp_ssl.c, $ext_openssl_shared)
- OPENSSL_SHARED_LIBADD="-lcrypto -lssl"
- PHP_SUBST(OPENSSL_SHARED_LIBADD)
- AC_DEFINE(HAVE_OPENSSL_EXT,1,[ ])
-fi
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
deleted file mode 100644
index 45968b83c5..0000000000
--- a/ext/openssl/openssl.c
+++ /dev/null
@@ -1,3056 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Venaas <venaas@php.net> |
- | Wez Furlong <wez@thebrainroom.com> |
- | Sascha Kettler <kettler@gmx.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_openssl.h"
-
-/* PHP Includes */
-#include "ext/standard/file.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_fopen_wrappers.h"
-
-/* OpenSSL includes */
-#include <openssl/evp.h>
-#include <openssl/x509.h>
-#include <openssl/x509v3.h>
-#include <openssl/crypto.h>
-#include <openssl/pem.h>
-#include <openssl/err.h>
-#include <openssl/conf.h>
-#include <openssl/rand.h>
-
-#define DEFAULT_KEY_LENGTH 512
-#define MIN_KEY_LENGTH 384
-
-#define OPENSSL_ALGO_SHA1 1
-#define OPENSSL_ALGO_MD5 2
-#define OPENSSL_ALGO_MD4 3
-#define OPENSSL_ALGO_MD2 4
-
-#define DEBUG_SMIME 0
-
-static unsigned char arg2_force_ref[] =
- { 2, BYREF_NONE, BYREF_FORCE };
-static unsigned char arg2and3_force_ref[] =
- { 3, BYREF_NONE, BYREF_FORCE, BYREF_FORCE };
-
-enum php_openssl_key_type {
- OPENSSL_KEYTYPE_RSA,
- OPENSSL_KEYTYPE_DSA,
- OPENSSL_KEYTYPE_DH,
- OPENSSL_KEYTYPE_DEFAULT = OPENSSL_KEYTYPE_RSA
-};
-
-enum php_openssl_cipher_type {
- PHP_OPENSSL_CIPHER_RC2_40,
- PHP_OPENSSL_CIPHER_RC2_128,
- PHP_OPENSSL_CIPHER_RC2_64,
- PHP_OPENSSL_CIPHER_DES,
- PHP_OPENSSL_CIPHER_3DES,
-
- PHP_OPENSSL_CIPHER_DEFAULT = PHP_OPENSSL_CIPHER_RC2_40
-};
-
-/* {{{ openssl_functions[]
- */
-function_entry openssl_functions[] = {
-/* public/private key functions */
- PHP_FE(openssl_pkey_free, NULL)
- PHP_FE(openssl_pkey_new, NULL)
- PHP_FE(openssl_pkey_export, arg2_force_ref)
- PHP_FE(openssl_pkey_export_to_file, NULL)
- PHP_FE(openssl_pkey_get_private, NULL)
- PHP_FE(openssl_pkey_get_public, NULL)
-
- PHP_FALIAS(openssl_free_key, openssl_pkey_free, NULL)
- PHP_FALIAS(openssl_get_privatekey, openssl_pkey_get_private, NULL)
- PHP_FALIAS(openssl_get_publickey, openssl_pkey_get_public, NULL)
-
-/* x.509 cert funcs */
- PHP_FE(openssl_x509_read, NULL)
- PHP_FE(openssl_x509_free, NULL)
- PHP_FE(openssl_x509_parse, NULL)
- PHP_FE(openssl_x509_checkpurpose, NULL)
- PHP_FE(openssl_x509_check_private_key, NULL)
- PHP_FE(openssl_x509_export, arg2_force_ref)
- PHP_FE(openssl_x509_export_to_file, NULL)
-
-/* CSR funcs */
- PHP_FE(openssl_csr_new, arg2_force_ref)
- PHP_FE(openssl_csr_export, arg2_force_ref)
- PHP_FE(openssl_csr_export_to_file, NULL)
- PHP_FE(openssl_csr_sign, NULL)
-
- PHP_FE(openssl_sign, arg2_force_ref)
- PHP_FE(openssl_verify, NULL)
- PHP_FE(openssl_seal, arg2and3_force_ref)
- PHP_FE(openssl_open, arg2_force_ref)
-
-/* for S/MIME handling */
- PHP_FE(openssl_pkcs7_verify, NULL)
- PHP_FE(openssl_pkcs7_decrypt, NULL)
- PHP_FE(openssl_pkcs7_sign, NULL)
- PHP_FE(openssl_pkcs7_encrypt, NULL)
-
- PHP_FE(openssl_private_encrypt, arg2_force_ref)
- PHP_FE(openssl_private_decrypt, arg2_force_ref)
- PHP_FE(openssl_public_encrypt, arg2_force_ref)
- PHP_FE(openssl_public_decrypt, arg2_force_ref)
-
- PHP_FE(openssl_error_string, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ openssl_module_entry
- */
-zend_module_entry openssl_module_entry = {
- STANDARD_MODULE_HEADER,
- "openssl",
- openssl_functions,
- PHP_MINIT(openssl),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(openssl),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_OPENSSL
-ZEND_GET_MODULE(openssl)
-#endif
-
-static int le_key;
-static int le_x509;
-static int le_csr;
-
-/* {{{ resource destructors */
-static void php_pkey_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- EVP_PKEY *pkey = (EVP_PKEY *)rsrc->ptr;
-
- assert(pkey != NULL);
-
- EVP_PKEY_free(pkey);
-}
-
-static void php_x509_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- X509 *x509 = (X509 *)rsrc->ptr;
- X509_free(x509);
-}
-
-static void php_csr_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- X509_REQ * csr = (X509_REQ*)rsrc->ptr;
- X509_REQ_free(csr);
-}
-/* }}} */
-
-/* {{{ openssl safe_mode & open_basedir checks */
-inline static int php_openssl_safe_mode_chk(char *filename TSRMLS_DC)
-{
- if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- return -1;
- }
- if (php_check_open_basedir(filename TSRMLS_CC)) {
- return -1;
- }
-
- return 0;
-}
-/* }}} */
-
-/* {{{ openssl -> PHP "bridging" */
-/* true global; readonly after module startup */
-static char default_ssl_conf_filename[MAXPATHLEN];
-
-struct php_x509_request {
- LHASH * global_config; /* Global SSL config */
- LHASH * req_config; /* SSL config for this request */
- const EVP_MD * md_alg;
- const EVP_MD * digest;
- char * section_name,
- * config_filename,
- * digest_name,
- * extensions_section,
- * request_extensions_section;
- int priv_key_bits;
- int priv_key_type;
-
- int priv_key_encrypt;
-
- EVP_PKEY * priv_key;
-};
-
-
-static X509 * php_openssl_x509_from_zval(zval ** val, int makeresource, long * resourceval TSRMLS_DC);
-static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char * passphrase, int makeresource, long * resourceval TSRMLS_DC);
-static int php_openssl_is_private_key(EVP_PKEY* pkey TSRMLS_DC);
-static X509_STORE * setup_verify(zval * calist TSRMLS_DC);
-static STACK_OF(X509) * load_all_certs_from_file(char *certfile);
-static X509_REQ * php_openssl_csr_from_zval(zval ** val, int makeresource, long * resourceval TSRMLS_DC);
-static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req TSRMLS_DC);
-
-
-static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int shortname TSRMLS_DC)
-{
- zval * subitem;
- int i;
- char * sn, * ln;
- int nid;
- X509_NAME_ENTRY * ne;
- ASN1_STRING * str;
- ASN1_OBJECT * obj;
-
- MAKE_STD_ZVAL(subitem);
- array_init(subitem);
-
- for (i = 0; i < X509_NAME_entry_count(name); i++) {
- ne = X509_NAME_get_entry(name, i);
- obj = X509_NAME_ENTRY_get_object(ne);
- str = X509_NAME_ENTRY_get_data(ne);
- nid = OBJ_obj2nid(obj);
- if (shortname) {
- sn = (char*)OBJ_nid2sn(nid);
- add_assoc_stringl(subitem, sn, str->data, str->length, 1);
- } else {
- ln = (char*)OBJ_nid2ln(nid);
- add_assoc_stringl(subitem, ln, str->data, str->length, 1);
- }
- }
- zend_hash_update(HASH_OF(val), key, strlen(key) + 1, (void *)&subitem, sizeof(subitem), NULL);
-}
-
-static void add_assoc_asn1_string(zval * val, char * key, ASN1_STRING * str)
-{
- add_assoc_stringl(val, key, str->data, str->length, 1);
-}
-
-static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr TSRMLS_DC)
-{
-/*
- This is how the time string is formatted:
-
- sprintf(p,"%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100,
- ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
-*/
-
- time_t ret;
- struct tm thetime;
- char * strbuf;
- char * thestr;
- long gmadjust = 0;
-
- if (timestr->length < 13) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "extension author too lazy to parse %s correctly", timestr->data);
- return (time_t)-1;
- }
-
- strbuf = estrdup(timestr->data);
-
- memset(&thetime, 0, sizeof(thetime));
-
- /* we work backwards so that we can use atoi more easily */
-
- thestr = strbuf + timestr->length - 3;
-
- thetime.tm_sec = atoi(thestr);
- *thestr = '\0';
- thestr -= 2;
- thetime.tm_min = atoi(thestr);
- *thestr = '\0';
- thestr -= 2;
- thetime.tm_hour = atoi(thestr);
- *thestr = '\0';
- thestr -= 2;
- thetime.tm_mday = atoi(thestr);
- *thestr = '\0';
- thestr -= 2;
- thetime.tm_mon = atoi(thestr)-1;
- *thestr = '\0';
- thestr -= 2;
- thetime.tm_year = atoi(thestr);
-
- if (thetime.tm_year < 68) {
- thetime.tm_year += 100;
- }
-
- thetime.tm_isdst = -1;
- ret = mktime(&thetime);
-
-#if HAVE_TM_GMTOFF
- gmadjust = thetime.tm_gmtoff;
-#else
- /*
- ** If correcting for daylight savings time, we set the adjustment to
- ** the value of timezone - 3600 seconds. Otherwise, we need to overcorrect and
- ** set the adjustment to the main timezone + 3600 seconds.
- */
- gmadjust = -(thetime.tm_isdst ? (long)timezone - 3600 : (long)timezone + 3600);
-#endif
- ret += gmadjust;
-
- efree(strbuf);
-
- return ret;
-}
-
-static inline int php_openssl_config_check_syntax(
- const char * section_label,
- const char * config_filename,
- const char * section,
- LHASH * config TSRMLS_DC)
-{
- X509V3_CTX ctx;
-
- X509V3_set_ctx_test(&ctx);
- X509V3_set_conf_lhash(&ctx, config);
- if (!X509V3_EXT_add_conf(config, &ctx, (char *)section, NULL)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error loading %s section %s of %s",
- section_label,
- section,
- config_filename);
- return FAILURE;
- }
- return SUCCESS;
-}
-
-static int add_oid_section(struct php_x509_request * req TSRMLS_DC)
-{
- char * str;
- STACK_OF(CONF_VALUE) * sktmp;
- CONF_VALUE * cnf;
- int i;
-
- str = CONF_get_string(req->req_config, NULL, "oid_section");
- if (str == NULL) {
- return SUCCESS;
- }
- sktmp = CONF_get_section(req->req_config, str);
- if (sktmp == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "problem loading oid section %s", str);
- return FAILURE;
- }
- for (i = 0; i < sk_CONF_VALUE_num(sktmp); i++) {
- cnf = sk_CONF_VALUE_value(sktmp, i);
- if (OBJ_create(cnf->value, cnf->name, cnf->name) == NID_undef) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "problem creating object %s=%s", cnf->name, cnf->value);
- return FAILURE;
- }
- }
- return SUCCESS;
-}
-
-#define PHP_SSL_REQ_INIT(req) memset(req, 0, sizeof(*req))
-#define PHP_SSL_REQ_DISPOSE(req) php_openssl_dispose_config(req TSRMLS_CC)
-#define PHP_SSL_REQ_PARSE(req, zval) php_openssl_parse_config(req, zval TSRMLS_CC)
-
-#define PHP_SSL_CONFIG_SYNTAX_CHECK(var) if (req->var && php_openssl_config_check_syntax(#var, \
- req->config_filename, req->var, req->req_config TSRMLS_CC) == FAILURE) return FAILURE
-
-#define SET_OPTIONAL_STRING_ARG(key, varname, defval) \
- if (optional_args && zend_hash_find(Z_ARRVAL_P(optional_args), key, sizeof(key), (void**)&item) == SUCCESS) \
- varname = Z_STRVAL_PP(item); \
- else \
- varname = defval
-
-#define SET_OPTIONAL_LONG_ARG(key, varname, defval) \
- if (optional_args && zend_hash_find(Z_ARRVAL_P(optional_args), key, sizeof(key), (void**)&item) == SUCCESS) \
- varname = Z_LVAL_PP(item); \
- else \
- varname = defval
-
-
-
-static int php_openssl_parse_config(
- struct php_x509_request * req,
- zval * optional_args
- TSRMLS_DC
- )
-{
- char * str;
- zval ** item;
-
- SET_OPTIONAL_STRING_ARG("config", req->config_filename, default_ssl_conf_filename);
- SET_OPTIONAL_STRING_ARG("config_section_name", req->section_name, "req");
- req->global_config = CONF_load(NULL, default_ssl_conf_filename, NULL);
- req->req_config = CONF_load(NULL, req->config_filename, NULL);
-
- if (req->req_config == NULL) {
- return FAILURE;
- }
-
- /* read in the oids */
- str = CONF_get_string(req->req_config, NULL, "oid_file");
- if (str && !php_openssl_safe_mode_chk(str TSRMLS_CC)) {
- BIO *oid_bio = BIO_new_file(str, "r");
- if (oid_bio) {
- OBJ_create_objects(oid_bio);
- BIO_free(oid_bio);
- }
- }
- if (add_oid_section(req TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
- SET_OPTIONAL_STRING_ARG("digest_alg", req->digest_name,
- CONF_get_string(req->req_config, req->section_name, "default_md"));
- SET_OPTIONAL_STRING_ARG("x509_extensions", req->extensions_section,
- CONF_get_string(req->req_config, req->section_name, "x509_extensions"));
- SET_OPTIONAL_STRING_ARG("req_extensions", req->extensions_section,
- CONF_get_string(req->req_config, req->request_extensions_section, "req_extensions"));
- SET_OPTIONAL_LONG_ARG("private_key_bits", req->priv_key_bits,
- CONF_get_number(req->req_config, req->section_name, "default_bits"));
-
- SET_OPTIONAL_LONG_ARG("private_key_type", req->priv_key_type, OPENSSL_KEYTYPE_DEFAULT);
-
- if (optional_args && zend_hash_find(Z_ARRVAL_P(optional_args), "encrypt_key", sizeof("encrypt_key"), (void**)&item) == SUCCESS) {
- req->priv_key_encrypt = Z_BVAL_PP(item);
- } else {
- str = CONF_get_string(req->req_config, req->section_name, "encrypt_rsa_key");
- if (str == NULL) {
- str = CONF_get_string(req->req_config, req->section_name, "encrypt_key");
- }
- if (str && strcmp(str, "no") == 0) {
- req->priv_key_encrypt = 0;
- } else {
- req->priv_key_encrypt = 1;
- }
- }
-
- /* digest alg */
- if (req->digest_name == NULL) {
- req->digest_name = CONF_get_string(req->req_config, req->section_name, "default_md");
- }
- if (req->digest_name) {
- req->digest = req->md_alg = EVP_get_digestbyname(req->digest_name);
- }
- if (req->md_alg == NULL) {
- req->md_alg = req->digest = EVP_md5();
- }
-
- PHP_SSL_CONFIG_SYNTAX_CHECK(extensions_section);
-
- /* set the string mask */
- str = CONF_get_string(req->req_config, req->section_name, "string_mask");
- if (str && !ASN1_STRING_set_default_mask_asc(str)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid global string mask setting %s", str);
- return FAILURE;
- }
-
- if (req->request_extensions_section == NULL) {
- req->request_extensions_section = CONF_get_string(req->req_config, req->section_name, "req_extensions");
- }
- PHP_SSL_CONFIG_SYNTAX_CHECK(request_extensions_section);
-
- return SUCCESS;
-}
-
-static void php_openssl_dispose_config(struct php_x509_request * req TSRMLS_DC)
-{
- if (req->priv_key) {
- EVP_PKEY_free(req->priv_key);
- req->priv_key = NULL;
- }
- if (req->global_config) {
- CONF_free(req->global_config);
- req->global_config = NULL;
- }
- if (req->req_config) {
- CONF_free(req->req_config);
- req->req_config = NULL;
- }
-}
-
-static int php_openssl_load_rand_file(const char * file, int *egdsocket, int *seeded)
-{
- char buffer[MAXPATHLEN];
-
- TSRMLS_FETCH();
-
- *egdsocket = 0;
- *seeded = 0;
-
-#ifdef WINDOWS
- RAND_screen();
-#endif
- if (file == NULL) {
- file = RAND_file_name(buffer, sizeof(buffer));
- } else if (RAND_egd(file) > 0) {
- /* if the given filename is an EGD socket, don't
- * write anything back to it */
- *egdsocket = 1;
- return SUCCESS;
- }
- if (file == NULL || !RAND_load_file(file, -1)) {
- if (RAND_status() == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to load random state; not enough random data!");
- return FAILURE;
- }
- return FAILURE;
- }
- *seeded = 1;
- return SUCCESS;
-}
-
-static int php_openssl_write_rand_file(const char * file, int egdsocket, int seeded)
-{
- char buffer[MAXPATHLEN];
-
- TSRMLS_FETCH();
-
- if (egdsocket || !seeded) {
- /* if we did not manage to read the seed file, we should not write
- * a low-entropy seed file back */
- return FAILURE;
- }
- if (file == NULL) {
- file = RAND_file_name(buffer, sizeof(buffer));
- }
- if (file == NULL || !RAND_write_file(file)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to write random state");
- return FAILURE;
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(openssl)
-{
- char * config_filename;
-
- le_key = zend_register_list_destructors_ex(php_pkey_free, NULL, "OpenSSL key", module_number);
- le_x509 = zend_register_list_destructors_ex(php_x509_free, NULL, "OpenSSL X.509", module_number);
- le_csr = zend_register_list_destructors_ex(php_csr_free, NULL, "OpenSSL X.509 CSR", module_number);
-
- OpenSSL_add_all_ciphers();
- OpenSSL_add_all_digests();
- OpenSSL_add_all_algorithms();
-
- ERR_load_ERR_strings();
- ERR_load_crypto_strings();
- ERR_load_EVP_strings();
-
- /* purposes for cert purpose checking */
- REGISTER_LONG_CONSTANT("X509_PURPOSE_SSL_CLIENT", X509_PURPOSE_SSL_CLIENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("X509_PURPOSE_SSL_SERVER", X509_PURPOSE_SSL_SERVER, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("X509_PURPOSE_NS_SSL_SERVER", X509_PURPOSE_NS_SSL_SERVER, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("X509_PURPOSE_SMIME_SIGN", X509_PURPOSE_SMIME_SIGN, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("X509_PURPOSE_SMIME_ENCRYPT", X509_PURPOSE_SMIME_ENCRYPT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("X509_PURPOSE_CRL_SIGN", X509_PURPOSE_CRL_SIGN, CONST_CS|CONST_PERSISTENT);
-#ifdef X509_PURPOSE_ANY
- REGISTER_LONG_CONSTANT("X509_PURPOSE_ANY", X509_PURPOSE_ANY, CONST_CS|CONST_PERSISTENT);
-#endif
-
- /* signature algorithm constants */
- REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA1", OPENSSL_ALGO_SHA1, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD5", OPENSSL_ALGO_MD5, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD4", OPENSSL_ALGO_MD4, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT);
-
- /* flags for S/MIME */
- REGISTER_LONG_CONSTANT("PKCS7_DETACHED", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_TEXT", PKCS7_TEXT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_NOINTERN", PKCS7_NOINTERN, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_NOVERIFY", PKCS7_NOVERIFY, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_NOCHAIN", PKCS7_NOCHAIN, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_NOCERTS", PKCS7_NOCERTS, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_NOATTR", PKCS7_NOATTR, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_BINARY", PKCS7_BINARY, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_NOSIGS", PKCS7_NOSIGS, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_PADDING", RSA_PKCS1_PADDING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OPENSSL_SSLV23_PADDING", RSA_SSLV23_PADDING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OPENSSL_NO_PADDING", RSA_NO_PADDING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_OAEP_PADDING", RSA_PKCS1_OAEP_PADDING, CONST_CS|CONST_PERSISTENT);
-
- /* Ciphers */
- REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_40", PHP_OPENSSL_CIPHER_RC2_40, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_128", PHP_OPENSSL_CIPHER_RC2_128, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_64", PHP_OPENSSL_CIPHER_RC2_64, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_DES", PHP_OPENSSL_CIPHER_DES, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_3DES", PHP_OPENSSL_CIPHER_3DES, CONST_CS|CONST_PERSISTENT);
-
- /* Values for key types */
- REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_RSA", OPENSSL_KEYTYPE_RSA, CONST_CS|CONST_PERSISTENT);
-#ifndef NO_DSA
- REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DSA", OPENSSL_KEYTYPE_DSA, CONST_CS|CONST_PERSISTENT);
-#endif
- REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DH", OPENSSL_KEYTYPE_DH, CONST_CS|CONST_PERSISTENT);
-
- /* Determine default SSL configuration file */
- config_filename = getenv("OPENSSL_CONF");
- if (config_filename == NULL) {
- config_filename = getenv("SSLEAY_CONF");
- }
-
- /* default to 'openssl.cnf' if no environment variable is set */
- if (config_filename == NULL) {
- snprintf(default_ssl_conf_filename, sizeof(default_ssl_conf_filename), "%s/%s",
- X509_get_default_cert_area(),
- "openssl.cnf");
- } else {
- strlcpy(default_ssl_conf_filename, config_filename, sizeof(default_ssl_conf_filename));
- }
-
- php_stream_xport_register("ssl", php_openssl_ssl_socket_factory TSRMLS_CC);
- php_stream_xport_register("tls", php_openssl_ssl_socket_factory TSRMLS_CC);
-
- /* override the default tcp socket provider */
- php_stream_xport_register("tcp", php_openssl_ssl_socket_factory TSRMLS_CC);
-
- php_register_url_stream_wrapper("https", &php_stream_http_wrapper TSRMLS_CC);
- php_register_url_stream_wrapper("ftps", &php_stream_ftp_wrapper TSRMLS_CC);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(openssl)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "OpenSSL support", "enabled");
- php_info_print_table_row(2, "OpenSSL Version", OPENSSL_VERSION_TEXT);
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(openssl)
-{
- EVP_cleanup();
-
- php_unregister_url_stream_wrapper("https" TSRMLS_CC);
- php_unregister_url_stream_wrapper("ftps" TSRMLS_CC);
-
- php_stream_xport_unregister("ssl" TSRMLS_CC);
- php_stream_xport_unregister("tls" TSRMLS_CC);
-
- /* reinstate the default tcp handler */
- php_stream_xport_register("tcp", php_stream_generic_socket_factory TSRMLS_CC);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ x509 cert functions */
-
-/* {{{ php_openssl_x509_from_zval
- Given a zval, coerce it into an X509 object.
- The zval can be:
- . X509 resource created using openssl_read_x509()
- . if it starts with file:// then it will be interpreted as the path to that cert
- . it will be interpreted as the cert data
- If you supply makeresource, the result will be registered as an x509 resource and
- it's value returned in makeresource.
-*/
-static X509 * php_openssl_x509_from_zval(zval ** val, int makeresource, long * resourceval TSRMLS_DC)
-{
- X509 *cert = NULL;
-
- if (resourceval) {
- *resourceval = -1;
- }
- if (Z_TYPE_PP(val) == IS_RESOURCE) {
- /* is it an x509 resource ? */
- void * what;
- int type;
-
- what = zend_fetch_resource(val TSRMLS_CC, -1, "OpenSSL X.509", &type, 1, le_x509);
- if (!what) {
- return NULL;
- }
- /* this is so callers can decide if they should free the X509 */
- if (resourceval) {
- *resourceval = Z_LVAL_PP(val);
- }
- if (type == le_x509) {
- return (X509*)what;
- }
- /* other types could be used here - eg: file pointers and read in the data from them */
-
- return NULL;
- }
- /* force it to be a string and check if it refers to a file */
- convert_to_string_ex(val);
-
- if (Z_STRLEN_PP(val) > 7 && memcmp(Z_STRVAL_PP(val), "file://", sizeof("file://") - 1) == 0) {
- /* read cert from the named file */
- BIO *in;
-
- if (php_openssl_safe_mode_chk(Z_STRVAL_PP(val) + (sizeof("file://") - 1) TSRMLS_CC)) {
- return NULL;
- }
-
- in = BIO_new_file(Z_STRVAL_PP(val) + (sizeof("file://") - 1), "r");
- if (in == NULL) {
- return NULL;
- }
- cert = PEM_read_bio_X509(in, NULL, NULL, NULL);
- BIO_free(in);
- } else {
- BIO *in;
-
- in = BIO_new_mem_buf(Z_STRVAL_PP(val), Z_STRLEN_PP(val));
- if (in == NULL) {
- return NULL;
- }
- cert = (X509 *) PEM_ASN1_read_bio((char *(*)())d2i_X509, PEM_STRING_X509, in, NULL, NULL, NULL);
- BIO_free(in);
- }
-
- if (cert && makeresource && resourceval) {
- *resourceval = zend_list_insert(cert, le_x509);
- }
- return cert;
-}
-
-/* }}} */
-
-/* {{{ proto bool openssl_x509_export_to_file(mixed x509, string outfilename [, bool notext = true])
- Exports a CERT to file or a var */
-PHP_FUNCTION(openssl_x509_export_to_file)
-{
- X509 * cert;
- zval * zcert = NULL;
- zend_bool notext = 1;
- BIO * bio_out;
- long certresource;
- char * filename;
- int filename_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|b", &zcert, &filename, &filename_len, &notext) == FAILURE) {
- return;
- }
- RETVAL_FALSE;
-
- cert = php_openssl_x509_from_zval(&zcert, 0, &certresource TSRMLS_CC);
- if (cert == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot get cert from parameter 1");
- return;
- }
-
- if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) {
- return;
- }
-
- bio_out = BIO_new_file(filename, "w");
- if (bio_out) {
- if (!notext) {
- X509_print(bio_out, cert);
- }
- PEM_write_bio_X509(bio_out, cert);
-
- RETVAL_TRUE;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error opening file %s", filename);
- }
- if (certresource == -1 && cert) {
- X509_free(cert);
- }
- BIO_free(bio_out);
-}
-/* }}} */
-
-/* {{{ proto bool openssl_x509_export(mixed x509, string &out [, bool notext = true])
- Exports a CERT to file or a var */
-PHP_FUNCTION(openssl_x509_export)
-{
- X509 * cert;
- zval * zcert = NULL, *zout=NULL;
- zend_bool notext = 1;
- BIO * bio_out;
- long certresource;
- char * bio_mem_ptr;
- long bio_mem_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|b", &zcert, &zout, &notext) == FAILURE) {
- return;
- }
- RETVAL_FALSE;
-
- cert = php_openssl_x509_from_zval(&zcert, 0, &certresource TSRMLS_CC);
- if (cert == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot get cert from parameter 1");
- return;
- }
-
- bio_out = BIO_new(BIO_s_mem());
- if (!notext) {
- X509_print(bio_out, cert);
- }
- PEM_write_bio_X509(bio_out, cert);
-
- bio_mem_len = BIO_get_mem_data(bio_out, &bio_mem_ptr);
- ZVAL_STRINGL(zout, bio_mem_ptr, bio_mem_len, 1);
-
- RETVAL_TRUE;
-
- if (certresource == -1 && cert) {
- X509_free(cert);
- }
- BIO_free(bio_out);
-}
-/* }}} */
-
-/* {{{ proto bool openssl_x509_check_private_key(mixed cert, mixed key)
- Checks if a private key corresponds to a CERT */
-PHP_FUNCTION(openssl_x509_check_private_key)
-{
- zval * zcert, *zkey;
- X509 * cert = NULL;
- EVP_PKEY * key = NULL;
- long certresource = -1, keyresource = -1;
-
- RETVAL_FALSE;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &zcert, &zkey) == FAILURE) {
- return;
- }
- cert = php_openssl_x509_from_zval(&zcert, 0, &certresource TSRMLS_CC);
- if (cert == NULL) {
- RETURN_FALSE;
- }
- key = php_openssl_evp_from_zval(&zkey, 0, "", 1, &keyresource TSRMLS_CC);
- if (key) {
- RETVAL_BOOL(X509_check_private_key(cert, key));
- }
-
- if (keyresource == -1 && key) {
- EVP_PKEY_free(key);
- }
- if (certresource == -1 && cert) {
- X509_free(cert);
- }
-}
-/* }}} */
-
-/* {{{ proto array openssl_x509_parse(mixed x509 [, bool shortnames=true])
- Returns an array of the fields/values of the CERT */
-PHP_FUNCTION(openssl_x509_parse)
-{
- zval * zcert;
- X509 * cert = NULL;
- long certresource = -1;
- int i;
- zend_bool useshortnames = 1;
- char * tmpstr;
- zval * subitem;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &zcert, &useshortnames) == FAILURE) {
- return;
- }
- cert = php_openssl_x509_from_zval(&zcert, 0, &certresource TSRMLS_CC);
- if (cert == NULL) {
- RETURN_FALSE;
- }
- array_init(return_value);
-
- if (cert->name) {
- add_assoc_string(return_value, "name", cert->name, 1);
- }
-/* add_assoc_bool(return_value, "valid", cert->valid); */
-
- add_assoc_name_entry(return_value, "subject", X509_get_subject_name(cert), useshortnames TSRMLS_CC);
- /* hash as used in CA directories to lookup cert by subject name */
- {
- char buf[32];
- snprintf(buf, sizeof(buf), "%08lx", X509_subject_name_hash(cert));
- add_assoc_string(return_value, "hash", buf, 1);
- }
-
- add_assoc_name_entry(return_value, "issuer", X509_get_issuer_name(cert), useshortnames TSRMLS_CC);
- add_assoc_long(return_value, "version", X509_get_version(cert));
- add_assoc_long(return_value, "serialNumber", ASN1_INTEGER_get(X509_get_serialNumber(cert)));
-
- add_assoc_asn1_string(return_value, "validFrom", X509_get_notBefore(cert));
- add_assoc_asn1_string(return_value, "validTo", X509_get_notAfter(cert));
-
- add_assoc_long(return_value, "validFrom_time_t", asn1_time_to_time_t(X509_get_notBefore(cert) TSRMLS_CC));
- add_assoc_long(return_value, "validTo_time_t", asn1_time_to_time_t(X509_get_notAfter(cert) TSRMLS_CC));
-
- tmpstr = X509_alias_get0(cert, NULL);
- if (tmpstr) {
- add_assoc_string(return_value, "alias", tmpstr, 1);
- }
-/*
- add_assoc_long(return_value, "signaturetypeLONG", X509_get_signature_type(cert));
- add_assoc_string(return_value, "signaturetype", OBJ_nid2sn(X509_get_signature_type(cert)), 1);
- add_assoc_string(return_value, "signaturetypeLN", OBJ_nid2ln(X509_get_signature_type(cert)), 1);
-*/
- MAKE_STD_ZVAL(subitem);
- array_init(subitem);
-
- /* NOTE: the purposes are added as integer keys - the keys match up to the X509_PURPOSE_SSL_XXX defines
- in x509v3.h */
- for (i = 0; i < X509_PURPOSE_get_count(); i++) {
- int id, purpset;
- char * pname;
- X509_PURPOSE * purp;
- zval * subsub;
-
- MAKE_STD_ZVAL(subsub);
- array_init(subsub);
-
- purp = X509_PURPOSE_get0(i);
- id = X509_PURPOSE_get_id(purp);
-
- purpset = X509_check_purpose(cert, id, 0);
- add_index_bool(subsub, 0, purpset);
-
- purpset = X509_check_purpose(cert, id, 1);
- add_index_bool(subsub, 1, purpset);
-
- pname = useshortnames ? X509_PURPOSE_get0_sname(purp) : X509_PURPOSE_get0_name(purp);
- add_index_string(subsub, 2, pname, 1);
-
- /* NOTE: if purpset > 1 then it's a warning - we should mention it ? */
-
- add_index_zval(subitem, id, subsub);
- }
- add_assoc_zval(return_value, "purposes", subitem);
-
- if (certresource == -1 && cert) {
- X509_free(cert);
- }
-}
-/* }}} */
-
-/* {{{ load_all_certs_from_file */
-static STACK_OF(X509) * load_all_certs_from_file(char *certfile)
-{
- STACK_OF(X509_INFO) *sk=NULL;
- STACK_OF(X509) *stack=NULL, *ret=NULL;
- BIO *in=NULL;
- X509_INFO *xi;
- TSRMLS_FETCH();
-
- if(!(stack = sk_X509_new_null())) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "memory allocation failure");
- goto end;
- }
-
- if (php_openssl_safe_mode_chk(certfile TSRMLS_CC)) {
- goto end;
- }
-
- if(!(in=BIO_new_file(certfile, "r"))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error opening the file, %s", certfile);
- goto end;
- }
-
- /* This loads from a file, a stack of x509/crl/pkey sets */
- if(!(sk=PEM_X509_INFO_read_bio(in, NULL, NULL, NULL))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error reading the file, %s", certfile);
- goto end;
- }
-
- /* scan over it and pull out the certs */
- while (sk_X509_INFO_num(sk)) {
- xi=sk_X509_INFO_shift(sk);
- if (xi->x509 != NULL) {
- sk_X509_push(stack,xi->x509);
- xi->x509=NULL;
- }
- X509_INFO_free(xi);
- }
- if(!sk_X509_num(stack)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "no certificates in file, %s", certfile);
- sk_X509_free(stack);
- goto end;
- }
- ret=stack;
-end:
- BIO_free(in);
- sk_X509_INFO_free(sk);
-
- return ret;
-}
-/* }}} */
-
-/* {{{ check_cert */
-static int check_cert(X509_STORE *ctx, X509 *x, STACK_OF(X509) *untrustedchain, int purpose)
-{
- int ret=0;
- X509_STORE_CTX *csc;
- TSRMLS_FETCH();
-
- csc = X509_STORE_CTX_new();
- if (csc == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "memory allocation failure");
- return 0;
- }
- X509_STORE_CTX_init(csc, ctx, x, untrustedchain);
-
- if(purpose >= 0) {
- X509_STORE_CTX_set_purpose(csc, purpose);
- }
- ret = X509_verify_cert(csc);
- X509_STORE_CTX_free(csc);
-
- return ret;
-}
-/* }}} */
-
-/* {{{ proto int openssl_x509_checkpurpose(mixed x509cert, int purpose, array cainfo [, string untrustedfile])
- Checks the CERT to see if it can be used for the purpose in purpose. cainfo holds information about trusted CAs */
-PHP_FUNCTION(openssl_x509_checkpurpose)
-{
- zval * zcert, * zcainfo = NULL;
- X509_STORE * cainfo = NULL;
- X509 * cert = NULL;
- long certresource = -1;
- STACK_OF(X509) * untrustedchain = NULL;
- long purpose;
- char * untrusted = NULL;
- int untrusted_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl|a!s", &zcert, &purpose, &zcainfo, &untrusted, &untrusted_len)
- == FAILURE) {
- return;
- }
-
- RETVAL_LONG(-1);
-
- if (untrusted) {
- untrustedchain = load_all_certs_from_file(untrusted);
- if (untrustedchain == NULL) {
- goto clean_exit;
- }
- }
-
- cainfo = setup_verify(zcainfo TSRMLS_CC);
- if (cainfo == NULL) {
- goto clean_exit;
- }
- cert = php_openssl_x509_from_zval(&zcert, 0, &certresource TSRMLS_CC);
- if (cert == NULL) {
- goto clean_exit;
- }
- RETVAL_LONG(check_cert(cainfo, cert, untrustedchain, purpose));
-
-clean_exit:
- if (certresource == 1 && cert) {
- X509_free(cert);
- }
- if (cainfo) {
- X509_STORE_free(cainfo);
- }
- if (untrustedchain) {
- sk_X509_pop_free(untrustedchain, X509_free);
- }
-}
-/* }}} */
-
-/* {{{ setup_verify
- * calist is an array containing file and directory names. create a
- * certificate store and add those certs to it for use in verification.
-*/
-static X509_STORE * setup_verify(zval * calist TSRMLS_DC)
-{
- X509_STORE *store;
- X509_LOOKUP * dir_lookup, * file_lookup;
- HashPosition pos;
- int ndirs = 0, nfiles = 0;
-
- store = X509_STORE_new();
-
- if (store == NULL) {
- return NULL;
- }
-
- if (calist && (Z_TYPE_P(calist) == IS_ARRAY)) {
- zend_hash_internal_pointer_reset_ex(HASH_OF(calist), &pos);
- for (;; zend_hash_move_forward_ex(HASH_OF(calist), &pos)) {
- zval ** item;
- struct stat sb;
-
- if (zend_hash_get_current_data_ex(HASH_OF(calist), (void**)&item, &pos) == FAILURE) {
- break;
- }
- convert_to_string_ex(item);
-
- if (VCWD_STAT(Z_STRVAL_PP(item), &sb) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to stat %s", Z_STRVAL_PP(item));
- continue;
- }
-
- if ((sb.st_mode & S_IFREG) == S_IFREG) {
- file_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
- if (file_lookup == NULL || !X509_LOOKUP_load_file(file_lookup, Z_STRVAL_PP(item), X509_FILETYPE_PEM)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error loading file %s", Z_STRVAL_PP(item));
- } else {
- nfiles++;
- }
- file_lookup = NULL;
- } else {
- dir_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir());
- if (dir_lookup == NULL || !X509_LOOKUP_add_dir(dir_lookup, Z_STRVAL_PP(item), X509_FILETYPE_PEM)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error loading directory %s", Z_STRVAL_PP(item));
- } else {
- ndirs++;
- }
- dir_lookup = NULL;
- }
- }
- }
- if (nfiles == 0) {
- file_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
- if (file_lookup) {
- X509_LOOKUP_load_file(file_lookup, NULL, X509_FILETYPE_DEFAULT);
- }
- }
- if (ndirs == 0) {
- dir_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir());
- if (dir_lookup) {
- X509_LOOKUP_add_dir(dir_lookup, NULL, X509_FILETYPE_DEFAULT);
- }
- }
- return store;
-}
-/* }}} */
-
-/* {{{ proto resource openssl_x509_read(mixed cert)
- Reads X.509 certificates */
-PHP_FUNCTION(openssl_x509_read)
-{
- zval *cert;
- X509 *x509;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &cert) == FAILURE) {
- return;
- }
- Z_TYPE_P(return_value) = IS_RESOURCE;
- x509 = php_openssl_x509_from_zval(&cert, 1, &Z_LVAL_P(return_value) TSRMLS_CC);
-
- if (x509 == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "supplied parameter cannot be coerced into an X509 certificate!");
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto void openssl_x509_free(resource x509)
- Frees X.509 certificates */
-PHP_FUNCTION(openssl_x509_free)
-{
- zval *x509;
- X509 *cert;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &x509) == FAILURE) {
- return;
- }
- ZEND_FETCH_RESOURCE(cert, X509 *, &x509, -1, "OpenSSL X.509", le_x509);
- zend_list_delete(Z_LVAL_P(x509));
-}
-/* }}} */
-
-/* }}} */
-
-/* {{{ x509 CSR functions */
-
-/* {{{ php_openssl_make_REQ */
-static int php_openssl_make_REQ(struct php_x509_request * req, X509_REQ * csr, zval * dn, zval * attribs TSRMLS_DC)
-{
- STACK_OF(CONF_VALUE) * dn_sk, *attr_sk = NULL;
- char * str, *dn_sect, *attr_sect;
-
- dn_sect = CONF_get_string(req->req_config, req->section_name, "distinguished_name");
- if (dn_sect == NULL) {
- return FAILURE;
- }
- dn_sk = CONF_get_section(req->req_config, dn_sect);
- if (dn_sk == NULL) {
- return FAILURE;
- }
- attr_sect = CONF_get_string(req->req_config, req->section_name, "attributes");
- if (attr_sect == NULL) {
- attr_sk = NULL;
- } else {
- attr_sk = CONF_get_section(req->req_config, attr_sect);
- if (attr_sk == NULL) {
- return FAILURE;
- }
- }
- /* setup the version number: version 1 */
- if (X509_REQ_set_version(csr, 0L)) {
- int i, nid;
- char * type;
- CONF_VALUE * v;
- X509_NAME * subj;
- HashPosition hpos;
- zval ** item;
-
- subj = X509_REQ_get_subject_name(csr);
- /* apply values from the dn hash */
- zend_hash_internal_pointer_reset_ex(HASH_OF(dn), &hpos);
- while(zend_hash_get_current_data_ex(HASH_OF(dn), (void**)&item, &hpos) == SUCCESS) {
- char * strindex; int strindexlen;
- long intindex;
-
- zend_hash_get_current_key_ex(HASH_OF(dn), &strindex, &strindexlen, &intindex, 0, &hpos);
-
- convert_to_string_ex(item);
-
- if (strindex) {
- int nid;
-
- nid = OBJ_txt2nid(strindex);
- if (nid != NID_undef) {
- if (!X509_NAME_add_entry_by_NID(subj, nid, MBSTRING_ASC,
- (unsigned char*)Z_STRVAL_PP(item), -1, -1, 0))
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "dn: add_entry_by_NID %d -> %s (failed)", nid, Z_STRVAL_PP(item));
- return FAILURE;
- }
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "dn: %s is not a recognized name", strindex);
- }
- }
- zend_hash_move_forward_ex(HASH_OF(dn), &hpos);
- }
-
- /* Finally apply defaults from config file */
- for(i = 0; i < sk_CONF_VALUE_num(dn_sk); i++) {
- int len;
- char buffer[200];
-
- v = sk_CONF_VALUE_value(dn_sk, i);
- type = v->name;
-
- len = strlen(type);
- if (len < sizeof("_default")) {
- continue;
- }
- len -= sizeof("_default") - 1;
- if (strcmp("_default", type + len) != 0) {
- continue;
- }
-
- memcpy(buffer, type, len);
- buffer[len] = '\0';
- type = buffer;
-
- /* Skip past any leading X. X: X, etc to allow for multiple
- * instances */
- for (str = type; *str; str++) {
- if (*str == ':' || *str == ',' || *str == '.') {
- str++;
- if (*str) {
- type = str;
- }
- break;
- }
- }
- /* if it is already set, skip this */
- nid = OBJ_txt2nid(type);
- if (X509_NAME_get_index_by_NID(subj, nid, -1) >= 0) {
- continue;
- }
- if (!X509_NAME_add_entry_by_txt(subj, type, MBSTRING_ASC, (unsigned char*)v->value, -1, -1, 0)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "add_entry_by_txt %s -> %s (failed)", type, v->value);
- return FAILURE;
- }
- if (!X509_NAME_entry_count(subj)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "no objects specified in config file");
- return FAILURE;
- }
- }
- if (attribs) {
- zend_hash_internal_pointer_reset_ex(HASH_OF(attribs), &hpos);
- while(zend_hash_get_current_data_ex(HASH_OF(attribs), (void**)&item, &hpos) == SUCCESS) {
- char * strindex; int strindexlen;
- long intindex;
-
- zend_hash_get_current_key_ex(HASH_OF(attribs), &strindex, &strindexlen, &intindex, 0, &hpos);
- convert_to_string_ex(item);
-
- if (strindex) {
- int nid;
-
- nid = OBJ_txt2nid(strindex);
- if (nid != NID_undef) {
- if (!X509_NAME_add_entry_by_NID(subj, nid, MBSTRING_ASC, (unsigned char*)Z_STRVAL_PP(item), -1, -1, 0)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "attribs: add_entry_by_NID %d -> %s (failed)", nid, Z_STRVAL_PP(item));
- return FAILURE;
- }
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "dn: %s is not a recognized name", strindex);
- }
- }
- zend_hash_move_forward_ex(HASH_OF(attribs), &hpos);
- }
- for (i = 0; i < sk_CONF_VALUE_num(attr_sk); i++) {
- v = sk_CONF_VALUE_value(attr_sk, i);
- /* if it is already set, skip this */
- nid = OBJ_txt2nid(v->name);
- if (X509_REQ_get_attr_by_NID(csr, nid, -1) >= 0) {
- continue;
- }
- if (!X509_REQ_add1_attr_by_txt(csr, v->name, MBSTRING_ASC, (unsigned char*)v->value, -1)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "add1_attr_by_txt %s -> %s (failed)", v->name, v->value);
- return FAILURE;
- }
- }
- }
- }
-
- X509_REQ_set_pubkey(csr, req->priv_key);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_openssl_csr_from_zval */
-static X509_REQ * php_openssl_csr_from_zval(zval ** val, int makeresource, long * resourceval TSRMLS_DC)
-{
- X509_REQ * csr = NULL;
- char * filename = NULL;
- BIO * in;
-
- if (resourceval) {
- *resourceval = -1;
- }
- if (Z_TYPE_PP(val) == IS_RESOURCE) {
- void * what;
- int type;
-
- what = zend_fetch_resource(val TSRMLS_CC, -1, "OpenSSL X.509 CSR", &type, 1, le_csr);
- if (what) {
- if (resourceval) {
- *resourceval = Z_LVAL_PP(val);
- }
- return (X509_REQ*)what;
- }
- return NULL;
- } else if (Z_TYPE_PP(val) != IS_STRING) {
- return NULL;
- }
-
- if (Z_STRLEN_PP(val) > 7 && memcmp(Z_STRVAL_PP(val), "file://", sizeof("file://") - 1) == 0) {
- filename = Z_STRVAL_PP(val) + (sizeof("file://") - 1);
- }
- if (filename) {
- if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) {
- return NULL;
- }
- in = BIO_new_file(filename, "r");
- } else {
- in = BIO_new_mem_buf(Z_STRVAL_PP(val), Z_STRLEN_PP(val));
- }
- csr = PEM_read_bio_X509_REQ(in, NULL,NULL,NULL);
- BIO_free(in);
-
- return csr;
-}
-/* }}} */
-
-/* {{{ proto bool openssl_csr_export_to_file(resource csr, string outfilename [, bool notext=true])
- Exports a CSR to file */
-PHP_FUNCTION(openssl_csr_export_to_file)
-{
- X509_REQ * csr;
- zval * zcsr = NULL;
- zend_bool notext = 1;
- char * filename = NULL; int filename_len;
- BIO * bio_out;
- long csr_resource;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|b", &zcsr, &filename, &filename_len, &notext) == FAILURE) {
- return;
- }
- RETVAL_FALSE;
-
- csr = php_openssl_csr_from_zval(&zcsr, 0, &csr_resource TSRMLS_CC);
- if (csr == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot get CSR from parameter 1");
- return;
- }
-
- if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) {
- return;
- }
-
- bio_out = BIO_new_file(filename, "w");
- if (bio_out) {
- if (!notext) {
- X509_REQ_print(bio_out, csr);
- }
- PEM_write_bio_X509_REQ(bio_out, csr);
- RETVAL_TRUE;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error opening file %s", filename);
- }
-
- if (csr_resource == -1 && csr) {
- X509_REQ_free(csr);
- }
- BIO_free(bio_out);
-}
-/* }}} */
-
-
-
-/* {{{ proto bool openssl_csr_export(resource csr, string &out [, bool notext=true])
- Exports a CSR to file or a var */
-PHP_FUNCTION(openssl_csr_export)
-{
- X509_REQ * csr;
- zval * zcsr = NULL, *zout=NULL;
- zend_bool notext = 1;
- BIO * bio_out;
- long csr_resource;
- char * bio_mem_ptr;
- long bio_mem_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|b", &zcsr, &zout, &notext) == FAILURE) {
- return;
- }
- RETVAL_FALSE;
-
- csr = php_openssl_csr_from_zval(&zcsr, 0, &csr_resource TSRMLS_CC);
- if (csr == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot get CSR from parameter 1");
- return;
- }
-
- /* export to a var */
-
- bio_out = BIO_new(BIO_s_mem());
- if (!notext) {
- X509_REQ_print(bio_out, csr);
- }
- PEM_write_bio_X509_REQ(bio_out, csr);
-
- bio_mem_len = BIO_get_mem_data(bio_out, &bio_mem_ptr);
- ZVAL_STRINGL(zout, bio_mem_ptr, bio_mem_len, 1);
-
- RETVAL_TRUE;
-
- if (csr_resource == -1 && csr) {
- X509_REQ_free(csr);
- }
- BIO_free(bio_out);
-}
-/* }}} */
-
-/* {{{ proto resource openssl_csr_sign(mixed csr, mixed x509, mixed priv_key, long days)
- Signs a cert with another CERT */
-PHP_FUNCTION(openssl_csr_sign)
-{
- zval * zcert = NULL, *zcsr, *zpkey, *args = NULL;
- long num_days;
- X509 * cert = NULL, *new_cert = NULL;
- X509_REQ * csr;
- EVP_PKEY * key = NULL, *priv_key;
- long csr_resource, certresource, keyresource;
- int i;
- struct php_x509_request req;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz!zl|a!", &zcsr, &zcert, &zpkey, &num_days, &args) == FAILURE)
- return;
-
- RETVAL_FALSE;
- PHP_SSL_REQ_INIT(&req);
-
- csr = php_openssl_csr_from_zval(&zcsr, 0, &csr_resource TSRMLS_CC);
- if (csr == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot get CSR from parameter 1");
- return;
- }
- if (zcert) {
- cert = php_openssl_x509_from_zval(&zcert, 0, &certresource TSRMLS_CC);
- if (cert == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot get cert from parameter 2");
- goto cleanup;
- }
- }
- priv_key = php_openssl_evp_from_zval(&zpkey, 0, "", 1, &keyresource TSRMLS_CC);
- if (priv_key == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot get private key from parameter 3");
- goto cleanup;
- }
- if (cert && !X509_check_private_key(cert, priv_key)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "private key does not correspond to signing cert");
- goto cleanup;
- }
-
- if (PHP_SSL_REQ_PARSE(&req, args) == FAILURE) {
- goto cleanup;
- }
- /* Check that the request matches the signature */
- key = X509_REQ_get_pubkey(csr);
- if (key == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error unpacking public key");
- goto cleanup;
- }
- i = X509_REQ_verify(csr, key);
-
- if (i < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Signature verification problems");
- goto cleanup;
- }
- else if (i == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Signature did not match the certificate request");
- goto cleanup;
- }
-
- /* Now we can get on with it */
-
- new_cert = X509_new();
- if (new_cert == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No memory");
- goto cleanup;
- }
- /* Version 3 cert */
- if (!X509_set_version(new_cert, 3))
- goto cleanup;
-
- /* TODO: Allow specifying */
- ASN1_INTEGER_set(X509_get_serialNumber(new_cert), 0L);
-
- X509_set_subject_name(new_cert, X509_REQ_get_subject_name(csr));
-
- if (cert == NULL) {
- cert = new_cert;
- }
- if (!X509_set_issuer_name(new_cert, X509_get_subject_name(cert))) {
- goto cleanup;
- }
- X509_gmtime_adj(X509_get_notBefore(new_cert), 0);
- X509_gmtime_adj(X509_get_notAfter(new_cert), (long)60*60*24*num_days);
- i = X509_set_pubkey(new_cert, key);
- if (!i) {
- goto cleanup;
- }
- if (req.request_extensions_section) {
- X509V3_CTX ctx;
-
- X509V3_set_ctx(&ctx, cert, new_cert, csr, NULL, 0);
- X509V3_set_conf_lhash(&ctx, req.req_config);
- if (!X509V3_EXT_add_conf(req.req_config, &ctx, req.request_extensions_section, new_cert)) {
- goto cleanup;
- }
- }
-
- /* Now sign it */
- if (!X509_sign(new_cert, priv_key, req.digest)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to sign it");
- goto cleanup;
- }
-
- /* Succeeded; lets return the cert */
- RETVAL_RESOURCE(zend_list_insert(new_cert, le_x509));
- new_cert = NULL;
-
-cleanup:
-
- if (cert == new_cert) {
- cert = NULL;
- }
- PHP_SSL_REQ_DISPOSE(&req);
-
- if (keyresource == -1 && priv_key) {
- EVP_PKEY_free(priv_key);
- }
- if (key) {
- EVP_PKEY_free(key);
- }
- if (csr_resource == -1 && csr) {
- X509_REQ_free(csr);
- }
- if (certresource == -1 && cert) {
- X509_free(cert);
- }
- if (new_cert) {
- X509_free(new_cert);
- }
-}
-/* }}} */
-
-/* {{{ proto bool openssl_csr_new(array dn, resource &privkey [, array configargs, array extraattribs])
- Generates a privkey and CSR */
-PHP_FUNCTION(openssl_csr_new)
-{
- struct php_x509_request req;
- zval * args = NULL, * dn, *attribs = NULL;
- zval * out_pkey;
- X509_REQ * csr = NULL;
- int we_made_the_key = 1;
- long key_resource;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "az|a!a!", &dn, &out_pkey, &args, &attribs) == FAILURE) {
- return;
- }
- RETVAL_FALSE;
-
- PHP_SSL_REQ_INIT(&req);
-
- if (PHP_SSL_REQ_PARSE(&req, args) == SUCCESS) {
- /* Generate or use a private key */
- if (Z_TYPE_P(out_pkey) != IS_NULL) {
- req.priv_key = php_openssl_evp_from_zval(&out_pkey, 0, NULL, 0, &key_resource TSRMLS_CC);
- if (req.priv_key != NULL) {
- we_made_the_key = 0;
- }
- }
- if (req.priv_key == NULL) {
- php_openssl_generate_private_key(&req TSRMLS_CC);
- }
- if (req.priv_key == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to generate a private key");
- } else {
- csr = X509_REQ_new();
- if (csr) {
- if (php_openssl_make_REQ(&req, csr, dn, attribs TSRMLS_CC) == SUCCESS) {
- X509V3_CTX ext_ctx;
-
- X509V3_set_ctx(&ext_ctx, NULL, NULL, csr, NULL, 0);
- X509V3_set_conf_lhash(&ext_ctx, req.req_config);
-
- /* Add extensions */
- if (req.request_extensions_section && !X509V3_EXT_REQ_add_conf(req.req_config,
- &ext_ctx, req.request_extensions_section, csr))
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error loading extension section %s", req.request_extensions_section);
- } else {
- RETVAL_TRUE;
-
- if (X509_REQ_sign(csr, req.priv_key, req.digest)) {
- RETVAL_RESOURCE(zend_list_insert(csr, le_csr));
- csr = NULL;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error signing request");
- }
-
- if (we_made_the_key) {
- /* and a resource for the private key */
- ZVAL_RESOURCE(out_pkey, zend_list_insert(req.priv_key, le_key));
- } else if (key_resource != -1) {
- req.priv_key = NULL; /* make sure the cleanup code doesn't zap it! */
- }
- }
- }
- }
- }
- }
- if (csr) {
- X509_REQ_free(csr);
- }
- PHP_SSL_REQ_DISPOSE(&req);
-}
-/* }}} */
-
-/* }}} */
-
-/* {{{ EVP Public/Private key functions */
-
-/* {{{ php_openssl_evp_from_zval
- Given a zval, coerce it into a EVP_PKEY object.
- It can be:
- 1. private key resource from openssl_get_privatekey()
- 2. X509 resource -> public key will be extracted from it
- 3. if it starts with file:// interpreted as path to key file
- 4. interpreted as the data from the cert/key file and interpreted in same way as openssl_get_privatekey()
- 5. an array(0 => [items 2..4], 1 => passphrase)
- 6. if val is a string (possibly starting with file:///) and it is not an X509 certificate, then interpret as public key
- NOTE: If you are requesting a private key but have not specified a passphrase, you should use an
- empty string rather than NULL for the passphrase - NULL causes a passphrase prompt to be emitted in
- the Apache error log!
-*/
-static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char * passphrase, int makeresource, long * resourceval TSRMLS_DC)
-{
- EVP_PKEY * key = NULL;
- X509 * cert = NULL;
- int free_cert = 0;
- long cert_res = -1;
- char * filename = NULL;
-
- if (resourceval) {
- *resourceval = -1;
- }
- if (Z_TYPE_PP(val) == IS_ARRAY) {
- zval ** zphrase;
-
- /* get passphrase */
-
- if (zend_hash_index_find(HASH_OF(*val), 1, (void **)&zphrase) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "key array must be of the form array(0 => key, 1 => phrase)");
- return NULL;
- }
- convert_to_string_ex(zphrase);
- passphrase = Z_STRVAL_PP(zphrase);
-
- /* now set val to be the key param and continue */
- if (zend_hash_index_find(HASH_OF(*val), 0, (void **)&val) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "key array must be of the form array(0 => key, 1 => phrase)");
- return NULL;
- }
- }
-
- if (Z_TYPE_PP(val) == IS_RESOURCE) {
- void * what;
- int type;
-
- what = zend_fetch_resource(val TSRMLS_CC, -1, "OpenSSL X.509/key", &type, 2, le_x509, le_key);
- if (!what) {
- return NULL;
- }
- if (resourceval) {
- *resourceval = Z_LVAL_PP(val);
- }
- if (type == le_x509) {
- /* extract key from cert, depending on public_key param */
- cert = (X509*)what;
- free_cert = 0;
- } else if (type == le_key) {
- /* check whether it is actually a private key if requested */
- if (!public_key && !php_openssl_is_private_key((EVP_PKEY*)what TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "supplied key param is a public key");
- return NULL;
- }
-
- /* got the key - return it */
- return (EVP_PKEY*)what;
- }
-
- /* other types could be used here - eg: file pointers and read in the data from them */
-
- return NULL;
- } else {
- /* force it to be a string and check if it refers to a file */
- convert_to_string_ex(val);
-
- if (Z_STRLEN_PP(val) > 7 && memcmp(Z_STRVAL_PP(val), "file://", sizeof("file://") - 1) == 0) {
- filename = Z_STRVAL_PP(val) + (sizeof("file://") - 1);
- }
- /* it's an X509 file/cert of some kind, and we need to extract the data from that */
- if (public_key) {
- cert = php_openssl_x509_from_zval(val, 0, &cert_res TSRMLS_CC);
- free_cert = (cert_res == -1);
- /* actual extraction done later */
- if (!cert) {
- /* not a X509 certificate, try to retrieve public key */
- BIO* in;
- if (filename) {
- in = BIO_new_file(filename, "r");
- } else {
- in = BIO_new_mem_buf(Z_STRVAL_PP(val), Z_STRLEN_PP(val));
- }
- if (in == NULL) {
- return NULL;
- }
- key = PEM_read_bio_PUBKEY(in, NULL,NULL, NULL);
- BIO_free(in);
- }
- } else {
- /* we want the private key */
- BIO *in;
-
- if (filename) {
- if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) {
- return NULL;
- }
- in = BIO_new_file(filename, "r");
- } else {
- in = BIO_new_mem_buf(Z_STRVAL_PP(val), Z_STRLEN_PP(val));
- }
-
- if (in == NULL) {
- return NULL;
- }
- key = PEM_read_bio_PrivateKey(in, NULL,NULL, passphrase);
- BIO_free(in);
- }
- }
-
- if (public_key && cert && key == NULL) {
- /* extract public key from X509 cert */
- key = (EVP_PKEY *) X509_get_pubkey(cert);
- }
-
- if (free_cert && cert) {
- X509_free(cert);
- }
- if (key && makeresource && resourceval) {
- *resourceval = ZEND_REGISTER_RESOURCE(NULL, key, le_key);
- }
- return key;
-}
-/* }}} */
-
-/* {{{ php_openssl_generate_private_key */
-static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req TSRMLS_DC)
-{
- char * randfile = NULL;
- int egdsocket, seeded;
- EVP_PKEY * return_val = NULL;
-
- if (req->priv_key_bits < MIN_KEY_LENGTH) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "private key length is too short; it needs to be at least %d bits, not %d",
- MIN_KEY_LENGTH, req->priv_key_bits);
- return NULL;
- }
-
- randfile = CONF_get_string(req->req_config, req->section_name, "RANDFILE");
- php_openssl_load_rand_file(randfile, &egdsocket, &seeded);
-
- if ((req->priv_key = EVP_PKEY_new()) != NULL) {
- switch(req->priv_key_type) {
- case OPENSSL_KEYTYPE_RSA:
- if (EVP_PKEY_assign_RSA(req->priv_key, RSA_generate_key(req->priv_key_bits, 0x10001, NULL, NULL)))
- return_val = req->priv_key;
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported private key type");
- }
- }
-
- php_openssl_write_rand_file(randfile, egdsocket, seeded);
-
- if (return_val == NULL) {
- EVP_PKEY_free(req->priv_key);
- req->priv_key = NULL;
- return NULL;
- }
-
- return return_val;
-}
-/* }}} */
-
-/* {{{ php_openssl_is_private_key
- Check whether the supplied key is a private key by checking if the secret prime factors are set */
-static int php_openssl_is_private_key(EVP_PKEY* pkey TSRMLS_DC)
-{
- assert(pkey != NULL);
-
- switch (pkey->type) {
-#ifndef NO_RSA
- case EVP_PKEY_RSA:
- case EVP_PKEY_RSA2:
- assert(pkey->pkey.rsa != NULL);
-
- if (NULL == pkey->pkey.rsa->p || NULL == pkey->pkey.rsa->q) {
- return 0;
- }
- break;
-#endif
-#ifndef NO_DSA
- case EVP_PKEY_DSA:
- case EVP_PKEY_DSA1:
- case EVP_PKEY_DSA2:
- case EVP_PKEY_DSA3:
- case EVP_PKEY_DSA4:
- assert(pkey->pkey.dsa != NULL);
-
- if (NULL == pkey->pkey.dsa->p || NULL == pkey->pkey.dsa->q || NULL == pkey->pkey.dsa->priv_key){
- return 0;
- }
- break;
-#endif
-#ifndef NO_DH
- case EVP_PKEY_DH:
- assert(pkey->pkey.dh != NULL);
-
- if (NULL == pkey->pkey.dh->p || NULL == pkey->pkey.dh->priv_key) {
- return 0;
- }
- break;
-#endif
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "key type not supported in this PHP build!");
- break;
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ proto resource openssl_pkey_new([array configargs])
- Generates a new private key */
-PHP_FUNCTION(openssl_pkey_new)
-{
- struct php_x509_request req;
- zval * args = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!", &args) == FAILURE) {
- return;
- }
- RETVAL_FALSE;
-
- PHP_SSL_REQ_INIT(&req);
-
- if (PHP_SSL_REQ_PARSE(&req, args) == SUCCESS)
- {
- if (php_openssl_generate_private_key(&req TSRMLS_CC)) {
- /* pass back a key resource */
- RETVAL_RESOURCE(zend_list_insert(req.priv_key, le_key));
- /* make sure the cleanup code doesn't zap it! */
- req.priv_key = NULL;
- }
- }
- PHP_SSL_REQ_DISPOSE(&req);
-}
-/* }}} */
-
-/* {{{ proto bool openssl_pkey_export_to_file(mixed key, string outfilename [, string passphrase, array config_args)
- Gets an exportable representation of a key into a file */
-PHP_FUNCTION(openssl_pkey_export_to_file)
-{
- struct php_x509_request req;
- zval * zpkey, * args = NULL;
- char * passphrase = NULL; int passphrase_len = 0;
- char * filename = NULL; int filename_len = 0;
- long key_resource = -1;
- EVP_PKEY * key;
- BIO * bio_out = NULL;
- const EVP_CIPHER * cipher;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|s!a!", &zpkey, &filename, &filename_len, &passphrase, &passphrase_len, &args) == FAILURE) {
- return;
- }
- RETVAL_FALSE;
-
- key = php_openssl_evp_from_zval(&zpkey, 0, passphrase, 0, &key_resource TSRMLS_CC);
-
- if (key == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot get key from parameter 1");
- RETURN_FALSE;
- }
-
- if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- PHP_SSL_REQ_INIT(&req);
-
- if (PHP_SSL_REQ_PARSE(&req, args) == SUCCESS) {
- bio_out = BIO_new_file(filename, "w");
-
- if (passphrase && req.priv_key_encrypt) {
- cipher = EVP_des_ede3_cbc();
- } else {
- cipher = NULL;
- }
- if (PEM_write_bio_PrivateKey(bio_out, key, cipher, passphrase, passphrase_len, NULL, NULL)) {
- /* Success!
- * If returning the output as a string, do so now */
- RETVAL_TRUE;
- }
- }
- PHP_SSL_REQ_DISPOSE(&req);
-
- if (key_resource == -1 && key) {
- EVP_PKEY_free(key);
- }
- if (bio_out) {
- BIO_free(bio_out);
- }
-}
-/* }}} */
-
-/* {{{ proto bool openssl_pkey_export(mixed key, &mixed out [, string passphrase [, array config_args]])
- Gets an exportable representation of a key into a string or file */
-PHP_FUNCTION(openssl_pkey_export)
-{
- struct php_x509_request req;
- zval * zpkey, * args = NULL, *out;
- char * passphrase = NULL; int passphrase_len = 0;
- long key_resource = -1;
- EVP_PKEY * key;
- BIO * bio_out = NULL;
- const EVP_CIPHER * cipher;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|s!a!", &zpkey, &out, &passphrase, &passphrase_len, &args) == FAILURE) {
- return;
- }
- RETVAL_FALSE;
-
- key = php_openssl_evp_from_zval(&zpkey, 0, passphrase, 0, &key_resource TSRMLS_CC);
-
- if (key == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot get key from parameter 1");
- RETURN_FALSE;
- }
-
- PHP_SSL_REQ_INIT(&req);
-
- if (PHP_SSL_REQ_PARSE(&req, args) == SUCCESS) {
- bio_out = BIO_new(BIO_s_mem());
-
- if (passphrase && req.priv_key_encrypt) {
- cipher = EVP_des_ede3_cbc();
- } else {
- cipher = NULL;
- }
- if (PEM_write_bio_PrivateKey(bio_out, key, cipher, passphrase, passphrase_len, NULL, NULL)) {
- /* Success!
- * If returning the output as a string, do so now */
-
- char * bio_mem_ptr;
- long bio_mem_len;
- RETVAL_TRUE;
-
- bio_mem_len = BIO_get_mem_data(bio_out, &bio_mem_ptr);
- ZVAL_STRINGL(out, bio_mem_ptr, bio_mem_len, 1);
- }
- }
- PHP_SSL_REQ_DISPOSE(&req);
-
- if (key_resource == -1 && key) {
- EVP_PKEY_free(key);
- }
- if (bio_out) {
- BIO_free(bio_out);
- }
-}
-/* }}} */
-
-/* {{{ proto int openssl_pkey_get_public(mixed cert)
- Gets public key from X.509 certificate */
-PHP_FUNCTION(openssl_pkey_get_public)
-{
- zval *cert;
- EVP_PKEY *pkey;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &cert) == FAILURE) {
- return;
- }
- Z_TYPE_P(return_value) = IS_RESOURCE;
- pkey = php_openssl_evp_from_zval(&cert, 1, NULL, 1, &Z_LVAL_P(return_value) TSRMLS_CC);
-
- if (pkey == NULL) {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto void openssl_pkey_free(int key)
- Frees a key */
-PHP_FUNCTION(openssl_pkey_free)
-{
- zval *key;
- EVP_PKEY *pkey;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &key) == FAILURE) {
- return;
- }
- ZEND_FETCH_RESOURCE(pkey, EVP_PKEY *, &key, -1, "OpenSSL key", le_key);
- zend_list_delete(Z_LVAL_P(key));
-}
-/* }}} */
-
-/* {{{ proto int openssl_pkey_get_private(string key [, string passphrase])
- Gets private keys */
-PHP_FUNCTION(openssl_pkey_get_private)
-{
- zval *cert;
- EVP_PKEY *pkey;
- char * passphrase = "";
- int passphrase_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|s", &cert, &passphrase, &passphrase_len) == FAILURE) {
- return;
- }
- Z_TYPE_P(return_value) = IS_RESOURCE;
- pkey = php_openssl_evp_from_zval(&cert, 0, passphrase, 1, &Z_LVAL_P(return_value) TSRMLS_CC);
-
- if (pkey == NULL) {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* }}} */
-
-/* {{{ PKCS7 S/MIME functions */
-
-/* {{{ proto bool openssl_pkcs7_verify(string filename, long flags [, string signerscerts [, array cainfo [, string extracerts]]])
- Verifys that the data block is intact, the signer is who they say they are, and returns the CERTs of the signers */
-PHP_FUNCTION(openssl_pkcs7_verify)
-{
- X509_STORE * store = NULL;
- zval * cainfo = NULL;
- STACK_OF(X509) *signers= NULL;
- STACK_OF(X509) *others = NULL;
- PKCS7 * p7 = NULL;
- BIO * in = NULL, * datain = NULL;
- long flags = 0;
- char * filename; int filename_len;
- char * extracerts = NULL; int extracerts_len;
- char * signersfilename = NULL; int signersfilename_len;
-
- RETVAL_LONG(-1);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|sas", &filename, &filename_len,
- &flags, &signersfilename, &signersfilename_len, &cainfo,
- &extracerts, &extracerts_len) == FAILURE) {
- return;
- }
-
- if (extracerts) {
- others = load_all_certs_from_file(extracerts);
- if (others == NULL) {
- goto clean_exit;
- }
- }
-
- flags = flags & ~PKCS7_DETACHED;
-
- store = setup_verify(cainfo TSRMLS_CC);
-
- if (!store) {
- goto clean_exit;
- }
- if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) {
- goto clean_exit;
- }
-
- in = BIO_new_file(filename, (flags & PKCS7_BINARY) ? "rb" : "r");
- if (in == NULL) {
- goto clean_exit;
- }
- p7 = SMIME_read_PKCS7(in, &datain);
- if (p7 == NULL) {
-#if DEBUG_SMIME
- zend_printf("SMIME_read_PKCS7 failed\n");
-#endif
- goto clean_exit;
- }
-#if DEBUG_SMIME
- zend_printf("Calling PKCS7 verify\n");
-#endif
-
- if (PKCS7_verify(p7, others, store, datain, NULL, flags)) {
-
- RETVAL_TRUE;
-
- if (signersfilename) {
- BIO *certout;
-
- if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) {
- goto clean_exit;
- }
-
- certout = BIO_new_file(signersfilename, "w");
- if (certout) {
- int i;
- signers = PKCS7_get0_signers(p7, NULL, flags);
-
- for(i = 0; i < sk_X509_num(signers); i++) {
- PEM_write_bio_X509(certout, sk_X509_value(signers, i));
- }
- BIO_free(certout);
- sk_X509_free(signers);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "signature OK, but cannot open %s for writing", signersfilename);
- RETVAL_LONG(-1);
- }
- }
- goto clean_exit;
- } else {
- RETVAL_FALSE;
- }
-clean_exit:
- X509_STORE_free(store);
- BIO_free(datain);
- BIO_free(in);
- PKCS7_free(p7);
- sk_X509_free(others);
-}
-/* }}} */
-
-/* {{{ proto bool openssl_pkcs7_encrypt(string infile, string outfile, mixed recipcerts, array headers [, long flags [, long cipher]])
- Encrypts the message in the file named infile with the certificates in recipcerts and output the result to the file named outfile */
-PHP_FUNCTION(openssl_pkcs7_encrypt)
-{
- zval * zrecipcerts, * zheaders = NULL;
- STACK_OF(X509) * recipcerts = NULL;
- BIO * infile = NULL, * outfile = NULL;
- long flags = 0;
- PKCS7 * p7 = NULL;
- HashPosition hpos;
- zval ** zcertval;
- X509 * cert;
- const EVP_CIPHER *cipher = NULL;
- long cipherid = PHP_OPENSSL_CIPHER_DEFAULT;
- uint strindexlen;
- ulong intindex;
- char * strindex;
- char * infilename = NULL; int infilename_len;
- char * outfilename = NULL; int outfilename_len;
-
- RETVAL_FALSE;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssza!|ll", &infilename, &infilename_len,
- &outfilename, &outfilename_len, &zrecipcerts, &zheaders, &flags, &cipherid) == FAILURE)
- return;
-
-
- if (php_openssl_safe_mode_chk(infilename TSRMLS_CC) || php_openssl_safe_mode_chk(outfilename TSRMLS_CC)) {
- return;
- }
-
- infile = BIO_new_file(infilename, "r");
- if (infile == NULL) {
- goto clean_exit;
- }
-
- outfile = BIO_new_file(outfilename, "w");
- if (outfile == NULL) {
- goto clean_exit;
- }
-
- recipcerts = sk_X509_new_null();
-
- /* get certs */
- if (Z_TYPE_P(zrecipcerts) == IS_ARRAY) {
- zend_hash_internal_pointer_reset_ex(HASH_OF(zrecipcerts), &hpos);
- while(zend_hash_get_current_data_ex(HASH_OF(zrecipcerts), (void**)&zcertval, &hpos) == SUCCESS) {
- long certresource;
-
- cert = php_openssl_x509_from_zval(zcertval, 0, &certresource TSRMLS_CC);
- if (cert == NULL) {
- goto clean_exit;
- }
-
- if (certresource != -1) {
- /* we shouldn't free this particular cert, as it is a resource.
- make a copy and push that on the stack instead */
- cert = X509_dup(cert);
- if (cert == NULL) {
- goto clean_exit;
- }
- }
- sk_X509_push(recipcerts, cert);
-
- zend_hash_move_forward_ex(HASH_OF(zrecipcerts), &hpos);
- }
- } else {
- /* a single certificate */
- long certresource;
-
- cert = php_openssl_x509_from_zval(&zrecipcerts, 0, &certresource TSRMLS_CC);
- if (cert == NULL) {
- goto clean_exit;
- }
-
- if (certresource != -1) {
- /* we shouldn't free this particular cert, as it is a resource.
- make a copy and push that on the stack instead */
- cert = X509_dup(cert);
- if (cert == NULL) {
- goto clean_exit;
- }
- }
- sk_X509_push(recipcerts, cert);
- }
-
- /* sanity check the cipher */
- switch (cipherid) {
- case PHP_OPENSSL_CIPHER_RC2_40:
- cipher = EVP_rc2_40_cbc();
- break;
- case PHP_OPENSSL_CIPHER_RC2_64:
- cipher = EVP_rc2_64_cbc();
- break;
- case PHP_OPENSSL_CIPHER_RC2_128:
- cipher = EVP_rc2_cbc();
- break;
- case PHP_OPENSSL_CIPHER_DES:
- cipher = EVP_des_cbc();
- break;
- case PHP_OPENSSL_CIPHER_3DES:
- cipher = EVP_des_ede3_cbc();
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid cipher type `%d'", cipherid);
- goto clean_exit;
- }
- if (cipher == NULL) {
- /* shouldn't happen */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to get cipher");
- goto clean_exit;
- }
-
- p7 = PKCS7_encrypt(recipcerts, infile, (EVP_CIPHER*)cipher, flags);
-
- if (p7 == NULL) {
- goto clean_exit;
- }
-
- /* tack on extra headers */
- if (zheaders) {
- zend_hash_internal_pointer_reset_ex(HASH_OF(zheaders), &hpos);
- while(zend_hash_get_current_data_ex(HASH_OF(zheaders), (void**)&zcertval, &hpos) == SUCCESS) {
- zend_hash_get_current_key_ex(HASH_OF(zheaders), &strindex, &strindexlen, &intindex, 0, &hpos);
-
- convert_to_string_ex(zcertval);
-
- if (strindex) {
- BIO_printf(outfile, "%s: %s\n", strindex, Z_STRVAL_PP(zcertval));
- } else {
- BIO_printf(outfile, "%s\n", Z_STRVAL_PP(zcertval));
- }
-
- zend_hash_move_forward_ex(HASH_OF(zheaders), &hpos);
- }
- }
-
- BIO_reset(infile);
-
- /* write the encrypted data */
- SMIME_write_PKCS7(outfile, p7, infile, flags);
-
- RETVAL_TRUE;
-
-clean_exit:
- PKCS7_free(p7);
- BIO_free(infile);
- BIO_free(outfile);
- if (recipcerts) {
- sk_X509_pop_free(recipcerts, X509_free);
- }
-}
-/* }}} */
-
-/* {{{ proto bool openssl_pkcs7_sign(string infile, string outfile, mixed signcert, mixed signkey, array headers [, long flags [, string extracertsfilename]])
- Signs the MIME message in the file named infile with signcert/signkey and output the result to file name outfile. headers lists plain text headers to exclude from the signed portion of the message, and should include to, from and subject as a minimum */
-
-PHP_FUNCTION(openssl_pkcs7_sign)
-{
- zval * zcert, * zprivkey, * zheaders;
- zval ** hval;
- X509 * cert = NULL;
- EVP_PKEY * privkey = NULL;
- long flags = PKCS7_DETACHED;
- PKCS7 * p7 = NULL;
- BIO * infile = NULL, * outfile = NULL;
- STACK_OF(X509) *others = NULL;
- long certresource = -1, keyresource = -1;
- ulong intindex;
- uint strindexlen;
- HashPosition hpos;
- char * strindex;
- char * infilename; int infilename_len;
- char * outfilename; int outfilename_len;
- char * extracertsfilename = NULL; int extracertsfilename_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sszza!|ls",
- &infilename, &infilename_len, &outfilename, &outfilename_len,
- &zcert, &zprivkey, &zheaders, &flags, &extracertsfilename,
- &extracertsfilename_len) == FAILURE) {
- return;
- }
-
- RETVAL_FALSE;
-
- if (extracertsfilename) {
- others = load_all_certs_from_file(extracertsfilename);
- if (others == NULL) {
- goto clean_exit;
- }
- }
-
- privkey = php_openssl_evp_from_zval(&zprivkey, 0, "", 0, &keyresource TSRMLS_CC);
- if (privkey == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error getting private key");
- goto clean_exit;
- }
-
- cert = php_openssl_x509_from_zval(&zcert, 0, &certresource TSRMLS_CC);
- if (cert == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error getting cert");
- goto clean_exit;
- }
-
- if (php_openssl_safe_mode_chk(infilename TSRMLS_CC) || php_openssl_safe_mode_chk(outfilename TSRMLS_CC)) {
- goto clean_exit;
- }
-
- infile = BIO_new_file(infilename, "r");
- if (infile == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error opening input file %s!", infilename);
- goto clean_exit;
- }
-
- outfile = BIO_new_file(outfilename, "w");
- if (outfile == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error opening output file %s!", outfilename);
- goto clean_exit;
- }
-
- p7 = PKCS7_sign(cert, privkey, others, infile, flags);
- if (p7 == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error creating PKCS7 structure!");
- goto clean_exit;
- }
-
- BIO_reset(infile);
-
- /* tack on extra headers */
- if (zheaders) {
- zend_hash_internal_pointer_reset_ex(HASH_OF(zheaders), &hpos);
- while(zend_hash_get_current_data_ex(HASH_OF(zheaders), (void**)&hval, &hpos) == SUCCESS) {
- zend_hash_get_current_key_ex(HASH_OF(zheaders), &strindex, &strindexlen, &intindex, 0, &hpos);
-
- convert_to_string_ex(hval);
-
- if (strindex) {
- BIO_printf(outfile, "%s: %s\n", strindex, Z_STRVAL_PP(hval));
- } else {
- BIO_printf(outfile, "%s\n", Z_STRVAL_PP(hval));
- }
- zend_hash_move_forward_ex(HASH_OF(zheaders), &hpos);
- }
- }
- /* write the signed data */
- SMIME_write_PKCS7(outfile, p7, infile, flags);
-
- RETVAL_TRUE;
-
-clean_exit:
- PKCS7_free(p7);
- BIO_free(infile);
- BIO_free(outfile);
- if (others) {
- sk_X509_pop_free(others, X509_free);
- }
- if (privkey && keyresource == -1) {
- EVP_PKEY_free(privkey);
- }
- if (cert && certresource == -1) {
- X509_free(cert);
- }
-}
-/* }}} */
-
-/* {{{ proto bool openssl_pkcs7_decrypt(string infilename, string outfilename, mixed recipcert [, mixed recipkey])
- Decrypts the S/MIME message in the file name infilename and output the results to the file name outfilename. recipcert is a CERT for one of the recipients. recipkey specifies the private key matching recipcert, if recipcert does not include the key */
-
-PHP_FUNCTION(openssl_pkcs7_decrypt)
-{
- zval * recipcert, * recipkey = NULL;
- X509 * cert = NULL;
- EVP_PKEY * key = NULL;
- long certresval, keyresval;
- BIO * in = NULL, * out = NULL, * datain = NULL;
- PKCS7 * p7 = NULL;
- char * infilename; int infilename_len;
- char * outfilename; int outfilename_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssz|z", &infilename, &infilename_len,
- &outfilename, &outfilename_len, &recipcert, &recipkey) == FAILURE) {
- return;
- }
-
- RETVAL_FALSE;
-
- cert = php_openssl_x509_from_zval(&recipcert, 0, &certresval TSRMLS_CC);
- if (cert == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to coerce parameter 3 to x509 cert");
- goto clean_exit;
- }
-
- key = php_openssl_evp_from_zval(recipkey ? &recipkey : &recipcert, 0, "", 0, &keyresval TSRMLS_CC);
- if (key == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to get private key");
- goto clean_exit;
- }
-
- if (php_openssl_safe_mode_chk(infilename TSRMLS_CC) || php_openssl_safe_mode_chk(outfilename TSRMLS_CC)) {
- goto clean_exit;
- }
-
- in = BIO_new_file(infilename, "r");
- if (in == NULL) {
- goto clean_exit;
- }
- out = BIO_new_file(outfilename, "w");
- if (out == NULL) {
- goto clean_exit;
- }
-
- p7 = SMIME_read_PKCS7(in, &datain);
-
- if (p7 == NULL) {
- goto clean_exit;
- }
- if (PKCS7_decrypt(p7, key, cert, out, PKCS7_DETACHED)) {
- RETVAL_TRUE;
- }
-clean_exit:
- PKCS7_free(p7);
- BIO_free(datain);
- BIO_free(in);
- BIO_free(out);
- if (cert && certresval == -1) {
- X509_free(cert);
- }
- if (key && keyresval == -1) {
- EVP_PKEY_free(key);
- }
-}
-/* }}} */
-
-/* }}} */
-
-/* {{{ proto bool openssl_private_encrypt(string data, string crypted, mixed key [, int padding])
- Encrypts data with private key */
-PHP_FUNCTION(openssl_private_encrypt)
-{
- zval *key, *crypted;
- EVP_PKEY *pkey;
- int cryptedlen;
- unsigned char *cryptedbuf = NULL;
- int successful = 0;
- long keyresource = -1;
- char * data;
- int data_len;
- long padding = RSA_PKCS1_PADDING;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) {
- return;
- }
- RETVAL_FALSE;
-
- pkey = php_openssl_evp_from_zval(&key, 0, "", 0, &keyresource TSRMLS_CC);
-
- if (pkey == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "key param is not a valid private key");
- RETURN_FALSE;
- }
-
- cryptedlen = EVP_PKEY_size(pkey);
- cryptedbuf = emalloc(cryptedlen + 1);
-
- switch (Z_TYPE_P(pkey)) {
- case EVP_PKEY_RSA:
- case EVP_PKEY_RSA2:
- successful = (RSA_private_encrypt(data_len,
- data,
- cryptedbuf,
- pkey->pkey.rsa,
- padding) == cryptedlen);
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "key type not supported in this PHP build!");
- }
-
- if (successful) {
- zval_dtor(crypted);
- cryptedbuf[cryptedlen] = '\0';
- ZVAL_STRINGL(crypted, cryptedbuf, cryptedlen, 0);
- cryptedbuf = NULL;
- RETVAL_TRUE;
- }
- if (cryptedbuf) {
- efree(cryptedbuf);
- }
- if (keyresource == -1) {
- EVP_PKEY_free(pkey);
- }
-}
-/* }}} */
-
-/* {{{ proto bool openssl_private_decrypt(string data, string decrypted, mixed key [, int padding])
- Decrypts data with private key */
-PHP_FUNCTION(openssl_private_decrypt)
-{
- zval *key, *crypted;
- EVP_PKEY *pkey;
- int cryptedlen;
- unsigned char *cryptedbuf = NULL;
- unsigned char *crypttemp;
- int successful = 0;
- long padding = RSA_PKCS1_PADDING;
- long keyresource = -1;
- char * data;
- int data_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) {
- return;
- }
- RETVAL_FALSE;
-
- pkey = php_openssl_evp_from_zval(&key, 0, "", 0, &keyresource TSRMLS_CC);
- if (pkey == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "key parameter is not a valid private key");
- RETURN_FALSE;
- }
-
- cryptedlen = EVP_PKEY_size(pkey);
- crypttemp = emalloc(cryptedlen + 1);
-
- switch (Z_TYPE_P(pkey)) {
- case EVP_PKEY_RSA:
- case EVP_PKEY_RSA2:
- cryptedlen = RSA_private_decrypt(data_len,
- data,
- crypttemp,
- pkey->pkey.rsa,
- padding);
- if (cryptedlen != -1) {
- cryptedbuf = emalloc(cryptedlen + 1);
- memcpy(cryptedbuf, crypttemp, cryptedlen);
- successful = 1;
- }
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "key type not supported in this PHP build!");
- }
-
- efree(crypttemp);
-
- if (successful) {
- zval_dtor(crypted);
- cryptedbuf[cryptedlen] = '\0';
- ZVAL_STRINGL(crypted, cryptedbuf, cryptedlen, 0);
- cryptedbuf = NULL;
- RETVAL_TRUE;
- }
-
- if (keyresource == -1) {
- EVP_PKEY_free(pkey);
- }
- if (cryptedbuf) {
- efree(cryptedbuf);
- }
-}
-/* }}} */
-
-/* {{{ proto bool openssl_public_encrypt(string data, string crypted, mixed key [, int padding])
- Encrypts data with public key */
-PHP_FUNCTION(openssl_public_encrypt)
-{
- zval *key, *crypted;
- EVP_PKEY *pkey;
- int cryptedlen;
- unsigned char *cryptedbuf;
- int successful = 0;
- long keyresource = -1;
- long padding = RSA_PKCS1_PADDING;
- char * data;
- int data_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &data, &data_len, &crypted, &key, &padding) == FAILURE)
- return;
-
- RETVAL_FALSE;
-
- pkey = php_openssl_evp_from_zval(&key, 1, NULL, 0, &keyresource TSRMLS_CC);
- if (pkey == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "key parameter is not a valid public key");
- RETURN_FALSE;
- }
-
- cryptedlen = EVP_PKEY_size(pkey);
- cryptedbuf = emalloc(cryptedlen + 1);
-
- switch (Z_TYPE_P(pkey)) {
- case EVP_PKEY_RSA:
- case EVP_PKEY_RSA2:
- successful = (RSA_public_encrypt(data_len,
- data,
- cryptedbuf,
- pkey->pkey.rsa,
- padding) == cryptedlen);
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "key type not supported in this PHP build!");
-
- }
-
- if (successful) {
- zval_dtor(crypted);
- cryptedbuf[cryptedlen] = '\0';
- ZVAL_STRINGL(crypted, cryptedbuf, cryptedlen, 0);
- cryptedbuf = NULL;
- RETVAL_TRUE;
- }
- if (keyresource == -1) {
- EVP_PKEY_free(pkey);
- }
- if (cryptedbuf) {
- efree(cryptedbuf);
- }
-}
-/* }}} */
-
-/* {{{ proto bool openssl_public_decrypt(string data, string crypted, resource key [, int padding])
- Decrypts data with public key */
-PHP_FUNCTION(openssl_public_decrypt)
-{
- zval *key, *crypted;
- EVP_PKEY *pkey;
- int cryptedlen;
- unsigned char *cryptedbuf = NULL;
- unsigned char *crypttemp;
- int successful = 0;
- long keyresource = -1;
- long padding = RSA_PKCS1_PADDING;
- char * data;
- int data_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) {
- return;
- }
- RETVAL_FALSE;
-
- pkey = php_openssl_evp_from_zval(&key, 1, NULL, 0, &keyresource TSRMLS_CC);
- if (pkey == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "key parameter is not a valid public key");
- RETURN_FALSE;
- }
-
- cryptedlen = EVP_PKEY_size(pkey);
- crypttemp = emalloc(cryptedlen + 1);
-
- switch (Z_TYPE_P(pkey)) {
- case EVP_PKEY_RSA:
- case EVP_PKEY_RSA2:
- cryptedlen = RSA_public_decrypt(data_len,
- data,
- crypttemp,
- pkey->pkey.rsa,
- padding);
- if (cryptedlen != -1) {
- cryptedbuf = emalloc(cryptedlen + 1);
- memcpy(cryptedbuf, crypttemp, cryptedlen);
- successful = 1;
- }
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "key type not supported in this PHP build!");
-
- }
-
- efree(crypttemp);
-
- if (successful) {
- zval_dtor(crypted);
- cryptedbuf[cryptedlen] = '\0';
- ZVAL_STRINGL(crypted, cryptedbuf, cryptedlen, 0);
- cryptedbuf = NULL;
- RETVAL_TRUE;
- }
-
- if (cryptedbuf) {
- efree(cryptedbuf);
- }
- if (keyresource == -1) {
- EVP_PKEY_free(pkey);
- }
-}
-/* }}} */
-
-/* {{{ proto mixed openssl_error_string(void)
- Returns a description of the last error, and alters the index of the error messages. Returns false when the are no more messages */
-PHP_FUNCTION(openssl_error_string)
-{
- char buf[512];
- unsigned long val;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- val = ERR_get_error();
- if (val) {
- RETURN_STRING(ERR_error_string(val, buf), 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool openssl_sign(string data, &string signature, mixed key)
- Signs data */
-PHP_FUNCTION(openssl_sign)
-{
- zval *key, *signature;
- EVP_PKEY *pkey;
- int siglen;
- unsigned char *sigbuf;
- long keyresource = -1;
- char * data;
- int data_len;
- EVP_MD_CTX md_ctx;
- long signature_algo = OPENSSL_ALGO_SHA1;
- EVP_MD *mdtype;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &data, &data_len, &signature, &key, &signature_algo) == FAILURE) {
- return;
- }
- pkey = php_openssl_evp_from_zval(&key, 0, "", 0, &keyresource TSRMLS_CC);
- if (pkey == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "supplied key param cannot be coerced into a private key");
- RETURN_FALSE;
- }
-
- siglen = EVP_PKEY_size(pkey);
- sigbuf = emalloc(siglen + 1);
-
- switch (signature_algo) {
- case OPENSSL_ALGO_SHA1:
- mdtype = EVP_sha1();
- break;
- case OPENSSL_ALGO_MD5:
- mdtype = EVP_md5();
- break;
- case OPENSSL_ALGO_MD4:
- mdtype = EVP_md4();
- break;
- case OPENSSL_ALGO_MD2:
- mdtype = EVP_md2();
- break;
- }
-
- EVP_SignInit(&md_ctx, mdtype);
- EVP_SignUpdate(&md_ctx, data, data_len);
- if (EVP_SignFinal (&md_ctx, sigbuf, &siglen, pkey)) {
- zval_dtor(signature);
- sigbuf[siglen] = '\0';
- ZVAL_STRINGL(signature, sigbuf, siglen, 0);
- RETVAL_TRUE;
- } else {
- efree(sigbuf);
- RETVAL_FALSE;
- }
- if (keyresource == -1) {
- EVP_PKEY_free(pkey);
- }
-}
-/* }}} */
-
-/* {{{ proto int openssl_verify(string data, string signature, mixed key)
- Verifys data */
-PHP_FUNCTION(openssl_verify)
-{
- zval *key;
- EVP_PKEY *pkey;
- int err;
- EVP_MD_CTX md_ctx;
- long keyresource = -1;
- char * data; int data_len;
- char * signature; int signature_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssz", &data, &data_len, &signature, &signature_len, &key) == FAILURE) {
- return;
- }
-
- pkey = php_openssl_evp_from_zval(&key, 1, NULL, 0, &keyresource TSRMLS_CC);
- if (pkey == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "supplied key param cannot be coerced into a public key");
- RETURN_FALSE;
- }
-
- EVP_VerifyInit (&md_ctx, EVP_sha1());
- EVP_VerifyUpdate (&md_ctx, data, data_len);
- err = EVP_VerifyFinal (&md_ctx, signature, signature_len, pkey);
-
- if (keyresource == -1) {
- EVP_PKEY_free(pkey);
- }
- RETURN_LONG(err);
-}
-/* }}} */
-
-/* {{{ proto int openssl_seal(string data, &string sealdata, &array ekeys, array pubkeys)
- Seals data */
-PHP_FUNCTION(openssl_seal)
-{
- zval *pubkeys, **pubkey, *sealdata, *ekeys;
- HashTable *pubkeysht;
- HashPosition pos;
- EVP_PKEY **pkeys;
- long * key_resources; /* so we know what to cleanup */
- int i, len1, len2, *eksl, nkeys;
- unsigned char *buf = NULL, **eks;
- char * data; int data_len;
- EVP_CIPHER_CTX ctx;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szza/", &data, &data_len, &sealdata, &ekeys, &pubkeys) == FAILURE) {
- return;
- }
-
- pubkeysht = HASH_OF(pubkeys);
- nkeys = pubkeysht ? zend_hash_num_elements(pubkeysht) : 0;
- if (!nkeys) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Fourth argument to openssl_seal() must be a non-empty array");
- RETURN_FALSE;
- }
-
- pkeys = safe_emalloc(nkeys, sizeof(*pkeys), 0);
- eksl = safe_emalloc(nkeys, sizeof(*eksl), 0);
- eks = safe_emalloc(nkeys, sizeof(*eks), 0);
- key_resources = safe_emalloc(nkeys, sizeof(long), 0);
-
- /* get the public keys we are using to seal this data */
- zend_hash_internal_pointer_reset_ex(pubkeysht, &pos);
- i = 0;
- while (zend_hash_get_current_data_ex(pubkeysht, (void **) &pubkey,
- &pos) == SUCCESS) {
- pkeys[i] = php_openssl_evp_from_zval(pubkey, 1, NULL, 0, &key_resources[i] TSRMLS_CC);
- if (pkeys[i] == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not a public key (%dth member of pubkeys)", i);
- RETVAL_FALSE;
- goto clean_exit;
- }
- eks[i] = emalloc(EVP_PKEY_size(pkeys[i]) + 1);
- zend_hash_move_forward_ex(pubkeysht, &pos);
- i++;
- }
-
- if (!EVP_EncryptInit(&ctx,EVP_rc4(),NULL,NULL)) {
- RETVAL_FALSE;
- goto clean_exit;
- }
-
-#if 0
- /* Need this if allow ciphers that require initialization vector */
- ivlen = EVP_CIPHER_CTX_iv_length(&ctx);
- iv = ivlen ? emalloc(ivlen + 1) : NULL;
-#endif
- /* allocate one byte extra to make room for \0 */
- buf = emalloc(data_len + EVP_CIPHER_CTX_block_size(&ctx));
-
- if (!EVP_SealInit(&ctx, EVP_rc4(), eks, eksl, NULL, pkeys, nkeys) || !EVP_SealUpdate(&ctx, buf, &len1, data, data_len)) {
- RETVAL_FALSE;
- efree(buf);
- goto clean_exit;
- }
-
- EVP_SealFinal(&ctx, buf + len1, &len2);
-
- if (len1 + len2 > 0) {
- zval_dtor(sealdata);
- buf[len1 + len2] = '\0';
- buf = erealloc(buf, len1 + len2 + 1);
- ZVAL_STRINGL(sealdata, buf, len1 + len2, 0);
-
- zval_dtor(ekeys);
- array_init(ekeys);
- for (i=0; i<nkeys; i++) {
- eks[i][eksl[i]] = '\0';
- add_next_index_stringl(ekeys, erealloc(eks[i], eksl[i] + 1), eksl[i], 0);
- eks[i] = NULL;
- }
-#if 0
- /* If allow ciphers that need IV, we need this */
- zval_dtor(*ivec);
- if (ivlen) {
- iv[ivlen] = '\0';
- ZVAL_STRINGL(*ivec, erealloc(iv, ivlen + 1), ivlen, 0);
- } else {
- ZVAL_EMPTY_STRING(*ivec);
- }
-#endif
- } else {
- efree(buf);
- }
- RETVAL_LONG(len1 + len2);
-
-clean_exit:
- for (i=0; i<nkeys; i++) {
- if (key_resources[i] == -1) {
- EVP_PKEY_free(pkeys[i]);
- }
- if (eks[i]) {
- efree(eks[i]);
- }
- }
- efree(eks);
- efree(eksl);
- efree(pkeys);
- efree(key_resources);
-}
-/* }}} */
-
-/* {{{ proto bool openssl_open(string data, &string opendata, string ekey, mixed privkey)
- Opens data */
-PHP_FUNCTION(openssl_open)
-{
- zval *privkey, *opendata;
- EVP_PKEY *pkey;
- int len1, len2;
- unsigned char *buf;
- long keyresource = -1;
- EVP_CIPHER_CTX ctx;
- char * data; int data_len;
- char * ekey; int ekey_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szsz", &data, &data_len, &opendata, &ekey, &ekey_len, &privkey) == FAILURE) {
- return;
- }
-
- pkey = php_openssl_evp_from_zval(&privkey, 0, "", 0, &keyresource TSRMLS_CC);
- if (pkey == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to coerce parameter 4 into a private key");
- RETURN_FALSE;
- }
- buf = emalloc(data_len + 1);
-
- if (EVP_OpenInit(&ctx, EVP_rc4(), ekey, ekey_len, NULL, pkey) && EVP_OpenUpdate(&ctx, buf, &len1, data, data_len)) {
- if (!EVP_OpenFinal(&ctx, buf + len1, &len2) || (len1 + len2 == 0)) {
- efree(buf);
- if (keyresource == -1) {
- EVP_PKEY_free(pkey);
- }
- RETURN_FALSE;
- }
- } else {
- efree(buf);
- if (keyresource == -1) {
- EVP_PKEY_free(pkey);
- }
- RETURN_FALSE;
- }
- if (keyresource == -1) {
- EVP_PKEY_free(pkey);
- }
- zval_dtor(opendata);
- buf[len1 + len2] = '\0';
- ZVAL_STRINGL(opendata, erealloc(buf, len1 + len2 + 1), len1 + len2, 0);
- RETURN_TRUE;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 8
- * c-basic-offset: 8
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/openssl/openssl.dsp b/ext/openssl/openssl.dsp
deleted file mode 100644
index 40f58a92df..0000000000
--- a/ext/openssl/openssl.dsp
+++ /dev/null
@@ -1,107 +0,0 @@
-# Microsoft Developer Studio Project File - Name="openssl" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=openssl - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "openssl.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "openssl.mak" CFG="openssl - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "openssl - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "openssl - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "openssl - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPENSSL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_OPENSSL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OPENSSL_EXT=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_openssl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "openssl - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPENSSL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_OPENSSL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OPENSSL_EXT=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_openssl.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "openssl - Win32 Release_TS"
-# Name "openssl - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\openssl.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_openssl.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h
deleted file mode 100644
index 2c7dde6bb6..0000000000
--- a/ext/openssl/php_openssl.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Venaas <venaas@php.net> |
- | Wez Furlong <wez@thebrainroom.com |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_OPENSSL_H
-#define PHP_OPENSSL_H
-/* HAVE_OPENSSL would include SSL MySQL stuff */
-#if HAVE_OPENSSL_EXT
-extern zend_module_entry openssl_module_entry;
-#define phpext_openssl_ptr &openssl_module_entry
-
-php_stream_transport_factory_func php_openssl_ssl_socket_factory;
-
-PHP_MINIT_FUNCTION(openssl);
-PHP_MSHUTDOWN_FUNCTION(openssl);
-PHP_MINFO_FUNCTION(openssl);
-
-PHP_FUNCTION(openssl_pkey_get_private);
-PHP_FUNCTION(openssl_pkey_get_public);
-PHP_FUNCTION(openssl_pkey_free);
-PHP_FUNCTION(openssl_pkey_new);
-PHP_FUNCTION(openssl_pkey_export);
-PHP_FUNCTION(openssl_pkey_export_to_file);
-
-PHP_FUNCTION(openssl_sign);
-PHP_FUNCTION(openssl_verify);
-PHP_FUNCTION(openssl_seal);
-PHP_FUNCTION(openssl_open);
-PHP_FUNCTION(openssl_private_encrypt);
-PHP_FUNCTION(openssl_private_decrypt);
-PHP_FUNCTION(openssl_public_encrypt);
-PHP_FUNCTION(openssl_public_decrypt);
-
-PHP_FUNCTION(openssl_pkcs7_verify);
-PHP_FUNCTION(openssl_pkcs7_decrypt);
-PHP_FUNCTION(openssl_pkcs7_sign);
-PHP_FUNCTION(openssl_pkcs7_encrypt);
-
-PHP_FUNCTION(openssl_error_string);
-
-PHP_FUNCTION(openssl_x509_read);
-PHP_FUNCTION(openssl_x509_free);
-PHP_FUNCTION(openssl_x509_parse);
-PHP_FUNCTION(openssl_x509_checkpurpose);
-PHP_FUNCTION(openssl_x509_export);
-PHP_FUNCTION(openssl_x509_export_to_file);
-PHP_FUNCTION(openssl_x509_check_private_key);
-PHP_FUNCTION(openssl_csr_new);
-PHP_FUNCTION(openssl_csr_export);
-PHP_FUNCTION(openssl_csr_export_to_file);
-PHP_FUNCTION(openssl_csr_sign);
-
-#else
-
-#define phpext_openssl_ptr NULL
-
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/openssl/tests/001.phpt b/ext/openssl/tests/001.phpt
deleted file mode 100644
index 9b15e134a5..0000000000
--- a/ext/openssl/tests/001.phpt
+++ /dev/null
@@ -1,74 +0,0 @@
---TEST--
-OpenSSL private key functions
---SKIPIF--
-<?php // vim600:syn=php
-include('skipif.inc'); ?>
---POST--
---GET--
---FILE--
-<?php
-echo "Creating private key\n";
-
-/* stack up some entropy; performance is not critical,
- * and being slow will most likely even help the test.
- */
-for ($z = "", $i = 0; $i < 1024; $i++) {
- $z .= $i * $i;
- if (function_exists("usleep"))
- usleep($i);
-}
-
-$privkey = openssl_pkey_new();
-
-if ($privkey === false)
- die("failed to create private key");
-
-$passphrase = "banana";
-$key_file_name = tempnam("/tmp", "ssl");
-if ($key_file_name === false)
- die("failed to get a temporary filename!");
-
-echo "Export key to file\n";
-
-openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase) or die("failed to export to file $key_file_name");
-
-echo "Load key from file - array syntax\n";
-
-$loaded_key = openssl_pkey_get_private(array("file://$key_file_name", $passphrase));
-
-if ($loaded_key === false)
- die("failed to load key using array syntax");
-
-openssl_pkey_free($loaded_key);
-
-echo "Load key using direct syntax\n";
-
-$loaded_key = openssl_pkey_get_private("file://$key_file_name", $passphrase);
-
-if ($loaded_key === false)
- die("failed to load key using direct syntax");
-
-openssl_pkey_free($loaded_key);
-
-echo "Load key manually and use string syntax\n";
-
-$key_content = file_get_contents($key_file_name);
-$loaded_key = openssl_pkey_get_private($key_content, $passphrase);
-
-if ($loaded_key === false)
- die("failed to load key using string syntax");
-
-openssl_pkey_free($loaded_key);
-
-echo "OK!\n";
-
-@unlink($key_file_name);
-
-?>
---EXPECT--
-Creating private key
-Export key to file
-Load key from file - array syntax
-Load key using direct syntax
-Load key manually and use string syntax
-OK!
diff --git a/ext/openssl/tests/skipif.inc b/ext/openssl/tests/skipif.inc
deleted file mode 100644
index 21e947d0b2..0000000000
--- a/ext/openssl/tests/skipif.inc
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-// This script prints "skip" if condition does not meet.
-
-if (!extension_loaded("openssl") && ini_get("enable_dl")) {
- $dlext = (substr(PHP_OS, 0, 3) == "WIN") ? ".dll" : ".so";
- @dl("openssl$dlext");
-}
-if (!extension_loaded("openssl")) {
- die("skip\n");
-}
-?>
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
deleted file mode 100644
index 420a60a3d6..0000000000
--- a/ext/openssl/xp_ssl.c
+++ /dev/null
@@ -1,557 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "ext/standard/file.h"
-#include "streams/php_streams_int.h"
-#include "php_network.h"
-#include "php_openssl.h"
-#include <openssl/ssl.h>
-#include <openssl/err.h>
-
-
-/* This implementation is very closely tied to the that of the native
- * sockets implemented in the core.
- * Don't try this technique in other extensions!
- * */
-
-typedef struct _php_openssl_netstream_data_t {
- php_netstream_data_t s;
- SSL *ssl_handle;
- int enable_on_connect;
- int is_client;
- int ssl_active;
- php_stream_xport_crypt_method_t method;
-} php_openssl_netstream_data_t;
-
-php_stream_ops php_openssl_socket_ops;
-
-static int handle_ssl_error(php_stream *stream, int nr_bytes TSRMLS_DC)
-{
- php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract;
- int err = SSL_get_error(sslsock->ssl_handle, nr_bytes);
- char esbuf[512];
- char *ebuf = NULL, *wptr = NULL;
- size_t ebuf_size = 0;
- unsigned long code;
- int retry = 1;
-
- switch(err) {
- case SSL_ERROR_ZERO_RETURN:
- /* SSL terminated (but socket may still be active) */
- retry = 0;
- break;
- case SSL_ERROR_WANT_READ:
- case SSL_ERROR_WANT_WRITE:
- /* re-negotiation, or perhaps the SSL layer needs more
- * packets: retry in next iteration */
- break;
- case SSL_ERROR_SYSCALL:
- if (ERR_peek_error() == 0) {
- if (nr_bytes == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "SSL: fatal protocol error");
- stream->eof = 1;
- retry = 0;
- } else {
- char *estr = php_socket_strerror(php_socket_errno(), NULL, 0);
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "SSL: %s", estr);
-
- efree(estr);
- retry = 0;
- }
- break;
- }
- /* fall through */
- default:
- /* some other error */
- while ((code = ERR_get_error()) != 0) {
- /* allow room for a NUL and an optional \n */
- if (ebuf) {
- esbuf[0] = '\n';
- esbuf[1] = '\0';
- ERR_error_string_n(code, esbuf + 1, sizeof(esbuf) - 2);
- } else {
- esbuf[0] = '\0';
- ERR_error_string_n(code, esbuf, sizeof(esbuf) - 1);
- }
- code = strlen(esbuf);
- esbuf[code] = '\0';
-
- ebuf = erealloc(ebuf, ebuf_size + code + 1);
- if (wptr == NULL) {
- wptr = ebuf;
- }
-
- /* also copies the NUL */
- memcpy(wptr, esbuf, code + 1);
- wptr += code;
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "SSL operation failed with code %d.%s%s",
- err,
- ebuf ? "OpenSSL Error messages:\n" : "",
- ebuf ? ebuf : "");
-
- retry = 0;
- }
- return retry;
-}
-
-
-static size_t php_openssl_sockop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
-{
- php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract;
- int didwrite;
-
- if (sslsock->ssl_active) {
- int retry = 1;
-
- do {
- didwrite = SSL_write(sslsock->ssl_handle, buf, count);
-
- if (didwrite <= 0) {
- retry = handle_ssl_error(stream, didwrite TSRMLS_CC);
- } else {
- break;
- }
- } while(retry);
-
- } else {
- didwrite = php_stream_socket_ops.write(stream, buf, count TSRMLS_CC);
- }
-
- if (didwrite > 0) {
- php_stream_notify_progress_increment(stream->context, didwrite, 0);
- }
-
- if (didwrite < 0) {
- didwrite = 0;
- }
-
- return didwrite;
-}
-
-static size_t php_openssl_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-{
- php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract;
- int nr_bytes = 0;
-
- if (sslsock->ssl_active) {
- int retry = 1;
-
- do {
- nr_bytes = SSL_read(sslsock->ssl_handle, buf, count);
-
- if (nr_bytes <= 0) {
- retry = handle_ssl_error(stream, nr_bytes TSRMLS_CC);
- if (retry == 0 && !SSL_pending(sslsock->ssl_handle)) {
- stream->eof = 1;
- }
- } else {
- /* we got the data */
- break;
- }
- } while (retry);
- }
- else
- {
- nr_bytes = php_stream_socket_ops.read(stream, buf, count TSRMLS_CC);
- }
-
- if (nr_bytes > 0) {
- php_stream_notify_progress_increment(stream->context, nr_bytes, 0);
- }
-
- if (nr_bytes < 0) {
- nr_bytes = 0;
- }
-
- return nr_bytes;
-}
-
-
-static int php_openssl_sockop_close(php_stream *stream, int close_handle TSRMLS_DC)
-{
- php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract;
- fd_set wrfds, efds;
- int n;
- struct timeval timeout;
-
- if (close_handle) {
- if (sslsock->ssl_active) {
- SSL_shutdown(sslsock->ssl_handle);
- sslsock->ssl_active = 0;
- }
- if (sslsock->ssl_handle) {
- SSL_free(sslsock->ssl_handle);
- sslsock->ssl_handle = NULL;
- }
- if (sslsock->s.socket != -1) {
- /* prevent more data from coming in */
- shutdown(sslsock->s.socket, SHUT_RD);
-
- /* try to make sure that the OS sends all data before we close the connection.
- * Essentially, we are waiting for the socket to become writeable, which means
- * that all pending data has been sent.
- * We use a small timeout which should encourage the OS to send the data,
- * but at the same time avoid hanging indefintely.
- * */
- do {
- FD_ZERO(&wrfds);
- FD_SET(sslsock->s.socket, &wrfds);
- efds = wrfds;
-
- timeout.tv_sec = 0;
- timeout.tv_usec = 5000; /* arbitrary */
-
- n = select(sslsock->s.socket + 1, NULL, &wrfds, &efds, &timeout);
- } while (n == -1 && php_socket_errno() == EINTR);
-
- closesocket(sslsock->s.socket);
- sslsock->s.socket = -1;
- }
- }
-
- pefree(sslsock, php_stream_is_persistent(stream));
-
- return 0;
-}
-
-static int php_openssl_sockop_flush(php_stream *stream TSRMLS_DC)
-{
- return php_stream_socket_ops.flush(stream TSRMLS_CC);
-}
-
-static int php_openssl_sockop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC)
-{
- return php_stream_socket_ops.stat(stream, ssb TSRMLS_CC);
-}
-
-static inline int php_openssl_setup_crypto(php_stream *stream,
- php_openssl_netstream_data_t *sslsock,
- php_stream_xport_crypto_param *cparam
- TSRMLS_DC)
-{
- SSL_CTX *ctx;
- SSL_METHOD *method;
-
- if (sslsock->ssl_handle) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL/TLS already set-up for this stream");
- return -1;
- }
-
- /* need to do slightly different things, based on client/server method,
- * so lets remember which method was selected */
-
- switch (cparam->inputs.method) {
- case STREAM_CRYPTO_METHOD_SSLv23_CLIENT:
- sslsock->is_client = 1;
- method = SSLv23_client_method();
- break;
- case STREAM_CRYPTO_METHOD_SSLv2_CLIENT:
- sslsock->is_client = 1;
- method = SSLv2_client_method();
- break;
- case STREAM_CRYPTO_METHOD_SSLv3_CLIENT:
- sslsock->is_client = 1;
- method = SSLv3_client_method();
- break;
- case STREAM_CRYPTO_METHOD_TLS_CLIENT:
- sslsock->is_client = 1;
- method = TLSv1_client_method();
- break;
- case STREAM_CRYPTO_METHOD_SSLv23_SERVER:
- sslsock->is_client = 0;
- method = SSLv23_server_method();
- break;
- case STREAM_CRYPTO_METHOD_SSLv3_SERVER:
- sslsock->is_client = 0;
- method = SSLv3_server_method();
- break;
- case STREAM_CRYPTO_METHOD_SSLv2_SERVER:
- sslsock->is_client = 0;
- method = SSLv2_server_method();
- break;
- case STREAM_CRYPTO_METHOD_TLS_SERVER:
- sslsock->is_client = 0;
- method = TLSv1_server_method();
- break;
- default:
- return -1;
-
- }
-
- ctx = SSL_CTX_new(method);
- if (ctx == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to create an SSL context");
- return -1;
- }
-
- sslsock->ssl_handle = SSL_new(ctx);
- if (sslsock->ssl_handle == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to create an SSL handle");
- SSL_CTX_free(ctx);
- return -1;
- }
-
- if (!SSL_set_fd(sslsock->ssl_handle, sslsock->s.socket)) {
- handle_ssl_error(stream, 0 TSRMLS_CC);
- }
-
- if (cparam->inputs.session) {
- if (cparam->inputs.session->ops != &php_openssl_socket_ops) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "supplied session stream must be an SSL enabled stream");
- } else {
- SSL_copy_session_id(sslsock->ssl_handle, ((php_openssl_netstream_data_t*)cparam->inputs.session->abstract)->ssl_handle);
- }
- }
- return 0;
-}
-
-static inline int php_openssl_enable_crypto(php_stream *stream,
- php_openssl_netstream_data_t *sslsock,
- php_stream_xport_crypto_param *cparam
- TSRMLS_DC)
-{
- int n, retry = 1;
-
- if (cparam->inputs.activate) {
- if (sslsock->is_client) {
- do {
- n = SSL_connect(sslsock->ssl_handle);
-
- if (n <= 0) {
- retry = handle_ssl_error(stream, n TSRMLS_CC);
- } else {
- break;
- }
- } while (retry);
-
- if (n == 1) {
- sslsock->ssl_active = 1;
- }
-
- return n;
-
- } else {
-
- }
- } else {
- /* deactivate - common for server/client */
- }
- return -1;
-}
-
-static inline int php_openssl_tcp_sockop_accept(php_stream *stream, php_openssl_netstream_data_t *sock,
- php_stream_xport_param *xparam STREAMS_DC TSRMLS_DC)
-{
- int clisock;
-
- xparam->outputs.client = NULL;
-
- clisock = php_network_accept_incoming(sock->s.socket,
- xparam->want_textaddr ? &xparam->outputs.textaddr : NULL,
- xparam->want_textaddr ? &xparam->outputs.textaddrlen : NULL,
- xparam->want_addr ? &xparam->outputs.addr : NULL,
- xparam->want_addr ? &xparam->outputs.addrlen : NULL,
- xparam->inputs.timeout,
- xparam->want_errortext ? &xparam->outputs.error_text : NULL,
- &xparam->outputs.error_code
- TSRMLS_CC);
-
- if (clisock >= 0) {
- php_openssl_netstream_data_t *clisockdata;
-
- clisockdata = pemalloc(sizeof(*clisockdata), stream->is_persistent);
-
- if (clisockdata == NULL) {
- close(clisock);
- /* technically a fatal error */
- } else {
- /* copy underlying tcp fields */
- memset(clisockdata, 0, sizeof(*clisockdata));
- memcpy(clisockdata, sock, sizeof(clisockdata->s));
-
- clisockdata->s.socket = clisock;
-
- xparam->outputs.client = php_stream_alloc_rel(stream->ops, clisockdata, NULL, "r+");
- if (xparam->outputs.client) {
- xparam->outputs.client->context = stream->context;
- }
- }
- }
-
- return xparam->outputs.client == NULL ? -1 : 0;
-}
-static int php_openssl_sockop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC)
-{
- php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract;
- php_stream_xport_crypto_param *cparam = (php_stream_xport_crypto_param *)ptrparam;
- php_stream_xport_param *xparam = (php_stream_xport_param *)ptrparam;
-
- switch (option) {
- case PHP_STREAM_OPTION_CRYPTO_API:
-
- switch(cparam->op) {
-
- case STREAM_XPORT_CRYPTO_OP_SETUP:
- cparam->outputs.returncode = php_openssl_setup_crypto(stream, sslsock, cparam TSRMLS_CC);
- return PHP_STREAM_OPTION_RETURN_OK;
- break;
- case STREAM_XPORT_CRYPTO_OP_ENABLE:
- cparam->outputs.returncode = php_openssl_enable_crypto(stream, sslsock, cparam TSRMLS_CC);
- return PHP_STREAM_OPTION_RETURN_OK;
- break;
- default:
- /* fall through */
- break;
- }
-
- break;
-
- case PHP_STREAM_OPTION_XPORT_API:
- switch(xparam->op) {
-
- case STREAM_XPORT_OP_CONNECT:
- case STREAM_XPORT_OP_CONNECT_ASYNC:
- /* TODO: Async connects need to check the enable_on_connect option when
- * we notice that the connect has actually been established */
- php_stream_socket_ops.set_option(stream, option, value, ptrparam TSRMLS_CC);
-
- if (xparam->outputs.returncode == 0 && sslsock->enable_on_connect) {
- if (php_stream_xport_crypto_setup(stream, sslsock->method, NULL TSRMLS_CC) < 0 ||
- php_stream_xport_crypto_enable(stream, 1 TSRMLS_CC) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to enable crypto");
- xparam->outputs.returncode = -1;
- }
- }
- return PHP_STREAM_OPTION_RETURN_OK;
- break;
-
- case STREAM_XPORT_OP_ACCEPT:
- /* we need to copy the additional fields that the underlying tcp transport
- * doesn't know about */
- xparam->outputs.returncode = php_openssl_tcp_sockop_accept(stream, sslsock, xparam STREAMS_CC TSRMLS_CC);
- return PHP_STREAM_OPTION_RETURN_OK;
- break;
-
- default:
- /* fall through */
- break;
- }
- }
-
- return php_stream_socket_ops.set_option(stream, option, value, ptrparam TSRMLS_CC);
-}
-
-static int php_openssl_sockop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
-{
- php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract;
-
- switch(castas) {
- case PHP_STREAM_AS_STDIO:
- if (sslsock->ssl_active) {
- return FAILURE;
- }
- if (ret) {
- *ret = fdopen(sslsock->s.socket, stream->mode);
- if (*ret) {
- return SUCCESS;
- }
- return FAILURE;
- }
- return SUCCESS;
- case PHP_STREAM_AS_FD:
- case PHP_STREAM_AS_SOCKETD:
- if (sslsock->ssl_active) {
- return FAILURE;
- }
- if (ret) {
- *ret = (void*)sslsock->s.socket;
- }
- return SUCCESS;
- default:
- return FAILURE;
- }
-}
-
-php_stream_ops php_openssl_socket_ops = {
- php_openssl_sockop_write, php_openssl_sockop_read,
- php_openssl_sockop_close, php_openssl_sockop_flush,
- "tcp_socket/ssl",
- NULL, /* seek */
- php_openssl_sockop_cast,
- php_openssl_sockop_stat,
- php_openssl_sockop_set_option,
-};
-
-
-PHPAPI php_stream *php_openssl_ssl_socket_factory(const char *proto, long protolen,
- char *resourcename, long resourcenamelen,
- const char *persistent_id, int options, int flags,
- struct timeval *timeout,
- php_stream_context *context STREAMS_DC TSRMLS_DC)
-{
- php_stream *stream = NULL;
- php_openssl_netstream_data_t *sslsock = NULL;
-
- sslsock = pemalloc(sizeof(php_openssl_netstream_data_t), persistent_id ? 1 : 0);
- memset(sslsock, 0, sizeof(*sslsock));
-
- sslsock->s.is_blocked = 1;
- sslsock->s.timeout.tv_sec = FG(default_socket_timeout);
- sslsock->s.timeout.tv_usec = 0;
-
- /* we don't know the socket until we have determined if we are binding or
- * connecting */
- sslsock->s.socket = -1;
-
- stream = php_stream_alloc_rel(&php_openssl_socket_ops, sslsock, persistent_id, "r+");
-
- if (stream == NULL) {
- pefree(sslsock, persistent_id ? 1 : 0);
- return NULL;
- }
-
- if (strncmp(proto, "ssl", protolen) == 0) {
- sslsock->enable_on_connect = 1;
- sslsock->method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT;
- } else if (strncmp(proto, "tls", protolen) == 0) {
- sslsock->enable_on_connect = 1;
- sslsock->method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
- }
-
- return stream;
-}
-
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/oracle/CREDITS b/ext/oracle/CREDITS
deleted file mode 100644
index f06045fdcb..0000000000
--- a/ext/oracle/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Oracle
-Stig Bakken, Mitch Golden, Rasmus Lerdorf, Andreas Karajannis, Thies C. Arntzen
diff --git a/ext/oracle/config.m4 b/ext/oracle/config.m4
deleted file mode 100644
index d3283e18d3..0000000000
--- a/ext/oracle/config.m4
+++ /dev/null
@@ -1,160 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_DEFUN(AC_ORACLE_VERSION,[
- AC_MSG_CHECKING([Oracle version])
- if test -s "$ORACLE_DIR/orainst/unix.rgs"; then
- ORACLE_VERSION=`grep '"ocommon"' $ORACLE_DIR/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
- test -z "$ORACLE_VERSION" && ORACLE_VERSION=7.3
- elif test -f $ORACLE_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
- ORACLE_VERSION=9.0
- elif test -f $ORACLE_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then
- ORACLE_VERSION=8.1
- elif test -f $ORACLE_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.1.0; then
- ORACLE_VERSION=8.0
- elif test -f $ORACLE_DIR/lib/libclntsh.a; then
- if test -f $ORACLE_DIR/lib/libcore4.a; then
- ORACLE_VERSION=8.0
- else
- ORACLE_VERSION=8.1
- fi
- else
- AC_MSG_ERROR(Oracle needed libraries not found)
- fi
- AC_MSG_RESULT($ORACLE_VERSION)
-])
-
-PHP_ARG_WITH(oracle, for Oracle-ORACLE support,
-[ --with-oracle[=DIR] Include Oracle-oci7 support. Default DIR is
- ORACLE_HOME.])
-
-if test "$PHP_ORACLE" != "no"; then
- AC_MSG_CHECKING([Oracle Install-Dir])
- if test "$PHP_ORACLE" = "yes"; then
- ORACLE_DIR=$ORACLE_HOME
- else
- ORACLE_DIR=$PHP_ORACLE
- fi
- AC_MSG_RESULT($ORACLE_DIR)
-
- if test -d "$ORACLE_DIR/rdbms/public"; then
- PHP_ADD_INCLUDE($ORACLE_DIR/rdbms/public)
- fi
- if test -d "$ORACLE_DIR/rdbms/demo"; then
- PHP_ADD_INCLUDE($ORACLE_DIR/rdbms/demo)
- fi
- if test -d "$ORACLE_DIR/network/public"; then
- PHP_ADD_INCLUDE($ORACLE_DIR/network/public)
- fi
- if test -d "$ORACLE_DIR/plsql/public"; then
- PHP_ADD_INCLUDE($ORACLE_DIR/plsql/public)
- fi
-
- if test -f "$ORACLE_DIR/lib/sysliblist"; then
- PHP_EVAL_LIBLINE(`cat $ORACLE_DIR/lib/sysliblist`, ORACLE_SHARED_LIBADD)
- elif test -f "$ORACLE_DIR/rdbms/lib/sysliblist"; then
- PHP_EVAL_LIBLINE(`cat $ORACLE_DIR/rdbms/lib/sysliblist`, ORACLE_SHARED_LIBADD)
- fi
-
- AC_ORACLE_VERSION($ORACLE_DIR)
- case $ORACLE_VERSION in
- 7.0|7.1)
- if test -f $ORACLE_DIR/lib/liboracle.$SHLIB_SUFFIX_NAME; then
- PHP_ADD_LIBRARY_WITH_PATH(oracle, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- else
- PHP_ADD_LIBRARY_WITH_PATH(core, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(cv6, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(core, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(cv6, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ora, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- if test "$ext_shared" = "yes"; then
- ORACLE_SHARED_LIBADD="$ORACLE_DIR/lib/osntab.o $ORACLE_SHARED_LIBADD";
- else
- LIBS="$ORACLE_DIR/lib/osntab.o $LIBS";
- fi
- PHP_ADD_LIBRARY_WITH_PATH(ocic, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- if test "`uname -s 2>/dev/null`" = "AIX"; then
- if test "$ext_shared" = "yes"; then
- ORACLE_SHARED_LIBADD="$ORACLE_SHARED_LIBADD -bI:$ORACLE_DIR/lib/mili.exp"
- else
- LIBS="$LIBS -bI:$ORACLE_DIR/lib/mili.exp"
- fi
- fi
- fi
- ;;
-
- 7.2)
- if test -f $ORACLE_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME; then
- PHP_ADD_LIBRARY_WITH_PATH(clntsh, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- else
- PHP_ADD_LIBRARY_WITH_PATH(core3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(c3v6, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ora, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ora, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- if test "$ext_shared" = "yes"; then
- ORACLE_SHARED_LIBADD="$ORACLE_DIR/lib/osntab.o $ORACLE_SHARED_LIBADD";
- else
- LIBS="$ORACLE_DIR/lib/osntab.o $LIBS";
- fi
- PHP_ADD_LIBRARY_WITH_PATH(ocic, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- fi
- ;;
-
- 7.3)
- if test -f $ORACLE_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME; then
- PHP_ADD_LIBRARY_WITH_PATH(clntsh, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- else
- PHP_ADD_LIBRARY_WITH_PATH(core3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(core3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(c3v6, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(epc, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(generic, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(common, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(client, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ncr, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(generic, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(common, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(client, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ncr, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(client, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- fi
- ;;
-
- 8.0)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, "", ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(core4, "", ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(psa, "", ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(clntsh, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- ;;
-
- 8.1|9.0)
- PHP_ADD_LIBRARY(clntsh, 1, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBPATH($ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- ;;
- *)
- AC_MSG_ERROR(Unsupported Oracle version!)
- ;;
- esac
-
- PHP_NEW_EXTENSION(oracle, oracle.c, $ext_shared)
- AC_DEFINE(HAVE_ORACLE,1,[ ])
-
- PHP_SUBST_OLD(ORACLE_SHARED_LIBADD)
- PHP_SUBST_OLD(ORACLE_DIR)
- PHP_SUBST_OLD(ORACLE_VERSION)
-fi
diff --git a/ext/oracle/oracle.c b/ext/oracle/oracle.c
deleted file mode 100644
index 0f1881a933..0000000000
--- a/ext/oracle/oracle.c
+++ /dev/null
@@ -1,1769 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@php.net> |
- | Mitch Golden <mgolden@interport.net> |
- | Rasmus Lerdorf <rasmus@php.net> |
- | Andreas Karajannis <Andreas.Karajannis@gmd.de> |
- | Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* comment out the next line if you're on Oracle 7.x and don't have the olog
- call. */
-
-#define HAS_OLOG 1
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#include "zend_globals.h"
-
-#if HAVE_ORACLE
-
-#include "php_oracle.h"
-#define HASH_DTOR (void (*)(void *))
-
-#include "ext/standard/info.h"
-
-
-#ifndef min
-#define min(a, b) ((a) > (b) ? (b) : (a))
-#endif
-
-#ifdef PHP_WIN32
-#define PHP_ORA_API __declspec(dllexport)
-#else
-#define PHP_ORA_API
-#endif
-
-#ifdef ZTS
-int ora_globals_id;
-#else
-PHP_ORA_API php_ora_globals ora_globals;
-#endif
-
-#define DB_SIZE 65536
-
-#define ORA_FETCHINTO_ASSOC (1<<0)
-#define ORA_FETCHINTO_NULLS (1<<1)
-
-static oraCursor *ora_get_cursor(HashTable *, pval ** TSRMLS_DC);
-static char *ora_error(Cda_Def *);
-static int ora_describe_define(oraCursor *);
-static void _close_oraconn(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-static int _close_oracur(oraCursor *cur TSRMLS_DC);
-static int _ora_ping(oraConnection *conn);
-int ora_set_param_values(oraCursor *cursor, int isout TSRMLS_DC);
-
-void ora_do_logon(INTERNAL_FUNCTION_PARAMETERS, int persistent);
-
-static int le_conn, le_pconn, le_cursor;
-
-/* {{{ prototypes
- */
-PHP_FUNCTION(ora_bind);
-PHP_FUNCTION(ora_close);
-PHP_FUNCTION(ora_commit);
-PHP_FUNCTION(ora_commitoff);
-PHP_FUNCTION(ora_commiton);
-PHP_FUNCTION(ora_do);
-PHP_FUNCTION(ora_error);
-PHP_FUNCTION(ora_errorcode);
-PHP_FUNCTION(ora_exec);
-PHP_FUNCTION(ora_fetch);
-PHP_FUNCTION(ora_fetch_into);
-PHP_FUNCTION(ora_columntype);
-PHP_FUNCTION(ora_columnname);
-PHP_FUNCTION(ora_columnsize);
-PHP_FUNCTION(ora_getcolumn);
-PHP_FUNCTION(ora_numcols);
-PHP_FUNCTION(ora_numrows);
-PHP_FUNCTION(ora_logoff);
-PHP_FUNCTION(ora_logon);
-PHP_FUNCTION(ora_plogon);
-PHP_FUNCTION(ora_open);
-PHP_FUNCTION(ora_parse);
-PHP_FUNCTION(ora_rollback);
-
-PHP_MINIT_FUNCTION(oracle);
-PHP_RINIT_FUNCTION(oracle);
-PHP_MSHUTDOWN_FUNCTION(oracle);
-PHP_RSHUTDOWN_FUNCTION(oracle);
-PHP_MINFO_FUNCTION(oracle);
-/* }}} */
-
-static unsigned char second_args_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
-
-/* {{{ oracle_functions[]
- */
-function_entry oracle_functions[] = {
- PHP_FE(ora_bind, NULL)
- PHP_FE(ora_close, NULL)
- PHP_FE(ora_commit, NULL)
- PHP_FE(ora_commitoff, NULL)
- PHP_FE(ora_commiton, NULL)
- PHP_FE(ora_do, NULL)
- PHP_FE(ora_error, NULL)
- PHP_FE(ora_errorcode, NULL)
- PHP_FE(ora_exec, NULL)
- PHP_FE(ora_fetch, NULL)
- PHP_FE(ora_fetch_into, second_args_force_ref)
- PHP_FE(ora_columntype, NULL)
- PHP_FE(ora_columnname, NULL)
- PHP_FE(ora_columnsize, NULL)
- PHP_FE(ora_getcolumn, NULL)
- PHP_FE(ora_numcols, NULL)
- PHP_FE(ora_numrows, NULL)
- PHP_FE(ora_logoff, NULL)
- PHP_FE(ora_logon, NULL)
- PHP_FE(ora_plogon, NULL)
- PHP_FE(ora_open, NULL)
- PHP_FE(ora_parse, NULL)
- PHP_FE(ora_rollback, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ oracle_module_entry
- */
-zend_module_entry oracle_module_entry = {
- STANDARD_MODULE_HEADER,
- "oracle",
- oracle_functions,
- PHP_MINIT(oracle), /* extension-wide startup function */
- PHP_MSHUTDOWN(oracle), /* extension-wide shutdown function */
- PHP_RINIT(oracle), /* per-request startup function */
- PHP_RSHUTDOWN(oracle), /* per-request shutdown function */
- PHP_MINFO(oracle),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-/* {{{ ora_func_tab[]
- */
-static const text *ora_func_tab[] =
-{(text *) "unused",
-/* 1, 2 */ (text *) "unused", (text *) "OSQL",
-/* 3, 4 */ (text *) "unused", (text *) "OEXEC/OEXN",
-/* 5, 6 */ (text *) "unused", (text *) "OBIND",
-/* 7, 8 */ (text *) "unused", (text *) "ODEFIN",
-/* 9, 10 */ (text *) "unused", (text *) "ODSRBN",
-/* 11, 12 */ (text *) "unused", (text *) "OFETCH/OFEN",
-/* 13, 14 */ (text *) "unused", (text *) "OOPEN",
-/* 15, 16 */ (text *) "unused", (text *) "OCLOSE",
-/* 17, 18 */ (text *) "unused", (text *) "unused",
-/* 19, 20 */ (text *) "unused", (text *) "unused",
-/* 21, 22 */ (text *) "unused", (text *) "ODSC",
-/* 23, 24 */ (text *) "unused", (text *) "ONAME",
-/* 25, 26 */ (text *) "unused", (text *) "OSQL3",
-/* 27, 28 */ (text *) "unused", (text *) "OBNDRV",
-/* 29, 30 */ (text *) "unused", (text *) "OBNDRN",
-/* 31, 32 */ (text *) "unused", (text *) "unused",
-/* 33, 34 */ (text *) "unused", (text *) "OOPT",
-/* 35, 36 */ (text *) "unused", (text *) "unused",
-/* 37, 38 */ (text *) "unused", (text *) "unused",
-/* 39, 40 */ (text *) "unused", (text *) "unused",
-/* 41, 42 */ (text *) "unused", (text *) "unused",
-/* 43, 44 */ (text *) "unused", (text *) "unused",
-/* 45, 46 */ (text *) "unused", (text *) "unused",
-/* 47, 48 */ (text *) "unused", (text *) "unused",
-/* 49, 50 */ (text *) "unused", (text *) "unused",
-/* 51, 52 */ (text *) "unused", (text *) "OCAN",
-/* 53, 54 */ (text *) "unused", (text *) "OPARSE",
-/* 55, 56 */ (text *) "unused", (text *) "OEXFET",
-/* 57, 58 */ (text *) "unused", (text *) "OFLNG",
-/* 59, 60 */ (text *) "unused", (text *) "ODESCR",
-/* 61, 62 */ (text *) "unused", (text *) "OBNDRA"
-};
-/* }}} */
-
-#ifdef COMPILE_DL_ORACLE
-ZEND_GET_MODULE(oracle)
-#endif
-
-/* {{{ _close_oraconn
- */
-static void _close_oraconn(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- oraConnection *conn = (oraConnection *)rsrc->ptr;
-
- conn->open = 0;
-
- ologof(&conn->lda);
- ORA(num_links)--;
-
- zend_hash_del(ORA(conns),(void*)&conn,sizeof(void*));
-
- if (conn->persistent) {
- ORA(num_persistent)--;
- free(conn);
- } else {
- efree(conn);
- }
-}
-/* }}} */
-
-/* {{{ pval_ora_param_destructor
- */
-static void
-pval_ora_param_destructor(oraParam *param)
-{
- if (param->progv) {
- efree(param->progv);
- }
-}
-/* }}} */
-
-/* {{{ _close_oracur
- */
-static int _close_oracur(oraCursor *cur TSRMLS_DC)
-{
- int i;
-
- if (cur){
- if (cur->query){
- efree(cur->query);
- }
- if (cur->params){
- zend_hash_destroy(cur->params);
- efree(cur->params);
- cur->params = NULL;
- }
- if (cur->columns){
- for(i = 0; i < cur->ncols; i++){
- if (cur->columns[i].buf)
- efree(cur->columns[i].buf);
- }
- efree(cur->columns);
- cur->columns = NULL;
- }
-
- if (cur->open){
- oraConnection *db_conn;
-
- if (zend_hash_find(ORA(conns),(void*)&(cur->conn_ptr),sizeof(void*),(void **)&db_conn) == SUCCESS) {
- oclose(&cur->cda);
- }
- }
-
- efree(cur);
- }
-
- return 1;
-}
-/* }}} */
-
-/* {{{ php_close_ora_cursor
- */
-static void php_close_ora_cursor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- oraCursor *cur = (oraCursor *)rsrc->ptr;
-
- _close_oracur(cur TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ php_ora_init_globals
- */
-static void php_ora_init_globals(php_ora_globals *ora_globals_p TSRMLS_DC)
-{
- if (cfg_get_long("oracle.allow_persistent",
- &ORA(allow_persistent))
- == FAILURE) {
- ORA(allow_persistent) = -1;
- }
- if (cfg_get_long("oracle.max_persistent",
- &ORA(max_persistent))
- == FAILURE) {
- ORA(max_persistent) = -1;
- }
- if (cfg_get_long("oracle.max_links",
- &ORA(max_links))
- == FAILURE) {
- ORA(max_links) = -1;
- }
-
- ORA(num_persistent) = 0;
-
- ORA(conns) = malloc(sizeof(HashTable));
- zend_hash_init(ORA(conns), 13, NULL, NULL, 1);
-
- memset((void*) &ORA(db_err_conn),0,sizeof(ORA(db_err_conn)));
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(oracle)
-{
-#ifdef ZTS
- ts_allocate_id(&ora_globals_id, sizeof(php_ora_globals), (ts_allocate_ctor) php_ora_init_globals, NULL);
-#else
- php_ora_init_globals(&ora_globals TSRMLS_CC);
-#endif
-
- le_cursor = zend_register_list_destructors_ex(php_close_ora_cursor, NULL, "oracle cursor", module_number);
- le_conn = zend_register_list_destructors_ex(_close_oraconn, NULL, "oracle link", module_number);
- le_pconn = zend_register_list_destructors_ex(NULL, _close_oraconn, "oracle link persistent", module_number);
-
- REGISTER_LONG_CONSTANT("ORA_BIND_INOUT", 0, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ORA_BIND_IN", 1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ORA_BIND_OUT", 2, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("ORA_FETCHINTO_ASSOC",ORA_FETCHINTO_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ORA_FETCHINTO_NULLS",ORA_FETCHINTO_NULLS, CONST_CS | CONST_PERSISTENT);
-
-#ifdef ZTS
- opinit(OCI_EV_TSF);
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(oracle)
-{
- ORA(num_links) =
- ORA(num_persistent);
- /*
- ORA(defaultlrl) = 0;
- ORA(defaultbinmode) = 0;
- ORA(defaultconn) = 0;
- */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(oracle)
-{
- zend_hash_destroy(ORA(conns));
- free(ORA(conns));
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(oracle)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ _ora_ping
- */
-static int _ora_ping(oraConnection *conn)
-{
- Cda_Def cda;
-
- if (oopen(&cda, &conn->lda, (text *) 0, -1, -1, (text *) 0, -1)) {
- return 0;
- }
-
- if (oparse(&cda, "select sysdate from dual", (sb4) - 1, 0, VERSION_7)) {
- oclose(&cda);
- return 0;
- }
-
- oclose(&cda);
- return 1;
-
-}
-/* }}} */
-
-/*
- ** PHP functions
-*/
-
-/* {{{ proto int ora_logon(string user, string password)
- Open an Oracle connection */
-PHP_FUNCTION(ora_logon)
-{
- ora_do_logon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int ora_plogon(string user, string password)
- Open a persistent Oracle connection */
-PHP_FUNCTION(ora_plogon)
-{
- ora_do_logon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ ora_do_logon
- */
-void ora_do_logon(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- char *user,*passwd;
- pval **arg1, **arg2;
- char *hashed_details;
- int hashed_details_length;
- oraConnection *db_conn;
-
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
-
- user = Z_STRVAL_PP(arg1);
- passwd = Z_STRVAL_PP(arg2);
-
- hashed_details_length = sizeof("oracle__")-1+strlen(user)+strlen(passwd);
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"oracle_%s_%s",user,passwd);
-
- if (!ORA(allow_persistent)) {
- persistent=0;
- }
- if (persistent) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
-
- if (ORA(max_links)!=-1 && ORA(num_links)>=ORA(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Oracle: Too many open links (%d)",ORA(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (ORA(max_persistent)!=-1 && ORA(num_persistent)>=ORA(max_persistent)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Oracle: Too many open persistent links (%d)",ORA(num_persistent));
- efree(hashed_details);
- RETURN_FALSE;
- }
- /* create the link */
- db_conn = (oraConnection *)malloc(sizeof(oraConnection));
- memset((void *) db_conn,0,sizeof(oraConnection));
- db_conn->persistent = 1;
-
- if (
-#if HAS_OLOG
- olog(&db_conn->lda, db_conn->hda, user,strlen(user), passwd, strlen(passwd), 0, -1, OCI_LM_DEF)
-#else
- orlon(&db_conn->lda, db_conn->hda, user,strlen(user), passwd, strlen(passwd), 0)
-#endif
- ) {
- ORA(db_err_conn) = *db_conn;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect to ORACLE (%s)",ora_error(&db_conn->lda));
-
- if (persistent) {
- free(db_conn);
- } else {
- efree(db_conn);
- }
-
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* hash it up */
- Z_TYPE(new_le) = le_pconn;
- new_le.ptr = db_conn;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
- free(db_conn);
- efree(hashed_details);
- RETURN_FALSE;
- }
- ORA(num_persistent)++;
- ORA(num_links)++;
- zend_hash_add(ORA(conns),(void*)&db_conn,sizeof(void*),(void*)&db_conn,sizeof(void*),NULL);
- } else { /* we do */
- if (Z_TYPE_P(le) != le_pconn) {
- RETURN_FALSE;
- }
-
- db_conn = (oraConnection *) le->ptr;
-
- /* ensure that the link did not die */
-
- if (!_ora_ping(db_conn)) {
- if (
-#if HAS_OLOG
- olog(&db_conn->lda, db_conn->hda, user,strlen(user), passwd, strlen(passwd), 0, -1, OCI_LM_DEF)
-#else
- orlon(&db_conn->lda, db_conn->hda, user,strlen(user), passwd, strlen(passwd), 0)
-#endif
- ) {
- ORA(db_err_conn) = *db_conn;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Oracle: Link to server lost, unable to reconnect",ora_error(&db_conn->lda));
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1);
- efree(hashed_details);
- RETURN_FALSE;
- }
- }
- }
- ZEND_REGISTER_RESOURCE(return_value, db_conn, le_pconn);
- } else { /* non persistent */
- list_entry *index_ptr,new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual Oracle link sits.
- * if it doesn't, open a new Oracle link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list),hashed_details,hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
- int type,link;
- void *ptr;
-
- if (Z_TYPE_P(index_ptr) != le_index_ptr) {
- RETURN_FALSE;
- }
- link = (int) index_ptr->ptr;
- ptr = zend_list_find(link,&type); /* check if the link is still there */
- if (ptr && (type==le_conn || type==le_pconn)) {
- zend_list_addref(link);
- Z_LVAL_P(return_value) = link;
- Z_TYPE_P(return_value) = IS_RESOURCE;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list),hashed_details,hashed_details_length+1);
- }
- }
- if (ORA(max_links)!=-1 && ORA(num_links)>=ORA(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Oracle: Too many open links (%d)",ORA(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- db_conn = (oraConnection *) emalloc(sizeof(oraConnection));
- memset((void *) db_conn,0,sizeof(oraConnection));
- db_conn->persistent = 0;
-
- if (
-#if HAS_OLOG
- olog(&db_conn->lda, db_conn->hda, user,strlen(user), passwd, strlen(passwd), 0, -1, OCI_LM_DEF)
-#else
- orlon(&db_conn->lda, db_conn->hda, user,strlen(user), passwd, strlen(passwd), 0)
-#endif
- ) {
- ORA(db_err_conn) = *db_conn;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Oracle: Connection Failed: %s\n",ora_error(&db_conn->lda));
- efree(hashed_details);
- efree(db_conn);
- RETURN_FALSE;
- }
-
- /* add it to the list */
- ZEND_REGISTER_RESOURCE(return_value, db_conn, le_conn);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
- Z_TYPE(new_index_ptr) = le_index_ptr;
- if (zend_hash_update(&EG(regular_list),hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- zend_hash_add(ORA(conns),(void*)&db_conn,sizeof(void*),(void*)&db_conn,sizeof(void*),NULL);
- ORA(num_links)++;
- }
-
- efree(hashed_details);
-}
-/* }}} */
-
-/* {{{ proto int ora_logoff(int connection)
- Close an Oracle connection */
-PHP_FUNCTION(ora_logoff)
-{ /* conn_index */
- oraConnection *conn;
- pval **arg;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE2(conn, oraConnection *, arg, -1, "Oracle-Connection", le_conn, le_pconn);
-
- zend_list_delete(Z_LVAL_PP(arg));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_open(int connection)
- Open an Oracle cursor */
-PHP_FUNCTION(ora_open)
-{ /* conn_index */
- pval **arg;
- oraConnection *conn = NULL;
- oraCursor *cursor = NULL;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE2(conn, oraConnection *, arg, -1, "Oracle-Connection", le_conn, le_pconn);
-
- cursor = (oraCursor *)emalloc(sizeof(oraCursor));
- memset(cursor, 0, sizeof(oraCursor));
- if (oopen(&cursor->cda, &conn->lda, (text *) 0, -1, -1, (text *) 0, -1)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open new cursor (%s)",
- ora_error(&cursor->cda));
- efree(cursor);
- RETURN_FALSE;
- }
- cursor->open = 1;
- cursor->conn_ptr = conn;
- ZEND_REGISTER_RESOURCE(return_value, cursor, le_cursor);
- cursor->conn_id = Z_LVAL_P(return_value);
-}
-
-/* }}} */
-
-/* {{{ proto int ora_close(int cursor)
- Close an Oracle cursor */
-PHP_FUNCTION(ora_close)
-{ /* conn_index */
- pval **arg;
- oraCursor *cursor;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(cursor, oraCursor *, arg, -1, "Oracle-Cursor", le_cursor);
-
- zend_list_delete(Z_LVAL_PP(arg));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_commitoff(int connection)
- Disable automatic commit */
-PHP_FUNCTION(ora_commitoff)
-{ /* conn_index */
- pval **arg;
- oraConnection *conn;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE2(conn, oraConnection *, arg, -1, "Oracle-Connection", le_conn, le_pconn);
-
- if (ocof(&conn->lda)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to turn off auto-commit (%s)",
- ora_error(&conn->lda));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_commiton(int connection)
- Enable automatic commit */
-PHP_FUNCTION(ora_commiton)
-{ /* conn_index */
- pval **arg;
- oraConnection *conn;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE2(conn, oraConnection *, arg, -1, "Oracle-Connection", le_conn, le_pconn);
-
- if (ocon(&conn->lda)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to turn on auto-commit (%s)",
- ora_error(&conn->lda));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_commit(int connection)
- Commit an Oracle transaction */
-PHP_FUNCTION(ora_commit)
-{ /* conn_index */
- pval **arg;
- oraConnection *conn;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE2(conn, oraConnection *, arg, -1, "Oracle-Connection", le_conn, le_pconn);
-
- if (ocom(&conn->lda)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to commit transaction (%s)",
- ora_error(&conn->lda));
- RETURN_FALSE;
- }
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_rollback(int connection)
- Roll back an Oracle transaction */
-PHP_FUNCTION(ora_rollback)
-{ /* conn_index */
- pval **arg;
- oraConnection *conn;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE2(conn, oraConnection *, arg, -1, "Oracle-Connection", le_conn, le_pconn);
-
- if (orol(&conn->lda)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to roll back transaction (%s)",
- ora_error(&conn->lda));
- RETURN_FALSE;
- }
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_parse(int cursor, string sql_statement [, int defer])
- Parse an Oracle SQL statement */
-PHP_FUNCTION(ora_parse)
-{
- pval **curs, **sql, **def;
- oraCursor *cursor;
- sword defer = 0;
- text *query;
-
- switch (ZEND_NUM_ARGS()) {
- case 3:
- zend_get_parameters_ex(3,&curs,&sql,&def);
- convert_to_long_ex(def);
- if (Z_LVAL_PP(def)) {
- defer = DEFER_PARSE;
- }
- break;
- case 2:
- zend_get_parameters_ex(2,&curs,&sql);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(sql);
- query = (text *) estrndup(Z_STRVAL_PP(sql),Z_STRLEN_PP(sql));
-
- if (query == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid query");
- RETURN_FALSE;
- }
-
- if (!(cursor = ora_get_cursor(&EG(regular_list),curs TSRMLS_CC))){
- efree(query);
- RETURN_FALSE;
- }
-
- if (cursor->query) {
- efree(cursor->query);
- }
-
- cursor->query = query;
- cursor->fetched = 0;
-
- if (cursor->params && cursor->nparams > 0){
- zend_hash_destroy(cursor->params);
- efree(cursor->params);
- cursor->params = NULL;
- cursor->nparams = 0;
- }
-
- if (oparse(&cursor->cda, query, (sb4) - 1, defer, VERSION_7)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ora_Parse failed (%s)",ora_error(&cursor->cda));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_bind(int cursor, string php_variable_name, string sql_parameter_name, int length [, int type])
- Bind a PHP variable to an Oracle parameter */
-PHP_FUNCTION(ora_bind)
-{
- pval **curs, **pvar, **svar, **plen, **ptyp;
- int inout = 0;
- oraParam *newparam, *paramptr;
- oraCursor *cursor;
- char *paramname;
-
- switch (ZEND_NUM_ARGS()) {
- case 5:
- zend_get_parameters_ex(5,&curs,&pvar,&svar,&plen,&ptyp);
- convert_to_long_ex(ptyp);
- inout = Z_LVAL_PP(ptyp);
- break;
- case 4:
- zend_get_parameters_ex(4,&curs,&pvar,&svar,&plen);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- cursor = ora_get_cursor(&EG(regular_list), curs TSRMLS_CC);
- if (cursor == NULL) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(pvar);
- convert_to_string_ex(svar);
- convert_to_long_ex(plen);
-
- if (cursor->params == NULL) {
- ALLOC_HASHTABLE(cursor->params);
- if (!cursor->params ||
- zend_hash_init(cursor->params, 19, NULL,
- HASH_DTOR pval_ora_param_destructor, 0) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize parameter list");
- RETURN_FALSE;
- }
- }
- newparam = (oraParam *)emalloc(sizeof(oraParam));
-
- if ((paramname = estrndup(Z_STRVAL_PP(pvar), Z_STRLEN_PP(pvar))) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Out of memory for parametername");
- efree(newparam);
- RETURN_FALSE;
- }
-
- if (zend_hash_add(cursor->params, paramname, Z_STRLEN_PP(pvar) + 1,
- newparam, sizeof(oraParam), (void **)&paramptr) == FAILURE) {
- /* XXX zend_hash_destroy */
- efree(paramname);
- efree(newparam);
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not make parameter placeholder");
- RETURN_FALSE;
- }
-
- efree(newparam);
- efree(paramname);
-
- paramptr->progvl = Z_LVAL_PP(plen) + 1;
- paramptr->inout = inout;
-
- paramptr->progv = (text *)emalloc(paramptr->progvl);
-
-/* XXX Maximum for progvl */
- paramptr->alen = paramptr->progvl;
-
- if (obndra(&cursor->cda,
- Z_STRVAL_PP(svar),
- -1,
- (ub1 *)paramptr->progv,
- paramptr->progvl,
- SQLT_STR, /* ftype */
- -1, /* scale */
- 0/*&paramptr->ind*/, /* ind */
- &paramptr->alen, /* alen */
- 0 /*&paramptr->arcode*/,
- 0, /* maxsize */
- 0,
- 0,
- -1,
- -1)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ora_Bind failed (%s)",
- ora_error(&cursor->cda));
- RETURN_FALSE;
- }
-
- cursor->nparams++;
- RETURN_TRUE;
-}
-/* }}} */
-
-/*
- XXX Make return values compatible with old module ?
- */
-/* {{{ proto int ora_exec(int cursor)
- Execute a parsed statement */
-PHP_FUNCTION(ora_exec)
-{ /* cursor_index */
- pval **arg;
- oraCursor *cursor = NULL;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if ((cursor = ora_get_cursor(&EG(regular_list), arg TSRMLS_CC)) == NULL) {
- RETURN_FALSE;
- }
-
- if (cursor->cda.ft == FT_SELECT) {
- if (ora_describe_define(cursor) < 0) {
- /* error message is given by ora_describe_define() */
- RETURN_FALSE;
- }
- }
-
- if(cursor->nparams > 0){
- if(!ora_set_param_values(cursor, 0 TSRMLS_CC)){
- RETURN_FALSE;
- }
- }
-
- if (oexec(&cursor->cda)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ora_Exec failed (%s)",
- ora_error(&cursor->cda));
- RETURN_FALSE;
- }
-
- if(cursor->nparams > 0){
- if(!ora_set_param_values(cursor, 1 TSRMLS_CC)){
- RETURN_FALSE;
- }
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_numcols(int cursor)
- Returns the numbers of columns in a result */
-PHP_FUNCTION(ora_numcols)
-{ /* cursor_index */
- pval **arg;
- oraCursor *cursor = NULL;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if ((cursor = ora_get_cursor(&EG(regular_list), arg TSRMLS_CC)) == NULL) {
- RETURN_FALSE;
- }
-
- RETURN_LONG(cursor->ncols);
-}
-/* }}} */
-
-/* {{{ proto int ora_numrows(int cursor)
- Returns the number of rows in a result */
-PHP_FUNCTION(ora_numrows)
-{ /* cursor_index */
- pval **arg;
- oraCursor *cursor = NULL;
-
- if(zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if((cursor = ora_get_cursor(&EG(regular_list), arg TSRMLS_CC)) == NULL) {
- RETURN_FALSE;
- }
-
- RETURN_LONG(cursor->cda.rpc);
-}
-/* }}} */
-
-/* prepares/executes/fetches 1st row if avail*/
-/* {{{ proto int ora_do(int connection, int cursor)
- Parse and execute a statement and fetch first result row */
-PHP_FUNCTION(ora_do)
-{
- pval **con,**sql;
- oraConnection *conn = NULL;
- oraCursor *cursor = NULL;
- text *query;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &con,&sql) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE2(conn, oraConnection *, con, -1, "Oracle-Connection", le_conn, le_pconn);
-
- convert_to_string_ex(sql);
-
- cursor = (oraCursor *)emalloc(sizeof(oraCursor));
-
- memset(cursor, 0, sizeof(oraCursor));
-
- query = (text *) estrndup(Z_STRVAL_PP(sql),Z_STRLEN_PP(sql));
-
- if (query == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid query in Ora_Do");
- RETURN_FALSE;
- }
-
- cursor->query = query;
-
- if (oopen(&cursor->cda, &conn->lda, (text *) 0, -1, -1, (text *) 0, -1)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open new cursor (%s)",
- ora_error(&cursor->cda));
- efree(cursor);
- RETURN_FALSE;
- }
- cursor->open = 1;
- cursor->conn_ptr = conn;
- cursor->conn_id = Z_LVAL_PP(con);
-
- /* Prepare stmt */
-
- if (oparse(&cursor->cda, query, (sb4) - 1, 1, VERSION_7)){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ora_Do failed (%s)",
- ora_error(&cursor->cda));
- _close_oracur(cursor TSRMLS_CC);
- RETURN_FALSE;
- }
-
- /* Execute stmt (and fetch 1st row for selects) */
- if (cursor->cda.ft == FT_SELECT) {
- if (ora_describe_define(cursor) < 0){
- /* error message is given by ora_describe_define() */
- _close_oracur(cursor TSRMLS_CC);
- RETURN_FALSE;
- }
- if (oexfet(&cursor->cda, 1, 0, 0)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ora_Do failed (%s)",
- ora_error(&cursor->cda));
- _close_oracur(cursor TSRMLS_CC);
- RETURN_FALSE;
- }
- cursor->fetched = 1;
- } else {
- if (oexec(&cursor->cda)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ora_Do failed (%s)",
- ora_error(&cursor->cda));
- _close_oracur(cursor TSRMLS_CC);
- RETURN_FALSE;
- }
- }
-
- ZEND_REGISTER_RESOURCE(return_value, cursor, le_cursor);
-}
-/* }}} */
-
-/* {{{ proto int ora_fetch(int cursor)
- Fetch a row of result data from a cursor */
-PHP_FUNCTION(ora_fetch)
-{ /* cursor_index */
- pval **arg;
- oraCursor *cursor;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((cursor = ora_get_cursor(&EG(regular_list), arg TSRMLS_CC)) == NULL) {
- RETURN_FALSE;
- }
-
- if (cursor->ncols == 0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available on this cursor");
- RETURN_FALSE;
- }
-
- /* Get data from Oracle */
- if (ofetch(&cursor->cda)) {
- if (cursor->cda.rc != NO_DATA_FOUND) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ora_Fetch failed (%s)",
- ora_error(&cursor->cda));
- }
- RETURN_FALSE;
- }
- cursor->fetched++;
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_fetch_into(int cursor, array result [, int flags])
- Fetch a row into the specified result array */
-PHP_FUNCTION(ora_fetch_into)
-{
- pval **curs, **arr, **flg, *tmp;
- oraCursor *cursor;
- int i;
- int flags = 0;
-
- switch(ZEND_NUM_ARGS()){
- case 2:
- zend_get_parameters_ex(2, &curs, &arr);
- break;
-
- case 3:
- zend_get_parameters_ex(3, &curs, &arr, &flg);
- convert_to_long_ex(flg);
- flags = Z_LVAL_PP(flg);
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- /* Find the cursor */
- if ((cursor = ora_get_cursor(&EG(regular_list), curs TSRMLS_CC)) == NULL) {
- RETURN_FALSE;
- }
-
- if (cursor->ncols == 0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available on this cursor");
- RETURN_FALSE;
- }
-
- if (ofetch(&cursor->cda)) {
- if (cursor->cda.rc != NO_DATA_FOUND) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ora_Fetch_Into failed (%s)",ora_error(&cursor->cda));
- }
- RETURN_FALSE;
- }
- cursor->fetched++;
-
- if (Z_TYPE_PP(arr) != IS_ARRAY){
- pval_destructor(*arr);
- array_init(*arr);
- }
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(arr));
-
- for (i = 0; i < cursor->ncols; i++) {
- if (cursor->columns[i].col_retcode == 1405) {
- if (!(flags&ORA_FETCHINTO_NULLS)){
- continue; /* don't add anything for NULL columns, unless the calles wants it */
- } else {
- MAKE_STD_ZVAL(tmp);
- ZVAL_NULL(tmp);
- }
- } else if (cursor->columns[i].col_retcode != 0 &&
- cursor->columns[i].col_retcode != 1406) {
- /* So error fetching column. The most common is 1405, a NULL */
- /* was retreived. 1406 is ASCII or string buffer data was */
- /* truncated. The converted data from the database did not fit */
- /* into the buffer. Since we allocated the buffer to be large */
- /* enough, this should not occur. Anyway, we probably want to */
- /* return what we did get, in that case */
- RETURN_FALSE;
- } else {
- MAKE_STD_ZVAL(tmp);
-
- Z_TYPE_P(tmp) = IS_STRING;
- Z_STRLEN_P(tmp) = 0;
-
- switch(cursor->columns[i].dbtype) {
- case SQLT_LNG:
- case SQLT_LBI:
- {
- ub4 ret_len;
- int offset = cursor->columns[i].col_retlen;
- sb2 result;
-
- if (cursor->columns[i].col_retcode == 1406) { /* truncation -> get the rest! */
- while (1) {
- cursor->columns[i].buf = erealloc(cursor->columns[i].buf,offset + DB_SIZE + 1);
-
- if (! cursor->columns[i].buf) {
- offset = 0;
- break;
- }
-
- result = oflng(&cursor->cda,
- (sword)(i + 1),
- cursor->columns[i].buf + offset,
- DB_SIZE,
- 1,
- &ret_len,
- offset);
- if (result) {
- break;
- }
-
- if (ret_len <= 0) {
- break;
- }
-
- offset += ret_len;
- }
- }
- if (cursor->columns[i].buf && offset) {
- Z_STRLEN_P(tmp) = offset;
- } else {
- Z_STRLEN_P(tmp) = 0;
- }
- }
- break;
- default:
- Z_STRLEN_P(tmp) = min(cursor->columns[i].col_retlen,
- cursor->columns[i].dsize);
- break;
- }
- Z_STRVAL_P(tmp) = estrndup(cursor->columns[i].buf,Z_STRLEN_P(tmp));
- }
-
- if (flags&ORA_FETCHINTO_ASSOC){
- zend_hash_update(Z_ARRVAL_PP(arr), cursor->columns[i].cbuf, cursor->columns[i].cbufl+1, (void *) &tmp, sizeof(pval*), NULL);
- } else {
- zend_hash_index_update(Z_ARRVAL_PP(arr), i, (void *) &tmp, sizeof(pval*), NULL);
- }
-
- }
-
- RETURN_LONG(cursor->ncols);
-}
-/* }}} */
-
-/* {{{ proto string ora_columnname(int cursor, int column)
- Get the name of an Oracle result column */
-PHP_FUNCTION(ora_columnname)
-{ /* cursor_index, column_index */
- pval **curs, **col;
- oraCursor *cursor = NULL;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &curs, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((cursor = ora_get_cursor(&EG(regular_list), curs TSRMLS_CC)) == NULL) {
- RETURN_FALSE;
- }
-
- convert_to_long_ex(col);
-
- if (cursor->ncols == 0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this cursor index");
- RETURN_FALSE;
- }
-
- if (Z_LVAL_PP(col) >= cursor->ncols){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Column index larger than number of columns");
- RETURN_FALSE;
- }
-
- if (Z_LVAL_PP(col) < 0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Column numbering starts at 0");
- RETURN_FALSE;
- }
-
- RETURN_STRINGL(cursor->columns[Z_LVAL_PP(col)].cbuf,
- cursor->columns[Z_LVAL_PP(col)].cbufl,1);
-}
-/* }}} */
-
-/* {{{ proto string ora_columntype(int cursor, int column)
- Get the type of an Oracle result column */
-PHP_FUNCTION(ora_columntype)
-{ /* cursor_index, column_index */
- pval **curs, **col;
- int colno;
- oraCursor *cursor = NULL;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &curs, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((cursor = ora_get_cursor(&EG(regular_list), curs TSRMLS_CC)) == NULL) {
- RETURN_FALSE;
- }
-
- convert_to_long_ex(col);
- colno = Z_LVAL_PP(col);
-
- if (cursor->ncols == 0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this cursor index");
- RETURN_FALSE;
- }
-
- if (colno >= cursor->ncols){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Column index larger than number of columns");
- RETURN_FALSE;
- }
-
- if (colno < 0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Column numbering starts at 0");
- RETURN_FALSE;
- }
-
- switch (cursor->columns[colno].dbtype) {
- case SQLT_CHR:
- RETURN_STRINGL("VARCHAR2", 8, 1);
- case SQLT_VCS:
- case SQLT_AVC:
- RETURN_STRINGL("VARCHAR", 7, 1);
- case SQLT_STR:
- case SQLT_AFC:
- RETURN_STRINGL("CHAR", 4, 1);
- case SQLT_NUM: case SQLT_INT:
- case SQLT_FLT: case SQLT_UIN:
- RETURN_STRINGL("NUMBER", 6, 1);
- case SQLT_LNG:
- RETURN_STRINGL("LONG", 4, 1);
- case SQLT_LBI:
- RETURN_STRINGL("LONG RAW", 8, 1);
- case SQLT_RID:
- RETURN_STRINGL("ROWID", 5, 1);
- case SQLT_DAT:
- RETURN_STRINGL("DATE", 4, 1);
-#ifdef SQLT_CUR
- case SQLT_CUR:
- RETURN_STRINGL("CURSOR", 6, 1);
-#endif
- default:
- {
- char numbuf[21];
- snprintf(numbuf, 20, "UNKNOWN(%d)", cursor->columns[colno].dbtype);
- numbuf[20] = '\0';
- RETVAL_STRING(numbuf,1);
- }
- }
-}
-/* }}} */
-
-/* {{{ proto int ora_columnsize(int cursor, int column)
- Return the size of the column */
-PHP_FUNCTION(ora_columnsize)
-{ /* cursor_index, column_index */
- pval **curs, **col;
- oraCursor *cursor = NULL;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &curs, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* Find the cursor */
- if ((cursor = ora_get_cursor(&EG(regular_list), curs TSRMLS_CC)) == NULL) {
- RETURN_FALSE;
- }
-
- convert_to_long_ex(col);
-
- if (cursor->ncols == 0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this cursor index");
- RETURN_FALSE;
- }
-
- if (Z_LVAL_PP(col) >= cursor->ncols){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Column index larger than number of columns");
- RETURN_FALSE;
- }
-
- if (Z_LVAL_PP(col) < 0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Column numbering starts at 0");
- RETURN_FALSE;
- }
-
- RETURN_LONG(cursor->columns[Z_LVAL_PP(col)].dbsize);
-}
-/* }}} */
-
-/* {{{ proto mixed ora_getcolumn(int cursor, int column)
- Get data from a fetched row */
-PHP_FUNCTION(ora_getcolumn)
-{ /* cursor_index, column_index */
- pval **curs,**col;
- int colno;
- oraCursor *cursor = NULL;
- oraColumn *column = NULL;
- int len;
- sb2 type;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &curs, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((cursor = ora_get_cursor(&EG(regular_list), curs TSRMLS_CC)) == NULL) {
- RETURN_FALSE;
- }
-
- if (cursor->ncols == 0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this cursor index");
- RETURN_FALSE;
- }
-
- convert_to_long_ex(col);
- colno = Z_LVAL_PP(col);
-
- if (colno >= cursor->ncols){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Column index larger than number of columns");
- RETURN_FALSE;
- }
-
- if (colno < 0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Column numbering starts at 0");
- RETURN_FALSE;
- }
-
- if (cursor->fetched == 0){
- if (ofetch(&cursor->cda)) {
- if (cursor->cda.rc != NO_DATA_FOUND) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ora_Fetch failed (%s)",
- ora_error(&cursor->cda));
- }
- RETURN_FALSE;
- }
- cursor->fetched++;
- }
-
- column = &cursor->columns[colno];
-
- type = column->dbtype;
-
- if (column->col_retcode == 1405) {
- RETURN_NULL();
- }
-
- if (column->col_retcode != 0 && column->col_retcode != 1406) {
- /* So error fetching column. The most common is 1405, a NULL
- * was retreived. 1406 is ASCII or string buffer data was
- * truncated. The converted data from the database did not fit
- * into the buffer. Since we allocated the buffer to be large
- * enough, this should not occur. Anyway, we probably want to
- * return what we did get, in that case
- */
- RETURN_FALSE;
- } else {
- switch(type) {
- case SQLT_CHR:
- case SQLT_NUM:
- case SQLT_INT:
- case SQLT_FLT:
- case SQLT_STR:
- case SQLT_UIN:
- case SQLT_AFC:
- case SQLT_AVC:
- case SQLT_DAT:
- len = min(column->col_retlen, column->dsize);
- RETURN_STRINGL(column->buf,len,1);
-
- case SQLT_LNG:
- case SQLT_LBI:
- {
- ub4 ret_len;
- int offset = column->col_retlen;
- sb2 result;
-
- if (column->col_retcode == 1406) { /* truncation -> get the rest! */
- while (1) {
- column->buf = erealloc(column->buf,offset + DB_SIZE + 1);
-
- if (! column->buf) {
- offset = 0;
- break;
- }
-
- result = oflng(&cursor->cda,
- (sword)(colno + 1),
- column->buf + offset,
- DB_SIZE,
- 1,
- &ret_len,
- offset);
- if (result) {
- break;
- }
-
- if (ret_len <= 0) {
- break;
- }
-
- offset += ret_len;
- }
- }
- if (column->buf && offset) {
- RETURN_STRINGL(column->buf, offset, 1);
- } else {
- RETURN_FALSE;
- }
- }
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ora_GetColumn found invalid type (%d)", type);
- RETURN_FALSE;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string ora_error(int cursor_or_connection)
- Get an Oracle error message */
-PHP_FUNCTION(ora_error)
-{
- pval **arg;
- oraCursor *cursor;
- oraConnection *conn;
- void *res;
- int what;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 0 || argc >> 1 || zend_get_parameters_ex(argc, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 1) {
- res = zend_fetch_resource(arg TSRMLS_CC, -1,"Oracle-Connection/Cursor",&what,3,le_conn, le_pconn, le_cursor);
- ZEND_VERIFY_RESOURCE(res);
-
- if (what == le_cursor) {
- cursor = (oraCursor *) res;
- RETURN_STRING(ora_error(&cursor->cda),1);
- } else {
- conn = (oraConnection *) res;
- RETURN_STRING(ora_error(&conn->lda),1);
- }
- } else {
- RETURN_STRING(ora_error(&ORA(db_err_conn).lda),1);
- }
-}
-/* }}} */
-
-/* {{{ proto int ora_errorcode(int cursor_or_connection)
- Get an Oracle error code */
-PHP_FUNCTION(ora_errorcode)
-{
- pval **arg;
- oraCursor *cursor;
- oraConnection *conn;
- void *res;
- int what;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 0 || argc >> 1 || zend_get_parameters_ex(argc, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 1) {
- res = zend_fetch_resource(arg TSRMLS_CC, -1,"Oracle-Connection/Cursor",&what,3,le_conn, le_pconn, le_cursor);
- ZEND_VERIFY_RESOURCE(res);
-
- if (what == le_cursor) {
- cursor = (oraCursor *) res;
- RETURN_LONG(cursor->cda.rc);
- } else {
- conn = (oraConnection *) res;
- RETURN_LONG(conn->lda.rc);
- }
- } else {
- RETURN_LONG(ORA(db_err_conn).lda.rc);
- }
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(oracle)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Oracle Support", "enabled");
-#ifndef PHP_WIN32
- php_info_print_table_row(2, "Oracle Version", PHP_ORACLE_VERSION );
- php_info_print_table_row(2, "Compile-time ORACLE_HOME", PHP_ORACLE_DIR );
- php_info_print_table_row(2, "Libraries Used", PHP_ORACLE_SHARED_LIBADD );
-#endif
- php_info_print_table_end();
-}
-/* }}} */
-
-/*
-** Functions internal to this module.
-*/
-
-/* {{{ ora_get_cursor
- */
-static oraCursor *
-ora_get_cursor(HashTable *list, pval **ind TSRMLS_DC)
-{
- oraCursor *cursor;
- oraConnection *db_conn;
-
- cursor = (oraCursor *) zend_fetch_resource(ind TSRMLS_CC, -1, "Oracle-Cursor", NULL, 1, le_cursor);
- if (! cursor) {
- return NULL;
- }
-
- if (zend_hash_find(ORA(conns),(void*)&(cursor->conn_ptr),sizeof(void*),(void **)&db_conn) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Connection already closed for cursor index %d", ind);
- return NULL;
- }
-
- return cursor;
-}
-/* }}} */
-
-/* {{{ ora_error
- */
-static char *
-ora_error(Cda_Def * cda)
-{
- sword n, l;
- static text errmsg[ 512 ];
-
- n = oerhms(cda, cda->rc, errmsg, 400);
-
- /* remove the last newline */
- l = strlen(errmsg);
- if (l < 400 && errmsg[l - 1] == '\n') {
- errmsg[l - 1] = '\0';
- l--;
- }
- if (cda->fc > 0) {
- strcat(errmsg, " -- while processing OCI function ");
- strncat(errmsg, ora_func_tab[cda->fc], 75); /* 512 - 400 - 36 */
- }
- return (char *) errmsg;
-}
-/* }}} */
-
-/* {{{ ora_describe_define
- */
-static sword
-ora_describe_define(oraCursor * cursor)
-{
- long col = 0;
- int i;
- sb2 type;
- sb4 dbsize;
- TSRMLS_FETCH();
-
- if (cursor == NULL) {
- return -1;
- }
-
- if (cursor->columns) {
- for(i = 0; i < cursor->ncols; i++){
- if (cursor->columns[i].buf)
- efree(cursor->columns[i].buf);
- }
- efree(cursor->columns);
- }
-
- cursor->ncols = 0;
-
- while(1){
- if (odescr(&cursor->cda, (sword) cursor->ncols + 1, &dbsize, (sb2 *)0, (sb1 *)0,
- (sb4 *)0, (sb4 *)0, (sb2 *)0, (sb2 *)0, (sb2 *)0)){
- if (cursor->cda.rc == VAR_NOT_IN_LIST) {
- break;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ora_error(&cursor->cda));
- cursor->ncols = 0;
- return -1;
- }
- }
- cursor->ncols++;
- }
-
- if (cursor->ncols > 0){
- cursor->columns = (oraColumn *) emalloc(sizeof(oraColumn) * cursor->ncols);
- memset(cursor->columns,0,sizeof(oraColumn) * cursor->ncols);
- }
-
- for(col = 0; col < cursor->ncols; col++){
- cursor->columns[col].cbufl = ORANAMELEN;
-
- if (odescr(&cursor->cda, (sword)col + 1, &cursor->columns[col].dbsize,
- &cursor->columns[col].dbtype, &cursor->columns[col].cbuf[0],
- &cursor->columns[col].cbufl, &cursor->columns[col].dsize,
- &cursor->columns[col].prec, &cursor->columns[col].scale,
- &cursor->columns[col].nullok)) {
- if (cursor->cda.rc == VAR_NOT_IN_LIST) {
- break;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ora_error(&cursor->cda));
- return -1;
- }
- }
-
- cursor->columns[col].cbuf[cursor->columns[col].cbufl] = '\0';
-
- switch (cursor->columns[col].dbtype) {
- case SQLT_LBI:
- cursor->columns[col].dsize = DB_SIZE;
- type = SQLT_LBI;
- break;
- case SQLT_LNG:
- cursor->columns[col].dsize = DB_SIZE;
- default:
- type = SQLT_STR;
- break;
- }
-
- cursor->columns[col].buf = (ub1 *) emalloc(cursor->columns[col].dsize + 1);
-
- /* Define an output variable for the column */
- if (odefin(&cursor->cda, (sword)col + 1, cursor->columns[col].buf,
- cursor->columns[col].dsize + 1, type, -1, &cursor->columns[col].indp,
- (text *) 0, -1, -1, &cursor->columns[col].col_retlen,
- &cursor->columns[col].col_retcode)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ora_error(&cursor->cda));
- return -1;
- }
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ ora_set_param_values
- */
-int ora_set_param_values(oraCursor *cursor, int isout TSRMLS_DC)
-{
- char *paramname;
- oraParam *param;
- pval **pdata;
- int i, len, plen;
-
- zend_hash_internal_pointer_reset(cursor->params);
-
- if(zend_hash_num_elements(cursor->params) != cursor->nparams){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Mismatch in number of parameters");
- return 0;
- }
-
- for(i = 0; i < cursor->nparams; i++, zend_hash_move_forward(cursor->params)){
- if(zend_hash_get_current_key(cursor->params, &paramname, NULL, 0) != HASH_KEY_IS_STRING){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't get parameter name");
- return 0;
- }
-
- if(zend_hash_get_current_data(cursor->params, (void **)&param) == FAILURE){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't get parameter data");
- return 0;
- }
-
- if(isout){
- SET_VAR_STRINGL(paramname, estrdup(param->progv), strlen(param->progv));
- continue;
- }
-
- /* doing the in-loop */
-
- if (zend_hash_find(&EG(symbol_table), paramname, strlen(paramname) + 1, (void **)&pdata) == FAILURE){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't find variable for parameter");
- return 0;
- }
-
- convert_to_string(*pdata);
- plen = Z_STRLEN_PP(pdata);
-
- if (param->progvl <= plen){
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Input value will be truncated");
- }
-
- len = min(param->progvl - 1, plen);
-
- strncpy(param->progv, Z_STRVAL_PP(pdata), len);
- param->progv[len] = '\0';
- }
-
- return 1;
-}
-/* }}} */
-
-#endif /* HAVE_ORACLE */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/oracle/oracle.dsp b/ext/oracle/oracle.dsp
deleted file mode 100644
index 1791bf877c..0000000000
--- a/ext/oracle/oracle.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="oracle" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=oracle - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "oracle.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "oracle.mak" CFG="oracle - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "oracle - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "oracle - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "oracle - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_ORACLE" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\oci73\include" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_ORACLE=1 /D COMPILE_DL_ORACLE=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib ociw32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_oracle.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\oci73\lib" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "oracle - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\oci73\include" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_ORACLE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_ORACLE=1 /D COMPILE_DL_ORACLE=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts-debug.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib ociw32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_oracle.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\oci73\lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "oracle - Win32 Release_TS"
-# Name "oracle - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\oracle.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_oracle.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/oracle/php_oracle.h b/ext/oracle/php_oracle.h
deleted file mode 100644
index a761dff53b..0000000000
--- a/ext/oracle/php_oracle.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/* $Id$ */
-
-/* synced with oracle.h,v 1.40 1999/06/01 08:11:04 thies Exp $ */
-
-#ifndef PHP_ORACLE_H
-#define PHP_ORACLE_H
-
-#if HAVE_ORACLE
-
-#if (defined(__osf__) && defined(__alpha))
-# ifndef A_OSF
-# define A_OSF
-# endif
-# ifndef OSF1
-# define OSF1
-# endif
-# ifndef _INTRINSICS
-# define _INTRINSICS
-# endif
-#endif /* osf alpha */
-
-#include "oratypes.h"
-#include "ocidfn.h"
-#include "ociapr.h"
-
-extern zend_module_entry oracle_module_entry;
-#define phpext_oracle_ptr &oracle_module_entry
-
-#ifdef ZTS
-#define ORA(v) TSRMG(ora_globals_id, php_ora_globals *, v)
-#else
-#define ORA(v) (ora_globals.v)
-#endif
-
-/* oparse flags */
-#define DEFER_PARSE 1
-#define NATIVE 1
-#define VERSION_7 2
-
-#define ORANUMWIDTH 38
-
-#if (defined(__osf__) && defined(__alpha)) || defined(CRAY) || defined(KSR)
-#define HDA_SIZE 512
-#else
-#define HDA_SIZE 256
-#endif
-
-#define ORAUIDLEN 32
-#define ORAPWLEN 32
-#define ORANAMELEN 32
-#define ORABUFLEN 2000
-
-/* Some Oracle error codes */
-#define VAR_NOT_IN_LIST 1007
-#define NO_DATA_FOUND 1403
-#define NULL_VALUE_RETURNED 1405
-
-/* Some SQL and ORA function codes */
-#define FT_INSERT 3
-#define FT_SELECT 4
-#define FT_UPDATE 5
-#define FT_DELETE 9
-
-#define FC_OOPEN 14
-
-typedef struct {
- int open;
- int persistent;
- Lda_Def lda;
- ub1 hda[HDA_SIZE];
-} oraConnection;
-
-typedef struct oraColumn {
- sb4 dbsize;
- sb2 dbtype;
- text cbuf[ORANAMELEN+1];
- sb4 cbufl;
- sb4 dsize;
- sb2 prec;
- sb2 scale;
- sb2 nullok;
- ub1 *buf;
- sb2 indp;
- ub2 col_retlen, col_retcode;
-} oraColumn;
-
-typedef struct oraParam {
- text *progv;
- sword progvl;
- sb2 inout;
- ub2 alen;
-} oraParam;
-
-typedef struct oraCursor {
- int open;
- Cda_Def cda;
- text *query;
- HashTable *params;
- int nparams;
- oraColumn *columns;
- int ncols;
- int fetched;
- oraConnection *conn_ptr;
- int conn_id;
-} oraCursor;
-
-typedef struct {
- char *defDB;
- char *defUser;
- char *defPW;
- long allow_persistent;
- long max_persistent;
- long max_links;
- long num_persistent;
- long num_links;
- HashTable *conns;
- oraConnection db_err_conn;
-} php_ora_globals;
-
-#else
-
-#define phpext_oracle_ptr NULL
-
-#endif /* HAVE_ORACLE */
-
-#endif /* PHP_ORACLE_H */
-
-/*
- * Local Variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-
-
-
diff --git a/ext/ovrimos/CREDITS b/ext/ovrimos/CREDITS
deleted file mode 100644
index b8c4b75630..0000000000
--- a/ext/ovrimos/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Ovrimos
-Nikos Mavroyanopoulos
diff --git a/ext/ovrimos/config.m4 b/ext/ovrimos/config.m4
deleted file mode 100644
index b424664fb2..0000000000
--- a/ext/ovrimos/config.m4
+++ /dev/null
@@ -1,28 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(ovrimos, for Ovrimos SQL Server support,
-[ --with-ovrimos[=DIR] Include Ovrimos SQL Server support. DIR is the
- Ovrimos libsqlcli install directory.])
-
-if test "$PHP_OVRIMOS" != "no"; then
- for i in /usr/local /usr $PHP_OVRIMOS; do
- if test -f $i/include/sqlcli.h; then
- OVRIMOS_DIR=$i
- fi
- done
-
- if test -z "$OVRIMOS_DIR"; then
- AC_MSG_ERROR(Please reinstall Ovrimos' libsqlcli - I cannot find sqlcli.h)
- fi
-
- PHP_ADD_INCLUDE($OVRIMOS_DIR/include)
- PHP_SUBST(OVRIMOS_SHARED_LIBADD)
- LDFLAGS="$LDFLAGS $ld_runpath_switch$OVRIMOS_DIR/lib -L$OVRIMOS_DIR/lib"
- AC_CHECK_LIB(sqlcli, main)
- PHP_ADD_LIBRARY_WITH_PATH(sqlcli, $OVRIMOS_DIR/lib, OVRIMOS_SHARED_LIBADD)
- AC_DEFINE(HAVE_LIBSQLCLI,1,[ ])
-
- PHP_NEW_EXTENSION(ovrimos, ovrimos.c, $ext_shared)
-fi
diff --git a/ext/ovrimos/ovrimos.c b/ext/ovrimos/ovrimos.c
deleted file mode 100644
index e34cd155c9..0000000000
--- a/ext/ovrimos/ovrimos.c
+++ /dev/null
@@ -1,1291 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Dimitris Souflis, Nikos Mavroyanopoulos |
- | for Ovrimos S.A. |
- | |
- | Contact support@ovrimos.com for questions regarding this module |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_globals.h"
-#include "zend_API.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-
-#include <sqlcli.h> /* ovrimos header
- */
-
-#ifndef WIN32 /* stricmp is defined in sqlcli */
-# define stricmp strcasecmp
-#endif
-
-
-PHP_MINFO_FUNCTION(ovrimos)
-{
- php_printf("&quot;Ovrimos&quot; module<br />\n");
-}
-
-/* Main User Functions
- */
-
-/* ovrimos_connect() currently does not support secure (SSL/TLS) connections.
- * As an alternative you can use the unixODBC driver available at
- * http://www.ovrimos.com/download which supports SSL.
- * Contact support@ovrimos.com for more information.
- */
-
-/* 2001-07-27: ovrimos_close_all() function was removed in order
- * for this module to be reentrant.
- */
-
-
-/* structures introduced in order to support the old ovrimos-php-api with
- * the new multi-threaded library (old works with the old library).
- * This version is reentrant.
- *
- * The only limitation is that a connection ( as returned by ovrimos_connect())
- * may only be accessed by one thread (but this is the case in php now).
- */
-
-typedef struct {
- SQLS statement;
- int longreadlen;
- struct _CON_STATE* con_state;
-} STATEMENT;
-
-typedef struct _CON_STATE {
- SQLH connection;
- STATEMENT * statements;
- int nstatements;
-} CON_STATE;
-
-typedef STATEMENT* PSTATEMENT;
-typedef CON_STATE* PCON_STATE;
-
-static void column_to_string(SQLS stmt, int i, char *buffer, int *len, PSTATEMENT pstmt);
-
-/* {{{ proto int ovrimos_connect(string host, string db, string user, string password)
- Connect to an Ovrimos database */
-PHP_FUNCTION(ovrimos_connect)
-{
- pval *arg1, *arg2, *arg3, *arg4;
- PCON_STATE state;
- SQLH conn = 0;
-
- if (ARG_COUNT(ht) != 4
- || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg1);
- convert_to_string(arg2);
- convert_to_string(arg3);
- convert_to_string(arg4);
-
- if (!sqlConnect
- (Z_STRVAL_P(arg1), Z_STRVAL_P(arg2), Z_STRVAL_P(arg3),
- Z_STRVAL_P(arg4), &conn, 0)) {
- RETURN_LONG(0);
- }
-
- state = ecalloc( 1, sizeof(CON_STATE));
-
- state->connection = conn;
- state->statements = NULL;
- state->nstatements = 0;
-
- RETURN_LONG( (long)state);
-}
-
-/* }}} */
-
-/* {{{ proto void ovrimos_close(int connection)
- Close a connection */
-PHP_FUNCTION(ovrimos_close)
-{
- pval *arg1;
- int i;
- PCON_STATE state;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE
- || Z_TYPE_P(arg1) != IS_LONG) {
- WRONG_PARAM_COUNT;
- }
-
- state = (PCON_STATE) Z_LVAL_P(arg1);
-
- /* free all the statements associated with
- * the connection. (called results in php)
- */
-
- for (i=0;i < state->nstatements;i++) {
- if ( state->statements[i].statement!=NULL) {
- sqlFreeStmt( state->statements[i].statement);
- }
- }
- if (state->statements!=NULL)
- efree( state->statements);
-
- /* close the SQL_Handle
- */
- sqlDisconnect( state->connection);
-
- efree( state);
-
- return;
-}
-
-/* }}} */
-
-
-/* {{{ proto int ovrimos_longreadlen(int result_id, int length)
- Handle LONG columns */
-PHP_FUNCTION(ovrimos_longreadlen)
-{
- pval *arg1, *arg2;
- PSTATEMENT stmt;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_long(arg2);
-
- stmt = (PSTATEMENT) Z_LVAL_P(arg1);
-
- stmt->longreadlen = Z_LVAL_P(arg2);
- RETURN_TRUE;
-}
-
-/* }}} */
-
-#define DEFAULT_LONGREADLEN 0
-
-/* These two functions are quite expensive. Some optimization may be
- * done in a later version.
- */
-static int local_sqlAllocStmt( PCON_STATE state, SQLH conn, SQLS *stmt, PSTATEMENT* pstmt) {
-int index, ret;
-
- ret = sqlAllocStmt( conn, stmt);
- if (!ret) return ret;
-
- state->nstatements++;
- state->statements = erealloc(state->statements, state->nstatements*sizeof( STATEMENT));
-
- index = state->nstatements - 1;
- state->statements[ index].statement = (*stmt);
- state->statements[ index].longreadlen = DEFAULT_LONGREADLEN;
- state->statements[ index].con_state = state;
-
- *pstmt = &state->statements[ index];
-
- return 1;
-}
-
-static int local_sqlFreeStmt( PSTATEMENT statement, SQLS stmt) {
-int j, i;
-PSTATEMENT new_statements;
-PCON_STATE state = statement->con_state;
-
- sqlFreeStmt( stmt);
-
- if (state->nstatements-1 == 0) {
- efree( state->statements);
- state->statements = NULL;
- state->nstatements--;
-
- return 1;
- }
-
- new_statements = emalloc( (state->nstatements-1) * sizeof(STATEMENT));
-
- for (i=j=0;i<state->nstatements;i++) {
- if (state->statements->statement != stmt) {
- new_statements[j].statement = state->statements[i].statement;
- new_statements[j].longreadlen = state->statements[i].longreadlen;
- new_statements[j++].con_state = state->statements[i].con_state;
- }
- }
-
- efree( state->statements);
- state->statements = new_statements;
- state->nstatements--;
-
- return 1; /* true */
-}
-
-/* {{{ proto int ovrimos_prepare(int connection_id, string query)
- Prepares a statement for execution */
-PHP_FUNCTION(ovrimos_prepare)
-{
- pval *arg1, *arg2;
- SQLH conn;
- char *query;
- SQLS stmt;
- PCON_STATE state;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_string(arg2);
-
- state = (PCON_STATE) Z_LVAL_P(arg1);
-
- conn = (SQLH) state->connection;
- query = Z_STRVAL_P(arg2);
-
- if (!local_sqlAllocStmt( state, conn, &stmt, &pstmt)) {
- RETURN_FALSE;
- }
- if (!sqlPrepare(stmt, query)) {
- local_sqlFreeStmt( pstmt, stmt);
- RETURN_FALSE;
- }
- if (!sqlGetOutputColDescr(stmt)) {
- local_sqlFreeStmt( pstmt, stmt);
- RETURN_FALSE;
- }
- if (!sqlGetParamDescr(stmt)) {
- local_sqlFreeStmt( pstmt, stmt);
- RETURN_FALSE;
- }
-
- /* returns a result id which is actually a
- * pointer to a STATEMENT structure;
- */
- RETURN_LONG( (long)pstmt);
-}
-
-/* }}} */
-
-/*
- * Execute prepared SQL statement. Supports only input parameters.
- */
-/* {{{ proto int ovrimos_execute(int result_id [, array parameters_array])
- Execute a prepared statement */
-PHP_FUNCTION(ovrimos_execute)
-{
- pval *arg1, *arg2;
- SQLS stmt;
- int numArgs;
- int icol, colnb;
- PSTATEMENT pstmt;
-
- numArgs = ARG_COUNT(ht);
-
- if (getParameters(ht, numArgs, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
-
- stmt = pstmt->statement;
- colnb = sqlGetParamNb(stmt);
-
- if (colnb != 0) {
- pval **tmp;
- int arr_elem;
-
- if (Z_TYPE_P(arg2) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not an array in call to ovrimos_execute()");
- RETURN_FALSE;
- }
- arr_elem = zend_hash_num_elements(Z_ARRVAL_P(arg2));
- if (arr_elem < colnb) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not enough parameters in call to ovrimos_execute(): %d instead of %d", arr_elem, colnb);
- RETURN_FALSE;
- }
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(arg2));
-
- for (icol = 0; icol < colnb; icol++) {
- int len;
- cvt_error err;
- bool ret;
- char *msg;
- char buffer[10240];
- sql_type to_type = sqlGetParamSQLType(stmt, icol);
- sql_type from_type;
-
- if (zend_hash_get_current_data
- (Z_ARRVAL_P(arg2), (void **) &tmp) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error getting parameter %d in call to ovrimos_execute()", icol);
- RETURN_FALSE;
- }
- convert_to_string(*tmp);
- if (Z_TYPE_PP(tmp) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error converting parameter %d to string in call to ovrimos_execute()", icol);
- RETURN_FALSE;
- }
-
- /* PHP data to param type */
- Z_TYPE(from_type) = T_VARCHAR;
- from_type.u.length = Z_STRLEN_PP(tmp);
-
- *buffer = 0;
- memcpy(buffer + 1, Z_STRVAL_PP(tmp),
- from_type.u.length);
- buffer[from_type.u.length + 1] = 0;
-
- ret =
- type_convert(buffer, &from_type, &to_type, 0,
- &err);
- switch (err) {
- case cvt_trunc:
- msg = "Data truncated";
- break;
- case cvt_range:
- msg = "Numeric value out of range";
- break;
- case cvt_prec:
- msg = "Precision lost";
- break;
- case cvt_incomp:
- msg =
- "Restricted data type attribute violation";
- break;
- case cvt_no:
- msg = "Conversion failed";
- break;
- default:
- msg = "Unknown error";
- break;
- }
- if (!ret) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error converting parameter %d: %s in call to ovrimos_execute()", icol, msg);
- RETURN_FALSE;
- }
-
- len = sql_type_size(to_type) - 1;
- if (!sqlPutParam(stmt, icol, buffer + 1, len)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could send parameter %d (%d bytes) in call to ovrimos_execute()", icol, len);
- RETURN_FALSE;
- }
- }
- }
-
- if (!sqlExec(stmt)) {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string ovrimos_cursor(int result_id)
- Get cursor name */
-PHP_FUNCTION(ovrimos_cursor)
-{
- char cname[126];
- pval *arg1;
- SQLS stmt;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
-
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
- stmt = pstmt->statement;
-
- if (!sqlGetCursorName(stmt, cname)) {
- RETURN_FALSE;
- }
- RETURN_STRING(cname, 1);
-}
-
-/* }}} */
-
-/* This function returns a result id. The result ID is
- * a pointer to a STATEMENT structure.
- * Every result is mapped to a statement.
- */
-
-/* {{{ proto int ovrimos_exec(int connection_id, string query)
- Prepare and execute an SQL statement */
-PHP_FUNCTION(ovrimos_exec)
-{
- pval *arg1, *arg2;
- SQLH conn;
- SQLS stmt;
- int numArgs;
- char *query;
- PSTATEMENT pstmt;
- PCON_STATE state;
-
- numArgs = ARG_COUNT(ht);
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_string(arg2);
-
- state = (PCON_STATE) Z_LVAL_P(arg1);
- conn = state->connection;
- query = Z_STRVAL_P(arg2);
-
- if (!local_sqlAllocStmt( state, conn, &stmt, &pstmt)) {
- RETURN_FALSE;
- }
-
- if (!sqlExecDirect(stmt, query)) {
- local_sqlFreeStmt( pstmt, stmt);
- RETURN_FALSE;
- }
- if (!sqlGetOutputColDescr(stmt)) {
- local_sqlFreeStmt( pstmt, stmt);
- RETURN_FALSE;
- }
- if (!sqlGetParamDescr(stmt)) {
- local_sqlFreeStmt( pstmt, stmt);
- RETURN_FALSE;
- }
-
- RETURN_LONG( (long)pstmt);
-}
-
-/* }}} */
-
-/* {{{ column_to_string
- */
-static void column_to_string(SQLS stmt, int i, char *buffer, int *len, PSTATEMENT pstmt)
-{
- const char *bf = sqlColValue(stmt, i, 0);
- int longreadlen;
-
- longreadlen = pstmt->longreadlen;
-
- switch (sqlGetOutputColType(stmt, i)) {
- case T_BIGINT:
- case T_UBIGINT:{
- switch (sqlGetOutputColType(stmt, i)) {
- case T_BIGINT:
- printsint64(Read(sint64, bf), buffer);
- break;
- case T_UBIGINT:
- printuint64(Read(uint64, bf), buffer);
- break;
- }
- *len = strlen(buffer);
- }
- break;
- case T_INTEGER:
- sprintf(buffer, "%11d", Read(sint32, bf));
- *len = strlen(buffer);
- break;
- case T_UINTEGER:
- sprintf(buffer, "%10u", Read(uint32, bf));
- *len = strlen(buffer);
- break;
- case T_SMALLINT:
- sprintf(buffer, "%6hd", Read(sint16, bf));
- *len = strlen(buffer);
- break;
- case T_USMALLINT:
- sprintf(buffer, "%5hu", Read(uint16, bf));
- *len = strlen(buffer);
- break;
- case T_TINYINT:
- sprintf(buffer, "%4hd", (sint16) Read(sint8, bf));
- *len = strlen(buffer);
- break;
- case T_UTINYINT:
- sprintf(buffer, "%3hu", (uint16) Read(uint8, bf));
- *len = strlen(buffer);
- break;
- case T_BIT:
- sprintf(buffer, "%s",
- (Read(uint8, bf) == 0) ? "off" : "on");
- *len = strlen(buffer);
- break;
- case T_REAL:
- sprintf(buffer, "%9.7g", (double) Read(float, bf));
- *len = strlen(buffer);
- break;
-
- case T_FLOAT:
- case T_DOUBLE:
- sprintf(buffer, "%19.17g", Read(double, bf));
- *len = strlen(buffer);
- break;
- case T_DECIMAL:
- case T_NUMERIC:{
- int prec = sqlGetOutputColPrecision(stmt, i);
- int scale = sqlGetOutputColScale(stmt, i);
- sprintf(buffer, "%*.*f", prec + 2, scale,
- Read(double, bf));
- *len = strlen(buffer);
- } break;
- case T_CHAR:
- case T_VARCHAR:
- strcpy(buffer, bf);
- *len = strlen(buffer);
- break;
- case T_UNI_CHAR:
- case T_UNI_VARCHAR:
- uni_strcpy((uni_char *) buffer, (uni_char *) bf);
- *len = uni_strlen((uni_char *) buffer);
- break;
- case T_BINARY:{
- int sz = sqlGetOutputColLength(stmt, i);
- memcpy(buffer, bf, sz);
- *len = sz;
- } break;
-
- case T_VARBINARY:{
- int sz = Read(uint16, bf);
- memcpy(buffer, bf + 2, sz);
- *len = sz;
- } break;
-
- case T_DATE:{
- if (!sql_date_to_str((uint32 *) bf, buffer)) {
- strcpy(buffer, "Error!");
- }
- }
- break;
-
- case T_TIME:{
- int prec = sqlGetOutputColPrecision(stmt, i);
- if (!sql_time_to_str
- ((uint32 *) bf, prec, 0, buffer)) {
- strcpy(buffer, "Error!");
- }
- }
- break;
-
- case T_TIMESTAMP:{
- int prec = sqlGetOutputColPrecision(stmt, i);
- if (!sql_timestamp_to_str
- ((uint32 *) bf, prec, 0, buffer)) {
- strcpy(buffer, "Error!");
- }
-
- }
- break;
-
- case T_LONGVARCHAR:
- case T_LONGVARBINARY:{
- if (longreadlen == 0) {
- *buffer = 0;
- *len = 0;
- } else
- if (!sqlColValueLong
- (stmt, i, 0, 0, longreadlen, buffer, len)) {
- strcpy(buffer, "Error!");
- }
- }
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto int ovrimos_fetch_into(int result_id, array result_array [, string how, [int rownumber]])
- Fetch one result row into an array
- how: 'Next' (default), 'Prev', 'First', 'Last', 'Absolute'
- */
-PHP_FUNCTION(ovrimos_fetch_into)
-{
- int numArgs;
- char *s_how;
- typedef enum { h_next = 0, h_prev, h_first, h_last, h_absolute
- } h_type;
- h_type how = h_next; /* default */
- sint32 rownum = 0;
- pval *arg_id, *arg_how = 0, *arg_row = 0, *arr, *tmp;
- SQLS stmt;
- PSTATEMENT pstmt;
- int icol, colnb;
- bool ret=0;
- numArgs = ARG_COUNT(ht);
-
- switch (numArgs) {
- case 2:
- if (getParameters(ht, 2, &arg_id, &arr) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 3:
- if (getParameters(ht, 3, &arg_id, &arr, &arg_how) ==
- FAILURE) WRONG_PARAM_COUNT;
- break;
- case 4:
- if (getParameters(ht, 4, &arg_id, &arr, &arg_how, &arg_row)
- == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg_id);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg_id);
-
- stmt = pstmt->statement;
-
- if (arg_how != 0) {
- if (Z_TYPE_P(arg_how) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Third argument not string in ovrimos_fetch_into()");
- RETURN_FALSE;
- }
- s_how = Z_STRVAL_P(arg_how);
- if (stricmp(s_how, "next") == 0) {
- how = h_next;
- } else if (stricmp(s_how, "prev") == 0) {
- how = h_prev;
- } else if (stricmp(s_how, "first") == 0) {
- how = h_first;
- } else if (stricmp(s_how, "last") == 0) {
- how = h_last;
- } else if (stricmp(s_how, "absolute") == 0) {
- how = h_absolute;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Third argument not valid in ovrimos_fetch_into()");
- RETURN_FALSE;
- }
- if (arg_row == 0 && how == h_absolute) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Fourth argument is required for ABSOLUTE in ovrimos_fetch_into()");
- RETURN_FALSE;
- }
- if (arg_row != 0) {
- convert_to_long(arg_row);
- rownum = Z_LVAL_P(arg_row);
- switch (how) {
- case h_next:
- case h_prev:
- rownum--; /* Next 1 should send FUNC_CURSOR_NEXT(0) */
- break;
- default:
- break;
- }
- }
- }
-
- if (Z_TYPE_P(arr) != IS_ARRAY) {
- array_init(arr);
- }
- switch (how) {
- case h_absolute:
- case h_first:
- ret = sqlCursorFirst(stmt, rownum);
- break;
- case h_last:
- ret = sqlCursorLast(stmt, rownum);
- break;
- case h_next:
- ret = sqlCursorNext(stmt, rownum);
- break;
- case h_prev:
- ret = sqlCursorPrev(stmt, rownum);
- break;
- }
- if (!ret) {
- RETURN_FALSE;
- }
-
- colnb = sqlGetOutputColNb(stmt);
- for (icol = 0; icol < colnb; icol++) {
- int len;
- char buffer[10240];
- tmp = (pval *) emalloc(sizeof(pval));
- tmp->refcount = 1;
- Z_TYPE_P(tmp) = IS_STRING;
- Z_STRLEN_P(tmp) = 0;
-
- /* Produce column value in 'tmp' ... */
-
- column_to_string(stmt, icol, buffer, &len, pstmt);
- Z_STRLEN_P(tmp) = len;
- Z_STRVAL_P(tmp) = estrndup(buffer, len);
-
- zend_hash_index_update(Z_ARRVAL_P(arr), icol, &tmp,
- sizeof(pval *), NULL);
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_fetch_row(int result_id [, int how, [int row_number]])
- how: 'Next' (default), 'Prev', 'First', 'Last', 'Absolute'
- Fetch a row */
-PHP_FUNCTION(ovrimos_fetch_row)
-{
- int numArgs;
- char *s_how;
- typedef enum { h_next = 0, h_prev, h_first, h_last, h_absolute
- } h_type;
- h_type how = h_next; /* default */
- sint32 rownum = 0;
- pval *arg_id, *arg_how = 0, *arg_row = 0;
- SQLS stmt;
- PSTATEMENT pstmt;
- bool ret = 0;
- numArgs = ARG_COUNT(ht);
-
- switch (numArgs) {
- case 1:
- if (getParameters(ht, 1, &arg_id) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 2:
- if (getParameters(ht, 2, &arg_id, &arg_how) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 3:
- if (getParameters(ht, 3, &arg_id, &arg_how, &arg_row) ==
- FAILURE) WRONG_PARAM_COUNT;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg_id);
-
- pstmt = (PSTATEMENT) Z_LVAL_P(arg_id);
- stmt = (SQLS) pstmt->statement;
-
- if (arg_how != 0) {
- if (Z_TYPE_P(arg_how) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument not string in ovrimos_fetch_row()");
- RETURN_FALSE;
- }
- s_how = Z_STRVAL_P(arg_how);
- if (stricmp(s_how, "next") == 0) {
- how = h_next;
- } else if (stricmp(s_how, "prev") == 0) {
- how = h_prev;
- } else if (stricmp(s_how, "first") == 0) {
- how = h_first;
- } else if (stricmp(s_how, "last") == 0) {
- how = h_last;
- } else if (stricmp(s_how, "absolute") == 0) {
- how = h_absolute;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument not valid in ovrimos_fetch_row()");
- RETURN_FALSE;
- }
- if (arg_row == 0 && how == 4) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Third argument is required for ABSOLUTE in ovrimos_fetch_row()");
- RETURN_FALSE;
- }
- if (arg_row != 0) {
- convert_to_long(arg_row);
- rownum = Z_LVAL_P(arg_row);
- switch (how) {
- case h_next:
- case h_prev:
- rownum--; /* Next 1 should send FUNC_CURSOR_NEXT(0) */
- break;
- default:
- break;
- }
- }
- }
-
- switch (how) {
- case h_absolute:
- case h_first:
- ret = sqlCursorFirst(stmt, rownum);
- break;
- case h_last:
- ret = sqlCursorLast(stmt, rownum);
- break;
- case h_next:
- ret = sqlCursorNext(stmt, rownum);
- break;
- case h_prev:
- ret = sqlCursorPrev(stmt, rownum);
- break;
- }
- if (!ret) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string ovrimos_result(int result_id, mixed field)
- Get result data */
-PHP_FUNCTION(ovrimos_result)
-{
- int numArgs = ARG_COUNT(ht);
- pval *arg_id, *arg_field;
- int icol=0, colnb;
- SQLS stmt;
- int len;
- PSTATEMENT pstmt;
- char buffer[1024];
-
- if (numArgs != 2
- || getParameters(ht, 2, &arg_id,
- &arg_field) == FAILURE) WRONG_PARAM_COUNT;
-
- convert_to_long(arg_id);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg_id);
- stmt = (SQLS) pstmt->statement;
-
- colnb = sqlGetOutputColNb(stmt);
-
- if (Z_TYPE_P(arg_field) == IS_STRING) {
- int i;
- for (i = 0; i < colnb; i++) {
- if (!stricmp
- (Z_STRVAL_P(arg_field),
- sqlGetOutputColName(stmt, i))) {
- icol = i;
- break;
- }
- }
- } else if (Z_TYPE_P(arg_field) == IS_LONG) {
- icol = Z_LVAL_P(arg_field) - 1;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument neither number nor string in ovrimos_result()");
- RETURN_FALSE;
- }
- if (icol < 0 || icol > colnb) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown column in ovrimos_result()");
- RETURN_FALSE;
- }
- column_to_string(stmt, icol, buffer, &len, pstmt);
-
- RETURN_STRINGL(buffer, len, 1);
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_result_all(int result_id [, string format])
- Print result as HTML table */
-PHP_FUNCTION(ovrimos_result_all)
-{
- long fetched = 0;
- pval *arg1, *arg2;
- int numArgs;
- SQLS stmt;
- int icol, colnb;
- PSTATEMENT pstmt;
- char buffer[1024];
- int len;
-
- numArgs = ARG_COUNT(ht);
- if (numArgs == 1) {
- if (getParameters(ht, 1, &arg1) == FAILURE)
- WRONG_PARAM_COUNT;
- } else {
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
- stmt = (SQLS) pstmt->statement;
-
- colnb = sqlGetOutputColNb(stmt);
-
- /* Start table tag */
- if (numArgs == 1) {
- php_printf("<table><tr>");
- } else {
- convert_to_string(arg2);
- php_printf("<table %s ><tr>", Z_STRVAL_P(arg2));
- }
-
- for (icol = 0; icol < colnb; icol++) {
- php_printf("<th>%s</th>", sqlGetOutputColName(stmt, icol));
- }
-
- php_printf("</tr>\n");
-
- if (sqlCursorFirst(stmt, 0)) {
- do {
- fetched++;
- php_printf("<tr>");
- for (icol = 0; icol < colnb; icol++) {
- column_to_string(stmt, icol, buffer, &len, pstmt);
- php_printf("<td>%s</td>", buffer);
- }
- php_printf("</tr>\n");
- } while (sqlCursorNext(stmt, 0));
- }
- php_printf("</table>\n");
-
- RETURN_LONG(fetched);
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_free_result(int result_id)
- Free resources associated with a result */
-PHP_FUNCTION(ovrimos_free_result)
-{
- pval *arg1;
- SQLS stmt;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
- stmt = (SQLS) pstmt->statement;
-
- sqlCloseCursor( stmt);
- local_sqlFreeStmt( pstmt, stmt);
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_num_rows(int result_id)
- Get number of rows in a result */
-PHP_FUNCTION(ovrimos_num_rows)
-{
- uint32 rows;
- pval *arg1;
- SQLS stmt;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
- stmt = (SQLS) pstmt->statement;
-
-
- sqlGetRowCount(stmt, &rows);
- RETURN_LONG(rows);
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_num_fields(int result_id)
- Get number of columns in a result */
-PHP_FUNCTION(ovrimos_num_fields)
-{
- pval *arg1;
- SQLS stmt;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
-
- stmt = (SQLS) pstmt->statement;
-
- RETURN_LONG(sqlGetOutputColNb(stmt));
-}
-
-/* }}} */
-
-/* {{{ proto string ovrimos_field_name(int result_id, int field_number)
- Get a column name */
-PHP_FUNCTION(ovrimos_field_name)
-{
- pval *arg1, *arg2;
- SQLS stmt;
- int field;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
-
- stmt = (SQLS) pstmt->statement;
-
-
- if (Z_LVAL_P(arg2) < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field numbering starts at 1! in call to ovrimos_field_name()");
- RETURN_FALSE;
- }
-
- field = Z_LVAL_P(arg2) - 1;
-
- if (field >= sqlGetOutputColNb(stmt)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No field at this index (%d) in call to ovrimos_field_name()", field);
- RETURN_FALSE;
- }
-
- RETURN_STRING((char *) sqlGetOutputColName(stmt, field), 1);
-}
-
-/* }}} */
-
-/* {{{ proto string ovrimos_field_type(int result_id, int field_number)
- Get the datatype of a column */
-PHP_FUNCTION(ovrimos_field_type)
-{
- pval *arg1, *arg2;
- SQLS stmt;
- int field;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
-
- stmt = (SQLS) pstmt->statement;
-
- if (Z_LVAL_P(arg2) < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field numbering starts at 1! in call to ovrimos_field_type()");
- RETURN_FALSE;
- }
-
- field = Z_LVAL_P(arg2) - 1;
-
- if (field >= sqlGetOutputColNb(stmt)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No field at this index (%d) in call to ovrimos_field_type()", field);
- RETURN_FALSE;
- }
-
- RETURN_LONG(sqlGetOutputColType(stmt, field));
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_field_len(int result_id, int field_number)
- Get the length of a column */
-PHP_FUNCTION(ovrimos_field_len)
-{
- pval *arg1, *arg2;
- SQLS stmt;
- int field;
- PSTATEMENT pstmt;
- int longreadlen;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
-
- longreadlen = pstmt->longreadlen;
-
- stmt = (SQLS) pstmt->statement;
-
- if (Z_LVAL_P(arg2) < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field numbering starts at 1! in call to ovrimos_field_len()");
- RETURN_FALSE;
- }
-
- field = Z_LVAL_P(arg2) - 1;
-
- if (field >= sqlGetOutputColNb(stmt)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No field at this index (%d) in call to ovrimos_field_len()", field);
- RETURN_FALSE;
- }
-
- switch (sqlGetOutputColType(stmt, field)) {
- case T_LONGVARCHAR:
- case T_LONGVARBINARY:
- RETURN_LONG(longreadlen);
- default:
- RETURN_LONG(sqlGetOutputColLength(stmt, field));
- }
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_field_num(int result_id, string field_name)
- Return column number */
-PHP_FUNCTION(ovrimos_field_num)
-{
- pval *arg1, *arg2;
- SQLS stmt;
- int i, n;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE
- || Z_TYPE_P(arg2) != IS_STRING) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
- stmt = (SQLS) pstmt->statement;
-
- n = sqlGetOutputColNb(stmt);
- for (i = 0; i < n; i++) {
- if (!strcmp
- (Z_STRVAL_P(arg2), sqlGetOutputColName(stmt, i))) {
- RETURN_LONG(i + 1);
- }
- }
- RETURN_FALSE;
-}
-
-/* }}} */
-
-#if 0
-/* {{{ proto int ovrimos_autocommit(int connection_id, int OnOff)
- Toggle autocommit mode
- There can be problems with pconnections!*/
-PHP_FUNCTION(ovrimos_autocommit)
-{
-}
-
-/* }}} */
-#endif
-
-/* {{{ proto int ovrimos_commit(int connection_id)
- Commit an ovrimos transaction */
-PHP_FUNCTION(ovrimos_commit)
-{
- pval *arg1;
- SQLS stmt;
- int i;
- PCON_STATE state;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE
- || Z_TYPE_P(arg1) != IS_LONG) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long( arg1);
- state = (PCON_STATE) Z_LVAL_P(arg1);
-
- for (i=0;i<state->nstatements;i++) {
- stmt = state->statements[ i].statement;
- if (stmt==NULL) {
- continue;
- }
- if (!sqlCommit(stmt)) {
- RETURN_FALSE;
- }
- }
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_rollback(int connection_id)
- Rollback a transaction */
-PHP_FUNCTION(ovrimos_rollback)
-{
- pval *arg1;
- SQLS stmt;
- int i;
- PCON_STATE state;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE
- || Z_TYPE_P(arg1) != IS_LONG) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long( arg1);
- state = (PCON_STATE) Z_LVAL_P(arg1);
-
- for (i=0;i<state->nstatements;i++) {
- stmt = (SQLS) state->statements[ i].statement;
- if (stmt==NULL) continue;
-
- if (!sqlRollback(stmt)) {
- RETURN_FALSE;
- }
- }
- RETURN_TRUE;
-}
-
-/* }}} */
-
-#if 0
-/* {{{ proto int ovrimos_setoption(int conn_id|result_id, int which, int option, int value)
- Sets connection or statement options */
-PHP_FUNCTION(ovrimos_setoption)
-{
-}
-
-/* }}} */
-#endif
-
-/* {{{ ovrimos_functions[]
- */
-function_entry ovrimos_functions[] = {
-/* PHP_FE(ovrimos_setoption, NULL)*/
-/* PHP_FE(ovrimos_autocommit, NULL)*/
- PHP_FE(ovrimos_close, NULL)
- PHP_FE(ovrimos_commit, NULL)
- PHP_FE(ovrimos_connect, NULL)
- PHP_FE(ovrimos_cursor, NULL)
- PHP_FE(ovrimos_exec, NULL)
- PHP_FE(ovrimos_prepare, NULL)
- PHP_FE(ovrimos_execute, NULL)
- PHP_FE(ovrimos_fetch_row, NULL)
- PHP_FE(ovrimos_fetch_into, second_arg_force_ref)
- PHP_FE(ovrimos_field_len, NULL)
- PHP_FE(ovrimos_field_name, NULL)
- PHP_FE(ovrimos_field_type, NULL)
- PHP_FE(ovrimos_field_num, NULL)
- PHP_FE(ovrimos_free_result, NULL)
- PHP_FE(ovrimos_num_fields, NULL)
- PHP_FE(ovrimos_num_rows, NULL)
- PHP_FE(ovrimos_result, NULL)
- PHP_FE(ovrimos_result_all, NULL)
- PHP_FE(ovrimos_rollback, NULL)
-/* PHP_FE(ovrimos_binmode, NULL)*/
- PHP_FE(ovrimos_longreadlen, NULL)
- PHP_FALIAS(ovrimos_do, ovrimos_exec, NULL) {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry ovrimos_module_entry = {
- STANDARD_MODULE_HEADER,
- "ovrimos",
- ovrimos_functions,
- NULL,
- NULL,
- NULL,
- NULL,
- PHP_MINFO(ovrimos),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-DLEXPORT zend_module_entry *get_module()
-{
- return &ovrimos_module_entry;
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/ovrimos/php_ovrimos.h b/ext/ovrimos/php_ovrimos.h
deleted file mode 100644
index b3e1336046..0000000000
--- a/ext/ovrimos/php_ovrimos.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef PHP_OVRIMOS_H
-#define PHP_OVRIMOS_H
-
-#if HAVE_LIBSQLCLI
-
-#if PHP_API_VERSION < 19990421
-#define zend_module_entry zend_module_entry
-#include "zend_modules.h"
-#include "internal_functions.h"
-#endif
-
-extern zend_module_entry ovrimos_module_entry;
-#define ovrimos_module_ptr &ovrimos_module_entry
-
-PHP_FUNCTION(ovrimos_connect);
-PHP_FUNCTION(ovrimos_close);
-PHP_FUNCTION(ovrimos_longreadlen);
-PHP_FUNCTION(ovrimos_prepare);
-PHP_FUNCTION(ovrimos_execute);
-PHP_FUNCTION(ovrimos_cursor);
-PHP_FUNCTION(ovrimos_exec);
-PHP_FUNCTION(ovrimos_fetch_into);
-PHP_FUNCTION(ovrimos_fetch_row);
-PHP_FUNCTION(ovrimos_result);
-PHP_FUNCTION(ovrimos_result_all);
-PHP_FUNCTION(ovrimos_free_result);
-PHP_FUNCTION(ovrimos_num_rows);
-PHP_FUNCTION(ovrimos_num_fields);
-PHP_FUNCTION(ovrimos_field_name);
-PHP_FUNCTION(ovrimos_field_type);
-PHP_FUNCTION(ovrimos_field_len);
-PHP_FUNCTION(ovrimos_field_num);
-/*PHP_FUNCTION(ovrimos_autocommit);*/
-PHP_FUNCTION(ovrimos_commit);
-PHP_FUNCTION(ovrimos_rollback);
-/*PHP_FUNCTION(ovrimos_setoption);*/
-
-#else
-#define ovrimos_module_ptr NULL
-#endif
-
-#define phpext_ovrimos_ptr ovrimos_module_ptr
-
-#endif
diff --git a/ext/pcntl/CREDITS b/ext/pcntl/CREDITS
deleted file mode 100644
index 1d629d7adf..0000000000
--- a/ext/pcntl/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-pcntl
-Jason Greene
diff --git a/ext/pcntl/EXPERIMENTAL b/ext/pcntl/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/pcntl/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/pcntl/README b/ext/pcntl/README
deleted file mode 100644
index cadd11121c..0000000000
--- a/ext/pcntl/README
+++ /dev/null
@@ -1,16 +0,0 @@
-Process Control Module for PHP (pcntl)
-
-This module will attempt to implement all features related to process spawning and
-control (fork(), waitpid(), signal(), WIF's, etc). This is extremly experimental,
-with hope to become stable on most UNIX's. I greatly apreciate any feedback, fixes,
-and or suggestions on how to improve/better implement
-this functionality.
-
-Thanks,
-
-Jason Greeme < jason@inetgurus.net / jason@php.net >
-
-
-
-
-
diff --git a/ext/pcntl/config.m4 b/ext/pcntl/config.m4
deleted file mode 100644
index 84cac889c2..0000000000
--- a/ext/pcntl/config.m4
+++ /dev/null
@@ -1,19 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-dnl Process Control (pcntl) extentsion --EXPERIMENTAL--
-dnl TODO - Add platform checks
-
-PHP_ARG_ENABLE(pcntl, whether to enable pcntl support,
-[ --enable-pcntl Enable experimental pcntl support (CLI/CGI only)])
-
-if test "$PHP_PCNTL" != "no"; then
-
- AC_CHECK_FUNCS(fork, [ AC_DEFINE(HAVE_FORK,1,[ ]) ], [ AC_MSG_ERROR(pcntl: fork() not supported by this platform) ])
- AC_CHECK_FUNCS(waitpid, [ AC_DEFINE(HAVE_WAITPID,1,[ ]) ], [ AC_MSG_ERROR(pcntl: fork() not supported by this platform) ])
- AC_CHECK_FUNCS(sigaction, [ AC_DEFINE(HAVE_SIGACTION,1,[ ]) ], [ AC_MSG_ERROR(pcntl: sigaction() not supported by this platform) ])
- AC_CHECK_FUNCS(getpriority setpriority)
-
- PHP_NEW_EXTENSION(pcntl, pcntl.c php_signal.c, $ext_shared, cli)
-fi
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
deleted file mode 100755
index bc639c15b7..0000000000
--- a/ext/pcntl/pcntl.c
+++ /dev/null
@@ -1,656 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jason Greene <jason@inetgurus.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#define PCNTL_DEBUG 0
-
-#if PCNTL_DEBUG
-#define DEBUG_OUT printf("DEBUG: ");printf
-#define IF_DEBUG(z) z
-#else
-#define IF_DEBUG(z)
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_pcntl.h"
-
-#if HAVE_GETPRIORITY || HAVE_SETPRIORITY
-#include <sys/time.h>
-#include <sys/resource.h>
-#endif
-
-ZEND_DECLARE_MODULE_GLOBALS(pcntl)
-
-function_entry pcntl_functions[] = {
- PHP_FE(pcntl_fork, NULL)
- PHP_FE(pcntl_waitpid, second_arg_force_ref)
- PHP_FE(pcntl_signal, NULL)
- PHP_FE(pcntl_wifexited, NULL)
- PHP_FE(pcntl_wifstopped, NULL)
- PHP_FE(pcntl_wifsignaled, NULL)
- PHP_FE(pcntl_wexitstatus, NULL)
- PHP_FE(pcntl_wtermsig, NULL)
- PHP_FE(pcntl_wstopsig, NULL)
- PHP_FE(pcntl_exec, NULL)
- PHP_FE(pcntl_alarm, NULL)
- PHP_FE(pcntl_getpriority, NULL)
- PHP_FE(pcntl_setpriority, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry pcntl_module_entry = {
- STANDARD_MODULE_HEADER,
- "pcntl",
- pcntl_functions,
- PHP_MINIT(pcntl),
- PHP_MSHUTDOWN(pcntl),
- PHP_RINIT(pcntl),
- PHP_RSHUTDOWN(pcntl),
- PHP_MINFO(pcntl),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_PCNTL
-ZEND_GET_MODULE(pcntl)
-#endif
-
-void php_register_signal_constants(INIT_FUNC_ARGS)
-{
-
- /* Wait Constants */
-#ifdef WNOHANG
- REGISTER_LONG_CONSTANT("WNOHANG", (long) WNOHANG, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef WUNTRACED
- REGISTER_LONG_CONSTANT("WUNTRACED", (long) WUNTRACED, CONST_CS | CONST_PERSISTENT);
-#endif
-
- /* Signal Constants */
- REGISTER_LONG_CONSTANT("SIG_IGN", (long) SIG_IGN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIG_DFL", (long) SIG_DFL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIG_ERR", (long) SIG_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGHUP", (long) SIGHUP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGINT", (long) SIGINT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGQUIT", (long) SIGQUIT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGILL", (long) SIGILL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGTRAP", (long) SIGTRAP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGABRT", (long) SIGABRT, CONST_CS | CONST_PERSISTENT);
-#ifdef SIGIOT
- REGISTER_LONG_CONSTANT("SIGIOT", (long) SIGIOT, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_LONG_CONSTANT("SIGBUS", (long) SIGBUS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGFPE", (long) SIGFPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGKILL", (long) SIGKILL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGUSR1", (long) SIGUSR1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGSEGV", (long) SIGSEGV, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGUSR2", (long) SIGUSR2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGPIPE", (long) SIGPIPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGALRM", (long) SIGALRM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGTERM", (long) SIGTERM, CONST_CS | CONST_PERSISTENT);
-#ifdef SIGSTKFLT
- REGISTER_LONG_CONSTANT("SIGSTKFLT",(long) SIGSTKFLT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef SIGCLD
- REGISTER_LONG_CONSTANT("SIGCLD", (long) SIGCLD, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef SIGCHLD
- REGISTER_LONG_CONSTANT("SIGCHLD", (long) SIGCHLD, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_LONG_CONSTANT("SIGCONT", (long) SIGCONT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGSTOP", (long) SIGSTOP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGTSTP", (long) SIGTSTP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGTTIN", (long) SIGTTIN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGTTOU", (long) SIGTTOU, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGURG", (long) SIGURG , CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGXCPU", (long) SIGXCPU, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGXFSZ", (long) SIGXFSZ, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGVTALRM",(long) SIGVTALRM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGPROF", (long) SIGPROF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGWINCH", (long) SIGWINCH, CONST_CS | CONST_PERSISTENT);
-#ifdef SIGPOLL
- REGISTER_LONG_CONSTANT("SIGPOLL", (long) SIGPOLL, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_LONG_CONSTANT("SIGIO", (long) SIGIO, CONST_CS | CONST_PERSISTENT);
-#ifdef SIGPWR
- REGISTER_LONG_CONSTANT("SIGPWR", (long) SIGPWR, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_LONG_CONSTANT("SIGSYS", (long) SIGSYS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGBABY", (long) SIGSYS, CONST_CS | CONST_PERSISTENT);
-
-#if HAVE_GETPRIORITY || HAVE_SETPRIORITY
- REGISTER_LONG_CONSTANT("PRIO_PGRP", PRIO_PGRP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PRIO_USER", PRIO_USER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PRIO_PROCESS", PRIO_PROCESS, CONST_CS | CONST_PERSISTENT);
-#endif
-}
-
-static void php_pcntl_init_globals(zend_pcntl_globals *pcntl_globals)
-{
- /* Just in case ... */
- memset(&pcntl_globals->php_signal_queue,0,sizeof(pcntl_globals->php_signal_queue));
-
- zend_llist_init(&pcntl_globals->php_signal_queue, sizeof (long), NULL, 1);
- pcntl_globals->signal_queue_ready = 0;
- pcntl_globals->processing_signal_queue = 0;
-}
-
-PHP_RINIT_FUNCTION(pcntl)
-{
- zend_hash_init(&PCNTL_G(php_signal_table), 16, NULL, ZVAL_PTR_DTOR, 1);
- return SUCCESS;
-}
-
-PHP_MINIT_FUNCTION(pcntl)
-{
- php_register_signal_constants(INIT_FUNC_ARGS_PASSTHRU);
- ZEND_INIT_MODULE_GLOBALS(pcntl, php_pcntl_init_globals, NULL);
- php_add_tick_function(pcntl_tick_handler);
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(pcntl)
-{
- zend_llist_destroy(&PCNTL_G(php_signal_queue));
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(pcntl)
-{
- zend_hash_destroy(&PCNTL_G(php_signal_table));
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(pcntl)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "pcntl support", "enabled");
- php_info_print_table_end();
-}
-
-/* {{{ proto int pcntl_fork(void)
- Forks the currently running process following the same behavior as the UNIX fork() system call*/
-PHP_FUNCTION(pcntl_fork)
-{
- pid_t id;
-
- id = fork();
- if (id == -1) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error %d", errno);
- }
-
- RETURN_LONG((long) id);
-}
-/* }}} */
-
-/* {{{ proto int pcntl_alarm(int seconds)
- Set an alarm clock for delivery of a signal*/
-PHP_FUNCTION(pcntl_alarm)
-{
- long seconds;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE)
- return;
-
- RETURN_LONG ((long) alarm(seconds));
-}
-/* }}} */
-
-/* {{{ proto int pcntl_waitpid(long pid, long status, long options)
- Waits on or returns the status of a forked child as defined by the waitpid() system call */
-PHP_FUNCTION(pcntl_waitpid)
-{
- long pid, options = 0;
- zval *z_status = NULL;
- int status;
- pid_t child_id;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|l", &pid, &z_status, &options) == FAILURE)
- return;
-
- convert_to_long_ex(&z_status);
-
- status = Z_LVAL_P(z_status);
-
- child_id = waitpid((pid_t) pid, &status, options);
-
- Z_LVAL_P(z_status) = status;
-
- RETURN_LONG((long) child_id);
-}
-/* }}} */
-
-/* {{{ proto bool pcntl_wifexited(long status)
- Returns true if the child status code represents a successful exit */
-PHP_FUNCTION(pcntl_wifexited)
-{
-#ifdef WIFEXITED
- zval **status;
- int status_word;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- status_word = (int) Z_LVAL_PP(status);
-
- if (WIFEXITED(status_word)) RETURN_TRUE;
-#endif
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool pcntl_wifstopped(long status)
- Returns true if the child status code represents a stopped process (WUNTRACED must have been used with waitpid) */
-PHP_FUNCTION(pcntl_wifstopped)
-{
-#ifdef WIFSTOPPED
- zval **status;
- int status_word;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- status_word = (int) Z_LVAL_PP(status);
-
- if (WIFSTOPPED(status_word)) RETURN_TRUE;
-#endif
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool pcntl_wifsignaled(long status)
- Returns true if the child status code represents a process that was terminated due to a signal */
-PHP_FUNCTION(pcntl_wifsignaled)
-{
-#ifdef WIFSIGNALED
- zval **status;
- int status_word;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- status_word = (int) Z_LVAL_PP(status);
-
- if (WIFSIGNALED(status_word)) RETURN_TRUE;
-#endif
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int pcntl_wexitstatus(long status)
- Returns the status code of a child's exit */
-PHP_FUNCTION(pcntl_wexitstatus)
-{
-#ifdef WEXITSTATUS
- zval **status;
- int status_word;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- status_word = (int) Z_LVAL_PP(status);
-
- /* WEXITSTATUS only returns 8 bits so we *MUST* cast this to signed char
- if you want to have valid negative exit codes */
- RETURN_LONG((signed char) WEXITSTATUS(status_word));
-#else
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto int pcntl_wtermsig(long status)
- Returns the number of the signal that terminated the process who's status code is passed */
-PHP_FUNCTION(pcntl_wtermsig)
-{
-#ifdef WTERMSIG
- zval **status;
- int status_word;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- status_word = (int) Z_LVAL_PP(status);
-
- RETURN_LONG(WTERMSIG(status_word));
-#else
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto int pcntl_wstopsig(long status)
- Returns the number of the signal that caused the process to stop who's status code is passed */
-PHP_FUNCTION(pcntl_wstopsig)
-{
-#ifdef WSTOPSIG
- zval **status;
- int status_word;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- status_word = (int) Z_LVAL_PP(status);
-
- RETURN_LONG(WSTOPSIG(status_word));
-#else
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto bool pcntl_exec(string path [, array args [, array envs]])
- Executes specified program in current process space as defined by exec(2) */
-PHP_FUNCTION(pcntl_exec)
-{
- zval *args, *envs;
- zval **element;
- HashTable *args_hash, *envs_hash;
- int argc = 0, argi = 0;
- int envc = 0, envi = 0;
- int return_val = 0;
- char **argv = NULL, **envp = NULL;
- char **current_arg, **pair;
- int pair_length;
- char *key;
- int key_length;
- char *path;
- int path_len;
- long key_num;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|aa", &path, &path_len, &args, &envs) == FAILURE) {
- return;
- }
-
- if (ZEND_NUM_ARGS() > 1) {
- /* Build argumnent list */
- args_hash = HASH_OF(args);
- argc = zend_hash_num_elements(args_hash);
-
- argv = alloca((argc+2) * sizeof(char *));
- *argv = path;
- for ( zend_hash_internal_pointer_reset(args_hash), current_arg = argv+1;
- (argi < argc && (zend_hash_get_current_data(args_hash, (void **) &element) == SUCCESS));
- (argi++, current_arg++, zend_hash_move_forward(args_hash)) ) {
-
- convert_to_string_ex(element);
- *current_arg = Z_STRVAL_PP(element);
- }
- *(current_arg) = NULL;
- } else {
- argv = alloca(2 * sizeof(char *));
- *argv = path;
- *(argv+1) = NULL;
- }
-
- if ( ZEND_NUM_ARGS() == 3 ) {
- /* Build environment pair list */
- envs_hash = HASH_OF(envs);
- envc = zend_hash_num_elements(envs_hash);
-
- envp = alloca((envc+1) * sizeof(char *));
- for ( zend_hash_internal_pointer_reset(envs_hash), pair = envp;
- (envi < envc && (zend_hash_get_current_data(envs_hash, (void **) &element) == SUCCESS));
- (envi++, pair++, zend_hash_move_forward(envs_hash)) ) {
- switch (return_val = zend_hash_get_current_key_ex(envs_hash, &key, &key_length, &key_num, 0, NULL)) {
- case HASH_KEY_IS_LONG:
- key = alloca(101);
- snprintf(key, 100, "%ld", key_num);
- key_length = strlen(key);
- break;
- case HASH_KEY_NON_EXISTANT:
- pair--;
- continue;
- }
-
- convert_to_string_ex(element);
-
- /* Length of element + equal sign + length of key + null */
- pair_length = Z_STRLEN_PP(element) + key_length + 2;
- *pair = emalloc(pair_length);
- strlcpy(*pair, key, key_length);
- strlcat(*pair, "=", pair_length);
- strlcat(*pair, Z_STRVAL_PP(element), pair_length);
-
- /* Cleanup */
- if (return_val == HASH_KEY_IS_LONG) free_alloca(key);
- }
- *(pair) = NULL;
- }
-
- if (execve(path, argv, envp) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occured: (errno %d) %s", errno, strerror(errno));
- }
-
- /* Cleanup */
- if (envp != NULL) {
- for (pair = envp; *pair != NULL; pair++) efree(*pair);
- free_alloca(envp);
- }
-
- free_alloca(argv);
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool pcntl_signal(long signo, mixed handle, [bool restart_syscalls])
- Assigns a system signal handler to a PHP function */
-PHP_FUNCTION(pcntl_signal)
-{
- zval *handle, **dest_handle = NULL;
- char *func_name;
- long signo;
- zend_bool restart_syscalls = 1;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|b", &signo, &handle, &restart_syscalls) == FAILURE) {
- return;
- }
-
- /* Special long value case for SIG_DFL and SIG_IGN */
- if (Z_TYPE_P(handle)==IS_LONG) {
- if (Z_LVAL_P(handle)!= (long) SIG_DFL && Z_LVAL_P(handle) != (long) SIG_IGN) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for handle argument specifEied");
- }
- if (php_signal(signo, (Sigfunc *) Z_LVAL_P(handle), (int) restart_syscalls) == SIG_ERR) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error assigning singal");
- RETURN_FALSE;
- }
- RETURN_TRUE;
- }
-
- if (!zend_is_callable(handle, 0, &func_name)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a callable function name error", func_name);
- efree(func_name);
- RETURN_FALSE;
- }
- efree(func_name);
-
- /* Add the function name to our signal table */
- zend_hash_index_update(&PCNTL_G(php_signal_table), signo, (void **) &handle, sizeof(zval *), (void **) &dest_handle);
- if (dest_handle) zval_add_ref(dest_handle);
-
- if (php_signal(signo, pcntl_signal_handler, (int) restart_syscalls) == SIG_ERR) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error assigning singal");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-#ifdef HAVE_GETPRIORITY
-/* {{{ proto int pcntl_getpriority(int pid, [int process_identifier]])
- Get the priority of any process */
-PHP_FUNCTION(pcntl_getpriority)
-{
- long who = PRIO_PROCESS;
- long pid = getpid();
- int pri;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &pid, &who) == FAILURE) {
- RETURN_FALSE;
- }
-
- /* needs to be cleared, since any returned value is valid */
- errno = 0;
-
- pri = getpriority(who, pid);
-
- if (errno) {
- switch (errno) {
- case ESRCH:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%l: No process was located using the given parameters.", errno);
- break;
- case EINVAL:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%l: Invalid identifier flag.", errno);
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error %l has occured.", errno);
- break;
- }
- RETURN_FALSE;
- }
-
- RETURN_LONG(pri);
-}
-/* }}} */
-#endif
-
-#ifdef HAVE_SETPRIORITY
-/* {{{ proto bool pcntl_setpriority(int priority, [int pid, [int process_identifier]])
- Change the priority of any process */
-PHP_FUNCTION(pcntl_setpriority)
-{
- long who = PRIO_PROCESS;
- long pid = getpid();
- long pri;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ll", &pri, &pid, &who) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (setpriority(who, pid, pri)) {
- switch (errno) {
- case ESRCH:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%l: No process was located using the given parameters.", errno);
- break;
- case EINVAL:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%l: Invalid identifier flag.", errno);
- break;
- case EPERM:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%l: A process was located, but neither its effective nor real user ID matched the effective user ID of the caller.", errno);
- break;
- case EACCES:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%l: Only a super user may attempt to increase the process priority.", errno);
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error %l has occured.", errno);
- break;
- }
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-/* Our custom signal handler that calls the appropriate php_function */
-static void pcntl_signal_handler(int signo)
-{
- long signal_num = signo;
- TSRMLS_FETCH();
-
- IF_DEBUG(DEBUG_OUT("Caught signo %d\n", signo));
- if (! PCNTL_G(processing_signal_queue)) {
- zend_llist_add_element(&PCNTL_G(php_signal_queue), &signal_num);
- PCNTL_G(signal_queue_ready) = 1;
- IF_DEBUG(DEBUG_OUT("Added queue entry\n"));
- }
- return;
-}
-
-void pcntl_tick_handler()
-{
- zend_llist_element *element;
- zval *param, **handle, *retval;
- TSRMLS_FETCH();
-
- /* Bail if the queue is empty or if we are already playing the queue*/
- if (! PCNTL_G(signal_queue_ready) || PCNTL_G(processing_signal_queue))
- return;
-
- /* Mark our queue empty */
- PCNTL_G(signal_queue_ready) = 0;
-
- /* If for some reason our signal queue is empty then return */
- if (zend_llist_count(&PCNTL_G(php_signal_queue)) <= 0) {
- return;
- }
-
- /* Prevent reentrant handler calls */
- PCNTL_G(processing_signal_queue) = 1;
-
- /* Allocate */
- MAKE_STD_ZVAL(param);
- MAKE_STD_ZVAL(retval);
-
- /* Traverse through our signal queue and call the appropriate php functions */
- for (element = (&PCNTL_G(php_signal_queue))->head; element; element = element->next) {
- long *signal_num = (long *)&element->data;
- if (zend_hash_index_find(&PCNTL_G(php_signal_table), *signal_num, (void **) &handle)==FAILURE) {
- continue;
- }
-
- ZVAL_LONG(param, *signal_num);
-
- /* Call php singal handler - Note that we do not report errors, and we ignore the eturn value */
- call_user_function(EG(function_table), NULL, *handle, retval, 1, &param TSRMLS_CC);
- }
- /* Clear */
- zend_llist_clean(&PCNTL_G(php_signal_queue));
-
- /* Re-enable queue */
- PCNTL_G(processing_signal_queue) = 0;
-
- /* Clean up */
- efree(param);
- efree(retval);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h
deleted file mode 100644
index ccca57813f..0000000000
--- a/ext/pcntl/php_pcntl.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jason Greene <jason@inetgurus.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_PCNTL_H
-#define PHP_PCNTL_H
-
-#include <sys/wait.h>
-#include "php_signal.h"
-#include "php_ticks.h"
-extern zend_module_entry pcntl_module_entry;
-#define phpext_pcntl_ptr &pcntl_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_PCNTL_API __declspec(dllexport)
-#else
-#define PHP_PCNTL_API
-#endif
-
-PHP_MINIT_FUNCTION(pcntl);
-PHP_MSHUTDOWN_FUNCTION(pcntl);
-PHP_RINIT_FUNCTION(pcntl);
-PHP_RSHUTDOWN_FUNCTION(pcntl);
-PHP_MINFO_FUNCTION(pcntl);
-
-PHP_FUNCTION(pcntl_alarm);
-PHP_FUNCTION(pcntl_fork);
-PHP_FUNCTION(pcntl_waitpid);
-PHP_FUNCTION(pcntl_wifexited);
-PHP_FUNCTION(pcntl_wifstopped);
-PHP_FUNCTION(pcntl_wifsignaled);
-PHP_FUNCTION(pcntl_wexitstatus);
-PHP_FUNCTION(pcntl_wtermsig);
-PHP_FUNCTION(pcntl_wstopsig);
-PHP_FUNCTION(pcntl_signal);
-PHP_FUNCTION(pcntl_exec);
-PHP_FUNCTION(pcntl_getpriority);
-PHP_FUNCTION(pcntl_setpriority);
-
-static void pcntl_signal_handler(int);
-static void pcntl_tick_handler();
-
-
-ZEND_BEGIN_MODULE_GLOBALS(pcntl)
- HashTable php_signal_table;
- zend_llist php_signal_queue;
- int signal_queue_ready;
- int processing_signal_queue;
-ZEND_END_MODULE_GLOBALS(pcntl)
-#ifdef ZTS
-#define PCNTL_G(v) TSRMG(pcntl_globals_id, zend_pcntl_globals *, v)
-#else
-#define PCNTL_G(v) (pcntl_globals.v)
-#endif
-
-#endif /* PHP_PCNTL_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c
deleted file mode 100644
index 9e26ae7da3..0000000000
--- a/ext/pcntl/php_signal.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jason Greene <jason@inetgurus.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php_signal.h"
-
-/* php_signal using sigaction is derrived from Advanced Programing
- * in the Unix Environment by W. Richard Stevens p 298. */
-Sigfunc *php_signal(int signo, Sigfunc *func, int restart)
-{
-
- struct sigaction act,oact;
- act.sa_handler = func;
- sigemptyset(&act.sa_mask);
- act.sa_flags = 0;
- if (signo == SIGALRM || (! restart)) {
-#ifdef SA_INTERRUPT
- act.sa_flags |= SA_INTERRUPT; /* SunOS */
-#endif
- } else {
-#ifdef SA_RESTART
- act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */
-#endif
- }
- if (sigaction(signo, &act, &oact) < 0)
- return SIG_ERR;
-
- return oact.sa_handler;
-}
-
diff --git a/ext/pcntl/php_signal.h b/ext/pcntl/php_signal.h
deleted file mode 100644
index 12d4ddc943..0000000000
--- a/ext/pcntl/php_signal.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jason Greene <jason@inetgurus.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <signal.h>
-#ifndef PHP_SIGNAL_H
-#define PHP_SIGNAL_H
-
-typedef void Sigfunc(int);
-Sigfunc *php_signal(int signo, Sigfunc *func, int restart);
-
-#endif
diff --git a/ext/pcntl/test-pcntl.php b/ext/pcntl/test-pcntl.php
deleted file mode 100755
index 6b3ee5649e..0000000000
--- a/ext/pcntl/test-pcntl.php
+++ /dev/null
@@ -1,39 +0,0 @@
-#!../../php -q
-<?
-
-declare(ticks=1);
-
-function alarm_handle($signal){
- if ($signal==SIGALRM) print "Caught SIGALRM!!!\n";
-}
-
-function usr1_handle($signal){
- if ($signal==SIGUSR1) print "Caught SIGUSR1!!!\n";
-}
-
-print "This test will demonstrate a fork followed by ipc via signals.\n";
-
-$pid=pcntl_fork();
-if ($pid==0) {
- pcntl_signal(SIGUSR1, "usr1_handle");
- pcntl_signal(SIGALRM, "alarm_handle");
- print "Child: Waiting for alarm.....\n";
- sleep(100);
- print "Child: Waiting for usr1......\n";
- sleep(100);
- print "Child: Resetting Alarm handler to Ignore....\n";
- pcntl_signal(SIGALRM, SIG_IGN);
- sleep(10);
- print "Done\n";
-} else {
- print "Parent: Waiting 10 seconds....\n";
- sleep(10);
- print "Parent: Sending SIGALRM to Child\n";
- posix_kill($pid,SIGALRM);
- sleep(1);
- print "Parent: Senging SIGUSR1 to Child\n";
- posix_kill($pid,SIGUSR1);
- sleep(1);
- print "Parent: Sending SIGALRM to Child\n";
- pcntl_waitpid($pid, &$status, $options);
-}
diff --git a/ext/pcntl/tests/001.phpt b/ext/pcntl/tests/001.phpt
deleted file mode 100644
index 27aff8bbe4..0000000000
--- a/ext/pcntl/tests/001.phpt
+++ /dev/null
@@ -1,84 +0,0 @@
---TEST--
-Test pcntl wait functionality
---SKIPIF--
-<?php
- if (!extension_loaded("pcntl")) print "skip";
- if (!function_exists("posix_kill")) print "skip posix_kill() not avaliable";
-?>
---POST--
---GET--
---FILE--
-<?php
-function test_exit_waits(){
- print "\n\nTesting pcntl_wifexited and wexitstatus....";
-
- $pid=pcntl_fork();
- if ($pid==0) {
- sleep(1);
- exit(-1);
- } else {
- $options=0;
- pcntl_waitpid($pid, $status, $options);
- if ( pcntl_wifexited($status) ) print "\nExited With: ". pcntl_wexitstatus($status);
- }
-}
-
-function test_exit_signal(){
- print "\n\nTesting pcntl_wifsignaled....";
-
- $pid=pcntl_fork();
-
- if ($pid==0) {
- sleep(10);
- exit;
- } else {
- $options=0;
- posix_kill($pid, SIGTERM);
- pcntl_waitpid($pid, $status, $options);
- if ( pcntl_wifsignaled($status) ) {
- $signal_print=pcntl_wtermsig($status);
- if ($signal_print==SIGTERM) $signal_print="SIGTERM";
- print "\nProcess was terminated by signal : ". $signal_print;
- }
-
- }
-}
-
-
-function test_stop_signal(){
- print "\n\nTesting pcntl_wifstopped and pcntl_wstopsig....";
-
- $pid=pcntl_fork();
-
- if ($pid==0) {
- sleep(1);
- exit;
- } else {
- $options=WUNTRACED;
- posix_kill($pid, SIGSTOP);
- pcntl_waitpid($pid, $status, $options);
- if ( pcntl_wifstopped($status) ) {
- $signal_print=pcntl_wstopsig($status);
- if ($signal_print==SIGSTOP) $signal_print="SIGSTOP";
- print "\nProcess was stoped by signal : ". $signal_print;
- }
- posix_kill($pid, SIGCONT);
- }
-}
-
-print "Staring wait.h tests....";
-test_exit_waits();
-test_exit_signal();
-test_stop_signal();
-?>
---EXPECT--
-Staring wait.h tests....
-
-Testing pcntl_wifexited and wexitstatus....
-Exited With: -1
-
-Testing pcntl_wifsignaled....
-Process was terminated by signal : SIGTERM
-
-Testing pcntl_wifstopped and pcntl_wstopsig....
-Process was stoped by signal : SIGSTOP
diff --git a/ext/pcre/CREDITS b/ext/pcre/CREDITS
deleted file mode 100644
index ae0fba35d4..0000000000
--- a/ext/pcre/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Perl Compatible Regexps
-Andrei Zmievski
diff --git a/ext/pcre/config.m4 b/ext/pcre/config.m4
deleted file mode 100644
index 9e81ad2814..0000000000
--- a/ext/pcre/config.m4
+++ /dev/null
@@ -1,56 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-dnl By default we'll compile and link against the bundled PCRE library
-dnl if DIR is supplied, we'll use that for linking
-
-PHP_ARG_WITH(pcre-regex,for PCRE support,
-[ --without-pcre-regex Do not include Perl Compatible Regular Expressions
- support. Use --with-pcre-regex=DIR to specify DIR
- where PCRE's include and library files are located,
- if not using bundled library.],yes)
-
-if test "$PHP_PCRE_REGEX" != "no"; then
- if test "$PHP_PCRE_REGEX" = "yes"; then
- PHP_NEW_EXTENSION(pcre, pcrelib/maketables.c pcrelib/get.c pcrelib/study.c pcrelib/pcre.c php_pcre.c, $ext_shared,,-DSUPPORT_UTF8 -DLINK_SIZE=2 -I@ext_srcdir@/pcrelib)
- PHP_ADD_BUILD_DIR($ext_builddir/pcrelib)
- AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
- else
- for i in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/include $PHP_PCRE_REGEX/include/pcre; do
- test -f $i/pcre.h && PCRE_INCDIR=$i
- done
-
- if test -z "$PCRE_INCDIR"; then
- AC_MSG_ERROR([Could not find pcre.h in $PHP_PCRE_REGEX])
- fi
-
- for j in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/lib; do
- test -f $j/libpcre.a -o -f $j/libpcre.$SHLIB_SUFFIX_NAME && PCRE_LIBDIR=$j
- done
-
- if test -z "$PCRE_LIBDIR" ; then
- AC_MSG_ERROR([Could not find libpcre.(a|$SHLIB_SUFFIX_NAME) in $PHP_PCRE_REGEX])
- fi
-
- changequote({,})
- pcre_major=`grep PCRE_MAJOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
- pcre_minor=`grep PCRE_MINOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
- changequote([,])
- pcre_minor_length=`echo "$pcre_minor" | wc -c | sed -e 's/[^0-9]//g'`
- if test "$pcre_minor_length" -eq 2 ; then
- pcre_minor="$pcre_minor"0
- fi
- pcre_version=$pcre_major$pcre_minor
- if test "$pcre_version" -lt 208; then
- AC_MSG_ERROR([The PCRE extension requires PCRE library version >= 2.08])
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR, PCRE_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_PCRE, 1, [ ])
- PHP_ADD_INCLUDE($PCRE_INCDIR)
- PHP_NEW_EXTENSION(pcre, php_pcre.c, $ext_shared,,-DSUPPORT_UTF8 -DLINK_SIZE=2)
- fi
- PHP_SUBST(PCRE_SHARED_LIBADD)
-fi
diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4
deleted file mode 100644
index 9e81ad2814..0000000000
--- a/ext/pcre/config0.m4
+++ /dev/null
@@ -1,56 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-dnl By default we'll compile and link against the bundled PCRE library
-dnl if DIR is supplied, we'll use that for linking
-
-PHP_ARG_WITH(pcre-regex,for PCRE support,
-[ --without-pcre-regex Do not include Perl Compatible Regular Expressions
- support. Use --with-pcre-regex=DIR to specify DIR
- where PCRE's include and library files are located,
- if not using bundled library.],yes)
-
-if test "$PHP_PCRE_REGEX" != "no"; then
- if test "$PHP_PCRE_REGEX" = "yes"; then
- PHP_NEW_EXTENSION(pcre, pcrelib/maketables.c pcrelib/get.c pcrelib/study.c pcrelib/pcre.c php_pcre.c, $ext_shared,,-DSUPPORT_UTF8 -DLINK_SIZE=2 -I@ext_srcdir@/pcrelib)
- PHP_ADD_BUILD_DIR($ext_builddir/pcrelib)
- AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
- else
- for i in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/include $PHP_PCRE_REGEX/include/pcre; do
- test -f $i/pcre.h && PCRE_INCDIR=$i
- done
-
- if test -z "$PCRE_INCDIR"; then
- AC_MSG_ERROR([Could not find pcre.h in $PHP_PCRE_REGEX])
- fi
-
- for j in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/lib; do
- test -f $j/libpcre.a -o -f $j/libpcre.$SHLIB_SUFFIX_NAME && PCRE_LIBDIR=$j
- done
-
- if test -z "$PCRE_LIBDIR" ; then
- AC_MSG_ERROR([Could not find libpcre.(a|$SHLIB_SUFFIX_NAME) in $PHP_PCRE_REGEX])
- fi
-
- changequote({,})
- pcre_major=`grep PCRE_MAJOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
- pcre_minor=`grep PCRE_MINOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
- changequote([,])
- pcre_minor_length=`echo "$pcre_minor" | wc -c | sed -e 's/[^0-9]//g'`
- if test "$pcre_minor_length" -eq 2 ; then
- pcre_minor="$pcre_minor"0
- fi
- pcre_version=$pcre_major$pcre_minor
- if test "$pcre_version" -lt 208; then
- AC_MSG_ERROR([The PCRE extension requires PCRE library version >= 2.08])
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR, PCRE_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_PCRE, 1, [ ])
- PHP_ADD_INCLUDE($PCRE_INCDIR)
- PHP_NEW_EXTENSION(pcre, php_pcre.c, $ext_shared,,-DSUPPORT_UTF8 -DLINK_SIZE=2)
- fi
- PHP_SUBST(PCRE_SHARED_LIBADD)
-fi
diff --git a/ext/pcre/pcrelib/AUTHORS b/ext/pcre/pcrelib/AUTHORS
deleted file mode 100644
index 832dddca45..0000000000
--- a/ext/pcre/pcrelib/AUTHORS
+++ /dev/null
@@ -1,6 +0,0 @@
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
-University of Cambridge Computing Service,
-Cambridge, England. Phone: +44 1223 334714.
-
-Copyright (c) 1997-2001 University of Cambridge
diff --git a/ext/pcre/pcrelib/COPYING b/ext/pcre/pcrelib/COPYING
deleted file mode 100644
index 8effa66492..0000000000
--- a/ext/pcre/pcrelib/COPYING
+++ /dev/null
@@ -1,50 +0,0 @@
-PCRE LICENCE
-------------
-
-PCRE is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
-University of Cambridge Computing Service,
-Cambridge, England. Phone: +44 1223 334714.
-
-Copyright (c) 1997-2001 University of Cambridge
-
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. In practice, this means that if you use
- PCRE in software which you distribute to others, commercially or
- otherwise, you must put a sentence like this
-
- Regular expression support is provided by the PCRE library package,
- which is open source software, written by Philip Hazel, and copyright
- by the University of Cambridge, England.
-
- somewhere reasonably visible in your documentation and in any relevant
- files or online help data or similar. A reference to the ftp site for
- the source, that is, to
-
- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
-
- should also be given in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), or Lesser General Purpose Licence (LGPL),
- then the terms of that licence shall supersede any condition above with
- which it is incompatible.
-
-The documentation for PCRE, supplied in the "doc" directory, is distributed
-under the same terms as the software itself.
-
-End
diff --git a/ext/pcre/pcrelib/ChangeLog b/ext/pcre/pcrelib/ChangeLog
deleted file mode 100644
index 708b82a74b..0000000000
--- a/ext/pcre/pcrelib/ChangeLog
+++ /dev/null
@@ -1,958 +0,0 @@
-ChangeLog for PCRE
-------------------
-
-Version 4.00 ....
------------------
-
-1. If a comment in an extended regex that started immediately after a meta-item
-extended to the end of string, PCRE compiled incorrect data. This could lead to
-all kinds of weird effects. Example: /#/ was bad; /()#/ was bad; /a#/ was not.
-
-2. Moved to autoconf 2.53 and libtool 1.4.2.
-
-3. Perl 5.8 no longer needs "use utf8" for doing UTF-8 things. Consequently,
-the special perltest8 script is no longer needed - all the tests can be run
-from a single perltest script.
-
-4. From 5.004, Perl has not included the VT character (0x0b) in the set defined
-by \s. It has now been removed in PCRE. This means it isn't recognized as
-whitespace in /x regexes too, which is the same as Perl. Note that the POSIX
-class [:space:] *does* include VT, thereby creating a mess.
-
-5. Added the class [:blank:] (a GNU extension from Perl 5.8) to match only
-space and tab.
-
-6. Perl 5.005 was a long time ago. It's time to amalgamate the tests that use
-its new features into the main test script, reducing the number of scripts.
-
-7. Perl 5.8 has changed the meaning of patterns like /a(?i)b/. Earlier
-versions were backward compatible, and made the (?i) apply to the whole
-pattern, as if /i were given. Now it behaves more logically, and applies the
-option setting only to what follows. PCRE has been changed to follow suit.
-However, if it finds options settings right at the start of the pattern, it
-extracts them into the global options, as before. Thus, they show up in the
-info data.
-
-8. Added support for the \Q...\E escape sequence. Characters in between are
-treated as literals. This is slightly different from Perl in that $ and @ are
-also handled as literals inside the quotes. In Perl, they will cause variable
-interpolation. Note the following examples:
-
- Pattern PCRE matches Perl matches
-
- \Qabc$xyz\E abc$xyz abc followed by the contents of $xyz
- \Qabc\$xyz\E abc\$xyz abc\$xyz
- \Qabc\E\$\Qxyz\E abc$xyz abc$xyz
-
-9. Re-organized 3 code statements in pcretest to avoid "overflow in
-floating-point constant arithmetic" warnings from a Microsoft compiler. Added a
-(size_t) cast to one statement in pcretest and one in pcreposix to avoid
-signed/unsigned warnings.
-
-10. SunOS4 doesn't have strtoul(). This was used only for unpicking the -o
-option for pcretest, so I've replaced it by a simple function that does just
-that job.
-
-11. pcregrep was ending with code 0 instead of 2 for the commands "pcregrep" or
-"pcregrep -".
-
-12. Added "possessive quantifiers" ?+, *+, ++, and {,}+ which come from Sun's
-Java package. This provides some syntactic sugar for simple cases of what my
-documentation calls "once-only subpatterns". A pattern such as x*+ is the
-same as (?>x*). In other words, if what is inside (?>...) is just a single
-repeated item, you can use this simplified notation. Note that only makes sense
-with greedy quantifiers. Consequently, the use of the possessive quantifier
-forces greediness, whatever the setting of the PCRE_UNGREEDY option.
-
-13. A change of greediness default within a pattern was not taking effect at
-the current level for patterns like /(b+(?U)a+)/. It did apply to parenthesized
-subpatterns that followed. Patterns like /b+(?U)a+/ worked because the option
-was abstracted outside.
-
-14. PCRE now supports the \G assertion. It is true when the current matching
-position is at the start point of the match. This differs from \A when the
-starting offset is non-zero. Used with the /g option of pcretest (or similar
-code), it works in the same way as it does for Perl's /g option.
-
-15. Some bugs concerning the handling of certain option changes within patterns
-have been fixed. These applied to options other than (?ims). For example,
-"a(?x: b c )d" did not match "XabcdY" but did match "Xa b c dY". It should have
-been the other way round. Some of this was related to change 7 above.
-
-16. PCRE now gives errors for /[.x.]/ and /[=x=]/ as unsupported POSIX
-features, as Perl does. Previously, PCRE gave the warnings only for /[[.x.]]/
-and /[[=x=]]/. PCRE now also gives an error for /[:name:]/ because it supports
-POSIX classes only within a class (e.g. /[[:alpha:]]/).
-
-17. Added support for Perl's \C escape. This matches one byte, even in UTF8
-mode. Unlike ".", it always matches newline, whatever the setting of
-PCRE_DOTALL. However, PCRE does not permit \C to appear in lookbehind
-assertions. (Perl allows it, but it doesn't (in general) work because it can't
-calculate the length of the lookbehind. At least, that's the case for Perl
-5.8.0)
-
-18. Added an error diagnosis for escapes that PCRE does not support: these are
-\L, \l, \N, \P, \p, \U, \u, and \X.
-
-19. Although correctly diagnosing a missing ']' in a character class, PCRE was
-reading past the end of the pattern in cases such as /[abcd/.
-
-20. PCRE was getting more memory than necessary for patterns with classes that
-contained both POSIX named classes and other characters, e.g. /[[:space:]abc/.
-
-21. Added some code, conditional on #ifdef VPCOMPAT, to make life easier for
-compiling PCRE for use with Virtual Pascal.
-
-22. Small fix to the Makefile to make it work properly if the build is done
-outside the source tree.
-
-23. Added a new extension: a condition to go with recursion. If a conditional
-subpattern starts with (?(R) the "true" branch is used if recursion has
-happened, whereas the "false" branch is used only at the top level.
-
-24. When there was a very long string of literal characters (over 255 bytes
-without UTF support, over 250 bytes with UTF support), the computation of how
-much memory was required could be incorrect, leading to segfaults or other
-strange effects.
-
-25. PCRE was incorrectly assuming anchoring (either to start of subject or to
-start of line for a non-DOTALL pattern) when a pattern started with (.*) and
-there was a subsequent back reference to those brackets. This meant that, for
-example, /(.*)\d+\1/ failed to match "abc123bc". Unfortunately, it isn't
-possible to check for precisely this case. All we can do is abandon the
-optimization if .* occurs inside capturing brackets when there are any back
-references whatsoever.
-
-26. The handling of the optimization for finding the first character of a
-non-anchored pattern, and for finding a character that is required later in the
-match were failing in some cases. This didn't break the matching; it just
-failed to optimize when it could. The way this is done has been re-implemented.
-
-27. Fixed typo in error message for invalid (?R item (it said "(?p").
-
-28. Added a new feature that provides some of the functionality that Perl
-provides with (?{...}). The facility is termed a "callout". The way it is done
-in PCRE is for the caller to provide an optional function, by setting
-pcre_callout to its entry point. Like pcre_malloc and pcre_free, this is a
-global variable. By default it is unset, which disables all calling out. To get
-the function called, the regex must include (?C) at appropriate points. This
-is, in fact, equivalent to (?C0), and any number <= 255 may be given with (?C).
-This provides a means of identifying different callout points. When PCRE
-reaches such a point in the regex, if pcre_callout has been set, the external
-function is called. It is provided with data in a structure called
-pcre_callout_block, which is defined in pcre.h. If the function returns 0,
-matching continues; if it returns a non-zero value, the match at the current
-point fails. However, backtracking will occur if possible.
-
-29. pcretest is upgraded to test the callout functionality. It provides a
-callout function that displays information. By default, it shows the start of
-the match and the current position in the text. There are some new data escapes
-to vary what happens:
-
- \C+ in addition, show current contents of captured substrings
- \C- do not supply a callout function
- \C!n return 1 when callout number n is reached
- \C!n!m return 1 when callout number n is reached for the mth time
-
-30. If pcregrep was called with the -l option and just a single file name, it
-output "<stdin>" if a match was found, instead of the file name.
-
-31. Improve the efficiency of the POSIX API to PCRE. If the number of capturing
-slots is less than POSIX_MALLOC_THRESHOLD, use a block on the stack to pass to
-pcre_exec(). This saves a malloc/free per call. The default value of
-POSIX_MALLOC_THRESHOLD is 5; it can be changed by --with-posix-malloc-threshold
-when configuring.
-
-32. The default maximum size of a compiled pattern is 64K. There have been a
-few cases of people hitting this limit. The code now uses macros to handle the
-storing of links as offsets within the compiled pattern. It defaults to 2-byte
-links, but this can be changed to 3 or 4 bytes by --with-link-size when
-configuring. Tests 2 and 5 work only with 2-byte links because they output
-debugging information about compiled patterns.
-
-33. Internal code re-arrangements:
-
- (a) Moved the debugging function for printing out a compiled regex into
- its own source file (printint.c) and used #include to pull it into
- pcretest.c and, when DEBUG is defined, into pcre.c, instead of having
- two separate copies.
-
- (b) Defined the list of op-code names for debugging as a macro in
- internal.h so that it is next to the definition of the opcodes.
-
- (c) Defined a table of op-code lengths for simpler skipping along compiled
- code. This is again a macro in internal.h so that it is next to the
- definition of the opcodes.
-
-34. Added support for recursive calls to individual subpatterns, along the
- lines of Robin Houston's patch (but implemented somewhat differently).
-
-35. Further mods to the Makefile to help Win32. Also, added code to pcregrep
- to allow it to read and process whole directories in Win32. This code was
- contributed by Lionel Fourquaux; it has not been tested by me.
-
-36. Added support for named subpatterns. The Python syntax (?P<name>...) is
- used to name a group. Names consist of alphanumerics and underscores, and
- must be unique. Back references use the syntax (?P=name) and recursive
- calls use (?P>name) which is a PCRE extension to the Python extension.
- Groups still have numbers. The function pcre_fullinfo() can be used after
- compilation to extract a name/number map. There are three relevant calls:
-
- PCRE_INFO_NAMEENTRYSIZE yields the size of each entry in the map
- PCRE_INFO_NAMECOUNT yields the number of entries
- PCRE_INFO_NAMETABLE yields a pointer to the map.
-
- The map is a vector of fixed-size entries. The size of each entry depends
- on the length of the longest name used. The first two bytes of each entry
- are the group number, most significant byte first. There follows the
- corresponding name, zero terminated. The names are in alphabetical order.
-
-
-Version 3.9 02-Jan-02
----------------------
-
-1. A bit of extraneous text had somehow crept into the pcregrep documentation.
-
-2. If --disable-static was given, the building process failed when trying to
-build pcretest and pcregrep. (For some reason it was using libtool to compile
-them, which is not right, as they aren't part of the library.)
-
-
-Version 3.8 18-Dec-01
----------------------
-
-1. The experimental UTF-8 code was completely screwed up. It was packing the
-bytes in the wrong order. How dumb can you get?
-
-
-Version 3.7 29-Oct-01
----------------------
-
-1. In updating pcretest to check change 1 of version 3.6, I screwed up.
-This caused pcretest, when used on the test data, to segfault. Unfortunately,
-this didn't happen under Solaris 8, where I normally test things.
-
-2. The Makefile had to be changed to make it work on BSD systems, where 'make'
-doesn't seem to recognize that ./xxx and xxx are the same file. (This entry
-isn't in ChangeLog distributed with 3.7 because I forgot when I hastily made
-this fix an hour or so after the initial 3.7 release.)
-
-
-Version 3.6 23-Oct-01
----------------------
-
-1. Crashed with /(sens|respons)e and \1ibility/ and "sense and sensibility" if
-offsets passed as NULL with zero offset count.
-
-2. The config.guess and config.sub files had not been updated when I moved to
-the latest autoconf.
-
-
-Version 3.5 15-Aug-01
----------------------
-
-1. Added some missing #if !defined NOPOSIX conditionals in pcretest.c that
-had been forgotten.
-
-2. By using declared but undefined structures, we can avoid using "void"
-definitions in pcre.h while keeping the internal definitions of the structures
-private.
-
-3. The distribution is now built using autoconf 2.50 and libtool 1.4. From a
-user point of view, this means that both static and shared libraries are built
-by default, but this can be individually controlled. More of the work of
-handling this static/shared cases is now inside libtool instead of PCRE's make
-file.
-
-4. The pcretest utility is now installed along with pcregrep because it is
-useful for users (to test regexs) and by doing this, it automatically gets
-relinked by libtool. The documentation has been turned into a man page, so
-there are now .1, .txt, and .html versions in /doc.
-
-5. Upgrades to pcregrep:
- (i) Added long-form option names like gnu grep.
- (ii) Added --help to list all options with an explanatory phrase.
- (iii) Added -r, --recursive to recurse into sub-directories.
- (iv) Added -f, --file to read patterns from a file.
-
-6. pcre_exec() was referring to its "code" argument before testing that
-argument for NULL (and giving an error if it was NULL).
-
-7. Upgraded Makefile.in to allow for compiling in a different directory from
-the source directory.
-
-8. Tiny buglet in pcretest: when pcre_fullinfo() was called to retrieve the
-options bits, the pointer it was passed was to an int instead of to an unsigned
-long int. This mattered only on 64-bit systems.
-
-9. Fixed typo (3.4/1) in pcre.h again. Sigh. I had changed pcre.h (which is
-generated) instead of pcre.in, which it its source. Also made the same change
-in several of the .c files.
-
-10. A new release of gcc defines printf() as a macro, which broke pcretest
-because it had an ifdef in the middle of a string argument for printf(). Fixed
-by using separate calls to printf().
-
-11. Added --enable-newline-is-cr and --enable-newline-is-lf to the configure
-script, to force use of CR or LF instead of \n in the source. On non-Unix
-systems, the value can be set in config.h.
-
-12. The limit of 200 on non-capturing parentheses is a _nesting_ limit, not an
-absolute limit. Changed the text of the error message to make this clear, and
-likewise updated the man page.
-
-13. The limit of 99 on the number of capturing subpatterns has been removed.
-The new limit is 65535, which I hope will not be a "real" limit.
-
-
-Version 3.4 22-Aug-00
----------------------
-
-1. Fixed typo in pcre.h: unsigned const char * changed to const unsigned char *.
-
-2. Diagnose condition (?(0) as an error instead of crashing on matching.
-
-
-Version 3.3 01-Aug-00
----------------------
-
-1. If an octal character was given, but the value was greater than \377, it
-was not getting masked to the least significant bits, as documented. This could
-lead to crashes in some systems.
-
-2. Perl 5.6 (if not earlier versions) accepts classes like [a-\d] and treats
-the hyphen as a literal. PCRE used to give an error; it now behaves like Perl.
-
-3. Added the functions pcre_free_substring() and pcre_free_substring_list().
-These just pass their arguments on to (pcre_free)(), but they are provided
-because some uses of PCRE bind it to non-C systems that can call its functions,
-but cannot call free() or pcre_free() directly.
-
-4. Add "make test" as a synonym for "make check". Corrected some comments in
-the Makefile.
-
-5. Add $(DESTDIR)/ in front of all the paths in the "install" target in the
-Makefile.
-
-6. Changed the name of pgrep to pcregrep, because Solaris has introduced a
-command called pgrep for grepping around the active processes.
-
-7. Added the beginnings of support for UTF-8 character strings.
-
-8. Arranged for the Makefile to pass over the settings of CC, CFLAGS, and
-RANLIB to ./ltconfig so that they are used by libtool. I think these are all
-the relevant ones. (AR is not passed because ./ltconfig does its own figuring
-out for the ar command.)
-
-
-Version 3.2 12-May-00
----------------------
-
-This is purely a bug fixing release.
-
-1. If the pattern /((Z)+|A)*/ was matched agained ZABCDEFG it matched Z instead
-of ZA. This was just one example of several cases that could provoke this bug,
-which was introduced by change 9 of version 2.00. The code for breaking
-infinite loops after an iteration that matches an empty string was't working
-correctly.
-
-2. The pcretest program was not imitating Perl correctly for the pattern /a*/g
-when matched against abbab (for example). After matching an empty string, it
-wasn't forcing anchoring when setting PCRE_NOTEMPTY for the next attempt; this
-caused it to match further down the string than it should.
-
-3. The code contained an inclusion of sys/types.h. It isn't clear why this
-was there because it doesn't seem to be needed, and it causes trouble on some
-systems, as it is not a Standard C header. It has been removed.
-
-4. Made 4 silly changes to the source to avoid stupid compiler warnings that
-were reported on the Macintosh. The changes were from
-
- while ((c = *(++ptr)) != 0 && c != '\n');
-to
- while ((c = *(++ptr)) != 0 && c != '\n') ;
-
-Totally extraordinary, but if that's what it takes...
-
-5. PCRE is being used in one environment where neither memmove() nor bcopy() is
-available. Added HAVE_BCOPY and an autoconf test for it; if neither
-HAVE_MEMMOVE nor HAVE_BCOPY is set, use a built-in emulation function which
-assumes the way PCRE uses memmove() (always moving upwards).
-
-6. PCRE is being used in one environment where strchr() is not available. There
-was only one use in pcre.c, and writing it out to avoid strchr() probably gives
-faster code anyway.
-
-
-Version 3.1 09-Feb-00
----------------------
-
-The only change in this release is the fixing of some bugs in Makefile.in for
-the "install" target:
-
-(1) It was failing to install pcreposix.h.
-
-(2) It was overwriting the pcre.3 man page with the pcreposix.3 man page.
-
-
-Version 3.0 01-Feb-00
----------------------
-
-1. Add support for the /+ modifier to perltest (to output $` like it does in
-pcretest).
-
-2. Add support for the /g modifier to perltest.
-
-3. Fix pcretest so that it behaves even more like Perl for /g when the pattern
-matches null strings.
-
-4. Fix perltest so that it doesn't do unwanted things when fed an empty
-pattern. Perl treats empty patterns specially - it reuses the most recent
-pattern, which is not what we want. Replace // by /(?#)/ in order to avoid this
-effect.
-
-5. The POSIX interface was broken in that it was just handing over the POSIX
-captured string vector to pcre_exec(), but (since release 2.00) PCRE has
-required a bigger vector, with some working space on the end. This means that
-the POSIX wrapper now has to get and free some memory, and copy the results.
-
-6. Added some simple autoconf support, placing the test data and the
-documentation in separate directories, re-organizing some of the
-information files, and making it build pcre-config (a GNU standard). Also added
-libtool support for building PCRE as a shared library, which is now the
-default.
-
-7. Got rid of the leading zero in the definition of PCRE_MINOR because 08 and
-09 are not valid octal constants. Single digits will be used for minor values
-less than 10.
-
-8. Defined REG_EXTENDED and REG_NOSUB as zero in the POSIX header, so that
-existing programs that set these in the POSIX interface can use PCRE without
-modification.
-
-9. Added a new function, pcre_fullinfo() with an extensible interface. It can
-return all that pcre_info() returns, plus additional data. The pcre_info()
-function is retained for compatibility, but is considered to be obsolete.
-
-10. Added experimental recursion feature (?R) to handle one common case that
-Perl 5.6 will be able to do with (?p{...}).
-
-11. Added support for POSIX character classes like [:alpha:], which Perl is
-adopting.
-
-
-Version 2.08 31-Aug-99
-----------------------
-
-1. When startoffset was not zero and the pattern began with ".*", PCRE was not
-trying to match at the startoffset position, but instead was moving forward to
-the next newline as if a previous match had failed.
-
-2. pcretest was not making use of PCRE_NOTEMPTY when repeating for /g and /G,
-and could get into a loop if a null string was matched other than at the start
-of the subject.
-
-3. Added definitions of PCRE_MAJOR and PCRE_MINOR to pcre.h so the version can
-be distinguished at compile time, and for completeness also added PCRE_DATE.
-
-5. Added Paul Sokolovsky's minor changes to make it easy to compile a Win32 DLL
-in GnuWin32 environments.
-
-
-Version 2.07 29-Jul-99
-----------------------
-
-1. The documentation is now supplied in plain text form and HTML as well as in
-the form of man page sources.
-
-2. C++ compilers don't like assigning (void *) values to other pointer types.
-In particular this affects malloc(). Although there is no problem in Standard
-C, I've put in casts to keep C++ compilers happy.
-
-3. Typo on pcretest.c; a cast of (unsigned char *) in the POSIX regexec() call
-should be (const char *).
-
-4. If NOPOSIX is defined, pcretest.c compiles without POSIX support. This may
-be useful for non-Unix systems who don't want to bother with the POSIX stuff.
-However, I haven't made this a standard facility. The documentation doesn't
-mention it, and the Makefile doesn't support it.
-
-5. The Makefile now contains an "install" target, with editable destinations at
-the top of the file. The pcretest program is not installed.
-
-6. pgrep -V now gives the PCRE version number and date.
-
-7. Fixed bug: a zero repetition after a literal string (e.g. /abcde{0}/) was
-causing the entire string to be ignored, instead of just the last character.
-
-8. If a pattern like /"([^\\"]+|\\.)*"/ is applied in the normal way to a
-non-matching string, it can take a very, very long time, even for strings of
-quite modest length, because of the nested recursion. PCRE now does better in
-some of these cases. It does this by remembering the last required literal
-character in the pattern, and pre-searching the subject to ensure it is present
-before running the real match. In other words, it applies a heuristic to detect
-some types of certain failure quickly, and in the above example, if presented
-with a string that has no trailing " it gives "no match" very quickly.
-
-9. A new runtime option PCRE_NOTEMPTY causes null string matches to be ignored;
-other alternatives are tried instead.
-
-
-Version 2.06 09-Jun-99
-----------------------
-
-1. Change pcretest's output for amount of store used to show just the code
-space, because the remainder (the data block) varies in size between 32-bit and
-64-bit systems.
-
-2. Added an extra argument to pcre_exec() to supply an offset in the subject to
-start matching at. This allows lookbehinds to work when searching for multiple
-occurrences in a string.
-
-3. Added additional options to pcretest for testing multiple occurrences:
-
- /+ outputs the rest of the string that follows a match
- /g loops for multiple occurrences, using the new startoffset argument
- /G loops for multiple occurrences by passing an incremented pointer
-
-4. PCRE wasn't doing the "first character" optimization for patterns starting
-with \b or \B, though it was doing it for other lookbehind assertions. That is,
-it wasn't noticing that a match for a pattern such as /\bxyz/ has to start with
-the letter 'x'. On long subject strings, this gives a significant speed-up.
-
-
-Version 2.05 21-Apr-99
-----------------------
-
-1. Changed the type of magic_number from int to long int so that it works
-properly on 16-bit systems.
-
-2. Fixed a bug which caused patterns starting with .* not to work correctly
-when the subject string contained newline characters. PCRE was assuming
-anchoring for such patterns in all cases, which is not correct because .* will
-not pass a newline unless PCRE_DOTALL is set. It now assumes anchoring only if
-DOTALL is set at top level; otherwise it knows that patterns starting with .*
-must be retried after every newline in the subject.
-
-
-Version 2.04 18-Feb-99
-----------------------
-
-1. For parenthesized subpatterns with repeats whose minimum was zero, the
-computation of the store needed to hold the pattern was incorrect (too large).
-If such patterns were nested a few deep, this could multiply and become a real
-problem.
-
-2. Added /M option to pcretest to show the memory requirement of a specific
-pattern. Made -m a synonym of -s (which does this globally) for compatibility.
-
-3. Subpatterns of the form (regex){n,m} (i.e. limited maximum) were being
-compiled in such a way that the backtracking after subsequent failure was
-pessimal. Something like (a){0,3} was compiled as (a)?(a)?(a)? instead of
-((a)((a)(a)?)?)? with disastrous performance if the maximum was of any size.
-
-
-Version 2.03 02-Feb-99
-----------------------
-
-1. Fixed typo and small mistake in man page.
-
-2. Added 4th condition (GPL supersedes if conflict) and created separate
-LICENCE file containing the conditions.
-
-3. Updated pcretest so that patterns such as /abc\/def/ work like they do in
-Perl, that is the internal \ allows the delimiter to be included in the
-pattern. Locked out the use of \ as a delimiter. If \ immediately follows
-the final delimiter, add \ to the end of the pattern (to test the error).
-
-4. Added the convenience functions for extracting substrings after a successful
-match. Updated pcretest to make it able to test these functions.
-
-
-Version 2.02 14-Jan-99
-----------------------
-
-1. Initialized the working variables associated with each extraction so that
-their saving and restoring doesn't refer to uninitialized store.
-
-2. Put dummy code into study.c in order to trick the optimizer of the IBM C
-compiler for OS/2 into generating correct code. Apparently IBM isn't going to
-fix the problem.
-
-3. Pcretest: the timing code wasn't using LOOPREPEAT for timing execution
-calls, and wasn't printing the correct value for compiling calls. Increased the
-default value of LOOPREPEAT, and the number of significant figures in the
-times.
-
-4. Changed "/bin/rm" in the Makefile to "-rm" so it works on Windows NT.
-
-5. Renamed "deftables" as "dftables" to get it down to 8 characters, to avoid
-a building problem on Windows NT with a FAT file system.
-
-
-Version 2.01 21-Oct-98
-----------------------
-
-1. Changed the API for pcre_compile() to allow for the provision of a pointer
-to character tables built by pcre_maketables() in the current locale. If NULL
-is passed, the default tables are used.
-
-
-Version 2.00 24-Sep-98
-----------------------
-
-1. Since the (>?) facility is in Perl 5.005, don't require PCRE_EXTRA to enable
-it any more.
-
-2. Allow quantification of (?>) groups, and make it work correctly.
-
-3. The first character computation wasn't working for (?>) groups.
-
-4. Correct the implementation of \Z (it is permitted to match on the \n at the
-end of the subject) and add 5.005's \z, which really does match only at the
-very end of the subject.
-
-5. Remove the \X "cut" facility; Perl doesn't have it, and (?> is neater.
-
-6. Remove the ability to specify CASELESS, MULTILINE, DOTALL, and
-DOLLAR_END_ONLY at runtime, to make it possible to implement the Perl 5.005
-localized options. All options to pcre_study() were also removed.
-
-7. Add other new features from 5.005:
-
- $(?<= positive lookbehind
- $(?<! negative lookbehind
- (?imsx-imsx) added the unsetting capability
- such a setting is global if at outer level; local otherwise
- (?imsx-imsx:) non-capturing groups with option setting
- (?(cond)re|re) conditional pattern matching
-
- A backreference to itself in a repeated group matches the previous
- captured string.
-
-8. General tidying up of studying (both automatic and via "study")
-consequential on the addition of new assertions.
-
-9. As in 5.005, unlimited repeated groups that could match an empty substring
-are no longer faulted at compile time. Instead, the loop is forcibly broken at
-runtime if any iteration does actually match an empty substring.
-
-10. Include the RunTest script in the distribution.
-
-11. Added tests from the Perl 5.005_02 distribution. This showed up a few
-discrepancies, some of which were old and were also with respect to 5.004. They
-have now been fixed.
-
-
-Version 1.09 28-Apr-98
-----------------------
-
-1. A negated single character class followed by a quantifier with a minimum
-value of one (e.g. [^x]{1,6} ) was not compiled correctly. This could lead to
-program crashes, or just wrong answers. This did not apply to negated classes
-containing more than one character, or to minima other than one.
-
-
-Version 1.08 27-Mar-98
-----------------------
-
-1. Add PCRE_UNGREEDY to invert the greediness of quantifiers.
-
-2. Add (?U) and (?X) to set PCRE_UNGREEDY and PCRE_EXTRA respectively. The
-latter must appear before anything that relies on it in the pattern.
-
-
-Version 1.07 16-Feb-98
-----------------------
-
-1. A pattern such as /((a)*)*/ was not being diagnosed as in error (unlimited
-repeat of a potentially empty string).
-
-
-Version 1.06 23-Jan-98
-----------------------
-
-1. Added Markus Oberhumer's little patches for C++.
-
-2. Literal strings longer than 255 characters were broken.
-
-
-Version 1.05 23-Dec-97
-----------------------
-
-1. Negated character classes containing more than one character were failing if
-PCRE_CASELESS was set at run time.
-
-
-Version 1.04 19-Dec-97
-----------------------
-
-1. Corrected the man page, where some "const" qualifiers had been omitted.
-
-2. Made debugging output print "{0,xxx}" instead of just "{,xxx}" to agree with
-input syntax.
-
-3. Fixed memory leak which occurred when a regex with back references was
-matched with an offsets vector that wasn't big enough. The temporary memory
-that is used in this case wasn't being freed if the match failed.
-
-4. Tidied pcretest to ensure it frees memory that it gets.
-
-5. Temporary memory was being obtained in the case where the passed offsets
-vector was exactly big enough.
-
-6. Corrected definition of offsetof() from change 5 below.
-
-7. I had screwed up change 6 below and broken the rules for the use of
-setjmp(). Now fixed.
-
-
-Version 1.03 18-Dec-97
-----------------------
-
-1. A erroneous regex with a missing opening parenthesis was correctly
-diagnosed, but PCRE attempted to access brastack[-1], which could cause crashes
-on some systems.
-
-2. Replaced offsetof(real_pcre, code) by offsetof(real_pcre, code[0]) because
-it was reported that one broken compiler failed on the former because "code" is
-also an independent variable.
-
-3. The erroneous regex a[]b caused an array overrun reference.
-
-4. A regex ending with a one-character negative class (e.g. /[^k]$/) did not
-fail on data ending with that character. (It was going on too far, and checking
-the next character, typically a binary zero.) This was specific to the
-optimized code for single-character negative classes.
-
-5. Added a contributed patch from the TIN world which does the following:
-
- + Add an undef for memmove, in case the the system defines a macro for it.
-
- + Add a definition of offsetof(), in case there isn't one. (I don't know
- the reason behind this - offsetof() is part of the ANSI standard - but
- it does no harm).
-
- + Reduce the ifdef's in pcre.c using macro DPRINTF, thereby eliminating
- most of the places where whitespace preceded '#'. I have given up and
- allowed the remaining 2 cases to be at the margin.
-
- + Rename some variables in pcre to eliminate shadowing. This seems very
- pedantic, but does no harm, of course.
-
-6. Moved the call to setjmp() into its own function, to get rid of warnings
-from gcc -Wall, and avoided calling it at all unless PCRE_EXTRA is used.
-
-7. Constructs such as \d{8,} were compiling into the equivalent of
-\d{8}\d{0,65527} instead of \d{8}\d* which didn't make much difference to the
-outcome, but in this particular case used more store than had been allocated,
-which caused the bug to be discovered because it threw up an internal error.
-
-8. The debugging code in both pcre and pcretest for outputting the compiled
-form of a regex was going wrong in the case of back references followed by
-curly-bracketed repeats.
-
-
-Version 1.02 12-Dec-97
-----------------------
-
-1. Typos in pcre.3 and comments in the source fixed.
-
-2. Applied a contributed patch to get rid of places where it used to remove
-'const' from variables, and fixed some signed/unsigned and uninitialized
-variable warnings.
-
-3. Added the "runtest" target to Makefile.
-
-4. Set default compiler flag to -O2 rather than just -O.
-
-
-Version 1.01 19-Nov-97
-----------------------
-
-1. PCRE was failing to diagnose unlimited repeat of empty string for patterns
-like /([ab]*)*/, that is, for classes with more than one character in them.
-
-2. Likewise, it wasn't diagnosing patterns with "once-only" subpatterns, such
-as /((?>a*))*/ (a PCRE_EXTRA facility).
-
-
-Version 1.00 18-Nov-97
-----------------------
-
-1. Added compile-time macros to support systems such as SunOS4 which don't have
-memmove() or strerror() but have other things that can be used instead.
-
-2. Arranged that "make clean" removes the executables.
-
-
-Version 0.99 27-Oct-97
-----------------------
-
-1. Fixed bug in code for optimizing classes with only one character. It was
-initializing a 32-byte map regardless, which could cause it to run off the end
-of the memory it had got.
-
-2. Added, conditional on PCRE_EXTRA, the proposed (?>REGEX) construction.
-
-
-Version 0.98 22-Oct-97
-----------------------
-
-1. Fixed bug in code for handling temporary memory usage when there are more
-back references than supplied space in the ovector. This could cause segfaults.
-
-
-Version 0.97 21-Oct-97
-----------------------
-
-1. Added the \X "cut" facility, conditional on PCRE_EXTRA.
-
-2. Optimized negated single characters not to use a bit map.
-
-3. Brought error texts together as macro definitions; clarified some of them;
-fixed one that was wrong - it said "range out of order" when it meant "invalid
-escape sequence".
-
-4. Changed some char * arguments to const char *.
-
-5. Added PCRE_NOTBOL and PCRE_NOTEOL (from POSIX).
-
-6. Added the POSIX-style API wrapper in pcreposix.a and testing facilities in
-pcretest.
-
-
-Version 0.96 16-Oct-97
-----------------------
-
-1. Added a simple "pgrep" utility to the distribution.
-
-2. Fixed an incompatibility with Perl: "{" is now treated as a normal character
-unless it appears in one of the precise forms "{ddd}", "{ddd,}", or "{ddd,ddd}"
-where "ddd" means "one or more decimal digits".
-
-3. Fixed serious bug. If a pattern had a back reference, but the call to
-pcre_exec() didn't supply a large enough ovector to record the related
-identifying subpattern, the match always failed. PCRE now remembers the number
-of the largest back reference, and gets some temporary memory in which to save
-the offsets during matching if necessary, in order to ensure that
-backreferences always work.
-
-4. Increased the compatibility with Perl in a number of ways:
-
- (a) . no longer matches \n by default; an option PCRE_DOTALL is provided
- to request this handling. The option can be set at compile or exec time.
-
- (b) $ matches before a terminating newline by default; an option
- PCRE_DOLLAR_ENDONLY is provided to override this (but not in multiline
- mode). The option can be set at compile or exec time.
-
- (c) The handling of \ followed by a digit other than 0 is now supposed to be
- the same as Perl's. If the decimal number it represents is less than 10
- or there aren't that many previous left capturing parentheses, an octal
- escape is read. Inside a character class, it's always an octal escape,
- even if it is a single digit.
-
- (d) An escaped but undefined alphabetic character is taken as a literal,
- unless PCRE_EXTRA is set. Currently this just reserves the remaining
- escapes.
-
- (e) {0} is now permitted. (The previous item is removed from the compiled
- pattern).
-
-5. Changed all the names of code files so that the basic parts are no longer
-than 10 characters, and abolished the teeny "globals.c" file.
-
-6. Changed the handling of character classes; they are now done with a 32-byte
-bit map always.
-
-7. Added the -d and /D options to pcretest to make it possible to look at the
-internals of compilation without having to recompile pcre.
-
-
-Version 0.95 23-Sep-97
-----------------------
-
-1. Fixed bug in pre-pass concerning escaped "normal" characters such as \x5c or
-\x20 at the start of a run of normal characters. These were being treated as
-real characters, instead of the source characters being re-checked.
-
-
-Version 0.94 18-Sep-97
-----------------------
-
-1. The functions are now thread-safe, with the caveat that the global variables
-containing pointers to malloc() and free() or alternative functions are the
-same for all threads.
-
-2. Get pcre_study() to generate a bitmap of initial characters for non-
-anchored patterns when this is possible, and use it if passed to pcre_exec().
-
-
-Version 0.93 15-Sep-97
-----------------------
-
-1. /(b)|(:+)/ was computing an incorrect first character.
-
-2. Add pcre_study() to the API and the passing of pcre_extra to pcre_exec(),
-but not actually doing anything yet.
-
-3. Treat "-" characters in classes that cannot be part of ranges as literals,
-as Perl does (e.g. [-az] or [az-]).
-
-4. Set the anchored flag if a branch starts with .* or .*? because that tests
-all possible positions.
-
-5. Split up into different modules to avoid including unneeded functions in a
-compiled binary. However, compile and exec are still in one module. The "study"
-function is split off.
-
-6. The character tables are now in a separate module whose source is generated
-by an auxiliary program - but can then be edited by hand if required. There are
-now no calls to isalnum(), isspace(), isdigit(), isxdigit(), tolower() or
-toupper() in the code.
-
-7. Turn the malloc/free funtions variables into pcre_malloc and pcre_free and
-make them global. Abolish the function for setting them, as the caller can now
-set them directly.
-
-
-Version 0.92 11-Sep-97
-----------------------
-
-1. A repeat with a fixed maximum and a minimum of 1 for an ordinary character
-(e.g. /a{1,3}/) was broken (I mis-optimized it).
-
-2. Caseless matching was not working in character classes if the characters in
-the pattern were in upper case.
-
-3. Make ranges like [W-c] work in the same way as Perl for caseless matching.
-
-4. Make PCRE_ANCHORED public and accept as a compile option.
-
-5. Add an options word to pcre_exec() and accept PCRE_ANCHORED and
-PCRE_CASELESS at run time. Add escapes \A and \I to pcretest to cause it to
-pass them.
-
-6. Give an error if bad option bits passed at compile or run time.
-
-7. Add PCRE_MULTILINE at compile and exec time, and (?m) as well. Add \M to
-pcretest to cause it to pass that flag.
-
-8. Add pcre_info(), to get the number of identifying subpatterns, the stored
-options, and the first character, if set.
-
-9. Recognize C+ or C{n,m} where n >= 1 as providing a fixed starting character.
-
-
-Version 0.91 10-Sep-97
-----------------------
-
-1. PCRE was failing to diagnose unlimited repeats of subpatterns that could
-match the empty string as in /(a*)*/. It was looping and ultimately crashing.
-
-2. PCRE was looping on encountering an indefinitely repeated back reference to
-a subpattern that had matched an empty string, e.g. /(a|)\1*/. It now does what
-Perl does - treats the match as successful.
-
-****
diff --git a/ext/pcre/pcrelib/INSTALL b/ext/pcre/pcrelib/INSTALL
deleted file mode 100644
index 08802812de..0000000000
--- a/ext/pcre/pcrelib/INSTALL
+++ /dev/null
@@ -1,185 +0,0 @@
-Basic Installation
-==================
-
- These are generic installation instructions that apply to systems that
-can run the `configure' shell script - Unix systems and any that imitate
-it. They are not specific to PCRE. There are PCRE-specific instructions
-for non-Unix systems in the file NON-UNIX-USE.
-
- The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation. It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions. Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, a file
-`config.cache' that saves the results of its tests to speed up
-reconfiguring, and a file `config.log' containing compiler output
-(useful mainly for debugging `configure').
-
- If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release. If at some point `config.cache'
-contains results you don't want to keep, you may remove or edit it.
-
- The file `configure.in' is used to create `configure' by a program
-called `autoconf'. You only need `configure.in' if you want to change
-it or regenerate `configure' using a newer version of `autoconf'.
-
-The simplest way to compile this package is:
-
- 1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system. If you're
- using `csh' on an old version of System V, you might need to type
- `sh ./configure' instead to prevent `csh' from trying to execute
- `configure' itself.
-
- Running `configure' takes awhile. While running, it prints some
- messages telling which features it is checking for.
-
- 2. Type `make' to compile the package.
-
- 3. Optionally, type `make check' to run any self-tests that come with
- the package.
-
- 4. Type `make install' to install the programs and any data files and
- documentation.
-
- 5. You can remove the program binaries and object files from the
- source code directory by typing `make clean'. To also remove the
- files that `configure' created (so you can compile the package for
- a different kind of computer), type `make distclean'. There is
- also a `make maintainer-clean' target, but that is intended mainly
- for the package's developers. If you use it, you may have to get
- all sorts of other programs in order to regenerate files that came
- with the distribution.
-
-Compilers and Options
-=====================
-
- Some systems require unusual options for compilation or linking that
-the `configure' script does not know about. You can give `configure'
-initial values for variables by setting them in the environment. Using
-a Bourne-compatible shell, you can do that on the command line like
-this:
- CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
-
-Or on systems that have the `env' program, you can do it like this:
- env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
-
-Compiling For Multiple Architectures
-====================================
-
- You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory. To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'. `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
-
- If you have to use a `make' that does not supports the `VPATH'
-variable, you have to compile the package for one architecture at a time
-in the source code directory. After you have installed the package for
-one architecture, use `make distclean' before reconfiguring for another
-architecture.
-
-Installation Names
-==================
-
- By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc. You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
-
- You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files. If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
-
- In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
-kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
-
- If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-Optional Features
-=================
-
- Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System). The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
- For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-Specifying the System Type
-==========================
-
- There may be some features `configure' can not figure out
-automatically, but needs to determine by the type of host the package
-will run on. Usually `configure' can figure that out, but if it prints
-a message saying it can not guess the host type, give it the
-`--host=TYPE' option. TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name with three fields:
- CPU-COMPANY-SYSTEM
-
-See the file `config.sub' for the possible values of each field. If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the host type.
-
- If you are building compiler tools for cross-compiling, you can also
-use the `--target=TYPE' option to select the type of system they will
-produce code for and the `--build=TYPE' option to select the type of
-system on which you are compiling the package.
-
-Sharing Defaults
-================
-
- If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists. Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Operation Controls
-==================
-
- `configure' recognizes the following options to control how it
-operates.
-
-`--cache-file=FILE'
- Use and save the results of the tests in FILE instead of
- `./config.cache'. Set FILE to `/dev/null' to disable caching, for
- debugging `configure'.
-
-`--help'
- Print a summary of the options to `configure', and exit.
-
-`--quiet'
-`--silent'
-`-q'
- Do not print messages saying which checks are being made. To
- suppress all normal output, redirect it to `/dev/null' (any error
- messages will still be shown).
-
-`--srcdir=DIR'
- Look for the package's source code in directory DIR. Usually
- `configure' can determine that directory automatically.
-
-`--version'
- Print the version of Autoconf used to generate the `configure'
- script, and exit.
-
-`configure' also accepts some other, not widely useful, options.
diff --git a/ext/pcre/pcrelib/LICENCE b/ext/pcre/pcrelib/LICENCE
deleted file mode 100644
index 8effa66492..0000000000
--- a/ext/pcre/pcrelib/LICENCE
+++ /dev/null
@@ -1,50 +0,0 @@
-PCRE LICENCE
-------------
-
-PCRE is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
-University of Cambridge Computing Service,
-Cambridge, England. Phone: +44 1223 334714.
-
-Copyright (c) 1997-2001 University of Cambridge
-
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. In practice, this means that if you use
- PCRE in software which you distribute to others, commercially or
- otherwise, you must put a sentence like this
-
- Regular expression support is provided by the PCRE library package,
- which is open source software, written by Philip Hazel, and copyright
- by the University of Cambridge, England.
-
- somewhere reasonably visible in your documentation and in any relevant
- files or online help data or similar. A reference to the ftp site for
- the source, that is, to
-
- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
-
- should also be given in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), or Lesser General Purpose Licence (LGPL),
- then the terms of that licence shall supersede any condition above with
- which it is incompatible.
-
-The documentation for PCRE, supplied in the "doc" directory, is distributed
-under the same terms as the software itself.
-
-End
diff --git a/ext/pcre/pcrelib/NEWS b/ext/pcre/pcrelib/NEWS
deleted file mode 100644
index 27866b68a2..0000000000
--- a/ext/pcre/pcrelib/NEWS
+++ /dev/null
@@ -1,85 +0,0 @@
-News about PCRE releases
-------------------------
-
-Release 3.5 15-Aug-01
----------------------
-
-1. The configuring system has been upgraded to use later versions of autoconf
-and libtool. By default it builds both a shared and a static library if the OS
-supports it. You can use --disable-shared or --disable-static on the configure
-command if you want only one of them.
-
-2. The pcretest utility is now installed along with pcregrep because it is
-useful for users (to test regexs) and by doing this, it automatically gets
-relinked by libtool. The documentation has been turned into a man page, so
-there are now .1, .txt, and .html versions in /doc.
-
-3. Upgrades to pcregrep:
- (i) Added long-form option names like gnu grep.
- (ii) Added --help to list all options with an explanatory phrase.
- (iii) Added -r, --recursive to recurse into sub-directories.
- (iv) Added -f, --file to read patterns from a file.
-
-4. Added --enable-newline-is-cr and --enable-newline-is-lf to the configure
-script, to force use of CR or LF instead of \n in the source. On non-Unix
-systems, the value can be set in config.h.
-
-5. The limit of 200 on non-capturing parentheses is a _nesting_ limit, not an
-absolute limit. Changed the text of the error message to make this clear, and
-likewise updated the man page.
-
-6. The limit of 99 on the number of capturing subpatterns has been removed.
-The new limit is 65535, which I hope will not be a "real" limit.
-
-
-Release 3.3 01-Aug-00
----------------------
-
-There is some support for UTF-8 character strings. This is incomplete and
-experimental. The documentation describes what is and what is not implemented.
-Otherwise, this is just a bug-fixing release.
-
-
-Release 3.0 01-Feb-00
----------------------
-
-1. A "configure" script is now used to configure PCRE for Unix systems. It
-builds a Makefile, a config.h file, and the pcre-config script.
-
-2. PCRE is built as a shared library by default.
-
-3. There is support for POSIX classes such as [:alpha:].
-
-5. There is an experimental recursion feature.
-
-----------------------------------------------------------------------------
- IMPORTANT FOR THOSE UPGRADING FROM VERSIONS BEFORE 2.00
-
-Please note that there has been a change in the API such that a larger
-ovector is required at matching time, to provide some additional workspace.
-The new man page has details. This change was necessary in order to support
-some of the new functionality in Perl 5.005.
-
- IMPORTANT FOR THOSE UPGRADING FROM VERSION 2.00
-
-Another (I hope this is the last!) change has been made to the API for the
-pcre_compile() function. An additional argument has been added to make it
-possible to pass over a pointer to character tables built in the current
-locale by pcre_maketables(). To use the default tables, this new arguement
-should be passed as NULL.
-
- IMPORTANT FOR THOSE UPGRADING FROM VERSION 2.05
-
-Yet another (and again I hope this really is the last) change has been made
-to the API for the pcre_exec() function. An additional argument has been
-added to make it possible to start the match other than at the start of the
-subject string. This is important if there are lookbehinds. The new man
-page has the details, but you just want to convert existing programs, all
-you need to do is to stick in a new fifth argument to pcre_exec(), with a
-value of zero. For example, change
-
- pcre_exec(pattern, extra, subject, length, options, ovec, ovecsize)
-to
- pcre_exec(pattern, extra, subject, length, 0, options, ovec, ovecsize)
-
-****
diff --git a/ext/pcre/pcrelib/NON-UNIX-USE b/ext/pcre/pcrelib/NON-UNIX-USE
deleted file mode 100644
index 8cbad88819..0000000000
--- a/ext/pcre/pcrelib/NON-UNIX-USE
+++ /dev/null
@@ -1,89 +0,0 @@
-Compiling PCRE on non-Unix systems
-----------------------------------
-
-If you want to compile PCRE for a non-Unix system, note that it consists
-entirely of code written in Standard C, and so should compile successfully
-on any machine with a Standard C compiler and library, using normal compiling
-commands to do the following:
-
-(1) Copy or rename the file config.in as config.h, and change the macros that
-define HAVE_STRERROR and HAVE_MEMMOVE to define them as 1 rather than 0.
-Unfortunately, because of the way Unix autoconf works, the default setting has
-to be 0. You may also want to make changes to other macros in config.h. In
-particular, if you want to force a specific value for newline, you can define
-the NEWLINE macro. The default is to use '\n', thereby using whatever value
-your compiler gives to '\n'.
-
-(2) Copy or rename the file pcre.in as pcre.h, and change the macro definitions
-for PCRE_MAJOR, PCRE_MINOR, and PCRE_DATE near its start to the values set in
-configure.in.
-
-(3) Compile dftables.c as a stand-alone program, and then run it with
-the standard output sent to chartables.c. This generates a set of standard
-character tables.
-
-(4) Compile maketables.c, get.c, study.c and pcre.c and link them all
-together into an object library in whichever form your system keeps such
-libraries. This is the pcre library (chartables.c gets included by means of an
-#include directive).
-
-(5) Similarly, compile pcreposix.c and link it as the pcreposix library.
-
-(6) Compile the test program pcretest.c. This needs the functions in the
-pcre and pcreposix libraries when linking.
-
-(7) Run pcretest on the testinput files in the testdata directory, and check
-that the output matches the corresponding testoutput files. You must use the
--i option when checking testinput2.
-
-If you have a system without "configure" but where you can use a Makefile, edit
-Makefile.in to create Makefile, substituting suitable values for the variables
-at the head of the file.
-
-Some help in building a Win32 DLL of PCRE in GnuWin32 environments was
-contributed by Paul Sokolovsky. These environments are Mingw32
-(http://www.xraylith.wisc.edu/~khan/software/gnu-win32/) and CygWin
-(http://sourceware.cygnus.com/cygwin/). Paul comments:
-
- For CygWin, set CFLAGS=-mno-cygwin, and do 'make dll'. You'll get
- pcre.dll (containing pcreposix also), libpcre.dll.a, and dynamically
- linked pgrep and pcretest. If you have /bin/sh, run RunTest (three
- main test go ok, locale not supported).
-
-A script for building PCRE using Borland's C++ compiler for use with VPASCAL
-was contributed by Alexander Tokarev. It is called makevp.bat.
-
-These are some further comments about Win32 builds from Mark Evans:
-
-The documentation for Win32 builds is a bit shy. Under MSVC6 I
-followed their instructions to the letter, but there were still
-some things missing.
-
-(1) Must #define STATIC for entire project if linking statically.
- (I see no reason to use DLLs for code this compact.) This of
- course is a project setting in MSVC under Preprocessor.
-
-(2) Missing some #ifdefs relating to the function pointers
- pcre_malloc and pcre_free. See my solution below. (The stubs
- may not be mandatory but they made me feel better.)
-
-=========================
-#ifdef _WIN32
-#include <malloc.h>
-
-void* malloc_stub(size_t N)
-{ return malloc(N); }
-void free_stub(void* p)
-{ free(p); }
-void *(*pcre_malloc)(size_t) = &malloc_stub;
-void (*pcre_free)(void *) = &free_stub;
-
-#else
-
-void *(*pcre_malloc)(size_t) = malloc;
-void (*pcre_free)(void *) = free;
-
-#endif
-=========================
-
-****
diff --git a/ext/pcre/pcrelib/README b/ext/pcre/pcrelib/README
deleted file mode 100644
index 81cd1c6fa3..0000000000
--- a/ext/pcre/pcrelib/README
+++ /dev/null
@@ -1,312 +0,0 @@
-README file for PCRE (Perl-compatible regular expression library)
------------------------------------------------------------------
-
-The latest release of PCRE is always available from
-
- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz
-
-Please read the NEWS file if you are upgrading from a previous release.
-
-PCRE has its own native API, but a set of "wrapper" functions that are based on
-the POSIX API are also supplied in the library libpcreposix. Note that this
-just provides a POSIX calling interface to PCRE: the regular expressions
-themselves still follow Perl syntax and semantics. The header file
-for the POSIX-style functions is called pcreposix.h. The official POSIX name is
-regex.h, but I didn't want to risk possible problems with existing files of
-that name by distributing it that way. To use it with an existing program that
-uses the POSIX API, it will have to be renamed or pointed at by a link.
-
-
-Contributions by users of PCRE
-------------------------------
-
-You can find contributions from PCRE users in the directory
-
- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib
-
-where there is also a README file giving brief descriptions of what they are.
-Several of them provide support for compiling PCRE on various flavours of
-Windows systems (I myself do not use Windows). Some are complete in themselves;
-others are pointers to URLs containing relevant files.
-
-
-Building PCRE on a Unix-like system
------------------------------------
-
-To build PCRE on a Unix-like system, first run the "configure" command from the
-PCRE distribution directory, with your current directory set to the directory
-where you want the files to be created. This command is a standard GNU
-"autoconf" configuration script, for which generic instructions are supplied in
-INSTALL.
-
-Most commonly, people build PCRE within its own distribution directory, and in
-this case, on many systems, just running "./configure" is sufficient, but the
-usual methods of changing standard defaults are available. For example,
-
-CFLAGS='-O2 -Wall' ./configure --prefix=/opt/local
-
-specifies that the C compiler should be run with the flags '-O2 -Wall' instead
-of the default, and that "make install" should install PCRE under /opt/local
-instead of the default /usr/local.
-
-If you want to build in a different directory, just run "configure" with that
-directory as current. For example, suppose you have unpacked the PCRE source
-into /source/pcre/pcre-xxx, but you want to build it in /build/pcre/pcre-xxx:
-
-cd /build/pcre/pcre-xxx
-/source/pcre/pcre-xxx/configure
-
-If you want to make use of the experimential, incomplete support for UTF-8
-character strings in PCRE, you must add --enable-utf8 to the "configure"
-command. Without it, the code for handling UTF-8 is not included in the
-library. (Even when included, it still has to be enabled by an option at run
-time.)
-
-The "configure" script builds five files:
-
-. libtool is a script that builds shared and/or static libraries
-. Makefile is built by copying Makefile.in and making substitutions.
-. config.h is built by copying config.in and making substitutions.
-. pcre-config is built by copying pcre-config.in and making substitutions.
-. RunTest is a script for running tests
-
-Once "configure" has run, you can run "make". It builds two libraries called
-libpcre and libpcreposix, a test program called pcretest, and the pcregrep
-command. You can use "make install" to copy these, the public header files
-pcre.h and pcreposix.h, and the man pages to appropriate live directories on
-your system, in the normal way.
-
-Running "make install" also installs the command pcre-config, which can be used
-to recall information about the PCRE configuration and installation. For
-example,
-
- pcre-config --version
-
-prints the version number, and
-
- pcre-config --libs
-
-outputs information about where the library is installed. This command can be
-included in makefiles for programs that use PCRE, saving the programmer from
-having to remember too many details.
-
-There is one esoteric feature that is controlled by "configure". It concerns
-the character value used for "newline", and is something that you probably do
-not want to change on a Unix system. The default is to use whatever value your
-compiler gives to '\n'. By using --enable-newline-is-cr or
---enable-newline-is-lf you can force the value to be CR (13) or LF (10) if you
-really want to.
-
-
-Shared libraries on Unix systems
---------------------------------
-
-The default distribution builds PCRE as two shared libraries and two static
-libraries, as long as the operating system supports shared libraries. Shared
-library support relies on the "libtool" script which is built as part of the
-"configure" process.
-
-The libtool script is used to compile and link both shared and static
-libraries. They are placed in a subdirectory called .libs when they are newly
-built. The programs pcretest and pcregrep are built to use these uninstalled
-libraries (by means of wrapper scripts in the case of shared libraries). When
-you use "make install" to install shared libraries, pcregrep and pcretest are
-automatically re-built to use the newly installed shared libraries before being
-installed themselves. However, the versions left in the source directory still
-use the uninstalled libraries.
-
-To build PCRE using static libraries only you must use --disable-shared when
-configuring it. For example
-
-./configure --prefix=/usr/gnu --disable-shared
-
-Then run "make" in the usual way. Similarly, you can use --disable-static to
-build only shared libraries.
-
-
-Building on non-Unix systems
-----------------------------
-
-For a non-Unix system, read the comments in the file NON-UNIX-USE. PCRE has
-been compiled on Windows systems and on Macintoshes, but I don't know the
-details because I don't use those systems. It should be straightforward to
-build PCRE on any system that has a Standard C compiler, because it uses only
-Standard C functions.
-
-
-Testing PCRE
-------------
-
-To test PCRE on a Unix system, run the RunTest script that is created by the
-configuring process. (This can also be run by "make runtest", "make check", or
-"make test".) For other systems, see the instruction in NON-UNIX-USE.
-
-The script runs the pcretest test program (which is documented in the doc
-directory) on each of the testinput files (in the testdata directory) in turn,
-and compares the output with the contents of the corresponding testoutput file.
-A file called testtry is used to hold the output from pcretest. To run pcretest
-on just one of the test files, give its number as an argument to RunTest, for
-example:
-
- RunTest 2
-
-The first file can also be fed directly into the perltest script to check that
-Perl gives the same results. The only difference you should see is in the first
-few lines, where the Perl version is given instead of the PCRE version.
-
-The second set of tests check pcre_fullinfo(), pcre_info(), pcre_study(),
-pcre_copy_substring(), pcre_get_substring(), pcre_get_substring_list(), error
-detection, and run-time flags that are specific to PCRE, as well as the POSIX
-wrapper API. It also uses the debugging flag to check some of the internals of
-pcre_compile().
-
-If you build PCRE with a locale setting that is not the standard C locale, the
-character tables may be different (see next paragraph). In some cases, this may
-cause failures in the second set of tests. For example, in a locale where the
-isprint() function yields TRUE for characters in the range 128-255, the use of
-[:isascii:] inside a character class defines a different set of characters, and
-this shows up in this test as a difference in the compiled code, which is being
-listed for checking. Where the comparison test output contains [\x00-\x7f] the
-test will contain [\x00-\xff], and similarly in some other cases. This is not a
-bug in PCRE.
-
-The third set of tests checks pcre_maketables(), the facility for building a
-set of character tables for a specific locale and using them instead of the
-default tables. The tests make use of the "fr" (French) locale. Before running
-the test, the script checks for the presence of this locale by running the
-"locale" command. If that command fails, or if it doesn't include "fr" in the
-list of available locales, the third test cannot be run, and a comment is
-output to say why. If running this test produces instances of the error
-
- ** Failed to set locale "fr"
-
-in the comparison output, it means that locale is not available on your system,
-despite being listed by "locale". This does not mean that PCRE is broken.
-
-The fourth test checks the experimental, incomplete UTF-8 support. It is not
-run automatically unless PCRE is built with UTF-8 support. To do this you must
-set --enable-utf8 when running "configure". This file can be also fed directly
-to the perltest script, provided you are running Perl 5.8 or higher. (For Perl
-5.6, a small patch, commented in the script, can be be used.)
-
-The fifth and final file tests error handling with UTF-8 encoding, and internal
-UTF-8 features of PCRE that are not relevant to Perl.
-
-
-Character tables
-----------------
-
-PCRE uses four tables for manipulating and identifying characters. The final
-argument of the pcre_compile() function is a pointer to a block of memory
-containing the concatenated tables. A call to pcre_maketables() can be used to
-generate a set of tables in the current locale. If the final argument for
-pcre_compile() is passed as NULL, a set of default tables that is built into
-the binary is used.
-
-The source file called chartables.c contains the default set of tables. This is
-not supplied in the distribution, but is built by the program dftables
-(compiled from dftables.c), which uses the ANSI C character handling functions
-such as isalnum(), isalpha(), isupper(), islower(), etc. to build the table
-sources. This means that the default C locale which is set for your system will
-control the contents of these default tables. You can change the default tables
-by editing chartables.c and then re-building PCRE. If you do this, you should
-probably also edit Makefile to ensure that the file doesn't ever get
-re-generated.
-
-The first two 256-byte tables provide lower casing and case flipping functions,
-respectively. The next table consists of three 32-byte bit maps which identify
-digits, "word" characters, and white space, respectively. These are used when
-building 32-byte bit maps that represent character classes.
-
-The final 256-byte table has bits indicating various character types, as
-follows:
-
- 1 white space character
- 2 letter
- 4 decimal digit
- 8 hexadecimal digit
- 16 alphanumeric or '_'
- 128 regular expression metacharacter or binary zero
-
-You should not alter the set of characters that contain the 128 bit, as that
-will cause PCRE to malfunction.
-
-
-Manifest
---------
-
-The distribution should contain the following files:
-
-(A) The actual source files of the PCRE library functions and their
- headers:
-
- dftables.c auxiliary program for building chartables.c
- get.c )
- maketables.c )
- study.c ) source of
- pcre.c ) the functions
- pcreposix.c )
- pcre.in "source" for the header for the external API; pcre.h
- is built from this by "configure"
- pcreposix.h header for the external POSIX wrapper API
- internal.h header for internal use
- config.in template for config.h, which is built by configure
-
-(B) Auxiliary files:
-
- AUTHORS information about the author of PCRE
- ChangeLog log of changes to the code
- INSTALL generic installation instructions
- LICENCE conditions for the use of PCRE
- COPYING the same, using GNU's standard name
- Makefile.in template for Unix Makefile, which is built by configure
- NEWS important changes in this release
- NON-UNIX-USE notes on building PCRE on non-Unix systems
- README this file
- RunTest.in template for a Unix shell script for running tests
- config.guess ) files used by libtool,
- config.sub ) used only when building a shared library
- configure a configuring shell script (built by autoconf)
- configure.in the autoconf input used to build configure
- doc/Tech.Notes notes on the encoding
- doc/pcre.3 man page source for the PCRE functions
- doc/pcre.html HTML version
- doc/pcre.txt plain text version
- doc/pcreposix.3 man page source for the POSIX wrapper API
- doc/pcreposix.html HTML version
- doc/pcreposix.txt plain text version
- doc/pcretest.txt documentation of test program
- doc/perltest.txt documentation of Perl test program
- doc/pcregrep.1 man page source for the pcregrep utility
- doc/pcregrep.html HTML version
- doc/pcregrep.txt plain text version
- install-sh a shell script for installing files
- ltmain.sh file used to build a libtool script
- pcretest.c comprehensive test program
- pcredemo.c simple demonstration of coding calls to PCRE
- perltest Perl test program
- perltest8 Perl test program for UTF-8 tests
- pcregrep.c source of a grep utility that uses PCRE
- pcre-config.in source of script which retains PCRE information
- testdata/testinput1 test data, compatible with Perl
- testdata/testinput2 test data for error messages and non-Perl things
- testdata/testinput3 test data for locale-specific tests
- testdata/testinput4 test data for UTF-8 tests compatible with Perl
- testdata/testinput5 test data for other UTF-8 tests
- testdata/testoutput1 test results corresponding to testinput1
- testdata/testoutput2 test results corresponding to testinput2
- testdata/testoutput3 test results corresponding to testinput3
- testdata/testoutput4 test results corresponding to testinput4
- testdata/testoutput5 test results corresponding to testinput5
-
-(C) Auxiliary files for Win32 DLL
-
- dll.mk
- pcre.def
-
-(D) Auxiliary file for VPASCAL
-
- makevp.bat
-
-Philip Hazel <ph10@cam.ac.uk>
-August 2002
diff --git a/ext/pcre/pcrelib/chartables.c b/ext/pcre/pcrelib/chartables.c
deleted file mode 100644
index 9055da2d2d..0000000000
--- a/ext/pcre/pcrelib/chartables.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/* This file is automatically written by the dftables auxiliary
-program. If you edit it by hand, you might like to edit the Makefile to
-prevent its ever being regenerated.
-
-This file is #included in the compilation of pcre.c to build the default
-character tables which are used when no tables are passed to the compile
-function. */
-
-static unsigned char pcre_default_tables[] = {
-
-/* This table is a lower casing table. */
-
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 97, 98, 99,100,101,102,103,
- 104,105,106,107,108,109,110,111,
- 112,113,114,115,116,117,118,119,
- 120,121,122, 91, 92, 93, 94, 95,
- 96, 97, 98, 99,100,101,102,103,
- 104,105,106,107,108,109,110,111,
- 112,113,114,115,116,117,118,119,
- 120,121,122,123,124,125,126,127,
- 128,129,130,131,132,133,134,135,
- 136,137,138,139,140,141,142,143,
- 144,145,146,147,148,149,150,151,
- 152,153,154,155,156,157,158,159,
- 160,161,162,163,164,165,166,167,
- 168,169,170,171,172,173,174,175,
- 176,177,178,179,180,181,182,183,
- 184,185,186,187,188,189,190,191,
- 192,193,194,195,196,197,198,199,
- 200,201,202,203,204,205,206,207,
- 208,209,210,211,212,213,214,215,
- 216,217,218,219,220,221,222,223,
- 224,225,226,227,228,229,230,231,
- 232,233,234,235,236,237,238,239,
- 240,241,242,243,244,245,246,247,
- 248,249,250,251,252,253,254,255,
-
-/* This table is a case flipping table. */
-
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 97, 98, 99,100,101,102,103,
- 104,105,106,107,108,109,110,111,
- 112,113,114,115,116,117,118,119,
- 120,121,122, 91, 92, 93, 94, 95,
- 96, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87,
- 88, 89, 90,123,124,125,126,127,
- 128,129,130,131,132,133,134,135,
- 136,137,138,139,140,141,142,143,
- 144,145,146,147,148,149,150,151,
- 152,153,154,155,156,157,158,159,
- 160,161,162,163,164,165,166,167,
- 168,169,170,171,172,173,174,175,
- 176,177,178,179,180,181,182,183,
- 184,185,186,187,188,189,190,191,
- 192,193,194,195,196,197,198,199,
- 200,201,202,203,204,205,206,207,
- 208,209,210,211,212,213,214,215,
- 216,217,218,219,220,221,222,223,
- 224,225,226,227,228,229,230,231,
- 232,233,234,235,236,237,238,239,
- 240,241,242,243,244,245,246,247,
- 248,249,250,251,252,253,254,255,
-
-/* This table contains bit maps for various character classes.
-Each map is 32 bytes long and the bits run from the least
-significant end of each byte. The classes that have their own
-maps are: space, xdigit, digit, upper, lower, word, graph
-print, punct, and cntrl. Other classes are built from combinations. */
-
- 0x00,0x3e,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
- 0x7e,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xfe,0xff,0xff,0x07,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0x07,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
- 0xfe,0xff,0xff,0x87,0xfe,0xff,0xff,0x07,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0xfe,0xff,0x00,0xfc,
- 0x01,0x00,0x00,0xf8,0x01,0x00,0x00,0x78,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
-/* This table identifies various classes of character by individual bits:
- 0x01 white space character
- 0x02 letter
- 0x04 decimal digit
- 0x08 hexadecimal digit
- 0x10 alphanumeric or '_'
- 0x80 regular expression metacharacter or binary zero
-*/
-
- 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0- 7 */
- 0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00, /* 8- 15 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 16- 23 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 24- 31 */
- 0x01,0x00,0x00,0x00,0x80,0x00,0x00,0x00, /* - ' */
- 0x80,0x80,0x80,0x80,0x00,0x00,0x80,0x00, /* ( - / */
- 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, /* 0 - 7 */
- 0x1c,0x1c,0x00,0x00,0x00,0x00,0x00,0x80, /* 8 - ? */
- 0x00,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x12, /* @ - G */
- 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* H - O */
- 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* P - W */
- 0x12,0x12,0x12,0x80,0x00,0x00,0x80,0x10, /* X - _ */
- 0x00,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x12, /* ` - g */
- 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* h - o */
- 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* p - w */
- 0x12,0x12,0x12,0x80,0x80,0x00,0x00,0x00, /* x -127 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 128-135 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 136-143 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 144-151 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 152-159 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 160-167 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 168-175 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 176-183 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 184-191 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 192-199 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 200-207 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 208-215 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 216-223 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 224-231 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 232-239 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 240-247 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/* 248-255 */
-
-/* End of chartables.c */
diff --git a/ext/pcre/pcrelib/dftables.c b/ext/pcre/pcrelib/dftables.c
deleted file mode 100644
index fe4ffcdb7a..0000000000
--- a/ext/pcre/pcrelib/dftables.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/*
-PCRE is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
- Copyright (c) 1997-2001 University of Cambridge
-
------------------------------------------------------------------------------
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
------------------------------------------------------------------------------
-
-See the file Tech.Notes for some information on the internals.
-*/
-
-
-/* This is a support program to generate the file chartables.c, containing
-character tables of various kinds. They are built according to the default C
-locale and used as the default tables by PCRE. Now that pcre_maketables is
-a function visible to the outside world, we make use of its code from here in
-order to be consistent. */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "internal.h"
-
-#define DFTABLES /* maketables.c notices this */
-#include "maketables.c"
-
-
-int main(void)
-{
-int i;
-const unsigned char *tables = pcre_maketables();
-
-printf(
- "/*************************************************\n"
- "* Perl-Compatible Regular Expressions *\n"
- "*************************************************/\n\n"
- "/* This file is automatically written by the dftables auxiliary \n"
- "program. If you edit it by hand, you might like to edit the Makefile to \n"
- "prevent its ever being regenerated.\n\n"
- "This file is #included in the compilation of pcre.c to build the default\n"
- "character tables which are used when no tables are passed to the compile\n"
- "function. */\n\n"
- "static unsigned char pcre_default_tables[] = {\n\n"
- "/* This table is a lower casing table. */\n\n");
-
-printf(" ");
-for (i = 0; i < 256; i++)
- {
- if ((i & 7) == 0 && i != 0) printf("\n ");
- printf("%3d", *tables++);
- if (i != 255) printf(",");
- }
-printf(",\n\n");
-
-printf("/* This table is a case flipping table. */\n\n");
-
-printf(" ");
-for (i = 0; i < 256; i++)
- {
- if ((i & 7) == 0 && i != 0) printf("\n ");
- printf("%3d", *tables++);
- if (i != 255) printf(",");
- }
-printf(",\n\n");
-
-printf(
- "/* This table contains bit maps for various character classes.\n"
- "Each map is 32 bytes long and the bits run from the least\n"
- "significant end of each byte. The classes that have their own\n"
- "maps are: space, xdigit, digit, upper, lower, word, graph\n"
- "print, punct, and cntrl. Other classes are built from combinations. */\n\n");
-
-printf(" ");
-for (i = 0; i < cbit_length; i++)
- {
- if ((i & 7) == 0 && i != 0)
- {
- if ((i & 31) == 0) printf("\n");
- printf("\n ");
- }
- printf("0x%02x", *tables++);
- if (i != cbit_length - 1) printf(",");
- }
-printf(",\n\n");
-
-printf(
- "/* This table identifies various classes of character by individual bits:\n"
- " 0x%02x white space character\n"
- " 0x%02x letter\n"
- " 0x%02x decimal digit\n"
- " 0x%02x hexadecimal digit\n"
- " 0x%02x alphanumeric or '_'\n"
- " 0x%02x regular expression metacharacter or binary zero\n*/\n\n",
- ctype_space, ctype_letter, ctype_digit, ctype_xdigit, ctype_word,
- ctype_meta);
-
-printf(" ");
-for (i = 0; i < 256; i++)
- {
- if ((i & 7) == 0 && i != 0)
- {
- printf(" /* ");
- if (isprint(i-8)) printf(" %c -", i-8);
- else printf("%3d-", i-8);
- if (isprint(i-1)) printf(" %c ", i-1);
- else printf("%3d", i-1);
- printf(" */\n ");
- }
- printf("0x%02x", *tables++);
- if (i != 255) printf(",");
- }
-
-printf("};/* ");
-if (isprint(i-8)) printf(" %c -", i-8);
- else printf("%3d-", i-8);
-if (isprint(i-1)) printf(" %c ", i-1);
- else printf("%3d", i-1);
-printf(" */\n\n/* End of chartables.c */\n");
-
-return 0;
-}
-
-/* End of dftables.c */
diff --git a/ext/pcre/pcrelib/dll.mk b/ext/pcre/pcrelib/dll.mk
deleted file mode 100644
index d8b728e57e..0000000000
--- a/ext/pcre/pcrelib/dll.mk
+++ /dev/null
@@ -1,60 +0,0 @@
-# dll.mk - auxilary Makefile to easy build dll's for mingw32 target
-# ver. 0.6 of 1999-03-25
-#
-# Homepage of this makefile - http://www.is.lg.ua/~paul/devel/
-# Homepage of original mingw32 project -
-# http://www.fu.is.saga-u.ac.jp/~colin/gcc.html
-#
-# How to use:
-# This makefile can:
-# 1. Create automatical .def file from list of objects
-# 2. Create .dll from objects and .def file, either automatical, or your
-# hand-written (maybe) file, which must have same basename as dll
-# WARNING! There MUST be object, which name match dll's name. Make sux.
-# 3. Create import library from .def (as for .dll, only its name required,
-# not dll itself)
-# By convention implibs for dll have .dll.a suffix, e.g. libstuff.dll.a
-# Why not just libstuff.a? 'Cos that's name for static lib, ok?
-# Process divided into 3 phases because:
-# 1. Pre-existent .def possible
-# 2. Generating implib is enough time-consuming
-#
-# Variables:
-# DLL_LDLIBS - libs for linking dll
-# DLL_LDFLAGS - flags for linking dll
-#
-# By using $(DLL_SUFFIX) instead of 'dll', e.g. stuff.$(DLL_SUFFIX)
-# you may help porting makefiles to other platforms
-#
-# Put this file in your make's include path (e.g. main include dir, for
-# more information see include section in make doc). Put in the beginning
-# of your own Makefile line "include dll.mk". Specify dependences, e.g.:
-#
-# Do all stuff in one step
-# libstuff.dll.a: $(OBJECTS) stuff.def
-# stuff.def: $(OBJECTS)
-#
-# Steps separated, pre-provided .def, link with user32
-#
-# DLL_LDLIBS=-luser32
-# stuff.dll: $(OBJECTS)
-# libstuff.dll.a: $(OBJECTS)
-
-
-DLLWRAP=dllwrap
-DLLTOOL=dlltool
-
-DLL_SUFFIX=dll
-
-.SUFFIXES: .o .$(DLL_SUFFIX)
-
-_%.def: %.o
- $(DLLTOOL) --export-all --output-def $@ $^
-
-%.$(DLL_SUFFIX): %.o
- $(DLLWRAP) --dllname $(notdir $@) --driver-name $(CC) --def $*.def -o $@ $(filter %.o,$^) $(DLL_LDFLAGS) $(DLL_LDLIBS)
-
-lib%.$(DLL_SUFFIX).a:%.def
- $(DLLTOOL) --dllname $(notdir $*.dll) --def $< --output-lib $@
-
-# End
diff --git a/ext/pcre/pcrelib/doc/Tech.Notes b/ext/pcre/pcrelib/doc/Tech.Notes
deleted file mode 100644
index df8f21892f..0000000000
--- a/ext/pcre/pcrelib/doc/Tech.Notes
+++ /dev/null
@@ -1,253 +0,0 @@
-Technical Notes about PCRE
---------------------------
-
-Many years ago I implemented some regular expression functions to an algorithm
-suggested by Martin Richards. These were not Unix-like in form, and were quite
-restricted in what they could do by comparison with Perl. The interesting part
-about the algorithm was that the amount of space required to hold the compiled
-form of an expression was known in advance. The code to apply an expression did
-not operate by backtracking, as the Henry Spencer and Perl code does, but
-instead checked all possibilities simultaneously by keeping a list of current
-states and checking all of them as it advanced through the subject string. (In
-the terminology of Jeffrey Friedl's book, it was a "DFA algorithm".) When the
-pattern was all used up, all remaining states were possible matches, and the
-one matching the longest subset of the subject string was chosen. This did not
-necessarily maximize the individual wild portions of the pattern, as is
-expected in Unix and Perl-style regular expressions.
-
-By contrast, the code originally written by Henry Spencer and subsequently
-heavily modified for Perl actually compiles the expression twice: once in a
-dummy mode in order to find out how much store will be needed, and then for
-real. The execution function operates by backtracking and maximizing (or,
-optionally, minimizing in Perl) the amount of the subject that matches
-individual wild portions of the pattern. This is an "NFA algorithm" in Friedl's
-terminology.
-
-For the set of functions that forms PCRE (which are unrelated to those
-mentioned above), I tried at first to invent an algorithm that used an amount
-of store bounded by a multiple of the number of characters in the pattern, to
-save on compiling time. However, because of the greater complexity in Perl
-regular expressions, I couldn't do this. In any case, a first pass through the
-pattern is needed, in order to find internal flag settings like (?i) at top
-level. So PCRE works by running a very degenerate first pass to calculate a
-maximum store size, and then a second pass to do the real compile - which may
-use a bit less than the predicted amount of store. The idea is that this is
-going to turn out faster because the first pass is degenerate and the second
-pass can just store stuff straight into the vector. It does make the compiling
-functions bigger, of course, but they have got quite big anyway to handle all
-the Perl stuff.
-
-The compiled form of a pattern is a vector of bytes, containing items of
-variable length. The first byte in an item is an opcode, and the length of the
-item is either implicit in the opcode or contained in the data bytes which
-follow it. A list of all the opcodes follows:
-
-Opcodes with no following data
-------------------------------
-
-These items are all just one byte long
-
- OP_END end of pattern
- OP_ANY match any character
- OP_SOD match start of data: \A
- OP_CIRC ^ (start of data, or after \n in multiline)
- OP_NOT_WORD_BOUNDARY \W
- OP_WORD_BOUNDARY \w
- OP_NOT_DIGIT \D
- OP_DIGIT \d
- OP_NOT_WHITESPACE \S
- OP_WHITESPACE \s
- OP_NOT_WORDCHAR \W
- OP_WORDCHAR \w
- OP_EODN match end of data or \n at end: \Z
- OP_EOD match end of data: \z
- OP_DOLL $ (end of data, or before \n in multiline)
- OP_RECURSE match the pattern recursively
-
-
-Repeating single characters
----------------------------
-
-The common repeats (*, +, ?) when applied to a single character appear as
-two-byte items using the following opcodes:
-
- OP_STAR
- OP_MINSTAR
- OP_PLUS
- OP_MINPLUS
- OP_QUERY
- OP_MINQUERY
-
-Those with "MIN" in their name are the minimizing versions. Each is followed by
-the character that is to be repeated. Other repeats make use of
-
- OP_UPTO
- OP_MINUPTO
- OP_EXACT
-
-which are followed by a two-byte count (most significant first) and the
-repeated character. OP_UPTO matches from 0 to the given number. A repeat with a
-non-zero minimum and a fixed maximum is coded as an OP_EXACT followed by an
-OP_UPTO (or OP_MINUPTO).
-
-
-Repeating character types
--------------------------
-
-Repeats of things like \d are done exactly as for single characters, except
-that instead of a character, the opcode for the type is stored in the data
-byte. The opcodes are:
-
- OP_TYPESTAR
- OP_TYPEMINSTAR
- OP_TYPEPLUS
- OP_TYPEMINPLUS
- OP_TYPEQUERY
- OP_TYPEMINQUERY
- OP_TYPEUPTO
- OP_TYPEMINUPTO
- OP_TYPEEXACT
-
-
-Matching a character string
----------------------------
-
-The OP_CHARS opcode is followed by a one-byte count and then that number of
-characters. If there are more than 255 characters in sequence, successive
-instances of OP_CHARS are used.
-
-
-Character classes
------------------
-
-OP_CLASS is used for a character class, provided there are at least two
-characters in the class. If there is only one character, OP_CHARS is used for a
-positive class, and OP_NOT for a negative one (that is, for something like
-[^a]). Another set of repeating opcodes (OP_NOTSTAR etc.) are used for a
-repeated, negated, single-character class. The normal ones (OP_STAR etc.) are
-used for a repeated positive single-character class.
-
-OP_CLASS is followed by a 32-byte bit map containing a 1 bit for every
-character that is acceptable. The bits are counted from the least significant
-end of each byte.
-
-
-Back references
----------------
-
-OP_REF is followed by two bytes containing the reference number.
-
-
-Repeating character classes and back references
------------------------------------------------
-
-Single-character classes are handled specially (see above). This applies to
-OP_CLASS and OP_REF. In both cases, the repeat information follows the base
-item. The matching code looks at the following opcode to see if it is one of
-
- OP_CRSTAR
- OP_CRMINSTAR
- OP_CRPLUS
- OP_CRMINPLUS
- OP_CRQUERY
- OP_CRMINQUERY
- OP_CRRANGE
- OP_CRMINRANGE
-
-All but the last two are just single-byte items. The others are followed by
-four bytes of data, comprising the minimum and maximum repeat counts.
-
-
-Brackets and alternation
-------------------------
-
-A pair of non-capturing (round) brackets is wrapped round each expression at
-compile time, so alternation always happens in the context of brackets.
-
-Non-capturing brackets use the opcode OP_BRA, while capturing brackets use
-OP_BRA+1, OP_BRA+2, etc. [Note for North Americans: "bracket" to some English
-speakers, including myself, can be round, square, curly, or pointy. Hence this
-usage.]
-
-Originally PCRE was limited to 99 capturing brackets (so as not to use up all
-the opcodes). From release 3.5, there is no limit. What happens is that the
-first ones, up to EXTRACT_BASIC_MAX are handled with separate opcodes, as
-above. If there are more, the opcode is set to EXTRACT_BASIC_MAX+1, and the
-first operation in the bracket is OP_BRANUMBER, followed by a 2-byte bracket
-number. This opcode is ignored while matching, but is fished out when handling
-the bracket itself. (They could have all been done like this, but I was making
-minimal changes.)
-
-A bracket opcode is followed by two bytes which give the offset to the next
-alternative OP_ALT or, if there aren't any branches, to the matching KET
-opcode. Each OP_ALT is followed by two bytes giving the offset to the next one,
-or to the KET opcode.
-
-OP_KET is used for subpatterns that do not repeat indefinitely, while
-OP_KETRMIN and OP_KETRMAX are used for indefinite repetitions, minimally or
-maximally respectively. All three are followed by two bytes giving (as a
-positive number) the offset back to the matching BRA opcode.
-
-If a subpattern is quantified such that it is permitted to match zero times, it
-is preceded by one of OP_BRAZERO or OP_BRAMINZERO. These are single-byte
-opcodes which tell the matcher that skipping this subpattern entirely is a
-valid branch.
-
-A subpattern with an indefinite maximum repetition is replicated in the
-compiled data its minimum number of times (or once with a BRAZERO if the
-minimum is zero), with the final copy terminating with a KETRMIN or KETRMAX as
-appropriate.
-
-A subpattern with a bounded maximum repetition is replicated in a nested
-fashion up to the maximum number of times, with BRAZERO or BRAMINZERO before
-each replication after the minimum, so that, for example, (abc){2,5} is
-compiled as (abc)(abc)((abc)((abc)(abc)?)?)?. The 99 and 200 bracket limits do
-not apply to these internally generated brackets.
-
-
-Assertions
-----------
-
-Forward assertions are just like other subpatterns, but starting with one of
-the opcodes OP_ASSERT or OP_ASSERT_NOT. Backward assertions use the opcodes
-OP_ASSERTBACK and OP_ASSERTBACK_NOT, and the first opcode inside the assertion
-is OP_REVERSE, followed by a two byte count of the number of characters to move
-back the pointer in the subject string. When operating in UTF-8 mode, the count
-is a character count rather than a byte count. A separate count is present in
-each alternative of a lookbehind assertion, allowing them to have different
-fixed lengths.
-
-
-Once-only subpatterns
----------------------
-
-These are also just like other subpatterns, but they start with the opcode
-OP_ONCE.
-
-
-Conditional subpatterns
------------------------
-
-These are like other subpatterns, but they start with the opcode OP_COND. If
-the condition is a back reference, this is stored at the start of the
-subpattern using the opcode OP_CREF followed by two bytes containing the
-reference number. If the condition is "in recursion" (coded as "(?(R)"), the
-same scheme is used, with a "reference number" of 0xffff. Otherwise, a
-conditional subpattern always starts with one of the assertions.
-
-
-Changing options
-----------------
-
-If any of the /i, /m, or /s options are changed within a pattern, an OP_OPT
-opcode is compiled, followed by one byte containing the new settings of these
-flags. If there are several alternatives, there is an occurrence of OP_OPT at
-the start of all those following the first options change, to set appropriate
-options for the start of the alternative. Immediately after the end of the
-group there is another such item to reset the flags to their previous values. A
-change of flag right at the very start of the pattern can be handled entirely
-at compile time, and so does not cause anything to be put into the compiled
-data.
-
-Philip Hazel
-August 2002
diff --git a/ext/pcre/pcrelib/doc/pcre.3 b/ext/pcre/pcrelib/doc/pcre.3
deleted file mode 100644
index 4827c5e21d..0000000000
--- a/ext/pcre/pcrelib/doc/pcre.3
+++ /dev/null
@@ -1,1993 +0,0 @@
-.TH PCRE 3
-.SH NAME
-pcre - Perl-compatible regular expressions.
-.SH SYNOPSIS
-.B #include <pcre.h>
-.PP
-.SM
-.br
-.B pcre *pcre_compile(const char *\fIpattern\fR, int \fIoptions\fR,
-.ti +5n
-.B const char **\fIerrptr\fR, int *\fIerroffset\fR,
-.ti +5n
-.B const unsigned char *\fItableptr\fR);
-.PP
-.br
-.B pcre_extra *pcre_study(const pcre *\fIcode\fR, int \fIoptions\fR,
-.ti +5n
-.B const char **\fIerrptr\fR);
-.PP
-.br
-.B int pcre_exec(const pcre *\fIcode\fR, "const pcre_extra *\fIextra\fR,"
-.ti +5n
-.B "const char *\fIsubject\fR," int \fIlength\fR, int \fIstartoffset\fR,
-.ti +5n
-.B int \fIoptions\fR, int *\fIovector\fR, int \fIovecsize\fR);
-.PP
-.br
-.B int pcre_copy_substring(const char *\fIsubject\fR, int *\fIovector\fR,
-.ti +5n
-.B int \fIstringcount\fR, int \fIstringnumber\fR, char *\fIbuffer\fR,
-.ti +5n
-.B int \fIbuffersize\fR);
-.PP
-.br
-.B int pcre_get_substring(const char *\fIsubject\fR, int *\fIovector\fR,
-.ti +5n
-.B int \fIstringcount\fR, int \fIstringnumber\fR,
-.ti +5n
-.B const char **\fIstringptr\fR);
-.PP
-.br
-.B int pcre_get_substring_list(const char *\fIsubject\fR,
-.ti +5n
-.B int *\fIovector\fR, int \fIstringcount\fR, "const char ***\fIlistptr\fR);"
-.PP
-.br
-.B void pcre_free_substring(const char *\fIstringptr\fR);
-.PP
-.br
-.B void pcre_free_substring_list(const char **\fIstringptr\fR);
-.PP
-.br
-.B const unsigned char *pcre_maketables(void);
-.PP
-.br
-.B int pcre_fullinfo(const pcre *\fIcode\fR, "const pcre_extra *\fIextra\fR,"
-.ti +5n
-.B int \fIwhat\fR, void *\fIwhere\fR);
-.PP
-.br
-.B int pcre_info(const pcre *\fIcode\fR, int *\fIoptptr\fR, int
-.B *\fIfirstcharptr\fR);
-.PP
-.br
-.B char *pcre_version(void);
-.PP
-.br
-.B void *(*pcre_malloc)(size_t);
-.PP
-.br
-.B void (*pcre_free)(void *);
-
-
-
-.SH DESCRIPTION
-The PCRE library is a set of functions that implement regular expression
-pattern matching using the same syntax and semantics as Perl 5, with just a few
-differences (see below). The current implementation corresponds to Perl 5.005,
-with some additional features from later versions. This includes some
-experimental, incomplete support for UTF-8 encoded strings. Details of exactly
-what is and what is not supported are given below.
-
-PCRE has its own native API, which is described in this document. There is also
-a set of wrapper functions that correspond to the POSIX regular expression API.
-These are described in the \fBpcreposix\fR documentation.
-
-The native API function prototypes are defined in the header file \fBpcre.h\fR,
-and on Unix systems the library itself is called \fBlibpcre.a\fR, so can be
-accessed by adding \fB-lpcre\fR to the command for linking an application which
-calls it. The header file defines the macros PCRE_MAJOR and PCRE_MINOR to
-contain the major and minor release numbers for the library. Applications can
-use these to include support for different releases.
-
-The functions \fBpcre_compile()\fR, \fBpcre_study()\fR, and \fBpcre_exec()\fR
-are used for compiling and matching regular expressions. A sample program that
-demonstrates the simplest way of using them is given in the file
-\fIpcredemo.c\fR. The last section of this man page describes how to run it.
-
-The functions \fBpcre_copy_substring()\fR, \fBpcre_get_substring()\fR, and
-\fBpcre_get_substring_list()\fR are convenience functions for extracting
-captured substrings from a matched subject string; \fBpcre_free_substring()\fR
-and \fBpcre_free_substring_list()\fR are also provided, to free the memory used
-for extracted strings.
-
-The function \fBpcre_maketables()\fR is used (optionally) to build a set of
-character tables in the current locale for passing to \fBpcre_compile()\fR.
-
-The function \fBpcre_fullinfo()\fR is used to find out information about a
-compiled pattern; \fBpcre_info()\fR is an obsolete version which returns only
-some of the available information, but is retained for backwards compatibility.
-The function \fBpcre_version()\fR returns a pointer to a string containing the
-version of PCRE and its date of release.
-
-The global variables \fBpcre_malloc\fR and \fBpcre_free\fR initially contain
-the entry points of the standard \fBmalloc()\fR and \fBfree()\fR functions
-respectively. PCRE calls the memory management functions via these variables,
-so a calling program can replace them if it wishes to intercept the calls. This
-should be done before calling any PCRE functions.
-
-
-.SH MULTI-THREADING
-The PCRE functions can be used in multi-threading applications, with the
-proviso that the memory management functions pointed to by \fBpcre_malloc\fR
-and \fBpcre_free\fR are shared by all threads.
-
-The compiled form of a regular expression is not altered during matching, so
-the same compiled pattern can safely be used by several threads at once.
-
-
-.SH COMPILING A PATTERN
-The function \fBpcre_compile()\fR is called to compile a pattern into an
-internal form. The pattern is a C string terminated by a binary zero, and
-is passed in the argument \fIpattern\fR. A pointer to a single block of memory
-that is obtained via \fBpcre_malloc\fR is returned. This contains the compiled
-code and related data. The \fBpcre\fR type is defined for the returned block;
-this is a typedef for a structure whose contents are not externally defined. It
-is up to the caller to free the memory when it is no longer required.
-
-Although the compiled code of a PCRE regex is relocatable, that is, it does not
-depend on memory location, the complete \fBpcre\fR data block is not
-fully relocatable, because it contains a copy of the \fItableptr\fR argument,
-which is an address (see below).
-
-The size of a compiled pattern is roughly proportional to the length of the
-pattern string, except that each character class (other than those containing
-just a single character, negated or not) requires 33 bytes, and repeat
-quantifiers with a minimum greater than one or a bounded maximum cause the
-relevant portions of the compiled pattern to be replicated.
-
-The \fIoptions\fR argument contains independent bits that affect the
-compilation. It should be zero if no options are required. Some of the options,
-in particular, those that are compatible with Perl, can also be set and unset
-from within the pattern (see the detailed description of regular expressions
-below). For these options, the contents of the \fIoptions\fR argument specifies
-their initial settings at the start of compilation and execution. The
-PCRE_ANCHORED option can be set at the time of matching as well as at compile
-time.
-
-If \fIerrptr\fR is NULL, \fBpcre_compile()\fR returns NULL immediately.
-Otherwise, if compilation of a pattern fails, \fBpcre_compile()\fR returns
-NULL, and sets the variable pointed to by \fIerrptr\fR to point to a textual
-error message. The offset from the start of the pattern to the character where
-the error was discovered is placed in the variable pointed to by
-\fIerroffset\fR, which must not be NULL. If it is, an immediate error is given.
-
-If the final argument, \fItableptr\fR, is NULL, PCRE uses a default set of
-character tables which are built when it is compiled, using the default C
-locale. Otherwise, \fItableptr\fR must be the result of a call to
-\fBpcre_maketables()\fR. See the section on locale support below.
-
-This code fragment shows a typical straightforward call to \fBpcre_compile()\fR:
-
- pcre *re;
- const char *error;
- int erroffset;
- re = pcre_compile(
- "^A.*Z", /* the pattern */
- 0, /* default options */
- &error, /* for error message */
- &erroffset, /* for error offset */
- NULL); /* use default character tables */
-
-The following option bits are defined in the header file:
-
- PCRE_ANCHORED
-
-If this bit is set, the pattern is forced to be "anchored", that is, it is
-constrained to match only at the start of the string which is being searched
-(the "subject string"). This effect can also be achieved by appropriate
-constructs in the pattern itself, which is the only way to do it in Perl.
-
- PCRE_CASELESS
-
-If this bit is set, letters in the pattern match both upper and lower case
-letters. It is equivalent to Perl's /i option.
-
- PCRE_DOLLAR_ENDONLY
-
-If this bit is set, a dollar metacharacter in the pattern matches only at the
-end of the subject string. Without this option, a dollar also matches
-immediately before the final character if it is a newline (but not before any
-other newlines). The PCRE_DOLLAR_ENDONLY option is ignored if PCRE_MULTILINE is
-set. There is no equivalent to this option in Perl.
-
- PCRE_DOTALL
-
-If this bit is set, a dot metacharater in the pattern matches all characters,
-including newlines. Without it, newlines are excluded. This option is
-equivalent to Perl's /s option. A negative class such as [^a] always matches a
-newline character, independent of the setting of this option.
-
- PCRE_EXTENDED
-
-If this bit is set, whitespace data characters in the pattern are totally
-ignored except when escaped or inside a character class, and characters between
-an unescaped # outside a character class and the next newline character,
-inclusive, are also ignored. This is equivalent to Perl's /x option, and makes
-it possible to include comments inside complicated patterns. Note, however,
-that this applies only to data characters. Whitespace characters may never
-appear within special character sequences in a pattern, for example within the
-sequence (?( which introduces a conditional subpattern.
-
- PCRE_EXTRA
-
-This option was invented in order to turn on additional functionality of PCRE
-that is incompatible with Perl, but it is currently of very little use. When
-set, any backslash in a pattern that is followed by a letter that has no
-special meaning causes an error, thus reserving these combinations for future
-expansion. By default, as in Perl, a backslash followed by a letter with no
-special meaning is treated as a literal. There are at present no other features
-controlled by this option. It can also be set by a (?X) option setting within a
-pattern.
-
- PCRE_MULTILINE
-
-By default, PCRE treats the subject string as consisting of a single "line" of
-characters (even if it actually contains several newlines). The "start of line"
-metacharacter (^) matches only at the start of the string, while the "end of
-line" metacharacter ($) matches only at the end of the string, or before a
-terminating newline (unless PCRE_DOLLAR_ENDONLY is set). This is the same as
-Perl.
-
-When PCRE_MULTILINE it is set, the "start of line" and "end of line" constructs
-match immediately following or immediately before any newline in the subject
-string, respectively, as well as at the very start and end. This is equivalent
-to Perl's /m option. If there are no "\\n" characters in a subject string, or
-no occurrences of ^ or $ in a pattern, setting PCRE_MULTILINE has no
-effect.
-
- PCRE_UNGREEDY
-
-This option inverts the "greediness" of the quantifiers so that they are not
-greedy by default, but become greedy if followed by "?". It is not compatible
-with Perl. It can also be set by a (?U) option setting within the pattern.
-
- PCRE_UTF8
-
-This option causes PCRE to regard both the pattern and the subject as strings
-of UTF-8 characters instead of just byte strings. However, it is available only
-if PCRE has been built to include UTF-8 support. If not, the use of this option
-provokes an error. Support for UTF-8 is new, experimental, and incomplete.
-Details of exactly what it entails are given below.
-
-
-.SH STUDYING A PATTERN
-When a pattern is going to be used several times, it is worth spending more
-time analyzing it in order to speed up the time taken for matching. The
-function \fBpcre_study()\fR takes a pointer to a compiled pattern as its first
-argument, and returns a pointer to a \fBpcre_extra\fR block (another typedef
-for a structure with hidden contents) containing additional information about
-the pattern; this can be passed to \fBpcre_exec()\fR. If no additional
-information is available, NULL is returned.
-
-The second argument contains option bits. At present, no options are defined
-for \fBpcre_study()\fR, and this argument should always be zero.
-
-The third argument for \fBpcre_study()\fR is a pointer to an error message. If
-studying succeeds (even if no data is returned), the variable it points to is
-set to NULL. Otherwise it points to a textual error message.
-
-This is a typical call to \fBpcre_study\fR():
-
- pcre_extra *pe;
- pe = pcre_study(
- re, /* result of pcre_compile() */
- 0, /* no options exist */
- &error); /* set to NULL or points to a message */
-
-At present, studying a pattern is useful only for non-anchored patterns that do
-not have a single fixed starting character. A bitmap of possible starting
-characters is created.
-
-
-.SH LOCALE SUPPORT
-PCRE handles caseless matching, and determines whether characters are letters,
-digits, or whatever, by reference to a set of tables. The library contains a
-default set of tables which is created in the default C locale when PCRE is
-compiled. This is used when the final argument of \fBpcre_compile()\fR is NULL,
-and is sufficient for many applications.
-
-An alternative set of tables can, however, be supplied. Such tables are built
-by calling the \fBpcre_maketables()\fR function, which has no arguments, in the
-relevant locale. The result can then be passed to \fBpcre_compile()\fR as often
-as necessary. For example, to build and use tables that are appropriate for the
-French locale (where accented characters with codes greater than 128 are
-treated as letters), the following code could be used:
-
- setlocale(LC_CTYPE, "fr");
- tables = pcre_maketables();
- re = pcre_compile(..., tables);
-
-The tables are built in memory that is obtained via \fBpcre_malloc\fR. The
-pointer that is passed to \fBpcre_compile\fR is saved with the compiled
-pattern, and the same tables are used via this pointer by \fBpcre_study()\fR
-and \fBpcre_exec()\fR. Thus for any single pattern, compilation, studying and
-matching all happen in the same locale, but different patterns can be compiled
-in different locales. It is the caller's responsibility to ensure that the
-memory containing the tables remains available for as long as it is needed.
-
-
-.SH INFORMATION ABOUT A PATTERN
-The \fBpcre_fullinfo()\fR function returns information about a compiled
-pattern. It replaces the obsolete \fBpcre_info()\fR function, which is
-nevertheless retained for backwards compability (and is documented below).
-
-The first argument for \fBpcre_fullinfo()\fR is a pointer to the compiled
-pattern. The second argument is the result of \fBpcre_study()\fR, or NULL if
-the pattern was not studied. The third argument specifies which piece of
-information is required, while the fourth argument is a pointer to a variable
-to receive the data. The yield of the function is zero for success, or one of
-the following negative numbers:
-
- PCRE_ERROR_NULL the argument \fIcode\fR was NULL
- the argument \fIwhere\fR was NULL
- PCRE_ERROR_BADMAGIC the "magic number" was not found
- PCRE_ERROR_BADOPTION the value of \fIwhat\fR was invalid
-
-Here is a typical call of \fBpcre_fullinfo()\fR, to obtain the length of the
-compiled pattern:
-
- int rc;
- unsigned long int length;
- rc = pcre_fullinfo(
- re, /* result of pcre_compile() */
- pe, /* result of pcre_study(), or NULL */
- PCRE_INFO_SIZE, /* what is required */
- &length); /* where to put the data */
-
-The possible values for the third argument are defined in \fBpcre.h\fR, and are
-as follows:
-
- PCRE_INFO_OPTIONS
-
-Return a copy of the options with which the pattern was compiled. The fourth
-argument should point to an \fBunsigned long int\fR variable. These option bits
-are those specified in the call to \fBpcre_compile()\fR, modified by any
-top-level option settings within the pattern itself, and with the PCRE_ANCHORED
-bit forcibly set if the form of the pattern implies that it can match only at
-the start of a subject string.
-
- PCRE_INFO_SIZE
-
-Return the size of the compiled pattern, that is, the value that was passed as
-the argument to \fBpcre_malloc()\fR when PCRE was getting memory in which to
-place the compiled data. The fourth argument should point to a \fBsize_t\fR
-variable.
-
- PCRE_INFO_CAPTURECOUNT
-
-Return the number of capturing subpatterns in the pattern. The fourth argument
-should point to an \fbint\fR variable.
-
- PCRE_INFO_BACKREFMAX
-
-Return the number of the highest back reference in the pattern. The fourth
-argument should point to an \fBint\fR variable. Zero is returned if there are
-no back references.
-
- PCRE_INFO_FIRSTCHAR
-
-Return information about the first character of any matched string, for a
-non-anchored pattern. If there is a fixed first character, e.g. from a pattern
-such as (cat|cow|coyote), it is returned in the integer pointed to by
-\fIwhere\fR. Otherwise, if either
-
-(a) the pattern was compiled with the PCRE_MULTILINE option, and every branch
-starts with "^", or
-
-(b) every branch of the pattern starts with ".*" and PCRE_DOTALL is not set
-(if it were set, the pattern would be anchored),
-
--1 is returned, indicating that the pattern matches only at the start of a
-subject string or after any "\\n" within the string. Otherwise -2 is returned.
-For anchored patterns, -2 is returned.
-
- PCRE_INFO_FIRSTTABLE
-
-If the pattern was studied, and this resulted in the construction of a 256-bit
-table indicating a fixed set of characters for the first character in any
-matching string, a pointer to the table is returned. Otherwise NULL is
-returned. The fourth argument should point to an \fBunsigned char *\fR
-variable.
-
- PCRE_INFO_LASTLITERAL
-
-For a non-anchored pattern, return the value of the rightmost literal character
-which must exist in any matched string, other than at its start. The fourth
-argument should point to an \fBint\fR variable. If there is no such character,
-or if the pattern is anchored, -1 is returned. For example, for the pattern
-/a\\d+z\\d+/ the returned value is 'z'.
-
-The \fBpcre_info()\fR function is now obsolete because its interface is too
-restrictive to return all the available data about a compiled pattern. New
-programs should use \fBpcre_fullinfo()\fR instead. The yield of
-\fBpcre_info()\fR is the number of capturing subpatterns, or one of the
-following negative numbers:
-
- PCRE_ERROR_NULL the argument \fIcode\fR was NULL
- PCRE_ERROR_BADMAGIC the "magic number" was not found
-
-If the \fIoptptr\fR argument is not NULL, a copy of the options with which the
-pattern was compiled is placed in the integer it points to (see
-PCRE_INFO_OPTIONS above).
-
-If the pattern is not anchored and the \fIfirstcharptr\fR argument is not NULL,
-it is used to pass back information about the first character of any matched
-string (see PCRE_INFO_FIRSTCHAR above).
-
-
-.SH MATCHING A PATTERN
-The function \fBpcre_exec()\fR is called to match a subject string against a
-pre-compiled pattern, which is passed in the \fIcode\fR argument. If the
-pattern has been studied, the result of the study should be passed in the
-\fIextra\fR argument. Otherwise this must be NULL.
-
-Here is an example of a simple call to \fBpcre_exec()\fR:
-
- int rc;
- int ovector[30];
- rc = pcre_exec(
- re, /* result of pcre_compile() */
- NULL, /* we didn't study the pattern */
- "some string", /* the subject string */
- 11, /* the length of the subject string */
- 0, /* start at offset 0 in the subject */
- 0, /* default options */
- ovector, /* vector for substring information */
- 30); /* number of elements in the vector */
-
-The PCRE_ANCHORED option can be passed in the \fIoptions\fR argument, whose
-unused bits must be zero. However, if a pattern was compiled with
-PCRE_ANCHORED, or turned out to be anchored by virtue of its contents, it
-cannot be made unachored at matching time.
-
-There are also three further options that can be set only at matching time:
-
- PCRE_NOTBOL
-
-The first character of the string is not the beginning of a line, so the
-circumflex metacharacter should not match before it. Setting this without
-PCRE_MULTILINE (at compile time) causes circumflex never to match.
-
- PCRE_NOTEOL
-
-The end of the string is not the end of a line, so the dollar metacharacter
-should not match it nor (except in multiline mode) a newline immediately before
-it. Setting this without PCRE_MULTILINE (at compile time) causes dollar never
-to match.
-
- PCRE_NOTEMPTY
-
-An empty string is not considered to be a valid match if this option is set. If
-there are alternatives in the pattern, they are tried. If all the alternatives
-match the empty string, the entire match fails. For example, if the pattern
-
- a?b?
-
-is applied to a string not beginning with "a" or "b", it matches the empty
-string at the start of the subject. With PCRE_NOTEMPTY set, this match is not
-valid, so PCRE searches further into the string for occurrences of "a" or "b".
-
-Perl has no direct equivalent of PCRE_NOTEMPTY, but it does make a special case
-of a pattern match of the empty string within its \fBsplit()\fR function, and
-when using the /g modifier. It is possible to emulate Perl's behaviour after
-matching a null string by first trying the match again at the same offset with
-PCRE_NOTEMPTY set, and then if that fails by advancing the starting offset (see
-below) and trying an ordinary match again.
-
-The subject string is passed as a pointer in \fIsubject\fR, a length in
-\fIlength\fR, and a starting offset in \fIstartoffset\fR. Unlike the pattern
-string, the subject may contain binary zero characters. When the starting
-offset is zero, the search for a match starts at the beginning of the subject,
-and this is by far the most common case.
-
-A non-zero starting offset is useful when searching for another match in the
-same subject by calling \fBpcre_exec()\fR again after a previous success.
-Setting \fIstartoffset\fR differs from just passing over a shortened string and
-setting PCRE_NOTBOL in the case of a pattern that begins with any kind of
-lookbehind. For example, consider the pattern
-
- \\Biss\\B
-
-which finds occurrences of "iss" in the middle of words. (\\B matches only if
-the current position in the subject is not a word boundary.) When applied to
-the string "Mississipi" the first call to \fBpcre_exec()\fR finds the first
-occurrence. If \fBpcre_exec()\fR is called again with just the remainder of the
-subject, namely "issipi", it does not match, because \\B is always false at the
-start of the subject, which is deemed to be a word boundary. However, if
-\fBpcre_exec()\fR is passed the entire string again, but with \fIstartoffset\fR
-set to 4, it finds the second occurrence of "iss" because it is able to look
-behind the starting point to discover that it is preceded by a letter.
-
-If a non-zero starting offset is passed when the pattern is anchored, one
-attempt to match at the given offset is tried. This can only succeed if the
-pattern does not require the match to be at the start of the subject.
-
-In general, a pattern matches a certain portion of the subject, and in
-addition, further substrings from the subject may be picked out by parts of the
-pattern. Following the usage in Jeffrey Friedl's book, this is called
-"capturing" in what follows, and the phrase "capturing subpattern" is used for
-a fragment of a pattern that picks out a substring. PCRE supports several other
-kinds of parenthesized subpattern that do not cause substrings to be captured.
-
-Captured substrings are returned to the caller via a vector of integer offsets
-whose address is passed in \fIovector\fR. The number of elements in the vector
-is passed in \fIovecsize\fR. The first two-thirds of the vector is used to pass
-back captured substrings, each substring using a pair of integers. The
-remaining third of the vector is used as workspace by \fBpcre_exec()\fR while
-matching capturing subpatterns, and is not available for passing back
-information. The length passed in \fIovecsize\fR should always be a multiple of
-three. If it is not, it is rounded down.
-
-When a match has been successful, information about captured substrings is
-returned in pairs of integers, starting at the beginning of \fIovector\fR, and
-continuing up to two-thirds of its length at the most. The first element of a
-pair is set to the offset of the first character in a substring, and the second
-is set to the offset of the first character after the end of a substring. The
-first pair, \fIovector[0]\fR and \fIovector[1]\fR, identify the portion of the
-subject string matched by the entire pattern. The next pair is used for the
-first capturing subpattern, and so on. The value returned by \fBpcre_exec()\fR
-is the number of pairs that have been set. If there are no capturing
-subpatterns, the return value from a successful match is 1, indicating that
-just the first pair of offsets has been set.
-
-Some convenience functions are provided for extracting the captured substrings
-as separate strings. These are described in the following section.
-
-It is possible for an capturing subpattern number \fIn+1\fR to match some
-part of the subject when subpattern \fIn\fR has not been used at all. For
-example, if the string "abc" is matched against the pattern (a|(z))(bc)
-subpatterns 1 and 3 are matched, but 2 is not. When this happens, both offset
-values corresponding to the unused subpattern are set to -1.
-
-If a capturing subpattern is matched repeatedly, it is the last portion of the
-string that it matched that gets returned.
-
-If the vector is too small to hold all the captured substrings, it is used as
-far as possible (up to two-thirds of its length), and the function returns a
-value of zero. In particular, if the substring offsets are not of interest,
-\fBpcre_exec()\fR may be called with \fIovector\fR passed as NULL and
-\fIovecsize\fR as zero. However, if the pattern contains back references and
-the \fIovector\fR isn't big enough to remember the related substrings, PCRE has
-to get additional memory for use during matching. Thus it is usually advisable
-to supply an \fIovector\fR.
-
-Note that \fBpcre_info()\fR can be used to find out how many capturing
-subpatterns there are in a compiled pattern. The smallest size for
-\fIovector\fR that will allow for \fIn\fR captured substrings in addition to
-the offsets of the substring matched by the whole pattern is (\fIn\fR+1)*3.
-
-If \fBpcre_exec()\fR fails, it returns a negative number. The following are
-defined in the header file:
-
- PCRE_ERROR_NOMATCH (-1)
-
-The subject string did not match the pattern.
-
- PCRE_ERROR_NULL (-2)
-
-Either \fIcode\fR or \fIsubject\fR was passed as NULL, or \fIovector\fR was
-NULL and \fIovecsize\fR was not zero.
-
- PCRE_ERROR_BADOPTION (-3)
-
-An unrecognized bit was set in the \fIoptions\fR argument.
-
- PCRE_ERROR_BADMAGIC (-4)
-
-PCRE stores a 4-byte "magic number" at the start of the compiled code, to catch
-the case when it is passed a junk pointer. This is the error it gives when the
-magic number isn't present.
-
- PCRE_ERROR_UNKNOWN_NODE (-5)
-
-While running the pattern match, an unknown item was encountered in the
-compiled pattern. This error could be caused by a bug in PCRE or by overwriting
-of the compiled pattern.
-
- PCRE_ERROR_NOMEMORY (-6)
-
-If a pattern contains back references, but the \fIovector\fR that is passed to
-\fBpcre_exec()\fR is not big enough to remember the referenced substrings, PCRE
-gets a block of memory at the start of matching to use for this purpose. If the
-call via \fBpcre_malloc()\fR fails, this error is given. The memory is freed at
-the end of matching.
-
-
-.SH EXTRACTING CAPTURED SUBSTRINGS
-Captured substrings can be accessed directly by using the offsets returned by
-\fBpcre_exec()\fR in \fIovector\fR. For convenience, the functions
-\fBpcre_copy_substring()\fR, \fBpcre_get_substring()\fR, and
-\fBpcre_get_substring_list()\fR are provided for extracting captured substrings
-as new, separate, zero-terminated strings. A substring that contains a binary
-zero is correctly extracted and has a further zero added on the end, but the
-result does not, of course, function as a C string.
-
-The first three arguments are the same for all three functions: \fIsubject\fR
-is the subject string which has just been successfully matched, \fIovector\fR
-is a pointer to the vector of integer offsets that was passed to
-\fBpcre_exec()\fR, and \fIstringcount\fR is the number of substrings that
-were captured by the match, including the substring that matched the entire
-regular expression. This is the value returned by \fBpcre_exec\fR if it
-is greater than zero. If \fBpcre_exec()\fR returned zero, indicating that it
-ran out of space in \fIovector\fR, the value passed as \fIstringcount\fR should
-be the size of the vector divided by three.
-
-The functions \fBpcre_copy_substring()\fR and \fBpcre_get_substring()\fR
-extract a single substring, whose number is given as \fIstringnumber\fR. A
-value of zero extracts the substring that matched the entire pattern, while
-higher values extract the captured substrings. For \fBpcre_copy_substring()\fR,
-the string is placed in \fIbuffer\fR, whose length is given by
-\fIbuffersize\fR, while for \fBpcre_get_substring()\fR a new block of memory is
-obtained via \fBpcre_malloc\fR, and its address is returned via
-\fIstringptr\fR. The yield of the function is the length of the string, not
-including the terminating zero, or one of
-
- PCRE_ERROR_NOMEMORY (-6)
-
-The buffer was too small for \fBpcre_copy_substring()\fR, or the attempt to get
-memory failed for \fBpcre_get_substring()\fR.
-
- PCRE_ERROR_NOSUBSTRING (-7)
-
-There is no substring whose number is \fIstringnumber\fR.
-
-The \fBpcre_get_substring_list()\fR function extracts all available substrings
-and builds a list of pointers to them. All this is done in a single block of
-memory which is obtained via \fBpcre_malloc\fR. The address of the memory block
-is returned via \fIlistptr\fR, which is also the start of the list of string
-pointers. The end of the list is marked by a NULL pointer. The yield of the
-function is zero if all went well, or
-
- PCRE_ERROR_NOMEMORY (-6)
-
-if the attempt to get the memory block failed.
-
-When any of these functions encounter a substring that is unset, which can
-happen when capturing subpattern number \fIn+1\fR matches some part of the
-subject, but subpattern \fIn\fR has not been used at all, they return an empty
-string. This can be distinguished from a genuine zero-length substring by
-inspecting the appropriate offset in \fIovector\fR, which is negative for unset
-substrings.
-
-The two convenience functions \fBpcre_free_substring()\fR and
-\fBpcre_free_substring_list()\fR can be used to free the memory returned by
-a previous call of \fBpcre_get_substring()\fR or
-\fBpcre_get_substring_list()\fR, respectively. They do nothing more than call
-the function pointed to by \fBpcre_free\fR, which of course could be called
-directly from a C program. However, PCRE is used in some situations where it is
-linked via a special interface to another programming language which cannot use
-\fBpcre_free\fR directly; it is for these cases that the functions are
-provided.
-
-
-.SH LIMITATIONS
-There are some size limitations in PCRE but it is hoped that they will never in
-practice be relevant.
-The maximum length of a compiled pattern is 65539 (sic) bytes.
-All values in repeating quantifiers must be less than 65536.
-There maximum number of capturing subpatterns is 65535.
-There is no limit to the number of non-capturing subpatterns, but the maximum
-depth of nesting of all kinds of parenthesized subpattern, including capturing
-subpatterns, assertions, and other types of subpattern, is 200.
-
-The maximum length of a subject string is the largest positive number that an
-integer variable can hold. However, PCRE uses recursion to handle subpatterns
-and indefinite repetition. This means that the available stack space may limit
-the size of a subject string that can be processed by certain patterns.
-
-
-.SH DIFFERENCES FROM PERL
-The differences described here are with respect to Perl 5.005.
-
-1. By default, a whitespace character is any character that the C library
-function \fBisspace()\fR recognizes, though it is possible to compile PCRE with
-alternative character type tables. Normally \fBisspace()\fR matches space,
-formfeed, newline, carriage return, horizontal tab, and vertical tab. Perl 5
-no longer includes vertical tab in its set of whitespace characters. The \\v
-escape that was in the Perl documentation for a long time was never in fact
-recognized. However, the character itself was treated as whitespace at least
-up to 5.002. In 5.004 and 5.005 it does not match \\s.
-
-2. PCRE does not allow repeat quantifiers on lookahead assertions. Perl permits
-them, but they do not mean what you might think. For example, (?!a){3} does
-not assert that the next three characters are not "a". It just asserts that the
-next character is not "a" three times.
-
-3. Capturing subpatterns that occur inside negative lookahead assertions are
-counted, but their entries in the offsets vector are never set. Perl sets its
-numerical variables from any such patterns that are matched before the
-assertion fails to match something (thereby succeeding), but only if the
-negative lookahead assertion contains just one branch.
-
-4. Though binary zero characters are supported in the subject string, they are
-not allowed in a pattern string because it is passed as a normal C string,
-terminated by zero. The escape sequence "\\0" can be used in the pattern to
-represent a binary zero.
-
-5. The following Perl escape sequences are not supported: \\l, \\u, \\L, \\U,
-\\E, \\Q. In fact these are implemented by Perl's general string-handling and
-are not part of its pattern matching engine.
-
-6. The Perl \\G assertion is not supported as it is not relevant to single
-pattern matches.
-
-7. Fairly obviously, PCRE does not support the (?{code}) and (?p{code})
-constructions. However, there is some experimental support for recursive
-patterns using the non-Perl item (?R).
-
-8. There are at the time of writing some oddities in Perl 5.005_02 concerned
-with the settings of captured strings when part of a pattern is repeated. For
-example, matching "aba" against the pattern /^(a(b)?)+$/ sets $2 to the value
-"b", but matching "aabbaa" against /^(aa(bb)?)+$/ leaves $2 unset. However, if
-the pattern is changed to /^(aa(b(b))?)+$/ then $2 (and $3) are set.
-
-In Perl 5.004 $2 is set in both cases, and that is also true of PCRE. If in the
-future Perl changes to a consistent state that is different, PCRE may change to
-follow.
-
-9. Another as yet unresolved discrepancy is that in Perl 5.005_02 the pattern
-/^(a)?(?(1)a|b)+$/ matches the string "a", whereas in PCRE it does not.
-However, in both Perl and PCRE /^(a)?a/ matched against "a" leaves $1 unset.
-
-10. PCRE provides some extensions to the Perl regular expression facilities:
-
-(a) Although lookbehind assertions must match fixed length strings, each
-alternative branch of a lookbehind assertion can match a different length of
-string. Perl 5.005 requires them all to have the same length.
-
-(b) If PCRE_DOLLAR_ENDONLY is set and PCRE_MULTILINE is not set, the $ meta-
-character matches only at the very end of the string.
-
-(c) If PCRE_EXTRA is set, a backslash followed by a letter with no special
-meaning is faulted.
-
-(d) If PCRE_UNGREEDY is set, the greediness of the repetition quantifiers is
-inverted, that is, by default they are not greedy, but if followed by a
-question mark they are.
-
-(e) PCRE_ANCHORED can be used to force a pattern to be tried only at the start
-of the subject.
-
-(f) The PCRE_NOTBOL, PCRE_NOTEOL, and PCRE_NOTEMPTY options for
-\fBpcre_exec()\fR have no Perl equivalents.
-
-(g) The (?R) construct allows for recursive pattern matching (Perl 5.6 can do
-this using the (?p{code}) construct, which PCRE cannot of course support.)
-
-
-.SH REGULAR EXPRESSION DETAILS
-The syntax and semantics of the regular expressions supported by PCRE are
-described below. Regular expressions are also described in the Perl
-documentation and in a number of other books, some of which have copious
-examples. Jeffrey Friedl's "Mastering Regular Expressions", published by
-O'Reilly (ISBN 1-56592-257), covers them in great detail.
-
-The description here is intended as reference documentation. The basic
-operation of PCRE is on strings of bytes. However, there is the beginnings of
-some support for UTF-8 character strings. To use this support you must
-configure PCRE to include it, and then call \fBpcre_compile()\fR with the
-PCRE_UTF8 option. How this affects the pattern matching is described in the
-final section of this document.
-
-A regular expression is a pattern that is matched against a subject string from
-left to right. Most characters stand for themselves in a pattern, and match the
-corresponding characters in the subject. As a trivial example, the pattern
-
- The quick brown fox
-
-matches a portion of a subject string that is identical to itself. The power of
-regular expressions comes from the ability to include alternatives and
-repetitions in the pattern. These are encoded in the pattern by the use of
-\fImeta-characters\fR, which do not stand for themselves but instead are
-interpreted in some special way.
-
-There are two different sets of meta-characters: those that are recognized
-anywhere in the pattern except within square brackets, and those that are
-recognized in square brackets. Outside square brackets, the meta-characters are
-as follows:
-
- \\ general escape character with several uses
- ^ assert start of subject (or line, in multiline mode)
- $ assert end of subject (or line, in multiline mode)
- . match any character except newline (by default)
- [ start character class definition
- | start of alternative branch
- ( start subpattern
- ) end subpattern
- ? extends the meaning of (
- also 0 or 1 quantifier
- also quantifier minimizer
- * 0 or more quantifier
- + 1 or more quantifier
- { start min/max quantifier
-
-Part of a pattern that is in square brackets is called a "character class". In
-a character class the only meta-characters are:
-
- \\ general escape character
- ^ negate the class, but only if the first character
- - indicates character range
- ] terminates the character class
-
-The following sections describe the use of each of the meta-characters.
-
-
-.SH BACKSLASH
-The backslash character has several uses. Firstly, if it is followed by a
-non-alphameric character, it takes away any special meaning that character may
-have. This use of backslash as an escape character applies both inside and
-outside character classes.
-
-For example, if you want to match a "*" character, you write "\\*" in the
-pattern. This applies whether or not the following character would otherwise be
-interpreted as a meta-character, so it is always safe to precede a
-non-alphameric with "\\" to specify that it stands for itself. In particular,
-if you want to match a backslash, you write "\\\\".
-
-If a pattern is compiled with the PCRE_EXTENDED option, whitespace in the
-pattern (other than in a character class) and characters between a "#" outside
-a character class and the next newline character are ignored. An escaping
-backslash can be used to include a whitespace or "#" character as part of the
-pattern.
-
-A second use of backslash provides a way of encoding non-printing characters
-in patterns in a visible manner. There is no restriction on the appearance of
-non-printing characters, apart from the binary zero that terminates a pattern,
-but when a pattern is being prepared by text editing, it is usually easier to
-use one of the following escape sequences than the binary character it
-represents:
-
- \\a alarm, that is, the BEL character (hex 07)
- \\cx "control-x", where x is any character
- \\e escape (hex 1B)
- \\f formfeed (hex 0C)
- \\n newline (hex 0A)
- \\r carriage return (hex 0D)
- \\t tab (hex 09)
- \\xhh character with hex code hh
- \\ddd character with octal code ddd, or backreference
-
-The precise effect of "\\cx" is as follows: if "x" is a lower case letter, it
-is converted to upper case. Then bit 6 of the character (hex 40) is inverted.
-Thus "\\cz" becomes hex 1A, but "\\c{" becomes hex 3B, while "\\c;" becomes hex
-7B.
-
-After "\\x", up to two hexadecimal digits are read (letters can be in upper or
-lower case).
-
-After "\\0" up to two further octal digits are read. In both cases, if there
-are fewer than two digits, just those that are present are used. Thus the
-sequence "\\0\\x\\07" specifies two binary zeros followed by a BEL character.
-Make sure you supply two digits after the initial zero if the character that
-follows is itself an octal digit.
-
-The handling of a backslash followed by a digit other than 0 is complicated.
-Outside a character class, PCRE reads it and any following digits as a decimal
-number. If the number is less than 10, or if there have been at least that many
-previous capturing left parentheses in the expression, the entire sequence is
-taken as a \fIback reference\fR. A description of how this works is given
-later, following the discussion of parenthesized subpatterns.
-
-Inside a character class, or if the decimal number is greater than 9 and there
-have not been that many capturing subpatterns, PCRE re-reads up to three octal
-digits following the backslash, and generates a single byte from the least
-significant 8 bits of the value. Any subsequent digits stand for themselves.
-For example:
-
- \\040 is another way of writing a space
- \\40 is the same, provided there are fewer than 40
- previous capturing subpatterns
- \\7 is always a back reference
- \\11 might be a back reference, or another way of
- writing a tab
- \\011 is always a tab
- \\0113 is a tab followed by the character "3"
- \\113 is the character with octal code 113 (since there
- can be no more than 99 back references)
- \\377 is a byte consisting entirely of 1 bits
- \\81 is either a back reference, or a binary zero
- followed by the two characters "8" and "1"
-
-Note that octal values of 100 or greater must not be introduced by a leading
-zero, because no more than three octal digits are ever read.
-
-All the sequences that define a single byte value can be used both inside and
-outside character classes. In addition, inside a character class, the sequence
-"\\b" is interpreted as the backspace character (hex 08). Outside a character
-class it has a different meaning (see below).
-
-The third use of backslash is for specifying generic character types:
-
- \\d any decimal digit
- \\D any character that is not a decimal digit
- \\s any whitespace character
- \\S any character that is not a whitespace character
- \\w any "word" character
- \\W any "non-word" character
-
-Each pair of escape sequences partitions the complete set of characters into
-two disjoint sets. Any given character matches one, and only one, of each pair.
-
-A "word" character is any letter or digit or the underscore character, that is,
-any character which can be part of a Perl "word". The definition of letters and
-digits is controlled by PCRE's character tables, and may vary if locale-
-specific matching is taking place (see "Locale support" above). For example, in
-the "fr" (French) locale, some character codes greater than 128 are used for
-accented letters, and these are matched by \\w.
-
-These character type sequences can appear both inside and outside character
-classes. They each match one character of the appropriate type. If the current
-matching point is at the end of the subject string, all of them fail, since
-there is no character to match.
-
-The fourth use of backslash is for certain simple assertions. An assertion
-specifies a condition that has to be met at a particular point in a match,
-without consuming any characters from the subject string. The use of
-subpatterns for more complicated assertions is described below. The backslashed
-assertions are
-
- \\b word boundary
- \\B not a word boundary
- \\A start of subject (independent of multiline mode)
- \\Z end of subject or newline at end (independent of multiline mode)
- \\z end of subject (independent of multiline mode)
-
-These assertions may not appear in character classes (but note that "\\b" has a
-different meaning, namely the backspace character, inside a character class).
-
-A word boundary is a position in the subject string where the current character
-and the previous character do not both match \\w or \\W (i.e. one matches
-\\w and the other matches \\W), or the start or end of the string if the
-first or last character matches \\w, respectively.
-
-The \\A, \\Z, and \\z assertions differ from the traditional circumflex and
-dollar (described below) in that they only ever match at the very start and end
-of the subject string, whatever options are set. They are not affected by the
-PCRE_NOTBOL or PCRE_NOTEOL options. If the \fIstartoffset\fR argument of
-\fBpcre_exec()\fR is non-zero, \\A can never match. The difference between \\Z
-and \\z is that \\Z matches before a newline that is the last character of the
-string as well as at the end of the string, whereas \\z matches only at the
-end.
-
-
-.SH CIRCUMFLEX AND DOLLAR
-Outside a character class, in the default matching mode, the circumflex
-character is an assertion which is true only if the current matching point is
-at the start of the subject string. If the \fIstartoffset\fR argument of
-\fBpcre_exec()\fR is non-zero, circumflex can never match. Inside a character
-class, circumflex has an entirely different meaning (see below).
-
-Circumflex need not be the first character of the pattern if a number of
-alternatives are involved, but it should be the first thing in each alternative
-in which it appears if the pattern is ever to match that branch. If all
-possible alternatives start with a circumflex, that is, if the pattern is
-constrained to match only at the start of the subject, it is said to be an
-"anchored" pattern. (There are also other constructs that can cause a pattern
-to be anchored.)
-
-A dollar character is an assertion which is true only if the current matching
-point is at the end of the subject string, or immediately before a newline
-character that is the last character in the string (by default). Dollar need
-not be the last character of the pattern if a number of alternatives are
-involved, but it should be the last item in any branch in which it appears.
-Dollar has no special meaning in a character class.
-
-The meaning of dollar can be changed so that it matches only at the very end of
-the string, by setting the PCRE_DOLLAR_ENDONLY option at compile or matching
-time. This does not affect the \\Z assertion.
-
-The meanings of the circumflex and dollar characters are changed if the
-PCRE_MULTILINE option is set. When this is the case, they match immediately
-after and immediately before an internal "\\n" character, respectively, in
-addition to matching at the start and end of the subject string. For example,
-the pattern /^abc$/ matches the subject string "def\\nabc" in multiline mode,
-but not otherwise. Consequently, patterns that are anchored in single line mode
-because all branches start with "^" are not anchored in multiline mode, and a
-match for circumflex is possible when the \fIstartoffset\fR argument of
-\fBpcre_exec()\fR is non-zero. The PCRE_DOLLAR_ENDONLY option is ignored if
-PCRE_MULTILINE is set.
-
-Note that the sequences \\A, \\Z, and \\z can be used to match the start and
-end of the subject in both modes, and if all branches of a pattern start with
-\\A it is always anchored, whether PCRE_MULTILINE is set or not.
-
-
-.SH FULL STOP (PERIOD, DOT)
-Outside a character class, a dot in the pattern matches any one character in
-the subject, including a non-printing character, but not (by default) newline.
-If the PCRE_DOTALL option is set, dots match newlines as well. The handling of
-dot is entirely independent of the handling of circumflex and dollar, the only
-relationship being that they both involve newline characters. Dot has no
-special meaning in a character class.
-
-
-.SH SQUARE BRACKETS
-An opening square bracket introduces a character class, terminated by a closing
-square bracket. A closing square bracket on its own is not special. If a
-closing square bracket is required as a member of the class, it should be the
-first data character in the class (after an initial circumflex, if present) or
-escaped with a backslash.
-
-A character class matches a single character in the subject; the character must
-be in the set of characters defined by the class, unless the first character in
-the class is a circumflex, in which case the subject character must not be in
-the set defined by the class. If a circumflex is actually required as a member
-of the class, ensure it is not the first character, or escape it with a
-backslash.
-
-For example, the character class [aeiou] matches any lower case vowel, while
-[^aeiou] matches any character that is not a lower case vowel. Note that a
-circumflex is just a convenient notation for specifying the characters which
-are in the class by enumerating those that are not. It is not an assertion: it
-still consumes a character from the subject string, and fails if the current
-pointer is at the end of the string.
-
-When caseless matching is set, any letters in a class represent both their
-upper case and lower case versions, so for example, a caseless [aeiou] matches
-"A" as well as "a", and a caseless [^aeiou] does not match "A", whereas a
-caseful version would.
-
-The newline character is never treated in any special way in character classes,
-whatever the setting of the PCRE_DOTALL or PCRE_MULTILINE options is. A class
-such as [^a] will always match a newline.
-
-The minus (hyphen) character can be used to specify a range of characters in a
-character class. For example, [d-m] matches any letter between d and m,
-inclusive. If a minus character is required in a class, it must be escaped with
-a backslash or appear in a position where it cannot be interpreted as
-indicating a range, typically as the first or last character in the class.
-
-It is not possible to have the literal character "]" as the end character of a
-range. A pattern such as [W-]46] is interpreted as a class of two characters
-("W" and "-") followed by a literal string "46]", so it would match "W46]" or
-"-46]". However, if the "]" is escaped with a backslash it is interpreted as
-the end of range, so [W-\\]46] is interpreted as a single class containing a
-range followed by two separate characters. The octal or hexadecimal
-representation of "]" can also be used to end a range.
-
-Ranges operate in ASCII collating sequence. They can also be used for
-characters specified numerically, for example [\\000-\\037]. If a range that
-includes letters is used when caseless matching is set, it matches the letters
-in either case. For example, [W-c] is equivalent to [][\\^_`wxyzabc], matched
-caselessly, and if character tables for the "fr" locale are in use,
-[\\xc8-\\xcb] matches accented E characters in both cases.
-
-The character types \\d, \\D, \\s, \\S, \\w, and \\W may also appear in a
-character class, and add the characters that they match to the class. For
-example, [\\dABCDEF] matches any hexadecimal digit. A circumflex can
-conveniently be used with the upper case character types to specify a more
-restricted set of characters than the matching lower case type. For example,
-the class [^\\W_] matches any letter or digit, but not underscore.
-
-All non-alphameric characters other than \\, -, ^ (at the start) and the
-terminating ] are non-special in character classes, but it does no harm if they
-are escaped.
-
-
-.SH POSIX CHARACTER CLASSES
-Perl 5.6 (not yet released at the time of writing) is going to support the
-POSIX notation for character classes, which uses names enclosed by [: and :]
-within the enclosing square brackets. PCRE supports this notation. For example,
-
- [01[:alpha:]%]
-
-matches "0", "1", any alphabetic character, or "%". The supported class names
-are
-
- alnum letters and digits
- alpha letters
- ascii character codes 0 - 127
- cntrl control characters
- digit decimal digits (same as \\d)
- graph printing characters, excluding space
- lower lower case letters
- print printing characters, including space
- punct printing characters, excluding letters and digits
- space white space (same as \\s)
- upper upper case letters
- word "word" characters (same as \\w)
- xdigit hexadecimal digits
-
->>>>>>>>>>>>Only WORD is perl. BLANK is GNU.
-
-The names "ascii" and "word" are Perl extensions. Another Perl extension is
-negation, which is indicated by a ^ character after the colon. For example,
-
- [12[:^digit:]]
-
-matches "1", "2", or any non-digit. PCRE (and Perl) also recognize the POSIX
-syntax [.ch.] and [=ch=] where "ch" is a "collating element", but these are not
-supported, and an error is given if they are encountered.
-
-
-.SH VERTICAL BAR
-Vertical bar characters are used to separate alternative patterns. For example,
-the pattern
-
- gilbert|sullivan
-
-matches either "gilbert" or "sullivan". Any number of alternatives may appear,
-and an empty alternative is permitted (matching the empty string).
-The matching process tries each alternative in turn, from left to right,
-and the first one that succeeds is used. If the alternatives are within a
-subpattern (defined below), "succeeds" means matching the rest of the main
-pattern as well as the alternative in the subpattern.
-
-
-.SH INTERNAL OPTION SETTING
-The settings of PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and PCRE_EXTENDED
-can be changed from within the pattern by a sequence of Perl option letters
-enclosed between "(?" and ")". The option letters are
-
- i for PCRE_CASELESS
- m for PCRE_MULTILINE
- s for PCRE_DOTALL
- x for PCRE_EXTENDED
-
-For example, (?im) sets caseless, multiline matching. It is also possible to
-unset these options by preceding the letter with a hyphen, and a combined
-setting and unsetting such as (?im-sx), which sets PCRE_CASELESS and
-PCRE_MULTILINE while unsetting PCRE_DOTALL and PCRE_EXTENDED, is also
-permitted. If a letter appears both before and after the hyphen, the option is
-unset.
-
-The scope of these option changes depends on where in the pattern the setting
-occurs. For settings that are outside any subpattern (defined below), the
-effect is the same as if the options were set or unset at the start of
-matching. The following patterns all behave in exactly the same way:
-
- (?i)abc
- a(?i)bc
- ab(?i)c
- abc(?i)
-
-which in turn is the same as compiling the pattern abc with PCRE_CASELESS set.
-In other words, such "top level" settings apply to the whole pattern (unless
-there are other changes inside subpatterns). If there is more than one setting
-of the same option at top level, the rightmost setting is used.
-
-If an option change occurs inside a subpattern, the effect is different. This
-is a change of behaviour in Perl 5.005. An option change inside a subpattern
-affects only that part of the subpattern that follows it, so
-
- (a(?i)b)c
-
-matches abc and aBc and no other strings (assuming PCRE_CASELESS is not used).
-By this means, options can be made to have different settings in different
-parts of the pattern. Any changes made in one alternative do carry on
-into subsequent branches within the same subpattern. For example,
-
- (a(?i)b|c)
-
-matches "ab", "aB", "c", and "C", even though when matching "C" the first
-branch is abandoned before the option setting. This is because the effects of
-option settings happen at compile time. There would be some very weird
-behaviour otherwise.
-
-The PCRE-specific options PCRE_UNGREEDY and PCRE_EXTRA can be changed in the
-same way as the Perl-compatible options by using the characters U and X
-respectively. The (?X) flag setting is special in that it must always occur
-earlier in the pattern than any of the additional features it turns on, even
-when it is at top level. It is best put at the start.
-
-
-.SH SUBPATTERNS
-Subpatterns are delimited by parentheses (round brackets), which can be nested.
-Marking part of a pattern as a subpattern does two things:
-
-1. It localizes a set of alternatives. For example, the pattern
-
- cat(aract|erpillar|)
-
-matches one of the words "cat", "cataract", or "caterpillar". Without the
-parentheses, it would match "cataract", "erpillar" or the empty string.
-
-2. It sets up the subpattern as a capturing subpattern (as defined above).
-When the whole pattern matches, that portion of the subject string that matched
-the subpattern is passed back to the caller via the \fIovector\fR argument of
-\fBpcre_exec()\fR. Opening parentheses are counted from left to right (starting
-from 1) to obtain the numbers of the capturing subpatterns.
-
-For example, if the string "the red king" is matched against the pattern
-
- the ((red|white) (king|queen))
-
-the captured substrings are "red king", "red", and "king", and are numbered 1,
-2, and 3, respectively.
-
-The fact that plain parentheses fulfil two functions is not always helpful.
-There are often times when a grouping subpattern is required without a
-capturing requirement. If an opening parenthesis is followed by "?:", the
-subpattern does not do any capturing, and is not counted when computing the
-number of any subsequent capturing subpatterns. For example, if the string "the
-white queen" is matched against the pattern
-
- the ((?:red|white) (king|queen))
-
-the captured substrings are "white queen" and "queen", and are numbered 1 and
-2. The maximum number of captured substrings is 99, and the maximum number of
-all subpatterns, both capturing and non-capturing, is 200.
-
-As a convenient shorthand, if any option settings are required at the start of
-a non-capturing subpattern, the option letters may appear between the "?" and
-the ":". Thus the two patterns
-
- (?i:saturday|sunday)
- (?:(?i)saturday|sunday)
-
-match exactly the same set of strings. Because alternative branches are tried
-from left to right, and options are not reset until the end of the subpattern
-is reached, an option setting in one branch does affect subsequent branches, so
-the above patterns match "SUNDAY" as well as "Saturday".
-
-
-.SH REPETITION
-Repetition is specified by quantifiers, which can follow any of the following
-items:
-
- a single character, possibly escaped
- the . metacharacter
- a character class
- a back reference (see next section)
- a parenthesized subpattern (unless it is an assertion - see below)
-
-The general repetition quantifier specifies a minimum and maximum number of
-permitted matches, by giving the two numbers in curly brackets (braces),
-separated by a comma. The numbers must be less than 65536, and the first must
-be less than or equal to the second. For example:
-
- z{2,4}
-
-matches "zz", "zzz", or "zzzz". A closing brace on its own is not a special
-character. If the second number is omitted, but the comma is present, there is
-no upper limit; if the second number and the comma are both omitted, the
-quantifier specifies an exact number of required matches. Thus
-
- [aeiou]{3,}
-
-matches at least 3 successive vowels, but may match many more, while
-
- \\d{8}
-
-matches exactly 8 digits. An opening curly bracket that appears in a position
-where a quantifier is not allowed, or one that does not match the syntax of a
-quantifier, is taken as a literal character. For example, {,6} is not a
-quantifier, but a literal string of four characters.
-
-The quantifier {0} is permitted, causing the expression to behave as if the
-previous item and the quantifier were not present.
-
-For convenience (and historical compatibility) the three most common
-quantifiers have single-character abbreviations:
-
- * is equivalent to {0,}
- + is equivalent to {1,}
- ? is equivalent to {0,1}
-
-It is possible to construct infinite loops by following a subpattern that can
-match no characters with a quantifier that has no upper limit, for example:
-
- (a?)*
-
-Earlier versions of Perl and PCRE used to give an error at compile time for
-such patterns. However, because there are cases where this can be useful, such
-patterns are now accepted, but if any repetition of the subpattern does in fact
-match no characters, the loop is forcibly broken.
-
-By default, the quantifiers are "greedy", that is, they match as much as
-possible (up to the maximum number of permitted times), without causing the
-rest of the pattern to fail. The classic example of where this gives problems
-is in trying to match comments in C programs. These appear between the
-sequences /* and */ and within the sequence, individual * and / characters may
-appear. An attempt to match C comments by applying the pattern
-
- /\\*.*\\*/
-
-to the string
-
- /* first command */ not comment /* second comment */
-
-fails, because it matches the entire string owing to the greediness of the .*
-item.
-
-However, if a quantifier is followed by a question mark, it ceases to be
-greedy, and instead matches the minimum number of times possible, so the
-pattern
-
- /\\*.*?\\*/
-
-does the right thing with the C comments. The meaning of the various
-quantifiers is not otherwise changed, just the preferred number of matches.
-Do not confuse this use of question mark with its use as a quantifier in its
-own right. Because it has two uses, it can sometimes appear doubled, as in
-
- \\d??\\d
-
-which matches one digit by preference, but can match two if that is the only
-way the rest of the pattern matches.
-
-If the PCRE_UNGREEDY option is set (an option which is not available in Perl),
-the quantifiers are not greedy by default, but individual ones can be made
-greedy by following them with a question mark. In other words, it inverts the
-default behaviour.
-
-When a parenthesized subpattern is quantified with a minimum repeat count that
-is greater than 1 or with a limited maximum, more store is required for the
-compiled pattern, in proportion to the size of the minimum or maximum.
-
-If a pattern starts with .* or .{0,} and the PCRE_DOTALL option (equivalent
-to Perl's /s) is set, thus allowing the . to match newlines, the pattern is
-implicitly anchored, because whatever follows will be tried against every
-character position in the subject string, so there is no point in retrying the
-overall match at any position after the first. PCRE treats such a pattern as
-though it were preceded by \\A. In cases where it is known that the subject
-string contains no newlines, it is worth setting PCRE_DOTALL when the pattern
-begins with .* in order to obtain this optimization, or alternatively using ^
-to indicate anchoring explicitly.
-
-When a capturing subpattern is repeated, the value captured is the substring
-that matched the final iteration. For example, after
-
- (tweedle[dume]{3}\\s*)+
-
-has matched "tweedledum tweedledee" the value of the captured substring is
-"tweedledee". However, if there are nested capturing subpatterns, the
-corresponding captured values may have been set in previous iterations. For
-example, after
-
- /(a|(b))+/
-
-matches "aba" the value of the second captured substring is "b".
-
-
-.SH BACK REFERENCES
-Outside a character class, a backslash followed by a digit greater than 0 (and
-possibly further digits) is a back reference to a capturing subpattern earlier
-(i.e. to its left) in the pattern, provided there have been that many previous
-capturing left parentheses.
-
-However, if the decimal number following the backslash is less than 10, it is
-always taken as a back reference, and causes an error only if there are not
-that many capturing left parentheses in the entire pattern. In other words, the
-parentheses that are referenced need not be to the left of the reference for
-numbers less than 10. See the section entitled "Backslash" above for further
-details of the handling of digits following a backslash.
-
-A back reference matches whatever actually matched the capturing subpattern in
-the current subject string, rather than anything matching the subpattern
-itself. So the pattern
-
- (sens|respons)e and \\1ibility
-
-matches "sense and sensibility" and "response and responsibility", but not
-"sense and responsibility". If caseful matching is in force at the time of the
-back reference, the case of letters is relevant. For example,
-
- ((?i)rah)\\s+\\1
-
-matches "rah rah" and "RAH RAH", but not "RAH rah", even though the original
-capturing subpattern is matched caselessly.
-
-There may be more than one back reference to the same subpattern. If a
-subpattern has not actually been used in a particular match, any back
-references to it always fail. For example, the pattern
-
- (a|(bc))\\2
-
-always fails if it starts to match "a" rather than "bc". Because there may be
-up to 99 back references, all digits following the backslash are taken
-as part of a potential back reference number. If the pattern continues with a
-digit character, some delimiter must be used to terminate the back reference.
-If the PCRE_EXTENDED option is set, this can be whitespace. Otherwise an empty
-comment can be used.
-
-A back reference that occurs inside the parentheses to which it refers fails
-when the subpattern is first used, so, for example, (a\\1) never matches.
-However, such references can be useful inside repeated subpatterns. For
-example, the pattern
-
- (a|b\\1)+
-
-matches any number of "a"s and also "aba", "ababbaa" etc. At each iteration of
-the subpattern, the back reference matches the character string corresponding
-to the previous iteration. In order for this to work, the pattern must be such
-that the first iteration does not need to match the back reference. This can be
-done using alternation, as in the example above, or by a quantifier with a
-minimum of zero.
-
-
-.SH ASSERTIONS
-An assertion is a test on the characters following or preceding the current
-matching point that does not actually consume any characters. The simple
-assertions coded as \\b, \\B, \\A, \\Z, \\z, ^ and $ are described above. More
-complicated assertions are coded as subpatterns. There are two kinds: those
-that look ahead of the current position in the subject string, and those that
-look behind it.
-
-An assertion subpattern is matched in the normal way, except that it does not
-cause the current matching position to be changed. Lookahead assertions start
-with (?= for positive assertions and (?! for negative assertions. For example,
-
- \\w+(?=;)
-
-matches a word followed by a semicolon, but does not include the semicolon in
-the match, and
-
- foo(?!bar)
-
-matches any occurrence of "foo" that is not followed by "bar". Note that the
-apparently similar pattern
-
- (?!foo)bar
-
-does not find an occurrence of "bar" that is preceded by something other than
-"foo"; it finds any occurrence of "bar" whatsoever, because the assertion
-(?!foo) is always true when the next three characters are "bar". A
-lookbehind assertion is needed to achieve this effect.
-
-Lookbehind assertions start with (?<= for positive assertions and (?<! for
-negative assertions. For example,
-
- (?<!foo)bar
-
-does find an occurrence of "bar" that is not preceded by "foo". The contents of
-a lookbehind assertion are restricted such that all the strings it matches must
-have a fixed length. However, if there are several alternatives, they do not
-all have to have the same fixed length. Thus
-
- (?<=bullock|donkey)
-
-is permitted, but
-
- (?<!dogs?|cats?)
-
-causes an error at compile time. Branches that match different length strings
-are permitted only at the top level of a lookbehind assertion. This is an
-extension compared with Perl 5.005, which requires all branches to match the
-same length of string. An assertion such as
-
- (?<=ab(c|de))
-
-is not permitted, because its single top-level branch can match two different
-lengths, but it is acceptable if rewritten to use two top-level branches:
-
- (?<=abc|abde)
-
-The implementation of lookbehind assertions is, for each alternative, to
-temporarily move the current position back by the fixed width and then try to
-match. If there are insufficient characters before the current position, the
-match is deemed to fail. Lookbehinds in conjunction with once-only subpatterns
-can be particularly useful for matching at the ends of strings; an example is
-given at the end of the section on once-only subpatterns.
-
-Several assertions (of any sort) may occur in succession. For example,
-
- (?<=\\d{3})(?<!999)foo
-
-matches "foo" preceded by three digits that are not "999". Notice that each of
-the assertions is applied independently at the same point in the subject
-string. First there is a check that the previous three characters are all
-digits, and then there is a check that the same three characters are not "999".
-This pattern does \fInot\fR match "foo" preceded by six characters, the first
-of which are digits and the last three of which are not "999". For example, it
-doesn't match "123abcfoo". A pattern to do that is
-
- (?<=\\d{3}...)(?<!999)foo
-
-This time the first assertion looks at the preceding six characters, checking
-that the first three are digits, and then the second assertion checks that the
-preceding three characters are not "999".
-
-Assertions can be nested in any combination. For example,
-
- (?<=(?<!foo)bar)baz
-
-matches an occurrence of "baz" that is preceded by "bar" which in turn is not
-preceded by "foo", while
-
- (?<=\\d{3}(?!999)...)foo
-
-is another pattern which matches "foo" preceded by three digits and any three
-characters that are not "999".
-
-Assertion subpatterns are not capturing subpatterns, and may not be repeated,
-because it makes no sense to assert the same thing several times. If any kind
-of assertion contains capturing subpatterns within it, these are counted for
-the purposes of numbering the capturing subpatterns in the whole pattern.
-However, substring capturing is carried out only for positive assertions,
-because it does not make sense for negative assertions.
-
-Assertions count towards the maximum of 200 parenthesized subpatterns.
-
-
-.SH ONCE-ONLY SUBPATTERNS
-With both maximizing and minimizing repetition, failure of what follows
-normally causes the repeated item to be re-evaluated to see if a different
-number of repeats allows the rest of the pattern to match. Sometimes it is
-useful to prevent this, either to change the nature of the match, or to cause
-it fail earlier than it otherwise might, when the author of the pattern knows
-there is no point in carrying on.
-
-Consider, for example, the pattern \\d+foo when applied to the subject line
-
- 123456bar
-
-After matching all 6 digits and then failing to match "foo", the normal
-action of the matcher is to try again with only 5 digits matching the \\d+
-item, and then with 4, and so on, before ultimately failing. Once-only
-subpatterns provide the means for specifying that once a portion of the pattern
-has matched, it is not to be re-evaluated in this way, so the matcher would
-give up immediately on failing to match "foo" the first time. The notation is
-another kind of special parenthesis, starting with (?> as in this example:
-
- (?>\\d+)bar
-
-This kind of parenthesis "locks up" the part of the pattern it contains once
-it has matched, and a failure further into the pattern is prevented from
-backtracking into it. Backtracking past it to previous items, however, works as
-normal.
-
-An alternative description is that a subpattern of this type matches the string
-of characters that an identical standalone pattern would match, if anchored at
-the current point in the subject string.
-
-Once-only subpatterns are not capturing subpatterns. Simple cases such as the
-above example can be thought of as a maximizing repeat that must swallow
-everything it can. So, while both \\d+ and \\d+? are prepared to adjust the
-number of digits they match in order to make the rest of the pattern match,
-(?>\\d+) can only match an entire sequence of digits.
-
-This construction can of course contain arbitrarily complicated subpatterns,
-and it can be nested.
-
-Once-only subpatterns can be used in conjunction with lookbehind assertions to
-specify efficient matching at the end of the subject string. Consider a simple
-pattern such as
-
- abcd$
-
-when applied to a long string which does not match. Because matching proceeds
-from left to right, PCRE will look for each "a" in the subject and then see if
-what follows matches the rest of the pattern. If the pattern is specified as
-
- ^.*abcd$
-
-the initial .* matches the entire string at first, but when this fails (because
-there is no following "a"), it backtracks to match all but the last character,
-then all but the last two characters, and so on. Once again the search for "a"
-covers the entire string, from right to left, so we are no better off. However,
-if the pattern is written as
-
- ^(?>.*)(?<=abcd)
-
-there can be no backtracking for the .* item; it can match only the entire
-string. The subsequent lookbehind assertion does a single test on the last four
-characters. If it fails, the match fails immediately. For long strings, this
-approach makes a significant difference to the processing time.
-
-When a pattern contains an unlimited repeat inside a subpattern that can itself
-be repeated an unlimited number of times, the use of a once-only subpattern is
-the only way to avoid some failing matches taking a very long time indeed.
-The pattern
-
- (\\D+|<\\d+>)*[!?]
-
-matches an unlimited number of substrings that either consist of non-digits, or
-digits enclosed in <>, followed by either ! or ?. When it matches, it runs
-quickly. However, if it is applied to
-
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-
-it takes a long time before reporting failure. This is because the string can
-be divided between the two repeats in a large number of ways, and all have to
-be tried. (The example used [!?] rather than a single character at the end,
-because both PCRE and Perl have an optimization that allows for fast failure
-when a single character is used. They remember the last single character that
-is required for a match, and fail early if it is not present in the string.)
-If the pattern is changed to
-
- ((?>\\D+)|<\\d+>)*[!?]
-
-sequences of non-digits cannot be broken, and failure happens quickly.
-
-
-.SH CONDITIONAL SUBPATTERNS
-It is possible to cause the matching process to obey a subpattern
-conditionally or to choose between two alternative subpatterns, depending on
-the result of an assertion, or whether a previous capturing subpattern matched
-or not. The two possible forms of conditional subpattern are
-
- (?(condition)yes-pattern)
- (?(condition)yes-pattern|no-pattern)
-
-If the condition is satisfied, the yes-pattern is used; otherwise the
-no-pattern (if present) is used. If there are more than two alternatives in the
-subpattern, a compile-time error occurs.
-
-There are two kinds of condition. If the text between the parentheses consists
-of a sequence of digits, the condition is satisfied if the capturing subpattern
-of that number has previously matched. The number must be greater than zero.
-Consider the following pattern, which contains non-significant white space to
-make it more readable (assume the PCRE_EXTENDED option) and to divide it into
-three parts for ease of discussion:
-
- ( \\( )? [^()]+ (?(1) \\) )
-
-The first part matches an optional opening parenthesis, and if that
-character is present, sets it as the first captured substring. The second part
-matches one or more characters that are not parentheses. The third part is a
-conditional subpattern that tests whether the first set of parentheses matched
-or not. If they did, that is, if subject started with an opening parenthesis,
-the condition is true, and so the yes-pattern is executed and a closing
-parenthesis is required. Otherwise, since no-pattern is not present, the
-subpattern matches nothing. In other words, this pattern matches a sequence of
-non-parentheses, optionally enclosed in parentheses.
-
-If the condition is not a sequence of digits, it must be an assertion. This may
-be a positive or negative lookahead or lookbehind assertion. Consider this
-pattern, again containing non-significant white space, and with the two
-alternatives on the second line:
-
- (?(?=[^a-z]*[a-z])
- \\d{2}-[a-z]{3}-\\d{2} | \\d{2}-\\d{2}-\\d{2} )
-
-The condition is a positive lookahead assertion that matches an optional
-sequence of non-letters followed by a letter. In other words, it tests for the
-presence of at least one letter in the subject. If a letter is found, the
-subject is matched against the first alternative; otherwise it is matched
-against the second. This pattern matches strings in one of the two forms
-dd-aaa-dd or dd-dd-dd, where aaa are letters and dd are digits.
-
-
-.SH COMMENTS
-The sequence (?# marks the start of a comment which continues up to the next
-closing parenthesis. Nested parentheses are not permitted. The characters
-that make up a comment play no part in the pattern matching at all.
-
-If the PCRE_EXTENDED option is set, an unescaped # character outside a
-character class introduces a comment that continues up to the next newline
-character in the pattern.
-
-
-.SH RECURSIVE PATTERNS
-Consider the problem of matching a string in parentheses, allowing for
-unlimited nested parentheses. Without the use of recursion, the best that can
-be done is to use a pattern that matches up to some fixed depth of nesting. It
-is not possible to handle an arbitrary nesting depth. Perl 5.6 has provided an
-experimental facility that allows regular expressions to recurse (amongst other
-things). It does this by interpolating Perl code in the expression at run time,
-and the code can refer to the expression itself. A Perl pattern to solve the
-parentheses problem can be created like this:
-
- $re = qr{\\( (?: (?>[^()]+) | (?p{$re}) )* \\)}x;
-
-The (?p{...}) item interpolates Perl code at run time, and in this case refers
-recursively to the pattern in which it appears. Obviously, PCRE cannot support
-the interpolation of Perl code. Instead, the special item (?R) is provided for
-the specific case of recursion. This PCRE pattern solves the parentheses
-problem (assume the PCRE_EXTENDED option is set so that white space is
-ignored):
-
- \\( ( (?>[^()]+) | (?R) )* \\)
-
-First it matches an opening parenthesis. Then it matches any number of
-substrings which can either be a sequence of non-parentheses, or a recursive
-match of the pattern itself (i.e. a correctly parenthesized substring). Finally
-there is a closing parenthesis.
-
-This particular example pattern contains nested unlimited repeats, and so the
-use of a once-only subpattern for matching strings of non-parentheses is
-important when applying the pattern to strings that do not match. For example,
-when it is applied to
-
- (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
-
-it yields "no match" quickly. However, if a once-only subpattern is not used,
-the match runs for a very long time indeed because there are so many different
-ways the + and * repeats can carve up the subject, and all have to be tested
-before failure can be reported.
-
-The values set for any capturing subpatterns are those from the outermost level
-of the recursion at which the subpattern value is set. If the pattern above is
-matched against
-
- (ab(cd)ef)
-
-the value for the capturing parentheses is "ef", which is the last value taken
-on at the top level. If additional parentheses are added, giving
-
- \\( ( ( (?>[^()]+) | (?R) )* ) \\)
- ^ ^
- ^ ^
-the string they capture is "ab(cd)ef", the contents of the top level
-parentheses. If there are more than 15 capturing parentheses in a pattern, PCRE
-has to obtain extra memory to store data during a recursion, which it does by
-using \fBpcre_malloc\fR, freeing it via \fBpcre_free\fR afterwards. If no
-memory can be obtained, it saves data for the first 15 capturing parentheses
-only, as there is no way to give an out-of-memory error from within a
-recursion.
-
-
-.SH PERFORMANCE
-Certain items that may appear in patterns are more efficient than others. It is
-more efficient to use a character class like [aeiou] than a set of alternatives
-such as (a|e|i|o|u). In general, the simplest construction that provides the
-required behaviour is usually the most efficient. Jeffrey Friedl's book
-contains a lot of discussion about optimizing regular expressions for efficient
-performance.
-
-When a pattern begins with .* and the PCRE_DOTALL option is set, the pattern is
-implicitly anchored by PCRE, since it can match only at the start of a subject
-string. However, if PCRE_DOTALL is not set, PCRE cannot make this optimization,
-because the . metacharacter does not then match a newline, and if the subject
-string contains newlines, the pattern may match from the character immediately
-following one of them instead of from the very start. For example, the pattern
-
- (.*) second
-
-matches the subject "first\\nand second" (where \\n stands for a newline
-character) with the first captured substring being "and". In order to do this,
-PCRE has to retry the match starting after every newline in the subject.
-
-If you are using such a pattern with subject strings that do not contain
-newlines, the best performance is obtained by setting PCRE_DOTALL, or starting
-the pattern with ^.* to indicate explicit anchoring. That saves PCRE from
-having to scan along the subject looking for a newline to restart at.
-
-Beware of patterns that contain nested indefinite repeats. These can take a
-long time to run when applied to a string that does not match. Consider the
-pattern fragment
-
- (a+)*
-
-This can match "aaaa" in 33 different ways, and this number increases very
-rapidly as the string gets longer. (The * repeat can match 0, 1, 2, 3, or 4
-times, and for each of those cases other than 0, the + repeats can match
-different numbers of times.) When the remainder of the pattern is such that the
-entire match is going to fail, PCRE has in principle to try every possible
-variation, and this can take an extremely long time.
-
-An optimization catches some of the more simple cases such as
-
- (a+)*b
-
-where a literal character follows. Before embarking on the standard matching
-procedure, PCRE checks that there is a "b" later in the subject string, and if
-there is not, it fails the match immediately. However, when there is no
-following literal this optimization cannot be used. You can see the difference
-by comparing the behaviour of
-
- (a+)*\\d
-
-with the pattern above. The former gives a failure almost instantly when
-applied to a whole line of "a" characters, whereas the latter takes an
-appreciable time with strings longer than about 20 characters.
-
-
-.SH UTF-8 SUPPORT
-Starting at release 3.3, PCRE has some support for character strings encoded
-in the UTF-8 format. This is incomplete, and is regarded as experimental. In
-order to use it, you must configure PCRE to include UTF-8 support in the code,
-and, in addition, you must call \fBpcre_compile()\fR with the PCRE_UTF8 option
-flag. When you do this, both the pattern and any subject strings that are
-matched against it are treated as UTF-8 strings instead of just strings of
-bytes, but only in the cases that are mentioned below.
-
-If you compile PCRE with UTF-8 support, but do not use it at run time, the
-library will be a bit bigger, but the additional run time overhead is limited
-to testing the PCRE_UTF8 flag in several places, so should not be very large.
-
-PCRE assumes that the strings it is given contain valid UTF-8 codes. It does
-not diagnose invalid UTF-8 strings. If you pass invalid UTF-8 strings to PCRE,
-the results are undefined.
-
-Running with PCRE_UTF8 set causes these changes in the way PCRE works:
-
-1. In a pattern, the escape sequence \\x{...}, where the contents of the braces
-is a string of hexadecimal digits, is interpreted as a UTF-8 character whose
-code number is the given hexadecimal number, for example: \\x{1234}. This
-inserts from one to six literal bytes into the pattern, using the UTF-8
-encoding. If a non-hexadecimal digit appears between the braces, the item is
-not recognized.
-
-2. The original hexadecimal escape sequence, \\xhh, generates a two-byte UTF-8
-character if its value is greater than 127.
-
-3. Repeat quantifiers are NOT correctly handled if they follow a multibyte
-character. For example, \\x{100}* and \\xc3+ do not work. If you want to
-repeat such characters, you must enclose them in non-capturing parentheses,
-for example (?:\\x{100}), at present.
-
-4. The dot metacharacter matches one UTF-8 character instead of a single byte.
-
-5. Unlike literal UTF-8 characters, the dot metacharacter followed by a
-repeat quantifier does operate correctly on UTF-8 characters instead of
-single bytes.
-
-4. Although the \\x{...} escape is permitted in a character class, characters
-whose values are greater than 255 cannot be included in a class.
-
-5. A class is matched against a UTF-8 character instead of just a single byte,
-but it can match only characters whose values are less than 256. Characters
-with greater values always fail to match a class.
-
-6. Repeated classes work correctly on multiple characters.
-
-7. Classes containing just a single character whose value is greater than 127
-(but less than 256), for example, [\\x80] or [^\\x{93}], do not work because
-these are optimized into single byte matches. In the first case, of course,
-the class brackets are just redundant.
-
-8. Lookbehind assertions move backwards in the subject by a fixed number of
-characters instead of a fixed number of bytes. Simple cases have been tested
-to work correctly, but there may be hidden gotchas herein.
-
-9. The character types such as \\d and \\w do not work correctly with UTF-8
-characters. They continue to test a single byte.
-
-10. Anything not explicitly mentioned here continues to work in bytes rather
-than in characters.
-
-The following UTF-8 features of Perl 5.6 are not implemented:
-
-1. The escape sequence \\C to match a single byte.
-
-2. The use of Unicode tables and properties and escapes \\p, \\P, and \\X.
-
-
-.SH SAMPLE PROGRAM
-The code below is a simple, complete demonstration program, to get you started
-with using PCRE. This code is also supplied in the file \fIpcredemo.c\fR in the
-PCRE distribution.
-
-The program compiles the regular expression that is its first argument, and
-matches it against the subject string in its second argument. No options are
-set, and default character tables are used. If matching succeeds, the program
-outputs the portion of the subject that matched, together with the contents of
-any captured substrings.
-
-On a Unix system that has PCRE installed in \fI/usr/local\fR, you can compile
-the demonstration program using a command like this:
-
- gcc -o pcredemo pcredemo.c -I/usr/local/include -L/usr/local/lib -lpcre
-
-Then you can run simple tests like this:
-
- ./pcredemo 'cat|dog' 'the cat sat on the mat'
-
-Note that there is a much more comprehensive test program, called
-\fBpcretest\fR, which supports many more facilities for testing regular
-expressions. The \fBpcredemo\fR program is provided as a simple coding example.
-
-On some operating systems (e.g. Solaris) you may get an error like this when
-you try to run \fBpcredemo\fR:
-
- ld.so.1: a.out: fatal: libpcre.so.0: open failed: No such file or directory
-
-This is caused by the way shared library support works on those systems. You
-need to add
-
- -R/usr/local/lib
-
-to the compile command to get round this problem. Here's the code:
-
- #include <stdio.h>
- #include <string.h>
- #include <pcre.h>
-
- #define OVECCOUNT 30 /* should be a multiple of 3 */
-
- int main(int argc, char **argv)
- {
- pcre *re;
- const char *error;
- int erroffset;
- int ovector[OVECCOUNT];
- int rc, i;
-
- if (argc != 3)
- {
- printf("Two arguments required: a regex and a "
- "subject string\\n");
- return 1;
- }
-
- /* Compile the regular expression in the first argument */
-
- re = pcre_compile(
- argv[1], /* the pattern */
- 0, /* default options */
- &error, /* for error message */
- &erroffset, /* for error offset */
- NULL); /* use default character tables */
-
- /* Compilation failed: print the error message and exit */
-
- if (re == NULL)
- {
- printf("PCRE compilation failed at offset %d: %s\\n",
- erroffset, error);
- return 1;
- }
-
- /* Compilation succeeded: match the subject in the second
- argument */
-
- rc = pcre_exec(
- re, /* the compiled pattern */
- NULL, /* we didn't study the pattern */
- argv[2], /* the subject string */
- (int)strlen(argv[2]), /* the length of the subject */
- 0, /* start at offset 0 in the subject */
- 0, /* default options */
- ovector, /* vector for substring information */
- OVECCOUNT); /* number of elements in the vector */
-
- /* Matching failed: handle error cases */
-
- if (rc < 0)
- {
- switch(rc)
- {
- case PCRE_ERROR_NOMATCH: printf("No match\\n"); break;
- /*
- Handle other special cases if you like
- */
- default: printf("Matching error %d\\n", rc); break;
- }
- return 1;
- }
-
- /* Match succeded */
-
- printf("Match succeeded\\n");
-
- /* The output vector wasn't big enough */
-
- if (rc == 0)
- {
- rc = OVECCOUNT/3;
- printf("ovector only has room for %d captured "
- substrings\\n", rc - 1);
- }
-
- /* Show substrings stored in the output vector */
-
- for (i = 0; i < rc; i++)
- {
- char *substring_start = argv[2] + ovector[2*i];
- int substring_length = ovector[2*i+1] - ovector[2*i];
- printf("%2d: %.*s\\n", i, substring_length,
- substring_start);
- }
-
- return 0;
- }
-
-
-.SH AUTHOR
-Philip Hazel <ph10@cam.ac.uk>
-.br
-University Computing Service,
-.br
-New Museums Site,
-.br
-Cambridge CB2 3QG, England.
-.br
-Phone: +44 1223 334714
-
-Last updated: 15 August 2001
-.br
-Copyright (c) 1997-2001 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcre.html b/ext/pcre/pcrelib/doc/pcre.html
deleted file mode 100644
index d3d7b738d2..0000000000
--- a/ext/pcre/pcrelib/doc/pcre.html
+++ /dev/null
@@ -1,2672 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>pcre specification</TITLE>
-</HEAD>
-<body bgcolor="#FFFFFF" text="#00005A">
-<H1>pcre specification</H1>
-This HTML document has been generated automatically from the original man page.
-If there is any nonsense in it, please consult the man page in case the
-conversion went wrong.
-<UL>
-<LI><A NAME="TOC1" HREF="#SEC1">NAME</A>
-<LI><A NAME="TOC2" HREF="#SEC2">SYNOPSIS</A>
-<LI><A NAME="TOC3" HREF="#SEC3">DESCRIPTION</A>
-<LI><A NAME="TOC4" HREF="#SEC4">MULTI-THREADING</A>
-<LI><A NAME="TOC5" HREF="#SEC5">COMPILING A PATTERN</A>
-<LI><A NAME="TOC6" HREF="#SEC6">STUDYING A PATTERN</A>
-<LI><A NAME="TOC7" HREF="#SEC7">LOCALE SUPPORT</A>
-<LI><A NAME="TOC8" HREF="#SEC8">INFORMATION ABOUT A PATTERN</A>
-<LI><A NAME="TOC9" HREF="#SEC9">MATCHING A PATTERN</A>
-<LI><A NAME="TOC10" HREF="#SEC10">EXTRACTING CAPTURED SUBSTRINGS</A>
-<LI><A NAME="TOC11" HREF="#SEC11">LIMITATIONS</A>
-<LI><A NAME="TOC12" HREF="#SEC12">DIFFERENCES FROM PERL</A>
-<LI><A NAME="TOC13" HREF="#SEC13">REGULAR EXPRESSION DETAILS</A>
-<LI><A NAME="TOC14" HREF="#SEC14">BACKSLASH</A>
-<LI><A NAME="TOC15" HREF="#SEC15">CIRCUMFLEX AND DOLLAR</A>
-<LI><A NAME="TOC16" HREF="#SEC16">FULL STOP (PERIOD, DOT)</A>
-<LI><A NAME="TOC17" HREF="#SEC17">SQUARE BRACKETS</A>
-<LI><A NAME="TOC18" HREF="#SEC18">POSIX CHARACTER CLASSES</A>
-<LI><A NAME="TOC19" HREF="#SEC19">VERTICAL BAR</A>
-<LI><A NAME="TOC20" HREF="#SEC20">INTERNAL OPTION SETTING</A>
-<LI><A NAME="TOC21" HREF="#SEC21">SUBPATTERNS</A>
-<LI><A NAME="TOC22" HREF="#SEC22">REPETITION</A>
-<LI><A NAME="TOC23" HREF="#SEC23">BACK REFERENCES</A>
-<LI><A NAME="TOC24" HREF="#SEC24">ASSERTIONS</A>
-<LI><A NAME="TOC25" HREF="#SEC25">ONCE-ONLY SUBPATTERNS</A>
-<LI><A NAME="TOC26" HREF="#SEC26">CONDITIONAL SUBPATTERNS</A>
-<LI><A NAME="TOC27" HREF="#SEC27">COMMENTS</A>
-<LI><A NAME="TOC28" HREF="#SEC28">RECURSIVE PATTERNS</A>
-<LI><A NAME="TOC29" HREF="#SEC29">PERFORMANCE</A>
-<LI><A NAME="TOC30" HREF="#SEC30">UTF-8 SUPPORT</A>
-<LI><A NAME="TOC31" HREF="#SEC31">SAMPLE PROGRAM</A>
-<LI><A NAME="TOC32" HREF="#SEC32">AUTHOR</A>
-</UL>
-<LI><A NAME="SEC1" HREF="#TOC1">NAME</A>
-<P>
-pcre - Perl-compatible regular expressions.
-</P>
-<LI><A NAME="SEC2" HREF="#TOC1">SYNOPSIS</A>
-<P>
-<B>#include &#60;pcre.h&#62;</B>
-</P>
-<P>
-<B>pcre *pcre_compile(const char *<I>pattern</I>, int <I>options</I>,</B>
-<B>const char **<I>errptr</I>, int *<I>erroffset</I>,</B>
-<B>const unsigned char *<I>tableptr</I>);</B>
-</P>
-<P>
-<B>pcre_extra *pcre_study(const pcre *<I>code</I>, int <I>options</I>,</B>
-<B>const char **<I>errptr</I>);</B>
-</P>
-<P>
-<B>int pcre_exec(const pcre *<I>code</I>, const pcre_extra *<I>extra</I>,</B>
-<B>const char *<I>subject</I>, int <I>length</I>, int <I>startoffset</I>,</B>
-<B>int <I>options</I>, int *<I>ovector</I>, int <I>ovecsize</I>);</B>
-</P>
-<P>
-<B>int pcre_copy_substring(const char *<I>subject</I>, int *<I>ovector</I>,</B>
-<B>int <I>stringcount</I>, int <I>stringnumber</I>, char *<I>buffer</I>,</B>
-<B>int <I>buffersize</I>);</B>
-</P>
-<P>
-<B>int pcre_get_substring(const char *<I>subject</I>, int *<I>ovector</I>,</B>
-<B>int <I>stringcount</I>, int <I>stringnumber</I>,</B>
-<B>const char **<I>stringptr</I>);</B>
-</P>
-<P>
-<B>int pcre_get_substring_list(const char *<I>subject</I>,</B>
-<B>int *<I>ovector</I>, int <I>stringcount</I>, const char ***<I>listptr</I>);</B>
-</P>
-<P>
-<B>void pcre_free_substring(const char *<I>stringptr</I>);</B>
-</P>
-<P>
-<B>void pcre_free_substring_list(const char **<I>stringptr</I>);</B>
-</P>
-<P>
-<B>const unsigned char *pcre_maketables(void);</B>
-</P>
-<P>
-<B>int pcre_fullinfo(const pcre *<I>code</I>, const pcre_extra *<I>extra</I>,</B>
-<B>int <I>what</I>, void *<I>where</I>);</B>
-</P>
-<P>
-<B>int pcre_info(const pcre *<I>code</I>, int *<I>optptr</I>, int</B>
-<B>*<I>firstcharptr</I>);</B>
-</P>
-<P>
-<B>char *pcre_version(void);</B>
-</P>
-<P>
-<B>void *(*pcre_malloc)(size_t);</B>
-</P>
-<P>
-<B>void (*pcre_free)(void *);</B>
-</P>
-<LI><A NAME="SEC3" HREF="#TOC1">DESCRIPTION</A>
-<P>
-The PCRE library is a set of functions that implement regular expression
-pattern matching using the same syntax and semantics as Perl 5, with just a few
-differences (see below). The current implementation corresponds to Perl 5.005,
-with some additional features from later versions. This includes some
-experimental, incomplete support for UTF-8 encoded strings. Details of exactly
-what is and what is not supported are given below.
-</P>
-<P>
-PCRE has its own native API, which is described in this document. There is also
-a set of wrapper functions that correspond to the POSIX regular expression API.
-These are described in the <B>pcreposix</B> documentation.
-</P>
-<P>
-The native API function prototypes are defined in the header file <B>pcre.h</B>,
-and on Unix systems the library itself is called <B>libpcre.a</B>, so can be
-accessed by adding <B>-lpcre</B> to the command for linking an application which
-calls it. The header file defines the macros PCRE_MAJOR and PCRE_MINOR to
-contain the major and minor release numbers for the library. Applications can
-use these to include support for different releases.
-</P>
-<P>
-The functions <B>pcre_compile()</B>, <B>pcre_study()</B>, and <B>pcre_exec()</B>
-are used for compiling and matching regular expressions. A sample program that
-demonstrates the simplest way of using them is given in the file
-<I>pcredemo.c</I>. The last section of this man page describes how to run it.
-</P>
-<P>
-The functions <B>pcre_copy_substring()</B>, <B>pcre_get_substring()</B>, and
-<B>pcre_get_substring_list()</B> are convenience functions for extracting
-captured substrings from a matched subject string; <B>pcre_free_substring()</B>
-and <B>pcre_free_substring_list()</B> are also provided, to free the memory used
-for extracted strings.
-</P>
-<P>
-The function <B>pcre_maketables()</B> is used (optionally) to build a set of
-character tables in the current locale for passing to <B>pcre_compile()</B>.
-</P>
-<P>
-The function <B>pcre_fullinfo()</B> is used to find out information about a
-compiled pattern; <B>pcre_info()</B> is an obsolete version which returns only
-some of the available information, but is retained for backwards compatibility.
-The function <B>pcre_version()</B> returns a pointer to a string containing the
-version of PCRE and its date of release.
-</P>
-<P>
-The global variables <B>pcre_malloc</B> and <B>pcre_free</B> initially contain
-the entry points of the standard <B>malloc()</B> and <B>free()</B> functions
-respectively. PCRE calls the memory management functions via these variables,
-so a calling program can replace them if it wishes to intercept the calls. This
-should be done before calling any PCRE functions.
-</P>
-<LI><A NAME="SEC4" HREF="#TOC1">MULTI-THREADING</A>
-<P>
-The PCRE functions can be used in multi-threading applications, with the
-proviso that the memory management functions pointed to by <B>pcre_malloc</B>
-and <B>pcre_free</B> are shared by all threads.
-</P>
-<P>
-The compiled form of a regular expression is not altered during matching, so
-the same compiled pattern can safely be used by several threads at once.
-</P>
-<LI><A NAME="SEC5" HREF="#TOC1">COMPILING A PATTERN</A>
-<P>
-The function <B>pcre_compile()</B> is called to compile a pattern into an
-internal form. The pattern is a C string terminated by a binary zero, and
-is passed in the argument <I>pattern</I>. A pointer to a single block of memory
-that is obtained via <B>pcre_malloc</B> is returned. This contains the compiled
-code and related data. The <B>pcre</B> type is defined for the returned block;
-this is a typedef for a structure whose contents are not externally defined. It
-is up to the caller to free the memory when it is no longer required.
-</P>
-<P>
-Although the compiled code of a PCRE regex is relocatable, that is, it does not
-depend on memory location, the complete <B>pcre</B> data block is not
-fully relocatable, because it contains a copy of the <I>tableptr</I> argument,
-which is an address (see below).
-</P>
-<P>
-The size of a compiled pattern is roughly proportional to the length of the
-pattern string, except that each character class (other than those containing
-just a single character, negated or not) requires 33 bytes, and repeat
-quantifiers with a minimum greater than one or a bounded maximum cause the
-relevant portions of the compiled pattern to be replicated.
-</P>
-<P>
-The <I>options</I> argument contains independent bits that affect the
-compilation. It should be zero if no options are required. Some of the options,
-in particular, those that are compatible with Perl, can also be set and unset
-from within the pattern (see the detailed description of regular expressions
-below). For these options, the contents of the <I>options</I> argument specifies
-their initial settings at the start of compilation and execution. The
-PCRE_ANCHORED option can be set at the time of matching as well as at compile
-time.
-</P>
-<P>
-If <I>errptr</I> is NULL, <B>pcre_compile()</B> returns NULL immediately.
-Otherwise, if compilation of a pattern fails, <B>pcre_compile()</B> returns
-NULL, and sets the variable pointed to by <I>errptr</I> to point to a textual
-error message. The offset from the start of the pattern to the character where
-the error was discovered is placed in the variable pointed to by
-<I>erroffset</I>, which must not be NULL. If it is, an immediate error is given.
-</P>
-<P>
-If the final argument, <I>tableptr</I>, is NULL, PCRE uses a default set of
-character tables which are built when it is compiled, using the default C
-locale. Otherwise, <I>tableptr</I> must be the result of a call to
-<B>pcre_maketables()</B>. See the section on locale support below.
-</P>
-<P>
-This code fragment shows a typical straightforward call to <B>pcre_compile()</B>:
-</P>
-<P>
-<PRE>
- pcre *re;
- const char *error;
- int erroffset;
- re = pcre_compile(
- "^A.*Z", /* the pattern */
- 0, /* default options */
- &error, /* for error message */
- &erroffset, /* for error offset */
- NULL); /* use default character tables */
-</PRE>
-</P>
-<P>
-The following option bits are defined in the header file:
-</P>
-<P>
-<PRE>
- PCRE_ANCHORED
-</PRE>
-</P>
-<P>
-If this bit is set, the pattern is forced to be "anchored", that is, it is
-constrained to match only at the start of the string which is being searched
-(the "subject string"). This effect can also be achieved by appropriate
-constructs in the pattern itself, which is the only way to do it in Perl.
-</P>
-<P>
-<PRE>
- PCRE_CASELESS
-</PRE>
-</P>
-<P>
-If this bit is set, letters in the pattern match both upper and lower case
-letters. It is equivalent to Perl's /i option.
-</P>
-<P>
-<PRE>
- PCRE_DOLLAR_ENDONLY
-</PRE>
-</P>
-<P>
-If this bit is set, a dollar metacharacter in the pattern matches only at the
-end of the subject string. Without this option, a dollar also matches
-immediately before the final character if it is a newline (but not before any
-other newlines). The PCRE_DOLLAR_ENDONLY option is ignored if PCRE_MULTILINE is
-set. There is no equivalent to this option in Perl.
-</P>
-<P>
-<PRE>
- PCRE_DOTALL
-</PRE>
-</P>
-<P>
-If this bit is set, a dot metacharater in the pattern matches all characters,
-including newlines. Without it, newlines are excluded. This option is
-equivalent to Perl's /s option. A negative class such as [^a] always matches a
-newline character, independent of the setting of this option.
-</P>
-<P>
-<PRE>
- PCRE_EXTENDED
-</PRE>
-</P>
-<P>
-If this bit is set, whitespace data characters in the pattern are totally
-ignored except when escaped or inside a character class, and characters between
-an unescaped # outside a character class and the next newline character,
-inclusive, are also ignored. This is equivalent to Perl's /x option, and makes
-it possible to include comments inside complicated patterns. Note, however,
-that this applies only to data characters. Whitespace characters may never
-appear within special character sequences in a pattern, for example within the
-sequence (?( which introduces a conditional subpattern.
-</P>
-<P>
-<PRE>
- PCRE_EXTRA
-</PRE>
-</P>
-<P>
-This option was invented in order to turn on additional functionality of PCRE
-that is incompatible with Perl, but it is currently of very little use. When
-set, any backslash in a pattern that is followed by a letter that has no
-special meaning causes an error, thus reserving these combinations for future
-expansion. By default, as in Perl, a backslash followed by a letter with no
-special meaning is treated as a literal. There are at present no other features
-controlled by this option. It can also be set by a (?X) option setting within a
-pattern.
-</P>
-<P>
-<PRE>
- PCRE_MULTILINE
-</PRE>
-</P>
-<P>
-By default, PCRE treats the subject string as consisting of a single "line" of
-characters (even if it actually contains several newlines). The "start of line"
-metacharacter (^) matches only at the start of the string, while the "end of
-line" metacharacter ($) matches only at the end of the string, or before a
-terminating newline (unless PCRE_DOLLAR_ENDONLY is set). This is the same as
-Perl.
-</P>
-<P>
-When PCRE_MULTILINE it is set, the "start of line" and "end of line" constructs
-match immediately following or immediately before any newline in the subject
-string, respectively, as well as at the very start and end. This is equivalent
-to Perl's /m option. If there are no "\n" characters in a subject string, or
-no occurrences of ^ or $ in a pattern, setting PCRE_MULTILINE has no
-effect.
-</P>
-<P>
-<PRE>
- PCRE_UNGREEDY
-</PRE>
-</P>
-<P>
-This option inverts the "greediness" of the quantifiers so that they are not
-greedy by default, but become greedy if followed by "?". It is not compatible
-with Perl. It can also be set by a (?U) option setting within the pattern.
-</P>
-<P>
-<PRE>
- PCRE_UTF8
-</PRE>
-</P>
-<P>
-This option causes PCRE to regard both the pattern and the subject as strings
-of UTF-8 characters instead of just byte strings. However, it is available only
-if PCRE has been built to include UTF-8 support. If not, the use of this option
-provokes an error. Support for UTF-8 is new, experimental, and incomplete.
-Details of exactly what it entails are given below.
-</P>
-<LI><A NAME="SEC6" HREF="#TOC1">STUDYING A PATTERN</A>
-<P>
-When a pattern is going to be used several times, it is worth spending more
-time analyzing it in order to speed up the time taken for matching. The
-function <B>pcre_study()</B> takes a pointer to a compiled pattern as its first
-argument, and returns a pointer to a <B>pcre_extra</B> block (another typedef
-for a structure with hidden contents) containing additional information about
-the pattern; this can be passed to <B>pcre_exec()</B>. If no additional
-information is available, NULL is returned.
-</P>
-<P>
-The second argument contains option bits. At present, no options are defined
-for <B>pcre_study()</B>, and this argument should always be zero.
-</P>
-<P>
-The third argument for <B>pcre_study()</B> is a pointer to an error message. If
-studying succeeds (even if no data is returned), the variable it points to is
-set to NULL. Otherwise it points to a textual error message.
-</P>
-<P>
-This is a typical call to <B>pcre_study</B>():
-</P>
-<P>
-<PRE>
- pcre_extra *pe;
- pe = pcre_study(
- re, /* result of pcre_compile() */
- 0, /* no options exist */
- &error); /* set to NULL or points to a message */
-</PRE>
-</P>
-<P>
-At present, studying a pattern is useful only for non-anchored patterns that do
-not have a single fixed starting character. A bitmap of possible starting
-characters is created.
-</P>
-<LI><A NAME="SEC7" HREF="#TOC1">LOCALE SUPPORT</A>
-<P>
-PCRE handles caseless matching, and determines whether characters are letters,
-digits, or whatever, by reference to a set of tables. The library contains a
-default set of tables which is created in the default C locale when PCRE is
-compiled. This is used when the final argument of <B>pcre_compile()</B> is NULL,
-and is sufficient for many applications.
-</P>
-<P>
-An alternative set of tables can, however, be supplied. Such tables are built
-by calling the <B>pcre_maketables()</B> function, which has no arguments, in the
-relevant locale. The result can then be passed to <B>pcre_compile()</B> as often
-as necessary. For example, to build and use tables that are appropriate for the
-French locale (where accented characters with codes greater than 128 are
-treated as letters), the following code could be used:
-</P>
-<P>
-<PRE>
- setlocale(LC_CTYPE, "fr");
- tables = pcre_maketables();
- re = pcre_compile(..., tables);
-</PRE>
-</P>
-<P>
-The tables are built in memory that is obtained via <B>pcre_malloc</B>. The
-pointer that is passed to <B>pcre_compile</B> is saved with the compiled
-pattern, and the same tables are used via this pointer by <B>pcre_study()</B>
-and <B>pcre_exec()</B>. Thus for any single pattern, compilation, studying and
-matching all happen in the same locale, but different patterns can be compiled
-in different locales. It is the caller's responsibility to ensure that the
-memory containing the tables remains available for as long as it is needed.
-</P>
-<LI><A NAME="SEC8" HREF="#TOC1">INFORMATION ABOUT A PATTERN</A>
-<P>
-The <B>pcre_fullinfo()</B> function returns information about a compiled
-pattern. It replaces the obsolete <B>pcre_info()</B> function, which is
-nevertheless retained for backwards compability (and is documented below).
-</P>
-<P>
-The first argument for <B>pcre_fullinfo()</B> is a pointer to the compiled
-pattern. The second argument is the result of <B>pcre_study()</B>, or NULL if
-the pattern was not studied. The third argument specifies which piece of
-information is required, while the fourth argument is a pointer to a variable
-to receive the data. The yield of the function is zero for success, or one of
-the following negative numbers:
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NULL the argument <I>code</I> was NULL
- the argument <I>where</I> was NULL
- PCRE_ERROR_BADMAGIC the "magic number" was not found
- PCRE_ERROR_BADOPTION the value of <I>what</I> was invalid
-</PRE>
-</P>
-<P>
-Here is a typical call of <B>pcre_fullinfo()</B>, to obtain the length of the
-compiled pattern:
-</P>
-<P>
-<PRE>
- int rc;
- unsigned long int length;
- rc = pcre_fullinfo(
- re, /* result of pcre_compile() */
- pe, /* result of pcre_study(), or NULL */
- PCRE_INFO_SIZE, /* what is required */
- &length); /* where to put the data */
-</PRE>
-</P>
-<P>
-The possible values for the third argument are defined in <B>pcre.h</B>, and are
-as follows:
-</P>
-<P>
-<PRE>
- PCRE_INFO_OPTIONS
-</PRE>
-</P>
-<P>
-Return a copy of the options with which the pattern was compiled. The fourth
-argument should point to an <B>unsigned long int</B> variable. These option bits
-are those specified in the call to <B>pcre_compile()</B>, modified by any
-top-level option settings within the pattern itself, and with the PCRE_ANCHORED
-bit forcibly set if the form of the pattern implies that it can match only at
-the start of a subject string.
-</P>
-<P>
-<PRE>
- PCRE_INFO_SIZE
-</PRE>
-</P>
-<P>
-Return the size of the compiled pattern, that is, the value that was passed as
-the argument to <B>pcre_malloc()</B> when PCRE was getting memory in which to
-place the compiled data. The fourth argument should point to a <B>size_t</B>
-variable.
-</P>
-<P>
-<PRE>
- PCRE_INFO_CAPTURECOUNT
-</PRE>
-</P>
-<P>
-Return the number of capturing subpatterns in the pattern. The fourth argument
-should point to an \fbint\fR variable.
-</P>
-<P>
-<PRE>
- PCRE_INFO_BACKREFMAX
-</PRE>
-</P>
-<P>
-Return the number of the highest back reference in the pattern. The fourth
-argument should point to an <B>int</B> variable. Zero is returned if there are
-no back references.
-</P>
-<P>
-<PRE>
- PCRE_INFO_FIRSTCHAR
-</PRE>
-</P>
-<P>
-Return information about the first character of any matched string, for a
-non-anchored pattern. If there is a fixed first character, e.g. from a pattern
-such as (cat|cow|coyote), it is returned in the integer pointed to by
-<I>where</I>. Otherwise, if either
-</P>
-<P>
-(a) the pattern was compiled with the PCRE_MULTILINE option, and every branch
-starts with "^", or
-</P>
-<P>
-(b) every branch of the pattern starts with ".*" and PCRE_DOTALL is not set
-(if it were set, the pattern would be anchored),
-</P>
-<P>
--1 is returned, indicating that the pattern matches only at the start of a
-subject string or after any "\n" within the string. Otherwise -2 is returned.
-For anchored patterns, -2 is returned.
-</P>
-<P>
-<PRE>
- PCRE_INFO_FIRSTTABLE
-</PRE>
-</P>
-<P>
-If the pattern was studied, and this resulted in the construction of a 256-bit
-table indicating a fixed set of characters for the first character in any
-matching string, a pointer to the table is returned. Otherwise NULL is
-returned. The fourth argument should point to an <B>unsigned char *</B>
-variable.
-</P>
-<P>
-<PRE>
- PCRE_INFO_LASTLITERAL
-</PRE>
-</P>
-<P>
-For a non-anchored pattern, return the value of the rightmost literal character
-which must exist in any matched string, other than at its start. The fourth
-argument should point to an <B>int</B> variable. If there is no such character,
-or if the pattern is anchored, -1 is returned. For example, for the pattern
-/a\d+z\d+/ the returned value is 'z'.
-</P>
-<P>
-The <B>pcre_info()</B> function is now obsolete because its interface is too
-restrictive to return all the available data about a compiled pattern. New
-programs should use <B>pcre_fullinfo()</B> instead. The yield of
-<B>pcre_info()</B> is the number of capturing subpatterns, or one of the
-following negative numbers:
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NULL the argument <I>code</I> was NULL
- PCRE_ERROR_BADMAGIC the "magic number" was not found
-</PRE>
-</P>
-<P>
-If the <I>optptr</I> argument is not NULL, a copy of the options with which the
-pattern was compiled is placed in the integer it points to (see
-PCRE_INFO_OPTIONS above).
-</P>
-<P>
-If the pattern is not anchored and the <I>firstcharptr</I> argument is not NULL,
-it is used to pass back information about the first character of any matched
-string (see PCRE_INFO_FIRSTCHAR above).
-</P>
-<LI><A NAME="SEC9" HREF="#TOC1">MATCHING A PATTERN</A>
-<P>
-The function <B>pcre_exec()</B> is called to match a subject string against a
-pre-compiled pattern, which is passed in the <I>code</I> argument. If the
-pattern has been studied, the result of the study should be passed in the
-<I>extra</I> argument. Otherwise this must be NULL.
-</P>
-<P>
-Here is an example of a simple call to <B>pcre_exec()</B>:
-</P>
-<P>
-<PRE>
- int rc;
- int ovector[30];
- rc = pcre_exec(
- re, /* result of pcre_compile() */
- NULL, /* we didn't study the pattern */
- "some string", /* the subject string */
- 11, /* the length of the subject string */
- 0, /* start at offset 0 in the subject */
- 0, /* default options */
- ovector, /* vector for substring information */
- 30); /* number of elements in the vector */
-</PRE>
-</P>
-<P>
-The PCRE_ANCHORED option can be passed in the <I>options</I> argument, whose
-unused bits must be zero. However, if a pattern was compiled with
-PCRE_ANCHORED, or turned out to be anchored by virtue of its contents, it
-cannot be made unachored at matching time.
-</P>
-<P>
-There are also three further options that can be set only at matching time:
-</P>
-<P>
-<PRE>
- PCRE_NOTBOL
-</PRE>
-</P>
-<P>
-The first character of the string is not the beginning of a line, so the
-circumflex metacharacter should not match before it. Setting this without
-PCRE_MULTILINE (at compile time) causes circumflex never to match.
-</P>
-<P>
-<PRE>
- PCRE_NOTEOL
-</PRE>
-</P>
-<P>
-The end of the string is not the end of a line, so the dollar metacharacter
-should not match it nor (except in multiline mode) a newline immediately before
-it. Setting this without PCRE_MULTILINE (at compile time) causes dollar never
-to match.
-</P>
-<P>
-<PRE>
- PCRE_NOTEMPTY
-</PRE>
-</P>
-<P>
-An empty string is not considered to be a valid match if this option is set. If
-there are alternatives in the pattern, they are tried. If all the alternatives
-match the empty string, the entire match fails. For example, if the pattern
-</P>
-<P>
-<PRE>
- a?b?
-</PRE>
-</P>
-<P>
-is applied to a string not beginning with "a" or "b", it matches the empty
-string at the start of the subject. With PCRE_NOTEMPTY set, this match is not
-valid, so PCRE searches further into the string for occurrences of "a" or "b".
-</P>
-<P>
-Perl has no direct equivalent of PCRE_NOTEMPTY, but it does make a special case
-of a pattern match of the empty string within its <B>split()</B> function, and
-when using the /g modifier. It is possible to emulate Perl's behaviour after
-matching a null string by first trying the match again at the same offset with
-PCRE_NOTEMPTY set, and then if that fails by advancing the starting offset (see
-below) and trying an ordinary match again.
-</P>
-<P>
-The subject string is passed as a pointer in <I>subject</I>, a length in
-<I>length</I>, and a starting offset in <I>startoffset</I>. Unlike the pattern
-string, the subject may contain binary zero characters. When the starting
-offset is zero, the search for a match starts at the beginning of the subject,
-and this is by far the most common case.
-</P>
-<P>
-A non-zero starting offset is useful when searching for another match in the
-same subject by calling <B>pcre_exec()</B> again after a previous success.
-Setting <I>startoffset</I> differs from just passing over a shortened string and
-setting PCRE_NOTBOL in the case of a pattern that begins with any kind of
-lookbehind. For example, consider the pattern
-</P>
-<P>
-<PRE>
- \Biss\B
-</PRE>
-</P>
-<P>
-which finds occurrences of "iss" in the middle of words. (\B matches only if
-the current position in the subject is not a word boundary.) When applied to
-the string "Mississipi" the first call to <B>pcre_exec()</B> finds the first
-occurrence. If <B>pcre_exec()</B> is called again with just the remainder of the
-subject, namely "issipi", it does not match, because \B is always false at the
-start of the subject, which is deemed to be a word boundary. However, if
-<B>pcre_exec()</B> is passed the entire string again, but with <I>startoffset</I>
-set to 4, it finds the second occurrence of "iss" because it is able to look
-behind the starting point to discover that it is preceded by a letter.
-</P>
-<P>
-If a non-zero starting offset is passed when the pattern is anchored, one
-attempt to match at the given offset is tried. This can only succeed if the
-pattern does not require the match to be at the start of the subject.
-</P>
-<P>
-In general, a pattern matches a certain portion of the subject, and in
-addition, further substrings from the subject may be picked out by parts of the
-pattern. Following the usage in Jeffrey Friedl's book, this is called
-"capturing" in what follows, and the phrase "capturing subpattern" is used for
-a fragment of a pattern that picks out a substring. PCRE supports several other
-kinds of parenthesized subpattern that do not cause substrings to be captured.
-</P>
-<P>
-Captured substrings are returned to the caller via a vector of integer offsets
-whose address is passed in <I>ovector</I>. The number of elements in the vector
-is passed in <I>ovecsize</I>. The first two-thirds of the vector is used to pass
-back captured substrings, each substring using a pair of integers. The
-remaining third of the vector is used as workspace by <B>pcre_exec()</B> while
-matching capturing subpatterns, and is not available for passing back
-information. The length passed in <I>ovecsize</I> should always be a multiple of
-three. If it is not, it is rounded down.
-</P>
-<P>
-When a match has been successful, information about captured substrings is
-returned in pairs of integers, starting at the beginning of <I>ovector</I>, and
-continuing up to two-thirds of its length at the most. The first element of a
-pair is set to the offset of the first character in a substring, and the second
-is set to the offset of the first character after the end of a substring. The
-first pair, <I>ovector[0]</I> and <I>ovector[1]</I>, identify the portion of the
-subject string matched by the entire pattern. The next pair is used for the
-first capturing subpattern, and so on. The value returned by <B>pcre_exec()</B>
-is the number of pairs that have been set. If there are no capturing
-subpatterns, the return value from a successful match is 1, indicating that
-just the first pair of offsets has been set.
-</P>
-<P>
-Some convenience functions are provided for extracting the captured substrings
-as separate strings. These are described in the following section.
-</P>
-<P>
-It is possible for an capturing subpattern number <I>n+1</I> to match some
-part of the subject when subpattern <I>n</I> has not been used at all. For
-example, if the string "abc" is matched against the pattern (a|(z))(bc)
-subpatterns 1 and 3 are matched, but 2 is not. When this happens, both offset
-values corresponding to the unused subpattern are set to -1.
-</P>
-<P>
-If a capturing subpattern is matched repeatedly, it is the last portion of the
-string that it matched that gets returned.
-</P>
-<P>
-If the vector is too small to hold all the captured substrings, it is used as
-far as possible (up to two-thirds of its length), and the function returns a
-value of zero. In particular, if the substring offsets are not of interest,
-<B>pcre_exec()</B> may be called with <I>ovector</I> passed as NULL and
-<I>ovecsize</I> as zero. However, if the pattern contains back references and
-the <I>ovector</I> isn't big enough to remember the related substrings, PCRE has
-to get additional memory for use during matching. Thus it is usually advisable
-to supply an <I>ovector</I>.
-</P>
-<P>
-Note that <B>pcre_info()</B> can be used to find out how many capturing
-subpatterns there are in a compiled pattern. The smallest size for
-<I>ovector</I> that will allow for <I>n</I> captured substrings in addition to
-the offsets of the substring matched by the whole pattern is (<I>n</I>+1)*3.
-</P>
-<P>
-If <B>pcre_exec()</B> fails, it returns a negative number. The following are
-defined in the header file:
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NOMATCH (-1)
-</PRE>
-</P>
-<P>
-The subject string did not match the pattern.
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NULL (-2)
-</PRE>
-</P>
-<P>
-Either <I>code</I> or <I>subject</I> was passed as NULL, or <I>ovector</I> was
-NULL and <I>ovecsize</I> was not zero.
-</P>
-<P>
-<PRE>
- PCRE_ERROR_BADOPTION (-3)
-</PRE>
-</P>
-<P>
-An unrecognized bit was set in the <I>options</I> argument.
-</P>
-<P>
-<PRE>
- PCRE_ERROR_BADMAGIC (-4)
-</PRE>
-</P>
-<P>
-PCRE stores a 4-byte "magic number" at the start of the compiled code, to catch
-the case when it is passed a junk pointer. This is the error it gives when the
-magic number isn't present.
-</P>
-<P>
-<PRE>
- PCRE_ERROR_UNKNOWN_NODE (-5)
-</PRE>
-</P>
-<P>
-While running the pattern match, an unknown item was encountered in the
-compiled pattern. This error could be caused by a bug in PCRE or by overwriting
-of the compiled pattern.
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NOMEMORY (-6)
-</PRE>
-</P>
-<P>
-If a pattern contains back references, but the <I>ovector</I> that is passed to
-<B>pcre_exec()</B> is not big enough to remember the referenced substrings, PCRE
-gets a block of memory at the start of matching to use for this purpose. If the
-call via <B>pcre_malloc()</B> fails, this error is given. The memory is freed at
-the end of matching.
-</P>
-<LI><A NAME="SEC10" HREF="#TOC1">EXTRACTING CAPTURED SUBSTRINGS</A>
-<P>
-Captured substrings can be accessed directly by using the offsets returned by
-<B>pcre_exec()</B> in <I>ovector</I>. For convenience, the functions
-<B>pcre_copy_substring()</B>, <B>pcre_get_substring()</B>, and
-<B>pcre_get_substring_list()</B> are provided for extracting captured substrings
-as new, separate, zero-terminated strings. A substring that contains a binary
-zero is correctly extracted and has a further zero added on the end, but the
-result does not, of course, function as a C string.
-</P>
-<P>
-The first three arguments are the same for all three functions: <I>subject</I>
-is the subject string which has just been successfully matched, <I>ovector</I>
-is a pointer to the vector of integer offsets that was passed to
-<B>pcre_exec()</B>, and <I>stringcount</I> is the number of substrings that
-were captured by the match, including the substring that matched the entire
-regular expression. This is the value returned by <B>pcre_exec</B> if it
-is greater than zero. If <B>pcre_exec()</B> returned zero, indicating that it
-ran out of space in <I>ovector</I>, the value passed as <I>stringcount</I> should
-be the size of the vector divided by three.
-</P>
-<P>
-The functions <B>pcre_copy_substring()</B> and <B>pcre_get_substring()</B>
-extract a single substring, whose number is given as <I>stringnumber</I>. A
-value of zero extracts the substring that matched the entire pattern, while
-higher values extract the captured substrings. For <B>pcre_copy_substring()</B>,
-the string is placed in <I>buffer</I>, whose length is given by
-<I>buffersize</I>, while for <B>pcre_get_substring()</B> a new block of memory is
-obtained via <B>pcre_malloc</B>, and its address is returned via
-<I>stringptr</I>. The yield of the function is the length of the string, not
-including the terminating zero, or one of
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NOMEMORY (-6)
-</PRE>
-</P>
-<P>
-The buffer was too small for <B>pcre_copy_substring()</B>, or the attempt to get
-memory failed for <B>pcre_get_substring()</B>.
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NOSUBSTRING (-7)
-</PRE>
-</P>
-<P>
-There is no substring whose number is <I>stringnumber</I>.
-</P>
-<P>
-The <B>pcre_get_substring_list()</B> function extracts all available substrings
-and builds a list of pointers to them. All this is done in a single block of
-memory which is obtained via <B>pcre_malloc</B>. The address of the memory block
-is returned via <I>listptr</I>, which is also the start of the list of string
-pointers. The end of the list is marked by a NULL pointer. The yield of the
-function is zero if all went well, or
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NOMEMORY (-6)
-</PRE>
-</P>
-<P>
-if the attempt to get the memory block failed.
-</P>
-<P>
-When any of these functions encounter a substring that is unset, which can
-happen when capturing subpattern number <I>n+1</I> matches some part of the
-subject, but subpattern <I>n</I> has not been used at all, they return an empty
-string. This can be distinguished from a genuine zero-length substring by
-inspecting the appropriate offset in <I>ovector</I>, which is negative for unset
-substrings.
-</P>
-<P>
-The two convenience functions <B>pcre_free_substring()</B> and
-<B>pcre_free_substring_list()</B> can be used to free the memory returned by
-a previous call of <B>pcre_get_substring()</B> or
-<B>pcre_get_substring_list()</B>, respectively. They do nothing more than call
-the function pointed to by <B>pcre_free</B>, which of course could be called
-directly from a C program. However, PCRE is used in some situations where it is
-linked via a special interface to another programming language which cannot use
-<B>pcre_free</B> directly; it is for these cases that the functions are
-provided.
-</P>
-<LI><A NAME="SEC11" HREF="#TOC1">LIMITATIONS</A>
-<P>
-There are some size limitations in PCRE but it is hoped that they will never in
-practice be relevant.
-The maximum length of a compiled pattern is 65539 (sic) bytes.
-All values in repeating quantifiers must be less than 65536.
-There maximum number of capturing subpatterns is 65535.
-There is no limit to the number of non-capturing subpatterns, but the maximum
-depth of nesting of all kinds of parenthesized subpattern, including capturing
-subpatterns, assertions, and other types of subpattern, is 200.
-</P>
-<P>
-The maximum length of a subject string is the largest positive number that an
-integer variable can hold. However, PCRE uses recursion to handle subpatterns
-and indefinite repetition. This means that the available stack space may limit
-the size of a subject string that can be processed by certain patterns.
-</P>
-<LI><A NAME="SEC12" HREF="#TOC1">DIFFERENCES FROM PERL</A>
-<P>
-The differences described here are with respect to Perl 5.005.
-</P>
-<P>
-1. By default, a whitespace character is any character that the C library
-function <B>isspace()</B> recognizes, though it is possible to compile PCRE with
-alternative character type tables. Normally <B>isspace()</B> matches space,
-formfeed, newline, carriage return, horizontal tab, and vertical tab. Perl 5
-no longer includes vertical tab in its set of whitespace characters. The \v
-escape that was in the Perl documentation for a long time was never in fact
-recognized. However, the character itself was treated as whitespace at least
-up to 5.002. In 5.004 and 5.005 it does not match \s.
-</P>
-<P>
-2. PCRE does not allow repeat quantifiers on lookahead assertions. Perl permits
-them, but they do not mean what you might think. For example, (?!a){3} does
-not assert that the next three characters are not "a". It just asserts that the
-next character is not "a" three times.
-</P>
-<P>
-3. Capturing subpatterns that occur inside negative lookahead assertions are
-counted, but their entries in the offsets vector are never set. Perl sets its
-numerical variables from any such patterns that are matched before the
-assertion fails to match something (thereby succeeding), but only if the
-negative lookahead assertion contains just one branch.
-</P>
-<P>
-4. Though binary zero characters are supported in the subject string, they are
-not allowed in a pattern string because it is passed as a normal C string,
-terminated by zero. The escape sequence "\0" can be used in the pattern to
-represent a binary zero.
-</P>
-<P>
-5. The following Perl escape sequences are not supported: \l, \u, \L, \U,
-\E, \Q. In fact these are implemented by Perl's general string-handling and
-are not part of its pattern matching engine.
-</P>
-<P>
-6. The Perl \G assertion is not supported as it is not relevant to single
-pattern matches.
-</P>
-<P>
-7. Fairly obviously, PCRE does not support the (?{code}) and (?p{code})
-constructions. However, there is some experimental support for recursive
-patterns using the non-Perl item (?R).
-</P>
-<P>
-8. There are at the time of writing some oddities in Perl 5.005_02 concerned
-with the settings of captured strings when part of a pattern is repeated. For
-example, matching "aba" against the pattern /^(a(b)?)+$/ sets $2 to the value
-"b", but matching "aabbaa" against /^(aa(bb)?)+$/ leaves $2 unset. However, if
-the pattern is changed to /^(aa(b(b))?)+$/ then $2 (and $3) are set.
-</P>
-<P>
-In Perl 5.004 $2 is set in both cases, and that is also true of PCRE. If in the
-future Perl changes to a consistent state that is different, PCRE may change to
-follow.
-</P>
-<P>
-9. Another as yet unresolved discrepancy is that in Perl 5.005_02 the pattern
-/^(a)?(?(1)a|b)+$/ matches the string "a", whereas in PCRE it does not.
-However, in both Perl and PCRE /^(a)?a/ matched against "a" leaves $1 unset.
-</P>
-<P>
-10. PCRE provides some extensions to the Perl regular expression facilities:
-</P>
-<P>
-(a) Although lookbehind assertions must match fixed length strings, each
-alternative branch of a lookbehind assertion can match a different length of
-string. Perl 5.005 requires them all to have the same length.
-</P>
-<P>
-(b) If PCRE_DOLLAR_ENDONLY is set and PCRE_MULTILINE is not set, the $ meta-
-character matches only at the very end of the string.
-</P>
-<P>
-(c) If PCRE_EXTRA is set, a backslash followed by a letter with no special
-meaning is faulted.
-</P>
-<P>
-(d) If PCRE_UNGREEDY is set, the greediness of the repetition quantifiers is
-inverted, that is, by default they are not greedy, but if followed by a
-question mark they are.
-</P>
-<P>
-(e) PCRE_ANCHORED can be used to force a pattern to be tried only at the start
-of the subject.
-</P>
-<P>
-(f) The PCRE_NOTBOL, PCRE_NOTEOL, and PCRE_NOTEMPTY options for
-<B>pcre_exec()</B> have no Perl equivalents.
-</P>
-<P>
-(g) The (?R) construct allows for recursive pattern matching (Perl 5.6 can do
-this using the (?p{code}) construct, which PCRE cannot of course support.)
-</P>
-<LI><A NAME="SEC13" HREF="#TOC1">REGULAR EXPRESSION DETAILS</A>
-<P>
-The syntax and semantics of the regular expressions supported by PCRE are
-described below. Regular expressions are also described in the Perl
-documentation and in a number of other books, some of which have copious
-examples. Jeffrey Friedl's "Mastering Regular Expressions", published by
-O'Reilly (ISBN 1-56592-257), covers them in great detail.
-</P>
-<P>
-The description here is intended as reference documentation. The basic
-operation of PCRE is on strings of bytes. However, there is the beginnings of
-some support for UTF-8 character strings. To use this support you must
-configure PCRE to include it, and then call <B>pcre_compile()</B> with the
-PCRE_UTF8 option. How this affects the pattern matching is described in the
-final section of this document.
-</P>
-<P>
-A regular expression is a pattern that is matched against a subject string from
-left to right. Most characters stand for themselves in a pattern, and match the
-corresponding characters in the subject. As a trivial example, the pattern
-</P>
-<P>
-<PRE>
- The quick brown fox
-</PRE>
-</P>
-<P>
-matches a portion of a subject string that is identical to itself. The power of
-regular expressions comes from the ability to include alternatives and
-repetitions in the pattern. These are encoded in the pattern by the use of
-<I>meta-characters</I>, which do not stand for themselves but instead are
-interpreted in some special way.
-</P>
-<P>
-There are two different sets of meta-characters: those that are recognized
-anywhere in the pattern except within square brackets, and those that are
-recognized in square brackets. Outside square brackets, the meta-characters are
-as follows:
-</P>
-<P>
-<PRE>
- \ general escape character with several uses
- ^ assert start of subject (or line, in multiline mode)
- $ assert end of subject (or line, in multiline mode)
- . match any character except newline (by default)
- [ start character class definition
- | start of alternative branch
- ( start subpattern
- ) end subpattern
- ? extends the meaning of (
- also 0 or 1 quantifier
- also quantifier minimizer
- * 0 or more quantifier
- + 1 or more quantifier
- { start min/max quantifier
-</PRE>
-</P>
-<P>
-Part of a pattern that is in square brackets is called a "character class". In
-a character class the only meta-characters are:
-</P>
-<P>
-<PRE>
- \ general escape character
- ^ negate the class, but only if the first character
- - indicates character range
- ] terminates the character class
-</PRE>
-</P>
-<P>
-The following sections describe the use of each of the meta-characters.
-</P>
-<LI><A NAME="SEC14" HREF="#TOC1">BACKSLASH</A>
-<P>
-The backslash character has several uses. Firstly, if it is followed by a
-non-alphameric character, it takes away any special meaning that character may
-have. This use of backslash as an escape character applies both inside and
-outside character classes.
-</P>
-<P>
-For example, if you want to match a "*" character, you write "\*" in the
-pattern. This applies whether or not the following character would otherwise be
-interpreted as a meta-character, so it is always safe to precede a
-non-alphameric with "\" to specify that it stands for itself. In particular,
-if you want to match a backslash, you write "\\".
-</P>
-<P>
-If a pattern is compiled with the PCRE_EXTENDED option, whitespace in the
-pattern (other than in a character class) and characters between a "#" outside
-a character class and the next newline character are ignored. An escaping
-backslash can be used to include a whitespace or "#" character as part of the
-pattern.
-</P>
-<P>
-A second use of backslash provides a way of encoding non-printing characters
-in patterns in a visible manner. There is no restriction on the appearance of
-non-printing characters, apart from the binary zero that terminates a pattern,
-but when a pattern is being prepared by text editing, it is usually easier to
-use one of the following escape sequences than the binary character it
-represents:
-</P>
-<P>
-<PRE>
- \a alarm, that is, the BEL character (hex 07)
- \cx "control-x", where x is any character
- \e escape (hex 1B)
- \f formfeed (hex 0C)
- \n newline (hex 0A)
- \r carriage return (hex 0D)
- \t tab (hex 09)
- \xhh character with hex code hh
- \ddd character with octal code ddd, or backreference
-</PRE>
-</P>
-<P>
-The precise effect of "\cx" is as follows: if "x" is a lower case letter, it
-is converted to upper case. Then bit 6 of the character (hex 40) is inverted.
-Thus "\cz" becomes hex 1A, but "\c{" becomes hex 3B, while "\c;" becomes hex
-7B.
-</P>
-<P>
-After "\x", up to two hexadecimal digits are read (letters can be in upper or
-lower case).
-</P>
-<P>
-After "\0" up to two further octal digits are read. In both cases, if there
-are fewer than two digits, just those that are present are used. Thus the
-sequence "\0\x\07" specifies two binary zeros followed by a BEL character.
-Make sure you supply two digits after the initial zero if the character that
-follows is itself an octal digit.
-</P>
-<P>
-The handling of a backslash followed by a digit other than 0 is complicated.
-Outside a character class, PCRE reads it and any following digits as a decimal
-number. If the number is less than 10, or if there have been at least that many
-previous capturing left parentheses in the expression, the entire sequence is
-taken as a <I>back reference</I>. A description of how this works is given
-later, following the discussion of parenthesized subpatterns.
-</P>
-<P>
-Inside a character class, or if the decimal number is greater than 9 and there
-have not been that many capturing subpatterns, PCRE re-reads up to three octal
-digits following the backslash, and generates a single byte from the least
-significant 8 bits of the value. Any subsequent digits stand for themselves.
-For example:
-</P>
-<P>
-<PRE>
- \040 is another way of writing a space
- \40 is the same, provided there are fewer than 40
- previous capturing subpatterns
- \7 is always a back reference
- \11 might be a back reference, or another way of
- writing a tab
- \011 is always a tab
- \0113 is a tab followed by the character "3"
- \113 is the character with octal code 113 (since there
- can be no more than 99 back references)
- \377 is a byte consisting entirely of 1 bits
- \81 is either a back reference, or a binary zero
- followed by the two characters "8" and "1"
-</PRE>
-</P>
-<P>
-Note that octal values of 100 or greater must not be introduced by a leading
-zero, because no more than three octal digits are ever read.
-</P>
-<P>
-All the sequences that define a single byte value can be used both inside and
-outside character classes. In addition, inside a character class, the sequence
-"\b" is interpreted as the backspace character (hex 08). Outside a character
-class it has a different meaning (see below).
-</P>
-<P>
-The third use of backslash is for specifying generic character types:
-</P>
-<P>
-<PRE>
- \d any decimal digit
- \D any character that is not a decimal digit
- \s any whitespace character
- \S any character that is not a whitespace character
- \w any "word" character
- \W any "non-word" character
-</PRE>
-</P>
-<P>
-Each pair of escape sequences partitions the complete set of characters into
-two disjoint sets. Any given character matches one, and only one, of each pair.
-</P>
-<P>
-A "word" character is any letter or digit or the underscore character, that is,
-any character which can be part of a Perl "word". The definition of letters and
-digits is controlled by PCRE's character tables, and may vary if locale-
-specific matching is taking place (see "Locale support" above). For example, in
-the "fr" (French) locale, some character codes greater than 128 are used for
-accented letters, and these are matched by \w.
-</P>
-<P>
-These character type sequences can appear both inside and outside character
-classes. They each match one character of the appropriate type. If the current
-matching point is at the end of the subject string, all of them fail, since
-there is no character to match.
-</P>
-<P>
-The fourth use of backslash is for certain simple assertions. An assertion
-specifies a condition that has to be met at a particular point in a match,
-without consuming any characters from the subject string. The use of
-subpatterns for more complicated assertions is described below. The backslashed
-assertions are
-</P>
-<P>
-<PRE>
- \b word boundary
- \B not a word boundary
- \A start of subject (independent of multiline mode)
- \Z end of subject or newline at end (independent of multiline mode)
- \z end of subject (independent of multiline mode)
-</PRE>
-</P>
-<P>
-These assertions may not appear in character classes (but note that "\b" has a
-different meaning, namely the backspace character, inside a character class).
-</P>
-<P>
-A word boundary is a position in the subject string where the current character
-and the previous character do not both match \w or \W (i.e. one matches
-\w and the other matches \W), or the start or end of the string if the
-first or last character matches \w, respectively.
-</P>
-<P>
-The \A, \Z, and \z assertions differ from the traditional circumflex and
-dollar (described below) in that they only ever match at the very start and end
-of the subject string, whatever options are set. They are not affected by the
-PCRE_NOTBOL or PCRE_NOTEOL options. If the <I>startoffset</I> argument of
-<B>pcre_exec()</B> is non-zero, \A can never match. The difference between \Z
-and \z is that \Z matches before a newline that is the last character of the
-string as well as at the end of the string, whereas \z matches only at the
-end.
-</P>
-<LI><A NAME="SEC15" HREF="#TOC1">CIRCUMFLEX AND DOLLAR</A>
-<P>
-Outside a character class, in the default matching mode, the circumflex
-character is an assertion which is true only if the current matching point is
-at the start of the subject string. If the <I>startoffset</I> argument of
-<B>pcre_exec()</B> is non-zero, circumflex can never match. Inside a character
-class, circumflex has an entirely different meaning (see below).
-</P>
-<P>
-Circumflex need not be the first character of the pattern if a number of
-alternatives are involved, but it should be the first thing in each alternative
-in which it appears if the pattern is ever to match that branch. If all
-possible alternatives start with a circumflex, that is, if the pattern is
-constrained to match only at the start of the subject, it is said to be an
-"anchored" pattern. (There are also other constructs that can cause a pattern
-to be anchored.)
-</P>
-<P>
-A dollar character is an assertion which is true only if the current matching
-point is at the end of the subject string, or immediately before a newline
-character that is the last character in the string (by default). Dollar need
-not be the last character of the pattern if a number of alternatives are
-involved, but it should be the last item in any branch in which it appears.
-Dollar has no special meaning in a character class.
-</P>
-<P>
-The meaning of dollar can be changed so that it matches only at the very end of
-the string, by setting the PCRE_DOLLAR_ENDONLY option at compile or matching
-time. This does not affect the \Z assertion.
-</P>
-<P>
-The meanings of the circumflex and dollar characters are changed if the
-PCRE_MULTILINE option is set. When this is the case, they match immediately
-after and immediately before an internal "\n" character, respectively, in
-addition to matching at the start and end of the subject string. For example,
-the pattern /^abc$/ matches the subject string "def\nabc" in multiline mode,
-but not otherwise. Consequently, patterns that are anchored in single line mode
-because all branches start with "^" are not anchored in multiline mode, and a
-match for circumflex is possible when the <I>startoffset</I> argument of
-<B>pcre_exec()</B> is non-zero. The PCRE_DOLLAR_ENDONLY option is ignored if
-PCRE_MULTILINE is set.
-</P>
-<P>
-Note that the sequences \A, \Z, and \z can be used to match the start and
-end of the subject in both modes, and if all branches of a pattern start with
-\A it is always anchored, whether PCRE_MULTILINE is set or not.
-</P>
-<LI><A NAME="SEC16" HREF="#TOC1">FULL STOP (PERIOD, DOT)</A>
-<P>
-Outside a character class, a dot in the pattern matches any one character in
-the subject, including a non-printing character, but not (by default) newline.
-If the PCRE_DOTALL option is set, dots match newlines as well. The handling of
-dot is entirely independent of the handling of circumflex and dollar, the only
-relationship being that they both involve newline characters. Dot has no
-special meaning in a character class.
-</P>
-<LI><A NAME="SEC17" HREF="#TOC1">SQUARE BRACKETS</A>
-<P>
-An opening square bracket introduces a character class, terminated by a closing
-square bracket. A closing square bracket on its own is not special. If a
-closing square bracket is required as a member of the class, it should be the
-first data character in the class (after an initial circumflex, if present) or
-escaped with a backslash.
-</P>
-<P>
-A character class matches a single character in the subject; the character must
-be in the set of characters defined by the class, unless the first character in
-the class is a circumflex, in which case the subject character must not be in
-the set defined by the class. If a circumflex is actually required as a member
-of the class, ensure it is not the first character, or escape it with a
-backslash.
-</P>
-<P>
-For example, the character class [aeiou] matches any lower case vowel, while
-[^aeiou] matches any character that is not a lower case vowel. Note that a
-circumflex is just a convenient notation for specifying the characters which
-are in the class by enumerating those that are not. It is not an assertion: it
-still consumes a character from the subject string, and fails if the current
-pointer is at the end of the string.
-</P>
-<P>
-When caseless matching is set, any letters in a class represent both their
-upper case and lower case versions, so for example, a caseless [aeiou] matches
-"A" as well as "a", and a caseless [^aeiou] does not match "A", whereas a
-caseful version would.
-</P>
-<P>
-The newline character is never treated in any special way in character classes,
-whatever the setting of the PCRE_DOTALL or PCRE_MULTILINE options is. A class
-such as [^a] will always match a newline.
-</P>
-<P>
-The minus (hyphen) character can be used to specify a range of characters in a
-character class. For example, [d-m] matches any letter between d and m,
-inclusive. If a minus character is required in a class, it must be escaped with
-a backslash or appear in a position where it cannot be interpreted as
-indicating a range, typically as the first or last character in the class.
-</P>
-<P>
-It is not possible to have the literal character "]" as the end character of a
-range. A pattern such as [W-]46] is interpreted as a class of two characters
-("W" and "-") followed by a literal string "46]", so it would match "W46]" or
-"-46]". However, if the "]" is escaped with a backslash it is interpreted as
-the end of range, so [W-\]46] is interpreted as a single class containing a
-range followed by two separate characters. The octal or hexadecimal
-representation of "]" can also be used to end a range.
-</P>
-<P>
-Ranges operate in ASCII collating sequence. They can also be used for
-characters specified numerically, for example [\000-\037]. If a range that
-includes letters is used when caseless matching is set, it matches the letters
-in either case. For example, [W-c] is equivalent to [][\^_`wxyzabc], matched
-caselessly, and if character tables for the "fr" locale are in use,
-[\xc8-\xcb] matches accented E characters in both cases.
-</P>
-<P>
-The character types \d, \D, \s, \S, \w, and \W may also appear in a
-character class, and add the characters that they match to the class. For
-example, [\dABCDEF] matches any hexadecimal digit. A circumflex can
-conveniently be used with the upper case character types to specify a more
-restricted set of characters than the matching lower case type. For example,
-the class [^\W_] matches any letter or digit, but not underscore.
-</P>
-<P>
-All non-alphameric characters other than \, -, ^ (at the start) and the
-terminating ] are non-special in character classes, but it does no harm if they
-are escaped.
-</P>
-<LI><A NAME="SEC18" HREF="#TOC1">POSIX CHARACTER CLASSES</A>
-<P>
-Perl 5.6 (not yet released at the time of writing) is going to support the
-POSIX notation for character classes, which uses names enclosed by [: and :]
-within the enclosing square brackets. PCRE supports this notation. For example,
-</P>
-<P>
-<PRE>
- [01[:alpha:]%]
-</PRE>
-</P>
-<P>
-matches "0", "1", any alphabetic character, or "%". The supported class names
-are
-</P>
-<P>
-<PRE>
- alnum letters and digits
- alpha letters
- ascii character codes 0 - 127
- cntrl control characters
- digit decimal digits (same as \d)
- graph printing characters, excluding space
- lower lower case letters
- print printing characters, including space
- punct printing characters, excluding letters and digits
- space white space (same as \s)
- upper upper case letters
- word "word" characters (same as \w)
- xdigit hexadecimal digits
-</PRE>
-</P>
-<P>
-&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;Only WORD is perl. BLANK is GNU.
-</P>
-<P>
-The names "ascii" and "word" are Perl extensions. Another Perl extension is
-negation, which is indicated by a ^ character after the colon. For example,
-</P>
-<P>
-<PRE>
- [12[:^digit:]]
-</PRE>
-</P>
-<P>
-matches "1", "2", or any non-digit. PCRE (and Perl) also recognize the POSIX
-syntax [.ch.] and [=ch=] where "ch" is a "collating element", but these are not
-supported, and an error is given if they are encountered.
-</P>
-<LI><A NAME="SEC19" HREF="#TOC1">VERTICAL BAR</A>
-<P>
-Vertical bar characters are used to separate alternative patterns. For example,
-the pattern
-</P>
-<P>
-<PRE>
- gilbert|sullivan
-</PRE>
-</P>
-<P>
-matches either "gilbert" or "sullivan". Any number of alternatives may appear,
-and an empty alternative is permitted (matching the empty string).
-The matching process tries each alternative in turn, from left to right,
-and the first one that succeeds is used. If the alternatives are within a
-subpattern (defined below), "succeeds" means matching the rest of the main
-pattern as well as the alternative in the subpattern.
-</P>
-<LI><A NAME="SEC20" HREF="#TOC1">INTERNAL OPTION SETTING</A>
-<P>
-The settings of PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and PCRE_EXTENDED
-can be changed from within the pattern by a sequence of Perl option letters
-enclosed between "(?" and ")". The option letters are
-</P>
-<P>
-<PRE>
- i for PCRE_CASELESS
- m for PCRE_MULTILINE
- s for PCRE_DOTALL
- x for PCRE_EXTENDED
-</PRE>
-</P>
-<P>
-For example, (?im) sets caseless, multiline matching. It is also possible to
-unset these options by preceding the letter with a hyphen, and a combined
-setting and unsetting such as (?im-sx), which sets PCRE_CASELESS and
-PCRE_MULTILINE while unsetting PCRE_DOTALL and PCRE_EXTENDED, is also
-permitted. If a letter appears both before and after the hyphen, the option is
-unset.
-</P>
-<P>
-The scope of these option changes depends on where in the pattern the setting
-occurs. For settings that are outside any subpattern (defined below), the
-effect is the same as if the options were set or unset at the start of
-matching. The following patterns all behave in exactly the same way:
-</P>
-<P>
-<PRE>
- (?i)abc
- a(?i)bc
- ab(?i)c
- abc(?i)
-</PRE>
-</P>
-<P>
-which in turn is the same as compiling the pattern abc with PCRE_CASELESS set.
-In other words, such "top level" settings apply to the whole pattern (unless
-there are other changes inside subpatterns). If there is more than one setting
-of the same option at top level, the rightmost setting is used.
-</P>
-<P>
-If an option change occurs inside a subpattern, the effect is different. This
-is a change of behaviour in Perl 5.005. An option change inside a subpattern
-affects only that part of the subpattern that follows it, so
-</P>
-<P>
-<PRE>
- (a(?i)b)c
-</PRE>
-</P>
-<P>
-matches abc and aBc and no other strings (assuming PCRE_CASELESS is not used).
-By this means, options can be made to have different settings in different
-parts of the pattern. Any changes made in one alternative do carry on
-into subsequent branches within the same subpattern. For example,
-</P>
-<P>
-<PRE>
- (a(?i)b|c)
-</PRE>
-</P>
-<P>
-matches "ab", "aB", "c", and "C", even though when matching "C" the first
-branch is abandoned before the option setting. This is because the effects of
-option settings happen at compile time. There would be some very weird
-behaviour otherwise.
-</P>
-<P>
-The PCRE-specific options PCRE_UNGREEDY and PCRE_EXTRA can be changed in the
-same way as the Perl-compatible options by using the characters U and X
-respectively. The (?X) flag setting is special in that it must always occur
-earlier in the pattern than any of the additional features it turns on, even
-when it is at top level. It is best put at the start.
-</P>
-<LI><A NAME="SEC21" HREF="#TOC1">SUBPATTERNS</A>
-<P>
-Subpatterns are delimited by parentheses (round brackets), which can be nested.
-Marking part of a pattern as a subpattern does two things:
-</P>
-<P>
-1. It localizes a set of alternatives. For example, the pattern
-</P>
-<P>
-<PRE>
- cat(aract|erpillar|)
-</PRE>
-</P>
-<P>
-matches one of the words "cat", "cataract", or "caterpillar". Without the
-parentheses, it would match "cataract", "erpillar" or the empty string.
-</P>
-<P>
-2. It sets up the subpattern as a capturing subpattern (as defined above).
-When the whole pattern matches, that portion of the subject string that matched
-the subpattern is passed back to the caller via the <I>ovector</I> argument of
-<B>pcre_exec()</B>. Opening parentheses are counted from left to right (starting
-from 1) to obtain the numbers of the capturing subpatterns.
-</P>
-<P>
-For example, if the string "the red king" is matched against the pattern
-</P>
-<P>
-<PRE>
- the ((red|white) (king|queen))
-</PRE>
-</P>
-<P>
-the captured substrings are "red king", "red", and "king", and are numbered 1,
-2, and 3, respectively.
-</P>
-<P>
-The fact that plain parentheses fulfil two functions is not always helpful.
-There are often times when a grouping subpattern is required without a
-capturing requirement. If an opening parenthesis is followed by "?:", the
-subpattern does not do any capturing, and is not counted when computing the
-number of any subsequent capturing subpatterns. For example, if the string "the
-white queen" is matched against the pattern
-</P>
-<P>
-<PRE>
- the ((?:red|white) (king|queen))
-</PRE>
-</P>
-<P>
-the captured substrings are "white queen" and "queen", and are numbered 1 and
-2. The maximum number of captured substrings is 99, and the maximum number of
-all subpatterns, both capturing and non-capturing, is 200.
-</P>
-<P>
-As a convenient shorthand, if any option settings are required at the start of
-a non-capturing subpattern, the option letters may appear between the "?" and
-the ":". Thus the two patterns
-</P>
-<P>
-<PRE>
- (?i:saturday|sunday)
- (?:(?i)saturday|sunday)
-</PRE>
-</P>
-<P>
-match exactly the same set of strings. Because alternative branches are tried
-from left to right, and options are not reset until the end of the subpattern
-is reached, an option setting in one branch does affect subsequent branches, so
-the above patterns match "SUNDAY" as well as "Saturday".
-</P>
-<LI><A NAME="SEC22" HREF="#TOC1">REPETITION</A>
-<P>
-Repetition is specified by quantifiers, which can follow any of the following
-items:
-</P>
-<P>
-<PRE>
- a single character, possibly escaped
- the . metacharacter
- a character class
- a back reference (see next section)
- a parenthesized subpattern (unless it is an assertion - see below)
-</PRE>
-</P>
-<P>
-The general repetition quantifier specifies a minimum and maximum number of
-permitted matches, by giving the two numbers in curly brackets (braces),
-separated by a comma. The numbers must be less than 65536, and the first must
-be less than or equal to the second. For example:
-</P>
-<P>
-<PRE>
- z{2,4}
-</PRE>
-</P>
-<P>
-matches "zz", "zzz", or "zzzz". A closing brace on its own is not a special
-character. If the second number is omitted, but the comma is present, there is
-no upper limit; if the second number and the comma are both omitted, the
-quantifier specifies an exact number of required matches. Thus
-</P>
-<P>
-<PRE>
- [aeiou]{3,}
-</PRE>
-</P>
-<P>
-matches at least 3 successive vowels, but may match many more, while
-</P>
-<P>
-<PRE>
- \d{8}
-</PRE>
-</P>
-<P>
-matches exactly 8 digits. An opening curly bracket that appears in a position
-where a quantifier is not allowed, or one that does not match the syntax of a
-quantifier, is taken as a literal character. For example, {,6} is not a
-quantifier, but a literal string of four characters.
-</P>
-<P>
-The quantifier {0} is permitted, causing the expression to behave as if the
-previous item and the quantifier were not present.
-</P>
-<P>
-For convenience (and historical compatibility) the three most common
-quantifiers have single-character abbreviations:
-</P>
-<P>
-<PRE>
- * is equivalent to {0,}
- + is equivalent to {1,}
- ? is equivalent to {0,1}
-</PRE>
-</P>
-<P>
-It is possible to construct infinite loops by following a subpattern that can
-match no characters with a quantifier that has no upper limit, for example:
-</P>
-<P>
-<PRE>
- (a?)*
-</PRE>
-</P>
-<P>
-Earlier versions of Perl and PCRE used to give an error at compile time for
-such patterns. However, because there are cases where this can be useful, such
-patterns are now accepted, but if any repetition of the subpattern does in fact
-match no characters, the loop is forcibly broken.
-</P>
-<P>
-By default, the quantifiers are "greedy", that is, they match as much as
-possible (up to the maximum number of permitted times), without causing the
-rest of the pattern to fail. The classic example of where this gives problems
-is in trying to match comments in C programs. These appear between the
-sequences /* and */ and within the sequence, individual * and / characters may
-appear. An attempt to match C comments by applying the pattern
-</P>
-<P>
-<PRE>
- /\*.*\*/
-</PRE>
-</P>
-<P>
-to the string
-</P>
-<P>
-<PRE>
- /* first command */ not comment /* second comment */
-</PRE>
-</P>
-<P>
-fails, because it matches the entire string owing to the greediness of the .*
-item.
-</P>
-<P>
-However, if a quantifier is followed by a question mark, it ceases to be
-greedy, and instead matches the minimum number of times possible, so the
-pattern
-</P>
-<P>
-<PRE>
- /\*.*?\*/
-</PRE>
-</P>
-<P>
-does the right thing with the C comments. The meaning of the various
-quantifiers is not otherwise changed, just the preferred number of matches.
-Do not confuse this use of question mark with its use as a quantifier in its
-own right. Because it has two uses, it can sometimes appear doubled, as in
-</P>
-<P>
-<PRE>
- \d??\d
-</PRE>
-</P>
-<P>
-which matches one digit by preference, but can match two if that is the only
-way the rest of the pattern matches.
-</P>
-<P>
-If the PCRE_UNGREEDY option is set (an option which is not available in Perl),
-the quantifiers are not greedy by default, but individual ones can be made
-greedy by following them with a question mark. In other words, it inverts the
-default behaviour.
-</P>
-<P>
-When a parenthesized subpattern is quantified with a minimum repeat count that
-is greater than 1 or with a limited maximum, more store is required for the
-compiled pattern, in proportion to the size of the minimum or maximum.
-</P>
-<P>
-If a pattern starts with .* or .{0,} and the PCRE_DOTALL option (equivalent
-to Perl's /s) is set, thus allowing the . to match newlines, the pattern is
-implicitly anchored, because whatever follows will be tried against every
-character position in the subject string, so there is no point in retrying the
-overall match at any position after the first. PCRE treats such a pattern as
-though it were preceded by \A. In cases where it is known that the subject
-string contains no newlines, it is worth setting PCRE_DOTALL when the pattern
-begins with .* in order to obtain this optimization, or alternatively using ^
-to indicate anchoring explicitly.
-</P>
-<P>
-When a capturing subpattern is repeated, the value captured is the substring
-that matched the final iteration. For example, after
-</P>
-<P>
-<PRE>
- (tweedle[dume]{3}\s*)+
-</PRE>
-</P>
-<P>
-has matched "tweedledum tweedledee" the value of the captured substring is
-"tweedledee". However, if there are nested capturing subpatterns, the
-corresponding captured values may have been set in previous iterations. For
-example, after
-</P>
-<P>
-<PRE>
- /(a|(b))+/
-</PRE>
-</P>
-<P>
-matches "aba" the value of the second captured substring is "b".
-</P>
-<LI><A NAME="SEC23" HREF="#TOC1">BACK REFERENCES</A>
-<P>
-Outside a character class, a backslash followed by a digit greater than 0 (and
-possibly further digits) is a back reference to a capturing subpattern earlier
-(i.e. to its left) in the pattern, provided there have been that many previous
-capturing left parentheses.
-</P>
-<P>
-However, if the decimal number following the backslash is less than 10, it is
-always taken as a back reference, and causes an error only if there are not
-that many capturing left parentheses in the entire pattern. In other words, the
-parentheses that are referenced need not be to the left of the reference for
-numbers less than 10. See the section entitled "Backslash" above for further
-details of the handling of digits following a backslash.
-</P>
-<P>
-A back reference matches whatever actually matched the capturing subpattern in
-the current subject string, rather than anything matching the subpattern
-itself. So the pattern
-</P>
-<P>
-<PRE>
- (sens|respons)e and \1ibility
-</PRE>
-</P>
-<P>
-matches "sense and sensibility" and "response and responsibility", but not
-"sense and responsibility". If caseful matching is in force at the time of the
-back reference, the case of letters is relevant. For example,
-</P>
-<P>
-<PRE>
- ((?i)rah)\s+\1
-</PRE>
-</P>
-<P>
-matches "rah rah" and "RAH RAH", but not "RAH rah", even though the original
-capturing subpattern is matched caselessly.
-</P>
-<P>
-There may be more than one back reference to the same subpattern. If a
-subpattern has not actually been used in a particular match, any back
-references to it always fail. For example, the pattern
-</P>
-<P>
-<PRE>
- (a|(bc))\2
-</PRE>
-</P>
-<P>
-always fails if it starts to match "a" rather than "bc". Because there may be
-up to 99 back references, all digits following the backslash are taken
-as part of a potential back reference number. If the pattern continues with a
-digit character, some delimiter must be used to terminate the back reference.
-If the PCRE_EXTENDED option is set, this can be whitespace. Otherwise an empty
-comment can be used.
-</P>
-<P>
-A back reference that occurs inside the parentheses to which it refers fails
-when the subpattern is first used, so, for example, (a\1) never matches.
-However, such references can be useful inside repeated subpatterns. For
-example, the pattern
-</P>
-<P>
-<PRE>
- (a|b\1)+
-</PRE>
-</P>
-<P>
-matches any number of "a"s and also "aba", "ababbaa" etc. At each iteration of
-the subpattern, the back reference matches the character string corresponding
-to the previous iteration. In order for this to work, the pattern must be such
-that the first iteration does not need to match the back reference. This can be
-done using alternation, as in the example above, or by a quantifier with a
-minimum of zero.
-</P>
-<LI><A NAME="SEC24" HREF="#TOC1">ASSERTIONS</A>
-<P>
-An assertion is a test on the characters following or preceding the current
-matching point that does not actually consume any characters. The simple
-assertions coded as \b, \B, \A, \Z, \z, ^ and $ are described above. More
-complicated assertions are coded as subpatterns. There are two kinds: those
-that look ahead of the current position in the subject string, and those that
-look behind it.
-</P>
-<P>
-An assertion subpattern is matched in the normal way, except that it does not
-cause the current matching position to be changed. Lookahead assertions start
-with (?= for positive assertions and (?! for negative assertions. For example,
-</P>
-<P>
-<PRE>
- \w+(?=;)
-</PRE>
-</P>
-<P>
-matches a word followed by a semicolon, but does not include the semicolon in
-the match, and
-</P>
-<P>
-<PRE>
- foo(?!bar)
-</PRE>
-</P>
-<P>
-matches any occurrence of "foo" that is not followed by "bar". Note that the
-apparently similar pattern
-</P>
-<P>
-<PRE>
- (?!foo)bar
-</PRE>
-</P>
-<P>
-does not find an occurrence of "bar" that is preceded by something other than
-"foo"; it finds any occurrence of "bar" whatsoever, because the assertion
-(?!foo) is always true when the next three characters are "bar". A
-lookbehind assertion is needed to achieve this effect.
-</P>
-<P>
-Lookbehind assertions start with (?&#60;= for positive assertions and (?&#60;! for
-negative assertions. For example,
-</P>
-<P>
-<PRE>
- (?&#60;!foo)bar
-</PRE>
-</P>
-<P>
-does find an occurrence of "bar" that is not preceded by "foo". The contents of
-a lookbehind assertion are restricted such that all the strings it matches must
-have a fixed length. However, if there are several alternatives, they do not
-all have to have the same fixed length. Thus
-</P>
-<P>
-<PRE>
- (?&#60;=bullock|donkey)
-</PRE>
-</P>
-<P>
-is permitted, but
-</P>
-<P>
-<PRE>
- (?&#60;!dogs?|cats?)
-</PRE>
-</P>
-<P>
-causes an error at compile time. Branches that match different length strings
-are permitted only at the top level of a lookbehind assertion. This is an
-extension compared with Perl 5.005, which requires all branches to match the
-same length of string. An assertion such as
-</P>
-<P>
-<PRE>
- (?&#60;=ab(c|de))
-</PRE>
-</P>
-<P>
-is not permitted, because its single top-level branch can match two different
-lengths, but it is acceptable if rewritten to use two top-level branches:
-</P>
-<P>
-<PRE>
- (?&#60;=abc|abde)
-</PRE>
-</P>
-<P>
-The implementation of lookbehind assertions is, for each alternative, to
-temporarily move the current position back by the fixed width and then try to
-match. If there are insufficient characters before the current position, the
-match is deemed to fail. Lookbehinds in conjunction with once-only subpatterns
-can be particularly useful for matching at the ends of strings; an example is
-given at the end of the section on once-only subpatterns.
-</P>
-<P>
-Several assertions (of any sort) may occur in succession. For example,
-</P>
-<P>
-<PRE>
- (?&#60;=\d{3})(?&#60;!999)foo
-</PRE>
-</P>
-<P>
-matches "foo" preceded by three digits that are not "999". Notice that each of
-the assertions is applied independently at the same point in the subject
-string. First there is a check that the previous three characters are all
-digits, and then there is a check that the same three characters are not "999".
-This pattern does <I>not</I> match "foo" preceded by six characters, the first
-of which are digits and the last three of which are not "999". For example, it
-doesn't match "123abcfoo". A pattern to do that is
-</P>
-<P>
-<PRE>
- (?&#60;=\d{3}...)(?&#60;!999)foo
-</PRE>
-</P>
-<P>
-This time the first assertion looks at the preceding six characters, checking
-that the first three are digits, and then the second assertion checks that the
-preceding three characters are not "999".
-</P>
-<P>
-Assertions can be nested in any combination. For example,
-</P>
-<P>
-<PRE>
- (?&#60;=(?&#60;!foo)bar)baz
-</PRE>
-</P>
-<P>
-matches an occurrence of "baz" that is preceded by "bar" which in turn is not
-preceded by "foo", while
-</P>
-<P>
-<PRE>
- (?&#60;=\d{3}(?!999)...)foo
-</PRE>
-</P>
-<P>
-is another pattern which matches "foo" preceded by three digits and any three
-characters that are not "999".
-</P>
-<P>
-Assertion subpatterns are not capturing subpatterns, and may not be repeated,
-because it makes no sense to assert the same thing several times. If any kind
-of assertion contains capturing subpatterns within it, these are counted for
-the purposes of numbering the capturing subpatterns in the whole pattern.
-However, substring capturing is carried out only for positive assertions,
-because it does not make sense for negative assertions.
-</P>
-<P>
-Assertions count towards the maximum of 200 parenthesized subpatterns.
-</P>
-<LI><A NAME="SEC25" HREF="#TOC1">ONCE-ONLY SUBPATTERNS</A>
-<P>
-With both maximizing and minimizing repetition, failure of what follows
-normally causes the repeated item to be re-evaluated to see if a different
-number of repeats allows the rest of the pattern to match. Sometimes it is
-useful to prevent this, either to change the nature of the match, or to cause
-it fail earlier than it otherwise might, when the author of the pattern knows
-there is no point in carrying on.
-</P>
-<P>
-Consider, for example, the pattern \d+foo when applied to the subject line
-</P>
-<P>
-<PRE>
- 123456bar
-</PRE>
-</P>
-<P>
-After matching all 6 digits and then failing to match "foo", the normal
-action of the matcher is to try again with only 5 digits matching the \d+
-item, and then with 4, and so on, before ultimately failing. Once-only
-subpatterns provide the means for specifying that once a portion of the pattern
-has matched, it is not to be re-evaluated in this way, so the matcher would
-give up immediately on failing to match "foo" the first time. The notation is
-another kind of special parenthesis, starting with (?&#62; as in this example:
-</P>
-<P>
-<PRE>
- (?&#62;\d+)bar
-</PRE>
-</P>
-<P>
-This kind of parenthesis "locks up" the part of the pattern it contains once
-it has matched, and a failure further into the pattern is prevented from
-backtracking into it. Backtracking past it to previous items, however, works as
-normal.
-</P>
-<P>
-An alternative description is that a subpattern of this type matches the string
-of characters that an identical standalone pattern would match, if anchored at
-the current point in the subject string.
-</P>
-<P>
-Once-only subpatterns are not capturing subpatterns. Simple cases such as the
-above example can be thought of as a maximizing repeat that must swallow
-everything it can. So, while both \d+ and \d+? are prepared to adjust the
-number of digits they match in order to make the rest of the pattern match,
-(?&#62;\d+) can only match an entire sequence of digits.
-</P>
-<P>
-This construction can of course contain arbitrarily complicated subpatterns,
-and it can be nested.
-</P>
-<P>
-Once-only subpatterns can be used in conjunction with lookbehind assertions to
-specify efficient matching at the end of the subject string. Consider a simple
-pattern such as
-</P>
-<P>
-<PRE>
- abcd$
-</PRE>
-</P>
-<P>
-when applied to a long string which does not match. Because matching proceeds
-from left to right, PCRE will look for each "a" in the subject and then see if
-what follows matches the rest of the pattern. If the pattern is specified as
-</P>
-<P>
-<PRE>
- ^.*abcd$
-</PRE>
-</P>
-<P>
-the initial .* matches the entire string at first, but when this fails (because
-there is no following "a"), it backtracks to match all but the last character,
-then all but the last two characters, and so on. Once again the search for "a"
-covers the entire string, from right to left, so we are no better off. However,
-if the pattern is written as
-</P>
-<P>
-<PRE>
- ^(?&#62;.*)(?&#60;=abcd)
-</PRE>
-</P>
-<P>
-there can be no backtracking for the .* item; it can match only the entire
-string. The subsequent lookbehind assertion does a single test on the last four
-characters. If it fails, the match fails immediately. For long strings, this
-approach makes a significant difference to the processing time.
-</P>
-<P>
-When a pattern contains an unlimited repeat inside a subpattern that can itself
-be repeated an unlimited number of times, the use of a once-only subpattern is
-the only way to avoid some failing matches taking a very long time indeed.
-The pattern
-</P>
-<P>
-<PRE>
- (\D+|&#60;\d+&#62;)*[!?]
-</PRE>
-</P>
-<P>
-matches an unlimited number of substrings that either consist of non-digits, or
-digits enclosed in &#60;&#62;, followed by either ! or ?. When it matches, it runs
-quickly. However, if it is applied to
-</P>
-<P>
-<PRE>
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-</PRE>
-</P>
-<P>
-it takes a long time before reporting failure. This is because the string can
-be divided between the two repeats in a large number of ways, and all have to
-be tried. (The example used [!?] rather than a single character at the end,
-because both PCRE and Perl have an optimization that allows for fast failure
-when a single character is used. They remember the last single character that
-is required for a match, and fail early if it is not present in the string.)
-If the pattern is changed to
-</P>
-<P>
-<PRE>
- ((?&#62;\D+)|&#60;\d+&#62;)*[!?]
-</PRE>
-</P>
-<P>
-sequences of non-digits cannot be broken, and failure happens quickly.
-</P>
-<LI><A NAME="SEC26" HREF="#TOC1">CONDITIONAL SUBPATTERNS</A>
-<P>
-It is possible to cause the matching process to obey a subpattern
-conditionally or to choose between two alternative subpatterns, depending on
-the result of an assertion, or whether a previous capturing subpattern matched
-or not. The two possible forms of conditional subpattern are
-</P>
-<P>
-<PRE>
- (?(condition)yes-pattern)
- (?(condition)yes-pattern|no-pattern)
-</PRE>
-</P>
-<P>
-If the condition is satisfied, the yes-pattern is used; otherwise the
-no-pattern (if present) is used. If there are more than two alternatives in the
-subpattern, a compile-time error occurs.
-</P>
-<P>
-There are two kinds of condition. If the text between the parentheses consists
-of a sequence of digits, the condition is satisfied if the capturing subpattern
-of that number has previously matched. The number must be greater than zero.
-Consider the following pattern, which contains non-significant white space to
-make it more readable (assume the PCRE_EXTENDED option) and to divide it into
-three parts for ease of discussion:
-</P>
-<P>
-<PRE>
- ( \( )? [^()]+ (?(1) \) )
-</PRE>
-</P>
-<P>
-The first part matches an optional opening parenthesis, and if that
-character is present, sets it as the first captured substring. The second part
-matches one or more characters that are not parentheses. The third part is a
-conditional subpattern that tests whether the first set of parentheses matched
-or not. If they did, that is, if subject started with an opening parenthesis,
-the condition is true, and so the yes-pattern is executed and a closing
-parenthesis is required. Otherwise, since no-pattern is not present, the
-subpattern matches nothing. In other words, this pattern matches a sequence of
-non-parentheses, optionally enclosed in parentheses.
-</P>
-<P>
-If the condition is not a sequence of digits, it must be an assertion. This may
-be a positive or negative lookahead or lookbehind assertion. Consider this
-pattern, again containing non-significant white space, and with the two
-alternatives on the second line:
-</P>
-<P>
-<PRE>
- (?(?=[^a-z]*[a-z])
- \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} )
-</PRE>
-</P>
-<P>
-The condition is a positive lookahead assertion that matches an optional
-sequence of non-letters followed by a letter. In other words, it tests for the
-presence of at least one letter in the subject. If a letter is found, the
-subject is matched against the first alternative; otherwise it is matched
-against the second. This pattern matches strings in one of the two forms
-dd-aaa-dd or dd-dd-dd, where aaa are letters and dd are digits.
-</P>
-<LI><A NAME="SEC27" HREF="#TOC1">COMMENTS</A>
-<P>
-The sequence (?# marks the start of a comment which continues up to the next
-closing parenthesis. Nested parentheses are not permitted. The characters
-that make up a comment play no part in the pattern matching at all.
-</P>
-<P>
-If the PCRE_EXTENDED option is set, an unescaped # character outside a
-character class introduces a comment that continues up to the next newline
-character in the pattern.
-</P>
-<LI><A NAME="SEC28" HREF="#TOC1">RECURSIVE PATTERNS</A>
-<P>
-Consider the problem of matching a string in parentheses, allowing for
-unlimited nested parentheses. Without the use of recursion, the best that can
-be done is to use a pattern that matches up to some fixed depth of nesting. It
-is not possible to handle an arbitrary nesting depth. Perl 5.6 has provided an
-experimental facility that allows regular expressions to recurse (amongst other
-things). It does this by interpolating Perl code in the expression at run time,
-and the code can refer to the expression itself. A Perl pattern to solve the
-parentheses problem can be created like this:
-</P>
-<P>
-<PRE>
- $re = qr{\( (?: (?&#62;[^()]+) | (?p{$re}) )* \)}x;
-</PRE>
-</P>
-<P>
-The (?p{...}) item interpolates Perl code at run time, and in this case refers
-recursively to the pattern in which it appears. Obviously, PCRE cannot support
-the interpolation of Perl code. Instead, the special item (?R) is provided for
-the specific case of recursion. This PCRE pattern solves the parentheses
-problem (assume the PCRE_EXTENDED option is set so that white space is
-ignored):
-</P>
-<P>
-<PRE>
- \( ( (?&#62;[^()]+) | (?R) )* \)
-</PRE>
-</P>
-<P>
-First it matches an opening parenthesis. Then it matches any number of
-substrings which can either be a sequence of non-parentheses, or a recursive
-match of the pattern itself (i.e. a correctly parenthesized substring). Finally
-there is a closing parenthesis.
-</P>
-<P>
-This particular example pattern contains nested unlimited repeats, and so the
-use of a once-only subpattern for matching strings of non-parentheses is
-important when applying the pattern to strings that do not match. For example,
-when it is applied to
-</P>
-<P>
-<PRE>
- (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
-</PRE>
-</P>
-<P>
-it yields "no match" quickly. However, if a once-only subpattern is not used,
-the match runs for a very long time indeed because there are so many different
-ways the + and * repeats can carve up the subject, and all have to be tested
-before failure can be reported.
-</P>
-<P>
-The values set for any capturing subpatterns are those from the outermost level
-of the recursion at which the subpattern value is set. If the pattern above is
-matched against
-</P>
-<P>
-<PRE>
- (ab(cd)ef)
-</PRE>
-</P>
-<P>
-the value for the capturing parentheses is "ef", which is the last value taken
-on at the top level. If additional parentheses are added, giving
-</P>
-<P>
-<PRE>
- \( ( ( (?&#62;[^()]+) | (?R) )* ) \)
- ^ ^
- ^ ^
-</PRE>
-the string they capture is "ab(cd)ef", the contents of the top level
-parentheses. If there are more than 15 capturing parentheses in a pattern, PCRE
-has to obtain extra memory to store data during a recursion, which it does by
-using <B>pcre_malloc</B>, freeing it via <B>pcre_free</B> afterwards. If no
-memory can be obtained, it saves data for the first 15 capturing parentheses
-only, as there is no way to give an out-of-memory error from within a
-recursion.
-</P>
-<LI><A NAME="SEC29" HREF="#TOC1">PERFORMANCE</A>
-<P>
-Certain items that may appear in patterns are more efficient than others. It is
-more efficient to use a character class like [aeiou] than a set of alternatives
-such as (a|e|i|o|u). In general, the simplest construction that provides the
-required behaviour is usually the most efficient. Jeffrey Friedl's book
-contains a lot of discussion about optimizing regular expressions for efficient
-performance.
-</P>
-<P>
-When a pattern begins with .* and the PCRE_DOTALL option is set, the pattern is
-implicitly anchored by PCRE, since it can match only at the start of a subject
-string. However, if PCRE_DOTALL is not set, PCRE cannot make this optimization,
-because the . metacharacter does not then match a newline, and if the subject
-string contains newlines, the pattern may match from the character immediately
-following one of them instead of from the very start. For example, the pattern
-</P>
-<P>
-<PRE>
- (.*) second
-</PRE>
-</P>
-<P>
-matches the subject "first\nand second" (where \n stands for a newline
-character) with the first captured substring being "and". In order to do this,
-PCRE has to retry the match starting after every newline in the subject.
-</P>
-<P>
-If you are using such a pattern with subject strings that do not contain
-newlines, the best performance is obtained by setting PCRE_DOTALL, or starting
-the pattern with ^.* to indicate explicit anchoring. That saves PCRE from
-having to scan along the subject looking for a newline to restart at.
-</P>
-<P>
-Beware of patterns that contain nested indefinite repeats. These can take a
-long time to run when applied to a string that does not match. Consider the
-pattern fragment
-</P>
-<P>
-<PRE>
- (a+)*
-</PRE>
-</P>
-<P>
-This can match "aaaa" in 33 different ways, and this number increases very
-rapidly as the string gets longer. (The * repeat can match 0, 1, 2, 3, or 4
-times, and for each of those cases other than 0, the + repeats can match
-different numbers of times.) When the remainder of the pattern is such that the
-entire match is going to fail, PCRE has in principle to try every possible
-variation, and this can take an extremely long time.
-</P>
-<P>
-An optimization catches some of the more simple cases such as
-</P>
-<P>
-<PRE>
- (a+)*b
-</PRE>
-</P>
-<P>
-where a literal character follows. Before embarking on the standard matching
-procedure, PCRE checks that there is a "b" later in the subject string, and if
-there is not, it fails the match immediately. However, when there is no
-following literal this optimization cannot be used. You can see the difference
-by comparing the behaviour of
-</P>
-<P>
-<PRE>
- (a+)*\d
-</PRE>
-</P>
-<P>
-with the pattern above. The former gives a failure almost instantly when
-applied to a whole line of "a" characters, whereas the latter takes an
-appreciable time with strings longer than about 20 characters.
-</P>
-<LI><A NAME="SEC30" HREF="#TOC1">UTF-8 SUPPORT</A>
-<P>
-Starting at release 3.3, PCRE has some support for character strings encoded
-in the UTF-8 format. This is incomplete, and is regarded as experimental. In
-order to use it, you must configure PCRE to include UTF-8 support in the code,
-and, in addition, you must call <B>pcre_compile()</B> with the PCRE_UTF8 option
-flag. When you do this, both the pattern and any subject strings that are
-matched against it are treated as UTF-8 strings instead of just strings of
-bytes, but only in the cases that are mentioned below.
-</P>
-<P>
-If you compile PCRE with UTF-8 support, but do not use it at run time, the
-library will be a bit bigger, but the additional run time overhead is limited
-to testing the PCRE_UTF8 flag in several places, so should not be very large.
-</P>
-<P>
-PCRE assumes that the strings it is given contain valid UTF-8 codes. It does
-not diagnose invalid UTF-8 strings. If you pass invalid UTF-8 strings to PCRE,
-the results are undefined.
-</P>
-<P>
-Running with PCRE_UTF8 set causes these changes in the way PCRE works:
-</P>
-<P>
-1. In a pattern, the escape sequence \x{...}, where the contents of the braces
-is a string of hexadecimal digits, is interpreted as a UTF-8 character whose
-code number is the given hexadecimal number, for example: \x{1234}. This
-inserts from one to six literal bytes into the pattern, using the UTF-8
-encoding. If a non-hexadecimal digit appears between the braces, the item is
-not recognized.
-</P>
-<P>
-2. The original hexadecimal escape sequence, \xhh, generates a two-byte UTF-8
-character if its value is greater than 127.
-</P>
-<P>
-3. Repeat quantifiers are NOT correctly handled if they follow a multibyte
-character. For example, \x{100}* and \xc3+ do not work. If you want to
-repeat such characters, you must enclose them in non-capturing parentheses,
-for example (?:\x{100}), at present.
-</P>
-<P>
-4. The dot metacharacter matches one UTF-8 character instead of a single byte.
-</P>
-<P>
-5. Unlike literal UTF-8 characters, the dot metacharacter followed by a
-repeat quantifier does operate correctly on UTF-8 characters instead of
-single bytes.
-</P>
-<P>
-4. Although the \x{...} escape is permitted in a character class, characters
-whose values are greater than 255 cannot be included in a class.
-</P>
-<P>
-5. A class is matched against a UTF-8 character instead of just a single byte,
-but it can match only characters whose values are less than 256. Characters
-with greater values always fail to match a class.
-</P>
-<P>
-6. Repeated classes work correctly on multiple characters.
-</P>
-<P>
-7. Classes containing just a single character whose value is greater than 127
-(but less than 256), for example, [\x80] or [^\x{93}], do not work because
-these are optimized into single byte matches. In the first case, of course,
-the class brackets are just redundant.
-</P>
-<P>
-8. Lookbehind assertions move backwards in the subject by a fixed number of
-characters instead of a fixed number of bytes. Simple cases have been tested
-to work correctly, but there may be hidden gotchas herein.
-</P>
-<P>
-9. The character types such as \d and \w do not work correctly with UTF-8
-characters. They continue to test a single byte.
-</P>
-<P>
-10. Anything not explicitly mentioned here continues to work in bytes rather
-than in characters.
-</P>
-<P>
-The following UTF-8 features of Perl 5.6 are not implemented:
-</P>
-<P>
-1. The escape sequence \C to match a single byte.
-</P>
-<P>
-2. The use of Unicode tables and properties and escapes \p, \P, and \X.
-</P>
-<LI><A NAME="SEC31" HREF="#TOC1">SAMPLE PROGRAM</A>
-<P>
-The code below is a simple, complete demonstration program, to get you started
-with using PCRE. This code is also supplied in the file <I>pcredemo.c</I> in the
-PCRE distribution.
-</P>
-<P>
-The program compiles the regular expression that is its first argument, and
-matches it against the subject string in its second argument. No options are
-set, and default character tables are used. If matching succeeds, the program
-outputs the portion of the subject that matched, together with the contents of
-any captured substrings.
-</P>
-<P>
-On a Unix system that has PCRE installed in <I>/usr/local</I>, you can compile
-the demonstration program using a command like this:
-</P>
-<P>
-<PRE>
- gcc -o pcredemo pcredemo.c -I/usr/local/include -L/usr/local/lib -lpcre
-</PRE>
-</P>
-<P>
-Then you can run simple tests like this:
-</P>
-<P>
-<PRE>
- ./pcredemo 'cat|dog' 'the cat sat on the mat'
-</PRE>
-</P>
-<P>
-Note that there is a much more comprehensive test program, called
-<B>pcretest</B>, which supports many more facilities for testing regular
-expressions. The <B>pcredemo</B> program is provided as a simple coding example.
-</P>
-<P>
-On some operating systems (e.g. Solaris) you may get an error like this when
-you try to run <B>pcredemo</B>:
-</P>
-<P>
-<PRE>
- ld.so.1: a.out: fatal: libpcre.so.0: open failed: No such file or directory
-</PRE>
-</P>
-<P>
-This is caused by the way shared library support works on those systems. You
-need to add
-</P>
-<P>
-<PRE>
- -R/usr/local/lib
-</PRE>
-</P>
-<P>
-to the compile command to get round this problem. Here's the code:
-</P>
-<P>
-<PRE>
- #include &#60;stdio.h&#62;
- #include &#60;string.h&#62;
- #include &#60;pcre.h&#62;
-</PRE>
-</P>
-<P>
-<PRE>
- #define OVECCOUNT 30 /* should be a multiple of 3 */
-</PRE>
-</P>
-<P>
-<PRE>
- int main(int argc, char **argv)
- {
- pcre *re;
- const char *error;
- int erroffset;
- int ovector[OVECCOUNT];
- int rc, i;
-</PRE>
-</P>
-<P>
-<PRE>
- if (argc != 3)
- {
- printf("Two arguments required: a regex and a "
- "subject string\n");
- return 1;
- }
-</PRE>
-</P>
-<P>
-<PRE>
- /* Compile the regular expression in the first argument */
-</PRE>
-</P>
-<P>
-<PRE>
- re = pcre_compile(
- argv[1], /* the pattern */
- 0, /* default options */
- &error, /* for error message */
- &erroffset, /* for error offset */
- NULL); /* use default character tables */
-</PRE>
-</P>
-<P>
-<PRE>
- /* Compilation failed: print the error message and exit */
-</PRE>
-</P>
-<P>
-<PRE>
- if (re == NULL)
- {
- printf("PCRE compilation failed at offset %d: %s\n",
- erroffset, error);
- return 1;
- }
-</PRE>
-</P>
-<P>
-<PRE>
- /* Compilation succeeded: match the subject in the second
- argument */
-</PRE>
-</P>
-<P>
-<PRE>
- rc = pcre_exec(
- re, /* the compiled pattern */
- NULL, /* we didn't study the pattern */
- argv[2], /* the subject string */
- (int)strlen(argv[2]), /* the length of the subject */
- 0, /* start at offset 0 in the subject */
- 0, /* default options */
- ovector, /* vector for substring information */
- OVECCOUNT); /* number of elements in the vector */
-</PRE>
-</P>
-<P>
-<PRE>
- /* Matching failed: handle error cases */
-</PRE>
-</P>
-<P>
-<PRE>
- if (rc &#60; 0)
- {
- switch(rc)
- {
- case PCRE_ERROR_NOMATCH: printf("No match\n"); break;
- /*
- Handle other special cases if you like
- */
- default: printf("Matching error %d\n", rc); break;
- }
- return 1;
- }
-</PRE>
-</P>
-<P>
-<PRE>
- /* Match succeded */
-</PRE>
-</P>
-<P>
-<PRE>
- printf("Match succeeded\n");
-</PRE>
-</P>
-<P>
-<PRE>
- /* The output vector wasn't big enough */
-</PRE>
-</P>
-<P>
-<PRE>
- if (rc == 0)
- {
- rc = OVECCOUNT/3;
- printf("ovector only has room for %d captured "
- substrings\n", rc - 1);
- }
-</PRE>
-</P>
-<P>
-<PRE>
- /* Show substrings stored in the output vector */
-</PRE>
-</P>
-<P>
-<PRE>
- for (i = 0; i &#60; rc; i++)
- {
- char *substring_start = argv[2] + ovector[2*i];
- int substring_length = ovector[2*i+1] - ovector[2*i];
- printf("%2d: %.*s\n", i, substring_length,
- substring_start);
- }
-</PRE>
-</P>
-<P>
-<PRE>
- return 0;
- }
-</PRE>
-</P>
-<LI><A NAME="SEC32" HREF="#TOC1">AUTHOR</A>
-<P>
-Philip Hazel &#60;ph10@cam.ac.uk&#62;
-<BR>
-University Computing Service,
-<BR>
-New Museums Site,
-<BR>
-Cambridge CB2 3QG, England.
-<BR>
-Phone: +44 1223 334714
-</P>
-<P>
-Last updated: 15 August 2001
-<BR>
-Copyright (c) 1997-2001 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcre.txt b/ext/pcre/pcrelib/doc/pcre.txt
deleted file mode 100644
index 46ede59754..0000000000
--- a/ext/pcre/pcrelib/doc/pcre.txt
+++ /dev/null
@@ -1,2307 +0,0 @@
-NAME
- pcre - Perl-compatible regular expressions.
-
-
-
-SYNOPSIS
- #include <pcre.h>
-
- pcre *pcre_compile(const char *pattern, int options,
- const char **errptr, int *erroffset,
- const unsigned char *tableptr);
-
- pcre_extra *pcre_study(const pcre *code, int options,
- const char **errptr);
-
- int pcre_exec(const pcre *code, const pcre_extra *extra,
- const char *subject, int length, int startoffset,
- int options, int *ovector, int ovecsize);
-
- int pcre_copy_substring(const char *subject, int *ovector,
- int stringcount, int stringnumber, char *buffer,
- int buffersize);
-
- int pcre_get_substring(const char *subject, int *ovector,
- int stringcount, int stringnumber,
- const char **stringptr);
-
- int pcre_get_substring_list(const char *subject,
- int *ovector, int stringcount, const char ***listptr);
-
- void pcre_free_substring(const char *stringptr);
-
- void pcre_free_substring_list(const char **stringptr);
-
- const unsigned char *pcre_maketables(void);
-
- int pcre_fullinfo(const pcre *code, const pcre_extra *extra,
- int what, void *where);
-
- int pcre_info(const pcre *code, int *optptr, *firstcharptr);
-
- char *pcre_version(void);
-
- void *(*pcre_malloc)(size_t);
-
- void (*pcre_free)(void *);
-
-
-
-
-DESCRIPTION
- The PCRE library is a set of functions that implement regu-
- lar expression pattern matching using the same syntax and
- semantics as Perl 5, with just a few differences (see
-
- below). The current implementation corresponds to Perl
- 5.005, with some additional features from later versions.
- This includes some experimental, incomplete support for
- UTF-8 encoded strings. Details of exactly what is and what
- is not supported are given below.
-
- PCRE has its own native API, which is described in this
- document. There is also a set of wrapper functions that
- correspond to the POSIX regular expression API. These are
- described in the pcreposix documentation.
-
- The native API function prototypes are defined in the header
- file pcre.h, and on Unix systems the library itself is
- called libpcre.a, so can be accessed by adding -lpcre to the
- command for linking an application which calls it. The
- header file defines the macros PCRE_MAJOR and PCRE_MINOR to
- contain the major and minor release numbers for the library.
- Applications can use these to include support for different
- releases.
-
- The functions pcre_compile(), pcre_study(), and pcre_exec()
- are used for compiling and matching regular expressions. A
- sample program that demonstrates the simplest way of using
- them is given in the file pcredemo.c. The last section of
- this man page describes how to run it.
-
- The functions pcre_copy_substring(), pcre_get_substring(),
- and pcre_get_substring_list() are convenience functions for
- extracting captured substrings from a matched subject
- string; pcre_free_substring() and pcre_free_substring_list()
- are also provided, to free the memory used for extracted
- strings.
-
- The function pcre_maketables() is used (optionally) to build
- a set of character tables in the current locale for passing
- to pcre_compile().
-
- The function pcre_fullinfo() is used to find out information
- about a compiled pattern; pcre_info() is an obsolete version
- which returns only some of the available information, but is
- retained for backwards compatibility. The function
- pcre_version() returns a pointer to a string containing the
- version of PCRE and its date of release.
-
- The global variables pcre_malloc and pcre_free initially
- contain the entry points of the standard malloc() and free()
- functions respectively. PCRE calls the memory management
- functions via these variables, so a calling program can
- replace them if it wishes to intercept the calls. This
- should be done before calling any PCRE functions.
-
-
-
-MULTI-THREADING
- The PCRE functions can be used in multi-threading applica-
- tions, with the proviso that the memory management functions
- pointed to by pcre_malloc and pcre_free are shared by all
- threads.
-
- The compiled form of a regular expression is not altered
- during matching, so the same compiled pattern can safely be
- used by several threads at once.
-
-
-
-COMPILING A PATTERN
- The function pcre_compile() is called to compile a pattern
- into an internal form. The pattern is a C string terminated
- by a binary zero, and is passed in the argument pattern. A
- pointer to a single block of memory that is obtained via
- pcre_malloc is returned. This contains the compiled code and
- related data. The pcre type is defined for the returned
- block; this is a typedef for a structure whose contents are
- not externally defined. It is up to the caller to free the
- memory when it is no longer required.
-
- Although the compiled code of a PCRE regex is relocatable,
- that is, it does not depend on memory location, the complete
- pcre data block is not fully relocatable, because it con-
- tains a copy of the tableptr argument, which is an address
- (see below).
-
- The size of a compiled pattern is roughly proportional to
- the length of the pattern string, except that each character
- class (other than those containing just a single character,
- negated or not) requires 33 bytes, and repeat quantifiers
- with a minimum greater than one or a bounded maximum cause
- the relevant portions of the compiled pattern to be repli-
- cated.
-
- The options argument contains independent bits that affect
- the compilation. It should be zero if no options are
- required. Some of the options, in particular, those that are
- compatible with Perl, can also be set and unset from within
- the pattern (see the detailed description of regular expres-
- sions below). For these options, the contents of the options
- argument specifies their initial settings at the start of
- compilation and execution. The PCRE_ANCHORED option can be
- set at the time of matching as well as at compile time.
-
- If errptr is NULL, pcre_compile() returns NULL immediately.
- Otherwise, if compilation of a pattern fails, pcre_compile()
- returns NULL, and sets the variable pointed to by errptr to
- point to a textual error message. The offset from the start
- of the pattern to the character where the error was
- discovered is placed in the variable pointed to by
- erroffset, which must not be NULL. If it is, an immediate
- error is given.
-
- If the final argument, tableptr, is NULL, PCRE uses a
- default set of character tables which are built when it is
- compiled, using the default C locale. Otherwise, tableptr
- must be the result of a call to pcre_maketables(). See the
- section on locale support below.
-
- This code fragment shows a typical straightforward call to
- pcre_compile():
-
- pcre *re;
- const char *error;
- int erroffset;
- re = pcre_compile(
- "^A.*Z", /* the pattern */
- 0, /* default options */
- &error, /* for error message */
- &erroffset, /* for error offset */
- NULL); /* use default character tables */
-
- The following option bits are defined in the header file:
-
- PCRE_ANCHORED
-
- If this bit is set, the pattern is forced to be "anchored",
- that is, it is constrained to match only at the start of the
- string which is being searched (the "subject string"). This
- effect can also be achieved by appropriate constructs in the
- pattern itself, which is the only way to do it in Perl.
-
- PCRE_CASELESS
-
- If this bit is set, letters in the pattern match both upper
- and lower case letters. It is equivalent to Perl's /i
- option.
-
- PCRE_DOLLAR_ENDONLY
-
- If this bit is set, a dollar metacharacter in the pattern
- matches only at the end of the subject string. Without this
- option, a dollar also matches immediately before the final
- character if it is a newline (but not before any other new-
- lines). The PCRE_DOLLAR_ENDONLY option is ignored if
- PCRE_MULTILINE is set. There is no equivalent to this option
- in Perl.
-
- PCRE_DOTALL
-
- If this bit is set, a dot metacharater in the pattern
- matches all characters, including newlines. Without it, new-
- lines are excluded. This option is equivalent to Perl's /s
- option. A negative class such as [^a] always matches a new-
- line character, independent of the setting of this option.
-
- PCRE_EXTENDED
-
- If this bit is set, whitespace data characters in the pat-
- tern are totally ignored except when escaped or inside a
- character class, and characters between an unescaped # out-
- side a character class and the next newline character,
- inclusive, are also ignored. This is equivalent to Perl's /x
- option, and makes it possible to include comments inside
- complicated patterns. Note, however, that this applies only
- to data characters. Whitespace characters may never appear
- within special character sequences in a pattern, for example
- within the sequence (?( which introduces a conditional sub-
- pattern.
-
- PCRE_EXTRA
-
- This option was invented in order to turn on additional
- functionality of PCRE that is incompatible with Perl, but it
- is currently of very little use. When set, any backslash in
- a pattern that is followed by a letter that has no special
- meaning causes an error, thus reserving these combinations
- for future expansion. By default, as in Perl, a backslash
- followed by a letter with no special meaning is treated as a
- literal. There are at present no other features controlled
- by this option. It can also be set by a (?X) option setting
- within a pattern.
-
- PCRE_MULTILINE
-
- By default, PCRE treats the subject string as consisting of
- a single "line" of characters (even if it actually contains
- several newlines). The "start of line" metacharacter (^)
- matches only at the start of the string, while the "end of
- line" metacharacter ($) matches only at the end of the
- string, or before a terminating newline (unless
- PCRE_DOLLAR_ENDONLY is set). This is the same as Perl.
-
- When PCRE_MULTILINE it is set, the "start of line" and "end
- of line" constructs match immediately following or immedi-
- ately before any newline in the subject string, respec-
- tively, as well as at the very start and end. This is
- equivalent to Perl's /m option. If there are no "\n" charac-
- ters in a subject string, or no occurrences of ^ or $ in a
- pattern, setting PCRE_MULTILINE has no effect.
-
- PCRE_UNGREEDY
-
- This option inverts the "greediness" of the quantifiers so
- that they are not greedy by default, but become greedy if
- followed by "?". It is not compatible with Perl. It can also
- be set by a (?U) option setting within the pattern.
-
- PCRE_UTF8
-
- This option causes PCRE to regard both the pattern and the
- subject as strings of UTF-8 characters instead of just byte
- strings. However, it is available only if PCRE has been
- built to include UTF-8 support. If not, the use of this
- option provokes an error. Support for UTF-8 is new, experi-
- mental, and incomplete. Details of exactly what it entails
- are given below.
-
-
-
-STUDYING A PATTERN
- When a pattern is going to be used several times, it is
- worth spending more time analyzing it in order to speed up
- the time taken for matching. The function pcre_study() takes
- a pointer to a compiled pattern as its first argument, and
- returns a pointer to a pcre_extra block (another typedef for
- a structure with hidden contents) containing additional
- information about the pattern; this can be passed to
- pcre_exec(). If no additional information is available, NULL
- is returned.
-
- The second argument contains option bits. At present, no
- options are defined for pcre_study(), and this argument
- should always be zero.
-
- The third argument for pcre_study() is a pointer to an error
- message. If studying succeeds (even if no data is returned),
- the variable it points to is set to NULL. Otherwise it
- points to a textual error message.
-
- This is a typical call to pcre_study():
-
- pcre_extra *pe;
- pe = pcre_study(
- re, /* result of pcre_compile() */
- 0, /* no options exist */
- &error); /* set to NULL or points to a message */
-
- At present, studying a pattern is useful only for non-
- anchored patterns that do not have a single fixed starting
- character. A bitmap of possible starting characters is
- created.
-
-
-
-LOCALE SUPPORT
- PCRE handles caseless matching, and determines whether char-
- acters are letters, digits, or whatever, by reference to a
- set of tables. The library contains a default set of tables
- which is created in the default C locale when PCRE is com-
- piled. This is used when the final argument of
- pcre_compile() is NULL, and is sufficient for many applica-
- tions.
-
- An alternative set of tables can, however, be supplied. Such
- tables are built by calling the pcre_maketables() function,
- which has no arguments, in the relevant locale. The result
- can then be passed to pcre_compile() as often as necessary.
- For example, to build and use tables that are appropriate
- for the French locale (where accented characters with codes
- greater than 128 are treated as letters), the following code
- could be used:
-
- setlocale(LC_CTYPE, "fr");
- tables = pcre_maketables();
- re = pcre_compile(..., tables);
-
- The tables are built in memory that is obtained via
- pcre_malloc. The pointer that is passed to pcre_compile is
- saved with the compiled pattern, and the same tables are
- used via this pointer by pcre_study() and pcre_exec(). Thus
- for any single pattern, compilation, studying and matching
- all happen in the same locale, but different patterns can be
- compiled in different locales. It is the caller's responsi-
- bility to ensure that the memory containing the tables
- remains available for as long as it is needed.
-
-
-
-INFORMATION ABOUT A PATTERN
- The pcre_fullinfo() function returns information about a
- compiled pattern. It replaces the obsolete pcre_info() func-
- tion, which is nevertheless retained for backwards compabil-
- ity (and is documented below).
-
- The first argument for pcre_fullinfo() is a pointer to the
- compiled pattern. The second argument is the result of
- pcre_study(), or NULL if the pattern was not studied. The
- third argument specifies which piece of information is
- required, while the fourth argument is a pointer to a vari-
- able to receive the data. The yield of the function is zero
- for success, or one of the following negative numbers:
-
- PCRE_ERROR_NULL the argument code was NULL
- the argument where was NULL
- PCRE_ERROR_BADMAGIC the "magic number" was not found
- PCRE_ERROR_BADOPTION the value of what was invalid
-
- Here is a typical call of pcre_fullinfo(), to obtain the
- length of the compiled pattern:
-
- int rc;
- unsigned long int length;
- rc = pcre_fullinfo(
- re, /* result of pcre_compile() */
- pe, /* result of pcre_study(), or NULL */
- PCRE_INFO_SIZE, /* what is required */
- &length); /* where to put the data */
-
- The possible values for the third argument are defined in
- pcre.h, and are as follows:
-
- PCRE_INFO_OPTIONS
-
- Return a copy of the options with which the pattern was com-
- piled. The fourth argument should point to an unsigned long
- int variable. These option bits are those specified in the
- call to pcre_compile(), modified by any top-level option
- settings within the pattern itself, and with the
- PCRE_ANCHORED bit forcibly set if the form of the pattern
- implies that it can match only at the start of a subject
- string.
-
- PCRE_INFO_SIZE
-
- Return the size of the compiled pattern, that is, the value
- that was passed as the argument to pcre_malloc() when PCRE
- was getting memory in which to place the compiled data. The
- fourth argument should point to a size_t variable.
-
- PCRE_INFO_CAPTURECOUNT
-
- Return the number of capturing subpatterns in the pattern.
- The fourth argument should point to an int variable.
-
- PCRE_INFO_BACKREFMAX
-
- Return the number of the highest back reference in the pat-
- tern. The fourth argument should point to an int variable.
- Zero is returned if there are no back references.
-
- PCRE_INFO_FIRSTCHAR
-
- Return information about the first character of any matched
- string, for a non-anchored pattern. If there is a fixed
- first character, e.g. from a pattern such as
- (cat|cow|coyote), it is returned in the integer pointed to
- by where. Otherwise, if either
-
- (a) the pattern was compiled with the PCRE_MULTILINE option,
- and every branch starts with "^", or
-
- (b) every branch of the pattern starts with ".*" and
- PCRE_DOTALL is not set (if it were set, the pattern would be
- anchored),
-
- -1 is returned, indicating that the pattern matches only at
- the start of a subject string or after any "\n" within the
- string. Otherwise -2 is returned. For anchored patterns, -2
- is returned.
-
- PCRE_INFO_FIRSTTABLE
-
- If the pattern was studied, and this resulted in the con-
- struction of a 256-bit table indicating a fixed set of char-
- acters for the first character in any matching string, a
- pointer to the table is returned. Otherwise NULL is
- returned. The fourth argument should point to an unsigned
- char * variable.
-
- PCRE_INFO_LASTLITERAL
-
- For a non-anchored pattern, return the value of the right-
- most literal character which must exist in any matched
- string, other than at its start. The fourth argument should
- point to an int variable. If there is no such character, or
- if the pattern is anchored, -1 is returned. For example, for
- the pattern /a\d+z\d+/ the returned value is 'z'.
-
- The pcre_info() function is now obsolete because its inter-
- face is too restrictive to return all the available data
- about a compiled pattern. New programs should use
- pcre_fullinfo() instead. The yield of pcre_info() is the
- number of capturing subpatterns, or one of the following
- negative numbers:
-
- PCRE_ERROR_NULL the argument code was NULL
- PCRE_ERROR_BADMAGIC the "magic number" was not found
-
- If the optptr argument is not NULL, a copy of the options
- with which the pattern was compiled is placed in the integer
- it points to (see PCRE_INFO_OPTIONS above).
-
- If the pattern is not anchored and the firstcharptr argument
- is not NULL, it is used to pass back information about the
- first character of any matched string (see
- PCRE_INFO_FIRSTCHAR above).
-
-
-
-MATCHING A PATTERN
- The function pcre_exec() is called to match a subject string
-
-
-
-
-
-SunOS 5.8 Last change: 9
-
-
-
- against a pre-compiled pattern, which is passed in the code
- argument. If the pattern has been studied, the result of the
- study should be passed in the extra argument. Otherwise this
- must be NULL.
-
- Here is an example of a simple call to pcre_exec():
-
- int rc;
- int ovector[30];
- rc = pcre_exec(
- re, /* result of pcre_compile() */
- NULL, /* we didn't study the pattern */
- "some string", /* the subject string */
- 11, /* the length of the subject string */
- 0, /* start at offset 0 in the subject */
- 0, /* default options */
- ovector, /* vector for substring information */
- 30); /* number of elements in the vector */
-
- The PCRE_ANCHORED option can be passed in the options argu-
- ment, whose unused bits must be zero. However, if a pattern
- was compiled with PCRE_ANCHORED, or turned out to be
- anchored by virtue of its contents, it cannot be made
- unachored at matching time.
-
- There are also three further options that can be set only at
- matching time:
-
- PCRE_NOTBOL
-
- The first character of the string is not the beginning of a
- line, so the circumflex metacharacter should not match
- before it. Setting this without PCRE_MULTILINE (at compile
- time) causes circumflex never to match.
-
- PCRE_NOTEOL
-
- The end of the string is not the end of a line, so the dol-
- lar metacharacter should not match it nor (except in multi-
- line mode) a newline immediately before it. Setting this
- without PCRE_MULTILINE (at compile time) causes dollar never
- to match.
-
- PCRE_NOTEMPTY
-
- An empty string is not considered to be a valid match if
- this option is set. If there are alternatives in the pat-
- tern, they are tried. If all the alternatives match the
- empty string, the entire match fails. For example, if the
- pattern
-
- a?b?
-
- is applied to a string not beginning with "a" or "b", it
- matches the empty string at the start of the subject. With
- PCRE_NOTEMPTY set, this match is not valid, so PCRE searches
- further into the string for occurrences of "a" or "b".
-
- Perl has no direct equivalent of PCRE_NOTEMPTY, but it does
- make a special case of a pattern match of the empty string
- within its split() function, and when using the /g modifier.
- It is possible to emulate Perl's behaviour after matching a
- null string by first trying the match again at the same
- offset with PCRE_NOTEMPTY set, and then if that fails by
- advancing the starting offset (see below) and trying an
- ordinary match again.
-
- The subject string is passed as a pointer in subject, a
- length in length, and a starting offset in startoffset.
- Unlike the pattern string, the subject may contain binary
- zero characters. When the starting offset is zero, the
- search for a match starts at the beginning of the subject,
- and this is by far the most common case.
-
- A non-zero starting offset is useful when searching for
- another match in the same subject by calling pcre_exec()
- again after a previous success. Setting startoffset differs
- from just passing over a shortened string and setting
- PCRE_NOTBOL in the case of a pattern that begins with any
- kind of lookbehind. For example, consider the pattern
-
- \Biss\B
-
- which finds occurrences of "iss" in the middle of words. (\B
- matches only if the current position in the subject is not a
- word boundary.) When applied to the string "Mississipi" the
- first call to pcre_exec() finds the first occurrence. If
- pcre_exec() is called again with just the remainder of the
- subject, namely "issipi", it does not match, because \B is
- always false at the start of the subject, which is deemed to
- be a word boundary. However, if pcre_exec() is passed the
- entire string again, but with startoffset set to 4, it finds
- the second occurrence of "iss" because it is able to look
- behind the starting point to discover that it is preceded by
- a letter.
-
- If a non-zero starting offset is passed when the pattern is
- anchored, one attempt to match at the given offset is tried.
- This can only succeed if the pattern does not require the
- match to be at the start of the subject.
-
- In general, a pattern matches a certain portion of the sub-
- ject, and in addition, further substrings from the subject
- may be picked out by parts of the pattern. Following the
- usage in Jeffrey Friedl's book, this is called "capturing"
- in what follows, and the phrase "capturing subpattern" is
- used for a fragment of a pattern that picks out a substring.
- PCRE supports several other kinds of parenthesized subpat-
- tern that do not cause substrings to be captured.
-
- Captured substrings are returned to the caller via a vector
- of integer offsets whose address is passed in ovector. The
- number of elements in the vector is passed in ovecsize. The
- first two-thirds of the vector is used to pass back captured
- substrings, each substring using a pair of integers. The
- remaining third of the vector is used as workspace by
- pcre_exec() while matching capturing subpatterns, and is not
- available for passing back information. The length passed in
- ovecsize should always be a multiple of three. If it is not,
- it is rounded down.
-
- When a match has been successful, information about captured
- substrings is returned in pairs of integers, starting at the
- beginning of ovector, and continuing up to two-thirds of its
- length at the most. The first element of a pair is set to
- the offset of the first character in a substring, and the
- second is set to the offset of the first character after the
- end of a substring. The first pair, ovector[0] and ovec-
- tor[1], identify the portion of the subject string matched
- by the entire pattern. The next pair is used for the first
- capturing subpattern, and so on. The value returned by
- pcre_exec() is the number of pairs that have been set. If
- there are no capturing subpatterns, the return value from a
- successful match is 1, indicating that just the first pair
- of offsets has been set.
-
- Some convenience functions are provided for extracting the
- captured substrings as separate strings. These are described
- in the following section.
-
- It is possible for an capturing subpattern number n+1 to
- match some part of the subject when subpattern n has not
- been used at all. For example, if the string "abc" is
- matched against the pattern (a|(z))(bc) subpatterns 1 and 3
- are matched, but 2 is not. When this happens, both offset
- values corresponding to the unused subpattern are set to -1.
-
- If a capturing subpattern is matched repeatedly, it is the
- last portion of the string that it matched that gets
- returned.
-
- If the vector is too small to hold all the captured sub-
- strings, it is used as far as possible (up to two-thirds of
- its length), and the function returns a value of zero. In
- particular, if the substring offsets are not of interest,
- pcre_exec() may be called with ovector passed as NULL and
- ovecsize as zero. However, if the pattern contains back
- references and the ovector isn't big enough to remember the
- related substrings, PCRE has to get additional memory for
- use during matching. Thus it is usually advisable to supply
- an ovector.
-
- Note that pcre_info() can be used to find out how many cap-
- turing subpatterns there are in a compiled pattern. The
- smallest size for ovector that will allow for n captured
- substrings in addition to the offsets of the substring
- matched by the whole pattern is (n+1)*3.
-
- If pcre_exec() fails, it returns a negative number. The fol-
- lowing are defined in the header file:
-
- PCRE_ERROR_NOMATCH (-1)
-
- The subject string did not match the pattern.
-
- PCRE_ERROR_NULL (-2)
-
- Either code or subject was passed as NULL, or ovector was
- NULL and ovecsize was not zero.
-
- PCRE_ERROR_BADOPTION (-3)
-
- An unrecognized bit was set in the options argument.
-
- PCRE_ERROR_BADMAGIC (-4)
-
- PCRE stores a 4-byte "magic number" at the start of the com-
- piled code, to catch the case when it is passed a junk
- pointer. This is the error it gives when the magic number
- isn't present.
-
- PCRE_ERROR_UNKNOWN_NODE (-5)
-
- While running the pattern match, an unknown item was encoun-
- tered in the compiled pattern. This error could be caused by
- a bug in PCRE or by overwriting of the compiled pattern.
-
- PCRE_ERROR_NOMEMORY (-6)
-
- If a pattern contains back references, but the ovector that
- is passed to pcre_exec() is not big enough to remember the
- referenced substrings, PCRE gets a block of memory at the
- start of matching to use for this purpose. If the call via
- pcre_malloc() fails, this error is given. The memory is
- freed at the end of matching.
-
-
-
-
-EXTRACTING CAPTURED SUBSTRINGS
- Captured substrings can be accessed directly by using the
- offsets returned by pcre_exec() in ovector. For convenience,
- the functions pcre_copy_substring(), pcre_get_substring(),
- and pcre_get_substring_list() are provided for extracting
- captured substrings as new, separate, zero-terminated
- strings. A substring that contains a binary zero is
- correctly extracted and has a further zero added on the end,
- but the result does not, of course, function as a C string.
-
- The first three arguments are the same for all three func-
- tions: subject is the subject string which has just been
- successfully matched, ovector is a pointer to the vector of
- integer offsets that was passed to pcre_exec(), and
- stringcount is the number of substrings that were captured
- by the match, including the substring that matched the
- entire regular expression. This is the value returned by
- pcre_exec if it is greater than zero. If pcre_exec()
- returned zero, indicating that it ran out of space in ovec-
- tor, the value passed as stringcount should be the size of
- the vector divided by three.
-
- The functions pcre_copy_substring() and pcre_get_substring()
- extract a single substring, whose number is given as string-
- number. A value of zero extracts the substring that matched
- the entire pattern, while higher values extract the captured
- substrings. For pcre_copy_substring(), the string is placed
- in buffer, whose length is given by buffersize, while for
- pcre_get_substring() a new block of memory is obtained via
- pcre_malloc, and its address is returned via stringptr. The
- yield of the function is the length of the string, not
- including the terminating zero, or one of
-
- PCRE_ERROR_NOMEMORY (-6)
-
- The buffer was too small for pcre_copy_substring(), or the
- attempt to get memory failed for pcre_get_substring().
-
- PCRE_ERROR_NOSUBSTRING (-7)
-
- There is no substring whose number is stringnumber.
-
- The pcre_get_substring_list() function extracts all avail-
- able substrings and builds a list of pointers to them. All
- this is done in a single block of memory which is obtained
- via pcre_malloc. The address of the memory block is returned
- via listptr, which is also the start of the list of string
- pointers. The end of the list is marked by a NULL pointer.
- The yield of the function is zero if all went well, or
-
- PCRE_ERROR_NOMEMORY (-6)
-
- if the attempt to get the memory block failed.
-
- When any of these functions encounter a substring that is
- unset, which can happen when capturing subpattern number n+1
- matches some part of the subject, but subpattern n has not
- been used at all, they return an empty string. This can be
- distinguished from a genuine zero-length substring by
- inspecting the appropriate offset in ovector, which is nega-
- tive for unset substrings.
-
- The two convenience functions pcre_free_substring() and
- pcre_free_substring_list() can be used to free the memory
- returned by a previous call of pcre_get_substring() or
- pcre_get_substring_list(), respectively. They do nothing
- more than call the function pointed to by pcre_free, which
- of course could be called directly from a C program. How-
- ever, PCRE is used in some situations where it is linked via
- a special interface to another programming language which
- cannot use pcre_free directly; it is for these cases that
- the functions are provided.
-
-
-
-LIMITATIONS
- There are some size limitations in PCRE but it is hoped that
- they will never in practice be relevant. The maximum length
- of a compiled pattern is 65539 (sic) bytes. All values in
- repeating quantifiers must be less than 65536. There max-
- imum number of capturing subpatterns is 65535. There is no
- limit to the number of non-capturing subpatterns, but the
- maximum depth of nesting of all kinds of parenthesized sub-
- pattern, including capturing subpatterns, assertions, and
- other types of subpattern, is 200.
-
- The maximum length of a subject string is the largest posi-
- tive number that an integer variable can hold. However, PCRE
- uses recursion to handle subpatterns and indefinite repeti-
- tion. This means that the available stack space may limit
- the size of a subject string that can be processed by cer-
- tain patterns.
-
-
-
-DIFFERENCES FROM PERL
- The differences described here are with respect to Perl
- 5.005.
-
- 1. By default, a whitespace character is any character that
- the C library function isspace() recognizes, though it is
- possible to compile PCRE with alternative character type
- tables. Normally isspace() matches space, formfeed, newline,
- carriage return, horizontal tab, and vertical tab. Perl 5 no
- longer includes vertical tab in its set of whitespace char-
- acters. The \v escape that was in the Perl documentation for
- a long time was never in fact recognized. However, the char-
- acter itself was treated as whitespace at least up to 5.002.
- In 5.004 and 5.005 it does not match \s.
-
- 2. PCRE does not allow repeat quantifiers on lookahead
- assertions. Perl permits them, but they do not mean what you
- might think. For example, (?!a){3} does not assert that the
- next three characters are not "a". It just asserts that the
- next character is not "a" three times.
-
- 3. Capturing subpatterns that occur inside negative looka-
- head assertions are counted, but their entries in the
- offsets vector are never set. Perl sets its numerical vari-
- ables from any such patterns that are matched before the
- assertion fails to match something (thereby succeeding), but
- only if the negative lookahead assertion contains just one
- branch.
-
- 4. Though binary zero characters are supported in the sub-
- ject string, they are not allowed in a pattern string
- because it is passed as a normal C string, terminated by
- zero. The escape sequence "\0" can be used in the pattern to
- represent a binary zero.
-
- 5. The following Perl escape sequences are not supported:
- \l, \u, \L, \U, \E, \Q. In fact these are implemented by
- Perl's general string-handling and are not part of its pat-
- tern matching engine.
-
- 6. The Perl \G assertion is not supported as it is not
- relevant to single pattern matches.
-
- 7. Fairly obviously, PCRE does not support the (?{code}) and
- (?p{code}) constructions. However, there is some experimen-
- tal support for recursive patterns using the non-Perl item
- (?R).
-
- 8. There are at the time of writing some oddities in Perl
- 5.005_02 concerned with the settings of captured strings
- when part of a pattern is repeated. For example, matching
- "aba" against the pattern /^(a(b)?)+$/ sets $2 to the value
- "b", but matching "aabbaa" against /^(aa(bb)?)+$/ leaves $2
- unset. However, if the pattern is changed to
- /^(aa(b(b))?)+$/ then $2 (and $3) are set.
-
- In Perl 5.004 $2 is set in both cases, and that is also true
- of PCRE. If in the future Perl changes to a consistent state
- that is different, PCRE may change to follow.
-
- 9. Another as yet unresolved discrepancy is that in Perl
- 5.005_02 the pattern /^(a)?(?(1)a|b)+$/ matches the string
- "a", whereas in PCRE it does not. However, in both Perl and
- PCRE /^(a)?a/ matched against "a" leaves $1 unset.
-
- 10. PCRE provides some extensions to the Perl regular
- expression facilities:
-
- (a) Although lookbehind assertions must match fixed length
- strings, each alternative branch of a lookbehind assertion
- can match a different length of string. Perl 5.005 requires
- them all to have the same length.
-
- (b) If PCRE_DOLLAR_ENDONLY is set and PCRE_MULTILINE is not
- set, the $ meta- character matches only at the very end of
- the string.
-
- (c) If PCRE_EXTRA is set, a backslash followed by a letter
- with no special meaning is faulted.
-
- (d) If PCRE_UNGREEDY is set, the greediness of the repeti-
- tion quantifiers is inverted, that is, by default they are
- not greedy, but if followed by a question mark they are.
-
- (e) PCRE_ANCHORED can be used to force a pattern to be tried
- only at the start of the subject.
-
- (f) The PCRE_NOTBOL, PCRE_NOTEOL, and PCRE_NOTEMPTY options
- for pcre_exec() have no Perl equivalents.
-
- (g) The (?R) construct allows for recursive pattern matching
- (Perl 5.6 can do this using the (?p{code}) construct, which
- PCRE cannot of course support.)
-
-
-
-REGULAR EXPRESSION DETAILS
- The syntax and semantics of the regular expressions sup-
- ported by PCRE are described below. Regular expressions are
- also described in the Perl documentation and in a number of
- other books, some of which have copious examples. Jeffrey
- Friedl's "Mastering Regular Expressions", published by
- O'Reilly (ISBN 1-56592-257), covers them in great detail.
-
- The description here is intended as reference documentation.
- The basic operation of PCRE is on strings of bytes. However,
- there is the beginnings of some support for UTF-8 character
- strings. To use this support you must configure PCRE to
- include it, and then call pcre_compile() with the PCRE_UTF8
- option. How this affects the pattern matching is described
- in the final section of this document.
-
- A regular expression is a pattern that is matched against a
- subject string from left to right. Most characters stand for
- themselves in a pattern, and match the corresponding charac-
- ters in the subject. As a trivial example, the pattern
-
- The quick brown fox
-
- matches a portion of a subject string that is identical to
- itself. The power of regular expressions comes from the
- ability to include alternatives and repetitions in the pat-
- tern. These are encoded in the pattern by the use of meta-
- characters, which do not stand for themselves but instead
- are interpreted in some special way.
-
- There are two different sets of meta-characters: those that
- are recognized anywhere in the pattern except within square
- brackets, and those that are recognized in square brackets.
- Outside square brackets, the meta-characters are as follows:
-
- \ general escape character with several uses
- ^ assert start of subject (or line, in multiline
- mode)
- $ assert end of subject (or line, in multiline mode)
- . match any character except newline (by default)
- [ start character class definition
- | start of alternative branch
- ( start subpattern
- ) end subpattern
- ? extends the meaning of (
- also 0 or 1 quantifier
- also quantifier minimizer
- * 0 or more quantifier
- + 1 or more quantifier
- { start min/max quantifier
-
- Part of a pattern that is in square brackets is called a
- "character class". In a character class the only meta-
- characters are:
-
- \ general escape character
- ^ negate the class, but only if the first character
- - indicates character range
- ] terminates the character class
-
- The following sections describe the use of each of the
- meta-characters.
-
-
-
-BACKSLASH
- The backslash character has several uses. Firstly, if it is
- followed by a non-alphameric character, it takes away any
- special meaning that character may have. This use of
-
- backslash as an escape character applies both inside and
- outside character classes.
-
- For example, if you want to match a "*" character, you write
- "\*" in the pattern. This applies whether or not the follow-
- ing character would otherwise be interpreted as a meta-
- character, so it is always safe to precede a non-alphameric
- with "\" to specify that it stands for itself. In particu-
- lar, if you want to match a backslash, you write "\\".
-
- If a pattern is compiled with the PCRE_EXTENDED option, whi-
- tespace in the pattern (other than in a character class) and
- characters between a "#" outside a character class and the
- next newline character are ignored. An escaping backslash
- can be used to include a whitespace or "#" character as part
- of the pattern.
-
- A second use of backslash provides a way of encoding non-
- printing characters in patterns in a visible manner. There
- is no restriction on the appearance of non-printing charac-
- ters, apart from the binary zero that terminates a pattern,
- but when a pattern is being prepared by text editing, it is
- usually easier to use one of the following escape sequences
- than the binary character it represents:
-
- \a alarm, that is, the BEL character (hex 07)
- \cx "control-x", where x is any character
- \e escape (hex 1B)
- \f formfeed (hex 0C)
- \n newline (hex 0A)
- \r carriage return (hex 0D)
- \t tab (hex 09)
- \xhh character with hex code hh
- \ddd character with octal code ddd, or backreference
-
- The precise effect of "\cx" is as follows: if "x" is a lower
- case letter, it is converted to upper case. Then bit 6 of
- the character (hex 40) is inverted. Thus "\cz" becomes hex
- 1A, but "\c{" becomes hex 3B, while "\c;" becomes hex 7B.
-
- After "\x", up to two hexadecimal digits are read (letters
- can be in upper or lower case).
-
- After "\0" up to two further octal digits are read. In both
- cases, if there are fewer than two digits, just those that
- are present are used. Thus the sequence "\0\x\07" specifies
- two binary zeros followed by a BEL character. Make sure you
- supply two digits after the initial zero if the character
- that follows is itself an octal digit.
-
- The handling of a backslash followed by a digit other than 0
- is complicated. Outside a character class, PCRE reads it
- and any following digits as a decimal number. If the number
- is less than 10, or if there have been at least that many
- previous capturing left parentheses in the expression, the
- entire sequence is taken as a back reference. A description
- of how this works is given later, following the discussion
- of parenthesized subpatterns.
-
- Inside a character class, or if the decimal number is
- greater than 9 and there have not been that many capturing
- subpatterns, PCRE re-reads up to three octal digits follow-
- ing the backslash, and generates a single byte from the
- least significant 8 bits of the value. Any subsequent digits
- stand for themselves. For example:
-
- \040 is another way of writing a space
- \40 is the same, provided there are fewer than 40
- previous capturing subpatterns
- \7 is always a back reference
- \11 might be a back reference, or another way of
- writing a tab
- \011 is always a tab
- \0113 is a tab followed by the character "3"
- \113 is the character with octal code 113 (since there
- can be no more than 99 back references)
- \377 is a byte consisting entirely of 1 bits
- \81 is either a back reference, or a binary zero
- followed by the two characters "8" and "1"
-
- Note that octal values of 100 or greater must not be intro-
- duced by a leading zero, because no more than three octal
- digits are ever read.
-
- All the sequences that define a single byte value can be
- used both inside and outside character classes. In addition,
- inside a character class, the sequence "\b" is interpreted
- as the backspace character (hex 08). Outside a character
- class it has a different meaning (see below).
-
- The third use of backslash is for specifying generic charac-
- ter types:
-
- \d any decimal digit
- \D any character that is not a decimal digit
- \s any whitespace character
- \S any character that is not a whitespace character
- \w any "word" character
- \W any "non-word" character
-
- Each pair of escape sequences partitions the complete set of
- characters into two disjoint sets. Any given character
- matches one, and only one, of each pair.
-
- A "word" character is any letter or digit or the underscore
- character, that is, any character which can be part of a
- Perl "word". The definition of letters and digits is con-
- trolled by PCRE's character tables, and may vary if locale-
- specific matching is taking place (see "Locale support"
- above). For example, in the "fr" (French) locale, some char-
- acter codes greater than 128 are used for accented letters,
- and these are matched by \w.
-
- These character type sequences can appear both inside and
- outside character classes. They each match one character of
- the appropriate type. If the current matching point is at
- the end of the subject string, all of them fail, since there
- is no character to match.
-
- The fourth use of backslash is for certain simple asser-
- tions. An assertion specifies a condition that has to be met
- at a particular point in a match, without consuming any
- characters from the subject string. The use of subpatterns
- for more complicated assertions is described below. The
- backslashed assertions are
-
- \b word boundary
- \B not a word boundary
- \A start of subject (independent of multiline mode)
- \Z end of subject or newline at end (independent of
- multiline mode)
- \z end of subject (independent of multiline mode)
-
- These assertions may not appear in character classes (but
- note that "\b" has a different meaning, namely the backspace
- character, inside a character class).
-
- A word boundary is a position in the subject string where
- the current character and the previous character do not both
- match \w or \W (i.e. one matches \w and the other matches
- \W), or the start or end of the string if the first or last
- character matches \w, respectively.
-
- The \A, \Z, and \z assertions differ from the traditional
- circumflex and dollar (described below) in that they only
- ever match at the very start and end of the subject string,
- whatever options are set. They are not affected by the
- PCRE_NOTBOL or PCRE_NOTEOL options. If the startoffset argu-
- ment of pcre_exec() is non-zero, \A can never match. The
- difference between \Z and \z is that \Z matches before a
- newline that is the last character of the string as well as
- at the end of the string, whereas \z matches only at the
- end.
-
-
-
-CIRCUMFLEX AND DOLLAR
- Outside a character class, in the default matching mode, the
- circumflex character is an assertion which is true only if
- the current matching point is at the start of the subject
- string. If the startoffset argument of pcre_exec() is non-
- zero, circumflex can never match. Inside a character class,
- circumflex has an entirely different meaning (see below).
-
- Circumflex need not be the first character of the pattern if
- a number of alternatives are involved, but it should be the
- first thing in each alternative in which it appears if the
- pattern is ever to match that branch. If all possible alter-
- natives start with a circumflex, that is, if the pattern is
- constrained to match only at the start of the subject, it is
- said to be an "anchored" pattern. (There are also other con-
- structs that can cause a pattern to be anchored.)
-
- A dollar character is an assertion which is true only if the
- current matching point is at the end of the subject string,
- or immediately before a newline character that is the last
- character in the string (by default). Dollar need not be the
- last character of the pattern if a number of alternatives
- are involved, but it should be the last item in any branch
- in which it appears. Dollar has no special meaning in a
- character class.
-
- The meaning of dollar can be changed so that it matches only
- at the very end of the string, by setting the
- PCRE_DOLLAR_ENDONLY option at compile or matching time. This
- does not affect the \Z assertion.
-
- The meanings of the circumflex and dollar characters are
- changed if the PCRE_MULTILINE option is set. When this is
- the case, they match immediately after and immediately
- before an internal "\n" character, respectively, in addition
- to matching at the start and end of the subject string. For
- example, the pattern /^abc$/ matches the subject string
- "def\nabc" in multiline mode, but not otherwise. Conse-
- quently, patterns that are anchored in single line mode
- because all branches start with "^" are not anchored in mul-
- tiline mode, and a match for circumflex is possible when the
- startoffset argument of pcre_exec() is non-zero. The
- PCRE_DOLLAR_ENDONLY option is ignored if PCRE_MULTILINE is
- set.
-
- Note that the sequences \A, \Z, and \z can be used to match
- the start and end of the subject in both modes, and if all
- branches of a pattern start with \A it is always anchored,
- whether PCRE_MULTILINE is set or not.
-
-
-
-FULL STOP (PERIOD, DOT)
- Outside a character class, a dot in the pattern matches any
- one character in the subject, including a non-printing char-
- acter, but not (by default) newline. If the PCRE_DOTALL
- option is set, dots match newlines as well. The handling of
- dot is entirely independent of the handling of circumflex
- and dollar, the only relationship being that they both
- involve newline characters. Dot has no special meaning in a
- character class.
-
-
-
-SQUARE BRACKETS
- An opening square bracket introduces a character class, ter-
- minated by a closing square bracket. A closing square
- bracket on its own is not special. If a closing square
- bracket is required as a member of the class, it should be
- the first data character in the class (after an initial cir-
- cumflex, if present) or escaped with a backslash.
-
- A character class matches a single character in the subject;
- the character must be in the set of characters defined by
- the class, unless the first character in the class is a cir-
- cumflex, in which case the subject character must not be in
- the set defined by the class. If a circumflex is actually
- required as a member of the class, ensure it is not the
- first character, or escape it with a backslash.
-
- For example, the character class [aeiou] matches any lower
- case vowel, while [^aeiou] matches any character that is not
- a lower case vowel. Note that a circumflex is just a con-
- venient notation for specifying the characters which are in
- the class by enumerating those that are not. It is not an
- assertion: it still consumes a character from the subject
- string, and fails if the current pointer is at the end of
- the string.
-
- When caseless matching is set, any letters in a class
- represent both their upper case and lower case versions, so
- for example, a caseless [aeiou] matches "A" as well as "a",
- and a caseless [^aeiou] does not match "A", whereas a case-
- ful version would.
-
- The newline character is never treated in any special way in
- character classes, whatever the setting of the PCRE_DOTALL
- or PCRE_MULTILINE options is. A class such as [^a] will
- always match a newline.
-
- The minus (hyphen) character can be used to specify a range
- of characters in a character class. For example, [d-m]
- matches any letter between d and m, inclusive. If a minus
- character is required in a class, it must be escaped with a
- backslash or appear in a position where it cannot be inter-
- preted as indicating a range, typically as the first or last
- character in the class.
-
- It is not possible to have the literal character "]" as the
- end character of a range. A pattern such as [W-]46] is
- interpreted as a class of two characters ("W" and "-") fol-
- lowed by a literal string "46]", so it would match "W46]" or
- "-46]". However, if the "]" is escaped with a backslash it
- is interpreted as the end of range, so [W-\]46] is inter-
- preted as a single class containing a range followed by two
- separate characters. The octal or hexadecimal representation
- of "]" can also be used to end a range.
-
- Ranges operate in ASCII collating sequence. They can also be
- used for characters specified numerically, for example
- [\000-\037]. If a range that includes letters is used when
- caseless matching is set, it matches the letters in either
- case. For example, [W-c] is equivalent to [][\^_`wxyzabc],
- matched caselessly, and if character tables for the "fr"
- locale are in use, [\xc8-\xcb] matches accented E characters
- in both cases.
-
- The character types \d, \D, \s, \S, \w, and \W may also
- appear in a character class, and add the characters that
- they match to the class. For example, [\dABCDEF] matches any
- hexadecimal digit. A circumflex can conveniently be used
- with the upper case character types to specify a more res-
- tricted set of characters than the matching lower case type.
- For example, the class [^\W_] matches any letter or digit,
- but not underscore.
-
- All non-alphameric characters other than \, -, ^ (at the
- start) and the terminating ] are non-special in character
- classes, but it does no harm if they are escaped.
-
-
-
-POSIX CHARACTER CLASSES
- Perl 5.6 (not yet released at the time of writing) is going
- to support the POSIX notation for character classes, which
- uses names enclosed by [: and :] within the enclosing
- square brackets. PCRE supports this notation. For example,
-
- [01[:alpha:]%]
-
- matches "0", "1", any alphabetic character, or "%". The sup-
- ported class names are
-
- alnum letters and digits
- alpha letters
- ascii character codes 0 - 127
- cntrl control characters
- digit decimal digits (same as \d)
- graph printing characters, excluding space
- lower lower case letters
- print printing characters, including space
- punct printing characters, excluding letters and digits
- space white space (same as \s)
- upper upper case letters
- word "word" characters (same as \w)
- xdigit hexadecimal digits
-
- >>>>>>>>>>>>Only WORD is perl. BLANK is GNU.
-
- The names "ascii" and "word" are Perl extensions. Another
- Perl extension is negation, which is indicated by a ^ char-
- acter after the colon. For example,
-
- [12[:^digit:]]
-
- matches "1", "2", or any non-digit. PCRE (and Perl) also
- recognize the POSIX syntax [.ch.] and [=ch=] where "ch" is a
- "collating element", but these are not supported, and an
- error is given if they are encountered.
-
-
-
-VERTICAL BAR
- Vertical bar characters are used to separate alternative
- patterns. For example, the pattern
-
- gilbert|sullivan
-
- matches either "gilbert" or "sullivan". Any number of alter-
- natives may appear, and an empty alternative is permitted
- (matching the empty string). The matching process tries
- each alternative in turn, from left to right, and the first
- one that succeeds is used. If the alternatives are within a
- subpattern (defined below), "succeeds" means matching the
- rest of the main pattern as well as the alternative in the
- subpattern.
-
-
-
-INTERNAL OPTION SETTING
- The settings of PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL,
- and PCRE_EXTENDED can be changed from within the pattern by
- a sequence of Perl option letters enclosed between "(?" and
- ")". The option letters are
-
- i for PCRE_CASELESS
- m for PCRE_MULTILINE
- s for PCRE_DOTALL
- x for PCRE_EXTENDED
-
- For example, (?im) sets caseless, multiline matching. It is
- also possible to unset these options by preceding the letter
- with a hyphen, and a combined setting and unsetting such as
- (?im-sx), which sets PCRE_CASELESS and PCRE_MULTILINE while
- unsetting PCRE_DOTALL and PCRE_EXTENDED, is also permitted.
- If a letter appears both before and after the hyphen, the
- option is unset.
-
- The scope of these option changes depends on where in the
- pattern the setting occurs. For settings that are outside
- any subpattern (defined below), the effect is the same as if
- the options were set or unset at the start of matching. The
- following patterns all behave in exactly the same way:
-
- (?i)abc
- a(?i)bc
- ab(?i)c
- abc(?i)
-
- which in turn is the same as compiling the pattern abc with
- PCRE_CASELESS set. In other words, such "top level" set-
- tings apply to the whole pattern (unless there are other
- changes inside subpatterns). If there is more than one set-
- ting of the same option at top level, the rightmost setting
- is used.
-
- If an option change occurs inside a subpattern, the effect
- is different. This is a change of behaviour in Perl 5.005.
- An option change inside a subpattern affects only that part
- of the subpattern that follows it, so
-
- (a(?i)b)c
-
- matches abc and aBc and no other strings (assuming
- PCRE_CASELESS is not used). By this means, options can be
- made to have different settings in different parts of the
- pattern. Any changes made in one alternative do carry on
- into subsequent branches within the same subpattern. For
- example,
-
- (a(?i)b|c)
-
- matches "ab", "aB", "c", and "C", even though when matching
- "C" the first branch is abandoned before the option setting.
- This is because the effects of option settings happen at
- compile time. There would be some very weird behaviour oth-
- erwise.
-
- The PCRE-specific options PCRE_UNGREEDY and PCRE_EXTRA can
- be changed in the same way as the Perl-compatible options by
- using the characters U and X respectively. The (?X) flag
- setting is special in that it must always occur earlier in
- the pattern than any of the additional features it turns on,
- even when it is at top level. It is best put at the start.
-
-
-
-SUBPATTERNS
- Subpatterns are delimited by parentheses (round brackets),
- which can be nested. Marking part of a pattern as a subpat-
- tern does two things:
-
- 1. It localizes a set of alternatives. For example, the pat-
- tern
-
- cat(aract|erpillar|)
-
- matches one of the words "cat", "cataract", or "caterpil-
- lar". Without the parentheses, it would match "cataract",
- "erpillar" or the empty string.
-
- 2. It sets up the subpattern as a capturing subpattern (as
- defined above). When the whole pattern matches, that por-
- tion of the subject string that matched the subpattern is
- passed back to the caller via the ovector argument of
- pcre_exec(). Opening parentheses are counted from left to
- right (starting from 1) to obtain the numbers of the captur-
- ing subpatterns.
-
- For example, if the string "the red king" is matched against
- the pattern
-
- the ((red|white) (king|queen))
-
- the captured substrings are "red king", "red", and "king",
- and are numbered 1, 2, and 3, respectively.
-
- The fact that plain parentheses fulfil two functions is not
- always helpful. There are often times when a grouping sub-
- pattern is required without a capturing requirement. If an
- opening parenthesis is followed by "?:", the subpattern does
- not do any capturing, and is not counted when computing the
- number of any subsequent capturing subpatterns. For example,
- if the string "the white queen" is matched against the pat-
- tern
-
- the ((?:red|white) (king|queen))
-
- the captured substrings are "white queen" and "queen", and
- are numbered 1 and 2. The maximum number of captured sub-
- strings is 99, and the maximum number of all subpatterns,
- both capturing and non-capturing, is 200.
- As a convenient shorthand, if any option settings are
- required at the start of a non-capturing subpattern, the
- option letters may appear between the "?" and the ":". Thus
- the two patterns
-
- (?i:saturday|sunday)
- (?:(?i)saturday|sunday)
-
- match exactly the same set of strings. Because alternative
- branches are tried from left to right, and options are not
- reset until the end of the subpattern is reached, an option
- setting in one branch does affect subsequent branches, so
- the above patterns match "SUNDAY" as well as "Saturday".
-
-
-
-REPETITION
- Repetition is specified by quantifiers, which can follow any
- of the following items:
-
- a single character, possibly escaped
- the . metacharacter
- a character class
- a back reference (see next section)
- a parenthesized subpattern (unless it is an assertion -
- see below)
-
- The general repetition quantifier specifies a minimum and
- maximum number of permitted matches, by giving the two
- numbers in curly brackets (braces), separated by a comma.
- The numbers must be less than 65536, and the first must be
- less than or equal to the second. For example:
-
- z{2,4}
-
- matches "zz", "zzz", or "zzzz". A closing brace on its own
- is not a special character. If the second number is omitted,
- but the comma is present, there is no upper limit; if the
- second number and the comma are both omitted, the quantifier
- specifies an exact number of required matches. Thus
-
- [aeiou]{3,}
-
- matches at least 3 successive vowels, but may match many
- more, while
-
- \d{8}
-
- matches exactly 8 digits. An opening curly bracket that
- appears in a position where a quantifier is not allowed, or
- one that does not match the syntax of a quantifier, is taken
- as a literal character. For example, {,6} is not a
- quantifier, but a literal string of four characters.
-
- The quantifier {0} is permitted, causing the expression to
- behave as if the previous item and the quantifier were not
- present.
-
- For convenience (and historical compatibility) the three
- most common quantifiers have single-character abbreviations:
-
- * is equivalent to {0,}
- + is equivalent to {1,}
- ? is equivalent to {0,1}
-
- It is possible to construct infinite loops by following a
- subpattern that can match no characters with a quantifier
- that has no upper limit, for example:
-
- (a?)*
-
- Earlier versions of Perl and PCRE used to give an error at
- compile time for such patterns. However, because there are
- cases where this can be useful, such patterns are now
- accepted, but if any repetition of the subpattern does in
- fact match no characters, the loop is forcibly broken.
-
- By default, the quantifiers are "greedy", that is, they
- match as much as possible (up to the maximum number of per-
- mitted times), without causing the rest of the pattern to
- fail. The classic example of where this gives problems is in
- trying to match comments in C programs. These appear between
- the sequences /* and */ and within the sequence, individual
- * and / characters may appear. An attempt to match C com-
- ments by applying the pattern
-
- /\*.*\*/
-
- to the string
-
- /* first command */ not comment /* second comment */
-
- fails, because it matches the entire string owing to the
- greediness of the .* item.
-
- However, if a quantifier is followed by a question mark, it
- ceases to be greedy, and instead matches the minimum number
- of times possible, so the pattern
-
- /\*.*?\*/
-
- does the right thing with the C comments. The meaning of the
- various quantifiers is not otherwise changed, just the pre-
- ferred number of matches. Do not confuse this use of
- question mark with its use as a quantifier in its own right.
- Because it has two uses, it can sometimes appear doubled, as
- in
-
- \d??\d
-
- which matches one digit by preference, but can match two if
- that is the only way the rest of the pattern matches.
-
- If the PCRE_UNGREEDY option is set (an option which is not
- available in Perl), the quantifiers are not greedy by
- default, but individual ones can be made greedy by following
- them with a question mark. In other words, it inverts the
- default behaviour.
-
- When a parenthesized subpattern is quantified with a minimum
- repeat count that is greater than 1 or with a limited max-
- imum, more store is required for the compiled pattern, in
- proportion to the size of the minimum or maximum.
-
- If a pattern starts with .* or .{0,} and the PCRE_DOTALL
- option (equivalent to Perl's /s) is set, thus allowing the .
- to match newlines, the pattern is implicitly anchored,
- because whatever follows will be tried against every charac-
- ter position in the subject string, so there is no point in
- retrying the overall match at any position after the first.
- PCRE treats such a pattern as though it were preceded by \A.
- In cases where it is known that the subject string contains
- no newlines, it is worth setting PCRE_DOTALL when the pat-
- tern begins with .* in order to obtain this optimization, or
- alternatively using ^ to indicate anchoring explicitly.
-
- When a capturing subpattern is repeated, the value captured
- is the substring that matched the final iteration. For exam-
- ple, after
-
- (tweedle[dume]{3}\s*)+
-
- has matched "tweedledum tweedledee" the value of the cap-
- tured substring is "tweedledee". However, if there are
- nested capturing subpatterns, the corresponding captured
- values may have been set in previous iterations. For exam-
- ple, after
-
- /(a|(b))+/
-
- matches "aba" the value of the second captured substring is
- "b".
-
-
-
-
-BACK REFERENCES
- Outside a character class, a backslash followed by a digit
- greater than 0 (and possibly further digits) is a back
- reference to a capturing subpattern earlier (i.e. to its
- left) in the pattern, provided there have been that many
- previous capturing left parentheses.
-
- However, if the decimal number following the backslash is
- less than 10, it is always taken as a back reference, and
- causes an error only if there are not that many capturing
- left parentheses in the entire pattern. In other words, the
- parentheses that are referenced need not be to the left of
- the reference for numbers less than 10. See the section
- entitled "Backslash" above for further details of the han-
- dling of digits following a backslash.
-
- A back reference matches whatever actually matched the cap-
- turing subpattern in the current subject string, rather than
- anything matching the subpattern itself. So the pattern
-
- (sens|respons)e and \1ibility
-
- matches "sense and sensibility" and "response and responsi-
- bility", but not "sense and responsibility". If caseful
- matching is in force at the time of the back reference, the
- case of letters is relevant. For example,
-
- ((?i)rah)\s+\1
-
- matches "rah rah" and "RAH RAH", but not "RAH rah", even
- though the original capturing subpattern is matched case-
- lessly.
-
- There may be more than one back reference to the same sub-
- pattern. If a subpattern has not actually been used in a
- particular match, any back references to it always fail. For
- example, the pattern
-
- (a|(bc))\2
-
- always fails if it starts to match "a" rather than "bc".
- Because there may be up to 99 back references, all digits
- following the backslash are taken as part of a potential
- back reference number. If the pattern continues with a digit
- character, some delimiter must be used to terminate the back
- reference. If the PCRE_EXTENDED option is set, this can be
- whitespace. Otherwise an empty comment can be used.
-
- A back reference that occurs inside the parentheses to which
- it refers fails when the subpattern is first used, so, for
- example, (a\1) never matches. However, such references can
- be useful inside repeated subpatterns. For example, the
- pattern
-
- (a|b\1)+
-
- matches any number of "a"s and also "aba", "ababbaa" etc. At
- each iteration of the subpattern, the back reference matches
- the character string corresponding to the previous itera-
- tion. In order for this to work, the pattern must be such
- that the first iteration does not need to match the back
- reference. This can be done using alternation, as in the
- example above, or by a quantifier with a minimum of zero.
-
-
-
-ASSERTIONS
- An assertion is a test on the characters following or
- preceding the current matching point that does not actually
- consume any characters. The simple assertions coded as \b,
- \B, \A, \Z, \z, ^ and $ are described above. More compli-
- cated assertions are coded as subpatterns. There are two
- kinds: those that look ahead of the current position in the
- subject string, and those that look behind it.
-
- An assertion subpattern is matched in the normal way, except
- that it does not cause the current matching position to be
- changed. Lookahead assertions start with (?= for positive
- assertions and (?! for negative assertions. For example,
-
- \w+(?=;)
-
- matches a word followed by a semicolon, but does not include
- the semicolon in the match, and
-
- foo(?!bar)
-
- matches any occurrence of "foo" that is not followed by
- "bar". Note that the apparently similar pattern
-
- (?!foo)bar
-
- does not find an occurrence of "bar" that is preceded by
- something other than "foo"; it finds any occurrence of "bar"
- whatsoever, because the assertion (?!foo) is always true
- when the next three characters are "bar". A lookbehind
- assertion is needed to achieve this effect.
-
- Lookbehind assertions start with (?<= for positive asser-
- tions and (?<! for negative assertions. For example,
-
- (?<!foo)bar
-
- does find an occurrence of "bar" that is not preceded by
- "foo". The contents of a lookbehind assertion are restricted
- such that all the strings it matches must have a fixed
- length. However, if there are several alternatives, they do
- not all have to have the same fixed length. Thus
-
- (?<=bullock|donkey)
-
- is permitted, but
-
- (?<!dogs?|cats?)
-
- causes an error at compile time. Branches that match dif-
- ferent length strings are permitted only at the top level of
- a lookbehind assertion. This is an extension compared with
- Perl 5.005, which requires all branches to match the same
- length of string. An assertion such as
-
- (?<=ab(c|de))
-
- is not permitted, because its single top-level branch can
- match two different lengths, but it is acceptable if rewrit-
- ten to use two top-level branches:
-
- (?<=abc|abde)
-
- The implementation of lookbehind assertions is, for each
- alternative, to temporarily move the current position back
- by the fixed width and then try to match. If there are
- insufficient characters before the current position, the
- match is deemed to fail. Lookbehinds in conjunction with
- once-only subpatterns can be particularly useful for match-
- ing at the ends of strings; an example is given at the end
- of the section on once-only subpatterns.
-
- Several assertions (of any sort) may occur in succession.
- For example,
-
- (?<=\d{3})(?<!999)foo
-
- matches "foo" preceded by three digits that are not "999".
- Notice that each of the assertions is applied independently
- at the same point in the subject string. First there is a
- check that the previous three characters are all digits, and
- then there is a check that the same three characters are not
- "999". This pattern does not match "foo" preceded by six
- characters, the first of which are digits and the last three
- of which are not "999". For example, it doesn't match
- "123abcfoo". A pattern to do that is
-
- (?<=\d{3}...)(?<!999)foo
-
- This time the first assertion looks at the preceding six
- characters, checking that the first three are digits, and
- then the second assertion checks that the preceding three
- characters are not "999".
-
- Assertions can be nested in any combination. For example,
-
- (?<=(?<!foo)bar)baz
-
- matches an occurrence of "baz" that is preceded by "bar"
- which in turn is not preceded by "foo", while
-
- (?<=\d{3}(?!999)...)foo
-
- is another pattern which matches "foo" preceded by three
- digits and any three characters that are not "999".
-
- Assertion subpatterns are not capturing subpatterns, and may
- not be repeated, because it makes no sense to assert the
- same thing several times. If any kind of assertion contains
- capturing subpatterns within it, these are counted for the
- purposes of numbering the capturing subpatterns in the whole
- pattern. However, substring capturing is carried out only
- for positive assertions, because it does not make sense for
- negative assertions.
-
- Assertions count towards the maximum of 200 parenthesized
- subpatterns.
-
-
-
-ONCE-ONLY SUBPATTERNS
- With both maximizing and minimizing repetition, failure of
- what follows normally causes the repeated item to be re-
- evaluated to see if a different number of repeats allows the
- rest of the pattern to match. Sometimes it is useful to
- prevent this, either to change the nature of the match, or
- to cause it fail earlier than it otherwise might, when the
- author of the pattern knows there is no point in carrying
- on.
-
- Consider, for example, the pattern \d+foo when applied to
- the subject line
-
- 123456bar
-
- After matching all 6 digits and then failing to match "foo",
- the normal action of the matcher is to try again with only 5
- digits matching the \d+ item, and then with 4, and so on,
- before ultimately failing. Once-only subpatterns provide the
- means for specifying that once a portion of the pattern has
- matched, it is not to be re-evaluated in this way, so the
- matcher would give up immediately on failing to match "foo"
- the first time. The notation is another kind of special
- parenthesis, starting with (?> as in this example:
-
- (?>\d+)bar
-
- This kind of parenthesis "locks up" the part of the pattern
- it contains once it has matched, and a failure further into
- the pattern is prevented from backtracking into it. Back-
- tracking past it to previous items, however, works as nor-
- mal.
-
- An alternative description is that a subpattern of this type
- matches the string of characters that an identical stan-
- dalone pattern would match, if anchored at the current point
- in the subject string.
-
- Once-only subpatterns are not capturing subpatterns. Simple
- cases such as the above example can be thought of as a max-
- imizing repeat that must swallow everything it can. So,
- while both \d+ and \d+? are prepared to adjust the number of
- digits they match in order to make the rest of the pattern
- match, (?>\d+) can only match an entire sequence of digits.
-
- This construction can of course contain arbitrarily compli-
- cated subpatterns, and it can be nested.
-
- Once-only subpatterns can be used in conjunction with look-
- behind assertions to specify efficient matching at the end
- of the subject string. Consider a simple pattern such as
-
- abcd$
-
- when applied to a long string which does not match. Because
- matching proceeds from left to right, PCRE will look for
- each "a" in the subject and then see if what follows matches
- the rest of the pattern. If the pattern is specified as
-
- ^.*abcd$
-
- the initial .* matches the entire string at first, but when
- this fails (because there is no following "a"), it back-
- tracks to match all but the last character, then all but the
- last two characters, and so on. Once again the search for
- "a" covers the entire string, from right to left, so we are
- no better off. However, if the pattern is written as
-
- ^(?>.*)(?<=abcd)
-
- there can be no backtracking for the .* item; it can match
- only the entire string. The subsequent lookbehind assertion
- does a single test on the last four characters. If it fails,
- the match fails immediately. For long strings, this approach
- makes a significant difference to the processing time.
-
- When a pattern contains an unlimited repeat inside a subpat-
- tern that can itself be repeated an unlimited number of
- times, the use of a once-only subpattern is the only way to
- avoid some failing matches taking a very long time indeed.
- The pattern
-
- (\D+|<\d+>)*[!?]
-
- matches an unlimited number of substrings that either con-
- sist of non-digits, or digits enclosed in <>, followed by
- either ! or ?. When it matches, it runs quickly. However, if
- it is applied to
-
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-
- it takes a long time before reporting failure. This is
- because the string can be divided between the two repeats in
- a large number of ways, and all have to be tried. (The exam-
- ple used [!?] rather than a single character at the end,
- because both PCRE and Perl have an optimization that allows
- for fast failure when a single character is used. They
- remember the last single character that is required for a
- match, and fail early if it is not present in the string.)
- If the pattern is changed to
-
- ((?>\D+)|<\d+>)*[!?]
-
- sequences of non-digits cannot be broken, and failure hap-
- pens quickly.
-
-
-
-CONDITIONAL SUBPATTERNS
- It is possible to cause the matching process to obey a sub-
- pattern conditionally or to choose between two alternative
- subpatterns, depending on the result of an assertion, or
- whether a previous capturing subpattern matched or not. The
- two possible forms of conditional subpattern are
-
- (?(condition)yes-pattern)
- (?(condition)yes-pattern|no-pattern)
-
- If the condition is satisfied, the yes-pattern is used; oth-
- erwise the no-pattern (if present) is used. If there are
- more than two alternatives in the subpattern, a compile-time
- error occurs.
-
- There are two kinds of condition. If the text between the
- parentheses consists of a sequence of digits, the condition
- is satisfied if the capturing subpattern of that number has
- previously matched. The number must be greater than zero.
- Consider the following pattern, which contains non-
- significant white space to make it more readable (assume the
- PCRE_EXTENDED option) and to divide it into three parts for
- ease of discussion:
-
- ( \( )? [^()]+ (?(1) \) )
-
- The first part matches an optional opening parenthesis, and
- if that character is present, sets it as the first captured
- substring. The second part matches one or more characters
- that are not parentheses. The third part is a conditional
- subpattern that tests whether the first set of parentheses
- matched or not. If they did, that is, if subject started
- with an opening parenthesis, the condition is true, and so
- the yes-pattern is executed and a closing parenthesis is
- required. Otherwise, since no-pattern is not present, the
- subpattern matches nothing. In other words, this pattern
- matches a sequence of non-parentheses, optionally enclosed
- in parentheses.
-
- If the condition is not a sequence of digits, it must be an
- assertion. This may be a positive or negative lookahead or
- lookbehind assertion. Consider this pattern, again contain-
- ing non-significant white space, and with the two alterna-
- tives on the second line:
-
- (?(?=[^a-z]*[a-z])
- \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} )
-
- The condition is a positive lookahead assertion that matches
- an optional sequence of non-letters followed by a letter. In
- other words, it tests for the presence of at least one
- letter in the subject. If a letter is found, the subject is
- matched against the first alternative; otherwise it is
- matched against the second. This pattern matches strings in
- one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are
- letters and dd are digits.
-
-
-
-COMMENTS
- The sequence (?# marks the start of a comment which contin-
- ues up to the next closing parenthesis. Nested parentheses
- are not permitted. The characters that make up a comment
- play no part in the pattern matching at all.
-
- If the PCRE_EXTENDED option is set, an unescaped # character
- outside a character class introduces a comment that contin-
- ues up to the next newline character in the pattern.
-
-
-
-RECURSIVE PATTERNS
- Consider the problem of matching a string in parentheses,
- allowing for unlimited nested parentheses. Without the use
- of recursion, the best that can be done is to use a pattern
- that matches up to some fixed depth of nesting. It is not
- possible to handle an arbitrary nesting depth. Perl 5.6 has
- provided an experimental facility that allows regular
- expressions to recurse (amongst other things). It does this
- by interpolating Perl code in the expression at run time,
- and the code can refer to the expression itself. A Perl pat-
- tern to solve the parentheses problem can be created like
- this:
-
- $re = qr{\( (?: (?>[^()]+) | (?p{$re}) )* \)}x;
-
- The (?p{...}) item interpolates Perl code at run time, and
- in this case refers recursively to the pattern in which it
- appears. Obviously, PCRE cannot support the interpolation of
- Perl code. Instead, the special item (?R) is provided for
- the specific case of recursion. This PCRE pattern solves the
- parentheses problem (assume the PCRE_EXTENDED option is set
- so that white space is ignored):
-
- \( ( (?>[^()]+) | (?R) )* \)
-
- First it matches an opening parenthesis. Then it matches any
- number of substrings which can either be a sequence of non-
- parentheses, or a recursive match of the pattern itself
- (i.e. a correctly parenthesized substring). Finally there is
- a closing parenthesis.
-
- This particular example pattern contains nested unlimited
- repeats, and so the use of a once-only subpattern for match-
- ing strings of non-parentheses is important when applying
- the pattern to strings that do not match. For example, when
- it is applied to
-
- (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
-
- it yields "no match" quickly. However, if a once-only sub-
- pattern is not used, the match runs for a very long time
- indeed because there are so many different ways the + and *
- repeats can carve up the subject, and all have to be tested
- before failure can be reported.
-
- The values set for any capturing subpatterns are those from
- the outermost level of the recursion at which the subpattern
- value is set. If the pattern above is matched against
-
- (ab(cd)ef)
-
- the value for the capturing parentheses is "ef", which is
- the last value taken on at the top level. If additional
- parentheses are added, giving
-
- \( ( ( (?>[^()]+) | (?R) )* ) \)
- ^ ^
- ^ ^ the string they capture is
- "ab(cd)ef", the contents of the top level parentheses. If
- there are more than 15 capturing parentheses in a pattern,
- PCRE has to obtain extra memory to store data during a
- recursion, which it does by using pcre_malloc, freeing it
- via pcre_free afterwards. If no memory can be obtained, it
- saves data for the first 15 capturing parentheses only, as
- there is no way to give an out-of-memory error from within a
- recursion.
-
-
-
-PERFORMANCE
- Certain items that may appear in patterns are more efficient
- than others. It is more efficient to use a character class
- like [aeiou] than a set of alternatives such as (a|e|i|o|u).
- In general, the simplest construction that provides the
- required behaviour is usually the most efficient. Jeffrey
- Friedl's book contains a lot of discussion about optimizing
- regular expressions for efficient performance.
-
- When a pattern begins with .* and the PCRE_DOTALL option is
- set, the pattern is implicitly anchored by PCRE, since it
- can match only at the start of a subject string. However, if
- PCRE_DOTALL is not set, PCRE cannot make this optimization,
- because the . metacharacter does not then match a newline,
- and if the subject string contains newlines, the pattern may
- match from the character immediately following one of them
- instead of from the very start. For example, the pattern
-
- (.*) second
-
- matches the subject "first\nand second" (where \n stands for
- a newline character) with the first captured substring being
- "and". In order to do this, PCRE has to retry the match
- starting after every newline in the subject.
-
- If you are using such a pattern with subject strings that do
- not contain newlines, the best performance is obtained by
- setting PCRE_DOTALL, or starting the pattern with ^.* to
- indicate explicit anchoring. That saves PCRE from having to
- scan along the subject looking for a newline to restart at.
-
- Beware of patterns that contain nested indefinite repeats.
- These can take a long time to run when applied to a string
- that does not match. Consider the pattern fragment
-
- (a+)*
-
- This can match "aaaa" in 33 different ways, and this number
- increases very rapidly as the string gets longer. (The *
- repeat can match 0, 1, 2, 3, or 4 times, and for each of
- those cases other than 0, the + repeats can match different
- numbers of times.) When the remainder of the pattern is such
- that the entire match is going to fail, PCRE has in princi-
- ple to try every possible variation, and this can take an
- extremely long time.
-
- An optimization catches some of the more simple cases such
- as
-
- (a+)*b
-
- where a literal character follows. Before embarking on the
- standard matching procedure, PCRE checks that there is a "b"
- later in the subject string, and if there is not, it fails
- the match immediately. However, when there is no following
- literal this optimization cannot be used. You can see the
- difference by comparing the behaviour of
-
- (a+)*\d
-
- with the pattern above. The former gives a failure almost
- instantly when applied to a whole line of "a" characters,
- whereas the latter takes an appreciable time with strings
- longer than about 20 characters.
-
-
-
-UTF-8 SUPPORT
- Starting at release 3.3, PCRE has some support for character
- strings encoded in the UTF-8 format. This is incomplete, and
- is regarded as experimental. In order to use it, you must
- configure PCRE to include UTF-8 support in the code, and, in
- addition, you must call pcre_compile() with the PCRE_UTF8
- option flag. When you do this, both the pattern and any sub-
- ject strings that are matched against it are treated as
- UTF-8 strings instead of just strings of bytes, but only in
- the cases that are mentioned below.
-
- If you compile PCRE with UTF-8 support, but do not use it at
- run time, the library will be a bit bigger, but the addi-
- tional run time overhead is limited to testing the PCRE_UTF8
- flag in several places, so should not be very large.
-
- PCRE assumes that the strings it is given contain valid
- UTF-8 codes. It does not diagnose invalid UTF-8 strings. If
- you pass invalid UTF-8 strings to PCRE, the results are
- undefined.
- Running with PCRE_UTF8 set causes these changes in the way
- PCRE works:
-
- 1. In a pattern, the escape sequence \x{...}, where the con-
- tents of the braces is a string of hexadecimal digits, is
- interpreted as a UTF-8 character whose code number is the
- given hexadecimal number, for example: \x{1234}. This
- inserts from one to six literal bytes into the pattern,
- using the UTF-8 encoding. If a non-hexadecimal digit appears
- between the braces, the item is not recognized.
-
- 2. The original hexadecimal escape sequence, \xhh, generates
- a two-byte UTF-8 character if its value is greater than 127.
-
- 3. Repeat quantifiers are NOT correctly handled if they fol-
- low a multibyte character. For example, \x{100}* and \xc3+
- do not work. If you want to repeat such characters, you must
- enclose them in non-capturing parentheses, for example
- (?:\x{100}), at present.
-
- 4. The dot metacharacter matches one UTF-8 character instead
- of a single byte.
-
- 5. Unlike literal UTF-8 characters, the dot metacharacter
- followed by a repeat quantifier does operate correctly on
- UTF-8 characters instead of single bytes.
-
- 4. Although the \x{...} escape is permitted in a character
- class, characters whose values are greater than 255 cannot
- be included in a class.
-
- 5. A class is matched against a UTF-8 character instead of
- just a single byte, but it can match only characters whose
- values are less than 256. Characters with greater values
- always fail to match a class.
-
- 6. Repeated classes work correctly on multiple characters.
-
- 7. Classes containing just a single character whose value is
- greater than 127 (but less than 256), for example, [\x80] or
- [^\x{93}], do not work because these are optimized into sin-
- gle byte matches. In the first case, of course, the class
- brackets are just redundant.
-
- 8. Lookbehind assertions move backwards in the subject by a
- fixed number of characters instead of a fixed number of
- bytes. Simple cases have been tested to work correctly, but
- there may be hidden gotchas herein.
-
- 9. The character types such as \d and \w do not work
- correctly with UTF-8 characters. They continue to test a
- single byte.
- 10. Anything not explicitly mentioned here continues to work
- in bytes rather than in characters.
-
- The following UTF-8 features of Perl 5.6 are not imple-
- mented:
-
- 1. The escape sequence \C to match a single byte.
-
- 2. The use of Unicode tables and properties and escapes \p,
- \P, and \X.
-
-
-
-SAMPLE PROGRAM
- The code below is a simple, complete demonstration program,
- to get you started with using PCRE. This code is also sup-
- plied in the file pcredemo.c in the PCRE distribution.
-
- The program compiles the regular expression that is its
- first argument, and matches it against the subject string in
- its second argument. No options are set, and default charac-
- ter tables are used. If matching succeeds, the program out-
- puts the portion of the subject that matched, together with
- the contents of any captured substrings.
-
- On a Unix system that has PCRE installed in /usr/local, you
- can compile the demonstration program using a command like
- this:
-
- gcc -o pcredemo pcredemo.c -I/usr/local/include
- -L/usr/local/lib -lpcre
-
- Then you can run simple tests like this:
-
- ./pcredemo 'cat|dog' 'the cat sat on the mat'
-
- Note that there is a much more comprehensive test program,
- called pcretest, which supports many more facilities for
- testing regular expressions. The pcredemo program is pro-
- vided as a simple coding example.
-
- On some operating systems (e.g. Solaris) you may get an
- error like this when you try to run pcredemo:
-
- ld.so.1: a.out: fatal: libpcre.so.0: open failed: No such
- file or directory
-
- This is caused by the way shared library support works on
- those systems. You need to add
-
- -R/usr/local/lib
-
- to the compile command to get round this problem. Here's the
- code:
-
- #include <stdio.h>
- #include <string.h>
- #include <pcre.h>
-
- #define OVECCOUNT 30 /* should be a multiple of 3 */
-
- int main(int argc, char **argv)
- {
- pcre *re;
- const char *error;
- int erroffset;
- int ovector[OVECCOUNT];
- int rc, i;
-
- if (argc != 3)
- {
- printf("Two arguments required: a regex and a "
- "subject string\n");
- return 1;
- }
-
- /* Compile the regular expression in the first argument */
-
- re = pcre_compile(
- argv[1], /* the pattern */
- 0, /* default options */
- &error, /* for error message */
- &erroffset, /* for error offset */
- NULL); /* use default character tables */
-
- /* Compilation failed: print the error message and exit */
-
- if (re == NULL)
- {
- printf("PCRE compilation failed at offset %d: %s\n",
- erroffset, error);
- return 1;
- }
-
- /* Compilation succeeded: match the subject in the second
- argument */
-
- rc = pcre_exec(
- re, /* the compiled pattern */
- NULL, /* we didn't study the pattern */
- argv[2], /* the subject string */
- (int)strlen(argv[2]), /* the length of the subject */
- 0, /* start at offset 0 in the subject */
- 0, /* default options */
- ovector, /* vector for substring information */
- OVECCOUNT); /* number of elements in the vector */
-
- /* Matching failed: handle error cases */
-
- if (rc < 0)
- {
- switch(rc)
- {
- case PCRE_ERROR_NOMATCH: printf("No match\n"); break;
- /*
- Handle other special cases if you like
- */
- default: printf("Matching error %d\n", rc); break;
- }
- return 1;
- }
-
- /* Match succeded */
-
- printf("Match succeeded\n");
-
- /* The output vector wasn't big enough */
-
- if (rc == 0)
- {
- rc = OVECCOUNT/3;
- printf("ovector only has room for %d captured "
- substrings\n", rc - 1);
- }
-
- /* Show substrings stored in the output vector */
-
- for (i = 0; i < rc; i++)
- {
- char *substring_start = argv[2] + ovector[2*i];
- int substring_length = ovector[2*i+1] - ovector[2*i];
- printf("%2d: %.*s\n", i, substring_length,
- substring_start);
- }
-
- return 0;
- }
-
-
-
-AUTHOR
- Philip Hazel <ph10@cam.ac.uk>
- University Computing Service,
- New Museums Site,
- Cambridge CB2 3QG, England.
- Phone: +44 1223 334714
- Last updated: 15 August 2001
- Copyright (c) 1997-2001 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcregrep.1 b/ext/pcre/pcrelib/doc/pcregrep.1
deleted file mode 100644
index b55745aca8..0000000000
--- a/ext/pcre/pcrelib/doc/pcregrep.1
+++ /dev/null
@@ -1,92 +0,0 @@
-.TH PCREGREP 1
-.SH NAME
-pcregrep - a grep with Perl-compatible regular expressions.
-.SH SYNOPSIS
-.B pcregrep [-Vcfhilnrsvx] [pattern] [file1 file2 ...]
-
-
-.SH DESCRIPTION
-\fBpcregrep\fR searches files for character patterns, in the same way as other
-grep commands do, but it uses the PCRE regular expression library to support
-patterns that are compatible with the regular expressions of Perl 5. See
-\fBpcre(3)\fR for a full description of syntax and semantics.
-
-A pattern must be specified on the command line unless the \fB-f\fR option is
-used (see below).
-
-If no files are specified, \fBpcregrep\fR reads the standard input. By default,
-each line that matches the pattern is copied to the standard output, and if
-there is more than one file, the file name is printed before each line of
-output. However, there are options that can change how \fBpcregrep\fR behaves.
-
-Lines are limited to BUFSIZ characters. BUFSIZ is defined in \fB<stdio.h>\fR.
-The newline character is removed from the end of each line before it is matched
-against the pattern.
-
-
-.SH OPTIONS
-.TP 10
-\fB-V\fR
-Write the version number of the PCRE library being used to the standard error
-stream.
-.TP
-\fB-c\fR
-Do not print individual lines; instead just print a count of the number of
-lines that would otherwise have been printed. If several files are given, a
-count is printed for each of them.
-.TP
-\fB-f\fIfilename\fR Read a number of patterns from the file, one per line, and
-match all of them against each line of input. A line is output if any of the
-patterns match it. When \fB-f\fR is used, no pattern is taken from the command
-line; all arguments are treated as file names. There is a maximum of 100
-patterns. Trailing white space is removed, and blank lines are ignored. An
-empty file contains no patterns and therefore matches nothing.
-.TP
-\fB-h\fR
-Suppress printing of filenames when searching multiple files.
-.TP
-\fB-i\fR
-Ignore upper/lower case distinctions during comparisons.
-.TP
-\fB-l\fR
-Instead of printing lines from the files, just print the names of the files
-containing lines that would have been printed. Each file name is printed
-once, on a separate line.
-.TP
-\fB-n\fR
-Precede each line by its line number in the file.
-.TP
-\fB-r\fR
-If any file is a directory, recursively scan the files it contains. Without
-\fB-r\fR a directory is scanned as a normal file.
-.TP
-\fB-s\fR
-Work silently, that is, display nothing except error messages.
-The exit status indicates whether any matches were found.
-.TP
-\fB-v\fR
-Invert the sense of the match, so that lines which do \fInot\fR match the
-pattern are now the ones that are found.
-.TP
-\fB-x\fR
-Force the pattern to be anchored (it must start matching at the beginning of
-the line) and in addition, require it to match the entire line. This is
-equivalent to having ^ and $ characters at the start and end of each
-alternative branch in the regular expression.
-
-
-.SH SEE ALSO
-\fBpcre(3)\fR, Perl 5 documentation
-
-
-.SH DIAGNOSTICS
-Exit status is 0 if any matches were found, 1 if no matches were found, and 2
-for syntax errors or inacessible files (even if matches were found).
-
-
-.SH AUTHOR
-Philip Hazel <ph10@cam.ac.uk>
-
-Last updated: 25 July 2002
-.br
-Copyright (c) 1997-2002 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcregrep.html b/ext/pcre/pcrelib/doc/pcregrep.html
deleted file mode 100644
index 20151d4a08..0000000000
--- a/ext/pcre/pcrelib/doc/pcregrep.html
+++ /dev/null
@@ -1,125 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>pcregrep specification</TITLE>
-</HEAD>
-<body bgcolor="#FFFFFF" text="#00005A">
-<H1>pcregrep specification</H1>
-This HTML document has been generated automatically from the original man page.
-If there is any nonsense in it, please consult the man page in case the
-conversion went wrong.
-<UL>
-<LI><A NAME="TOC1" HREF="#SEC1">NAME</A>
-<LI><A NAME="TOC2" HREF="#SEC2">SYNOPSIS</A>
-<LI><A NAME="TOC3" HREF="#SEC3">DESCRIPTION</A>
-<LI><A NAME="TOC4" HREF="#SEC4">OPTIONS</A>
-<LI><A NAME="TOC5" HREF="#SEC5">SEE ALSO</A>
-<LI><A NAME="TOC6" HREF="#SEC6">DIAGNOSTICS</A>
-<LI><A NAME="TOC7" HREF="#SEC7">AUTHOR</A>
-</UL>
-<LI><A NAME="SEC1" HREF="#TOC1">NAME</A>
-<P>
-pcregrep - a grep with Perl-compatible regular expressions.
-</P>
-<LI><A NAME="SEC2" HREF="#TOC1">SYNOPSIS</A>
-<P>
-<B>pcregrep [-Vcfhilnrsvx] [pattern] [file1 file2 ...]</B>
-</P>
-<LI><A NAME="SEC3" HREF="#TOC1">DESCRIPTION</A>
-<P>
-<B>pcregrep</B> searches files for character patterns, in the same way as other
-grep commands do, but it uses the PCRE regular expression library to support
-patterns that are compatible with the regular expressions of Perl 5. See
-<B>pcre(3)</B> for a full description of syntax and semantics.
-</P>
-<P>
-A pattern must be specified on the command line unless the <B>-f</B> option is
-used (see below).
-</P>
-<P>
-If no files are specified, <B>pcregrep</B> reads the standard input. By default,
-each line that matches the pattern is copied to the standard output, and if
-there is more than one file, the file name is printed before each line of
-output. However, there are options that can change how <B>pcregrep</B> behaves.
-</P>
-<P>
-Lines are limited to BUFSIZ characters. BUFSIZ is defined in <B>&#60;stdio.h&#62;</B>.
-The newline character is removed from the end of each line before it is matched
-against the pattern.
-</P>
-<LI><A NAME="SEC4" HREF="#TOC1">OPTIONS</A>
-<P>
-<B>-V</B>
-Write the version number of the PCRE library being used to the standard error
-stream.
-</P>
-<P>
-<B>-c</B>
-Do not print individual lines; instead just print a count of the number of
-lines that would otherwise have been printed. If several files are given, a
-count is printed for each of them.
-</P>
-<P>
-\fB-f<I>filename</I> Read a number of patterns from the file, one per line, and
-match all of them against each line of input. A line is output if any of the
-patterns match it. When <B>-f</B> is used, no pattern is taken from the command
-line; all arguments are treated as file names. There is a maximum of 100
-patterns. Trailing white space is removed, and blank lines are ignored. An
-empty file contains no patterns and therefore matches nothing.
-</P>
-<P>
-<B>-h</B>
-Suppress printing of filenames when searching multiple files.
-</P>
-<P>
-<B>-i</B>
-Ignore upper/lower case distinctions during comparisons.
-</P>
-<P>
-<B>-l</B>
-Instead of printing lines from the files, just print the names of the files
-containing lines that would have been printed. Each file name is printed
-once, on a separate line.
-</P>
-<P>
-<B>-n</B>
-Precede each line by its line number in the file.
-</P>
-<P>
-<B>-r</B>
-If any file is a directory, recursively scan the files it contains. Without
-<B>-r</B> a directory is scanned as a normal file.
-</P>
-<P>
-<B>-s</B>
-Work silently, that is, display nothing except error messages.
-The exit status indicates whether any matches were found.
-</P>
-<P>
-<B>-v</B>
-Invert the sense of the match, so that lines which do <I>not</I> match the
-pattern are now the ones that are found.
-</P>
-<P>
-<B>-x</B>
-Force the pattern to be anchored (it must start matching at the beginning of
-the line) and in addition, require it to match the entire line. This is
-equivalent to having ^ and $ characters at the start and end of each
-alternative branch in the regular expression.
-</P>
-<LI><A NAME="SEC5" HREF="#TOC1">SEE ALSO</A>
-<P>
-<B>pcre(3)</B>, Perl 5 documentation
-</P>
-<LI><A NAME="SEC6" HREF="#TOC1">DIAGNOSTICS</A>
-<P>
-Exit status is 0 if any matches were found, 1 if no matches were found, and 2
-for syntax errors or inacessible files (even if matches were found).
-</P>
-<LI><A NAME="SEC7" HREF="#TOC1">AUTHOR</A>
-<P>
-Philip Hazel &#60;ph10@cam.ac.uk&#62;
-</P>
-<P>
-Last updated: 25 July 2002
-<BR>
-Copyright (c) 1997-2002 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcregrep.txt b/ext/pcre/pcrelib/doc/pcregrep.txt
deleted file mode 100644
index ce53f7a889..0000000000
--- a/ext/pcre/pcrelib/doc/pcregrep.txt
+++ /dev/null
@@ -1,109 +0,0 @@
-NAME
- pcregrep - a grep with Perl-compatible regular expressions.
-
-
-
-SYNOPSIS
- pcregrep [-Vcfhilnrsvx] [pattern] [file1 file2 ...]
-
-
-
-DESCRIPTION
- pcregrep searches files for character patterns, in the same
- way as other grep commands do, but it uses the PCRE regular
- expression library to support patterns that are compatible
- with the regular expressions of Perl 5. See pcre(3) for a
- full description of syntax and semantics.
-
- A pattern must be specified on the command line unless the
- -f option is used (see below).
-
- If no files are specified, pcregrep reads the standard
- input. By default, each line that matches the pattern is
- copied to the standard output, and if there is more than one
- file, the file name is printed before each line of output.
- However, there are options that can change how pcregrep
- behaves.
-
- Lines are limited to BUFSIZ characters. BUFSIZ is defined in
- <stdio.h>. The newline character is removed from the end of
- each line before it is matched against the pattern.
-
-
-
-OPTIONS
- -V Write the version number of the PCRE library being
- used to the standard error stream.
-
- -c Do not print individual lines; instead just print
- a count of the number of lines that would other-
- wise have been printed. If several files are
- given, a count is printed for each of them.
-
-
-
-and
- -
- ffilename Read a number of patterns from the file, one per line,
- match all of them against each line of input. A
- line is output if any of the patterns match it.
- When -f is used, no pattern is taken from the com-
- mand line; all arguments are treated as file
- names. There is a maximum of 100 patterns. Trail-
- ing white space is removed, and blank lines are
- ignored. An empty file contains no patterns and
- therefore matches nothing.
-
- -h Suppress printing of filenames when searching mul-
- tiple files.
-
- -i Ignore upper/lower case distinctions during com-
- parisons.
-
- -l Instead of printing lines from the files, just
- print the names of the files containing lines that
- would have been printed. Each file name is printed
- once, on a separate line.
-
- -n Precede each line by its line number in the file.
-
- -r If any file is a directory, recursively scan the
- files it contains. Without -r a directory is
- scanned as a normal file.
-
- -s Work silently, that is, display nothing except
- error messages. The exit status indicates whether
- any matches were found.
-
- -v Invert the sense of the match, so that lines which
- do not match the pattern are now the ones that are
- found.
-
- -x Force the pattern to be anchored (it must start
- matching at the beginning of the line) and in
- addition, require it to match the entire line.
- This is equivalent to having ^ and $ characters at
- the start and end of each alternative branch in
- the regular expression.
-
-
-
-SEE ALSO
- pcre(3), Perl 5 documentation
-
-
-
-
-
-DIAGNOSTICS
- Exit status is 0 if any matches were found, 1 if no matches
- were found, and 2 for syntax errors or inacessible files
- (even if matches were found).
-
-
-
-AUTHOR
- Philip Hazel <ph10@cam.ac.uk>
-
- Last updated: 25 July 2002
- Copyright (c) 1997-2002 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcreposix.3 b/ext/pcre/pcrelib/doc/pcreposix.3
deleted file mode 100644
index 41716ead91..0000000000
--- a/ext/pcre/pcrelib/doc/pcreposix.3
+++ /dev/null
@@ -1,149 +0,0 @@
-.TH PCRE 3
-.SH NAME
-pcreposix - POSIX API for Perl-compatible regular expressions.
-.SH SYNOPSIS
-.B #include <pcreposix.h>
-.PP
-.SM
-.br
-.B int regcomp(regex_t *\fIpreg\fR, const char *\fIpattern\fR,
-.ti +5n
-.B int \fIcflags\fR);
-.PP
-.br
-.B int regexec(regex_t *\fIpreg\fR, const char *\fIstring\fR,
-.ti +5n
-.B size_t \fInmatch\fR, regmatch_t \fIpmatch\fR[], int \fIeflags\fR);
-.PP
-.br
-.B size_t regerror(int \fIerrcode\fR, const regex_t *\fIpreg\fR,
-.ti +5n
-.B char *\fIerrbuf\fR, size_t \fIerrbuf_size\fR);
-.PP
-.br
-.B void regfree(regex_t *\fIpreg\fR);
-
-
-.SH DESCRIPTION
-This set of functions provides a POSIX-style API to the PCRE regular expression
-package. See the \fBpcre\fR documentation for a description of the native API,
-which contains additional functionality.
-
-The functions described here are just wrapper functions that ultimately call
-the native API. Their prototypes are defined in the \fBpcreposix.h\fR header
-file, and on Unix systems the library itself is called \fBpcreposix.a\fR, so
-can be accessed by adding \fB-lpcreposix\fR to the command for linking an
-application which uses them. Because the POSIX functions call the native ones,
-it is also necessary to add \fR-lpcre\fR.
-
-I have implemented only those option bits that can be reasonably mapped to PCRE
-native options. In addition, the options REG_EXTENDED and REG_NOSUB are defined
-with the value zero. They have no effect, but since programs that are written
-to the POSIX interface often use them, this makes it easier to slot in PCRE as
-a replacement library. Other POSIX options are not even defined.
-
-When PCRE is called via these functions, it is only the API that is POSIX-like
-in style. The syntax and semantics of the regular expressions themselves are
-still those of Perl, subject to the setting of various PCRE options, as
-described below.
-
-The header for these functions is supplied as \fBpcreposix.h\fR to avoid any
-potential clash with other POSIX libraries. It can, of course, be renamed or
-aliased as \fBregex.h\fR, which is the "correct" name. It provides two
-structure types, \fIregex_t\fR for compiled internal forms, and
-\fIregmatch_t\fR for returning captured substrings. It also defines some
-constants whose names start with "REG_"; these are used for setting options and
-identifying error codes.
-
-
-.SH COMPILING A PATTERN
-
-The function \fBregcomp()\fR is called to compile a pattern into an
-internal form. The pattern is a C string terminated by a binary zero, and
-is passed in the argument \fIpattern\fR. The \fIpreg\fR argument is a pointer
-to a regex_t structure which is used as a base for storing information about
-the compiled expression.
-
-The argument \fIcflags\fR is either zero, or contains one or more of the bits
-defined by the following macros:
-
- REG_ICASE
-
-The PCRE_CASELESS option is set when the expression is passed for compilation
-to the native function.
-
- REG_NEWLINE
-
-The PCRE_MULTILINE option is set when the expression is passed for compilation
-to the native function.
-
-In the absence of these flags, no options are passed to the native function.
-This means the the regex is compiled with PCRE default semantics. In
-particular, the way it handles newline characters in the subject string is the
-Perl way, not the POSIX way. Note that setting PCRE_MULTILINE has only
-\fIsome\fR of the effects specified for REG_NEWLINE. It does not affect the way
-newlines are matched by . (they aren't) or a negative class such as [^a] (they
-are).
-
-The yield of \fBregcomp()\fR is zero on success, and non-zero otherwise. The
-\fIpreg\fR structure is filled in on success, and one member of the structure
-is publicized: \fIre_nsub\fR contains the number of capturing subpatterns in
-the regular expression. Various error codes are defined in the header file.
-
-
-.SH MATCHING A PATTERN
-The function \fBregexec()\fR is called to match a pre-compiled pattern
-\fIpreg\fR against a given \fIstring\fR, which is terminated by a zero byte,
-subject to the options in \fIeflags\fR. These can be:
-
- REG_NOTBOL
-
-The PCRE_NOTBOL option is set when calling the underlying PCRE matching
-function.
-
- REG_NOTEOL
-
-The PCRE_NOTEOL option is set when calling the underlying PCRE matching
-function.
-
-The portion of the string that was matched, and also any captured substrings,
-are returned via the \fIpmatch\fR argument, which points to an array of
-\fInmatch\fR structures of type \fIregmatch_t\fR, containing the members
-\fIrm_so\fR and \fIrm_eo\fR. These contain the offset to the first character of
-each substring and the offset to the first character after the end of each
-substring, respectively. The 0th element of the vector relates to the entire
-portion of \fIstring\fR that was matched; subsequent elements relate to the
-capturing subpatterns of the regular expression. Unused entries in the array
-have both structure members set to -1.
-
-A successful match yields a zero return; various error codes are defined in the
-header file, of which REG_NOMATCH is the "expected" failure code.
-
-
-.SH ERROR MESSAGES
-The \fBregerror()\fR function maps a non-zero errorcode from either
-\fBregcomp\fR or \fBregexec\fR to a printable message. If \fIpreg\fR is not
-NULL, the error should have arisen from the use of that structure. A message
-terminated by a binary zero is placed in \fIerrbuf\fR. The length of the
-message, including the zero, is limited to \fIerrbuf_size\fR. The yield of the
-function is the size of buffer needed to hold the whole message.
-
-
-.SH STORAGE
-Compiling a regular expression causes memory to be allocated and associated
-with the \fIpreg\fR structure. The function \fBregfree()\fR frees all such
-memory, after which \fIpreg\fR may no longer be used as a compiled expression.
-
-
-.SH AUTHOR
-Philip Hazel <ph10@cam.ac.uk>
-.br
-University Computing Service,
-.br
-New Museums Site,
-.br
-Cambridge CB2 3QG, England.
-.br
-Phone: +44 1223 334714
-
-Copyright (c) 1997-2000 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcreposix.html b/ext/pcre/pcrelib/doc/pcreposix.html
deleted file mode 100644
index 9c89478420..0000000000
--- a/ext/pcre/pcrelib/doc/pcreposix.html
+++ /dev/null
@@ -1,191 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>pcreposix specification</TITLE>
-</HEAD>
-<body bgcolor="#FFFFFF" text="#00005A">
-<H1>pcreposix specification</H1>
-This HTML document has been generated automatically from the original man page.
-If there is any nonsense in it, please consult the man page in case the
-conversion went wrong.
-<UL>
-<LI><A NAME="TOC1" HREF="#SEC1">NAME</A>
-<LI><A NAME="TOC2" HREF="#SEC2">SYNOPSIS</A>
-<LI><A NAME="TOC3" HREF="#SEC3">DESCRIPTION</A>
-<LI><A NAME="TOC4" HREF="#SEC4">COMPILING A PATTERN</A>
-<LI><A NAME="TOC5" HREF="#SEC5">MATCHING A PATTERN</A>
-<LI><A NAME="TOC6" HREF="#SEC6">ERROR MESSAGES</A>
-<LI><A NAME="TOC7" HREF="#SEC7">STORAGE</A>
-<LI><A NAME="TOC8" HREF="#SEC8">AUTHOR</A>
-</UL>
-<LI><A NAME="SEC1" HREF="#TOC1">NAME</A>
-<P>
-pcreposix - POSIX API for Perl-compatible regular expressions.
-</P>
-<LI><A NAME="SEC2" HREF="#TOC1">SYNOPSIS</A>
-<P>
-<B>#include &#60;pcreposix.h&#62;</B>
-</P>
-<P>
-<B>int regcomp(regex_t *<I>preg</I>, const char *<I>pattern</I>,</B>
-<B>int <I>cflags</I>);</B>
-</P>
-<P>
-<B>int regexec(regex_t *<I>preg</I>, const char *<I>string</I>,</B>
-<B>size_t <I>nmatch</I>, regmatch_t <I>pmatch</I>[], int <I>eflags</I>);</B>
-</P>
-<P>
-<B>size_t regerror(int <I>errcode</I>, const regex_t *<I>preg</I>,</B>
-<B>char *<I>errbuf</I>, size_t <I>errbuf_size</I>);</B>
-</P>
-<P>
-<B>void regfree(regex_t *<I>preg</I>);</B>
-</P>
-<LI><A NAME="SEC3" HREF="#TOC1">DESCRIPTION</A>
-<P>
-This set of functions provides a POSIX-style API to the PCRE regular expression
-package. See the <B>pcre</B> documentation for a description of the native API,
-which contains additional functionality.
-</P>
-<P>
-The functions described here are just wrapper functions that ultimately call
-the native API. Their prototypes are defined in the <B>pcreposix.h</B> header
-file, and on Unix systems the library itself is called <B>pcreposix.a</B>, so
-can be accessed by adding <B>-lpcreposix</B> to the command for linking an
-application which uses them. Because the POSIX functions call the native ones,
-it is also necessary to add \fR-lpcre\fR.
-</P>
-<P>
-I have implemented only those option bits that can be reasonably mapped to PCRE
-native options. In addition, the options REG_EXTENDED and REG_NOSUB are defined
-with the value zero. They have no effect, but since programs that are written
-to the POSIX interface often use them, this makes it easier to slot in PCRE as
-a replacement library. Other POSIX options are not even defined.
-</P>
-<P>
-When PCRE is called via these functions, it is only the API that is POSIX-like
-in style. The syntax and semantics of the regular expressions themselves are
-still those of Perl, subject to the setting of various PCRE options, as
-described below.
-</P>
-<P>
-The header for these functions is supplied as <B>pcreposix.h</B> to avoid any
-potential clash with other POSIX libraries. It can, of course, be renamed or
-aliased as <B>regex.h</B>, which is the "correct" name. It provides two
-structure types, <I>regex_t</I> for compiled internal forms, and
-<I>regmatch_t</I> for returning captured substrings. It also defines some
-constants whose names start with "REG_"; these are used for setting options and
-identifying error codes.
-</P>
-<LI><A NAME="SEC4" HREF="#TOC1">COMPILING A PATTERN</A>
-<P>
-The function <B>regcomp()</B> is called to compile a pattern into an
-internal form. The pattern is a C string terminated by a binary zero, and
-is passed in the argument <I>pattern</I>. The <I>preg</I> argument is a pointer
-to a regex_t structure which is used as a base for storing information about
-the compiled expression.
-</P>
-<P>
-The argument <I>cflags</I> is either zero, or contains one or more of the bits
-defined by the following macros:
-</P>
-<P>
-<PRE>
- REG_ICASE
-</PRE>
-</P>
-<P>
-The PCRE_CASELESS option is set when the expression is passed for compilation
-to the native function.
-</P>
-<P>
-<PRE>
- REG_NEWLINE
-</PRE>
-</P>
-<P>
-The PCRE_MULTILINE option is set when the expression is passed for compilation
-to the native function.
-</P>
-<P>
-In the absence of these flags, no options are passed to the native function.
-This means the the regex is compiled with PCRE default semantics. In
-particular, the way it handles newline characters in the subject string is the
-Perl way, not the POSIX way. Note that setting PCRE_MULTILINE has only
-<I>some</I> of the effects specified for REG_NEWLINE. It does not affect the way
-newlines are matched by . (they aren't) or a negative class such as [^a] (they
-are).
-</P>
-<P>
-The yield of <B>regcomp()</B> is zero on success, and non-zero otherwise. The
-<I>preg</I> structure is filled in on success, and one member of the structure
-is publicized: <I>re_nsub</I> contains the number of capturing subpatterns in
-the regular expression. Various error codes are defined in the header file.
-</P>
-<LI><A NAME="SEC5" HREF="#TOC1">MATCHING A PATTERN</A>
-<P>
-The function <B>regexec()</B> is called to match a pre-compiled pattern
-<I>preg</I> against a given <I>string</I>, which is terminated by a zero byte,
-subject to the options in <I>eflags</I>. These can be:
-</P>
-<P>
-<PRE>
- REG_NOTBOL
-</PRE>
-</P>
-<P>
-The PCRE_NOTBOL option is set when calling the underlying PCRE matching
-function.
-</P>
-<P>
-<PRE>
- REG_NOTEOL
-</PRE>
-</P>
-<P>
-The PCRE_NOTEOL option is set when calling the underlying PCRE matching
-function.
-</P>
-<P>
-The portion of the string that was matched, and also any captured substrings,
-are returned via the <I>pmatch</I> argument, which points to an array of
-<I>nmatch</I> structures of type <I>regmatch_t</I>, containing the members
-<I>rm_so</I> and <I>rm_eo</I>. These contain the offset to the first character of
-each substring and the offset to the first character after the end of each
-substring, respectively. The 0th element of the vector relates to the entire
-portion of <I>string</I> that was matched; subsequent elements relate to the
-capturing subpatterns of the regular expression. Unused entries in the array
-have both structure members set to -1.
-</P>
-<P>
-A successful match yields a zero return; various error codes are defined in the
-header file, of which REG_NOMATCH is the "expected" failure code.
-</P>
-<LI><A NAME="SEC6" HREF="#TOC1">ERROR MESSAGES</A>
-<P>
-The <B>regerror()</B> function maps a non-zero errorcode from either
-<B>regcomp</B> or <B>regexec</B> to a printable message. If <I>preg</I> is not
-NULL, the error should have arisen from the use of that structure. A message
-terminated by a binary zero is placed in <I>errbuf</I>. The length of the
-message, including the zero, is limited to <I>errbuf_size</I>. The yield of the
-function is the size of buffer needed to hold the whole message.
-</P>
-<LI><A NAME="SEC7" HREF="#TOC1">STORAGE</A>
-<P>
-Compiling a regular expression causes memory to be allocated and associated
-with the <I>preg</I> structure. The function <B>regfree()</B> frees all such
-memory, after which <I>preg</I> may no longer be used as a compiled expression.
-</P>
-<LI><A NAME="SEC8" HREF="#TOC1">AUTHOR</A>
-<P>
-Philip Hazel &#60;ph10@cam.ac.uk&#62;
-<BR>
-University Computing Service,
-<BR>
-New Museums Site,
-<BR>
-Cambridge CB2 3QG, England.
-<BR>
-Phone: +44 1223 334714
-</P>
-<P>
-Copyright (c) 1997-2000 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcreposix.txt b/ext/pcre/pcrelib/doc/pcreposix.txt
deleted file mode 100644
index 2d76f7cdcc..0000000000
--- a/ext/pcre/pcrelib/doc/pcreposix.txt
+++ /dev/null
@@ -1,159 +0,0 @@
-NAME
- pcreposix - POSIX API for Perl-compatible regular expres-
- sions.
-
-
-
-SYNOPSIS
- #include <pcreposix.h>
-
- int regcomp(regex_t *preg, const char *pattern,
- int cflags);
-
- int regexec(regex_t *preg, const char *string,
- size_t nmatch, regmatch_t pmatch[], int eflags);
-
- size_t regerror(int errcode, const regex_t *preg,
- char *errbuf, size_t errbuf_size);
-
- void regfree(regex_t *preg);
-
-
-
-DESCRIPTION
- This set of functions provides a POSIX-style API to the PCRE
- regular expression package. See the pcre documentation for a
- description of the native API, which contains additional
- functionality.
-
- The functions described here are just wrapper functions that
- ultimately call the native API. Their prototypes are defined
- in the pcreposix.h header file, and on Unix systems the
- library itself is called pcreposix.a, so can be accessed by
- adding -lpcreposix to the command for linking an application
- which uses them. Because the POSIX functions call the native
- ones, it is also necessary to add -lpcre.
-
- I have implemented only those option bits that can be rea-
- sonably mapped to PCRE native options. In addition, the
- options REG_EXTENDED and REG_NOSUB are defined with the
- value zero. They have no effect, but since programs that are
- written to the POSIX interface often use them, this makes it
- easier to slot in PCRE as a replacement library. Other POSIX
- options are not even defined.
-
- When PCRE is called via these functions, it is only the API
- that is POSIX-like in style. The syntax and semantics of the
- regular expressions themselves are still those of Perl, sub-
- ject to the setting of various PCRE options, as described
- below.
-
- The header for these functions is supplied as pcreposix.h to
- avoid any potential clash with other POSIX libraries. It
- can, of course, be renamed or aliased as regex.h, which is
- the "correct" name. It provides two structure types, regex_t
- for compiled internal forms, and regmatch_t for returning
- captured substrings. It also defines some constants whose
- names start with "REG_"; these are used for setting options
- and identifying error codes.
-
-
-
-COMPILING A PATTERN
- The function regcomp() is called to compile a pattern into
- an internal form. The pattern is a C string terminated by a
- binary zero, and is passed in the argument pattern. The preg
- argument is a pointer to a regex_t structure which is used
- as a base for storing information about the compiled expres-
- sion.
-
- The argument cflags is either zero, or contains one or more
- of the bits defined by the following macros:
-
- REG_ICASE
-
- The PCRE_CASELESS option is set when the expression is
- passed for compilation to the native function.
-
- REG_NEWLINE
-
- The PCRE_MULTILINE option is set when the expression is
- passed for compilation to the native function.
-
- In the absence of these flags, no options are passed to the
- native function. This means the the regex is compiled with
- PCRE default semantics. In particular, the way it handles
- newline characters in the subject string is the Perl way,
- not the POSIX way. Note that setting PCRE_MULTILINE has only
- some of the effects specified for REG_NEWLINE. It does not
- affect the way newlines are matched by . (they aren't) or a
- negative class such as [^a] (they are).
-
- The yield of regcomp() is zero on success, and non-zero oth-
- erwise. The preg structure is filled in on success, and one
- member of the structure is publicized: re_nsub contains the
- number of capturing subpatterns in the regular expression.
- Various error codes are defined in the header file.
-
-
-
-MATCHING A PATTERN
- The function regexec() is called to match a pre-compiled
- pattern preg against a given string, which is terminated by
- a zero byte, subject to the options in eflags. These can be:
-
- REG_NOTBOL
-
- The PCRE_NOTBOL option is set when calling the underlying
- PCRE matching function.
-
- REG_NOTEOL
-
- The PCRE_NOTEOL option is set when calling the underlying
- PCRE matching function.
-
- The portion of the string that was matched, and also any
- captured substrings, are returned via the pmatch argument,
- which points to an array of nmatch structures of type
- regmatch_t, containing the members rm_so and rm_eo. These
- contain the offset to the first character of each substring
- and the offset to the first character after the end of each
- substring, respectively. The 0th element of the vector
- relates to the entire portion of string that was matched;
- subsequent elements relate to the capturing subpatterns of
- the regular expression. Unused entries in the array have
- both structure members set to -1.
-
- A successful match yields a zero return; various error codes
- are defined in the header file, of which REG_NOMATCH is the
- "expected" failure code.
-
-
-
-ERROR MESSAGES
- The regerror() function maps a non-zero errorcode from
- either regcomp or regexec to a printable message. If preg is
- not NULL, the error should have arisen from the use of that
- structure. A message terminated by a binary zero is placed
- in errbuf. The length of the message, including the zero, is
- limited to errbuf_size. The yield of the function is the
- size of buffer needed to hold the whole message.
-
-
-
-STORAGE
- Compiling a regular expression causes memory to be allocated
- and associated with the preg structure. The function reg-
- free() frees all such memory, after which preg may no longer
- be used as a compiled expression.
-
-
-
-AUTHOR
- Philip Hazel <ph10@cam.ac.uk>
- University Computing Service,
- New Museums Site,
- Cambridge CB2 3QG, England.
- Phone: +44 1223 334714
-
- Copyright (c) 1997-2000 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcretest.1 b/ext/pcre/pcrelib/doc/pcretest.1
deleted file mode 100644
index 02afe7a49d..0000000000
--- a/ext/pcre/pcrelib/doc/pcretest.1
+++ /dev/null
@@ -1,288 +0,0 @@
-.TH PCRETEST 1
-.SH NAME
-pcretest - a program for testing Perl-compatible regular expressions.
-.SH SYNOPSIS
-.B pcretest "[-d] [-i] [-m] [-o osize] [-p] [-t] [source] [destination]"
-
-\fBpcretest\fR was written as a test program for the PCRE regular expression
-library itself, but it can also be used for experimenting with regular
-expressions. This man page describes the features of the test program; for
-details of the regular expressions themselves, see the \fBpcre\fR man page.
-
-.SH OPTIONS
-.TP 10
-\fB-d\fR
-Behave as if each regex had the \fB/D\fR modifier (see below); the internal
-form is output after compilation.
-.TP 10
-\fB-i\fR
-Behave as if each regex had the \fB/I\fR modifier; information about the
-compiled pattern is given after compilation.
-.TP 10
-\fB-m\fR
-Output the size of each compiled pattern after it has been compiled. This is
-equivalent to adding /M to each regular expression. For compatibility with
-earlier versions of pcretest, \fB-s\fR is a synonym for \fB-m\fR.
-.TP 10
-\fB-o\fR \fIosize\fR
-Set the number of elements in the output vector that is used when calling PCRE
-to be \fIosize\fR. The default value is 45, which is enough for 14 capturing
-subexpressions. The vector size can be changed for individual matching calls by
-including \\O in the data line (see below).
-.TP 10
-\fB-p\fR
-Behave as if each regex has \fB/P\fR modifier; the POSIX wrapper API is used
-to call PCRE. None of the other options has any effect when \fB-p\fR is set.
-.TP 10
-\fB-t\fR
-Run each compile, study, and match many times with a timer, and output
-resulting time per compile or match (in milliseconds). Do not set \fB-t\fR with
-\fB-m\fR, because you will then get the size output 20000 times and the timing
-will be distorted.
-
-
-.SH DESCRIPTION
-
-If \fBpcretest\fR is given two filename arguments, it reads from the first and
-writes to the second. If it is given only one filename argument, it reads from
-that file and writes to stdout. Otherwise, it reads from stdin and writes to
-stdout, and prompts for each line of input, using "re>" to prompt for regular
-expressions, and "data>" to prompt for data lines.
-
-The program handles any number of sets of input on a single input file. Each
-set starts with a regular expression, and continues with any number of data
-lines to be matched against the pattern.
-
-Each line is matched separately and independently. If you want to do
-multiple-line matches, you have to use the \\n escape sequence in a single line
-of input to encode the newline characters. The maximum length of data line is
-30,000 characters.
-
-An empty line signals the end of the data lines, at which point a new regular
-expression is read. The regular expressions are given enclosed in any
-non-alphameric delimiters other than backslash, for example
-
- /(a|bc)x+yz/
-
-White space before the initial delimiter is ignored. A regular expression may
-be continued over several input lines, in which case the newline characters are
-included within it. It is possible to include the delimiter within the pattern
-by escaping it, for example
-
- /abc\\/def/
-
-If you do so, the escape and the delimiter form part of the pattern, but since
-delimiters are always non-alphameric, this does not affect its interpretation.
-If the terminating delimiter is immediately followed by a backslash, for
-example,
-
- /abc/\\
-
-then a backslash is added to the end of the pattern. This is done to provide a
-way of testing the error condition that arises if a pattern finishes with a
-backslash, because
-
- /abc\\/
-
-is interpreted as the first line of a pattern that starts with "abc/", causing
-pcretest to read the next line as a continuation of the regular expression.
-
-
-.SH PATTERN MODIFIERS
-
-The pattern may be followed by \fBi\fR, \fBm\fR, \fBs\fR, or \fBx\fR to set the
-PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, or PCRE_EXTENDED options,
-respectively. For example:
-
- /caseless/i
-
-These modifier letters have the same effect as they do in Perl. There are
-others which set PCRE options that do not correspond to anything in Perl:
-\fB/A\fR, \fB/E\fR, and \fB/X\fR set PCRE_ANCHORED, PCRE_DOLLAR_ENDONLY, and
-PCRE_EXTRA respectively.
-
-Searching for all possible matches within each subject string can be requested
-by the \fB/g\fR or \fB/G\fR modifier. After finding a match, PCRE is called
-again to search the remainder of the subject string. The difference between
-\fB/g\fR and \fB/G\fR is that the former uses the \fIstartoffset\fR argument to
-\fBpcre_exec()\fR to start searching at a new point within the entire string
-(which is in effect what Perl does), whereas the latter passes over a shortened
-substring. This makes a difference to the matching process if the pattern
-begins with a lookbehind assertion (including \\b or \\B).
-
-If any call to \fBpcre_exec()\fR in a \fB/g\fR or \fB/G\fR sequence matches an
-empty string, the next call is done with the PCRE_NOTEMPTY and PCRE_ANCHORED
-flags set in order to search for another, non-empty, match at the same point.
-If this second match fails, the start offset is advanced by one, and the normal
-match is retried. This imitates the way Perl handles such cases when using the
-\fB/g\fR modifier or the \fBsplit()\fR function.
-
-There are a number of other modifiers for controlling the way \fBpcretest\fR
-operates.
-
-The \fB/+\fR modifier requests that as well as outputting the substring that
-matched the entire pattern, pcretest should in addition output the remainder of
-the subject string. This is useful for tests where the subject contains
-multiple copies of the same substring.
-
-The \fB/L\fR modifier must be followed directly by the name of a locale, for
-example,
-
- /pattern/Lfr
-
-For this reason, it must be the last modifier letter. The given locale is set,
-\fBpcre_maketables()\fR is called to build a set of character tables for the
-locale, and this is then passed to \fBpcre_compile()\fR when compiling the
-regular expression. Without an \fB/L\fR modifier, NULL is passed as the tables
-pointer; that is, \fB/L\fR applies only to the expression on which it appears.
-
-The \fB/I\fR modifier requests that \fBpcretest\fR output information about the
-compiled expression (whether it is anchored, has a fixed first character, and
-so on). It does this by calling \fBpcre_fullinfo()\fR after compiling an
-expression, and outputting the information it gets back. If the pattern is
-studied, the results of that are also output.
-
-The \fB/D\fR modifier is a PCRE debugging feature, which also assumes \fB/I\fR.
-It causes the internal form of compiled regular expressions to be output after
-compilation.
-
-The \fB/S\fR modifier causes \fBpcre_study()\fR to be called after the
-expression has been compiled, and the results used when the expression is
-matched.
-
-The \fB/M\fR modifier causes the size of memory block used to hold the compiled
-pattern to be output.
-
-The \fB/P\fR modifier causes \fBpcretest\fR to call PCRE via the POSIX wrapper
-API rather than its native API. When this is done, all other modifiers except
-\fB/i\fR, \fB/m\fR, and \fB/+\fR are ignored. REG_ICASE is set if \fB/i\fR is
-present, and REG_NEWLINE is set if \fB/m\fR is present. The wrapper functions
-force PCRE_DOLLAR_ENDONLY always, and PCRE_DOTALL unless REG_NEWLINE is set.
-
-The \fB/8\fR modifier causes \fBpcretest\fR to call PCRE with the PCRE_UTF8
-option set. This turns on the (currently incomplete) support for UTF-8
-character handling in PCRE, provided that it was compiled with this support
-enabled. This modifier also causes any non-printing characters in output
-strings to be printed using the \\x{hh...} notation if they are valid UTF-8
-sequences.
-
-
-.SH DATA LINES
-
-Before each data line is passed to \fBpcre_exec()\fR, leading and trailing
-whitespace is removed, and it is then scanned for \\ escapes. The following are
-recognized:
-
- \\a alarm (= BEL)
- \\b backspace
- \\e escape
- \\f formfeed
- \\n newline
- \\r carriage return
- \\t tab
- \\v vertical tab
- \\nnn octal character (up to 3 octal digits)
- \\xhh hexadecimal character (up to 2 hex digits)
- \\x{hh...} hexadecimal UTF-8 character
-
- \\A pass the PCRE_ANCHORED option to \fBpcre_exec()\fR
- \\B pass the PCRE_NOTBOL option to \fBpcre_exec()\fR
- \\Cdd call pcre_copy_substring() for substring dd
- after a successful match (any decimal number
- less than 32)
- \\Gdd call pcre_get_substring() for substring dd
- after a successful match (any decimal number
- less than 32)
- \\L call pcre_get_substringlist() after a
- successful match
- \\N pass the PCRE_NOTEMPTY option to \fBpcre_exec()\fR
- \\Odd set the size of the output vector passed to
- \fBpcre_exec()\fR to dd (any number of decimal
- digits)
- \\Z pass the PCRE_NOTEOL option to \fBpcre_exec()\fR
-
-When \\O is used, it may be higher or lower than the size set by the \fB-O\fR
-option (or defaulted to 45); \\O applies only to the call of \fBpcre_exec()\fR
-for the line in which it appears.
-
-A backslash followed by anything else just escapes the anything else. If the
-very last character is a backslash, it is ignored. This gives a way of passing
-an empty line as data, since a real empty line terminates the data input.
-
-If \fB/P\fR was present on the regex, causing the POSIX wrapper API to be used,
-only \fB\B\fR, and \fB\Z\fR have any effect, causing REG_NOTBOL and REG_NOTEOL
-to be passed to \fBregexec()\fR respectively.
-
-The use of \\x{hh...} to represent UTF-8 characters is not dependent on the use
-of the \fB/8\fR modifier on the pattern. It is recognized always. There may be
-any number of hexadecimal digits inside the braces. The result is from one to
-six bytes, encoded according to the UTF-8 rules.
-
-
-.SH OUTPUT FROM PCRETEST
-
-When a match succeeds, pcretest outputs the list of captured substrings that
-\fBpcre_exec()\fR returns, starting with number 0 for the string that matched
-the whole pattern. Here is an example of an interactive pcretest run.
-
- $ pcretest
- PCRE version 2.06 08-Jun-1999
-
- re> /^abc(\\d+)/
- data> abc123
- 0: abc123
- 1: 123
- data> xyz
- No match
-
-If the strings contain any non-printing characters, they are output as \\0x
-escapes, or as \\x{...} escapes if the \fB/8\fR modifier was present on the
-pattern. If the pattern has the \fB/+\fR modifier, then the output for
-substring 0 is followed by the the rest of the subject string, identified by
-"0+" like this:
-
- re> /cat/+
- data> cataract
- 0: cat
- 0+ aract
-
-If the pattern has the \fB/g\fR or \fB/G\fR modifier, the results of successive
-matching attempts are output in sequence, like this:
-
- re> /\\Bi(\\w\\w)/g
- data> Mississippi
- 0: iss
- 1: ss
- 0: iss
- 1: ss
- 0: ipp
- 1: pp
-
-"No match" is output only if the first match attempt fails.
-
-If any of the sequences \fB\\C\fR, \fB\\G\fR, or \fB\\L\fR are present in a
-data line that is successfully matched, the substrings extracted by the
-convenience functions are output with C, G, or L after the string number
-instead of a colon. This is in addition to the normal full list. The string
-length (that is, the return from the extraction function) is given in
-parentheses after each string for \fB\\C\fR and \fB\\G\fR.
-
-Note that while patterns can be continued over several lines (a plain ">"
-prompt is used for continuations), data lines may not. However newlines can be
-included in data by means of the \\n escape.
-
-
-.SH AUTHOR
-Philip Hazel <ph10@cam.ac.uk>
-.br
-University Computing Service,
-.br
-New Museums Site,
-.br
-Cambridge CB2 3QG, England.
-.br
-Phone: +44 1223 334714
-
-Last updated: 25 August 2002
-.br
-Copyright (c) 1997-2002 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcretest.html b/ext/pcre/pcrelib/doc/pcretest.html
deleted file mode 100644
index cec1214420..0000000000
--- a/ext/pcre/pcrelib/doc/pcretest.html
+++ /dev/null
@@ -1,377 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>pcretest specification</TITLE>
-</HEAD>
-<body bgcolor="#FFFFFF" text="#00005A">
-<H1>pcretest specification</H1>
-This HTML document has been generated automatically from the original man page.
-If there is any nonsense in it, please consult the man page in case the
-conversion went wrong.
-<UL>
-<LI><A NAME="TOC1" HREF="#SEC1">NAME</A>
-<LI><A NAME="TOC2" HREF="#SEC2">SYNOPSIS</A>
-<LI><A NAME="TOC3" HREF="#SEC3">OPTIONS</A>
-<LI><A NAME="TOC4" HREF="#SEC4">DESCRIPTION</A>
-<LI><A NAME="TOC5" HREF="#SEC5">PATTERN MODIFIERS</A>
-<LI><A NAME="TOC6" HREF="#SEC6">DATA LINES</A>
-<LI><A NAME="TOC7" HREF="#SEC7">OUTPUT FROM PCRETEST</A>
-<LI><A NAME="TOC8" HREF="#SEC8">AUTHOR</A>
-</UL>
-<LI><A NAME="SEC1" HREF="#TOC1">NAME</A>
-<P>
-pcretest - a program for testing Perl-compatible regular expressions.
-</P>
-<LI><A NAME="SEC2" HREF="#TOC1">SYNOPSIS</A>
-<P>
-<B>pcretest [-d] [-i] [-m] [-o osize] [-p] [-t] [source] [destination]</B>
-</P>
-<P>
-<B>pcretest</B> was written as a test program for the PCRE regular expression
-library itself, but it can also be used for experimenting with regular
-expressions. This man page describes the features of the test program; for
-details of the regular expressions themselves, see the <B>pcre</B> man page.
-</P>
-<LI><A NAME="SEC3" HREF="#TOC1">OPTIONS</A>
-<P>
-<B>-d</B>
-Behave as if each regex had the <B>/D</B> modifier (see below); the internal
-form is output after compilation.
-</P>
-<P>
-<B>-i</B>
-Behave as if each regex had the <B>/I</B> modifier; information about the
-compiled pattern is given after compilation.
-</P>
-<P>
-<B>-m</B>
-Output the size of each compiled pattern after it has been compiled. This is
-equivalent to adding /M to each regular expression. For compatibility with
-earlier versions of pcretest, <B>-s</B> is a synonym for <B>-m</B>.
-</P>
-<P>
-<B>-o</B> <I>osize</I>
-Set the number of elements in the output vector that is used when calling PCRE
-to be <I>osize</I>. The default value is 45, which is enough for 14 capturing
-subexpressions. The vector size can be changed for individual matching calls by
-including \O in the data line (see below).
-</P>
-<P>
-<B>-p</B>
-Behave as if each regex has <B>/P</B> modifier; the POSIX wrapper API is used
-to call PCRE. None of the other options has any effect when <B>-p</B> is set.
-</P>
-<P>
-<B>-t</B>
-Run each compile, study, and match many times with a timer, and output
-resulting time per compile or match (in milliseconds). Do not set <B>-t</B> with
-<B>-m</B>, because you will then get the size output 20000 times and the timing
-will be distorted.
-</P>
-<LI><A NAME="SEC4" HREF="#TOC1">DESCRIPTION</A>
-<P>
-If <B>pcretest</B> is given two filename arguments, it reads from the first and
-writes to the second. If it is given only one filename argument, it reads from
-that file and writes to stdout. Otherwise, it reads from stdin and writes to
-stdout, and prompts for each line of input, using "re&#62;" to prompt for regular
-expressions, and "data&#62;" to prompt for data lines.
-</P>
-<P>
-The program handles any number of sets of input on a single input file. Each
-set starts with a regular expression, and continues with any number of data
-lines to be matched against the pattern.
-</P>
-<P>
-Each line is matched separately and independently. If you want to do
-multiple-line matches, you have to use the \n escape sequence in a single line
-of input to encode the newline characters. The maximum length of data line is
-30,000 characters.
-</P>
-<P>
-An empty line signals the end of the data lines, at which point a new regular
-expression is read. The regular expressions are given enclosed in any
-non-alphameric delimiters other than backslash, for example
-</P>
-<P>
-<PRE>
- /(a|bc)x+yz/
-</PRE>
-</P>
-<P>
-White space before the initial delimiter is ignored. A regular expression may
-be continued over several input lines, in which case the newline characters are
-included within it. It is possible to include the delimiter within the pattern
-by escaping it, for example
-</P>
-<P>
-<PRE>
- /abc\/def/
-</PRE>
-</P>
-<P>
-If you do so, the escape and the delimiter form part of the pattern, but since
-delimiters are always non-alphameric, this does not affect its interpretation.
-If the terminating delimiter is immediately followed by a backslash, for
-example,
-</P>
-<P>
-<PRE>
- /abc/\
-</PRE>
-</P>
-<P>
-then a backslash is added to the end of the pattern. This is done to provide a
-way of testing the error condition that arises if a pattern finishes with a
-backslash, because
-</P>
-<P>
-<PRE>
- /abc\/
-</PRE>
-</P>
-<P>
-is interpreted as the first line of a pattern that starts with "abc/", causing
-pcretest to read the next line as a continuation of the regular expression.
-</P>
-<LI><A NAME="SEC5" HREF="#TOC1">PATTERN MODIFIERS</A>
-<P>
-The pattern may be followed by <B>i</B>, <B>m</B>, <B>s</B>, or <B>x</B> to set the
-PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, or PCRE_EXTENDED options,
-respectively. For example:
-</P>
-<P>
-<PRE>
- /caseless/i
-</PRE>
-</P>
-<P>
-These modifier letters have the same effect as they do in Perl. There are
-others which set PCRE options that do not correspond to anything in Perl:
-<B>/A</B>, <B>/E</B>, and <B>/X</B> set PCRE_ANCHORED, PCRE_DOLLAR_ENDONLY, and
-PCRE_EXTRA respectively.
-</P>
-<P>
-Searching for all possible matches within each subject string can be requested
-by the <B>/g</B> or <B>/G</B> modifier. After finding a match, PCRE is called
-again to search the remainder of the subject string. The difference between
-<B>/g</B> and <B>/G</B> is that the former uses the <I>startoffset</I> argument to
-<B>pcre_exec()</B> to start searching at a new point within the entire string
-(which is in effect what Perl does), whereas the latter passes over a shortened
-substring. This makes a difference to the matching process if the pattern
-begins with a lookbehind assertion (including \b or \B).
-</P>
-<P>
-If any call to <B>pcre_exec()</B> in a <B>/g</B> or <B>/G</B> sequence matches an
-empty string, the next call is done with the PCRE_NOTEMPTY and PCRE_ANCHORED
-flags set in order to search for another, non-empty, match at the same point.
-If this second match fails, the start offset is advanced by one, and the normal
-match is retried. This imitates the way Perl handles such cases when using the
-<B>/g</B> modifier or the <B>split()</B> function.
-</P>
-<P>
-There are a number of other modifiers for controlling the way <B>pcretest</B>
-operates.
-</P>
-<P>
-The <B>/+</B> modifier requests that as well as outputting the substring that
-matched the entire pattern, pcretest should in addition output the remainder of
-the subject string. This is useful for tests where the subject contains
-multiple copies of the same substring.
-</P>
-<P>
-The <B>/L</B> modifier must be followed directly by the name of a locale, for
-example,
-</P>
-<P>
-<PRE>
- /pattern/Lfr
-</PRE>
-</P>
-<P>
-For this reason, it must be the last modifier letter. The given locale is set,
-<B>pcre_maketables()</B> is called to build a set of character tables for the
-locale, and this is then passed to <B>pcre_compile()</B> when compiling the
-regular expression. Without an <B>/L</B> modifier, NULL is passed as the tables
-pointer; that is, <B>/L</B> applies only to the expression on which it appears.
-</P>
-<P>
-The <B>/I</B> modifier requests that <B>pcretest</B> output information about the
-compiled expression (whether it is anchored, has a fixed first character, and
-so on). It does this by calling <B>pcre_fullinfo()</B> after compiling an
-expression, and outputting the information it gets back. If the pattern is
-studied, the results of that are also output.
-</P>
-<P>
-The <B>/D</B> modifier is a PCRE debugging feature, which also assumes <B>/I</B>.
-It causes the internal form of compiled regular expressions to be output after
-compilation.
-</P>
-<P>
-The <B>/S</B> modifier causes <B>pcre_study()</B> to be called after the
-expression has been compiled, and the results used when the expression is
-matched.
-</P>
-<P>
-The <B>/M</B> modifier causes the size of memory block used to hold the compiled
-pattern to be output.
-</P>
-<P>
-The <B>/P</B> modifier causes <B>pcretest</B> to call PCRE via the POSIX wrapper
-API rather than its native API. When this is done, all other modifiers except
-<B>/i</B>, <B>/m</B>, and <B>/+</B> are ignored. REG_ICASE is set if <B>/i</B> is
-present, and REG_NEWLINE is set if <B>/m</B> is present. The wrapper functions
-force PCRE_DOLLAR_ENDONLY always, and PCRE_DOTALL unless REG_NEWLINE is set.
-</P>
-<P>
-The <B>/8</B> modifier causes <B>pcretest</B> to call PCRE with the PCRE_UTF8
-option set. This turns on the (currently incomplete) support for UTF-8
-character handling in PCRE, provided that it was compiled with this support
-enabled. This modifier also causes any non-printing characters in output
-strings to be printed using the \x{hh...} notation if they are valid UTF-8
-sequences.
-</P>
-<LI><A NAME="SEC6" HREF="#TOC1">DATA LINES</A>
-<P>
-Before each data line is passed to <B>pcre_exec()</B>, leading and trailing
-whitespace is removed, and it is then scanned for \ escapes. The following are
-recognized:
-</P>
-<P>
-<PRE>
- \a alarm (= BEL)
- \b backspace
- \e escape
- \f formfeed
- \n newline
- \r carriage return
- \t tab
- \v vertical tab
- \nnn octal character (up to 3 octal digits)
- \xhh hexadecimal character (up to 2 hex digits)
- \x{hh...} hexadecimal UTF-8 character
-</PRE>
-</P>
-<P>
-<PRE>
- \A pass the PCRE_ANCHORED option to <B>pcre_exec()</B>
- \B pass the PCRE_NOTBOL option to <B>pcre_exec()</B>
- \Cdd call pcre_copy_substring() for substring dd
- after a successful match (any decimal number
- less than 32)
- \Gdd call pcre_get_substring() for substring dd
- after a successful match (any decimal number
- less than 32)
- \L call pcre_get_substringlist() after a
- successful match
- \N pass the PCRE_NOTEMPTY option to <B>pcre_exec()</B>
- \Odd set the size of the output vector passed to
- <B>pcre_exec()</B> to dd (any number of decimal
- digits)
- \Z pass the PCRE_NOTEOL option to <B>pcre_exec()</B>
-</PRE>
-</P>
-<P>
-When \O is used, it may be higher or lower than the size set by the <B>-O</B>
-option (or defaulted to 45); \O applies only to the call of <B>pcre_exec()</B>
-for the line in which it appears.
-</P>
-<P>
-A backslash followed by anything else just escapes the anything else. If the
-very last character is a backslash, it is ignored. This gives a way of passing
-an empty line as data, since a real empty line terminates the data input.
-</P>
-<P>
-If <B>/P</B> was present on the regex, causing the POSIX wrapper API to be used,
-only <B>\B</B>, and <B>\Z</B> have any effect, causing REG_NOTBOL and REG_NOTEOL
-to be passed to <B>regexec()</B> respectively.
-</P>
-<P>
-The use of \x{hh...} to represent UTF-8 characters is not dependent on the use
-of the <B>/8</B> modifier on the pattern. It is recognized always. There may be
-any number of hexadecimal digits inside the braces. The result is from one to
-six bytes, encoded according to the UTF-8 rules.
-</P>
-<LI><A NAME="SEC7" HREF="#TOC1">OUTPUT FROM PCRETEST</A>
-<P>
-When a match succeeds, pcretest outputs the list of captured substrings that
-<B>pcre_exec()</B> returns, starting with number 0 for the string that matched
-the whole pattern. Here is an example of an interactive pcretest run.
-</P>
-<P>
-<PRE>
- $ pcretest
- PCRE version 2.06 08-Jun-1999
-</PRE>
-</P>
-<P>
-<PRE>
- re&#62; /^abc(\d+)/
- data&#62; abc123
- 0: abc123
- 1: 123
- data&#62; xyz
- No match
-</PRE>
-</P>
-<P>
-If the strings contain any non-printing characters, they are output as \0x
-escapes, or as \x{...} escapes if the <B>/8</B> modifier was present on the
-pattern. If the pattern has the <B>/+</B> modifier, then the output for
-substring 0 is followed by the the rest of the subject string, identified by
-"0+" like this:
-</P>
-<P>
-<PRE>
- re&#62; /cat/+
- data&#62; cataract
- 0: cat
- 0+ aract
-</PRE>
-</P>
-<P>
-If the pattern has the <B>/g</B> or <B>/G</B> modifier, the results of successive
-matching attempts are output in sequence, like this:
-</P>
-<P>
-<PRE>
- re&#62; /\Bi(\w\w)/g
- data&#62; Mississippi
- 0: iss
- 1: ss
- 0: iss
- 1: ss
- 0: ipp
- 1: pp
-</PRE>
-</P>
-<P>
-"No match" is output only if the first match attempt fails.
-</P>
-<P>
-If any of the sequences <B>\C</B>, <B>\G</B>, or <B>\L</B> are present in a
-data line that is successfully matched, the substrings extracted by the
-convenience functions are output with C, G, or L after the string number
-instead of a colon. This is in addition to the normal full list. The string
-length (that is, the return from the extraction function) is given in
-parentheses after each string for <B>\C</B> and <B>\G</B>.
-</P>
-<P>
-Note that while patterns can be continued over several lines (a plain "&#62;"
-prompt is used for continuations), data lines may not. However newlines can be
-included in data by means of the \n escape.
-</P>
-<LI><A NAME="SEC8" HREF="#TOC1">AUTHOR</A>
-<P>
-Philip Hazel &#60;ph10@cam.ac.uk&#62;
-<BR>
-University Computing Service,
-<BR>
-New Museums Site,
-<BR>
-Cambridge CB2 3QG, England.
-<BR>
-Phone: +44 1223 334714
-</P>
-<P>
-Last updated: 25 August 2002
-<BR>
-Copyright (c) 1997-2002 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcretest.txt b/ext/pcre/pcrelib/doc/pcretest.txt
deleted file mode 100644
index 54e989a83c..0000000000
--- a/ext/pcre/pcrelib/doc/pcretest.txt
+++ /dev/null
@@ -1,329 +0,0 @@
-NAME
- pcretest - a program for testing Perl-compatible regular
- expressions.
-
-
-
-SYNOPSIS
- pcretest [-d] [-i] [-m] [-o osize] [-p] [-t] [source] [des-
- tination]
-
- pcretest was written as a test program for the PCRE regular
- expression library itself, but it can also be used for
- experimenting with regular expressions. This man page
- describes the features of the test program; for details of
- the regular expressions themselves, see the pcre man page.
-
-
-
-OPTIONS
- -d Behave as if each regex had the /D modifier (see
- below); the internal form is output after compila-
- tion.
-
- -i Behave as if each regex had the /I modifier;
- information about the compiled pattern is given
- after compilation.
-
- -m Output the size of each compiled pattern after it
- has been compiled. This is equivalent to adding /M
- to each regular expression. For compatibility with
- earlier versions of pcretest, -s is a synonym for
- -m.
-
- -o osize Set the number of elements in the output vector
- that is used when calling PCRE to be osize. The
- default value is 45, which is enough for 14 cap-
- turing subexpressions. The vector size can be
- changed for individual matching calls by including
- \O in the data line (see below).
-
- -p Behave as if each regex has /P modifier; the POSIX
- wrapper API is used to call PCRE. None of the
- other options has any effect when -p is set.
-
- -t Run each compile, study, and match many times with
- a timer, and output resulting time per compile or
- match (in milliseconds). Do not set -t with -m,
- because you will then get the size output 20000
- times and the timing will be distorted.
-
-
-
-DESCRIPTION
- If pcretest is given two filename arguments, it reads from
- the first and writes to the second. If it is given only one
-
-
-
-
-SunOS 5.8 Last change: 1
-
-
-
- filename argument, it reads from that file and writes to
- stdout. Otherwise, it reads from stdin and writes to stdout,
- and prompts for each line of input, using "re>" to prompt
- for regular expressions, and "data>" to prompt for data
- lines.
-
- The program handles any number of sets of input on a single
- input file. Each set starts with a regular expression, and
- continues with any number of data lines to be matched
- against the pattern.
-
- Each line is matched separately and independently. If you
- want to do multiple-line matches, you have to use the \n
- escape sequence in a single line of input to encode the new-
- line characters. The maximum length of data line is 30,000
- characters.
-
- An empty line signals the end of the data lines, at which
- point a new regular expression is read. The regular expres-
- sions are given enclosed in any non-alphameric delimiters
- other than backslash, for example
-
- /(a|bc)x+yz/
-
- White space before the initial delimiter is ignored. A regu-
- lar expression may be continued over several input lines, in
- which case the newline characters are included within it. It
- is possible to include the delimiter within the pattern by
- escaping it, for example
-
- /abc\/def/
-
- If you do so, the escape and the delimiter form part of the
- pattern, but since delimiters are always non-alphameric,
- this does not affect its interpretation. If the terminating
- delimiter is immediately followed by a backslash, for exam-
- ple,
-
- /abc/\
-
- then a backslash is added to the end of the pattern. This is
- done to provide a way of testing the error condition that
- arises if a pattern finishes with a backslash, because
-
- /abc\/
-
- is interpreted as the first line of a pattern that starts
- with "abc/", causing pcretest to read the next line as a
- continuation of the regular expression.
-
-
-
-PATTERN MODIFIERS
- The pattern may be followed by i, m, s, or x to set the
- PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, or PCRE_EXTENDED
- options, respectively. For example:
-
- /caseless/i
-
- These modifier letters have the same effect as they do in
- Perl. There are others which set PCRE options that do not
- correspond to anything in Perl: /A, /E, and /X set
- PCRE_ANCHORED, PCRE_DOLLAR_ENDONLY, and PCRE_EXTRA respec-
- tively.
-
- Searching for all possible matches within each subject
- string can be requested by the /g or /G modifier. After
- finding a match, PCRE is called again to search the
- remainder of the subject string. The difference between /g
- and /G is that the former uses the startoffset argument to
- pcre_exec() to start searching at a new point within the
- entire string (which is in effect what Perl does), whereas
- the latter passes over a shortened substring. This makes a
- difference to the matching process if the pattern begins
- with a lookbehind assertion (including \b or \B).
-
- If any call to pcre_exec() in a /g or /G sequence matches an
- empty string, the next call is done with the PCRE_NOTEMPTY
- and PCRE_ANCHORED flags set in order to search for another,
- non-empty, match at the same point. If this second match
- fails, the start offset is advanced by one, and the normal
- match is retried. This imitates the way Perl handles such
- cases when using the /g modifier or the split() function.
-
- There are a number of other modifiers for controlling the
- way pcretest operates.
-
- The /+ modifier requests that as well as outputting the sub-
- string that matched the entire pattern, pcretest should in
- addition output the remainder of the subject string. This is
- useful for tests where the subject contains multiple copies
- of the same substring.
-
- The /L modifier must be followed directly by the name of a
- locale, for example,
-
- /pattern/Lfr
-
- For this reason, it must be the last modifier letter. The
- given locale is set, pcre_maketables() is called to build a
- set of character tables for the locale, and this is then
- passed to pcre_compile() when compiling the regular expres-
- sion. Without an /L modifier, NULL is passed as the tables
- pointer; that is, /L applies only to the expression on which
- it appears.
-
- The /I modifier requests that pcretest output information
- about the compiled expression (whether it is anchored, has a
- fixed first character, and so on). It does this by calling
- pcre_fullinfo() after compiling an expression, and output-
- ting the information it gets back. If the pattern is stu-
- died, the results of that are also output.
-
- The /D modifier is a PCRE debugging feature, which also
- assumes /I. It causes the internal form of compiled regular
- expressions to be output after compilation.
-
- The /S modifier causes pcre_study() to be called after the
- expression has been compiled, and the results used when the
- expression is matched.
-
- The /M modifier causes the size of memory block used to hold
- the compiled pattern to be output.
-
- The /P modifier causes pcretest to call PCRE via the POSIX
- wrapper API rather than its native API. When this is done,
- all other modifiers except /i, /m, and /+ are ignored.
- REG_ICASE is set if /i is present, and REG_NEWLINE is set if
- /m is present. The wrapper functions force
- PCRE_DOLLAR_ENDONLY always, and PCRE_DOTALL unless
- REG_NEWLINE is set.
-
- The /8 modifier causes pcretest to call PCRE with the
- PCRE_UTF8 option set. This turns on the (currently incom-
- plete) support for UTF-8 character handling in PCRE, pro-
- vided that it was compiled with this support enabled. This
- modifier also causes any non-printing characters in output
- strings to be printed using the \x{hh...} notation if they
- are valid UTF-8 sequences.
-
-
-
-DATA LINES
- Before each data line is passed to pcre_exec(), leading and
- trailing whitespace is removed, and it is then scanned for \
- escapes. The following are recognized:
-
- \a alarm (= BEL)
- \b backspace
- \e escape
- \f formfeed
- \n newline
- \r carriage return
- \t tab
- \v vertical tab
- \nnn octal character (up to 3 octal digits)
-
- hexadecimal character (up to 2 hex digits)
- \x{hh...} hexadecimal UTF-8 character
-
- \A pass the PCRE_ANCHORED option to pcre_exec()
- \B pass the PCRE_NOTBOL option to pcre_exec()
- \Cdd call pcre_copy_substring() for substring dd
- after a successful match (any decimal number
- less than 32)
- \Gdd call pcre_get_substring() for substring dd
- after a successful match (any decimal number
- less than 32)
- \L call pcre_get_substringlist() after a
- successful match
- \N pass the PCRE_NOTEMPTY option to pcre_exec()
- \Odd set the size of the output vector passed to
- pcre_exec() to dd (any number of decimal
- digits)
- \Z pass the PCRE_NOTEOL option to pcre_exec()
-
- When \O is used, it may be higher or lower than the size set
- by the -O option (or defaulted to 45); \O applies only to
- the call of pcre_exec() for the line in which it appears.
-
- A backslash followed by anything else just escapes the any-
- thing else. If the very last character is a backslash, it is
- ignored. This gives a way of passing an empty line as data,
- since a real empty line terminates the data input.
-
- If /P was present on the regex, causing the POSIX wrapper
- API to be used, only B, and Z have any effect, causing
- REG_NOTBOL and REG_NOTEOL to be passed to regexec() respec-
- tively.
-
- The use of \x{hh...} to represent UTF-8 characters is not
- dependent on the use of the /8 modifier on the pattern. It
- is recognized always. There may be any number of hexadecimal
- digits inside the braces. The result is from one to six
- bytes, encoded according to the UTF-8 rules.
-
-
-
-OUTPUT FROM PCRETEST
- When a match succeeds, pcretest outputs the list of captured
- substrings that pcre_exec() returns, starting with number 0
- for the string that matched the whole pattern. Here is an
- example of an interactive pcretest run.
-
- $ pcretest
- PCRE version 2.06 08-Jun-1999
-
- re> /^abc(\d+)/
- data> abc123
-
- 0: abc123
- 1: 123
- data> xyz
- No match
-
- If the strings contain any non-printing characters, they are
- output as \0x escapes, or as \x{...} escapes if the /8
- modifier was present on the pattern. If the pattern has the
- /+ modifier, then the output for substring 0 is followed by
- the the rest of the subject string, identified by "0+" like
- this:
-
- re> /cat/+
- data> cataract
- 0: cat
- 0+ aract
-
- If the pattern has the /g or /G modifier, the results of
- successive matching attempts are output in sequence, like
- this:
-
- re> /\Bi(\w\w)/g
- data> Mississippi
- 0: iss
- 1: ss
- 0: iss
- 1: ss
- 0: ipp
- 1: pp
-
- "No match" is output only if the first match attempt fails.
-
- If any of the sequences \C, \G, or \L are present in a data
- line that is successfully matched, the substrings extracted
- by the convenience functions are output with C, G, or L
- after the string number instead of a colon. This is in addi-
- tion to the normal full list. The string length (that is,
- the return from the extraction function) is given in
- parentheses after each string for \C and \G.
-
- Note that while patterns can be continued over several lines
- (a plain ">" prompt is used for continuations), data lines
- may not. However newlines can be included in data by means
- of the \n escape.
-
-
-
-AUTHOR
- Philip Hazel <ph10@cam.ac.uk>
- University Computing Service,
- New Museums Site,
- Cambridge CB2 3QG, England.
- Phone: +44 1223 334714
-
- Last updated: 25 August 2002
- Copyright (c) 1997-2002 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/perltest.txt b/ext/pcre/pcrelib/doc/perltest.txt
deleted file mode 100644
index 9ea9d932a5..0000000000
--- a/ext/pcre/pcrelib/doc/perltest.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-The perltest program
---------------------
-
-The perltest program tests Perl's regular expressions; it has the same
-specification as pcretest, and so can be given identical input, except that
-input patterns can be followed only by Perl's lower case modifiers and /+ (as
-used by pcretest), which is recognized and handled by the program.
-
-The data lines are processed as Perl double-quoted strings, so if they contain
-" \ $ or @ characters, these have to be escaped. For this reason, all such
-characters in testinput1 and testinput3 are escaped so that they can be used
-for perltest as well as for pcretest, and the special upper case modifiers such
-as /A that pcretest recognizes are not used in these files. The output should
-be identical, apart from the initial identifying banner.
-
-The perltest script can also test UTF-8 features. It works as is for Perl 5.8
-or higher. It recognizes the special modifier /8 that pcretest uses to invoke
-UTF-8 functionality. The testinput5 file can be fed to perltest to run UTF-8
-tests.
-
-For Perl 5.6, perltest won't work unmodified for the UTF-8 tests. You need to
-uncomment the "use utf8" lines that it contains. It is best to do this on a
-copy of the script, because for non-UTF-8 tests, these lines should remain
-commented out.
-
-The testinput2 and testinput4 files are not suitable for feeding to perltest,
-since they do make use of the special upper case modifiers and escapes that
-pcretest uses to test some features of PCRE. The first of these files also
-contains malformed regular expressions, in order to check that PCRE diagnoses
-them correctly. Similarly, testinput6 tests UTF-8 features that do not relate
-to Perl.
-
-Philip Hazel <ph10@cam.ac.uk>
-August 2002
diff --git a/ext/pcre/pcrelib/get.c b/ext/pcre/pcrelib/get.c
deleted file mode 100644
index 55e736dc24..0000000000
--- a/ext/pcre/pcrelib/get.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/*
-This is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language. See
-the file Tech.Notes for some information on the internals.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
- Copyright (c) 1997-2001 University of Cambridge
-
------------------------------------------------------------------------------
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
------------------------------------------------------------------------------
-*/
-
-/* This module contains some convenience functions for extracting substrings
-from the subject string after a regex match has succeeded. The original idea
-for these functions came from Scott Wimer <scottw@cgibuilder.com>. */
-
-
-/* Include the internals header, which itself includes Standard C headers plus
-the external pcre header. */
-
-#include "internal.h"
-
-
-
-/*************************************************
-* Copy captured string to given buffer *
-*************************************************/
-
-/* This function copies a single captured substring into a given buffer.
-Note that we use memcpy() rather than strncpy() in case there are binary zeros
-in the string.
-
-Arguments:
- subject the subject string that was matched
- ovector pointer to the offsets table
- stringcount the number of substrings that were captured
- (i.e. the yield of the pcre_exec call, unless
- that was zero, in which case it should be 1/3
- of the offset table size)
- stringnumber the number of the required substring
- buffer where to put the substring
- size the size of the buffer
-
-Returns: if successful:
- the length of the copied string, not including the zero
- that is put on the end; can be zero
- if not successful:
- PCRE_ERROR_NOMEMORY (-6) buffer too small
- PCRE_ERROR_NOSUBSTRING (-7) no such captured substring
-*/
-
-int
-pcre_copy_substring(const char *subject, int *ovector, int stringcount,
- int stringnumber, char *buffer, int size)
-{
-int yield;
-if (stringnumber < 0 || stringnumber >= stringcount)
- return PCRE_ERROR_NOSUBSTRING;
-stringnumber *= 2;
-yield = ovector[stringnumber+1] - ovector[stringnumber];
-if (size < yield + 1) return PCRE_ERROR_NOMEMORY;
-memcpy(buffer, subject + ovector[stringnumber], yield);
-buffer[yield] = 0;
-return yield;
-}
-
-
-
-/*************************************************
-* Copy all captured strings to new store *
-*************************************************/
-
-/* This function gets one chunk of store and builds a list of pointers and all
-of the captured substrings in it. A NULL pointer is put on the end of the list.
-
-Arguments:
- subject the subject string that was matched
- ovector pointer to the offsets table
- stringcount the number of substrings that were captured
- (i.e. the yield of the pcre_exec call, unless
- that was zero, in which case it should be 1/3
- of the offset table size)
- listptr set to point to the list of pointers
-
-Returns: if successful: 0
- if not successful:
- PCRE_ERROR_NOMEMORY (-6) failed to get store
-*/
-
-int
-pcre_get_substring_list(const char *subject, int *ovector, int stringcount,
- const char ***listptr)
-{
-int i;
-int size = sizeof(char *);
-int double_count = stringcount * 2;
-char **stringlist;
-char *p;
-
-for (i = 0; i < double_count; i += 2)
- size += sizeof(char *) + ovector[i+1] - ovector[i] + 1;
-
-stringlist = (char **)(pcre_malloc)(size);
-if (stringlist == NULL) return PCRE_ERROR_NOMEMORY;
-
-*listptr = (const char **)stringlist;
-p = (char *)(stringlist + stringcount + 1);
-
-for (i = 0; i < double_count; i += 2)
- {
- int len = ovector[i+1] - ovector[i];
- memcpy(p, subject + ovector[i], len);
- *stringlist++ = p;
- p += len;
- *p++ = 0;
- }
-
-*stringlist = NULL;
-return 0;
-}
-
-
-
-/*************************************************
-* Free store obtained by get_substring_list *
-*************************************************/
-
-/* This function exists for the benefit of people calling PCRE from non-C
-programs that can call its functions, but not free() or (pcre_free)() directly.
-
-Argument: the result of a previous pcre_get_substring_list()
-Returns: nothing
-*/
-
-void
-pcre_free_substring_list(const char **pointer)
-{
-(pcre_free)((void *)pointer);
-}
-
-
-
-/*************************************************
-* Copy captured string to new store *
-*************************************************/
-
-/* This function copies a single captured substring into a piece of new
-store
-
-Arguments:
- subject the subject string that was matched
- ovector pointer to the offsets table
- stringcount the number of substrings that were captured
- (i.e. the yield of the pcre_exec call, unless
- that was zero, in which case it should be 1/3
- of the offset table size)
- stringnumber the number of the required substring
- stringptr where to put a pointer to the substring
-
-Returns: if successful:
- the length of the string, not including the zero that
- is put on the end; can be zero
- if not successful:
- PCRE_ERROR_NOMEMORY (-6) failed to get store
- PCRE_ERROR_NOSUBSTRING (-7) substring not present
-*/
-
-int
-pcre_get_substring(const char *subject, int *ovector, int stringcount,
- int stringnumber, const char **stringptr)
-{
-int yield;
-char *substring;
-if (stringnumber < 0 || stringnumber >= stringcount)
- return PCRE_ERROR_NOSUBSTRING;
-stringnumber *= 2;
-yield = ovector[stringnumber+1] - ovector[stringnumber];
-substring = (char *)(pcre_malloc)(yield + 1);
-if (substring == NULL) return PCRE_ERROR_NOMEMORY;
-memcpy(substring, subject + ovector[stringnumber], yield);
-substring[yield] = 0;
-*stringptr = substring;
-return yield;
-}
-
-
-
-/*************************************************
-* Free store obtained by get_substring *
-*************************************************/
-
-/* This function exists for the benefit of people calling PCRE from non-C
-programs that can call its functions, but not free() or (pcre_free)() directly.
-
-Argument: the result of a previous pcre_get_substring()
-Returns: nothing
-*/
-
-void
-pcre_free_substring(const char *pointer)
-{
-(pcre_free)((void *)pointer);
-}
-
-/* End of get.c */
diff --git a/ext/pcre/pcrelib/internal.h b/ext/pcre/pcrelib/internal.h
deleted file mode 100644
index 2396668a33..0000000000
--- a/ext/pcre/pcrelib/internal.h
+++ /dev/null
@@ -1,632 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-
-/* This is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language. See
-the file Tech.Notes for some information on the internals.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
- Copyright (c) 1997-2003 University of Cambridge
-
------------------------------------------------------------------------------
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
------------------------------------------------------------------------------
-*/
-
-/* This header contains definitions that are shared between the different
-modules, but which are not relevant to the outside. */
-
-/* Get the definitions provided by running "configure" */
-
-#ifdef PHP_WIN32
-# include "config.w32.h"
-#elif defined(NETWARE)
-# include "config.nw.h"
-#else
-# include "php_config.h"
-#endif
-
-/* The value of NEWLINE determines the newline character. The default is to
-leave it up to the compiler, but some sites want to force a particular value.
-On Unix systems, "configure" can be used to override this default. */
-
-#ifndef NEWLINE
-#define NEWLINE '\n'
-#endif
-
-/* When compiling for use with the Virtual Pascal compiler, these functions
-need to have their names changed. PCRE must be compiled with the -DVPCOMPAT
-option on the command line. */
-
-#ifdef VPCOMPAT
-#define strncmp(s1,s2,m) _strncmp(s1,s2,m)
-#define memcpy(d,s,n) _memcpy(d,s,n)
-#define memmove(d,s,n) _memmove(d,s,n)
-#define memset(s,c,n) _memset(s,c,n)
-#else /* VPCOMPAT */
-
-/* To cope with SunOS4 and other systems that lack memmove() but have bcopy(),
-define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY
-is set. Otherwise, include an emulating function for those systems that have
-neither (there some non-Unix environments where this is the case). This assumes
-that all calls to memmove are moving strings upwards in store, which is the
-case in PCRE. */
-
-#if ! HAVE_MEMMOVE
-#undef memmove /* some systems may have a macro */
-#if HAVE_BCOPY
-#define memmove(a, b, c) bcopy(b, a, c)
-#else /* HAVE_BCOPY */
-void *
-pcre_memmove(unsigned char *dest, const unsigned char *src, size_t n)
-{
-int i;
-dest += n;
-src += n;
-for (i = 0; i < n; ++i) *(--dest) = *(--src);
-}
-#define memmove(a, b, c) pcre_memmove(a, b, c)
-#endif /* not HAVE_BCOPY */
-#endif /* not HAVE_MEMMOVE */
-#endif /* not VPCOMPAT */
-
-
-/* PCRE keeps offsets in its compiled code as 2-byte quantities by default.
-These are used, for example, to link from the start of a subpattern to its
-alternatives and its end. The use of 2 bytes per offset limits the size of the
-compiled regex to around 64K, which is big enough for almost everybody.
-However, I received a request for an even bigger limit. For this reason, and
-also to make the code easier to maintain, the storing and loading of offsets
-from the byte string is now handled by the macros that are defined here.
-
-The macros are controlled by the value of LINK_SIZE. This defaults to 2 in
-the config.h file, but can be overridden by using -D on the command line. This
-is automated on Unix systems via the "configure" command. */
-
-#if LINK_SIZE == 2
-
-#define PUT(a,n,d) \
- (a[n] = (d) >> 8), \
- (a[(n)+1] = (d) & 255)
-
-#define GET(a,n) \
- (((a)[n] << 8) | (a)[(n)+1])
-
-#define MAX_PATTERN_SIZE (1 << 16)
-
-
-#elif LINK_SIZE == 3
-
-#define PUT(a,n,d) \
- (a[n] = (d) >> 16), \
- (a[(n)+1] = (d) >> 8), \
- (a[(n)+2] = (d) & 255)
-
-#define GET(a,n) \
- (((a)[n] << 16) | ((a)[(n)+1] << 8) | (a)[(n)+2])
-
-#define MAX_PATTERN_SIZE (1 << 24)
-
-
-#elif LINK_SIZE == 4
-
-#define PUT(a,n,d) \
- (a[n] = (d) >> 24), \
- (a[(n)+1] = (d) >> 16), \
- (a[(n)+2] = (d) >> 8), \
- (a[(n)+3] = (d) & 255)
-
-#define GET(a,n) \
- (((a)[n] << 24) | ((a)[(n)+1] << 16) | ((a)[(n)+2] << 8) | (a)[(n)+3])
-
-#define MAX_PATTERN_SIZE (1 << 30) /* Keep it positive */
-
-
-#else
-#error LINK_SIZE must be either 2, 3, or 4
-#endif
-
-
-/* Convenience macro defined in terms of the others */
-
-#define PUTINC(a,n,d) PUT(a,n,d), a += LINK_SIZE
-
-
-/* PCRE uses some other 2-byte quantities that do not change when the size of
-offsets changes. There are used for repeat counts and for other things such as
-capturing parenthesis numbers in back references. */
-
-#define PUT2(a,n,d) \
- a[n] = (d) >> 8; \
- a[(n)+1] = (d) & 255
-
-#define GET2(a,n) \
- (((a)[n] << 8) | (a)[(n)+1])
-
-#define PUT2INC(a,n,d) PUT2(a,n,d), a += 2
-
-
-/* Standard C headers plus the external interface definition */
-
-#include <ctype.h>
-#include <limits.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "pcre.h"
-
-/* In case there is no definition of offsetof() provided - though any proper
-Standard C system should have one. */
-
-#ifndef offsetof
-#define offsetof(p_type,field) ((size_t)&(((p_type *)0)->field))
-#endif
-
-/* These are the public options that can change during matching. */
-
-#define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL)
-
-/* Private options flags start at the most significant end of the four bytes,
-but skip the top bit so we can use ints for convenience without getting tangled
-with negative values. The public options defined in pcre.h start at the least
-significant end. Make sure they don't overlap, though now that we have expanded
-to four bytes there is plenty of space. */
-
-#define PCRE_FIRSTSET 0x40000000 /* first_char is set */
-#define PCRE_REQCHSET 0x20000000 /* req_char is set */
-#define PCRE_STARTLINE 0x10000000 /* start after \n for multiline */
-#define PCRE_ICHANGED 0x08000000 /* i option changes within regex */
-
-/* Options for the "extra" block produced by pcre_study(). */
-
-#define PCRE_STUDY_MAPPED 0x01 /* a map of starting chars exists */
-
-/* Masks for identifying the public options which are permitted at compile
-time, run time or study time, respectively. */
-
-#define PUBLIC_OPTIONS \
- (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \
- PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8)
-
-#define PUBLIC_EXEC_OPTIONS \
- (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY)
-
-#define PUBLIC_STUDY_OPTIONS 0 /* None defined */
-
-/* Magic number to provide a small check against being handed junk. */
-
-#define MAGIC_NUMBER 0x50435245UL /* 'PCRE' */
-
-/* Negative values for the firstchar and reqchar variables */
-
-#define REQ_UNSET (-2)
-#define REQ_NONE (-1)
-
-/* Flags added to firstchar or reqchar */
-
-#define REQ_CASELESS 0x0100 /* indicates caselessness */
-
-/* Miscellaneous definitions */
-
-typedef int BOOL;
-
-#define FALSE 0
-#define TRUE 1
-
-/* Escape items that are just an encoding of a particular data value. Note that
-ESC_n is defined as yet another macro, which is set in config.h to either \n
-(the default) or \r (which some people want). */
-
-#ifndef ESC_e
-#define ESC_e 27
-#endif
-
-#ifndef ESC_f
-#define ESC_f '\f'
-#endif
-
-#ifndef ESC_n
-#define ESC_n NEWLINE
-#endif
-
-#ifndef ESC_r
-#define ESC_r '\r'
-#endif
-
-#ifndef ESC_t
-#define ESC_t '\t'
-#endif
-
-/* These are escaped items that aren't just an encoding of a particular data
-value such as \n. They must have non-zero values, as check_escape() returns
-their negation. Also, they must appear in the same order as in the opcode
-definitions below, up to ESC_z. There's a dummy for OP_ANY because it
-corresponds to "." rather than an escape sequence. The final one must be
-ESC_REF as subsequent values are used for \1, \2, \3, etc. There is are two
-tests in the code for an escape greater than ESC_b and less than ESC_Z to
-detect the types that may be repeated. These are the types that consume a
-character. If any new escapes are put in between that don't consume a
-character, that code will have to change. */
-
-enum { ESC_A = 1, ESC_G, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W,
- ESC_w, ESC_dum1, ESC_C, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_REF };
-
-
-/* Opcode table: OP_BRA must be last, as all values >= it are used for brackets
-that extract substrings. Starting from 1 (i.e. after OP_END), the values up to
-OP_EOD must correspond in order to the list of escapes immediately above.
-Note that whenever this list is updated, the two macro definitions that follow
-must also be updated to match. */
-
-enum {
- OP_END, /* 0 End of pattern */
-
- /* Values corresponding to backslashed metacharacters */
-
- OP_SOD, /* 1 Start of data: \A */
- OP_SOM, /* 2 Start of match (subject + offset): \G */
- OP_NOT_WORD_BOUNDARY, /* 3 \B */
- OP_WORD_BOUNDARY, /* 4 \b */
- OP_NOT_DIGIT, /* 5 \D */
- OP_DIGIT, /* 6 \d */
- OP_NOT_WHITESPACE, /* 7 \S */
- OP_WHITESPACE, /* 8 \s */
- OP_NOT_WORDCHAR, /* 9 \W */
- OP_WORDCHAR, /* 10 \w */
- OP_ANY, /* 11 Match any character */
- OP_ANYBYTE, /* 12 Match any byte (\C); different to OP_ANY for UTF-8 */
- OP_EODN, /* 13 End of data or \n at end of data: \Z. */
- OP_EOD, /* 14 End of data: \z */
-
- OP_OPT, /* 15 Set runtime options */
- OP_CIRC, /* 16 Start of line - varies with multiline switch */
- OP_DOLL, /* 17 End of line - varies with multiline switch */
- OP_CHARS, /* 18 Match string of characters */
- OP_NOT, /* 19 Match anything but the following char */
-
- OP_STAR, /* 20 The maximizing and minimizing versions of */
- OP_MINSTAR, /* 21 all these opcodes must come in pairs, with */
- OP_PLUS, /* 22 the minimizing one second. */
- OP_MINPLUS, /* 23 This first set applies to single characters */
- OP_QUERY, /* 24 */
- OP_MINQUERY, /* 25 */
- OP_UPTO, /* 26 From 0 to n matches */
- OP_MINUPTO, /* 27 */
- OP_EXACT, /* 28 Exactly n matches */
-
- OP_NOTSTAR, /* 29 The maximizing and minimizing versions of */
- OP_NOTMINSTAR, /* 30 all these opcodes must come in pairs, with */
- OP_NOTPLUS, /* 31 the minimizing one second. */
- OP_NOTMINPLUS, /* 32 This set applies to "not" single characters */
- OP_NOTQUERY, /* 33 */
- OP_NOTMINQUERY, /* 34 */
- OP_NOTUPTO, /* 35 From 0 to n matches */
- OP_NOTMINUPTO, /* 36 */
- OP_NOTEXACT, /* 37 Exactly n matches */
-
- OP_TYPESTAR, /* 38 The maximizing and minimizing versions of */
- OP_TYPEMINSTAR, /* 39 all these opcodes must come in pairs, with */
- OP_TYPEPLUS, /* 40 the minimizing one second. These codes must */
- OP_TYPEMINPLUS, /* 41 be in exactly the same order as those above. */
- OP_TYPEQUERY, /* 42 This set applies to character types such as \d */
- OP_TYPEMINQUERY, /* 43 */
- OP_TYPEUPTO, /* 44 From 0 to n matches */
- OP_TYPEMINUPTO, /* 45 */
- OP_TYPEEXACT, /* 46 Exactly n matches */
-
- OP_CRSTAR, /* 47 The maximizing and minimizing versions of */
- OP_CRMINSTAR, /* 48 all these opcodes must come in pairs, with */
- OP_CRPLUS, /* 49 the minimizing one second. These codes must */
- OP_CRMINPLUS, /* 50 be in exactly the same order as those above. */
- OP_CRQUERY, /* 51 These are for character classes and back refs */
- OP_CRMINQUERY, /* 52 */
- OP_CRRANGE, /* 53 These are different to the three seta above. */
- OP_CRMINRANGE, /* 54 */
-
- OP_CLASS, /* 55 Match a character class */
- OP_REF, /* 56 Match a back reference */
- OP_RECURSE, /* 57 Match a numbered subpattern (possibly recursive) */
- OP_CALLOUT, /* 58 Call out to external function if provided */
-
- OP_ALT, /* 59 Start of alternation */
- OP_KET, /* 60 End of group that doesn't have an unbounded repeat */
- OP_KETRMAX, /* 61 These two must remain together and in this */
- OP_KETRMIN, /* 62 order. They are for groups the repeat for ever. */
-
- /* The assertions must come before ONCE and COND */
-
- OP_ASSERT, /* 63 Positive lookahead */
- OP_ASSERT_NOT, /* 64 Negative lookahead */
- OP_ASSERTBACK, /* 65 Positive lookbehind */
- OP_ASSERTBACK_NOT, /* 66 Negative lookbehind */
- OP_REVERSE, /* 67 Move pointer back - used in lookbehind assertions */
-
- /* ONCE and COND must come after the assertions, with ONCE first, as there's
- a test for >= ONCE for a subpattern that isn't an assertion. */
-
- OP_ONCE, /* 68 Once matched, don't back up into the subpattern */
- OP_COND, /* 69 Conditional group */
- OP_CREF, /* 70 Used to hold an extraction string number (cond ref) */
-
- OP_BRAZERO, /* 71 These two must remain together and in this */
- OP_BRAMINZERO, /* 72 order. */
-
- OP_BRANUMBER, /* 73 Used for extracting brackets whose number is greater
- than can fit into an opcode. */
-
- OP_BRA /* 74 This and greater values are used for brackets that
- extract substrings up to a basic limit. After that,
- use is made of OP_BRANUMBER. */
-};
-
-
-/* This macro defines textual names for all the opcodes. There are used only
-for debugging, in pcre.c when DEBUG is defined, and also in pcretest.c. The
-macro is referenced only in printint.c. */
-
-#define OP_NAME_LIST \
- "End", "\\A", "\\G", "\\B", "\\b", "\\D", "\\d", \
- "\\S", "\\s", "\\W", "\\w", "Any", "Anybyte", "\\Z", "\\z", \
- "Opt", "^", "$", "chars", "not", \
- "*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
- "*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
- "*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
- "*", "*?", "+", "+?", "?", "??", "{", "{", \
- "class", "Ref", "Recurse", "Callout", \
- "Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not", \
- "AssertB", "AssertB not", "Reverse", "Once", "Cond", "Cond ref",\
- "Brazero", "Braminzero", "Branumber", "Bra"
-
-
-/* This macro defines the length of fixed length operations in the compiled
-regex. The lengths are used when searching for specific things, and also in the
-debugging printing of a compiled regex. We use a macro so that it can be
-incorporated both into pcre.c and pcretest.c without being publicly exposed. */
-
-#define OP_LENGTHS \
- 1, /* End */ \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* \A, \G, \B, \B, \D, \d, \S, \s, \W, \w */ \
- 1, 1, 1, 1, 2, 1, 1, /* Any, Anybyte, \Z, \z, Opt, ^, $ */ \
- 2, /* Chars - the minimum length */ \
- 2, /* not */ \
- /* Positive single-char repeats */ \
- 2, 2, 2, 2, 2, 2, /* *, *?, +, +?, ?, ?? */ \
- 4, 4, 4, /* upto, minupto, exact */ \
- /* Negative single-char repeats */ \
- 2, 2, 2, 2, 2, 2, /* NOT *, *?, +, +?, ?, ?? */ \
- 4, 4, 4, /* NOT upto, minupto, exact */ \
- /* Positive type repeats */ \
- 2, 2, 2, 2, 2, 2, /* Type *, *?, +, +?, ?, ?? */ \
- 4, 4, 4, /* Type upto, minupto, exact */ \
- /* Multi-char class repeats */ \
- 1, 1, 1, 1, 1, 1, /* *, *?, +, +?, ?, ?? */ \
- 5, 5, /* CRRANGE, CRMINRANGE */ \
- 33, 3, /* CLASS, REF */ \
- 1+LINK_SIZE, /* RECURSE */ \
- 2, /* CALLOUT */ \
- 1+LINK_SIZE, /* Alt */ \
- 1+LINK_SIZE, /* Ket */ \
- 1+LINK_SIZE, /* KetRmax */ \
- 1+LINK_SIZE, /* KetRmin */ \
- 1+LINK_SIZE, /* Assert */ \
- 1+LINK_SIZE, /* Assert not */ \
- 1+LINK_SIZE, /* Assert behind */ \
- 1+LINK_SIZE, /* Assert behind not */ \
- 1+LINK_SIZE, /* Reverse */ \
- 1+LINK_SIZE, /* Once */ \
- 1, /* COND */ \
- 3, /* CREF */ \
- 1, 1, /* BRAZERO, BRAMINZERO */ \
- 3, /* BRANUMBER */ \
- 1+LINK_SIZE /* BRA */ \
-
-
-/* The highest extraction number before we have to start using additional
-bytes. (Originally PCRE didn't have support for extraction counts highter than
-this number.) The value is limited by the number of opcodes left after OP_BRA,
-i.e. 255 - OP_BRA. We actually set it a bit lower to leave room for additional
-opcodes. */
-
-#define EXTRACT_BASIC_MAX 150
-
-/* A magic value for OP_CREF to indicate the "in recursion" condition. */
-
-#define CREF_RECURSE 0xffff
-
-/* The texts of compile-time error messages are defined as macros here so that
-they can be accessed by the POSIX wrapper and converted into error codes. Yes,
-I could have used error codes in the first place, but didn't feel like changing
-just to accommodate the POSIX wrapper. */
-
-#define ERR1 "\\ at end of pattern"
-#define ERR2 "\\c at end of pattern"
-#define ERR3 "unrecognized character follows \\"
-#define ERR4 "numbers out of order in {} quantifier"
-#define ERR5 "number too big in {} quantifier"
-#define ERR6 "missing terminating ] for character class"
-#define ERR7 "invalid escape sequence in character class"
-#define ERR8 "range out of order in character class"
-#define ERR9 "nothing to repeat"
-#define ERR10 "operand of unlimited repeat could match the empty string"
-#define ERR11 "internal error: unexpected repeat"
-#define ERR12 "unrecognized character after (?"
-#define ERR13 "POSIX named classes are supported only within a class"
-#define ERR14 "missing )"
-#define ERR15 "reference to non-existent subpattern"
-#define ERR16 "erroffset passed as NULL"
-#define ERR17 "unknown option bit(s) set"
-#define ERR18 "missing ) after comment"
-#define ERR19 "parentheses nested too deeply"
-#define ERR20 "regular expression too large"
-#define ERR21 "failed to get memory"
-#define ERR22 "unmatched parentheses"
-#define ERR23 "internal error: code overflow"
-#define ERR24 "unrecognized character after (?<"
-#define ERR25 "lookbehind assertion is not fixed length"
-#define ERR26 "malformed number after (?("
-#define ERR27 "conditional group contains more than two branches"
-#define ERR28 "assertion expected after (?("
-#define ERR29 "(?R or (?digits must be followed by )"
-#define ERR30 "unknown POSIX class name"
-#define ERR31 "POSIX collating elements are not supported"
-#define ERR32 "this version of PCRE is not compiled with PCRE_UTF8 support"
-#define ERR33 "characters with values > 255 are not yet supported in classes"
-#define ERR34 "character value in \\x{...} sequence is too large"
-#define ERR35 "invalid condition (?(0)"
-#define ERR36 "\\C not allowed in lookbehind assertion"
-#define ERR37 "PCRE does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X"
-#define ERR38 "number after (?C is > 255"
-#define ERR39 "closing ) for (?C expected"
-#define ERR40 "recursive call could loop indefinitely"
-#define ERR41 "unrecognized character after (?P"
-#define ERR42 "syntax error after (?P"
-#define ERR43 "two named groups have the same name"
-
-/* All character handling must be done as unsigned characters. Otherwise there
-are problems with top-bit-set characters and functions such as isspace().
-However, we leave the interface to the outside world as char *, because that
-should make things easier for callers. We define a short type for unsigned char
-to save lots of typing. I tried "uchar", but it causes problems on Digital
-Unix, where it is defined in sys/types, so use "uschar" instead. */
-
-typedef unsigned char uschar;
-
-/* The real format of the start of the pcre block; the index of names and the
-code vector run on as long as necessary after the end. */
-
-typedef struct real_pcre {
- unsigned long int magic_number;
- size_t size; /* Total that was malloced */
- const unsigned char *tables; /* Pointer to tables */
- unsigned long int options;
- unsigned short int top_bracket;
- unsigned short int top_backref;
- unsigned short int first_char;
- unsigned short int req_char;
- unsigned short int name_entry_size; /* Size of any name items; 0 => none */
- unsigned short int name_count; /* Number of name items */
-} real_pcre;
-
-/* The real format of the extra block returned by pcre_study(). */
-
-typedef struct real_pcre_extra {
- uschar options;
- uschar start_bits[32];
-} real_pcre_extra;
-
-
-/* Structure for passing "static" information around between the functions
-doing the compiling, so that they are thread-safe. */
-
-typedef struct compile_data {
- const uschar *lcc; /* Points to lower casing table */
- const uschar *fcc; /* Points to case-flipping table */
- const uschar *cbits; /* Points to character type table */
- const uschar *ctypes; /* Points to table of type maps */
- const uschar *start_code; /* The start of the compiled code */
- uschar *name_table; /* The name/number table */
- int names_found; /* Number of entries so far */
- int name_entry_size; /* Size of each entry */
-} compile_data;
-
-/* Structure for maintaining a chain of pointers to the currently incomplete
-branches, for testing for left recursion. */
-
-typedef struct branch_chain {
- struct branch_chain *outer;
- uschar *current;
-} branch_chain;
-
-/* Structure for items in a linked list that represents an explicit recursive
-call within the pattern. */
-
-typedef struct recursion_info {
- struct recursion_info *prev; /* Previous recursion record (or NULL) */
- int group_num; /* Number of group that was called */
- const uschar *after_call; /* "Return value": points after the call in the expr */
- const uschar *save_start; /* Old value of md->start_match */
- int *offset_save; /* Pointer to start of saved offsets */
- int saved_max; /* Number of saved offsets */
-} recursion_info;
-
-/* Structure for passing "static" information around between the functions
-doing the matching, so that they are thread-safe. */
-
-typedef struct match_data {
- int errorcode; /* As it says */
- int *offset_vector; /* Offset vector */
- int offset_end; /* One past the end */
- int offset_max; /* The maximum usable for return data */
- const uschar *lcc; /* Points to lower casing table */
- const uschar *ctypes; /* Points to table of type maps */
- BOOL offset_overflow; /* Set if too many extractions */
- BOOL notbol; /* NOTBOL flag */
- BOOL noteol; /* NOTEOL flag */
- BOOL utf8; /* UTF8 flag */
- BOOL endonly; /* Dollar not before final \n */
- BOOL notempty; /* Empty string match not wanted */
- const uschar *start_code; /* For use when recursing */
- const uschar *start_subject; /* Start of the subject string */
- const uschar *end_subject; /* End of the subject string */
- const uschar *start_match; /* Start of this match attempt */
- const uschar *end_match_ptr; /* Subject position at end match */
- int end_offset_top; /* Highwater mark at end of match */
- int capture_last; /* Most recent capture number */
- int start_offset; /* The start offset value */
- recursion_info *recursive; /* Linked list of recursion data */
-} match_data;
-
-/* Bit definitions for entries in the pcre_ctypes table. */
-
-#define ctype_space 0x01
-#define ctype_letter 0x02
-#define ctype_digit 0x04
-#define ctype_xdigit 0x08
-#define ctype_word 0x10 /* alphameric or '_' */
-#define ctype_meta 0x80 /* regexp meta char or zero (end pattern) */
-
-/* Offsets for the bitmap tables in pcre_cbits. Each table contains a set
-of bits for a class map. Some classes are built by combining these tables. */
-
-#define cbit_space 0 /* [:space:] or \s */
-#define cbit_xdigit 32 /* [:xdigit:] */
-#define cbit_digit 64 /* [:digit:] or \d */
-#define cbit_upper 96 /* [:upper:] */
-#define cbit_lower 128 /* [:lower:] */
-#define cbit_word 160 /* [:word:] or \w */
-#define cbit_graph 192 /* [:graph:] */
-#define cbit_print 224 /* [:print:] */
-#define cbit_punct 256 /* [:punct:] */
-#define cbit_cntrl 288 /* [:cntrl:] */
-#define cbit_length 320 /* Length of the cbits table */
-
-/* Offsets of the various tables from the base tables pointer, and
-total length. */
-
-#define lcc_offset 0
-#define fcc_offset 256
-#define cbits_offset 512
-#define ctypes_offset (cbits_offset + cbit_length)
-#define tables_length (ctypes_offset + 256)
-
-/* End of internal.h */
diff --git a/ext/pcre/pcrelib/maketables.c b/ext/pcre/pcrelib/maketables.c
deleted file mode 100644
index f89765214c..0000000000
--- a/ext/pcre/pcrelib/maketables.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/*
-PCRE is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
- Copyright (c) 1997-2001 University of Cambridge
-
------------------------------------------------------------------------------
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
------------------------------------------------------------------------------
-
-See the file Tech.Notes for some information on the internals.
-*/
-
-
-/* This file is compiled on its own as part of the PCRE library. However,
-it is also included in the compilation of dftables.c, in which case the macro
-DFTABLES is defined. */
-
-#ifndef DFTABLES
-#include "internal.h"
-#endif
-
-
-
-/*************************************************
-* Create PCRE character tables *
-*************************************************/
-
-/* This function builds a set of character tables for use by PCRE and returns
-a pointer to them. They are build using the ctype functions, and consequently
-their contents will depend upon the current locale setting. When compiled as
-part of the library, the store is obtained via pcre_malloc(), but when compiled
-inside dftables, use malloc().
-
-Arguments: none
-Returns: pointer to the contiguous block of data
-*/
-
-const unsigned char *
-pcre_maketables(void)
-{
-unsigned char *yield, *p;
-int i;
-
-#ifndef DFTABLES
-yield = (unsigned char*)(pcre_malloc)(tables_length);
-#else
-yield = (unsigned char*)malloc(tables_length);
-#endif
-
-if (yield == NULL) return NULL;
-p = yield;
-
-/* First comes the lower casing table */
-
-for (i = 0; i < 256; i++) *p++ = tolower(i);
-
-/* Next the case-flipping table */
-
-for (i = 0; i < 256; i++) *p++ = islower(i)? toupper(i) : tolower(i);
-
-/* Then the character class tables. Don't try to be clever and save effort
-on exclusive ones - in some locales things may be different. Note that the
-table for "space" includes everything "isspace" gives, including VT in the
-default locale. This makes it work for the POSIX class [:space:]. */
-
-memset(p, 0, cbit_length);
-for (i = 0; i < 256; i++)
- {
- if (isdigit(i))
- {
- p[cbit_digit + i/8] |= 1 << (i&7);
- p[cbit_word + i/8] |= 1 << (i&7);
- }
- if (isupper(i))
- {
- p[cbit_upper + i/8] |= 1 << (i&7);
- p[cbit_word + i/8] |= 1 << (i&7);
- }
- if (islower(i))
- {
- p[cbit_lower + i/8] |= 1 << (i&7);
- p[cbit_word + i/8] |= 1 << (i&7);
- }
- if (i == '_') p[cbit_word + i/8] |= 1 << (i&7);
- if (isspace(i)) p[cbit_space + i/8] |= 1 << (i&7);
- if (isxdigit(i))p[cbit_xdigit + i/8] |= 1 << (i&7);
- if (isgraph(i)) p[cbit_graph + i/8] |= 1 << (i&7);
- if (isprint(i)) p[cbit_print + i/8] |= 1 << (i&7);
- if (ispunct(i)) p[cbit_punct + i/8] |= 1 << (i&7);
- if (iscntrl(i)) p[cbit_cntrl + i/8] |= 1 << (i&7);
- }
-p += cbit_length;
-
-/* Finally, the character type table. In this, we exclude VT from the white
-space chars, because Perl doesn't recognize it as such for \s and for comments
-within regexes. */
-
-for (i = 0; i < 256; i++)
- {
- int x = 0;
- if (i != 0x0b && isspace(i)) x += ctype_space;
- if (isalpha(i)) x += ctype_letter;
- if (isdigit(i)) x += ctype_digit;
- if (isxdigit(i)) x += ctype_xdigit;
- if (isalnum(i) || i == '_') x += ctype_word;
- if (strchr("*+?{^.$|()[", i) != 0) x += ctype_meta;
- *p++ = x;
- }
-
-return yield;
-}
-
-/* End of maketables.c */
diff --git a/ext/pcre/pcrelib/pcre.c b/ext/pcre/pcrelib/pcre.c
deleted file mode 100644
index 8c74905131..0000000000
--- a/ext/pcre/pcrelib/pcre.c
+++ /dev/null
@@ -1,5992 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/*
-This is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language. See
-the file Tech.Notes for some information on the internals.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
- Copyright (c) 1997-2003 University of Cambridge
-
------------------------------------------------------------------------------
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
------------------------------------------------------------------------------
-*/
-
-
-/* Define DEBUG to get debugging output on stdout. */
-
-/* #define DEBUG */
-
-/* Use a macro for debugging printing, 'cause that eliminates the use of #ifdef
-inline, and there are *still* stupid compilers about that don't like indented
-pre-processor statements. I suppose it's only been 10 years... */
-
-#ifdef DEBUG
-#define DPRINTF(p) printf p
-#else
-#define DPRINTF(p) /*nothing*/
-#endif
-
-/* Include the internals header, which itself includes Standard C headers plus
-the external pcre header. */
-
-#include "internal.h"
-
-
-/* Allow compilation as C++ source code, should anybody want to do that. */
-
-#ifdef __cplusplus
-#define class pcre_class
-#endif
-
-
-/* Maximum number of items on the nested bracket stacks at compile time. This
-applies to the nesting of all kinds of parentheses. It does not limit
-un-nested, non-capturing parentheses. This number can be made bigger if
-necessary - it is used to dimension one int and one unsigned char vector at
-compile time. */
-
-#define BRASTACK_SIZE 200
-
-
-
-/* Maximum number of ints of offset to save on the stack for recursive calls.
-If the offset vector is bigger, malloc is used. This should be a multiple of 3,
-because the offset vector is always a multiple of 3 long. */
-
-#define REC_STACK_SAVE_MAX 30
-
-
-/* The number of bytes in a literal character string above which we can't add
-any more is different when UTF-8 characters may be encountered. */
-
-#ifdef SUPPORT_UTF8
-#define MAXLIT 250
-#else
-#define MAXLIT 255
-#endif
-
-
-/* Table of sizes for the fixed-length opcodes. It's defined in a macro so that
-the definition is next to the definition of the opcodes in internal.h. */
-
-static uschar OP_lengths[] = { OP_LENGTHS };
-
-/* Min and max values for the common repeats; for the maxima, 0 => infinity */
-
-static const char rep_min[] = { 0, 0, 1, 1, 0, 0 };
-static const char rep_max[] = { 0, 0, 0, 0, 1, 1 };
-
-/* Table for handling escaped characters in the range '0'-'z'. Positive returns
-are simple data values; negative values are for special things like \d and so
-on. Zero means further processing is needed (for things like \x), or the escape
-is invalid. */
-
-static const short int escapes[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0 - 7 */
- 0, 0, ':', ';', '<', '=', '>', '?', /* 8 - ? */
- '@', -ESC_A, -ESC_B, -ESC_C, -ESC_D, -ESC_E, 0, -ESC_G, /* @ - G */
- 0, 0, 0, 0, 0, 0, 0, 0, /* H - O */
- 0, -ESC_Q, 0, -ESC_S, 0, 0, 0, -ESC_W, /* P - W */
- 0, 0, -ESC_Z, '[', '\\', ']', '^', '_', /* X - _ */
- '`', 7, -ESC_b, 0, -ESC_d, ESC_e, ESC_f, 0, /* ` - g */
- 0, 0, 0, 0, 0, 0, ESC_n, 0, /* h - o */
- 0, 0, ESC_r, -ESC_s, ESC_t, 0, 0, -ESC_w, /* p - w */
- 0, 0, -ESC_z /* x - z */
-};
-
-/* Tables of names of POSIX character classes and their lengths. The list is
-terminated by a zero length entry. The first three must be alpha, upper, lower,
-as this is assumed for handling case independence. */
-
-static const char *posix_names[] = {
- "alpha", "lower", "upper",
- "alnum", "ascii", "blank", "cntrl", "digit", "graph",
- "print", "punct", "space", "word", "xdigit" };
-
-static const uschar posix_name_lengths[] = {
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 6, 0 };
-
-/* Table of class bit maps for each POSIX class; up to three may be combined
-to form the class. The table for [:blank:] is dynamically modified to remove
-the vertical space characters. */
-
-static const int posix_class_maps[] = {
- cbit_lower, cbit_upper, -1, /* alpha */
- cbit_lower, -1, -1, /* lower */
- cbit_upper, -1, -1, /* upper */
- cbit_digit, cbit_lower, cbit_upper, /* alnum */
- cbit_print, cbit_cntrl, -1, /* ascii */
- cbit_space, -1, -1, /* blank - a GNU extension */
- cbit_cntrl, -1, -1, /* cntrl */
- cbit_digit, -1, -1, /* digit */
- cbit_graph, -1, -1, /* graph */
- cbit_print, -1, -1, /* print */
- cbit_punct, -1, -1, /* punct */
- cbit_space, -1, -1, /* space */
- cbit_word, -1, -1, /* word - a Perl extension */
- cbit_xdigit,-1, -1 /* xdigit */
-};
-
-
-/* Definition to allow mutual recursion */
-
-static BOOL
- compile_regex(int, int, int *, uschar **, const uschar **, const char **,
- BOOL, int, int *, int *, branch_chain *, compile_data *);
-
-/* Structure for building a chain of data that actually lives on the
-stack, for holding the values of the subject pointer at the start of each
-subpattern, so as to detect when an empty string has been matched by a
-subpattern - to break infinite loops. */
-
-typedef struct eptrblock {
- struct eptrblock *prev;
- const uschar *saved_eptr;
-} eptrblock;
-
-/* Flag bits for the match() function */
-
-#define match_condassert 0x01 /* Called to check a condition assertion */
-#define match_isgroup 0x02 /* Set if start of bracketed group */
-
-
-
-/*************************************************
-* Global variables *
-*************************************************/
-
-/* PCRE is thread-clean and doesn't use any global variables in the normal
-sense. However, it calls memory allocation and free functions via the two
-indirections below, and it can optionally do callouts. These values can be
-changed by the caller, but are shared between all threads. However, when
-compiling for Virtual Pascal, things are done differently (see pcre.in). */
-
-#ifndef VPCOMPAT
-void *(*pcre_malloc)(size_t) = malloc;
-void (*pcre_free)(void *) = free;
-int (*pcre_callout)(pcre_callout_block *) = NULL;
-#endif
-
-
-/*************************************************
-* Macros and tables for character handling *
-*************************************************/
-
-/* When UTF-8 encoding is being used, a character is no longer just a single
-byte. The macros for character handling generate simple sequences when used in
-byte-mode, and more complicated ones for UTF-8 characters. */
-
-#ifndef SUPPORT_UTF8
-#define GETCHARINC(c, eptr) c = *eptr++;
-#define GETCHARLEN(c, eptr, len) c = *eptr;
-#define BACKCHAR(eptr)
-
-#else /* SUPPORT_UTF8 */
-
-/* Get the next UTF-8 character, advancing the pointer */
-
-#define GETCHARINC(c, eptr) \
- c = *eptr++; \
- if (md->utf8 && (c & 0xc0) == 0xc0) \
- { \
- int a = utf8_table4[c & 0x3f]; /* Number of additional bytes */ \
- int s = 6*a; \
- c = (c & utf8_table3[a]) << s; \
- while (a-- > 0) \
- { \
- s -= 6; \
- c |= (*eptr++ & 0x3f) << s; \
- } \
- }
-
-/* Get the next UTF-8 character, not advancing the pointer, setting length */
-
-#define GETCHARLEN(c, eptr, len) \
- c = *eptr; \
- len = 1; \
- if (md->utf8 && (c & 0xc0) == 0xc0) \
- { \
- int i; \
- int a = utf8_table4[c & 0x3f]; /* Number of additional bytes */ \
- int s = 6*a; \
- c = (c & utf8_table3[a]) << s; \
- for (i = 1; i <= a; i++) \
- { \
- s -= 6; \
- c |= (eptr[i] & 0x3f) << s; \
- } \
- len += a; \
- }
-
-/* If the pointer is not at the start of a character, move it back until
-it is. */
-
-#define BACKCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr--;
-
-#endif
-
-
-
-/*************************************************
-* Default character tables *
-*************************************************/
-
-/* A default set of character tables is included in the PCRE binary. Its source
-is built by the maketables auxiliary program, which uses the default C ctypes
-functions, and put in the file chartables.c. These tables are used by PCRE
-whenever the caller of pcre_compile() does not provide an alternate set of
-tables. */
-
-#include "chartables.c"
-
-
-
-#ifdef SUPPORT_UTF8
-/*************************************************
-* Tables for UTF-8 support *
-*************************************************/
-
-/* These are the breakpoints for different numbers of bytes in a UTF-8
-character. */
-
-static int utf8_table1[] = { 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};
-
-/* These are the indicator bits and the mask for the data bits to set in the
-first byte of a character, indexed by the number of additional bytes. */
-
-static int utf8_table2[] = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
-static int utf8_table3[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
-
-/* Table of the number of extra characters, indexed by the first character
-masked with 0x3f. The highest number for a valid UTF-8 character is in fact
-0x3d. */
-
-static uschar utf8_table4[] = {
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
-
-
-/*************************************************
-* Convert character value to UTF-8 *
-*************************************************/
-
-/* This function takes an integer value in the range 0 - 0x7fffffff
-and encodes it as a UTF-8 character in 0 to 6 bytes.
-
-Arguments:
- cvalue the character value
- buffer pointer to buffer for result - at least 6 bytes long
-
-Returns: number of characters placed in the buffer
-*/
-
-static int
-ord2utf8(int cvalue, uschar *buffer)
-{
-register int i, j;
-for (i = 0; i < sizeof(utf8_table1)/sizeof(int); i++)
- if (cvalue <= utf8_table1[i]) break;
-buffer += i;
-for (j = i; j > 0; j--)
- {
- *buffer-- = 0x80 | (cvalue & 0x3f);
- cvalue >>= 6;
- }
-*buffer = utf8_table2[i] | cvalue;
-return i + 1;
-}
-#endif
-
-
-
-/*************************************************
-* Print compiled regex *
-*************************************************/
-
-/* The code for doing this is held in a separate file that is also included in
-pcretest.c. It defines a function called print_internals(). */
-
-#ifdef DEBUG
-#include "printint.c"
-#endif
-
-
-
-/*************************************************
-* Return version string *
-*************************************************/
-
-#define STRING(a) # a
-#define XSTRING(s) STRING(s)
-
-const char *
-pcre_version(void)
-{
-return XSTRING(PCRE_MAJOR) "." XSTRING(PCRE_MINOR) " " XSTRING(PCRE_DATE);
-}
-
-
-
-
-/*************************************************
-* (Obsolete) Return info about compiled pattern *
-*************************************************/
-
-/* This is the original "info" function. It picks potentially useful data out
-of the private structure, but its interface was too rigid. It remains for
-backwards compatibility. The public options are passed back in an int - though
-the re->options field has been expanded to a long int, all the public options
-at the low end of it, and so even on 16-bit systems this will still be OK.
-Therefore, I haven't changed the API for pcre_info().
-
-Arguments:
- external_re points to compiled code
- optptr where to pass back the options
- first_char where to pass back the first character,
- or -1 if multiline and all branches start ^,
- or -2 otherwise
-
-Returns: number of capturing subpatterns
- or negative values on error
-*/
-
-int
-pcre_info(const pcre *external_re, int *optptr, int *first_char)
-{
-const real_pcre *re = (const real_pcre *)external_re;
-if (re == NULL) return PCRE_ERROR_NULL;
-if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC;
-if (optptr != NULL) *optptr = (int)(re->options & PUBLIC_OPTIONS);
-if (first_char != NULL)
- *first_char = ((re->options & PCRE_FIRSTSET) != 0)? re->first_char :
- ((re->options & PCRE_STARTLINE) != 0)? -1 : -2;
-return re->top_bracket;
-}
-
-
-
-/*************************************************
-* Return info about compiled pattern *
-*************************************************/
-
-/* This is a newer "info" function which has an extensible interface so
-that additional items can be added compatibly.
-
-Arguments:
- external_re points to compiled code
- external_study points to study data, or NULL
- what what information is required
- where where to put the information
-
-Returns: 0 if data returned, negative on error
-*/
-
-int
-pcre_fullinfo(const pcre *external_re, const pcre_extra *study_data, int what,
- void *where)
-{
-const real_pcre *re = (const real_pcre *)external_re;
-const real_pcre_extra *study = (const real_pcre_extra *)study_data;
-
-if (re == NULL || where == NULL) return PCRE_ERROR_NULL;
-if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC;
-
-switch (what)
- {
- case PCRE_INFO_OPTIONS:
- *((unsigned long int *)where) = re->options & PUBLIC_OPTIONS;
- break;
-
- case PCRE_INFO_SIZE:
- *((size_t *)where) = re->size;
- break;
-
- case PCRE_INFO_CAPTURECOUNT:
- *((int *)where) = re->top_bracket;
- break;
-
- case PCRE_INFO_BACKREFMAX:
- *((int *)where) = re->top_backref;
- break;
-
- case PCRE_INFO_FIRSTCHAR:
- *((int *)where) =
- ((re->options & PCRE_FIRSTSET) != 0)? re->first_char :
- ((re->options & PCRE_STARTLINE) != 0)? -1 : -2;
- break;
-
- case PCRE_INFO_FIRSTTABLE:
- *((const uschar **)where) =
- (study != NULL && (study->options & PCRE_STUDY_MAPPED) != 0)?
- study->start_bits : NULL;
- break;
-
- case PCRE_INFO_LASTLITERAL:
- *((int *)where) =
- ((re->options & PCRE_REQCHSET) != 0)? re->req_char : -1;
- break;
-
- case PCRE_INFO_NAMEENTRYSIZE:
- *((int *)where) = re->name_entry_size;
- break;
-
- case PCRE_INFO_NAMECOUNT:
- *((int *)where) = re->name_count;
- break;
-
- case PCRE_INFO_NAMETABLE:
- *((const uschar **)where) = (const uschar *)re + sizeof(real_pcre);
- break;
-
- default: return PCRE_ERROR_BADOPTION;
- }
-
-return 0;
-}
-
-
-
-#ifdef DEBUG
-/*************************************************
-* Debugging function to print chars *
-*************************************************/
-
-/* Print a sequence of chars in printable format, stopping at the end of the
-subject if the requested.
-
-Arguments:
- p points to characters
- length number to print
- is_subject TRUE if printing from within md->start_subject
- md pointer to matching data block, if is_subject is TRUE
-
-Returns: nothing
-*/
-
-static void
-pchars(const uschar *p, int length, BOOL is_subject, match_data *md)
-{
-int c;
-if (is_subject && length > md->end_subject - p) length = md->end_subject - p;
-while (length-- > 0)
- if (isprint(c = *(p++))) printf("%c", c); else printf("\\x%02x", c);
-}
-#endif
-
-
-
-
-/*************************************************
-* Handle escapes *
-*************************************************/
-
-/* This function is called when a \ has been encountered. It either returns a
-positive value for a simple escape such as \n, or a negative value which
-encodes one of the more complicated things such as \d. When UTF-8 is enabled,
-a positive value greater than 255 may be returned. On entry, ptr is pointing at
-the \. On exit, it is on the final character of the escape sequence.
-
-Arguments:
- ptrptr points to the pattern position pointer
- errorptr points to the pointer to the error message
- bracount number of previous extracting brackets
- options the options bits
- isclass TRUE if inside a character class
- cd pointer to char tables block
-
-Returns: zero or positive => a data character
- negative => a special escape sequence
- on error, errorptr is set
-*/
-
-static int
-check_escape(const uschar **ptrptr, const char **errorptr, int bracount,
- int options, BOOL isclass, compile_data *cd)
-{
-const uschar *ptr = *ptrptr;
-int c, i;
-
-/* If backslash is at the end of the pattern, it's an error. */
-
-c = *(++ptr);
-if (c == 0) *errorptr = ERR1;
-
-/* Digits or letters may have special meaning; all others are literals. */
-
-else if (c < '0' || c > 'z') {}
-
-/* Do an initial lookup in a table. A non-zero result is something that can be
-returned immediately. Otherwise further processing may be required. */
-
-else if ((i = escapes[c - '0']) != 0) c = i;
-
-/* Escapes that need further processing, or are illegal. */
-
-else
- {
- const uschar *oldptr;
- switch (c)
- {
- /* A number of Perl escapes are not handled by PCRE. We give an explicit
- error. */
-
- case 'l':
- case 'L':
- case 'N':
- case 'p':
- case 'P':
- case 'u':
- case 'U':
- case 'X':
- *errorptr = ERR37;
- break;
-
- /* The handling of escape sequences consisting of a string of digits
- starting with one that is not zero is not straightforward. By experiment,
- the way Perl works seems to be as follows:
-
- Outside a character class, the digits are read as a decimal number. If the
- number is less than 10, or if there are that many previous extracting
- left brackets, then it is a back reference. Otherwise, up to three octal
- digits are read to form an escaped byte. Thus \123 is likely to be octal
- 123 (cf \0123, which is octal 012 followed by the literal 3). If the octal
- value is greater than 377, the least significant 8 bits are taken. Inside a
- character class, \ followed by a digit is always an octal number. */
-
- case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9':
-
- if (!isclass)
- {
- oldptr = ptr;
- c -= '0';
- while ((cd->ctypes[ptr[1]] & ctype_digit) != 0)
- c = c * 10 + *(++ptr) - '0';
- if (c < 10 || c <= bracount)
- {
- c = -(ESC_REF + c);
- break;
- }
- ptr = oldptr; /* Put the pointer back and fall through */
- }
-
- /* Handle an octal number following \. If the first digit is 8 or 9, Perl
- generates a binary zero byte and treats the digit as a following literal.
- Thus we have to pull back the pointer by one. */
-
- if ((c = *ptr) >= '8')
- {
- ptr--;
- c = 0;
- break;
- }
-
- /* \0 always starts an octal number, but we may drop through to here with a
- larger first octal digit. */
-
- case '0':
- c -= '0';
- while(i++ < 2 && (cd->ctypes[ptr[1]] & ctype_digit) != 0 &&
- ptr[1] != '8' && ptr[1] != '9')
- c = c * 8 + *(++ptr) - '0';
- c &= 255; /* Take least significant 8 bits */
- break;
-
- /* \x is complicated when UTF-8 is enabled. \x{ddd} is a character number
- which can be greater than 0xff, but only if the ddd are hex digits. */
-
- case 'x':
-#ifdef SUPPORT_UTF8
- if (ptr[1] == '{' && (options & PCRE_UTF8) != 0)
- {
- const uschar *pt = ptr + 2;
- register int count = 0;
- c = 0;
- while ((cd->ctypes[*pt] & ctype_xdigit) != 0)
- {
- count++;
- c = c * 16 + cd->lcc[*pt] -
- (((cd->ctypes[*pt] & ctype_digit) != 0)? '0' : 'W');
- pt++;
- }
- if (*pt == '}')
- {
- if (c < 0 || count > 8) *errorptr = ERR34;
- ptr = pt;
- break;
- }
- /* If the sequence of hex digits does not end with '}', then we don't
- recognize this construct; fall through to the normal \x handling. */
- }
-#endif
-
- /* Read just a single hex char */
-
- c = 0;
- while (i++ < 2 && (cd->ctypes[ptr[1]] & ctype_xdigit) != 0)
- {
- ptr++;
- c = c * 16 + cd->lcc[*ptr] -
- (((cd->ctypes[*ptr] & ctype_digit) != 0)? '0' : 'W');
- }
- break;
-
- /* Other special escapes not starting with a digit are straightforward */
-
- case 'c':
- c = *(++ptr);
- if (c == 0)
- {
- *errorptr = ERR2;
- return 0;
- }
-
- /* A letter is upper-cased; then the 0x40 bit is flipped */
-
- if (c >= 'a' && c <= 'z') c = cd->fcc[c];
- c ^= 0x40;
- break;
-
- /* PCRE_EXTRA enables extensions to Perl in the matter of escapes. Any
- other alphameric following \ is an error if PCRE_EXTRA was set; otherwise,
- for Perl compatibility, it is a literal. This code looks a bit odd, but
- there used to be some cases other than the default, and there may be again
- in future, so I haven't "optimized" it. */
-
- default:
- if ((options & PCRE_EXTRA) != 0) switch(c)
- {
- default:
- *errorptr = ERR3;
- break;
- }
- break;
- }
- }
-
-*ptrptr = ptr;
-return c;
-}
-
-
-
-/*************************************************
-* Check for counted repeat *
-*************************************************/
-
-/* This function is called when a '{' is encountered in a place where it might
-start a quantifier. It looks ahead to see if it really is a quantifier or not.
-It is only a quantifier if it is one of the forms {ddd} {ddd,} or {ddd,ddd}
-where the ddds are digits.
-
-Arguments:
- p pointer to the first char after '{'
- cd pointer to char tables block
-
-Returns: TRUE or FALSE
-*/
-
-static BOOL
-is_counted_repeat(const uschar *p, compile_data *cd)
-{
-if ((cd->ctypes[*p++] & ctype_digit) == 0) return FALSE;
-while ((cd->ctypes[*p] & ctype_digit) != 0) p++;
-if (*p == '}') return TRUE;
-
-if (*p++ != ',') return FALSE;
-if (*p == '}') return TRUE;
-
-if ((cd->ctypes[*p++] & ctype_digit) == 0) return FALSE;
-while ((cd->ctypes[*p] & ctype_digit) != 0) p++;
-return (*p == '}');
-}
-
-
-
-/*************************************************
-* Read repeat counts *
-*************************************************/
-
-/* Read an item of the form {n,m} and return the values. This is called only
-after is_counted_repeat() has confirmed that a repeat-count quantifier exists,
-so the syntax is guaranteed to be correct, but we need to check the values.
-
-Arguments:
- p pointer to first char after '{'
- minp pointer to int for min
- maxp pointer to int for max
- returned as -1 if no max
- errorptr points to pointer to error message
- cd pointer to character tables clock
-
-Returns: pointer to '}' on success;
- current ptr on error, with errorptr set
-*/
-
-static const uschar *
-read_repeat_counts(const uschar *p, int *minp, int *maxp,
- const char **errorptr, compile_data *cd)
-{
-int min = 0;
-int max = -1;
-
-while ((cd->ctypes[*p] & ctype_digit) != 0) min = min * 10 + *p++ - '0';
-
-if (*p == '}') max = min; else
- {
- if (*(++p) != '}')
- {
- max = 0;
- while((cd->ctypes[*p] & ctype_digit) != 0) max = max * 10 + *p++ - '0';
- if (max < min)
- {
- *errorptr = ERR4;
- return p;
- }
- }
- }
-
-/* Do paranoid checks, then fill in the required variables, and pass back the
-pointer to the terminating '}'. */
-
-if (min > 65535 || max > 65535)
- *errorptr = ERR5;
-else
- {
- *minp = min;
- *maxp = max;
- }
-return p;
-}
-
-
-
-/*************************************************
-* Find first significant op code *
-*************************************************/
-
-/* This is called by several functions that scan a compiled expression looking
-for a fixed first character, or an anchoring op code etc. It skips over things
-that do not influence this. For some calls, a change of option is important.
-
-Arguments:
- code pointer to the start of the group
- options pointer to external options
- optbit the option bit whose changing is significant, or
- zero if none are
-
-Returns: pointer to the first significant opcode
-*/
-
-static const uschar*
-first_significant_code(const uschar *code, int *options, int optbit)
-{
-for (;;)
- {
- switch ((int)*code)
- {
- case OP_OPT:
- if (optbit > 0 && ((int)code[1] & optbit) != (*options & optbit))
- *options = (int)code[1];
- code += 2;
- break;
-
- case OP_ASSERT_NOT:
- case OP_ASSERTBACK:
- case OP_ASSERTBACK_NOT:
- do code += GET(code, 1); while (*code == OP_ALT);
- /* Fall through */
-
- case OP_CALLOUT:
- case OP_CREF:
- case OP_BRANUMBER:
- case OP_WORD_BOUNDARY:
- case OP_NOT_WORD_BOUNDARY:
- code += OP_lengths[*code];
- break;
-
- default:
- return code;
- }
- }
-/* Control never reaches here */
-}
-
-
-
-
-/*************************************************
-* Find the fixed length of a pattern *
-*************************************************/
-
-/* Scan a pattern and compute the fixed length of subject that will match it,
-if the length is fixed. This is needed for dealing with backward assertions.
-
-Arguments:
- code points to the start of the pattern (the bracket)
- options the compiling options
-
-Returns: the fixed length, or -1 if there is no fixed length,
- or -2 if \C was encountered
-*/
-
-static int
-find_fixedlength(uschar *code, int options)
-{
-int length = -1;
-
-register int branchlength = 0;
-register uschar *cc = code + 1 + LINK_SIZE;
-
-/* Scan along the opcodes for this branch. If we get to the end of the
-branch, check the length against that of the other branches. */
-
-for (;;)
- {
- int d;
- register int op = *cc;
- if (op >= OP_BRA) op = OP_BRA;
-
- switch (op)
- {
- case OP_BRA:
- case OP_ONCE:
- case OP_COND:
- d = find_fixedlength(cc, options);
- if (d < 0) return d;
- branchlength += d;
- do cc += GET(cc, 1); while (*cc == OP_ALT);
- cc += 1 + LINK_SIZE;
- break;
-
- /* Reached end of a branch; if it's a ket it is the end of a nested
- call. If it's ALT it is an alternation in a nested call. If it is
- END it's the end of the outer call. All can be handled by the same code. */
-
- case OP_ALT:
- case OP_KET:
- case OP_KETRMAX:
- case OP_KETRMIN:
- case OP_END:
- if (length < 0) length = branchlength;
- else if (length != branchlength) return -1;
- if (*cc != OP_ALT) return length;
- cc += 1 + LINK_SIZE;
- branchlength = 0;
- break;
-
- /* Skip over assertive subpatterns */
-
- case OP_ASSERT:
- case OP_ASSERT_NOT:
- case OP_ASSERTBACK:
- case OP_ASSERTBACK_NOT:
- do cc += GET(cc, 1); while (*cc == OP_ALT);
- /* Fall through */
-
- /* Skip over things that don't match chars */
-
- case OP_REVERSE:
- case OP_BRANUMBER:
- case OP_CREF:
- case OP_OPT:
- case OP_CALLOUT:
- case OP_SOD:
- case OP_SOM:
- case OP_EOD:
- case OP_EODN:
- case OP_CIRC:
- case OP_DOLL:
- case OP_NOT_WORD_BOUNDARY:
- case OP_WORD_BOUNDARY:
- cc += OP_lengths[*cc];
- break;
-
- /* Handle char strings. In UTF-8 mode we must count characters, not bytes.
- This requires a scan of the string, unfortunately. We assume valid UTF-8
- strings, so all we do is reduce the length by one for every byte whose bits
- are 10xxxxxx. */
-
- case OP_CHARS:
- branchlength += *(++cc);
-#ifdef SUPPORT_UTF8
- for (d = 1; d <= *cc; d++)
- if ((cc[d] & 0xc0) == 0x80) branchlength--;
-#endif
- cc += *cc + 1;
- break;
-
- /* Handle exact repetitions */
-
- case OP_EXACT:
- case OP_TYPEEXACT:
- branchlength += GET2(cc,1);
- cc += 4;
- break;
-
- /* Handle single-char matchers */
-
- case OP_NOT_DIGIT:
- case OP_DIGIT:
- case OP_NOT_WHITESPACE:
- case OP_WHITESPACE:
- case OP_NOT_WORDCHAR:
- case OP_WORDCHAR:
- case OP_ANY:
- branchlength++;
- cc++;
- break;
-
- /* The single-byte matcher isn't allowed */
-
- case OP_ANYBYTE:
- return -2;
-
- /* Check a class for variable quantification */
-
- case OP_CLASS:
- cc += 33;
-
- switch (*cc)
- {
- case OP_CRSTAR:
- case OP_CRMINSTAR:
- case OP_CRQUERY:
- case OP_CRMINQUERY:
- return -1;
-
- case OP_CRRANGE:
- case OP_CRMINRANGE:
- if (GET2(cc,1) != GET2(cc,3)) return -1;
- branchlength += GET2(cc,1);
- cc += 5;
- break;
-
- default:
- branchlength++;
- }
- break;
-
- /* Anything else is variable length */
-
- default:
- return -1;
- }
- }
-/* Control never gets here */
-}
-
-
-
-
-/*************************************************
-* Scan compiled regex for numbered bracket *
-*************************************************/
-
-/* This little function scans through a compiled pattern until it finds a
-capturing bracket with the given number.
-
-Arguments:
- code points to start of expression
- number the required bracket number
-
-Returns: pointer to the opcode for the bracket, or NULL if not found
-*/
-
-static const uschar *
-find_bracket(const uschar *code, int number)
-{
-for (;;)
- {
- register int c = *code;
- if (c == OP_END) return NULL;
- else if (c == OP_CHARS) code += code[1] + OP_lengths[c];
- else if (c > OP_BRA)
- {
- int n = c - OP_BRA;
- if (n > EXTRACT_BASIC_MAX) n = GET2(code, 2+LINK_SIZE);
- if (n == number) return (uschar *)code;
- code += OP_lengths[OP_BRA];
- }
- else code += OP_lengths[c];
- }
-}
-
-
-
-/*************************************************
-* Scan compiled branch for non-emptiness *
-*************************************************/
-
-/* This function scans through a branch of a compiled pattern to see whether it
-can match the empty string or not. It is called only from could_be_empty()
-below. Note that first_significant_code() skips over assertions. If we hit an
-unclosed bracket, we return "empty" - this means we've struck an inner bracket
-whose current branch will already have been scanned.
-
-Arguments:
- code points to start of search
- endcode points to where to stop
-
-Returns: TRUE if what is matched could be empty
-*/
-
-static BOOL
-could_be_empty_branch(const uschar *code, const uschar *endcode)
-{
-register int c;
-for (code = first_significant_code(code + 1 + LINK_SIZE, NULL, 0);
- code < endcode;
- code = first_significant_code(code + OP_lengths[c], NULL, 0))
- {
- c = *code;
-
- if (c >= OP_BRA)
- {
- BOOL empty_branch;
- if (GET(code, 1) == 0) return TRUE; /* Hit unclosed bracket */
-
- /* Scan a closed bracket */
-
- empty_branch = FALSE;
- do
- {
- if (!empty_branch && could_be_empty_branch(code, endcode))
- empty_branch = TRUE;
- code += GET(code, 1);
- }
- while (*code == OP_ALT);
- if (!empty_branch) return FALSE; /* All branches are non-empty */
- code += 1 + LINK_SIZE;
- c = *code;
- }
-
- /* Check for any quantifier after a class */
-
- else if (c == OP_CLASS)
- {
- const uschar *ccode = code + 33;
-
- switch (*ccode)
- {
- case OP_CRSTAR: /* These could be empty; continue */
- case OP_CRMINSTAR:
- case OP_CRQUERY:
- case OP_CRMINQUERY:
- break;
-
- default: /* Non-repeat => class must match */
- case OP_CRPLUS: /* These repeats aren't empty */
- case OP_CRMINPLUS:
- return FALSE;
-
- case OP_CRRANGE:
- case OP_CRMINRANGE:
- if (GET2(ccode, 1) > 0) return FALSE; /* Minimum > 0 */
- break;
- }
- }
-
- /* Test for an opcode that must match a character. */
-
- else switch (c)
- {
- case OP_NOT_DIGIT:
- case OP_DIGIT:
- case OP_NOT_WHITESPACE:
- case OP_WHITESPACE:
- case OP_NOT_WORDCHAR:
- case OP_WORDCHAR:
- case OP_ANY:
- case OP_ANYBYTE:
- case OP_CHARS:
- case OP_NOT:
- case OP_PLUS:
- case OP_MINPLUS:
- case OP_EXACT:
- case OP_NOTPLUS:
- case OP_NOTMINPLUS:
- case OP_NOTEXACT:
- case OP_TYPEPLUS:
- case OP_TYPEMINPLUS:
- case OP_TYPEEXACT:
- return FALSE;
-
- /* End of branch */
-
- case OP_KET:
- case OP_KETRMAX:
- case OP_KETRMIN:
- case OP_ALT:
- return TRUE;
- }
- }
-
-return TRUE;
-}
-
-
-
-/*************************************************
-* Scan compiled regex for non-emptiness *
-*************************************************/
-
-/* This function is called to check for left recursive calls. We want to check
-the current branch of the current pattern to see if it could match the empty
-string. If it could, we must look outwards for branches at other levels,
-stopping when we pass beyond the bracket which is the subject of the recursion.
-
-Arguments:
- code points to start of the recursion
- endcode points to where to stop (current RECURSE item)
- bcptr points to the chain of current (unclosed) branch starts
-
-Returns: TRUE if what is matched could be empty
-*/
-
-static BOOL
-could_be_empty(const uschar *code, const uschar *endcode, branch_chain *bcptr)
-{
-while (bcptr != NULL && bcptr->current >= code)
- {
- if (!could_be_empty_branch(bcptr->current, endcode)) return FALSE;
- bcptr = bcptr->outer;
- }
-return TRUE;
-}
-
-
-
-/*************************************************
-* Check for POSIX class syntax *
-*************************************************/
-
-/* This function is called when the sequence "[:" or "[." or "[=" is
-encountered in a character class. It checks whether this is followed by an
-optional ^ and then a sequence of letters, terminated by a matching ":]" or
-".]" or "=]".
-
-Argument:
- ptr pointer to the initial [
- endptr where to return the end pointer
- cd pointer to compile data
-
-Returns: TRUE or FALSE
-*/
-
-static BOOL
-check_posix_syntax(const uschar *ptr, const uschar **endptr, compile_data *cd)
-{
-int terminator; /* Don't combine these lines; the Solaris cc */
-terminator = *(++ptr); /* compiler warns about "non-constant" initializer. */
-if (*(++ptr) == '^') ptr++;
-while ((cd->ctypes[*ptr] & ctype_letter) != 0) ptr++;
-if (*ptr == terminator && ptr[1] == ']')
- {
- *endptr = ptr;
- return TRUE;
- }
-return FALSE;
-}
-
-
-
-
-/*************************************************
-* Check POSIX class name *
-*************************************************/
-
-/* This function is called to check the name given in a POSIX-style class entry
-such as [:alnum:].
-
-Arguments:
- ptr points to the first letter
- len the length of the name
-
-Returns: a value representing the name, or -1 if unknown
-*/
-
-static int
-check_posix_name(const uschar *ptr, int len)
-{
-register int yield = 0;
-while (posix_name_lengths[yield] != 0)
- {
- if (len == posix_name_lengths[yield] &&
- strncmp((const char *)ptr, posix_names[yield], len) == 0) return yield;
- yield++;
- }
-return -1;
-}
-
-
-
-
-/*************************************************
-* Compile one branch *
-*************************************************/
-
-/* Scan the pattern, compiling it into the code vector. If the options are
-changed during the branch, the pointer is used to change the external options
-bits.
-
-Arguments:
- optionsptr pointer to the option bits
- brackets points to number of extracting brackets used
- code points to the pointer to the current code point
- ptrptr points to the current pattern pointer
- errorptr points to pointer to error message
- firstcharptr set to initial literal character, or < 0 (REQ_UNSET, REQ_NONE)
- reqcharptr set to the last literal character required, else < 0
- bcptr points to current branch chain
- cd contains pointers to tables etc.
-
-Returns: TRUE on success
- FALSE, with *errorptr set on error
-*/
-
-static BOOL
-compile_branch(int *optionsptr, int *brackets, uschar **codeptr,
- const uschar **ptrptr, const char **errorptr, int *firstcharptr,
- int *reqcharptr, branch_chain *bcptr, compile_data *cd)
-{
-int repeat_type, op_type;
-int repeat_min = 0, repeat_max = 0; /* To please picky compilers */
-int bravalue = 0;
-int length;
-int greedy_default, greedy_non_default;
-int firstchar, reqchar;
-int zeroreqchar, zerofirstchar;
-int req_caseopt;
-int condcount = 0;
-int options = *optionsptr;
-register int c;
-register uschar *code = *codeptr;
-uschar *tempcode;
-BOOL inescq = FALSE;
-BOOL groupsetfirstchar = FALSE;
-const uschar *ptr = *ptrptr;
-const uschar *tempptr;
-uschar *previous = NULL;
-uschar class[32];
-
-/* Set up the default and non-default settings for greediness */
-
-greedy_default = ((options & PCRE_UNGREEDY) != 0);
-greedy_non_default = greedy_default ^ 1;
-
-/* Initialize no first char, no required char. REQ_UNSET means "no char
-matching encountered yet". It gets changed to REQ_NONE if we hit something that
-matches a non-fixed char first char; reqchar just remains unset if we never
-find one.
-
-When we hit a repeat whose minimum is zero, we may have to adjust these values
-to take the zero repeat into account. This is implemented by setting them to
-zerofirstchar and zeroreqchar when such a repeat is encountered. The individual
-item types that can be repeated set these backoff variables appropriately. */
-
-firstchar = reqchar = zerofirstchar = zeroreqchar = REQ_UNSET;
-
-/* The variable req_caseopt contains either the REQ_CASELESS value or zero,
-according to the current setting of the caseless flag. REQ_CASELESS is a bit
-value > 255. It is added into the firstchar or reqchar variables to record the
-case status of the value. */
-
-req_caseopt = ((options & PCRE_CASELESS) != 0)? REQ_CASELESS : 0;
-
-/* Switch on next character until the end of the branch */
-
-for (;; ptr++)
- {
- BOOL negate_class;
- BOOL possessive_quantifier;
- int class_charcount;
- int class_lastchar;
- int newoptions;
- int recno;
- int skipbytes;
- int subreqchar;
- int subfirstchar;
-
- c = *ptr;
- if (inescq && c != 0) goto NORMAL_CHAR;
-
- if ((options & PCRE_EXTENDED) != 0)
- {
- if ((cd->ctypes[c] & ctype_space) != 0) continue;
- if (c == '#')
- {
- /* The space before the ; is to avoid a warning on a silly compiler
- on the Macintosh. */
- while ((c = *(++ptr)) != 0 && c != NEWLINE) ;
- if (c != 0) continue; /* Else fall through to handle end of string */
- }
- }
-
- switch(c)
- {
- /* The branch terminates at end of string, |, or ). */
-
- case 0:
- case '|':
- case ')':
- *firstcharptr = firstchar;
- *reqcharptr = reqchar;
- *codeptr = code;
- *ptrptr = ptr;
- return TRUE;
-
- /* Handle single-character metacharacters. In multiline mode, ^ disables
- the setting of any following char as a first character. */
-
- case '^':
- if ((options & PCRE_MULTILINE) != 0)
- {
- if (firstchar == REQ_UNSET) firstchar = REQ_NONE;
- }
- previous = NULL;
- *code++ = OP_CIRC;
- break;
-
- case '$':
- previous = NULL;
- *code++ = OP_DOLL;
- break;
-
- /* There can never be a first char if '.' is first, whatever happens about
- repeats. The value of reqchar doesn't change either. */
-
- case '.':
- if (firstchar == REQ_UNSET) firstchar = REQ_NONE;
- zerofirstchar = firstchar;
- zeroreqchar = reqchar;
- previous = code;
- *code++ = OP_ANY;
- break;
-
- /* Character classes. These always build a 32-byte bitmap of the permitted
- characters, except in the special case where there is only one character.
- For negated classes, we build the map as usual, then invert it at the end.
- */
-
- case '[':
- previous = code;
- *code++ = OP_CLASS;
-
- /* PCRE supports POSIX class stuff inside a class. Perl gives an error if
- they are encountered at the top level, so we'll do that too. */
-
- if ((ptr[1] == ':' || ptr[1] == '.' || ptr[1] == '=') &&
- check_posix_syntax(ptr, &tempptr, cd))
- {
- *errorptr = (ptr[1] == ':')? ERR13 : ERR31;
- goto FAILED;
- }
-
- /* If the first character is '^', set the negation flag and skip it. */
-
- if ((c = *(++ptr)) == '^')
- {
- negate_class = TRUE;
- c = *(++ptr);
- }
- else negate_class = FALSE;
-
- /* Keep a count of chars so that we can optimize the case of just a single
- character. */
-
- class_charcount = 0;
- class_lastchar = -1;
-
- /* Initialize the 32-char bit map to all zeros. We have to build the
- map in a temporary bit of store, in case the class contains only 1
- character, because in that case the compiled code doesn't use the
- bit map. */
-
- memset(class, 0, 32 * sizeof(uschar));
-
- /* Process characters until ] is reached. By writing this as a "do" it
- means that an initial ] is taken as a data character. The first pass
- checked the overall syntax. */
-
- do
- {
- /* Handle POSIX class names. Perl allows a negation extension of the
- form [:^name:]. A square bracket that doesn't match the syntax is
- treated as a literal. We also recognize the POSIX constructions
- [.ch.] and [=ch=] ("collating elements") and fault them, as Perl
- 5.6 and 5.8 do. */
-
- if (c == '[' &&
- (ptr[1] == ':' || ptr[1] == '.' || ptr[1] == '=') &&
- check_posix_syntax(ptr, &tempptr, cd))
- {
- BOOL local_negate = FALSE;
- int posix_class, i;
- register const uschar *cbits = cd->cbits;
-
- if (ptr[1] != ':')
- {
- *errorptr = ERR31;
- goto FAILED;
- }
-
- ptr += 2;
- if (*ptr == '^')
- {
- local_negate = TRUE;
- ptr++;
- }
-
- posix_class = check_posix_name(ptr, tempptr - ptr);
- if (posix_class < 0)
- {
- *errorptr = ERR30;
- goto FAILED;
- }
-
- /* If matching is caseless, upper and lower are converted to
- alpha. This relies on the fact that the class table starts with
- alpha, lower, upper as the first 3 entries. */
-
- if ((options & PCRE_CASELESS) != 0 && posix_class <= 2)
- posix_class = 0;
-
- /* Or into the map we are building up to 3 of the static class
- tables, or their negations. The [:blank:] class sets up the same
- chars as the [:space:] class (all white space). We remove the vertical
- white space chars afterwards. */
-
- posix_class *= 3;
- for (i = 0; i < 3; i++)
- {
- BOOL isblank = strncmp(ptr, "blank", 5) == 0;
- int taboffset = posix_class_maps[posix_class + i];
- if (taboffset < 0) break;
- if (local_negate)
- {
- for (c = 0; c < 32; c++) class[c] |= ~cbits[c+taboffset];
- if (isblank) class[1] |= 0x3c;
- }
- else
- {
- for (c = 0; c < 32; c++) class[c] |= cbits[c+taboffset];
- if (isblank) class[1] &= ~0x3c;
- }
- }
-
- ptr = tempptr + 1;
- class_charcount = 10; /* Set > 1; assumes more than 1 per class */
- continue;
- }
-
- /* Backslash may introduce a single character, or it may introduce one
- of the specials, which just set a flag. Escaped items are checked for
- validity in the pre-compiling pass. The sequence \b is a special case.
- Inside a class (and only there) it is treated as backspace. Elsewhere
- it marks a word boundary. Other escapes have preset maps ready to
- or into the one we are building. We assume they have more than one
- character in them, so set class_count bigger than one. */
-
- if (c == '\\')
- {
- c = check_escape(&ptr, errorptr, *brackets, options, TRUE, cd);
- if (-c == ESC_b) c = '\b';
- else if (c < 0)
- {
- register const uschar *cbits = cd->cbits;
- class_charcount = 10; /* Greater than 1 is what matters */
- switch (-c)
- {
- case ESC_d:
- for (c = 0; c < 32; c++) class[c] |= cbits[c+cbit_digit];
- continue;
-
- case ESC_D:
- for (c = 0; c < 32; c++) class[c] |= ~cbits[c+cbit_digit];
- continue;
-
- case ESC_w:
- for (c = 0; c < 32; c++) class[c] |= cbits[c+cbit_word];
- continue;
-
- case ESC_W:
- for (c = 0; c < 32; c++) class[c] |= ~cbits[c+cbit_word];
- continue;
-
- case ESC_s:
- for (c = 0; c < 32; c++) class[c] |= cbits[c+cbit_space];
- class[1] &= ~0x08; /* Perl 5.004 onwards omits VT from \s */
- continue;
-
- case ESC_S:
- for (c = 0; c < 32; c++) class[c] |= ~cbits[c+cbit_space];
- class[1] |= 0x08; /* Perl 5.004 onwards omits VT from \s */
- continue;
-
- default:
- *errorptr = ERR7;
- goto FAILED;
- }
- }
-
- /* Fall through if single character, but don't at present allow
- chars > 255 in UTF-8 mode. */
-
-#ifdef SUPPORT_UTF8
- if (c > 255)
- {
- *errorptr = ERR33;
- goto FAILED;
- }
-#endif
- }
-
- /* A single character may be followed by '-' to form a range. However,
- Perl does not permit ']' to be the end of the range. A '-' character
- here is treated as a literal. */
-
- if (ptr[1] == '-' && ptr[2] != ']')
- {
- int d;
- ptr += 2;
- d = *ptr;
-
- /* The second part of a range can be a single-character escape, but
- not any of the other escapes. Perl 5.6 treats a hyphen as a literal
- in such circumstances. */
-
- if (d == '\\')
- {
- const uschar *oldptr = ptr;
- d = check_escape(&ptr, errorptr, *brackets, options, TRUE, cd);
-
-#ifdef SUPPORT_UTF8
- if (d > 255)
- {
- *errorptr = ERR33;
- goto FAILED;
- }
-#endif
- /* \b is backslash; any other special means the '-' was literal */
-
- if (d < 0)
- {
- if (d == -ESC_b) d = '\b'; else
- {
- ptr = oldptr - 2;
- goto SINGLE_CHARACTER; /* A few lines below */
- }
- }
- }
-
- if (d < c)
- {
- *errorptr = ERR8;
- goto FAILED;
- }
-
- for (; c <= d; c++)
- {
- class[c/8] |= (1 << (c&7));
- if ((options & PCRE_CASELESS) != 0)
- {
- int uc = cd->fcc[c]; /* flip case */
- class[uc/8] |= (1 << (uc&7));
- }
- class_charcount++; /* in case a one-char range */
- class_lastchar = c;
- }
- continue; /* Go get the next char in the class */
- }
-
- /* Handle a lone single character - we can get here for a normal
- non-escape char, or after \ that introduces a single character. */
-
- SINGLE_CHARACTER:
-
- class [c/8] |= (1 << (c&7));
- if ((options & PCRE_CASELESS) != 0)
- {
- c = cd->fcc[c]; /* flip case */
- class[c/8] |= (1 << (c&7));
- }
- class_charcount++;
- class_lastchar = c;
- }
-
- /* Loop until ']' reached; the check for end of string happens inside the
- loop. This "while" is the end of the "do" above. */
-
- while ((c = *(++ptr)) != ']');
-
- /* If class_charcount is 1 and class_lastchar is not negative, we saw
- precisely one character. This doesn't need the whole 32-byte bit map. We
- turn it into a 1-character OP_CHARS if it's positive, or OP_NOT if it's
- negative. In the positive case, it can cause firstchar to be set.
- Otherwise, there can be no first char if this item is first, whatever
- repeat count may follow. In the case of reqchar, save the previous value
- for reinstating. */
-
- if (class_charcount == 1 && class_lastchar >= 0)
- {
- zeroreqchar = reqchar;
- if (negate_class)
- {
- if (firstchar == REQ_UNSET) firstchar = REQ_NONE;
- zerofirstchar = firstchar;
- code[-1] = OP_NOT;
- }
- else
- {
- if (firstchar == REQ_UNSET)
- {
- zerofirstchar = REQ_NONE;
- firstchar = class_lastchar | req_caseopt;
- }
- else
- {
- zerofirstchar = firstchar;
- reqchar = class_lastchar | req_caseopt;
- }
- code[-1] = OP_CHARS;
- *code++ = 1;
- }
- *code++ = class_lastchar;
- }
-
- /* Otherwise, negate the 32-byte map if necessary, and copy it into
- the code vector. If this is the first thing in the branch, there can be
- no first char setting, whatever the repeat count. Any reqchar setting
- must remain unchanged after any kind of repeat. */
-
- else
- {
- if (firstchar == REQ_UNSET) firstchar = REQ_NONE;
- zerofirstchar = firstchar;
- zeroreqchar = reqchar;
- if (negate_class)
- for (c = 0; c < 32; c++) code[c] = ~class[c];
- else
- memcpy(code, class, 32);
- code += 32;
- }
- break;
-
- /* Various kinds of repeat */
-
- case '{':
- if (!is_counted_repeat(ptr+1, cd)) goto NORMAL_CHAR;
- ptr = read_repeat_counts(ptr+1, &repeat_min, &repeat_max, errorptr, cd);
- if (*errorptr != NULL) goto FAILED;
- goto REPEAT;
-
- case '*':
- repeat_min = 0;
- repeat_max = -1;
- goto REPEAT;
-
- case '+':
- repeat_min = 1;
- repeat_max = -1;
- goto REPEAT;
-
- case '?':
- repeat_min = 0;
- repeat_max = 1;
-
- REPEAT:
- if (previous == NULL)
- {
- *errorptr = ERR9;
- goto FAILED;
- }
-
- if (repeat_min == 0)
- {
- firstchar = zerofirstchar; /* Adjust for zero repeat */
- reqchar = zeroreqchar; /* Ditto */
- }
-
- op_type = 0; /* Default single-char op codes */
- possessive_quantifier = FALSE; /* Default not possessive quantifier */
-
- /* Save start of previous item, in case we have to move it up to make space
- for an inserted OP_ONCE for the additional '+' extension. */
-
- tempcode = previous;
-
- /* If the next character is '+', we have a possessive quantifier. This
- implies greediness, whatever the setting of the PCRE_UNGREEDY option.
- If the next character is '?' this is a minimizing repeat, by default,
- but if PCRE_UNGREEDY is set, it works the other way round. We change the
- repeat type to the non-default. */
-
- if (ptr[1] == '+')
- {
- repeat_type = 0; /* Force greedy */
- possessive_quantifier = TRUE;
- ptr++;
- }
- else if (ptr[1] == '?')
- {
- repeat_type = greedy_non_default;
- ptr++;
- }
- else repeat_type = greedy_default;
-
- /* If previous was a recursion, we need to wrap it inside brackets so that
- it can be replicated if necessary. */
-
- if (*previous == OP_RECURSE)
- {
- memmove(previous + 1 + LINK_SIZE, previous, 1 + LINK_SIZE);
- code += 1 + LINK_SIZE;
- *previous = OP_BRA;
- PUT(previous, 1, code - previous);
- *code = OP_KET;
- PUT(code, 1, code - previous);
- code += 1 + LINK_SIZE;
- }
-
- /* If previous was a string of characters, chop off the last one and use it
- as the subject of the repeat. If there was only one character, we can
- abolish the previous item altogether. If a one-char item has a minumum of
- more than one, ensure that it is set in reqchar - it might not be if a
- sequence such as x{3} is the first thing in a branch because the x will
- have gone into firstchar instead. */
-
- if (*previous == OP_CHARS)
- {
- int len = previous[1];
- if (len == 1)
- {
- c = previous[2];
- code = previous;
- if (repeat_min > 1) reqchar = c | req_caseopt;
- }
- else
- {
- c = previous[len+1];
- previous[1]--;
- code--;
- tempcode = code; /* Adjust position to be moved for '+' */
- }
-
- goto OUTPUT_SINGLE_REPEAT; /* Code shared with single character types */
- }
-
- /* If previous was a single negated character ([^a] or similar), we use
- one of the special opcodes, replacing it. The code is shared with single-
- character repeats by setting opt_type to add a suitable offset into
- repeat_type. */
-
- else if (*previous == OP_NOT)
- {
- op_type = OP_NOTSTAR - OP_STAR; /* Use "not" opcodes */
- c = previous[1];
- code = previous;
- goto OUTPUT_SINGLE_REPEAT;
- }
-
- /* If previous was a character type match (\d or similar), abolish it and
- create a suitable repeat item. The code is shared with single-character
- repeats by setting op_type to add a suitable offset into repeat_type. */
-
- else if (*previous < OP_EODN)
- {
- op_type = OP_TYPESTAR - OP_STAR; /* Use type opcodes */
- c = *previous;
- code = previous;
-
- OUTPUT_SINGLE_REPEAT:
-
- /* If the maximum is zero then the minimum must also be zero; Perl allows
- this case, so we do too - by simply omitting the item altogether. */
-
- if (repeat_max == 0) goto END_REPEAT;
-
- /* Combine the op_type with the repeat_type */
-
- repeat_type += op_type;
-
- /* A minimum of zero is handled either as the special case * or ?, or as
- an UPTO, with the maximum given. */
-
- if (repeat_min == 0)
- {
- if (repeat_max == -1) *code++ = OP_STAR + repeat_type;
- else if (repeat_max == 1) *code++ = OP_QUERY + repeat_type;
- else
- {
- *code++ = OP_UPTO + repeat_type;
- PUT2INC(code, 0, repeat_max);
- }
- }
-
- /* The case {1,} is handled as the special case + */
-
- else if (repeat_min == 1 && repeat_max == -1)
- *code++ = OP_PLUS + repeat_type;
-
- /* The case {n,n} is just an EXACT, while the general case {n,m} is
- handled as an EXACT followed by an UPTO. An EXACT of 1 is optimized. */
-
- else
- {
- if (repeat_min != 1)
- {
- *code++ = OP_EXACT + op_type; /* NB EXACT doesn't have repeat_type */
- PUT2INC(code, 0, repeat_min);
- }
-
- /* If the mininum is 1 and the previous item was a character string,
- we either have to put back the item that got cancelled if the string
- length was 1, or add the character back onto the end of a longer
- string. For a character type nothing need be done; it will just get
- put back naturally. Note that the final character is always going to
- get added below. */
-
- else if (*previous == OP_CHARS)
- {
- if (code == previous) code += 2; else previous[1]++;
- }
-
- /* For a single negated character we also have to put back the
- item that got cancelled. */
-
- else if (*previous == OP_NOT) code++;
-
- /* If the maximum is unlimited, insert an OP_STAR. */
-
- if (repeat_max < 0)
- {
- *code++ = c;
- *code++ = OP_STAR + repeat_type;
- }
-
- /* Else insert an UPTO if the max is greater than the min. */
-
- else if (repeat_max != repeat_min)
- {
- *code++ = c;
- repeat_max -= repeat_min;
- *code++ = OP_UPTO + repeat_type;
- PUT2INC(code, 0, repeat_max);
- }
- }
-
- /* The character or character type itself comes last in all cases. */
-
- *code++ = c;
- }
-
- /* If previous was a character class or a back reference, we put the repeat
- stuff after it, but just skip the item if the repeat was {0,0}. */
-
- else if (*previous == OP_CLASS || *previous == OP_REF)
- {
- if (repeat_max == 0)
- {
- code = previous;
- goto END_REPEAT;
- }
- if (repeat_min == 0 && repeat_max == -1)
- *code++ = OP_CRSTAR + repeat_type;
- else if (repeat_min == 1 && repeat_max == -1)
- *code++ = OP_CRPLUS + repeat_type;
- else if (repeat_min == 0 && repeat_max == 1)
- *code++ = OP_CRQUERY + repeat_type;
- else
- {
- *code++ = OP_CRRANGE + repeat_type;
- PUT2INC(code, 0, repeat_min);
- if (repeat_max == -1) repeat_max = 0; /* 2-byte encoding for max */
- PUT2INC(code, 0, repeat_max);
- }
- }
-
- /* If previous was a bracket group, we may have to replicate it in certain
- cases. */
-
- else if (*previous >= OP_BRA || *previous == OP_ONCE ||
- *previous == OP_COND)
- {
- register int i;
- int ketoffset = 0;
- int len = code - previous;
- uschar *bralink = NULL;
-
- /* If the maximum repeat count is unlimited, find the end of the bracket
- by scanning through from the start, and compute the offset back to it
- from the current code pointer. There may be an OP_OPT setting following
- the final KET, so we can't find the end just by going back from the code
- pointer. */
-
- if (repeat_max == -1)
- {
- register uschar *ket = previous;
- do ket += GET(ket, 1); while (*ket != OP_KET);
- ketoffset = code - ket;
- }
-
- /* The case of a zero minimum is special because of the need to stick
- OP_BRAZERO in front of it, and because the group appears once in the
- data, whereas in other cases it appears the minimum number of times. For
- this reason, it is simplest to treat this case separately, as otherwise
- the code gets far too messy. There are several special subcases when the
- minimum is zero. */
-
- if (repeat_min == 0)
- {
- /* If the maximum is also zero, we just omit the group from the output
- altogether. */
-
- if (repeat_max == 0)
- {
- code = previous;
- goto END_REPEAT;
- }
-
- /* If the maximum is 1 or unlimited, we just have to stick in the
- BRAZERO and do no more at this point. */
-
- if (repeat_max <= 1)
- {
- memmove(previous+1, previous, len);
- code++;
- *previous++ = OP_BRAZERO + repeat_type;
- }
-
- /* If the maximum is greater than 1 and limited, we have to replicate
- in a nested fashion, sticking OP_BRAZERO before each set of brackets.
- The first one has to be handled carefully because it's the original
- copy, which has to be moved up. The remainder can be handled by code
- that is common with the non-zero minimum case below. We just have to
- adjust the value or repeat_max, since one less copy is required. */
-
- else
- {
- int offset;
- memmove(previous + 2 + LINK_SIZE, previous, len);
- code += 2 + LINK_SIZE;
- *previous++ = OP_BRAZERO + repeat_type;
- *previous++ = OP_BRA;
-
- /* We chain together the bracket offset fields that have to be
- filled in later when the ends of the brackets are reached. */
-
- offset = (bralink == NULL)? 0 : previous - bralink;
- bralink = previous;
- PUTINC(previous, 0, offset);
- }
-
- repeat_max--;
- }
-
- /* If the minimum is greater than zero, replicate the group as many
- times as necessary, and adjust the maximum to the number of subsequent
- copies that we need. If we set a first char from the group, and didn't
- set a required char, copy the latter from the former. */
-
- else
- {
- if (repeat_min > 1)
- {
- if (groupsetfirstchar && reqchar < 0) reqchar = firstchar;
- for (i = 1; i < repeat_min; i++)
- {
- memcpy(code, previous, len);
- code += len;
- }
- }
- if (repeat_max > 0) repeat_max -= repeat_min;
- }
-
- /* This code is common to both the zero and non-zero minimum cases. If
- the maximum is limited, it replicates the group in a nested fashion,
- remembering the bracket starts on a stack. In the case of a zero minimum,
- the first one was set up above. In all cases the repeat_max now specifies
- the number of additional copies needed. */
-
- if (repeat_max >= 0)
- {
- for (i = repeat_max - 1; i >= 0; i--)
- {
- *code++ = OP_BRAZERO + repeat_type;
-
- /* All but the final copy start a new nesting, maintaining the
- chain of brackets outstanding. */
-
- if (i != 0)
- {
- int offset;
- *code++ = OP_BRA;
- offset = (bralink == NULL)? 0 : code - bralink;
- bralink = code;
- PUTINC(code, 0, offset);
- }
-
- memcpy(code, previous, len);
- code += len;
- }
-
- /* Now chain through the pending brackets, and fill in their length
- fields (which are holding the chain links pro tem). */
-
- while (bralink != NULL)
- {
- int oldlinkoffset;
- int offset = code - bralink + 1;
- uschar *bra = code - offset;
- oldlinkoffset = GET(bra, 1);
- bralink = (oldlinkoffset == 0)? NULL : bralink - oldlinkoffset;
- *code++ = OP_KET;
- PUTINC(code, 0, offset);
- PUT(bra, 1, offset);
- }
- }
-
- /* If the maximum is unlimited, set a repeater in the final copy. We
- can't just offset backwards from the current code point, because we
- don't know if there's been an options resetting after the ket. The
- correct offset was computed above. */
-
- else code[-ketoffset] = OP_KETRMAX + repeat_type;
- }
-
- /* Else there's some kind of shambles */
-
- else
- {
- *errorptr = ERR11;
- goto FAILED;
- }
-
- /* If the character following a repeat is '+', we wrap the entire repeated
- item inside OP_ONCE brackets. This is just syntactic sugar, taken from
- Sun's Java package. The repeated item starts at tempcode, not at previous,
- which might be the first part of a string whose (former) last char we
- repeated. However, we don't support '+' after a greediness '?'. */
-
- if (possessive_quantifier)
- {
- int len = code - tempcode;
- memmove(tempcode + 1+LINK_SIZE, tempcode, len);
- code += 1 + LINK_SIZE;
- len += 1 + LINK_SIZE;
- tempcode[0] = OP_ONCE;
- *code++ = OP_KET;
- PUTINC(code, 0, len);
- PUT(tempcode, 1, len);
- }
-
- /* In all case we no longer have a previous item. */
-
- END_REPEAT:
- previous = NULL;
- break;
-
-
- /* Start of nested bracket sub-expression, or comment or lookahead or
- lookbehind or option setting or condition. First deal with special things
- that can come after a bracket; all are introduced by ?, and the appearance
- of any of them means that this is not a referencing group. They were
- checked for validity in the first pass over the string, so we don't have to
- check for syntax errors here. */
-
- case '(':
- newoptions = options;
- skipbytes = 0;
-
- if (*(++ptr) == '?')
- {
- int set, unset;
- int *optset;
-
- switch (*(++ptr))
- {
- case '#': /* Comment; skip to ket */
- ptr++;
- while (*ptr != ')') ptr++;
- continue;
-
- case ':': /* Non-extracting bracket */
- bravalue = OP_BRA;
- ptr++;
- break;
-
- case '(':
- bravalue = OP_COND; /* Conditional group */
-
- /* Condition to test for recursion */
-
- if (ptr[1] == 'R')
- {
- code[1+LINK_SIZE] = OP_CREF;
- PUT2(code, 2+LINK_SIZE, CREF_RECURSE);
- skipbytes += 1+LINK_SIZE;
- ptr += 3;
- }
-
- /* Condition to test for a numbered subpattern match */
-
- else if ((cd->ctypes[ptr[1]] & ctype_digit) != 0)
- {
- int condref = *(++ptr) - '0';
- while (*(++ptr) != ')') condref = condref*10 + *ptr - '0';
- if (condref == 0)
- {
- *errorptr = ERR35;
- goto FAILED;
- }
- ptr++;
- code[1+LINK_SIZE] = OP_CREF;
- PUT2(code, 2+LINK_SIZE, condref);
- skipbytes = 3;
- }
- /* For conditions that are assertions, we just fall through, having
- set bravalue above. */
- break;
-
- case '=': /* Positive lookahead */
- bravalue = OP_ASSERT;
- ptr++;
- break;
-
- case '!': /* Negative lookahead */
- bravalue = OP_ASSERT_NOT;
- ptr++;
- break;
-
- case '<': /* Lookbehinds */
- switch (*(++ptr))
- {
- case '=': /* Positive lookbehind */
- bravalue = OP_ASSERTBACK;
- ptr++;
- break;
-
- case '!': /* Negative lookbehind */
- bravalue = OP_ASSERTBACK_NOT;
- ptr++;
- break;
- }
- break;
-
- case '>': /* One-time brackets */
- bravalue = OP_ONCE;
- ptr++;
- break;
-
- case 'C': /* Callout - may be followed by digits */
- *code++ = OP_CALLOUT;
- {
- int n = 0;
- while ((cd->ctypes[*(++ptr)] & ctype_digit) != 0)
- n = n * 10 + *ptr - '0';
- if (n > 255)
- {
- *errorptr = ERR38;
- goto FAILED;
- }
- *code++ = n;
- }
- previous = NULL;
- continue;
-
- case 'P': /* Named subpattern handling */
- if (*(++ptr) == '<') /* Definition */
- {
- int i, namelen;
- const uschar *name = ++ptr;
- uschar *slot = cd->name_table;
-
- while (*ptr++ != '>');
- namelen = ptr - name - 1;
-
- for (i = 0; i < cd->names_found; i++)
- {
- int c = strncmp(name, slot+2, namelen);
- if (c == 0)
- {
- *errorptr = ERR43;
- goto FAILED;
- }
- if (c < 0)
- {
- memmove(slot + cd->name_entry_size, slot,
- (cd->names_found - i) * cd->name_entry_size);
- break;
- }
- slot += cd->name_entry_size;
- }
-
- PUT2(slot, 0, *brackets + 1);
- memcpy(slot + 2, name, namelen);
- slot[2+namelen] = 0;
- cd->names_found++;
- goto NUMBERED_GROUP;
- }
-
- if (*ptr == '=' || *ptr == '>') /* Reference or recursion */
- {
- int i, namelen;
- int type = *ptr++;
- const uschar *name = ptr;
- uschar *slot = cd->name_table;
-
- while (*ptr != ')') ptr++;
- namelen = ptr - name;
-
- for (i = 0; i < cd->names_found; i++)
- {
- if (strncmp(name, slot+2, namelen) == 0) break;
- slot += cd->name_entry_size;
- }
- if (i >= cd->names_found)
- {
- *errorptr = ERR15;
- goto FAILED;
- }
-
- recno = GET2(slot, 0);
-
- if (type == '>') goto HANDLE_RECURSION; /* A few lines below */
-
- /* Back reference */
-
- previous = code;
- *code++ = OP_REF;
- PUT2INC(code, 0, recno);
- continue;
- }
-
- /* Should never happen */
- break;
-
- case 'R': /* Pattern recursion */
- ptr++; /* Same as (?0) */
- /* Fall through */
-
- /* Recursion or "subroutine" call */
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- {
- const uschar *called;
- recno = 0;
-
- while ((cd->ctypes[*ptr] & ctype_digit) != 0)
- recno = recno * 10 + *ptr++ - '0';
-
- /* Come here from code above that handles a named recursion */
-
- HANDLE_RECURSION:
-
- previous = code;
-
- /* Find the bracket that is being referenced. Temporarily end the
- regex in case it doesn't exist. */
-
- *code = OP_END;
- called = (recno == 0)?
- cd->start_code : find_bracket(cd->start_code, recno);
- if (called == NULL)
- {
- *errorptr = ERR15;
- goto FAILED;
- }
-
- /* If the subpattern is still open, this is a recursive call. We
- check to see if this is a left recursion that could loop for ever,
- and diagnose that case. */
-
- if (GET(called, 1) == 0 && could_be_empty(called, code, bcptr))
- {
- *errorptr = ERR40;
- goto FAILED;
- }
-
- /* Insert the recursion/subroutine item */
-
- *code = OP_RECURSE;
- PUT(code, 1, called - cd->start_code);
- code += 1 + LINK_SIZE;
- }
- continue;
-
- /* Character after (? not specially recognized */
-
- default: /* Option setting */
- set = unset = 0;
- optset = &set;
-
- while (*ptr != ')' && *ptr != ':')
- {
- switch (*ptr++)
- {
- case '-': optset = &unset; break;
-
- case 'i': *optset |= PCRE_CASELESS; break;
- case 'm': *optset |= PCRE_MULTILINE; break;
- case 's': *optset |= PCRE_DOTALL; break;
- case 'x': *optset |= PCRE_EXTENDED; break;
- case 'U': *optset |= PCRE_UNGREEDY; break;
- case 'X': *optset |= PCRE_EXTRA; break;
- }
- }
-
- /* Set up the changed option bits, but don't change anything yet. */
-
- newoptions = (options | set) & (~unset);
-
- /* If the options ended with ')' this is not the start of a nested
- group with option changes, so the options change at this level. Compile
- code to change the ims options if this setting actually changes any of
- them. We also pass the new setting back so that it can be put at the
- start of any following branches, and when this group ends (if we are in
- a group), a resetting item can be compiled.
-
- Note that if this item is right at the start of the pattern, the
- options will have been abstracted and made global, so there will be no
- change to compile. */
-
- if (*ptr == ')')
- {
- if ((options & PCRE_IMS) != (newoptions & PCRE_IMS))
- {
- *code++ = OP_OPT;
- *code++ = newoptions & PCRE_IMS;
- }
-
- /* Change options at this level, and pass them back for use
- in subsequent branches. Reset the greedy defaults and the case
- value for firstchar and reqchar. */
-
- *optionsptr = options = newoptions;
- greedy_default = ((newoptions & PCRE_UNGREEDY) != 0);
- greedy_non_default = greedy_default ^ 1;
- req_caseopt = ((options & PCRE_CASELESS) != 0)? REQ_CASELESS : 0;
-
- previous = NULL; /* This item can't be repeated */
- continue; /* It is complete */
- }
-
- /* If the options ended with ':' we are heading into a nested group
- with possible change of options. Such groups are non-capturing and are
- not assertions of any kind. All we need to do is skip over the ':';
- the newoptions value is handled below. */
-
- bravalue = OP_BRA;
- ptr++;
- }
- }
-
- /* Else we have a referencing group; adjust the opcode. If the bracket
- number is greater than EXTRACT_BASIC_MAX, we set the opcode one higher, and
- arrange for the true number to follow later, in an OP_BRANUMBER item. */
-
- else
- {
- NUMBERED_GROUP:
- if (++(*brackets) > EXTRACT_BASIC_MAX)
- {
- bravalue = OP_BRA + EXTRACT_BASIC_MAX + 1;
- code[1+LINK_SIZE] = OP_BRANUMBER;
- PUT2(code, 2+LINK_SIZE, *brackets);
- skipbytes = 3;
- }
- else bravalue = OP_BRA + *brackets;
- }
-
- /* Process nested bracketed re. Assertions may not be repeated, but other
- kinds can be. We copy code into a non-register variable in order to be able
- to pass its address because some compilers complain otherwise. Pass in a
- new setting for the ims options if they have changed. */
-
- previous = (bravalue >= OP_ONCE)? code : NULL;
- *code = bravalue;
- tempcode = code;
-
- if (!compile_regex(
- newoptions, /* The complete new option state */
- options & PCRE_IMS, /* The previous ims option state */
- brackets, /* Extracting bracket count */
- &tempcode, /* Where to put code (updated) */
- &ptr, /* Input pointer (updated) */
- errorptr, /* Where to put an error message */
- (bravalue == OP_ASSERTBACK ||
- bravalue == OP_ASSERTBACK_NOT), /* TRUE if back assert */
- skipbytes, /* Skip over OP_COND/OP_BRANUMBER */
- &subfirstchar, /* For possible first char */
- &subreqchar, /* For possible last char */
- bcptr, /* Current branch chain */
- cd)) /* Tables block */
- goto FAILED;
-
- /* At the end of compiling, code is still pointing to the start of the
- group, while tempcode has been updated to point past the end of the group
- and any option resetting that may follow it. The pattern pointer (ptr)
- is on the bracket. */
-
- /* If this is a conditional bracket, check that there are no more than
- two branches in the group. */
-
- else if (bravalue == OP_COND)
- {
- uschar *tc = code;
- condcount = 0;
-
- do {
- condcount++;
- tc += GET(tc,1);
- }
- while (*tc != OP_KET);
-
- if (condcount > 2)
- {
- *errorptr = ERR27;
- goto FAILED;
- }
-
- /* If there is just one branch, we must not make use of its firstchar or
- reqchar, because this is equivalent to an empty second branch. */
-
- if (condcount == 1) subfirstchar = subreqchar = REQ_NONE;
- }
-
- /* Handle updating of the required and first characters. Update for normal
- brackets of all kinds, and conditions with two branches (see code above).
- If the bracket is followed by a quantifier with zero repeat, we have to
- back off. Hence the definition of zeroreqchar and zerofirstchar outside the
- main loop so that they can be accessed for the back off. */
-
- zeroreqchar = reqchar;
- zerofirstchar = firstchar;
- groupsetfirstchar = FALSE;
-
- if (bravalue >= OP_BRA || bravalue == OP_ONCE || bravalue == OP_COND)
- {
- /* If we have not yet set a firstchar in this branch, take it from the
- subpattern, remembering that it was set here so that a repeat of more
- than one can replicate it as reqchar if necessary. If the subpattern has
- no firstchar, set "none" for the whole branch. In both cases, a zero
- repeat forces firstchar to "none". */
-
- if (firstchar == REQ_UNSET)
- {
- if (subfirstchar >= 0)
- {
- firstchar = subfirstchar;
- groupsetfirstchar = TRUE;
- }
- else firstchar = REQ_NONE;
- zerofirstchar = REQ_NONE;
- }
-
- /* If firstchar was previously set, convert the subpattern's firstchar
- into reqchar if there wasn't one. */
-
- else if (subfirstchar >= 0 && subreqchar < 0) subreqchar = subfirstchar;
-
- /* If the subpattern set a required char (or set a first char that isn't
- really the first char - see above), set it. */
-
- if (subreqchar >= 0) reqchar = subreqchar;
- }
-
- /* For a forward assertion, we take the reqchar, if set. This can be
- helpful if the pattern that follows the assertion doesn't set a different
- char. For example, it's useful for /(?=abcde).+/. We can't set firstchar
- for an assertion, however because it leads to incorrect effect for patterns
- such as /(?=a)a.+/ when the "real" "a" would then become a reqchar instead
- of a firstchar. This is overcome by a scan at the end if there's no
- firstchar, looking for an asserted first char. */
-
- else if (bravalue == OP_ASSERT && subreqchar >= 0) reqchar = subreqchar;
-
- /* Now update the main code pointer to the end of the group. */
-
- code = tempcode;
-
- /* Error if hit end of pattern */
-
- if (*ptr != ')')
- {
- *errorptr = ERR14;
- goto FAILED;
- }
- break;
-
- /* Check \ for being a real metacharacter; if not, fall through and handle
- it as a data character at the start of a string. Escape items are checked
- for validity in the pre-compiling pass. */
-
- case '\\':
- tempptr = ptr;
- c = check_escape(&ptr, errorptr, *brackets, options, FALSE, cd);
-
- /* Handle metacharacters introduced by \. For ones like \d, the ESC_ values
- are arranged to be the negation of the corresponding OP_values. For the
- back references, the values are ESC_REF plus the reference number. Only
- back references and those types that consume a character may be repeated.
- We can test for values between ESC_b and ESC_Z for the latter; this may
- have to change if any new ones are ever created. */
-
- if (c < 0)
- {
- if (-c == ESC_Q) /* Handle start of quoted string */
- {
- if (ptr[1] == '\\' && ptr[2] == 'E') ptr += 2; /* avoid empty string */
- else inescq = TRUE;
- continue;
- }
-
- /* For metasequences that actually match a character, we disable the
- setting of a first character if it hasn't already been set. */
-
- if (firstchar == REQ_UNSET && -c > ESC_b && -c < ESC_Z)
- firstchar = REQ_NONE;
-
- /* Set values to reset to if this is followed by a zero repeat. */
-
- zerofirstchar = firstchar;
- zeroreqchar = reqchar;
-
- /* Back references are handled specially */
-
- if (-c >= ESC_REF)
- {
- int number = -c - ESC_REF;
- previous = code;
- *code++ = OP_REF;
- PUT2INC(code, 0, number);
- }
- else
- {
- previous = (-c > ESC_b && -c < ESC_Z)? code : NULL;
- *code++ = -c;
- }
- continue;
- }
-
- /* Data character: reset and fall through */
-
- ptr = tempptr;
- c = '\\';
-
- /* Handle a run of data characters until a metacharacter is encountered.
- The first character is guaranteed not to be whitespace or # when the
- extended flag is set. */
-
- NORMAL_CHAR:
- default:
- previous = code;
- *code = OP_CHARS;
- code += 2;
- length = 0;
-
- do
- {
- /* If in \Q...\E, check for the end; if not, we always have a literal */
-
- if (inescq)
- {
- if (c == '\\' && ptr[1] == 'E')
- {
- inescq = FALSE;
- ptr++;
- }
- else
- {
- *code++ = c;
- length++;
- }
- continue;
- }
-
- /* Skip white space and comments for /x patterns */
-
- if ((options & PCRE_EXTENDED) != 0)
- {
- if ((cd->ctypes[c] & ctype_space) != 0) continue;
- if (c == '#')
- {
- /* The space before the ; is to avoid a warning on a silly compiler
- on the Macintosh. */
- while ((c = *(++ptr)) != 0 && c != NEWLINE) ;
- if (c == 0) break;
- continue;
- }
- }
-
- /* Backslash may introduce a data char or a metacharacter. Escaped items
- are checked for validity in the pre-compiling pass. Stop the string
- before a metaitem. */
-
- if (c == '\\')
- {
- tempptr = ptr;
- c = check_escape(&ptr, errorptr, *brackets, options, FALSE, cd);
- if (c < 0) { ptr = tempptr; break; }
-
- /* If a character is > 127 in UTF-8 mode, we have to turn it into
- two or more characters in the UTF-8 encoding. */
-
-#ifdef SUPPORT_UTF8
- if (c > 127 && (options & PCRE_UTF8) != 0)
- {
- uschar buffer[8];
- int len = ord2utf8(c, buffer);
- for (c = 0; c < len; c++) *code++ = buffer[c];
- length += len;
- continue;
- }
-#endif
- }
-
- /* Ordinary character or single-char escape */
-
- *code++ = c;
- length++;
- }
-
- /* This "while" is the end of the "do" above. */
-
- while (length < MAXLIT && (cd->ctypes[c = *(++ptr)] & ctype_meta) == 0);
-
- /* Update the first and last character */
-
- if (firstchar == REQ_UNSET)
- {
- if (length > 1)
- {
- zerofirstchar = firstchar = previous[2] | req_caseopt;
- zeroreqchar = (length > 2)? (code[-2] | req_caseopt) : reqchar;
- reqchar = code[-1] | req_caseopt;
- }
- else
- {
- zerofirstchar = REQ_NONE;
- firstchar = code[-1] | req_caseopt;
- zeroreqchar = reqchar;
- }
- }
- else /* firstchar previously set */
- {
- zerofirstchar = firstchar;
- zeroreqchar = (length > 1)? (code[-2] | req_caseopt) : reqchar;
- reqchar = code[-1] | req_caseopt;
- }
-
- /* Set the length in the data vector, and advance to the next state. */
-
- previous[1] = length;
- if (length < MAXLIT) ptr--;
- break;
- }
- } /* end of big loop */
-
-/* Control never reaches here by falling through, only by a goto for all the
-error states. Pass back the position in the pattern so that it can be displayed
-to the user for diagnosing the error. */
-
-FAILED:
-*ptrptr = ptr;
-return FALSE;
-}
-
-
-
-
-/*************************************************
-* Compile sequence of alternatives *
-*************************************************/
-
-/* On entry, ptr is pointing past the bracket character, but on return
-it points to the closing bracket, or vertical bar, or end of string.
-The code variable is pointing at the byte into which the BRA operator has been
-stored. If the ims options are changed at the start (for a (?ims: group) or
-during any branch, we need to insert an OP_OPT item at the start of every
-following branch to ensure they get set correctly at run time, and also pass
-the new options into every subsequent branch compile.
-
-Argument:
- options option bits, including any changes for this subpattern
- oldims previous settings of ims option bits
- brackets -> int containing the number of extracting brackets used
- codeptr -> the address of the current code pointer
- ptrptr -> the address of the current pattern pointer
- errorptr -> pointer to error message
- lookbehind TRUE if this is a lookbehind assertion
- skipbytes skip this many bytes at start (for OP_COND, OP_BRANUMBER)
- firstcharptr place to put the first required character, or a negative number
- reqcharptr place to put the last required character, or a negative number
- bcptr pointer to the chain of currently open branches
- cd points to the data block with tables pointers etc.
-
-Returns: TRUE on success
-*/
-
-static BOOL
-compile_regex(int options, int oldims, int *brackets, uschar **codeptr,
- const uschar **ptrptr, const char **errorptr, BOOL lookbehind, int skipbytes,
- int *firstcharptr, int *reqcharptr, branch_chain *bcptr, compile_data *cd)
-{
-const uschar *ptr = *ptrptr;
-uschar *code = *codeptr;
-uschar *last_branch = code;
-uschar *start_bracket = code;
-uschar *reverse_count = NULL;
-int firstchar, reqchar;
-int branchfirstchar, branchreqchar;
-branch_chain bc;
-
-bc.outer = bcptr;
-bc.current = code;
-
-firstchar = reqchar = REQ_UNSET;
-
-/* Offset is set zero to mark that this bracket is still open */
-
-PUT(code, 1, 0);
-code += 1 + LINK_SIZE + skipbytes;
-
-/* Loop for each alternative branch */
-
-for (;;)
- {
- /* Handle a change of ims options at the start of the branch */
-
- if ((options & PCRE_IMS) != oldims)
- {
- *code++ = OP_OPT;
- *code++ = options & PCRE_IMS;
- }
-
- /* Set up dummy OP_REVERSE if lookbehind assertion */
-
- if (lookbehind)
- {
- *code++ = OP_REVERSE;
- reverse_count = code;
- PUTINC(code, 0, 0);
- }
-
- /* Now compile the branch */
-
- if (!compile_branch(&options, brackets, &code, &ptr, errorptr,
- &branchfirstchar, &branchreqchar, &bc, cd))
- {
- *ptrptr = ptr;
- return FALSE;
- }
-
- /* If this is the first branch, the firstchar and reqchar values for the
- branch become the values for the regex. */
-
- if (*last_branch != OP_ALT)
- {
- firstchar = branchfirstchar;
- reqchar = branchreqchar;
- }
-
- /* If this is not the first branch, the first char and reqchar have to
- match the values from all the previous branches. */
-
- else
- {
- /* If we previously had a firstchar, but it doesn't match the new branch,
- we have to abandon the firstchar for the regex, but if there was previously
- no reqchar, it takes on the value of the old firstchar. */
-
- if (firstchar >= 0 && firstchar != branchfirstchar)
- {
- if (reqchar < 0) reqchar = firstchar;
- firstchar = REQ_NONE;
- }
-
- /* If we (now or from before) have no firstchar, a firstchar from the
- branch becomes a reqchar if there isn't a branch reqchar. */
-
- if (firstchar < 0 && branchfirstchar >= 0 && branchreqchar < 0)
- branchreqchar = branchfirstchar;
-
- /* Now ensure that the reqchars match */
-
- if (reqchar != branchreqchar) reqchar = REQ_NONE;
- }
-
- /* If lookbehind, check that this branch matches a fixed-length string,
- and put the length into the OP_REVERSE item. Temporarily mark the end of
- the branch with OP_END. */
-
- if (lookbehind)
- {
- int length;
- *code = OP_END;
- length = find_fixedlength(last_branch, options);
- DPRINTF(("fixed length = %d\n", length));
- if (length < 0)
- {
- *errorptr = (length == -2)? ERR36 : ERR25;
- *ptrptr = ptr;
- return FALSE;
- }
- PUT(reverse_count, 0, length);
- }
-
- /* Reached end of expression, either ')' or end of pattern. Go back through
- the alternative branches and reverse the chain of offsets, with the field in
- the BRA item now becoming an offset to the first alternative. If there are
- no alternatives, it points to the end of the group. The length in the
- terminating ket is always the length of the whole bracketed item. If any of
- the ims options were changed inside the group, compile a resetting op-code
- following, except at the very end of the pattern. Return leaving the pointer
- at the terminating char. */
-
- if (*ptr != '|')
- {
- int length = code - last_branch;
- do
- {
- int prev_length = GET(last_branch, 1);
- PUT(last_branch, 1, length);
- length = prev_length;
- last_branch -= length;
- }
- while (length > 0);
-
- /* Fill in the ket */
-
- *code = OP_KET;
- PUT(code, 1, code - start_bracket);
- code += 1 + LINK_SIZE;
-
- /* Resetting option if needed */
-
- if ((options & PCRE_IMS) != oldims && *ptr == ')')
- {
- *code++ = OP_OPT;
- *code++ = oldims;
- }
-
- /* Set values to pass back */
-
- *codeptr = code;
- *ptrptr = ptr;
- *firstcharptr = firstchar;
- *reqcharptr = reqchar;
- return TRUE;
- }
-
- /* Another branch follows; insert an "or" node. Its length field points back
- to the previous branch while the bracket remains open. At the end the chain
- is reversed. It's done like this so that the start of the bracket has a
- zero offset until it is closed, making it possible to detect recursion. */
-
- *code = OP_ALT;
- PUT(code, 1, code - last_branch);
- bc.current = last_branch = code;
- code += 1 + LINK_SIZE;
- ptr++;
- }
-/* Control never reaches here */
-}
-
-
-
-
-/*************************************************
-* Check for anchored expression *
-*************************************************/
-
-/* Try to find out if this is an anchored regular expression. Consider each
-alternative branch. If they all start with OP_SOD or OP_CIRC, or with a bracket
-all of whose alternatives start with OP_SOD or OP_CIRC (recurse ad lib), then
-it's anchored. However, if this is a multiline pattern, then only OP_SOD
-counts, since OP_CIRC can match in the middle.
-
-A branch is also implicitly anchored if it starts with .* and DOTALL is set,
-because that will try the rest of the pattern at all possible matching points,
-so there is no point trying again.... er ....
-
-.... except when the .* appears inside capturing parentheses, and there is a
-subsequent back reference to those parentheses. We haven't enough information
-to catch that case precisely. The best we can do is to detect when .* is in
-capturing brackets and the highest back reference is greater than or equal to
-that level.
-
-Arguments:
- code points to start of expression (the bracket)
- options points to the options setting
- in_brackets TRUE if inside capturing parentheses
- top_backref the highest back reference in the regex
-
-Returns: TRUE or FALSE
-*/
-
-static BOOL
-is_anchored(register const uschar *code, int *options, BOOL in_brackets,
- int top_backref)
-{
-do {
- const uschar *scode =
- first_significant_code(code + 1+LINK_SIZE, options, PCRE_MULTILINE);
- register int op = *scode;
-
- /* Capturing brackets */
-
- if (op > OP_BRA)
- {
- if (!is_anchored(scode, options, TRUE, top_backref)) return FALSE;
- }
-
- /* Other brackets */
-
- else if (op == OP_BRA || op == OP_ASSERT || op == OP_ONCE || op == OP_COND)
- {
- if (!is_anchored(scode, options, in_brackets, top_backref))
- return FALSE;
- }
-
- /* .* is not anchored unless DOTALL is set and it isn't in brackets that
- may be referenced. */
-
- else if ((op == OP_TYPESTAR || op == OP_TYPEMINSTAR) &&
- (*options & PCRE_DOTALL) != 0)
- {
- if (scode[1] != OP_ANY || (in_brackets && top_backref > 0)) return FALSE;
- }
-
- /* Check for explicit anchoring */
-
- else if (op != OP_SOD &&
- ((*options & PCRE_MULTILINE) != 0 || op != OP_CIRC))
- return FALSE;
- code += GET(code, 1);
- }
-while (*code == OP_ALT); /* Loop for each alternative */
-return TRUE;
-}
-
-
-
-/*************************************************
-* Check for starting with ^ or .* *
-*************************************************/
-
-/* This is called to find out if every branch starts with ^ or .* so that
-"first char" processing can be done to speed things up in multiline
-matching and for non-DOTALL patterns that start with .* (which must start at
-the beginning or after \n). As in the case of is_anchored() (see above), we
-have to take account of back references to capturing brackets that contain .*
-because in that case we can't make the assumption.
-
-Arguments:
- code points to start of expression (the bracket)
- in_brackets TRUE if inside capturing parentheses
- top_backref the highest back reference in the regex
-
-Returns: TRUE or FALSE
-*/
-
-static BOOL
-is_startline(const uschar *code, BOOL in_brackets, int top_backref)
-{
-do {
- const uschar *scode = first_significant_code(code + 1+LINK_SIZE, NULL, 0);
- register int op = *scode;
-
- /* Capturing brackets */
-
- if (op > OP_BRA)
- { if (!is_startline(scode, TRUE, top_backref)) return FALSE; }
-
- /* Other brackets */
-
- else if (op == OP_BRA || op == OP_ASSERT || op == OP_ONCE || op == OP_COND)
- { if (!is_startline(scode, in_brackets, top_backref)) return FALSE; }
-
- /* .* is not anchored unless DOTALL is set and it isn't in brackets that
- may be referenced. */
-
- else if (op == OP_TYPESTAR || op == OP_TYPEMINSTAR)
- {
- if (scode[1] != OP_ANY || (in_brackets && top_backref > 0)) return FALSE;
- }
-
- /* Check for explicit circumflex */
-
- else if (op != OP_CIRC) return FALSE;
- code += GET(code, 1);
- }
-while (*code == OP_ALT); /* Loop for each alternative */
-return TRUE;
-}
-
-
-
-/*************************************************
-* Check for asserted fixed first char *
-*************************************************/
-
-/* During compilation, the "first char" settings from forward assertions are
-discarded, because they can cause conflicts with actual literals that follow.
-However, if we end up without a first char setting for an unanchored pattern,
-it is worth scanning the regex to see if there is an initial asserted first
-char. If all branches start with the same asserted char, or with a bracket all
-of whose alternatives start with the same asserted char (recurse ad lib), then
-we return that char, otherwise -1.
-
-Arguments:
- code points to start of expression (the bracket)
- options pointer to the options (used to check casing changes)
- inassert TRUE if in an assertion
-
-Returns: -1 or the fixed first char
-*/
-
-static int
-find_firstassertedchar(const uschar *code, int *options, BOOL inassert)
-{
-register int c = -1;
-do {
- int d;
- const uschar *scode =
- first_significant_code(code + 1+LINK_SIZE, options, PCRE_CASELESS);
- register int op = *scode;
-
- if (op >= OP_BRA) op = OP_BRA;
-
- switch(op)
- {
- default:
- return -1;
-
- case OP_BRA:
- case OP_ASSERT:
- case OP_ONCE:
- case OP_COND:
- if ((d = find_firstassertedchar(scode, options, op == OP_ASSERT)) < 0)
- return -1;
- if (c < 0) c = d; else if (c != d) return -1;
- break;
-
- case OP_EXACT: /* Fall through */
- scode++;
-
- case OP_CHARS: /* Fall through */
- scode++;
-
- case OP_PLUS:
- case OP_MINPLUS:
- if (!inassert) return -1;
- if (c < 0)
- {
- c = scode[1];
- if ((*options & PCRE_CASELESS) != 0) c |= REQ_CASELESS;
- }
- else if (c != scode[1]) return -1;
- break;
- }
-
- code += GET(code, 1);
- }
-while (*code == OP_ALT);
-return c;
-}
-
-
-
-
-/*************************************************
-* Compile a Regular Expression *
-*************************************************/
-
-/* This function takes a string and returns a pointer to a block of store
-holding a compiled version of the expression.
-
-Arguments:
- pattern the regular expression
- options various option bits
- errorptr pointer to pointer to error text
- erroroffset ptr offset in pattern where error was detected
- tables pointer to character tables or NULL
-
-Returns: pointer to compiled data block, or NULL on error,
- with errorptr and erroroffset set
-*/
-
-pcre *
-pcre_compile(const char *pattern, int options, const char **errorptr,
- int *erroroffset, const unsigned char *tables)
-{
-real_pcre *re;
-int length = 1 + LINK_SIZE; /* For initial BRA plus length */
-int runlength;
-int c, firstchar, reqchar;
-int bracount = 0;
-int top_backref = 0;
-int branch_extra = 0;
-int branch_newextra;
-int item_count = -1;
-int name_count = 0;
-int max_name_size = 0;
-BOOL inescq = FALSE;
-unsigned int brastackptr = 0;
-size_t size;
-uschar *code;
-const uschar *codestart;
-const uschar *ptr;
-compile_data compile_block;
-int brastack[BRASTACK_SIZE];
-uschar bralenstack[BRASTACK_SIZE];
-
-/* Can't support UTF8 unless PCRE has been compiled to include the code. */
-
-#ifndef SUPPORT_UTF8
-if ((options & PCRE_UTF8) != 0)
- {
- *errorptr = ERR32;
- return NULL;
- }
-#endif
-
-/* We can't pass back an error message if errorptr is NULL; I guess the best we
-can do is just return NULL. */
-
-if (errorptr == NULL) return NULL;
-*errorptr = NULL;
-
-/* However, we can give a message for this error */
-
-if (erroroffset == NULL)
- {
- *errorptr = ERR16;
- return NULL;
- }
-*erroroffset = 0;
-
-if ((options & ~PUBLIC_OPTIONS) != 0)
- {
- *errorptr = ERR17;
- return NULL;
- }
-
-/* Set up pointers to the individual character tables */
-
-if (tables == NULL) tables = pcre_default_tables;
-compile_block.lcc = tables + lcc_offset;
-compile_block.fcc = tables + fcc_offset;
-compile_block.cbits = tables + cbits_offset;
-compile_block.ctypes = tables + ctypes_offset;
-
-/* Reflect pattern for debugging output */
-
-DPRINTF(("------------------------------------------------------------------\n"));
-DPRINTF(("%s\n", pattern));
-
-/* The first thing to do is to make a pass over the pattern to compute the
-amount of store required to hold the compiled code. This does not have to be
-perfect as long as errors are overestimates. At the same time we can detect any
-flag settings right at the start, and extract them. Make an attempt to correct
-for any counted white space if an "extended" flag setting appears late in the
-pattern. We can't be so clever for #-comments. */
-
-ptr = (const uschar *)(pattern - 1);
-while ((c = *(++ptr)) != 0)
- {
- int min, max;
- int class_charcount;
- int bracket_length;
- int duplength;
-
- /* If we are inside a \Q...\E sequence, all chars are literal */
-
- if (inescq) goto NORMAL_CHAR;
-
- /* Otherwise, first check for ignored whitespace and comments */
-
- if ((options & PCRE_EXTENDED) != 0)
- {
- if ((compile_block.ctypes[c] & ctype_space) != 0) continue;
- if (c == '#')
- {
- /* The space before the ; is to avoid a warning on a silly compiler
- on the Macintosh. */
- while ((c = *(++ptr)) != 0 && c != NEWLINE) ;
- if (c == 0) break;
- continue;
- }
- }
-
- item_count++; /* Is zero for the first non-comment item */
-
- switch(c)
- {
- /* A backslashed item may be an escaped "normal" character or a
- character type. For a "normal" character, put the pointers and
- character back so that tests for whitespace etc. in the input
- are done correctly. */
-
- case '\\':
- {
- const uschar *save_ptr = ptr;
- c = check_escape(&ptr, errorptr, bracount, options, FALSE, &compile_block);
- if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
- if (c >= 0)
- {
- ptr = save_ptr;
- c = '\\';
- goto NORMAL_CHAR;
- }
- }
-
- /* If \Q, enter "literal" mode */
-
- if (-c == ESC_Q)
- {
- inescq = TRUE;
- continue;
- }
-
- /* Other escapes need one byte */
-
- length++;
-
- /* A back reference needs an additional 2 bytes, plus either one or 5
- bytes for a repeat. We also need to keep the value of the highest
- back reference. */
-
- if (c <= -ESC_REF)
- {
- int refnum = -c - ESC_REF;
- if (refnum > top_backref) top_backref = refnum;
- length += 2; /* For single back reference */
- if (ptr[1] == '{' && is_counted_repeat(ptr+2, &compile_block))
- {
- ptr = read_repeat_counts(ptr+2, &min, &max, errorptr, &compile_block);
- if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
- if ((min == 0 && (max == 1 || max == -1)) ||
- (min == 1 && max == -1))
- length++;
- else length += 5;
- if (ptr[1] == '?') ptr++;
- }
- }
- continue;
-
- case '*': /* These repeats won't be after brackets; */
- case '+': /* those are handled separately */
- case '?':
- if (ptr[1] == '+') /* Handle "possessive quantifier" */
- {
- length += 2 + 2*LINK_SIZE;
- ptr++;
- }
- /* Fall through */
-
- case '^': /* Single-byte metacharacters */
- case '.':
- case '$':
- length++;
- continue;
-
- /* This covers the cases of repeats after a single char, metachar, class,
- or back reference. */
-
- case '{':
- if (!is_counted_repeat(ptr+1, &compile_block)) goto NORMAL_CHAR;
- ptr = read_repeat_counts(ptr+1, &min, &max, errorptr, &compile_block);
- if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
- if ((min == 0 && (max == 1 || max == -1)) ||
- (min == 1 && max == -1))
- length++;
- else
- {
- length--; /* Uncount the original char or metachar */
- if (min == 1) length++; else if (min > 0) length += 4;
- if (max > 0) length += 4; else length += 2;
- }
- if (ptr[1] == '?') ptr++; /* Needs no extra length */
- if (ptr[1] == '+') /* Possessive quantifier */
- {
- ptr++;
- length += 2 + 2*LINK_SIZE; /* Allow for atomic brackets */
- }
- continue;
-
- /* An alternation contains an offset to the next branch or ket. If any ims
- options changed in the previous branch(es), and/or if we are in a
- lookbehind assertion, extra space will be needed at the start of the
- branch. This is handled by branch_extra. */
-
- case '|':
- length += 1 + LINK_SIZE + branch_extra;
- continue;
-
- /* A character class uses 33 characters. Don't worry about character types
- that aren't allowed in classes - they'll get picked up during the compile.
- A character class that contains only one character uses 2 or 3 bytes,
- depending on whether it is negated or not. Notice this where we can. */
-
- case '[':
- class_charcount = 0;
- if (*(++ptr) == '^') ptr++;
-
- /* Written as a "do" so that an initial ']' is taken as data */
-
- if (*ptr != 0) do
- {
- if (*ptr == '\\')
- {
- int ch = check_escape(&ptr, errorptr, bracount, options, TRUE,
- &compile_block);
- if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
- if (-ch == ESC_b) class_charcount++; else class_charcount = 10;
- }
-
- /* Check the syntax for POSIX stuff. The bits we actually handle are
- checked during the real compile phase. */
-
- else if (*ptr == '[' && check_posix_syntax(ptr, &ptr, &compile_block))
- {
- ptr++;
- class_charcount = 10; /* Make sure > 1 */
- }
-
- /* Anything else just counts as one char */
-
- else class_charcount++;
- }
- while (*(++ptr) != 0 && *ptr != ']'); /* Concludes "do" above */
-
- if (*ptr == 0) /* Missing terminating ']' */
- {
- *errorptr = ERR6;
- goto PCRE_ERROR_RETURN;
- }
-
- /* Repeats for negated single chars are handled by the general code */
-
- if (class_charcount == 1) length += 3; else
- {
- length += 33;
-
- /* A repeat needs either 1 or 5 bytes. */
-
- if (*ptr != 0 && ptr[1] == '{' && is_counted_repeat(ptr+2, &compile_block))
- {
- ptr = read_repeat_counts(ptr+2, &min, &max, errorptr, &compile_block);
- if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
- if ((min == 0 && (max == 1 || max == -1)) ||
- (min == 1 && max == -1))
- length++;
- else length += 5;
- if (ptr[1] == '?') ptr++;
- }
- }
- continue;
-
- /* Brackets may be genuine groups or special things */
-
- case '(':
- branch_newextra = 0;
- bracket_length = 1 + LINK_SIZE;
-
- /* Handle special forms of bracket, which all start (? */
-
- if (ptr[1] == '?')
- {
- int set, unset;
- int *optset;
-
- switch (c = ptr[2])
- {
- /* Skip over comments entirely */
- case '#':
- ptr += 3;
- while (*ptr != 0 && *ptr != ')') ptr++;
- if (*ptr == 0)
- {
- *errorptr = ERR18;
- goto PCRE_ERROR_RETURN;
- }
- continue;
-
- /* Non-referencing groups and lookaheads just move the pointer on, and
- then behave like a non-special bracket, except that they don't increment
- the count of extracting brackets. Ditto for the "once only" bracket,
- which is in Perl from version 5.005. */
-
- case ':':
- case '=':
- case '!':
- case '>':
- ptr += 2;
- break;
-
- /* (?R) specifies a recursive call to the regex, which is an extension
- to provide the facility which can be obtained by (?p{perl-code}) in
- Perl 5.6. In Perl 5.8 this has become (??{perl-code}).
-
- From PCRE 4.00, items such as (?3) specify subroutine-like "calls" to
- the appropriate numbered brackets. This includes both recursive and
- non-recursive calls. (?R) is now synonymous with (?0). */
-
- case 'R':
- ptr++;
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- ptr += 2;
- if (c != 'R')
- while ((compile_block.ctypes[*(++ptr)] & ctype_digit) != 0);
- if (*ptr != ')')
- {
- *errorptr = ERR29;
- goto PCRE_ERROR_RETURN;
- }
- length += 1 + LINK_SIZE;
-
- /* If this item is quantified, it will get wrapped inside brackets so
- as to use the code for quantified brackets. We jump down and use the
- code that handles this for real brackets. */
-
- if (ptr[1] == '+' || ptr[1] == '*' || ptr[1] == '?' || ptr[1] == '{')
- {
- length += 2 + 2 * LINK_SIZE; /* to make bracketed */
- duplength = 5 + 3 * LINK_SIZE;
- goto HANDLE_QUANTIFIED_BRACKETS;
- }
- continue;
-
- /* (?C) is an extension which provides "callout" - to provide a bit of
- the functionality of the Perl (?{...}) feature. An optional number may
- follow (default is zero). */
-
- case 'C':
- ptr += 2;
- while ((compile_block.ctypes[*(++ptr)] & ctype_digit) != 0);
- if (*ptr != ')')
- {
- *errorptr = ERR39;
- goto PCRE_ERROR_RETURN;
- }
- length += 2;
- continue;
-
- /* Named subpatterns are an extension copied from Python */
-
- case 'P':
- ptr += 3;
- if (*ptr == '<')
- {
- const uschar *p = ++ptr;
- while ((compile_block.ctypes[*ptr] & ctype_word) != 0) ptr++;
- if (*ptr != '>')
- {
- *errorptr = ERR42;
- goto PCRE_ERROR_RETURN;
- }
- name_count++;
- if (ptr - p > max_name_size) max_name_size = (ptr - p);
- break;
- }
-
- if (*ptr == '=' || *ptr == '>')
- {
- while ((compile_block.ctypes[*(++ptr)] & ctype_word) != 0);
- if (*ptr != ')')
- {
- *errorptr = ERR42;
- goto PCRE_ERROR_RETURN;
- }
- break;
- }
-
- /* Unknown character after (?P */
-
- *errorptr = ERR41;
- goto PCRE_ERROR_RETURN;
-
- /* Lookbehinds are in Perl from version 5.005 */
-
- case '<':
- ptr += 3;
- if (*ptr == '=' || *ptr == '!')
- {
- branch_newextra = 1 + LINK_SIZE;
- length += 1 + LINK_SIZE; /* For the first branch */
- break;
- }
- *errorptr = ERR24;
- goto PCRE_ERROR_RETURN;
-
- /* Conditionals are in Perl from version 5.005. The bracket must either
- be followed by a number (for bracket reference) or by an assertion
- group, or (a PCRE extension) by 'R' for a recursion test. */
-
- case '(':
- if (ptr[3] == 'R' && ptr[4] == ')')
- {
- ptr += 4;
- length += 3;
- }
- else if ((compile_block.ctypes[ptr[3]] & ctype_digit) != 0)
- {
- ptr += 4;
- length += 3;
- while ((compile_block.ctypes[*ptr] & ctype_digit) != 0) ptr++;
- if (*ptr != ')')
- {
- *errorptr = ERR26;
- goto PCRE_ERROR_RETURN;
- }
- }
- else /* An assertion must follow */
- {
- ptr++; /* Can treat like ':' as far as spacing is concerned */
- if (ptr[2] != '?' ||
- (ptr[3] != '=' && ptr[3] != '!' && ptr[3] != '<') )
- {
- ptr += 2; /* To get right offset in message */
- *errorptr = ERR28;
- goto PCRE_ERROR_RETURN;
- }
- }
- break;
-
- /* Else loop checking valid options until ) is met. Anything else is an
- error. If we are without any brackets, i.e. at top level, the settings
- act as if specified in the options, so massage the options immediately.
- This is for backward compatibility with Perl 5.004. */
-
- default:
- set = unset = 0;
- optset = &set;
- ptr += 2;
-
- for (;; ptr++)
- {
- c = *ptr;
- switch (c)
- {
- case 'i':
- *optset |= PCRE_CASELESS;
- continue;
-
- case 'm':
- *optset |= PCRE_MULTILINE;
- continue;
-
- case 's':
- *optset |= PCRE_DOTALL;
- continue;
-
- case 'x':
- *optset |= PCRE_EXTENDED;
- continue;
-
- case 'X':
- *optset |= PCRE_EXTRA;
- continue;
-
- case 'U':
- *optset |= PCRE_UNGREEDY;
- continue;
-
- case '-':
- optset = &unset;
- continue;
-
- /* A termination by ')' indicates an options-setting-only item; if
- this is at the very start of the pattern (indicated by item_count
- being zero), we use it to set the global options. This is helpful
- when analyzing the pattern for first characters, etc. Otherwise
- nothing is done here and it is handled during the compiling
- process.
-
- [Historical note: Up to Perl 5.8, options settings at top level
- were always global settings, wherever they appeared in the pattern.
- That is, they were equivalent to an external setting. From 5.8
- onwards, they apply only to what follows (which is what you might
- expect).] */
-
- case ')':
- if (item_count == 0)
- {
- options = (options | set) & (~unset);
- set = unset = 0; /* To save length */
- item_count--; /* To allow for several */
- }
-
- /* Fall through */
-
- /* A termination by ':' indicates the start of a nested group with
- the given options set. This is again handled at compile time, but
- we must allow for compiled space if any of the ims options are
- set. We also have to allow for resetting space at the end of
- the group, which is why 4 is added to the length and not just 2.
- If there are several changes of options within the same group, this
- will lead to an over-estimate on the length, but this shouldn't
- matter very much. We also have to allow for resetting options at
- the start of any alternations, which we do by setting
- branch_newextra to 2. Finally, we record whether the case-dependent
- flag ever changes within the regex. This is used by the "required
- character" code. */
-
- case ':':
- if (((set|unset) & PCRE_IMS) != 0)
- {
- length += 4;
- branch_newextra = 2;
- if (((set|unset) & PCRE_CASELESS) != 0) options |= PCRE_ICHANGED;
- }
- goto END_OPTIONS;
-
- /* Unrecognized option character */
-
- default:
- *errorptr = ERR12;
- goto PCRE_ERROR_RETURN;
- }
- }
-
- /* If we hit a closing bracket, that's it - this is a freestanding
- option-setting. We need to ensure that branch_extra is updated if
- necessary. The only values branch_newextra can have here are 0 or 2.
- If the value is 2, then branch_extra must either be 2 or 5, depending
- on whether this is a lookbehind group or not. */
-
- END_OPTIONS:
- if (c == ')')
- {
- if (branch_newextra == 2 &&
- (branch_extra == 0 || branch_extra == 1+LINK_SIZE))
- branch_extra += branch_newextra;
- continue;
- }
-
- /* If options were terminated by ':' control comes here. Fall through
- to handle the group below. */
- }
- }
-
- /* Extracting brackets must be counted so we can process escapes in a
- Perlish way. If the number exceeds EXTRACT_BASIC_MAX we are going to
- need an additional 3 bytes of store per extracting bracket. */
-
- else
- {
- bracount++;
- if (bracount > EXTRACT_BASIC_MAX) bracket_length += 3;
- }
-
- /* Save length for computing whole length at end if there's a repeat that
- requires duplication of the group. Also save the current value of
- branch_extra, and start the new group with the new value. If non-zero, this
- will either be 2 for a (?imsx: group, or 3 for a lookbehind assertion. */
-
- if (brastackptr >= sizeof(brastack)/sizeof(int))
- {
- *errorptr = ERR19;
- goto PCRE_ERROR_RETURN;
- }
-
- bralenstack[brastackptr] = branch_extra;
- branch_extra = branch_newextra;
-
- brastack[brastackptr++] = length;
- length += bracket_length;
- continue;
-
- /* Handle ket. Look for subsequent max/min; for certain sets of values we
- have to replicate this bracket up to that many times. If brastackptr is
- 0 this is an unmatched bracket which will generate an error, but take care
- not to try to access brastack[-1] when computing the length and restoring
- the branch_extra value. */
-
- case ')':
- length += 1 + LINK_SIZE;
- if (brastackptr > 0)
- {
- duplength = length - brastack[--brastackptr];
- branch_extra = bralenstack[brastackptr];
- }
- else duplength = 0;
-
- /* The following code is also used when a recursion such as (?3) is
- followed by a quantifier, because in that case, it has to be wrapped inside
- brackets so that the quantifier works. The value of duplength must be
- set before arrival. */
-
- HANDLE_QUANTIFIED_BRACKETS:
-
- /* Leave ptr at the final char; for read_repeat_counts this happens
- automatically; for the others we need an increment. */
-
- if ((c = ptr[1]) == '{' && is_counted_repeat(ptr+2, &compile_block))
- {
- ptr = read_repeat_counts(ptr+2, &min, &max, errorptr, &compile_block);
- if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
- }
- else if (c == '*') { min = 0; max = -1; ptr++; }
- else if (c == '+') { min = 1; max = -1; ptr++; }
- else if (c == '?') { min = 0; max = 1; ptr++; }
- else { min = 1; max = 1; }
-
- /* If the minimum is zero, we have to allow for an OP_BRAZERO before the
- group, and if the maximum is greater than zero, we have to replicate
- maxval-1 times; each replication acquires an OP_BRAZERO plus a nesting
- bracket set. */
-
- if (min == 0)
- {
- length++;
- if (max > 0) length += (max - 1) * (duplength + 3 + 2*LINK_SIZE);
- }
-
- /* When the minimum is greater than zero, we have to replicate up to
- minval-1 times, with no additions required in the copies. Then, if there
- is a limited maximum we have to replicate up to maxval-1 times allowing
- for a BRAZERO item before each optional copy and nesting brackets for all
- but one of the optional copies. */
-
- else
- {
- length += (min - 1) * duplength;
- if (max > min) /* Need this test as max=-1 means no limit */
- length += (max - min) * (duplength + 3 + 2*LINK_SIZE)
- - (2 + 2*LINK_SIZE);
- }
-
- /* Allow space for once brackets for "possessive quantifier" */
-
- if (ptr[1] == '+')
- {
- ptr++;
- length += 2 + 2*LINK_SIZE;
- }
- continue;
-
- /* Non-special character. For a run of such characters the length required
- is the number of characters + 2, except that the maximum run length is 255.
- We won't get a skipped space or a non-data escape or the start of a #
- comment as the first character, so the length can't be zero. */
-
- NORMAL_CHAR:
- default:
- length += 2;
- runlength = 0;
- do
- {
- /* If in a \Q...\E sequence, check for end; otherwise it's a literal */
- if (inescq)
- {
- if (c == '\\' && ptr[1] == 'E')
- {
- inescq = FALSE;
- ptr++;
- }
- else runlength++;
- continue;
- }
-
- /* Skip whitespace and comments for /x */
-
- if ((options & PCRE_EXTENDED) != 0)
- {
- if ((compile_block.ctypes[c] & ctype_space) != 0) continue;
- if (c == '#')
- {
- /* The space before the ; is to avoid a warning on a silly compiler
- on the Macintosh. */
- while ((c = *(++ptr)) != 0 && c != NEWLINE) ;
- continue;
- }
- }
-
- /* Backslash may introduce a data char or a metacharacter; stop the
- string before the latter. */
-
- if (c == '\\')
- {
- const uschar *saveptr = ptr;
- c = check_escape(&ptr, errorptr, bracount, options, FALSE,
- &compile_block);
- if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
- if (c < 0) { ptr = saveptr; break; }
-
-#ifdef SUPPORT_UTF8
- if (c > 127 && (options & PCRE_UTF8) != 0)
- {
- int i;
- for (i = 0; i < sizeof(utf8_table1)/sizeof(int); i++)
- if (c <= utf8_table1[i]) break;
- runlength += i;
- }
-#endif
- }
-
- /* Ordinary character or single-char escape */
-
- runlength++;
- }
-
- /* This "while" is the end of the "do" above. */
-
- while (runlength < MAXLIT &&
- (compile_block.ctypes[c = *(++ptr)] & ctype_meta) == 0);
-
- if (runlength < MAXLIT) ptr--;
- length += runlength;
- continue;
- }
- }
-
-length += 2 + LINK_SIZE; /* For final KET and END */
-
-if (length > MAX_PATTERN_SIZE)
- {
- *errorptr = ERR20;
- return NULL;
- }
-
-/* Compute the size of data block needed and get it, either from malloc or
-externally provided function. */
-
-size = length + sizeof(real_pcre) + name_count * (max_name_size + 3);
-re = (real_pcre *)(pcre_malloc)(size);
-
-if (re == NULL)
- {
- *errorptr = ERR21;
- return NULL;
- }
-
-/* Put in the magic number, and save the size, options, and table pointer */
-
-re->magic_number = MAGIC_NUMBER;
-re->size = size;
-re->options = options;
-re->tables = tables;
-re->name_entry_size = max_name_size + 3;
-re->name_count = name_count;
-
-/* The starting points of the name/number translation table and of the code are
-passed around in the compile data block. */
-
-compile_block.names_found = 0;
-compile_block.name_entry_size = max_name_size + 3;
-compile_block.name_table = (uschar *)re + sizeof(real_pcre);
-codestart = compile_block.name_table + re->name_entry_size * re->name_count;
-compile_block.start_code = codestart;
-
-/* Set up a starting, non-extracting bracket, then compile the expression. On
-error, *errorptr will be set non-NULL, so we don't need to look at the result
-of the function here. */
-
-ptr = (const uschar *)pattern;
-code = (uschar *)codestart;
-*code = OP_BRA;
-bracount = 0;
-(void)compile_regex(options, options & PCRE_IMS, &bracount, &code, &ptr,
- errorptr, FALSE, 0, &firstchar, &reqchar, NULL, &compile_block);
-re->top_bracket = bracount;
-re->top_backref = top_backref;
-
-/* If not reached end of pattern on success, there's an excess bracket. */
-
-if (*errorptr == NULL && *ptr != 0) *errorptr = ERR22;
-
-/* Fill in the terminating state and check for disastrous overflow, but
-if debugging, leave the test till after things are printed out. */
-
-*code++ = OP_END;
-
-#ifndef DEBUG
-if (code - codestart > length) *errorptr = ERR23;
-#endif
-
-/* Give an error if there's back reference to a non-existent capturing
-subpattern. */
-
-if (top_backref > re->top_bracket) *errorptr = ERR15;
-
-/* Failed to compile, or error while post-processing */
-
-if (*errorptr != NULL)
- {
- (pcre_free)(re);
- PCRE_ERROR_RETURN:
- *erroroffset = ptr - (const uschar *)pattern;
- return NULL;
- }
-
-/* If the anchored option was not passed, set the flag if we can determine that
-the pattern is anchored by virtue of ^ characters or \A or anything else (such
-as starting with .* when DOTALL is set).
-
-Otherwise, if we know what the first character has to be, save it, because that
-speeds up unanchored matches no end. If not, see if we can set the
-PCRE_STARTLINE flag. This is helpful for multiline matches when all branches
-start with ^. and also when all branches start with .* for non-DOTALL matches.
-*/
-
-if ((options & PCRE_ANCHORED) == 0)
- {
- int temp_options = options;
- if (is_anchored(codestart, &temp_options, FALSE, top_backref))
- re->options |= PCRE_ANCHORED;
- else
- {
- if (firstchar < 0)
- firstchar = find_firstassertedchar(codestart, &temp_options, FALSE);
- if (firstchar >= 0) /* Remove caseless flag for non-caseable chars */
- {
- int ch = firstchar & 255;
- re->first_char = ((firstchar & REQ_CASELESS) != 0 &&
- compile_block.fcc[ch] == ch)? ch : firstchar;
- re->options |= PCRE_FIRSTSET;
- }
- else if (is_startline(codestart, FALSE, top_backref))
- re->options |= PCRE_STARTLINE;
- }
- }
-
-/* Save the last required character if any. Remove caseless flag for
-non-caseable chars. */
-
-if ((re->options & PCRE_ANCHORED) != 0 && reqchar < 0 && firstchar >= 0)
- reqchar = firstchar;
-
-if (reqchar >= 0)
- {
- int ch = reqchar & 255;
- re->req_char = ((reqchar & REQ_CASELESS) != 0 &&
- compile_block.fcc[ch] == ch)? ch : reqchar;
- re->options |= PCRE_REQCHSET;
- }
-
-/* Print out the compiled data for debugging */
-
-#ifdef DEBUG
-
-printf("Length = %d top_bracket = %d top_backref = %d\n",
- length, re->top_bracket, re->top_backref);
-
-if (re->options != 0)
- {
- printf("%s%s%s%s%s%s%s%s%s\n",
- ((re->options & PCRE_ANCHORED) != 0)? "anchored " : "",
- ((re->options & PCRE_CASELESS) != 0)? "caseless " : "",
- ((re->options & PCRE_ICHANGED) != 0)? "case state changed " : "",
- ((re->options & PCRE_EXTENDED) != 0)? "extended " : "",
- ((re->options & PCRE_MULTILINE) != 0)? "multiline " : "",
- ((re->options & PCRE_DOTALL) != 0)? "dotall " : "",
- ((re->options & PCRE_DOLLAR_ENDONLY) != 0)? "endonly " : "",
- ((re->options & PCRE_EXTRA) != 0)? "extra " : "",
- ((re->options & PCRE_UNGREEDY) != 0)? "ungreedy " : "");
- }
-
-if ((re->options & PCRE_FIRSTSET) != 0)
- {
- int ch = re->first_char & 255;
- char *caseless = ((re->first_char & REQ_CASELESS) == 0)? "" : " (caseless)";
- if (isprint(ch)) printf("First char = %c%s\n", ch, caseless);
- else printf("First char = \\x%02x%s\n", ch, caseless);
- }
-
-if ((re->options & PCRE_REQCHSET) != 0)
- {
- int ch = re->req_char & 255;
- char *caseless = ((re->req_char & REQ_CASELESS) == 0)? "" : " (caseless)";
- if (isprint(ch)) printf("Req char = %c%s\n", ch, caseless);
- else printf("Req char = \\x%02x%s\n", ch, caseless);
- }
-
-print_internals(re, stdout);
-
-/* This check is done here in the debugging case so that the code that
-was compiled can be seen. */
-
-if (code - codestart > length)
- {
- *errorptr = ERR23;
- (pcre_free)(re);
- *erroroffset = ptr - (uschar *)pattern;
- return NULL;
- }
-#endif
-
-return (pcre *)re;
-}
-
-
-
-/*************************************************
-* Match a back-reference *
-*************************************************/
-
-/* If a back reference hasn't been set, the length that is passed is greater
-than the number of characters left in the string, so the match fails.
-
-Arguments:
- offset index into the offset vector
- eptr points into the subject
- length length to be matched
- md points to match data block
- ims the ims flags
-
-Returns: TRUE if matched
-*/
-
-static BOOL
-match_ref(int offset, register const uschar *eptr, int length, match_data *md,
- unsigned long int ims)
-{
-const uschar *p = md->start_subject + md->offset_vector[offset];
-
-#ifdef DEBUG
-if (eptr >= md->end_subject)
- printf("matching subject <null>");
-else
- {
- printf("matching subject ");
- pchars(eptr, length, TRUE, md);
- }
-printf(" against backref ");
-pchars(p, length, FALSE, md);
-printf("\n");
-#endif
-
-/* Always fail if not enough characters left */
-
-if (length > md->end_subject - eptr) return FALSE;
-
-/* Separate the caselesss case for speed */
-
-if ((ims & PCRE_CASELESS) != 0)
- {
- while (length-- > 0)
- if (md->lcc[*p++] != md->lcc[*eptr++]) return FALSE;
- }
-else
- { while (length-- > 0) if (*p++ != *eptr++) return FALSE; }
-
-return TRUE;
-}
-
-
-
-/*************************************************
-* Match from current position *
-*************************************************/
-
-/* On entry ecode points to the first opcode, and eptr to the first character
-in the subject string, while eptrb holds the value of eptr at the start of the
-last bracketed group - used for breaking infinite loops matching zero-length
-strings.
-
-Arguments:
- eptr pointer in subject
- ecode position in code
- offset_top current top pointer
- md pointer to "static" info for the match
- ims current /i, /m, and /s options
- eptrb pointer to chain of blocks containing eptr at start of
- brackets - for testing for empty matches
- flags can contain
- match_condassert - this is an assertion condition
- match_isgroup - this is the start of a bracketed group
-
-Returns: TRUE if matched
-*/
-
-static BOOL
-match(register const uschar *eptr, register const uschar *ecode,
- int offset_top, match_data *md, unsigned long int ims, eptrblock *eptrb,
- int flags)
-{
-unsigned long int original_ims = ims; /* Save for resetting on ')' */
-eptrblock newptrb;
-
-/* At the start of a bracketed group, add the current subject pointer to the
-stack of such pointers, to be re-instated at the end of the group when we hit
-the closing ket. When match() is called in other circumstances, we don't add to
-the stack. */
-
-if ((flags & match_isgroup) != 0)
- {
- newptrb.prev = eptrb;
- newptrb.saved_eptr = eptr;
- eptrb = &newptrb;
- }
-
-/* Now start processing the operations. */
-
-for (;;)
- {
- int op = (int)*ecode;
- int min, max, ctype;
- register int i;
- register int c;
- BOOL minimize = FALSE;
-
- /* Opening capturing bracket. If there is space in the offset vector, save
- the current subject position in the working slot at the top of the vector. We
- mustn't change the current values of the data slot, because they may be set
- from a previous iteration of this group, and be referred to by a reference
- inside the group.
-
- If the bracket fails to match, we need to restore this value and also the
- values of the final offsets, in case they were set by a previous iteration of
- the same bracket.
-
- If there isn't enough space in the offset vector, treat this as if it were a
- non-capturing bracket. Don't worry about setting the flag for the error case
- here; that is handled in the code for KET. */
-
- if (op > OP_BRA)
- {
- int offset;
- int number = op - OP_BRA;
-
- /* For extended extraction brackets (large number), we have to fish out the
- number from a dummy opcode at the start. */
-
- if (number > EXTRACT_BASIC_MAX)
- number = GET2(ecode, 2+LINK_SIZE);
- offset = number << 1;
-
-#ifdef DEBUG
- printf("start bracket %d subject=", number);
- pchars(eptr, 16, TRUE, md);
- printf("\n");
-#endif
-
- if (offset < md->offset_max)
- {
- int save_offset1 = md->offset_vector[offset];
- int save_offset2 = md->offset_vector[offset+1];
- int save_offset3 = md->offset_vector[md->offset_end - number];
- int save_capture_last = md->capture_last;
-
- DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));
- md->offset_vector[md->offset_end - number] = eptr - md->start_subject;
-
- do
- {
- if (match(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb,
- match_isgroup)) return TRUE;
- md->capture_last = save_capture_last;
- ecode += GET(ecode, 1);
- }
- while (*ecode == OP_ALT);
-
- DPRINTF(("bracket %d failed\n", number));
-
- md->offset_vector[offset] = save_offset1;
- md->offset_vector[offset+1] = save_offset2;
- md->offset_vector[md->offset_end - number] = save_offset3;
-
- return FALSE;
- }
-
- /* Insufficient room for saving captured contents */
-
- else op = OP_BRA;
- }
-
- /* Other types of node can be handled by a switch */
-
- switch(op)
- {
- case OP_BRA: /* Non-capturing bracket: optimized */
- DPRINTF(("start bracket 0\n"));
- do
- {
- if (match(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb,
- match_isgroup)) return TRUE;
- ecode += GET(ecode, 1);
- }
- while (*ecode == OP_ALT);
- DPRINTF(("bracket 0 failed\n"));
- return FALSE;
-
- /* Conditional group: compilation checked that there are no more than
- two branches. If the condition is false, skipping the first branch takes us
- past the end if there is only one branch, but that's OK because that is
- exactly what going to the ket would do. */
-
- case OP_COND:
- if (ecode[LINK_SIZE+1] == OP_CREF) /* Condition extract or recurse test */
- {
- int offset = GET2(ecode, LINK_SIZE+2) << 1; /* Doubled ref number */
- BOOL condition = (offset == CREF_RECURSE * 2)?
- (md->recursive != NULL) :
- (offset < offset_top && md->offset_vector[offset] >= 0);
- return match(eptr, ecode + (condition?
- (LINK_SIZE + 4) : (LINK_SIZE + 1 + GET(ecode, 1))),
- offset_top, md, ims, eptrb, match_isgroup);
- }
-
- /* The condition is an assertion. Call match() to evaluate it - setting
- the final argument TRUE causes it to stop at the end of an assertion. */
-
- else
- {
- if (match(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
- match_condassert | match_isgroup))
- {
- ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE+2);
- while (*ecode == OP_ALT) ecode += GET(ecode, 1);
- }
- else ecode += GET(ecode, 1);
- return match(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb,
- match_isgroup);
- }
- /* Control never reaches here */
-
- /* Skip over conditional reference or large extraction number data if
- encountered. */
-
- case OP_CREF:
- case OP_BRANUMBER:
- ecode += 3;
- break;
-
- /* End of the pattern. If we are in a recursion, we should restore the
- offsets appropriately and continue from after the call. */
-
- case OP_END:
- if (md->recursive != NULL && md->recursive->group_num == 0)
- {
- recursion_info *rec = md->recursive;
- DPRINTF(("Hit the end in a (?0) recursion\n"));
- md->recursive = rec->prev;
- memmove(md->offset_vector, rec->offset_save,
- rec->saved_max * sizeof(int));
- md->start_match = rec->save_start;
- ims = original_ims;
- ecode = rec->after_call;
- break;
- }
-
- /* Otherwise, if PCRE_NOTEMPTY is set, fail if we have matched an empty
- string - backtracking will then try other alternatives, if any. */
-
- if (md->notempty && eptr == md->start_match) return FALSE;
- md->end_match_ptr = eptr; /* Record where we ended */
- md->end_offset_top = offset_top; /* and how many extracts were taken */
- return TRUE;
-
- /* Change option settings */
-
- case OP_OPT:
- ims = ecode[1];
- ecode += 2;
- DPRINTF(("ims set to %02lx\n", ims));
- break;
-
- /* Assertion brackets. Check the alternative branches in turn - the
- matching won't pass the KET for an assertion. If any one branch matches,
- the assertion is true. Lookbehind assertions have an OP_REVERSE item at the
- start of each branch to move the current point backwards, so the code at
- this level is identical to the lookahead case. */
-
- case OP_ASSERT:
- case OP_ASSERTBACK:
- do
- {
- if (match(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
- match_isgroup)) break;
- ecode += GET(ecode, 1);
- }
- while (*ecode == OP_ALT);
- if (*ecode == OP_KET) return FALSE;
-
- /* If checking an assertion for a condition, return TRUE. */
-
- if ((flags & match_condassert) != 0) return TRUE;
-
- /* Continue from after the assertion, updating the offsets high water
- mark, since extracts may have been taken during the assertion. */
-
- do ecode += GET(ecode,1); while (*ecode == OP_ALT);
- ecode += 1 + LINK_SIZE;
- offset_top = md->end_offset_top;
- continue;
-
- /* Negative assertion: all branches must fail to match */
-
- case OP_ASSERT_NOT:
- case OP_ASSERTBACK_NOT:
- do
- {
- if (match(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
- match_isgroup)) return FALSE;
- ecode += GET(ecode,1);
- }
- while (*ecode == OP_ALT);
-
- if ((flags & match_condassert) != 0) return TRUE;
-
- ecode += 1 + LINK_SIZE;
- continue;
-
- /* Move the subject pointer back. This occurs only at the start of
- each branch of a lookbehind assertion. If we are too close to the start to
- move back, this match function fails. When working with UTF-8 we move
- back a number of characters, not bytes. */
-
- case OP_REVERSE:
-#ifdef SUPPORT_UTF8
- c = GET(ecode,1);
- for (i = 0; i < c; i++)
- {
- eptr--;
- BACKCHAR(eptr)
- }
-#else
- eptr -= GET(ecode,1);
-#endif
-
- if (eptr < md->start_subject) return FALSE;
- ecode += 1 + LINK_SIZE;
- break;
-
- /* The callout item calls an external function, if one is provided, passing
- details of the match so far. This is mainly for debugging, though the
- function is able to force a failure. */
-
- case OP_CALLOUT:
- if (pcre_callout != NULL)
- {
- pcre_callout_block cb;
- cb.version = 0; /* Version 0 of the callout block */
- cb.callout_number = ecode[1];
- cb.offset_vector = md->offset_vector;
- cb.subject = (const char *)md->start_subject;
- cb.subject_length = md->end_subject - md->start_subject;
- cb.start_match = md->start_match - md->start_subject;
- cb.current_position = eptr - md->start_subject;
- cb.capture_top = offset_top/2;
- cb.capture_last = md->capture_last;
- if ((*pcre_callout)(&cb) != 0) return FALSE;
- }
- ecode += 2;
- break;
-
- /* Recursion either matches the current regex, or some subexpression. The
- offset data is the offset to the starting bracket from the start of the
- whole pattern. However, it is possible that a BRAZERO was inserted before
- this bracket after we took the offset - we just skip it if encountered.
-
- If there are any capturing brackets started but not finished, we have to
- save their starting points and reinstate them after the recursion. However,
- we don't know how many such there are (offset_top records the completed
- total) so we just have to save all the potential data. There may be up to
- 65535 such values, which is too large to put on the stack, but using malloc
- for small numbers seems expensive. As a compromise, the stack is used when
- there are no more than REC_STACK_SAVE_MAX values to store; otherwise malloc
- is used. A problem is what to do if the malloc fails ... there is no way of
- returning to the top level with an error. Save the top REC_STACK_SAVE_MAX
- values on the stack, and accept that the rest may be wrong.
-
- There are also other values that have to be saved. We use a chained
- sequence of blocks that actually live on the stack. Thanks to Robin Houston
- for the original version of this logic. */
-
- case OP_RECURSE:
- {
- int stacksave[REC_STACK_SAVE_MAX];
- recursion_info new_recursive;
- const uschar *callpat = md->start_code + GET(ecode, 1);
-
- if (*callpat == OP_BRAZERO) callpat++;
-
- new_recursive.group_num = *callpat - OP_BRA;
-
- /* For extended extraction brackets (large number), we have to fish out
- the number from a dummy opcode at the start. */
-
- if (new_recursive.group_num > EXTRACT_BASIC_MAX)
- new_recursive.group_num = GET2(callpat, 2+LINK_SIZE);
-
- /* Add to "recursing stack" */
-
- new_recursive.prev = md->recursive;
- md->recursive = &new_recursive;
-
- /* Find where to continue from afterwards */
-
- ecode += 1 + LINK_SIZE;
- new_recursive.after_call = ecode;
-
- /* Now save the offset data. */
-
- new_recursive.saved_max = md->offset_end;
- if (new_recursive.saved_max <= REC_STACK_SAVE_MAX)
- new_recursive.offset_save = stacksave;
- else
- {
- new_recursive.offset_save = (int *)
- (pcre_malloc)(new_recursive.saved_max * sizeof(int));
-
- /* RH: Warning: This may cause INCORRECT RESULTS if we run out of
- memory here, because we won't be restoring all the stored strings
- correctly. We either need proper run-time error handling or, at the
- very least, some way to warn the user. Could we just spit a message to
- stderr?
-
- PH: No, Robin, no! You must NEVER write to stderr from inside a general
- library function, because you don't know anything about the state of
- the file descriptor.
-
- RH: Returning error values would be very tedious because of the
- recursion; and Philip Hazel says that longjmp() - in many ways the
- obvious solution - has previously caused problems on some platforms. */
-
- if (new_recursive.offset_save == NULL)
- {
- DPRINTF(("malloc() failed - results may be wrong\n"));
- new_recursive.offset_save = stacksave;
- new_recursive.saved_max = REC_STACK_SAVE_MAX;
- }
- }
-
- memcpy(new_recursive.offset_save, md->offset_vector,
- new_recursive.saved_max * sizeof(int));
- new_recursive.save_start = md->start_match;
- md->start_match = eptr;
-
- /* OK, now we can do the recursion. For each top-level alternative we
- restore the offset and recursion data. */
-
- DPRINTF(("Recursing into group %d\n", new_recursive.group_num));
- do
- {
- if (match(eptr, callpat + 1 + LINK_SIZE, offset_top, md, ims, eptrb,
- match_isgroup))
- {
- md->recursive = new_recursive.prev;
- if (new_recursive.offset_save != stacksave)
- (pcre_free)(new_recursive.offset_save);
- return TRUE;
- }
-
- md->recursive = &new_recursive;
- memcpy(md->offset_vector, new_recursive.offset_save,
- new_recursive.saved_max * sizeof(int));
- callpat += GET(callpat, 1);
- }
- while (*callpat == OP_ALT);
-
- DPRINTF(("Recursion didn't match\n"));
- md->recursive = new_recursive.prev;
- if (new_recursive.offset_save != stacksave)
- (pcre_free)(new_recursive.offset_save);
- return FALSE;
- }
- break;
-
- /* "Once" brackets are like assertion brackets except that after a match,
- the point in the subject string is not moved back. Thus there can never be
- a move back into the brackets. Friedl calls these "atomic" subpatterns.
- Check the alternative branches in turn - the matching won't pass the KET
- for this kind of subpattern. If any one branch matches, we carry on as at
- the end of a normal bracket, leaving the subject pointer. */
-
- case OP_ONCE:
- {
- const uschar *prev = ecode;
- const uschar *saved_eptr = eptr;
-
- do
- {
- if (match(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb,
- match_isgroup)) break;
- ecode += GET(ecode,1);
- }
- while (*ecode == OP_ALT);
-
- /* If hit the end of the group (which could be repeated), fail */
-
- if (*ecode != OP_ONCE && *ecode != OP_ALT) return FALSE;
-
- /* Continue as from after the assertion, updating the offsets high water
- mark, since extracts may have been taken. */
-
- do ecode += GET(ecode,1); while (*ecode == OP_ALT);
-
- offset_top = md->end_offset_top;
- eptr = md->end_match_ptr;
-
- /* For a non-repeating ket, just continue at this level. This also
- happens for a repeating ket if no characters were matched in the group.
- This is the forcible breaking of infinite loops as implemented in Perl
- 5.005. If there is an options reset, it will get obeyed in the normal
- course of events. */
-
- if (*ecode == OP_KET || eptr == saved_eptr)
- {
- ecode += 1+LINK_SIZE;
- break;
- }
-
- /* The repeating kets try the rest of the pattern or restart from the
- preceding bracket, in the appropriate order. We need to reset any options
- that changed within the bracket before re-running it, so check the next
- opcode. */
-
- if (ecode[1+LINK_SIZE] == OP_OPT)
- {
- ims = (ims & ~PCRE_IMS) | ecode[4];
- DPRINTF(("ims set to %02lx at group repeat\n", ims));
- }
-
- if (*ecode == OP_KETRMIN)
- {
- if (match(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0)
- ||
- match(eptr, prev, offset_top, md, ims, eptrb, match_isgroup))
- return TRUE;
- }
- else /* OP_KETRMAX */
- {
- if (match(eptr, prev, offset_top, md, ims, eptrb, match_isgroup) ||
- match(eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0))
- return TRUE;
- }
- }
- return FALSE;
-
- /* An alternation is the end of a branch; scan along to find the end of the
- bracketed group and go to there. */
-
- case OP_ALT:
- do ecode += GET(ecode,1); while (*ecode == OP_ALT);
- break;
-
- /* BRAZERO and BRAMINZERO occur just before a bracket group, indicating
- that it may occur zero times. It may repeat infinitely, or not at all -
- i.e. it could be ()* or ()? in the pattern. Brackets with fixed upper
- repeat limits are compiled as a number of copies, with the optional ones
- preceded by BRAZERO or BRAMINZERO. */
-
- case OP_BRAZERO:
- {
- const uschar *next = ecode+1;
- if (match(eptr, next, offset_top, md, ims, eptrb, match_isgroup))
- return TRUE;
- do next += GET(next,1); while (*next == OP_ALT);
- ecode = next + 1+LINK_SIZE;
- }
- break;
-
- case OP_BRAMINZERO:
- {
- const uschar *next = ecode+1;
- do next += GET(next,1); while (*next == OP_ALT);
- if (match(eptr, next + 1+LINK_SIZE, offset_top, md, ims, eptrb,
- match_isgroup)) return TRUE;
- ecode++;
- }
- break;
-
- /* End of a group, repeated or non-repeating. If we are at the end of
- an assertion "group", stop matching and return TRUE, but record the
- current high water mark for use by positive assertions. Do this also
- for the "once" (not-backup up) groups. */
-
- case OP_KET:
- case OP_KETRMIN:
- case OP_KETRMAX:
- {
- const uschar *prev = ecode - GET(ecode, 1);
- const uschar *saved_eptr = eptrb->saved_eptr;
-
- eptrb = eptrb->prev; /* Back up the stack of bracket start pointers */
-
- if (*prev == OP_ASSERT || *prev == OP_ASSERT_NOT ||
- *prev == OP_ASSERTBACK || *prev == OP_ASSERTBACK_NOT ||
- *prev == OP_ONCE)
- {
- md->end_match_ptr = eptr; /* For ONCE */
- md->end_offset_top = offset_top;
- return TRUE;
- }
-
- /* In all other cases except a conditional group we have to check the
- group number back at the start and if necessary complete handling an
- extraction by setting the offsets and bumping the high water mark. */
-
- if (*prev != OP_COND)
- {
- int offset;
- int number = *prev - OP_BRA;
-
- /* For extended extraction brackets (large number), we have to fish out
- the number from a dummy opcode at the start. */
-
- if (number > EXTRACT_BASIC_MAX) number = GET2(prev, 2+LINK_SIZE);
- offset = number << 1;
-
-#ifdef DEBUG
- printf("end bracket %d", number);
- printf("\n");
-#endif
-
- /* Test for a numbered group. This includes groups called as a result
- of recursion. Note that whole-pattern recursion is coded as a recurse
- into group 0, so it won't be picked up here. Instead, we catch it when
- the OP_END is reached. */
-
- if (number > 0)
- {
- md->capture_last = number;
- if (offset >= md->offset_max) md->offset_overflow = TRUE; else
- {
- md->offset_vector[offset] =
- md->offset_vector[md->offset_end - number];
- md->offset_vector[offset+1] = eptr - md->start_subject;
- if (offset_top <= offset) offset_top = offset + 2;
- }
-
- /* Handle a recursively called group. Restore the offsets
- appropriately and continue from after the call. */
-
- if (md->recursive != NULL && md->recursive->group_num == number)
- {
- recursion_info *rec = md->recursive;
- DPRINTF(("Recursion (%d) succeeded - continuing\n", number));
- md->recursive = rec->prev;
- md->start_match = rec->save_start;
- memcpy(md->offset_vector, rec->offset_save,
- rec->saved_max * sizeof(int));
- ecode = rec->after_call;
- ims = original_ims;
- break;
- }
- }
- }
-
- /* Reset the value of the ims flags, in case they got changed during
- the group. */
-
- ims = original_ims;
- DPRINTF(("ims reset to %02lx\n", ims));
-
- /* For a non-repeating ket, just continue at this level. This also
- happens for a repeating ket if no characters were matched in the group.
- This is the forcible breaking of infinite loops as implemented in Perl
- 5.005. If there is an options reset, it will get obeyed in the normal
- course of events. */
-
- if (*ecode == OP_KET || eptr == saved_eptr)
- {
- ecode += 1 + LINK_SIZE;
- break;
- }
-
- /* The repeating kets try the rest of the pattern or restart from the
- preceding bracket, in the appropriate order. */
-
- if (*ecode == OP_KETRMIN)
- {
- if (match(eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0) ||
- match(eptr, prev, offset_top, md, ims, eptrb, match_isgroup))
- return TRUE;
- }
- else /* OP_KETRMAX */
- {
- if (match(eptr, prev, offset_top, md, ims, eptrb, match_isgroup) ||
- match(eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0))
- return TRUE;
- }
- }
- return FALSE;
-
- /* Start of subject unless notbol, or after internal newline if multiline */
-
- case OP_CIRC:
- if (md->notbol && eptr == md->start_subject) return FALSE;
- if ((ims & PCRE_MULTILINE) != 0)
- {
- if (eptr != md->start_subject && eptr[-1] != NEWLINE) return FALSE;
- ecode++;
- break;
- }
- /* ... else fall through */
-
- /* Start of subject assertion */
-
- case OP_SOD:
- if (eptr != md->start_subject) return FALSE;
- ecode++;
- break;
-
- /* Start of match assertion */
-
- case OP_SOM:
- if (eptr != md->start_subject + md->start_offset) return FALSE;
- ecode++;
- break;
-
- /* Assert before internal newline if multiline, or before a terminating
- newline unless endonly is set, else end of subject unless noteol is set. */
-
- case OP_DOLL:
- if ((ims & PCRE_MULTILINE) != 0)
- {
- if (eptr < md->end_subject) { if (*eptr != NEWLINE) return FALSE; }
- else { if (md->noteol) return FALSE; }
- ecode++;
- break;
- }
- else
- {
- if (md->noteol) return FALSE;
- if (!md->endonly)
- {
- if (eptr < md->end_subject - 1 ||
- (eptr == md->end_subject - 1 && *eptr != NEWLINE)) return FALSE;
-
- ecode++;
- break;
- }
- }
- /* ... else fall through */
-
- /* End of subject assertion (\z) */
-
- case OP_EOD:
- if (eptr < md->end_subject) return FALSE;
- ecode++;
- break;
-
- /* End of subject or ending \n assertion (\Z) */
-
- case OP_EODN:
- if (eptr < md->end_subject - 1 ||
- (eptr == md->end_subject - 1 && *eptr != NEWLINE)) return FALSE;
- ecode++;
- break;
-
- /* Word boundary assertions */
-
- case OP_NOT_WORD_BOUNDARY:
- case OP_WORD_BOUNDARY:
- {
- BOOL prev_is_word = (eptr != md->start_subject) &&
- ((md->ctypes[eptr[-1]] & ctype_word) != 0);
- BOOL cur_is_word = (eptr < md->end_subject) &&
- ((md->ctypes[*eptr] & ctype_word) != 0);
- if ((*ecode++ == OP_WORD_BOUNDARY)?
- cur_is_word == prev_is_word : cur_is_word != prev_is_word)
- return FALSE;
- }
- break;
-
- /* Match a single character type; inline for speed */
-
- case OP_ANY:
- if ((ims & PCRE_DOTALL) == 0 && eptr < md->end_subject && *eptr == NEWLINE)
- return FALSE;
- if (eptr++ >= md->end_subject) return FALSE;
-#ifdef SUPPORT_UTF8
- if (md->utf8)
- while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
-#endif
- ecode++;
- break;
-
- /* Match a single byte, even in UTF-8 mode. This opcode really does match
- any byte, even newline, independent of the setting of PCRE_DOTALL. */
-
- case OP_ANYBYTE:
- if (eptr++ >= md->end_subject) return FALSE;
- ecode++;
- break;
-
- case OP_NOT_DIGIT:
- if (eptr >= md->end_subject ||
- (md->ctypes[*eptr++] & ctype_digit) != 0)
- return FALSE;
- ecode++;
- break;
-
- case OP_DIGIT:
- if (eptr >= md->end_subject ||
- (md->ctypes[*eptr++] & ctype_digit) == 0)
- return FALSE;
- ecode++;
- break;
-
- case OP_NOT_WHITESPACE:
- if (eptr >= md->end_subject ||
- (md->ctypes[*eptr++] & ctype_space) != 0)
- return FALSE;
- ecode++;
- break;
-
- case OP_WHITESPACE:
- if (eptr >= md->end_subject ||
- (md->ctypes[*eptr++] & ctype_space) == 0)
- return FALSE;
- ecode++;
- break;
-
- case OP_NOT_WORDCHAR:
- if (eptr >= md->end_subject ||
- (md->ctypes[*eptr++] & ctype_word) != 0)
- return FALSE;
- ecode++;
- break;
-
- case OP_WORDCHAR:
- if (eptr >= md->end_subject ||
- (md->ctypes[*eptr++] & ctype_word) == 0)
- return FALSE;
- ecode++;
- break;
-
- /* Match a back reference, possibly repeatedly. Look past the end of the
- item to see if there is repeat information following. The code is similar
- to that for character classes, but repeated for efficiency. Then obey
- similar code to character type repeats - written out again for speed.
- However, if the referenced string is the empty string, always treat
- it as matched, any number of times (otherwise there could be infinite
- loops). */
-
- case OP_REF:
- {
- int length;
- int offset = GET2(ecode, 1) << 1; /* Doubled ref number */
- ecode += 3; /* Advance past item */
-
- /* If the reference is unset, set the length to be longer than the amount
- of subject left; this ensures that every attempt at a match fails. We
- can't just fail here, because of the possibility of quantifiers with zero
- minima. */
-
- length = (offset >= offset_top || md->offset_vector[offset] < 0)?
- md->end_subject - eptr + 1 :
- md->offset_vector[offset+1] - md->offset_vector[offset];
-
- /* Set up for repetition, or handle the non-repeated case */
-
- switch (*ecode)
- {
- case OP_CRSTAR:
- case OP_CRMINSTAR:
- case OP_CRPLUS:
- case OP_CRMINPLUS:
- case OP_CRQUERY:
- case OP_CRMINQUERY:
- c = *ecode++ - OP_CRSTAR;
- minimize = (c & 1) != 0;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
- break;
-
- case OP_CRRANGE:
- case OP_CRMINRANGE:
- minimize = (*ecode == OP_CRMINRANGE);
- min = GET2(ecode, 1);
- max = GET2(ecode, 3);
- if (max == 0) max = INT_MAX;
- ecode += 5;
- break;
-
- default: /* No repeat follows */
- if (!match_ref(offset, eptr, length, md, ims)) return FALSE;
- eptr += length;
- continue; /* With the main loop */
- }
-
- /* If the length of the reference is zero, just continue with the
- main loop. */
-
- if (length == 0) continue;
-
- /* First, ensure the minimum number of matches are present. We get back
- the length of the reference string explicitly rather than passing the
- address of eptr, so that eptr can be a register variable. */
-
- for (i = 1; i <= min; i++)
- {
- if (!match_ref(offset, eptr, length, md, ims)) return FALSE;
- eptr += length;
- }
-
- /* If min = max, continue at the same level without recursion.
- They are not both allowed to be zero. */
-
- if (min == max) continue;
-
- /* If minimizing, keep trying and advancing the pointer */
-
- if (minimize)
- {
- for (i = min;; i++)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- if (i >= max || !match_ref(offset, eptr, length, md, ims))
- return FALSE;
- eptr += length;
- }
- /* Control never gets here */
- }
-
- /* If maximizing, find the longest string and work backwards */
-
- else
- {
- const uschar *pp = eptr;
- for (i = min; i < max; i++)
- {
- if (!match_ref(offset, eptr, length, md, ims)) break;
- eptr += length;
- }
- while (eptr >= pp)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- eptr -= length;
- }
- return FALSE;
- }
- }
- /* Control never gets here */
-
-
-
- /* Match a character class, possibly repeatedly. Look past the end of the
- item to see if there is repeat information following. Then obey similar
- code to character type repeats - written out again for speed. */
-
- case OP_CLASS:
- {
- const uschar *data = ecode + 1; /* Save for matching */
- ecode += 33; /* Advance past the item */
-
- switch (*ecode)
- {
- case OP_CRSTAR:
- case OP_CRMINSTAR:
- case OP_CRPLUS:
- case OP_CRMINPLUS:
- case OP_CRQUERY:
- case OP_CRMINQUERY:
- c = *ecode++ - OP_CRSTAR;
- minimize = (c & 1) != 0;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
- break;
-
- case OP_CRRANGE:
- case OP_CRMINRANGE:
- minimize = (*ecode == OP_CRMINRANGE);
- min = GET2(ecode, 1);
- max = GET2(ecode, 3);
- if (max == 0) max = INT_MAX;
- ecode += 5;
- break;
-
- default: /* No repeat follows */
- min = max = 1;
- break;
- }
-
- /* First, ensure the minimum number of matches are present. */
-
- for (i = 1; i <= min; i++)
- {
- if (eptr >= md->end_subject) return FALSE;
- GETCHARINC(c, eptr) /* Get character; increment eptr */
-
-#ifdef SUPPORT_UTF8
- /* We do not yet support class members > 255 */
- if (c > 255) return FALSE;
-#endif
-
- if ((data[c/8] & (1 << (c&7))) != 0) continue;
- return FALSE;
- }
-
- /* If max == min we can continue with the main loop without the
- need to recurse. */
-
- if (min == max) continue;
-
- /* If minimizing, keep testing the rest of the expression and advancing
- the pointer while it matches the class. */
-
- if (minimize)
- {
- for (i = min;; i++)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- if (i >= max || eptr >= md->end_subject) return FALSE;
- GETCHARINC(c, eptr) /* Get character; increment eptr */
-
-#ifdef SUPPORT_UTF8
- /* We do not yet support class members > 255 */
- if (c > 255) return FALSE;
-#endif
- if ((data[c/8] & (1 << (c&7))) != 0) continue;
- return FALSE;
- }
- /* Control never gets here */
- }
-
- /* If maximizing, find the longest possible run, then work backwards. */
-
- else
- {
- const uschar *pp = eptr;
- int len = 1;
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject) break;
- GETCHARLEN(c, eptr, len) /* Get character, set length if UTF-8 */
-
-#ifdef SUPPORT_UTF8
- /* We do not yet support class members > 255 */
- if (c > 255) break;
-#endif
- if ((data[c/8] & (1 << (c&7))) == 0) break;
- eptr += len;
- }
-
- while (eptr >= pp)
- {
- if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
-
-#ifdef SUPPORT_UTF8
- BACKCHAR(eptr)
-#endif
- }
- return FALSE;
- }
- }
- /* Control never gets here */
-
- /* Match a run of characters */
-
- case OP_CHARS:
- {
- register int length = ecode[1];
- ecode += 2;
-
-#ifdef DEBUG /* Sigh. Some compilers never learn. */
- if (eptr >= md->end_subject)
- printf("matching subject <null> against pattern ");
- else
- {
- printf("matching subject ");
- pchars(eptr, length, TRUE, md);
- printf(" against pattern ");
- }
- pchars(ecode, length, FALSE, md);
- printf("\n");
-#endif
-
- if (length > md->end_subject - eptr) return FALSE;
- if ((ims & PCRE_CASELESS) != 0)
- {
- while (length-- > 0)
- if (md->lcc[*ecode++] != md->lcc[*eptr++])
- return FALSE;
- }
- else
- {
- while (length-- > 0) if (*ecode++ != *eptr++) return FALSE;
- }
- }
- break;
-
- /* Match a single character repeatedly; different opcodes share code. */
-
- case OP_EXACT:
- min = max = GET2(ecode, 1);
- ecode += 3;
- goto REPEATCHAR;
-
- case OP_UPTO:
- case OP_MINUPTO:
- min = 0;
- max = GET2(ecode, 1);
- minimize = *ecode == OP_MINUPTO;
- ecode += 3;
- goto REPEATCHAR;
-
- case OP_STAR:
- case OP_MINSTAR:
- case OP_PLUS:
- case OP_MINPLUS:
- case OP_QUERY:
- case OP_MINQUERY:
- c = *ecode++ - OP_STAR;
- minimize = (c & 1) != 0;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
-
- /* Common code for all repeated single-character matches. We can give
- up quickly if there are fewer than the minimum number of characters left in
- the subject. */
-
- REPEATCHAR:
- if (min > md->end_subject - eptr) return FALSE;
- c = *ecode++;
-
- /* The code is duplicated for the caseless and caseful cases, for speed,
- since matching characters is likely to be quite common. First, ensure the
- minimum number of matches are present. If min = max, continue at the same
- level without recursing. Otherwise, if minimizing, keep trying the rest of
- the expression and advancing one matching character if failing, up to the
- maximum. Alternatively, if maximizing, find the maximum number of
- characters and work backwards. */
-
- DPRINTF(("matching %c{%d,%d} against subject %.*s\n", c, min, max,
- max, eptr));
-
- if ((ims & PCRE_CASELESS) != 0)
- {
- c = md->lcc[c];
- for (i = 1; i <= min; i++)
- if (c != md->lcc[*eptr++]) return FALSE;
- if (min == max) continue;
- if (minimize)
- {
- for (i = min;; i++)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- if (i >= max || eptr >= md->end_subject ||
- c != md->lcc[*eptr++])
- return FALSE;
- }
- /* Control never gets here */
- }
- else
- {
- const uschar *pp = eptr;
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || c != md->lcc[*eptr]) break;
- eptr++;
- }
- while (eptr >= pp)
- if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- return FALSE;
- }
- /* Control never gets here */
- }
-
- /* Caseful comparisons */
-
- else
- {
- for (i = 1; i <= min; i++) if (c != *eptr++) return FALSE;
- if (min == max) continue;
- if (minimize)
- {
- for (i = min;; i++)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- if (i >= max || eptr >= md->end_subject || c != *eptr++) return FALSE;
- }
- /* Control never gets here */
- }
- else
- {
- const uschar *pp = eptr;
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || c != *eptr) break;
- eptr++;
- }
- while (eptr >= pp)
- if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- return FALSE;
- }
- }
- /* Control never gets here */
-
- /* Match a negated single character */
-
- case OP_NOT:
- if (eptr >= md->end_subject) return FALSE;
- ecode++;
- if ((ims & PCRE_CASELESS) != 0)
- {
- if (md->lcc[*ecode++] == md->lcc[*eptr++]) return FALSE;
- }
- else
- {
- if (*ecode++ == *eptr++) return FALSE;
- }
- break;
-
- /* Match a negated single character repeatedly. This is almost a repeat of
- the code for a repeated single character, but I haven't found a nice way of
- commoning these up that doesn't require a test of the positive/negative
- option for each character match. Maybe that wouldn't add very much to the
- time taken, but character matching *is* what this is all about... */
-
- case OP_NOTEXACT:
- min = max = GET2(ecode, 1);
- ecode += 3;
- goto REPEATNOTCHAR;
-
- case OP_NOTUPTO:
- case OP_NOTMINUPTO:
- min = 0;
- max = GET2(ecode, 1);
- minimize = *ecode == OP_NOTMINUPTO;
- ecode += 3;
- goto REPEATNOTCHAR;
-
- case OP_NOTSTAR:
- case OP_NOTMINSTAR:
- case OP_NOTPLUS:
- case OP_NOTMINPLUS:
- case OP_NOTQUERY:
- case OP_NOTMINQUERY:
- c = *ecode++ - OP_NOTSTAR;
- minimize = (c & 1) != 0;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
-
- /* Common code for all repeated single-character matches. We can give
- up quickly if there are fewer than the minimum number of characters left in
- the subject. */
-
- REPEATNOTCHAR:
- if (min > md->end_subject - eptr) return FALSE;
- c = *ecode++;
-
- /* The code is duplicated for the caseless and caseful cases, for speed,
- since matching characters is likely to be quite common. First, ensure the
- minimum number of matches are present. If min = max, continue at the same
- level without recursing. Otherwise, if minimizing, keep trying the rest of
- the expression and advancing one matching character if failing, up to the
- maximum. Alternatively, if maximizing, find the maximum number of
- characters and work backwards. */
-
- DPRINTF(("negative matching %c{%d,%d} against subject %.*s\n", c, min, max,
- max, eptr));
-
- if ((ims & PCRE_CASELESS) != 0)
- {
- c = md->lcc[c];
- for (i = 1; i <= min; i++)
- if (c == md->lcc[*eptr++]) return FALSE;
- if (min == max) continue;
- if (minimize)
- {
- for (i = min;; i++)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- if (i >= max || eptr >= md->end_subject ||
- c == md->lcc[*eptr++])
- return FALSE;
- }
- /* Control never gets here */
- }
- else
- {
- const uschar *pp = eptr;
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || c == md->lcc[*eptr]) break;
- eptr++;
- }
- while (eptr >= pp)
- if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- return FALSE;
- }
- /* Control never gets here */
- }
-
- /* Caseful comparisons */
-
- else
- {
- for (i = 1; i <= min; i++) if (c == *eptr++) return FALSE;
- if (min == max) continue;
- if (minimize)
- {
- for (i = min;; i++)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- if (i >= max || eptr >= md->end_subject || c == *eptr++) return FALSE;
- }
- /* Control never gets here */
- }
- else
- {
- const uschar *pp = eptr;
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || c == *eptr) break;
- eptr++;
- }
- while (eptr >= pp)
- if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- return FALSE;
- }
- }
- /* Control never gets here */
-
- /* Match a single character type repeatedly; several different opcodes
- share code. This is very similar to the code for single characters, but we
- repeat it in the interests of efficiency. */
-
- case OP_TYPEEXACT:
- min = max = GET2(ecode, 1);
- minimize = TRUE;
- ecode += 3;
- goto REPEATTYPE;
-
- case OP_TYPEUPTO:
- case OP_TYPEMINUPTO:
- min = 0;
- max = GET2(ecode, 1);
- minimize = *ecode == OP_TYPEMINUPTO;
- ecode += 3;
- goto REPEATTYPE;
-
- case OP_TYPESTAR:
- case OP_TYPEMINSTAR:
- case OP_TYPEPLUS:
- case OP_TYPEMINPLUS:
- case OP_TYPEQUERY:
- case OP_TYPEMINQUERY:
- c = *ecode++ - OP_TYPESTAR;
- minimize = (c & 1) != 0;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
-
- /* Common code for all repeated single character type matches */
-
- REPEATTYPE:
- ctype = *ecode++; /* Code for the character type */
-
- /* First, ensure the minimum number of matches are present. Use inline
- code for maximizing the speed, and do the type test once at the start
- (i.e. keep it out of the loop). Also we can test that there are at least
- the minimum number of bytes before we start, except when doing '.' in
- UTF8 mode. Leave the test in in all cases; in the special case we have
- to test after each character. */
-
- if (min > md->end_subject - eptr) return FALSE;
- if (min > 0) switch(ctype)
- {
- case OP_ANY:
-#ifdef SUPPORT_UTF8
- if (md->utf8)
- {
- for (i = 1; i <= min; i++)
- {
- if (eptr >= md->end_subject ||
- (*eptr++ == NEWLINE && (ims & PCRE_DOTALL) == 0))
- return FALSE;
- while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
- }
- break;
- }
-#endif
- /* Non-UTF8 can be faster */
- if ((ims & PCRE_DOTALL) == 0)
- { for (i = 1; i <= min; i++) if (*eptr++ == NEWLINE) return FALSE; }
- else eptr += min;
- break;
-
- case OP_ANYBYTE:
- eptr += min;
- break;
-
- case OP_NOT_DIGIT:
- for (i = 1; i <= min; i++)
- if ((md->ctypes[*eptr++] & ctype_digit) != 0) return FALSE;
- break;
-
- case OP_DIGIT:
- for (i = 1; i <= min; i++)
- if ((md->ctypes[*eptr++] & ctype_digit) == 0) return FALSE;
- break;
-
- case OP_NOT_WHITESPACE:
- for (i = 1; i <= min; i++)
- if ((md->ctypes[*eptr++] & ctype_space) != 0) return FALSE;
- break;
-
- case OP_WHITESPACE:
- for (i = 1; i <= min; i++)
- if ((md->ctypes[*eptr++] & ctype_space) == 0) return FALSE;
- break;
-
- case OP_NOT_WORDCHAR:
- for (i = 1; i <= min; i++)
- if ((md->ctypes[*eptr++] & ctype_word) != 0)
- return FALSE;
- break;
-
- case OP_WORDCHAR:
- for (i = 1; i <= min; i++)
- if ((md->ctypes[*eptr++] & ctype_word) == 0)
- return FALSE;
- break;
- }
-
- /* If min = max, continue at the same level without recursing */
-
- if (min == max) continue;
-
- /* If minimizing, we have to test the rest of the pattern before each
- subsequent match. */
-
- if (minimize)
- {
- for (i = min;; i++)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0)) return TRUE;
- if (i >= max || eptr >= md->end_subject) return FALSE;
-
- c = *eptr++;
- switch(ctype)
- {
- case OP_ANY:
- if ((ims & PCRE_DOTALL) == 0 && c == NEWLINE) return FALSE;
-#ifdef SUPPORT_UTF8
- if (md->utf8)
- while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
-#endif
- break;
-
- case OP_ANYBYTE:
- break;
-
- case OP_NOT_DIGIT:
- if ((md->ctypes[c] & ctype_digit) != 0) return FALSE;
- break;
-
- case OP_DIGIT:
- if ((md->ctypes[c] & ctype_digit) == 0) return FALSE;
- break;
-
- case OP_NOT_WHITESPACE:
- if ((md->ctypes[c] & ctype_space) != 0) return FALSE;
- break;
-
- case OP_WHITESPACE:
- if ((md->ctypes[c] & ctype_space) == 0) return FALSE;
- break;
-
- case OP_NOT_WORDCHAR:
- if ((md->ctypes[c] & ctype_word) != 0) return FALSE;
- break;
-
- case OP_WORDCHAR:
- if ((md->ctypes[c] & ctype_word) == 0) return FALSE;
- break;
- }
- }
- /* Control never gets here */
- }
-
- /* If maximizing it is worth using inline code for speed, doing the type
- test once at the start (i.e. keep it out of the loop). */
-
- else
- {
- const uschar *pp = eptr;
- switch(ctype)
- {
- case OP_ANY:
-
- /* Special code is required for UTF8, but when the maximum is unlimited
- we don't need it. */
-
-#ifdef SUPPORT_UTF8
- if (md->utf8 && max < INT_MAX)
- {
- if ((ims & PCRE_DOTALL) == 0)
- {
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || *eptr++ == NEWLINE) break;
- while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
- }
- }
- else
- {
- for (i = min; i < max; i++)
- {
- eptr++;
- while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
- }
- }
- break;
- }
-#endif
- /* Non-UTF8 can be faster */
- if ((ims & PCRE_DOTALL) == 0)
- {
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || *eptr == NEWLINE) break;
- eptr++;
- }
- break;
- }
- /* For non-UTF8 DOTALL case, fall through and treat as \C */
-
- case OP_ANYBYTE:
- c = max - min;
- if (c > md->end_subject - eptr) c = md->end_subject - eptr;
- eptr += c;
- break;
-
- case OP_NOT_DIGIT:
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_digit) != 0)
- break;
- eptr++;
- }
- break;
-
- case OP_DIGIT:
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_digit) == 0)
- break;
- eptr++;
- }
- break;
-
- case OP_NOT_WHITESPACE:
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_space) != 0)
- break;
- eptr++;
- }
- break;
-
- case OP_WHITESPACE:
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_space) == 0)
- break;
- eptr++;
- }
- break;
-
- case OP_NOT_WORDCHAR:
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_word) != 0)
- break;
- eptr++;
- }
- break;
-
- case OP_WORDCHAR:
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_word) == 0)
- break;
- eptr++;
- }
- break;
- }
-
- while (eptr >= pp)
- {
- if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
-#ifdef SUPPORT_UTF8
- if (md->utf8)
- while (eptr > pp && (*eptr & 0xc0) == 0x80) eptr--;
-#endif
- }
- return FALSE;
- }
- /* Control never gets here */
-
- /* There's been some horrible disaster. */
-
- default:
- DPRINTF(("Unknown opcode %d\n", *ecode));
- md->errorcode = PCRE_ERROR_UNKNOWN_NODE;
- return FALSE;
- }
-
- /* Do not stick any code in here without much thought; it is assumed
- that "continue" in the code above comes out to here to repeat the main
- loop. */
-
- } /* End of main loop */
-/* Control never reaches here */
-}
-
-
-
-
-/*************************************************
-* Execute a Regular Expression *
-*************************************************/
-
-/* This function applies a compiled re to a subject string and picks out
-portions of the string if it matches. Two elements in the vector are set for
-each substring: the offsets to the start and end of the substring.
-
-Arguments:
- external_re points to the compiled expression
- external_extra points to "hints" from pcre_study() or is NULL
- subject points to the subject string
- length length of subject string (may contain binary zeros)
- start_offset where to start in the subject string
- options option bits
- offsets points to a vector of ints to be filled in with offsets
- offsetcount the number of elements in the vector
-
-Returns: > 0 => success; value is the number of elements filled in
- = 0 => success, but offsets is not big enough
- -1 => failed to match
- < -1 => some kind of unexpected problem
-*/
-
-int
-pcre_exec(const pcre *external_re, const pcre_extra *external_extra,
- const char *subject, int length, int start_offset, int options, int *offsets,
- int offsetcount)
-{
-int resetcount, ocount;
-int first_char = -1;
-int req_char = -1;
-int req_char2 = -1;
-unsigned long int ims = 0;
-match_data match_block;
-const uschar *start_bits = NULL;
-const uschar *start_match = (const uschar *)subject + start_offset;
-const uschar *end_subject;
-const uschar *req_char_ptr = start_match - 1;
-const real_pcre *re = (const real_pcre *)external_re;
-const real_pcre_extra *extra = (const real_pcre_extra *)external_extra;
-const uschar *codestart =
- (const uschar *)re + sizeof(real_pcre) + re->name_count * re->name_entry_size;
-BOOL using_temporary_offsets = FALSE;
-BOOL anchored;
-BOOL startline;
-BOOL first_char_caseless = FALSE;
-BOOL req_char_caseless = FALSE;
-
-if ((options & ~PUBLIC_EXEC_OPTIONS) != 0) return PCRE_ERROR_BADOPTION;
-
-if (re == NULL || subject == NULL ||
- (offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL;
-if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC;
-
-anchored = ((re->options | options) & PCRE_ANCHORED) != 0;
-startline = (re->options & PCRE_STARTLINE) != 0;
-
-match_block.start_code = codestart;
-match_block.start_subject = (const uschar *)subject;
-match_block.start_offset = start_offset;
-match_block.end_subject = match_block.start_subject + length;
-end_subject = match_block.end_subject;
-
-match_block.endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
-match_block.utf8 = (re->options & PCRE_UTF8) != 0;
-
-match_block.notbol = (options & PCRE_NOTBOL) != 0;
-match_block.noteol = (options & PCRE_NOTEOL) != 0;
-match_block.notempty = (options & PCRE_NOTEMPTY) != 0;
-
-match_block.errorcode = PCRE_ERROR_NOMATCH; /* Default error */
-match_block.recursive = NULL; /* No recursion */
-
-match_block.lcc = re->tables + lcc_offset;
-match_block.ctypes = re->tables + ctypes_offset;
-
-/* The ims options can vary during the matching as a result of the presence
-of (?ims) items in the pattern. They are kept in a local variable so that
-restoring at the exit of a group is easy. */
-
-ims = re->options & (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL);
-
-/* If the expression has got more back references than the offsets supplied can
-hold, we get a temporary bit of working store to use during the matching.
-Otherwise, we can use the vector supplied, rounding down its size to a multiple
-of 3. */
-
-ocount = offsetcount - (offsetcount % 3);
-
-if (re->top_backref > 0 && re->top_backref >= ocount/3)
- {
- ocount = re->top_backref * 3 + 3;
- match_block.offset_vector = (int *)(pcre_malloc)(ocount * sizeof(int));
- if (match_block.offset_vector == NULL) return PCRE_ERROR_NOMEMORY;
- using_temporary_offsets = TRUE;
- DPRINTF(("Got memory to hold back references\n"));
- }
-else match_block.offset_vector = offsets;
-
-match_block.offset_end = ocount;
-match_block.offset_max = (2*ocount)/3;
-match_block.offset_overflow = FALSE;
-match_block.capture_last = -1;
-
-/* Compute the minimum number of offsets that we need to reset each time. Doing
-this makes a huge difference to execution time when there aren't many brackets
-in the pattern. */
-
-resetcount = 2 + re->top_bracket * 2;
-if (resetcount > offsetcount) resetcount = ocount;
-
-/* Reset the working variable associated with each extraction. These should
-never be used unless previously set, but they get saved and restored, and so we
-initialize them to avoid reading uninitialized locations. */
-
-if (match_block.offset_vector != NULL)
- {
- register int *iptr = match_block.offset_vector + ocount;
- register int *iend = iptr - resetcount/2 + 1;
- while (--iptr >= iend) *iptr = -1;
- }
-
-/* Set up the first character to match, if available. The first_char value is
-never set for an anchored regular expression, but the anchoring may be forced
-at run time, so we have to test for anchoring. The first char may be unset for
-an unanchored pattern, of course. If there's no first char and the pattern was
-studied, there may be a bitmap of possible first characters. */
-
-if (!anchored)
- {
- if ((re->options & PCRE_FIRSTSET) != 0)
- {
- first_char = re->first_char & 255;
- if ((first_char_caseless = ((re->first_char & REQ_CASELESS) != 0)) == TRUE)
- first_char = match_block.lcc[first_char];
- }
- else
- if (!startline && extra != NULL &&
- (extra->options & PCRE_STUDY_MAPPED) != 0)
- start_bits = extra->start_bits;
- }
-
-/* For anchored or unanchored matches, there may be a "last known required
-character" set. */
-
-if ((re->options & PCRE_REQCHSET) != 0)
- {
- req_char = re->req_char & 255;
- req_char_caseless = (re->req_char & REQ_CASELESS) != 0;
- req_char2 = (re->tables + fcc_offset)[req_char]; /* case flipped */
- }
-
-/* Loop for handling unanchored repeated matching attempts; for anchored regexs
-the loop runs just once. */
-
-do
- {
- int rc;
- register int *iptr = match_block.offset_vector;
- register int *iend = iptr + resetcount;
-
- /* Reset the maximum number of extractions we might see. */
-
- while (iptr < iend) *iptr++ = -1;
-
- /* Advance to a unique first char if possible */
-
- if (first_char >= 0)
- {
- if (first_char_caseless)
- while (start_match < end_subject &&
- match_block.lcc[*start_match] != first_char)
- start_match++;
- else
- while (start_match < end_subject && *start_match != first_char)
- start_match++;
- }
-
- /* Or to just after \n for a multiline match if possible */
-
- else if (startline)
- {
- if (start_match > match_block.start_subject + start_offset)
- {
- while (start_match < end_subject && start_match[-1] != NEWLINE)
- start_match++;
- }
- }
-
- /* Or to a non-unique first char after study */
-
- else if (start_bits != NULL)
- {
- while (start_match < end_subject)
- {
- register int c = *start_match;
- if ((start_bits[c/8] & (1 << (c&7))) == 0) start_match++; else break;
- }
- }
-
-#ifdef DEBUG /* Sigh. Some compilers never learn. */
- printf(">>>> Match against: ");
- pchars(start_match, end_subject - start_match, TRUE, &match_block);
- printf("\n");
-#endif
-
- /* If req_char is set, we know that that character must appear in the subject
- for the match to succeed. If the first character is set, req_char must be
- later in the subject; otherwise the test starts at the match point. This
- optimization can save a huge amount of backtracking in patterns with nested
- unlimited repeats that aren't going to match. Writing separate code for
- cased/caseless versions makes it go faster, as does using an autoincrement
- and backing off on a match. */
-
- if (req_char >= 0)
- {
- register const uschar *p = start_match + ((first_char >= 0)? 1 : 0);
-
- /* We don't need to repeat the search if we haven't yet reached the
- place we found it at last time. */
-
- if (p > req_char_ptr)
- {
- if (req_char_caseless)
- {
- while (p < end_subject)
- {
- register int pp = *p++;
- if (pp == req_char || pp == req_char2) { p--; break; }
- }
- }
- else
- {
- while (p < end_subject)
- {
- if (*p++ == req_char) { p--; break; }
- }
- }
-
- /* If we can't find the required character, break the matching loop */
-
- if (p >= end_subject) break;
-
- /* If we have found the required character, save the point where we
- found it, so that we don't search again next time round the loop if
- the start hasn't passed this character yet. */
-
- req_char_ptr = p;
- }
- }
-
- /* When a match occurs, substrings will be set for all internal extractions;
- we just need to set up the whole thing as substring 0 before returning. If
- there were too many extractions, set the return code to zero. In the case
- where we had to get some local store to hold offsets for backreferences, copy
- those back references that we can. In this case there need not be overflow
- if certain parts of the pattern were not used. */
-
- match_block.start_match = start_match;
- if (!match(start_match, codestart, 2, &match_block, ims, NULL, match_isgroup))
- continue;
-
- /* Copy the offset information from temporary store if necessary */
-
- if (using_temporary_offsets)
- {
- if (offsetcount >= 4)
- {
- memcpy(offsets + 2, match_block.offset_vector + 2,
- (offsetcount - 2) * sizeof(int));
- DPRINTF(("Copied offsets from temporary memory\n"));
- }
- if (match_block.end_offset_top > offsetcount)
- match_block.offset_overflow = TRUE;
-
- DPRINTF(("Freeing temporary memory\n"));
- (pcre_free)(match_block.offset_vector);
- }
-
- rc = match_block.offset_overflow? 0 : match_block.end_offset_top/2;
-
- if (offsetcount < 2) rc = 0; else
- {
- offsets[0] = start_match - match_block.start_subject;
- offsets[1] = match_block.end_match_ptr - match_block.start_subject;
- }
-
- DPRINTF((">>>> returning %d\n", rc));
- return rc;
- }
-
-/* This "while" is the end of the "do" above */
-
-while (!anchored &&
- match_block.errorcode == PCRE_ERROR_NOMATCH &&
- start_match++ < end_subject);
-
-if (using_temporary_offsets)
- {
- DPRINTF(("Freeing temporary memory\n"));
- (pcre_free)(match_block.offset_vector);
- }
-
-DPRINTF((">>>> returning %d\n", match_block.errorcode));
-
-return match_block.errorcode;
-}
-
-/* End of pcre.c */
diff --git a/ext/pcre/pcrelib/pcre.def b/ext/pcre/pcrelib/pcre.def
deleted file mode 100644
index 4f6c4bff40..0000000000
--- a/ext/pcre/pcrelib/pcre.def
+++ /dev/null
@@ -1,22 +0,0 @@
-EXPORTS
-
-pcre_malloc DATA
-pcre_free DATA
-
-pcre_compile
-pcre_copy_substring
-pcre_exec
-pcre_get_substring
-pcre_get_substring_list
-pcre_free_substring
-pcre_free_substring_list
-pcre_info
-pcre_fullinfo
-pcre_maketables
-pcre_study
-pcre_version
-
-regcomp
-regexec
-regerror
-regfree
diff --git a/ext/pcre/pcrelib/pcre.h b/ext/pcre/pcrelib/pcre.h
deleted file mode 100644
index b33045c4f3..0000000000
--- a/ext/pcre/pcrelib/pcre.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/* Copyright (c) 1997-2003 University of Cambridge */
-
-#ifndef _PCRE_H
-#define _PCRE_H
-
-/* The file pcre.h is build by "configure". Do not edit it; instead
-make changes to pcre.in. */
-
-#include "php_compat.h"
-
-#define PCRE_MAJOR 3
-#define PCRE_MINOR 92
-#define PCRE_DATE 11-Sep-2002
-
-/* Win32 uses DLL by default */
-
-#ifdef _WIN32
-# ifdef PHP_EXPORTS
-# define PCRE_DL_IMPORT
-# else
-# define PCRE_DL_IMPORT __declspec(dllimport)
-# endif
-#else
-# define PCRE_DL_IMPORT
-#endif
-
-/* Have to include stdlib.h in order to ensure that size_t is defined;
-it is needed here for malloc. */
-
-#include <stdlib.h>
-
-/* Allow for C++ users */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Options */
-
-#define PCRE_CASELESS 0x0001
-#define PCRE_MULTILINE 0x0002
-#define PCRE_DOTALL 0x0004
-#define PCRE_EXTENDED 0x0008
-#define PCRE_ANCHORED 0x0010
-#define PCRE_DOLLAR_ENDONLY 0x0020
-#define PCRE_EXTRA 0x0040
-#define PCRE_NOTBOL 0x0080
-#define PCRE_NOTEOL 0x0100
-#define PCRE_UNGREEDY 0x0200
-#define PCRE_NOTEMPTY 0x0400
-#define PCRE_UTF8 0x0800
-
-/* Exec-time and get-time error codes */
-
-#define PCRE_ERROR_NOMATCH (-1)
-#define PCRE_ERROR_NULL (-2)
-#define PCRE_ERROR_BADOPTION (-3)
-#define PCRE_ERROR_BADMAGIC (-4)
-#define PCRE_ERROR_UNKNOWN_NODE (-5)
-#define PCRE_ERROR_NOMEMORY (-6)
-#define PCRE_ERROR_NOSUBSTRING (-7)
-
-/* Request types for pcre_fullinfo() */
-
-#define PCRE_INFO_OPTIONS 0
-#define PCRE_INFO_SIZE 1
-#define PCRE_INFO_CAPTURECOUNT 2
-#define PCRE_INFO_BACKREFMAX 3
-#define PCRE_INFO_FIRSTCHAR 4
-#define PCRE_INFO_FIRSTTABLE 5
-#define PCRE_INFO_LASTLITERAL 6
-#define PCRE_INFO_NAMEENTRYSIZE 7
-#define PCRE_INFO_NAMECOUNT 8
-#define PCRE_INFO_NAMETABLE 9
-
-/* Types */
-
-struct real_pcre; /* declaration; the definition is private */
-struct real_pcre_extra; /* declaration; the definition is private */
-
-typedef struct real_pcre pcre;
-typedef struct real_pcre_extra pcre_extra;
-
-/* The structure for passing out data via the pcre_callout_function. We use a
-structure so that new fields can be added on the end in future versions,
-without changing the API of the function, thereby allowing old clients to work
-without modification. */
-
-typedef struct pcre_callout_block {
- int version; /* Identifies version of block */
- /* ------------------------ Version 0 ------------------------------- */
- int callout_number; /* Number compiled into pattern */
- int *offset_vector; /* The offset vector */
- const char *subject; /* The subject being matched */
- int subject_length; /* The length of the subject */
- int start_match; /* Offset to start of this match attempt */
- int current_position; /* Where we currently are */
- int capture_top; /* Max current capture */
- int capture_last; /* Most recently closed capture */
- /* ------------------------------------------------------------------ */
-} pcre_callout_block;
-
-/* Indirection for store get and free functions. These can be set to
-alternative malloc/free functions if required. There is also an optional
-callout function that is triggered by the (?) regex item. Some magic is
-required for Win32 DLL; it is null on other OS. For Virtual Pascal, these have
-to be different again. */
-
-#ifndef VPCOMPAT
-PCRE_DL_IMPORT extern void *(*pcre_malloc)(size_t);
-PCRE_DL_IMPORT extern void (*pcre_free)(void *);
-PCRE_DL_IMPORT extern int (*pcre_callout)(pcre_callout_block *);
-#else /* VPCOMPAT */
-extern void *pcre_malloc(size_t);
-extern void pcre_free(void *);
-extern int pcre_callout(pcre_callout_block *);
-#endif /* VPCOMPAT */
-
-/* Exported PCRE functions */
-
-PCRE_DL_IMPORT extern pcre *pcre_compile(const char *, int, const char **,
- int *, const unsigned char *);
-PCRE_DL_IMPORT extern int pcre_copy_substring(const char *, int *, int, int,
- char *, int);
-PCRE_DL_IMPORT extern int pcre_exec(const pcre *, const pcre_extra *,
- const char *, int, int, int, int *, int);
-PCRE_DL_IMPORT extern void pcre_free_substring(const char *);
-PCRE_DL_IMPORT extern void pcre_free_substring_list(const char **);
-PCRE_DL_IMPORT extern int pcre_get_substring(const char *, int *, int, int,
- const char **);
-PCRE_DL_IMPORT extern int pcre_get_substring_list(const char *, int *, int,
- const char ***);
-PCRE_DL_IMPORT extern int pcre_info(const pcre *, int *, int *);
-PCRE_DL_IMPORT extern int pcre_fullinfo(const pcre *, const pcre_extra *, int,
- void *);
-PCRE_DL_IMPORT extern const unsigned char *pcre_maketables(void);
-PCRE_DL_IMPORT extern pcre_extra *pcre_study(const pcre *, int, const char **);
-PCRE_DL_IMPORT extern const char *pcre_version(void);
-
-#undef PCRE_DL_IMPORT
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* End of pcre.h */
diff --git a/ext/pcre/pcrelib/pcregrep.c b/ext/pcre/pcrelib/pcregrep.c
deleted file mode 100644
index 87bb65ccbd..0000000000
--- a/ext/pcre/pcrelib/pcregrep.c
+++ /dev/null
@@ -1,640 +0,0 @@
-/*************************************************
-* pcregrep program *
-*************************************************/
-
-/* This is a grep program that uses the PCRE regular expression library to do
-its pattern matching. On a Unix or Win32 system it can recurse into
-directories. */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "config.h"
-#include "pcre.h"
-
-#define FALSE 0
-#define TRUE 1
-
-typedef int BOOL;
-
-#define VERSION "2.2 10-Sep-2003"
-#define MAX_PATTERN_COUNT 100
-
-
-/*************************************************
-* Global variables *
-*************************************************/
-
-static char *pattern_filename = NULL;
-static int pattern_count = 0;
-static pcre **pattern_list;
-static pcre_extra **hints_list;
-
-static BOOL count_only = FALSE;
-static BOOL filenames = TRUE;
-static BOOL filenames_only = FALSE;
-static BOOL invert = FALSE;
-static BOOL number = FALSE;
-static BOOL recurse = FALSE;
-static BOOL silent = FALSE;
-static BOOL whole_lines = FALSE;
-
-/* Structure for options and list of them */
-
-typedef struct option_item {
- int one_char;
- char *long_name;
- char *help_text;
-} option_item;
-
-static option_item optionlist[] = {
- { -1, "help", "display this help and exit" },
- { 'c', "count", "print only a count of matching lines per FILE" },
- { 'h', "no-filename", "suppress the prefixing filename on output" },
- { 'i', "ignore-case", "ignore case distinctions" },
- { 'l', "files-with-matches", "print only FILE names containing matches" },
- { 'n', "line-number", "print line number with output lines" },
- { 'r', "recursive", "recursively scan sub-directories" },
- { 's', "no-messages", "suppress error messages" },
- { 'V', "version", "print version information and exit" },
- { 'v', "invert-match", "select non-matching lines" },
- { 'x', "line-regex", "force PATTERN to match only whole lines" },
- { 'x', "line-regexp", "force PATTERN to match only whole lines" },
- { 0, NULL, NULL }
-};
-
-
-/*************************************************
-* Functions for directory scanning *
-*************************************************/
-
-/* These functions are defined so that they can be made system specific,
-although at present the only ones are for Unix, Win32, and for "no directory
-recursion support". */
-
-
-/************* Directory scanning in Unix ***********/
-
-#if IS_UNIX
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <dirent.h>
-
-typedef DIR directory_type;
-
-int
-isdirectory(char *filename)
-{
-struct stat statbuf;
-if (stat(filename, &statbuf) < 0)
- return 0; /* In the expectation that opening as a file will fail */
-return ((statbuf.st_mode & S_IFMT) == S_IFDIR)? '/' : 0;
-}
-
-directory_type *
-opendirectory(char *filename)
-{
-return opendir(filename);
-}
-
-char *
-readdirectory(directory_type *dir)
-{
-for (;;)
- {
- struct dirent *dent = readdir(dir);
- if (dent == NULL) return NULL;
- if (strcmp(dent->d_name, ".") != 0 && strcmp(dent->d_name, "..") != 0)
- return dent->d_name;
- }
-return NULL; /* Keep compiler happy; never executed */
-}
-
-void
-closedirectory(directory_type *dir)
-{
-closedir(dir);
-}
-
-
-/************* Directory scanning in Win32 ***********/
-
-/* I (Philip Hazel) have no means of testing this code. It was contributed by
-Lionel Fourquaux. */
-
-
-#elif HAVE_WIN32API
-
-#ifndef STRICT
-# define STRICT
-#endif
-#ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-#endif
-#include <windows.h>
-
-typedef struct directory_type
-{
-HANDLE handle;
-BOOL first;
-WIN32_FIND_DATA data;
-} directory_type;
-
-int
-isdirectory(char *filename)
-{
-DWORD attr = GetFileAttributes(filename);
-if (attr == INVALID_FILE_ATTRIBUTES)
- return 0;
-return ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) ? '/' : 0;
-}
-
-directory_type *
-opendirectory(char *filename)
-{
-size_t len;
-char *pattern;
-directory_type *dir;
-DWORD err;
-len = strlen(filename);
-pattern = (char *) malloc(len + 3);
-dir = (directory_type *) malloc(sizeof(*dir));
-if ((pattern == NULL) || (dir == NULL))
- {
- fprintf(stderr, "pcregrep: malloc failed\n");
- exit(2);
- }
-memcpy(pattern, filename, len);
-memcpy(&(pattern[len]), "\\*", 3);
-dir->handle = FindFirstFile(pattern, &(dir->data));
-if (dir->handle != INVALID_HANDLE_VALUE)
- {
- free(pattern);
- dir->first = TRUE;
- return dir;
- }
-err = GetLastError();
-free(pattern);
-free(dir);
-errno = (err == ERROR_ACCESS_DENIED) ? EACCES : ENOENT;
-return NULL;
-}
-
-char *
-readdirectory(directory_type *dir)
-{
-for (;;)
- {
- if (!dir->first)
- {
- if (!FindNextFile(dir->handle, &(dir->data)))
- return NULL;
- }
- else
- {
- dir->first = FALSE;
- }
- if (strcmp(dir->data.cFileName, ".") != 0 && strcmp(dir->data.cFileName, "..") != 0)
- return dir->data.cFileName;
- }
-#ifndef _MSC_VER
-return NULL; /* Keep compiler happy; never executed */
-#endif
-}
-
-void
-closedirectory(directory_type *dir)
-{
-FindClose(dir->handle);
-free(dir);
-}
-
-
-/************* Directory scanning when we can't do it ***********/
-
-/* The type is void, and apart from isdirectory(), the functions do nothing. */
-
-#else
-
-typedef void directory_type;
-
-int isdirectory(char *filename) { return FALSE; }
-directory_type * opendirectory(char *filename) {}
-char *readdirectory(directory_type *dir) {}
-void closedirectory(directory_type *dir) {}
-
-#endif
-
-
-
-#if ! HAVE_STRERROR
-/*************************************************
-* Provide strerror() for non-ANSI libraries *
-*************************************************/
-
-/* Some old-fashioned systems still around (e.g. SunOS4) don't have strerror()
-in their libraries, but can provide the same facility by this simple
-alternative function. */
-
-extern int sys_nerr;
-extern char *sys_errlist[];
-
-char *
-strerror(int n)
-{
-if (n < 0 || n >= sys_nerr) return "unknown error number";
-return sys_errlist[n];
-}
-#endif /* HAVE_STRERROR */
-
-
-
-/*************************************************
-* Grep an individual file *
-*************************************************/
-
-static int
-pcregrep(FILE *in, char *name)
-{
-int rc = 1;
-int linenumber = 0;
-int count = 0;
-int offsets[99];
-char buffer[BUFSIZ];
-
-while (fgets(buffer, sizeof(buffer), in) != NULL)
- {
- BOOL match = FALSE;
- int i;
- int length = (int)strlen(buffer);
- if (length > 0 && buffer[length-1] == '\n') buffer[--length] = 0;
- linenumber++;
-
- for (i = 0; !match && i < pattern_count; i++)
- {
- match = pcre_exec(pattern_list[i], hints_list[i], buffer, length, 0, 0,
- offsets, 99) >= 0;
- if (match && whole_lines && offsets[1] != length) match = FALSE;
- }
-
- if (match != invert)
- {
- if (count_only) count++;
-
- else if (filenames_only)
- {
- fprintf(stdout, "%s\n", (name == NULL)? "<stdin>" : name);
- return 0;
- }
-
- else if (silent) return 0;
-
- else
- {
- if (name != NULL) fprintf(stdout, "%s:", name);
- if (number) fprintf(stdout, "%d:", linenumber);
- fprintf(stdout, "%s\n", buffer);
- }
-
- rc = 0;
- }
- }
-
-if (count_only)
- {
- if (name != NULL) fprintf(stdout, "%s:", name);
- fprintf(stdout, "%d\n", count);
- }
-
-return rc;
-}
-
-
-
-
-/*************************************************
-* Grep a file or recurse into a directory *
-*************************************************/
-
-static int
-grep_or_recurse(char *filename, BOOL recurse, BOOL show_filenames,
- BOOL only_one_at_top)
-{
-int rc = 1;
-int sep;
-FILE *in;
-
-/* If the file is a directory and we are recursing, scan each file within it.
-The scanning code is localized so it can be made system-specific. */
-
-if ((sep = isdirectory(filename)) != 0 && recurse)
- {
- char buffer[1024];
- char *nextfile;
- directory_type *dir = opendirectory(filename);
-
- if (dir == NULL)
- {
- fprintf(stderr, "pcregrep: Failed to open directory %s: %s\n", filename,
- strerror(errno));
- return 2;
- }
-
- while ((nextfile = readdirectory(dir)) != NULL)
- {
- int frc;
- sprintf(buffer, "%.512s%c%.128s", filename, sep, nextfile);
- frc = grep_or_recurse(buffer, recurse, TRUE, FALSE);
- if (frc == 0 && rc == 1) rc = 0;
- }
-
- closedirectory(dir);
- return rc;
- }
-
-/* If the file is not a directory, or we are not recursing, scan it. If this is
-the first and only argument at top level, we don't show the file name (unless
-we are only showing the file name). Otherwise, control is via the
-show_filenames variable. */
-
-in = fopen(filename, "r");
-if (in == NULL)
- {
- fprintf(stderr, "pcregrep: Failed to open %s: %s\n", filename, strerror(errno));
- return 2;
- }
-
-rc = pcregrep(in, (filenames_only || (show_filenames && !only_one_at_top))?
- filename : NULL);
-fclose(in);
-return rc;
-}
-
-
-
-
-/*************************************************
-* Usage function *
-*************************************************/
-
-static int
-usage(int rc)
-{
-fprintf(stderr, "Usage: pcregrep [-Vcfhilnrsvx] [long-options] [pattern] [file1 file2 ...]\n");
-fprintf(stderr, "Type `pcregrep --help' for more information.\n");
-return rc;
-}
-
-
-
-
-/*************************************************
-* Help function *
-*************************************************/
-
-static void
-help(void)
-{
-option_item *op;
-
-printf("Usage: pcregrep [OPTION]... [PATTERN] [FILE1 FILE2 ...]\n");
-printf("Search for PATTERN in each FILE or standard input.\n");
-printf("PATTERN must be present if -f is not used.\n");
-printf("Example: pcregrep -i 'hello.*world' menu.h main.c\n\n");
-
-printf("Options:\n");
-
-for (op = optionlist; op->one_char != 0; op++)
- {
- int n;
- char s[4];
- if (op->one_char > 0) sprintf(s, "-%c,", op->one_char); else strcpy(s, " ");
- printf(" %s --%s%n", s, op->long_name, &n);
- n = 30 - n;
- if (n < 1) n = 1;
- printf("%.*s%s\n", n, " ", op->help_text);
- }
-
-printf("\n -f<filename> or --file=<filename>\n");
-printf(" Read patterns from <filename> instead of using a command line option.\n");
-printf(" Trailing white space is removed; blanks lines are ignored.\n");
-printf(" There is a maximum of %d patterns.\n", MAX_PATTERN_COUNT);
-
-printf("\nWith no FILE, read standard input. If fewer than two FILEs given, assume -h.\n");
-printf("Exit status is 0 if any matches, 1 if no matches, and 2 if trouble.\n");
-}
-
-
-
-
-/*************************************************
-* Handle an option *
-*************************************************/
-
-static int
-handle_option(int letter, int options)
-{
-switch(letter)
- {
- case -1: help(); exit(0);
- case 'c': count_only = TRUE; break;
- case 'h': filenames = FALSE; break;
- case 'i': options |= PCRE_CASELESS; break;
- case 'l': filenames_only = TRUE;
- case 'n': number = TRUE; break;
- case 'r': recurse = TRUE; break;
- case 's': silent = TRUE; break;
- case 'v': invert = TRUE; break;
- case 'x': whole_lines = TRUE; options |= PCRE_ANCHORED; break;
-
- case 'V':
- fprintf(stderr, "pcregrep version %s using ", VERSION);
- fprintf(stderr, "PCRE version %s\n", pcre_version());
- exit(0);
- break;
-
- default:
- fprintf(stderr, "pcregrep: Unknown option -%c\n", letter);
- exit(usage(2));
- }
-
-return options;
-}
-
-
-
-
-/*************************************************
-* Main program *
-*************************************************/
-
-int
-main(int argc, char **argv)
-{
-int i, j;
-int rc = 1;
-int options = 0;
-int errptr;
-const char *error;
-BOOL only_one_at_top;
-
-/* Process the options */
-
-for (i = 1; i < argc; i++)
- {
- if (argv[i][0] != '-') break;
-
- /* Missing options */
-
- if (argv[i][1] == 0) exit(usage(2));
-
- /* Long name options */
-
- if (argv[i][1] == '-')
- {
- option_item *op;
-
- if (strncmp(argv[i]+2, "file=", 5) == 0)
- {
- pattern_filename = argv[i] + 7;
- continue;
- }
-
- for (op = optionlist; op->one_char != 0; op++)
- {
- if (strcmp(argv[i]+2, op->long_name) == 0)
- {
- options = handle_option(op->one_char, options);
- break;
- }
- }
- if (op->one_char == 0)
- {
- fprintf(stderr, "pcregrep: Unknown option %s\n", argv[i]);
- exit(usage(2));
- }
- }
-
- /* One-char options */
-
- else
- {
- char *s = argv[i] + 1;
- while (*s != 0)
- {
- if (*s == 'f')
- {
- pattern_filename = s + 1;
- if (pattern_filename[0] == 0)
- {
- if (i >= argc - 1)
- {
- fprintf(stderr, "pcregrep: File name missing after -f\n");
- exit(usage(2));
- }
- pattern_filename = argv[++i];
- }
- break;
- }
- else options = handle_option(*s++, options);
- }
- }
- }
-
-pattern_list = malloc(MAX_PATTERN_COUNT * sizeof(pcre *));
-hints_list = malloc(MAX_PATTERN_COUNT * sizeof(pcre_extra *));
-
-if (pattern_list == NULL || hints_list == NULL)
- {
- fprintf(stderr, "pcregrep: malloc failed\n");
- return 2;
- }
-
-/* Compile the regular expression(s). */
-
-if (pattern_filename != NULL)
- {
- FILE *f = fopen(pattern_filename, "r");
- char buffer[BUFSIZ];
- if (f == NULL)
- {
- fprintf(stderr, "pcregrep: Failed to open %s: %s\n", pattern_filename,
- strerror(errno));
- return 2;
- }
- while (fgets(buffer, sizeof(buffer), f) != NULL)
- {
- char *s = buffer + (int)strlen(buffer);
- if (pattern_count >= MAX_PATTERN_COUNT)
- {
- fprintf(stderr, "pcregrep: Too many patterns in file (max %d)\n",
- MAX_PATTERN_COUNT);
- return 2;
- }
- while (s > buffer && isspace((unsigned char)(s[-1]))) s--;
- if (s == buffer) continue;
- *s = 0;
- pattern_list[pattern_count] = pcre_compile(buffer, options, &error,
- &errptr, NULL);
- if (pattern_list[pattern_count++] == NULL)
- {
- fprintf(stderr, "pcregrep: Error in regex number %d at offset %d: %s\n",
- pattern_count, errptr, error);
- return 2;
- }
- }
- fclose(f);
- }
-
-/* If no file name, a single regex must be given inline */
-
-else
- {
- if (i >= argc) return usage(2);
- pattern_list[0] = pcre_compile(argv[i++], options, &error, &errptr, NULL);
- if (pattern_list[0] == NULL)
- {
- fprintf(stderr, "pcregrep: Error in regex at offset %d: %s\n", errptr,
- error);
- return 2;
- }
- pattern_count++;
- }
-
-/* Study the regular expressions, as we will be running them may times */
-
-for (j = 0; j < pattern_count; j++)
- {
- hints_list[j] = pcre_study(pattern_list[j], 0, &error);
- if (error != NULL)
- {
- char s[16];
- if (pattern_count == 1) s[0] = 0; else sprintf(s, " number %d", j);
- fprintf(stderr, "pcregrep: Error while studying regex%s: %s\n", s, error);
- return 2;
- }
- }
-
-/* If there are no further arguments, do the business on stdin and exit */
-
-if (i >= argc) return pcregrep(stdin, NULL);
-
-/* Otherwise, work through the remaining arguments as files or directories.
-Pass in the fact that there is only one argument at top level - this suppresses
-the file name if the argument is not a directory. */
-
-only_one_at_top = (i == argc - 1);
-if (filenames_only) filenames = TRUE;
-
-for (; i < argc; i++)
- {
- int frc = grep_or_recurse(argv[i], recurse, filenames, only_one_at_top);
- if (frc == 0 && rc == 1) rc = 0;
- }
-
-return rc;
-}
-
-/* End */
diff --git a/ext/pcre/pcrelib/pcreposix.c b/ext/pcre/pcrelib/pcreposix.c
deleted file mode 100644
index 0ed55bb248..0000000000
--- a/ext/pcre/pcrelib/pcreposix.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/*
-This is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language. See
-the file Tech.Notes for some information on the internals.
-
-This module is a wrapper that provides a POSIX API to the underlying PCRE
-functions.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
- Copyright (c) 1997-2003 University of Cambridge
-
------------------------------------------------------------------------------
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
------------------------------------------------------------------------------
-*/
-
-#include "internal.h"
-#include "pcreposix.h"
-#include "stdlib.h"
-
-
-
-/* Corresponding tables of PCRE error messages and POSIX error codes. */
-
-static const char *estring[] = {
- ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9, ERR10,
- ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17, ERR18, ERR19, ERR20,
- ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR29, ERR29, ERR30,
- ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39, ERR40,
- ERR41, ERR42, ERR43 };
-
-static int eint[] = {
- REG_EESCAPE, /* "\\ at end of pattern" */
- REG_EESCAPE, /* "\\c at end of pattern" */
- REG_EESCAPE, /* "unrecognized character follows \\" */
- REG_BADBR, /* "numbers out of order in {} quantifier" */
- REG_BADBR, /* "number too big in {} quantifier" */
- REG_EBRACK, /* "missing terminating ] for character class" */
- REG_ECTYPE, /* "invalid escape sequence in character class" */
- REG_ERANGE, /* "range out of order in character class" */
- REG_BADRPT, /* "nothing to repeat" */
- REG_BADRPT, /* "operand of unlimited repeat could match the empty string" */
- REG_ASSERT, /* "internal error: unexpected repeat" */
- REG_BADPAT, /* "unrecognized character after (?" */
- REG_BADPAT, /* "POSIX named classes are supported only within a class" */
- REG_EPAREN, /* "missing )" */
- REG_ESUBREG, /* "reference to non-existent subpattern" */
- REG_INVARG, /* "erroffset passed as NULL" */
- REG_INVARG, /* "unknown option bit(s) set" */
- REG_EPAREN, /* "missing ) after comment" */
- REG_ESIZE, /* "parentheses nested too deeply" */
- REG_ESIZE, /* "regular expression too large" */
- REG_ESPACE, /* "failed to get memory" */
- REG_EPAREN, /* "unmatched brackets" */
- REG_ASSERT, /* "internal error: code overflow" */
- REG_BADPAT, /* "unrecognized character after (?<" */
- REG_BADPAT, /* "lookbehind assertion is not fixed length" */
- REG_BADPAT, /* "malformed number after (?(" */
- REG_BADPAT, /* "conditional group containe more than two branches" */
- REG_BADPAT, /* "assertion expected after (?(" */
- REG_BADPAT, /* "(?R or (?digits must be followed by )" */
- REG_ECTYPE, /* "unknown POSIX class name" */
- REG_BADPAT, /* "POSIX collating elements are not supported" */
- REG_INVARG, /* "this version of PCRE is not compiled with PCRE_UTF8 support" */
- REG_BADPAT, /* "characters with values > 255 are not yet supported in classes" */
- REG_BADPAT, /* "character value in \x{...} sequence is too large" */
- REG_BADPAT, /* "invalid condition (?(0)" */
- REG_BADPAT, /* "\\C not allowed in lookbehind assertion" */
- REG_EESCAPE, /* "PCRE does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X" */
- REG_BADPAT, /* "number after (?C is > 255" */
- REG_BADPAT, /* "closing ) for (?C expected" */
- REG_BADPAT, /* "recursive call could loop indefinitely" */
- REG_BADPAT, /* "unrecognized character after (?P" */
- REG_BADPAT, /* "syntax error after (?P" */
- REG_BADPAT /* "two named groups have the same name" */
-};
-
-/* Table of texts corresponding to POSIX error codes */
-
-static const char *pstring[] = {
- "", /* Dummy for value 0 */
- "internal error", /* REG_ASSERT */
- "invalid repeat counts in {}", /* BADBR */
- "pattern error", /* BADPAT */
- "? * + invalid", /* BADRPT */
- "unbalanced {}", /* EBRACE */
- "unbalanced []", /* EBRACK */
- "collation error - not relevant", /* ECOLLATE */
- "bad class", /* ECTYPE */
- "bad escape sequence", /* EESCAPE */
- "empty expression", /* EMPTY */
- "unbalanced ()", /* EPAREN */
- "bad range inside []", /* ERANGE */
- "expression too big", /* ESIZE */
- "failed to get memory", /* ESPACE */
- "bad back reference", /* ESUBREG */
- "bad argument", /* INVARG */
- "match failed" /* NOMATCH */
-};
-
-
-
-
-/*************************************************
-* Translate PCRE text code to int *
-*************************************************/
-
-/* PCRE compile-time errors are given as strings defined as macros. We can just
-look them up in a table to turn them into POSIX-style error codes. */
-
-static int
-pcre_posix_error_code(const char *s)
-{
-size_t i;
-for (i = 0; i < sizeof(estring)/sizeof(char *); i++)
- if (strcmp(s, estring[i]) == 0) return eint[i];
-return REG_ASSERT;
-}
-
-
-
-/*************************************************
-* Translate error code to string *
-*************************************************/
-
-size_t
-regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
-{
-const char *message, *addmessage;
-size_t length, addlength;
-
-message = (errcode >= (int)(sizeof(pstring)/sizeof(char *)))?
- "unknown error code" : pstring[errcode];
-length = strlen(message) + 1;
-
-addmessage = " at offset ";
-addlength = (preg != NULL && (int)preg->re_erroffset != -1)?
- strlen(addmessage) + 6 : 0;
-
-if (errbuf_size > 0)
- {
- if (addlength > 0 && errbuf_size >= length + addlength)
- sprintf(errbuf, "%s%s%-6d", message, addmessage, (int)preg->re_erroffset);
- else
- {
- strncpy(errbuf, message, errbuf_size - 1);
- errbuf[errbuf_size-1] = 0;
- }
- }
-
-return length + addlength;
-}
-
-
-
-
-/*************************************************
-* Free store held by a regex *
-*************************************************/
-
-void
-regfree(regex_t *preg)
-{
-(pcre_free)(preg->re_pcre);
-}
-
-
-
-
-/*************************************************
-* Compile a regular expression *
-*************************************************/
-
-/*
-Arguments:
- preg points to a structure for recording the compiled expression
- pattern the pattern to compile
- cflags compilation flags
-
-Returns: 0 on success
- various non-zero codes on failure
-*/
-
-int
-regcomp(regex_t *preg, const char *pattern, int cflags)
-{
-const char *errorptr;
-int erroffset;
-int options = 0;
-
-if ((cflags & REG_ICASE) != 0) options |= PCRE_CASELESS;
-if ((cflags & REG_NEWLINE) != 0) options |= PCRE_MULTILINE;
-
-preg->re_pcre = pcre_compile(pattern, options, &errorptr, &erroffset, NULL);
-preg->re_erroffset = erroffset;
-
-if (preg->re_pcre == NULL) return pcre_posix_error_code(errorptr);
-
-preg->re_nsub = pcre_info(preg->re_pcre, NULL, NULL);
-return 0;
-}
-
-
-
-
-/*************************************************
-* Match a regular expression *
-*************************************************/
-
-/* Unfortunately, PCRE requires 3 ints of working space for each captured
-substring, so we have to get and release working store instead of just using
-the POSIX structures as was done in earlier releases when PCRE needed only 2
-ints. However, if the number of possible capturing brackets is small, use a
-block of store on the stack, to reduce the use of malloc/free. The threshold is
-in a macro that can be changed at configure time. */
-
-int
-regexec(regex_t *preg, const char *string, size_t nmatch,
- regmatch_t pmatch[], int eflags)
-{
-int rc;
-int options = 0;
-int *ovector = NULL;
-int small_ovector[POSIX_MALLOC_THRESHOLD * 3];
-BOOL allocated_ovector = FALSE;
-
-if ((eflags & REG_NOTBOL) != 0) options |= PCRE_NOTBOL;
-if ((eflags & REG_NOTEOL) != 0) options |= PCRE_NOTEOL;
-
-preg->re_erroffset = (size_t)(-1); /* Only has meaning after compile */
-
-if (nmatch > 0)
- {
- if (nmatch <= POSIX_MALLOC_THRESHOLD)
- {
- ovector = &(small_ovector[0]);
- }
- else
- {
- ovector = (int *)malloc(sizeof(int) * nmatch * 3);
- if (ovector == NULL) return REG_ESPACE;
- allocated_ovector = TRUE;
- }
- }
-
-rc = pcre_exec(preg->re_pcre, NULL, string, (int)strlen(string), 0, options,
- ovector, nmatch * 3);
-
-if (rc == 0) rc = nmatch; /* All captured slots were filled in */
-
-if (rc >= 0)
- {
- size_t i;
- for (i = 0; i < (size_t)rc; i++)
- {
- pmatch[i].rm_so = ovector[i*2];
- pmatch[i].rm_eo = ovector[i*2+1];
- }
- if (allocated_ovector) free(ovector);
- for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1;
- return 0;
- }
-
-else
- {
- if (allocated_ovector) free(ovector);
- switch(rc)
- {
- case PCRE_ERROR_NOMATCH: return REG_NOMATCH;
- case PCRE_ERROR_NULL: return REG_INVARG;
- case PCRE_ERROR_BADOPTION: return REG_INVARG;
- case PCRE_ERROR_BADMAGIC: return REG_INVARG;
- case PCRE_ERROR_UNKNOWN_NODE: return REG_ASSERT;
- case PCRE_ERROR_NOMEMORY: return REG_ESPACE;
- default: return REG_ASSERT;
- }
- }
-}
-
-/* End of pcreposix.c */
diff --git a/ext/pcre/pcrelib/pcreposix.h b/ext/pcre/pcrelib/pcreposix.h
deleted file mode 100644
index e70af2de84..0000000000
--- a/ext/pcre/pcrelib/pcreposix.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/* Copyright (c) 1997-2001 University of Cambridge */
-
-#ifndef _PCREPOSIX_H
-#define _PCREPOSIX_H
-
-/* This is the header for the POSIX wrapper interface to the PCRE Perl-
-Compatible Regular Expression library. It defines the things POSIX says should
-be there. I hope. */
-
-/* Have to include stdlib.h in order to ensure that size_t is defined. */
-
-#include <stdlib.h>
-
-/* Allow for C++ users */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Options defined by POSIX. */
-
-#define REG_ICASE 0x01
-#define REG_NEWLINE 0x02
-#define REG_NOTBOL 0x04
-#define REG_NOTEOL 0x08
-
-/* These are not used by PCRE, but by defining them we make it easier
-to slot PCRE into existing programs that make POSIX calls. */
-
-#define REG_EXTENDED 0
-#define REG_NOSUB 0
-
-/* Error values. Not all these are relevant or used by the wrapper. */
-
-enum {
- REG_ASSERT = 1, /* internal error ? */
- REG_BADBR, /* invalid repeat counts in {} */
- REG_BADPAT, /* pattern error */
- REG_BADRPT, /* ? * + invalid */
- REG_EBRACE, /* unbalanced {} */
- REG_EBRACK, /* unbalanced [] */
- REG_ECOLLATE, /* collation error - not relevant */
- REG_ECTYPE, /* bad class */
- REG_EESCAPE, /* bad escape sequence */
- REG_EMPTY, /* empty expression */
- REG_EPAREN, /* unbalanced () */
- REG_ERANGE, /* bad range inside [] */
- REG_ESIZE, /* expression too big */
- REG_ESPACE, /* failed to get memory */
- REG_ESUBREG, /* bad back reference */
- REG_INVARG, /* bad argument */
- REG_NOMATCH /* match failed */
-};
-
-
-/* The structure representing a compiled regular expression. */
-
-typedef struct {
- void *re_pcre;
- size_t re_nsub;
- size_t re_erroffset;
-} regex_t;
-
-/* The structure in which a captured offset is returned. */
-
-typedef int regoff_t;
-
-typedef struct {
- regoff_t rm_so;
- regoff_t rm_eo;
-} regmatch_t;
-
-/* The functions */
-
-extern int regcomp(regex_t *, const char *, int);
-extern int regexec(regex_t *, const char *, size_t, regmatch_t *, int);
-extern size_t regerror(int, const regex_t *, char *, size_t);
-extern void regfree(regex_t *);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* End of pcreposix.h */
diff --git a/ext/pcre/pcrelib/pcretest.c b/ext/pcre/pcrelib/pcretest.c
deleted file mode 100644
index 8977ef7f66..0000000000
--- a/ext/pcre/pcrelib/pcretest.c
+++ /dev/null
@@ -1,1274 +0,0 @@
-/*************************************************
-* PCRE testing program *
-*************************************************/
-
-/* This program was hacked up as a tester for PCRE. I really should have
-written it more tidily in the first place. Will I ever learn? It has grown and
-been extended and consequently is now rather untidy in places. */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <locale.h>
-
-/* We need the internal info for displaying the results of pcre_study(). Also
-for getting the opcodes for showing compiled code. */
-
-#include "internal.h"
-
-/* It is possible to compile this test program without including support for
-testing the POSIX interface, though this is not available via the standard
-Makefile. */
-
-#if !defined NOPOSIX
-#include "pcreposix.h"
-#endif
-
-#ifndef CLOCKS_PER_SEC
-#ifdef CLK_TCK
-#define CLOCKS_PER_SEC CLK_TCK
-#else
-#define CLOCKS_PER_SEC 100
-#endif
-#endif
-
-#define LOOPREPEAT 50000
-
-
-static FILE *outfile;
-static int log_store = 0;
-static int callout_count;
-static int callout_extra;
-static int callout_fail_count;
-static int callout_fail_id;
-static int first_callout;
-static int utf8;
-static size_t gotten_store;
-
-
-
-static int utf8_table1[] = {
- 0x0000007f, 0x000007ff, 0x0000ffff, 0x001fffff, 0x03ffffff, 0x7fffffff};
-
-static int utf8_table2[] = {
- 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
-
-static int utf8_table3[] = {
- 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
-
-
-
-/*************************************************
-* Print compiled regex *
-*************************************************/
-
-/* The code for doing this is held in a separate file that is also included in
-pcre.c when it is compiled with the debug switch. It defines a function called
-print_internals(), which uses a table of opcode lengths defined by the macro
-OP_LENGTHS, whose name must be OP_lengths. */
-
-static uschar OP_lengths[] = { OP_LENGTHS };
-
-#include "printint.c"
-
-
-
-/*************************************************
-* Read number from string *
-*************************************************/
-
-/* We don't use strtoul() because SunOS4 doesn't have it. Rather than mess
-around with conditional compilation, just do the job by hand. It is only used
-for unpicking the -o argument, so just keep it simple.
-
-Arguments:
- str string to be converted
- endptr where to put the end pointer
-
-Returns: the unsigned long
-*/
-
-static int
-get_value(unsigned char *str, unsigned char **endptr)
-{
-int result = 0;
-while(*str != 0 && isspace(*str)) str++;
-while (isdigit(*str)) result = result * 10 + (int)(*str++ - '0');
-*endptr = str;
-return(result);
-}
-
-
-
-/*************************************************
-* Convert character value to UTF-8 *
-*************************************************/
-
-/* This function takes an integer value in the range 0 - 0x7fffffff
-and encodes it as a UTF-8 character in 0 to 6 bytes.
-
-Arguments:
- cvalue the character value
- buffer pointer to buffer for result - at least 6 bytes long
-
-Returns: number of characters placed in the buffer
- -1 if input character is negative
- 0 if input character is positive but too big (only when
- int is longer than 32 bits)
-*/
-
-static int
-ord2utf8(int cvalue, unsigned char *buffer)
-{
-register int i, j;
-for (i = 0; i < sizeof(utf8_table1)/sizeof(int); i++)
- if (cvalue <= utf8_table1[i]) break;
-if (i >= sizeof(utf8_table1)/sizeof(int)) return 0;
-if (cvalue < 0) return -1;
-
-buffer += i;
-for (j = i; j > 0; j--)
- {
- *buffer-- = 0x80 | (cvalue & 0x3f);
- cvalue >>= 6;
- }
-*buffer = utf8_table2[i] | cvalue;
-return i + 1;
-}
-
-
-/*************************************************
-* Convert UTF-8 string to value *
-*************************************************/
-
-/* This function takes one or more bytes that represents a UTF-8 character,
-and returns the value of the character.
-
-Argument:
- buffer a pointer to the byte vector
- vptr a pointer to an int to receive the value
-
-Returns: > 0 => the number of bytes consumed
- -6 to 0 => malformed UTF-8 character at offset = (-return)
-*/
-
-int
-utf82ord(unsigned char *buffer, int *vptr)
-{
-int c = *buffer++;
-int d = c;
-int i, j, s;
-
-for (i = -1; i < 6; i++) /* i is number of additional bytes */
- {
- if ((d & 0x80) == 0) break;
- d <<= 1;
- }
-
-if (i == -1) { *vptr = c; return 1; } /* ascii character */
-if (i == 0 || i == 6) return 0; /* invalid UTF-8 */
-
-/* i now has a value in the range 1-5 */
-
-s = 6*i;
-d = (c & utf8_table3[i]) << s;
-
-for (j = 0; j < i; j++)
- {
- c = *buffer++;
- if ((c & 0xc0) != 0x80) return -(j+1);
- s -= 6;
- d |= (c & 0x3f) << s;
- }
-
-/* Check that encoding was the correct unique one */
-
-for (j = 0; j < sizeof(utf8_table1)/sizeof(int); j++)
- if (d <= utf8_table1[j]) break;
-if (j != i) return -(i+1);
-
-/* Valid value */
-
-*vptr = d;
-return i+1;
-}
-
-
-
-/*************************************************
-* Print character string *
-*************************************************/
-
-/* Character string printing function. Must handle UTF-8 strings in utf8
-mode. Yields number of characters printed. If handed a NULL file, just counts
-chars without printing. */
-
-static int pchars(unsigned char *p, int length, FILE *f)
-{
-int c;
-int yield = 0;
-
-while (length-- > 0)
- {
- if (utf8)
- {
- int rc = utf82ord(p, &c);
-
- if (rc > 0 && rc <= length + 1) /* Mustn't run over the end */
- {
- length -= rc - 1;
- p += rc;
- if (c < 256 && isprint(c))
- {
- if (f != NULL) fprintf(f, "%c", c);
- yield++;
- }
- else
- {
- int n;
- if (f != NULL) fprintf(f, "\\x{%02x}%n", c, &n);
- yield += n;
- }
- continue;
- }
- }
-
- /* Not UTF-8, or malformed UTF-8 */
-
- if (isprint(c = *(p++)))
- {
- if (f != NULL) fprintf(f, "%c", c);
- yield++;
- }
- else
- {
- if (f != NULL) fprintf(f, "\\x%02x", c);
- yield += 4;
- }
- }
-
-return yield;
-}
-
-
-
-/*************************************************
-* Callout function *
-*************************************************/
-
-/* Called from PCRE as a result of the (?C) item. We print out where we are in
-the match. Yield OK unless more callouts than the fail count. . */
-
-static int callout(pcre_callout_block *cb)
-{
-FILE *f = (first_callout | callout_extra)? outfile : NULL;
-int i, pre_start, post_start;
-
-if (callout_extra)
- {
- int i;
- fprintf(f, "Callout %d: last capture = %d\n",
- cb->callout_number, cb->capture_last);
-
- for (i = 0; i < cb->capture_top * 2; i += 2)
- {
- if (cb->offset_vector[i] < 0)
- fprintf(f, "%2d: <unset>\n", i/2);
- else
- {
- fprintf(f, "%2d: ", i/2);
- (void)pchars((unsigned char *)cb->subject + cb->offset_vector[i],
- cb->offset_vector[i+1] - cb->offset_vector[i], f);
- fprintf(f, "\n");
- }
- }
- }
-
-/* Re-print the subject in canonical form, the first time or if giving full
-datails. On subsequent calls in the same match, we use pchars just to find the
-printed lengths of the substrings. */
-
-if (f != NULL) fprintf(f, "--->");
-
-pre_start = pchars((unsigned char *)cb->subject, cb->start_match, f);
-post_start = pchars((unsigned char *)(cb->subject + cb->start_match),
- cb->current_position - cb->start_match, f);
-
-(void)pchars((unsigned char *)(cb->subject + cb->current_position),
- cb->subject_length - cb->current_position, f);
-
-if (f != NULL) fprintf(f, "\n");
-
-/* Always print appropriate indicators, with callout number if not already
-shown */
-
-if (callout_extra) fprintf(outfile, " ");
- else fprintf(outfile, "%3d ", cb->callout_number);
-
-for (i = 0; i < pre_start; i++) fprintf(outfile, " ");
-fprintf(outfile, "^");
-
-if (post_start > 0)
- {
- for (i = 0; i < post_start - 1; i++) fprintf(outfile, " ");
- fprintf(outfile, "^");
- }
-
-fprintf(outfile, "\n");
-
-first_callout = 0;
-
-return (cb->callout_number != callout_fail_id)? 0 :
- (++callout_count >= callout_fail_count)? 1 : 0;
-}
-
-
-/*************************************************
-* Local malloc function *
-*************************************************/
-
-/* Alternative malloc function, to test functionality and show the size of the
-compiled re. */
-
-static void *new_malloc(size_t size)
-{
-gotten_store = size;
-return malloc(size);
-}
-
-
-
-/*************************************************
-* Call pcre_fullinfo() *
-*************************************************/
-
-/* Get one piece of information from the pcre_fullinfo() function */
-
-static void new_info(pcre *re, pcre_extra *study, int option, void *ptr)
-{
-int rc;
-if ((rc = pcre_fullinfo(re, study, option, ptr)) < 0)
- fprintf(outfile, "Error %d from pcre_fullinfo(%d)\n", rc, option);
-}
-
-
-
-/*************************************************
-* Main Program *
-*************************************************/
-
-/* Read lines from named file or stdin and write to named file or stdout; lines
-consist of a regular expression, in delimiters and optionally followed by
-options, followed by a set of test data, terminated by an empty line. */
-
-int main(int argc, char **argv)
-{
-FILE *infile = stdin;
-int options = 0;
-int study_options = 0;
-int op = 1;
-int timeit = 0;
-int showinfo = 0;
-int showstore = 0;
-int size_offsets = 45;
-int size_offsets_max;
-int *offsets;
-#if !defined NOPOSIX
-int posix = 0;
-#endif
-int debug = 0;
-int done = 0;
-unsigned char buffer[30000];
-unsigned char dbuffer[1024];
-
-/* Static so that new_malloc can use it. */
-
-outfile = stdout;
-
-/* Scan options */
-
-while (argc > 1 && argv[op][0] == '-')
- {
- unsigned char *endptr;
-
- if (strcmp(argv[op], "-s") == 0 || strcmp(argv[op], "-m") == 0)
- showstore = 1;
- else if (strcmp(argv[op], "-t") == 0) timeit = 1;
- else if (strcmp(argv[op], "-i") == 0) showinfo = 1;
- else if (strcmp(argv[op], "-d") == 0) showinfo = debug = 1;
- else if (strcmp(argv[op], "-o") == 0 && argc > 2 &&
- ((size_offsets = get_value(argv[op+1], &endptr)), *endptr == 0))
- {
- op++;
- argc--;
- }
-#if !defined NOPOSIX
- else if (strcmp(argv[op], "-p") == 0) posix = 1;
-#endif
- else
- {
- printf("** Unknown or malformed option %s\n", argv[op]);
- printf("Usage: pcretest [-d] [-i] [-o <n>] [-p] [-s] [-t] [<input> [<output>]]\n");
- printf(" -d debug: show compiled code; implies -i\n"
- " -i show information about compiled pattern\n"
- " -o <n> set size of offsets vector to <n>\n");
-#if !defined NOPOSIX
- printf(" -p use POSIX interface\n");
-#endif
- printf(" -s output store information\n"
- " -t time compilation and execution\n");
- return 1;
- }
- op++;
- argc--;
- }
-
-/* Get the store for the offsets vector, and remember what it was */
-
-size_offsets_max = size_offsets;
-offsets = malloc(size_offsets_max * sizeof(int));
-if (offsets == NULL)
- {
- printf("** Failed to get %d bytes of memory for offsets vector\n",
- size_offsets_max * sizeof(int));
- return 1;
- }
-
-/* Sort out the input and output files */
-
-if (argc > 1)
- {
- infile = fopen(argv[op], "r");
- if (infile == NULL)
- {
- printf("** Failed to open %s\n", argv[op]);
- return 1;
- }
- }
-
-if (argc > 2)
- {
- outfile = fopen(argv[op+1], "w");
- if (outfile == NULL)
- {
- printf("** Failed to open %s\n", argv[op+1]);
- return 1;
- }
- }
-
-/* Set alternative malloc function */
-
-pcre_malloc = new_malloc;
-
-/* Heading line, then prompt for first regex if stdin */
-
-fprintf(outfile, "PCRE version %s\n\n", pcre_version());
-
-/* Main loop */
-
-while (!done)
- {
- pcre *re = NULL;
- pcre_extra *extra = NULL;
-
-#if !defined NOPOSIX /* There are still compilers that require no indent */
- regex_t preg;
- int do_posix = 0;
-#endif
-
- const char *error;
- unsigned char *p, *pp, *ppp;
- const unsigned char *tables = NULL;
- int do_study = 0;
- int do_debug = debug;
- int do_G = 0;
- int do_g = 0;
- int do_showinfo = showinfo;
- int do_showrest = 0;
- int erroroffset, len, delimiter;
-
- utf8 = 0;
-
- if (infile == stdin) printf(" re> ");
- if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) break;
- if (infile != stdin) fprintf(outfile, "%s", (char *)buffer);
- fflush(outfile);
-
- p = buffer;
- while (isspace(*p)) p++;
- if (*p == 0) continue;
-
- /* Get the delimiter and seek the end of the pattern; if is isn't
- complete, read more. */
-
- delimiter = *p++;
-
- if (isalnum(delimiter) || delimiter == '\\')
- {
- fprintf(outfile, "** Delimiter must not be alphameric or \\\n");
- goto SKIP_DATA;
- }
-
- pp = p;
-
- for(;;)
- {
- while (*pp != 0)
- {
- if (*pp == '\\' && pp[1] != 0) pp++;
- else if (*pp == delimiter) break;
- pp++;
- }
- if (*pp != 0) break;
-
- len = sizeof(buffer) - (pp - buffer);
- if (len < 256)
- {
- fprintf(outfile, "** Expression too long - missing delimiter?\n");
- goto SKIP_DATA;
- }
-
- if (infile == stdin) printf(" > ");
- if (fgets((char *)pp, len, infile) == NULL)
- {
- fprintf(outfile, "** Unexpected EOF\n");
- done = 1;
- goto CONTINUE;
- }
- if (infile != stdin) fprintf(outfile, "%s", (char *)pp);
- }
-
- /* If the first character after the delimiter is backslash, make
- the pattern end with backslash. This is purely to provide a way
- of testing for the error message when a pattern ends with backslash. */
-
- if (pp[1] == '\\') *pp++ = '\\';
-
- /* Terminate the pattern at the delimiter */
-
- *pp++ = 0;
-
- /* Look for options after final delimiter */
-
- options = 0;
- study_options = 0;
- log_store = showstore; /* default from command line */
-
- while (*pp != 0)
- {
- switch (*pp++)
- {
- case 'g': do_g = 1; break;
- case 'i': options |= PCRE_CASELESS; break;
- case 'm': options |= PCRE_MULTILINE; break;
- case 's': options |= PCRE_DOTALL; break;
- case 'x': options |= PCRE_EXTENDED; break;
-
- case '+': do_showrest = 1; break;
- case 'A': options |= PCRE_ANCHORED; break;
- case 'D': do_debug = do_showinfo = 1; break;
- case 'E': options |= PCRE_DOLLAR_ENDONLY; break;
- case 'G': do_G = 1; break;
- case 'I': do_showinfo = 1; break;
- case 'M': log_store = 1; break;
-
-#if !defined NOPOSIX
- case 'P': do_posix = 1; break;
-#endif
-
- case 'S': do_study = 1; break;
- case 'U': options |= PCRE_UNGREEDY; break;
- case 'X': options |= PCRE_EXTRA; break;
- case '8': options |= PCRE_UTF8; utf8 = 1; break;
-
- case 'L':
- ppp = pp;
- while (*ppp != '\n' && *ppp != ' ') ppp++;
- *ppp = 0;
- if (setlocale(LC_CTYPE, (const char *)pp) == NULL)
- {
- fprintf(outfile, "** Failed to set locale \"%s\"\n", pp);
- goto SKIP_DATA;
- }
- tables = pcre_maketables();
- pp = ppp;
- break;
-
- case '\n': case ' ': break;
- default:
- fprintf(outfile, "** Unknown option '%c'\n", pp[-1]);
- goto SKIP_DATA;
- }
- }
-
- /* Handle compiling via the POSIX interface, which doesn't support the
- timing, showing, or debugging options, nor the ability to pass over
- local character tables. */
-
-#if !defined NOPOSIX
- if (posix || do_posix)
- {
- int rc;
- int cflags = 0;
- if ((options & PCRE_CASELESS) != 0) cflags |= REG_ICASE;
- if ((options & PCRE_MULTILINE) != 0) cflags |= REG_NEWLINE;
- rc = regcomp(&preg, (char *)p, cflags);
-
- /* Compilation failed; go back for another re, skipping to blank line
- if non-interactive. */
-
- if (rc != 0)
- {
- (void)regerror(rc, &preg, (char *)buffer, sizeof(buffer));
- fprintf(outfile, "Failed: POSIX code %d: %s\n", rc, buffer);
- goto SKIP_DATA;
- }
- }
-
- /* Handle compiling via the native interface */
-
- else
-#endif /* !defined NOPOSIX */
-
- {
- if (timeit)
- {
- register int i;
- clock_t time_taken;
- clock_t start_time = clock();
- for (i = 0; i < LOOPREPEAT; i++)
- {
- re = pcre_compile((char *)p, options, &error, &erroroffset, tables);
- if (re != NULL) free(re);
- }
- time_taken = clock() - start_time;
- fprintf(outfile, "Compile time %.3f milliseconds\n",
- (((double)time_taken * 1000.0) / (double)LOOPREPEAT) /
- (double)CLOCKS_PER_SEC);
- }
-
- re = pcre_compile((char *)p, options, &error, &erroroffset, tables);
-
- /* Compilation failed; go back for another re, skipping to blank line
- if non-interactive. */
-
- if (re == NULL)
- {
- fprintf(outfile, "Failed: %s at offset %d\n", error, erroroffset);
- SKIP_DATA:
- if (infile != stdin)
- {
- for (;;)
- {
- if (fgets((char *)buffer, sizeof(buffer), infile) == NULL)
- {
- done = 1;
- goto CONTINUE;
- }
- len = (int)strlen((char *)buffer);
- while (len > 0 && isspace(buffer[len-1])) len--;
- if (len == 0) break;
- }
- fprintf(outfile, "\n");
- }
- goto CONTINUE;
- }
-
- /* Compilation succeeded; print data if required. There are now two
- info-returning functions. The old one has a limited interface and
- returns only limited data. Check that it agrees with the newer one. */
-
- if (log_store)
- fprintf(outfile, "Memory allocation (code space): %d\n",
- (int)(gotten_store -
- sizeof(real_pcre) -
- ((real_pcre *)re)->name_count * ((real_pcre *)re)->name_entry_size));
-
- if (do_showinfo)
- {
- unsigned long int get_options;
- int old_first_char, old_options, old_count;
- int count, backrefmax, first_char, need_char;
- int nameentrysize, namecount;
- const uschar *nametable;
- size_t size;
-
- if (do_debug)
- {
- fprintf(outfile, "------------------------------------------------------------------\n");
- print_internals(re, outfile);
- }
-
- new_info(re, NULL, PCRE_INFO_OPTIONS, &get_options);
- new_info(re, NULL, PCRE_INFO_SIZE, &size);
- new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count);
- new_info(re, NULL, PCRE_INFO_BACKREFMAX, &backrefmax);
- new_info(re, NULL, PCRE_INFO_FIRSTCHAR, &first_char);
- new_info(re, NULL, PCRE_INFO_LASTLITERAL, &need_char);
- new_info(re, NULL, PCRE_INFO_NAMEENTRYSIZE, &nameentrysize);
- new_info(re, NULL, PCRE_INFO_NAMECOUNT, &namecount);
- new_info(re, NULL, PCRE_INFO_NAMETABLE, &nametable);
-
- old_count = pcre_info(re, &old_options, &old_first_char);
- if (count < 0) fprintf(outfile,
- "Error %d from pcre_info()\n", count);
- else
- {
- if (old_count != count) fprintf(outfile,
- "Count disagreement: pcre_fullinfo=%d pcre_info=%d\n", count,
- old_count);
-
- if (old_first_char != first_char) fprintf(outfile,
- "First char disagreement: pcre_fullinfo=%d pcre_info=%d\n",
- first_char, old_first_char);
-
- if (old_options != (int)get_options) fprintf(outfile,
- "Options disagreement: pcre_fullinfo=%ld pcre_info=%d\n",
- get_options, old_options);
- }
-
- if (size != gotten_store) fprintf(outfile,
- "Size disagreement: pcre_fullinfo=%d call to malloc for %d\n",
- size, gotten_store);
-
- fprintf(outfile, "Capturing subpattern count = %d\n", count);
- if (backrefmax > 0)
- fprintf(outfile, "Max back reference = %d\n", backrefmax);
-
- if (namecount > 0)
- {
- fprintf(outfile, "Named capturing subpatterns:\n");
- while (namecount-- > 0)
- {
- fprintf(outfile, " %s %*s%3d\n", nametable + 2,
- nameentrysize - 3 - (int)strlen((char *)nametable + 2), "",
- GET2(nametable, 0));
- nametable += nameentrysize;
- }
- }
-
- if (get_options == 0) fprintf(outfile, "No options\n");
- else fprintf(outfile, "Options:%s%s%s%s%s%s%s%s%s\n",
- ((get_options & PCRE_ANCHORED) != 0)? " anchored" : "",
- ((get_options & PCRE_CASELESS) != 0)? " caseless" : "",
- ((get_options & PCRE_EXTENDED) != 0)? " extended" : "",
- ((get_options & PCRE_MULTILINE) != 0)? " multiline" : "",
- ((get_options & PCRE_DOTALL) != 0)? " dotall" : "",
- ((get_options & PCRE_DOLLAR_ENDONLY) != 0)? " dollar_endonly" : "",
- ((get_options & PCRE_EXTRA) != 0)? " extra" : "",
- ((get_options & PCRE_UNGREEDY) != 0)? " ungreedy" : "",
- ((get_options & PCRE_UTF8) != 0)? " utf8" : "");
-
- if (((((real_pcre *)re)->options) & PCRE_ICHANGED) != 0)
- fprintf(outfile, "Case state changes\n");
-
- if (first_char == -1)
- {
- fprintf(outfile, "First char at start or follows \\n\n");
- }
- else if (first_char < 0)
- {
- fprintf(outfile, "No first char\n");
- }
- else
- {
- int ch = first_char & 255;
- char *caseless = ((first_char & REQ_CASELESS) == 0)?
- "" : " (caseless)";
- if (isprint(ch))
- fprintf(outfile, "First char = \'%c\'%s\n", ch, caseless);
- else
- fprintf(outfile, "First char = %d%s\n", ch, caseless);
- }
-
- if (need_char < 0)
- {
- fprintf(outfile, "No need char\n");
- }
- else
- {
- int ch = need_char & 255;
- char *caseless = ((need_char & REQ_CASELESS) == 0)?
- "" : " (caseless)";
- if (isprint(need_char))
- fprintf(outfile, "Need char = \'%c\'%s\n", ch, caseless);
- else
- fprintf(outfile, "Need char = %d%s\n", ch, caseless);
- }
- }
-
- /* If /S was present, study the regexp to generate additional info to
- help with the matching. */
-
- if (do_study)
- {
- if (timeit)
- {
- register int i;
- clock_t time_taken;
- clock_t start_time = clock();
- for (i = 0; i < LOOPREPEAT; i++)
- extra = pcre_study(re, study_options, &error);
- time_taken = clock() - start_time;
- if (extra != NULL) free(extra);
- fprintf(outfile, " Study time %.3f milliseconds\n",
- (((double)time_taken * 1000.0) / (double)LOOPREPEAT) /
- (double)CLOCKS_PER_SEC);
- }
-
- extra = pcre_study(re, study_options, &error);
- if (error != NULL)
- fprintf(outfile, "Failed to study: %s\n", error);
- else if (extra == NULL)
- fprintf(outfile, "Study returned NULL\n");
-
- else if (do_showinfo)
- {
- uschar *start_bits = NULL;
- new_info(re, extra, PCRE_INFO_FIRSTTABLE, &start_bits);
- if (start_bits == NULL)
- fprintf(outfile, "No starting character set\n");
- else
- {
- int i;
- int c = 24;
- fprintf(outfile, "Starting character set: ");
- for (i = 0; i < 256; i++)
- {
- if ((start_bits[i/8] & (1<<(i%8))) != 0)
- {
- if (c > 75)
- {
- fprintf(outfile, "\n ");
- c = 2;
- }
- if (isprint(i) && i != ' ')
- {
- fprintf(outfile, "%c ", i);
- c += 2;
- }
- else
- {
- fprintf(outfile, "\\x%02x ", i);
- c += 5;
- }
- }
- }
- fprintf(outfile, "\n");
- }
- }
- }
- }
-
- /* Read data lines and test them */
-
- for (;;)
- {
- unsigned char *q;
- unsigned char *bptr = dbuffer;
- int *use_offsets = offsets;
- int use_size_offsets = size_offsets;
- int count, c;
- int copystrings = 0;
- int getstrings = 0;
- int getlist = 0;
- int gmatched = 0;
- int start_offset = 0;
- int g_notempty = 0;
-
- options = 0;
-
- pcre_callout = callout;
- first_callout = 1;
- callout_extra = 0;
- callout_count = 0;
- callout_fail_count = 999999;
- callout_fail_id = -1;
-
- if (infile == stdin) printf("data> ");
- if (fgets((char *)buffer, sizeof(buffer), infile) == NULL)
- {
- done = 1;
- goto CONTINUE;
- }
- if (infile != stdin) fprintf(outfile, "%s", (char *)buffer);
-
- len = (int)strlen((char *)buffer);
- while (len > 0 && isspace(buffer[len-1])) len--;
- buffer[len] = 0;
- if (len == 0) break;
-
- p = buffer;
- while (isspace(*p)) p++;
-
- q = dbuffer;
- while ((c = *p++) != 0)
- {
- int i = 0;
- int n = 0;
-
- if (c == '\\') switch ((c = *p++))
- {
- case 'a': c = 7; break;
- case 'b': c = '\b'; break;
- case 'e': c = 27; break;
- case 'f': c = '\f'; break;
- case 'n': c = '\n'; break;
- case 'r': c = '\r'; break;
- case 't': c = '\t'; break;
- case 'v': c = '\v'; break;
-
- case '0': case '1': case '2': case '3':
- case '4': case '5': case '6': case '7':
- c -= '0';
- while (i++ < 2 && isdigit(*p) && *p != '8' && *p != '9')
- c = c * 8 + *p++ - '0';
- break;
-
- case 'x':
-
- /* Handle \x{..} specially - new Perl thing for utf8 */
-
- if (*p == '{')
- {
- unsigned char *pt = p;
- c = 0;
- while (isxdigit(*(++pt)))
- c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'W');
- if (*pt == '}')
- {
- unsigned char buffer[8];
- int ii, utn;
- utn = ord2utf8(c, buffer);
- for (ii = 0; ii < utn - 1; ii++) *q++ = buffer[ii];
- c = buffer[ii]; /* Last byte */
- p = pt + 1;
- break;
- }
- /* Not correct form; fall through */
- }
-
- /* Ordinary \x */
-
- c = 0;
- while (i++ < 2 && isxdigit(*p))
- {
- c = c * 16 + tolower(*p) - ((isdigit(*p))? '0' : 'W');
- p++;
- }
- break;
-
- case 0: /* Allows for an empty line */
- p--;
- continue;
-
- case 'A': /* Option setting */
- options |= PCRE_ANCHORED;
- continue;
-
- case 'B':
- options |= PCRE_NOTBOL;
- continue;
-
- case 'C':
- if (isdigit(*p)) /* Set copy string */
- {
- while(isdigit(*p)) n = n * 10 + *p++ - '0';
- copystrings |= 1 << n;
- }
- else if (*p == '+')
- {
- callout_extra = 1;
- p++;
- }
- else if (*p == '-')
- {
- pcre_callout = NULL;
- p++;
- }
- else if (*p == '!')
- {
- callout_fail_id = 0;
- p++;
- while(isdigit(*p))
- callout_fail_id = callout_fail_id * 10 + *p++ - '0';
- callout_fail_count = 0;
- if (*p == '!')
- {
- p++;
- while(isdigit(*p))
- callout_fail_count = callout_fail_count * 10 + *p++ - '0';
- }
- }
- continue;
-
- case 'G':
- while(isdigit(*p)) n = n * 10 + *p++ - '0';
- getstrings |= 1 << n;
- continue;
-
- case 'L':
- getlist = 1;
- continue;
-
- case 'N':
- options |= PCRE_NOTEMPTY;
- continue;
-
- case 'O':
- while(isdigit(*p)) n = n * 10 + *p++ - '0';
- if (n > size_offsets_max)
- {
- size_offsets_max = n;
- free(offsets);
- use_offsets = offsets = malloc(size_offsets_max * sizeof(int));
- if (offsets == NULL)
- {
- printf("** Failed to get %d bytes of memory for offsets vector\n",
- size_offsets_max * sizeof(int));
- return 1;
- }
- }
- use_size_offsets = n;
- if (n == 0) use_offsets = NULL; /* Ensures it can't write to it */
- continue;
-
- case 'Z':
- options |= PCRE_NOTEOL;
- continue;
- }
- *q++ = c;
- }
- *q = 0;
- len = q - dbuffer;
-
- /* Handle matching via the POSIX interface, which does not
- support timing. */
-
-#if !defined NOPOSIX
- if (posix || do_posix)
- {
- int rc;
- int eflags = 0;
- regmatch_t *pmatch = malloc(sizeof(regmatch_t) * use_size_offsets);
- if ((options & PCRE_NOTBOL) != 0) eflags |= REG_NOTBOL;
- if ((options & PCRE_NOTEOL) != 0) eflags |= REG_NOTEOL;
-
- rc = regexec(&preg, (const char *)bptr, use_size_offsets, pmatch, eflags);
-
- if (rc != 0)
- {
- (void)regerror(rc, &preg, (char *)buffer, sizeof(buffer));
- fprintf(outfile, "No match: POSIX code %d: %s\n", rc, buffer);
- }
- else
- {
- size_t i;
- for (i = 0; i < (size_t)use_size_offsets; i++)
- {
- if (pmatch[i].rm_so >= 0)
- {
- fprintf(outfile, "%2d: ", (int)i);
- (void)pchars(dbuffer + pmatch[i].rm_so,
- pmatch[i].rm_eo - pmatch[i].rm_so, outfile);
- fprintf(outfile, "\n");
- if (i == 0 && do_showrest)
- {
- fprintf(outfile, " 0+ ");
- (void)pchars(dbuffer + pmatch[i].rm_eo, len - pmatch[i].rm_eo,
- outfile);
- fprintf(outfile, "\n");
- }
- }
- }
- }
- free(pmatch);
- }
-
- /* Handle matching via the native interface - repeats for /g and /G */
-
- else
-#endif /* !defined NOPOSIX */
-
- for (;; gmatched++) /* Loop for /g or /G */
- {
- if (timeit)
- {
- register int i;
- clock_t time_taken;
- clock_t start_time = clock();
- for (i = 0; i < LOOPREPEAT; i++)
- count = pcre_exec(re, extra, (char *)bptr, len,
- start_offset, options | g_notempty, use_offsets, use_size_offsets);
- time_taken = clock() - start_time;
- fprintf(outfile, "Execute time %.3f milliseconds\n",
- (((double)time_taken * 1000.0) / (double)LOOPREPEAT) /
- (double)CLOCKS_PER_SEC);
- }
-
- count = pcre_exec(re, extra, (char *)bptr, len,
- start_offset, options | g_notempty, use_offsets, use_size_offsets);
-
- if (count == 0)
- {
- fprintf(outfile, "Matched, but too many substrings\n");
- count = use_size_offsets/3;
- }
-
- /* Matched */
-
- if (count >= 0)
- {
- int i;
- for (i = 0; i < count * 2; i += 2)
- {
- if (use_offsets[i] < 0)
- fprintf(outfile, "%2d: <unset>\n", i/2);
- else
- {
- fprintf(outfile, "%2d: ", i/2);
- (void)pchars(bptr + use_offsets[i],
- use_offsets[i+1] - use_offsets[i], outfile);
- fprintf(outfile, "\n");
- if (i == 0)
- {
- if (do_showrest)
- {
- fprintf(outfile, " 0+ ");
- (void)pchars(bptr + use_offsets[i+1], len - use_offsets[i+1],
- outfile);
- fprintf(outfile, "\n");
- }
- }
- }
- }
-
- for (i = 0; i < 32; i++)
- {
- if ((copystrings & (1 << i)) != 0)
- {
- char copybuffer[16];
- int rc = pcre_copy_substring((char *)bptr, use_offsets, count,
- i, copybuffer, sizeof(copybuffer));
- if (rc < 0)
- fprintf(outfile, "copy substring %d failed %d\n", i, rc);
- else
- fprintf(outfile, "%2dC %s (%d)\n", i, copybuffer, rc);
- }
- }
-
- for (i = 0; i < 32; i++)
- {
- if ((getstrings & (1 << i)) != 0)
- {
- const char *substring;
- int rc = pcre_get_substring((char *)bptr, use_offsets, count,
- i, &substring);
- if (rc < 0)
- fprintf(outfile, "get substring %d failed %d\n", i, rc);
- else
- {
- fprintf(outfile, "%2dG %s (%d)\n", i, substring, rc);
- /* free((void *)substring); */
- pcre_free_substring(substring);
- }
- }
- }
-
- if (getlist)
- {
- const char **stringlist;
- int rc = pcre_get_substring_list((char *)bptr, use_offsets, count,
- &stringlist);
- if (rc < 0)
- fprintf(outfile, "get substring list failed %d\n", rc);
- else
- {
- for (i = 0; i < count; i++)
- fprintf(outfile, "%2dL %s\n", i, stringlist[i]);
- if (stringlist[i] != NULL)
- fprintf(outfile, "string list not terminated by NULL\n");
- /* free((void *)stringlist); */
- pcre_free_substring_list(stringlist);
- }
- }
- }
-
- /* Failed to match. If this is a /g or /G loop and we previously set
- g_notempty after a null match, this is not necessarily the end.
- We want to advance the start offset, and continue. Fudge the offset
- values to achieve this. We won't be at the end of the string - that
- was checked before setting g_notempty. */
-
- else
- {
- if (g_notempty != 0)
- {
- use_offsets[0] = start_offset;
- use_offsets[1] = start_offset + 1;
- }
- else
- {
- if (gmatched == 0) /* Error if no previous matches */
- {
- if (count == -1) fprintf(outfile, "No match\n");
- else fprintf(outfile, "Error %d\n", count);
- }
- break; /* Out of the /g loop */
- }
- }
-
- /* If not /g or /G we are done */
-
- if (!do_g && !do_G) break;
-
- /* If we have matched an empty string, first check to see if we are at
- the end of the subject. If so, the /g loop is over. Otherwise, mimic
- what Perl's /g options does. This turns out to be rather cunning. First
- we set PCRE_NOTEMPTY and PCRE_ANCHORED and try the match again at the
- same point. If this fails (picked up above) we advance to the next
- character. */
-
- g_notempty = 0;
- if (use_offsets[0] == use_offsets[1])
- {
- if (use_offsets[0] == len) break;
- g_notempty = PCRE_NOTEMPTY | PCRE_ANCHORED;
- }
-
- /* For /g, update the start offset, leaving the rest alone */
-
- if (do_g) start_offset = use_offsets[1];
-
- /* For /G, update the pointer and length */
-
- else
- {
- bptr += use_offsets[1];
- len -= use_offsets[1];
- }
- } /* End of loop for /g and /G */
- } /* End of loop for data lines */
-
- CONTINUE:
-
-#if !defined NOPOSIX
- if (posix || do_posix) regfree(&preg);
-#endif
-
- if (re != NULL) free(re);
- if (extra != NULL) free(extra);
- if (tables != NULL)
- {
- free((void *)tables);
- setlocale(LC_CTYPE, "C");
- }
- }
-
-fprintf(outfile, "\n");
-return 0;
-}
-
-/* End */
diff --git a/ext/pcre/pcrelib/study.c b/ext/pcre/pcrelib/study.c
deleted file mode 100644
index 65771b9d74..0000000000
--- a/ext/pcre/pcrelib/study.c
+++ /dev/null
@@ -1,409 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/*
-This is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language. See
-the file Tech.Notes for some information on the internals.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
- Copyright (c) 1997-2003 University of Cambridge
-
------------------------------------------------------------------------------
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
------------------------------------------------------------------------------
-*/
-
-
-/* Include the internals header, which itself includes Standard C headers plus
-the external pcre header. */
-
-#include "internal.h"
-
-
-
-/*************************************************
-* Set a bit and maybe its alternate case *
-*************************************************/
-
-/* Given a character, set its bit in the table, and also the bit for the other
-version of a letter if we are caseless.
-
-Arguments:
- start_bits points to the bit map
- c is the character
- caseless the caseless flag
- cd the block with char table pointers
-
-Returns: nothing
-*/
-
-static void
-set_bit(uschar *start_bits, int c, BOOL caseless, compile_data *cd)
-{
-start_bits[c/8] |= (1 << (c&7));
-if (caseless && (cd->ctypes[c] & ctype_letter) != 0)
- start_bits[cd->fcc[c]/8] |= (1 << (cd->fcc[c]&7));
-}
-
-
-
-/*************************************************
-* Create bitmap of starting chars *
-*************************************************/
-
-/* This function scans a compiled unanchored expression and attempts to build a
-bitmap of the set of initial characters. If it can't, it returns FALSE. As time
-goes by, we may be able to get more clever at doing this.
-
-Arguments:
- code points to an expression
- start_bits points to a 32-byte table, initialized to 0
- caseless the current state of the caseless flag
- cd the block with char table pointers
-
-Returns: TRUE if table built, FALSE otherwise
-*/
-
-static BOOL
-set_start_bits(const uschar *code, uschar *start_bits, BOOL caseless,
- compile_data *cd)
-{
-register int c;
-
-/* This next statement and the later reference to dummy are here in order to
-trick the optimizer of the IBM C compiler for OS/2 into generating correct
-code. Apparently IBM isn't going to fix the problem, and we would rather not
-disable optimization (in this module it actually makes a big difference, and
-the pcre module can use all the optimization it can get). */
-
-volatile int dummy;
-
-do
- {
- const uschar *tcode = code + 1 + LINK_SIZE;
- BOOL try_next = TRUE;
-
- while (try_next)
- {
- /* If a branch starts with a bracket or a positive lookahead assertion,
- recurse to set bits from within them. That's all for this branch. */
-
- if ((int)*tcode >= OP_BRA || *tcode == OP_ASSERT)
- {
- if (!set_start_bits(tcode, start_bits, caseless, cd))
- return FALSE;
- try_next = FALSE;
- }
-
- else switch(*tcode)
- {
- default:
- return FALSE;
-
- /* Skip over callout */
-
- case OP_CALLOUT:
- tcode += 2;
- break;
-
- /* Skip over extended extraction bracket number */
-
- case OP_BRANUMBER:
- tcode += 3;
- break;
-
- /* Skip over lookbehind and negative lookahead assertions */
-
- case OP_ASSERT_NOT:
- case OP_ASSERTBACK:
- case OP_ASSERTBACK_NOT:
- do tcode += GET(tcode, 1); while (*tcode == OP_ALT);
- tcode += 1+LINK_SIZE;
- break;
-
- /* Skip over an option setting, changing the caseless flag */
-
- case OP_OPT:
- caseless = (tcode[1] & PCRE_CASELESS) != 0;
- tcode += 2;
- break;
-
- /* BRAZERO does the bracket, but carries on. */
-
- case OP_BRAZERO:
- case OP_BRAMINZERO:
- if (!set_start_bits(++tcode, start_bits, caseless, cd))
- return FALSE;
- dummy = 1;
- do tcode += GET(tcode,1); while (*tcode == OP_ALT);
- tcode += 1+LINK_SIZE;
- break;
-
- /* Single-char * or ? sets the bit and tries the next item */
-
- case OP_STAR:
- case OP_MINSTAR:
- case OP_QUERY:
- case OP_MINQUERY:
- set_bit(start_bits, tcode[1], caseless, cd);
- tcode += 2;
- break;
-
- /* Single-char upto sets the bit and tries the next */
-
- case OP_UPTO:
- case OP_MINUPTO:
- set_bit(start_bits, tcode[3], caseless, cd);
- tcode += 4;
- break;
-
- /* At least one single char sets the bit and stops */
-
- case OP_EXACT: /* Fall through */
- tcode++;
-
- case OP_CHARS: /* Fall through */
- tcode++;
-
- case OP_PLUS:
- case OP_MINPLUS:
- set_bit(start_bits, tcode[1], caseless, cd);
- try_next = FALSE;
- break;
-
- /* Single character type sets the bits and stops */
-
- case OP_NOT_DIGIT:
- for (c = 0; c < 32; c++)
- start_bits[c] |= ~cd->cbits[c+cbit_digit];
- try_next = FALSE;
- break;
-
- case OP_DIGIT:
- for (c = 0; c < 32; c++)
- start_bits[c] |= cd->cbits[c+cbit_digit];
- try_next = FALSE;
- break;
-
- case OP_NOT_WHITESPACE:
- for (c = 0; c < 32; c++)
- start_bits[c] |= ~cd->cbits[c+cbit_space];
- try_next = FALSE;
- break;
-
- case OP_WHITESPACE:
- for (c = 0; c < 32; c++)
- start_bits[c] |= cd->cbits[c+cbit_space];
- try_next = FALSE;
- break;
-
- case OP_NOT_WORDCHAR:
- for (c = 0; c < 32; c++)
- start_bits[c] |= ~cd->cbits[c+cbit_word];
- try_next = FALSE;
- break;
-
- case OP_WORDCHAR:
- for (c = 0; c < 32; c++)
- start_bits[c] |= cd->cbits[c+cbit_word];
- try_next = FALSE;
- break;
-
- /* One or more character type fudges the pointer and restarts, knowing
- it will hit a single character type and stop there. */
-
- case OP_TYPEPLUS:
- case OP_TYPEMINPLUS:
- tcode++;
- break;
-
- case OP_TYPEEXACT:
- tcode += 3;
- break;
-
- /* Zero or more repeats of character types set the bits and then
- try again. */
-
- case OP_TYPEUPTO:
- case OP_TYPEMINUPTO:
- tcode += 2; /* Fall through */
-
- case OP_TYPESTAR:
- case OP_TYPEMINSTAR:
- case OP_TYPEQUERY:
- case OP_TYPEMINQUERY:
- switch(tcode[1])
- {
- case OP_NOT_DIGIT:
- for (c = 0; c < 32; c++)
- start_bits[c] |= ~cd->cbits[c+cbit_digit];
- break;
-
- case OP_DIGIT:
- for (c = 0; c < 32; c++)
- start_bits[c] |= cd->cbits[c+cbit_digit];
- break;
-
- case OP_NOT_WHITESPACE:
- for (c = 0; c < 32; c++)
- start_bits[c] |= ~cd->cbits[c+cbit_space];
- break;
-
- case OP_WHITESPACE:
- for (c = 0; c < 32; c++)
- start_bits[c] |= cd->cbits[c+cbit_space];
- break;
-
- case OP_NOT_WORDCHAR:
- for (c = 0; c < 32; c++)
- start_bits[c] |= ~cd->cbits[c+cbit_word];
- break;
-
- case OP_WORDCHAR:
- for (c = 0; c < 32; c++)
- start_bits[c] |= cd->cbits[c+cbit_word];
- break;
- }
-
- tcode += 2;
- break;
-
- /* Character class: set the bits and either carry on or not,
- according to the repeat count. */
-
- case OP_CLASS:
- {
- tcode++;
- for (c = 0; c < 32; c++) start_bits[c] |= tcode[c];
- tcode += 32;
- switch (*tcode)
- {
- case OP_CRSTAR:
- case OP_CRMINSTAR:
- case OP_CRQUERY:
- case OP_CRMINQUERY:
- tcode++;
- break;
-
- case OP_CRRANGE:
- case OP_CRMINRANGE:
- if (((tcode[1] << 8) + tcode[2]) == 0) tcode += 5;
- else try_next = FALSE;
- break;
-
- default:
- try_next = FALSE;
- break;
- }
- }
- break; /* End of class handling */
-
- } /* End of switch */
- } /* End of try_next loop */
-
- code += GET(code, 1); /* Advance to next branch */
- }
-while (*code == OP_ALT);
-return TRUE;
-}
-
-
-
-/*************************************************
-* Study a compiled expression *
-*************************************************/
-
-/* This function is handed a compiled expression that it must study to produce
-information that will speed up the matching. It returns a pcre_extra block
-which then gets handed back to pcre_exec().
-
-Arguments:
- re points to the compiled expression
- options contains option bits
- errorptr points to where to place error messages;
- set NULL unless error
-
-Returns: pointer to a pcre_extra block,
- NULL on error or if no optimization possible
-*/
-
-pcre_extra *
-pcre_study(const pcre *external_re, int options, const char **errorptr)
-{
-uschar start_bits[32];
-real_pcre_extra *extra;
-const real_pcre *re = (const real_pcre *)external_re;
-uschar *code = (uschar *)re + sizeof(real_pcre) +
- (re->name_count * re->name_entry_size);
-compile_data compile_block;
-
-*errorptr = NULL;
-
-if (re == NULL || re->magic_number != MAGIC_NUMBER)
- {
- *errorptr = "argument is not a compiled regular expression";
- return NULL;
- }
-
-if ((options & ~PUBLIC_STUDY_OPTIONS) != 0)
- {
- *errorptr = "unknown or incorrect option bit(s) set";
- return NULL;
- }
-
-/* For an anchored pattern, or an unanchored pattern that has a first char, or
-a multiline pattern that matches only at "line starts", no further processing
-at present. */
-
-if ((re->options & (PCRE_ANCHORED|PCRE_FIRSTSET|PCRE_STARTLINE)) != 0)
- return NULL;
-
-/* Set the character tables in the block which is passed around */
-
-compile_block.lcc = re->tables + lcc_offset;
-compile_block.fcc = re->tables + fcc_offset;
-compile_block.cbits = re->tables + cbits_offset;
-compile_block.ctypes = re->tables + ctypes_offset;
-
-/* See if we can find a fixed set of initial characters for the pattern. */
-
-memset(start_bits, 0, 32 * sizeof(uschar));
-if (!set_start_bits(code, start_bits, (re->options & PCRE_CASELESS) != 0,
- &compile_block)) return NULL;
-
-/* Get an "extra" block and put the information therein. */
-
-extra = (real_pcre_extra *)(pcre_malloc)(sizeof(real_pcre_extra));
-
-if (extra == NULL)
- {
- *errorptr = "failed to get memory";
- return NULL;
- }
-
-extra->options = PCRE_STUDY_MAPPED;
-memcpy(extra->start_bits, start_bits, sizeof(start_bits));
-
-return (pcre_extra *)extra;
-}
-
-/* End of study.c */
diff --git a/ext/pcre/pcrelib/testdata/testinput1 b/ext/pcre/pcrelib/testdata/testinput1
deleted file mode 100644
index c64257685b..0000000000
--- a/ext/pcre/pcrelib/testdata/testinput1
+++ /dev/null
@@ -1,3808 +0,0 @@
-/the quick brown fox/
- the quick brown fox
- The quick brown FOX
- What do you know about the quick brown fox?
- What do you know about THE QUICK BROWN FOX?
-
-/The quick brown fox/i
- the quick brown fox
- The quick brown FOX
- What do you know about the quick brown fox?
- What do you know about THE QUICK BROWN FOX?
-
-/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
- abcd\t\n\r\f\a\e9;\$\\?caxyz
-
-/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
- abxyzpqrrrabbxyyyypqAzz
- abxyzpqrrrabbxyyyypqAzz
- aabxyzpqrrrabbxyyyypqAzz
- aaabxyzpqrrrabbxyyyypqAzz
- aaaabxyzpqrrrabbxyyyypqAzz
- abcxyzpqrrrabbxyyyypqAzz
- aabcxyzpqrrrabbxyyyypqAzz
- aaabcxyzpqrrrabbxyyyypAzz
- aaabcxyzpqrrrabbxyyyypqAzz
- aaabcxyzpqrrrabbxyyyypqqAzz
- aaabcxyzpqrrrabbxyyyypqqqAzz
- aaabcxyzpqrrrabbxyyyypqqqqAzz
- aaabcxyzpqrrrabbxyyyypqqqqqAzz
- aaabcxyzpqrrrabbxyyyypqqqqqqAzz
- aaaabcxyzpqrrrabbxyyyypqAzz
- abxyzzpqrrrabbxyyyypqAzz
- aabxyzzzpqrrrabbxyyyypqAzz
- aaabxyzzzzpqrrrabbxyyyypqAzz
- aaaabxyzzzzpqrrrabbxyyyypqAzz
- abcxyzzpqrrrabbxyyyypqAzz
- aabcxyzzzpqrrrabbxyyyypqAzz
- aaabcxyzzzzpqrrrabbxyyyypqAzz
- aaaabcxyzzzzpqrrrabbxyyyypqAzz
- aaaabcxyzzzzpqrrrabbbxyyyypqAzz
- aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
- aaabcxyzpqrrrabbxyyyypABzz
- aaabcxyzpqrrrabbxyyyypABBzz
- >>>aaabxyzpqrrrabbxyyyypqAzz
- >aaaabxyzpqrrrabbxyyyypqAzz
- >>>>abcxyzpqrrrabbxyyyypqAzz
- *** Failers
- abxyzpqrrabbxyyyypqAzz
- abxyzpqrrrrabbxyyyypqAzz
- abxyzpqrrrabxyyyypqAzz
- aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
- aaaabcxyzzzzpqrrrabbbxyyypqAzz
- aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
-
-/^(abc){1,2}zz/
- abczz
- abcabczz
- *** Failers
- zz
- abcabcabczz
- >>abczz
-
-/^(b+?|a){1,2}?c/
- bc
- bbc
- bbbc
- bac
- bbac
- aac
- abbbbbbbbbbbc
- bbbbbbbbbbbac
- *** Failers
- aaac
- abbbbbbbbbbbac
-
-/^(b+|a){1,2}c/
- bc
- bbc
- bbbc
- bac
- bbac
- aac
- abbbbbbbbbbbc
- bbbbbbbbbbbac
- *** Failers
- aaac
- abbbbbbbbbbbac
-
-/^(b+|a){1,2}?bc/
- bbc
-
-/^(b*|ba){1,2}?bc/
- babc
- bbabc
- bababc
- *** Failers
- bababbc
- babababc
-
-/^(ba|b*){1,2}?bc/
- babc
- bbabc
- bababc
- *** Failers
- bababbc
- babababc
-
-/^\ca\cA\c[\c{\c:/
- \x01\x01\e;z
-
-/^[ab\]cde]/
- athing
- bthing
- ]thing
- cthing
- dthing
- ething
- *** Failers
- fthing
- [thing
- \\thing
-
-/^[]cde]/
- ]thing
- cthing
- dthing
- ething
- *** Failers
- athing
- fthing
-
-/^[^ab\]cde]/
- fthing
- [thing
- \\thing
- *** Failers
- athing
- bthing
- ]thing
- cthing
- dthing
- ething
-
-/^[^]cde]/
- athing
- fthing
- *** Failers
- ]thing
- cthing
- dthing
- ething
-
-/^\/
-
-
-/^ÿ/
- ÿ
-
-/^[0-9]+$/
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 100
- *** Failers
- abc
-
-/^.*nter/
- enter
- inter
- uponter
-
-/^xxx[0-9]+$/
- xxx0
- xxx1234
- *** Failers
- xxx
-
-/^.+[0-9][0-9][0-9]$/
- x123
- xx123
- 123456
- *** Failers
- 123
- x1234
-
-/^.+?[0-9][0-9][0-9]$/
- x123
- xx123
- 123456
- *** Failers
- 123
- x1234
-
-/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
- abc!pqr=apquxz.ixr.zzz.ac.uk
- *** Failers
- !pqr=apquxz.ixr.zzz.ac.uk
- abc!=apquxz.ixr.zzz.ac.uk
- abc!pqr=apquxz:ixr.zzz.ac.uk
- abc!pqr=apquxz.ixr.zzz.ac.ukk
-
-/:/
- Well, we need a colon: somewhere
- *** Fail if we don't
-
-/([\da-f:]+)$/i
- 0abc
- abc
- fed
- E
- ::
- 5f03:12C0::932e
- fed def
- Any old stuff
- *** Failers
- 0zzz
- gzzz
- fed\x20
- Any old rubbish
-
-/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
- .1.2.3
- A.12.123.0
- *** Failers
- .1.2.3333
- 1.2.3
- 1234.2.3
-
-/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
- 1 IN SOA non-sp1 non-sp2(
- 1 IN SOA non-sp1 non-sp2 (
- *** Failers
- 1IN SOA non-sp1 non-sp2(
-
-/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
- a.
- Z.
- 2.
- ab-c.pq-r.
- sxk.zzz.ac.uk.
- x-.y-.
- *** Failers
- -abc.peq.
-
-/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
- *.a
- *.b0-a
- *.c3-b.c
- *.c-a.b-c
- *** Failers
- *.0
- *.a-
- *.a-b.c-
- *.c-a.0-c
-
-/^(?=ab(de))(abd)(e)/
- abde
-
-/^(?!(ab)de|x)(abd)(f)/
- abdf
-
-/^(?=(ab(cd)))(ab)/
- abcd
-
-/^[\da-f](\.[\da-f])*$/i
- a.b.c.d
- A.B.C.D
- a.b.c.1.2.3.C
-
-/^\".*\"\s*(;.*)?$/
- \"1234\"
- \"abcd\" ;
- \"\" ; rhubarb
- *** Failers
- \"1234\" : things
-
-/^$/
- \
- *** Failers
-
-/ ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/x
- ab c
- *** Failers
- abc
- ab cde
-
-/(?x) ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/
- ab c
- *** Failers
- abc
- ab cde
-
-/^ a\ b[c ]d $/x
- a bcd
- a b d
- *** Failers
- abcd
- ab d
-
-/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
- abcdefhijklm
-
-/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
- abcdefhijklm
-
-/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
- a+ Z0+\x08\n\x1d\x12
-
-/^[.^$|()*+?{,}]+/
- .^\$(*+)|{?,?}
-
-/^a*\w/
- z
- az
- aaaz
- a
- aa
- aaaa
- a+
- aa+
-
-/^a*?\w/
- z
- az
- aaaz
- a
- aa
- aaaa
- a+
- aa+
-
-/^a+\w/
- az
- aaaz
- aa
- aaaa
- aa+
-
-/^a+?\w/
- az
- aaaz
- aa
- aaaa
- aa+
-
-/^\d{8}\w{2,}/
- 1234567890
- 12345678ab
- 12345678__
- *** Failers
- 1234567
-
-/^[aeiou\d]{4,5}$/
- uoie
- 1234
- 12345
- aaaaa
- *** Failers
- 123456
-
-/^[aeiou\d]{4,5}?/
- uoie
- 1234
- 12345
- aaaaa
- 123456
-
-/\A(abc|def)=(\1){2,3}\Z/
- abc=abcabc
- def=defdefdef
- *** Failers
- abc=defdef
-
-/^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/
- abcdefghijkcda2
- abcdefghijkkkkcda2
-
-/(cat(a(ract|tonic)|erpillar)) \1()2(3)/
- cataract cataract23
- catatonic catatonic23
- caterpillar caterpillar23
-
-
-/^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/
- From abcd Mon Sep 01 12:33:02 1997
-
-/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
- From abcd Mon Sep 01 12:33:02 1997
- From abcd Mon Sep 1 12:33:02 1997
- *** Failers
- From abcd Sep 01 12:33:02 1997
-
-/^12.34/s
- 12\n34
- 12\r34
-
-/\w+(?=\t)/
- the quick brown\t fox
-
-/foo(?!bar)(.*)/
- foobar is foolish see?
-
-/(?:(?!foo)...|^.{0,2})bar(.*)/
- foobar crowbar etc
- barrel
- 2barrel
- A barrel
-
-/^(\D*)(?=\d)(?!123)/
- abc456
- *** Failers
- abc123
-
-/^1234(?# test newlines
- inside)/
- 1234
-
-/^1234 #comment in extended re
- /x
- 1234
-
-/#rhubarb
- abcd/x
- abcd
-
-/^abcd#rhubarb/x
- abcd
-
-/^(a)\1{2,3}(.)/
- aaab
- aaaab
- aaaaab
- aaaaaab
-
-/(?!^)abc/
- the abc
- *** Failers
- abc
-
-/(?=^)abc/
- abc
- *** Failers
- the abc
-
-/^[ab]{1,3}(ab*|b)/
- aabbbbb
-
-/^[ab]{1,3}?(ab*|b)/
- aabbbbb
-
-/^[ab]{1,3}?(ab*?|b)/
- aabbbbb
-
-/^[ab]{1,3}(ab*?|b)/
- aabbbbb
-
-/ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* # optional leading comment
-(?: (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) # initial word
-(?: (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) )* # further okay, if led by a period
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-# address
-| # or
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) # one word, optionally followed by....
-(?:
-[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or...
-\(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) | # comments, or...
-
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-# quoted strings
-)*
-< (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* # leading <
-(?: @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-
-(?: (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* , (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-)* # further okay, if led by comma
-: # closing colon
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* )? # optional route
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) # initial word
-(?: (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) )* # further okay, if led by a period
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-# address spec
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* > # trailing >
-# name and address
-) (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* # optional trailing comment
-/x
- Alan Other <user\@dom.ain>
- <user\@dom.ain>
- user\@dom.ain
- \"A. Other\" <user.1234\@dom.ain> (a comment)
- A. Other <user.1234\@dom.ain> (a comment)
- \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
- A missing angle <user\@some.where
- *** Failers
- The quick brown fox
-
-/[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional leading comment
-(?:
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# additional words
-)*
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-# address
-| # or
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-# leading word
-[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # "normal" atoms and or spaces
-(?:
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-|
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-) # "special" comment or quoted string
-[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # more "normal"
-)*
-<
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# <
-(?:
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-(?: ,
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-)* # additional domains
-:
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)? # optional route
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# additional words
-)*
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-# address spec
-> # >
-# name and address
-)
-/x
- Alan Other <user\@dom.ain>
- <user\@dom.ain>
- user\@dom.ain
- \"A. Other\" <user.1234\@dom.ain> (a comment)
- A. Other <user.1234\@dom.ain> (a comment)
- \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
- A missing angle <user\@some.where
- *** Failers
- The quick brown fox
-
-/abc\0def\00pqr\000xyz\0000AB/
- abc\0def\00pqr\000xyz\0000AB
- abc456 abc\0def\00pqr\000xyz\0000ABCDE
-
-/abc\x0def\x00pqr\x000xyz\x0000AB/
- abc\x0def\x00pqr\x000xyz\x0000AB
- abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
-
-/^[\000-\037]/
- \0A
- \01B
- \037C
-
-/\0*/
- \0\0\0\0
-
-/A\x0{2,3}Z/
- The A\x0\x0Z
- An A\0\x0\0Z
- *** Failers
- A\0Z
- A\0\x0\0\x0Z
-
-/^(cow|)\1(bell)/
- cowcowbell
- bell
- *** Failers
- cowbell
-
-/^\s/
- \040abc
- \x0cabc
- \nabc
- \rabc
- \tabc
- *** Failers
- abc
-
-/^a b
-
- c/x
- abc
-
-/^(a|)\1*b/
- ab
- aaaab
- b
- *** Failers
- acb
-
-/^(a|)\1+b/
- aab
- aaaab
- b
- *** Failers
- ab
-
-/^(a|)\1?b/
- ab
- aab
- b
- *** Failers
- acb
-
-/^(a|)\1{2}b/
- aaab
- b
- *** Failers
- ab
- aab
- aaaab
-
-/^(a|)\1{2,3}b/
- aaab
- aaaab
- b
- *** Failers
- ab
- aab
- aaaaab
-
-/ab{1,3}bc/
- abbbbc
- abbbc
- abbc
- *** Failers
- abc
- abbbbbc
-
-/([^.]*)\.([^:]*):[T ]+(.*)/
- track1.title:TBlah blah blah
-
-/([^.]*)\.([^:]*):[T ]+(.*)/i
- track1.title:TBlah blah blah
-
-/([^.]*)\.([^:]*):[t ]+(.*)/i
- track1.title:TBlah blah blah
-
-/^[W-c]+$/
- WXY_^abc
- ***Failers
- wxy
-
-/^[W-c]+$/i
- WXY_^abc
- wxy_^ABC
-
-/^[\x3f-\x5F]+$/i
- WXY_^abc
- wxy_^ABC
-
-/^abc$/m
- abc
- qqq\nabc
- abc\nzzz
- qqq\nabc\nzzz
-
-/^abc$/
- abc
- *** Failers
- qqq\nabc
- abc\nzzz
- qqq\nabc\nzzz
-
-/\Aabc\Z/m
- abc
- abc\n
- *** Failers
- qqq\nabc
- abc\nzzz
- qqq\nabc\nzzz
-
-/\A(.)*\Z/s
- abc\ndef
-
-/\A(.)*\Z/m
- *** Failers
- abc\ndef
-
-/(?:b)|(?::+)/
- b::c
- c::b
-
-/[-az]+/
- az-
- *** Failers
- b
-
-/[az-]+/
- za-
- *** Failers
- b
-
-/[a\-z]+/
- a-z
- *** Failers
- b
-
-/[a-z]+/
- abcdxyz
-
-/[\d-]+/
- 12-34
- *** Failers
- aaa
-
-/[\d-z]+/
- 12-34z
- *** Failers
- aaa
-
-/\x5c/
- \\
-
-/\x20Z/
- the Zoo
- *** Failers
- Zulu
-
-/(abc)\1/i
- abcabc
- ABCabc
- abcABC
-
-/ab{3cd/
- ab{3cd
-
-/ab{3,cd/
- ab{3,cd
-
-/ab{3,4a}cd/
- ab{3,4a}cd
-
-/{4,5a}bc/
- {4,5a}bc
-
-/^a.b/
- a\rb
- *** Failers
- a\nb
-
-/abc$/
- abc
- abc\n
- *** Failers
- abc\ndef
-
-/(abc)\123/
- abc\x53
-
-/(abc)\223/
- abc\x93
-
-/(abc)\323/
- abc\xd3
-
-/(abc)\500/
- abc\x40
- abc\100
-
-/(abc)\5000/
- abc\x400
- abc\x40\x30
- abc\1000
- abc\100\x30
- abc\100\060
- abc\100\60
-
-/abc\81/
- abc\081
- abc\0\x38\x31
-
-/abc\91/
- abc\091
- abc\0\x39\x31
-
-/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/
- abcdefghijkllS
-
-/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
- abcdefghijk\12S
-
-/ab\gdef/
- abgdef
-
-/a{0}bc/
- bc
-
-/(a|(bc)){0,0}?xyz/
- xyz
-
-/abc[\10]de/
- abc\010de
-
-/abc[\1]de/
- abc\1de
-
-/(abc)[\1]de/
- abc\1de
-
-/(?s)a.b/
- a\nb
-
-/^([^a])([^\b])([^c]*)([^d]{3,4})/
- baNOTccccd
- baNOTcccd
- baNOTccd
- bacccd
- *** Failers
- anything
- b\bc
- baccd
-
-/[^a]/
- Abc
-
-/[^a]/i
- Abc
-
-/[^a]+/
- AAAaAbc
-
-/[^a]+/i
- AAAaAbc
-
-/[^a]+/
- bbb\nccc
-
-/[^k]$/
- abc
- *** Failers
- abk
-
-/[^k]{2,3}$/
- abc
- kbc
- kabc
- *** Failers
- abk
- akb
- akk
-
-/^\d{8,}\@.+[^k]$/
- 12345678\@a.b.c.d
- 123456789\@x.y.z
- *** Failers
- 12345678\@x.y.uk
- 1234567\@a.b.c.d
-
-/(a)\1{8,}/
- aaaaaaaaa
- aaaaaaaaaa
- *** Failers
- aaaaaaa
-
-/[^a]/
- aaaabcd
- aaAabcd
-
-/[^a]/i
- aaaabcd
- aaAabcd
-
-/[^az]/
- aaaabcd
- aaAabcd
-
-/[^az]/i
- aaaabcd
- aaAabcd
-
-/\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377/
- \000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377
-
-/P[^*]TAIRE[^*]{1,6}?LL/
- xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
-
-/P[^*]TAIRE[^*]{1,}?LL/
- xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
-
-/(\.\d\d[1-9]?)\d+/
- 1.230003938
- 1.875000282
- 1.235
-
-/(\.\d\d((?=0)|\d(?=\d)))/
- 1.230003938
- 1.875000282
- *** Failers
- 1.235
-
-/a(?)b/
- ab
-
-/\b(foo)\s+(\w+)/i
- Food is on the foo table
-
-/foo(.*)bar/
- The food is under the bar in the barn.
-
-/foo(.*?)bar/
- The food is under the bar in the barn.
-
-/(.*)(\d*)/
- I have 2 numbers: 53147
-
-/(.*)(\d+)/
- I have 2 numbers: 53147
-
-/(.*?)(\d*)/
- I have 2 numbers: 53147
-
-/(.*?)(\d+)/
- I have 2 numbers: 53147
-
-/(.*)(\d+)$/
- I have 2 numbers: 53147
-
-/(.*?)(\d+)$/
- I have 2 numbers: 53147
-
-/(.*)\b(\d+)$/
- I have 2 numbers: 53147
-
-/(.*\D)(\d+)$/
- I have 2 numbers: 53147
-
-/^\D*(?!123)/
- ABC123
-
-/^(\D*)(?=\d)(?!123)/
- ABC445
- *** Failers
- ABC123
-
-/^[W-]46]/
- W46]789
- -46]789
- *** Failers
- Wall
- Zebra
- 42
- [abcd]
- ]abcd[
-
-/^[W-\]46]/
- W46]789
- Wall
- Zebra
- Xylophone
- 42
- [abcd]
- ]abcd[
- \\backslash
- *** Failers
- -46]789
- well
-
-/\d\d\/\d\d\/\d\d\d\d/
- 01/01/2000
-
-/word (?:[a-zA-Z0-9]+ ){0,10}otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark otherword
- word cat dog elephant mussel cow horse canary baboon snake shark
-
-/word (?:[a-zA-Z0-9]+ ){0,300}otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
-
-/^(a){0,0}/
- bcd
- abc
- aab
-
-/^(a){0,1}/
- bcd
- abc
- aab
-
-/^(a){0,2}/
- bcd
- abc
- aab
-
-/^(a){0,3}/
- bcd
- abc
- aab
- aaa
-
-/^(a){0,}/
- bcd
- abc
- aab
- aaa
- aaaaaaaa
-
-/^(a){1,1}/
- bcd
- abc
- aab
-
-/^(a){1,2}/
- bcd
- abc
- aab
-
-/^(a){1,3}/
- bcd
- abc
- aab
- aaa
-
-/^(a){1,}/
- bcd
- abc
- aab
- aaa
- aaaaaaaa
-
-/.*\.gif/
- borfle\nbib.gif\nno
-
-/.{0,}\.gif/
- borfle\nbib.gif\nno
-
-/.*\.gif/m
- borfle\nbib.gif\nno
-
-/.*\.gif/s
- borfle\nbib.gif\nno
-
-/.*\.gif/ms
- borfle\nbib.gif\nno
-
-/.*$/
- borfle\nbib.gif\nno
-
-/.*$/m
- borfle\nbib.gif\nno
-
-/.*$/s
- borfle\nbib.gif\nno
-
-/.*$/ms
- borfle\nbib.gif\nno
-
-/.*$/
- borfle\nbib.gif\nno\n
-
-/.*$/m
- borfle\nbib.gif\nno\n
-
-/.*$/s
- borfle\nbib.gif\nno\n
-
-/.*$/ms
- borfle\nbib.gif\nno\n
-
-/(.*X|^B)/
- abcde\n1234Xyz
- BarFoo
- *** Failers
- abcde\nBar
-
-/(.*X|^B)/m
- abcde\n1234Xyz
- BarFoo
- abcde\nBar
-
-/(.*X|^B)/s
- abcde\n1234Xyz
- BarFoo
- *** Failers
- abcde\nBar
-
-/(.*X|^B)/ms
- abcde\n1234Xyz
- BarFoo
- abcde\nBar
-
-/(?s)(.*X|^B)/
- abcde\n1234Xyz
- BarFoo
- *** Failers
- abcde\nBar
-
-/(?s:.*X|^B)/
- abcde\n1234Xyz
- BarFoo
- *** Failers
- abcde\nBar
-
-/^.*B/
- **** Failers
- abc\nB
-
-/(?s)^.*B/
- abc\nB
-
-/(?m)^.*B/
- abc\nB
-
-/(?ms)^.*B/
- abc\nB
-
-/(?ms)^B/
- abc\nB
-
-/(?s)B$/
- B\n
-
-/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
- 123456654321
-
-/^\d\d\d\d\d\d\d\d\d\d\d\d/
- 123456654321
-
-/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
- 123456654321
-
-/^[abc]{12}/
- abcabcabcabc
-
-/^[a-c]{12}/
- abcabcabcabc
-
-/^(a|b|c){12}/
- abcabcabcabc
-
-/^[abcdefghijklmnopqrstuvwxy0123456789]/
- n
- *** Failers
- z
-
-/abcde{0,0}/
- abcd
- *** Failers
- abce
-
-/ab[cd]{0,0}e/
- abe
- *** Failers
- abcde
-
-/ab(c){0,0}d/
- abd
- *** Failers
- abcd
-
-/a(b*)/
- a
- ab
- abbbb
- *** Failers
- bbbbb
-
-/ab\d{0}e/
- abe
- *** Failers
- ab1e
-
-/"([^\\"]+|\\.)*"/
- the \"quick\" brown fox
- \"the \\\"quick\\\" brown fox\"
-
-/.*?/g+
- abc
-
-/\b/g+
- abc
-
-/\b/+g
- abc
-
-//g
- abc
-
-/<tr([\w\W\s\d][^<>]{0,})><TD([\w\W\s\d][^<>]{0,})>([\d]{0,}\.)(.*)((<BR>([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/is
- <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
-
-/a[^a]b/
- acb
- a\nb
-
-/a.b/
- acb
- *** Failers
- a\nb
-
-/a[^a]b/s
- acb
- a\nb
-
-/a.b/s
- acb
- a\nb
-
-/^(b+?|a){1,2}?c/
- bac
- bbac
- bbbac
- bbbbac
- bbbbbac
-
-/^(b+|a){1,2}?c/
- bac
- bbac
- bbbac
- bbbbac
- bbbbbac
-
-/(?!\A)x/m
- x\nb\n
- a\bx\n
-
-/\x0{ab}/
- \0{ab}
-
-/(A|B)*?CD/
- CD
-
-/(A|B)*CD/
- CD
-
-/(AB)*?\1/
- ABABAB
-
-/(AB)*\1/
- ABABAB
-
-/(?<!bar)foo/
- foo
- catfood
- arfootle
- rfoosh
- *** Failers
- barfoo
- towbarfoo
-
-/\w{3}(?<!bar)foo/
- catfood
- *** Failers
- foo
- barfoo
- towbarfoo
-
-/(?<=(foo)a)bar/
- fooabar
- *** Failers
- bar
- foobbar
-
-/\Aabc\z/m
- abc
- *** Failers
- abc\n
- qqq\nabc
- abc\nzzz
- qqq\nabc\nzzz
-
-"(?>.*/)foo"
- /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
-
-"(?>.*/)foo"
- /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
-
-/(?>(\.\d\d[1-9]?))\d+/
- 1.230003938
- 1.875000282
- *** Failers
- 1.235
-
-/^((?>\w+)|(?>\s+))*$/
- now is the time for all good men to come to the aid of the party
- *** Failers
- this is not a line with only words and spaces!
-
-/(\d+)(\w)/
- 12345a
- 12345+
-
-/((?>\d+))(\w)/
- 12345a
- *** Failers
- 12345+
-
-/(?>a+)b/
- aaab
-
-/((?>a+)b)/
- aaab
-
-/(?>(a+))b/
- aaab
-
-/(?>b)+/
- aaabbbccc
-
-/(?>a+|b+|c+)*c/
- aaabbbbccccd
-
-/((?>[^()]+)|\([^()]*\))+/
- ((abc(ade)ufh()()x
-
-/\(((?>[^()]+)|\([^()]+\))+\)/
- (abc)
- (abc(def)xyz)
- *** Failers
- ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-
-/a(?-i)b/i
- ab
- Ab
- *** Failers
- aB
- AB
-
-/(a (?x)b c)d e/
- a bcd e
- *** Failers
- a b cd e
- abcd e
- a bcde
-
-/(a b(?x)c d (?-x)e f)/
- a bcde f
- *** Failers
- abcdef
-
-/(a(?i)b)c/
- abc
- aBc
- *** Failers
- abC
- aBC
- Abc
- ABc
- ABC
- AbC
-
-/a(?i:b)c/
- abc
- aBc
- *** Failers
- ABC
- abC
- aBC
-
-/a(?i:b)*c/
- aBc
- aBBc
- *** Failers
- aBC
- aBBC
-
-/a(?=b(?i)c)\w\wd/
- abcd
- abCd
- *** Failers
- aBCd
- abcD
-
-/(?s-i:more.*than).*million/i
- more than million
- more than MILLION
- more \n than Million
- *** Failers
- MORE THAN MILLION
- more \n than \n million
-
-/(?:(?s-i)more.*than).*million/i
- more than million
- more than MILLION
- more \n than Million
- *** Failers
- MORE THAN MILLION
- more \n than \n million
-
-/(?>a(?i)b+)+c/
- abc
- aBbc
- aBBc
- *** Failers
- Abc
- abAb
- abbC
-
-/(?=a(?i)b)\w\wc/
- abc
- aBc
- *** Failers
- Ab
- abC
- aBC
-
-/(?<=a(?i)b)(\w\w)c/
- abxxc
- aBxxc
- *** Failers
- Abxxc
- ABxxc
- abxxC
-
-/(?:(a)|b)(?(1)A|B)/
- aA
- bB
- *** Failers
- aB
- bA
-
-/^(a)?(?(1)a|b)+$/
- aa
- b
- bb
- *** Failers
- ab
-
-/^(?(?=abc)\w{3}:|\d\d)$/
- abc:
- 12
- *** Failers
- 123
- xyz
-
-/^(?(?!abc)\d\d|\w{3}:)$/
- abc:
- 12
- *** Failers
- 123
- xyz
-
-/(?(?<=foo)bar|cat)/
- foobar
- cat
- fcat
- focat
- *** Failers
- foocat
-
-/(?(?<!foo)cat|bar)/
- foobar
- cat
- fcat
- focat
- *** Failers
- foocat
-
-/( \( )? [^()]+ (?(1) \) |) /x
- abcd
- (abcd)
- the quick (abcd) fox
- (abcd
-
-/( \( )? [^()]+ (?(1) \) ) /x
- abcd
- (abcd)
- the quick (abcd) fox
- (abcd
-
-/^(?(2)a|(1)(2))+$/
- 12
- 12a
- 12aa
- *** Failers
- 1234
-
-/((?i)blah)\s+\1/
- blah blah
- BLAH BLAH
- Blah Blah
- blaH blaH
- *** Failers
- blah BLAH
- Blah blah
- blaH blah
-
-/((?i)blah)\s+(?i:\1)/
- blah blah
- BLAH BLAH
- Blah Blah
- blaH blaH
- blah BLAH
- Blah blah
- blaH blah
-
-/(?>a*)*/
- a
- aa
- aaaa
-
-/(abc|)+/
- abc
- abcabc
- abcabcabc
- xyz
-
-/([a]*)*/
- a
- aaaaa
-
-/([ab]*)*/
- a
- b
- ababab
- aaaabcde
- bbbb
-
-/([^a]*)*/
- b
- bbbb
- aaa
-
-/([^ab]*)*/
- cccc
- abab
-
-/([a]*?)*/
- a
- aaaa
-
-/([ab]*?)*/
- a
- b
- abab
- baba
-
-/([^a]*?)*/
- b
- bbbb
- aaa
-
-/([^ab]*?)*/
- c
- cccc
- baba
-
-/(?>a*)*/
- a
- aaabcde
-
-/((?>a*))*/
- aaaaa
- aabbaa
-
-/((?>a*?))*/
- aaaaa
- aabbaa
-
-/(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x
- 12-sep-98
- 12-09-98
- *** Failers
- sep-12-98
-
-/(?<=(foo))bar\1/
- foobarfoo
- foobarfootling
- *** Failers
- foobar
- barfoo
-
-/(?i:saturday|sunday)/
- saturday
- sunday
- Saturday
- Sunday
- SATURDAY
- SUNDAY
- SunDay
-
-/(a(?i)bc|BB)x/
- abcx
- aBCx
- bbx
- BBx
- *** Failers
- abcX
- aBCX
- bbX
- BBX
-
-/^([ab](?i)[cd]|[ef])/
- ac
- aC
- bD
- elephant
- Europe
- frog
- France
- *** Failers
- Africa
-
-/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
- ab
- aBd
- xy
- xY
- zebra
- Zambesi
- *** Failers
- aCD
- XY
-
-/(?<=foo\n)^bar/m
- foo\nbar
- *** Failers
- bar
- baz\nbar
-
-/(?<=(?<!foo)bar)baz/
- barbaz
- barbarbaz
- koobarbaz
- *** Failers
- baz
- foobarbaz
-
-/The case of aaaaaa is missed out below because I think Perl 5.005_02 gets/
-/it wrong; it sets $1 to aaa rather than aa. Compare the following test,/
-/where it does set $1 to aa when matching aaaaaa./
-
-/^(a\1?){4}$/
- a
- aa
- aaa
- aaaa
- aaaaa
- aaaaaaa
- aaaaaaaa
- aaaaaaaaa
- aaaaaaaaaa
- aaaaaaaaaaa
- aaaaaaaaaaaa
- aaaaaaaaaaaaa
- aaaaaaaaaaaaaa
- aaaaaaaaaaaaaaa
- aaaaaaaaaaaaaaaa
-
-/^(a\1?)(a\1?)(a\2?)(a\3?)$/
- a
- aa
- aaa
- aaaa
- aaaaa
- aaaaaa
- aaaaaaa
- aaaaaaaa
- aaaaaaaaa
- aaaaaaaaaa
- aaaaaaaaaaa
- aaaaaaaaaaaa
- aaaaaaaaaaaaa
- aaaaaaaaaaaaaa
- aaaaaaaaaaaaaaa
- aaaaaaaaaaaaaaaa
-
-/The following tests are taken from the Perl 5.005 test suite; some of them/
-/are compatible with 5.004, but I'd rather not have to sort them out./
-
-/abc/
- abc
- xabcy
- ababc
- *** Failers
- xbc
- axc
- abx
-
-/ab*c/
- abc
-
-/ab*bc/
- abc
- abbc
- abbbbc
-
-/.{1}/
- abbbbc
-
-/.{3,4}/
- abbbbc
-
-/ab{0,}bc/
- abbbbc
-
-/ab+bc/
- abbc
- *** Failers
- abc
- abq
-
-/ab{1,}bc/
-
-/ab+bc/
- abbbbc
-
-/ab{1,}bc/
- abbbbc
-
-/ab{1,3}bc/
- abbbbc
-
-/ab{3,4}bc/
- abbbbc
-
-/ab{4,5}bc/
- *** Failers
- abq
- abbbbc
-
-/ab?bc/
- abbc
- abc
-
-/ab{0,1}bc/
- abc
-
-/ab?bc/
-
-/ab?c/
- abc
-
-/ab{0,1}c/
- abc
-
-/^abc$/
- abc
- *** Failers
- abbbbc
- abcc
-
-/^abc/
- abcc
-
-/^abc$/
-
-/abc$/
- aabc
- *** Failers
- aabc
- aabcd
-
-/^/
- abc
-
-/$/
- abc
-
-/a.c/
- abc
- axc
-
-/a.*c/
- axyzc
-
-/a[bc]d/
- abd
- *** Failers
- axyzd
- abc
-
-/a[b-d]e/
- ace
-
-/a[b-d]/
- aac
-
-/a[-b]/
- a-
-
-/a[b-]/
- a-
-
-/a]/
- a]
-
-/a[]]b/
- a]b
-
-/a[^bc]d/
- aed
- *** Failers
- abd
- abd
-
-/a[^-b]c/
- adc
-
-/a[^]b]c/
- adc
- *** Failers
- a-c
- a]c
-
-/\ba\b/
- a-
- -a
- -a-
-
-/\by\b/
- *** Failers
- xy
- yz
- xyz
-
-/\Ba\B/
- *** Failers
- a-
- -a
- -a-
-
-/\By\b/
- xy
-
-/\by\B/
- yz
-
-/\By\B/
- xyz
-
-/\w/
- a
-
-/\W/
- -
- *** Failers
- -
- a
-
-/a\sb/
- a b
-
-/a\Sb/
- a-b
- *** Failers
- a-b
- a b
-
-/\d/
- 1
-
-/\D/
- -
- *** Failers
- -
- 1
-
-/[\w]/
- a
-
-/[\W]/
- -
- *** Failers
- -
- a
-
-/a[\s]b/
- a b
-
-/a[\S]b/
- a-b
- *** Failers
- a-b
- a b
-
-/[\d]/
- 1
-
-/[\D]/
- -
- *** Failers
- -
- 1
-
-/ab|cd/
- abc
- abcd
-
-/()ef/
- def
-
-/$b/
-
-/a\(b/
- a(b
-
-/a\(*b/
- ab
- a((b
-
-/a\\b/
- a\b
-
-/((a))/
- abc
-
-/(a)b(c)/
- abc
-
-/a+b+c/
- aabbabc
-
-/a{1,}b{1,}c/
- aabbabc
-
-/a.+?c/
- abcabc
-
-/(a+|b)*/
- ab
-
-/(a+|b){0,}/
- ab
-
-/(a+|b)+/
- ab
-
-/(a+|b){1,}/
- ab
-
-/(a+|b)?/
- ab
-
-/(a+|b){0,1}/
- ab
-
-/[^ab]*/
- cde
-
-/abc/
- *** Failers
- b
-
-
-/a*/
-
-
-/([abc])*d/
- abbbcd
-
-/([abc])*bcd/
- abcd
-
-/a|b|c|d|e/
- e
-
-/(a|b|c|d|e)f/
- ef
-
-/abcd*efg/
- abcdefg
-
-/ab*/
- xabyabbbz
- xayabbbz
-
-/(ab|cd)e/
- abcde
-
-/[abhgefdc]ij/
- hij
-
-/^(ab|cd)e/
-
-/(abc|)ef/
- abcdef
-
-/(a|b)c*d/
- abcd
-
-/(ab|ab*)bc/
- abc
-
-/a([bc]*)c*/
- abc
-
-/a([bc]*)(c*d)/
- abcd
-
-/a([bc]+)(c*d)/
- abcd
-
-/a([bc]*)(c+d)/
- abcd
-
-/a[bcd]*dcdcde/
- adcdcde
-
-/a[bcd]+dcdcde/
- *** Failers
- abcde
- adcdcde
-
-/(ab|a)b*c/
- abc
-
-/((a)(b)c)(d)/
- abcd
-
-/[a-zA-Z_][a-zA-Z0-9_]*/
- alpha
-
-/^a(bc+|b[eh])g|.h$/
- abh
-
-/(bc+d$|ef*g.|h?i(j|k))/
- effgz
- ij
- reffgz
- *** Failers
- effg
- bcdd
-
-/((((((((((a))))))))))/
- a
-
-/((((((((((a))))))))))\10/
- aa
-
-/(((((((((a)))))))))/
- a
-
-/multiple words of text/
- *** Failers
- aa
- uh-uh
-
-/multiple words/
- multiple words, yeah
-
-/(.*)c(.*)/
- abcde
-
-/\((.*), (.*)\)/
- (a, b)
-
-/[k]/
-
-/abcd/
- abcd
-
-/a(bc)d/
- abcd
-
-/a[-]?c/
- ac
-
-/(abc)\1/
- abcabc
-
-/([a-c]*)\1/
- abcabc
-
-/(a)|\1/
- a
- *** Failers
- ab
- x
-
-/(([a-c])b*?\2)*/
- ababbbcbc
-
-/(([a-c])b*?\2){3}/
- ababbbcbc
-
-/((\3|b)\2(a)x)+/
- aaaxabaxbaaxbbax
-
-/((\3|b)\2(a)){2,}/
- bbaababbabaaaaabbaaaabba
-
-/abc/i
- ABC
- XABCY
- ABABC
- *** Failers
- aaxabxbaxbbx
- XBC
- AXC
- ABX
-
-/ab*c/i
- ABC
-
-/ab*bc/i
- ABC
- ABBC
-
-/ab*?bc/i
- ABBBBC
-
-/ab{0,}?bc/i
- ABBBBC
-
-/ab+?bc/i
- ABBC
-
-/ab+bc/i
- *** Failers
- ABC
- ABQ
-
-/ab{1,}bc/i
-
-/ab+bc/i
- ABBBBC
-
-/ab{1,}?bc/i
- ABBBBC
-
-/ab{1,3}?bc/i
- ABBBBC
-
-/ab{3,4}?bc/i
- ABBBBC
-
-/ab{4,5}?bc/i
- *** Failers
- ABQ
- ABBBBC
-
-/ab??bc/i
- ABBC
- ABC
-
-/ab{0,1}?bc/i
- ABC
-
-/ab??bc/i
-
-/ab??c/i
- ABC
-
-/ab{0,1}?c/i
- ABC
-
-/^abc$/i
- ABC
- *** Failers
- ABBBBC
- ABCC
-
-/^abc/i
- ABCC
-
-/^abc$/i
-
-/abc$/i
- AABC
-
-/^/i
- ABC
-
-/$/i
- ABC
-
-/a.c/i
- ABC
- AXC
-
-/a.*?c/i
- AXYZC
-
-/a.*c/i
- *** Failers
- AABC
- AXYZD
-
-/a[bc]d/i
- ABD
-
-/a[b-d]e/i
- ACE
- *** Failers
- ABC
- ABD
-
-/a[b-d]/i
- AAC
-
-/a[-b]/i
- A-
-
-/a[b-]/i
- A-
-
-/a]/i
- A]
-
-/a[]]b/i
- A]B
-
-/a[^bc]d/i
- AED
-
-/a[^-b]c/i
- ADC
- *** Failers
- ABD
- A-C
-
-/a[^]b]c/i
- ADC
-
-/ab|cd/i
- ABC
- ABCD
-
-/()ef/i
- DEF
-
-/$b/i
- *** Failers
- A]C
- B
-
-/a\(b/i
- A(B
-
-/a\(*b/i
- AB
- A((B
-
-/a\\b/i
- A\B
-
-/((a))/i
- ABC
-
-/(a)b(c)/i
- ABC
-
-/a+b+c/i
- AABBABC
-
-/a{1,}b{1,}c/i
- AABBABC
-
-/a.+?c/i
- ABCABC
-
-/a.*?c/i
- ABCABC
-
-/a.{0,5}?c/i
- ABCABC
-
-/(a+|b)*/i
- AB
-
-/(a+|b){0,}/i
- AB
-
-/(a+|b)+/i
- AB
-
-/(a+|b){1,}/i
- AB
-
-/(a+|b)?/i
- AB
-
-/(a+|b){0,1}/i
- AB
-
-/(a+|b){0,1}?/i
- AB
-
-/[^ab]*/i
- CDE
-
-/abc/i
-
-/a*/i
-
-
-/([abc])*d/i
- ABBBCD
-
-/([abc])*bcd/i
- ABCD
-
-/a|b|c|d|e/i
- E
-
-/(a|b|c|d|e)f/i
- EF
-
-/abcd*efg/i
- ABCDEFG
-
-/ab*/i
- XABYABBBZ
- XAYABBBZ
-
-/(ab|cd)e/i
- ABCDE
-
-/[abhgefdc]ij/i
- HIJ
-
-/^(ab|cd)e/i
- ABCDE
-
-/(abc|)ef/i
- ABCDEF
-
-/(a|b)c*d/i
- ABCD
-
-/(ab|ab*)bc/i
- ABC
-
-/a([bc]*)c*/i
- ABC
-
-/a([bc]*)(c*d)/i
- ABCD
-
-/a([bc]+)(c*d)/i
- ABCD
-
-/a([bc]*)(c+d)/i
- ABCD
-
-/a[bcd]*dcdcde/i
- ADCDCDE
-
-/a[bcd]+dcdcde/i
-
-/(ab|a)b*c/i
- ABC
-
-/((a)(b)c)(d)/i
- ABCD
-
-/[a-zA-Z_][a-zA-Z0-9_]*/i
- ALPHA
-
-/^a(bc+|b[eh])g|.h$/i
- ABH
-
-/(bc+d$|ef*g.|h?i(j|k))/i
- EFFGZ
- IJ
- REFFGZ
- *** Failers
- ADCDCDE
- EFFG
- BCDD
-
-/((((((((((a))))))))))/i
- A
-
-/((((((((((a))))))))))\10/i
- AA
-
-/(((((((((a)))))))))/i
- A
-
-/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
- A
-
-/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
- C
-
-/multiple words of text/i
- *** Failers
- AA
- UH-UH
-
-/multiple words/i
- MULTIPLE WORDS, YEAH
-
-/(.*)c(.*)/i
- ABCDE
-
-/\((.*), (.*)\)/i
- (A, B)
-
-/[k]/i
-
-/abcd/i
- ABCD
-
-/a(bc)d/i
- ABCD
-
-/a[-]?c/i
- AC
-
-/(abc)\1/i
- ABCABC
-
-/([a-c]*)\1/i
- ABCABC
-
-/a(?!b)./
- abad
-
-/a(?=d)./
- abad
-
-/a(?=c|d)./
- abad
-
-/a(?:b|c|d)(.)/
- ace
-
-/a(?:b|c|d)*(.)/
- ace
-
-/a(?:b|c|d)+?(.)/
- ace
- acdbcdbe
-
-/a(?:b|c|d)+(.)/
- acdbcdbe
-
-/a(?:b|c|d){2}(.)/
- acdbcdbe
-
-/a(?:b|c|d){4,5}(.)/
- acdbcdbe
-
-/a(?:b|c|d){4,5}?(.)/
- acdbcdbe
-
-/((foo)|(bar))*/
- foobar
-
-/a(?:b|c|d){6,7}(.)/
- acdbcdbe
-
-/a(?:b|c|d){6,7}?(.)/
- acdbcdbe
-
-/a(?:b|c|d){5,6}(.)/
- acdbcdbe
-
-/a(?:b|c|d){5,6}?(.)/
- acdbcdbe
-
-/a(?:b|c|d){5,7}(.)/
- acdbcdbe
-
-/a(?:b|c|d){5,7}?(.)/
- acdbcdbe
-
-/a(?:b|(c|e){1,2}?|d)+?(.)/
- ace
-
-/^(.+)?B/
- AB
-
-/^([^a-z])|(\^)$/
- .
-
-/^[<>]&/
- <&OUT
-
-/^(a\1?){4}$/
- aaaaaaaaaa
- *** Failers
- AB
- aaaaaaaaa
- aaaaaaaaaaa
-
-/^(a(?(1)\1)){4}$/
- aaaaaaaaaa
- *** Failers
- aaaaaaaaa
- aaaaaaaaaaa
-
-/(?:(f)(o)(o)|(b)(a)(r))*/
- foobar
-
-/(?<=a)b/
- ab
- *** Failers
- cb
- b
-
-/(?<!c)b/
- ab
- b
- b
-
-/(?:..)*a/
- aba
-
-/(?:..)*?a/
- aba
-
-/^(?:b|a(?=(.)))*\1/
- abc
-
-/^(){3,5}/
- abc
-
-/^(a+)*ax/
- aax
-
-/^((a|b)+)*ax/
- aax
-
-/^((a|bc)+)*ax/
- aax
-
-/(a|x)*ab/
- cab
-
-/(a)*ab/
- cab
-
-/(?:(?i)a)b/
- ab
-
-/((?i)a)b/
- ab
-
-/(?:(?i)a)b/
- Ab
-
-/((?i)a)b/
- Ab
-
-/(?:(?i)a)b/
- *** Failers
- cb
- aB
-
-/((?i)a)b/
-
-/(?i:a)b/
- ab
-
-/((?i:a))b/
- ab
-
-/(?i:a)b/
- Ab
-
-/((?i:a))b/
- Ab
-
-/(?i:a)b/
- *** Failers
- aB
- aB
-
-/((?i:a))b/
-
-/(?:(?-i)a)b/i
- ab
-
-/((?-i)a)b/i
- ab
-
-/(?:(?-i)a)b/i
- aB
-
-/((?-i)a)b/i
- aB
-
-/(?:(?-i)a)b/i
- *** Failers
- aB
- Ab
-
-/((?-i)a)b/i
-
-/(?:(?-i)a)b/i
- aB
-
-/((?-i)a)b/i
- aB
-
-/(?:(?-i)a)b/i
- *** Failers
- Ab
- AB
-
-/((?-i)a)b/i
-
-/(?-i:a)b/i
- ab
-
-/((?-i:a))b/i
- ab
-
-/(?-i:a)b/i
- aB
-
-/((?-i:a))b/i
- aB
-
-/(?-i:a)b/i
- *** Failers
- AB
- Ab
-
-/((?-i:a))b/i
-
-/(?-i:a)b/i
- aB
-
-/((?-i:a))b/i
- aB
-
-/(?-i:a)b/i
- *** Failers
- Ab
- AB
-
-/((?-i:a))b/i
-
-/((?-i:a.))b/i
- *** Failers
- AB
- a\nB
-
-/((?s-i:a.))b/i
- a\nB
-
-/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
- cabbbb
-
-/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
- caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
-
-/(ab)\d\1/i
- Ab4ab
- ab4Ab
-
-/foo\w*\d{4}baz/
- foobar1234baz
-
-/x(~~)*(?:(?:F)?)?/
- x~~
-
-/^a(?#xxx){3}c/
- aaac
-
-/^a (?#xxx) (?#yyy) {3}c/x
- aaac
-
-/(?<![cd])b/
- *** Failers
- B\nB
- dbcb
-
-/(?<![cd])[ab]/
- dbaacb
-
-/(?<!(c|d))b/
-
-/(?<!(c|d))[ab]/
- dbaacb
-
-/(?<!cd)[ab]/
- cdaccb
-
-/^(?:a?b?)*$/
- *** Failers
- dbcb
- a--
-
-/((?s)^a(.))((?m)^b$)/
- a\nb\nc\n
-
-/((?m)^b$)/
- a\nb\nc\n
-
-/(?m)^b/
- a\nb\n
-
-/(?m)^(b)/
- a\nb\n
-
-/((?m)^b)/
- a\nb\n
-
-/\n((?m)^b)/
- a\nb\n
-
-/((?s).)c(?!.)/
- a\nb\nc\n
- a\nb\nc\n
-
-/((?s)b.)c(?!.)/
- a\nb\nc\n
- a\nb\nc\n
-
-/^b/
-
-/()^b/
- *** Failers
- a\nb\nc\n
- a\nb\nc\n
-
-/((?m)^b)/
- a\nb\nc\n
-
-/(?(1)a|b)/
-
-/(?(1)b|a)/
- a
-
-/(x)?(?(1)a|b)/
- *** Failers
- a
- a
-
-/(x)?(?(1)b|a)/
- a
-
-/()?(?(1)b|a)/
- a
-
-/()(?(1)b|a)/
-
-/()?(?(1)a|b)/
- a
-
-/^(\()?blah(?(1)(\)))$/
- (blah)
- blah
- *** Failers
- a
- blah)
- (blah
-
-/^(\(+)?blah(?(1)(\)))$/
- (blah)
- blah
- *** Failers
- blah)
- (blah
-
-/(?(?!a)a|b)/
-
-/(?(?!a)b|a)/
- a
-
-/(?(?=a)b|a)/
- *** Failers
- a
- a
-
-/(?(?=a)a|b)/
- a
-
-/(?=(a+?))(\1ab)/
- aaab
-
-/^(?=(a+?))\1ab/
-
-/(\w+:)+/
- one:
-
-/$(?<=^(a))/
- a
-
-/(?=(a+?))(\1ab)/
- aaab
-
-/^(?=(a+?))\1ab/
- *** Failers
- aaab
- aaab
-
-/([\w:]+::)?(\w+)$/
- abcd
- xy:z:::abcd
-
-/^[^bcd]*(c+)/
- aexycd
-
-/(a*)b+/
- caab
-
-/([\w:]+::)?(\w+)$/
- abcd
- xy:z:::abcd
- *** Failers
- abcd:
- abcd:
-
-/^[^bcd]*(c+)/
- aexycd
-
-/(>a+)ab/
-
-/(?>a+)b/
- aaab
-
-/([[:]+)/
- a:[b]:
-
-/([[=]+)/
- a=[b]=
-
-/([[.]+)/
- a.[b].
-
-/((?>a+)b)/
- aaab
-
-/(?>(a+))b/
- aaab
-
-/((?>[^()]+)|\([^()]*\))+/
- ((abc(ade)ufh()()x
-
-/a\Z/
- *** Failers
- aaab
- a\nb\n
-
-/b\Z/
- a\nb\n
-
-/b\z/
-
-/b\Z/
- a\nb
-
-/b\z/
- a\nb
- *** Failers
-
-/^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/
- a
- abc
- a-b
- 0-9
- a.b
- 5.6.7
- the.quick.brown.fox
- a100.b200.300c
- 12-ab.1245
- ***Failers
- \
- .a
- -a
- a-
- a.
- a_b
- a.-
- a..
- ab..bc
- the.quick.brown.fox-
- the.quick.brown.fox.
- the.quick.brown.fox_
- the.quick.brown.fox+
-
-/(?>.*)(?<=(abcd|wxyz))/
- alphabetabcd
- endingwxyz
- *** Failers
- a rather long string that doesn't end with one of them
-
-/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark otherword
- word cat dog elephant mussel cow horse canary baboon snake shark
-
-/word (?>[a-zA-Z0-9]+ ){0,30}otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
-
-/(?<=\d{3}(?!999))foo/
- 999foo
- 123999foo
- *** Failers
- 123abcfoo
-
-/(?<=(?!...999)\d{3})foo/
- 999foo
- 123999foo
- *** Failers
- 123abcfoo
-
-/(?<=\d{3}(?!999)...)foo/
- 123abcfoo
- 123456foo
- *** Failers
- 123999foo
-
-/(?<=\d{3}...)(?<!999)foo/
- 123abcfoo
- 123456foo
- *** Failers
- 123999foo
-
-/<a[\s]+href[\s]*=[\s]* # find <a href=
- ([\"\'])? # find single or double quote
- (?(1) (.*?)\1 | ([^\s]+)) # if quote found, match up to next matching
- # quote, otherwise match up to next space
-/isx
- <a href=abcd xyz
- <a href=\"abcd xyz pqr\" cats
- <a href=\'abcd xyz pqr\' cats
-
-/<a\s+href\s*=\s* # find <a href=
- (["'])? # find single or double quote
- (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching
- # quote, otherwise match up to next space
-/isx
- <a href=abcd xyz
- <a href=\"abcd xyz pqr\" cats
- <a href = \'abcd xyz pqr\' cats
-
-/<a\s+href(?>\s*)=(?>\s*) # find <a href=
- (["'])? # find single or double quote
- (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching
- # quote, otherwise match up to next space
-/isx
- <a href=abcd xyz
- <a href=\"abcd xyz pqr\" cats
- <a href = \'abcd xyz pqr\' cats
-
-/((Z)+|A)*/
- ZABCDEFG
-
-/(Z()|A)*/
- ZABCDEFG
-
-/(Z(())|A)*/
- ZABCDEFG
-
-/((?>Z)+|A)*/
- ZABCDEFG
-
-/((?>)+|A)*/
- ZABCDEFG
-
-/a*/g
- abbab
-
-/^[a-\d]/
- abcde
- -things
- 0digit
- *** Failers
- bcdef
-
-/^[\d-a]/
- abcde
- -things
- 0digit
- *** Failers
- bcdef
-
-/[[:space:]]+/
- > \x09\x0a\x0c\x0d\x0b<
-
-/[[:blank:]]+/
- > \x09\x0a\x0c\x0d\x0b<
-
-/[\s]+/
- > \x09\x0a\x0c\x0d\x0b<
-
-/\s+/
- > \x09\x0a\x0c\x0d\x0b<
-
-/a b/x
- ab
-
-/(?!\A)x/m
- a\nxb\n
-
-/(?!^)x/m
- a\nxb\n
-
-/abc\Qabc\Eabc/
- abcabcabc
-
-/abc\Q(*+|\Eabc/
- abc(*+|abc
-
-/ abc\Q abc\Eabc/x
- abc abcabc
- *** Failers
- abcabcabc
-
-/abc#comment
- \Q#not comment
- literal\E/x
- abc#not comment\n literal
-
-/abc#comment
- \Q#not comment
- literal/x
- abc#not comment\n literal
-
-/abc#comment
- \Q#not comment
- literal\E #more comment
- /x
- abc#not comment\n literal
-
-/abc#comment
- \Q#not comment
- literal\E #more comment/x
- abc#not comment\n literal
-
-/\Qabc\$xyz\E/
- abc\\\$xyz
-
-/\Qabc\E\$\Qxyz\E/
- abc\$xyz
-
-/\Gabc/
- abc
- *** Failers
- xyzabc
-
-/\Gabc./g
- abc1abc2xyzabc3
-
-/abc./g
- abc1abc2xyzabc3
-
-/a(?x: b c )d/
- XabcdY
- *** Failers
- Xa b c d Y
-
-/((?x)x y z | a b c)/
- XabcY
- AxyzB
-
-/(?i)AB(?-i)C/
- XabCY
- *** Failers
- XabcY
-
-/((?i)AB(?-i)C|D)E/
- abCE
- DE
- *** Failers
- abcE
- abCe
- dE
- De
-
-/(.*)\d+\1/
- abc123abc
- abc123bc
-
-/(.*)\d+\1/s
- abc123abc
- abc123bc
-
-/((.*))\d+\1/
- abc123abc
- abc123bc
-
-/-- This tests for an IPv6 address in the form where it can have up to --/
-/-- eight components, one and only one of which is empty. This must be --/
-/-- an internal component. --/
-
-/^(?!:) # colon disallowed at start
- (?: # start of item
- (?: [0-9a-f]{1,4} | # 1-4 hex digits or
- (?(1)0 | () ) ) # if null previously matched, fail; else null
- : # followed by colon
- ){1,7} # end item; 1-7 of them required
- [0-9a-f]{1,4} $ # final hex number at end of string
- (?(1)|.) # check that there was an empty component
- /xi
- a123::a123
- a123:b342::abcd
- a123:b342::324e:abcd
- a123:ddde:b342::324e:abcd
- a123:ddde:b342::324e:dcba:abcd
- a123:ddde:9999:b342::324e:dcba:abcd
- *** Failers
- 1:2:3:4:5:6:7:8
- a123:bce:ddde:9999:b342::324e:dcba:abcd
- a123::9999:b342::324e:dcba:abcd
- abcde:2:3:4:5:6:7:8
- ::1
- abcd:fee0:123::
- :1
- 1:
-
-/ End of testinput1 /
diff --git a/ext/pcre/pcrelib/testdata/testinput2 b/ext/pcre/pcrelib/testdata/testinput2
deleted file mode 100644
index 2dd498a713..0000000000
--- a/ext/pcre/pcrelib/testdata/testinput2
+++ /dev/null
@@ -1,1162 +0,0 @@
-/(a)b|/
-
-/abc/
- abc
- defabc
- \Aabc
- *** Failers
- \Adefabc
- ABC
-
-/^abc/
- abc
- \Aabc
- *** Failers
- defabc
- \Adefabc
-
-/a+bc/
-
-/a*bc/
-
-/a{3}bc/
-
-/(abc|a+z)/
-
-/^abc$/
- abc
- *** Failers
- def\nabc
-
-/ab\gdef/X
-
-/(?X)ab\gdef/X
-
-/x{5,4}/
-
-/z{65536}/
-
-/[abcd/
-
-/[\B]/
-
-/[z-a]/
-
-/^*/
-
-/(abc/
-
-/(?# abc/
-
-/(?z)abc/
-
-/.*b/
-
-/.*?b/
-
-/cat|dog|elephant/
- this sentence eventually mentions a cat
- this sentences rambles on and on for a while and then reaches elephant
-
-/cat|dog|elephant/S
- this sentence eventually mentions a cat
- this sentences rambles on and on for a while and then reaches elephant
-
-/cat|dog|elephant/iS
- this sentence eventually mentions a CAT cat
- this sentences rambles on and on for a while to elephant ElePhant
-
-/a|[bcd]/S
-
-/(a|[^\dZ])/S
-
-/(a|b)*[\s]/S
-
-/(ab\2)/
-
-/{4,5}abc/
-
-/(a)(b)(c)\2/
- abcb
- \O0abcb
- \O3abcb
- \O6abcb
- \O9abcb
- \O12abcb
-
-/(a)bc|(a)(b)\2/
- abc
- \O0abc
- \O3abc
- \O6abc
- aba
- \O0aba
- \O3aba
- \O6aba
- \O9aba
- \O12aba
-
-/abc$/E
- abc
- *** Failers
- abc\n
- abc\ndef
-
-/(a)(b)(c)(d)(e)\6/
-
-/the quick brown fox/
- the quick brown fox
- this is a line with the quick brown fox
-
-/the quick brown fox/A
- the quick brown fox
- *** Failers
- this is a line with the quick brown fox
-
-/ab(?z)cd/
-
-/^abc|def/
- abcdef
- abcdef\B
-
-/.*((abc)$|(def))/
- defabc
- \Zdefabc
-
-/abc/P
- abc
- *** Failers
-
-/^abc|def/P
- abcdef
- abcdef\B
-
-/.*((abc)$|(def))/P
- defabc
- \Zdefabc
-
-/the quick brown fox/P
- the quick brown fox
- *** Failers
- The Quick Brown Fox
-
-/the quick brown fox/Pi
- the quick brown fox
- The Quick Brown Fox
-
-/abc.def/P
- *** Failers
- abc\ndef
-
-/abc$/P
- abc
- abc\n
-
-/(abc)\2/P
-
-/(abc\1)/P
- abc
-
-/)/
-
-/a[]b/
-
-/[^aeiou ]{3,}/
- co-processors, and for
-
-/<.*>/
- abc<def>ghi<klm>nop
-
-/<.*?>/
- abc<def>ghi<klm>nop
-
-/<.*>/U
- abc<def>ghi<klm>nop
-
-/(?U)<.*>/
- abc<def>ghi<klm>nop
-
-/<.*?>/U
- abc<def>ghi<klm>nop
-
-/={3,}/U
- abc========def
-
-/(?U)={3,}?/
- abc========def
-
-/(?<!bar|cattle)foo/
- foo
- catfoo
- *** Failers
- the barfoo
- and cattlefoo
-
-/(?<=a+)b/
-
-/(?<=aaa|b{0,3})b/
-
-/(?<!(foo)a\1)bar/
-
-/(?i)abc/
-
-/(a|(?m)a)/
-
-/(?i)^1234/
-
-/(^b|(?i)^d)/
-
-/(?s).*/
-
-/[abcd]/S
-
-/(?i)[abcd]/S
-
-/(?m)[xy]|(b|c)/S
-
-/(^a|^b)/m
-
-/(?i)(^a|^b)/m
-
-/(a)(?(1)a|b|c)/
-
-/(?(?=a)a|b|c)/
-
-/(?(1a)/
-
-/(?(?i))/
-
-/(?(abc))/
-
-/(?(?<ab))/
-
-/((?s)blah)\s+\1/
-
-/((?i)blah)\s+\1/
-
-/((?i)b)/DS
-
-/(a*b|(?i:c*(?-i)d))/S
-
-/a$/
- a
- a\n
- *** Failers
- \Za
- \Za\n
-
-/a$/m
- a
- a\n
- \Za\n
- *** Failers
- \Za
-
-/\Aabc/m
-
-/^abc/m
-
-/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/
- aaaaabbbbbcccccdef
-
-/(?<=foo)[ab]/S
-
-/(?<!foo)(alpha|omega)/S
-
-/(?!alphabet)[ab]/S
-
-/(?<=foo\n)^bar/m
-
-/(?>^abc)/m
- abc
- def\nabc
- *** Failers
- defabc
-
-/(?<=ab(c+)d)ef/
-
-/(?<=ab(?<=c+)d)ef/
-
-/(?<=ab(c|de)f)g/
-
-/The next three are in testinput2 because they have variable length branches/
-
-/(?<=bullock|donkey)-cart/
- the bullock-cart
- a donkey-cart race
- *** Failers
- cart
- horse-and-cart
-
-/(?<=ab(?i)x|y|z)/
-
-/(?>.*)(?<=(abcd)|(xyz))/
- alphabetabcd
- endingxyz
-
-/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/
- abxyZZ
- abXyZZ
- ZZZ
- zZZ
- bZZ
- BZZ
- *** Failers
- ZZ
- abXYZZ
- zzz
- bzz
-
-/(?<!(foo)a)bar/
- bar
- foobbar
- *** Failers
- fooabar
-
-/This one is here because Perl 5.005_02 doesn't fail it/
-
-/^(a)?(?(1)a|b)+$/
- *** Failers
- a
-
-/This one is here because I think Perl 5.005_02 gets the setting of $1 wrong/
-
-/^(a\1?){4}$/
- aaaaaa
-
-/These are syntax tests from Perl 5.005/
-
-/a[b-a]/
-
-/a[]b/
-
-/a[/
-
-/*a/
-
-/(*)b/
-
-/abc)/
-
-/(abc/
-
-/a**/
-
-/)(/
-
-/\1/
-
-/\2/
-
-/(a)|\2/
-
-/a[b-a]/i
-
-/a[]b/i
-
-/a[/i
-
-/*a/i
-
-/(*)b/i
-
-/abc)/i
-
-/(abc/i
-
-/a**/i
-
-/)(/i
-
-/:(?:/
-
-/(?<%)b/
-
-/a(?{)b/
-
-/a(?{{})b/
-
-/a(?{}})b/
-
-/a(?{"{"})b/
-
-/a(?{"{"}})b/
-
-/(?(1?)a|b)/
-
-/(?(1)a|b|c)/
-
-/[a[:xyz:/
-
-/(?<=x+)y/
-
-/a{37,17}/
-
-/abc/\
-
-/abc/\P
-
-/abc/\i
-
-/(a)bc(d)/
- abcd
- abcd\C2
- abcd\C5
-
-/(.{20})/
- abcdefghijklmnopqrstuvwxyz
- abcdefghijklmnopqrstuvwxyz\C1
- abcdefghijklmnopqrstuvwxyz\G1
-
-/(.{15})/
- abcdefghijklmnopqrstuvwxyz
- abcdefghijklmnopqrstuvwxyz\C1\G1
-
-/(.{16})/
- abcdefghijklmnopqrstuvwxyz
- abcdefghijklmnopqrstuvwxyz\C1\G1\L
-
-/^(a|(bc))de(f)/
- adef\G1\G2\G3\G4\L
- bcdef\G1\G2\G3\G4\L
- adefghijk\C0
-
-/^abc\00def/
- abc\00def\L\C0
-
-/word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
-)((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
-)?)?)?)?)?)?)?)?)?otherword/M
-
-/.*X/D
-
-/.*X/Ds
-
-/(.*X|^B)/D
-
-/(.*X|^B)/Ds
-
-/(?s)(.*X|^B)/D
-
-/(?s:.*X|^B)/D
-
-/\Biss\B/+
- Mississippi
-
-/\Biss\B/+P
- Mississippi
-
-/iss/G+
- Mississippi
-
-/\Biss\B/G+
- Mississippi
-
-/\Biss\B/g+
- Mississippi
- *** Failers
- Mississippi\A
-
-/(?<=[Ms])iss/g+
- Mississippi
-
-/(?<=[Ms])iss/G+
- Mississippi
-
-/^iss/g+
- ississippi
-
-/.*iss/g+
- abciss\nxyzisspqr
-
-/.i./+g
- Mississippi
- Mississippi\A
- Missouri river
- Missouri river\A
-
-/^.is/+g
- Mississippi
-
-/^ab\n/g+
- ab\nab\ncd
-
-/^ab\n/mg+
- ab\nab\ncd
-
-/abc/
-
-/abc|bac/
-
-/(abc|bac)/
-
-/(abc|(c|dc))/
-
-/(abc|(d|de)c)/
-
-/a*/
-
-/a+/
-
-/(baa|a+)/
-
-/a{0,3}/
-
-/baa{3,}/
-
-/"([^\\"]+|\\.)*"/
-
-/(abc|ab[cd])/
-
-/(a|.)/
-
-/a|ba|\w/
-
-/abc(?=pqr)/
-
-/...(?<=abc)/
-
-/abc(?!pqr)/
-
-/ab./
-
-/ab[xyz]/
-
-/abc*/
-
-/ab.c*/
-
-/a.c*/
-
-/.c*/
-
-/ac*/
-
-/(a.c*|b.c*)/
-
-/a.c*|aba/
-
-/.+a/
-
-/(?=abcda)a.*/
-
-/(?=a)a.*/
-
-/a(b)*/
-
-/a\d*/
-
-/ab\d*/
-
-/a(\d)*/
-
-/abcde{0,0}/
-
-/ab\d+/
-
-/a(?(1)b)/
-
-/a(?(1)bag|big)/
-
-/a(?(1)bag|big)*/
-
-/a(?(1)bag|big)+/
-
-/a(?(1)b..|b..)/
-
-/ab\d{0}e/
-
-/a?b?/
- a
- b
- ab
- \
- *** Failers
- \N
-
-/|-/
- abcd
- -abc
- \Nab-c
- *** Failers
- \Nabc
-
-/a*(b+)(z)(z)/P
- aaaabbbbzzzz
- aaaabbbbzzzz\O0
- aaaabbbbzzzz\O1
- aaaabbbbzzzz\O2
- aaaabbbbzzzz\O3
- aaaabbbbzzzz\O4
- aaaabbbbzzzz\O5
-
-/^.?abcd/S
-
-/\( # ( at start
- (?: # Non-capturing bracket
- (?>[^()]+) # Either a sequence of non-brackets (no backtracking)
- | # Or
- (?R) # Recurse - i.e. nested bracketed string
- )* # Zero or more contents
- \) # Closing )
- /x
- (abcd)
- (abcd)xyz
- xyz(abcd)
- (ab(xy)cd)pqr
- (ab(xycd)pqr
- () abc ()
- 12(abcde(fsh)xyz(foo(bar))lmno)89
- *** Failers
- abcd
- abcd)
- (abcd
-
-/\( ( (?>[^()]+) | (?R) )* \) /xg
- (ab(xy)cd)pqr
- 1(abcd)(x(y)z)pqr
-
-/\( (?: (?>[^()]+) | (?R) ) \) /x
- (abcd)
- (ab(xy)cd)
- (a(b(c)d)e)
- ((ab))
- *** Failers
- ()
-
-/\( (?: (?>[^()]+) | (?R) )? \) /x
- ()
- 12(abcde(fsh)xyz(foo(bar))lmno)89
-
-/\( ( (?>[^()]+) | (?R) )* \) /x
- (ab(xy)cd)
-
-/\( ( ( (?>[^()]+) | (?R) )* ) \) /x
- (ab(xy)cd)
-
-/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /x
- (ab(xy)cd)
- (123ab(xy)cd)
-
-/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /x
- (ab(xy)cd)
- (123ab(xy)cd)
-
-/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /x
- (ab(xy)cd)
-
-/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /x
- (abcd(xyz<p>qrs)123)
-
-/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /x
- (ab(cd)ef)
- (ab(cd(ef)gh)ij)
-
-/^[[:alnum:]]/D
-
-/^[[:alpha:]]/D
-
-/^[[:ascii:]]/D
-
-/^[[:blank:]]/D
-
-/^[[:cntrl:]]/D
-
-/^[[:digit:]]/D
-
-/^[[:graph:]]/D
-
-/^[[:lower:]]/D
-
-/^[[:print:]]/D
-
-/^[[:punct:]]/D
-
-/^[[:space:]]/D
-
-/^[[:upper:]]/D
-
-/^[[:xdigit:]]/D
-
-/^[[:word:]]/D
-
-/^[[:^cntrl:]]/D
-
-/^[12[:^digit:]]/D
-
-/^[[:^blank:]]/D
-
-/[01[:alpha:]%]/D
-
-/[[.ch.]]/
-
-/[[=ch=]]/
-
-/[[:rhubarb:]]/
-
-/[[:upper:]]/i
- A
- a
-
-/[[:lower:]]/i
- A
- a
-
-/((?-i)[[:lower:]])[[:lower:]]/i
- ab
- aB
- *** Failers
- Ab
- AB
-
-/[\200-\410]/
-
-/^(?(0)f|b)oo/
-
-/This one's here because of the large output vector needed/
-
-/(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/
- \O900 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 ABC ABC
-
-/This one's here because Perl does this differently and PCRE can't at present/
-
-/(main(O)?)+/
- mainmain
- mainOmain
-
-/These are all cases where Perl does it differently (nested captures)/
-
-/^(a(b)?)+$/
- aba
-
-/^(aa(bb)?)+$/
- aabbaa
-
-/^(aa|aa(bb))+$/
- aabbaa
-
-/^(aa(bb)??)+$/
- aabbaa
-
-/^(?:aa(bb)?)+$/
- aabbaa
-
-/^(aa(b(b))?)+$/
- aabbaa
-
-/^(?:aa(b(b))?)+$/
- aabbaa
-
-/^(?:aa(b(?:b))?)+$/
- aabbaa
-
-/^(?:aa(bb(?:b))?)+$/
- aabbbaa
-
-/^(?:aa(b(?:bb))?)+$/
- aabbbaa
-
-/^(?:aa(?:b(b))?)+$/
- aabbaa
-
-/^(?:aa(?:b(bb))?)+$/
- aabbbaa
-
-/^(aa(b(bb))?)+$/
- aabbbaa
-
-/^(aa(bb(bb))?)+$/
- aabbbbaa
-
-/--------------------------------------------------------------------/
-
-/#/xMD
-
-/a#/xMD
-
-/[\s]/D
-
-/[\S]/D
-
-/a(?i)b/D
- ab
- aB
- *** Failers
- AB
-
-/(a(?i)b)/D
- ab
- aB
- *** Failers
- AB
-
-/ (?i)abc/xD
-
-/#this is a comment
- (?i)abc/xD
-
-/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/D
-
-/\Q123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/D
-
-/\Q\E/D
- \
-
-/\Q\Ex/D
-
-/ \Q\E/D
-
-/a\Q\E/D
- abc
- bca
- bac
-
-/a\Q\Eb/D
- abc
-
-/\Q\Eabc/D
-
-/x*+\w/D
- ****Failers
- xxxxx
-
-/x?+/D
-
-/x++/D
-
-/x{1,3}+/D
-
-/(x)*+/D
-
-/^(\w++|\s++)*$/
- now is the time for all good men to come to the aid of the party
- *** Failers
- this is not a line with only words and spaces!
-
-/(\d++)(\w)/
- 12345a
- *** Failers
- 12345+
-
-/a++b/
- aaab
-
-/(a++b)/
- aaab
-
-/(a++)b/
- aaab
-
-/([^()]++|\([^()]*\))+/
- ((abc(ade)ufh()()x
-
-/\(([^()]++|\([^()]+\))+\)/
- (abc)
- (abc(def)xyz)
- *** Failers
- ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-
-/(abc){1,3}+/D
-
-/a+?+/
-
-/a{2,3}?+b/
-
-/(?U)a+?+/
-
-/a{2,3}?+b/U
-
-/x(?U)a++b/D
- xaaaab
-
-/(?U)xa++b/D
- xaaaab
-
-/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/D
-
-/^x(?U)a+b/D
-
-/^x(?U)(a+)b/D
-
-/[.x.]/
-
-/[=x=]/
-
-/[:x:]/
-
-/\l/
-
-/\L/
-
-/\N{name}/
-
-/\pP/
-
-/\PP/
-
-/\p{prop}/
-
-/\P{prop}/
-
-/\u/
-
-/\U/
-
-/\X/
-
-/[/
-
-/[a-/
-
-/[[:space:]/
-
-/[\s]/DM
-
-/[[:space:]]/DM
-
-/[[:space:]abcde]/DM
-
-/< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >/x
- <>
- <abcd>
- <abc <123> hij>
- <abc <def> hij>
- <abc<>def>
- <abc<>
- *** Failers
- <abc
-
-|8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|DM
-
-|\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|DM
-
-/(.*)\d+\1/I
-
-/(.*)\d+/I
-
-/(.*)\d+\1/Is
-
-/(.*)\d+/Is
-
-/(.*(xyz))\d+\2/I
-
-/((.*))\d+\1/I
- abc123bc
-
-/a[b]/I
-
-/(?=a).*/I
-
-/(?=abc).xyz/iI
-
-/(?=abc)(?i).xyz/I
-
-/(?=a)(?=b)/I
-
-/(?=.)a/I
-
-/((?=abcda)a)/I
-
-/((?=abcda)ab)/I
-
-/()a/I
-
-/(?(1)ab|ac)/I
-
-/(?(1)abz|acz)/I
-
-/(?(1)abz)/I
-
-/(?(1)abz)123/I
-
-/(a)+/I
-
-/(a){2,3}/I
-
-/(a)*/I
-
-/[a]/I
-
-/[ab]/I
-
-/[ab]/IS
-
-/[^a]/I
-
-/\d456/I
-
-/\d456/IS
-
-/a^b/I
-
-/^a/mI
- abcde
- xy\nabc
- *** Failers
- xyabc
-
-/c|abc/I
-
-/(?i)[ab]/IS
-
-/[ab](?i)cd/IS
-
-/abc(?C)def/
- abcdef
- 1234abcdef
- *** Failers
- abcxyz
- abcxyzf
-
-/abc(?C)de(?C1)f/
- 123abcdef
-
-/(?C1)\dabc(?C2)def/
- 1234abcdef
- *** Failers
- abcdef
-
-/(?C255)ab/
-
-/(?C256)ab/
-
-/(?Cab)xx/
-
-/(?C12vr)x/
-
-/abc(?C)def/
- *** Failers
- \x83\x0\x61bcdef
-
-/(abc)(?C)de(?C1)f/
- 123abcdef
- 123abcdef\C+
- 123abcdef\C-
- *** Failers
- 123abcdef\C!1
-
-/(?C0)(abc(?C1))*/
- abcabcabc
- abcabc\C!1!3
- *** Failers
- abcabcabc\C!1!3
-
-/(\d{3}(?C))*/
- 123\C+
- 123456\C+
- 123456789\C+
-
-/((xyz)(?C)p|(?C1)xyzabc)/
- xyzabc\C+
-
-/(X)((xyz)(?C)p|(?C1)xyzabc)/
- Xxyzabc\C+
-
-/(?=(abc))(?C)abcdef/
- abcdef\C+
-
-/(?!(abc)(?C1)d)(?C2)abcxyz/
- abcxyz\C+
-
-/(?<=(abc)(?C))xyz/
- abcxyz\C+
-
-/(?C)abc/
-
-/(?C)^abc/
-
-/(?C)a|b/S
-
-/(?R)/
-
-/(a|(?R))/
-
-/(ab|(bc|(de|(?R))))/
-
-/x(ab|(bc|(de|(?R))))/
- xab
- xbc
- xde
- xxab
- xxxab
- *** Failers
- xyab
-
-/(ab|(bc|(de|(?1))))/
-
-/x(ab|(bc|(de|(?1)x)x)x)/
-
-/^([^()]|\((?1)*\))*$/
- abc
- a(b)c
- a(b(c))d
- *** Failers)
- a(b(c)d
-
-/^>abc>([^()]|\((?1)*\))*<xyz<$/
- >abc>123<xyz<
- >abc>1(2)3<xyz<
- >abc>(1(2)3)<xyz<
-
-/(a(?1)b)/D
-
-/(a(?1)+b)/D
-
-/^\W*(?:((.)\W*(?1)\W*\2|)|((.)\W*(?3)\W*\4|\W*.\W*))\W*$/i
- 1221
- Satan, oscillate my metallic sonatas!
- A man, a plan, a canal: Panama!
- Able was I ere I saw Elba.
- *** Failers
- The quick brown fox
-
-/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/
- 12
- (((2+2)*-3)-7)
- -12
- *** Failers
- ((2+2)*-3)-7)
-
-/^(x(y|(?1){2})z)/
- xyz
- xxyzxyzz
- *** Failers
- xxyzz
- xxyzxyzxyzz
-
-/((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/x
- <>
- <abcd>
- <abc <123> hij>
- <abc <def> hij>
- <abc<>def>
- <abc<>
- *** Failers
- <abc
-
-/(?1)/
-
-/((?2)(abc)/
-
-/^(abc)def(?1)/
- abcdefabc
-
-/^(a|b|c)=(?1)+/
- a=a
- a=b
- a=bc
-
-/^(a|b|c)=((?1))+/
- a=a
- a=b
- a=bc
-
-/a(?P<name1>b|c)d(?P<longername2>e)/D
- abde
- acde
-
-/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/D
-
-/(?P<a>a)...(?P=a)bbb(?P>a)d/D
-
-/ End of testinput2 /
diff --git a/ext/pcre/pcrelib/testdata/testinput3 b/ext/pcre/pcrelib/testdata/testinput3
deleted file mode 100644
index 391aa62069..0000000000
--- a/ext/pcre/pcrelib/testdata/testinput3
+++ /dev/null
@@ -1,65 +0,0 @@
-/^[\w]+/
- *** Failers
- École
-
-/^[\w]+/Lfr
- École
-
-/^[\w]+/
- *** Failers
- École
-
-/^[\W]+/
- École
-
-/^[\W]+/Lfr
- *** Failers
- École
-
-/[\b]/
- \b
- *** Failers
- a
-
-/[\b]/Lfr
- \b
- *** Failers
- a
-
-/^\w+/
- *** Failers
- École
-
-/^\w+/Lfr
- École
-
-/(.+)\b(.+)/
- École
-
-/(.+)\b(.+)/Lfr
- *** Failers
- École
-
-/École/i
- École
- *** Failers
- école
-
-/École/iLfr
- École
- école
-
-/\w/IS
-
-/\w/ISLfr
-
-/^[\xc8-\xc9]/iLfr
- École
- école
-
-/^[\xc8-\xc9]/Lfr
- École
- *** Failers
- école
-
-/ End of testinput3 /
diff --git a/ext/pcre/pcrelib/testdata/testinput4 b/ext/pcre/pcrelib/testdata/testinput4
deleted file mode 100644
index 51d6b97632..0000000000
--- a/ext/pcre/pcrelib/testdata/testinput4
+++ /dev/null
@@ -1,155 +0,0 @@
-/-- Do not use the \x{} construct except with patterns that have the --/
-/-- /8 option set, because PCRE doesn't recognize them as UTF-8 unless --/
-/-- that option is set. However, the latest Perls recognize them always. --/
-
-/a.b/8
- acb
- a\x7fb
- a\x{100}b
- *** Failers
- a\nb
-
-/a(.{3})b/8
- a\x{4000}xyb
- a\x{4000}\x7fyb
- a\x{4000}\x{100}yb
- *** Failers
- a\x{4000}b
- ac\ncb
-
-/a(.*?)(.)/
- a\xc0\x88b
-
-/a(.*?)(.)/8
- a\x{100}b
-
-/a(.*)(.)/
- a\xc0\x88b
-
-/a(.*)(.)/8
- a\x{100}b
-
-/a(.)(.)/
- a\xc0\x92bcd
-
-/a(.)(.)/8
- a\x{240}bcd
-
-/a(.?)(.)/
- a\xc0\x92bcd
-
-/a(.?)(.)/8
- a\x{240}bcd
-
-/a(.??)(.)/
- a\xc0\x92bcd
-
-/a(.??)(.)/8
- a\x{240}bcd
-
-/a(.{3})b/8
- a\x{1234}xyb
- a\x{1234}\x{4321}yb
- a\x{1234}\x{4321}\x{3412}b
- *** Failers
- a\x{1234}b
- ac\ncb
-
-/a(.{3,})b/8
- a\x{1234}xyb
- a\x{1234}\x{4321}yb
- a\x{1234}\x{4321}\x{3412}b
- axxxxbcdefghijb
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- *** Failers
- a\x{1234}b
-
-/a(.{3,}?)b/8
- a\x{1234}xyb
- a\x{1234}\x{4321}yb
- a\x{1234}\x{4321}\x{3412}b
- axxxxbcdefghijb
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- *** Failers
- a\x{1234}b
-
-/a(.{3,5})b/8
- a\x{1234}xyb
- a\x{1234}\x{4321}yb
- a\x{1234}\x{4321}\x{3412}b
- axxxxbcdefghijb
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- axbxxbcdefghijb
- axxxxxbcdefghijb
- *** Failers
- a\x{1234}b
- axxxxxxbcdefghijb
-
-/a(.{3,5}?)b/8
- a\x{1234}xyb
- a\x{1234}\x{4321}yb
- a\x{1234}\x{4321}\x{3412}b
- axxxxbcdefghijb
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- axbxxbcdefghijb
- axxxxxbcdefghijb
- *** Failers
- a\x{1234}b
- axxxxxxbcdefghijb
-
-/^[a\x{c0}]/8
- *** Failers
- \x{100}
-
-/(?<=aXb)cd/8
- aXbcd
-
-/(?<=a\x{100}b)cd/8
- a\x{100}bcd
-
-/(?<=a\x{100000}b)cd/8
- a\x{100000}bcd
-
-/(?:\x{100}){3}b/8
- \x{100}\x{100}\x{100}b
- *** Failers
- \x{100}\x{100}b
-
-/\x{ab}/8
- \x{ab}
- \xc2\xab
- *** Failers
- \x00{ab}
-
-/(?<=(.))X/8
- WXYZ
- \x{256}XYZ
- *** Failers
- XYZ
-
-/X(\C{3})/8
- X\x{1234}
-
-/X(\C{4})/8
- X\x{1234}YZ
-
-/X\C*/8
- XYZabcdce
-
-/X\C*?/8
- XYZabcde
-
-/X\C{3,5}/8
- Xabcdefg
- X\x{1234}
- X\x{1234}YZ
- X\x{1234}\x{512}
- X\x{1234}\x{512}YZ
-
-/X\C{3,5}?/8
- Xabcdefg
- X\x{1234}
- X\x{1234}YZ
- X\x{1234}\x{512}
-
-/ End of testinput4 /
diff --git a/ext/pcre/pcrelib/testdata/testinput5 b/ext/pcre/pcrelib/testdata/testinput5
deleted file mode 100644
index 81fe233e6b..0000000000
--- a/ext/pcre/pcrelib/testdata/testinput5
+++ /dev/null
@@ -1,91 +0,0 @@
-/\x{100}/8DM
-
-/\x{1000}/8DM
-
-/\x{10000}/8DM
-
-/\x{100000}/8DM
-
-/\x{1000000}/8DM
-
-/\x{4000000}/8DM
-
-/\x{7fffFFFF}/8DM
-
-/[\x{ff}]/8DM
-
-/[\x{100}]/8DM
-
-/\x{ffffffff}/8
-
-/\x{100000000}/8
-
-/^\x{100}a\x{1234}/8
- \x{100}a\x{1234}bcd
-
-/\x80/8D
-
-/\xff/8D
-
-/\x{0041}\x{2262}\x{0391}\x{002e}/D8
- \x{0041}\x{2262}\x{0391}\x{002e}
-
-/\x{D55c}\x{ad6d}\x{C5B4}/D8
- \x{D55c}\x{ad6d}\x{C5B4}
-
-/\x{65e5}\x{672c}\x{8a9e}/D8
- \x{65e5}\x{672c}\x{8a9e}
-
-/\x{80}/D8
-
-/\x{084}/D8
-
-/\x{104}/D8
-
-/\x{861}/D8
-
-/\x{212ab}/D8
-
-/.{3,5}X/D8
- \x{212ab}\x{212ab}\x{212ab}\x{861}X
-
-
-/.{3,5}?/D8
- \x{212ab}\x{212ab}\x{212ab}\x{861}
-
-/-- These tests are here rather than in testinput4 because Perl 5.6 has --/
-/-- some problems with UTF-8 support, in the area of \x{..} where the --/
-/-- value is < 255. It grumbles about invalid UTF-8 strings. --/
-
-/^[a\x{c0}]b/8
- \x{c0}b
-
-/^([a\x{c0}]*?)aa/8
- a\x{c0}aaaa/
-
-/^([a\x{c0}]*?)aa/8
- a\x{c0}aaaa/
- a\x{c0}a\x{c0}aaa/
-
-/^([a\x{c0}]*)aa/8
- a\x{c0}aaaa/
- a\x{c0}a\x{c0}aaa/
-
-/^([a\x{c0}]*)a\x{c0}/8
- a\x{c0}aaaa/
- a\x{c0}a\x{c0}aaa/
-
-/-- --/
-
-/(?<=\C)X/8
- Should produce an error diagnostic
-
-/-- This one is here not because it's different to Perl, but because the --/
-/-- way the captured single-byte is displayed. (In Perl it becomes a --/
-/-- character, and you can't tell the difference.) --/
-
-/X(\C)(.*)/8
- X\x{1234}
- X\nabc
-
-/ End of testinput5 /
diff --git a/ext/pcre/pcrelib/testdata/testinput6 b/ext/pcre/pcrelib/testdata/testinput6
deleted file mode 100644
index 00748513c6..0000000000
--- a/ext/pcre/pcrelib/testdata/testinput6
+++ /dev/null
@@ -1,78 +0,0 @@
-/\x{100}/8DM
-
-/\x{1000}/8DM
-
-/\x{10000}/8DM
-
-/\x{100000}/8DM
-
-/\x{1000000}/8DM
-
-/\x{4000000}/8DM
-
-/\x{7fffFFFF}/8DM
-
-/[\x{ff}]/8DM
-
-/[\x{100}]/8DM
-
-/\x{ffffffff}/8
-
-/\x{100000000}/8
-
-/^\x{100}a\x{1234}/8
- \x{100}a\x{1234}bcd
-
-/\x80/8D
-
-/\xff/8D
-
-/\x{0041}\x{2262}\x{0391}\x{002e}/D8
- \x{0041}\x{2262}\x{0391}\x{002e}
-
-/\x{D55c}\x{ad6d}\x{C5B4}/D8
- \x{D55c}\x{ad6d}\x{C5B4}
-
-/\x{65e5}\x{672c}\x{8a9e}/D8
- \x{65e5}\x{672c}\x{8a9e}
-
-/\x{80}/D8
-
-/\x{084}/D8
-
-/\x{104}/D8
-
-/\x{861}/D8
-
-/\x{212ab}/D8
-
-/.{3,5}X/D8
- \x{212ab}\x{212ab}\x{212ab}\x{861}X
-
-
-/.{3,5}?/D8
- \x{212ab}\x{212ab}\x{212ab}\x{861}
-
-/-- These tests are here rather than in testinput5 because Perl 5.6 has --/
-/-- some problems with UTF-8 support, in the area of \x{..} where the --/
-/-- value is < 255. It grumbles about invalid UTF-8 strings. --/
-
-/^[a\x{c0}]b/8
- \x{c0}b
-
-/^([a\x{c0}]*?)aa/8
- a\x{c0}aaaa/
-
-/^([a\x{c0}]*?)aa/8
- a\x{c0}aaaa/
- a\x{c0}a\x{c0}aaa/
-
-/^([a\x{c0}]*)aa/8
- a\x{c0}aaaa/
- a\x{c0}a\x{c0}aaa/
-
-/^([a\x{c0}]*)a\x{c0}/8
- a\x{c0}aaaa/
- a\x{c0}a\x{c0}aaa/
-
-/ End of testinput6 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput1 b/ext/pcre/pcrelib/testdata/testoutput1
deleted file mode 100644
index 81bf6cef3d..0000000000
--- a/ext/pcre/pcrelib/testdata/testoutput1
+++ /dev/null
@@ -1,6222 +0,0 @@
-PCRE version 3.92 11-Sep-2002
-
-/the quick brown fox/
- the quick brown fox
- 0: the quick brown fox
- The quick brown FOX
-No match
- What do you know about the quick brown fox?
- 0: the quick brown fox
- What do you know about THE QUICK BROWN FOX?
-No match
-
-/The quick brown fox/i
- the quick brown fox
- 0: the quick brown fox
- The quick brown FOX
- 0: The quick brown FOX
- What do you know about the quick brown fox?
- 0: the quick brown fox
- What do you know about THE QUICK BROWN FOX?
- 0: THE QUICK BROWN FOX
-
-/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
- abcd\t\n\r\f\a\e9;\$\\?caxyz
- 0: abcd\x09\x0a\x0d\x0c\x07\x1b9;$\?caxyz
-
-/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
- abxyzpqrrrabbxyyyypqAzz
- 0: abxyzpqrrrabbxyyyypqAzz
- abxyzpqrrrabbxyyyypqAzz
- 0: abxyzpqrrrabbxyyyypqAzz
- aabxyzpqrrrabbxyyyypqAzz
- 0: aabxyzpqrrrabbxyyyypqAzz
- aaabxyzpqrrrabbxyyyypqAzz
- 0: aaabxyzpqrrrabbxyyyypqAzz
- aaaabxyzpqrrrabbxyyyypqAzz
- 0: aaaabxyzpqrrrabbxyyyypqAzz
- abcxyzpqrrrabbxyyyypqAzz
- 0: abcxyzpqrrrabbxyyyypqAzz
- aabcxyzpqrrrabbxyyyypqAzz
- 0: aabcxyzpqrrrabbxyyyypqAzz
- aaabcxyzpqrrrabbxyyyypAzz
- 0: aaabcxyzpqrrrabbxyyyypAzz
- aaabcxyzpqrrrabbxyyyypqAzz
- 0: aaabcxyzpqrrrabbxyyyypqAzz
- aaabcxyzpqrrrabbxyyyypqqAzz
- 0: aaabcxyzpqrrrabbxyyyypqqAzz
- aaabcxyzpqrrrabbxyyyypqqqAzz
- 0: aaabcxyzpqrrrabbxyyyypqqqAzz
- aaabcxyzpqrrrabbxyyyypqqqqAzz
- 0: aaabcxyzpqrrrabbxyyyypqqqqAzz
- aaabcxyzpqrrrabbxyyyypqqqqqAzz
- 0: aaabcxyzpqrrrabbxyyyypqqqqqAzz
- aaabcxyzpqrrrabbxyyyypqqqqqqAzz
- 0: aaabcxyzpqrrrabbxyyyypqqqqqqAzz
- aaaabcxyzpqrrrabbxyyyypqAzz
- 0: aaaabcxyzpqrrrabbxyyyypqAzz
- abxyzzpqrrrabbxyyyypqAzz
- 0: abxyzzpqrrrabbxyyyypqAzz
- aabxyzzzpqrrrabbxyyyypqAzz
- 0: aabxyzzzpqrrrabbxyyyypqAzz
- aaabxyzzzzpqrrrabbxyyyypqAzz
- 0: aaabxyzzzzpqrrrabbxyyyypqAzz
- aaaabxyzzzzpqrrrabbxyyyypqAzz
- 0: aaaabxyzzzzpqrrrabbxyyyypqAzz
- abcxyzzpqrrrabbxyyyypqAzz
- 0: abcxyzzpqrrrabbxyyyypqAzz
- aabcxyzzzpqrrrabbxyyyypqAzz
- 0: aabcxyzzzpqrrrabbxyyyypqAzz
- aaabcxyzzzzpqrrrabbxyyyypqAzz
- 0: aaabcxyzzzzpqrrrabbxyyyypqAzz
- aaaabcxyzzzzpqrrrabbxyyyypqAzz
- 0: aaaabcxyzzzzpqrrrabbxyyyypqAzz
- aaaabcxyzzzzpqrrrabbbxyyyypqAzz
- 0: aaaabcxyzzzzpqrrrabbbxyyyypqAzz
- aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
- 0: aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
- aaabcxyzpqrrrabbxyyyypABzz
- 0: aaabcxyzpqrrrabbxyyyypABzz
- aaabcxyzpqrrrabbxyyyypABBzz
- 0: aaabcxyzpqrrrabbxyyyypABBzz
- >>>aaabxyzpqrrrabbxyyyypqAzz
- 0: aaabxyzpqrrrabbxyyyypqAzz
- >aaaabxyzpqrrrabbxyyyypqAzz
- 0: aaaabxyzpqrrrabbxyyyypqAzz
- >>>>abcxyzpqrrrabbxyyyypqAzz
- 0: abcxyzpqrrrabbxyyyypqAzz
- *** Failers
-No match
- abxyzpqrrabbxyyyypqAzz
-No match
- abxyzpqrrrrabbxyyyypqAzz
-No match
- abxyzpqrrrabxyyyypqAzz
-No match
- aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
-No match
- aaaabcxyzzzzpqrrrabbbxyyypqAzz
-No match
- aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
-No match
-
-/^(abc){1,2}zz/
- abczz
- 0: abczz
- 1: abc
- abcabczz
- 0: abcabczz
- 1: abc
- *** Failers
-No match
- zz
-No match
- abcabcabczz
-No match
- >>abczz
-No match
-
-/^(b+?|a){1,2}?c/
- bc
- 0: bc
- 1: b
- bbc
- 0: bbc
- 1: b
- bbbc
- 0: bbbc
- 1: bb
- bac
- 0: bac
- 1: a
- bbac
- 0: bbac
- 1: a
- aac
- 0: aac
- 1: a
- abbbbbbbbbbbc
- 0: abbbbbbbbbbbc
- 1: bbbbbbbbbbb
- bbbbbbbbbbbac
- 0: bbbbbbbbbbbac
- 1: a
- *** Failers
-No match
- aaac
-No match
- abbbbbbbbbbbac
-No match
-
-/^(b+|a){1,2}c/
- bc
- 0: bc
- 1: b
- bbc
- 0: bbc
- 1: bb
- bbbc
- 0: bbbc
- 1: bbb
- bac
- 0: bac
- 1: a
- bbac
- 0: bbac
- 1: a
- aac
- 0: aac
- 1: a
- abbbbbbbbbbbc
- 0: abbbbbbbbbbbc
- 1: bbbbbbbbbbb
- bbbbbbbbbbbac
- 0: bbbbbbbbbbbac
- 1: a
- *** Failers
-No match
- aaac
-No match
- abbbbbbbbbbbac
-No match
-
-/^(b+|a){1,2}?bc/
- bbc
- 0: bbc
- 1: b
-
-/^(b*|ba){1,2}?bc/
- babc
- 0: babc
- 1: ba
- bbabc
- 0: bbabc
- 1: ba
- bababc
- 0: bababc
- 1: ba
- *** Failers
-No match
- bababbc
-No match
- babababc
-No match
-
-/^(ba|b*){1,2}?bc/
- babc
- 0: babc
- 1: ba
- bbabc
- 0: bbabc
- 1: ba
- bababc
- 0: bababc
- 1: ba
- *** Failers
-No match
- bababbc
-No match
- babababc
-No match
-
-/^\ca\cA\c[\c{\c:/
- \x01\x01\e;z
- 0: \x01\x01\x1b;z
-
-/^[ab\]cde]/
- athing
- 0: a
- bthing
- 0: b
- ]thing
- 0: ]
- cthing
- 0: c
- dthing
- 0: d
- ething
- 0: e
- *** Failers
-No match
- fthing
-No match
- [thing
-No match
- \\thing
-No match
-
-/^[]cde]/
- ]thing
- 0: ]
- cthing
- 0: c
- dthing
- 0: d
- ething
- 0: e
- *** Failers
-No match
- athing
-No match
- fthing
-No match
-
-/^[^ab\]cde]/
- fthing
- 0: f
- [thing
- 0: [
- \\thing
- 0: \
- *** Failers
- 0: *
- athing
-No match
- bthing
-No match
- ]thing
-No match
- cthing
-No match
- dthing
-No match
- ething
-No match
-
-/^[^]cde]/
- athing
- 0: a
- fthing
- 0: f
- *** Failers
- 0: *
- ]thing
-No match
- cthing
-No match
- dthing
-No match
- ething
-No match
-
-/^\/
-
- 0: \x81
-
-/^ÿ/
- ÿ
- 0: \xff
-
-/^[0-9]+$/
- 0
- 0: 0
- 1
- 0: 1
- 2
- 0: 2
- 3
- 0: 3
- 4
- 0: 4
- 5
- 0: 5
- 6
- 0: 6
- 7
- 0: 7
- 8
- 0: 8
- 9
- 0: 9
- 10
- 0: 10
- 100
- 0: 100
- *** Failers
-No match
- abc
-No match
-
-/^.*nter/
- enter
- 0: enter
- inter
- 0: inter
- uponter
- 0: uponter
-
-/^xxx[0-9]+$/
- xxx0
- 0: xxx0
- xxx1234
- 0: xxx1234
- *** Failers
-No match
- xxx
-No match
-
-/^.+[0-9][0-9][0-9]$/
- x123
- 0: x123
- xx123
- 0: xx123
- 123456
- 0: 123456
- *** Failers
-No match
- 123
-No match
- x1234
- 0: x1234
-
-/^.+?[0-9][0-9][0-9]$/
- x123
- 0: x123
- xx123
- 0: xx123
- 123456
- 0: 123456
- *** Failers
-No match
- 123
-No match
- x1234
- 0: x1234
-
-/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
- abc!pqr=apquxz.ixr.zzz.ac.uk
- 0: abc!pqr=apquxz.ixr.zzz.ac.uk
- 1: abc
- 2: pqr
- *** Failers
-No match
- !pqr=apquxz.ixr.zzz.ac.uk
-No match
- abc!=apquxz.ixr.zzz.ac.uk
-No match
- abc!pqr=apquxz:ixr.zzz.ac.uk
-No match
- abc!pqr=apquxz.ixr.zzz.ac.ukk
-No match
-
-/:/
- Well, we need a colon: somewhere
- 0: :
- *** Fail if we don't
-No match
-
-/([\da-f:]+)$/i
- 0abc
- 0: 0abc
- 1: 0abc
- abc
- 0: abc
- 1: abc
- fed
- 0: fed
- 1: fed
- E
- 0: E
- 1: E
- ::
- 0: ::
- 1: ::
- 5f03:12C0::932e
- 0: 5f03:12C0::932e
- 1: 5f03:12C0::932e
- fed def
- 0: def
- 1: def
- Any old stuff
- 0: ff
- 1: ff
- *** Failers
-No match
- 0zzz
-No match
- gzzz
-No match
- fed\x20
-No match
- Any old rubbish
-No match
-
-/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
- .1.2.3
- 0: .1.2.3
- 1: 1
- 2: 2
- 3: 3
- A.12.123.0
- 0: A.12.123.0
- 1: 12
- 2: 123
- 3: 0
- *** Failers
-No match
- .1.2.3333
-No match
- 1.2.3
-No match
- 1234.2.3
-No match
-
-/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
- 1 IN SOA non-sp1 non-sp2(
- 0: 1 IN SOA non-sp1 non-sp2(
- 1: 1
- 2: non-sp1
- 3: non-sp2
- 1 IN SOA non-sp1 non-sp2 (
- 0: 1 IN SOA non-sp1 non-sp2 (
- 1: 1
- 2: non-sp1
- 3: non-sp2
- *** Failers
-No match
- 1IN SOA non-sp1 non-sp2(
-No match
-
-/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
- a.
- 0: a.
- Z.
- 0: Z.
- 2.
- 0: 2.
- ab-c.pq-r.
- 0: ab-c.pq-r.
- 1: .pq-r
- sxk.zzz.ac.uk.
- 0: sxk.zzz.ac.uk.
- 1: .uk
- x-.y-.
- 0: x-.y-.
- 1: .y-
- *** Failers
-No match
- -abc.peq.
-No match
-
-/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
- *.a
- 0: *.a
- *.b0-a
- 0: *.b0-a
- 1: 0-a
- *.c3-b.c
- 0: *.c3-b.c
- 1: 3-b
- 2: .c
- *.c-a.b-c
- 0: *.c-a.b-c
- 1: -a
- 2: .b-c
- 3: -c
- *** Failers
-No match
- *.0
-No match
- *.a-
-No match
- *.a-b.c-
-No match
- *.c-a.0-c
-No match
-
-/^(?=ab(de))(abd)(e)/
- abde
- 0: abde
- 1: de
- 2: abd
- 3: e
-
-/^(?!(ab)de|x)(abd)(f)/
- abdf
- 0: abdf
- 1: <unset>
- 2: abd
- 3: f
-
-/^(?=(ab(cd)))(ab)/
- abcd
- 0: ab
- 1: abcd
- 2: cd
- 3: ab
-
-/^[\da-f](\.[\da-f])*$/i
- a.b.c.d
- 0: a.b.c.d
- 1: .d
- A.B.C.D
- 0: A.B.C.D
- 1: .D
- a.b.c.1.2.3.C
- 0: a.b.c.1.2.3.C
- 1: .C
-
-/^\".*\"\s*(;.*)?$/
- \"1234\"
- 0: "1234"
- \"abcd\" ;
- 0: "abcd" ;
- 1: ;
- \"\" ; rhubarb
- 0: "" ; rhubarb
- 1: ; rhubarb
- *** Failers
-No match
- \"1234\" : things
-No match
-
-/^$/
- \
- 0:
- *** Failers
-No match
-
-/ ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/x
- ab c
- 0: ab c
- *** Failers
-No match
- abc
-No match
- ab cde
-No match
-
-/(?x) ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/
- ab c
- 0: ab c
- *** Failers
-No match
- abc
-No match
- ab cde
-No match
-
-/^ a\ b[c ]d $/x
- a bcd
- 0: a bcd
- a b d
- 0: a b d
- *** Failers
-No match
- abcd
-No match
- ab d
-No match
-
-/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
- abcdefhijklm
- 0: abcdefhijklm
- 1: abc
- 2: bc
- 3: c
- 4: def
- 5: ef
- 6: f
- 7: hij
- 8: ij
- 9: j
-10: klm
-11: lm
-12: m
-
-/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
- abcdefhijklm
- 0: abcdefhijklm
- 1: bc
- 2: c
- 3: ef
- 4: f
- 5: ij
- 6: j
- 7: lm
- 8: m
-
-/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
- a+ Z0+\x08\n\x1d\x12
- 0: a+ Z0+\x08\x0a\x1d\x12
-
-/^[.^$|()*+?{,}]+/
- .^\$(*+)|{?,?}
- 0: .^$(*+)|{?,?}
-
-/^a*\w/
- z
- 0: z
- az
- 0: az
- aaaz
- 0: aaaz
- a
- 0: a
- aa
- 0: aa
- aaaa
- 0: aaaa
- a+
- 0: a
- aa+
- 0: aa
-
-/^a*?\w/
- z
- 0: z
- az
- 0: a
- aaaz
- 0: a
- a
- 0: a
- aa
- 0: a
- aaaa
- 0: a
- a+
- 0: a
- aa+
- 0: a
-
-/^a+\w/
- az
- 0: az
- aaaz
- 0: aaaz
- aa
- 0: aa
- aaaa
- 0: aaaa
- aa+
- 0: aa
-
-/^a+?\w/
- az
- 0: az
- aaaz
- 0: aa
- aa
- 0: aa
- aaaa
- 0: aa
- aa+
- 0: aa
-
-/^\d{8}\w{2,}/
- 1234567890
- 0: 1234567890
- 12345678ab
- 0: 12345678ab
- 12345678__
- 0: 12345678__
- *** Failers
-No match
- 1234567
-No match
-
-/^[aeiou\d]{4,5}$/
- uoie
- 0: uoie
- 1234
- 0: 1234
- 12345
- 0: 12345
- aaaaa
- 0: aaaaa
- *** Failers
-No match
- 123456
-No match
-
-/^[aeiou\d]{4,5}?/
- uoie
- 0: uoie
- 1234
- 0: 1234
- 12345
- 0: 1234
- aaaaa
- 0: aaaa
- 123456
- 0: 1234
-
-/\A(abc|def)=(\1){2,3}\Z/
- abc=abcabc
- 0: abc=abcabc
- 1: abc
- 2: abc
- def=defdefdef
- 0: def=defdefdef
- 1: def
- 2: def
- *** Failers
-No match
- abc=defdef
-No match
-
-/^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/
- abcdefghijkcda2
- 0: abcdefghijkcda2
- 1: a
- 2: b
- 3: c
- 4: d
- 5: e
- 6: f
- 7: g
- 8: h
- 9: i
-10: j
-11: k
-12: cd
- abcdefghijkkkkcda2
- 0: abcdefghijkkkkcda2
- 1: a
- 2: b
- 3: c
- 4: d
- 5: e
- 6: f
- 7: g
- 8: h
- 9: i
-10: j
-11: k
-12: cd
-
-/(cat(a(ract|tonic)|erpillar)) \1()2(3)/
- cataract cataract23
- 0: cataract cataract23
- 1: cataract
- 2: aract
- 3: ract
- 4:
- 5: 3
- catatonic catatonic23
- 0: catatonic catatonic23
- 1: catatonic
- 2: atonic
- 3: tonic
- 4:
- 5: 3
- caterpillar caterpillar23
- 0: caterpillar caterpillar23
- 1: caterpillar
- 2: erpillar
- 3: <unset>
- 4:
- 5: 3
-
-
-/^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/
- From abcd Mon Sep 01 12:33:02 1997
- 0: From abcd Mon Sep 01 12:33
- 1: abcd
-
-/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
- From abcd Mon Sep 01 12:33:02 1997
- 0: From abcd Mon Sep 01 12:33
- 1: Sep
- From abcd Mon Sep 1 12:33:02 1997
- 0: From abcd Mon Sep 1 12:33
- 1: Sep
- *** Failers
-No match
- From abcd Sep 01 12:33:02 1997
-No match
-
-/^12.34/s
- 12\n34
- 0: 12\x0a34
- 12\r34
- 0: 12\x0d34
-
-/\w+(?=\t)/
- the quick brown\t fox
- 0: brown
-
-/foo(?!bar)(.*)/
- foobar is foolish see?
- 0: foolish see?
- 1: lish see?
-
-/(?:(?!foo)...|^.{0,2})bar(.*)/
- foobar crowbar etc
- 0: rowbar etc
- 1: etc
- barrel
- 0: barrel
- 1: rel
- 2barrel
- 0: 2barrel
- 1: rel
- A barrel
- 0: A barrel
- 1: rel
-
-/^(\D*)(?=\d)(?!123)/
- abc456
- 0: abc
- 1: abc
- *** Failers
-No match
- abc123
-No match
-
-/^1234(?# test newlines
- inside)/
- 1234
- 0: 1234
-
-/^1234 #comment in extended re
- /x
- 1234
- 0: 1234
-
-/#rhubarb
- abcd/x
- abcd
- 0: abcd
-
-/^abcd#rhubarb/x
- abcd
- 0: abcd
-
-/^(a)\1{2,3}(.)/
- aaab
- 0: aaab
- 1: a
- 2: b
- aaaab
- 0: aaaab
- 1: a
- 2: b
- aaaaab
- 0: aaaaa
- 1: a
- 2: a
- aaaaaab
- 0: aaaaa
- 1: a
- 2: a
-
-/(?!^)abc/
- the abc
- 0: abc
- *** Failers
-No match
- abc
-No match
-
-/(?=^)abc/
- abc
- 0: abc
- *** Failers
-No match
- the abc
-No match
-
-/^[ab]{1,3}(ab*|b)/
- aabbbbb
- 0: aabb
- 1: b
-
-/^[ab]{1,3}?(ab*|b)/
- aabbbbb
- 0: aabbbbb
- 1: abbbbb
-
-/^[ab]{1,3}?(ab*?|b)/
- aabbbbb
- 0: aa
- 1: a
-
-/^[ab]{1,3}(ab*?|b)/
- aabbbbb
- 0: aabb
- 1: b
-
-/ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* # optional leading comment
-(?: (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) # initial word
-(?: (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) )* # further okay, if led by a period
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-# address
-| # or
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) # one word, optionally followed by....
-(?:
-[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or...
-\(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) | # comments, or...
-
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-# quoted strings
-)*
-< (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* # leading <
-(?: @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-
-(?: (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* , (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-)* # further okay, if led by comma
-: # closing colon
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* )? # optional route
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) # initial word
-(?: (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) )* # further okay, if led by a period
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-# address spec
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* > # trailing >
-# name and address
-) (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* # optional trailing comment
-/x
- Alan Other <user\@dom.ain>
- 0: Alan Other <user@dom.ain>
- <user\@dom.ain>
- 0: user@dom.ain
- user\@dom.ain
- 0: user@dom.ain
- \"A. Other\" <user.1234\@dom.ain> (a comment)
- 0: "A. Other" <user.1234@dom.ain> (a comment)
- A. Other <user.1234\@dom.ain> (a comment)
- 0: Other <user.1234@dom.ain> (a comment)
- \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
- 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
- A missing angle <user\@some.where
- 0: user@some.where
- *** Failers
-No match
- The quick brown fox
-No match
-
-/[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional leading comment
-(?:
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# additional words
-)*
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-# address
-| # or
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-# leading word
-[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # "normal" atoms and or spaces
-(?:
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-|
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-) # "special" comment or quoted string
-[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # more "normal"
-)*
-<
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# <
-(?:
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-(?: ,
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-)* # additional domains
-:
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)? # optional route
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# additional words
-)*
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-# address spec
-> # >
-# name and address
-)
-/x
- Alan Other <user\@dom.ain>
- 0: Alan Other <user@dom.ain>
- <user\@dom.ain>
- 0: user@dom.ain
- user\@dom.ain
- 0: user@dom.ain
- \"A. Other\" <user.1234\@dom.ain> (a comment)
- 0: "A. Other" <user.1234@dom.ain>
- A. Other <user.1234\@dom.ain> (a comment)
- 0: Other <user.1234@dom.ain>
- \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
- 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
- A missing angle <user\@some.where
- 0: user@some.where
- *** Failers
-No match
- The quick brown fox
-No match
-
-/abc\0def\00pqr\000xyz\0000AB/
- abc\0def\00pqr\000xyz\0000AB
- 0: abc\x00def\x00pqr\x00xyz\x000AB
- abc456 abc\0def\00pqr\000xyz\0000ABCDE
- 0: abc\x00def\x00pqr\x00xyz\x000AB
-
-/abc\x0def\x00pqr\x000xyz\x0000AB/
- abc\x0def\x00pqr\x000xyz\x0000AB
- 0: abc\x0def\x00pqr\x000xyz\x0000AB
- abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
- 0: abc\x0def\x00pqr\x000xyz\x0000AB
-
-/^[\000-\037]/
- \0A
- 0: \x00
- \01B
- 0: \x01
- \037C
- 0: \x1f
-
-/\0*/
- \0\0\0\0
- 0: \x00\x00\x00\x00
-
-/A\x0{2,3}Z/
- The A\x0\x0Z
- 0: A\x00\x00Z
- An A\0\x0\0Z
- 0: A\x00\x00\x00Z
- *** Failers
-No match
- A\0Z
-No match
- A\0\x0\0\x0Z
-No match
-
-/^(cow|)\1(bell)/
- cowcowbell
- 0: cowcowbell
- 1: cow
- 2: bell
- bell
- 0: bell
- 1:
- 2: bell
- *** Failers
-No match
- cowbell
-No match
-
-/^\s/
- \040abc
- 0:
- \x0cabc
- 0: \x0c
- \nabc
- 0: \x0a
- \rabc
- 0: \x0d
- \tabc
- 0: \x09
- *** Failers
-No match
- abc
-No match
-
-/^a b
-
- c/x
- abc
- 0: abc
-
-/^(a|)\1*b/
- ab
- 0: ab
- 1: a
- aaaab
- 0: aaaab
- 1: a
- b
- 0: b
- 1:
- *** Failers
-No match
- acb
-No match
-
-/^(a|)\1+b/
- aab
- 0: aab
- 1: a
- aaaab
- 0: aaaab
- 1: a
- b
- 0: b
- 1:
- *** Failers
-No match
- ab
-No match
-
-/^(a|)\1?b/
- ab
- 0: ab
- 1: a
- aab
- 0: aab
- 1: a
- b
- 0: b
- 1:
- *** Failers
-No match
- acb
-No match
-
-/^(a|)\1{2}b/
- aaab
- 0: aaab
- 1: a
- b
- 0: b
- 1:
- *** Failers
-No match
- ab
-No match
- aab
-No match
- aaaab
-No match
-
-/^(a|)\1{2,3}b/
- aaab
- 0: aaab
- 1: a
- aaaab
- 0: aaaab
- 1: a
- b
- 0: b
- 1:
- *** Failers
-No match
- ab
-No match
- aab
-No match
- aaaaab
-No match
-
-/ab{1,3}bc/
- abbbbc
- 0: abbbbc
- abbbc
- 0: abbbc
- abbc
- 0: abbc
- *** Failers
-No match
- abc
-No match
- abbbbbc
-No match
-
-/([^.]*)\.([^:]*):[T ]+(.*)/
- track1.title:TBlah blah blah
- 0: track1.title:TBlah blah blah
- 1: track1
- 2: title
- 3: Blah blah blah
-
-/([^.]*)\.([^:]*):[T ]+(.*)/i
- track1.title:TBlah blah blah
- 0: track1.title:TBlah blah blah
- 1: track1
- 2: title
- 3: Blah blah blah
-
-/([^.]*)\.([^:]*):[t ]+(.*)/i
- track1.title:TBlah blah blah
- 0: track1.title:TBlah blah blah
- 1: track1
- 2: title
- 3: Blah blah blah
-
-/^[W-c]+$/
- WXY_^abc
- 0: WXY_^abc
- ***Failers
-No match
- wxy
-No match
-
-/^[W-c]+$/i
- WXY_^abc
- 0: WXY_^abc
- wxy_^ABC
- 0: wxy_^ABC
-
-/^[\x3f-\x5F]+$/i
- WXY_^abc
- 0: WXY_^abc
- wxy_^ABC
- 0: wxy_^ABC
-
-/^abc$/m
- abc
- 0: abc
- qqq\nabc
- 0: abc
- abc\nzzz
- 0: abc
- qqq\nabc\nzzz
- 0: abc
-
-/^abc$/
- abc
- 0: abc
- *** Failers
-No match
- qqq\nabc
-No match
- abc\nzzz
-No match
- qqq\nabc\nzzz
-No match
-
-/\Aabc\Z/m
- abc
- 0: abc
- abc\n
- 0: abc
- *** Failers
-No match
- qqq\nabc
-No match
- abc\nzzz
-No match
- qqq\nabc\nzzz
-No match
-
-/\A(.)*\Z/s
- abc\ndef
- 0: abc\x0adef
- 1: f
-
-/\A(.)*\Z/m
- *** Failers
- 0: *** Failers
- 1: s
- abc\ndef
-No match
-
-/(?:b)|(?::+)/
- b::c
- 0: b
- c::b
- 0: ::
-
-/[-az]+/
- az-
- 0: az-
- *** Failers
- 0: a
- b
-No match
-
-/[az-]+/
- za-
- 0: za-
- *** Failers
- 0: a
- b
-No match
-
-/[a\-z]+/
- a-z
- 0: a-z
- *** Failers
- 0: a
- b
-No match
-
-/[a-z]+/
- abcdxyz
- 0: abcdxyz
-
-/[\d-]+/
- 12-34
- 0: 12-34
- *** Failers
-No match
- aaa
-No match
-
-/[\d-z]+/
- 12-34z
- 0: 12-34z
- *** Failers
-No match
- aaa
-No match
-
-/\x5c/
- \\
- 0: \
-
-/\x20Z/
- the Zoo
- 0: Z
- *** Failers
-No match
- Zulu
-No match
-
-/(abc)\1/i
- abcabc
- 0: abcabc
- 1: abc
- ABCabc
- 0: ABCabc
- 1: ABC
- abcABC
- 0: abcABC
- 1: abc
-
-/ab{3cd/
- ab{3cd
- 0: ab{3cd
-
-/ab{3,cd/
- ab{3,cd
- 0: ab{3,cd
-
-/ab{3,4a}cd/
- ab{3,4a}cd
- 0: ab{3,4a}cd
-
-/{4,5a}bc/
- {4,5a}bc
- 0: {4,5a}bc
-
-/^a.b/
- a\rb
- 0: a\x0db
- *** Failers
-No match
- a\nb
-No match
-
-/abc$/
- abc
- 0: abc
- abc\n
- 0: abc
- *** Failers
-No match
- abc\ndef
-No match
-
-/(abc)\123/
- abc\x53
- 0: abcS
- 1: abc
-
-/(abc)\223/
- abc\x93
- 0: abc\x93
- 1: abc
-
-/(abc)\323/
- abc\xd3
- 0: abc\xd3
- 1: abc
-
-/(abc)\500/
- abc\x40
- 0: abc@
- 1: abc
- abc\100
- 0: abc@
- 1: abc
-
-/(abc)\5000/
- abc\x400
- 0: abc@0
- 1: abc
- abc\x40\x30
- 0: abc@0
- 1: abc
- abc\1000
- 0: abc@0
- 1: abc
- abc\100\x30
- 0: abc@0
- 1: abc
- abc\100\060
- 0: abc@0
- 1: abc
- abc\100\60
- 0: abc@0
- 1: abc
-
-/abc\81/
- abc\081
- 0: abc\x0081
- abc\0\x38\x31
- 0: abc\x0081
-
-/abc\91/
- abc\091
- 0: abc\x0091
- abc\0\x39\x31
- 0: abc\x0091
-
-/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/
- abcdefghijkllS
- 0: abcdefghijkllS
- 1: a
- 2: b
- 3: c
- 4: d
- 5: e
- 6: f
- 7: g
- 8: h
- 9: i
-10: j
-11: k
-12: l
-
-/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
- abcdefghijk\12S
- 0: abcdefghijk\x0aS
- 1: a
- 2: b
- 3: c
- 4: d
- 5: e
- 6: f
- 7: g
- 8: h
- 9: i
-10: j
-11: k
-
-/ab\gdef/
- abgdef
- 0: abgdef
-
-/a{0}bc/
- bc
- 0: bc
-
-/(a|(bc)){0,0}?xyz/
- xyz
- 0: xyz
-
-/abc[\10]de/
- abc\010de
- 0: abc\x08de
-
-/abc[\1]de/
- abc\1de
- 0: abc\x01de
-
-/(abc)[\1]de/
- abc\1de
- 0: abc\x01de
- 1: abc
-
-/(?s)a.b/
- a\nb
- 0: a\x0ab
-
-/^([^a])([^\b])([^c]*)([^d]{3,4})/
- baNOTccccd
- 0: baNOTcccc
- 1: b
- 2: a
- 3: NOT
- 4: cccc
- baNOTcccd
- 0: baNOTccc
- 1: b
- 2: a
- 3: NOT
- 4: ccc
- baNOTccd
- 0: baNOTcc
- 1: b
- 2: a
- 3: NO
- 4: Tcc
- bacccd
- 0: baccc
- 1: b
- 2: a
- 3:
- 4: ccc
- *** Failers
- 0: *** Failers
- 1: *
- 2: *
- 3: * Fail
- 4: ers
- anything
-No match
- b\bc
-No match
- baccd
-No match
-
-/[^a]/
- Abc
- 0: A
-
-/[^a]/i
- Abc
- 0: b
-
-/[^a]+/
- AAAaAbc
- 0: AAA
-
-/[^a]+/i
- AAAaAbc
- 0: bc
-
-/[^a]+/
- bbb\nccc
- 0: bbb\x0accc
-
-/[^k]$/
- abc
- 0: c
- *** Failers
- 0: s
- abk
-No match
-
-/[^k]{2,3}$/
- abc
- 0: abc
- kbc
- 0: bc
- kabc
- 0: abc
- *** Failers
- 0: ers
- abk
-No match
- akb
-No match
- akk
-No match
-
-/^\d{8,}\@.+[^k]$/
- 12345678\@a.b.c.d
- 0: 12345678@a.b.c.d
- 123456789\@x.y.z
- 0: 123456789@x.y.z
- *** Failers
-No match
- 12345678\@x.y.uk
-No match
- 1234567\@a.b.c.d
-No match
-
-/(a)\1{8,}/
- aaaaaaaaa
- 0: aaaaaaaaa
- 1: a
- aaaaaaaaaa
- 0: aaaaaaaaaa
- 1: a
- *** Failers
-No match
- aaaaaaa
-No match
-
-/[^a]/
- aaaabcd
- 0: b
- aaAabcd
- 0: A
-
-/[^a]/i
- aaaabcd
- 0: b
- aaAabcd
- 0: b
-
-/[^az]/
- aaaabcd
- 0: b
- aaAabcd
- 0: A
-
-/[^az]/i
- aaaabcd
- 0: b
- aaAabcd
- 0: b
-
-/\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377/
- \000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377
- 0: \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff
-
-/P[^*]TAIRE[^*]{1,6}?LL/
- xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
- 0: PSTAIREISLL
-
-/P[^*]TAIRE[^*]{1,}?LL/
- xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
- 0: PSTAIREISLL
-
-/(\.\d\d[1-9]?)\d+/
- 1.230003938
- 0: .230003938
- 1: .23
- 1.875000282
- 0: .875000282
- 1: .875
- 1.235
- 0: .235
- 1: .23
-
-/(\.\d\d((?=0)|\d(?=\d)))/
- 1.230003938
- 0: .23
- 1: .23
- 2:
- 1.875000282
- 0: .875
- 1: .875
- 2: 5
- *** Failers
-No match
- 1.235
-No match
-
-/a(?)b/
- ab
- 0: ab
-
-/\b(foo)\s+(\w+)/i
- Food is on the foo table
- 0: foo table
- 1: foo
- 2: table
-
-/foo(.*)bar/
- The food is under the bar in the barn.
- 0: food is under the bar in the bar
- 1: d is under the bar in the
-
-/foo(.*?)bar/
- The food is under the bar in the barn.
- 0: food is under the bar
- 1: d is under the
-
-/(.*)(\d*)/
- I have 2 numbers: 53147
- 0: I have 2 numbers: 53147
- 1: I have 2 numbers: 53147
- 2:
-
-/(.*)(\d+)/
- I have 2 numbers: 53147
- 0: I have 2 numbers: 53147
- 1: I have 2 numbers: 5314
- 2: 7
-
-/(.*?)(\d*)/
- I have 2 numbers: 53147
- 0:
- 1:
- 2:
-
-/(.*?)(\d+)/
- I have 2 numbers: 53147
- 0: I have 2
- 1: I have
- 2: 2
-
-/(.*)(\d+)$/
- I have 2 numbers: 53147
- 0: I have 2 numbers: 53147
- 1: I have 2 numbers: 5314
- 2: 7
-
-/(.*?)(\d+)$/
- I have 2 numbers: 53147
- 0: I have 2 numbers: 53147
- 1: I have 2 numbers:
- 2: 53147
-
-/(.*)\b(\d+)$/
- I have 2 numbers: 53147
- 0: I have 2 numbers: 53147
- 1: I have 2 numbers:
- 2: 53147
-
-/(.*\D)(\d+)$/
- I have 2 numbers: 53147
- 0: I have 2 numbers: 53147
- 1: I have 2 numbers:
- 2: 53147
-
-/^\D*(?!123)/
- ABC123
- 0: AB
-
-/^(\D*)(?=\d)(?!123)/
- ABC445
- 0: ABC
- 1: ABC
- *** Failers
-No match
- ABC123
-No match
-
-/^[W-]46]/
- W46]789
- 0: W46]
- -46]789
- 0: -46]
- *** Failers
-No match
- Wall
-No match
- Zebra
-No match
- 42
-No match
- [abcd]
-No match
- ]abcd[
-No match
-
-/^[W-\]46]/
- W46]789
- 0: W
- Wall
- 0: W
- Zebra
- 0: Z
- Xylophone
- 0: X
- 42
- 0: 4
- [abcd]
- 0: [
- ]abcd[
- 0: ]
- \\backslash
- 0: \
- *** Failers
-No match
- -46]789
-No match
- well
-No match
-
-/\d\d\/\d\d\/\d\d\d\d/
- 01/01/2000
- 0: 01/01/2000
-
-/word (?:[a-zA-Z0-9]+ ){0,10}otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark otherword
- 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
- word cat dog elephant mussel cow horse canary baboon snake shark
-No match
-
-/word (?:[a-zA-Z0-9]+ ){0,300}otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
-No match
-
-/^(a){0,0}/
- bcd
- 0:
- abc
- 0:
- aab
- 0:
-
-/^(a){0,1}/
- bcd
- 0:
- abc
- 0: a
- 1: a
- aab
- 0: a
- 1: a
-
-/^(a){0,2}/
- bcd
- 0:
- abc
- 0: a
- 1: a
- aab
- 0: aa
- 1: a
-
-/^(a){0,3}/
- bcd
- 0:
- abc
- 0: a
- 1: a
- aab
- 0: aa
- 1: a
- aaa
- 0: aaa
- 1: a
-
-/^(a){0,}/
- bcd
- 0:
- abc
- 0: a
- 1: a
- aab
- 0: aa
- 1: a
- aaa
- 0: aaa
- 1: a
- aaaaaaaa
- 0: aaaaaaaa
- 1: a
-
-/^(a){1,1}/
- bcd
-No match
- abc
- 0: a
- 1: a
- aab
- 0: a
- 1: a
-
-/^(a){1,2}/
- bcd
-No match
- abc
- 0: a
- 1: a
- aab
- 0: aa
- 1: a
-
-/^(a){1,3}/
- bcd
-No match
- abc
- 0: a
- 1: a
- aab
- 0: aa
- 1: a
- aaa
- 0: aaa
- 1: a
-
-/^(a){1,}/
- bcd
-No match
- abc
- 0: a
- 1: a
- aab
- 0: aa
- 1: a
- aaa
- 0: aaa
- 1: a
- aaaaaaaa
- 0: aaaaaaaa
- 1: a
-
-/.*\.gif/
- borfle\nbib.gif\nno
- 0: bib.gif
-
-/.{0,}\.gif/
- borfle\nbib.gif\nno
- 0: bib.gif
-
-/.*\.gif/m
- borfle\nbib.gif\nno
- 0: bib.gif
-
-/.*\.gif/s
- borfle\nbib.gif\nno
- 0: borfle\x0abib.gif
-
-/.*\.gif/ms
- borfle\nbib.gif\nno
- 0: borfle\x0abib.gif
-
-/.*$/
- borfle\nbib.gif\nno
- 0: no
-
-/.*$/m
- borfle\nbib.gif\nno
- 0: borfle
-
-/.*$/s
- borfle\nbib.gif\nno
- 0: borfle\x0abib.gif\x0ano
-
-/.*$/ms
- borfle\nbib.gif\nno
- 0: borfle\x0abib.gif\x0ano
-
-/.*$/
- borfle\nbib.gif\nno\n
- 0: no
-
-/.*$/m
- borfle\nbib.gif\nno\n
- 0: borfle
-
-/.*$/s
- borfle\nbib.gif\nno\n
- 0: borfle\x0abib.gif\x0ano\x0a
-
-/.*$/ms
- borfle\nbib.gif\nno\n
- 0: borfle\x0abib.gif\x0ano\x0a
-
-/(.*X|^B)/
- abcde\n1234Xyz
- 0: 1234X
- 1: 1234X
- BarFoo
- 0: B
- 1: B
- *** Failers
-No match
- abcde\nBar
-No match
-
-/(.*X|^B)/m
- abcde\n1234Xyz
- 0: 1234X
- 1: 1234X
- BarFoo
- 0: B
- 1: B
- abcde\nBar
- 0: B
- 1: B
-
-/(.*X|^B)/s
- abcde\n1234Xyz
- 0: abcde\x0a1234X
- 1: abcde\x0a1234X
- BarFoo
- 0: B
- 1: B
- *** Failers
-No match
- abcde\nBar
-No match
-
-/(.*X|^B)/ms
- abcde\n1234Xyz
- 0: abcde\x0a1234X
- 1: abcde\x0a1234X
- BarFoo
- 0: B
- 1: B
- abcde\nBar
- 0: B
- 1: B
-
-/(?s)(.*X|^B)/
- abcde\n1234Xyz
- 0: abcde\x0a1234X
- 1: abcde\x0a1234X
- BarFoo
- 0: B
- 1: B
- *** Failers
-No match
- abcde\nBar
-No match
-
-/(?s:.*X|^B)/
- abcde\n1234Xyz
- 0: abcde\x0a1234X
- BarFoo
- 0: B
- *** Failers
-No match
- abcde\nBar
-No match
-
-/^.*B/
- **** Failers
-No match
- abc\nB
-No match
-
-/(?s)^.*B/
- abc\nB
- 0: abc\x0aB
-
-/(?m)^.*B/
- abc\nB
- 0: B
-
-/(?ms)^.*B/
- abc\nB
- 0: abc\x0aB
-
-/(?ms)^B/
- abc\nB
- 0: B
-
-/(?s)B$/
- B\n
- 0: B
-
-/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
- 123456654321
- 0: 123456654321
-
-/^\d\d\d\d\d\d\d\d\d\d\d\d/
- 123456654321
- 0: 123456654321
-
-/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
- 123456654321
- 0: 123456654321
-
-/^[abc]{12}/
- abcabcabcabc
- 0: abcabcabcabc
-
-/^[a-c]{12}/
- abcabcabcabc
- 0: abcabcabcabc
-
-/^(a|b|c){12}/
- abcabcabcabc
- 0: abcabcabcabc
- 1: c
-
-/^[abcdefghijklmnopqrstuvwxy0123456789]/
- n
- 0: n
- *** Failers
-No match
- z
-No match
-
-/abcde{0,0}/
- abcd
- 0: abcd
- *** Failers
-No match
- abce
-No match
-
-/ab[cd]{0,0}e/
- abe
- 0: abe
- *** Failers
-No match
- abcde
-No match
-
-/ab(c){0,0}d/
- abd
- 0: abd
- *** Failers
-No match
- abcd
-No match
-
-/a(b*)/
- a
- 0: a
- 1:
- ab
- 0: ab
- 1: b
- abbbb
- 0: abbbb
- 1: bbbb
- *** Failers
- 0: a
- 1:
- bbbbb
-No match
-
-/ab\d{0}e/
- abe
- 0: abe
- *** Failers
-No match
- ab1e
-No match
-
-/"([^\\"]+|\\.)*"/
- the \"quick\" brown fox
- 0: "quick"
- 1: quick
- \"the \\\"quick\\\" brown fox\"
- 0: "the \"quick\" brown fox"
- 1: brown fox
-
-/.*?/g+
- abc
- 0:
- 0+ abc
- 0: a
- 0+ bc
- 0:
- 0+ bc
- 0: b
- 0+ c
- 0:
- 0+ c
- 0: c
- 0+
- 0:
- 0+
-
-/\b/g+
- abc
- 0:
- 0+ abc
- 0:
- 0+
-
-/\b/+g
- abc
- 0:
- 0+ abc
- 0:
- 0+
-
-//g
- abc
- 0:
- 0:
- 0:
- 0:
-
-/<tr([\w\W\s\d][^<>]{0,})><TD([\w\W\s\d][^<>]{0,})>([\d]{0,}\.)(.*)((<BR>([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/is
- <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
- 0: <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
- 1: BGCOLOR='#DBE9E9'
- 2: align=left valign=top
- 3: 43.
- 4: <a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)
- 5:
- 6:
- 7: <unset>
- 8: align=left valign=top
- 9: Lega lstaff.com
-10: align=left valign=top
-11: CA - Statewide
-
-/a[^a]b/
- acb
- 0: acb
- a\nb
- 0: a\x0ab
-
-/a.b/
- acb
- 0: acb
- *** Failers
-No match
- a\nb
-No match
-
-/a[^a]b/s
- acb
- 0: acb
- a\nb
- 0: a\x0ab
-
-/a.b/s
- acb
- 0: acb
- a\nb
- 0: a\x0ab
-
-/^(b+?|a){1,2}?c/
- bac
- 0: bac
- 1: a
- bbac
- 0: bbac
- 1: a
- bbbac
- 0: bbbac
- 1: a
- bbbbac
- 0: bbbbac
- 1: a
- bbbbbac
- 0: bbbbbac
- 1: a
-
-/^(b+|a){1,2}?c/
- bac
- 0: bac
- 1: a
- bbac
- 0: bbac
- 1: a
- bbbac
- 0: bbbac
- 1: a
- bbbbac
- 0: bbbbac
- 1: a
- bbbbbac
- 0: bbbbbac
- 1: a
-
-/(?!\A)x/m
- x\nb\n
-No match
- a\bx\n
- 0: x
-
-/\x0{ab}/
- \0{ab}
- 0: \x00{ab}
-
-/(A|B)*?CD/
- CD
- 0: CD
-
-/(A|B)*CD/
- CD
- 0: CD
-
-/(AB)*?\1/
- ABABAB
- 0: ABAB
- 1: AB
-
-/(AB)*\1/
- ABABAB
- 0: ABABAB
- 1: AB
-
-/(?<!bar)foo/
- foo
- 0: foo
- catfood
- 0: foo
- arfootle
- 0: foo
- rfoosh
- 0: foo
- *** Failers
-No match
- barfoo
-No match
- towbarfoo
-No match
-
-/\w{3}(?<!bar)foo/
- catfood
- 0: catfoo
- *** Failers
-No match
- foo
-No match
- barfoo
-No match
- towbarfoo
-No match
-
-/(?<=(foo)a)bar/
- fooabar
- 0: bar
- 1: foo
- *** Failers
-No match
- bar
-No match
- foobbar
-No match
-
-/\Aabc\z/m
- abc
- 0: abc
- *** Failers
-No match
- abc\n
-No match
- qqq\nabc
-No match
- abc\nzzz
-No match
- qqq\nabc\nzzz
-No match
-
-"(?>.*/)foo"
- /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
-No match
-
-"(?>.*/)foo"
- /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
- 0: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
-
-/(?>(\.\d\d[1-9]?))\d+/
- 1.230003938
- 0: .230003938
- 1: .23
- 1.875000282
- 0: .875000282
- 1: .875
- *** Failers
-No match
- 1.235
-No match
-
-/^((?>\w+)|(?>\s+))*$/
- now is the time for all good men to come to the aid of the party
- 0: now is the time for all good men to come to the aid of the party
- 1: party
- *** Failers
-No match
- this is not a line with only words and spaces!
-No match
-
-/(\d+)(\w)/
- 12345a
- 0: 12345a
- 1: 12345
- 2: a
- 12345+
- 0: 12345
- 1: 1234
- 2: 5
-
-/((?>\d+))(\w)/
- 12345a
- 0: 12345a
- 1: 12345
- 2: a
- *** Failers
-No match
- 12345+
-No match
-
-/(?>a+)b/
- aaab
- 0: aaab
-
-/((?>a+)b)/
- aaab
- 0: aaab
- 1: aaab
-
-/(?>(a+))b/
- aaab
- 0: aaab
- 1: aaa
-
-/(?>b)+/
- aaabbbccc
- 0: bbb
-
-/(?>a+|b+|c+)*c/
- aaabbbbccccd
- 0: aaabbbbc
-
-/((?>[^()]+)|\([^()]*\))+/
- ((abc(ade)ufh()()x
- 0: abc(ade)ufh()()x
- 1: x
-
-/\(((?>[^()]+)|\([^()]+\))+\)/
- (abc)
- 0: (abc)
- 1: abc
- (abc(def)xyz)
- 0: (abc(def)xyz)
- 1: xyz
- *** Failers
-No match
- ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-No match
-
-/a(?-i)b/i
- ab
- 0: ab
- Ab
- 0: Ab
- *** Failers
-No match
- aB
-No match
- AB
-No match
-
-/(a (?x)b c)d e/
- a bcd e
- 0: a bcd e
- 1: a bc
- *** Failers
-No match
- a b cd e
-No match
- abcd e
-No match
- a bcde
-No match
-
-/(a b(?x)c d (?-x)e f)/
- a bcde f
- 0: a bcde f
- 1: a bcde f
- *** Failers
-No match
- abcdef
-No match
-
-/(a(?i)b)c/
- abc
- 0: abc
- 1: ab
- aBc
- 0: aBc
- 1: aB
- *** Failers
-No match
- abC
-No match
- aBC
-No match
- Abc
-No match
- ABc
-No match
- ABC
-No match
- AbC
-No match
-
-/a(?i:b)c/
- abc
- 0: abc
- aBc
- 0: aBc
- *** Failers
-No match
- ABC
-No match
- abC
-No match
- aBC
-No match
-
-/a(?i:b)*c/
- aBc
- 0: aBc
- aBBc
- 0: aBBc
- *** Failers
-No match
- aBC
-No match
- aBBC
-No match
-
-/a(?=b(?i)c)\w\wd/
- abcd
- 0: abcd
- abCd
- 0: abCd
- *** Failers
-No match
- aBCd
-No match
- abcD
-No match
-
-/(?s-i:more.*than).*million/i
- more than million
- 0: more than million
- more than MILLION
- 0: more than MILLION
- more \n than Million
- 0: more \x0a than Million
- *** Failers
-No match
- MORE THAN MILLION
-No match
- more \n than \n million
-No match
-
-/(?:(?s-i)more.*than).*million/i
- more than million
- 0: more than million
- more than MILLION
- 0: more than MILLION
- more \n than Million
- 0: more \x0a than Million
- *** Failers
-No match
- MORE THAN MILLION
-No match
- more \n than \n million
-No match
-
-/(?>a(?i)b+)+c/
- abc
- 0: abc
- aBbc
- 0: aBbc
- aBBc
- 0: aBBc
- *** Failers
-No match
- Abc
-No match
- abAb
-No match
- abbC
-No match
-
-/(?=a(?i)b)\w\wc/
- abc
- 0: abc
- aBc
- 0: aBc
- *** Failers
-No match
- Ab
-No match
- abC
-No match
- aBC
-No match
-
-/(?<=a(?i)b)(\w\w)c/
- abxxc
- 0: xxc
- 1: xx
- aBxxc
- 0: xxc
- 1: xx
- *** Failers
-No match
- Abxxc
-No match
- ABxxc
-No match
- abxxC
-No match
-
-/(?:(a)|b)(?(1)A|B)/
- aA
- 0: aA
- 1: a
- bB
- 0: bB
- *** Failers
-No match
- aB
-No match
- bA
-No match
-
-/^(a)?(?(1)a|b)+$/
- aa
- 0: aa
- 1: a
- b
- 0: b
- bb
- 0: bb
- *** Failers
-No match
- ab
-No match
-
-/^(?(?=abc)\w{3}:|\d\d)$/
- abc:
- 0: abc:
- 12
- 0: 12
- *** Failers
-No match
- 123
-No match
- xyz
-No match
-
-/^(?(?!abc)\d\d|\w{3}:)$/
- abc:
- 0: abc:
- 12
- 0: 12
- *** Failers
-No match
- 123
-No match
- xyz
-No match
-
-/(?(?<=foo)bar|cat)/
- foobar
- 0: bar
- cat
- 0: cat
- fcat
- 0: cat
- focat
- 0: cat
- *** Failers
-No match
- foocat
-No match
-
-/(?(?<!foo)cat|bar)/
- foobar
- 0: bar
- cat
- 0: cat
- fcat
- 0: cat
- focat
- 0: cat
- *** Failers
-No match
- foocat
-No match
-
-/( \( )? [^()]+ (?(1) \) |) /x
- abcd
- 0: abcd
- (abcd)
- 0: (abcd)
- 1: (
- the quick (abcd) fox
- 0: the quick
- (abcd
- 0: abcd
-
-/( \( )? [^()]+ (?(1) \) ) /x
- abcd
- 0: abcd
- (abcd)
- 0: (abcd)
- 1: (
- the quick (abcd) fox
- 0: the quick
- (abcd
- 0: abcd
-
-/^(?(2)a|(1)(2))+$/
- 12
- 0: 12
- 1: 1
- 2: 2
- 12a
- 0: 12a
- 1: 1
- 2: 2
- 12aa
- 0: 12aa
- 1: 1
- 2: 2
- *** Failers
-No match
- 1234
-No match
-
-/((?i)blah)\s+\1/
- blah blah
- 0: blah blah
- 1: blah
- BLAH BLAH
- 0: BLAH BLAH
- 1: BLAH
- Blah Blah
- 0: Blah Blah
- 1: Blah
- blaH blaH
- 0: blaH blaH
- 1: blaH
- *** Failers
-No match
- blah BLAH
-No match
- Blah blah
-No match
- blaH blah
-No match
-
-/((?i)blah)\s+(?i:\1)/
- blah blah
- 0: blah blah
- 1: blah
- BLAH BLAH
- 0: BLAH BLAH
- 1: BLAH
- Blah Blah
- 0: Blah Blah
- 1: Blah
- blaH blaH
- 0: blaH blaH
- 1: blaH
- blah BLAH
- 0: blah BLAH
- 1: blah
- Blah blah
- 0: Blah blah
- 1: Blah
- blaH blah
- 0: blaH blah
- 1: blaH
-
-/(?>a*)*/
- a
- 0: a
- aa
- 0: aa
- aaaa
- 0: aaaa
-
-/(abc|)+/
- abc
- 0: abc
- 1:
- abcabc
- 0: abcabc
- 1:
- abcabcabc
- 0: abcabcabc
- 1:
- xyz
- 0:
- 1:
-
-/([a]*)*/
- a
- 0: a
- 1:
- aaaaa
- 0: aaaaa
- 1:
-
-/([ab]*)*/
- a
- 0: a
- 1:
- b
- 0: b
- 1:
- ababab
- 0: ababab
- 1:
- aaaabcde
- 0: aaaab
- 1:
- bbbb
- 0: bbbb
- 1:
-
-/([^a]*)*/
- b
- 0: b
- 1:
- bbbb
- 0: bbbb
- 1:
- aaa
- 0:
- 1:
-
-/([^ab]*)*/
- cccc
- 0: cccc
- 1:
- abab
- 0:
- 1:
-
-/([a]*?)*/
- a
- 0:
- 1:
- aaaa
- 0:
- 1:
-
-/([ab]*?)*/
- a
- 0:
- 1:
- b
- 0:
- 1:
- abab
- 0:
- 1:
- baba
- 0:
- 1:
-
-/([^a]*?)*/
- b
- 0:
- 1:
- bbbb
- 0:
- 1:
- aaa
- 0:
- 1:
-
-/([^ab]*?)*/
- c
- 0:
- 1:
- cccc
- 0:
- 1:
- baba
- 0:
- 1:
-
-/(?>a*)*/
- a
- 0: a
- aaabcde
- 0: aaa
-
-/((?>a*))*/
- aaaaa
- 0: aaaaa
- 1:
- aabbaa
- 0: aa
- 1:
-
-/((?>a*?))*/
- aaaaa
- 0:
- 1:
- aabbaa
- 0:
- 1:
-
-/(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x
- 12-sep-98
- 0: 12-sep-98
- 12-09-98
- 0: 12-09-98
- *** Failers
-No match
- sep-12-98
-No match
-
-/(?<=(foo))bar\1/
- foobarfoo
- 0: barfoo
- 1: foo
- foobarfootling
- 0: barfoo
- 1: foo
- *** Failers
-No match
- foobar
-No match
- barfoo
-No match
-
-/(?i:saturday|sunday)/
- saturday
- 0: saturday
- sunday
- 0: sunday
- Saturday
- 0: Saturday
- Sunday
- 0: Sunday
- SATURDAY
- 0: SATURDAY
- SUNDAY
- 0: SUNDAY
- SunDay
- 0: SunDay
-
-/(a(?i)bc|BB)x/
- abcx
- 0: abcx
- 1: abc
- aBCx
- 0: aBCx
- 1: aBC
- bbx
- 0: bbx
- 1: bb
- BBx
- 0: BBx
- 1: BB
- *** Failers
-No match
- abcX
-No match
- aBCX
-No match
- bbX
-No match
- BBX
-No match
-
-/^([ab](?i)[cd]|[ef])/
- ac
- 0: ac
- 1: ac
- aC
- 0: aC
- 1: aC
- bD
- 0: bD
- 1: bD
- elephant
- 0: e
- 1: e
- Europe
- 0: E
- 1: E
- frog
- 0: f
- 1: f
- France
- 0: F
- 1: F
- *** Failers
-No match
- Africa
-No match
-
-/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
- ab
- 0: ab
- 1: ab
- aBd
- 0: aBd
- 1: aBd
- xy
- 0: xy
- 1: xy
- xY
- 0: xY
- 1: xY
- zebra
- 0: z
- 1: z
- Zambesi
- 0: Z
- 1: Z
- *** Failers
-No match
- aCD
-No match
- XY
-No match
-
-/(?<=foo\n)^bar/m
- foo\nbar
- 0: bar
- *** Failers
-No match
- bar
-No match
- baz\nbar
-No match
-
-/(?<=(?<!foo)bar)baz/
- barbaz
- 0: baz
- barbarbaz
- 0: baz
- koobarbaz
- 0: baz
- *** Failers
-No match
- baz
-No match
- foobarbaz
-No match
-
-/The case of aaaaaa is missed out below because I think Perl 5.005_02 gets/
-/it wrong; it sets $1 to aaa rather than aa. Compare the following test,/
-No match
-/where it does set $1 to aa when matching aaaaaa./
-No match
-
-/^(a\1?){4}$/
- a
-No match
- aa
-No match
- aaa
-No match
- aaaa
- 0: aaaa
- 1: a
- aaaaa
- 0: aaaaa
- 1: a
- aaaaaaa
- 0: aaaaaaa
- 1: a
- aaaaaaaa
-No match
- aaaaaaaaa
-No match
- aaaaaaaaaa
- 0: aaaaaaaaaa
- 1: aaaa
- aaaaaaaaaaa
-No match
- aaaaaaaaaaaa
-No match
- aaaaaaaaaaaaa
-No match
- aaaaaaaaaaaaaa
-No match
- aaaaaaaaaaaaaaa
-No match
- aaaaaaaaaaaaaaaa
-No match
-
-/^(a\1?)(a\1?)(a\2?)(a\3?)$/
- a
-No match
- aa
-No match
- aaa
-No match
- aaaa
- 0: aaaa
- 1: a
- 2: a
- 3: a
- 4: a
- aaaaa
- 0: aaaaa
- 1: a
- 2: aa
- 3: a
- 4: a
- aaaaaa
- 0: aaaaaa
- 1: a
- 2: aa
- 3: a
- 4: aa
- aaaaaaa
- 0: aaaaaaa
- 1: a
- 2: aa
- 3: aaa
- 4: a
- aaaaaaaa
-No match
- aaaaaaaaa
-No match
- aaaaaaaaaa
- 0: aaaaaaaaaa
- 1: a
- 2: aa
- 3: aaa
- 4: aaaa
- aaaaaaaaaaa
-No match
- aaaaaaaaaaaa
-No match
- aaaaaaaaaaaaa
-No match
- aaaaaaaaaaaaaa
-No match
- aaaaaaaaaaaaaaa
-No match
- aaaaaaaaaaaaaaaa
-No match
-
-/The following tests are taken from the Perl 5.005 test suite; some of them/
-/are compatible with 5.004, but I'd rather not have to sort them out./
-No match
-
-/abc/
- abc
- 0: abc
- xabcy
- 0: abc
- ababc
- 0: abc
- *** Failers
-No match
- xbc
-No match
- axc
-No match
- abx
-No match
-
-/ab*c/
- abc
- 0: abc
-
-/ab*bc/
- abc
- 0: abc
- abbc
- 0: abbc
- abbbbc
- 0: abbbbc
-
-/.{1}/
- abbbbc
- 0: a
-
-/.{3,4}/
- abbbbc
- 0: abbb
-
-/ab{0,}bc/
- abbbbc
- 0: abbbbc
-
-/ab+bc/
- abbc
- 0: abbc
- *** Failers
-No match
- abc
-No match
- abq
-No match
-
-/ab{1,}bc/
-
-/ab+bc/
- abbbbc
- 0: abbbbc
-
-/ab{1,}bc/
- abbbbc
- 0: abbbbc
-
-/ab{1,3}bc/
- abbbbc
- 0: abbbbc
-
-/ab{3,4}bc/
- abbbbc
- 0: abbbbc
-
-/ab{4,5}bc/
- *** Failers
-No match
- abq
-No match
- abbbbc
-No match
-
-/ab?bc/
- abbc
- 0: abbc
- abc
- 0: abc
-
-/ab{0,1}bc/
- abc
- 0: abc
-
-/ab?bc/
-
-/ab?c/
- abc
- 0: abc
-
-/ab{0,1}c/
- abc
- 0: abc
-
-/^abc$/
- abc
- 0: abc
- *** Failers
-No match
- abbbbc
-No match
- abcc
-No match
-
-/^abc/
- abcc
- 0: abc
-
-/^abc$/
-
-/abc$/
- aabc
- 0: abc
- *** Failers
-No match
- aabc
- 0: abc
- aabcd
-No match
-
-/^/
- abc
- 0:
-
-/$/
- abc
- 0:
-
-/a.c/
- abc
- 0: abc
- axc
- 0: axc
-
-/a.*c/
- axyzc
- 0: axyzc
-
-/a[bc]d/
- abd
- 0: abd
- *** Failers
-No match
- axyzd
-No match
- abc
-No match
-
-/a[b-d]e/
- ace
- 0: ace
-
-/a[b-d]/
- aac
- 0: ac
-
-/a[-b]/
- a-
- 0: a-
-
-/a[b-]/
- a-
- 0: a-
-
-/a]/
- a]
- 0: a]
-
-/a[]]b/
- a]b
- 0: a]b
-
-/a[^bc]d/
- aed
- 0: aed
- *** Failers
-No match
- abd
-No match
- abd
-No match
-
-/a[^-b]c/
- adc
- 0: adc
-
-/a[^]b]c/
- adc
- 0: adc
- *** Failers
-No match
- a-c
- 0: a-c
- a]c
-No match
-
-/\ba\b/
- a-
- 0: a
- -a
- 0: a
- -a-
- 0: a
-
-/\by\b/
- *** Failers
-No match
- xy
-No match
- yz
-No match
- xyz
-No match
-
-/\Ba\B/
- *** Failers
- 0: a
- a-
-No match
- -a
-No match
- -a-
-No match
-
-/\By\b/
- xy
- 0: y
-
-/\by\B/
- yz
- 0: y
-
-/\By\B/
- xyz
- 0: y
-
-/\w/
- a
- 0: a
-
-/\W/
- -
- 0: -
- *** Failers
- 0: *
- -
- 0: -
- a
-No match
-
-/a\sb/
- a b
- 0: a b
-
-/a\Sb/
- a-b
- 0: a-b
- *** Failers
-No match
- a-b
- 0: a-b
- a b
-No match
-
-/\d/
- 1
- 0: 1
-
-/\D/
- -
- 0: -
- *** Failers
- 0: *
- -
- 0: -
- 1
-No match
-
-/[\w]/
- a
- 0: a
-
-/[\W]/
- -
- 0: -
- *** Failers
- 0: *
- -
- 0: -
- a
-No match
-
-/a[\s]b/
- a b
- 0: a b
-
-/a[\S]b/
- a-b
- 0: a-b
- *** Failers
-No match
- a-b
- 0: a-b
- a b
-No match
-
-/[\d]/
- 1
- 0: 1
-
-/[\D]/
- -
- 0: -
- *** Failers
- 0: *
- -
- 0: -
- 1
-No match
-
-/ab|cd/
- abc
- 0: ab
- abcd
- 0: ab
-
-/()ef/
- def
- 0: ef
- 1:
-
-/$b/
-
-/a\(b/
- a(b
- 0: a(b
-
-/a\(*b/
- ab
- 0: ab
- a((b
- 0: a((b
-
-/a\\b/
- a\b
-No match
-
-/((a))/
- abc
- 0: a
- 1: a
- 2: a
-
-/(a)b(c)/
- abc
- 0: abc
- 1: a
- 2: c
-
-/a+b+c/
- aabbabc
- 0: abc
-
-/a{1,}b{1,}c/
- aabbabc
- 0: abc
-
-/a.+?c/
- abcabc
- 0: abc
-
-/(a+|b)*/
- ab
- 0: ab
- 1: b
-
-/(a+|b){0,}/
- ab
- 0: ab
- 1: b
-
-/(a+|b)+/
- ab
- 0: ab
- 1: b
-
-/(a+|b){1,}/
- ab
- 0: ab
- 1: b
-
-/(a+|b)?/
- ab
- 0: a
- 1: a
-
-/(a+|b){0,1}/
- ab
- 0: a
- 1: a
-
-/[^ab]*/
- cde
- 0: cde
-
-/abc/
- *** Failers
-No match
- b
-No match
-
-
-/a*/
-
-
-/([abc])*d/
- abbbcd
- 0: abbbcd
- 1: c
-
-/([abc])*bcd/
- abcd
- 0: abcd
- 1: a
-
-/a|b|c|d|e/
- e
- 0: e
-
-/(a|b|c|d|e)f/
- ef
- 0: ef
- 1: e
-
-/abcd*efg/
- abcdefg
- 0: abcdefg
-
-/ab*/
- xabyabbbz
- 0: ab
- xayabbbz
- 0: a
-
-/(ab|cd)e/
- abcde
- 0: cde
- 1: cd
-
-/[abhgefdc]ij/
- hij
- 0: hij
-
-/^(ab|cd)e/
-
-/(abc|)ef/
- abcdef
- 0: ef
- 1:
-
-/(a|b)c*d/
- abcd
- 0: bcd
- 1: b
-
-/(ab|ab*)bc/
- abc
- 0: abc
- 1: a
-
-/a([bc]*)c*/
- abc
- 0: abc
- 1: bc
-
-/a([bc]*)(c*d)/
- abcd
- 0: abcd
- 1: bc
- 2: d
-
-/a([bc]+)(c*d)/
- abcd
- 0: abcd
- 1: bc
- 2: d
-
-/a([bc]*)(c+d)/
- abcd
- 0: abcd
- 1: b
- 2: cd
-
-/a[bcd]*dcdcde/
- adcdcde
- 0: adcdcde
-
-/a[bcd]+dcdcde/
- *** Failers
-No match
- abcde
-No match
- adcdcde
-No match
-
-/(ab|a)b*c/
- abc
- 0: abc
- 1: ab
-
-/((a)(b)c)(d)/
- abcd
- 0: abcd
- 1: abc
- 2: a
- 3: b
- 4: d
-
-/[a-zA-Z_][a-zA-Z0-9_]*/
- alpha
- 0: alpha
-
-/^a(bc+|b[eh])g|.h$/
- abh
- 0: bh
-
-/(bc+d$|ef*g.|h?i(j|k))/
- effgz
- 0: effgz
- 1: effgz
- ij
- 0: ij
- 1: ij
- 2: j
- reffgz
- 0: effgz
- 1: effgz
- *** Failers
-No match
- effg
-No match
- bcdd
-No match
-
-/((((((((((a))))))))))/
- a
- 0: a
- 1: a
- 2: a
- 3: a
- 4: a
- 5: a
- 6: a
- 7: a
- 8: a
- 9: a
-10: a
-
-/((((((((((a))))))))))\10/
- aa
- 0: aa
- 1: a
- 2: a
- 3: a
- 4: a
- 5: a
- 6: a
- 7: a
- 8: a
- 9: a
-10: a
-
-/(((((((((a)))))))))/
- a
- 0: a
- 1: a
- 2: a
- 3: a
- 4: a
- 5: a
- 6: a
- 7: a
- 8: a
- 9: a
-
-/multiple words of text/
- *** Failers
-No match
- aa
-No match
- uh-uh
-No match
-
-/multiple words/
- multiple words, yeah
- 0: multiple words
-
-/(.*)c(.*)/
- abcde
- 0: abcde
- 1: ab
- 2: de
-
-/\((.*), (.*)\)/
- (a, b)
- 0: (a, b)
- 1: a
- 2: b
-
-/[k]/
-
-/abcd/
- abcd
- 0: abcd
-
-/a(bc)d/
- abcd
- 0: abcd
- 1: bc
-
-/a[-]?c/
- ac
- 0: ac
-
-/(abc)\1/
- abcabc
- 0: abcabc
- 1: abc
-
-/([a-c]*)\1/
- abcabc
- 0: abcabc
- 1: abc
-
-/(a)|\1/
- a
- 0: a
- 1: a
- *** Failers
- 0: a
- 1: a
- ab
- 0: a
- 1: a
- x
-No match
-
-/(([a-c])b*?\2)*/
- ababbbcbc
- 0: ababb
- 1: bb
- 2: b
-
-/(([a-c])b*?\2){3}/
- ababbbcbc
- 0: ababbbcbc
- 1: cbc
- 2: c
-
-/((\3|b)\2(a)x)+/
- aaaxabaxbaaxbbax
- 0: bbax
- 1: bbax
- 2: b
- 3: a
-
-/((\3|b)\2(a)){2,}/
- bbaababbabaaaaabbaaaabba
- 0: bbaaaabba
- 1: bba
- 2: b
- 3: a
-
-/abc/i
- ABC
- 0: ABC
- XABCY
- 0: ABC
- ABABC
- 0: ABC
- *** Failers
-No match
- aaxabxbaxbbx
-No match
- XBC
-No match
- AXC
-No match
- ABX
-No match
-
-/ab*c/i
- ABC
- 0: ABC
-
-/ab*bc/i
- ABC
- 0: ABC
- ABBC
- 0: ABBC
-
-/ab*?bc/i
- ABBBBC
- 0: ABBBBC
-
-/ab{0,}?bc/i
- ABBBBC
- 0: ABBBBC
-
-/ab+?bc/i
- ABBC
- 0: ABBC
-
-/ab+bc/i
- *** Failers
-No match
- ABC
-No match
- ABQ
-No match
-
-/ab{1,}bc/i
-
-/ab+bc/i
- ABBBBC
- 0: ABBBBC
-
-/ab{1,}?bc/i
- ABBBBC
- 0: ABBBBC
-
-/ab{1,3}?bc/i
- ABBBBC
- 0: ABBBBC
-
-/ab{3,4}?bc/i
- ABBBBC
- 0: ABBBBC
-
-/ab{4,5}?bc/i
- *** Failers
-No match
- ABQ
-No match
- ABBBBC
-No match
-
-/ab??bc/i
- ABBC
- 0: ABBC
- ABC
- 0: ABC
-
-/ab{0,1}?bc/i
- ABC
- 0: ABC
-
-/ab??bc/i
-
-/ab??c/i
- ABC
- 0: ABC
-
-/ab{0,1}?c/i
- ABC
- 0: ABC
-
-/^abc$/i
- ABC
- 0: ABC
- *** Failers
-No match
- ABBBBC
-No match
- ABCC
-No match
-
-/^abc/i
- ABCC
- 0: ABC
-
-/^abc$/i
-
-/abc$/i
- AABC
- 0: ABC
-
-/^/i
- ABC
- 0:
-
-/$/i
- ABC
- 0:
-
-/a.c/i
- ABC
- 0: ABC
- AXC
- 0: AXC
-
-/a.*?c/i
- AXYZC
- 0: AXYZC
-
-/a.*c/i
- *** Failers
-No match
- AABC
- 0: AABC
- AXYZD
-No match
-
-/a[bc]d/i
- ABD
- 0: ABD
-
-/a[b-d]e/i
- ACE
- 0: ACE
- *** Failers
-No match
- ABC
-No match
- ABD
-No match
-
-/a[b-d]/i
- AAC
- 0: AC
-
-/a[-b]/i
- A-
- 0: A-
-
-/a[b-]/i
- A-
- 0: A-
-
-/a]/i
- A]
- 0: A]
-
-/a[]]b/i
- A]B
- 0: A]B
-
-/a[^bc]d/i
- AED
- 0: AED
-
-/a[^-b]c/i
- ADC
- 0: ADC
- *** Failers
-No match
- ABD
-No match
- A-C
-No match
-
-/a[^]b]c/i
- ADC
- 0: ADC
-
-/ab|cd/i
- ABC
- 0: AB
- ABCD
- 0: AB
-
-/()ef/i
- DEF
- 0: EF
- 1:
-
-/$b/i
- *** Failers
-No match
- A]C
-No match
- B
-No match
-
-/a\(b/i
- A(B
- 0: A(B
-
-/a\(*b/i
- AB
- 0: AB
- A((B
- 0: A((B
-
-/a\\b/i
- A\B
-No match
-
-/((a))/i
- ABC
- 0: A
- 1: A
- 2: A
-
-/(a)b(c)/i
- ABC
- 0: ABC
- 1: A
- 2: C
-
-/a+b+c/i
- AABBABC
- 0: ABC
-
-/a{1,}b{1,}c/i
- AABBABC
- 0: ABC
-
-/a.+?c/i
- ABCABC
- 0: ABC
-
-/a.*?c/i
- ABCABC
- 0: ABC
-
-/a.{0,5}?c/i
- ABCABC
- 0: ABC
-
-/(a+|b)*/i
- AB
- 0: AB
- 1: B
-
-/(a+|b){0,}/i
- AB
- 0: AB
- 1: B
-
-/(a+|b)+/i
- AB
- 0: AB
- 1: B
-
-/(a+|b){1,}/i
- AB
- 0: AB
- 1: B
-
-/(a+|b)?/i
- AB
- 0: A
- 1: A
-
-/(a+|b){0,1}/i
- AB
- 0: A
- 1: A
-
-/(a+|b){0,1}?/i
- AB
- 0:
-
-/[^ab]*/i
- CDE
- 0: CDE
-
-/abc/i
-
-/a*/i
-
-
-/([abc])*d/i
- ABBBCD
- 0: ABBBCD
- 1: C
-
-/([abc])*bcd/i
- ABCD
- 0: ABCD
- 1: A
-
-/a|b|c|d|e/i
- E
- 0: E
-
-/(a|b|c|d|e)f/i
- EF
- 0: EF
- 1: E
-
-/abcd*efg/i
- ABCDEFG
- 0: ABCDEFG
-
-/ab*/i
- XABYABBBZ
- 0: AB
- XAYABBBZ
- 0: A
-
-/(ab|cd)e/i
- ABCDE
- 0: CDE
- 1: CD
-
-/[abhgefdc]ij/i
- HIJ
- 0: HIJ
-
-/^(ab|cd)e/i
- ABCDE
-No match
-
-/(abc|)ef/i
- ABCDEF
- 0: EF
- 1:
-
-/(a|b)c*d/i
- ABCD
- 0: BCD
- 1: B
-
-/(ab|ab*)bc/i
- ABC
- 0: ABC
- 1: A
-
-/a([bc]*)c*/i
- ABC
- 0: ABC
- 1: BC
-
-/a([bc]*)(c*d)/i
- ABCD
- 0: ABCD
- 1: BC
- 2: D
-
-/a([bc]+)(c*d)/i
- ABCD
- 0: ABCD
- 1: BC
- 2: D
-
-/a([bc]*)(c+d)/i
- ABCD
- 0: ABCD
- 1: B
- 2: CD
-
-/a[bcd]*dcdcde/i
- ADCDCDE
- 0: ADCDCDE
-
-/a[bcd]+dcdcde/i
-
-/(ab|a)b*c/i
- ABC
- 0: ABC
- 1: AB
-
-/((a)(b)c)(d)/i
- ABCD
- 0: ABCD
- 1: ABC
- 2: A
- 3: B
- 4: D
-
-/[a-zA-Z_][a-zA-Z0-9_]*/i
- ALPHA
- 0: ALPHA
-
-/^a(bc+|b[eh])g|.h$/i
- ABH
- 0: BH
-
-/(bc+d$|ef*g.|h?i(j|k))/i
- EFFGZ
- 0: EFFGZ
- 1: EFFGZ
- IJ
- 0: IJ
- 1: IJ
- 2: J
- REFFGZ
- 0: EFFGZ
- 1: EFFGZ
- *** Failers
-No match
- ADCDCDE
-No match
- EFFG
-No match
- BCDD
-No match
-
-/((((((((((a))))))))))/i
- A
- 0: A
- 1: A
- 2: A
- 3: A
- 4: A
- 5: A
- 6: A
- 7: A
- 8: A
- 9: A
-10: A
-
-/((((((((((a))))))))))\10/i
- AA
- 0: AA
- 1: A
- 2: A
- 3: A
- 4: A
- 5: A
- 6: A
- 7: A
- 8: A
- 9: A
-10: A
-
-/(((((((((a)))))))))/i
- A
- 0: A
- 1: A
- 2: A
- 3: A
- 4: A
- 5: A
- 6: A
- 7: A
- 8: A
- 9: A
-
-/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
- A
- 0: A
- 1: A
-
-/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
- C
- 0: C
- 1: C
-
-/multiple words of text/i
- *** Failers
-No match
- AA
-No match
- UH-UH
-No match
-
-/multiple words/i
- MULTIPLE WORDS, YEAH
- 0: MULTIPLE WORDS
-
-/(.*)c(.*)/i
- ABCDE
- 0: ABCDE
- 1: AB
- 2: DE
-
-/\((.*), (.*)\)/i
- (A, B)
- 0: (A, B)
- 1: A
- 2: B
-
-/[k]/i
-
-/abcd/i
- ABCD
- 0: ABCD
-
-/a(bc)d/i
- ABCD
- 0: ABCD
- 1: BC
-
-/a[-]?c/i
- AC
- 0: AC
-
-/(abc)\1/i
- ABCABC
- 0: ABCABC
- 1: ABC
-
-/([a-c]*)\1/i
- ABCABC
- 0: ABCABC
- 1: ABC
-
-/a(?!b)./
- abad
- 0: ad
-
-/a(?=d)./
- abad
- 0: ad
-
-/a(?=c|d)./
- abad
- 0: ad
-
-/a(?:b|c|d)(.)/
- ace
- 0: ace
- 1: e
-
-/a(?:b|c|d)*(.)/
- ace
- 0: ace
- 1: e
-
-/a(?:b|c|d)+?(.)/
- ace
- 0: ace
- 1: e
- acdbcdbe
- 0: acd
- 1: d
-
-/a(?:b|c|d)+(.)/
- acdbcdbe
- 0: acdbcdbe
- 1: e
-
-/a(?:b|c|d){2}(.)/
- acdbcdbe
- 0: acdb
- 1: b
-
-/a(?:b|c|d){4,5}(.)/
- acdbcdbe
- 0: acdbcdb
- 1: b
-
-/a(?:b|c|d){4,5}?(.)/
- acdbcdbe
- 0: acdbcd
- 1: d
-
-/((foo)|(bar))*/
- foobar
- 0: foobar
- 1: bar
- 2: foo
- 3: bar
-
-/a(?:b|c|d){6,7}(.)/
- acdbcdbe
- 0: acdbcdbe
- 1: e
-
-/a(?:b|c|d){6,7}?(.)/
- acdbcdbe
- 0: acdbcdbe
- 1: e
-
-/a(?:b|c|d){5,6}(.)/
- acdbcdbe
- 0: acdbcdbe
- 1: e
-
-/a(?:b|c|d){5,6}?(.)/
- acdbcdbe
- 0: acdbcdb
- 1: b
-
-/a(?:b|c|d){5,7}(.)/
- acdbcdbe
- 0: acdbcdbe
- 1: e
-
-/a(?:b|c|d){5,7}?(.)/
- acdbcdbe
- 0: acdbcdb
- 1: b
-
-/a(?:b|(c|e){1,2}?|d)+?(.)/
- ace
- 0: ace
- 1: c
- 2: e
-
-/^(.+)?B/
- AB
- 0: AB
- 1: A
-
-/^([^a-z])|(\^)$/
- .
- 0: .
- 1: .
-
-/^[<>]&/
- <&OUT
- 0: <&
-
-/^(a\1?){4}$/
- aaaaaaaaaa
- 0: aaaaaaaaaa
- 1: aaaa
- *** Failers
-No match
- AB
-No match
- aaaaaaaaa
-No match
- aaaaaaaaaaa
-No match
-
-/^(a(?(1)\1)){4}$/
- aaaaaaaaaa
- 0: aaaaaaaaaa
- 1: aaaa
- *** Failers
-No match
- aaaaaaaaa
-No match
- aaaaaaaaaaa
-No match
-
-/(?:(f)(o)(o)|(b)(a)(r))*/
- foobar
- 0: foobar
- 1: f
- 2: o
- 3: o
- 4: b
- 5: a
- 6: r
-
-/(?<=a)b/
- ab
- 0: b
- *** Failers
-No match
- cb
-No match
- b
-No match
-
-/(?<!c)b/
- ab
- 0: b
- b
- 0: b
- b
- 0: b
-
-/(?:..)*a/
- aba
- 0: aba
-
-/(?:..)*?a/
- aba
- 0: a
-
-/^(?:b|a(?=(.)))*\1/
- abc
- 0: ab
- 1: b
-
-/^(){3,5}/
- abc
- 0:
- 1:
-
-/^(a+)*ax/
- aax
- 0: aax
- 1: a
-
-/^((a|b)+)*ax/
- aax
- 0: aax
- 1: a
- 2: a
-
-/^((a|bc)+)*ax/
- aax
- 0: aax
- 1: a
- 2: a
-
-/(a|x)*ab/
- cab
- 0: ab
-
-/(a)*ab/
- cab
- 0: ab
-
-/(?:(?i)a)b/
- ab
- 0: ab
-
-/((?i)a)b/
- ab
- 0: ab
- 1: a
-
-/(?:(?i)a)b/
- Ab
- 0: Ab
-
-/((?i)a)b/
- Ab
- 0: Ab
- 1: A
-
-/(?:(?i)a)b/
- *** Failers
-No match
- cb
-No match
- aB
-No match
-
-/((?i)a)b/
-
-/(?i:a)b/
- ab
- 0: ab
-
-/((?i:a))b/
- ab
- 0: ab
- 1: a
-
-/(?i:a)b/
- Ab
- 0: Ab
-
-/((?i:a))b/
- Ab
- 0: Ab
- 1: A
-
-/(?i:a)b/
- *** Failers
-No match
- aB
-No match
- aB
-No match
-
-/((?i:a))b/
-
-/(?:(?-i)a)b/i
- ab
- 0: ab
-
-/((?-i)a)b/i
- ab
- 0: ab
- 1: a
-
-/(?:(?-i)a)b/i
- aB
- 0: aB
-
-/((?-i)a)b/i
- aB
- 0: aB
- 1: a
-
-/(?:(?-i)a)b/i
- *** Failers
-No match
- aB
- 0: aB
- Ab
-No match
-
-/((?-i)a)b/i
-
-/(?:(?-i)a)b/i
- aB
- 0: aB
-
-/((?-i)a)b/i
- aB
- 0: aB
- 1: a
-
-/(?:(?-i)a)b/i
- *** Failers
-No match
- Ab
-No match
- AB
-No match
-
-/((?-i)a)b/i
-
-/(?-i:a)b/i
- ab
- 0: ab
-
-/((?-i:a))b/i
- ab
- 0: ab
- 1: a
-
-/(?-i:a)b/i
- aB
- 0: aB
-
-/((?-i:a))b/i
- aB
- 0: aB
- 1: a
-
-/(?-i:a)b/i
- *** Failers
-No match
- AB
-No match
- Ab
-No match
-
-/((?-i:a))b/i
-
-/(?-i:a)b/i
- aB
- 0: aB
-
-/((?-i:a))b/i
- aB
- 0: aB
- 1: a
-
-/(?-i:a)b/i
- *** Failers
-No match
- Ab
-No match
- AB
-No match
-
-/((?-i:a))b/i
-
-/((?-i:a.))b/i
- *** Failers
-No match
- AB
-No match
- a\nB
-No match
-
-/((?s-i:a.))b/i
- a\nB
- 0: a\x0aB
- 1: a\x0a
-
-/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
- cabbbb
- 0: cabbbb
-
-/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
- caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
- 0: caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
-
-/(ab)\d\1/i
- Ab4ab
- 0: Ab4ab
- 1: Ab
- ab4Ab
- 0: ab4Ab
- 1: ab
-
-/foo\w*\d{4}baz/
- foobar1234baz
- 0: foobar1234baz
-
-/x(~~)*(?:(?:F)?)?/
- x~~
- 0: x~~
- 1: ~~
-
-/^a(?#xxx){3}c/
- aaac
- 0: aaac
-
-/^a (?#xxx) (?#yyy) {3}c/x
- aaac
- 0: aaac
-
-/(?<![cd])b/
- *** Failers
-No match
- B\nB
-No match
- dbcb
-No match
-
-/(?<![cd])[ab]/
- dbaacb
- 0: a
-
-/(?<!(c|d))b/
-
-/(?<!(c|d))[ab]/
- dbaacb
- 0: a
-
-/(?<!cd)[ab]/
- cdaccb
- 0: b
-
-/^(?:a?b?)*$/
- *** Failers
-No match
- dbcb
-No match
- a--
-No match
-
-/((?s)^a(.))((?m)^b$)/
- a\nb\nc\n
- 0: a\x0ab
- 1: a\x0a
- 2: \x0a
- 3: b
-
-/((?m)^b$)/
- a\nb\nc\n
- 0: b
- 1: b
-
-/(?m)^b/
- a\nb\n
- 0: b
-
-/(?m)^(b)/
- a\nb\n
- 0: b
- 1: b
-
-/((?m)^b)/
- a\nb\n
- 0: b
- 1: b
-
-/\n((?m)^b)/
- a\nb\n
- 0: \x0ab
- 1: b
-
-/((?s).)c(?!.)/
- a\nb\nc\n
- 0: \x0ac
- 1: \x0a
- a\nb\nc\n
- 0: \x0ac
- 1: \x0a
-
-/((?s)b.)c(?!.)/
- a\nb\nc\n
- 0: b\x0ac
- 1: b\x0a
- a\nb\nc\n
- 0: b\x0ac
- 1: b\x0a
-
-/^b/
-
-/()^b/
- *** Failers
-No match
- a\nb\nc\n
-No match
- a\nb\nc\n
-No match
-
-/((?m)^b)/
- a\nb\nc\n
- 0: b
- 1: b
-
-/(?(1)a|b)/
-
-/(?(1)b|a)/
- a
- 0: a
-
-/(x)?(?(1)a|b)/
- *** Failers
-No match
- a
-No match
- a
-No match
-
-/(x)?(?(1)b|a)/
- a
- 0: a
-
-/()?(?(1)b|a)/
- a
- 0: a
-
-/()(?(1)b|a)/
-
-/()?(?(1)a|b)/
- a
- 0: a
- 1:
-
-/^(\()?blah(?(1)(\)))$/
- (blah)
- 0: (blah)
- 1: (
- 2: )
- blah
- 0: blah
- *** Failers
-No match
- a
-No match
- blah)
-No match
- (blah
-No match
-
-/^(\(+)?blah(?(1)(\)))$/
- (blah)
- 0: (blah)
- 1: (
- 2: )
- blah
- 0: blah
- *** Failers
-No match
- blah)
-No match
- (blah
-No match
-
-/(?(?!a)a|b)/
-
-/(?(?!a)b|a)/
- a
- 0: a
-
-/(?(?=a)b|a)/
- *** Failers
-No match
- a
-No match
- a
-No match
-
-/(?(?=a)a|b)/
- a
- 0: a
-
-/(?=(a+?))(\1ab)/
- aaab
- 0: aab
- 1: a
- 2: aab
-
-/^(?=(a+?))\1ab/
-
-/(\w+:)+/
- one:
- 0: one:
- 1: one:
-
-/$(?<=^(a))/
- a
- 0:
- 1: a
-
-/(?=(a+?))(\1ab)/
- aaab
- 0: aab
- 1: a
- 2: aab
-
-/^(?=(a+?))\1ab/
- *** Failers
-No match
- aaab
-No match
- aaab
-No match
-
-/([\w:]+::)?(\w+)$/
- abcd
- 0: abcd
- 1: <unset>
- 2: abcd
- xy:z:::abcd
- 0: xy:z:::abcd
- 1: xy:z:::
- 2: abcd
-
-/^[^bcd]*(c+)/
- aexycd
- 0: aexyc
- 1: c
-
-/(a*)b+/
- caab
- 0: aab
- 1: aa
-
-/([\w:]+::)?(\w+)$/
- abcd
- 0: abcd
- 1: <unset>
- 2: abcd
- xy:z:::abcd
- 0: xy:z:::abcd
- 1: xy:z:::
- 2: abcd
- *** Failers
- 0: Failers
- 1: <unset>
- 2: Failers
- abcd:
-No match
- abcd:
-No match
-
-/^[^bcd]*(c+)/
- aexycd
- 0: aexyc
- 1: c
-
-/(>a+)ab/
-
-/(?>a+)b/
- aaab
- 0: aaab
-
-/([[:]+)/
- a:[b]:
- 0: :[
- 1: :[
-
-/([[=]+)/
- a=[b]=
- 0: =[
- 1: =[
-
-/([[.]+)/
- a.[b].
- 0: .[
- 1: .[
-
-/((?>a+)b)/
- aaab
- 0: aaab
- 1: aaab
-
-/(?>(a+))b/
- aaab
- 0: aaab
- 1: aaa
-
-/((?>[^()]+)|\([^()]*\))+/
- ((abc(ade)ufh()()x
- 0: abc(ade)ufh()()x
- 1: x
-
-/a\Z/
- *** Failers
-No match
- aaab
-No match
- a\nb\n
-No match
-
-/b\Z/
- a\nb\n
- 0: b
-
-/b\z/
-
-/b\Z/
- a\nb
- 0: b
-
-/b\z/
- a\nb
- 0: b
- *** Failers
-No match
-
-/^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/
- a
- 0: a
- 1:
- abc
- 0: abc
- 1:
- a-b
- 0: a-b
- 1:
- 0-9
- 0: 0-9
- 1:
- a.b
- 0: a.b
- 1:
- 5.6.7
- 0: 5.6.7
- 1:
- the.quick.brown.fox
- 0: the.quick.brown.fox
- 1:
- a100.b200.300c
- 0: a100.b200.300c
- 1:
- 12-ab.1245
- 0: 12-ab.1245
- 1:
- ***Failers
-No match
- \
-No match
- .a
-No match
- -a
-No match
- a-
-No match
- a.
-No match
- a_b
-No match
- a.-
-No match
- a..
-No match
- ab..bc
-No match
- the.quick.brown.fox-
-No match
- the.quick.brown.fox.
-No match
- the.quick.brown.fox_
-No match
- the.quick.brown.fox+
-No match
-
-/(?>.*)(?<=(abcd|wxyz))/
- alphabetabcd
- 0: alphabetabcd
- 1: abcd
- endingwxyz
- 0: endingwxyz
- 1: wxyz
- *** Failers
-No match
- a rather long string that doesn't end with one of them
-No match
-
-/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark otherword
- 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
- word cat dog elephant mussel cow horse canary baboon snake shark
-No match
-
-/word (?>[a-zA-Z0-9]+ ){0,30}otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
-No match
-
-/(?<=\d{3}(?!999))foo/
- 999foo
- 0: foo
- 123999foo
- 0: foo
- *** Failers
-No match
- 123abcfoo
-No match
-
-/(?<=(?!...999)\d{3})foo/
- 999foo
- 0: foo
- 123999foo
- 0: foo
- *** Failers
-No match
- 123abcfoo
-No match
-
-/(?<=\d{3}(?!999)...)foo/
- 123abcfoo
- 0: foo
- 123456foo
- 0: foo
- *** Failers
-No match
- 123999foo
-No match
-
-/(?<=\d{3}...)(?<!999)foo/
- 123abcfoo
- 0: foo
- 123456foo
- 0: foo
- *** Failers
-No match
- 123999foo
-No match
-
-/<a[\s]+href[\s]*=[\s]* # find <a href=
- ([\"\'])? # find single or double quote
- (?(1) (.*?)\1 | ([^\s]+)) # if quote found, match up to next matching
- # quote, otherwise match up to next space
-/isx
- <a href=abcd xyz
- 0: <a href=abcd
- 1: <unset>
- 2: <unset>
- 3: abcd
- <a href=\"abcd xyz pqr\" cats
- 0: <a href="abcd xyz pqr"
- 1: "
- 2: abcd xyz pqr
- <a href=\'abcd xyz pqr\' cats
- 0: <a href='abcd xyz pqr'
- 1: '
- 2: abcd xyz pqr
-
-/<a\s+href\s*=\s* # find <a href=
- (["'])? # find single or double quote
- (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching
- # quote, otherwise match up to next space
-/isx
- <a href=abcd xyz
- 0: <a href=abcd
- 1: <unset>
- 2: <unset>
- 3: abcd
- <a href=\"abcd xyz pqr\" cats
- 0: <a href="abcd xyz pqr"
- 1: "
- 2: abcd xyz pqr
- <a href = \'abcd xyz pqr\' cats
- 0: <a href = 'abcd xyz pqr'
- 1: '
- 2: abcd xyz pqr
-
-/<a\s+href(?>\s*)=(?>\s*) # find <a href=
- (["'])? # find single or double quote
- (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching
- # quote, otherwise match up to next space
-/isx
- <a href=abcd xyz
- 0: <a href=abcd
- 1: <unset>
- 2: <unset>
- 3: abcd
- <a href=\"abcd xyz pqr\" cats
- 0: <a href="abcd xyz pqr"
- 1: "
- 2: abcd xyz pqr
- <a href = \'abcd xyz pqr\' cats
- 0: <a href = 'abcd xyz pqr'
- 1: '
- 2: abcd xyz pqr
-
-/((Z)+|A)*/
- ZABCDEFG
- 0: ZA
- 1: A
- 2: Z
-
-/(Z()|A)*/
- ZABCDEFG
- 0: ZA
- 1: A
- 2:
-
-/(Z(())|A)*/
- ZABCDEFG
- 0: ZA
- 1: A
- 2:
- 3:
-
-/((?>Z)+|A)*/
- ZABCDEFG
- 0: ZA
- 1: A
-
-/((?>)+|A)*/
- ZABCDEFG
- 0:
- 1:
-
-/a*/g
- abbab
- 0: a
- 0:
- 0:
- 0: a
- 0:
- 0:
-
-/^[a-\d]/
- abcde
- 0: a
- -things
- 0: -
- 0digit
- 0: 0
- *** Failers
-No match
- bcdef
-No match
-
-/^[\d-a]/
- abcde
- 0: a
- -things
- 0: -
- 0digit
- 0: 0
- *** Failers
-No match
- bcdef
-No match
-
-/[[:space:]]+/
- > \x09\x0a\x0c\x0d\x0b<
- 0: \x09\x0a\x0c\x0d\x0b
-
-/[[:blank:]]+/
- > \x09\x0a\x0c\x0d\x0b<
- 0: \x09
-
-/[\s]+/
- > \x09\x0a\x0c\x0d\x0b<
- 0: \x09\x0a\x0c\x0d
-
-/\s+/
- > \x09\x0a\x0c\x0d\x0b<
- 0: \x09\x0a\x0c\x0d
-
-/a b/x
- ab
-No match
-
-/(?!\A)x/m
- a\nxb\n
- 0: x
-
-/(?!^)x/m
- a\nxb\n
-No match
-
-/abc\Qabc\Eabc/
- abcabcabc
- 0: abcabcabc
-
-/abc\Q(*+|\Eabc/
- abc(*+|abc
- 0: abc(*+|abc
-
-/ abc\Q abc\Eabc/x
- abc abcabc
- 0: abc abcabc
- *** Failers
-No match
- abcabcabc
-No match
-
-/abc#comment
- \Q#not comment
- literal\E/x
- abc#not comment\n literal
- 0: abc#not comment\x0a literal
-
-/abc#comment
- \Q#not comment
- literal/x
- abc#not comment\n literal
- 0: abc#not comment\x0a literal
-
-/abc#comment
- \Q#not comment
- literal\E #more comment
- /x
- abc#not comment\n literal
- 0: abc#not comment\x0a literal
-
-/abc#comment
- \Q#not comment
- literal\E #more comment/x
- abc#not comment\n literal
- 0: abc#not comment\x0a literal
-
-/\Qabc\$xyz\E/
- abc\\\$xyz
- 0: abc\$xyz
-
-/\Qabc\E\$\Qxyz\E/
- abc\$xyz
- 0: abc$xyz
-
-/\Gabc/
- abc
- 0: abc
- *** Failers
-No match
- xyzabc
-No match
-
-/\Gabc./g
- abc1abc2xyzabc3
- 0: abc1
- 0: abc2
-
-/abc./g
- abc1abc2xyzabc3
- 0: abc1
- 0: abc2
- 0: abc3
-
-/a(?x: b c )d/
- XabcdY
- 0: abcd
- *** Failers
-No match
- Xa b c d Y
-No match
-
-/((?x)x y z | a b c)/
- XabcY
- 0: abc
- 1: abc
- AxyzB
- 0: xyz
- 1: xyz
-
-/(?i)AB(?-i)C/
- XabCY
- 0: abC
- *** Failers
-No match
- XabcY
-No match
-
-/((?i)AB(?-i)C|D)E/
- abCE
- 0: abCE
- 1: abC
- DE
- 0: DE
- 1: D
- *** Failers
-No match
- abcE
-No match
- abCe
-No match
- dE
-No match
- De
-No match
-
-/(.*)\d+\1/
- abc123abc
- 0: abc123abc
- 1: abc
- abc123bc
- 0: bc123bc
- 1: bc
-
-/(.*)\d+\1/s
- abc123abc
- 0: abc123abc
- 1: abc
- abc123bc
- 0: bc123bc
- 1: bc
-
-/((.*))\d+\1/
- abc123abc
- 0: abc123abc
- 1: abc
- 2: abc
- abc123bc
- 0: bc123bc
- 1: bc
- 2: bc
-
-/-- This tests for an IPv6 address in the form where it can have up to --/
-/-- eight components, one and only one of which is empty. This must be --/
-No match
-/-- an internal component. --/
-No match
-
-/^(?!:) # colon disallowed at start
- (?: # start of item
- (?: [0-9a-f]{1,4} | # 1-4 hex digits or
- (?(1)0 | () ) ) # if null previously matched, fail; else null
- : # followed by colon
- ){1,7} # end item; 1-7 of them required
- [0-9a-f]{1,4} $ # final hex number at end of string
- (?(1)|.) # check that there was an empty component
- /xi
- a123::a123
- 0: a123::a123
- 1:
- a123:b342::abcd
- 0: a123:b342::abcd
- 1:
- a123:b342::324e:abcd
- 0: a123:b342::324e:abcd
- 1:
- a123:ddde:b342::324e:abcd
- 0: a123:ddde:b342::324e:abcd
- 1:
- a123:ddde:b342::324e:dcba:abcd
- 0: a123:ddde:b342::324e:dcba:abcd
- 1:
- a123:ddde:9999:b342::324e:dcba:abcd
- 0: a123:ddde:9999:b342::324e:dcba:abcd
- 1:
- *** Failers
-No match
- 1:2:3:4:5:6:7:8
-No match
- a123:bce:ddde:9999:b342::324e:dcba:abcd
-No match
- a123::9999:b342::324e:dcba:abcd
-No match
- abcde:2:3:4:5:6:7:8
-No match
- ::1
-No match
- abcd:fee0:123::
-No match
- :1
-No match
- 1:
-No match
-
-/ End of testinput1 /
-
diff --git a/ext/pcre/pcrelib/testdata/testoutput2 b/ext/pcre/pcrelib/testdata/testoutput2
deleted file mode 100644
index 2d1db0fb13..0000000000
--- a/ext/pcre/pcrelib/testdata/testoutput2
+++ /dev/null
@@ -1,4088 +0,0 @@
-PCRE version 3.92 11-Sep-2002
-
-/(a)b|/
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-
-/abc/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
- abc
- 0: abc
- defabc
- 0: abc
- \Aabc
- 0: abc
- *** Failers
-No match
- \Adefabc
-No match
- ABC
-No match
-
-/^abc/
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 'c'
- abc
- 0: abc
- \Aabc
- 0: abc
- *** Failers
-No match
- defabc
-No match
- \Adefabc
-No match
-
-/a+bc/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
-
-/a*bc/
-Capturing subpattern count = 0
-No options
-No first char
-Need char = 'c'
-
-/a{3}bc/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
-
-/(abc|a+z)/
-Capturing subpattern count = 1
-No options
-First char = 'a'
-No need char
-
-/^abc$/
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 'c'
- abc
- 0: abc
- *** Failers
-No match
- def\nabc
-No match
-
-/ab\gdef/X
-Failed: unrecognized character follows \ at offset 3
-
-/(?X)ab\gdef/X
-Failed: unrecognized character follows \ at offset 7
-
-/x{5,4}/
-Failed: numbers out of order in {} quantifier at offset 5
-
-/z{65536}/
-Failed: number too big in {} quantifier at offset 7
-
-/[abcd/
-Failed: missing terminating ] for character class at offset 5
-
-/[\B]/
-Failed: invalid escape sequence in character class at offset 2
-
-/[z-a]/
-Failed: range out of order in character class at offset 3
-
-/^*/
-Failed: nothing to repeat at offset 1
-
-/(abc/
-Failed: missing ) at offset 4
-
-/(?# abc/
-Failed: missing ) after comment at offset 7
-
-/(?z)abc/
-Failed: unrecognized character after (? at offset 2
-
-/.*b/
-Capturing subpattern count = 0
-No options
-First char at start or follows \n
-Need char = 'b'
-
-/.*?b/
-Capturing subpattern count = 0
-No options
-First char at start or follows \n
-Need char = 'b'
-
-/cat|dog|elephant/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
- this sentence eventually mentions a cat
- 0: cat
- this sentences rambles on and on for a while and then reaches elephant
- 0: elephant
-
-/cat|dog|elephant/S
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: c d e
- this sentence eventually mentions a cat
- 0: cat
- this sentences rambles on and on for a while and then reaches elephant
- 0: elephant
-
-/cat|dog|elephant/iS
-Capturing subpattern count = 0
-Options: caseless
-No first char
-No need char
-Starting character set: C D E c d e
- this sentence eventually mentions a CAT cat
- 0: CAT
- this sentences rambles on and on for a while to elephant ElePhant
- 0: elephant
-
-/a|[bcd]/S
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: a b c d
-
-/(a|[^\dZ])/S
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-Starting character set: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a
- \x0b \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19
- \x1a \x1b \x1c \x1d \x1e \x1f \x20 ! " # $ % & ' ( ) * + , - . / : ; < = >
- ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y [ \ ] ^ _ ` a b c d
- e f g h i j k l m n o p q r s t u v w x y z { | } ~ \x7f \x80 \x81 \x82 \x83
- \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92
- \x93 \x94 \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f \xa0 \xa1
- \xa2 \xa3 \xa4 \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf \xb0
- \xb1 \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf
- \xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce
- \xcf \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd
- \xde \xdf \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec
- \xed \xee \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb
- \xfc \xfd \xfe \xff
-
-/(a|b)*[\s]/S
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-Starting character set: \x09 \x0a \x0c \x0d \x20 a b
-
-/(ab\2)/
-Failed: reference to non-existent subpattern at offset 6
-
-/{4,5}abc/
-Failed: nothing to repeat at offset 4
-
-/(a)(b)(c)\2/
-Capturing subpattern count = 3
-Max back reference = 2
-No options
-First char = 'a'
-Need char = 'c'
- abcb
- 0: abcb
- 1: a
- 2: b
- 3: c
- \O0abcb
-Matched, but too many substrings
- \O3abcb
-Matched, but too many substrings
- 0: abcb
- \O6abcb
-Matched, but too many substrings
- 0: abcb
- 1: a
- \O9abcb
-Matched, but too many substrings
- 0: abcb
- 1: a
- 2: b
- \O12abcb
- 0: abcb
- 1: a
- 2: b
- 3: c
-
-/(a)bc|(a)(b)\2/
-Capturing subpattern count = 3
-Max back reference = 2
-No options
-First char = 'a'
-No need char
- abc
- 0: abc
- 1: a
- \O0abc
-Matched, but too many substrings
- \O3abc
-Matched, but too many substrings
- 0: abc
- \O6abc
- 0: abc
- 1: a
- aba
- 0: aba
- 1: <unset>
- 2: a
- 3: b
- \O0aba
-Matched, but too many substrings
- \O3aba
-Matched, but too many substrings
- 0: aba
- \O6aba
-Matched, but too many substrings
- 0: aba
- 1: <unset>
- \O9aba
-Matched, but too many substrings
- 0: aba
- 1: <unset>
- 2: a
- \O12aba
- 0: aba
- 1: <unset>
- 2: a
- 3: b
-
-/abc$/E
-Capturing subpattern count = 0
-Options: dollar_endonly
-First char = 'a'
-Need char = 'c'
- abc
- 0: abc
- *** Failers
-No match
- abc\n
-No match
- abc\ndef
-No match
-
-/(a)(b)(c)(d)(e)\6/
-Failed: reference to non-existent subpattern at offset 17
-
-/the quick brown fox/
-Capturing subpattern count = 0
-No options
-First char = 't'
-Need char = 'x'
- the quick brown fox
- 0: the quick brown fox
- this is a line with the quick brown fox
- 0: the quick brown fox
-
-/the quick brown fox/A
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 'x'
- the quick brown fox
- 0: the quick brown fox
- *** Failers
-No match
- this is a line with the quick brown fox
-No match
-
-/ab(?z)cd/
-Failed: unrecognized character after (? at offset 4
-
-/^abc|def/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
- abcdef
- 0: abc
- abcdef\B
- 0: def
-
-/.*((abc)$|(def))/
-Capturing subpattern count = 3
-No options
-First char at start or follows \n
-No need char
- defabc
- 0: defabc
- 1: abc
- 2: abc
- \Zdefabc
- 0: def
- 1: def
- 2: <unset>
- 3: def
-
-/abc/P
- abc
- 0: abc
- *** Failers
-No match: POSIX code 17: match failed
-
-/^abc|def/P
- abcdef
- 0: abc
- abcdef\B
- 0: def
-
-/.*((abc)$|(def))/P
- defabc
- 0: defabc
- 1: abc
- 2: abc
- \Zdefabc
- 0: def
- 1: def
- 3: def
-
-/the quick brown fox/P
- the quick brown fox
- 0: the quick brown fox
- *** Failers
-No match: POSIX code 17: match failed
- The Quick Brown Fox
-No match: POSIX code 17: match failed
-
-/the quick brown fox/Pi
- the quick brown fox
- 0: the quick brown fox
- The Quick Brown Fox
- 0: The Quick Brown Fox
-
-/abc.def/P
- *** Failers
-No match: POSIX code 17: match failed
- abc\ndef
-No match: POSIX code 17: match failed
-
-/abc$/P
- abc
- 0: abc
- abc\n
- 0: abc
-
-/(abc)\2/P
-Failed: POSIX code 15: bad back reference at offset 7
-
-/(abc\1)/P
- abc
-No match: POSIX code 17: match failed
-
-/)/
-Failed: unmatched parentheses at offset 0
-
-/a[]b/
-Failed: missing terminating ] for character class at offset 4
-
-/[^aeiou ]{3,}/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
- co-processors, and for
- 0: -pr
-
-/<.*>/
-Capturing subpattern count = 0
-No options
-First char = '<'
-Need char = '>'
- abc<def>ghi<klm>nop
- 0: <def>ghi<klm>
-
-/<.*?>/
-Capturing subpattern count = 0
-No options
-First char = '<'
-Need char = '>'
- abc<def>ghi<klm>nop
- 0: <def>
-
-/<.*>/U
-Capturing subpattern count = 0
-Options: ungreedy
-First char = '<'
-Need char = '>'
- abc<def>ghi<klm>nop
- 0: <def>
-
-/(?U)<.*>/
-Capturing subpattern count = 0
-Options: ungreedy
-First char = '<'
-Need char = '>'
- abc<def>ghi<klm>nop
- 0: <def>
-
-/<.*?>/U
-Capturing subpattern count = 0
-Options: ungreedy
-First char = '<'
-Need char = '>'
- abc<def>ghi<klm>nop
- 0: <def>ghi<klm>
-
-/={3,}/U
-Capturing subpattern count = 0
-Options: ungreedy
-First char = '='
-Need char = '='
- abc========def
- 0: ===
-
-/(?U)={3,}?/
-Capturing subpattern count = 0
-Options: ungreedy
-First char = '='
-Need char = '='
- abc========def
- 0: ========
-
-/(?<!bar|cattle)foo/
-Capturing subpattern count = 0
-No options
-First char = 'f'
-Need char = 'o'
- foo
- 0: foo
- catfoo
- 0: foo
- *** Failers
-No match
- the barfoo
-No match
- and cattlefoo
-No match
-
-/(?<=a+)b/
-Failed: lookbehind assertion is not fixed length at offset 6
-
-/(?<=aaa|b{0,3})b/
-Failed: lookbehind assertion is not fixed length at offset 14
-
-/(?<!(foo)a\1)bar/
-Failed: lookbehind assertion is not fixed length at offset 12
-
-/(?i)abc/
-Capturing subpattern count = 0
-Options: caseless
-First char = 'a' (caseless)
-Need char = 'c' (caseless)
-
-/(a|(?m)a)/
-Capturing subpattern count = 1
-No options
-First char = 'a'
-No need char
-
-/(?i)^1234/
-Capturing subpattern count = 0
-Options: anchored caseless
-No first char
-Need char = '4'
-
-/(^b|(?i)^d)/
-Capturing subpattern count = 1
-Options: anchored
-Case state changes
-No first char
-No need char
-
-/(?s).*/
-Capturing subpattern count = 0
-Options: anchored dotall
-No first char
-No need char
-
-/[abcd]/S
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: a b c d
-
-/(?i)[abcd]/S
-Capturing subpattern count = 0
-Options: caseless
-No first char
-No need char
-Starting character set: A B C D a b c d
-
-/(?m)[xy]|(b|c)/S
-Capturing subpattern count = 1
-Options: multiline
-No first char
-No need char
-Starting character set: b c x y
-
-/(^a|^b)/m
-Capturing subpattern count = 1
-Options: multiline
-First char at start or follows \n
-No need char
-
-/(?i)(^a|^b)/m
-Capturing subpattern count = 1
-Options: caseless multiline
-First char at start or follows \n
-No need char
-
-/(a)(?(1)a|b|c)/
-Failed: conditional group contains more than two branches at offset 13
-
-/(?(?=a)a|b|c)/
-Failed: conditional group contains more than two branches at offset 12
-
-/(?(1a)/
-Failed: malformed number after (?( at offset 4
-
-/(?(?i))/
-Failed: assertion expected after (?( at offset 3
-
-/(?(abc))/
-Failed: assertion expected after (?( at offset 3
-
-/(?(?<ab))/
-Failed: unrecognized character after (?< at offset 5
-
-/((?s)blah)\s+\1/
-Capturing subpattern count = 1
-Max back reference = 1
-No options
-First char = 'b'
-Need char = 'h'
-
-/((?i)blah)\s+\1/
-Capturing subpattern count = 1
-Max back reference = 1
-No options
-Case state changes
-First char = 'b' (caseless)
-Need char = 'h' (caseless)
-
-/((?i)b)/DS
-------------------------------------------------------------------
- 0 16 Bra 0
- 3 8 Bra 1
- 6 01 Opt
- 8 1 b
- 11 8 Ket
- 14 00 Opt
- 16 16 Ket
- 19 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-No options
-Case state changes
-First char = 'b' (caseless)
-No need char
-Study returned NULL
-
-/(a*b|(?i:c*(?-i)d))/S
-Capturing subpattern count = 1
-No options
-Case state changes
-No first char
-No need char
-Starting character set: C a b c d
-
-/a$/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
- a
- 0: a
- a\n
- 0: a
- *** Failers
-No match
- \Za
-No match
- \Za\n
-No match
-
-/a$/m
-Capturing subpattern count = 0
-Options: multiline
-First char = 'a'
-No need char
- a
- 0: a
- a\n
- 0: a
- \Za\n
- 0: a
- *** Failers
-No match
- \Za
-No match
-
-/\Aabc/m
-Capturing subpattern count = 0
-Options: anchored multiline
-No first char
-Need char = 'c'
-
-/^abc/m
-Capturing subpattern count = 0
-Options: multiline
-First char at start or follows \n
-Need char = 'c'
-
-/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/
-Capturing subpattern count = 5
-Options: anchored
-No first char
-Need char = 'a'
- aaaaabbbbbcccccdef
- 0: aaaaabbbbbcccccdef
- 1: aaaaabbbbbcccccdef
- 2: aaaaa
- 3: b
- 4: bbbbccccc
- 5: def
-
-/(?<=foo)[ab]/S
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: a b
-
-/(?<!foo)(alpha|omega)/S
-Capturing subpattern count = 1
-No options
-No first char
-Need char = 'a'
-Starting character set: a o
-
-/(?!alphabet)[ab]/S
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: a b
-
-/(?<=foo\n)^bar/m
-Capturing subpattern count = 0
-Options: multiline
-First char at start or follows \n
-Need char = 'r'
-
-/(?>^abc)/m
-Capturing subpattern count = 0
-Options: multiline
-First char at start or follows \n
-Need char = 'c'
- abc
- 0: abc
- def\nabc
- 0: abc
- *** Failers
-No match
- defabc
-No match
-
-/(?<=ab(c+)d)ef/
-Failed: lookbehind assertion is not fixed length at offset 11
-
-/(?<=ab(?<=c+)d)ef/
-Failed: lookbehind assertion is not fixed length at offset 12
-
-/(?<=ab(c|de)f)g/
-Failed: lookbehind assertion is not fixed length at offset 13
-
-/The next three are in testinput2 because they have variable length branches/
-Capturing subpattern count = 0
-No options
-First char = 'T'
-Need char = 's'
-
-/(?<=bullock|donkey)-cart/
-Capturing subpattern count = 0
-No options
-First char = '-'
-Need char = 't'
- the bullock-cart
- 0: -cart
- a donkey-cart race
- 0: -cart
- *** Failers
-No match
- cart
-No match
- horse-and-cart
-No match
-
-/(?<=ab(?i)x|y|z)/
-Capturing subpattern count = 0
-No options
-Case state changes
-No first char
-No need char
-
-/(?>.*)(?<=(abcd)|(xyz))/
-Capturing subpattern count = 2
-No options
-First char at start or follows \n
-No need char
- alphabetabcd
- 0: alphabetabcd
- 1: abcd
- endingxyz
- 0: endingxyz
- 1: <unset>
- 2: xyz
-
-/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/
-Capturing subpattern count = 0
-No options
-Case state changes
-First char = 'Z'
-Need char = 'Z'
- abxyZZ
- 0: ZZ
- abXyZZ
- 0: ZZ
- ZZZ
- 0: ZZ
- zZZ
- 0: ZZ
- bZZ
- 0: ZZ
- BZZ
- 0: ZZ
- *** Failers
-No match
- ZZ
-No match
- abXYZZ
-No match
- zzz
-No match
- bzz
-No match
-
-/(?<!(foo)a)bar/
-Capturing subpattern count = 1
-No options
-First char = 'b'
-Need char = 'r'
- bar
- 0: bar
- foobbar
- 0: bar
- *** Failers
-No match
- fooabar
-No match
-
-/This one is here because Perl 5.005_02 doesn't fail it/
-Capturing subpattern count = 0
-No options
-First char = 'T'
-Need char = 't'
-
-/^(a)?(?(1)a|b)+$/
-Capturing subpattern count = 1
-Options: anchored
-No first char
-No need char
- *** Failers
-No match
- a
-No match
-
-/This one is here because I think Perl 5.005_02 gets the setting of $1 wrong/
-Capturing subpattern count = 0
-No options
-First char = 'T'
-Need char = 'g'
-
-/^(a\1?){4}$/
-Capturing subpattern count = 1
-Max back reference = 1
-Options: anchored
-No first char
-Need char = 'a'
- aaaaaa
- 0: aaaaaa
- 1: aa
-
-/These are syntax tests from Perl 5.005/
-Capturing subpattern count = 0
-No options
-First char = 'T'
-Need char = '5'
-
-/a[b-a]/
-Failed: range out of order in character class at offset 4
-
-/a[]b/
-Failed: missing terminating ] for character class at offset 4
-
-/a[/
-Failed: missing terminating ] for character class at offset 2
-
-/*a/
-Failed: nothing to repeat at offset 0
-
-/(*)b/
-Failed: nothing to repeat at offset 1
-
-/abc)/
-Failed: unmatched parentheses at offset 3
-
-/(abc/
-Failed: missing ) at offset 4
-
-/a**/
-Failed: nothing to repeat at offset 2
-
-/)(/
-Failed: unmatched parentheses at offset 0
-
-/\1/
-Failed: reference to non-existent subpattern at offset 2
-
-/\2/
-Failed: reference to non-existent subpattern at offset 2
-
-/(a)|\2/
-Failed: reference to non-existent subpattern at offset 6
-
-/a[b-a]/i
-Failed: range out of order in character class at offset 4
-
-/a[]b/i
-Failed: missing terminating ] for character class at offset 4
-
-/a[/i
-Failed: missing terminating ] for character class at offset 2
-
-/*a/i
-Failed: nothing to repeat at offset 0
-
-/(*)b/i
-Failed: nothing to repeat at offset 1
-
-/abc)/i
-Failed: unmatched parentheses at offset 3
-
-/(abc/i
-Failed: missing ) at offset 4
-
-/a**/i
-Failed: nothing to repeat at offset 2
-
-/)(/i
-Failed: unmatched parentheses at offset 0
-
-/:(?:/
-Failed: missing ) at offset 4
-
-/(?<%)b/
-Failed: unrecognized character after (?< at offset 3
-
-/a(?{)b/
-Failed: unrecognized character after (? at offset 3
-
-/a(?{{})b/
-Failed: unrecognized character after (? at offset 3
-
-/a(?{}})b/
-Failed: unrecognized character after (? at offset 3
-
-/a(?{"{"})b/
-Failed: unrecognized character after (? at offset 3
-
-/a(?{"{"}})b/
-Failed: unrecognized character after (? at offset 3
-
-/(?(1?)a|b)/
-Failed: malformed number after (?( at offset 4
-
-/(?(1)a|b|c)/
-Failed: conditional group contains more than two branches at offset 10
-
-/[a[:xyz:/
-Failed: missing terminating ] for character class at offset 8
-
-/(?<=x+)y/
-Failed: lookbehind assertion is not fixed length at offset 6
-
-/a{37,17}/
-Failed: numbers out of order in {} quantifier at offset 7
-
-/abc/\
-Failed: \ at end of pattern at offset 4
-
-/abc/\P
-Failed: POSIX code 9: bad escape sequence at offset 4
-
-/abc/\i
-Failed: \ at end of pattern at offset 4
-
-/(a)bc(d)/
-Capturing subpattern count = 2
-No options
-First char = 'a'
-Need char = 'd'
- abcd
- 0: abcd
- 1: a
- 2: d
- abcd\C2
- 0: abcd
- 1: a
- 2: d
- 2C d (1)
- abcd\C5
- 0: abcd
- 1: a
- 2: d
-copy substring 5 failed -7
-
-/(.{20})/
-Capturing subpattern count = 1
-No options
-No first char
-No need char
- abcdefghijklmnopqrstuvwxyz
- 0: abcdefghijklmnopqrst
- 1: abcdefghijklmnopqrst
- abcdefghijklmnopqrstuvwxyz\C1
- 0: abcdefghijklmnopqrst
- 1: abcdefghijklmnopqrst
-copy substring 1 failed -6
- abcdefghijklmnopqrstuvwxyz\G1
- 0: abcdefghijklmnopqrst
- 1: abcdefghijklmnopqrst
- 1G abcdefghijklmnopqrst (20)
-
-/(.{15})/
-Capturing subpattern count = 1
-No options
-No first char
-No need char
- abcdefghijklmnopqrstuvwxyz
- 0: abcdefghijklmno
- 1: abcdefghijklmno
- abcdefghijklmnopqrstuvwxyz\C1\G1
- 0: abcdefghijklmno
- 1: abcdefghijklmno
- 1C abcdefghijklmno (15)
- 1G abcdefghijklmno (15)
-
-/(.{16})/
-Capturing subpattern count = 1
-No options
-No first char
-No need char
- abcdefghijklmnopqrstuvwxyz
- 0: abcdefghijklmnop
- 1: abcdefghijklmnop
- abcdefghijklmnopqrstuvwxyz\C1\G1\L
- 0: abcdefghijklmnop
- 1: abcdefghijklmnop
-copy substring 1 failed -6
- 1G abcdefghijklmnop (16)
- 0L abcdefghijklmnop
- 1L abcdefghijklmnop
-
-/^(a|(bc))de(f)/
-Capturing subpattern count = 3
-Options: anchored
-No first char
-Need char = 'f'
- adef\G1\G2\G3\G4\L
- 0: adef
- 1: a
- 2: <unset>
- 3: f
- 1G a (1)
- 2G (0)
- 3G f (1)
-get substring 4 failed -7
- 0L adef
- 1L a
- 2L
- 3L f
- bcdef\G1\G2\G3\G4\L
- 0: bcdef
- 1: bc
- 2: bc
- 3: f
- 1G bc (2)
- 2G bc (2)
- 3G f (1)
-get substring 4 failed -7
- 0L bcdef
- 1L bc
- 2L bc
- 3L f
- adefghijk\C0
- 0: adef
- 1: a
- 2: <unset>
- 3: f
- 0C adef (4)
-
-/^abc\00def/
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 'f'
- abc\00def\L\C0
- 0: abc\x00def
- 0C abc (7)
- 0L abc
-
-/word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
-)((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
-)?)?)?)?)?)?)?)?)?otherword/M
-Memory allocation (code space): 428
-Capturing subpattern count = 8
-No options
-First char = 'w'
-Need char = 'd'
-
-/.*X/D
-------------------------------------------------------------------
- 0 8 Bra 0
- 3 Any*
- 5 1 X
- 8 8 Ket
- 11 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char at start or follows \n
-Need char = 'X'
-
-/.*X/Ds
-------------------------------------------------------------------
- 0 8 Bra 0
- 3 Any*
- 5 1 X
- 8 8 Ket
- 11 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored dotall
-No first char
-Need char = 'X'
-
-/(.*X|^B)/D
-------------------------------------------------------------------
- 0 21 Bra 0
- 3 8 Bra 1
- 6 Any*
- 8 1 X
- 11 7 Alt
- 14 ^
- 15 1 B
- 18 15 Ket
- 21 21 Ket
- 24 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-No options
-First char at start or follows \n
-No need char
-
-/(.*X|^B)/Ds
-------------------------------------------------------------------
- 0 21 Bra 0
- 3 8 Bra 1
- 6 Any*
- 8 1 X
- 11 7 Alt
- 14 ^
- 15 1 B
- 18 15 Ket
- 21 21 Ket
- 24 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-Options: anchored dotall
-No first char
-No need char
-
-/(?s)(.*X|^B)/D
-------------------------------------------------------------------
- 0 21 Bra 0
- 3 8 Bra 1
- 6 Any*
- 8 1 X
- 11 7 Alt
- 14 ^
- 15 1 B
- 18 15 Ket
- 21 21 Ket
- 24 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-Options: anchored dotall
-No first char
-No need char
-
-/(?s:.*X|^B)/D
-------------------------------------------------------------------
- 0 27 Bra 0
- 3 10 Bra 0
- 6 04 Opt
- 8 Any*
- 10 1 X
- 13 9 Alt
- 16 04 Opt
- 18 ^
- 19 1 B
- 22 19 Ket
- 25 00 Opt
- 27 27 Ket
- 30 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char at start or follows \n
-No need char
-
-/\Biss\B/+
-Capturing subpattern count = 0
-No options
-First char = 'i'
-Need char = 's'
- Mississippi
- 0: iss
- 0+ issippi
-
-/\Biss\B/+P
- Mississippi
- 0: iss
- 0+ issippi
-
-/iss/G+
-Capturing subpattern count = 0
-No options
-First char = 'i'
-Need char = 's'
- Mississippi
- 0: iss
- 0+ issippi
- 0: iss
- 0+ ippi
-
-/\Biss\B/G+
-Capturing subpattern count = 0
-No options
-First char = 'i'
-Need char = 's'
- Mississippi
- 0: iss
- 0+ issippi
-
-/\Biss\B/g+
-Capturing subpattern count = 0
-No options
-First char = 'i'
-Need char = 's'
- Mississippi
- 0: iss
- 0+ issippi
- 0: iss
- 0+ ippi
- *** Failers
-No match
- Mississippi\A
-No match
-
-/(?<=[Ms])iss/g+
-Capturing subpattern count = 0
-No options
-First char = 'i'
-Need char = 's'
- Mississippi
- 0: iss
- 0+ issippi
- 0: iss
- 0+ ippi
-
-/(?<=[Ms])iss/G+
-Capturing subpattern count = 0
-No options
-First char = 'i'
-Need char = 's'
- Mississippi
- 0: iss
- 0+ issippi
-
-/^iss/g+
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 's'
- ississippi
- 0: iss
- 0+ issippi
-
-/.*iss/g+
-Capturing subpattern count = 0
-No options
-First char at start or follows \n
-Need char = 's'
- abciss\nxyzisspqr
- 0: abciss
- 0+ \x0axyzisspqr
- 0: xyziss
- 0+ pqr
-
-/.i./+g
-Capturing subpattern count = 0
-No options
-No first char
-Need char = 'i'
- Mississippi
- 0: Mis
- 0+ sissippi
- 0: sis
- 0+ sippi
- 0: sip
- 0+ pi
- Mississippi\A
- 0: Mis
- 0+ sissippi
- 0: sis
- 0+ sippi
- 0: sip
- 0+ pi
- Missouri river
- 0: Mis
- 0+ souri river
- 0: ri
- 0+ river
- 0: riv
- 0+ er
- Missouri river\A
- 0: Mis
- 0+ souri river
-
-/^.is/+g
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 's'
- Mississippi
- 0: Mis
- 0+ sissippi
-
-/^ab\n/g+
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 10
- ab\nab\ncd
- 0: ab\x0a
- 0+ ab\x0acd
-
-/^ab\n/mg+
-Capturing subpattern count = 0
-Options: multiline
-First char at start or follows \n
-Need char = 10
- ab\nab\ncd
- 0: ab\x0a
- 0+ ab\x0acd
- 0: ab\x0a
- 0+ cd
-
-/abc/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
-
-/abc|bac/
-Capturing subpattern count = 0
-No options
-No first char
-Need char = 'c'
-
-/(abc|bac)/
-Capturing subpattern count = 1
-No options
-No first char
-Need char = 'c'
-
-/(abc|(c|dc))/
-Capturing subpattern count = 2
-No options
-No first char
-Need char = 'c'
-
-/(abc|(d|de)c)/
-Capturing subpattern count = 2
-No options
-No first char
-Need char = 'c'
-
-/a*/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/a+/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/(baa|a+)/
-Capturing subpattern count = 1
-No options
-No first char
-Need char = 'a'
-
-/a{0,3}/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/baa{3,}/
-Capturing subpattern count = 0
-No options
-First char = 'b'
-Need char = 'a'
-
-/"([^\\"]+|\\.)*"/
-Capturing subpattern count = 1
-No options
-First char = '"'
-Need char = '"'
-
-/(abc|ab[cd])/
-Capturing subpattern count = 1
-No options
-First char = 'a'
-No need char
-
-/(a|.)/
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-
-/a|ba|\w/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/abc(?=pqr)/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'r'
-
-/...(?<=abc)/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/abc(?!pqr)/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
-
-/ab./
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/ab[xyz]/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/abc*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/ab.c*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/a.c*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/.c*/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/ac*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/(a.c*|b.c*)/
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-
-/a.c*|aba/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/.+a/
-Capturing subpattern count = 0
-No options
-No first char
-Need char = 'a'
-
-/(?=abcda)a.*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'a'
-
-/(?=a)a.*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/a(b)*/
-Capturing subpattern count = 1
-No options
-First char = 'a'
-No need char
-
-/a\d*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/ab\d*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/a(\d)*/
-Capturing subpattern count = 1
-No options
-First char = 'a'
-No need char
-
-/abcde{0,0}/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'd'
-
-/ab\d+/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/a(?(1)b)/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/a(?(1)bag|big)/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'g'
-
-/a(?(1)bag|big)*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/a(?(1)bag|big)+/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'g'
-
-/a(?(1)b..|b..)/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/ab\d{0}e/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'e'
-
-/a?b?/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
- a
- 0: a
- b
- 0: b
- ab
- 0: ab
- \
- 0:
- *** Failers
- 0:
- \N
-No match
-
-/|-/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
- abcd
- 0:
- -abc
- 0:
- \Nab-c
- 0: -
- *** Failers
- 0:
- \Nabc
-No match
-
-/a*(b+)(z)(z)/P
- aaaabbbbzzzz
- 0: aaaabbbbzz
- 1: bbbb
- 2: z
- 3: z
- aaaabbbbzzzz\O0
- aaaabbbbzzzz\O1
- 0: aaaabbbbzz
- aaaabbbbzzzz\O2
- 0: aaaabbbbzz
- 1: bbbb
- aaaabbbbzzzz\O3
- 0: aaaabbbbzz
- 1: bbbb
- 2: z
- aaaabbbbzzzz\O4
- 0: aaaabbbbzz
- 1: bbbb
- 2: z
- 3: z
- aaaabbbbzzzz\O5
- 0: aaaabbbbzz
- 1: bbbb
- 2: z
- 3: z
-
-/^.?abcd/S
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 'd'
-Study returned NULL
-
-/\( # ( at start
- (?: # Non-capturing bracket
- (?>[^()]+) # Either a sequence of non-brackets (no backtracking)
- | # Or
- (?R) # Recurse - i.e. nested bracketed string
- )* # Zero or more contents
- \) # Closing )
- /x
-Capturing subpattern count = 0
-Options: extended
-First char = '('
-Need char = ')'
- (abcd)
- 0: (abcd)
- (abcd)xyz
- 0: (abcd)
- xyz(abcd)
- 0: (abcd)
- (ab(xy)cd)pqr
- 0: (ab(xy)cd)
- (ab(xycd)pqr
- 0: (xycd)
- () abc ()
- 0: ()
- 12(abcde(fsh)xyz(foo(bar))lmno)89
- 0: (abcde(fsh)xyz(foo(bar))lmno)
- *** Failers
-No match
- abcd
-No match
- abcd)
-No match
- (abcd
-No match
-
-/\( ( (?>[^()]+) | (?R) )* \) /xg
-Capturing subpattern count = 1
-Options: extended
-First char = '('
-Need char = ')'
- (ab(xy)cd)pqr
- 0: (ab(xy)cd)
- 1: cd
- 1(abcd)(x(y)z)pqr
- 0: (abcd)
- 1: abcd
- 0: (x(y)z)
- 1: z
-
-/\( (?: (?>[^()]+) | (?R) ) \) /x
-Capturing subpattern count = 0
-Options: extended
-First char = '('
-Need char = ')'
- (abcd)
- 0: (abcd)
- (ab(xy)cd)
- 0: (xy)
- (a(b(c)d)e)
- 0: (c)
- ((ab))
- 0: ((ab))
- *** Failers
-No match
- ()
-No match
-
-/\( (?: (?>[^()]+) | (?R) )? \) /x
-Capturing subpattern count = 0
-Options: extended
-First char = '('
-Need char = ')'
- ()
- 0: ()
- 12(abcde(fsh)xyz(foo(bar))lmno)89
- 0: (fsh)
-
-/\( ( (?>[^()]+) | (?R) )* \) /x
-Capturing subpattern count = 1
-Options: extended
-First char = '('
-Need char = ')'
- (ab(xy)cd)
- 0: (ab(xy)cd)
- 1: cd
-
-/\( ( ( (?>[^()]+) | (?R) )* ) \) /x
-Capturing subpattern count = 2
-Options: extended
-First char = '('
-Need char = ')'
- (ab(xy)cd)
- 0: (ab(xy)cd)
- 1: ab(xy)cd
- 2: cd
-
-/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /x
-Capturing subpattern count = 3
-Options: extended
-First char = '('
-Need char = ')'
- (ab(xy)cd)
- 0: (ab(xy)cd)
- 1: <unset>
- 2: ab(xy)cd
- 3: cd
- (123ab(xy)cd)
- 0: (123ab(xy)cd)
- 1: 123
- 2: ab(xy)cd
- 3: cd
-
-/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /x
-Capturing subpattern count = 3
-Options: extended
-First char = '('
-Need char = ')'
- (ab(xy)cd)
- 0: (ab(xy)cd)
- 1: ab(xy)cd
- 2: <unset>
- 3: cd
- (123ab(xy)cd)
- 0: (123ab(xy)cd)
- 1: 123ab(xy)cd
- 2: 123
- 3: cd
-
-/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /x
-Capturing subpattern count = 11
-Options: extended
-First char = '('
-Need char = ')'
- (ab(xy)cd)
- 0: (ab(xy)cd)
- 1: ab(xy)cd
- 2: ab(xy)cd
- 3: ab(xy)cd
- 4: ab(xy)cd
- 5: ab(xy)cd
- 6: ab(xy)cd
- 7: ab(xy)cd
- 8: ab(xy)cd
- 9: ab(xy)cd
-10: ab(xy)cd
-11: cd
-
-/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /x
-Capturing subpattern count = 3
-Options: extended
-First char = '('
-Need char = ')'
- (abcd(xyz<p>qrs)123)
- 0: (abcd(xyz<p>qrs)123)
- 1: abcd(xyz<p>qrs)123
- 2: 123
- 3: <unset>
-
-/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /x
-Capturing subpattern count = 3
-Options: extended
-First char = '('
-Need char = ')'
- (ab(cd)ef)
- 0: (ab(cd)ef)
- 1: ab(cd)ef
- 2: ef
- 3: (cd)
- (ab(cd(ef)gh)ij)
- 0: (ab(cd(ef)gh)ij)
- 1: ab(cd(ef)gh)ij
- 2: ij
- 3: (cd(ef)gh)
-
-/^[[:alnum:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [0-9A-Za-z]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:alpha:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [A-Za-z]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:ascii:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [\x00-\x7f]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:blank:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [\x09 ]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:cntrl:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [\x00-\x1f\x7f]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:digit:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [0-9]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:graph:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [!-~]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:lower:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [a-z]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:print:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [ -~]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:punct:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [!-/:-@[-`{-~]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:space:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [\x09-\x0d ]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:upper:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [A-Z]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:xdigit:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [0-9A-Fa-f]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:word:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [0-9A-Z_a-z]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:^cntrl:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [ -~\x80-\xff]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[12[:^digit:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [\x00-/1-2:-\xff]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:^blank:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [\x00-\x08\x0a-\x1f!-\xff]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/[01[:alpha:]%]/D
-------------------------------------------------------------------
- 0 36 Bra 0
- 3 [%0-1A-Za-z]
- 36 36 Ket
- 39 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/[[.ch.]]/
-Failed: POSIX collating elements are not supported at offset 1
-
-/[[=ch=]]/
-Failed: POSIX collating elements are not supported at offset 1
-
-/[[:rhubarb:]]/
-Failed: unknown POSIX class name at offset 3
-
-/[[:upper:]]/i
-Capturing subpattern count = 0
-Options: caseless
-No first char
-No need char
- A
- 0: A
- a
- 0: a
-
-/[[:lower:]]/i
-Capturing subpattern count = 0
-Options: caseless
-No first char
-No need char
- A
- 0: A
- a
- 0: a
-
-/((?-i)[[:lower:]])[[:lower:]]/i
-Capturing subpattern count = 1
-Options: caseless
-Case state changes
-No first char
-No need char
- ab
- 0: ab
- 1: a
- aB
- 0: aB
- 1: a
- *** Failers
- 0: ai
- 1: a
- Ab
-No match
- AB
-No match
-
-/[\200-\410]/
-Failed: range out of order in character class at offset 9
-
-/^(?(0)f|b)oo/
-Failed: invalid condition (?(0) at offset 5
-
-/This one's here because of the large output vector needed/
-Capturing subpattern count = 0
-No options
-First char = 'T'
-Need char = 'd'
-
-/(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/
-Capturing subpattern count = 271
-Max back reference = 270
-No options
-No first char
-No need char
- \O900 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 ABC ABC
- 0: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 ABC ABC
- 1: 1
- 2: 2
- 3: 3
- 4: 4
- 5: 5
- 6: 6
- 7: 7
- 8: 8
- 9: 9
-10: 10
-11: 11
-12: 12
-13: 13
-14: 14
-15: 15
-16: 16
-17: 17
-18: 18
-19: 19
-20: 20
-21: 21
-22: 22
-23: 23
-24: 24
-25: 25
-26: 26
-27: 27
-28: 28
-29: 29
-30: 30
-31: 31
-32: 32
-33: 33
-34: 34
-35: 35
-36: 36
-37: 37
-38: 38
-39: 39
-40: 40
-41: 41
-42: 42
-43: 43
-44: 44
-45: 45
-46: 46
-47: 47
-48: 48
-49: 49
-50: 50
-51: 51
-52: 52
-53: 53
-54: 54
-55: 55
-56: 56
-57: 57
-58: 58
-59: 59
-60: 60
-61: 61
-62: 62
-63: 63
-64: 64
-65: 65
-66: 66
-67: 67
-68: 68
-69: 69
-70: 70
-71: 71
-72: 72
-73: 73
-74: 74
-75: 75
-76: 76
-77: 77
-78: 78
-79: 79
-80: 80
-81: 81
-82: 82
-83: 83
-84: 84
-85: 85
-86: 86
-87: 87
-88: 88
-89: 89
-90: 90
-91: 91
-92: 92
-93: 93
-94: 94
-95: 95
-96: 96
-97: 97
-98: 98
-99: 99
-100: 100
-101: 101
-102: 102
-103: 103
-104: 104
-105: 105
-106: 106
-107: 107
-108: 108
-109: 109
-110: 110
-111: 111
-112: 112
-113: 113
-114: 114
-115: 115
-116: 116
-117: 117
-118: 118
-119: 119
-120: 120
-121: 121
-122: 122
-123: 123
-124: 124
-125: 125
-126: 126
-127: 127
-128: 128
-129: 129
-130: 130
-131: 131
-132: 132
-133: 133
-134: 134
-135: 135
-136: 136
-137: 137
-138: 138
-139: 139
-140: 140
-141: 141
-142: 142
-143: 143
-144: 144
-145: 145
-146: 146
-147: 147
-148: 148
-149: 149
-150: 150
-151: 151
-152: 152
-153: 153
-154: 154
-155: 155
-156: 156
-157: 157
-158: 158
-159: 159
-160: 160
-161: 161
-162: 162
-163: 163
-164: 164
-165: 165
-166: 166
-167: 167
-168: 168
-169: 169
-170: 170
-171: 171
-172: 172
-173: 173
-174: 174
-175: 175
-176: 176
-177: 177
-178: 178
-179: 179
-180: 180
-181: 181
-182: 182
-183: 183
-184: 184
-185: 185
-186: 186
-187: 187
-188: 188
-189: 189
-190: 190
-191: 191
-192: 192
-193: 193
-194: 194
-195: 195
-196: 196
-197: 197
-198: 198
-199: 199
-200: 200
-201: 201
-202: 202
-203: 203
-204: 204
-205: 205
-206: 206
-207: 207
-208: 208
-209: 209
-210: 210
-211: 211
-212: 212
-213: 213
-214: 214
-215: 215
-216: 216
-217: 217
-218: 218
-219: 219
-220: 220
-221: 221
-222: 222
-223: 223
-224: 224
-225: 225
-226: 226
-227: 227
-228: 228
-229: 229
-230: 230
-231: 231
-232: 232
-233: 233
-234: 234
-235: 235
-236: 236
-237: 237
-238: 238
-239: 239
-240: 240
-241: 241
-242: 242
-243: 243
-244: 244
-245: 245
-246: 246
-247: 247
-248: 248
-249: 249
-250: 250
-251: 251
-252: 252
-253: 253
-254: 254
-255: 255
-256: 256
-257: 257
-258: 258
-259: 259
-260: 260
-261: 261
-262: 262
-263: 263
-264: 264
-265: 265
-266: 266
-267: 267
-268: 268
-269: 269
-270: ABC
-271: ABC
-
-/This one's here because Perl does this differently and PCRE can't at present/
-Capturing subpattern count = 0
-No options
-First char = 'T'
-Need char = 't'
-
-/(main(O)?)+/
-Capturing subpattern count = 2
-No options
-First char = 'm'
-Need char = 'n'
- mainmain
- 0: mainmain
- 1: main
- mainOmain
- 0: mainOmain
- 1: main
- 2: O
-
-/These are all cases where Perl does it differently (nested captures)/
-Capturing subpattern count = 1
-No options
-First char = 'T'
-Need char = 's'
-
-/^(a(b)?)+$/
-Capturing subpattern count = 2
-Options: anchored
-No first char
-Need char = 'a'
- aba
- 0: aba
- 1: a
- 2: b
-
-/^(aa(bb)?)+$/
-Capturing subpattern count = 2
-Options: anchored
-No first char
-Need char = 'a'
- aabbaa
- 0: aabbaa
- 1: aa
- 2: bb
-
-/^(aa|aa(bb))+$/
-Capturing subpattern count = 2
-Options: anchored
-No first char
-Need char = 'a'
- aabbaa
- 0: aabbaa
- 1: aa
- 2: bb
-
-/^(aa(bb)??)+$/
-Capturing subpattern count = 2
-Options: anchored
-No first char
-Need char = 'a'
- aabbaa
- 0: aabbaa
- 1: aa
- 2: bb
-
-/^(?:aa(bb)?)+$/
-Capturing subpattern count = 1
-Options: anchored
-No first char
-Need char = 'a'
- aabbaa
- 0: aabbaa
- 1: bb
-
-/^(aa(b(b))?)+$/
-Capturing subpattern count = 3
-Options: anchored
-No first char
-Need char = 'a'
- aabbaa
- 0: aabbaa
- 1: aa
- 2: bb
- 3: b
-
-/^(?:aa(b(b))?)+$/
-Capturing subpattern count = 2
-Options: anchored
-No first char
-Need char = 'a'
- aabbaa
- 0: aabbaa
- 1: bb
- 2: b
-
-/^(?:aa(b(?:b))?)+$/
-Capturing subpattern count = 1
-Options: anchored
-No first char
-Need char = 'a'
- aabbaa
- 0: aabbaa
- 1: bb
-
-/^(?:aa(bb(?:b))?)+$/
-Capturing subpattern count = 1
-Options: anchored
-No first char
-Need char = 'a'
- aabbbaa
- 0: aabbbaa
- 1: bbb
-
-/^(?:aa(b(?:bb))?)+$/
-Capturing subpattern count = 1
-Options: anchored
-No first char
-Need char = 'a'
- aabbbaa
- 0: aabbbaa
- 1: bbb
-
-/^(?:aa(?:b(b))?)+$/
-Capturing subpattern count = 1
-Options: anchored
-No first char
-Need char = 'a'
- aabbaa
- 0: aabbaa
- 1: b
-
-/^(?:aa(?:b(bb))?)+$/
-Capturing subpattern count = 1
-Options: anchored
-No first char
-Need char = 'a'
- aabbbaa
- 0: aabbbaa
- 1: bb
-
-/^(aa(b(bb))?)+$/
-Capturing subpattern count = 3
-Options: anchored
-No first char
-Need char = 'a'
- aabbbaa
- 0: aabbbaa
- 1: aa
- 2: bbb
- 3: bb
-
-/^(aa(bb(bb))?)+$/
-Capturing subpattern count = 3
-Options: anchored
-No first char
-Need char = 'a'
- aabbbbaa
- 0: aabbbbaa
- 1: aa
- 2: bbbb
- 3: bb
-
-/--------------------------------------------------------------------/
-Capturing subpattern count = 0
-No options
-First char = '-'
-Need char = '-'
-
-/#/xMD
-Memory allocation (code space): 7
-------------------------------------------------------------------
- 0 3 Bra 0
- 3 3 Ket
- 6 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: extended
-No first char
-No need char
-
-/a#/xMD
-Memory allocation (code space): 13
-------------------------------------------------------------------
- 0 6 Bra 0
- 3 1 a
- 6 6 Ket
- 9 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: extended
-First char = 'a'
-No need char
-
-/[\s]/D
-------------------------------------------------------------------
- 0 36 Bra 0
- 3 [\x09-\x0a\x0c-\x0d ]
- 36 36 Ket
- 39 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/[\S]/D
-------------------------------------------------------------------
- 0 36 Bra 0
- 3 [\x00-\x08\x0b\x0e-\x1f!-\xff]
- 36 36 Ket
- 39 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/a(?i)b/D
-------------------------------------------------------------------
- 0 11 Bra 0
- 3 1 a
- 6 01 Opt
- 8 1 b
- 11 11 Ket
- 14 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-Case state changes
-First char = 'a'
-Need char = 'b' (caseless)
- ab
- 0: ab
- aB
- 0: aB
- *** Failers
-No match
- AB
-No match
-
-/(a(?i)b)/D
-------------------------------------------------------------------
- 0 19 Bra 0
- 3 11 Bra 1
- 6 1 a
- 9 01 Opt
- 11 1 b
- 14 11 Ket
- 17 00 Opt
- 19 19 Ket
- 22 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-No options
-Case state changes
-First char = 'a'
-Need char = 'b' (caseless)
- ab
- 0: ab
- 1: ab
- aB
- 0: aB
- 1: aB
- *** Failers
-No match
- AB
-No match
-
-/ (?i)abc/xD
-------------------------------------------------------------------
- 0 8 Bra 0
- 3 3 abc
- 8 8 Ket
- 11 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: caseless extended
-First char = 'a' (caseless)
-Need char = 'c' (caseless)
-
-/#this is a comment
- (?i)abc/xD
-------------------------------------------------------------------
- 0 8 Bra 0
- 3 3 abc
- 8 8 Ket
- 11 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: caseless extended
-First char = 'a' (caseless)
-Need char = 'c' (caseless)
-
-/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/D
-------------------------------------------------------------------
- 0 307 Bra 0
- 3 250 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
-255 50 12345678901234567890123456789012345678901234567890
-307 307 Ket
-310 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char = '1'
-Need char = '0'
-
-/\Q123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/D
-------------------------------------------------------------------
- 0 307 Bra 0
- 3 250 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
-255 50 12345678901234567890123456789012345678901234567890
-307 307 Ket
-310 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char = '1'
-Need char = '0'
-
-/\Q\E/D
-------------------------------------------------------------------
- 0 3 Bra 0
- 3 3 Ket
- 6 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-No first char
-No need char
- \
- 0:
-
-/\Q\Ex/D
-------------------------------------------------------------------
- 0 6 Bra 0
- 3 1 x
- 6 6 Ket
- 9 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char = 'x'
-No need char
-
-/ \Q\E/D
-------------------------------------------------------------------
- 0 6 Bra 0
- 3 1
- 6 6 Ket
- 9 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char = ' '
-No need char
-
-/a\Q\E/D
-------------------------------------------------------------------
- 0 6 Bra 0
- 3 1 a
- 6 6 Ket
- 9 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
- abc
- 0: a
- bca
- 0: a
- bac
- 0: a
-
-/a\Q\Eb/D
-------------------------------------------------------------------
- 0 9 Bra 0
- 3 1 a
- 6 1 b
- 9 9 Ket
- 12 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
- abc
- 0: ab
-
-/\Q\Eabc/D
-------------------------------------------------------------------
- 0 8 Bra 0
- 3 3 abc
- 8 8 Ket
- 11 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
-
-/x*+\w/D
-------------------------------------------------------------------
- 0 12 Bra 0
- 3 5 Once
- 6 x*
- 8 5 Ket
- 11 \w
- 12 12 Ket
- 15 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-No first char
-No need char
- ****Failers
- 0: F
- xxxxx
-No match
-
-/x?+/D
-------------------------------------------------------------------
- 0 11 Bra 0
- 3 5 Once
- 6 x?
- 8 5 Ket
- 11 11 Ket
- 14 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/x++/D
-------------------------------------------------------------------
- 0 11 Bra 0
- 3 5 Once
- 6 x+
- 8 5 Ket
- 11 11 Ket
- 14 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char = 'x'
-No need char
-
-/x{1,3}+/D
-------------------------------------------------------------------
- 0 16 Bra 0
- 3 10 Once
- 6 1 x
- 9 x{,2}
- 13 10 Ket
- 16 16 Ket
- 19 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char = 'x'
-No need char
-
-/(x)*+/D
-------------------------------------------------------------------
- 0 19 Bra 0
- 3 13 Once
- 6 Brazero
- 7 6 Bra 1
- 10 1 x
- 13 6 KetRmax
- 16 13 Ket
- 19 19 Ket
- 22 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-
-/^(\w++|\s++)*$/
-Capturing subpattern count = 1
-Options: anchored
-No first char
-No need char
- now is the time for all good men to come to the aid of the party
- 0: now is the time for all good men to come to the aid of the party
- 1: party
- *** Failers
-No match
- this is not a line with only words and spaces!
-No match
-
-/(\d++)(\w)/
-Capturing subpattern count = 2
-No options
-No first char
-No need char
- 12345a
- 0: 12345a
- 1: 12345
- 2: a
- *** Failers
-No match
- 12345+
-No match
-
-/a++b/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
- aaab
- 0: aaab
-
-/(a++b)/
-Capturing subpattern count = 1
-No options
-First char = 'a'
-Need char = 'b'
- aaab
- 0: aaab
- 1: aaab
-
-/(a++)b/
-Capturing subpattern count = 1
-No options
-First char = 'a'
-Need char = 'b'
- aaab
- 0: aaab
- 1: aaa
-
-/([^()]++|\([^()]*\))+/
-Capturing subpattern count = 1
-No options
-No first char
-No need char
- ((abc(ade)ufh()()x
- 0: abc(ade)ufh()()x
- 1: x
-
-/\(([^()]++|\([^()]+\))+\)/
-Capturing subpattern count = 1
-No options
-First char = '('
-Need char = ')'
- (abc)
- 0: (abc)
- 1: abc
- (abc(def)xyz)
- 0: (abc(def)xyz)
- 1: xyz
- *** Failers
-No match
- ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-No match
-
-/(abc){1,3}+/D
-------------------------------------------------------------------
- 0 50 Bra 0
- 3 44 Once
- 6 8 Bra 1
- 9 3 abc
- 14 8 Ket
- 17 Brazero
- 18 26 Bra 0
- 21 8 Bra 1
- 24 3 abc
- 29 8 Ket
- 32 Brazero
- 33 8 Bra 1
- 36 3 abc
- 41 8 Ket
- 44 26 Ket
- 47 44 Ket
- 50 50 Ket
- 53 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-No options
-First char = 'a'
-Need char = 'c'
-
-/a+?+/
-Failed: nothing to repeat at offset 3
-
-/a{2,3}?+b/
-Failed: nothing to repeat at offset 7
-
-/(?U)a+?+/
-Failed: nothing to repeat at offset 7
-
-/a{2,3}?+b/U
-Failed: nothing to repeat at offset 7
-
-/x(?U)a++b/D
-------------------------------------------------------------------
- 0 17 Bra 0
- 3 1 x
- 6 5 Once
- 9 a+
- 11 5 Ket
- 14 1 b
- 17 17 Ket
- 20 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char = 'x'
-Need char = 'b'
- xaaaab
- 0: xaaaab
-
-/(?U)xa++b/D
-------------------------------------------------------------------
- 0 17 Bra 0
- 3 1 x
- 6 5 Once
- 9 a+
- 11 5 Ket
- 14 1 b
- 17 17 Ket
- 20 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: ungreedy
-First char = 'x'
-Need char = 'b'
- xaaaab
- 0: xaaaab
-
-/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/D
-------------------------------------------------------------------
- 0 106 Bra 0
- 3 ^
- 4 99 Bra 1
- 7 5 Bra 2
- 10 a+
- 12 5 Ket
- 15 37 Bra 3
- 18 [a-b]+?
- 52 37 Ket
- 55 37 Bra 4
- 58 [b-c]+
- 92 37 Ket
- 95 5 Bra 5
- 98 \w*
-100 5 Ket
-103 99 Ket
-106 106 Ket
-109 End
-------------------------------------------------------------------
-Capturing subpattern count = 5
-Options: anchored
-No first char
-Need char = 'a'
-
-/^x(?U)a+b/D
-------------------------------------------------------------------
- 0 12 Bra 0
- 3 ^
- 4 1 x
- 7 a+?
- 9 1 b
- 12 12 Ket
- 15 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 'b'
-
-/^x(?U)(a+)b/D
-------------------------------------------------------------------
- 0 18 Bra 0
- 3 ^
- 4 1 x
- 7 5 Bra 1
- 10 a+?
- 12 5 Ket
- 15 1 b
- 18 18 Ket
- 21 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-Options: anchored
-No first char
-Need char = 'b'
-
-/[.x.]/
-Failed: POSIX collating elements are not supported at offset 0
-
-/[=x=]/
-Failed: POSIX collating elements are not supported at offset 0
-
-/[:x:]/
-Failed: POSIX named classes are supported only within a class at offset 0
-
-/\l/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
-
-/\L/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
-
-/\N{name}/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
-
-/\pP/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
-
-/\PP/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
-
-/\p{prop}/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
-
-/\P{prop}/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
-
-/\u/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
-
-/\U/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
-
-/\X/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
-
-/[/
-Failed: missing terminating ] for character class at offset 1
-
-/[a-/
-Failed: missing terminating ] for character class at offset 3
-
-/[[:space:]/
-Failed: missing terminating ] for character class at offset 10
-
-/[\s]/DM
-Memory allocation (code space): 40
-------------------------------------------------------------------
- 0 36 Bra 0
- 3 [\x09-\x0a\x0c-\x0d ]
- 36 36 Ket
- 39 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/[[:space:]]/DM
-Memory allocation (code space): 40
-------------------------------------------------------------------
- 0 36 Bra 0
- 3 [\x09-\x0d ]
- 36 36 Ket
- 39 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/[[:space:]abcde]/DM
-Memory allocation (code space): 40
-------------------------------------------------------------------
- 0 36 Bra 0
- 3 [\x09-\x0d a-e]
- 36 36 Ket
- 39 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >/x
-Capturing subpattern count = 0
-Options: extended
-First char = '<'
-Need char = '>'
- <>
- 0: <>
- <abcd>
- 0: <abcd>
- <abc <123> hij>
- 0: <abc <123> hij>
- <abc <def> hij>
- 0: <def>
- <abc<>def>
- 0: <abc<>def>
- <abc<>
- 0: <>
- *** Failers
-No match
- <abc
-No match
-
-|8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|DM
-Memory allocation (code space): 421
-------------------------------------------------------------------
- 0 417 Bra 0
- 3 250 8J$WE<.rX+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:
-255 159 x9'c[%z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
-416 \b
-417 417 Ket
-420 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char = '8'
-Need char = 'X'
-
-|\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|DM
-Memory allocation (code space): 416
-------------------------------------------------------------------
- 0 412 Bra 0
- 3 250 $<.X+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:x9'c[
-255 154 %z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
-411 \b
-412 412 Ket
-415 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char = '$'
-Need char = 'X'
-
-/(.*)\d+\1/I
-Capturing subpattern count = 1
-Max back reference = 1
-No options
-No first char
-No need char
-
-/(.*)\d+/I
-Capturing subpattern count = 1
-No options
-First char at start or follows \n
-No need char
-
-/(.*)\d+\1/Is
-Capturing subpattern count = 1
-Max back reference = 1
-Options: dotall
-No first char
-No need char
-
-/(.*)\d+/Is
-Capturing subpattern count = 1
-Options: anchored dotall
-No first char
-No need char
-
-/(.*(xyz))\d+\2/I
-Capturing subpattern count = 2
-Max back reference = 2
-No options
-No first char
-Need char = 'z'
-
-/((.*))\d+\1/I
-Capturing subpattern count = 2
-Max back reference = 1
-No options
-No first char
-No need char
- abc123bc
- 0: bc123bc
- 1: bc
- 2: bc
-
-/a[b]/I
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/(?=a).*/I
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/(?=abc).xyz/iI
-Capturing subpattern count = 0
-Options: caseless
-First char = 'a' (caseless)
-Need char = 'z' (caseless)
-
-/(?=abc)(?i).xyz/I
-Capturing subpattern count = 0
-No options
-Case state changes
-First char = 'a'
-Need char = 'z' (caseless)
-
-/(?=a)(?=b)/I
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/(?=.)a/I
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/((?=abcda)a)/I
-Capturing subpattern count = 1
-No options
-First char = 'a'
-Need char = 'a'
-
-/((?=abcda)ab)/I
-Capturing subpattern count = 1
-No options
-First char = 'a'
-Need char = 'b'
-
-/()a/I
-Capturing subpattern count = 1
-No options
-No first char
-Need char = 'a'
-
-/(?(1)ab|ac)/I
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/(?(1)abz|acz)/I
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'z'
-
-/(?(1)abz)/I
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/(?(1)abz)123/I
-Capturing subpattern count = 0
-No options
-No first char
-Need char = '3'
-
-/(a)+/I
-Capturing subpattern count = 1
-No options
-First char = 'a'
-No need char
-
-/(a){2,3}/I
-Capturing subpattern count = 1
-No options
-First char = 'a'
-Need char = 'a'
-
-/(a)*/I
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-
-/[a]/I
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/[ab]/I
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/[ab]/IS
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: a b
-
-/[^a]/I
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/\d456/I
-Capturing subpattern count = 0
-No options
-No first char
-Need char = '6'
-
-/\d456/IS
-Capturing subpattern count = 0
-No options
-No first char
-Need char = '6'
-Starting character set: 0 1 2 3 4 5 6 7 8 9
-
-/a^b/I
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/^a/mI
-Capturing subpattern count = 0
-Options: multiline
-First char at start or follows \n
-Need char = 'a'
- abcde
- 0: a
- xy\nabc
- 0: a
- *** Failers
-No match
- xyabc
-No match
-
-/c|abc/I
-Capturing subpattern count = 0
-No options
-No first char
-Need char = 'c'
-
-/(?i)[ab]/IS
-Capturing subpattern count = 0
-Options: caseless
-No first char
-No need char
-Starting character set: A B a b
-
-/[ab](?i)cd/IS
-Capturing subpattern count = 0
-No options
-Case state changes
-No first char
-Need char = 'd' (caseless)
-Starting character set: a b
-
-/abc(?C)def/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'f'
- abcdef
---->abcdef
- 0 ^ ^
- 0: abcdef
- 1234abcdef
---->1234abcdef
- 0 ^ ^
- 0: abcdef
- *** Failers
-No match
- abcxyz
-No match
- abcxyzf
---->abcxyzf
- 0 ^ ^
-No match
-
-/abc(?C)de(?C1)f/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'f'
- 123abcdef
---->123abcdef
- 0 ^ ^
- 1 ^ ^
- 0: abcdef
-
-/(?C1)\dabc(?C2)def/
-Capturing subpattern count = 0
-No options
-No first char
-Need char = 'f'
- 1234abcdef
---->1234abcdef
- 1 ^
- 1 ^
- 1 ^
- 1 ^
- 2 ^ ^
- 0: 4abcdef
- *** Failers
-No match
- abcdef
---->abcdef
- 1 ^
- 1 ^
- 1 ^
- 1 ^
- 1 ^
- 1 ^
-No match
-
-/(?C255)ab/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/(?C256)ab/
-Failed: number after (?C is > 255 at offset 6
-
-/(?Cab)xx/
-Failed: closing ) for (?C expected at offset 3
-
-/(?C12vr)x/
-Failed: closing ) for (?C expected at offset 5
-
-/abc(?C)def/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'f'
- *** Failers
-No match
- \x83\x0\x61bcdef
---->\x83\x00abcdef
- 0 ^ ^
- 0: abcdef
-
-/(abc)(?C)de(?C1)f/
-Capturing subpattern count = 1
-No options
-First char = 'a'
-Need char = 'f'
- 123abcdef
---->123abcdef
- 0 ^ ^
- 1 ^ ^
- 0: abcdef
- 1: abc
- 123abcdef\C+
-Callout 0: last capture = 1
- 0: <unset>
- 1: abc
---->123abcdef
- ^ ^
-Callout 1: last capture = 1
- 0: <unset>
- 1: abc
---->123abcdef
- ^ ^
- 0: abcdef
- 1: abc
- 123abcdef\C-
- 0: abcdef
- 1: abc
- *** Failers
-No match
- 123abcdef\C!1
---->123abcdef
- 0 ^ ^
- 1 ^ ^
-No match
-
-/(?C0)(abc(?C1))*/
-Capturing subpattern count = 1
-No options
-No first char
-No need char
- abcabcabc
---->abcabcabc
- 0 ^
- 1 ^ ^
- 1 ^ ^
- 1 ^ ^
- 0: abcabcabc
- 1: abc
- abcabc\C!1!3
---->abcabc
- 0 ^
- 1 ^ ^
- 1 ^ ^
- 0: abcabc
- 1: abc
- *** Failers
---->*** Failers
- 0 ^
- 0:
- abcabcabc\C!1!3
---->abcabcabc
- 0 ^
- 1 ^ ^
- 1 ^ ^
- 1 ^ ^
- 0: abcabc
- 1: abc
-
-/(\d{3}(?C))*/
-Capturing subpattern count = 1
-No options
-No first char
-No need char
- 123\C+
-Callout 0: last capture = -1
- 0: <unset>
---->123
- ^ ^
- 0: 123
- 1: 123
- 123456\C+
-Callout 0: last capture = -1
- 0: <unset>
---->123456
- ^ ^
-Callout 0: last capture = 1
- 0: <unset>
- 1: 123
---->123456
- ^ ^
- 0: 123456
- 1: 456
- 123456789\C+
-Callout 0: last capture = -1
- 0: <unset>
---->123456789
- ^ ^
-Callout 0: last capture = 1
- 0: <unset>
- 1: 123
---->123456789
- ^ ^
-Callout 0: last capture = 1
- 0: <unset>
- 1: 456
---->123456789
- ^ ^
- 0: 123456789
- 1: 789
-
-/((xyz)(?C)p|(?C1)xyzabc)/
-Capturing subpattern count = 2
-No options
-First char = 'x'
-No need char
- xyzabc\C+
-Callout 0: last capture = 2
- 0: <unset>
- 1: <unset>
- 2: xyz
---->xyzabc
- ^ ^
-Callout 1: last capture = -1
- 0: <unset>
---->xyzabc
- ^
- 0: xyzabc
- 1: xyzabc
-
-/(X)((xyz)(?C)p|(?C1)xyzabc)/
-Capturing subpattern count = 3
-No options
-First char = 'X'
-Need char = 'x'
- Xxyzabc\C+
-Callout 0: last capture = 3
- 0: <unset>
- 1: X
- 2: <unset>
- 3: xyz
---->Xxyzabc
- ^ ^
-Callout 1: last capture = 1
- 0: <unset>
- 1: X
---->Xxyzabc
- ^^
- 0: Xxyzabc
- 1: X
- 2: xyzabc
-
-/(?=(abc))(?C)abcdef/
-Capturing subpattern count = 1
-No options
-First char = 'a'
-Need char = 'f'
- abcdef\C+
-Callout 0: last capture = 1
- 0: <unset>
- 1: abc
---->abcdef
- ^
- 0: abcdef
- 1: abc
-
-/(?!(abc)(?C1)d)(?C2)abcxyz/
-Capturing subpattern count = 1
-No options
-First char = 'a'
-Need char = 'z'
- abcxyz\C+
-Callout 1: last capture = 1
- 0: <unset>
- 1: abc
---->abcxyz
- ^ ^
-Callout 2: last capture = -1
- 0: <unset>
---->abcxyz
- ^
- 0: abcxyz
-
-/(?<=(abc)(?C))xyz/
-Capturing subpattern count = 1
-No options
-First char = 'x'
-Need char = 'z'
- abcxyz\C+
-Callout 0: last capture = 1
- 0: <unset>
- 1: abc
---->abcxyz
- ^
- 0: xyz
- 1: abc
-
-/(?C)abc/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
-
-/(?C)^abc/
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 'c'
-
-/(?C)a|b/S
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: a b
-
-/(?R)/
-Failed: recursive call could loop indefinitely at offset 3
-
-/(a|(?R))/
-Failed: recursive call could loop indefinitely at offset 6
-
-/(ab|(bc|(de|(?R))))/
-Failed: recursive call could loop indefinitely at offset 15
-
-/x(ab|(bc|(de|(?R))))/
-Capturing subpattern count = 3
-No options
-First char = 'x'
-No need char
- xab
- 0: xab
- 1: ab
- xbc
- 0: xbc
- 1: bc
- 2: bc
- xde
- 0: xde
- 1: de
- 2: de
- 3: de
- xxab
- 0: xxab
- 1: xab
- 2: xab
- 3: xab
- xxxab
- 0: xxxab
- 1: xxab
- 2: xxab
- 3: xxab
- *** Failers
-No match
- xyab
-No match
-
-/(ab|(bc|(de|(?1))))/
-Failed: recursive call could loop indefinitely at offset 15
-
-/x(ab|(bc|(de|(?1)x)x)x)/
-Failed: recursive call could loop indefinitely at offset 16
-
-/^([^()]|\((?1)*\))*$/
-Capturing subpattern count = 1
-Options: anchored
-No first char
-No need char
- abc
- 0: abc
- 1: c
- a(b)c
- 0: a(b)c
- 1: c
- a(b(c))d
- 0: a(b(c))d
- 1: d
- *** Failers)
-No match
- a(b(c)d
-No match
-
-/^>abc>([^()]|\((?1)*\))*<xyz<$/
-Capturing subpattern count = 1
-Options: anchored
-No first char
-Need char = '<'
- >abc>123<xyz<
- 0: >abc>123<xyz<
- 1: 3
- >abc>1(2)3<xyz<
- 0: >abc>1(2)3<xyz<
- 1: 3
- >abc>(1(2)3)<xyz<
- 0: >abc>(1(2)3)<xyz<
- 1: (1(2)3)
-
-/(a(?1)b)/D
-------------------------------------------------------------------
- 0 18 Bra 0
- 3 12 Bra 1
- 6 1 a
- 9 3 Recurse
- 12 1 b
- 15 12 Ket
- 18 18 Ket
- 21 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-No options
-First char = 'a'
-Need char = 'b'
-
-/(a(?1)+b)/D
-------------------------------------------------------------------
- 0 24 Bra 0
- 3 18 Bra 1
- 6 1 a
- 9 6 Bra 0
- 12 3 Recurse
- 15 6 KetRmax
- 18 1 b
- 21 18 Ket
- 24 24 Ket
- 27 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-No options
-First char = 'a'
-Need char = 'b'
-
-/^\W*(?:((.)\W*(?1)\W*\2|)|((.)\W*(?3)\W*\4|\W*.\W*))\W*$/i
-Capturing subpattern count = 4
-Max back reference = 4
-Options: anchored caseless
-No first char
-No need char
- 1221
- 0: 1221
- 1: 1221
- 2: 1
- Satan, oscillate my metallic sonatas!
- 0: Satan, oscillate my metallic sonatas!
- 1: <unset>
- 2: <unset>
- 3: Satan, oscillate my metallic sonatas
- 4: S
- A man, a plan, a canal: Panama!
- 0: A man, a plan, a canal: Panama!
- 1: <unset>
- 2: <unset>
- 3: A man, a plan, a canal: Panama
- 4: A
- Able was I ere I saw Elba.
- 0: Able was I ere I saw Elba.
- 1: <unset>
- 2: <unset>
- 3: Able was I ere I saw Elba
- 4: A
- *** Failers
-No match
- The quick brown fox
-No match
-
-/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/
-Capturing subpattern count = 2
-Options: anchored
-No first char
-No need char
- 12
- 0: 12
- 1: 12
- (((2+2)*-3)-7)
- 0: (((2+2)*-3)-7)
- 1: (((2+2)*-3)-7)
- 2: -
- -12
- 0: -12
- 1: -12
- *** Failers
-No match
- ((2+2)*-3)-7)
-No match
-
-/^(x(y|(?1){2})z)/
-Capturing subpattern count = 2
-Options: anchored
-No first char
-Need char = 'z'
- xyz
- 0: xyz
- 1: xyz
- 2: y
- xxyzxyzz
- 0: xxyzxyzz
- 1: xxyzxyzz
- 2: xyzxyz
- *** Failers
-No match
- xxyzz
-No match
- xxyzxyzxyzz
-No match
-
-/((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/x
-Capturing subpattern count = 2
-Options: extended
-First char = '<'
-Need char = '>'
- <>
- 0: <>
- 1: <>
- 2: <>
- <abcd>
- 0: <abcd>
- 1: <abcd>
- 2: <abcd>
- <abc <123> hij>
- 0: <abc <123> hij>
- 1: <abc <123> hij>
- 2: <abc <123> hij>
- <abc <def> hij>
- 0: <def>
- 1: <def>
- 2: <def>
- <abc<>def>
- 0: <abc<>def>
- 1: <abc<>def>
- 2: <abc<>def>
- <abc<>
- 0: <>
- 1: <>
- 2: <>
- *** Failers
-No match
- <abc
-No match
-
-/(?1)/
-Failed: reference to non-existent subpattern at offset 3
-
-/((?2)(abc)/
-Failed: reference to non-existent subpattern at offset 4
-
-/^(abc)def(?1)/
-Capturing subpattern count = 1
-Options: anchored
-No first char
-Need char = 'f'
- abcdefabc
- 0: abcdefabc
- 1: abc
-
-/^(a|b|c)=(?1)+/
-Capturing subpattern count = 1
-Options: anchored
-No first char
-Need char = '='
- a=a
- 0: a=a
- 1: a
- a=b
- 0: a=b
- 1: a
- a=bc
- 0: a=bc
- 1: a
-
-/^(a|b|c)=((?1))+/
-Capturing subpattern count = 2
-Options: anchored
-No first char
-Need char = '='
- a=a
- 0: a=a
- 1: a
- 2: a
- a=b
- 0: a=b
- 1: a
- 2: b
- a=bc
- 0: a=bc
- 1: a
- 2: c
-
-/a(?P<name1>b|c)d(?P<longername2>e)/D
-------------------------------------------------------------------
- 0 33 Bra 0
- 3 1 a
- 6 6 Bra 1
- 9 1 b
- 12 6 Alt
- 15 1 c
- 18 12 Ket
- 21 1 d
- 24 6 Bra 2
- 27 1 e
- 30 6 Ket
- 33 33 Ket
- 36 End
-------------------------------------------------------------------
-Capturing subpattern count = 2
-Named capturing subpatterns:
- longername2 2
- name1 1
-No options
-First char = 'a'
-Need char = 'e'
- abde
- 0: abde
- 1: b
- 2: e
- acde
- 0: acde
- 1: c
- 2: e
-
-/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/D
-------------------------------------------------------------------
- 0 39 Bra 0
- 3 24 Bra 0
- 6 1 a
- 9 15 Bra 1
- 12 1 c
- 15 6 Bra 2
- 18 1 d
- 21 6 Ket
- 24 15 Ket
- 27 24 Ket
- 30 6 Bra 3
- 33 1 a
- 36 6 Ket
- 39 39 Ket
- 42 End
-------------------------------------------------------------------
-Capturing subpattern count = 3
-Named capturing subpatterns:
- a 3
- c 1
- d 2
-No options
-First char = 'a'
-Need char = 'a'
-
-/(?P<a>a)...(?P=a)bbb(?P>a)d/D
-------------------------------------------------------------------
- 0 29 Bra 0
- 3 6 Bra 1
- 6 1 a
- 9 6 Ket
- 12 Any
- 13 Any
- 14 Any
- 15 \1
- 18 3 bbb
- 23 3 Recurse
- 26 1 d
- 29 29 Ket
- 32 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-Named capturing subpatterns:
- a 1
-No options
-First char = 'a'
-Need char = 'd'
-
-/ End of testinput2 /
-Capturing subpattern count = 0
-No options
-First char = ' '
-Need char = ' '
-
diff --git a/ext/pcre/pcrelib/testdata/testoutput3 b/ext/pcre/pcrelib/testdata/testoutput3
deleted file mode 100644
index 8cc3e8dc64..0000000000
--- a/ext/pcre/pcrelib/testdata/testoutput3
+++ /dev/null
@@ -1,116 +0,0 @@
-PCRE version 3.92 11-Sep-2002
-
-/^[\w]+/
- *** Failers
-No match
- École
-No match
-
-/^[\w]+/Lfr
- École
- 0: École
-
-/^[\w]+/
- *** Failers
-No match
- École
-No match
-
-/^[\W]+/
- École
- 0: \xc9
-
-/^[\W]+/Lfr
- *** Failers
- 0: ***
- École
-No match
-
-/[\b]/
- \b
- 0: \x08
- *** Failers
-No match
- a
-No match
-
-/[\b]/Lfr
- \b
- 0: \x08
- *** Failers
-No match
- a
-No match
-
-/^\w+/
- *** Failers
-No match
- École
-No match
-
-/^\w+/Lfr
- École
- 0: École
-
-/(.+)\b(.+)/
- École
- 0: \xc9cole
- 1: \xc9
- 2: cole
-
-/(.+)\b(.+)/Lfr
- *** Failers
- 0: *** Failers
- 1: ***
- 2: Failers
- École
-No match
-
-/École/i
- École
- 0: \xc9cole
- *** Failers
-No match
- école
-No match
-
-/École/iLfr
- École
- 0: École
- école
- 0: école
-
-/\w/IS
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
- Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
-
-/\w/ISLfr
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
- Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
- À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å
- æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ
-
-/^[\xc8-\xc9]/iLfr
- École
- 0: É
- école
- 0: é
-
-/^[\xc8-\xc9]/Lfr
- École
- 0: É
- *** Failers
-No match
- école
-No match
-
-/ End of testinput3 /
-
diff --git a/ext/pcre/pcrelib/testdata/testoutput4 b/ext/pcre/pcrelib/testdata/testoutput4
deleted file mode 100644
index 3018c9baa7..0000000000
--- a/ext/pcre/pcrelib/testdata/testoutput4
+++ /dev/null
@@ -1,304 +0,0 @@
-PCRE version 3.92 11-Sep-2002
-
-/-- Do not use the \x{} construct except with patterns that have the --/
-/-- /8 option set, because PCRE doesn't recognize them as UTF-8 unless --/
-No match
-/-- that option is set. However, the latest Perls recognize them always. --/
-No match
-
-/a.b/8
- acb
- 0: acb
- a\x7fb
- 0: a\x{7f}b
- a\x{100}b
- 0: a\x{100}b
- *** Failers
-No match
- a\nb
-No match
-
-/a(.{3})b/8
- a\x{4000}xyb
- 0: a\x{4000}xyb
- 1: \x{4000}xy
- a\x{4000}\x7fyb
- 0: a\x{4000}\x{7f}yb
- 1: \x{4000}\x{7f}y
- a\x{4000}\x{100}yb
- 0: a\x{4000}\x{100}yb
- 1: \x{4000}\x{100}y
- *** Failers
-No match
- a\x{4000}b
-No match
- ac\ncb
-No match
-
-/a(.*?)(.)/
- a\xc0\x88b
- 0: a\xc0
- 1:
- 2: \xc0
-
-/a(.*?)(.)/8
- a\x{100}b
- 0: a\x{100}
- 1:
- 2: \x{100}
-
-/a(.*)(.)/
- a\xc0\x88b
- 0: a\xc0\x88b
- 1: \xc0\x88
- 2: b
-
-/a(.*)(.)/8
- a\x{100}b
- 0: a\x{100}b
- 1: \x{100}
- 2: b
-
-/a(.)(.)/
- a\xc0\x92bcd
- 0: a\xc0\x92
- 1: \xc0
- 2: \x92
-
-/a(.)(.)/8
- a\x{240}bcd
- 0: a\x{240}b
- 1: \x{240}
- 2: b
-
-/a(.?)(.)/
- a\xc0\x92bcd
- 0: a\xc0\x92
- 1: \xc0
- 2: \x92
-
-/a(.?)(.)/8
- a\x{240}bcd
- 0: a\x{240}b
- 1: \x{240}
- 2: b
-
-/a(.??)(.)/
- a\xc0\x92bcd
- 0: a\xc0
- 1:
- 2: \xc0
-
-/a(.??)(.)/8
- a\x{240}bcd
- 0: a\x{240}
- 1:
- 2: \x{240}
-
-/a(.{3})b/8
- a\x{1234}xyb
- 0: a\x{1234}xyb
- 1: \x{1234}xy
- a\x{1234}\x{4321}yb
- 0: a\x{1234}\x{4321}yb
- 1: \x{1234}\x{4321}y
- a\x{1234}\x{4321}\x{3412}b
- 0: a\x{1234}\x{4321}\x{3412}b
- 1: \x{1234}\x{4321}\x{3412}
- *** Failers
-No match
- a\x{1234}b
-No match
- ac\ncb
-No match
-
-/a(.{3,})b/8
- a\x{1234}xyb
- 0: a\x{1234}xyb
- 1: \x{1234}xy
- a\x{1234}\x{4321}yb
- 0: a\x{1234}\x{4321}yb
- 1: \x{1234}\x{4321}y
- a\x{1234}\x{4321}\x{3412}b
- 0: a\x{1234}\x{4321}\x{3412}b
- 1: \x{1234}\x{4321}\x{3412}
- axxxxbcdefghijb
- 0: axxxxbcdefghijb
- 1: xxxxbcdefghij
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- 0: a\x{1234}\x{4321}\x{3412}\x{3421}b
- 1: \x{1234}\x{4321}\x{3412}\x{3421}
- *** Failers
-No match
- a\x{1234}b
-No match
-
-/a(.{3,}?)b/8
- a\x{1234}xyb
- 0: a\x{1234}xyb
- 1: \x{1234}xy
- a\x{1234}\x{4321}yb
- 0: a\x{1234}\x{4321}yb
- 1: \x{1234}\x{4321}y
- a\x{1234}\x{4321}\x{3412}b
- 0: a\x{1234}\x{4321}\x{3412}b
- 1: \x{1234}\x{4321}\x{3412}
- axxxxbcdefghijb
- 0: axxxxb
- 1: xxxx
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- 0: a\x{1234}\x{4321}\x{3412}\x{3421}b
- 1: \x{1234}\x{4321}\x{3412}\x{3421}
- *** Failers
-No match
- a\x{1234}b
-No match
-
-/a(.{3,5})b/8
- a\x{1234}xyb
- 0: a\x{1234}xyb
- 1: \x{1234}xy
- a\x{1234}\x{4321}yb
- 0: a\x{1234}\x{4321}yb
- 1: \x{1234}\x{4321}y
- a\x{1234}\x{4321}\x{3412}b
- 0: a\x{1234}\x{4321}\x{3412}b
- 1: \x{1234}\x{4321}\x{3412}
- axxxxbcdefghijb
- 0: axxxxb
- 1: xxxx
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- 0: a\x{1234}\x{4321}\x{3412}\x{3421}b
- 1: \x{1234}\x{4321}\x{3412}\x{3421}
- axbxxbcdefghijb
- 0: axbxxb
- 1: xbxx
- axxxxxbcdefghijb
- 0: axxxxxb
- 1: xxxxx
- *** Failers
-No match
- a\x{1234}b
-No match
- axxxxxxbcdefghijb
-No match
-
-/a(.{3,5}?)b/8
- a\x{1234}xyb
- 0: a\x{1234}xyb
- 1: \x{1234}xy
- a\x{1234}\x{4321}yb
- 0: a\x{1234}\x{4321}yb
- 1: \x{1234}\x{4321}y
- a\x{1234}\x{4321}\x{3412}b
- 0: a\x{1234}\x{4321}\x{3412}b
- 1: \x{1234}\x{4321}\x{3412}
- axxxxbcdefghijb
- 0: axxxxb
- 1: xxxx
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- 0: a\x{1234}\x{4321}\x{3412}\x{3421}b
- 1: \x{1234}\x{4321}\x{3412}\x{3421}
- axbxxbcdefghijb
- 0: axbxxb
- 1: xbxx
- axxxxxbcdefghijb
- 0: axxxxxb
- 1: xxxxx
- *** Failers
-No match
- a\x{1234}b
-No match
- axxxxxxbcdefghijb
-No match
-
-/^[a\x{c0}]/8
- *** Failers
-No match
- \x{100}
-No match
-
-/(?<=aXb)cd/8
- aXbcd
- 0: cd
-
-/(?<=a\x{100}b)cd/8
- a\x{100}bcd
- 0: cd
-
-/(?<=a\x{100000}b)cd/8
- a\x{100000}bcd
- 0: cd
-
-/(?:\x{100}){3}b/8
- \x{100}\x{100}\x{100}b
- 0: \x{100}\x{100}\x{100}b
- *** Failers
-No match
- \x{100}\x{100}b
-No match
-
-/\x{ab}/8
- \x{ab}
- 0: \x{ab}
- \xc2\xab
- 0: \x{ab}
- *** Failers
-No match
- \x00{ab}
-No match
-
-/(?<=(.))X/8
- WXYZ
- 0: X
- 1: W
- \x{256}XYZ
- 0: X
- 1: \x{256}
- *** Failers
-No match
- XYZ
-No match
-
-/X(\C{3})/8
- X\x{1234}
- 0: X\x{1234}
- 1: \x{1234}
-
-/X(\C{4})/8
- X\x{1234}YZ
- 0: X\x{1234}Y
- 1: \x{1234}Y
-
-/X\C*/8
- XYZabcdce
- 0: XYZabcdce
-
-/X\C*?/8
- XYZabcde
- 0: X
-
-/X\C{3,5}/8
- Xabcdefg
- 0: Xabcde
- X\x{1234}
- 0: X\x{1234}
- X\x{1234}YZ
- 0: X\x{1234}YZ
- X\x{1234}\x{512}
- 0: X\x{1234}\x{512}
- X\x{1234}\x{512}YZ
- 0: X\x{1234}\x{512}
-
-/X\C{3,5}?/8
- Xabcdefg
- 0: Xabc
- X\x{1234}
- 0: X\x{1234}
- X\x{1234}YZ
- 0: X\x{1234}
- X\x{1234}\x{512}
- 0: X\x{1234}
-
-/ End of testinput4 /
-
diff --git a/ext/pcre/pcrelib/testdata/testoutput5 b/ext/pcre/pcrelib/testdata/testoutput5
deleted file mode 100644
index 01daca505e..0000000000
--- a/ext/pcre/pcrelib/testdata/testoutput5
+++ /dev/null
@@ -1,339 +0,0 @@
-PCRE version 3.92 11-Sep-2002
-
-/\x{100}/8DM
-Memory allocation (code space): 11
-------------------------------------------------------------------
- 0 7 Bra 0
- 3 2 \xc4\x80
- 7 7 Ket
- 10 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 196
-Need char = 128
-
-/\x{1000}/8DM
-Memory allocation (code space): 12
-------------------------------------------------------------------
- 0 8 Bra 0
- 3 3 \xe1\x80\x80
- 8 8 Ket
- 11 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 225
-Need char = 128
-
-/\x{10000}/8DM
-Memory allocation (code space): 13
-------------------------------------------------------------------
- 0 9 Bra 0
- 3 4 \xf0\x90\x80\x80
- 9 9 Ket
- 12 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 240
-Need char = 128
-
-/\x{100000}/8DM
-Memory allocation (code space): 13
-------------------------------------------------------------------
- 0 9 Bra 0
- 3 4 \xf4\x80\x80\x80
- 9 9 Ket
- 12 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 244
-Need char = 128
-
-/\x{1000000}/8DM
-Memory allocation (code space): 14
-------------------------------------------------------------------
- 0 10 Bra 0
- 3 5 \xf9\x80\x80\x80\x80
- 10 10 Ket
- 13 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 249
-Need char = 128
-
-/\x{4000000}/8DM
-Memory allocation (code space): 15
-------------------------------------------------------------------
- 0 11 Bra 0
- 3 6 \xfc\x84\x80\x80\x80\x80
- 11 11 Ket
- 14 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 252
-Need char = 128
-
-/\x{7fffFFFF}/8DM
-Memory allocation (code space): 15
-------------------------------------------------------------------
- 0 11 Bra 0
- 3 6 \xfd\xbf\xbf\xbf\xbf\xbf
- 11 11 Ket
- 14 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 253
-Need char = 191
-
-/[\x{ff}]/8DM
-Memory allocation (code space): 40
-------------------------------------------------------------------
- 0 6 Bra 0
- 3 1 \xff
- 6 6 Ket
- 9 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 255
-No need char
-
-/[\x{100}]/8DM
-Failed: characters with values > 255 are not yet supported in classes at offset 7
-
-/\x{ffffffff}/8
-Failed: character value in \x{...} sequence is too large at offset 11
-
-/\x{100000000}/8
-Failed: character value in \x{...} sequence is too large at offset 12
-
-/^\x{100}a\x{1234}/8
- \x{100}a\x{1234}bcd
- 0: \x{100}a\x{1234}
-
-/\x80/8D
-------------------------------------------------------------------
- 0 7 Bra 0
- 3 2 \xc2\x80
- 7 7 Ket
- 10 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 194
-Need char = 128
-
-/\xff/8D
-------------------------------------------------------------------
- 0 7 Bra 0
- 3 2 \xc3\xbf
- 7 7 Ket
- 10 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 195
-Need char = 191
-
-/\x{0041}\x{2262}\x{0391}\x{002e}/D8
-------------------------------------------------------------------
- 0 12 Bra 0
- 3 7 A\xe2\x89\xa2\xce\x91.
- 12 12 Ket
- 15 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 'A'
-Need char = '.'
- \x{0041}\x{2262}\x{0391}\x{002e}
- 0: A\x{2262}\x{391}.
-
-/\x{D55c}\x{ad6d}\x{C5B4}/D8
-------------------------------------------------------------------
- 0 14 Bra 0
- 3 9 \xed\x95\x9c\xea\xb5\xad\xec\x96\xb4
- 14 14 Ket
- 17 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 237
-Need char = 180
- \x{D55c}\x{ad6d}\x{C5B4}
- 0: \x{d55c}\x{ad6d}\x{c5b4}
-
-/\x{65e5}\x{672c}\x{8a9e}/D8
-------------------------------------------------------------------
- 0 14 Bra 0
- 3 9 \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e
- 14 14 Ket
- 17 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 230
-Need char = 158
- \x{65e5}\x{672c}\x{8a9e}
- 0: \x{65e5}\x{672c}\x{8a9e}
-
-/\x{80}/D8
-------------------------------------------------------------------
- 0 7 Bra 0
- 3 2 \xc2\x80
- 7 7 Ket
- 10 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 194
-Need char = 128
-
-/\x{084}/D8
-------------------------------------------------------------------
- 0 7 Bra 0
- 3 2 \xc2\x84
- 7 7 Ket
- 10 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 194
-Need char = 132
-
-/\x{104}/D8
-------------------------------------------------------------------
- 0 7 Bra 0
- 3 2 \xc4\x84
- 7 7 Ket
- 10 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 196
-Need char = 132
-
-/\x{861}/D8
-------------------------------------------------------------------
- 0 8 Bra 0
- 3 3 \xe0\xa1\xa1
- 8 8 Ket
- 11 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 224
-Need char = 161
-
-/\x{212ab}/D8
-------------------------------------------------------------------
- 0 9 Bra 0
- 3 4 \xf0\xa1\x8a\xab
- 9 9 Ket
- 12 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 240
-Need char = 171
-
-/.{3,5}X/D8
-------------------------------------------------------------------
- 0 14 Bra 0
- 3 Any{3}
- 7 Any{0,2}
- 11 1 X
- 14 14 Ket
- 17 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-No first char
-Need char = 'X'
- \x{212ab}\x{212ab}\x{212ab}\x{861}X
- 0: \x{212ab}\x{212ab}\x{212ab}\x{861}X
-
-
-/.{3,5}?/D8
-------------------------------------------------------------------
- 0 11 Bra 0
- 3 Any{3}
- 7 Any{0,2}?
- 11 11 Ket
- 14 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-No first char
-No need char
- \x{212ab}\x{212ab}\x{212ab}\x{861}
- 0: \x{212ab}\x{212ab}\x{212ab}
-
-/-- These tests are here rather than in testinput4 because Perl 5.6 has --/
-/-- some problems with UTF-8 support, in the area of \x{..} where the --/
-No match
-/-- value is < 255. It grumbles about invalid UTF-8 strings. --/
-No match
-
-/^[a\x{c0}]b/8
- \x{c0}b
- 0: \x{c0}b
-
-/^([a\x{c0}]*?)aa/8
- a\x{c0}aaaa/
- 0: a\x{c0}aa
- 1: a\x{c0}
-
-/^([a\x{c0}]*?)aa/8
- a\x{c0}aaaa/
- 0: a\x{c0}aa
- 1: a\x{c0}
- a\x{c0}a\x{c0}aaa/
- 0: a\x{c0}a\x{c0}aa
- 1: a\x{c0}a\x{c0}
-
-/^([a\x{c0}]*)aa/8
- a\x{c0}aaaa/
- 0: a\x{c0}aaaa
- 1: a\x{c0}aa
- a\x{c0}a\x{c0}aaa/
- 0: a\x{c0}a\x{c0}aaa
- 1: a\x{c0}a\x{c0}a
-
-/^([a\x{c0}]*)a\x{c0}/8
- a\x{c0}aaaa/
- 0: a\x{c0}
- 1:
- a\x{c0}a\x{c0}aaa/
- 0: a\x{c0}a\x{c0}
- 1: a\x{c0}
-
-/-- --/
-
-/(?<=\C)X/8
-Failed: \C not allowed in lookbehind assertion at offset 6
-
-/-- This one is here not because it's different to Perl, but because the --/
-/-- way the captured single-byte is displayed. (In Perl it becomes a --/
-No match
-/-- character, and you can't tell the difference.) --/
-No match
-
-/X(\C)(.*)/8
- X\x{1234}
- 0: X\x{1234}
- 1: \xe1
- 2: \x88\xb4
- X\nabc
- 0: X\x{0a}abc
- 1: \x{0a}
- 2: abc
-
-/ End of testinput5 /
-
diff --git a/ext/pcre/pcrelib/testdata/testoutput6 b/ext/pcre/pcrelib/testdata/testoutput6
deleted file mode 100644
index fcf084670f..0000000000
--- a/ext/pcre/pcrelib/testdata/testoutput6
+++ /dev/null
@@ -1,319 +0,0 @@
-PCRE version 3.9 02-Jan-2002
-
-/\x{100}/8DM
-Memory allocation (code space): 11
-------------------------------------------------------------------
- 0 7 Bra 0
- 3 2 \xc4\x80
- 7 7 Ket
- 10 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 196
-Need char = 128
-
-/\x{1000}/8DM
-Memory allocation (code space): 12
-------------------------------------------------------------------
- 0 8 Bra 0
- 3 3 \xe1\x80\x80
- 8 8 Ket
- 11 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 225
-Need char = 128
-
-/\x{10000}/8DM
-Memory allocation (code space): 13
-------------------------------------------------------------------
- 0 9 Bra 0
- 3 4 \xf0\x90\x80\x80
- 9 9 Ket
- 12 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 240
-Need char = 128
-
-/\x{100000}/8DM
-Memory allocation (code space): 13
-------------------------------------------------------------------
- 0 9 Bra 0
- 3 4 \xf4\x80\x80\x80
- 9 9 Ket
- 12 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 244
-Need char = 128
-
-/\x{1000000}/8DM
-Memory allocation (code space): 14
-------------------------------------------------------------------
- 0 10 Bra 0
- 3 5 \xf9\x80\x80\x80\x80
- 10 10 Ket
- 13 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 249
-Need char = 128
-
-/\x{4000000}/8DM
-Memory allocation (code space): 15
-------------------------------------------------------------------
- 0 11 Bra 0
- 3 6 \xfc\x84\x80\x80\x80\x80
- 11 11 Ket
- 14 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 252
-Need char = 128
-
-/\x{7fffFFFF}/8DM
-Memory allocation (code space): 15
-------------------------------------------------------------------
- 0 11 Bra 0
- 3 6 \xfd\xbf\xbf\xbf\xbf\xbf
- 11 11 Ket
- 14 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 253
-Need char = 191
-
-/[\x{ff}]/8DM
-Memory allocation (code space): 40
-------------------------------------------------------------------
- 0 6 Bra 0
- 3 1 \xff
- 6 6 Ket
- 9 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 255
-No need char
-
-/[\x{100}]/8DM
-Memory allocation (code space): 40
-Failed: characters with values > 255 are not yet supported in classes at offset 7
-
-/\x{ffffffff}/8
-Failed: character value in \x{...} sequence is too large at offset 11
-
-/\x{100000000}/8
-Failed: character value in \x{...} sequence is too large at offset 12
-
-/^\x{100}a\x{1234}/8
- \x{100}a\x{1234}bcd
- 0: \x{100}a\x{1234}
-
-/\x80/8D
-------------------------------------------------------------------
- 0 7 Bra 0
- 3 2 \xc2\x80
- 7 7 Ket
- 10 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 194
-Need char = 128
-
-/\xff/8D
-------------------------------------------------------------------
- 0 7 Bra 0
- 3 2 \xc3\xbf
- 7 7 Ket
- 10 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 195
-Need char = 191
-
-/\x{0041}\x{2262}\x{0391}\x{002e}/D8
-------------------------------------------------------------------
- 0 12 Bra 0
- 3 7 A\xe2\x89\xa2\xce\x91.
- 12 12 Ket
- 15 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 'A'
-Need char = '.'
- \x{0041}\x{2262}\x{0391}\x{002e}
- 0: A\x{2262}\x{391}.
-
-/\x{D55c}\x{ad6d}\x{C5B4}/D8
-------------------------------------------------------------------
- 0 14 Bra 0
- 3 9 \xed\x95\x9c\xea\xb5\xad\xec\x96\xb4
- 14 14 Ket
- 17 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 237
-Need char = 180
- \x{D55c}\x{ad6d}\x{C5B4}
- 0: \x{d55c}\x{ad6d}\x{c5b4}
-
-/\x{65e5}\x{672c}\x{8a9e}/D8
-------------------------------------------------------------------
- 0 14 Bra 0
- 3 9 \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e
- 14 14 Ket
- 17 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 230
-Need char = 158
- \x{65e5}\x{672c}\x{8a9e}
- 0: \x{65e5}\x{672c}\x{8a9e}
-
-/\x{80}/D8
-------------------------------------------------------------------
- 0 7 Bra 0
- 3 2 \xc2\x80
- 7 7 Ket
- 10 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 194
-Need char = 128
-
-/\x{084}/D8
-------------------------------------------------------------------
- 0 7 Bra 0
- 3 2 \xc2\x84
- 7 7 Ket
- 10 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 194
-Need char = 132
-
-/\x{104}/D8
-------------------------------------------------------------------
- 0 7 Bra 0
- 3 2 \xc4\x84
- 7 7 Ket
- 10 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 196
-Need char = 132
-
-/\x{861}/D8
-------------------------------------------------------------------
- 0 8 Bra 0
- 3 3 \xe0\xa1\xa1
- 8 8 Ket
- 11 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 224
-Need char = 161
-
-/\x{212ab}/D8
-------------------------------------------------------------------
- 0 9 Bra 0
- 3 4 \xf0\xa1\x8a\xab
- 9 9 Ket
- 12 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 240
-Need char = 171
-
-/.{3,5}X/D8
-------------------------------------------------------------------
- 0 14 Bra 0
- 3 Any{3}
- 7 Any{0,2}
- 11 1 X
- 14 14 Ket
- 17 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-No first char
-Need char = 'X'
- \x{212ab}\x{212ab}\x{212ab}\x{861}X
- 0: \x{212ab}\x{212ab}\x{212ab}\x{861}X
-
-
-/.{3,5}?/D8
-------------------------------------------------------------------
- 0 11 Bra 0
- 3 Any{3}
- 7 Any{0,2}?
- 11 11 Ket
- 14 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-No first char
-No need char
- \x{212ab}\x{212ab}\x{212ab}\x{861}
- 0: \x{212ab}\x{212ab}\x{212ab}
-
-/-- These tests are here rather than in testinput5 because Perl 5.6 has --/
-/-- some problems with UTF-8 support, in the area of \x{..} where the --/
-No match
-/-- value is < 255. It grumbles about invalid UTF-8 strings. --/
-No match
-
-/^[a\x{c0}]b/8
- \x{c0}b
- 0: \x{c0}b
-
-/^([a\x{c0}]*?)aa/8
- a\x{c0}aaaa/
- 0: a\x{c0}aa
- 1: a\x{c0}
-
-/^([a\x{c0}]*?)aa/8
- a\x{c0}aaaa/
- 0: a\x{c0}aa
- 1: a\x{c0}
- a\x{c0}a\x{c0}aaa/
- 0: a\x{c0}a\x{c0}aa
- 1: a\x{c0}a\x{c0}
-
-/^([a\x{c0}]*)aa/8
- a\x{c0}aaaa/
- 0: a\x{c0}aaaa
- 1: a\x{c0}aa
- a\x{c0}a\x{c0}aaa/
- 0: a\x{c0}a\x{c0}aaa
- 1: a\x{c0}a\x{c0}a
-
-/^([a\x{c0}]*)a\x{c0}/8
- a\x{c0}aaaa/
- 0: a\x{c0}
- 1:
- a\x{c0}a\x{c0}aaa/
- 0: a\x{c0}a\x{c0}
- 1: a\x{c0}
-
-/ End of testinput6 /
-
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
deleted file mode 100644
index f31a6bf207..0000000000
--- a/ext/pcre/php_pcre.c
+++ /dev/null
@@ -1,1506 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Andrei Zmievski <andrei@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_pcre.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_smart_str.h"
-
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
-
-#include "ext/standard/php_string.h"
-
-#define PREG_PATTERN_ORDER 1
-#define PREG_SET_ORDER 2
-#define PREG_OFFSET_CAPTURE (1<<8)
-
-#define PREG_SPLIT_NO_EMPTY (1<<0)
-#define PREG_SPLIT_DELIM_CAPTURE (1<<1)
-#define PREG_SPLIT_OFFSET_CAPTURE (1<<2)
-
-#define PREG_REPLACE_EVAL (1<<0)
-
-#define PREG_GREP_INVERT (1<<0)
-
-
-ZEND_DECLARE_MODULE_GLOBALS(pcre)
-
-
-static void *php_pcre_malloc(size_t size)
-{
- return pemalloc(size, 1);
-}
-
-
-static void php_pcre_free(void *ptr)
-{
- pefree(ptr, 1);
-}
-
-
-static void php_free_pcre_cache(void *data)
-{
- pcre_cache_entry *pce = (pcre_cache_entry *) data;
- pefree(pce->re, 1);
-#if HAVE_SETLOCALE
- if ((void*)pce->tables) pefree((void*)pce->tables, 1);
- pefree(pce->locale, 1);
-#endif
-}
-
-
-static void php_pcre_init_globals(zend_pcre_globals *pcre_globals TSRMLS_DC)
-{
- zend_hash_init(&pcre_globals->pcre_cache, 0, NULL, php_free_pcre_cache, 1);
-}
-
-static void php_pcre_shutdown_globals(zend_pcre_globals *pcre_globals TSRMLS_DC)
-{
- zend_hash_destroy(&pcre_globals->pcre_cache);
-}
-
-
-static /* {{{ PHP_MINFO_FUNCTION(pcre) */
-PHP_MINFO_FUNCTION(pcre)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "PCRE (Perl Compatible Regular Expressions) Support", "enabled" );
- php_info_print_table_row(2, "PCRE Library Version", pcre_version() );
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION(pcre) */
-static PHP_MINIT_FUNCTION(pcre)
-{
- ZEND_INIT_MODULE_GLOBALS(pcre, php_pcre_init_globals, php_pcre_shutdown_globals);
-
- REGISTER_LONG_CONSTANT("PREG_PATTERN_ORDER", PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PREG_SET_ORDER", PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PREG_OFFSET_CAPTURE", PREG_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PREG_SPLIT_NO_EMPTY", PREG_SPLIT_NO_EMPTY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PREG_SPLIT_DELIM_CAPTURE", PREG_SPLIT_DELIM_CAPTURE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PREG_SPLIT_OFFSET_CAPTURE", PREG_SPLIT_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PREG_GREP_INVERT", PREG_GREP_INVERT, CONST_CS | CONST_PERSISTENT);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION(pcre) */
-static PHP_MSHUTDOWN_FUNCTION(pcre)
-{
-#ifndef ZTS
- php_pcre_shutdown_globals(&pcre_globals TSRMLS_CC);
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION(pcre) */
-static PHP_RINIT_FUNCTION(pcre)
-{
- pcre_malloc = php_pcre_malloc;
- pcre_free = php_pcre_free;
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ pcre_get_compiled_regex
- */
-PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_options TSRMLS_DC) {
- pcre *re = NULL;
- int coptions = 0;
- int soptions = 0;
- const char *error;
- int erroffset;
- char delimiter;
- char start_delimiter;
- char end_delimiter;
- char *p, *pp;
- char *pattern;
- int regex_len;
- int do_study = 0;
- int poptions = 0;
- unsigned const char *tables = NULL;
-#if HAVE_SETLOCALE
- char *locale = setlocale(LC_CTYPE, NULL);
-#endif
- pcre_cache_entry *pce;
- pcre_cache_entry new_entry;
-
- /* Try to lookup the cached regex entry, and if successful, just pass
- back the compiled pattern, otherwise go on and compile it. */
- regex_len = strlen(regex);
- if (zend_hash_find(&PCRE_G(pcre_cache), regex, regex_len+1, (void **)&pce) == SUCCESS) {
-#if HAVE_SETLOCALE
- if (!strcmp(pce->locale, locale)) {
-#endif
- *extra = pce->extra;
- *preg_options = pce->preg_options;
- return pce->re;
-#if HAVE_SETLOCALE
- }
-#endif
- }
-
- p = regex;
-
- /* Parse through the leading whitespace, and display a warning if we
- get to the end without encountering a delimiter. */
- while (isspace((int)*p)) p++;
- if (*p == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty regular expression");
- return NULL;
- }
-
- /* Get the delimiter and display a warning if it is alphanumeric
- or a backslash. */
- delimiter = *p++;
- if (isalnum((int)delimiter) || delimiter == '\\') {
- php_error_docref(NULL TSRMLS_CC,E_WARNING, "Delimiter must not be alphanumeric or backslash");
- return NULL;
- }
-
- start_delimiter = delimiter;
- if ((pp = strchr("([{< )]}> )]}>", delimiter)))
- delimiter = pp[5];
- end_delimiter = delimiter;
-
- if (start_delimiter == end_delimiter) {
- /* We need to iterate through the pattern, searching for the ending delimiter,
- but skipping the backslashed delimiters. If the ending delimiter is not
- found, display a warning. */
- pp = p;
- while (*pp != 0) {
- if (*pp == '\\' && pp[1] != 0) pp++;
- else if (*pp == delimiter)
- break;
- pp++;
- }
- if (*pp == 0) {
- php_error_docref(NULL TSRMLS_CC,E_WARNING, "No ending delimiter '%c' found", delimiter);
- return NULL;
- }
- } else {
- /* We iterate through the pattern, searching for the matching ending
- * delimiter. For each matching starting delimiter, we increment nesting
- * level, and decrement it for each matching ending delimiter. If we
- * reach the end of the pattern without matching, display a warning.
- */
- int brackets = 1; /* brackets nesting level */
- pp = p;
- while (*pp != 0) {
- if (*pp == '\\' && pp[1] != 0) pp++;
- else if (*pp == end_delimiter && --brackets <= 0)
- break;
- else if (*pp == start_delimiter)
- brackets++;
- pp++;
- }
- if (*pp == 0) {
- php_error_docref(NULL TSRMLS_CC,E_WARNING, "No ending matching delimiter '%c' found", end_delimiter);
- return NULL;
- }
- }
-
- /* Make a copy of the actual pattern. */
- pattern = estrndup(p, pp-p);
-
- /* Move on to the options */
- pp++;
-
- /* Clear out preg options */
- *preg_options = 0;
-
- /* Parse through the options, setting appropriate flags. Display
- a warning if we encounter an unknown modifier. */
- while (*pp != 0) {
- switch (*pp++) {
- /* Perl compatible options */
- case 'i': coptions |= PCRE_CASELESS; break;
- case 'm': coptions |= PCRE_MULTILINE; break;
- case 's': coptions |= PCRE_DOTALL; break;
- case 'x': coptions |= PCRE_EXTENDED; break;
-
- /* PCRE specific options */
- case 'A': coptions |= PCRE_ANCHORED; break;
- case 'D': coptions |= PCRE_DOLLAR_ENDONLY;break;
- case 'S': do_study = 1; break;
- case 'U': coptions |= PCRE_UNGREEDY; break;
- case 'X': coptions |= PCRE_EXTRA; break;
- case 'u': coptions |= PCRE_UTF8; break;
-
- /* Custom preg options */
- case 'e': poptions |= PREG_REPLACE_EVAL; break;
-
- case ' ':
- case '\n':
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC,E_WARNING, "Unknown modifier '%c'", pp[-1]);
- efree(pattern);
- return NULL;
- }
- }
-
-#if HAVE_SETLOCALE
- if (strcmp(locale, "C"))
- tables = pcre_maketables();
-#endif
-
- /* Compile pattern and display a warning if compilation failed. */
- re = pcre_compile(pattern,
- coptions,
- &error,
- &erroffset,
- tables);
-
- if (re == NULL) {
- php_error_docref(NULL TSRMLS_CC,E_WARNING, "Compilation failed: %s at offset %d", error, erroffset);
- efree(pattern);
- return NULL;
- }
-
- /* If study option was specified, study the pattern and
- store the result in extra for passing to pcre_exec. */
- if (do_study) {
- *extra = pcre_study(re, soptions, &error);
- if (error != NULL) {
- php_error_docref(NULL TSRMLS_CC,E_WARNING, "Error while studying pattern");
- }
- }
-
- *preg_options = poptions;
-
- efree(pattern);
-
- /* Store the compiled pattern and extra info in the cache. */
- new_entry.re = re;
- new_entry.extra = *extra;
- new_entry.preg_options = poptions;
-#if HAVE_SETLOCALE
- new_entry.locale = pestrdup(locale, 1);
- new_entry.tables = tables;
-#endif
- zend_hash_update(&PCRE_G(pcre_cache), regex, regex_len+1, (void *)&new_entry,
- sizeof(pcre_cache_entry), NULL);
-
- return re;
-}
-/* }}} */
-
-/* {{{ add_offset_pair */
-static inline void add_offset_pair(zval *result, char *str, int len, int offset)
-{
- zval *match_pair;
-
- ALLOC_ZVAL(match_pair);
- array_init(match_pair);
- INIT_PZVAL(match_pair);
-
- /* Add (match, offset) to the return value */
- add_next_index_stringl(match_pair, str, len, 1);
- add_next_index_long(match_pair, offset);
-
- zend_hash_next_index_insert(Z_ARRVAL_P(result), &match_pair, sizeof(zval *), NULL);
-}
-/* }}} */
-
-/* {{{ php_pcre_match
- */
-static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
-{
- zval **regex, /* Regular expression */
- **subject, /* String to match against */
- **subpats = NULL, /* Array for subpatterns */
- **flags, /* Match control flags */
- *result_set, /* Holds a set of subpatterns after
- a global match */
- **match_sets = NULL; /* An array of sets of matches for each
- subpattern after a global match */
- pcre *re = NULL; /* Compiled regular expression */
- pcre_extra *extra = NULL; /* Holds results of studying */
- int exoptions = 0; /* Execution options */
- int preg_options = 0; /* Custom preg options */
- int count = 0; /* Count of matched subpatterns */
- int *offsets; /* Array of subpattern offsets */
- int num_subpats; /* Number of captured subpatterns */
- int size_offsets; /* Size of the offsets array */
- int start_offset; /* Where the new search starts */
- int matched; /* Has anything matched */
- int i;
- int subpats_order = 0; /* Order of subpattern matches */
- int offset_capture = 0;/* Capture match offsets: yes/no */
- int g_notempty = 0; /* If the match should not be empty */
- const char **stringlist; /* Used to hold list of subpatterns */
- char *match; /* The current match */
-
-
- /* Get function parameters and do error-checking. */
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (global || zend_get_parameters_ex(2, &regex, &subject) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
-
- case 3:
- if (zend_get_parameters_ex(3, &regex, &subject, &subpats) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (global)
- subpats_order = PREG_PATTERN_ORDER;
- break;
-
- case 4:
- if (zend_get_parameters_ex(4, &regex, &subject, &subpats, &flags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(flags);
- offset_capture = Z_LVAL_PP(flags) & PREG_OFFSET_CAPTURE;
- subpats_order = Z_LVAL_PP(flags) & 0xff;
- if ((global && (subpats_order < PREG_PATTERN_ORDER || subpats_order > PREG_SET_ORDER)) ||
- (!global && subpats_order != 0)) {
- php_error_docref(NULL TSRMLS_CC,E_WARNING, "Wrong value for parameter 4");
- return;
- }
- break;
-
- default:
- WRONG_PARAM_COUNT;
- }
-
- /* Make sure we're dealing with strings. */
- convert_to_string_ex(regex);
- convert_to_string_ex(subject);
-
- /* Make sure to clean up the passed array and initialize it. */
- if (subpats != NULL) {
- zval_dtor(*subpats);
- array_init(*subpats);
- }
-
- /* Compile regex or get it from cache. */
- if ((re = pcre_get_compiled_regex(Z_STRVAL_PP(regex), &extra, &preg_options TSRMLS_CC)) == NULL) {
- RETURN_FALSE;
- }
-
- /* Calculate the size of the offsets array, and allocate memory for it. */
- pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &num_subpats);
- num_subpats++;
- size_offsets = num_subpats * 3;
- offsets = (int *)emalloc(size_offsets * sizeof(int));
-
- /* Allocate match sets array and initialize the values */
- if (global && subpats_order == PREG_PATTERN_ORDER) {
- match_sets = (zval **)emalloc(num_subpats * sizeof(zval *));
- for (i=0; i<num_subpats; i++) {
- ALLOC_ZVAL(match_sets[i]);
- array_init(match_sets[i]);
- INIT_PZVAL(match_sets[i]);
- }
- }
-
- /* Start from the beginning of the string */
- start_offset = 0;
- match = NULL;
- matched = 0;
-
- do {
- /* Execute the regular expression. */
- count = pcre_exec(re, extra, Z_STRVAL_PP(subject),
- Z_STRLEN_PP(subject), start_offset,
- exoptions|g_notempty, offsets, size_offsets);
-
- /* Check for too many substrings condition. */
- if (count == 0) {
- php_error_docref(NULL TSRMLS_CC,E_NOTICE, "Matched, but too many substrings");
- count = size_offsets/3;
- }
-
- /* If something has matched */
- if (count >= 0) {
- matched++;
- match = Z_STRVAL_PP(subject) + offsets[0];
-
- /* If subpatterns array has been passed, fill it in with values. */
- if (subpats != NULL) {
- /* Try to get the list of substrings and display a warning if failed. */
- if (pcre_get_substring_list(Z_STRVAL_PP(subject),
- offsets, count, &stringlist) < 0) {
- efree(offsets);
- efree(re);
- php_error_docref(NULL TSRMLS_CC,E_WARNING, "Get subpatterns list failed");
- return;
- }
-
- if (global) { /* global pattern matching */
- if (subpats_order == PREG_PATTERN_ORDER) {
- /* For each subpattern, insert it into the appropriate array. */
- for (i = 0; i < count; i++) {
- if (offset_capture) {
- add_offset_pair(match_sets[i], (char *)stringlist[i],
- offsets[(i<<1)+1] - offsets[i<<1], offsets[i<<1]);
- } else {
- add_next_index_stringl(match_sets[i], (char *)stringlist[i],
- offsets[(i<<1)+1] - offsets[i<<1], 1);
- }
- }
- /*
- * If the number of captured subpatterns on this run is
- * less than the total possible number, pad the result
- * arrays with empty strings.
- */
- if (count < num_subpats) {
- for (; i < num_subpats; i++) {
- add_next_index_string(match_sets[i], empty_string, 1);
- }
- }
- } else {
- /* Allocate the result set array */
- ALLOC_ZVAL(result_set);
- array_init(result_set);
- INIT_PZVAL(result_set);
-
- /* Add all the subpatterns to it */
- for (i = 0; i < count; i++) {
- if (offset_capture) {
- add_offset_pair(result_set, (char *)stringlist[i],
- offsets[(i<<1)+1] - offsets[i<<1], offsets[i<<1]);
- } else {
- add_next_index_stringl(result_set, (char *)stringlist[i],
- offsets[(i<<1)+1] - offsets[i<<1], 1);
- }
- }
- /* And add it to the output array */
- zend_hash_next_index_insert(Z_ARRVAL_PP(subpats), &result_set,
- sizeof(zval *), NULL);
- }
- } else { /* single pattern matching */
- /* For each subpattern, insert it into the subpatterns array. */
- for (i = 0; i < count; i++) {
- if (offset_capture) {
- add_offset_pair(*subpats, (char *)stringlist[i],
- offsets[(i<<1)+1] - offsets[i<<1], offsets[i<<1]);
- } else {
- add_next_index_stringl(*subpats, (char *)stringlist[i],
- offsets[(i<<1)+1] - offsets[i<<1], 1);
- }
- }
- }
-
- php_pcre_free((void *) stringlist);
- }
- }
- else { /* Failed to match */
- /* If we previously set PCRE_NOTEMPTY after a null match,
- this is not necessarily the end. We need to advance
- the start offset, and continue. Fudge the offset values
- to achieve this, unless we're already at the end of the string. */
- if (g_notempty != 0 && start_offset < Z_STRLEN_PP(subject)) {
- offsets[0] = start_offset;
- offsets[1] = start_offset + 1;
- } else
- break;
- }
-
- /* If we have matched an empty string, mimic what Perl's /g options does.
- This turns out to be rather cunning. First we set PCRE_NOTEMPTY and try
- the match again at the same point. If this fails (picked up above) we
- advance to the next character. */
- g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY | PCRE_ANCHORED : 0;
-
- /* Advance to the position right after the last full match */
- start_offset = offsets[1];
- } while (global);
-
- /* Add the match sets to the output array and clean up */
- if (global && subpats_order == PREG_PATTERN_ORDER) {
- for (i=0; i<num_subpats; i++) {
- zend_hash_next_index_insert(Z_ARRVAL_PP(subpats), &match_sets[i], sizeof(zval *), NULL);
- }
- efree(match_sets);
- }
-
- efree(offsets);
-
- RETVAL_LONG(matched);
-}
-/* }}} */
-
-/* {{{ proto int preg_match(string pattern, string subject [, array subpatterns [, int flags]])
- Perform a Perl-style regular expression match */
-PHP_FUNCTION(preg_match)
-{
- php_pcre_match(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags])
- Perform a Perl-style global regular expression match */
-PHP_FUNCTION(preg_match_all)
-{
- php_pcre_match(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ preg_get_backref
- */
-static int preg_get_backref(char **str, int *backref)
-{
- register char in_brace = 0;
- register char *walk = *str;
-
- if (walk[1] == 0)
- return 0;
-
- if (*walk == '$' && walk[1] == '{') {
- in_brace = 1;
- walk++;
- }
- walk++;
-
- if (*walk >= '0' && *walk <= '9') {
- *backref = *walk - '0';
- walk++;
- } else
- return 0;
-
- if (*walk && *walk >= '0' && *walk <= '9') {
- *backref = *backref * 10 + *walk - '0';
- walk++;
- }
-
- if (in_brace) {
- if (*walk == 0 || *walk != '}')
- return 0;
- else
- walk++;
- }
-
- *str = walk;
- return 1;
-}
-/* }}} */
-
-/* {{{ preg_do_repl_func
- */
-static int preg_do_repl_func(zval *function, char *subject, int *offsets, int count, char **result TSRMLS_DC)
-{
- zval *retval_ptr; /* Function return value */
- zval **args[1]; /* Argument to pass to function */
- zval *subpats; /* Captured subpatterns */
- int result_len; /* Return value length */
- int i;
-
- MAKE_STD_ZVAL(subpats);
- array_init(subpats);
- for (i = 0; i < count; i++)
- add_next_index_stringl(subpats, &subject[offsets[i<<1]], offsets[(i<<1)+1] - offsets[i<<1], 1);
- args[0] = &subpats;
-
- if (call_user_function_ex(EG(function_table), NULL, function, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
- convert_to_string_ex(&retval_ptr);
- *result = estrndup(Z_STRVAL_P(retval_ptr), Z_STRLEN_P(retval_ptr));
- result_len = Z_STRLEN_P(retval_ptr);
- zval_ptr_dtor(&retval_ptr);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call custom replacement function");
- result_len = offsets[1] - offsets[0];
- *result = estrndup(&subject[offsets[0]], result_len);
- }
- zval_dtor(subpats);
- FREE_ZVAL(subpats);
-
- return result_len;
-}
-/* }}} */
-
-/* {{{ preg_do_eval
- */
-static int preg_do_eval(char *eval_str, int eval_str_len, char *subject,
- int *offsets, int count, char **result TSRMLS_DC)
-{
- zval retval; /* Return value from evaluation */
- char *eval_str_end, /* End of eval string */
- *match, /* Current match for a backref */
- *esc_match, /* Quote-escaped match */
- *walk, /* Used to walk the code string */
- *segment, /* Start of segment to append while walking */
- walk_last; /* Last walked character */
- int match_len; /* Length of the match */
- int esc_match_len; /* Length of the quote-escaped match */
- int result_len; /* Length of the result of the evaluation */
- int backref; /* Current backref */
- char *compiled_string_description;
- smart_str code = {0};
-
- eval_str_end = eval_str + eval_str_len;
- walk = segment = eval_str;
- walk_last = 0;
-
- while (walk < eval_str_end) {
- /* If found a backreference.. */
- if ('\\' == *walk || '$' == *walk) {
- smart_str_appendl(&code, segment, walk - segment);
- if (walk_last == '\\') {
- code.c[code.len-1] = *walk++;
- segment = walk;
- walk_last = 0;
- continue;
- }
- segment = walk;
- if (preg_get_backref(&walk, &backref)) {
- if (backref < count) {
- /* Find the corresponding string match and substitute it
- in instead of the backref */
- match = subject + offsets[backref<<1];
- match_len = offsets[(backref<<1)+1] - offsets[backref<<1];
- if (match_len)
- esc_match = php_addslashes(match, match_len, &esc_match_len, 0 TSRMLS_CC);
- else {
- esc_match = match;
- esc_match_len = 0;
- }
- } else {
- esc_match = empty_string;
- esc_match_len = 0;
- match_len = 0;
- }
- smart_str_appendl(&code, esc_match, esc_match_len);
-
- segment = walk;
-
- /* Clean up and reassign */
- if (esc_match_len)
- efree(esc_match);
- continue;
- }
- }
- walk++;
- walk_last = walk[-1];
- }
- smart_str_appendl(&code, segment, walk - segment);
- smart_str_0(&code);
-
- compiled_string_description = zend_make_compiled_string_description("regexp code" TSRMLS_CC);
- /* Run the code */
- if (zend_eval_string(code.c, &retval, compiled_string_description TSRMLS_CC) == FAILURE) {
- efree(compiled_string_description);
- php_error_docref(NULL TSRMLS_CC,E_ERROR, "Failed evaluating code:\n%s", code);
- /* zend_error() does not return in this case */
- }
- efree(compiled_string_description);
- convert_to_string(&retval);
-
- /* Save the return value and its length */
- *result = estrndup(Z_STRVAL(retval), Z_STRLEN(retval));
- result_len = Z_STRLEN(retval);
-
- /* Clean up */
- zval_dtor(&retval);
- smart_str_free(&code);
-
- return result_len;
-}
-/* }}} */
-
-/* {{{ php_pcre_replace
- */
-PHPAPI char *php_pcre_replace(char *regex, int regex_len,
- char *subject, int subject_len,
- zval *replace_val, int is_callable_replace,
- int *result_len, int limit TSRMLS_DC)
-{
- pcre *re = NULL; /* Compiled regular expression */
- pcre_extra *extra = NULL; /* Holds results of studying */
- int exoptions = 0; /* Execution options */
- int preg_options = 0; /* Custom preg options */
- int count = 0; /* Count of matched subpatterns */
- int *offsets; /* Array of subpattern offsets */
- int size_offsets; /* Size of the offsets array */
- int new_len; /* Length of needed storage */
- int alloc_len; /* Actual allocated length */
- int eval_result_len=0; /* Length of the eval'ed or
- function-returned string */
- int match_len; /* Length of the current match */
- int backref; /* Backreference number */
- int eval; /* If the replacement string should be eval'ed */
- int start_offset; /* Where the new search starts */
- int g_notempty=0; /* If the match should not be empty */
- int replace_len=0; /* Length of replacement string */
- char *result, /* Result of replacement */
- *replace=NULL, /* Replacement string */
- *new_buf, /* Temporary buffer for re-allocation */
- *walkbuf, /* Location of current replacement in the result */
- *walk, /* Used to walk the replacement string */
- *match, /* The current match */
- *piece, /* The current piece of subject */
- *replace_end=NULL, /* End of replacement string */
- *eval_result, /* Result of eval or custom function */
- walk_last; /* Last walked character */
-
- /* Compile regex or get it from cache. */
- if ((re = pcre_get_compiled_regex(regex, &extra, &preg_options TSRMLS_CC)) == NULL) {
- return NULL;
- }
-
- eval = preg_options & PREG_REPLACE_EVAL;
- if (is_callable_replace) {
- if (eval) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "/e modifier cannot be used with replacement callback");
- return NULL;
- }
- } else {
- replace = Z_STRVAL_P(replace_val);
- replace_len = Z_STRLEN_P(replace_val);
- replace_end = replace + replace_len;
- }
-
- /* Calculate the size of the offsets array, and allocate memory for it. */
- size_offsets = (pcre_info(re, NULL, NULL) + 1) * 3;
- offsets = (int *)emalloc(size_offsets * sizeof(int));
-
- alloc_len = 2 * subject_len + 1;
- result = emalloc(alloc_len * sizeof(char));
-
- /* Initialize */
- match = NULL;
- *result_len = 0;
- start_offset = 0;
-
- while (1) {
- /* Execute the regular expression. */
- count = pcre_exec(re, extra, subject, subject_len, start_offset,
- exoptions|g_notempty, offsets, size_offsets);
-
- /* Check for too many substrings condition. */
- if (count == 0) {
- php_error_docref(NULL TSRMLS_CC,E_NOTICE, "Matched, but too many substrings");
- count = size_offsets/3;
- }
-
- piece = subject + start_offset;
-
- if (count > 0 && (limit == -1 || limit > 0)) {
- /* Set the match location in subject */
- match = subject + offsets[0];
-
- new_len = *result_len + offsets[0] - start_offset; /* part before the match */
-
- /* If evaluating, do it and add the return string's length */
- if (eval) {
- eval_result_len = preg_do_eval(replace, replace_len, subject,
- offsets, count, &eval_result TSRMLS_CC);
- new_len += eval_result_len;
- } else if (is_callable_replace) {
- /* Use custom function to get replacement string and its length. */
- eval_result_len = preg_do_repl_func(replace_val, subject, offsets,
- count, &eval_result TSRMLS_CC);
- new_len += eval_result_len;
- } else { /* do regular substitution */
- walk = replace;
- walk_last = 0;
- while (walk < replace_end) {
- if ('\\' == *walk || '$' == *walk) {
- if (walk_last == '\\') {
- walk++;
- walk_last = 0;
- continue;
- }
- if (preg_get_backref(&walk, &backref)) {
- if (backref < count)
- new_len += offsets[(backref<<1)+1] - offsets[backref<<1];
- continue;
- }
- }
- new_len++;
- walk++;
- walk_last = walk[-1];
- }
- }
-
- if (new_len + 1 > alloc_len) {
- alloc_len = 1 + alloc_len + 2 * new_len;
- new_buf = emalloc(alloc_len);
- memcpy(new_buf, result, *result_len);
- efree(result);
- result = new_buf;
- }
- /* copy the part of the string before the match */
- memcpy(&result[*result_len], piece, match-piece);
- *result_len += match-piece;
-
- /* copy replacement and backrefs */
- walkbuf = result + *result_len;
-
- /* If evaluating or using custom function, copy result to the buffer
- * and clean up. */
- if (eval || is_callable_replace) {
- memcpy(walkbuf, eval_result, eval_result_len);
- *result_len += eval_result_len;
- STR_FREE(eval_result);
- } else { /* do regular backreference copying */
- walk = replace;
- walk_last = 0;
- while (walk < replace_end) {
- if ('\\' == *walk || '$' == *walk) {
- if (walk_last == '\\') {
- *(walkbuf-1) = *walk++;
- walk_last = 0;
- continue;
- }
- if (preg_get_backref(&walk, &backref)) {
- if (backref < count) {
- match_len = offsets[(backref<<1)+1] - offsets[backref<<1];
- memcpy(walkbuf, subject + offsets[backref<<1], match_len);
- walkbuf += match_len;
- }
- continue;
- }
- }
- *walkbuf++ = *walk++;
- walk_last = walk[-1];
- }
- *walkbuf = '\0';
- /* increment the result length by how much we've added to the string */
- *result_len += walkbuf - (result + *result_len);
- }
-
- if (limit != -1)
- limit--;
-
- } else { /* Failed to match */
- /* If we previously set PCRE_NOTEMPTY after a null match,
- this is not necessarily the end. We need to advance
- the start offset, and continue. Fudge the offset values
- to achieve this, unless we're already at the end of the string. */
- if (g_notempty != 0 && start_offset < subject_len) {
- offsets[0] = start_offset;
- offsets[1] = start_offset + 1;
- memcpy(&result[*result_len], piece, 1);
- (*result_len)++;
- } else {
- new_len = *result_len + subject_len - start_offset;
- if (new_len + 1 > alloc_len) {
- alloc_len = new_len + 1; /* now we know exactly how long it is */
- new_buf = emalloc(alloc_len * sizeof(char));
- memcpy(new_buf, result, *result_len);
- efree(result);
- result = new_buf;
- }
- /* stick that last bit of string on our output */
- memcpy(&result[*result_len], piece, subject_len - start_offset);
- *result_len += subject_len - start_offset;
- result[*result_len] = '\0';
- break;
- }
- }
-
- /* If we have matched an empty string, mimic what Perl's /g options does.
- This turns out to be rather cunning. First we set PCRE_NOTEMPTY and try
- the match again at the same point. If this fails (picked up above) we
- advance to the next character. */
- g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY | PCRE_ANCHORED : 0;
-
- /* Advance to the next piece. */
- start_offset = offsets[1];
- }
-
- efree(offsets);
-
- return result;
-}
-/* }}} */
-
-/* {{{ php_replace_in_subject
- */
-static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, int *result_len, int limit, zend_bool is_callable_replace TSRMLS_DC)
-{
- zval **regex_entry,
- **replace_entry = NULL,
- *replace_value,
- empty_replace;
- char *subject_value,
- *result;
- int subject_len;
-
- /* Make sure we're dealing with strings. */
- convert_to_string_ex(subject);
- ZVAL_STRINGL(&empty_replace, empty_string, 0, 0);
-
- /* If regex is an array */
- if (Z_TYPE_P(regex) == IS_ARRAY) {
- /* Duplicate subject string for repeated replacement */
- subject_value = estrndup(Z_STRVAL_PP(subject), Z_STRLEN_PP(subject));
- subject_len = Z_STRLEN_PP(subject);
- *result_len = subject_len;
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(regex));
-
- replace_value = replace;
- if (Z_TYPE_P(replace) == IS_ARRAY && !is_callable_replace)
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(replace));
-
- /* For each entry in the regex array, get the entry */
- while (zend_hash_get_current_data(Z_ARRVAL_P(regex), (void **)&regex_entry) == SUCCESS) {
- /* Make sure we're dealing with strings. */
- convert_to_string_ex(regex_entry);
-
- /* If replace is an array and not a callable construct */
- if (Z_TYPE_P(replace) == IS_ARRAY && !is_callable_replace) {
- /* Get current entry */
- if (zend_hash_get_current_data(Z_ARRVAL_P(replace), (void **)&replace_entry) == SUCCESS) {
- if (!is_callable_replace) {
- convert_to_string_ex(replace_entry);
- }
- replace_value = *replace_entry;
- zend_hash_move_forward(Z_ARRVAL_P(replace));
- } else {
- /* We've run out of replacement strings, so use an empty one */
- replace_value = &empty_replace;
- }
- }
-
- /* Do the actual replacement and put the result back into subject_value
- for further replacements. */
- if ((result = php_pcre_replace(Z_STRVAL_PP(regex_entry),
- Z_STRLEN_PP(regex_entry),
- subject_value,
- subject_len,
- replace_value,
- is_callable_replace,
- result_len,
- limit TSRMLS_CC)) != NULL) {
- efree(subject_value);
- subject_value = result;
- subject_len = *result_len;
- }
-
- zend_hash_move_forward(Z_ARRVAL_P(regex));
- }
-
- return subject_value;
- } else {
- result = php_pcre_replace(Z_STRVAL_P(regex),
- Z_STRLEN_P(regex),
- Z_STRVAL_PP(subject),
- Z_STRLEN_PP(subject),
- replace,
- is_callable_replace,
- result_len,
- limit TSRMLS_CC);
- return result;
- }
-}
-/* }}} */
-
-/* {{{ preg_replace_impl
- */
-static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_callable_replace)
-{
- zval **regex,
- **replace,
- **subject,
- **limit,
- **subject_entry;
- char *result;
- int result_len;
- int limit_val = -1;
- char *string_key;
- ulong num_key;
- char *callback_name = NULL;
-
- /* Get function parameters and do error-checking. */
- if (ZEND_NUM_ARGS() < 3 || ZEND_NUM_ARGS() > 4 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &regex, &replace, &subject, &limit) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!is_callable_replace && Z_TYPE_PP(replace) == IS_ARRAY && Z_TYPE_PP(regex) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter mismatch, pattern is a string while replacement in an array.");
- RETURN_FALSE;
- }
-
- SEPARATE_ZVAL(replace);
- if (Z_TYPE_PP(replace) != IS_ARRAY)
- convert_to_string_ex(replace);
- if (is_callable_replace) {
- if (!zend_is_callable(*replace, 0, &callback_name)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "requires argument 2, '%s', to be a valid callback", callback_name);
- efree(callback_name);
- *return_value = **subject;
- zval_copy_ctor(return_value);
- return;
- }
- efree(callback_name);
- }
-
- SEPARATE_ZVAL(regex);
- SEPARATE_ZVAL(subject);
-
- if (ZEND_NUM_ARGS() > 3) {
- convert_to_long_ex(limit);
- limit_val = Z_LVAL_PP(limit);
- }
-
- if (Z_TYPE_PP(regex) != IS_ARRAY)
- convert_to_string_ex(regex);
-
- /* if subject is an array */
- if (Z_TYPE_PP(subject) == IS_ARRAY) {
- array_init(return_value);
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(subject));
-
- /* For each subject entry, convert it to string, then perform replacement
- and add the result to the return_value array. */
- while (zend_hash_get_current_data(Z_ARRVAL_PP(subject), (void **)&subject_entry) == SUCCESS) {
- if ((result = php_replace_in_subject(*regex, *replace, subject_entry, &result_len, limit_val, is_callable_replace TSRMLS_CC)) != NULL) {
- /* Add to return array */
- switch(zend_hash_get_current_key(Z_ARRVAL_PP(subject), &string_key, &num_key, 0))
- {
- case HASH_KEY_IS_STRING:
- add_assoc_stringl(return_value, string_key, result, result_len, 0);
- break;
-
- case HASH_KEY_IS_LONG:
- add_index_stringl(return_value, num_key, result, result_len, 0);
- break;
- }
- }
-
- zend_hash_move_forward(Z_ARRVAL_PP(subject));
- }
- }
- else { /* if subject is not an array */
- if ((result = php_replace_in_subject(*regex, *replace, subject, &result_len, limit_val, is_callable_replace TSRMLS_CC)) != NULL) {
- RETVAL_STRINGL(result, result_len, 0);
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit])
- Perform Perl-style regular expression replacement. */
-PHP_FUNCTION(preg_replace)
-{
- preg_replace_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string preg_replace_callback(mixed regex, mixed callback, mixed subject [, int limit])
- Perform Perl-style regular expression replacement using replacement callback. */
-PHP_FUNCTION(preg_replace_callback)
-{
- preg_replace_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto array preg_split(string pattern, string subject [, int limit [, int flags]])
- Split string into an array using a perl-style regular expression as a delimiter */
-PHP_FUNCTION(preg_split)
-{
- zval **regex, /* Regular expression to split by */
- **subject, /* Subject string to split */
- **limit, /* Number of pieces to return */
- **flags;
- pcre *re = NULL; /* Compiled regular expression */
- pcre_extra *extra = NULL; /* Holds results of studying */
- int *offsets; /* Array of subpattern offsets */
- int size_offsets; /* Size of the offsets array */
- int exoptions = 0; /* Execution options */
- int preg_options = 0; /* Custom preg options */
- int argc; /* Argument count */
- int limit_val = -1; /* Integer value of limit */
- int no_empty = 0; /* If NO_EMPTY flag is set */
- int delim_capture = 0; /* If delimiters should be captured */
- int offset_capture = 0;/* If offsets should be captured */
- int count = 0; /* Count of matched subpatterns */
- int start_offset; /* Where the new search starts */
- int next_offset; /* End of the last delimiter match + 1 */
- int g_notempty = 0; /* If the match should not be empty */
- char *match, /* The current match */
- *last_match; /* Location of last match */
-
- /* Get function parameters and do error checking */
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 4 || zend_get_parameters_ex(argc, &regex, &subject, &limit, &flags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc > 2) {
- convert_to_long_ex(limit);
- limit_val = Z_LVAL_PP(limit);
- if (limit_val == 0)
- limit_val = -1;
-
- if (argc > 3) {
- convert_to_long_ex(flags);
- no_empty = Z_LVAL_PP(flags) & PREG_SPLIT_NO_EMPTY;
- delim_capture = Z_LVAL_PP(flags) & PREG_SPLIT_DELIM_CAPTURE;
- offset_capture = Z_LVAL_PP(flags) & PREG_SPLIT_OFFSET_CAPTURE;
- }
- }
-
- /* Make sure we're dealing with strings */
- convert_to_string_ex(regex);
- convert_to_string_ex(subject);
-
- /* Compile regex or get it from cache. */
- if ((re = pcre_get_compiled_regex(Z_STRVAL_PP(regex), &extra, &preg_options TSRMLS_CC)) == NULL) {
- RETURN_FALSE;
- }
-
- /* Initialize return value */
- array_init(return_value);
-
- /* Calculate the size of the offsets array, and allocate memory for it. */
- size_offsets = (pcre_info(re, NULL, NULL) + 1) * 3;
- offsets = (int *)emalloc(size_offsets * sizeof(int));
-
- /* Start at the beginning of the string */
- start_offset = 0;
- next_offset = 0;
- last_match = Z_STRVAL_PP(subject);
- match = NULL;
-
- /* Get next piece if no limit or limit not yet reached and something matched*/
- while ((limit_val == -1 || limit_val > 1)) {
- count = pcre_exec(re, extra, Z_STRVAL_PP(subject),
- Z_STRLEN_PP(subject), start_offset,
- exoptions|g_notempty, offsets, size_offsets);
-
- /* Check for too many substrings condition. */
- if (count == 0) {
- php_error_docref(NULL TSRMLS_CC,E_NOTICE, "Matched, but too many substrings");
- count = size_offsets/3;
- }
-
- /* If something matched */
- if (count > 0) {
- match = Z_STRVAL_PP(subject) + offsets[0];
-
- if (!no_empty || &Z_STRVAL_PP(subject)[offsets[0]] != last_match) {
-
- if (offset_capture) {
- /* Add (match, offset) pair to the return value */
- add_offset_pair(return_value, last_match, &Z_STRVAL_PP(subject)[offsets[0]]-last_match, next_offset);
- } else {
- /* Add the piece to the return value */
- add_next_index_stringl(return_value, last_match,
- &Z_STRVAL_PP(subject)[offsets[0]]-last_match, 1);
- }
-
- /* One less left to do */
- if (limit_val != -1)
- limit_val--;
- }
-
- last_match = &Z_STRVAL_PP(subject)[offsets[1]];
- next_offset = offsets[1];
-
- if (delim_capture) {
- int i, match_len;
- for (i = 1; i < count; i++) {
- match_len = offsets[(i<<1)+1] - offsets[i<<1];
- /* If we have matched a delimiter */
- if (!no_empty || match_len > 0) {
- if (offset_capture) {
- add_offset_pair(return_value, &Z_STRVAL_PP(subject)[offsets[i<<1]], match_len, offsets[i<<1]);
- } else {
- add_next_index_stringl(return_value,
- &Z_STRVAL_PP(subject)[offsets[i<<1]],
- match_len, 1);
- }
- }
- }
- }
- } else { /* Failed to match */
- /* If we previously set PCRE_NOTEMPTY after a null match,
- this is not necessarily the end. We need to advance
- the start offset, and continue. Fudge the offset values
- to achieve this, unless we're already at the end of the string. */
- if (g_notempty != 0 && start_offset < Z_STRLEN_PP(subject)) {
- offsets[0] = start_offset;
- offsets[1] = start_offset + 1;
- } else
- break;
- }
-
- /* If we have matched an empty string, mimic what Perl's /g options does.
- This turns out to be rather cunning. First we set PCRE_NOTEMPTY and try
- the match again at the same point. If this fails (picked up above) we
- advance to the next character. */
- g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY | PCRE_ANCHORED : 0;
-
- /* Advance to the position right after the last full match */
- start_offset = offsets[1];
- }
-
-
- if (!no_empty || start_offset != Z_STRLEN_PP(subject))
- {
- if (offset_capture) {
- /* Add the last (match, offset) pair to the return value */
- add_offset_pair(return_value, &Z_STRVAL_PP(subject)[start_offset], Z_STRLEN_PP(subject) - start_offset, start_offset);
- } else {
- /* Add the last piece to the return value */
- add_next_index_stringl(return_value, last_match, Z_STRVAL_PP(subject) + Z_STRLEN_PP(subject) - last_match, 1);
- }
- }
-
-
- /* Clean up */
- efree(offsets);
-}
-/* }}} */
-
-/* {{{ proto string preg_quote(string str, string delim_char)
- Quote regular expression characters plus an optional character */
-PHP_FUNCTION(preg_quote)
-{
- zval **in_str_arg; /* Input string argument */
- zval **delim; /* Additional delimiter argument */
- char *in_str, /* Input string */
- *in_str_end, /* End of the input string */
- *out_str, /* Output string with quoted characters */
- *p, /* Iterator for input string */
- *q, /* Iterator for output string */
- delim_char=0, /* Delimiter character to be quoted */
- c; /* Current character */
- zend_bool quote_delim = 0; /* Whether to quote additional delim char */
-
- /* Get the arguments and check for errors */
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &in_str_arg, &delim) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* Make sure we're working with strings */
- convert_to_string_ex(in_str_arg);
- in_str = Z_STRVAL_PP(in_str_arg);
- in_str_end = Z_STRVAL_PP(in_str_arg) + Z_STRLEN_PP(in_str_arg);
-
- /* Nothing to do if we got an empty string */
- if (in_str == in_str_end) {
- RETVAL_STRINGL(empty_string, 0, 0);
- }
-
- if (ZEND_NUM_ARGS() == 2) {
- convert_to_string_ex(delim);
- if (Z_STRLEN_PP(delim) > 0) {
- delim_char = Z_STRVAL_PP(delim)[0];
- quote_delim = 1;
- }
- }
-
- /* Allocate enough memory so that even if each character
- is quoted, we won't run out of room */
- out_str = emalloc(2 * Z_STRLEN_PP(in_str_arg) + 1);
-
- /* Go through the string and quote necessary characters */
- for(p = in_str, q = out_str; p != in_str_end; p++) {
- c = *p;
- switch(c) {
- case '.':
- case '\\':
- case '+':
- case '*':
- case '?':
- case '[':
- case '^':
- case ']':
- case '$':
- case '(':
- case ')':
- case '{':
- case '}':
- case '=':
- case '!':
- case '>':
- case '<':
- case '|':
- case ':':
- *q++ = '\\';
- *q++ = c;
- break;
-
- default:
- if (quote_delim && c == delim_char)
- *q++ = '\\';
- *q++ = c;
- break;
- }
- }
- *q = '\0';
-
- /* Reallocate string and return it */
- RETVAL_STRINGL(erealloc(out_str, q - out_str + 1), q - out_str, 0);
-}
-/* }}} */
-
-/* {{{ proto array preg_grep(string regex, array input)
- Searches array and returns entries which match regex */
-PHP_FUNCTION(preg_grep)
-{
- zval **regex, /* Regular expression */
- **input, /* Input array */
- **flags,
- **entry; /* An entry in the input array */
- pcre *re = NULL; /* Compiled regular expression */
- pcre_extra *extra = NULL; /* Holds results of studying */
- int preg_options = 0; /* Custom preg options */
- int *offsets; /* Array of subpattern offsets */
- int size_offsets; /* Size of the offsets array */
- int count = 0; /* Count of matched subpatterns */
- char *string_key;
- ulong num_key;
- zend_bool invert = 0; /* Whether to return non-matching
- entries */
-
- /* Get arguments and do error checking */
-
- if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &regex, &input, &flags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC,E_WARNING, "Second argument to preg_grep() should be an array");
- return;
- }
-
- SEPARATE_ZVAL(input);
-
- /* Make sure regex is a string */
- convert_to_string_ex(regex);
-
- if (ZEND_NUM_ARGS() > 2) {
- convert_to_long_ex(flags);
- invert = (Z_LVAL_PP(flags) & PREG_GREP_INVERT) ? 1 : 0;
- }
-
- /* Compile regex or get it from cache. */
- if ((re = pcre_get_compiled_regex(Z_STRVAL_PP(regex), &extra, &preg_options TSRMLS_CC)) == NULL) {
- RETURN_FALSE;
- }
-
- /* Calculate the size of the offsets array, and allocate memory for it. */
- size_offsets = (pcre_info(re, NULL, NULL) + 1) * 3;
- offsets = (int *)emalloc(size_offsets * sizeof(int));
-
- /* Initialize return array */
- array_init(return_value);
-
- /* Go through the input array */
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(input));
- while(zend_hash_get_current_data(Z_ARRVAL_PP(input), (void **)&entry) == SUCCESS) {
-
- convert_to_string_ex(entry);
-
- /* Perform the match */
- count = pcre_exec(re, extra, Z_STRVAL_PP(entry),
- Z_STRLEN_PP(entry), 0,
- 0, offsets, size_offsets);
-
- /* Check for too many substrings condition. */
- if (count == 0) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Matched, but too many substrings");
- count = size_offsets/3;
- }
-
- /* If the entry fits our requirements */
- if ((count > 0 && !invert) ||
- (count < 0 && invert)) {
- (*entry)->refcount++;
-
- /* Add to return array */
- switch(zend_hash_get_current_key(Z_ARRVAL_PP(input), &string_key, &num_key, 0))
- {
- case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL_P(return_value), string_key,
- strlen(string_key)+1, entry, sizeof(zval *), NULL);
- break;
-
- case HASH_KEY_IS_LONG:
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry,
- sizeof(zval *), NULL);
- break;
- }
- }
-
- zend_hash_move_forward(Z_ARRVAL_PP(input));
- }
-
- /* Clean up */
- efree(offsets);
-}
-/* }}} */
-
-/* {{{ module definition structures */
-
-function_entry pcre_functions[] = {
- PHP_FE(preg_match, third_arg_force_ref)
- PHP_FE(preg_match_all, third_arg_force_ref)
- PHP_FE(preg_replace, NULL)
- PHP_FE(preg_replace_callback, NULL)
- PHP_FE(preg_split, NULL)
- PHP_FE(preg_quote, NULL)
- PHP_FE(preg_grep, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry pcre_module_entry = {
- STANDARD_MODULE_HEADER,
- "pcre",
- pcre_functions,
- PHP_MINIT(pcre),
- PHP_MSHUTDOWN(pcre),
- PHP_RINIT(pcre),
- NULL,
- PHP_MINFO(pcre),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_PCRE
-ZEND_GET_MODULE(pcre)
-#endif
-
-/* }}} */
-
-#endif /* HAVE_PCRE || HAVE_BUNDLED_PCRE */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h
deleted file mode 100644
index 938f612844..0000000000
--- a/ext/pcre/php_pcre.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Andrei Zmievski <andrei@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_PCRE_H
-#define PHP_PCRE_H
-
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
-
-#if HAVE_BUNDLED_PCRE
-#include "pcrelib/pcre.h"
-#else
-#include "pcre.h"
-#endif
-
-#if HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
-PHP_FUNCTION(preg_match);
-PHP_FUNCTION(preg_match_all);
-PHP_FUNCTION(preg_replace);
-PHP_FUNCTION(preg_replace_callback);
-PHP_FUNCTION(preg_split);
-PHP_FUNCTION(preg_quote);
-PHP_FUNCTION(preg_grep);
-
-PHPAPI char *php_pcre_replace(char *regex, int regex_len, char *subject, int subject_len, zval *replace_val, int is_callable_replace, int *result_len, int limit TSRMLS_DC);
-PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *options TSRMLS_DC);
-
-extern zend_module_entry pcre_module_entry;
-#define pcre_module_ptr &pcre_module_entry
-
-typedef struct {
- pcre *re;
- pcre_extra *extra;
- int preg_options;
-#if HAVE_SETLOCALE
- char *locale;
- unsigned const char *tables;
-#endif
-} pcre_cache_entry;
-
-ZEND_BEGIN_MODULE_GLOBALS(pcre)
- HashTable pcre_cache;
-ZEND_END_MODULE_GLOBALS(pcre)
-
-#ifdef ZTS
-# define PCRE_G(v) TSRMG(pcre_globals_id, zend_pcre_globals *, v)
-#else
-# define PCRE_G(v) (pcre_globals.v)
-#endif
-
-#else
-
-#define pcre_module_ptr NULL
-
-#endif /* HAVE_PCRE || HAVE_BUNDLED_PCRE */
-
-#define phpext_pcre_ptr pcre_module_ptr
-
-#endif /* PHP_PCRE_H */
diff --git a/ext/pcre/tests/bug20528.phpt b/ext/pcre/tests/bug20528.phpt
deleted file mode 100644
index 8182fd9bfe..0000000000
--- a/ext/pcre/tests/bug20528.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Bug #20528 (preg_split() drops characters (re-opens Bug #15413))
---FILE--
-<?php
- $data = '(#11/19/2002#)';
- var_dump(preg_split('/\b/', $data));
-?>
---EXPECT--
-array(7) {
- [0]=>
- string(2) "(#"
- [1]=>
- string(2) "11"
- [2]=>
- string(1) "/"
- [3]=>
- string(2) "19"
- [4]=>
- string(1) "/"
- [5]=>
- string(4) "2002"
- [6]=>
- string(2) "#)"
-}
diff --git a/ext/pcre/tests/bug21732.phpt b/ext/pcre/tests/bug21732.phpt
deleted file mode 100644
index 3dfc41e19f..0000000000
--- a/ext/pcre/tests/bug21732.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-Bug #21732 (preg_replace() segfaults with invalid parameters)
---INI--
-error_reporting=0
---FILE--
-<?php
-class foo {
- function cb($param) {
- var_dump($param);
- return "yes!";
- }
-}
-
-var_dump(preg_replace('', array(), ''));
-var_dump(preg_replace_callback("/(ab)(cd)(e)/", array(new foo(), "cb"), 'abcde'));
-?>
---EXPECT--
-bool(false)
-array(4) {
- [0]=>
- string(5) "abcde"
- [1]=>
- string(2) "ab"
- [2]=>
- string(2) "cd"
- [3]=>
- string(1) "e"
-}
-string(4) "yes!"
diff --git a/ext/pdf/CREDITS b/ext/pdf/CREDITS
deleted file mode 100644
index 8bf39a0695..0000000000
--- a/ext/pdf/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-PDF
-Uwe Steinmann, Rainer Schaaf
diff --git a/ext/pdf/config.m4 b/ext/pdf/config.m4
deleted file mode 100644
index f0ded5004d..0000000000
--- a/ext/pdf/config.m4
+++ /dev/null
@@ -1,129 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(pdflib,for PDFlib support,
-[ --with-pdflib[=DIR] Include PDFlib support.])
-
-if test -z "$PHP_JPEG_DIR"; then
- PHP_ARG_WITH(jpeg-dir, for the location of libjpeg,
- [ --with-jpeg-dir[=DIR] PDFLIB: define libjpeg install directory.
- (OPTIONAL for PDFlib v4)], no, no)
-fi
-
-if test -z "$PHP_PNG_DIR"; then
- PHP_ARG_WITH(png-dir, for the location of libpng,
- [ --with-png-dir[=DIR] PDFLIB: define libpng install directory.
- (OPTIONAL for PDFlib v4)], no, no)
-fi
-
-if test -z "$PHP_ZLIB_DIR"; then
- PHP_ARG_WITH(zlib-dir, for the location of libz,
- [ --with-zlib-dir[=DIR] PDFLIB: define libz install directory.
- (OPTIONAL for PDFlib v4)], no, no)
-fi
-
-PHP_ARG_WITH(tiff-dir, for the location of libtiff,
-[ --with-tiff-dir[=DIR] PDFLIB: define libtiff install directory.
- (OPTIONAL for PDFlib v4)], no, no)
-
-if test "$PHP_PDFLIB" != "no"; then
-
- PHP_NEW_EXTENSION(pdf, pdf.c, $ext_shared)
- PHP_SUBST(PDF_SHARED_LIBADD)
-
- dnl #
- dnl # Optional libraries for PDFlib
- dnl #
-
- dnl # libjpeg
- if test "$PHP_JPEG_DIR" != "no"; then
- PHP_CHECK_LIBRARY(jpeg,jpeg_read_header,
- [
- PHP_ADD_LIBRARY_WITH_PATH(jpeg, $PHP_JPEG_DIR/lib, PDF_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR([libjpeg not found!])
- ],[
- -L$PHP_JPEG_DIR/lib
- ])
- else
- AC_MSG_WARN([If configure fails, try --with-jpeg-dir=<DIR>])
- fi
-
- dnl # libpng
- if test "$PHP_PNG_DIR" != "no"; then
- PHP_CHECK_LIBRARY(png,png_create_info_struct,
- [
- PHP_ADD_LIBRARY_WITH_PATH(png, $PHP_PNG_DIR/lib, PDF_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR([libpng not found!])
- ],[
- -L$PHP_PNG_DIR/lib
- ])
- else
- AC_MSG_WARN([If configure fails, try --with-png-dir=<DIR>])
- fi
-
- dnl # libtiff
- if test "$PHP_TIFF_DIR" != "no"; then
- PHP_CHECK_LIBRARY(tiff,TIFFOpen,
- [
- PHP_ADD_LIBRARY_WITH_PATH(tiff, $PHP_TIFF_DIR/lib, PDF_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR([libtiff not found!])
- ],[
- -L$PHP_TIFF_DIR/lib
- ])
- else
- AC_MSG_WARN([If configure fails, try --with-tiff-dir=<DIR>])
- fi
-
- dnl # zlib
- AC_MSG_CHECKING([for the location of zlib])
- if test "$PHP_ZLIB_DIR" = "no"; then
- AC_MSG_RESULT([no. If configure fails, try --with-zlib-dir=<DIR>])
- else
- AC_MSG_RESULT([$PHP_ZLIB_DIR])
- PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/lib, PDF_SHARED_LIBADD)
- fi
-
- dnl #
- dnl # The main PDFlib configure
- dnl #
-
- case $PHP_PDFLIB in
- yes)
- AC_CHECK_LIB(pdf, PDF_show_boxed, [
- AC_DEFINE(HAVE_PDFLIB,1,[ ])
- PHP_ADD_LIBRARY(pdf,, PDF_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR([
-PDFlib extension requires at least pdflib 3.x. You may also need libtiff, libjpeg, libpng and libz.
-Use the options --with-tiff-dir=<DIR>, --with-jpeg-dir=<DIR>, --with-png-dir=<DIR> and --with-zlib-dir=<DIR>
-See config.log for more information.
-])
- ])
- ;;
- *)
- if test -f "$PHP_PDFLIB/include/pdflib.h" ; then
-
- PHP_CHECK_LIBRARY(pdf, PDF_show_boxed,
- [
- AC_DEFINE(HAVE_PDFLIB,1,[ ])
- PHP_ADD_LIBRARY_WITH_PATH(pdf, $PHP_PDFLIB/lib, PDF_SHARED_LIBADD)
- PHP_ADD_INCLUDE($PHP_PDFLIB/include)
- ],[
- AC_MSG_ERROR([
-PDFlib extension requires at least pdflib 3.x. You may also need libtiff, libjpeg, libpng and libz.
-Use the options --with-tiff-dir=<DIR>, --with-jpeg-dir=<DIR>, --with-png-dir=<DIR> and --with-zlib-dir=<DIR>
-See config.log for more information.
-])
- ],[
- -L$PHP_PDFLIB/lib $PDF_SHARED_LIBADD
- ])
- else
- AC_MSG_ERROR([pdflib.h not found! Check the path passed to --with-pdflib=<PATH>. PATH should be the install prefix directory.])
- fi
- ;;
- esac
-fi
diff --git a/ext/pdf/pdf.c b/ext/pdf/pdf.c
deleted file mode 100644
index 75e53f93fc..0000000000
--- a/ext/pdf/pdf.c
+++ /dev/null
@@ -1,3231 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de> |
- | Rainer Schaaf <rjs@pdflib.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE.
- Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */
-/* Note that there is no code from the pdflib package in this file */
-
-/* {{{ includes
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "zend_list.h"
-#include "ext/standard/head.h"
-#include "ext/standard/info.h"
-#include "ext/standard/file.h"
-#include "php_streams.h"
-
-#if HAVE_LIBGD13
-#include "ext/gd/php_gd.h"
-#if HAVE_GD_BUNDLED
-#include "ext/gd/libgd/gd.h"
-#else
-#include "gd.h"
-#endif
-static int le_gd;
-#endif
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef PHP_WIN32
-# include <io.h>
-# include <fcntl.h>
-#endif
-/* }}} */
-
-#if HAVE_PDFLIB
-
-#include "php_pdf.h"
-
-static int le_pdf;
-
-/* {{{ constants
- * to adopt the php way of error handling to PDFlib
- * The image related functions in PDFlib return -1 on error
- * but they may return 0 (FALSE) in normal cases
- * so this offset will repair this
- */
-#define PDFLIB_IMAGE_OFFSET 1
-#define PDFLIB_FONT_OFFSET 1
-#define PDFLIB_PDI_OFFSET 1
-#define PDFLIB_PATTERN_OFFSET 1
-#define PDFLIB_SPOT_OFFSET 1
-/* }}} */
-
-/* {{{ pdf_functions[]
- */
-function_entry pdf_functions[] = {
- PHP_FE(pdf_new, NULL) /* new function */
- PHP_FE(pdf_delete, NULL) /* new function */
- PHP_FE(pdf_open_file, NULL) /* new function */
- PHP_FE(pdf_get_buffer, NULL) /* new function */
- PHP_FE(pdf_close, NULL)
- PHP_FE(pdf_begin_page, NULL)
- PHP_FE(pdf_end_page, NULL)
- PHP_FE(pdf_get_majorversion, NULL)
- PHP_FE(pdf_get_minorversion, NULL)
- PHP_FE(pdf_get_value, NULL)
- PHP_FE(pdf_set_value, NULL)
- PHP_FE(pdf_get_parameter, NULL)
- PHP_FE(pdf_set_parameter, NULL)
- PHP_FE(pdf_findfont, NULL) /* new function */
- PHP_FE(pdf_setfont, NULL) /* new function */
- PHP_FE(pdf_show, NULL)
- PHP_FE(pdf_show_xy, NULL)
- PHP_FE(pdf_continue_text, NULL)
- PHP_FE(pdf_show_boxed, NULL)
- PHP_FE(pdf_stringwidth, NULL) /* new parameters: [int font, float size] */
- PHP_FE(pdf_set_text_pos, NULL)
- PHP_FE(pdf_setdash, NULL)
- PHP_FE(pdf_setpolydash, NULL) /* new function: not yet finished */
- PHP_FE(pdf_setflat, NULL)
- PHP_FE(pdf_setlinejoin, NULL)
- PHP_FE(pdf_setlinecap, NULL)
- PHP_FE(pdf_setmiterlimit, NULL)
- PHP_FE(pdf_setlinewidth, NULL)
- PHP_FE(pdf_save, NULL)
- PHP_FE(pdf_restore, NULL)
- PHP_FE(pdf_translate, NULL)
- PHP_FE(pdf_scale, NULL)
- PHP_FE(pdf_rotate, NULL)
- PHP_FE(pdf_skew, NULL)
- PHP_FE(pdf_concat, NULL) /* new function */
- PHP_FE(pdf_moveto, NULL)
- PHP_FE(pdf_lineto, NULL)
- PHP_FE(pdf_curveto, NULL)
- PHP_FE(pdf_circle, NULL)
- PHP_FE(pdf_arc, NULL)
- PHP_FE(pdf_rect, NULL)
- PHP_FE(pdf_closepath, NULL)
- PHP_FE(pdf_stroke, NULL)
- PHP_FE(pdf_closepath_stroke, NULL)
- PHP_FE(pdf_fill, NULL)
- PHP_FE(pdf_fill_stroke, NULL)
- PHP_FE(pdf_closepath_fill_stroke, NULL)
- PHP_FE(pdf_clip, NULL)
- PHP_FE(pdf_endpath, NULL)
- PHP_FE(pdf_open_image_file, NULL) /* new parameters: [char *stringpram, int intparam] */
- PHP_FE(pdf_open_ccitt, NULL) /* new function */
- PHP_FE(pdf_open_image, NULL) /* new function */
- PHP_FE(pdf_close_image, NULL)
- PHP_FE(pdf_place_image, NULL)
- PHP_FE(pdf_add_bookmark, NULL)
- PHP_FE(pdf_set_info, NULL)
- PHP_FE(pdf_attach_file, NULL) /* new function */
- PHP_FE(pdf_add_note, NULL) /* new function */
- PHP_FE(pdf_add_pdflink, NULL)
- PHP_FE(pdf_add_locallink, NULL) /* new function */
- PHP_FE(pdf_add_launchlink, NULL)/* new function */
- PHP_FE(pdf_add_weblink, NULL)
- PHP_FE(pdf_set_border_style, NULL)
- PHP_FE(pdf_set_border_color, NULL)
- PHP_FE(pdf_set_border_dash, NULL)
-
- /* End of the official PDFLIB V3.x API */
-
- /* aliases for compatibility reasons */
- PHP_FALIAS(pdf_add_outline, pdf_add_bookmark, NULL)
-
- /* old font handling */
- PHP_FE(pdf_set_font, NULL) /* deprecated */
- PHP_FE(pdf_get_font, NULL) /* deprecated */
- PHP_FE(pdf_get_fontname, NULL) /* deprecated */
- PHP_FE(pdf_get_fontsize, NULL) /* deprecated */
-
- /* old way of starting a PDF document */
- PHP_FE(pdf_open, NULL) /* deprecated */
-
- /* old stuff for setting infos */
- PHP_FE(pdf_set_info_creator, NULL) /* deprecated */
- PHP_FE(pdf_set_info_title, NULL) /* deprecated */
- PHP_FE(pdf_set_info_subject, NULL) /* deprecated */
- PHP_FE(pdf_set_info_author, NULL) /* deprecated */
- PHP_FE(pdf_set_info_keywords, NULL) /* deprecated */
- PHP_FE(pdf_set_leading, NULL) /* deprecated */
- PHP_FE(pdf_set_text_rendering, NULL) /* deprecated */
- PHP_FE(pdf_set_horiz_scaling, NULL) /* deprecated */
- PHP_FE(pdf_set_text_rise, NULL) /* deprecated */
- PHP_FE(pdf_set_char_spacing, NULL) /* deprecated */
- PHP_FE(pdf_set_word_spacing, NULL) /* deprecated */
- PHP_FE(pdf_set_transition, NULL) /* deprecated */
- PHP_FE(pdf_set_duration, NULL) /* deprecated */
- PHP_FE(pdf_get_image_height, NULL) /* deprecated */
- PHP_FE(pdf_get_image_width, NULL) /* deprecated */
-
- /* old stuff for opening images */
- PHP_FE(pdf_open_jpeg, NULL) /* deprecated */
- PHP_FE(pdf_open_tiff, NULL) /* deprecated */
- PHP_FE(pdf_open_png, NULL) /* deprecated */
- PHP_FE(pdf_open_gif, NULL) /* deprecated */
-
- /* some more stuff for compatibility */
- PHP_FE(pdf_add_annotation, NULL)
-#if HAVE_LIBGD13
- PHP_FE(pdf_open_memory_image, NULL)
-#endif
- /* depreciatet after V4.0 of PDFlib */
- PHP_FE(pdf_setgray_fill, NULL)
- PHP_FE(pdf_setgray_stroke, NULL)
- PHP_FE(pdf_setgray, NULL)
- PHP_FE(pdf_setrgbcolor_fill, NULL)
- PHP_FE(pdf_setrgbcolor_stroke, NULL)
- PHP_FE(pdf_setrgbcolor, NULL)
-
-#if (PDFLIB_MAJORVERSION >= 4)
-/* support for new functions in PDFlib V4.0 */
- PHP_FE(pdf_open_pdi, NULL)
- PHP_FE(pdf_close_pdi, NULL)
- PHP_FE(pdf_open_pdi_page, NULL)
- PHP_FE(pdf_place_pdi_page, NULL)
- PHP_FE(pdf_close_pdi_page, NULL)
- PHP_FE(pdf_get_pdi_parameter, NULL)
- PHP_FE(pdf_get_pdi_value, NULL)
- PHP_FE(pdf_begin_pattern, NULL)
- PHP_FE(pdf_end_pattern, NULL)
- PHP_FE(pdf_begin_template, NULL)
- PHP_FE(pdf_end_template, NULL)
- PHP_FE(pdf_setcolor, NULL)
- PHP_FE(pdf_makespotcolor, NULL)
- PHP_FE(pdf_arcn, NULL)
- PHP_FE(pdf_add_thumbnail, NULL)
- PHP_FE(pdf_initgraphics, NULL)
- PHP_FE(pdf_setmatrix, NULL)
-#endif /* PDFlib >= V4 */
-
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ pdf_module_entry
- */
-zend_module_entry pdf_module_entry = {
- STANDARD_MODULE_HEADER,
- "pdf",
- pdf_functions,
- PHP_MINIT(pdf),
- PHP_MSHUTDOWN(pdf),
- NULL,
- NULL,
- PHP_MINFO(pdf),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_PDF
-ZEND_GET_MODULE(pdf)
-#endif
-
-/* {{{ _free_pdf_doc
- */
-static void _free_pdf_doc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- PDF *pdf = (PDF *)rsrc->ptr;
- PDF_delete(pdf);
-}
-/* }}} */
-
-/* {{{ custom_errorhandler
- */
-static void custom_errorhandler(PDF *p, int type, const char *shortmsg)
-{
- TSRMLS_FETCH();
- switch (type){
- case PDF_NonfatalError:
- /*
- * PDFlib warnings should be visible to the user.
- * If he decides to live with PDFlib warnings
- * he may use the PDFlib function
- * pdf_set_parameter($p, "warning" 0) to switch off
- * the warnings inside PDFlib.
- */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Internal PDFlib warning: %s", shortmsg);
- return;
- case PDF_MemoryError: /* give up in all other cases */
- case PDF_IOError:
- case PDF_RuntimeError:
- case PDF_IndexError:
- case PDF_TypeError:
- case PDF_DivisionByZero:
- case PDF_OverflowError:
- case PDF_SyntaxError:
- case PDF_ValueError:
- case PDF_SystemError:
- case PDF_UnknownError:
- default:
- php_error_docref(NULL TSRMLS_CC, E_ERROR,"PDFlib error: %s", shortmsg);
- }
-}
-/* }}} */
-
-/* {{{ pdf_emalloc
- */
-static void *pdf_emalloc(PDF *p, size_t size, const char *caller)
-{
- return(emalloc(size));
-}
-/* }}} */
-
-/* {{{ pdf_realloc
- */
-static void *pdf_realloc(PDF *p, void *mem, size_t size, const char *caller)
-{
- return(erealloc(mem, size));
-}
-/* }}} */
-
-/* {{{ pdf_efree
- */
-static void pdf_efree(PDF *p, void *mem)
-{
- efree(mem);
-}
-/* }}} */
-
-/* {{{ pdf_flushwrite
- */
-static size_t pdf_flushwrite(PDF *p, void *data, size_t size)
-{
- TSRMLS_FETCH();
-
- return(php_write(data, size TSRMLS_CC));
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(pdf)
-{
- char tmp[32];
-
- snprintf(tmp, 31, "%d.%02d", PDF_get_majorversion(), PDF_get_minorversion() );
- tmp[31]=0;
-
- php_info_print_table_start();
- php_info_print_table_row(2, "PDF Support", "enabled" );
-#if (PDFLIB_MAJORVERSION >= 4)
- php_info_print_table_row(2, "PDFlib GmbH Version", PDFLIB_VERSIONSTRING );
-#else
- php_info_print_table_row(2, "PDFlib GmbH Version", tmp );
-#endif
- php_info_print_table_row(2, "Revision", "$Revision$" );
- php_info_print_table_end();
-
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(pdf)
-{
- if ((PDF_get_majorversion() != PDFLIB_MAJORVERSION) ||
- (PDF_get_minorversion() != PDFLIB_MINORVERSION)) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR,"PDFlib error: Version mismatch in wrapper code");
- }
- le_pdf = zend_register_list_destructors_ex(_free_pdf_doc, NULL, "pdf object", module_number);
-
- /* this does something like setlocale("C", ...) in PDFlib 3.x */
- PDF_boot();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(pdf)
-{
- PDF_shutdown();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ _php_pdf_set_info
- */
-static void _php_pdf_set_info(INTERNAL_FUNCTION_PARAMETERS, char *field)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- PDF_set_info(pdf, field, Z_STRVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool pdf_set_info(int pdfdoc, string fieldname, string value)
- Fills an info field of the document */
-PHP_FUNCTION(pdf_set_info)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- PDF_set_info(pdf, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool pdf_set_info_creator(int pdfdoc, string creator)
- Fills the creator field of the document */
-PHP_FUNCTION(pdf_set_info_creator)
-{
- _php_pdf_set_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, "Creator");
-}
-/* }}} */
-
-/* {{{ proto bool pdf_set_info_title(int pdfdoc, string title)
- Fills the title field of the document */
-PHP_FUNCTION(pdf_set_info_title)
-{
- _php_pdf_set_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, "Title");
-}
-/* }}} */
-
-/* {{{ proto bool pdf_set_info_subject(int pdfdoc, string subject)
- Fills the subject field of the document */
-PHP_FUNCTION(pdf_set_info_subject)
-{
- _php_pdf_set_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, "Subject");
-}
-/* }}} */
-
-/* {{{ proto bool pdf_set_info_author(int pdfdoc, string author)
- Fills the author field of the document */
-PHP_FUNCTION(pdf_set_info_author)
-{
- _php_pdf_set_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, "Author");
-}
-/* }}} */
-
-/* {{{ proto bool pdf_set_info_keywords(int pdfdoc, string keywords)
- Fills the keywords field of the document */
-PHP_FUNCTION(pdf_set_info_keywords)
-{
- _php_pdf_set_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, "Keywords");
-}
-/* }}} */
-
-/* {{{ proto resource pdf_open([int filedesc])
- Opens a new pdf document. If filedesc is NULL, document is created in memory. This is the old interface, only for compatibility use pdf_new + pdf_open_file instead */
-PHP_FUNCTION(pdf_open)
-{
- zval **file;
- FILE *fp = NULL;
- PDF *pdf;
- int argc = ZEND_NUM_ARGS();
-
- if(argc > 1) {
- WRONG_PARAM_COUNT;
- } else if (argc != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
- fp = NULL;
- } else {
- php_stream *stream;
-
- php_stream_from_zval(stream, file);
-
- if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void*)&fp, 1) == FAILURE) {
- RETURN_FALSE;
- }
- }
-
- pdf = PDF_new2(custom_errorhandler, pdf_emalloc, pdf_realloc, pdf_efree, NULL);
-
- if(fp) {
- if (PDF_open_fp(pdf, fp) < 0) {
- RETURN_FALSE;
- }
- } else {
- PDF_open_mem(pdf, pdf_flushwrite);
- }
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_set_parameter(pdf, "imagewarning", "true");
-#endif
- PDF_set_parameter(pdf, "binding", "PHP");
-
- ZEND_REGISTER_RESOURCE(return_value, pdf, le_pdf);
-}
-
-/* }}} */
-
-/* {{{ proto void pdf_close(int pdfdoc)
- Closes the pdf document */
-PHP_FUNCTION(pdf_close)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_close(pdf);
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto void pdf_begin_page(int pdfdoc, float width, float height)
- Starts page */
-PHP_FUNCTION(pdf_begin_page)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_begin_page(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_end_page(int pdfdoc)
- Ends page */
-PHP_FUNCTION(pdf_end_page)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_end_page(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_show(int pdfdoc, string text)
- Output text at current position */
-PHP_FUNCTION(pdf_show)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- PDF_show2(pdf, Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_show_xy(int pdfdoc, string text, float x_koor, float y_koor)
- Output text at position */
-PHP_FUNCTION(pdf_show_xy)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- PDF_show_xy2(pdf, Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pdf_show_boxed(int pdfdoc, string text, float x_koor, float y_koor, float width, float height, string mode [, string feature])
- Output text formated in a boxed */
-PHP_FUNCTION(pdf_show_boxed)
-{
- zval **argv[8];
- int argc = ZEND_NUM_ARGS();
- int nr;
- char *feature;
- PDF *pdf;
-
- if (((argc < 7) || (argc > 8)) || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, argv[0], -1, "pdf object", le_pdf);
-
- convert_to_string_ex(argv[1]);
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
- convert_to_double_ex(argv[4]);
- convert_to_double_ex(argv[5]);
- convert_to_string_ex(argv[6]);
-
- if(argc == 8) {
- convert_to_string_ex(argv[7]);
- feature = Z_STRVAL_PP(argv[7]);
- } else {
- feature = NULL;
- }
-
- nr = PDF_show_boxed(pdf, Z_STRVAL_PP(argv[1]),
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]),
- (float) Z_DVAL_PP(argv[5]),
- Z_STRVAL_PP(argv[6]),
- feature);
-
- RETURN_LONG(nr);
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_font(int pdfdoc, string font, float size, string encoding [, int embed])
- Select the current font face, size and encoding */
-PHP_FUNCTION(pdf_set_font)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
- int font, embed;
- PDF *pdf;
-
- switch (ZEND_NUM_ARGS()) {
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- embed = 0;
- break;
- case 5:
- if (zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg5);
- embed = Z_LVAL_PP(arg5);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_string_ex(arg4);
-
- font = PDF_findfont(pdf, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg4), embed);
- if (font == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Font %s not found", Z_STRVAL_PP(arg2));
- RETURN_FALSE;
- }
-
- PDF_setfont(pdf, font, (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ _php_pdf_set_value
- */
-static void _php_pdf_set_value(INTERNAL_FUNCTION_PARAMETERS, char *field)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- PDF_set_value(pdf, field, (float)Z_DVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_value(int pdfdoc, string key, float value)
- Sets arbitrary value */
-PHP_FUNCTION(pdf_set_value)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_set_value(pdf, Z_STRVAL_PP(arg2), (float)Z_DVAL_PP(arg3));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto float pdf_get_value(int pdfdoc, string key, float modifier)
- Gets arbitrary value */
-PHP_FUNCTION(pdf_get_value)
-{
- zval **argv[3];
- int argc = ZEND_NUM_ARGS();
- PDF *pdf;
- double value;
-
- if(((argc < 2) || (argc > 3)) || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, argv[0], -1, "pdf object", le_pdf);
-
- convert_to_string_ex(argv[1]);
- if(argc == 3)
- convert_to_double_ex(argv[2]);
-
- if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "imagewidth"))) {
- if(argc < 3) WRONG_PARAM_COUNT;
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2])-PDFLIB_IMAGE_OFFSET);
- } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "imageheight"))) {
- if(argc < 3) WRONG_PARAM_COUNT;
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2])-PDFLIB_IMAGE_OFFSET);
- } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "resx"))) {
- if(argc < 3) WRONG_PARAM_COUNT;
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2])-PDFLIB_IMAGE_OFFSET);
- } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "resy"))) {
- if(argc < 3) WRONG_PARAM_COUNT;
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2])-PDFLIB_IMAGE_OFFSET);
- } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "capheight"))) {
- if(argc < 3) WRONG_PARAM_COUNT;
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2])-PDFLIB_FONT_OFFSET);
- } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "ascender"))) {
- if(argc < 3) WRONG_PARAM_COUNT;
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2])-PDFLIB_FONT_OFFSET);
- } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "descender"))) {
- if(argc < 3) WRONG_PARAM_COUNT;
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2])-PDFLIB_FONT_OFFSET);
- } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "font"))) {
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), 0.0)+PDFLIB_FONT_OFFSET;
- } else {
- if(argc < 3) {
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), 0.0);
- } else {
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2]));
- }
- }
-
- RETURN_DOUBLE(value);
-}
-/* }}} */
-
-/* {{{ proto int pdf_get_font(int pdfdoc)
- Gets the current font */
-PHP_FUNCTION(pdf_get_font)
-{
- zval **arg1;
- int font;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- font = (int) PDF_get_value(pdf, "font", 0);
- RETURN_LONG(font+PDFLIB_FONT_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto string pdf_get_fontname(int pdfdoc)
- Gets the current font name */
-PHP_FUNCTION(pdf_get_fontname)
-{
- zval **arg1;
- char *fontname;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- fontname = (char *) PDF_get_parameter(pdf, "fontname", 0);
- RETURN_STRING(fontname, 1);
-}
-/* }}} */
-
-/* {{{ proto float pdf_get_fontsize(int pdfdoc)
- Gets the current font size */
-PHP_FUNCTION(pdf_get_fontsize)
-{
- zval **arg1;
- float fontsize;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- fontsize = PDF_get_value(pdf, "fontsize", 0);
- RETURN_DOUBLE(fontsize);
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_leading(int pdfdoc, float distance)
- Sets distance between text lines */
-PHP_FUNCTION(pdf_set_leading)
-{
- _php_pdf_set_value(INTERNAL_FUNCTION_PARAM_PASSTHRU, "leading");
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_text_rendering(int pdfdoc, int mode)
- Determines how text is rendered */
-PHP_FUNCTION(pdf_set_text_rendering)
-{
- _php_pdf_set_value(INTERNAL_FUNCTION_PARAM_PASSTHRU, "textrendering");
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_horiz_scaling(int pdfdoc, float scale)
- Sets horizontal scaling of text */
-PHP_FUNCTION(pdf_set_horiz_scaling)
-{
- _php_pdf_set_value(INTERNAL_FUNCTION_PARAM_PASSTHRU, "horizscaling");
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_text_rise(int pdfdoc, float value)
- Sets the text rise */
-PHP_FUNCTION(pdf_set_text_rise)
-{
- _php_pdf_set_value(INTERNAL_FUNCTION_PARAM_PASSTHRU, "textrise");
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_char_spacing(int pdfdoc, float space)
- Sets character spacing */
-PHP_FUNCTION(pdf_set_char_spacing)
-{
- _php_pdf_set_value(INTERNAL_FUNCTION_PARAM_PASSTHRU, "charspacing");
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_word_spacing(int pdfdoc, float space)
- Sets spacing between words */
-PHP_FUNCTION(pdf_set_word_spacing)
-{
- _php_pdf_set_value(INTERNAL_FUNCTION_PARAM_PASSTHRU, "wordspacing");
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_text_pos(int pdfdoc, float x, float y)
- Sets the position of text for the next pdf_show call */
-PHP_FUNCTION(pdf_set_text_pos)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_set_text_pos(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_continue_text(int pdfdoc, string text)
- Output text in next line */
-PHP_FUNCTION(pdf_continue_text)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- PDF_continue_text2(pdf, Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto float pdf_stringwidth(int pdfdoc, string text [, int font, float size])
- Returns width of text in current font */
-PHP_FUNCTION(pdf_stringwidth)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- int font;
- double width, size;
- PDF *pdf;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(arg3);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- if (ZEND_NUM_ARGS() == 2) {
- font = (int)PDF_get_value(pdf, "font", 0)+PDFLIB_FONT_OFFSET;
- size = PDF_get_value(pdf, "fontsize", 0);
- } else {
- convert_to_long_ex(arg3);
- font = Z_LVAL_PP(arg3);
- convert_to_double_ex(arg4);
- size = Z_DVAL_PP(arg4);
- }
- width = (double) PDF_stringwidth2(pdf,
- Z_STRVAL_PP(arg2),
- Z_STRLEN_PP(arg2),
- font-PDFLIB_FONT_OFFSET,
- (float)size);
-
- RETURN_DOUBLE((double) width);
-}
-/* }}} */
-
-/* {{{ proto void pdf_save(int pdfdoc)
- Saves current enviroment */
-PHP_FUNCTION(pdf_save)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_save(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_restore(int pdfdoc)
- Restores formerly saved enviroment */
-PHP_FUNCTION(pdf_restore)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_restore(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_translate(int pdfdoc, float x, float y)
- Sets origin of coordinate system */
-PHP_FUNCTION(pdf_translate)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_translate(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_scale(int pdfdoc, float x_scale, float y_scale)
- Sets scaling */
-PHP_FUNCTION(pdf_scale)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_scale(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_rotate(int pdfdoc, float angle)
- Sets rotation */
-PHP_FUNCTION(pdf_rotate)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- PDF_rotate(pdf, (float) Z_DVAL_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_skew(int pdfdoc, float xangle, float yangle)
- Skew the coordinate system */
-PHP_FUNCTION(pdf_skew)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_skew(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setflat(int pdfdoc, float value)
- Sets flatness */
-PHP_FUNCTION(pdf_setflat)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- /* pdflib will do this for you, will throw some exception
- if((Z_LVAL_PP(arg2) > 100) && (Z_LVAL_PP(arg2) < 0)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter of pdf_setflat() has to between 0 and 100");
- RETURN_FALSE;
- }
- */
-
- PDF_setflat(pdf, (float) Z_DVAL_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setlinejoin(int pdfdoc, int value)
- Sets linejoin parameter */
-PHP_FUNCTION(pdf_setlinejoin)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
- /* pdflib will do this for you, will throw some exception
- if((Z_LVAL_PP(arg2) > 2) && (Z_LVAL_PP(arg2) < 0)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter of pdf_setlinejoin() must be between 0 and 2");
- RETURN_FALSE;
- }
- */
-
- PDF_setlinejoin(pdf, Z_LVAL_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setlinecap(int pdfdoc, int value)
- Sets linecap parameter */
-PHP_FUNCTION(pdf_setlinecap)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
- /* pdflib will do this for you, will throw some exception
- if((Z_LVAL_PP(arg2) > 2) && (Z_LVAL_PP(arg2) < 0)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter of pdf_setlinecap() must be > 0 and <= 2");
- RETURN_FALSE;
- }
- */
-
- PDF_setlinecap(pdf, Z_LVAL_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setmiterlimit(int pdfdoc, float value)
- Sets miter limit */
-PHP_FUNCTION(pdf_setmiterlimit)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- /* pdflib will do this for you, will throw some exception
- if(Z_DVAL_PP(arg2) < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter of pdf_setmiterlimit() must be >= 1");
- RETURN_FALSE;
- }
- */
-
- PDF_setmiterlimit(pdf, (float) Z_DVAL_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setlinewidth(int pdfdoc, float width)
- Sets line width */
-PHP_FUNCTION(pdf_setlinewidth)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- PDF_setlinewidth(pdf, (float) Z_DVAL_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setdash(int pdfdoc, float black, float white)
- Sets dash pattern */
-PHP_FUNCTION(pdf_setdash)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_setdash(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_moveto(int pdfdoc, float x, float y)
- Sets current point */
-PHP_FUNCTION(pdf_moveto)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_moveto(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_curveto(int pdfdoc, float x1, float y1, float x2, float y2, float x3, float y3)
- Draws a curve */
-PHP_FUNCTION(pdf_curveto)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 7 || zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_double_ex(arg6);
- convert_to_double_ex(arg7);
-
- PDF_curveto(pdf, (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- (float) Z_DVAL_PP(arg6),
- (float) Z_DVAL_PP(arg7));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_lineto(int pdfdoc, float x, float y)
- Draws a line */
-PHP_FUNCTION(pdf_lineto)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_lineto(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_circle(int pdfdoc, float x, float y, float radius)
- Draws a circle */
-PHP_FUNCTION(pdf_circle)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- PDF_circle(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_arc(int pdfdoc, float x, float y, float radius, float start, float end)
- Draws an arc */
-PHP_FUNCTION(pdf_arc)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_double_ex(arg6);
-
- PDF_arc(pdf, (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- (float) Z_DVAL_PP(arg6));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_rect(int pdfdoc, float x, float y, float width, float height)
- Draws a rectangle */
-PHP_FUNCTION(pdf_rect)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
-
- PDF_rect(pdf, (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_closepath(int pdfdoc)
- Close path */
-PHP_FUNCTION(pdf_closepath)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_closepath(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_closepath_stroke(int pdfdoc)
- Close path and draw line along path */
-PHP_FUNCTION(pdf_closepath_stroke)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_closepath_stroke(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_stroke(int pdfdoc)
- Draw line along path path */
-PHP_FUNCTION(pdf_stroke)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_stroke(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_fill(int pdfdoc)
- Fill current path */
-PHP_FUNCTION(pdf_fill)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_fill(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_fill_stroke(int pdfdoc)
- Fill and stroke current path */
-PHP_FUNCTION(pdf_fill_stroke)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_fill_stroke(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_closepath_fill_stroke(int pdfdoc)
- Close, fill and stroke current path */
-PHP_FUNCTION(pdf_closepath_fill_stroke)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_closepath_fill_stroke(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_endpath(int pdfdoc)
- Ends current path */
-PHP_FUNCTION(pdf_endpath)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_endpath(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_clip(int pdfdoc)
- Clips to current path */
-PHP_FUNCTION(pdf_clip)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_clip(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_parameter(int pdfdoc, string key, string value)
- Sets arbitrary parameters */
-PHP_FUNCTION(pdf_set_parameter)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- PDF_set_parameter(pdf, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string pdf_get_parameter(int pdfdoc, string key, mixed modifier)
- Gets arbitrary parameters */
-PHP_FUNCTION(pdf_get_parameter)
-{
- zval **argv[3];
- int argc = ZEND_NUM_ARGS();
- PDF *pdf;
- char *value;
-
- if(((argc < 2) || (argc > 3)) || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, argv[0], -1, "pdf object", le_pdf);
-
- convert_to_string_ex(argv[1]);
- if(argc == 3) {
- convert_to_double_ex(argv[2]);
- value = (char *) PDF_get_parameter(pdf, Z_STRVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]));
- } else {
- value = (char *) PDF_get_parameter(pdf, Z_STRVAL_PP(argv[1]), 0.0);
- }
-
- RETURN_STRING(value, 1);
-}
-/* }}} */
-
-/* {{{ proto void pdf_setgray_fill(int pdfdoc, float value)
- Sets filling color to gray value */
-PHP_FUNCTION(pdf_setgray_fill)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_setcolor(pdf, "fill", "gray", (float) Z_DVAL_PP(arg2), 0, 0, 0);
-#else
- PDF_setgray_fill(pdf, (float) Z_DVAL_PP(arg2));
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setgray_stroke(int pdfdoc, float value)
- Sets drawing color to gray value */
-PHP_FUNCTION(pdf_setgray_stroke)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_setcolor(pdf, "stroke", "gray", (float) Z_DVAL_PP(arg2), 0, 0, 0);
-#else
- PDF_setgray_stroke(pdf, (float) Z_DVAL_PP(arg2));
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setgray(int pdfdoc, float value)
- Sets drawing and filling color to gray value */
-PHP_FUNCTION(pdf_setgray)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_setcolor(pdf, "both", "gray", (float) Z_DVAL_PP(arg2), 0, 0, 0);
-#else
- PDF_setgray(pdf, (float) Z_DVAL_PP(arg2));
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setrgbcolor_fill(int pdfdoc, float red, float green, float blue)
- Sets filling color to RGB color value */
-PHP_FUNCTION(pdf_setrgbcolor_fill)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_setcolor(pdf, "fill", "rgb", (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4), 0);
-#else
- PDF_setrgbcolor_fill(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4));
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setrgbcolor_stroke(int pdfdoc, float red, float green, float blue)
- Sets drawing color to RGB color value */
-PHP_FUNCTION(pdf_setrgbcolor_stroke)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_setcolor(pdf, "stroke", "rgb", (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4), 0);
-#else
- PDF_setrgbcolor_stroke(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4));
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setrgbcolor(int pdfdoc, float red, float green, float blue)
- Sets drawing and filling color to RGB color value */
-PHP_FUNCTION(pdf_setrgbcolor)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_setcolor(pdf, "both", "rgb", (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4), 0);
-#else
- PDF_setrgbcolor(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4));
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pdf_add_bookmark(int pdfdoc, string text [, int parent, int open])
- Adds bookmark for current page */
-PHP_FUNCTION(pdf_add_bookmark)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- int parentid, open, id;
- PDF *pdf;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
-
- if (ZEND_NUM_ARGS() > 2) {
- convert_to_long_ex(arg3);
- parentid = Z_LVAL_PP(arg3);
-
- if (ZEND_NUM_ARGS() > 3) {
- convert_to_long_ex(arg4);
- open = Z_LVAL_PP(arg4);
- } else {
- open = 0;
- }
- } else {
- parentid = 0;
- open = 0;
- }
-
- /* will never return 0 */
- id = PDF_add_bookmark(pdf, Z_STRVAL_PP(arg2), parentid, open);
-
- RETURN_LONG(id);
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_transition(int pdfdoc, int transition)
- Sets transition between pages */
-PHP_FUNCTION(pdf_set_transition)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
-
- switch(Z_LVAL_PP(arg2)) {
- case 0:
- PDF_set_parameter(pdf, "transition", "none");
- break;
- case 1:
- PDF_set_parameter(pdf, "transition", "split");
- break;
- case 2:
- PDF_set_parameter(pdf, "transition", "blinds");
- break;
- case 3:
- PDF_set_parameter(pdf, "transition", "box");
- break;
- case 4:
- PDF_set_parameter(pdf, "transition", "wipe");
- break;
- case 5:
- PDF_set_parameter(pdf, "transition", "dissolve");
- break;
- case 6:
- PDF_set_parameter(pdf, "transition", "glitter");
- break;
- case 7:
- PDF_set_parameter(pdf, "transition", "replace");
- break;
- default:
- PDF_set_parameter(pdf, "transition", "none");
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_duration(int pdfdoc, float duration)
- Sets duration between pages */
-PHP_FUNCTION(pdf_set_duration)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- PDF_set_value(pdf, "duration", (float) Z_DVAL_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ _php_pdf_open_image
- */
-static void _php_pdf_open_image(INTERNAL_FUNCTION_PARAMETERS, char *type)
-{
- zval **arg1, **arg2;
- PDF *pdf;
- int pdf_image;
- char *image;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
-
-#ifdef VIRTUAL_DIR
- virtual_filepath(Z_STRVAL_PP(arg2), &image TSRMLS_CC);
-#else
- image = Z_STRVAL_PP(arg2);
-#endif
-
- pdf_image = PDF_open_image_file(pdf, type, image, "", 0);
-
- RETURN_LONG(pdf_image+PDFLIB_IMAGE_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_gif(int pdf, string giffile)
- Opens a GIF file and returns an image for placement in a pdf object */
-PHP_FUNCTION(pdf_open_gif)
-{
- _php_pdf_open_image(INTERNAL_FUNCTION_PARAM_PASSTHRU,"gif");
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_jpeg(int pdf, string jpegfile)
- Opens a JPEG file and returns an image for placement in a PDF document */
-PHP_FUNCTION(pdf_open_jpeg)
-{
- _php_pdf_open_image(INTERNAL_FUNCTION_PARAM_PASSTHRU,"jpeg");
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_png(int pdf, string pngfile)
- Opens a PNG file and returns an image for placement in a PDF document */
-PHP_FUNCTION(pdf_open_png)
-{
- _php_pdf_open_image(INTERNAL_FUNCTION_PARAM_PASSTHRU,"png");
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_tiff(int pdf, string tifffile)
- Opens a TIFF file and returns an image for placement in a PDF document */
-PHP_FUNCTION(pdf_open_tiff)
-{
- _php_pdf_open_image(INTERNAL_FUNCTION_PARAM_PASSTHRU,"tiff");
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_image_file(int pdf, string type, string file, string stringparam, int intparam)
- Opens an image file of the given type and returns an image for placement in a PDF document */
-PHP_FUNCTION(pdf_open_image_file)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
- PDF *pdf;
- int pdf_image, argc;
- char *image;
- char *stringparam;
- int intparam;
-
- switch ((argc = ZEND_NUM_ARGS())) {
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 5:
- if (zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
-#ifdef VIRTUAL_DIR
- virtual_filepath(Z_STRVAL_PP(arg3), &image TSRMLS_CC);
-#else
- image = Z_STRVAL_PP(arg3);
-#endif
-
- if (argc == 3) {
- pdf_image = PDF_open_image_file(pdf, Z_STRVAL_PP(arg2), image, "", 0);
- } else {
- convert_to_string_ex(arg4);
- convert_to_long_ex(arg5);
-
- stringparam = Z_STRVAL_PP(arg4);
- intparam = Z_LVAL_PP(arg5);
-
- /* adjust the image handle */
- if (!strcmp(stringparam, "masked"))
- intparam -= PDFLIB_IMAGE_OFFSET;
-
- pdf_image = PDF_open_image_file(pdf, Z_STRVAL_PP(arg2), image, stringparam, intparam);
- }
-
- if (pdf_image == -1) {
- /* pdflib will do this for you, will throw some exception
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not open image: %s", image);
- */
- RETURN_FALSE;
- }
- RETURN_LONG(pdf_image+PDFLIB_IMAGE_OFFSET);
-
-}
-/* }}} */
-
-#if HAVE_LIBGD13
-/* {{{ proto int pdf_open_memory_image(int pdf, int image)
- Takes an GD image and returns an image for placement in a PDF document */
-PHP_FUNCTION(pdf_open_memory_image)
-{
- zval **arg1, **arg2;
- int i, j, color, count;
- int pdf_image;
- gdImagePtr im;
- unsigned char *buffer, *ptr;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
- ZEND_GET_RESOURCE_TYPE_ID(le_gd,"gd");
- if(!le_gd)
- {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to find handle for GD image stream. Please check the GD extension is loaded.");
- }
- ZEND_FETCH_RESOURCE(im, gdImagePtr, arg2, -1, "Image", le_gd);
-
- count = 3 * im->sx * im->sy;
- buffer = (unsigned char *) emalloc(count);
-
- ptr = buffer;
- for(i=0; i<im->sy; i++) {
- for(j=0; j<im->sx; j++) {
-#if HAVE_LIBGD20
- if(gdImageTrueColor(im)) {
- if (im->tpixels && gdImageBoundsSafe(im, j, i)) {
- color = gdImageTrueColorPixel(im, j, i);
- *ptr++ = (color >> 16) & 0xFF;
- *ptr++ = (color >> 8) & 0xFF;
- *ptr++ = color & 0xFF;
- }
- } else {
-#endif
- if (im->pixels && gdImageBoundsSafe(im, j, i)) {
- color = im->pixels[i][j];
- *ptr++ = im->red[color];
- *ptr++ = im->green[color];
- *ptr++ = im->blue[color];
- }
-#if HAVE_LIBGD20
- }
-#endif
- }
- }
-
- pdf_image = PDF_open_image(pdf, "raw", "memory", buffer, im->sx*im->sy*3, im->sx, im->sy, 3, 8, NULL);
- efree(buffer);
-
- if(pdf_image == -1) {
- /* pdflib will do this for you, will throw some exception
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not open image");
- */
- efree(buffer);
- RETURN_FALSE;
- }
-
- RETURN_LONG(pdf_image+PDFLIB_IMAGE_OFFSET);
-}
-/* }}} */
-#endif /* HAVE_LIBGD13 */
-
-/* {{{ proto void pdf_close_image(int pdf, int pdfimage)
- Closes the PDF image */
-PHP_FUNCTION(pdf_close_image)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
- convert_to_long_ex(arg2);
-
- PDF_close_image(pdf, Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_place_image(int pdf, int pdfimage, float x, float y, float scale)
- Places image in the PDF document */
-PHP_FUNCTION(pdf_place_image)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
-
- PDF_place_image(pdf, Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET, (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4), (float) Z_DVAL_PP(arg5));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pdf_get_image_width(int pdf, int pdfimage)
- Returns the width of an image */
-PHP_FUNCTION(pdf_get_image_width)
-{
- zval **arg1, **arg2;
- PDF *pdf;
- int width;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
- convert_to_long_ex(arg2);
-
- width = (int) PDF_get_value(pdf, "imagewidth", (float)Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET);
- RETURN_LONG(width);
-}
-/* }}} */
-
-/* {{{ proto int pdf_get_image_height(int pdf, int pdfimage)
- Returns the height of an image */
-PHP_FUNCTION(pdf_get_image_height)
-{
- zval **arg1, **arg2;
- PDF *pdf;
- int height;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
- convert_to_long_ex(arg2);
-
- height = (int) PDF_get_value(pdf, "imageheight", (float)Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET);
- RETURN_LONG(height);
-}
-/* }}} */
-
-/* {{{ proto void pdf_add_weblink(int pdfdoc, float llx, float lly, float urx, float ury, string url)
- Adds link to web resource */
-PHP_FUNCTION(pdf_add_weblink)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_string_ex(arg6);
- PDF_add_weblink(pdf, (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- Z_STRVAL_PP(arg6));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_add_pdflink(int pdfdoc, float llx, float lly, float urx, float ury, string filename, int page, string dest)
- Adds link to PDF document */
-PHP_FUNCTION(pdf_add_pdflink)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 8 || zend_get_parameters_ex(8, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7, &arg8) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_long_ex(arg7);
- convert_to_string_ex(arg8);
- PDF_add_pdflink(pdf, (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- Z_STRVAL_PP(arg6),
- Z_LVAL_PP(arg7),
- Z_STRVAL_PP(arg8));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_border_style(int pdfdoc, string style, float width)
- Sets style of box surounding all kinds of annotations and link */
-PHP_FUNCTION(pdf_set_border_style)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_set_border_style(pdf, Z_STRVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_border_color(int pdfdoc, float red, float green, float blue)
- Sets color of box surounded all kinds of annotations and links */
-PHP_FUNCTION(pdf_set_border_color)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- PDF_set_border_color(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_border_dash(int pdfdoc, float black, float white)
- Sets the border dash style of all kinds of annotations and links */
-PHP_FUNCTION(pdf_set_border_dash)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_set_border_dash(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_add_annotation(int pdfdoc, float xll, float yll, float xur, float xur, string title, string text)
- Sets annotation (depreciated use pdf_add_note instead) */
-PHP_FUNCTION(pdf_add_annotation)
-{
- zval **argv[7];
- PDF *pdf;
-
- if(ZEND_NUM_ARGS() != 7 || zend_get_parameters_array_ex(7, argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, argv[0], -1, "pdf object", le_pdf);
-
- convert_to_double_ex(argv[1]);
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
- convert_to_double_ex(argv[4]);
- convert_to_string_ex(argv[5]);
- convert_to_string_ex(argv[6]);
-
- PDF_add_note(pdf, (float) Z_DVAL_PP(argv[1]),
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]),
- Z_STRVAL_PP(argv[6]),
- Z_STRVAL_PP(argv[5]),
- "note", 1);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* RJS: START OF NEW CODE */
-
-/* {{{ proto resource pdf_new()
- Creates a new PDF object */
-PHP_FUNCTION(pdf_new)
-{
- PDF *pdf;
-
- pdf = PDF_new2(custom_errorhandler, pdf_emalloc, pdf_realloc, pdf_efree, NULL);
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_set_parameter(pdf, "imagewarning", "true");
-#endif
- PDF_set_parameter(pdf, "binding", "PHP");
-
- ZEND_REGISTER_RESOURCE(return_value, pdf, le_pdf);
-}
-/* }}} */
-
-/* {{{ proto int pdf_get_majorversion()
- Returns the major version number of the PDFlib */
-PHP_FUNCTION(pdf_get_majorversion)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_LONG(PDF_get_majorversion());
-}
-/* }}} */
-
-/* {{{ proto int pdf_get_minorversion()
- Returns the minor version number of the PDFlib */
-PHP_FUNCTION(pdf_get_minorversion)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_LONG(PDF_get_minorversion());
-}
-/* }}} */
-
-/* {{{ proto bool pdf_delete(int pdfdoc)
- Deletes the PDF object */
-PHP_FUNCTION(pdf_delete)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
- zend_list_delete(Z_RESVAL_PP(arg1));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_file(int pdfdoc [, char filename])
- Opens a new PDF document. If filename is NULL, document is created in memory. This is not yet fully supported */
-
-PHP_FUNCTION(pdf_open_file)
-{
- zval **arg1, **arg2;
- int pdf_file;
- char *filename;
- int argc;
- PDF *pdf;
-
- if((argc = ZEND_NUM_ARGS()) > 2)
- WRONG_PARAM_COUNT;
-
- if (argc == 1) {
- if (zend_get_parameters_ex(1, &arg1) == FAILURE)
- WRONG_PARAM_COUNT;
- } else {
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- if (argc == 2) {
- convert_to_string_ex(arg2);
- filename = Z_STRVAL_PP(arg2);
- pdf_file = PDF_open_file(pdf, filename);
- } else {
- /* open in memory */
- pdf_file = PDF_open_file(pdf, "");
- }
-
- if (pdf_file == -1)
- RETURN_FALSE;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string pdf_get_buffer(int pdfdoc)
- Fetches the full buffer containig the generated PDF data */
-PHP_FUNCTION(pdf_get_buffer)
-{
- zval **arg1;
- long size;
- PDF *pdf;
- const char *buffer;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- buffer = PDF_get_buffer(pdf, &size);
-
- RETURN_STRINGL((char *)buffer, size, 1);
-}
-/* }}} */
-
-/* {{{ proto int pdf_findfont(int pdfdoc, string fontname, string encoding [, int embed])
- Prepares the font fontname for later use with pdf_setfont() */
-PHP_FUNCTION(pdf_findfont)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- int embed, font;
- const char *fontname, *encoding;
- PDF *pdf;
-
- switch (ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- embed = 0;
- break;
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg4);
- embed = Z_LVAL_PP(arg4);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- fontname = Z_STRVAL_PP(arg2);
-
- convert_to_string_ex(arg3);
- encoding = Z_STRVAL_PP(arg3);
-
- font = PDF_findfont(pdf, fontname, encoding, embed);
- if (font == -1) {
- /* pdflib will do this for you, will throw some exception
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Font %s not found", fontname);
- */
- RETURN_FALSE;
- }
-
- RETURN_LONG(font+PDFLIB_FONT_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_setfont(int pdfdoc, int font, float fontsize)
- Sets the current font in the fiven fontsize */
-PHP_FUNCTION(pdf_setfont)
-{
- zval **arg1, **arg2, **arg3;
- int font;
- float fontsize;
- PDF *pdf;
-
- if(ZEND_NUM_ARGS() != 3)
- WRONG_PARAM_COUNT;
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
- font = Z_LVAL_PP(arg2);
-
- convert_to_double_ex(arg3);
- fontsize = (float)Z_DVAL_PP(arg3);
-
- PDF_setfont(pdf, font-PDFLIB_FONT_OFFSET, fontsize);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setpolydash(int pdfdoc, float darray)
- Sets more complicated dash pattern */
-
-PHP_FUNCTION(pdf_setpolydash)
-{
- zval **arg1, **arg2;
- HashTable *array;
- int len, i;
- float *darray;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_array_ex(arg2);
- array = Z_ARRVAL_PP(arg2);
- len = zend_hash_num_elements(array);
-
- darray = safe_emalloc(len, sizeof(double), 0);
- zend_hash_internal_pointer_reset(array);
- for (i=0; i<len; i++) {
- zval *keydata, **keydataptr;
-
- zend_hash_get_current_data(array, (void **) &keydataptr);
- keydata = *keydataptr;
- if (Z_TYPE_P(keydata) == IS_DOUBLE) {
- darray[i] = (float) Z_DVAL_P(keydata);
- } else if (Z_TYPE_P(keydata) == IS_LONG) {
- darray[i] = (float) Z_LVAL_P(keydata);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PDFlib set_polydash: illegal darray value");
- }
- zend_hash_move_forward(array);
- }
-
- PDF_setpolydash(pdf, darray, len);
-
- efree(darray);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_concat(int pdf, float a, float b, float c, float d, float e, float f)
- Concatenates a matrix to the current transformation matrix for text and graphics */
-PHP_FUNCTION(pdf_concat)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 7 || zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_double_ex(arg6);
- convert_to_double_ex(arg7);
-
- PDF_concat(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- (float) Z_DVAL_PP(arg6),
- (float) Z_DVAL_PP(arg7));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_ccitt(int pdf, string filename, int width, int height, int bitreverse, int k, int blackls1)
- Opens an image file with raw CCITT G3 or G4 compresed bitmap data */
-PHP_FUNCTION(pdf_open_ccitt)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
- PDF *pdf;
- int pdf_image;
- char *image;
-
- if (ZEND_NUM_ARGS() != 7 || zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
-#ifdef VIRTUAL_DIR
- virtual_filepath(Z_STRVAL_PP(arg2), &image TSRMLS_CC);
-#else
- image = Z_STRVAL_PP(arg2);
-#endif
-
- convert_to_long_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_long_ex(arg5);
- convert_to_long_ex(arg6);
- convert_to_long_ex(arg7);
-
- pdf_image = PDF_open_CCITT(pdf,
- image,
- Z_LVAL_PP(arg3),
- Z_LVAL_PP(arg4),
- Z_LVAL_PP(arg5),
- Z_LVAL_PP(arg6),
- Z_LVAL_PP(arg7));
-
- RETURN_LONG(pdf_image+PDFLIB_IMAGE_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_image(int pdf, string type, string source, string data, long length, int width, int height, int components, int bpc, string params)
- Opens an image of the given type and returns an image for placement in a PDF document */
-PHP_FUNCTION(pdf_open_image)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8, **arg9, **arg10;
- PDF *pdf;
- int pdf_image;
- char *image;
-
- if (ZEND_NUM_ARGS() != 10 || zend_get_parameters_ex(10, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
- convert_to_long_ex(arg5);
- convert_to_long_ex(arg6);
- convert_to_long_ex(arg7);
- convert_to_long_ex(arg8);
- convert_to_long_ex(arg9);
- convert_to_string_ex(arg10);
-
-#ifdef VIRTUAL_DIR
- virtual_filepath(Z_STRVAL_PP(arg4), &image TSRMLS_CC);
-#else
- image = Z_STRVAL_PP(arg4);
-#endif
-
- pdf_image = PDF_open_image(pdf,
- Z_STRVAL_PP(arg2),
- Z_STRVAL_PP(arg3),
- image,
- Z_LVAL_PP(arg5),
- Z_LVAL_PP(arg6),
- Z_LVAL_PP(arg7),
- Z_LVAL_PP(arg8),
- Z_LVAL_PP(arg9),
- Z_STRVAL_PP(arg10));
-
- RETURN_LONG(pdf_image+PDFLIB_IMAGE_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_attach_file(int pdf, float lly, float lly, float urx, float ury, string filename, string description, string author, string mimetype, string icon)
- Adds a file attachment annotation at the rectangle specified by his lower left and upper right corners */
-PHP_FUNCTION(pdf_attach_file)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8, **arg9, **arg10;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 10 || zend_get_parameters_ex(10, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_long_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_string_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_string_ex(arg9);
- convert_to_string_ex(arg10);
-
- PDF_attach_file(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- Z_STRVAL_PP(arg6),
- Z_STRVAL_PP(arg7),
- Z_STRVAL_PP(arg8),
- Z_STRVAL_PP(arg9),
- Z_STRVAL_PP(arg10));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_add_note(int pdfdoc, float llx, float lly, float urx, float ury, string contents, string title, string icon, int open)
- Sets annotation */
-PHP_FUNCTION(pdf_add_note)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8, **arg9;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 9 || zend_get_parameters_ex(9, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_string_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_long_ex(arg9);
-
- PDF_add_note(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- Z_STRVAL_PP(arg6),
- Z_STRVAL_PP(arg7),
- Z_STRVAL_PP(arg8),
- Z_LVAL_PP(arg9));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_add_locallink(int pdfdoc, float llx, float lly, float urx, float ury, int page, string dest)
- Adds link to web resource */
-PHP_FUNCTION(pdf_add_locallink)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 7 || zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_long_ex(arg6);
- convert_to_string_ex(arg7);
-
- PDF_add_locallink(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- Z_LVAL_PP(arg6),
- Z_STRVAL_PP(arg7));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_add_launchlink(int pdfdoc, float llx, float lly, float urx, float ury, string filename)
- Adds link to web resource */
-PHP_FUNCTION(pdf_add_launchlink)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_string_ex(arg6);
-
- PDF_add_launchlink(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- Z_STRVAL_PP(arg6));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#if (PDFLIB_MAJORVERSION >= 4)
-
-/* {{{ proto int pdf_open_pdi(int pdf, string filename, string stringparam, int intparam);
- * Open an existing PDF document and prepare it for later use. */
-PHP_FUNCTION(pdf_open_pdi)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
- int pdi_handle;
- char *file;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
-
-#ifdef VIRTUAL_DIR
- virtual_filepath(Z_STRVAL_PP(arg2), &file TSRMLS_CC);
-#else
- file = Z_STRVAL_PP(arg2);
-#endif
-
- pdi_handle = PDF_open_pdi(pdf,
- file,
- Z_STRVAL_PP(arg3),
- Z_LVAL_PP(arg4));
-
- RETURN_LONG(pdi_handle+PDFLIB_PDI_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_close_pdi(int pdf, int doc);
- * Close all open page handles, and close the input PDF document. */
-PHP_FUNCTION(pdf_close_pdi)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
-
- PDF_close_pdi(pdf,
- Z_LVAL_PP(arg2)-PDFLIB_PDI_OFFSET);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_pdi_page(int pdf, int doc, int page, string label);
- * Prepare a page for later use with PDF_place_image(). */
-PHP_FUNCTION(pdf_open_pdi_page)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
- int pdi_image;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
- convert_to_string_ex(arg4);
-
- pdi_image = PDF_open_pdi_page(pdf,
- Z_LVAL_PP(arg2)-PDFLIB_PDI_OFFSET,
- Z_LVAL_PP(arg3),
- Z_STRVAL_PP(arg4));
-
- RETURN_LONG(pdi_image+PDFLIB_IMAGE_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_place_pdi_page(int pdf, int page, float x, float y, float sx, float sy)
- * Place a PDF page with the lower left corner at (x, y), and scale it. */
-PHP_FUNCTION(pdf_place_pdi_page)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_double_ex(arg6);
-
- PDF_place_pdi_page(pdf,
- Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET,
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- (float) Z_DVAL_PP(arg6));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_close_pdi_page(int pdf, int page);
- * Close the page handle, and free all page-related resources. */
-PHP_FUNCTION(pdf_close_pdi_page)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
-
- PDF_close_pdi_page(pdf,
- Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string pdf_get_pdi_parameter(int pdf, string key, int doc, int page, int index);
- * Get the contents of some PDI document parameter with string type. */
-PHP_FUNCTION(pdf_get_pdi_parameter)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
- PDF *pdf;
- const char *buffer;
- int size;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_long_ex(arg5);
-
- buffer = PDF_get_pdi_parameter(pdf,
- Z_STRVAL_PP(arg2),
- Z_LVAL_PP(arg3)-PDFLIB_PDI_OFFSET,
- Z_LVAL_PP(arg4)-PDFLIB_IMAGE_OFFSET,
- Z_LVAL_PP(arg5),
- &size);
-
- RETURN_STRINGL((char *)buffer, size, 1);
-}
-/* }}} */
-
-/* {{{ proto float pdf_get_pdi_value(int pdf, string key, int doc, int page, int index);
- * Get the contents of some PDI document parameter with numerical type. */
-PHP_FUNCTION(pdf_get_pdi_value)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
- PDF *pdf;
- double value;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_long_ex(arg5);
-
- value = (double)PDF_get_pdi_value(pdf,
- Z_STRVAL_PP(arg2),
- Z_LVAL_PP(arg3)-PDFLIB_PDI_OFFSET,
- Z_LVAL_PP(arg4)-PDFLIB_IMAGE_OFFSET,
- Z_LVAL_PP(arg5));
-
- RETURN_DOUBLE(value);
-}
-/* }}} */
-
-/* {{{ proto int pdf_begin_pattern(int pdf, float width, float height, float xstep, float ystep, int painttype);
- * Start a new pattern definition. */
-PHP_FUNCTION(pdf_begin_pattern)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- PDF *pdf;
- int pattern_image;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_long_ex(arg6);
-
- pattern_image = PDF_begin_pattern(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- Z_LVAL_PP(arg6));
-
- RETURN_LONG(pattern_image+PDFLIB_PATTERN_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_end_pattern(int pdf);
- * Finish the pattern definition. */
-PHP_FUNCTION(pdf_end_pattern)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_end_pattern(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pdf_begin_template(int pdf, float width, float height);
- * Start a new template definition. */
-PHP_FUNCTION(pdf_begin_template)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
- int tmpl_image;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
-
- tmpl_image = PDF_begin_template(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3));
-
- RETURN_LONG(tmpl_image+PDFLIB_IMAGE_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_end_template(int pdf);
- * Finish the template definition. */
-PHP_FUNCTION(pdf_end_template)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
-
- PDF_end_template(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setcolor(int pdf, string type, string colorspace, float c1 [, float c2 [, float c3 [, float c4]]]);
- * Set the current color space and color. */
-PHP_FUNCTION(pdf_setcolor)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
- PDF *pdf;
- double c1;
- int argc = ZEND_NUM_ARGS();
-
- if(argc < 4 || argc > 7) {
- WRONG_PARAM_COUNT;
- }
- switch(argc) {
- case 4:
- if(zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 5:
- if(zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 6:
- if(zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 7:
- if(zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_double_ex(arg4);
- if(argc > 4) convert_to_double_ex(arg5);
- if(argc > 5) convert_to_double_ex(arg6);
- if(argc > 6) convert_to_double_ex(arg7);
-
- if (0 == (strcmp(Z_STRVAL_PP(arg3), "spot"))) {
- c1 = Z_DVAL_PP(arg4)-PDFLIB_SPOT_OFFSET;
- } else if(0 == (strcmp(Z_STRVAL_PP(arg3), "pattern"))) {
- c1 = Z_DVAL_PP(arg4)-PDFLIB_PATTERN_OFFSET;
- } else {
- c1 = Z_DVAL_PP(arg4);
- }
-
- PDF_setcolor(pdf,
- Z_STRVAL_PP(arg2),
- Z_STRVAL_PP(arg3),
- (float) c1,
- (float) ((argc>4) ? Z_DVAL_PP(arg5):0),
- (float) ((argc>5) ? Z_DVAL_PP(arg6):0),
- (float) ((argc>6) ? Z_DVAL_PP(arg7):0));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pdf_makespotcolor(int pdf, string spotname);
- * Make a named spot color from the current color. */
-PHP_FUNCTION(pdf_makespotcolor)
-{
- zval **arg1, **arg2;
- PDF *pdf;
- int spotcolor;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
-
- spotcolor = PDF_makespotcolor(pdf,
- Z_STRVAL_PP(arg2),
- Z_STRLEN_PP(arg2));
-
- RETURN_LONG(spotcolor+PDFLIB_SPOT_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_arcn(int pdf, float x, float y, float r, float alpha, float beta);
- * Draw a clockwise circular arc from alpha to beta degrees. */
-PHP_FUNCTION(pdf_arcn)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_double_ex(arg6);
-
- PDF_arcn(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- (float) Z_DVAL_PP(arg6));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_initgraphics(int pdf);
- * Reset all implicit color and graphics state parameters to their defaults. */
-PHP_FUNCTION(pdf_initgraphics)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_initgraphics(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_add_thumbnail(int pdf, int image);
- * Add an existing image as thumbnail for the current page. */
-PHP_FUNCTION(pdf_add_thumbnail)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
-
- PDF_add_thumbnail(pdf,
- Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setmatrix(int pdf, float a, float b, float c, float d, float e, float f)
- Explicitly set the current transformation matrix. */
-PHP_FUNCTION(pdf_setmatrix)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 7 || zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_double_ex(arg6);
- convert_to_double_ex(arg7);
-
- PDF_setmatrix(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- (float) Z_DVAL_PP(arg6),
- (float) Z_DVAL_PP(arg7));
-
- RETURN_TRUE;
-}
-/* }}} */
-#endif /* PDFlib >= V4 */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/pdf/pdf.dsp b/ext/pdf/pdf.dsp
deleted file mode 100644
index 654fe55421..0000000000
--- a/ext/pdf/pdf.dsp
+++ /dev/null
@@ -1,114 +0,0 @@
-# Microsoft Developer Studio Project File - Name="pdf" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=pdf - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "pdf.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "pdf.mak" CFG="pdf - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "pdf - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "pdf - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "pdf - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_PDF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PDF_EXPORTS" /D "COMPILE_DL_PDF" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_PDFLIB=1 /D ZTS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib pdflib.lib zlib.lib libpng.lib libtiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_pdf.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "pdf - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_PDF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PDF_EXPORTS" /D "COMPILE_DL_PDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_PDFLIB=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib pdflib.lib zlib.lib libpng.lib libtiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_pdf.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "pdf - Win32 Release_TS"
-# Name "pdf - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\pdf.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_pdf.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/pdf/php_pdf.h b/ext/pdf/php_pdf.h
deleted file mode 100644
index f5d92995f5..0000000000
--- a/ext/pdf/php_pdf.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_PDF_H
-#define PHP_PDF_H
-
-#if HAVE_PDFLIB
-
-#include <pdflib.h>
-
-extern zend_module_entry pdf_module_entry;
-#define pdf_module_ptr &pdf_module_entry
-
-PHP_MINFO_FUNCTION(pdf);
-PHP_MINIT_FUNCTION(pdf);
-PHP_MSHUTDOWN_FUNCTION(pdf);
-PHP_FUNCTION(pdf_new); /* new function */
-PHP_FUNCTION(pdf_delete); /* new function */
-PHP_FUNCTION(pdf_open_file);
-PHP_FUNCTION(pdf_get_buffer); /* new function */
-PHP_FUNCTION(pdf_close);
-PHP_FUNCTION(pdf_begin_page);
-PHP_FUNCTION(pdf_end_page);
-PHP_FUNCTION(pdf_get_majorversion);
-PHP_FUNCTION(pdf_get_minorversion);
-PHP_FUNCTION(pdf_get_value);
-PHP_FUNCTION(pdf_set_value);
-PHP_FUNCTION(pdf_get_parameter);
-PHP_FUNCTION(pdf_set_parameter);
-PHP_FUNCTION(pdf_findfont); /* new function */
-PHP_FUNCTION(pdf_setfont); /* new function */
-PHP_FUNCTION(pdf_show);
-PHP_FUNCTION(pdf_show_xy);
-PHP_FUNCTION(pdf_continue_text);
-PHP_FUNCTION(pdf_show_boxed);
-PHP_FUNCTION(pdf_stringwidth); /* new parameters: [int font, float size] */
-PHP_FUNCTION(pdf_set_text_pos);
-PHP_FUNCTION(pdf_setdash);
-PHP_FUNCTION(pdf_setpolydash); /* new function: not yet finished */
-PHP_FUNCTION(pdf_setflat);
-PHP_FUNCTION(pdf_setlinejoin);
-PHP_FUNCTION(pdf_setlinecap);
-PHP_FUNCTION(pdf_setmiterlimit);
-PHP_FUNCTION(pdf_setlinewidth);
-PHP_FUNCTION(pdf_save);
-PHP_FUNCTION(pdf_restore);
-PHP_FUNCTION(pdf_translate);
-PHP_FUNCTION(pdf_scale);
-PHP_FUNCTION(pdf_rotate);
-PHP_FUNCTION(pdf_skew);
-PHP_FUNCTION(pdf_concat); /* new function */
-PHP_FUNCTION(pdf_moveto);
-PHP_FUNCTION(pdf_lineto);
-PHP_FUNCTION(pdf_curveto);
-PHP_FUNCTION(pdf_circle);
-PHP_FUNCTION(pdf_arc);
-PHP_FUNCTION(pdf_rect);
-PHP_FUNCTION(pdf_closepath);
-PHP_FUNCTION(pdf_stroke);
-PHP_FUNCTION(pdf_closepath_stroke);
-PHP_FUNCTION(pdf_fill);
-PHP_FUNCTION(pdf_fill_stroke);
-PHP_FUNCTION(pdf_closepath_fill_stroke);
-PHP_FUNCTION(pdf_clip);
-PHP_FUNCTION(pdf_endpath);
-PHP_FUNCTION(pdf_setgray_fill);
-PHP_FUNCTION(pdf_setgray_stroke);
-PHP_FUNCTION(pdf_setgray);
-PHP_FUNCTION(pdf_setrgbcolor_fill);
-PHP_FUNCTION(pdf_setrgbcolor_stroke);
-PHP_FUNCTION(pdf_setrgbcolor);
-PHP_FUNCTION(pdf_open_image_file); /* new parameters: [char *stringpram, int intparam] */
-PHP_FUNCTION(pdf_open_ccitt); /* new function */
-PHP_FUNCTION(pdf_open_image); /* new function: checkit not yet completeted :( */
-PHP_FUNCTION(pdf_close_image);
-PHP_FUNCTION(pdf_place_image);
-PHP_FUNCTION(pdf_add_bookmark);
-PHP_FUNCTION(pdf_set_info);
-PHP_FUNCTION(pdf_attach_file); /* new function */
-PHP_FUNCTION(pdf_add_note); /* new function */
-PHP_FUNCTION(pdf_add_pdflink);
-PHP_FUNCTION(pdf_add_locallink); /* new function */
-PHP_FUNCTION(pdf_add_launchlink); /* new function */
-PHP_FUNCTION(pdf_add_weblink);
-PHP_FUNCTION(pdf_set_border_style);
-PHP_FUNCTION(pdf_set_border_color);
-PHP_FUNCTION(pdf_set_border_dash);
-
-/* RJS:
- End of the official PDFLIB V3.x API */
-
-/* old font handling */
-PHP_FUNCTION(pdf_set_font); /* deprecated */
-PHP_FUNCTION(pdf_get_font); /* deprecated */
-PHP_FUNCTION(pdf_get_fontname); /* deprecated */
-PHP_FUNCTION(pdf_get_fontsize); /* deprecated */
-
-/* old way of starting a PDF document */
-PHP_FUNCTION(pdf_open); /* deprecated */
-
-/* old stuff for setting infos */
-PHP_FUNCTION(pdf_set_info_creator); /* deprecated */
-PHP_FUNCTION(pdf_set_info_title); /* deprecated */
-PHP_FUNCTION(pdf_set_info_subject); /* deprecated */
-PHP_FUNCTION(pdf_set_info_author); /* deprecated */
-PHP_FUNCTION(pdf_set_info_keywords); /* deprecated */
-PHP_FUNCTION(pdf_set_leading); /* deprecated */
-PHP_FUNCTION(pdf_set_text_rendering); /* deprecated */
-PHP_FUNCTION(pdf_set_horiz_scaling); /* deprecated */
-PHP_FUNCTION(pdf_set_text_rise); /* deprecated */
-PHP_FUNCTION(pdf_set_char_spacing); /* deprecated */
-PHP_FUNCTION(pdf_set_word_spacing); /* deprecated */
-PHP_FUNCTION(pdf_set_transition); /* deprecated */
-PHP_FUNCTION(pdf_set_duration); /* deprecated */
-PHP_FUNCTION(pdf_get_image_height); /* deprecated */
-PHP_FUNCTION(pdf_get_image_width); /* deprecated */
-
-/* old stuff for opening images */
-PHP_FUNCTION(pdf_open_jpeg); /* deprecated */
-PHP_FUNCTION(pdf_open_tiff); /* deprecated */
-PHP_FUNCTION(pdf_open_png); /* deprecated */
-PHP_FUNCTION(pdf_open_gif); /* deprecated */
-
-/* some more stuff for compatibility */
-PHP_FUNCTION(pdf_add_annotation);
-#if HAVE_LIBGD13
-PHP_FUNCTION(pdf_open_memory_image);
-#endif
-
-#if (PDFLIB_MAJORVERSION >= 4)
-/* support for new functions in PDFlib V4.0 */
-PHP_FUNCTION(pdf_open_pdi);
-PHP_FUNCTION(pdf_close_pdi);
-PHP_FUNCTION(pdf_open_pdi_page);
-PHP_FUNCTION(pdf_place_pdi_page);
-PHP_FUNCTION(pdf_close_pdi_page);
-PHP_FUNCTION(pdf_get_pdi_parameter);
-PHP_FUNCTION(pdf_get_pdi_value);
-PHP_FUNCTION(pdf_begin_pattern);
-PHP_FUNCTION(pdf_end_pattern);
-PHP_FUNCTION(pdf_setcolor);
-PHP_FUNCTION(pdf_makespotcolor);
-PHP_FUNCTION(pdf_begin_template);
-PHP_FUNCTION(pdf_end_template);
-PHP_FUNCTION(pdf_arcn);
-PHP_FUNCTION(pdf_add_thumbnail);
-PHP_FUNCTION(pdf_initgraphics);
-PHP_FUNCTION(pdf_setmatrix);
-#endif /* PDFlib >= V4 */
-
-#ifdef ZTS
-#define PDFG(v) TSRMG(pdf_globals_id, php_pdf_globals *, v)
-#else
-#define PDFG(v) (pdf_globals.v)
-#endif
-
-
-#else
-#define pdf_module_ptr NULL
-#endif
-#define phpext_pdf_ptr pdf_module_ptr
-#endif /* PHP_PDF_H */
diff --git a/ext/pfpro/CREDITS b/ext/pfpro/CREDITS
deleted file mode 100644
index 1b57a7f25b..0000000000
--- a/ext/pfpro/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Verisign Payflow Pro
-John Donagher, David Croft
diff --git a/ext/pfpro/TODO b/ext/pfpro/TODO
deleted file mode 100644
index a10a191e80..0000000000
--- a/ext/pfpro/TODO
+++ /dev/null
@@ -1,12 +0,0 @@
-John Donagher <jdonagher@php.net> - 20010501
-############################################
-- XMLPay support??
-- Add test cases
-
-pfpro_process[_raw]:
-- Expose API-level context control optionally to user
-- Figure out what Verisign's pfproCompleteTransaction() purpose is and why it
- corrupts the response data
-
-pfpro_process:
-- Fix response parsing to ignore delimiters [&=] in response data values
diff --git a/ext/pfpro/config.m4 b/ext/pfpro/config.m4
deleted file mode 100644
index 63fc634c42..0000000000
--- a/ext/pfpro/config.m4
+++ /dev/null
@@ -1,68 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(pfpro, for Verisign Payflow Pro support,
-[ --with-pfpro[=DIR] Include Verisign Payflow Pro support.])
-
-if test "$PHP_PFPRO" != "no"; then
- PFPRO_LIB=libpfpro.so
- PFPRO_HDR=pfpro.h
-
- for i in /usr/local /usr $PHP_PFPRO; do
- if test -r $i/$PFPRO_HDR; then
- PFPRO_INC_DIR=$i
- elif test -r $i/include/$PFPRO_HDR; then
- PFPRO_INC_DIR=$i/include
- elif test -r $i/lib/$PFPRO_HDR; then
- PFPRO_INC_DIR=$i/lib
- elif test -r $i/bin/$PFPRO_HDR; then
- PFPRO_INC_DIR=$i/bin
- fi
-
- if test -r $i/$PFPRO_LIB; then
- PFPRO_LIB_DIR=$i
- elif test -r $i/lib/$PFPRO_LIB; then
- PFPRO_LIB_DIR=$i/lib
- fi
- done
-
- if test -z "$PFPRO_INC_DIR"; then
- AC_MSG_ERROR([Could not find pfpro.h. Please make sure you have the
- Verisign Payflow Pro SDK installed. Use
- ./configure --with-pfpro=<pfpro-dir> if necessary])
- fi
-
- if test -z "$PFPRO_LIB_DIR"; then
- AC_MSG_ERROR([Could not find libpfpro.so. Please make sure you have the
- Verisign Payflow Pro SDK installed. Use
- ./configure --with-pfpro=<pfpro-dir> if necessary])
- fi
-
- dnl
- dnl Check version of SDK
- dnl
- PHP_CHECK_LIBRARY(pfpro, pfproInit,
- [
- PFPRO_VERSION=3
- ], [
- PHP_CHECK_LIBRARY(pfpro, PNInit,
- [
- PFPRO_VERSION=2
- ], [
- AC_MSG_ERROR([The pfpro extension requires version 2 or 3 of the SDK])
- ], [
- -L$PFPRO_LIB_DIR
- ])
- ], [
- -L$PFPRO_LIB_DIR
- ])
-
- AC_DEFINE_UNQUOTED(PFPRO_VERSION, $PFPRO_VERSION, [Version of SDK])
- PHP_ADD_INCLUDE($PFPRO_INC_DIR)
- PHP_ADD_LIBRARY_WITH_PATH(pfpro, $PFPRO_LIB_DIR, PFPRO_SHARED_LIBADD)
-
- PHP_NEW_EXTENSION(pfpro, pfpro.c, $ext_shared)
- PHP_SUBST(PFPRO_SHARED_LIBADD)
- AC_DEFINE(HAVE_PFPRO, 1, [ ])
-fi
diff --git a/ext/pfpro/pfpro.c b/ext/pfpro/pfpro.c
deleted file mode 100644
index 5fe0333e88..0000000000
--- a/ext/pfpro/pfpro.c
+++ /dev/null
@@ -1,549 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: David Croft <david@infotrek.co.uk>, |
- | John Donagher <john@webmeta.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_pfpro.h"
-
-#if HAVE_PFPRO
-
-/* {{{ includes */
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-#include <pfpro.h>
-/* }}} */
-
-/* {{{ zts */
-ZEND_DECLARE_MODULE_GLOBALS(pfpro)
-/* }}} */
-
-/* {{{ Function table */
-function_entry pfpro_functions[] = {
- PHP_FE(pfpro_version, NULL)
- PHP_FE(pfpro_init, NULL)
- PHP_FE(pfpro_cleanup, NULL)
- PHP_FE(pfpro_process_raw, NULL)
- PHP_FE(pfpro_process, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ Zend module entry */
-zend_module_entry pfpro_module_entry = {
- STANDARD_MODULE_HEADER,
- "pfpro",
- pfpro_functions,
- PHP_MINIT(pfpro),
- PHP_MSHUTDOWN(pfpro),
- PHP_RINIT(pfpro), /* request start */
- PHP_RSHUTDOWN(pfpro), /* request end */
- PHP_MINFO(pfpro),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-/* {{{ dl() stuff */
-#ifdef COMPILE_DL_PFPRO
-ZEND_GET_MODULE(pfpro)
-#endif
-/* }}} */
-
-/* {{{ initialization defaults */
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("pfpro.defaulthost", "test-payflow.verisign.com", PHP_INI_ALL, OnUpdateString, defaulthost, zend_pfpro_globals, pfpro_globals)
- STD_PHP_INI_ENTRY("pfpro.defaultport", "443", PHP_INI_ALL, OnUpdateLong, defaultport, zend_pfpro_globals, pfpro_globals)
- STD_PHP_INI_ENTRY("pfpro.defaulttimeout", "30", PHP_INI_ALL, OnUpdateLong, defaulttimeout, zend_pfpro_globals, pfpro_globals)
- STD_PHP_INI_ENTRY("pfpro.proxyaddress", "", PHP_INI_ALL, OnUpdateString, proxyaddress, zend_pfpro_globals, pfpro_globals)
- STD_PHP_INI_ENTRY("pfpro.proxyport", "", PHP_INI_ALL, OnUpdateLong, proxyport, zend_pfpro_globals, pfpro_globals)
- STD_PHP_INI_ENTRY("pfpro.proxylogon", "", PHP_INI_ALL, OnUpdateString, proxylogon, zend_pfpro_globals, pfpro_globals)
- STD_PHP_INI_ENTRY("pfpro.proxypassword", "", PHP_INI_ALL, OnUpdateString, proxypassword, zend_pfpro_globals, pfpro_globals)
-PHP_INI_END()
-
-/* {{{ php_extname_init_globals
- */
-static void php_pfpro_init_globals(zend_pfpro_globals *pfpro_globals)
-{
- pfpro_globals->initialized = 0;
- pfpro_globals->defaulthost = NULL;
- pfpro_globals->defaultport = 0;
- pfpro_globals->defaulttimeout = 0;
- pfpro_globals->proxyaddress = NULL;
- pfpro_globals->proxyport = 0;
- pfpro_globals->proxylogon = NULL;
- pfpro_globals->proxypassword = NULL;
-}
-/* }}} */
-
-PHP_MINIT_FUNCTION(pfpro)
-{
- ZEND_INIT_MODULE_GLOBALS(pfpro, php_pfpro_init_globals, NULL);
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(pfpro)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(pfpro)
-{
- PFPROG(initialized) = 0;
-
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(pfpro)
-{
- if (PFPROG(initialized) == 1) {
- pfproCleanup();
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ minfo registration */
-PHP_MINFO_FUNCTION(pfpro)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Verisign Payflow Pro support", "enabled");
- php_info_print_table_row(2, "libpfpro version", pfproVersion());
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-/* }}} */
-
-/* {{{ proto string pfpro_version()
- Returns the version of the Payflow Pro library */
-PHP_FUNCTION(pfpro_version)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_STRING((char *)pfproVersion(), 1);
-}
-/* }}} */
-
-/* {{{ proto void pfpro_init()
- Initializes the Payflow Pro library */
-PHP_FUNCTION(pfpro_init)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- pfproInit();
-
- PFPROG(initialized) = 1;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pfpro_cleanup()
- Shuts down the Payflow Pro library */
-PHP_FUNCTION(pfpro_cleanup)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- pfproCleanup();
-
- PFPROG(initialized) = 0;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string pfpro_process_raw(string parmlist [, string hostaddress [, int port, [, int timeout [, string proxyAddress [, int proxyPort [, string proxyLogon [, string proxyPassword]]]]]]])
- Raw Payflow Pro transaction processing */
-PHP_FUNCTION(pfpro_process_raw)
-{
- zval ***args;
- char *parmlist = NULL;
- char *address = NULL;
- int port = PFPROG(defaultport);
- int timeout = PFPROG(defaulttimeout);
- char *proxyAddress = PFPROG(proxyaddress);
- int proxyPort = PFPROG(proxyport);
- char *proxyLogon = PFPROG(proxylogon);
- char *proxyPassword = PFPROG(proxypassword);
- int freeaddress = 0;
-#if PFPRO_VERSION < 3
- char response[512] = "";
-#else
- int context;
- char *response;
-#endif
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 8) {
- WRONG_PARAM_COUNT;
- }
-
- args = (zval ***) emalloc(sizeof(zval **) * ZEND_NUM_ARGS());
-
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to read parameters in pfpro_process_raw()");
- efree(args);
- RETURN_FALSE;
- }
-
- switch (ZEND_NUM_ARGS()) {
- case 8:
- convert_to_string_ex(args[7]);
- proxyPassword = Z_STRVAL_PP(args[7]);
- /* fall through */
-
- case 7:
- convert_to_string_ex(args[6]);
- proxyLogon = Z_STRVAL_PP(args[6]);
- /* fall through */
-
- case 6:
- convert_to_long_ex(args[5]);
- proxyPort = Z_LVAL_PP(args[5]);
- /* fall through */
-
- case 5:
- convert_to_string_ex(args[4]);
- proxyAddress = Z_STRVAL_PP(args[4]);
- /* fall through */
-
- case 4:
- convert_to_long_ex(args[3]);
- timeout = Z_LVAL_PP(args[3]);
- /* fall through */
-
- case 3:
- convert_to_long_ex(args[2]);
- port = Z_LVAL_PP(args[2]);
- /* fall through */
-
- case 2:
- convert_to_string_ex(args[1]);
- address = Z_STRVAL_PP(args[1]);
- }
-
- convert_to_string_ex(args[0]);
- parmlist = Z_STRVAL_PP(args[0]);
-
- efree(args);
-
- if (address == NULL) {
- address = estrdup(PFPROG(defaulthost));
- freeaddress = 1;
- }
-
-#if PFPRO_VERSION < 3
- /* Blank the response buffer */
- memset(response, 0, sizeof(response));
-#endif
-
- /* Initialize the library if needed */
-
- if (PFPROG(initialized) == 0) {
- pfproInit();
- PFPROG(initialized) = 1;
- }
-
- /* Perform the transaction */
-
-#if PFPRO_VERSION < 3
- ProcessPNTransaction(address, port, proxyAddress, proxyPort, proxyLogon, proxyPassword, parmlist, strlen(parmlist), timeout, response);
-#else
- pfproCreateContext(&context, address, port, timeout, proxyAddress, proxyPort, proxyLogon, proxyPassword);
- pfproSubmitTransaction(context, parmlist, strlen(parmlist), &response);
- pfproDestroyContext(context);
-#endif
-
- if (freeaddress) {
- efree(address);
- }
-
- RETURN_STRING(response, 1);
-}
-/* }}} */
-
-/* {{{ proto array pfpro_process(array parmlist [, string hostaddress [, int port, [, int timeout [, string proxyAddress [, int proxyPort [, string proxyLogon [, string proxyPassword]]]]]]])
- Payflow Pro transaction processing using arrays */
-PHP_FUNCTION(pfpro_process)
-{
- zval ***args;
- HashTable *target_hash;
- ulong num_key;
- char *string_key;
- zval **entry;
- int pass;
- char *parmlist = NULL;
- char *address = NULL;
- int port = PFPROG(defaultport);
- int timeout = PFPROG(defaulttimeout);
- char *proxyAddress = PFPROG(proxyaddress);
- int proxyPort = PFPROG(proxyport);
- char *proxyLogon = PFPROG(proxylogon);
- char *proxyPassword = PFPROG(proxypassword);
- int parmlength = 0;
- int freeaddress = 0;
-#if PFPRO_VERSION < 3
- char response[512] = "";
-#else
- int context;
- char *response;
-#endif
- char tmpbuf[128];
- char *var,*val,*strtok_buf=NULL; /* Pointers for string manipulation */
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 8) {
- WRONG_PARAM_COUNT;
- }
-
- args = (zval ***) emalloc(sizeof(zval **) * ZEND_NUM_ARGS());
-
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to read parameters in pfpro_process()");
- efree(args);
- RETURN_FALSE;
- }
-
- if (Z_TYPE_PP(args[0]) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "First parameter to pfpro_process() must be an array");
- efree(args);
- RETURN_FALSE;
- }
-
- switch (ZEND_NUM_ARGS()) {
- case 8:
- convert_to_string_ex(args[7]);
- proxyPassword = Z_STRVAL_PP(args[7]);
- /* fall through */
-
- case 7:
- convert_to_string_ex(args[6]);
- proxyLogon = Z_STRVAL_PP(args[6]);
- /* fall through */
-
- case 6:
- convert_to_long_ex(args[5]);
- proxyPort = Z_LVAL_PP(args[5]);
- /* fall through */
-
- case 5:
- convert_to_string_ex(args[4]);
- proxyAddress = Z_STRVAL_PP(args[4]);
- /* fall through */
-
- case 4:
- convert_to_long_ex(args[3]);
- timeout = Z_LVAL_PP(args[3]);
- /* fall through */
-
- case 3:
- convert_to_long_ex(args[2]);
- port = Z_LVAL_PP(args[2]);
- /* fall through */
-
- case 2:
- convert_to_string_ex(args[1]);
- address = Z_STRVAL_PP(args[1]);
- }
-
- /* Concatenate the passed array as specified by Verisign.
- Basically it's all key=value&key=value, the only exception
- being if the value contains = or &, in which case we also
- encode the length, e.g. key[5]=bl&ah */
-
- target_hash = HASH_OF(*args[0]);
-
- for (pass = 0; pass <= 1; pass ++) {
-
- parmlength = 0;
- /* we go around the array twice. the first time to calculate
- the string length, the second time to actually store it */
-
- zend_hash_internal_pointer_reset(target_hash);
-
- while (zend_hash_get_current_data(target_hash, (void **)&entry) == SUCCESS) {
-
- if (parmlength > 0) {
- if (pass == 1)
- strcpy(parmlist + parmlength, "&");
- parmlength += 1;
- }
-
- switch (zend_hash_get_current_key(target_hash, &string_key, &num_key, 0)) {
-
- case HASH_KEY_IS_STRING:
-
- if (pass == 1)
- strcpy(parmlist + parmlength, string_key);
- parmlength += strlen(string_key);
-
- break;
-
- case HASH_KEY_IS_LONG:
-
- sprintf(tmpbuf, "%ld", num_key);
- if (pass == 1)
- strcpy(parmlist + parmlength, tmpbuf);
- parmlength += strlen(tmpbuf);
-
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "pfpro_process() array keys must be strings or integers");
- if (parmlist) {
- efree(parmlist);
- }
- efree(args);
- RETURN_FALSE;
- }
-
-
- switch (Z_TYPE_PP(entry)) {
- case IS_STRING:
- if (strchr(Z_STRVAL_PP(entry), '&')
- || strchr(Z_STRVAL_PP(entry), '=')) {
- sprintf(tmpbuf, "[%d]=", Z_STRLEN_PP(entry));
- if (pass == 1)
- strcpy(parmlist + parmlength, tmpbuf);
- parmlength += strlen(tmpbuf);
- } else {
- if (pass == 1)
- strcpy(parmlist + parmlength, "=");
- parmlength += 1;
- }
-
- if (pass == 1)
- strcpy(parmlist + parmlength, Z_STRVAL_PP(entry));
- parmlength += Z_STRLEN_PP(entry);
-
- break;
-
- case IS_LONG:
- sprintf(tmpbuf, "=%ld", Z_LVAL_PP(entry));
- if (pass == 1)
- strcpy(parmlist + parmlength, tmpbuf);
- parmlength += strlen(tmpbuf);
-
- break;
-
- case IS_DOUBLE:
- sprintf(tmpbuf, "=%.2f", Z_DVAL_PP(entry));
- if (pass == 1)
- strcpy(parmlist + parmlength, tmpbuf);
- parmlength += strlen(tmpbuf);
-
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "pfpro_process() array values must be strings, ints or floats");
- if (parmlist) {
- efree(parmlist);
- }
- efree(args);
- RETURN_FALSE;
- }
- zend_hash_move_forward(target_hash);
- }
-
- if (pass == 0) {
- parmlist = emalloc(parmlength + 1);
- }
- }
-
- efree(args);
-
- if (address == NULL) {
- address = estrdup(PFPROG(defaulthost));
- freeaddress = 1;
- }
-
- /* Allocate the array for the response now - so we catch any errors
- from this BEFORE we knock it off to the bank */
-
- array_init(return_value);
-
-#if PFPRO_VERSION < 3
- /* Blank the response buffer */
- memset(response, 0, sizeof(response));
-#endif
-
- /* Initialize the library if needed */
-
- if (PFPROG(initialized) == 0) {
- pfproInit();
- PFPROG(initialized) = 1;
- }
-
- /* Perform the transaction */
-
-#if PFPRO_VERSION < 3
- ProcessPNTransaction(address, port, proxyAddress, proxyPort, proxyLogon, proxyPassword, parmlist, strlen(parmlist), timeout, response);
-#else
- pfproCreateContext(&context, address, port, timeout, proxyAddress, proxyPort, proxyLogon, proxyPassword);
- pfproSubmitTransaction(context, parmlist, strlen(parmlist), &response);
- pfproDestroyContext(context);
-#endif
-
- if (freeaddress) {
- efree(address);
- }
-
- if (parmlist) {
- efree(parmlist);
- }
-
- /* This final chunk of code is to walk the returned string
- * and build the return array to the user.
- */
- var = php_strtok_r(response, "&", &strtok_buf);
-
- while (var) {
- val = strchr(var, '=');
- if (val) { /* have a value */
- *val++ = '\0';
- add_assoc_string(return_value, var, val, 1);
- }
- var = php_strtok_r(NULL, "&", &strtok_buf);
- }
-}
-/* }}} */
-
-#endif /* HAVE_PFPRO */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/pfpro/php_pfpro.h b/ext/pfpro/php_pfpro.h
deleted file mode 100644
index 1216b9aa3e..0000000000
--- a/ext/pfpro/php_pfpro.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: David Croft <david@infotrek.co.uk> |
- | John Donagher <john@webmeta.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_PFPRO_H
-#define PHP_PFPRO_H
-
-#if HAVE_PFPRO
-
-extern zend_module_entry pfpro_module_entry;
-#define phpext_pfpro_ptr &pfpro_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_PFPRO_API __declspec(dllexport)
-#else
-#define PHP_PFPRO_API
-#endif
-
-#if PFPRO_VERSION < 3
-#define pfproVersion() PNVersion()
-#define pfproInit() PNInit()
-#define pfproCleanup() PNCleanup()
-#endif
-
-PHP_MINIT_FUNCTION(pfpro);
-PHP_MSHUTDOWN_FUNCTION(pfpro);
-PHP_RINIT_FUNCTION(pfpro);
-PHP_RSHUTDOWN_FUNCTION(pfpro);
-PHP_MINFO_FUNCTION(pfpro);
-
-PHP_FUNCTION(pfpro_version); /* Return library version */
-PHP_FUNCTION(pfpro_init); /* Initialise pfpro gateway */
-PHP_FUNCTION(pfpro_cleanup); /* Shut down cleanly */
-PHP_FUNCTION(pfpro_process_raw); /* Raw transaction processing */
-PHP_FUNCTION(pfpro_process); /* Transaction processing */
-
-ZEND_BEGIN_MODULE_GLOBALS(pfpro)
- int initialized;
- char *defaulthost;
- long defaultport;
- long defaulttimeout;
- char *proxyaddress;
- long proxyport;
- char *proxylogon;
- char *proxypassword;
-ZEND_END_MODULE_GLOBALS(pfpro)
-
-#ifdef ZTS
-#define PFPROG(v) TSRMG(pfpro_globals_id, zend_pfpro_globals *, v)
-#else
-#define PFPROG(v) (pfpro_globals.v)
-#endif
-
-#else
-
-#define phpext_pfpro_ptr NULL
-
-#endif
-
-#endif /* PHP_PFPRO_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/pgsql/CREDITS b/ext/pgsql/CREDITS
deleted file mode 100644
index 846d37c2f5..0000000000
--- a/ext/pgsql/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-PostgreSQL
-Jouni Ahto, Zeev Suraski, Yasuo Ohgaki
diff --git a/ext/pgsql/README b/ext/pgsql/README
deleted file mode 100644
index 2b4c412338..0000000000
--- a/ext/pgsql/README
+++ /dev/null
@@ -1,235 +0,0 @@
-==== About This Module ===
-PostgreSQL module provides access to PostgreSQL server from
-PHP script. This module uses PostgreSQL C client lib called libpq.
-It is important that you use libpq that is later than backend
-(PostgreSQL Server) version. Otherwise, you may experience
-strange problems.
-
-Please send e-mail to yohgaki@php.net if you have comments for
-pgsql module. I appreciate your feedback.
-
-==== API Change ===
-Older PHP than 4.2.0, pg_loimport()/pg_loexport() connection
-parameter as last parameter, not like other functions. From 4.2.0,
-connection parameter became 1st parameter. Old syntax is preserved,
-but it will raise NOTICE error message.
-
-pg_connect()/pg_pconnect() has obsolete multi parameter syntax.
-This syntax will be deleted in 4.3.0 or later.
-
-Omitting connectin parameter is NOT recommended. Connection
-parameter may be required for future PHP version. Specify connection
-always if you don't want to rewrite code when it is changed.
-
-==== Function Name Change ====
-Function names are going to be changed to confirm coding
-standard. MySQL module has been done this already. Function names will
-be changed as follows.
-
-pg_errormessage -> pg_error_message
-pg_cmdtuples -> pg_affected_rows
-pg_fieldnum -> pg_field_num
-and so on. Except pg_cmdtuples, under scores '_' will be added to
-names.
-
-Older names will become aliases of new functions for backward
-compatibility.
-
-Manual will be updated when this change is commited to CVS source.
-
-==== Configure Option Notes ====
-You cannot specify PostgreSQL source directly to build PostgreSQL
-module with specific version. You need to install PostgreSQL
-somewhere in your system to build PHP with PostgreSQL support.
-
-==== Note For PostgreSQL 7.2 ====
-I've tested upto 7.2.2.
-
-==== TODO List ===
-Make pg_convert() smater.
- - Better regex
- - User defiend type support
-Support async connection.
-
-==== Experimental Functions =====
-
-WARNING: API/behavior may be changed without notice.
-
-Async query can improve application performance
-*significantly*. Please test and report any failure to
-yohgaki@php.net
-
-There are some cases that async functions blocks process. Even if
-process was blocked, functions work as expected. (except it blocks
-process) These are cases that process is blocked. Refer to libpq
-manual for details. Followings are common cases that async functions
-are blocked.
-
- - If libpq is compile with USE_SSL, some async functions are
- blocked.
- - If libpq under Win32 is *NOT* compiled with
- WIN32_NON_BLOCKING_CONNECTIONS, non-blocking connection will block.
-
-Async function may also block if you have not retrive result and
-send or execute query. If there is result left on connection,
-pg_send_query() will block until last query is completed.
-
-Garbages are cleaned when resource is cleaned up. There is no need to
-clean up query result if it is not needed.
-
-Please refer to libpq manual or source for details.
-These functions are *NOT* supposed to be documented, yet.
-API may be changed.
-
-NOTE: These functions are added in PHP 4.2.0 unless they are mentioned.
-
--------------------------------------------------------------------
-bool pg_send_query(resource connection, string query)
-
-Sends async query to backend. Result may be retrieved with
-pg_get_result(). It does not accept multiple query, but it accepts
-multiple queries at once. Each result may be retrieved separately by
-pg_get_result().
-
---------------------------------------------------------------------
-bool pg_cancel_query(resource connection)
-
-Cancels currently executing async query already sent to PostgreSQL
-server. This function is useful when user request time consuming query
-to server. It cannot cancel query executed by pg_exec(), since
-pg_exec() is a blocking function.
-
---------------------------------------------------------------------
-resource pg_get_result(resource conn)
-
-Gets pgsql query result resource. Returned value can be fed to
-pg_result()/pg_fetch_*(). pg_get_result() may block if result is not
-ready to be retrived. Use pg_is_busy() to check result is ready to be
-retrieved or not. If multiple query is sent to backend, it may be
-retrieved one by one using pg_get_result(). If there is no result left
-in connection, it returns false.
-
---------------------------------------------------------------------
-bool pg_connection_busy(resource connection)
-
-Returns connections is executing query or not.
-
---------------------------------------------------------------------
-int pg_connection_status(resource connection)
-
-Gets connection status. It returns PGSQL_CONNECTION_OK or
-PGSQL_CONNECTION_BAD.
-
---------------------------------------------------------------------
-bool pg_connection_reset(resource connection)
-
-Resets communication port to Postgresql server using the same
-connection parameter. It's useful for error recovery.
-
---------------------------------------------------------------------
-string pg_result_error(resource result)
-
-Get error message associated with result
-
---------------------------------------------------------------------
-int pg_result_status(resource result)
-
-Get status of query result
-
---------------------------------------------------------------------
-
-
-Copy functions
-
---------------------------------------------------------------------
-mixed pg_copy_to(int connection_id, string table_name,
- [, string delim [, string null_as]])
-
-nt pg_copy_from(int connection_id, string table_name, array rows
- [, string delim [, string null_as]])
-
---------------------------------------------------------------------
-
-Utility functions
-
---------------------------------------------------------------------
-string pg_escape_string(string data)
-Escape string or binary for SQL statemen (7.2 or later)
-
-
-string pg_escape_bytea(string data)
-Escape string or binary for SQL statement (7.2 or later)
-
---------------------------------------------------------------------
-
-Large Object Functions
-
---------------------------------------------------------------------
-int pg_lo_tell(resource large_object)
-Returns current position of large object
-
---------------------------------------------------------------------
-bool pg_lo_lseek(resource large_object, int offset[, int whence])
-Seeks position of large object
-
---------------------------------------------------------------------
-
-Notice message function
-
---------------------------------------------------------------------
-
-string pg_last_notice(resource connection)
-Returns the last notice set by the backend
-
-This function is fully implemed in only in current CVS version.
-PHP 4.3.0 supposed to included fully implemented version.
-
-NOTE: Added in PHP 4.0.6, but there is bug in notice message handling
-in PHP 4.0.6. Do no use 4.0.6 with pgsql module!!
-
---------------------------------------------------------------------
-
-Utility functions (for PHP 4.3.0)
-
---------------------------------------------------------------------
-array pg_metadata(resource db, string table)
- Get metadata
-
---------------------------------------------------------------------
-array pg_convert(resource db, string table, array values)
- Check and convert values for PostgreSQL SQL statement
-
---------------------------------------------------------------------
-bool pg_insert(resource db, string table, array values[, bool convert[, bool async]])
- Insert values (filed=>value) to table
-
---------------------------------------------------------------------
-bool pg_update(resource db, string table, array fields, array ids[, bool convert[, bool async]])
- Update table using values (field=>value) and ids (id=>value)
-
---------------------------------------------------------------------
-bool pg_delete(resource db, string table, array ids[, bool convert[, bool async]])
- Delete records has ids (id=>value)
-
---------------------------------------------------------------------
-array pg_select(resource db, string table, array ids[, bool convert])
- Select records that has ids (id=>value)
-
---------------------------------------------------------------------
-array pg_get_notify([resource db[, notify]])
- Get notify message on the connection
-
---------------------------------------------------------------------
-string pg_unescape_bytea(string bytea_data)
- Unescape bytea field data
-
---------------------------------------------------------------------
-bool pg_ping(resource db)
- ping database connection and try to reset connection if it's
- broken
-
--------------------------------------------------------------------
-
-Again, experimental functions are subject to be changed without
-notice.
-
diff --git a/ext/pgsql/config.m4 b/ext/pgsql/config.m4
deleted file mode 100644
index efccb17e94..0000000000
--- a/ext/pgsql/config.m4
+++ /dev/null
@@ -1,72 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_DEFUN(PHP_PGSQL_CHECK_FUNCTIONS,[
-])
-
-PHP_ARG_WITH(pgsql,for PostgreSQL support,
-[ --with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQL
- base install directory, defaults to /usr/local/pgsql.])
-
-if test "$PHP_PGSQL" != "no"; then
- PHP_EXPAND_PATH($PGSQL_INCLUDE, PGSQL_INCLUDE)
-
- if test "$PHP_PGSQL" = "yes"; then
- PGSQL_SEARCH_PATHS="/usr /usr/local /usr/local/pgsql"
- else
- PGSQL_SEARCH_PATHS=$PHP_PGSQL
- fi
-
- for i in $PGSQL_SEARCH_PATHS; do
- for j in include include/pgsql include/postgres include/postgresql ""; do
- if test -r "$i/$j/libpq-fe.h"; then
- PGSQL_INC_BASE=$i
- PGSQL_INCLUDE=$i/$j
- if test -r "$i/$j/pg_config.h"; then
- AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h])
- fi
- fi
- done
-
- for j in lib lib/pgsql lib/postgres lib/postgresql ""; do
- if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a"; then
- PGSQL_LIBDIR=$i/$j
- fi
- done
- done
-
- if test -z "$PGSQL_INCLUDE"; then
- AC_MSG_ERROR(Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path)
- fi
-
- if test -z "$PGSQL_LIBDIR"; then
- AC_MSG_ERROR(Cannot find libpq.so. Please specify correct PostgreSQL installation path)
- fi
-
- if test -z "$PGSQL_INCLUDE" -a -z "$PGSQL_LIBDIR" ; then
- AC_MSG_ERROR([Unable to find libpq anywhere under $withval])
- fi
-
- AC_DEFINE(HAVE_PGSQL,1,[Whether to build PostgreSQL support or not])
- old_LIBS=$LIBS
- old_LDFLAGS=$LDFLAGS
- LDFLAGS="$LDFLAGS -L$PGSQL_LIBDIR"
- AC_CHECK_LIB(pq, PQescapeString,AC_DEFINE(HAVE_PQESCAPE,1,[PostgreSQL 7.2.0 or later]))
- AC_CHECK_LIB(pq, PQsetnonblocking,AC_DEFINE(HAVE_PQSETNONBLOCKING,1,[PostgreSQL 7.0.x or later]))
- AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[Broken libpq under windows]))
- AC_CHECK_LIB(pq, PQoidValue,AC_DEFINE(HAVE_PQOIDVALUE,1,[Older PostgreSQL]))
- AC_CHECK_LIB(pq, PQclientEncoding,AC_DEFINE(HAVE_PQCLIENTENCODING,1,[PostgreSQL 7.0.x or later]))
- AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibye]))
- LIBS=$old_LIBS
- LDFLAGS=$old_LDFLAGS
-
- PHP_ADD_LIBRARY_WITH_PATH(pq, $PGSQL_LIBDIR, PGSQL_SHARED_LIBADD)
- PHP_SUBST(PGSQL_SHARED_LIBADD)
-
- PHP_ADD_INCLUDE($PGSQL_INCLUDE)
-
- PHP_NEW_EXTENSION(pgsql, pgsql.c, $ext_shared)
-fi
-
-
diff --git a/ext/pgsql/mysql_users.php b/ext/pgsql/mysql_users.php
deleted file mode 100644
index 65a2c33967..0000000000
--- a/ext/pgsql/mysql_users.php
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-/*
- * File: mysql_users.php
- * Author: Yasuo Ohgaki <yohgaki@php.net>
- *
- * This file contains example user defined functions that does
- * similar to MySQL functions. They can be implemented as module
- * functions, but there won't be many users need them.
- *
- * Requires: PostgreSQL 7.2.x
- */
-
-/*
- * mysql_list_dbs()
- *
- * This function should be needed, since PostgreSQL connection
- * binds database.
- */
-function pg_list_dbs($db)
-{
- assert(is_resource($db));
- $query = '
-SELECT
- d.datname as "Name",
- u.usename as "Owner",
- pg_encoding_to_char(d.encoding) as "Encoding"
-FROM
- pg_database d LEFT JOIN pg_user u ON d.datdba = u.usesysid
-ORDER BY 1;
-';
- return pg_query($db, $query);
-}
-
-
-/*
- * mysql_list_tables()
- */
-function pg_list_tables($db)
-{
- assert(is_resource($db));
- $query = "
-SELECT
- c.relname as \"Name\",
- CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' END as \"Type\",
- u.usename as \"Owner\"
-FROM
- pg_class c LEFT JOIN pg_user u ON c.relowner = u.usesysid
-WHERE
- c.relkind IN ('r','v','S','')
- AND c.relname !~ '^pg_'
-ORDER BY 1;
-";
- return pg_query($db, $query);
-}
-
-/*
- * mysql_list_fields()
- *
- * See also pg_meta_data(). It returns field defintion as array.
- */
-function pg_list_fields($db, $table)
-{
- assert(is_resource($db));
- $query = "
-SELECT
- a.attname,
- format_type(a.atttypid, a.atttypmod),
- a.attnotnull,
- a.atthasdef,
- a.attnum
-FROM
- pg_class c,
- pg_attribute a
-WHERE
- c.relname = '".$table."'
- AND a.attnum > 0 AND a.attrelid = c.oid
-ORDER BY a.attnum;
-";
- return pg_query($db, $query);
-}
-
-?>
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
deleted file mode 100644
index ef0d1c4fe6..0000000000
--- a/ext/pgsql/pgsql.c
+++ /dev/null
@@ -1,4507 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- | Jouni Ahto <jouni.ahto@exdec.fi> |
- | Yasuo Ohgaki <yohgaki@php.net> |
- | Youichi Iwakiri <yiwakiri@st.rim.or.jp> (pg_copy_*) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdlib.h>
-
-#define PHP_PGSQL_PRIVATE 1
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#define SMART_STR_PREALLOC 512
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/php_smart_str.h"
-#include "php_pgsql.h"
-#include "php_globals.h"
-
-#if HAVE_PGSQL
-
-#ifndef InvalidOid
-#define InvalidOid ((Oid) 0)
-#endif
-
-#define PGSQL_ASSOC 1<<0
-#define PGSQL_NUM 1<<1
-#define PGSQL_BOTH (PGSQL_ASSOC|PGSQL_NUM)
-
-#define PGSQL_STATUS_LONG 1
-#define PGSQL_STATUS_STRING 2
-
-#define PGSQL_MAX_LENGTH_OF_LONG 30
-#define PGSQL_MAX_LENGTH_OF_DOUBLE 60
-
-#define PGSQL_RETURN_OID(oid) do { \
- if (oid > LONG_MAX) { \
- smart_str s = {0}; \
- smart_str_append_unsigned(&s, oid); \
- smart_str_0(&s); \
- RETURN_STRINGL(s.c, s.len, 0); \
- } \
- RETURN_LONG((long)oid); \
-} while(0)
-
-
-#if HAVE_PQSETNONBLOCKING
-#define PQ_SETNONBLOCKING(pg_link, flag) PQsetnonblocking(pg_link, flag)
-#else
-#define PQ_SETNONBLOCKING(pg_link, flag) 0
-#endif
-
-#define CHECK_DEFAULT_LINK(x) if ((x) == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "No PostgreSQL link opened yet."); }
-
-/* {{{ pgsql_functions[]
- */
-function_entry pgsql_functions[] = {
- /* connection functions */
- PHP_FE(pg_connect, NULL)
- PHP_FE(pg_pconnect, NULL)
- PHP_FE(pg_close, NULL)
- PHP_FE(pg_connection_status, NULL)
- PHP_FE(pg_connection_busy, NULL)
- PHP_FE(pg_connection_reset, NULL)
- PHP_FE(pg_host, NULL)
- PHP_FE(pg_dbname, NULL)
- PHP_FE(pg_port, NULL)
- PHP_FE(pg_tty, NULL)
- PHP_FE(pg_options, NULL)
- PHP_FE(pg_ping, NULL)
- /* query functions */
- PHP_FE(pg_query, NULL)
- PHP_FE(pg_send_query, NULL)
- PHP_FE(pg_cancel_query, NULL)
- /* result functions */
- PHP_FE(pg_fetch_result, NULL)
- PHP_FE(pg_fetch_row, NULL)
- PHP_FE(pg_fetch_assoc, NULL)
- PHP_FE(pg_fetch_array, NULL)
- PHP_FE(pg_fetch_object, NULL)
- PHP_FE(pg_fetch_all, NULL)
- PHP_FE(pg_affected_rows,NULL)
- PHP_FE(pg_get_result, NULL)
- PHP_FE(pg_result_seek, NULL)
- PHP_FE(pg_result_status,NULL)
- PHP_FE(pg_free_result, NULL)
- PHP_FE(pg_last_oid, NULL)
- PHP_FE(pg_num_rows, NULL)
- PHP_FE(pg_num_fields, NULL)
- PHP_FE(pg_field_name, NULL)
- PHP_FE(pg_field_num, NULL)
- PHP_FE(pg_field_size, NULL)
- PHP_FE(pg_field_type, NULL)
- PHP_FE(pg_field_prtlen, NULL)
- PHP_FE(pg_field_is_null,NULL)
- /* async message function */
- PHP_FE(pg_get_notify, NULL)
- PHP_FE(pg_get_pid, NULL)
- /* error message functions */
- PHP_FE(pg_result_error, NULL)
- PHP_FE(pg_last_error, NULL)
- PHP_FE(pg_last_notice, NULL)
- /* copy functions */
- PHP_FE(pg_put_line, NULL)
- PHP_FE(pg_end_copy, NULL)
- PHP_FE(pg_copy_to, NULL)
- PHP_FE(pg_copy_from, NULL)
- /* debug functions */
- PHP_FE(pg_trace, NULL)
- PHP_FE(pg_untrace, NULL)
- /* large object functions */
- PHP_FE(pg_lo_create, NULL)
- PHP_FE(pg_lo_unlink, NULL)
- PHP_FE(pg_lo_open, NULL)
- PHP_FE(pg_lo_close, NULL)
- PHP_FE(pg_lo_read, NULL)
- PHP_FE(pg_lo_write, NULL)
- PHP_FE(pg_lo_read_all, NULL)
- PHP_FE(pg_lo_import, NULL)
- PHP_FE(pg_lo_export, NULL)
- PHP_FE(pg_lo_seek, NULL)
- PHP_FE(pg_lo_tell, NULL)
- /* utility functions */
-#if HAVE_PQESCAPE
- PHP_FE(pg_escape_string,NULL)
- PHP_FE(pg_escape_bytea, NULL)
- PHP_FE(pg_unescape_bytea, NULL)
-#endif
-#if HAVE_PQCLIENTENCODING
- PHP_FE(pg_client_encoding, NULL)
- PHP_FE(pg_set_client_encoding, NULL)
-#endif
- /* misc function */
- PHP_FE(pg_meta_data, NULL)
- PHP_FE(pg_convert, NULL)
- PHP_FE(pg_insert, NULL)
- PHP_FE(pg_update, NULL)
- PHP_FE(pg_delete, NULL)
- PHP_FE(pg_select, NULL)
- /* aliases for downwards compatibility */
- PHP_FALIAS(pg_exec, pg_query, NULL)
- PHP_FALIAS(pg_getlastoid, pg_last_oid, NULL)
- PHP_FALIAS(pg_cmdtuples, pg_affected_rows, NULL)
- PHP_FALIAS(pg_errormessage, pg_last_error, NULL)
- PHP_FALIAS(pg_numrows, pg_num_rows, NULL)
- PHP_FALIAS(pg_numfields, pg_num_fields, NULL)
- PHP_FALIAS(pg_fieldname, pg_field_name, NULL)
- PHP_FALIAS(pg_fieldsize, pg_field_size, NULL)
- PHP_FALIAS(pg_fieldtype, pg_field_type, NULL)
- PHP_FALIAS(pg_fieldnum, pg_field_num, NULL)
- PHP_FALIAS(pg_fieldprtlen, pg_field_prtlen, NULL)
- PHP_FALIAS(pg_fieldisnull, pg_field_is_null, NULL)
- PHP_FALIAS(pg_freeresult, pg_free_result, NULL)
- PHP_FALIAS(pg_result, pg_fetch_result, NULL)
- PHP_FALIAS(pg_loreadall, pg_lo_read_all, NULL)
- PHP_FALIAS(pg_locreate, pg_lo_create, NULL)
- PHP_FALIAS(pg_lounlink, pg_lo_unlink, NULL)
- PHP_FALIAS(pg_loopen, pg_lo_open, NULL)
- PHP_FALIAS(pg_loclose, pg_lo_close, NULL)
- PHP_FALIAS(pg_loread, pg_lo_read, NULL)
- PHP_FALIAS(pg_lowrite, pg_lo_write, NULL)
- PHP_FALIAS(pg_loimport, pg_lo_import, NULL)
- PHP_FALIAS(pg_loexport, pg_lo_export, NULL)
-#if HAVE_PQCLIENTENCODING
- PHP_FALIAS(pg_clientencoding, pg_client_encoding, NULL)
- PHP_FALIAS(pg_setclientencoding, pg_set_client_encoding, NULL)
-#endif
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ pgsql_module_entry
- */
-zend_module_entry pgsql_module_entry = {
- STANDARD_MODULE_HEADER,
- "pgsql",
- pgsql_functions,
- PHP_MINIT(pgsql),
- PHP_MSHUTDOWN(pgsql),
- PHP_RINIT(pgsql),
- PHP_RSHUTDOWN(pgsql),
- PHP_MINFO(pgsql),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_PGSQL
-ZEND_GET_MODULE(pgsql)
-#endif
-
-static int le_link, le_plink, le_result, le_lofp, le_string;
-
-#ifdef ZTS
-int pgsql_globals_id;
-#else
-php_pgsql_globals pgsql_globals;
-#endif
-
-/* {{{ php_pgsql_set_default_link
- */
-static void php_pgsql_set_default_link(int id TSRMLS_DC)
-{
- zend_list_addref(id);
-
- if (PGG(default_link) != -1) {
- zend_list_delete(PGG(default_link));
- }
-
- PGG(default_link) = id;
-}
-/* }}} */
-
-/* {{{ _close_pgsql_link
- */
-static void _close_pgsql_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- PGconn *link = (PGconn *)rsrc->ptr;
- PGresult *res;
-
- while ((res = PQgetResult(link))) {
- PQclear(res);
- }
- PQfinish(link);
- PGG(num_links)--;
-}
-/* }}} */
-
-/* {{{ _close_pgsql_plink
- */
-static void _close_pgsql_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- PGconn *link = (PGconn *)rsrc->ptr;
- PGresult *res;
-
- while ((res = PQgetResult(link))) {
- PQclear(res);
- }
- PQfinish(link);
- PGG(num_persistent)--;
- PGG(num_links)--;
-}
-/* }}} */
-
-/* {{{ _php_pgsql_notice_handler
- */
-static void _php_pgsql_notice_handler(void *resource_id, const char *message)
-{
- php_pgsql_notice *notice;
-
- TSRMLS_FETCH();
- if (! PGG(ignore_notices)) {
- if (PGG(log_notices)) {
- php_log_err((char *) message TSRMLS_CC);
- }
- notice = (php_pgsql_notice *)emalloc(sizeof(php_pgsql_notice));
- notice->len = strlen(message);
- notice->message = estrndup(message, notice->len);
- zend_hash_index_update(&PGG(notices), *(int *)resource_id, (void **)&notice, sizeof(php_pgsql_notice *), NULL);
- }
-}
-/* }}} */
-
-#define PHP_PGSQL_NOTICE_PTR_DTOR (void (*)(void *))_php_pgsql_notice_ptr_dtor
-
-/* {{{ _php_pgsql_notice_dtor
- */
-static void _php_pgsql_notice_ptr_dtor(void **ptr)
-{
- php_pgsql_notice *notice = (php_pgsql_notice *)*ptr;
- efree(notice->message);
- efree(notice);
-}
-/* }}} */
-
-/* {{{ _rollback_transactions
- */
-static int _rollback_transactions(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- PGconn *link;
- PGresult *res;
- int orig;
-
- if (Z_TYPE_P(rsrc) != le_plink)
- return 0;
-
- link = (PGconn *) rsrc->ptr;
-
- if (PQ_SETNONBLOCKING(link, 0)) {
- php_error_docref("ref.pgsql" TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode.");
- return -1;
- }
-
- while ((res = PQgetResult(link))) {
- PQclear(res);
- }
- orig = PGG(ignore_notices);
- PGG(ignore_notices) = 1;
- res = PQexec(link,"BEGIN;ROLLBACK;");
- PQclear(res);
- PGG(ignore_notices) = orig;
-
- return 0;
-}
-/* }}} */
-
-/* {{{ _free_ptr
- */
-static void _free_ptr(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- pgLofp *lofp = (pgLofp *)rsrc->ptr;
- efree(lofp);
-}
-/* }}} */
-
-/* {{{ _free_result
- */
-static void _free_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- pgsql_result_handle *pg_result = (pgsql_result_handle *)rsrc->ptr;
-
- PQclear(pg_result->result);
- efree(pg_result);
-}
-/* }}} */
-
-/* {{{ PHP_INI
- */
-PHP_INI_BEGIN()
-STD_PHP_INI_BOOLEAN("pgsql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateBool, allow_persistent, php_pgsql_globals, pgsql_globals)
-STD_PHP_INI_ENTRY_EX("pgsql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_persistent, php_pgsql_globals, pgsql_globals, display_link_numbers)
-STD_PHP_INI_ENTRY_EX("pgsql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_links, php_pgsql_globals, pgsql_globals, display_link_numbers)
-STD_PHP_INI_BOOLEAN("pgsql.auto_reset_persistent", "0", PHP_INI_SYSTEM, OnUpdateBool, auto_reset_persistent, php_pgsql_globals, pgsql_globals)
-STD_PHP_INI_BOOLEAN("pgsql.ignore_notice", "0", PHP_INI_ALL, OnUpdateBool, ignore_notices, php_pgsql_globals, pgsql_globals)
-STD_PHP_INI_BOOLEAN("pgsql.log_notice", "0", PHP_INI_ALL, OnUpdateBool, log_notices, php_pgsql_globals, pgsql_globals)
-PHP_INI_END()
-/* }}} */
-
-/* {{{ php_pgsql_init_globals
- */
-static void php_pgsql_init_globals(php_pgsql_globals *pgsql_globals_p TSRMLS_DC)
-{
- PGG(num_persistent) = 0;
- /* Initilize notice message hash at MINIT only */
- zend_hash_init_ex(&PGG(notices), 0, NULL, PHP_PGSQL_NOTICE_PTR_DTOR, 1, 0);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(pgsql)
-{
-#ifdef ZTS
- ts_allocate_id(&pgsql_globals_id, sizeof(php_pgsql_globals), (ts_allocate_ctor) php_pgsql_init_globals, NULL);
-#else
- php_pgsql_init_globals(&pgsql_globals TSRMLS_CC);
-#endif
-
- REGISTER_INI_ENTRIES();
-
- le_link = zend_register_list_destructors_ex(_close_pgsql_link, NULL, "pgsql link", module_number);
- le_plink = zend_register_list_destructors_ex(NULL, _close_pgsql_plink, "pgsql link persistent", module_number);
- le_result = zend_register_list_destructors_ex(_free_result, NULL, "pgsql result", module_number);
- le_lofp = zend_register_list_destructors_ex(_free_ptr, NULL, "pgsql large object", module_number);
- le_string = zend_register_list_destructors_ex(_free_ptr, NULL, "pgsql string", module_number);
- /* For connection option */
- REGISTER_LONG_CONSTANT("PGSQL_CONNECT_FORCE_NEW", PGSQL_CONNECT_FORCE_NEW, CONST_CS | CONST_PERSISTENT);
- /* For pg_fetch_array() */
- REGISTER_LONG_CONSTANT("PGSQL_ASSOC", PGSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_NUM", PGSQL_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_BOTH", PGSQL_BOTH, CONST_CS | CONST_PERSISTENT);
- /* For pg_connection_status() */
- REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_BAD", CONNECTION_BAD, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_OK", CONNECTION_OK, CONST_CS | CONST_PERSISTENT);
- /* For lo_seek() */
- REGISTER_LONG_CONSTANT("PGSQL_SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT);
- /* For pg_result_status() return value type */
- REGISTER_LONG_CONSTANT("PGSQL_STATUS_LONG", PGSQL_STATUS_LONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_STATUS_STRING", PGSQL_STATUS_STRING, CONST_CS | CONST_PERSISTENT);
- /* For pg_result_status() return value */
- REGISTER_LONG_CONSTANT("PGSQL_EMPTY_QUERY", PGRES_EMPTY_QUERY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_COMMAND_OK", PGRES_COMMAND_OK, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_TUPLES_OK", PGRES_TUPLES_OK, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_COPY_OUT", PGRES_COPY_OUT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_COPY_IN", PGRES_COPY_IN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_BAD_RESPONSE", PGRES_BAD_RESPONSE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_NONFATAL_ERROR", PGRES_NONFATAL_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_FATAL_ERROR", PGRES_FATAL_ERROR, CONST_CS | CONST_PERSISTENT);
- /* pg_convert options */
- REGISTER_LONG_CONSTANT("PGSQL_CONV_IGNORE_DEFAULT", PGSQL_CONV_IGNORE_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_CONV_FORCE_NULL", PGSQL_CONV_FORCE_NULL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_CONV_IGNORE_NOT_NULL", PGSQL_CONV_IGNORE_NOT_NULL, CONST_CS | CONST_PERSISTENT);
- /* pg_insert/update/delete/select options */
- REGISTER_LONG_CONSTANT("PGSQL_DML_NO_CONV", PGSQL_DML_NO_CONV, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_DML_EXEC", PGSQL_DML_EXEC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_DML_ASYNC", PGSQL_DML_ASYNC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_DML_STRING", PGSQL_DML_STRING, CONST_CS | CONST_PERSISTENT);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(pgsql)
-{
- UNREGISTER_INI_ENTRIES();
- zend_hash_destroy(&PGG(notices));
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(pgsql)
-{
- PGG(default_link)=-1;
- PGG(num_links) = PGG(num_persistent);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(pgsql)
-{
- /* clean up notice messages */
- zend_hash_clean(&PGG(notices));
- /* clean up persistent connection */
- zend_hash_apply(&EG(persistent_list), (apply_func_t) _rollback_transactions TSRMLS_CC);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(pgsql)
-{
- char buf[256];
-
- php_info_print_table_start();
- php_info_print_table_header(2, "PostgreSQL Support", "enabled");
-#if HAVE_PG_CONFIG_H
- php_info_print_table_row(2, "PostgreSQL(libpq) Version", PG_VERSION);
-#ifdef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
- php_info_print_table_row(2, "Multibyte character support", "enabled");
-#else
- php_info_print_table_row(2, "Multibyte character support", "disabled");
-#endif
-#ifdef USE_SSL
- php_info_print_table_row(2, "SSL support", "enabled");
-#else
- php_info_print_table_row(2, "SSL support", "disabled");
-#endif
-#endif /* HAVE_PG_CONFIG_H */
- sprintf(buf, "%ld", PGG(num_persistent));
- php_info_print_table_row(2, "Active Persistent Links", buf);
- sprintf(buf, "%ld", PGG(num_links));
- php_info_print_table_row(2, "Active Links", buf);
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-/* }}} */
-
-
-/* {{{ php_pgsql_do_connect
- */
-static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- char *host=NULL,*port=NULL,*options=NULL,*tty=NULL,*dbname=NULL,*connstring=NULL;
- PGconn *pgsql;
- smart_str str = {0};
- zval **args[5];
- int i, connect_type = 0;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 5
- || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- smart_str_appends(&str, "pgsql");
-
- for (i = 0; i < ZEND_NUM_ARGS(); i++) {
- convert_to_string_ex(args[i]);
- smart_str_appendc(&str, '_');
- smart_str_appendl(&str, Z_STRVAL_PP(args[i]), Z_STRLEN_PP(args[i]));
- }
-
- smart_str_0(&str);
-
- if (ZEND_NUM_ARGS() == 1) { /* new style, using connection string */
- connstring = Z_STRVAL_PP(args[0]);
- } else if (ZEND_NUM_ARGS() == 2 ) { /* Safe to add conntype_option, since 2 args was illegal */
- connstring = Z_STRVAL_PP(args[0]);
- convert_to_long_ex(args[1]);
- connect_type = Z_LVAL_PP(args[1]);
- } else {
- host = Z_STRVAL_PP(args[0]);
- port = Z_STRVAL_PP(args[1]);
- dbname = Z_STRVAL_PP(args[ZEND_NUM_ARGS()-1]);
-
- switch (ZEND_NUM_ARGS()) {
- case 5:
- tty = Z_STRVAL_PP(args[3]);
- /* fall through */
- case 4:
- options = Z_STRVAL_PP(args[2]);
- break;
- }
- }
-
- if (persistent && PGG(allow_persistent)) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), str.c, str.len+1, (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
-
- if (PGG(max_links)!=-1 && PGG(num_links)>=PGG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "Cannot create new link. Too many open links (%d).", PGG(num_links));
- goto err;
- }
- if (PGG(max_persistent)!=-1 && PGG(num_persistent)>=PGG(max_persistent)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "Cannot create new link. Too many open persistent links (%d).", PGG(num_persistent));
- goto err;
- }
-
- /* create the link */
- if (connstring) {
- pgsql=PQconnectdb(connstring);
- } else {
- pgsql=PQsetdb(host,port,options,tty,dbname);
- }
- if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "Unable to connect to PostgreSQL server: %s.", PQerrorMessage(pgsql));
- if (pgsql) {
- PQfinish(pgsql);
- }
- goto err;
- }
-
- /* hash it up */
- Z_TYPE(new_le) = le_plink;
- new_le.ptr = pgsql;
- if (zend_hash_update(&EG(persistent_list), str.c, str.len+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
- goto err;
- }
- PGG(num_links)++;
- PGG(num_persistent)++;
- } else { /* we do */
- if (Z_TYPE_P(le) != le_plink) {
- RETURN_FALSE;
- }
- /* ensure that the link did not die */
- if (PGG(auto_reset_persistent) & 1) {
- /* need to send & get something from backend to
- make sure we catch CONNECTION_BAD everytime */
- PGresult *pg_result;
- pg_result = PQexec(le->ptr, "select 1");
- PQclear(pg_result);
- }
- if (PQstatus(le->ptr)==CONNECTION_BAD) { /* the link died */
- if (le->ptr == NULL) {
- if (connstring) {
- le->ptr=PQconnectdb(connstring);
- } else {
- le->ptr=PQsetdb(host,port,options,tty,dbname);
- }
- }
- else {
- PQreset(le->ptr);
- }
- if (le->ptr==NULL || PQstatus(le->ptr)==CONNECTION_BAD) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"PostgreSQL link lost, unable to reconnect.");
- zend_hash_del(&EG(persistent_list),str.c,str.len+1);
- goto err;
- }
- }
- pgsql = (PGconn *) le->ptr;
- }
- ZEND_REGISTER_RESOURCE(return_value, pgsql, le_plink);
- } else { /* Non persistent connection */
- list_entry *index_ptr,new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual pgsql link sits.
- * if it doesn't, open a new pgsql link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (!(connect_type & PGSQL_CONNECT_FORCE_NEW)
- && zend_hash_find(&EG(regular_list),str.c,str.len+1,(void **) &index_ptr)==SUCCESS) {
- int type,link;
- void *ptr;
-
- if (Z_TYPE_P(index_ptr) != le_index_ptr) {
- RETURN_FALSE;
- }
- link = (int) index_ptr->ptr;
- ptr = zend_list_find(link,&type); /* check if the link is still there */
- if (ptr && (type==le_link || type==le_plink)) {
- Z_LVAL_P(return_value) = link;
- zend_list_addref(link);
- php_pgsql_set_default_link(link TSRMLS_CC);
- Z_TYPE_P(return_value) = IS_RESOURCE;
- goto cleanup;
- } else {
- zend_hash_del(&EG(regular_list),str.c,str.len+1);
- }
- }
- if (PGG(max_links)!=-1 && PGG(num_links)>=PGG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create new link. Too many open links (%d).", PGG(num_links));
- goto err;
- }
- if (connstring) {
- pgsql = PQconnectdb(connstring);
- } else {
- pgsql = PQsetdb(host,port,options,tty,dbname);
- }
- if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect to PostgreSQL server: %s.", PQerrorMessage(pgsql));
- goto err;
- }
-
- /* add it to the list */
- ZEND_REGISTER_RESOURCE(return_value, pgsql, le_link);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
- Z_TYPE(new_index_ptr) = le_index_ptr;
- if (zend_hash_update(&EG(regular_list),str.c,str.len+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
- goto err;
- }
- PGG(num_links)++;
- }
- /* set notice processer */
- if (! PGG(ignore_notices) && Z_TYPE_P(return_value) == IS_RESOURCE) {
- PQsetNoticeProcessor(pgsql, _php_pgsql_notice_handler, (void *)&Z_RESVAL_P(return_value));
- }
- php_pgsql_set_default_link(Z_LVAL_P(return_value) TSRMLS_CC);
-
-cleanup:
- smart_str_free(&str);
- return;
-
-err:
- smart_str_free(&str);
- RETURN_FALSE;
-}
-/* }}} */
-
-#if 0
-/* {{{ php_pgsql_get_default_link
- */
-static int php_pgsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
-{
- if (PGG(default_link)==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_pgsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
- }
- return PGG(default_link);
-}
-/* }}} */
-#endif
-
-/* {{{ proto resource pg_connect(string connection_string[, int connect_type] | [string host, string port [, string options [, string tty,]]] string database)
- Open a PostgreSQL connection */
-PHP_FUNCTION(pg_connect)
-{
- php_pgsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-/* }}} */
-
-/* {{{ proto resource pg_pconnect(string connection_string | [string host, string port [, string options [, string tty,]]] string database)
- Open a persistent PostgreSQL connection */
-PHP_FUNCTION(pg_pconnect)
-{
- php_pgsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ proto bool pg_close([resource connection])
- Close a PostgreSQL connection */
-PHP_FUNCTION(pg_close)
-{
- zval **pgsql_link = NULL;
- int id;
- PGconn *pgsql;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- if (id==-1) { /* explicit resource number */
- zend_list_delete(Z_RESVAL_PP(pgsql_link));
- }
-
- if (id!=-1
- || (pgsql_link && Z_RESVAL_PP(pgsql_link)==PGG(default_link))) {
- zend_list_delete(PGG(default_link));
- PGG(default_link) = -1;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-
-#define PHP_PG_DBNAME 1
-#define PHP_PG_ERROR_MESSAGE 2
-#define PHP_PG_OPTIONS 3
-#define PHP_PG_PORT 4
-#define PHP_PG_TTY 5
-#define PHP_PG_HOST 6
-
-/* {{{ php_pgsql_get_link_info
- */
-static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
-{
- zval **pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_link)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- switch(entry_type) {
- case PHP_PG_DBNAME:
- Z_STRVAL_P(return_value) = PQdb(pgsql);
- break;
- case PHP_PG_ERROR_MESSAGE:
- Z_STRVAL_P(return_value) = PQerrorMessage(pgsql);
- break;
- case PHP_PG_OPTIONS:
- Z_STRVAL_P(return_value) = PQoptions(pgsql);
- break;
- case PHP_PG_PORT:
- Z_STRVAL_P(return_value) = PQport(pgsql);
- break;
- case PHP_PG_TTY:
- Z_STRVAL_P(return_value) = PQtty(pgsql);
- break;
- case PHP_PG_HOST:
- Z_STRVAL_P(return_value) = PQhost(pgsql);
- break;
- default:
- RETURN_FALSE;
- }
- Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
- Z_STRVAL_P(return_value) = (char *) estrdup(Z_STRVAL_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
-}
-/* }}} */
-
-/* {{{ proto string pg_dbname([resource connection])
- Get the database name */
-PHP_FUNCTION(pg_dbname)
-{
- php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_DBNAME);
-}
-/* }}} */
-
-/* {{{ proto string pg_last_error([resource connection])
- Get the error message string */
-PHP_FUNCTION(pg_last_error)
-{
- php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_ERROR_MESSAGE);
-}
-/* }}} */
-
-/* {{{ proto string pg_options([resource connection])
- Get the options associated with the connection */
-PHP_FUNCTION(pg_options)
-{
- php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_OPTIONS);
-}
-/* }}} */
-
-/* {{{ proto int pg_port([resource connection])
- Return the port number associated with the connection */
-PHP_FUNCTION(pg_port)
-{
- php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_PORT);
-}
-/* }}} */
-
-/* {{{ proto string pg_tty([resource connection])
- Return the tty name associated with the connection */
-PHP_FUNCTION(pg_tty)
-{
- php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_TTY);
-}
-/* }}} */
-
-/* {{{ proto string pg_host([resource connection])
- Returns the host name associated with the connection */
-PHP_FUNCTION(pg_host)
-{
- php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_HOST);
-}
-/* }}} */
-
-/* {{{ proto bool pg_ping(resource connection)
- Ping database. If connection is bad, try to reconnect. */
-PHP_FUNCTION(pg_ping)
-{
- zval *pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r",
- &pgsql_link) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- /* ping connection */
- PQexec(pgsql, "SELECT 1;");
-
- /* check status. */
- if (PQstatus(pgsql) == CONNECTION_OK)
- RETURN_TRUE;
-
- /* reset connection if it's broken */
- PQreset(pgsql);
- if (PQstatus(pgsql) == CONNECTION_OK) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto resource pg_query([resource connection,] string query)
- Execute a query */
-PHP_FUNCTION(pg_query)
-{
- zval **query, **pgsql_link = NULL;
- int id = -1;
- int leftover = 0;
- PGconn *pgsql;
- PGresult *pgsql_result;
- ExecStatusType status;
- pgsql_result_handle *pg_result;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &query)==FAILURE) {
- RETURN_FALSE;
- }
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &pgsql_link, &query)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- convert_to_string_ex(query);
- if (PQ_SETNONBLOCKING(pgsql, 0)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE,"Cannot set connection to blocking mode.");
- RETURN_FALSE;
- }
- while ((pgsql_result = PQgetResult(pgsql))) {
- PQclear(pgsql_result);
- leftover = 1;
- }
- if (leftover) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found results on this connection. Use pg_get_result() to get these results first.");
- }
- pgsql_result = PQexec(pgsql, Z_STRVAL_PP(query));
- if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) {
- PQclear(pgsql_result);
- PQreset(pgsql);
- pgsql_result = PQexec(pgsql, Z_STRVAL_PP(query));
- }
-
- if (pgsql_result) {
- status = PQresultStatus(pgsql_result);
- } else {
- status = (ExecStatusType) PQstatus(pgsql);
- }
-
- switch (status) {
- case PGRES_EMPTY_QUERY:
- case PGRES_BAD_RESPONSE:
- case PGRES_NONFATAL_ERROR:
- case PGRES_FATAL_ERROR:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Query failed: %s.", PQerrorMessage(pgsql));
- RETURN_FALSE;
- break;
- case PGRES_COMMAND_OK: /* successful command that did not return rows */
- default:
- if (pgsql_result) {
- pg_result = (pgsql_result_handle *) emalloc(sizeof(pgsql_result_handle));
- pg_result->conn = pgsql;
- pg_result->result = pgsql_result;
- pg_result->row = 0;
- ZEND_REGISTER_RESOURCE(return_value, pg_result, le_result);
- } else {
- RETURN_FALSE;
- }
- break;
- }
-}
-/* }}} */
-
-#define PHP_PG_NUM_ROWS 1
-#define PHP_PG_NUM_FIELDS 2
-#define PHP_PG_CMD_TUPLES 3
-
-/* {{{ php_pgsql_get_result_info
- */
-static void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
-{
- zval **result;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
-
- pgsql_result = pg_result->result;
-
- switch (entry_type) {
- case PHP_PG_NUM_ROWS:
- Z_LVAL_P(return_value) = PQntuples(pgsql_result);
- break;
- case PHP_PG_NUM_FIELDS:
- Z_LVAL_P(return_value) = PQnfields(pgsql_result);
- break;
- case PHP_PG_CMD_TUPLES:
-#if HAVE_PQCMDTUPLES
- Z_LVAL_P(return_value) = atoi(PQcmdTuples(pgsql_result));
-#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supported under this build.");
- Z_LVAL_P(return_value) = 0;
-#endif
- break;
- default:
- RETURN_FALSE;
- }
- Z_TYPE_P(return_value) = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto int pg_num_rows(resource result)
- Return the number of rows in the result */
-PHP_FUNCTION(pg_num_rows)
-{
- php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_NUM_ROWS);
-}
-/* }}} */
-
-/* {{{ proto int pg_num_fields(resource result)
- Return the number of fields in the result */
-PHP_FUNCTION(pg_num_fields)
-{
- php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_NUM_FIELDS);
-}
-/* }}} */
-
-/* {{{ proto int pg_affected_rows(resource result)
- Returns the number of affected tuples */
-PHP_FUNCTION(pg_affected_rows)
-{
- php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_CMD_TUPLES);
-}
-/* }}} */
-
-/* {{{ proto string pg_last_notice(resource connection)
- Returns the last notice set by the backend */
-PHP_FUNCTION(pg_last_notice)
-{
- zval *pgsql_link;
- PGconn *pg_link;
- int id = -1;
- php_pgsql_notice **notice;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r",
- &pgsql_link) == FAILURE) {
- return;
- }
- /* Just to check if user passed valid resoruce */
- ZEND_FETCH_RESOURCE2(pg_link, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- if (zend_hash_index_find(&PGG(notices), Z_RESVAL_P(pgsql_link), (void **)&notice) == FAILURE) {
- RETURN_FALSE;
- }
- RETURN_STRINGL((*notice)->message, (*notice)->len, 1);
-}
-/* }}} */
-
-/* {{{ get_field_name
- */
-static char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list TSRMLS_DC)
-{
- PGresult *result;
- smart_str str = {0};
- list_entry *field_type;
- char *ret=NULL;
-
- /* try to lookup the type in the resource list */
- smart_str_appends(&str, "pgsql_oid_");
- smart_str_append_unsigned(&str, oid);
- smart_str_0(&str);
-
- if (zend_hash_find(list,str.c,str.len+1,(void **) &field_type)==SUCCESS) {
- ret = estrdup((char *)field_type->ptr);
- } else { /* hash all oid's */
- int i,num_rows;
- int oid_offset,name_offset;
- char *tmp_oid, *end_ptr, *tmp_name;
- list_entry new_oid_entry;
-
- if ((result = PQexec(pgsql,"select oid,typname from pg_type")) == NULL) {
- smart_str_free(&str);
- return empty_string;
- }
- num_rows = PQntuples(result);
- oid_offset = PQfnumber(result,"oid");
- name_offset = PQfnumber(result,"typname");
-
- for (i=0; i<num_rows; i++) {
- if ((tmp_oid = PQgetvalue(result,i,oid_offset))==NULL) {
- continue;
- }
-
- str.len = 0;
- smart_str_appends(&str, "pgsql_oid_");
- smart_str_appends(&str, tmp_oid);
- smart_str_0(&str);
-
- if ((tmp_name = PQgetvalue(result,i,name_offset))==NULL) {
- continue;
- }
- Z_TYPE(new_oid_entry) = le_string;
- new_oid_entry.ptr = estrdup(tmp_name);
- zend_hash_update(list,str.c,str.len+1,(void *) &new_oid_entry, sizeof(list_entry), NULL);
- if (!ret && strtoul(tmp_oid, &end_ptr, 10)==oid) {
- ret = estrdup(tmp_name);
- }
- }
- }
-
- smart_str_free(&str);
- return ret;
-}
-/* }}} */
-
-#define PHP_PG_FIELD_NAME 1
-#define PHP_PG_FIELD_SIZE 2
-#define PHP_PG_FIELD_TYPE 3
-
-/* {{{ php_pgsql_get_field_info
- */
-static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
-{
- zval **result, **field;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &result, &field)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
-
- pgsql_result = pg_result->result;
- convert_to_long_ex(field);
-
- if (Z_LVAL_PP(field) < 0 || Z_LVAL_PP(field) >= PQnfields(pgsql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad field offset specified.");
- RETURN_FALSE;
- }
-
- switch (entry_type) {
- case PHP_PG_FIELD_NAME:
- Z_STRVAL_P(return_value) = PQfname(pgsql_result, Z_LVAL_PP(field));
- Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
- Z_STRVAL_P(return_value) = estrndup(Z_STRVAL_P(return_value),Z_STRLEN_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- break;
- case PHP_PG_FIELD_SIZE:
- Z_LVAL_P(return_value) = PQfsize(pgsql_result, Z_LVAL_PP(field));
- Z_TYPE_P(return_value) = IS_LONG;
- break;
- case PHP_PG_FIELD_TYPE:
- Z_STRVAL_P(return_value) = get_field_name(pg_result->conn, PQftype(pgsql_result, Z_LVAL_PP(field)), &EG(regular_list) TSRMLS_CC);
- Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- break;
- default:
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string pg_field_name(resource result, int field_number)
- Returns the name of the field */
-PHP_FUNCTION(pg_field_name)
-{
- php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_FIELD_NAME);
-}
-/* }}} */
-
-/* {{{ proto int pg_field_size(resource result, int field_number)
- Returns the internal size of the field */
-PHP_FUNCTION(pg_field_size)
-{
- php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_FIELD_SIZE);
-}
-/* }}} */
-
-/* {{{ proto string pg_field_type(resource result, int field_number)
- Returns the type name for the given field */
-PHP_FUNCTION(pg_field_type)
-{
- php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_FIELD_TYPE);
-}
-/* }}} */
-
-/* {{{ proto int pg_field_num(resource result, string field_name)
- Returns the field number of the named field */
-PHP_FUNCTION(pg_field_num)
-{
- zval **result, **field;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &result, &field)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
-
- pgsql_result = pg_result->result;
-
- convert_to_string_ex(field);
- Z_LVAL_P(return_value) = PQfnumber(pgsql_result, Z_STRVAL_PP(field));
- Z_TYPE_P(return_value) = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto mixed pg_fetch_result(resource result, [int row_number,] mixed field_name)
- Returns values from a result identifier */
-PHP_FUNCTION(pg_fetch_result)
-{
- zval **result, **row, **field=NULL;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
- int field_offset, pgsql_row;
-
- if ((ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &result, &row, &field)==FAILURE) &&
- (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &result, &field)==FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
-
- pgsql_result = pg_result->result;
- if (ZEND_NUM_ARGS() == 2) {
- if (pg_result->row < 0)
- pg_result->row = 0;
- pgsql_row = pg_result->row;
- if (pgsql_row >= PQntuples(pgsql_result)) {
- RETURN_FALSE;
- }
- } else {
- convert_to_long_ex(row);
- pgsql_row = Z_LVAL_PP(row);
- if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %d on PostgreSQL result index %d.", Z_LVAL_PP(row), Z_LVAL_PP(result));
- RETURN_FALSE;
- }
- }
- switch(Z_TYPE_PP(field)) {
- case IS_STRING:
- field_offset = PQfnumber(pgsql_result, Z_STRVAL_PP(field));
- break;
- default:
- convert_to_long_ex(field);
- field_offset = Z_LVAL_PP(field);
- break;
- }
- if (field_offset<0 || field_offset>=PQnfields(pgsql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified.");
- RETURN_FALSE;
- }
-
- if (PQgetisnull(pgsql_result, pgsql_row, field_offset)) {
- Z_TYPE_P(return_value) = IS_NULL;
- } else {
- Z_STRVAL_P(return_value) = PQgetvalue(pgsql_result, pgsql_row, field_offset);
- Z_STRLEN_P(return_value) = (Z_STRVAL_P(return_value) ? strlen(Z_STRVAL_P(return_value)) : 0);
- Z_STRVAL_P(return_value) = safe_estrndup(Z_STRVAL_P(return_value),Z_STRLEN_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
- }
-}
-/* }}} */
-
-/* {{{ void php_pgsql_fetch_hash */
-static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
-{
- zval **result, **row, **arg3;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
- int i, num_fields, pgsql_row;
- char *element, *field_name;
- uint element_len;
-
- switch (ZEND_NUM_ARGS()) {
- case 1: /* pg_fetch_*(result) */
- if (zend_get_parameters_ex(1, &result) == FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2: /* pg_fetch_*(result, row) */
- if (zend_get_parameters_ex(2, &result, &row) == FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3: /* pg_fetch_*(result, row, result_type) */
- if (zend_get_parameters_ex(3, &result, &row, &arg3) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(arg3);
- result_type = Z_LVAL_PP(arg3);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (!(result_type & PGSQL_BOTH)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid result type.");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
-
- pgsql_result = pg_result->result;
-
- if (ZEND_NUM_ARGS() == 1) {
- pgsql_row = pg_result->row;
- if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
- RETURN_FALSE;
- }
- pg_result->row++;
- } else {
- if (Z_TYPE_PP(row) != IS_NULL) {
- convert_to_long_ex(row);
- pgsql_row = Z_LVAL_PP(row);
- pg_result->row = pgsql_row;
- if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %d on PostgreSQL result index %d.", Z_LVAL_PP(row), Z_LVAL_PP(result));
- RETURN_FALSE;
- }
- } else {
- /* If 2nd param is NULL, use internal row counter to access next row */
- pgsql_row = pg_result->row;
- if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
- RETURN_FALSE;
- }
- pg_result->row++;
- }
- }
- array_init(return_value);
- for (i = 0, num_fields = PQnfields(pgsql_result); i < num_fields; i++) {
- if (PQgetisnull(pgsql_result, pgsql_row, i)) {
- if (result_type & PGSQL_NUM) {
- add_index_null(return_value, i);
- }
- if (result_type & PGSQL_ASSOC) {
- field_name = PQfname(pgsql_result, i);
- add_assoc_null(return_value, field_name);
- }
- } else {
- element = PQgetvalue(pgsql_result, pgsql_row, i);
- element_len = (element ? strlen(element) : 0);
- if (element) {
- char *data;
- int data_len;
- int should_copy=0;
-
- if (PG(magic_quotes_runtime)) {
- data = php_addslashes(element, element_len, &data_len, 0 TSRMLS_CC);
- } else {
- data = safe_estrndup(element, element_len);
- data_len = element_len;
- }
-
- if (result_type & PGSQL_NUM) {
- add_index_stringl(return_value, i, data, data_len, should_copy);
- should_copy=1;
- }
-
- if (result_type & PGSQL_ASSOC) {
- field_name = PQfname(pgsql_result, i);
- add_assoc_stringl(return_value, field_name, data, data_len, should_copy);
- }
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ proto array pg_fetch_row(resource result [, int row [, int result_type]])
- Get a row as an enumerated array */
-PHP_FUNCTION(pg_fetch_row)
-{
- php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, PGSQL_NUM);
-}
-/* }}} */
-
-/* {{{ proto array pg_fetch_assoc(resource result [, int row])
- Fetch a row as an assoc array */
-PHP_FUNCTION(pg_fetch_assoc)
-{
- /* pg_fetch_assoc() is added from PHP 4.3.0. It should raise error, when
- there is 3rd parameter */
- if (ZEND_NUM_ARGS() > 2)
- WRONG_PARAM_COUNT;
- php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, PGSQL_ASSOC);
-}
-/* }}} */
-
-/* {{{ proto array pg_fetch_array(resource result [, int row [, int result_type]])
- Fetch a row as an array */
-PHP_FUNCTION(pg_fetch_array)
-{
- php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, PGSQL_BOTH);
-}
-/* }}} */
-
-/* {{{ proto object pg_fetch_object(resource result [, int row])
- Fetch a row as an object */
-PHP_FUNCTION(pg_fetch_object)
-{
- /* pg_fetch_object() allowed result_type used to be. 3rd parameter
- must be allowed for compatibility */
- php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, PGSQL_ASSOC);
- if (Z_TYPE_P(return_value)==IS_ARRAY) {
- object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value));
- }
-}
-/* }}} */
-
-/* {{{ proto array pg_fetch_all(resource result)
- Fetch all rows into array */
-PHP_FUNCTION(pg_fetch_all)
-{
- zval *result;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r",
- &result) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, "PostgreSQL result", le_result);
-
- pgsql_result = pg_result->result;
- array_init(return_value);
- if (php_pgsql_result2array(pgsql_result, return_value TSRMLS_CC) == FAILURE) {
- zval_dtor(return_value);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto mixed pg_result_seek(resource result, int offset)
- Set internal row offset */
-PHP_FUNCTION(pg_result_seek)
-{
- zval *result;
- long row;
- pgsql_result_handle *pg_result;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &row) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, "PostgreSQL result", le_result);
-
- if (row < 0 || row >= PQntuples(pg_result->result)) {
- RETURN_FALSE;
- }
-
- /* seek to offset */
- pg_result->row = row;
- RETURN_TRUE;
-}
-/* }}} */
-
-
-#define PHP_PG_DATA_LENGTH 1
-#define PHP_PG_DATA_ISNULL 2
-
-/* {{{ php_pgsql_data_info
- */
-static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
-{
- zval **result, **row, **field;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
- int field_offset, pgsql_row;
-
- if ((ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &result, &row, &field)==FAILURE) &&
- (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &result, &field)==FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
-
- pgsql_result = pg_result->result;
- if (ZEND_NUM_ARGS() == 2) {
- if (pg_result->row < 0)
- pg_result->row = 0;
- pgsql_row = pg_result->row;
- if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
- RETURN_FALSE;
- }
- } else {
- convert_to_long_ex(row);
- pgsql_row = Z_LVAL_PP(row);
- if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %d on PostgreSQL result index %d.", Z_LVAL_PP(row), Z_LVAL_PP(result));
- RETURN_FALSE;
- }
- }
-
- switch(Z_TYPE_PP(field)) {
- case IS_STRING:
- convert_to_string_ex(field);
- field_offset = PQfnumber(pgsql_result, Z_STRVAL_PP(field));
- break;
- default:
- convert_to_long_ex(field);
- field_offset = Z_LVAL_PP(field);
- break;
- }
- if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified.");
- RETURN_FALSE;
- }
-
- switch (entry_type) {
- case PHP_PG_DATA_LENGTH:
- Z_LVAL_P(return_value) = PQgetlength(pgsql_result, pgsql_row, field_offset);
- break;
- case PHP_PG_DATA_ISNULL:
- Z_LVAL_P(return_value) = PQgetisnull(pgsql_result, pgsql_row, field_offset);
- break;
- }
- Z_TYPE_P(return_value) = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto int pg_field_prtlen(resource result, [int row,] mixed field_name_or_number)
- Returns the printed length */
-PHP_FUNCTION(pg_field_prtlen)
-{
- php_pgsql_data_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_PG_DATA_LENGTH);
-}
-/* }}} */
-
-/* {{{ proto int pg_field_is_null(resource result, [int row,] mixed field_name_or_number)
- Test if a field is NULL */
-PHP_FUNCTION(pg_field_is_null)
-{
- php_pgsql_data_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_PG_DATA_ISNULL);
-}
-/* }}} */
-
-/* {{{ proto bool pg_free_result(resource result)
- Free result memory */
-PHP_FUNCTION(pg_free_result)
-{
- zval **result;
- pgsql_result_handle *pg_result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
- if (Z_LVAL_PP(result) == 0) {
- RETURN_FALSE;
- }
- zend_list_delete(Z_LVAL_PP(result));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string pg_last_oid(resource result)
- Returns the last object identifier */
-PHP_FUNCTION(pg_last_oid)
-{
- zval **result;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
-#ifdef HAVE_PQOIDVALUE
- Oid oid;
-#endif
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
- pgsql_result = pg_result->result;
-#ifdef HAVE_PQOIDVALUE
- oid = PQoidValue(pgsql_result);
- if (oid == InvalidOid) {
- RETURN_FALSE;
- }
- PGSQL_RETURN_OID(oid);
-#else
- Z_STRVAL_P(return_value) = (char *) PQoidStatus(pgsql_result);
- if (Z_STRVAL_P(return_value)) {
- RETURN_STRING(Z_STRVAL_P(return_value), 1);
- }
- RETURN_STRING(empty_string, 0);
-#endif
-}
-/* }}} */
-
-/* {{{ proto bool pg_trace(string filename [, string mode [, resource connection]])
- Enable tracing a PostgreSQL connection */
-PHP_FUNCTION(pg_trace)
-{
- zval **z_filename, **z_mode, **z_pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
- char *mode = "w";
- FILE *fp = NULL;
- php_stream *stream;
- id = PGG(default_link);
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &z_filename)==FAILURE) {
- RETURN_FALSE;
- }
- CHECK_DEFAULT_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &z_filename, &z_mode)==FAILURE) {
- RETURN_FALSE;
- }
- CHECK_DEFAULT_LINK(id);
- convert_to_string_ex(z_mode);
- mode = Z_STRVAL_PP(z_mode);
- break;
- case 3:
- if (zend_get_parameters_ex(3, &z_filename, &z_mode, &z_pgsql_link)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(z_mode);
- mode = Z_STRVAL_PP(z_mode);
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, z_pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- convert_to_string_ex(z_filename);
-
- stream = php_stream_open_wrapper(Z_STRVAL_PP(z_filename), mode, ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
-
- if (!stream) {
- RETURN_FALSE;
- }
-
- if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void**)fp, REPORT_ERRORS)) {
- php_stream_close(stream);
- RETURN_FALSE;
- }
- php_stream_auto_cleanup(stream);
- PQtrace(pgsql, fp);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool pg_untrace([resource connection])
- Disable tracing of a PostgreSQL connection */
-PHP_FUNCTION(pg_untrace)
-{
- zval **pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_link)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- PQuntrace(pgsql);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pg_lo_create([resource connection])
- Create a large object */
-PHP_FUNCTION(pg_lo_create)
-{
- zval **pgsql_link = NULL;
- PGconn *pgsql;
- Oid pgsql_oid;
- int id = -1;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_link)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- /* NOTE: Archive modes not supported until I get some more data. Don't think anybody's
- using it anyway. I believe it's also somehow related to the 'time travel' feature of
- PostgreSQL, that's on the list of features to be removed... Create modes not supported.
- What's the use of an object that can be only written to, but not read from, and vice
- versa? Beats me... And the access type (r/w) must be specified again when opening
- the object, probably (?) overrides this. (Jouni)
- */
-
- if ((pgsql_oid = lo_creat(pgsql, INV_READ|INV_WRITE)) == InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create PostgreSQL large object.");
- RETURN_FALSE;
- }
- PGSQL_RETURN_OID(pgsql_oid);
-}
-/* }}} */
-
-/* {{{ proto bool pg_lo_unlink([resource connection,] string large_object_oid)
- Delete a large object */
-PHP_FUNCTION(pg_lo_unlink)
-{
- zval *pgsql_link = NULL;
- long oid_long;
- char *oid_string, *end_ptr;
- int oid_strlen;
- PGconn *pgsql;
- Oid oid;
- int id = -1;
- int argc = ZEND_NUM_ARGS();
-
- /* accept string type since Oid type is unsigned int */
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "rs", &pgsql_link, &oid_string, &oid_strlen) == SUCCESS) {
- oid = (Oid)strtoul(oid_string, &end_ptr, 10);
- if ((oid_string+oid_strlen) != end_ptr) {
- /* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed.");
- RETURN_FALSE;
- }
- }
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "rl", &pgsql_link, &oid_long) == SUCCESS) {
- if (oid_long <= InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified.");
- RETURN_FALSE;
- }
- oid = (Oid)oid_long;
- }
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "s", &oid_string, &oid_strlen) == SUCCESS) {
- oid = (Oid)strtoul(oid_string, &end_ptr, 10);
- if ((oid_string+oid_strlen) != end_ptr) {
- /* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed.");
- RETURN_FALSE;
- }
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- }
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "l", &oid_long) == SUCCESS) {
- if (oid_long <= InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID is specified.");
- RETURN_FALSE;
- }
- oid = (Oid)oid_long;
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- }
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires 1 or 2 arguments.");
- RETURN_FALSE;
- }
-
- if (pgsql_link == NULL) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- if (lo_unlink(pgsql, oid) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to delete PostgreSQL large object %u.", oid);
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto resource pg_lo_open([resource connection,] int large_object_oid, string mode)
- Open a large object and return fd */
-PHP_FUNCTION(pg_lo_open)
-{
- zval *pgsql_link = NULL;
- long oid_long;
- char *oid_string, *end_ptr, *mode_string;
- int oid_strlen, mode_strlen;
- PGconn *pgsql;
- Oid oid;
- int id = -1, pgsql_mode=0, pgsql_lofd;
- int create=0;
- pgLofp *pgsql_lofp;
- int argc = ZEND_NUM_ARGS();
-
- /* accept string type since Oid is unsigned int */
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "rss", &pgsql_link, &oid_string, &oid_strlen, &mode_string, &mode_strlen) == SUCCESS) {
- oid = (Oid)strtoul(oid_string, &end_ptr, 10);
- if ((oid_string+oid_strlen) != end_ptr) {
- /* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed.");
- RETURN_FALSE;
- }
- }
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "rls", &pgsql_link, &oid_long, &mode_string, &mode_strlen) == SUCCESS) {
- if (oid_long <= InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified.");
- RETURN_FALSE;
- }
- oid = (Oid)oid_long;
- }
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "ss", &oid_string, &oid_strlen, &mode_string, &mode_strlen) == SUCCESS) {
- oid = (Oid)strtoul(oid_string, &end_ptr, 10);
- if ((oid_string+oid_strlen) != end_ptr) {
- /* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed.");
- RETURN_FALSE;
- }
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- }
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "ls", &oid_long, &mode_string, &mode_strlen) == SUCCESS) {
- if (oid_long <= InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified.");
- RETURN_FALSE;
- }
- oid = (Oid)oid_long;
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- }
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires 1 or 2 arguments.");
- RETURN_FALSE;
- }
-
- if (pgsql_link == NULL) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- /* r/w/+ is little bit more PHP-like than INV_READ/INV_WRITE and a lot of
- faster to type. Unfortunately, doesn't behave the same way as fopen()...
- (Jouni)
- */
-
- if (strchr(mode_string, 'r') == mode_string) {
- pgsql_mode |= INV_READ;
- if (strchr(mode_string, '+') == mode_string+1) {
- pgsql_mode |= INV_WRITE;
- }
- }
- if (strchr(mode_string, 'w') == mode_string) {
- pgsql_mode |= INV_WRITE;
- create = 1;
- if (strchr(mode_string, '+') == mode_string+1) {
- pgsql_mode |= INV_READ;
- }
- }
-
- pgsql_lofp = (pgLofp *) emalloc(sizeof(pgLofp));
-
- if ((pgsql_lofd = lo_open(pgsql, oid, pgsql_mode)) == -1) {
- if (create) {
- if ((oid = lo_creat(pgsql, INV_READ|INV_WRITE)) == 0) {
- efree(pgsql_lofp);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create PostgreSQL large object.");
- RETURN_FALSE;
- } else {
- if ((pgsql_lofd = lo_open(pgsql, oid, pgsql_mode)) == -1) {
- if (lo_unlink(pgsql, oid) == -1) {
- efree(pgsql_lofp);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Something is really messed up! Your database is badly corrupted in a way NOT related to PHP.");
- RETURN_FALSE;
- }
- efree(pgsql_lofp);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open PostgreSQL large object.");
- RETURN_FALSE;
- } else {
- pgsql_lofp->conn = pgsql;
- pgsql_lofp->lofd = pgsql_lofd;
- Z_LVAL_P(return_value) = zend_list_insert(pgsql_lofp, le_lofp);
- Z_TYPE_P(return_value) = IS_LONG;
- }
- }
- } else {
- efree(pgsql_lofp);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open PostgreSQL large object.");
- RETURN_FALSE;
- }
- } else {
- pgsql_lofp->conn = pgsql;
- pgsql_lofp->lofd = pgsql_lofd;
- ZEND_REGISTER_RESOURCE(return_value, pgsql_lofp, le_lofp);
- }
-}
-/* }}} */
-
-/* {{{ proto bool pg_lo_close(resource large_object)
- Close a large object */
-PHP_FUNCTION(pg_lo_close)
-{
- zval **pgsql_lofp;
- pgLofp *pgsql;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_lofp)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(pgsql, pgLofp *, pgsql_lofp, -1, "PostgreSQL large object", le_lofp);
-
- if (lo_close((PGconn *)pgsql->conn, pgsql->lofd) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to close PostgreSQL large object descriptor %d.", pgsql->lofd);
- RETVAL_FALSE;
- } else {
- RETVAL_TRUE;
- }
-
- zend_list_delete(Z_RESVAL_PP(pgsql_lofp));
- return;
-}
-/* }}} */
-
-#define PGSQL_LO_READ_BUF_SIZE 8192
-
-/* {{{ proto string pg_lo_read(resource large_object [, int len])
- Read a large object */
-PHP_FUNCTION(pg_lo_read)
-{
- zval **pgsql_id, **len;
- int buf_len = PGSQL_LO_READ_BUF_SIZE, nbytes;
- char *buf;
- pgLofp *pgsql;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &pgsql_id, &len) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pgsql, pgLofp *, pgsql_id, -1, "PostgreSQL large object", le_lofp);
-
- if (ZEND_NUM_ARGS() > 1) {
- convert_to_long_ex(len);
- buf_len = Z_LVAL_PP(len);
- }
-
- buf = (char *) safe_emalloc(sizeof(char), (buf_len+1), 0);
- if ((nbytes = lo_read((PGconn *)pgsql->conn, pgsql->lofd, buf, buf_len))<0) {
- efree(buf);
- RETURN_FALSE;
- }
-
- buf[nbytes] = '\0';
- RETURN_STRINGL(buf, nbytes, 0);
-}
-/* }}} */
-
-/* {{{ proto int pg_lo_write(resource large_object, string buf [, int len])
- Write a large object */
-PHP_FUNCTION(pg_lo_write)
-{
- zval **pgsql_id, **str, **z_len;
- int nbytes;
- int len;
- pgLofp *pgsql;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 ||
- zend_get_parameters_ex(argc, &pgsql_id, &str, &z_len) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(str);
-
- if (argc > 2) {
- convert_to_long_ex(z_len);
- if (Z_LVAL_PP(z_len) > Z_STRLEN_PP(str)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot write more than buffer size %d. Tried to write %d.", Z_LVAL_PP(str), Z_LVAL_PP(z_len));
- RETURN_FALSE;
- }
- if (Z_LVAL_PP(z_len) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Buffer size must be larger than 0, but %d was specified.", Z_LVAL_PP(str), Z_LVAL_PP(z_len));
- RETURN_FALSE;
- }
- len = Z_LVAL_PP(z_len);
- }
- else {
- len = Z_STRLEN_PP(str);
- }
-
- ZEND_FETCH_RESOURCE(pgsql, pgLofp *, pgsql_id, -1, "PostgreSQL large object", le_lofp);
-
- if ((nbytes = lo_write((PGconn *)pgsql->conn, pgsql->lofd, Z_STRVAL_PP(str), len)) == -1) {
- RETURN_FALSE;
- }
-
- RETURN_LONG(nbytes);
-}
-/* }}} */
-
-/* {{{ proto int pg_lo_read_all(resource large_object)
- Read a large object and send straight to browser */
-PHP_FUNCTION(pg_lo_read_all)
-{
- zval **pgsql_id;
- int tbytes;
- volatile int nbytes;
- char buf[PGSQL_LO_READ_BUF_SIZE];
- pgLofp *pgsql;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_id)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(pgsql, pgLofp *, pgsql_id, -1, "PostgreSQL large object", le_lofp);
-
- tbytes = 0;
- while ((nbytes = lo_read((PGconn *)pgsql->conn, pgsql->lofd, buf, PGSQL_LO_READ_BUF_SIZE))>0) {
- php_body_write(buf, nbytes TSRMLS_CC);
- tbytes += nbytes;
- }
- RETURN_LONG(tbytes);
-}
-/* }}} */
-
-/* {{{ proto int pg_lo_import([resource connection, ] string filename)
- Import large object direct from filesystem */
-PHP_FUNCTION(pg_lo_import)
-{
- zval *pgsql_link = NULL;
- char *file_in;
- int id = -1, name_len;
- int argc = ZEND_NUM_ARGS();
- PGconn *pgsql;
- Oid oid;
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "rs", &pgsql_link, &file_in, &name_len) == SUCCESS) {
- ;
- }
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "s", &file_in, &name_len) == SUCCESS) {
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- }
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "sr", &file_in, &name_len, &pgsql_link ) == SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Old API is used.");
- }
- else {
- WRONG_PARAM_COUNT;
- }
-
- if (pgsql_link == NULL) {
- RETURN_FALSE;
- }
-
- if (PG(safe_mode) &&(!php_checkuid(file_in, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(file_in TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- oid = lo_import(pgsql, file_in);
-
- if (oid == InvalidOid) {
- RETURN_FALSE;
- }
- PGSQL_RETURN_OID(oid);
-}
-/* }}} */
-
-/* {{{ proto bool pg_lo_export([resource connection, ] int objoid, string filename)
- Export large object direct to filesystem */
-PHP_FUNCTION(pg_lo_export)
-{
- zval *pgsql_link = NULL;
- char *file_out, *oid_string, *end_ptr;
- int oid_strlen;
- int id = -1, name_len;
- long oid_long;
- Oid oid;
- PGconn *pgsql;
- int argc = ZEND_NUM_ARGS();
-
- /* allow string to handle large OID value correctly */
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "rls", &pgsql_link, &oid_long, &file_out, &name_len) == SUCCESS) {
- if (oid_long <= InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified.");
- RETURN_FALSE;
- }
- oid = (Oid)oid_long;
- }
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "rss", &pgsql_link, &oid_string, &oid_strlen, &file_out, &name_len) == SUCCESS) {
- oid = (Oid)strtoul(oid_string, &end_ptr, 10);
- if ((oid_string+oid_strlen) != end_ptr) {
- /* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed.");
- RETURN_FALSE;
- }
- }
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "ls", &oid_long, &file_out, &name_len) == SUCCESS) {
- if (oid_long <= InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified.");
- RETURN_FALSE;
- }
- oid = (Oid)oid_long;
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- }
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "ss", &oid_string, &oid_strlen, &file_out, &name_len) == SUCCESS) {
- oid = (Oid)strtoul(oid_string, &end_ptr, 10);
- if ((oid_string+oid_strlen) != end_ptr) {
- /* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed.");
- RETURN_FALSE;
- }
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- }
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "ssr", &oid_string, &oid_strlen, &file_out, &name_len, &pgsql_link) == SUCCESS) {
- oid = (Oid)strtoul(oid_string, &end_ptr, 10);
- if ((oid_string+oid_strlen) != end_ptr) {
- /* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed.");
- RETURN_FALSE;
- }
- }
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "lsr", &oid_long, &file_out, &name_len, &pgsql_link) == SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, " %s(): Old API is used");
- if (oid_long <= InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified.");
- RETURN_FALSE;
- }
- oid = (Oid)oid_long;
- }
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires 2 or 3 arguments.");
- RETURN_FALSE;
- }
-
- if (pgsql_link == NULL) {
- RETURN_FALSE;
- }
-
- if (PG(safe_mode) &&(!php_checkuid(file_out, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(file_out TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- if (lo_export(pgsql, oid, file_out)) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool pg_lo_seek(resource large_object, int offset [, int whence])
- Seeks position of large object */
-PHP_FUNCTION(pg_lo_seek)
-{
- zval *pgsql_id = NULL;
- long offset = 0, whence = SEEK_CUR;
- pgLofp *pgsql;
- int argc = ZEND_NUM_ARGS();
-
- if (zend_parse_parameters(argc TSRMLS_CC, "rl|l", &pgsql_id, &offset, &whence) == FAILURE) {
- return;
- }
- if (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid whence parameter.");
- return;
- }
-
- ZEND_FETCH_RESOURCE(pgsql, pgLofp *, &pgsql_id, -1, "PostgreSQL large object", le_lofp);
-
- if (lo_lseek((PGconn *)pgsql->conn, pgsql->lofd, offset, whence) > -1) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int pg_lo_tell(resource large_object)
- Returns current position of large object */
-PHP_FUNCTION(pg_lo_tell)
-{
- zval *pgsql_id = NULL;
- int offset = 0;
- pgLofp *pgsql;
- int argc = ZEND_NUM_ARGS();
-
- if (zend_parse_parameters(argc TSRMLS_CC, "r", &pgsql_id) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(pgsql, pgLofp *, &pgsql_id, -1, "PostgreSQL large object", le_lofp);
-
- offset = lo_tell((PGconn *)pgsql->conn, pgsql->lofd);
- RETURN_LONG(offset);
-}
-/* }}} */
-
-#ifdef HAVE_PQCLIENTENCODING
-/* {{{ proto int pg_set_client_encoding([resource connection,] string encoding)
- Set client encoding */
-PHP_FUNCTION(pg_set_client_encoding)
-{
- zval **encoding, **pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &encoding)==FAILURE) {
- RETURN_FALSE;
- }
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &pgsql_link, &encoding)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- convert_to_string_ex(encoding);
- Z_LVAL_P(return_value) = PQsetClientEncoding(pgsql, Z_STRVAL_PP(encoding));
- Z_TYPE_P(return_value) = IS_LONG;
-
-}
-/* }}} */
-
-/* {{{ proto string pg_client_encoding([resource connection])
- Get the current client encoding */
-PHP_FUNCTION(pg_client_encoding)
-{
- zval **pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_link)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- /* Just do the same as found in PostgreSQL sources... */
-
-#ifndef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
-#define pg_encoding_to_char(x) "SQL_ASCII"
-#endif
-
- Z_STRVAL_P(return_value)
- = (char *) pg_encoding_to_char(PQclientEncoding(pgsql));
- Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
- Z_STRVAL_P(return_value) = (char *) estrdup(Z_STRVAL_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
-}
-/* }}} */
-#endif
-
-
-#define COPYBUFSIZ 8192
-
-/* {{{ proto bool pg_end_copy([resource connection])
- Sync with backend. Completes the Copy command */
-PHP_FUNCTION(pg_end_copy)
-{
- zval **pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
- int result = 0;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_link)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- result = PQendcopy(pgsql);
-
- if (result!=0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Query failed: %s.", PQerrorMessage(pgsql));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto bool pg_put_line([resource connection,] string query)
- Send null-terminated string to backend server*/
-PHP_FUNCTION(pg_put_line)
-{
- zval **query, **pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
- int result = 0;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &query)==FAILURE) {
- RETURN_FALSE;
- }
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &pgsql_link, &query)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- convert_to_string_ex(query);
- result = PQputline(pgsql, Z_STRVAL_PP(query));
-
- if (result==EOF) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Query failed: %s.", PQerrorMessage(pgsql));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array pg_copy_to(resource connection, string table_name [, string delimiter [, string null_as]])
- Copy table to array */
-PHP_FUNCTION(pg_copy_to)
-{
- zval *pgsql_link;
- char *table_name, *pg_delim = NULL, *pg_null_as = NULL;
- int table_name_len, pg_delim_len, pg_null_as_len;
- char *query;
- char *query_template = "COPY \"\" TO STDOUT DELIMITERS ':' WITH NULL AS ''";
- int id = -1;
- PGconn *pgsql;
- PGresult *pgsql_result;
- ExecStatusType status;
- int copydone = 0;
- char copybuf[COPYBUFSIZ];
- char *csv = (char *)NULL;
- int ret;
- int argc = ZEND_NUM_ARGS();
-
- if (zend_parse_parameters(argc TSRMLS_CC, "rs|ss",
- &pgsql_link, &table_name, &table_name_len,
- &pg_delim, &pg_delim_len, &pg_null_as, &pg_null_as_len) == FAILURE) {
- return;
- }
- if (!pg_delim) {
- pg_delim = "\t";
- }
- if (!pg_null_as) {
- pg_null_as = safe_estrdup("\\\\N");
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- query = (char *)emalloc(strlen(query_template) + strlen(table_name) + strlen(pg_null_as) + 1);
- sprintf(query, "COPY \"%s\" TO STDOUT DELIMITERS '%s' WITH NULL AS '%s'",
- table_name, pg_delim, pg_null_as);
-
- while ((pgsql_result = PQgetResult(pgsql))) {
- PQclear(pgsql_result);
- }
- pgsql_result = PQexec(pgsql, query);
- efree(pg_null_as);
- efree(query);
-
- if (pgsql_result) {
- status = PQresultStatus(pgsql_result);
- } else {
- status = (ExecStatusType) PQstatus(pgsql);
- }
-
- switch (status) {
- case PGRES_COPY_OUT:
- if (pgsql_result) {
- PQclear(pgsql_result);
- array_init(return_value);
- while (!copydone)
- {
- if ((ret = PQgetline(pgsql, copybuf, COPYBUFSIZ))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "getline failed: %s.", PQerrorMessage(pgsql));
- RETURN_FALSE;
- }
-
- if (copybuf[0] == '\\' &&
- copybuf[1] == '.' &&
- copybuf[2] == '\0')
- {
- copydone = 1;
- }
- else
- {
- if (csv == (char *)NULL) {
- csv = estrdup(copybuf);
- } else {
- csv = (char *)erealloc(csv, strlen(csv) + sizeof(char)*(COPYBUFSIZ+1));
- strcat(csv, copybuf);
- }
-
- switch (ret)
- {
- case EOF:
- copydone = 1;
- case 0:
- add_next_index_string(return_value, csv, 1);
- efree(csv);
- csv = (char *)NULL;
- break;
- case 1:
- break;
- }
- }
- }
- if (PQendcopy(pgsql)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "endcopy failed: %s.", PQerrorMessage(pgsql));
- RETURN_FALSE;
- }
- while ((pgsql_result = PQgetResult(pgsql))) {
- PQclear(pgsql_result);
- }
- } else {
- PQclear(pgsql_result);
- RETURN_FALSE;
- }
- break;
- default:
- PQclear(pgsql_result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Copy command failed: %s.", PQerrorMessage(pgsql));
- RETURN_FALSE;
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto bool pg_copy_from(resource connection, string table_name , array rows [, string delimiter [, string null_as]])
- Copy table from array */
-PHP_FUNCTION(pg_copy_from)
-{
- zval *pgsql_link = NULL, *pg_rows;
- zval **tmp;
- char *table_name, *pg_delim = NULL, *pg_null_as = NULL;
- int table_name_len, pg_delim_len, pg_null_as_len;
- char *query;
- char *query_template = "COPY \"\" FROM STDIN DELIMITERS ':' WITH NULL AS ''";
- HashPosition pos;
- int id = -1;
- PGconn *pgsql;
- PGresult *pgsql_result;
- ExecStatusType status;
- int argc = ZEND_NUM_ARGS();
-
- if (zend_parse_parameters(argc TSRMLS_CC, "rs/a|ss",
- &pgsql_link, &table_name, &table_name_len, &pg_rows,
- &pg_delim, &pg_delim_len, &pg_null_as, &pg_null_as_len) == FAILURE) {
- return;
- }
- if (!pg_delim) {
- pg_delim = "\t";
- }
- if (!pg_null_as) {
- pg_null_as = safe_estrdup("\\\\N");
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- query = (char *)emalloc(strlen(query_template) + strlen(table_name) + strlen(pg_null_as) + 1);
- sprintf(query, "COPY \"%s\" FROM STDIN DELIMITERS '%s' WITH NULL AS '%s'",
- table_name, pg_delim, pg_null_as);
- while ((pgsql_result = PQgetResult(pgsql))) {
- PQclear(pgsql_result);
- }
- pgsql_result = PQexec(pgsql, query);
-
- efree(pg_null_as);
- efree(query);
-
- if (pgsql_result) {
- status = PQresultStatus(pgsql_result);
- } else {
- status = (ExecStatusType) PQstatus(pgsql);
- }
-
- switch (status) {
- case PGRES_COPY_IN:
- if (pgsql_result) {
- PQclear(pgsql_result);
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(pg_rows), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_P(pg_rows), (void **) &tmp, &pos) == SUCCESS) {
- convert_to_string_ex(tmp);
- query = (char *)emalloc(Z_STRLEN_PP(tmp) +2);
- strcpy(query, Z_STRVAL_PP(tmp));
- if(*(query+Z_STRLEN_PP(tmp)-1) != '\n')
- strcat(query, "\n");
- if (PQputline(pgsql, query)) {
- efree(query);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "copy failed: %s.", PQerrorMessage(pgsql));
- RETURN_FALSE;
- }
- efree(query);
- zend_hash_move_forward_ex(Z_ARRVAL_P(pg_rows), &pos);
- }
- if (PQputline(pgsql, "\\.\n") == EOF) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "putline failed: %s.", PQerrorMessage(pgsql));
- RETURN_FALSE;
- }
- if (PQendcopy(pgsql)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "endcopy failed: %s.", PQerrorMessage(pgsql));
- RETURN_FALSE;
- }
- while ((pgsql_result = PQgetResult(pgsql))) {
- PQclear(pgsql_result);
- }
- } else {
- PQclear(pgsql_result);
- RETURN_FALSE;
- }
- RETURN_TRUE;
- break;
- default:
- PQclear(pgsql_result);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Copy command failed: %s.", PQerrorMessage(pgsql));
- RETURN_FALSE;
- break;
- }
-}
-/* }}} */
-
-#ifdef HAVE_PQESCAPE
-/* {{{ proto string pg_escape_string(string data)
- Escape string for text/char type */
-PHP_FUNCTION(pg_escape_string)
-{
- char *from = NULL, *to = NULL;
- int to_len;
- int from_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
- &from, &from_len) == FAILURE) {
- return;
- }
-
- to = (char *)safe_emalloc(from_len, 2, 1);
- to_len = (int)PQescapeString(to, from, from_len);
- RETURN_STRINGL(to, to_len, 0);
-}
-/* }}} */
-
-/* {{{ proto string pg_escape_bytea(string data)
- Escape binary for bytea type */
-PHP_FUNCTION(pg_escape_bytea)
-{
- char *from = NULL, *to = NULL;
- size_t to_len;
- int from_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
- &from, &from_len) == FAILURE) {
- return;
- }
-
- to = (char *)PQescapeBytea((unsigned char*)from, from_len, &to_len);
- RETVAL_STRINGL(to, to_len-1, 1); /* to_len includes addtional '\0' */
- free(to);
-}
-/* }}} */
-
-/* PQunescapeBytea() from PostgreSQL 7.3 to provide bytea unescape feature to 7.2 users.
- Renamed to php_pgsql_unescape_bytea() */
-/*
- * PQunescapeBytea - converts the null terminated string representation
- * of a bytea, strtext, into binary, filling a buffer. It returns a
- * pointer to the buffer which is NULL on error, and the size of the
- * buffer in retbuflen. The pointer may subsequently be used as an
- * argument to the function free(3). It is the reverse of PQescapeBytea.
- *
- * The following transformations are reversed:
- * '\0' == ASCII 0 == \000
- * '\'' == ASCII 39 == \'
- * '\\' == ASCII 92 == \\
- *
- * States:
- * 0 normal 0->1->2->3->4
- * 1 \ 1->5
- * 2 \0 1->6
- * 3 \00
- * 4 \000
- * 5 \'
- * 6 \\
- */
-static unsigned char * php_pgsql_unescape_bytea(unsigned char *strtext, size_t *retbuflen)
-{
- size_t buflen;
- unsigned char *buffer,
- *sp,
- *bp;
- unsigned int state = 0;
-
- if (strtext == NULL)
- return NULL;
- buflen = strlen(strtext); /* will shrink, also we discover if
- * strtext */
- buffer = (unsigned char *) emalloc(buflen); /* isn't NULL terminated */
- for (bp = buffer, sp = strtext; *sp != '\0'; bp++, sp++)
- {
- switch (state)
- {
- case 0:
- if (*sp == '\\')
- state = 1;
- *bp = *sp;
- break;
- case 1:
- if (*sp == '\'') /* state=5 */
- { /* replace \' with 39 */
- bp--;
- *bp = '\'';
- buflen--;
- state = 0;
- }
- else if (*sp == '\\') /* state=6 */
- { /* replace \\ with 92 */
- bp--;
- *bp = '\\';
- buflen--;
- state = 0;
- }
- else
- {
- if (isdigit(*sp))
- state = 2;
- else
- state = 0;
- *bp = *sp;
- }
- break;
- case 2:
- if (isdigit(*sp))
- state = 3;
- else
- state = 0;
- *bp = *sp;
- break;
- case 3:
- if (isdigit(*sp)) /* state=4 */
- {
- unsigned char *start, *end, buf[4]; /* 000 + '\0' */
-
- bp -= 3;
- memcpy(buf, sp-2, 3);
- buf[3] = '\0';
- start = buf;
- *bp = (unsigned char)strtoul(start, (char **)&end, 8);
- buflen -= 3;
- state = 0;
- }
- else
- {
- *bp = *sp;
- state = 0;
- }
- break;
- }
- }
- buffer = erealloc(buffer, buflen+1);
- buffer[buflen] = '\0';
-
- *retbuflen = buflen;
- return buffer;
-}
-
-/* {{{ proto string pg_unescape_bytea(string data)
- Unescape binary for bytea type */
-PHP_FUNCTION(pg_unescape_bytea)
-{
- char *from = NULL, *to = NULL;
- size_t to_len;
- int from_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
- &from, &from_len) == FAILURE) {
- return;
- }
-
- to = (char *)php_pgsql_unescape_bytea((unsigned char*)from, &to_len);
- if (!to) {
- RETURN_FALSE;
- }
- RETVAL_STRINGL(to, to_len, 0);
-}
-/* }}} */
-#endif
-
-/* {{{ proto string pg_result_error(resource result)
- Get error message associated with result */
-PHP_FUNCTION(pg_result_error)
-{
- zval *result;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
- char *err = NULL;
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r",
- &result) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, "PostgreSQL result", le_result);
-
- pgsql_result = pg_result->result;
- if (!pgsql_result) {
- RETURN_FALSE;
- }
- err = (char *)PQresultErrorMessage(pgsql_result);
- RETURN_STRING(err,1);
-}
-/* }}} */
-
-/* {{{ proto int pg_connection_status(resource connnection)
- Get connection status */
-PHP_FUNCTION(pg_connection_status)
-{
- zval *pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r",
- &pgsql_link) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- RETURN_LONG(PQstatus(pgsql));
-}
-
-/* }}} */
-
-/* {{{ proto bool pg_connection_reset(resource connection)
- Reset connection (reconnect) */
-PHP_FUNCTION(pg_connection_reset)
-{
- zval *pgsql_link;
- int id = -1;
- PGconn *pgsql;
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r",
- &pgsql_link) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- PQreset(pgsql);
- if (PQstatus(pgsql) == CONNECTION_BAD) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-/* }}} */
-
-#define PHP_PG_ASYNC_IS_BUSY 1
-#define PHP_PG_ASYNC_REQUEST_CANCEL 2
-
-/* {{{ php_pgsql_flush_query
- */
-static int php_pgsql_flush_query(PGconn *pgsql TSRMLS_DC)
-{
- PGresult *res;
- int leftover = 0;
-
- if (PQ_SETNONBLOCKING(pgsql, 1)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE,"Cannot set connection to nonblocking mode.");
- return -1;
- }
- while ((res = PQgetResult(pgsql))) {
- PQclear(res);
- leftover++;
- }
- PQ_SETNONBLOCKING(pgsql, 0);
- return leftover;
-}
-/* }}} */
-
-/* {{{ php_pgsql_do_async
- */
-static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
-{
- zval *pgsql_link;
- int id = -1;
- PGconn *pgsql;
- PGresult *pgsql_result;
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r",
- &pgsql_link) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- if (PQ_SETNONBLOCKING(pgsql, 1)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to nonblocking mode.");
- RETURN_FALSE;
- }
- switch(entry_type) {
- case PHP_PG_ASYNC_IS_BUSY:
- PQconsumeInput(pgsql);
- Z_LVAL_P(return_value) = PQisBusy(pgsql);
- Z_TYPE_P(return_value) = IS_LONG;
- break;
- case PHP_PG_ASYNC_REQUEST_CANCEL:
- Z_LVAL_P(return_value) = PQrequestCancel(pgsql);
- Z_TYPE_P(return_value) = IS_LONG;
- while ((pgsql_result = PQgetResult(pgsql))) {
- PQclear(pgsql_result);
- }
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "PostgreSQL module error, please report this error.");
- break;
- }
- if (PQ_SETNONBLOCKING(pgsql, 0)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode.");
- }
- convert_to_boolean_ex(&return_value);
-}
-/* }}} */
-
-/* {{{ proto bool pg_cancel_query(resource connection)
- Cancel request */
-PHP_FUNCTION(pg_cancel_query)
-{
- php_pgsql_do_async(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_PG_ASYNC_REQUEST_CANCEL);
-}
-/* }}} */
-
-/* {{{ proto bool pg_connection_busy(resource connection)
- Get connection is busy or not */
-PHP_FUNCTION(pg_connection_busy)
-{
- php_pgsql_do_async(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_PG_ASYNC_IS_BUSY);
-}
-/* }}} */
-
-/* {{{ proto bool pg_send_query(resource connection, string qeury)
- Send asynchronous query */
-PHP_FUNCTION(pg_send_query)
-{
- zval *pgsql_link;
- char *query;
- int len;
- int id = -1;
- PGconn *pgsql;
- PGresult *res;
- int leftover = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs",
- &pgsql_link, &query, &len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- if (PQ_SETNONBLOCKING(pgsql, 1)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to nonblocking mode.");
- RETURN_FALSE;
- }
- while ((res = PQgetResult(pgsql))) {
- PQclear(res);
- leftover = 1;
- }
- if (leftover) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "There are results on this connection. Call pg_get_result() until it returns FALSE.");
- }
- if (!PQsendQuery(pgsql, query)) {
- if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) {
- PQreset(pgsql);
- }
- if (!PQsendQuery(pgsql, query)) {
- RETURN_FALSE;
- }
- }
- if (PQ_SETNONBLOCKING(pgsql, 0)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode.");
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto resource pg_get_result(resource connection)
- Get asynchronous query result */
-PHP_FUNCTION(pg_get_result)
-{
- zval *pgsql_link;
- int id = -1;
- PGconn *pgsql;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r",
- &pgsql_link) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- pgsql_result = PQgetResult(pgsql);
- if (!pgsql_result) {
- /* no result */
- RETURN_FALSE;
- }
- pg_result = (pgsql_result_handle *) emalloc(sizeof(pgsql_result_handle));
- pg_result->conn = pgsql;
- pg_result->result = pgsql_result;
- pg_result->row = 0;
- ZEND_REGISTER_RESOURCE(return_value, pg_result, le_result);
-}
-/* }}} */
-
-/* {{{ proto int pg_result_status(resource result[, long result_type])
- Get status of query result */
-PHP_FUNCTION(pg_result_status)
-{
- zval *result;
- long result_type = PGSQL_STATUS_LONG;
- ExecStatusType status;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l",
- &result, &result_type) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, "PostgreSQL result", le_result);
-
- pgsql_result = pg_result->result;
- if (result_type == PGSQL_STATUS_LONG) {
- status = PQresultStatus(pgsql_result);
- RETURN_LONG((int)status);
- }
- else if (result_type == PGSQL_STATUS_STRING) {
- RETURN_STRING(PQcmdStatus(pgsql_result), 1);
- }
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Optional 2nd parameter should be PGSQL_STATUS_LONG or PGSQL_STATUS_STRING.");
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto resource pg_get_notify([resource connection[, result_type]])
- Get asynchronous notification */
-PHP_FUNCTION(pg_get_notify)
-{
- zval *pgsql_link;
- int id = -1, result_type = PGSQL_ASSOC;
- PGconn *pgsql;
- PGnotify *pgsql_notify;
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l",
- &pgsql_link) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- PQconsumeInput(pgsql);
- pgsql_notify = PQnotifies(pgsql);
- if (!pgsql_notify) {
- /* no notify message */
- RETURN_FALSE;
- }
- array_init(return_value);
- if (result_type & (PGSQL_NUM|PGSQL_BOTH)) {
- add_index_string(return_value, 0, pgsql_notify->relname, 1);
- add_index_long(return_value, 1, pgsql_notify->be_pid);
- }
- if (result_type & (PGSQL_ASSOC|PGSQL_BOTH)) {
- add_assoc_string(return_value, "message", pgsql_notify->relname, 1);
- add_assoc_long(return_value, "pid", pgsql_notify->be_pid);
- }
-}
-/* }}} */
-
-/* {{{ proto resource pg_get_pid([resource connection)
- Get backend(server) pid */
-PHP_FUNCTION(pg_get_pid)
-{
- zval *pgsql_link;
- int id = -1;
- PGconn *pgsql;
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r",
- &pgsql_link) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- RETURN_LONG(PQbackendPID(pgsql));
-}
-/* }}} */
-
-/* {{{ php_pgsql_meta_data
- * TODO: Add meta_data cache for better performance
- */
-PHPAPI int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta TSRMLS_DC)
-{
- PGresult *pg_result;
- char *tmp_name;
- smart_str querystr = {0};
- int new_len;
- int i, num_rows;
- zval *elem;
-
- smart_str_appends(&querystr,
- "SELECT a.attname, a.attnum, t.typname, a.attlen, a.attnotNULL, a.atthasdef "
- "FROM pg_class as c, pg_attribute a, pg_type t "
- "WHERE a.attnum > 0 AND a.attrelid = c.oid AND c.relname = '");
-
- tmp_name = php_addslashes((char *)table_name, strlen(table_name), &new_len, 0 TSRMLS_CC);
- smart_str_appendl(&querystr, tmp_name, new_len);
- efree(tmp_name);
-
- smart_str_appends(&querystr, "' AND a.atttypid = t.oid ORDER BY a.attnum;");
- smart_str_0(&querystr);
-
- pg_result = PQexec(pg_link, querystr.c);
- if (PQresultStatus(pg_result) != PGRES_TUPLES_OK || (num_rows = PQntuples(pg_result)) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Failed to query meta_data for '%s' table %s.", table_name, querystr.c);
- smart_str_free(&querystr);
- PQclear(pg_result);
- return FAILURE;
- }
- smart_str_free(&querystr);
-
- for (i = 0; i < num_rows; i++) {
- char *name;
- MAKE_STD_ZVAL(elem);
- array_init(elem);
- add_assoc_long(elem, "num", atoi(PQgetvalue(pg_result,i,1)));
- add_assoc_string(elem, "type", PQgetvalue(pg_result,i,2), 1);
- add_assoc_long(elem, "len", atoi(PQgetvalue(pg_result,i,3)));
- if (!strcmp(PQgetvalue(pg_result,i,4), "t")) {
- add_assoc_bool(elem, "not null", 1);
- }
- else {
- add_assoc_bool(elem, "not null", 0);
- }
- if (!strcmp(PQgetvalue(pg_result,i,5), "t")) {
- add_assoc_bool(elem, "has default", 1);
- }
- else {
- add_assoc_bool(elem, "has default", 0);
- }
- name = PQgetvalue(pg_result,i,0);
- add_assoc_zval(meta, name, elem);
- }
-
- return SUCCESS;
-}
-
-/* }}} */
-
-
-/* {{{ proto array pg_meta_data(resource db, string table)
- Get meta_data */
-PHP_FUNCTION(pg_meta_data)
-{
- zval *pgsql_link;
- char *table_name;
- uint table_name_len;
- PGconn *pgsql;
- int id = -1;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs",
- &pgsql_link, &table_name, &table_name_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- array_init(return_value);
- if (php_pgsql_meta_data(pgsql, table_name, return_value TSRMLS_CC) == FAILURE) {
- zval_dtor(return_value); /* destroy array */
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_pgsql_get_data_type
- */
-static php_pgsql_data_type php_pgsql_get_data_type(const char *type_name, size_t len)
-{
- /* This is stupid way to do. I'll fix it when I decied how to support
- user defined types. (Yasuo) */
-
- /* boolean */
- if (!strcmp(type_name, "bool")|| !strcmp(type_name, "boolean"))
- return PG_BOOL;
- /* object id */
- if (!strcmp(type_name, "oid"))
- return PG_OID;
- /* integer */
- if (!strcmp(type_name, "int2") || !strcmp(type_name, "smallint"))
- return PG_INT2;
- if (!strcmp(type_name, "int4") || !strcmp(type_name, "integer"))
- return PG_INT4;
- if (!strcmp(type_name, "int8") || !strcmp(type_name, "bigint"))
- return PG_INT8;
- /* real and other */
- if (!strcmp(type_name, "float4") || !strcmp(type_name, "real"))
- return PG_FLOAT4;
- if (!strcmp(type_name, "float8") || !strcmp(type_name, "double precision"))
- return PG_FLOAT8;
- if (!strcmp(type_name, "numeric"))
- return PG_NUMERIC;
- if (!strcmp(type_name, "money"))
- return PG_MONEY;
- /* character */
- if (!strcmp(type_name, "text"))
- return PG_TEXT;
- if (!strcmp(type_name, "bpchar") || !strcmp(type_name, "character"))
- return PG_CHAR;
- if (!strcmp(type_name, "varchar") || !strcmp(type_name, "character varying"))
- return PG_VARCHAR;
- /* time and interval */
- if (!strcmp(type_name, "abstime"))
- return PG_UNIX_TIME;
- if (!strcmp(type_name, "reltime"))
- return PG_UNIX_TIME_INTERVAL;
- if (!strcmp(type_name, "tinterval"))
- return PG_UNIX_TIME_INTERVAL;
- if (!strcmp(type_name, "date"))
- return PG_DATE;
- if (!strcmp(type_name, "time"))
- return PG_TIME;
- if (!strcmp(type_name, "time with time zone") || !strcmp(type_name, "timetz"))
- return PG_TIME_WITH_TIMEZONE;
- if (!strcmp(type_name, "timestamp without time zone") || !strcmp(type_name, "timestamp"))
- return PG_TIMESTAMP;
- if (!strcmp(type_name, "timestamp with time zone") || !strcmp(type_name, "timestamptz"))
- return PG_TIMESTAMP_WITH_TIMEZONE;
- if (!strcmp(type_name, "interval"))
- return PG_INTERVAL;
- /* binary */
- if (!strcmp(type_name, "bytea"))
- return PG_BYTEA;
- /* network */
- if (!strcmp(type_name, "cidr"))
- return PG_CIDR;
- if (!strcmp(type_name, "inet"))
- return PG_INET;
- if (!strcmp(type_name, "macaddr"))
- return PG_MACADDR;
- /* bit */
- if (!strcmp(type_name, "bit"))
- return PG_BIT;
- if (!strcmp(type_name, "bit varying"))
- return PG_VARBIT;
- /* geometric */
- if (!strcmp(type_name, "line"))
- return PG_LINE;
- if (!strcmp(type_name, "lseg"))
- return PG_LSEG;
- if (!strcmp(type_name, "box"))
- return PG_BOX;
- if (!strcmp(type_name, "path"))
- return PG_PATH;
- if (!strcmp(type_name, "point"))
- return PG_POINT;
- if (!strcmp(type_name, "polygon"))
- return PG_POLYGON;
- if (!strcmp(type_name, "circle"))
- return PG_CIRCLE;
-
- return PG_UNKNOWN;
-}
-/* }}} */
-
-/* {{{ php_pgsql_convert_match
- * test field value with regular expression specified.
- */
-static int php_pgsql_convert_match(const char *str, const char *regex , int icase TSRMLS_DC)
-{
- regex_t re;
- regmatch_t *subs;
- int regopt = REG_EXTENDED;
- int regerr, ret = SUCCESS;
-
- if (icase) {
- regopt |= REG_ICASE;
- }
-
- regerr = regcomp(&re, regex, regopt);
- if (regerr) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot compile regex.");
- regfree(&re);
- return FAILURE;
- }
- subs = (regmatch_t *)ecalloc(sizeof(regmatch_t), re.re_nsub+1);
-
- regerr = regexec(&re, str, re.re_nsub+1, subs, 0);
- if (regerr == REG_NOMATCH) {
-#ifdef PHP_DEBUG
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "'%s' does not match with '%s'.", str, regex);
-#endif
- ret = FAILURE;
- }
- else if (regerr) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot exec regex.");
- ret = FAILURE;
- }
- regfree(&re);
- efree(subs);
- return ret;
-}
-
-/* }}} */
-
-/* {{{ php_pgsql_add_quote
- * add quotes around string.
- */
-static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC)
-{
- smart_str str = {0};
-
- assert(Z_TYPE_P(src) == IS_STRING);
- assert(should_free == 1 || should_free == 0);
-
- smart_str_appendc(&str, '\'');
- smart_str_appendl(&str, Z_STRVAL_P(src), Z_STRLEN_P(src));
- smart_str_appendc(&str, '\'');
- smart_str_0(&str);
-
- if (should_free) {
- efree(Z_STRVAL_P(src));
- }
- Z_STRVAL_P(src) = str.c;
- Z_STRLEN_P(src) = str.len;
-
- return SUCCESS;
-}
-/* }}} */
-
-#define PGSQL_CONV_CHECK_IGNORE() \
- if (!err && Z_TYPE_P(new_val) == IS_STRING && !strcmp(Z_STRVAL_P(new_val), "NULL")) { \
- /* if new_value is string "NULL" and field has default value, remove element to use default value */ \
- if (!(opt & PGSQL_CONV_IGNORE_DEFAULT) && Z_BVAL_PP(has_default)) { \
- zval_dtor(new_val); \
- FREE_ZVAL(new_val); \
- skip_field = 1; \
- } \
- /* raise error if it's not null and cannot be ignored */ \
- else if (!(opt & PGSQL_CONV_IGNORE_NOT_NULL) && Z_BVAL_PP(not_null)) { \
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected NULL for 'NOT NULL' field '%s'.", field ); \
- err = 1; \
- } \
- }
-
-/* {{{ php_pgsql_convert
- * check and convert array values (fieldname=>vlaue pair) for sql
- */
-PHPAPI int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, ulong opt TSRMLS_DC)
-{
- HashPosition pos;
- char *field = NULL;
- uint field_len = -1;
- ulong num_idx = -1;
- zval *meta, **def, **type, **not_null, **has_default, **val, *new_val;
- int new_len, key_type, err = 0, skip_field;
-
- assert(pg_link != NULL);
- assert(Z_TYPE_P(values) == IS_ARRAY);
- assert(Z_TYPE_P(result) == IS_ARRAY);
- assert(!(opt & ~PGSQL_CONV_OPTS));
-
- if (!table_name) {
- return FAILURE;
- }
- MAKE_STD_ZVAL(meta);
- array_init(meta);
- if (php_pgsql_meta_data(pg_link, table_name, meta TSRMLS_CC) == FAILURE) {
- zval_dtor(meta);
- FREE_ZVAL(meta);
- return FAILURE;
- }
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(values), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_P(values), (void **)&val, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos)) {
- skip_field = 0;
-
- if ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &field, &field_len, &num_idx, 0, &pos)) == HASH_KEY_NON_EXISTANT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to get array key type.");
- err = 1;
- }
- if (!err && key_type == HASH_KEY_IS_LONG) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Accepts only string key for values.");
- err = 1;
- }
- if (!err && key_type == HASH_KEY_NON_EXISTANT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Accepts only string key for values.");
- err = 1;
- }
- if (!err && zend_hash_find(Z_ARRVAL_P(meta), field, field_len, (void **)&def) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid field name (%s) in values.", field);
- err = 1;
- }
- if (!err && zend_hash_find(Z_ARRVAL_PP(def), "type", sizeof("type"), (void **)&type) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected broken meta data. Missing 'type'.");
- err = 1;
- }
- if (!err && zend_hash_find(Z_ARRVAL_PP(def), "not null", sizeof("not null"), (void **)&not_null) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected broken meta data. Missing 'not null'.");
- err = 1;
- }
- if (!err && zend_hash_find(Z_ARRVAL_PP(def), "has default", sizeof("has default"), (void **)&has_default) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected broken meta data. Missing 'has default'.");
- err = 1;
- }
- if (!err && (Z_TYPE_PP(val) == IS_ARRAY ||
- Z_TYPE_PP(val) == IS_OBJECT ||
- Z_TYPE_PP(val) == IS_CONSTANT_ARRAY)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects scaler values as field values.");
- err = 1;
- }
- if (err) {
- break; /* break out for() */
- }
- MAKE_STD_ZVAL(new_val);
- switch(php_pgsql_get_data_type(Z_STRVAL_PP(type), Z_STRLEN_PP(type)))
- {
- case PG_BOOL:
- switch (Z_TYPE_PP(val)) {
- case IS_STRING:
- if (Z_STRLEN_PP(val) == 0) {
- ZVAL_STRING(new_val, "NULL", 1);
- }
- else {
- if (!strcmp(Z_STRVAL_PP(val), "t") || !strcmp(Z_STRVAL_PP(val), "T") ||
- !strcmp(Z_STRVAL_PP(val), "y") || !strcmp(Z_STRVAL_PP(val), "Y") ||
- !strcmp(Z_STRVAL_PP(val), "true") || !strcmp(Z_STRVAL_PP(val), "True") ||
- !strcmp(Z_STRVAL_PP(val), "yes") || !strcmp(Z_STRVAL_PP(val), "Yes") ||
- !strcmp(Z_STRVAL_PP(val), "1")) {
- ZVAL_STRING(new_val, "'t'", 1);
- }
- else if (!strcmp(Z_STRVAL_PP(val), "f") || !strcmp(Z_STRVAL_PP(val), "F") ||
- !strcmp(Z_STRVAL_PP(val), "n") || !strcmp(Z_STRVAL_PP(val), "N") ||
- !strcmp(Z_STRVAL_PP(val), "false") || !strcmp(Z_STRVAL_PP(val), "False") ||
- !strcmp(Z_STRVAL_PP(val), "no") || !strcmp(Z_STRVAL_PP(val), "No") ||
- !strcmp(Z_STRVAL_PP(val), "0")) {
- ZVAL_STRING(new_val, "'f'", 1);
- }
- else {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected invalid value (%s) for PostgreSQL %s field (%s).", Z_STRVAL_PP(val), Z_STRVAL_PP(type), field);
- err = 1;
- }
- }
- break;
-
- case IS_LONG:
- case IS_BOOL:
- if (Z_LVAL_PP(val)) {
- ZVAL_STRING(new_val, "'t'", 1);
- }
- else {
- ZVAL_STRING(new_val, "'f'", 1);
- }
- break;
-
- case IS_NULL:
- ZVAL_STRING(new_val, "NULL", 1);
- break;
-
- default:
- err = 1;
- }
- PGSQL_CONV_CHECK_IGNORE();
- if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects string, null, long or boolelan value for PostgreSQL '%s' (%s).", Z_STRVAL_PP(type), field);
- }
- break;
-
- case PG_OID:
- case PG_INT2:
- case PG_INT4:
- case PG_INT8:
- switch (Z_TYPE_PP(val)) {
- case IS_STRING:
- if (Z_STRLEN_PP(val) == 0) {
- ZVAL_STRING(new_val, "NULL", 1);
- }
- else {
- /* FIXME: better regex must be used */
- if (php_pgsql_convert_match(Z_STRVAL_PP(val), "^([+-]{0,1}[0-9]+)$", 0 TSRMLS_CC) == FAILURE) {
- err = 1;
- }
- else {
- ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
- }
- }
- break;
-
- case IS_DOUBLE:
- ZVAL_DOUBLE(new_val, Z_DVAL_PP(val));
- convert_to_long_ex(&new_val);
- break;
-
- case IS_LONG:
- ZVAL_LONG(new_val, Z_LVAL_PP(val));
- break;
-
- case IS_NULL:
- ZVAL_STRING(new_val, "NULL", 1);
- break;
-
- default:
- err = 1;
- }
- PGSQL_CONV_CHECK_IGNORE();
- if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL, string, long or double value for pgsql '%s' (%s).", Z_STRVAL_PP(type), field);
- }
- break;
-
- case PG_NUMERIC:
- case PG_MONEY:
- case PG_FLOAT4:
- case PG_FLOAT8:
- switch (Z_TYPE_PP(val)) {
- case IS_STRING:
- if (Z_STRLEN_PP(val) == 0) {
- ZVAL_STRING(new_val, "NULL", 1);
- }
- else {
- /* FIXME: better regex must be used */
- if (php_pgsql_convert_match(Z_STRVAL_PP(val), "^([+-]{0,1}[0-9]+)|([+-]{0,1}[0-9]*[\\.][0-9]+)|([+-]{0,1}[0-9]+[\\.][0-9]*)$", 0 TSRMLS_CC) == FAILURE) {
- err = 1;
- }
- else {
- ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
- }
- }
- break;
-
- case IS_LONG:
- ZVAL_LONG(new_val, Z_LVAL_PP(val));
- break;
-
- case IS_DOUBLE:
- ZVAL_DOUBLE(new_val, Z_DVAL_PP(val));
- break;
-
- case IS_NULL:
- ZVAL_STRING(new_val, "NULL", 1);
- break;
-
- default:
- err = 1;
- }
- PGSQL_CONV_CHECK_IGNORE();
- if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL, string, long or double value for PostgreSQL '%s' (%s).", Z_STRVAL_PP(type), field);
- }
- break;
-
- case PG_TEXT:
- case PG_CHAR:
- case PG_VARCHAR:
- switch (Z_TYPE_PP(val)) {
- case IS_STRING:
- if (Z_STRLEN_PP(val) == 0) {
- if (opt & PGSQL_CONV_FORCE_NULL) {
- ZVAL_STRING(new_val, "NULL", 1);
- }
- else {
- ZVAL_STRING(new_val, empty_string, 1);
- }
- }
- else {
- Z_TYPE_P(new_val) = IS_STRING;
-#if HAVE_PQESCAPE
- {
- char *tmp;
- tmp = (char *)safe_emalloc(Z_STRLEN_PP(val), 2, 1);
- Z_STRLEN_P(new_val) = (int)PQescapeString(tmp, Z_STRVAL_PP(val), Z_STRLEN_PP(val));
- Z_STRVAL_P(new_val) = tmp;
- }
-#else
- Z_STRVAL_P(new_val) = php_addslashes(Z_STRVAL_PP(val), Z_STRLEN_PP(val), &Z_STRLEN_P(new_val), 0 TSRMLS_CC);
-#endif
- }
- php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
- break;
-
- case IS_LONG:
- ZVAL_LONG(new_val, Z_LVAL_PP(val));
- convert_to_string_ex(&new_val);
- break;
-
- case IS_DOUBLE:
- ZVAL_DOUBLE(new_val, Z_DVAL_PP(val));
- convert_to_string_ex(&new_val);
- break;
-
- case IS_NULL:
- ZVAL_STRING(new_val, "NULL", 1);
- break;
-
- default:
- err = 1;
- }
- PGSQL_CONV_CHECK_IGNORE();
- if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL, string, long or double value for PostgreSQL '%s' (%s).", Z_STRVAL_PP(type), field);
- }
- break;
-
- case PG_UNIX_TIME:
- case PG_UNIX_TIME_INTERVAL:
- /* these are the actallay a integer */
- switch (Z_TYPE_PP(val)) {
- case IS_STRING:
- if (Z_STRLEN_PP(val) == 0) {
- ZVAL_STRING(new_val, "NULL", 1);
- }
- else {
- /* FIXME: Better regex must be used */
- if (php_pgsql_convert_match(Z_STRVAL_PP(val), "^[0-9]+$", 0 TSRMLS_CC) == FAILURE) {
- err = 1;
- }
- else {
- ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
- convert_to_long_ex(&new_val);
- }
- }
- break;
-
- case IS_DOUBLE:
- ZVAL_DOUBLE(new_val, Z_DVAL_PP(val));
- convert_to_long_ex(&new_val);
- break;
-
- case IS_LONG:
- ZVAL_LONG(new_val, Z_LVAL_PP(val));
- break;
-
- case IS_NULL:
- ZVAL_STRING(new_val, "NULL", 1);
- break;
-
- default:
- err = 1;
- }
- PGSQL_CONV_CHECK_IGNORE();
- if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL, string, long or double value for '%s' (%s).", Z_STRVAL_PP(type), field);
- }
- break;
-
- case PG_CIDR:
- case PG_INET:
- switch (Z_TYPE_PP(val)) {
- case IS_STRING:
- if (Z_STRLEN_PP(val) == 0) {
- ZVAL_STRING(new_val, "NULL", 1);
- }
- else {
- /* FIXME: Better regex must be used */
- if (php_pgsql_convert_match(Z_STRVAL_PP(val), "^([0-9]{1,3}\\.){3}[0-9]{1,3}(/[0-9]{1,2}){0,1}$", 0 TSRMLS_CC) == FAILURE) {
- err = 1;
- }
- else {
- ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
- php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
- }
- }
- break;
-
- case IS_NULL:
- ZVAL_STRING(new_val, "NULL", 1);
- break;
-
- default:
- err = 1;
- }
- PGSQL_CONV_CHECK_IGNORE();
- if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL or string for '%s' (%s).", Z_STRVAL_PP(type), field);
- }
- break;
-
- case PG_TIME_WITH_TIMEZONE:
- case PG_TIMESTAMP:
- case PG_TIMESTAMP_WITH_TIMEZONE:
- switch(Z_TYPE_PP(val)) {
- case IS_STRING:
- if (Z_STRLEN_PP(val) == 0) {
- ZVAL_STRING(new_val, "NULL", 1);
- }
- else {
- /* FIXME: better regex must be used */
- if (php_pgsql_convert_match(Z_STRVAL_PP(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,2}(:[0-9]{1,2}){0,1}|[a-zA-Z]{1,5})){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) {
- err = 1;
- }
- else {
- ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
- php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
- }
- }
- break;
-
- case IS_NULL:
- ZVAL_STRING(new_val, "NULL", 1);
- break;
-
- default:
- err = 1;
- }
- PGSQL_CONV_CHECK_IGNORE();
- if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s).", Z_STRVAL_PP(type), field);
- }
- break;
-
- case PG_DATE:
- switch(Z_TYPE_PP(val)) {
- case IS_STRING:
- if (Z_STRLEN_PP(val) == 0) {
- ZVAL_STRING(new_val, "NULL", 1);
- }
- else {
- /* FIXME: better regex must be used */
- if (php_pgsql_convert_match(Z_STRVAL_PP(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})$", 1 TSRMLS_CC) == FAILURE) {
- err = 1;
- }
- else {
- ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
- php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
- }
- }
- break;
-
- case IS_NULL:
- ZVAL_STRING(new_val, "NULL", 1);
- break;
-
- default:
- err = 1;
- }
- PGSQL_CONV_CHECK_IGNORE();
- if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s).", Z_STRVAL_PP(type), field);
- }
- break;
-
- case PG_TIME:
- switch(Z_TYPE_PP(val)) {
- case IS_STRING:
- if (Z_STRLEN_PP(val) == 0) {
- ZVAL_STRING(new_val, "NULL", 1);
- }
- else {
- /* FIXME: better regex must be used */
- if (php_pgsql_convert_match(Z_STRVAL_PP(val), "^(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) {
- err = 1;
- }
- else {
- ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
- php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
- }
- }
- break;
-
- case IS_NULL:
- ZVAL_STRING(new_val, "NULL", 1);
- break;
-
- default:
- err = 1;
- }
- PGSQL_CONV_CHECK_IGNORE();
- if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s).", Z_STRVAL_PP(type), field);
- }
- break;
-
- case PG_INTERVAL:
- switch(Z_TYPE_PP(val)) {
- case IS_STRING:
- if (Z_STRLEN_PP(val) == 0) {
- ZVAL_STRING(new_val, "NULL", 1);
- }
- else {
- /* FIXME: better regex must be used */
- if (php_pgsql_convert_match(Z_STRVAL_PP(val), "^[+-]{0,1}[ \\t]+((second|seconds|minute|minute|hour|hour|day|days|week|weeks|month|monthes|year|years|decade|decades|century|centuries|millennium|millenniums){1,1}[ \\t]+)+([ \\t]+ago){0,1}$", 1 TSRMLS_CC) == FAILURE &&
- php_pgsql_convert_match(Z_STRVAL_PP(val), "^@[ \\t]+[+-]{0,1}[ \\t]+(second|seconds|minute|minute|hour|hour|day|days|week|weeks|month|monthes|year|years|decade|decades|century|centuries|millennium|millenniums){1,1}[ \\t]+)+([ \\t]+ago$", 1 TSRMLS_CC) == FAILURE) {
- err = 1;
- }
- else {
- ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
- php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
- }
- }
- break;
-
- case IS_NULL:
- ZVAL_STRING(new_val, "NULL", 1);
- break;
-
- default:
- err = 1;
- }
- PGSQL_CONV_CHECK_IGNORE();
- if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s).", Z_STRVAL_PP(type), field);
- }
- break;
-#ifdef HAVE_PQESCAPE
- case PG_BYTEA:
- switch (Z_TYPE_PP(val)) {
- case IS_STRING:
- if (Z_STRLEN_PP(val) == 0) {
- ZVAL_STRING(new_val, "NULL", 1);
- }
- else {
- unsigned char *tmp;
- size_t to_len;
- tmp = PQescapeBytea(Z_STRVAL_PP(val), Z_STRLEN_PP(val), &to_len);
- Z_TYPE_P(new_val) = IS_STRING;
- Z_STRLEN_P(new_val) = to_len-1; /* PQescapeBytea's to_len includes additional '\0' */
- Z_STRVAL_P(new_val) = emalloc(to_len);
- memcpy(Z_STRVAL_P(new_val), tmp, to_len);
- free(tmp);
- php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
-
- }
- break;
-
- case IS_LONG:
- ZVAL_LONG(new_val, Z_LVAL_PP(val));
- convert_to_string_ex(&new_val);
- break;
-
- case IS_DOUBLE:
- ZVAL_DOUBLE(new_val, Z_DVAL_PP(val));
- convert_to_string_ex(&new_val);
- break;
-
- case IS_NULL:
- ZVAL_STRING(new_val, "NULL", 1);
- break;
-
- default:
- err = 1;
- }
- PGSQL_CONV_CHECK_IGNORE();
- if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL, string, long or double value for PostgreSQL '%s' (%s).", Z_STRVAL_PP(type), field);
- }
- break;
-
-#endif
- case PG_MACADDR:
- switch(Z_TYPE_PP(val)) {
- case IS_STRING:
- if (Z_STRLEN_PP(val) == 0) {
- ZVAL_STRING(new_val, "NULL", 1);
- }
- else {
- if (php_pgsql_convert_match(Z_STRVAL_PP(val), "^([0-9a-f]{2,2}:){5,5}[0-9a-f]{2,2}$", 1 TSRMLS_CC) == FAILURE) {
- err = 1;
- }
- else {
- ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
- php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
- }
- }
- break;
-
- case IS_NULL:
- ZVAL_STRING(new_val, "NULL", 1);
- break;
-
- default:
- err = 1;
- }
- PGSQL_CONV_CHECK_IGNORE();
- if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s).", Z_STRVAL_PP(type), field);
- }
- break;
-
- /* bit */
- case PG_BIT:
- case PG_VARBIT:
- /* geometric */
- case PG_LINE:
- case PG_LSEG:
- case PG_POINT:
- case PG_BOX:
- case PG_PATH:
- case PG_POLYGON:
- case PG_CIRCLE:
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "PostgreSQL '%s' type (%s) is not supported.", Z_STRVAL_PP(type), field);
- err = 1;
- break;
-
- case PG_UNKNOWN:
- default:
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown or system data type '%s' for '%s'.", Z_STRVAL_PP(type), field);
- err = 1;
- break;
- } /* switch */
-
- if (err) {
- zval_dtor(new_val);
- FREE_ZVAL(new_val);
- break; /* break out for() */
- }
- if (!skip_field) {
- /* If field is NULL and HAS DEFAULT, should be skipped */
- field = php_addslashes(field, strlen(field), &new_len, 0 TSRMLS_CC);
- add_assoc_zval(result, field, new_val);
- efree(field);
- }
- } /* for */
- zval_dtor(meta);
- FREE_ZVAL(meta);
-
- if (err) {
- /* shouldn't destroy & free zval here */
- return FAILURE;
- }
- return SUCCESS;
-}
-/* }}} */
-
-
-/* {{{ proto array pg_convert(resource db, string table, array values[, int options])
- Check and convert values for PostgreSQL SQL statement */
-PHP_FUNCTION(pg_convert)
-{
- zval *pgsql_link, *values;
- char *table_name;
- int table_name_len;
- ulong option = 0;
- PGconn *pg_link;
- int id = -1;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
- "rsa|l", &pgsql_link, &table_name, &table_name_len, &values, &option) == FAILURE) {
- return;
- }
- if (option & ~PGSQL_CONV_OPTS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid option is specified.");
- RETURN_FALSE;
- }
- if (!table_name_len) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Table name is invalid.");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pg_link, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- if (php_pgsql_flush_query(pg_link TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected unhandled result(s) in connection.");
- }
- array_init(return_value);
- if (php_pgsql_convert(pg_link, table_name, values, return_value, option TSRMLS_CC) == FAILURE) {
- zval_dtor(return_value);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, ulong opt TSRMLS_DC)
-{
- if (opt & PGSQL_DML_ASYNC) {
- if (PQsendQuery(pg_link, querystr->c)) {
- return 0;
- }
- }
- else {
- PGresult *pg_result;
-
- pg_result = PQexec(pg_link, querystr->c);
- if (PQresultStatus(pg_result) == expect) {
- return 0;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Failed to execute '%s'.", querystr->c);
- PQclear(pg_result);
- }
- }
-
- return -1;
-}
-
-/* {{{ php_pgsql_insert
- */
-PHPAPI int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, ulong opt, char **sql TSRMLS_DC)
-{
- zval **val, *converted = NULL;
- char buf[256];
- char *fld;
- smart_str querystr = {0};
- int key_type, ret = FAILURE;
- uint fld_len;
- ulong num_idx;
- HashPosition pos;
-
- assert(pg_link != NULL);
- assert(table != NULL);
- assert(Z_TYPE_P(var_array) == IS_ARRAY);
-
- if (zend_hash_num_elements(Z_ARRVAL_P(var_array)) == 0) {
- return FAILURE;
- }
-
- /* convert input array if needed */
- if (!(opt & PGSQL_DML_NO_CONV)) {
- MAKE_STD_ZVAL(converted);
- array_init(converted);
- if (php_pgsql_convert(pg_link, table, var_array, converted, (opt & PGSQL_CONV_OPTS) TSRMLS_CC) == FAILURE) {
- goto cleanup;
- }
- var_array = converted;
- }
-
- smart_str_appends(&querystr, "INSERT INTO ");
- smart_str_appends(&querystr, table);
- smart_str_appends(&querystr, " (");
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(var_array), &pos);
- while ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(var_array), &fld,
- &fld_len, &num_idx, 0, &pos)) != HASH_KEY_NON_EXISTANT) {
- if (key_type == HASH_KEY_IS_LONG) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects associative array for values to be inserted.");
- goto cleanup;
- }
- smart_str_appendl(&querystr, fld, fld_len - 1);
- smart_str_appendc(&querystr, ',');
- zend_hash_move_forward_ex(Z_ARRVAL_P(var_array), &pos);
- }
- querystr.len--;
- smart_str_appends(&querystr, ") VALUES (");
-
- /* make values string */
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(var_array), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_P(var_array), (void **)&val, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_P(var_array), &pos)) {
-
- /* we can avoid the key_type check here, because we tested it in the other loop */
- switch(Z_TYPE_PP(val)) {
- case IS_STRING:
- smart_str_appendl(&querystr, Z_STRVAL_PP(val), Z_STRLEN_PP(val));
- break;
- case IS_LONG:
- smart_str_append_long(&querystr, Z_LVAL_PP(val));
- break;
- case IS_DOUBLE:
- smart_str_appendl(&querystr, buf, sprintf(buf, "%f", Z_DVAL_PP(val)));
- break;
- default:
- /* should not happen */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Report this error to php-dev@lists.php.net, type = %d.", Z_TYPE_PP(val));
- goto cleanup;
- break;
- }
- smart_str_appendc(&querystr, ',');
- }
- /* Remove the trailing "," */
- querystr.len--;
- smart_str_appends(&querystr, ");");
- smart_str_0(&querystr);
-
- if ((opt & (PGSQL_DML_EXEC|PGSQL_DML_ASYNC)) &&
- do_exec(&querystr, PGRES_COMMAND_OK, pg_link, (opt & PGSQL_CONV_OPTS) TSRMLS_CC) == 0) {
- ret = SUCCESS;
- }
- else if (opt & PGSQL_DML_STRING) {
- ret = SUCCESS;
- }
-
-cleanup:
- if (!(opt & PGSQL_DML_NO_CONV)) {
- zval_dtor(converted);
- FREE_ZVAL(converted);
- }
- if (ret == SUCCESS && (opt & PGSQL_DML_STRING)) {
- *sql = querystr.c;
- }
- else {
- smart_str_free(&querystr);
- }
- return ret;
-}
-/* }}} */
-
-/* {{{ proto mixed pg_insert(resource db, string table, array values[, int options])
- Insert values (filed=>value) to table */
-PHP_FUNCTION(pg_insert)
-{
- zval *pgsql_link, *values;
- char *table, *sql = NULL;
- int table_len;
- ulong option = PGSQL_DML_EXEC;
- PGconn *pg_link;
- int id = -1, argc = ZEND_NUM_ARGS();
-
- if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l",
- &pgsql_link, &table, &table_len, &values, &option) == FAILURE) {
- return;
- }
- if (option & ~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_ASYNC|PGSQL_DML_STRING)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid option is specified.");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pg_link, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- if (php_pgsql_flush_query(pg_link TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected unhandled result(s) in connection.");
- }
- if (php_pgsql_insert(pg_link, table, values, option, &sql TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
- if (option & PGSQL_DML_STRING) {
- RETURN_STRING(sql, 0);
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-static inline int build_assignment_string(smart_str *querystr, HashTable *ht, const char *pad, int pad_len TSRMLS_DC)
-{
- HashPosition pos;
- uint fld_len;
- int key_type;
- ulong num_idx;
- char *fld;
- char buf[256];
- zval **val;
-
- for (zend_hash_internal_pointer_reset_ex(ht, &pos);
- zend_hash_get_current_data_ex(ht, (void **)&val, &pos) == SUCCESS;
- zend_hash_move_forward_ex(ht, &pos)) {
- key_type = zend_hash_get_current_key_ex(ht, &fld, &fld_len, &num_idx, 0, &pos);
- if (key_type == HASH_KEY_IS_LONG) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects associative array for values to be inserted.");
- return -1;
- }
- smart_str_appendl(querystr, fld, fld_len - 1);
- smart_str_appendc(querystr, '=');
-
- switch(Z_TYPE_PP(val)) {
- case IS_STRING:
- smart_str_appendl(querystr, Z_STRVAL_PP(val), Z_STRLEN_PP(val));
- break;
- case IS_LONG:
- smart_str_append_long(querystr, Z_LVAL_PP(val));
- break;
- case IS_DOUBLE:
- smart_str_appendl(querystr, buf, sprintf(buf, "%f", Z_DVAL_PP(val)));
- break;
- default:
- /* should not happen */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects scaler values other than NULL. Need to convert?");
- return -1;
- }
- smart_str_appendl(querystr, pad, pad_len);
- }
- querystr->len -= pad_len;
-
- return 0;
-}
-
-/* {{{ php_pgsql_update
- */
-PHPAPI int php_pgsql_update(PGconn *pg_link, const char *table, zval *var_array, zval *ids_array, ulong opt, char **sql TSRMLS_DC)
-{
- zval *var_converted = NULL, *ids_converted = NULL;
- smart_str querystr = {0};
- int ret = FAILURE;
-
- assert(pg_link != NULL);
- assert(table != NULL);
- assert(Z_TYPE_P(var_array) == IS_ARRAY);
- assert(Z_TYPE_P(ids_array) == IS_ARRAY);
- assert(!(opt & ~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_STRING)));
-
- if (zend_hash_num_elements(Z_ARRVAL_P(var_array)) == 0
- || zend_hash_num_elements(Z_ARRVAL_P(ids_array)) == 0) {
- return FAILURE;
- }
-
- if (!(opt & PGSQL_DML_NO_CONV)) {
- MAKE_STD_ZVAL(var_converted);
- array_init(var_converted);
- if (php_pgsql_convert(pg_link, table, var_array, var_converted, (opt & PGSQL_CONV_OPTS) TSRMLS_CC) == FAILURE) {
- goto cleanup;
- }
- var_array = var_converted;
- MAKE_STD_ZVAL(ids_converted);
- array_init(ids_converted);
- if (php_pgsql_convert(pg_link, table, ids_array, ids_converted, (opt & PGSQL_CONV_OPTS) TSRMLS_CC) == FAILURE) {
- goto cleanup;
- }
- ids_array = ids_converted;
- }
-
- smart_str_appends(&querystr, "UPDATE ");
- smart_str_appends(&querystr, table);
- smart_str_appends(&querystr, " SET ");
-
- if (build_assignment_string(&querystr, Z_ARRVAL_P(var_array), ",", 1 TSRMLS_CC))
- goto cleanup;
-
- smart_str_appends(&querystr, " WHERE ");
-
- if (build_assignment_string(&querystr, Z_ARRVAL_P(ids_array), " AND ", sizeof(" AND ")-1 TSRMLS_CC))
- goto cleanup;
-
- smart_str_appendc(&querystr, ';');
- smart_str_0(&querystr);
-
- if (do_exec(&querystr, PGRES_COMMAND_OK, pg_link, opt TSRMLS_CC) == 0)
- ret = SUCCESS;
-
-cleanup:
- if (var_converted) {
- zval_dtor(var_converted);
- FREE_ZVAL(var_converted);
- }
- if (ids_converted) {
- zval_dtor(ids_converted);
- FREE_ZVAL(ids_converted);
- }
- if (ret == SUCCESS && (opt & PGSQL_DML_STRING)) {
- *sql = querystr.c;
- }
- else {
- smart_str_free(&querystr);
- }
- return ret;
-}
-/* }}} */
-
-/* {{{ proto mixed pg_update(resource db, string table, array fields, array ids[, int options])
- Update table using values (field=>value) and ids (id=>value) */
-PHP_FUNCTION(pg_update)
-{
- zval *pgsql_link, *values, *ids;
- char *table, *sql = NULL;
- int table_len;
- ulong option = PGSQL_DML_EXEC;
- PGconn *pg_link;
- int id = -1, argc = ZEND_NUM_ARGS();
-
- if (zend_parse_parameters(argc TSRMLS_CC, "rsaa|l",
- &pgsql_link, &table, &table_len, &values, &ids, &option) == FAILURE) {
- return;
- }
- if (option & ~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_STRING)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid option is specified.");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pg_link, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- if (php_pgsql_flush_query(pg_link TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected unhandled result(s) in connection.");
- }
- if (php_pgsql_update(pg_link, table, values, ids, option, &sql TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
- if (option & PGSQL_DML_STRING) {
- RETURN_STRING(sql, 0);
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ php_pgsql_delete
- */
-PHPAPI int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, ulong opt, char **sql TSRMLS_DC)
-{
- zval *ids_converted = NULL;
- smart_str querystr = {0};
- int ret = FAILURE;
-
- assert(pg_link != NULL);
- assert(table != NULL);
- assert(Z_TYPE_P(ids_array) == IS_ARRAY);
- assert(!(opt & ~(PGSQL_CONV_FORCE_NULL|PGSQL_DML_EXEC|PGSQL_DML_STRING)));
-
- if (zend_hash_num_elements(Z_ARRVAL_P(ids_array)) == 0) {
- return FAILURE;
- }
-
- if (!(opt & PGSQL_DML_NO_CONV)) {
- MAKE_STD_ZVAL(ids_converted);
- array_init(ids_converted);
- if (php_pgsql_convert(pg_link, table, ids_array, ids_converted, (opt & PGSQL_CONV_OPTS) TSRMLS_CC) == FAILURE) {
- goto cleanup;
- }
- ids_array = ids_converted;
- }
-
- smart_str_appends(&querystr, "DELETE FROM ");
- smart_str_appends(&querystr, table);
- smart_str_appends(&querystr, " WHERE ");
-
- if (build_assignment_string(&querystr, Z_ARRVAL_P(ids_array), " AND ", sizeof(" AND ")-1 TSRMLS_CC))
- goto cleanup;
-
- smart_str_appendc(&querystr, ';');
- smart_str_0(&querystr);
-
- if (do_exec(&querystr, PGRES_COMMAND_OK, pg_link, opt TSRMLS_CC) == 0)
- ret = SUCCESS;
-
-cleanup:
- if (!(opt & PGSQL_DML_NO_CONV)) {
- zval_dtor(ids_converted);
- FREE_ZVAL(ids_converted);
- }
- if (ret == SUCCESS && (opt & PGSQL_DML_STRING)) {
- *sql = estrdup(querystr.c);
- }
- else {
- smart_str_free(&querystr);
- }
- return ret;
-}
-/* }}} */
-
-/* {{{ proto mixed pg_delete(resource db, string table, array ids[, int options])
- Delete records has ids (id=>value) */
-PHP_FUNCTION(pg_delete)
-{
- zval *pgsql_link, *ids;
- char *table, *sql = NULL;
- int table_len;
- ulong option = PGSQL_DML_EXEC;
- PGconn *pg_link;
- int id = -1, argc = ZEND_NUM_ARGS();
-
- if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l",
- &pgsql_link, &table, &table_len, &ids, &option) == FAILURE) {
- return;
- }
- if (option & ~(PGSQL_CONV_FORCE_NULL|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_STRING)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid option is specified.");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pg_link, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- if (php_pgsql_flush_query(pg_link TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected unhandled result(s) in connection.");
- }
- if (php_pgsql_delete(pg_link, table, ids, option, &sql TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
- if (option & PGSQL_DML_STRING) {
- RETURN_STRING(sql, 0);
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ php_pgsql_result2array
- */
-PHPAPI int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TSRMLS_DC)
-{
- zval *row;
- char *field_name, *element, *data;
- size_t num_fields, element_len, data_len;
- int pg_numrows, pg_row;
- uint i;
- assert(Z_TYPE_P(ret_array) == IS_ARRAY);
-
- if ((pg_numrows = PQntuples(pg_result)) <= 0) {
- return FAILURE;
- }
- for (pg_row = 0; pg_row < pg_numrows; pg_row++) {
- MAKE_STD_ZVAL(row);
- array_init(row);
- add_index_zval(ret_array, pg_row, row);
- for (i = 0, num_fields = PQnfields(pg_result); i < num_fields; i++) {
- if (PQgetisnull(pg_result, pg_row, i)) {
- field_name = PQfname(pg_result, i);
- add_assoc_null(row, field_name);
- } else {
- element = PQgetvalue(pg_result, pg_row, i);
- element_len = (element ? strlen(element) : 0);
- if (element) {
- if (PG(magic_quotes_runtime)) {
- data = php_addslashes(element, element_len, &data_len, 0 TSRMLS_CC);
- } else {
- data = safe_estrndup(element, element_len);
- data_len = element_len;
- }
- field_name = PQfname(pg_result, i);
- add_assoc_stringl(row, field_name, data, data_len, 0);
- }
- }
- }
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_pgsql_select
- */
-PHPAPI int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_array, ulong opt, char **sql TSRMLS_DC)
-{
- zval *ids_converted = NULL;
- smart_str querystr = {0};
- int ret = FAILURE;
- PGresult *pg_result;
-
- assert(pg_link != NULL);
- assert(table != NULL);
- assert(Z_TYPE_P(ids_array) == IS_ARRAY);
- assert(Z_TYPE_P(ret_array) == IS_ARRAY);
- assert(!(opt & ~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_ASYNC|PGSQL_DML_STRING)));
-
- if (zend_hash_num_elements(Z_ARRVAL_P(ids_array)) == 0) {
- return FAILURE;
- }
-
- if (!(opt & PGSQL_DML_NO_CONV)) {
- MAKE_STD_ZVAL(ids_converted);
- array_init(ids_converted);
- if (php_pgsql_convert(pg_link, table, ids_array, ids_converted, (opt & PGSQL_CONV_OPTS) TSRMLS_CC) == FAILURE) {
- goto cleanup;
- }
- ids_array = ids_converted;
- }
-
- smart_str_appends(&querystr, "SELECT * FROM ");
- smart_str_appends(&querystr, table);
- smart_str_appends(&querystr, " WHERE ");
-
- if (build_assignment_string(&querystr, Z_ARRVAL_P(ids_array), " AND ", sizeof(" AND ")-1 TSRMLS_CC))
- goto cleanup;
-
- smart_str_appendc(&querystr, ';');
- smart_str_0(&querystr);
-
- pg_result = PQexec(pg_link, querystr.c);
- if (PQresultStatus(pg_result) == PGRES_TUPLES_OK) {
- ret = php_pgsql_result2array(pg_result, ret_array TSRMLS_CC);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Failed to execute '%s'.", querystr.c);
- PQclear(pg_result);
- }
-
-cleanup:
- if (!(opt & PGSQL_DML_NO_CONV)) {
- zval_dtor(ids_converted);
- FREE_ZVAL(ids_converted);
- }
- if (ret == SUCCESS && (opt & PGSQL_DML_STRING)) {
- *sql = querystr.c;
- }
- else {
- smart_str_free(&querystr);
- }
- return ret;
-}
-/* }}} */
-
-/* {{{ proto mixed pg_select(resource db, string table, array ids[, int options])
- Select records that has ids (id=>value) */
-PHP_FUNCTION(pg_select)
-{
- zval *pgsql_link, *ids;
- char *table, *sql = NULL;
- int table_len;
- ulong option = PGSQL_DML_EXEC;
- PGconn *pg_link;
- int id = -1, argc = ZEND_NUM_ARGS();
-
- if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l",
- &pgsql_link, &table, &table_len, &ids, &option) == FAILURE) {
- return;
- }
- if (option & ~(PGSQL_CONV_FORCE_NULL|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_ASYNC|PGSQL_DML_STRING)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid option is specified.");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pg_link, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- if (php_pgsql_flush_query(pg_link TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected unhandled result(s) in connection.");
- }
- array_init(return_value);
- if (php_pgsql_select(pg_link, table, ids, return_value, option, &sql TSRMLS_CC) == FAILURE) {
- zval_dtor(return_value);
- RETURN_FALSE;
- }
- if (option & PGSQL_DML_STRING) {
- zval_dtor(return_value);
- RETURN_STRING(sql, 0);
- }
- return;
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/pgsql/pgsql.dsp b/ext/pgsql/pgsql.dsp
deleted file mode 100644
index 93a64b4765..0000000000
--- a/ext/pgsql/pgsql.dsp
+++ /dev/null
@@ -1,167 +0,0 @@
-# Microsoft Developer Studio Project File - Name="pgsql" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=pgsql - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "pgsql.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "pgsql.mak" CFG="pgsql - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "pgsql - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "pgsql - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "pgsql - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "pgsql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "pgsql - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PGSQL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "D:\Projects\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D "HAVE_PQCMDTUPLES" /D "HAVE_PQCLIENTENCODING" /D "HAVE_PQESCAPE" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib libpqdll.lib php4ts.lib /nologo /dll /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"../../Release/pgsql.dll" /libpath:"..\..\..\PostgreSQL\lib" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "pgsql - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PGSQL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "D:\Projects\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D "HAVE_PQCMDTUPLES" /D "HAVE_PQCLIENTENCODING" /D "HAVE_PQESCAPE" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"../../Debug/pgsql.dll" /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "pgsql - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\PostgreSQL\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "ZTS" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D ZTS=1 /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "NDEBUG" /D "ZTS" /D ZEND_DEBUG=0 /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D "HAVE_PQCMDTUPLES" /D "HAVE_PQCLIENTENCODING" /D "HAVE_PQESCAPE" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib libpqdll.lib php4ts.lib /nologo /dll /machine:I386 /libpath:"..\..\..\PostgreSQL\lib" /libpath:"..\..\Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib libpq.lib php4ts.lib /nologo /dll /machine:I386 /out:"../../Release_TS/php_pgsql.dll" /libpath:"..\..\..\php_build\postgresql\src\interfaces\libpq\Release" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "pgsql - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D ZTS=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "D:\Projects\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "_DEBUG" /D "ZTS" /D ZEND_DEBUG=1 /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D "HAVE_PQCMDTUPLES" /D "HAVE_PQCLIENTENCODING" /D "HAVE_PQESCAPE" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libpq.lib /nologo /dll /debug /machine:I386 /out:"../../Debug_TS/pgsql.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "pgsql - Win32 Release"
-# Name "pgsql - Win32 Debug"
-# Name "pgsql - Win32 Release_TS"
-# Name "pgsql - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\pgsql.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_pgsql.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/pgsql/pgsql.mak b/ext/pgsql/pgsql.mak
deleted file mode 100644
index 908056acfb..0000000000
--- a/ext/pgsql/pgsql.mak
+++ /dev/null
@@ -1,170 +0,0 @@
-# Temporarily here -- later may go into some batch file
-# which will set this as an environment variable
-PROJECT_ROOT = ..\..
-
-# Module details
-MODULE_NAME = phppgsql
-MODULE_DESC = "PHP 4.3 - PostgreSQL Extension"
-VMAJ = 3
-VMIN = 0
-VREV = 0
-
-#include the common settings
-include $(PROJECT_ROOT)/netware/common.mif
-
-# Build type defaults to 'release'
-ifndef BUILD
-BUILD = release
-endif
-
-# Extensions of all input and output files
-.SUFFIXES:
-.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d
-
-# Source files
-C_SRC = pgsql.c \
- start.c
-
-CPP_SRC_NODIR = $(notdir $(CPP_SRC))
-C_SRC_NODIR = $(notdir $(C_SRC))
-SRC_DIR = $(dir $(CPP_SRC) $(C_SRC))
-
-# Library files
-LIBRARY =
-
-# Destination directories and files
-OBJ_DIR = $(BUILD)
-FINAL_DIR = $(BUILD)
-OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.obj) $(C_SRC_NODIR:.c=.obj))
-DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.d) $(C_SRC_NODIR:.c=.d))
-
-# Binary file
-ifndef BINARY
- BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm
-endif
-
-# Compile flags
-C_FLAGS += -c -maxerrors 25 -msgstyle gcc -wchar_t on -bool on -processor Pentium
-C_FLAGS += -nostdinc -nosyspath
-C_FLAGS += -relax_pointers # To remove type-casting errors
-C_FLAGS += -DNETWARE -DZTS -DNEW_LIBC -DUSE_OLD_FUNCTIONS
-C_FLAGS += -D__BIT_TYPES_DEFINED__ -DCOMPILE_DL_PGSQL=1
-C_FLAGS += -I. -I- -I$(PROJECT_ROOT) -I$(PROJECT_ROOT)/main
-C_FLAGS += -I$(PROJECT_ROOT)/ext/standard -I$(PROJECT_ROOT)/netware
-C_FLAGS += -I$(PROJECT_ROOT)/zend -I$(PROJECT_ROOT)/tsrm
-C_FLAGS += -I$(SDK_DIR)/include -I$(MWCIncludes)
-C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include
-
-
-# Extra stuff based on debug / release builds
-ifeq '$(BUILD)' 'debug'
- SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym
- C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -DDEBUGGING -DDKFBPON
- C_FLAGS += -exc cw -DZEND_DEBUG=1
- LD_FLAGS += -sym on -sym codeview4 -osym $(SYM_FILE)
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib
-else
- C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off -opt intrinsics
- C_FLAGS += -opt level=4 -DZEND_DEBUG=0
- LD_FLAGS += -sym off
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
-endif
-
-
-# Dependencies
-MODULE = LibC \
- phplib \
- libpq
-IMPORT = @$(SDK_DIR)/imports/libc.imp \
- @$(SDK_DIR)/imports/ws2nlm.imp \
- @$(MPK_DIR)/import/mpkOrg.imp \
- @$(PROJECT_ROOT)/netware/phplib.imp \
- @$(PROJECT_ROOT)/netware/libpq.imp
-EXPORT = ($(MODULE_NAME)) get_module
-API = OutputToScreen
-
-# Virtual paths
-vpath %.cpp .
-vpath %.c . ..\..\netware
-vpath %.obj $(OBJ_DIR)
-
-
-all: prebuild project
-
-.PHONY: all
-
-prebuild:
- @if not exist $(OBJ_DIR) md $(OBJ_DIR)
-
-project: $(BINARY)
- @echo Build complete.
-
-$(OBJ_DIR)/%.d: %.cpp
- @echo Building Dependencies for $(<F)
- @$(CC) -M $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.d: %.c
- @echo Building Dependencies for $(<F)
- @$(CC) -M $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.obj: %.cpp
- @echo Compiling $?...
- @$(CC) $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.obj: %.c
- @echo Compiling $?...
- @$(CC) $< $(C_FLAGS) -o $@
-
-
-$(BINARY): $(OBJECTS)
- @echo Import $(IMPORT) > $(basename $@).def
-ifdef API
- @echo Import $(API) >> $(basename $@).def
-endif
- @echo Module $(MODULE) >> $(basename $@).def
-ifdef EXPORT
- @echo Export $(EXPORT) >> $(basename $@).def
-endif
- @echo AutoUnload >> $(basename $@).def
-ifeq '$(BUILD)' 'debug'
- @echo Debug >> $(basename $@).def
-endif
- @echo Flag_On 0x00000008 >> $(basename $@).def
- @echo Start _LibCPrelude >> $(basename $@).def
- @echo Exit _LibCPostlude >> $(basename $@).def
-
- $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc
- @echo xdcdata $(basename $@).xdc >> $(basename $@).def
-
- @echo Linking $@...
- @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link
-
- @echo $(LIBRARY) $(OBJECTS) >> $(basename $@).link
-
- @$(LINK) @$(basename $@).link
-
-
-.PHONY: clean
-clean: cleanobj cleanbin
-
-.PHONY: cleand
-cleand:
- @echo Deleting all dependency files...
- -@del "$(OBJ_DIR)\*.d"
-
-.PHONY: cleanobj
-cleanobj:
- @echo Deleting all object files...
- -@del "$(OBJ_DIR)\*.obj"
-
-.PHONY: cleanbin
-cleanbin:
- @echo Deleting binary files...
- -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm"
- @echo Deleting MAP, DEF files, etc....
- -@del "$(FINAL_DIR)\$(MODULE_NAME).map"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).def"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).link"
-ifeq '$(BUILD)' 'debug'
- -@del $(FINAL_DIR)\$(MODULE_NAME).sym
-endif
diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h
deleted file mode 100644
index 429cefe53d..0000000000
--- a/ext/pgsql/php_pgsql.h
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- | Jouni Ahto <jouni.ahto@exdec.fi> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_PGSQL_H
-#define PHP_PGSQL_H
-
-#if HAVE_PGSQL
-
-#define PHP_PGSQL_API 20020419
-
-extern zend_module_entry pgsql_module_entry;
-#define pgsql_module_ptr &pgsql_module_entry
-
-#ifdef PHP_PGSQL_PRIVATE
-#undef SOCKET_SIZE_TYPE
-#include <libpq-fe.h>
-
-#ifdef PHP_WIN32
-#define INV_WRITE 0x00020000
-#define INV_READ 0x00040000
-#undef PHPAPI
-#ifdef PGSQL_EXPORTS
-#define PHPAPI __declspec(dllexport)
-#else
-#define PHPAPI __declspec(dllimport)
-#endif
-#else
-#include <libpq/libpq-fs.h>
-#endif
-
-#ifdef HAVE_PG_CONFIG_H
-#include <pg_config.h>
-#endif
-
-#ifdef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
-const char * pg_encoding_to_char(int encoding);
-#endif
-
-PHP_MINIT_FUNCTION(pgsql);
-PHP_MSHUTDOWN_FUNCTION(pgsql);
-PHP_RINIT_FUNCTION(pgsql);
-PHP_RSHUTDOWN_FUNCTION(pgsql);
-PHP_MINFO_FUNCTION(pgsql);
-/* connection functions */
-PHP_FUNCTION(pg_connect);
-PHP_FUNCTION(pg_pconnect);
-PHP_FUNCTION(pg_close);
-PHP_FUNCTION(pg_connection_reset);
-PHP_FUNCTION(pg_connection_status);
-PHP_FUNCTION(pg_connection_busy);
-PHP_FUNCTION(pg_host);
-PHP_FUNCTION(pg_dbname);
-PHP_FUNCTION(pg_port);
-PHP_FUNCTION(pg_tty);
-PHP_FUNCTION(pg_options);
-PHP_FUNCTION(pg_ping);
-/* query functions */
-PHP_FUNCTION(pg_query);
-PHP_FUNCTION(pg_send_query);
-PHP_FUNCTION(pg_cancel_query);
-/* result functions */
-PHP_FUNCTION(pg_fetch_assoc);
-PHP_FUNCTION(pg_fetch_array);
-PHP_FUNCTION(pg_fetch_object);
-PHP_FUNCTION(pg_fetch_result);
-PHP_FUNCTION(pg_fetch_row);
-PHP_FUNCTION(pg_fetch_all);
-PHP_FUNCTION(pg_affected_rows);
-PHP_FUNCTION(pg_get_result);
-PHP_FUNCTION(pg_result_seek);
-PHP_FUNCTION(pg_result_status);
-PHP_FUNCTION(pg_free_result);
-PHP_FUNCTION(pg_last_oid);
-PHP_FUNCTION(pg_num_rows);
-PHP_FUNCTION(pg_num_fields);
-PHP_FUNCTION(pg_field_name);
-PHP_FUNCTION(pg_field_num);
-PHP_FUNCTION(pg_field_size);
-PHP_FUNCTION(pg_field_type);
-PHP_FUNCTION(pg_field_prtlen);
-PHP_FUNCTION(pg_field_is_null);
-/* async message functions */
-PHP_FUNCTION(pg_get_notify);
-PHP_FUNCTION(pg_get_pid);
-/* error message functions */
-PHP_FUNCTION(pg_result_error);
-PHP_FUNCTION(pg_last_error);
-PHP_FUNCTION(pg_last_notice);
-/* copy functions */
-PHP_FUNCTION(pg_put_line);
-PHP_FUNCTION(pg_end_copy);
-PHP_FUNCTION(pg_copy_to);
-PHP_FUNCTION(pg_copy_from);
-/* large object functions */
-PHP_FUNCTION(pg_lo_create);
-PHP_FUNCTION(pg_lo_unlink);
-PHP_FUNCTION(pg_lo_open);
-PHP_FUNCTION(pg_lo_close);
-PHP_FUNCTION(pg_lo_read);
-PHP_FUNCTION(pg_lo_write);
-PHP_FUNCTION(pg_lo_read_all);
-PHP_FUNCTION(pg_lo_import);
-PHP_FUNCTION(pg_lo_export);
-PHP_FUNCTION(pg_lo_seek);
-PHP_FUNCTION(pg_lo_tell);
-
-/* debugging functions */
-PHP_FUNCTION(pg_trace);
-PHP_FUNCTION(pg_untrace);
-
-/* utility functions */
-PHP_FUNCTION(pg_client_encoding);
-PHP_FUNCTION(pg_set_client_encoding);
-#if HAVE_PQESCAPE
-PHP_FUNCTION(pg_escape_string);
-PHP_FUNCTION(pg_escape_bytea);
-PHP_FUNCTION(pg_unescape_bytea);
-#endif
-
-/* misc functions */
-PHP_FUNCTION(pg_meta_data);
-PHP_FUNCTION(pg_convert);
-PHP_FUNCTION(pg_insert);
-PHP_FUNCTION(pg_update);
-PHP_FUNCTION(pg_delete);
-PHP_FUNCTION(pg_select);
-
-/* connection options - ToDo: Add async connection option */
-#define PGSQL_CONNECT_FORCE_NEW (1<<1)
-/* php_pgsql_convert options */
-#define PGSQL_CONV_IGNORE_DEFAULT (1<<1) /* Do not use DEAFULT value by removing field from returned array */
-#define PGSQL_CONV_FORCE_NULL (1<<2) /* Convert to NULL if string is null string */
-#define PGSQL_CONV_IGNORE_NOT_NULL (1<<3) /* Ignore NOT NULL constraints */
-#define PGSQL_CONV_OPTS (PGSQL_CONV_IGNORE_DEFAULT|PGSQL_CONV_FORCE_NULL|PGSQL_CONV_IGNORE_NOT_NULL)
-/* php_pgsql_insert/update/select/delete options */
-#define PGSQL_DML_NO_CONV (1<<8) /* Do not call php_pgsql_convert() */
-#define PGSQL_DML_EXEC (1<<9) /* Execute query */
-#define PGSQL_DML_ASYNC (1<<10) /* Do async query */
-#define PGSQL_DML_STRING (1<<11) /* Return query string */
-
-/* exported functions */
-PHPAPI int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta TSRMLS_DC);
-PHPAPI int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, ulong opt TSRMLS_DC);
-PHPAPI int php_pgsql_insert(PGconn *pg_link, const char *table, zval *values, ulong opt, char **sql TSRMLS_DC);
-PHPAPI int php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval *ids, ulong opt , char **sql TSRMLS_DC);
-PHPAPI int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids, ulong opt, char **sql TSRMLS_DC);
-PHPAPI int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids, zval *ret_array, ulong opt, char **sql TSRMLS_DC);
-PHPAPI int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TSRMLS_DC);
-
-/* internal functions */
-static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent);
-static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
-static void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
-static char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list TSRMLS_DC);
-static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
-static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
-static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS,int entry_type);
-
-typedef enum _php_pgsql_data_type {
- /* boolean */
- PG_BOOL,
- /* number */
- PG_OID,
- PG_INT2,
- PG_INT4,
- PG_INT8,
- PG_FLOAT4,
- PG_FLOAT8,
- PG_NUMERIC,
- PG_MONEY,
- /* character */
- PG_TEXT,
- PG_CHAR,
- PG_VARCHAR,
- /* time and interval */
- PG_UNIX_TIME,
- PG_UNIX_TIME_INTERVAL,
- PG_DATE,
- PG_TIME,
- PG_TIME_WITH_TIMEZONE,
- PG_TIMESTAMP,
- PG_TIMESTAMP_WITH_TIMEZONE,
- PG_INTERVAL,
- /* binary */
- PG_BYTEA,
- /* network */
- PG_CIDR,
- PG_INET,
- PG_MACADDR,
- /* bit */
- PG_BIT,
- PG_VARBIT,
- /* geometoric */
- PG_LINE,
- PG_LSEG,
- PG_POINT,
- PG_BOX,
- PG_PATH,
- PG_POLYGON,
- PG_CIRCLE,
- /* unkown and system */
- PG_UNKNOWN
-} php_pgsql_data_type;
-
-typedef struct pgLofp {
- PGconn *conn;
- int lofd;
-} pgLofp;
-
-typedef struct _php_pgsql_result_handle {
- PGconn *conn;
- PGresult *result;
- int row;
-} pgsql_result_handle;
-
-typedef struct _php_pgsql_notice {
- char *message;
- size_t len;
-} php_pgsql_notice;
-
-typedef struct {
- long default_link; /* default link when connection is omitted */
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
- long auto_reset_persistent;
- int le_lofp,le_string;
- int ignore_notices,log_notices;
- HashTable notices; /* notice message for each connection */
-} php_pgsql_globals;
-
-
-#ifdef ZTS
-# define PGG(v) TSRMG(pgsql_globals_id, php_pgsql_globals *, v)
-extern int pgsql_globals_id;
-#else
-# define PGG(v) (pgsql_globals.v)
-extern php_pgsql_globals pgsql_globals;
-#endif
-
-#endif
-
-#else
-
-#define pgsql_module_ptr NULL
-
-#endif
-
-#define phpext_pgsql_ptr pgsql_module_ptr
-
-#endif /* PHP_PGSQL_H */
diff --git a/ext/pgsql/tests/01createdb.phpt b/ext/pgsql/tests/01createdb.phpt
deleted file mode 100644
index 3b34ed537e..0000000000
--- a/ext/pgsql/tests/01createdb.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-PostgreSQL create db
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("createdb.inc");
-?>
---EXPECT--
-OK
diff --git a/ext/pgsql/tests/02connection.phpt b/ext/pgsql/tests/02connection.phpt
deleted file mode 100644
index fd1333dfe6..0000000000
--- a/ext/pgsql/tests/02connection.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-PostgreSQL connection
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("connection.inc");
-?>
---EXPECT--
-OK
diff --git a/ext/pgsql/tests/03sync_query.phpt b/ext/pgsql/tests/03sync_query.phpt
deleted file mode 100644
index 0f2e048959..0000000000
--- a/ext/pgsql/tests/03sync_query.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-PostgreSQL sync query
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("sync_query.inc");
-?>
---EXPECT--
-OK
diff --git a/ext/pgsql/tests/04async_query.phpt b/ext/pgsql/tests/04async_query.phpt
deleted file mode 100644
index a3d17699b9..0000000000
--- a/ext/pgsql/tests/04async_query.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-PostgreSQL async query
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("async_query.inc");
-?>
---EXPECT--
-OK
diff --git a/ext/pgsql/tests/05large_object.phpt b/ext/pgsql/tests/05large_object.phpt
deleted file mode 100644
index ef0bc15db9..0000000000
--- a/ext/pgsql/tests/05large_object.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-PostgreSQL large object
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("large_object.inc");
-?>
---EXPECT--
-large object data
-OK
diff --git a/ext/pgsql/tests/06copy.phpt b/ext/pgsql/tests/06copy.phpt
deleted file mode 100644
index dbbe1ff4d6..0000000000
--- a/ext/pgsql/tests/06copy.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-PostgreSQL copy functions
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("copy.inc");
-?>
---EXPECT--
-OK
diff --git a/ext/pgsql/tests/07optional.phpt b/ext/pgsql/tests/07optional.phpt
deleted file mode 100644
index f8b8cbeec7..0000000000
--- a/ext/pgsql/tests/07optional.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-PostgreSQL optional functions
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("optional.inc");
-?>
---EXPECT--
-OK
diff --git a/ext/pgsql/tests/08escape.phpt b/ext/pgsql/tests/08escape.phpt
deleted file mode 100644
index e6a8cf8731..0000000000
--- a/ext/pgsql/tests/08escape.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-PostgreSQL escape functions
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("escape.inc");
-?>
---EXPECT--
-pg_escape_string() is NOT Ok
-string(9) "ABC\ABC\'"
-string(12) "ABC\\ABC\\''"
-string(10) "ABC\\ABC\'"
-pg_escape_bytea() is Ok
diff --git a/ext/pgsql/tests/09notice.phpt b/ext/pgsql/tests/09notice.phpt
deleted file mode 100644
index f50bc70702..0000000000
--- a/ext/pgsql/tests/09notice.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-PostgreSQL notice function
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("notice.inc");
-?>
---EXPECT--
-NOTICE: BEGIN: already a transaction in progress
-
-NOTICE: BEGIN: already a transaction in progress
-pg_last_notice() is Ok
diff --git a/ext/pgsql/tests/10pg_convert.phpt b/ext/pgsql/tests/10pg_convert.phpt
deleted file mode 100644
index 016c7e74d5..0000000000
--- a/ext/pgsql/tests/10pg_convert.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-PostgreSQL pg_convert()
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("pg_convert.inc");
-?>
---EXPECT--
-array(3) {
- ["num"]=>
- string(4) "1234"
- ["str"]=>
- string(5) "'AAA'"
- ["bin"]=>
- string(5) "'BBB'"
-}
diff --git a/ext/pgsql/tests/11pg_meta_data.phpt b/ext/pgsql/tests/11pg_meta_data.phpt
deleted file mode 100644
index 85e2d2cf07..0000000000
--- a/ext/pgsql/tests/11pg_meta_data.phpt
+++ /dev/null
@@ -1,50 +0,0 @@
---TEST--
-PostgreSQL pg_metadata()
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("pg_meta_data.inc");
-?>
---EXPECT--
-array(3) {
- ["num"]=>
- array(5) {
- ["num"]=>
- int(1)
- ["type"]=>
- string(4) "int4"
- ["len"]=>
- int(4)
- ["not null"]=>
- bool(false)
- ["has default"]=>
- bool(false)
- }
- ["str"]=>
- array(5) {
- ["num"]=>
- int(2)
- ["type"]=>
- string(4) "text"
- ["len"]=>
- int(-1)
- ["not null"]=>
- bool(false)
- ["has default"]=>
- bool(false)
- }
- ["bin"]=>
- array(5) {
- ["num"]=>
- int(3)
- ["type"]=>
- string(5) "bytea"
- ["len"]=>
- int(-1)
- ["not null"]=>
- bool(false)
- ["has default"]=>
- bool(false)
- }
-}
diff --git a/ext/pgsql/tests/12pg_insert.phpt b/ext/pgsql/tests/12pg_insert.phpt
deleted file mode 100644
index 104b6fe662..0000000000
--- a/ext/pgsql/tests/12pg_insert.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-PostgreSQL pg_insert()
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("pg_insert.inc");
-?>
---EXPECT--
-INSERT INTO php_pgsql_test (num,str,bin) VALUES (1234,'AAA','BBB');
-Ok
diff --git a/ext/pgsql/tests/13pg_select.phpt b/ext/pgsql/tests/13pg_select.phpt
deleted file mode 100644
index 43c94c037f..0000000000
--- a/ext/pgsql/tests/13pg_select.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-PostgreSQL pg_select()
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("pg_select.inc");
-?>
---EXPECT--
-array(1) {
- [0]=>
- array(3) {
- ["num"]=>
- string(4) "1234"
- ["str"]=>
- string(3) "AAA"
- ["bin"]=>
- string(3) "BBB"
- }
-}
-SELECT * FROM php_pgsql_test WHERE num=1234;
-Ok
diff --git a/ext/pgsql/tests/14pg_update.phpt b/ext/pgsql/tests/14pg_update.phpt
deleted file mode 100644
index 7dd4dd2d95..0000000000
--- a/ext/pgsql/tests/14pg_update.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-PostgreSQL pg_update()
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("pg_update.inc");
-?>
---EXPECT--
-UPDATE php_pgsql_test SET num=1234,str='ABC',bin='XYZ' WHERE num=1234;
-Ok
diff --git a/ext/pgsql/tests/15pg_delete.phpt b/ext/pgsql/tests/15pg_delete.phpt
deleted file mode 100644
index 331e898383..0000000000
--- a/ext/pgsql/tests/15pg_delete.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-PostgreSQL pg_delete()
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("pg_delete.inc");
-?>
---EXPECT--
-Ok
diff --git a/ext/pgsql/tests/16pg_result_status.phpt b/ext/pgsql/tests/16pg_result_status.phpt
deleted file mode 100644
index 6faf849e7f..0000000000
--- a/ext/pgsql/tests/16pg_result_status.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-PostgreSQL pg_result_status()
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("pg_result_status.inc");
-?>
---EXPECT--
-1
-COMMIT
diff --git a/ext/pgsql/tests/17result.phpt b/ext/pgsql/tests/17result.phpt
deleted file mode 100644
index e8c3f390de..0000000000
--- a/ext/pgsql/tests/17result.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-PostgreSQL pg_fetch_*() functions
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("result.inc");
-?>
---EXPECT--
-object(stdClass)(3) {
- ["num"]=>
- string(1) "1"
- ["str"]=>
- string(3) "ABC"
- ["bin"]=>
- NULL
-}
-array(6) {
- [0]=>
- string(1) "1"
- ["num"]=>
- string(1) "1"
- [1]=>
- string(3) "ABC"
- ["str"]=>
- string(3) "ABC"
- [2]=>
- NULL
- ["bin"]=>
- NULL
-}
-array(3) {
- [0]=>
- string(1) "1"
- [1]=>
- string(3) "ABC"
- [2]=>
- NULL
-}
-array(3) {
- ["num"]=>
- string(1) "2"
- ["str"]=>
- string(3) "ABC"
- ["bin"]=>
- NULL
-}
-bool(true)
-Ok
diff --git a/ext/pgsql/tests/18pg_escape_bytea.phpt b/ext/pgsql/tests/18pg_escape_bytea.phpt
deleted file mode 100644
index 08832c40da..0000000000
--- a/ext/pgsql/tests/18pg_escape_bytea.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-PostgreSQL pg_escape_bytea() functions
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("pg_escape_bytea.inc");
-?>
---EXPECT--
-OK
diff --git a/ext/pgsql/tests/19pg_ping.phpt b/ext/pgsql/tests/19pg_ping.phpt
deleted file mode 100644
index eba678b55e..0000000000
--- a/ext/pgsql/tests/19pg_ping.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-PostgreSQL pg_ping() functions
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("pg_ping.inc");
-?>
---EXPECT--
-bool(true)
diff --git a/ext/pgsql/tests/20pg_get_pid.phpt b/ext/pgsql/tests/20pg_get_pid.phpt
deleted file mode 100644
index 9572751185..0000000000
--- a/ext/pgsql/tests/20pg_get_pid.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-PostgreSQL pg_get_pid() functions
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("pg_get_pid.inc");
-?>
---EXPECT--
-OK
diff --git a/ext/pgsql/tests/21pg_get_notify.phpt b/ext/pgsql/tests/21pg_get_notify.phpt
deleted file mode 100644
index 0ff3a74a26..0000000000
--- a/ext/pgsql/tests/21pg_get_notify.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-PostgreSQL pg_get_notify() functions
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("pg_get_notify.inc");
-?>
---EXPECT--
-OK
diff --git a/ext/pgsql/tests/80_bug14383.phpt b/ext/pgsql/tests/80_bug14383.phpt
deleted file mode 100644
index c60e11c19a..0000000000
--- a/ext/pgsql/tests/80_bug14383.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-Bug #14383
---SKIPIF--
-<?php
-require_once(dirname(__FILE__).'/../../dba/tests/skipif.inc');
-require_once('skipif.inc');
-?>
---FILE--
-<?php
-require_once('config.inc');
-
-$dbh = @pg_connect($conn_str);
-if (!$dbh) {
- die ("Could not connect to the server");
-}
-pg_close($dbh);
-
-require_once(dirname(__FILE__).'/../../dba/tests/test.inc');
-require_once(dirname(__FILE__).'/../../dba/tests/dba_handler.inc');
-
-?>
---EXPECTF--
-database handler: %s
-3NYNYY
-Content String 2
-Content 2 replaced
-Read during write:%sallowed
-Content 2 replaced 2nd time
-The 6th value
-array(3) {
- ["key number 6"]=>
- string(13) "The 6th value"
- ["key2"]=>
- string(27) "Content 2 replaced 2nd time"
- ["key5"]=>
- string(23) "The last content string"
-} \ No newline at end of file
diff --git a/ext/pgsql/tests/98old_api.phpt b/ext/pgsql/tests/98old_api.phpt
deleted file mode 100644
index c6f8070c23..0000000000
--- a/ext/pgsql/tests/98old_api.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-PostgreSQL old api
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("old_api.inc");
-?>
---EXPECT--
-OK
diff --git a/ext/pgsql/tests/9999dropdb.phpt b/ext/pgsql/tests/9999dropdb.phpt
deleted file mode 100644
index d60e2dce99..0000000000
--- a/ext/pgsql/tests/9999dropdb.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-PostgreSQL drop db
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-include("dropdb.inc");
-?>
---EXPECT--
-OK
diff --git a/ext/pgsql/tests/README b/ext/pgsql/tests/README
deleted file mode 100644
index 22915127a6..0000000000
--- a/ext/pgsql/tests/README
+++ /dev/null
@@ -1,14 +0,0 @@
-Test scripts assume:
- - PostgreSQL server is installed locally
- - there is a PostgreSQL account for the users running test script
- - there is database named "test"
-
-For instance, if you login name is 'testuser', you should
-have PostgreSQL user account named 'testuser' and have 'test'
-database.
-
-If you have account and database, type "createdb test" from
-command prompt to create database to execute test scripts.
-
-If you find problems in PostgreSQL module, please mail to
-yohgaki@php.net or php-dev@lists.php.net.
diff --git a/ext/pgsql/tests/async_query.inc b/ext/pgsql/tests/async_query.inc
deleted file mode 100644
index ac70809095..0000000000
--- a/ext/pgsql/tests/async_query.inc
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-include('config.inc');
-
-$db = pg_connect($conn_str);
-
-if (!pg_send_query($db, "SELECT * FROM ".$table_name.";")) {
- echo "pg_send_query() error\n";
-}
-while(pg_connection_busy($db)); // busy wait: intended
-if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
- echo "pg_connection_status() error\n";
-}
-if (!($result = pg_get_result($db)))
-{
- echo "pg_get_result() error\n";
-}
-
-if (!($rows = pg_num_rows($result))) {
- echo "pg_num_rows() error\n";
-}
-for ($i=0; $i < $rows; $i++)
-{
- pg_fetch_array($result, $i, PGSQL_NUM);
-}
-for ($i=0; $i < $rows; $i++)
-{
- pg_fetch_object($result, $i, PGSQL_ASSOC);
-}
-for ($i=0; $i < $rows; $i++)
-{
- pg_fetch_row($result, $i);
-}
-for ($i=0; $i < $rows; $i++)
-{
- pg_fetch_result($result, $i, 0);
-}
-
-pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";"));
-pg_num_fields(pg_query($db, "SELECT * FROM ".$table_name.";"));
-pg_field_name($result, 0);
-pg_field_num($result, $field_name);
-pg_field_size($result, 0);
-pg_field_type($result, 0);
-pg_field_prtlen($result, 0);
-pg_field_is_null($result, 0);
-
-if (!pg_send_query($db, "INSERT INTO ".$table_name." VALUES (8888, 'GGG');"))
-{
- echo "pg_send_query() error\n";
-}
-
-pg_last_oid($result);
-pg_free_result($result);
-
-
-echo "OK";
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/config.inc b/ext/pgsql/tests/config.inc
deleted file mode 100644
index 2b5f05a71d..0000000000
--- a/ext/pgsql/tests/config.inc
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-// These vars are used to connect db and create test table.
-// values can be set to meet your environment
-
-$conn_str = "host=localhost dbname=test"; // connection string
-$table_name = "php_pgsql_test"; // test table that should be exist
-$num_test_record = 1000; // Number of records to create
-
-$table_def = "CREATE TABLE php_pgsql_test (num int, str text, bin bytea);"; // Test table
-$field_name = "num"; // For pg_field_num()
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/connection.inc b/ext/pgsql/tests/connection.inc
deleted file mode 100644
index e6e9c143af..0000000000
--- a/ext/pgsql/tests/connection.inc
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-// connection function tests
-
-include('config.inc');
-
-$db = pg_pconnect($conn_str);
-if (pg_connection_status($db) != PGSQL_CONNECTION_OK)
-{
- echo "pg_connection_status() error\n";
-}
-if (!pg_connection_reset($db))
-{
- echo "pg_connection_reset() error\n";
-}
-if (pg_connection_busy($db))
-{
- echo "pg_connection_busy() error\n";
-}
-if (!pg_host($db))
-{
- echo "pg_host() error\n";
-}
-if (!pg_dbname($db))
-{
- echo "pg_dbname() error\n";
-}
-if (!pg_port($db))
-{
- echo "pg_port() error\n";
-}
-if (pg_tty($db))
-{
- echo "pg_tty() error\n";
-}
-if (pg_options($db))
-{
- echo "pg_options() error\n";
-}
-
-pg_close($db);
-
-echo "OK";
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/copy.inc b/ext/pgsql/tests/copy.inc
deleted file mode 100644
index 52b6e1d748..0000000000
--- a/ext/pgsql/tests/copy.inc
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-include('config.inc');
-
-
-echo "OK";
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/createdb.inc b/ext/pgsql/tests/createdb.inc
deleted file mode 100644
index b11883800f..0000000000
--- a/ext/pgsql/tests/createdb.inc
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-// create test table
-
-include('config.inc');
-
-$db = pg_connect($conn_str);
-if (!@pg_num_rows(@pg_query($db, "SELECT * FROM ".$table_name)))
-{
- @pg_query($db,$table_def); // Create table here
- for ($i=0; $i < $num_test_record; $i++) {
- pg_query($db,"INSERT INTO ".$table_name." VALUES ($i, 'ABC');");
- }
-}
-else {
- echo pg_last_error()."\n";
-}
-
-pg_close($db);
-
-echo "OK";
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/dropdb.inc b/ext/pgsql/tests/dropdb.inc
deleted file mode 100644
index eaf33ae742..0000000000
--- a/ext/pgsql/tests/dropdb.inc
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-// drop test table
-
-include('config.inc');
-
-$db = pg_connect($conn_str);
-pg_query($db, "DROP TABLE ".$table_name);
-
-echo "OK";
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/escape.inc b/ext/pgsql/tests/escape.inc
deleted file mode 100644
index a39e1c1621..0000000000
--- a/ext/pgsql/tests/escape.inc
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-include 'config.inc';
-define('FILE_NAME', './php.gif');
-
-// pg_escape_string() test
-$before = "ABC\\ABC\'";
-$expect = "ABC\\\\ABC\\'";
-$after = pg_escape_string($before);
-if ($expect === $after) {
- echo "pg_escape_string() is Ok\n";
-}
-else {
- echo "pg_escape_string() is NOT Ok\n";
- var_dump($before);
- var_dump($after);
- var_dump($expect);
-}
-
-// pg_escape_bytea() test
-$before = "ABC\\ABC";
-$expect = "ABC\\\\\\\\ABC";
-$after = pg_escape_bytea($before);
-if ($expect === $after) {
- echo "pg_escape_bytea() is Ok\n";
-}
-else {
- echo "pg_escape_byte() is NOT Ok\n";
- var_dump($before);
- var_dump($after);
- var_dump($expect);
-}
-
-// Test using database
-$fp = fopen(FILE_NAME,'r');
-$data = fread($fp, filesize(FILE_NAME));
-$db = pg_connect($conn_str);
-
-// Insert binary to DB
-$escaped_data = pg_escape_bytea($data);
-pg_query("DELETE FROM ".$table_name." WHERE num = -9999;");
-$sql = "INSERT INTO ".$table_name." (num, bin) VALUES (-9999, CAST ('".$escaped_data."' AS BYTEA));";
-pg_query($db, $sql);
-
-// Retrieve binary from DB
-$sql = "SELECT bin::bytea FROM ".$table_name." WHERE num = -9999";
-$result = pg_query($db, $sql);
-$row = pg_fetch_array($result, 0, PGSQL_ASSOC);
-
-// Compare
-// Need to wait PostgreSQL 7.3.x for PQunescapeBytea()
-// if ($data === pg_unescape_bytea($row['bin'])) {
-// echo "pg_escape_bytea() actually works with databse\n";
-// }
-// else {
-// echo "pg_escape_bytea() is broken\n";
-// }
-
-?>
diff --git a/ext/pgsql/tests/informational.inc b/ext/pgsql/tests/informational.inc
deleted file mode 100644
index 120c61335b..0000000000
--- a/ext/pgsql/tests/informational.inc
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-// connection function tests
-
-include('config.inc');
-
-$db = pg_pconnect($conn_str);
-if (pg_connection_status($db) != PGSQL_CONNECTION_OK)
-{
- echo "pg_connection_status() error\n";
-}
-if (!pg_connection_reset($db))
-{
- echo "pg_connection_reset() error\n";
-}
-if (pg_connection_busy($db))
-{
- echo "pg_connection_busy() error\n";
-}
-if (!pg_host($db))
-{
- echo "pg_host() error\n";
-}
-if (!pg_dbname($db))
-{
- echo "pg_dbname() error\n";
-}
-if (!pg_port($db))
-{
- echo "pg_port() error\n";
-}
-if (pg_tty($db))
-{
- echo "pg_tty() error\n";
-}
-if (pg_options($db))
-{
- echo "pg_options() error\n";
-}
-
-echo pg_host($db);
-
-
-pg_close($db);
-
-echo "OK";
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/large_object.inc b/ext/pgsql/tests/large_object.inc
deleted file mode 100644
index f21912b5b6..0000000000
--- a/ext/pgsql/tests/large_object.inc
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-include('config.inc');
-
-$db = pg_connect($conn_str);
-
-// create/write/close LO
-pg_exec ($db, "begin");
-$oid = pg_lo_create ($db);
-if (!$oid) echo ("pg_lo_create() error\n");
-$handle = pg_lo_open ($db, $oid, "w");
-if (!$handle) echo ("pg_lo_open() error\n");
-pg_lo_write ($handle, "large object data\n");
-pg_lo_close ($handle);
-pg_exec ($db, "commit");
-
-// open/read/tell/seek/close LO
-pg_exec ($db, "begin");
-$handle = pg_lo_open ($db, $oid, "w");
-pg_lo_read($handle, 100);
-pg_lo_tell($handle);
-pg_lo_seek($handle, 2);
-pg_lo_close($handle);
-pg_exec ($db, "commit");
-
-// open/read_all/close LO
-pg_exec ($db, "begin");
-$handle = pg_lo_open ($db, $oid, "w");
-pg_lo_read_all($handle);
-if (pg_last_error()) echo "pg_lo_read_all() error\n".pg_last_error();
-pg_lo_close($handle);
-pg_exec ($db, "commit");
-
-// unlink LO
-pg_exec ($db, "begin");
-pg_lo_unlink($db, $oid) or print("pg_lo_unlink() error\n");
-pg_exec ($db, "commit");
-
-// more pg_lo_unlink() tests
-// Test without connection
-pg_exec ($db, "begin");
-$oid = pg_lo_create ($db) or print("pg_lo_create() error\n");
-pg_lo_unlink($oid) or print("pg_lo_unlink() error\n");
-pg_exec ($db, "commit");
-
-// Test with string oid value
-pg_exec ($db, "begin");
-$oid = pg_lo_create ($db) or print("pg_lo_create() error\n");
-pg_lo_unlink($db, (string)$oid) or print("pg_lo_unlink() error\n");
-pg_exec ($db, "commit");
-
-// import/export LO
-pg_query($db, 'begin');
-$oid = pg_lo_import($db, 'php.gif');
-pg_query($db, 'commit');
-pg_query($db, 'begin');
-@unlink('php.gif.exported');
-pg_lo_export($oid, 'php.gif.exported', $db);
-if (!file_exists('php.gif.exported')) {
- echo "Export failed\n";
-}
-@unlink('php.gif.exported');
-pg_query($db, 'commit');
-
-echo "OK";
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/notice.inc b/ext/pgsql/tests/notice.inc
deleted file mode 100644
index 4c2b1de49e..0000000000
--- a/ext/pgsql/tests/notice.inc
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-include 'config.inc';
-
-ini_set('pgsql.log_notice',1);
-
-$db = pg_connect($conn_str);
-pg_query($db, "BEGIN;");
-pg_query($db, "BEGIN;");
-
-$msg = pg_last_notice($db);
-if ($msg === FALSE) {
- echo "Cannot find notice message in hash\n";
- var_dump($msg);
-}
-echo $msg;
-echo "pg_last_notice() is Ok\n";
-
-?>
diff --git a/ext/pgsql/tests/old_api.inc b/ext/pgsql/tests/old_api.inc
deleted file mode 100644
index 4995961831..0000000000
--- a/ext/pgsql/tests/old_api.inc
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-include('config.inc');
-
-$db = pg_connect($conn_str);
-$result = pg_exec("SELECT * FROM ".$table_name);
-pg_numrows($result);
-pg_numfields($result);
-pg_fieldname($result, 0);
-pg_fieldsize($result, $field_name);
-pg_fieldtype($result, 0);
-pg_fieldprtlen($result, 0);
-pg_fieldisnull($result, 0);
-
-pg_result($result,0,0);
-$result = pg_exec("INSERT INTO ".$table_name." VALUES (7777, 'KKK')");
-$oid = pg_getlastoid($result);
-pg_freeresult($result);
-pg_errormessage();
-$result = pg_exec("UPDATE ".$table_name." SET str = 'QQQ' WHERE str like 'RGD';");
-pg_cmdtuples($result);
-
-
-
-echo "OK";
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/optional.inc b/ext/pgsql/tests/optional.inc
deleted file mode 100644
index 87dbfd39d3..0000000000
--- a/ext/pgsql/tests/optional.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-// optional functions
-
-include('config.inc');
-
-$db = pg_connect($conn_str);
-$enc = pg_client_encoding($db);
-
-pg_set_client_encoding($db, $enc);
-
-echo "OK";
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/pg_convert.inc b/ext/pgsql/tests/pg_convert.inc
deleted file mode 100644
index ab6e95ff65..0000000000
--- a/ext/pgsql/tests/pg_convert.inc
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-error_reporting(E_ALL);
-
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-
-$fields = array('num'=>'1234', 'str'=>'AAA', 'bin'=>'BBB');
-$converted = pg_convert($db, $table_name, $fields);
-
-var_dump($converted);
-
-
-?>
diff --git a/ext/pgsql/tests/pg_delete.inc b/ext/pgsql/tests/pg_delete.inc
deleted file mode 100644
index 33ba80e727..0000000000
--- a/ext/pgsql/tests/pg_delete.inc
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-error_reporting(E_ALL);
-
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-
-$fields = array('num'=>'1234', 'str'=>'XXX', 'bin'=>'YYY');
-$ids = array('num'=>'1234');
-if (!pg_delete($db, $table_name, $ids)) {
- echo "Error\n";
-}
-else {
- echo "Ok\n";
-}
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/pg_escape_bytea.inc b/ext/pgsql/tests/pg_escape_bytea.inc
deleted file mode 100644
index 249c2f158d..0000000000
--- a/ext/pgsql/tests/pg_escape_bytea.inc
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-// optional functions
-
-include('config.inc');
-
-
-$fp = fopen('php.gif', 'r');
-$image = fread($fp, filesize('php.gif'));
-$esc_image = pg_escape_bytea($image);
-
-$db = pg_connect($conn_str);
-pg_query($db, 'INSERT INTO '.$table_name.' (num, bin) VALUES (9876, \''.$esc_image.'\');');
-$result = pg_query($db, 'SELECT * FROM '.$table_name.' WHERE num = 9876');
-$rows = pg_fetch_all($result);
-$unesc_image = pg_unescape_bytea($rows[0]['bin']);
-
-if ($unesc_image !== $image) {
- echo "NG";
-}
-else {
- echo "OK";
-}
-
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/pg_get_notify.inc b/ext/pgsql/tests/pg_get_notify.inc
deleted file mode 100644
index dfb4fe3b85..0000000000
--- a/ext/pgsql/tests/pg_get_notify.inc
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-// optional functions
-
-include('config.inc');
-
-
-$db = pg_connect($conn_str);
-pg_query($db, 'LISTEN test_msg');
-pg_query($db, 'NOTIFY test_msg');
-
-$msg = pg_get_notify($db);
-
-isset($msg['message'],$msg['pid']) ? print 'OK' : print 'NG';
-
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/pg_get_pid.inc b/ext/pgsql/tests/pg_get_pid.inc
deleted file mode 100644
index 5aa8e7efa5..0000000000
--- a/ext/pgsql/tests/pg_get_pid.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-// optional functions
-
-include('config.inc');
-
-
-$db = pg_connect($conn_str);
-$pid = pg_get_pid($db);
-
-is_integer($pid) ? print 'OK' : print 'NG';
-
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/pg_insert.inc b/ext/pgsql/tests/pg_insert.inc
deleted file mode 100644
index e0777a215e..0000000000
--- a/ext/pgsql/tests/pg_insert.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-error_reporting(E_ALL);
-
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-$fields = array('num'=>'1234', 'str'=>'AAA', 'bin'=>'BBB');
-
-pg_insert($db, $table_name, $fields) or print "Error in test 1\n";
-echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING)."\n";
-
-echo "Ok\n";
-?>
diff --git a/ext/pgsql/tests/pg_meta_data.inc b/ext/pgsql/tests/pg_meta_data.inc
deleted file mode 100644
index 4486935838..0000000000
--- a/ext/pgsql/tests/pg_meta_data.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-error_reporting(E_ALL);
-
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-
-$meta = pg_meta_data($db, $table_name);
-
-var_dump($meta);
-
-
-?>
diff --git a/ext/pgsql/tests/pg_ping.inc b/ext/pgsql/tests/pg_ping.inc
deleted file mode 100644
index 2d9be9fadc..0000000000
--- a/ext/pgsql/tests/pg_ping.inc
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-// optional functions
-
-include('config.inc');
-
-$db = pg_connect($conn_str);
-var_dump(pg_ping($db));
-
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/pg_result_status.inc b/ext/pgsql/tests/pg_result_status.inc
deleted file mode 100644
index 2c03e8966a..0000000000
--- a/ext/pgsql/tests/pg_result_status.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-
-$sql = "SELECT * FROM ".$table_name." WHERE num = -2";
-$result = pg_query($db, "BEGIN;END");
-
-echo pg_result_status($result)."\n";
-echo pg_result_status($result, PGSQL_STATUS_STRING)."\n";
-
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/pg_select.inc b/ext/pgsql/tests/pg_select.inc
deleted file mode 100644
index 4d251bc992..0000000000
--- a/ext/pgsql/tests/pg_select.inc
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-error_reporting(E_ALL);
-
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ');
-$ids = array('num'=>'1234');
-
-$res = pg_select($db, $table_name, $ids) or print "Error\n";
-var_dump($res);
-echo pg_select($db, $table_name, $ids, PGSQL_DML_STRING)."\n";
-echo "Ok\n";
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/pg_update.inc b/ext/pgsql/tests/pg_update.inc
deleted file mode 100644
index 8fc8bb168b..0000000000
--- a/ext/pgsql/tests/pg_update.inc
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-error_reporting(E_ALL);
-
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ');
-$ids = array('num'=>'1234');
-
-pg_update($db, $table_name, $fields, $ids) or print "Error in test 1\n";
-echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING)."\n";
-
-echo "Ok\n";
-
-?>
diff --git a/ext/pgsql/tests/php.gif b/ext/pgsql/tests/php.gif
deleted file mode 100644
index 7beda43fd4..0000000000
--- a/ext/pgsql/tests/php.gif
+++ /dev/null
Binary files differ
diff --git a/ext/pgsql/tests/result.inc b/ext/pgsql/tests/result.inc
deleted file mode 100644
index fb38938b89..0000000000
--- a/ext/pgsql/tests/result.inc
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-error_reporting(E_ALL);
-
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-
-$sql = "SELECT * FROM $table_name";
-$result = pg_query($db, $sql) or die('Cannot qeury db');
-$rows = pg_num_rows($result);
-
-$rec = pg_fetch_object($result, 1);
-var_dump($rec);
-$rec = pg_fetch_array($result, 1);
-var_dump($rec);
-$rec = pg_fetch_row($result, 1);
-var_dump($rec);
-$rec = pg_fetch_assoc($result);
-var_dump($rec);
-var_dump(pg_result_seek($result, 0));
-
-echo "Ok\n";
-
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/skipif.inc b/ext/pgsql/tests/skipif.inc
deleted file mode 100644
index 34e93b2aaa..0000000000
--- a/ext/pgsql/tests/skipif.inc
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-// This script prints "skip" unless:
-// * the pgsql extension is built-in or loadable, AND
-// * there is a database called "test" accessible
-// with no username/password, AND
-// * we have create/drop privileges on the entire "test"
-// database
-
-include("config.inc");
-
-if (!extension_loaded("pgsql") && ini_get("enable_dl")) {
- $dlext = (substr(PHP_OS, 0, 3) == "WIN") ? ".dll" : ".so";
- @dl("pgsql$dlext");
-}
-if (!extension_loaded("pgsql")) {
- die("skip\n");
-}
-$conn = @pg_connect($conn_str);
-if (!is_resource($conn)) {
- die("skip\n");
-}
-?> \ No newline at end of file
diff --git a/ext/pgsql/tests/sync_query.inc b/ext/pgsql/tests/sync_query.inc
deleted file mode 100644
index 5a75b2c88c..0000000000
--- a/ext/pgsql/tests/sync_query.inc
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-include('config.inc');
-
-$db = pg_connect($conn_str);
-
-$result = pg_query($db, "SELECT * FROM ".$table_name.";");
-if (!($rows = pg_num_rows($result)))
-{
- echo "pg_num_row() error\n";
-}
-for ($i=0; $i < $rows; $i++)
-{
- pg_fetch_array($result, $i, PGSQL_NUM);
-}
-for ($i=0; $i < $rows; $i++)
-{
- pg_fetch_object($result, $i, PGSQL_ASSOC);
-}
-for ($i=0; $i < $rows; $i++)
-{
- pg_fetch_row($result, $i);
-}
-for ($i=0; $i < $rows; $i++)
-{
- pg_fetch_result($result, $i, 0);
-}
-
-pg_result_error($result);
-pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";"));
-pg_num_fields(pg_query($db, "SELECT * FROM ".$table_name.";"));
-pg_field_name($result, 0);
-pg_field_num($result, $field_name);
-pg_field_size($result, 0);
-pg_field_type($result, 0);
-pg_field_prtlen($result, 0);
-pg_field_is_null($result, 0);
-
-$result = pg_query($db, "INSERT INTO ".$table_name." VALUES (9999, 'ABC');");
-pg_last_oid($result);
-
-pg_free_result($result);
-pg_close($db);
-
-echo "OK";
-
-?> \ No newline at end of file
diff --git a/ext/posix/CREDITS b/ext/posix/CREDITS
deleted file mode 100644
index c769635d91..0000000000
--- a/ext/posix/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Posix
-Kristian Köhntopp
diff --git a/ext/posix/config.m4 b/ext/posix/config.m4
deleted file mode 100644
index fc3767e98b..0000000000
--- a/ext/posix/config.m4
+++ /dev/null
@@ -1,13 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(posix,whether to enable POSIX-like functions,
-[ --disable-posix Disable POSIX-like functions], yes)
-
-if test "$PHP_POSIX" = "yes"; then
- AC_DEFINE(HAVE_POSIX, 1, [whether to include POSIX-like functions])
- PHP_NEW_EXTENSION(posix, posix.c, $ext_shared)
-
- AC_CHECK_FUNCS(seteuid setegid setsid getsid setpgid getpgid ctermid mkfifo getrlimit)
-fi
diff --git a/ext/posix/php_posix.h b/ext/posix/php_posix.h
deleted file mode 100644
index f466dacb55..0000000000
--- a/ext/posix/php_posix.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Kristian Koehntopp <kris@koehntopp.de> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef PHP_POSIX_H
-#define PHP_POSIX_H
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if HAVE_POSIX
-#ifndef DLEXPORT
-#define DLEXPORT
-#endif
-
-extern zend_module_entry posix_module_entry;
-#define posix_module_ptr &posix_module_entry
-
-/* POSIX.1, 3.3 */
-PHP_FUNCTION(posix_kill);
-
-/* POSIX.1, 4.1 */
-PHP_FUNCTION(posix_getpid);
-PHP_FUNCTION(posix_getppid);
-
-/* POSIX.1, 4.2 */
-PHP_FUNCTION(posix_getuid);
-PHP_FUNCTION(posix_getgid);
-PHP_FUNCTION(posix_geteuid);
-PHP_FUNCTION(posix_getegid);
-PHP_FUNCTION(posix_setuid);
-PHP_FUNCTION(posix_setgid);
-#ifdef HAVE_SETEUID
-PHP_FUNCTION(posix_seteuid);
-#endif
-#ifdef HAVE_SETEGID
-PHP_FUNCTION(posix_setegid);
-#endif
-PHP_FUNCTION(posix_getgroups);
-PHP_FUNCTION(posix_getlogin);
-
-/* POSIX.1, 4.3 */
-PHP_FUNCTION(posix_getpgrp);
-#ifdef HAVE_SETSID
-PHP_FUNCTION(posix_setsid);
-#endif
-PHP_FUNCTION(posix_setpgid);
-/* Non-Posix functions which are common */
-#ifdef HAVE_GETPGID
-PHP_FUNCTION(posix_getpgid);
-#endif
-#ifdef HAVE_GETSID
-PHP_FUNCTION(posix_getsid);
-#endif
-
-/* POSIX.1, 4.4 */
-PHP_FUNCTION(posix_uname);
-PHP_FUNCTION(posix_times);
-
-/* POSIX.1, 4.5 */
-#ifdef HAVE_CTERMID
-PHP_FUNCTION(posix_ctermid);
-#endif
-PHP_FUNCTION(posix_ttyname);
-PHP_FUNCTION(posix_isatty);
-
-/* POSIX.1, 5.2 */
-PHP_FUNCTION(posix_getcwd);
-
-/* POSIX.1, 5.4 */
-#ifdef HAVE_MKFIFO
-PHP_FUNCTION(posix_mkfifo);
-#endif
-
-/* POSIX.1, 9.2 */
-PHP_FUNCTION(posix_getgrnam);
-PHP_FUNCTION(posix_getgrgid);
-PHP_FUNCTION(posix_getpwnam);
-PHP_FUNCTION(posix_getpwuid);
-
-#ifdef HAVE_GETRLIMIT
-PHP_FUNCTION(posix_getrlimit);
-#endif
-
-PHP_FUNCTION(posix_get_last_error);
-PHP_FUNCTION(posix_strerror);
-
-ZEND_BEGIN_MODULE_GLOBALS(posix)
- int last_error;
-ZEND_END_MODULE_GLOBALS(posix)
-
-#ifdef ZTS
-# define POSIX_G(v) TSRMG(posix_globals_id, zend_posix_globals *, v)
-#else
-# define POSIX_G(v) (posix_globals.v)
-#endif
-
-#else
-
-#define posix_module_ptr NULL
-
-#endif
-
-#define phpext_posix_ptr posix_module_ptr
-
-#endif /* PHP_POSIX_H */
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
deleted file mode 100644
index b53740990b..0000000000
--- a/ext/posix/posix.c
+++ /dev/null
@@ -1,1016 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Kristian Koehntopp <kris@koehntopp.de> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-#include "php_posix.h"
-
-#if HAVE_POSIX
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#include <unistd.h>
-#include <sys/resource.h>
-#include <sys/utsname.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <signal.h>
-#include <sys/times.h>
-#include <errno.h>
-#include <grp.h>
-#include <pwd.h>
-
-ZEND_DECLARE_MODULE_GLOBALS(posix)
-
-/* {{{ posix_functions[]
- */
-function_entry posix_functions[] = {
- /* POSIX.1, 3.3 */
- PHP_FE(posix_kill, NULL)
-
- /* POSIX.1, 4.1 */
- PHP_FE(posix_getpid, NULL)
- PHP_FE(posix_getppid, NULL)
-
- /* POSIX.1, 4.2 */
- PHP_FE(posix_getuid, NULL)
- PHP_FE(posix_setuid, NULL)
- PHP_FE(posix_geteuid, NULL)
-#ifdef HAVE_SETEUID
- PHP_FE(posix_seteuid, NULL)
-#endif
- PHP_FE(posix_getgid, NULL)
- PHP_FE(posix_setgid, NULL)
- PHP_FE(posix_getegid, NULL)
-#ifdef HAVE_SETEGID
- PHP_FE(posix_setegid, NULL)
-#endif
- PHP_FE(posix_getgroups, NULL)
- PHP_FE(posix_getlogin, NULL)
-
- /* POSIX.1, 4.3 */
- PHP_FE(posix_getpgrp, NULL)
-#ifdef HAVE_SETSID
- PHP_FE(posix_setsid, NULL)
-#endif
- PHP_FE(posix_setpgid, NULL)
- /* Non-Posix functions which are common */
-#ifdef HAVE_GETPGID
- PHP_FE(posix_getpgid, NULL)
-#endif /* HAVE_GETPGID */
-#ifdef HAVE_GETSID
- PHP_FE(posix_getsid, NULL)
-#endif /* HAVE_GETSID */
-
- /* POSIX.1, 4.4 */
- PHP_FE(posix_uname, NULL)
-
- /* POSIX.1, 4.5 */
- PHP_FE(posix_times, NULL)
-
- /* POSIX.1, 4.7 */
-#ifdef HAVE_CTERMID
- PHP_FE(posix_ctermid, NULL)
-#endif
- PHP_FE(posix_ttyname, NULL)
- PHP_FE(posix_isatty, NULL)
-
- /* POSIX.1, 5.2 */
- PHP_FE(posix_getcwd, NULL)
-
- /* POSIX.1, 5.4 */
-#ifdef HAVE_MKFIFO
- PHP_FE(posix_mkfifo, NULL)
-#endif
-
- /* POSIX.1, 9.2 */
- PHP_FE(posix_getgrnam, NULL)
- PHP_FE(posix_getgrgid, NULL)
- PHP_FE(posix_getpwnam, NULL)
- PHP_FE(posix_getpwuid, NULL)
-
-#ifdef HAVE_GETRLIMIT
- PHP_FE(posix_getrlimit, NULL)
-#endif
-
- PHP_FE(posix_get_last_error, NULL)
- PHP_FALIAS(posix_errno, posix_get_last_error, NULL)
- PHP_FE(posix_strerror, NULL)
-
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-static PHP_MINFO_FUNCTION(posix)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Revision", "$Revision$");
- php_info_print_table_end();
-}
-/* }}} */
-
-static void php_posix_init_globals(zend_posix_globals *posix_globals TSRMLS_DC)
-{
- posix_globals->last_error = 0;
-}
-
-/* {{{ PHP_MINIT_FUNCTION(posix)
- */
-static PHP_MINIT_FUNCTION(posix)
-{
- ZEND_INIT_MODULE_GLOBALS(posix, php_posix_init_globals, NULL);
- return SUCCESS;
-}
-/* }}} */
-
-static PHP_MINFO_FUNCTION(posix);
-
-/* {{{ posix_module_entry
- */
-zend_module_entry posix_module_entry = {
- STANDARD_MODULE_HEADER,
- "posix",
- posix_functions,
- PHP_MINIT(posix),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(posix),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_POSIX
-ZEND_GET_MODULE(posix)
-#endif
-
-/* {{{ proto bool posix_kill(int pid, int sig)
- Send a signal to a process (POSIX.1, 3.3.2) */
-
-PHP_FUNCTION(posix_kill)
-{
- long pid, sig;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &pid, &sig) == FAILURE)
- return;
-
- if (kill(pid, sig) < 0) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int posix_getpid(void)
- Get the current process id (POSIX.1, 4.1.1) */
-PHP_FUNCTION(posix_getpid)
-{
- pid_t pid;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- pid = getpid();
- RETURN_LONG(pid);
-}
-/* }}} */
-
-/* {{{ proto int posix_getppid(void)
- Get the parent process id (POSIX.1, 4.1.1) */
-PHP_FUNCTION(posix_getppid)
-{
- pid_t ppid;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- ppid = getppid();
- RETURN_LONG(ppid);
-}
-/* }}} */
-
-/* {{{ proto int posix_getuid(void)
- Get the current user id (POSIX.1, 4.2.1) */
-PHP_FUNCTION(posix_getuid)
-{
- uid_t uid;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- uid = getuid();
- RETURN_LONG(uid);
-}
-/* }}} */
-
-/* {{{ proto int posix_getgid(void)
- Get the current group id (POSIX.1, 4.2.1) */
-PHP_FUNCTION(posix_getgid)
-{
- gid_t gid;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- gid = getgid();
- RETURN_LONG(gid);
-}
-/* }}} */
-
-/* {{{ proto int posix_geteuid(void)
- Get the current effective user id (POSIX.1, 4.2.1) */
-PHP_FUNCTION(posix_geteuid)
-{
- uid_t uid;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- uid = geteuid();
- RETURN_LONG(uid);
-}
-/* }}} */
-
-/* {{{ proto int posix_getegid(void)
- Get the current effective group id (POSIX.1, 4.2.1) */
-PHP_FUNCTION(posix_getegid)
-{
- gid_t gid;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- gid = getegid();
- RETURN_LONG(gid);
- }
-/* }}} */
-
-/* {{{ proto bool posix_setuid(long uid)
- Set user id (POSIX.1, 4.2.2) */
-PHP_FUNCTION(posix_setuid)
-{
- long uid;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &uid) == FAILURE)
- return;
-
- if (setuid(uid) < 0) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool posix_setgid(int uid)
- Set group id (POSIX.1, 4.2.2) */
-PHP_FUNCTION(posix_setgid)
-{
- long gid;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &gid) == FAILURE)
- return;
-
- if (setgid(gid) < 0) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool posix_seteuid(long uid)
- Set effective user id */
-#ifdef HAVE_SETEUID
-PHP_FUNCTION(posix_seteuid)
-{
- long euid;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &euid) == FAILURE)
- return;
-
- if (seteuid(euid) < 0) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-#endif
-/* }}} */
-
-/* {{{ proto bool posix_setegid(long uid)
- Set effective group id */
-#ifdef HAVE_SETEGID
-PHP_FUNCTION(posix_setegid)
-{
- long egid;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &egid) == FAILURE)
- return;
-
- if (setegid(egid) < 0) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-#endif
-/* }}} */
-
-/* {{{ proto array posix_getgroups(void)
- Get supplementary group id's (POSIX.1, 4.2.3) */
-PHP_FUNCTION(posix_getgroups)
-{
- gid_t gidlist[NGROUPS_MAX];
- int result;
- int i;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- if ((result = getgroups(NGROUPS_MAX, gidlist)) < 0) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- for (i=0; i<result; i++) {
- add_next_index_long(return_value, gidlist[i]);
- }
-}
-/* }}} */
-
-/* {{{ proto string posix_getlogin(void)
- Get user name (POSIX.1, 4.2.4) */
-PHP_FUNCTION(posix_getlogin)
-{
- char *p;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- if (NULL == (p = getlogin())) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- RETURN_STRING(p, 1);
-}
-/* }}} */
-
-/* {{{ proto int posix_getpgrp(void)
- Get current process group id (POSIX.1, 4.3.1) */
-PHP_FUNCTION(posix_getpgrp)
-{
- pid_t pgrp;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- pgrp = getpgrp();
- RETURN_LONG(pgrp);
-}
-/* }}} */
-
-/* {{{ proto int posix_setsid(void)
- Create session and set process group id (POSIX.1, 4.3.2) */
-#ifdef HAVE_SETSID
-PHP_FUNCTION(posix_setsid)
-{
- pid_t sid;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- sid = setsid();
- RETURN_LONG(sid);
-}
-#endif
-/* }}} */
-
-/* {{{ proto bool posix_setpgid(int pid, int pgid)
- Set process group id for job control (POSIX.1, 4.3.3) */
-PHP_FUNCTION(posix_setpgid)
-{
- long pid, pgid;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &pid, &pgid) == FAILURE)
- return;
-
- if (setpgid(pid, pgid) < 0) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int posix_getpgid(void)
- Get the process group id of the specified process (This is not a POSIX function, but a SVR4ism, so we compile conditionally) */
-#ifdef HAVE_GETPGID
-PHP_FUNCTION(posix_getpgid)
-{
- long pid;
- pid_t pgid;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pid) == FAILURE)
- return;
-
- if ((pgid = getpgid(pid)) < 0) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- RETURN_LONG(pgid);
-}
-#endif
-/* }}} */
-
-/* {{{ proto int posix_getsid(void)
- Get process group id of session leader (This is not a POSIX function, but a SVR4ism, so be compile conditionally) */
-#ifdef HAVE_GETSID
-PHP_FUNCTION(posix_getsid)
-{
- long pid;
- pid_t sid;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pid) == FAILURE)
- return;
-
- if ((sid = getsid(pid)) < 0) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- RETURN_LONG(sid);
-}
-#endif
-/* }}} */
-
-/* {{{ proto array posix_uname(void)
- Get system name (POSIX.1, 4.4.1) */
-PHP_FUNCTION(posix_uname)
-{
- struct utsname u;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- if (uname(&u) < 0) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- add_assoc_string(return_value, "sysname", u.sysname, 1);
- add_assoc_string(return_value, "nodename", u.nodename, 1);
- add_assoc_string(return_value, "release", u.release, 1);
- add_assoc_string(return_value, "version", u.version, 1);
- add_assoc_string(return_value, "machine", u.machine, 1);
-#ifdef _GNU_SOURCE
- add_assoc_string(return_value, "domainname", u.domainname, 1);
-#endif
-}
-/* }}} */
-
-/* POSIX.1, 4.5.1 time() - Get System Time
- already covered by PHP
- */
-
-/* {{{ proto array posix_times(void)
- Get process times (POSIX.1, 4.5.2) */
-PHP_FUNCTION(posix_times)
-{
- struct tms t;
- clock_t ticks;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- if((ticks = times(&t)) < 0) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- add_assoc_long(return_value, "ticks", ticks); /* clock ticks */
- add_assoc_long(return_value, "utime", t.tms_utime); /* user time */
- add_assoc_long(return_value, "stime", t.tms_stime); /* system time */
- add_assoc_long(return_value, "cutime", t.tms_cutime); /* user time of children */
- add_assoc_long(return_value, "cstime", t.tms_cstime); /* system time of children */
-}
-/* }}} */
-
-/* POSIX.1, 4.6.1 getenv() - Environment Access
- already covered by PHP
-*/
-
-/* {{{ proto string posix_ctermid(void)
- Generate terminal path name (POSIX.1, 4.7.1) */
-#ifdef HAVE_CTERMID
-PHP_FUNCTION(posix_ctermid)
-{
- char buffer[L_ctermid];
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- if (NULL == ctermid(buffer)) {
- /* Found no documentation how the defined behaviour is when this
- * function fails
- */
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- RETURN_STRING(buffer, 1);
-}
-#endif
-/* }}} */
-
-/* Checks if the provides resource is a stream and if it provides a file descriptor */
-static int php_posix_stream_get_fd(zval *zfp, int *fd TSRMLS_DC)
-{
- php_stream *stream;
-
- php_stream_from_zval_no_verify(stream, &zfp);
-
- if (stream == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 1 to be a valid stream resource");
- return 0;
- }
- if (php_stream_can_cast(stream, PHP_STREAM_AS_FD) == SUCCESS) {
- php_stream_cast(stream, PHP_STREAM_AS_FD, (void*)fd, 0);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not use stream of type '%s'",
- stream->ops->label);
- return 0;
- }
- return 1;
-}
-
-/* {{{ proto string posix_ttyname(int fd)
- Determine terminal device name (POSIX.1, 4.7.2) */
-PHP_FUNCTION(posix_ttyname)
-{
- zval *z_fd;
- char *p;
- int fd;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE)
- return;
-
- switch (Z_TYPE_P(z_fd)) {
- case IS_RESOURCE:
- if (!php_posix_stream_get_fd(z_fd, &fd TSRMLS_CC)) {
- RETURN_FALSE;
- }
- break;
- default:
- convert_to_long(z_fd);
- fd = Z_LVAL_P(z_fd);
- }
-
- if (NULL == (p = ttyname(fd))) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- RETURN_STRING(p, 1);
-}
-/* }}} */
-
-/* {{{ proto bool posix_isatty(int fd)
- Determine if filedesc is a tty (POSIX.1, 4.7.1) */
-PHP_FUNCTION(posix_isatty)
-{
- zval *z_fd;
- int fd;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE)
- return;
-
- switch (Z_TYPE_P(z_fd)) {
- case IS_RESOURCE:
- if (!php_posix_stream_get_fd(z_fd, &fd TSRMLS_CC)) {
- RETURN_FALSE;
- }
- break;
- default:
- convert_to_long(z_fd);
- fd = Z_LVAL_P(z_fd);
- }
-
- if (isatty(fd)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/*
- POSIX.1, 4.8.1 sysconf() - TODO
- POSIX.1, 5.7.1 pathconf(), fpathconf() - TODO
-
- POSIX.1, 5.1.2 opendir(), readdir(), rewinddir(), closedir()
- POSIX.1, 5.2.1 chdir()
- already supported by PHP
- */
-
-/* {{{ proto string posix_getcwd(void)
- Get working directory pathname (POSIX.1, 5.2.2) */
-PHP_FUNCTION(posix_getcwd)
-{
- char buffer[MAXPATHLEN];
- char *p;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- p = VCWD_GETCWD(buffer, MAXPATHLEN);
- if (!p) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- RETURN_STRING(buffer, 1);
-}
-/* }}} */
-
-/*
- POSIX.1, 5.3.x open(), creat(), umask()
- POSIX.1, 5.4.1 link()
- already supported by PHP.
- */
-
-/* {{{ proto bool posix_mkfifo(string pathname, int mode)
- Make a FIFO special file (POSIX.1, 5.4.2) */
-#ifdef HAVE_MKFIFO
-PHP_FUNCTION(posix_mkfifo)
-{
- char *path;
- int path_len;
- long mode;
- int result;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &path, &path_len, &mode) == FAILURE)
- return;
-
- if (PG(safe_mode) && (!php_checkuid(path, NULL, CHECKUID_ALLOW_ONLY_DIR))) {
- RETURN_FALSE;
- }
-
- result = mkfifo(path, mode);
- if (result < 0) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-#endif
-/* }}} */
-
-/* Takes a pointer to posix group and a pointer to an already initialized ZVAL
- * array container and fills the array with the posix group member data. */
-int php_posix_group_to_array(struct group *g, zval *array_group) {
- zval *array_members;
- int count;
-
- if (NULL == g)
- return 0;
-
- if (array_group == NULL || Z_TYPE_P(array_group) != IS_ARRAY)
- return 0;
-
- MAKE_STD_ZVAL(array_members);
- array_init(array_members);
-
- add_assoc_string(array_group, "name", g->gr_name, 1);
- add_assoc_string(array_group, "passwd", g->gr_passwd, 1);
- for (count=0; g->gr_mem[count] != NULL; count++) {
- add_next_index_string(array_members, g->gr_mem[count], 1);
- }
- zend_hash_update(Z_ARRVAL_P(array_group), "members", sizeof("members"), (void*)&array_members, sizeof(zval*), NULL);
- add_assoc_long(array_group, "gid", g->gr_gid);
- return 1;
-}
-
-/*
- POSIX.1, 5.5.1 unlink()
- POSIX.1, 5.5.2 rmdir()
- POSIX.1, 5.5.3 rename()
- POSIX.1, 5.6.x stat(), access(), chmod(), utime()
- already supported by PHP (access() not supported, because it is
- braindead and dangerous and gives outdated results).
-
- POSIX.1, 6.x most I/O functions already supported by PHP.
- POSIX.1, 7.x tty functions, TODO
- POSIX.1, 8.x interactions with other C language functions
- POSIX.1, 9.x system database access
- */
-
-/* {{{ proto array posix_getgrnam(string groupname)
- Group database access (POSIX.1, 9.2.1) */
-PHP_FUNCTION(posix_getgrnam)
-{
- char *name;
- struct group *g;
- int name_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE)
- return;
-
- if (NULL == (g = getgrnam(name))) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- if (!php_posix_group_to_array(g, return_value)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to convert posix group to array");
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array posix_getgrgid(long gid)
- Group database access (POSIX.1, 9.2.1) */
-PHP_FUNCTION(posix_getgrgid)
-{
- long gid;
- struct group *g;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &gid) == FAILURE)
- return;
-
- if (NULL == (g = getgrgid(gid))) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- if (!php_posix_group_to_array(g, return_value)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to convert posix group struct to array");
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-int php_posix_passwd_to_array(struct passwd *pw, zval *return_value) {
- if (NULL == pw)
- return 0;
- if (NULL == return_value || Z_TYPE_P(return_value) != IS_ARRAY)
- return 0;
-
- add_assoc_string(return_value, "name", pw->pw_name, 1);
- add_assoc_string(return_value, "passwd", pw->pw_passwd, 1);
- add_assoc_long (return_value, "uid", pw->pw_uid);
- add_assoc_long (return_value, "gid", pw->pw_gid);
- add_assoc_string(return_value, "gecos", pw->pw_gecos, 1);
- add_assoc_string(return_value, "dir", pw->pw_dir, 1);
- add_assoc_string(return_value, "shell", pw->pw_shell, 1);
- return 1;
-}
-
-/* {{{ proto array posix_getpwnam(string groupname)
- User database access (POSIX.1, 9.2.2) */
-PHP_FUNCTION(posix_getpwnam)
-{
- struct passwd *pw;
- char *name;
- int name_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE)
- return;
-
- if (NULL == (pw = getpwnam(name))) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- if (!php_posix_passwd_to_array(pw, return_value)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to convert posix passwd struct to array");
- RETURN_FALSE;
- }
-
-}
-/* }}} */
-
-/* {{{ proto array posix_getpwuid(long uid)
- User database access (POSIX.1, 9.2.2) */
-PHP_FUNCTION(posix_getpwuid)
-{
- long uid;
- struct passwd *pw;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &uid) == FAILURE)
- return;
-
- if (NULL == (pw = getpwuid(uid))) {
- POSIX_G(last_error) = errno;
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- if (!php_posix_passwd_to_array(pw, return_value)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to convert posix passwd struct to array");
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-#ifdef HAVE_GETRLIMIT
-
-#define UNLIMITED_STRING "unlimited"
-
-/* {{{ posix_addlimit
- */
-static int posix_addlimit(int limit, char *name, zval *return_value TSRMLS_DC) {
- int result;
- struct rlimit rl;
- char hard[80];
- char soft[80];
-
- snprintf(hard, 80, "hard %s", name);
- snprintf(soft, 80, "soft %s", name);
-
- result = getrlimit(limit, &rl);
- if (result < 0) {
- POSIX_G(last_error) = errno;
- return FAILURE;
- }
-
- if (rl.rlim_cur == RLIM_INFINITY) {
- add_assoc_stringl(return_value, soft, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1, 1);
- } else {
- add_assoc_long(return_value, soft, rl.rlim_cur);
- }
-
- if (rl.rlim_max == RLIM_INFINITY) {
- add_assoc_stringl(return_value, hard, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1, 1);
- } else {
- add_assoc_long(return_value, hard, rl.rlim_max);
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ limits[]
- */
-struct limitlist {
- int limit;
- char *name;
-} limits[] = {
-#ifdef RLIMIT_CORE
- { RLIMIT_CORE, "core" },
-#endif
-
-#ifdef RLIMIT_DATA
- { RLIMIT_DATA, "data" },
-#endif
-
-#ifdef RLIMIT_STACK
- { RLIMIT_STACK, "stack" },
-#endif
-
-#ifdef RLIMIT_VMEM
- { RLIMIT_VMEM, "virtualmem" },
-#endif
-
-#ifdef RLIMIT_AS
- { RLIMIT_AS, "totalmem" },
-#endif
-
-#ifdef RLIMIT_RSS
- { RLIMIT_RSS, "rss" },
-#endif
-
-#ifdef RLIMIT_NPROC
- { RLIMIT_NPROC, "maxproc" },
-#endif
-
-#ifdef RLIMIT_MEMLOCK
- { RLIMIT_MEMLOCK, "memlock" },
-#endif
-
-#ifdef RLIMIT_CPU
- { RLIMIT_CPU, "cpu" },
-#endif
-
-#ifdef RLIMIT_FSIZE
- { RLIMIT_FSIZE, "filesize" },
-#endif
-
-#ifdef RLIMIT_NOFILE
- { RLIMIT_NOFILE, "openfiles" },
-#endif
-
-#ifdef RLIMIT_OFILE
- { RLIMIT_OFILE, "openfiles" },
-#endif
-
- { 0, NULL }
-};
-/* }}} */
-
-
-/* {{{ proto int posix_getrlimit(void)
- Get system resource consumption limits (This is not a POSIX function, but a BSDism and a SVR4ism. We compile conditionally) */
-PHP_FUNCTION(posix_getrlimit)
-{
- struct limitlist *l = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- array_init(return_value);
-
- for (l=limits; l->name; l++) {
- if (posix_addlimit(l->limit, l->name, return_value TSRMLS_CC) == FAILURE)
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-#endif /* HAVE_GETRLIMIT */
-
-/* {{{ proto int posix_get_last_error(void)
- Retrieve the error number set by the last posix function which failed. */
-PHP_FUNCTION(posix_get_last_error)
-{
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
- return;
-
- RETURN_LONG(POSIX_G(last_error));
-}
-/* }}} */
-
-/* {{{ proto string posix_strerror(int errno)
- Retrieve the system error message associated with the given errno. */
-PHP_FUNCTION(posix_strerror)
-{
- long error;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &error) == FAILURE)
- return;
-
- RETURN_STRING(strerror(error), 1);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/pspell/CREDITS b/ext/pspell/CREDITS
deleted file mode 100644
index a7919d4b7c..0000000000
--- a/ext/pspell/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Pspell
-Vlad Krupin
diff --git a/ext/pspell/README b/ext/pspell/README
deleted file mode 100644
index b7d3adf198..0000000000
--- a/ext/pspell/README
+++ /dev/null
@@ -1,51 +0,0 @@
-README file for pspell (spellchecker) module for PHP4
------------------------------------------------------
-
-The latest release of pspell is always available from
-
- http://pspell.sourceforge.net/
-
-This module was developed and tested with aspell-.31.1 and pspell-.11.0.2,
-although slightly earlier (and hopefully later) versions of those libraries
-should work as well.
-
-General notes
--------------
-
-Please, note that somewhere around version .27.x (I believe) aspell stopped
-working with the aspell module for php. This is due to the fact that the
-author changed things around a bit, and suggested that people link to pspell
-in the future rather than to aspell. That's exactly what this module is for.
-It has the same basic functionality as aspell (and more features are being
-added). I did not want to modify existing aspell module, because it would
-break things for those who are using older aspell, or result in very ugly code.
-Rather, I wrote a new module - pspell.
-
-
-Building pspell on a Unix system
---------------------------------
-
-In order to use pspell, you need to have *both* aspell and pspell libraries
-installed, and they have to be compatible with each other. Get the latest
-release of both at the URL given above.
-
-I expect the libraries to be in /usr/local (that's the default when you
-cofigure pspell and aspell with their 'configure' scripts woth no parameters).
-If that location is different, please specify it in --with-pspell=PATH, where
-PATH is the path you specified for pspell libraries.
-
-Notes on personalized dictionaries
-----------------------------------
-
-It is now possible to have personalized dictionaries with pspell. This is
-achieved by opening a dictionary with pspell_new_personal() rather than
-pspell_new() and specifying the custom dictionary as the first parameter.
-The parameter probably should begin with '/' because otherwise it will
-be relative to $HOME, which is probably set to "/root". This is probably not
-what you want because you need write access for nobody to be able to write
-to a dictionary. Once the dictionary is open, you can use
-pspell_add_to_personal() to add words to the wordlist and finally
-pspell_save_wordlist() to save it.
-
-Note that at this moment pspell_save_wordlist() will return TRUE, even if
-there was an error. This will be changed once pspell library is fixed. \ No newline at end of file
diff --git a/ext/pspell/config.m4 b/ext/pspell/config.m4
deleted file mode 100644
index 8c1cbe49b7..0000000000
--- a/ext/pspell/config.m4
+++ /dev/null
@@ -1,36 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(pspell,for PSPELL support,
-[ --with-pspell[=DIR] Include PSPELL support.
- This replaces the old ASPELL extension.])
-
-if test "$PHP_PSPELL" != "no"; then
- PHP_NEW_EXTENSION(pspell, pspell.c, $ext_shared)
- if test "$PHP_PSPELL" != "yes"; then
- PSPELL_SEARCH_DIRS=$PHP_PSPELL
- else
- PSPELL_SEARCH_DIRS="/usr/local /usr"
- fi
- for i in $PSPELL_SEARCH_DIRS; do
- if test -f $i/include/pspell/pspell.h; then
- PSPELL_DIR=$i
- PSPELL_INCDIR=$i/include/pspell
- elif test -f $i/include/pspell.h; then
- PSPELL_DIR=$i
- PSPELL_INCDIR=$i/include
- fi
- done
-
- if test -z "$PSPELL_DIR"; then
- AC_MSG_ERROR(Cannot find pspell)
- fi
-
- PSPELL_LIBDIR=$PSPELL_DIR/lib
-
- AC_DEFINE(HAVE_PSPELL,1,[ ])
- PHP_SUBST(PSPELL_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(pspell, $PSPELL_LIBDIR, PSPELL_SHARED_LIBADD)
- PHP_ADD_INCLUDE($PSPELL_INCDIR)
-fi
diff --git a/ext/pspell/php_pspell.h b/ext/pspell/php_pspell.h
deleted file mode 100644
index f602978479..0000000000
--- a/ext/pspell/php_pspell.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Vlad Krupin <phpdevel@echospace.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef _PSPELL_H
-#define _PSPELL_H
-#if HAVE_PSPELL
-extern zend_module_entry pspell_module_entry;
-#define pspell_module_ptr &pspell_module_entry
-
-PHP_MINIT_FUNCTION(pspell);
-PHP_MINFO_FUNCTION(pspell);
-PHP_FUNCTION(pspell_new);
-PHP_FUNCTION(pspell_new_personal);
-PHP_FUNCTION(pspell_new_config);
-PHP_FUNCTION(pspell_check);
-PHP_FUNCTION(pspell_suggest);
-PHP_FUNCTION(pspell_store_replacement);
-PHP_FUNCTION(pspell_add_to_personal);
-PHP_FUNCTION(pspell_add_to_session);
-PHP_FUNCTION(pspell_clear_session);
-PHP_FUNCTION(pspell_save_wordlist);
-PHP_FUNCTION(pspell_config_create);
-PHP_FUNCTION(pspell_config_runtogether);
-PHP_FUNCTION(pspell_config_mode);
-PHP_FUNCTION(pspell_config_ignore);
-PHP_FUNCTION(pspell_config_personal);
-PHP_FUNCTION(pspell_config_repl);
-PHP_FUNCTION(pspell_config_save_repl);
-#else
-#define pspell_module_ptr NULL
-#endif
-
-#define phpext_pspell_ptr pspell_module_ptr
-
-#endif /* _PSPELL_H */
diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c
deleted file mode 100644
index 1d1a6436a9..0000000000
--- a/ext/pspell/pspell.c
+++ /dev/null
@@ -1,819 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Vlad Krupin <phpdevel@echospace.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#define IS_EXT_MODULE
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdio.h>
-
-#if HAVE_PSPELL
-
-/* this will enforce compatibility in .12 version (broken after .11.2) */
-#define USE_ORIGINAL_MANAGER_FUNCS
-
-#include "php_pspell.h"
-#include <pspell.h>
-#include "ext/standard/info.h"
-
-#define PSPELL_FAST 1L
-#define PSPELL_NORMAL 2L
-#define PSPELL_BAD_SPELLERS 3L
-#define PSPELL_SPEED_MASK_INTERNAL 3L
-#define PSPELL_RUN_TOGETHER 8L
-
-/* {{{ pspell_functions[]
- */
-function_entry pspell_functions[] = {
- PHP_FE(pspell_new, NULL)
- PHP_FE(pspell_new_personal, NULL)
- PHP_FE(pspell_new_config, NULL)
- PHP_FE(pspell_check, NULL)
- PHP_FE(pspell_suggest, NULL)
- PHP_FE(pspell_store_replacement, NULL)
- PHP_FE(pspell_add_to_personal, NULL)
- PHP_FE(pspell_add_to_session, NULL)
- PHP_FE(pspell_clear_session, NULL)
- PHP_FE(pspell_save_wordlist, NULL)
- PHP_FE(pspell_config_create, NULL)
- PHP_FE(pspell_config_runtogether, NULL)
- PHP_FE(pspell_config_mode, NULL)
- PHP_FE(pspell_config_ignore, NULL)
- PHP_FE(pspell_config_personal, NULL)
- PHP_FE(pspell_config_repl, NULL)
- PHP_FE(pspell_config_save_repl, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-static int le_pspell, le_pspell_config;
-
-zend_module_entry pspell_module_entry = {
- STANDARD_MODULE_HEADER,
- "pspell", pspell_functions, PHP_MINIT(pspell), NULL, NULL, NULL, PHP_MINFO(pspell), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_PSPELL
-ZEND_GET_MODULE(pspell)
-#endif
-
-static void php_pspell_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- PspellManager *manager = (PspellManager *)rsrc->ptr;
-
- delete_pspell_manager(manager);
-}
-
-static void php_pspell_close_config(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- PspellConfig *config = (PspellConfig *)rsrc->ptr;
-
- delete_pspell_config(config);
-}
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(pspell)
-{
- REGISTER_LONG_CONSTANT("PSPELL_FAST", PSPELL_FAST, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("PSPELL_NORMAL", PSPELL_NORMAL, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("PSPELL_BAD_SPELLERS", PSPELL_BAD_SPELLERS, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("PSPELL_RUN_TOGETHER", PSPELL_RUN_TOGETHER, CONST_PERSISTENT | CONST_CS);
- le_pspell = zend_register_list_destructors_ex(php_pspell_close, NULL, "pspell", module_number);
- le_pspell_config = zend_register_list_destructors_ex(php_pspell_close_config, NULL, "pspell config", module_number);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto int pspell_new(string language [, string spelling [, string jargon [, string encoding [, int mode]]]])
- Load a dictionary */
-PHP_FUNCTION(pspell_new)
-{
- zval **language,**spelling,**jargon,**encoding,**pmode;
- long mode = 0L, speed = 0L;
- int argc;
- int ind;
-
- PspellCanHaveError *ret;
- PspellManager *manager;
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 5 || zend_get_parameters_ex(argc,&language,&spelling,&jargon,&encoding,&pmode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- config = new_pspell_config();
- convert_to_string_ex(language);
- pspell_config_replace(config, "language-tag", Z_STRVAL_PP(language));
-
- if(argc > 1){
- convert_to_string_ex(spelling);
- if(Z_STRLEN_PP(spelling) > 0){
- pspell_config_replace(config, "spelling", Z_STRVAL_PP(spelling));
- }
- }
-
- if(argc > 2){
- convert_to_string_ex(jargon);
- if(Z_STRLEN_PP(jargon) > 0){
- pspell_config_replace(config, "jargon", Z_STRVAL_PP(jargon));
- }
- }
-
- if(argc > 3){
- convert_to_string_ex(encoding);
- if(Z_STRLEN_PP(encoding) > 0){
- pspell_config_replace(config, "encoding", Z_STRVAL_PP(encoding));
- }
- }
-
- if(argc > 4){
- convert_to_long_ex(pmode);
- mode = Z_LVAL_PP(pmode);
- speed = mode & PSPELL_SPEED_MASK_INTERNAL;
-
- /* First check what mode we want (how many suggestions) */
- if(speed == PSPELL_FAST){
- pspell_config_replace(config, "sug-mode", "fast");
- }else if(speed == PSPELL_NORMAL){
- pspell_config_replace(config, "sug-mode", "normal");
- }else if(speed == PSPELL_BAD_SPELLERS){
- pspell_config_replace(config, "sug-mode", "bad-spellers");
- }
-
- /* Then we see if run-together words should be treated as valid components */
- if(mode & PSPELL_RUN_TOGETHER){
- pspell_config_replace(config, "run-together", "true");
- }
- }
-
- ret = new_pspell_manager(config);
- delete_pspell_config(config);
-
- if(pspell_error_number(ret) != 0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PSPELL couldn't open the dictionary. reason: %s ", pspell_error_message(ret));
- RETURN_FALSE;
- }
-
- manager = to_pspell_manager(ret);
- ind = zend_list_insert(manager, le_pspell);
- RETURN_LONG(ind);
-}
-/* }}} */
-
-/* {{{ proto int pspell_new_personal(string personal, string language [, string spelling [, string jargon [, string encoding [, int mode]]]])
- Load a dictionary with a personal wordlist*/
-PHP_FUNCTION(pspell_new_personal)
-{
- zval **personal, **language,**spelling,**jargon,**encoding,**pmode;
- long mode = 0L, speed = 0L;
- int argc;
- int ind;
-
- PspellCanHaveError *ret;
- PspellManager *manager;
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 6 || zend_get_parameters_ex(argc,&personal,&language,&spelling,&jargon,&encoding,&pmode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- config = new_pspell_config();
-
- convert_to_string_ex(personal);
- pspell_config_replace(config, "personal", Z_STRVAL_PP(personal));
- pspell_config_replace(config, "save-repl", "false");
-
- convert_to_string_ex(language);
- pspell_config_replace(config, "language-tag", Z_STRVAL_PP(language));
-
- if(argc > 2){
- convert_to_string_ex(spelling);
- if(Z_STRLEN_PP(spelling) > 0){
- pspell_config_replace(config, "spelling", Z_STRVAL_PP(spelling));
- }
- }
-
- if(argc > 3){
- convert_to_string_ex(jargon);
- if(Z_STRLEN_PP(jargon) > 0){
- pspell_config_replace(config, "jargon", Z_STRVAL_PP(jargon));
- }
- }
-
- if(argc > 4){
- convert_to_string_ex(encoding);
- if(Z_STRLEN_PP(encoding) > 0){
- pspell_config_replace(config, "encoding", Z_STRVAL_PP(encoding));
- }
- }
-
- if(argc > 5){
- convert_to_long_ex(pmode);
- mode = Z_LVAL_PP(pmode);
- speed = mode & PSPELL_SPEED_MASK_INTERNAL;
-
- /* First check what mode we want (how many suggestions) */
- if(speed == PSPELL_FAST){
- pspell_config_replace(config, "sug-mode", "fast");
- }else if(speed == PSPELL_NORMAL){
- pspell_config_replace(config, "sug-mode", "normal");
- }else if(speed == PSPELL_BAD_SPELLERS){
- pspell_config_replace(config, "sug-mode", "bad-spellers");
- }
-
- /* Then we see if run-together words should be treated as valid components */
- if(mode & PSPELL_RUN_TOGETHER){
- pspell_config_replace(config, "run-together", "true");
- }
- }
-
- ret = new_pspell_manager(config);
- delete_pspell_config(config);
-
- if(pspell_error_number(ret) != 0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PSPELL couldn't open the dictionary. reason: %s ", pspell_error_message(ret));
- RETURN_FALSE;
- }
-
- manager = to_pspell_manager(ret);
- ind = zend_list_insert(manager, le_pspell);
-
- RETURN_LONG(ind);
-}
-/* }}} */
-
-/* {{{ proto int pspell_new_config(int config)
- Load a dictionary based on the given config */
-PHP_FUNCTION(pspell_new_config)
-{
- int type;
- zval **conf;
- int argc;
- int ind;
-
- PspellCanHaveError *ret;
- PspellManager *manager;
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 1 || zend_get_parameters_ex(argc,&conf) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(conf);
- config = (PspellConfig *) zend_list_find(Z_LVAL_PP(conf), &type);
- ret = new_pspell_manager(config);
-
- if(pspell_error_number(ret) != 0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PSPELL couldn't open the dictionary. reason: %s ", pspell_error_message(ret));
- RETURN_FALSE;
- }
-
- manager = to_pspell_manager(ret);
- ind = zend_list_insert(manager, le_pspell);
- RETURN_LONG(ind);
-}
-/* }}} */
-
-/* {{{ proto int pspell_check(int pspell, string word)
- Returns true if word is valid */
-PHP_FUNCTION(pspell_check)
-{
- int type;
- zval **scin,**word;
- PspellManager *manager;
-
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(scin);
- convert_to_string_ex(word);
- manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
- if(!manager){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin));
- RETURN_FALSE;
- }
-
- if(pspell_manager_check(manager, Z_STRVAL_PP(word))){
- RETURN_TRUE;
- }else{
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array pspell_suggest(int pspell, string word)
- Returns array of suggestions */
-PHP_FUNCTION(pspell_suggest)
-{
- zval **scin, **word;
- int argc;
- PspellManager *manager;
- int type;
- const PspellWordList *wl;
- const char *sug;
-
- argc = ZEND_NUM_ARGS();
- if(argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(scin);
- convert_to_string_ex(word);
- manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
- if(!manager){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin));
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- wl = pspell_manager_suggest(manager, Z_STRVAL_PP(word));
- if(wl){
- PspellStringEmulation *els = pspell_word_list_elements(wl);
- while((sug = pspell_string_emulation_next(els)) != 0){
- add_next_index_string(return_value,(char *)sug,1);
- }
- delete_pspell_string_emulation(els);
- }else{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PSPELL had a problem. details: %s ", pspell_manager_error_message(manager));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int pspell_store_replacement(int pspell, string misspell, string correct)
- Notify the dictionary of a user-selected replacement */
-PHP_FUNCTION(pspell_store_replacement)
-{
- int type;
- zval **scin,**miss,**corr;
- PspellManager *manager;
-
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 3 || zend_get_parameters_ex(argc, &scin,&miss,&corr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(scin);
- convert_to_string_ex(miss);
- convert_to_string_ex(corr);
- manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
- if(!manager){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin));
- RETURN_FALSE;
- }
-
- pspell_manager_store_replacement(manager, Z_STRVAL_PP(miss), Z_STRVAL_PP(corr));
- if(pspell_manager_error_number(manager) == 0){
- RETURN_TRUE;
- }else{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "pspell_store_replacement() gave error: %s", pspell_manager_error_message(manager));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int pspell_add_to_personal(int pspell, string word)
- Adds a word to a personal list */
-PHP_FUNCTION(pspell_add_to_personal)
-{
- int type;
- zval **scin,**word;
- PspellManager *manager;
-
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(scin);
- convert_to_string_ex(word);
- manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
- if(!manager){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin));
- RETURN_FALSE;
- }
-
- /*If the word is empty, we have to return; otherwise we'll segfault! ouch!*/
- if(Z_STRLEN_PP(word) == 0){
- RETURN_FALSE;
- }
-
- pspell_manager_add_to_personal(manager, Z_STRVAL_PP(word));
- if(pspell_manager_error_number(manager) == 0){
- RETURN_TRUE;
- }else{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "pspell_add_to_personal() gave error: %s", pspell_manager_error_message(manager));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int pspell_add_to_session(int pspell, string word)
- Adds a word to the current session */
-PHP_FUNCTION(pspell_add_to_session)
-{
- int type;
- zval **scin,**word;
- PspellManager *manager;
-
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(scin);
- convert_to_string_ex(word);
- manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
- if(!manager){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin));
- RETURN_FALSE;
- }
-
- /*If the word is empty, we have to return; otherwise we'll segfault! ouch!*/
- if(Z_STRLEN_PP(word) == 0){
- RETURN_FALSE;
- }
-
- pspell_manager_add_to_session(manager, Z_STRVAL_PP(word));
- if(pspell_manager_error_number(manager) == 0){
- RETURN_TRUE;
- }else{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "pspell_add_to_session() gave error: %s", pspell_manager_error_message(manager));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int pspell_clear_session(int pspell)
- Clears the current session */
-PHP_FUNCTION(pspell_clear_session)
-{
- int type;
- zval **scin;
- PspellManager *manager;
-
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 1 || zend_get_parameters_ex(argc, &scin) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(scin);
- manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
- if(!manager){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin));
- RETURN_FALSE;
- }
-
- pspell_manager_clear_session(manager);
- if(pspell_manager_error_number(manager) == 0){
- RETURN_TRUE;
- }else{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "pspell_clear_session() gave error: %s", pspell_manager_error_message(manager));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int pspell_save_wordlist(int pspell)
- Saves the current (personal) wordlist */
-PHP_FUNCTION(pspell_save_wordlist)
-{
- int type;
- zval **scin;
- PspellManager *manager;
-
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 1 || zend_get_parameters_ex(argc, &scin) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(scin);
- manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
- if(!manager){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin));
- RETURN_FALSE;
- }
-
- pspell_manager_save_all_word_lists(manager);
-
- if(pspell_manager_error_number(manager) == 0){
- RETURN_TRUE;
- }else{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "pspell_save_wordlist() gave error: %s", pspell_manager_error_message(manager));
- RETURN_FALSE;
- }
-
-}
-/* }}} */
-
-/* {{{ proto int pspell_config_create(string language [, string spelling [, string jargon [, string encoding]]])
- Create a new config to be used later to create a manager */
-PHP_FUNCTION(pspell_config_create)
-{
- zval **language,**spelling,**jargon,**encoding;
- int argc;
- int ind;
-
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 4 || zend_get_parameters_ex(argc,&language,&spelling,&jargon,&encoding) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- config = new_pspell_config();
- convert_to_string_ex(language);
- pspell_config_replace(config, "language-tag", Z_STRVAL_PP(language));
-
- if(argc > 1){
- convert_to_string_ex(spelling);
- if(Z_STRLEN_PP(spelling) > 0){
- pspell_config_replace(config, "spelling", Z_STRVAL_PP(spelling));
- }
- }
-
- if(argc > 2){
- convert_to_string_ex(jargon);
- if(Z_STRLEN_PP(jargon) > 0){
- pspell_config_replace(config, "jargon", Z_STRVAL_PP(jargon));
- }
- }
-
- if(argc > 3){
- convert_to_string_ex(encoding);
- if(Z_STRLEN_PP(encoding) > 0){
- pspell_config_replace(config, "encoding", Z_STRVAL_PP(encoding));
- }
- }
-
- /* By default I do not want to write anything anywhere because it'll try to write to $HOME
- which is not what we want */
- pspell_config_replace(config, "save-repl", "false");
-
- ind = zend_list_insert(config, le_pspell_config);
- RETURN_LONG(ind);
-}
-/* }}} */
-
-/* {{{ proto int pspell_config_runtogether(int conf, bool runtogether)
- Consider run-together words as valid components */
-PHP_FUNCTION(pspell_config_runtogether)
-{
- int type;
- zval **sccin, **runtogether;
- int argc;
-
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&runtogether) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sccin);
- config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
- if(!config){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin));
- RETURN_FALSE;
- }
-
- convert_to_boolean_ex(runtogether);
- pspell_config_replace(config, "run-together", Z_LVAL_PP(runtogether) ? "true" : "false");
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pspell_config_mode(int conf, long mode)
- Select mode for config (PSPELL_FAST, PSPELL_NORMAL or PSPELL_BAD_SPELLERS) */
-PHP_FUNCTION(pspell_config_mode)
-{
- int type;
- zval **sccin, **mode;
- int argc;
-
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&mode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sccin);
- config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
- if(!config){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin));
- RETURN_FALSE;
- }
-
- convert_to_long_ex(mode);
-
- /* First check what mode we want (how many suggestions) */
- if(Z_LVAL_PP(mode) == PSPELL_FAST){
- pspell_config_replace(config, "sug-mode", "fast");
- }else if(Z_LVAL_PP(mode) == PSPELL_NORMAL){
- pspell_config_replace(config, "sug-mode", "normal");
- }else if(Z_LVAL_PP(mode) == PSPELL_BAD_SPELLERS){
- pspell_config_replace(config, "sug-mode", "bad-spellers");
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pspell_config_ignore(int conf, int ignore)
- Ignore words <= n chars */
-PHP_FUNCTION(pspell_config_ignore)
-{
- int type;
- zval **sccin, **pignore;
- int argc;
-
- /* Hack. But I cannot imagine any word being more than 999 characters long */
- int loc = 3;
- char ignore_str[loc + 1];
- long ignore = 0L;
-
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&pignore) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sccin);
- config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
- if(!config){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin));
- RETURN_FALSE;
- }
-
- convert_to_long_ex(pignore);
- ignore = Z_LVAL_PP(pignore);
-
- /* The following is a very hackish way to convert a long to a string
- (actually only the numbers 0-999 will get converted properly, but that should
- be sufficient). If anyone knows of a better way to convert an integer to a string,
- please, fix it.*/
- ignore_str[loc] = '\0';
- while(ignore > 0){
- if(loc == 0){
- break;
- }
- ignore_str[--loc] = '0' + (ignore % 10);
- ignore /= 10;
- }
- if(ignore_str[loc] == '\0'){
- ignore_str[--loc] = '0';
- }
-
- pspell_config_replace(config, "ignore", &ignore_str[loc]);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pspell_config_personal(int conf, string personal)
- Use a personal dictionary for this config */
-PHP_FUNCTION(pspell_config_personal)
-{
- int type;
- zval **sccin, **personal;
- int argc;
-
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&personal) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sccin);
- config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
- if(!config){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin));
- RETURN_FALSE;
- }
-
- convert_to_string_ex(personal);
- pspell_config_replace(config, "personal", Z_STRVAL_PP(personal));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pspell_config_repl(int conf, string repl)
- Use a personal dictionary with replacement pairs for this config */
-PHP_FUNCTION(pspell_config_repl)
-{
- int type;
- zval **sccin, **repl;
- int argc;
-
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&repl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sccin);
- config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
- if(!config){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin));
- RETURN_FALSE;
- }
-
- pspell_config_replace(config, "save-repl", "true");
-
- convert_to_string_ex(repl);
- pspell_config_replace(config, "repl", Z_STRVAL_PP(repl));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pspell_config_save_repl(int conf, bool save)
- Save replacement pairs when personal list is saved for this config */
-PHP_FUNCTION(pspell_config_save_repl)
-{
- int type;
- zval **sccin, **save;
- int argc;
-
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&save) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sccin);
- config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
- if(!config){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin));
- RETURN_FALSE;
- }
-
- convert_to_boolean_ex(save);
- pspell_config_replace(config, "save-repl", Z_LVAL_PP(save) ? "true" : "false");
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(pspell)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "PSpell Support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/pspell/tests/01pspell_basic.phpt b/ext/pspell/tests/01pspell_basic.phpt
deleted file mode 100644
index 5efccab8fa..0000000000
--- a/ext/pspell/tests/01pspell_basic.phpt
+++ /dev/null
@@ -1,143 +0,0 @@
---TEST--
-pspell basic tests
---SKIPIF--
-<?php
- if (!extension_loaded("pspell")) print "skip";
- if (!@pspell_new ("en", "", "", "", (PSPELL_FAST|PSPELL_RUN_TOGETHER))) {
- die("skip English dictionary is not avaliable");
- }
-?>
---POST--
---GET--
---FILE--
-<?php // $Id$
-
-error_reporting(E_ALL);
-$string = "";
-$string .= "I will not buy this record, it is scratched. ";
-$string .= "Sorry ";
-$string .= "I will not buy this record, it is scratched. ";
-$string .= "Uh, no, no, no. This is a tobacconist's ";
-$string .= "Ah! I will not buy this tobacconist's, it is scratched. ";
-$string .= "No, no, no, no. Tobacco... um... cigarettes (holds up a pack). ";
-$string .= "Ya! See-gar-ets! Ya! Uh... My hovercraft is full of eels. ";
-$string .= "Sorry? ";
-$string .= "My hovercraft (pantomimes puffing a cigarette)... is full of eels (pretends to strike a match). ";
-$string .= "Ahh, matches!";
-
-$pspell = pspell_new ("en", "", "", "", (PSPELL_FAST|PSPELL_RUN_TOGETHER));
-$array = explode(' ',preg_replace('/[^a-zA-Z0-9 ]/','',$string));
-for($i=0,$u=count($array);$i<$u;++$i) {
- echo $array[$i].' : ';
- if (!pspell_check($pspell, $array[$i])) {
- echo "..false\n";
- $suggestions = pspell_suggest ($pspell, $array[$i]);
-
- foreach ($suggestions as $suggestion) {
- echo "Possible spelling: $suggestion\n";
- }
- } else {
- echo "true\n";
- }
-}
-
---EXPECT--
-I : true
-will : true
-not : true
-buy : true
-this : true
-record : true
-it : true
-is : true
-scratched : true
-Sorry : true
-I : true
-will : true
-not : true
-buy : true
-this : true
-record : true
-it : true
-is : true
-scratched : true
-Uh : true
-no : true
-no : true
-no : true
-This : true
-is : true
-a : true
-tobacconists : true
-Ah : true
-I : true
-will : true
-not : true
-buy : true
-this : true
-tobacconists : true
-it : true
-is : true
-scratched : true
-No : true
-no : true
-no : true
-no : true
-Tobacco : true
-um : true
-cigarettes : true
-holds : true
-up : true
-a : true
-pack : true
-Ya : true
-Seegarets : ..false
-Possible spelling: Secrets
-Possible spelling: Regrets
-Possible spelling: Secretes
-Possible spelling: Egrets
-Possible spelling: Serrates
-Possible spelling: Segre's
-Possible spelling: Seagate's
-Possible spelling: Regreets
-Possible spelling: Segregates
-Possible spelling: Sergeants
-Possible spelling: Sugariest
-Possible spelling: Garrets
-Possible spelling: Socrates
-Possible spelling: Egret's
-Possible spelling: Separates
-Possible spelling: Cigarettes
-Possible spelling: Sugared
-Possible spelling: Scarlets
-Ya : true
-Uh : true
-My : true
-hovercraft : true
-is : true
-full : true
-of : true
-eels : true
-Sorry : true
-My : true
-hovercraft : true
-pantomimes : true
-puffing : true
-a : true
-cigarette : true
-is : true
-full : true
-of : true
-eels : true
-pretends : true
-to : true
-strike : true
-a : true
-match : true
-Ahh : ..false
-Possible spelling: Shh
-Possible spelling: Ah
-Possible spelling: Aha
-Possible spelling: Ash
-Possible spelling: Ha
-matches : true
diff --git a/ext/qtdom/CREDITS b/ext/qtdom/CREDITS
deleted file mode 100644
index efeff5dbf9..0000000000
--- a/ext/qtdom/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-qtdom
-Jan Borsodi
diff --git a/ext/qtdom/EXPERIMENTAL b/ext/qtdom/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/qtdom/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/qtdom/config.m4 b/ext/qtdom/config.m4
deleted file mode 100644
index 6c6a731347..0000000000
--- a/ext/qtdom/config.m4
+++ /dev/null
@@ -1,37 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(qtdom, for QtDOM support,
-[ --with-qtdom Include QtDOM support (requires Qt >= 2.2.0).])
-
-if test "$PHP_QTDOM" != "no"; then
- case $PHP_QTDOM in
- yes)
- if test -f $QTDIR/include/qdom.h; then
- QTDOM_LIBDIR=$QTDIR/lib
- QTDOM_INCDIR=$QTDIR/include
- elif test -f /usr/lib/qt2/include/qdom.h; then
- QTDOM_LIBDIR=/usr/lib
- QTDOM_INCDIR=/usr/lib/qt2/include
- fi
- ;;
- *)
- if test -f $PHP_QTDOM/include/qdom.h; then
- QTDOM_LIBDIR=$PHP_QTDOM/lib
- QTDOM_INCDIR=$PHP_QTDOM/include
- fi
- ;;
- esac
-
- if test -z "$QTDOM_INCDIR"; then
- AC_MSG_ERROR([qdom.h not found.])
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(qt, $QTDOM_LIBDIR, QTDOM_SHARED_LIBADD)
- PHP_ADD_INCLUDE($QTDOM_INCDIR)
- PHP_NEW_EXTENSION(qtdom, qtdom.c qtdom_qt.cpp, $ext_shared)
- PHP_SUBST(QTDOM_SHARED_LIBADD)
- AC_DEFINE(HAVE_QTDOM, 1, [Whether you have qtdom])
- PHP_REQUIRE_CXX
-fi
diff --git a/ext/qtdom/qtdom.c b/ext/qtdom/qtdom.c
deleted file mode 100644
index 77773d65fc..0000000000
--- a/ext/qtdom/qtdom.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jan Borsodi |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "qtdom.h"
-#include "qtdom_qt.h"
-
-#if HAVE_QTDOM
-
-static zend_function_entry qdomdoc_class_functions[] = {
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry qdomnode_class_functions[] = {
- {NULL, NULL, NULL}
-};
-
-/* If you declare any globals in php_qtdom.h uncomment this:
-ZEND_DECLARE_MODULE_GLOBALS(qtdom)
-*/
-
-/* True global resources - no need for thread safety here */
-static int le_qtdom;
-
-/* Every user visible function must have an entry in qtdom_functions[].
-*/
-function_entry qtdom_functions[] = {
- PHP_FE(qdom_tree, NULL)
- PHP_FE(qdom_error, NULL)
- {NULL, NULL, NULL} /* Must be the last line in qtdom_functions[] */
-};
-
-zend_module_entry qtdom_module_entry = {
- STANDARD_MODULE_HEADER,
- "qtdom",
- qtdom_functions,
- PHP_MINIT(qtdom),
- PHP_MSHUTDOWN(qtdom),
- NULL,
- NULL,
- PHP_MINFO(qtdom),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_QTDOM
-ZEND_GET_MODULE(qtdom)
-#endif
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(qtdom)
-{
- zend_class_entry qdomdoc_class_entry;
- zend_class_entry qdomnode_class_entry;
-
- INIT_CLASS_ENTRY(qdomdoc_class_entry, "QDomDocument", qdomdoc_class_functions);
- INIT_CLASS_ENTRY(qdomnode_class_entry, "QDomNode", qdomnode_class_functions);
-
- qdomdoc_class_entry_ptr = zend_register_internal_class(&qdomdoc_class_entry TSRMLS_CC);
- qdomnode_class_entry_ptr = zend_register_internal_class(&qdomnode_class_entry TSRMLS_CC);
-
- qdom_init();
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(qtdom)
-{
- qdom_shutdown();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(qtdom)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "qtdom support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ qdom_find_attributes
- * Helper function for creating the attributes, returns the number
- * of attributes found or -1 if an error occured */
-static int qdom_find_attributes( zval **children, struct qdom_attribute *attr TSRMLS_DC)
-{
- zval *child;
- struct qdom_node *node;
- int count;
- int i;
- count = 0;
-
- MAKE_STD_ZVAL(*children);
- array_init(*children);
- for ( i = 0; i < attr->Count; ++i )
- {
- node = qdom_do_attribute_at( attr, i );
-
- MAKE_STD_ZVAL(child);
- object_init_ex(child, qdomnode_class_entry_ptr);
- zend_hash_next_index_insert(Z_ARRVAL_PP(children), &child, sizeof(zval *), NULL);
- add_property_stringl(child, "name", (char *) node->Name, strlen(node->Name), 1);
- add_property_long(child, "type", node->Type);
- add_property_stringl(child, "content", (char *) node->Content, strlen(node->Content), 1);
-
- qdom_do_node_free( node );
- ++count;
- }
-
- return count;
-}
-/* }}} */
-
-/* {{{ qdom_find_children
- Helper function for recursively going trough the QDomNode tree and creating
- the same in PHP objects. Returns the number of children or -1 if an error
- occured. */
-static int qdom_find_children( zval **children, struct qdom_node *orig_node TSRMLS_DC)
-{
- zval *child;
- struct qdom_node *node, *tmp_node, *child_node;
- int count;
-
- zval *n_children, *a_children;
- count = 0;
-
- node = qdom_do_copy_node( orig_node );
- tmp_node = node;
-/* node = orig_node; */
-
- MAKE_STD_ZVAL(*children);
- array_init(*children);
- while( node )
- {
- int num_childs, num_attrs;
-
- MAKE_STD_ZVAL(child);
- object_init_ex(child, qdomnode_class_entry_ptr);
- zend_hash_next_index_insert(Z_ARRVAL_PP(children), &child, sizeof(zval *), NULL);
- add_property_stringl(child, "name", (char *) node->Name, strlen(node->Name), 1);
- add_property_long(child, "type", node->Type);
- if ( node->Type == 2 || node->Type == 3 || node->Type == 4 )
- add_property_stringl(child, "content", (char *) node->Content, strlen(node->Content), 1);
-
- num_attrs = qdom_do_node_attribute_count( node );
- if ( num_attrs > 0 )
- {
- struct qdom_attribute *attr = qdom_do_node_attributes( node );
- if ( qdom_find_attributes( &a_children, attr TSRMLS_CC) > 0 )
- {
- zend_hash_update(Z_OBJPROP_P(child), "attributes", sizeof("attributes"),
- (void *) &a_children, sizeof(zval *), NULL);
- }
- qdom_do_attributes_free( attr );
-/* add_property_long(child, "attributes", num_attrs ); */
- }
-
- num_childs = qdom_do_node_children_count( node );
- if ( num_childs > 0 )
- {
- child_node = qdom_do_copy_node( node );
- child_node = qdom_do_first_child( child_node );
- if ( qdom_find_children( &n_children, child_node TSRMLS_CC) > 0 )
- {
- zend_hash_update(Z_OBJPROP_P(child), "children", sizeof("children"), (void *) &n_children, sizeof(zval *), NULL);
- }
- qdom_do_node_free( child_node );
- }
-
- node = qdom_do_next_node( node );
- ++count;
- }
- qdom_do_node_free( tmp_node );
- return count;
-}
-/* }}} */
-
-/* {{{ proto object qdom_tree( string )
- creates a tree of an xml string */
-PHP_FUNCTION(qdom_tree)
-{
- zval **arg;
- char qt_ver1[200];
- char *qt_ver = qt_ver1;
- char *qdom_type_name;
- struct qdom_doc *doc;
- struct qdom_node *node;
- zval *children;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- qdom_do_install_message_handler();
-
- qdom_do_version( &qt_ver );
-
- object_init_ex(return_value, qdomdoc_class_entry_ptr);
- add_property_stringl(return_value, "version", (char *) qt_ver, strlen(qt_ver), 1);
-
- doc = qdom_do_init( Z_STRVAL_PP(arg) );
-
- qdom_do_doc_type( doc, &qdom_type_name );
-
- if ( qdom_type_name )
- add_property_stringl(return_value, "doctype", (char *) qdom_type_name, strlen(qdom_type_name), 1);
-
- node = doc->Children;
- if ( qdom_find_children( &children, node TSRMLS_CC) > 0 )
- {
- add_property_long(return_value, "type", node->Type);
- zend_hash_update(Z_OBJPROP_P(return_value), "children", sizeof("children"), (void *) &children, sizeof(zval *), NULL);
- }
-
- qdom_do_free( doc );
- qdom_do_free_message_handler();
-}
-/* }}} */
-
-/* {{{ proto string qdom_error()
- Returns the error string from the last QDOM operation or FALSE if no errors occured.*/
-PHP_FUNCTION(qdom_error)
-{
- char *error = qdom_error_log();
- if ( error == 0 )
- RETURN_FALSE;
- RETURN_STRING( error, 1 );
-}
-/* }}} */
-
-#endif /* HAVE_QTDOM */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/qtdom/qtdom.h b/ext/qtdom/qtdom.h
deleted file mode 100644
index 1a2fa1c2a5..0000000000
--- a/ext/qtdom/qtdom.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jan Borsodi |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_QTDOM_H
-#define PHP_QTDOM_H
-
-#if HAVE_QTDOM
-
-extern zend_module_entry qtdom_module_entry;
-#define phpext_qtdom_ptr &qtdom_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_QTDOM_API __declspec(dllexport)
-#else
-#define PHP_QTDOM_API
-#endif
-
-static zend_class_entry *qdomdoc_class_entry_ptr;
-static zend_class_entry *qdomnode_class_entry_ptr;
-
-PHP_MINIT_FUNCTION(qtdom);
-PHP_MSHUTDOWN_FUNCTION(qtdom);
-PHP_RINIT_FUNCTION(qtdom);
-PHP_RSHUTDOWN_FUNCTION(qtdom);
-PHP_MINFO_FUNCTION(qtdom);
-
-PHP_FUNCTION(qdom_tree);
-PHP_FUNCTION(qdom_error);
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-
-ZEND_BEGIN_MODULE_GLOBALS(qtdom)
- int global_variable;
-ZEND_END_MODULE_GLOBALS(qtdom)
-*/
-
-#ifdef ZTS
-# define QTDOMG(v) TSRMG(qtdom_globals_id, zend_qtdom_globals *, v)
-#else
-# define QTDOMG(v) (qtdom_globals.v)
-#endif
-
-#else
-
-#define phpext_qtdom_ptr NULL
-
-#endif
-
-#endif /* PHP_QTDOM_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/qtdom/qtdom.php b/ext/qtdom/qtdom.php
deleted file mode 100644
index 8db4e649b3..0000000000
--- a/ext/qtdom/qtdom.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?
-$module = 'qtdom';
-$function = 'confirm_' . $module . '_compiled';
-if (extension_loaded($module)) {
- $str = $function($module);
-} else {
- $str = "Module $module is not compiled into PHP";
-}
-echo "$str\n";
-?>
diff --git a/ext/qtdom/qtdom_qt.cpp b/ext/qtdom/qtdom_qt.cpp
deleted file mode 100644
index 6cc5050e49..0000000000
--- a/ext/qtdom/qtdom_qt.cpp
+++ /dev/null
@@ -1,371 +0,0 @@
-//
-// $Id$
-//
-// Jan Borsodi <jb@ez.no>
-// Created on: <09-Nov-2000 11:18:46 root>
-//
-
-
-extern "C"
-{
-//#include "php.h"
-//#include "php_ini.h"
-//#include "php_qtdom.h"
-#include "qtdom_qt.h"
-}
-
-
-//#if HAVE_QTDOM
-
-#include <qdom.h>
-#include <qstring.h>
-#include <qglobal.h>
-
-struct qdom_node *qdom_to_node( QDomNode *node );
-
-/*!
- Initialises certain global variables, they are:
- g_qdom_message_log : A global variable for handling error logs and message handler function.
-*/
-
-extern "C" void qdom_init()
-{
- g_qdom_message_log = new qdom_message;
- g_qdom_message_log->Log = 0;
- g_qdom_message_log->OldHandler = 0;
-}
-
-/*!
- Frees global variables initialised in the init function.
-*/
-
-extern "C" void qdom_shutdown()
-{
- if ( g_qdom_message_log->Log )
- delete []g_qdom_message_log->Log;
- delete g_qdom_message_log;
- g_qdom_message_log = 0;
-}
-
-/*!
- Copies the version number for Qt into the \c ver variable,
- the variable must be allocated by user and must have enough characters (20 should suffice).
-*/
-
-extern "C" void qdom_do_version( char **ver )
-{
- strcpy( *ver, QT_VERSION_STR );
-}
-
-/*!
- Moves the DOM node to the next sibling if any and returns the node.
-*/
-
-extern "C" struct qdom_node *qdom_do_next_node( struct qdom_node *node )
-{
- QDomNode *q_node = (QDomNode *)node->Q_Node;
- if ( !q_node )
- return 0;
-
- if ( q_node->isNull() )
- return 0;
- *q_node = q_node->nextSibling();
- if ( q_node->isNull() )
- return 0;
-
- node->Type = q_node->nodeType();
- const char *name = q_node->nodeName().latin1();
- node->Name = new char[q_node->nodeName().length()+1];
- strcpy( node->Name, name );
- const char *content = q_node->nodeValue().latin1();
- node->Content = new char[q_node->nodeValue().length()+1];
- strcpy( node->Content, content );
-
- return node;
-}
-
-/*!
- Finds the first child of the current node and returns it if any.
-*/
-
-extern "C" struct qdom_node *qdom_do_first_child( struct qdom_node *node )
-{
- QDomNode *q_node = (QDomNode *)node->Q_Node;
- if ( !q_node )
- return 0;
-
- if ( q_node->isNull() )
- return 0;
- *q_node = q_node->firstChild();
- if ( q_node->isNull() )
- return 0;
-
- node->Type = q_node->nodeType();
- const char *name = q_node->nodeName().latin1();
- node->Name = new char[q_node->nodeName().length()+1];
- strcpy( node->Name, name );
- const char *content = q_node->nodeValue().latin1();
- node->Content = new char[q_node->nodeValue().length()+1];
- strcpy( node->Content, content );
-
- return node;
-}
-
-/*!
- Returns the number of the children for the current node.
-*/
-
-extern "C" int qdom_do_node_children_count( struct qdom_node *node )
-{
- if ( !node )
- return 0;
- QDomNode *q_node = (QDomNode *)node->Q_Node;
- if ( !q_node )
- return 0;
- return q_node->childNodes().count();
-}
-
-/*!
- Returns the number of attributes for the current node.
-*/
-
-extern "C" int qdom_do_node_attribute_count( struct qdom_node *node )
-{
- if ( !node )
- return 0;
- QDomNode *q_node = (QDomNode *)node->Q_Node;
- if ( !q_node )
- return 0;
- return q_node->attributes().length();
-}
-
-/*!
- Returns the attribute map for the current node.
-*/
-
-extern "C" struct qdom_attribute *qdom_do_node_attributes( struct qdom_node *node )
-{
- struct qdom_attribute *attr = new struct qdom_attribute;
- QDomNode *q_node = (QDomNode *)node->Q_Node;
- QDomNamedNodeMap *map = new QDomNamedNodeMap( q_node->attributes() );
- attr->Q_Node = map;
- attr->Count = map->length();
- return attr;
-}
-
-/*!
- Returns the node at a given index taken from the attribute list if any.
-*/
-
-extern "C" struct qdom_node *qdom_do_attribute_at( struct qdom_attribute *attr, int index )
-{
- if ( !attr )
- return 0;
- QDomNamedNodeMap *map = (QDomNamedNodeMap *)attr->Q_Node;
- if ( index < 0 || index >= map->length() )
- return 0;
- QDomNode node = map->item( index );
- return qdom_to_node( &node );
-}
-
-/*!
- Frees an attribute map.
-*/
-
-extern "C" void qdom_do_attributes_free( struct qdom_attribute *attr )
-{
- if ( !attr )
- return;
- QDomNamedNodeMap *map = (QDomNamedNodeMap *)attr->Q_Node;
- delete map;
- delete attr;
-}
-
-/*!
- Makes a copy of a node.
-*/
-
-extern "C" struct qdom_node *qdom_do_copy_node( struct qdom_node *node )
-{
- if ( !node )
- return 0;
- struct qdom_node *tmp = new struct qdom_node;
- if ( node->Name )
- {
- tmp->Name = new char[strlen(node->Name)+1];
- strcpy( tmp->Name, node->Name );
- }
- else
- tmp->Name = 0;
- if ( node->Content )
- {
- tmp->Content = new char[strlen(node->Content)+1];
- strcpy( tmp->Content, node->Content );
- }
- else
- tmp->Content = 0;
- if ( node->Q_Node )
- {
- QDomNode *q_node = (QDomNode *)node->Q_Node;
- tmp->Q_Node = new QDomNode( *q_node );
- }
- else
- tmp->Q_Node = 0;
- tmp->Type = node->Type;
- return tmp;
-}
-
-/*!
- Frees a node.
-*/
-
-extern "C" void qdom_do_node_free( struct qdom_node *node )
-{
- if ( !node )
- return;
- delete []node->Name;
- delete []node->Content;
- QDomNode *q_node = (QDomNode *)node->Q_Node;
- delete q_node;
- delete node;
-}
-
-/*!
- Wraps a qdom_node struct around a QDomNode object which can be used by the C code.
-*/
-
-struct qdom_node *qdom_to_node( QDomNode *node )
-{
- if ( !node )
- return 0;
- qdom_node *q_node = new struct qdom_node;
- q_node->Type = node->nodeType();
- const char *name = node->nodeName().latin1();
- q_node->Name = new char[node->nodeName().length()+1];
- strcpy( q_node->Name, name );
- const char *content = node->nodeValue().latin1();
- q_node->Content = new char[node->nodeValue().length()+1];
- strcpy( q_node->Content, content );
- q_node->Q_Node = new QDomNode( *node );
- return q_node;
-}
-
-/*!
- Copies the doctype name taken from the the qdom_doc object to the
- \c name variable, the variable is initialised by the function.
-*/
-
-extern "C" void qdom_do_doc_type( struct qdom_doc *doc, char **name )
-{
- if ( !doc )
- {
- *name = 0;
- return;
- }
- QDomDocument *document = (QDomDocument *)doc->Document;
- QString str = document->doctype().name();
- const char *q_name = str.latin1();
- if ( q_name )
- {
- *name = new char[strlen(q_name)+1];
- strcpy( *name, q_name );
- }
- else
- {
- *name = 0;
- }
-}
-
-/*!
- Initialises a qdom_doc struct with the string taken from \c arg.
-*/
-
-extern "C" struct qdom_doc *qdom_do_init( const char *arg )
-{
- struct qdom_doc *doc = new struct qdom_doc;
- QDomDocument *document = new QDomDocument();
- document->setContent( QString( arg ) );
- QDomNode *node = new QDomNode;
- *node = document->documentElement();
- doc->Document = document;
- doc->CurrentNode = node;
- doc->Children = qdom_to_node( node );
- return doc;
-}
-
-/*!
- Frees a qdom_doc struct.
-*/
-
-extern "C" void qdom_do_free( struct qdom_doc *doc )
-{
- QDomNode *node = (QDomNode *)doc->CurrentNode;
- QDomDocument *document = (QDomDocument *)doc->Document;
- delete document;
- delete node;
- delete doc->Children;
- delete doc;
-}
-
-/*!
- The custom message output used for catching Qt error messages when parsing with QDOM.
-*/
-
-void qdom_messageOutput( QtMsgType , const char *msg )
-{
- if ( !g_qdom_message_log )
- return;
- int msg_len = strlen( msg );
- int log_len = 0;
- if ( g_qdom_message_log->Log )
- log_len = strlen( g_qdom_message_log->Log );
- int total_len = log_len+msg_len+2;
- char *log = new char[total_len];
- if ( g_qdom_message_log->Log )
- strncpy( log, g_qdom_message_log->Log, log_len );
- strncpy( log+log_len, msg, msg_len );
- log[log_len+msg_len] = '\n';
- log[total_len - 1] = '\0';
- if ( g_qdom_message_log->Log )
- delete []g_qdom_message_log->Log;
- g_qdom_message_log->Log = log;
-}
-
-/*!
- Installs the custom message handler and clears the log entries.
-*/
-
-extern "C" void qdom_do_install_message_handler()
-{
- if ( !g_qdom_message_log )
- g_qdom_message_log = new qdom_message;
- msg_handler *old_handler = new msg_handler;
- g_qdom_message_log->OldHandler = (void *)old_handler;
- if ( g_qdom_message_log->Log )
- delete []g_qdom_message_log->Log;
- g_qdom_message_log->Log = 0;
- *old_handler = qInstallMsgHandler( qdom_messageOutput );
-}
-
-/*!
- Frees the custom message handler.
-*/
-
-extern "C" void qdom_do_free_message_handler()
-{
- msg_handler *old_handler = (msg_handler *)g_qdom_message_log->OldHandler;
- qInstallMsgHandler( *old_handler );
-}
-
-/*!
- Returns the string containg the error log, or 0 if no log is available.
-*/
-
-extern "C" char *qdom_error_log()
-{
- if ( !g_qdom_message_log )
- return 0;
- return g_qdom_message_log->Log;
-}
-
-//#endif // HAVE_QTDOM
diff --git a/ext/qtdom/qtdom_qt.h b/ext/qtdom/qtdom_qt.h
deleted file mode 100644
index 97d83acea1..0000000000
--- a/ext/qtdom/qtdom_qt.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// -*- Mode: C++ -*-
-//
-// $Id$
-//
-// Created on: <09-Nov-2000 12:00:24 root>
-//
-
-#ifndef QDOM_QT_H
-#define QDOM_QT_H
-
-struct qdom_node
-{
- int Type;
- char *Name;
- char *Content;
- void *Q_Node;
-};
-
-struct qdom_attribute
-{
- int Count;
- void *Q_Node;
-};
-
-struct qdom_doc
-{
- void *Document;
- void *CurrentNode;
- struct qdom_node *Children;
-};
-
-struct qdom_message
-{
- char *Log;
- void *OldHandler;
-};
-
-void qdom_init();
-void qdom_shutdown();
-
-void qdom_do_install_message_handler();
-void qdom_do_free_message_handler();
-
-char *qdom_error_log();
-
-void qdom_do_version( char **ver );
-
-struct qdom_node *qdom_do_next_node( struct qdom_node *node );
-struct qdom_node *qdom_do_first_child( struct qdom_node *node );
-
-struct qdom_attribute *qdom_do_node_attributes( struct qdom_node *node );
-struct qdom_node *qdom_do_attribute_at( struct qdom_attribute *attr, int index );
-void qdom_do_attributes_free( struct qdom_attribute *node );
-
-int qdom_do_node_children_count( struct qdom_node *node );
-int qdom_do_node_attribute_count( struct qdom_node *node );
-
-struct qdom_node *qdom_do_copy_node( struct qdom_node *node );
-void qdom_do_node_free( struct qdom_node *node );
-
-void qdom_do_doc_type( struct qdom_doc *doc, char **name );
-struct qdom_doc *qdom_do_init( const char *arg );
-void qdom_do_free( struct qdom_doc *doc );
-
-struct qdom_message *g_qdom_message_log;
-
-#endif // QDOM_QT_H
diff --git a/ext/readline/CREDITS b/ext/readline/CREDITS
deleted file mode 100644
index 02e44a44d4..0000000000
--- a/ext/readline/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Readline
-Thies C. Arntzen
diff --git a/ext/readline/README.libedit b/ext/readline/README.libedit
deleted file mode 100644
index a19371056e..0000000000
--- a/ext/readline/README.libedit
+++ /dev/null
@@ -1,4 +0,0 @@
-This library can be built with libedit - non-GPL drop-in readline replacement.
-Libedit can be obtained from http://sourceforge.net/projects/libedit/
-It is taken from NetBSD (http://www.netbsd.org/) CVS repository and modified
-to work as stand-alone library.
diff --git a/ext/readline/config.m4 b/ext/readline/config.m4
deleted file mode 100644
index a22c09dee7..0000000000
--- a/ext/readline/config.m4
+++ /dev/null
@@ -1,94 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(libedit,for libedit readline replacement,
-[ --with-libedit[=DIR] Include libedit readline replacement (CLI/CGI only).])
-
-PHP_ARG_WITH(readline,for readline support,
-[ --with-readline[=DIR] Include readline support (CLI/CGI only).])
-
-if test "$PHP_READLINE" != "no"; then
- for i in /usr/local /usr $PHP_READLINE; do
- if test -f $i/include/readline/readline.h; then
- READLINE_DIR=$i
- fi
- done
-
- if test -z "$READLINE_DIR"; then
- AC_MSG_ERROR(Please reinstall readline - I cannot find readline.h)
- fi
-
- PHP_ADD_INCLUDE($READLINE_DIR/include)
-
- AC_CHECK_LIB(ncurses, tgetent,
- [
- PHP_ADD_LIBRARY(ncurses,,READLINE_SHARED_LIBADD)
- ],[
- AC_CHECK_LIB(termcap, tgetent,
- [
- PHP_ADD_LIBRARY(termcap,,READLINE_SHARED_LIBADD)
- ])
- ])
-
- PHP_CHECK_LIBRARY(readline, readline,
- [
- PHP_ADD_LIBRARY_WITH_PATH(readline, $READLINE_DIR/lib, READLINE_SHARED_LIBADD)
- ], [
- AC_MSG_ERROR(readline library not found)
- ], [
- -L$READLINE_DIR/lib
- ])
-
- PHP_CHECK_LIBRARY(history, add_history,
- [
- PHP_ADD_LIBRARY_WITH_PATH(history, $READLINE_DIR/lib, READLINE_SHARED_LIBADD)
- ], [
- AC_MSG_ERROR(history library required by readline not found)
- ], [
- -L$READLINE_DIR/lib
- ])
-
- PHP_SUBST(READLINE_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_LIBREADLINE, 1, [ ])
- PHP_NEW_EXTENSION(readline, readline.c, $ext_shared, cli)
-
-elif test "$PHP_LIBEDIT" != "no"; then
-
- for i in /usr/local /usr $PHP_LIBEDIT; do
- if test -f $i/include/readline/readline.h; then
- LIBEDIT_DIR=$i
- fi
- done
-
- if test -z "$LIBEDIT_DIR"; then
- AC_MSG_ERROR(Please reinstall libedit - I cannot find readline.h)
- fi
-
- PHP_ADD_INCLUDE($LIBEDIT_DIR/include)
-
- AC_CHECK_LIB(ncurses, tgetent,
- [
- PHP_ADD_LIBRARY(ncurses,,READLINE_SHARED_LIBADD)
- ],[
- AC_CHECK_LIB(termcap, tgetent,
- [
- PHP_ADD_LIBRARY(termcap,,READLINE_SHARED_LIBADD)
- ])
- ])
-
- PHP_CHECK_LIBRARY(edit, readline,
- [
- PHP_ADD_LIBRARY_WITH_PATH(edit, $LIBEDIT_DIR/lib, READLINE_SHARED_LIBADD)
- ], [
- AC_MSG_ERROR(edit library required by readline not found)
- ], [
- -L$READLINE_DIR/lib
- ])
-
- PHP_SUBST(READLINE_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_LIBEDIT, 1, [ ])
- PHP_NEW_EXTENSION(readline, readline.c, $ext_shared, cli)
-fi
diff --git a/ext/readline/php_readline.h b/ext/readline/php_readline.h
deleted file mode 100644
index 90a6dda009..0000000000
--- a/ext/readline/php_readline.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_READLINE_H
-#define PHP_READLINE_H
-
-#if HAVE_LIBREADLINE || HAVE_LIBEDIT
-#ifdef ZTS
-#warning Readline module will *NEVER* be thread-safe
-#endif
-
-extern zend_module_entry readline_module_entry;
-#define phpext_readline_ptr &readline_module_entry
-
-#else
-
-#define phpext_readline_ptr NULL
-
-#endif /* HAVE_LIBREADLINE */
-
-#endif /* PHP_READLINE_H */
-
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
deleted file mode 100644
index 4fa70bc263..0000000000
--- a/ext/readline/readline.c
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* {{{ includes & prototypes */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_readline.h"
-
-#if HAVE_LIBREADLINE || HAVE_LIBEDIT
-
-#include <readline/readline.h>
-#ifndef HAVE_LIBEDIT
-#include <readline/history.h>
-#endif
-
-PHP_FUNCTION(readline);
-PHP_FUNCTION(readline_add_history);
-PHP_FUNCTION(readline_info);
-PHP_FUNCTION(readline_clear_history);
-#ifndef HAVE_LIBEDIT
-PHP_FUNCTION(readline_list_history);
-#endif
-PHP_FUNCTION(readline_read_history);
-PHP_FUNCTION(readline_write_history);
-PHP_FUNCTION(readline_completion_function);
-
-static char *_readline_completion = NULL;
-static zval _readline_array;
-
-PHP_MINIT_FUNCTION(readline);
-PHP_RSHUTDOWN_FUNCTION(readline);
-
-/* }}} */
-/* {{{ module stuff */
-
-static zend_function_entry php_readline_functions[] = {
- PHP_FE(readline, NULL)
- PHP_FE(readline_info, NULL)
- PHP_FE(readline_add_history, NULL)
- PHP_FE(readline_clear_history, NULL)
-#ifndef HAVE_LIBEDIT
- PHP_FE(readline_list_history, NULL)
-#endif
- PHP_FE(readline_read_history, NULL)
- PHP_FE(readline_write_history, NULL)
- PHP_FE(readline_completion_function,NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry readline_module_entry = {
- STANDARD_MODULE_HEADER,
- "readline",
- php_readline_functions,
- PHP_MINIT(readline),
- NULL,
- NULL,
- PHP_RSHUTDOWN(readline),
- NULL,
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_READLINE
-ZEND_GET_MODULE(readline)
-#endif
-
-PHP_MINIT_FUNCTION(readline)
-{
- using_history();
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(readline)
-{
- if (_readline_completion)
- efree(_readline_completion);
-
- return SUCCESS;
-}
-
-/* }}} */
-/* {{{ proto string readline([string prompt])
- Reads a line */
-PHP_FUNCTION(readline)
-{
- char *result;
- pval **arg;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (ac == 1) {
- convert_to_string_ex(arg);
- }
-
- result = readline(ac?Z_STRVAL_PP(arg):NULL);
-
- if (! result) {
- RETURN_FALSE;
- } else {
- RETVAL_STRING(result,1);
- free(result);
- }
-}
-
-/* }}} */
-/* {{{ proto mixed readline_info([string varname] [, string newvalue])
- Gets/sets various internal readline variables. */
-
-#define SAFE_STRING(s) ((s)?(s):"")
-
-PHP_FUNCTION(readline_info)
-{
- zval **what;
- zval **value;
- int oldval;
- char *oldstr;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 0 || ac > 2 || zend_get_parameters_ex(ac, &what, &value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (ac == 0) {
- array_init(return_value);
- add_assoc_string(return_value,"line_buffer",SAFE_STRING(rl_line_buffer),1);
- add_assoc_long(return_value,"point",rl_point);
- add_assoc_long(return_value,"end",rl_end);
-#ifdef HAVE_LIBREADLINE
- add_assoc_long(return_value,"mark",rl_mark);
- add_assoc_long(return_value,"done",rl_done);
- add_assoc_long(return_value,"pending_input",rl_pending_input);
- add_assoc_string(return_value,"prompt",SAFE_STRING(rl_prompt),1);
- add_assoc_string(return_value,"terminal_name",SAFE_STRING(rl_terminal_name),1);
-#endif
-#if HAVE_ERASE_EMPTY_LINE
- add_assoc_long(return_value,"erase_empty_line",rl_erase_empty_line);
-#endif
- add_assoc_string(return_value,"library_version",SAFE_STRING(rl_library_version),1);
- add_assoc_string(return_value,"readline_name",SAFE_STRING(rl_readline_name),1);
- } else {
- convert_to_string_ex(what);
-
- if (! strcasecmp(Z_STRVAL_PP(what),"line_buffer")) {
- oldstr = rl_line_buffer;
- if (ac == 2) {
- /* XXX if (rl_line_buffer) free(rl_line_buffer); */
- convert_to_string_ex(value);
- rl_line_buffer = strdup(Z_STRVAL_PP(value));
- }
- RETVAL_STRING(SAFE_STRING(oldstr),1);
- } else if (! strcasecmp(Z_STRVAL_PP(what),"point")) {
- RETVAL_LONG(rl_point);
- } else if (! strcasecmp(Z_STRVAL_PP(what),"end")) {
- RETVAL_LONG(rl_end);
-#ifdef HAVE_LIBREADLINE
- } else if (! strcasecmp(Z_STRVAL_PP(what),"mark")) {
- RETVAL_LONG(rl_mark);
- } else if (! strcasecmp(Z_STRVAL_PP(what),"done")) {
- oldval = rl_done;
- if (ac == 2) {
- convert_to_long_ex(value);
- rl_done = Z_LVAL_PP(value);
- }
- RETVAL_LONG(oldval);
- } else if (! strcasecmp(Z_STRVAL_PP(what),"pending_input")) {
- oldval = rl_pending_input;
- if (ac == 2) {
- convert_to_string_ex(value);
- rl_pending_input = Z_STRVAL_PP(value)[0];
- }
- RETVAL_LONG(oldval);
- } else if (! strcasecmp(Z_STRVAL_PP(what),"prompt")) {
- RETVAL_STRING(SAFE_STRING(rl_prompt),1);
- } else if (! strcasecmp(Z_STRVAL_PP(what),"terminal_name")) {
- RETVAL_STRING(SAFE_STRING(rl_terminal_name),1);
-#endif
-#if HAVE_ERASE_EMPTY_LINE
- } else if (! strcasecmp(Z_STRVAL_PP(what),"erase_empty_line")) {
- oldval = rl_erase_empty_line;
- if (ac == 2) {
- convert_to_long_ex(value);
- rl_erase_empty_line = Z_LVAL_PP(value);
- }
- RETVAL_LONG(oldval);
-#endif
- } else if (! strcasecmp(Z_STRVAL_PP(what),"library_version")) {
- RETVAL_STRING(SAFE_STRING(rl_library_version),1);
- } else if (! strcasecmp(Z_STRVAL_PP(what),"readline_name")) {
- oldstr = rl_readline_name;
- if (ac == 2) {
- /* XXX if (rl_readline_name) free(rl_readline_name); */
- convert_to_string_ex(value);
- rl_readline_name = strdup(Z_STRVAL_PP(value));;
- }
- RETVAL_STRING(SAFE_STRING(oldstr),1);
- }
- }
-}
-
-/* }}} */
-/* {{{ proto void readline_add_history([string prompt])
- Adds a line to the history */
-PHP_FUNCTION(readline_add_history)
-{
- pval **arg;
- int ac = ZEND_NUM_ARGS();
-
- if (ac != 1 || zend_get_parameters_ex(ac, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- add_history(Z_STRVAL_PP(arg));
-
- RETURN_TRUE;
-}
-
-/* }}} */
-/* {{{ proto void readline_clear_history(void)
- Clears the history */
-PHP_FUNCTION(readline_clear_history)
-{
- int ac = ZEND_NUM_ARGS();
-
- if (ac != 0) {
- WRONG_PARAM_COUNT;
- }
-
- clear_history();
-
- RETURN_TRUE;
-}
-
-/* }}} */
-/* {{{ proto array readline_list_history(void)
- Lists the history */
-#ifndef HAVE_LIBEDIT
-PHP_FUNCTION(readline_list_history)
-{
- HIST_ENTRY **history;
- int ac = ZEND_NUM_ARGS();
-
- if (ac) {
- WRONG_PARAM_COUNT;
- }
-
- history = history_list();
-
- array_init(return_value);
-
- if (history) {
- int i;
- for (i = 0; history[i]; i++) {
- add_next_index_string(return_value,history[i]->line,1);
- }
- }
-}
-#endif
-/* }}} */
-/* {{{ proto int readline_read_history([string filename] [, int from] [,int to])
- Reads the history */
-PHP_FUNCTION(readline_read_history)
-{
- pval **arg;
- char *filename = NULL;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* XXX from & to NYI */
-
- if (ac == 1) {
- convert_to_string_ex(arg);
- filename = Z_STRVAL_PP(arg);
- }
-
- if (read_history(filename)) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-
-/* }}} */
-/* {{{ proto int readline_write_history([string filename])
- Writes the history */
-PHP_FUNCTION(readline_write_history)
-{
- pval **arg;
- char *filename = NULL;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (ac == 1) {
- convert_to_string_ex(arg);
- filename = Z_STRVAL_PP(arg);
- }
-
- if (write_history(filename)) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-
-/* }}} */
-/* {{{ proto void readline_completion_function(string funcname)
- Readline completion function? */
-
-static char *_readline_command_generator(char *text,int state)
-{
- HashTable *myht = Z_ARRVAL(_readline_array);
- zval **entry;
-
- if (! state) {
- zend_hash_internal_pointer_reset(myht);
- }
-
- while (zend_hash_get_current_data(myht, (void **)&entry) == SUCCESS) {
- zend_hash_move_forward(myht);
-
- convert_to_string_ex(entry);
- if (strncmp (Z_STRVAL_PP(entry), text, strlen(text)) == 0) {
- return (strdup(Z_STRVAL_PP(entry)));
- }
- }
-
- return NULL;
-}
-
-static zval *_readline_string_zval(const char *str)
-{
- zval *ret;
- int len = strlen(str);
- MAKE_STD_ZVAL(ret);
-
- Z_TYPE_P(ret) = IS_STRING;
- Z_STRLEN_P(ret) = len;
- Z_STRVAL_P(ret) = estrndup(str, len);
- return ret;
-}
-
-static zval *_readline_long_zval(long l)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
-
- Z_TYPE_P(ret) = IS_LONG;
- Z_LVAL_P(ret) = l;
- return ret;
-}
-
-static char **_readline_completion_cb(char *text, int start, int end)
-{
- zval *params[4];
- int i;
- char **matches = NULL;
- TSRMLS_FETCH();
-
- params[0]=_readline_string_zval(_readline_completion);
- params[1]=_readline_string_zval(text);
- params[2]=_readline_long_zval(start);
- params[3]=_readline_long_zval(end);
-
- if (call_user_function(CG(function_table), NULL, params[0], &_readline_array, 3, params+1 TSRMLS_CC) == SUCCESS) {
- if (Z_TYPE(_readline_array) == IS_ARRAY) {
- matches = completion_matches(text,_readline_command_generator);
- }
- }
-
- for (i = 0; i < 4; i++) {
- zval_ptr_dtor(&params[i]);
- }
- zval_dtor(&_readline_array);
-
- return matches;
-}
-
-PHP_FUNCTION(readline_completion_function)
-{
- pval **arg;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (ac == 1) {
- convert_to_string_ex(arg);
-
- if (_readline_completion)
- efree(_readline_completion);
-
- _readline_completion = estrdup(Z_STRVAL_PP(arg));
- rl_attempted_completion_function = _readline_completion_cb;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-#endif /* HAVE_LIBREADLINE */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/recode/CREDITS b/ext/recode/CREDITS
deleted file mode 100644
index 2b07813086..0000000000
--- a/ext/recode/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Recode
-Kristian Köhntopp
diff --git a/ext/recode/config.m4 b/ext/recode/config.m4
deleted file mode 100644
index aae118a76b..0000000000
--- a/ext/recode/config.m4
+++ /dev/null
@@ -1,63 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(recode,for recode support,
-[ --with-recode[=DIR] Include recode support.])
-
-if test "$PHP_RECODE" != "no"; then
- RECODE_LIST="$PHP_RECODE /usr /usr/local /opt"
-
- for i in $RECODE_LIST; do
- if test -f $i/include/recode.h; then
- RECODE_DIR=$i
- RECODE_INC=include
- RECODE_LIB=lib
- fi
- if test -f $i/include/recode/recode.h; then
- RECODE_DIR=$i
- RECODE_INC=include/recode
- RECODE_LIB=lib/recode
- fi
- if test -f $i/recode/include/recode.h; then
- RECODE_DIR=$i/recode
- RECODE_INC=include
- RECODE_LIB=lib
- fi
- done
-
- if test -z "$RECODE_DIR"; then
- AC_MSG_ERROR([Can not find recode.h anywhere under $RECODE_LIST.])
- fi
-
- PHP_CHECK_LIBRARY(recode, recode_format_table,
- [
- PHP_ADD_LIBRARY_WITH_PATH(recode, $RECODE_DIR/$RECODE_LIB, RECODE_SHARED_LIBADD)
- ], [
- old_LDFLAGS=$LDFLAGS
- old_LIBS=$LIBS
- LDFLAGS="$LDFLAGS -L$RECODE_DIR/$RECODE_LIB"
- LIBS="$LIBS -lrecode"
- AC_TRY_LINK(
- [
-char *program_name;
- ],[
-recode_format_table();
- ],[
- PHP_ADD_LIBRARY_DEFER_WITH_PATH(recode, $RECODE_DIR/$RECODE_LIB, RECODE_SHARED_LIBADD)
- AC_DEFINE(HAVE_BROKEN_RECODE, 1, [Whether we have librecode 3.5])
- ],[
- AC_MSG_ERROR(I cannot link librecode (-L$RECODE_DIR/$RECODE_LIB -lrecode). Is it installed?)
- ])
- LIBS=$old_LIBS
- LDFLAGS=$old_LDFLAGS
- ], [
- -L$RECODE_DIR/$RECODE_LIB
- ])
-
- AC_DEFINE(HAVE_LIBRECODE, 1, [Whether we have librecode 3.5 or higher])
- PHP_ADD_INCLUDE($RECODE_DIR/$RECODE_INC)
- PHP_SUBST(RECODE_SHARED_LIBADD)
- AC_CHECK_HEADERS(stdbool.h)
- PHP_NEW_EXTENSION(recode, recode.c, $ext_shared)
-fi
diff --git a/ext/recode/php_recode.h b/ext/recode/php_recode.h
deleted file mode 100644
index 2025e78781..0000000000
--- a/ext/recode/php_recode.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Kristian Koehntopp <kris@koehntopp.de> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_RECODE_H
-#define PHP_RECODE_H
-
-#if HAVE_LIBRECODE
-
-extern zend_module_entry recode_module_entry;
-#define phpext_recode_ptr &recode_module_entry
-
-PHP_MINIT_FUNCTION(recode);
-PHP_MSHUTDOWN_FUNCTION(recode);
-PHP_MINFO_FUNCTION(recode);
-PHP_FUNCTION(recode_string);
-PHP_FUNCTION(recode_file);
-
-#else
-#define phpext_recode_ptr NULL
-#endif
-
-#endif /* PHP_RECODE_H */
diff --git a/ext/recode/recode.c b/ext/recode/recode.c
deleted file mode 100644
index 81d0e9aafc..0000000000
--- a/ext/recode/recode.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Kristian Koehntopp <kris@koehntopp.de> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* {{{ includes & prototypes */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_streams.h"
-
-#if HAVE_LIBRECODE
-
-/* For recode 3.5 */
-#if HAVE_BROKEN_RECODE
-extern char *program_name;
-char *program_name = "php";
-#endif
-
-#ifdef HAVE_STDBOOL_H
-# include <stdbool.h>
-#else
- typedef enum {false = 0, true = 1} bool;
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <recode.h>
-
-#include "php_recode.h"
-#include "ext/standard/info.h"
-#include "ext/standard/file.h"
-#include "ext/standard/php_string.h"
-
-/* }}} */
-
-ZEND_BEGIN_MODULE_GLOBALS(recode)
- RECODE_OUTER outer;
-ZEND_END_MODULE_GLOBALS(recode)
-
-#ifdef ZTS
-# define ReSG(v) TSRMG(recode_globals_id, zend_recode_globals *, v)
-#else
-# define ReSG(v) (recode_globals.v)
-#endif
-
-ZEND_DECLARE_MODULE_GLOBALS(recode);
-
-/* {{{ module stuff */
-static zend_function_entry php_recode_functions[] = {
- PHP_FE(recode_string, NULL)
- PHP_FE(recode_file, NULL)
- PHP_FALIAS(recode, recode_string, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry recode_module_entry = {
- STANDARD_MODULE_HEADER,
- "recode",
- php_recode_functions,
- PHP_MINIT(recode),
- PHP_MSHUTDOWN(recode),
- NULL,
- NULL,
- PHP_MINFO(recode),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_RECODE
-ZEND_GET_MODULE(recode)
-#endif
-
-static void php_recode_init_globals (zend_recode_globals *rg)
-{
- rg->outer = NULL;
-}
-
-PHP_MINIT_FUNCTION(recode)
-{
- ZEND_INIT_MODULE_GLOBALS(recode, php_recode_init_globals, NULL);
-
- ReSG(outer) = recode_new_outer(false);
- if (ReSG(outer) == NULL) {
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(recode)
-{
- if (ReSG(outer)) {
- recode_delete_outer(ReSG(outer));
- }
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(recode)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Recode Support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision$");
- php_info_print_table_end();
-}
-
-/* {{{ proto string recode_string(string request, string str)
- Recode string str according to request string */
-PHP_FUNCTION(recode_string)
-{
- RECODE_REQUEST request = NULL;
- char *r = NULL;
- zval **str;
- zval **req;
- bool success;
- int r_len=0, r_alen =0;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &req, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
- convert_to_string_ex(req);
-
- request = recode_new_request(ReSG(outer));
-
- if (request == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot allocate request structure");
- RETURN_FALSE;
- }
-
- success = recode_scan_request(request, Z_STRVAL_PP(req));
- if (!success) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal recode request '%s'", Z_STRVAL_PP(req));
- goto error_exit;
- }
-
- recode_buffer_to_buffer(request, Z_STRVAL_PP(str), Z_STRLEN_PP(str), &r, &r_len, &r_alen);
- if (!r) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Recoding failed.");
- goto error_exit;
- }
-
- RETVAL_STRINGL(r, r_len, 1);
- free(r);
- /* FALLTHROUGH */
-
-error_exit:
- if (request)
- recode_delete_request(request);
-
- if (!r)
- RETURN_FALSE;
-
- return;
-}
-/* }}} */
-
-/* {{{ proto bool recode_file(string request, resource input, resource output)
- Recode file input into file output according to request */
-PHP_FUNCTION(recode_file)
-{
- RECODE_REQUEST request = NULL;
- int success;
- zval **req;
- zval **input, **output;
- php_stream *instream, *outstream;
- FILE *in_fp, *out_fp;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &req, &input, &output) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(instream, input);
- php_stream_from_zval(outstream, output);
-
- if (FAILURE == php_stream_cast(instream, PHP_STREAM_AS_STDIO, (void**)&in_fp, REPORT_ERRORS)) {
- RETURN_FALSE;
- }
-
- if (FAILURE == php_stream_cast(outstream, PHP_STREAM_AS_STDIO, (void**)&out_fp, REPORT_ERRORS)) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(req);
-
- request = recode_new_request(ReSG(outer));
- if (request == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot allocate request structure");
- RETURN_FALSE;
- }
-
- success = recode_scan_request(request, Z_STRVAL_PP(req));
- if (!success) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal recode request '%s'", Z_STRVAL_PP(req));
- goto error_exit;
- }
-
- success = recode_file_to_file(request, in_fp, out_fp);
- if (!success) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Recoding failed.");
- goto error_exit;
- }
-
- if (request)
- recode_delete_request(request);
- RETURN_TRUE;
-
-error_exit:
- if (request)
- recode_delete_request(request);
-
- RETURN_FALSE;
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/rpc/CREDITS b/ext/rpc/CREDITS
deleted file mode 100644
index f49489bcf8..0000000000
--- a/ext/rpc/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Java
-Sam Ruby
diff --git a/ext/rpc/EXPERIMENTAL b/ext/rpc/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/rpc/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/rpc/RPC_HOWTO b/ext/rpc/RPC_HOWTO
deleted file mode 100644
index 9b6e92b7c6..0000000000
--- a/ext/rpc/RPC_HOWTO
+++ /dev/null
@@ -1,97 +0,0 @@
-what's this ?
-=============
-
-This is an abstraction layer that eases the task of writing rpc
-extensions (e.g. java, com, corba, soap, srm, .net, xml-rpc, ..).
-it maps the quite complex ZendEngine2 oo api to a few simpler to
-handle callback functions declared in the 'rpc_object_handlers'
-struct.
-
-so what happens behind my back ?
-================================
-
-- the abstraction layer takes care of your underlaying data structure
-and passes it to you each time you have to handle an operation.
-- it does reference counting and tells you when you have to destruct
-your underlaying data structure.
-- it registers a class and four functions (xxx_load, xxx_call, xxx_get,
-xxx_set) for your rpc layer and checks if the parameters are valid (beside
-the ones that are optional for your rpc layer).
-- it silently creates proxies for references to members of your rpc
-objects.
-- it optionally does object pooling for objects that support it (has to
-be defined in the constructor)
-- it optionally requests hash values for method and property names and
-caches them. call / get and set requests will then receive the hash value
-instead of the original function- / propertyname.
-
-how can i make use of it ?
-==========================
-
-take ext/rpc/com/com.c as a starting point. you'll have to set up the following struct:
-
-typedef struct _rpc_object_handlers {
- int (*rpc_hash)(char *name, zend_uint name_len, char **hash, zend_uint *hash_len, int type);
- int hash_type;
- int (*rpc_ctor)(char *class_name, zend_uint class_name_len, void **data, INTERNAL_FUNCTION_PARAMETERS);
- int (*rpc_dtor)(void **data);
- int (*rpc_call)(char *method_name, zend_uint method_name_len, void **data, INTERNAL_FUNCTION_PARAMETERS);
- int (*rpc_get)(char *property_name, zend_uint property_name_len, zval *return_value, void **data);
- int (*rpc_set)(char *property_name, zend_uint property_name_len, zval *value, zval *return_value, void **data);
- int (*rpc_compare)(void **data1, void **data2);
- int (*rpc_get_classname)(char **class_name, zend_uint *class_name_length, void **data);
- int (*rpc_has_property)(char *property_name, zend_uint property_name_length, void **data);
- int (*rpc_unset_property)(char *property_name, zend_uint property_name_length, void **data);
- int (*rpc_get_properties)(HashTable **properties, void **data);
-} rpc_object_handlers;
-
-
-rpc_hash:
-the hashing function for method and property names. returns a hash value
-for the string passed in 'name'. 'type' is either METHOD or PROPERTY.
-if you set 'hash_type' to HASH_AS_INT you can set '*hash' to NULL and pass
-the hash value as 'hash_len'.
-rpc_hash can be set to NULL if hashing of method and property names is not
-appreciated.
-
-hash_type:
-either HASH_AS_INT, HASH_AS_STRING or DONT_HASH
-
-rpc_ctor:
-the constructor
-
-rpc_dtor:
-the destructor
-
-rpc_call:
-the call handler
-
-rpc_get:
-the get handler
-
-rpc_set:
-the set handler
-
-rpc_compare:
-the compare handler.
-rpc_compare can be set to NULL then objects will be treated the same if they
-belong to the same rpc layer.
-
-rpc_get_classname:
-returns the classname.
-rpc_get_classname can be set to NULL then the name of the rpc layer will be
-used as classname.
-
-rpc_has_property:
-check if a property exists.
-rpc_has_property can be set to NULL then true will be returned for every request.
-
-rpc_unset_property:
-unset a property.
-rpc_unset_property can be set to NULL, a 'not supported' warning will then be
-issued.
-
-rpc_get_properties:
-returns a HashTable with all the properties.
-rpc_get_properties can be set to NULL, then a list of the explicit declared
-properties will be returned.
diff --git a/ext/rpc/com/CREDITS b/ext/rpc/com/CREDITS
deleted file mode 100644
index b713bdc50b..0000000000
--- a/ext/rpc/com/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Win32 COM
-Alan Brown, Wez Furlong, Harald Radi, Zeev Suraski \ No newline at end of file
diff --git a/ext/rpc/com/TODO b/ext/rpc/com/TODO
deleted file mode 100644
index 05ac41167a..0000000000
--- a/ext/rpc/com/TODO
+++ /dev/null
@@ -1,28 +0,0 @@
-1) Multi-dimenstional array support
-4) Documentation (internal and user) and howtos
-5) IEnumVariant::All() which would be like IEnumVariant::Next(IDispatch::Count)
-7) Test component (goes with the docs)
-8) Test suite (Needs test component)
-10) lets try if we are able to call non IDispatch - only Typelib components
-
--- delayed till PHP5: 3) WithEvents
--- delayed till PHP5: 9) reduce the need for VARIANT()
-
-ad 6.) check vbsample.php (new VARIANT(*, *|VT_BYREF)) GPs
-
--- done 2) IErrorInfo
--- done 6) Look for memory leaks and AdRef/Release problems - I KNOW there are some...
--- done 11) IEnumVariant::Next() without parameter should only return an object, not an array with one element
--- done 12) VARIANT->value as lvalue
--- done 13) export VARIANT through the COM module
--- done 14) trap exceptions and errors
-
--- donne ad 4.) faq (i've collected a few questions from various lists)
- variant attributes !!
-
-to be discussed:
-
-- mts support (getcontext)
-- adsi support (ads* functions)
-
--- delayed till PHP 5: try serialisation support (if component implements IPersist)
diff --git a/ext/rpc/com/com.c b/ext/rpc/com/com.c
deleted file mode 100644
index 0f807300de..0000000000
--- a/ext/rpc/com/com.c
+++ /dev/null
@@ -1,1362 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-#define _WIN32_DCOM
-#define COBJMACROS
-
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#include "../rpc.h"
-#include "../handler.h"
-
-#include "com.h"
-#include "com_wrapper.h"
-#include "conversion.h"
-#include "variant.h"
-#include "ext/standard/php_smart_str.h"
-#include <oleauto.h>
-#include <ocidl.h>
-
-
-static ZEND_FUNCTION(com_indexed_prop_set);
-static ZEND_FUNCTION(com_create_guid);
-
-/* protos */
-static int com_hash(rpc_string, rpc_string *, void *, int, char *, int);
-static int com_name(rpc_string, rpc_string *, void *, int);
-static int com_ctor(rpc_string, void **, int , zval ***);
-static int com_dtor(void *);
-static int com_describe(rpc_string, void *, char **, unsigned char **);
-static int com_call(rpc_string, void *, zval *, int, zval ***);
-static int com_get(rpc_string, zval *, void *);
-static int com_set(rpc_string, zval *, void *);
-static int com_compare(void *, void *);
-static int com_has_property(rpc_string, void *);
-static int com_unset_property(rpc_string, void *);
-static int com_get_properties(HashTable **, void *);
-
-static ZEND_INI_MH(com_typelib_file_change);
-
-/* globals */
-static IBindCtx *pBindCtx;
-static unsigned char arg1and2_force_ref[] = { 2, BYREF_FORCE, BYREF_FORCE };
-
-/* register rpc callback function */
-RPC_REGISTER_HANDLERS_BEGIN(com)
-TRUE, /* poolable */
-HASH_AS_INT_WITH_SIGNATURE,
-com_hash,
-com_name,
-com_ctor,
-com_dtor,
-com_describe,
-com_call,
-com_get,
-com_set,
-com_compare,
-com_has_property,
-com_unset_property,
-com_get_properties
-RPC_REGISTER_HANDLERS_END()
-
-/* register ini settings */
-PHP_INI_BEGIN()
-PHP_INI_ENTRY_EX("com.allow_dcom", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
-PHP_INI_ENTRY_EX("com.autoregister_typelib", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
-PHP_INI_ENTRY_EX("com.autoregister_verbose", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
-PHP_INI_ENTRY_EX("com.autoregister_casesensitive", "1", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
-PHP_INI_ENTRY("com.typelib_file", "", PHP_INI_SYSTEM, com_typelib_file_change)
-PHP_INI_END()
-
-/* register userspace functions */
-RPC_FUNCTION_ENTRY_BEGIN(com)
- ZEND_FALIAS(com_invoke, rpc_call, NULL)
- ZEND_FE(com_addref, NULL)
- ZEND_FE(com_release, NULL)
- ZEND_FE(com_next, NULL)
- ZEND_FE(com_all, NULL)
- ZEND_FE(com_reset, NULL)
- ZEND_FE(com_skip, NULL)
- ZEND_FE(com_event_sink, arg1and2_force_ref)
- ZEND_FE(com_message_pump, NULL)
- ZEND_FE(com_load_typelib, NULL)
- ZEND_FE(com_print_typeinfo, NULL)
- ZEND_FE(com_indexed_prop_set, NULL)
- ZEND_FE(com_create_guid, NULL)
-RPC_FUNCTION_ENTRY_END()
-
-zend_module_entry com_module_entry = {
- ZE2_STANDARD_MODULE_HEADER,
- "com",
- RPC_FUNCTION_ENTRY(com),
- ZEND_MINIT(com),
- ZEND_MSHUTDOWN(com),
- NULL,
- NULL,
- ZEND_MINFO(com),
- "0.1a",
- STANDARD_MODULE_PROPERTIES
-};
-
-/* register class methods */
-RPC_METHOD_ENTRY_BEGIN(com)
- ZEND_FALIAS(addref, com_addref, NULL)
- ZEND_FALIAS(release, com_release, NULL)
- ZEND_FALIAS(next, com_next, NULL)
- ZEND_FALIAS(all, com_all, NULL)
- ZEND_FALIAS(reset, com_reset, NULL)
- ZEND_FALIAS(skip, com_skip, NULL)
-RPC_METHOD_ENTRY_END()
-
-
-ZEND_MINIT_FUNCTION(com)
-{
- CreateBindCtx(0, &pBindCtx);
- php_variant_init(module_number TSRMLS_CC);
-
- RPC_REGISTER_LAYER(com);
- REGISTER_INI_ENTRIES();
-
- return SUCCESS;
-}
-
-ZEND_MSHUTDOWN_FUNCTION(com)
-{
- php_variant_shutdown(TSRMLS_C);
- pBindCtx->lpVtbl->Release(pBindCtx);
-
- UNREGISTER_INI_ENTRIES();
-
- return SUCCESS;
-}
-
-ZEND_MINFO_FUNCTION(com)
-{
- DISPLAY_INI_ENTRIES();
-}
-
-#ifdef COMPILE_DL_COM
-ZEND_GET_MODULE(com);
-#endif
-
-/* rpc handler functions */
-
-static int com_hash(rpc_string name, rpc_string *hash, void *data, int num_args, char *arg_types, int type)
-{
- switch (type) {
- case CLASS:
- {
- CLSID *clsid = malloc(sizeof(CLSID));
-
- /* if name is {NULL, 0} then the corresponding hash value has to be figured out
- * of the *data struct. this might be not a trivial task.
- */
- if (name.str) {
- OLECHAR *olestr = php_char_to_OLECHAR(name.str, name.len, CP_ACP, FALSE);
-
- if (FAILED(CLSIDFromString(olestr, clsid))) {
- /* Perhaps this is a Moniker? */
- free(clsid);
- efree(olestr);
-
- hash->str = strdup(name.str);
- hash->len = name.len;
-
- return SUCCESS;
- }
-
- efree(olestr);
- } else {
- comval *obj = (comval *)data;
- IProvideClassInfo2 *pci2;
-
- if (SUCCEEDED(C_DISPATCH_VT(obj)->QueryInterface(C_DISPATCH(obj), &IID_IProvideClassInfo2, (void**)&pci2))) {
- if (FAILED(pci2->lpVtbl->GetGUID(pci2, GUIDKIND_DEFAULT_SOURCE_DISP_IID, clsid))) {
- free(clsid);
-
- return FAILURE;
- }
- pci2->lpVtbl->Release(pci2);
- } else if (C_HASTLIB(obj)) {
- TYPEATTR *typeattrib;
-
- if (FAILED(C_TYPEINFO_VT(obj)->GetTypeAttr(C_TYPEINFO(obj), &typeattrib))) {
- free(clsid);
-
- return FAILURE;
- }
-
- *clsid = (typeattrib->guid);
- C_TYPEINFO_VT(obj)->ReleaseTypeAttr(C_TYPEINFO(obj), typeattrib);
- }
- }
-
- hash->str = (char *) clsid;
- /* str is actually not a string but a CLSID struct, thus set len to 0.
- * nevertheless clsid is freed by the rpc_string_dtor
- */
- hash->len = 0;
-
- return SUCCESS;
- }
-
- case METHOD:
- case PROPERTY:
- {
- DISPID *dispid = malloc(sizeof(DISPID));
- OLECHAR *olestr = php_char_to_OLECHAR(name.str, name.len, CP_ACP, FALSE);
-
- if(SUCCEEDED(php_COM_get_ids_of_names((comval *) data, olestr, dispid))) {
- hash->str = (char *) dispid;
- /* str is actually not a string but a DISPID struct, thus set len to 0.
- * nevertheless dispid is freed by the rpc_string_dtor
- */
- hash->len = 0;
-
- efree(olestr);
-
- return SUCCESS;
- } else {
- free(dispid);
- efree(olestr);
-
- return FAILURE;
- }
- }
- }
-
- return FAILURE;
-}
-
-static int com_name(rpc_string hash, rpc_string *name, void *data, int type)
-{
- if (hash.len != 0) {
- /* not a GUID, perhaps a Moniker */
- name->str = strdup(hash.str);
- name->len = hash.len;
-
- return SUCCESS;
- } else {
- switch (type) {
- case CLASS:
- {
- CLSID clsid;
- OLECHAR *olestr;
-
- clsid = *((CLSID *) hash.str);
-
- ProgIDFromCLSID(&clsid, &olestr);
- if (olestr == NULL) {
- StringFromCLSID(&clsid, &olestr);
- }
-
- if (olestr == NULL) {
- return FAILURE;
- }
-
- name->str = php_OLECHAR_to_char(olestr, &(name->len), CP_ACP, TRUE);
- CoTaskMemFree(olestr);
-
- return SUCCESS;
- }
-
- case METHOD:
- case PROPERTY:
- /* not used yet */
- break;
- }
- }
-
- return FAILURE;
-}
-
-static int com_ctor(rpc_string class_name, void **data, int num_args, zval **args[])
-{
- zval **server_name = NULL;
- zval **code_page = NULL;
- zval **typelib = NULL;
- zval **user_name=NULL;
- zval **password=NULL;
- zval **domain=NULL;
- int mode = 0;
- comval *obj;
- HRESULT hr;
- CLSCTX flags = CLSCTX_SERVER;
-
- switch (num_args) {
- case 3:
- typelib = args[2];
- convert_to_string_ex(typelib);
- /* break missing intentionally */
- case 2:
- code_page = args[1];
- convert_to_long_ex(code_page);
- /* break missing intentionally */
- case 1:
- server_name = args[0];
- /* break missing intentionally */
- break;
-
- case 0:
- /* nothing to do */
- break;
-
- default:
- /* exception */
- return FAILURE;
- }
-
- if (server_name != NULL) {
- /* What is server name? A String or an array? */
- if (Z_TYPE_PP(server_name) == IS_NULL) {
- server_name = NULL;
- } else if (Z_TYPE_PP(server_name) == IS_ARRAY) {
- zval **tmp;
- /* Aha - we have a number of possible arguments.
- * They are in the hash By name: Server, Domain, Username, Password
- * Flags.
- * This has been crafted to maintian maximum backward compatability.
- * If the server name is specified as a string, then the function
- * should behave as before by defaulting username and password and
- * using the (I believe) incorrect CLSCTX_SERVER instantiation
- * paramter. However if server is specified in this array then we
- * use either CLSCTX_REMOTE_SERVER or whatever flags are specified
- * in the array
- */
- HashTable *ht = Z_ARRVAL_PP(server_name);
- if (FAILURE == zend_hash_find(ht, "Server", 7, (void **) &tmp)) {
- server_name = NULL;
- } else {
- server_name = tmp;
- convert_to_string_ex(server_name);
- /* CLSCTX_SERVER includes INPROC and LOCAL SERVER. This means
- * that any local server will be instantiated BEFORE even
- * looking on a remote server. Thus if we have a server name,
- * probably we want to access a remote machine or we would not
- * have bothered specifying it. So it would be wrong to to
- * connect locally. Futher, unless the name passed is a GUID,
- * there has to be something to map the Prog.Id to GUID and
- * unless that has been modified to remove the information
- * about local instantiation CLSCTX_SERVER would force a local
- * instantiation This setting can be overridden below if the
- * user specifies a flags element */
- flags = CLSCTX_REMOTE_SERVER;
- }
- if (FAILURE == zend_hash_find(ht, "username", 9, (void **) &tmp)) {
- user_name = NULL;
- } else {
- user_name = tmp;
- convert_to_string_ex(user_name);
- }
- if (FAILURE == zend_hash_find(ht, "domain", 7, (void **) &tmp)) {
- domain = NULL;
- } else {
- domain = tmp;
- convert_to_string_ex(domain);
- }
- if (FAILURE == zend_hash_find(ht, "password", 9, (void **) &tmp)) {
- password=NULL;
- } else {
- password = tmp;
- convert_to_string_ex(password);
- }
- if (SUCCESS == zend_hash_find(ht, "flags", 6, (void **) &tmp)) {
- convert_to_long_ex(tmp);
- flags = (CLSCTX) Z_LVAL_PP(tmp);
- }
- }
-
- if (server_name != NULL) {
- if (!INI_INT("com.allow_dcom")) {
- rpc_error(E_WARNING, "DCOM is disabled");
- return FAILURE;
- } else {
- flags = CLSCTX_REMOTE_SERVER;
- convert_to_string_ex(server_name);
- }
- }
- }
-
- ALLOC_COM(obj);
- *data = obj;
-
- if (code_page != NULL) {
- C_CODEPAGE(obj) = Z_LVAL_PP(code_page);
- }
-
- if (class_name.len) {
- /* Perhaps this is a Moniker? */
- IMoniker *pMoniker;
- ULONG ulEaten;
-
- if (server_name) {
- hr = MK_E_SYNTAX;
- } else {
- OLECHAR *olestr = php_char_to_OLECHAR(class_name.str, class_name.len, C_CODEPAGE(obj), FALSE);
-
- if (SUCCEEDED(hr = MkParseDisplayNameEx(pBindCtx, olestr, &ulEaten, &pMoniker))) {
- hr = pMoniker->lpVtbl->BindToObject(pMoniker, pBindCtx, NULL, &IID_IDispatch, (LPVOID *) &C_DISPATCH(obj));
- pMoniker->lpVtbl->Release(pMoniker);
- }
-
- efree(olestr);
- }
-
- if (FAILED(hr)) {
- char *error_message;
-
- php_COM_destruct(obj);
- error_message = php_COM_error_message(hr);
- rpc_error(E_WARNING,"Invalid ProgID, GUID string, or Moniker: %s", error_message);
- LocalFree(error_message);
-
- return FAILURE;
- }
- } else {
- /* obtain IDispatch */
- if (!server_name) {
- hr = CoCreateInstance((CLSID *) class_name.str, NULL, flags, &IID_IDispatch, (LPVOID *) &C_DISPATCH(obj));
- } else {
- COSERVERINFO server_info;
- MULTI_QI pResults;
- COAUTHIDENTITY authid;
- COAUTHINFO authinfo = {RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, &authid, EOAC_NONE};
-
- server_info.dwReserved1=0;
- server_info.dwReserved2=0;
- server_info.pwszName = php_char_to_OLECHAR(Z_STRVAL_PP(server_name), Z_STRLEN_PP(server_name), C_CODEPAGE(obj), FALSE);
- if (user_name) {
- /* Parse Username into domain\username */
- authid.User = (WCHAR *) Z_STRVAL_PP(user_name);
- authid.UserLength = Z_STRLEN_PP(user_name);
- if (password) {
- authid.Password = (USHORT *) Z_STRVAL_PP(password);
- authid.PasswordLength = Z_STRLEN_PP(password);
- } else {
- authid.Password = (USHORT *) "";
- authid.PasswordLength = 0;
- }
- if (domain) {
- authid.Domain = (USHORT *) Z_STRVAL_PP(domain);
- authid.DomainLength = Z_STRLEN_PP(domain);
- } else {
- authid.Domain = (USHORT *) "";
- authid.DomainLength = 0;
- }
- authid.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
-
- server_info.pAuthInfo=&authinfo;
- } else {
- server_info.pAuthInfo=NULL;
- }
-
- pResults.pIID = &IID_IDispatch;
- pResults.pItf = NULL;
- pResults.hr = S_OK;
- hr=CoCreateInstanceEx((CLSID *) class_name.str, NULL, flags, &server_info, 1, &pResults);
- if (SUCCEEDED(hr)) {
- hr = pResults.hr;
- C_DISPATCH(obj) = (IDispatch *) pResults.pItf;
- }
- efree(server_info.pwszName);
- }
-
- if (FAILED(hr)) {
- char *error_message, *clsid;
-
- php_COM_destruct(obj);
- error_message = php_COM_error_message(hr);
- clsid = php_COM_string_from_CLSID((CLSID *)class_name.str);
- rpc_error(E_WARNING,"Unable to obtain IDispatch interface for CLSID %s: %s", clsid, error_message);
- LocalFree(error_message);
- efree(clsid);
-
- return FAILURE;
- }
- }
-
- php_COM_set(obj, &C_DISPATCH(obj), TRUE);
-
- if (INI_INT("com.autoregister_casesensitive")) {
- mode |= CONST_CS;
- }
-
- if (C_HASTLIB(obj)) {
- if (INI_INT("com.autoregister_typelib")) {
- ITypeLib *pTL;
- unsigned int idx;
-
- /* @todo check if typlib isn't already loaded */
- if (C_TYPEINFO_VT(obj)->GetContainingTypeLib(C_TYPEINFO(obj), &pTL, &idx) == S_OK) {
- php_COM_load_typelib(pTL, mode);
- pTL->lpVtbl->Release(pTL);
- }
- }
- } else {
- if (typelib != NULL) {
- ITypeLib *pTL;
-
- if ((pTL = php_COM_find_typelib(Z_STRVAL_PP(typelib), mode)) != NULL) {
- C_HASTLIB(obj) = SUCCEEDED(pTL->lpVtbl->GetTypeInfo(pTL, 0, &C_TYPEINFO(obj)));
- /* idx 0 should deliver the ITypeInfo for the IDispatch Interface */
- if (INI_INT("com.autoregister_typelib")) {
- php_COM_load_typelib(pTL, mode);
- }
- pTL->lpVtbl->Release(pTL);
- }
- }
- }
-
- return SUCCESS;
-}
-
-static int com_dtor(void *data)
-{
- php_COM_destruct((comval *) data);
-
- return SUCCESS;
-}
-
-static inline void vt_type_to_zpp_string(ELEMDESC *elem, smart_str *argtypes_str, unsigned char *argflags)
-{
- int ref = 0;
- int nullable = 0;
- char zppflag = 'z';
- WORD vt, flags;
-
- vt = elem->tdesc.vt;
- flags = elem->paramdesc.wParamFlags;
-
- if (vt == VT_PTR) {
- nullable = 1;
- ref = 0;
- vt = elem->tdesc.lptdesc->vt;
- } else {
- ref = vt & VT_BYREF;
- }
-
- if (vt & VT_ARRAY) {
- zppflag = 'a';
- } else {
- switch(vt & ~(VT_BYREF | VT_ARRAY)) {
- case VT_UI1:
- case VT_UI2:
- case VT_UI4:
- case VT_I1:
- case VT_I2:
- case VT_I4:
- zppflag = 'l';
- break;
-
- case VT_R8:
- case VT_CY:
- case VT_DATE:
- zppflag = 'd';
- break;
-
- case VT_BSTR:
- zppflag = 's';
- break;
-
- case VT_BOOL:
- zppflag = 'b';
- break;
-
- case VT_DISPATCH:
- case VT_UNKNOWN:
- zppflag = 'o';
- break;
-
- case VT_VARIANT:
- default:
- zppflag = 'z';
-
- }
- }
-
- if (ref) {
- smart_str_appendl(argtypes_str, "z/", 2);
- *argflags = BYREF_FORCE;
- } else {
- *argflags = BYREF_NONE;
- if (nullable) {
- smart_str_appendl(argtypes_str, "!", 1);
- }
- }
-}
-
-static int com_describe(rpc_string method_name, void *data, char **arg_types, unsigned char **ref_types)
-{
- rpc_internal *intern;
- comval *obj;
- ITypeInfo *typeinfo;
- FUNCDESC *funcdesc;
- MEMBERID fid;
- OLECHAR *olename;
- int retval = FAILURE, arg_count;
- int i, type_len = 0;
- smart_str argtypes_str = {0};
- unsigned char *func_arg_types;
- TSRMLS_FETCH();
-
- GET_INTERNAL_EX(intern, data);
- obj = (comval*)data;
-
- if (!C_HASTLIB(obj)) {
- return FAILURE;
- }
-
- olename = php_char_to_OLECHAR(method_name.str, method_name.len, CP_ACP, FALSE);
- typeinfo = C_TYPEINFO(obj);
-
- if (SUCCEEDED(ITypeInfo_GetIDsOfNames(typeinfo, &olename, 1, &fid)) && SUCCEEDED(ITypeInfo_GetFuncDesc(typeinfo, fid, &funcdesc))) {
-
- arg_count = funcdesc->cParams + (funcdesc->cParamsOpt == -1 ? 1 : funcdesc->cParamsOpt);
-
- func_arg_types = (unsigned char*)malloc((1 + arg_count) * sizeof(unsigned char));
-
- func_arg_types[0] = arg_count;
-
- /* required parameters first */
- for (i = 0; i < funcdesc->cParams; i++) {
- ELEMDESC *elem = &funcdesc->lprgelemdescParam[i];
-
- vt_type_to_zpp_string(elem, &argtypes_str, &func_arg_types[i+1]);
- }
-
- if (funcdesc->cParamsOpt == -1) {
- /* needs to be a SAFEARRAY of VARIANTS */
- smart_str_appendl(&argtypes_str, "|z", 2);
- func_arg_types[funcdesc->cParams+1] = BYREF_NONE;
- } else if (funcdesc->cParamsOpt > 0) {
- smart_str_appendl(&argtypes_str, "|", 1);
-
- for (i = funcdesc->cParams; i < funcdesc->cParams + funcdesc->cParamsOpt; i++) {
- ELEMDESC *elem = &funcdesc->lprgelemdescParam[i];
-
- vt_type_to_zpp_string(elem, &argtypes_str, &func_arg_types[i+1]);
- }
- }
-
- *ref_types = func_arg_types;
- smart_str_0(&argtypes_str);
- *arg_types = strdup(argtypes_str.c);
- smart_str_free(&argtypes_str);
-
- retval = SUCCESS;
- ITypeInfo_ReleaseFuncDesc(typeinfo, funcdesc);
- }
-
- efree(olename);
-
- return retval;
-}
-
-static int com_call(rpc_string method_name, void *data, zval *return_value, int num_args, zval **args[])
-{
- DISPPARAMS dispparams;
- HRESULT hr;
- OLECHAR *funcname = NULL;
- VARIANT *variant_args;
- VARIANT result;
- int current_arg, current_variant;
- char *ErrString = NULL;
- TSRMLS_FETCH();
-
- /* if the length of the name is 0, we are dealing with a pointer to a dispid */
- assert(method_name.len == 0);
-
- variant_args = num_args ? (VARIANT *) emalloc(sizeof(VARIANT) * num_args) : NULL;
-
- for (current_arg = 0; current_arg < num_args; current_arg++) {
- current_variant = num_args - current_arg - 1;
- php_zval_to_variant(*args[current_arg], &variant_args[current_variant], C_CODEPAGE((comval *) data) TSRMLS_CC);
- }
-
- dispparams.rgvarg = variant_args;
- dispparams.rgdispidNamedArgs = NULL;
- dispparams.cArgs = num_args;
- dispparams.cNamedArgs = 0;
-
- VariantInit(&result);
-
- hr = php_COM_invoke((comval *) data, *(DISPID*)method_name.str, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dispparams, &result, &ErrString);
-
- for (current_arg=0;current_arg<num_args;current_arg++) {
- /* don't release IDispatch pointers as they are used afterwards */
- if (V_VT(&variant_args[current_arg]) != VT_DISPATCH) {
- /* @todo review this: what happens to an array of IDispatchs or a VARIANT->IDispatch */
- VariantClear(&variant_args[current_arg]);
- }
- }
-
- if (variant_args) {
- efree(variant_args);
- variant_args = NULL;
- }
-
- if (FAILED(hr)) {
- char *error_message;
-
- error_message = php_COM_error_message(hr);
- if (ErrString) {
- rpc_error(E_WARNING,"Invoke() failed: %s %s", error_message, ErrString);
- efree(ErrString);
- } else {
- rpc_error(E_WARNING,"Invoke() failed: %s", error_message);
- }
- LocalFree(error_message);
- return FAILURE;
- }
-
- RETVAL_VARIANT(&result, C_CODEPAGE((comval *) data));
-
- return SUCCESS;
-}
-
-static int com_get(rpc_string property_name, zval *return_value, void *data)
-{
- char *ErrString = NULL;
- VARIANT *result;
- DISPPARAMS dispparams;
- HRESULT hr;
-
- result = (VARIANT *) emalloc(sizeof(VARIANT));
- VariantInit(result);
-
- dispparams.cArgs = 0;
- dispparams.cNamedArgs = 0;
-
- if (FAILED(hr = php_COM_invoke((comval *) data, *((DISPID *) property_name.str), DISPATCH_PROPERTYGET, &dispparams, result, &ErrString))) {
- char *error_message;
-
- efree(result);
- error_message = php_COM_error_message(hr);
- if (ErrString != NULL) {
- rpc_error(E_WARNING,"PropGet() failed: %s %s", error_message, ErrString);
- efree(ErrString);
- } else {
- rpc_error(E_WARNING,"PropGet() failed: %s", error_message);
- }
- LocalFree(error_message);
-
- return FAILURE;
- }
-
- if (V_VT(result) == VT_DISPATCH) {
- RETVAL_VARIANT(result, C_CODEPAGE((comval *) data));
- } else {
- comval *foo = (comval *) data;
- php_variant_to_zval(result, return_value, C_CODEPAGE(foo));
- VariantClear(result);
- }
-
- efree(result);
-
- return SUCCESS;
-}
-
-static int com_set(rpc_string property_name, zval *value, void *data)
-{
- HRESULT hr;
- DISPID mydispid = DISPID_PROPERTYPUT;
- DISPPARAMS dispparams;
- VARIANT *var;
- char *error_message, *ErrString = NULL;
- TSRMLS_FETCH();
-
- var = (VARIANT *) emalloc(sizeof(VARIANT));
- VariantInit(var);
-
- php_zval_to_variant(value, var, C_CODEPAGE((comval *) data) TSRMLS_CC);
- dispparams.rgvarg = var;
- dispparams.rgdispidNamedArgs = &mydispid;
- dispparams.cArgs = 1;
- dispparams.cNamedArgs = 1;
-
- if (FAILED(hr = php_COM_invoke((comval *) data, *(DISPID*)property_name.str, DISPATCH_PROPERTYPUT, &dispparams, NULL, &ErrString))) {
- error_message = php_COM_error_message(hr);
- if (ErrString) {
- rpc_error(E_WARNING,"PropPut() failed: %s %s", error_message, ErrString);
- efree(ErrString);
- } else {
- rpc_error(E_WARNING,"PropPut() failed: %s", error_message);
- }
- LocalFree(error_message);
- VariantClear(var);
- efree(var);
-
- return FAILURE;
- }
-
-
- VariantClear(var);
- efree(var);
-
- return SUCCESS;
-}
-
-static int com_compare(void *data1, void *data2)
-{
- return SUCCESS;
-}
-
-static int com_has_property(rpc_string property_name, void *data)
-{
- return SUCCESS;
-}
-
-static int com_unset_property(rpc_string property_name, void *data)
-{
- return SUCCESS;
-}
-
-static int com_get_properties(HashTable **properties, void *data)
-{
- return SUCCESS;
-}
-
-
-/* custom functions */
-
-static ZEND_FUNCTION(com_create_guid)
-{
- GUID retval;
- OLECHAR *guid_string;
-
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (CoCreateGuid(&retval) == S_OK && StringFromCLSID(&retval, &guid_string) == S_OK) {
- Z_TYPE_P(return_value) = IS_STRING;
- Z_STRVAL_P(return_value) = php_OLECHAR_to_char(guid_string, &Z_STRLEN_P(return_value), CP_ACP, 0);
-
- CoTaskMemFree(guid_string);
- } else {
- RETURN_FALSE;
- }
-}
-
-
-
-static ZEND_FUNCTION(com_indexed_prop_set)
-{
- zval *object;
- rpc_internal *intern;
- char *propname;
- long propname_len;
- zval **arguments;
- int arg_count = ZEND_NUM_ARGS();
- DISPPARAMS dispparams;
- DISPID dispid, altdispid;
- VARIANT *variant_args;
- VARIANT result;
- int current_arg, current_variant;
- char *ErrString = NULL;
- OLECHAR *olestr;
-
- if (zend_parse_method_parameters(2 TSRMLS_CC, getThis(), "Os", &object, com_class_entry,
- &propname, &propname_len) != SUCCESS) {
- return;
- }
-
- if (ZEND_NUM_ARGS() < 3) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
- /* TODO: exception */
- }
-
- arguments = (zval **) emalloc(sizeof(zval *) * ZEND_NUM_ARGS());
- if (zend_get_parameters_array(ht, arg_count, arguments) == FAILURE) {
- RETURN_NULL();
- }
-
- olestr = php_char_to_OLECHAR(propname, propname_len, CP_ACP, FALSE);
-
- if (FAILED(php_COM_get_ids_of_names((comval *) intern->data, olestr, &dispid))) {
- RETURN_NULL();
- }
- variant_args = (VARIANT *) emalloc(sizeof(VARIANT) * (arg_count - 2));
-
- for (current_arg = 2; current_arg < arg_count; current_arg++) {
- current_variant = arg_count - current_arg - 1;
- php_zval_to_variant(arguments[current_arg], &variant_args[current_variant],
- C_CODEPAGE((comval *)intern->data) TSRMLS_CC);
- }
-
- dispparams.rgvarg = variant_args;
- dispparams.rgdispidNamedArgs = NULL;
- dispparams.cArgs = arg_count - 2;
- dispparams.cNamedArgs = 0;
- altdispid = DISPID_PROPERTYPUT;
- dispparams.rgdispidNamedArgs = &altdispid;
- dispparams.cNamedArgs = 1;
-
- VariantInit(&result);
-
- if (php_COM_invoke((comval*)intern->data, dispid, DISPATCH_PROPERTYPUT, &dispparams, &result, &ErrString)==FAILURE) {
- VariantClear(&result);
- RETVAL_NULL();
- } else {
- RETVAL_VARIANT(&result, C_CODEPAGE((comval*)intern->data));
- }
-
- efree(variant_args);
- efree(arguments);
- efree(olestr);
-
-}
-
-/* {{{ proto mixed com_addref(int module)
- Increases the reference counter on a COM object */
-ZEND_FUNCTION(com_addref)
-{
- zval *object;
- rpc_internal *intern;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, com_class_entry) != SUCCESS) {
- return;
- }
-
- if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
- /* TODO: exception */
- }
-
- RETURN_LONG(php_COM_addref((comval *) intern->data));
-}
-/* }}} */
-
-/* {{{ proto mixed com_release(int module)
- Releases a COM object */
-ZEND_FUNCTION(com_release)
-{
- zval *object;
- rpc_internal *intern;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, com_class_entry) != SUCCESS) {
- return;
- }
-
- if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
- /* TODO: exception */
- }
-
- RETURN_LONG(php_COM_release((comval *) intern->data));
-}
-/* }}} */
-
-ZEND_FUNCTION(com_next)
-{
- zval *object;
- rpc_internal *intern;
- comval *obj;
- unsigned long count = 1;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &object, com_class_entry, &count) != SUCCESS) {
- return;
- }
-
- if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
- /* TODO: exception */
- }
-
- obj = (comval *) intern->data;
-
- if (C_HASENUM(obj)) {
- SAFEARRAY *pSA;
- SAFEARRAYBOUND rgsabound[1];
- VARIANT *result;
- HRESULT hr;
-
- /* Grab one argument off the stack, allocate enough
- * VARIANTs
- * Get the IEnumVariant interface and call ->Next();
- */
-
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = count;
-
- result = (VARIANT *) emalloc(sizeof(VARIANT));
- VariantInit(result);
-
- if ((pSA = SafeArrayCreate(VT_VARIANT, 1, rgsabound)) == NULL) {
- efree(result);
- /* @todo exception */
-
- RETURN_NULL();
- } else {
- V_ARRAY(result) = pSA;
- V_VT(result) = VT_VARIANT|VT_ARRAY;
- }
-
- if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Next(C_ENUMVARIANT(obj), count, pSA->pvData, &count))) {
- char *error_message;
-
- efree(result);
- error_message = php_COM_error_message(hr);
- rpc_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
- efree(error_message);
-
- RETURN_NULL();
- }
-
- if (count != rgsabound[0].cElements) {
- rgsabound[0].cElements = count;
- if (FAILED(SafeArrayRedim(pSA, rgsabound))) {
- char *error_message;
-
- efree(result);
- error_message = php_COM_error_message(hr);
- rpc_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
- efree(error_message);
-
- RETURN_NULL();
- }
- }
-
- /* return a single element if next() was called without count */
- if ((ZEND_NUM_ARGS() == 0) && (count == 1)) {
- long index[] = {0};
-
- SafeArrayGetElement(pSA, index, result);
- SafeArrayDestroy(pSA);
- }
-
- RETURN_VARIANT(result, C_CODEPAGE(obj));
- }
-
- /* @todo exception */
- RETURN_NULL();
-}
-
-ZEND_FUNCTION(com_all)
-{
-#if 0
- } else if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "all")) {
-#define FETCH_BLOCKSIZE 10 /* fetch blocks of 10 elements */
-
- count = FETCH_BLOCKSIZE;
-
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = count;
-
- if ((pSA = SafeArrayCreate(VT_VARIANT, 1, rgsabound)) == NULL) {
- VariantInit(var_result);
- return FAILURE;
- } else {
- V_ARRAY(var_result) = pSA;
- V_VT(var_result) = VT_VARIANT|VT_ARRAY;
- }
-
- /* blah*/
-#endif
-}
-
-ZEND_FUNCTION(com_reset)
-{
- zval *object;
- rpc_internal *intern;
- comval *obj;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, com_class_entry) != SUCCESS) {
- return;
- }
-
- if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
- /* TODO: exception */
- }
-
- obj = (comval *) intern->data;
-
- if (C_HASENUM(obj)) {
- HRESULT hr;
-
- if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Reset(C_ENUMVARIANT(obj)))) {
- char *error_message = php_COM_error_message(hr);
- rpc_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
- efree(error_message);
-
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
- }
-
- /* @todo exception */
- RETURN_FALSE;
-}
-
-ZEND_FUNCTION(com_skip)
-{
- zval *object;
- rpc_internal *intern;
- comval *obj;
- unsigned long count = 1;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &object, com_class_entry, &count) != SUCCESS) {
- return;
- }
-
- if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
- /* TODO: exception */
- }
-
- obj = (comval *) intern->data;
-
- if (C_HASENUM(obj)) {
- HRESULT hr;
-
- if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Skip(C_ENUMVARIANT(obj), count))) {
- char *error_message = php_COM_error_message(hr);
- rpc_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
- efree(error_message);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
- }
-
- /* @todo exception */
- RETURN_FALSE;
-}
-
-/* {{{ proto bool com_isenum(object com_module)
- Grabs an IEnumVariant */
-ZEND_FUNCTION(com_isenum)
-{
- zval *object;
- rpc_internal *intern;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, com_class_entry) != SUCCESS) {
- return;
- }
-
- if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
- /* TODO: exception */
- }
-
- RETURN_BOOL(C_HASENUM((comval *) intern->data));
-}
-/* }}} */
-
-/* {{{ proto bool com_load_typelib(string typelib_name [, int case_insensitive])
- Loads a Typelib */
-ZEND_FUNCTION(com_load_typelib)
-{
- char *typelib;
- int len, cis = FALSE;
- int mode = CONST_CS;
- ITypeLib *pTL;
-
- zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &typelib, &len, &cis);
-
- if (cis) {
- mode &= ~CONST_CS;
- }
-
- pTL = php_COM_find_typelib(typelib, mode);
- if (php_COM_load_typelib(pTL, mode) == SUCCESS) {
- pTL->lpVtbl->Release(pTL);
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool com_print_typeinfo(mixed comobject | string typelib, string dispinterface, bool wantsink)
- Print out a PHP class definition for a dispatchable interface */
-ZEND_FUNCTION(com_print_typeinfo)
-{
- zval *object;
- char *ifacename = NULL;
- char *typelibname = NULL;
- int typeliblen, ifacelen;
- zend_bool wantsink = 0;
- comval *obj = NULL;
- rpc_internal *intern;
- ITypeInfo *typeinfo;
-
- if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s/s!b",
- &typelibname, &typeliblen, &ifacename, &ifacelen, &wantsink)) {
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O/s!b",
- &object, com_class_entry, &ifacename, &ifacelen, &wantsink)) {
- RETURN_FALSE;
- } else {
- if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
- /* TODO: exception */
- }
-
- obj = (comval *) intern->data;
- }
- }
-
- typeinfo = php_COM_locate_typeinfo(typelibname, obj, ifacename, wantsink);
- if (typeinfo) {
- php_COM_process_typeinfo(typeinfo, NULL, 1, NULL);
- typeinfo->lpVtbl->Release(typeinfo);
-
- RETURN_TRUE;
- } else {
- rpc_error(E_WARNING, "Unable to find typeinfo using the parameters supplied");
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool com_event_sink(mixed comobject, object sinkobject [, mixed sinkinterface])
- Connect events from a COM object to a PHP object */
-ZEND_FUNCTION(com_event_sink)
-{
- zval *object, *sinkobject, *sink=NULL;
- char *dispname = NULL, *typelibname = NULL;
- zend_bool gotguid = 0;
- comval *obj;
- rpc_internal *intern;
- ITypeInfo *typeinfo = NULL;
-
- RETVAL_FALSE;
-
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oz|z/", &object, com_class_entry, &sinkobject, &sink)) {
- RETURN_FALSE;
- }
-
- if (sink && Z_TYPE_P(sink) == IS_ARRAY) {
- /* 0 => typelibname, 1 => dispname */
- zval **tmp;
-
- if (zend_hash_index_find(Z_ARRVAL_P(sink), 0, (void**)&tmp) == SUCCESS)
- typelibname = Z_STRVAL_PP(tmp);
- if (zend_hash_index_find(Z_ARRVAL_P(sink), 1, (void**)&tmp) == SUCCESS)
- dispname = Z_STRVAL_PP(tmp);
- } else if (sink != NULL) {
- convert_to_string_ex(&sink);
- dispname = Z_STRVAL_P(sink);
- }
-
- if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
- /* TODO: exception */
- }
-
- obj = (comval *) intern->data;
-
- typeinfo = php_COM_locate_typeinfo(typelibname, obj, dispname, 1);
-
- if (typeinfo) {
- HashTable *id_to_name;
-
- ALLOC_HASHTABLE(id_to_name);
-
- if (php_COM_process_typeinfo(typeinfo, id_to_name, 0, &obj->sinkid)) {
-
- /* Create the COM wrapper for this sink */
- obj->sinkdispatch = php_COM_export_as_sink(sinkobject, &obj->sinkid, id_to_name);
-
- /* Now hook it up to the source */
- php_COM_enable_events(obj, TRUE);
-
- RETVAL_TRUE;
-
- } else {
- FREE_HASHTABLE(id_to_name);
- }
- }
-
- if (typeinfo)
- typeinfo->lpVtbl->Release(typeinfo);
-
-}
-/* }}} */
-
-
-
-/* ini callbacks */
-
-static ZEND_INI_MH(com_typelib_file_change)
-{
- FILE *typelib_file;
- char *typelib_name_buffer;
- char *strtok_buf = NULL;
- int interactive;
- interactive = CG(interactive);
-
- if (!new_value || (typelib_file = VCWD_FOPEN(new_value, "r"))==NULL) {
- return FAILURE;
- }
-
- if (interactive) {
- printf("Loading type libraries...");
- fflush(stdout);
- }
-
- typelib_name_buffer = (char *) emalloc(sizeof(char)*1024);
-
- while (fgets(typelib_name_buffer, 1024, typelib_file)) {
- ITypeLib *pTL;
- char *typelib_name;
- char *modifier, *ptr;
- int mode = CONST_CS | CONST_PERSISTENT; /* CONST_PERSISTENT is ok here */
-
- if (typelib_name_buffer[0]==';') {
- continue;
- }
- typelib_name = php_strtok_r(typelib_name_buffer, "\r\n", &strtok_buf); /* get rid of newlines */
- if (typelib_name == NULL) {
- continue;
- }
- typelib_name = php_strtok_r(typelib_name, "#", &strtok_buf);
- modifier = php_strtok_r(NULL, "#", &strtok_buf);
- if (modifier != NULL) {
- if (!strcmp(modifier, "cis") || !strcmp(modifier, "case_insensitive")) {
- mode &= ~CONST_CS;
- }
- }
-
- /* Remove leading/training white spaces on search_string */
- while (isspace(*typelib_name)) {/* Ends on '\0' in worst case */
- typelib_name ++;
- }
- ptr = typelib_name + strlen(typelib_name) - 1;
- while ((ptr != typelib_name) && isspace(*ptr)) {
- *ptr = '\0';
- ptr--;
- }
-
- if (interactive) {
- printf("\rLoading %-60s\r", typelib_name);
- }
-
- if ((pTL = php_COM_find_typelib(typelib_name, mode)) != NULL) {
- php_COM_load_typelib(pTL, mode);
- pTL->lpVtbl->Release(pTL);
- }
- }
-
- efree(typelib_name_buffer);
- fclose(typelib_file);
-
- if (interactive) {
- printf("\r%70s\r", "");
- }
-
- return SUCCESS;
-} \ No newline at end of file
diff --git a/ext/rpc/com/com.dsp b/ext/rpc/com/com.dsp
deleted file mode 100644
index ae933eecc7..0000000000
--- a/ext/rpc/com/com.dsp
+++ /dev/null
@@ -1,167 +0,0 @@
-# Microsoft Developer Studio Project File - Name="com" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=com - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "com.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "com.mak" CFG="com - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "com - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "com - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "com - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "com - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "com - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release/php_rpc_com.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "com - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug/php_rpc_com.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "com - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /D /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_rpc_com.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "com - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_rpc_com.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "com - Win32 Release"
-# Name "com - Win32 Debug"
-# Name "com - Win32 Debug_TS"
-# Name "com - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\com.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_com.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\README
-# End Source File
-# End Target
-# End Project
diff --git a/ext/rpc/com/com.h b/ext/rpc/com/com.h
deleted file mode 100644
index c0f63eb4d6..0000000000
--- a/ext/rpc/com/com.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef COM_H
-#define COM_H
-
-#include "../handler.h"
-#include "../php_rpc.h"
-
-#ifndef PHP_COM_DONT_DECLARE_RPC_HANDLER
-RPC_DECLARE_HANDLER(com);
-#endif
-
-ZEND_MINIT_FUNCTION(com);
-ZEND_MSHUTDOWN_FUNCTION(com);
-ZEND_MINFO_FUNCTION(com);
-
-ZEND_FUNCTION(com_addref);
-ZEND_FUNCTION(com_release);
-ZEND_FUNCTION(com_isenum);
-ZEND_FUNCTION(com_next);
-ZEND_FUNCTION(com_all);
-ZEND_FUNCTION(com_reset);
-ZEND_FUNCTION(com_skip);
-ZEND_FUNCTION(com_event_sink);
-ZEND_FUNCTION(com_message_pump);
-ZEND_FUNCTION(com_load_typelib);
-ZEND_FUNCTION(com_print_typeinfo);
-
-#endif \ No newline at end of file
diff --git a/ext/rpc/com/com_wrapper.c b/ext/rpc/com/com_wrapper.c
deleted file mode 100644
index 5892611485..0000000000
--- a/ext/rpc/com/com_wrapper.c
+++ /dev/null
@@ -1,930 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- | Harald Radi <h.radi@nme.at> |
- | Alan Brown <abrown@pobox.com> |
- | Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-/*
- * This module implements support for COM components that support the IDispatch
- * interface. Both local (COM) and remote (DCOM) components can be accessed.
- *
- * Type libraries can be loaded (in order for PHP to recognize automation constants)
- * by specifying a typelib_file in the PHP .ini file. That file should contain
- * paths to type libraries, one in every line. By default, constants are registered
- * as case-sensitive. If you want them to be defined as case-insensitive, add
- * #case_insensitive or #cis at the end of the type library path.
- *
- * This is also the first module to demonstrate Zend's OO syntax overloading
- * capabilities. CORBA coders are invited to write a CORBA module as well!
- *
- * Zeev
- */
-
-/*
- * 28.12.2000
- * unicode conversion fixed by Harald Radi <h.radi@nme.at>
- *
- * now all these strange '?'s should be disapeared
- */
-
-/*
- * 28.1.2001
- * VARIANT datatype and pass_by_reference support
- */
-
-/*
- * 03.6.2001
- * Enhanced Typelib support to include a search by name
- */
-
-#ifdef PHP_WIN32
-
-#define _WIN32_DCOM
-
-#include "php.h"
-#include "php_ini.h"
-
-#include <iostream.h>
-#include <math.h>
-#include <ocidl.h>
-
-#include "../rpc.h"
-#include "../php_rpc.h"
-#include "../handler.h"
-
-#include "com.h"
-#include "com_wrapper.h"
-#include "conversion.h"
-#include "variant.h"
-
-#ifdef _DEBUG
-int resourcecounter = 1;
-#endif
-
-ZEND_API HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags,
- DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult, char **ErrString)
-{
- HRESULT hr;
- int failed = FALSE;
- unsigned int ArgErr = 0;
- EXCEPINFO ExceptInfo;
-
- *ErrString = NULL;
- /* @todo use DispInvoke here ? */
- if (C_HASTLIB(obj)) {
- hr = C_TYPEINFO_VT(obj)->Invoke(C_TYPEINFO(obj), C_DISPATCH(obj),
- dispIdMember, wFlags, pDispParams, pVarResult, &ExceptInfo, &ArgErr);
- if (FAILED(hr) && (hr != DISP_E_EXCEPTION)) {
- hr = C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), dispIdMember, &IID_NULL,
- LOCALE_SYSTEM_DEFAULT, wFlags, pDispParams, pVarResult, &ExceptInfo, &ArgErr);
- if (SUCCEEDED(hr)) {
- /*
- * ITypLib doesn't work
- * Release ITypeLib and fall back to IDispatch
- */
-
- C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
- C_HASTLIB(obj) = FALSE;
- }
- }
- } else {
- hr = C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), dispIdMember, &IID_NULL,
- LOCALE_SYSTEM_DEFAULT, wFlags, pDispParams, pVarResult, &ExceptInfo, &ArgErr);
- }
-
- if (FAILED(hr)) {
- switch (hr) {
- case DISP_E_EXCEPTION: {
-
- char *src=estrdup("Unavailable");
- int srclen=strlen(src);
- char *desc=estrdup("Unavailable");
- int desclen=strlen(desc);
-
- if (ExceptInfo.bstrSource)
- {
- efree(src);
- src = php_OLECHAR_to_char(ExceptInfo.bstrSource, &srclen, C_CODEPAGE(obj), FALSE);
- SysFreeString(ExceptInfo.bstrSource);
- }
- if (ExceptInfo.bstrDescription)
- {
- efree(desc);
- desc = php_OLECHAR_to_char(ExceptInfo.bstrDescription, &desclen, C_CODEPAGE(obj), FALSE);
- SysFreeString(ExceptInfo.bstrDescription);
- }
-
- spprintf(ErrString, 0, "<b>Source</b>: %s <b>Description</b>: %s", src, desc);
- efree(src);
- efree(desc);
-
- if (ExceptInfo.bstrHelpFile)
- {
- SysFreeString(ExceptInfo.bstrHelpFile);
- }
- }
- break;
- case DISP_E_PARAMNOTFOUND:
- case DISP_E_TYPEMISMATCH:
- spprintf(ErrString, 0, "<b>Argument</b>: %d", pDispParams->cArgs - ArgErr);
- break;
- }
- }
-
- if (pVarResult && (V_VT(pVarResult) == VT_EMPTY)) {
- V_VT(pVarResult) = VT_I4;
- V_I4(pVarResult) = hr;
- }
-
- return hr;
-}
-
-
-ZEND_API HRESULT php_COM_get_ids_of_names(comval *obj, OLECHAR FAR* rgszNames, DISPID FAR* rgDispId)
-{
- HRESULT hr;
-
- if (C_HASTLIB(obj)) {
- hr = C_TYPEINFO_VT(obj)->GetIDsOfNames(C_TYPEINFO(obj), &rgszNames, 1, rgDispId);
-
- if (FAILED(hr)) {
- hr = C_DISPATCH_VT(obj)->GetIDsOfNames(C_DISPATCH(obj), &IID_NULL, &rgszNames, 1, LOCALE_SYSTEM_DEFAULT, rgDispId);
-
- if (SUCCEEDED(hr)) {
- /*
- * ITypLib doesn't work
- * Release ITypeLib and fall back to IDispatch
- */
-
- C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
- C_HASTLIB(obj) = FALSE;
- }
- }
- } else {
- hr = C_DISPATCH_VT(obj)->GetIDsOfNames(C_DISPATCH(obj), &IID_NULL, &rgszNames, 1, LOCALE_SYSTEM_DEFAULT, rgDispId);
- }
-
- return hr;
-}
-
-
-ZEND_API HRESULT php_COM_release(comval *obj)
-{
- return C_DISPATCH_VT(obj)->Release(C_DISPATCH(obj));
-}
-
-
-ZEND_API HRESULT php_COM_addref(comval *obj)
-{
- return C_DISPATCH_VT(obj)->AddRef(C_DISPATCH(obj));
-}
-
-
-ZEND_API HRESULT php_COM_set(comval *obj, IDispatch FAR* FAR* ppDisp, int cleanup)
-{
- HRESULT hr = 1;
- DISPPARAMS dispparams;
- VARIANT *result;
- IDispatch FAR* pDisp;
-
- pDisp = *ppDisp;
- if (cleanup) {
- *ppDisp = NULL;
- }
-
- C_DISPATCH(obj) = pDisp;
- C_HASTLIB(obj) = SUCCEEDED(C_DISPATCH_VT(obj)->GetTypeInfo(C_DISPATCH(obj), 0, LANG_NEUTRAL, &C_TYPEINFO(obj)));
-
- dispparams.rgvarg = NULL;
- dispparams.rgdispidNamedArgs = NULL;
- dispparams.cArgs = 0;
- dispparams.cNamedArgs = 0;
-
- result = (VARIANT *) emalloc(sizeof(VARIANT));
- VariantInit(result);
-
- if (C_HASENUM(obj) = SUCCEEDED(C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), DISPID_NEWENUM, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
- DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dispparams, result, NULL, NULL))) {
- if (V_VT(result) == VT_UNKNOWN) {
- V_UNKNOWN(result)->lpVtbl->AddRef(V_UNKNOWN(result));
- C_HASENUM(obj) = SUCCEEDED(V_UNKNOWN(result)->lpVtbl->QueryInterface(V_UNKNOWN(result), &IID_IEnumVARIANT,
- (void**)&C_ENUMVARIANT(obj)));
- } else if (V_VT(result) == VT_DISPATCH) {
- V_DISPATCH(result)->lpVtbl->AddRef(V_DISPATCH(result));
- C_HASENUM(obj) = SUCCEEDED(V_DISPATCH(result)->lpVtbl->QueryInterface(V_DISPATCH(result), &IID_IEnumVARIANT,
- (void**)&C_ENUMVARIANT(obj)));
- }
- }
-
- efree(result);
-
- if (!cleanup) {
- hr = C_DISPATCH_VT(obj)->AddRef(C_DISPATCH(obj));
- }
-
-#ifdef _DEBUG
- obj->resourceindex = resourcecounter++;
-#endif
-
- return hr;
-}
-
-
-
-
-ZEND_API char *php_COM_error_message(HRESULT hr)
-{
- void *pMsgBuf = NULL;
-
- if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
- hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pMsgBuf, 0, NULL)) {
- char error_string[] = "No description available";
-
- pMsgBuf = LocalAlloc(LMEM_FIXED, sizeof(error_string));
- memcpy(pMsgBuf, error_string, sizeof(error_string));
- }
-
- return pMsgBuf;
-}
-
-
-ZEND_API char *php_COM_string_from_CLSID(const CLSID *clsid)
-{
- LPOLESTR ole_clsid;
- char *clsid_str;
-
- StringFromCLSID(clsid, &ole_clsid);
- clsid_str = php_OLECHAR_to_char(ole_clsid, NULL, CP_ACP, FALSE);
- CoTaskMemFree(ole_clsid);
-
- return clsid_str;
-}
-
-
-ZEND_API HRESULT php_COM_destruct(comval *obj)
-{
- HRESULT hr = S_OK;
-
- php_COM_enable_events(obj, FALSE);
- if (obj->sinkdispatch)
- obj->sinkdispatch->lpVtbl->Release(obj->sinkdispatch);
-
- if (C_HASTLIB(obj)) {
- C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
- }
- if (C_HASENUM(obj)) {
- C_ENUMVARIANT_VT(obj)->Release(C_ENUMVARIANT(obj));
- }
-
- if (C_DISPATCH(obj)) {
- hr = C_DISPATCH_VT(obj)->Release(C_DISPATCH(obj));
- }
- efree(obj);
-
- return hr;
-}
-
-
-
-
-
-
-
-
-/* {{{ proto bool com_message_pump([int timeoutms])
- Process COM messages, sleeping for up to timeoutms milliseconds */
-PHP_FUNCTION(com_message_pump)
-{
- long timeoutms = 0;
- MSG msg;
- DWORD result;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &timeoutms) == FAILURE)
- RETURN_FALSE;
-
- result = MsgWaitForMultipleObjects(0, NULL, FALSE, timeoutms, QS_ALLINPUT);
-
- if (result == WAIT_OBJECT_0) {
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- /* we processed messages */
- RETVAL_TRUE;
- } else {
- /* we did not process messages (timed out) */
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-ZEND_API HRESULT php_COM_enable_events(comval *obj, int enable)
-{
- if (obj->sinkdispatch) {
- IConnectionPointContainer *cont;
- IConnectionPoint *point;
-
- if (SUCCEEDED(C_DISPATCH_VT(obj)->QueryInterface(C_DISPATCH(obj), &IID_IConnectionPointContainer, (void**)&cont))) {
- if (SUCCEEDED(cont->lpVtbl->FindConnectionPoint(cont, &obj->sinkid, &point))) {
- if (enable) {
- point->lpVtbl->Advise(point, (IUnknown*)obj->sinkdispatch, &obj->sinkcookie);
- } else {
- point->lpVtbl->Unadvise(point, obj->sinkcookie);
- }
- point->lpVtbl->Release(point);
- }
- cont->lpVtbl->Release(cont);
- }
- }
-
- return S_OK;
-}
-
-static const struct {
- VARTYPE vt;
- const char *name;
-} vt_names[] = {
- { VT_NULL, "VT_NULL" },
- { VT_EMPTY, "VT_EMPTY" },
- { VT_UI1, "VT_UI1" },
- { VT_I2, "VT_I2" },
- { VT_I4, "VT_I4" },
- { VT_R4, "VT_R4" },
- { VT_R8, "VT_R8" },
- { VT_BOOL, "VT_BOOL" },
- { VT_ERROR, "VT_ERROR" },
- { VT_CY, "VT_CY" },
- { VT_DATE, "VT_DATE" },
- { VT_BSTR, "VT_BSTR" },
- { VT_DECIMAL, "VT_DECIMAL" },
- { VT_UNKNOWN, "VT_UNKNOWN" },
- { VT_DISPATCH, "VT_DISPATCH" },
- { VT_VARIANT, "VT_VARIANT" },
- { VT_I1, "VT_I1" },
- { VT_UI2, "VT_UI2" },
- { VT_UI4, "VT_UI4" },
- { VT_INT, "VT_INT" },
- { VT_UINT, "VT_UINT" },
- { VT_ARRAY, "VT_ARRAY" },
- { VT_BYREF, "VT_BYREF" },
- { VT_VOID, "VT_VOID" },
- { VT_PTR, "VT_PTR" },
- { VT_HRESULT, "VT_HRESULT" },
- { 0, NULL }
-};
-
-static inline const char *vt_to_string(VARTYPE vt)
-{
- int i;
- for (i = 0; vt_names[i].name != NULL; i++) {
- if (vt_names[i].vt == vt)
- return vt_names[i].name;
- }
- return "?";
-}
-
-ZEND_API int php_COM_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int printdef, GUID *guid)
-{
- TYPEATTR *attr;
- FUNCDESC *func;
- int i;
- OLECHAR *olename;
- char *ansiname = NULL;
- unsigned int ansinamelen;
- int ret = 0;
-
- if (FAILED(typeinfo->lpVtbl->GetTypeAttr(typeinfo, &attr)))
- return 0;
-
- /* verify that it is suitable */
- if (id_to_name == NULL || attr->typekind == TKIND_DISPATCH) {
-
- if (guid)
- memcpy(guid, &attr->guid, sizeof(GUID));
-
- if (printdef) {
- char *guidstring;
-
- typeinfo->lpVtbl->GetDocumentation(typeinfo, MEMBERID_NIL, &olename, NULL, NULL, NULL);
- ansiname = php_OLECHAR_to_char(olename, &ansinamelen, CP_ACP, FALSE);
- SysFreeString(olename);
-
- guidstring = php_COM_string_from_CLSID(&attr->guid);
- php_printf("class %s { /* GUID=%s */\n", ansiname, guidstring);
- efree(guidstring);
-
- efree(ansiname);
- }
-
- if (id_to_name)
- zend_hash_init(id_to_name, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- /* So we've got the dispatch interface; lets list the event methods */
- for (i = 0; i < attr->cFuncs; i++) {
- zval *tmp;
- DISPID lastid = 0; /* for props */
- int isprop;
-
- if (FAILED(typeinfo->lpVtbl->GetFuncDesc(typeinfo, i, &func)))
- break;
-
- isprop = (func->invkind & DISPATCH_PROPERTYGET || func->invkind & DISPATCH_PROPERTYPUT);
-
- if (!isprop || lastid != func->memid) {
-
- lastid = func->memid;
-
- typeinfo->lpVtbl->GetDocumentation(typeinfo, func->memid, &olename, NULL, NULL, NULL);
- ansiname = php_OLECHAR_to_char(olename, &ansinamelen, CP_ACP, FALSE);
- SysFreeString(olename);
-
- if (printdef) {
- int j;
- char *funcdesc;
- unsigned int funcdesclen, cnames = 0;
- BSTR *names;
-
- names = (BSTR*)emalloc((func->cParams + 1) * sizeof(BSTR));
-
- typeinfo->lpVtbl->GetNames(typeinfo, func->memid, names, func->cParams + 1, &cnames);
- /* first element is the function name */
- SysFreeString(names[0]);
-
- php_printf("\t/* DISPID=%d */\n", func->memid);
-
- if (func->elemdescFunc.tdesc.vt != VT_VOID) {
- php_printf("\t/* %s [%d] */\n",
- vt_to_string(func->elemdescFunc.tdesc.vt),
- func->elemdescFunc.tdesc.vt
- );
- }
-
- if (isprop) {
-
- typeinfo->lpVtbl->GetDocumentation(typeinfo, func->memid, NULL, &olename, NULL, NULL);
- if (olename) {
- funcdesc = php_OLECHAR_to_char(olename, &funcdesclen, CP_ACP, FALSE);
- SysFreeString(olename);
- php_printf("\t/* %s */\n", funcdesc);
- efree(funcdesc);
- }
-
- php_printf("\tvar $%s;\n\n", ansiname);
-
- } else {
- /* a function */
-
- php_printf("\tfunction %s(\n", ansiname);
-
- for (j = 0; j < func->cParams; j++) {
- ELEMDESC *elem = &func->lprgelemdescParam[j];
-
- php_printf("\t\t/* %s [%d] ", vt_to_string(elem->tdesc.vt), elem->tdesc.vt);
-
- if (elem->paramdesc.wParamFlags & PARAMFLAG_FIN)
- php_printf("[in]");
- if (elem->paramdesc.wParamFlags & PARAMFLAG_FOUT)
- php_printf("[out]");
-
- if (elem->tdesc.vt == VT_PTR) {
- /* what does it point to ? */
- php_printf(" --> %s [%d] ",
- vt_to_string(elem->tdesc.lptdesc->vt),
- elem->tdesc.lptdesc->vt
- );
- }
-
- /* when we handle prop put and get, this will look nicer */
- if (j+1 < (int)cnames) {
- funcdesc = php_OLECHAR_to_char(names[j+1], &funcdesclen, CP_ACP, FALSE);
- SysFreeString(names[j+1]);
- } else {
- funcdesc = "???";
- }
-
- php_printf(" */ %s%s%c\n",
- elem->tdesc.vt == VT_PTR ? "&$" : "$",
- funcdesc,
- j == func->cParams - 1 ? ' ' : ','
- );
-
- if (j+1 < (int)cnames)
- efree(funcdesc);
- }
-
- php_printf("\t\t)\n\t{\n");
-
- typeinfo->lpVtbl->GetDocumentation(typeinfo, func->memid, NULL, &olename, NULL, NULL);
- if (olename) {
- funcdesc = php_OLECHAR_to_char(olename, &funcdesclen, CP_ACP, FALSE);
- SysFreeString(olename);
- php_printf("\t\t/* %s */\n", funcdesc);
- efree(funcdesc);
- }
-
- php_printf("\t}\n");
- }
-
- efree(names);
- }
-
- if (id_to_name) {
- zend_str_tolower(ansiname, ansinamelen);
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, ansiname, ansinamelen, 0);
- zend_hash_index_update(id_to_name, func->memid, (void*)&tmp, sizeof(zval *), NULL);
- }
- }
- typeinfo->lpVtbl->ReleaseFuncDesc(typeinfo, func);
-
- }
-
- if (printdef)
- php_printf("}\n");
-
- ret = 1;
- } else {
- zend_error(E_WARNING, "That's not a dispatchable interface!! type kind = %08x", attr->typekind);
- }
-
- typeinfo->lpVtbl->ReleaseTypeAttr(typeinfo, attr);
-
- return ret;
-}
-
-ZEND_API ITypeInfo *php_COM_locate_typeinfo(char *typelibname, comval *obj, char *dispname, int sink)
-{
- ITypeInfo *typeinfo = NULL;
- ITypeLib *typelib = NULL;
- int gotguid = 0;
- GUID iid;
-
- if (obj) {
- if (dispname == NULL && sink) {
- IProvideClassInfo2 *pci2;
- IProvideClassInfo *pci;
-
- if (SUCCEEDED(C_DISPATCH_VT(obj)->QueryInterface(C_DISPATCH(obj), &IID_IProvideClassInfo2, (void**)&pci2))) {
- gotguid = SUCCEEDED(pci2->lpVtbl->GetGUID(pci2, GUIDKIND_DEFAULT_SOURCE_DISP_IID, &iid));
- pci2->lpVtbl->Release(pci2);
- }
- if (!gotguid && SUCCEEDED(C_DISPATCH_VT(obj)->QueryInterface(C_DISPATCH(obj), &IID_IProvideClassInfo, (void**)&pci))) {
- /* examine the available interfaces */
- /* TODO: write some code here */
- pci->lpVtbl->Release(pci);
- }
- } else if (dispname && C_HASTLIB(obj)) {
- unsigned int idx;
- /* get the library from the object; the rest will be dealt with later */
- C_TYPEINFO_VT(obj)->GetContainingTypeLib(C_TYPEINFO(obj), &typelib, &idx);
- } else if (typelibname == NULL) {
- C_DISPATCH_VT(obj)->GetTypeInfo(C_DISPATCH(obj), 0, LANG_NEUTRAL, &typeinfo);
- }
- } else if (typelibname) {
- /* Fetch the typelibrary and use that to look things up */
- typelib = php_COM_find_typelib(typelibname, CONST_CS);
- }
-
- if (!gotguid && dispname && typelib) {
- unsigned short cfound;
- MEMBERID memid;
- OLECHAR *olename = php_char_to_OLECHAR(dispname, strlen(dispname), CP_ACP, FALSE);
-
- cfound = 1;
- if (FAILED(typelib->lpVtbl->FindName(typelib, olename, 0, &typeinfo, &memid, &cfound)) || cfound == 0) {
- CLSID coclass;
- ITypeInfo *coinfo;
-
- /* assume that it might be a progid instead */
- if (SUCCEEDED(CLSIDFromProgID(olename, &coclass)) &&
- SUCCEEDED(typelib->lpVtbl->GetTypeInfoOfGuid(typelib, &coclass, &coinfo))) {
-
- /* enumerate implemented interfaces and pick the one as indicated by sink */
- TYPEATTR *attr;
- int i;
-
- coinfo->lpVtbl->GetTypeAttr(coinfo, &attr);
-
- for (i = 0; i < attr->cImplTypes; i++) {
- HREFTYPE rt;
- int tf;
-
- if (FAILED(coinfo->lpVtbl->GetImplTypeFlags(coinfo, i, &tf)))
- continue;
-
- if ((sink && tf == (IMPLTYPEFLAG_FSOURCE|IMPLTYPEFLAG_FDEFAULT)) ||
- (!sink && (tf & IMPLTYPEFLAG_FSOURCE) == 0)) {
-
- /* flags match what we are looking for */
-
- if (SUCCEEDED(coinfo->lpVtbl->GetRefTypeOfImplType(coinfo, i, &rt)))
- if (SUCCEEDED(coinfo->lpVtbl->GetRefTypeInfo(coinfo, rt, &typeinfo)))
- break;
-
- }
- }
-
- coinfo->lpVtbl->ReleaseTypeAttr(coinfo, attr);
- coinfo->lpVtbl->Release(coinfo);
- }
- }
-
-
- efree(olename);
- } else if (gotguid) {
- typelib->lpVtbl->GetTypeInfoOfGuid(typelib, &iid, &typeinfo);
- }
-
- if (typelib)
- typelib->lpVtbl->Release(typelib);
-
- return typeinfo;
-}
-
-static ITypeLib *php_COM_find_typelib(char *search_string, int mode)
-{
- ITypeLib *TypeLib = NULL;
- char *strtok_buf, *major, *minor;
- CLSID clsid;
- OLECHAR *p;
-
- /* Type Libraries:
- * The string we have is either:
- * a) a file name
- * b) a CLSID, major, minor e.g. "{00000200-0000-0010-8000-00AA006D2EA4},2,0"
- * c) a Type Library name e.g. "Microsoft OLE DB ActiveX Data Objects 1.0 Library"
- * Searching for the name will be more expensive that the
- * other two, so we will do that when both other attempts
- * fail.
- */
-
- search_string = php_strtok_r(search_string, ",", &strtok_buf);
-
- if (search_string == NULL)
- return NULL;
-
- major = php_strtok_r(NULL, ",", &strtok_buf);
- minor = php_strtok_r(NULL, ",", &strtok_buf);
-
- p = php_char_to_OLECHAR(search_string, strlen(search_string), CP_ACP, FALSE);
- /* Is the string a GUID ? */
-
- if (!FAILED(CLSIDFromString(p, &clsid))) {
- HRESULT hr;
- WORD major_i = 1;
- WORD minor_i = 0;
-
- /* We have a valid GUID, check to see if a major/minor */
- /* version was specified otherwise assume 1,0 */
- if ((major != NULL) && (minor != NULL)) {
- major_i = (WORD) atoi(major);
- minor_i = (WORD) atoi(minor);
- }
-
- /* The GUID will either be a typelibrary or a CLSID */
- hr = LoadRegTypeLib((REFGUID) &clsid, major_i, minor_i, LANG_NEUTRAL, &TypeLib);
-
- /* If the LoadRegTypeLib fails, let's try to instantiate */
- /* the class itself and then QI for the TypeInfo and */
- /* retrieve the type info from that interface */
- if (FAILED(hr) && (!major || !minor)) {
- IDispatch *Dispatch;
- ITypeInfo *TypeInfo;
- int idx;
-
- if (FAILED(CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (LPVOID *) &Dispatch))) {
- efree(p);
- return NULL;
- }
- if (FAILED(Dispatch->lpVtbl->GetTypeInfo(Dispatch, 0, LANG_NEUTRAL, &TypeInfo))) {
- Dispatch->lpVtbl->Release(Dispatch);
- efree(p);
- return NULL;
- }
- Dispatch->lpVtbl->Release(Dispatch);
- if (FAILED(TypeInfo->lpVtbl->GetContainingTypeLib(TypeInfo, &TypeLib, &idx))) {
- TypeInfo->lpVtbl->Release(TypeInfo);
- efree(p);
- return NULL;
- }
- TypeInfo->lpVtbl->Release(TypeInfo);
- }
- } else {
- if (FAILED(LoadTypeLib(p, &TypeLib))) {
- /* Walk HKCR/TypeLib looking for the string */
- /* If that succeeds, call ourself recursively */
- /* using the CLSID found, else give up and bail */
- HKEY hkey, hsubkey;
- DWORD SubKeys, MaxSubKeyLength;
- char *keyname;
- register unsigned int ii, jj;
- DWORD VersionCount;
- char version[20]; /* All the version keys are 1.0, 4.6, ... */
- char *libname;
- DWORD libnamelen;
-
- /* No Need for Unicode version any more */
- efree(p);
-
- /* Starting at HKEY_CLASSES_ROOT/TypeLib */
- /* Walk all subkeys (Typelib GUIDs) looking */
- /* at each version for a string match to the */
- /* supplied argument */
-
- if (ERROR_SUCCESS != RegOpenKey(HKEY_CLASSES_ROOT, "TypeLib",&hkey)) {
- /* This is pretty bad - better bail */
- return NULL;
- }
- if (ERROR_SUCCESS != RegQueryInfoKey(hkey, NULL, NULL, NULL, &SubKeys, &MaxSubKeyLength, NULL, NULL, NULL, NULL, NULL, NULL)) {
- RegCloseKey(hkey);
- return NULL;
- }
- MaxSubKeyLength++; /* \0 is not counted */
- keyname = emalloc(MaxSubKeyLength);
- libname = emalloc(strlen(search_string)+1);
- for (ii=0;ii<SubKeys;ii++) {
- if (ERROR_SUCCESS != RegEnumKey(hkey, ii, keyname, MaxSubKeyLength)) {
- /* Failed - who cares */
- continue;
- }
- if (ERROR_SUCCESS != RegOpenKey(hkey, keyname, &hsubkey)) {
- /* Failed - who cares */
- continue;
- }
- if (ERROR_SUCCESS != RegQueryInfoKey(hsubkey, NULL, NULL, NULL, &VersionCount, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) {
- /* Failed - who cares */
- RegCloseKey(hsubkey);
- continue;
- }
- for (jj=0;jj<VersionCount;jj++) {
- if (ERROR_SUCCESS != RegEnumKey(hsubkey, jj, version, sizeof(version))) {
- /* Failed - who cares */
- continue;
- }
- /* OK we just need to retrieve the default */
- /* value for this key and see if it matches */
- libnamelen = strlen(search_string)+1;
- if (ERROR_SUCCESS == RegQueryValue(hsubkey, version, libname, &libnamelen)) {
- if ((mode & CONST_CS) ? (strcmp(libname, search_string) == 0) : (stricmp(libname, search_string) == 0)) {
- char *str;
- int major, minor;
-
- /* Found it */
- RegCloseKey(hkey);
- RegCloseKey(hsubkey);
-
- efree(libname);
- /* We can either open up the "win32" key and find the DLL name */
- /* Or just parse the version string and pass that in */
- /* The version string seems like a more portable solution */
- /* Given that there is a COM on Unix */
- if (2 != sscanf(version, "%d.%d", &major, &minor)) {
- major = 1;
- minor = 0;
- }
- str = emalloc(strlen(keyname)+strlen(version)+20); /* 18 == safety, 2 == extra comma and \0 */
- sprintf(str, "%s,%d,%d", keyname, major, minor);
- efree(keyname);
- TypeLib = php_COM_find_typelib(str, mode);
- efree(str);
- /* This is probbaly much harder to read and follow */
- /* But it is MUCH more effiecient than trying to */
- /* test for errors and leave through a single "return" */
- return TypeLib;
- }
- } else {
- /* Failed - perhaps too small abuffer */
- /* But if too small, then the name does not match */
- }
- }
- RegCloseKey(hsubkey);
- }
- efree(keyname);
- efree(libname);
- return NULL;
- }
- }
- efree(p);
- return TypeLib;
-}
-
-
-ZEND_API int php_COM_load_typelib(ITypeLib *TypeLib, int mode)
-{
- ITypeComp *TypeComp;
- int i;
- int interfaces;
- TSRMLS_FETCH();
-
- if (NULL == TypeLib) {
- return FAILURE;
- }
-
- interfaces = TypeLib->lpVtbl->GetTypeInfoCount(TypeLib);
-
- TypeLib->lpVtbl->GetTypeComp(TypeLib, &TypeComp);
- for (i=0; i<interfaces; i++) {
- TYPEKIND pTKind;
-
- TypeLib->lpVtbl->GetTypeInfoType(TypeLib, i, &pTKind);
- if (pTKind==TKIND_ENUM) {
- ITypeInfo *TypeInfo;
- VARDESC *pVarDesc;
- UINT NameCount;
- int j;
- BSTR bstr_EnumId;
- char *EnumId;
-
- TypeLib->lpVtbl->GetDocumentation(TypeLib, i, &bstr_EnumId, NULL, NULL, NULL);
- EnumId = php_OLECHAR_to_char(bstr_EnumId, NULL, CP_ACP, FALSE);
- printf("Enumeration %d - %s:\n", i, EnumId);
- efree(EnumId);
-
- TypeLib->lpVtbl->GetTypeInfo(TypeLib, i, &TypeInfo);
-
- j=0;
- while (SUCCEEDED(TypeInfo->lpVtbl->GetVarDesc(TypeInfo, j, &pVarDesc))) {
- BSTR bstr_ids;
- zend_constant c;
- zval exists, results, value;
- char *const_name;
-
- TypeInfo->lpVtbl->GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
- if (NameCount!=1) {
- j++;
- continue;
- }
- const_name = php_OLECHAR_to_char(bstr_ids, &c.name_len, CP_ACP, FALSE);
- c.name = zend_strndup(const_name, c.name_len);
- efree(const_name);
- c.name_len++; /* length should include the NULL */
- SysFreeString(bstr_ids);
-
- /* Before registering the contsnt, let's see if we can find it */
- if (zend_get_constant(c.name, c.name_len-1, &exists TSRMLS_CC)) {
- /* Oops, it already exists. No problem if it is defined as the same value */
- /* Check to see if they are the same */
- if (!compare_function(&results, &c.value, &exists TSRMLS_CC) && INI_INT("com.autoregister_verbose")) {
- rpc_error(E_WARNING, "Type library value %s is already defined and has a different value", c.name);
- }
- free(c.name);
- j++;
- continue;
- }
-
- php_variant_to_zval(pVarDesc->lpvarValue, &value, CP_ACP);
- /* we only import enumerations (=int) */
- if (Z_TYPE(value) == IS_LONG) {
- c.flags = mode;
- c.value.type = IS_LONG;
- c.value.value.lval = Z_LVAL(value);
- c.module_number = 0; /* the module number is not available here */
-
- zend_register_constant(&c TSRMLS_CC);
- }
-
- j++;
- }
- TypeInfo->lpVtbl->Release(TypeInfo);
- }
- }
-
- return SUCCESS;
-}
-
-
-/* create an overloaded COM object from a dispatch pointer */
-PHPAPI zval *php_COM_object_from_dispatch(IDispatch *disp)
-{
- comval *obj;
-
- ALLOC_COM(obj);
- php_COM_set(obj, &disp, FALSE);
-
- return rpc_object_from_data(com, obj);
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/rpc/com/com_wrapper.h b/ext/rpc/com/com_wrapper.h
deleted file mode 100644
index c751df4931..0000000000
--- a/ext/rpc/com/com_wrapper.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- | Harald Radi <h.radi@nme.at> |
- | Alan Brown <abrown@pobox.com> |
- | Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef COM_WRAPPER_H
-#define COM_WRAPPER_H
-
-#if PHP_WIN32
-
-BEGIN_EXTERN_C()
-
-typedef struct comval_ {
- BOOL typelib;
- BOOL enumeration;
- int refcount;
- int codepage;
- struct {
- IDispatch *dispatch;
- ITypeInfo *typeinfo;
- IEnumVARIANT *enumvariant;
- } i;
-
-#if 1
- IDispatch *sinkdispatch;
- GUID sinkid;
- DWORD sinkcookie;
-#endif
-
-#ifdef _DEBUG
- int resourceindex;
-#endif
-
-} comval;
-
-ZEND_API HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult, char **ErrString);
-ZEND_API HRESULT php_COM_get_ids_of_names(comval *obj, OLECHAR FAR* rgszNames, DISPID FAR* rgDispId);
-ZEND_API HRESULT php_COM_release(comval *obj);
-ZEND_API HRESULT php_COM_addref(comval *obj);
-ZEND_API HRESULT php_COM_destruct(comval *obj);
-ZEND_API HRESULT php_COM_set(comval *obj, IDispatch FAR* FAR* pDisp, int cleanup);
-ZEND_API HRESULT php_COM_enable_events(comval *obj, int enable);
-
-ZEND_API char* php_COM_string_from_CLSID(const CLSID *clsid);
-ZEND_API char* php_COM_error_message(HRESULT hr);
-ZEND_API int php_COM_load_typelib(ITypeLib *TypeLib, int mode);
-ZEND_API int php_COM_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int printdef, GUID *guid);
-ZEND_API ITypeInfo* php_COM_locate_typeinfo(char *typelibname, comval *obj, char *dispname, int sink);
-ZEND_API ITypeLib* php_COM_find_typelib(char *search_string, int mode);
-
-ZEND_API IDispatch* php_COM_export_as_sink(zval *val, GUID *sinkid, HashTable *id_to_name);
-ZEND_API IDispatch* php_COM_export_object(zval *val);
-ZEND_API zval* php_COM_object_from_dispatch(IDispatch *disp);
-
-END_EXTERN_C()
-
-#define ZVAL_COM(z,o) { \
- rpc_internal *intern; \
- Z_TYPE_P(z) = IS_OBJECT; \
- (z)->value.obj = rpc_objects_new(com_class_entry TSRMLS_CC); \
- if (GET_INTERNAL_EX(intern, (z)) != SUCCESS) { \
- /* TODO: exception */ \
- } \
- intern->data = (o); \
- }
-
-#define RETVAL_COM(o) ZVAL_COM(&return_value, o);
-#define RETURN_COM(o) RETVAL_COM(o) \
- return;
-
-#define ALLOC_COM(z) (z) = (comval *) ecalloc(1, sizeof(comval)); \
- C_CODEPAGE(z) = CP_ACP;
-
-#define FREE_COM(z) php_COM_destruct(z);
-
-#define C_CODEPAGE(x) ((x)->codepage)
-
-#define C_HASTLIB(x) ((x)->typelib)
-#define C_HASENUM(x) ((x)->enumeration)
-
-#define C_DISPATCH(x) ((x)->i.dispatch)
-#define C_TYPEINFO(x) ((x)->i.typeinfo)
-#define C_ENUMVARIANT(x) ((x)->i.enumvariant)
-
-#define C_DISPATCH_VT(x) (C_DISPATCH(x)->lpVtbl)
-#define C_TYPEINFO_VT(x) (C_TYPEINFO(x)->lpVtbl)
-#define C_ENUMVARIANT_VT(x) (C_ENUMVARIANT(x)->lpVtbl)
-
-#endif /* PHP_WIN32 */
-
-#endif /* COM_H */
diff --git a/ext/rpc/com/conversion.c b/ext/rpc/com/conversion.c
deleted file mode 100644
index 8cc9e0197a..0000000000
--- a/ext/rpc/com/conversion.c
+++ /dev/null
@@ -1,855 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- | Alan Brown <abrown@pobox.com> |
- | Paul Shortis <pshortis@dataworx.com.au> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * 03.6.2001
- * Added SafeArray ==> Hash support
- */
-
-/*
- * Paul Shortis June 7, 2001 <pshortis@dataworx.com.au> - Added code to support SafeArray passing
- * to COM objects. Support includes passing arrays of variants as well
- * as typed arrays.
- */
-
-#ifdef PHP_WIN32
-
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#include "php.h"
-
-#include "../rpc.h"
-#include "../handler.h"
-
-#include "com.h"
-#include "com_wrapper.h"
-#include "conversion.h"
-#include "variant.h"
-
-/* prototypes */
-
-static int comval_to_variant(zval *zval_arg, VARIANT *var_arg);
-
-/* implementations */
-PHPAPI void php_zval_to_variant(zval *zval_arg, VARIANT *var_arg, int codepage TSRMLS_DC)
-{
- int type = VT_EMPTY; /* default variant type */
-
- switch (Z_TYPE_P(zval_arg)) {
- case IS_NULL:
- type = VT_NULL;
- break;
-
- case IS_BOOL:
- type = VT_BOOL;
- break;
-
- case IS_OBJECT:
- if (!strcmp(Z_OBJCE_P(zval_arg)->name, "VARIANT")) {
- type = VT_VARIANT|VT_BYREF;
- } else {
- type = VT_DISPATCH;
- }
- break;
-
- case IS_ARRAY:
- type = VT_ARRAY;
- break;
-
- case IS_RESOURCE:
- case IS_CONSTANT:
- case IS_CONSTANT_ARRAY:
- /* ?? */
- break;
-
- case IS_LONG:
- type = VT_I4; /* assuming 32-bit platform */
- break;
-
- case IS_DOUBLE:
- type = VT_R8; /* assuming 64-bit double precision */
- break;
-
- case IS_STRING:
- type = VT_BSTR;
- break;
- }
-
- php_zval_to_variant_ex(zval_arg, var_arg, type, codepage TSRMLS_CC);
-}
-
-
-PHPAPI void php_zval_to_variant_ex(zval *zval_arg, VARIANT *var_arg, int type, int codepage TSRMLS_DC)
-{
- OLECHAR *unicode_str = NULL;
-
- VariantInit(var_arg);
- V_VT(var_arg) = type;
-
- if (V_VT(var_arg) & VT_ARRAY) {
- /* For now we'll just handle single dimension arrays, we'll use the data type of the first element for the
- output data type */
- HashTable *ht = Z_ARRVAL(*zval_arg);
- int numberOfElements = zend_hash_num_elements(ht);
- SAFEARRAY *safeArray;
- SAFEARRAYBOUND bounds[1];
- VARIANT *v;
- zval **entry; /* An entry in the input array */
-
- type &= ~VT_ARRAY;
-
- if (V_VT(var_arg) == (VT_ARRAY|VT_BYREF)) { /* == is intended, because VT_*|VT_BYREF|VT_ARRAY means something diffrent */
- type &= ~VT_BYREF;
- V_VARIANTREF(var_arg) = (VARIANT *) emalloc(sizeof(VARIANT));
- var_arg = V_VARIANTREF(var_arg); /* put the array in that VARIANT */
- }
-
- bounds[0].lLbound = 0;
- bounds[0].cElements = numberOfElements;
- safeArray = SafeArrayCreate(VT_VARIANT, 1, bounds);
-
- if (NULL == safeArray) {
- rpc_error(E_WARNING, "Unable to convert php array to VARIANT array - %s", numberOfElements ? "" : "(Empty input array)");
- ZVAL_FALSE(zval_arg);
- } else {
- V_ARRAY(var_arg) = safeArray;
- V_VT(var_arg) = VT_ARRAY|VT_VARIANT; /* Now have a valid safe array allocated */
- if (SUCCEEDED(SafeArrayLock(safeArray))) {
- ulong i;
-
- zend_hash_internal_pointer_reset(ht);
- for (i = 0; i < (ulong)numberOfElements; ++i) {
- if ((zend_hash_get_current_data(ht, (void **)&entry) == SUCCESS) && (entry != NULL)) { /* Get a pointer to the php array element */
- /* Add another value to the safe array */
- if (SUCCEEDED(SafeArrayPtrOfIndex( safeArray, &i, &v))) { /* Pointer to output element entry retrieved successfully */
- if (type) { /* explicit type */
- php_zval_to_variant_ex(*entry, v, type, codepage TSRMLS_CC); /* Do the required conversion */
- } else {
- php_zval_to_variant(*entry, v, codepage TSRMLS_CC); /* Do the required conversion */
- }
- } else {
- rpc_error(E_WARNING, "phpArrayToSafeArray() - Unable to retrieve pointer to output element number (%d)", i);
- }
- }
- zend_hash_move_forward(ht);
- }
- SafeArrayUnlock( safeArray);
- } else {
- rpc_error(E_WARNING, "phpArrayToSafeArray() - Unable to lock safeArray");
- }
- }
- } else {
- switch (V_VT(var_arg)) {
-
- case VT_NULL:
- case VT_VOID:
- ZVAL_NULL(zval_arg);
- break;
-
- case VT_UI1:
- convert_to_long_ex(&zval_arg);
- V_UI1(var_arg) = (unsigned char) Z_LVAL_P(zval_arg);
- break;
-
- case VT_I2:
- convert_to_long_ex(&zval_arg);
- V_I2(var_arg) = (short) Z_LVAL_P(zval_arg);
- break;
-
- case VT_I4:
- convert_to_long_ex(&zval_arg);
- V_I4(var_arg) = Z_LVAL_P(zval_arg);
- break;
-
- case VT_R4:
- convert_to_double_ex(&zval_arg);
- V_R4(var_arg) = (float) Z_DVAL_P(zval_arg);
- break;
-
- case VT_R8:
- convert_to_double_ex(&zval_arg);
- V_R8(var_arg) = Z_DVAL_P(zval_arg);
- break;
-
- case VT_BOOL:
- convert_to_boolean_ex(&zval_arg);
- if (Z_LVAL_P(zval_arg)) {
- V_BOOL(var_arg) = VT_TRUE;
- } else {
- V_BOOL(var_arg) = VT_FALSE;
- }
- break;
-
- case VT_ERROR:
- convert_to_long_ex(&zval_arg);
- V_ERROR(var_arg) = Z_LVAL_P(zval_arg);
- break;
-
- case VT_CY:
- convert_to_double_ex(&zval_arg);
- VarCyFromR8(Z_DVAL_P(zval_arg), &V_CY(var_arg));
- break;
-
- case VT_DATE: {
- SYSTEMTIME wintime;
- struct tm *phptime;
-
- switch (Z_TYPE_P(zval_arg)) {
- case IS_DOUBLE:
- /* already a VariantTime value */
- V_DATE(var_arg) = Z_DVAL_P(zval_arg);
- break;
-
- /** @todo
- case IS_STRING:
- */
- /* string representation of a time value */
-
- default:
- /* a PHP time value ? */
- convert_to_long_ex(&zval_arg);
- phptime = gmtime(&(Z_LVAL_P(zval_arg)));
- memset(&wintime, 0, sizeof(wintime));
-
- wintime.wYear = phptime->tm_year + 1900;
- wintime.wMonth = phptime->tm_mon + 1;
- wintime.wDay = phptime->tm_mday;
- wintime.wHour = phptime->tm_hour;
- wintime.wMinute = phptime->tm_min;
- wintime.wSecond = phptime->tm_sec;
-
- SystemTimeToVariantTime(&wintime, &V_DATE(var_arg));
- break;
- }
- }
- break;
-
- case VT_BSTR:
- convert_to_string_ex(&zval_arg);
- unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(zval_arg), Z_STRLEN_P(zval_arg), codepage, FALSE);
- V_BSTR(var_arg) = SysAllocStringByteLen((char *) unicode_str, Z_STRLEN_P(zval_arg) * sizeof(OLECHAR));
- break;
-
- case VT_DECIMAL:
- convert_to_string_ex(&zval_arg);
- unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(zval_arg), Z_STRLEN_P(zval_arg), codepage, FALSE);
- VarDecFromStr(unicode_str, LOCALE_SYSTEM_DEFAULT, 0, &V_DECIMAL(var_arg));
- break;
-
- case VT_DECIMAL|VT_BYREF:
- convert_to_string_ex(&zval_arg);
- unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(zval_arg), Z_STRLEN_P(zval_arg), codepage, FALSE);
- VarDecFromStr(unicode_str, LOCALE_SYSTEM_DEFAULT, 0, V_DECIMALREF(var_arg));
- break;
-
- case VT_UNKNOWN:
- if (comval_to_variant(zval_arg, var_arg) == SUCCESS) {
- V_VT(var_arg) = VT_UNKNOWN;
- V_UNKNOWN(var_arg) = (IUnknown *) V_DISPATCH(var_arg);
- }
- break;
-
- case VT_DISPATCH:
- if (Z_OBJCE_P(zval_arg) == com_class_entry) {
- comval_to_variant(zval_arg, var_arg);
- } else {
- V_DISPATCH(var_arg) = php_COM_export_object(zval_arg);
-
- if (V_DISPATCH(var_arg)) {
- V_VT(var_arg) = VT_DISPATCH;
- }
- }
- if (V_VT(var_arg) != VT_DISPATCH) {
- VariantInit(var_arg);
- }
- break;
-
- case VT_UI1|VT_BYREF:
- convert_to_long(zval_arg);
- V_UI1REF(var_arg) = (unsigned char FAR*) &Z_LVAL_P(zval_arg);
- break;
-
- case VT_I2|VT_BYREF:
- convert_to_long(zval_arg);
- V_I2REF(var_arg) = (short FAR*) &Z_LVAL_P(zval_arg);
- break;
-
- case VT_I4|VT_BYREF:
- convert_to_long(zval_arg);
- V_I4REF(var_arg) = (long FAR*) &Z_LVAL_P(zval_arg);
- break;
-
- case VT_R4|VT_BYREF:
- convert_to_double(zval_arg);
- V_R4REF(var_arg) = (float FAR*) &Z_LVAL_P(zval_arg);
- break;
-
- case VT_R8|VT_BYREF:
- convert_to_double(zval_arg);
- V_R8REF(var_arg) = (double FAR*) &Z_LVAL_P(zval_arg);
- break;
-
- case VT_BOOL|VT_BYREF:
- convert_to_boolean(zval_arg);
- /* emalloc or malloc ? */
- V_BOOLREF(var_arg) = (short FAR*) pemalloc(sizeof(short), 1);
- if (Z_LVAL_P(zval_arg)) {
- *V_BOOLREF(var_arg) = VT_TRUE;
- } else {
- *V_BOOLREF(var_arg) = VT_FALSE;
- }
- break;
-
- case VT_ERROR|VT_BYREF:
- convert_to_long(zval_arg);
- V_ERRORREF(var_arg) = (long FAR*) &Z_LVAL_P(zval_arg);
- break;
-
- case VT_CY|VT_BYREF:
- convert_to_double_ex(&zval_arg);
- VarCyFromR8(Z_DVAL_P(zval_arg), var_arg->pcyVal);
- break;
-
- case VT_DATE|VT_BYREF: {
- SYSTEMTIME wintime;
- struct tm *phptime;
-
- phptime = gmtime(&(Z_LVAL_P(zval_arg)));
- memset(&wintime, 0, sizeof(wintime));
-
- wintime.wYear = phptime->tm_year + 1900;
- wintime.wMonth = phptime->tm_mon + 1;
- wintime.wDay = phptime->tm_mday;
- wintime.wHour = phptime->tm_hour;
- wintime.wMinute = phptime->tm_min;
- wintime.wSecond = phptime->tm_sec;
-
- SystemTimeToVariantTime(&wintime, var_arg->pdate);
- }
- break;
-
- case VT_BSTR|VT_BYREF:
- convert_to_string(zval_arg);
- V_BSTRREF(var_arg) = (BSTR FAR*) emalloc(sizeof(BSTR FAR*));
- unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(zval_arg), Z_STRLEN_P(zval_arg), codepage, FALSE);
- *V_BSTRREF(var_arg) = SysAllocString(unicode_str);
- break;
-
- case VT_UNKNOWN|VT_BYREF:
- if (comval_to_variant(zval_arg, var_arg) == SUCCESS) {
- V_VT(var_arg) = VT_UNKNOWN|VT_BYREF;
- V_UNKNOWNREF(var_arg) = (IUnknown **) &V_DISPATCH(var_arg);
- }
- break;
-
- case VT_DISPATCH|VT_BYREF:
- if (comval_to_variant(zval_arg, var_arg) == SUCCESS) {
- V_VT(var_arg) = VT_DISPATCH|VT_BYREF;
- V_DISPATCHREF(var_arg) = &V_DISPATCH(var_arg);
- }
- break;
-
- case VT_VARIANT:
- rpc_error(E_WARNING, "VT_VARIANT is invalid. Use VT_VARIANT|VT_BYREF instead.");
- /* break missing intentionally */
- case VT_VARIANT|VT_BYREF: {
- variantval *var;
- TSRMLS_FETCH();
-
- if ((var = zend_object_store_get_object(zval_arg TSRMLS_CC)) == NULL) {
- /* TODO exception */
- }
-
- V_VARIANTREF(var_arg) = var->var;
- }
- break;
-
- case VT_I1:
- convert_to_long_ex(&zval_arg);
- V_I1(var_arg) = (char)Z_LVAL_P(zval_arg);
- break;
-
- case VT_UI2:
- convert_to_long_ex(&zval_arg);
- V_UI2(var_arg) = (unsigned short)Z_LVAL_P(zval_arg);
- break;
-
- case VT_UI4:
- convert_to_long_ex(&zval_arg);
- V_UI4(var_arg) = (unsigned long)Z_LVAL_P(zval_arg);
- break;
-
- case VT_INT:
- convert_to_long_ex(&zval_arg);
- V_INT(var_arg) = (int)Z_LVAL_P(zval_arg);
- break;
-
- case VT_UINT:
- convert_to_long_ex(&zval_arg);
- V_UINT(var_arg) = (unsigned int)Z_LVAL_P(zval_arg);
- break;
-
- case VT_I1|VT_BYREF:
- convert_to_long(zval_arg);
- V_I1REF(var_arg) = (char FAR*) &Z_LVAL_P(zval_arg);
- break;
-
- case VT_UI2|VT_BYREF:
- convert_to_long(zval_arg);
- V_UI2REF(var_arg) = (unsigned short FAR*) &Z_LVAL_P(zval_arg);
- break;
-
- case VT_UI4|VT_BYREF:
- convert_to_long(zval_arg);
- V_UI4REF(var_arg) = (unsigned long FAR*) &Z_LVAL_P(zval_arg);
- break;
-
- case VT_INT|VT_BYREF:
- convert_to_long(zval_arg);
- V_INTREF(var_arg) = (int FAR*) &Z_LVAL_P(zval_arg);
- break;
-
- case VT_UINT|VT_BYREF:
- convert_to_long(zval_arg);
- V_UINTREF(var_arg) = (unsigned int FAR*) &Z_LVAL_P(zval_arg);
- break;
-
- default:
- rpc_error(E_WARNING, "Unsupported variant type: %d (0x%X)", V_VT(var_arg), V_VT(var_arg));
- }
-
- if (unicode_str != NULL) {
- efree(unicode_str);
- }
- }
-}
-
-PHPAPI int php_variant_to_zval(VARIANT *var_arg, zval *zval_arg, int codepage)
-{
- /* Changed the function to return a value for recursive error testing */
- /* Existing calls will be unaffected by the change - so it */
- /* seemed like the smallest impact on unfamiliar code */
- int ret = SUCCESS;
-
- INIT_PZVAL(zval_arg);
-
- /* Add SafeArray support */
- if (V_ISARRAY(var_arg)) {
- SAFEARRAY *array = V_ARRAY(var_arg);
- LONG indices[1];
- LONG lbound=0, ubound;
- VARTYPE vartype;
- register int ii;
- UINT Dims;
- VARIANT vv;
- zval *element;
- HRESULT hr;
-
- /* TODO: Add support for multi-dimensional SafeArrays */
- /* For now just validate that the SafeArray has one dimension */
- if (1 != (Dims = SafeArrayGetDim(array))) {
- rpc_error(E_WARNING, "Unsupported: multi-dimensional (%d) SafeArrays", Dims);
- ZVAL_NULL(zval_arg);
- return FAILURE;
- }
- SafeArrayLock(array);
-
- /* This call has failed for everything I have tried */
- /* But best leave it to be on the safe side */
- if (FAILED(SafeArrayGetVartype(array, &vartype)) || (vartype == VT_EMPTY)) {
- /* Fall back to what we do know */
- /* Mask off the array bit and assume */
- /* what is left is the type of the array */
- /* elements */
- vartype = V_VT(var_arg) & ~VT_ARRAY;
- }
- SafeArrayGetUBound(array, 1, &ubound);
- SafeArrayGetLBound(array, 1, &lbound);
-
- /* Since COM returned an array we set up the php */
- /* return value to be an array */
- array_init(zval_arg);
-
- /* Walk the safe array */
- for (ii=lbound;ii<=ubound;ii++) {
- indices[0] = ii;
- VariantInit(&vv); /* Docs say this just set the vt field, but you never know */
- /* Set up a variant to pass to a recursive call */
- /* So that we do not need to have two copies */
- /* of the code */
- if (VT_VARIANT == vartype) {
- hr = SafeArrayGetElement(array, indices, (VOID *) &(vv));
- } else {
- V_VT(&vv) = vartype;
- hr = SafeArrayGetElement(array, indices, (VOID *) &(vv.lVal));
- }
- if (FAILED(hr)) {
- /* Failure to retieve an element probably means the array is sparse */
- /* So leave the php array sparse too */
- continue;
- }
- /* Create an element to be added to the array */
- ALLOC_ZVAL(element);
- /* Call ourself again to handle the base type conversion */
- /* If SafeArrayGetElement proclaims to allocate */
- /* memory for a BSTR, so the recursive call frees */
- /* the string correctly */
- if (FAILURE == php_variant_to_zval(&vv, element, codepage)) {
- /* Error occurred setting up array element */
- /* Error was displayed by the recursive call */
- FREE_ZVAL(element);
- /* TODO: Do we stop here, or go on and */
- /* try to make sense of the rest of the array */
- /* Going on leads to multiple errors displayed */
- /* for the same conversion. For large arrays that */
- /* could be very annoying */
- /* And if we don't go on - what to do about */
- /* the parts of the array that are OK? */
- /* break; */
- } else {
- /* Just insert the element into our return array */
- add_index_zval(zval_arg, ii, element);
- }
- }
- SafeArrayUnlock(array);
- } else switch (var_arg->vt & ~VT_BYREF) {
- case VT_EMPTY:
- ZVAL_NULL(zval_arg);
- break;
-
- case VT_UI1:
- if (V_ISBYREF(var_arg)) {
- ZVAL_LONG(zval_arg, (long)*V_UI1REF(var_arg));
- } else {
- ZVAL_LONG(zval_arg, (long)V_UI1(var_arg));
- }
- break;
-
- case VT_I2:
- if (V_ISBYREF(var_arg)) {
- ZVAL_LONG(zval_arg, (long )*V_I2REF(var_arg));
- } else {
- ZVAL_LONG(zval_arg, (long)V_I2(var_arg));
- }
- break;
-
- case VT_I4:
- if (V_ISBYREF(var_arg)) {
- ZVAL_LONG(zval_arg, *V_I4REF(var_arg));
- } else {
- ZVAL_LONG(zval_arg, V_I4(var_arg));
- }
- break;
-
- case VT_R4:
- if (V_ISBYREF(var_arg)) {
- ZVAL_DOUBLE(zval_arg, (double)*V_R4REF(var_arg));
- } else {
- ZVAL_DOUBLE(zval_arg, (double)V_R4(var_arg));
- }
- break;
-
- case VT_R8:
- if (V_ISBYREF(var_arg)) {
- ZVAL_DOUBLE(zval_arg, *V_R8REF(var_arg));
- } else {
- ZVAL_DOUBLE(zval_arg, V_R8(var_arg));
- }
- break;
-
- /* 96bit uint */
- case VT_DECIMAL: {
- OLECHAR *unicode_str;
- switch (VarBstrFromDec(&V_DECIMAL(var_arg), LOCALE_SYSTEM_DEFAULT, 0, &unicode_str)) {
- case S_OK:
- Z_STRVAL_P(zval_arg) = php_OLECHAR_to_char(unicode_str, &Z_STRLEN_P(zval_arg), codepage, FALSE);
- Z_TYPE_P(zval_arg) = IS_STRING;
- break;
-
- default:
- ZVAL_NULL(zval_arg);
- ret = FAILURE;
- rpc_error(E_WARNING, "Error converting DECIMAL value to PHP string");
- break;
- }
- }
- break;
-
- /* Currency */
- case VT_CY:
- if (V_ISBYREF(var_arg)) {
- VarR8FromCy(*V_CYREF(var_arg), &Z_DVAL_P(zval_arg));
- } else {
- VarR8FromCy(V_CY(var_arg), &Z_DVAL_P(zval_arg));
- }
- Z_TYPE_P(zval_arg) = IS_DOUBLE;
- break;
-
- case VT_BOOL:
- if (V_ISBYREF(var_arg)) {
- if (*V_BOOLREF(var_arg)) {
- ZVAL_BOOL(zval_arg, Z_TRUE);
- } else {
- ZVAL_BOOL(zval_arg, Z_FALSE);
- }
- } else {
- if (V_BOOL(var_arg)) {
- ZVAL_BOOL(zval_arg, Z_TRUE);
- } else {
- ZVAL_BOOL(zval_arg, Z_FALSE);
- }
- }
- break;
-
- case VT_NULL:
- case VT_VOID:
- ZVAL_NULL(zval_arg);
- break;
-
- case VT_VARIANT:
- php_variant_to_zval(V_VARIANTREF(var_arg), zval_arg, codepage);
- break;
-
- case VT_BSTR:
- Z_TYPE_P(zval_arg) = IS_STRING;
-
- if (V_ISBYREF(var_arg)) {
- if (*V_BSTR(var_arg)) {
- Z_STRVAL_P(zval_arg) = php_OLECHAR_to_char(*V_BSTRREF(var_arg), &Z_STRLEN_P(zval_arg), codepage, FALSE);
- } else {
- ZVAL_NULL(zval_arg);
- }
- efree(V_BSTRREF(var_arg));
- } else {
- if (V_BSTR(var_arg)) {
- Z_STRVAL_P(zval_arg) = php_OLECHAR_to_char(V_BSTR(var_arg), &Z_STRLEN_P(zval_arg), codepage, FALSE);
- } else {
- ZVAL_NULL(zval_arg);
- }
- }
-
- break;
-
- case VT_DATE: {
- BOOL success;
- SYSTEMTIME wintime;
- struct tm phptime;
-
- if (V_ISBYREF(var_arg)) {
- success = VariantTimeToSystemTime(*V_DATEREF(var_arg), &wintime);
- } else {
- success = VariantTimeToSystemTime(V_DATE(var_arg), &wintime);
- }
-
- if (success) {
- memset(&phptime, 0, sizeof(phptime));
-
- phptime.tm_year = wintime.wYear - 1900;
- phptime.tm_mon = wintime.wMonth - 1;
- phptime.tm_mday = wintime.wDay;
- phptime.tm_hour = wintime.wHour;
- phptime.tm_min = wintime.wMinute;
- phptime.tm_sec = wintime.wSecond;
- phptime.tm_isdst = -1;
-
- tzset();
- ZVAL_LONG(zval_arg, mktime(&phptime));
- } else {
- ret = FAILURE;
- }
- }
- break;
-
- case VT_UNKNOWN:
- if (V_UNKNOWN(var_arg) == NULL) {
- V_DISPATCH(var_arg) = NULL;
- } else {
- HRESULT hr;
-
- hr = V_UNKNOWN(var_arg)->lpVtbl->QueryInterface(var_arg->punkVal, &IID_IDispatch, &V_DISPATCH(var_arg));
-
- if (FAILED(hr)) {
- char *error_message;
-
- error_message = php_COM_error_message(hr);
- rpc_error(E_WARNING, "Unable to obtain IDispatch interface: %s", error_message);
- LocalFree(error_message);
-
- V_DISPATCH(var_arg) = NULL;
- }
- }
- /* break missing intentionaly */
- case VT_DISPATCH: {
- comval *obj;
-
- if (V_DISPATCH(var_arg) == NULL) {
- ret = FAILURE;
- ZVAL_NULL(zval_arg);
- } else {
- TSRMLS_FETCH();
-
- ALLOC_COM(obj);
- php_COM_set(obj, &V_DISPATCH(var_arg), FALSE);
-
- ZVAL_COM(zval_arg, obj);
- VariantInit(var_arg); /* to protect C_DISPATCH(obj) from being freed when var_result is destructed */
- }
- }
- break;
-
- case VT_I1:
- if (V_ISBYREF(var_arg)) {
- ZVAL_LONG(zval_arg, (long)*V_I1REF(var_arg));
- } else {
- ZVAL_LONG(zval_arg, (long)V_I1(var_arg));
- }
- break;
-
- case VT_UI2:
- if (V_ISBYREF(var_arg)) {
- ZVAL_LONG(zval_arg, (long)*V_UI2REF(var_arg));
- } else {
- ZVAL_LONG(zval_arg, (long)V_UI2(var_arg));
- }
- break;
-
- case VT_UI4:
- if (V_ISBYREF(var_arg)) {
- ZVAL_LONG(zval_arg, (long)*V_UI4REF(var_arg));
- } else {
- ZVAL_LONG(zval_arg, (long)V_UI4(var_arg));
- }
- break;
-
- case VT_INT:
- if (V_ISBYREF(var_arg)) {
- ZVAL_LONG(zval_arg, (long)*V_INTREF(var_arg));
- } else {
- ZVAL_LONG(zval_arg, (long)V_INT(var_arg));
- }
- break;
-
- case VT_UINT:
- if (V_ISBYREF(var_arg)) {
- ZVAL_LONG(zval_arg, (long)*V_UINTREF(var_arg));
- } else {
- ZVAL_LONG(zval_arg, (long)V_UINT(var_arg));
- }
- break;
-
- default:
- rpc_error(E_WARNING, "Unsupported variant type: %d (0x%X)", V_VT(var_arg), V_VT(var_arg));
- ZVAL_NULL(zval_arg);
- ret = FAILURE;
- break;
- }
- return ret;
-}
-
-
-PHPAPI OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage, int persist)
-{
- BOOL error = FALSE;
- OLECHAR *unicode_str;
-
- if (strlen == -1) {
- /* request needed buffersize */
- strlen = MultiByteToWideChar(codepage, (codepage == CP_UTF8 ? 0 : MB_PRECOMPOSED | MB_ERR_INVALID_CHARS), C_str, -1, NULL, 0);
- } else {
- /* \0 terminator */
- strlen++;
- }
-
- if (strlen >= 0) {
- unicode_str = (OLECHAR *) pemalloc(sizeof(OLECHAR) * strlen, persist);
-
- /* convert string */
- error = !MultiByteToWideChar(codepage, (codepage == CP_UTF8 ? 0 : MB_PRECOMPOSED | MB_ERR_INVALID_CHARS), C_str, strlen, unicode_str, strlen);
- } else {
- /* return a zero-length string */
- unicode_str = (OLECHAR *) pemalloc(sizeof(OLECHAR), persist);
- *unicode_str = 0;
-
- error = TRUE;
- }
-
- if (error) {
- switch (GetLastError()) {
- case ERROR_NO_UNICODE_TRANSLATION:
- rpc_error(E_WARNING, "No unicode translation available for the specified string");
- break;
- case ERROR_INSUFFICIENT_BUFFER:
- rpc_error(E_WARNING, "Internal Error: Insufficient Buffer");
- break;
- default:
- rpc_error(E_WARNING, "Unknown error in php_char_to_OLECHAR()");
- }
- }
-
- return unicode_str;
-}
-
-
-PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int codepage, int persist)
-{
- char *C_str;
- uint length = 0;
-
- /* request needed buffersize */
- uint reqSize = WideCharToMultiByte(codepage, codepage == CP_UTF8 ? 0 : WC_COMPOSITECHECK, unicode_str, -1, NULL, 0, NULL, NULL);
-
- if (reqSize) {
- C_str = (char *) pemalloc(sizeof(char) * reqSize, persist);
-
- /* convert string */
- length = WideCharToMultiByte(codepage, codepage == CP_UTF8 ? 0 : WC_COMPOSITECHECK, unicode_str, -1, C_str, reqSize, NULL, NULL) - 1;
- } else {
- C_str = (char *) pemalloc(sizeof(char), persist);
- *C_str = 0;
-
- rpc_error(E_WARNING, "Error in php_OLECHAR_to_char()");
- }
-
- if (out_length) {
- *out_length = length;
- }
-
- return C_str;
-}
-
-static int comval_to_variant(zval *object, VARIANT *var_arg)
-{
- rpc_internal *intern;
- TSRMLS_FETCH();
-
- if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
- /* TODO exception */
- VariantInit(var_arg);
-
- return FAILURE;
- } else {
- V_VT(var_arg) = VT_DISPATCH;
- V_DISPATCH(var_arg) = C_DISPATCH((comval *) intern->data);
-
- return SUCCESS;
- }
-}
-
-#endif /* PHP_WIN32 */
diff --git a/ext/rpc/com/conversion.h b/ext/rpc/com/conversion.h
deleted file mode 100644
index 9837c3a2f0..0000000000
--- a/ext/rpc/com/conversion.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- | Alan Brown <abrown@pobox.com> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef CONVERSION_H
-#define CONVERSION_H
-
-/* isn't this defined somewhere else ? */
-
-#define Z_TRUE 1
-#define Z_FALSE 0
-
-#define VT_TRUE -1
-#define VT_FALSE 0
-
-BEGIN_EXTERN_C()
-
-ZEND_API void php_zval_to_variant(zval *zval_arg, VARIANT *var_arg, int codepage TSRMLS_DC);
-ZEND_API void php_zval_to_variant_ex(zval *zval_arg, VARIANT *var_arg, int type, int codepage TSRMLS_DC);
-ZEND_API int php_variant_to_zval(VARIANT *var_arg, zval *zval_arg, int codepage);
-
-ZEND_API OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage, int persist);
-ZEND_API char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int codepage, int persist);
-
-END_EXTERN_C()
-
-#endif \ No newline at end of file
diff --git a/ext/rpc/com/dispatch.c b/ext/rpc/com/dispatch.c
deleted file mode 100644
index 8b32c4e607..0000000000
--- a/ext/rpc/com/dispatch.c
+++ /dev/null
@@ -1,641 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*
- * This module is used to export PHP objects to COM and DOTNET by exposing
- * them as objects implementing IDispatch.
- * */
-
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#include "../rpc.h"
-
-#include "php.h"
-#include "com.h"
-#include "com_wrapper.h"
-#include "conversion.h"
-#include "variant.h"
-
-#define COBJMACROS
-#include <unknwn.h> /* IDispatch */
-#include <dispex.h> /* IDispatchEx */
-
-
-typedef struct {
- /* This first part MUST match the declaration
- * of interface IDispatchEx */
- CONST_VTBL struct IDispatchExVtbl *lpVtbl;
-
- /* now the PHP stuff */
-
- THREAD_T engine_thread; /* for sanity checking */
- zval *object; /* the object exported */
- LONG refcount; /* COM reference count */
-
- HashTable *dispid_to_name; /* keep track of dispid -> name mappings */
- HashTable *name_to_dispid; /* keep track of name -> dispid mappings */
-
- GUID sinkid; /* iid that we "implement" for event sinking */
-
- int id;
-} php_dispatchex;
-
-static void disp_destructor(php_dispatchex *disp);
-
-static void dispatch_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- php_dispatchex *disp = (php_dispatchex *)rsrc->ptr;
- disp_destructor(disp);
-}
-
-static int le_dispatch;
-int php_COM_dispatch_init(int module_number TSRMLS_DC)
-{
- le_dispatch = zend_register_list_destructors_ex(dispatch_dtor, NULL, "COM:Dispatch", module_number);
- return le_dispatch;
-}
-
-
-/* {{{ trace */
-static inline void trace(char *fmt, ...)
-{
- va_list ap;
- char buf[4096];
-
- sprintf(buf, "T=%08x ", tsrm_thread_id());
- OutputDebugString(buf);
-
- va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf), fmt, ap);
-
- OutputDebugString(buf);
-
- va_end(ap);
-}
-/* }}} */
-
-#define FETCH_DISP(methname) \
- php_dispatchex *disp = (php_dispatchex*)This; \
- trace(" PHP:%s %s\n", Z_OBJCE_P(disp->object)->name, methname); \
- if (tsrm_thread_id() != disp->engine_thread) \
- return E_UNEXPECTED;
-
-
-static HRESULT STDMETHODCALLTYPE disp_queryinterface(
- IDispatchEx *This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject)
-{
- TSRMLS_FETCH();
- FETCH_DISP("QueryInterface");
-
- if (IsEqualGUID(&IID_IUnknown, riid) ||
- IsEqualGUID(&IID_IDispatch, riid) ||
- IsEqualGUID(&IID_IDispatchEx, riid) ||
- IsEqualGUID(&disp->sinkid, riid)) {
- *ppvObject = This;
- InterlockedIncrement(&disp->refcount);
- return S_OK;
- }
-
- *ppvObject = NULL;
- return E_NOINTERFACE;
-}
-
-static ULONG STDMETHODCALLTYPE disp_addref(IDispatchEx *This)
-{
- TSRMLS_FETCH();
- FETCH_DISP("AddRef");
-
- return InterlockedIncrement(&disp->refcount);
-}
-
-static ULONG STDMETHODCALLTYPE disp_release(IDispatchEx *This)
-{
- ULONG ret;
- TSRMLS_FETCH();
- FETCH_DISP("Release");
-
- ret = InterlockedDecrement(&disp->refcount);
- trace("-- refcount now %d\n", ret);
- if (ret == 0) {
- /* destroy it */
- if (disp->id)
- zend_list_delete(disp->id);
- }
- return ret;
-}
-
-static HRESULT STDMETHODCALLTYPE disp_gettypeinfocount(
- IDispatchEx *This,
- /* [out] */ UINT *pctinfo)
-{
- TSRMLS_FETCH();
- FETCH_DISP("GetTypeInfoCount");
-
- *pctinfo = 0;
- return S_OK;
-}
-
-static HRESULT STDMETHODCALLTYPE disp_gettypeinfo(
- IDispatchEx *This,
- /* [in] */ UINT iTInfo,
- /* [in] */ LCID lcid,
- /* [out] */ ITypeInfo **ppTInfo)
-{
- TSRMLS_FETCH();
- FETCH_DISP("GetTypeInfo");
-
- *ppTInfo = NULL;
- return DISP_E_BADINDEX;
-}
-
-static HRESULT STDMETHODCALLTYPE disp_getidsofnames(
- IDispatchEx *This,
- /* [in] */ REFIID riid,
- /* [size_is][in] */ LPOLESTR *rgszNames,
- /* [in] */ UINT cNames,
- /* [in] */ LCID lcid,
- /* [size_is][out] */ DISPID *rgDispId)
-{
- UINT i;
- HRESULT ret = S_OK;
- TSRMLS_FETCH();
- FETCH_DISP("GetIDsOfNames");
-
- for (i = 0; i < cNames; i++) {
- char *name;
- unsigned int namelen;
- zval **tmp;
-
- name = php_OLECHAR_to_char(rgszNames[i], &namelen, CP_ACP, FALSE);
-
- /* Lookup the name in the hash */
- if (zend_hash_find(disp->name_to_dispid, name, namelen+1, (void**)&tmp) == FAILURE) {
- ret = DISP_E_UNKNOWNNAME;
- rgDispId[i] = 0;
- } else {
- rgDispId[i] = Z_LVAL_PP(tmp);
- }
-
- efree(name);
-
- }
-
- return ret;
-}
-
-static HRESULT STDMETHODCALLTYPE disp_invoke(
- IDispatchEx *This,
- /* [in] */ DISPID dispIdMember,
- /* [in] */ REFIID riid,
- /* [in] */ LCID lcid,
- /* [in] */ WORD wFlags,
- /* [out][in] */ DISPPARAMS *pDispParams,
- /* [out] */ VARIANT *pVarResult,
- /* [out] */ EXCEPINFO *pExcepInfo,
- /* [out] */ UINT *puArgErr)
-{
- return This->lpVtbl->InvokeEx(This, dispIdMember,
- lcid, wFlags, pDispParams,
- pVarResult, pExcepInfo, NULL);
-}
-
-static HRESULT STDMETHODCALLTYPE disp_getdispid(
- IDispatchEx *This,
- /* [in] */ BSTR bstrName,
- /* [in] */ DWORD grfdex,
- /* [out] */ DISPID *pid)
-{
- HRESULT ret = DISP_E_UNKNOWNNAME;
- char *name;
- unsigned int namelen;
- zval **tmp;
- TSRMLS_FETCH();
- FETCH_DISP("GetDispID");
-
- name = php_OLECHAR_to_char(bstrName, &namelen, CP_ACP, FALSE);
-
- /* Lookup the name in the hash */
- if (zend_hash_find(disp->name_to_dispid, name, namelen+1, (void**)&tmp) == SUCCESS) {
- *pid = Z_LVAL_PP(tmp);
- ret = S_OK;
- }
-
- efree(name);
-
- return ret;
-}
-
-static HRESULT STDMETHODCALLTYPE disp_invokeex(
- IDispatchEx *This,
- /* [in] */ DISPID id,
- /* [in] */ LCID lcid,
- /* [in] */ WORD wFlags,
- /* [in] */ DISPPARAMS *pdp,
- /* [out] */ VARIANT *pvarRes,
- /* [out] */ EXCEPINFO *pei,
- /* [unique][in] */ IServiceProvider *pspCaller)
-{
- zval **name;
- UINT i;
- int codepage = CP_ACP;
- zval *retval = NULL;
- zval ***params = NULL;
- HRESULT ret = DISP_E_MEMBERNOTFOUND;
- TSRMLS_FETCH();
- FETCH_DISP("InvokeEx");
-
- if (SUCCESS == zend_hash_index_find(disp->dispid_to_name, id, (void**)&name)) {
- /* TODO: add support for overloaded objects */
-
- trace("-- Invoke: %d %20s flags=%08x args=%d\n", id, Z_STRVAL_PP(name), wFlags, pdp->cArgs);
-
- /* convert args into zvals.
- * Args are in reverse order */
- params = (zval ***)emalloc(sizeof(zval **) * pdp->cArgs);
- for (i = 0; i < pdp->cArgs; i++) {
- VARIANT *arg;
- zval *zarg;
-
- arg = &pdp->rgvarg[ pdp->cArgs - 1 - i];
-
- trace("alloc zval for arg %d VT=%08x\n", i, V_VT(arg));
-
- ALLOC_INIT_ZVAL(zarg);
-
- if (V_VT(arg) == VT_DISPATCH) {
- trace("arg %d is dispatchable\n", i);
- if ((zarg = php_COM_object_from_dispatch(V_DISPATCH(arg))) == NULL) {
- trace("failed to convert arg %d to zval\n", i);
- ZVAL_NULL(zarg);
- }
- } else {
- /* arg can't be an idispatch, so we don't care for the implicit AddRef() call here */
- if (FAILURE == php_variant_to_zval(arg, zarg, codepage)) {
- trace("failed to convert arg %d to zval\n", i);
- ZVAL_NULL(zarg);
- }
- }
-
- params[i] = &zarg;
- }
-
- trace("arguments processed, prepare to do some work\n");
-
- if (wFlags & DISPATCH_PROPERTYGET) {
- trace("trying to get a property\n");
- zend_hash_find(Z_OBJPROP_P(disp->object), Z_STRVAL_PP(name), Z_STRLEN_PP(name)+1, (void**)&retval);
- } else if (wFlags & DISPATCH_PROPERTYPUT) {
- trace("trying to set a property\n");
- add_property_zval(disp->object, Z_STRVAL_PP(name), *params[0]);
- } else if (wFlags & DISPATCH_METHOD) {
- trace("Trying to call user function\n");
- if (SUCCESS == call_user_function_ex(EG(function_table), &disp->object, *name,
- &retval, pdp->cArgs, params, 1, NULL TSRMLS_CC)) {
- ret = S_OK;
- } else {
- ret = DISP_E_EXCEPTION;
- }
- } else {
- trace("Don't know how to handle this invocation %08x\n", wFlags);
- }
-
- /* release arguments */
- for (i = 0; i < pdp->cArgs; i++)
- zval_ptr_dtor(params[i]);
- efree(params);
-
- /* return value */
- if (retval) {
- if (pvarRes) {
- if (Z_TYPE_P(retval) == IS_OBJECT) {
- /* export the object using a dispatch like ourselves */
- VariantInit(pvarRes);
- V_VT(pvarRes) = VT_DISPATCH;
- V_DISPATCH(pvarRes) = php_COM_export_object(retval);
- } else {
- php_zval_to_variant(retval, pvarRes, codepage TSRMLS_CC);
- }
- }
- zval_ptr_dtor(&retval);
- } else if (pvarRes) {
- VariantInit(pvarRes);
- }
-
- } else {
- trace("InvokeEx: I don't support DISPID=%d\n", id);
- }
-
- return ret;
-}
-
-static HRESULT STDMETHODCALLTYPE disp_deletememberbyname(
- IDispatchEx *This,
- /* [in] */ BSTR bstrName,
- /* [in] */ DWORD grfdex)
-{
- TSRMLS_FETCH();
- FETCH_DISP("DeleteMemberByName");
-
- return S_FALSE;
-}
-
-static HRESULT STDMETHODCALLTYPE disp_deletememberbydispid(
- IDispatchEx *This,
- /* [in] */ DISPID id)
-{
- TSRMLS_FETCH();
- FETCH_DISP("DeleteMemberByDispID");
-
- return S_FALSE;
-}
-
-static HRESULT STDMETHODCALLTYPE disp_getmemberproperties(
- IDispatchEx *This,
- /* [in] */ DISPID id,
- /* [in] */ DWORD grfdexFetch,
- /* [out] */ DWORD *pgrfdex)
-{
- TSRMLS_FETCH();
- FETCH_DISP("GetMemberProperties");
-
- return DISP_E_UNKNOWNNAME;
-}
-
-static HRESULT STDMETHODCALLTYPE disp_getmembername(
- IDispatchEx *This,
- /* [in] */ DISPID id,
- /* [out] */ BSTR *pbstrName)
-{
- zval *name;
- TSRMLS_FETCH();
- FETCH_DISP("GetMemberName");
-
- if (SUCCESS == zend_hash_index_find(disp->dispid_to_name, id, (void**)&name)) {
- OLECHAR *olestr = php_char_to_OLECHAR(Z_STRVAL_P(name), Z_STRLEN_P(name), CP_ACP, FALSE);
- *pbstrName = SysAllocString(olestr);
- efree(olestr);
- return S_OK;
- } else {
- return DISP_E_UNKNOWNNAME;
- }
-}
-
-static HRESULT STDMETHODCALLTYPE disp_getnextdispid(
- IDispatchEx *This,
- /* [in] */ DWORD grfdex,
- /* [in] */ DISPID id,
- /* [out] */ DISPID *pid)
-{
- ulong next = id+1;
- TSRMLS_FETCH();
- FETCH_DISP("GetNextDispID");
-
- while(!zend_hash_index_exists(disp->dispid_to_name, next))
- next++;
-
- if (zend_hash_index_exists(disp->dispid_to_name, next)) {
- *pid = next;
- return S_OK;
- }
- return S_FALSE;
-}
-
-static HRESULT STDMETHODCALLTYPE disp_getnamespaceparent(
- IDispatchEx *This,
- /* [out] */ IUnknown **ppunk)
-{
- TSRMLS_FETCH();
- FETCH_DISP("GetNameSpaceParent");
-
- *ppunk = NULL;
- return E_NOTIMPL;
-}
-
-static struct IDispatchExVtbl php_dispatch_vtbl = {
- disp_queryinterface,
- disp_addref,
- disp_release,
- disp_gettypeinfocount,
- disp_gettypeinfo,
- disp_getidsofnames,
- disp_invoke,
- disp_getdispid,
- disp_invokeex,
- disp_deletememberbyname,
- disp_deletememberbydispid,
- disp_getmemberproperties,
- disp_getmembername,
- disp_getnextdispid,
- disp_getnamespaceparent
-};
-
-
-/* enumerate functions and properties of the object and assign
- * dispatch ids */
-static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
-{
- HashPosition pos;
- char *name = NULL;
- zval *tmp;
- int namelen;
- int keytype;
- ulong pid;
-
- if (disp->dispid_to_name == NULL) {
- ALLOC_HASHTABLE(disp->dispid_to_name);
- ALLOC_HASHTABLE(disp->name_to_dispid);
- zend_hash_init(disp->name_to_dispid, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_init(disp->dispid_to_name, 0, NULL, ZVAL_PTR_DTOR, 0);
- }
-
- /* properties */
- zend_hash_internal_pointer_reset_ex(Z_OBJPROP_PP(&disp->object), &pos);
- while (HASH_KEY_NON_EXISTANT != (keytype =
- zend_hash_get_current_key_ex(Z_OBJPROP_PP(&disp->object), &name, &namelen, &pid, 0, &pos))) {
- char namebuf[32];
- if (keytype == HASH_KEY_IS_LONG) {
- sprintf(namebuf, "%d", pid);
- name = namebuf;
- namelen = strlen(namebuf);
- }
-
- zend_hash_move_forward_ex(Z_OBJPROP_PP(&disp->object), &pos);
-
- /* Find the existing id */
- if (zend_hash_find(disp->name_to_dispid, name, namelen+1, (void**)&tmp) == SUCCESS)
- continue;
-
- /* add the mappings */
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, name, namelen, 1);
- zend_hash_index_update(disp->dispid_to_name, pid, (void*)&tmp, sizeof(zval *), NULL);
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, pid);
- zend_hash_update(disp->name_to_dispid, name, namelen+1, (void*)&tmp, sizeof(zval *), NULL);
-
- }
-
- /* functions */
- zend_hash_internal_pointer_reset_ex(&Z_OBJCE_PP(&disp->object)->function_table, &pos);
- while (HASH_KEY_NON_EXISTANT != (keytype =
- zend_hash_get_current_key_ex(&Z_OBJCE_PP(&disp->object)->function_table, &name, &namelen, &pid, 0, &pos))) {
-
- char namebuf[32];
- if (keytype == HASH_KEY_IS_LONG) {
- sprintf(namebuf, "%d", pid);
- name = namebuf;
- namelen = strlen(namebuf);
- }
-
- zend_hash_move_forward_ex(Z_OBJPROP_PP(&disp->object), &pos);
-
- /* Find the existing id */
- if (zend_hash_find(disp->name_to_dispid, name, namelen+1, (void**)&tmp) == SUCCESS)
- continue;
-
- /* add the mappings */
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, name, namelen, 1);
- zend_hash_index_update(disp->dispid_to_name, pid, (void*)&tmp, sizeof(zval *), NULL);
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, pid);
- zend_hash_update(disp->name_to_dispid, name, namelen+1, (void*)&tmp, sizeof(zval *), NULL);
- }
-}
-
-static php_dispatchex *disp_constructor(zval *object)
-{
- php_dispatchex *disp = (php_dispatchex*)CoTaskMemAlloc(sizeof(php_dispatchex));
-
- trace("constructing a COM proxy\n");
-
- if (disp == NULL)
- return NULL;
-
- memset(disp, 0, sizeof(php_dispatchex));
-
- disp->engine_thread = tsrm_thread_id();
- disp->lpVtbl = &php_dispatch_vtbl;
- disp->refcount = 1;
-
-
- if (object)
- ZVAL_ADDREF(object);
- disp->object = object;
-
- disp->id = zend_list_insert(disp, le_dispatch);
-
- return disp;
-}
-
-static void disp_destructor(php_dispatchex *disp)
-{
- TSRMLS_FETCH();
-
- trace("destroying COM wrapper for PHP object %s\n", Z_OBJCE_P(disp->object)->name);
-
- disp->id = 0;
-
- if (disp->refcount > 0)
- CoDisconnectObject((IUnknown*)disp, 0);
-
- zend_hash_destroy(disp->dispid_to_name);
- zend_hash_destroy(disp->name_to_dispid);
- FREE_HASHTABLE(disp->dispid_to_name);
- FREE_HASHTABLE(disp->name_to_dispid);
-
- if (disp->object)
- zval_ptr_dtor(&disp->object);
-
-
- CoTaskMemFree(disp);
-}
-
-PHPAPI IDispatch *php_COM_export_as_sink(zval *val, GUID *sinkid, HashTable *id_to_name)
-{
- php_dispatchex *disp = disp_constructor(val);
- HashPosition pos;
- char *name = NULL;
- zval *tmp, **ntmp;
- int namelen;
- int keytype;
- ulong pid;
-
- disp->dispid_to_name = id_to_name;
-
- memcpy(&disp->sinkid, sinkid, sizeof(disp->sinkid));
-
- /* build up the reverse mapping */
- ALLOC_HASHTABLE(disp->name_to_dispid);
- zend_hash_init(disp->name_to_dispid, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- zend_hash_internal_pointer_reset_ex(id_to_name, &pos);
- while (HASH_KEY_NON_EXISTANT != (keytype =
- zend_hash_get_current_key_ex(id_to_name, &name, &namelen, &pid, 0, &pos))) {
-
- if (keytype == HASH_KEY_IS_LONG) {
-
- zend_hash_get_current_data_ex(id_to_name, (void**)&ntmp, &pos);
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, pid);
- zend_hash_update(disp->name_to_dispid, Z_STRVAL_PP(ntmp), Z_STRLEN_PP(ntmp)+1, (void*)&tmp, sizeof(zval *), NULL);
- }
-
- zend_hash_move_forward_ex(id_to_name, &pos);
- }
-
- return (IDispatch*)disp;
-}
-
-PHPAPI IDispatch *php_COM_export_object(zval *val)
-{
- php_dispatchex *disp = NULL;
- TSRMLS_FETCH();
-
- if (Z_TYPE_P(val) != IS_OBJECT)
- return NULL;
-
- if (Z_OBJCE_P(val) == com_class_entry) {
- /* pass back it's IDispatch directly */
- comval *obj;
- rpc_internal *intern;
-
- if (GET_INTERNAL_EX(intern, val) != SUCCESS) {
- /* TODO: exception */
- }
-
- obj = (comval *) intern->data;
-
- C_DISPATCH(obj)->lpVtbl->AddRef(C_DISPATCH(obj));
- return C_DISPATCH(obj);
- }
-
- disp = disp_constructor(val);
- generate_dispids(disp TSRMLS_CC);
-
- return (IDispatch*)disp;
-}
-
-
diff --git a/ext/rpc/com/php_com.h b/ext/rpc/com/php_com.h
deleted file mode 100644
index 6a3fb61d7b..0000000000
--- a/ext/rpc/com/php_com.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_COM_H
-#define PHP_COM_H
-
-extern zend_module_entry com_module_entry;
-#define phpext_com_ptr &com_module_entry
-
-#endif /* PHP_COM_H */ \ No newline at end of file
diff --git a/ext/rpc/com/variant.c b/ext/rpc/com/variant.c
deleted file mode 100644
index fbe4bf9f78..0000000000
--- a/ext/rpc/com/variant.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- | Alan Brown <abrown@pobox.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/*
- * This module maps the VARIANT datastructure into PHP so that it can be used to
- * pass values to COM and DOTNET Objects by reference and not only by value.
- *
- * harald
- */
-
-#ifdef PHP_WIN32
-
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "conversion.h"
-#include "variant.h"
-
-#include "../php_rpc.h"
-
-#include <unknwn.h>
-
-static zend_object_value variant_objects_new(zend_class_entry * TSRMLS_DC);
-static void variant_objects_delete(void *, zend_object_handle TSRMLS_DC);
-
-/* object handler */
-static zval* variant_read(zval *, zval * TSRMLS_DC);
-static void variant_write(zval *, zval *, zval * TSRMLS_DC);
-static union _zend_function* variant_get_constructor(zval * TSRMLS_DC);
-static zend_class_entry* variant_get_class_entry(zval * TSRMLS_DC);
-/**/
-
-static HashTable types;
-static zend_class_entry *variant_class_entry;
-static zend_function *variant_ctor;
-static zend_object_handlers variant_handlers = {
- ZEND_OBJECTS_STORE_HANDLERS,
-
- variant_read,
- variant_write,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- variant_get_constructor,
- variant_get_class_entry,
- NULL,
- NULL
-};
-
-/**/
-void php_variant_init(int module_number TSRMLS_DC)
-{
- zend_internal_function *zif;
- zend_class_entry ce;
- int type;
-
- /* variant datatypes */
- REGISTER_LONG_CONSTANT("VT_NULL", VT_NULL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_EMPTY", VT_EMPTY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_UI1", VT_UI1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_I2", VT_I2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_I4", VT_I4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_R4", VT_R4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_R8", VT_R8, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_BOOL", VT_BOOL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_ERROR", VT_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_CY", VT_CY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_DATE", VT_DATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_BSTR", VT_BSTR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_DECIMAL", VT_DECIMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_UNKNOWN", VT_UNKNOWN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_DISPATCH", VT_DISPATCH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_VARIANT", VT_VARIANT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_I1", VT_I1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_UI2", VT_UI2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_UI4", VT_UI4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_INT", VT_INT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_UINT", VT_UINT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_ARRAY", VT_ARRAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_BYREF", VT_BYREF, CONST_CS | CONST_PERSISTENT);
-
- /* codepages */
- REGISTER_LONG_CONSTANT("CP_ACP", CP_ACP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_MACCP", CP_MACCP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_OEMCP", CP_OEMCP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_UTF7", CP_UTF7, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_UTF8", CP_UTF8, CONST_CS | CONST_PERSISTENT);
-
-#ifdef CP_SYMBOL
- REGISTER_LONG_CONSTANT("CP_SYMBOL", CP_SYMBOL, CONST_CS | CONST_PERSISTENT);
-#else
-#error "CP_SYMBOL undefined"
-#endif
-#ifdef CP_THREAD_ACP
- REGISTER_LONG_CONSTANT("CP_THREAD_ACP", CP_THREAD_ACP, CONST_CS | CONST_PERSISTENT);
-#else
-#error "CP_THREAD_ACP undefined"
-#endif
-
- INIT_CLASS_ENTRY(ce, "variant", NULL);
- ce.create_object = variant_objects_new;
- variant_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
-
- zif = (zend_internal_function *) emalloc(sizeof(zend_internal_function));
-
- zif->type = ZEND_INTERNAL_FUNCTION;
- zif->function_name = variant_class_entry->name;
- zif->scope = variant_class_entry;
- zif->arg_types = NULL;
- zif->handler = ZEND_FN(variant_load);
-
- /* add new constructor to the method table */
- zend_hash_add(&(variant_class_entry->function_table), variant_class_entry->name,
- variant_class_entry->name_length + 1, zif, sizeof(zend_function), &variant_ctor);
- efree(zif);
-
- zend_hash_init(&types, 0, NULL, NULL, TRUE);
-
- type = VT_UI1;
- zend_hash_add(&types, "bVal", 5, (void *) &type, sizeof(int), NULL);
- type = VT_UI2;
- zend_hash_add(&types, "uiVal", 6, (void *) &type, sizeof(int), NULL);
- type = VT_UI4;
- zend_hash_add(&types, "ulVal", 6, (void *) &type, sizeof(int), NULL);
- type = VT_UINT;
- zend_hash_add(&types, "uintVal", 8, (void *) &type, sizeof(int), NULL);
- type = VT_I1;
- zend_hash_add(&types, "cVal", 5, (void *) &type, sizeof(int), NULL);
- type = VT_I2;
- zend_hash_add(&types, "iVal", 5, (void *) &type, sizeof(int), NULL);
- type = VT_I4;
- zend_hash_add(&types, "lVal", 5, (void *) &type, sizeof(int), NULL);
- type = VT_INT;
- zend_hash_add(&types, "intVal", 7, (void *) &type, sizeof(int), NULL);
- type = VT_R4;
- zend_hash_add(&types, "fltVal", 7, (void *) &type, sizeof(int), NULL);
- type = VT_R8;
- zend_hash_add(&types, "dblVal", 7, (void *) &type, sizeof(int), NULL);
- type = VT_BOOL;
- zend_hash_add(&types, "boolVal", 8, (void *) &type, sizeof(int), NULL);
- type = VT_ERROR;
- zend_hash_add(&types, "scode", 6, (void *) &type, sizeof(int), NULL);
- type = VT_CY;
- zend_hash_add(&types, "cyVal", 6, (void *) &type, sizeof(int), NULL);
- type = VT_DATE;
- zend_hash_add(&types, "date", 5, (void *) &type, sizeof(int), NULL);
- type = VT_BSTR;
- zend_hash_add(&types, "bstrVal", 8, (void *) &type, sizeof(int), NULL);
- type = VT_UNKNOWN;
- zend_hash_add(&types, "punkVal", 8, (void *) &type, sizeof(int), NULL);
- type = VT_DISPATCH;
- zend_hash_add(&types, "pdispVal", 9, (void *) &type, sizeof(int), NULL);
- type = VT_ARRAY;
- zend_hash_add(&types, "parray", 7, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF;
- zend_hash_add(&types, "byref", 6, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_UI1;
- zend_hash_add(&types, "pbVal", 6, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_UI2;
- zend_hash_add(&types, "puiVal", 7, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_UI4;
- zend_hash_add(&types, "pulVal", 7, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_UINT;
- zend_hash_add(&types, "puintVal", 9, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_I1;
- zend_hash_add(&types, "pcVal", 6, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_I2;
- zend_hash_add(&types, "piVal", 6, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_I4;
- zend_hash_add(&types, "plVal", 6, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_INT;
- zend_hash_add(&types, "pintVal", 8, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_R4;
- zend_hash_add(&types, "pfltVal", 8, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_R8;
- zend_hash_add(&types, "pdblVal", 8, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_BOOL;
- zend_hash_add(&types, "pboolVal", 9, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_ERROR;
- zend_hash_add(&types, "pscode", 7, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_CY;
- zend_hash_add(&types, "pcyVal", 7, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_DATE;
- zend_hash_add(&types, "pdate", 6, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_BSTR;
- zend_hash_add(&types, "pbstrVal", 9, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_DECIMAL;
- zend_hash_add(&types, "pdecVal", 8, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_UNKNOWN;
- zend_hash_add(&types, "ppunkVal", 9, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_DISPATCH;
- zend_hash_add(&types, "ppdispVal", 10, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_ARRAY;
- zend_hash_add(&types, "pparray", 8, (void *) &type, sizeof(int), NULL);
- type = VT_BYREF|VT_VARIANT;
- zend_hash_add(&types, "pvarVal", 8, (void *) &type, sizeof(int), NULL);
-}
-
-void php_variant_shutdown(TSRMLS_D)
-{
- zend_hash_destroy(&types);
-}
-
-static zend_object_value variant_objects_new(zend_class_entry *ce TSRMLS_DC)
-{
- zend_object_value *zov;
- variantval *var;
-
- ALLOC_VARIANT(var);
-
- /* set up the object value struct */
- zov = (zend_object_value*) emalloc(sizeof(zend_object_value));
- zov->handlers = &variant_handlers;
- zov->handle = zend_objects_store_put(var, variant_objects_delete, NULL TSRMLS_CC);
-
- return *zov;
-}
-
-static void variant_objects_delete(void *object, zend_object_handle handle TSRMLS_DC)
-{
- FREE_VARIANT((variantval *)object);
-}
-
-static zval* variant_read(zval *object, zval *member TSRMLS_DC)
-{
- variantval *var;
- zval *result;
-
- ALLOC_ZVAL(result);
-
- if ((var = zend_object_store_get_object(object TSRMLS_CC)) == NULL) {
- /* exception */
- }
-
- if (!strcmp(Z_STRVAL_P(member), "value")) {
- /* var_arg can't be an idispatch, so we don't care for the implicit AddRef() call here */
- php_variant_to_zval(var->var, result, var->codepage);
- } else if (!strcmp(Z_STRVAL_P(member), "type")) {
- ZVAL_LONG(result, V_VT(var->var));
- } else {
- ZVAL_FALSE(result);
- rpc_error(E_WARNING, "Unknown member.");
- }
-
- return result;
-}
-
-static void variant_write(zval *object, zval *member, zval *value TSRMLS_DC)
-{
- int *type;
- variantval *var;
-
- if ((var = zend_object_store_get_object(object TSRMLS_CC)) == NULL) {
- /* exception */
- }
-
- if (!strcmp(Z_STRVAL_P(member), "value")) {
- php_zval_to_variant(value, var->var, var->codepage TSRMLS_CC);
- } else if (zend_hash_find(&types, Z_STRVAL_P(member), Z_STRLEN_P(member) + 1, (void **) &type) == SUCCESS) {
- php_zval_to_variant_ex(value, var->var, *type, var->codepage TSRMLS_CC);
- } else {
- rpc_error(E_WARNING, "Unknown member.");
- }
-}
-
-static union _zend_function* variant_get_constructor(zval *object TSRMLS_DC)
-{
- return variant_ctor;
-}
-
-static zend_class_entry* variant_get_class_entry(zval *object TSRMLS_DC)
-{
- return variant_class_entry;
-}
-
-/**/
-/* constructor */
-ZEND_FUNCTION(variant_load)
-{
- zval *value = NULL, *object = getThis();
- variantval *var;
- long type = 0;
-
- if (!object || ((var = zend_object_store_get_object(object TSRMLS_CC)) == NULL)) {
- /*TODO exception */
- }
-
- zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zll", &value, &type, &(var->codepage));
-
- if (value) {
- if (type) {
- php_zval_to_variant_ex(value, var->var, type, var->codepage TSRMLS_CC);
- } else {
- php_zval_to_variant(value, var->var, var->codepage TSRMLS_CC);
- }
- }
-}
-
-#endif /* PHP_WIN32 */
diff --git a/ext/rpc/com/variant.h b/ext/rpc/com/variant.h
deleted file mode 100644
index e8c3539572..0000000000
--- a/ext/rpc/com/variant.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-
-#ifndef VARIANT_H
-#define VARIANT_H
-
-#if PHP_WIN32
-
-#define ALLOC_VARIANT(v) (v) = (variantval *) emalloc(sizeof(variantval)); \
- (v)->var = (VARIANT *) emalloc(sizeof(VARIANT)); \
- (v)->codepage = CP_ACP; \
- VariantInit((v)->var);
-
-#define FREE_VARIANT(v) VariantClear((v)->var); \
- efree((v)->var); \
- efree((v));
-
-#define ZVAL_VARIANT(z, v, cp) \
- if (V_VT(v) == VT_DISPATCH && V_DISPATCH(v) == NULL) { \
- V_VT(v) = VT_NULL; \
- } \
- if (V_VT(v) == VT_DISPATCH) { \
- comval *obj; \
- ALLOC_COM(obj); \
- php_COM_set(obj, &V_DISPATCH(v), TRUE); \
- rpc_object_from_data_ex(z, com, obj, NULL); \
- } else { \
- php_variant_to_zval((v), (z), cp); \
- VariantClear(v); \
- }
-
-#define RETVAL_VARIANT(v, cp) ZVAL_VARIANT(return_value, v, cp)
-#define RETURN_VARIANT(v, cp) RETVAL_VARIANT(v, cp) \
- return;
-
-typedef struct variantval_ {
- VARIANT* var;
- long codepage;
-} variantval;
-
-void php_variant_init(int module_number TSRMLS_DC);
-void php_variant_shutdown(TSRMLS_D);
-
-ZEND_FUNCTION(variant_load);
-
-#endif /* PHP_WIN32 */
-
-#endif /* VARIANT_H */
diff --git a/ext/rpc/dotnet/CREDITS b/ext/rpc/dotnet/CREDITS
deleted file mode 100644
index 154522c6f8..0000000000
--- a/ext/rpc/dotnet/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-dotnet
-Sam Ruby
diff --git a/ext/rpc/dotnet/EXPERIMENTAL b/ext/rpc/dotnet/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/rpc/dotnet/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/rpc/dotnet/README b/ext/rpc/dotnet/README
deleted file mode 100644
index 8cad7bab8f..0000000000
--- a/ext/rpc/dotnet/README
+++ /dev/null
@@ -1,32 +0,0 @@
-Warning
-=======
-
-This support is EXPERIMENTAL. In fact, it integrates code that
-Microsoft labels as pre-beta. Use at your own risk.
-
-Build instructions
-==================
-
-Download and install the .NET Framework SDK Technology Preview from
-http://msdn.microsoft.com/net/#sdk. Once installed, copy Mscoree.h
-(typically found in C:\Program Files\NGWSSDK\Include to ext\dotnet).
-Do not simply add the NGWSSDK\Include directory to the include path
-as this will cause compilation failures.
-
-Download and unzip the source to the dm.net COM Moniker from
-http://staff.develop.com/jasonw/clr/readme.htm. Copy mscorlib.h
-to ext\dotnet. There is no need to register the clrmonsrv.dll as
-it is not used.
-
-At this point, the dotnet project can be built like any other
-project, from either VisualStudio 6's GUI or from the command line.
-Example command line invocation:
-
- msdev dotnet.dsp /MAKE "dotnet - Win32 Debug_TS"
-
-Execution instructions:
-=======================
-
-Add "extension=php_dotnet.dll" into php.ini.
-
-Sample program can be found at dotnet.php
diff --git a/ext/rpc/dotnet/dotnet.cpp b/ext/rpc/dotnet/dotnet.cpp
deleted file mode 100644
index 75fed831e5..0000000000
--- a/ext/rpc/dotnet/dotnet.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2002 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby <rubys@us.ibm.com> |
- | Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * This module implements support for Microsoft .Net components.
- */
-
-/*
- * 28.1.2001
- * use external unicode conversion functions
- *
- * harald radi <h.radi@nme.at>
- */
-
-#ifdef PHP_WIN32
-
-#include <iostream>
-#include <math.h>
-#include <comdef.h>
-
-extern "C"
-{
-#include "php.h"
-#include "ext/standard/info.h"
-}
-
-#include "ext/com/conversion.h"
-#include "ext/com/php_COM.h"
-
-#include "Mscoree.h"
-#include "mscorlib.h"
-
-using namespace mscorlib;
-
-static ICorRuntimeHost *pHost;
-static mscorlib::_AppDomain *pDomain;
-
-static zend_class_entry dotnet_class_entry;
-static int codepage;
-
-HRESULT dotnet_init() {
- HRESULT hr;
-
- hr = CoCreateInstance(CLSID_CorRuntimeHost, NULL, CLSCTX_ALL,
- IID_ICorRuntimeHost, (void **)&pHost);
- if (FAILED(hr)) return hr;
-
- hr = pHost->Start();
- if (FAILED(hr)) return hr;
-
- IUnknown *uDomain;
- hr = pHost->GetDefaultDomain(&uDomain);
- if (FAILED(hr)) return hr;
-
- hr = uDomain->QueryInterface(__uuidof(_AppDomain), (void**) &pDomain);
- if (FAILED(hr)) return -1;
-
- uDomain->Release();
-
- return ERROR_SUCCESS;
-}
-
-HRESULT dotnet_create(OLECHAR *assembly, OLECHAR *datatype, comval *obj TSRMLS_DC) {
- HRESULT hr;
-
- _ObjectHandle *pHandle;
- hr = pDomain->CreateInstance(_bstr_t(assembly), _bstr_t(datatype), &pHandle);
- if (FAILED(hr)) return hr;
- if (!pHandle) return hr;
-
- _variant_t unwrapped;
- hr = pHandle->Unwrap(&unwrapped);
- pHandle->Release();
- if (FAILED(hr)) return hr;
-
- php_COM_set(obj, &unwrapped.pdispVal, TRUE TSRMLS_CC);
- return ERROR_SUCCESS;
-}
-
-void dotnet_term() {
- if (pHost) pHost->Stop();
- if (pHost) pHost->Release();
- if (pDomain) pDomain->Release();
-
- pHost = 0;
- pDomain = 0;
-}
-
-/* {{{ proto int dotnet_load(string assembly_name [, string datatype_name, int codepage])
- Loads a DOTNET module */
-PHP_FUNCTION(dotnet_load)
-{
- HRESULT hr;
- zval **assembly_name, **datatype_name, **code_page;
- OLECHAR *assembly, *datatype;
- comval *obj;
-
- switch(ZEND_NUM_ARGS())
- {
- case 2:
- zend_get_parameters_ex(2, &assembly_name, &datatype_name);
- codepage = CP_ACP;
- break;
- case 3:
- zend_get_parameters_ex(3, &assembly_name, &datatype_name, &code_page);
-
- convert_to_long_ex(code_page);
- codepage = Z_LVAL_PP(code_page);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string_ex(assembly_name);
- assembly = php_char_to_OLECHAR(Z_STRVAL_PP(assembly_name), Z_STRLEN_PP(assembly_name), codepage TSRMLS_CC);
-
- convert_to_string_ex(datatype_name);
- datatype = php_char_to_OLECHAR(Z_STRVAL_PP(datatype_name), Z_STRLEN_PP(datatype_name), codepage TSRMLS_CC);
-
- ALLOC_COM(obj);
-
- /* obtain IDispatch */
- hr = dotnet_create(assembly, datatype, obj TSRMLS_CC);
- efree(assembly);
- efree(datatype);
- if (FAILED(hr)) {
- char *error_message;
- error_message = php_COM_error_message(hr TSRMLS_CC);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error obtaining .Net class for %s in assembly %s: %s", datatype_name->value.str.val, assembly_name->value.str.val, error_message);
- LocalFree(error_message);
- efree(obj);
- RETURN_FALSE;
- }
- if (C_DISPATCH(obj) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate %s in assembly %s", datatype_name->value.str.val, assembly_name->value.str.val);
- efree(obj);
- RETURN_FALSE;
- }
-
- RETURN_LONG(zend_list_insert(obj, IS_COM));
-}
-/* }}} */
-
-
-void php_DOTNET_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- pval *object = property_reference->object;
- zend_overloaded_element *function_name = (zend_overloaded_element *) property_reference->elements_list->tail->data;
-
- if (zend_llist_count(property_reference->elements_list)==1
- && !strcmp(Z_STRVAL(function_name->element), "dotnet")) { /* constructor */
- pval *object_handle;
-
- PHP_FN(dotnet_load)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- if (!Z_LVAL_P(return_value)) {
- ZVAL_FALSE(object);
- return;
- }
- ALLOC_ZVAL(object_handle);
- *object_handle = *return_value;
- pval_copy_constructor(object_handle);
- INIT_PZVAL(object_handle);
- zend_hash_index_update(Z_OBJPROP_P(object), 0, &object_handle, sizeof(pval *), NULL);
- pval_destructor(&function_name->element);
- } else {
- php_COM_call_function_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU, property_reference);
- }
-}
-
-void php_register_DOTNET_class(TSRMLS_D)
-{
- INIT_OVERLOADED_CLASS_ENTRY(dotnet_class_entry, "DOTNET", NULL,
- php_DOTNET_call_function_handler,
- php_COM_get_property_handler,
- php_COM_set_property_handler);
-
- zend_register_internal_class(&dotnet_class_entry TSRMLS_CC);
-}
-
-function_entry DOTNET_functions[] = {
- {NULL, NULL, NULL}
-};
-
-static PHP_MINFO_FUNCTION(DOTNET)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, ".NET support", "enabled");
- php_info_print_table_end();
-}
-
-PHP_MINIT_FUNCTION(DOTNET)
-{
- HRESULT hr;
-
- if (FAILED(hr = dotnet_init())) {
- return hr;
- }
-
- php_register_DOTNET_class(TSRMLS_C);
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(DOTNET)
-{
- dotnet_term();
- return SUCCESS;
-}
-
-
-zend_module_entry dotnet_module_entry = {
- STANDARD_MODULE_HEADER,
- "dotnet", DOTNET_functions, PHP_MINIT(DOTNET), PHP_MSHUTDOWN(DOTNET), NULL, NULL, PHP_MINFO(DOTNET), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES
-};
-
-BEGIN_EXTERN_C()
-ZEND_GET_MODULE(dotnet)
-END_EXTERN_C()
-
-#endif
diff --git a/ext/rpc/dotnet/dotnet.dsp b/ext/rpc/dotnet/dotnet.dsp
deleted file mode 100644
index 1a7d790802..0000000000
--- a/ext/rpc/dotnet/dotnet.dsp
+++ /dev/null
@@ -1,167 +0,0 @@
-# Microsoft Developer Studio Project File - Name="dotnet" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=dotnet - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "dotnet.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "dotnet.mak" CFG="dotnet - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "dotnet - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dotnet - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dotnet - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dotnet - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "dotnet - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release/php_dotnet.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "dotnet - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug/php_dotnet.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "dotnet - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /D /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_dotnet.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "dotnet - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dotnet.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "dotnet - Win32 Release"
-# Name "dotnet - Win32 Debug"
-# Name "dotnet - Win32 Debug_TS"
-# Name "dotnet - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\dotnet.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_dotnet.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\README
-# End Source File
-# End Target
-# End Project
diff --git a/ext/rpc/dotnet/dotnet.php b/ext/rpc/dotnet/dotnet.php
deleted file mode 100644
index 3b0b67c02f..0000000000
--- a/ext/rpc/dotnet/dotnet.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?
- $stack = new DOTNET("mscorlib","System.Collections.Stack");
-
- $stack->Push(".Net");
- $stack->Push("Hello ");
-
- echo $stack->Pop() . $stack->Pop();
-?>
diff --git a/ext/rpc/dotnet/php_dotnet.h b/ext/rpc/dotnet/php_dotnet.h
deleted file mode 100644
index 598c0b5579..0000000000
--- a/ext/rpc/dotnet/php_dotnet.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef PHP_DOTNET_H
-#define PHP_DOTNET_H
-
-#ifdef PHP_WIN32
-
-PHP_MINIT_FUNCTION(DOTNET);
-PHP_MSHUTDOWN_FUNCTION(DOTNET);
-PHP_FUNCTION(DOTNET_load);
-
-extern zend_module_entry DOTNET_module_entry;
-#define DOTNET_module_ptr &DOTNET_module_entry
-
-#else
-
-#define DOTNET_module_ptr NULL
-
-#endif /* PHP_WIN32 */
-
-#define phpext_DOTNET_ptr DOTNET_module_ptr
-
-#endif /* PHP_DOTNET_H */
diff --git a/ext/rpc/handler.h b/ext/rpc/handler.h
deleted file mode 100644
index cbb868265c..0000000000
--- a/ext/rpc/handler.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef HANDLER_H
-#define HANDLER_H
-
-#include "php.h"
-#include "php_ini.h"
-
-#define RPC_REGISTER_LAYER(layer) rpc_register_layer(&layer##_handler_entry TSRMLS_CC);
-#define RPC_DECLARE_HANDLER(layer) rpc_object_handlers layer##_object_handlers; \
- zend_class_entry *layer##_class_entry; \
- function_entry layer##_function_entry[]; \
- function_entry layer##_method_entry[]; \
- static rpc_handler_entry layer##_handler_entry = \
- {#layer, &layer##_object_handlers, &layer##_class_entry,\
- layer##_function_entry, layer##_method_entry}
-
-#define RPC_REGISTER_HANDLERS_BEGIN(layer) zend_class_entry *layer##_class_entry; \
- rpc_object_handlers layer##_object_handlers = {
-
-#define RPC_REGISTER_HANDLERS_END() };
-
-#define RPC_FUNCTION_ENTRY(layer) layer##_function_entry
-#define RPC_FUNCTION_ENTRY_BEGIN(layer) function_entry layer##_function_entry[] = { \
- ZEND_FALIAS(layer##_load, rpc_load, NULL) \
- ZEND_FALIAS(layer##_call, rpc_call, NULL) \
- ZEND_FALIAS(layer##_get, rpc_get, NULL) \
- ZEND_FALIAS(layer##_set, rpc_get, NULL) \
- ZEND_FALIAS(layer##_singleton, rpc_singleton, NULL) \
- ZEND_FALIAS(layer##_poolable, rpc_poolable, NULL)
-
-#define RPC_FUNCTION_ENTRY_END() {NULL, NULL, NULL} \
- };
-
-#define RPC_METHOD_ENTRY_BEGIN(layer) function_entry layer##_method_entry[] = {
-
-#define RPC_METHOD_ENTRY_END() {NULL, NULL, NULL} \
- };
-
-#define DONT_HASH 0
-#define HASH_AS_INT 1
-#define HASH_AS_STRING 2
-#define HASH_WITH_SIGNATURE 4
-#define HASH_AS_INT_WITH_SIGNATURE (HASH_AS_INT & HASH_WITH_SIGNATURE)
-#define HASH_AS_STRING_WITH_SIGNATURE (HASH_AS_STRING & HASH_WITH_SIGNATURE)
-
-#define CLASS 0
-#define METHOD 1
-#define PROPERTY 2
-
-
-/* string */
-typedef struct _rpc_string {
- char *str;
- zend_uint len;
-} rpc_string;
-
-/* rpc handler that have to be implemented by a
- * specific rpc layer
- */
-typedef struct _rpc_object_handlers {
- const zend_bool poolable;
- const zend_uint hash_type;
- int (*rpc_hash)(rpc_string name, rpc_string *hash, void *data, int num_args, char *arg_types, int type);
- int (*rpc_name)(rpc_string hash, rpc_string *name, void *data, int type);
- int (*rpc_ctor)(rpc_string class_name, void **data, int num_args, zval **args[]);
- int (*rpc_dtor)(void *data);
- int (*rpc_describe)(rpc_string method_name, void *data, char **arg_types, unsigned char **ref_types);
- int (*rpc_call)(rpc_string method_name, void *data, zval *return_value, int num_args, zval **args[]);
- int (*rpc_get)(rpc_string property_name, zval *return_value, void *data);
- int (*rpc_set)(rpc_string property_name, zval *value, void *data);
- int (*rpc_compare)(void *data1, void *data2);
- int (*rpc_has_property)(rpc_string property_name, void *data);
- int (*rpc_unset_property)(rpc_string property_name, void *data);
- int (*rpc_get_properties)(HashTable **properties, void *data);
-} rpc_object_handlers;
-
-/* handler entry */
-typedef struct _rpc_handler_entry {
- char *name;
- rpc_object_handlers *handlers;
- zend_class_entry **ce;
- function_entry *functions;
- function_entry *methods;
-} rpc_handler_entry;
-
-/* class/method/function hash */
-typedef struct _rpc_class_hash {
- rpc_string name; /* must be first entry */
- zend_bool poolable;
- zend_bool singleton;
- TsHashTable methods;
- TsHashTable properties;
- rpc_object_handlers **handlers;
- zend_class_entry *ce;
- void *data;
-} rpc_class_hash;
-
-/* internal data */
-typedef struct _rpc_internal {
- MUTEX_T mx_handler;
- TsHashTable function_table;
- zend_bool free_function_table;
- rpc_object_handlers **handlers;
- rpc_class_hash *hash;
- zend_class_entry *ce;
- void *data;
-} rpc_internal;
-
-/* proxy data */
-typedef struct _rpc_proxy {
- zend_uint dummy;
-} rpc_proxy;
-
-
-ZEND_API ZEND_FUNCTION(rpc_load);
-ZEND_API ZEND_FUNCTION(rpc_call);
-ZEND_API ZEND_FUNCTION(rpc_set);
-ZEND_API ZEND_FUNCTION(rpc_get);
-ZEND_API ZEND_FUNCTION(rpc_singleton);
-ZEND_API ZEND_FUNCTION(rpc_poolable);
-
-ZEND_API rpc_register_layer(rpc_handler_entry *entry TSRMLS_DC);
-ZEND_API zval* _rpc_object_from_data(zval *z, rpc_handler_entry *handler, void *data, rpc_class_hash *class_hash);
-#define rpc_object_from_data(layer, data) rpc_object_from_data_ex(NULL, layer, data, NULL)
-#define rpc_object_from_data_ex(z, layer, data, class_hash) _rpc_object_from_data((z), &layer##_handler_entry, (data), (class_hash))
-
-#endif /* HANDLER_H */ \ No newline at end of file
diff --git a/ext/rpc/hash.h b/ext/rpc/hash.h
deleted file mode 100644
index d2f558df5b..0000000000
--- a/ext/rpc/hash.h
+++ /dev/null
@@ -1,74 +0,0 @@
-#ifndef HASH_H
-#define HASH_H
-
-static int zend_ts_hash_remove_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData);
-
-static int zend_ts_hash_remove_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData)
-{
- uint nIndex;
- uint h = nKeyLength;
- uint result;
- void **ppData;
- Bucket *p;
-
- tsrm_mutex_lock(ht->mx_writer);
-
- if (arKey) {
- result = zend_hash_find(TS_HASH(ht), arKey, nKeyLength, (void **) &ppData);
- } else {
- result = zend_hash_index_find(TS_HASH(ht), h, (void **) &ppData);
- }
-
- if (result == SUCCESS) {
- *pData = *ppData;
-
- if (arKey) {
- h = zend_inline_hash_func(arKey, nKeyLength);
- }
-
- nIndex = h & TS_HASH(ht)->nTableMask;
-
- p = TS_HASH(ht)->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && ((p->nKeyLength == 0) || /* Numeric index */
- ((p->nKeyLength == nKeyLength) && (!memcmp(p->arKey, arKey, nKeyLength))))) {
- HANDLE_BLOCK_INTERRUPTIONS();
- if (p == TS_HASH(ht)->arBuckets[nIndex]) {
- TS_HASH(ht)->arBuckets[nIndex] = p->pNext;
- } else {
- p->pLast->pNext = p->pNext;
- }
- if (p->pNext) {
- p->pNext->pLast = p->pLast;
- }
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p->pListNext;
- } else {
- /* Deleting the head of the list */
- TS_HASH(ht)->pListHead = p->pListNext;
- }
- if (p->pListNext != NULL) {
- p->pListNext->pListLast = p->pListLast;
- } else {
- TS_HASH(ht)->pListTail = p->pListLast;
- }
- if (TS_HASH(ht)->pInternalPointer == p) {
- TS_HASH(ht)->pInternalPointer = p->pListNext;
- }
- if (!p->pDataPtr) {
- pefree(p->pData, TS_HASH(ht)->persistent);
- }
- pefree(p, TS_HASH(ht)->persistent);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- TS_HASH(ht)->nNumOfElements--;
- return SUCCESS;
- }
- p = p->pNext;
- }
- }
- tsrm_mutex_unlock(ht->mx_writer);
-
- return FAILURE;
-}
-
-#endif /* HASH_H */
diff --git a/ext/rpc/java/CREDITS b/ext/rpc/java/CREDITS
deleted file mode 100644
index f49489bcf8..0000000000
--- a/ext/rpc/java/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Java
-Sam Ruby
diff --git a/ext/rpc/java/EXPERIMENTAL b/ext/rpc/java/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/rpc/java/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/rpc/java/Makefile.frag b/ext/rpc/java/Makefile.frag
deleted file mode 100644
index 74c3ead1f0..0000000000
--- a/ext/rpc/java/Makefile.frag
+++ /dev/null
@@ -1,13 +0,0 @@
-
-$(srcdir)/java.c : $(srcdir)/php_java.jar
-
-$(srcdir)/php_java.jar : $(srcdir)/reflect.java
- @$(mkinstalldirs) $(srcdir)/net/php
- @cp $(srcdir)/reflect.java $(srcdir)/net/php
- @echo library=php_java > $(srcdir)/net/php/reflect.properties
- @$(JAVA_C) $(srcdir)/net/php/reflect.java
- @test ! -f reflect.class || mv reflect.class $(srcdir)/net/php # bug in KJC javac
- @$(JAVA_JAR) $(srcdir)/php_java.jar -C $(srcdir) net/php/reflect.class -C $(srcdir) net/php/reflect.properties
- @rm $(srcdir)/net/php/reflect.*
- @rmdir $(srcdir)/net/php
- @rmdir $(srcdir)/net
diff --git a/ext/rpc/java/README b/ext/rpc/java/README
deleted file mode 100644
index 571cb9ef76..0000000000
--- a/ext/rpc/java/README
+++ /dev/null
@@ -1,247 +0,0 @@
-What is PHP4 ext/java?
-
- PHP4 ext/java provides a simple and effective means for creating and
- invoking methods on Java objects from PHP. The JVM is created using JNI,
- and everything runs in-process.
-
- Two examples are provided, jver and jawt, to illustrate usage of this
- extension. A few things to note:
-
- 1) new Java() will create an instance of a class if a suitable constructor
- is available. If no parameters are passed and the default constructor
- is useful as it provides access to classes like "java.lang.System"
- which expose most of their functionallity through static methods.
-
- 2) Accessing a member of an instance will first look for bean properties
- then public fields. In other words, "print $date.time" will first
- attempt to be resolved as "$date.getTime()", then as "$date.time";
-
- 3) Both static and instance members can be accessed on an object with
- the same syntax. Furthermore, if the java object is of type
- "java.lang.Class", then static members of the class (fields and
- methods) can be accessed.
-
- 4) Exceptions raised result in PHP warnings, and null results. The
- warnings may be eliminated by prefixing the method call with an
- "@" sign. The following APIs may be used to retrieve and reset
- the last error:
-
- java_last_exception_get()
- java_last_exception_clear()
-
- 5) Overload resolution is in general a hard problem given the
- differences in types between the two languages. The PHP Java
- extension employs a simple, but fairly effective, metric for
- determining which overload is the best match.
-
- Additionally, method names in PHP are not case sensitive, potentially
- increasing the number of overloads to select from.
-
- Once a method is selected, the parameters are cooerced if necessary,
- possibly with a loss of data (example: double precision floating point
- numbers will be converted to boolean).
-
- 6) In the tradition of PHP, arrays and hashtables may pretty much
- be used interchangably. Note that hashtables in PHP may only be
- indexed by integers or strings; and that arrays of primitive types
- in Java can not be sparse. Also note that these constructs are
- passed by value, so may be expensive in terms of memory and time.
-
-Build and execution instructions:
-
- Given the number of platforms and providers of JVMs, no single set of
- instructions will be able to cover all cases. So in place of hard and
- fast instructions, below are a working examples for a number of free and
- commercial implementations and platforms. Please adjust the paths to
- suit your installation. Also, if you happen to get this to work on
- another JVM/platform combination, please let me know, particularly if
- a unique build or execution setup was required.
-
- Note for Windows users: semi-colons (";") mark the beginning of
- comments in php.ini files, so if you wish to add to the classpath,
- make sure that the entire string is in quotes. See the JDK 1.1.8
- instructions below for an example.
-
- This function has been tested in both CGI and Apache (apxs) modes. As
- the current design requires shared libraries, this support can not be
- linked statically into Apache.
-
- With ext/java, no Java Virtual Machines are created until the first
- Java call is made. This not only eliminates unnecessary overhead if
- the extension is never used, it also provides error messages directly
- back to the user instead of being burried in a log some place.
-
- For people interested in robustness, performance, and more complete
- integration with Java, consider using the sapi/servlet interface which
- is built upon the Java extension. Running PHP as a servlet enables PHP
- to utilize the existing JVM and threads from the servlet engine, and
- provides direct access to the servlet request and response objects.
-
- Finally, the bottom of this readme contains some guidance for how to
- approach situations in which these instructions don't work on your
- machine.
-
-========================================================================
-=== JVM=Kaffe 1.0.4 (as delivered with OS), OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.library.path=/usr/lib/kaffe:/home/rubys/php4/modules
- java.class.path=/usr/share/kaffe/Klasses.jar:/home/rubys/php4/modules/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=java.so
-
-========================================================================
-=== JVM=Kaffe 1.0.5 (built from source), OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.library.path=/usr/local/lib/kaffe:/home/rubys/php4/modules
- java.class.path=/usr/local/share/kaffe/Klasses.jar:/home/rubys/php4/modules/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=java.so
-
-========================================================================
-=== JVM=IBM 1.1.8, OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.class.path=/home/jdk118/lib/classes.zip:/home/rubys/php4/modules/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=java.so
-
-========================================================================
-=== JVM=Blackdown 1.2.2 RC4, OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.class.path=/home/rubys/php4/lib/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=java.so
-
-========================================================================
-=== JVM=Sun JDK 1.2.2, OS=Linux ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.class.path=/home/rubys/php4/lib/php_java.jar
- java.library.path=/home/rubys/php4/modules
- extension_dir=/home/rubys/php4/modules
- extension=java.so
-
-========================================================================
-=== JVM=Sun JDK 1.1.8, OS=Windows NT 4 ===
-========================================================================
-
-build instructions:
-
- SET JAVA_HOME=D:\jdk1.1.8
- msdev ext\java\java.dsp /MAKE "java - Win32 Debug_TS"
-
-php.ini:
-
- [java]
- java.class.path="D:\jdk1.1.8\lib\classes.zip;F:\PHP4\Debug_TS\php_java.jar"
- extension=php_java.dll
-
-========================================================================
-=== JVM=Sun JDK 1.2.2, OS=Windows NT 4 ===
-========================================================================
-
-build instructions:
-
- SET JAVA_HOME=D:\jdk1.2.2
- msdev ext\java\java.dsp /MAKE "java - Win32 Debug_TS"
-
-php.ini:
-
- [java]
- java.class.path=F:\PHP4\Debug_TS\php_java.jar
- extension=php_java.dll
-
-=========================================================================
-
-Guidance for when these instructions don't work.
-
- JDK vendors don't typically document their internal workings, and are
- typically very reliant on code inside of the JAVA main program and the
- installation directory structure. For this reason, running PHP as a
- servlet is typically much easier to get working. But if for some reason
- this is not appropriate for you, and the instructions above don't work,
- then read on.
-
- The first thing to realize is that the directory structure of the JDK is
- very important. Some users (particularly on Windows) get a message about
- a DLL or shared library not being available and proceed to find that file
- and copy it into a system directory. This typically just gets you to the
- next problem - for example, it appears that many JDKs attempt to locate
- the runtime Java classes (rt.jar) in a directory relative to these system
- libraries. So unless you are inclined to copy your entire Java
- installation, you are much better adjusting your PATHs.
-
- Not documented above, but useful for many JDK's is ability to specify the
- library path via java.library.path in the php.ini. On many Unix machines,
- determining the initial value for this can be done by changing directory
- to where you find a shared library that can't be loaded (example:
- libjava.so), and executing "ld libjava.so". If you see some modules
- listed as "not found", add the necessary directories to LD_LIBRARY_PATH
- and repeat until successful. On my system, I require the following
- two directories.
-
- /home/jdk1.2.2/jre/lib/i386/native_threads
- /home/jdk1.2.2/jre/lib/i386/classic
-
- Note: this only determines the statically loaded libraries. Additional
- libraries (such as libzip.so) may be loaded dynamically. On my system,
- libzip.so is located in
-
- /home/jdk1.2.2/jre/lib/i386
-
- Another php.ini variable which may be helpful is java.home.
-
- If java.library.path doesn't work for you (it won't on any JDK 1.1
- implementations, for example), then try setting the system PATH or the
- LD_LIBRARY_PATH before starting your web server. For Apache on Linux
- systems, this can be accomplished by editing the Root's .bashrc and
- adding the necessary export LD_LIBRARY_PATH statement.
-
- If that doesn't work, try dividing an (hopefully) conquering by temporarily
- eliminating items such as Apache from the process by adjusting the
- arguments passed to the ./configure command (i.e., removing --with-apxs).
-
- If all else fails, "man dlopen" on Unix systems will give more insight on
- what the system is trying to do internally.
-
- There have been some issues where users need to create a symbolic link
- from java.so to libphp_java.so. If you notice a large number of unexplained
- crashes in your webserver log file, try doing this.
diff --git a/ext/rpc/java/config.m4 b/ext/rpc/java/config.m4
deleted file mode 100644
index 5ee63d71ff..0000000000
--- a/ext/rpc/java/config.m4
+++ /dev/null
@@ -1,190 +0,0 @@
-dnl
-dnl $Id$
-dnl
-AC_DEFUN(JAVA_FIND_JAR, [
- AC_MSG_CHECKING([Java Jar location])
- if test "$PHP_JAVA" = "yes"; then
- if JAVA_JAR=`which jar 2>/dev/null`; then
- JAVA_JAR="$JAVA_JAR cf"
- else
- JAVA_JAR=
- fi
- PHP_JAVA=`cd \`dirname \\\`which javac\\\`\`/..;pwd`
-
- dnl
- dnl substitue zip for systems which don't have jar
- dnl
- if test -z "$JAVA_JAR"; then
- JAVA_JAR='zip -q0'
- fi
- else
- dnl
- dnl we have a custom path defined so use it
- dnl
- if test -x $PHP_JAVA/bin/jar; then
- JAVA_JAR="$PHP_JAVA/bin/jar cf"
- else
- AC_MSG_ERROR([Unable to locate $PHP_JAVA/bin])
- fi
- fi
- PHP_SUBST(JAVA_JAR)
- AC_MSG_RESULT([$JAVA_JAR])
-])
-
-AC_DEFUN(JAVA_FIND_C, [
- AC_MSG_CHECKING([Java C location])
- if test "$PHP_JAVA" = "yes"; then
- JAVA_C=`which javac`
- else
- dnl
- dnl We've been given a path to use, so use it
- dnl
- if test -x $PHP_JAVA/bin/javac; then
- JAVA_C=$PHP_JAVA/bin/javac
- else
- AC_MSG_ERROR([Unable to locate $PHP_JAVA/bin])
- fi
- fi
- if test -z "$JAVA_C"; then
- AC_MSG_ERROR([Unable to locate the javac binary in your system path
-Either adjust your Java installation or provide the Java installation path,
-e.g. --with-java=/java expecting /java/bin/ to contain the binaries])
- fi
-
- PHP_SUBST(JAVA_C)
- AC_MSG_RESULT([$JAVA_C])
-])
-
-AC_DEFUN(JAVA_CHECK_LIB, [
- AC_MSG_CHECKING([Checking for libjava])
- if test -d $PHP_JAVA/lib/kaffe; then
- PHP_ADD_LIBPATH($PHP_JAVA/lib)
- JAVA_CFLAGS=-DKAFFE
- JAVA_INCLUDE=-I$PHP_JAVA/include/kaffe
- JAVA_CLASSPATH=$PHP_JAVA/share/kaffe/Klasses.jar
- JAVA_LIB=kaffevm
- JAVA_LIBPATH=$PHP_JAVA/lib/kaffe
- java_libext=kaffevm
-
- test -f $PHP_JAVA/lib/$JAVA_LIB && JAVA_LIBPATH=$PHP_JAVA/lib
- test -f $PHP_JAVA/lib/kaffe/$JAVA_LIB && JAVA_LIBPATH=$PHP_JAVA/lib/kaffe
-
- dnl
- dnl accomodate old versions of kaffe which don't support jar
- dnl
- if kaffe -version 2>&1 | grep 1.0b > /dev/null; then
- JAVA_JAR='zip -q0'
- fi
- elif test -f $PHP_JAVA/lib/$java_libext; then
- JAVA_LIB=java
- JAVA_LIBPATH=$PHP_JAVA/lib
- JAVA_INCLUDE=-I$PHP_JAVA/include
-
- test -f $PHP_JAVA/lib/classes.zip && JAVA_CFLAGS=-DJNI_11
- test -f $PHP_JAVA/lib/jvm.jar && JAVA_CFLAGS=-DJNI_12
- test -f $PHP_JAVA/lib/classes.zip && JAVA_CLASSPATH=$PHP_JAVA/lib/classes.zip
- test -f $PHP_JAVA/lib/jvm.jar && JAVA_CLASSPATH=$PHP_JAVA/lib/jvm.jar
-
- for i in $PHP_JAVA/include/*; do
- test -f $i/jni_md.h && JAVA_INCLUDE="$JAVA_INCLUDE $i"
- done
- dnl
- dnl sample JDK v 1.4 path
- dnl /usr/java/j2sdk1.4.0_01/jre/lib/i386/libjava.so
- dnl
- else
- dnl
- dnl We have to find everything
- dnl
- for i in `find $PHP_JAVA/include -type d`; do
- test -f $i/jni.h && JAVA_INCLUDE="$JAVA_INCLUDE -I$i"
- test -f $i/jni_md.h && JAVA_INCLUDE="$JAVA_INCLUDE -I$i"
- done
-
- for i in `find $PHP_JAVA/ -type d`; do
- test -f $i/classes.zip && JAVA_CFLAGS=-DJNI_11
- test -f $i/rt.jar && JAVA_CFLAGS=-DJNI_12
- test -f $i/classes.zip && JAVA_CLASSPATH=$i/classes.zip
- test -f $i/rt.jar && JAVA_CLASSPATH=$i/rt.jar
-
- if test -f $i/$java_libext; then
- JAVA_LIB=java
- JAVA_LIBPATH=$i
-
- test -d $i/hotspot && PHP_ADD_LIBPATH($i/hotspot)
- test -d $i/classic && PHP_ADD_LIBPATH($i/classic)
- test -d $i/server && PHP_ADD_LIBPATH($i/server)
- test -d $i/native_threads && PHP_ADD_LIBPATH($i/native_threads)
- fi
- done
-
- if test -z "$JAVA_INCLUDE"; then
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(unable to find Java VM includes)
- fi
-
- JAVA_CFLAGS="$JAVA_CFLAGS -D_REENTRANT"
- fi
-
- AC_MSG_RESULT([$JAVA_LIBPATH])
-])
-
-
-PHP_ARG_WITH(java, for Java support,
-[ --with-java[=DIR] Include Java support. DIR is the JDK base install directory.
- This extension is always built as shared.])
-
-if test "$PHP_JAVA" != "no"; then
- platform=`uname -s 2>/dev/null`
- java_libext=libjava.so
- case $platform in
- AIX) java_libext=libjava.a ;;
- HP-UX) java_libext=libjava.sl ;;
- Darwin) java_libext=libjava.jnilib ;;
- esac
- JAVA_FIND_JAR()
- JAVA_FIND_C()
-
- if test "$platform" = "Darwin"; then
- AC_CHECK_HEADERS([JavaVM/JavaVM.h])
- AC_CHECK_HEADERS([JavaVM/jni.h])
- dnl JAVA_CLASSPATH=/System/Library/Frameworks/JavaVM.framework/Classes/classes.jar
- PHP_CHECK_FRAMEWORK("JavaVM", JNI_CreateJavaVM,[AC_DEFINE(HAVE_JAVA,1,[ ])])
- PHP_ADD_FRAMEWORK("JavaVM")
- JAVA_CFLAGS="-x objective-c"
- else
- JAVA_CHECK_LIB()
- AC_DEFINE(HAVE_JAVA,1,[ ])
-
- if test -z "$JAVA_LIBPATH"; then
- AC_MSG_ERROR([unable to find Java VM libraries in $PHP_JAVA])
- fi
-
- PHP_ADD_LIBPATH($JAVA_LIBPATH)
- JAVA_CFLAGS="$JAVA_CFLAGS '-DJAVALIB=\"$JAVA_LIBPATH/$java_libext\"'"
- fi
-
- if test "$PHP_SAPI" != "servlet"; then
- PHP_NEW_EXTENSION(java, java.c, shared,, $JAVA_CFLAGS $JAVA_INCLUDE)
-
- if test "$PHP_SAPI" = "cgi"; then
- if test "$platform" != "Darwin"; then
- PHP_ADD_LIBRARY($JAVA_LIB)
- fi
- fi
-
- if test -n "$INSTALL_IT"; then
- INSTALL_IT="$INSTALL_IT ;"
- fi
-
- INSTALL_IT="$INSTALL_IT \$(srcdir)/build/shtool mkdir -p -f -m 0755 \$(INSTALL_ROOT)\$(libdir)"
- INSTALL_IT="$INSTALL_IT ; \$(INSTALL) -m 0755 \$(srcdir)/ext/java/php_java.jar \$(INSTALL_ROOT)\$(libdir)"
- fi
-
- PHP_SUBST(JAVA_CLASSPATH)
- PHP_SUBST(JAVA_INCLUDE)
- PHP_SUBST(JAVA_CFLAGS)
-
- PHP_ADD_MAKEFILE_FRAGMENT
-fi
-
diff --git a/ext/rpc/java/except.php b/ext/rpc/java/except.php
deleted file mode 100644
index a7e6a79c08..0000000000
--- a/ext/rpc/java/except.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?
- $stack=new Java("java.util.Stack");
- $stack->push(1);
-
- #
- # Should succeed and print out "1"
- #
- $result = $stack->pop();
- $ex = java_last_exception_get();
- if (!$ex) print "$result\n";
-
- #
- # Should fail - note the "@" eliminates the warning
- #
- $result=@$stack->pop();
- $ex=java_last_exception_get();
- if ($ex) print $ex->toString();
-
- #
- # Reset last exception
- #
- java_last_exception_clear();
-?>
diff --git a/ext/rpc/java/java.c b/ext/rpc/java/java.c
deleted file mode 100644
index 3ddf457e41..0000000000
--- a/ext/rpc/java/java.c
+++ /dev/null
@@ -1,862 +0,0 @@
- /*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-
-/*
- * This module implements Zend OO syntax overloading support for Java
- * components using JNI and reflection.
- */
-
-#include "php.h"
-#include "zend_compile.h"
-#include "php_ini.h"
-#include "php_globals.h"
-
-#if HAVE_JAVAVM_JAVAVM_H
-#include <JavaVM/JavaVM.h>
-#include <JavaVM/jni.h>
-#define JNI_12
-#else
-#include <jni.h>
-#endif
-
-
-#ifdef PHP_WIN32
-#include "win32/winutil.h"
-#define DL_ERROR php_win_err
-#endif
-
-
-#include <stdio.h>
-
-#define IS_EXCEPTION 86
-
-/***************************************************************************/
-
-#ifndef KAFFE
-#ifndef JNI_11
-#ifndef JNI_12
-
-#ifdef JNI_VERSION_1_2
-#define JNI_12
-#else
-#define JNI_11
-#endif
-
-#endif
-#endif
-#endif
-
-#ifdef PHP_WIN32
-#ifdef JNI_12
-#define JAVALIB "jvm.dll"
-#else
-#define JAVALIB "javai.dll"
-#endif
-#else
-#endif
-
-/***************************************************************************/
-
-static int le_jobject = 0;
-
-static char *classpath = 0;
-static char *libpath = 0;
-static char *javahome = 0;
-static char *javalib = 0;
-
-static void *dl_handle = 0;
-
-/* {{{ ZEND_BEGIN_MODULE_GLOBALS
- */
-ZEND_BEGIN_MODULE_GLOBALS(java)
- JavaVM *jvm;
- JNIEnv *jenv;
- jobject php_reflect;
- jclass reflect_class;
-ZEND_END_MODULE_GLOBALS(java)
-/* }}} */
-
-#ifdef ZTS
-# define JG(v) TSRMG(java_globals_id, zend_java_globals *, v)
-#else
-# define JG(v) (java_globals.v)
-#endif
-
-ZEND_DECLARE_MODULE_GLOBALS(java)
-
-static zend_class_entry java_class_entry;
-
-static PHP_INI_MH(OnIniUpdate)
-{
- if (new_value) *(char**)mh_arg1 = new_value;
- return SUCCESS;
-}
-
-/* {{{ PHP_INI_BEGIN
- */
-PHP_INI_BEGIN()
- PHP_INI_ENTRY1("java.class.path", NULL, PHP_INI_SYSTEM, OnIniUpdate, &classpath)
-#ifndef JNI_11
- PHP_INI_ENTRY1("java.home", NULL, PHP_INI_SYSTEM, OnIniUpdate, &javahome)
- PHP_INI_ENTRY1("java.library.path", NULL, PHP_INI_SYSTEM,OnIniUpdate, &libpath)
-#endif
-#ifdef JAVALIB
- PHP_INI_ENTRY1("java.library", JAVALIB, PHP_INI_SYSTEM, OnIniUpdate, &javalib)
-#else
- PHP_INI_ENTRY1("java.library", NULL, PHP_INI_SYSTEM, OnIniUpdate, &javalib)
-#endif
-PHP_INI_END()
-/* }}} */
-
-/***************************************************************************/
-
-/* {{{ jvm_destroy
- */
-/*
- * Destroy a Java Virtual Machine.
- */
-void jvm_destroy(TSRMLS_D)
-{
- if (JG(php_reflect)) (*JG(jenv))->DeleteGlobalRef(JG(jenv), JG(php_reflect));
- JG(php_reflect) = 0;
-}
-/* }}} */
-
-/* {{{ addJVMOption
- */
-/*
- * Create a Java Virtual Machine.
- * - class.path, home, and library.path are read out of the INI file
- * - appropriate (pre 1.1, JDK 1.1, and JDK 1.2) initialization is performed
- * - net.php.reflect class file is located
- */
-
-#ifdef JNI_12
-static void addJVMOption(JavaVMInitArgs *vm_args, char *name, char *value)
-{
- char *option = (char*) malloc(strlen(name) + strlen(value) + 1);
- strcpy(option, name);
- strcat(option, value);
- vm_args->options[vm_args->nOptions++].optionString = option;
-}
-#endif
-/* }}} */
-
-/* {{{ jvm_create
- */
-static int jvm_create(TSRMLS_D)
-{
- int rc;
- jobject local_php_reflect;
- jthrowable error;
-
- jint (JNICALL *JNI_CreateVM)(const void*, const void*, void*);
-#ifndef JNI_12
- jint (JNICALL *JNI_DefaultArgs)(void*);
-#endif
-
-#ifdef JNI_11
- JDK1_1InitArgs vm_args;
-#else
- JavaVMInitArgs vm_args;
-#ifdef JNI_12
- JavaVMOption options[3];
-#endif
-#endif
-
-
- if (javalib) {
- dl_handle = DL_LOAD(javalib);
-
- if (!dl_handle) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to load Java Library %s, error: %s", javalib, DL_ERROR());
- return -1;
- }
- }
-
-#ifndef JAVALIB
- if (!dl_handle)
- JNI_CreateVM = &JNI_CreateJavaVM;
- else
-#endif
-
- JNI_CreateVM = (jint (JNICALL *)(const void*, const void*, void*))
- DL_FETCH_SYMBOL(dl_handle, "JNI_CreateJavaVM");
-
- if (!JNI_CreateVM) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to locate CreateJavaVM function");
- return -1;
- }
-
-#ifdef JNI_12
-
- vm_args.version = JNI_VERSION_1_2;
- vm_args.ignoreUnrecognized = JNI_FALSE;
- vm_args.options = options;
- vm_args.nOptions = 0;
-
- if (classpath) addJVMOption(&vm_args, "-Djava.class.path=", classpath);
- if (javahome) addJVMOption(&vm_args, "-Djava.home=", javahome);
- if (libpath) addJVMOption(&vm_args, "-Djava.library.path=", libpath);
-
-#else
-
-#ifndef JAVALIB
- if (!dl_handle)
- JNI_DefaultArgs = &JNI_GetDefaultJavaVMInitArgs;
- else
-#endif
-
- JNI_DefaultArgs = (jint (JNICALL *)(void*))
- DL_FETCH_SYMBOL(dl_handle, "JNI_GetDefaultJavaVMInitArgs");
-
- if (!JNI_DefaultArgs) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to locate GetDefaultJavaVMInitArgs function");
- return -1;
- }
-
- vm_args.version=0x00010001;
- (*JNI_DefaultArgs)(&vm_args);
-
- if (!classpath) classpath = "";
- vm_args.classpath = classpath;
-#ifdef KAFFE
- vm_args.classhome = javahome;
- vm_args.libraryhome = libpath;
-#endif
-
-#endif
-
- rc = (*JNI_CreateVM)(&JG(jvm), &JG(jenv), &vm_args);
-
- if (rc) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to create Java Virtual Machine");
- return rc;
- }
-
- JG(reflect_class) = (*JG(jenv))->FindClass(JG(jenv), "net/php/reflect");
- error = (*JG(jenv))->ExceptionOccurred(JG(jenv));
- if (error) {
- jclass errClass;
- jmethodID toString;
- jobject errString;
- const char *errAsUTF;
- jboolean isCopy;
- JNIEnv *jenv = JG(jenv);
- (*jenv)->ExceptionClear(jenv);
- errClass = (*jenv)->GetObjectClass(jenv, error);
- toString = (*jenv)->GetMethodID(jenv, errClass, "toString",
- "()Ljava/lang/String;");
- errString = (*jenv)->CallObjectMethod(jenv, error, toString);
- errAsUTF = (*jenv)->GetStringUTFChars(jenv, errString, &isCopy);
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "%s", errAsUTF);
- if (isCopy) (*jenv)->ReleaseStringUTFChars(jenv, error, errAsUTF);
- jvm_destroy(TSRMLS_C);
- return -1;
- }
-
- local_php_reflect = (*JG(jenv))->AllocObject(JG(jenv), JG(reflect_class));
- JG(php_reflect) = (*JG(jenv))->NewGlobalRef(JG(jenv), local_php_reflect);
- return rc;
-}
-/* }}} */
-
-/***************************************************************************/
-
-/* {{{ _java_makeObject
- */
-static jobject _java_makeObject(pval* arg TSRMLS_DC)
-{
- JNIEnv *jenv = JG(jenv);
- jobject result;
- pval **handle;
- int type;
- jmethodID makeArg;
- jclass hashClass;
-
- switch (Z_TYPE_P(arg)) {
- case IS_STRING:
- result=(*jenv)->NewByteArray(jenv, Z_STRLEN_P(arg));
- (*jenv)->SetByteArrayRegion(jenv, (jbyteArray)result, 0,
- Z_STRLEN_P(arg), Z_STRVAL_P(arg));
- break;
-
- case IS_OBJECT:
- zend_hash_index_find(Z_OBJPROP_P(arg), 0, (void*)&handle);
- result = zend_list_find(Z_LVAL_PP(handle), &type);
- break;
-
- case IS_BOOL:
- makeArg = (*jenv)->GetMethodID(jenv, JG(reflect_class), "MakeArg",
- "(Z)Ljava/lang/Object;");
- result = (*jenv)->CallObjectMethod(jenv, JG(php_reflect), makeArg,
- (jboolean)(Z_LVAL_P(arg)));
- break;
-
- case IS_LONG:
- makeArg = (*jenv)->GetMethodID(jenv, JG(reflect_class), "MakeArg",
- "(J)Ljava/lang/Object;");
- result = (*jenv)->CallObjectMethod(jenv, JG(php_reflect), makeArg,
- (jlong)(Z_LVAL_P(arg)));
- break;
-
- case IS_DOUBLE:
- makeArg = (*jenv)->GetMethodID(jenv, JG(reflect_class), "MakeArg",
- "(D)Ljava/lang/Object;");
- result = (*jenv)->CallObjectMethod(jenv, JG(php_reflect), makeArg,
- (jdouble)(Z_DVAL_P(arg)));
- break;
-
- case IS_ARRAY:
- {
- jobject jkey, jval;
- zval **value;
- zval key;
- char *string_key;
- ulong num_key;
- jobject jold;
- jmethodID put, init;
-
- hashClass = (*jenv)->FindClass(jenv, "java/util/Hashtable");
- init = (*jenv)->GetMethodID(jenv, hashClass, "<init>", "()V");
- result = (*jenv)->NewObject(jenv, hashClass, init);
-
- put = (*jenv)->GetMethodID(jenv, hashClass, "put",
- "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
-
- /* Iterate through hash */
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(arg));
- while(zend_hash_get_current_data(Z_ARRVAL_P(arg), (void**)&value) == SUCCESS) {
- jval = _java_makeObject(*value TSRMLS_CC);
-
- switch (zend_hash_get_current_key(Z_ARRVAL_P(arg), &string_key, &num_key, 0)) {
- case HASH_KEY_IS_STRING:
- Z_TYPE(key) = IS_STRING;
- Z_STRVAL(key) = string_key;
- Z_STRLEN(key) = strlen(string_key);
- jkey = _java_makeObject(&key TSRMLS_CC);
- break;
- case HASH_KEY_IS_LONG:
- Z_TYPE(key) = IS_LONG;
- Z_LVAL(key) = num_key;
- jkey = _java_makeObject(&key TSRMLS_CC);
- break;
- default: /* HASH_KEY_NON_EXISTANT */
- jkey = 0;
- }
- jold = (*jenv)->CallObjectMethod(jenv, result, put, jkey, jval);
- if (Z_TYPE_PP(value) != IS_OBJECT) (*jenv)->DeleteLocalRef(jenv, jval);
- zend_hash_move_forward(Z_ARRVAL_P(arg));
- }
-
- break;
- }
-
- default:
- result=0;
- }
-
- return result;
-}
-/* }}} */
-
-/***************************************************************************/
-
-/* {{{ _java_makeArray
- */
-static jobjectArray _java_makeArray(int argc, pval** argv TSRMLS_DC)
-{
- JNIEnv *jenv = JG(jenv);
-
- jclass objectClass = (*jenv)->FindClass(jenv, "java/lang/Object");
- jobjectArray result = (*jenv)->NewObjectArray(jenv, argc, objectClass, 0);
- jobject arg;
- int i;
-
- for (i=0; i<argc; i++) {
- arg = _java_makeObject(argv[i] TSRMLS_CC);
- (*jenv)->SetObjectArrayElement(jenv, result, i, arg);
- if (Z_TYPE_P(argv[i]) != IS_OBJECT) (*jenv)->DeleteLocalRef(jenv, arg);
- }
- return result;
-}
-/* }}} */
-
-/* {{{ checkError
- */
-static int checkError(pval *value TSRMLS_DC)
-{
- if (Z_TYPE_P(value) == IS_EXCEPTION) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", Z_STRVAL_P(value));
- efree(Z_STRVAL_P(value));
- ZVAL_FALSE(value);
- return 1;
- };
- return 0;
-}
-/* }}} */
-
-/***************************************************************************/
-
-/* {{{ java_call_function_handler
- */
-/*
- * Invoke a method on an object. If method name is "java", create a new
- * object instead.
- */
-void java_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- JNIEnv *jenv;
-
- pval *object = property_reference->object;
- zend_overloaded_element *function_name = (zend_overloaded_element *)
- property_reference->elements_list->tail->data;
-
- int arg_count = ZEND_NUM_ARGS();
- jlong result = 0;
- zval ***arguments = (zval ***) emalloc(sizeof(zval *)*arg_count);
-
- zend_get_parameters_array_ex(arg_count, arguments);
-
- if (!JG(jenv)) jvm_create(TSRMLS_C);
- if (!JG(jenv)) return;
- jenv = JG(jenv);
-
- if (!strcmp("java", Z_STRVAL(function_name->element))) {
-
- /* construct a Java object:
- First argument is the class name. Any additional arguments will
- be treated as constructor parameters. */
-
- jmethodID co = (*jenv)->GetMethodID(jenv, JG(reflect_class), "CreateObject",
- "(Ljava/lang/String;[Ljava/lang/Object;J)V");
- jstring className;
- result = (jlong)(long)object;
-
- if (ZEND_NUM_ARGS() < 1) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Missing classname in new Java() call");
- return;
- }
-
- className=(*jenv)->NewStringUTF(jenv, Z_STRVAL_PP(arguments[0]));
- (*jenv)->CallVoidMethod(jenv, JG(php_reflect), co,
- className, _java_makeArray(arg_count-1, *(arguments+1) TSRMLS_CC), result);
-
- (*jenv)->DeleteLocalRef(jenv, className);
-
- } else {
-
- pval **handle;
- int type;
- jobject obj;
- jstring method;
-
- /* invoke a method on the given object */
-
- jmethodID invoke = (*jenv)->GetMethodID(jenv, JG(reflect_class), "Invoke",
- "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;J)V");
- zend_hash_index_find(Z_OBJPROP_P(object), 0, (void**) &handle);
- obj = zend_list_find(Z_LVAL_PP(handle), &type);
- method = (*jenv)->NewStringUTF(jenv, Z_STRVAL(function_name->element));
- result = (jlong)(long)return_value;
-
- (*jenv)->CallVoidMethod(jenv, JG(php_reflect), invoke,
- obj, method, _java_makeArray(arg_count, *arguments TSRMLS_CC), result);
-
- (*jenv)->DeleteLocalRef(jenv, method);
-
- }
-
- efree(arguments);
- pval_destructor(&function_name->element);
-
- checkError((pval*)(long)result TSRMLS_CC);
-}
-/* }}} */
-
-/***************************************************************************/
-
-/* {{{ proto object java_last_exception_get(void)
- Get last Java exception */
-PHP_FUNCTION(java_last_exception_get)
-{
- jlong result = 0;
- jmethodID lastEx;
-
- if (ZEND_NUM_ARGS()!=0) WRONG_PARAM_COUNT;
-
- result = (jlong)(long)return_value;
-
- lastEx = (*JG(jenv))->GetMethodID(JG(jenv), JG(reflect_class),
- "lastException", "(J)V");
-
- (*JG(jenv))->CallVoidMethod(JG(jenv), JG(php_reflect), lastEx, result);
-}
-
-/* }}} */
-
-/***************************************************************************/
-
-/* {{{ proto void java_last_exception_clear(void)
- Clear last java extension */
-PHP_FUNCTION(java_last_exception_clear)
-{
- jlong result = 0;
- jmethodID clearEx;
-
- if (ZEND_NUM_ARGS()!=0) WRONG_PARAM_COUNT;
-
- result = (jlong)(long)return_value;
-
- clearEx = (*JG(jenv))->GetMethodID(JG(jenv), JG(reflect_class),
- "clearException", "()V");
-
- (*JG(jenv))->CallVoidMethod(JG(jenv), JG(php_reflect), clearEx);
-}
-
-/* }}} */
-
-/***************************************************************************/
-
-/* {{{ _java_getset_property
- */
-static pval _java_getset_property
- (zend_property_reference *property_reference, jobjectArray value TSRMLS_DC)
-{
- pval presult;
- jlong result = 0;
- pval **pobject;
- jobject obj;
- int type;
-
- /* get the property name */
- zend_llist_element *element = property_reference->elements_list->head;
- zend_overloaded_element *property=(zend_overloaded_element *)element->data;
- jstring propName;
-
- JNIEnv *jenv;
- jenv = JG(jenv);
-
- propName = (*jenv)->NewStringUTF(jenv, Z_STRVAL(property->element));
-
- /* get the object */
- zend_hash_index_find(Z_OBJPROP_P(property_reference->object),
- 0, (void **) &pobject);
- obj = zend_list_find(Z_LVAL_PP(pobject), &type);
- result = (jlong)(long) &presult;
- Z_TYPE(presult) = IS_NULL;
-
- if (!obj || (type!=le_jobject)) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Attempt to access a Java property on a non-Java object");
- } else {
- /* invoke the method */
- jmethodID gsp = (*jenv)->GetMethodID(jenv, JG(reflect_class), "GetSetProp",
- "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;J)V");
- (*jenv)->CallVoidMethod
- (jenv, JG(php_reflect), gsp, obj, propName, value, result);
- }
-
- (*jenv)->DeleteLocalRef(jenv, propName);
- pval_destructor(&property->element);
- return presult;
-}
-/* }}} */
-
-/* {{{ java_get_property_handler
- */
-pval java_get_property_handler(zend_property_reference *property_reference)
-{
- pval presult;
- TSRMLS_FETCH();
-
- presult = _java_getset_property(property_reference, 0 TSRMLS_CC);
- checkError(&presult TSRMLS_CC);
- return presult;
-}
-/* }}} */
-
-/* {{{ java_set_property_handler
- */
-int java_set_property_handler(zend_property_reference *property_reference, pval *value)
-{
- pval presult;
- TSRMLS_FETCH();
-
- presult = _java_getset_property(property_reference, _java_makeArray(1, &value TSRMLS_CC) TSRMLS_CC);
- return checkError(&presult TSRMLS_CC) ? FAILURE : SUCCESS;
-}
-/* }}} */
-
-/***************************************************************************/
-
-/* {{{ _php_java_destructor
- */
-static void _php_java_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- void *jobject = (void *)rsrc->ptr;
-
- if (JG(jenv)) (*JG(jenv))->DeleteGlobalRef(JG(jenv), jobject);
-}
-/* }}} */
-
-/* {{{ alloc_java_globals_ctor
- */
-static void alloc_java_globals_ctor(zend_java_globals *java_globals TSRMLS_DC)
-{
- memset(java_globals, 0, sizeof(zend_java_globals));
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(java)
-{
- INIT_OVERLOADED_CLASS_ENTRY(java_class_entry, "java", NULL,
- java_call_function_handler,
- java_get_property_handler,
- java_set_property_handler);
-
- zend_register_internal_class(&java_class_entry TSRMLS_CC);
-
- le_jobject = zend_register_list_destructors_ex(_php_java_destructor, NULL, "java", module_number);
-
- REGISTER_INI_ENTRIES();
-
- if (!classpath) classpath = getenv("CLASSPATH");
-
- if (!libpath) {
- libpath=PG(extension_dir);
- }
-
- ZEND_INIT_MODULE_GLOBALS(java, alloc_java_globals_ctor, NULL);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(java)
-{
- UNREGISTER_INI_ENTRIES();
- if (JG(jvm)) jvm_destroy(TSRMLS_C);
- return SUCCESS;
-}
-/* }}} */
-
-function_entry java_functions[] = {
- PHP_FE(java_last_exception_get, NULL)
- PHP_FE(java_last_exception_clear, NULL)
- {NULL, NULL, NULL}
-};
-
-
-static PHP_MINFO_FUNCTION(java) {
- DISPLAY_INI_ENTRIES();
-}
-
-zend_module_entry java_module_entry = {
- STANDARD_MODULE_HEADER,
- "java",
- java_functions,
- PHP_MINIT(java),
- PHP_MSHUTDOWN(java),
- NULL,
- NULL,
- PHP_MINFO(java),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-ZEND_GET_MODULE(java)
-
-/***************************************************************************/
-
-/* {{{ Java_net_php_reflect_setResultFromString
- */
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromString
- (JNIEnv *jenv, jclass self, jlong result, jbyteArray jvalue)
-{
- jboolean isCopy;
- jbyte *value = (*jenv)->GetByteArrayElements(jenv, jvalue, &isCopy);
- pval *presult = (pval*)(long)result;
- Z_TYPE_P(presult)=IS_STRING;
- Z_STRLEN_P(presult)=(*jenv)->GetArrayLength(jenv, jvalue);
- Z_STRVAL_P(presult)=emalloc(Z_STRLEN_P(presult)+1);
- memcpy(Z_STRVAL_P(presult), value, Z_STRLEN_P(presult));
- Z_STRVAL_P(presult)[Z_STRLEN_P(presult)]=0;
- if (isCopy) (*jenv)->ReleaseByteArrayElements(jenv, jvalue, value, 0);
-}
-/* }}} */
-
-/* {{{ Java_net_php_reflect_setResultFromLong
- */
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromLong
- (JNIEnv *jenv, jclass self, jlong result, jlong value)
-{
- pval *presult = (pval*)(long)result;
- Z_TYPE_P(presult)=IS_LONG;
- Z_LVAL_P(presult)=(long)value;
-}
-/* }}} */
-
-/* {{{ Java_net_php_reflect_setResultFromDouble
- */
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromDouble
- (JNIEnv *jenv, jclass self, jlong result, jdouble value)
-{
- pval *presult = (pval*)(long)result;
- Z_TYPE_P(presult)=IS_DOUBLE;
- Z_DVAL_P(presult)=value;
-}
-/* }}} */
-
-/* {{{ Java_net_php_reflect_setResultFromBoolean
- */
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromBoolean
- (JNIEnv *jenv, jclass self, jlong result, jboolean value)
-{
- pval *presult = (pval*)(long)result;
- Z_TYPE_P(presult)=IS_BOOL;
- Z_LVAL_P(presult)=value;
-}
-/* }}} */
-
-/* {{{ Java_net_php_reflect_setResultFromObject
- */
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromObject
- (JNIEnv *jenv, jclass self, jlong result, jobject value)
-{
- /* wrapper the java object in a pval object */
- pval *presult = (pval*)(long)result;
- pval *handle;
- TSRMLS_FETCH();
-
- if (Z_TYPE_P(presult) != IS_OBJECT) {
- object_init_ex(presult, &java_class_entry);
- presult->is_ref=1;
- presult->refcount=1;
- }
-
- ALLOC_ZVAL(handle);
- Z_TYPE_P(handle) = IS_LONG;
- Z_LVAL_P(handle) =
- zend_list_insert((*jenv)->NewGlobalRef(jenv, value), le_jobject);
- pval_copy_constructor(handle);
- INIT_PZVAL(handle);
- zend_hash_index_update(Z_OBJPROP_P(presult), 0, &handle, sizeof(pval *), NULL);
-}
-/* }}} */
-
-/* {{{ Java_net_php_reflect_setResultFromArray
- */
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromArray
- (JNIEnv *jenv, jclass self, jlong result)
-{
- array_init( (pval*)(long)result );
-}
-/* }}} */
-
-/* {{{ Java_net_php_reflect_nextElement
- */
-JNIEXPORT jlong JNICALL Java_net_php_reflect_nextElement
- (JNIEnv *jenv, jclass self, jlong array)
-{
- pval *result;
- pval *handle = (pval*)(long)array;
- ALLOC_ZVAL(result);
- zend_hash_next_index_insert(Z_ARRVAL_P(handle), &result, sizeof(zval *), NULL);
- return (jlong)(long)result;
-}
-/* }}} */
-
-/* {{{ Java_net_php_reflect_hashIndexUpdate
- */
-JNIEXPORT jlong JNICALL Java_net_php_reflect_hashIndexUpdate
- (JNIEnv *jenv, jclass self, jlong array, jlong key)
-{
- pval *result;
- pval *handle = (pval*)(long)array;
- ALLOC_ZVAL(result);
- zend_hash_index_update(Z_ARRVAL_P(handle), (unsigned long)key,
- &result, sizeof(zval *), NULL);
- return (jlong)(long)result;
-}
-/* }}} */
-
-/* {{{ Java_net_php_reflect_hashUpdate
- */
-JNIEXPORT jlong JNICALL Java_net_php_reflect_hashUpdate
- (JNIEnv *jenv, jclass self, jlong array, jbyteArray key)
-{
- pval *result;
- pval pkey;
- pval *handle = (pval*)(long)array;
- ALLOC_ZVAL(result);
- Java_net_php_reflect_setResultFromString(jenv, self, (jlong)(long)&pkey, key);
- zend_hash_update(Z_ARRVAL_P(handle), Z_STRVAL(pkey), Z_STRLEN(pkey)+1,
- &result, sizeof(zval *), NULL);
- return (jlong)(long)result;
-}
-/* }}} */
-
-/* {{{ Java_net_php_reflect_setException
- */
-JNIEXPORT void JNICALL Java_net_php_reflect_setException
- (JNIEnv *jenv, jclass self, jlong result, jbyteArray value)
-{
- pval *presult = (pval*)(long)result;
- Java_net_php_reflect_setResultFromString(jenv, self, result, value);
- Z_TYPE_P(presult)=IS_EXCEPTION;
-}
-/* }}} */
-
-/* {{{ Java_net_php_reflect_setEnv
- */
-JNIEXPORT void JNICALL Java_net_php_reflect_setEnv
- (JNIEnv *newJenv, jclass self TSRMLS_DC)
-{
- jobject local_php_reflect;
-
- JG(jenv)=newJenv;
-
- if (!self) self = (*JG(jenv))->FindClass(JG(jenv), "net/php/reflect");
- JG(reflect_class) = self;
-
- if (JG(php_reflect)) (*JG(jenv))->DeleteGlobalRef(JG(jenv), JG(php_reflect));
- local_php_reflect = (*JG(jenv))->AllocObject(JG(jenv), JG(reflect_class));
- JG(php_reflect) = (*JG(jenv))->NewGlobalRef(JG(jenv), local_php_reflect);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/rpc/java/java.dsp b/ext/rpc/java/java.dsp
deleted file mode 100644
index a7e353f253..0000000000
--- a/ext/rpc/java/java.dsp
+++ /dev/null
@@ -1,254 +0,0 @@
-# Microsoft Developer Studio Project File - Name="java" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=java - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "java.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "java.mak" CFG="java - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "java - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "java - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "java - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "java - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "java - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\..\Release"
-# PROP BASE Intermediate_Dir "..\..\..\Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\..\Release"
-# PROP Intermediate_Dir "..\..\..\Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\..\Release/php_rpc_java.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\..\Release"
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\..\Debug"
-# PROP BASE Intermediate_Dir "..\..\..\Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\..\Debug"
-# PROP Intermediate_Dir "..\..\..\Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\Debug/php_rpc_java.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\..\Debug"
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\..\Debug_TS"
-# PROP BASE Intermediate_Dir "..\..\..\Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\..\Debug_TS"
-# PROP Intermediate_Dir "..\..\..\Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\.." /I "..\..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\..\bindlib_w32" /D "_DEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /I "..\..\..\main" /I "..\..\..\TSRM" /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\Debug_TS/php_rpc_java.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "java - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\..\Release_TS"
-# PROP BASE Intermediate_Dir "..\..\..\Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\..\Release_TS"
-# PROP Intermediate_Dir "..\..\..\Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\..\.." /I "..\..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\..\bindlib_w32" /D "NDEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\\" /I "..\..\..\main" /I "..\..\..\TSRM" /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\..\Release_TS/php_rpc_java.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\..\Release_TS" /libpath:"..\..\..\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "java - Win32 Release"
-# Name "java - Win32 Debug"
-# Name "java - Win32 Debug_TS"
-# Name "java - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\java.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_java.h
-# End Source File
-# End Group
-# Begin Group "Java Files"
-
-# PROP Default_Filter "java"
-# Begin Source File
-
-SOURCE=.\reflect.java
-
-!IF "$(CFG)" == "java - Win32 Release"
-
-# Begin Custom Build
-OutDir=.\..\..\..\Release
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug"
-
-# Begin Custom Build
-OutDir=.\..\..\..\Debug
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac -g net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug_TS"
-
-# Begin Custom Build
-OutDir=.\..\..\..\Debug_TS
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac -g net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "java - Win32 Release_TS"
-
-# Begin Custom Build
-OutDir=.\..\..\..\Release_TS
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\jtest.php
-# End Source File
-# End Target
-# End Project
diff --git a/ext/rpc/java/jawt.php b/ext/rpc/java/jawt.php
deleted file mode 100644
index 30f2235611..0000000000
--- a/ext/rpc/java/jawt.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?
-
- // This example is only intented to be run as a CGI.
-
- $frame = new Java("java.awt.Frame", "Zend");
- $button = new Java("java.awt.Button", "Hello Java world!");
- $frame->add("North", $button);
- $frame->validate();
- $frame->pack();
- $frame->visible = True;
-
- $thread = new Java("java.lang.Thread");
- $thread->sleep(10000);
-
- $frame->dispose();
-
- // Odd behavior noted with Sun JVMs:
- //
- // 1) $thread->destroy() will fail with a NoSuchMethodError exception.
- // 2) The call to (*jvm)->DestroyJVM(jvm) made when PHP terminates
- // will hang, unless _BOTH_ the calls to pack and setVisible above
- // are removed.
- //
- // Even more odd: both effects are seen with a 100% Java implementation
- // of the above!
-
-?>
diff --git a/ext/rpc/java/jver.php b/ext/rpc/java/jver.php
deleted file mode 100644
index 7015944101..0000000000
--- a/ext/rpc/java/jver.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<html>
-<?
-
- $system = new Java("java.lang.System");
- print "Java version=".$system->getProperty("java.version")." <br>\n";
- print "Java vendor=".$system->getProperty("java.vendor")." <p>\n\n";
- print "OS=".$system->getProperty("os.name")." ".
- $system->getProperty("os.version")." on ".
- $system->getProperty("os.arch")." <br>\n";
-
- $formatter = new Java("java.text.SimpleDateFormat",
- "EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz");
-
- print $formatter->format(new Java("java.util.Date"))."\n";
-
-?>
-</html>
diff --git a/ext/rpc/java/reflect.java b/ext/rpc/java/reflect.java
deleted file mode 100644
index a9a7983ed2..0000000000
--- a/ext/rpc/java/reflect.java
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2002 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-package net.php;
-
-import java.lang.reflect.*;
-import java.util.*;
-import java.beans.*;
-
-public class reflect {
-
- static { loadLibrary("reflect"); }
-
- protected static void loadLibrary(String property) {
- try {
- ResourceBundle bundle = ResourceBundle.getBundle("net.php."+property);
- System.loadLibrary(bundle.getString("library"));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- //
- // Native methods
- //
- private static native void setResultFromString(long result, byte value[]);
- private static native void setResultFromLong(long result, long value);
- private static native void setResultFromDouble(long result, double value);
- private static native void setResultFromBoolean(long result, boolean value);
- private static native void setResultFromObject(long result, Object value);
- private static native void setResultFromArray(long result);
- private static native long nextElement(long array);
- private static native long hashUpdate(long array, byte key[]);
- private static native long hashIndexUpdate(long array, long key);
- private static native void setException(long result, byte value[]);
- public static native void setEnv();
-
- //
- // Helper routines which encapsulate the native methods
- //
- public static void setResult(long result, Object value) {
- if (value == null) return;
-
- if (value instanceof java.lang.String) {
-
- setResultFromString(result, ((String)value).getBytes());
-
- } else if (value instanceof java.lang.Number) {
-
- if (value instanceof java.lang.Integer ||
- value instanceof java.lang.Short ||
- value instanceof java.lang.Byte) {
- setResultFromLong(result, ((Number)value).longValue());
- } else {
- /* Float, Double, BigDecimal, BigInteger, Double, Long, ... */
- setResultFromDouble(result, ((Number)value).doubleValue());
- }
-
- } else if (value instanceof java.lang.Boolean) {
-
- setResultFromBoolean(result, ((Boolean)value).booleanValue());
-
- } else if (value.getClass().isArray()) {
-
- long length = Array.getLength(value);
- setResultFromArray(result);
- for (int i=0; i<length; i++) {
- setResult(nextElement(result), Array.get(value, i));
- }
-
- } else if (value instanceof java.util.Hashtable) {
-
- Hashtable ht = (Hashtable) value;
- setResultFromArray(result);
- for (Enumeration e = ht.keys(); e.hasMoreElements(); ) {
- Object key = e.nextElement();
- long slot;
- if (key instanceof Number &&
- !(key instanceof Double || key instanceof Float))
- slot = hashIndexUpdate(result, ((Number)key).longValue());
- else
- slot = hashUpdate(result, key.toString().getBytes());
- setResult(slot, ht.get(key));
- }
-
- } else {
-
- setResultFromObject(result, value);
-
- }
- }
-
- Throwable lastException = null;
-
- void lastException(long result) {
- setResult(result, lastException);
- }
-
- void clearException() {
- lastException = null;
- }
-
- void setException(long result, Throwable e) {
- if (e instanceof InvocationTargetException) {
- Throwable t = ((InvocationTargetException)e).getTargetException();
- if (t!=null) e=t;
- }
-
- lastException = e;
- setException(result, e.toString().getBytes());
- }
-
- //
- // Create an new instance of a given class
- //
- public void CreateObject(String name, Object args[], long result) {
- try {
- Vector matches = new Vector();
-
- Constructor cons[] = Class.forName(name).getConstructors();
- for (int i=0; i<cons.length; i++) {
- if (cons[i].getParameterTypes().length == args.length) {
- matches.addElement(cons[i]);
- }
- }
-
- Constructor selected = (Constructor)select(matches, args);
-
- if (selected == null) {
- if (args.length > 0) {
- throw new InstantiationException("No matching constructor found");
- } else {
- // for classes which have no visible constructor, return the class
- // useful for classes like java.lang.System and java.util.Calendar.
- setResult(result, Class.forName(name));
- return;
- }
- }
-
- Object coercedArgs[] = coerce(selected.getParameterTypes(), args);
- setResultFromObject(result, selected.newInstance(coercedArgs));
-
- } catch (Exception e) {
- setException(result, e);
- }
- }
-
- //
- // Select the best match from a list of methods
- //
- private static Object select(Vector methods, Object args[]) {
- if (methods.size() == 1) return methods.firstElement();
-
- Object selected = null;
- int best = Integer.MAX_VALUE;
-
- for (Enumeration e = methods.elements(); e.hasMoreElements(); ) {
- Object element = e.nextElement();
- int weight=0;
-
- Class parms[] = (element instanceof Method) ?
- ((Method)element).getParameterTypes() :
- ((Constructor)element).getParameterTypes();
-
- for (int i=0; i<parms.length; i++) {
- if (parms[i].isInstance(args[i])) {
- for (Class c=parms[i]; (c=c.getSuperclass()) != null; ) {
- if (!c.isInstance(args[i])) break;
- weight++;
- }
- } else if (parms[i].isAssignableFrom(java.lang.String.class)) {
- if (!(args[i] instanceof byte[]) && !(args[i] instanceof String))
- weight+=9999;
- } else if (parms[i].isArray()) {
- if (args[i] instanceof java.util.Hashtable)
- weight+=256;
- else
- weight+=9999;
- } else if (parms[i].isPrimitive()) {
- Class c=parms[i];
- if (args[i] instanceof Number) {
- if (c==Boolean.TYPE) weight+=5;
- if (c==Character.TYPE) weight+=4;
- if (c==Byte.TYPE) weight+=3;
- if (c==Short.TYPE) weight+=2;
- if (c==Integer.TYPE) weight++;
- if (c==Float.TYPE) weight++;
- } else if (args[i] instanceof Boolean) {
- if (c!=Boolean.TYPE) weight+=9999;
- } else if (args[i] instanceof String) {
- if (c== Character.TYPE || ((String)args[i]).length()>0)
- weight+=((String)args[i]).length();
- else
- weight+=64;
- } else {
- weight+=9999;
- }
- } else {
- weight+=9999;
- }
- }
-
- if (weight < best) {
- if (weight == 0) return element;
- best = weight;
- selected = element;
- }
- }
-
- return selected;
- }
-
- //
- // Coerce arguments when possible to conform to the argument list.
- // Java's reflection will automatically do widening conversions,
- // unfortunately PHP only supports wide formats, so to be practical
- // some (possibly lossy) conversions are required.
- //
- private static Object[] coerce(Class parms[], Object args[]) {
- Object result[] = args;
- for (int i=0; i<args.length; i++) {
- if (args[i] instanceof byte[] && !parms[i].isArray()) {
- Class c = parms[i];
- String s = new String((byte[])args[i]);
- result[i] = s;
- try {
- if (c == Boolean.TYPE) result[i]=new Boolean(s);
- if (c == Byte.TYPE) result[i]=new Byte(s);
- if (c == Short.TYPE) result[i]=new Short(s);
- if (c == Integer.TYPE) result[i]=new Integer(s);
- if (c == Float.TYPE) result[i]=new Float(s);
- if (c == Long.TYPE) result[i]=new Long(s);
- if (c == Character.TYPE && s.length()>0)
- result[i]=new Character(s.charAt(0));
- } catch (NumberFormatException n) {
- // oh well, we tried!
- }
- } else if (args[i] instanceof Number && parms[i].isPrimitive()) {
- if (result==args) result=(Object[])result.clone();
- Class c = parms[i];
- Number n = (Number)args[i];
- if (c == Boolean.TYPE) result[i]=new Boolean(0.0!=n.floatValue());
- if (c == Byte.TYPE) result[i]=new Byte(n.byteValue());
- if (c == Short.TYPE) result[i]=new Short(n.shortValue());
- if (c == Integer.TYPE) result[i]=new Integer(n.intValue());
- if (c == Float.TYPE) result[i]=new Float(n.floatValue());
- if (c == Long.TYPE && !(n instanceof Long))
- result[i]=new Long(n.longValue());
- } else if (args[i] instanceof Hashtable && parms[i].isArray()) {
- try {
- Hashtable ht = (Hashtable)args[i];
- int size = ht.size();
-
- // Verify that the keys are Long, and determine maximum
- for (Enumeration e = ht.keys(); e.hasMoreElements(); ) {
- int index = ((Long)e.nextElement()).intValue();
- if (index >= size) size = index+1;
- }
-
- Object tempArray[] = new Object[size];
- Class tempTarget[] = new Class[size];
- Class targetType = parms[i].getComponentType();
-
- // flatten the hash table into an array
- for (int j=0; j<size; j++) {
- tempArray[j] = ht.get(new Long(j));
- if (tempArray[j] == null && targetType.isPrimitive())
- throw new Exception("bail");
- tempTarget[j] = targetType;
- }
-
- // coerce individual elements into the target type
- Object coercedArray[] = coerce(tempTarget, tempArray);
-
- // copy the results into the desired array type
- Object array = Array.newInstance(targetType,size);
- for (int j=0; j<size; j++) {
- Array.set(array, j, coercedArray[j]);
- }
-
- result[i]=array;
- } catch (Exception e) {
- // leave result[i] alone...
- }
- }
- }
- return result;
- }
-
- //
- // Invoke a method on a given object
- //
- public void Invoke
- (Object object, String method, Object args[], long result)
- {
- try {
- Vector matches = new Vector();
-
- // gather
- for (Class jclass = object.getClass();;jclass=(Class)object) {
- while (!Modifier.isPublic(jclass.getModifiers())) {
- // OK, some joker gave us an instance of a non-public class
- // This often occurs in the case of enumerators
- // Substitute the first public interface in its place,
- // and barring that, try the superclass
- Class interfaces[] = jclass.getInterfaces();
- jclass=jclass.getSuperclass();
- for (int i=interfaces.length; i-->0;) {
- if (Modifier.isPublic(interfaces[i].getModifiers())) {
- jclass=interfaces[i];
- }
- }
- }
- Method methods[] = jclass.getMethods();
- for (int i=0; i<methods.length; i++) {
- if (methods[i].getName().equalsIgnoreCase(method) &&
- methods[i].getParameterTypes().length == args.length) {
- matches.addElement(methods[i]);
- }
- }
-
- // try a second time with the object itself, if it is of type Class
- if (!(object instanceof Class) || (jclass==object)) break;
- }
-
- Method selected = (Method)select(matches, args);
- if (selected == null) throw new NoSuchMethodException(method);
-
- Object coercedArgs[] = coerce(selected.getParameterTypes(), args);
- setResult(result, selected.invoke(object, coercedArgs));
-
- } catch (Exception e) {
- setException(result, e);
- }
- }
-
- //
- // Get or Set a property
- //
- public void GetSetProp
- (Object object, String prop, Object args[], long result)
- {
- try {
-
- for (Class jclass = object.getClass();;jclass=(Class)object) {
- while (!Modifier.isPublic(jclass.getModifiers())) {
- // OK, some joker gave us an instance of a non-public class
- // Substitute the first public interface in its place,
- // and barring that, try the superclass
- Class interfaces[] = jclass.getInterfaces();
- jclass=jclass.getSuperclass();
- for (int i=interfaces.length; i-->0;) {
- if (Modifier.isPublic(interfaces[i].getModifiers())) {
- jclass=interfaces[i];
- }
- }
- }
- BeanInfo beanInfo = Introspector.getBeanInfo(jclass);
- PropertyDescriptor props[] = beanInfo.getPropertyDescriptors();
- for (int i=0; i<props.length; i++) {
- if (props[i].getName().equalsIgnoreCase(prop)) {
- Method method;
- if (args!=null && args.length>0) {
- method=props[i].getWriteMethod();
- args = coerce(method.getParameterTypes(), args);
- } else {
- method=props[i].getReadMethod();
- }
- setResult(result, method.invoke(object, args));
- return;
- }
- }
-
- Field jfields[] = jclass.getFields();
- for (int i=0; i<jfields.length; i++) {
- if (jfields[i].getName().equalsIgnoreCase(prop)) {
- if (args!=null && args.length>0) {
- args = coerce(new Class[] {jfields[i].getType()}, args);
- jfields[i].set(object, args[0]);
- } else {
- setResult(result, jfields[i].get(object));
- }
- return;
- }
- }
-
- // try a second time with the object itself, if it is of type Class
- if (!(object instanceof Class) || (jclass==object)) break;
- }
-
- } catch (Exception e) {
- setException(result, e);
- }
- }
-
- //
- // Helper routines for the C implementation
- //
- public Object MakeArg(boolean b) { return new Boolean(b); }
- public Object MakeArg(long l) { return new Long(l); }
- public Object MakeArg(double d) { return new Double(d); }
-}
diff --git a/ext/rpc/php_rpc.h b/ext/rpc/php_rpc.h
deleted file mode 100644
index 16126bc82a..0000000000
--- a/ext/rpc/php_rpc.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_RPC_H
-#define PHP_RPC_H
-
-#include "zend.h"
-
-extern zend_module_entry rpc_module_entry;
-#define phpext_rpc_ptr &rpc_module_entry
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-ZEND_MINIT_FUNCTION(rpc);
-ZEND_MSHUTDOWN_FUNCTION(rpc);
-ZEND_RINIT_FUNCTION(rpc);
-ZEND_RSHUTDOWN_FUNCTION(rpc);
-ZEND_MINFO_FUNCTION(rpc);
-
-ZEND_API void rpc_error(int type, const char *format, ...);
-ZEND_API zend_object_value rpc_objects_new(zend_class_entry * TSRMLS_DC);
-
-#endif /* PHP_RPC_H */ \ No newline at end of file
diff --git a/ext/rpc/rpc.c b/ext/rpc/rpc.c
deleted file mode 100644
index a9e361c93f..0000000000
--- a/ext/rpc/rpc.c
+++ /dev/null
@@ -1,936 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-
-#include "php_rpc.h"
-#include "rpc.h"
-#include "hash.h"
-#include "handler.h"
-
-static void rpc_instance_dtor(void *);
-static void rpc_class_dtor(void *);
-static void rpc_string_dtor(void *);
-
-static void rpc_objects_delete(void *, zend_object_handle TSRMLS_DC);
-static void rpc_ini_cb(void *arg TSRMLS_DC);
-
-static rpc_class_hash *rpc_class_hash_find(rpc_string *name);
-
-/* object handler */
-static zval* rpc_read(zval *, zval * TSRMLS_DC);
-static void rpc_write(zval *, zval *, zval * TSRMLS_DC);
-static zval** rpc_get_property(zval *, zval * TSRMLS_DC);
-static zval* rpc_get(zval * TSRMLS_DC);
-static void rpc_set(zval **, zval * TSRMLS_DC);
-static int rpc_has_property(zval *, zval *, int TSRMLS_DC);
-static void rpc_unset_property(zval *, zval * TSRMLS_DC);
-static HashTable* rpc_get_properties(zval * TSRMLS_DC);
-static union _zend_function* rpc_get_method(zval *, char *, int TSRMLS_DC);
-static union _zend_function* rpc_get_constructor(zval * TSRMLS_DC);
-static zend_class_entry* rpc_get_class_entry(zval * TSRMLS_DC);
-static int rpc_get_class_name(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC);
-static int rpc_compare(zval *, zval * TSRMLS_DC);
-/**/
-
-/* pseudo handler */
-static void rpc_internal_get(rpc_internal *, char *, zend_uint, zval *);
-static void rpc_internal_set(rpc_internal *, char *, zend_uint, zval *);
-/**/
-
-extern zend_object_handlers rpc_proxy_handlers;
-
-static zend_object_handlers rpc_handlers = {
- ZEND_OBJECTS_STORE_HANDLERS,
-
- rpc_read,
- rpc_write,
- rpc_get_property,
- NULL,
- rpc_get,
- rpc_set,
- rpc_has_property,
- rpc_unset_property,
- rpc_get_properties,
- rpc_get_method,
- NULL,
- rpc_get_constructor,
- rpc_get_class_entry,
- rpc_get_class_name,
- rpc_compare
-};
-
-/* {{{ rpc_functions[]
- */
-function_entry rpc_functions[] = {
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ rpc_module_entry
- */
-zend_module_entry rpc_module_entry = {
- STANDARD_MODULE_HEADER,
- "rpc",
- rpc_functions,
- ZEND_MINIT(rpc),
- ZEND_MSHUTDOWN(rpc),
- NULL,
- NULL,
- ZEND_MINFO(rpc),
- "0.1a",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-zend_class_entry rpc_class_entry;
-
-static zend_class_entry *rpc_entry;
-static zend_function *rpc_ctor;
-static HashTable handlers;
-static TsHashTable pool;
-static TsHashTable classes;
-static zend_llist classes_list;
-static zend_llist layers;
-
-#ifdef COMPILE_DL_RPC
-ZEND_GET_MODULE(rpc);
-#endif
-
-/* {{{ ZEND_MINIT_FUNCTION
- */
-ZEND_MINIT_FUNCTION(rpc)
-{
- zend_internal_function *zif;
-
- /* rpc base class entry */
- INIT_CLASS_ENTRY(rpc_class_entry, "rpc", NULL);
- rpc_entry = zend_register_internal_class(&rpc_class_entry TSRMLS_CC);
-
- zend_hash_init(&handlers, 0, NULL, NULL, TRUE);
- zend_ts_hash_init(&pool, sizeof(rpc_internal **), NULL, rpc_instance_dtor, TRUE);
- zend_ts_hash_init(&classes, 0, NULL, NULL, TRUE);
- zend_llist_init(&classes_list, sizeof(rpc_class_hash **), rpc_class_dtor, TRUE);
- zend_llist_init(&layers, sizeof(char *), NULL, TRUE);
-
- zif = (zend_internal_function *) emalloc(sizeof(zend_internal_function));
-
- zif->type = ZEND_INTERNAL_FUNCTION;
- zif->function_name = rpc_entry->name;
- zif->scope = rpc_entry;
- zif->arg_types = NULL;
- zif->handler = ZEND_FN(rpc_load);
-
- /* add new constructor to the method table */
- zend_hash_add(&(rpc_entry->function_table), rpc_entry->name, rpc_entry->name_length + 1, zif, sizeof(zend_function), &rpc_ctor);
- efree(zif);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ ZEND_MSHUTDOWN_FUNCTION
- */
-ZEND_MSHUTDOWN_FUNCTION(rpc)
-{
- /* destroy instances first */
- zend_ts_hash_destroy(&pool);
-
- zend_ts_hash_destroy(&classes);
- zend_llist_destroy(&classes_list);
- zend_llist_destroy(&layers);
- zend_hash_destroy(&handlers);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ ZEND_MINFO_FUNCTION
- */
-ZEND_MINFO_FUNCTION(rpc)
-{
- php_info_print_table_start();
- zend_llist_apply(&layers, rpc_ini_cb TSRMLS_CC);
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-/* }}} */
-
-ZEND_API rpc_register_layer(rpc_handler_entry *entry TSRMLS_DC)
-{
- zend_class_entry ce;
-
- INIT_CLASS_ENTRY(ce, entry->name, entry->methods);
-
- ce.create_object = rpc_objects_new;
-
- /* load all available rpc handler into a hash */
- zend_hash_add(&handlers, entry->name, strlen(entry->name) + 1, &(entry->handlers), sizeof(rpc_object_handlers *), NULL);
- zend_llist_add_element(&layers, &(entry->name));
-
- /* register classes */
- *(entry->ce) = zend_register_internal_class_ex(&ce, rpc_entry, NULL TSRMLS_CC);
-}
-
-static void rpc_class_dtor(void *pDest)
-{
- rpc_class_hash **hash;
-
- hash = (rpc_class_hash **) pDest;
-
- if ((*hash)->singleton) {
- RPC_HT(*hash)->rpc_dtor((*hash)->data);
- }
-
- zend_ts_hash_destroy(&((*hash)->methods));
- zend_ts_hash_destroy(&((*hash)->properties));
-
- free((*hash)->name.str);
- pefree((*hash), TRUE);
-}
-
-static void rpc_string_dtor(void *pDest)
-{
- rpc_string **string;
-
- string = (rpc_string **) pDest;
-
- free((*string)->str);
- pefree(*string, TRUE);
-}
-
-static void rpc_instance_dtor(void *pDest)
-{
- rpc_internal **intern;
-
- intern = (rpc_internal **) pDest;
-
- RPC_HT(*intern)->rpc_dtor((*intern)->data);
-
- tsrm_mutex_free((*intern)->mx_handler);
- if ((*intern)->free_function_table) {
- zend_ts_hash_destroy(&((*intern)->function_table));
- }
-
- pefree(*intern, TRUE);
-}
-
-static void rpc_ini_cb(void *arg TSRMLS_DC)
-{
- char *name = *((char **) arg);
- php_info_print_table_header(2, name, "loaded");
-}
-
-static zend_object_value rpc_create_proxy(TSRMLS_D)
-{
- zend_object_value *zov;
- rpc_proxy *proxy_intern;
-
- /* set up the object value struct */
- zov = (zend_object_value*) pemalloc(sizeof(zend_object_value), TRUE);
- zov->handlers = &rpc_proxy_handlers;
-
- /* set up the internal representation of the proxy */
- proxy_intern = (rpc_proxy *) pemalloc(sizeof(rpc_proxy), TRUE);
-
- /* store the instance in a hash and set the key as handle, thus
- * we can find it later easily
- */
-/* tsrm_mutex_lock(proxy->mx_writer);
- {
- zov->handle = zend_hash_next_free_element(TS_HASH(proxy));
- zend_ts_hash_next_index_insert(proxy, &proxy_intern, sizeof(rpc_proxy *), NULL);
- }
- tsrm_mutex_unlock(proxy->mx_writer);
-*/
- return *zov;
-}
-
-/* object handler */
-
-static void rpc_objects_delete(void *object, zend_object_handle handle TSRMLS_DC)
-{
- rpc_internal *intern = (rpc_internal *) object;
-
- if (RPC_CLASS(intern) && RPC_CLASS(intern)->singleton) {
- pefree(intern, TRUE);
- } else if (RPC_CLASS(intern) && RPC_CLASS(intern)->poolable) {
- if (RPC_CLASS(intern)->name.str) {
- zend_ts_hash_add(&pool, RPC_CLASS(intern)->name.str, RPC_CLASS(intern)->name.len + 1, &intern, sizeof(rpc_internal *), NULL);
- } else {
- zend_ts_hash_index_update(&pool, RPC_CLASS(intern)->name.len + 1, &intern, sizeof(rpc_internal *), NULL);
- }
- } else {
- if (intern->data != NULL) {
- RPC_HT(intern)->rpc_dtor(intern->data);
- }
- pefree(intern, TRUE);
- }
-}
-
-static zval* rpc_read(zval *object, zval *member TSRMLS_DC)
-{
- zval *return_value;
- GET_INTERNAL(intern);
-
- /* seting up the return value and decrease the refcounter as we don't
- * keep a reference to this zval.
- */
- MAKE_STD_ZVAL(return_value);
- ZVAL_DELREF(return_value);
- ZVAL_NULL(return_value);
-
- if (intern->hash && Z_TYPE_P(member) == IS_LONG) {
- rpc_internal_get(intern, NULL, Z_LVAL_P(member), return_value);
- } else if (Z_TYPE_P(member) == IS_STRING) {
- rpc_internal_get(intern, Z_STRVAL_P(member), Z_STRLEN_P(member), return_value);
- } else {
- /* TODO: exception here */
- }
-
- return return_value;
-}
-
-static void rpc_write(zval *object, zval *member, zval *value TSRMLS_DC)
-{
- GET_INTERNAL(intern);
-
- if (intern->hash && Z_TYPE_P(member) == IS_LONG) {
- rpc_internal_set(intern, NULL, Z_LVAL_P(member), value);
- } else if (Z_TYPE_P(member) == IS_STRING) {
- rpc_internal_set(intern, Z_STRVAL_P(member), Z_STRLEN_P(member), value);
- } else {
- /* TODO: exception here */
- }
-}
-
-static zval** rpc_get_property(zval *object, zval *member TSRMLS_DC)
-{
- zval **return_value;
- GET_INTERNAL(intern);
-
- return_value = emalloc(sizeof(zval *));
- MAKE_STD_ZVAL(*return_value);
- Z_TYPE_P(object) = IS_OBJECT;
- (*return_value)->value.obj = rpc_create_proxy(TSRMLS_C);
-
- return return_value;
-}
-
-static zval* rpc_get(zval *property TSRMLS_DC)
-{
- /* not yet implemented */
- return NULL;
-}
-
-static void rpc_set(zval **property, zval *value TSRMLS_DC)
-{
- /* not yet implemented */
-}
-
-static int rpc_has_property(zval *object, zval *member, int check_empty TSRMLS_DC)
-{
-// GET_INTERNAL(intern);
- /* FIXME */
- return FAILURE;
-}
-
-static void rpc_unset_property(zval *object, zval *member TSRMLS_DC)
-{
-// GET_INTERNAL(intern);
- /* FIXME */
-}
-
-static HashTable* rpc_get_properties(zval *object TSRMLS_DC)
-{
-// GET_INTERNAL(intern);
- /* FIXME */
- return NULL;
-}
-
-static union _zend_function* rpc_get_method(zval *object, char *method, int method_len TSRMLS_DC)
-{
- zend_function *function;
- unsigned char *ref_types = NULL;
- GET_INTERNAL(intern);
-
- if (zend_ts_hash_find(&intern->function_table, method, method_len + 1, &function) != SUCCESS) {
- zend_internal_function *zif;
-
- /* get reftypes */
- if (RPC_HT(intern)->rpc_describe) {
- char *arg_types;
- rpc_string method_name;
-
- method_name.str = method;
- method_name.len = method_len;
-
- RPC_HT(intern)->rpc_describe(method_name, intern->data, &arg_types, &ref_types);
- }
-
- zif = (zend_internal_function *) emalloc(sizeof(zend_internal_function));
- zif->arg_types = ref_types;
- zif->function_name = method;
- zif->handler = ZEND_FN(rpc_call);
- zif->scope = intern->ce;
- zif->type = ZEND_INTERNAL_FUNCTION;
- zif->fn_flags = ZEND_ACC_PUBLIC;
-
- /* add new method to the method table */
- zend_ts_hash_add(&intern->function_table, method, method_len + 1, zif, sizeof(zend_function), &function);
- efree(zif);
- }
-
- return function;
-}
-
-static union _zend_function* rpc_get_constructor(zval *object TSRMLS_DC)
-{
- return rpc_ctor;
-}
-
-static zend_class_entry* rpc_get_class_entry(zval *object TSRMLS_DC)
-{
- GET_INTERNAL(intern);
-
- return intern->ce;
-}
-
-static int rpc_get_class_name(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
-{
- GET_INTERNAL(intern);
-
- if (parent) {
- return FAILURE;
- } else {
- *class_name = intern->ce->name;
- *class_name_len = intern->ce->name_length;
- return SUCCESS;
- }
-}
-
-static int rpc_compare(zval *object1, zval *object2 TSRMLS_DC)
-{
- /* FIXME */
- return FAILURE;
-}
-
-/**/
-
-/* constructor */
-ZEND_API ZEND_FUNCTION(rpc_load)
-{
- zval *object = getThis();
- zval ***args, ***args_free;
- zend_uint num_args = ZEND_NUM_ARGS();
- rpc_class_hash *class_hash;
- rpc_internal *intern;
- rpc_string hash_val, class_val;
- int retval, append = 0;
- char *arg_types;
-
- /* check if we were called as a constructor or as a function */
- if (!object) {
- /* we were called as a function so we have to figure out which rpc layer was requested
- * and then we have to set up a zval containing the object
- */
-
- /* get class entry */
- GET_CLASS(ce);
-
- /* set up a new zval container */
- object = return_value;
-
- Z_TYPE_P(object) = IS_OBJECT;
-
- /* create a new object */
- object->value.obj = rpc_objects_new(*ce TSRMLS_CC);
-
- /* now everything is set up the same way as if we were called as a constructor */
- }
-
- if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
- /* TODO: exception */
- }
-
- /* fetch further parameters */
- GET_ARGS_EX(num_args, args, args_free, 1);
-
- /* if classname != integer */
- if ((zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 1 TSRMLS_CC, "l", &class_val.len) != SUCCESS) ||
- /* or we have no hash function */
- !(RPC_HT(intern)->rpc_hash) ||
- /* or integer hashing is not allowed */
- !(RPC_HT(intern)->hash_type & HASH_AS_INT)) {
-
- /* else check for string - classname */
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 1 TSRMLS_CC, "s", &class_val.str, &class_val.len) != SUCCESS) {
- /* none of the two possibilities */
- /* TODO: exception */
- rpc_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C));
- ZVAL_NULL(object);
- return;
- } else {
- /* hash classname if hashing function exists */
- if (RPC_HT(intern)->rpc_hash) {
-
- GET_SIGNATURE(intern, class_val.str, class_val.len, hash_val, num_args, arg_types);
-
- /* check if already hashed */
- if ((class_hash = rpc_class_hash_find(&hash_val)) == NULL) {
- ALLOC_CLASS_HASH(class_hash, intern->handlers);
-
- /* do hashing */
- if (RPC_HT(intern)->rpc_hash(class_val, (rpc_string *) class_hash, NULL, num_args, arg_types, CLASS) != SUCCESS) {
- /* TODO: exception */
- ZVAL_NULL(object);
- return;
- }
-
- /* overload class entry */
- RPC_HT(intern)->rpc_name(class_val, &class_val, NULL, CLASS);
- OVERLOAD_RPC_CLASS(class_val, intern, class_hash);
-
- /* register with non-hashed key
- * also track all instaces in a llist for destruction later on, because there might be duplicate entries in
- * the hashtable and we can't determine if a pointer references to an already freed element
- */
- REGISTER_RPC_CLASS(class_val, class_hash);
- } else {
- INIT_RPC_OBJECT(intern, class_hash);
- }
-
- FREE_SIGNATURE(hash_val, arg_types);
- } else {
- /* Copy the function table hash for this object, so that it is separated
- * from the "global" table */
- SEPARATE_RPC_CLASS(intern);
- }
- }
- } else {
- /* integer classname (hashcode) */
- if ((class_hash = rpc_class_hash_find(&hash_val)) == NULL) {
- ALLOC_CLASS_HASH(class_hash, intern->handlers);
-
- class_val.str = NULL;
- class_hash->name.str = NULL;
- class_hash->name.len = class_val.len;
-
- /* overload class entry */
- RPC_HT(intern)->rpc_name(class_val, &class_val, NULL, CLASS);
- OVERLOAD_RPC_CLASS(class_val, intern, class_hash);
-
- /* register int hashcode, we don't know more */
- REGISTER_RPC_CLASS(class_val, class_hash);
- } else {
- INIT_RPC_OBJECT(intern, class_hash);
- }
- }
-
- /* if hash function available */
- if (RPC_HT(intern)->rpc_hash) {
- rpc_internal *pool_intern;
-
- /* assign cache structure */
- RPC_CLASS(intern) = class_hash;
-
- if (zend_ts_hash_remove_key_or_index(&pool, RPC_CLASS(intern)->name.str, RPC_CLASS(intern)->name.len + 1, (void **) &pool_intern) == SUCCESS) {
- intern->data = pool_intern->data;
-
- pefree(pool_intern, TRUE);
- retval = SUCCESS;
- } else if (RPC_CLASS(intern)->singleton) {
- /* singleton */
- intern->data = RPC_CLASS(intern)->data;
- retval = SUCCESS;
- } else {
- /* call the rpc ctor */
- retval = RPC_HT(intern)->rpc_ctor(class_hash->name, &(intern->data), num_args, args);
- }
- } else {
- /* disable caching from now on */
- intern->hash = NULL;
-
- /* call the rpc ctor */
- retval = RPC_HT(intern)->rpc_ctor(class_val, &(intern->data), num_args, args);
- }
-
- efree(args_free);
-
- if (retval != SUCCESS) {
- /* TODO: exception */
- RETURN_NULL();
- }
-}
-
-ZEND_API ZEND_FUNCTION(rpc_call)
-{
- zval *object = getThis();
- zval ***args, ***args_free;
- zend_uint num_args = ZEND_NUM_ARGS();
- char *hash = NULL, *arg_types;
- int hash_len, retval, strip = 0;
-
- /* check if we were called as a method or as a function */
- if (!object) {
- /* we were called as a function so we have to figure out which rpc layer was requested */
-
- /* get class entry */
- GET_CLASS(ce);
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 2 TSRMLS_CC, "Ol", &object, *ce, &hash_len) != SUCCESS) {
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 2 TSRMLS_CC, "Os", &object, *ce, &hash, &hash_len) != SUCCESS) {
- /* none of the two possibilities */
- /* TODO: exception */
- rpc_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C));
- }
- }
-
- strip = 2;
- } else {
- hash = get_active_function_name(TSRMLS_C);
- hash_len = strlen(hash);
- }
-
- GET_ARGS_EX(num_args, args, args_free, strip);
-
- /* scope for internal data */
- {
- rpc_string hash_val, *method_hash, **method_hash_find;
- GET_INTERNAL(intern);
-
- method_hash = (rpc_string *) pemalloc(sizeof(rpc_string), TRUE);
- method_hash->str = hash;
- method_hash->len = hash_len;
-
- if (intern->hash) {
- /* cache method table lookups */
-
- if (!hash && !(RPC_HT(intern)->hash_type & HASH_AS_INT)) {
- /* TODO: exception */
- } else if(hash) {
- /* string passed */
- GET_METHOD_SIGNATURE(intern, method_hash, hash_val, num_args, arg_types);
-
- /* check if already hashed */
- if (zend_ts_hash_find(&(intern->hash->methods), hash_val.str, hash_val.len + 1, (void **) &method_hash_find) != SUCCESS) {
- if (RPC_HT(intern)->rpc_hash(*method_hash, method_hash, intern->data, num_args, arg_types, METHOD) != SUCCESS) {
- /* TODO: exception */
- RETURN_NULL();
- }
-
- /* register with non-hashed key */
- zend_ts_hash_add(&(intern->hash->methods), hash_val.str, hash_val.len + 1, &method_hash, sizeof(rpc_string *), NULL);
- } else {
- pefree(method_hash, TRUE);
- method_hash = *method_hash_find;
- }
-
- FREE_SIGNATURE(hash_val, arg_types);
- }
- }
-
- /* actually this should not be neccesary, but who knows :)
- * considering possible thread implementations in future php versions
- * and srm it is better to do concurrency checks
- * DEPRECATE THIS !
- */
- tsrm_mutex_lock(intern->mx_handler);
- retval = RPC_HT(intern)->rpc_call(*method_hash, intern->data, return_value, num_args, args);
- tsrm_mutex_unlock(intern->mx_handler);
- }
-
- efree(args_free);
-
- if (retval != SUCCESS) {
- /* TODO: exception here */
- }
-}
-
-ZEND_API ZEND_FUNCTION(rpc_set)
-{
- zval *object, *value;
- char *property = NULL;
- int property_len;
- rpc_internal *intern;
- /* get class entry */
- GET_CLASS(ce);
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 3 TSRMLS_CC, "Olz", &object, *ce, &property_len, &value) != SUCCESS) {
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 3 TSRMLS_CC, "Osz", &object, *ce, &property, &property_len, &value) != SUCCESS) {
- /* none of the two possibilities */
- /* TODO: exception */
- rpc_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C));
- }
- }
-
- GET_INTERNAL_EX(intern, object);
- if (!property && !intern->hash) {
- /* TODO: exception here */
- } else {
- rpc_internal_set(intern, property, property_len, value);
- }
-}
-
-ZEND_API ZEND_FUNCTION(rpc_get)
-{
- zval *object;
- char *property = NULL;
- int property_len;
- rpc_internal *intern;
- /* get class entry */
- GET_CLASS(ce);
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 2 TSRMLS_CC, "Ol", &object, *ce, &property_len) != SUCCESS) {
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 2 TSRMLS_CC, "Os", &object, *ce, &property, &property_len) != SUCCESS) {
- /* none of the two possibilities */
- /* TODO: exception */
- rpc_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C));
- }
- }
-
- GET_INTERNAL_EX(intern, object);
- if (!property && !intern->hash) {
- /* TODO: exception here */
- } else {
- rpc_internal_get(intern, property, property_len, return_value);
- }
-}
-
-ZEND_API ZEND_FUNCTION(rpc_singleton)
-{
- zval *object;
- rpc_internal *intern;
- /* get class entry */
- GET_CLASS(ce);
-
- zend_parse_parameters(1 TSRMLS_CC, "O", &object, *ce);
-
- GET_INTERNAL_EX(intern, object);
-
- if (!RPC_CLASS(intern)) {
- /* TODO: exception here, no hashing */
- } else if (!RPC_CLASS(intern)->singleton) {
- RPC_CLASS(intern)->singleton = TRUE;
- RPC_CLASS(intern)->data = intern->data;
- }
-}
-
-ZEND_API ZEND_FUNCTION(rpc_poolable)
-{
- zval *object;
- rpc_internal *intern;
- /* get class entry */
- GET_CLASS(ce);
-
- zend_parse_parameters(1 TSRMLS_CC, "O", &object, *ce);
-
- GET_INTERNAL_EX(intern, object);
-
- if (RPC_HT(intern)->poolable && RPC_CLASS(intern) && (RPC_HT(intern)->poolable == TRUE)) {
- RPC_CLASS(intern)->poolable = TRUE;
- } else {
- /* TODO: exception here, no hashing */
- }
-}
-
-ZEND_API void rpc_error(int type, const char *format, ...)
-{
- va_list args;
- TSRMLS_FETCH();
-
- va_start(args, format);
- zend_error_cb(type, zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C), format, args);
- va_end(args);
-}
-
-ZEND_API zend_object_value rpc_objects_new(zend_class_entry *class_type TSRMLS_DC)
-{
- zend_object_value zov;
- rpc_internal *intern;
-
- /* set up the object value struct */
- zov.handlers = &rpc_handlers;
-
- /* set up the internal representation of our rpc instance */
- intern = (rpc_internal *) pecalloc(1, sizeof(rpc_internal), TRUE);
-
- intern->ce = class_type;
- intern->data = NULL;
- intern->free_function_table = 0;
- intern->function_table.reader = 0;
- intern->function_table.mx_reader = tsrm_mutex_alloc();
- intern->function_table.mx_writer = tsrm_mutex_alloc();
- intern->mx_handler = tsrm_mutex_alloc();
-
- if (zend_hash_find(&handlers, class_type->name, class_type->name_length + 1, (void **) &(intern->handlers)) != SUCCESS) {
- /* TODO: exception */
- }
-
- zov.handle = zend_objects_store_put(intern, rpc_objects_delete, NULL TSRMLS_CC);
-
- return zov;
-}
-
-/*******************/
-
-static void rpc_internal_get(rpc_internal *intern, char *property, zend_uint property_len, zval *return_value)
-{
- int retval;
- rpc_string *property_hash, **property_hash_find;
-
- Z_TYPE_P(return_value) = IS_NULL;
-
- property_hash = (rpc_string *) pemalloc(sizeof(rpc_string), TRUE);
- property_hash->str = property;
- property_hash->len = property_len;
-
- if (intern->hash) {
- /* cache method table lookups */
-
- if (!property && !(RPC_HT(intern)->hash_type & HASH_AS_INT)) {
- /* TODO: exception */
- } else if(property) {
- /* check if already hashed */
- if (zend_ts_hash_find(&(intern->hash->properties), property, property_len + 1, (void **) &property_hash_find) != SUCCESS) {
- if (RPC_HT(intern)->rpc_hash(*property_hash, property_hash, intern->data, 0, NULL, PROPERTY) != SUCCESS) {
- /* TODO: exception */
- RETURN_NULL();
- }
-
- /* register with non-hashed key */
- zend_ts_hash_add(&(intern->hash->properties), property, property_len + 1, &property_hash, sizeof(rpc_string *), NULL);
- } else {
- pefree(property_hash, TRUE);
- property_hash = *property_hash_find;
- }
- }
- }
-
-
- tsrm_mutex_lock(intern->mx_handler);
- retval = RPC_HT(intern)->rpc_get(*property_hash, return_value, intern->data);
- tsrm_mutex_unlock(intern->mx_handler);
-
- if (retval != SUCCESS) {
- /* TODO: exception here */
- }
-}
-
-static void rpc_internal_set(rpc_internal *intern, char *property, zend_uint property_len, zval *value)
-{
- int retval;
- rpc_string property_name;
-
- property_name.str = property;
- property_name.len = property_len;
-
- tsrm_mutex_lock(intern->mx_handler);
- retval = RPC_HT(intern)->rpc_set(property_name, value, intern->data);
- tsrm_mutex_unlock(intern->mx_handler);
-
- if (retval != SUCCESS) {
- /* TODO: exception here */
- }
-}
-
-static rpc_class_hash *rpc_class_hash_find(rpc_string *name)
-{
- rpc_class_hash **class_hash_find = NULL;
-
- if (name->str == NULL) {
- /* int value */
- if (zend_ts_hash_index_find(&classes, name->len, (void**) &class_hash_find) != SUCCESS) {
- return NULL;
- }
- } else {
- /* string value */
- if (zend_ts_hash_find(&classes, name->str, name->len + 1, (void **) &class_hash_find) != SUCCESS) {
- return NULL;
- }
- }
-
- return *class_hash_find;
-}
-
-ZEND_API zval* _rpc_object_from_data(zval *z, rpc_handler_entry *handler, void *data, rpc_class_hash *class_hash)
-{
- rpc_internal *intern;
- rpc_string hash, name = {NULL, 0};
- TSRMLS_FETCH();
-
- if (z == NULL) {
- ALLOC_ZVAL(z);
- }
-
- Z_TYPE_P(z) = IS_OBJECT;
- z->value.obj = rpc_objects_new(*(handler->ce) TSRMLS_CC);
-
- if (GET_INTERNAL_EX(intern, z) != SUCCESS) {
- /* TODO: exception */
- return NULL;
- }
-
- intern->ce = *(handler->ce);
- intern->data = data;
-
- if ((handler->handlers->rpc_hash) &&
- (handler->handlers->rpc_hash(name, &hash, data, 0, "", CLASS) == SUCCESS)) {
- /* We are hashing, try to find an appropriate hash or create a new one */
- if ((class_hash == NULL) &&
- ((class_hash = rpc_class_hash_find(&hash)) == NULL)) {
- ALLOC_CLASS_HASH(class_hash, intern->handlers);
-
- class_hash->name = hash;
-
- if (handler->handlers->rpc_name(hash, &name, data, CLASS) != SUCCESS) {
- /* TODO exception */
- }
-
- OVERLOAD_RPC_CLASS(name, intern, class_hash);
- REGISTER_RPC_CLASS(name, class_hash);
- } else {
- INIT_RPC_OBJECT(intern, class_hash);
- }
-
- RPC_CLASS(intern) = class_hash;
- } else {
- /* Copy the function table hash for this object, so that it is separated
- * from the "global" table */
- SEPARATE_RPC_CLASS(intern);
- }
-
- return z;
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/rpc/rpc.h b/ext/rpc/rpc.h
deleted file mode 100644
index 07c760c36c..0000000000
--- a/ext/rpc/rpc.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef RPC_H
-#define RPC_H
-
-#define RPC_HT(intern) (*((intern)->handlers))
-#define RPC_CLASS(intern) ((intern)->hash)
-
-#define GET_INTERNAL(intern) rpc_internal *intern; \
- if (GET_INTERNAL_EX(intern, object) != SUCCESS) { \
- /* TODO: exception */ \
- }
-
-#define GET_INTERNAL_EX(intern, object) (((intern = zend_object_store_get_object(object TSRMLS_CC)) == NULL) ? FAILURE : SUCCESS)
-
-#define GET_CLASS(ce) char *key; \
- int key_len; \
- zend_class_entry **ce; \
- \
- /* the name of the rpc layer is prepended to '_load' so lets strip everything after \
- * the first '_' away from the function name \
- */ \
- key = estrdup(get_active_function_name(TSRMLS_C)); \
- key_len = strchr(key, '_') - key; \
- key[key_len] = '\0'; \
- \
- /* get the class entry for the requested rpc layer */ \
- if (zend_hash_find(CG(class_table), key, key_len + 1, (void **) &ce) != SUCCESS) { \
- efree(key); \
- /* TODO: exception here */ \
- } else { \
- efree(key); \
- }
-
-#define GET_ARGS_EX(num_args, args, args_free, strip) \
- GET_ARGS(num_args, args) \
- \
- args_free = args; \
- \
- /* strip away the first parameters */ \
- num_args -= strip; \
- args = (num_args > 0) ? &args[strip] : NULL;
-
-#define GET_ARGS(num_args, args) \
- args = (zval ***) emalloc(sizeof(zval **) * num_args); \
- \
- if (zend_get_parameters_array_ex(num_args, args) != SUCCESS) { \
- efree(args); \
- /* TODO: exception */ \
- }
-
-#define GET_METHOD_SIGNATURE(intern, method, hash_val, num_args, arg_types) \
- GET_SIGNATURE(intern, method->str, method->len, hash_val, num_args, arg_types)
-
-#define GET_SIGNATURE(intern, name, name_len, hash_val, num_args, arg_types) \
- hash_val.len = name_len; \
- \
- if ((*intern->handlers)->hash_type & HASH_WITH_SIGNATURE) { \
- zend_uint _signature_counter; \
- \
- arg_types = (char *) emalloc(sizeof(char) * (num_args + 1)); \
- hash_val.len += num_args + 1; \
- \
- for (_signature_counter = 0; _signature_counter < num_args; _signature_counter++) { \
- switch (Z_TYPE_PP(args[_signature_counter])) { \
- case IS_NULL: \
- arg_types[_signature_counter] = 'n'; \
- break; \
- case IS_LONG: \
- arg_types[_signature_counter] = 'l'; \
- break; \
- case IS_DOUBLE: \
- arg_types[_signature_counter] = 'd'; \
- break; \
- case IS_STRING: \
- arg_types[_signature_counter] = 's'; \
- break; \
- case IS_ARRAY: \
- arg_types[_signature_counter] = 'a'; \
- break; \
- case IS_OBJECT: \
- arg_types[_signature_counter] = 'o'; \
- break; \
- case IS_BOOL: \
- arg_types[_signature_counter] = 'b'; \
- break; \
- case IS_RESOURCE: \
- arg_types[_signature_counter] = 'r'; \
- break; \
- default: \
- arg_types[_signature_counter] = 'u'; \
- } \
- } \
- \
- arg_types[_signature_counter] = '\0'; \
- } else { \
- arg_types = (char *) emalloc(sizeof(char)); \
- arg_types[0] = '\0'; \
- } \
- \
- hash_val.str = (char *) emalloc(sizeof(char) * (hash_val.len + 2)); \
- memcpy(hash_val.str, arg_types, num_args + 1); \
- memcpy(&hash_val.str[hash_val.len - name_len], \
- name, name_len + 1);
-
-#define FREE_SIGNATURE(hash_val, arg_types) \
- efree(arg_types); \
- efree(hash_val.str);
-
-#define ALLOC_CLASS_HASH(_class_hash, _handlers) \
- if (_class_hash = pemalloc(sizeof(rpc_class_hash), TRUE)) { \
- /* set up the cache */ \
- zend_ts_hash_init(&(_class_hash->methods), 0, NULL, rpc_string_dtor, TRUE); \
- zend_ts_hash_init(&(_class_hash->properties), 0, NULL, rpc_string_dtor, TRUE); \
- _class_hash->singleton = FALSE; \
- _class_hash->poolable = FALSE; \
- _class_hash->data = NULL; \
- _class_hash->handlers = _handlers; \
- }
-
-#define INIT_RPC_OBJECT(__intern, __clh) \
- (__intern)->ce = (__clh)->ce; \
- (__intern)->function_table.hash = (__intern)->ce->function_table;
-
-#define OVERLOAD_RPC_CLASS(__name, __intern, __clh) { \
- zend_class_entry overloaded_class_entry; \
- INIT_CLASS_ENTRY(overloaded_class_entry, NULL, NULL); \
- overloaded_class_entry.name = __name.str; \
- overloaded_class_entry.name_length = (__name.str != NULL) ? __name.len : 0; \
- (__clh)->ce = zend_register_internal_class_ex(&overloaded_class_entry, (__intern)->ce, NULL TSRMLS_CC); \
- INIT_RPC_OBJECT(__intern, __clh); \
- }
-
-#define SEPARATE_RPC_CLASS(__intern) \
- (__intern)->free_function_table = 1; \
- zend_ts_hash_init(&((__intern)->function_table), 0, NULL, NULL, TRUE); \
- zend_hash_copy(&((__intern)->function_table.hash), &((__intern)->ce->function_table), NULL, NULL, 0);
-
-#define REGISTER_RPC_CLASS(__name, __class_hash) { \
- rpc_class_hash **_tmp; \
- if ((__name).str != NULL) { \
- zend_ts_hash_add(&classes, (__name).str, (__name).len + 1, &(__class_hash), sizeof(rpc_class_hash *), (void **) &_tmp); \
- } \
- \
- tsrm_mutex_lock(classes.mx_writer); \
- zend_llist_add_element(&classes_list, _tmp); \
- tsrm_mutex_unlock(classes.mx_writer); \
- \
- if ((__class_hash)->name.str) { \
- zend_ts_hash_add(&classes, (__class_hash)->name.str, (__class_hash)->name.len + 1, &(__class_hash), sizeof(rpc_class_hash *), NULL); \
- } else { \
- zend_ts_hash_index_update(&classes, class_hash->name.len, &class_hash, sizeof(rpc_class_hash *), NULL); \
- } \
- }
-
-
-#endif \ No newline at end of file
diff --git a/ext/rpc/rpc_proxy.c b/ext/rpc/rpc_proxy.c
deleted file mode 100644
index 960d89cb49..0000000000
--- a/ext/rpc/rpc_proxy.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-#include "php.h"
-
-#include "rpc_proxy.h"
-#include "handler.h"
-
-/* object handler */
-static void rpc_proxy_add_ref(zval * TSRMLS_DC);
-static void rpc_proxy_del_ref(zval * TSRMLS_DC);
-static void rpc_proxy_delete(zval * TSRMLS_DC);
-static zend_object_value rpc_proxy_clone(zval * TSRMLS_DC);
-static zval* rpc_proxy_read(zval *, zval * TSRMLS_DC);
-static void rpc_proxy_write(zval *, zval *, zval * TSRMLS_DC);
-static zval** rpc_proxy_get_property(zval *, zval * TSRMLS_DC);
-static zval* rpc_proxy_get(zval * TSRMLS_DC);
-static void rpc_proxy_set(zval **, zval * TSRMLS_DC);
-static int rpc_proxy_has_property(zval *, zval *, int TSRMLS_DC);
-static void rpc_proxy_unset_property(zval *, zval * TSRMLS_DC);
-static HashTable* rpc_proxy_get_properties(zval * TSRMLS_DC);
-static union _zend_function* rpc_proxy_get_method(zval *, char *, int TSRMLS_DC);
-static union _zend_function* rpc_proxy_get_constructor(zval * TSRMLS_DC);
-static zend_class_entry* rpc_proxy_get_class_entry(zval *object TSRMLS_DC);
-static int rpc_proxy_get_classname(zval *, char **, zend_uint *, int TSRMLS_DC);
-static int rpc_proxy_compare(zval *, zval * TSRMLS_DC);
-/**/
-
-zend_object_handlers rpc_proxy_handlers = {
- rpc_proxy_add_ref,
- rpc_proxy_del_ref,
- rpc_proxy_delete,
- rpc_proxy_clone,
- rpc_proxy_read,
- rpc_proxy_write,
- rpc_proxy_get_property,
- NULL,
- rpc_proxy_get,
- rpc_proxy_set,
- rpc_proxy_has_property,
- rpc_proxy_unset_property,
- rpc_proxy_get_properties,
- rpc_proxy_get_method,
- NULL,
- rpc_proxy_get_constructor,
- rpc_proxy_get_class_entry,
- rpc_proxy_get_classname,
- rpc_proxy_compare
-};
-
-
-/* object handler */
-
-static void rpc_proxy_add_ref(zval *object TSRMLS_DC)
-{
-}
-
-static void rpc_proxy_del_ref(zval *object TSRMLS_DC)
-{
-}
-
-static void rpc_proxy_delete(zval *object TSRMLS_DC)
-{
-}
-
-static zend_object_value rpc_proxy_clone(zval *object TSRMLS_DC)
-{
-}
-
-static zval* rpc_proxy_read(zval *object, zval *member TSRMLS_DC)
-{
- return NULL;
-}
-
-static void rpc_proxy_write(zval *object, zval *member, zval *value TSRMLS_DC)
-{
-}
-
-static zval** rpc_proxy_get_property(zval *object, zval *member TSRMLS_DC)
-{
- return NULL;
-}
-
-static zval* rpc_proxy_get(zval *property TSRMLS_DC)
-{
- return NULL;
-}
-
-static void rpc_proxy_set(zval **property, zval *value TSRMLS_DC)
-{
-}
-
-static int rpc_proxy_has_property(zval *object, zval *member, int check_empty TSRMLS_DC)
-{
- return FAILURE;
-}
-
-static void rpc_proxy_unset_property(zval *object, zval *member TSRMLS_DC)
-{
-}
-
-static HashTable* rpc_proxy_get_properties(zval *object TSRMLS_DC)
-{
- return NULL;
-}
-
-static union _zend_function* rpc_proxy_get_method(zval *object, char *method, int method_len TSRMLS_DC)
-{
- return NULL;
-}
-
-static union _zend_function* rpc_proxy_get_constructor(zval *object TSRMLS_DC)
-{
- return NULL;
-}
-
-static zend_class_entry* rpc_proxy_get_class_entry(zval *object TSRMLS_DC)
-{
- return NULL;
-}
-
-static int rpc_proxy_get_classname(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
-{
- return FAILURE;
-}
-
-static int rpc_proxy_compare(zval *object1, zval *object2 TSRMLS_DC)
-{
- return FAILURE;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/rpc/rpc_proxy.h b/ext/rpc/rpc_proxy.h
deleted file mode 100644
index 5ff074278a..0000000000
--- a/ext/rpc/rpc_proxy.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef RPC_PROXY_H
-#define RPC_PROXY_H
-
-#endif \ No newline at end of file
diff --git a/ext/rpc/skeleton/php_skeleton.h b/ext/rpc/skeleton/php_skeleton.h
deleted file mode 100644
index a1e8a84bc4..0000000000
--- a/ext/rpc/skeleton/php_skeleton.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_SKELETON_H
-#define PHP_SKELETON_H
-
-extern zend_module_entry skeleton_module_entry;
-#define phpext_skeleton_ptr &skeleton_module_entry
-
-/*
- * Local variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: sw=4 ts=4 noet
- */
-#endif /* PHP_SKELETON_H */
diff --git a/ext/rpc/skeleton/skeleton.c b/ext/rpc/skeleton/skeleton.c
deleted file mode 100644
index bebafb71ec..0000000000
--- a/ext/rpc/skeleton/skeleton.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-#include "../rpc.h"
-#include "../handler.h"
-
-#include "skeleton.h"
-
-/* protos */
-static int skeleton_hash(rpc_string, rpc_string *, void *, int, char *, int);
-static int skeleton_name(rpc_string, rpc_string *, void *, int);
-static int skeleton_ctor(rpc_string, void **, int , zval ***);
-static int skeleton_dtor(void *);
-static int skeleton_describe(rpc_string, void *, char **, unsigned char **);
-static int skeleton_call(rpc_string, void **, zval *, int, zval ***);
-static int skeleton_get(rpc_string, zval *, void **);
-static int skeleton_set(rpc_string, zval *, void **);
-static int skeleton_compare(void **, void **);
-static int skeleton_has_property(rpc_string, void **);
-static int skeleton_unset_property(rpc_string, void **);
-static int skeleton_get_properties(HashTable **, void **);
-
-/* register rpc callback function */
-RPC_REGISTER_HANDLERS_BEGIN(skeleton)
-FALSE, /* poolable TRUE|FALSE*/
-DONT_HASH, /* hash function name lookups to avoid reflection of the object for each
- * method call. hashing is done either by mapping only the function name
- * to a coresponding method id or by taking the whole method signature into
- * account. possible values:
- * DONT_HASH|HASH_AS_INT|HASH_AS_STRING|
- * HASH_AS_INT_WITH_SIGNATURE|HASH_AS_STRING_WITH_SIGNATURE
- */
-skeleton_hash, /* the hash function, can be NULL */
-skeleton_name, /* the reverse hash function, can be NULL */
-skeleton_ctor, /* constructor */
-skeleton_dtor, /* destructor */
-skeleton_describe, /* function to reflect methods to get information about parameter types.
- * parameters can be forced to be by reference this way. can be NULL.
- */
-skeleton_call, /* method call handler */
-skeleton_get, /* property get handler */
-skeleton_set, /* property set handler */
-skeleton_compare, /* compare handler, can be NULL */
-skeleton_has_property, /* reflection functions */
-skeleton_unset_property, /* can be NULL */
-skeleton_get_properties
-RPC_REGISTER_HANDLERS_END()
-
-/* register ini settings */
-PHP_INI_BEGIN()
- /* TODO: palce your ini entries here */
-PHP_INI_END()
-
-/* register userspace functions */
-RPC_FUNCTION_ENTRY_BEGIN(skeleton)
- /* TODO: add your userspace functions here */
- ZEND_FE(skeleton_function, NULL)
-RPC_FUNCTION_ENTRY_END()
-
-/* register class methods */
-RPC_METHOD_ENTRY_BEGIN(skeleton)
- /* TODO: add your class methods here */
- ZEND_FALIAS(method, skeleton_function, NULL)
-RPC_METHOD_ENTRY_END()
-
-zend_module_entry skeleton_module_entry = {
- ZE2_STANDARD_MODULE_HEADER,
- "skeleton",
- RPC_FUNCTION_ENTRY(skeleton),
- ZEND_MINIT(skeleton),
- ZEND_MSHUTDOWN(skeleton),
- NULL,
- NULL,
- ZEND_MINFO(skeleton),
- "0.1a",
- STANDARD_MODULE_PROPERTIES
-};
-
-ZEND_MINIT_FUNCTION(skeleton)
-{
- /* TODO: place your init stuff here */
-
- RPC_REGISTER_LAYER(skeleton);
- REGISTER_INI_ENTRIES();
-
- return SUCCESS;
-}
-
-ZEND_MSHUTDOWN_FUNCTION(skeleton)
-{
- /* TODO: place your shutdown stuff here */
-
- UNREGISTER_INI_ENTRIES();
-
- return SUCCESS;
-}
-
-ZEND_MINFO_FUNCTION(skeleton)
-{
- DISPLAY_INI_ENTRIES();
-}
-
-#ifdef COMPILE_DL_SKELETON
-ZEND_GET_MODULE(skeleton);
-#endif
-
-/* rpc handler functions */
-
-/* {{{ skeleton_hash
- */
-static int skeleton_hash(rpc_string name, rpc_string *hash, void *data, int num_args, char *arg_types, int type)
-{
- /* TODO: implement your hash function here. if you have specified any of the HASH_AS_INT constants, simply set
- * hash->str to NULL and set hash->len to the int hash value.
- * arg_types is a zend_parse_parameters() like string containing the types of the parameters passed enabling you
- * to find the best match if you want to hash WITH_SIGNATURE.
- * type is one of CLASS|METHOD|PROPERTY.
- */
- hash->str = strdup(name.str);
- hash->len = name.len;
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ skeleton_name
- */
-static int skeleton_name(rpc_string hash, rpc_string *name, void *data, int type)
-{
- /* TODO: do the opposite of what you did above */
- return FAILURE;
-}
-/* }}} */
-
-/* {{{ skeleton_ctor
- */
-static int skeleton_ctor(rpc_string class_name, void **data, int num_args, zval **args[])
-{
- /* TODO: use *data as a pointer to your internal data. if you want to enable your instances for
- * pooling or to be used as singletons then you have to use malloc() and free() instead of
- * emalloc() and efree() because emalloc()'ed memory will be efree()'ed on script shutdown.
- * ATTENTION: take care about possible memory holes when you use malloc()
- * calls to the handler functions are mutual exclusive per userspace instance, thus if you use
- * the same internal datastructure accross multiple userspace instances of php objects you have
- * to care for thread safety yourself (this again applies only if you want to make your instances
- * poolable/singleton-able), if you have an internal data structure per instance, then you don't
- * have to care for thread safety as the handler functions are locked by a mutex.
- */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ skeleton_dtor
- */
-static int skeleton_dtor(void *data)
-{
- /* TODO: free everything you alloc'ed above */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ skeleton_describe
- */
-static int skeleton_describe(rpc_string method_name, void *data, char **arg_types, unsigned char **ref_types)
-{
- /* TODO: return a zend_parse_parameters() like string in arg_types to describe the
- * parameters taken by the specific function. if one of the parameters should be forced be reference then
- * you have to set ref_types to an array describing the function parameters as you would in the
- * ZEND_FE() macro as the last parameter.
- */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ skeleton_call
- */
-static int skeleton_call(rpc_string method_name, void **data, zval *return_value, int num_args, zval **args[])
-{
- /* TODO: implement call handler. if you passed back an arg_types string in the describe function the arguments
- * are already converted to the corresponding types, if there are too few or too much, a warning is already issued.
- * if arg_types was NULL you have to check for the right parameter count and types yourself.
- */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ skeleton_get
- */
-static int skeleton_get(rpc_string property_name, zval *return_value, void **data)
-{
- /* TODO: implement get handler */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ skeleton_set
- */
-static int skeleton_set(rpc_string property_name, zval *value, void **data)
-{
- /* TODO: implement set handler */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ skeleton_compare
- */
-static int skeleton_compare(void **data1, void **data2)
-{
- /* TODO: implement compare handler */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ skeleton_has_property
- */
-static int skeleton_has_property(rpc_string property_name, void **data)
-{
- /* TODO: implement has property handler */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ skeleton_unset_property
- */
-static int skeleton_unset_property(rpc_string property_name, void **data)
-{
- /* TODO: implement unset property handler */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ skeleton_get_properties
- */
-static int skeleton_get_properties(HashTable **properties, void **data)
-{
- /* TODO: implement get properties handler */
- return SUCCESS;
-}
-/* }}} */
-
-
-/* custom functions */
-ZEND_FUNCTION(skeleton_function)
-{
-}
-
-/*
- * Local variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: sw=4 ts=4 noet
- */
diff --git a/ext/rpc/skeleton/skeleton.h b/ext/rpc/skeleton/skeleton.h
deleted file mode 100644
index cd79721260..0000000000
--- a/ext/rpc/skeleton/skeleton.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef SKELETON_H
-#define SKELETON_H
-
-#include "../handler.h"
-#include "../php_rpc.h"
-
-RPC_DECLARE_HANDLER(skeleton);
-
-ZEND_MINIT_FUNCTION(skeleton);
-ZEND_MSHUTDOWN_FUNCTION(skeleton);
-ZEND_MINFO_FUNCTION(skeleton);
-
-/* TODO: define your functions here */
-ZEND_FUNCTION(skeleton_function);
-/**/
-
-/*
- * Local variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: sw=4 ts=4 noet
- */
-#endif /* SKELETON_H */
diff --git a/ext/rpc/tests/test1.php b/ext/rpc/tests/test1.php
deleted file mode 100644
index b61a4aad5f..0000000000
--- a/ext/rpc/tests/test1.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-$rpc = new com("class");
-
-/* class hirarchy test */
-echo "is class .. " . (get_class($rpc) == "class" ? "passed" : "faiure");
-echo "\n";
-echo "is com .. " . (is_subclass_of($rpc, "com") ? "passed" : "failure");
-echo "\n";
-echo "is rpc .. " . (is_subclass_of($rpc, "rpc") ? "passed" : "failure");
-
-/* uncloneable */
-//$rpc->__clone(); // issues a fatal
-?> \ No newline at end of file
diff --git a/ext/rpc/tests/test2.php b/ext/rpc/tests/test2.php
deleted file mode 100644
index 666033da2a..0000000000
--- a/ext/rpc/tests/test2.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-echo "hash test\n";
-
-/* hash test */
-$rpc1 = new com("hash", true, 1);
-$rpc2 = new com("hash", false, 2);
-$rpc3 = new com("hash", true, 3);
-$rpc4 = com_load("hash", false, 4);
-$rpc5 = com_load("hash", true, 5);
-
-$rpc1->{3} = "hh";
-com_set($rpc2, "hehe", 3);
-
-$rpc1->call("blah");
-$rpc2->call("blah");
-$rpc3->call("blah");
-$rpc4->call("heh");
-$rpc5->call("blah");
-?> \ No newline at end of file
diff --git a/ext/rpc/tests/test3.php b/ext/rpc/tests/test3.php
deleted file mode 100644
index 8fe522cb37..0000000000
--- a/ext/rpc/tests/test3.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-echo "singleton test\n";
-
-/* singleton test */
-$rpc1 = new com("singleton", true, 1);
-com_singleton($rpc1);
-
-$rpc2 = new com("singleton", false, 2);
-$rpc3 = new com("singleton", true, 3);
-$rpc4 = new com("singleton", false, 4);
-$rpc5 = new com("singleton", true, 5);
-
-delete $rpc1;
-delete $rpc2;
-delete $rpc3;
-delete $rpc4;
-delete $rpc5;
-?>
diff --git a/ext/rpc/tests/test4.php b/ext/rpc/tests/test4.php
deleted file mode 100644
index e690273672..0000000000
--- a/ext/rpc/tests/test4.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-echo "pooling test\n";
-
-/* pooling test */
-$rpc = new com("pooling", true, 1);
-com_poolable($rpc);
-delete $rpc;
-
-$rpc = new com("pooling", true, 1);
-delete $rpc;
-
-$rpc = new com("pooling", true, 1);
-delete $rpc;
-
-$rpc = new com("pooling", true, 1);
-delete $rpc;
-?>
diff --git a/ext/rpc/tests/tests.php b/ext/rpc/tests/tests.php
deleted file mode 100644
index 2ea6a7d019..0000000000
--- a/ext/rpc/tests/tests.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-//include_once "test1.php";
-//include_once "test2.php";
-//include_once "test3.php";
-include_once "test4.php";
-?>
diff --git a/ext/rpc/xmlrpc/CREDITS b/ext/rpc/xmlrpc/CREDITS
deleted file mode 100644
index cfb14faf80..0000000000
--- a/ext/rpc/xmlrpc/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-xmlrpc
-Dan Libby
diff --git a/ext/rpc/xmlrpc/EXPERIMENTAL b/ext/rpc/xmlrpc/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/rpc/xmlrpc/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/rpc/xmlrpc/config.m4 b/ext/rpc/xmlrpc/config.m4
deleted file mode 100644
index 712e240470..0000000000
--- a/ext/rpc/xmlrpc/config.m4
+++ /dev/null
@@ -1,93 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-sinclude(ext/xmlrpc/libxmlrpc/acinclude.m4)
-sinclude(ext/xmlrpc/libxmlrpc/xmlrpc.m4)
-sinclude(libxmlrpc/acinclude.m4)
-sinclude(libxmlrpc/xmlrpc.m4)
-
-PHP_ARG_WITH(xmlrpc, for XMLRPC-EPI support,
-[ --with-xmlrpc[=DIR] Include XMLRPC-EPI support.])
-
-PHP_ARG_WITH(expat-dir, libexpat dir for XMLRPC-EPI,
-[ --with-expat-dir=DIR XMLRPC-EPI: libexpat dir for XMLRPC-EPI.],yes,no)
-
-PHP_ARG_WITH(iconv-dir, iconv dir for XMLRPC-EPI,
-[ --with-iconv-dir=DIR XMLRPC-EPI: iconv dir for XMLRPC-EPI.],yes,no)
-
-if test "$PHP_XMLRPC" != "no"; then
-
- PHP_SUBST(XMLRPC_SHARED_LIBADD)
- AC_DEFINE(HAVE_XMLRPC,1,[ ])
-
- testval=no
- for i in /usr /usr/local $PHP_EXPAT_DIR $XMLRPC_DIR; do
- if test -f $i/lib/libexpat.a -o -f $i/lib/libexpat.$SHLIB_SUFFIX_NAME; then
- AC_DEFINE(HAVE_LIBEXPAT2,1,[ ])
- PHP_ADD_LIBRARY_WITH_PATH(expat, $i/lib, XMLRPC_SHARED_LIBADD)
- PHP_ADD_INCLUDE($i/include)
- testval=yes
- fi
- done
-
- if test "$testval" = "no"; then
- AC_MSG_ERROR(XML-RPC support requires libexpat. Use --with-expat-dir=<DIR>)
- fi
-
- if test "$PHP_ICONV_DIR" != "no"; then
- PHP_ICONV=$PHP_ICONV_DIR
- fi
-
- if test "$PHP_ICONV" = "no"; then
- PHP_ICONV=yes
- fi
-
- PHP_SETUP_ICONV(XMLRPC_SHARED_LIBADD, [], [
- AC_MSG_ERROR([iconv not found, in order to build xmlrpc you need the iconv library])
- ])
-fi
-
-
-if test "$PHP_XMLRPC" = "yes"; then
- XMLRPC_CHECKS
- PHP_NEW_EXTENSION(xmlrpc,xmlrpc-epi-php.c libxmlrpc/base64.c \
- libxmlrpc/simplestring.c libxmlrpc/xml_to_dandarpc.c \
- libxmlrpc/xmlrpc_introspection.c libxmlrpc/encodings.c \
- libxmlrpc/system_methods.c libxmlrpc/xml_to_xmlrpc.c \
- libxmlrpc/queue.c libxmlrpc/xml_element.c libxmlrpc/xmlrpc.c \
- libxmlrpc/xml_to_soap.c,$ext_shared,,
- -I@ext_srcdir@/libxmlrpc -DVERSION="0.50")
- PHP_ADD_BUILD_DIR($ext_builddir/libxmlrpc)
- XMLRPC_MODULE_TYPE=builtin
-
-elif test "$PHP_XMLRPC" != "no"; then
-
- if test -r $PHP_XMLRPC/include/xmlrpc.h; then
- XMLRPC_DIR=$PHP_XMLRPC/include
- elif test -r $PHP_XMLRPC/include/xmlrpc-epi/xmlrpc.h; then
-dnl some xmlrpc-epi header files have generic file names like
-dnl queue.h or base64.h. Distributions have to create dir
-dnl for xmlrpc-epi because of this.
- XMLRPC_DIR=$PHP_XMLRPC/include/xmlrpc-epi
- else
- AC_MSG_CHECKING(for XMLRPC-EPI in default path)
- for i in /usr/local /usr; do
- if test -r $i/include/xmlrpc.h; then
- XMLRPC_DIR=$i/include
- AC_MSG_RESULT(found in $i)
- fi
- done
- fi
-
- if test -z "$XMLRPC_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the XMLRPC-EPI distribution)
- fi
-
- PHP_ADD_INCLUDE($XMLRPC_DIR)
- PHP_ADD_LIBRARY_WITH_PATH(xmlrpc, $XMLRPC_DIR/lib, XMLRPC_SHARED_LIBADD)
-
-fi
-
-
diff --git a/ext/rpc/xmlrpc/libxmlrpc/README b/ext/rpc/xmlrpc/libxmlrpc/README
deleted file mode 100644
index 323edfa671..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/README
+++ /dev/null
@@ -1,17 +0,0 @@
-organization of this directory is moving towards this approach:
-
-<module>.h -- public API and data types
-<module>_private.h -- protected API and data types
-<module>.c -- implementation and private API / types
-
-The rules are:
-.c files may include *_private.h.
-.h files may not include *_private.h
-
-This allows us to have a nicely encapsulated C api with opaque data types and private functions
-that are nonetheless shared between source files without redundant extern declarations..
-
-
-
-
-
diff --git a/ext/rpc/xmlrpc/libxmlrpc/acinclude.m4 b/ext/rpc/xmlrpc/libxmlrpc/acinclude.m4
deleted file mode 100644
index 07bf4f0b07..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/acinclude.m4
+++ /dev/null
@@ -1,32 +0,0 @@
-# Local macros for automake & autoconf
-
-AC_DEFUN(XMLRPC_FUNCTION_CHECKS,[
-
-# Standard XMLRPC list
-AC_CHECK_FUNCS( \
- strtoul strtoull snprintf \
- strstr strpbrk strerror\
- memcpy memmove)
-
-])
-
-AC_DEFUN(XMLRPC_HEADER_CHECKS,[
-AC_HEADER_STDC
-AC_CHECK_HEADERS(xmlparse.h xmltok.h stdlib.h strings.h string.h)
-])
-
-AC_DEFUN(XMLRPC_TYPE_CHECKS,[
-
-AC_REQUIRE([AC_C_CONST])
-AC_REQUIRE([AC_C_INLINE])
-AC_CHECK_SIZEOF(char, 1)
-
-AC_CHECK_SIZEOF(int, 4)
-AC_CHECK_SIZEOF(long, 4)
-AC_CHECK_SIZEOF(long long, 8)
-AC_TYPE_SIZE_T
-AC_HEADER_TIME
-AC_TYPE_UID_T
-
-
-])
diff --git a/ext/rpc/xmlrpc/libxmlrpc/base64.c b/ext/rpc/xmlrpc/libxmlrpc/base64.c
deleted file mode 100644
index 6ae8b73c08..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/base64.c
+++ /dev/null
@@ -1,192 +0,0 @@
-static const char rcsid[] = "#(@) $Id$";
-
-/*
-
- Encode or decode file as MIME base64 (RFC 1341)
-
- by John Walker
- http://www.fourmilab.ch/
-
- This program is in the public domain.
-
-*/
-#include <stdio.h>
-
-/* ENCODE -- Encode binary file into base64. */
-#include <stdlib.h>
-#include <ctype.h>
-
-#include "base64.h"
-
-static unsigned char dtable[512];
-
-void buffer_new(struct buffer_st *b)
-{
- b->length = 512;
- b->data = malloc(sizeof(char)*(b->length));
- b->data[0] = 0;
- b->ptr = b->data;
- b->offset = 0;
-}
-
-void buffer_add(struct buffer_st *b, char c)
-{
- *(b->ptr++) = c;
- b->offset++;
- if (b->offset == b->length) {
- b->length += 512;
- b->data = realloc(b->data, b->length);
- b->ptr = b->data + b->offset;
- }
-}
-
-void buffer_delete(struct buffer_st *b)
-{
- free(b->data);
- b->length = 0;
- b->offset = 0;
- b->ptr = NULL;
- b->data = NULL;
-}
-
-void base64_encode(struct buffer_st *b, const char *source, int length)
-{
- int i, hiteof = 0;
- int offset = 0;
- int olen;
-
- olen = 0;
-
- buffer_new(b);
-
- /* Fill dtable with character encodings. */
-
- for (i = 0; i < 26; i++) {
- dtable[i] = 'A' + i;
- dtable[26 + i] = 'a' + i;
- }
- for (i = 0; i < 10; i++) {
- dtable[52 + i] = '0' + i;
- }
- dtable[62] = '+';
- dtable[63] = '/';
-
- while (!hiteof) {
- unsigned char igroup[3], ogroup[4];
- int c, n;
-
- igroup[0] = igroup[1] = igroup[2] = 0;
- for (n = 0; n < 3; n++) {
- c = *(source++);
- offset++;
- if (offset > length) {
- hiteof = 1;
- break;
- }
- igroup[n] = (unsigned char) c;
- }
- if (n > 0) {
- ogroup[0] = dtable[igroup[0] >> 2];
- ogroup[1] = dtable[((igroup[0] & 3) << 4) | (igroup[1] >> 4)];
- ogroup[2] = dtable[((igroup[1] & 0xF) << 2) | (igroup[2] >> 6)];
- ogroup[3] = dtable[igroup[2] & 0x3F];
-
- /* Replace characters in output stream with "=" pad
- characters if fewer than three characters were
- read from the end of the input stream. */
-
- if (n < 3) {
- ogroup[3] = '=';
- if (n < 2) {
- ogroup[2] = '=';
- }
- }
- for (i = 0; i < 4; i++) {
- buffer_add(b, ogroup[i]);
- if (!(b->offset % 72)) {
- // buffer_add(b, '\r');
- buffer_add(b, '\n');
- }
- }
- }
- }
- // buffer_add(b, '\r');
- buffer_add(b, '\n');
-}
-
-void base64_decode(struct buffer_st *bfr, const char *source, int length)
-{
- int i;
- int offset = 0;
- int endoffile;
- int count;
-
- buffer_new(bfr);
-
- for (i = 0; i < 255; i++) {
- dtable[i] = 0x80;
- }
- for (i = 'A'; i <= 'Z'; i++) {
- dtable[i] = 0 + (i - 'A');
- }
- for (i = 'a'; i <= 'z'; i++) {
- dtable[i] = 26 + (i - 'a');
- }
- for (i = '0'; i <= '9'; i++) {
- dtable[i] = 52 + (i - '0');
- }
- dtable['+'] = 62;
- dtable['/'] = 63;
- dtable['='] = 0;
-
- endoffile = 0;
-
- /*CONSTANTCONDITION*/
- while (1) {
- unsigned char a[4], b[4], o[3];
-
- for (i = 0; i < 4; i++) {
- int c;
- while (1) {
- c = *(source++);
- offset++;
- if (offset > length) endoffile = 1;
- if (isspace(c) || c == '\n' || c == '\r') continue;
- break;
- }
-
- if (endoffile) {
- /*
- if (i > 0) {
- fprintf(stderr, "Input file incomplete.\n");
- exit(1);
- }
- */
- return;
- }
-
- if (dtable[c] & 0x80) {
- /*
- fprintf(stderr, "Offset %i length %i\n", offset, length);
- fprintf(stderr, "character '%c:%x:%c' in input file.\n", c, c, dtable[c]);
- exit(1);
- */
- i--;
- continue;
- }
- a[i] = (unsigned char) c;
- b[i] = (unsigned char) dtable[c];
- }
- o[0] = (b[0] << 2) | (b[1] >> 4);
- o[1] = (b[1] << 4) | (b[2] >> 2);
- o[2] = (b[2] << 6) | b[3];
- i = a[2] == '=' ? 1 : (a[3] == '=' ? 2 : 3);
- count = 0;
- while (count < i) {
- buffer_add(bfr, o[count++]);
- }
- if (i < 3) {
- return;
- }
- }
-}
diff --git a/ext/rpc/xmlrpc/libxmlrpc/base64.h b/ext/rpc/xmlrpc/libxmlrpc/base64.h
deleted file mode 100644
index 4cf156ad1e..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/base64.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-
- Encode or decode file as MIME base64 (RFC 1341)
-
- by John Walker
- http://www.fourmilab.ch/
-
- This program is in the public domain.
-
-*/
-
-
-struct buffer_st {
- char *data;
- int length;
- char *ptr;
- int offset;
-};
-
-void buffer_new(struct buffer_st *b);
-void buffer_add(struct buffer_st *b, char c);
-void buffer_delete(struct buffer_st *b);
-
-void base64_encode(struct buffer_st *b, const char *source, int length);
-void base64_decode(struct buffer_st *b, const char *source, int length);
-
-/*
-#define DEBUG_MALLOC
- */
-
-#ifdef DEBUG_MALLOC
-void *_malloc_real(size_t s, char *file, int line);
-void _free_real(void *p, char *file, int line);
-
-#define malloc(s) _malloc_real(s,__FILE__,__LINE__)
-#define free(p) _free_real(p, __FILE__,__LINE__)
-#endif
-
diff --git a/ext/rpc/xmlrpc/libxmlrpc/encodings.c b/ext/rpc/xmlrpc/libxmlrpc/encodings.c
deleted file mode 100644
index 8f7d33ea43..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/encodings.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifndef PHP_WIN32
-#include <php_config.h>
-#else
-#include <config.w32.h>
-#include <stdlib.h>
-#endif
-
-static const char rcsid[] = "#(@) $Id$";
-
-#include <errno.h>
-
-#ifdef HAVE_GICONV_H
-#include <giconv.h>
-#else
-#include <iconv.h>
-#endif
-
-#include "encodings.h"
-
-static char* convert(const char* src, int src_len, int *new_len, const char* from_enc, const char* to_enc) {
- char* outbuf = 0;
-
- if(src && src_len && from_enc && to_enc) {
- int outlenleft = src_len;
- int outlen = src_len;
- int inlenleft = src_len;
- iconv_t ic = iconv_open(to_enc, from_enc);
- char* src_ptr = (char*)src;
- char* out_ptr = 0;
-
- if(ic != (iconv_t)-1) {
- size_t st;
- outbuf = (char*)malloc(outlen + 1);
-
- if(outbuf) {
- out_ptr = (char*)outbuf;
- while(inlenleft) {
- st = iconv(ic, &src_ptr, &inlenleft, &out_ptr, &outlenleft);
- if(st == -1) {
- if(errno == E2BIG) {
- int diff = out_ptr - outbuf;
- outlen += inlenleft;
- outlenleft += inlenleft;
- outbuf = (char*)realloc(outbuf, outlen + 1);
- if(!outbuf) {
- break;
- }
- out_ptr = outbuf + diff;
- }
- else {
- free(outbuf);
- outbuf = 0;
- break;
- }
- }
- }
- }
- iconv_close(ic);
- }
- outlen -= outlenleft;
-
- if(new_len) {
- *new_len = outbuf ? outlen : 0;
- }
- if(outbuf) {
- outbuf[outlen] = 0;
- }
- }
- return outbuf;
-}
-
-/* returns a new string that must be freed */
-char* utf8_encode(const char *s, int len, int *newlen, const char* encoding)
-{
- return convert(s, len, newlen, encoding, "UTF-8");
-}
-
-/* returns a new string, possibly decoded */
-char* utf8_decode(const char *s, int len, int *newlen, const char* encoding)
-{
- return convert(s, len, newlen, "UTF-8", encoding);
-}
-
diff --git a/ext/rpc/xmlrpc/libxmlrpc/encodings.h b/ext/rpc/xmlrpc/libxmlrpc/encodings.h
deleted file mode 100644
index 486360b1be..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/encodings.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-#ifndef __ENCODINGS__H
-#define __ENCODINGS__H
-
-/* these defines are for legacy purposes. */
-#define encoding_utf_8 "UTF-8"
-typedef const char* ENCODING_ID;
-#define utf8_get_encoding_id_string(desired_enc) ((const char*)desired_enc)
-#define utf8_get_encoding_id_from_string(id_string) ((ENCODING_ID)id_string)
-
-char* utf8_encode(const char *s, int len, int *newlen, ENCODING_ID encoding);
-char* utf8_decode(const char *s, int len, int *newlen, ENCODING_ID encoding);
-
-#endif /* __ENCODINGS__H */
diff --git a/ext/rpc/xmlrpc/libxmlrpc/queue.c b/ext/rpc/xmlrpc/libxmlrpc/queue.c
deleted file mode 100644
index 24187383fd..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/queue.c
+++ /dev/null
@@ -1,982 +0,0 @@
-static const char rcsid[] = "#(@) $Id$";
-
-/*
- * Date last modified: Jan 2001
- * Modifications by Dan Libby (dan@libby.com), including:
- * - various fixes, null checks, etc
- * - addition of Q_Iter funcs, macros
- */
-
-
-/*-**************************************************************
- *
- * File : q.c
- *
- * Author: Peter Yard [1993.01.02] -- 02 Jan 1993
- *
- * Disclaimer: This code is released to the public domain.
- *
- * Description:
- * Generic double ended queue (Deque pronounced DEK) for handling
- * any data types, with sorting.
- *
- * By use of various functions in this module the caller
- * can create stacks, queues, lists, doubly linked lists,
- * sorted lists, indexed lists. All lists are dynamic.
- *
- * It is the responsibility of the caller to malloc and free
- * memory for insertion into the queue. A pointer to the object
- * is used so that not only can any data be used but various kinds
- * of data can be pushed on the same queue if one so wished e.g.
- * various length string literals mixed with pointers to structures
- * or integers etc.
- *
- * Enhancements:
- * A future improvement would be the option of multiple "cursors"
- * so that multiple locations could occur in the one queue to allow
- * placemarkers and additional flexibility. Perhaps even use queue
- * itself to have a list of cursors.
- *
- * Usage:
- *
- * /x init queue x/
- * queue q;
- * Q_Init(&q);
- *
- * To create a stack :
- *
- * Q_PushHead(&q, &mydata1); /x push x/
- * Q_PushHead(&q, &mydata2);
- * .....
- * data_ptr = Q_PopHead(&q); /x pop x/
- * .....
- * data_ptr = Q_Head(&q); /x top of stack x/
- *
- * To create a FIFO:
- *
- * Q_PushHead(&q, &mydata1);
- * .....
- * data_ptr = Q_PopTail(&q);
- *
- * To create a double list:
- *
- * data_ptr = Q_Head(&q);
- * ....
- * data_ptr = Q_Next(&q);
- * data_ptr = Q_Tail(&q);
- * if (Q_IsEmpty(&q)) ....
- * .....
- * data_ptr = Q_Previous(&q);
- *
- * To create a sorted list:
- *
- * Q_PushHead(&q, &mydata1); /x push x/
- * Q_PushHead(&q, &mydata2);
- * .....
- * if (!Q_Sort(&q, MyFunction))
- * .. error ..
- *
- * /x fill in key field of mydata1.
- * * NB: Q_Find does linear search
- * x/
- *
- * if (Q_Find(&q, &mydata1, MyFunction))
- * {
- * /x found it, queue cursor now at correct record x/
- * /x can retrieve with x/
- * data_ptr = Q_Get(&q);
- *
- * /x alter data , write back with x/
- * Q_Put(&q, data_ptr);
- * }
- *
- * /x Search with binary search x/
- * if (Q_Seek(&q, &mydata, MyFunction))
- * /x etc x/
- *
- *
- ****************************************************************/
-
-#ifdef _WIN32
-#include "xmlrpc_win32.h"
-#endif
-#include <stdlib.h>
-#include "queue.h"
-
-
-static void QuickSort(void *list[], int low, int high,
- int (*Comp)(const void *, const void *));
-static int Q_BSearch(queue *q, void *key,
- int (*Comp)(const void *, const void *));
-
-/* The index: a pointer to pointers */
-
-static void **index;
-static datanode **posn_index;
-
-
-/***
- *
- ** function : Q_Init
- *
- ** purpose : Initialise queue object and pointers.
- *
- ** parameters : 'queue' pointer.
- *
- ** returns : True_ if init successful else False_
- *
- ** comments :
- ***/
-
-int Q_Init(queue *q)
-{
- if(q) {
- q->head = q->tail = NULL;
- q->cursor = q->head;
- q->size = 0;
- q->sorted = False_;
- }
-
- return True_;
-}
-
-/***
- *
- ** function : Q_AtHead
- *
- ** purpose : tests if cursor is at head of queue
- *
- ** parameters : 'queue' pointer.
- *
- ** returns : boolean - True_ is at head else False_
- *
- ** comments :
- *
- ***/
-
-int Q_AtHead(queue *q)
-{
- return(q && q->cursor == q->head);
-}
-
-
-/***
- *
- ** function : Q_AtTail
- *
- ** purpose : boolean test if cursor at tail of queue
- *
- ** parameters : 'queue' pointer to test.
- *
- ** returns : True_ or False_
- *
- ** comments :
- *
- ***/
-
-int Q_AtTail(queue *q)
-{
- return(q && q->cursor == q->tail);
-}
-
-
-/***
- *
- ** function : Q_IsEmpty
- *
- ** purpose : test if queue has nothing in it.
- *
- ** parameters : 'queue' pointer
- *
- ** returns : True_ if IsEmpty queue, else False_
- *
- ** comments :
- *
- ***/
-
-inline int Q_IsEmpty(queue *q)
-{
- return(!q || q->size == 0);
-}
-
-/***
- *
- ** function : Q_Size
- *
- ** purpose : return the number of elements in the queue
- *
- ** parameters : queue pointer
- *
- ** returns : number of elements
- *
- ** comments :
- *
- ***/
-
-int Q_Size(queue *q)
-{
- return q ? q->size : 0;
-}
-
-
-/***
- *
- ** function : Q_Head
- *
- ** purpose : position queue cursor to first element (head) of queue.
- *
- ** parameters : 'queue' pointer
- *
- ** returns : pointer to data at head. If queue is IsEmpty returns NULL
- *
- ** comments :
- *
- ***/
-
-void *Q_Head(queue *q)
-{
- if(Q_IsEmpty(q))
- return NULL;
-
- q->cursor = q->head;
-
- return q->cursor->data;
-}
-
-
-/***
- *
- ** function : Q_Tail
- *
- ** purpose : locate cursor at tail of queue.
- *
- ** parameters : 'queue' pointer
- *
- ** returns : pointer to data at tail , if queue IsEmpty returns NULL
- *
- ** comments :
- *
- ***/
-
-void *Q_Tail(queue *q)
-{
- if(Q_IsEmpty(q))
- return NULL;
-
- q->cursor = q->tail;
-
- return q->cursor->data;
-}
-
-
-/***
- *
- ** function : Q_PushHead
- *
- ** purpose : put a data pointer at the head of the queue
- *
- ** parameters : 'queue' pointer, void pointer to the data.
- *
- ** returns : True_ if success else False_ if unable to push data.
- *
- ** comments :
- *
- ***/
-
-int Q_PushHead(queue *q, void *d)
-{
- if(q && d) {
- node *n;
- datanode *p;
-
- p = malloc(sizeof(datanode));
- if(p == NULL)
- return False_;
-
- n = q->head;
-
- q->head = (node*)p;
- q->head->prev = NULL;
-
- if(q->size == 0) {
- q->head->next = NULL;
- q->tail = q->head;
- }
- else {
- q->head->next = (datanode*)n;
- n->prev = q->head;
- }
-
- q->head->data = d;
- q->size++;
-
- q->cursor = q->head;
-
- q->sorted = False_;
-
- return True_;
- }
- return False_;
-}
-
-
-
-/***
- *
- ** function : Q_PushTail
- *
- ** purpose : put a data element pointer at the tail of the queue
- *
- ** parameters : queue pointer, pointer to the data
- *
- ** returns : True_ if data pushed, False_ if data not inserted.
- *
- ** comments :
- *
- ***/
-
-int Q_PushTail(queue *q, void *d)
-{
- if(q && d) {
- node *p;
- datanode *n;
-
- n = malloc(sizeof(datanode));
- if(n == NULL)
- return False_;
-
- p = q->tail;
- q->tail = (node *)n;
-
- if(q->size == 0) {
- q->tail->prev = NULL;
- q->head = q->tail;
- }
- else {
- q->tail->prev = (datanode *)p;
- p->next = q->tail;
- }
-
- q->tail->next = NULL;
-
- q->tail->data = d;
- q->cursor = q->tail;
- q->size++;
-
- q->sorted = False_;
-
- return True_;
- }
- return False_;
-}
-
-
-
-/***
- *
- ** function : Q_PopHead
- *
- ** purpose : remove and return the top element at the head of the
- * queue.
- *
- ** parameters : queue pointer
- *
- ** returns : pointer to data element or NULL if queue is IsEmpty.
- *
- ** comments :
- *
- ***/
-
-void *Q_PopHead(queue *q)
-{
- datanode *n;
- void *d;
-
- if(Q_IsEmpty(q))
- return NULL;
-
- d = q->head->data;
- n = q->head->next;
- free(q->head);
-
- q->size--;
-
- if(q->size == 0)
- q->head = q->tail = q->cursor = NULL;
- else {
- q->head = (node *)n;
- q->head->prev = NULL;
- q->cursor = q->head;
- }
-
- q->sorted = False_;
-
- return d;
-}
-
-
-/***
- *
- ** function : Q_PopTail
- *
- ** purpose : remove element from tail of queue and return data.
- *
- ** parameters : queue pointer
- *
- ** returns : pointer to data element that was at tail. NULL if queue
- * IsEmpty.
- *
- ** comments :
- *
- ***/
-
-void *Q_PopTail(queue *q)
-{
- datanode *p;
- void *d;
-
- if(Q_IsEmpty(q))
- return NULL;
-
- d = q->tail->data;
- p = q->tail->prev;
- free(q->tail);
- q->size--;
-
- if(q->size == 0)
- q->head = q->tail = q->cursor = NULL;
- else {
- q->tail = (node *)p;
- q->tail->next = NULL;
- q->cursor = q->tail;
- }
-
- q->sorted = False_;
-
- return d;
-}
-
-
-
-/***
- *
- ** function : Q_Next
- *
- ** purpose : Move to the next element in the queue without popping
- *
- ** parameters : queue pointer.
- *
- ** returns : pointer to data element of new element or NULL if end
- * of the queue.
- *
- ** comments : This uses the cursor for the current position. Q_Next
- * only moves in the direction from the head of the queue
- * to the tail.
- ***/
-
-void *Q_Next(queue *q)
-{
- if(!q)
- return NULL;
-
- if(!q->cursor || q->cursor->next == NULL)
- return NULL;
-
- q->cursor = (node *)q->cursor->next;
-
- return q->cursor->data ;
-}
-
-
-
-/***
- *
- ** function : Q_Previous
- *
- ** purpose : Opposite of Q_Next. Move to next element closer to the
- * head of the queue.
- *
- ** parameters : pointer to queue
- *
- ** returns : pointer to data of new element else NULL if queue IsEmpty
- *
- ** comments : Makes cursor move towards the head of the queue.
- *
- ***/
-
-void *Q_Previous(queue *q)
-{
- if(!q)
- return NULL;
-
- if(q->cursor->prev == NULL)
- return NULL;
-
- q->cursor = (node *)q->cursor->prev;
-
- return q->cursor->data;
-}
-
-
-void *Q_Iter_Del(queue *q, q_iter iter)
-{
- void *d;
- datanode *n, *p;
-
- if(!q)
- return NULL;
-
- if(iter == NULL)
- return NULL;
-
- if(iter == (q_iter)q->head)
- return Q_PopHead(q);
-
- if(iter == (q_iter)q->tail)
- return Q_PopTail(q);
-
- n = ((node*)iter)->next;
- p = ((node*)iter)->prev;
- d = ((node*)iter)->data;
-
- free(iter);
-
- if(p) {
- p->next = n;
- }
- if (q->cursor == (node*)iter) {
- if (p) {
- q->cursor = p;
- } else {
- q->cursor = n;
- }
- }
-
-
- if (n != NULL) {
- n->prev = p;
- }
-
- q->size--;
-
- q->sorted = False_;
-
- return d;
-}
-
-
-
-/***
- *
- ** function : Q_DelCur
- *
- ** purpose : Delete the current queue element as pointed to by
- * the cursor.
- *
- ** parameters : queue pointer
- *
- ** returns : pointer to data element.
- *
- ** comments : WARNING! It is the responsibility of the caller to
- * free any memory. Queue cannot distinguish between
- * pointers to literals and malloced memory.
- *
- ***/
-
-void *Q_DelCur(queue* q) {
- if(q) {
- return Q_Iter_Del(q, (q_iter)q->cursor);
- }
- return 0;
-}
-
-
-/***
- *
- ** function : Q_Destroy
- *
- ** purpose : Free all queue resources
- *
- ** parameters : queue pointer
- *
- ** returns : null.
- *
- ** comments : WARNING! It is the responsibility of the caller to
- * free any memory. Queue cannot distinguish between
- * pointers to literals and malloced memory.
- *
- ***/
-
-void Q_Destroy(queue *q)
-{
- while(!Q_IsEmpty(q)) {
- Q_PopHead(q);
- }
-}
-
-
-/***
- *
- ** function : Q_Get
- *
- ** purpose : get the pointer to the data at the cursor location
- *
- ** parameters : queue pointer
- *
- ** returns : data element pointer
- *
- ** comments :
- *
- ***/
-
-void *Q_Get(queue *q)
-{
- if(!q)
- return NULL;
-
- if(q->cursor == NULL)
- return NULL;
- return q->cursor->data;
-}
-
-
-
-/***
- *
- ** function : Q_Put
- *
- ** purpose : replace pointer to data with new pointer to data.
- *
- ** parameters : queue pointer, data pointer
- *
- ** returns : boolean- True_ if successful, False_ if cursor at NULL
- *
- ** comments :
- *
- ***/
-
-int Q_Put(queue *q, void *data)
-{
- if(q && data) {
- if(q->cursor == NULL)
- return False_;
-
- q->cursor->data = data;
- return True_;
- }
- return False_;
-}
-
-
-/***
- *
- ** function : Q_Find
- *
- ** purpose : Linear search of queue for match with key in *data
- *
- ** parameters : queue pointer q, data pointer with data containing key
- * comparison function here called Comp.
- *
- ** returns : True_ if found , False_ if not in queue.
- *
- ** comments : Useful for small queues that are constantly changing
- * and would otherwise need constant sorting with the
- * Q_Seek function.
- * For description of Comp see Q_Sort.
- * Queue cursor left on position found item else at end.
- *
- ***/
-
-int Q_Find(queue *q, void *data,
- int (*Comp)(const void *, const void *))
-{
- void *d;
-
- if (q == NULL) {
- return False_;
- }
-
- d = Q_Head(q);
- do {
- if(Comp(d, data) == 0)
- return True_;
- d = Q_Next(q);
- } while(!Q_AtTail(q));
-
- if(Comp(d, data) == 0)
- return True_;
-
- return False_;
-}
-
-/*======== Sorted Queue and Index functions ========= */
-
-
-static void QuickSort(void *list[], int low, int high,
- int (*Comp)(const void *, const void *))
-{
- int flag = 1, i, j;
- void *key, *temp;
-
- if(low < high) {
- i = low;
- j = high + 1;
-
- key = list[ low ];
-
- while(flag) {
- i++;
- while(Comp(list[i], key) < 0)
- i++;
-
- j--;
- while(Comp(list[j], key) > 0)
- j--;
-
- if(i < j) {
- temp = list[i];
- list[i] = list[j];
- list[j] = temp;
- }
- else flag = 0;
- }
-
- temp = list[low];
- list[low] = list[j];
- list[j] = temp;
-
- QuickSort(list, low, j-1, Comp);
- QuickSort(list, j+1, high, Comp);
- }
-}
-
-
-/***
- *
- ** function : Q_Sort
- *
- ** purpose : sort the queue and allow index style access.
- *
- ** parameters : queue pointer, comparison function compatible with
- * with 'qsort'.
- *
- ** returns : True_ if sort succeeded. False_ if error occurred.
- *
- ** comments : Comp function supplied by caller must return
- * -1 if data1 < data2
- * 0 if data1 == data2
- * +1 if data1 > data2
- *
- * for Comp(data1, data2)
- *
- * If queue is already sorted it frees the memory of the
- * old index and starts again.
- *
- ***/
-
-int Q_Sort(queue *q, int (*Comp)(const void *, const void *))
-{
- int i;
- void *d;
- datanode *dn;
-
- /* if already sorted free memory for tag array */
-
- if(q->sorted) {
- free(index);
- free(posn_index);
- q->sorted = False_;
- }
-
- /* Now allocate memory of array, array of pointers */
-
- index = malloc(q->size * sizeof(q->cursor->data));
- if(index == NULL)
- return False_;
-
- posn_index = malloc(q->size * sizeof(q->cursor));
- if(posn_index == NULL) {
- free(index);
- return False_;
- }
-
- /* Walk queue putting pointers into array */
-
- d = Q_Head(q);
- for(i=0; i < q->size; i++) {
- index[i] = d;
- posn_index[i] = q->cursor;
- d = Q_Next(q);
- }
-
- /* Now sort the index */
-
- QuickSort(index, 0, q->size - 1, Comp);
-
- /* Rearrange the actual queue into correct order */
-
- dn = q->head;
- i = 0;
- while(dn != NULL) {
- dn->data = index[i++];
- dn = dn->next;
- }
-
- /* Re-position to original element */
-
- if(d != NULL)
- Q_Find(q, d, Comp);
- else Q_Head(q);
-
- q->sorted = True_;
-
- return True_;
-}
-
-
-/***
- *
- ** function : Q_BSearch
- *
- ** purpose : binary search of queue index for node containing key
- *
- ** parameters : queue pointer 'q', data pointer of key 'key',
- * Comp comparison function.
- *
- ** returns : integer index into array of node pointers,
- * or -1 if not found.
- *
- ** comments : see Q_Sort for description of 'Comp' function.
- *
- ***/
-
-static int Q_BSearch( queue *q, void *key,
- int (*Comp)(const void *, const void*))
-{
- int low, mid, hi, val;
-
- low = 0;
- hi = q->size - 1;
-
- while(low <= hi) {
- mid = (low + hi) / 2;
- val = Comp(key, index[ mid ]);
-
- if(val < 0)
- hi = mid - 1;
-
- else if(val > 0)
- low = mid + 1;
-
- else /* Success */
- return mid;
- }
-
- /* Not Found */
-
- return -1;
-}
-
-
-/***
- *
- ** function : Q_Seek
- *
- ** purpose : use index to locate data according to key in 'data'
- *
- ** parameters : queue pointer 'q', data pointer 'data', Comp comparison
- * function.
- *
- ** returns : pointer to data or NULL if could not find it or could
- * not sort queue.
- *
- ** comments : see Q_Sort for description of 'Comp' function.
- *
- ***/
-
-void *Q_Seek(queue *q, void *data, int (*Comp)(const void *, const void *))
-{
- int idx;
-
- if (q == NULL) {
- return NULL;
- }
-
- if(!q->sorted) {
- if(!Q_Sort(q, Comp))
- return NULL;
- }
-
- idx = Q_BSearch(q, data, Comp);
-
- if(idx < 0)
- return NULL;
-
- q->cursor = posn_index[idx];
-
- return index[idx];
-}
-
-
-
-/***
- *
- ** function : Q_Insert
- *
- ** purpose : Insert an element into an indexed queue
- *
- ** parameters : queue pointer 'q', data pointer 'data', Comp comparison
- * function.
- *
- ** returns : pointer to data or NULL if could not find it or could
- * not sort queue.
- *
- ** comments : see Q_Sort for description of 'Comp' function.
- * WARNING! This code can be very slow since each new
- * element means a new Q_Sort. Should only be used for
- * the insertion of the odd element ,not the piecemeal
- * building of an entire queue.
- ***/
-
-int Q_Insert(queue *q, void *data, int (*Comp)(const void *, const void *))
-{
- if (q == NULL) {
- return False_;
- }
-
- Q_PushHead(q, data);
-
- if(!Q_Sort(q, Comp))
- return False_;
-
- return True_;
-}
-
-/* read only funcs for iterating through queue. above funcs modify queue */
-q_iter Q_Iter_Head(queue *q) {
- return q ? (q_iter)q->head : NULL;
-}
-
-q_iter Q_Iter_Tail(queue *q) {
- return q ? (q_iter)q->tail : NULL;
-}
-
-q_iter Q_Iter_Next(q_iter qi) {
- return qi ? (q_iter)((node*)qi)->next : NULL;
-}
-
-q_iter Q_Iter_Prev(q_iter qi) {
- return qi ? (q_iter)((node*)qi)->prev : NULL;
-}
-
-void * Q_Iter_Get(q_iter qi) {
- return qi ? ((node*)qi)->data : NULL;
-}
-
-int Q_Iter_Put(q_iter qi, void* data) {
- if(qi) {
- ((node*)qi)->data = data;
- return True_;
- }
- return False_;
-}
diff --git a/ext/rpc/xmlrpc/libxmlrpc/queue.h b/ext/rpc/xmlrpc/libxmlrpc/queue.h
deleted file mode 100644
index e850b57e6c..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/queue.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Date last modified: Jan 2001
- * Modifications by Dan Libby (dan@libby.com), including:
- * - various fixes, null checks, etc
- * - addition of Q_Iter funcs, macros
- */
-
-/*
- * File : q.h
- *
- * Peter Yard 02 Jan 1993.
- *
- * Disclaimer: This code is released to the public domain.
- */
-
-#ifndef Q__H
-#define Q__H
-
-#ifndef False_
- #define False_ 0
-#endif
-
-#ifndef True_
- #define True_ 1
-#endif
-
-typedef struct nodeptr datanode;
-
-typedef struct nodeptr {
- void *data ;
- datanode *prev, *next ;
-} node ;
-
-/* For external use with Q_Iter* funcs */
-typedef struct nodeptr* q_iter;
-
-typedef struct {
- node *head, *tail, *cursor;
- int size, sorted, item_deleted;
-} queue;
-
-typedef struct {
- void *dataptr;
- node *loc ;
-} index_elt ;
-
-
-int Q_Init(queue *q);
-void Q_Destroy(queue *q);
-int Q_IsEmpty(queue *q);
-int Q_Size(queue *q);
-int Q_AtHead(queue *q);
-int Q_AtTail(queue *q);
-int Q_PushHead(queue *q, void *d);
-int Q_PushTail(queue *q, void *d);
-void *Q_Head(queue *q);
-void *Q_Tail(queue *q);
-void *Q_PopHead(queue *q);
-void *Q_PopTail(queue *q);
-void *Q_Next(queue *q);
-void *Q_Previous(queue *q);
-void *Q_DelCur(queue *q);
-void *Q_Get(queue *q);
-int Q_Put(queue *q, void *data);
-int Q_Sort(queue *q, int (*Comp)(const void *, const void *));
-int Q_Find(queue *q, void *data,
- int (*Comp)(const void *, const void *));
-void *Q_Seek(queue *q, void *data,
- int (*Comp)(const void *, const void *));
-int Q_Insert(queue *q, void *data,
- int (*Comp)(const void *, const void *));
-
-/* read only funcs for iterating through queue. above funcs modify queue */
-q_iter Q_Iter_Head(queue *q);
-q_iter Q_Iter_Tail(queue *q);
-q_iter Q_Iter_Next(q_iter qi);
-q_iter Q_Iter_Prev(q_iter qi);
-void* Q_Iter_Get(q_iter qi);
-int Q_Iter_Put(q_iter qi, void* data); // not read only! here for completeness.
-void* Q_Iter_Del(queue *q, q_iter iter); // not read only! here for completeness.
-
-/* Fast (macro'd) versions of above */
-#define Q_Iter_Head_F(q) (q ? (q_iter)((queue*)q)->head : NULL)
-#define Q_Iter_Tail_F(q) (q ? (q_iter)((queue*)q)->tail : NULL)
-#define Q_Iter_Next_F(qi) (qi ? (q_iter)((node*)qi)->next : NULL)
-#define Q_Iter_Prev_F(qi) (qi ? (q_iter)((node*)qi)->prev : NULL)
-#define Q_Iter_Get_F(qi) (qi ? ((node*)qi)->data : NULL)
-
-#endif /* Q__H */
diff --git a/ext/rpc/xmlrpc/libxmlrpc/simplestring.c b/ext/rpc/xmlrpc/libxmlrpc/simplestring.c
deleted file mode 100644
index 011c253225..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/simplestring.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-static const char rcsid[] = "#(@) $Id$";
-
-
-#define SIMPLESTRING_INCR 32
-
-/****h* ABOUT/simplestring
- * NAME
- * simplestring
- * AUTHOR
- * Dan Libby, aka danda (dan@libby.com)
- * CREATION DATE
- * 06/2000
- * HISTORY
- * $Log$
- * Revision 1.2 2002/07/05 04:43:53 danda
- * merged in updates from SF project. bring php repository up to date with xmlrpc-epi version 0.51
- *
- * Revision 1.4 2002/02/13 20:58:50 danda
- * patch to make source more windows friendly, contributed by Jeff Lawson
- *
- * Revision 1.3 2001/09/29 21:58:05 danda
- * adding cvs log to history section
- *
- * 10/15/2000 -- danda -- adding robodoc documentation
- * PORTABILITY
- * Coded on RedHat Linux 6.2. Builds on Solaris x86. Should build on just
- * about anything with minor mods.
- * NOTES
- * This code was written primarily for xmlrpc, but has found some other uses.
- *
- * simplestring is, as the name implies, a simple API for dealing with C strings.
- * Why would I write yet another string API? Because I couldn't find any that were
- * a) free / GPL, b) simple/lightweight, c) fast, not doing unneccesary strlens all
- * over the place. So. It is simple, and it seems to work, and it is pretty fast.
- *
- * Oh, and it is also binary safe, ie it can handle strings with embedded NULLs,
- * so long as the real length is passed in.
- *
- * And the masses rejoiced.
- *
- * BUGS
- * there must be some.
- ******/
-
-#include <stdlib.h>
-#include "simplestring.h"
-
-#define my_free(thing) if(thing) {free(thing); thing = 0;}
-
-/*----------------------**
-* Begin String Functions *
-*-----------------------*/
-
-/****f* FUNC/simplestring_init
- * NAME
- * simplestring_init
- * SYNOPSIS
- * void simplestring_init(simplestring* string)
- * FUNCTION
- * initialize string
- * INPUTS
- * string - pointer to a simplestring struct that will be initialized
- * RESULT
- * void
- * NOTES
- * SEE ALSO
- * simplestring_free ()
- * simplestring_clear ()
- * SOURCE
- */
-void simplestring_init(simplestring* string) {
- memset(string, 0, sizeof(simplestring));
-}
-/******/
-
-static void simplestring_init_str(simplestring* string) {
- string->str = (char*)malloc(SIMPLESTRING_INCR);
- if(string->str) {
- string->str[0] = 0;
- string->len = 0;
- string->size = SIMPLESTRING_INCR;
- }
- else {
- string->size = 0;
- }
-}
-
-/****f* FUNC/simplestring_clear
- * NAME
- * simplestring_clear
- * SYNOPSIS
- * void simplestring_clear(simplestring* string)
- * FUNCTION
- * clears contents of a string
- * INPUTS
- * string - the string value to clear
- * RESULT
- * void
- * NOTES
- * This function is very fast as it does not de-allocate any memory.
- * SEE ALSO
- *
- * SOURCE
- */
-void simplestring_clear(simplestring* string) {
- if(string->str) {
- string->str[0] = 0;
- }
- string->len = 0;
-}
-/******/
-
-/****f* FUNC/simplestring_free
- * NAME
- * simplestring_free
- * SYNOPSIS
- * void simplestring_free(simplestring* string)
- * FUNCTION
- * frees contents of a string, if any. Does *not* free the simplestring struct itself.
- * INPUTS
- * string - value containing string to be free'd
- * RESULT
- * void
- * NOTES
- * caller is responsible for allocating and freeing simplestring* struct itself.
- * SEE ALSO
- * simplestring_init ()
- * SOURCE
- */
-void simplestring_free(simplestring* string) {
- if(string && string->str) {
- my_free(string->str);
- string->len = 0;
- }
-}
-/******/
-
-/****f* FUNC/simplestring_addn
- * NAME
- * simplestring_addn
- * SYNOPSIS
- * void simplestring_addn(simplestring* string, const char* add, int add_len)
- * FUNCTION
- * copies n characters from source to target string
- * INPUTS
- * target - target string
- * source - source string
- * add_len - number of characters to copy
- * RESULT
- * void
- * NOTES
- * SEE ALSO
- * simplestring_add ()
- * SOURCE
- */
-void simplestring_addn(simplestring* target, const char* source, int add_len) {
- if(target && source) {
- if(!target->str) {
- simplestring_init_str(target);
- }
- if(target->len + add_len + 1 > target->size) {
- /* newsize is current length + new length */
- int newsize = target->len + add_len + 1;
- int incr = target->size * 2;
-
- /* align to SIMPLESTRING_INCR increments */
- newsize = newsize - (newsize % incr) + incr;
- target->str = (char*)realloc(target->str, newsize);
-
- target->size = target->str ? newsize : 0;
- }
-
- if(target->str) {
- if(add_len) {
- memcpy(target->str + target->len, source, add_len);
- }
- target->len += add_len;
- target->str[target->len] = 0; /* null terminate */
- }
- }
-}
-/******/
-
-/****f* FUNC/simplestring_add
- * NAME
- * simplestring_add
- * SYNOPSIS
- * void simplestring_add(simplestring* string, const char* add)
- * FUNCTION
- * appends a string of unknown length from source to target
- * INPUTS
- * target - the target string to append to
- * source - the source string of unknown length
- * RESULT
- * void
- * NOTES
- * SEE ALSO
- * simplestring_addn ()
- * SOURCE
- */
-void simplestring_add(simplestring* target, const char* source) {
- if(target && source) {
- simplestring_addn(target, source, strlen(source));
- }
-}
-/******/
-
-
-/*----------------------
-* End String Functions *
-*--------------------**/
diff --git a/ext/rpc/xmlrpc/libxmlrpc/simplestring.h b/ext/rpc/xmlrpc/libxmlrpc/simplestring.h
deleted file mode 100644
index c5d98cf1d8..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/simplestring.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-#ifndef __SIMPLESTRING_H__
- #define __SIMPLESTRING_H__
-
-/*-********************************
-* begin simplestring header stuff *
-**********************************/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /****s* struct/simplestring
- * NAME
- * simplestring
- * NOTES
- * represents a string efficiently for fast appending, etc.
- * SOURCE
- */
-typedef struct _simplestring {
- char* str; /* string buf */
- int len; /* length of string/buf */
- int size; /* size of allocated buffer */
-} simplestring;
-/******/
-
-#ifndef NULL
- #define NULL 0
-#endif
-
-void simplestring_init(simplestring* string);
-void simplestring_clear(simplestring* string);
-void simplestring_free(simplestring* string);
-void simplestring_add(simplestring* string, const char* add);
-void simplestring_addn(simplestring* string, const char* add, int add_len);
-
-#ifdef __cplusplus
-}
-#endif
-
-/*-******************************
-* end simplestring header stuff *
-********************************/
-
-#endif /* __SIMPLESTRING_H__ */
diff --git a/ext/rpc/xmlrpc/libxmlrpc/system_methods.c b/ext/rpc/xmlrpc/libxmlrpc/system_methods.c
deleted file mode 100644
index c47236df14..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/system_methods.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2001 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-/****h* ABOUT/system_methods
- * AUTHOR
- * Dan Libby, aka danda (dan@libby.com)
- * HISTORY
- * $Log$
- * Revision 1.7 2001/09/29 21:58:05 danda
- * adding cvs log to history section
- *
- * 4/28/2001 -- danda -- adding system.multicall and separating out system methods.
- * TODO
- * NOTES
- *******/
-
-
-#include "queue.h"
-#include "xmlrpc.h"
-#include "xmlrpc_private.h"
-#include "xmlrpc_introspection_private.h"
-#include "system_methods_private.h"
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-
-static const char* xsm_introspection_xml =
-"<?xml version='1.0' ?>"
-
-"<introspection version='1.0'>"
- "<typeList>"
-
- "<typeDescription name='system.value' basetype='struct' desc='description of a value'>"
- "<value type='string' name='name' optional='yes'>value identifier</value>"
- "<value type='string' name='type'>value&apos;s xmlrpc or user-defined type</value>"
- "<value type='string' name='description'>value&apos;s textual description</value> "
- "<value type='boolean' name='optional'>true if value is optional, else it is required</value> "
- "<value type='any' name='member' optional='yes'>a child of this element. n/a for scalar types</value> "
- "</typeDescription>"
-
- "<typeDescription name='system.valueList' basetype='array' desc='list of value descriptions'>"
- "<value type='system.value'/>"
- "</typeDescription>"
-
- "<typeDescription name='system.stringList' basetype='array' desc='list of strings'>"
- "<value type='string'/>"
- "</typeDescription>"
-
-
- "</typeList>"
-
- "<methodList>"
-
- "<!-- system.describeMethods -->"
- "<methodDescription name='system.describeMethods'>"
- "<author>Dan Libby</author>"
- "<purpose>fully describes the methods and types implemented by this XML-RPC server.</purpose>"
- "<version>1.1</version>"
- "<signatures>"
- "<signature>"
- "<params>"
- "<value type='array' name='methodList' optional='yes' desc='a list of methods to be described. if omitted, all are described.'>"
- "<value type='string'>a valid method name</value>"
- "</value>"
- "</params>"
- "<returns>"
- "<value type='struct' desc='contains methods list and types list'>"
- "<value type='array' name='methodList' desc='a list of methods'>"
- "<value type='struct' desc='representation of a single method'>"
- "<value type='string' name='name'>method name</value>"
- "<value type='string' name='version' optional='yes'>method version</value>"
- "<value type='string' name='author' optional='yes'>method author</value>"
- "<value type='string' name='purpose' optional='yes'>method purpose</value>"
- "<value type='array' name='signatures' desc='list of method signatures'>"
- "<value type='struct' desc='representation of a single signature'>"
- "<value type='system.valueList' name='params' optional='yes'>parameter list</value>"
- "<value type='system.valueList' name='returns' optional='yes'>return value list</value>"
- "</value>"
- "</value>"
- "<value type='system.stringList' name='bugs' optional='yes'>list of known bugs</value>"
- "<value type='system.stringList' name='errors' optional='yes'>list of possible errors and error codes</value>"
- "<value type='system.stringList' name='examples' optional='yes'>list of examples</value>"
- "<value type='system.stringList' name='history' optional='yes'>list of modifications</value>"
- "<value type='system.stringList' name='notes' optional='yes'>list of notes</value>"
- "<value type='system.stringList' name='see' optional='yes'>see also. list of related methods</value>"
- "<value type='system.stringList' name='todo' optional='yes'>list of unimplemented features</value>"
- "</value>"
- "</value>"
- "<value type='array' name='typeList' desc='a list of type descriptions. Typically used for referencing complex types'>"
- "<value type='system.value'>a type description</value>"
- "</value>"
- "</value>"
- "</returns>"
- "</signature>"
- "</signatures>"
- "<see>"
- "<item name='system.listMethods' />"
- "<item name='system.methodSignature' />"
- "<item name='system.methodHelp' />"
- "</see>"
- "<example/>"
- "<error/>"
- "<note/>"
- "<bug/>"
- "<todo/>"
- "</methodDescription>"
-
- "<!-- system.listMethods -->"
- "<methodDescription name='system.listMethods'>"
- "<author>Dan Libby</author>"
- "<purpose>enumerates the methods implemented by this XML-RPC server.</purpose>"
- "<version>1.0</version>"
- "<signatures>"
- "<signature>"
- "<returns>"
- "<value type='array' desc='an array of strings'>"
- "<value type='string'>name of a method implemented by the server.</value>"
- "</value>"
- "</returns>"
- "</signature>"
- "</signatures>"
- "<see>"
- "<item name='system.describeMethods' />"
- "<item name='system.methodSignature' />"
- "<item name='system.methodHelp' />"
- "</see>"
- "<example/>"
- "<error/>"
- "<note/>"
- "<bug/>"
- "<todo/>"
- "</methodDescription>"
-
- "<!-- system.methodHelp -->"
- "<methodDescription name='system.methodHelp'>"
- "<author>Dan Libby</author>"
- "<purpose>provides documentation string for a single method</purpose>"
- "<version>1.0</version>"
- "<signatures>"
- "<signature>"
- "<params>"
- "<value type='string' name='methodName'>name of the method for which documentation is desired</value>"
- "</params>"
- "<returns>"
- "<value type='string'>help text if defined for the method passed, otherwise an empty string</value>"
- "</returns>"
- "</signature>"
- "</signatures>"
- "<see>"
- "<item name='system.listMethods' />"
- "<item name='system.methodSignature' />"
- "<item name='system.methodHelp' />"
- "</see>"
- "<example/>"
- "<error/>"
- "<note/>"
- "<bug/>"
- "<todo/>"
- "</methodDescription>"
-
- "<!-- system.methodSignature -->"
- "<methodDescription name='system.methodSignature'>"
- "<author>Dan Libby</author>"
- "<purpose>provides 1 or more signatures for a single method</purpose>"
- "<version>1.0</version>"
- "<signatures>"
- "<signature>"
- "<params>"
- "<value type='string' name='methodName'>name of the method for which documentation is desired</value>"
- "</params>"
- "<returns>"
- "<value type='array' desc='a list of arrays, each representing a signature'>"
- "<value type='array' desc='a list of strings. the first element represents the method return value. subsequent elements represent parameters.'>"
- "<value type='string'>a string indicating the xmlrpc type of a value. one of: string, int, double, base64, datetime, array, struct</value>"
- "</value>"
- "</value>"
- "</returns>"
- "</signature>"
- "</signatures>"
- "<see>"
- "<item name='system.listMethods' />"
- "<item name='system.methodHelp' />"
- "<item name='system.describeMethods' />"
- "</see>"
- "<example/>"
- "<error/>"
- "<note/>"
- "<bug/>"
- "<todo/>"
- "</methodDescription>"
-
- "<!-- system.multiCall -->"
- "<methodDescription name='system.multiCall'>"
- "<author>Dan Libby</author>"
- "<purpose>executes multiple methods in sequence and returns the results</purpose>"
- "<version>1.0</version>"
- "<signatures>"
- "<signature>"
- "<params>"
- "<value type='array' name='methodList' desc='an array of method call structs'>"
- "<value type='struct' desc='a struct representing a single method call'>"
- "<value type='string' name='methodName' desc='name of the method to be executed'/>"
- "<value type='array' name='params' desc='an array representing the params to a method. sub-elements should match method signature'/>"
- "</value>"
- "</value>"
- "</params>"
- "<returns>"
- "<value type='array' desc='an array of method responses'>"
- "<value type='array' desc='an array containing a single value, which is the method&apos;s response'/>"
- "</value>"
- "</returns>"
- "</signature>"
- "</signatures>"
- "<see>"
- "<item name='system.listMethods' />"
- "<item name='system.methodHelp' />"
- "<item name='system.describeMethods' />"
- "</see>"
- "<example/>"
- "<error/>"
- "<note/>"
- "<bug/>"
- "<todo/>"
- "</methodDescription>"
-
- "<!-- system.getCapabilities -->"
- "<methodDescription name='system.getCapabilities'>"
- "<author>Dan Libby</author>"
- "<purpose>returns a list of capabilities supported by this server</purpose>"
- "<version>1.0</version>"
- "<notes><item>spec url: http://groups.yahoo.com/group/xml-rpc/message/2897</item></notes>"
- "<signatures>"
- "<signature>"
- "<returns>"
- "<value type='struct' desc='list of capabilities, each with a unique key defined by the capability&apos;s spec'>"
- "<value type='struct' desc='definition of a single capability'>"
- "<value type='string' name='specURL'>www address of the specification defining this capability</value>"
- "<value type='int' name='specVersion'>version of the spec that this server's implementation conforms to</value>"
- "</value>"
- "</value>"
- "</returns>"
- "</signature>"
- "</signatures>"
- "<see>"
- "<item name='system.listMethods' />"
- "<item name='system.methodHelp' />"
- "<item name='system.describeMethods' />"
- "</see>"
- "<example/>"
- "<error/>"
- "<note/>"
- "<bug/>"
- "<todo/>"
- "</methodDescription>"
-
- "</methodList>"
-"</introspection>";
-
-
-/* forward declarations for static (non public, non api) funcs */
-static XMLRPC_VALUE xsm_system_multicall_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData);
-static XMLRPC_VALUE xsm_system_get_capabilities_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData);
-
-/*-*******************
-* System Methods API *
-*********************/
-
-static void xsm_lazy_doc_methods_cb(XMLRPC_SERVER server, void* userData) {
- XMLRPC_VALUE xDesc = XMLRPC_IntrospectionCreateDescription(xsm_introspection_xml, NULL);
- XMLRPC_ServerAddIntrospectionData(server, xDesc);
- XMLRPC_CleanupValue(xDesc);
-}
-
-void xsm_register(XMLRPC_SERVER server) {
- xi_register_system_methods(server);
-
- XMLRPC_ServerRegisterMethod(server, xsm_token_system_multicall, xsm_system_multicall_cb);
- XMLRPC_ServerRegisterMethod(server, xsm_token_system_get_capabilities, xsm_system_get_capabilities_cb);
-
- /* callback for documentation generation should it be requested */
- XMLRPC_ServerRegisterIntrospectionCallback(server, xsm_lazy_doc_methods_cb);
-}
-
-XMLRPC_VALUE xsm_system_multicall_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData) {
- XMLRPC_VALUE xArray = XMLRPC_VectorRewind(XMLRPC_RequestGetData(input));
- XMLRPC_VALUE xReturn = XMLRPC_CreateVector(0, xmlrpc_vector_array);
-
- if (xArray) {
- XMLRPC_VALUE xMethodIter = XMLRPC_VectorRewind(xArray);
-
- while (xMethodIter) {
- XMLRPC_REQUEST request = XMLRPC_RequestNew();
- if(request) {
- const char* methodName = XMLRPC_VectorGetStringWithID(xMethodIter, "methodName");
- XMLRPC_VALUE params = XMLRPC_VectorGetValueWithID(xMethodIter, "params");
-
- if(methodName && params) {
- XMLRPC_VALUE xRandomArray = XMLRPC_CreateVector(0, xmlrpc_vector_array);
- XMLRPC_RequestSetMethodName(request, methodName);
- XMLRPC_RequestSetData(request, params);
- XMLRPC_RequestSetRequestType(request, xmlrpc_request_call);
-
- XMLRPC_AddValueToVector(xRandomArray,
- XMLRPC_ServerCallMethod(server, request, userData));
-
- XMLRPC_AddValueToVector(xReturn, xRandomArray);
- }
- XMLRPC_RequestFree(request, 1);
- }
- xMethodIter = XMLRPC_VectorNext(xArray);
- }
- }
- return xReturn;
-}
-
-
-XMLRPC_VALUE xsm_system_get_capabilities_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData) {
- XMLRPC_VALUE xReturn = XMLRPC_CreateVector(0, xmlrpc_vector_struct);
- XMLRPC_VALUE xFaults = XMLRPC_CreateVector("faults_interop", xmlrpc_vector_struct);
- XMLRPC_VALUE xIntro = XMLRPC_CreateVector("introspection", xmlrpc_vector_struct);
-
- /* support for fault spec */
- XMLRPC_VectorAppendString(xFaults, "specURL", "http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php", 0);
- XMLRPC_VectorAppendInt(xFaults, "specVersion", 20010516);
-
- /* support for introspection spec */
- XMLRPC_VectorAppendString(xIntro, "specURL", "http://xmlrpc-epi.sourceforge.net/specs/rfc.introspection.php", 0);
- XMLRPC_VectorAppendInt(xIntro, "specVersion", 20010516);
-
- XMLRPC_AddValuesToVector(xReturn,
- xFaults,
- xIntro,
- NULL);
-
- return xReturn;
-
-}
-
-/*-***********************
-* End System Methods API *
-*************************/
-
-
-
diff --git a/ext/rpc/xmlrpc/libxmlrpc/system_methods_private.h b/ext/rpc/xmlrpc/libxmlrpc/system_methods_private.h
deleted file mode 100644
index 72408fd3c4..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/system_methods_private.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2001 Dan Libby, Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-/* IMPORTANT!
- *
- * only non-public things should be in this file. It is fine for any .c file
- * in xmlrpc/src to include it, but users of the public API should never
- * include it, and thus *.h files that are part of the public API should
- * never include it, or they would break if this file is not present.
- */
-
-
-#ifndef __SYSTEM_METHODS_PRIVATE_H
-/*
- * Avoid include redundancy.
- */
-#define __SYSTEM_METHODS_PRIVATE_H
-
-/*----------------------------------------------------------------------------
- * system_methods_private.h
- *
- * Purpose:
- * define non-public system.* methods
- * Comments:
- * xsm = xmlrpc system methods
- */
-
-/*----------------------------------------------------------------------------
- * Constants
- */
-#define xsm_token_system_multicall "system.multiCall"
-#define xsm_token_system_get_capabilities "system.getCapabilities"
-
-
-/*----------------------------------------------------------------------------
- * Includes
- */
-
-/*----------------------------------------------------------------------------
- * Structures
- */
-
-/*----------------------------------------------------------------------------
- * Globals
- */
-
-/*----------------------------------------------------------------------------
- * Functions
- */
-void xsm_register(XMLRPC_SERVER server);
-int xsm_is_system_method(XMLRPC_Callback cb);
-
-/*----------------------------------------------------------------------------
- * Macros
- */
-
-
-#endif /* __SYSTEM_METHODS_PRIVATE_H */
-
-
-
-
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xml_element.c b/ext/rpc/xmlrpc/libxmlrpc/xml_element.c
deleted file mode 100644
index 3b2335c408..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xml_element.c
+++ /dev/null
@@ -1,734 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-static const char rcsid[] = "#(@) $Id$";
-
-
-
-/****h* ABOUT/xml_element
- * NAME
- * xml_element
- * AUTHOR
- * Dan Libby, aka danda (dan@libby.com)
- * CREATION DATE
- * 06/2000
- * HISTORY
- * $Log$
- * Revision 1.3 2002/07/05 04:43:53 danda
- * merged in updates from SF project. bring php repository up to date with xmlrpc-epi version 0.51
- *
- * Revision 1.9 2002/07/03 20:54:30 danda
- * root element should not have a parent. patch from anon SF user
- *
- * Revision 1.8 2002/05/23 17:46:51 danda
- * patch from mukund - fix non utf-8 encoding conversions
- *
- * Revision 1.7 2002/02/13 20:58:50 danda
- * patch to make source more windows friendly, contributed by Jeff Lawson
- *
- * Revision 1.6 2002/01/08 01:06:55 danda
- * enable <?xml version="1.0"?> format for parsers that are very picky.
- *
- * Revision 1.5 2001/09/29 21:58:05 danda
- * adding cvs log to history section
- *
- * 10/15/2000 -- danda -- adding robodoc documentation
- * TODO
- * Nicer external API. Get rid of macros. Make opaque types, etc.
- * PORTABILITY
- * Coded on RedHat Linux 6.2. Builds on Solaris x86. Should build on just
- * about anything with minor mods.
- * NOTES
- * This code incorporates ideas from expat-ensor from http://xml.ensor.org.
- *
- * It was coded primarily to act as a go-between for expat and xmlrpc. To this
- * end, it stores xml elements, their sub-elements, and their attributes in an
- * in-memory tree. When expat is done parsing, the tree can be walked, thus
- * retrieving the values. The code can also be used to build a tree via API then
- * write out the tree to a buffer, thus "serializing" the xml.
- *
- * It turns out this is useful for other purposes, such as parsing config files.
- * YMMV.
- *
- * Some Features:
- * - output option for xml escaping data. Choices include no escaping, entity escaping,
- * or CDATA sections.
- * - output option for character encoding. Defaults to (none) utf-8.
- * - output option for verbosity/readability. ultra-compact, newlines, pretty/level indented.
- *
- * BUGS
- * there must be some.
- ******/
-
-#ifdef _WIN32
-#include "xmlrpc_win32.h"
-#endif
-#include <stdlib.h>
-#include <string.h>
-
-#include "xml_element.h"
-#include "queue.h"
-#include "expat.h"
-#include "encodings.h"
-
-#define my_free(thing) if(thing) {free(thing); thing = 0;}
-
-#define XML_DECL_START "<?xml"
-#define XML_DECL_START_LEN sizeof(XML_DECL_START) - 1
-#define XML_DECL_VERSION "version=\"1.0\""
-#define XML_DECL_VERSION_LEN sizeof(XML_DECL_VERSION) - 1
-#define XML_DECL_ENCODING_ATTR "encoding"
-#define XML_DECL_ENCODING_ATTR_LEN sizeof(XML_DECL_ENCODING_ATTR) - 1
-#define XML_DECL_ENCODING_DEFAULT "utf-8"
-#define XML_DECL_ENCODING_DEFAULT_LEN sizeof(XML_DECL_ENCODING_DEFAULT) - 1
-#define XML_DECL_END "?>"
-#define XML_DECL_END_LEN sizeof(XML_DECL_END) - 1
-#define START_TOKEN_BEGIN "<"
-#define START_TOKEN_BEGIN_LEN sizeof(START_TOKEN_BEGIN) - 1
-#define START_TOKEN_END ">"
-#define START_TOKEN_END_LEN sizeof(START_TOKEN_END) - 1
-#define EMPTY_START_TOKEN_END "/>"
-#define EMPTY_START_TOKEN_END_LEN sizeof(EMPTY_START_TOKEN_END) - 1
-#define END_TOKEN_BEGIN "</"
-#define END_TOKEN_BEGIN_LEN sizeof(END_TOKEN_BEGIN) - 1
-#define END_TOKEN_END ">"
-#define END_TOKEN_END_LEN sizeof(END_TOKEN_END) - 1
-#define ATTR_DELIMITER "\""
-#define ATTR_DELIMITER_LEN sizeof(ATTR_DELIMITER) - 1
-#define CDATA_BEGIN "<![CDATA["
-#define CDATA_BEGIN_LEN sizeof(CDATA_BEGIN) - 1
-#define CDATA_END "]]>"
-#define CDATA_END_LEN sizeof(CDATA_END) - 1
-#define EQUALS "="
-#define EQUALS_LEN sizeof(EQUALS) - 1
-#define WHITESPACE " "
-#define WHITESPACE_LEN sizeof(WHITESPACE) - 1
-#define NEWLINE "\n"
-#define NEWLINE_LEN sizeof(NEWLINE) - 1
-#define MAX_VAL_BUF 144
-#define SCALAR_STR "SCALAR"
-#define SCALAR_STR_LEN sizeof(SCALAR_STR) - 1
-#define VECTOR_STR "VECTOR"
-#define VECTOR_STR_LEN sizeof(VECTOR_STR) - 1
-#define RESPONSE_STR "RESPONSE"
-#define RESPONSE_STR_LEN sizeof(RESPONSE_STR) - 1
-
-
-/*-----------------------------
-- Begin xml_element Functions -
------------------------------*/
-
-/****f* xml_element/xml_elem_free_non_recurse
- * NAME
- * xml_elem_free_non_recurse
- * SYNOPSIS
- * void xml_elem_free_non_recurse(xml_element* root)
- * FUNCTION
- * free a single xml element. child elements will not be freed.
- * INPUTS
- * root - the element to free
- * RESULT
- * void
- * NOTES
- * SEE ALSO
- * xml_elem_free ()
- * xml_elem_new ()
- * SOURCE
- */
-void xml_elem_free_non_recurse(xml_element* root) {
- if(root) {
- xml_element_attr* attrs = Q_Head(&root->attrs);
- while(attrs) {
- my_free(attrs->key);
- my_free(attrs->val);
- my_free(attrs);
- attrs = Q_Next(&root->attrs);
- }
-
- Q_Destroy(&root->children);
- Q_Destroy(&root->attrs);
- my_free((char*)root->name);
- simplestring_free(&root->text);
- my_free(root);
- }
-}
-/******/
-
-/****f* xml_element/xml_elem_free
- * NAME
- * xml_elem_free
- * SYNOPSIS
- * void xml_elem_free(xml_element* root)
- * FUNCTION
- * free an xml element and all of its child elements
- * INPUTS
- * root - the root of an xml tree you would like to free
- * RESULT
- * void
- * NOTES
- * SEE ALSO
- * xml_elem_free_non_recurse ()
- * xml_elem_new ()
- * SOURCE
- */
-void xml_elem_free(xml_element* root) {
- if(root) {
- xml_element* kids = Q_Head(&root->children);
- while(kids) {
- xml_elem_free(kids);
- kids = Q_Next(&root->children);
- }
- xml_elem_free_non_recurse(root);
- }
-}
-/******/
-
-/****f* xml_element/xml_elem_new
- * NAME
- * xml_elem_new
- * SYNOPSIS
- * xml_element* xml_elem_new()
- * FUNCTION
- * allocates and initializes a new xml_element
- * INPUTS
- * none
- * RESULT
- * xml_element* or NULL. NULL indicates an out-of-memory condition.
- * NOTES
- * SEE ALSO
- * xml_elem_free ()
- * xml_elem_free_non_recurse ()
- * SOURCE
- */
-xml_element* xml_elem_new() {
- xml_element* elem = calloc(1, sizeof(xml_element));
- if(elem) {
- Q_Init(&elem->children);
- Q_Init(&elem->attrs);
- simplestring_init(&elem->text);
-
- /* init empty string in case we don't find any char data */
- simplestring_addn(&elem->text, "", 0);
- }
- return elem;
-}
-/******/
-
-static int xml_elem_writefunc(int (*fptr)(void *data, const char *text, int size), const char *text, void *data, int len)
-{
- return fptr && text ? fptr(data, text, len ? len : strlen(text)) : 0;
-}
-
-
-
-static int create_xml_escape(char *pString, unsigned char c)
-{
- int counter = 0;
-
- pString[counter++] = '&';
- pString[counter++] = '#';
- if(c >= 100) {
- pString[counter++] = c / 100 + '0';
- c = c % 100;
- }
- if(c >= 10) {
- pString[counter++] = c / 10 + '0';
- c = c % 10;
- }
- pString[counter++] = c + '0';
- pString[counter++] = ';';
- return counter;
-}
-
-#define non_ascii(c) (c > 127)
-#define non_print(c) (!isprint(c))
-#define markup(c) (c == '&' || c == '\"' || c == '>' || c == '<')
-#define entity_length(c) ( (c >= 100) ? 3 : ((c >= 10) ? 2 : 1) ) + 3; /* "&#" + c + ";" */
-
-/*
- * xml_elem_entity_escape
- *
- * Purpose:
- * escape reserved xml chars and non utf-8 chars as xml entities
- * Comments:
- * The return value may be a new string, or null if no
- * conversion was performed. In the latter case, *newlen will
- * be 0.
- * Flags (to escape)
- * xml_elem_no_escaping = 0x000,
- * xml_elem_entity_escaping = 0x002, // escape xml special chars as entities
- * xml_elem_non_ascii_escaping = 0x008, // escape chars above 127
- * xml_elem_cdata_escaping = 0x010, // wrap in cdata
- */
-static char* xml_elem_entity_escape(const char* buf, int old_len, int *newlen, XML_ELEM_ESCAPING flags) {
- char *pRetval = 0;
- int iNewBufLen=0;
-
-#define should_escape(c, flag) ( ((flag & xml_elem_markup_escaping) && markup(c)) || \
- ((flag & xml_elem_non_ascii_escaping) && non_ascii(c)) || \
- ((flag & xml_elem_non_print_escaping) && non_print(c)) )
-
- if(buf && *buf) {
- const unsigned char *bufcopy;
- char *NewBuffer;
- int ToBeXmlEscaped=0;
- int iLength;
- bufcopy = buf;
- iLength= old_len ? old_len : strlen(buf);
- while(*bufcopy) {
- if( should_escape(*bufcopy, flags) ) {
- /* the length will increase by length of xml escape - the character length */
- iLength += entity_length(*bufcopy);
- ToBeXmlEscaped=1;
- }
- bufcopy++;
- }
-
- if(ToBeXmlEscaped) {
-
- NewBuffer= malloc(iLength+1);
- if(NewBuffer) {
- bufcopy=buf;
- while(*bufcopy) {
- if(should_escape(*bufcopy, flags)) {
- iNewBufLen += create_xml_escape(NewBuffer+iNewBufLen,*bufcopy);
- }
- else {
- NewBuffer[iNewBufLen++]=*bufcopy;
- }
- bufcopy++;
- }
- NewBuffer[iNewBufLen] = 0;
- pRetval = NewBuffer;
- }
- }
- }
-
- if(newlen) {
- *newlen = iNewBufLen;
- }
-
- return pRetval;
-}
-
-
-static void xml_element_serialize(xml_element *el, int (*fptr)(void *data, const char *text, int size), void *data, XML_ELEM_OUTPUT_OPTIONS options, int depth)
-{
- int i;
- static STRUCT_XML_ELEM_OUTPUT_OPTIONS default_opts = {xml_elem_pretty, xml_elem_markup_escaping | xml_elem_non_print_escaping, XML_DECL_ENCODING_DEFAULT};
- static char whitespace[] = " "
- " "
- " ";
- depth++;
-
- if(!el) {
- fprintf(stderr, "Nothing to write\n");
- return;
- }
- if(!options) {
- options = &default_opts;
- }
-
- /* print xml declaration if at root level */
- if(depth == 1) {
- xml_elem_writefunc(fptr, XML_DECL_START, data, XML_DECL_START_LEN);
- xml_elem_writefunc(fptr, WHITESPACE, data, WHITESPACE_LEN);
- xml_elem_writefunc(fptr, XML_DECL_VERSION, data, XML_DECL_VERSION_LEN);
- if(options->encoding && *options->encoding) {
- xml_elem_writefunc(fptr, WHITESPACE, data, WHITESPACE_LEN);
- xml_elem_writefunc(fptr, XML_DECL_ENCODING_ATTR, data, XML_DECL_ENCODING_ATTR_LEN);
- xml_elem_writefunc(fptr, EQUALS, data, EQUALS_LEN);
- xml_elem_writefunc(fptr, ATTR_DELIMITER, data, ATTR_DELIMITER_LEN);
- xml_elem_writefunc(fptr, options->encoding, data, 0);
- xml_elem_writefunc(fptr, ATTR_DELIMITER, data, ATTR_DELIMITER_LEN);
- }
- xml_elem_writefunc(fptr, XML_DECL_END, data, XML_DECL_END_LEN);
- if(options->verbosity != xml_elem_no_white_space) {
- xml_elem_writefunc(fptr, NEWLINE, data, NEWLINE_LEN);
- }
- }
-
- if(options->verbosity == xml_elem_pretty && depth > 2) {
- xml_elem_writefunc(fptr, whitespace, data, depth - 2);
- }
- /* begin element */
- xml_elem_writefunc(fptr,START_TOKEN_BEGIN, data, START_TOKEN_BEGIN_LEN);
- if(el->name) {
- xml_elem_writefunc(fptr, el->name, data, 0);
-
- /* write attrs, if any */
- if(Q_Size(&el->attrs)) {
- xml_element_attr* iter = Q_Head(&el->attrs);
- while( iter ) {
- xml_elem_writefunc(fptr, WHITESPACE, data, WHITESPACE_LEN);
- xml_elem_writefunc(fptr, iter->key, data, 0);
- xml_elem_writefunc(fptr, EQUALS, data, EQUALS_LEN);
- xml_elem_writefunc(fptr, ATTR_DELIMITER, data, ATTR_DELIMITER_LEN);
- xml_elem_writefunc(fptr, iter->val, data, 0);
- xml_elem_writefunc(fptr, ATTR_DELIMITER, data, ATTR_DELIMITER_LEN);
-
- iter = Q_Next(&el->attrs);
- }
- }
- }
- else {
- xml_elem_writefunc(fptr, "None", data, 0);
- }
- /* if no text and no children, use abbreviated form, eg: <foo/> */
- if(!el->text.len && !Q_Size(&el->children)) {
- xml_elem_writefunc(fptr, EMPTY_START_TOKEN_END, data, EMPTY_START_TOKEN_END_LEN);
- }
- /* otherwise, print element contents */
- else {
- xml_elem_writefunc(fptr, START_TOKEN_END, data, START_TOKEN_END_LEN);
-
- /* print text, if any */
- if(el->text.len) {
- char* escaped_str = el->text.str;
- int buflen = el->text.len;
-
- if(options->escaping && options->escaping != xml_elem_cdata_escaping) {
- escaped_str = xml_elem_entity_escape(el->text.str, buflen, &buflen, options->escaping );
- if(!escaped_str) {
- escaped_str = el->text.str;
- }
- }
-
- if(options->escaping & xml_elem_cdata_escaping) {
- xml_elem_writefunc(fptr, CDATA_BEGIN, data, CDATA_BEGIN_LEN);
- }
-
- xml_elem_writefunc(fptr, escaped_str, data, buflen);
-
- if(escaped_str != el->text.str) {
- my_free(escaped_str);
- }
-
- if(options->escaping & xml_elem_cdata_escaping) {
- xml_elem_writefunc(fptr, CDATA_END, data, CDATA_END_LEN);
- }
- }
- /* no text, so print child elems */
- else {
- xml_element *kids = Q_Head(&el->children);
- i = 0;
- while( kids ) {
- if(i++ == 0) {
- if(options->verbosity != xml_elem_no_white_space) {
- xml_elem_writefunc(fptr, NEWLINE, data, NEWLINE_LEN);
- }
- }
- xml_element_serialize(kids, fptr, data, options, depth);
- kids = Q_Next(&el->children);
- }
- if(i) {
- if(options->verbosity == xml_elem_pretty && depth > 2) {
- xml_elem_writefunc(fptr, whitespace, data, depth - 2);
- }
- }
- }
-
- xml_elem_writefunc(fptr, END_TOKEN_BEGIN, data, END_TOKEN_BEGIN_LEN);
- xml_elem_writefunc(fptr,el->name ? el->name : "None", data, 0);
- xml_elem_writefunc(fptr, END_TOKEN_END, data, END_TOKEN_END_LEN);
- }
- if(options->verbosity != xml_elem_no_white_space) {
- xml_elem_writefunc(fptr, NEWLINE, data, NEWLINE_LEN);
- }
-}
-
-/* print buf to file */
-static file_out_fptr(void *f, const char *text, int size)
-{
- fputs(text, (FILE *)f);
-}
-
-/* print buf to simplestring */
-static simplestring_out_fptr(void *f, const char *text, int size)
-{
- simplestring* buf = (simplestring*)f;
- if(buf) {
- simplestring_addn(buf, text, size);
- }
-}
-
-/****f* xml_element/xml_elem_serialize_to_string
- * NAME
- * xml_elem_serialize_to_string
- * SYNOPSIS
- * void xml_element_serialize_to_string(xml_element *el, XML_ELEM_OUTPUT_OPTIONS options, int *buf_len)
- * FUNCTION
- * writes element tree as XML into a newly allocated buffer
- * INPUTS
- * el - root element of tree
- * options - options determining how output is written. see XML_ELEM_OUTPUT_OPTIONS
- * buf_len - length of returned buffer, if not null.
- * RESULT
- * char* or NULL. Must be free'd by caller.
- * NOTES
- * SEE ALSO
- * xml_elem_serialize_to_stream ()
- * xml_elem_parse_buf ()
- * SOURCE
- */
-char* xml_elem_serialize_to_string(xml_element *el, XML_ELEM_OUTPUT_OPTIONS options, int *buf_len)
-{
- simplestring buf;
- simplestring_init(&buf);
-
- xml_element_serialize(el, simplestring_out_fptr, (void *)&buf, options, 0);
-
- if(buf_len) {
- *buf_len = buf.len;
- }
-
- return buf.str;
-}
-/******/
-
-/****f* xml_element/xml_elem_serialize_to_stream
- * NAME
- * xml_elem_serialize_to_stream
- * SYNOPSIS
- * void xml_elem_serialize_to_stream(xml_element *el, FILE *output, XML_ELEM_OUTPUT_OPTIONS options)
- * FUNCTION
- * writes element tree as XML into a stream (typically an opened file)
- * INPUTS
- * el - root element of tree
- * output - stream handle
- * options - options determining how output is written. see XML_ELEM_OUTPUT_OPTIONS
- * RESULT
- * void
- * NOTES
- * SEE ALSO
- * xml_elem_serialize_to_string ()
- * xml_elem_parse_buf ()
- * SOURCE
- */
-void xml_elem_serialize_to_stream(xml_element *el, FILE *output, XML_ELEM_OUTPUT_OPTIONS options)
-{
- xml_element_serialize(el, file_out_fptr, (void *)output, options, 0);
-}
-/******/
-
-/*--------------------------*
-* End xml_element Functions *
-*--------------------------*/
-
-
-/*----------------------
-* Begin Expat Handlers *
-*---------------------*/
-
-typedef struct _xml_elem_data {
- xml_element* root;
- xml_element* current;
- XML_ELEM_INPUT_OPTIONS input_options;
- int needs_enc_conversion;
-} xml_elem_data;
-
-
-/* expat start of element handler */
-static void startElement(void *userData, const char *name, const char **attrs)
-{
- xml_element *c;
- xml_elem_data* mydata = (xml_elem_data*)userData;
- const char** p = attrs;
-
- if(mydata) {
- c = mydata->current;
-
- mydata->current = xml_elem_new();
- mydata->current->name = (char*)strdup(name);
- mydata->current->parent = c;
-
- /* init attrs */
- while(p && *p) {
- xml_element_attr* attr = malloc(sizeof(xml_element_attr));
- if(attr) {
- attr->key = strdup(*p);
- attr->val = strdup(*(p+1));
- Q_PushTail(&mydata->current->attrs, attr);
-
- p += 2;
- }
- }
- }
-}
-
-/* expat end of element handler */
-static void endElement(void *userData, const char *name)
-{
- xml_elem_data* mydata = (xml_elem_data*)userData;
-
- if(mydata && mydata->current && mydata->current->parent) {
- Q_PushTail(&mydata->current->parent->children, mydata->current);
-
- mydata->current = mydata->current->parent;
- }
-}
-
-/* expat char data handler */
-static void charHandler(void *userData,
- const char *s,
- int len)
-{
- xml_elem_data* mydata = (xml_elem_data*)userData;
- if(mydata && mydata->current) {
-
- /* Check if we need to decode utf-8 parser output to another encoding */
- if(mydata->needs_enc_conversion && mydata->input_options->encoding) {
- int new_len = 0;
- char* add_text = utf8_decode(s, len, &new_len, mydata->input_options->encoding);
- if(add_text) {
- len = new_len;
- simplestring_addn(&mydata->current->text, add_text, len);
- free(add_text);
- return;
- }
- }
- simplestring_addn(&mydata->current->text, s, len);
- }
-}
-/******/
-
-/*-------------------*
-* End Expat Handlers *
-*-------------------*/
-
-/*-------------------*
-* xml_elem_parse_buf *
-*-------------------*/
-
-/****f* xml_element/xml_elem_parse_buf
- * NAME
- * xml_elem_parse_buf
- * SYNOPSIS
- * xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTIONS options, XML_ELEM_ERROR error)
- * FUNCTION
- * parse a buffer containing XML into an xml_element in-memory tree
- * INPUTS
- * in_buf - buffer containing XML document
- * len - length of buffer
- * options - input options. optional
- * error - error result data. optional. check if result is null.
- * RESULT
- * void
- * NOTES
- * The returned data must be free'd by caller
- * SEE ALSO
- * xml_elem_serialize_to_string ()
- * xml_elem_free ()
- * SOURCE
- */
-xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTIONS options, XML_ELEM_ERROR error)
-{
- xml_element* xReturn = NULL;
- char buf[100] = "";
- static STRUCT_XML_ELEM_INPUT_OPTIONS default_opts = {encoding_utf_8};
-
- if(!options) {
- options = &default_opts;
- }
-
- if(in_buf) {
- XML_Parser parser;
- xml_elem_data mydata = {0};
-
- parser = XML_ParserCreate(NULL);
-
- mydata.root = xml_elem_new();
- mydata.current = mydata.root;
- mydata.input_options = options;
- mydata.needs_enc_conversion = options->encoding && strcmp(options->encoding, encoding_utf_8);
-
- XML_SetElementHandler(parser, startElement, endElement);
- XML_SetCharacterDataHandler(parser, charHandler);
-
- /* pass the xml_elem_data struct along */
- XML_SetUserData(parser, (void*)&mydata);
-
- if(!len) {
- len = strlen(in_buf);
- }
-
- /* parse the XML */
- if(XML_Parse(parser, in_buf, len, 1) == 0) {
- enum XML_Error err_code = XML_GetErrorCode(parser);
- int line_num = XML_GetCurrentLineNumber(parser);
- int col_num = XML_GetCurrentColumnNumber(parser);
- long byte_idx = XML_GetCurrentByteIndex(parser);
- int byte_total = XML_GetCurrentByteCount(parser);
- const char * error_str = XML_ErrorString(err_code);
- if(byte_idx >= 0) {
- snprintf(buf,
- sizeof(buf),
- "\n\tdata beginning %i before byte index: %s\n",
- byte_idx > 10 ? 10 : byte_idx,
- in_buf + (byte_idx > 10 ? byte_idx - 10 : byte_idx));
- }
-
- fprintf(stderr, "expat reports error code %i\n"
- "\tdescription: %s\n"
- "\tline: %i\n"
- "\tcolumn: %i\n"
- "\tbyte index: %i\n"
- "\ttotal bytes: %i\n%s ",
- err_code, error_str, line_num,
- col_num, byte_idx, byte_total, buf);
-
-
- /* error condition */
- if(error) {
- error->parser_code = (long)err_code;
- error->line = line_num;
- error->column = col_num;
- error->byte_index = byte_idx;
- error->parser_error = error_str;
- }
- }
- else {
- xReturn = (xml_element*)Q_Head(&mydata.root->children);
- xReturn->parent = NULL;
- }
-
- XML_ParserFree(parser);
-
-
- xml_elem_free_non_recurse(mydata.root);
- }
-
- return xReturn;
-}
-
-/******/
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xml_element.h b/ext/rpc/xmlrpc/libxmlrpc/xml_element.h
deleted file mode 100644
index cfe7ca2483..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xml_element.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-#ifndef __XML_ELEMENT_H__
- #define __XML_ELEMENT_H__
-
-/* includes */
-#include <stdio.h>
-#include "queue.h"
-#include "simplestring.h"
-#include "encodings.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/****d* enum/XML_ELEM_VERBOSITY
- * NAME
- * XML_ELEM_VERBOSITY
- * NOTES
- * verbosity/readability options for generated xml
- * SEE ALSO
- * XML_ELEM_OUTPUT_OPTIONS
- * SOURCE
- */
-typedef enum _xml_elem_verbosity {
- xml_elem_no_white_space, /* compact xml with no white space */
- xml_elem_newlines_only, /* add newlines for enhanced readability */
- xml_elem_pretty /* add newlines and indent accordint to depth */
-} XML_ELEM_VERBOSITY;
-/******/
-
-
-/****d* enum/XML_ELEM_ESCAPING
- * NAME
- * XML_ELEM_ESCAPING
- * NOTES
- * xml escaping options for generated xml
- * SEE ALSO
- * XML_ELEM_OUTPUT_OPTIONS
- * SOURCE
- */
-typedef enum _xml_elem_escaping {
- xml_elem_no_escaping = 0x000,
- xml_elem_markup_escaping = 0x002, /* entity escape xml special chars */
- xml_elem_non_ascii_escaping = 0x008, /* entity escape chars above 127 */
- xml_elem_non_print_escaping = 0x010, /* entity escape non print (illegal) chars */
- xml_elem_cdata_escaping = 0x020, /* wrap in cdata section */
-} XML_ELEM_ESCAPING;
-/******/
-
-
-/****s* struct/XML_ELEM_OUTPUT_OPTIONS
- * NAME
- * XML_ELEM_OUTPUT_OPTIONS
- * NOTES
- * defines various output options
- * SOURCE
- */
-typedef struct _xml_output_options {
- XML_ELEM_VERBOSITY verbosity; /* length/verbosity of xml */
- XML_ELEM_ESCAPING escaping; /* how to escape special chars */
- const char* encoding; /* <?xml encoding="<encoding>" ?> */
-} STRUCT_XML_ELEM_OUTPUT_OPTIONS, *XML_ELEM_OUTPUT_OPTIONS;
-/******/
-
-/****s* struct/XML_ELEM_INPUT_OPTIONS
- * NAME
- * XML_ELEM_INPUT_OPTIONS
- * NOTES
- * defines various input options
- * SOURCE
- */
-typedef struct _xml_input_options {
- ENCODING_ID encoding; /* which encoding to use. */
-} STRUCT_XML_ELEM_INPUT_OPTIONS, *XML_ELEM_INPUT_OPTIONS;
-/******/
-
-/****s* struct/XML_ELEM_ERROR
- * NAME
- * XML_ELEM_ERROR
- * NOTES
- * defines an xml parser error
- * SOURCE
- */
-typedef struct _xml_elem_error {
- int parser_code;
- const char* parser_error;
- long line;
- long column;
- long byte_index;
-} STRUCT_XML_ELEM_ERROR, *XML_ELEM_ERROR;
-/******/
-
-
-/*-************************
-* begin xml element stuff *
-**************************/
-
-/****s* struct/xml_elem_attr
- * NAME
- * xml_elem_attr
- * NOTES
- * representation of an xml attribute, foo="bar"
- * SOURCE
- */
-typedef struct _xml_element_attr {
- char* key; /* attribute key */
- char* val; /* attribute value */
-} xml_element_attr;
-/******/
-
-/****s* struct/xml_elem_attr
- * NAME
- * xml_elem_attr
- * NOTES
- * representation of an xml element, eg <candidate name="Harry Browne" party="Libertarian"/>
- * SOURCE
- */
-typedef struct _xml_element {
- const char* name; /* element identifier */
- simplestring text; /* text contained between element begin/end pairs */
- struct _xml_element* parent; /* element's parent */
-
- queue attrs; /* attribute list */
- queue children; /* child element list */
-} xml_element;
-/******/
-
-void xml_elem_free(xml_element* root);
-void xml_elem_free_non_recurse(xml_element* root);
-xml_element* xml_elem_new(void);
-char* xml_elem_serialize_to_string(xml_element *el, XML_ELEM_OUTPUT_OPTIONS options, int *buf_len);
-void xml_elem_serialize_to_stream(xml_element *el, FILE *output, XML_ELEM_OUTPUT_OPTIONS options);
-xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTIONS options, XML_ELEM_ERROR error);
-
-/*-**********************
-* end xml element stuff *
-************************/
-
-/*-**********************
-* Begin xml_element API *
-************************/
-
-/****d* VALUE/XMLRPC_MACROS
- * NAME
- * Some Helpful Macros
- * NOTES
- * Some macros for making life easier. Should be self-explanatory.
- * SEE ALSO
- * XMLRPC_AddValueToVector ()
- * XMLRPC_VectorGetValueWithID_Case ()
- * XMLRPC_VALUE
- * SOURCE
- */
-#define xml_elem_next_element(el) ((el) ? (xml_element *)Q_Next(&el->children) : NULL)
-#define xml_elem_head_element(el) ((el) ? (xml_element *)Q_Head(&el->children) : NULL)
-#define xml_elem_next_attr(el) ((el) ? (xml_element_attr *)Q_Next(&el->attrs) : NULL)
-#define xml_elem_head_attr(el) ((el) ? (xml_element_attr *)Q_Head(&el->attrs) : NULL)
-#define xml_elem_get_name(el) (char *)((el) ? el->name : NULL)
-#define xml_elem_get_val(el) (char *)((el) ? el->text.str : NULL)
-/******/
-
-
-/*-********************
-* End xml_element API *
-**********************/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __XML_ELEMENT_H__ */
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.c b/ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.c
deleted file mode 100644
index b51d991723..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-#ifdef _WIN32
-#include "xmlrpc_win32.h"
-#endif
-#include <string.h>
-#include <stdlib.h>
-#include "xml_to_dandarpc.h"
-#include "base64.h"
-
-/* list of tokens used in vocab */
-#define ELEM_METHODCALL "methodCall"
-#define ELEM_METHODNAME "methodName"
-#define ELEM_METHODRESPONSE "methodResponse"
-#define ELEM_ROOT "simpleRPC"
-
-#define ATTR_ARRAY "array"
-#define ATTR_BASE64 "base64"
-#define ATTR_BOOLEAN "boolean"
-#define ATTR_DATETIME "dateTime.iso8601"
-#define ATTR_DOUBLE "double"
-#define ATTR_ID "id"
-#define ATTR_INT "int"
-#define ATTR_MIXED "mixed"
-#define ATTR_SCALAR "scalar"
-#define ATTR_STRING "string"
-#define ATTR_STRUCT "struct"
-#define ATTR_TYPE "type"
-#define ATTR_VECTOR "vector"
-#define ATTR_VERSION "version"
-
-#define VAL_VERSION_0_9 "0.9"
-
-
-XMLRPC_VALUE xml_element_to_DANDARPC_REQUEST_worker(XMLRPC_REQUEST request, XMLRPC_VALUE xCurrent, xml_element* el) {
- if(!xCurrent) {
- xCurrent = XMLRPC_CreateValueEmpty();
- }
-
- if(el->name) {
- const char* id = NULL;
- const char* type = NULL;
- xml_element_attr* attr_iter = Q_Head(&el->attrs);
-
- while(attr_iter) {
- if(!strcmp(attr_iter->key, ATTR_ID)) {
- id = attr_iter->val;
- }
- if(!strcmp(attr_iter->key, ATTR_TYPE)) {
- type = attr_iter->val;
- }
- attr_iter = Q_Next(&el->attrs);
- }
-
- if(id) {
- XMLRPC_SetValueID_Case(xCurrent, id, 0, xmlrpc_case_exact);
- }
-
- if(!strcmp(el->name, ATTR_SCALAR)) {
- if(!type || !strcmp(type, ATTR_STRING)) {
- XMLRPC_SetValueString(xCurrent, el->text.str, el->text.len);
- }
- else if(!strcmp(type, ATTR_INT)) {
- XMLRPC_SetValueInt(xCurrent, atoi(el->text.str));
- }
- else if(!strcmp(type, ATTR_BOOLEAN)) {
- XMLRPC_SetValueBoolean(xCurrent, atoi(el->text.str));
- }
- else if(!strcmp(type, ATTR_DOUBLE)) {
- XMLRPC_SetValueDouble(xCurrent, atof(el->text.str));
- }
- else if(!strcmp(type, ATTR_DATETIME)) {
- XMLRPC_SetValueDateTime_ISO8601(xCurrent, el->text.str);
- }
- else if(!strcmp(type, ATTR_BASE64)) {
- struct buffer_st buf;
- base64_decode(&buf, el->text.str, el->text.len);
- XMLRPC_SetValueBase64(xCurrent, buf.data, buf.offset);
- buffer_delete(&buf);
- }
- }
- else if(!strcmp(el->name, ATTR_VECTOR)) {
- xml_element* iter = (xml_element*)Q_Head(&el->children);
-
- if(!type || !strcmp(type, ATTR_MIXED)) {
- XMLRPC_SetIsVector(xCurrent, xmlrpc_vector_mixed);
- }
- else if(!strcmp(type, ATTR_ARRAY)) {
- XMLRPC_SetIsVector(xCurrent, xmlrpc_vector_array);
- }
- else if(!strcmp(type, ATTR_STRUCT)) {
- XMLRPC_SetIsVector(xCurrent, xmlrpc_vector_struct);
- }
- while( iter ) {
- XMLRPC_VALUE xNext = XMLRPC_CreateValueEmpty();
- xml_element_to_DANDARPC_REQUEST_worker(request, xNext, iter);
- XMLRPC_AddValueToVector(xCurrent, xNext);
- iter = (xml_element*)Q_Next(&el->children);
- }
- }
- else {
- xml_element* iter = (xml_element*)Q_Head(&el->children);
- while( iter ) {
- xml_element_to_DANDARPC_REQUEST_worker(request, xCurrent, iter);
- iter = (xml_element*)Q_Next(&el->children);
- }
-
- if(!strcmp(el->name, ELEM_METHODCALL)) {
- if(request) {
- XMLRPC_RequestSetRequestType(request, xmlrpc_request_call);
- }
- }
- else if(!strcmp(el->name, ELEM_METHODRESPONSE)) {
- if(request) {
- XMLRPC_RequestSetRequestType(request, xmlrpc_request_response);
- }
- }
- else if(!strcmp(el->name, ELEM_METHODNAME)) {
- if(request) {
- XMLRPC_RequestSetMethodName(request, el->text.str);
- }
- }
- }
- }
- return xCurrent;
-}
-
-XMLRPC_VALUE xml_element_to_DANDARPC_VALUE(xml_element* el)
-{
- return xml_element_to_DANDARPC_REQUEST_worker(NULL, NULL, el);
-}
-
-XMLRPC_VALUE xml_element_to_DANDARPC_REQUEST(XMLRPC_REQUEST request, xml_element* el)
-{
- if(request) {
- return XMLRPC_RequestSetData(request, xml_element_to_DANDARPC_REQUEST_worker(request, NULL, el));
- }
- return NULL;
-}
-
-xml_element* DANDARPC_to_xml_element_worker(XMLRPC_REQUEST request, XMLRPC_VALUE node) {
-#define BUF_SIZE 512
- xml_element* root = NULL;
- if(node) {
- char buf[BUF_SIZE];
- const char* id = XMLRPC_GetValueID(node);
- XMLRPC_VALUE_TYPE type = XMLRPC_GetValueType(node);
- XMLRPC_REQUEST_OUTPUT_OPTIONS output = XMLRPC_RequestGetOutputOptions(request);
- int bNoAddType = (type == xmlrpc_string && request && output && output->xml_elem_opts.verbosity == xml_elem_no_white_space);
- xml_element* elem_val = xml_elem_new();
- const char* pAttrType = NULL;
-
- xml_element_attr* attr_type = bNoAddType ? NULL : malloc(sizeof(xml_element_attr));
-
- if(attr_type) {
- attr_type->key = strdup(ATTR_TYPE);
- attr_type->val = 0;
- Q_PushTail(&elem_val->attrs, attr_type);
- }
-
- elem_val->name = (type == xmlrpc_vector) ? strdup(ATTR_VECTOR) : strdup(ATTR_SCALAR);
-
- if(id && *id) {
- xml_element_attr* attr_id = malloc(sizeof(xml_element_attr));
- if(attr_id) {
- attr_id->key = strdup(ATTR_ID);
- attr_id->val = strdup(id);
- Q_PushTail(&elem_val->attrs, attr_id);
- }
- }
-
- switch(type) {
- case xmlrpc_string:
- pAttrType = ATTR_STRING;
- simplestring_addn(&elem_val->text, XMLRPC_GetValueString(node), XMLRPC_GetValueStringLen(node));
- break;
- case xmlrpc_int:
- pAttrType = ATTR_INT;
- snprintf(buf, BUF_SIZE, "%i", XMLRPC_GetValueInt(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_boolean:
- pAttrType = ATTR_BOOLEAN;
- snprintf(buf, BUF_SIZE, "%i", XMLRPC_GetValueBoolean(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_double:
- pAttrType = ATTR_DOUBLE;
- snprintf(buf, BUF_SIZE, "%f", XMLRPC_GetValueDouble(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_datetime:
- pAttrType = ATTR_DATETIME;
- simplestring_add(&elem_val->text, XMLRPC_GetValueDateTime_ISO8601(node));
- break;
- case xmlrpc_base64:
- {
- struct buffer_st buf;
- pAttrType = ATTR_BASE64;
- base64_encode(&buf, XMLRPC_GetValueBase64(node), XMLRPC_GetValueStringLen(node));
- simplestring_addn(&elem_val->text, buf.data, buf.offset );
- buffer_delete(&buf);
- }
- break;
- case xmlrpc_vector:
- {
- XMLRPC_VECTOR_TYPE my_type = XMLRPC_GetVectorType(node);
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(node);
-
- switch(my_type) {
- case xmlrpc_vector_array:
- pAttrType = ATTR_ARRAY;
- break;
- case xmlrpc_vector_mixed:
- pAttrType = ATTR_MIXED;
- break;
- case xmlrpc_vector_struct:
- pAttrType = ATTR_STRUCT;
- break;
- default:
- break;
- }
-
- /* recurse through sub-elements */
- while( xIter ) {
- xml_element* next_el = DANDARPC_to_xml_element_worker(request, xIter);
- if(next_el) {
- Q_PushTail(&elem_val->children, next_el);
- }
- xIter = XMLRPC_VectorNext(node);
- }
- }
- break;
- default:
- break;
- }
- if(pAttrType && attr_type && !bNoAddType) {
- attr_type->val = strdup(pAttrType);
- }
- root = elem_val;
- }
- return root;
-}
-
-xml_element* DANDARPC_VALUE_to_xml_element(XMLRPC_VALUE node) {
- return DANDARPC_to_xml_element_worker(NULL, node);
-}
-
-xml_element* DANDARPC_REQUEST_to_xml_element(XMLRPC_REQUEST request) {
- xml_element* wrapper = NULL;
- xml_element* root = NULL;
- if(request) {
- XMLRPC_REQUEST_TYPE request_type = XMLRPC_RequestGetRequestType(request);
- const char* pStr = NULL;
- xml_element_attr* version = malloc(sizeof(xml_element_attr));
- version->key = strdup(ATTR_VERSION);
- version->val = strdup(VAL_VERSION_0_9);
-
- wrapper = xml_elem_new();
-
- if(request_type == xmlrpc_request_response) {
- pStr = ELEM_METHODRESPONSE;
- }
- else if(request_type == xmlrpc_request_call) {
- pStr = ELEM_METHODCALL;
- }
- if(pStr) {
- wrapper->name = strdup(pStr);
- }
-
- root = xml_elem_new();
- root->name = strdup(ELEM_ROOT);
- Q_PushTail(&root->attrs, version);
- Q_PushTail(&root->children, wrapper);
-
- pStr = XMLRPC_RequestGetMethodName(request);
-
- if(pStr) {
- xml_element* method = xml_elem_new();
- method->name = strdup(ELEM_METHODNAME);
- simplestring_add(&method->text, pStr);
- Q_PushTail(&wrapper->children, method);
- }
- Q_PushTail(&wrapper->children,
- DANDARPC_to_xml_element_worker(request, XMLRPC_RequestGetData(request)));
- }
- return root;
-}
-
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.h b/ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.h
deleted file mode 100644
index 6facb55778..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-#ifndef XML_TO_DANDARPC_H
- #define XML_TO_DANDARPC_H
-
-#include "time.h"
-#include "xmlrpc.h"
-
-XMLRPC_VALUE xml_element_to_DANDARPC_VALUE(xml_element* el);
-XMLRPC_VALUE xml_element_to_DANDARPC_REQUEST(XMLRPC_REQUEST request, xml_element* el);
-xml_element* DANDARPC_VALUE_to_xml_element(XMLRPC_VALUE node);
-xml_element* DANDARPC_REQUEST_to_xml_element(XMLRPC_REQUEST request);
-
-#endif /* XML_TO_DANDARPC_H */
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.c b/ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.c
deleted file mode 100644
index a09131aad6..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.c
+++ /dev/null
@@ -1,673 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
-*/
-
-
-/*-**********************************************************************
-* TODO: *
-* - [SOAP-ENC:position] read sparse arrays (and write?) *
-* - [SOAP-ENC:offset] read partially transmitted arrays (and write?) *
-* - read "flattened" multi-dimensional arrays. (don't bother writing) *
-* *
-* BUGS: *
-* - does not read schema. thus only knows soap pre-defined types. *
-* - references (probably) do not work. untested. *
-* - does not expose SOAP-ENV:Header to application at all. *
-* - does not use namespaces correctly, thus: *
-* - namespaces are hard-coded in comparison tokens *
-* - if a sender uses another namespace identifer, it will break *
-************************************************************************/
-
-
-static const char rcsid[] = "#(@) $Id:";
-
-#ifdef _WIN32
-#include "xmlrpc_win32.h"
-#endif
-#include <string.h>
-#include <stdlib.h>
-#include "xml_to_soap.h"
-#include "base64.h"
-
-/* list of tokens used in vocab */
-#define TOKEN_ANY "xsd:ur-type"
-#define TOKEN_ARRAY "SOAP-ENC:Array"
-#define TOKEN_ARRAY_TYPE "SOAP-ENC:arrayType"
-#define TOKEN_BASE64 "SOAP-ENC:base64"
-#define TOKEN_BOOLEAN "xsd:boolean"
-#define TOKEN_DATETIME "xsd:timeInstant"
-#define TOKEN_DOUBLE "xsd:double"
-#define TOKEN_FLOAT "xsd:float"
-#define TOKEN_ID "id"
-#define TOKEN_INT "xsd:int"
-#define TOKEN_NULL "xsi:null"
-#define TOKEN_STRING "xsd:string"
-#define TOKEN_STRUCT "xsd:struct"
-#define TOKEN_TYPE "xsi:type"
-#define TOKEN_FAULT "SOAP-ENV:Fault"
-#define TOKEN_MUSTUNDERSTAND "SOAP-ENV:mustUnderstand"
-#define TOKEN_ACTOR "SOAP-ENV:actor"
-#define TOKEN_ACTOR_NEXT "http://schemas.xmlsoap.org/soap/actor/next"
-
-#define TOKEN_XMLRPC_FAULTCODE "faultCode"
-#define TOKEN_XMLRPC_FAULTSTRING "faultString"
-#define TOKEN_SOAP_FAULTCODE "faultcode"
-#define TOKEN_SOAP_FAULTSTRING "faultstring"
-#define TOKEN_SOAP_FAULTDETAILS "details"
-#define TOKEN_SOAP_FAULTACTOR "actor"
-
-
-// determine if a string represents a soap type, as used in
-// element names
-static inline int is_soap_type(const char* soap_type) {
- return(strstr(soap_type, "SOAP-ENC:") || strstr(soap_type, "xsd:")) ? 1 : 0;
-}
-
-/* utility func to generate a new attribute. possibly should be in xml_element.c?? */
-static xml_element_attr* new_attr(const char* key, const char* val) {
- xml_element_attr* attr = malloc(sizeof(xml_element_attr));
- if (attr) {
- attr->key = key ? strdup(key) : NULL;
- attr->val = val ? strdup(val) : NULL;
- }
- return attr;
-}
-
-struct array_info {
- char kids_type[30];
- unsigned long size;
- /* ... ? */
-};
-
-
-/* parses soap arrayType attribute to generate an array_info structure.
- * TODO: should deal with sparse, flattened, & multi-dimensional arrays
- */
-static struct array_info* parse_array_type_info(const char* array_type) {
- struct array_info* ai = NULL;
- if (array_type) {
- ai = (struct array_info*)calloc(1, sizeof(struct array_info));
- if (ai) {
- char buf[128], *p;
- snprintf(buf, sizeof(buf), "%s", array_type);
- p = strchr(buf, '[');
- if (p) {
- *p = 0;
- }
- strcpy(ai->kids_type, buf);
- }
- }
- return ai;
-}
-
-/* performs heuristics on an xmlrpc_vector_array to determine
- * appropriate soap arrayType string.
- */
-static const char* get_array_soap_type(XMLRPC_VALUE node) {
- XMLRPC_VALUE_TYPE_EASY type = xmlrpc_type_none;
-
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(node);
- int loopCount = 0;
- const char* soapType = TOKEN_ANY;
-
- type = XMLRPC_GetValueTypeEasy(xIter);
- xIter = XMLRPC_VectorNext(node);
-
- while (xIter) {
- /* 50 seems like a decent # of loops. That will likely
- * cover most cases. Any more and we start to sacrifice
- * performance.
- */
- if ( (XMLRPC_GetValueTypeEasy(xIter) != type) || loopCount >= 50) {
- type = xmlrpc_type_none;
- break;
- }
- loopCount ++;
-
- xIter = XMLRPC_VectorNext(node);
- }
- switch (type) {
- case xmlrpc_type_none:
- soapType = TOKEN_ANY;
- break;
- case xmlrpc_type_empty:
- soapType = TOKEN_NULL;
- break;
- case xmlrpc_type_int:
- soapType = TOKEN_INT;
- break;
- case xmlrpc_type_double:
- soapType = TOKEN_DOUBLE;
- break;
- case xmlrpc_type_boolean:
- soapType = TOKEN_BOOLEAN;
- break;
- case xmlrpc_type_string:
- soapType = TOKEN_STRING;
- break;
- case xmlrpc_type_base64:
- soapType = TOKEN_BASE64;
- break;
- case xmlrpc_type_datetime:
- soapType = TOKEN_DATETIME;
- break;
- case xmlrpc_type_struct:
- soapType = TOKEN_STRUCT;
- break;
- case xmlrpc_type_array:
- soapType = TOKEN_ARRAY;
- break;
- case xmlrpc_type_mixed:
- soapType = TOKEN_STRUCT;
- break;
- }
- return soapType;
-}
-
-/* determines wether a node is a fault or not, and of which type:
- * 0 = not a fault,
- * 1 = xmlrpc style fault
- * 2 = soap style fault.
- */
-static inline int get_fault_type(XMLRPC_VALUE node) {
- if (XMLRPC_VectorGetValueWithID(node, TOKEN_XMLRPC_FAULTCODE) &&
- XMLRPC_VectorGetValueWithID(node, TOKEN_XMLRPC_FAULTSTRING)) {
- return 1;
- }
- else if (XMLRPC_VectorGetValueWithID(node, TOKEN_SOAP_FAULTCODE) &&
- XMLRPC_VectorGetValueWithID(node, TOKEN_SOAP_FAULTSTRING)) {
- return 2;
- }
- return 0;
-}
-
-/* input: an XMLRPC_VALUE representing a fault struct in xml-rpc style.
- * output: an XMLRPC_VALUE representing a fault struct in soap style,
- * with xmlrpc codes mapped to soap codes, and all other values preserved.
- * note that the returned value is a completely new value, and must be freed.
- * the input value is untouched.
- */
-static XMLRPC_VALUE gen_fault_xmlrpc(XMLRPC_VALUE node, xml_element* el_target) {
- XMLRPC_VALUE xDup = XMLRPC_DupValueNew(node);
- XMLRPC_VALUE xCode = XMLRPC_VectorGetValueWithID(xDup, TOKEN_XMLRPC_FAULTCODE);
- XMLRPC_VALUE xStr = XMLRPC_VectorGetValueWithID(xDup, TOKEN_XMLRPC_FAULTSTRING);
-
- XMLRPC_SetValueID(xCode, TOKEN_SOAP_FAULTCODE, 0);
- XMLRPC_SetValueID(xStr, TOKEN_SOAP_FAULTSTRING, 0);
-
- /* rough mapping of xmlrpc fault codes to soap codes */
- switch (XMLRPC_GetValueInt(xCode)) {
- case -32700: // "parse error. not well formed",
- case -32701: // "parse error. unsupported encoding"
- case -32702: // "parse error. invalid character for encoding"
- case -32600: // "server error. invalid xml-rpc. not conforming to spec."
- case -32601: // "server error. requested method not found"
- case -32602: // "server error. invalid method parameters"
- XMLRPC_SetValueString(xCode, "SOAP-ENV:Client", 0);
- break;
- case -32603: // "server error. internal xml-rpc error"
- case -32500: // "application error"
- case -32400: // "system error"
- case -32300: // "transport error
- XMLRPC_SetValueString(xCode, "SOAP-ENV:Server", 0);
- break;
- }
- return xDup;
-}
-
-// returns a new XMLRPC_VALUE representing a soap fault, comprised of a struct with four keys.
-static XMLRPC_VALUE gen_soap_fault(const char* fault_code, const char* fault_string,
- const char* actor, const char* details) {
- XMLRPC_VALUE xReturn = XMLRPC_CreateVector(TOKEN_FAULT, xmlrpc_vector_struct);
- XMLRPC_AddValuesToVector(xReturn,
- XMLRPC_CreateValueString(TOKEN_SOAP_FAULTCODE, fault_code, 0),
- XMLRPC_CreateValueString(TOKEN_SOAP_FAULTSTRING, fault_string, 0),
- XMLRPC_CreateValueString(TOKEN_SOAP_FAULTACTOR, actor, 0),
- XMLRPC_CreateValueString(TOKEN_SOAP_FAULTDETAILS, details, 0),
- NULL);
- return xReturn;
-}
-
-/* translates xml soap dom to native data structures. recursive. */
-XMLRPC_VALUE xml_element_to_SOAP_REQUEST_worker(XMLRPC_REQUEST request,
- XMLRPC_VALUE xParent,
- struct array_info* parent_array,
- XMLRPC_VALUE xCurrent,
- xml_element* el,
- int depth) {
- XMLRPC_REQUEST_TYPE rtype = xmlrpc_request_none;
-
- // no current element on first call
- if (!xCurrent) {
- xCurrent = XMLRPC_CreateValueEmpty();
- }
-
- // increment recursion depth guage
- depth ++;
-
- // safety first. must have a valid element
- if (el && el->name) {
- const char* id = NULL;
- const char* type = NULL, *arrayType=NULL, *actor = NULL;
- xml_element_attr* attr_iter = Q_Head(&el->attrs);
- int b_must_understand = 0;
-
- // in soap, types may be specified in either element name -or- with xsi:type attribute.
- if (is_soap_type(el->name)) {
- type = el->name;
- }
- // if our parent node, by definition a vector, is not an array, then
- // our element name must be our key identifier.
- else if (XMLRPC_GetVectorType(xParent) != xmlrpc_vector_array) {
- id = el->name;
- if(!strcmp(id, "item")) {
- }
- }
-
- // iterate through element attributes, pick out useful stuff.
- while (attr_iter) {
- // element's type
- if (!strcmp(attr_iter->key, TOKEN_TYPE)) {
- type = attr_iter->val;
- }
- // array type
- else if (!strcmp(attr_iter->key, TOKEN_ARRAY_TYPE)) {
- arrayType = attr_iter->val;
- }
- // must understand, sometimes present in headers.
- else if (!strcmp(attr_iter->key, TOKEN_MUSTUNDERSTAND)) {
- b_must_understand = strchr(attr_iter->val, '1') ? 1 : 0;
- }
- // actor, used in conjuction with must understand.
- else if (!strcmp(attr_iter->key, TOKEN_ACTOR)) {
- actor = attr_iter->val;
- }
- attr_iter = Q_Next(&el->attrs);
- }
-
- // check if caller says we must understand something in a header.
- if (b_must_understand) {
- // is must understand actually indended for us?
- // BUG: spec says we should also determine if actor is our URL, but
- // we do not have that information.
- if (!actor || !strcmp(actor, TOKEN_ACTOR_NEXT)) {
- // TODO: implement callbacks or other mechanism for applications
- // to "understand" these headers. For now, we just bail if we
- // get a mustUnderstand header intended for us.
- XMLRPC_RequestSetError(request,
- gen_soap_fault("SOAP-ENV:MustUnderstand",
- "SOAP Must Understand Error",
- "", ""));
- return xCurrent;
- }
- }
-
- // set id (key) if one was found.
- if (id) {
- XMLRPC_SetValueID_Case(xCurrent, id, 0, xmlrpc_case_exact);
- }
-
- // according to soap spec,
- // depth 1 = Envelope, 2 = Header, Body & Fault, 3 = methodcall or response.
- if (depth == 3) {
- const char* methodname = el->name;
- char* p = NULL;
-
- // BUG: we determine request or response type using presence of "Response" in element name.
- // According to spec, this is only recommended, not required. Apparently, implementations
- // are supposed to know the type of action based on state, which strikes me as a bit lame.
- // Anyway, we don't have that state info, thus we use Response as a heuristic.
- rtype =
-#ifdef strcasestr
- strcasestr(el->name, "response") ? xmlrpc_request_response : xmlrpc_request_call;
-#else
- strstr(el->name, "esponse") ? xmlrpc_request_response : xmlrpc_request_call;
-#endif
- XMLRPC_RequestSetRequestType(request, rtype);
-
- // Get methodname. strip xml namespace crap.
- p = strchr(el->name, ':');
- if (p) {
- methodname = p + 1;
- }
- if (rtype == xmlrpc_request_call) {
- XMLRPC_RequestSetMethodName(request, methodname);
- }
- }
-
-
- // Next, we begin to convert actual values.
- // if no children, then must be a scalar value.
- if (!Q_Size(&el->children)) {
- if (!type && parent_array && parent_array->kids_type[0]) {
- type = parent_array->kids_type;
- }
- if (!type || !strcmp(type, TOKEN_STRING)) {
- XMLRPC_SetValueString(xCurrent, el->text.str, el->text.len);
- }
- else if (!strcmp(type, TOKEN_INT)) {
- XMLRPC_SetValueInt(xCurrent, atoi(el->text.str));
- }
- else if (!strcmp(type, TOKEN_BOOLEAN)) {
- XMLRPC_SetValueBoolean(xCurrent, atoi(el->text.str));
- }
- else if (!strcmp(type, TOKEN_DOUBLE) ||
- !strcmp(type, TOKEN_FLOAT)) {
- XMLRPC_SetValueDouble(xCurrent, atof(el->text.str));
- }
- else if (!strcmp(type, TOKEN_NULL)) {
- // already an empty val. do nothing.
- }
- else if (!strcmp(type, TOKEN_DATETIME)) {
- XMLRPC_SetValueDateTime_ISO8601(xCurrent, el->text.str);
- }
- else if (!strcmp(type, TOKEN_BASE64)) {
- struct buffer_st buf;
- base64_decode(&buf, el->text.str, el->text.len);
- XMLRPC_SetValueBase64(xCurrent, buf.data, buf.offset);
- buffer_delete(&buf);
- }
- }
- // Element has children, thus a vector, or "compound type" in soap-speak.
- else {
- struct array_info* ai = NULL;
- xml_element* iter = (xml_element*)Q_Head(&el->children);
-
- if (!type || !strcmp(type, TOKEN_STRUCT)) {
- XMLRPC_SetIsVector(xCurrent, xmlrpc_vector_struct);
- }
- else if (!strcmp(type, TOKEN_ARRAY) || arrayType != NULL) {
- // determine magic associated with soap array type.
- // this is passed down as we recurse, so our children have access to the info.
- ai = parse_array_type_info(arrayType); // alloc'ed ai free'd below.
- XMLRPC_SetIsVector(xCurrent, xmlrpc_vector_array);
- }
- else {
- // mixed is probably closest thing we have to compound type.
- XMLRPC_SetIsVector(xCurrent, xmlrpc_vector_mixed);
- }
- // Recurse, adding values as we go. Check for error during recursion
- // and if found, bail. this short-circuits us out of the recursion.
- while ( iter && !XMLRPC_RequestGetError(request) ) {
- XMLRPC_VALUE xNext = NULL;
- // top level elements don't actually represent values, so we just pass the
- // current value along until we are deep enough.
- if ( depth <= 2 ||
- (rtype == xmlrpc_request_response && depth <= 3) ) {
- xml_element_to_SOAP_REQUEST_worker(request, NULL, ai, xCurrent, iter, depth);
- }
- // ready to do some actual de-serialization. create a new empty value and
- // pass that along to be init'd, then add it to our current vector.
- else {
- xNext = XMLRPC_CreateValueEmpty();
- xml_element_to_SOAP_REQUEST_worker(request, xCurrent, ai, xNext, iter, depth);
- XMLRPC_AddValueToVector(xCurrent, xNext);
- }
- iter = (xml_element*)Q_Next(&el->children);
- }
- // cleanup
- if (ai) {
- free(ai);
- }
- }
- }
- return xCurrent;
-}
-
-// Convert soap xml dom to XMLRPC_VALUE, sans request info. untested.
-XMLRPC_VALUE xml_element_to_SOAP_VALUE(xml_element* el)
-{
- return xml_element_to_SOAP_REQUEST_worker(NULL, NULL, NULL, NULL, el, 0);
-}
-
-// Convert soap xml dom to XMLRPC_REQUEST
-XMLRPC_VALUE xml_element_to_SOAP_REQUEST(XMLRPC_REQUEST request, xml_element* el)
-{
- if (request) {
- return XMLRPC_RequestSetData(request, xml_element_to_SOAP_REQUEST_worker(request, NULL, NULL, NULL, el, 0));
- }
- return NULL;
-}
-
-
-/* translates data structures to soap/xml. recursive */
-xml_element* SOAP_to_xml_element_worker(XMLRPC_REQUEST request, XMLRPC_VALUE node) {
-#define BUF_SIZE 128
- xml_element* elem_val = NULL;
- if (node) {
- int bFreeNode = 0; /* sometimes we may need to free 'node' variable */
- char buf[BUF_SIZE];
- XMLRPC_VALUE_TYPE_EASY type = XMLRPC_GetValueTypeEasy(node);
- char* pName = NULL, *pAttrType = NULL;
-
- // create our return value element
- elem_val = xml_elem_new();
-
- switch (type) {
- case xmlrpc_type_struct:
- case xmlrpc_type_mixed:
- case xmlrpc_type_array:
- if (type == xmlrpc_type_array) {
- // array's are _very_ special in soap.
- // TODO: Should handle sparse/partial arrays here.
-
- // determine soap array type.
- const char* type = get_array_soap_type(node);
- xml_element_attr* attr_array_type = NULL;
-
- // specify array kids type and array size.
- snprintf(buf, sizeof(buf), "%s[%i]", type, XMLRPC_VectorSize(node));
- attr_array_type = new_attr(TOKEN_ARRAY_TYPE, buf);
-
- Q_PushTail(&elem_val->attrs, attr_array_type);
-
- pAttrType = TOKEN_ARRAY;
- }
- // check for fault, which is a rather special case.
- // (can't these people design anything consistent/simple/elegant?)
- else if (type == xmlrpc_type_struct) {
- int fault_type = get_fault_type(node);
- if (fault_type) {
- if (fault_type == 1) {
- // gen fault from xmlrpc style fault codes
- // notice that we get a new node, which must be freed herein.
- node = gen_fault_xmlrpc(node, elem_val);
- bFreeNode = 1;
- }
- pName = TOKEN_FAULT;
- }
- }
-
- {
- /* recurse through sub-elements */
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(node);
- while ( xIter ) {
- xml_element* next_el = SOAP_to_xml_element_worker(request, xIter);
- if (next_el) {
- Q_PushTail(&elem_val->children, next_el);
- }
- xIter = XMLRPC_VectorNext(node);
- }
- }
-
- break;
-
- // handle scalar types
- case xmlrpc_type_empty:
- pAttrType = TOKEN_NULL;
- break;
- case xmlrpc_type_string:
- pAttrType = TOKEN_STRING;
- simplestring_addn(&elem_val->text, XMLRPC_GetValueString(node), XMLRPC_GetValueStringLen(node));
- break;
- case xmlrpc_type_int:
- pAttrType = TOKEN_INT;
- snprintf(buf, BUF_SIZE, "%i", XMLRPC_GetValueInt(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_type_boolean:
- pAttrType = TOKEN_BOOLEAN;
- snprintf(buf, BUF_SIZE, "%i", XMLRPC_GetValueBoolean(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_type_double:
- pAttrType = TOKEN_DOUBLE;
- snprintf(buf, BUF_SIZE, "%f", XMLRPC_GetValueDouble(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_type_datetime:
- {
- time_t tt = XMLRPC_GetValueDateTime(node);
- struct tm *tm = localtime (&tt);
- pAttrType = TOKEN_DATETIME;
- if(strftime (buf, BUF_SIZE, "%Y-%m-%dT%H:%M:%SZ", tm)) {
- simplestring_add(&elem_val->text, buf);
- }
- }
- break;
- case xmlrpc_type_base64:
- {
- struct buffer_st buf;
- pAttrType = TOKEN_BASE64;
- base64_encode(&buf, XMLRPC_GetValueBase64(node), XMLRPC_GetValueStringLen(node));
- simplestring_addn(&elem_val->text, buf.data, buf.offset );
- buffer_delete(&buf);
- }
- break;
- break;
- default:
- break;
- }
-
- // determining element's name is a bit tricky, due to soap semantics.
- if (!pName) {
- // if the value's type is known...
- if (pAttrType) {
- // see if it has an id (key). If so, use that as name,
- // and type as an attribute.
- pName = (char*)XMLRPC_GetValueID(node);
- if (pName) {
- Q_PushTail(&elem_val->attrs, new_attr(TOKEN_TYPE, pAttrType));
- }
-
- // otherwise, use the type as the name.
- else {
- pName = pAttrType;
- }
- }
- // if the value's type is not known... (a rare case?)
- else {
- // see if it has an id (key). otherwise, default to generic "item"
- pName = (char*)XMLRPC_GetValueID(node);
- if (!pName) {
- pName = "item";
- }
- }
- }
- elem_val->name = strdup(pName);
-
- // cleanup
- if (bFreeNode) {
- XMLRPC_CleanupValue(node);
- }
- }
- return elem_val;
-}
-
-// convert XMLRPC_VALUE to soap xml dom. untested.
-xml_element* SOAP_VALUE_to_xml_element(XMLRPC_VALUE node) {
- return SOAP_to_xml_element_worker(NULL, node);
-}
-
-// convert XMLRPC_REQUEST to soap xml dom.
-xml_element* SOAP_REQUEST_to_xml_element(XMLRPC_REQUEST request) {
- xml_element* root = xml_elem_new();
-
- // safety first.
- if (root) {
- xml_element* body = xml_elem_new();
- root->name = strdup("SOAP-ENV:Envelope");
-
- /* silly namespace stuff */
- Q_PushTail(&root->attrs, new_attr("xmlns:SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"));
- Q_PushTail(&root->attrs, new_attr("xmlns:xsi", "http://www.w3.org/1999/XMLSchema-instance"));
- Q_PushTail(&root->attrs, new_attr("xmlns:xsd", "http://www.w3.org/1999/XMLSchema"));
- Q_PushTail(&root->attrs, new_attr("xmlns:SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/"));
- Q_PushTail(&root->attrs, new_attr("xmlns:si", "http://soapinterop.org/xsd"));
- Q_PushTail(&root->attrs, new_attr("xmlns:ns6", "http://testuri.org"));
- Q_PushTail(&root->attrs, new_attr("SOAP-ENV:encodingStyle", "http://schemas.xmlsoap.org/soap/encoding/"));
-
- //Q_PushHead(&root->attrs, new_attr("xmlns:ks", "http://kitchen.sink.org/soap/everything/under/sun"));
- // JUST KIDDING!! :-) ----> -------------------------------------------------
-
- if (body) {
- // go ahead and serialize first...
- xml_element* el_serialized =
- SOAP_to_xml_element_worker(request,
- XMLRPC_RequestGetData(request));
-
- /* check for fault, in which case, there is no intermediate element */
- if (el_serialized && !strcmp(el_serialized->name, TOKEN_FAULT)) {
- Q_PushTail(&body->children, el_serialized);
- }
- // usual case: not a fault. Add Response element in between.
- else {
- xml_element* rpc = xml_elem_new();
-
- if (rpc) {
- const char* methodname = XMLRPC_RequestGetMethodName(request);
- XMLRPC_REQUEST_TYPE rtype = XMLRPC_RequestGetRequestType(request);
-
- // if we are making a request, we want to use the methodname as is.
- if (rtype == xmlrpc_request_call) {
- if (methodname) {
- rpc->name = strdup(methodname);
- }
- }
- // if it's a response, we append "Response". Also, given xmlrpc-epi
- // API/architecture, it's likely that we don't have a methodname for
- // the response, so we have to check that.
- else {
- char buf[128];
- snprintf(buf, sizeof(buf), "%s%s",
- methodname ? methodname : "",
- "Response");
-
- rpc->name = strdup(buf);
- }
-
- // add serialized data to method call/response.
- // add method call/response to body element
- if (rpc->name) {
- if(el_serialized) {
- if(Q_Size(&el_serialized->children) && rtype == xmlrpc_request_call) {
- xml_element* iter = (xml_element*)Q_Head(&el_serialized->children);
- while(iter) {
- Q_PushTail(&rpc->children, iter);
- iter = (xml_element*)Q_Next(&el_serialized->children);
- }
- xml_elem_free_non_recurse(el_serialized);
- }
- else {
- Q_PushTail(&rpc->children, el_serialized);
- }
- }
-
- Q_PushTail(&body->children, rpc);
- }
- else {
- // no method name?!
- // TODO: fault here...?
- }
- }
- }
- body->name = strdup("SOAP-ENV:Body");
- Q_PushTail(&root->children, body);
- }
- }
-
- return root;
-}
-
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.h b/ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.h
deleted file mode 100644
index 9ae9308b22..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-#ifndef XML_TO_SOAP_H
- #define XML_TO_SOAP_H
-
-#include "xmlrpc.h"
-
-XMLRPC_VALUE xml_element_to_SOAP_VALUE(xml_element* el);
-XMLRPC_VALUE xml_element_to_SOAP_REQUEST(XMLRPC_REQUEST request, xml_element* el);
-xml_element* SOAP_VALUE_to_xml_element(XMLRPC_VALUE node);
-xml_element* SOAP_REQUEST_to_xml_element(XMLRPC_REQUEST request);
-
-#endif /* XML_TO_XMLRPC_H */
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.c b/ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.c
deleted file mode 100644
index c45d3ec3db..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.c
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-static const char rcsid[] = "#(@) $Id$";
-
-#ifdef _WIN32
-#include "xmlrpc_win32.h"
-#endif
-#include <string.h>
-#include <stdlib.h>
-#include "xml_to_xmlrpc.h"
-#include "base64.h"
-
-/* list of tokens used in vocab */
-#define ELEM_ARRAY "array"
-#define ELEM_BASE64 "base64"
-#define ELEM_BOOLEAN "boolean"
-#define ELEM_DATA "data"
-#define ELEM_DATETIME "dateTime.iso8601"
-#define ELEM_DOUBLE "double"
-#define ELEM_FAULT "fault"
-#define ELEM_FAULTCODE "faultCode"
-#define ELEM_FAULTSTRING "faultString"
-#define ELEM_I4 "i4"
-#define ELEM_INT "int"
-#define ELEM_MEMBER "member"
-#define ELEM_METHODCALL "methodCall"
-#define ELEM_METHODNAME "methodName"
-#define ELEM_METHODRESPONSE "methodResponse"
-#define ELEM_NAME "name"
-#define ELEM_PARAM "param"
-#define ELEM_PARAMS "params"
-#define ELEM_STRING "string"
-#define ELEM_STRUCT "struct"
-#define ELEM_VALUE "value"
-
-
-XMLRPC_VALUE xml_element_to_XMLRPC_REQUEST_worker(XMLRPC_REQUEST request, XMLRPC_VALUE parent_vector, XMLRPC_VALUE current_val, xml_element* el) {
- if (!current_val) {
- /* This should only be the case for the first element */
- current_val = XMLRPC_CreateValueEmpty();
- }
-
- if (el->name) {
-
- /* first, deal with the crazy/stupid fault format */
- if (!strcmp(el->name, ELEM_FAULT)) {
- xml_element* fault_value = (xml_element*)Q_Head(&el->children);
- XMLRPC_SetIsVector(current_val, xmlrpc_vector_struct);
-
- if(fault_value) {
- xml_element* fault_struct = (xml_element*)Q_Head(&fault_value->children);
- if(fault_struct) {
- xml_element* iter = (xml_element*)Q_Head(&fault_struct->children);
-
- while (iter) {
- XMLRPC_VALUE xNextVal = XMLRPC_CreateValueEmpty();
- xml_element_to_XMLRPC_REQUEST_worker(request, current_val, xNextVal, iter);
- XMLRPC_AddValueToVector(current_val, xNextVal);
- iter = (xml_element*)Q_Next(&fault_struct->children);
- }
- }
- }
- }
- else if (!strcmp(el->name, ELEM_DATA) /* should be ELEM_ARRAY, but there is an extra level. weird */
- || (!strcmp(el->name, ELEM_PARAMS) &&
- (XMLRPC_RequestGetRequestType(request) == xmlrpc_request_call)) ) { /* this "PARAMS" concept is silly. dave?! */
- xml_element* iter = (xml_element*)Q_Head(&el->children);
- XMLRPC_SetIsVector(current_val, xmlrpc_vector_array);
-
- while (iter) {
- XMLRPC_VALUE xNextVal = XMLRPC_CreateValueEmpty();
- xml_element_to_XMLRPC_REQUEST_worker(request, current_val, xNextVal, iter);
- XMLRPC_AddValueToVector(current_val, xNextVal);
- iter = (xml_element*)Q_Next(&el->children);
- }
- }
- else if (!strcmp(el->name, ELEM_STRUCT)) {
- xml_element* iter = (xml_element*)Q_Head(&el->children);
- XMLRPC_SetIsVector(current_val, xmlrpc_vector_struct);
-
- while ( iter ) {
- XMLRPC_VALUE xNextVal = XMLRPC_CreateValueEmpty();
- xml_element_to_XMLRPC_REQUEST_worker(request, current_val, xNextVal, iter);
- XMLRPC_AddValueToVector(current_val, xNextVal);
- iter = (xml_element*)Q_Next(&el->children);
- }
- }
- else if (!strcmp(el->name, ELEM_STRING) ||
- (!strcmp(el->name, ELEM_VALUE) && Q_Size(&el->children) == 0)) {
- XMLRPC_SetValueString(current_val, el->text.str, el->text.len);
- }
- else if (!strcmp(el->name, ELEM_NAME)) {
- XMLRPC_SetValueID_Case(current_val, el->text.str, 0, xmlrpc_case_exact);
- }
- else if (!strcmp(el->name, ELEM_INT) || !strcmp(el->name, ELEM_I4)) {
- XMLRPC_SetValueInt(current_val, atoi(el->text.str));
- }
- else if (!strcmp(el->name, ELEM_BOOLEAN)) {
- XMLRPC_SetValueBoolean(current_val, atoi(el->text.str));
- }
- else if (!strcmp(el->name, ELEM_DOUBLE)) {
- XMLRPC_SetValueDouble(current_val, atof(el->text.str));
- }
- else if (!strcmp(el->name, ELEM_DATETIME)) {
- XMLRPC_SetValueDateTime_ISO8601(current_val, el->text.str);
- }
- else if (!strcmp(el->name, ELEM_BASE64)) {
- struct buffer_st buf;
- base64_decode(&buf, el->text.str, el->text.len);
- XMLRPC_SetValueBase64(current_val, buf.data, buf.offset);
- buffer_delete(&buf);
- }
- else {
- xml_element* iter;
-
- if (!strcmp(el->name, ELEM_METHODCALL)) {
- if (request) {
- XMLRPC_RequestSetRequestType(request, xmlrpc_request_call);
- }
- }
- else if (!strcmp(el->name, ELEM_METHODRESPONSE)) {
- if (request) {
- XMLRPC_RequestSetRequestType(request, xmlrpc_request_response);
- }
- }
- else if (!strcmp(el->name, ELEM_METHODNAME)) {
- if (request) {
- XMLRPC_RequestSetMethodName(request, el->text.str);
- }
- }
-
- iter = (xml_element*)Q_Head(&el->children);
- while ( iter ) {
- xml_element_to_XMLRPC_REQUEST_worker(request, parent_vector,
- current_val, iter);
- iter = (xml_element*)Q_Next(&el->children);
- }
- }
- }
- return current_val;
-}
-
-XMLRPC_VALUE xml_element_to_XMLRPC_VALUE(xml_element* el)
-{
- return xml_element_to_XMLRPC_REQUEST_worker(NULL, NULL, NULL, el);
-}
-
-XMLRPC_VALUE xml_element_to_XMLRPC_REQUEST(XMLRPC_REQUEST request, xml_element* el)
-{
- if (request) {
- return XMLRPC_RequestSetData(request, xml_element_to_XMLRPC_REQUEST_worker(request, NULL, NULL, el));
- }
- return NULL;
-}
-
-xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VALUE node,
- XMLRPC_REQUEST_TYPE request_type, int depth) {
-#define BUF_SIZE 512
- xml_element* root = NULL;
- if (node) {
- char buf[BUF_SIZE];
- XMLRPC_VALUE_TYPE type = XMLRPC_GetValueType(node);
- XMLRPC_VECTOR_TYPE vtype = XMLRPC_GetVectorType(node);
- xml_element* elem_val = xml_elem_new();
-
- /* special case for when root element is not an array */
- if (depth == 0 &&
- !(type == xmlrpc_vector &&
- vtype == xmlrpc_vector_array &&
- request_type == xmlrpc_request_call) ) {
- int bIsFault = (vtype == xmlrpc_vector_struct && XMLRPC_VectorGetValueWithID(node, ELEM_FAULTCODE));
-
- xml_element* next_el = XMLRPC_to_xml_element_worker(NULL, node, request_type, depth + 1);
- if (next_el) {
- Q_PushTail(&elem_val->children, next_el);
- }
- elem_val->name = strdup(bIsFault ? ELEM_FAULT : ELEM_PARAMS);
- }
- else {
- switch (type) {
- case xmlrpc_empty: // treat null value as empty string in xmlrpc.
- case xmlrpc_string:
- elem_val->name = strdup(ELEM_STRING);
- simplestring_addn(&elem_val->text, XMLRPC_GetValueString(node), XMLRPC_GetValueStringLen(node));
- break;
- case xmlrpc_int:
- elem_val->name = strdup(ELEM_INT);
- snprintf(buf, BUF_SIZE, "%i", XMLRPC_GetValueInt(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_boolean:
- elem_val->name = strdup(ELEM_BOOLEAN);
- snprintf(buf, BUF_SIZE, "%i", XMLRPC_GetValueBoolean(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_double:
- elem_val->name = strdup(ELEM_DOUBLE);
- snprintf(buf, BUF_SIZE, "%f", XMLRPC_GetValueDouble(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_datetime:
- elem_val->name = strdup(ELEM_DATETIME);
- simplestring_add(&elem_val->text, XMLRPC_GetValueDateTime_ISO8601(node));
- break;
- case xmlrpc_base64:
- {
- struct buffer_st buf;
- elem_val->name = strdup(ELEM_BASE64);
- base64_encode(&buf, XMLRPC_GetValueBase64(node), XMLRPC_GetValueStringLen(node));
- simplestring_addn(&elem_val->text, buf.data, buf.offset );
- buffer_delete(&buf);
- }
- break;
- case xmlrpc_vector:
- {
- XMLRPC_VECTOR_TYPE my_type = XMLRPC_GetVectorType(node);
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(node);
- xml_element* root_vector_elem = elem_val;
-
- switch (my_type) {
- case xmlrpc_vector_array:
- {
- if(depth == 0) {
- elem_val->name = strdup(ELEM_PARAMS);
- }
- else {
- /* Hi my name is Dave and I like to make things as confusing
- * as possible, thus I will throw in this 'data' element
- * where it absolutely does not belong just so that people
- * cannot code arrays and structs in a similar and straight
- * forward manner. Have a good day.
- *
- * GRRRRRRRRR!
- */
- xml_element* data = xml_elem_new();
- data->name = strdup(ELEM_DATA);
-
- elem_val->name = strdup(ELEM_ARRAY);
- Q_PushTail(&elem_val->children, data);
- root_vector_elem = data;
- }
- }
- break;
- case xmlrpc_vector_mixed: /* not officially supported */
- case xmlrpc_vector_struct:
- elem_val->name = strdup(ELEM_STRUCT);
- break;
- default:
- break;
- }
-
- /* recurse through sub-elements */
- while ( xIter ) {
- xml_element* next_el = XMLRPC_to_xml_element_worker(node, xIter, request_type, depth + 1);
- if (next_el) {
- Q_PushTail(&root_vector_elem->children, next_el);
- }
- xIter = XMLRPC_VectorNext(node);
- }
- }
- break;
- default:
- break;
- }
- }
-
- {
- XMLRPC_VECTOR_TYPE vtype = XMLRPC_GetVectorType(current_vector);
-
- if (depth == 1) {
- xml_element* value = xml_elem_new();
- value->name = strdup(ELEM_VALUE);
-
- /* yet another hack for the "fault" crap */
- if (XMLRPC_VectorGetValueWithID(node, ELEM_FAULTCODE)) {
- root = value;
- }
- else {
- xml_element* param = xml_elem_new();
- param->name = strdup(ELEM_PARAM);
-
- Q_PushTail(&param->children, value);
-
- root = param;
- }
- Q_PushTail(&value->children, elem_val);
- }
- else if (vtype == xmlrpc_vector_struct || vtype == xmlrpc_vector_mixed) {
- xml_element* member = xml_elem_new();
- xml_element* name = xml_elem_new();
- xml_element* value = xml_elem_new();
-
- member->name = strdup(ELEM_MEMBER);
- name->name = strdup(ELEM_NAME);
- value->name = strdup(ELEM_VALUE);
-
- simplestring_add(&name->text, XMLRPC_GetValueID(node));
-
- Q_PushTail(&member->children, name);
- Q_PushTail(&member->children, value);
- Q_PushTail(&value->children, elem_val);
-
- root = member;
- }
- else if (vtype == xmlrpc_vector_array) {
- xml_element* value = xml_elem_new();
-
- value->name = strdup(ELEM_VALUE);
-
- Q_PushTail(&value->children, elem_val);
-
- root = value;
- }
- else if (vtype == xmlrpc_vector_none) {
- /* no parent. non-op */
- root = elem_val;
- }
- else {
- xml_element* value = xml_elem_new();
-
- value->name = strdup(ELEM_VALUE);
-
- Q_PushTail(&value->children, elem_val);
-
- root = value;
- }
- }
- }
- return root;
-}
-
-xml_element* XMLRPC_VALUE_to_xml_element(XMLRPC_VALUE node) {
- return XMLRPC_to_xml_element_worker(NULL, node, xmlrpc_request_none, 0);
-}
-
-xml_element* XMLRPC_REQUEST_to_xml_element(XMLRPC_REQUEST request) {
- xml_element* wrapper = NULL;
- if (request) {
- const char* pStr = NULL;
- XMLRPC_REQUEST_TYPE request_type = XMLRPC_RequestGetRequestType(request);
- XMLRPC_VALUE xParams = XMLRPC_RequestGetData(request);
-
- wrapper = xml_elem_new();
-
- if (request_type == xmlrpc_request_call) {
- pStr = ELEM_METHODCALL;
- }
- else if (request_type == xmlrpc_request_response) {
- pStr = ELEM_METHODRESPONSE;
- }
- if (pStr) {
- wrapper->name = strdup(pStr);
- }
-
- if(request_type == xmlrpc_request_call) {
- pStr = XMLRPC_RequestGetMethodName(request);
-
- if (pStr) {
- xml_element* method = xml_elem_new();
- method->name = strdup(ELEM_METHODNAME);
- simplestring_add(&method->text, pStr);
- Q_PushTail(&wrapper->children, method);
- }
- }
- if (xParams) {
- Q_PushTail(&wrapper->children,
- XMLRPC_to_xml_element_worker(NULL, XMLRPC_RequestGetData(request), XMLRPC_RequestGetRequestType(request), 0));
- }
- else {
- /* Despite the spec, the xml-rpc list folk want me to send an empty params element */
- xml_element* params = xml_elem_new();
- params->name = strdup(ELEM_PARAMS);
- Q_PushTail(&wrapper->children, params);
- }
- }
- return wrapper;
-}
-
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.h b/ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.h
deleted file mode 100644
index 234a153460..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-#ifndef XML_TO_XMLRPC_H
- #define XML_TO_XMLRPC_H
-
-#include "time.h"
-#include "xmlrpc.h"
-
-XMLRPC_VALUE xml_element_to_XMLRPC_VALUE(xml_element* el);
-XMLRPC_VALUE xml_element_to_XMLRPC_REQUEST(XMLRPC_REQUEST request, xml_element* el);
-xml_element* XMLRPC_VALUE_to_xml_element(XMLRPC_VALUE node);
-xml_element* XMLRPC_REQUEST_to_xml_element(XMLRPC_REQUEST request);
-
-#endif /* XML_TO_XMLRPC_H */
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc.c b/ext/rpc/xmlrpc/libxmlrpc/xmlrpc.c
deleted file mode 100644
index 3eca7065a8..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc.c
+++ /dev/null
@@ -1,2956 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-static const char rcsid[] = "#(@) $Id$";
-
-
-/****h* ABOUT/xmlrpc
- * NAME
- * XMLRPC_VALUE
- * AUTHOR
- * Dan Libby, aka danda (dan@libby.com)
- * CREATION DATE
- * 9/1999 - 10/2000
- * HISTORY
- * $Log$
- * Revision 1.22 2002/03/09 23:15:44 danda
- * add fault interrogation funcs
- *
- * Revision 1.21 2002/03/09 22:27:41 danda
- * win32 build patches contributed by Jeff Lawson
- *
- * Revision 1.20 2002/02/13 20:58:50 danda
- * patch to make source more windows friendly, contributed by Jeff Lawson
- *
- * Revision 1.19 2001/10/12 23:25:54 danda
- * default to writing xmlrpc
- *
- * Revision 1.18 2001/09/29 21:58:05 danda
- * adding cvs log to history section
- *
- * 10/15/2000 -- danda -- adding robodoc documentation
- * 08/2000 -- danda -- PHP C extension that uses XMLRPC
- * 08/2000 -- danda -- support for two vocabularies: danda-rpc and xml-rpc
- * 09/1999 -- danda -- Initial API, before I even knew of standard XMLRPC vocab. Response only.
- * 07/2000 -- danda -- wrote new implementation to be compatible with xmlrpc standard and
- * incorporated some ideas from ensor, most notably the separation of
- * xml dom from xmlrpc api.
- * 06/2000 -- danda -- played with expat-ensor from www.ensor.org. Cool, but some flaws.
- * TODO
- * PORTABILITY
- * Coded on RedHat Linux 6.2. Builds on Solaris x86. Should build on just
- * about anything with minor mods.
- * NOTES
- * Welcome to XMLRPC. For more info on the specification and history, see
- * http://www.xmlrpc.org.
- *
- * This code aims to be a full-featured C implementation of XMLRPC. It does not
- * have any networking code. Rather, it is intended to be plugged into apps
- * or libraries with existing networking facilities, eg PHP, apache, perl, mozilla,
- * home-brew application servers, etc.
- *
- * Usage Paradigm:
- * The user of this library will typically be implementing either an XMLRPC server,
- * an XMLRPC client, or both. The client will use the library to build an in-memory
- * representation of a request, and then serialize (encode) that request into XML. The
- * client will then send the XML to the server via external mechanism. The server will
- * de-serialize the XML back into an binary representation, call the appropriate registered
- * method -- thereby generating a response. The response will be serialized into XML and
- * sent back to the client. The client will de-serialize it into memory, and can
- * iterate through the results via API.
- *
- * Both the request and the response may consist of arbitrarily long, arbitrarily nested
- * values. The values may be one of several types, as defined by XMLRPC_VALUE_TYPE.
- *
- * Features and Architecture:
- * - The XML parsing (xml_element.c) is completely independent of the XMLRPC api. In fact,
- * it can be used as a standalone dom implementation.
- * - Because of this, the same XMLRPC data can be serialized into multiple xml vocabularies.
- * It is simply a matter of writing a transport. So far, two transports have been defined.
- * The default xmlrpc vocab (xml_to_xmlrpc.c), and simple-rpc (xml_to_dandarpc.c) which is
- * proprietary, but imho more readable, and nice for proprietary legacy reasons.
- * - Various output options, including: xml escaping via CDATA or entity, case folding,
- * vocab version, and character encoding.
- * - One to One mapping between C structures and actual values, unlike ensor which forces
- * one to understand the arcana of the xmlrpc vocab.
- * - support for mixed indexed/keyed vector types, making it more compatible with
- * languages such as PHP.
- * - quite speedy compared to implementations written in interpreted languages. Also, uses
- * intelligent string handling, so not many strlen() calls, etc.
- * - comprehensive API for manipulation of values
- *******/
-
-
-#ifdef _WIN32
-#include "xmlrpc_win32.h"
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <time.h>
-
-#include "queue.h"
-#include "xmlrpc.h"
-#include "expat.h"
-#include "base64.h"
-
-#include "xml_to_xmlrpc.h"
-#include "xml_to_dandarpc.h"
-#include "xml_to_soap.h"
-#include "xml_element.h"
-#include "xmlrpc_private.h"
-#include "xmlrpc_introspection_private.h"
-#include "system_methods_private.h"
-
-
-
-/*-*********************
-* Begin Time Functions *
-***********************/
-
-static int date_from_ISO8601 (const char *text, time_t * value) {
- struct tm tm;
- int n;
- int i;
- char buf[18];
-
- if (strchr (text, '-')) {
- char *p = (char *) text, *p2 = buf;
- while (p && *p) {
- if (*p != '-') {
- *p2 = *p;
- p2++;
- }
- p++;
- }
- text = buf;
- }
-
-
- tm.tm_isdst = -1;
-
- if(strlen(text) < 17) {
- return -1;
- }
-
- n = 1000;
- tm.tm_year = 0;
- for(i = 0; i < 4; i++) {
- tm.tm_year += (text[i]-'0')*n;
- n /= 10;
- }
- n = 10;
- tm.tm_mon = 0;
- for(i = 0; i < 2; i++) {
- tm.tm_mon += (text[i+4]-'0')*n;
- n /= 10;
- }
- tm.tm_mon --;
-
- n = 10;
- tm.tm_mday = 0;
- for(i = 0; i < 2; i++) {
- tm.tm_mday += (text[i+6]-'0')*n;
- n /= 10;
- }
-
- n = 10;
- tm.tm_hour = 0;
- for(i = 0; i < 2; i++) {
- tm.tm_hour += (text[i+9]-'0')*n;
- n /= 10;
- }
-
- n = 10;
- tm.tm_min = 0;
- for(i = 0; i < 2; i++) {
- tm.tm_min += (text[i+12]-'0')*n;
- n /= 10;
- }
-
- n = 10;
- tm.tm_sec = 0;
- for(i = 0; i < 2; i++) {
- tm.tm_sec += (text[i+15]-'0')*n;
- n /= 10;
- }
-
- tm.tm_year -= 1900;
-
- *value = mktime(&tm);
-
- return 0;
-
-}
-
-static int date_to_ISO8601 (time_t value, char *buf, int length) {
- struct tm *tm;
- tm = localtime(&value);
-#if 0 // TODO: soap seems to favor this method. xmlrpc the latter.
- return strftime (buf, length, "%Y-%m-%dT%H:%M:%SZ", tm);
-#else
- return strftime(buf, length, "%Y%m%dT%H:%M:%S", tm);
-#endif
-}
-
-/*-*******************
-* End Time Functions *
-*********************/
-
-
-/*-***************************
-* Begin XMLRPC_REQUEST funcs *
-*****************************/
-
-/****f* REQUEST/XMLRPC_RequestNew
- * NAME
- * XMLRPC_RequestNew
- * SYNOPSIS
- * XMLRPC_REQUEST XMLRPC_RequestNew()
- * FUNCTION
- * Creates a new XMLRPC_Request data struct
- * INPUTS
- * none
- * SEE ALSO
- * XMLRPC_RequestFree ()
- * SOURCE
- */
-XMLRPC_REQUEST XMLRPC_RequestNew() {
- XMLRPC_REQUEST xRequest = calloc(1, sizeof(STRUCT_XMLRPC_REQUEST));
- if(xRequest) {
- simplestring_init(&xRequest->methodName);
- }
- return xRequest;
-}
-
-/*******/
-
-/****f* REQUEST/XMLRPC_RequestFree
- * NAME
- * XMLRPC_RequestFree
- * SYNOPSIS
- * void XMLRPC_RequestFree(XMLRPC_REQUEST request, int bFreeIO)
- * FUNCTION
- * Free XMLRPC Request and all sub-values
- * INPUTS
- * request -- previously allocated request struct
- * bFreeIO -- 1 = also free request value data, if any, 0 = ignore.
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_CleanupValue ()
- * SOURCE
- */
-void XMLRPC_RequestFree(XMLRPC_REQUEST request, int bFreeIO) {
- if(request) {
- simplestring_free(&request->methodName);
-
- if(request->io && bFreeIO) {
- XMLRPC_CleanupValue(request->io);
- }
- if(request->error) {
- XMLRPC_CleanupValue(request->error);
- }
- my_free(request);
- }
-}
-
-/*******/
-
-/* Set Method Name to call */
-/****f* REQUEST/XMLRPC_RequestSetMethodName
- * NAME
- * XMLRPC_RequestSetMethodName
- * SYNOPSIS
- * const char* XMLRPC_RequestSetMethodName(XMLRPC_REQUEST request, const char* methodName)
- * FUNCTION
- * Set name of method to call with this request.
- * INPUTS
- * request -- previously allocated request struct
- * methodName -- name of method
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestGetMethodName ()
- * XMLRPC_RequestFree ()
- * SOURCE
- */
-const char* XMLRPC_RequestSetMethodName(XMLRPC_REQUEST request, const char* methodName) {
- if(request) {
- simplestring_clear(&request->methodName);
- simplestring_add(&request->methodName, methodName);
- return request->methodName.str;
- }
- return NULL;
-}
-
-/*******/
-
-/****f* REQUEST/XMLRPC_RequestGetMethodName
- * NAME
- * XMLRPC_RequestGetMethodName
- * SYNOPSIS
- * const char* XMLRPC_RequestGetMethodName(XMLRPC_REQUEST request)
- * FUNCTION
- * Get name of method called by this request
- * INPUTS
- * request -- previously allocated request struct
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestSetMethodName ()
- * XMLRPC_RequestFree ()
- * SOURCE
- */
-const char* XMLRPC_RequestGetMethodName(XMLRPC_REQUEST request) {
- return request ? request->methodName.str : NULL;
-}
-
-/*******/
-
-/****f* REQUEST/XMLRPC_RequestSetRequestType
- * NAME
- * XMLRPC_RequestSetRequestType
- * SYNOPSIS
- * XMLRPC_REQUEST_TYPE XMLRPC_RequestSetRequestType(XMLRPC_REQUEST request, XMLRPC_REQUEST_TYPE type)
- * FUNCTION
- * A request struct may be allocated by a caller or by xmlrpc
- * in response to a request. This allows setting the
- * request type.
- * INPUTS
- * request -- previously allocated request struct
- * type -- request type [xmlrpc_method_call | xmlrpc_method_response]
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestGetRequestType ()
- * XMLRPC_RequestFree ()
- * XMLRPC_REQUEST_TYPE
- * SOURCE
- */
-XMLRPC_REQUEST_TYPE XMLRPC_RequestSetRequestType (XMLRPC_REQUEST request,
- XMLRPC_REQUEST_TYPE type) {
- if(request) {
- request->request_type = type;
- return request->request_type;
- }
- return xmlrpc_request_none;
-}
-
-/*******/
-
-/****f* REQUEST/XMLRPC_RequestGetRequestType
- * NAME
- * XMLRPC_RequestGetRequestType
- * SYNOPSIS
- * XMLRPC_REQUEST_TYPE XMLRPC_RequestGetRequestType(XMLRPC_REQUEST request)
- * FUNCTION
- * A request struct may be allocated by a caller or by xmlrpc
- * in response to a request. This allows setting the
- * request type.
- * INPUTS
- * request -- previously allocated request struct
- * RESULT
- * type -- request type [xmlrpc_method_call | xmlrpc_method_response]
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestSetRequestType ()
- * XMLRPC_RequestFree ()
- * XMLRPC_REQUEST_TYPE
- * SOURCE
- */
-XMLRPC_REQUEST_TYPE XMLRPC_RequestGetRequestType(XMLRPC_REQUEST request) {
- return request ? request->request_type : xmlrpc_request_none;
-}
-
-/*******/
-
-
-/****f* REQUEST/XMLRPC_RequestSetData
- * NAME
- * XMLRPC_RequestSetData
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_RequestSetData(XMLRPC_REQUEST request, XMLRPC_VALUE data)
- * FUNCTION
- * Associates a block of xmlrpc data with the request. The
- * data is *not* copied. A pointer is kept. The caller
- * should be careful not to doubly free the data value,
- * which may optionally be free'd by XMLRPC_RequestFree().
- * INPUTS
- * request -- previously allocated request struct
- * data -- previously allocated data struct
- * RESULT
- * XMLRPC_VALUE -- pointer to value stored, or NULL
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestGetData ()
- * XMLRPC_RequestFree ()
- * XMLRPC_REQUEST
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_RequestSetData(XMLRPC_REQUEST request, XMLRPC_VALUE data) {
- if(request && data) {
- if (request->io) {
- XMLRPC_CleanupValue (request->io);
- }
- request->io = XMLRPC_CopyValue(data);
- return request->io;
- }
- return NULL;
-}
-
-/*******/
-
-/****f* REQUEST/XMLRPC_RequestGetData
- * NAME
- * XMLRPC_RequestGetData
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_RequestGetData(XMLRPC_REQUEST request)
- * FUNCTION
- * Returns data associated with request, if any.
- * INPUTS
- * request -- previously allocated request struct
- * RESULT
- * XMLRPC_VALUE -- pointer to value stored, or NULL
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestSetData ()
- * XMLRPC_RequestFree ()
- * XMLRPC_REQUEST
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_RequestGetData(XMLRPC_REQUEST request) {
- return request ? request->io : NULL;
-}
-
-/*******/
-
-/****f* REQUEST/XMLRPC_RequestSetError
- * NAME
- * XMLRPC_RequestSetError
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_RequestSetError(XMLRPC_REQUEST request, XMLRPC_VALUE error)
- * FUNCTION
- * Associates a block of xmlrpc data, representing an error
- * condition, with the request.
- * INPUTS
- * request -- previously allocated request struct
- * error -- previously allocated error code or struct
- * RESULT
- * XMLRPC_VALUE -- pointer to value stored, or NULL
- * NOTES
- * This is a private function for usage by internals only.
- * SEE ALSO
- * XMLRPC_RequestGetError ()
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_RequestSetError (XMLRPC_REQUEST request, XMLRPC_VALUE error) {
- if (request && error) {
- if (request->error) {
- XMLRPC_CleanupValue (request->error);
- }
- request->error = XMLRPC_CopyValue (error);
- return request->error;
- }
- return NULL;
-}
-
-/*******/
-
-/****f* REQUEST/XMLRPC_RequestGetError
- * NAME
- * XMLRPC_RequestGetError
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_RequestGetError(XMLRPC_REQUEST request)
- * FUNCTION
- * Returns error data associated with request, if any.
- * INPUTS
- * request -- previously allocated request struct
- * RESULT
- * XMLRPC_VALUE -- pointer to error value stored, or NULL
- * NOTES
- * This is a private function for usage by internals only.
- * SEE ALSO
- * XMLRPC_RequestSetError ()
- * XMLRPC_RequestFree ()
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_RequestGetError (XMLRPC_REQUEST request) {
- return request ? request->error : NULL;
-}
-
-/*******/
-
-
-/****f* REQUEST/XMLRPC_RequestSetOutputOptions
- * NAME
- * XMLRPC_RequestSetOutputOptions
- * SYNOPSIS
- * XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestSetOutputOptions(XMLRPC_REQUEST request, XMLRPC_REQUEST_OUTPUT_OPTIONS output)
- * FUNCTION
- * Sets output options used for generating XML. The output struct
- * is copied, and may be freed by the caller.
- * INPUTS
- * request -- previously allocated request struct
- * output -- output options struct initialized by caller
- * RESULT
- * XMLRPC_REQUEST_OUTPUT_OPTIONS -- pointer to value stored, or NULL
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestGetOutputOptions ()
- * XMLRPC_RequestFree ()
- * XMLRPC_REQUEST
- * XMLRPC_REQUEST_OUTPUT_OPTIONS
- * SOURCE
- */
-XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestSetOutputOptions(XMLRPC_REQUEST request, XMLRPC_REQUEST_OUTPUT_OPTIONS output) {
- if(request && output) {
- memcpy (&request->output, output,
- sizeof (STRUCT_XMLRPC_REQUEST_OUTPUT_OPTIONS));
- return &request->output;
- }
- return NULL;
-}
-
-/*******/
-
-
-/****f* REQUEST/XMLRPC_RequestGetOutputOptions
- * NAME
- * XMLRPC_RequestGetOutputOptions
- * SYNOPSIS
- * XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestGetOutputOptions(XMLRPC_REQUEST request)
- * FUNCTION
- * Gets a pointer to output options used for generating XML.
- * INPUTS
- * request -- previously allocated request struct
- * RESULT
- * XMLRPC_REQUEST_OUTPUT_OPTIONS -- pointer to options stored, or NULL
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestSetOutputOptions ()
- * XMLRPC_RequestFree ()
- * XMLRPC_REQUEST
- * XMLRPC_REQUEST_OUTPUT_OPTIONS
- * SOURCE
- */
-XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestGetOutputOptions(XMLRPC_REQUEST request) {
- return request ? &request->output : NULL;
-}
-
-/*******/
-
-/*-*************************
-* End XMLRPC_REQUEST funcs *
-***************************/
-
-
-/*-***************************
-* Begin Serializiation funcs *
-*****************************/
-
-/****f* SERIALIZE/XMLRPC_VALUE_ToXML
- * NAME
- * XMLRPC_VALUE_ToXML
- * SYNOPSIS
- * char* XMLRPC_VALUE_ToXML(XMLRPC_VALUE val)
- * FUNCTION
- * encode XMLRPC_VALUE into XML buffer. Note that the generated
- * buffer will not contain a methodCall.
- * INPUTS
- * val -- previously allocated XMLRPC_VALUE
- * buf_len -- length of returned buffer, if not null
- * RESULT
- * char* -- newly allocated buffer containing XML.
- * It is the caller's responsibility to free it.
- * SEE ALSO
- * XMLRPC_REQUEST_ToXML ()
- * XMLRPC_VALUE_FromXML ()
- * XMLRPC_Free ()
- * XMLRPC_VALUE
- * SOURCE
- */
-char* XMLRPC_VALUE_ToXML(XMLRPC_VALUE val, int* buf_len) {
- xml_element *root_elem = XMLRPC_VALUE_to_xml_element(val);
- char* pRet = NULL;
-
- if(root_elem) {
- pRet = xml_elem_serialize_to_string(root_elem, NULL, buf_len);
- xml_elem_free(root_elem);
- }
- return pRet;
-}
-
-/*******/
-
-/****f* SERIALIZE/XMLRPC_REQUEST_ToXML
- * NAME
- * XMLRPC_REQUEST_ToXML
- * SYNOPSIS
- * char* XMLRPC_REQUEST_ToXML(XMLRPC_REQUEST request)
- * FUNCTION
- * encode XMLRPC_REQUEST into XML buffer
- * INPUTS
- * request -- previously allocated XMLRPC_REQUEST
- * buf_len -- size of returned buf, if not null
- * RESULT
- * char* -- newly allocated buffer containing XML.
- * It is the caller's responsibility to free it.
- * SEE ALSO
- * XMLRPC_REQUEST_ToXML ()
- * XMLRPC_REQUEST_FromXML ()
- * XMLRPC_Free ()
- * XMLRPC_VALUE_ToXML ()
- * XMLRPC_REQUEST
- * SOURCE
- */
-char* XMLRPC_REQUEST_ToXML(XMLRPC_REQUEST request, int* buf_len) {
- char* pRet = NULL;
- if (request) {
- xml_element *root_elem = NULL;
- if (request->output.version == xmlrpc_version_simple) {
- root_elem = DANDARPC_REQUEST_to_xml_element (request);
- }
- else if (request->output.version == xmlrpc_version_1_0 ||
- request->output.version == xmlrpc_version_none) {
- root_elem = XMLRPC_REQUEST_to_xml_element (request);
- }
- else if (request->output.version == xmlrpc_version_soap_1_1) {
- root_elem = SOAP_REQUEST_to_xml_element (request);
- }
-
- if(root_elem) {
- pRet =
- xml_elem_serialize_to_string (root_elem,
- &request->output.xml_elem_opts,
- buf_len);
- xml_elem_free(root_elem);
- }
- }
- return pRet;
-}
-
-/*******/
-
-/****f* SERIALIZE/XMLRPC_VALUE_FromXML
- * NAME
- * XMLRPC_VALUE_FromXML
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_VALUE_FromXML(const char* in_buf, int le
- * FUNCTION
- * Retrieve XMLRPC_VALUE from XML buffer. Note that this will
- * ignore any methodCall. See XMLRPC_REQUEST_FromXML
- * INPUTS
- * in_buf -- character buffer containing XML
- * len -- length of buffer
- * RESULT
- * XMLRPC_VALUE -- newly allocated data, or NULL if error. Should
- * be free'd by caller.
- * SEE ALSO
- * XMLRPC_VALUE_ToXML ()
- * XMLRPC_REQUEST_FromXML ()
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_VALUE_FromXML (const char *in_buf, int len, XMLRPC_REQUEST_INPUT_OPTIONS in_options) {
- XMLRPC_VALUE xResponse = NULL;
- XMLRPC_REQUEST req = XMLRPC_REQUEST_FromXML(in_buf, len, in_options);
-
- if(req) {
- xResponse = req->io;
- XMLRPC_RequestFree(req, 0);
- }
- return xResponse;
-}
-
-/*******/
-
-/* map parser errors to standard xml-rpc errors */
-static XMLRPC_VALUE map_expat_errors(XML_ELEM_ERROR error) {
- XMLRPC_VALUE xReturn = NULL;
- if(error) {
- XMLRPC_ERROR_CODE code;
- char buf[1024];
- snprintf(buf, sizeof(buf),
- "error occurred at line %i, column %i, byte index %i",
- error->line, error->column, error->byte_index);
-
- /* expat specific errors */
- switch(error->parser_code) {
- case XML_ERROR_UNKNOWN_ENCODING:
- code = xmlrpc_error_parse_unknown_encoding;
- break;
- case XML_ERROR_INCORRECT_ENCODING:
- code = xmlrpc_error_parse_bad_encoding;
- break;
- default:
- code = xmlrpc_error_parse_xml_syntax;
- break;
- }
- xReturn = XMLRPC_UtilityCreateFault(code, buf);
- }
- return xReturn;
-}
-
-/****f* SERIALIZE/XMLRPC_REQUEST_FromXML
- * NAME
- * XMLRPC_REQUEST_FromXML
- * SYNOPSIS
- * XMLRPC_REQUEST XMLRPC_REQUEST_FromXML(const char* in_buf, int le
- * FUNCTION
- * Retrieve XMLRPC_REQUEST from XML buffer
- * INPUTS
- * in_buf -- character buffer containing XML
- * len -- length of buffer
- * RESULT
- * XMLRPC_REQUEST -- newly allocated data, or NULL if error. Should
- * be free'd by caller.
- * SEE ALSO
- * XMLRPC_REQUEST_ToXML ()
- * XMLRPC_VALUE_FromXML ()
- * XMLRPC_REQUEST
- * SOURCE
- */
-XMLRPC_REQUEST XMLRPC_REQUEST_FromXML (const char *in_buf, int len,
- XMLRPC_REQUEST_INPUT_OPTIONS in_options) {
- XMLRPC_REQUEST request = XMLRPC_RequestNew();
- STRUCT_XML_ELEM_ERROR error = {0};
-
- if(request) {
- xml_element *root_elem =
- xml_elem_parse_buf (in_buf, len,
- (in_options ? &in_options->xml_elem_opts : NULL),
- &error);
-
- if(root_elem) {
- if(!strcmp(root_elem->name, "simpleRPC")) {
- request->output.version = xmlrpc_version_simple;
- xml_element_to_DANDARPC_REQUEST(request, root_elem);
- }
- else if (!strcmp (root_elem->name, "SOAP-ENV:Envelope")) {
- request->output.version = xmlrpc_version_soap_1_1;
- xml_element_to_SOAP_REQUEST (request, root_elem);
- }
- else {
- request->output.version = xmlrpc_version_1_0;
- xml_element_to_XMLRPC_REQUEST(request, root_elem);
- }
- xml_elem_free(root_elem);
- }
- else {
- if(error.parser_error) {
- XMLRPC_RequestSetError (request, map_expat_errors (&error));
- }
- }
- }
-
- return request;
-}
-
-/*******/
-
-/*-************************
-* End Serialization Funcs *
-**************************/
-
-
-
-/****f* VALUE/XMLRPC_CreateValueEmpty
- * NAME
- * XMLRPC_CreateValueEmpty
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueEmpty ()
- * FUNCTION
- * Create an XML value to be used/modified elsewhere.
- * INPUTS
- * RESULT
- * XMLRPC_VALUE. The new value, or NULL on failure.
- * SEE ALSO
- * XMLRPC_CleanupValue ()
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueEmpty() {
- XMLRPC_VALUE v = calloc(1, sizeof(STRUCT_XMLRPC_VALUE));
- if(v) {
-#ifdef XMLRPC_DEBUG_REFCOUNT
- printf ("calloc'd 0x%x\n", v);
-#endif
- v->type = xmlrpc_empty;
- simplestring_init(&v->id);
- simplestring_init(&v->str);
- }
- return v;
-}
-
-static const char* get_string(const char* buf, int bDup) {
- if(bDup) {
- return strdup(buf);
- }
- return buf;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_SetValueID_Case
- * NAME
- * XMLRPC_SetValueID_Case
- * SYNOPSIS
- * const char *XMLRPC_SetValueID_Case(XMLRPC_VALUE value, const char* id, int len, XMLRPC_CASE id_case)
- * FUNCTION
- * Assign an ID (key) to an XMLRPC value.
- * INPUTS
- * value The xml value who's ID we will set.
- * id The desired new id.
- * len length of id string if known, or 0 if unknown.
- * id_case one of XMLRPC_CASE
- * RESULT
- * const char* pointer to the newly allocated id string, or NULL
- * SEE ALSO
- * XMLRPC_SetValueID ()
- * XMLRPC_GetValueID ()
- * XMLRPC_VALUE
- * XMLRPC_CASE
- * SOURCE
- */
-const char *XMLRPC_SetValueID_Case(XMLRPC_VALUE value, const char* id, int len, XMLRPC_CASE id_case) {
- const char* pRetval = NULL;
- if(value) {
- if(id) {
- simplestring_clear(&value->id);
- (len > 0) ? simplestring_addn(&value->id, id, len) :
- simplestring_add(&value->id, id);
-
- /* upper or lower case string in place if required. could be a seperate func. */
- if(id_case == xmlrpc_case_lower || id_case == xmlrpc_case_upper) {
- int i;
- for(i = 0; i < value->id.len; i++) {
- value->id.str[i] =
- (id_case ==
- xmlrpc_case_lower) ? tolower (value->id.
- str[i]) : toupper (value->
- id.
- str[i]);
- }
- }
-
- pRetval = value->id.str;
-
-#ifdef XMLRPC_DEBUG_REFCOUNT
- printf("set value id: %s\n", pRetval);
-#endif
- }
- }
-
- return pRetval;
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_SetValueString
- * NAME
- * XMLRPC_SetValueString
- * SYNOPSIS
- * const char *XMLRPC_SetValueString(XMLRPC_VALUE value, const char* val, int len)
- * FUNCTION
- * Assign a string value to an XMLRPC_VALUE, and set it to type xmlrpc_string
- * INPUTS
- * value The xml value who's ID we will set.
- * val The desired new string val.
- * len length of val string if known, or 0 if unknown.
- * RESULT
- * const char* pointer to the newly allocated value string, or NULL
- * SEE ALSO
- * XMLRPC_GetValueString ()
- * XMLRPC_VALUE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-const char *XMLRPC_SetValueString(XMLRPC_VALUE value, const char* val, int len) {
- char *pRetval = NULL;
- if(value && val) {
- simplestring_clear(&value->str);
- (len > 0) ? simplestring_addn(&value->str, val, len) :
- simplestring_add(&value->str, val);
- value->type = xmlrpc_string;
- pRetval = (char *)value->str.str;
- }
-
- return pRetval;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_SetValueInt
- * NAME
- * XMLRPC_SetValueInt
- * SYNOPSIS
- * void XMLRPC_SetValueInt(XMLRPC_VALUE value, int val)
- * FUNCTION
- * Assign an int value to an XMLRPC_VALUE, and set it to type xmlrpc_int
- * INPUTS
- * value The xml value who's ID we will set.
- * val The desired new integer value
- * RESULT
- * SEE ALSO
- * XMLRPC_GetValueInt ()
- * XMLRPC_VALUE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-void XMLRPC_SetValueInt(XMLRPC_VALUE value, int val) {
- if(value) {
- value->type = xmlrpc_int;
- value->i = val;
- }
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_SetValueBoolean
- * NAME
- * XMLRPC_SetValueBoolean
- * SYNOPSIS
- * void XMLRPC_SetValueBoolean(XMLRPC_VALUE value, int val)
- * FUNCTION
- * Assign a boolean value to an XMLRPC_VALUE, and set it to type xmlrpc_boolean
- * INPUTS
- * value The xml value who's value we will set.
- * val The desired new boolean value. [0 | 1]
- * RESULT
- * SEE ALSO
- * XMLRPC_GetValueBoolean ()
- * XMLRPC_VALUE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-void XMLRPC_SetValueBoolean(XMLRPC_VALUE value, int val) {
- if(value) {
- value->type = xmlrpc_boolean;
- value->i = val ? 1 : 0;
- }
-}
-
-/*******/
-
-
-/****f* VECTOR/XMLRPC_SetIsVector
- * NAME
- * XMLRPC_SetIsVector
- * SYNOPSIS
- * int XMLRPC_SetIsVector(XMLRPC_VALUE value, XMLRPC_VECTOR_TYPE type)
- * FUNCTION
- * Set the XMLRPC_VALUE to be a vector (list) type. The vector may be one of
- * [xmlrpc_array | xmlrpc_struct | xmlrpc_mixed]. An array has only index values.
- * A struct has key/val pairs. Mixed allows both index and key/val combinations.
- * INPUTS
- * value The xml value who's vector type we will set
- * type New type of vector as enumerated by XMLRPC_VECTOR_TYPE
- * RESULT
- * int 1 if successful, 0 otherwise
- * SEE ALSO
- * XMLRPC_GetValueType ()
- * XMLRPC_GetVectorType ()
- * XMLRPC_VALUE
- * XMLRPC_VECTOR_TYPE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-int XMLRPC_SetIsVector(XMLRPC_VALUE value, XMLRPC_VECTOR_TYPE type) {
- int bSuccess = 0;
-
- if (value) {
- // we can change the type so long as nothing is currently stored.
- if(value->type == xmlrpc_vector) {
- if(value->v) {
- if(!Q_Size(value->v->q)) {
- value->v->type = type;
- }
- }
- }
- else {
- value->v = calloc(1, sizeof(STRUCT_XMLRPC_VECTOR));
- if(value->v) {
- value->v->q = (queue*)malloc(sizeof(queue));
- if(value->v->q) {
- Q_Init(value->v->q);
- value->v->type = type;
- value->type = xmlrpc_vector;
- bSuccess = 1;
- }
- }
- }
- }
-
- return bSuccess;
-}
-
-/*******/
-
-/****f* VECTOR/XMLRPC_CreateVector
- * NAME
- * XMLRPC_CreateVector
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateVector(const char* id, XMLRPC_VECTOR_TYPE type)
- * FUNCTION
- * Create a new vector and optionally set an id.
- * INPUTS
- * id The id of the vector, or NULL
- * type New type of vector as enumerated by XMLRPC_VECTOR_TYPE
- * RESULT
- * XMLRPC_VALUE The new vector, or NULL on failure.
- * SEE ALSO
- * XMLRPC_CreateValueEmpty ()
- * XMLRPC_SetIsVector ()
- * XMLRPC_GetValueType ()
- * XMLRPC_GetVectorType ()
- * XMLRPC_VALUE
- * XMLRPC_VECTOR_TYPE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateVector(const char* id, XMLRPC_VECTOR_TYPE type) {
- XMLRPC_VALUE val = NULL;
-
- val = XMLRPC_CreateValueEmpty();
- if(val) {
- XMLRPC_VECTOR *pSIV = NULL;
-
- if(XMLRPC_SetIsVector(val, type)) {
- if(id) {
- const char *pSVI = NULL;
-
- pSVI = XMLRPC_SetValueID(val, id, 0);
- if(NULL == pSVI) {
- val = NULL;
- }
- }
- }
- else {
- val = NULL;
- }
- }
- return val;
-}
-
-/*******/
-
-
-/* Not yet implemented.
- *
- * This should use a hash to determine if a given target id has already
- * been appended.
- *
- * Alternately, it could walk the entire vector, but that could be quite
- * slow for very large lists.
- */
-static int isDuplicateEntry(XMLRPC_VALUE target, XMLRPC_VALUE source) {
- return 0;
-}
-
-/****f* VECTOR/XMLRPC_AddValueToVector
- * NAME
- * XMLRPC_AddValueToVector
- * SYNOPSIS
- * int XMLRPC_AddValueToVector(XMLRPC_VALUE target, XMLRPC_VALUE source)
- * FUNCTION
- * Add (append) an existing XMLRPC_VALUE to a vector.
- * INPUTS
- * target The target vector
- * source The source value to append
- * RESULT
- * int 1 if successful, else 0
- * SEE ALSO
- * XMLRPC_AddValuesToVector ()
- * XMLRPC_VectorGetValueWithID_Case ()
- * XMLRPC_VALUE
- * NOTES
- * The function will fail and return 0 if an attempt is made to add
- * a value with an ID into a vector of type xmlrpc_vector_array. Such
- * values can only be added to xmlrpc_vector_struct.
- * SOURCE
- */
-int XMLRPC_AddValueToVector(XMLRPC_VALUE target, XMLRPC_VALUE source) {
- if(target && source) {
- if(target->type == xmlrpc_vector && target->v &&
- target->v->q && target->v->type != xmlrpc_vector_none) {
-
- /* guard against putting value of unknown type into vector */
- switch(source->type) {
- case xmlrpc_empty:
- case xmlrpc_base64:
- case xmlrpc_boolean:
- case xmlrpc_datetime:
- case xmlrpc_double:
- case xmlrpc_int:
- case xmlrpc_string:
- case xmlrpc_vector:
- /* Guard against putting a key/val pair into an array vector */
- if( !(source->id.len && target->v->type == xmlrpc_vector_array) ) {
- if (isDuplicateEntry (target, source)
- || Q_PushTail (target->v->q, XMLRPC_CopyValue (source))) {
- return 1;
- }
- }
- else {
- fprintf (stderr,
- "xmlrpc: attempted to add key/val pair to vector of type array\n");
- }
- break;
- default:
- fprintf (stderr,
- "xmlrpc: attempted to add value of unknown type to vector\n");
- break;
- }
- }
- }
- return 0;
-}
-
-/*******/
-
-
-/****f* VECTOR/XMLRPC_AddValuesToVector
- * NAME
- * XMLRPC_AddValuesToVector
- * SYNOPSIS
- * XMLRPC_AddValuesToVector ( target, val1, val2, val3, val(n), 0 )
- * XMLRPC_AddValuesToVector( XMLRPC_VALUE, ... )
- * FUNCTION
- * Add (append) a series of existing XMLRPC_VALUE to a vector.
- * INPUTS
- * target The target vector
- * ... The source value(s) to append. The last item *must* be 0.
- * RESULT
- * int 1 if successful, else 0
- * SEE ALSO
- * XMLRPC_AddValuesToVector ()
- * XMLRPC_VectorGetValueWithID_Case ()
- * XMLRPC_VALUE
- * NOTES
- * This function may actually return failure after it has already modified
- * or added items to target. You can not trust the state of target
- * if this function returns failure.
- * SOURCE
- */
-int XMLRPC_AddValuesToVector(XMLRPC_VALUE target, ...) {
- int iRetval = 0;
-
- if(target) {
- if(target->type == xmlrpc_vector) {
- XMLRPC_VALUE v = NULL;
- va_list vl;
-
- va_start(vl, target);
-
- do {
- v = va_arg(vl, XMLRPC_VALUE);
- if(v) {
- if(!XMLRPC_AddValueToVector(target, v)) {
- iRetval = 0;
- break;
- }
- }
- }
- while (v);
-
- va_end(vl);
-
- if(NULL == v) {
- iRetval = 1;
- }
- }
- }
- return iRetval;
-}
-
-/*******/
-
-
-/****f* VECTOR/XMLRPC_VectorGetValueWithID_Case
- * NAME
- * XMLRPC_VectorGetValueWithID_Case
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_VectorGetValueWithID_Case(XMLRPC_VALUE vector, const char* id, XMLRPC_CASE_COMPARISON id_case)
- * FUNCTION
- * Get value from vector matching id (key)
- * INPUTS
- * vector The source vector
- * id The key to find
- * id_case Rule for how to match key
- * RESULT
- * int 1 if successful, else 0
- * SEE ALSO
- * XMLRPC_SetValueID_Case ()
- * XMLRPC_VALUE
- * XMLRPC_CASE_COMPARISON
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_VectorGetValueWithID_Case (XMLRPC_VALUE vector, const char *id,
- XMLRPC_CASE_COMPARISON id_case) {
- if(vector && vector->v && vector->v->q) {
- q_iter qi = Q_Iter_Head_F(vector->v->q);
-
- while(qi) {
- XMLRPC_VALUE xIter = Q_Iter_Get_F(qi);
- if(xIter && xIter->id.str) {
- if(id_case == xmlrpc_case_sensitive) {
- if(!strcmp(xIter->id.str, id)) {
- return xIter;
- }
- }
- else if(id_case == xmlrpc_case_insensitive) {
- if(!strcasecmp(xIter->id.str, id)) {
- return xIter;
- }
- }
- }
- qi = Q_Iter_Next_F(qi);
- }
- }
- return NULL;
-}
-
-/*******/
-
-
-int XMLRPC_VectorRemoveValue(XMLRPC_VALUE vector, XMLRPC_VALUE value) {
- if(vector && vector->v && vector->v->q && value) {
- q_iter qi = Q_Iter_Head_F(vector->v->q);
-
- while(qi) {
- XMLRPC_VALUE xIter = Q_Iter_Get_F(qi);
- if(xIter == value) {
- XMLRPC_CleanupValue(xIter);
- Q_Iter_Del(vector->v->q, qi);
- return 1;
- }
- qi = Q_Iter_Next_F(qi);
- }
- }
- return 0;
-}
-
-
-/****f* VALUE/XMLRPC_CreateValueString
- * NAME
- * XMLRPC_CreateValueString
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueString(const char* id, const char* val, int len)
- * FUNCTION
- * Create an XMLRPC_VALUE, and assign a string to it
- * INPUTS
- * id The id of the value, or NULL
- * val The desired new string val.
- * len length of val string if known, or 0 if unknown.
- * RESULT
- * newly allocated XMLRPC_VALUE, or NULL
- * SEE ALSO
- * XMLRPC_GetValueString ()
- * XMLRPC_CreateValueEmpty ()
- * XMLRPC_VALUE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueString(const char* id, const char* val, int len) {
- XMLRPC_VALUE value = NULL;
- if(val) {
- value = XMLRPC_CreateValueEmpty();
- if(value) {
- XMLRPC_SetValueString(value, val, len);
- if(id) {
- XMLRPC_SetValueID(value, id, 0);
- }
- }
- }
- return value;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_CreateValueInt
- * NAME
- * XMLRPC_CreateValueInt
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueInt(const char* id, int i)
- * FUNCTION
- * Create an XMLRPC_VALUE, and assign an int to it
- * INPUTS
- * id The id of the value, or NULL
- * i The desired new int val.
- * RESULT
- * newly allocated XMLRPC_VALUE, or NULL
- * SEE ALSO
- * XMLRPC_GetValueInt ()
- * XMLRPC_CreateValueEmpty ()
- * XMLRPC_VALUE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueInt(const char* id, int i) {
- XMLRPC_VALUE val = XMLRPC_CreateValueEmpty();
- if(val) {
- XMLRPC_SetValueInt(val, i);
- if(id) {
- XMLRPC_SetValueID(val, id, 0);
- }
- }
- return val;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_CreateValueBoolean
- * NAME
- * XMLRPC_CreateValueBoolean
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueBoolean(const char* id, int i)
- * FUNCTION
- * Create an XMLRPC_VALUE, and assign an int to it
- * INPUTS
- * id The id of the value, or NULL
- * i The desired new int val.
- * RESULT
- * newly allocated XMLRPC_VALUE, or NULL
- * SEE ALSO
- * XMLRPC_GetValueBoolean ()
- * XMLRPC_CreateValueEmpty ()
- * XMLRPC_VALUE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueBoolean(const char* id, int i) {
- XMLRPC_VALUE val = XMLRPC_CreateValueEmpty();
- if(val) {
- XMLRPC_SetValueBoolean(val, i);
- if(id) {
- XMLRPC_SetValueID(val, id, 0);
- }
- }
- return val;
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_CleanupValue
- * NAME
- * XMLRPC_CleanupValue
- * SYNOPSIS
- * void XMLRPC_CleanupValue(XMLRPC_VALUE value)
- * FUNCTION
- * Frees all memory allocated for an XMLRPC_VALUE and any of its children (if a vector)
- * INPUTS
- * value The id of the value to be cleaned up.
- * RESULT
- * void
- * NOTES
- * Normally this function will be called for the topmost vector, thus free-ing
- * all children. If a child of a vector is free'd first, results are undefined.
- * Failure to call this function *will* cause memory leaks.
- *
- * Also, this function is implemented using reference counting. Thus a value
- * may be added and freed from multiple parents so long as a reference is added
- * first using XMLRPC_CopyValue()
- * SEE ALSO
- * XMLRPC_RequestFree ()
- * XMLRPC_CreateValueEmpty ()
- * XMLRPC_CopyValue()
- * XMLRPC_VALUE
- * SOURCE
- */
-void XMLRPC_CleanupValue(XMLRPC_VALUE value) {
- if(value) {
- if(value->iRefCount > 0) {
- value->iRefCount --;
- }
-
-#ifdef XMLRPC_DEBUG_REFCOUNT
- if(value->id.str) {
- printf ("decremented refcount of %s, now %i\n", value->id.str,
- value->iRefCount);
- }
- else {
- printf ("decremented refcount of 0x%x, now %i\n", value,
- value->iRefCount);
- }
-#endif
-
- if(value->type == xmlrpc_vector) {
- if(value->v) {
- if(value->iRefCount == 0) {
- XMLRPC_VALUE cur = (XMLRPC_VALUE)Q_Head(value->v->q);
- while( cur ) {
- XMLRPC_CleanupValue(cur);
-
- /* Make sure some idiot didn't include a vector as a child of itself
- * and thus it would have already free'd these.
- */
- if(value->v && value->v->q) {
- cur = Q_Next(value->v->q);
- }
- else {
- break;
- }
- }
-
- Q_Destroy(value->v->q);
- my_free(value->v->q);
- my_free(value->v);
- }
- }
- }
-
-
- if(value->iRefCount == 0) {
-
- /* guard against freeing invalid types */
- switch(value->type) {
- case xmlrpc_empty:
- case xmlrpc_base64:
- case xmlrpc_boolean:
- case xmlrpc_datetime:
- case xmlrpc_double:
- case xmlrpc_int:
- case xmlrpc_string:
- case xmlrpc_vector:
-#ifdef XMLRPC_DEBUG_REFCOUNT
- if(value->id.str) {
- printf("free'd %s\n", value->id.str);
- }
- else {
- printf("free'd 0x%x\n", value);
- }
-#endif
- simplestring_free(&value->id);
- simplestring_free(&value->str);
-
- memset(value, 0, sizeof(STRUCT_XMLRPC_VALUE));
- my_free(value);
- break;
- default:
- fprintf (stderr,
- "xmlrpc: attempted to free value of invalid type\n");
- break;
- }
- }
- }
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_SetValueDateTime
- * NAME
- * XMLRPC_SetValueDateTime
- * SYNOPSIS
- * void XMLRPC_SetValueDateTime(XMLRPC_VALUE value, time_t time)
- * FUNCTION
- * Assign time value to XMLRPC_VALUE
- * INPUTS
- * value The target XMLRPC_VALUE
- * time The desired new unix time value (time_t)
- * RESULT
- * void
- * SEE ALSO
- * XMLRPC_GetValueDateTime ()
- * XMLRPC_SetValueDateTime_ISO8601 ()
- * XMLRPC_CreateValueDateTime ()
- * XMLRPC_VALUE
- * SOURCE
- */
-void XMLRPC_SetValueDateTime(XMLRPC_VALUE value, time_t time) {
- if(value) {
- char timeBuf[30];
- value->type = xmlrpc_datetime;
- value->i = time;
-
- timeBuf[0] = 0;
-
- date_to_ISO8601(time, timeBuf, sizeof(timeBuf));
-
- if(timeBuf[0]) {
- simplestring_clear(&value->str);
- simplestring_add(&value->str, timeBuf);
- }
- }
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_CopyValue
- * NAME
- * XMLRPC_CopyValue
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CopyValue(XMLRPC_VALUE value)
- * FUNCTION
- * Make a copy (reference) of an XMLRPC_VALUE
- * INPUTS
- * value The target XMLRPC_VALUE
- * RESULT
- * XMLRPC_VALUE -- address of the copy
- * SEE ALSO
- * XMLRPC_CleanupValue ()
- * XMLRPC_DupValueNew ()
- * NOTES
- * This function is implemented via reference counting, so the
- * returned value is going to be the same as the passed in value.
- * The value must be freed the same number of times it is copied
- * or there will be a memory leak.
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CopyValue(XMLRPC_VALUE value) {
- if(value) {
- value->iRefCount ++;
-#ifdef XMLRPC_DEBUG_REFCOUNT
- if(value->id.str) {
- printf ("incremented refcount of %s, now %i\n", value->id.str,
- value->iRefCount);
- }
- else {
- printf ("incremented refcount of 0x%x, now %i\n", value,
- value->iRefCount);
- }
-#endif
- }
- return value;
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_DupValueNew
- * NAME
- * XMLRPC_DupValueNew
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_DupValueNew(XMLRPC_VALUE value)
- * FUNCTION
- * Make a duplicate (non reference) of an XMLRPC_VALUE with newly allocated mem.
- * INPUTS
- * value The source XMLRPC_VALUE to duplicate
- * RESULT
- * XMLRPC_VALUE -- address of the duplicate value
- * SEE ALSO
- * XMLRPC_CleanupValue ()
- * XMLRPC_CopyValue ()
- * NOTES
- * Use this when function when you need to modify the contents of
- * the copied value seperately from the original.
- *
- * this function is recursive, thus the value and all of its children
- * (if any) will be duplicated.
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_DupValueNew (XMLRPC_VALUE xSource) {
- XMLRPC_VALUE xReturn = NULL;
- if (xSource) {
- xReturn = XMLRPC_CreateValueEmpty ();
- if (xSource->id.len) {
- XMLRPC_SetValueID (xReturn, xSource->id.str, xSource->id.len);
- }
-
- switch (xSource->type) {
- case xmlrpc_int:
- case xmlrpc_boolean:
- XMLRPC_SetValueInt (xReturn, xSource->i);
- break;
- case xmlrpc_string:
- case xmlrpc_base64:
- XMLRPC_SetValueString (xReturn, xSource->str.str, xSource->str.len);
- break;
- case xmlrpc_datetime:
- XMLRPC_SetValueDateTime (xReturn, xSource->i);
- break;
- case xmlrpc_double:
- XMLRPC_SetValueDouble (xReturn, xSource->d);
- break;
- case xmlrpc_vector:
- {
- q_iter qi = Q_Iter_Head_F (xSource->v->q);
- XMLRPC_SetIsVector (xReturn, xSource->v->type);
-
- while (qi) {
- XMLRPC_VALUE xIter = Q_Iter_Get_F (qi);
- XMLRPC_AddValueToVector (xReturn, XMLRPC_DupValueNew (xIter));
- qi = Q_Iter_Next_F (qi);
- }
- }
- break;
- }
- }
- return xReturn;
-}
-
-/*******/
-
-
-
-/****f* VALUE/XMLRPC_CreateValueDateTime
- * NAME
- * XMLRPC_CreateValueDateTime
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueDateTime(const char* id, time_t time)
- * FUNCTION
- * Create new datetime value from time_t
- * INPUTS
- * id id of the new value, or NULL
- * time The desired unix time value (time_t)
- * RESULT
- * void
- * SEE ALSO
- * XMLRPC_GetValueDateTime ()
- * XMLRPC_SetValueDateTime ()
- * XMLRPC_CreateValueDateTime_ISO8601 ()
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueDateTime(const char* id, time_t time) {
- XMLRPC_VALUE val = XMLRPC_CreateValueEmpty();
- if(val) {
- XMLRPC_SetValueDateTime(val, time);
- if(id) {
- XMLRPC_SetValueID(val, id, 0);
- }
- }
- return val;
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_SetValueDateTime_ISO8601
- * NAME
- * XMLRPC_SetValueDateTime_ISO8601
- * SYNOPSIS
- * void XMLRPC_SetValueDateTime_ISO8601(XMLRPC_VALUE value, const char* s)
- * FUNCTION
- * Set datetime value from IS08601 encoded string
- * INPUTS
- * value The target XMLRPC_VALUE
- * s The desired new time value
- * RESULT
- * void
- * BUGS
- * This function currently attempts to convert the time string to a valid unix time
- * value before passing it. Behavior when the string is invalid or out of range
- * is not well defined, but will probably result in Jan 1, 1970 (0) being passed.
- * SEE ALSO
- * XMLRPC_GetValueDateTime_ISO8601 ()
- * XMLRPC_CreateValueDateTime_ISO8601 ()
- * XMLRPC_CreateValueDateTime ()
- * XMLRPC_VALUE
- * SOURCE
- */
-void XMLRPC_SetValueDateTime_ISO8601(XMLRPC_VALUE value, const char* s) {
- if(value) {
- time_t time_val = 0;
- if(s) {
- date_from_ISO8601(s, &time_val);
- XMLRPC_SetValueDateTime(value, time_val);
- }
- }
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_CreateValueDateTime_ISO8601
- * NAME
- * XMLRPC_CreateValueDateTime_ISO8601
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueDateTime_ISO8601(const char* id, const char *s)
- * FUNCTION
- * Create datetime value from IS08601 encoded string
- * INPUTS
- * id The id of the new value, or NULL
- * s The desired new time value
- * RESULT
- * newly allocated XMLRPC_VALUE, or NULL if no value created.
- * BUGS
- * See XMLRPC_SetValueDateTime_ISO8601 ()
- * SEE ALSO
- * XMLRPC_GetValueDateTime_ISO8601 ()
- * XMLRPC_SetValueDateTime_ISO8601 ()
- * XMLRPC_CreateValueDateTime ()
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueDateTime_ISO8601(const char* id, const char *s) {
- XMLRPC_VALUE val = XMLRPC_CreateValueEmpty();
- if(val) {
- XMLRPC_SetValueDateTime_ISO8601(val, s);
- if(id) {
- XMLRPC_SetValueID(val, id, 0);
- }
- }
- return val;
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_SetValueBase64
- * NAME
- * XMLRPC_SetValueBase64
- * SYNOPSIS
- * void XMLRPC_SetValueBase64(XMLRPC_VALUE value, const char* s, int len)
- * FUNCTION
- * Set base64 value. Base64 is useful for transferring binary data, such as an image.
- * INPUTS
- * value The target XMLRPC_VALUE
- * s The desired new binary value
- * len The length of s, or NULL. If buffer is not null terminated, len *must* be passed.
- * RESULT
- * void
- * NOTES
- * Data is set/stored/retrieved as passed in, but is base64 encoded for XML transfer, and
- * decoded on the other side. This is transparent to the caller.
- * SEE ALSO
- * XMLRPC_GetValueBase64 ()
- * XMLRPC_CreateValueBase64 ()
- * XMLRPC_VALUE
- * SOURCE
- */
-void XMLRPC_SetValueBase64(XMLRPC_VALUE value, const char* s, int len) {
- if(value && s) {
- simplestring_clear(&value->str);
- (len > 0) ? simplestring_addn(&value->str, s, len) :
- simplestring_add(&value->str, s);
- value->type = xmlrpc_base64;
- }
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_CreateValueBase64
- * NAME
- * XMLRPC_CreateValueBase64
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueBase64(const char* id, const char* s, int len)
- * FUNCTION
- * Create base64 value. Base64 is useful for transferring binary data, such as an image.
- * INPUTS
- * id id of the new value, or NULL
- * s The desired new binary value
- * len The length of s, or NULL. If buffer is not null terminated, len *must* be passed.
- * RESULT
- * newly allocated XMLRPC_VALUE, or NULL if error
- * NOTES
- * See XMLRPC_SetValueBase64 ()
- * SEE ALSO
- * XMLRPC_GetValueBase64 ()
- * XMLRPC_SetValueBase64 ()
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueBase64(const char* id, const char* s, int len) {
- XMLRPC_VALUE val = XMLRPC_CreateValueEmpty();
- if(val) {
- XMLRPC_SetValueBase64(val, s, len);
- if(id) {
- XMLRPC_SetValueID(val, id, 0);
- }
- }
- return val;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_SetValueDouble
- * NAME
- * XMLRPC_SetValueDouble
- * SYNOPSIS
- * void XMLRPC_SetValueDouble(XMLRPC_VALUE value, double val)
- * FUNCTION
- * Set double (floating point) value.
- * INPUTS
- * value The target XMLRPC_VALUE
- * val The desired new double value
- * RESULT
- * void
- * SEE ALSO
- * XMLRPC_GetValueDouble ()
- * XMLRPC_CreateValueDouble ()
- * XMLRPC_VALUE
- * SOURCE
- */
-void XMLRPC_SetValueDouble(XMLRPC_VALUE value, double val) {
- if(value) {
- value->type = xmlrpc_double;
- value->d = val;
- }
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_CreateValueDouble
- * NAME
- * XMLRPC_CreateValueDouble
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueDouble(const char* id, double d)
- * FUNCTION
- * Create double (floating point) value.
- * INPUTS
- * id id of the newly created value, or NULL
- * d The desired new double value
- * RESULT
- * void
- * SEE ALSO
- * XMLRPC_GetValueDouble ()
- * XMLRPC_CreateValueDouble ()
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueDouble(const char* id, double d) {
- XMLRPC_VALUE val = XMLRPC_CreateValueEmpty();
- if(val) {
- XMLRPC_SetValueDouble(val, d);
- if(id) {
- XMLRPC_SetValueID(val, id, 0);
- }
- }
- return val;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueString
- * NAME
- * XMLRPC_GetValueString
- * SYNOPSIS
- * const char* XMLRPC_GetValueString(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve string value
- * INPUTS
- * value source XMLRPC_VALUE of type xmlrpc_string
- * RESULT
- * void
- * SEE ALSO
- * XMLRPC_SetValueString ()
- * XMLRPC_GetValueType ()
- * XMLRPC_VALUE
- * SOURCE
- */
-const char* XMLRPC_GetValueString(XMLRPC_VALUE value) {
- return ((value && value->type == xmlrpc_string) ? value->str.str : 0);
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueStringLen
- * NAME
- * XMLRPC_GetValueStringLen
- * SYNOPSIS
- * int XMLRPC_GetValueStringLen(XMLRPC_VALUE value)
- * FUNCTION
- * determine length of string value
- * INPUTS
- * value XMLRPC_VALUE of type xmlrpc_string
- * RESULT
- * length of string, or 0
- * NOTES
- * SEE ALSO
- * XMLRPC_SetValueString ()
- * XMLRPC_GetValueString ()
- * SOURCE
- */
-int XMLRPC_GetValueStringLen(XMLRPC_VALUE value) {
- return ((value) ? value->str.len : 0);
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueInt
- * NAME
- * XMLRPC_GetValueInt
- * SYNOPSIS
- * int XMLRPC_GetValueInt(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve integer value.
- * INPUTS
- * value XMLRPC_VALUE of type xmlrpc_int
- * RESULT
- * integer value or 0 if value is not valid int
- * NOTES
- * use XMLRPC_GetValueType () to be sure if 0 is real return value or not
- * SEE ALSO
- * XMLRPC_SetValueInt ()
- * XMLRPC_CreateValueInt ()
- * SOURCE
- */
-int XMLRPC_GetValueInt(XMLRPC_VALUE value) {
- return ((value && value->type == xmlrpc_int) ? value->i : 0);
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueBoolean
- * NAME
- * XMLRPC_GetValueBoolean
- * SYNOPSIS
- * int XMLRPC_GetValueBoolean(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve boolean value.
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_boolean
- * RESULT
- * boolean value or 0 if value is not valid boolean
- * NOTES
- * use XMLRPC_GetValueType() to be sure if 0 is real value or not
- * SEE ALSO
- * XMLRPC_SetValueBoolean ()
- * XMLRPC_CreateValueBoolean ()
- * SOURCE
- */
-int XMLRPC_GetValueBoolean(XMLRPC_VALUE value) {
- return ((value && value->type == xmlrpc_boolean) ? value->i : 0);
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueDouble
- * NAME
- * XMLRPC_GetValueDouble
- * SYNOPSIS
- * double XMLRPC_GetValueDouble(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve double value
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_double
- * RESULT
- * double value or 0 if value is not valid double.
- * NOTES
- * use XMLRPC_GetValueType() to be sure if 0 is real value or not
- * SEE ALSO
- * XMLRPC_SetValueDouble ()
- * XMLRPC_CreateValueDouble ()
- * SOURCE
- */
-double XMLRPC_GetValueDouble(XMLRPC_VALUE value) {
- return ((value && value->type == xmlrpc_double) ? value->d : 0);
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueBase64
- * NAME
- * XMLRPC_GetValueBase64
- * SYNOPSIS
- * const char* XMLRPC_GetValueBase64(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve binary value
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_base64
- * RESULT
- * pointer to binary value or 0 if value is not valid.
- * SEE ALSO
- * XMLRPC_SetValueBase64 ()
- * XMLRPC_CreateValueBase64 ()
- * NOTES
- * Call XMLRPC_GetValueStringLen() to retrieve real length of binary data. strlen()
- * will not be accurate, as returned data may contain embedded nulls.
- * SOURCE
- */
-const char* XMLRPC_GetValueBase64(XMLRPC_VALUE value) {
- return ((value && value->type == xmlrpc_base64) ? value->str.str : 0);
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueDateTime
- * NAME
- * XMLRPC_GetValueDateTime
- * SYNOPSIS
- * time_t XMLRPC_GetValueDateTime(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve time_t value
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_datetime
- * RESULT
- * time_t value or 0 if value is not valid datetime.
- * NOTES
- * use XMLRPC_GetValueType() to be sure if 0 is real value or not
- * SEE ALSO
- * XMLRPC_SetValueDateTime ()
- * XMLRPC_GetValueDateTime_ISO8601 ()
- * XMLRPC_CreateValueDateTime ()
- * SOURCE
- */
-time_t XMLRPC_GetValueDateTime(XMLRPC_VALUE value) {
- return (time_t)((value && value->type == xmlrpc_datetime) ? value->i : 0);
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueDateTime_IOS8601
- * NAME
- * XMLRPC_GetValueDateTime_IOS8601
- * SYNOPSIS
- * const char* XMLRPC_GetValueDateTime_IOS8601(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve ISO8601 formatted time value
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_datetime
- * RESULT
- * const char* value or 0 if value is not valid datetime.
- * SEE ALSO
- * XMLRPC_SetValueDateTime_IOS8601 ()
- * XMLRPC_GetValueDateTime ()
- * XMLRPC_CreateValueDateTime_IOS8601 ()
- * SOURCE
- */
-const char* XMLRPC_GetValueDateTime_ISO8601(XMLRPC_VALUE value) {
- return ((value && value->type == xmlrpc_datetime) ? value->str.str : 0);
-}
-
-/*******/
-
-/* Get ID (key) of value or NULL */
-/****f* VALUE/XMLRPC_GetValueID
- * NAME
- * XMLRPC_GetValueID
- * SYNOPSIS
- * const char* XMLRPC_GetValueID(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve id (key) of value
- * INPUTS
- * XMLRPC_VALUE of any type
- * RESULT
- * const char* pointer to id of value, or NULL
- * NOTES
- * SEE ALSO
- * XMLRPC_SetValueID()
- * XMLRPC_CreateValueEmpty()
- * SOURCE
- */
-const char* XMLRPC_GetValueID(XMLRPC_VALUE value) {
- return (const char*)((value && value->id.len) ? value->id.str : 0);
-}
-
-/*******/
-
-
-/****f* VECTOR/XMLRPC_VectorSize
- * NAME
- * XMLRPC_VectorSize
- * SYNOPSIS
- * int XMLRPC_VectorSize(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve size of vector
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_vector
- * RESULT
- * count of items in vector
- * NOTES
- * This is a cheap operation even on large vectors. Vector size is
- * maintained by queue during add/remove ops.
- * SEE ALSO
- * XMLRPC_AddValueToVector ()
- * SOURCE
- */
-int XMLRPC_VectorSize(XMLRPC_VALUE value) {
- int size = 0;
- if(value && value->type == xmlrpc_vector && value->v) {
- size = Q_Size(value->v->q);
- }
- return size;
-}
-
-/*******/
-
-/****f* VECTOR/XMLRPC_VectorRewind
- * NAME
- * XMLRPC_VectorRewind
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_VectorRewind(XMLRPC_VALUE value)
- * FUNCTION
- * reset vector to first item
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_vector
- * RESULT
- * first XMLRPC_VALUE in list, or NULL if empty or error.
- * NOTES
- * Be careful to rewind any vector passed in to you if you expect to
- * iterate through the entire list.
- * SEE ALSO
- * XMLRPC_VectorNext ()
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_VectorRewind(XMLRPC_VALUE value) {
- XMLRPC_VALUE xReturn = NULL;
- if(value && value->type == xmlrpc_vector && value->v) {
- xReturn = (XMLRPC_VALUE)Q_Head(value->v->q);
- }
- return xReturn;
-}
-
-/*******/
-
-/****f* VECTOR/XMLRPC_VectorNext
- * NAME
- * XMLRPC_VectorNext
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_VectorNext(XMLRPC_VALUE value)
- * FUNCTION
- * Iterate vector to next item in list.
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_vector
- * RESULT
- * Next XMLRPC_VALUE in vector, or NULL if at end.
- * NOTES
- * SEE ALSO
- * XMLRPC_VectorRewind ()
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_VectorNext(XMLRPC_VALUE value) {
- XMLRPC_VALUE xReturn = NULL;
- if(value && value->type == xmlrpc_vector && value->v) {
- xReturn = (XMLRPC_VALUE)Q_Next(value->v->q);
- }
- return xReturn;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueType
- * NAME
- * XMLRPC_GetValueType
- * SYNOPSIS
- * XMLRPC_VALUE_TYPE XMLRPC_GetValueType(XMLRPC_VALUE value)
- * FUNCTION
- * determine data type of the XMLRPC_VALUE
- * INPUTS
- * XMLRPC_VALUE target of query
- * RESULT
- * data type of value as enumerated by XMLRPC_VALUE_TYPE
- * NOTES
- * all values are of type xmlrpc_empty until set.
- * Deprecated for public use. See XMLRPC_GetValueTypeEasy
- * SEE ALSO
- * XMLRPC_SetValue*
- * XMLRPC_CreateValue*
- * XMLRPC_Append*
- * XMLRPC_GetValueTypeEasy ()
- * SOURCE
- */
-XMLRPC_VALUE_TYPE XMLRPC_GetValueType(XMLRPC_VALUE value) {
- return value ? value->type : xmlrpc_empty;
-}
-
-/*******/
-
-/* Vector type accessor */
-/****f* VALUE/XMLRPC_GetVectorType
- * NAME
- * XMLRPC_GetVectorType
- * SYNOPSIS
- * XMLRPC_VECTOR_TYPE XMLRPC_GetVectorType(XMLRPC_VALUE value)
- * FUNCTION
- * determine vector type of the XMLRPC_VALUE
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_vector
- * RESULT
- * vector type of value as enumerated by XMLRPC_VECTOR_TYPE.
- * xmlrpc_none if not a value.
- * NOTES
- * xmlrpc_none is returned if value is not a vector
- * Deprecated for public use. See XMLRPC_GetValueTypeEasy
- * SEE ALSO
- * XMLRPC_SetIsVector ()
- * XMLRPC_GetValueType ()
- * XMLRPC_GetValueTypeEasy ()
- * SOURCE
- */
-XMLRPC_VECTOR_TYPE XMLRPC_GetVectorType(XMLRPC_VALUE value) {
- return(value && value->v) ? value->v->type : xmlrpc_none;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueTypeEasy
- * NAME
- * XMLRPC_GetValueTypeEasy
- * SYNOPSIS
- * XMLRPC_VALUE_TYPE_EASY XMLRPC_GetValueTypeEasy(XMLRPC_VALUE value)
- * FUNCTION
- * determine data type of the XMLRPC_VALUE. includes vector types.
- * INPUTS
- * XMLRPC_VALUE target of query
- * RESULT
- * data type of value as enumerated by XMLRPC_VALUE_TYPE_EASY
- * xmlrpc_type_none if not a value.
- * NOTES
- * all values are of type xmlrpc_type_empty until set.
- * SEE ALSO
- * XMLRPC_SetValue*
- * XMLRPC_CreateValue*
- * XMLRPC_Append*
- * SOURCE
- */
-XMLRPC_VALUE_TYPE_EASY XMLRPC_GetValueTypeEasy (XMLRPC_VALUE value) {
- if (value) {
- switch (value->type) {
- case xmlrpc_vector:
- switch (value->v->type) {
- case xmlrpc_vector_none:
- return xmlrpc_type_none;
- case xmlrpc_vector_struct:
- return xmlrpc_type_struct;
- case xmlrpc_vector_mixed:
- return xmlrpc_type_mixed;
- case xmlrpc_vector_array:
- return xmlrpc_type_array;
- }
- default:
- /* evil cast, but we know they are the same */
- return(XMLRPC_VALUE_TYPE_EASY) value->type;
- }
- }
- return xmlrpc_none;
-}
-
-/*******/
-
-
-
-/*-*******************
-* Begin Server Funcs *
-*********************/
-
-
-/****f* VALUE/XMLRPC_ServerCreate
- * NAME
- * XMLRPC_ServerCreate
- * SYNOPSIS
- * XMLRPC_SERVER XMLRPC_ServerCreate()
- * FUNCTION
- * Allocate/Init XMLRPC Server Resources.
- * INPUTS
- * none
- * RESULT
- * newly allocated XMLRPC_SERVER
- * NOTES
- * SEE ALSO
- * XMLRPC_ServerDestroy ()
- * XMLRPC_GetGlobalServer ()
- * SOURCE
- */
-XMLRPC_SERVER XMLRPC_ServerCreate() {
- XMLRPC_SERVER server = calloc(1, sizeof(STRUCT_XMLRPC_SERVER));
- if(server) {
- Q_Init(&server->methodlist);
- Q_Init(&server->docslist);
-
- /* register system methods */
- xsm_register(server);
- }
- return server;
-}
-
-/*******/
-
-/* Return global server. Not locking! Not Thread Safe! */
-/****f* VALUE/XMLRPC_GetGlobalServer
- * NAME
- * XMLRPC_GetGlobalServer
- * SYNOPSIS
- * XMLRPC_SERVER XMLRPC_GetGlobalServer()
- * FUNCTION
- * Allocates a global (process-wide) server, or returns pointer if pre-existing.
- * INPUTS
- * none
- * RESULT
- * pointer to global server, or 0 if error.
- * NOTES
- * ***WARNING*** This function is not thread safe. It is included only for the very lazy.
- * Multi-threaded programs that use this may experience problems.
- * BUGS
- * There is currently no way to cleanup the global server gracefully.
- * SEE ALSO
- * XMLRPC_ServerCreate ()
- * SOURCE
- */
-XMLRPC_SERVER XMLRPC_GetGlobalServer() {
- static XMLRPC_SERVER xsServer = 0;
- if(!xsServer) {
- xsServer = XMLRPC_ServerCreate();
- }
- return xsServer;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_ServerDestroy
- * NAME
- * XMLRPC_ServerDestroy
- * SYNOPSIS
- * void XMLRPC_ServerDestroy(XMLRPC_SERVER server)
- * FUNCTION
- * Free Server Resources
- * INPUTS
- * server The server to be free'd
- * RESULT
- * void
- * NOTES
- * This frees the server struct and any methods that have been added.
- * SEE ALSO
- * XMLRPC_ServerCreate ()
- * SOURCE
- */
-void XMLRPC_ServerDestroy(XMLRPC_SERVER server) {
- if(server) {
- doc_method* dm = Q_Head(&server->docslist);
- server_method* sm = Q_Head(&server->methodlist);
- while( dm ) {
- my_free(dm);
- dm = Q_Next(&server->docslist);
- }
- while( sm ) {
- if(sm->name) {
- my_free(sm->name);
- }
- if(sm->desc) {
- XMLRPC_CleanupValue(sm->desc);
- }
- my_free(sm);
- sm = Q_Next(&server->methodlist);
- }
- if(server->xIntrospection) {
- XMLRPC_CleanupValue(server->xIntrospection);
- }
-
- Q_Destroy(&server->methodlist);
- Q_Destroy(&server->docslist);
- my_free(server);
- }
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_ServerRegisterMethod
- * NAME
- * XMLRPC_ServerRegisterMethod
- * SYNOPSIS
- * void XMLRPC_ServerRegisterMethod(XMLRPC_SERVER server, const char *name, XMLRPC_Callback cb)
- * FUNCTION
- * Register new XMLRPC method with server
- * INPUTS
- * server The XMLRPC_SERVER to register the method with
- * name public name of the method
- * cb C function that implements the method
- * RESULT
- * int - 1 if success, else 0
- * NOTES
- * A C function must be registered for every "method" that the server recognizes. The
- * method name is equivalent to <methodCall><name> method name </name></methodCall> in the
- * XML syntax.
- * SEE ALSO
- * XMLRPC_ServerFindMethod ()
- * XMLRPC_ServerCallMethod ()
- * SOURCE
- */
-int XMLRPC_ServerRegisterMethod(XMLRPC_SERVER server, const char *name, XMLRPC_Callback cb) {
- if(server && name && cb) {
-
- server_method* sm = malloc(sizeof(server_method));
-
- if(sm) {
- sm->name = strdup(name);
- sm->method = cb;
- sm->desc = NULL;
-
- return Q_PushTail(&server->methodlist, sm);
- }
- }
- return 0;
-}
-
-/*******/
-
-server_method* find_method(XMLRPC_SERVER server, const char* name) {
- server_method* sm;
-
- q_iter qi = Q_Iter_Head_F(&server->methodlist);
-
- while( qi ) {
- sm = Q_Iter_Get_F(qi);
- if(sm && !strcmp(sm->name, name)) {
- return sm;
- }
- qi = Q_Iter_Next_F(qi);
- }
- return NULL;
-}
-
-
-const char* type_to_str(XMLRPC_VALUE_TYPE type, XMLRPC_VECTOR_TYPE vtype) {
- switch(type) {
- case xmlrpc_none:
- return "none";
- case xmlrpc_empty:
- return "empty";
- case xmlrpc_base64:
- return "base64";
- case xmlrpc_boolean:
- return "boolean";
- case xmlrpc_datetime:
- return "datetime";
- case xmlrpc_double:
- return "double";
- case xmlrpc_int:
- return "int";
- case xmlrpc_string:
- return "string";
- case xmlrpc_vector:
- switch(vtype) {
- case xmlrpc_vector_none:
- return "none";
- case xmlrpc_vector_array:
- return "array";
- case xmlrpc_vector_mixed:
- return "mixed vector (struct)";
- case xmlrpc_vector_struct:
- return "struct";
- }
- }
-}
-
-/****f* VALUE/XMLRPC_ServerFindMethod
- * NAME
- * XMLRPC_ServerFindMethod
- * SYNOPSIS
- * XMLRPC_Callback XMLRPC_ServerFindMethod(XMLRPC_SERVER server, const char* callName)
- * FUNCTION
- * retrieve C callback associated with a given method name.
- * INPUTS
- * server The XMLRPC_SERVER the method is registered with
- * callName the method to find
- * RESULT
- * previously registered XMLRPC_Callback, or NULL
- * NOTES
- * Typically, this is used to determine if a requested method exists, without actually calling it.
- * SEE ALSO
- * XMLRPC_ServerCallMethod ()
- * XMLRPC_ServerRegisterMethod ()
- * SOURCE
- */
-XMLRPC_Callback XMLRPC_ServerFindMethod(XMLRPC_SERVER server, const char* callName) {
- if(server && callName) {
- q_iter qi = Q_Iter_Head_F(&server->methodlist);
- while( qi ) {
- server_method* sm = Q_Iter_Get_F(qi);
- if(sm && !strcmp(sm->name, callName)) {
- return sm->method;
- }
- qi = Q_Iter_Next_F(qi);
- }
- }
- return NULL;
-}
-
-/*******/
-
-
-/* Call method specified in request */
-/****f* VALUE/XMLRPC_ServerCallMethod
- * NAME
- * XMLRPC_ServerCallMethod
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_ServerCallMethod(XMLRPC_SERVER server, XMLRPC_REQUEST request, void* userData)
- * FUNCTION
- *
- * INPUTS
- * server The XMLRPC_SERVER the method is registered with
- * request the request to handle
- * userData any additional data to pass to the C callback, or NULL
- * RESULT
- * XMLRPC_VALUE allocated by the callback, or NULL
- * NOTES
- * It is typically the caller's responsibility to free the returned value.
- *
- * Often the caller will want to serialize the result as XML, via
- * XMLRPC_VALUE_To_XML () or XMLRPC_REQUEST_To_XML ()
- * SEE ALSO
- * XMLRPC_ServerFindMethod ()
- * XMLRPC_ServerRegisterMethod ()
- * XMLRPC_CleanupValue ()
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_ServerCallMethod(XMLRPC_SERVER server, XMLRPC_REQUEST request, void* userData) {
- XMLRPC_VALUE xReturn = NULL;
-
- /* check for error set during request parsing / generation */
- if(request && request->error) {
- xReturn = XMLRPC_CopyValue(request->error);
- }
- else if (server && request) {
- XMLRPC_Callback cb =
- XMLRPC_ServerFindMethod (server, request->methodName.str);
- if(cb) {
- xReturn = cb(server, request, userData);
- }
- else {
- xReturn =
- XMLRPC_UtilityCreateFault (xmlrpc_error_unknown_method,
- request->methodName.str);
- }
- }
- return xReturn;
-}
-
-/*******/
-
-/*-*****************
-* End server funcs *
-*******************/
-
-
-/*-***********************************
-* Begin XMLRPC General Options funcs *
-*************************************/
-
-/* For options used by XMLRPC_VALUE funcs that otherwise do not have
- * parameters for options. Kind of gross. :(
- */
-typedef struct _xmlrpc_options {
- XMLRPC_CASE id_case;
- XMLRPC_CASE_COMPARISON id_case_compare;
-}
-STRUCT_XMLRPC_OPTIONS, *XMLRPC_OPTIONS;
-
-static XMLRPC_OPTIONS XMLRPC_GetDefaultOptions() {
- static STRUCT_XMLRPC_OPTIONS options = {
- xmlrpc_case_exact,
- xmlrpc_case_sensitive
- };
- return &options;
-}
-
-/****f* VALUE/XMLRPC_GetDefaultIdCase
- * NAME
- * XMLRPC_GetDefaultIdCase
- * SYNOPSIS
- * XMLRPC_CASE XMLRPC_GetDefaultIdCase()
- * FUNCTION
- * Gets default case options used by XMLRPC_VALUE funcs
- * INPUTS
- * none
- * RESULT
- * XMLRPC_CASE
- * BUGS
- * Nasty and gross. Should be server specific, but that requires changing all
- * the XMLRPC_VALUE api's.
- * SEE ALSO
- * XMLRPC_SetDefaultIdCase ()
- * SOURCE
- */
-XMLRPC_CASE XMLRPC_GetDefaultIdCase() {
- XMLRPC_OPTIONS options = XMLRPC_GetDefaultOptions();
- return options->id_case;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_SetDefaultIdCase
- * NAME
- * XMLRPC_SetDefaultIdCase
- * SYNOPSIS
- * XMLRPC_CASE XMLRPC_SetDefaultIdCase(XMLRPC_CASE id_case)
- * FUNCTION
- * Sets default case options used by XMLRPC_VALUE funcs
- * INPUTS
- * id_case case options as enumerated by XMLRPC_CASE
- * RESULT
- * XMLRPC_CASE -- newly set option
- * BUGS
- * Nasty and gross. Should be server specific, but that requires changing all
- * the XMLRPC_VALUE api's.
- * SEE ALSO
- * XMLRPC_GetDefaultIdCase ()
- * SOURCE
- */
-XMLRPC_CASE XMLRPC_SetDefaultIdCase(XMLRPC_CASE id_case) {
- XMLRPC_OPTIONS options = XMLRPC_GetDefaultOptions();
- options->id_case = id_case;
- return options->id_case;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetDefaultIdCaseComparison
- * NAME
- * XMLRPC_GetDefaultIdCaseComparison
- * SYNOPSIS
- * XMLRPC_CASE XMLRPC_GetDefaultIdCaseComparison( )
- * FUNCTION
- * Gets default case comparison options used by XMLRPC_VALUE funcs
- * INPUTS
- * none
- * RESULT
- * XMLRPC_CASE_COMPARISON default
- * BUGS
- * Nasty and gross. Should be server specific, but that requires changing all
- * the XMLRPC_VALUE api's.
- * SEE ALSO
- * XMLRPC_SetDefaultIdCaseComparison ()
- * SOURCE
- */
-XMLRPC_CASE_COMPARISON XMLRPC_GetDefaultIdCaseComparison() {
- XMLRPC_OPTIONS options = XMLRPC_GetDefaultOptions();
- return options->id_case_compare;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_SetDefaultIdCaseComparison
- * NAME
- * XMLRPC_SetDefaultIdCaseComparison
- * SYNOPSIS
- * XMLRPC_CASE XMLRPC_SetDefaultIdCaseComparison( XMLRPC_CASE_COMPARISON id_case_compare )
- * FUNCTION
- * Gets default case comparison options used by XMLRPC_VALUE funcs
- * INPUTS
- * id_case_compare case comparison rule to set as default
- * RESULT
- * XMLRPC_CASE_COMPARISON newly set default
- * BUGS
- * Nasty and gross. Should be server specific, but that requires changing all
- * the XMLRPC_VALUE api's.
- * SEE ALSO
- * XMLRPC_GetDefaultIdCaseComparison ()
- * SOURCE
- */
-XMLRPC_CASE_COMPARISON XMLRPC_SetDefaultIdCaseComparison(XMLRPC_CASE_COMPARISON id_case_compare) {
- XMLRPC_OPTIONS options = XMLRPC_GetDefaultOptions();
- options->id_case_compare = id_case_compare;
- return options->id_case_compare;
-}
-
-/*******/
-
-/*-*********************************
-* End XMLRPC General Options funcs *
-***********************************/
-
-
-/*-******************
-* Fault API funcs *
-********************/
-
-/****f* UTILITY/XMLRPC_UtilityCreateFault
- * NAME
- * XMLRPC_UtilityCreateFault
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_UtilityCreateFault( int fault_code, const char* fault_string )
- * FUNCTION
- * generates a struct containing a string member with id "faultString" and an int member
- * with id "faultCode". When using the xmlrpc xml serialization, these will be translated
- * to <fault><value><struct>... format.
- * INPUTS
- * fault_code application specific error code. can be 0.
- * fault_string application specific error string. cannot be null.
- * RESULT
- * XMLRPC_VALUE a newly created struct vector representing the error, or null on error.
- * NOTES
- * This is a utility function. xmlrpc "faults" are not directly represented in this xmlrpc
- * API or data structures. It is the author's view, that this API is intended for simple
- * data types, and a "fault" is a complex data type consisting of multiple simple data
- * types. This function is provided for convenience only, the same result could be
- * achieved directly by the application.
- *
- * This function now supports some "standardized" fault codes, as specified at.
- * http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php.
- * If one of these fault codes is received, the description string will automatically
- * be prefixed with a standard error string and 2 newlines.
- *
- * The actual transformation between this complex type and the xml "<fault>" element takes
- * place in the xmlrpc to xml serialization layer. This step is not performed when using the
- * simplerpc serialization, meaning that there will be no "<fault>" element in that
- * serialization. There will simply be a standard struct with 2 child elements.
- * imho, the "<fault>" element is unnecessary and/or out of place as part of the standard API.
- *
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_UtilityCreateFault(int fault_code, const char* fault_string) {
- XMLRPC_VALUE xOutput = NULL;
-
- char* string = NULL;
- simplestring description;
- simplestring_init(&description);
-
- switch (fault_code) {
- case xmlrpc_error_parse_xml_syntax:
- string = xmlrpc_error_parse_xml_syntax_str;
- break;
- case xmlrpc_error_parse_unknown_encoding:
- string = xmlrpc_error_parse_unknown_encoding_str;
- break;
- case xmlrpc_error_parse_bad_encoding:
- string = xmlrpc_error_parse_bad_encoding_str;
- break;
- case xmlrpc_error_invalid_xmlrpc:
- string = xmlrpc_error_invalid_xmlrpc_str;
- break;
- case xmlrpc_error_unknown_method:
- string = xmlrpc_error_unknown_method_str;
- break;
- case xmlrpc_error_invalid_params:
- string = xmlrpc_error_invalid_params_str;
- break;
- case xmlrpc_error_internal_server:
- string = xmlrpc_error_internal_server_str;
- break;
- case xmlrpc_error_application:
- string = xmlrpc_error_application_str;
- break;
- case xmlrpc_error_system:
- string = xmlrpc_error_system_str;
- break;
- case xmlrpc_error_transport:
- string = xmlrpc_error_transport_str;
- break;
- }
-
- simplestring_add(&description, string);
-
- if(string && fault_string) {
- simplestring_add(&description, "\n\n");
- }
- simplestring_add(&description, fault_string);
-
-
- if(description.len) {
- xOutput = XMLRPC_CreateVector(NULL, xmlrpc_vector_struct);
-
- XMLRPC_VectorAppendString (xOutput, "faultString", description.str,
- description.len);
- XMLRPC_VectorAppendInt(xOutput, "faultCode", fault_code);
- }
-
- simplestring_free(&description);
-
- return xOutput;
-}
-
-/*******/
-
-
-/****f* FAULT/XMLRPC_ValueIsFault
- * NAME
- * XMLRPC_ValueIsFault
- * SYNOPSIS
- * int XMLRPC_ValueIsFault (XMLRPC_VALUE value)
- * FUNCTION
- * Determines if a value encapsulates a fault "object"
- * INPUTS
- * value any XMLRPC_VALUE
- * RESULT
- * 1 if it is a fault, else 0
- * SEE ALSO
- * XMLRPC_ResponseIsFault ()
- * SOURCE
- */
-int XMLRPC_ValueIsFault (XMLRPC_VALUE value) {
- if( XMLRPC_VectorGetValueWithID(value, "faultCode") &&
- XMLRPC_VectorGetValueWithID(value, "faultString") ) {
- return 1;
- }
- return 0;
-}
-/*******/
-
-
-/****f* FAULT/XMLRPC_ResponseIsFault
- * NAME
- * XMLRPC_ResponseIsFault
- * SYNOPSIS
- * int XMLRPC_ResponseIsFault (XMLRPC_REQUEST response)
- * FUNCTION
- * Determines if a response contains an encapsulated fault "object"
- * INPUTS
- * value any XMLRPC_REQUEST. typically of type xmlrpc_request_response
- * RESULT
- * 1 if it contains a fault, else 0
- * SEE ALSO
- * XMLRPC_ValueIsFault ()
- * SOURCE
- */
-int XMLRPC_ResponseIsFault(XMLRPC_REQUEST response) {
- return XMLRPC_ValueIsFault( XMLRPC_RequestGetData(response) );
-}
-
-/*******/
-
-/****f* FAULT/XMLRPC_GetValueFaultCode
- * NAME
- * XMLRPC_GetValueFaultCode
- * SYNOPSIS
- * int XMLRPC_GetValueFaultCode (XMLRPC_VALUE value)
- * FUNCTION
- * returns fault code from a struct, if any
- * INPUTS
- * value XMLRPC_VALUE of type xmlrpc_vector_struct.
- * RESULT
- * fault code, else 0.
- * BUGS
- * impossible to distinguish faultCode == 0 from faultCode not present.
- * SEE ALSO
- * XMLRPC_GetResponseFaultCode ()
- * SOURCE
- */
-int XMLRPC_GetValueFaultCode (XMLRPC_VALUE value) {
- return XMLRPC_VectorGetIntWithID(value, "faultCode");
-}
-
-/*******/
-
-/****f* FAULT/XMLRPC_GetResponseFaultCode
- * NAME
- * XMLRPC_GetResponseFaultCode
- * SYNOPSIS
- * int XMLRPC_GetResponseFaultCode(XMLRPC_REQUEST response)
- * FUNCTION
- * returns fault code from a response, if any
- * INPUTS
- * response XMLRPC_REQUEST. typically of type xmlrpc_request_response.
- * RESULT
- * fault code, else 0.
- * BUGS
- * impossible to distinguish faultCode == 0 from faultCode not present.
- * SEE ALSO
- * XMLRPC_GetValueFaultCode ()
- * SOURCE
- */
-int XMLRPC_GetResponseFaultCode(XMLRPC_REQUEST response) {
- return XMLRPC_GetValueFaultCode( XMLRPC_RequestGetData(response) );
-}
-
-/*******/
-
-
-/****f* FAULT/XMLRPC_GetValueFaultString
- * NAME
- * XMLRPC_GetValueFaultString
- * SYNOPSIS
- * const char* XMLRPC_GetValueFaultString (XMLRPC_VALUE value)
- * FUNCTION
- * returns fault string from a struct, if any
- * INPUTS
- * value XMLRPC_VALUE of type xmlrpc_vector_struct.
- * RESULT
- * fault string, else 0.
- * SEE ALSO
- * XMLRPC_GetResponseFaultString ()
- * SOURCE
- */
-const char* XMLRPC_GetValueFaultString (XMLRPC_VALUE value) {
- return XMLRPC_VectorGetStringWithID(value, "faultString");
-}
-
-/*******/
-
-/****f* FAULT/XMLRPC_GetResponseFaultString
- * NAME
- * XMLRPC_GetResponseFaultString
- * SYNOPSIS
- * const char* XMLRPC_GetResponseFaultString (XMLRPC_REQUEST response)
- * FUNCTION
- * returns fault string from a response, if any
- * INPUTS
- * response XMLRPC_REQUEST. typically of type xmlrpc_request_response.
- * RESULT
- * fault string, else 0.
- * SEE ALSO
- * XMLRPC_GetValueFaultString ()
- * SOURCE
- */
-const char* XMLRPC_GetResponseFaultString (XMLRPC_REQUEST response) {
- return XMLRPC_GetValueFaultString( XMLRPC_RequestGetData(response) );
-}
-
-/*******/
-
-
-/*-******************
-* Utility API funcs *
-********************/
-
-
-/****f* UTILITY/XMLRPC_Free
- * NAME
- * XMLRPC_Free
- * SYNOPSIS
- * void XMLRPC_Free(void* mem)
- * FUNCTION
- * frees a block of memory allocated by xmlrpc.
- * INPUTS
- * mem memory to free
- * RESULT
- * void
- * NOTES
- * Useful for OS's where memory must be free'd
- * in the same library in which it is allocated.
- * SOURCE
- */
-void XMLRPC_Free(void* mem) {
- my_free(mem);
-}
-
-/*******/
-
-
-/****f* UTILITY/XMLRPC_GetVersionString
- * NAME
- * XMLRPC_GetVersionString
- * SYNOPSIS
- * const char* XMLRPC_GetVersionString()
- * FUNCTION
- * returns library version string
- * INPUTS
- *
- * RESULT
- * const char*
- * NOTES
- * SOURCE
- */
-const char* XMLRPC_GetVersionString() {
- return XMLRPC_VERSION_STR;
-}
-
-/*******/
-
-
-/*-**********************
-* End Utility API funcs *
-************************/
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc.h b/ext/rpc/xmlrpc/libxmlrpc/xmlrpc.h
deleted file mode 100644
index dde3d5e122..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc.h
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-#ifndef XMLRPC_ALREADY_INCLUDED
-#define XMLRPC_ALREADY_INCLUDED 1
-
-/* includes */
-#include "xml_element.h"
-#include <time.h> /* for time_t */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* allow version to be specified via compile line define */
-#ifndef XMLRPC_LIB_VERSION
- #define XMLRPC_LIB_VERSION "0.51"
-#endif
-
-/* this number, representing the date, must be increased each time the API changes */
-#define XMLRPC_API_NO 20020623
-
-/* this string should be changed with each packaged release */
-#define XMLRPC_VERSION_STR "xmlrpc-epi v. " XMLRPC_LIB_VERSION
-
-/* where to find more info. shouldn't need to change much */
-#define XMLRPC_HOME_PAGE_STR "http://xmlprc-epi.sourceforge.net/"
-
-
-/****d* VALUE/XMLRPC_VALUE_TYPE
- * NAME
- * XMLRPC_VALUE_TYPE
- * NOTES
- * Defines data types for XMLRPC_VALUE
- * Deprecated for public use. See XMLRPC_VALUE_TYPE_EASY
- * SEE ALSO
- * XMLRPC_VECTOR_TYPE
- * XMLRPC_REQUEST_TYPE
- * SOURCE
- */
-typedef enum _XMLRPC_VALUE_TYPE {
- xmlrpc_none, /* not a value */
- xmlrpc_empty, /* empty value, eg NULL */
- xmlrpc_base64, /* base64 value, eg binary data */
- xmlrpc_boolean, /* boolean [0 | 1] */
- xmlrpc_datetime, /* datetime [ISO8601 | time_t] */
- xmlrpc_double, /* double / floating point */
- xmlrpc_int, /* integer */
- xmlrpc_string, /* string */
- xmlrpc_vector /* vector, aka list, array */
-} XMLRPC_VALUE_TYPE;
-/*******/
-
-/****d* VALUE/XMLRPC_VECTOR_TYPE
- * NAME
- * XMLRPC_VECTOR_TYPE
- * NOTES
- * Defines data types for XMLRPC_VECTOR.
- * Deprecated for public use. See XMLRPC_VALUE_TYPE_EASY
- * SEE ALSO
- * XMLRPC_VALUE_TYPE
- * XMLRPC_REQUEST_TYPE
- * SOURCE
- */
-typedef enum _XMLRPC_VECTOR_TYPE {
- xmlrpc_vector_none, /* not an array */
- xmlrpc_vector_array, /* no values may have key names */
- xmlrpc_vector_mixed, /* some values may have key names */
- xmlrpc_vector_struct /* all values must have key names */
-} XMLRPC_VECTOR_TYPE;
-/*******/
-
-/****d* VALUE/XMLRPC_VALUE_TYPE_EASY
- * NAME
- * XMLRPC_VALUE_TYPE_EASY
- * NOTES
- * Defines data types for XMLRPC_VALUE, including vector types.
- * SEE ALSO
- * XMLRPC_VECTOR_TYPE
- * XMLRPC_REQUEST_TYPE
- * SOURCE
- */
-typedef enum _XMLRPC_VALUE_TYPE_EASY {
- xmlrpc_type_none, /* not a value */
- xmlrpc_type_empty, /* empty value, eg NULL */
- xmlrpc_type_base64, /* base64 value, eg binary data */
- xmlrpc_type_boolean, /* boolean [0 | 1] */
- xmlrpc_type_datetime, /* datetime [ISO8601 | time_t] */
- xmlrpc_type_double, /* double / floating point */
- xmlrpc_type_int, /* integer */
- xmlrpc_type_string, /* string */
-/* -- IMPORTANT: identical to XMLRPC_VALUE_TYPE to this point. -- */
- xmlrpc_type_array, /* vector array */
- xmlrpc_type_mixed, /* vector mixed */
- xmlrpc_type_struct /* vector struct */
-} XMLRPC_VALUE_TYPE_EASY;
-/*******/
-
-
-/****d* VALUE/XMLRPC_REQUEST_TYPE
- * NAME
- * XMLRPC_REQUEST_TYPE
- * NOTES
- * Defines data types for XMLRPC_REQUEST
- * SEE ALSO
- * XMLRPC_VALUE_TYPE
- * XMLRPC_VECTOR_TYPE
- * SOURCE
- */
-typedef enum _xmlrpc_request_type {
- xmlrpc_request_none, /* not a valid request */
- xmlrpc_request_call, /* calling/invoking a method */
- xmlrpc_request_response, /* responding to a method call */
-} XMLRPC_REQUEST_TYPE;
-/*******/
-
-/****d* VALUE/XMLRPC_ERROR_CODE
- * NAME
- * XMLRPC_ERROR_CODE
- * NOTES
- * All existing error codes
- * SEE ALSO
- * XMLRPC_REQUEST_ERROR
- * SOURCE
- */
-typedef enum _xmlrpc_error_code {
- xmlrpc_error_none = 0, /* not an error */
- xmlrpc_error_parse_xml_syntax = -32700,
- xmlrpc_error_parse_unknown_encoding = -32701,
- xmlrpc_error_parse_bad_encoding = -32702,
- xmlrpc_error_invalid_xmlrpc = -32600,
- xmlrpc_error_unknown_method = -32601,
- xmlrpc_error_invalid_params = -32602,
- xmlrpc_error_internal_server = -32603,
- xmlrpc_error_application = -32500,
- xmlrpc_error_system = -32400,
- xmlrpc_error_transport = -32300
-} XMLRPC_ERROR_CODE;
-/******/
-
-#define xmlrpc_error_parse_xml_syntax_str "parse error. not well formed."
-#define xmlrpc_error_parse_unknown_encoding_str "parse error. unknown encoding"
-#define xmlrpc_error_parse_bad_encoding_str "parse error. invalid character for encoding"
-#define xmlrpc_error_invalid_xmlrpc_str "server error. xml-rpc not conforming to spec"
-#define xmlrpc_error_unknown_method_str "server error. method not found."
-#define xmlrpc_error_invalid_params_str "server error. invalid method parameters"
-#define xmlrpc_error_internal_server_str "server error. internal xmlrpc library error"
-#define xmlrpc_error_application_str "application error."
-#define xmlrpc_error_system_str "system error."
-#define xmlrpc_error_transport_str "transport error."
-
-
-
-/****d* VALUE/XMLRPC_VERSION
- * NAME
- * XMLRPC_VERSION
- * NOTES
- * Defines xml vocabulary used for generated xml
- * SEE ALSO
- * XMLRPC_REQUEST_OUTPUT_OPTIONS
- * XMLRPC_REQUEST_To_XML ()
- * SOURCE
- */
-typedef enum _xmlrpc_version {
- xmlrpc_version_none = 0, /* not a recognized vocabulary */
- xmlrpc_version_1_0 = 1, /* xmlrpc 1.0 standard vocab */
- xmlrpc_version_simple = 2, /* alt more readable vocab */
- xmlrpc_version_danda = 2, /* same as simple. legacy */
- xmlrpc_version_soap_1_1 = 3 /* SOAP. version 1.1 */
-} XMLRPC_VERSION;
-/******/
-
-/****s* VALUE/XMLRPC_REQUEST_OUTPUT_OPTIONS
- * NAME
- * XMLRPC_REQUEST_OUTPUT_OPTIONS
- * NOTES
- * Defines output options for generated xml
- * SEE ALSO
- * XMLRPC_VERSION
- * XML_ELEM_OUTPUT_OPTIONS
- * XMLRPC_REQUEST_To_XML ()
- * SOURCE
- */
-typedef struct _xmlrpc_request_output_options {
- STRUCT_XML_ELEM_OUTPUT_OPTIONS xml_elem_opts; /* xml_element specific output options */
- XMLRPC_VERSION version; /* xml vocabulary to use */
-} STRUCT_XMLRPC_REQUEST_OUTPUT_OPTIONS, *XMLRPC_REQUEST_OUTPUT_OPTIONS;
-/******/
-
-/****s* VALUE/XMLRPC_REQUEST_INPUT_OPTIONS
- * NAME
- * XMLRPC_REQUEST_INPUT_OPTIONS
- * NOTES
- * Defines options for reading in xml data
- * SEE ALSO
- * XMLRPC_VERSION
- * XML_ELEM_INPUT_OPTIONS
- * XMLRPC_REQUEST_From_XML ()
- * SOURCE
- */
-typedef struct _xmlrpc_request_input_options {
- STRUCT_XML_ELEM_INPUT_OPTIONS xml_elem_opts; /* xml_element specific output options */
-} STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS, *XMLRPC_REQUEST_INPUT_OPTIONS;
-/******/
-
-/****s* VALUE/XMLRPC_ERROR
- * NAME
- * XMLRPC_ERROR
- * NOTES
- * For the reporting and handling of errors
- * SOURCE
- */
-typedef struct _xmlrpc_error {
- XMLRPC_ERROR_CODE code;
- STRUCT_XML_ELEM_ERROR xml_elem_error; /* xml_element errors (parser errors) */
-} STRUCT_XMLRPC_ERROR, *XMLRPC_ERROR;
-/******/
-
-
-/****d* VALUE/XMLRPC_CASE_COMPARISON
- * NAME
- * XMLRPC_CASE_COMPARISON
- * NOTES
- * Defines case comparison options for XMLRPC_VALUE/VECTOR API's
- * SEE ALSO
- * XMLRPC_CASE
- * XMLRPC_VALUE
- * SOURCE
- */
-typedef enum _xmlrpc_case_comparison {
- xmlrpc_case_insensitive, /* use case-insensitive compare */
- xmlrpc_case_sensitive /* use case-sensitive compare */
-} XMLRPC_CASE_COMPARISON;
-/******/
-
-/****d* VALUE/XMLRPC_CASE
- * NAME
- * XMLRPC_CASE
- * NOTES
- * Defines case behavior when setting IDs in XMLRPC_VALUE API's
- * SEE ALSO
- * XMLRPC_CASE_COMPARISON
- * XMLRPC_VALUE
- * SOURCE
- */
-typedef enum _xmlrpc_case {
- xmlrpc_case_exact, /* leave case alone */
- xmlrpc_case_lower, /* lower-case id */
- xmlrpc_case_upper /* upper-case id */
-} XMLRPC_CASE;
-/******/
-
-/* if you don't like these defaults, you can set them with XMLRPC_SetDefaultIdCase*() */
-#define XMLRPC_DEFAULT_ID_CASE XMLRPC_GetDefaultIdCase()
-#define XMLRPC_DEFAULT_ID_CASE_SENSITIVITY XMLRPC_GetDefaultIdCaseComparison()
-
-/* opaque (non-public) types. defined locally in xmlrpc.c */
-typedef struct _xmlrpc_request* XMLRPC_REQUEST;
-typedef struct _xmlrpc_server* XMLRPC_SERVER;
-typedef struct _xmlrpc_value* XMLRPC_VALUE;
-
-/****d* VALUE/XMLRPC_Callback
- * NAME
- * XMLRPC_Callback
- * NOTES
- * Function prototype for user defined method handlers (callbacks).
- * SEE ALSO
- * XMLRPC_ServerRegisterMethod ()
- * XMLRPC_ServerCallMethod ()
- * XMLRPC_REQUEST
- * XMLRPC_VALUE
- * SOURCE
- */
-typedef XMLRPC_VALUE (*XMLRPC_Callback)(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData);
-/******/
-
-/* ID Case Defaults */
-XMLRPC_CASE XMLRPC_GetDefaultIdCase(void);
-XMLRPC_CASE XMLRPC_SetDefaultIdCase(XMLRPC_CASE id_case);
-XMLRPC_CASE_COMPARISON XMLRPC_GetDefaultIdCaseComparison(void);
-XMLRPC_CASE_COMPARISON XMLRPC_SetDefaultIdCaseComparison(XMLRPC_CASE_COMPARISON id_case);
-
-/* Vector manipulation */
-int XMLRPC_VectorSize(XMLRPC_VALUE value);
-XMLRPC_VALUE XMLRPC_VectorRewind(XMLRPC_VALUE value);
-XMLRPC_VALUE XMLRPC_VectorNext(XMLRPC_VALUE value);
-int XMLRPC_SetIsVector(XMLRPC_VALUE value, XMLRPC_VECTOR_TYPE type);
-int XMLRPC_AddValueToVector(XMLRPC_VALUE target, XMLRPC_VALUE source);
-int XMLRPC_AddValuesToVector(XMLRPC_VALUE target, ...);
-int XMLRPC_VectorRemoveValue(XMLRPC_VALUE vector, XMLRPC_VALUE value);
-XMLRPC_VALUE XMLRPC_VectorGetValueWithID_Case(XMLRPC_VALUE vector, const char* id, XMLRPC_CASE_COMPARISON id_case);
-
-
-/* Create values */
-XMLRPC_VALUE XMLRPC_CreateValueBoolean(const char* id, int truth);
-XMLRPC_VALUE XMLRPC_CreateValueBase64(const char* id, const char* s, int len);
-XMLRPC_VALUE XMLRPC_CreateValueDateTime(const char* id, time_t time);
-XMLRPC_VALUE XMLRPC_CreateValueDateTime_ISO8601(const char* id, const char *s);
-XMLRPC_VALUE XMLRPC_CreateValueDouble(const char* id, double f);
-XMLRPC_VALUE XMLRPC_CreateValueInt(const char* id, int i);
-XMLRPC_VALUE XMLRPC_CreateValueString(const char* id, const char* s, int len);
-XMLRPC_VALUE XMLRPC_CreateValueEmpty(void);
-XMLRPC_VALUE XMLRPC_CreateVector(const char* id, XMLRPC_VECTOR_TYPE type);
-
-/* Cleanup values */
-void XMLRPC_CleanupValue(XMLRPC_VALUE value);
-
-/* Request error */
-XMLRPC_VALUE XMLRPC_RequestSetError (XMLRPC_REQUEST request, XMLRPC_VALUE error);
-XMLRPC_VALUE XMLRPC_RequestGetError (XMLRPC_REQUEST request);
-
-/* Copy values */
-XMLRPC_VALUE XMLRPC_CopyValue(XMLRPC_VALUE value);
-XMLRPC_VALUE XMLRPC_DupValueNew(XMLRPC_VALUE xSource);
-
-/* Set Values */
-void XMLRPC_SetValueDateTime(XMLRPC_VALUE value, time_t time);
-void XMLRPC_SetValueDateTime_ISO8601(XMLRPC_VALUE value, const char* s);
-void XMLRPC_SetValueDouble(XMLRPC_VALUE value, double val);
-void XMLRPC_SetValueInt(XMLRPC_VALUE value, int val);
-void XMLRPC_SetValueBoolean(XMLRPC_VALUE value, int val);
-const char *XMLRPC_SetValueString(XMLRPC_VALUE value, const char* s, int len);
-void XMLRPC_SetValueBase64(XMLRPC_VALUE value, const char* s, int len);
-const char *XMLRPC_SetValueID_Case(XMLRPC_VALUE value, const char* id, int len, XMLRPC_CASE id_case);
-#define XMLRPC_SetValueID(value, id, len) XMLRPC_SetValueID_Case(value, id, len, XMLRPC_DEFAULT_ID_CASE)
-
-/* Get Values */
-const char* XMLRPC_GetValueString(XMLRPC_VALUE value);
-int XMLRPC_GetValueStringLen(XMLRPC_VALUE value);
-int XMLRPC_GetValueInt(XMLRPC_VALUE value);
-int XMLRPC_GetValueBoolean(XMLRPC_VALUE value);
-double XMLRPC_GetValueDouble(XMLRPC_VALUE value);
-const char* XMLRPC_GetValueBase64(XMLRPC_VALUE value);
-time_t XMLRPC_GetValueDateTime(XMLRPC_VALUE value);
-const char* XMLRPC_GetValueDateTime_ISO8601(XMLRPC_VALUE value);
-const char* XMLRPC_GetValueID(XMLRPC_VALUE value);
-
-/* Type introspection */
-XMLRPC_VALUE_TYPE XMLRPC_GetValueType(XMLRPC_VALUE v);
-XMLRPC_VALUE_TYPE_EASY XMLRPC_GetValueTypeEasy(XMLRPC_VALUE v);
-XMLRPC_VECTOR_TYPE XMLRPC_GetVectorType(XMLRPC_VALUE v);
-
-/* Parsing and Creating XML */
-XMLRPC_REQUEST XMLRPC_REQUEST_FromXML(const char* in_buf, int len, XMLRPC_REQUEST_INPUT_OPTIONS in_options);
-XMLRPC_VALUE XMLRPC_VALUE_FromXML(const char* in_buf, int len, XMLRPC_REQUEST_INPUT_OPTIONS in_options);
-char* XMLRPC_REQUEST_ToXML(XMLRPC_REQUEST request, int *buf_len);
-char* XMLRPC_VALUE_ToXML(XMLRPC_VALUE val, int* buf_len);
-
-/* Request manipulation funcs */
-const char* XMLRPC_RequestSetMethodName(XMLRPC_REQUEST request, const char* methodName);
-const char* XMLRPC_RequestGetMethodName(XMLRPC_REQUEST request);
-XMLRPC_REQUEST XMLRPC_RequestNew(void);
-void XMLRPC_RequestFree(XMLRPC_REQUEST request, int bFreeIO);
-XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestSetOutputOptions(XMLRPC_REQUEST request, XMLRPC_REQUEST_OUTPUT_OPTIONS output);
-XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestGetOutputOptions(XMLRPC_REQUEST request);
-XMLRPC_VALUE XMLRPC_RequestSetData(XMLRPC_REQUEST request, XMLRPC_VALUE data);
-XMLRPC_VALUE XMLRPC_RequestGetData(XMLRPC_REQUEST request);
-XMLRPC_REQUEST_TYPE XMLRPC_RequestSetRequestType(XMLRPC_REQUEST request, XMLRPC_REQUEST_TYPE type);
-XMLRPC_REQUEST_TYPE XMLRPC_RequestGetRequestType(XMLRPC_REQUEST request);
-
-/* Server Creation/Destruction; Method Registration and Invocation */
-XMLRPC_SERVER XMLRPC_ServerCreate(void);
-XMLRPC_SERVER XMLRPC_GetGlobalServer(void); /* better to use XMLRPC_ServerCreate if you can */
-void XMLRPC_ServerDestroy(XMLRPC_SERVER server);
-int XMLRPC_ServerRegisterMethod(XMLRPC_SERVER server, const char *name, XMLRPC_Callback cb);
-XMLRPC_Callback XMLRPC_ServerFindMethod(XMLRPC_SERVER server, const char* callName);
-XMLRPC_VALUE XMLRPC_ServerCallMethod(XMLRPC_SERVER server, XMLRPC_REQUEST request, void* userData);
-
-#include "xmlrpc_introspection.h"
-
-/* Fault interrogation funcs */
-int XMLRPC_ValueIsFault (XMLRPC_VALUE value);
-int XMLRPC_ResponseIsFault(XMLRPC_REQUEST response);
-int XMLRPC_GetValueFaultCode (XMLRPC_VALUE value);
-int XMLRPC_GetResponseFaultCode(XMLRPC_REQUEST response);
-const char* XMLRPC_GetValueFaultString (XMLRPC_VALUE value);
-const char* XMLRPC_GetResponseFaultString (XMLRPC_REQUEST response);
-
-
-/* Public Utility funcs */
-XMLRPC_VALUE XMLRPC_UtilityCreateFault(int fault_code, const char* fault_string);
-void XMLRPC_Free(void* mem);
-const char* XMLRPC_GetVersionString(void);
-
-/****d* VALUE/XMLRPC_MACROS
- * NAME
- * Some Helpful Macros
- * NOTES
- * Some macros for making life easier. Should be self-explanatory.
- * SEE ALSO
- * XMLRPC_AddValueToVector ()
- * XMLRPC_VectorGetValueWithID_Case ()
- * XMLRPC_VALUE
- * SOURCE
- */
-
-/* Append values to vector */
-#define XMLRPC_VectorAppendString(vector, id, s, len) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueString(id, s, len))
-#define XMLRPC_VectorAppendBase64(vector, id, s, len) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueBase64(id, s, len))
-#define XMLRPC_VectorAppendDateTime(vector, id, time) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueDateTime(id, time))
-#define XMLRPC_VectorAppendDateTime_ISO8601(vector, id, s) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueDateTime_ISO8601(id, s))
-#define XMLRPC_VectorAppendDouble(vector, id, f) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueDouble(id, f))
-#define XMLRPC_VectorAppendInt(vector, id, i) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueInt(id, i))
-#define XMLRPC_VectorAppendBoolean(vector, id, i) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueBoolean(id, i))
-
-/* Get named values from vector */
-#define XMLRPC_VectorGetValueWithID(vector, id) XMLRPC_VectorGetValueWithID_Case(vector, id, XMLRPC_DEFAULT_ID_CASE_SENSITIVITY)
-#define XMLRPC_VectorGetStringWithID(vector, id) XMLRPC_GetValueString(XMLRPC_VectorGetValueWithID(vector, id))
-#define XMLRPC_VectorGetBase64WithID(vector, id) XMLRPC_GetValueBase64(XMLRPC_VectorGetValueWithID(vector, id))
-#define XMLRPC_VectorGetDateTimeWithID(vector, id) XMLRPC_GetValueDateTime(XMLRPC_VectorGetValueWithID(vector, id))
-#define XMLRPC_VectorGetDoubleWithID(vector, id) XMLRPC_GetValueDouble(XMLRPC_VectorGetValueWithID(vector, id))
-#define XMLRPC_VectorGetIntWithID(vector, id) XMLRPC_GetValueInt(XMLRPC_VectorGetValueWithID(vector, id))
-#define XMLRPC_VectorGetBooleanWithID(vector, id) XMLRPC_GetValueBoolean(XMLRPC_VectorGetValueWithID(vector, id))
-
-/******/
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* not XMLRPC_ALREADY_INCLUDED */
-
-
-
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc.m4 b/ext/rpc/xmlrpc/libxmlrpc/xmlrpc.m4
deleted file mode 100644
index e89c245f02..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc.m4
+++ /dev/null
@@ -1,12 +0,0 @@
-AC_DEFUN(XMLRPC_CHECKS,[
-
-AC_REQUIRE([AC_PROG_CC])
-AC_REQUIRE([AC_PROG_LN_S])
-AC_REQUIRE([AC_PROG_RANLIB])
-
-AC_DEFINE(UNDEF_THREADS_HACK,,[ ])
-
-XMLRPC_HEADER_CHECKS
-XMLRPC_TYPE_CHECKS
-XMLRPC_FUNCTION_CHECKS
-])
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.c b/ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.c
deleted file mode 100644
index bc1853ea73..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.c
+++ /dev/null
@@ -1,598 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2001 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-/****h* ABOUT/xmlrpc_introspection
- * AUTHOR
- * Dan Libby, aka danda (dan@libby.com)
- * HISTORY
- * $Log$
- * Revision 1.9 2001/09/29 21:58:05 danda
- * adding cvs log to history section
- *
- * 4/10/2001 -- danda -- initial introspection support
- * TODO
- * NOTES
- *******/
-
-
-#ifdef _WIN32
-#include "xmlrpc_win32.h"
-#endif
-#include "queue.h"
-#include "xmlrpc.h"
-#include "xmlrpc_private.h"
-#include "xmlrpc_introspection_private.h"
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-
-/* forward declarations for static (non public, non api) funcs */
-static XMLRPC_VALUE xi_system_describe_methods_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData);
-static XMLRPC_VALUE xi_system_list_methods_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData);
-static XMLRPC_VALUE xi_system_method_signature_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData);
-static XMLRPC_VALUE xi_system_method_help_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData);
-
-
-/*-**********************************
-* Introspection Callbacks (methods) *
-************************************/
-
-/* iterates through a list of structs and finds the one with key "name" matching
- * needle. slow, would benefit from a struct key hash.
- */
-inline XMLRPC_VALUE find_named_value(XMLRPC_VALUE list, const char* needle) {
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(list);
- while(xIter) {
- const char* name = XMLRPC_VectorGetStringWithID(xIter, xi_token_name);
- if(name && !strcmp(name, needle)) {
- return xIter;
- }
- xIter = XMLRPC_VectorNext(list);
- }
- return NULL;
-}
-
-
-/* iterates through docs callbacks and calls any that have not yet been called */
-static void check_docs_loaded(XMLRPC_SERVER server, void* userData) {
- if(server) {
- q_iter qi = Q_Iter_Head_F(&server->docslist);
- while( qi ) {
- doc_method* dm = Q_Iter_Get_F(qi);
- if(dm && !dm->b_called) {
- dm->method(server, userData);
- dm->b_called = 1;
- }
- qi = Q_Iter_Next_F(qi);
- }
- }
-}
-
-
-/* utility function for xi_system_describe_methods_cb */
-inline void describe_method(XMLRPC_SERVER server, XMLRPC_VALUE vector, const char* method) {
- if(method) {
- server_method* sm = find_method(server, method);
- if(sm) {
- XMLRPC_AddValueToVector(vector, sm->desc);
- }
- }
-}
-
-
-
-/* system.describeMethods() callback */
-static XMLRPC_VALUE xi_system_describe_methods_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData) {
- XMLRPC_VALUE xParams = XMLRPC_VectorRewind(XMLRPC_RequestGetData(input));
- XMLRPC_VALUE xResponse = XMLRPC_CreateVector(NULL, xmlrpc_vector_struct);
- XMLRPC_VALUE xMethodList = XMLRPC_CreateVector("methodList", xmlrpc_vector_array);
- XMLRPC_VALUE xTypeList = NULL;
- int bAll = 1;
-
- /* lazy loading of introspection data */
- check_docs_loaded(server, userData);
-
- xTypeList = XMLRPC_VectorGetValueWithID(server->xIntrospection, "typeList");
-
- XMLRPC_AddValueToVector(xResponse, xTypeList);
- XMLRPC_AddValueToVector(xResponse, xMethodList);
-
- /* check if we have any param */
- if(xParams) {
- /* check if string or vector (1 or n) */
- XMLRPC_VALUE_TYPE type = XMLRPC_GetValueType(xParams);
- if(type == xmlrpc_string) {
- /* just one. spit it out. */
- describe_method(server, xMethodList, XMLRPC_GetValueString(xParams));
- bAll = 0;
- }
- else if(type == xmlrpc_vector) {
- /* multiple. spit all out */
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(xParams);
- while(xIter) {
- describe_method(server, xMethodList, XMLRPC_GetValueString(xIter));
- xIter = XMLRPC_VectorNext(xParams);
- }
- bAll = 0;
- }
- }
-
- /* otherwise, default to sending all methods */
- if(bAll) {
- q_iter qi = Q_Iter_Head_F(&server->methodlist);
- while( qi ) {
- server_method* sm = Q_Iter_Get_F(qi);
- if(sm) {
- XMLRPC_AddValueToVector(xMethodList, sm->desc);
- }
- qi = Q_Iter_Next_F(qi);
- }
- }
-
- return xResponse;
-}
-
-/* this complies with system.listMethods as defined at http://xmlrpc.usefulinc.com/doc/reserved.html */
-static XMLRPC_VALUE xi_system_list_methods_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData) {
- XMLRPC_VALUE xResponse = XMLRPC_CreateVector(NULL, xmlrpc_vector_array);
-
- q_iter qi = Q_Iter_Head_F(&server->methodlist);
- while( qi ) {
- server_method* sm = Q_Iter_Get_F(qi);
- if(sm) {
- XMLRPC_VectorAppendString(xResponse, 0, sm->name, 0);
- }
- qi = Q_Iter_Next_F(qi);
- }
- return xResponse;
-}
-
-/* this complies with system.methodSignature as defined at
- * http://xmlrpc.usefulinc.com/doc/sysmethodsig.html
- */
-static XMLRPC_VALUE xi_system_method_signature_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData) {
- const char* method = XMLRPC_GetValueString(XMLRPC_VectorRewind(XMLRPC_RequestGetData(input)));
- XMLRPC_VALUE xResponse = NULL;
-
- /* lazy loading of introspection data */
- check_docs_loaded(server, userData);
-
- if(method) {
- server_method* sm = find_method(server, method);
- if(sm && sm->desc) {
- XMLRPC_VALUE xTypesArray = XMLRPC_CreateVector(NULL, xmlrpc_vector_array);
- XMLRPC_VALUE xIter, xParams, xSig, xSigIter;
- const char* type;
-
- /* array of possible signatures. */
- xResponse = XMLRPC_CreateVector(NULL, xmlrpc_vector_array);
-
- /* find first signature */
- xSig = XMLRPC_VectorGetValueWithID(sm->desc, xi_token_signatures);
- xSigIter = XMLRPC_VectorRewind( xSig );
-
- /* iterate through sigs */
- while(xSigIter) {
- /* first type is the return value */
- type = XMLRPC_VectorGetStringWithID(XMLRPC_VectorRewind(
- XMLRPC_VectorGetValueWithID(xSigIter, xi_token_returns)),
- xi_token_type);
- XMLRPC_AddValueToVector(xTypesArray,
- XMLRPC_CreateValueString(NULL,
- type ? type : type_to_str(xmlrpc_none, 0),
- 0));
-
- /* the rest are parameters */
- xParams = XMLRPC_VectorGetValueWithID(xSigIter, xi_token_params);
- xIter = XMLRPC_VectorRewind(xParams);
-
- /* iter through params, adding to types array */
- while(xIter) {
- XMLRPC_AddValueToVector(xTypesArray,
- XMLRPC_CreateValueString(NULL,
- XMLRPC_VectorGetStringWithID(xIter, xi_token_type),
- 0));
- xIter = XMLRPC_VectorNext(xParams);
- }
-
- /* add types for this signature */
- XMLRPC_AddValueToVector(xResponse, xTypesArray);
-
- xSigIter = XMLRPC_VectorNext( xSig );
- }
- }
- }
-
- return xResponse;
-}
-
-/* this complies with system.methodHelp as defined at
- * http://xmlrpc.usefulinc.com/doc/sysmethhelp.html
- */
-static XMLRPC_VALUE xi_system_method_help_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData) {
- const char* method = XMLRPC_GetValueString(XMLRPC_VectorRewind(XMLRPC_RequestGetData(input)));
- XMLRPC_VALUE xResponse = NULL;
-
- /* lazy loading of introspection data */
- check_docs_loaded(server, userData);
-
- if(method) {
- server_method* sm = find_method(server, method);
- if(sm && sm->desc) {
- const char* help = XMLRPC_VectorGetStringWithID(sm->desc, xi_token_purpose);
-
- /* returns a documentation string, or empty string */
- xResponse = XMLRPC_CreateValueString(NULL, help ? help : xi_token_empty, 0);
- }
- }
-
- return xResponse;
-}
-
-/*-**************************************
-* End Introspection Callbacks (methods) *
-****************************************/
-
-
-/*-************************
-* Introspection Utilities *
-**************************/
-
-/* performs registration of introspection methods */
-void xi_register_system_methods(XMLRPC_SERVER server) {
- XMLRPC_ServerRegisterMethod(server, xi_token_system_list_methods, xi_system_list_methods_cb);
- XMLRPC_ServerRegisterMethod(server, xi_token_system_method_help, xi_system_method_help_cb);
- XMLRPC_ServerRegisterMethod(server, xi_token_system_method_signature, xi_system_method_signature_cb);
- XMLRPC_ServerRegisterMethod(server, xi_token_system_describe_methods, xi_system_describe_methods_cb);
-}
-
-/* describe a value (param, return, type) */
-static XMLRPC_VALUE describeValue_worker(const char* type, const char* id, const char* desc, int optional, const char* default_val, XMLRPC_VALUE sub_params) {
- XMLRPC_VALUE xParam = NULL;
- if(id || desc) {
- xParam = XMLRPC_CreateVector(NULL, xmlrpc_vector_struct);
- XMLRPC_VectorAppendString(xParam, xi_token_name, id, 0);
- XMLRPC_VectorAppendString(xParam, xi_token_type, type, 0);
- XMLRPC_VectorAppendString(xParam, xi_token_description, desc, 0);
- if(optional != 2) {
- XMLRPC_VectorAppendInt(xParam, xi_token_optional, optional);
- }
- if(optional == 1 && default_val) {
- XMLRPC_VectorAppendString(xParam, xi_token_default, default_val, 0);
- }
- XMLRPC_AddValueToVector(xParam, sub_params);
- }
- return xParam;
-}
-
-
-/* convert an xml tree conforming to spec <url tbd> to XMLRPC_VALUE
- * suitable for use with XMLRPC_ServerAddIntrospectionData
- */
-XMLRPC_VALUE xml_element_to_method_description(xml_element* el, XMLRPC_ERROR err) {
- XMLRPC_VALUE xReturn = NULL;
-
- if(el->name) {
- const char* name = NULL;
- const char* type = NULL;
- const char* basetype = NULL;
- const char* desc = NULL;
- const char* def = NULL;
- int optional = 0;
- xml_element_attr* attr_iter = Q_Head(&el->attrs);
-
- /* grab element attributes up front to save redundant while loops */
- while(attr_iter) {
- if(!strcmp(attr_iter->key, "name")) {
- name = attr_iter->val;
- }
- else if(!strcmp(attr_iter->key, "type")) {
- type = attr_iter->val;
- }
- else if(!strcmp(attr_iter->key, "basetype")) {
- basetype = attr_iter->val;
- }
- else if(!strcmp(attr_iter->key, "desc")) {
- desc = attr_iter->val;
- }
- else if(!strcmp(attr_iter->key, "optional")) {
- if(attr_iter->val && !strcmp(attr_iter->val, "yes")) {
- optional = 1;
- }
- }
- else if(!strcmp(attr_iter->key, "default")) {
- def = attr_iter->val;
- }
- attr_iter = Q_Next(&el->attrs);
- }
-
- /* value and typeDescription behave about the same */
- if(!strcmp(el->name, "value") || !strcmp(el->name, "typeDescription")) {
- XMLRPC_VALUE xSubList = NULL;
- const char* ptype = !strcmp(el->name, "value") ? type : basetype;
- if(ptype) {
- if(Q_Size(&el->children) &&
- !strcmp(ptype, "array") || !strcmp(ptype, "struct") || !strcmp(ptype, "mixed")) {
- xSubList = XMLRPC_CreateVector("member", xmlrpc_vector_array);
-
- if(xSubList) {
- xml_element* elem_iter = Q_Head(&el->children);
- while(elem_iter) {
- XMLRPC_AddValueToVector(xSubList,
- xml_element_to_method_description(elem_iter, err));
- elem_iter = Q_Next(&el->children);
- }
- }
- }
- xReturn = describeValue_worker(ptype, name, (desc ? desc : (xSubList ? NULL : el->text.str)), optional, def, xSubList);
- }
- }
-
- /* these three kids are about equivalent */
- else if(!strcmp(el->name, "params") ||
- !strcmp(el->name, "returns") ||
- !strcmp(el->name, "signature")) {
- if(Q_Size(&el->children)) {
- xml_element* elem_iter = Q_Head(&el->children);
- xReturn = XMLRPC_CreateVector(!strcmp(el->name, "signature") ? NULL : el->name, xmlrpc_vector_struct);
-
-
- while(elem_iter) {
- XMLRPC_AddValueToVector(xReturn,
- xml_element_to_method_description(elem_iter, err));
- elem_iter = Q_Next(&el->children);
- }
- }
- }
-
-
- else if(!strcmp(el->name, "methodDescription")) {
- xml_element* elem_iter = Q_Head(&el->children);
- xReturn = XMLRPC_CreateVector(NULL, xmlrpc_vector_struct);
-
- XMLRPC_VectorAppendString(xReturn, xi_token_name, name, 0);
-
- while(elem_iter) {
- XMLRPC_AddValueToVector(xReturn,
- xml_element_to_method_description(elem_iter, err));
- elem_iter = Q_Next(&el->children);
- }
- }
-
- /* items are slightly special */
- else if(!strcmp(el->name, "item")) {
- xReturn = XMLRPC_CreateValueString(name, el->text.str, el->text.len);
- }
-
- /* sure. we'll let any ol element with children through */
- else if(Q_Size(&el->children)) {
- xml_element* elem_iter = Q_Head(&el->children);
- xReturn = XMLRPC_CreateVector(el->name, xmlrpc_vector_mixed);
-
- while(elem_iter) {
- XMLRPC_AddValueToVector(xReturn,
- xml_element_to_method_description(elem_iter, err));
- elem_iter = Q_Next(&el->children);
- }
- }
-
- /* or anything at all really, so long as its got some text.
- * no reason being all snotty about a spec, right?
- */
- else if(el->name && el->text.len) {
- xReturn = XMLRPC_CreateValueString(el->name, el->text.str, el->text.len);
- }
- }
-
- return xReturn;
-}
-
-/*-****************************
-* End Introspection Utilities *
-******************************/
-
-
-
-/*-******************
-* Introspection API *
-********************/
-
-
-/****f* VALUE/XMLRPC_IntrospectionCreateDescription
- * NAME
- * XMLRPC_IntrospectionCreateDescription
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_IntrospectionCreateDescription(const char* xml, XMLRPC_ERROR err)
- * FUNCTION
- * converts raw xml describing types and methods into an
- * XMLRPC_VALUE suitable for use with XMLRPC_ServerAddIntrospectionData()
- * INPUTS
- * xml - xml data conforming to introspection spec at <url tbd>
- * err - optional pointer to error struct. filled in if error occurs and not NULL.
- * RESULT
- * XMLRPC_VALUE - newly created value, or NULL if fatal error.
- * BUGS
- * Currently does little or no validation of xml.
- * Only parse errors are currently reported in err, not structural errors.
- * SEE ALSO
- * XMLRPC_ServerAddIntrospectionData ()
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_IntrospectionCreateDescription(const char* xml, XMLRPC_ERROR err) {
- XMLRPC_VALUE xReturn = NULL;
- xml_element* root = xml_elem_parse_buf(xml, 0, 0, err ? &err->xml_elem_error : NULL);
-
- if(root) {
- xReturn = xml_element_to_method_description(root, err);
-
- xml_elem_free(root);
- }
-
- return xReturn;
-
-}
-/*******/
-
-
-/****f* SERVER/XMLRPC_ServerAddIntrospectionData
- * NAME
- * XMLRPC_ServerAddIntrospectionData
- * SYNOPSIS
- * int XMLRPC_ServerAddIntrospectionData(XMLRPC_SERVER server, XMLRPC_VALUE desc)
- * FUNCTION
- * updates server with additional introspection data
- * INPUTS
- * server - target server
- * desc - introspection data, should be a struct generated by
- * XMLRPC_IntrospectionCreateDescription ()
- * RESULT
- * int - 1 if success, else 0
- * NOTES
- * - function will fail if neither typeList nor methodList key is present in struct.
- * - if method or type already exists, it will be replaced.
- * - desc is never freed by the server. caller is responsible for cleanup.
- * BUGS
- * - horribly slow lookups. prime candidate for hash improvements.
- * - uglier and more complex than I like to see for API functions.
- * SEE ALSO
- * XMLRPC_ServerAddIntrospectionData ()
- * XMLRPC_ServerRegisterIntrospectionCallback ()
- * XMLRPC_CleanupValue ()
- * SOURCE
- */
-int XMLRPC_ServerAddIntrospectionData(XMLRPC_SERVER server, XMLRPC_VALUE desc) {
- int bSuccess = 0;
- if(server && desc) {
- XMLRPC_VALUE xNewTypes = XMLRPC_VectorGetValueWithID(desc, "typeList");
- XMLRPC_VALUE xNewMethods = XMLRPC_VectorGetValueWithID(desc, "methodList");
- XMLRPC_VALUE xServerTypes = XMLRPC_VectorGetValueWithID(server->xIntrospection, "typeList");
-
- if(xNewMethods) {
- XMLRPC_VALUE xMethod = XMLRPC_VectorRewind(xNewMethods);
-
- while(xMethod) {
- const char* name = XMLRPC_VectorGetStringWithID(xMethod, xi_token_name);
- server_method* sm = find_method(server, name);
-
- if(sm) {
- if(sm->desc) {
- XMLRPC_CleanupValue(sm->desc);
- }
- sm->desc = XMLRPC_CopyValue(xMethod);
- bSuccess = 1;
- }
-
- xMethod = XMLRPC_VectorNext(xNewMethods);
- }
- }
- if(xNewTypes) {
- if(!xServerTypes) {
- if(!server->xIntrospection) {
- server->xIntrospection = XMLRPC_CreateVector(NULL, xmlrpc_vector_struct);
- }
-
- XMLRPC_AddValueToVector(server->xIntrospection, xNewTypes);
- bSuccess = 1;
- }
- else {
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(xNewTypes);
- while(xIter) {
- /* get rid of old values */
- XMLRPC_VALUE xPrev = find_named_value(xServerTypes, XMLRPC_VectorGetStringWithID(xIter, xi_token_name));
- if(xPrev) {
- XMLRPC_VectorRemoveValue(xServerTypes, xPrev);
- }
- XMLRPC_AddValueToVector(xServerTypes, xIter);
- bSuccess = 1;
- xIter = XMLRPC_VectorNext(xNewTypes);
- }
- }
- }
- }
- return bSuccess;
-}
-/*******/
-
-
-/****f* SERVER/XMLRPC_ServerRegisterIntrospectionCallback
- * NAME
- * XMLRPC_ServerRegisterIntrospectionCallback
- * SYNOPSIS
- * int XMLRPC_ServerRegisterIntrospectionCallback(XMLRPC_SERVER server, XMLRPC_IntrospectionCallback cb)
- * FUNCTION
- * registers a callback for lazy generation of introspection data
- * INPUTS
- * server - target server
- * cb - callback that will generate introspection data
- * RESULT
- * int - 1 if success, else 0
- * NOTES
- * parsing xml and generating introspection data is fairly expensive, thus a
- * server may wish to wait until this data is actually requested before generating
- * it. Any number of callbacks may be registered at any time. A given callback
- * will only ever be called once, the first time an introspection request is
- * processed after the time of callback registration.
- * SEE ALSO
- * XMLRPC_ServerAddIntrospectionData ()
- * XMLRPC_IntrospectionCreateDescription ()
- * SOURCE
- */
-int XMLRPC_ServerRegisterIntrospectionCallback(XMLRPC_SERVER server, XMLRPC_IntrospectionCallback cb) {
- int bSuccess = 0;
- if(server && cb) {
-
- doc_method* dm = calloc(1, sizeof(doc_method));
-
- if(dm) {
- dm->method = cb;
- dm->b_called = 0;
-
- if(Q_PushTail(&server->docslist, dm)) {
- bSuccess = 1;
- }
- else {
- my_free(dm);
- }
- }
- }
- return 0;
-}
-/*******/
-
-/*-**********************
-* End Introspection API *
-************************/
-
-
-
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.h b/ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.h
deleted file mode 100644
index 656e441b96..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-/* IMPORTANT!
- *
- * only public (official API) things should be in this file. Anything else
- * should go in <group>_private.h, or in the appropriate .c file.
- */
-
-
-#ifndef __XI_INTROSPECTION_H
-/*
- * Avoid include redundancy.
- */
-#define __XI_INTROSPECTION_H
-
-/*----------------------------------------------------------------------------
- * xmlrpc_introspection.h
- *
- * Purpose:
- * define public introspection API
- * Comments:
- */
-
-/*----------------------------------------------------------------------------
- * Constants
- */
- #define xi_token_params "params"
- #define xi_token_returns "returns"
- #define xi_token_related "related"
- #define xi_token_sub "sub"
-
-
-/*----------------------------------------------------------------------------
- * Includes
- */
-
-/*----------------------------------------------------------------------------
- * Structures
- */
-
- /****d* VALUE/XMLRPC_IntrospectionCallback
- * NAME
- * XMLRPC_IntrospectionCallback
- * NOTES
- * Function prototype for lazy documentation generation (not generated until requested).
- * SOURCE
- */
-typedef void (*XMLRPC_IntrospectionCallback)(XMLRPC_SERVER server, void* userData);
-/******/
-
-
-/*----------------------------------------------------------------------------
- * Globals
- */
-
-/*----------------------------------------------------------------------------
- * Functions
- */
-XMLRPC_VALUE XMLRPC_IntrospectionCreateDescription(const char* xml, XMLRPC_ERROR error);
-int XMLRPC_ServerAddIntrospectionData(XMLRPC_SERVER server, XMLRPC_VALUE desc);
-int XMLRPC_ServerRegisterIntrospectionCallback(XMLRPC_SERVER server, XMLRPC_IntrospectionCallback cb);
-
-/*----------------------------------------------------------------------------
- * Macros
- */
-
-
-#endif /* __XI_INTROSPECTION_H */
-
-
-
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h b/ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h
deleted file mode 100644
index 7b97fa7ed7..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2001 Dan Libby, Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-/* IMPORTANT!
- *
- * only non-public things should be in this file. It is fine for any .c file
- * in xmlrpc/src to include it, but users of the public API should never
- * include it, and thus *.h files that are part of the public API should
- * never include it, or they would break if this file is not present.
- */
-
-
-#ifndef __XI_INTROSPECTION_PRIVATE_H
-/*
- * Avoid include redundancy.
- */
-#define __XI_INTROSPECTION_PRIVATE_H
-
-/*----------------------------------------------------------------------------
- * xmlrpc_introspection_private.h
- *
- * Purpose:
- * define non-public introspection routines
- * Comments:
- */
-
-/*----------------------------------------------------------------------------
- * Constants
- */
-#define xi_token_default "default"
-#define xi_token_description "description"
-#define xi_token_name "name"
-#define xi_token_optional "optional"
-#define xi_token_params "params"
-#define xi_token_purpose "purpose"
-#define xi_token_returns "returns"
-#define xi_token_signatures "signatures"
-#define xi_token_type "type"
-#define xi_token_version "version"
-#define xi_token_empty ""
-#define xi_token_system_describe_methods "system.describeMethods"
-#define xi_token_system_list_methods "system.listMethods"
-#define xi_token_system_method_help "system.methodHelp"
-#define xi_token_system_method_signature "system.methodSignature"
-
-
-/*----------------------------------------------------------------------------
- * Includes
- */
-
-/*----------------------------------------------------------------------------
- * Structures
- */
-typedef struct _doc_method {
- XMLRPC_IntrospectionCallback method;
- int b_called;
-} doc_method;
-
-/*----------------------------------------------------------------------------
- * Globals
- */
-
-/*----------------------------------------------------------------------------
- * Functions
- */
-void xi_register_system_methods(XMLRPC_SERVER server);
-
-/*----------------------------------------------------------------------------
- * Macros
- */
-
-
-#endif /* __XI_INTROSPECTION_PRIVATE_H */
-
-
-
-
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc_private.h b/ext/rpc/xmlrpc/libxmlrpc/xmlrpc_private.h
deleted file mode 100644
index 65c6b136a6..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc_private.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-/* only non-public things should be in this file. It is fine for any .c file
- * in xmlrpc/src to include it, but users of the public API should never
- * include it, and thus *.h files that are part of the public API should
- * never include it, or they would break if this file is not present.
- */
-
-#ifndef XMLRPC_PRIVATE_ALREADY_INCLUDED
-/*
- * Avoid include redundancy.
- */
-#define XMLRPC_PRIVATE_ALREADY_INCLUDED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*----------------------------------------------------------------------------
- * xmlrpc_private.h
- *
- * Purpose:
- * define non-public intra-library routines & data
- * Comments:
- */
-
-/*----------------------------------------------------------------------------
- * Constants
- */
-
-
-/*----------------------------------------------------------------------------
- * Includes
- */
-
-/*----------------------------------------------------------------------------
- * Structures
- */
-
-/* Some of these are typedef'd in xmlrpc.h for public use */
-
-typedef struct _xmlrpc_vector* XMLRPC_VECTOR;
-
-/****s* VALUE/XMLRPC_VALUE
- * NAME
- * XMLRPC_VALUE
- * NOTES
- * A value of variable data type. The most important object in this API. :)
- *
- * This struct is opaque to callers and should be accessed only via accessor functions.
- * SEE ALSO
- * XMLRPC_REQUEST
- * XMLRPC_CreateValueEmpty ()
- * XMLRPC_CleanupValue ()
- * SOURCE
- */
-typedef struct _xmlrpc_value {
- XMLRPC_VALUE_TYPE type; /* data type of this value */
- XMLRPC_VECTOR v; /* vector type specific info */
- simplestring str; /* string value buffer */
- simplestring id; /* id of this value. possibly empty. */
- int i; /* integer value. */
- double d; /* double value */
- int iRefCount; /* So we know when we can delete the value . */
-} STRUCT_XMLRPC_VALUE;
-/******/
-
-/****s* VALUE/XMLRPC_REQUEST
- * NAME
- * XMLRPC_REQUEST
- * NOTES
- * Internal representation of an XML request.
- *
- * This struct is opaque to callers and should be accessed only via accessor functions.
- *
- * SEE ALSO
- * XMLRPC_VALUE
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestFree ()
- * SOURCE
- */
-typedef struct _xmlrpc_request {
- XMLRPC_VALUE io; /* data associated with this request */
- simplestring methodName; /* name of method being called */
- XMLRPC_REQUEST_TYPE request_type; /* type of request */
- STRUCT_XMLRPC_REQUEST_OUTPUT_OPTIONS output; /* xml output options */
- XMLRPC_VALUE error; /* error codes */
-} STRUCT_XMLRPC_REQUEST;
-/******/
-
-/* Vector type. Used by XMLRPC_VALUE. Never visible to users of the API. */
-typedef struct _xmlrpc_vector {
- XMLRPC_VECTOR_TYPE type; /* vector type */
- queue *q; /* list of child values */
-} STRUCT_XMLRPC_VECTOR;
-/******/
-
-/****s* VALUE/XMLRPC_SERVER
- * NAME
- * XMLRPC_SERVER
- * NOTES
- * internal representation of an xmlrpc server
- *
- * This struct is opaque to callers and should be accessed only via accessor functions.
- *
- * SEE ALSO
- * XMLRPC_ServerCreate ()
- * XMLRPC_ServerDestroy ()
- * SOURCE
- */
-typedef struct _xmlrpc_server {
- queue methodlist; /* list of callback methods */
- queue docslist; /* list of introspection callbacks */
- XMLRPC_VALUE xIntrospection;
-} STRUCT_XMLRPC_SERVER;
-/******/
-
-typedef struct _server_method {
- char* name;
- XMLRPC_VALUE desc;
- XMLRPC_Callback method;
-} server_method;
-
-
-/*----------------------------------------------------------------------------
- * Globals
- */
-
-/*----------------------------------------------------------------------------
- * Functions
- */
-server_method* find_method(XMLRPC_SERVER server, const char* name);
-const char* type_to_str(XMLRPC_VALUE_TYPE type, XMLRPC_VECTOR_TYPE vtype);
-
-/*----------------------------------------------------------------------------
- * Macros
- */
-#define my_free(thing) if(thing) {free(thing); thing = 0;}
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* XMLRPC_PRIVATE_ALREADY_INCLUDED */
-
diff --git a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc_win32.h b/ext/rpc/xmlrpc/libxmlrpc/xmlrpc_win32.h
deleted file mode 100644
index 58c54bbb80..0000000000
--- a/ext/rpc/xmlrpc/libxmlrpc/xmlrpc_win32.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _XMLRPC_WIN32_H
-#define _XMLRPC_WIN32_H
-/* just some things needed to compile win32 */
-#include <windows.h>
-#include <stdlib.h>
-#define inline __inline
-#define snprintf _snprintf
-#define strcasecmp(s1, s2) stricmp(s1, s2)
-
-
-#endif \ No newline at end of file
diff --git a/ext/rpc/xmlrpc/php_xmlrpc.h b/ext/rpc/xmlrpc/php_xmlrpc.h
deleted file mode 100644
index c69a7e7581..0000000000
--- a/ext/rpc/xmlrpc/php_xmlrpc.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- This file is part of, or distributed with, libXMLRPC - a C library for
- xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2001 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-/* auto-generated portions of this file are also subject to the php license */
-
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Dan Libby |
- +----------------------------------------------------------------------+
- */
-
-#ifndef _PHP_XMLRPC_H
-#define _PHP_XMLRPC_H
-
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined.
-*/
-#if 1 /* HAVE_XMLRPC */
-
-extern zend_module_entry xmlrpc_module_entry;
-#define phpext_xmlrpc_ptr &xmlrpc_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_XMLRPC_API __declspec(dllexport)
-#else
-#define PHP_XMLRPC_API
-#endif
-
-PHP_MINIT_FUNCTION(xmlrpc);
-PHP_MSHUTDOWN_FUNCTION(xmlrpc);
-PHP_RINIT_FUNCTION(xmlrpc);
-PHP_RSHUTDOWN_FUNCTION(xmlrpc);
-PHP_MINFO_FUNCTION(xmlrpc);
-
-PHP_FUNCTION(xmlrpc_encode);
-PHP_FUNCTION(xmlrpc_decode);
-PHP_FUNCTION(xmlrpc_decode_request);
-PHP_FUNCTION(xmlrpc_encode_request);
-PHP_FUNCTION(xmlrpc_get_type);
-PHP_FUNCTION(xmlrpc_set_type);
-PHP_FUNCTION(xmlrpc_is_fault);
-PHP_FUNCTION(xmlrpc_server_create);
-PHP_FUNCTION(xmlrpc_server_destroy);
-PHP_FUNCTION(xmlrpc_server_register_method);
-PHP_FUNCTION(xmlrpc_server_call_method);
-PHP_FUNCTION(xmlrpc_parse_method_descriptions);
-PHP_FUNCTION(xmlrpc_server_add_introspection_data);
-PHP_FUNCTION(xmlrpc_server_register_introspection_callback);
-
-/* Fill in this structure and use entries in it
- for thread safety instead of using true globals.
-*/
-typedef struct {
- int x; /* fix error in msvc, cannot have empty structs */
-} zend_xmlrpc_globals;
-
-/* In every function that needs to use variables in zend_xmlrpc_globals,
- do call XMLRPCLS_FETCH(); after declaring other variables used by
- that function, and always refer to them as XMLRPCG(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#else
-
-#define phpext_xmlrpc_ptr NULL
-
-#endif
-
-#endif /* _PHP_XMLRPC_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/rpc/xmlrpc/xmlrpc-epi-php.c b/ext/rpc/xmlrpc/xmlrpc-epi-php.c
deleted file mode 100644
index 611f7cf7d6..0000000000
--- a/ext/rpc/xmlrpc/xmlrpc-epi-php.c
+++ /dev/null
@@ -1,1475 +0,0 @@
-/*
- This file is part of, or distributed with, libXMLRPC - a C library for
- xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2001 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-/* auto-generated portions of this file are also subject to the php license */
-
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Dan Libby |
- +----------------------------------------------------------------------+
- */
-
-/**********************************************************************
-* BUGS: *
-* - when calling a php user function, there appears to be no way to *
-* distinguish between a return value of null, and no return value *
-* at all. The xml serialization layer(s) will then return a value *
-* of null, when the right thing may be no value at all. (SOAP) *
-**********************************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/info.h"
-#include "php_ini.h"
-#include "php_xmlrpc.h"
-#include "xmlrpc.h"
-
-#define PHP_EXT_VERSION "0.51"
-
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined. */
-
-ZEND_DECLARE_MODULE_GLOBALS(xmlrpc)
-
-static int le_xmlrpc_server;
-
-static unsigned char second_args_force_ref[] = { 3, BYREF_NONE, BYREF_FORCE, BYREF_NONE };
-static unsigned char first_args_force_ref[] = { 2, BYREF_FORCE, BYREF_NONE };
-
-function_entry xmlrpc_functions[] = {
- PHP_FE(xmlrpc_encode, NULL)
- PHP_FE(xmlrpc_decode, NULL)
- PHP_FE(xmlrpc_decode_request, second_args_force_ref)
- PHP_FE(xmlrpc_encode_request, NULL)
- PHP_FE(xmlrpc_get_type, NULL)
- PHP_FE(xmlrpc_set_type, first_args_force_ref)
- PHP_FE(xmlrpc_is_fault, NULL)
- PHP_FE(xmlrpc_server_create, NULL)
- PHP_FE(xmlrpc_server_destroy, NULL)
- PHP_FE(xmlrpc_server_register_method, NULL)
- PHP_FE(xmlrpc_server_call_method, NULL)
- PHP_FE(xmlrpc_parse_method_descriptions, NULL)
- PHP_FE(xmlrpc_server_add_introspection_data, NULL)
- PHP_FE(xmlrpc_server_register_introspection_callback, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry xmlrpc_module_entry = {
- STANDARD_MODULE_HEADER,
- "xmlrpc",
- xmlrpc_functions,
- PHP_MINIT(xmlrpc),
- PHP_MSHUTDOWN(xmlrpc),
- PHP_RINIT(xmlrpc), /* Replace with NULL if there's nothing to do at request start */
- PHP_RSHUTDOWN(xmlrpc), /* Replace with NULL if there's nothing to do at request end */
- PHP_MINFO(xmlrpc),
- PHP_EXT_VERSION,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_XMLRPC
-ZEND_GET_MODULE(xmlrpc)
-#endif
-
-/*******************************
-* local structures and defines *
-*******************************/
-
-/* per server data */
-typedef struct _xmlrpc_server_data {
- zval* method_map;
- zval* introspection_map;
- XMLRPC_SERVER server_ptr;
-} xmlrpc_server_data;
-
-
-/* how to format output */
-typedef struct _php_output_options {
- int b_php_out;
- int b_auto_version;
- STRUCT_XMLRPC_REQUEST_OUTPUT_OPTIONS xmlrpc_out;
-} php_output_options;
-
-/* data passed to C callback */
-typedef struct _xmlrpc_callback_data {
- zval* xmlrpc_method;
- zval* php_function;
- zval* caller_params;
- zval* return_data;
- xmlrpc_server_data* server;
- char php_executed;
-} xmlrpc_callback_data;
-
-/* output options */
-#define OUTPUT_TYPE_KEY "output_type"
-#define OUTPUT_TYPE_KEY_LEN (sizeof(OUTPUT_TYPE_KEY) - 1)
-#define OUTPUT_TYPE_VALUE_PHP "php"
-#define OUTPUT_TYPE_VALUE_XML "xml"
-
-#define VERBOSITY_KEY "verbosity"
-#define VERBOSITY_KEY_LEN (sizeof(VERBOSITY_KEY) - 1)
-#define VERBOSITY_VALUE_NO_WHITE_SPACE "no_white_space"
-#define VERBOSITY_VALUE_NEWLINES_ONLY "newlines_only"
-#define VERBOSITY_VALUE_PRETTY "pretty"
-
-#define ESCAPING_KEY "escaping"
-#define ESCAPING_KEY_LEN (sizeof(ESCAPING_KEY) - 1)
-#define ESCAPING_VALUE_CDATA "cdata"
-#define ESCAPING_VALUE_NON_ASCII "non-ascii"
-#define ESCAPING_VALUE_NON_PRINT "non-print"
-#define ESCAPING_VALUE_MARKUP "markup"
-
-#define VERSION_KEY "version"
-#define VERSION_KEY_LEN (sizeof(VERSION_KEY) - 1)
-#define VERSION_VALUE_SIMPLE "simple"
-#define VERSION_VALUE_XMLRPC "xmlrpc"
-#define VERSION_VALUE_SOAP11 "soap 1.1"
-#define VERSION_VALUE_AUTO "auto"
-
-#define ENCODING_KEY "encoding"
-#define ENCODING_KEY_LEN (sizeof(ENCODING_KEY) - 1)
-#define ENCODING_DEFAULT "iso-8859-1"
-
-/* value types */
-#define OBJECT_TYPE_ATTR "xmlrpc_type"
-#define OBJECT_VALUE_ATTR "scalar"
-#define OBJECT_VALUE_TS_ATTR "timestamp"
-
-/* faults */
-#define FAULT_CODE "faultCode"
-#define FAULT_CODE_LEN (sizeof(FAULT_CODE) - 1)
-#define FAULT_STRING "faultString"
-#define FAULT_STRING_LEN (sizeof(FAULT_STRING) - 1)
-
-/***********************
-* forward declarations *
-***********************/
-XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval** newvalue);
-static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data);
-int sset_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE type);
-zval* decode_request_worker(zval* xml_in, zval* encoding_in, zval* method_name_out);
-const char* xmlrpc_type_as_str(XMLRPC_VALUE_TYPE type, XMLRPC_VECTOR_TYPE vtype);
-XMLRPC_VALUE_TYPE xmlrpc_str_as_type(const char* str);
-XMLRPC_VECTOR_TYPE xmlrpc_str_as_vector_type(const char* str);
-int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE type);
-
-/*********************
-* startup / shutdown *
-*********************/
-
-static void destroy_server_data(xmlrpc_server_data *server)
-{
- if (server) {
- XMLRPC_ServerDestroy(server->server_ptr);
-
- zval_dtor(server->method_map);
- FREE_ZVAL(server->method_map);
-
- zval_dtor(server->introspection_map);
- FREE_ZVAL(server->introspection_map);
-
- efree(server);
- }
-}
-
-/* called when server is being destructed. either when xmlrpc_server_destroy
- * is called, or when request ends. */
-static void xmlrpc_server_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- if (rsrc && rsrc->ptr) {
- destroy_server_data((xmlrpc_server_data*) rsrc->ptr);
- }
-}
-
-/* module init */
-PHP_MINIT_FUNCTION(xmlrpc)
-{
- le_xmlrpc_server = zend_register_list_destructors_ex(xmlrpc_server_destructor, NULL, "xmlrpc server", module_number);
-
- return SUCCESS;
-}
-
-/* module shutdown */
-PHP_MSHUTDOWN_FUNCTION(xmlrpc)
-{
- return SUCCESS;
-}
-
-/* Remove if there's nothing to do at request start */
-PHP_RINIT_FUNCTION(xmlrpc)
-{
- return SUCCESS;
-}
-
-/* Remove if there's nothing to do at request end */
-PHP_RSHUTDOWN_FUNCTION(xmlrpc)
-{
- return SUCCESS;
-}
-
-/* display info in phpinfo() */
-PHP_MINFO_FUNCTION(xmlrpc)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "core library version", XMLRPC_GetVersionString());
- php_info_print_table_row(2, "php extension version", PHP_EXT_VERSION);
- php_info_print_table_row(2, "author", "Dan Libby");
- php_info_print_table_row(2, "homepage", "http://xmlrpc-epi.sourceforge.net");
- php_info_print_table_row(2, "open sourced by", "Epinions.com");
- php_info_print_table_end();
-}
-
-/*******************
-* random utilities *
-*******************/
-
-/* Utility functions for adding data types to arrays, with or without key (assoc, non-assoc).
- * Could easily be further generalized to work with objects.
- */
-#if 0
-static int add_long(zval* list, char* id, int num) {
- if(id) return add_assoc_long(list, id, num);
- else return add_next_index_long(list, num);
-}
-
-static int add_double(zval* list, char* id, double num) {
- if(id) return add_assoc_double(list, id, num);
- else return add_next_index_double(list, num);
-}
-
-static int add_string(zval* list, char* id, char* string, int duplicate) {
- if(id) return add_assoc_string(list, id, string, duplicate);
- else return add_next_index_string(list, string, duplicate);
-}
-
-static int add_stringl(zval* list, char* id, char* string, uint length, int duplicate) {
- if(id) return add_assoc_stringl(list, id, string, length, duplicate);
- else return add_next_index_stringl(list, string, length, duplicate);
-}
-
-#endif
-
-static int add_zval(zval* list, const char* id, zval** val)
-{
- if (list && val) {
- if (id) {
- return zend_hash_update(Z_ARRVAL_P(list), (char*) id, strlen(id) + 1, (void *) val, sizeof(zval **), NULL);
- } else {
- return zend_hash_next_index_insert(Z_ARRVAL_P(list), (void *) val, sizeof(zval **), NULL);
- }
- }
- /* what is the correct return on error? */
- return 0;
-}
-
-#define my_zend_hash_get_current_key(ht, my_key, num_index) zend_hash_get_current_key(ht, my_key, num_index, 0)
-
-
-/*************************
-* input / output options *
-*************************/
-
-/* parse an array (user input) into output options suitable for use by xmlrpc engine
- * and determine whether to return data as xml or php vars */
-static void set_output_options(php_output_options* options, zval* output_opts)
-{
- if (options) {
-
- /* defaults */
- options->b_php_out = 0;
- options->b_auto_version = 1;
- options->xmlrpc_out.version = xmlrpc_version_1_0;
- options->xmlrpc_out.xml_elem_opts.encoding = ENCODING_DEFAULT;
- options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_pretty;
- options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_markup_escaping | xml_elem_non_ascii_escaping | xml_elem_non_print_escaping;
-
- if (output_opts && Z_TYPE_P(output_opts) == IS_ARRAY) {
- zval** val;
-
- /* type of output (xml/php) */
- if (zend_hash_find(Z_ARRVAL_P(output_opts), OUTPUT_TYPE_KEY, OUTPUT_TYPE_KEY_LEN + 1, (void**) &val) == SUCCESS) {
- if (Z_TYPE_PP(val) == IS_STRING) {
- if (!strcmp(Z_STRVAL_PP(val), OUTPUT_TYPE_VALUE_PHP)) {
- options->b_php_out = 1;
- } else if (!strcmp(Z_STRVAL_PP(val), OUTPUT_TYPE_VALUE_XML)) {
- options->b_php_out = 0;
- }
- }
- }
-
- /* verbosity of generated xml */
- if (zend_hash_find(Z_ARRVAL_P(output_opts), VERBOSITY_KEY, VERBOSITY_KEY_LEN + 1, (void**) &val) == SUCCESS) {
- if (Z_TYPE_PP(val) == IS_STRING) {
- if (!strcmp(Z_STRVAL_PP(val), VERBOSITY_VALUE_NO_WHITE_SPACE)) {
- options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_no_white_space;
- } else if (!strcmp(Z_STRVAL_PP(val), VERBOSITY_VALUE_NEWLINES_ONLY)) {
- options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_newlines_only;
- } else if (!strcmp(Z_STRVAL_PP(val), VERBOSITY_VALUE_PRETTY)) {
- options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_pretty;
- }
- }
- }
-
- /* version of xml to output */
- if (zend_hash_find(Z_ARRVAL_P(output_opts), VERSION_KEY, VERSION_KEY_LEN + 1, (void**) &val) == SUCCESS) {
- if (Z_TYPE_PP(val) == IS_STRING) {
- options->b_auto_version = 0;
- if (!strcmp(Z_STRVAL_PP(val), VERSION_VALUE_XMLRPC)) {
- options->xmlrpc_out.version = xmlrpc_version_1_0;
- } else if (!strcmp(Z_STRVAL_PP(val), VERSION_VALUE_SIMPLE)) {
- options->xmlrpc_out.version = xmlrpc_version_simple;
- } else if (!strcmp((*val)->value.str.val, VERSION_VALUE_SOAP11)) {
- options->xmlrpc_out.version = xmlrpc_version_soap_1_1;
- } else { /* if(!strcmp((*val)->value.str.val, VERSION_VALUE_AUTO)) { */
- options->b_auto_version = 1;
- }
- }
- }
-
- /* encoding code set */
- if(zend_hash_find(Z_ARRVAL_P(output_opts),
- ENCODING_KEY, ENCODING_KEY_LEN + 1,
- (void**)&val) == SUCCESS) {
- if(Z_TYPE_PP(val) == IS_STRING) {
- options->xmlrpc_out.xml_elem_opts.encoding = estrdup(Z_STRVAL_PP(val));
- }
- }
-
- /* escaping options */
- if(zend_hash_find(Z_ARRVAL_P(output_opts),
- ESCAPING_KEY, ESCAPING_KEY_LEN + 1,
- (void**)&val) == SUCCESS) {
- /* multiple values allowed. check if array */
- if(Z_TYPE_PP(val) == IS_ARRAY) {
- zval** iter_val;
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(val));
- options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_no_escaping;
- while(1) {
- if(zend_hash_get_current_data(Z_ARRVAL_PP(val), (void**)&iter_val) == SUCCESS) {
- if(Z_TYPE_PP(iter_val) == IS_STRING && Z_STRVAL_PP(iter_val)) {
- if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_CDATA)) {
- options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_cdata_escaping;
- }
- else if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_NON_ASCII)) {
- options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_non_ascii_escaping;
- }
- else if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_NON_PRINT)) {
- options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_non_print_escaping;
- }
- else if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_MARKUP)) {
- options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_markup_escaping;
- }
- }
- }
- else {
- break;
- }
-
- zend_hash_move_forward(Z_ARRVAL_PP(val));
- }
- }
- /* else, check for single value */
- else if(Z_TYPE_PP(val) == IS_STRING) {
- if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_CDATA)) {
- options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_cdata_escaping;
- }
- else if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_NON_ASCII)) {
- options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_non_ascii_escaping;
- }
- else if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_NON_PRINT)) {
- options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_non_print_escaping;
- }
- else if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_MARKUP)) {
- options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_markup_escaping;
- }
- }
- }
- }
- }
-}
-
-
-/******************
-* encode / decode *
-******************/
-
-/* php arrays have no distinction between array and struct types.
- * they even allow mixed. Thus, we determine the type by iterating
- * through the entire array and figuring out each element.
- * room for some optimation here if we stop after a specific # of elements.
- */
-static XMLRPC_VECTOR_TYPE determine_vector_type (HashTable *ht)
-{
- int bArray = 0, bStruct = 0, bMixed = 0;
- unsigned long num_index;
- char* my_key;
-
- zend_hash_internal_pointer_reset(ht);
- while(1) {
- int res = my_zend_hash_get_current_key(ht, &my_key, &num_index);
- if(res == HASH_KEY_IS_LONG) {
- if(bStruct) {
- bMixed = 1;
- break;
- }
- bArray = 1;
- }
- else if(res == HASH_KEY_NON_EXISTANT) {
- break;
- }
- else if(res == HASH_KEY_IS_STRING) {
- if(bArray) {
- bMixed = 1;
- break;
- }
- bStruct = 1;
- }
-
- zend_hash_move_forward(ht);
- }
- return bMixed ? xmlrpc_vector_mixed : (bStruct ? xmlrpc_vector_struct : xmlrpc_vector_array);
-}
-
-/* recursively convert php values into xmlrpc values */
-static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int depth)
-{
- XMLRPC_VALUE xReturn = NULL;
- if(in_val) {
- zval* val = NULL;
- XMLRPC_VALUE_TYPE type = get_zval_xmlrpc_type(in_val, &val);
- if(val) {
- switch(type) {
- case xmlrpc_base64:
- if(Z_TYPE_P(val) == IS_NULL) {
- xReturn = XMLRPC_CreateValueEmpty();
- XMLRPC_SetValueID(xReturn, key, 0);
- }
- else {
- xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL_P(val), Z_STRLEN_P(val));
- }
- break;
- case xmlrpc_datetime:
- convert_to_string(val);
- xReturn = XMLRPC_CreateValueDateTime_ISO8601(key, Z_STRVAL_P(val));
- break;
- case xmlrpc_boolean:
- convert_to_boolean(val);
- xReturn = XMLRPC_CreateValueBoolean(key, Z_LVAL_P(val));
- break;
- case xmlrpc_int:
- convert_to_long(val);
- xReturn = XMLRPC_CreateValueInt(key, Z_LVAL_P(val));
- break;
- case xmlrpc_double:
- convert_to_double(val);
- xReturn = XMLRPC_CreateValueDouble(key, Z_DVAL_P(val));
- break;
- case xmlrpc_string:
- convert_to_string(val);
- xReturn = XMLRPC_CreateValueString(key, Z_STRVAL_P(val), Z_STRLEN_P(val));
- break;
- case xmlrpc_vector:
- {
- unsigned long num_index;
- zval** pIter;
- char* my_key;
-
- convert_to_array(val);
-
- xReturn = XMLRPC_CreateVector(key, determine_vector_type(Z_ARRVAL_P(val)));
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(val));
- while(1) {
- int res = my_zend_hash_get_current_key(Z_ARRVAL_P(val), &my_key, &num_index);
- if(res == HASH_KEY_IS_LONG) {
- if(zend_hash_get_current_data(Z_ARRVAL_P(val), (void**)&pIter) == SUCCESS) {
- XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(0, *pIter, depth++));
- }
- }
- else if(res == HASH_KEY_NON_EXISTANT) {
- break;
- }
- else if(res == HASH_KEY_IS_STRING) {
- if(zend_hash_get_current_data(Z_ARRVAL_P(val), (void**)&pIter) == SUCCESS) {
- XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(my_key, *pIter, depth++));
- }
- }
-
- zend_hash_move_forward(Z_ARRVAL_P(val));
- }
- }
- break;
- default:
- break;
- }
- }
- }
- return xReturn;
-}
-
-static XMLRPC_VALUE PHP_to_XMLRPC(zval* root_val)
-{
- return PHP_to_XMLRPC_worker(NULL, root_val, 0);
-}
-
-/* recursively convert xmlrpc values into php values */
-static zval* XMLRPC_to_PHP(XMLRPC_VALUE el)
-{
- zval* elem = NULL;
- const char* pStr;
-
- if(el) {
- XMLRPC_VALUE_TYPE type = XMLRPC_GetValueType(el);
-
- MAKE_STD_ZVAL(elem); /* init. very important. spent a frustrating day finding this out. */
-
- switch(type) {
- case xmlrpc_empty:
- Z_TYPE_P(elem) = IS_NULL;
- break;
- case xmlrpc_string:
- pStr = XMLRPC_GetValueString(el);
- if(pStr) {
- Z_STRLEN_P(elem) = XMLRPC_GetValueStringLen(el);
- Z_STRVAL_P(elem) = estrndup(pStr, Z_STRLEN_P(elem));
- Z_TYPE_P(elem) = IS_STRING;
- }
- break;
- case xmlrpc_int:
- Z_LVAL_P(elem) = XMLRPC_GetValueInt(el);
- Z_TYPE_P(elem) = IS_LONG;
- break;
- case xmlrpc_boolean:
- Z_LVAL_P(elem) = XMLRPC_GetValueBoolean(el);
- Z_TYPE_P(elem) = IS_BOOL;
- break;
- case xmlrpc_double:
- Z_DVAL_P(elem) = XMLRPC_GetValueDouble(el);
- Z_TYPE_P(elem) = IS_DOUBLE;
- break;
- case xmlrpc_datetime:
- Z_STRLEN_P(elem) = XMLRPC_GetValueStringLen(el);
- Z_STRVAL_P(elem) = estrndup(XMLRPC_GetValueDateTime_ISO8601(el), Z_STRLEN_P(elem));
- Z_TYPE_P(elem) = IS_STRING;
- break;
- case xmlrpc_base64:
- pStr = XMLRPC_GetValueBase64(el);
- if(pStr) {
- Z_STRLEN_P(elem) = XMLRPC_GetValueStringLen(el);
- Z_STRVAL_P(elem) = estrndup(pStr, Z_STRLEN_P(elem));
- Z_TYPE_P(elem) = IS_STRING;
- }
- break;
- case xmlrpc_vector:
- array_init(elem);
- {
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(el);
-
- while( xIter ) {
- zval *val = XMLRPC_to_PHP(xIter);
- if (val) {
- add_zval(elem, XMLRPC_GetValueID(xIter), &val);
- }
- xIter = XMLRPC_VectorNext(el);
- }
- }
- break;
- default:
- break;
- }
- set_zval_xmlrpc_type(elem, type);
- }
- return elem;
-}
-
-/* {{{ proto string xmlrpc_encode_request(string method, mixed params)
- Generates XML for a method request */
-PHP_FUNCTION(xmlrpc_encode_request)
-{
- XMLRPC_REQUEST xRequest = NULL;
- zval **method, **vals, **out_opts;
- char* outBuf;
- php_output_options out;
-
- if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 || (zend_get_parameters_ex(ZEND_NUM_ARGS(), &method, &vals, &out_opts) == FAILURE)) {
- WRONG_PARAM_COUNT; /* prints/logs a warning and returns */
- }
-
- set_output_options(&out, (ZEND_NUM_ARGS() == 3) ? *out_opts : 0);
-
- if(return_value_used) {
- xRequest = XMLRPC_RequestNew();
-
- if(xRequest) {
- XMLRPC_RequestSetOutputOptions(xRequest, &out.xmlrpc_out);
- if (Z_TYPE_PP(method) == IS_NULL) {
- XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_response);
- } else {
- XMLRPC_RequestSetMethodName(xRequest, Z_STRVAL_PP(method));
- XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_call);
- }
- if (Z_TYPE_PP(vals) != IS_NULL) {
- XMLRPC_RequestSetData(xRequest, PHP_to_XMLRPC(*vals));
- }
-
- outBuf = XMLRPC_REQUEST_ToXML(xRequest, 0);
- if(outBuf) {
- RETVAL_STRING(outBuf, 1);
- free(outBuf);
- }
- XMLRPC_RequestFree(xRequest, 1);
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string xmlrpc_encode(mixed value)
- Generates XML for a PHP value */
-PHP_FUNCTION(xmlrpc_encode)
-{
- XMLRPC_VALUE xOut = NULL;
- zval **arg1;
- char *outBuf;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &arg1) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- if( return_value_used ) {
- /* convert native php type to xmlrpc type */
- xOut = PHP_to_XMLRPC(*arg1);
-
- /* generate raw xml from xmlrpc data */
- outBuf = XMLRPC_VALUE_ToXML(xOut, 0);
-
- if(xOut) {
- if(outBuf) {
- RETVAL_STRING(outBuf, 1);
- free(outBuf);
- }
- /* cleanup */
- XMLRPC_CleanupValue(xOut);
- }
- }
-}
-/* }}} */
-
-
-zval* decode_request_worker (zval* xml_in, zval* encoding_in, zval* method_name_out)
-{
- zval* retval = NULL;
- XMLRPC_REQUEST response;
- STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS opts = {{0}};
- opts.xml_elem_opts.encoding = encoding_in ? utf8_get_encoding_id_from_string(Z_STRVAL_P(encoding_in)) : ENCODING_DEFAULT;
-
- /* generate XMLRPC_REQUEST from raw xml */
- response = XMLRPC_REQUEST_FromXML(Z_STRVAL_P(xml_in), Z_STRLEN_P(xml_in), &opts);
- if(response) {
- /* convert xmlrpc data to native php types */
- retval = XMLRPC_to_PHP(XMLRPC_RequestGetData(response));
-
- if(XMLRPC_RequestGetRequestType(response) == xmlrpc_request_call) {
- if(method_name_out) {
- convert_to_string(method_name_out);
- Z_TYPE_P(method_name_out) = IS_STRING;
- Z_STRVAL_P(method_name_out) = estrdup(XMLRPC_RequestGetMethodName(response));
- Z_STRLEN_P(method_name_out) = strlen(Z_STRVAL_P(method_name_out));
- }
- }
-
- /* dust, sweep, and mop */
- XMLRPC_RequestFree(response, 1);
- }
- return retval;
-}
-
-/* {{{ proto array xmlrpc_decode_request(string xml, string& method [, string encoding])
- Decodes XML into native PHP types */
-PHP_FUNCTION(xmlrpc_decode_request)
-{
- zval **xml, **method, **encoding = NULL;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 || (zend_get_parameters_ex(argc, &xml, &method, &encoding) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(xml);
- convert_to_string_ex(method);
- if(argc == 3) {
- convert_to_string_ex(encoding);
- }
-
- if(return_value_used) {
- zval* retval = decode_request_worker(*xml, *encoding, *method);
- if(retval) {
- *return_value = *retval;
- FREE_ZVAL(retval);
- }
- }
-}
-/* }}} */
-
-
-/* {{{ proto array xmlrpc_decode(string xml [, string encoding])
- Decodes XML into native PHP types */
-PHP_FUNCTION(xmlrpc_decode)
-{
- zval **arg1, **arg2 = NULL;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 1 || argc > 2 || (zend_get_parameters_ex(argc, &arg1, &arg2) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- if(argc == 2) {
- convert_to_string_ex(arg2);
- }
-
- if(return_value_used) {
- zval* retval = decode_request_worker(*arg1, *arg2, NULL);
- if(retval) {
- *return_value = *retval;
- FREE_ZVAL(retval);
- }
- }
-}
-/* }}} */
-
-
-/*************************
-* server related methods *
-*************************/
-
-/* {{{ proto handle xmlrpc_server_create(void)
- Creates an xmlrpc server */
-PHP_FUNCTION(xmlrpc_server_create)
-{
- if(ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- if(return_value_used) {
- zval *method_map, *introspection_map;
- xmlrpc_server_data *server = emalloc(sizeof(xmlrpc_server_data));
- MAKE_STD_ZVAL(method_map);
- MAKE_STD_ZVAL(introspection_map);
-
- array_init(method_map);
- array_init(introspection_map);
-
- /* allocate server data. free'd in destroy_server_data() */
- server->method_map = method_map;
- server->introspection_map = introspection_map;
- server->server_ptr = XMLRPC_ServerCreate();
-
- XMLRPC_ServerRegisterIntrospectionCallback(server->server_ptr, php_xmlrpc_introspection_callback);
-
- /* store for later use */
- ZEND_REGISTER_RESOURCE(return_value,server, le_xmlrpc_server);
- }
-}
-
-/* {{{ proto void xmlrpc_server_destroy(handle server)
- Destroys server resources */
-PHP_FUNCTION(xmlrpc_server_destroy)
-{
- zval **arg1;
- int bSuccess = FAILURE;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &arg1) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- if(Z_TYPE_PP(arg1) == IS_RESOURCE) {
- int type;
-
- xmlrpc_server_data *server = zend_list_find(Z_LVAL_PP(arg1), &type);
-
- if(server && type == le_xmlrpc_server) {
- bSuccess = zend_list_delete(Z_LVAL_PP(arg1));
-
- /* called by hashtable destructor
- * destroy_server_data(server);
- */
- }
- }
- RETVAL_LONG(bSuccess == SUCCESS);
-}
-
-
-/* called by xmlrpc C engine as method handler for all registered methods.
- * it then calls the corresponding PHP function to handle the method.
- */
-static XMLRPC_VALUE php_xmlrpc_callback(XMLRPC_SERVER server, XMLRPC_REQUEST xRequest, void* data)
-{
- xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data;
- zval* xmlrpc_params;
- zval* callback_params[3];
- TSRMLS_FETCH();
-
- /* convert xmlrpc to native php types */
- xmlrpc_params = XMLRPC_to_PHP(XMLRPC_RequestGetData(xRequest));
-
- /* setup data hoojum */
- callback_params[0] = pData->xmlrpc_method;
- callback_params[1] = xmlrpc_params;
- callback_params[2] = pData->caller_params;
-
- /* Use same C function for all methods */
-
- /* php func prototype: function user_func($method_name, $xmlrpc_params, $user_params) */
- call_user_function(CG(function_table), NULL, pData->php_function, pData->return_data, 3, callback_params TSRMLS_CC);
-
- pData->php_executed = 1;
-
- zval_dtor(xmlrpc_params);
- FREE_ZVAL(xmlrpc_params);
-
- return NULL;
-}
-
-/* called by the C server when it first receives an introspection request. We pass this on to
- * our PHP listeners, if any
- */
-static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data)
-{
- zval *retval_ptr, **php_function;
- zval* callback_params[1];
- xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data;
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(retval_ptr);
- Z_TYPE_P(retval_ptr) = IS_NULL;
-
- /* setup data hoojum */
- callback_params[0] = pData->caller_params;
-
- /* loop through and call all registered callbacks */
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(pData->server->introspection_map));
- while(1) {
- if(zend_hash_get_current_data(Z_ARRVAL_P(pData->server->introspection_map),
- (void**)&php_function) == SUCCESS) {
-
- /* php func prototype: function string user_func($user_params) */
- if(call_user_function(CG(function_table), NULL, *php_function,
- retval_ptr, 1, callback_params TSRMLS_CC) == SUCCESS) {
- XMLRPC_VALUE xData;
- STRUCT_XMLRPC_ERROR err = {0};
-
- /* return value should be a string */
- convert_to_string(retval_ptr);
-
- xData = XMLRPC_IntrospectionCreateDescription(Z_STRVAL_P(retval_ptr), &err);
-
- if(xData) {
- if(!XMLRPC_ServerAddIntrospectionData(server, xData)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add introspection data returned from %s(), improper element structure", Z_STRVAL_PP(php_function));
- }
- XMLRPC_CleanupValue(xData);
- }
- else {
- /* could not create description */
- if(err.xml_elem_error.parser_code) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "xml parse error: [line %i, column %i, message: %s] Unable to add introspection data returned from %s()",
- err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error, Z_STRVAL_PP(php_function));
- }
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add introspection data returned from %s()",
- Z_STRVAL_PP(php_function));
- }
- }
- }
- else {
- /* user func failed */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error calling user introspection callback: %s()", Z_STRVAL_PP(php_function));
- }
- }
- else {
- break;
- }
-
- zend_hash_move_forward(Z_ARRVAL_P(pData->server->introspection_map));
- }
-
- /* so we don't call the same callbacks ever again */
- zend_hash_clean(Z_ARRVAL_P(pData->server->introspection_map));
-}
-
-/* {{{ proto bool xmlrpc_server_register_method(handle server, string method_name, string function)
- Register a PHP function to handle method matching method_name */
-PHP_FUNCTION(xmlrpc_server_register_method)
-{
- zval **method_key, **method_name, **handle, *method_name_save;
- int type;
- xmlrpc_server_data* server;
-
- if (ZEND_NUM_ARGS() != 3 || (zend_get_parameters_ex(3, &handle, &method_key, &method_name) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- server = zend_list_find(Z_LVAL_PP(handle), &type);
-
- if(type == le_xmlrpc_server) {
- /* register with C engine. every method just calls our standard callback,
- * and it then dispatches to php as necessary
- */
- if(XMLRPC_ServerRegisterMethod(server->server_ptr, Z_STRVAL_PP(method_key), php_xmlrpc_callback)) {
- /* save for later use */
- MAKE_STD_ZVAL(method_name_save);
- *method_name_save = **method_name;
- zval_copy_ctor(method_name_save);
-
- /* register our php method */
- add_zval(server->method_map, Z_STRVAL_PP(method_key), &method_name_save);
-
- RETURN_BOOL(1);
- }
- }
- RETURN_BOOL(0);
-}
-
-
-/* {{{ proto bool xmlrpc_server_register_introspection_callback(handle server, string function)
- Register a PHP function to generate documentation */
-PHP_FUNCTION(xmlrpc_server_register_introspection_callback)
-{
- zval **method_name, **handle, *method_name_save;
- int type;
- xmlrpc_server_data* server;
-
- if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &handle, &method_name) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- server = zend_list_find(Z_LVAL_PP(handle), &type);
-
- if(type == le_xmlrpc_server) {
- /* save for later use */
- MAKE_STD_ZVAL(method_name_save);
- *method_name_save = **method_name;
- zval_copy_ctor(method_name_save);
-
- /* register our php method */
- add_zval(server->introspection_map, NULL, &method_name_save);
-
- RETURN_BOOL(1);
- }
- RETURN_BOOL(0);
-}
-
-
-/* this function is itchin for a re-write */
-
-/* {{{ proto mixed xmlrpc_server_call_method(handle server, string xml, mixed user_data [, array output_options])
- Parses XML requests and call methods */
-PHP_FUNCTION(xmlrpc_server_call_method)
-{
- xmlrpc_callback_data data = {0};
- XMLRPC_REQUEST xRequest;
- STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS input_opts;
- xmlrpc_server_data* server;
- zval **rawxml, **caller_params, **handle, **output_opts = NULL;
- int type;
- php_output_options out;
- int argc =ZEND_NUM_ARGS();
-
- if (argc < 3 || argc > 4 || (zend_get_parameters_ex(argc, &handle, &rawxml, &caller_params, &output_opts) != SUCCESS)) {
- WRONG_PARAM_COUNT;
- }
- /* user output options */
- set_output_options(&out, *output_opts);
-
- server = zend_list_find(Z_LVAL_PP(handle), &type);
-
- if(type == le_xmlrpc_server) {
- /* HACK: use output encoding for now */
- input_opts.xml_elem_opts.encoding = utf8_get_encoding_id_from_string(out.xmlrpc_out.xml_elem_opts.encoding);
-
- /* generate an XMLRPC_REQUEST from the raw xml input */
- xRequest = XMLRPC_REQUEST_FromXML(Z_STRVAL_PP(rawxml), Z_STRLEN_PP(rawxml), &input_opts);
-
- if(xRequest) {
- const char* methodname = XMLRPC_RequestGetMethodName(xRequest);
- zval **php_function;
- XMLRPC_VALUE xAnswer = NULL;
- MAKE_STD_ZVAL(data.xmlrpc_method); /* init. very important. spent a frustrating day finding this out. */
- MAKE_STD_ZVAL(data.return_data);
- Z_TYPE_P(data.return_data) = IS_NULL; /* in case value is never init'd, we don't dtor to think it is a string or something */
- Z_TYPE_P(data.xmlrpc_method) = IS_NULL;
-
- if (!methodname) {
- methodname = "";
- }
-
- /* setup some data to pass to the callback function */
- Z_STRVAL_P(data.xmlrpc_method) = estrdup(methodname);
- Z_STRLEN_P(data.xmlrpc_method) = strlen(methodname);
- Z_TYPE_P(data.xmlrpc_method) = IS_STRING;
- data.caller_params = *caller_params;
- data.php_executed = 0;
- data.server = server;
-
- /* check if the called method has been previous registered */
- if(zend_hash_find(Z_ARRVAL_P(server->method_map),
- Z_STRVAL_P(data.xmlrpc_method),
- Z_STRLEN_P(data.xmlrpc_method) + 1,
- (void**)&php_function) == SUCCESS) {
-
- data.php_function = *php_function;
- }
-
- /* We could just call the php method directly ourselves at this point, but we do this
- * with a C callback in case the xmlrpc library ever implements some cool usage stats,
- * or somesuch.
- */
- xAnswer = XMLRPC_ServerCallMethod(server->server_ptr, xRequest, &data);
- if(xAnswer && out.b_php_out) {
- zval_dtor(data.return_data);
- FREE_ZVAL(data.return_data);
- data.return_data = XMLRPC_to_PHP(xAnswer);
- } else if(data.php_executed && !out.b_php_out) {
- xAnswer = PHP_to_XMLRPC(data.return_data);
- }
-
- /* should we return data as xml? */
- if(!out.b_php_out) {
- XMLRPC_REQUEST xResponse = XMLRPC_RequestNew();
- if(xResponse) {
- char *outBuf = 0;
- int buf_len = 0;
-
- /* automagically determine output serialization type from request type */
- if (out.b_auto_version) {
- XMLRPC_REQUEST_OUTPUT_OPTIONS opts = XMLRPC_RequestGetOutputOptions(xRequest);
- if (opts) {
- out.xmlrpc_out.version = opts->version;
- }
- }
- /* set some required request hoojum */
- XMLRPC_RequestSetOutputOptions(xResponse, &out.xmlrpc_out);
- XMLRPC_RequestSetRequestType(xResponse, xmlrpc_request_response);
- XMLRPC_RequestSetData(xResponse, xAnswer);
- XMLRPC_RequestSetMethodName(xResponse, methodname);
-
- /* generate xml */
- outBuf = XMLRPC_REQUEST_ToXML(xResponse, &buf_len);
- if(outBuf) {
- RETVAL_STRINGL(outBuf, buf_len, 1);
- free(outBuf);
- }
- /* cleanup after ourselves. what a sty! */
- XMLRPC_RequestFree(xResponse, 0);
- }
- } else { /* or as native php types? */
- *return_value = *data.return_data;
- zval_copy_ctor(return_value);
- }
-
- /* cleanup after ourselves. what a sty! */
- zval_dtor(data.xmlrpc_method);
- FREE_ZVAL(data.xmlrpc_method);
- zval_dtor(data.return_data);
- FREE_ZVAL(data.return_data);
-
- if(xAnswer) {
- XMLRPC_CleanupValue(xAnswer);
- }
-
- XMLRPC_RequestFree(xRequest, 1);
- }
- }
-}
-
-
-/* {{{ proto int xmlrpc_server_add_introspection_data(handle server, array desc)
- Adds introspection documentation */
-PHP_FUNCTION(xmlrpc_server_add_introspection_data)
-{
- zval **handle, **desc;
- int type;
- xmlrpc_server_data* server;
-
- if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &handle, &desc) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- server = zend_list_find(Z_LVAL_PP(handle), &type);
-
- if (type == le_xmlrpc_server) {
- XMLRPC_VALUE xDesc = PHP_to_XMLRPC(*desc);
- if (xDesc) {
- int retval = XMLRPC_ServerAddIntrospectionData(server->server_ptr, xDesc);
- XMLRPC_CleanupValue(xDesc);
- RETURN_LONG(retval);
- }
- }
- RETURN_LONG(0);
-}
-
-
-/* {{{ proto array xmlrpc_parse_method_descriptions(string xml)
- Decodes XML into a list of method descriptions */
-PHP_FUNCTION(xmlrpc_parse_method_descriptions)
-{
- zval **arg1, *retval;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &arg1) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
-
- if(return_value_used) {
- STRUCT_XMLRPC_ERROR err = {0};
- XMLRPC_VALUE xVal = XMLRPC_IntrospectionCreateDescription(Z_STRVAL_PP(arg1), &err);
- if(xVal) {
- retval = XMLRPC_to_PHP(xVal);
-
- if(retval) {
- *return_value = *retval;
- zval_copy_ctor(return_value);
- }
- /* dust, sweep, and mop */
- XMLRPC_CleanupValue(xVal);
- } else {
- /* could not create description */
- if(err.xml_elem_error.parser_code) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "xml parse error: [line %i, column %i, message: %s] Unable to create introspection data",
- err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid xml structure. Unable to create introspection data");
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "xml parse error. no method description created");
- }
- }
-}
-
-
-/************
-* type data *
-************/
-
-#define XMLRPC_TYPE_COUNT 9
-#define XMLRPC_VECTOR_TYPE_COUNT 4
-#define TYPE_STR_MAP_SIZE (XMLRPC_TYPE_COUNT + XMLRPC_VECTOR_TYPE_COUNT)
-
-/* return a string matching a given xmlrpc type */
-static const char** get_type_str_mapping(void)
-{
- static const char* str_mapping[TYPE_STR_MAP_SIZE];
- static int first = 1;
- if (first) {
- /* warning. do not add/delete without changing size define */
- str_mapping[xmlrpc_none] = "none";
- str_mapping[xmlrpc_empty] = "empty";
- str_mapping[xmlrpc_base64] = "base64";
- str_mapping[xmlrpc_boolean] = "boolean";
- str_mapping[xmlrpc_datetime] = "datetime";
- str_mapping[xmlrpc_double] = "double";
- str_mapping[xmlrpc_int] = "int";
- str_mapping[xmlrpc_string] = "string";
- str_mapping[xmlrpc_vector] = "vector";
- str_mapping[XMLRPC_TYPE_COUNT + xmlrpc_vector_none] = "none";
- str_mapping[XMLRPC_TYPE_COUNT + xmlrpc_vector_array] = "array";
- str_mapping[XMLRPC_TYPE_COUNT + xmlrpc_vector_mixed] = "mixed";
- str_mapping[XMLRPC_TYPE_COUNT + xmlrpc_vector_struct] = "struct";
- first = 0;
- }
- return (const char**)str_mapping;
-}
-
-/* map an xmlrpc type to a string */
-const char* xmlrpc_type_as_str(XMLRPC_VALUE_TYPE type, XMLRPC_VECTOR_TYPE vtype)
-{
- const char** str_mapping = get_type_str_mapping();
-
- if (vtype == xmlrpc_vector_none) {
- return str_mapping[type];
- } else {
- return str_mapping[XMLRPC_TYPE_COUNT + vtype];
- }
-}
-
-/* map a string to an xmlrpc type */
-XMLRPC_VALUE_TYPE xmlrpc_str_as_type(const char* str)
-{
- const char** str_mapping = get_type_str_mapping();
- int i;
-
- if (str) {
- for (i = 0; i < XMLRPC_TYPE_COUNT; i++) {
- if (!strcmp(str_mapping[i], str)) {
- return (XMLRPC_VALUE_TYPE) i;
- }
- }
- }
- return xmlrpc_none;
-}
-
-/* map a string to an xmlrpc vector type */
-XMLRPC_VECTOR_TYPE xmlrpc_str_as_vector_type(const char* str)
-{
- const char** str_mapping = get_type_str_mapping();
- int i;
-
- if (str) {
- for (i = XMLRPC_TYPE_COUNT; i < TYPE_STR_MAP_SIZE; i++) {
- if (!strcmp(str_mapping[i], str)) {
- return (XMLRPC_VECTOR_TYPE) (i - XMLRPC_TYPE_COUNT);
- }
- }
- }
- return xmlrpc_none;
-}
-
-
-/* set a given value to a particular type.
- * note: this only works on strings, and only for date and base64,
- * which do not have native php types. black magic lies herein.
- */
-int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype)
-{
- int bSuccess = FAILURE;
- TSRMLS_FETCH();
-
- /* we only really care about strings because they can represent
- * base64 and datetime. all other types have corresponding php types
- */
- if (Z_TYPE_P(value) == IS_STRING) {
- if (newtype == xmlrpc_base64 || newtype == xmlrpc_datetime) {
- const char* typestr = xmlrpc_type_as_str(newtype, xmlrpc_vector_none);
- zval* type;
-
- MAKE_STD_ZVAL(type);
-
- Z_TYPE_P(type) = IS_STRING;
- Z_STRVAL_P(type) = estrdup(typestr);
- Z_STRLEN_P(type) = strlen(typestr);
-
- if(newtype == xmlrpc_datetime) {
- XMLRPC_VALUE v = XMLRPC_CreateValueDateTime_ISO8601(NULL, value->value.str.val);
- if(v) {
- time_t timestamp = XMLRPC_GetValueDateTime(v);
- if(timestamp) {
- pval* ztimestamp;
-
- MAKE_STD_ZVAL(ztimestamp);
-
- ztimestamp->type = IS_LONG;
- ztimestamp->value.lval = timestamp;
-
- convert_to_object(value);
- if(SUCCESS == zend_hash_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void *) &type, sizeof(zval *), NULL)) {
- bSuccess = zend_hash_update(Z_OBJPROP_P(value), OBJECT_VALUE_TS_ATTR, sizeof(OBJECT_VALUE_TS_ATTR), (void *) &ztimestamp, sizeof(zval *), NULL);
- }
- }
- XMLRPC_CleanupValue(v);
- }
- }
- else {
- convert_to_object(value);
- bSuccess = zend_hash_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void *) &type, sizeof(zval *), NULL);
- }
- }
- }
-
- return bSuccess;
-}
-
-/* return xmlrpc type of a php value */
-XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval** newvalue)
-{
- XMLRPC_VALUE_TYPE type = xmlrpc_none;
- TSRMLS_FETCH();
-
- if (value) {
- switch (Z_TYPE_P(value)) {
- case IS_NULL:
- type = xmlrpc_base64;
- break;
- #ifndef BOOL_AS_LONG
-
- /* Right thing to do, but it breaks some legacy code. */
- case IS_BOOL:
- type = xmlrpc_boolean;
- break;
- #else
- case IS_BOOL:
- #endif
- case IS_LONG:
- case IS_RESOURCE:
- type = xmlrpc_int;
- break;
- case IS_DOUBLE:
- type = xmlrpc_double;
- break;
- case IS_CONSTANT:
- type = xmlrpc_string;
- break;
- case IS_STRING:
- type = xmlrpc_string;
- break;
- case IS_ARRAY:
- case IS_CONSTANT_ARRAY:
- type = xmlrpc_vector;
- break;
- case IS_OBJECT:
- {
- zval** attr;
- type = xmlrpc_vector;
-
- if (zend_hash_find(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void**) &attr) == SUCCESS) {
- if (Z_TYPE_PP(attr) == IS_STRING) {
- type = xmlrpc_str_as_type(Z_STRVAL_PP(attr));
- }
- }
- break;
- }
- }
-
- /* if requested, return an unmolested (magic removed) copy of the value */
- if (newvalue) {
- zval** val;
-
- if ((type == xmlrpc_base64 && Z_TYPE_P(value) != IS_NULL) || type == xmlrpc_datetime) {
- if (zend_hash_find(Z_OBJPROP_P(value), OBJECT_VALUE_ATTR, sizeof(OBJECT_VALUE_ATTR), (void**) &val) == SUCCESS) {
- *newvalue = *val;
- }
- } else {
- *newvalue = value;
- }
- }
- }
-
- return type;
-}
-
-
-/* {{{ proto bool xmlrpc_set_type(string value, string type)
- Sets xmlrpc type, base64 or datetime, for a PHP string value */
-PHP_FUNCTION(xmlrpc_set_type)
-{
- zval **arg, **type;
- XMLRPC_VALUE_TYPE vtype;
-
- if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &arg, &type) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(type);
- vtype = xmlrpc_str_as_type(Z_STRVAL_PP(type));
- if (vtype != xmlrpc_none) {
- if (set_zval_xmlrpc_type(*arg, vtype) == SUCCESS) {
- RETURN_TRUE;
- }
- } else {
- zend_error(E_WARNING,"invalid type '%s' passed to xmlrpc_set_type()", Z_STRVAL_PP(type));
- }
- RETURN_FALSE;
-}
-
-/* {{{ proto string xmlrpc_get_type(mixed value)
- Gets xmlrpc type for a PHP value. Especially useful for base64 and datetime strings */
-PHP_FUNCTION(xmlrpc_get_type)
-{
- zval **arg;
- XMLRPC_VALUE_TYPE type;
- XMLRPC_VECTOR_TYPE vtype = xmlrpc_vector_none;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &arg) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- type = get_zval_xmlrpc_type(*arg, 0);
- if (type == xmlrpc_vector) {
- vtype = determine_vector_type(Z_ARRVAL_PP(arg));
- }
-
- RETURN_STRING((char*) xmlrpc_type_as_str(type, vtype), 1);
-}
-
-/* {{{ proto string xmlrpc_is_fault(array)
- Determines if an array value represents an XMLRPC fault. */
-PHP_FUNCTION(xmlrpc_is_fault)
-{
- zval **arg, **val;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &arg) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(arg) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array argument expected");
- } else {
- /* The "correct" way to do this would be to call the xmlrpc
- * library XMLRPC_ValueIsFault() func. However, doing that
- * would require us to create an xmlrpc value from the php
- * array, which is rather expensive, especially if it was
- * a big array. Thus, we resort to this not so clever hackery.
- */
- if (zend_hash_find(Z_ARRVAL_PP(arg), FAULT_CODE, FAULT_CODE_LEN + 1, (void**) &val) == SUCCESS &&
- zend_hash_find(Z_ARRVAL_PP(arg), FAULT_STRING, FAULT_STRING_LEN + 1, (void**) &val) == SUCCESS) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
diff --git a/ext/rpc/xmlrpc/xmlrpc.dsp b/ext/rpc/xmlrpc/xmlrpc.dsp
deleted file mode 100644
index 9c2303721b..0000000000
--- a/ext/rpc/xmlrpc/xmlrpc.dsp
+++ /dev/null
@@ -1,211 +0,0 @@
-# Microsoft Developer Studio Project File - Name="xmlrpc" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=xmlrpc - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc.mak" CFG="xmlrpc - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xmlrpc - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "xmlrpc - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xmlrpc - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "libxmlrpc" /I "..\..\bundle\expat" /D HAVE_XMLRPC=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /D ZTS=1 /D COMPILE_DL_XMLRPC=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x1009 /d "_DEBUG"
-# ADD RSC /l 0x1009 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 iconv.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_xmlrpc.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "xmlrpc - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "libxmlrpc" /I "..\..\bundle\expat" /D HAVE_XMLRPC=1 /D "ZEND_WIN32" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D ZTS=1 /D COMPILE_DL_XMLRPC=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x1009 /d "NDEBUG"
-# ADD RSC /l 0x1009 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 iconv.lib php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_xmlrpc.dll" /libpath:"..\..\Release_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "xmlrpc - Win32 Debug_TS"
-# Name "xmlrpc - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=".\xmlrpc-epi-php.c"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_xmlrpc.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Group "libxmlrpc"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\libxmlrpc\base64.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\base64.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\encodings.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\encodings.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\queue.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\queue.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\simplestring.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\simplestring.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\system_methods.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\system_methods_private.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_element.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_element.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_dandarpc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_dandarpc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_soap.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_soap.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_xmlrpc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_xmlrpc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_introspection.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_introspection.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_introspection_private.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_private.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/session/CREDITS b/ext/session/CREDITS
deleted file mode 100644
index 79659c7035..0000000000
--- a/ext/session/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Sessions
-Sascha Schumann, Andrei Zmievski
diff --git a/ext/session/config.m4 b/ext/session/config.m4
deleted file mode 100644
index 4e5a4ddd2c..0000000000
--- a/ext/session/config.m4
+++ /dev/null
@@ -1,33 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(session, whether to enable PHP sessions,
-[ --disable-session Disable session support], yes)
-
-PHP_ARG_WITH(mm,for mm support,
-[ --with-mm[=DIR] Include mm support for session storage], no, no)
-
-if test "$PHP_SESSION" != "no"; then
- PHP_PWRITE_TEST
- PHP_PREAD_TEST
- PHP_NEW_EXTENSION(session, session.c mod_files.c mod_mm.c mod_user.c, $ext_shared)
- PHP_SUBST(SESSION_SHARED_LIBADD)
- AC_DEFINE(HAVE_PHP_SESSION,1,[ ])
-fi
-
-if test "$PHP_MM" != "no"; then
- for i in /usr/local /usr $PHP_MM; do
- if test -f "$i/include/mm.h"; then
- MM_DIR=$i
- fi
- done
-
- if test -z "$MM_DIR" ; then
- AC_MSG_ERROR(cannot find mm library)
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(mm, $MM_DIR/lib, SESSION_SHARED_LIBADD)
- PHP_ADD_INCLUDE($MM_DIR/include)
- AC_DEFINE(HAVE_LIBMM, 1, [Whether you have libmm])
-fi
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
deleted file mode 100644
index f276201a85..0000000000
--- a/ext/session/mod_files.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#if HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-
-#if HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#ifdef PHP_WIN32
-#include "win32/readdir.h"
-#endif
-#include <time.h>
-
-#include <fcntl.h>
-#include <errno.h>
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include "php_session.h"
-#include "mod_files.h"
-#include "ext/standard/flock_compat.h"
-
-#define FILE_PREFIX "sess_"
-
-typedef struct {
- int fd;
- char *lastkey;
- char *basedir;
- size_t basedir_len;
- size_t dirdepth;
- size_t st_size;
- int filemode;
-} ps_files;
-
-ps_module ps_mod_files = {
- PS_MOD(files)
-};
-
-/* If you change the logic here, please also update the error message in
- * ps_files_open() appropriately */
-static int ps_files_valid_key(const char *key)
-{
- size_t len;
- const char *p;
- char c;
- int ret = 1;
-
- for (p = key; (c = *p); p++) {
- /* valid characters are a..z,A..Z,0..9 */
- if (!((c >= 'a' && c <= 'z')
- || (c >= 'A' && c <= 'Z')
- || (c >= '0' && c <= '9')
- || c == ','
- || c == '-')) {
- ret = 0;
- break;
- }
- }
-
- len = p - key;
-
- if (len == 0)
- ret = 0;
-
- return ret;
-}
-
-static char *ps_files_path_create(char *buf, size_t buflen, ps_files *data, const char *key)
-{
- size_t key_len;
- const char *p;
- int i;
- int n;
-
- key_len = strlen(key);
- if (key_len <= data->dirdepth || buflen <
- (strlen(data->basedir) + 2 * data->dirdepth + key_len + 5 + sizeof(FILE_PREFIX)))
- return NULL;
- p = key;
- memcpy(buf, data->basedir, data->basedir_len);
- n = data->basedir_len;
- buf[n++] = PHP_DIR_SEPARATOR;
- for (i = 0; i < (int)data->dirdepth; i++) {
- buf[n++] = *p++;
- buf[n++] = PHP_DIR_SEPARATOR;
- }
- memcpy(buf + n, FILE_PREFIX, sizeof(FILE_PREFIX) - 1);
- n += sizeof(FILE_PREFIX) - 1;
- memcpy(buf + n, key, key_len);
- n += key_len;
- buf[n] = '\0';
-
- return buf;
-}
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-static void ps_files_close(ps_files *data)
-{
- if (data->fd != -1) {
- close(data->fd);
- data->fd = -1;
- }
-}
-
-static void ps_files_open(ps_files *data, const char *key TSRMLS_DC)
-{
- char buf[MAXPATHLEN];
-
- if (data->fd < 0 || !data->lastkey || strcmp(key, data->lastkey)) {
- if (data->lastkey) {
- efree(data->lastkey);
- data->lastkey = NULL;
- }
-
- ps_files_close(data);
-
- if (!ps_files_valid_key(key)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The session id contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,'");
- return;
- }
- if (!ps_files_path_create(buf, sizeof(buf), data, key))
- return;
-
- data->lastkey = estrdup(key);
-
- data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY,
- data->filemode);
-
- if (data->fd != -1) {
- flock(data->fd, LOCK_EX);
-
-#ifdef F_SETFD
- if (fcntl(data->fd, F_SETFD, 1)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "fcntl(%d, F_SETFD, 1) failed: %s (%d)", data->fd, strerror(errno), errno);
- }
-#endif
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "open(%s, O_RDWR) failed: %s (%d)", buf,
- strerror(errno), errno);
- }
- }
-}
-
-static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC)
-{
- DIR *dir;
- char dentry[sizeof(struct dirent) + MAXPATHLEN];
- struct dirent *entry = (struct dirent *) &dentry;
- struct stat sbuf;
- char buf[MAXPATHLEN];
- time_t now;
- int nrdels = 0;
- size_t dirname_len;
-
- dir = opendir(dirname);
- if (!dir) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "ps_files_cleanup_dir: opendir(%s) failed: %s (%d)\n", dirname, strerror(errno), errno);
- return (0);
- }
-
- time(&now);
-
- dirname_len = strlen(dirname);
-
- /* Prepare buffer (dirname never changes) */
- memcpy(buf, dirname, dirname_len);
- buf[dirname_len] = PHP_DIR_SEPARATOR;
-
- while (php_readdir_r(dir, (struct dirent *) dentry, &entry) == 0 && entry) {
- /* does the file start with our prefix? */
- if (!strncmp(entry->d_name, FILE_PREFIX, sizeof(FILE_PREFIX) - 1)) {
- size_t entry_len;
-
- entry_len = strlen(entry->d_name);
- /* does it fit into our buffer? */
- if (entry_len + dirname_len + 2 < MAXPATHLEN) {
- /* create the full path.. */
- memcpy(buf + dirname_len + 1, entry->d_name, entry_len);
- /* NUL terminate it and */
- buf[dirname_len + entry_len + 1] = '\0';
- /* check whether its last access was more than maxlifet ago */
- if (VCWD_STAT(buf, &sbuf) == 0 &&
- (now - sbuf.st_mtime) > maxlifetime) {
- VCWD_UNLINK(buf);
- nrdels++;
- }
- }
- }
- }
-
- closedir(dir);
-
- return (nrdels);
-}
-
-#define PS_FILES_DATA ps_files *data = PS_GET_MOD_DATA()
-
-PS_OPEN_FUNC(files)
-{
- ps_files *data;
- const char *p, *last;
- const char *argv[3];
- int argc = 0;
- size_t dirdepth = 0;
- int filemode = 0600;
-
- /* split up input parameter */
- last = save_path;
- p = strchr(save_path, ';');
- while (p) {
- argv[argc++] = last;
- last = ++p;
- p = strchr(p, ';');
- if (argc > 1) break;
- }
- argv[argc++] = last;
-
- if (argc > 1) {
- errno = 0;
- dirdepth = (size_t) strtol(argv[0], NULL, 10);
- if (errno == ERANGE) {
- php_error(E_WARNING,
- "The first parameter in session.save_path is invalid");
- return FAILURE;
- }
- }
-
- if (argc > 2) {
- errno = 0;
- filemode = strtol(argv[1], NULL, 8);
- if (errno == ERANGE || filemode < 0 || filemode > 07777) {
- php_error(E_WARNING,
- "The second parameter in session.save_path is invalid");
- return FAILURE;
- }
- }
- save_path = argv[argc - 1];
-
- data = emalloc(sizeof(*data));
- memset(data, 0, sizeof(*data));
-
- data->fd = -1;
- data->dirdepth = dirdepth;
- data->filemode = filemode;
- data->basedir_len = strlen(save_path);
- data->basedir = estrndup(save_path, data->basedir_len);
-
- PS_SET_MOD_DATA(data);
-
- return SUCCESS;
-}
-
-PS_CLOSE_FUNC(files)
-{
- PS_FILES_DATA;
-
- ps_files_close(data);
-
- if (data->lastkey)
- efree(data->lastkey);
- efree(data->basedir);
- efree(data);
- *mod_data = NULL;
-
- return SUCCESS;
-}
-
-PS_READ_FUNC(files)
-{
- long n;
- struct stat sbuf;
- PS_FILES_DATA;
-
- ps_files_open(data, key TSRMLS_CC);
- if (data->fd < 0)
- return FAILURE;
-
- if (fstat(data->fd, &sbuf))
- return FAILURE;
-
- data->st_size = *vallen = sbuf.st_size;
- *val = emalloc(sbuf.st_size);
-
-#if defined(HAVE_PREAD)
- n = pread(data->fd, *val, sbuf.st_size, 0);
-#else
- lseek(data->fd, 0, SEEK_SET);
- n = read(data->fd, *val, sbuf.st_size);
-#endif
-
- if (n != sbuf.st_size) {
- if (n == -1)
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "read failed: %s (%d)", strerror(errno), errno);
- else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "read returned less bytes than requested");
- efree(*val);
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-PS_WRITE_FUNC(files)
-{
- long n;
- PS_FILES_DATA;
-
- ps_files_open(data, key TSRMLS_CC);
- if (data->fd < 0)
- return FAILURE;
-
- /*
- * truncate file, if the amount of new data is smaller than
- * the existing data set.
- */
-
- if (vallen < (int)data->st_size)
- ftruncate(data->fd, 0);
-
-#if defined(HAVE_PWRITE)
- n = pwrite(data->fd, val, vallen, 0);
-#else
- lseek(data->fd, 0, SEEK_SET);
- n = write(data->fd, val, vallen);
-#endif
-
- if (n != vallen) {
- if (n == -1)
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "write failed: %s (%d)", strerror(errno), errno);
- else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "write wrote less bytes than requested");
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-PS_DESTROY_FUNC(files)
-{
- char buf[MAXPATHLEN];
- PS_FILES_DATA;
-
- if (!ps_files_path_create(buf, sizeof(buf), data, key))
- return FAILURE;
-
- ps_files_close(data);
-
- if (VCWD_UNLINK(buf) == -1) {
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-PS_GC_FUNC(files)
-{
- PS_FILES_DATA;
-
- /* we don't perform any cleanup, if dirdepth is larger than 0.
- we return SUCCESS, since all cleanup should be handled by
- an external entity (i.e. find -ctime x | xargs rm) */
-
- if (data->dirdepth == 0)
- *nrdels = ps_files_cleanup_dir(data->basedir, maxlifetime TSRMLS_CC);
-
- return SUCCESS;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/session/mod_files.h b/ext/session/mod_files.h
deleted file mode 100644
index 652920a17c..0000000000
--- a/ext/session/mod_files.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef MOD_FILES_H
-#define MOD_FILES_H
-
-extern ps_module ps_mod_files;
-#define ps_files_ptr &ps_mod_files
-
-PS_FUNCS(files);
-
-#endif
diff --git a/ext/session/mod_files.sh b/ext/session/mod_files.sh
deleted file mode 100644
index 4d6a681d9c..0000000000
--- a/ext/session/mod_files.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#! /bin/sh
-
-if test "$2" = ""; then
- echo "usage: $0 basedir depth"
- exit 1
-fi
-
-if test "$2" = "0"; then
- exit 0
-fi
-
-for i in a b c d e f 0 1 2 3 4 5 6 7 8 9; do
- newpath="$1/$i"
- mkdir $newpath || exit 1
- sh $0 $newpath `expr $2 - 1`
-done
diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c
deleted file mode 100644
index df18659278..0000000000
--- a/ext/session/mod_mm.c
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#ifdef HAVE_LIBMM
-
-#include <unistd.h>
-#include <mm.h>
-#include <time.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-
-#include "php_session.h"
-#include "mod_mm.h"
-#include "SAPI.h"
-
-#ifdef ZTS
-# error mm is not thread-safe
-#endif
-
-#define PS_MM_FILE "session_mm_"
-
-/* For php_uint32 */
-#include "ext/standard/basic_functions.h"
-
-/*
- * this list holds all data associated with one session
- */
-
-typedef struct ps_sd {
- struct ps_sd *next;
- php_uint32 hv; /* hash value of key */
- time_t ctime; /* time of last change */
- void *data;
- size_t datalen; /* amount of valid data */
- size_t alloclen; /* amount of allocated memory for data */
- char key[1]; /* inline key */
-} ps_sd;
-
-typedef struct {
- MM *mm;
- ps_sd **hash;
- php_uint32 hash_max;
- php_uint32 hash_cnt;
- pid_t owner;
-} ps_mm;
-
-static ps_mm *ps_mm_instance = NULL;
-
-#if 0
-#define ps_mm_debug(a) printf a
-#else
-#define ps_mm_debug(a)
-#endif
-
-static inline php_uint32 ps_sd_hash(const char *data, int len)
-{
- php_uint32 h;
- const char *e = data + len;
-
- for (h = 2166136261U; data < e; ) {
- h *= 16777619;
- h ^= *data++;
- }
-
- return h;
-}
-
-static void hash_split(ps_mm *data)
-{
- php_uint32 nmax;
- ps_sd **nhash;
- ps_sd **ohash, **ehash;
- ps_sd *ps, *next;
-
- nmax = ((data->hash_max + 1) << 1) - 1;
- nhash = mm_calloc(data->mm, nmax + 1, sizeof(*data->hash));
-
- if (!nhash) {
- /* no further memory to expand hash table */
- return;
- }
-
- ehash = data->hash + data->hash_max + 1;
- for (ohash = data->hash; ohash < ehash; ohash++) {
- for (ps = *ohash; ps; ps = next) {
- next = ps->next;
- ps->next = nhash[ps->hv & nmax];
- nhash[ps->hv & nmax] = ps;
- }
- }
- mm_free(data->mm, data->hash);
-
- data->hash = nhash;
- data->hash_max = nmax;
-}
-
-static ps_sd *ps_sd_new(ps_mm *data, const char *key)
-{
- php_uint32 hv, slot;
- ps_sd *sd;
- int keylen;
-
- keylen = strlen(key);
-
- sd = mm_malloc(data->mm, sizeof(ps_sd) + keylen);
- if (!sd) {
- TSRMLS_FETCH();
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "mm_malloc failed, avail %d, err %s", mm_available(data->mm), mm_error());
- return NULL;
- }
-
- hv = ps_sd_hash(key, keylen);
- slot = hv & data->hash_max;
-
- sd->ctime = 0;
- sd->hv = hv;
- sd->data = NULL;
- sd->alloclen = sd->datalen = 0;
-
- memcpy(sd->key, key, keylen + 1);
-
- sd->next = data->hash[slot];
- data->hash[slot] = sd;
-
- data->hash_cnt++;
-
- if (!sd->next) {
- if (data->hash_cnt >= data->hash_max)
- hash_split(data);
- }
-
- ps_mm_debug(("inserting %s(%p) into slot %d\n", key, sd, slot));
-
- return sd;
-}
-
-static void ps_sd_destroy(ps_mm *data, ps_sd *sd)
-{
- php_uint32 slot;
-
- slot = ps_sd_hash(sd->key, strlen(sd->key)) & data->hash_max;
-
- if (data->hash[slot] == sd)
- data->hash[slot] = sd->next;
- else {
- ps_sd *prev;
-
- /* There must be some entry before the one we want to delete */
- for (prev = data->hash[slot]; prev->next != sd; prev = prev->next);
- prev->next = sd->next;
- }
-
- data->hash_cnt--;
- if (sd->data)
- mm_free(data->mm, sd->data);
- mm_free(data->mm, sd);
-}
-
-static ps_sd *ps_sd_lookup(ps_mm *data, const char *key, int rw)
-{
- php_uint32 hv, slot;
- ps_sd *ret, *prev;
-
- hv = ps_sd_hash(key, strlen(key));
- slot = hv & data->hash_max;
-
- for (prev = NULL, ret = data->hash[slot]; ret; prev = ret, ret = ret->next)
- if (ret->hv == hv && !strcmp(ret->key, key))
- break;
-
- if (ret && rw && ret != data->hash[slot]) {
- /* Move the entry to the top of the linked list */
-
- if (prev)
- prev->next = ret->next;
- ret->next = data->hash[slot];
- data->hash[slot] = ret;
- }
-
- ps_mm_debug(("lookup(%s): ret=%p,hv=%u,slot=%d\n", key, ret, hv, slot));
-
- return ret;
-}
-
-ps_module ps_mod_mm = {
- PS_MOD(mm)
-};
-
-#define PS_MM_DATA ps_mm *data = PS_GET_MOD_DATA()
-
-static int ps_mm_initialize(ps_mm *data, const char *path)
-{
- data->owner = getpid();
- data->mm = mm_create(0, path);
- if (!data->mm) {
- return FAILURE;
- }
-
- data->hash_cnt = 0;
- data->hash_max = 511;
- data->hash = mm_calloc(data->mm, data->hash_max + 1, sizeof(ps_sd *));
- if (!data->hash) {
- mm_destroy(data->mm);
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-static void ps_mm_destroy(ps_mm *data)
-{
- int h;
- ps_sd *sd, *next;
-
- /* This function is called during each module shutdown,
- but we must not release the shared memory pool, when
- an Apache child dies! */
- if (data->owner != getpid()) return;
-
- for (h = 0; h < data->hash_max + 1; h++)
- for (sd = data->hash[h]; sd; sd = next) {
- next = sd->next;
- ps_sd_destroy(data, sd);
- }
-
- mm_free(data->mm, data->hash);
- mm_destroy(data->mm);
- free(data);
-}
-
-PHP_MINIT_FUNCTION(ps_mm)
-{
- int save_path_len = strlen(PS(save_path));
- int mod_name_len = strlen(sapi_module.name);
- char *ps_mm_path, euid[30];
- int ret;
-
- ps_mm_instance = calloc(sizeof(*ps_mm_instance), 1);
- if (!ps_mm_instance)
- return FAILURE;
-
- if (!sprintf(euid,"%d", geteuid()))
- return FAILURE;
-
- /* Directory + '/' + File + Module Name + Effective UID + \0 */
- ps_mm_path = do_alloca(save_path_len+1+sizeof(PS_MM_FILE)+mod_name_len+strlen(euid)+1);
-
- memcpy(ps_mm_path, PS(save_path), save_path_len + 1);
- if (save_path_len > 0 && ps_mm_path[save_path_len - 1] != DEFAULT_SLASH) {
- ps_mm_path[save_path_len] = DEFAULT_SLASH;
- ps_mm_path[save_path_len+1] = '\0';
- }
- strcat(ps_mm_path, PS_MM_FILE);
- strcat(ps_mm_path, sapi_module.name);
- strcat(ps_mm_path, euid);
-
- ret = ps_mm_initialize(ps_mm_instance, ps_mm_path);
-
- free_alloca(ps_mm_path);
-
- if (ret != SUCCESS) {
- free(ps_mm_instance);
- ps_mm_instance = NULL;
- return FAILURE;
- }
-
- php_session_register_module(&ps_mod_mm);
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(ps_mm)
-{
- if (ps_mm_instance) {
- ps_mm_destroy(ps_mm_instance);
- return SUCCESS;
- }
- return FAILURE;
-}
-
-PS_OPEN_FUNC(mm)
-{
- ps_mm_debug(("open: ps_mm_instance=%p\n", ps_mm_instance));
-
- if (!ps_mm_instance)
- return FAILURE;
-
- PS_SET_MOD_DATA(ps_mm_instance);
-
- return SUCCESS;
-}
-
-PS_CLOSE_FUNC(mm)
-{
- PS_SET_MOD_DATA(NULL);
-
- return SUCCESS;
-}
-
-PS_READ_FUNC(mm)
-{
- PS_MM_DATA;
- ps_sd *sd;
- int ret = FAILURE;
-
- mm_lock(data->mm, MM_LOCK_RD);
-
- sd = ps_sd_lookup(data, key, 0);
- if (sd) {
- *vallen = sd->datalen;
- *val = emalloc(sd->datalen + 1);
- memcpy(*val, sd->data, sd->datalen);
- (*val)[sd->datalen] = '\0';
- ret = SUCCESS;
- }
-
- mm_unlock(data->mm);
-
- return ret;
-}
-
-PS_WRITE_FUNC(mm)
-{
- PS_MM_DATA;
- ps_sd *sd;
-
- mm_lock(data->mm, MM_LOCK_RW);
-
- sd = ps_sd_lookup(data, key, 1);
- if (!sd) {
- sd = ps_sd_new(data, key);
- ps_mm_debug(("new entry for %s\n", key));
- }
-
- if (sd) {
- if (vallen >= sd->alloclen) {
- if (data->mm)
- mm_free(data->mm, sd->data);
- sd->alloclen = vallen + 1;
- sd->data = mm_malloc(data->mm, sd->alloclen);
-
- if (!sd->data) {
- ps_sd_destroy(data, sd);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot allocate new data segment");
- sd = NULL;
- }
- }
- if (sd) {
- sd->datalen = vallen;
- memcpy(sd->data, val, vallen);
- time(&sd->ctime);
- }
- }
-
- mm_unlock(data->mm);
-
- return sd ? SUCCESS : FAILURE;
-}
-
-PS_DESTROY_FUNC(mm)
-{
- PS_MM_DATA;
- ps_sd *sd;
-
- mm_lock(data->mm, MM_LOCK_RW);
-
- sd = ps_sd_lookup(data, key, 0);
- if (sd)
- ps_sd_destroy(data, sd);
-
- mm_unlock(data->mm);
-
- return SUCCESS;
-}
-
-PS_GC_FUNC(mm)
-{
- PS_MM_DATA;
- time_t limit;
- ps_sd **ohash, **ehash;
- ps_sd *sd, *next;
-
- *nrdels = 0;
- ps_mm_debug(("gc\n"));
-
- time(&limit);
-
- limit -= maxlifetime;
-
- mm_lock(data->mm, MM_LOCK_RW);
-
- ehash = data->hash + data->hash_max + 1;
- for (ohash = data->hash; ohash < ehash; ohash++)
- for (sd = *ohash; sd; sd = next) {
- next = sd->next;
- if (sd->ctime < limit) {
- ps_mm_debug(("purging %s\n", sd->key));
- ps_sd_destroy(data, sd);
- (*nrdels)++;
- }
- }
-
- mm_unlock(data->mm);
-
- return SUCCESS;
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/session/mod_mm.h b/ext/session/mod_mm.h
deleted file mode 100644
index 2fa85531a7..0000000000
--- a/ext/session/mod_mm.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef MOD_MM_H
-#define MOD_MM_H
-
-#ifdef HAVE_LIBMM
-
-#include "php_session.h"
-
-PHP_MINIT_FUNCTION(ps_mm);
-PHP_MSHUTDOWN_FUNCTION(ps_mm);
-
-extern ps_module ps_mod_mm;
-#define ps_mm_ptr &ps_mod_mm
-
-PS_FUNCS(mm);
-
-#endif
-#endif
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
deleted file mode 100644
index eeaf404bc4..0000000000
--- a/ext/session/mod_user.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_session.h"
-#include "mod_user.h"
-
-ps_module ps_mod_user = {
- PS_MOD(user)
-};
-
-#define SESS_ZVAL_LONG(val, a) \
-{ \
- MAKE_STD_ZVAL(a); \
- Z_TYPE_P(a) = IS_LONG; \
- Z_LVAL_P(a) = val; \
-}
-
-#define SESS_ZVAL_STRING(vl, a) \
-{ \
- int len = strlen(vl); \
- MAKE_STD_ZVAL(a); \
- Z_TYPE_P(a) = IS_STRING; \
- Z_STRLEN_P(a) = len; \
- Z_STRVAL_P(a) = estrndup(vl, len); \
-}
-
-#define SESS_ZVAL_STRINGN(vl, ln, a) \
-{ \
- MAKE_STD_ZVAL(a); \
- Z_TYPE_P(a) = IS_STRING; \
- Z_STRLEN_P(a) = ln; \
- Z_STRVAL_P(a) = estrndup(vl, ln); \
-}
-
-
-static zval *ps_call_handler(zval *func, int argc, zval **argv TSRMLS_DC)
-{
- int i;
- zval *retval = NULL;
-
- MAKE_STD_ZVAL(retval);
- if (call_user_function(EG(function_table), NULL, func, retval,
- argc, argv TSRMLS_CC) == FAILURE) {
- zval_ptr_dtor(&retval);
- retval = NULL;
- }
-
- for (i = 0; i < argc; i++) {
- zval_ptr_dtor(&argv[i]);
- }
-
- return retval;
-}
-
-#define STDVARS \
- zval *retval; \
- int ret = FAILURE; \
- ps_user *mdata = PS_GET_MOD_DATA(); \
- if (!mdata) \
- return FAILURE
-
-#define PSF(a) mdata->name.ps_##a
-
-#define FINISH \
- if (retval) { \
- convert_to_long(retval); \
- ret = Z_LVAL_P(retval); \
- zval_ptr_dtor(&retval); \
- } \
- return ret
-
-PS_OPEN_FUNC(user)
-{
- zval *args[2];
- STDVARS;
-
- SESS_ZVAL_STRING(save_path, args[0]);
- SESS_ZVAL_STRING(session_name, args[1]);
-
- retval = ps_call_handler(PSF(open), 2, args TSRMLS_CC);
-
- FINISH;
-}
-
-PS_CLOSE_FUNC(user)
-{
- int i;
- STDVARS;
-
- retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC);
-
- for (i = 0; i < 6; i++)
- zval_ptr_dtor(&mdata->names[i]);
- efree(mdata);
-
- PS_SET_MOD_DATA(NULL);
-
- FINISH;
-}
-
-PS_READ_FUNC(user)
-{
- zval *args[1];
- STDVARS;
-
- SESS_ZVAL_STRING(key, args[0]);
-
- retval = ps_call_handler(PSF(read), 1, args TSRMLS_CC);
-
- if (retval) {
- if (Z_TYPE_P(retval) == IS_STRING) {
- *val = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
- *vallen = Z_STRLEN_P(retval);
- ret = SUCCESS;
- }
- zval_ptr_dtor(&retval);
- }
-
- return ret;
-}
-
-PS_WRITE_FUNC(user)
-{
- zval *args[2];
- STDVARS;
-
- SESS_ZVAL_STRING(key, args[0]);
- SESS_ZVAL_STRINGN(val, vallen, args[1]);
-
- retval = ps_call_handler(PSF(write), 2, args TSRMLS_CC);
-
- FINISH;
-}
-
-PS_DESTROY_FUNC(user)
-{
- zval *args[1];
- STDVARS;
-
- SESS_ZVAL_STRING(key, args[0]);
-
- retval = ps_call_handler(PSF(destroy), 1, args TSRMLS_CC);
-
- FINISH;
-}
-
-PS_GC_FUNC(user)
-{
- zval *args[1];
- STDVARS;
-
- SESS_ZVAL_LONG(maxlifetime, args[0]);
-
- retval = ps_call_handler(PSF(gc), 1, args TSRMLS_CC);
-
- FINISH;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/session/mod_user.h b/ext/session/mod_user.h
deleted file mode 100644
index c146fd4d37..0000000000
--- a/ext/session/mod_user.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef MOD_USER_H
-#define MOD_USER_H
-
-typedef union {
- zval *names[6];
- struct {
- zval *ps_open;
- zval *ps_close;
- zval *ps_read;
- zval *ps_write;
- zval *ps_destroy;
- zval *ps_gc;
- } name;
-} ps_user;
-
-extern ps_module ps_mod_user;
-#define ps_user_ptr &ps_mod_user
-
-PS_FUNCS(user);
-
-#endif
diff --git a/ext/session/php_session.h b/ext/session/php_session.h
deleted file mode 100644
index 13f17d73a6..0000000000
--- a/ext/session/php_session.h
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_SESSION_H
-#define PHP_SESSION_H
-
-#include "ext/standard/php_var.h"
-
-#define PHP_SESSION_API 20020330
-
-#define PS_OPEN_ARGS void **mod_data, const char *save_path, const char *session_name TSRMLS_DC
-#define PS_CLOSE_ARGS void **mod_data TSRMLS_DC
-#define PS_READ_ARGS void **mod_data, const char *key, char **val, int *vallen TSRMLS_DC
-#define PS_WRITE_ARGS void **mod_data, const char *key, const char *val, const int vallen TSRMLS_DC
-#define PS_DESTROY_ARGS void **mod_data, const char *key TSRMLS_DC
-#define PS_GC_ARGS void **mod_data, int maxlifetime, int *nrdels TSRMLS_DC
-#define PS_CREATE_SID_ARGS void **mod_data, int *newlen TSRMLS_DC
-
-/* default create id function */
-char *php_session_create_id(PS_CREATE_SID_ARGS);
-
-typedef struct ps_module_struct {
- const char *s_name;
- int (*s_open)(PS_OPEN_ARGS);
- int (*s_close)(PS_CLOSE_ARGS);
- int (*s_read)(PS_READ_ARGS);
- int (*s_write)(PS_WRITE_ARGS);
- int (*s_destroy)(PS_DESTROY_ARGS);
- int (*s_gc)(PS_GC_ARGS);
- char *(*s_create_sid)(PS_CREATE_SID_ARGS);
-} ps_module;
-
-#define PS_GET_MOD_DATA() *mod_data
-#define PS_SET_MOD_DATA(a) *mod_data = (a)
-
-#define PS_OPEN_FUNC(x) int ps_open_##x(PS_OPEN_ARGS)
-#define PS_CLOSE_FUNC(x) int ps_close_##x(PS_CLOSE_ARGS)
-#define PS_READ_FUNC(x) int ps_read_##x(PS_READ_ARGS)
-#define PS_WRITE_FUNC(x) int ps_write_##x(PS_WRITE_ARGS)
-#define PS_DESTROY_FUNC(x) int ps_delete_##x(PS_DESTROY_ARGS)
-#define PS_GC_FUNC(x) int ps_gc_##x(PS_GC_ARGS)
-#define PS_CREATE_SID_FUNC(x) char *ps_create_sid_##x(PS_CREATE_SID_ARGS)
-
-#define PS_FUNCS(x) \
- PS_OPEN_FUNC(x); \
- PS_CLOSE_FUNC(x); \
- PS_READ_FUNC(x); \
- PS_WRITE_FUNC(x); \
- PS_DESTROY_FUNC(x); \
- PS_GC_FUNC(x); \
- PS_CREATE_SID_FUNC(x)
-
-#define PS_MOD(x) \
- #x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \
- ps_delete_##x, ps_gc_##x, php_session_create_id
-
-/* SID enabled module handler definitions */
-#define PS_FUNCS_SID(x) \
- PS_OPEN_FUNC(x); \
- PS_CLOSE_FUNC(x); \
- PS_READ_FUNC(x); \
- PS_WRITE_FUNC(x); \
- PS_DESTROY_FUNC(x); \
- PS_GC_FUNC(x); \
- PS_CREATE_SID_FUNC(x)
-
-#define PS_MOD_SID(x) \
- #x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \
- ps_delete_##x, ps_gc_##x, ps_create_sid_##x
-
-typedef enum {
- php_session_disabled,
- php_session_none,
- php_session_active
-} php_session_status;
-
-typedef struct _php_ps_globals {
- char *save_path;
- char *session_name;
- char *id;
- char *extern_referer_chk;
- char *entropy_file;
- char *cache_limiter;
- long entropy_length;
- long cookie_lifetime;
- char *cookie_path;
- char *cookie_domain;
- zend_bool cookie_secure;
- ps_module *mod;
- void *mod_data;
- php_session_status session_status;
- long gc_probability;
- long gc_divisor;
- long gc_maxlifetime;
- int module_number;
- long cache_expire;
- zend_bool bug_compat; /* Whether to behave like PHP 4.2 and earlier */
- zend_bool bug_compat_warn; /* Whether to warn about it */
- const struct ps_serializer_struct *serializer;
- zval *http_session_vars;
- zend_bool auto_start;
- zend_bool use_cookies;
- zend_bool use_only_cookies;
- zend_bool use_trans_sid; /* contains the INI value of whether to use trans-sid */
- zend_bool apply_trans_sid; /* whether or not to enable trans-sid for the current request */
-
- long hash_func;
- long hash_bits_per_character;
- int send_cookie;
- int define_sid;
-} php_ps_globals;
-
-typedef php_ps_globals zend_ps_globals;
-
-extern zend_module_entry session_module_entry;
-#define phpext_session_ptr &session_module_entry
-
-PHP_FUNCTION(session_name);
-PHP_FUNCTION(session_module_name);
-PHP_FUNCTION(session_save_path);
-PHP_FUNCTION(session_id);
-PHP_FUNCTION(session_regenerate_id);
-PHP_FUNCTION(session_decode);
-PHP_FUNCTION(session_register);
-PHP_FUNCTION(session_unregister);
-PHP_FUNCTION(session_is_registered);
-PHP_FUNCTION(session_encode);
-PHP_FUNCTION(session_start);
-PHP_FUNCTION(session_destroy);
-PHP_FUNCTION(session_unset);
-PHP_FUNCTION(session_set_save_handler);
-PHP_FUNCTION(session_cache_expire);
-PHP_FUNCTION(session_cache_limiter);
-PHP_FUNCTION(session_set_cookie_params);
-PHP_FUNCTION(session_get_cookie_params);
-PHP_FUNCTION(session_write_close);
-
-#ifdef ZTS
-#define PS(v) TSRMG(ps_globals_id, php_ps_globals *, v)
-#else
-#define PS(v) (ps_globals.v)
-#endif
-
-#define PS_SERIALIZER_ENCODE_ARGS char **newstr, int *newlen TSRMLS_DC
-#define PS_SERIALIZER_DECODE_ARGS const char *val, int vallen TSRMLS_DC
-
-typedef struct ps_serializer_struct {
- const char *name;
- int (*encode)(PS_SERIALIZER_ENCODE_ARGS);
- int (*decode)(PS_SERIALIZER_DECODE_ARGS);
-} ps_serializer;
-
-#define PS_SERIALIZER_ENCODE_NAME(x) ps_srlzr_encode_##x
-#define PS_SERIALIZER_DECODE_NAME(x) ps_srlzr_decode_##x
-
-#define PS_SERIALIZER_ENCODE_FUNC(x) \
- int PS_SERIALIZER_ENCODE_NAME(x)(PS_SERIALIZER_ENCODE_ARGS)
-#define PS_SERIALIZER_DECODE_FUNC(x) \
- int PS_SERIALIZER_DECODE_NAME(x)(PS_SERIALIZER_DECODE_ARGS)
-
-#define PS_SERIALIZER_FUNCS(x) \
- PS_SERIALIZER_ENCODE_FUNC(x); \
- PS_SERIALIZER_DECODE_FUNC(x)
-
-#define PS_SERIALIZER_ENTRY(x) \
- { #x, PS_SERIALIZER_ENCODE_NAME(x), PS_SERIALIZER_DECODE_NAME(x) }
-
-PHPAPI void session_adapt_url(const char *, size_t, char **, size_t * TSRMLS_DC);
-
-void php_add_session_var(char *name, size_t namelen TSRMLS_DC);
-void php_set_session_var(char *name, size_t namelen, zval *state_val, php_unserialize_data_t *var_hash TSRMLS_DC);
-int php_get_session_var(char *name, size_t namelen, zval ***state_var TSRMLS_DC);
-
-PHPAPI int php_session_register_module(ps_module *);
-
-PHPAPI int php_session_register_serializer(const char *name,
- int (*encode)(PS_SERIALIZER_ENCODE_ARGS),
- int (*decode)(PS_SERIALIZER_DECODE_ARGS));
-
-PHPAPI void php_session_set_id(char *id TSRMLS_DC);
-PHPAPI void php_session_start(TSRMLS_D);
-
-#define PS_ADD_VARL(name,namelen) do { \
- php_add_session_var(name, namelen TSRMLS_CC); \
-} while (0)
-
-#define PS_ADD_VAR(name) PS_ADD_VARL(name, strlen(name))
-
-#define PS_DEL_VARL(name,namelen) do { \
- if (PS(http_session_vars)) { \
- zend_hash_del(Z_ARRVAL_P(PS(http_session_vars)), name, namelen+1); \
- } \
-} while (0)
-
-
-#define PS_ENCODE_VARS \
- char *key; \
- uint key_length; \
- ulong num_key; \
- zval **struc;
-
-#define PS_ENCODE_LOOP(code) \
- { \
- HashTable *_ht = Z_ARRVAL_P(PS(http_session_vars)); \
- \
- for (zend_hash_internal_pointer_reset(_ht); \
- zend_hash_get_current_key_ex(_ht, &key, &key_length, &num_key, 0, NULL) == HASH_KEY_IS_STRING; \
- zend_hash_move_forward(_ht)) { \
- key_length--; \
- if (php_get_session_var(key, key_length, &struc TSRMLS_CC) == SUCCESS) { \
- code; \
- } \
- } \
- }
-
-ZEND_EXTERN_MODULE_GLOBALS(ps);
-
-void php_session_auto_start(void *data);
-void php_session_shutdown(void *data);
-
-#endif
diff --git a/ext/session/session.c b/ext/session/session.c
deleted file mode 100644
index 04fa63a916..0000000000
--- a/ext/session/session.c
+++ /dev/null
@@ -1,1778 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- | Andrei Zmievski <andrei@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#else
-#include <sys/time.h>
-#endif
-
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "php_ini.h"
-#include "SAPI.h"
-#include "php_session.h"
-#include "ext/standard/md5.h"
-#include "ext/standard/sha1.h"
-#include "ext/standard/php_var.h"
-#include "ext/standard/datetime.h"
-#include "ext/standard/php_lcg.h"
-#include "ext/standard/url_scanner_ex.h"
-#include "ext/standard/php_rand.h" /* for RAND_MAX */
-#include "ext/standard/info.h"
-#include "ext/standard/php_smart_str.h"
-
-#include "mod_files.h"
-#include "mod_user.h"
-
-#ifdef HAVE_LIBMM
-#include "mod_mm.h"
-#endif
-
-/* {{{ session_functions[]
- */
-function_entry session_functions[] = {
- PHP_FE(session_name, NULL)
- PHP_FE(session_module_name, NULL)
- PHP_FE(session_save_path, NULL)
- PHP_FE(session_id, NULL)
- PHP_FE(session_regenerate_id, NULL)
- PHP_FE(session_decode, NULL)
- PHP_FE(session_register, NULL)
- PHP_FE(session_unregister, NULL)
- PHP_FE(session_is_registered, NULL)
- PHP_FE(session_encode, NULL)
- PHP_FE(session_start, NULL)
- PHP_FE(session_destroy, NULL)
- PHP_FE(session_unset, NULL)
- PHP_FE(session_set_save_handler, NULL)
- PHP_FE(session_cache_limiter, NULL)
- PHP_FE(session_cache_expire, NULL)
- PHP_FE(session_set_cookie_params, NULL)
- PHP_FE(session_get_cookie_params, NULL)
- PHP_FE(session_write_close, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-ZEND_DECLARE_MODULE_GLOBALS(ps);
-
-static ps_module *_php_find_ps_module(char *name TSRMLS_DC);
-static const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC);
-
-static PHP_INI_MH(OnUpdateSaveHandler)
-{
- if (PS(session_status) == php_session_active) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "A session is active. You cannot change the session module's ini settings at this time.");
- return FAILURE;
- }
- PS(mod) = _php_find_ps_module(new_value TSRMLS_CC);
-/*
- * Following lines are commented out to prevent bogus error message at
- * start up. i.e. Save handler modules are not initilzied before Session
- * module.
- */
-
-#if 0
- if(!PS(mod)) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot find save handler %s", new_value);
- }
-#endif
- return SUCCESS;
-}
-
-static PHP_INI_MH(OnUpdateSerializer)
-{
- if (PS(session_status) == php_session_active) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "A session is active. You cannot change the session module's ini settings at this time.");
- return FAILURE;
- }
- PS(serializer) = _php_find_ps_serializer(new_value TSRMLS_CC);
-/*
- * Following lines are commented out to prevent bogus error message at
- * start up. i.e. Serializer modules are not initilzied before Session
- * module.
- */
-
-#if 0
- if(!PS(serializer)) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot find serialization handler %s", new_value);
- }
-#endif
- return SUCCESS;
-}
-
-
-/* {{{ PHP_INI
- */
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("session.bug_compat_42", "1", PHP_INI_ALL, OnUpdateBool, bug_compat, php_ps_globals, ps_globals)
- STD_PHP_INI_BOOLEAN("session.bug_compat_warn", "1", PHP_INI_ALL, OnUpdateBool, bug_compat_warn, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.save_path", "/tmp", PHP_INI_ALL, OnUpdateString, save_path, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.name", "PHPSESSID", PHP_INI_ALL, OnUpdateString, session_name, php_ps_globals, ps_globals)
- PHP_INI_ENTRY("session.save_handler", "files", PHP_INI_ALL, OnUpdateSaveHandler)
- STD_PHP_INI_BOOLEAN("session.auto_start", "0", PHP_INI_ALL, OnUpdateBool, auto_start, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.gc_probability", "1", PHP_INI_ALL, OnUpdateLong, gc_probability, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.gc_divisor", "100", PHP_INI_ALL, OnUpdateLong, gc_divisor, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.gc_maxlifetime", "1440", PHP_INI_ALL, OnUpdateLong, gc_maxlifetime, php_ps_globals, ps_globals)
- PHP_INI_ENTRY("session.serialize_handler", "php", PHP_INI_ALL, OnUpdateSerializer)
- STD_PHP_INI_ENTRY("session.cookie_lifetime", "0", PHP_INI_ALL, OnUpdateLong, cookie_lifetime, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.cookie_path", "/", PHP_INI_ALL, OnUpdateString, cookie_path, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.cookie_domain", "", PHP_INI_ALL, OnUpdateString, cookie_domain, php_ps_globals, ps_globals)
- STD_PHP_INI_BOOLEAN("session.cookie_secure", "", PHP_INI_ALL, OnUpdateBool, cookie_secure, php_ps_globals, ps_globals)
- STD_PHP_INI_BOOLEAN("session.use_cookies", "1", PHP_INI_ALL, OnUpdateBool, use_cookies, php_ps_globals, ps_globals)
- STD_PHP_INI_BOOLEAN("session.use_only_cookies", "0", PHP_INI_ALL, OnUpdateBool, use_only_cookies, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.referer_check", "", PHP_INI_ALL, OnUpdateString, extern_referer_chk, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.entropy_file", "", PHP_INI_ALL, OnUpdateString, entropy_file, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.entropy_length", "0", PHP_INI_ALL, OnUpdateLong, entropy_length, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.cache_limiter", "nocache", PHP_INI_ALL, OnUpdateString, cache_limiter, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.cache_expire", "180", PHP_INI_ALL, OnUpdateLong, cache_expire, php_ps_globals, ps_globals)
- STD_PHP_INI_BOOLEAN("session.use_trans_sid", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, use_trans_sid, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.hash_function", "0", PHP_INI_ALL, OnUpdateLong, hash_func, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.hash_bits_per_character", "4", PHP_INI_ALL, OnUpdateLong, hash_bits_per_character, php_ps_globals, ps_globals)
-
- /* Commented out until future discussion */
- /* PHP_INI_ENTRY("session.encode_sources", "globals,track", PHP_INI_ALL, NULL) */
-PHP_INI_END()
-/* }}} */
-
-PS_SERIALIZER_FUNCS(php);
-PS_SERIALIZER_FUNCS(php_binary);
-
-#define MAX_SERIALIZERS 10
-
-static ps_serializer ps_serializers[MAX_SERIALIZERS + 1] = {
- PS_SERIALIZER_ENTRY(php),
- PS_SERIALIZER_ENTRY(php_binary)
-};
-
-#define MAX_MODULES 10
-
-static ps_module *ps_modules[MAX_MODULES + 1] = {
- ps_files_ptr,
- ps_user_ptr
-};
-
-#define IF_SESSION_VARS() \
- if (PS(http_session_vars) && PS(http_session_vars)->type == IS_ARRAY)
-
-PHPAPI int php_session_register_serializer(const char *name,
- int (*encode)(PS_SERIALIZER_ENCODE_ARGS),
- int (*decode)(PS_SERIALIZER_DECODE_ARGS))
-{
- int ret = -1;
- int i;
-
- for (i = 0; i < MAX_SERIALIZERS; i++) {
- if (ps_serializers[i].name == NULL) {
- ps_serializers[i].name = name;
- ps_serializers[i].encode = encode;
- ps_serializers[i].decode = decode;
- ps_serializers[i + 1].name = NULL;
- ret = 0;
- break;
- }
- }
-
- return ret;
-}
-
-PHPAPI int php_session_register_module(ps_module *ptr)
-{
- int ret = -1;
- int i;
-
- for (i = 0; i < MAX_MODULES; i++) {
- if (!ps_modules[i]) {
- ps_modules[i] = ptr;
- ret = 0;
- break;
- }
- }
-
- return ret;
-}
-
-PHP_MINIT_FUNCTION(session);
-PHP_RINIT_FUNCTION(session);
-PHP_MSHUTDOWN_FUNCTION(session);
-PHP_RSHUTDOWN_FUNCTION(session);
-PHP_MINFO_FUNCTION(session);
-
-static void php_rinit_session_globals(TSRMLS_D);
-static void php_rshutdown_session_globals(TSRMLS_D);
-static zend_bool php_session_destroy(TSRMLS_D);
-
-zend_module_entry session_module_entry = {
- STANDARD_MODULE_HEADER,
- "session",
- session_functions,
- PHP_MINIT(session), PHP_MSHUTDOWN(session),
- PHP_RINIT(session), PHP_RSHUTDOWN(session),
- PHP_MINFO(session),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_SESSION
-ZEND_GET_MODULE(session)
-#endif
-
-typedef struct {
- char *name;
- void (*func)(TSRMLS_D);
-} php_session_cache_limiter_t;
-
-#define CACHE_LIMITER(name) _php_cache_limiter_##name
-#define CACHE_LIMITER_FUNC(name) static void CACHE_LIMITER(name)(TSRMLS_D)
-#define CACHE_LIMITER_ENTRY(name) { #name, CACHE_LIMITER(name) },
-
-#define ADD_HEADER(a) sapi_add_header(a, strlen(a), 1);
-
-#define MAX_STR 512
-
-void php_add_session_var(char *name, size_t namelen TSRMLS_DC)
-{
- zval **sym_track = NULL;
-
- zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name, namelen + 1,
- (void *) &sym_track);
-
- /*
- * Set up a proper reference between $_SESSION["x"] and $x.
- */
-
- if (PG(register_globals)) {
- zval **sym_global = NULL;
-
- zend_hash_find(&EG(symbol_table), name, namelen + 1,
- (void *) &sym_global);
-
- if (sym_global == NULL && sym_track == NULL) {
- zval *empty_var;
-
- ALLOC_INIT_ZVAL(empty_var); /* this sets refcount to 1 */
- ZVAL_DELREF(empty_var); /* our module does not maintain a ref */
- /* The next call will increase refcount by NR_OF_SYM_TABLES==2 */
- zend_set_hash_symbol(empty_var, name, namelen, 1, 2, Z_ARRVAL_P(PS(http_session_vars)), &EG(symbol_table));
- } else if (sym_global == NULL) {
- zend_set_hash_symbol(*sym_track, name, namelen, 1, 1, &EG(symbol_table));
- } else if (sym_track == NULL) {
- zend_set_hash_symbol(*sym_global, name, namelen, 1, 1, Z_ARRVAL_P(PS(http_session_vars)));
- }
- } else {
- if (sym_track == NULL) {
- zval *empty_var;
-
- ALLOC_INIT_ZVAL(empty_var);
- ZEND_SET_SYMBOL_WITH_LENGTH(Z_ARRVAL_P(PS(http_session_vars)), name, namelen+1, empty_var, 1, 0);
- }
- }
-}
-
-void php_set_session_var(char *name, size_t namelen, zval *state_val, php_unserialize_data_t *var_hash TSRMLS_DC)
-{
- if (PG(register_globals)) {
- zval **old_symbol;
- if (zend_hash_find(&EG(symbol_table),name,namelen+1,(void *)&old_symbol) == SUCCESS) {
- /*
- There was an old one, we need to replace it accurately.
- hash_update in zend_set_hash_symbol is not good, because
- it will leave referenced variables (such as local instances
- of a global variable) dangling.
-
- BTW: if you use register_globals references between
- session-vars won't work because of this very reason!
- */
-
-
- REPLACE_ZVAL_VALUE(old_symbol,state_val,1);
-
- /* the following line will muck with the reference-table used for
- * unserialisation
- */
-
- PHP_VAR_UNSERIALIZE_ZVAL_CHANGED(var_hash,state_val,*old_symbol);
-
- zend_set_hash_symbol(*old_symbol, name, namelen, 1, 1, Z_ARRVAL_P(PS(http_session_vars)));
- } else {
- zend_set_hash_symbol(state_val, name, namelen, 1, 2, Z_ARRVAL_P(PS(http_session_vars)), &EG(symbol_table));
- }
- } else IF_SESSION_VARS() {
- zend_set_hash_symbol(state_val, name, namelen, 0, 1, Z_ARRVAL_P(PS(http_session_vars)));
- }
-}
-
-int php_get_session_var(char *name, size_t namelen, zval ***state_var TSRMLS_DC)
-{
- int ret = FAILURE;
-
- IF_SESSION_VARS() {
- ret = zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name,
- namelen+1, (void **) state_var);
-
- /*
- * If register_globals is enabled, and
- * if there is an entry for the slot in $_SESSION, and
- * if that entry is still set to NULL, and
- * if the global var exists, then
- * we prefer the same key in the global sym table
- */
-
- if (PG(register_globals) && ret == SUCCESS
- && Z_TYPE_PP(*state_var) == IS_NULL) {
- zval **tmp;
-
- if (zend_hash_find(&EG(symbol_table), name, namelen + 1,
- (void **) &tmp) == SUCCESS) {
- *state_var = tmp;
- }
- }
- }
-
- return ret;
-}
-
-#define PS_BIN_NR_OF_BITS 8
-#define PS_BIN_UNDEF (1<<(PS_BIN_NR_OF_BITS-1))
-#define PS_BIN_MAX (PS_BIN_UNDEF-1)
-
-PS_SERIALIZER_ENCODE_FUNC(php_binary)
-{
- smart_str buf = {0};
- php_serialize_data_t var_hash;
- PS_ENCODE_VARS;
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
-
- PS_ENCODE_LOOP(
- if (key_length > PS_BIN_MAX) continue;
- smart_str_appendc(&buf, (unsigned char) key_length);
- smart_str_appendl(&buf, key, key_length);
-
- php_var_serialize(&buf, struc, &var_hash TSRMLS_CC);
- } else {
- if (key_length > PS_BIN_MAX) continue;
- smart_str_appendc(&buf, (unsigned char) (key_length & PS_BIN_UNDEF));
- smart_str_appendl(&buf, key, key_length);
- );
-
- if (newlen) *newlen = buf.len;
- *newstr = buf.c;
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- return SUCCESS;
-}
-
-PS_SERIALIZER_DECODE_FUNC(php_binary)
-{
- const char *p;
- char *name;
- const char *endptr = val + vallen;
- zval *current;
- int namelen;
- int has_value;
- php_unserialize_data_t var_hash;
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
-
- for (p = val; p < endptr; ) {
- namelen = *p & (~PS_BIN_UNDEF);
- has_value = *p & PS_BIN_UNDEF ? 0 : 1;
-
- name = estrndup(p + 1, namelen);
-
- p += namelen + 1;
-
- if (has_value) {
- MAKE_STD_ZVAL(current);
- if (php_var_unserialize(&current, &p, endptr, &var_hash TSRMLS_CC)) {
- php_set_session_var(name, namelen, current, &var_hash TSRMLS_CC);
- }
- zval_ptr_dtor(&current);
- }
- PS_ADD_VARL(name, namelen);
- efree(name);
- }
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- return SUCCESS;
-}
-
-#define PS_DELIMITER '|'
-#define PS_UNDEF_MARKER '!'
-
-PS_SERIALIZER_ENCODE_FUNC(php)
-{
- smart_str buf = {0};
- php_serialize_data_t var_hash;
- PS_ENCODE_VARS;
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
-
- PS_ENCODE_LOOP(
- smart_str_appendl(&buf, key, (unsigned char) key_length);
- smart_str_appendc(&buf, PS_DELIMITER);
-
- php_var_serialize(&buf, struc, &var_hash TSRMLS_CC);
- } else {
- smart_str_appendc(&buf, PS_UNDEF_MARKER);
- smart_str_appendl(&buf, key, key_length);
- smart_str_appendc(&buf, PS_DELIMITER);
- );
-
- if (newlen) *newlen = buf.len;
- *newstr = buf.c;
-
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
- return SUCCESS;
-}
-
-PS_SERIALIZER_DECODE_FUNC(php)
-{
- const char *p, *q;
- char *name;
- const char *endptr = val + vallen;
- zval *current;
- int namelen;
- int has_value;
- php_unserialize_data_t var_hash;
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
-
- p = val;
-
- while (p < endptr) {
- q = p;
- while (*q != PS_DELIMITER)
- if (++q >= endptr) goto break_outer_loop;
-
- if (p[0] == PS_UNDEF_MARKER) {
- p++;
- has_value = 0;
- } else {
- has_value = 1;
- }
-
- namelen = q - p;
- name = estrndup(p, namelen);
- q++;
-
- if (has_value) {
- MAKE_STD_ZVAL(current);
- if (php_var_unserialize(&current, &q, endptr, &var_hash TSRMLS_CC)) {
- php_set_session_var(name, namelen, current, &var_hash TSRMLS_CC);
- }
- zval_ptr_dtor(&current);
- }
- PS_ADD_VARL(name, namelen);
- efree(name);
-
- p = q;
- }
-break_outer_loop:
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- return SUCCESS;
-}
-
-static void php_session_track_init(TSRMLS_D)
-{
- /* Unconditionally destroy existing arrays -- possible dirty data */
- zend_hash_del(&EG(symbol_table), "HTTP_SESSION_VARS",
- sizeof("HTTP_SESSION_VARS"));
- zend_hash_del(&EG(symbol_table), "_SESSION", sizeof("_SESSION"));
-
- MAKE_STD_ZVAL(PS(http_session_vars));
- array_init(PS(http_session_vars));
-
- ZEND_SET_GLOBAL_VAR_WITH_LENGTH("HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS"), PS(http_session_vars), 2, 1);
- ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 2, 1);
-}
-
-static char *php_session_encode(int *newlen TSRMLS_DC)
-{
- char *ret = NULL;
-
- IF_SESSION_VARS() {
- if (PS(serializer)->encode(&ret, newlen TSRMLS_CC) == FAILURE)
- ret = NULL;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot encode non-existent session.");
- }
-
- return ret;
-}
-
-static void php_session_decode(const char *val, int vallen TSRMLS_DC)
-{
- if (PS(serializer)->decode(val, vallen TSRMLS_CC) == FAILURE) {
- php_session_destroy(TSRMLS_C);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to decode session object. Session has been destroyed.");
- }
-}
-
-
-/*
- * Note that we cannot use the BASE64 alphabet here, because
- * it contains "/" and "+": both are unacceptable for simple inclusion
- * into URLs.
- */
-
-static char hexconvtab[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,-";
-
-enum {
- PS_HASH_FUNC_MD5,
- PS_HASH_FUNC_SHA1
-};
-
-/* returns a pointer to the byte after the last valid character in out */
-static char *bin_to_readable(char *in, size_t inlen, char *out, char nbits)
-{
- unsigned char *p, *q;
- unsigned short w;
- int mask;
- int have;
-
- p = in;
- q = in + inlen;
-
- w = 0;
- have = 0;
- mask = (1 << nbits) - 1;
-
- while (1) {
- if (have < nbits) {
- if (p < q) {
- w |= *p++ << have;
- have += 8;
- } else {
- /* consumed everything? */
- if (have == 0) break;
- /* No? We need a final round */
- have = nbits;
- }
- }
-
- /* consume nbits */
- *out++ = hexconvtab[w & mask];
- w >>= nbits;
- have -= nbits;
- }
-
- *out = '\0';
- return out;
-}
-
-char *php_session_create_id(PS_CREATE_SID_ARGS)
-{
- PHP_MD5_CTX md5_context;
- PHP_SHA1_CTX sha1_context;
- unsigned char digest[21];
- int digest_len;
- int j;
- char *buf;
- struct timeval tv;
- zval **array;
- zval **token;
- char *remote_addr = NULL;
-
- gettimeofday(&tv, NULL);
-
- if (zend_hash_find(&EG(symbol_table), "_SERVER",
- sizeof("_SERVER"), (void **) &array) == SUCCESS &&
- Z_TYPE_PP(array) == IS_ARRAY &&
- zend_hash_find(Z_ARRVAL_PP(array), "REMOTE_ADDR",
- sizeof("REMOTE_ADDR"), (void **) &token) == SUCCESS) {
- remote_addr = Z_STRVAL_PP(token);
- }
-
- buf = emalloc(100);
-
- /* maximum 15+19+19+10 bytes */
- sprintf(buf, "%.15s%ld%ld%0.8f", remote_addr ? remote_addr : "",
- tv.tv_sec, tv.tv_usec, php_combined_lcg(TSRMLS_C) * 10);
-
- switch (PS(hash_func)) {
- case PS_HASH_FUNC_MD5:
- PHP_MD5Init(&md5_context);
- PHP_MD5Update(&md5_context, buf, strlen(buf));
- digest_len = 16;
- break;
- case PS_HASH_FUNC_SHA1:
- PHP_SHA1Init(&sha1_context);
- PHP_SHA1Update(&sha1_context, buf, strlen(buf));
- digest_len = 20;
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid session hash function");
- efree(buf);
- return NULL;
- }
-
- if (PS(entropy_length) > 0) {
- int fd;
-
- fd = VCWD_OPEN(PS(entropy_file), O_RDONLY);
- if (fd >= 0) {
- unsigned char rbuf[2048];
- int n;
- int to_read = PS(entropy_length);
-
- while (to_read > 0) {
- n = read(fd, rbuf, MIN(to_read, sizeof(rbuf)));
- if (n <= 0) break;
-
- switch (PS(hash_func)) {
- case PS_HASH_FUNC_MD5:
- PHP_MD5Update(&md5_context, rbuf, n);
- break;
- case PS_HASH_FUNC_SHA1:
- PHP_SHA1Update(&sha1_context, rbuf, n);
- break;
- }
- to_read -= n;
- }
- close(fd);
- }
- }
-
- switch (PS(hash_func)) {
- case PS_HASH_FUNC_MD5:
- PHP_MD5Final(digest, &md5_context);
- break;
- case PS_HASH_FUNC_SHA1:
- PHP_SHA1Final(digest, &sha1_context);
- break;
- }
-
- if (PS(hash_bits_per_character) < 4
- || PS(hash_bits_per_character) > 6) {
- PS(hash_bits_per_character) = 4;
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The ini setting hash_bits_per_character is out of range (should be 4, 5, or 6) - using 4 for now");
- }
- j = (int) (bin_to_readable(digest, digest_len, buf, PS(hash_bits_per_character)) - buf);
-
- if (newlen)
- *newlen = j;
- return buf;
-}
-
-static void php_session_initialize(TSRMLS_D)
-{
- char *val;
- int vallen;
-
- if (!PS(mod)) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to initialize session module.");
- return;
- }
-
- /* Open session handler first */
- if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name) TSRMLS_CC) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to initialize session module");
- return;
- }
-
- /* If there is no ID, use session module to create one */
- if (!PS(id))
- PS(id) = PS(mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC);
-
- /* Read data */
- /* Question: if you create a SID here, should you also try to read data?
- * I'm not sure, but while not doing so will remove one session operation
- * it could prove usefull for those sites which wish to have "default"
- * session information
- */
- php_session_track_init(TSRMLS_C);
- if (PS(mod)->s_read(&PS(mod_data), PS(id), &val, &vallen TSRMLS_CC) == SUCCESS) {
- php_session_decode(val, vallen TSRMLS_CC);
- efree(val);
- }
-}
-
-static int migrate_global(HashTable *ht, HashPosition *pos TSRMLS_DC)
-{
- char *str;
- uint str_len;
- ulong num_key;
- int n;
- zval **val = NULL;
- int ret = 0;
-
- n = zend_hash_get_current_key_ex(ht, &str, &str_len, &num_key, 0, pos);
-
- switch (n) {
- case HASH_KEY_IS_STRING:
- zend_hash_find(&EG(symbol_table), str, str_len, (void **) &val);
- if (val) {
- ZEND_SET_SYMBOL_WITH_LENGTH(ht, str, str_len, *val, (*val)->refcount + 1 , 1);
- ret = 1;
- }
- break;
- case HASH_KEY_IS_LONG:
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "The session bug compatibility code will not "
- "try to locate the global variable $%d due to its "
- "numeric nature.", num_key);
- break;
- }
-
- return ret;
-}
-
-static void php_session_save_current_state(TSRMLS_D)
-{
- int ret = FAILURE;
-
- IF_SESSION_VARS() {
- if (PS(bug_compat) && !PG(register_globals)) {
- HashTable *ht = Z_ARRVAL_P(PS(http_session_vars));
- HashPosition pos;
- zval **val;
- int do_warn = 0;
-
- zend_hash_internal_pointer_reset_ex(ht, &pos);
-
- while (zend_hash_get_current_data_ex(ht,
- (void **) &val, &pos) != FAILURE) {
- if (Z_TYPE_PP(val) == IS_NULL) {
- if (migrate_global(ht, &pos TSRMLS_CC))
- do_warn = 1;
- }
- zend_hash_move_forward_ex(ht, &pos);
- }
-
- if (do_warn && PS(bug_compat_warn)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively.");
- }
- }
-
- if (PS(mod_data)) {
- char *val;
- int vallen;
-
- val = php_session_encode(&vallen TSRMLS_CC);
- if (val) {
- ret = PS(mod)->s_write(&PS(mod_data), PS(id), val, vallen TSRMLS_CC);
- efree(val);
- } else {
- ret = PS(mod)->s_write(&PS(mod_data), PS(id), "", 0 TSRMLS_CC);
- }
- }
-
- if (ret == FAILURE)
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write session data (%s). Please "
- "verify that the current setting of session.save_path "
- "is correct (%s)",
- PS(mod)->s_name,
- PS(save_path));
- }
-
- if (PS(mod_data))
- PS(mod)->s_close(&PS(mod_data) TSRMLS_CC);
-}
-
-static char *month_names[] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-};
-
-static char *week_days[] = {
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"
-};
-
-static void strcpy_gmt(char *ubuf, time_t *when)
-{
- char buf[MAX_STR];
- struct tm tm;
- int n;
-
- php_gmtime_r(when, &tm);
-
- n = sprintf(buf, "%s, %d %s %d %02d:%02d:%02d GMT", /* SAFE */
- week_days[tm.tm_wday], tm.tm_mday,
- month_names[tm.tm_mon], tm.tm_year + 1900,
- tm.tm_hour, tm.tm_min,
- tm.tm_sec);
- memcpy(ubuf, buf, n);
- ubuf[n] = '\0';
-}
-
-static void last_modified(TSRMLS_D)
-{
- const char *path;
- struct stat sb;
- char buf[MAX_STR + 1];
-
- path = SG(request_info).path_translated;
- if (path) {
- if (VCWD_STAT(path, &sb) == -1) {
- return;
- }
-
-#define LAST_MODIFIED "Last-Modified: "
- memcpy(buf, LAST_MODIFIED, sizeof(LAST_MODIFIED) - 1);
- strcpy_gmt(buf + sizeof(LAST_MODIFIED) - 1, &sb.st_mtime);
- ADD_HEADER(buf);
- }
-}
-
-CACHE_LIMITER_FUNC(public)
-{
- char buf[MAX_STR + 1];
- struct timeval tv;
- time_t now;
-
- gettimeofday(&tv, NULL);
- now = tv.tv_sec + PS(cache_expire) * 60;
-#define EXPIRES "Expires: "
- memcpy(buf, EXPIRES, sizeof(EXPIRES) - 1);
- strcpy_gmt(buf + sizeof(EXPIRES) - 1, &now);
- ADD_HEADER(buf);
-
- sprintf(buf, "Cache-Control: public, max-age=%ld", PS(cache_expire) * 60); /* SAFE */
- ADD_HEADER(buf);
-
- last_modified(TSRMLS_C);
-}
-
-CACHE_LIMITER_FUNC(private_no_expire)
-{
- char buf[MAX_STR + 1];
-
- sprintf(buf, "Cache-Control: private, max-age=%ld, pre-check=%ld", PS(cache_expire) * 60, PS(cache_expire) * 60); /* SAFE */
- ADD_HEADER(buf);
-
- last_modified(TSRMLS_C);
-}
-
-CACHE_LIMITER_FUNC(private)
-{
- ADD_HEADER("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
- CACHE_LIMITER(private_no_expire)(TSRMLS_C);
-}
-
-CACHE_LIMITER_FUNC(nocache)
-{
- ADD_HEADER("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
- /* For HTTP/1.1 conforming clients and the rest (MSIE 5) */
- ADD_HEADER("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
- /* For HTTP/1.0 conforming clients */
- ADD_HEADER("Pragma: no-cache");
-}
-
-static php_session_cache_limiter_t php_session_cache_limiters[] = {
- CACHE_LIMITER_ENTRY(public)
- CACHE_LIMITER_ENTRY(private)
- CACHE_LIMITER_ENTRY(private_no_expire)
- CACHE_LIMITER_ENTRY(nocache)
- {0}
-};
-
-static int php_session_cache_limiter(TSRMLS_D)
-{
- php_session_cache_limiter_t *lim;
-
- if (PS(cache_limiter)[0] == '\0') return 0;
-
- if (SG(headers_sent)) {
- char *output_start_filename = php_get_output_start_filename(TSRMLS_C);
- int output_start_lineno = php_get_output_start_lineno(TSRMLS_C);
-
- if (output_start_filename) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot send session cache limiter - headers already sent (output started at %s:%d)",
- output_start_filename, output_start_lineno);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot send session cache limiter - headers already sent");
- }
- return -2;
- }
-
- for (lim = php_session_cache_limiters; lim->name; lim++) {
- if (!strcasecmp(lim->name, PS(cache_limiter))) {
- lim->func(TSRMLS_C);
- return 0;
- }
- }
-
- return -1;
-}
-
-#define COOKIE_SET_COOKIE "Set-Cookie: "
-#define COOKIE_EXPIRES "; expires="
-#define COOKIE_PATH "; path="
-#define COOKIE_DOMAIN "; domain="
-#define COOKIE_SECURE "; secure"
-
-static void php_session_send_cookie(TSRMLS_D)
-{
- smart_str ncookie = {0};
- char *date_fmt = NULL;
-
- if (SG(headers_sent)) {
- char *output_start_filename = php_get_output_start_filename(TSRMLS_C);
- int output_start_lineno = php_get_output_start_lineno(TSRMLS_C);
-
- if (output_start_filename) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot send session cookie - headers already sent by (output started at %s:%d)",
- output_start_filename, output_start_lineno);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot send session cookie - headers already sent");
- }
- return;
- }
-
- smart_str_appends(&ncookie, COOKIE_SET_COOKIE);
- smart_str_appends(&ncookie, PS(session_name));
- smart_str_appendc(&ncookie, '=');
- smart_str_appends(&ncookie, PS(id));
-
- if (PS(cookie_lifetime) > 0) {
- struct timeval tv;
-
- gettimeofday(&tv, NULL);
- date_fmt = php_std_date(tv.tv_sec + PS(cookie_lifetime) TSRMLS_CC);
-
- smart_str_appends(&ncookie, COOKIE_EXPIRES);
- smart_str_appends(&ncookie, date_fmt);
- efree(date_fmt);
- }
-
- if (PS(cookie_path)[0]) {
- smart_str_appends(&ncookie, COOKIE_PATH);
- smart_str_appends(&ncookie, PS(cookie_path));
- }
-
- if (PS(cookie_domain)[0]) {
- smart_str_appends(&ncookie, COOKIE_DOMAIN);
- smart_str_appends(&ncookie, PS(cookie_domain));
- }
-
- if (PS(cookie_secure)) {
- smart_str_appends(&ncookie, COOKIE_SECURE);
- }
-
- smart_str_0(&ncookie);
-
- sapi_add_header_ex(ncookie.c, ncookie.len, 0, 0 TSRMLS_CC);
-}
-
-static ps_module *_php_find_ps_module(char *name TSRMLS_DC)
-{
- ps_module *ret = NULL;
- ps_module **mod;
- int i;
-
- for (i = 0, mod = ps_modules; i < MAX_MODULES; i++, mod++)
- if (*mod && !strcasecmp(name, (*mod)->s_name)) {
- ret = *mod;
- break;
- }
-
- return ret;
-}
-
-static const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC)
-{
- const ps_serializer *ret = NULL;
- const ps_serializer *mod;
-
- for (mod = ps_serializers; mod->name; mod++)
- if (!strcasecmp(name, mod->name)) {
- ret = mod;
- break;
- }
-
- return ret;
-}
-
-#define PPID2SID \
- convert_to_string((*ppid)); \
- PS(id) = estrndup(Z_STRVAL_PP(ppid), Z_STRLEN_PP(ppid))
-
-static void php_session_reset_id(TSRMLS_D)
-{
- int module_number = PS(module_number);
-
- if (PS(send_cookie)) {
- php_session_send_cookie(TSRMLS_C);
- }
-
- /* if the SID constant exists, destroy it. */
- zend_hash_del(EG(zend_constants), "sid", sizeof("sid"));
-
- if (PS(define_sid)) {
- smart_str var = {0};
-
- smart_str_appends(&var, PS(session_name));
- smart_str_appendc(&var, '=');
- smart_str_appends(&var, PS(id));
- smart_str_0(&var);
- REGISTER_STRINGL_CONSTANT("SID", var.c, var.len, 0);
- } else {
- REGISTER_STRINGL_CONSTANT("SID", empty_string, 0, 0);
- }
-
- if (PS(apply_trans_sid)) {
- php_url_scanner_reset_vars(TSRMLS_C);
- php_url_scanner_add_var(PS(session_name), strlen(PS(session_name)), PS(id), strlen(PS(id)), 1 TSRMLS_CC);
- }
-}
-
-PHPAPI void php_session_start(TSRMLS_D)
-{
- zval **ppid;
- zval **data;
- char *p;
- int nrand;
- int lensess;
-
- PS(apply_trans_sid) = PS(use_trans_sid);
-
- PS(define_sid) = 1;
- PS(send_cookie) = 1;
- if (PS(session_status) != php_session_none)
- return;
-
- lensess = strlen(PS(session_name));
-
-
- /*
- * Cookies are preferred, because initially
- * cookie and get variables will be available.
- */
-
- if (!PS(id)) {
- if (zend_hash_find(&EG(symbol_table), "_COOKIE",
- sizeof("_COOKIE"), (void **) &data) == SUCCESS &&
- Z_TYPE_PP(data) == IS_ARRAY &&
- zend_hash_find(Z_ARRVAL_PP(data), PS(session_name),
- lensess + 1, (void **) &ppid) == SUCCESS) {
- PPID2SID;
- PS(apply_trans_sid) = 0;
- PS(send_cookie) = 0;
- PS(define_sid) = 0;
- }
-
- if (!PS(use_only_cookies) && !PS(id) &&
- zend_hash_find(&EG(symbol_table), "_GET",
- sizeof("_GET"), (void **) &data) == SUCCESS &&
- Z_TYPE_PP(data) == IS_ARRAY &&
- zend_hash_find(Z_ARRVAL_PP(data), PS(session_name),
- lensess + 1, (void **) &ppid) == SUCCESS) {
- PPID2SID;
- PS(send_cookie) = 0;
- }
-
- if (!PS(use_only_cookies) && !PS(id) &&
- zend_hash_find(&EG(symbol_table), "_POST",
- sizeof("_POST"), (void **) &data) == SUCCESS &&
- Z_TYPE_PP(data) == IS_ARRAY &&
- zend_hash_find(Z_ARRVAL_PP(data), PS(session_name),
- lensess + 1, (void **) &ppid) == SUCCESS) {
- PPID2SID;
- PS(send_cookie) = 0;
- }
- }
-
- /* check the REQUEST_URI symbol for a string of the form
- '<session-name>=<session-id>' to allow URLs of the form
- http://yoursite/<session-name>=<session-id>/script.php */
-
- if (!PS(use_only_cookies) && !PS(id) &&
- zend_hash_find(&EG(symbol_table), "REQUEST_URI",
- sizeof("REQUEST_URI"), (void **) &data) == SUCCESS &&
- Z_TYPE_PP(data) == IS_STRING &&
- (p = strstr(Z_STRVAL_PP(data), PS(session_name))) &&
- p[lensess] == '=') {
- char *q;
-
- p += lensess + 1;
- if ((q = strpbrk(p, "/?\\")))
- PS(id) = estrndup(p, q - p);
- }
-
- /* check whether the current request was referred to by
- an external site which invalidates the previously found id */
-
- if (PS(id) &&
- PS(extern_referer_chk)[0] != '\0' &&
- zend_hash_find(&EG(symbol_table), "HTTP_REFERER",
- sizeof("HTTP_REFERER"), (void **) &data) == SUCCESS &&
- Z_TYPE_PP(data) == IS_STRING &&
- Z_STRLEN_PP(data) != 0 &&
- strstr(Z_STRVAL_PP(data), PS(extern_referer_chk)) == NULL) {
- efree(PS(id));
- PS(id) = NULL;
- PS(send_cookie) = 1;
- if (PS(use_trans_sid))
- PS(apply_trans_sid) = 1;
- }
-
- php_session_initialize(TSRMLS_C);
-
- if (!PS(use_cookies) && PS(send_cookie)) {
- if (PS(use_trans_sid))
- PS(apply_trans_sid) = 1;
- PS(send_cookie) = 0;
- }
-
- php_session_reset_id(TSRMLS_C);
-
- PS(session_status) = php_session_active;
-
- php_session_cache_limiter(TSRMLS_C);
-
- if (PS(mod_data) && PS(gc_probability) > 0) {
- int nrdels = -1;
-
- nrand = (int) ((float) PS(gc_divisor) * php_combined_lcg(TSRMLS_C));
- if (nrand < PS(gc_probability)) {
- PS(mod)->s_gc(&PS(mod_data), PS(gc_maxlifetime), &nrdels TSRMLS_CC);
-#if 0
- if (nrdels != -1)
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "purged %d expired session objects\n", nrdels);
-#endif
- }
- }
-}
-
-static zend_bool php_session_destroy(TSRMLS_D)
-{
- zend_bool retval = SUCCESS;
-
- if (PS(session_status) != php_session_active) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to destroy uninitialized session");
- return FAILURE;
- }
-
- if (PS(mod)->s_destroy(&PS(mod_data), PS(id) TSRMLS_CC) == FAILURE) {
- retval = FAILURE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session object destruction failed");
- }
-
- php_rshutdown_session_globals(TSRMLS_C);
- php_rinit_session_globals(TSRMLS_C);
-
- return retval;
-}
-
-
-/* {{{ proto void session_set_cookie_params(int lifetime [, string path [, string domain [, bool secure]]])
- Set session cookie parameters */
-PHP_FUNCTION(session_set_cookie_params)
-{
- zval **lifetime, **path, **domain, **secure;
-
- if (!PS(use_cookies))
- return;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 4 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &lifetime, &path, &domain, &secure) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(lifetime);
- PS(cookie_lifetime) = Z_LVAL_PP(lifetime);
-
- if (ZEND_NUM_ARGS() > 1) {
- convert_to_string_ex(path);
- zend_alter_ini_entry("session.cookie_path", sizeof("session.cookie_path"), Z_STRVAL_PP(path), Z_STRLEN_PP(path), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
-
- if (ZEND_NUM_ARGS() > 2) {
- convert_to_string_ex(domain);
- zend_alter_ini_entry("session.cookie_domain", sizeof("session.cookie_domain"), Z_STRVAL_PP(domain), Z_STRLEN_PP(domain), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- if (ZEND_NUM_ARGS() > 3) {
- convert_to_long_ex(secure);
- zend_alter_ini_entry("session.cookie_secure", sizeof("session.cookie_secure"), Z_BVAL_PP(secure)?"1":"0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ proto array session_get_cookie_params(void)
- Return the session cookie parameters */
-PHP_FUNCTION(session_get_cookie_params)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- array_init(return_value);
-
- add_assoc_long(return_value, "lifetime", PS(cookie_lifetime));
- add_assoc_string(return_value, "path", PS(cookie_path), 1);
- add_assoc_string(return_value, "domain", PS(cookie_domain), 1);
- add_assoc_bool(return_value, "secure", PS(cookie_secure));
-}
-/* }}} */
-
-/* {{{ proto string session_name([string newname])
- Return the current session name. If newname is given, the session name is replaced with newname */
-PHP_FUNCTION(session_name)
-{
- zval **p_name;
- int ac = ZEND_NUM_ARGS();
- char *old;
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
- WRONG_PARAM_COUNT;
-
- old = estrdup(PS(session_name));
-
- if (ac == 1) {
- convert_to_string_ex(p_name);
- zend_alter_ini_entry("session.name", sizeof("session.name"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- }
-
- RETVAL_STRING(old, 0);
-}
-/* }}} */
-
-/* {{{ proto string session_module_name([string newname])
- Return the current module name used for accessing session data. If newname is given, the module name is replaced with newname */
-PHP_FUNCTION(session_module_name)
-{
- zval **p_name;
- int ac = ZEND_NUM_ARGS();
- char *old;
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
- WRONG_PARAM_COUNT;
-
- old = safe_estrdup(PS(mod)->s_name);
-
- if (ac == 1) {
- ps_module *tempmod;
-
- convert_to_string_ex(p_name);
- tempmod = _php_find_ps_module(Z_STRVAL_PP(p_name) TSRMLS_CC);
- if (tempmod) {
- if (PS(mod_data))
- PS(mod)->s_close(&PS(mod_data) TSRMLS_CC);
- PS(mod) = tempmod;
- PS(mod_data) = NULL;
- } else {
- efree(old);
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot find named PHP session module (%s)",
- Z_STRVAL_PP(p_name));
- RETURN_FALSE;
- }
- }
-
- RETVAL_STRING(old, 0);
-}
-/* }}} */
-
-/* {{{ proto void session_set_save_handler(string open, string close, string read, string write, string destroy, string gc)
- Sets user-level functions */
-PHP_FUNCTION(session_set_save_handler)
-{
- zval **args[6];
- int i;
- ps_user *mdata;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_array_ex(6, args) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (PS(session_status) != php_session_none)
- RETURN_FALSE;
-
- zend_alter_ini_entry("session.save_handler", sizeof("session.save_handler"), "user", sizeof("user")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
-
- mdata = emalloc(sizeof(*mdata));
-
- for (i = 0; i < 6; i++) {
- ZVAL_ADDREF(*args[i]);
- mdata->names[i] = *args[i];
- }
-
- PS(mod_data) = (void *) mdata;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string session_save_path([string newname])
- Return the current save path passed to module_name. If newname is given, the save path is replaced with newname */
-PHP_FUNCTION(session_save_path)
-{
- zval **p_name;
- int ac = ZEND_NUM_ARGS();
- char *old;
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
- WRONG_PARAM_COUNT;
-
- old = estrdup(PS(save_path));
-
- if (ac == 1) {
- convert_to_string_ex(p_name);
- zend_alter_ini_entry("session.save_path", sizeof("session.save_path"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- }
-
- RETVAL_STRING(old, 0);
-}
-/* }}} */
-
-/* {{{ proto string session_id([string newid])
- Return the current session id. If newid is given, the session id is replaced with newid */
-PHP_FUNCTION(session_id)
-{
- zval **p_name;
- int ac = ZEND_NUM_ARGS();
- char *old = empty_string;
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (PS(id))
- old = estrdup(PS(id));
-
- if (ac == 1) {
- convert_to_string_ex(p_name);
- if (PS(id)) efree(PS(id));
- PS(id) = estrndup(Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name));
- }
-
- RETVAL_STRING(old, 0);
-}
-/* }}} */
-
-/* {{{ proto string session_regenerate_id()
- Update the current session id with a newly generated one. */
-PHP_FUNCTION(session_regenerate_id)
-{
- if (PS(session_status) == php_session_active) {
- if (PS(id)) efree(PS(id));
-
- PS(id) = PS(mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC);
-
- php_session_reset_id(TSRMLS_C);
-
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string session_cache_limiter([string new_cache_limiter])
- Return the current cache limiter. If new_cache_limited is given, the current cache_limiter is replaced with new_cache_limiter */
-PHP_FUNCTION(session_cache_limiter)
-{
- zval **p_cache_limiter;
- int ac = ZEND_NUM_ARGS();
- char *old;
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_cache_limiter) == FAILURE)
- WRONG_PARAM_COUNT;
-
- old = estrdup(PS(cache_limiter));
-
- if (ac == 1) {
- convert_to_string_ex(p_cache_limiter);
- zend_alter_ini_entry("session.cache_limiter", sizeof("session.cache_limiter"), Z_STRVAL_PP(p_cache_limiter), Z_STRLEN_PP(p_cache_limiter), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- }
-
- RETVAL_STRING(old, 0);
-}
-/* }}} */
-
-/* {{{ proto int session_cache_expire([int new_cache_expire])
- Return the current cache expire. If new_cache_expire is given, the current cache_expire is replaced with new_cache_expire */
-PHP_FUNCTION(session_cache_expire)
-{
- zval **p_cache_expire;
- int ac = ZEND_NUM_ARGS();
- long old;
-
- old = PS(cache_expire);
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_cache_expire) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (ac == 1) {
- convert_to_long_ex(p_cache_expire);
- PS(cache_expire) = Z_LVAL_PP(p_cache_expire);
- }
-
- RETVAL_LONG(old);
-}
-/* }}} */
-
-/* {{{ static void php_register_var(zval** entry TSRMLS_DC) */
-static void php_register_var(zval** entry TSRMLS_DC)
-{
- zval **value;
-
- if (Z_TYPE_PP(entry) == IS_ARRAY) {
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(entry));
-
- while (zend_hash_get_current_data(Z_ARRVAL_PP(entry), (void**)&value) == SUCCESS) {
- php_register_var(value TSRMLS_CC);
- zend_hash_move_forward(Z_ARRVAL_PP(entry));
- }
- } else {
- convert_to_string_ex(entry);
-
- if ((strcmp(Z_STRVAL_PP(entry), "HTTP_SESSION_VARS") != 0) ||
- (strcmp(Z_STRVAL_PP(entry), "_SESSION") != 0)) {
- PS_ADD_VARL(Z_STRVAL_PP(entry), Z_STRLEN_PP(entry));
- }
- }
-}
-/* }}} */
-
-/* {{{ proto bool session_register(mixed var_names [, mixed ...])
- Adds varname(s) to the list of variables which are freezed at the session end */
-PHP_FUNCTION(session_register)
-{
- zval ***args;
- int argc = ZEND_NUM_ARGS();
- int i;
-
- if (argc <= 0)
- RETURN_FALSE
- else
- args = (zval ***)emalloc(argc * sizeof(zval **));
-
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- if (PS(session_status) == php_session_none)
- php_session_start(TSRMLS_C);
-
- for (i = 0; i < argc; i++) {
- if (Z_TYPE_PP(args[i]) == IS_ARRAY)
- SEPARATE_ZVAL(args[i]);
- php_register_var(args[i] TSRMLS_CC);
- }
-
- efree(args);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool session_unregister(string varname)
- Removes varname from the list of variables which are freezed at the session end */
-PHP_FUNCTION(session_unregister)
-{
- zval **p_name;
- int ac = ZEND_NUM_ARGS();
-
- if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(p_name);
-
- PS_DEL_VARL(Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool session_is_registered(string varname)
- Checks if a variable is registered in session */
-PHP_FUNCTION(session_is_registered)
-{
- zval **p_name;
- zval *p_var;
- int ac = ZEND_NUM_ARGS();
-
- if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(p_name);
-
- if (PS(session_status) == php_session_none)
- RETURN_FALSE;
-
- IF_SESSION_VARS() {
- if (zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)),
- Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name)+1,
- (void **)&p_var) == SUCCESS) {
- RETURN_TRUE;
- }
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string session_encode(void)
- Serializes the current setup and returns the serialized representation */
-PHP_FUNCTION(session_encode)
-{
- int len;
- char *enc;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- enc = php_session_encode(&len TSRMLS_CC);
- if (enc == NULL) {
- RETURN_FALSE;
- }
-
- RETVAL_STRINGL(enc, len, 0);
-}
-/* }}} */
-
-/* {{{ proto bool session_decode(string data)
- Deserializes data and reinitializes the variables */
-PHP_FUNCTION(session_decode)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (PS(session_status) == php_session_none) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(str);
-
- php_session_decode(Z_STRVAL_PP(str), Z_STRLEN_PP(str) TSRMLS_CC);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool session_start(void)
- Begin session - reinitializes freezed variables, registers browsers etc */
-PHP_FUNCTION(session_start)
-{
- /* skipping check for non-zero args for performance reasons here ?*/
- php_session_start(TSRMLS_C);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool session_destroy(void)
- Destroy the current session and all data associated with it */
-PHP_FUNCTION(session_destroy)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- if (php_session_destroy(TSRMLS_C) == SUCCESS) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto void session_unset(void)
- Unset all registered variables */
-PHP_FUNCTION(session_unset)
-{
- if (PS(session_status) == php_session_none)
- RETURN_FALSE;
-
- IF_SESSION_VARS() {
- HashTable *ht = Z_ARRVAL_P(PS(http_session_vars));
-
- if (PG(register_globals)) {
- uint str_len;
- char *str;
- ulong num_key;
- HashPosition pos;
-
- zend_hash_internal_pointer_reset_ex(ht, &pos);
-
- while (zend_hash_get_current_key_ex(ht, &str, &str_len, &num_key,
- 0, &pos) == HASH_KEY_IS_STRING) {
- zend_hash_del(&EG(symbol_table), str, str_len);
- zend_hash_move_forward_ex(ht, &pos);
- }
- }
-
- /* Clean $_SESSION. */
- zend_hash_clean(ht);
- }
-}
-/* }}} */
-
-PHPAPI void session_adapt_url(const char *url, size_t urllen, char **new, size_t *newlen TSRMLS_DC)
-{
- if (PS(apply_trans_sid) && (PS(session_status) == php_session_active)) {
- *new = php_url_scanner_adapt_single_url(url, urllen, PS(session_name), PS(id), newlen TSRMLS_CC);
- }
-}
-
-static void php_rinit_session_globals(TSRMLS_D)
-{
- PS(id) = NULL;
- PS(session_status) = php_session_none;
- PS(mod_data) = NULL;
- PS(http_session_vars) = NULL;
-}
-
-static void php_rshutdown_session_globals(TSRMLS_D)
-{
- if (PS(mod_data)) {
- PS(mod)->s_close(&PS(mod_data) TSRMLS_CC);
- }
- if (PS(id)) {
- efree(PS(id));
- }
-}
-
-
-PHP_RINIT_FUNCTION(session)
-{
- php_rinit_session_globals(TSRMLS_C);
-
- if (PS(mod) == NULL) {
- char *value;
-
- value = zend_ini_string("session.save_handler", sizeof("session.save_handler"), 0);
- if (value) {
- PS(mod) = _php_find_ps_module(value TSRMLS_CC);
- }
-
- if (!PS(mod)) {
- /* current status is unusable */
- PS(session_status) = php_session_disabled;
- return SUCCESS;
- }
- }
-
- if (PS(auto_start)) {
- php_session_start(TSRMLS_C);
- }
-
- return SUCCESS;
-}
-
-static void php_session_flush(TSRMLS_D)
-{
- if(PS(session_status)==php_session_active) {
- php_session_save_current_state(TSRMLS_C);
- PS(session_status)=php_session_none;
- }
-}
-
-/* {{{ proto void session_write_close(void)
- Write session data and end session */
-PHP_FUNCTION(session_write_close)
-{
- php_session_flush(TSRMLS_C);
-}
-
-PHP_RSHUTDOWN_FUNCTION(session)
-{
- php_session_flush(TSRMLS_C);
- php_rshutdown_session_globals(TSRMLS_C);
- return SUCCESS;
-}
-/* }}} */
-
-
-PHP_MINIT_FUNCTION(session)
-{
-#ifdef ZTS
- php_ps_globals *ps_globals;
-
- ts_allocate_id(&ps_globals_id, sizeof(php_ps_globals), NULL, NULL);
- ps_globals = ts_resource(ps_globals_id);
-#endif
-
- zend_register_auto_global("_SESSION", sizeof("_SESSION")-1, NULL TSRMLS_CC);
-
- PS(module_number) = module_number; /* if we really need this var we need to init it in zts mode as well! */
-
- PS(session_status) = php_session_none;
- REGISTER_INI_ENTRIES();
-
-#ifdef HAVE_LIBMM
- PHP_MINIT(ps_mm) (INIT_FUNC_ARGS_PASSTHRU);
-#endif
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(session)
-{
- UNREGISTER_INI_ENTRIES();
-
-#ifdef HAVE_LIBMM
- PHP_MSHUTDOWN(ps_mm) (SHUTDOWN_FUNC_ARGS_PASSTHRU);
-#endif
-
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(session)
-{
- ps_module **mod;
- smart_str handlers = {0};
- int i;
-
- for (i = 0, mod = ps_modules; i < MAX_MODULES; i++, mod++) {
- if (*mod && (*mod)->s_name) {
- smart_str_appends(&handlers, (*mod)->s_name);
- smart_str_appendc(&handlers, ' ');
- }
- }
-
- php_info_print_table_start();
- php_info_print_table_row(2, "Session Support", "enabled" );
-
- if (handlers.c) {
- smart_str_0(&handlers);
- php_info_print_table_row(2, "Registered save handlers", handlers.c);
- smart_str_free(&handlers);
- } else {
- php_info_print_table_row(2, "Registered save handlers", "none");
- }
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/session/tests/001.phpt b/ext/session/tests/001.phpt
deleted file mode 100644
index f499029a73..0000000000
--- a/ext/session/tests/001.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-session object serialization
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-register_globals=1
-session.serialize_handler=php
---FILE--
-<?php
-error_reporting(E_ALL);
-
-class foo {
- var $bar = "ok";
-
- function method() { $this->yes = "done"; }
-}
-
-$baz = new foo;
-$baz->method();
-
-$arr[3] = new foo;
-$arr[3]->method();
-
-session_register("baz");
-session_register("arr");
-
-print session_encode()."\n";
-
-session_destroy();
---GET--
---POST--
---EXPECT--
-baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";s:4:"done";}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";s:4:"done";}}
diff --git a/ext/session/tests/002.phpt b/ext/session/tests/002.phpt
deleted file mode 100644
index 7c77fdcf94..0000000000
--- a/ext/session/tests/002.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-session_unset() without a initialized session
---SKIPIF--
-<?php include('skipif.inc'); ?>
---FILE--
-<?php
-error_reporting(E_ALL);
-session_unset();
-print "ok\n";
---GET--
---POST--
---EXPECT--
-ok
diff --git a/ext/session/tests/003.phpt b/ext/session/tests/003.phpt
deleted file mode 100644
index 638506e31e..0000000000
--- a/ext/session/tests/003.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-session object deserialization
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-register_globals=1
-session.serialize_handler=php
---FILE--
-<?php
-error_reporting(E_ALL);
-
-class foo {
- var $bar = "ok";
- function method() { $this->yes++; }
-}
-
-session_id("abtest");
-session_start();
-session_decode('baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}');
-
-$baz->method();
-$arr[3]->method();
-
-var_dump($baz);
-var_dump($arr);
-session_destroy();
---EXPECT--
-object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
-}
-array(1) {
- [3]=>
- &object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
- }
-}
diff --git a/ext/session/tests/004.phpt b/ext/session/tests/004.phpt
deleted file mode 100644
index 0d930c5307..0000000000
--- a/ext/session/tests/004.phpt
+++ /dev/null
@@ -1,111 +0,0 @@
---TEST--
-session_set_save_handler test
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-register_globals=1
-session.name=PHPSESSID
-session.serialize_handler=php
---FILE--
-<?php
-error_reporting(E_ALL);
-
-class handler {
- var $data = 'baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}';
- function open($save_path, $session_name)
- {
- print "OPEN: $session_name\n";
- return true;
- }
- function close()
- {
- return true;
- }
- function read($key)
- {
- print "READ: $key\n";
- return $GLOBALS["hnd"]->data;
- }
-
- function write($key, $val)
- {
- print "WRITE: $key, $val\n";
- $GLOBALS["hnd"]->data = $val;
- return true;
- }
-
- function destroy($key)
- {
- print "DESTROY: $key\n";
- return true;
- }
-
- function gc() { return true; }
-}
-
-$hnd = new handler;
-
-class foo {
- var $bar = "ok";
- function method() { $this->yes++; }
-}
-
-session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
-
-session_id("abtest");
-session_start();
-$baz->method();
-$arr[3]->method();
-
-var_dump($baz);
-var_dump($arr);
-
-session_write_close();
-
-session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
-session_start();
-
-var_dump($baz);
-var_dump($arr);
-
-session_destroy();
-?>
---EXPECT--
-OPEN: PHPSESSID
-READ: abtest
-object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
-}
-array(1) {
- [3]=>
- &object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
- }
-}
-WRITE: abtest, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}}
-OPEN: PHPSESSID
-READ: abtest
-object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
-}
-array(1) {
- [3]=>
- object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
- }
-}
-DESTROY: abtest
diff --git a/ext/session/tests/005.phpt b/ext/session/tests/005.phpt
deleted file mode 100644
index 3c9205277f..0000000000
--- a/ext/session/tests/005.phpt
+++ /dev/null
@@ -1,146 +0,0 @@
---TEST--
-custom save handler, multiple session_start()s, complex data structure test.
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-register_globals=1
-session.name=PHPSESSID
-session.serialize_handler=php
---FILE--
-<?php
-
-error_reporting(E_ALL);
-
-class handler {
- var $data = 'baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}';
- function open($save_path, $session_name)
- {
- print "OPEN: $session_name\n";
- return true;
- }
- function close()
- {
- print "CLOSE\n";
- return true;
- }
- function read($key)
- {
- print "READ: $key\n";
- return $GLOBALS["hnd"]->data;
- }
-
- function write($key, $val)
- {
- print "WRITE: $key, $val\n";
- $GLOBALS["hnd"]->data = $val;
- return true;
- }
-
- function destroy($key)
- {
- print "DESTROY: $key\n";
- return true;
- }
-
- function gc() { return true; }
-}
-
-$hnd = new handler;
-
-class foo {
- var $bar = "ok";
- function method() { $this->yes++; }
-}
-
-session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
-
-session_id("abtest");
-session_start();
-$baz->method();
-$arr[3]->method();
-
-var_dump($baz);
-var_dump($arr);
-
-session_write_close();
-
-session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
-session_start();
-$baz->method();
-$arr[3]->method();
-
-
-$c = 123;
-session_register("c");
-var_dump($baz); var_dump($arr); var_dump($c);
-
-session_write_close();
-
-session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
-session_start();
-var_dump($baz); var_dump($arr); var_dump($c);
-
-session_destroy();
-?>
---EXPECT--
-OPEN: PHPSESSID
-READ: abtest
-object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
-}
-array(1) {
- [3]=>
- &object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
- }
-}
-WRITE: abtest, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}}
-CLOSE
-OPEN: PHPSESSID
-READ: abtest
-object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(3)
-}
-array(1) {
- [3]=>
- &object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(3)
- }
-}
-int(123)
-WRITE: abtest, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:3;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:3;}}c|i:123;
-CLOSE
-OPEN: PHPSESSID
-READ: abtest
-object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(3)
-}
-array(1) {
- [3]=>
- object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(3)
- }
-}
-int(123)
-DESTROY: abtest
-CLOSE
diff --git a/ext/session/tests/006.phpt b/ext/session/tests/006.phpt
deleted file mode 100644
index 2cdeace074..0000000000
--- a/ext/session/tests/006.phpt
+++ /dev/null
@@ -1,70 +0,0 @@
---TEST--
-correct instantiation of references between variables in sessions
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-register_globals=1
-session.serialize_handler=php
---FILE--
-<?php
-error_reporting(E_ALL);
-
-session_id("abtest");
-session_start();
-
-class a {
- var $test = "hallo";
-}
-
-class b {
- var $a;
- function b(&$a) {
- $this->a = &$a;
- }
-}
-
-$a = new a();
-$b = new b($a);
-
-echo "original values:\n";
-var_dump($a,$b);
-
-session_register("a");
-session_register("b");
-session_write_close();
-
-session_unregister("a");
-session_unregister("b");
-
-session_start();
-
-echo "values after session:\n";
-var_dump($a,$b);
-?>
---EXPECT--
-original values:
-object(a)(1) {
- ["test"]=>
- string(5) "hallo"
-}
-object(b)(1) {
- ["a"]=>
- &object(a)(1) {
- ["test"]=>
- string(5) "hallo"
- }
-}
-values after session:
-object(a)(1) {
- ["test"]=>
- string(5) "hallo"
-}
-object(b)(1) {
- ["a"]=>
- &object(a)(1) {
- ["test"]=>
- string(5) "hallo"
- }
-}
diff --git a/ext/session/tests/007.phpt b/ext/session/tests/007.phpt
deleted file mode 100644
index 7e13ab27e3..0000000000
--- a/ext/session/tests/007.phpt
+++ /dev/null
@@ -1,59 +0,0 @@
---TEST--
-bug compatibility: unset($c) with enabled register_globals
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-register_globals=1
-session.bug_compat_42=1
-session.serialize_handler=php
---FILE--
-<?php
-error_reporting(E_ALL);
-
-session_id("abtest");
-
-### Phase 1 cleanup
-session_start();
-session_destroy();
-
-### Phase 2 $HTTP_SESSION_VARS["c"] does not contain any value
-session_id("abtest");
-session_register("c");
-unset($c);
-$c = 3.14;
-session_write_close();
-unset($HTTP_SESSION_VARS);
-unset($c);
-
-### Phase 3 $HTTP_SESSION_VARS["c"] is set
-session_start();
-var_dump($c);
-var_dump($HTTP_SESSION_VARS);
-unset($c);
-$c = 2.78;
-
-session_write_close();
-unset($HTTP_SESSION_VARS);
-unset($c);
-
-### Phase 4 final
-
-session_start();
-var_dump($c);
-var_dump($HTTP_SESSION_VARS);
-
-session_destroy();
-?>
---EXPECT--
-float(3.14)
-array(1) {
- ["c"]=>
- &float(3.14)
-}
-float(3.14)
-array(1) {
- ["c"]=>
- &float(3.14)
-}
diff --git a/ext/session/tests/008-php4.2.3.phpt b/ext/session/tests/008-php4.2.3.phpt
deleted file mode 100644
index 2785ddc2e8..0000000000
--- a/ext/session/tests/008-php4.2.3.phpt
+++ /dev/null
@@ -1,68 +0,0 @@
---TEST--
-bug compatibility: global is used albeit register_globals=0
---SKIPIF--
-<?php include('skipif.inc');
- if (version_compare(PHP_VERSION,"4.2.3-dev", "<")) die("skip this is for PHP >= 4.2.3");
-?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-register_globals=0
-session.bug_compat_42=1
-session.bug_compat_warn=1
-track_errors=1
-log_errors=0
-html_errors=0
-display_errors=1
-error_reporting=2039;
-session.serialize_handler=php
---FILE--
-<?php
-session_id("abtest");
-
-### Phase 1 cleanup
-session_start();
-session_destroy();
-
-### Phase 2 $HTTP_SESSION_VARS["c"] does not contain any value
-session_id("abtest");
-session_register("c");
-var_dump($c);
-unset($c);
-$c = 3.14;
-@session_write_close(); // this generates an E_WARNING which will be printed
-// by $php_errormsg so we can use "@" here. ANY further message IS an error.
-echo $php_errormsg."\n";
-unset($HTTP_SESSION_VARS);
-unset($c);
-
-### Phase 3 $HTTP_SESSION_VARS["c"] is set
-session_start();
-var_dump($HTTP_SESSION_VARS);
-unset($c);
-$c = 2.78;
-
-session_write_close();
-unset($HTTP_SESSION_VARS);
-unset($c);
-
-### Phase 4 final
-
-session_start();
-var_dump($c);
-var_dump($HTTP_SESSION_VARS);
-
-session_destroy();
-?>
---EXPECTF--
-NULL
-Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively.
-array(1) {
- ["c"]=>
- float(3.14)
-}
-NULL
-array(1) {
- ["c"]=>
- float(3.14)
-}
diff --git a/ext/session/tests/008.phpt b/ext/session/tests/008.phpt
deleted file mode 100644
index 044a6f2536..0000000000
--- a/ext/session/tests/008.phpt
+++ /dev/null
@@ -1,61 +0,0 @@
---TEST--
-bug compatibility: global is used albeit register_globals=0
---SKIPIF--
-<?php include('skipif.inc');
- if (version_compare(PHP_VERSION,"4.2.3-dev", ">=")) die("skip this is for PHP < 4.2.3");
-?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-register_globals=0
-session.bug_compat_42=1
-session.bug_compat_warn=0
---FILE--
-<?php
-error_reporting(E_ALL & ~E_NOTICE);
-
-session_id("abtest");
-
-### Phase 1 cleanup
-session_start();
-session_destroy();
-
-### Phase 2 $HTTP_SESSION_VARS["c"] does not contain any value
-session_id("abtest");
-session_register("c");
-var_dump($c);
-unset($c);
-$c = 3.14;
-session_write_close();
-unset($HTTP_SESSION_VARS);
-unset($c);
-
-### Phase 3 $HTTP_SESSION_VARS["c"] is set
-session_start();
-var_dump($HTTP_SESSION_VARS);
-unset($c);
-$c = 2.78;
-
-session_write_close();
-unset($HTTP_SESSION_VARS);
-unset($c);
-
-### Phase 4 final
-
-session_start();
-var_dump($c);
-var_dump($HTTP_SESSION_VARS);
-
-session_destroy();
-?>
---EXPECT--
-NULL
-array(1) {
- ["c"]=>
- float(3.14)
-}
-NULL
-array(1) {
- ["c"]=>
- float(3.14)
-}
diff --git a/ext/session/tests/009.phpt b/ext/session/tests/009.phpt
deleted file mode 100644
index a79cb931aa..0000000000
--- a/ext/session/tests/009.phpt
+++ /dev/null
@@ -1,57 +0,0 @@
---TEST--
-unset($_SESSION["name"]); should work with register_globals=off
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-register_globals=0
-session.bug_compat_42=1
-session.bug_compat_warn=0
-session.serialize_handler=php
---FILE--
-<?php
-error_reporting(E_ALL);
-
-session_id("abtest");
-
-### Phase 1 cleanup
-session_start();
-session_destroy();
-
-### Phase 2 $HTTP_SESSION_VARS["c"] does not contain any value
-session_id("abtest");
-session_start();
-var_dump($HTTP_SESSION_VARS);
-$HTTP_SESSION_VARS["name"] = "foo";
-var_dump($HTTP_SESSION_VARS);
-session_write_close();
-
-### Phase 3 $HTTP_SESSION_VARS["c"] is set
-session_start();
-var_dump($HTTP_SESSION_VARS);
-unset($HTTP_SESSION_VARS["name"]);
-var_dump($HTTP_SESSION_VARS);
-session_write_close();
-
-### Phase 4 final
-
-session_start();
-var_dump($HTTP_SESSION_VARS);
-session_destroy();
-?>
---EXPECT--
-array(0) {
-}
-array(1) {
- ["name"]=>
- string(3) "foo"
-}
-array(1) {
- ["name"]=>
- string(3) "foo"
-}
-array(0) {
-}
-array(0) {
-}
diff --git a/ext/session/tests/010.phpt b/ext/session/tests/010.phpt
deleted file mode 100644
index e1af8ce87f..0000000000
--- a/ext/session/tests/010.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-$session_array = explode(";", session_encode()); should not segfault
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-register_globals=0
-session.bug_compat_42=1
-session.bug_compat_warn=0
---FILE--
-<?php
-error_reporting(E_ALL);
-
-$session_array = explode(";", @session_encode());
-print "I live\n";
-?>
---EXPECT--
-I live
diff --git a/ext/session/tests/011.phpt b/ext/session/tests/011.phpt
deleted file mode 100644
index 6aaa6bd797..0000000000
--- a/ext/session/tests/011.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-session_decode(); should not segfault
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-register_globals=0
-session.bug_compat_42=1
-session.bug_compat_warn=0
---FILE--
-<?php
-error_reporting(E_ALL);
-
-@session_decode("garbage data and no session started");
-@session_decode("userid|s:5:\"mazen\";chatRoom|s:1:\"1\";");
-print "I live\n";
-?>
---EXPECT--
-I live
diff --git a/ext/session/tests/012.phpt b/ext/session/tests/012.phpt
deleted file mode 100644
index 2bfee9b3de..0000000000
--- a/ext/session/tests/012.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-registering $_SESSION should not segfault
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-register_globals=1
-session.bug_compat_42=1
-session.bug_compat_warn=0
-session.serialize_handler=php
---FILE--
-<?php
-error_reporting(E_ALL);
-
-### Absurd example, value of $_SESSION does not matter
-
-session_id("abtest");
-session_start();
-session_register("_SESSION");
-$_SESSION = "kk";
-
-session_write_close();
-
-### Restart to test for $_SESSION brokenness
-
-session_start();
-$_SESSION = "kk";
-session_destroy();
-
-print "I live\n";
-?>
---EXPECT--
-I live
diff --git a/ext/session/tests/013.phpt b/ext/session/tests/013.phpt
deleted file mode 100644
index 77c1353054..0000000000
--- a/ext/session/tests/013.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-redefining SID should not cause warnings
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-register_globals=1
-session.bug_compat_42=1
-session.bug_compat_warn=0
-session.serialize_handler=php
---FILE--
-<?php
-error_reporting(E_ALL);
-
-session_id("abtest");
-session_start();
-session_destroy();
-session_id("abtest2");
-session_start();
-session_destroy();
-
-print "I live\n";
-?>
---EXPECT--
-I live
diff --git a/ext/session/tests/014.phpt b/ext/session/tests/014.phpt
deleted file mode 100644
index 593cfb957d..0000000000
--- a/ext/session/tests/014.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-a script should not be able to modify session.use_trans_sid
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_trans_sid=1
-session.use_cookies=0
-session.cache_limiter=
-register_globals=1
-session.bug_compat_42=1
-session.bug_compat_warn=0
-session.name=PHPSESSID
-session.serialize_handler=php
---FILE--
-<?php
-error_reporting(E_ALL);
-
-session_id("abtest");
-session_start();
-
-?>
-<a href="/link">
-<?php
-ini_set("session.use_trans_sid","0");
-?>
-<a href="/link">
-<?php
-ini_set("session.use_trans_sid","1");
-?>
-<a href="/link">
-<?php
-session_destroy();
-?>
---EXPECT--
-<a href="/link?PHPSESSID=abtest">
-<a href="/link?PHPSESSID=abtest">
-<a href="/link?PHPSESSID=abtest">
diff --git a/ext/session/tests/015.phpt b/ext/session/tests/015.phpt
deleted file mode 100644
index 53929b1672..0000000000
--- a/ext/session/tests/015.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-use_trans_sid should not affect SID
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_trans_sid=1
-session.use_cookies=0
-session.cache_limiter=
-arg_separator.output=&
-session.name=PHPSESSID
-session.serialize_handler=php
---FILE--
-<?php
-error_reporting(E_ALL);
-
-session_id("abtest");
-session_start();
-?>
-<a href="/link?<?php echo SID; ?>">
-<?php
-session_destroy();
-?>
---EXPECT--
-<a href="/link?PHPSESSID=abtest&PHPSESSID=abtest">
diff --git a/ext/session/tests/016.phpt b/ext/session/tests/016.phpt
deleted file mode 100644
index fde3a915a7..0000000000
--- a/ext/session/tests/016.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-invalid session.save_path should not cause a segfault
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.save_path="123;:/really\\completely:::/invalid;;,23123;213"
-session.use_cookies=0
-session.cache_limiter=
-session.serialize_handler=php
---FILE--
-<?php
-error_reporting(E_ALL);
-
-@session_start();
-$HTTP_SESSION_VARS["test"] = 1;
-@session_write_close();
-print "I live\n";
-?>
---EXPECT--
-I live
diff --git a/ext/session/tests/017.phpt b/ext/session/tests/017.phpt
deleted file mode 100644
index 2a11fed85b..0000000000
--- a/ext/session/tests/017.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-setting $_SESSION before session_start() should not cause segfault
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-session.serialize_handler=php
---FILE--
-<?php
-
-error_reporting(E_ALL);
-
-class Kill {
- function Kill() {
- global $HTTP_SESSION_VARS;
- session_start();
- }
-}
-$k = new Kill();
-
-print "I live\n";
-?>
---EXPECT--
-I live
diff --git a/ext/session/tests/018.phpt b/ext/session/tests/018.phpt
deleted file mode 100644
index 0b84978ed2..0000000000
--- a/ext/session/tests/018.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-rewriter correctly handles attribute names which contain dashes
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-session.use_trans_sid=1
-session.name=PHPSESSID
-session.serialize_handler=php
---FILE--
-<?php
-
-error_reporting(E_ALL);
-
-session_id("abtest");
-session_start();
-?>
-<form accept-charset="ISO-8859-15, ISO-8859-1" action=url.php>
-<?php
-session_destroy();
-?>
---EXPECT--
-<form accept-charset="ISO-8859-15, ISO-8859-1" action=url.php><input type="hidden" name="PHPSESSID" value="abtest" />
diff --git a/ext/session/tests/019.phpt b/ext/session/tests/019.phpt
deleted file mode 100644
index c8b969e44f..0000000000
--- a/ext/session/tests/019.phpt
+++ /dev/null
@@ -1,72 +0,0 @@
---TEST--
-serializing references test case using globals
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-register_globals=1
-session.serialize_handler=php
---FILE--
-<?php
-
-error_reporting(E_ALL);
-
-class TFoo {
- var $c;
- function TFoo($c) {
- $this->c = $c;
- }
- function inc() {
- $this->c++;
- }
-}
-
-session_id("abtest");
-session_register('o1', 'o2' );
-session_start();
-
-$o1 =& new TFoo(42);
-$o2 =& $o1;
-
-session_write_close();
-
-unset($o1);
-unset($o2);
-
-session_start();
-
-var_dump($_SESSION);
-
-$o1->inc();
-$o2->inc();
-
-var_dump($_SESSION);
-
-session_destroy();
-?>
---EXPECT--
-array(2) {
- ["o1"]=>
- &object(tfoo)(1) {
- ["c"]=>
- int(42)
- }
- ["o2"]=>
- &object(tfoo)(1) {
- ["c"]=>
- int(42)
- }
-}
-array(2) {
- ["o1"]=>
- &object(tfoo)(1) {
- ["c"]=>
- int(44)
- }
- ["o2"]=>
- &object(tfoo)(1) {
- ["c"]=>
- int(44)
- }
-}
diff --git a/ext/session/tests/020.phpt b/ext/session/tests/020.phpt
deleted file mode 100644
index c9571ef20d..0000000000
--- a/ext/session/tests/020.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-rewriter uses arg_seperator.output for modifying URLs
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-session.use_trans_sid=1
-arg_separator.output=&amp;
-session.name=PHPSESSID
-session.serialize_handler=php
---FILE--
-<?php
-
-error_reporting(E_ALL);
-
-session_id("abtest");
-session_start();
-?>
-<a href="link.php?a=b">
-<?php
-session_destroy();
-?>
---EXPECT--
-<a href="link.php?a=b&amp;PHPSESSID=abtest">
diff --git a/ext/session/tests/021.phpt b/ext/session/tests/021.phpt
deleted file mode 100644
index b45406438e..0000000000
--- a/ext/session/tests/021.phpt
+++ /dev/null
@@ -1,61 +0,0 @@
---TEST--
-rewriter handles form and fieldset tags correctly
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-session.use_trans_sid=1
-url_rewriter.tags="a=href,area=href,frame=src,input=src,form=,fieldset="
-session.name=PHPSESSID
-session.serialize_handler=php
---FILE--
-<?php
-
-error_reporting(E_ALL);
-
-session_id("abtest");
-session_start();
-?>
-<form>
-<fieldset>
-<?php
-
-ob_flush();
-
-ini_set("url_rewriter.tags", "a=href,area=href,frame=src,input=src,form=");
-
-?>
-<form>
-<fieldset>
-<?php
-
-ob_flush();
-
-ini_set("url_rewriter.tags", "a=href,area=href,frame=src,input=src,form=fakeentry");
-
-?>
-<form>
-<fieldset>
-<?php
-
-ob_flush();
-
-ini_set("url_rewriter.tags", "a=href,fieldset=,area=href,frame=src,input=src");
-
-?>
-<form>
-<fieldset>
-<?php
-
-session_destroy();
-?>
---EXPECT--
-<form><input type="hidden" name="PHPSESSID" value="abtest" />
-<fieldset><input type="hidden" name="PHPSESSID" value="abtest" />
-<form><input type="hidden" name="PHPSESSID" value="abtest" />
-<fieldset>
-<form><input type="hidden" name="PHPSESSID" value="abtest" />
-<fieldset>
-<form>
-<fieldset><input type="hidden" name="PHPSESSID" value="abtest" />
diff --git a/ext/session/tests/skipif.inc b/ext/session/tests/skipif.inc
deleted file mode 100644
index 8336e75bd0..0000000000
--- a/ext/session/tests/skipif.inc
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-// This script prints "skip" if condition does not meet.
-if (!extension_loaded("session") && ini_get("enable_dl")) {
- $dlext = (substr(PHP_OS, 0, 3) == "WIN") ? ".dll" : ".so";
- @dl("session$dlext");
-}
-if (!extension_loaded("session")) {
- die("skip\n");
-}
-?>
diff --git a/ext/shmop/CREDITS b/ext/shmop/CREDITS
deleted file mode 100644
index caab89e208..0000000000
--- a/ext/shmop/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Shared Memory Operations
-Slava Poliakov, Ilia Alshanetsky
diff --git a/ext/shmop/README b/ext/shmop/README
deleted file mode 100644
index d1cc5abc2b..0000000000
--- a/ext/shmop/README
+++ /dev/null
@@ -1,69 +0,0 @@
-last update Jan 2, 2002 (hackie@prohost.org/ilia@prohost.org)
-
-Shared Memory Operations Extension to PHP4
-
- While developing a search deamon we needed a php based front end
- to communicate the deamon via SHM. PHP already had a shared memory
- extention (sysvshm) written by Christian Cartus <cartus@atrior.de>,
- unfortunatly this extention was designed with PHP only in mind and
- offers high level features which are extremly bothersome for basic SHM
- we had in mind. After spending a day trying to reverse engineer and figure
- out the format of sysvshm we decided that it would be much easier to
- add our own extention to php for simple SHM operations, we were right :)).
-
-the functions are:
-
-int shmop_open(int key, string flags, int mode, int size)
-
- key - the key of/for the shared memory block
- flags - 4 flags are avalible
- a for read only access (sets SHM_RDONLY)
- w for read & write access
- c create or open an existing segment (sets IPC_CREATE)
- n create a new segment and fail if one already exists under same name (sets IPC_CREATE|IPC_EXCL)
- (the n flag is mostly useful for security perpouses, so that you don't end up opening a faked segment
- if someone guesses your key)
- mode - acsess mode same as for a file (0644) for example
- size - size of the block in bytes
-
- returns an indentifier
-
-
-char shmop_read(int shmid, int start, int count)
-
- shmid - shmid from which to read
- start - offset from which to start reading
- count - how many bytes to read
-
- returns the data read
-
-int shmop_write(int shmid, string data, int offset)
-
- shmid - shmid from which to read
- data - string to put into shared memory
- offset - offset in shm to write from
-
- returns bytes written
-
-int shmop_size(int shmid)
-
- shmid - shmid for which to return the size
-
- returns the size in bytes of the shm segment
-
-
-int shmop_delete(int shmid)
-
- marks the segment for deletion, the segment will be deleted when all processes mapping it will detach
-
- shmid - shmid which to mark for deletion
-
- returns 1 if all ok, zero on failure
-
-int shmop_close(int shmid)
-
- shmid - shmid which to close
-
- returns zero
-
-
diff --git a/ext/shmop/config.m4 b/ext/shmop/config.m4
deleted file mode 100644
index 6c1709d715..0000000000
--- a/ext/shmop/config.m4
+++ /dev/null
@@ -1,8 +0,0 @@
-dnl $Id$
-PHP_ARG_ENABLE(shmop, whether to enable shmop support,
-[ --enable-shmop Enable shmop support])
-
-if test "$PHP_SHMOP" != "no"; then
- AC_DEFINE(HAVE_SHMOP, 1, [ ])
- PHP_NEW_EXTENSION(shmop, shmop.c, $ext_shared)
-fi
diff --git a/ext/shmop/php_shmop.h b/ext/shmop/php_shmop.h
deleted file mode 100644
index ff4321c762..0000000000
--- a/ext/shmop/php_shmop.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Slava Poliakov <hackie@prohost.org> |
- | Ilia Alshanetsky <ilia@prohost.org> |
- +----------------------------------------------------------------------+
- */
-#ifndef PHP_SHMOP_H
-#define PHP_SHMOP_H
-
-#if HAVE_SHMOP
-
-extern zend_module_entry shmop_module_entry;
-#define phpext_shmop_ptr &shmop_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_SHMOP_API __declspec(dllexport)
-#else
-#define PHP_SHMOP_API
-#endif
-
-PHP_MINIT_FUNCTION(shmop);
-PHP_MSHUTDOWN_FUNCTION(shmop);
-PHP_RINIT_FUNCTION(shmop);
-PHP_RSHUTDOWN_FUNCTION(shmop);
-PHP_MINFO_FUNCTION(shmop);
-
-PHP_FUNCTION(shmop_open);
-PHP_FUNCTION(shmop_read);
-PHP_FUNCTION(shmop_close);
-PHP_FUNCTION(shmop_size);
-PHP_FUNCTION(shmop_write);
-PHP_FUNCTION(shmop_delete);
-
-#ifdef PHP_WIN32
-typedef int key_t;
-#endif
-
-struct php_shmop
-{
- int shmid;
- key_t key;
- int shmflg;
- int shmatflg;
- char *addr;
- int size;
-};
-
-typedef struct {
- int le_shmop;
-} php_shmop_globals;
-
-#ifdef ZTS
-#define SHMOPG(v) TSRMG(shmop_globals_id, php_shmop_globals *, v)
-#else
-#define SHMOPG(v) (shmop_globals.v)
-#endif
-
-#else
-
-#define phpext_shmop_ptr NULL
-
-#endif
-
-#endif /* PHP_SHMOP_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c
deleted file mode 100644
index 47e3e226e5..0000000000
--- a/ext/shmop/shmop.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Slava Poliakov <hackie@prohost.org> |
- | Ilia Alshanetsky <ilia@prohost.org> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_shmop.h"
-# ifndef PHP_WIN32
-# include <sys/ipc.h>
-# include <sys/shm.h>
-#else
-#include "tsrm_win32.h"
-#endif
-
-
-#if HAVE_SHMOP
-
-#include "ext/standard/info.h"
-
-#ifdef ZTS
-int shmop_globals_id;
-#else
-php_shmop_globals shmop_globals;
-#endif
-
-int shm_type;
-
-/* {{{ shmop_functions[]
- */
-function_entry shmop_functions[] = {
- PHP_FE(shmop_open, NULL)
- PHP_FE(shmop_read, NULL)
- PHP_FE(shmop_close, NULL)
- PHP_FE(shmop_size, NULL)
- PHP_FE(shmop_write, NULL)
- PHP_FE(shmop_delete, NULL)
- {NULL, NULL, NULL} /* Must be the last line in shmop_functions[] */
-};
-/* }}} */
-
-/* {{{ shmop_module_entry
- */
-zend_module_entry shmop_module_entry = {
- STANDARD_MODULE_HEADER,
- "shmop",
- shmop_functions,
- PHP_MINIT(shmop),
- PHP_MSHUTDOWN(shmop),
- NULL,
- NULL,
- PHP_MINFO(shmop),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_SHMOP
-ZEND_GET_MODULE(shmop)
-#endif
-
-/* {{{ rsclean
- */
-static void rsclean(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- struct php_shmop *shmop = (struct php_shmop *)rsrc->ptr;
-
- shmdt(shmop->addr);
- efree(shmop);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(shmop)
-{
- shm_type = zend_register_list_destructors_ex(rsclean, NULL, "shmop", module_number);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(shmop)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(shmop)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "shmop support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ proto int shmop_open (int key, string flags, int mode, int size)
- gets and attaches a shared memory segment */
-PHP_FUNCTION(shmop_open)
-{
- long key, mode, size;
- struct php_shmop *shmop;
- struct shmid_ds shm;
- int rsid;
- char *flags;
- int flags_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsll", &key, &flags, &flags_len, &mode, &size) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (flags_len != 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a valid flag", flags);
- RETURN_FALSE;
- }
-
- shmop = emalloc(sizeof(struct php_shmop));
- memset(shmop, 0, sizeof(struct php_shmop));
-
- shmop->key = key;
- shmop->shmflg |= mode;
-
- switch (flags[0])
- {
- case 'a':
- shmop->shmatflg |= SHM_RDONLY;
- break;
- case 'c':
- shmop->shmflg |= IPC_CREAT;
- shmop->size = size;
- break;
- case 'n':
- shmop->shmflg |= (IPC_CREAT | IPC_EXCL);
- shmop->size = size;
- break;
- case 'w':
- /* noop
- shm segment is being opened for read & write
- will fail if segment does not exist
- */
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid access mode");
- efree(shmop);
- RETURN_FALSE;
- }
-
- shmop->shmid = shmget(shmop->key, shmop->size, shmop->shmflg);
- if (shmop->shmid == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to attach or create shared memory segment");
- efree(shmop);
- RETURN_FALSE;
- }
-
- if (shmctl(shmop->shmid, IPC_STAT, &shm)) {
- efree(shmop);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to get shared memory segment information");
- RETURN_FALSE;
- }
-
- shmop->addr = shmat(shmop->shmid, 0, shmop->shmatflg);
- if (shmop->addr == (char*) -1) {
- efree(shmop);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to attach to shared memory segment");
- RETURN_FALSE;
- }
-
- shmop->size = shm.shm_segsz;
-
- rsid = zend_list_insert(shmop, shm_type);
- RETURN_LONG(rsid);
-}
-/* }}} */
-
-/* {{{ proto string shmop_read (int shmid, int start, int count)
- reads from a shm segment */
-PHP_FUNCTION(shmop_read)
-{
- long shmid, start, count;
- struct php_shmop *shmop;
- int type;
- char *startaddr;
- int bytes;
- char *return_string;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &shmid, &start, &count) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- shmop = zend_list_find(shmid, &type);
-
- if (!shmop) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "no shared memory segment with an id of [%lu]", shmid);
- RETURN_FALSE;
- }
-
- if (start < 0 || start > shmop->size) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "start is out of range");
- RETURN_FALSE;
- }
-
- if (start + count > shmop->size) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "count is out of range");
- RETURN_FALSE;
- }
-
- if (count < 0 ){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "count is out of range");
- RETURN_FALSE;
- }
-
- startaddr = shmop->addr + start;
- bytes = count ? count : shmop->size - start;
-
- return_string = emalloc(bytes+1);
- memcpy(return_string, startaddr, bytes);
- return_string[bytes] = 0;
-
- RETURN_STRINGL(return_string, bytes, 0);
-}
-/* }}} */
-
-/* {{{ proto void shmop_close (int shmid)
- closes a shared memory segment */
-PHP_FUNCTION(shmop_close)
-{
- long shmid;
- struct php_shmop *shmop;
- int type;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- shmop = zend_list_find(shmid, &type);
-
- if (!shmop) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "no shared memory segment with an id of [%lu]", shmid);
- RETURN_FALSE;
- }
-
- zend_list_delete(shmid);
-}
-/* }}} */
-
-/* {{{ proto int shmop_size (int shmid)
- returns the shm size */
-PHP_FUNCTION(shmop_size)
-{
- long shmid;
- struct php_shmop *shmop;
- int type;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- shmop = zend_list_find(shmid, &type);
-
- if (!shmop) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "no shared memory segment with an id of [%lu]", shmid);
- RETURN_FALSE;
- }
-
- RETURN_LONG(shmop->size);
-}
-/* }}} */
-
-/* {{{ proto int shmop_write (int shmid, string data, int offset)
- writes to a shared memory segment */
-PHP_FUNCTION(shmop_write)
-{
- struct php_shmop *shmop;
- int type;
- int writesize;
- long shmid, offset;
- char *data;
- int data_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsl", &shmid, &data, &data_len, &offset) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- shmop = zend_list_find(shmid, &type);
-
- if (!shmop) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "no shared memory segment with an id of [%lu]", shmid);
- RETURN_FALSE;
- }
-
- if ((shmop->shmatflg & SHM_RDONLY) == SHM_RDONLY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "trying to write to a read only segment");
- RETURN_FALSE;
- }
-
- if (offset > shmop->size) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "offset out of range");
- RETURN_FALSE;
- }
-
- writesize = (data_len < shmop->size - offset) ? data_len : shmop->size - offset;
- memcpy(shmop->addr + offset, data, writesize);
-
- RETURN_LONG(writesize);
-}
-/* }}} */
-
-/* {{{ proto bool shmop_delete (int shmid)
- mark segment for deletion */
-PHP_FUNCTION(shmop_delete)
-{
- long shmid;
- struct php_shmop *shmop;
- int type;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- shmop = zend_list_find(shmid, &type);
-
- if (!shmop) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "no shared memory segment with an id of [%lu]", shmid);
- RETURN_FALSE;
- }
-
- if (shmctl(shmop->shmid, IPC_RMID, NULL)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "can't mark segment for deletion (are you the owner?)");
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#endif /* HAVE_SHMOP */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/shmop/shmop.dsp b/ext/shmop/shmop.dsp
deleted file mode 100644
index 4915c64f1c..0000000000
--- a/ext/shmop/shmop.dsp
+++ /dev/null
@@ -1,107 +0,0 @@
-# Microsoft Developer Studio Project File - Name="shmop" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=shmop - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "shmop.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "shmop.mak" CFG="shmop - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "shmop - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "shmop - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "shmop - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SHMOP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\TSRM" /I "..\..\ZEND" /D ZEND_WIN32=1 /D PHP_WIN32=1 /D "NDEBUG" /D "PHP_EXPORTS" /D "HAVE_SHMOP" /D COMPILE_DL_SHMOP=1 /D ZEND_DEBUG=0 /D "ZTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_shmop.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "shmop - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SHMOP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\TSRM" /I "..\..\ZEND" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_EXPORTS" /D "COMPILE_DL_SHMOP" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SHMOP=1 /D ZTS=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_shmop.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "shmop - Win32 Release_TS"
-# Name "shmop - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\shmop.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_shmop.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/shmop/tests/001.phpt b/ext/shmop/tests/001.phpt
deleted file mode 100644
index 1a1b926308..0000000000
--- a/ext/shmop/tests/001.phpt
+++ /dev/null
@@ -1,91 +0,0 @@
---TEST--
-shmop extension test
---SKIPIF--
-<?php
- if (!extension_loaded("shmop")) {
- die("skip shmop() extension not avaliable");
- }
-?>
---FILE--
-<?php
- $hex_shm_id = 0xff3;
- $write_d1 = "test #1 of the shmop() extension";
- $write_d2 = "test #2 append data to shared memory segment";
-
- echo "shm open for create: ";
- $shm_id = shmop_open($hex_shm_id, "n", 0644, 1024);
- if (!$shm_id) {
- die("failed\n");
- } else {
- echo "ok\n";
- }
-
- echo "shm size is: " . ($shm_size = shmop_size($shm_id)) . "\n";
-
- echo "shm write test #1: ";
- $written = shmop_write($shm_id, $write_d1, 0);
- if ($written != strlen($write_d1)) {
- echo "failed\n";
- } else {
- echo "ok\n";
- }
-
- echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n";
-
- shmop_close($shm_id);
-
- echo "shm open for read only: ";
- $shm_id = shmop_open($hex_shm_id, "a", 0644, 1024);
- if (!$shm_id) {
- echo "failed\n";
- } else {
- echo "ok\n";
- }
-
- echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n";
-
- /* try to append data to the shared memory segment, this should fail */
- @shmop_write($shm_id, $write_d1, $written);
- echo $php_errormsg . "\n";
-
- shmop_close($shm_id);
-
- echo "shm open for read only: ";
- $shm_id = shmop_open($hex_shm_id, "w", 0644, 1024);
- if (!$shm_id) {
- echo "failed\n";
- } else {
- echo "ok\n";
- }
-
- echo "shm write test #1: ";
- $written = shmop_write($shm_id, $write_d2, $written);
- if ($written != strlen($write_d2)) {
- die("failed\n");
- } else {
- echo "ok\n";
- }
-
- echo "data in memory is: " . shmop_read($shm_id, 0, strlen($write_d1 . $write_d2)) . "\n";
-
- echo "deletion of shm segment: ";
- if (!shmop_delete($shm_id)) {
- echo "failed\n";
- } else {
- echo "ok\n";
- }
-
- shmop_close($shm_id);
-?>
---EXPECT--
-shm open for create: ok
-shm size is: 1024
-shm write test #1: ok
-data in memory is: test #1 of the shmop() extension
-shm open for read only: ok
-data in memory is: test #1 of the shmop() extension
-trying to write to a read only segment
-shm open for read only: ok
-shm write test #1: ok
-data in memory is: test #1 of the shmop() extensiontest #2 append data to shared memory segment
-deletion of shm segment: ok
diff --git a/ext/skeleton/CREDITS b/ext/skeleton/CREDITS
deleted file mode 100644
index 58fc71019a..0000000000
--- a/ext/skeleton/CREDITS
+++ /dev/null
@@ -1 +0,0 @@
-extname \ No newline at end of file
diff --git a/ext/skeleton/EXPERIMENTAL b/ext/skeleton/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/skeleton/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/skeleton/create_stubs b/ext/skeleton/create_stubs
deleted file mode 100755
index e7845c2846..0000000000
--- a/ext/skeleton/create_stubs
+++ /dev/null
@@ -1,289 +0,0 @@
-#!/usr/bin/awk -f
-
-function gobble(s, x)
-{
- sub(/^ /, "", line)
- match(line, "^" "(" s ")")
- x = substr(line, 1, RLENGTH)
- line = substr(line, RLENGTH+1)
- return x
-}
-
-function convert(i, j, t)
-{
- type = argtypes[i,j]
- name = argnames[i,j]
- opt = optionals[i,j]
- tabs = x = ""
-
- for (i = 0; i < t; i++) { tabs = tabs "\t" }
-
- if (type == "int" || type == "long") {
- longs = longs "\tlong " name ";\n"
- } else if (type == "bool" || type == "boolean") {
- bools = bools "\tzend_bool " name ";\n"
- } else if (type == "double" || type == "float") {
- doubles = doubles "\tdouble " name ";\n"
- } else if (type == "string") {
- strings = strings "\tchar *" name " = NULL;\n"
- ints = ints "\tint " name "_len;\n"
- } else if (type == "array" || type == "object" || type == "mixed") {
- zvals = zvals "\tzval *" name " = NULL;\n"
- } else if (type == "resource" || type == "handle") {
- zvals = zvals "\tzval *" name " = NULL;\n"
- resources = resources "\tif (" name ") {\n" \
- "\t\tZEND_FETCH_RESOURCE(???, ???, " name ", " name "_id, \"???\", ???_rsrc_id);\n\t}\n"
- ints = ints "\tint " name "_id = -1;\n"
- }
-}
-
-function comment(s)
-{
- if (i_know_what_to_do_shut_up_i_dont_need_your_help_mode) {
- return
- } else {
- return s
- }
-}
-
-BEGIN {
- name = "[_A-Za-z][_A-Za-z0-9]*"
- type = "int|long|double|float|string|bool|boolean|array|object|resource|handle|mixed|void"
- spec = "l|l|d|d|s|b|b|a|o|r|r|z|"
- num_funcs = 0
-
-# create a map from type name to the spec
- split(type, type_array, "\|")
- split(spec, spec_array, "\|")
- for (i in type_array) {
- spec_map[type_array[i]] = spec_array[i]
- }
-
- if (xml && xml != "yes") {
- xmldoc = xml
- } else {
- xmldoc = extname "/" extname ".xml"
- }
-
-
- xmlhead = "<?xml version='1.0' encoding='iso-8859-1'?>\n" \
- "<!-- $Revision$ -->\n" \
- " <reference id=\"ref." extname "\">\n" \
- " <title> functions</title>\n" \
- " <titleabbrev></titleabbrev>\n\n" \
- " <partintro>\n" \
- " &warn.experimental;\n" \
- " <para>\n" \
- " </para>\n" \
- " </partintro>\n\n";
-
- xmlfoot = " </reference>\n\n" \
- "<!-- Keep this comment at the end of the file\n" \
- "Local variables:\n" \
- "mode: sgml\n" \
- "sgml-omittag:t\n" \
- "sgml-shorttag:t\n" \
- "sgml-minimize-attributes:nil\n" \
- "sgml-always-quote-attributes:t\n" \
- "sgml-indent-step:1\n" \
- "sgml-indent-data:t\n" \
- "indent-tabs-mode:nil\n" \
- "sgml-parent-document:nil\n" \
- "sgml-default-dtd-file:\"../../manual.ced\"\n" \
- "sgml-exposed-tags:nil\n" \
- "sgml-local-catalogs:nil\n" \
- "sgml-local-ecat-files:nil\n" \
- "End:\n" \
- "vim600: syn=xml fen fdm=syntax fdl=2 si\n" \
- "vim: et tw=78 syn=sgml\n" \
- "vi: ts=1 sw=1\n" \
- "-->\n"
-}
-
-{
- args_max = args_min = optional = i = spec_opt = 0
- line = $0
- spec_str = "\""
-
-## php extension must use lower case function names.
-## this will translate any capitalized letter to lowercase
-## and warn the user
- if (match(func_name,"[A-Z]") != 0) {
- printf("NOTICE: lower casing function name '%s'\n",func_name)
- func_name = tolower(func_name)
- }
- func_type = gobble(type);
- func_name = gobble(name);
-
- if (gobble("\\(")) {
- if (gobble("\\[")) optional = 1
- while (arg_type = gobble(type)) {
- arg_name = gobble(name)
- if(arg_type == "void") {
- args_max = 0;
- args_min = 0;
- break;
- } else {
- argtypes[num_funcs,args_max] = arg_type
- argnames[num_funcs,args_max] = arg_name
-
- args_max++
- if (optional) {
- if (!spec_opt) {
- spec_str = spec_str "|"
- spec_opt = 1
- }
- optionals[num_funcs,i] = optional
- } else {
- args_min++
- }
- spec_str = spec_str spec_map[arg_type]
-
- if (x = gobble("\\[")) {
- optional++
- }
-
- y = gobble(",")
- if (!x && y && optional) {
- grouped_optional_param[num_funcs,i] = 1
- }
- i++
- }
- }
- }
-
-# if (x = gobble("\\)")) {
- gobble("\\]* *)")
- sub(/^[ \t]+/, "", line)
- fcomments[num_funcs] = line
-# }
-
- spec_str = spec_str "\""
-
- funcs[num_funcs] = func_name
- types[num_funcs] = func_type
- maxargs[num_funcs] = args_max
- minargs[num_funcs] = args_min
- specs[num_funcs] = spec_str
- spec_opts[num_funcs] = spec_opt
-
- num_funcs++
-}
-
-END {
- if (xml) print xmlhead > xmldoc
- for (i = 0; i < num_funcs; i++) {
- compareargc = maxargs[i] - minargs[i]
- closefetch = fetchargs = zvals = xmlparams = funcvals = resources = handleargs = closeopts = ""
- ints = longs = doubles = strings = bools = zvals = ""
-
- proto = "/* {{{ proto " types[i] " " funcs[i] "("
-
- refid = funcs[i]
- gsub(/_/, "-", refid)
- xmlstr = " <refentry id=\"function." refid "\">\n" \
- " <refnamediv>\n" \
- " <refname>" funcs[i] "</refname>\n" \
- " <refpurpose>" fcomments[i] "</refpurpose>\n" \
- " </refnamediv>\n" \
- " <refsect1>\n" \
- " <title>Description</title>\n" \
- " <funcsynopsis>\n" \
- " <funcprototype>\n" \
- " <funcdef>" types[i] " <function>" funcs[i] "</function></funcdef>\n"
-
- if (maxargs[i]>0) {
- fetchargs = "\tif (zend_parse_parameters("
- ints = ints "\tint argc = ZEND_NUM_ARGS();\n"
- fetchargs = fetchargs "argc TSRMLS_CC, " specs[i]
- } else {
- fetchargs = fetchargs "\tif (ZEND_NUM_ARGS() != 0) {\n\t\tWRONG_PARAM_COUNT;\n\t}"
- xmlparams = xmlparams " <void/>\n"
- }
-
- for (j = 0; j < maxargs[i]; j++) {
-
- fetchargs = fetchargs ", "
-
- fetchargs = fetchargs "&" argnames[i,j]
- if (argtypes[i,j] == "string") {
- fetchargs = fetchargs ", &" argnames[i,j] "_len"
- }
-
- xmlparams = xmlparams " <paramdef>" argtypes[i,j]
- if (j > minargs[i]-1) {
- if (!grouped_optional_param[i,j-1]) {
- if (j > 0) proto = proto " "
- proto = proto "["
- closeopts = closeopts "]"
- }
- xmlparams = xmlparams "\n <parameter><optional>" \
- argnames[i,j] \
- "</optional></parameter>\n </paramdef>\n"
- } else {
- xmlparams = xmlparams \
- " <parameter>" \
- argnames[i,j] \
- "</parameter></paramdef>\n"
- }
-
- if (j > 0) proto = proto ", "
- proto = proto argtypes[i,j] " " argnames[i,j]
-
- convert(i, j, 1)
- }
-
- proto = proto closeopts ")\n " fcomments[i] " */\nPHP_FUNCTION(" funcs[i] ")\n{"
- if (maxargs[i]>0) {
- fetchargs = fetchargs ") == FAILURE)" closefetch " \n\t\treturn;\n"
- }
- funcvals = strings ints longs doubles bools zvals
- xmlstr = xmlstr xmlparams \
- " </funcprototype>\n" \
- " </funcsynopsis>\n" \
- " &warn.experimental.func;\n" \
- " <para>\n" \
- " &warn.undocumented.func;\n" \
- " </para>\n" \
- " </refsect1>\n" \
- " </refentry>\n"
-
- print proto > stubfile
- if (funcvals) print funcvals > stubfile
- if (fetchargs) print fetchargs > stubfile
- if (resources) {
- print resources > stubfile
- if (!stubs) print "" > extname "/function_warning"
- }
- if (!i_know_what_to_do_shut_up_i_dont_need_your_help_mode) {
- print "\tphp_error(E_WARNING, \"" funcs[i] ": not yet implemented\");" > stubfile
- }
- print "}\n/* }}} */\n" > stubfile
-
- if (stubs) {
- h_stubs = h_stubs "PHP_FUNCTION(" funcs[i] ");\n"
- c_stubs = c_stubs "\tPHP_FE(" funcs[i] ",\tNULL)\n"
- } else {
- print "PHP_FUNCTION(" funcs[i] ");" > extname "/function_declarations"
- print "\tPHP_FE(" funcs[i] ",\tNULL)" > extname "/function_entries"
- }
-
- if (xml) print xmlstr > xmldoc
- }
-
- if (stubs) {
- print "\n/* ----------------------------------------------------------- */\n" > stubfile
- print c_stubs > stubfile
- print "\n/* ----------------------------------------------------------- */\n" > stubfile
- print h_stubs > stubfile
- }
-
- if (xml) print xmlfoot > xmldoc
-}
-
-#
-# Local variables:
-# tab-width: 2
-# c-basic-offset: 2
-# End:
-
diff --git a/ext/skeleton/php_skeleton.h b/ext/skeleton/php_skeleton.h
deleted file mode 100644
index 76ad225754..0000000000
--- a/ext/skeleton/php_skeleton.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* __header_here__ */
-
-#ifndef PHP_EXTNAME_H
-#define PHP_EXTNAME_H
-
-extern zend_module_entry extname_module_entry;
-#define phpext_extname_ptr &extname_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_EXTNAME_API __declspec(dllexport)
-#else
-#define PHP_EXTNAME_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-PHP_MINIT_FUNCTION(extname);
-PHP_MSHUTDOWN_FUNCTION(extname);
-PHP_RINIT_FUNCTION(extname);
-PHP_RSHUTDOWN_FUNCTION(extname);
-PHP_MINFO_FUNCTION(extname);
-
-PHP_FUNCTION(confirm_extname_compiled); /* For testing, remove later. */
-/* __function_declarations_here__ */
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-
-ZEND_BEGIN_MODULE_GLOBALS(extname)
- long global_value;
- char *global_string;
-ZEND_END_MODULE_GLOBALS(extname)
-*/
-
-/* In every utility function you add that needs to use variables
- in php_extname_globals, call TSRM_FETCH(); after declaring other
- variables used by that function, or better yet, pass in TSRMLS_CC
- after the last function argument and declare your utility function
- with TSRMLS_DC after the last declared argument. Always refer to
- the globals in your function as EXTNAME_G(variable). You are
- encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define EXTNAME_G(v) TSRMG(extname_globals_id, zend_extname_globals *, v)
-#else
-#define EXTNAME_G(v) (extname_globals.v)
-#endif
-
-#endif /* PHP_EXTNAME_H */
-
-/* __footer_here__ */
diff --git a/ext/skeleton/skeleton.c b/ext/skeleton/skeleton.c
deleted file mode 100644
index 021b76e789..0000000000
--- a/ext/skeleton/skeleton.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/* __header_here__ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_extname.h"
-
-/* If you declare any globals in php_extname.h uncomment this:
-ZEND_DECLARE_MODULE_GLOBALS(extname)
-*/
-
-/* True global resources - no need for thread safety here */
-static int le_extname;
-
-/* {{{ extname_functions[]
- *
- * Every user visible function must have an entry in extname_functions[].
- */
-function_entry extname_functions[] = {
- PHP_FE(confirm_extname_compiled, NULL) /* For testing, remove later. */
- /* __function_entries_here__ */
- {NULL, NULL, NULL} /* Must be the last line in extname_functions[] */
-};
-/* }}} */
-
-/* {{{ extname_module_entry
- */
-zend_module_entry extname_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
- "extname",
- extname_functions,
- PHP_MINIT(extname),
- PHP_MSHUTDOWN(extname),
- PHP_RINIT(extname), /* Replace with NULL if there's nothing to do at request start */
- PHP_RSHUTDOWN(extname), /* Replace with NULL if there's nothing to do at request end */
- PHP_MINFO(extname),
-#if ZEND_MODULE_API_NO >= 20010901
- "0.1", /* Replace with version number for your extension */
-#endif
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_EXTNAME
-ZEND_GET_MODULE(extname)
-#endif
-
-/* {{{ PHP_INI
- */
-/* Remove comments and fill if you need to have entries in php.ini
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("extname.global_value", "42", PHP_INI_ALL, OnUpdateLong, global_value, zend_extname_globals, extname_globals)
- STD_PHP_INI_ENTRY("extname.global_string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_extname_globals, extname_globals)
-PHP_INI_END()
-*/
-/* }}} */
-
-/* {{{ php_extname_init_globals
- */
-/* Uncomment this function if you have INI entries
-static void php_extname_init_globals(zend_extname_globals *extname_globals)
-{
- extname_globals->global_value = 0;
- extname_globals->global_string = NULL;
-}
-*/
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(extname)
-{
- /* If you have INI entries, uncomment these lines
- ZEND_INIT_MODULE_GLOBALS(extname, php_extname_init_globals, NULL);
- REGISTER_INI_ENTRIES();
- */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(extname)
-{
- /* uncomment this line if you have INI entries
- UNREGISTER_INI_ENTRIES();
- */
- return SUCCESS;
-}
-/* }}} */
-
-/* Remove if there's nothing to do at request start */
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(extname)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* Remove if there's nothing to do at request end */
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(extname)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(extname)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "extname support", "enabled");
- php_info_print_table_end();
-
- /* Remove comments if you have entries in php.ini
- DISPLAY_INI_ENTRIES();
- */
-}
-/* }}} */
-
-
-/* Remove the following function when you have succesfully modified config.m4
- so that your module can be compiled into PHP, it exists only for testing
- purposes. */
-
-/* Every user-visible function in PHP should document itself in the source */
-/* {{{ proto string confirm_extname_compiled(string arg)
- Return a string to confirm that the module is compiled in */
-PHP_FUNCTION(confirm_extname_compiled)
-{
- char *arg = NULL;
- int arg_len, len;
- char string[256];
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) {
- return;
- }
-
- len = sprintf(string, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "extname", arg);
- RETURN_STRINGL(string, len, 1);
-}
-/* }}} */
-/* The previous line is meant for vim and emacs, so it can correctly fold and
- unfold functions in source code. See the corresponding marks just before
- function definition, where the functions purpose is also documented. Please
- follow this convention for the convenience of others editing your code.
-*/
-
-/* __function_stubs_here__ */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/skeleton/skeleton.dsp b/ext/skeleton/skeleton.dsp
deleted file mode 100644
index 5f84019f21..0000000000
--- a/ext/skeleton/skeleton.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="extname" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=extname - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "extname.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "extname.mak" CFG="extname - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "extname - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "extname - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "extname - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXTNAME" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXTNAME_EXPORTS" /D "COMPILE_DL_EXTNAME" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXTNAME=1 /D "LIBZEND_EXPORTS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/extname.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "extname - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXTNAME" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXTNAME_EXPORTS" /D "COMPILE_DL_EXTNAME" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXTNAME=1 /D "LIBZEND_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/extname.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "extname - Win32 Release_TS"
-# Name "extname - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\extname.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_extname.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/skeleton/skeleton.php b/ext/skeleton/skeleton.php
deleted file mode 100644
index 12e1e64bb4..0000000000
--- a/ext/skeleton/skeleton.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?
-if(!extension_loaded('extname')) {
- dl('extname.' . PHP_SHLIB_SUFFIX);
-}
-$module = 'extname';
-$functions = get_extension_funcs($module);
-echo "Functions available in the test extension:<br>\n";
-foreach($functions as $func) {
- echo $func."<br>\n";
-}
-echo "<br>\n";
-$function = 'confirm_' . $module . '_compiled';
-if (extension_loaded($module)) {
- $str = $function($module);
-} else {
- $str = "Module $module is not compiled into PHP";
-}
-echo "$str\n";
-?>
diff --git a/ext/skeleton/tests/001.phpt b/ext/skeleton/tests/001.phpt
deleted file mode 100644
index 7ef8472db3..0000000000
--- a/ext/skeleton/tests/001.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Check for extname presence
---SKIPIF--
-<?php if (!extension_loaded("extname")) print "skip"; ?>
---POST--
---GET--
---INI--
---FILE--
-<?php
-echo "extname extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php4/README.TESTING for further information on
- writing regression tests
-*/
-?>
---EXPECT--
-extname extension is available
diff --git a/ext/snmp/CREDITS b/ext/snmp/CREDITS
deleted file mode 100644
index 067911cbb4..0000000000
--- a/ext/snmp/CREDITS
+++ /dev/null
@@ -1,3 +0,0 @@
-SNMP
-Rasmus Lerdorf
-Harrie Hazewinkel
diff --git a/ext/snmp/config.m4 b/ext/snmp/config.m4
deleted file mode 100644
index d8a5ad5d3e..0000000000
--- a/ext/snmp/config.m4
+++ /dev/null
@@ -1,123 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(snmp,for SNMP support,
-[ --with-snmp[=DIR] Include SNMP support.])
-
-if test "$PHP_SNMP" != "no"; then
-
- dnl
- dnl Try net-snmp first
- dnl
- if test "$PHP_SNMP" = "yes"; then
- AC_PATH_PROG(SNMP_CONFIG,net-snmp-config,,[/usr/local/bin:$PATH])
- else
- SNMP_CONFIG="$PHP_SNMP/bin/net-snmp-config"
- fi
-
- if test -x "$SNMP_CONFIG"; then
- SNMP_LIBS=`$SNMP_CONFIG --netsnmp-libs`
- SNMP_LIBS="$SNMP_LIBS `$SNMP_CONFIG --external-libs`"
- SNMP_PREFIX=`$SNMP_CONFIG --prefix`
-
- if test -n "$SNMP_LIBS" && test -n "$SNMP_PREFIX"; then
- PHP_ADD_INCLUDE(${SNMP_PREFIX}/include)
- PHP_EVAL_LIBLINE($SNMP_LIBS, SNMP_SHARED_LIBADD)
- AC_DEFINE(HAVE_NET_SNMP,1,[ ])
- SNMP_LIBNAME=netsnmp
- else
- AC_MSG_ERROR([Could not find the required paths. Please check your net-snmp installation.])
- fi
- else
-
- dnl
- dnl Try ucd-snmp if net-snmp test failed
- dnl
-
- if test "$PHP_SNMP" = "yes"; then
- for i in /usr/include /usr/local/include; do
- test -f $i/snmp.h && SNMP_INCDIR=$i
- test -f $i/ucd-snmp/snmp.h && SNMP_INCDIR=$i/ucd-snmp
- test -f $i/snmp/snmp.h && SNMP_INCDIR=$i/snmp
- test -f $i/snmp/include/ucd-snmp/snmp.h && SNMP_INCDIR=$i/snmp/include/ucd-snmp
- done
- for i in /usr /usr/snmp /usr/local /usr/local/snmp; do
- test -f $i/lib/libsnmp.a -o -f $i/lib/libsnmp.$SHLIB_SUFFIX_NAME && SNMP_LIBDIR=$i/lib
- done
- else
- SNMP_INCDIR=$PHP_SNMP/include
- test -d $PHP_SNMP/include/ucd-snmp && SNMP_INCDIR=$PHP_SNMP/include/ucd-snmp
- SNMP_LIBDIR=$PHP_SNMP/lib
- fi
-
- if test -z "$SNMP_INCDIR"; then
- AC_MSG_ERROR(snmp.h not found. Check your SNMP installation.)
- elif test -z "$SNMP_LIBDIR"; then
- AC_MSG_ERROR(libsnmp not found. Check your SNMP installation.)
- fi
-
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS=-I$SNMP_INCDIR
- AC_CHECK_HEADERS(default_store.h)
- if test "$ac_cv_header_default_store_h" = "yes"; then
- AC_MSG_CHECKING(for OpenSSL support in SNMP libraries)
- AC_EGREP_CPP(yes,[
-#include <ucd-snmp-config.h>
-#if USE_OPENSSL
- yes
-#endif
- ],[
- SNMP_SSL=yes
- ],[
- SNMP_SSL=no
- ])
- fi
- CPPFLAGS=$old_CPPFLAGS
- AC_MSG_RESULT($SNMP_SSL)
-
- if test "$SNMP_SSL" = "yes"; then
- if test "$PHP_OPENSSL" != "no"; then
- PHP_ADD_LIBRARY(ssl, 1, SNMP_SHARED_LIBADD)
- PHP_ADD_LIBRARY(crypto,1, SNMP_SHARED_LIBADD)
- else
- AC_MSG_ERROR(The UCD-SNMP in this system is built with SSL support.
-
- Add --with-openssl<=DIR> to your configure line.)
- fi
- fi
-
- AC_CHECK_LIB(kstat, kstat_read, [ PHP_ADD_LIBRARY(kstat,,SNMP_SHARED_LIBADD) ])
- PHP_ADD_INCLUDE($SNMP_INCDIR)
- PHP_ADD_LIBRARY_WITH_PATH(snmp, $SNMP_LIBDIR, SNMP_SHARED_LIBADD)
- SNMP_LIBNAME=snmp
- fi
-
- AC_CHECK_FUNCS(snmp_parse_oid)
-
- PHP_CHECK_LIBRARY($SNMP_LIBNAME, init_snmp,
- [
- AC_DEFINE(HAVE_SNMP,1,[ ])
- ], [
- AC_MSG_ERROR([SNMP sanity check failed. Please check config.log for more information.])
- ], [
- $SNMP_SHARED_LIBADD
- ])
-
- PHP_NEW_EXTENSION(snmp, snmp.c, $ext_shared)
- PHP_SUBST(SNMP_SHARED_LIBADD)
-fi
-
-
-AC_MSG_CHECKING(whether to enable UCD SNMP hack)
-AC_ARG_ENABLE(ucd-snmp-hack,
-[ --enable-ucd-snmp-hack Enable UCD SNMP hack],[
- if test "$enableval" = "yes" ; then
- AC_DEFINE(UCD_SNMP_HACK, 1, [ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
diff --git a/ext/snmp/php_snmp.h b/ext/snmp/php_snmp.h
deleted file mode 100644
index d2e52da884..0000000000
--- a/ext/snmp/php_snmp.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Mike Jackson <mhjack@tscnet.com> |
- | Steven Lawrance <slawrance@technologist.com> |
- | Harrie Hazewinkel <harrie@lisanza.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SNMP_H
-#define PHP_SNMP_H
-
-#if HAVE_SNMP
-
-#ifndef DLEXPORT
-#define DLEXPORT
-#endif
-
-extern zend_module_entry snmp_module_entry;
-#define snmp_module_ptr &snmp_module_entry
-
-PHP_MINIT_FUNCTION(snmp);
-PHP_MINFO_FUNCTION(snmp);
-
-PHP_FUNCTION(snmpget);
-PHP_FUNCTION(snmpwalk);
-PHP_FUNCTION(snmprealwalk);
-PHP_FUNCTION(snmp_get_quick_print);
-PHP_FUNCTION(snmp_set_quick_print);
-PHP_FUNCTION(snmp_set_enum_print);
-PHP_FUNCTION(snmp_set_oid_numeric_print);
-PHP_FUNCTION(snmpset);
-
-PHP_FUNCTION(snmp3_get);
-PHP_FUNCTION(snmp3_walk);
-PHP_FUNCTION(snmp3_real_walk);
-PHP_FUNCTION(snmp3_set);
-
-#else
-
-#define snmp_module_ptr NULL
-
-#endif /* HAVE_SNMP */
-
-#define phpext_snmp_ptr snmp_module_ptr
-
-#endif /* PHP_SNMP_H */
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
deleted file mode 100644
index ad76753633..0000000000
--- a/ext/snmp/snmp.c
+++ /dev/null
@@ -1,893 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Mike Jackson <mhjack@tscnet.com> |
- | Steven Lawrance <slawrance@technologist.com> |
- | Harrie Hazewinkel <harrie@lisanza.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/info.h"
-#include "php_snmp.h"
-
-#if HAVE_SNMP
-
-#include <sys/types.h>
-#ifdef PHP_WIN32
-#include <winsock2.h>
-#include <errno.h>
-#include <process.h>
-#include "win32/time.h"
-#elif defined(NETWARE)
-#ifdef USE_WINSOCK
-/*#include <ws2nlm.h>*/
-#include <novsock2.h>
-#else
-#include <sys/socket.h>
-#endif
-#include <errno.h>
-/*#include <process.h>*/
-#ifdef NEW_LIBC
-#include <sys/timeval.h>
-#else
-#include "netware/time_nw.h"
-#endif
-#else
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#ifndef _OSD_POSIX
-#include <sys/errno.h>
-#else
-#include <errno.h> /* BS2000/OSD uses <errno.h>, not <sys/errno.h> */
-#endif
-#include <netdb.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifndef __P
-#ifdef __GNUC__
-#define __P(args) args
-#else
-#define __P(args) ()
-#endif
-#endif
-
-#ifdef HAVE_NET_SNMP
-#include <net-snmp/net-snmp-config.h>
-#include <net-snmp/net-snmp-includes.h>
-#else
-#ifdef HAVE_DEFAULT_STORE_H
-#include "default_store.h"
-#endif
-#include "asn1.h"
-#include "snmp_api.h"
-#include "snmp_client.h"
-#include "snmp_impl.h"
-#include "snmp.h"
-#include "snmpv3.h"
-#include "keytools.h"
-#include "parse.h"
-#include "mib.h"
-#include "version.h"
-#include "transform_oids.h"
-#endif
-/* Ugly macro, since the length of OIDs in UCD-SNMP and NET-SNMP
- * is different and this way the code is not full of 'ifdef's.
- */
-#define OIDSIZE(p) (sizeof(p)/sizeof(oid))
-
-/* For really old ucd-snmp versions.. */
-#ifndef HAVE_SNMP_PARSE_OID
-#define snmp_parse_oid read_objid
-#endif
-
-/* ucd-snmp 3.3.1 changed the name of a few #defines... They've been changed back to the original ones in 3.5.3! */
-#ifndef SNMP_MSG_GET
-#define SNMP_MSG_GET GET_REQ_MSG
-#define SNMP_MSG_GETNEXT GETNEXT_REQ_MSG
-#endif
-
-/* constant - can be shared among threads */
-static oid objid_mib[] = {1, 3, 6, 1, 2, 1};
-
-/* {{{ snmp_functions[]
- */
-function_entry snmp_functions[] = {
- PHP_FE(snmpget, NULL)
- PHP_FE(snmpwalk, NULL)
- PHP_FE(snmprealwalk, NULL)
- PHP_FALIAS(snmpwalkoid, snmprealwalk, NULL)
- PHP_FE(snmp_get_quick_print, NULL)
- PHP_FE(snmp_set_quick_print, NULL)
-#ifdef HAVE_NET_SNMP
- PHP_FE(snmp_set_enum_print, NULL)
- PHP_FE(snmp_set_oid_numeric_print, NULL)
-#endif
- PHP_FE(snmpset, NULL)
-
- PHP_FE(snmp3_get, NULL)
- PHP_FE(snmp3_walk, NULL)
- PHP_FE(snmp3_real_walk, NULL)
- PHP_FE(snmp3_set, NULL)
- {NULL,NULL,NULL}
-};
-/* }}} */
-
-/* {{{ snmp_module_entry
- */
-zend_module_entry snmp_module_entry = {
- STANDARD_MODULE_HEADER,
- "snmp",
- snmp_functions,
- PHP_MINIT(snmp),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(snmp),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_SNMP
-ZEND_GET_MODULE(snmp)
-#endif
-
-/* THREAD_LS snmp_module php_snmp_module; - may need one of these at some point */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(snmp)
-{
- init_snmp("snmpapp");
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(snmp)
-{
- php_info_print_table_start();
-#ifdef HAVE_NET_SNMP
- php_info_print_table_row(2, "NET-SNMP Support", "enabled");
- php_info_print_table_row(2, "NET-SNMP Version", netsnmp_get_version());
-#else
- php_info_print_table_row(2, "UCD-SNMP Support", "enabled");
- php_info_print_table_row(2, "UCD-SNMP Version", VersionInfo);
-#endif
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ php_snmp_internal
-*
-* Generic SNMP object fetcher (for both v3 and v1)
-*
-* st=1 snmpget() - query an agent and return a single value.
-* st=2 snmpwalk() - walk the mib and return a single dimensional array
-* containing the values.
-* st=3 snmprealwalk() and snmpwalkoid() - walk the mib and return an
-* array of oid,value pairs.
-* st=5-8 ** Reserved **
-* st=11 snmpset() - query an agent and set a single value
-*
-*/
-static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, int st,
- struct snmp_session *session,
- char *objid,
- char type,
- char* value)
-{
- struct snmp_session *ss;
- struct snmp_pdu *pdu=NULL, *response;
- struct variable_list *vars;
- oid name[MAX_NAME_LEN];
- int name_length;
- oid root[MAX_NAME_LEN];
- int rootlen = 0;
- int gotroot = 0;
- int status, count;
- char buf[2048];
- char buf2[2048];
- int keepwalking=1;
- char *err;
-
- if (st >= 2) { /* walk */
- rootlen = MAX_NAME_LEN;
- if (strlen(objid)) { /* on a walk, an empty string means top of tree - no error */
- if (read_objid(objid, root, &rootlen)) {
- gotroot = 1;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid object identifier: %s", objid);
- }
- }
-
- if (!gotroot) {
- memmove((char *) root, (char *) objid_mib, sizeof(objid_mib));
- rootlen = sizeof(objid_mib) / sizeof(oid);
- gotroot = 1;
- }
- }
-
- if ((ss = snmp_open(session)) == NULL) {
- snmp_error(session, NULL, NULL, &err);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not open snmp connection: %s", err);
- free(err);
- RETURN_FALSE;
- }
-
- if (st >= 2) {
- memmove((char *)name, (char *)root, rootlen * sizeof(oid));
- name_length = rootlen;
- switch(st) {
- case 2:
- case 3:
- array_init(return_value);
- break;
- default:
- RETVAL_TRUE;
- break;
- }
- }
-
- while (keepwalking) {
- keepwalking = 0;
- if (st == 1) {
- pdu = snmp_pdu_create(SNMP_MSG_GET);
- name_length = MAX_OID_LEN;
- if (!snmp_parse_oid(objid, name, &name_length)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid object identifier: %s", objid);
- snmp_close(ss);
- RETURN_FALSE;
- }
- snmp_add_null_var(pdu, name, name_length);
- } else if (st == 11) {
- pdu = snmp_pdu_create(SNMP_MSG_SET);
- if (snmp_add_var(pdu, name, name_length, type, value)) {
-#ifdef HAVE_NET_SNMP
- snprint_objid(buf, sizeof(buf), name, name_length);
-#else
- sprint_objid(buf, name, name_length);
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not add variable: %s %c %s", buf, type, value);
- snmp_close(ss);
- RETURN_FALSE;
- }
- } else if (st >= 2) {
- pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
- snmp_add_null_var(pdu, name, name_length);
- }
-
-retry:
- status = snmp_synch_response(ss, pdu, &response);
- if (status == STAT_SUCCESS) {
- if (response->errstat == SNMP_ERR_NOERROR) {
- for (vars = response->variables; vars; vars = vars->next_variable) {
- if (st >= 2 && st != 11 &&
- (vars->name_length < rootlen || memcmp(root, vars->name, rootlen * sizeof(oid)))) {
- continue; /* not part of this subtree */
- }
-
- if (st != 11) {
-#ifdef HAVE_NET_SNMP
- snprint_value(buf, sizeof(buf), vars->name, vars->name_length, vars);
-#else
- sprint_value(buf,vars->name, vars->name_length, vars);
-#endif
- }
-
- if (st == 1) {
- RETVAL_STRING(buf,1);
- } else if (st == 2) {
- add_next_index_string(return_value,buf,1); /* Add to returned array */
- } else if (st == 3) {
-#ifdef HAVE_NET_SNMP
- snprint_objid(buf2, sizeof(buf2), vars->name, vars->name_length);
-#else
- sprint_objid(buf2, vars->name, vars->name_length);
-#endif
- add_assoc_string(return_value,buf2,buf,1);
- }
- if (st >= 2 && st != 11) {
- if (vars->type != SNMP_ENDOFMIBVIEW &&
- vars->type != SNMP_NOSUCHOBJECT && vars->type != SNMP_NOSUCHINSTANCE) {
- memmove((char *)name, (char *)vars->name,vars->name_length * sizeof(oid));
- name_length = vars->name_length;
- keepwalking = 1;
- }
- }
- }
- } else {
- if (st != 2 || response->errstat != SNMP_ERR_NOSUCHNAME) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error in packet: %s", snmp_errstring(response->errstat));
- if (response->errstat == SNMP_ERR_NOSUCHNAME) {
- for (count=1, vars = response->variables; vars && count != response->errindex;
- vars = vars->next_variable, count++);
- if (vars) {
-#ifdef HAVE_NET_SNMP
- snprint_objid(buf, sizeof(buf), vars->name, vars->name_length);
-#else
- sprint_objid(buf,vars->name, vars->name_length);
-#endif
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This name does not exist: %s",buf);
- }
- if (st == 1) {
- if ((pdu = snmp_fix_pdu(response, SNMP_MSG_GET)) != NULL) {
- goto retry;
- }
- } else if (st == 11) {
- if ((pdu = snmp_fix_pdu(response, SNMP_MSG_SET)) != NULL) {
- goto retry;
- }
- } else if (st >= 2) {
- if ((pdu = snmp_fix_pdu(response, SNMP_MSG_GETNEXT)) != NULL) {
- goto retry;
- }
- }
- snmp_close(ss);
- RETURN_FALSE;
- }
- }
- } else if (status == STAT_TIMEOUT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No response from %s", session->peername);
- if (st == 2 || st == 3) {
- zval_dtor(return_value);
- }
- snmp_close(ss);
- RETURN_FALSE;
- } else { /* status == STAT_ERROR */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred, quitting");
- if (st == 2 || st == 3) {
- zval_dtor(return_value);
- }
- snmp_close(ss);
- RETURN_FALSE;
- }
- if (response) {
- snmp_free_pdu(response);
- }
- } /* keepwalking */
- snmp_close(ss);
-}
-/* }}} */
-
-/* {{{ php_snmp
-*
-* Generic SNMPv1 handler
-* This function makes use of the internal SNMP object fetcher.
-* The object fetcher is shared with SNMPv3.
-*
-* st=1 snmpget() - query an agent and return a single value.
-* st=2 snmpwalk() - walk the mib and return a single dimensional array
-* containing the values.
-* st=3 snmprealwalk() and snmpwalkoid() - walk the mib and return an
-* array of oid,value pairs.
-* st=5-8 ** Reserved **
-* st=11 snmpset() - query an agent and set a single value
-*
-*/
-static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st)
-{
- zval **a1, **a2, **a3, **a4, **a5, **a6, **a7;
- struct snmp_session session;
- long timeout=SNMP_DEFAULT_TIMEOUT;
- long retries=SNMP_DEFAULT_RETRIES;
- int myargc = ZEND_NUM_ARGS();
- char type = (char) 0;
- char *value = (char *) 0;
- char hostname[MAX_NAME_LEN];
- int remote_port = 161;
- char *pptr;
-
- if (myargc < 3 || myargc > 7 ||
- zend_get_parameters_ex(myargc, &a1, &a2, &a3, &a4, &a5, &a6, &a7) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(a1);
- convert_to_string_ex(a2);
- convert_to_string_ex(a3);
-
- if (st == 11) {
- if (myargc < 5) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(a4);
- convert_to_string_ex(a5);
-
- if(myargc > 5) {
- convert_to_long_ex(a6);
- timeout = Z_LVAL_PP(a6);
- }
-
- if(myargc > 6) {
- convert_to_long_ex(a7);
- retries = Z_LVAL_PP(a7);
- }
-
- type = Z_STRVAL_PP(a4)[0];
- value = Z_STRVAL_PP(a5);
- } else {
- if(myargc > 3) {
- convert_to_long_ex(a4);
- timeout = Z_LVAL_PP(a4);
- }
-
- if(myargc > 4) {
- convert_to_long_ex(a5);
- retries = Z_LVAL_PP(a5);
- }
- }
-
- snmp_sess_init(&session);
- strcpy (hostname, Z_STRVAL_PP(a1));
- if ((pptr = strchr (hostname, ':'))) {
- remote_port = strtol (pptr + 1, NULL, 0);
- *pptr = 0;
- }
-
- session.peername = hostname;
- session.remote_port = remote_port;
- session.version = SNMP_VERSION_1;
- /*
- * FIXME: potential memory leak
- * This is a workaround for an "artifact" (Mike Slifcak)
- * in (at least) ucd-snmp 3.6.1 which frees
- * memory it did not allocate
- */
-#ifdef UCD_SNMP_HACK
- session.community = (u_char *)strdup(Z_STRVAL_PP(a2)); /* memory freed by SNMP library, strdup NOT estrdup */
-#else
- session.community = (u_char *)Z_STRVAL_PP(a2);
-#endif
- session.community_len = Z_STRLEN_PP(a2);
- session.retries = retries;
- session.timeout = timeout;
-
- session.authenticator = NULL;
-
- php_snmp_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU, st, &session, Z_STRVAL_PP(a3), type, value);
-}
-/* }}} */
-
-/* {{{ proto string snmpget(string host, string community, string object_id [, int timeout [, int retries]])
- Fetch a SNMP object */
-PHP_FUNCTION(snmpget)
-{
- php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ proto array snmpwalk(string host, string community, string object_id [, int timeout [, int retries]])
- Return all objects under the specified object id */
-PHP_FUNCTION(snmpwalk)
-{
- php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,2);
-}
-/* }}} */
-
-/* {{{ proto array snmprealwalk(string host, string community, string object_id [, int timeout [, int retries]])
- Return all objects including their respective object id withing the specified one */
-PHP_FUNCTION(snmprealwalk)
-{
- php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,3);
-}
-/* }}} */
-
-/* {{{ proto bool snmp_get_quick_print(void)
- Return the current status of quick_print */
-PHP_FUNCTION(snmp_get_quick_print)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
-#ifdef HAVE_NET_SNMP
- RETURN_BOOL(netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT));
-#else
- RETURN_BOOL(snmp_get_quick_print());
-#endif
-}
-/* }}} */
-
-/* {{{ proto void snmp_set_quick_print(int quick_print)
- Return all objects including their respective object id withing the specified one */
-PHP_FUNCTION(snmp_set_quick_print)
-{
- int argc = ZEND_NUM_ARGS();
- long a1;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "l", &a1) == FAILURE) {
- return;
- }
-
-#ifdef HAVE_NET_SNMP
- netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT, (int) a1);
-#else
- snmp_set_quick_print((int)a1);
-#endif
-}
-/* }}} */
-
-#ifdef HAVE_NET_SNMP
-/* {{{ proto void snmp_set_enum_print(int enum_print)
- Return all values that are enums with their enum value instead of the raw integer */
-PHP_FUNCTION(snmp_set_enum_print)
-{
- int argc = ZEND_NUM_ARGS();
- long a1;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "l", &a1) == FAILURE) {
- return;
- }
-
- netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM, (int) a1);
-}
-/* }}} */
-
-/* {{{ proto void snmp_set_oid_numeric_print(int oid_numeric_print)
- Return all objects including their respective object id withing the specified one */
-PHP_FUNCTION(snmp_set_oid_numeric_print)
-{
- int argc = ZEND_NUM_ARGS();
- long a1;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "l", &a1) == FAILURE) {
- return;
- }
- if ((int) a1 != 0) {
- netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
- NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
- NETSNMP_OID_OUTPUT_NUMERIC);
- }
-}
-/* }}} */
-#endif
-
-/* {{{ proto int snmpset(string host, string community, string object_id, string type, mixed value [, int timeout [, int retries]])
- Set the value of a SNMP object */
-PHP_FUNCTION(snmpset)
-{
- php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,11);
-}
-/* }}} */
-
-/* {{{ proto int netsnmp_session_set_sec_name(struct snmp_session *s, char *name)
- Set the security name in the snmpv3 session */
-static int netsnmp_session_set_sec_name(struct snmp_session *s, char *name)
-{
- if ((s) && (name)) {
- s->securityName = strdup(name);
- s->securityNameLen = strlen(s->securityName);
- return (0);
- }
- return (-1);
-}
-/* }}} */
-
-/* {{{ proto int netsnmp_session_set_sec_level(struct snmp_session *s, char *level)
- Set the security level in the snmpv3 session */
-static int netsnmp_session_set_sec_level(struct snmp_session *s, char *level TSRMLS_DC)
-{
- if ((s) && (level)) {
- if (!strcasecmp(level, "noAuthNoPriv") || !strcasecmp(level, "nanp")) {
- s->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
- return (0);
- } else if (!strcasecmp(level, "authNoPriv") || !strcasecmp(level, "anp")) {
- s->securityLevel = SNMP_SEC_LEVEL_AUTHNOPRIV;
- return (0);
- } else if (!strcasecmp(level, "authPriv") || !strcasecmp(level, "ap")) {
- s->securityLevel = SNMP_SEC_LEVEL_AUTHPRIV;
- return (0);
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid security level: %s", level);
- }
- return (-1);
-}
-/* }}} */
-
-/* {{{ proto int netsnmp_session_set_auth_protocol(struct snmp_session *s, char *prot)
- Set the authentication protocol in the snmpv3 session */
-static int netsnmp_session_set_auth_protocol(struct snmp_session *s, char *prot TSRMLS_DC)
-{
- if ((s) && (prot)) {
- if (!strcasecmp(prot, "MD5")) {
- s->securityAuthProto = usmHMACMD5AuthProtocol;
- s->securityAuthProtoLen = OIDSIZE(usmHMACMD5AuthProtocol);
- return (0);
- } else if (!strcasecmp(prot, "SHA")) {
- s->securityAuthProto = usmHMACSHA1AuthProtocol;
- s->securityAuthProtoLen = OIDSIZE(usmHMACSHA1AuthProtocol);
- return (0);
- } else if (strlen(prot)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid authentication protocol: %s", prot);
- }
- }
- return (-1);
-}
-/* }}} */
-
-/* {{{ proto int netsnmp_session_set_sec_protocol(struct snmp_session *s, char *prot)
- Set the security protocol in the snmpv3 session */
-static int netsnmp_session_set_sec_protocol(struct snmp_session *s, char *prot TSRMLS_DC)
-{
- if ((s) && (prot)) {
- if (!strcasecmp(prot, "DES")) {
- s->securityPrivProto = usmDESPrivProtocol;
- s->securityPrivProtoLen = OIDSIZE(usmDESPrivProtocol);
- return (0);
-#ifdef HAVE_AES
- } else if (!strcasecmp(prot, "AES128")) {
- s->securityPrivProto = usmAES128PrivProtocol;
- s->securityPrivProtoLen = OIDSIZE(usmAES128PrivProtocol);
- return (0);
- } else if (!strcasecmp(prot, "AES192")) {
- s->securityPrivProto = usmAES192PrivProtocol;
- s->securityPrivProtoLen = OIDSIZE(usmAES192PrivProtocol);
- return (0);
- } else if (!strcasecmp(prot, "AES256")) {
- s->securityPrivProto = usmAES256PrivProtocol;
- s->securityPrivProtoLen = OIDSIZE(usmAES256PrivProtocol);
- return (0);
-#endif
- } else if (strlen(prot)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid privacy protocol: %s", prot);
- }
- }
- return (-1);
-}
-/* }}} */
-
-/* {{{ proto int netsnmp_session_gen_auth_key(struct snmp_session *s, char *pass)
- Make key from pass phrase in the snmpv3 session */
-static int netsnmp_session_gen_auth_key(struct snmp_session *s, char *pass TSRMLS_DC)
-{
- /*
- * make master key from pass phrases
- */
- if ((s) && (pass) && strlen(pass)) {
- s->securityAuthKeyLen = USM_AUTH_KU_LEN;
- if (s->securityAuthProto == NULL) {
- /* get .conf set default */
- oid *def = get_default_authtype(&(s->securityAuthProtoLen));
- s->securityAuthProto = snmp_duplicate_objid(def, s->securityAuthProtoLen);
- }
- if (s->securityAuthProto == NULL) {
- /* assume MD5 */
- s->securityAuthProto =
- snmp_duplicate_objid(usmHMACMD5AuthProtocol, OIDSIZE(usmHMACMD5AuthProtocol));
- s->securityAuthProtoLen = OIDSIZE(usmHMACMD5AuthProtocol);
- }
- if (generate_Ku(s->securityAuthProto, s->securityAuthProtoLen,
- (u_char *) pass, strlen(pass),
- s->securityAuthKey, &(s->securityAuthKeyLen)) != SNMPERR_SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error generating a key for authentication pass phrase");
- return (-2);
- }
- return (0);
- }
- return (-1);
-}
-/* }}} */
-
-/* {{{ proto int netsnmp_session_gen_sec_key(struct snmp_session *s, u_char *pass)
- Make key from pass phrase in the snmpv3 session */
-static int netsnmp_session_gen_sec_key(struct snmp_session *s, u_char *pass TSRMLS_DC)
-{
- if ((s) && (pass) && strlen(pass)) {
- s->securityPrivKeyLen = USM_PRIV_KU_LEN;
- if (s->securityPrivProto == NULL) {
- /* get .conf set default */
- oid *def = get_default_privtype(&(s->securityPrivProtoLen));
- s->securityPrivProto = snmp_duplicate_objid(def, s->securityPrivProtoLen);
- }
- if (s->securityPrivProto == NULL) {
- /* assume DES */
- s->securityPrivProto = snmp_duplicate_objid(usmDESPrivProtocol,
- OIDSIZE(usmDESPrivProtocol));
- s->securityPrivProtoLen = OIDSIZE(usmDESPrivProtocol);
- }
- if (generate_Ku(s->securityAuthProto, s->securityAuthProtoLen,
- pass, strlen(pass),
- s->securityPrivKey, &(s->securityPrivKeyLen)) != SNMPERR_SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error generating a key for privacy pass phrase");
- return (-2);
- }
- return (0);
- }
- return (-1);
-}
-/* }}} */
-
-
-/* {{{ proto void php_snmpv3(INTERNAL_FUNCTION_PARAMETERS, int st)
-*
-* Generic SNMPv3 object fetcher
-* From here is passed on the the common internal object fetcher.
-*
-* st=1 snmp3_get() - query an agent and return a single value.
-* st=2 snmp3_walk() - walk the mib and return a single dimensional array
-* containing the values.
-* st=3 snmp3_real_walk() - walk the mib and return an
-* array of oid,value pairs.
-* st=11 snmp3_set() - query an agent and set a single value
-*
-*/
-static void php_snmpv3(INTERNAL_FUNCTION_PARAMETERS, int st)
-{
- zval **a1, **a2, **a3, **a4, **a5, **a6, **a7, **a8, **a9, **a10, **a11, **a12;
- struct snmp_session session;
- long timeout=SNMP_DEFAULT_TIMEOUT;
- long retries=SNMP_DEFAULT_RETRIES;
- int myargc = ZEND_NUM_ARGS();
- char type = (char) 0;
- char *value = (char *) 0;
- char hostname[MAX_NAME_LEN];
- int remote_port = 161;
- char *pptr;
-
- if (myargc < 8 || myargc > 12 ||
- zend_get_parameters_ex(myargc, &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9, &a10, &a11, &a12) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- snmp_sess_init(&session);
- /* This is all SNMPv3 */
- session.version = SNMP_VERSION_3;
-
- /* Reading the hostname and its optional non-default port number */
- convert_to_string_ex(a1);
- strcpy(hostname, Z_STRVAL_PP(a1));
- if ((pptr = strchr (hostname, ':'))) {
- remote_port = strtol (pptr + 1, NULL, 0);
- *pptr = 0;
- }
- session.peername = hostname;
- session.remote_port = remote_port;
-
- /* Setting the security name. */
- convert_to_string_ex(a2);
- if (netsnmp_session_set_sec_name(&session, Z_STRVAL_PP(a2))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could net set security name: %s", Z_STRVAL_PP(a2));
- RETURN_FALSE;
- }
-
- /* Setting the security level. */
- convert_to_string_ex(a3);
- if (netsnmp_session_set_sec_level(&session, Z_STRVAL_PP(a3) TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid security level: %s", a3);
- RETURN_FALSE;
- }
-
- /* Setting the authentication protocol. */
- convert_to_string_ex(a4);
- if (netsnmp_session_set_auth_protocol(&session, Z_STRVAL_PP(a4) TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid authentication protocol: %s", Z_STRVAL_PP(a4));
- RETURN_FALSE;
- }
-
- /* Setting the authentication passphrase. */
- convert_to_string_ex(a5);
- if (netsnmp_session_gen_auth_key(&session, Z_STRVAL_PP(a5) TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not generate key for authentication pass phrase: %s", Z_STRVAL_PP(a4));
- RETURN_FALSE;
- }
-
- /* Setting the security protocol. */
- convert_to_string_ex(a6);
- if (netsnmp_session_set_sec_protocol(&session, Z_STRVAL_PP(a6) TSRMLS_CC) &&
- (0 != strlen(Z_STRVAL_PP(a6)))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid security protocol: %s", Z_STRVAL_PP(a6));
- RETURN_FALSE;
- }
-
- /* Setting the security protocol passphrase. */
- convert_to_string_ex(a7);
- if (netsnmp_session_gen_sec_key(&session, Z_STRVAL_PP(a7) TSRMLS_CC) &&
- (0 != strlen(Z_STRVAL_PP(a7)))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not generate key for security pass phrase: %s", Z_STRVAL_PP(a7));
- RETURN_FALSE;
- }
-
- if (st == 11) {
- if (myargc < 10) {
- WRONG_PARAM_COUNT;
- }
- if (myargc > 10) {
- convert_to_long_ex(a11);
- timeout = Z_LVAL_PP(a11);
- }
- if (myargc > 11) {
- convert_to_long_ex(a12);
- retries = Z_LVAL_PP(a12);
- }
- convert_to_string_ex(a9);
- convert_to_string_ex(a10);
- type = Z_STRVAL_PP(a9)[0];
- value = Z_STRVAL_PP(a10);
- } else {
- if (myargc > 8) {
- convert_to_long_ex(a9);
- timeout = Z_LVAL_PP(a9);
- }
- if (myargc > 9) {
- convert_to_long_ex(a10);
- retries = Z_LVAL_PP(a10);
- }
- }
-
- session.retries = retries;
- session.timeout = timeout;
-
- php_snmp_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU, st, &session, Z_STRVAL_PP(a8), type, value);
-}
-/* }}} */
-
-/* {{{ proto int snmp3_get(string host, string sec_name, string sec_level, string auth_protocol, string auth_passphrase, string priv_protocol, string priv_passphrase, string object_id [, int timeout [, int retries]])
- Fetch the value of a SNMP object */
-PHP_FUNCTION(snmp3_get)
-{
- php_snmpv3(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-/* {{{ proto int snmp3_walk(string host, string sec_name, string sec_level, string auth_protocol, string auth_passphrase, string priv_protocol, string priv_passphrase, string object_id [, int timeout [, int retries]])
- Fetch the value of a SNMP object */
-PHP_FUNCTION(snmp3_walk)
-{
- php_snmpv3(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);
-}
-/* }}} */
-
-/* {{{ proto int snmp3_real_walk(string host, string sec_name, string sec_level, string auth_protocol, string auth_passphrase, string priv_protocol, string priv_passphrase, string object_id [, int timeout [, int retries]])
- Fetch the value of a SNMP object */
-PHP_FUNCTION(snmp3_real_walk)
-{
- php_snmpv3(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3);
-}
-/* }}} */
-
-/* {{{ proto int snmp3_set(string host, string sec_name, string sec_level, string auth_protocol, string auth_passphrase, string priv_protocol, string priv_passphrase, string object_id, string type, mixed value [, int timeout [, int retries]])
- Fetch the value of a SNMP object */
-PHP_FUNCTION(snmp3_set)
-{
- php_snmpv3(INTERNAL_FUNCTION_PARAM_PASSTHRU, 11);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/snmp/snmp.dsp b/ext/snmp/snmp.dsp
deleted file mode 100644
index ed016a4257..0000000000
--- a/ext/snmp/snmp.dsp
+++ /dev/null
@@ -1,109 +0,0 @@
-# Microsoft Developer Studio Project File - Name="snmp" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=snmp - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "snmp.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "snmp.mak" CFG="snmp - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "snmp - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "snmp - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "snmp - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_SNMP" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SNMP_EXPORTS" /D "COMPILE_DL_SNMP" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SNMP=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib libsnmp.lib wsock32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_snmp.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "snmp - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_SNMP" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SNMP_EXPORTS" /D "COMPILE_DL_SNMP" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SNMP=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib libsnmp.lib wsock32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_snmp.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "snmp - Win32 Release_TS"
-# Name "snmp - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\snmp.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_snmp.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/snmp/winsnmp.c b/ext/snmp/winsnmp.c
deleted file mode 100644
index 188d526ff5..0000000000
--- a/ext/snmp/winsnmp.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
-Created from the snmputil sample in the Microsoft SDK for NT
-*/
-
-#include "php.h"
-#if COMPILE_DL
-#include "../phpdl.h"
-#include "functions/dl.h"
-#endif
-#include "php_snmp.h"
-#include <sys/types.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <malloc.h>
-
-#if HAVE_SNMP
-
-#include <snmp.h>
-#include <mgmtapi.h>
-
-/* {{{ snmp_functions[]
- */
-function_entry snmp_functions[] = {
- {"snmpget", php3_snmpget, NULL},
- {"snmpwalk", php3_snmpwalk, NULL},
- {NULL,NULL,NULL}
-};
-/* }}} */
-
-/* {{{ snmp_module_entry
- */
-zend_module_entry snmp_module_entry = {
- STANDARD_MODULE_HEADER,
- "SNMP",
- snmp_functions,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#if COMPILE_DL
-DLEXPORT zend_module_entry *get_module() { return &snmp_module_entry; }
-#endif
-
-#define GET 1
-#define WALK 2
-#define GETNEXT 3
-
-#define TIMEOUT 6000 /* milliseconds */
-#define RETRIES 3
-
-/* {{{ _php_snmp
- */
-void _php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) {
- pval *a1, *a2, *a3;
- INT operation;
- LPSTR agent;
- LPSTR community;
- RFC1157VarBindList variableBindings;
- LPSNMP_MGR_SESSION session;
-
- INT timeout = TIMEOUT;
- INT retries = RETRIES;
-
- BYTE requestType;
- AsnInteger errorStatus;
- AsnInteger errorIndex;
- AsnObjectIdentifier oid;
- char *chkPtr = NULL;
-
- if (zend_get_parameters_ex(3, &a1, &a2, &a3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(a1);
- convert_to_string_ex(a2);
- convert_to_string_ex(a3);
-
- agent=Z_STRVAL_PP(a1);
- community=Z_STRVAL_PP(a2);
- operation=st;
- SnmpMgrStrToOid(Z_STRVAL_PP(a3), &oid);
-
-/*
- I've limited this to only one oid, but we can create a
- list of oid's here, and expand the function to take multiple
- oid's
-*/
- variableBindings.list->name = oid;
- variableBindings.list->value.asnType = ASN_NULL;
- variableBindings.len = 1;
-
-/* Establish a SNMP session to communicate with the remote agent. The
- community, communications timeout, and communications retry count
- for the session are also required.
-*/
- if ((session = SnmpMgrOpen(agent, community, timeout, retries)) == NULL){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error on SnmpMgrOpen %d\n", GetLastError());
- }
-
- /* Determine and perform the requested operation.*/
- if (operation == GET || operation == GETNEXT){
- /* Get and GetNext are relatively simple operations to perform.
- Simply initiate the request and process the result and/or
- possible error conditions. */
-
- if (operation == GET){
- requestType = ASN_RFC1157_GETREQUEST;
- } else {
- requestType = ASN_RFC1157_GETNEXTREQUEST;
- }
-
- /* Request that the API carry out the desired operation.*/
- if (!SnmpMgrRequest(session, requestType, &variableBindings,
- &errorStatus, &errorIndex)){
- /* The API is indicating an error. */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error on SnmpMgrRequest %d\n", GetLastError());
- } else {
- /* The API succeeded, errors may be indicated from the remote
- agent. */
- if (errorStatus > 0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error: errorStatus=%d, errorIndex=%d\n",
- errorStatus, errorIndex);
- } else {
- /* Display the resulting variable bindings.*/
- UINT i;
- char *str = NULL;
-
- for(i=0; i < variableBindings.len; i++)
- {
- SnmpMgrOidToStr(&variableBindings.list[i].name, &str);
- php_printf("Variable = %s\n", str);
- if (str) SNMP_free(str);
-
- php_printf("Value = ");
- SnmpUtilPrintAsnAny(&variableBindings.list[i].value);
-
- php_printf("\n");
- } /* end for() */
- }
- }
-
- /* Free the variable bindings that have been allocated.*/
- SnmpUtilVarBindListFree(&variableBindings);
- }
- else if (operation == WALK)
- {
- /* Walk is a common term used to indicate that all MIB variables
- under a given OID are to be traversed and displayed. This is
- a more complex operation requiring tests and looping in addition
- to the steps for get/getnext above. */
- AsnObjectIdentifier root;
- AsnObjectIdentifier tempOid;
-
- SnmpUtilOidCpy(&root, &variableBindings.list[0].name);
- requestType = ASN_RFC1157_GETNEXTREQUEST;
-
- while(1)
- {
- if (!SnmpMgrRequest(session, requestType, &variableBindings,
- &errorStatus, &errorIndex)){
- /* The API is indicating an error.*/
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error on SnmpMgrRequest %d\n", GetLastError());
- break;
- }
- else
- {
- /* The API succeeded, errors may be indicated from the remote
- agent.
- Test for end of subtree or end of MIB. */
- if (errorStatus == SNMP_ERRORSTATUS_NOSUCHNAME ||
- SnmpUtilOidNCmp(&variableBindings.list[0].name,
- &root, root.idLength))
- {
- PUTS("End of MIB subtree.\n\n");
- break;
- }
-
- /* Test for general error conditions or sucesss. */
- if (errorStatus > 0){
- php_error_docref(NULL TSRMLS_CC, E_ERROR,"Error: errorStatus=%d, errorIndex=%d \n", errorStatus, errorIndex);
- break;
- }
- else
- {
- /* Display resulting variable binding for this iteration. */
- char *str = NULL;
-
- SnmpMgrOidToStr(&variableBindings.list[0].name, &str);
- php_printf("Variable = %s\n", str);
- if (str) SNMP_free(str);
-
- php_printf("Value = ");
- SnmpUtilPrintAsnAny(&variableBindings.list[0].value);
-
- php_printf("\n");
- }
- } /* end if () */
- /* Prepare for the next iteration. Make sure returned oid is
- preserved and the returned value is freed.
- */
- SnmpUtilOidCpy(&tempOid, &variableBindings.list[0].name);
- SnmpUtilVarBindFree(&variableBindings.list[0]);
- SnmpUtilOidCpy(&variableBindings.list[0].name, &tempOid);
- variableBindings.list[0].value.asnType = ASN_NULL;
- SnmpUtilOidFree(&tempOid);
- } /* end while() */
- /* Free the variable bindings that have been allocated.*/
- SnmpUtilVarBindListFree(&variableBindings);
- SnmpUtilOidFree(&root);
- } /* end if (operation) */
-
-
- /* Close SNMP session with the remote agent.*/
- if (!SnmpMgrClose(session)){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "error on SnmpMgrClose %d\n", GetLastError());
- }
-}
-/* }}} */
-
-/* {{{ php3_snmpget
- */
-DLEXPORT void php3_snmpget(INTERNAL_FUNCTION_PARAMETERS) {
- _php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ php3_snmpwalk
- */
-DLEXPORT void php3_snmpwalk(INTERNAL_FUNCTION_PARAMETERS) {
- _php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,2);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/soap/EXPERIMENTAL b/ext/soap/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/soap/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/soap/Makefile.in b/ext/soap/Makefile.in
deleted file mode 100644
index eb52167d2d..0000000000
--- a/ext/soap/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libsoap.la
-LTLIBRARY_SOURCES = soap.c php_sdl.c php_schema.c php_xml.c php_encoding.c php_http.c php_packet_soap.c
-LTLIBRARY_SHARED_NAME = soap.la
-LTLIBRARY_SHARED_LIBADD = $(SOAP_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/soap/TODO b/ext/soap/TODO
deleted file mode 100644
index 00ee6adae0..0000000000
--- a/ext/soap/TODO
+++ /dev/null
@@ -1,39 +0,0 @@
-TODO:
-make sure soap 1.1 and 1.2 is supported fully
-Better WSDL support Client and server (how much validation is needed here?)
-UDDI??
-make internal refrences for soap encoding (use seralization logic)
-add ini option for always soap_error_handler
-provide user space overriding of serialization certin objects and types
-serialization in general needs to be polished/finished... all xsd types
-make perstistant objects and work with or without register_globals on
-look to see if php-soap will work with out always_populate_raw_post_data on
-see if client will work with ssl.. should be eaiser with php_streams
-work on soap seralizer (php serialization)
-work on a soap-service 'regiestry' and 'proxy' (apache soap style)
-convert all string mainpulation to use smart_str
-make the 'soap' packet abstract.. maybe incorperate xml-rpc
-make the transport layer abstract.. what other transport layers are needed?... who uses smtp? what about jabber?
-make $soap_object->data = 'text'; maybe invoke a set_*() and/or get_*() method
-when using wsdls and function names are similar find the best match
- void test(int);
- void test(string);
- maybe use the same alogrithim as ext/java.
-investigate further http keep_alive... inital testing proved slower.. maybe php_streams will speed things up..
-provide schema 1999/2001 support....
-through memory leak testing
-possible using shared memory for sdl caching...
-api for clearing/checking sdl caching...
-make php-soap work as a standalone server using php_streams and the new socket extension
-http authication
-proxy support
-wsdl generation static and auto (.net style (http://server.com/soapserver.php?WSDL)) using phpdoc parsing engine
-interpo testing...
-BENCHMARKING...... lets prove how fast it is.
-do some more work on website
-
-does this list stop... what exactly have i done?
-im sure im forgetting 20 thousand more things....
-
-
- - brad
diff --git a/ext/soap/config.m4 b/ext/soap/config.m4
deleted file mode 100644
index 0b27165bcb..0000000000
--- a/ext/soap/config.m4
+++ /dev/null
@@ -1,33 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension soap
-
-PHP_ARG_ENABLE(soap, whether to enable soap support,
-[ --enable-soap[=DIR] Enable soap support. DIR is libxml2
- library directory.])
-
-if test "$PHP_SOAP" != "no"; then
- if test "$PHP_SOAP" = "yes"; then
- for i in /usr/local /usr; do
- if test -d "$i/include/libxml2/libxml"; then
- XML2_INCDIR=$i/include/libxml2
- XML2_LIBDIR=$i/lib
- fi
- done
- else
- if test -d "$PHP_SOAP/include/libxml2/libxml"; then
- XML2_INCDIR=$PHP_SOAP/include/libxml2
- XML2_LIBDIR=$PHP_SOAP/lib
- fi
- fi
-
- if test -z "$XML2_INCDIR"; then
- AC_MSG_ERROR(Cannot find libxml2 header. Please specify correct libxml2 installation path)
- fi
-
- AC_DEFINE(HAVE_PHP_SOAP,1,[Whether you have soap module])
-
- PHP_ADD_INCLUDE($XML2_INCDIR)
- PHP_ADD_LIBRARY_WITH_PATH(xml2,$XML2_LIBDIR,SOAP_SHARED_LIBADD)
- PHP_NEW_EXTENSION(soap, soap.c php_encoding.c php_http.c php_packet_soap.c php_schema.c php_sdl.c php_xml.c, $ext_shared)
- PHP_SUBST(SOAP_SHARED_LIBADD)
-fi
diff --git a/ext/soap/interop/base.php b/ext/soap/interop/base.php
deleted file mode 100644
index a2bbb8a54a..0000000000
--- a/ext/soap/interop/base.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-class Interop_Base
-{
-}
-
-?> \ No newline at end of file
diff --git a/ext/soap/interop/client_round2.php b/ext/soap/interop/client_round2.php
deleted file mode 100644
index 5583bb6c17..0000000000
--- a/ext/soap/interop/client_round2.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
- <title>Round 2 Interop Client Tests</title>
-</head>
-
-<body>
-<a href="index.php">Back to Interop Index</a><br>
-<p>&nbsp;</p>
-<?php
-require_once 'SOAP/interop/client_round2_interop.php';
-
-$iop = new Interop_Client();
-
-function endpointList($test,$sel_endpoint)
-{
- global $iop;
- $iop->getEndpoints($test);
- echo "<select name='endpoint'>\n";
- foreach ($iop->endpoints as $epname => $epinfo) {
- $selected = '';
- if ($sel_endpoint == $epname) $selected = ' SELECTED';
- echo "<option value='$epname'$selected>$epname</option>\n";
- }
- echo "</select>\n";
-}
-function methodList($test,$sel_method)
-{
- global $iop;
-
- $ml = $iop->getMethodList($test);
- echo "<select name='method'>\n";
- foreach ($ml as $method) {
- $selected = '';
- if ($sel_method == $method) $selected = ' SELECTED';
- echo "<option value='$method'$selected>$method</option>\n";
- }
- echo "<option value='ALL'>Run All Methods</option>\n";
- echo "</select>\n";
-}
-
-function endpointTestForm($test, $endpoint, $method, $paramType, $useWSDL)
-{
- global $PHP_SELF;
- if (!$test) $test = 'base';
- echo "Round 2 '$test' Selected<br>\n";
- echo "Select endpoint and method to run:<br>\n";
- echo "<form action='$PHP_SELF' method='post'>\n";
- echo "<input type='hidden' name='test' value='$test'>\n";
- endpointList($test, $endpoint);
- methodList($test, $method);
- echo "<select name='paramType'><option value='soapval'>soap value</option>";
- echo "<option value='php'".($paramType=='php'?' selected':'').">php internal type</option></select>\n";
- echo "<select name='useWSDL'><option value='0'>go Direct</option><option value='1'".($useWSDL?' selected':'').">use WSDL</option></select>\n";
- echo "<input type='submit' value='Go'>\n";
- echo "</form><br>\n";
-}
-
-function testSelectForm($selected_test = NULL)
-{
- global $iop, $PHP_SELF;
- echo "Select a Round 2 test case to run:<br>\n";
- echo "<form action='$PHP_SELF' method='post'>\n";
- echo "<select name='test'>\n";
- foreach ($iop->tests as $test) {
- $selected = '';
- if ($selected_test == $test) $selected = ' SELECTED';
- echo "<option value='$test'$selected>$test</option>\n";
- }
- echo "</select>\n";
- echo "<input type='submit' value='Go'>\n";
- echo "</form><br>\n";
-}
-
-testSelectForm($_POST['test']);
-endpointTestForm($_POST['test'],$_POST['endpoint'],$_POST['method'],$_POST['paramType'],$_POST['useWSDL']);
-
-if ($_POST['test'] && array_key_exists('endpoint', $_POST) && array_key_exists('method', $_POST)) {
- // here we execute the orders
- echo "<h2>Calling {$_POST['method']} at {$_POST['endpoint']}</h2>\n";
- echo "NOTE: wire's are slightly modified to display better in web browsers.<br>\n";
-
- $iop->currentTest = $_POST['test']; // see $tests above
- $iop->paramType = $_POST['paramType']; // 'php' or 'soapval'
- $iop->useWSDL = $_POST['useWSDL']; // 1= do wsdl tests
- $iop->numServers = 0; // 0 = all
- $iop->specificEndpoint = $_POST['endpoint']; // test only this endpoint
- $iop->testMethod = $_POST['method']=='ALL'?'':$_POST['method']; // test only this method
- $iop->skipEndpointList = array(); // endpoints to skip
- $this->nosave = 0; // 1= disable saving results to database
- // debug output
- $iop->show = 1;
- $iop->debug = 1;
- $iop->showFaults = 0; // used in result table output
- echo '<pre>';
- $iop->doTest(); // run a single set of tests using above options
- echo '</pre>';
-}
-?>
-</body>
-</html>
diff --git a/ext/soap/interop/client_round2_interop.php b/ext/soap/interop/client_round2_interop.php
deleted file mode 100644
index b3bd98b4fc..0000000000
--- a/ext/soap/interop/client_round2_interop.php
+++ /dev/null
@@ -1,796 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-require_once 'DB.php'; // PEAR/DB
-require_once 'base.php';
-require_once 'client_round2_params.php';
-require_once 'test.utility.php';
-
-error_reporting(E_ALL ^ E_NOTICE);
-
-class Interop_Client extends Interop_Base
-{
- // database DNS
- var $DSN = 'mysql://user@localhost/interop2';
-
- // our central interop server, where we can get the list of endpoints
- var $interopServer = "http://www.whitemesa.net/interopInfo";
-
- // our local endpoint, will always get added to the database for all tests
- var $localEndpoint;
-
- // specify testing
- var $currentTest = 'base'; // see $tests above
- var $paramType = 'php'; // 'php' or 'soapval'
- var $useWSDL = 0; // 1= do wsdl tests
- var $numServers = 0; // 0 = all
- var $specificEndpoint = ''; // test only this endpoint
- var $testMethod = ''; // test only this method
- var $skipEndpointList = array(); // endpoints to skip
- var $nosave = 0;
- var $startAt = ''; // start in list at this endpoint
- // debug output
- var $show = 1;
- var $debug = 0;
- var $showFaults = 0; // used in result table output
-
- // PRIVATE VARIABLES
- var $dbc = NULL;
- var $totals = array();
- var $tests = array('base','GroupB', 'GroupC');
- var $paramTypes = array('php', 'soapval');
- var $endpoints = array();
-
- function Interop_Client() {
- // set up the database connection
- $this->dbc = DB::connect($this->DSN, true);
- // if it errors out, just ignore it and rely on regular methods
- if (DB::isError($this->dbc)) {
- echo $this->dbc->getMessage();
- $this->dbc = NULL;
- }
- // set up local endpoint
- $this->localEndpoint['base'] = array(
- 'endpointName'=>'PEAR SOAP',
- 'endpointURL'=>'http://localhost/soap_interop/server_round2.php',
- 'wsdlURL'=>'http://localhost/soap_interop/interop.wsdl'
- );
- $this->localEndpoint['GroupB'] = array(
- 'endpointName'=>'PEAR SOAP',
- 'endpointURL'=>'http://localhost/soap_interop/server_round2.php',
- 'wsdlURL'=>'http://localhost/soap_interop/interopB.wsdl'
- );
- $this->localEndpoint['GroupC'] = array(
- 'endpointName'=>'PEAR SOAP',
- 'endpointURL'=>'http://localhost/soap_interop/server_round2.php',
- 'wsdlURL'=>'http://localhost/soap_interop/echoheadersvc.wsdl'
- );
- }
-
- function _fetchEndpoints(&$soapclient, $test) {
- $this->_getEndpoints($test, 1);
-
- // retreive endpoints from the endpoint server
- $endpointArray = $soapclient->call("GetEndpointInfo",array("groupName"=>$test),"http://soapinterop.org/info/","http://soapinterop.org/info/");
- if (PEAR::isError($endpointArray)) {
- print $soapclient->wire;
- print_r($endpointArray);
- return;
- }
-
- // add our local endpoint
- if ($this->localEndpoint[$test]) {
- array_push($endpointArray, $this->localEndpoint[$test]);
- }
-
- if (!$endpointArray) return;
-
- // reset the status to zero
- $res = $this->dbc->query("update endpoints set status = 0 where class='$test'");
- if (DB::isError($res)) {
- die ($res->getMessage());
- }
- if (is_object($res)) $res->free();
- // save new endpoints into database
- foreach($endpointArray as $k => $v){
- if (array_key_exists($v['endpointName'],$this->endpoints)) {
- $res = $this->dbc->query("update endpoints set endpointURL='{$v['endpointURL']}', wsdlURL='{$v['wsdlURL']}', status=1 where id={$this->endpoints[$v['endpointName']]['id']}");
- } else {
- $res = $this->dbc->query("insert into endpoints (endpointName,endpointURL,wsdlURL,class) values('{$v['endpointName']}','{$v['endpointURL']}','{$v['wsdlURL']}','$test')");
- }
- if (DB::isError($res)) {
- die ($res->getMessage());
- }
- if (is_object($res)) $res->free();
- }
- }
-
- /**
- * fetchEndpoints
- * retreive endpoints interop server
- *
- * @return boolean result
- * @access private
- */
- function fetchEndpoints($test = NULL) {
- // fetch from the interop server
- $soapclient = new SoapObject($this->interopServer);
-
- if ($test) {
- $this->_fetchEndpoints($soapclient, $test);
- } else {
- foreach ($this->tests as $test) {
- $this->_fetchEndpoints($soapclient, $test);
- }
- $test = 'base';
- }
-
- // retreive all endpoints now
- $this->currentTest = $test;
- return $this->_getEndpoints($test);
- }
-
- /**
- * getEndpoints
- * retreive endpoints from either database or interop server
- *
- * @param string base (see local var $tests)
- * @param boolean all (if false, only get valid endpoints, status=1)
- * @return boolean result
- * @access private
- */
- function getEndpoints($base = 'base', $all = 0) {
- if (!$this->_getEndpoints($base, $all)) {
- return $this->fetchEndpoints($base);
- }
- return TRUE;
- }
-
- /**
- * _getEndpoints
- * retreive endpoints from database
- *
- * @param string base (see local var $tests)
- * @param boolean all (if false, only get valid endpoints, status=1)
- * @return boolean result
- * @access private
- */
- function _getEndpoints($base = "", $all = 0) {
- $this->endpoints = array();
-
- // build sql
- $sql = "select * from endpoints ";
- if ($base) {
- $sql .= "where class='$base' ";
- if (!$all) $sql .= "and status=1";
- } else
- if (!$all) $sql .= "where status=1";
-
- $db_ep = $this->dbc->getAll($sql,NULL, DB_FETCHMODE_ASSOC );
- if (DB::isError($db_ep)) {
- echo $sql."\n";
- echo $db_ep->getMessage();
- return FALSE;
- }
- // rearange the array
- foreach ($db_ep as $entry) {
- $this->endpoints[$entry['endpointName']] = $entry;
- }
- if (count($this->endpoints) > 0) {
- $this->currentTest = $base;
- return TRUE;
- }
- return FALSE;
- }
-
- /**
- * getResults
- * retreive results from the database, stuff them into the endpoint array
- *
- * @access private
- */
- function getResults($test = 'base', $type = 'php', $wsdl = 0) {
- // be sure we have the right endpoints for this test result
- $this->getEndpoints($test);
-
- // retreive the results and put them into the endpoint info
- $sql = "select * from results where class='$test' and type='$type' and wsdl=$wsdl";
- $results = $this->dbc->getAll($sql,NULL, DB_FETCHMODE_ASSOC );
- foreach ($results as $result) {
- // find the endpoint
- foreach ($this->endpoints as $epn => $epi) {
- if ($epi['id'] == $result['endpoint']) {
- // store the info
- $this->endpoints[$epn]['methods'][$result['function']] = $result;
- break;
- }
- }
- }
- }
-
- /**
- * saveResults
- * save the results of a method test into the database
- *
- * @access private
- */
- function _saveResults($endpoint_id, &$soap_test) {
- if ($this->nosave) return;
-
- $result = $soap_test->result;
- $wire = $result['wire'];
- if ($result['success']) {
- $success = 'OK';
- $error = '';
- } else {
- $success = $result['fault']->faultcode;
- $error = $result['fault']->faultstring;
- if (!$wire) $wire= $result['fault']->detail;
- }
-
- $test_name = $soap_test->test_name;
- // add header info to the test name
- if ($soap_test->headers) {
- foreach ($soap_test->headers as $h) {
- $destination = 0;
- if (get_class($h) == 'soap_header') {
- if ($h->attributes['SOAP-ENV:actor'] == 'http://schemas.xmlsoap.org/soap/actor/next') $destination = 1;
- $test_name .= ":{$h->name},$destination,{$h->attributes['SOAP-ENV:mustUnderstand']}";
- } else {
- if (!$h[3] || $h[3] == 'http://schemas.xmlsoap.org/soap/actor/next') $destination = 1;
- if (!$h[2]) $h[2] = 0;
- $qn = new QName($h[0]);
- $test_name .= ":{$qn->name},$destination,".(int)$h[2];
- }
- }
- }
-
- $sql = "delete from results where endpoint=$endpoint_id ".
- "and class='$this->currentTest' and type='$this->paramType' ".
- "and wsdl=$this->useWSDL and function=".
- $this->dbc->quote($test_name);
- #echo "\n".$sql;
- $res = $this->dbc->query($sql);
- if (DB::isError($res)) {
- die ($res->getMessage());
- }
- if (is_object($res)) $res->free();
-
- $sql = "insert into results (endpoint,stamp,class,type,wsdl,function,result,error,wire) ".
- "values($endpoint_id,".time().",'$this->currentTest',".
- "'$this->paramType',$this->useWSDL,".
- $this->dbc->quote($test_name).",".
- $this->dbc->quote($success).",".
- $this->dbc->quote($error).",".
- ($wire?$this->dbc->quote($wire):"''").")";
- #echo "\n".$sql;
- $res = $this->dbc->query($sql);
-
- if (DB::isError($res)) {
- die ($res->getMessage());
- }
- if (is_object($res)) $res->free();
- }
-
- /**
- * decodeSoapval
- * decodes a soap value to php type, used for test result comparisions
- *
- * @param SOAP_Value soapval
- * @return mixed result
- * @access public
- */
- function decodeSoapval($soapval)
- {
- if (gettype($soapval) == "object" &&
- (strcasecmp(get_class($soapval),"soapparam") == 0 ||
- strcasecmp(get_class($soapval),"soapvar") == 0)) {
- if (strcasecmp(get_class($soapval),"soapparam") == 0)
- $val = $soapval->param_data->enc_value;
- else
- $val = $soapval->enc_value;
- } else {
- $val = $soapval;
- }
- if (is_array($val)) {
- foreach($val as $k => $v) {
- if (gettype($v) == "object" &&
- (strcasecmp(get_class($soapval),"soapparam") == 0 ||
- strcasecmp(get_class($soapval),"soapvar") == 0)) {
- $val[$k] = $this->decodeSoapval($v);
- }
- }
- }
- return $val;
- }
-
- /**
- * compareResult
- * compare two php types for a match
- *
- * @param string expect
- * @param string test_result
- * @return boolean result
- * @access public
- */
- function compareResult($expect, $result, $type = NULL)
- {
- $ok = 0;
- $expect_type = gettype($expect);
- $result_type = gettype($result);
- if ($expect_type == "array" && $result_type == "array") {
- # compare arrays
- $ok = array_compare($expect, $result);
- } else {
- if ($type == 'boolean')
- $ok = boolean_compare($expect, $result);
- else
- $ok = string_compare($expect, $result);
- }
- return $ok;
- }
-
-
- /**
- * doEndpointMethod
- * run a method on an endpoint and store it's results to the database
- *
- * @param array endpoint_info
- * @param SOAP_Test test
- * @return boolean result
- * @access public
- */
- function doEndpointMethod(&$endpoint_info, &$soap_test) {
- $ok = FALSE;
-
- // prepare a holder for the test results
- $soap_test->result['class'] = $this->currentTest;
- $soap_test->result['type'] = $this->paramType;
- $soap_test->result['wsdl'] = $this->useWSDL;
-
- if ($this->useWSDL) {
- if (array_key_exists('wsdlURL',$endpoint_info)) {
- if (!array_key_exists('client',$endpoint_info)) {
- $endpoint_info['client'] = new SoapObject($endpoint_info['wsdlURL']);
- }
- $soap =& $endpoint_info['client'];
-
- # XXX how do we determine a failure on retreiving/parsing wsdl?
- if ($soap->wsdl->fault) {
- $fault = $soap->wsdl->fault->getFault();
- $soap_test->setResult(0,'WSDL',
- $fault->faultstring."\n\n".$fault->detail,
- $fault->faultstring,
- $fault
- );
- return FALSE;
- }
- } else {
- $fault = new SoapFault('WSDL',"no WSDL defined for $endpoint");
- $soap_test->setResult(0,'WSDL',
- $fault->faultstring,
- $fault->faultstring,
- $fault
- );
- return FALSE;
- }
- $namespace = false;
- $soapaction = false;
- } else {
- $namespace = $soapaction = 'http://soapinterop.org/';
- // hack to make tests work with MS SoapToolkit
- // it's the only one that uses this soapaction, and breaks if
- // it isn't right. Can't wait for soapaction to be fully depricated
- if ($this->currentTest == 'base' &&
- strstr($endpoint_info['endpointName'],'MS SOAP ToolKit 2.0')) {
- $soapaction = 'urn:soapinterop';
- }
- if (!array_key_exists('client',$endpoint_info)) {
- $endpoint_info['client'] = new SoapObject($endpoint_info['endpointURL'],$soapaction);
- }
- $soap = $endpoint_info['client'];
- }
- // add headers to the test
- if ($soap_test->headers) {
- // $header is already a SOAP_Header class
- foreach ($soap_test->headers as $header) {
- $soap->addHeader($header);
- }
- }
- // XXX no way to set encoding
- // this lets us set UTF-8, US-ASCII or other
- //$soap->setEncoding($soap_test->encoding);
-
- if ($this->useWSDL) {
- $args = '';
- foreach ($soap_test->method_params as $pname => $param) {
- $arg = '$soap_test->method_params["'.$pname.'"]';
- $args .= $args?','.$arg:$arg;
- }
- $return = eval('return $soap->'.$soap_test->method_name.'('.$args.');');
- } else {
- $return = $soap->__call($soap_test->method_name,$soap_test->method_params,$soapaction, $namespace);
- }
-
- // save the wire
- $wire = $soap->__getlastrequest()."\n\n".$soap->__getlastresponse();
- $wire = str_replace('>',">\n",$wire);
- $wire = str_replace('" ',"\" \n",$wire);
- #print $wire;
-
- if(!$soap->__isfault()){
- if (is_array($soap_test->method_params) && count($soap_test->method_params) == 1) {
- $sent = array_shift($soap_test->method_params);
- } else {
- $sent = $soap_test->method_params;
- }
-
- // compare header results
- $header_result = array();
- $headers_ok = TRUE;
-
- # XXX need to implement header support!
- #
- #if ($soap_test->headers) {
- # // $header is already a SOAP_Header class
- # foreach ($soap_test->headers as $header) {
- # if (get_class($header) != 'soap_header') {
- # // assume it's an array
- # $header = new SOAP_Header($header[0], NULL, $header[1], $header[2], $header[3], $header[4]);
- # }
- # $expect = $soap_test->headers_expect[$header->name];
- # $header_result[$header->name] = array();
- # // XXX need to fix need_result to identify the actor correctly
- # $need_result = $hresult ||
- # ($header->attributes['SOAP-ENV:actor'] == 'http://schemas.xmlsoap.org/soap/actor/next'
- # && $header->attributes['SOAP-ENV:mustUnderstand']);
- # if ($expect) {
- # $hresult = $soap->headers[key($expect)];
- # $ok = !$need_result || $this->compareResult($hresult ,$expect[key($expect)]);
- # } else {
- # $hresult = $soap->headers[$header->name];
- # $expect = $this->decodeSoapval($header);
- # $ok = !$need_result || $this->compareResult($hresult ,$expect);
- # }
- # $header_result[$header->name]['ok'] = $ok;
- # if (!$ok) $headers_ok = FALSE;
- # }
- #}
-
- # we need to decode what we sent so we can compare!
- $sent_d = $this->decodeSoapval($sent);
-
- $soap_test->result['sent'] = $sent;
- $soap_test->result['return'] = $return;
- // compare the results with what we sent
- $ok = $this->compareResult($sent_d,$return, $sent->type);
- if (!$ok && $soap_test->expect) {
- $ok = $this->compareResult($soap_test->expect,$return);
- }
-
- if($ok){
- if (!$headers_ok) {
- $fault = new SoapFault('HEADER','The returned result did not match what we expected to receive');
- $soap_test->setResult(0,$fault->faultcode,
- $wire,
- $fault->faultstring,
- $fault
- );
- } else {
- $soap_test->setResult(1,'OK',$wire);
- $success = TRUE;
- }
- } else {
- $fault = new SoapFault('RESULT','The returned result did not match what we expected to receive');
- $soap_test->setResult(0,$fault->faultcode,
- $wire,
- $fault->faultstring,
- $fault
- );
- }
- } else {
- $fault = $soap->__getfault();
- if ($soap_test->expect_fault) {
- $ok = 1;
- $res = 'OK';
- } else {
- $ok = 0;
- $res =$fault->faultcode;
- }
- $soap_test->setResult($ok,$res, $wire,$fault->faultstring, $fault);
- }
- return $ok;
- }
-
-
- /**
- * doTest
- * run a single round of tests
- *
- * @access public
- */
- function doTest() {
- global $soap_tests;
- // get endpoints for this test
- $this->getEndpoints($this->currentTest);
- #clear totals
- $this->totals = array();
-
- $i = 0;
- foreach($this->endpoints as $endpoint => $endpoint_info){
-
- // if we specify an endpoint, skip until we find it
- if ($this->specificEndpoint && $endpoint != $this->specificEndpoint) continue;
- if ($this->useWSDL && !$endpoint_info['endpointURL']) continue;
-
- $skipendpoint = FALSE;
- $this->totals['servers']++;
- #$endpoint_info['tests'] = array();
-
- if ($this->show) print "Processing $endpoint at {$endpoint_info['endpointURL']}<br>\n";
-
- foreach($soap_tests[$this->currentTest] as $soap_test) {
- //foreach(array_keys($method_params[$this->currentTest][$this->paramType]) as $method)
-
- // only run the type of test we're looking for (php or soapval)
- if ($soap_test->type != $this->paramType) continue;
-
- // if we haven't reached our startpoint, skip
- if ($this->startAt && $this->startAt != $endpoint_info['endpointName']) continue;
- $this->startAt = '';
-
- // if this is in our skip list, skip it
- if (in_array($endpoint, $this->skipEndpointList)) {
- $skipendpoint = TRUE;
- $skipfault = new SoapFault('SKIP','endpoint skipped');
- $soap_test->setResult(0,$fault->faultcode, '',
- $skipfault->faultstring,
- $skipfault
- );
- #$endpoint_info['tests'][] = &$soap_test;
- #$soap_test->showTestResult($this->debug);
- #$this->_saveResults($endpoint_info['id'], $soap_test->method_name);
- $soap_test->result = NULL;
- continue;
- }
-
- // if we're looking for a specific method, skip unless we have it
- if ($this->testMethod && !strstr($this->testMethod,$soap_test->test_name)) continue;
- if ($this->testMethod && $this->currentTest == 'GroupC') {
- // we have to figure things out now
- if (!preg_match('/(.*):(.*),(\d),(\d)/',$this->testMethod, $m)) continue;
-
- // is the header in the headers list?
- $gotit = FALSE;
- foreach ($soap_test->headers as $header) {
- if (get_class($header) == 'soap_header') {
- if ($header->name == $m[2]) {
- $gotit = $header->attributes['SOAP-ENV:actor'] == ($m[3]?SOAP_TEST_ACTOR_NEXT:SOAP_TEST_ACTOR_OTHER);
- $gotit = $gotit && $header->attributes['SOAP-ENV:mustUnderstand'] == $m[4];
- }
- } else {
- if ($header[0] == $m[2]) {
- $gotit = $gotit && $header[3] == ($m[3]?SOAP_TEST_ACTOR_NEXT:SOAP_TEST_ACTOR_OTHER);
- $gotit = $gotit && $header[4] == $m[4];
- }
- }
- }
- if (!$gotit) continue;
- }
-
- // if we are skipping the rest of the tests (due to error) note a fault
- if ($skipendpoint) {
- $soap_test->setResult(0,$fault->faultcode, '',
- $skipfault->faultstring,
- $skipfault
- );
- #$endpoint_info['tests'][] = &$soap_test;
- $this->totals['fail']++;
- } else {
- // run the endpoint test
- if ($this->doEndpointMethod($endpoint_info, $soap_test)) {
- $this->totals['success']++;
- } else {
- $skipendpoint = $soap_test->result['fault']->faultcode=='HTTP'
- && strstr($soap_test->result['fault']->faultstring,'Connect Error');
- $skipfault = $soap_test->result['fault'];
- $this->totals['fail']++;
- }
- #$endpoint_info['tests'][] = &$soap_test;
- }
- $soap_test->showTestResult($this->debug);
- $this->_saveResults($endpoint_info['id'], $soap_test);
- $soap_test->result = NULL;
- $this->totals['calls']++;
- }
- if ($this->numservers && ++$i >= $this->numservers) break;
- }
- }
-
- function doGroupTests() {
- $dowsdl = array(0,1);
- foreach($dowsdl as $usewsdl) {
- $this->useWSDL = $usewsdl;
- foreach($this->paramTypes as $ptype) {
- // skip a pointless test
- if ($usewsdl && $ptype == 'soapval') break;
- $this->paramType = $ptype;
- $this->doTest();
- }
- }
- }
-
- /**
- * doTests
- * go all out. This takes time.
- *
- * @access public
- */
- function doTests() {
- // the mother of all interop tests
- $dowsdl = array(0,1);
- foreach($this->tests as $test) {
- $this->currentTest = $test;
- foreach($dowsdl as $usewsdl) {
- $this->useWSDL = $usewsdl;
- foreach($this->paramTypes as $ptype) {
- // skip a pointless test
- if ($usewsdl && $ptype == 'soapval') break;
- $this->paramType = $ptype;
- $this->doTest();
- }
- }
- }
- }
-
- // ***********************************************************
- // output functions
-
- /**
- * getResults
- * retreive results from the database, stuff them into the endpoint array
- *
- * @access private
- */
- function getMethodList($test = 'base') {
- // retreive the results and put them into the endpoint info
- $sql = "select distinct(function) from results where class='$test' order by function";
- $results = $this->dbc->getAll($sql);
- $ar = array();
- foreach($results as $result) {
- $ar[] = $result[0];
- }
- return $ar;
- }
-
- function outputTable()
- {
- $methods = $this->getMethodList($this->currentTest);
- if (!$methods) return;
- $this->getResults($this->currentTest,$this->paramType,$this->useWSDL);
-
- echo "<b>Testing $this->currentTest ";
- if ($this->useWSDL) echo "using WSDL ";
- else echo "using Direct calls ";
- echo "with $this->paramType values</b><br>\n";
-
- // calculate totals for this table
- $this->totals['success'] = 0;
- $this->totals['fail'] = 0;
- $this->totals['servers'] = 0; #count($this->endpoints);
- foreach ($this->endpoints as $endpoint => $endpoint_info) {
- if (count($endpoint_info['methods']) > 0) {
- $this->totals['servers']++;
- foreach ($methods as $method) {
- $r = $endpoint_info['methods'][$method]['result'];
- if ($r == 'OK') $this->totals['success']++;
- else $this->totals['fail']++;
- }
- } else {
- unset($this->endpoints[$endpoint]);
- }
- }
- $this->totals['calls'] = count($methods) * $this->totals['servers'];
-
- if ($this->totals['fail'] == $this->totals['calls']) {
- // assume tests have not run, skip outputing table
- print "No Data Available<br>\n";
- return;
- }
-
- echo "\n\n<b>Servers: {$this->totals['servers']} Calls: {$this->totals['calls']} Success: {$this->totals['success']} Fail: {$this->totals['fail']}</b><br>\n";
-
- echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\">\n";
- echo "<tr><td class=\"BLANK\">Endpoint</td>\n";
- foreach ($methods as $method) {
- $info = split(':', $method);
- echo "<td class='BLANK' valign='top'>";
- foreach ($info as $m) {
- $hi = split(',',$m);
- echo '<b>'.$hi[0]."</b><br>\n";
- if (count($hi) > 1) {
- echo "&nbsp;&nbsp;Actor=".($hi[1]?'Target':'Not Target')."<br>\n";
- echo "&nbsp;&nbsp;MustUnderstand=$hi[2]<br>\n";
- }
- }
- echo "</td>\n";
- }
- echo "</tr>\n";
- $faults = array();
- $fi = 0;
- foreach ($this->endpoints as $endpoint => $endpoint_info) {
- if (array_key_exists('wsdlURL',$endpoint_info)) {
- echo "<tr><td class=\"BLANK\"><a href=\"{$endpoint_info['wsdlURL']}\">$endpoint</a></td>\n";
- } else {
- echo "<tr><td class=\"BLANK\">$endpoint</td>\n";
- }
- foreach ($methods as $method) {
- $id = $endpoint_info['methods'][$method]['id'];
- $r = $endpoint_info['methods'][$method]['result'];
- $e = $endpoint_info['methods'][$method]['error'];
- if ($e) {
- $faults[$fi++] = $e;
- }
- if ($r) {
- echo "<td class='$r'><a href='$PHP_SELF?wire=$id'>$r</a></td>\n";
- } else {
- echo "<td class='untested'>untested</td>\n";
- }
- }
- echo "</tr>\n";
- }
- echo "</table><br>\n";
- if ($this->showFaults && count($faults) > 0) {
- echo "<b>ERROR Details:</b><br>\n<ul>\n";
- # output more error detail
- foreach ($faults as $fault) {
- echo '<li>'.HTMLSpecialChars($fault)."</li>\n";
- }
- }
- echo "</ul><br><br>\n";
- }
-
- function outputTables() {
- // the mother of all interop tests
- $dowsdl = array(0,1);
- foreach($this->tests as $test) {
- $this->currentTest = $test;
- foreach($dowsdl as $usewsdl) {
- $this->useWSDL = $usewsdl;
- foreach($this->paramTypes as $ptype) {
- // skip a pointless test
- if ($usewsdl && $ptype == 'soapval') break;
- $this->paramType = $ptype;
- $this->outputTable();
- }
- }
- }
- }
-
- function showWire($id) {
- $results = $this->dbc->getAll("select * from results where id=$id",NULL, DB_FETCHMODE_ASSOC );
- #$wire = preg_replace("/>/",">\n",$results[0]['wire']);
- $wire = $results[0]['wire'];
- echo "<pre>\n".HTMLSpecialChars($wire)."</pre>\n";
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/ext/soap/interop/client_round2_params.php b/ext/soap/interop/client_round2_params.php
deleted file mode 100644
index 262093c0b7..0000000000
--- a/ext/soap/interop/client_round2_params.php
+++ /dev/null
@@ -1,636 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-define('SOAP_TEST_ACTOR_NEXT','http://schemas.xmlsoap.org/soap/actor/next');
-define('SOAP_TEST_ACTOR_OTHER','http://some/other/actor');
-
-class SOAP_Test {
- var $type = 'php';
- var $test_name = NULL;
- var $method_name = NULL;
- var $method_params = NULL;
- var $expect = NULL;
- var $expect_fault = FALSE;
- var $headers = NULL;
- var $headers_expect = NULL;
- var $result = array();
- var $show = 1;
- var $debug = 0;
- var $encoding = 'UTF-8';
-
- function SOAP_Test($methodname, $params, $expect = NULL) {
- # XXX we have to do this to make php-soap happy with NULL params
- if (!$params) $params = array();
-
- if (strchr($methodname,'(')) {
- preg_match('/(.*)\((.*)\)/',$methodname,$matches);
- $this->test_name = $methodname;
- $this->method_name = $matches[1];
- } else {
- $this->test_name = $this->method_name = $methodname;
- }
- $this->method_params = $params;
- $this->expect = $expect;
-
- // determine test type
- if ($params) {
- $v = array_values($params);
- if (gettype($v[0]) == 'object' &&
- (get_class($v[0]) == 'soapvar' || get_class($v[0]) == 'soapparam'))
- $this->type = 'soapval';
- }
- }
-
- function setResult($ok, $result, $wire, $error = '', $fault = NULL)
- {
- $this->result['success'] = $ok;
- $this->result['result'] = $result;
- $this->result['error'] = $error;
- $this->result['wire'] = $wire;
- $this->result['fault'] = $fault;
- }
-
- /**
- * showMethodResult
- * print simple output about a methods result
- *
- * @param array endpoint_info
- * @param string method
- * @access public
- */
- function showTestResult($debug = 0) {
- // debug output
- if ($debug) $this->show = 1;
- if ($debug) {
- echo str_repeat("-",50)."<br>\n";
- }
-
- echo "testing $this->test_name : ";
- if ($this->headers) {
- foreach ($this->headers as $h) {
- if (get_class($h) == 'soap_header') {
-
- echo "\n {$h->name},{$h->attributes['SOAP-ENV:actor']},{$h->attributes['SOAP-ENV:mustUnderstand']} : ";
- } else {
- if (!$h[4]) $h[4] = SOAP_TEST_ACTOR_NEXT;
- if (!$h[3]) $h[3] = 0;
- echo "\n $h[0],$h[4],$h[3] : ";
- }
- }
- }
-
- if ($debug) {
- print "method params: ";
- print_r($this->params);
- print "\n";
- }
-
- $ok = $this->result['success'];
- if ($ok) {
- print "SUCCESS\n";
- } else {
- $fault = $this->result['fault'];
- if ($fault) {
- print "FAILED: {$fault->faultcode} {$fault->faultstring}\n";
- } else {
- print "FAILED: ".$this->result['result']."\n";
- }
- }
- if ($debug) {
- echo "<pre>\n".htmlentities($this->result['wire'])."</pre>\n";
- }
- }
-}
-
-# XXX I know this isn't quite right, need to deal with this better
-function make_2d($x, $y)
-{
- for ($_x = 0; $_x < $x; $_x++) {
- for ($_y = 0; $_y < $y; $_y++) {
- $a[$_x][$_y] = "x{$_x}y{$_y}";
- }
- }
- return $a;
-}
-
-function soap_value($name, $value, $type) {
- return new soapparam(new soapvar($value,$type),$name);
-}
-
-class SOAPStruct {
- var $varString;
- var $varInt;
- var $varFloat;
- function SOAPStruct($s, $i, $f) {
- $this->varString = $s;
- $this->varInt = $i;
- $this->varFloat = $f;
- }
-}
-
-//***********************************************************
-// Base echoString
-
-$soap_tests['base'][] = new SOAP_Test('echoString', array('inputString' => 'hello world!'));
-$soap_tests['base'][] = new SOAP_Test('echoString', array('inputString' => soap_value('inputString','hello world',XSD_STRING)));
-$soap_tests['base'][] = new SOAP_Test('echoString(null)', array('inputString' => ""));
-$soap_tests['base'][] = new SOAP_Test('echoString(null)', array('inputString' => soap_value('inputString','',XSD_STRING)));
-$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => 'hello world\nline 2\n'));
-$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => soap_value('inputString','hello world\nline 2\n',XSD_STRING)));
-$test = new SOAP_Test('echoString(utf-8)', array('inputString' => utf8_encode('ỗÈéóÒ₧⅜ỗỸ')));
-$test->encoding = 'UTF-8';
-$soap_tests['base'][] = $test;
-$test = new SOAP_Test('echoString(utf-8)', array('inputString' => soap_value('inputString',utf8_encode('ỗÈéóÒ₧⅜ỗỸ'),XSD_STRING)));
-$test->encoding = 'UTF-8';
-$soap_tests['base'][] = $test;
-
-//***********************************************************
-// Base echoStringArray
-
-$soap_tests['base'][] = new SOAP_Test('echoStringArray',
- array('inputStringArray' => array('good','bad')));
-$soap_tests['base'][] = new SOAP_Test('echoStringArray',
- array('inputStringArray' =>
- soap_value('inputStringArray',array('good','bad'),SOAP_ENC_ARRAY)));
-
-// null array test
-# XXX NULL Arrays not supported
-#$soap_tests['base'][] = new SOAP_Test('echoStringArray(null)', array('inputStringArray' => NULL));
-#$soap_tests['base'][] = new SOAP_Test('echoStringArray(null)', array('inputStringArray' => soap_value('inputStringArray',NULL,XSD_STRING)));
-
-//***********************************************************
-// Base echoInteger
-
-$soap_tests['base'][] = new SOAP_Test('echoInteger', array('inputInteger' => 34345));
-$soap_tests['base'][] = new SOAP_Test('echoInteger', array('inputInteger' => soap_value('inputInteger',12345,XSD_INT)));
-
-//***********************************************************
-// Base echoIntegerArray
-
-$soap_tests['base'][] = new SOAP_Test('echoIntegerArray', array('inputIntegerArray' => array(1,234324324,2)));
-$soap_tests['base'][] = new SOAP_Test('echoIntegerArray',
- array('inputIntegerArray' =>
- soap_value('inputIntegerArray',
- array(new soapvar(12345,XSD_INT),new soapvar(654321,XSD_INT)),
- SOAP_ENC_ARRAY)));
-#
-#// null array test
-# XXX NULL Arrays not supported
-#$soap_tests['base'][] = new SOAP_Test('echoIntegerArray(null)', array('inputIntegerArray' => NULL));
-#$soap_tests['base'][] = new SOAP_Test('echoIntegerArray(null)', array('inputIntegerArray' => new SOAP_Value('inputIntegerArray','Array',NULL)));
-#
-//***********************************************************
-// Base echoFloat
-
-$soap_tests['base'][] = new SOAP_Test('echoFloat', array('inputFloat' => 342.23));
-$soap_tests['base'][] = new SOAP_Test('echoFloat', array('inputFloat' => soap_value('inputFloat',123.45,XSD_FLOAT)));
-
-//***********************************************************
-// Base echoFloatArray
-
-$soap_tests['base'][] = new SOAP_Test('echoFloatArray', array('inputFloatArray' => array(1.3223,34.2,325.325)));
-$soap_tests['base'][] = new SOAP_Test('echoFloatArray',
- array('inputFloatArray' =>
- soap_value('inputFloatArray',
- array(new soapvar(123.45,XSD_FLOAT),new soapvar(654.321,XSD_FLOAT)),
- SOAP_ENC_ARRAY)));
-//***********************************************************
-// Base echoStruct
-
-$soapstruct = new SOAPStruct('arg',34,325.325);
-# XXX no way to set a namespace!!!
-$soapsoapstruct = soap_value('inputStruct',$soapstruct,SOAP_ENC_OBJECT);
-$soap_tests['base'][] = new SOAP_Test('echoStruct', array('inputStruct' =>$soapstruct));
-$soap_tests['base'][] = new SOAP_Test('echoStruct', array('inputStruct' =>$soapsoapstruct));
-
-//***********************************************************
-// Base echoStructArray
-
-$soap_tests['base'][] = new SOAP_Test('echoStructArray', array('inputStructArray' => array(
- $soapstruct,$soapstruct,$soapstruct)));
-$soap_tests['base'][] = new SOAP_Test('echoStructArray', array('inputStructArray' =>
- soap_value('inputStructArray',array($soapstruct,$soapstruct,$soapstruct),SOAP_ENC_ARRAY)));
-
-
-//***********************************************************
-// Base echoVoid
-
-$soap_tests['base'][] = new SOAP_Test('echoVoid', NULL);
-$test = new SOAP_Test('echoVoid', NULL);
-$test->type = 'soapval';
-$soap_tests['base'][] = $test;
-
-//***********************************************************
-// Base echoBase64
-
-$soap_tests['base'][] = new SOAP_Test('echoBase64', array('inputBase64' => 'TmVicmFza2E='));
-$soap_tests['base'][] = new SOAP_Test('echoBase64', array('inputBase64' =>
- soap_value('inputBase64','TmVicmFza2E=',XSD_BASE64BINARY)));
-
-//***********************************************************
-// Base echoHexBinary
-
-$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' => '736F61707834'));
-$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' =>
- soap_value('inputHexBinary','736F61707834',XSD_HEXBINARY)));
-
-//***********************************************************
-// Base echoDecimal
-
-# XXX test fails because php-soap incorrectly sets decimal to long rather than float
-$soap_tests['base'][] = new SOAP_Test('echoDecimal', array('inputDecimal' => 12345.67890));
-$soap_tests['base'][] = new SOAP_Test('echoDecimal', array('inputDecimal' =>
- soap_value('inputDecimal',12345.67890,XSD_DECIMAL)));
-
-//***********************************************************
-// Base echoDate
-
-# php-soap doesn't handle datetime types properly yet
-$soap_tests['base'][] = new SOAP_Test('echoDate', array('inputDate' => '2001-05-24T17:31:41Z'));
-$soap_tests['base'][] = new SOAP_Test('echoDate', array('inputDate' =>
- soap_value('inputDate','2001-05-24T17:31:41Z',XSD_DATETIME)));#'2001-04-25T13:31:41-0700'
-
-//***********************************************************
-// Base echoBoolean
-
-# php-soap sends boolean as zero or one, which is ok, but to be explicit, send true or false.
-$soap_tests['base'][] = new SOAP_Test('echoBoolean', array('inputBoolean' => TRUE));
-$soap_tests['base'][] = new SOAP_Test('echoBoolean', array('inputBoolean' =>
- soap_value('inputBoolean',TRUE,XSD_BOOLEAN)));
-$soap_tests['base'][] = new SOAP_Test('echoBoolean', array('inputBoolean' => FALSE));
-$soap_tests['base'][] = new SOAP_Test('echoBoolean', array('inputBoolean' =>
- soap_value('inputBoolean',FALSE,XSD_BOOLEAN)));
-
-#
-#
-#//***********************************************************
-#// GROUP B
-#
-#
-#//***********************************************************
-#// GroupB echoStructAsSimpleTypes
-#
-#$expect = array(
-# 'outputString'=>'arg',
-# 'outputInteger'=>34,
-# 'outputFloat'=>325.325
-# );
-#$soap_tests['GroupB'][] = new SOAP_Test('echoStructAsSimpleTypes',
-# array('inputStruct' => array(
-# 'varString'=>'arg',
-# 'varInt'=>34,
-# 'varFloat'=>325.325
-# )), $expect);
-#$soap_tests['GroupB'][] = new SOAP_Test('echoStructAsSimpleTypes',
-# array('inputStruct' =>
-# new SOAP_Value('inputStruct','SOAPStruct',
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# ))), $expect);
-#
-#//***********************************************************
-#// GroupB echoSimpleTypesAsStruct
-#
-#$expect =
-# array(
-# 'varString'=>'arg',
-# 'varInt'=>34,
-# 'varFloat'=>325.325
-# );
-#$soap_tests['GroupB'][] = new SOAP_Test('echoSimpleTypesAsStruct',
-# array(
-# 'inputString'=>'arg',
-# 'inputInteger'=>34,
-# 'inputFloat'=>325.325
-# ), $expect);
-#$soap_tests['GroupB'][] = new SOAP_Test('echoSimpleTypesAsStruct',
-# array(
-# new SOAP_Value('inputString','string','arg'),
-# new SOAP_Value('inputInteger','int',34),
-# new SOAP_Value('inputFloat','float',325.325)
-# ), $expect);
-#
-#//***********************************************************
-#// GroupB echo2DStringArray
-#
-#$soap_tests['GroupB'][] = new SOAP_Test('echo2DStringArray',
-# array('input2DStringArray' => make_2d(3,3)));
-#
-#$multidimarray =
-# new SOAP_Value('input2DStringArray','Array',
-# array(
-# array(
-# new SOAP_Value('item','string','row0col0'),
-# new SOAP_Value('item','string','row0col1'),
-# new SOAP_Value('item','string','row0col2')
-# ),
-# array(
-# new SOAP_Value('item','string','row1col0'),
-# new SOAP_Value('item','string','row1col1'),
-# new SOAP_Value('item','string','row1col2')
-# )
-# )
-# );
-#$multidimarray->options['flatten'] = TRUE;
-#$soap_tests['GroupB'][] = new SOAP_Test('echo2DStringArray',
-# array('input2DStringArray' => $multidimarray));
-#
-#//***********************************************************
-#// GroupB echoNestedStruct
-#
-#$soap_tests['GroupB'][] = new SOAP_Test('echoNestedStruct',
-# array('inputStruct' => array(
-# 'varString'=>'arg',
-# 'varInt'=>34,
-# 'varFloat'=>325.325,
-# 'varStruct' => array(
-# 'varString'=>'arg',
-# 'varInt'=>34,
-# 'varFloat'=>325.325
-# )
-# )));
-#$soap_tests['GroupB'][] = new SOAP_Test('echoNestedStruct',
-# array('inputStruct' =>
-# new SOAP_Value('inputStruct','struct',
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325),
-# new SOAP_Value('varStruct','SOAPStruct',
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# )
-# /*,NULL,'http://soapinterop.org/xsd'*/)
-# )
-# )));
-#
-#//***********************************************************
-#// GroupB echoNestedArray
-#
-#$soap_tests['GroupB'][] = new SOAP_Test('echoNestedArray',
-# array('inputStruct' => array(
-# 'varString'=>'arg',
-# 'varInt'=>34,
-# 'varFloat'=>325.325,
-# 'varArray' => array('red','blue','green')
-# )));
-#$soap_tests['GroupB'][] = new SOAP_Test('echoNestedArray',
-# array('inputStruct' =>
-# new SOAP_Value('inputStruct','struct',
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325),
-# new SOAP_Value('varArray','Array',
-# array( #push struct elements into one soap value
-# new SOAP_Value('item','string','red'),
-# new SOAP_Value('item','string','blue'),
-# new SOAP_Value('item','string','green')
-# )
-# )
-# )
-# )));
-#
-#
-#//***********************************************************
-#// GROUP C header tests
-#
-#//***********************************************************
-#// echoMeStringRequest php val tests
-#
-#// echoMeStringRequest with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 0,SOAP_TEST_ACTOR_NEXT);
-#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 1,SOAP_TEST_ACTOR_NEXT);
-#$this->type = 'soapval'; // force a soapval version of this test
-#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStringRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStringRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#//***********************************************************
-#// echoMeStringRequest soapval tests
-#
-#// echoMeStringRequest with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world');
-#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 1);
-#$this->type = 'soapval'; // force a soapval version of this test
-#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStringRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStringRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint header destination, must understand,
-#// invalid namespace, should recieve a fault
-##$test = new SOAP_Test('echoVoid', NULL);
-##$test->type = 'soapval';
-##$test->headers[] = new SOAP_Header('{http://unknown.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 1);
-##$test->headers_expect['echoMeStringRequest'] = array();
-##$test->expect_fault = TRUE;
-##$soap_tests['GroupC'][] = $test;
-#
-#//***********************************************************
-#// php val tests
-#// echoMeStructRequest with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
-# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
-# 0,SOAP_TEST_ACTOR_NEXT);
-#$test->headers_expect['echoMeStructRequest'] =
-# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
-# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
-# 1,SOAP_TEST_ACTOR_NEXT);
-#$test->headers_expect['echoMeStructRequest'] =
-# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
-# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
-# 0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStructRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
-# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
-# 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStructRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#//***********************************************************
-#// soapval tests
-#// echoMeStructRequest with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# ));
-#$test->headers_expect['echoMeStructRequest'] =
-# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# ), 1);
-#$test->headers_expect['echoMeStructRequest'] =
-# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# ), 0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStructRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# ), 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStructRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#//***********************************************************
-#// echoMeUnknown php val tests
-#// echoMeUnknown with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!',0,SOAP_TEST_ACTOR_NEXT);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!',1,SOAP_TEST_ACTOR_NEXT);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$test->expect_fault = TRUE;
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!',0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!', 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#//***********************************************************
-#// echoMeUnknown soapval tests
-#// echoMeUnknown with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!');
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!',1);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$test->expect_fault = TRUE;
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!', 0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!', 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-
-
-?> \ No newline at end of file
diff --git a/ext/soap/interop/client_round2_results.php b/ext/soap/interop/client_round2_results.php
deleted file mode 100644
index 69f82ab582..0000000000
--- a/ext/soap/interop/client_round2_results.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-// NOTE: do not run this directly under a web server, as it will take a very long
-// time to execute. Run from a command line or something, and redirect output
-// to an html file.
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-require_once 'client_round2_interop.php';
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
-<style>
-TD { background-color: Red; }
-TD.BLANK { background-color: White; }
-TD.OK { background-color: Lime; }
-TD.RESULT { background-color: Green; }
-TD.untested { background-color: White; }
-TD.CONNECT { background-color: Yellow; }
-TD.TRANSPORT { background-color: Yellow; }
-TD.WSDL { background-color: Yellow; }
-TD.WSDLCACHE { background-color: Yellow; }
-TD.WSDLPARSER { background-color: Yellow; }
-TD.HTTP { background-color: Yellow; }
-TD.SMTP { background-color: Yellow; }
-</style>
- <title>PEAR-PHP SOAP Interop Tests</title>
-</head>
-
-<body bgcolor="White" text="Black">
-<h2 align="center">SOAP Client Interop Test Results: Round2</h2>
-
-<a href="index.php">Back to Interop Index</a><br>
-<p>&nbsp;</p>
-
-<?php
-$iop = new Interop_Client();
-
-if ($_GET['detail'] == 1) $iop->showFaults = 1;
-
-if ($_GET['wire']) {
- $iop->showWire($_GET['wire']);
-} else {
- $iop->getEndpoints();
- $iop->getResults();
-
- if ($_GET['test']) {
- $iop->currentTest = $_GET['test'];
- $iop->useWSDL = $_GET['wsdl']?$_GET['wsdl']:0;
- $iop->paramType = $_GET['type']?$_GET['type']:'php';
- $iop->outputTable();
- } else {
- $iop->outputTables();
- }
-}
-?>
-</body>
-</html>
diff --git a/ext/soap/interop/client_round2_run.php b/ext/soap/interop/client_round2_run.php
deleted file mode 100644
index ab773c7e21..0000000000
--- a/ext/soap/interop/client_round2_run.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-// this script is usefull for quickly testing stuff, use the 'pretty' file for html output
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-set_time_limit(0);
-require_once 'client_round2_interop.php';
-
-$iop = new Interop_Client();
-// force a fetch of endpoints, this happens irregardless if no endpoints in database
-#$iop->fetchEndpoints();
-
-// set some options
-$iop->currentTest = 'base'; // see $tests above
-$iop->paramType = 'php'; // 'php' or 'soapval'
-$iop->useWSDL = 1; // 1= do wsdl tests
-$iop->numServers = 0; // 0 = all
-$iop->specificEndpoint = '4s4c'; // test only this endpoint
-$iop->testMethod = 'echoString'; // test only this method
-
-#XXX MS SOAP ToolKit 2.0/3.0 crashes php-soap in __getfault!
-
-// endpoints to skip
-$iop->skipEndpointList = array('Apache Axis','IONA XMLBus','IONA XMLBus (CORBA)','MS SOAP ToolKit 2.0','MS SOAP ToolKit 3.0','Spheon JSOAP','SQLData SOAP Server','WASP Advanced 3.0');
-$iop->startAt='';
-$this->nosave = 0; // 1= disable saving results to database
-// debug output
-$iop->show = 1;
-$iop->debug = 0;
-$iop->showFaults = 0; // used in result table output
-
-$iop->doTest(); // run a single set of tests using above options
-#$iop->doGroupTests(); // run a group of tests set in $currentTest
-#$iop->doTests(); // run all tests, ignore above options
-#$iop->outputTables();
-echo "done";
-
-?>
diff --git a/ext/soap/interop/database_round2.sql b/ext/soap/interop/database_round2.sql
deleted file mode 100644
index 79669a04c2..0000000000
--- a/ext/soap/interop/database_round2.sql
+++ /dev/null
@@ -1,45 +0,0 @@
-# phpMyAdmin MySQL-Dump
-# version 2.2.5
-# http://phpwizard.net/phpMyAdmin/
-# http://phpmyadmin.sourceforge.net/ (download page)
-#
-# Host: localhost
-# Generation Time: Apr 08, 2002 at 08:32 PM
-# Server version: 3.23.49
-# PHP Version: 4.1.1
-# Database : `interop`
-# --------------------------------------------------------
-
-#
-# Table structure for table `endpoints`
-#
-
-CREATE TABLE endpoints (
- id int(11) NOT NULL auto_increment,
- endpointName varchar(50) NOT NULL default '',
- endpointURL varchar(255) NOT NULL default '',
- wsdlURL varchar(255) NOT NULL default '',
- class varchar(20) NOT NULL default '',
- status int(11) NOT NULL default '1',
- PRIMARY KEY (id)
-) TYPE=MyISAM;
-# --------------------------------------------------------
-
-#
-# Table structure for table `results`
-#
-
-CREATE TABLE results (
- id int(11) NOT NULL auto_increment,
- endpoint int(11) NOT NULL default '0',
- stamp int(11) NOT NULL default '0',
- class varchar(10) NOT NULL default '',
- type varchar(10) default NULL,
- wsdl int(11) NOT NULL default '0',
- function varchar(255) NOT NULL default '',
- result varchar(25) NOT NULL default '',
- error text,
- wire text NOT NULL,
- PRIMARY KEY (id)
-) TYPE=MyISAM;
-
diff --git a/ext/soap/interop/echoheadersvc.wsdl b/ext/soap/interop/echoheadersvc.wsdl
deleted file mode 100644
index a279580dc3..0000000000
--- a/ext/soap/interop/echoheadersvc.wsdl
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<definitions name="InteropTest" targetNamespace="http://soapinterop.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://soapinterop.org/" xmlns:s="http://soapinterop.org/xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
-
- <import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/"/>
- <import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/xsd"/>
- <import location="http://www.whitemesa.com/interop/InteropTestC.wsdl" namespace="http://soapinterop.org/"/>
-
- <service name="interopLabEchoHeader">
-
- <port name="interopPortEchoHdr" binding="tns:InteropEchoHeaderBinding">
- <soap:address location="http://localhost/soap_interop/server_round2.php"/>
- </port>
-
- </service>
-
-</definitions>
diff --git a/ext/soap/interop/endpointdata.sql b/ext/soap/interop/endpointdata.sql
deleted file mode 100644
index 80d9d5ac9c..0000000000
--- a/ext/soap/interop/endpointdata.sql
+++ /dev/null
@@ -1,85 +0,0 @@
-# phpMyAdmin MySQL-Dump
-# version 2.2.5
-# http://phpwizard.net/phpMyAdmin/
-# http://phpmyadmin.sourceforge.net/ (download page)
-#
-# Host: localhost
-# Generation Time: Jul 14, 2002 at 03:13 PM
-# Server version: 3.23.49
-# PHP Version: 4.2.1
-# Database : `interop2`
-
-#
-# Dumping data for table `endpoints`
-#
-
-INSERT INTO endpoints VALUES (1, '4s4c', 'http://soap.4s4c.com/ilab/soap.asp', 'http://www.pocketsoap.com/services/ilab.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (2, '4s4c v2.0', 'http://soap.4s4c.com/ilab2/soap.asp', 'http://soap.4s4c.com/ilab2/ilab.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (3, 'Apache Axis', 'http://nagoya.apache.org:5049/axis/services/echo', 'http://nagoya.apache.org:5049/axis/services/echo?wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (4, 'Apache SOAP 2.2', 'http://nagoya.apache.org:5049/soap/servlet/rpcrouter', 'http://www.apache.org/~rubys/ApacheSoap.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (5, 'ASP.NET Web Services', 'http://www.mssoapinterop.org/asmx/simple.asmx', 'http://www.mssoapinterop.org/asmx/simple.asmx?wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (6, 'CapeConnect', 'http://interop.capeclear.com/ccx/soapbuilders-round2', 'http://interop.capeclear.com/wsdl/soapbuilders-round2.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (7, 'Delphi SOAP', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropService.exe/soap/InteropTestPortType', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropService.exe/wsdl/InteropTestPortType', 'base', 1);
-INSERT INTO endpoints VALUES (8, 'EasySoap++', 'http://easysoap.sourceforge.net/cgi-bin/interopserver', 'http://easysoap.sourceforge.net/interopA.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (9, 'eSOAP', 'http://www.quakersoft.net/cgi-bin/interop2_server.cgi', 'http://www.quakersoft.net/wsdl/interop2.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (10, 'gSOAP', 'http://websrv.cs.fsu.edu/~engelen/interop2.cgi', 'http://www.cs.fsu.edu/~engelen/interop2.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (11, 'Frontier', 'http://www.soapware.org/xmethodsInterop', '', 'base', 1);
-INSERT INTO endpoints VALUES (12, 'GLUE', 'http://www.themindelectric.net:8005/glue/round2', 'http://www.themindelectric.net:8005/glue/round2.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (13, 'HP SOAP', 'http://soap.bluestone.com/hpws/soap/EchoService', 'http://soap.bluestone.com/hpws/soap/EchoService.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (14, 'IONA XMLBus', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/BaseService/BasePort', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/BaseService/BasePort', 'base', 1);
-INSERT INTO endpoints VALUES (15, 'IONA XMLBus (CORBA)', 'http://interop.xmlbus.com:7002/xmlbus/container/CORBAInterop/BaseService/BasePort', 'http://interop.xmlbus.com:7002/xmlbus/container/CORBAInterop/BaseService/BasePort', 'base', 1);
-INSERT INTO endpoints VALUES (16, 'kSOAP', 'http://kissen.cs.uni-dortmund.de:8080/ksoapinterop', 'http://www.whitemesa.com/interop/kSOAP.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (17, 'MS .NET Remoting', 'http://www.mssoapinterop.org/remoting/ServiceA.soap', 'http://www.mssoapinterop.org/remoting/ServiceA.soap?wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (18, 'MS SOAP ToolKit 2.0', 'http://mssoapinterop.org/stk/Interop.wsdl', 'http://mssoapinterop.org/stk/Interop.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (19, 'MS SOAP ToolKit 3.0', 'http://mssoapinterop.org/stkV3/Interop.wsdl', 'http://mssoapinterop.org/stkV3/Interop.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (20, 'NuSOAP', 'http://dietrich.ganx4.com/nusoap/testbed/round2_base_server.php', 'http://dietrich.ganx4.com/nusoap/testbed/round2_base.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (21, 'OpenLink', 'http://demo.openlinksw.com:8890/Interop', 'http://demo.openlinksw.com:8890/Interop/services.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (24, 'SIM', 'http://soapinterop.simdb.com/round2', 'http://soapinterop.simdb.com/round2?WSDL', 'base', 1);
-INSERT INTO endpoints VALUES (25, 'SOAP4R', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/SOAP4R_SOAPBuildersInteropTest_R2base.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (26, 'SOAP:Lite', 'http://services.soaplite.com/interop.cgi', 'http://services.soaplite.com/interop2.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (27, 'Spheon JSOAP', 'http://213.23.125.181:8081/RPC', 'http://213.23.125.181:8081/interop.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (28, 'Spray 2001', 'http://www.dolphinharbor.org/services/interop2001', 'http://www.dolphinharbor.org/services/interop2001/service.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (29, 'SQLData SOAP Server', 'http://soapclient.com/interop/sqldatainterop.wsdl', 'http://soapclient.com/interop/sqldatainterop.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (30, 'WASP Advanced 3.0', 'http://soap.systinet.net:6060/InteropService/', 'http://soap.systinet.net:6060/InteropService/', 'base', 1);
-INSERT INTO endpoints VALUES (32, 'White Mesa SOAP Server', 'http://www.whitemesa.net/interop/std', 'http://www.whitemesa.net/wsdl/std/interop.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (33, 'PEAR SOAP', 'http://localhost/soap_interop/server_round2.php', 'http://localhost/soap_interop/interop.wsdl.php', 'base', 1);
-INSERT INTO endpoints VALUES (34, '4s4c', 'http://soap.4s4c.com/ilab/soap.asp', 'http://www.pocketsoap.com/services/ilab_b.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (35, '4s4c v2.0', 'http://soap.4s4c.com/ilab2/soap.asp', 'http://soap.4s4c.com/ilab2/ilab_b.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (36, 'Apache Axis', 'http://nagoya.apache.org:5049/axis/services/echo', 'http://nagoya.apache.org:5049/axis/services/echo?wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (37, 'ASP.NET Web Services', 'http://www.mssoapinterop.org/asmx/simpleB.asmx', 'http://www.mssoapinterop.org/asmx/simpleb.asmx?wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (38, 'Delphi SOAP', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropGroupB.exe/soap/InteropTestPortTypeB', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropGroupB.exe/wsdl/InteropTestPortTypeB', 'GroupB', 1);
-INSERT INTO endpoints VALUES (39, 'EasySoap++', 'http://easysoap.sourceforge.net/cgi-bin/interopserver', 'http://easysoap.sourceforge.net/interopB.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (40, 'GLUE', 'http://www.themindelectric.net:8005/glue/round2B', 'http://www.themindelectric.net:8005/glue/round2B.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (41, 'gSOAP', 'http://websrv.cs.fsu.edu/~engelen/interop2B.cgi', 'http://www.cs.fsu.edu/~engelen/interop2B.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (42, 'HP SOAP', 'http://soap.bluestone.com/hpws/soap/EchoService', 'http://soap.bluestone.com/hpws/soap/EchoService.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (43, 'IONA XMLBus', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/GroupBService/GroupBPort', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/GroupBService/GroupBPort', 'GroupB', 1);
-INSERT INTO endpoints VALUES (44, 'MS .NET Remoting', 'http://www.mssoapinterop.org/remoting/ServiceB.soap', 'http://www.mssoapinterop.org/remoting/ServiceB.soap?wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (45, 'MS SOAP ToolKit 2.0', 'http://mssoapinterop.org/stk/InteropBtyped.wsdl', 'http://mssoapinterop.org/stk/InteropBtyped.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (46, 'MS SOAP ToolKit 3.0', 'http://mssoapinterop.org/stkV3/InteropB.wsdl', 'http://mssoapinterop.org/stkV3/InteropB.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (47, 'NuSOAP', 'http://dietrich.ganx4.com/nusoap/testbed/round2_groupb_server.php', 'http://dietrich.ganx4.com/nusoap/testbed/round2_groupb.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (48, 'OpenLink', 'http://demo.openlinksw.com:8890/Interop', 'http://demo.openlinksw.com:8890/Interop/services.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (50, 'SIM', 'http://soapinterop.simdb.com/round2B', 'http://soapinterop.simdb.com/round2B?WSDL', 'GroupB', 1);
-INSERT INTO endpoints VALUES (51, 'SOAP4R', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/SOAP4R_SOAPBuildersInteropTest_R2GroupB.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (52, 'SOAP:Lite', 'http://services.soaplite.com/interop.cgi', 'http://services.soaplite.com/InteropTestB.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (53, 'Spheon JSOAP', 'http://213.23.125.181:8081/RPC', 'http://213.23.125.181:8081/interopb.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (54, 'Spray 2001', 'http://www.dolphinharbor.org/services/interopB2001', 'http://www.dolphinharbor.org/services/interopB2001/service.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (55, 'SQLData SOAP Server', 'http://soapclient.com/interop/InteropB.wsdl', 'http://soapclient.com/interop/InteropB.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (56, 'WASP Advanced 3.0', 'http://soap.systinet.net:6060/InteropBService/', 'http://soap.systinet.net:6060/InteropBService/', 'GroupB', 1);
-INSERT INTO endpoints VALUES (58, 'White Mesa SOAP Server', 'http://www.whitemesa.net/interop/std/groupB', 'http://www.whitemesa.net/wsdl/std/interopB.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (59, 'PEAR SOAP', 'http://localhost/soap_interop/server_round2.php', 'http://localhost/soap_interop/interopB.wsdl.php', 'GroupB', 1);
-INSERT INTO endpoints VALUES (60, '4s4c v2.0', 'http://soap.4s4c.com/ilab2/soap.asp', 'http://soap.4s4c.com/ilab2/ilab_c.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (61, 'Apache Axis', 'http://nagoya.apache.org:5049/axis/services/echo', 'http://nagoya.apache.org:5049/axis/services/echo?wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (62, 'ASP.NET Web Services', 'http://mssoapinterop.org/asmx/header.asmx', 'http://mssoapinterop.org/asmx/header.asmx?wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (63, 'EasySoap++', 'http://easysoap.sourceforge.net/cgi-bin/interopserver', 'http://easysoap.sourceforge.net/interopC.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (64, 'MS SOAP ToolKit 2.0', 'http://mssoapinterop.org/stk/InteropC.wsdl', 'http://mssoapinterop.org/stk/InteropC.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (65, 'MS SOAP ToolKit 3.0', 'http://mssoapinterop.org/stkV3/InteropC.wsdl', 'http://mssoapinterop.org/stkV3/InteropC.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (66, 'OpenLink', 'http://demo.openlinksw.com:8890/Interop', 'http://demo.openlinksw.com:8890/Interop/services.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (67, 'SOAP:Lite', 'http://services.soaplite.com/interopC.cgi', 'http://services.soaplite.com/InteropTestC.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (68, 'Spray 2001', 'http://www.dolphinharbor.org/services/interopC', 'http://www.dolphinharbor.org/services/interopC/service.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (69, 'SQLData SOAP Server', 'http://soapclient.com/interop/interopC.wsdl', 'http://soapclient.com/interop/interopC.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (70, 'WASP Advanced 3.0', 'http://soap.systinet.net:6060/InteropCService/', 'http://soap.systinet.net:6060/InteropCService/', 'GroupC', 1);
-INSERT INTO endpoints VALUES (71, 'White Mesa SOAP Server', 'http://www.whitemesa.net/interop/std/echohdr', 'http://www.whitemesa.net/wsdl/std/echoheadersvc.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (72, 'PEAR SOAP', 'http://localhost/soap_interop/server_round2.php', 'http://localhost/soap_interop/echoheadersvc.wsdl.php', 'GroupC', 1);
-
-
-
diff --git a/ext/soap/interop/index.php b/ext/soap/interop/index.php
deleted file mode 100644
index ed222479b2..0000000000
--- a/ext/soap/interop/index.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
- <title>PEAR SOAP Interop</title>
-</head>
-<?php
-// get our endpoint
-$server = $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'];
-$endpoint = 'http://'.$server."/soap_interop/server_round2.php";
-$base = 'http://'.$server."/soap_interop/interop.wsdl";
-$groupb = 'http://'.$server."/soap_interop/interopB.wsdl";
-$groupc = 'http://'.$server."/soap_interop/echoheadersvc.wsdl";
-?>
-<body>
-
-<h2 align='center'>PEAR SOAP Interop</h2>
-<p>Welcome to the PEAR SOAP Interop pages. These pages are set up for
-SOAP Builder interop tests. You can find out more about the interop tests
-at <a href="http://www.whitemesa.com/interop.htm">White Mesa</a>.</p>
-<p>Currently Round 2 base, Group B and Group C interop tests are enabled.</p>
-
-<h3>Round 2 Interop Server</h3>
-Endpoint: <?php echo $endpoint; ?><br>
-Base WSDL: <a href="<?php echo $base ?>"><?php echo $base ?></a><br>
-Group B WSDL: <a href="<?php echo $groupb ?>"><?php echo $groupb ?></a><br>
-Group C WSDL: <a href="<?php echo $groupc ?>"><?php echo $groupc ?></a><br>
-
-<h3>Interop Client</h3>
-
-<p>
-Notes:
-Tests are done both "Direct" and with "WSDL". WSDL tests use the supplied interop WSDL
-to run the tests against. The Direct method uses an internal prebuilt list of methods and parameters
-for the test.</p>
-<p>
-Tests are also run against two methods of generating method parameters. The first, 'php', attempts
-to directly serialize PHP variables into soap values. The second method, 'soapval', uses a SOAP_Value
-class to define what the type of the value is. The second method is more interopable than the first
-by nature.
-</p>
-
-<h3>Client Test Interface</h3>
-<p>The <a href="client_round2.php">client interface</a> allows you to run the PEAR SOAP
-Client against a choosen interop server. Each run updates the results database below.</p>
-
-<h3>Interop Client Test Results</h3>
-<p>This is a database of the current test results using PEAR SOAP Clients against interop servers.</p>
-<p>
-More detail (wire) about errors (marked yellow or red) can be obtained by clicking on the
-link in the result box. If we have an HTTP error
-attempting to connect to the endpoint, we will mark all consecutive attempts as errors, and skip
-testing that endpoint. This reduces the time it takes to run the tests if a server is unavailable.
-WSDLCACHE errors mean we cannot retreive the WSDL file specified for the endpoint.
-</p>
-
-<ul>
-<li><a href="client_round2_results.php?test=base&type=php&wsdl=0">Base results using PHP native types</a></li>
-<li><a href="client_round2_results.php?test=base&type=soapval&wsdl=0">Base results using SOAP types</a></li>
-<li><a href="client_round2_results.php?test=base&type=php&wsdl=1">Base results using PHP native types with WSDL</a></li>
-<li><a href="client_round2_results.php?test=GroupB&type=php&wsdl=0">Group B results using PHP native types</a></li>
-<li><a href="client_round2_results.php?test=GroupB&type=soapval&wsdl=0">Group B results using SOAP types</a></li>
-<li><a href="client_round2_results.php?test=GroupB&type=php&wsdl=1">Group B results using PHP native types with WSDL</a></li>
-<li><a href="client_round2_results.php?test=GroupC&type=php&wsdl=0">Group C results using PHP native types</a></li>
-<li><a href="client_round2_results.php?test=GroupC&type=soapval&wsdl=0">Group C results using SOAP types</a></li>
-<li><a href="client_round2_results.php?test=GroupC&type=php&wsdl=1">Group C results using PHP native types with WSDL</a></li>
-<li><a href="client_round2_results.php">Show All Results</a></li>
-</ul>
-</body>
-</html>
diff --git a/ext/soap/interop/info.php b/ext/soap/interop/info.php
deleted file mode 100644
index 147cebcdd4..0000000000
--- a/ext/soap/interop/info.php
+++ /dev/null
@@ -1 +0,0 @@
-<?php phpinfo(); ?>
diff --git a/ext/soap/interop/interop.wsdl b/ext/soap/interop/interop.wsdl
deleted file mode 100644
index 6a835b571f..0000000000
--- a/ext/soap/interop/interop.wsdl
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-
-<definitions name="InteropTest" targetNamespace="http://soapinterop.org/"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://soapinterop.org/">
-
- <import location="http://www.whitemesa.com/wsdl/wmmsgrouter.xsd" namespace="http://whitemesa.com/headers/soapmsgrouter.xsd"/>
- <import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/"/>
- <import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/xsd"/>
-
- <service name="interopLab">
- <port name="interopTestPort" binding="tns:InteropTestSoapBinding">
- <soap:address location="http://localhost/soap_interop/server_round2.php"/>
- </port>
- </service>
-
-</definitions>
diff --git a/ext/soap/interop/interopB.wsdl b/ext/soap/interop/interopB.wsdl
deleted file mode 100644
index 92301af334..0000000000
--- a/ext/soap/interop/interopB.wsdl
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<definitions name="InteropTest" targetNamespace="http://soapinterop.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://soapinterop.org/" xmlns:s="http://soapinterop.org/xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
-
- <import location="http://www.whitemesa.com/interop/InteropTestB.wsdl" namespace="http://soapinterop.org/"/>
- <import location="http://www.whitemesa.com/interop/InteropTestB.wsdl" namespace="http://soapinterop.org/xsd"/>
-
- <service name="interopLabB">
- <port name="interopTestPortB" binding="tns:InteropTestSoapBindingB">
- <soap:address location="http://localhost/soap_interop/server_round2.php"/>
- </port>
- </service>
-
-</definitions>
diff --git a/ext/soap/interop/server_round2.php b/ext/soap/interop/server_round2.php
deleted file mode 100644
index a8eafe1eb2..0000000000
--- a/ext/soap/interop/server_round2.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'SOAP/Server.php';
-
-$server = new SOAP_Server;
-
-require_once 'server_round2_base.php';
-require_once 'server_round2_groupB.php';
-require_once 'server_round2_groupC.php';
-
-$server->service(isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:NULL);
-#echo "Content-Length is {$_SERVER['CONTENT_LENGTH']}\n\n";
-#echo "<!---\n\nlen:".strlen($HTTP_RAW_POST_DATA)."\n\n";
-#echo "[$HTTP_RAW_POST_DATA";
-#print "]\n\nend of input data-->";
-?> \ No newline at end of file
diff --git a/ext/soap/interop/server_round2_base.php b/ext/soap/interop/server_round2_base.php
deleted file mode 100644
index 15dc48e565..0000000000
--- a/ext/soap/interop/server_round2_base.php
+++ /dev/null
@@ -1,184 +0,0 @@
-<?
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more |
-// | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-require_once 'SOAP/Server.php';
-
-function generateFault($short, $long)
-{
- $params = array(
- "faultcode" => "Server",
- "faultstring" => $short,
- "detail" => $long
- );
-
- $faultmsg = new SOAP_Message("Fault",$params,"http://schemas.xmlsoap.org/soap/envelope/");
- return $faultmsg;
-}
-
-function hex2bin($data)
-{
- $len = strlen($data);
- return pack("H" . $len, $data);
-}
-
-
-class SOAP_Interop_Base {
- var $method_namespace = 'http://soapinterop.org/';
-
- function SOAP_Interop_Base() {
- #if ($server) {
- # $server->addToMap("echoString",array("string"),array("string"));
- # $server->addToMap("echoStringArray",array(),array());
- # $server->addToMap("echoInteger",array("int"),array("int"));
- # $server->addToMap("echoIntegerArray",array(),array());
- # $server->addToMap("echoFloat",array("float"),array("float"));
- # $server->addToMap("echoFloatArray",array(),array());
- # $server->addToMap("echoStruct",array(),array());
- # $server->addToMap("echoStructArray",array(),array());
- # $server->addToMap("echoVoid",array(),array());
- # $server->addToMap("echoBase64",array("base64Binary"),array("base64Binary"));
- # $server->addToMap("echoDate",array("dateTime"),array("dateTime"));
- # $server->addToMap("echoHexBinary",array("hexBinary"),array("hexBinary"));
- # $server->addToMap("echoDecimal",array("decimal"),array("decimal"));
- # $server->addToMap("echoBoolean",array("boolean"),array("boolean"));
- #}
- }
-
- function echoString($inputString)
- {
- return new SOAP_Value('outputString','string',$inputString);
- }
-
- function echoStringArray($inputStringArray)
- {
- $ra = array();
- if ($inputStringArray) {
- foreach($inputStringArray as $s) {
- $ra[] = new SOAP_Value('item','string',$s);
- }
- }
- return new SOAP_Value('outputStringArray',NULL,$ra);
- }
-
-
- function echoInteger($inputInteger)
- {
- return new SOAP_Value('outputInteger','int',(integer)$inputInteger);
- }
-
- function echoIntegerArray($inputIntegerArray)
- {
- $ra = array();
- if ($inputIntegerArray) {
- foreach ($inputIntegerArray as $i) {
- $ra[] = new SOAP_Value('item','int',$i);
- }
- }
- return new SOAP_Value('outputIntArray',NULL,$ra);
- }
-
- function echoFloat($inputFloat)
- {
- return new SOAP_Value('outputFloat','float',(FLOAT)$inputFloat);
- }
-
- function echoFloatArray($inputFloatArray)
- {
- $ra = array();
- if ($inputFloatArray) {
- foreach($inputFloatArray as $float) {
- $ra[] = new SOAP_Value('item','float',(FLOAT)$float);
- }
- }
- return new SOAP_Value('outputFloatArray',NULL,$ra);
- }
-
- function echoStruct($inputStruct)
- {
- return new SOAP_Value('return','{http://soapinterop.org/xsd}SOAPStruct',
- array(
- new SOAP_Value('varInt','int',$inputStruct['varInt']),
- new SOAP_Value('varFloat','float',$inputStruct['varFloat']),
- new SOAP_Value('varString','string',$inputStruct['varString'])
- ));
- }
-
- function echoStructArray($inputStructArray)
- {
- $ra = array();
- if ($inputStructArray) {
- foreach($inputStructArray as $struct) {
- $ra[] = new SOAP_Value('item','{http://soapinterop.org/xsd}SOAPStruct',
- array(
- new SOAP_Value('varInt','int',$struct['varInt']),
- new SOAP_Value('varFloat','float',$struct['varFloat']),
- new SOAP_Value('varString','string',$struct['varString'])
- ));
- }
- }
- return $ra;
- }
-
- function echoVoid()
- {
- return NULL;
- }
-
- function echoBase64($b_encoded)
- {
- return new SOAP_Value('return','base64Binary',base64_encode(base64_decode($b_encoded)));
- }
-
- function echoDate($timeInstant)
- {
- $dt = new SOAP_Type_dateTime($timeInstant);
- if ($dt->toUnixtime() != -1) {
- $value = $dt->toSOAP();
- return new SOAP_Value('return','dateTime',$value);
- } else {
- return new SOAP_Fault("Value $timeInstant is not a dateTime value");
- }
- }
-
- function echoHexBinary($hb)
- {
- return new SOAP_Value('return','hexBinary',bin2hex(hex2bin($hb)));
- }
-
- function echoDecimal($dec)
- {
- return new SOAP_Value('return','decimal',(FLOAT)$dec);
- }
-
- function echoBoolean($boolean)
- {
- return new SOAP_Value('return','boolean',$boolean);
- }
-
- function echoMimeAttachment($stuff)
- {
- return new SOAP_Attachment('return','application/octet-stream',NULL,$stuff);
- }
-}
-
-$base = new SOAP_Interop_Base();
-$server->addObjectMap($base);
-?> \ No newline at end of file
diff --git a/ext/soap/interop/server_round2_groupB.php b/ext/soap/interop/server_round2_groupB.php
deleted file mode 100644
index fa5856a26e..0000000000
--- a/ext/soap/interop/server_round2_groupB.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more |
-// | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-require_once 'SOAP/Server.php';
-
-class SOAP_Interop_GroupB {
- var $method_namespace = 'http://soapinterop.org/';
- var $dispatch_map = array();
-
- function SOAP_Interop_GroupB() {
- $this->dispatch_map['echoStructAsSimpleTypes'] =
- array('in' => array('inputStruct' => 'SOAPStruct'),
- 'out' => array('outputString' => 'string', 'outputInteger' => 'int', 'outputFloat' => 'float')
- );
-
-# $server->addToMap('echoSimpleTypesAsStruct',
-# array('outputString' => 'string', 'outputInteger' => 'int', 'outputFloat' => 'float'),
-# array('return' => 'struct'));
-# $server->addToMap('echoNestedStruct', array(), array());
-# $server->addToMap('echo2DStringArray', array(), array());
-# $server->addToMap('echoNestedArray', array(), array());
- }
- function echoStructAsSimpleTypes ($struct)
- {
- # convert a SOAPStruct to an array
- $vals = array_values($struct);
- return array(
- new SOAP_Value('outputString','string',$struct['varString']),
- new SOAP_Value('outputInteger','int',$struct['varInt']),
- new SOAP_Value('outputFloat','float',$struct['varFloat'])
- );
- return array_values($struct);
- }
-
- function echoSimpleTypesAsStruct($string, $int, $float)
- {
- # convert a input into struct
- $ret = new SOAP_Value('return','{http://soapinterop.org/xsd}SOAPStruct',
- array( #push struct elements into one soap value
- new SOAP_Value('varString','string',$string),
- new SOAP_Value('varInt','int',(int)$int),
- new SOAP_Value('varFloat','float',(FLOAT)$float)
- )
- );
- return $ret;
- }
-
- function echoNestedStruct($struct)
- {
- return $struct;
- }
-
- function echo2DStringArray($ary)
- {
- $ret = new SOAP_Value('return','Array',$ary);
- $ret->options['flatten'] = TRUE;
- return $ret;
- }
-
- function echoNestedArray($ary)
- {
- return $ary;
- }
-}
-
-$groupb = new SOAP_Interop_GroupB();
-$server->addObjectMap($groupb);
-
-?> \ No newline at end of file
diff --git a/ext/soap/interop/server_round2_groupC.php b/ext/soap/interop/server_round2_groupC.php
deleted file mode 100644
index b323f9ba06..0000000000
--- a/ext/soap/interop/server_round2_groupC.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-require_once 'SOAP/Server.php';
-require_once 'SOAP/Value.php';
-
-class SOAP_Interop_GroupC {
- var $method_namespace = 'http://soapinterop.org/echoheader/';
-
- function echoMeStringRequest($string)
- {
- return new SOAP_Value('{'.$this->method_namespace.'}echoMeStringResponse','string',$string);
- }
-
- function echoMeStructRequest($struct)
- {
- return new SOAP_Value('{'.$this->method_namespace.'}echoMeStructResponse','SOAPStruct',$struct);
- }
-}
-
-$groupc = new SOAP_Interop_GroupC();
-$server->addObjectMap($groupc);
-
-?> \ No newline at end of file
diff --git a/ext/soap/interop/server_round2_test.php b/ext/soap/interop/server_round2_test.php
deleted file mode 100644
index 3c050f7a1b..0000000000
--- a/ext/soap/interop/server_round2_test.php
+++ /dev/null
@@ -1,258 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'SOAP/Server.php';
-
-$server = new SOAP_Server;
-
-require_once 'server_round2_base.php';
-require_once 'server_round2_groupB.php';
-require_once 'server_round2_groupC.php';
-
-$test = '<?xml version="1.0"?>
-
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:si="http://soapinterop.org/xsd"
- xmlns:ns6="http://soapinterop.org/echoheader/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-<SOAP-ENV:Header>
-
-<ns6:echoMeStringRequest xsi:type="xsd:string" SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:mustUnderstand="0">hello world</ns6:echoMeStringRequest>
-</SOAP-ENV:Header>
-<SOAP-ENV:Body>
-
-<echoVoid></echoVoid>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>';
-
-$test = '<?xml version="1.0"?>
-
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:si="http://soapinterop.org/xsd"
- xmlns:ns6="http://soapinterop.org/echoheader/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-<SOAP-ENV:Header>
-
-<ns6:echoMeStructRequest xsi:type="si:SOAPStruct"
- SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next"
- SOAP-ENV:mustUnderstand="1">
-<varString xsi:type="xsd:string">arg</varString>
-
-<varInt xsi:type="xsd:int">34</varInt>
-
-<varFloat xsi:type="xsd:float">325.325</varFloat>
-</ns6:echoMeStructRequest>
-</SOAP-ENV:Header>
-<SOAP-ENV:Body>
-
-<echoVoid></echoVoid>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-';
-
-$test = '<?xml version="1.0"?>
-
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:si="http://soapinterop.org/xsd"
- xmlns:ns6="http://soapinterop.org/echoheader/"
- xmlns:ns7="http://soapinterop.org/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-<SOAP-ENV:Body>
-
-<ns7:echoString>
-<inputString xsi:type="xsd:string"></inputString>
-</ns7:echoString>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-';
-$test = '<?xml version="1.0" encoding="US-ASCII"?>
-
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:si="http://soapinterop.org/xsd"
- xmlns:ns6="http://soapinterop.org/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-<SOAP-ENV:Body>
-<ns6:echoVoid/>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>';
-
-$test = '<?xml version="1.0" encoding="US-ASCII"?>
-
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:si="http://soapinterop.org/xsd"
- xmlns:ns6="http://soapinterop.org/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-<SOAP-ENV:Body>
-<ns6:echoIntegerArray><inputIntegerArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:int[3]" SOAP-ENC:offset="[0]"><item xsi:type="xsd:int">1</item>
-<item xsi:type="xsd:int">234324324</item>
-<item xsi:type="xsd:int">2</item>
-</inputIntegerArray>
-</ns6:echoIntegerArray>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>';
-
-#$test = "<S:Envelope
-#S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
-#xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/'
-#xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'
-#xmlns:a='http://soapinterop.org/'
-#xmlns:b='http://soapinterop.org/xsd'
-#xmlns:XS='http://www.w3.org/2001/XMLSchema'
-#xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'>
-#<S:Body>
-#<b:SOAPStruct Enc:root='0' id='21b56c4' XI:type='b:SOAPStruct'>
-#<varInt XI:type='XS:int'>1</varInt>
-#<varFloat XI:type='XS:float'>2</varFloat>
-#<varString XI:type='XS:string'>wilma</varString>
-#</b:SOAPStruct>
-#<a:echoStructArray>
-#<inputStructArray XI:type='Enc:Array' Enc:arrayType='XS:anyType[3]'>
-#<fred href='#21b56c4'/>
-#<i href='#21b56c4'/>
-#<i href='#21b56c4'/>
-#</inputStructArray>
-#</a:echoStructArray>
-#</S:Body></S:Envelope>";
-
-#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:b='http://soapinterop.org/xsd' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoStructArray><inputStructArray XI:type='Enc:Array' Enc:arrayType='b:SOAPStruct[2]'><inputStruct href='#213e654'/> <inputStruct href='#21b8c4c'/> </inputStructArray> </a:echoStructArray> <b:SOAPStruct Enc:root='0' id='21b8c4c' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>-1</varInt> <varFloat XI:type='XS:float'>-1</varFloat> <varString XI:type='XS:string'>lean on into the groove y'all</varString> </b:SOAPStruct> <b:SOAPStruct Enc:root='0' id='213e654' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>1073741824</varInt> <varFloat XI:type='XS:float'>-42.24</varFloat> <varString XI:type='XS:string'>pocketSOAP rocks!&lt;g&gt;</varString> </b:SOAPStruct> </S:Body></S:Envelope>";
-
-#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:b='http://soapinterop.org/' xmlns:a='http://soapinterop.org/headers/' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Header> <a:Transaction S:mustUnderstand='1' XI:type='XS:short'>5</a:Transaction> </S:Header> <S:Body><b:echoString><inputString XI:type='XS:string'>Opps, should never see me</inputString> </b:echoString> </S:Body></S:Envelope>";
-#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:b='http://soapinterop.org/' xmlns:a='http://soapinterop.org/headers/' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Header> <a:Transaction XI:type='XS:short'>5</a:Transaction> </S:Header> <S:Body><b:echoString><inputString XI:type='XS:string'>Opps, should never see me</inputString> </b:echoString> </S:Body></S:Envelope>";
-#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:b='http://soapinterop.org/xsd' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoStructAsSimpleTypes><inputStruct href='#213e59c'/> </a:echoStructAsSimpleTypes> <b:SOAPStruct Enc:root='0' id='213e59c' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>42</varInt> <varString XI:type='XS:string'>Orbital</varString> <varFloat XI:type='XS:float'>-42.42</varFloat> </b:SOAPStruct> </S:Body></S:Envelope>";
-
-// white mesa failures
-/*$test = '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><h:echoMeStringRequest SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:mustUnderstand="1" xmlns:h="http://unknown.org/">White Mesa Test Header String.</h:echoMeStringRequest></SOAP-ENV:Header><SOAP-ENV:Body><m:echoVoid SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:m="http://soapinterop.org/" /></SOAP-ENV:Body></SOAP-ENV:Envelope>';
-*/
-/*
-$test = '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><h:echoMeStringRequest SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:mustUnderstand="1" xmlns:h="http://unknown.org/">White Mesa Test Header String.</h:echoMeStringRequest></SOAP-ENV:Header><SOAP-ENV:Body><m:echoVoid SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:m="http://soapinterop.org/" /></SOAP-ENV:Body></SOAP-ENV:Envelope>';
-*/
-//$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoIntegerArray><inputIntegerArray XI:nil='true'></inputIntegerArray> </a:echoIntegerArray> </S:Body></S:Envelope>";
-
-$test = '<?xml version="1.0" encoding="UTF-8"?>
-
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:ns4="http://soapinterop.org/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-<SOAP-ENV:Body>
-
-<ns4:echo2DStringArray>
-<input2DStringArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[2,3]">
-<item xsi:type="xsd:string">row0col0</item>
-<item xsi:type="xsd:string">row0col1</item>
-<item xsi:type="xsd:string">row0col2</item>
-<item xsi:type="xsd:string">row1col0</item>
-<item xsi:type="xsd:string">row1col1</item>
-<item xsi:type="xsd:string">row1col2</item></input2DStringArray></ns4:echo2DStringArray>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>';
-
-$_SERVER['REQUEST_METHOD'] = "POST";
-$_SERVER['CONTENT_TYPE'] = 'multipart/related; type=text/xml; boundary="=_d624611fe466a88d956a205651c74fdb"';
-
-$test = '--=_d624611fe466a88d956a205651c74fdb
-Content-Type: text/xml; charset="UTF-8"
-Content-Transfer-Encoding: base64
-
-PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCg0KPFNPQVAtRU5WOkVudmVs
-b3BlICB4bWxuczpTT0FQLUVOVj0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbnZl
-bG9wZS8iDQogIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiDQog
-IHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiDQog
-IHhtbG5zOlNPQVAtRU5DPSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy9zb2FwL2VuY29kaW5n
-LyINCiAgU09BUC1FTlY6ZW5jb2RpbmdTdHlsZT0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcv
-c29hcC9lbmNvZGluZy8iPg0KPFNPQVAtRU5WOkJvZHk+DQoNCjxlY2hvTWltZUF0dGFjaG1lbnQ+
-DQo8dGVzdCBocmVmPSJjaWQ6ZTZiOTg0M2JiYzUxY2JiMDAzOTk0MGVmN2VlNzY2MDMiLz48L2Vj
-aG9NaW1lQXR0YWNobWVudD4NCjwvU09BUC1FTlY6Qm9keT4NCjwvU09BUC1FTlY6RW52ZWxvcGU+
-DQo=
---=_d624611fe466a88d956a205651c74fdb
-Content-Disposition: attachment.php
-Content-Type: text/plain
-Content-Transfer-Encoding: base64
-Content-ID: <e6b9843bbc51cbb0039940ef7ee76603>
-
-PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
-QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
-Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
-Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
-dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
-DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
-cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
-X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
-KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
-Ow0KcHJpbnRfcigkcmVzcCk7DQpwcmludCAkY2xpZW50LT53aXJlOw0KPz4=
---=_d624611fe466a88d956a205651c74fdb--';
-
-$_SERVER['CONTENT_TYPE'] = 'multipart/related; type=text/xml; boundary="=_a2cbb051424cc43e72d3c8c8d0b8f70e"';
-$test='--=_a2cbb051424cc43e72d3c8c8d0b8f70e
-Content-Type: text/xml; charset="UTF-8"
-
-<?xml version="1.0" encoding="UTF-8"?>
-
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-<SOAP-ENV:Body>
-
-<echoMimeAttachment>
-<test href="cid:a223fea3c35b5f0e6dedf8da75efd6b3"/></echoMimeAttachment>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-
---=_a2cbb051424cc43e72d3c8c8d0b8f70e
-Content-Disposition: attachment.php
-Content-Type: text/plain
-Content-Transfer-Encoding: base64
-Content-ID: <a223fea3c35b5f0e6dedf8da75efd6b3>
-
-PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
-QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
-Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
-Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
-dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
-DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
-cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
-X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
-KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
-Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
---=_a2cbb051424cc43e72d3c8c8d0b8f70e--
-';
-$server->service($test, '',TRUE);
-print $server->response;
-?> \ No newline at end of file
diff --git a/ext/soap/interop/test.utility.php b/ext/soap/interop/test.utility.php
deleted file mode 100644
index 9af61c22fb..0000000000
--- a/ext/soap/interop/test.utility.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-require_once("SOAP/Parser.php");
-require_once("SOAP/Value.php");
-
-function number_compare($f1, $f2)
-{
- # figure out which has the least fractional digits
- preg_match('/.*?\.(.*)/',$f1,$m1);
- preg_match('/.*?\.(.*)/',$f2,$m2);
- #print_r($m1);
- # always use at least 2 digits of precision
- $d = max(min(strlen(count($m1)?$m1[1]:'0'),strlen(count($m2)?$m2[1]:'0')),2);
- $f1 = round($f1, $d);
- $f2 = round($f2, $d);
- return bccomp($f1, $f2, $d) == 0;
-}
-
-function boolean_compare($f1, $f2)
-{
- if (($f1 == 'true' || $f1 === TRUE || $f1 != 0) &&
- ($f2 == 'true' || $f2 === TRUE || $f2 != 0)) return TRUE;
- if (($f1 == 'false' || $f1 === FALSE || $f1 == 0) &&
- ($f2 == 'false' || $f2 === FALSE || $f2 == 0)) return TRUE;
- return FALSE;
-}
-
-function string_compare($e1, $e2)
-{
- if (is_numeric($e1) && is_numeric($e2)) {
- return number_compare($e1, $e2);
- }
- # handle dateTime comparison
- $e1_type = gettype($e1);
- $e2_type = gettype($e2);
- $ok = FALSE;
- if ($e1_type == "string") {
- $dt = new SOAP_Type_dateTime();
- $ok = $dt->compare($e1, $e2) == 0;
- }
- return $ok || $e1 == $e2 || strcasecmp(trim($e1), trim($e2)) == 0;
-}
-
-function array_compare(&$ar1, &$ar2)
-{
- if (gettype($ar1) != 'array' || gettype($ar2) != 'array') return FALSE;
- # first a shallow diff
- if (count($ar1) != count($ar2)) return FALSE;
- $diff = array_diff($ar1, $ar2);
- if (count($diff) == 0) return TRUE;
-
- # diff failed, do a full check of the array
- foreach ($ar1 as $k => $v) {
- #print "comparing $v == $ar2[$k]\n";
- if (gettype($v) == "array") {
- if (!array_compare($v, $ar2[$k])) return FALSE;
- } else {
- if (!string_compare($v, $ar2[$k])) return FALSE;
- }
- }
- return TRUE;
-}
-
-
-function parseMessage($msg)
-{
- # strip line endings
- #$msg = preg_replace('/\r|\n/', ' ', $msg);
- $response = new SOAP_Parser($msg);
- if ($response->fault) {
- return $response->fault->getFault();
- }
- $return = $response->getResponse();
- $v = $response->decode($return);
- if (gettype($v) == 'array' && count($v)==1) {
- return array_shift($v);
- }
- return $v;
-}
-
-
-?> \ No newline at end of file
diff --git a/ext/soap/interop/testclient.php b/ext/soap/interop/testclient.php
deleted file mode 100644
index b70c628ee5..0000000000
--- a/ext/soap/interop/testclient.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<html><body>
-<?
-error_reporting(2039);
-include("SOAP/Client.php");
-
-$txt = "Bjoern";
-
-$soapc = new SOAP_Client("http://localhost/soap_interop/testserver.php");
-$soapc->debug_flag = TRUE;
-print_r($soapc->call("testMethod",array("txt" => $txt)));
-print "<br>Debug: ";
-print $soapc->wire;
-print "<br><br>";
-unset($soapc);
-
-?>
-</html></body> \ No newline at end of file
diff --git a/ext/soap/interop/testserver.php b/ext/soap/interop/testserver.php
deleted file mode 100644
index 03973c8863..0000000000
--- a/ext/soap/interop/testserver.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-include "SOAP/Server.php";
-
-function testMethod($arg) {
- if ($arg != "") {
- return crypt($arg);
- } else {
- return "Please supply a text";
- }
-}
-
-$server = new soap_server();
-
-$server->addToMap("testMethod",array("string"),array("string"));
-$server->service($HTTP_RAW_POST_DATA);
-echo "<!-- this is a test -->";
-?> \ No newline at end of file
diff --git a/ext/soap/package.xml b/ext/soap/package.xml
deleted file mode 100644
index 965670fcc8..0000000000
--- a/ext/soap/package.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!-- do not use the "Type" attribute here, that one is only for
- generated package.xml files -->
-<package>
- <name>ext_soap</name>
- <summary>Provides SOAP Services</summary>
- <description>
- Description of package....
- </description>
- <status>beta</status>
- <maintainers>
- <maintainer>
- <user>rodif_bl</user>
- <name>Brad Lafountain</name>
- <email>rodif_bl@yahoo.com</email>
- <role>lead</role>
- </maintainer>
- <maintainer>
- <user>shane</user>
- <name>Shane Caraveo</name>
- <email>shane@caraveo.com</email>
- <role>lead</role>
- </maintainer>
- </maintainers>
- <license>PHP</license>
- <release>
- <version>0.1</version>
- <date>2002-07-07</date>
- <state>alpha</state>
- <notes>
- - First offical PEAR/PECL release
- </notes>
- </release>
- <filelist>
- <dir name="/">
- <file role="doc">EXPERIMENTAL</file>
- <file role="doc">TODO</file>
- <file role="src">config.m4</file>
- <file role="src">Makefile.in</file>
- <file role="src">php_encoding.c</file>
- <file role="src">php_encoding.h</file>
- <file role="src">php_http.c</file>
- <file role="src">php_http.h</file>
- <file role="src">php_packet_soap.c</file>
- <file role="src">php_packet_soap.h</file>
- <file role="src">php_schema.c</file>
- <file role="src">php_schema.h</file>
- <file role="src">php_sdl.c</file>
- <file role="src">php_sdl.h</file>
- <file role="src">php_soap.h</file>
- <file role="src">php_soap.h</file>
- <file role="src">php_xml.c</file>
- <file role="src">php_xml.h</file>
- <file role="src">soap.c</file>
- <file role="src">php_soap.dsp</file>
- </dir>
- </filelist>
-</package>
-
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
deleted file mode 100644
index 3b4909f3d6..0000000000
--- a/ext/soap/php_encoding.c
+++ /dev/null
@@ -1,1135 +0,0 @@
-#include <time.h>
-
-#include "php_soap.h"
-
-encode defaultEncoding[] = {
- {{UNKNOWN_TYPE, NULL, NULL, NULL}, guess_zval_convert, guess_xml_convert},
-
- {{IS_NULL, "null", "null", NULL}, to_zval_null, to_xml_null},
- {{IS_STRING, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
- {{IS_LONG, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{IS_DOUBLE, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
- {{IS_BOOL, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
- {{IS_CONSTANT, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
- {{IS_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_ENC_NAMESPACE, NULL}, to_zval_array, guess_array_map},
- {{IS_CONSTANT_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_ENC_NAMESPACE, NULL}, to_zval_array, to_xml_array},
- {{IS_OBJECT, SOAP_ENC_OBJECT_STRING, SOAP_ENC_NAMESPACE, NULL}, to_zval_object, to_xml_object},
-
- {{XSD_STRING, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
- {{XSD_BOOLEAN, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
- {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
- {{XSD_FLOAT, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
- {{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
- {{XSD_DATETIME, XSD_DATETIME_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_datetime},
- {{XSD_TIME, XSD_TIME_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_time},
- {{XSD_DATE, XSD_DATE_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_date},
- {{XSD_GYEARMONTH, XSD_GYEARMONTH_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gyearmonth},
- {{XSD_GYEAR, XSD_GYEAR_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gyear},
- {{XSD_GMONTHDAY, XSD_GMONTHDAY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gmonthday},
- {{XSD_GDAY, XSD_GDAY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gday},
- {{XSD_GMONTH, XSD_GMONTH_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gmonth},
- {{XSD_HEXBINARY, XSD_HEXBINARY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_stringl},
- {{XSD_BASE64BINARY, XSD_BASE64BINARY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_stringl},
-
- {{XSD_LONG, XSD_LONG_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_INT, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_string},
- {{XSD_SHORT, XSD_SHORT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_string},
-
- {{APACHE_MAP, APACHE_MAP_STRING, APACHE_NAMESPACE, NULL}, to_zval_map, to_xml_map},
-
- {{SOAP_ENC_OBJECT, SOAP_ENC_OBJECT_STRING, SOAP_ENC_NAMESPACE, NULL}, to_zval_object, to_xml_object},
- {{SOAP_ENC_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_ENC_NAMESPACE, NULL}, to_zval_array, to_xml_array},
-
- /* support some of the 1999 data types */
- {{XSD_STRING, XSD_STRING_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_string, to_xml_string},
- {{XSD_BOOLEAN, XSD_BOOLEAN_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
- {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_string},
- {{XSD_FLOAT, XSD_FLOAT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_string},
- {{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_string},
- {{XSD_LONG, XSD_LONG_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_INT, XSD_INT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_string},
- {{XSD_SHORT, XSD_SHORT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_string},
- {{XSD_1999_TIMEINSTANT, XSD_1999_TIMEINSTANT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_string, to_xml_string},
-
- {{END_KNOWN_TYPES, NULL, NULL, NULL}, guess_zval_convert, guess_xml_convert}
-
-/* TODO: finish off encoding */
-/*
-#define XSD_DURATION 107
-#define XSD_DURATION_STRING "duration"
-#define XSD_ANYURI 118
-#define XSD_ANYURI_STRING "anyURI"
-#define XSD_QNAME 119
-#define XSD_QNAME_STRING "QName"
-#define XSD_NOTATION 120
-#define XSD_NOTATION_STRING "NOTATION"
-*/
-
-/*
-#define XSD_NORMALIZEDSTRING 121
-#define XSD_NORMALIZEDSTRING_STRING "normalizedString"
-#define XSD_TOKEN 122
-#define XSD_TOKEN_STRING "token"
-#define XSD_LANGUAGE 123
-#define XSD_LANGUAGE_STRING "language"
-#define XSD_NMTOKEN 124
-#define XSD_NMTOKEN_STRING "NMTOKEN"
-#define XSD_NAME 124
-#define XSD_NAME_STRING "Name"
-#define XSD_NCNAME 125
-#define XSD_NCNAME_STRING "NCName"
-#define XSD_ID 126
-#define XSD_ID_STRING "ID"
-#define XSD_IDREF 127
-#define XSD_IDREF_STRING "IDREF"
-#define XSD_IDREFS 127
-#define XSD_IDREFS_STRING "IDREFS"
-#define XSD_ENTITY 128
-#define XSD_ENTITY_STRING "ENTITY"
-#define XSD_ENTITYS 129
-#define XSD_ENTITYS_STRING "ENTITYS"
-#define XSD_INTEGER 130
-#define XSD_INTEGER_STRING "integer"
-#define XSD_NONPOSITIVEINTEGER 131
-#define XSD_NONPOSITIVEINTEGER_STRING "nonPositiveInteger"
-#define XSD_NEGATIVEINTEGER 132
-#define XSD_NEGATIVEINTEGER_STRING "negativeInteger"
-#define XSD_NONNEGATIVEINTEGER 137
-#define XSD_NONNEGATIVEINTEGER_STRING "nonNegativeInteger"
-#define XSD_UNSIGNEDLONG 138
-#define XSD_UNSIGNEDLONG_STRING "unsignedLong"
-#define XSD_UNSIGNEDINT 139
-#define XSD_UNSIGNEDINT_STRING "unsignedInt"
-#define XSD_UNSIGNEDSHORT 140
-#define XSD_UNSIGNEDSHORT_STRING "unsignedShort"
-#define XSD_UNSIGNEDBYTE 141
-#define XSD_UNSIGNEDBYTE_STRING "unsignedByte"
-#define XSD_POSITIVEINTEGER 142
-#define XSD_POSITIVEINTEGER_STRING "positiveInteger"
-*/
-};
-
-xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style)
-{
- xmlNodePtr node;
-
- if(encode->to_xml_before)
- data = encode->to_xml_before(encode->details, data);
- if(encode->to_xml)
- node = encode->to_xml(encode->details, data, style);
- if(encode->to_xml_after)
- node = encode->to_xml_after(encode->details, node, style);
-
- return node;
-}
-
-zval *master_to_zval(encodePtr encode, xmlNodePtr data)
-{
- zval *ret;
-
- data = check_and_resolve_href(data);
- if(encode->to_zval_before)
- data = encode->to_zval_before(encode->details, data, 0);
- if(encode->to_zval)
- ret = encode->to_zval(encode->details, data);
- if(encode->to_zval_after)
- ret = encode->to_zval_after(encode->details, ret);
-
- return ret;
-}
-
-#ifdef HAVE_PHP_DOMXML
-zval *to_xml_before_user(encodeType type, zval *data)
-{
- TSRMLS_FETCH();
-
- if(type.map->map_functions.to_xml_before)
- {
- if(call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml_before, data, 1, &data TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Error calling to_xml_before");
- }
- return data;
-}
-
-xmlNodePtr to_xml_user(encodeType type, zval *data, int style)
-{
- zval *ret, **addr;
- xmlNodePtr node;
- TSRMLS_FETCH();
-
- if(type.map->map_functions.to_xml)
- {
- MAKE_STD_ZVAL(ret);
- if(call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml, ret, 1, &data TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Error calling to_xml");
-
- if(Z_TYPE_P(ret) != IS_OBJECT)
- php_error(E_ERROR, "Error serializing object from to_xml_user");
-
- if(zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS)
- {
- node = (xmlNodePtr)Z_LVAL_PP(addr);
- node = xmlCopyNode(node, 1);
- set_ns_and_type(node, type);
- }
- zval_ptr_dtor(&ret);
- }
- return node;
-}
-
-xmlNodePtr to_xml_after_user(encodeType type, xmlNodePtr node, int style)
-{
- zval *ret, *param, **addr;
- int found;
- TSRMLS_FETCH();
-
- if(type.map->map_functions.to_xml_after)
- {
- MAKE_STD_ZVAL(ret);
- MAKE_STD_ZVAL(param);
- param = php_domobject_new(node, &found, NULL TSRMLS_CC);
-
- if(call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml_after, ret, 1, &param TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Error calling to_xml_after");
- if(zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS)
- {
- node = (xmlNodePtr)Z_LVAL_PP(addr);
- set_ns_and_type(node, type);
- }
- zval_ptr_dtor(&ret);
- zval_ptr_dtor(&param);
- }
- return node;
-}
-
-xmlNodePtr to_zval_before_user(encodeType type, xmlNodePtr node, int style)
-{
- zval *ret, *param, **addr;
- int found;
- TSRMLS_FETCH();
-
- if(type.map->map_functions.to_zval_before)
- {
- MAKE_STD_ZVAL(ret);
- MAKE_STD_ZVAL(param);
- param = php_domobject_new(node, &found, NULL TSRMLS_CC);
-
- if(call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval_before, ret, 1, &param TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Error calling to_zval_before");
- if(zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS)
- {
- node = (xmlNodePtr)Z_LVAL_PP(addr);
- set_ns_and_type(node, type);
- }
- zval_ptr_dtor(&ret);
- zval_ptr_dtor(&param);
- }
- return node;
-}
-
-zval *to_zval_user(encodeType type, xmlNodePtr node)
-{
- zval *ret, *param;
- int found;
- TSRMLS_FETCH();
-
- if(type.map->map_functions.to_zval)
- {
- MAKE_STD_ZVAL(ret);
- MAKE_STD_ZVAL(param);
- param = php_domobject_new(node, &found, NULL TSRMLS_CC);
-
- if(call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval, ret, 1, &param TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Error calling to_zval");
- zval_ptr_dtor(&param);
- efree(param);
- }
- return ret;
-}
-
-zval *to_zval_after_user(encodeType type, zval *data)
-{
- TSRMLS_FETCH();
-
- if(type.map->map_functions.to_zval_after)
- {
- if(call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval_after, data, 1, &data TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Error calling to_xml_before");
- }
- return data;
-}
-#endif
-
-/* TODO: get rid of "bogus".. ither by passing in the already created xmlnode or passing in the node name */
-/* String encode/decode */
-zval *to_zval_string(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- if(data && data->children)
- ZVAL_STRING(ret, data->children->content, 1);
- return ret;
-}
-
-zval *to_zval_stringl(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- if(data && data->children)
- ZVAL_STRINGL(ret, data->children->content, xmlStrlen(data->children->content), 1);
- return ret;
-}
-
-xmlNodePtr to_xml_string(encodeType type, zval *data, int style)
-{
- xmlNodePtr ret;
- char *str, *pstr;
- int new_len;
- TSRMLS_FETCH();
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret);
-
- convert_to_string(data);
- str = php_escape_html_entities(Z_STRVAL_P(data), Z_STRLEN_P(data), &new_len, 0, 0, NULL TSRMLS_CC);
-
- pstr = malloc(new_len + 1);
- memcpy(pstr, str, new_len);
- pstr[new_len] = '\0';
- efree(str);
-
- xmlNodeSetContentLen(ret, pstr, new_len);
-
- if(style == SOAP_ENCODED)
- set_ns_and_type(ret, type);
- return ret;
-}
-
-xmlNodePtr to_xml_stringl(encodeType type, zval *data, int style)
-{
- xmlNodePtr ret;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret);
-
- convert_to_string(data);
- xmlNodeSetContentLen(ret, estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data)), Z_STRLEN_P(data));
-
- if(style == SOAP_ENCODED)
- set_ns_and_type(ret, type);
- return ret;
-}
-
-zval *to_zval_double(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- ZVAL_DOUBLE(ret, atof(data->children->content));
- return ret;
-}
-
-zval *to_zval_long(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- ZVAL_LONG(ret, atol(data->children->content));
- return ret;
-}
-
-xmlNodePtr to_xml_long(encodeType type, zval *data, int style)
-{
- xmlNodePtr ret;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret);
-
- convert_to_long(data);
- convert_to_string(data);
- xmlNodeSetContentLen(ret, Z_STRVAL_P(data), Z_STRLEN_P(data));
-
- if(style == SOAP_ENCODED)
- set_ns_and_type(ret, type);
- return ret;
-}
-
-zval *to_zval_bool(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- if(stricmp(data->children->content,"true") == 0 ||
- stricmp(data->children->content,"t") == 0 ||
- strcmp(data->children->content,"1") == 0)
- {
- ZVAL_BOOL(ret, 1);
- }
- else
- {
- ZVAL_BOOL(ret, 0);
- }
- return ret;
-}
-
-xmlNodePtr to_xml_bool(encodeType type, zval *data, int style)
-{
- xmlNodePtr ret;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret);
-
- convert_to_boolean(data);
- if(data->value.lval == 1)
- xmlNodeSetContent(ret, "1");
- else
- xmlNodeSetContent(ret, "0");
-
- if(style == SOAP_ENCODED)
- set_ns_and_type(ret, type);
- return ret;
-}
-
-/* Null encode/decode */
-zval *to_zval_null(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- ZVAL_NULL(ret);
- return ret;
-}
-
-xmlNodePtr to_xml_null(encodeType type, zval *data, int style)
-{
- xmlNodePtr ret;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret);
-
- if(style == SOAP_ENCODED)
- xmlSetProp(ret, "xsi:null", "1");
- return ret;
-}
-
-/* Struct encode/decode */
-zval *to_zval_object(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- xmlNodePtr trav;
- encodePtr enc;
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- object_init(ret);
- trav = data->children;
-
- enc = get_conversion(UNKNOWN_TYPE);
- do
- {
- if(trav->type == XML_ELEMENT_NODE)
- {
- zval *tmpVal;
-
- tmpVal = master_to_zval(enc, trav);
- add_property_zval(ret, (char *)trav->name, tmpVal);
- }
- }
- while(trav = trav->next);
-
- return ret;
-}
-
-xmlNodePtr to_xml_object(encodeType type, zval *data, int style)
-{
- xmlNodePtr xmlParam;
- HashTable *prop;
- int i;
- TSRMLS_FETCH();
-
- /* Special handling of class SoapVar */
- if(data && Z_TYPE_P(data) == IS_OBJECT && !strcmp(Z_OBJCE_P(data)->name, soap_var_class_entry.name))
- {
- zval **ztype, **zdata, **zns, **zstype, **zname, **znamens;
- encodePtr enc;
-
- if(zend_hash_find(Z_OBJPROP_P(data), "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE)
- php_error(E_ERROR, "error encoding SoapVar");
- if(zend_hash_find(Z_OBJPROP_P(data), "enc_value", sizeof("enc_value"), (void **)&zdata) == FAILURE)
- php_error(E_ERROR, "error encoding SoapVar");
-
- enc = get_conversion(Z_LVAL_P(*ztype));
- xmlParam = master_to_xml(enc, *zdata, style);
-
- if(zend_hash_find(Z_OBJPROP_P(data), "enc_stype", sizeof("enc_stype"), (void **)&zstype) == SUCCESS)
- {
- if(zend_hash_find(Z_OBJPROP_P(data), "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS)
- set_ns_and_type_ex(xmlParam, Z_STRVAL_PP(zns), Z_STRVAL_PP(zstype));
- else
- set_ns_and_type_ex(xmlParam, NULL, Z_STRVAL_PP(zstype));
- }
-
- if(zend_hash_find(Z_OBJPROP_P(data), "enc_name", sizeof("enc_name"), (void **)&zname) == SUCCESS)
- xmlNodeSetName(xmlParam, Z_STRVAL_PP(zname));
- if(zend_hash_find(Z_OBJPROP_P(data), "enc_namens", sizeof("enc_namens"), (void **)&znamens) == SUCCESS)
- {
- smart_str *ns;
- xmlNsPtr nsp;
-
- ns = encode_new_ns();
- nsp = xmlNewNs(xmlParam, Z_STRVAL_PP(znamens), ns->c);
- xmlSetNs(xmlParam, nsp);
- smart_str_free(ns);
- efree(ns);
- }
- }
- else
- {
- xmlParam = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, xmlParam);
-
- if(Z_TYPE_P(data) == IS_OBJECT)
- {
- prop = Z_OBJPROP_P(data);
- i = zend_hash_num_elements(prop);
- zend_hash_internal_pointer_reset(prop);
-
- for(;i > 0;i--)
- {
- xmlNodePtr property;
- encodePtr enc;
- zval **zprop;
- char *str_key;
-
- zend_hash_get_current_key(prop, &str_key, NULL, FALSE);
- zend_hash_get_current_data(prop, (void **)&zprop);
-
- enc = get_conversion((*zprop)->type);
- property = master_to_xml(enc, (*zprop), style);
-
- xmlNodeSetName(property, str_key);
- xmlAddChild(xmlParam, property);
- zend_hash_move_forward(prop);
- }
- }
-
- if(style == SOAP_ENCODED)
- set_ns_and_type(xmlParam, type);
- }
- return xmlParam;
-}
-
-/* Array encode/decode */
-xmlNodePtr guess_array_map(encodeType type, zval *data, int style)
-{
- encodePtr enc = NULL;
- TSRMLS_FETCH();
-
- if(data && Z_TYPE_P(data) == IS_ARRAY)
- {
- if(zend_hash_num_elements(Z_ARRVAL_P(data)) > 0)
- {
- if(is_map(data))
- enc = get_conversion(APACHE_MAP);
- else
- enc = get_conversion(SOAP_ENC_ARRAY);
- }
- }
- if(!enc)
- enc = get_conversion(IS_NULL);
-
- return master_to_xml(enc, data, style);
-}
-
-xmlNodePtr to_xml_array(encodeType type, zval *data, int style)
-{
- smart_str array_type_and_size = {0}, array_type = {0};
- int i;
- xmlNodePtr xmlParam;
- TSRMLS_FETCH();
-
- xmlParam = xmlNewNode(NULL,"BOGUS");
-
- FIND_ZVAL_NULL(data, xmlParam);
-
- if(Z_TYPE_P(data) == IS_ARRAY)
- {
- i = zend_hash_num_elements(Z_ARRVAL_P(data));
-
- if(style == SOAP_ENCODED)
- {
- get_array_type(data, &array_type TSRMLS_CC);
- smart_str_append(&array_type_and_size, &array_type);
- smart_str_appendc(&array_type_and_size, '[');
- smart_str_append_long(&array_type_and_size, i);
- smart_str_appendc(&array_type_and_size, ']');
- smart_str_0(&array_type_and_size);
-
- xmlSetProp(xmlParam, "SOAP-ENC:arrayType", array_type_and_size.c);
-
- smart_str_free(&array_type_and_size);
- smart_str_free(&array_type);
- }
-
- zend_hash_internal_pointer_reset(data->value.ht);
- for(;i > 0;i--)
- {
- xmlNodePtr xparam;
- zval **zdata;
- encodePtr enc;
- zend_hash_get_current_data(data->value.ht, (void **)&zdata);
-
- enc = get_conversion((*zdata)->type);
- xparam = master_to_xml(enc, (*zdata), style);
-
- if(style == SOAP_LITERAL)
- xmlNodeSetName(xparam, enc->details.type_str);
- else
- xmlNodeSetName(xparam, "val");
-
- xmlAddChild(xmlParam, xparam);
- zend_hash_move_forward(data->value.ht);
- }
- }
- if(style == SOAP_ENCODED)
- set_ns_and_type(xmlParam, type);
- return xmlParam;
-}
-
-zval *to_zval_array(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- xmlNodePtr trav;
- encodePtr enc;
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- array_init(ret);
- trav = data->children;
-
- enc = get_conversion(UNKNOWN_TYPE);
- while(trav)
- {
- if(trav->type == XML_ELEMENT_NODE)
- {
- zval *tmpVal;
- tmpVal = master_to_zval(enc, trav);
- zend_hash_next_index_insert(Z_ARRVAL_P(ret), &tmpVal, sizeof(zval *), NULL);
- }
- trav = trav->next;
- }
-
- return ret;
-}
-
-/* Map encode/decode */
-xmlNodePtr to_xml_map(encodeType type, zval *data, int style)
-{
- xmlNodePtr xmlParam;
- int i;
- TSRMLS_FETCH();
-
- xmlParam = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, xmlParam);
-
- if(Z_TYPE_P(data) == IS_ARRAY)
- {
- i = zend_hash_num_elements(Z_ARRVAL_P(data));
- /* TODO: Register namespace...??? */
- xmlSetProp(xmlParam, "xmlns:apache", "http://xml.apache.org/xml-soap");
- zend_hash_internal_pointer_reset(data->value.ht);
- for(;i > 0;i--)
- {
- xmlNodePtr xparam, item;
- xmlNodePtr key;
- zval **temp_data;
- char *key_val;
- int int_val;
- encodePtr enc;
-
- zend_hash_get_current_data(data->value.ht, (void **)&temp_data);
- if(Z_TYPE_PP(temp_data) != IS_NULL)
- {
- item = xmlNewNode(NULL, "item");
- key = xmlNewNode(NULL, "key");
- if(zend_hash_get_current_key(data->value.ht, &key_val, (long *)&int_val, FALSE) == HASH_KEY_IS_STRING)
- {
- if(style == SOAP_ENCODED)
- xmlSetProp(key, "xsi:type", "xsd:string");
- xmlNodeSetContent(key, key_val);
- }
- else
- {
- smart_str tmp = {0};
- smart_str_append_long(&tmp, int_val);
- smart_str_0(&tmp);
-
- if(style == SOAP_ENCODED)
- xmlSetProp(key, "xsi:type", "xsd:int");
- xmlNodeSetContentLen(key, tmp.c, tmp.len);
-
- smart_str_free(&tmp);
- }
-
-
- enc = get_conversion((*temp_data)->type);
- xparam = master_to_xml(enc, (*temp_data), style);
-
- xmlNodeSetName(xparam, "value");
- xmlAddChild(item, key);
- xmlAddChild(item, xparam);
- xmlAddChild(xmlParam, item);
- }
- zend_hash_move_forward(data->value.ht);
- }
- }
- if(style == SOAP_ENCODED)
- set_ns_and_type(xmlParam, type);
-
- return xmlParam;
-}
-
-zval *to_zval_map(encodeType type, xmlNodePtr data)
-{
- zval *ret, *key, *value;
- xmlNodePtr trav, item, xmlKey, xmlValue;
- encodePtr enc;
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- array_init(ret);
- trav = data->children;
-
- enc = get_conversion(UNKNOWN_TYPE);
- trav = data->children;
- FOREACHNODE(trav, "item", item)
- {
- xmlKey = get_node(item->children, "key");
- if(!xmlKey)
- php_error(E_ERROR, "Error encoding apache map, missing key");
-
- xmlValue = get_node(item->children, "value");
- if(!xmlKey)
- php_error(E_ERROR, "Error encoding apache map, missing value");
-
- key = master_to_zval(enc, xmlKey);
- value = master_to_zval(enc, xmlValue);
-
- if(Z_TYPE_P(key) == IS_STRING)
- zend_hash_update(Z_ARRVAL_P(ret), Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL);
- else if(Z_TYPE_P(key) == IS_LONG)
- zend_hash_index_update(Z_ARRVAL_P(ret), Z_LVAL_P(key), &value, sizeof(zval *), NULL);
- else
- php_error(E_ERROR, "Error encoding apache map, only Strings or Longs are allowd as keys");
- }
- ENDFOREACH(trav);
-
- return ret;
-}
-
-/* Unknown encode/decode */
-xmlNodePtr guess_xml_convert(encodeType type, zval *data, int style)
-{
- encodePtr enc;
- TSRMLS_FETCH();
-
- if(data)
- enc = get_conversion(data->type);
- else
- enc = get_conversion(IS_NULL);
- return master_to_xml(enc, data, style);
-}
-
-zval *guess_zval_convert(encodeType type, xmlNodePtr data)
-{
- encodePtr enc = NULL;
- xmlAttrPtr tmpattr;
- TSRMLS_FETCH();
-
- data = check_and_resolve_href(data);
-
- if(data == NULL || data->children == NULL)
- enc = get_conversion(IS_NULL);
- else
- {
- tmpattr = get_attribute(data->properties,"type");
- if(tmpattr != NULL)
- {
- enc = get_conversion_from_type(data, tmpattr->children->content);
- /*
- if(enc == NULL)
- php_error(E_ERROR, "Error (Don't know how to encode/decode \"%s\")", tmpattr->children->content);
- */
- }
-
- if(enc == NULL)
- {
- /* Didn't have a type, totally guess here */
- /* Logic: has children = IS_OBJECT else IS_STRING */
- xmlNodePtr trav;
-
- if(get_attribute(data->properties, "arrayType"))
- enc = get_conversion(SOAP_ENC_ARRAY);
- else
- {
- enc = get_conversion(XSD_STRING);
- trav = data->children;
- do
- {
- if(trav->type == XML_ELEMENT_NODE)
- {
- enc = get_conversion(SOAP_ENC_OBJECT);
- break;
- }
- }
- while(trav = trav->next);
- }
- }
- }
- return master_to_zval(enc, data);
-}
-
-/* Time encode/decode */
-xmlNodePtr to_xml_datetime_ex(encodeType type, zval *data, char *format, int style)
-{
- /* logic hacked from ext/standard/datetime.c */
- struct tm *ta, tmbuf;
- time_t timestamp;
- int max_reallocs = 5;
- size_t buf_len=64, real_len;
- char *buf;
- xmlNodePtr xmlParam;
-
- xmlParam = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, xmlParam);
-
- timestamp = Z_LVAL_P(data);
-
- time(&timestamp);
- ta = php_localtime_r(&timestamp, &tmbuf);
-
- buf = (char *) emalloc(buf_len);
- while ((real_len = strftime(buf, buf_len, format, ta)) == buf_len || real_len == 0)
- {
- buf_len *= 2;
- buf = (char *) erealloc(buf, buf_len);
- if(!--max_reallocs) break;
- }
-
- xmlNodeSetContent(xmlParam, buf);
- efree(buf);
-
- if(style == SOAP_ENCODED)
- set_ns_and_type(xmlParam, type);
- return xmlParam;
-}
-
-xmlNodePtr to_xml_datetime(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%Y-%m-%dT%H:%M:%S", style);
-}
-
-xmlNodePtr to_xml_time(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%H:%M:%S", style);
-}
-
-xmlNodePtr to_xml_date(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%Y-%m-%d", style);
-}
-
-xmlNodePtr to_xml_gyearmonth(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%Y-%m", style);
-}
-
-xmlNodePtr to_xml_gyear(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%Y", style);
-}
-
-xmlNodePtr to_xml_gmonthday(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "--%m-%d", style);
-}
-
-xmlNodePtr to_xml_gday(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%d", style);
-}
-
-xmlNodePtr to_xml_gmonth(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%m", style);
-}
-
-void set_ns_and_type(xmlNodePtr node, encodeType type)
-{
- set_ns_and_type_ex(node, type.ns, type.type_str);
-}
-
-void set_ns_and_type_ex(xmlNodePtr node, char *ns, char *type)
-{
- if(ns != NULL)
- {
- char *sprefix;
- smart_str *prefix;
- smart_str xmlns = {0}, nstype = {0};
-
- TSRMLS_FETCH();
-
- if(zend_hash_find(SOAP_GLOBAL(defEncNs), ns, strlen(ns) + 1, (void **)&sprefix) == FAILURE)
- {
- prefix = encode_new_ns();
- smart_str_appendl(&xmlns, "xmlns:", 6);
- smart_str_append(&xmlns, prefix);
- smart_str_0(&xmlns);
-
- xmlSetProp(node, xmlns.c, ns);
- }
- else
- {
- prefix = emalloc(sizeof(smart_str));
- memset(prefix, 0, sizeof(smart_str));
- smart_str_appends(prefix, sprefix);
- }
-
- smart_str_append(&nstype, prefix);
- smart_str_appendc(&nstype, ':');
- smart_str_appends(&nstype, type);
- smart_str_0(&nstype);
- xmlSetProp(node, "xsi:type", nstype.c);
- smart_str_free(&nstype);
- smart_str_free(&xmlns);
- smart_str_free(prefix);
- efree(prefix);
- }
- else
- xmlSetProp(node, "xsi:type", type);
-}
-
-smart_str *encode_new_ns()
-{
- int num;
- smart_str *ns = emalloc(sizeof(smart_str));
-
- TSRMLS_FETCH();
-
- memset(ns, 0, sizeof(smart_str));
- num = ++SOAP_GLOBAL(cur_uniq_ns);
- smart_str_appendl(ns, "ns", 2);
- smart_str_append_long(ns, num);
- smart_str_0(ns);
- return ns;
-}
-
-void encode_reset_ns()
-{
- TSRMLS_FETCH();
- SOAP_GLOBAL(cur_uniq_ns) = 0;
-}
-
-encodePtr get_conversion_ex(HashTable *encoding, int encode)
-{
- encodePtr *enc;
- TSRMLS_FETCH();
-
- if(zend_hash_index_find(encoding, encode, (void **)&enc) == FAILURE)
- php_error(E_ERROR, "Cannot find encoding");
-
- if(SOAP_GLOBAL(overrides))
- {
- smart_str nscat = {0};
-
- smart_str_appendl(&nscat, (*enc)->details.ns, strlen((*enc)->details.ns));
- smart_str_appendc(&nscat, ':');
- smart_str_appendl(&nscat, (*enc)->details.type_str, strlen((*enc)->details.type_str));
- smart_str_0(&nscat);
-
- zend_hash_find(SOAP_GLOBAL(overrides), nscat.c, nscat.len + 1, (void **)&enc);
- smart_str_free(&nscat);
- }
-
- return *enc;
-}
-
-encodePtr get_conversion_from_href_type_ex(HashTable *encoding, char *type, int len)
-{
- encodePtr *enc = NULL;
-
- if(encoding == NULL)
- return NULL;
-
- if(zend_hash_find(encoding, type, len + 1, (void **)&enc) == FAILURE)
- return NULL;
-
- return (*enc);
-}
-
-encodePtr get_conversion_from_type_ex(HashTable *encoding, xmlNodePtr node, char *type)
-{
- encodePtr *enc = NULL;
- xmlNsPtr nsptr;
- char *ns, *cptype;
- smart_str nscat = {0};
-
- if(encoding == NULL)
- return NULL;
-
- parse_namespace(type, &cptype, &ns);
- nsptr = xmlSearchNs(node->doc, node, ns);
- if(nsptr != NULL)
- {
- smart_str_appends(&nscat, nsptr->href);
- smart_str_appendc(&nscat, ':');
- smart_str_appends(&nscat, cptype);
- smart_str_0(&nscat);
-
- if(zend_hash_find(encoding, nscat.c, nscat.len + 1, (void **)&enc) == FAILURE)
- {
- if(zend_hash_find(encoding, type, strlen(type) + 1, (void **)&enc) == FAILURE)
- enc = NULL;
- }
- smart_str_free(&nscat);
- }
- else
- {
- if(zend_hash_find(encoding, type, strlen(type) + 1, (void **)&enc) == FAILURE)
- enc = NULL;
- }
-
- if(cptype) efree(cptype);
- if(ns) efree(ns);
- if(enc == NULL)
- return NULL;
- else
- return (*enc);
-}
-
-int is_map(zval *array)
-{
- int i, count = zend_hash_num_elements(Z_ARRVAL_P(array));
- for(i = 0;i < count;i++)
- {
- if(zend_hash_get_current_key_type(Z_ARRVAL_P(array)) == HASH_KEY_IS_STRING)
- return TRUE;
- zend_hash_move_forward(Z_ARRVAL_P(array));
- }
- return FALSE;
-}
-
-void get_array_type(zval *array, smart_str *type TSRMLS_DC)
-{
- HashTable *ht = HASH_OF(array);
- int i, count, cur_type, prev_type, different;
- char *name = NULL;
- zval **tmp;
-/* TSRMLS_FETCH();*/
-
- if(!array || Z_TYPE_P(array) != IS_ARRAY)
- smart_str_appendl(type, "xsd:ur-type", 11);
-
- different = FALSE;
- cur_type = prev_type = 0;
- count = zend_hash_num_elements(ht);
-
- zend_hash_internal_pointer_reset(ht);
- for(i = 0;i < count;i++)
- {
- zend_hash_get_current_data(ht, (void **)&tmp);
-
- if(Z_TYPE_PP(tmp) == IS_OBJECT && !strcmp(Z_OBJCE_PP(tmp)->name, soap_var_class_entry.name))
- {
- zval **ztype;
-
- if(zend_hash_find(Z_OBJPROP_PP(tmp), "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE)
- php_error(E_ERROR, "error encoding SoapVar");
- cur_type = Z_LVAL_P(*ztype);
- }
- else if(Z_TYPE_PP(tmp) == IS_ARRAY && is_map(*tmp))
- cur_type = APACHE_MAP;
- else
- cur_type = Z_TYPE_PP(tmp);
-
- if(i > 0)
- {
- if(cur_type != prev_type)
- {
- different = TRUE;
- break;
- }
- }
-
- prev_type = cur_type;
- zend_hash_move_forward(ht);
- }
-
- if(different)
- smart_str_appendl(type, "xsd:ur-type", 11);
- else
- {
- encodePtr enc;
- char *prefix;
-
- enc = get_conversion(cur_type);
-
- if(enc->details.ns != NULL)
- {
- if(zend_hash_find(SOAP_GLOBAL(defEncNs), enc->details.ns, strlen(enc->details.ns) + 1, (void **)&prefix) == FAILURE)
- php_error(E_ERROR, "fix me");
-
- smart_str_appendl(type, prefix, strlen(prefix));
- smart_str_appendc(type, ':');
- smart_str_appendl(type, enc->details.type_str, strlen(enc->details.type_str));
- smart_str_0(type);
- }
- else
- smart_str_appendl(type, enc->details.type_str, strlen(enc->details.type_str));
- }
-}
-
-
-smart_str *build_soap_action(zval *this_ptr, char *soapaction)
-{
- zval **uri;
- smart_str *tmp;
-
- tmp = emalloc(sizeof(smart_str));
- memset(tmp, 0, sizeof(smart_str));
-
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "uri", sizeof("uri"), (void *)&uri) == FAILURE)
- php_error(E_ERROR, "Error finding uri");
-
- smart_str_appendl(tmp, Z_STRVAL_PP(uri), Z_STRLEN_PP(uri));
- smart_str_appends(tmp, "#");
- smart_str_appendl(tmp, soapaction, strlen(soapaction));
- smart_str_0(tmp);
-
- return tmp;
-}
-
-void delete_encoder(void *encode)
-{
- encodePtr t = *((encodePtr*)encode);
- if(t->details.ns)
- free(t->details.ns);
- if(t->details.type_str)
- free(t->details.type_str);
- if(t->details.map)
- delete_mapping(t->details.map);
- free(t);
-}
-
diff --git a/ext/soap/php_encoding.h b/ext/soap/php_encoding.h
deleted file mode 100644
index 4a9bfc72a5..0000000000
--- a/ext/soap/php_encoding.h
+++ /dev/null
@@ -1,256 +0,0 @@
-#ifndef PHP_ENCODING_H
-#define PHP_ENCODING_H
-
-#define XSD_1999_NAMESPACE "http://www.w3.org/1999/XMLSchema"
-#define XSD_1999_TIMEINSTANT 401
-#define XSD_1999_TIMEINSTANT_STRING "timeInstant"
-
-#define XSD_NAMESPACE "http://www.w3.org/2001/XMLSchema"
-#define XSD_NS_PREFIX "xsd"
-#define XSD_STRING 101
-#define XSD_STRING_STRING "string"
-#define XSD_BOOLEAN 103
-#define XSD_BOOLEAN_STRING "boolean"
-#define XSD_DECIMAL 104
-#define XSD_DECIMAL_STRING "decimal"
-#define XSD_FLOAT 105
-#define XSD_FLOAT_STRING "float"
-#define XSD_DOUBLE 106
-#define XSD_DOUBLE_STRING "double"
-#define XSD_DURATION 107
-#define XSD_DURATION_STRING "duration"
-#define XSD_DATETIME 108
-#define XSD_DATETIME_STRING "dateTime"
-#define XSD_TIME 109
-#define XSD_TIME_STRING "time"
-#define XSD_DATE 110
-#define XSD_DATE_STRING "date"
-#define XSD_GYEARMONTH 111
-#define XSD_GYEARMONTH_STRING "gYearMonth"
-#define XSD_GYEAR 112
-#define XSD_GYEAR_STRING "gYear"
-#define XSD_GMONTHDAY 113
-#define XSD_GMONTHDAY_STRING "gMonthDay"
-#define XSD_GDAY 114
-#define XSD_GDAY_STRING "gDay"
-#define XSD_GMONTH 115
-#define XSD_GMONTH_STRING "gMonth"
-#define XSD_HEXBINARY 116
-#define XSD_HEXBINARY_STRING "hexBinary"
-#define XSD_BASE64BINARY 117
-#define XSD_BASE64BINARY_STRING "base64Binary"
-#define XSD_ANYURI 118
-#define XSD_ANYURI_STRING "anyURI"
-#define XSD_QNAME 119
-#define XSD_QNAME_STRING "QName"
-#define XSD_NOTATION 120
-#define XSD_NOTATION_STRING "NOTATION"
-#define XSD_NORMALIZEDSTRING 121
-#define XSD_NORMALIZEDSTRING_STRING "normalizedString"
-#define XSD_TOKEN 122
-#define XSD_TOKEN_STRING "token"
-#define XSD_LANGUAGE 123
-#define XSD_LANGUAGE_STRING "language"
-#define XSD_NMTOKEN 124
-#define XSD_NMTOKEN_STRING "NMTOKEN"
-#define XSD_NAME 124
-#define XSD_NAME_STRING "Name"
-#define XSD_NCNAME 125
-#define XSD_NCNAME_STRING "NCName"
-#define XSD_ID 126
-#define XSD_ID_STRING "ID"
-#define XSD_IDREF 127
-#define XSD_IDREF_STRING "IDREF"
-#define XSD_IDREFS 127
-#define XSD_IDREFS_STRING "IDREFS"
-#define XSD_ENTITY 128
-#define XSD_ENTITY_STRING "ENTITY"
-#define XSD_ENTITYS 129
-#define XSD_ENTITYS_STRING "ENTITYS"
-#define XSD_INTEGER 130
-#define XSD_INTEGER_STRING "integer"
-#define XSD_NONPOSITIVEINTEGER 131
-#define XSD_NONPOSITIVEINTEGER_STRING "nonPositiveInteger"
-#define XSD_NEGATIVEINTEGER 132
-#define XSD_NEGATIVEINTEGER_STRING "negativeInteger"
-#define XSD_LONG 133
-#define XSD_LONG_STRING "long"
-#define XSD_INT 134
-#define XSD_INT_STRING "int"
-#define XSD_SHORT 135
-#define XSD_SHORT_STRING "short"
-#define XSD_BYTE 136
-#define XSD_BYTE_STRING "byte"
-#define XSD_NONNEGATIVEINTEGER 137
-#define XSD_NONNEGATIVEINTEGER_STRING "nonNegativeInteger"
-#define XSD_UNSIGNEDLONG 138
-#define XSD_UNSIGNEDLONG_STRING "unsignedLong"
-#define XSD_UNSIGNEDINT 139
-#define XSD_UNSIGNEDINT_STRING "unsignedInt"
-#define XSD_UNSIGNEDSHORT 140
-#define XSD_UNSIGNEDSHORT_STRING "unsignedShort"
-#define XSD_UNSIGNEDBYTE 141
-#define XSD_UNSIGNEDBYTE_STRING "unsignedByte"
-#define XSD_POSITIVEINTEGER 142
-#define XSD_POSITIVEINTEGER_STRING "positiveInteger"
-
-#define APACHE_NAMESPACE "http://xml.apache.org/xml-soap"
-#define APACHE_NS_PREFIX "apache"
-#define APACHE_MAP 200
-#define APACHE_MAP_STRING "Map"
-
-#define SOAP_ENC_NAMESPACE "http://schemas.xmlsoap.org/soap/encoding/"
-#define SOAP_ENC_NS_PREFIX "SOAP-ENC"
-#define SOAP_ENC_ARRAY 300
-#define SOAP_ENC_ARRAY_STRING "Array"
-#define SOAP_ENC_OBJECT 301
-#define SOAP_ENC_OBJECT_STRING "Struct"
-
-#define SCHEMA_NAMESPACE "http://www.w3.org/2001/XMLSchema"
-#define SCHEMA_NS_PREFIX "s"
-
-#define WSDL_NAMESPACE "http://schemas.xmlsoap.org/wsdl/"
-#define WSDL_NS_PREFIX "wsdl"
-
-#define WSDL_SOAP_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap/"
-#define WSDL_SOAP_NS_PREFIX "wsdlSoap"
-
-#define WSDL_HTTP_NAMESPACE "http://schemas.xmlsoap.org/wsdl/http/"
-#define WSDL_HTTP_NS_PREFIX "http"
-
-#define WSDL_HTTP_TRANSPORT "http://schemas.xmlsoap.org/soap/http"
-
-#define UNKNOWN_TYPE 999998
-#define END_KNOWN_TYPES 999999
-
-struct _encodeType
-{
- int type;
- char *type_str;
- char *ns;
- sdlTypePtr sdl_type;
- soapMappingPtr map;
-};
-
-struct _encode
-{
- encodeType details;
- zval *(*to_zval)(encodeType type, xmlNodePtr data);
- xmlNodePtr (*to_xml)(encodeType type, zval *data, int style);
-
- xmlNodePtr (*to_zval_before)(encodeType type, xmlNodePtr data, int style);
- zval *(*to_zval_after)(encodeType type, zval *data);
-
- zval *(*to_xml_before)(encodeType type, zval *data);
- xmlNodePtr (*to_xml_after)(encodeType type, xmlNodePtr data, int style);
-};
-
-smart_str *build_soap_action(zval *this_ptr, char *soapaction);
-
-/* Master functions all encode/decode should be called thur these functions */
-xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style);
-zval *master_to_zval(encodePtr encode, xmlNodePtr data);
-
-#ifdef HAVE_PHP_DOMXML
-/* user defined mapping */
-zval *to_xml_before_user(encodeType type, zval *data);
-xmlNodePtr to_xml_user(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_after_user(encodeType type, xmlNodePtr node, int style);
-xmlNodePtr to_zval_before_user(encodeType type, xmlNodePtr node, int style);
-zval *to_zval_user(encodeType type, xmlNodePtr node);
-zval *to_zval_after_user(encodeType type, zval *data);
-#endif
-
-/* zval type decode */
-zval *to_zval_double(encodeType type, xmlNodePtr data);
-zval *to_zval_long(encodeType type, xmlNodePtr data);
-zval *to_zval_bool(encodeType type, xmlNodePtr data);
-zval *to_zval_object(encodeType type, xmlNodePtr data);
-zval *to_zval_string(encodeType type, xmlNodePtr data);
-zval *to_zval_array(encodeType type, xmlNodePtr data);
-zval *to_zval_map(encodeType type, xmlNodePtr data);
-zval *to_zval_null(encodeType type, xmlNodePtr data);
-zval *guess_zval_convert(encodeType type, xmlNodePtr data);
-
-xmlNodePtr to_xml_long(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_bool(encodeType type, zval *data, int style);
-
-/* String encode */
-xmlNodePtr to_xml_string(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_stringl(encodeType type, zval *data, int style);
-
-/* Null encode */
-xmlNodePtr to_xml_null(encodeType type, zval *data, int style);
-
-/* Struct encode */
-xmlNodePtr to_xml_object(encodeType type, zval *data, int style);
-
-/* Array encode */
-xmlNodePtr guess_array_map(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_array(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_map(encodeType type, zval *data, int style);
-
-/* Try and guess for non-wsdl clients and servers */
-xmlNodePtr guess_xml_convert(encodeType type, zval *data, int style);
-
-/* Datetime encode/decode */
-xmlNodePtr to_xml_datetime_ex(encodeType type, zval *data, char *format, int style);
-xmlNodePtr to_xml_datetime(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_time(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_date(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_gyearmonth(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_gyear(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_gmonthday(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_gday(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_gmonth(encodeType type, zval *data, int style);
-
-#define get_conversion(e) get_conversion_ex(SOAP_GLOBAL(defEncIndex), e)
-#define get_conversion_from_type(n, t) get_conversion_from_type_ex(SOAP_GLOBAL(defEnc), n, t)
-#define get_conversion_from_href_type(t) get_conversion_from_href_type_ex(SOAP_GLOBAL(defEnc), t, strlen(t))
-
-void encode_reset_ns();
-smart_str *encode_new_ns();
-
-void set_ns_and_type(xmlNodePtr node, encodeType type);
-void set_ns_and_type_ex(xmlNodePtr node, char *ns, char *type);
-encodePtr get_conversion_ex(HashTable *encoding, int encode);
-encodePtr get_conversion_from_type_ex(HashTable *encoding, xmlNodePtr node, char *type);
-encodePtr get_conversion_from_href_type_ex(HashTable *encoding, char *type, int len);
-
-int is_map(zval *array);
-void get_array_type(zval *array, smart_str *out_type TSRMLS_DC);
-
-void delete_encoder(void *handle);
-
-extern encode defaultEncoding[];
-
-#define FIND_XML_NULL(xml,zval) \
- { \
- xmlAttrPtr null; \
- if(!xml || !xml->children) \
- { \
- ZVAL_NULL(zval); \
- return zval; \
- } \
- if(xml->properties) \
- { \
- null = get_attribute(xml->properties, "null"); \
- if(null) \
- { \
- ZVAL_NULL(zval); \
- return zval; \
- } \
- } \
- }
-
-#define FIND_ZVAL_NULL(zval, xml) \
-{ \
- if(!zval) \
- { \
- xmlSetProp(xml, "xsi:null", "1"); \
- return xml; \
- } \
-}
-
-
-#endif
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
deleted file mode 100644
index 5f68e94e84..0000000000
--- a/ext/soap/php_http.c
+++ /dev/null
@@ -1,456 +0,0 @@
-#include "php_soap.h"
-
-void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, char *soapaction TSRMLS_DC)
-{
- xmlChar *buf;
- char *soap_headers;
- int buf_size,err,ret;
- sdlPtr sdl;
- php_url *phpurl = NULL;
- php_stream *stream;
- zval **trace;
-
- FETCH_THIS_SOCKET(stream);
- FETCH_THIS_URL(phpurl);
- FETCH_THIS_SDL(sdl);
-
- xmlDocDumpMemory(doc, &buf, &buf_size);
-
- if(!buf)
- php_error(E_ERROR, "Error build soap request");
-
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS
- && Z_LVAL_PP(trace) > 0)
- add_property_stringl(this_ptr, "__last_request", buf, buf_size, 1);
-
- if(!stream)
- {
- char *url;
- int use_ssl;
-
- if(!sdl)
- {
- zval **location;
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "location", sizeof("location"),(void **) &location) == FAILURE)
- php_error(E_ERROR, "Error could not find location");
- url = Z_STRVAL_PP(location);
- }
- else
- {
- sdlBindingPtr binding;
- FETCH_THIS_PORT(binding);
- url = binding->location;
- }
-
- phpurl = php_url_parse(url);
- if (phpurl == NULL) {
- php_error(E_ERROR, "Unable to parse URL \"%s\"", url);
- }
-
- use_ssl = strcmp(phpurl->scheme, "https") == 0;
-#if !HAVE_OPENSSL_EXT
- if (use_ssl) {
- php_error(E_ERROR, "SSL support not available in this build");
- }
-#endif
-
- if (phpurl->port == 0) {
- phpurl->port = use_ssl ? 443 : 80;
- }
-
- stream = php_stream_sock_open_host(phpurl->host, (unsigned short)phpurl->port, SOCK_STREAM, NULL, NULL);
-
- if(stream)
- {
-
-#if HAVE_OPENSSL_EXT
- /* fire up SSL, if requested */
- if (use_ssl) {
- if (FAILURE == php_stream_sock_ssl_activate(stream, 1)) {
- php_error(E_ERROR, "SSL Connection attempt failed");
- }
- }
-#endif
-
- add_property_resource(this_ptr, "httpsocket", php_stream_get_resource_id(stream));
-
- ret = zend_list_insert(phpurl, le_url);
- add_property_resource(this_ptr, "httpurl", ret);
- zend_list_addref(ret);
- } else {
- php_error(E_ERROR, "Could not connect to host");
- }
- }
-
- if (stream) {
- zval **cookies;
- char *header = "POST %s HTTP/1.1\r\nConnection: close\r\nAccept: text/html; text/xml; text/plain\r\nUser-Agent: PHP SOAP 0.1\r\nHost: %s\r\nContent-Type: text/xml\r\nContent-Length: %d\r\nSOAPAction: \"%s\"\r\n";
- int size = strlen(header) + strlen(phpurl->host) + strlen(phpurl->path) + 10;
-
- /* TODO: Add authentication */
- if(sdl != NULL)
- {
- /* TODO: need to grab soap action from wsdl....*/
- soap_headers = emalloc(size + strlen(soapaction));
- sprintf(soap_headers, header, phpurl->path, phpurl->host, buf_size, soapaction);
- }
- else
- {
- soap_headers = emalloc(size + strlen(soapaction));
- sprintf(soap_headers, header, phpurl->path, phpurl->host, buf_size, soapaction);
- }
-
- err = php_stream_write(stream, soap_headers, strlen(soap_headers));
-
- if(err != (int)strlen(soap_headers))
- php_error(E_ERROR,"Failed Sending HTTP Headers");
-
- /* Send cookies along with request */
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS)
- {
- smart_str cookie_str = {0};
- zval **data;
- char *key;
- int index, i;
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(cookies));
- for(i = 0;i < (int)Z_ARRVAL_PP(cookies)->nNumOfElements;i++)
- {
- zend_hash_get_current_data(Z_ARRVAL_PP(cookies), (void **)&data);
- zend_hash_get_current_key(Z_ARRVAL_PP(cookies), &key, (long *)&index, FALSE);
-
- smart_str_appendl(&cookie_str, "Cookie: ", 8);
- smart_str_appendl(&cookie_str, key, strlen(key));
- smart_str_appendc(&cookie_str, '=');
- smart_str_appendl(&cookie_str, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- smart_str_appendc(&cookie_str, ';');
- zend_hash_move_forward(Z_ARRVAL_PP(cookies));
- }
- smart_str_appendl(&cookie_str, "\r\n", 2);
- smart_str_0(&cookie_str);
-
- err = php_stream_write(stream, cookie_str.c, cookie_str.len);
-
- if(err != (int)cookie_str.len)
- php_error(E_ERROR,"Failed Sending HTTP Headers");
-
- smart_str_free(&cookie_str);
- }
-
- err = php_stream_write(stream, "\r\n", 2);
-
- if(err != 2)
- php_error(E_ERROR,"Failed Sending HTTP Headers");
-
-
- err = php_stream_write(stream, buf, buf_size);
-
- if(err != (int)strlen(buf))
- php_error(E_ERROR,"Failed Sending HTTP Content");
-
- efree(soap_headers);
- }
- xmlFree(buf);
-}
-
-void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS_DC)
-{
- char *http_headers, *http_body, *content_type, *http_version, http_status[4], *cookie_itt;
- int http_header_size, http_body_size, http_close;
- sdlPtr sdl;
- zval **socket_ref;
- php_stream *stream;
- zval **trace;
-
- FETCH_THIS_SDL(sdl);
-
- if(FIND_SOCKET_PROPERTY(this_ptr, socket_ref) != FAILURE)
- {
- FETCH_SOCKET_RES(stream, socket_ref);
- }
-
- if(!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC))
- php_error(E_ERROR, "Error Fetching http headers");
-
- /* Check to see what HTTP status was sent */
- http_version = get_http_header_value(http_headers,"HTTP/");
- if(http_version)
- {
- char *tmp;
-
- tmp = strstr(http_version," ");
-
- if(tmp != NULL)
- {
- tmp++;
- strncpy(http_status,tmp,4);
- http_status[3] = '\0';
- }
-
- /*
- Try and process any respsone that is xml might contain fault code
-
- Maybe try and test for some of the 300's 400's specfics but not
- right now.
-
- if(strcmp(http_status,"200"))
- {
- zval *err;
- char *http_err;
-
- MAKE_STD_ZVAL(err);
- ZVAL_STRING(err, http_body, 1);
- http_err = emalloc(strlen("HTTP request failed ()") + 4);
- sprintf(http_err, "HTTP request failed (%s)", http_status);
- add_soap_fault(thisObj, "SOAP-ENV:Client", http_err, NULL, err TSRMLS_CC);
- efree(http_err);
- return;
- }*/
-
- /* Try and get headers again */
- if(!strcmp(http_status, "100"))
- {
- if(!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC))
- php_error(E_ERROR, "Error Fetching http headers");
- }
-
- efree(http_version);
- }
-
- if(!get_http_body(stream, http_headers, &http_body, &http_body_size TSRMLS_CC))
- php_error(E_ERROR, "Error Fetching http body");
-
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS
- && Z_LVAL_PP(trace) > 0)
- add_property_stringl(this_ptr, "__last_response", http_body, http_body_size, 1);
-
- /* Close every time right now till i can spend more time on it
- it works.. it's just slower??
- */
- /* See if the server requested a close */
- http_close = TRUE;
- /*
- connection = get_http_header_value(http_headers,"Connection: ");
- if(connection)
- {
- if(!strcmp(connection, "Keep-Alive"))
- http_close = FALSE;
- efree(connection);
- }
- else
- {
- if(!strncmp(http_version,"1.1", 3))
- http_close = FALSE;
- }
- */
-
- if (http_close) {
- php_stream_close(stream);
- zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
- }
-
- /* Check and see if the server even sent a xml document */
- content_type = get_http_header_value(http_headers,"Content-Type: ");
- if(content_type)
- {
- char *pos = NULL;
- int cmplen;
- pos = strstr(content_type,";");
- if(pos != NULL)
- cmplen = pos - content_type;
- else
- cmplen = strlen(content_type);
-
- if(strncmp(content_type, "text/xml", cmplen))
- {
- if(strncmp(http_body, "<?xml", 5))
- {
- zval *err;
- MAKE_STD_ZVAL(err);
- ZVAL_STRINGL(err, http_body, http_body_size, 1);
- add_soap_fault(this_ptr, "SOAP-ENV:Client", "Didn't recieve an xml document", NULL, err TSRMLS_CC);
- efree(content_type);
- return;
- }
- }
- efree(content_type);
- }
-
- /* Grab and send back every cookie */
-
- /* Not going to worry about Path: because
- we shouldn't be changing urls so path dont
- matter too much
- */
- cookie_itt = strstr(http_headers,"Set-Cookie: ");
- while(cookie_itt)
- {
- char *end_pos, *cookie;
- char *eqpos, *sempos;
- smart_str name = {0}, value = {0};
- zval **cookies, *z_cookie;
-
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == FAILURE)
- {
- zval *tmp_cookies;
- MAKE_STD_ZVAL(tmp_cookies);
- array_init(tmp_cookies);
- zend_hash_update(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), &tmp_cookies, sizeof(zval *), (void **)&cookies);
- }
-
- end_pos = strstr(cookie_itt,"\r\n");
- cookie = get_http_header_value(cookie_itt,"Set-Cookie: ");
-
- eqpos = strstr(cookie, "=");
- sempos = strstr(cookie, ";");
-
- smart_str_appendl(&name, cookie, eqpos - cookie);
- smart_str_0(&name);
-
- smart_str_appendl(&value, eqpos + 1, sempos - (eqpos + 1));
- smart_str_0(&value);
-
- MAKE_STD_ZVAL(z_cookie);
- ZVAL_STRINGL(z_cookie, value.c, value.len, 1);
-
- zend_hash_update(Z_ARRVAL_PP(cookies), name.c, name.len + 1, &z_cookie, sizeof(zval *), NULL);
-
- cookie_itt = strstr(cookie_itt + sizeof("Set-Cookie: "), "Set-Cookie: ");
-
- smart_str_free(&value);
- smart_str_free(&name);
- efree(cookie);
- cookie_itt = FALSE;
- }
-
- *buffer = http_body;
- *buffer_len = http_body_size;
- efree(http_headers);
-}
-
-char *get_http_header_value(char *headers, char *type)
-{
- char *pos, *tmp = NULL;
- int typelen, headerslen;
-
- typelen = strlen(type);
- headerslen = strlen(headers);
-
- /* header `titles' can be lower case, or any case combination, according
- * to the various RFC's. */
- pos = headers;
- do {
- /* start of buffer or start of line */
- if (strncasecmp(pos, type, typelen) == 0) {
- char *eol;
-
- /* match */
- tmp = pos + typelen;
- eol = strstr(tmp, "\r\n");
- if (eol == NULL) {
- eol = headers + headerslen;
- }
- return estrndup(tmp, eol - tmp);
- }
-
- /* find next line */
- pos = strstr(pos, "\r\n");
- if (pos)
- pos += 2;
-
- } while (pos);
-
- return NULL;
-}
-
-int get_http_body(php_stream *stream, char *headers, char **response, int *out_size TSRMLS_DC)
-{
- char *trans_enc, *content_length, *http_buf = NULL;
- int http_buf_size = 0;
-
- trans_enc = get_http_header_value(headers, "Transfer-Encoding: ");
- content_length = get_http_header_value(headers, "Content-Length: ");
-
- if (trans_enc && !strcmp(trans_enc, "chunked")) {
- int cur = 0, size = 0, buf_size = 0, len_size;
- char done, chunk_size[10];
-
- done = FALSE;
- http_buf = NULL;
-
- while (!done) {
- php_stream_gets(stream, chunk_size, sizeof(chunk_size));
-
- if (sscanf(chunk_size, "%x", &buf_size) != -1) {
- http_buf = erealloc(http_buf, http_buf_size + buf_size + 1);
- len_size = 0;
-
- while (http_buf_size < buf_size) {
- len_size += php_stream_read(stream, http_buf + http_buf_size, buf_size - len_size);
- http_buf_size += len_size;
- }
-
- /* Eat up '\r' '\n' */
- php_stream_getc(stream);php_stream_getc(stream);
- }
- if (buf_size == 0) {
- done = TRUE;
- }
- }
- efree(trans_enc);
-
- if (http_buf == NULL) {
- http_buf = estrndup("", 1);
- http_buf_size = 1;
- } else {
- http_buf[http_buf_size] = '\0';
- }
-
- } else if (content_length) {
- int size;
- size = atoi(content_length);
- http_buf = emalloc(size + 1);
-
- while(http_buf_size < size) {
- http_buf_size += php_stream_read(stream, http_buf + http_buf_size, size - http_buf_size);
- }
- http_buf[size] = '\0';
- efree(content_length);
- } else {
- php_error(E_ERROR, "Don't know how to read http body, No Content-Length or chunked data");
- }
-
- (*response) = http_buf;
- (*out_size) = http_buf_size;
- return TRUE;
-}
-
-int get_http_headers(php_stream *stream, char **response, int *out_size TSRMLS_DC)
-{
- int done = FALSE;
- char chr;
- smart_str tmp_response = {0};
- char headerbuf[8192];
-
- while(!done)
- {
- if (!php_stream_gets(stream, headerbuf, sizeof(headerbuf))) {
- break;
- }
-
- if (strcmp(headerbuf, "\r\n") == 0) {
- /* empty line marks end of headers */
- done = TRUE;
- break;
- }
-
- /* add header to collection */
- smart_str_appends(&tmp_response, headerbuf);
- }
- smart_str_0(&tmp_response);
- (*response) = tmp_response.c;
- (*out_size) = tmp_response.len;
- return done;
-}
-
-
diff --git a/ext/soap/php_http.h b/ext/soap/php_http.h
deleted file mode 100644
index 2aa3f75ae1..0000000000
--- a/ext/soap/php_http.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef PHP_HTTP_H
-#define PHP_HTTP_H
-
-void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, char *soapaction TSRMLS_DC);
-void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS_DC);
-
-char *get_http_header_value(char *headers, char *type);
-int get_http_body(php_stream *socketd, char *headers, char **response, int *out_size TSRMLS_DC);
-int get_http_headers(php_stream *socketd,char **response, int *out_size TSRMLS_DC);
-
-#endif
diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c
deleted file mode 100644
index 5411c31ee9..0000000000
--- a/ext/soap/php_packet_soap.c
+++ /dev/null
@@ -1,141 +0,0 @@
-#include "php_soap.h"
-
-int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval ***ret, int *num_params TSRMLS_DC)
-{
- xmlDocPtr response;
- xmlNodePtr trav, trav2, env, body, resp, cur, fault;
- zval **tmp_ret;
-
- response = xmlParseMemory(buffer, buffer_size);
- xmlCleanupParser();
-
- if (!response) {
- php_error(E_ERROR, "looks like we got no XML document");
- }
-
- (*num_params) = 0;
-
- trav = response->children;
- FOREACHNODE(trav,"Envelope",env)
- {
- trav2 = env->children;
- FOREACHNODE(trav2,"Body",body)
- {
- fault = get_node(body->children,"Fault");
- if(fault != NULL)
- {
- char *faultcode = NULL, *faultstring = NULL, *faultactor = NULL;
- zval *details = NULL;
- xmlNodePtr tmp;
-
- tmp = get_node(fault->children,"faultcode");
- if(tmp != NULL && tmp->children != NULL)
- faultcode = tmp->children->content;
-
- tmp = get_node(fault->children,"faultstring");
- if(tmp != NULL && tmp->children != NULL)
- faultstring = tmp->children->content;
-
- tmp = get_node(fault->children,"faultactor");
- if(tmp != NULL && tmp->children != NULL)
- faultactor = tmp->children->content;
-
- tmp = get_node(fault->children,"detail");
- if(tmp != NULL)
- {
- encodePtr enc;
- enc = get_conversion(UNKNOWN_TYPE);
- details = enc->to_zval(enc->details, tmp);
- }
-
- add_soap_fault(this_ptr, faultcode, faultstring, faultactor, details TSRMLS_CC);
- }
- else
- {
- resp = body->children;
- if(fn != NULL)
- {
- sdlParamPtr *h_param, param = NULL;
- xmlNodePtr val = NULL;
- encodePtr enc;
- char *name, *ns = NULL;
-
- if(fn->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes;
-
- zend_hash_internal_pointer_reset(fn->responseParameters);
- if(zend_hash_get_current_data(fn->responseParameters, (void **)&h_param) != SUCCESS)
- php_error(E_ERROR, "Can't find response parameter \"%s\"", param->paramName);
-
- param = (*h_param);
- if(fnb->style == SOAP_DOCUMENT)
- {
- name = (*h_param)->encode->details.type_str;
- ns = (*h_param)->encode->details.ns;
- }
- else
- {
- name = fn->responseName;
- /* ns = ? */
- }
-
- cur = get_node_ex(resp, name, ns);
- /* TODO: produce warning invalid ns */
- if(!cur)
- cur = get_node(resp, name);
-
- if(!cur)
- php_error(E_ERROR, "Can't find response data");
-
-
- if(fnb->style == SOAP_DOCUMENT)
- val = cur;
- else
- val = get_node(cur->children, param->paramName);
-
- if(!val)
- php_error(E_ERROR, "Can't find response data");
-
- tmp_ret = emalloc(sizeof(zval **));
- if(param != NULL)
- enc = param->encode;
- else
- enc = get_conversion(UNKNOWN_TYPE);
-
- tmp_ret[0] = master_to_zval(enc, val);
- (*ret) = tmp_ret;
- (*num_params) = 1;
- }
- }
- else
- {
- cur = resp;
- while(cur && cur->type != XML_ELEMENT_NODE)
- cur = cur->next;
- if(cur != NULL)
- {
- xmlNodePtr val;
- val = cur->children;
- while(val && val->type != XML_ELEMENT_NODE)
- val = val->next;
-
- if(val != NULL)
- {
- encodePtr enc;
- enc = get_conversion(UNKNOWN_TYPE);
- tmp_ret = emalloc(sizeof(zval **));
- tmp_ret[0] = master_to_zval(enc, val);
- (*ret) = tmp_ret;
- (*num_params) = 1;
- }
- }
- }
- }
- }
- ENDFOREACH(trav2);
- }
- ENDFOREACH(trav);
- xmlFreeDoc(response);
- return TRUE;
-}
diff --git a/ext/soap/php_packet_soap.h b/ext/soap/php_packet_soap.h
deleted file mode 100644
index 3d0ec74673..0000000000
--- a/ext/soap/php_packet_soap.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef PHP_PACKET_SOAP_H
-#define PHP_PACKET_SOAP_H
-
-int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval ***ret, int *num_params TSRMLS_DC);
-
-#endif \ No newline at end of file
diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c
deleted file mode 100644
index da634941c1..0000000000
--- a/ext/soap/php_schema.c
+++ /dev/null
@@ -1,1080 +0,0 @@
-#include "php_soap.h"
-/*
-2.6.1 xsi:type
-2.6.2 xsi:nil
-2.6.3 xsi:schemaLocation, xsi:noNamespaceSchemaLocation
-*/
-
-/*
-<schema
- attributeFormDefault = (qualified | unqualified) : unqualified
- blockDefault = (#all | List of (extension | restriction | substitution)) : ''
- elementFormDefault = (qualified | unqualified) : unqualified
- finalDefault = (#all | List of (extension | restriction)) : ''
- id = ID
- targetNamespace = anyURI
- version = token
- xml:lang = language
- {any attributes with non-schema namespace . . .}>
- Content: ((include | import | redefine | annotation)*, (((simpleType | complexType | group | attributeGroup) | element | attribute | notation), annotation*)*)
-</schema>
-*/
-int load_schema(sdlPtr *sdl,xmlNodePtr schema)
-{
- xmlNodePtr trav, element, compType, simpleType, attribute;
- xmlAttrPtr tns;
-
- if(!(*sdl)->types)
- {
- (*sdl)->types = malloc(sizeof(HashTable));
- zend_hash_init((*sdl)->types, 0, NULL, delete_type, 1);
- }
-
- tns = get_attribute(schema->properties, "targetNamespace");
-
- trav = schema->children;
- FOREACHNODE(trav,"complexType",compType)
- {
- schema_complexType(sdl, tns, compType, NULL);
- }
- ENDFOREACH(trav);
-
- trav = schema->children;
- FOREACHNODE(trav,"simpleType",simpleType)
- {
- schema_simpleType(sdl, tns, simpleType, NULL);
- }
- ENDFOREACH(trav);
-
- trav = schema->children;
- FOREACHNODE(trav,"element",element)
- {
- schema_element(sdl, tns, element, NULL);
- }
- ENDFOREACH(trav);
-
- trav = schema->children;
- FOREACHNODE(trav, "attribute", attribute)
- {
- schema_attribute(sdl, tns, attribute, NULL);
- }
- ENDFOREACH(trav);
- return FALSE;
-}
-/*
-<simpleType
- final = (#all | (list | union | restriction))
- id = ID
- name = NCName
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (restriction | list | union))
-</simpleType>
-*/
-int schema_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpleType, sdlTypePtr cur_type)
-{
- xmlNodePtr content;
- xmlAttrPtr name, ns;
-
- ns = get_attribute(simpleType->properties, "targetNamespace");
- if(ns == NULL)
- ns = tsn;
-
- name = get_attribute(simpleType->properties, "name");
- if(name != NULL)
- {
- HashTable *ht;
- smart_str key = {0};
- sdlTypePtr newType, *ptr;
-
- newType = malloc(sizeof(sdlType));
- memset(newType, 0, sizeof(sdlType));
- newType->name = strdup(name->children->content);
- newType->namens = strdup(ns->children->content);
-
- if(cur_type == NULL)
- {
- ht = (*sdl)->types;
- smart_str_appends(&key, newType->namens);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, newType->name);
- smart_str_0(&key);
- }
- else
- {
- if(cur_type->elements == NULL)
- {
- cur_type->elements = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1);
- }
- ht = cur_type->elements;
- smart_str_appends(&key, cur_type->name);
- }
-
- zend_hash_add(ht, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), (void **)&ptr);
- cur_type = (*ptr);
- smart_str_free(&key);
- }
-
- content = get_node(simpleType->children, "restriction");
- if(content != NULL)
- {
- schema_restriction_simpleType(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(simpleType->children, "list");
- if(content != NULL)
- {
- schema_list(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(simpleType->children, "union");
- if(content != NULL)
- {
- schema_union(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*
-<list
- id = ID
- itemType = QName
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleType?))
-</list>
-*/
-int schema_list(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr listType, sdlTypePtr cur_type)
-{
- return TRUE;
-}
-
-/*
-<union
- id = ID
- memberTypes = List of QName
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleType*))
-</union>
-*/
-int schema_union(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr unionType, sdlTypePtr cur_type)
-{
- return TRUE;
-}
-
-/*
-<simpleContent
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (restriction | extension))
-</simpleContent>
-*/
-int schema_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpCompType, sdlTypePtr cur_type)
-{
- xmlNodePtr content;
-
- content = get_node(simpCompType->children, "restriction");
- if(content == NULL)
- {
- schema_restriction_simpleContent(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(simpCompType->children, "extension");
- if(content == NULL)
- {
- /* schema_extension(sdl, tsn, content, cur_type); */
- php_error(E_ERROR, "Error parsing schema (doesn't support extensions on simpleContent)");
- return TRUE;
- }
-
- php_error(E_ERROR, "Error parsing schema (simpleContent)");
- return FALSE;
-}
-
-/*
-<restriction
- base = QName
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*)?, ((attribute | attributeGroup)*, anyAttribute?))
-</restriction>
-*/
-int schema_restriction_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type)
-{
- xmlNodePtr content, trav;
- xmlAttrPtr base;
-
- content = get_node(restType->children, "simpleType");
- if(content != NULL)
- {
- schema_simpleType(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- base = get_attribute(restType->properties, "base");
- if(base != NULL)
- {
- /*
- cur_type->base = estrdup(base->children->content);
- */
- }
-
- if(cur_type->restrictions == NULL)
- {
- cur_type->restrictions = malloc(sizeof(sdlRestrictions));
- memset(cur_type->restrictions, 0, sizeof(sdlRestrictions));
- }
-
- trav = restType->children;
- do
- {
- if(trav->type == XML_ELEMENT_NODE)
- {
- if(!strcmp(trav->name, "minExclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->minExclusive);
- else if(!strcmp(trav->name, "minInclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->minInclusive);
- else if(!strcmp(trav->name, "maxExclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->maxExclusive);
- else if(!strcmp(trav->name, "maxInclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->maxInclusive);
- else if(!strcmp(trav->name, "totalDigits"))
- schema_restriction_var_int(trav, &cur_type->restrictions->totalDigits);
- else if(!strcmp(trav->name, "fractionDigits"))
- schema_restriction_var_int(trav, &cur_type->restrictions->fractionDigits);
- else if(!strcmp(trav->name, "length"))
- schema_restriction_var_int(trav, &cur_type->restrictions->length);
- else if(!strcmp(trav->name, "minLength"))
- schema_restriction_var_int(trav, &cur_type->restrictions->minLength);
- else if(!strcmp(trav->name, "maxLength"))
- schema_restriction_var_int(trav, &cur_type->restrictions->maxLength);
- else if(!strcmp(trav->name, "whiteSpace"))
- schema_restriction_var_char(trav, &cur_type->restrictions->whiteSpace);
- else if(!strcmp(trav->name, "pattern"))
- schema_restriction_var_char(trav, &cur_type->restrictions->pattern);
- else if(!strcmp(trav->name, "enumeration"))
- {
- sdlRestrictionCharPtr enumval = NULL;
-
- schema_restriction_var_char(trav, &enumval);
- if(cur_type->restrictions->enumeration == NULL)
- {
- cur_type->restrictions->enumeration = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->restrictions->enumeration, 0, NULL, delete_schema_restriction_var_char, 1);
- }
- zend_hash_next_index_insert(cur_type->restrictions->enumeration, &enumval, sizeof(sdlRestrictionCharPtr), NULL);
- }
- }
- }while(trav = trav->next);
-
- return TRUE;
-}
-
-/*
-<restriction
- base = QName
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))
-</restriction>
-*/
-int schema_restriction_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type)
-{
- xmlAttrPtr base;
- xmlNodePtr trav;
-
- base = get_attribute(restType->properties, "base");
- if(base != NULL)
- {
- char *type, *ns;
- xmlNsPtr nsptr;
-
- parse_namespace(base->children->content, &type, &ns);
- nsptr = xmlSearchNs(restType->doc, restType, ns);
- if(nsptr != NULL)
- {
- cur_type->encode = get_encoder((*sdl), (char *)nsptr->href, type);
- }
- if(type) efree(type);
- if(ns) efree(ns);
- }
-
- trav = restType->children;
- do
- {
- if(trav->type == XML_ELEMENT_NODE)
- {
- if(!strcmp(trav->name, "group"))
- {
- schema_group(sdl, tsn, trav, cur_type);
- return TRUE;
- }
- else if(!strcmp(trav->name, "all"))
- {
- schema_all(sdl, tsn, trav, cur_type);
- return TRUE;
- }
- else if(!strcmp(trav->name, "choice"))
- {
- schema_choice(sdl, tsn, trav, cur_type);
- return TRUE;
- }
- else if(!strcmp(trav->name, "sequence"))
- {
- schema_sequence(sdl, tsn, trav, cur_type);
- return TRUE;
- }
- else if(!strcmp(trav->name, "attribute"))
- {
- schema_attribute(sdl, tsn, trav, cur_type);
- }
- }
- }while(trav = trav->next);
-
- return TRUE;
-}
-
-/*
-<restriction
- base = QName
- id = ID
- {any attributes with non-schema Namespace . . .}>
- Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*))
-</restriction>
-*/
-int schema_restriction_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type)
-{
- xmlNodePtr content, trav;
- xmlAttrPtr base;
-
- base = get_attribute(restType->properties, "base");
- if(base != NULL)
- cur_type->encode = get_encoder_from_prefix((*sdl), restType, base->children->content);
-
- content = get_node(restType->children, "simpleType");
- if(content != NULL)
- {
- schema_simpleType(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- if(cur_type->restrictions == NULL)
- cur_type->restrictions = malloc(sizeof(sdlRestrictions));
-
- trav = restType->children;
- do
- {
- if(trav->type == XML_ELEMENT_NODE)
- {
- if(!strcmp(trav->name, "minExclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->minExclusive);
- else if(!strcmp(trav->name, "minInclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->minInclusive);
- else if(!strcmp(trav->name, "maxExclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->maxExclusive);
- else if(!strcmp(trav->name, "maxInclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->maxInclusive);
- else if(!strcmp(trav->name, "totalDigits"))
- schema_restriction_var_int(trav, &cur_type->restrictions->totalDigits);
- else if(!strcmp(trav->name, "fractionDigits"))
- schema_restriction_var_int(trav, &cur_type->restrictions->fractionDigits);
- else if(!strcmp(trav->name, "length"))
- schema_restriction_var_int(trav, &cur_type->restrictions->length);
- else if(!strcmp(trav->name, "minLength"))
- schema_restriction_var_int(trav, &cur_type->restrictions->minLength);
- else if(!strcmp(trav->name, "maxLength"))
- schema_restriction_var_int(trav, &cur_type->restrictions->maxLength);
- else if(!strcmp(trav->name, "whiteSpace"))
- schema_restriction_var_char(trav, &cur_type->restrictions->whiteSpace);
- else if(!strcmp(trav->name, "pattern"))
- schema_restriction_var_char(trav, &cur_type->restrictions->pattern);
- else if(!strcmp(trav->name, "enumeration"))
- {
- sdlRestrictionCharPtr enumval = NULL;
-
- schema_restriction_var_char(trav, &enumval);
- if(cur_type->restrictions->enumeration == NULL)
- {
- cur_type->restrictions->enumeration = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->restrictions->enumeration, 0, NULL, delete_schema_restriction_var_char, 1);
- }
- zend_hash_next_index_insert(cur_type->restrictions->enumeration, &enumval, sizeof(sdlRestrictionCharPtr), NULL);
- }
- }
- }while(trav = trav->next);
-
- return TRUE;
-}
-
-int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valptr)
-{
- xmlAttrPtr fixed, value, id;
-
- if((*valptr) == NULL)
- (*valptr) = malloc(sizeof(sdlRestrictionInt));
-
- fixed = get_attribute(val->properties, "fixed");
- (*valptr)->fixed = FALSE;
- if(fixed != NULL)
- {
- if(!strcmp(fixed->children->content, "true") ||
- !strcmp(fixed->children->content, "1"))
- (*valptr)->fixed = TRUE;
- }
-
- id = get_attribute(val->properties, "id");
- if(id != NULL)
- (*valptr)->id = strdup(id->children->content);
-
- value = get_attribute(val->properties, "value");
- if(value == NULL)
- php_error(E_ERROR, "Error parsing wsdl schema \"missing value for minExclusive\"");
-
- (*valptr)->value = atoi(value->children->content);
-
- return TRUE;
-}
-
-void delete_restriction_var_int(void *rvi)
-{
- sdlRestrictionIntPtr ptr = *((sdlRestrictionIntPtr*)rvi);
- if(ptr->id);
- free(ptr->id);
- free(ptr);
-}
-
-int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr)
-{
- xmlAttrPtr fixed, value, id;
-
- if((*valptr) == NULL)
- (*valptr) = malloc(sizeof(sdlRestrictionChar));
-
- fixed = get_attribute(val->properties, "fixed");
- (*valptr)->fixed = FALSE;
- if(fixed != NULL)
- {
- if(!strcmp(fixed->children->content, "true") ||
- !strcmp(fixed->children->content, "1"))
- (*valptr)->fixed = TRUE;
- }
-
- id = get_attribute(val->properties, "id");
- if(id != NULL)
- (*valptr)->id = strdup(id->children->content);
-
- value = get_attribute(val->properties, "value");
- if(value == NULL)
- php_error(E_ERROR, "Error parsing wsdl schema \"missing value restriction\"");
-
- (*valptr)->value = strdup(value->children->content);
- return TRUE;
-}
-
-void delete_schema_restriction_var_char(void *srvc)
-{
- sdlRestrictionCharPtr ptr = *((sdlRestrictionCharPtr*)srvc);
- if(ptr->id)
- free(ptr->id);
- if(ptr->value)
- free(ptr->value);
- free(ptr);
-}
-
-/*
-From simpleContent (not supported):
-<extension
- base = QName
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?))
-</extension>
-
-From complexContent:
-<extension
- base = QName
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))
-</extension>
-*/
-int schema_extension(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type)
-{
- xmlNodePtr content;
- xmlAttrPtr base;
-
- base = get_attribute(extType->properties, "base");
-
- content = get_node(extType->children, "group");
- if(content != NULL)
- {
- schema_group(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(extType->children, "all");
- if(content != NULL)
- {
- schema_all(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(extType->children, "choice");
- if(content != NULL)
- {
- schema_choice(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(extType->children, "sequence");
- if(content != NULL)
- {
- schema_sequence(sdl, tsn, content, cur_type);
- return TRUE;
- }
- return FALSE;
-}
-
-/*
-<all
- id = ID
- maxOccurs = 1 : 1
- minOccurs = (0 | 1) : 1
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, element*)
-</all>
-*/
-int schema_all(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr all, sdlTypePtr cur_type)
-{
- xmlNodePtr element, trav;
-
- trav = all->children;
- FOREACHNODE(trav, "element", element)
- {
- schema_element(sdl, tsn, element, cur_type);
- }
- ENDFOREACH(trav);
- return TRUE;
-}
-
-/*
-<group
- name = NCName>
- Content: (annotation?, (all | choice | sequence))
-</group>
-*/
-int schema_group(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTypePtr cur_type)
-{
- xmlNodePtr content;
- xmlAttrPtr name;
-
- name = get_attribute(groupType->properties, "name");
- if(name != NULL)
- {
-
- }
-
- content = get_node(groupType->children, "all");
- if(content != NULL)
- {
- schema_all(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(groupType->children, "choice");
- if(content != NULL)
- {
- schema_choice(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(groupType->children, "sequence");
- if(content != NULL)
- {
- schema_sequence(sdl, tsn, content, cur_type);
- return TRUE;
- }
- return FALSE;
-}
-/*
-<choice
- id = ID
- maxOccurs = (nonNegativeInteger | unbounded) : 1
- minOccurs = nonNegativeInteger : 1
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (element | group | choice | sequence | any)*)
-</choice>
-*/
-int schema_choice(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlTypePtr cur_type)
-{
- xmlNodePtr trav, data;
-
- /*
- cur_type->property_type = CHOICE;
- */
-
- trav = choiceType->children;
- FOREACHNODE(trav, "element", data)
- {
- schema_element(sdl, tsn, data, cur_type);
- }
- ENDFOREACH(trav);
-
- trav = choiceType->children;
- FOREACHNODE(trav, "group", data)
- {
- schema_group(sdl, tsn, data, cur_type);
- }
- ENDFOREACH(trav);
-
- trav = choiceType->children;
- FOREACHNODE(trav, "choice", data)
- {
- schema_choice(sdl, tsn, data, cur_type);
- }
- ENDFOREACH(trav);
-
- trav = choiceType->children;
- FOREACHNODE(trav, "sequence", data)
- {
- schema_sequence(sdl, tsn, data, cur_type);
- }
- ENDFOREACH(trav);
-
- trav = choiceType->children;
- FOREACHNODE(trav, "any", data)
- {
- schema_any(sdl, tsn, data, cur_type);
- }
- ENDFOREACH(trav);
-
- return TRUE;
-}
-
-/*
-<sequence
- id = ID
- maxOccurs = (nonNegativeInteger | unbounded) : 1
- minOccurs = nonNegativeInteger : 1
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (element | group | choice | sequence | any)*)
-</sequence>
-*/
-int schema_sequence(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr seqType, sdlTypePtr cur_type)
-{
- xmlNodePtr trav;
-
- trav = seqType->children;
- do
- {
- if(trav->type == XML_ELEMENT_NODE)
- {
- if(!strcmp(trav->name, "element"))
- {
- schema_element(sdl, tsn, trav, cur_type);
- }
- else if(!strcmp(trav->name, "group"))
- {
- schema_group(sdl, tsn, trav, cur_type);
- }
- else if(!strcmp(trav->name, "choice"))
- {
- schema_choice(sdl, tsn, trav, cur_type);
- }
- else if(!strcmp(trav->name, "sequence"))
- {
- schema_sequence(sdl, tsn, trav, cur_type);
- }
- else if(!strcmp(trav->name, "any"))
- {
- schema_any(sdl, tsn, trav, cur_type);
- }
- }
- }
- while(trav = trav->next);
-
- return TRUE;
-}
-
-int schema_any(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type)
-{
- return TRUE;
-}
-
-/*
-<complexContent
- id = ID
- mixed = boolean
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (restriction | extension))
-</complexContent>
-*/
-int schema_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compCont, sdlTypePtr cur_type)
-{
- xmlNodePtr content;
-
- content = get_node(compCont->children, "restriction");
- if(content != NULL)
- {
- schema_restriction_complexContent(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- return TRUE;
-}
-
-/*
-<complexType
- abstract = boolean : false
- block = (#all | List of (extension | restriction))
- final = (#all | List of (extension | restriction))
- id = ID
- mixed = boolean : false
- name = NCName
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))))
-</complexType>
-*/
-int schema_complexType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compType, sdlTypePtr cur_type)
-{
- xmlNodePtr content;
- xmlAttrPtr attrs, name, ns;
-
- attrs = compType->properties;
- ns = get_attribute(attrs, "targetNamespace");
- if(ns == NULL)
- ns = tsn;
-
- name = get_attribute(attrs, "name");
- if(name)
- {
- HashTable *ht;
- sdlTypePtr newType, *ptr;
- smart_str key = {0};
-
- newType = malloc(sizeof(sdlType));
- memset(newType, 0, sizeof(sdlType));
- newType->name = strdup(name->children->content);
- newType->namens = strdup(ns->children->content);
-
- if(cur_type == NULL)
- {
- ht = (*sdl)->types;
- smart_str_appends(&key, newType->namens);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, newType->name);
- smart_str_0(&key);
- }
- else
- {
- if(cur_type->elements == NULL)
- {
- cur_type->elements = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1);
- }
- ht = cur_type->elements;
- smart_str_appends(&key, newType->name);
- }
-
- zend_hash_add(ht, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), (void **)&ptr);
- cur_type = (*ptr);
- create_encoder((*sdl), cur_type, ns->children->content, name->children->content);
- smart_str_free(&key);
- }
-
- content = get_node(compType->children, "simpleContent");
- if(content != NULL)
- {
- schema_simpleContent(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(compType->children, "complexContent");
- if(content != NULL)
- {
- schema_complexContent(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- /* (group | all | choice | sequence) */
- content = get_node(compType->children, "group");
- if(content != NULL)
- {
- schema_group(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(compType->children, "all");
- if(content != NULL)
- {
- schema_all(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(compType->children, "choice");
- if(content != NULL)
- {
- schema_choice(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(compType->children, "sequence");
- if(content != NULL)
- schema_sequence(sdl, tsn, content, cur_type);
-
- return TRUE;
-}
-/*
-<element
- abstract = boolean : false
- block = (#all | List of (extension | restriction | substitution))
- default = string
- final = (#all | List of (extension | restriction))
- fixed = string
- form = (qualified | unqualified)
- id = ID
- maxOccurs = (nonNegativeInteger | unbounded) : 1
- minOccurs = nonNegativeInteger : 1
- name = NCName
- nillable = boolean : false
- ref = QName
- substitutionGroup = QName
- type = QName
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*))
-</element>
-*/
-int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr cur_type)
-{
- xmlNodePtr content;
- xmlAttrPtr attrs, curattr, name, ns;
- TSRMLS_FETCH(); /* is this really needed - or the parameter */
-
- attrs = element->properties;
- ns = get_attribute(attrs, "targetNamespace");
- if(ns == NULL)
- ns = tsn;
-
- name = get_attribute(attrs, "name");
- if(!name)
- name = get_attribute(attrs, "ref");
- if(name)
- {
- HashTable *addHash;
- sdlTypePtr newType, *tmp;
- smart_str key = {0};
-
- newType = malloc(sizeof(sdlType));
-
- memset(newType, 0, sizeof(sdlType));
- newType->name = strdup(name->children->content);
- newType->namens = strdup(tsn->children->content);
- newType->nullable = FALSE;
- newType->min_occurs = 1;
- newType->max_occurs = 1;
-
- if(cur_type == NULL)
- {
- addHash = (*sdl)->types;
- smart_str_appends(&key, newType->namens);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, newType->name);
- }
- else
- {
- if(cur_type->elements == NULL)
- {
- cur_type->elements = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1);
- }
- addHash = cur_type->elements;
- smart_str_appends(&key, newType->name);
- }
-
- smart_str_0(&key);
- zend_hash_add(addHash, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), (void **)&tmp);
- cur_type = (*tmp);
- create_encoder((*sdl), cur_type, ns->children->content, name->children->content);
- smart_str_free(&key);
- }
-
- curattr = get_attribute(attrs, "maxOccurs");
- if(curattr)
- {
- if(!strcmp(curattr->children->content, "unbounded"))
- cur_type->max_occurs = -1;
- else
- cur_type->max_occurs = atoi(curattr->children->content);
- }
-
- curattr = get_attribute(attrs, "minOccurs");
- if(curattr)
- cur_type->min_occurs = atoi(curattr->children->content);
-
- /* nillable = boolean : false */
- attrs = element->properties;
- curattr = get_attribute(attrs, "nillable");
- if(curattr)
- {
- if(!stricmp(curattr->children->content, "true") ||
- !stricmp(curattr->children->content, "1"))
- cur_type->nullable = TRUE;
- else
- cur_type->nullable = FALSE;
- }
- else
- cur_type->nullable = FALSE;
-
- /* type = QName */
- curattr = get_attribute(attrs, "type");
- if(!curattr)
- curattr = name;
- if(curattr)
- {
- char *cptype, *str_ns;
- xmlNsPtr nsptr;
-
- parse_namespace(curattr->children->content, &cptype, &str_ns);
- if(str_ns)
- nsptr = xmlSearchNs(element->doc, element, str_ns);
- else
- nsptr = xmlSearchNsByHref(element->doc, element, ns->children->content);
-
- cur_type->encode = get_create_encoder((*sdl), cur_type, (char *)nsptr->href, (char *)cptype);
- if(str_ns) efree(str_ns);
- if(cptype) efree(cptype);
- }
-
- if(cur_type->max_occurs == -1 || cur_type->max_occurs > 1)
- cur_type->encode = get_conversion(SOAP_ENC_ARRAY);
-
- content = get_node(element->children, "simpleType");
- if(content)
- schema_simpleType(sdl, tsn, content, cur_type);
-
- content = get_node(element->children, "complexType");
- if(content)
- schema_complexType(sdl, tsn, content, cur_type);
-
- return FALSE;
-}
-
-/*
-<attribute
- default = string
- fixed = string
- form = (qualified | unqualified)
- id = ID
- name = NCName
- ref = QName
- type = QName
- use = (optional | prohibited | required) : optional
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleType?))
-</attribute>
-*/
-int schema_attribute(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type)
-{
- xmlAttrPtr attr;
- sdlAttributePtr newAttr;
- xmlAttrPtr trav;
- smart_str key = {0};
-
- newAttr = malloc(sizeof(sdlAttribute));
- memset(newAttr, 0, sizeof(sdlAttribute));
-
- if(cur_type->attributes == NULL)
- {
- cur_type->attributes = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->attributes, 0, NULL, delete_attribute, 1);
- }
-
- trav = attrType->properties;
- FOREACHATTRNODE(trav, NULL, attr)
- {
- if(attr_is_equal_ex(trav, "default", SCHEMA_NAMESPACE))
- newAttr->def = strdup(attr->children->content);
- else if(attr_is_equal_ex(trav, "fixed", SCHEMA_NAMESPACE))
- newAttr->fixed = strdup(attr->children->content);
- else if(attr_is_equal_ex(trav, "form", SCHEMA_NAMESPACE))
- newAttr->form = strdup(attr->children->content);
- else if(attr_is_equal_ex(trav, "id", SCHEMA_NAMESPACE))
- newAttr->id = strdup(attr->children->content);
- else if(attr_is_equal_ex(trav, "name", SCHEMA_NAMESPACE))
- newAttr->name = strdup(attr->children->content);
- else if(attr_is_equal_ex(trav, "ref", SCHEMA_NAMESPACE))
- newAttr->ref= strdup(attr->children->content);
- else if(attr_is_equal_ex(trav, "type", SCHEMA_NAMESPACE))
- newAttr->type = strdup(attr->children->content);
- else if(attr_is_equal_ex(trav, "use", SCHEMA_NAMESPACE))
- newAttr->use = strdup(attr->children->content);
- else
- {
- xmlNsPtr nsPtr = attr_find_ns(trav);
-
- if(strcmp(nsPtr->href, SCHEMA_NAMESPACE))
- {
- smart_str key2 = {0};
-
- if(!newAttr->extraAttributes)
- {
- newAttr->extraAttributes = malloc(sizeof(HashTable));
- zend_hash_init(newAttr->extraAttributes, 0, NULL, NULL, 1);
- }
-
- smart_str_appends(&key2, nsPtr->href);
- smart_str_appendc(&key2, ':');
- smart_str_appends(&key2, trav->name);
- smart_str_0(&key2);
- zend_hash_add(newAttr->extraAttributes, key2.c, key2.len + 1, &trav, sizeof(xmlAttrPtr), NULL);
- smart_str_free(&key2);
- }
- }
- }
- ENDFOREACH(trav);
-
-
- if(newAttr->ref || newAttr->name)
- {
- xmlNsPtr ns;
-
- if(newAttr->ref)
- {
- char *value, *prefix = NULL;
-
- parse_namespace(newAttr->ref, &value, &prefix);
- ns = xmlSearchNs(attrType->doc, attrType, prefix);
- smart_str_appends(&key, ns->href);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, value);
-
- if(value)
- efree(value);
- if(prefix)
- efree(prefix);
- }
- else
- {
- ns = node_find_ns(attrType);
- smart_str_appends(&key, ns->href);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, newAttr->name);
- }
-
-
- if(ns)
- {
- smart_str_0(&key);
- zend_hash_add(cur_type->attributes, key.c, key.len + 1, &newAttr, sizeof(sdlAttributePtr), NULL);
- smart_str_free(&key);
- return TRUE;
- }
- }
-
- zend_hash_next_index_insert(cur_type->attributes, &newAttr, sizeof(sdlAttributePtr), NULL);
- return TRUE;
-} \ No newline at end of file
diff --git a/ext/soap/php_schema.h b/ext/soap/php_schema.h
deleted file mode 100644
index c43a221608..0000000000
--- a/ext/soap/php_schema.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef PHP_SCHEMA_H
-#define PHP_SCHEMA_H
-
-int load_schema(sdlPtr *sdl,xmlNodePtr schema);
-int schema_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpleType, sdlTypePtr cur_type);
-int schema_complexType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compType, sdlTypePtr cur_type);
-int schema_sequence(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr seqType, sdlTypePtr cur_type);
-int schema_list(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr listType, sdlTypePtr cur_type);
-int schema_union(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr unionType, sdlTypePtr cur_type);
-int schema_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpCompType, sdlTypePtr cur_type);
-int schema_restriction_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
-int schema_restriction_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
-int schema_restriction_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
-int schema_extension(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
-int schema_all(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
-int schema_group(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTypePtr cur_type);
-int schema_choice(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlTypePtr cur_type);
-int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr cur_type);
-int schema_attribute(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type);
-int schema_any(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
-
-int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valptr);
-void delete_restriction_var_int(void *rvi);
-
-int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr);
-void delete_schema_restriction_var_char(void *srvc);
-
-#endif
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
deleted file mode 100644
index c34f33b9e9..0000000000
--- a/ext/soap/php_sdl.c
+++ /dev/null
@@ -1,1139 +0,0 @@
-#include "php_soap.h"
-
-encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, char *type)
-{
- encodePtr enc = NULL;
- TSRMLS_FETCH();
-
- enc = get_conversion_from_type(data, type);
- if(enc == NULL && sdl)
- enc = get_conversion_from_type_ex(sdl->encoders, data, type);
- if(enc == NULL)
- enc = get_conversion(UNKNOWN_TYPE);
-
- return enc;
-}
-
-encodePtr get_encoder(sdlPtr sdl, char *ns, char *type)
-{
- encodePtr enc = NULL;
- char *nscat;
- TSRMLS_FETCH();
-
- nscat = emalloc(strlen(ns) + strlen(type) + 2);
- sprintf(nscat, "%s:%s", ns, type);
-
- enc = get_encoder_ex(sdl, nscat);
-
- efree(nscat);
- return enc;
-}
-
-encodePtr get_encoder_ex(sdlPtr sdl, char *nscat)
-{
- encodePtr enc = NULL;
- TSRMLS_FETCH();
-
- enc = get_conversion_from_href_type(nscat);
- if(enc == NULL && sdl)
- enc = get_conversion_from_href_type_ex(sdl->encoders, nscat, strlen(nscat));
- if(enc == NULL)
- enc = get_conversion(UNKNOWN_TYPE);
- return enc;
-}
-
-encodePtr get_create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *type)
-{
- encodePtr enc = NULL;
- smart_str nscat = {0};
- TSRMLS_FETCH();
-
- smart_str_appends(&nscat, ns);
- smart_str_appendc(&nscat, ':');
- smart_str_appends(&nscat, type);
- smart_str_0(&nscat);
-
- enc = get_conversion_from_href_type(nscat.c);
- if(enc == NULL)
- enc = get_conversion_from_href_type_ex(sdl->encoders, nscat.c, nscat.len);
- if(enc == NULL)
- enc = create_encoder(sdl, cur_type, ns, type);
-
- smart_str_free(&nscat);
- return enc;
-}
-
-encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *type)
-{
- smart_str nscat = {0};
- encodePtr enc;
-
- enc = malloc(sizeof(encode));
- memset(enc, 0, sizeof(encode));
-
- smart_str_appends(&nscat, ns);
- smart_str_appendc(&nscat, ':');
- smart_str_appends(&nscat, type);
- smart_str_0(&nscat);
-
- enc->details.ns = strdup(ns);
- enc->details.type_str = strdup(type);
- enc->details.sdl_type = cur_type;
- enc->to_xml = sdl_guess_convert_xml;
- enc->to_zval = sdl_guess_convert_zval;
-
- if(sdl->encoders == NULL)
- {
- sdl->encoders = malloc(sizeof(HashTable));
- zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, 1);
- }
- zend_hash_add(sdl->encoders, nscat.c, nscat.len + 1, &enc, sizeof(encodePtr), NULL);
- smart_str_free(&nscat);
- return enc;
-}
-
-zval *sdl_guess_convert_zval(encodeType enc, xmlNodePtr data)
-{
- sdlTypePtr type;
- zval *ret;
-
- type = enc.sdl_type;
-
- if(type->encode)
- {
- if(type->encode->details.type == IS_ARRAY ||
- type->encode->details.type == SOAP_ENC_ARRAY)
- ret = to_zval_array(enc, data);
- else
- ret = master_to_zval(type->encode, data);
- }
- else if(zend_hash_num_elements(type->elements) == 1)
- {
- sdlTypePtr *t;
- zend_hash_internal_pointer_reset(type->elements);
- if(zend_hash_get_current_data(type->elements, (void **)&t) != FAILURE &&
- (*t)->max_occurs != 1)
- ret = to_zval_array(enc, data);
- }
- if(ret)
- return ret;
- else
- return guess_zval_convert(enc, data);
-}
-
-xmlNodePtr sdl_guess_convert_xml(encodeType enc, zval *data, int style)
-{
- sdlTypePtr type;
- xmlNodePtr ret = NULL;
-
- type = enc.sdl_type;
-
- if(type->encode)
- {
- if(type->encode->details.type == IS_ARRAY ||
- type->encode->details.type == SOAP_ENC_ARRAY)
- ret = sdl_to_xml_array(type, data, style);
- else
- ret = master_to_xml(type->encode, data, style);
- }
- else if(type->elements)
- {
- sdlTypePtr *t;
- if(zend_hash_num_elements(type->elements) == 1)
- {
- zend_hash_internal_pointer_reset(type->elements);
- if(zend_hash_get_current_data(type->elements, (void **)&t) != FAILURE &&
- (*t)->max_occurs != 1)
- ret = sdl_to_xml_array((*t), data, style);
- }
- if(!ret)
- ret = sdl_to_xml_object(type, data, style);
- }
- else
- ret = guess_xml_convert(enc, data, style);
-
- /*
- set_ns_and_type(ret, enc);
- */
- return ret;
-}
-
-xmlNodePtr sdl_to_xml_object(sdlTypePtr type, zval *data, int style)
-{
- xmlNodePtr ret;
- sdlTypePtr *t, tmp;
-
- ret = xmlNewNode(NULL, "BOGUS");
-
- zend_hash_internal_pointer_reset(type->elements);
- while(zend_hash_get_current_data(type->elements, (void **)&t) != FAILURE)
- {
- zval **prop;
- tmp = *t;
- if(zend_hash_find(Z_OBJPROP_P(data), tmp->name, strlen(tmp->name) + 1, (void **)&prop) == FAILURE)
- {
- if(tmp->nullable == FALSE)
- php_error(E_ERROR, "Error encoding object to xml missing property \"%s\"", tmp->name);
- }
- else
- {
- xmlNodePtr newNode;
-
- newNode = master_to_xml(tmp->encode, (*prop), style);
- xmlNodeSetName(newNode, tmp->name);
- xmlAddChild(ret, newNode);
- }
- zend_hash_move_forward(type->elements);
- }
-
- return ret;
-}
-
-xmlNodePtr sdl_to_xml_array(sdlTypePtr type, zval *data, int style)
-{
- smart_str array_type_and_size = {0}, array_type = {0};
- int i;
- xmlNodePtr xmlParam;
- TSRMLS_FETCH();
-
- xmlParam = xmlNewNode(NULL,"BOGUS");
-
- FIND_ZVAL_NULL(data, xmlParam);
-
- if(Z_TYPE_P(data) == IS_ARRAY)
- {
- sdlAttributePtr *arrayType;
- i = zend_hash_num_elements(Z_ARRVAL_P(data));
-
- if(style == SOAP_ENCODED)
- {
- if(type->attributes &&
- zend_hash_find(type->attributes, SOAP_ENC_NAMESPACE":arrayType",
- sizeof(SOAP_ENC_NAMESPACE":arrayType"),
- (void **)&arrayType) == SUCCESS)
- {
- xmlAttrPtr *wsdl;
- if(zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arrayType", sizeof(WSDL_NAMESPACE":arrayType"), (void **)&wsdl) == SUCCESS)
- {
- char *ns = NULL, *value;
- smart_str *prefix = encode_new_ns();
- smart_str smart_ns = {0};
- xmlNsPtr myNs;
-
- parse_namespace((*wsdl)->children->content, &value, &ns);
- myNs = xmlSearchNs((*wsdl)->doc, (*wsdl)->parent, ns);
-
- smart_str_appendl(&smart_ns, "xmlns:", sizeof("xmlns:") - 1);
- smart_str_appendl(&smart_ns, prefix->c, prefix->len);
- smart_str_0(&smart_ns);
-
- xmlSetProp(xmlParam, smart_ns.c, myNs->href);
- smart_str_appends(&array_type_and_size, prefix->c);
- smart_str_appendc(&array_type_and_size, ':');
- smart_str_appends(&array_type_and_size, value);
- smart_str_0(&array_type_and_size);
-
- smart_str_free(prefix);
- efree(prefix);
- }
- }
- else
- {
- smart_str_appends(&array_type_and_size, type->name);
- smart_str_appendc(&array_type_and_size, '[');
- smart_str_append_long(&array_type_and_size, i);
- smart_str_appendc(&array_type_and_size, ']');
- smart_str_0(&array_type_and_size);
- }
- xmlSetProp(xmlParam, SOAP_ENC_NS_PREFIX":arrayType", array_type_and_size.c);
-
- smart_str_free(&array_type_and_size);
- smart_str_free(&array_type);
- }
-
- zend_hash_internal_pointer_reset(data->value.ht);
- for(;i > 0;i--)
- {
- xmlNodePtr xparam;
- zval **zdata;
- encodePtr enc;
- zend_hash_get_current_data(data->value.ht, (void **)&zdata);
-
- enc = get_conversion((*zdata)->type);
- xparam = master_to_xml(enc, (*zdata), style);
-
- xmlNodeSetName(xparam, type->name);
- xmlAddChild(xmlParam, xparam);
- zend_hash_move_forward(data->value.ht);
- }
- }
-
- if(style == SOAP_ENCODED)
- set_ns_and_type_ex(xmlParam, type->namens, type->name);
- return xmlParam;
-}
-
-zval *sdl_convert_zval(encodeType enc, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- ZVAL_STRING(ret, "blah", 1);
-
- return ret;
-}
-
-/*
-zval *sdl_convert_zval(xmlNodePtr data, sdlTypePtr type)
-{
- found = zend_hash_find(EG(class_table), class_name, class_name_len + 1, (void **)&ce);
- if(found != FAILURE)
- {
- service->type = SOAP_CLASS;
- service->soap_class.ce = ce;
- }
-}
-// this function will take a zval and apply all attributes of sldTypePtr
-zval *sdl_convert_zval_to_zval(zval *data, sdlTypePtr type)
-{
-}
-*/
-
-sdlPtr get_sdl(char *uri)
-{
- sdlPtr tmp, *hndl;
- TSRMLS_FETCH();
-
- tmp = NULL;
- hndl = NULL;
- if(zend_hash_find(SOAP_GLOBAL(sdls), uri, strlen(uri), (void **)&hndl) == FAILURE)
- {
- tmp = load_wsdl(uri, NULL);
- zend_hash_add(SOAP_GLOBAL(sdls), uri, strlen(uri), &tmp, sizeof(sdlPtr), NULL);
- }
- else
- tmp = *hndl;
-
- return tmp;
-}
-
-sdlBindingPtr get_binding_from_type(sdlPtr sdl, int type)
-{
- sdlBindingPtr *binding;
-
- if (sdl == NULL) {
- return NULL;
- }
-
- for(zend_hash_internal_pointer_reset(sdl->bindings);
- zend_hash_get_current_data(sdl->bindings, (void **) &binding) == SUCCESS;
- zend_hash_move_forward(sdl->bindings))
- {
- if((*binding)->bindingType == type)
- return *binding;
- }
- return NULL;
-}
-
-sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns)
-{
- sdlBindingPtr binding = NULL;
- smart_str key = {0};
-
- smart_str_appends(&key, ns);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, name);
-
- zend_hash_find(sdl->bindings, key.c, key.len, (void **)&binding);
-
- smart_str_free(&key);
- return binding;
-}
-
-int load_php_sdl()
-{
-#ifdef BRAD_0
- xmlNodePtr rootElement;
- xmlNodePtr services;
-
- SOAP_SERVER_GLOBAL_VARS();
- SOAP_SERVER_GLOBAL(availableServices) = xmlParseFile(servicesFile);
- rootElement = SOAP_SERVER_GLOBAL(availableServices)->children;
- services = rootElement->children;
-
- do
- {
- if(IS_ELEMENT_TYPE(services,PHP_SOAPSERVER_SERVICE))
- {
- phpSoapServicePtr newService;
- xmlNodePtr attrib, trav;
- HashTable *fn = NULL;
- HashTable *include = NULL;
- HashTable *cl = NULL;
-
- /* Init New Service */
- newService = emalloc(sizeof(phpSoapService));
- newService->serviceNode = services;
- newService->started = FALSE;
-
- fn = newService->functions = emalloc(sizeof(HashTable));
- include = newService->include_files = emalloc(sizeof(HashTable));
- zend_hash_init(fn, 0, NULL, free_function, 0);
- zend_hash_init(include, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- attrib = services->properties;
- trav = attrib;
- /* Get Attributes of Service */
- do
- {
- if(IS_ATTRIBUTE_TYPE(trav,PHP_SOAPSERVER_SERVICE_NAME))
- {
- char* name = ATTRIBUTE_VALUE(trav);
-
- /* Assign Service Vals */
- ALLOC_INIT_ZVAL(newService->serviceName);
- ZVAL_STRING(newService->serviceName,name,1);
- }
-
- if(IS_ATTRIBUTE_TYPE(trav,PHP_SOAPSERVER_SERVICE_STARTED))
- {
- char* started = ATTRIBUTE_VALUE(trav);
-
- /* Assign Service Vals */
- if(!stricmp(started,"true"))
- newService->started = TRUE;
- }
- }
- while(trav = trav->next);
-
- /* Get ChildNodes of Service */
- trav = services->children;
- do
- {
- /* Include Files */
- if(IS_ELEMENT_TYPE(trav,PHP_SOAPSERVER_SERVICE_INCLUDE_FILE))
- {
- xmlNodePtr trav1 = trav->properties;
- do
- {
- if(IS_ATTRIBUTE_TYPE(trav1,PHP_SOAPSERVER_SERVICE_INCLUDE_FILE_NAME))
- {
- char* name = ATTRIBUTE_VALUE(trav1);
- zval* z_name;
- ALLOC_INIT_ZVAL(z_name);
- ZVAL_STRING(z_name,name,1);
- zend_hash_next_index_insert(include,&z_name,sizeof(zval),NULL);
- }
- }
- while(trav1 = trav1->next);
- }
-
- /* Functions */
- if(IS_ELEMENT_TYPE(trav,PHP_SOAPSERVER_SERVICE_FUNCTION))
- {
- phpSoapServiceFunctionPtr function;
- xmlNodePtr trav1;
- HashTable *par = NULL;
-
- function = emalloc(sizeof(phpSoapServiceFunction));
- function->functionNode = trav;
-
- par = function->functionParams = emalloc(sizeof(HashTable));
- zend_hash_init(par, 0, NULL, free_param, 0);
-
- trav1 = trav->properties;
-
- do
- {
- if(IS_ATTRIBUTE_TYPE(trav1,PHP_SOAPSERVER_SERVICE_FUNCTION_NAME))
- {
- char* name = ATTRIBUTE_VALUE(trav1);
- ALLOC_INIT_ZVAL(function->functionName);
- ZVAL_STRING(function->functionName,name,1);
- }
- }
- while(trav1 = trav1->next);
-
- trav1 = trav->children;
- do
- {
- if(IS_ELEMENT_TYPE(trav1,PHP_SOAPSERVER_SERVICE_FUNCTION_PARAM))
- {
- phpSoapServiceParamPtr param;
- xmlNodePtr trav2;
-
- param = emalloc(sizeof(phpSoapServiceParam));
- param->paramNode = trav1;
-
- trav2 = trav1->properties;
-
- do
- {
- if(IS_ATTRIBUTE_TYPE(trav2,PHP_SOAPSERVER_SERVICE_FUNCTION_PARAM_NAME))
- {
- char* name = ATTRIBUTE_VALUE(trav2);
- ALLOC_INIT_ZVAL(param->paramName);
- ZVAL_STRING(param->paramName,name,1);
- }
- else if(IS_ATTRIBUTE_TYPE(trav2,PHP_SOAPSERVER_SERVICE_FUNCTION_PARAM_TYPE))
- {
- char* type = ATTRIBUTE_VALUE(trav2);
- ALLOC_INIT_ZVAL(param->paramType);
- ZVAL_STRING(param->paramType,type,1);
- }
- else if(IS_ATTRIBUTE_TYPE(trav2,PHP_SOAPSERVER_SERVICE_FUNCTION_PARAM_POSITION))
- {
- char* val = ATTRIBUTE_VALUE(trav2);
- ALLOC_INIT_ZVAL(param->paramName);
- ZVAL_LONG(param->paramName,atoi(val));
- }
- }
- while(trav2 = trav2->next);
- zend_hash_add(par,Z_STRVAL_P(param->paramName),Z_STRLEN_P(param->paramName),param,sizeof(phpSoapServiceParam),NULL);
- }
- }
- while(trav1 = trav1->next);
- zend_hash_add(fn,Z_STRVAL_P(function->functionName),Z_STRLEN_P(function->functionName),function,sizeof(phpSoapServiceFunction),NULL);
- }
-
- /* Classes */
- if(IS_ELEMENT_TYPE(trav,PHP_SOAPSERVER_SERVICE_CLASS))
- {
- xmlNodePtr att, func;
- att = trav->properties;
-
- if(fn == NULL)
- {
- fn = newService->functions = emalloc(sizeof(HashTable));
- zend_hash_init(fn, 0, NULL, ZVAL_PTR_DTOR, 0);
- }
-
- }
-
- }while(trav = trav->next);
-
- zend_hash_add(SOAP_SERVER_GLOBAL(services),Z_STRVAL_P(newService->serviceName),Z_STRLEN_P(newService->serviceName),newService,sizeof(phpSoapService),NULL);
- }
- }
- while(services = services->next);
-#endif
- return TRUE;
-}
-
-int write_php_sdl()
-{
- return TRUE;
-}
-
-sdlPtr load_wsdl(char *struri, sdlPtr parent)
-{
- xmlDocPtr wsdl;
- xmlNodePtr root, definitions, types, binding, schema, service, import;
- xmlNodePtr trav, trav2, trav3;
- xmlAttrPtr targetNamespace;
- sdlPtr tmpsdl;
- TSRMLS_FETCH();
-
- if(!parent)
- {
- tmpsdl = malloc(sizeof(sdl));
- memset(tmpsdl, 0, sizeof(sdl));
- tmpsdl->source = strdup(struri);
- }
- else
- tmpsdl = parent;
-
- wsdl = xmlParseFile(struri);
- xmlCleanupParser();
-
- if(!wsdl)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't load from %s", struri);
-
- tmpsdl->doc = wsdl;
- root = wsdl->children;
- definitions = get_node(root, "definitions");
- if(!definitions)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't find definitions in %s", struri);
-
- targetNamespace = get_attribute(definitions->properties, "targetNamespace");
- if(targetNamespace)
- tmpsdl->target_ns = strdup(targetNamespace->children->content);
-
- types = get_node(definitions->children, "types");
- if(types)
- {
- trav = types->children;
- FOREACHNODE(trav, "schema", schema)
- {
- load_schema(&tmpsdl, schema);
- }
- ENDFOREACH(trav);
- }
-
- trav = definitions->children;
- FOREACHNODE(trav, "import", import)
- {
- xmlAttrPtr tmp = get_attribute(import->properties, "location");
- if(tmp)
- load_wsdl(tmp->children->content, tmpsdl);
- }
- ENDFOREACH(trav);
-
- service = get_node(definitions->children, "service");
- if(service != NULL)
- {
- xmlAttrPtr name;
- xmlNodePtr trav, port;
-
- name = get_attribute(service->properties, "name");
- if(!name)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No name associated with service");
-
- trav = service->children;
- FOREACHNODE(trav, "port", port)
- {
- xmlAttrPtr type, name, bindingAttr, location;
- xmlNodePtr portType, operation;
- xmlNodePtr address;
- char *ns, *ctype;
- sdlBindingPtr tmpbinding;
-
- tmpbinding = malloc(sizeof(sdlBinding));
- memset(tmpbinding, 0, sizeof(sdlBinding));
-
- name = get_attribute(port->properties, "name");
- if(!name)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No name associated with port");
-
- bindingAttr = get_attribute(port->properties, "binding");
- if(bindingAttr == NULL)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No binding associated with port");
-
- /* find address and figure out binding type */
- address = get_node(port->children, "address");
- if(!address)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No address associated with port");
-
- location = get_attribute(address->properties, "location");
- if(!location)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No location associated with port");
-
- tmpbinding->location = strdup(location->children->content);
-
- if(address->ns && !strcmp(address->ns->href, WSDL_SOAP_NAMESPACE))
- tmpbinding->bindingType = BINDING_SOAP;
- else if(address->ns && !strcmp(address->ns->href, WSDL_HTTP_NAMESPACE))
- tmpbinding->bindingType = BINDING_HTTP;
-
- parse_namespace(bindingAttr->children->content, &ctype, &ns);
- binding = get_node_with_attribute(definitions->children, "binding", "name", ctype);
-
- if(!binding)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No binding element with name \"%s\"", ctype);
-
- if(ns) efree(ns); if(ctype) efree(ctype);
-
- if(tmpbinding->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingPtr soapBinding;
- xmlNodePtr soapBindingNode;
- xmlAttrPtr tmp;
-
- soapBinding = malloc(sizeof(sdlSoapBinding));
- memset(soapBinding, 0, sizeof(sdlSoapBinding));
-
- soapBindingNode = get_node_ex(binding->children, "binding", WSDL_SOAP_NAMESPACE);
- if(soapBindingNode)
- {
- tmp = get_attribute(soapBindingNode->properties, "style");
- if(tmp && !strcmp(tmp->children->content, "document"))
- soapBinding->style = SOAP_DOCUMENT;
- else
- soapBinding->style = SOAP_RPC;
-
- tmp = get_attribute(soapBindingNode->properties, "transport");
- if(tmp)
- {
- if(strcmp(tmp->children->content, WSDL_HTTP_TRANSPORT))
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: PHP-SOAP doesn't support transport '%s'", tmp->children->content);
-
- soapBinding->transport = strdup(tmp->children->content);
- }
- tmpbinding->bindingAttributes = (void *)soapBinding;
- }
- }
-
- name = get_attribute(binding->properties, "name");
- if(name == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing \"name\" attribute for \"binding\")");
-
- tmpbinding->name = strdup(name->children->content);
-
- type = get_attribute(binding->properties, "type");
- if(type == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing \"type\" attribute for \"binding\")");
-
- parse_namespace(type->children->content, &ctype, &ns);
- portType = get_node_with_attribute(definitions->children, "portType", "name", ctype);
- if(portType == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing \"portType\" with name \"%s\")", name->children->content);
- if(ctype) efree(ctype); if(ns) efree(ns);
-
- trav2 = binding->children;
- FOREACHNODE(trav2, "operation", operation)
- {
- sdlFunctionPtr function;
- xmlNodePtr input, output, fault, portTypeOperation, portTypeInput, msgInput, msgOutput;
- xmlAttrPtr op_name, paramOrder;
-
- op_name = get_attribute(operation->properties, "name");
- if(op_name == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing \"name\" attribute for \"operation\")");
-
- portTypeOperation = get_node_with_attribute(portType->children, "operation", "name", op_name->children->content);
- if(portTypeOperation == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing \"portType/operation\" with name \"%s\")", op_name->children->content);
-
- function = malloc(sizeof(sdlFunction));
- function->functionName = strdup(op_name->children->content);
- function->requestParameters = NULL;
- function->responseParameters = NULL;
- function->responseName = NULL;
- function->bindingAttributes = NULL;
- function->bindingType = tmpbinding->bindingType;
-
- if(tmpbinding->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingFunctionPtr soapFunctionBinding;
- sdlSoapBindingPtr soapBinding;
- xmlNodePtr soapOperation;
- xmlAttrPtr tmp;
-
- soapFunctionBinding = malloc(sizeof(sdlSoapBindingFunction));
- memset(soapFunctionBinding, 0, sizeof(sdlSoapBindingFunction));
- soapBinding = (sdlSoapBindingPtr)tmpbinding->bindingAttributes;
- soapFunctionBinding->style = soapBinding->style;
-
- soapOperation = get_node_ex(operation->children, "operation", WSDL_SOAP_NAMESPACE);
- if(soapOperation)
- {
- tmp = get_attribute(soapOperation->properties, "soapAction");
- if(tmp)
- soapFunctionBinding->soapAction = strdup(tmp->children->content);
-
- tmp = get_attribute(soapOperation->properties, "style");
- if(tmp && !strcmp(tmp->children->content, "rpc"))
- soapFunctionBinding->style = SOAP_RPC;
- else if(!soapBinding->style)
- soapFunctionBinding->style = SOAP_DOCUMENT;
- }
-
- function->bindingAttributes = (void *)soapFunctionBinding;
- }
-
- input = get_node(operation->children, "input");
- if(input != NULL)
- {
- xmlAttrPtr message;
- xmlNodePtr part;
- char *ns, *ctype;
-
- portTypeInput = get_node(portTypeOperation->children, "input");
- message = get_attribute(portTypeInput->properties, "message");
- if(message == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing name for \"input\" of \"%s\")", op_name->children->content);
-
- function->requestName = strdup(function->functionName);
- function->requestParameters = malloc(sizeof(HashTable));
- zend_hash_init(function->requestParameters, 0, NULL, delete_paramater, 1);
-
- parse_namespace(message->children->content, &ctype, &ns);
- msgInput = get_node_with_attribute(definitions->children, "message", "name", ctype);
- if(msgInput == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing \"message\" with name \"%s\")", message->children->content);
- if(ctype) efree(ctype); if(ns) efree(ns);
-
- if(tmpbinding->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingFunctionPtr soapFunctionBinding = function->bindingAttributes;
- xmlNodePtr body;
- xmlAttrPtr tmp;
-
- body = get_node_ex(input->children, "body", WSDL_SOAP_NAMESPACE);
- if(body)
- {
- tmp = get_attribute(body->properties, "use");
- if(tmp && !strcmp(tmp->children->content, "literal"))
- soapFunctionBinding->input.use = SOAP_LITERAL;
- else
- soapFunctionBinding->input.use = SOAP_ENCODED;
-
- tmp = get_attribute(body->properties, "namespace");
- if(tmp)
- soapFunctionBinding->input.ns = strdup(tmp->children->content);
-
- tmp = get_attribute(body->properties, "parts");
- if(tmp)
- soapFunctionBinding->input.parts = strdup(tmp->children->content);
-
- tmp = get_attribute(body->properties, "encodingStyle");
- if(tmp)
- soapFunctionBinding->input.encodingStyle = strdup(tmp->children->content);
- }
- }
-
- trav3 = msgInput->children;
- FOREACHNODE(trav3, "part", part)
- {
- xmlAttrPtr element, type, name;
- sdlParamPtr param;
-
- param = malloc(sizeof(sdlParam));
- param->order = 0;
-
- name = get_attribute(part->properties, "name");
- if(name == NULL)
- php_error(E_ERROR, "Error parsing wsdl (No name associated with part \"%s\")", msgInput->name);
-
- param->paramName = strdup(name->children->content);
-
- element = get_attribute(part->properties, "element");
- if(element != NULL)
- param->encode = get_encoder_from_prefix(tmpsdl, part, element->children->content);
-
- type = get_attribute(part->properties, "type");
- if(type != NULL)
- param->encode = get_encoder_from_prefix(tmpsdl, part, type->children->content);
-
- zend_hash_next_index_insert(function->requestParameters, &param, sizeof(sdlParamPtr), NULL);
- }
- ENDFOREACH(trav3);
- }
-
- paramOrder = get_attribute(portTypeOperation->properties, "parameterOrder");
- if(paramOrder)
- {
-
- }
-
- output = get_node(portTypeOperation->children, "output");
- if(output != NULL)
- {
- xmlAttrPtr message;
- xmlNodePtr part;
- char *ns, *ctype;
-
-
- function->responseName = malloc(strlen(function->functionName) + strlen("Response") + 1);
- sprintf(function->responseName, "%sResponse\0", function->functionName);
- function->responseParameters = malloc(sizeof(HashTable));
- zend_hash_init(function->responseParameters, 0, NULL, delete_paramater, 1);
-
- message = get_attribute(output->properties, "message");
- if(message == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing name for \"output\" of \"%s\")", op_name->children->content);
-
- parse_namespace(message->children->content, &ctype, &ns);
- msgOutput = get_node_with_attribute(definitions->children, "message", "name", ctype);
- if(msgOutput == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing \"message\" with name \"%s\")", message->children->content);
- if(ctype) efree(ctype); if(ns) efree(ns);
-
- if(tmpbinding->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingFunctionPtr soapFunctionBinding = function->bindingAttributes;
- xmlNodePtr body;
- xmlAttrPtr tmp;
-
- body = get_node_ex(output->children, "body", WSDL_SOAP_NAMESPACE);
- if(body)
- {
- tmp = get_attribute(body->properties, "use");
- if(tmp && !strcmp(tmp->children->content, "literal"))
- soapFunctionBinding->output.use = SOAP_LITERAL;
- else
- soapFunctionBinding->output.use = SOAP_ENCODED;
-
- tmp = get_attribute(body->properties, "namespace");
- if(tmp)
- soapFunctionBinding->output.ns = strdup(tmp->children->content);
-
- tmp = get_attribute(body->properties, "parts");
- if(tmp)
- soapFunctionBinding->output.parts = strdup(tmp->children->content);
-
- tmp = get_attribute(body->properties, "encodingStyle");
- if(tmp)
- soapFunctionBinding->output.encodingStyle = strdup(tmp->children->content);
- }
- }
-
- trav3 = msgOutput->children;
- FOREACHNODE(trav3, "part", part)
- {
- sdlParamPtr param;
- xmlAttrPtr element, type, name;
-
- param = malloc(sizeof(sdlParam));
- param->order = 0;
-
- name = get_attribute(part->properties, "name");
- if(name == NULL)
- php_error(E_ERROR, "Error parsing wsdl (No name associated with part \"%s\")", msgOutput->name);
-
- param->paramName = strdup(name->children->content);
-
- element = get_attribute(part->properties, "element");
- if(element)
- param->encode = get_encoder_from_prefix(tmpsdl, part, element->children->content);
-
- type = get_attribute(part->properties, "type");
- if(type)
- param->encode = get_encoder_from_prefix(tmpsdl, part, type->children->content);
-
- zend_hash_next_index_insert(function->responseParameters, &param, sizeof(sdlParamPtr), NULL);
- }
- ENDFOREACH(trav3);
- }
-
- fault = get_node(operation->children, "fault");
- if(!fault)
- {
- }
-
- if(!tmpbinding->functions)
- {
- tmpbinding->functions = malloc(sizeof(HashTable));
- zend_hash_init(tmpbinding->functions, 0, NULL, delete_function, 1);
- }
-
- zend_hash_add(tmpbinding->functions, php_strtolower(function->functionName, strlen(function->functionName)), strlen(function->functionName), &function, sizeof(sdlFunctionPtr), NULL);
- }
- ENDFOREACH(trav2);
-
- if(!tmpsdl->bindings)
- {
- tmpsdl->bindings = malloc(sizeof(HashTable));
- zend_hash_init(tmpsdl->bindings, 0, NULL, delete_binding, 1);
- }
-
- zend_hash_add(tmpsdl->bindings, tmpbinding->name, strlen(tmpbinding->name), &tmpbinding, sizeof(sdlBindingPtr), NULL);
- }
- ENDFOREACH(trav);
-
- }
- else
- php_error(E_ERROR, "Error parsing wsdl (\"Couldn't bind to service\")");
-
- return tmpsdl;
-}
-
-int write_wsdl()
-{
- return TRUE;
-}
-
-int write_ms_sdl()
-{
- return TRUE;
-}
-
-int load_ms_sdl(char *struri,int force_load)
-{
-/* Commenting this out. Does anyone need it? */
-#ifdef BRAD_0
-
- if(get_sdl(struri) == NULL || force_load)
- {
- SOAP_TLS_VARS();
- xmlDocPtr sdl = xmlParseFile(struri);
- xmlNodePtr schema,trav,trav2,req,res,paramOrd,reqRes,address,serviceAdd,service,soap,serviceDesc,root = sdl->children;
- xmlAttrPtr tmpattr,uri;
- char *add,*functionName,*soapAction,*request,*response,*parameterOrder,*value,*namespace;
- SDLPtr sdlPtr;
- SoapFunctionPtr tmpFunction;
- zval *tempZval;
- serviceDesc = get_node(root,"serviceDescription");
- soap = get_node(serviceDesc->children,"soap");
- trav = soap->children;
- sdlPtr = emalloc(sizeof(SDL));
-
- ALLOC_INIT_ZVAL(sdlPtr->sdlUri);
- ZVAL_STRING(sdlPtr->sdlUri,struri,1);
-
- FOREACHNODE(trav,"service",service)
- {
- sdlPtr->soapFunctions = emalloc(sizeof(HashTable));
- sdlPtr->addresses = emalloc(sizeof(HashTable));
- zend_hash_init(sdlPtr->soapFunctions, 0, NULL, delete_function, 0);
- zend_hash_init(sdlPtr->addresses, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- serviceAdd = get_node(service->children,"addresses");
- trav2 = serviceAdd->children;
- ALLOC_INIT_ZVAL(tempZval);
- FOREACHNODE(trav2,"address",address)
- {
- uri = get_attribute(address->properties,"uri");
- add = uri->children->content;
- ZVAL_STRING(tempZval,add,1);
- zend_hash_next_index_insert(sdlPtr->addresses,tempZval,sizeof(zval),NULL);
- }
- ENDFOREACH(trav2);
- trav2 = service->children;
- FOREACHNODE(trav2,"requestResponse",reqRes)
- {
- tmpFunction = emalloc(sizeof(SoapFunction));
-
- tmpattr = get_attribute(reqRes->properties,"name");
- functionName = tmpattr->children->content;
- ALLOC_INIT_ZVAL(tmpFunction->functionName);
- ZVAL_STRING(tmpFunction->functionName,functionName,1);
-
- tmpattr = get_attribute(reqRes->properties,"soapAction");
- soapAction = tmpattr->children->content;
- ALLOC_INIT_ZVAL(tmpFunction->soapAction);
- ZVAL_STRING(tmpFunction->soapAction,soapAction,1);
-
- /* Request */
- req = get_node(reqRes->children,"request");
- tmpattr = get_attribute(req->properties,"ref");
- if(tmpattr != NULL)
- {
- request = tmpattr->children->content;
- parse_namespace(request,&value,&namespace);
- ALLOC_INIT_ZVAL(tmpFunction->requestName);
- ZVAL_STRING(tmpFunction->requestName,value,1);
- tmpFunction->requestParameters = emalloc(sizeof(HashTable));
- zend_hash_init(tmpFunction->requestParameters, 0, NULL, delete_paramater, 0);
- efree(value);
- efree(namespace);
- }
-
- /* Response */
- res = get_node(reqRes->children,"response");
- tmpattr = get_attribute(res->properties,"ref");
- if(tmpattr != NULL)
- {
- response = tmpattr->children->content;
- parse_namespace(response,&value,&namespace);
- ALLOC_INIT_ZVAL(tmpFunction->responseName);
- ZVAL_STRING(tmpFunction->responseName,value,1);
- tmpFunction->responseParameters = emalloc(sizeof(HashTable));
- zend_hash_init(tmpFunction->responseParameters, 0, NULL, delete_paramater, 0);
- efree(value);
- efree(namespace);
- }
-
- /* Parameters */
- paramOrd = get_node(reqRes->children,"parameterorder");
- if(paramOrd != NULL)
- {
- zval *space,*array,**strval;
- int count,i;
- ALLOC_INIT_ZVAL(space);
- ZVAL_STRING(space," ",0);
- parameterOrder = paramOrd->children->content;
- ZVAL_STRING(tempZval,parameterOrder,1);
- ALLOC_INIT_ZVAL(array);
- array_init(array);
-
- /* Split on space */
- php_explode(space, tempZval, array, -1);
- zend_hash_internal_pointer_reset(array->value.ht);
- count = zend_hash_num_elements(array->value.ht);
-
- for(i = 0;i < count;i++)
- {
- SoapParamPtr param;
- param = emalloc(sizeof(SoapParam));
- param->order = i+1;
- param->type = NULL;
- zend_hash_get_current_data(array->value.ht,(void **)&strval);
- ALLOC_INIT_ZVAL(param->paramName);
- ZVAL_STRING(param->paramName,Z_STRVAL_PP(strval),1);
- zend_hash_next_index_insert(tmpFunction->requestParameters,param,sizeof(SoapParam),NULL);
- zend_hash_move_forward(array->value.ht);
- }
- }
- zend_hash_add(sdlPtr->soapFunctions,(char *)php_strtolower(functionName,strlen(functionName)),strlen(functionName),tmpFunction,sizeof(SoapFunction),NULL);
- }
- ENDFOREACH(trav2);
- }
- ENDFOREACH(trav);
-
- trav = serviceDesc->children;
- FOREACHNODE(trav,"schema",schema)
- {
- load_schema(&sdlPtr, schema);
- }
- ENDFOREACH(trav);
- sdlPtr->have_sdl = 1;
- map_types_to_functions(sdlPtr);
- zend_hash_add(SOAP_GLOBAL(SDLs),struri,strlen(struri),sdlPtr,sizeof(SDL),NULL);
- }
-#endif
- return FALSE;
-}
-
-void delete_type(void *data)
-{
- sdlTypePtr type = *((sdlTypePtr*)data);
- if(type->name)
- free(type->name);
- if(type->namens)
- free(type->namens);
- if(type->elements)
- {
- zend_hash_destroy(type->elements);
- free(type->elements);
- }
- if(type->attributes)
- {
- zend_hash_destroy(type->attributes);
- free(type->attributes);
- }
- if(type->restrictions)
- {
- delete_restriction_var_int(&type->restrictions->minExclusive);
- delete_restriction_var_int(&type->restrictions->minInclusive);
- delete_restriction_var_int(&type->restrictions->maxExclusive);
- delete_restriction_var_int(&type->restrictions->maxInclusive);
- delete_restriction_var_int(&type->restrictions->totalDigits);
- delete_restriction_var_int(&type->restrictions->fractionDigits);
- delete_restriction_var_int(&type->restrictions->length);
- delete_restriction_var_int(&type->restrictions->minLength);
- delete_restriction_var_int(&type->restrictions->maxLength);
- delete_schema_restriction_var_char(&type->restrictions->whiteSpace);
- delete_schema_restriction_var_char(&type->restrictions->pattern);
- zend_hash_destroy(type->restrictions->enumeration);
- free(type->restrictions->enumeration);
- free(type->restrictions);
- }
- free(type);
-}
-
-void delete_attribute(void *attribute)
-{
- sdlAttributePtr attr = *((sdlAttributePtr*)attribute);
-
- if(attr->def)
- free(attr->def);
- if(attr->fixed)
- free(attr->fixed);
- if(attr->form)
- free(attr->form);
- if(attr->id)
- free(attr->id);
- if(attr->name)
- free(attr->name);
- if(attr->ref)
- free(attr->ref);
- if(attr->type)
- free(attr->type);
- if(attr->use)
- free(attr->use);
- if(attr->extraAttributes)
- {
- zend_hash_destroy(attr->extraAttributes);
- free(attr->extraAttributes);
- }
-}
diff --git a/ext/soap/php_sdl.h b/ext/soap/php_sdl.h
deleted file mode 100644
index 38c9001e84..0000000000
--- a/ext/soap/php_sdl.h
+++ /dev/null
@@ -1,167 +0,0 @@
-#ifndef PHP_SDL_H
-#define PHP_SDL_H
-
-#define XSD_WHITESPACE_COLLAPSE 1
-#define XSD_WHITESPACE_PRESERVE 1
-#define XSD_WHITESPACE_REPLACE 1
-
-#define BINDING_SOAP 1
-#define BINDING_HTTP 2
-
-#define SOAP_RPC 1
-#define SOAP_DOCUMENT 2
-
-#define SOAP_ENCODED 1
-#define SOAP_LITERAL 2
-
-struct _sdl
-{
- xmlDocPtr doc; /* pointer to the parsed xml file */
- HashTable *types; /* array of sdlTypesPtr */
- HashTable *encoders; /* array of encodePtr */
- HashTable *bindings; /* array of sdlBindings (key'd by name) */
- char *target_ns;
- char *source;
-};
-
-struct _sdlBinding
-{
- char *name;
- HashTable *functions;
- char *location;
- int bindingType;
- void *bindingAttributes;
-};
-
-/* Soap Binding Specfic stuff */
-struct _sdlSoapBinding
-{
- char *transport;
- int style;
-};
-
-struct _sdlSoapBindingFunctionBody
-{
- char *ns;
- int use;
- char *parts; /* not implemented yet */
- char *encodingStyle; /* not implemented yet */
-};
-
-struct _sdlSoapBindingFunction
-{
- char *soapAction;
- int style;
-
- sdlSoapBindingFunctionBody input;
- sdlSoapBindingFunctionBody output;
- sdlSoapBindingFunctionBody falut;
-};
-
-/* HTTP Binding Specfic stuff */
-/*********** not implemented yet ************
-struct _sdlHttpBinding
-{
- int holder;
-};
-*********************************************/
-
-struct _sdlRestrictionInt
-{
- int value;
- char fixed;
- char *id;
-};
-
-struct _sdlRestrictionChar
-{
- char *value;
- char fixed;
- char *id;
-};
-
-struct _sdlRestrictions
-{
- HashTable *enumeration; /* array of sdlRestrictionCharPtr */
- sdlRestrictionIntPtr minExclusive;
- sdlRestrictionIntPtr minInclusive;
- sdlRestrictionIntPtr maxExclusive;
- sdlRestrictionIntPtr maxInclusive;
- sdlRestrictionIntPtr totalDigits;
- sdlRestrictionIntPtr fractionDigits;
- sdlRestrictionIntPtr length;
- sdlRestrictionIntPtr minLength;
- sdlRestrictionIntPtr maxLength;
- sdlRestrictionCharPtr whiteSpace;
- sdlRestrictionCharPtr pattern;
-};
-
-struct _sdlType
-{
- char *name;
- char *namens;
- int nullable;
- int min_occurs;
- int max_occurs;
- HashTable *elements; /* array of sdlTypePtr */
- HashTable *attributes; /* array of sdlAttributePtr */
- sdlRestrictionsPtr restrictions;
- encodePtr encode;
-};
-
-struct _sdlParam
-{
- int order;
- encodePtr encode;
- char *paramName;
-};
-
-struct _sdlFunction
-{
- char *functionName;
- char *requestName;
- char *responseName;
- HashTable *requestParameters; /* array of sdlParamPtr */
- HashTable *responseParameters; /* array of sdlParamPtr (this should only be one) */
- int bindingType;
- void *bindingAttributes;
-};
-
-struct _sdlAttribute
-{
- char *def;
- char *fixed;
- char *form;
- char *id;
- char *name;
- char *ref;
- char *type;
- char *use;
- HashTable *extraAttributes; /* array of xmlNodePtr */
-};
-
-sdlPtr get_sdl(char *uri);
-sdlPtr load_wsdl(char *struri, sdlPtr parent);
-int load_sdl(char *struri, int force_load);
-int load_ms_sdl(char *struri, int force_load);
-
-encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, char *type);
-encodePtr get_encoder(sdlPtr sdl, char *ns, char *type);
-encodePtr get_encoder_ex(sdlPtr sdl, char *nscat);
-encodePtr get_create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *type);
-encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *type);
-
-sdlBindingPtr get_binding_from_type(sdlPtr sdl, int type);
-sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns);
-
-xmlNodePtr sdl_guess_convert_xml(encodeType enc, zval* data, int style);
-zval *sdl_guess_convert_zval(encodeType enc, xmlNodePtr data);
-
-xmlNodePtr sdl_to_xml_array(sdlTypePtr type, zval *data, int style);
-xmlNodePtr sdl_to_xml_object(sdlTypePtr type, zval *data, int style);
-
-void delete_type(void *type);
-void delete_attribute(void *attribute);
-#endif
-
-
diff --git a/ext/soap/php_soap.dsp b/ext/soap/php_soap.dsp
deleted file mode 100644
index a80142d6c3..0000000000
--- a/ext/soap/php_soap.dsp
+++ /dev/null
@@ -1,148 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php_soap" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php_soap - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php_soap.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php_soap.mak" CFG="php_soap - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php_soap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php_soap - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php_soap - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\libxml2-2.4.12\include" /I "..\..\bind" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTSWS" /D "PHP_SOAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "ZTS" /D ZEND_DEBUG=0 /D "COMPILE_DL_SOAP" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib libxml2.lib wsock32.lib resolv.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_soap.dll" /libpath:"..\..\\" /libpath:"..\..\..\libxml2-2.4.12\lib" /libpath:"..\..\Release_TS"
-
-!ELSEIF "$(CFG)" == "php_soap - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\libxml2-2.4.12\include" /I "..\..\bind" /D "WS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "ZTS" /D ZEND_DEBUG=1 /D "COMPILE_DL_SOAP" /FR"Release_TS/" /Fp"Release_TS/gd.pch" /YX /Fo"Release_TS/" /Fd"Release_TS/" /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib libxml2.lib wsock32.lib resolv.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_soap.dll" /implib:"Release_TS/php_gd.lib" /pdbtype:sept /libpath:"..\..\\" /libpath:"..\..\..\libxml2-2.4.12\lib" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none /incremental:no
-
-!ENDIF
-
-# Begin Target
-
-# Name "php_soap - Win32 Release"
-# Name "php_soap - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_encoding.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_http.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_schema.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_sdl.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_xml.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\soap.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_encoding.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_http.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_schema.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_sdl.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_soap.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_xml.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h
deleted file mode 100644
index 9475e3207e..0000000000
--- a/ext/soap/php_soap.h
+++ /dev/null
@@ -1,416 +0,0 @@
-#ifndef PHP_SOAP_H
-#define PHP_SOAP_H
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_standard.h"
-#include "ext/session/php_session.h"
-#include "ext/standard/php_smart_str.h"
-#include "php_ini.h"
-#include "SAPI.h"
-#include <libxml/parser.h>
-#include <libxml/xpath.h>
-
-#ifdef HAVE_PHP_DOMXML
-# include "ext/domxml/php_domxml.h"
-#endif
-
-#ifndef PHP_HAVE_STREAMS
-# error You lose - must be compiled against PHP 4.3.0 or later
-#endif
-
-#ifndef PHP_WIN32
-# define TRUE 1
-# define FALSE 0
-# define stricmp strcasecmp
-#endif
-
-typedef struct _encodeType encodeType, *encodeTypePtr;
-typedef struct _encode encode, *encodePtr;
-
-typedef struct _sdl sdl, *sdlPtr;
-typedef struct _sdlRestrictionInt sdlRestrictionInt, *sdlRestrictionIntPtr;
-typedef struct _sdlRestrictionChar sdlRestrictionChar, *sdlRestrictionCharPtr;
-typedef struct _sdlRestrictions sdlRestrictions, *sdlRestrictionsPtr;
-typedef struct _sdlType sdlType, *sdlTypePtr;
-typedef struct _sdlParam sdlParam, *sdlParamPtr;
-typedef struct _sdlFunction sdlFunction, *sdlFunctionPtr;
-typedef struct _sdlAttribute sdlAttribute, *sdlAttributePtr;
-typedef struct _sdlBinding sdlBinding, *sdlBindingPtr;
-typedef struct _sdlSoapBinding sdlSoapBinding, *sdlSoapBindingPtr;
-typedef struct _sdlSoapBindingFunction sdlSoapBindingFunction, *sdlSoapBindingFunctionPtr;
-typedef struct _sdlSoapBindingFunctionBody sdlSoapBindingFunctionBody, *sdlSoapBindingFunctionBodyPtr;
-
-typedef struct _soapMapping soapMapping, *soapMappingPtr;
-typedef struct _soapService soapService, *soapServicePtr;
-
-#include "php_xml.h"
-#include "php_encoding.h"
-#include "php_sdl.h"
-#include "php_schema.h"
-#include "php_http.h"
-#include "php_packet_soap.h"
-
-extern int le_sdl;
-extern int le_http_socket;
-extern int le_url;
-extern int le_service;
-
-
-struct _soapHeaderHandler
-{
- char *ns;
- int type;
-
- struct _function_handler
- {
- char *functionName;
- char *type;
- } function_handler;
-
- struct _class_handler
- {
- zend_class_entry *ce;
- } class_handler;
-};
-
-struct _soapMapping
-{
- char *ns;
- char *ctype;
- int type;
-
- struct _map_functions
- {
- zval *to_xml_before;
- zval *to_xml;
- zval *to_xml_after;
- zval *to_zval_before;
- zval *to_zval;
- zval *to_zval_after;
- } map_functions;
-
- struct _map_class
- {
- int type;
- zend_class_entry *ce;
- } map_class;
-};
-
-struct _soapService
-{
- sdlPtr sdl;
-
- struct _soap_functions
- {
- HashTable *ft;
- int functions_all;
- } soap_functions;
-
- struct _soap_class
- {
- zend_class_entry *ce;
- zval **argv;
- int argc;
- int persistance;
- } soap_class;
-
- HashTable *mapping;
- int type;
- int enabled;
- char *uri;
-};
-
-#define SOAP_CLASS 1
-#define SOAP_FUNCTIONS 2
-#define SOAP_FUNCTIONS_ALL 999
-
-#define SOAP_MAP_FUNCTION 1
-#define SOAP_MAP_CLASS 2
-
-#define SOAP_PERSISTENCE_SESSION 1
-#define SOAP_PERSISTENCE_REQUEST 2
-
-ZEND_BEGIN_MODULE_GLOBALS(soap)
- HashTable *defEncNs;
- HashTable *defEncPrefix;
- HashTable *defEnc;
- HashTable *defEncIndex;
- HashTable *sdls;
- HashTable *services;
- HashTable *overrides;
- int cur_uniq_ns;
-ZEND_END_MODULE_GLOBALS(soap)
-#ifdef PHP_WIN32
-#define PHP_SOAP_API __declspec(dllexport)
-#else
-#define PHP_SOAP_API
-#endif
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-ZEND_EXTERN_MODULE_GLOBALS(soap);
-
-#ifdef ZTS
-# define SOAP_GLOBAL(v) TSRMG(soap_globals_id, zend_soap_globals *, v)
-#else
-# define SOAP_GLOBAL(v) (soap_globals.v)
-#endif
-
-#define PHP_SOAP_SERVER_CLASSNAME "soapserver"
-#define PHP_SOAP_CLASSNAME "soapobject"
-#define PHP_SOAP_VAR_CLASSNAME "soapvar"
-#define PHP_SOAP_FAULT_CLASSNAME "soapfault"
-#define PHP_SOAP_PARAM_CLASSNAME "soapparam"
-
-
-extern zend_module_entry soap_module_entry;
-#define soap_module_ptr & soap_module_entry
-
-PHP_MINIT_FUNCTION(soap);
-PHP_MSHUTDOWN_FUNCTION(soap);
-PHP_MINFO_FUNCTION(soap);
-
-/*
- Registry Functions
- TODO: this!
-*/
-PHP_FUNCTION(load_sdl);
-PHP_FUNCTION(unload_sdl);
-PHP_FUNCTION(unload_all_sdls);
-PHP_FUNCTION(get_available_sdls);
-PHP_FUNCTION(get_available_functions);
-PHP_FUNCTION(get_function_parameters);
-PHP_FUNCTION(soap_encode_to_xml);
-PHP_FUNCTION(soap_encode_to_zval);
-
-
-/* Server Functions */
-PHP_FUNCTION(soapserver);
-PHP_FUNCTION(setclass);
-PHP_FUNCTION(addfunction);
-PHP_FUNCTION(getfunctions);
-PHP_FUNCTION(handle);
-PHP_FUNCTION(setpersistence);
-PHP_FUNCTION(bind);
-#ifdef HAVE_PHP_DOMXML
-PHP_FUNCTION(map);
-#endif
-
-/* Client Functions */
-PHP_FUNCTION(soapobject);
-PHP_FUNCTION(__use);
-PHP_FUNCTION(__style);
-PHP_FUNCTION(__isfault);
-PHP_FUNCTION(__getfault);
-PHP_FUNCTION(__call);
-PHP_FUNCTION(__parse);
-PHP_FUNCTION(__generate);
-PHP_FUNCTION(__trace);
-PHP_FUNCTION(__getfunctions);
-PHP_FUNCTION(__gettypes);
-PHP_FUNCTION(__getlastresponse);
-PHP_FUNCTION(__getlastrequest);
-PHP_FUNCTION(__headerclass);
-PHP_FUNCTION(__headerfunction);
-
-/* SoapVar Functions */
-PHP_FUNCTION(soapvar);
-
-/* SoapFault Functions */
-PHP_FUNCTION(soapfault);
-
-/* SoapParam Functions */
-PHP_FUNCTION(soapparam);
-
-
-#define DECLARE_TRACE(file) \
- FILE *trace_fp; \
- char *trace_file = file;
-
-#define TRACE(place) \
- trace_fp = fopen(trace_file, "a+"); \
- fwrite(place, strlen(place), 1, trace_fp); \
- fclose(trace_fp);
-
-extern zend_class_entry soap_var_class_entry;
-
-PS_SERIALIZER_FUNCS(soap);
-
-void clear_soap_fault(zval *obj);
-void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC);
-void add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC);
-
-sdlParamPtr get_param(sdlFunctionPtr function, char *param_name, int index, int);
-sdlFunctionPtr get_function(sdlBindingPtr sdl, char *function_name);
-
-void delete_sdl(void *handle);
-void delete_binding(void *binding);
-void delete_sdl_soap_binding_function_body(sdlSoapBindingFunctionBody body);
-void delete_function(void *function);
-void delete_paramater(void *paramater);
-void delete_service(void *service);
-void delete_http_socket(void *handle);
-void delete_url(void *handle);
-void delete_mapping(void *data);
-
-void soap_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
-zval soap_get_property_handler(zend_property_reference *property_reference);
-int soap_set_property_handler(zend_property_reference *property_reference, zval *value);
-void soap_destructor(void *jobject);
-
-void deseralize_function_call(sdlPtr sdl, xmlDocPtr request, zval *function_name, int *num_params, zval **parameters[] TSRMLS_DC);
-xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_name,char *uri,zval *ret TSRMLS_DC);
-xmlDocPtr seralize_function_call(zval *this_ptr, sdlFunctionPtr function, char *function_name, char *uri, zval **arguments, int arg_count TSRMLS_DC);
-xmlNodePtr seralize_parameter(sdlParamPtr param,zval *param_val,int index,char *name, int style TSRMLS_DC);
-xmlNodePtr seralize_zval(zval *val, sdlParamPtr param, char *paramName, int style TSRMLS_DC);
-zval *desearlize_zval(sdlPtr sdl, xmlNodePtr data, sdlParamPtr param TSRMLS_DC);
-
-void soap_error_handler(int error_num, const char *error_filename, const uint error_lineno, const char *format, va_list args);
-#ifndef ZEND_ENGINE_2
-int my_call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[] TSRMLS_DC);
-#endif
-
-#define phpext_soap_ptr soap_module_ptr
-
-#define HTTP_RAW_POST_DATA "HTTP_RAW_POST_DATA"
-
-#define SOAP_SERVER_BEGIN_CODE() \
- zend_error_cb = soap_error_handler
-
-#define SOAP_SERVER_END_CODE() \
- zend_error_cb = old_handler
-
-
-#define FOREACHATTRNODE(n,c,i) \
- do \
- { \
- if(n == NULL) \
- break; \
- if(c) \
- i = get_attribute(n,c); \
- else \
- i = n; \
- if(i != NULL) \
- { \
- n = i;
-
-#define FOREACHNODE(n,c,i) \
- do \
- { \
- if(n == NULL) \
- break; \
- if(c) \
- i = get_node(n,c); \
- else \
- i = n; \
- if(i != NULL) \
- { \
- n = i;
-
-#define ENDFOREACH(n) \
- } \
- } while ((n = n->next));
-
-#define ZERO_PARAM() \
- if(ZEND_NUM_ARGS() != 0) \
- WRONG_PARAM_COUNT;
-
-#define ONE_PARAM(p) \
- if(ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &p) == FAILURE) \
- WRONG_PARAM_COUNT;
-
-#define TWO_PARAM(p,p1) \
- if(ZEND_NUM_ARGS() != 1 || getParameters(ht, 2, &p, &p1) == FAILURE) \
- WRONG_PARAM_COUNT;
-
-#define THREE_PARAM(p,p1,p2) \
- if(ZEND_NUM_ARGS() != 1 || getParameters(ht, 3, &p, &p1, &p2) == FAILURE) \
- WRONG_PARAM_COUNT;
-
-#define FETCH_THIS_PORT(ss) \
- { \
- zval *__thisObj; zval *__port; sdlBindingPtr *__tmp; \
- GET_THIS_OBJECT(__thisObj) \
- if(FIND_PORT_PROPERTY(__thisObj, __port) == FAILURE) { \
- ss = NULL; \
- php_error(E_ERROR, "Error could find current port"); \
- } \
- __tmp = (sdlBindingPtr*)Z_LVAL_P(__port); \
- ss = *__tmp; \
- }
-
-#define FIND_PORT_PROPERTY(ss,tmp) zend_hash_find(Z_OBJPROP_P(ss), "port", sizeof("port"), (void **)&tmp)
-
-#define FETCH_THIS_SDL(ss) \
- { \
- zval *__thisObj,**__tmp; \
- GET_THIS_OBJECT(__thisObj) \
- if(FIND_SDL_PROPERTY(__thisObj,__tmp) != FAILURE) \
- { \
- FETCH_SDL_RES(ss,__tmp); \
- } \
- else \
- ss = NULL; \
- }
-
-#define FIND_SDL_PROPERTY(ss,tmp) zend_hash_find(Z_OBJPROP_P(ss), "sdl", sizeof("sdl"), (void **)&tmp)
-#define FETCH_SDL_RES(ss,tmp) ss = (sdlPtr) zend_fetch_resource(tmp TSRMLS_CC, -1, "sdl", NULL, 1, le_sdl)
-
-#define FETCH_THIS_SERVICE(ss) \
- { \
- zval *__thisObj,**__tmp; \
- GET_THIS_OBJECT(__thisObj) \
- if(FIND_SERVICE_PROPERTY(__thisObj,__tmp) != FAILURE) \
- { \
- FETCH_SERVICE_RES(ss,__tmp); \
- } \
- else \
- ss = NULL; \
- }
-
-#define FIND_SERVICE_PROPERTY(ss,tmp) zend_hash_find(Z_OBJPROP_P(ss), "service", sizeof("service"), (void **)&tmp)
-#define FETCH_SERVICE_RES(ss,tmp) ss = (soapServicePtr) zend_fetch_resource(tmp TSRMLS_CC, -1, "service", NULL, 1, le_service)
-
-#define FETCH_THIS_URL(ss) \
- { \
- zval *__thisObj,**__tmp; \
- GET_THIS_OBJECT(__thisObj) \
- if(FIND_URL_PROPERTY(__thisObj,__tmp) != FAILURE) \
- { \
- FETCH_URL_RES(ss,__tmp); \
- } \
- else \
- ss = NULL; \
- }
-
-#define FIND_URL_PROPERTY(ss,tmp) zend_hash_find(Z_OBJPROP_P(ss), "httpurl", sizeof("httpurl"), (void **)&tmp)
-#define FETCH_URL_RES(ss,tmp) ss = (php_url *) zend_fetch_resource(tmp TSRMLS_CC, -1, "httpurl", NULL, 1, le_url)
-
-#define FETCH_THIS_SOCKET(ss) \
- { \
- zval *__thisObj,**__tmp; \
- GET_THIS_OBJECT(__thisObj) \
- if(FIND_SOCKET_PROPERTY(__thisObj,__tmp) != FAILURE) \
- { \
- FETCH_SOCKET_RES(ss,__tmp); \
- } \
- else \
- ss = NULL; \
- }
-
-#define FIND_SOCKET_PROPERTY(ss,tmp) zend_hash_find(Z_OBJPROP_P(ss), "httpsocket", sizeof("httpsocket"), (void **)&tmp)
-#define FETCH_SOCKET_RES(ss,tmp) php_stream_from_zval_no_verify(ss,tmp)
-
-#define GET_THIS_OBJECT(o) \
- o = getThis(); \
- if (!o) \
- { \
- php_error(E_WARNING, "Cannot Get Class Info"); \
- return; \
- }
-
-
-#endif
diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c
deleted file mode 100644
index 786ebc97a5..0000000000
--- a/ext/soap/php_xml.c
+++ /dev/null
@@ -1,242 +0,0 @@
-#include "php_soap.h"
-
-/* Channel libxml file io layer through the PHP streams subsystem.
- * This allows use of ftps:// and https:// urls */
-
-int php_stream_xmlIO_match_wrapper(const char *filename)
-{
- TSRMLS_FETCH();
- return php_stream_locate_url_wrapper(filename, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) ? 1 : 0;
-
-}
-
-void *php_stream_xmlIO_open_wrapper(const char *filename)
-{
- TSRMLS_FETCH();
- return php_stream_open_wrapper(filename, "rb", ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
-}
-
-int php_stream_xmlIO_read(void *context, char *buffer, int len)
-{
- TSRMLS_FETCH();
- return php_stream_read((php_stream*)context, buffer, len);
-}
-
-int php_stream_xmlIO_close(void *context)
-{
- TSRMLS_FETCH();
- return php_stream_close((php_stream*)context);
-}
-
-xmlNsPtr attr_find_ns(xmlAttrPtr node)
-{
- if(node->ns)
- return node->ns;
- else if(node->parent->ns)
- return node->parent->ns;
- else
- return xmlSearchNs(node->doc, node->parent, NULL);
-}
-
-xmlNsPtr node_find_ns(xmlNodePtr node)
-{
- if(node->ns)
- return node->ns;
- else
- return xmlSearchNs(node->doc, node, NULL);
-}
-
-int attr_is_equal_ex(xmlAttrPtr node, char *name, char *ns)
-{
- if(!strcmp(node->name, name))
- {
- if(ns)
- {
- xmlNsPtr nsPtr;
- if(node->ns)
- nsPtr = node->ns;
- else if(node->parent->ns)
- nsPtr = node->parent->ns;
- else
- nsPtr = xmlSearchNs(node->doc, node->parent, NULL);
- if(!strcmp(nsPtr->href, ns))
- return TRUE;
- return FALSE;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-int node_is_equal_ex(xmlNodePtr node, char *name, char *ns)
-{
- if(!strcmp(node->name, name))
- {
- if(ns)
- {
- xmlNsPtr nsPtr;
- if(node->ns)
- nsPtr = node->ns;
- else
- nsPtr = xmlSearchNs(node->doc, node, NULL);
- if(!strcmp(nsPtr->href, ns))
- return TRUE;
- return FALSE;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-xmlAttrPtr get_attribute_ex(xmlAttrPtr node, char *name, char *ns)
-{
- xmlAttrPtr trav = node;
- if(node == NULL) return NULL;
- do {
- if(attr_is_equal_ex(trav, name, ns))
- return trav;
- } while(trav = trav->next);
- return NULL;
-}
-
-xmlNodePtr get_node_ex(xmlNodePtr node, char *name, char *ns)
-{
- xmlNodePtr trav = node;
- if(node == NULL) return NULL;
- do {
- if(node_is_equal_ex(trav, name, ns))
- return trav;
- } while(trav = trav->next);
- return NULL;
-}
-
-xmlNodePtr get_node_recurisve_ex(xmlNodePtr node, char *name, char *ns)
-{
- xmlNodePtr trav = node;
- if(node == NULL) return NULL;
- do
- {
- if(node_is_equal_ex(trav, name, ns))
- return trav;
- else
- {
- if(node->children != NULL)
- {
- xmlNodePtr tmp;
- tmp = get_node_recurisve_ex(node->children, name, ns);
- if(tmp)
- return tmp;
- }
- }
- } while(trav = trav->next);
- return NULL;
-}
-
-xmlNodePtr get_node_with_attribute_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns)
-{
- xmlNodePtr trav = node, cur = NULL;
- xmlAttrPtr attr;
-
- if(node == NULL) return NULL;
- do
- {
- if(name != NULL)
- {
- cur = get_node_ex(trav, name, name_ns);
- if(!cur)
- return cur;
- }
- else
- cur = trav;
-
- attr = get_attribute_ex(cur->properties, attribute, attr_ns);
- if(attr != NULL && strcmp(attr->children->content, value) == 0)
- return cur;
- else
- {
- if(cur->children != NULL)
- {
- xmlNodePtr tmp;
- tmp = get_node_with_attribute_ex(cur->children, name, name_ns, attribute, value, attr_ns);
- if(tmp)
- return tmp;
- }
- }
- }while(trav = trav->next);
- return NULL;
-}
-
-xmlNodePtr get_node_with_attribute_recursive_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns)
-{
- xmlNodePtr trav = node, cur;
- xmlAttrPtr attr;
-
- if(node == NULL) return NULL;
- do
- {
- if(name != NULL)
- {
- cur = get_node_recurisve_ex(trav, name, name_ns);
- if(!cur)
- return cur;
- }
- else
- cur = trav;
-
- attr = get_attribute_ex(cur->properties, attribute, attr_ns);
- if(attr != NULL && strcmp(attr->children->content, value) == 0)
- return cur;
- else
- {
- if(cur->children != NULL)
- {
- xmlNodePtr tmp;
- tmp = get_node_with_attribute_recursive_ex(cur->children, name, name_ns, attribute, value, attr_ns);
- if(tmp)
- return tmp;
- }
- }
- }while(trav = trav->next);
- return NULL;
-}
-
-xmlNodePtr check_and_resolve_href(xmlNodePtr data)
-{
- xmlAttrPtr href;
- xmlNodePtr ret = data;
-
- if(!data || !data->properties)
- return ret;
-
- href = get_attribute(data->properties, "href");
- if(href)
- {
- /* Internal href try and find node */
- if(href->children->content[0] == '#')
- {
- ret = get_node_with_attribute_recursive(data->doc->children, NULL, "id", &href->children->content[1]);
- }
- /* External href....? */
- }
-
- return ret;
-}
-
-int parse_namespace(char *inval, char **value, char **namespace)
-{
- char *found = strchr(inval, ':');
-
- if(found != NULL)
- {
- (*namespace) = estrndup(inval, found - inval);
- (*value) = estrdup(++found);
- }
- else
- {
- (*value) = estrdup(inval);
- (*namespace) = NULL;
- }
-
- return FALSE;
-}
-
diff --git a/ext/soap/php_xml.h b/ext/soap/php_xml.h
deleted file mode 100644
index 461bf9dd97..0000000000
--- a/ext/soap/php_xml.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef PHP_SOAP_XML_H
-#define PHP_SOAP_XML_H
-
-#define get_attribute(node, name) get_attribute_ex(node, name, NULL)
-#define get_node(node, name) get_node_ex(node, name, NULL)
-#define get_node_recursive(node, name) get_node_recursive_ex(node, name, NULL)
-#define get_node_with_attribute(node, name, attr, val) get_node_with_attribute_ex(node, name, NULL, attr, val, NULL)
-#define get_node_with_attribute_recursive(node, name, attr, val) get_node_with_attribute_recursive_ex(node, name, NULL, attr, val, NULL)
-#define attr_is_equal(node, name) attr_is_equal_ex(node, name, NULL)
-
-xmlNsPtr attr_find_ns(xmlAttrPtr node);
-xmlNsPtr node_find_ns(xmlNodePtr node);
-int attr_is_equal_ex(xmlAttrPtr node, char *name, char *ns);
-int node_is_equal_ex(xmlNodePtr node, char *name, char *ns);
-xmlAttrPtr get_attribute_ex(xmlAttrPtr node,char *name, char *ns);
-xmlNodePtr get_node_ex(xmlNodePtr node,char *name, char *ns);
-xmlNodePtr get_node_recurisve_ex(xmlNodePtr node,char *name, char *ns);
-xmlNodePtr get_node_with_attribute_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns);
-xmlNodePtr get_node_with_attribute_recursive_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns);
-int parse_namespace(char *inval,char **value,char **namespace);
-xmlNodePtr check_and_resolve_href(xmlNodePtr data);
-
-int php_stream_xmlIO_match_wrapper(const char *filename);
-void *php_stream_xmlIO_open_wrapper(const char *filename);
-int php_stream_xmlIO_read(void *context, char *buffer, int len);
-int php_stream_xmlIO_close(void *context);
-
-#endif
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
deleted file mode 100644
index a349503d86..0000000000
--- a/ext/soap/soap.c
+++ /dev/null
@@ -1,2309 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "php_soap.h"
-
-int le_sdl = 0;
-int le_url = 0;
-int le_service = 0;
-
-/* Local functions */
-static void function_to_string(sdlFunctionPtr function, smart_str *buf);
-static void type_to_string(sdlTypePtr type, smart_str *buf, int level);
-
-static zend_class_entry soap_class_entry;
-static zend_class_entry soap_server_class_entry;
-static zend_class_entry soap_fault_class_entry;
-zend_class_entry soap_var_class_entry;
-zend_class_entry soap_param_class_entry;
-
-ZEND_DECLARE_MODULE_GLOBALS(soap);
-
-static void (*old_handler)(int, const char *, const uint, const char*, va_list);
-
-static zend_function_entry soap_functions[] = {
-#ifdef HAVE_PHP_DOMXML
- PHP_FE(soap_encode_to_xml, NULL)
- PHP_FE(soap_encode_to_zval, NULL)
-#endif
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry soap_fault_functions[] = {
- PHP_FE(soapfault, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry soap_server_functions[] = {
- PHP_FE(soapserver,NULL)
- PHP_FE(setpersistence,NULL)
- PHP_FE(setclass,NULL)
- PHP_FE(addfunction,NULL)
- PHP_FE(getfunctions,NULL)
- PHP_FE(handle,NULL)
- PHP_FE(bind,NULL)
-#ifdef HAVE_PHP_DOMXML
- PHP_FE(map, NULL)
-#endif
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry soap_client_functions[] = {
- PHP_FE(soapobject, NULL)
- PHP_FE(__isfault, NULL)
- PHP_FE(__getfault, NULL)
- PHP_FE(__use, NULL)
- PHP_FE(__style, NULL)
- PHP_FE(__call, NULL)
- PHP_FE(__parse, NULL)
- PHP_FE(__generate, NULL)
- PHP_FE(__trace, NULL)
- PHP_FE(__headerclass, NULL)
- PHP_FE(__headerfunction, NULL)
- PHP_FE(__getlastrequest, NULL)
- PHP_FE(__getlastresponse, NULL)
- PHP_FE(__getfunctions, NULL)
- PHP_FE(__gettypes, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry soap_var_functions[] = {
- PHP_FE(soapvar, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry soap_param_functions[] = {
- PHP_FE(soapparam, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry soap_module_entry = {
-#ifdef STANDARD_MODULE_HEADER
- STANDARD_MODULE_HEADER,
-#endif
- "soap",
- soap_functions,
- PHP_MINIT(soap),
- PHP_MSHUTDOWN(soap),
- NULL,
- NULL,
- PHP_MINFO(soap),
-#ifdef STANDARD_MODULE_HEADER
- NO_VERSION_YET,
-#endif
- STANDARD_MODULE_PROPERTIES,
-};
-
-#ifdef COMPILE_DL_SOAP
-ZEND_GET_MODULE(soap)
-#endif
-
-static void php_soap_init_globals(zend_soap_globals *soap_globals)
-{
- int i;
- long enc;
-
- soap_globals->sdls = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->sdls, 0, NULL, delete_sdl, 1);
-
- soap_globals->services = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->services, 0, NULL, delete_service, 1);
-
- soap_globals->defEnc = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEnc, 0, NULL, NULL, 1);
-
- soap_globals->defEncIndex = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEncIndex, 0, NULL, NULL, 1);
-
- soap_globals->defEncNs = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEncNs, 0, NULL, NULL, 1);
-
- soap_globals->defEncPrefix = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEncPrefix, 0, NULL, NULL, 1);
-
- soap_globals->overrides = NULL;
-
- i = 0;
- do
- {
- enc = (long)&defaultEncoding[i];
-
- /* If has a ns and a str_type then index it */
- if(defaultEncoding[i].details.type_str)
- {
- if(defaultEncoding[i].details.ns != NULL)
- {
- char *ns_type;
- ns_type = emalloc(strlen(defaultEncoding[i].details.ns) + strlen(defaultEncoding[i].details.type_str) + 2);
- sprintf(ns_type, "%s:%s", defaultEncoding[i].details.ns, defaultEncoding[i].details.type_str);
- zend_hash_add(soap_globals->defEnc, ns_type, strlen(ns_type) + 1, &enc, sizeof(encodePtr), NULL);
- efree(ns_type);
- }
- else
- {
- zend_hash_add(soap_globals->defEnc, defaultEncoding[i].details.type_str, strlen(defaultEncoding[i].details.type_str) + 1, &enc, sizeof(encodePtr), NULL);
- }
- }
- /* Index everything by number */
- zend_hash_index_update(soap_globals->defEncIndex, defaultEncoding[i].details.type, &enc, sizeof(encodePtr), NULL);
- i++;
- }
- while(defaultEncoding[i].details.type != END_KNOWN_TYPES);
-
- /* hash by namespace */
- zend_hash_add(soap_globals->defEncNs, XSD_1999_NAMESPACE, sizeof(XSD_1999_NAMESPACE), XSD_NS_PREFIX, sizeof(XSD_NS_PREFIX), NULL);
- zend_hash_add(soap_globals->defEncNs, XSD_NAMESPACE, sizeof(XSD_NAMESPACE), XSD_NS_PREFIX, sizeof(XSD_NS_PREFIX), NULL);
- zend_hash_add(soap_globals->defEncNs, APACHE_NAMESPACE, sizeof(APACHE_NAMESPACE), APACHE_NS_PREFIX, sizeof(APACHE_NS_PREFIX), NULL);
- zend_hash_add(soap_globals->defEncNs, SOAP_ENC_NAMESPACE, sizeof(SOAP_ENC_NAMESPACE), SOAP_ENC_NS_PREFIX, sizeof(SOAP_ENC_NS_PREFIX), NULL);
- /* and by prefix */
- zend_hash_add(soap_globals->defEncPrefix, XSD_NS_PREFIX, sizeof(XSD_NS_PREFIX), XSD_NAMESPACE, sizeof(XSD_NAMESPACE), NULL);
- zend_hash_add(soap_globals->defEncPrefix, APACHE_NS_PREFIX, sizeof(APACHE_NS_PREFIX), APACHE_NAMESPACE, sizeof(APACHE_NAMESPACE), NULL);
- zend_hash_add(soap_globals->defEncPrefix, SOAP_ENC_NS_PREFIX, sizeof(SOAP_ENC_NS_PREFIX), SOAP_ENC_NAMESPACE, sizeof(SOAP_ENC_NAMESPACE), NULL);
-
-}
-
-static void php_soap_del_globals(zend_soap_globals *soap_globals)
-{
-/* zend_hash_destroy(soap_globals->sdls);
- zend_hash_destroy(soap_globals->services);
- zend_hash_destroy(soap_globals->defEnc);
- zend_hash_destroy(soap_globals->defEncIndex);
- zend_hash_destroy(soap_globals->defEncNs);*/
-}
-
-PHP_MSHUTDOWN_FUNCTION(soap)
-{
- zend_hash_destroy(SOAP_GLOBAL(sdls));
- zend_hash_destroy(SOAP_GLOBAL(services));
- zend_hash_destroy(SOAP_GLOBAL(defEnc));
- zend_hash_destroy(SOAP_GLOBAL(defEncIndex));
- zend_hash_destroy(SOAP_GLOBAL(defEncNs));
- zend_hash_destroy(SOAP_GLOBAL(defEncPrefix));
- return SUCCESS;
-}
-
-PHP_MINIT_FUNCTION(soap)
-{
- /* TODO: add ini entry for always use soap errors */
- ZEND_INIT_MODULE_GLOBALS(soap, php_soap_init_globals, php_soap_del_globals);
-
- /* Enable php stream/wrapper support for libxml */
- xmlRegisterDefaultInputCallbacks();
- xmlRegisterInputCallbacks(php_stream_xmlIO_match_wrapper, php_stream_xmlIO_open_wrapper,
- php_stream_xmlIO_read, php_stream_xmlIO_close);
-
- /* Register SoapObject class */
- /* BIG NOTE : THIS EMITS AN COMPILATION WARNING UNDER ZE2 - handle_function_call deprecated.
- soap_call_function_handler should be of type struct _zend_function, not (*handle_function_call).
- */
- INIT_OVERLOADED_CLASS_ENTRY(soap_class_entry, PHP_SOAP_CLASSNAME, soap_client_functions, soap_call_function_handler, NULL, NULL);
- zend_register_internal_class(&soap_class_entry TSRMLS_CC);
-
- /* Register SoapVar class */
- INIT_CLASS_ENTRY(soap_var_class_entry, PHP_SOAP_VAR_CLASSNAME, soap_var_functions);
- zend_register_internal_class(&soap_var_class_entry TSRMLS_CC);
-
- /* Register SoapServer class */
- INIT_CLASS_ENTRY(soap_server_class_entry, PHP_SOAP_SERVER_CLASSNAME, soap_server_functions);
- zend_register_internal_class(&soap_server_class_entry TSRMLS_CC);
-
- /* Register SoapFault class */
- INIT_CLASS_ENTRY(soap_fault_class_entry, PHP_SOAP_FAULT_CLASSNAME, soap_fault_functions);
- zend_register_internal_class(&soap_fault_class_entry TSRMLS_CC);
-
- /* Register SoapParam class */
- INIT_CLASS_ENTRY(soap_param_class_entry, PHP_SOAP_PARAM_CLASSNAME, soap_param_functions);
- zend_register_internal_class(&soap_param_class_entry TSRMLS_CC);
-
- le_sdl = register_list_destructors(NULL, NULL);
- le_url = register_list_destructors(delete_url, NULL);
- le_service = register_list_destructors(delete_service, NULL);
-
- REGISTER_LONG_CONSTANT("SOAP_PERSISTENCE_SESSION", SOAP_PERSISTENCE_SESSION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_PERSISTENCE_REQUEST", SOAP_PERSISTENCE_REQUEST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_FUNCTIONS_ALL", SOAP_FUNCTIONS_ALL, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("SOAP_ENCODED", SOAP_ENCODED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_LITERAL", SOAP_LITERAL, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("SOAP_RPC", SOAP_RPC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_DOCUMENT", SOAP_DOCUMENT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("XSD_1999_TIMEINSTANT", XSD_1999_TIMEINSTANT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UNKNOWN_TYPE", UNKNOWN_TYPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_ENC_OBJECT", SOAP_ENC_OBJECT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_ENC_ARRAY", SOAP_ENC_ARRAY, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("XSD_STRING", XSD_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_BOOLEAN", XSD_BOOLEAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_DECIMAL", XSD_DECIMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_FLOAT", XSD_FLOAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_DOUBLE", XSD_DOUBLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_DURATION", XSD_DURATION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_DATETIME", XSD_DATETIME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_TIME", XSD_TIME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_DATE", XSD_DATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_GYEARMONTH", XSD_GYEARMONTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_GYEAR", XSD_GYEAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_GMONTHDAY", XSD_GMONTHDAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_GDAY", XSD_GDAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_GMONTH", XSD_GMONTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_HEXBINARY", XSD_HEXBINARY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_BASE64BINARY", XSD_BASE64BINARY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_ANYURI", XSD_ANYURI, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_QNAME", XSD_QNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NOTATION", XSD_NOTATION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NORMALIZEDSTRING", XSD_NORMALIZEDSTRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_TOKEN", XSD_TOKEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_LANGUAGE", XSD_LANGUAGE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NMTOKEN", XSD_NMTOKEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NAME", XSD_NAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NCNAME", XSD_NCNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_ID", XSD_ID, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_IDREF", XSD_IDREF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_IDREFS", XSD_IDREFS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_ENTITY", XSD_ENTITY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_ENTITYS", XSD_ENTITYS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_INTEGER", XSD_INTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NONPOSITIVEINTEGER", XSD_NONPOSITIVEINTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NEGATIVEINTEGER", XSD_NEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_LONG", XSD_LONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_INT", XSD_INT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_SHORT", XSD_SHORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_BYTE", XSD_BYTE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NONNEGATIVEINTEGER", XSD_NONNEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_UNSIGNEDLONG", XSD_UNSIGNEDLONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_UNSIGNEDINT", XSD_UNSIGNEDINT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_UNSIGNEDSHORT", XSD_UNSIGNEDSHORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_UNSIGNEDBYTE", XSD_UNSIGNEDBYTE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_POSITIVEINTEGER", XSD_POSITIVEINTEGER, CONST_CS | CONST_PERSISTENT);
-
- old_handler = zend_error_cb;
-
-#if HAVE_PHP_SESSION
- php_session_register_serializer("soap", PS_SERIALIZER_ENCODE_NAME(soap), PS_SERIALIZER_DECODE_NAME(soap));
-#endif
-
- return SUCCESS;
-}
-
-#if HAVE_PHP_SESSION
-PS_SERIALIZER_ENCODE_FUNC(soap)
-{
-/*
- char *key; \
- uint key_length; \
- ulong num_key; \
- zval **struc;
-
- wddx_packet *packet;
- PS_ENCODE_VARS;
-
- packet = php_wddx_constructor();
- if (!packet)
- return FAILURE;
-
- php_wddx_packet_start(packet, NULL, 0);
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
-
- PS_ENCODE_LOOP(
-
- php_wddx_serialize_var(packet, *struc, key, key_length);
- );
-
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
- php_wddx_packet_end(packet);
- *newstr = php_wddx_gather(packet);
- php_wddx_destructor(packet);
-
- if (newlen)
- *newlen = strlen(*newstr);
-*/
- return SUCCESS;
-}
-
-PS_SERIALIZER_DECODE_FUNC(soap)
-{
-/* zval *retval;
- zval **ent;
- char *key;
- uint key_length;
- char tmp[128];
- ulong idx;
- int hash_type;
- int ret;
- HashPosition pos;
-
- if (vallen == 0)
- return SUCCESS;
-
- MAKE_STD_ZVAL(retval);
-
- if ((ret = php_wddx_deserialize_ex((char *)val, vallen, retval)) == SUCCESS) {
-
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(retval), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_P(retval), (void **) &ent, &pos) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_P(retval), &pos)) {
- hash_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(retval), &key, &key_length, &idx, 0, &pos);
-
- switch (hash_type) {
- case HASH_KEY_IS_LONG:
- sprintf(tmp, "%ld", idx);
- key = tmp;
- case HASH_KEY_IS_STRING:
- php_set_session_var(key, key_length-1, *ent, NULL TSRMLS_CC);
- PS_ADD_VAR(key);
- }
- }
- }
-
- zval_ptr_dtor(&retval);
-*/
- return TRUE;
-}
-#endif
-
-
-PHP_MINFO_FUNCTION(soap)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Soap Client", "enabled");
- php_info_print_table_row(2, "Soap Server", "enabled");
-#if HAVE_PHP_SESSION
- php_info_print_table_row(2, "Soap Serializer", "enabled");
-#endif
- php_info_print_table_end();
-}
-
-#ifdef HAVE_PHP_DOMXML
-PHP_FUNCTION(soap_encode_to_xml)
-{
- zval *pzval, *ret;
- encodePtr enc;
- char *name;
- int found, name_len;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &name_len, &pzval) == FAILURE)
- php_error(E_ERROR, "wrong number of parameters to soap_encode_to_xml");
-
- enc = get_conversion(Z_TYPE_P(pzval));
- ret = php_domobject_new(seralize_zval(pzval, NULL, name, SOAP_ENCODED), &found, NULL TSRMLS_CC);
- *return_value = *ret;
- zval_copy_ctor(return_value);
- zval_ptr_dtor(&ret);
-}
-
-PHP_FUNCTION(soap_encode_to_zval)
-{
- zval *dom, **addr, *ret;
- xmlNodePtr node;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &dom) == FAILURE)
- php_error(E_ERROR, "wrong number of parameters to soap_encode_to_zval");
-
- if(zend_hash_index_find(Z_OBJPROP_P(dom), 1, (void **)&addr) == FAILURE)
- php_error(E_ERROR, "Cannot find domaddress to parameter passed to soap_encode_to_zval");
-
- node = (xmlNodePtr)Z_LVAL_PP(addr);
- ret = master_to_zval(get_conversion(UNKNOWN_TYPE), node);
- *return_value = *ret;
-}
-#endif
-
-/* SoapParam functions */
-PHP_FUNCTION(soapparam)
-{
- zval *thisObj, *data;
- char *name;
- int name_length;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &data, &name, &name_length) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapParam constructor");
-
- GET_THIS_OBJECT(thisObj);
-
- zval_add_ref(&data);
- add_property_stringl(thisObj, "param_name", name, name_length, 1);
- add_property_zval(thisObj, "param_data", data);
-}
-
-/* SoapFault functions */
-PHP_FUNCTION(soapfault)
-{
- char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL;
- int fault_string_len, fault_code_len, fault_actor_len;
- zval *thisObj, *details = NULL;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|zs", &fault_string, &fault_string_len,
- &fault_code, &fault_code_len, &details, &fault_actor, &fault_actor_len) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapFault constructor");
-
- GET_THIS_OBJECT(thisObj);
-
- if(details)
- zval_add_ref(&details);
- set_soap_fault(thisObj, fault_code, fault_string, fault_actor, details TSRMLS_CC);
-}
-
-/* SoapVar functions */
-PHP_FUNCTION(soapvar)
-{
- zval *data, *thisObj, *type;
- char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL;
- int stype_len, ns_len, name_len, namens_len;
-
- GET_THIS_OBJECT(thisObj);
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z!z|ssss", &data, &type, &stype, &stype_len, &ns, &ns_len, &name, &name_len, &namens, &namens_len) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapVal constructor");
-
- zval_add_ref(&data);
- if(Z_TYPE_P(type) == IS_NULL)
- add_property_long(thisObj, "enc_type", UNKNOWN_TYPE);
- else
- {
- if(zend_hash_index_exists(SOAP_GLOBAL(defEncIndex), Z_LVAL_P(type)))
- add_property_long(thisObj, "enc_type", Z_LVAL_P(type));
- else
- php_error(E_ERROR, "Cannot find encoding for SoapVar");
- }
-
- add_property_zval(thisObj, "enc_value", data);
-
- if(stype && strlen(stype) > 0)
- add_property_stringl(thisObj, "enc_stype", stype, stype_len, 1);
- if(ns && strlen(ns) > 0)
- add_property_stringl(thisObj, "enc_ns", ns, ns_len, 1);
- if(name && strlen(name) > 0)
- add_property_stringl(thisObj, "enc_name", name, name_len, 1);
- if(namens && strlen(namens) > 0)
- add_property_stringl(thisObj, "enc_namens", namens, namens_len, 1);
-}
-
-/* SoapServer functions */
-PHP_FUNCTION(soapserver)
-{
- zval *thisObj;
- soapServicePtr service;
- char *uri;
- int ret, uri_len;
-
- SOAP_SERVER_BEGIN_CODE();
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uri, &uri_len) == FAILURE)
- php_error(E_ERROR, "Wrong number of parameters to SoapServer constructor");
-
- GET_THIS_OBJECT(thisObj);
-
- service = emalloc(sizeof(soapService));
- memset(service, 0, sizeof(soapService));
-
- service->uri = estrndup(uri, uri_len);
- service->type = SOAP_FUNCTIONS;
- service->soap_functions.functions_all = FALSE;
- service->soap_functions.ft = emalloc(sizeof(HashTable));
- zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- ret = zend_list_insert(service, le_service);
- add_property_resource(thisObj, "service", ret);
- zend_list_addref(ret);
-
- SOAP_SERVER_END_CODE();
-}
-
-#define NULL_OR_STRING(zval) \
- (!zval || Z_TYPE_P(zval) == IS_NULL || Z_TYPE_P(zval) == IS_STRING)
-
-#define IS_VALID_FUNCTION(zval) \
- (zval && Z_TYPE_P(zval) != IS_NULL)
-
-#ifdef HAVE_PHP_DOMXML
-PHP_FUNCTION(map)
-{
- char *type, *class_name;
- zval *to_xml_before = NULL, *to_xml = NULL, *to_xml_after = NULL,
- *to_zval_before = NULL, *to_zval = NULL, *to_zval_after = NULL;
- int type_len, class_name_len;
- char *ns, *ctype;
- soapServicePtr service;
-
- SOAP_SERVER_BEGIN_CODE();
-
- if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sz|zzzzz",
- &type, &type_len, &to_xml_before, &to_xml, &to_xml_after, &to_zval_before, &to_zval,
- &to_zval_after) == SUCCESS && NULL_OR_STRING(to_xml_before) && NULL_OR_STRING(to_xml) &&
- NULL_OR_STRING(to_xml_after) && NULL_OR_STRING(to_zval_before) && NULL_OR_STRING(to_zval) &&
- NULL_OR_STRING(to_zval_after))
- {
- soapMappingPtr map;
- encodePtr enc, new_enc;
- smart_str resloved_ns = {0};
-
- FETCH_THIS_SERVICE(service);
-
- new_enc = malloc(sizeof(encode));
- memset(new_enc, 0, sizeof(encode));
-
- ctype = strrchr(type, ':');
- if(ctype) {
- smart_str_appendl(&resloved_ns, type, ctype - type);
- smart_str_0(&resloved_ns);
- ctype++;
- } else {
- ns = NULL;
- }
-
- if(ns)
- {
- if(zend_hash_find(SOAP_GLOBAL(defEncPrefix), resloved_ns.c, resloved_ns.len + 1, &ns) == SUCCESS)
- {
- enc = get_encoder(service->sdl, ns, ctype);
- smart_str_free(&resloved_ns);
- smart_str_appendl(&resloved_ns, ns, strlen(ns));
- smart_str_appendc(&resloved_ns, ':');
- smart_str_appendl(&resloved_ns, ctype, strlen(ctype));
- smart_str_0(&resloved_ns);
- type = resloved_ns.c;
- type_len = resloved_ns.len;
- }
- else
- enc = get_encoder_ex(service->sdl, type);
- }
- else
- enc = get_encoder_ex(service->sdl, type);
-
- new_enc->details.type = enc->details.type;
- new_enc->details.ns = strdup(enc->details.ns);
- new_enc->details.type_str = strdup(enc->details.type_str);
- new_enc->details.sdl_type = enc->details.sdl_type;
- new_enc->to_xml = enc->to_xml;
- new_enc->to_zval = enc->to_zval;
- new_enc->to_xml_before = enc->to_xml_before;
- new_enc->to_zval_before = enc->to_zval_before;
- new_enc->to_xml_after = enc->to_xml_after;
- new_enc->to_zval_after = enc->to_zval_after;
-
- map = emalloc(sizeof(soapMapping));
- memset(map, 0, sizeof(soapMapping));
-
- map->type = SOAP_MAP_FUNCTION;
- if(IS_VALID_FUNCTION(to_xml_before))
- {
- zval_add_ref(&to_xml_before);
- map->map_functions.to_xml_before = to_xml_before;
- new_enc->to_xml_before = to_xml_before_user;
- }
- if(IS_VALID_FUNCTION(to_xml))
- {
- zval_add_ref(&to_xml);
- map->map_functions.to_xml = to_xml;
- new_enc->to_xml = to_xml_user;
- }
- if(IS_VALID_FUNCTION(to_xml_after))
- {
- zval_add_ref(&to_xml_after);
- map->map_functions.to_xml_after = to_xml_after;
- new_enc->to_xml_after = to_xml_after_user;
- }
- if(IS_VALID_FUNCTION(to_zval_before))
- {
- zval_add_ref(&to_zval_before);
- map->map_functions.to_zval_before = to_zval_before;
- new_enc->to_zval_before = to_zval_before_user;
- }
- if(IS_VALID_FUNCTION(to_zval))
- {
- zval_add_ref(&to_zval);
- map->map_functions.to_zval = to_zval;
- new_enc->to_zval = to_zval_user;
- }
- if(IS_VALID_FUNCTION(to_zval_after))
- {
- zval_add_ref(&to_zval_after);
- map->map_functions.to_zval_after = to_zval_after;
- new_enc->to_zval_after = to_zval_after_user;
- }
-
- new_enc->details.map = map;
-
- if(!service->mapping)
- {
- service->mapping = emalloc(sizeof(HashTable));
- zend_hash_init(service->mapping, 0, NULL, delete_encoder, 0);
- }
- zend_hash_update(service->mapping, type, type_len + 1, &new_enc, sizeof(encodePtr), NULL);
- smart_str_free(&resloved_ns);
- }
- else if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &type, &type_len, &class_name, &class_name_len, &type) == SUCCESS)
- {
- }
- else
- php_error(E_ERROR, "Wrong number of parameters to SoapServer->map");
-}
-#endif
-
-PHP_FUNCTION(bind)
-{
- char *wsdl;
- int wsdl_len;
- soapServicePtr service;
-
- SOAP_SERVER_BEGIN_CODE();
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &wsdl, &wsdl_len) == FAILURE)
- php_error(E_ERROR, "Wrong number of parameters to SoapServer->bind");
-
- FETCH_THIS_SERVICE(service);
- service->sdl = get_sdl(wsdl);
-
- SOAP_SERVER_END_CODE();
-}
-
-PHP_FUNCTION(setpersistence)
-{
- soapServicePtr service;
- int value;
-
- SOAP_SERVER_BEGIN_CODE();
- FETCH_THIS_SERVICE(service);
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) != FAILURE)
- {
- if(service->type == SOAP_CLASS)
- {
- if(value == SOAP_PERSISTENCE_SESSION ||
- value == SOAP_PERSISTENCE_REQUEST)
- service->soap_class.persistance = value;
- else
- php_error(E_ERROR, "Tried to set persistence with bogus value (%ld)", value);
- }
- else
- php_error(E_ERROR, "Tried to set persistence when you are using you SOAP SERVER in function mode, no persistence needed");
- }
-
- SOAP_SERVER_END_CODE();
-}
-
-PHP_FUNCTION(setclass)
-{
- soapServicePtr service;
- zend_class_entry *ce;
- char *class_name = NULL;
- int found, argc;
- zval ***argv;
-
- SOAP_SERVER_BEGIN_CODE();
-
- FETCH_THIS_SERVICE(service);
-
- argc = ZEND_NUM_ARGS();
- argv = emalloc(argc * sizeof(zval **));
-
- if (argc < 1 || zend_get_parameters_array_ex(argc, argv) == FAILURE)
- {
- efree(argv);
- WRONG_PARAM_COUNT;
- }
-
- if(Z_TYPE_PP(argv[0]) == IS_STRING)
- {
- class_name = estrdup(Z_STRVAL_PP(argv[0]));
-
- found = zend_hash_find(EG(class_table), php_strtolower(class_name, Z_STRLEN_PP(argv[0])), Z_STRLEN_PP(argv[0]) + 1, (void **)&ce);
- efree(class_name);
- if(found != FAILURE)
- {
- service->type = SOAP_CLASS;
- service->soap_class.ce = ce;
- service->soap_class.persistance = SOAP_PERSISTENCE_REQUEST;
- service->soap_class.argc = argc - 1;
- if(service->soap_class.argc > 0)
- {
- int i;
- service->soap_class.argv = emalloc(sizeof(zval) * service->soap_class.argc);
- for(i = 0;i < service->soap_class.argc;i++)
- {
- service->soap_class.argv[i] = *(argv[i + 1]);
- zval_add_ref(&service->soap_class.argv[i]);
- }
- }
- }
- else
- php_error(E_ERROR, "Tried to set a non existant class (%s)", Z_STRVAL_PP(argv[0]));
- }
- else
- php_error(E_ERROR, "You must pass in a string to setclass");
-
- efree(argv);
- SOAP_SERVER_END_CODE();
-}
-
-PHP_FUNCTION(getfunctions)
-{
- soapServicePtr service;
- HashPosition pos;
-
- SOAP_SERVER_BEGIN_CODE();
-
- FETCH_THIS_SERVICE(service);
-
- array_init(return_value);
- if(service->type == SOAP_CLASS)
- {
- zend_function *f;
- zend_hash_internal_pointer_reset_ex(&service->soap_class.ce->function_table, &pos);
- while(zend_hash_get_current_data_ex(&service->soap_class.ce->function_table, (void **)&f, &pos) != FAILURE)
- {
- add_next_index_string(return_value, f->common.function_name, 1);
- zend_hash_move_forward_ex(&service->soap_class.ce->function_table, &pos);
- }
- }
- else if(service->soap_functions.functions_all == TRUE)
- {
- zend_function *f;
- zend_hash_internal_pointer_reset_ex(EG(function_table), &pos);
- while(zend_hash_get_current_data_ex(EG(function_table), (void **)&f, &pos) != FAILURE)
- {
- add_next_index_string(return_value, f->common.function_name, 1);
- zend_hash_move_forward_ex(EG(function_table), &pos);
- }
- }
- else if(service->soap_functions.ft != NULL)
- zend_hash_copy(Z_ARRVAL_P(return_value), service->soap_functions.ft, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
-
- SOAP_SERVER_END_CODE();
-}
-
-PHP_FUNCTION(addfunction)
-{
- soapServicePtr service;
- zval *function_name, *function_copy;
- HashPosition pos;
-
- SOAP_SERVER_BEGIN_CODE();
-
- FETCH_THIS_SERVICE(service);
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &function_name) == FAILURE)
- php_error(E_ERROR, "Invalid parameters passed to addfunction");
-
- /* TODO: could use zend_is_callable here */
-
- if(function_name->type == IS_ARRAY)
- {
- if(service->type == SOAP_FUNCTIONS)
- {
- zval **tmp_function, *function_copy;
-
- if(service->soap_functions.ft == NULL)
- {
- service->soap_functions.ft = emalloc(sizeof(HashTable));
- zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0);
- }
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(function_name), &pos);
- while(zend_hash_get_current_data_ex(Z_ARRVAL_P(function_name), (void **)&tmp_function, &pos) != FAILURE)
- {
- if(Z_TYPE_PP(tmp_function) != IS_STRING)
- php_error(E_ERROR, "Tried to add a function that isn't a string");
-
- MAKE_STD_ZVAL(function_copy);
- *function_copy = *(*tmp_function);
- zval_copy_ctor(function_copy);
-
- php_strtolower(Z_STRVAL_P(function_copy), Z_STRLEN_P(function_copy));
-
- if(zend_hash_exists(EG(function_table), Z_STRVAL_P(function_copy), Z_STRLEN_P(function_copy) + 1) == FALSE)
- php_error(E_ERROR, "Tried to add a non existant function (\"%s\")", Z_STRVAL_PP(tmp_function));
-
- zend_hash_update(service->soap_functions.ft, Z_STRVAL_P(function_copy), Z_STRLEN_P(function_copy) + 1, &function_copy, sizeof(zval *), NULL);
- zend_hash_move_forward_ex(Z_ARRVAL_P(function_name), &pos);
- }
- }
- }
- else if(function_name->type == IS_STRING)
- {
- MAKE_STD_ZVAL(function_copy);
- *function_copy = *function_name;
- zval_copy_ctor(function_copy);
-
- php_strtolower(Z_STRVAL_P(function_copy), Z_STRLEN_P(function_copy));
-
- if(zend_hash_exists(EG(function_table), Z_STRVAL_P(function_copy), Z_STRLEN_P(function_copy) + 1) == FALSE)
- php_error(E_ERROR, "Tried to add a non existant function (\"%s\")", Z_STRVAL_P(function_name));
- if(service->soap_functions.ft == NULL)
- {
- service->soap_functions.functions_all = FALSE;
- service->soap_functions.ft = emalloc(sizeof(HashTable));
- zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0);
- }
-
- zend_hash_update(service->soap_functions.ft, Z_STRVAL_P(function_copy), Z_STRLEN_P(function_copy) + 1, &function_copy, sizeof(zval *), NULL);
- }
- else if(function_name->type == IS_LONG)
- {
- if(Z_LVAL_P(function_name) == SOAP_FUNCTIONS_ALL)
- {
- if(service->soap_functions.ft != NULL)
- {
- zend_hash_destroy(service->soap_functions.ft);
- efree(service->soap_functions.ft);
- service->soap_functions.ft = NULL;
- }
- service->soap_functions.functions_all = TRUE;
- }
- else
- php_error(E_ERROR, "Invalid value passed to addfunction (%ld)", Z_LVAL_P(function_name));
- }
-
- SOAP_SERVER_END_CODE();
-}
-
-PHP_FUNCTION(handle)
-{
- soapServicePtr service;
- xmlDocPtr doc_request, doc_return;
- zval function_name, **params, **raw_post, *soap_obj, retval, **server_vars;
- char *fn_name, cont_len[30], *response_name;
- int num_params = 0, size, i, call_status;
- xmlChar *buf;
- HashTable *function_table;
-
- FETCH_THIS_SERVICE(service);
-
- SOAP_SERVER_BEGIN_CODE();
- ZERO_PARAM();
-
- INIT_ZVAL(retval);
-
- if(zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **)&server_vars) == SUCCESS)
- {
- zval **req_method, **query_string;
- if(zend_hash_find(Z_ARRVAL_PP(server_vars), "REQUEST_METHOD", sizeof("REQUEST_METHOD"), (void **)&req_method) == SUCCESS)
- {
- if(!strcmp(Z_STRVAL_PP(req_method), "GET") && zend_hash_find(Z_ARRVAL_PP(server_vars), "QUERY_STRING", sizeof("QUERY_STRING"), (void **)&query_string) == SUCCESS)
- {
- if(!strcmp(Z_STRVAL_PP(query_string), "WSDL"))
- {
- if(service->sdl)
- {
- zval readfile, readfile_ret, *param;
-
- INIT_ZVAL(readfile);
- INIT_ZVAL(readfile_ret);
- MAKE_STD_ZVAL(param);
-
- sapi_add_header("Content-Type: text/xml", sizeof("Content-Type: text/xml"), 1);
- ZVAL_STRING(param, service->sdl->source, 1);
- ZVAL_STRING(&readfile, "readfile", 1);
- if(call_user_function(EG(function_table), NULL, &readfile, &readfile_ret, 1, &param TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Couldn't find WSDL");
-
- zval_ptr_dtor(&param);
- zval_dtor(&readfile);
- zval_dtor(&readfile_ret);
- SOAP_SERVER_END_CODE();
- return;
- }
- }
- }
- }
- }
-
-/* Turn on output buffering... we don't want people print in their methods
- #if PHP_API_VERSION <= 20010901
- if(php_start_ob_buffer(NULL, 0 TSRMLS_CC) != SUCCESS)
- #else
-*/
- if(php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC) != SUCCESS)
-/* #endif */
- php_error(E_ERROR,"ob_start failed");
-
- if (zend_hash_find(&EG(symbol_table), HTTP_RAW_POST_DATA, sizeof(HTTP_RAW_POST_DATA), (void **) &raw_post)!=FAILURE
- && ((*raw_post)->type==IS_STRING))
- {
- doc_request = xmlParseMemory(Z_STRVAL_PP(raw_post),Z_STRLEN_PP(raw_post));
- xmlCleanupParser();
-
- deseralize_function_call(service->sdl, doc_request, &function_name, &num_params, &params TSRMLS_CC);
- xmlFreeDoc(doc_request);
-
- fn_name = estrndup(Z_STRVAL(function_name),Z_STRLEN(function_name));
- response_name = emalloc(Z_STRLEN(function_name) + strlen("Response") + 1);
- sprintf(response_name,"%sResponse",fn_name);
-
- if(service->type == SOAP_CLASS)
- {
- soap_obj = NULL;
- /* If persistent then set soap_obj from from the previous created session (if available) */
- if(service->soap_class.persistance == SOAP_PERSISTENCE_SESSION)
- {
- zval **tmp_soap;
-
- /*
- Try and call session regiser for our dummy session object
- The only reason that i use call_user_function is that
- their isn't a way to start the session from an extension
- so calling session_register will both register the var
- and start the session
- */
- {
- zval *bogus_session_name, session_register, sess_retval;
-
- INIT_ZVAL(session_register);
- INIT_ZVAL(sess_retval);
-
- if(!zend_ini_long("register_globals", sizeof("register_globals"), 0))
- php_error(E_ERROR, "PHP-SOAP requires 'register_globals' to be on when using persistent objects please check your php.ini file");
-
- MAKE_STD_ZVAL(bogus_session_name);
-
- ZVAL_STRING(bogus_session_name, "_bogus_session_name", 1);
- ZVAL_STRING(&session_register, "session_register", 1);
-
- if(call_user_function(EG(function_table), NULL, &session_register, &sess_retval, 1, &bogus_session_name TSRMLS_CC) == FAILURE)
- php_error(E_ERROR,"session_register failed");
-
- zval_ptr_dtor(&bogus_session_name);
- zval_dtor(&session_register);
- zval_dtor(&sess_retval);
- }
-
- /* Find the soap object and assign */
- if(zend_hash_find(&EG(symbol_table), "_bogus_session_name", sizeof("_bogus_session_name"), (void **) &tmp_soap) == SUCCESS)
- soap_obj = *tmp_soap;
- }
-
- /* If new session or something wierd happned */
- if(soap_obj == NULL)
- {
- zval *tmp_soap;
- MAKE_STD_ZVAL(tmp_soap);
- object_init_ex(tmp_soap, service->soap_class.ce);
-
- /* Call constructor */
- if(zend_hash_exists(&Z_OBJCE_P(tmp_soap)->function_table, service->soap_class.ce->name, strlen(service->soap_class.ce->name) + 1))
- {
- zval c_ret, constructor;
-
- INIT_ZVAL(c_ret);
- INIT_ZVAL(constructor);
-
- ZVAL_STRING(&constructor, service->soap_class.ce->name, 1);
- if(call_user_function(NULL, &tmp_soap, &constructor, &c_ret, service->soap_class.argc, service->soap_class.argv TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Error calling constructor");
- zval_dtor(&constructor);
- zval_dtor(&c_ret);
- }
-
- /* If session then update session hash with new object */
- if(service->soap_class.persistance == SOAP_PERSISTENCE_SESSION)
- {
- zval **tmp_soap_pp;
- if(zend_hash_update(&EG(symbol_table), "_bogus_session_name", sizeof("_bogus_session_name"), &tmp_soap, sizeof(zval *), (void **)&tmp_soap_pp) == SUCCESS)
- soap_obj = *tmp_soap_pp;
- }
- else
- soap_obj = tmp_soap;
- }
-/* function_table = &(soap_obj->value.obj.ce->function_table);*/
- function_table = &((Z_OBJCE_P(soap_obj))->function_table);
- }
- else
- {
- if(service->soap_functions.functions_all == TRUE)
- function_table = EG(function_table);
- else
- function_table = service->soap_functions.ft;
- }
-
- doc_return = NULL;
- if(zend_hash_exists(function_table, php_strtolower(Z_STRVAL(function_name), Z_STRLEN(function_name)), Z_STRLEN(function_name) + 1))
- {
- if(service->type == SOAP_CLASS)
- {
- call_status = call_user_function(NULL, &soap_obj, &function_name, &retval, num_params, params TSRMLS_CC);
- if(service->soap_class.persistance != SOAP_PERSISTENCE_SESSION)
- zval_ptr_dtor(&soap_obj);
- }
- else
- call_status = call_user_function(EG(function_table), NULL, &function_name, &retval, num_params, params TSRMLS_CC);
- }
- else
- php_error(E_ERROR, "Function (%s) doesn't exist", Z_STRVAL(function_name));
-
- if(call_status == SUCCESS)
- {
- sdlFunctionPtr function;
- function = get_function(get_binding_from_type(service->sdl, BINDING_SOAP), Z_STRVAL(function_name));
- SOAP_GLOBAL(overrides) = service->mapping;
- doc_return = seralize_response_call(function, response_name, service->uri, &retval TSRMLS_CC);
- SOAP_GLOBAL(overrides) = NULL;
- }
- else
- php_error(E_ERROR, "Function (%s) call failed", Z_STRVAL(function_name));
-
- /* Flush buffer */
- php_end_ob_buffer(0, 0 TSRMLS_CC);
-
- /* xmlDocDumpMemoryEnc(doc_return, &buf, &size, XML_CHAR_ENCODING_UTF8); */
- xmlDocDumpMemory(doc_return, &buf, &size);
-
- if(size == 0)
- php_error(E_ERROR, "Dump memory failed");
-
- sprintf(cont_len, "Content-Length: %d", size);
- sapi_add_header("Content-Type: text/xml", sizeof("Content-Type: text/xml"), 1);
- sapi_add_header(cont_len, strlen(cont_len) + 1, 1);
-
- /* Free Memory */
- if(num_params > 0)
- {
- for(i = 0; i < num_params;i++)
- zval_ptr_dtor(&params[i]);
- efree(params);
- }
-
- zval_dtor(&function_name);
- xmlFreeDoc(doc_return);
- efree(response_name);
- efree(fn_name);
-
- php_write(buf, size TSRMLS_CC);
- xmlFree(buf);
- }
- else
- {
- if(!zend_ini_long("always_populate_raw_post_data", sizeof("always_populate_raw_post_data"), 0))
- php_error(E_ERROR, "PHP-SOAP requires 'always_populate_raw_post_data' to be on please check your php.ini file");
-
- php_error(E_ERROR, "Couln't find HTTP_RAW_POST_DATA");
- }
-
- zval_dtor(&retval);
- SOAP_SERVER_END_CODE();
-}
-
-void soap_error_handler(int error_num, const char *error_filename, const uint error_lineno, const char *format, va_list args)
-{
- char buffer[1024];
- int buffer_len;
- TSRMLS_FETCH();
-
- buffer_len = vsnprintf(buffer, sizeof(buffer)-1, format, args);
- buffer[sizeof(buffer)-1]=0;
- if(buffer_len > sizeof(buffer) - 1 || buffer_len < 0) {
- buffer_len = sizeof(buffer) - 1;
- }
-
- /*
- Trap all errors
- What do do with these warnings
- E_WARNING, E_NOTICE, E_CORE_WARNING, E_COMPILE_WARNING, E_USER_WARNING, E_USER_NOTICE
- */
- if(error_num == E_USER_ERROR || error_num == E_COMPILE_ERROR || error_num == E_CORE_ERROR ||
- error_num == E_ERROR || error_num == E_PARSE)
- {
- zval outbuf, outbuflen, ret;
- xmlChar *buf, cont_len[30];
- int size;
- xmlDocPtr doc_return;
-
- INIT_ZVAL(outbuf);
- INIT_ZVAL(outbuflen);
- INIT_ZVAL(ret);
-
- /* Get output buffer and send as fault detials */
- if(php_ob_get_length(&outbuflen TSRMLS_CC) != FAILURE && Z_LVAL(outbuflen) != 0)
- php_ob_get_buffer(&outbuf TSRMLS_CC);
- php_end_ob_buffer(0, 0 TSRMLS_CC);
-
- set_soap_fault(&ret, "SOAP-ENV:Server", buffer, NULL, &outbuf TSRMLS_CC);
- doc_return = seralize_response_call(NULL, NULL, NULL, &ret TSRMLS_CC);
-
- /* Build and send our headers + http 500 status */
- /*
- xmlDocDumpMemoryEnc(doc_return, &buf, &size, XML_CHAR_ENCODING_UTF8);
- */
- xmlDocDumpMemory(doc_return, &buf, &size);
- sprintf(cont_len,"Content-Length: %d", size);
- sapi_add_header(cont_len, strlen(cont_len) + 1, 1);
- sapi_add_header("Content-Type: text/xml", sizeof("Content-Type: text/xml"), 1);
-
- /*
- Want to return HTTP 500 but apache wants to over write
- our fault code with their own handling... Figure this out later
- sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error"), 1);
- */
- php_write(buf, size TSRMLS_CC);
-
- xmlFreeDoc(doc_return);
- xmlFree(buf);
-
- zval_dtor(&outbuf);
- zval_dtor(&outbuflen);
- zval_dtor(&ret);
-
- zend_bailout();
- }
-}
-
-/* SoapObject functions */
-PHP_FUNCTION(soapobject)
-{
- char *location, *uri = NULL;
- int location_len, uri_len = 0;
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &location, &location_len, &uri, &uri_len) == SUCCESS)
- {
- if(uri)
- {
- /* if two parameters assume 'proxy' and 'uri' */
- add_property_stringl(thisObj, "location", location, location_len, 1);
- add_property_stringl(thisObj, "uri", uri, uri_len, 1);
- }
- else
- {
- /* if one parameter assume 'wsdl' */
- sdlPtr sdl;
- int ret;
-
- sdl = get_sdl(location);
- ret = zend_list_insert(sdl, le_sdl);
-
- add_property_resource(thisObj, "sdl", ret);
- /* FIXME: this is extremely bad practice */
- add_property_resource(thisObj, "port", (long)get_binding_from_type(sdl, BINDING_SOAP));
- zend_list_addref(ret);
- }
- }
-}
-
-PHP_FUNCTION(__headerclass)
-{
- char *classname, *ns;
- int classname_len, ns_len;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &classname, &classname_len, &ns, &ns_len) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapObject->__headerclass");
-}
-
-PHP_FUNCTION(__headerfunction)
-{
- char *functionname, *headername, *ns;
- int functionname_len, *headername_len, ns_len;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &functionname, &functionname_len, &headername,
- &headername_len, &ns, &ns_len) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapObject->__headerfunction");
-}
-
-PHP_FUNCTION(__use)
-{
- int use;
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &use) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapObject->__use");
-
- if(use == SOAP_DOCUMENT || use == SOAP_LITERAL)
- {
- add_property_long(thisObj, "use", use);
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-
-PHP_FUNCTION(__style)
-{
- int style;
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &style))
- php_error(E_ERROR, "Invalid arguments to SoapObject->__style");
-
- if(style == SOAP_RPC || style == SOAP_DOCUMENT)
- {
- add_property_long(thisObj, "style", style);
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-
-PHP_FUNCTION(__trace)
-{
- int level;
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &level))
- php_error(E_ERROR, "Invalid arguments to SoapObject->__trace");
-
- add_property_long(thisObj, "trace", level);
- RETURN_TRUE;
-}
-
-PHP_FUNCTION(__generate)
-{
- char *function, *soap_action, *uri;
- int function_len, soap_action_len, uri_len, i = 0;
- zval *args;
- zval **real_args;
- zval **param;
- xmlDocPtr request = NULL;
- int arg_count;
- xmlChar *buf;
- int size;
- sdlPtr sdl;
-
- HashPosition pos;
-
- FETCH_THIS_SDL(sdl);
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa|ss",
- &function, &function_len, &args, &soap_action, &soap_action_len, &uri, &uri_len) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapObject->__generate");
-
- arg_count = zend_hash_num_elements(Z_ARRVAL_P(args));
-
- real_args = emalloc(sizeof(zval *) * arg_count);
- for(zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(args), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_P(args), (void **) &param, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_P(args), &pos))
- {
- zval_add_ref(param);
- real_args[i++] = *param;
- }
-
-
- if(sdl)
- {
- sdlBindingPtr binding;
- sdlFunctionPtr sdlFunction;
- FETCH_THIS_PORT(binding);
-
- php_strtolower(function, function_len);
- sdlFunction = get_function(binding, function);
- request = seralize_function_call(this_ptr, sdlFunction, NULL, uri, real_args, arg_count TSRMLS_CC);
- }
- else
- {
- request = seralize_function_call(this_ptr, NULL, function, uri, real_args, arg_count TSRMLS_CC);
- }
-
- xmlDocDumpMemory(request, &buf, &size);
- ZVAL_STRINGL(return_value, buf, size, 1);
- xmlFree(buf);
-}
-
-PHP_FUNCTION(__parse)
-{
- char *message, *function;
- int message_len, function_len;
- int num_params;
- zval **ret_params = NULL;
- sdlPtr sdl;
- sdlFunctionPtr fn;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &message, &message_len, &function, &function_len) == FAILURE) {
- php_error(E_ERROR, "Invalid arguments to SoapObject->__parse");
- }
-
- FETCH_THIS_SDL(sdl);
-
- if (sdl != NULL) {
- sdlBindingPtr binding;
-
- FETCH_THIS_PORT(binding);
- fn = get_function(binding, function);
-
- if (fn != NULL) {
- parse_packet_soap(getThis(), message, message_len, fn, NULL, &ret_params, &num_params TSRMLS_CC);
- }
- } else {
- parse_packet_soap(getThis(), message, message_len, NULL, function, &ret_params, &num_params TSRMLS_CC);
- }
-
- if (num_params > 0) {
- *return_value = *ret_params[0];
- /* zval_add_ref(&return_value); */
- } else {
- ZVAL_NULL(return_value);
- }
-
- if (ret_params) {
- FREE_ZVAL(ret_params[0]);
- efree(ret_params);
- }
-}
-
-PHP_FUNCTION(__call)
-{
- char *function, *soap_action, *uri;
- int function_len, soap_action_len, uri_len, i = 0;
- zval *args;
- zval **real_args;
- zval **param;
- xmlDocPtr request = NULL;
- int num_params, arg_count;
- zval **ret_params = NULL;
- char *buffer;
- int len;
-
- HashPosition pos;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa|ss",
- &function, &function_len, &args, &soap_action, &soap_action_len, &uri, &uri_len) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapObject->__call");
-
- arg_count = zend_hash_num_elements(Z_ARRVAL_P(args));
-
- real_args = emalloc(sizeof(zval *) * arg_count);
- for(zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(args), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_P(args), (void **) &param, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_P(args), &pos))
- {
- zval_add_ref(param);
- real_args[i++] = *param;
- }
-
- request = seralize_function_call(this_ptr, NULL, function, uri, real_args, arg_count TSRMLS_CC);
- send_http_soap_request(getThis(), request, function, soap_action TSRMLS_CC);
- xmlFreeDoc(request);
-
- get_http_soap_response(getThis(), &buffer, &len TSRMLS_CC);
- parse_packet_soap(getThis(), buffer, len, NULL, function, &ret_params, &num_params TSRMLS_CC);
- efree(buffer);
-
- if(num_params > 0) {
- *return_value = *ret_params[0];
- /* zval_add_ref(&return_value); */
- } else {
- ZVAL_NULL(return_value);
- }
-
- if (ret_params) {
- FREE_ZVAL(ret_params[0]);
- efree(ret_params);
- }
-}
-
-PHP_FUNCTION(__isfault)
-{
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_hash_exists(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault")))
- RETURN_TRUE
- else
- RETURN_FALSE
-}
-
-PHP_FUNCTION(__getfault)
-{
- zval *thisObj;
- zval **tmp;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_hash_find(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault"), (void **)&tmp) == SUCCESS)
- {
- *return_value = *(*tmp);
- zval_copy_ctor(return_value);
- return;
- }
- RETURN_NULL();
-}
-
-PHP_FUNCTION(__getfunctions)
-{
- sdlPtr sdl;
- zval *thisObj;
- HashPosition pos;
-
- GET_THIS_OBJECT(thisObj);
-
- FETCH_THIS_SDL(sdl);
-
- if(sdl)
- {
- smart_str buf = {0};
- sdlFunctionPtr *function;
- sdlBindingPtr binding;
-
- FETCH_THIS_PORT(binding);
-
- array_init(return_value);
- zend_hash_internal_pointer_reset_ex(binding->functions, &pos);
- while(zend_hash_get_current_data_ex(binding->functions, (void **)&function, &pos) != FAILURE)
- {
- function_to_string((*function), &buf);
- add_next_index_stringl(return_value, buf.c, buf.len, 1);
- zend_hash_move_forward_ex(binding->functions, &pos);
- smart_str_free(&buf);
- }
- }
-}
-
-PHP_FUNCTION(__gettypes)
-{
- sdlPtr sdl;
- zval *thisObj;
- HashPosition pos;
-
- GET_THIS_OBJECT(thisObj);
-
- FETCH_THIS_SDL(sdl);
-
- if(sdl)
- {
- sdlTypePtr *type;
- smart_str buf = {0};
-
- array_init(return_value);
- if(sdl->types)
- {
- zend_hash_internal_pointer_reset_ex(sdl->types, &pos);
- while(zend_hash_get_current_data_ex(sdl->types, (void **)&type, &pos) != FAILURE)
- {
- type_to_string((*type), &buf, 0);
- add_next_index_stringl(return_value, buf.c, buf.len, 1);
- zend_hash_move_forward_ex(sdl->types, &pos);
- smart_str_free(&buf);
- }
- }
- }
-}
-
-PHP_FUNCTION(__getlastrequest)
-{
- zval *thisObj;
- zval **tmp;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_hash_find(Z_OBJPROP_P(thisObj), "__last_request", sizeof("__last_request"), (void **)&tmp) == SUCCESS)
- {
- RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
- }
- RETURN_NULL();
-}
-
-PHP_FUNCTION(__getlastresponse)
-{
- zval *thisObj;
- zval **tmp;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_hash_find(Z_OBJPROP_P(thisObj), "__last_response", sizeof("__last_response"), (void **)&tmp) == SUCCESS)
- {
- RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
- }
- RETURN_NULL();
-}
-
-void soap_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- pval *object = property_reference->object;
- zend_overloaded_element *function_name = (zend_overloaded_element *)property_reference->elements_list->tail->data;
- zval *thisObj;
- char *function = Z_STRVAL(function_name->element);
- zend_function *builtin_function;
-
- GET_THIS_OBJECT(thisObj);
-
- /*
- Find if the function being called is already defined...
- ( IMHO: zend should handle this functionality )
- */
- if(zend_hash_find(&Z_OBJCE_P(thisObj)->function_table, function, Z_STRLEN(function_name->element) + 1, (void **) &builtin_function) == SUCCESS)
- {
- builtin_function->internal_function.handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- else
- {
- zval **arguments = (zval **) emalloc(sizeof(zval *) * ZEND_NUM_ARGS());
- int arg_count = ZEND_NUM_ARGS();
- xmlDocPtr request = NULL;
- sdlPtr sdl;
- sdlFunctionPtr fn;
-
- zend_get_parameters_array(ht, arg_count, arguments);
-
- FETCH_THIS_SDL(sdl);
-
- clear_soap_fault(thisObj);
-
- if (sdl != NULL) {
- sdlBindingPtr binding;
-
- FETCH_THIS_PORT(binding);
- fn = get_function(binding, function);
- if(fn != NULL)
- {
- int num_params;
- zval **ret_params = NULL;
- char *buffer;
- char *ns;
- int len;
-
- if(binding->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes;
- request = seralize_function_call(this_ptr, fn, NULL, fnb->input.ns, arguments, arg_count TSRMLS_CC);
- send_http_soap_request(getThis(), request, fn->functionName, fnb->soapAction TSRMLS_CC);
- }
- else
- {
- request = seralize_function_call(this_ptr, fn, NULL, sdl->target_ns, arguments, arg_count TSRMLS_CC);
- send_http_soap_request(getThis(), request, fn->functionName, NULL TSRMLS_CC);
- }
-
- xmlFreeDoc(request);
-
- get_http_soap_response(getThis(), &buffer, &len TSRMLS_CC);
- parse_packet_soap(getThis(), buffer, len, fn, NULL, &ret_params, &num_params TSRMLS_CC);
- efree(buffer);
-
- if(num_params > 0) {
- *return_value = *ret_params[0];
- /* zval_add_ref(&return_value); */
- } else {
- ZVAL_NULL(return_value);
- }
-
- if (ret_params) {
- FREE_ZVAL(ret_params[0]);
- efree(ret_params);
- }
- }
- else
- {
- php_error(E_WARNING,"Function (\"%s\") not is not a valid method for this service", function);
- }
- }
- else
- {
- int num_params;
- zval **ret_params = NULL;
- zval **uri;
- smart_str *action;
- char *buffer;
- int len;
-
- if(zend_hash_find(Z_OBJPROP_P(thisObj), "uri", sizeof("uri"), (void *)&uri) == FAILURE)
- php_error(E_ERROR, "Error finding uri in soap_call_function_handler");
-
- request = seralize_function_call(this_ptr, NULL, function, Z_STRVAL_PP(uri), arguments, arg_count TSRMLS_CC);
- action = build_soap_action(thisObj, function);
- send_http_soap_request(getThis(), request, function, action->c TSRMLS_CC);
-
- smart_str_free(action);
- efree(action);
- xmlFreeDoc(request);
-
- get_http_soap_response(getThis(), &buffer, &len TSRMLS_CC);
- parse_packet_soap(getThis(), buffer, len, NULL, function, &ret_params, &num_params TSRMLS_CC);
- efree(buffer);
-
- if(num_params > 0) {
- *return_value = *ret_params[0];
- /* zval_add_ref(&return_value); */
- } else {
- ZVAL_NULL(return_value);
- }
-
- if (ret_params) {
- FREE_ZVAL(ret_params[0]);
- efree(ret_params);
- }
- }
- efree(arguments);
- }
-
- zval_dtor(&function_name->element);
-}
-
-void clear_soap_fault(zval *obj)
-{
- if(obj != NULL && obj->type == IS_OBJECT) {
-/* zend_hash_del(obj->value.obj.properties, "__soap_fault", sizeof("__soap_fault"));*/
- zend_hash_del(Z_OBJPROP_P(obj), "__soap_fault", sizeof("__soap_fault"));
- }
-}
-
-void add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC)
-{
- zval *fault;
- MAKE_STD_ZVAL(fault);
- set_soap_fault(fault, fault_string, fault_code, fault_actor, fault_detail TSRMLS_CC);
- add_property_zval(obj, "__soap_fault", fault);
-}
-
-void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC)
-{
- if(Z_TYPE_P(obj) != IS_OBJECT)
- object_init_ex(obj, &soap_fault_class_entry);
-
- if(fault_string != NULL)
- add_property_string(obj, "faultstring", fault_string, 1);
-
- if(fault_code != NULL)
- add_property_string(obj, "faultcode", fault_code, 1);
-
- if(fault_actor != NULL)
- add_property_string(obj, "faultactor", fault_actor, 1);
-
- if(fault_detail != NULL)
- {
- zval_add_ref(&fault_detail);
- add_property_zval(obj, "detail", fault_detail);
- }
-}
-
-void deseralize_function_call(sdlPtr sdl, xmlDocPtr request, zval *function_name, int *num_params, zval ***parameters TSRMLS_DC)
-{
- xmlNodePtr trav,trav2,trav3,trav4,env,body;
- int cur_param = 0,num_of_params = 0;
-
- trav = request->children;
- FOREACHNODE(trav,"Envelope",env)
- {
- trav2 = env->children;
- FOREACHNODE(trav2,"Body",body)
- {
- trav3 = body->children;
- do
- {
- /* TODO: make 'strict' (use the sdl defnintions) */
- if(trav3->type == XML_ELEMENT_NODE)
- {
- zval tmp_function_name, **tmp_parameters;
- sdlFunctionPtr function;
- sdlBindingPtr binding = get_binding_from_type(sdl, BINDING_SOAP);
-
- INIT_ZVAL(tmp_function_name);
- ZVAL_STRING(&tmp_function_name, (char *)trav3->name, 1);
-
- (*function_name) = tmp_function_name;
-
- function = get_function(binding, php_strtolower((char *)trav3->name, strlen(trav3->name)));
- if(sdl != NULL && function == NULL)
- php_error(E_ERROR, "Error function \"%s\" doesn't exists for this service \"%s\"", trav3->name, binding->location);
-
- if(trav3->children)
- {
- trav4 = trav3->children;
- if(function == NULL)
- {
- do
- {
- if(trav4->type == XML_ELEMENT_NODE)
- num_of_params++;
-
- } while ((trav4 = trav4->next));
- }
- else
- num_of_params = zend_hash_num_elements(function->requestParameters);
-
- tmp_parameters = emalloc(num_of_params * sizeof(zval *));
- trav4 = trav3->children;
- do
- {
- if(trav4->type == XML_ELEMENT_NODE)
- {
- encodePtr enc;
- sdlParamPtr *param = NULL;
-
- if(function != NULL && zend_hash_index_find(function->requestParameters, cur_param, (void **)&param) == FAILURE)
- php_error(E_ERROR, "Error cannot find parameter");
- if(param == NULL)
- enc = get_conversion(UNKNOWN_TYPE);
- else
- enc = (*param)->encode;
-
- tmp_parameters[cur_param] = master_to_zval(enc, trav4);
- cur_param++;
- }
-
- } while ((trav4 = trav4->next));
- }
- (*parameters) = tmp_parameters;
- (*num_params) = num_of_params;
- break;
- }
- } while ((trav3 = trav3->next));
-
- }
- ENDFOREACH(trav2);
- }
- ENDFOREACH(trav);
-}
-
-xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_name, char *uri, zval *ret TSRMLS_DC)
-{
- xmlDoc *doc;
- xmlNode *envelope,*body,*method, *param;
- xmlNs *ns;
- sdlParamPtr parameter = NULL;
- smart_str *gen_ns = NULL;
-
- encode_reset_ns();
-
- doc = xmlNewDoc("1.0");
- doc->charset = XML_CHAR_ENCODING_UTF8;
- doc->encoding = xmlStrdup((xmlChar*)"UTF-8");
- doc->children = xmlNewDocNode(doc, NULL, "SOAP-ENV:Envelope", NULL);
- envelope = doc->children;
-
- xmlSetProp(envelope, "SOAP-ENV:encodingStyle", "http://schemas.xmlsoap.org/soap/encoding/");
- xmlSetProp(envelope, "xmlns:SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/");
- xmlSetProp(envelope, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
- xmlSetProp(envelope, "xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
- xmlSetProp(envelope, "xmlns:" APACHE_NS_PREFIX , APACHE_NAMESPACE);
-
- ns = xmlNewNs(envelope,"http://schemas.xmlsoap.org/soap/envelope/","SOAP-ENV");
- body = xmlNewChild(envelope, ns, "Body", NULL);
-
- if(Z_TYPE_P(ret) == IS_OBJECT &&
- Z_OBJCE_P(ret)->refcount == soap_fault_class_entry.refcount)
- {
- param = seralize_zval(ret, NULL, "SOAP-ENV:Fault", SOAP_ENCODED TSRMLS_CC);
- xmlAddChild(body, param);
- }
- else
- {
- gen_ns = encode_new_ns();
- ns = xmlNewNs(envelope, uri, gen_ns->c);
-
- if(function != NULL)
- method = xmlNewChild(body, ns, function->responseName , NULL);
- else
- method = xmlNewChild(body, ns, function_name, NULL);
-
- if(uri)
- ns = xmlNewNs(method, uri, NULL);
-
- parameter = get_param(function, NULL, 0, TRUE);
-
- if(Z_TYPE_P(ret) == IS_OBJECT &&
- Z_OBJCE_P(ret)->refcount == soap_param_class_entry.refcount)
- {
- zval **ret_name;
- zval **ret_data;
-
- if(zend_hash_find(Z_OBJPROP_P(ret), "param_name", sizeof("param_name"), (void **)&ret_name) == SUCCESS &&
- zend_hash_find(Z_OBJPROP_P(ret), "param_data", sizeof("param_data"), (void **)&ret_data) == SUCCESS)
- param = seralize_parameter(parameter, *ret_data, 0, Z_STRVAL_PP(ret_name), SOAP_ENCODED TSRMLS_CC);
- else
- param = seralize_parameter(parameter, ret, 0, "return", SOAP_ENCODED TSRMLS_CC);
- }
- else
- param = seralize_parameter(parameter, ret, 0, "return", SOAP_ENCODED TSRMLS_CC);
-
- xmlAddChild(method,param);
- }
-
- if (gen_ns) {
- smart_str_free(gen_ns);
- efree(gen_ns);
- }
-
- return doc;
-}
-
-xmlDocPtr seralize_function_call(zval *this_ptr, sdlFunctionPtr function, char *function_name, char *uri, zval **arguments, int arg_count TSRMLS_DC)
-{
- xmlDoc *doc;
- xmlNode *envelope, *body, *method;
- xmlNs *ns, *tmpns;
- zval **zstyle, **zuse;
- int i, style, use;
- smart_str *gen_ns;
-
- encode_reset_ns();
-
- doc = xmlNewDoc("1.0");
- doc->encoding = xmlStrdup((xmlChar*)"UTF-8");
- doc->charset = XML_CHAR_ENCODING_UTF8;
- envelope = xmlNewDocNode(doc, NULL, "SOAP-ENV:Envelope", NULL);
- xmlDocSetRootElement(doc, envelope);
- xmlSetProp(envelope, "SOAP-ENV:encodingStyle", "http://schemas.xmlsoap.org/soap/encoding/");
- xmlSetProp(envelope, "xmlns:SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/");
- xmlSetProp(envelope, "xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
- xmlSetProp(envelope, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
-
- ns = xmlNewNs(envelope, "http://schemas.xmlsoap.org/soap/envelope/", "SOAP-ENV");
- body = xmlNewChild(envelope, ns, "Body", NULL);
-
- gen_ns = encode_new_ns();
-
- if(function)
- {
- if(function->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes;
-
- style = fnb->style;
- use = fnb->input.use;
- if(style == SOAP_RPC)
- {
- ns = xmlNewNs(body, fnb->input.ns, gen_ns->c);
- method = xmlNewChild(body, ns, function->requestName , NULL);
- }
- }
- }
- else
- {
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "style", sizeof("style"), (void **)&zstyle) == SUCCESS)
- style = Z_LVAL_PP(zstyle);
- else
- style = SOAP_RPC;
-
- if(style == SOAP_RPC)
- {
- ns = xmlNewNs(body, uri, gen_ns->c);
- method = xmlNewChild(body, ns, function_name, NULL);
- }
-
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "use", sizeof("use"), (void **)&zuse) == SUCCESS)
- use = Z_LVAL_PP(zuse);
- else
- use = SOAP_ENCODED;
- }
-
- for(i = 0;i < arg_count;i++)
- {
- xmlNodePtr param;
- sdlParamPtr parameter = get_param(function, NULL, i, FALSE);
-
- if(Z_TYPE_P(arguments[i]) == IS_OBJECT &&
- Z_OBJCE_P(arguments[i])->refcount == soap_param_class_entry.refcount)
- {
- zval **ret_name;
- zval **ret_data;
-
- if(zend_hash_find(Z_OBJPROP_P(arguments[i]), "param_name", sizeof("param_name"), (void **)&ret_name) == SUCCESS &&
- zend_hash_find(Z_OBJPROP_P(arguments[i]), "param_data", sizeof("param_data"), (void **)&ret_data) == SUCCESS)
- param = seralize_parameter(parameter, *ret_data, i, Z_STRVAL_PP(ret_name), use TSRMLS_CC);
- else
- param = seralize_parameter(parameter, arguments[i], i, NULL, use TSRMLS_CC);
- }
- else
- param = seralize_parameter(parameter, arguments[i], i, NULL, use TSRMLS_CC);
-
- if(style == SOAP_RPC)
- xmlAddChild(method, param);
- else if(style == SOAP_DOCUMENT)
- {
- if(function && function->bindingType == BINDING_SOAP)
- {
- sdlParamPtr *sparam;
-
- if(zend_hash_index_find(function->requestParameters, 0, (void **)&sparam) == SUCCESS)
- {
- ns = xmlNewNs(param, (*sparam)->encode->details.ns, gen_ns->c);
- xmlNodeSetName(param, (*sparam)->encode->details.type_str);
- xmlSetNs(param, ns);
- }
- }
- xmlAddChild(body, param);
- }
- }
- smart_str_free(gen_ns);
- efree(gen_ns);
-
- return doc;
-}
-
-xmlNodePtr seralize_parameter(sdlParamPtr param, zval *param_val, int index, char *name, int style TSRMLS_DC)
-{
- int type = 0;
- char *paramName;
- xmlNodePtr xmlParam;
-
- if(param != NULL && param->paramName != NULL)
- paramName = estrdup(param->paramName);
- else
- {
- if(name == NULL)
- {
- paramName = emalloc(10);
- sprintf(paramName,"param%d",index);
- }
- else
- paramName = estrdup(name);
- }
-
- xmlParam = seralize_zval(param_val, param, paramName, style TSRMLS_CC);
-
- efree(paramName);
-
- return xmlParam;
-}
-
-zval *desearlize_zval(sdlPtr sdl, xmlNodePtr data, sdlParamPtr param TSRMLS_DC)
-{
- encodePtr enc;
-
- if(param != NULL)
- enc = param->encode;
- else
- enc = get_conversion(UNKNOWN_TYPE);
-
- return enc->to_zval(enc->details, data);
-}
-
-xmlNodePtr seralize_zval(zval *val, sdlParamPtr param, char *paramName, int style TSRMLS_DC)
-{
- xmlNodePtr xmlParam;
- encodePtr enc;
-
- if(param != NULL)
- enc = param->encode;
- else
- enc = get_conversion(val->type);
-
- xmlParam = master_to_xml(enc, val, style);
- if(!strcmp(xmlParam->name, "BOGUS"))
- xmlNodeSetName(xmlParam, paramName);
-
- return xmlParam;
-}
-
-sdlParamPtr get_param(sdlFunctionPtr function, char *param_name, int index, int response)
-{
- sdlParamPtr *tmp = NULL;
- HashTable *h;
-
- if(function == NULL)
- return NULL;
-
- if(response == FALSE)
- h = function->requestParameters;
- else
- h = function->responseParameters;
-
- if (function != NULL && (param_name == NULL || zend_hash_find(h, param_name, strlen(param_name), (void **)&tmp) == FAILURE))
- {
- if(index != -1)
- if(zend_hash_index_find(h, index, (void **)&tmp) != FAILURE)
- return (*tmp);
- }
- else
- return (*tmp);
-
- return NULL;
-}
-
-sdlFunctionPtr get_function(sdlBindingPtr sdl, char *function_name)
-{
- sdlFunctionPtr *tmp;
- if(sdl != NULL)
- if(zend_hash_find(sdl->functions, function_name, strlen(function_name), (void **)&tmp) != FAILURE)
- return (*tmp);
- return NULL;
-}
-
-static void function_to_string(sdlFunctionPtr function, smart_str *buf)
-{
- int i = 0;
- HashPosition pos;
-
- if(function->responseParameters)
- {
- sdlParamPtr *param;
- param = function->responseParameters->pListHead->pData;
- smart_str_appendl(buf, (*param)->encode->details.type_str, strlen((*param)->encode->details.type_str));
- smart_str_appendc(buf, ' ');
- }
- else
- smart_str_appendl(buf, "void ", 5);
-
- smart_str_appendl(buf, function->functionName, strlen(function->functionName));
-
- smart_str_appendc(buf, '(');
- if(function->requestParameters)
- {
- sdlParamPtr *param;
-
- i = 0;
- zend_hash_internal_pointer_reset_ex(function->requestParameters, &pos);
- while(zend_hash_get_current_data_ex(function->requestParameters, (void **)&param, &pos) != FAILURE)
- {
- smart_str_appendl(buf, (*param)->encode->details.type_str, strlen((*param)->encode->details.type_str));
- smart_str_appendc(buf, ' ');
- smart_str_appendc(buf, '$');
- smart_str_appendl(buf, (*param)->paramName, strlen((*param)->paramName));
- if(zend_hash_num_elements(function->requestParameters) > i + 1)
- smart_str_appendl(buf, ", ", 2);
- zend_hash_move_forward_ex(function->requestParameters, &pos);
- i++;
- }
- }
- smart_str_appendc(buf, ')');
-}
-
-static void type_to_string(sdlTypePtr type, smart_str *buf, int level)
-{
- int i;
- smart_str spaces = {0};
- HashPosition pos;
-
- for(i = 0;i < level;i++)
- smart_str_appendc(&spaces, ' ');
-
- smart_str_appendl(buf, spaces.c, spaces.len);
- if(type->elements)
- {
- sdlTypePtr *t_type;
-
- smart_str_appendl(buf, "struct ", 7);
- smart_str_appendl(buf, type->name, strlen(type->name));
- smart_str_appendc(buf, '\n');
- smart_str_appendl(buf, spaces.c, spaces.len);
- smart_str_appendl(buf, "{\n", 2);
-
- zend_hash_internal_pointer_reset_ex(type->elements, &pos);
- level++;
- while(zend_hash_get_current_data_ex(type->elements, (void **)&t_type, &pos) != FAILURE)
- {
- type_to_string((*t_type), buf, level);
- zend_hash_move_forward_ex(type->elements, &pos);
- }
-
- smart_str_appendl(buf, spaces.c, spaces.len);
- smart_str_appendl(buf, "}\n", 2);
- }
- else
- {
- smart_str_appendl(buf, type->encode->details.type_str, strlen(type->encode->details.type_str));
- smart_str_appendc(buf, ' ');
- smart_str_appendl(buf, type->name, strlen(type->name));
- smart_str_appendl(buf, ";\n", 2);
- }
-}
-
-/* Deletes */
-void delete_sdl(void *handle)
-{
- sdlPtr tmp = *((sdlPtr*)handle);
-
- xmlFreeDoc(tmp->doc);
- if(tmp->source)
- free(tmp->source);
- if(tmp->target_ns)
- free(tmp->target_ns);
- if(tmp->encoders)
- {
- zend_hash_destroy(tmp->encoders);
- free(tmp->encoders);
- }
- if(tmp->types)
- {
- zend_hash_destroy(tmp->types);
- free(tmp->types);
- }
- if(tmp->bindings)
- {
- zend_hash_destroy(tmp->bindings);
- free(tmp->bindings);
- }
- free(tmp);
-}
-
-void delete_url(void *handle)
-{
- php_url_free((php_url*)handle);
-}
-
-void delete_service(void *data)
-{
- soapServicePtr service = (soapServicePtr)data;
-
- if(service->soap_functions.ft)
- {
- zend_hash_destroy(service->soap_functions.ft);
- efree(service->soap_functions.ft);
- }
-
- if(service->mapping)
- {
- zend_hash_destroy(service->mapping);
- efree(service->mapping);
- }
-
- if(service->soap_class.argc)
- {
- int i;
- for(i = 0; i < service->soap_class.argc;i++)
- zval_ptr_dtor(&service->soap_class.argv[i]);
- efree(service->soap_class.argv);
- }
-
- efree(service->uri);
- efree(service);
-}
-
-void delete_binding(void *data)
-{
- sdlBindingPtr binding = *((sdlBindingPtr*)data);
-
- if(binding->functions)
- {
- zend_hash_destroy(binding->functions);
- free(binding->functions);
- }
-
- if(binding->location)
- free(binding->location);
- if(binding->name)
- free(binding->name);
-
- if(binding->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingPtr soapBind = binding->bindingAttributes;
- free(soapBind->transport);
- }
-}
-
-void delete_function(void *data)
-{
- sdlFunctionPtr function = *((sdlFunctionPtr*)data);
-
- if(function->functionName)
- free(function->functionName);
- if(function->requestName)
- free(function->requestName);
- if(function->responseName)
- free(function->responseName);
-
- if(function->requestParameters)
- {
- zend_hash_destroy(function->requestParameters);
- free(function->requestParameters);
- }
- if(function->responseParameters)
- {
- zend_hash_destroy(function->responseParameters);
- free(function->responseParameters);
- }
-
- if(function->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingFunctionPtr soapFunction = function->bindingAttributes;
- if(soapFunction->soapAction)
- free(soapFunction->soapAction);
- delete_sdl_soap_binding_function_body(soapFunction->input);
- delete_sdl_soap_binding_function_body(soapFunction->output);
- delete_sdl_soap_binding_function_body(soapFunction->falut);
- }
-}
-
-void delete_sdl_soap_binding_function_body(sdlSoapBindingFunctionBody body)
-{
- if(body.ns)
- free(body.ns);
- if(body.parts)
- free(body.parts);
- if(body.encodingStyle)
- free(body.encodingStyle);
-}
-
-void delete_paramater(void *data)
-{
- sdlParamPtr param = *((sdlParamPtr*)data);
- if(param->paramName)
- free(param->paramName);
- free(param);
-}
-
-void delete_mapping(void *data)
-{
- soapMappingPtr map = (soapMappingPtr)data;
-
- if(map->ns)
- efree(map->ns);
- if(map->ctype)
- efree(map->ctype);
-
- if(map->type == SOAP_MAP_FUNCTION)
- {
- if(map->map_functions.to_xml_before)
- zval_ptr_dtor(&map->map_functions.to_xml_before);
- if(map->map_functions.to_xml)
- zval_ptr_dtor(&map->map_functions.to_xml);
- if(map->map_functions.to_xml_after)
- zval_ptr_dtor(&map->map_functions.to_xml_after);
-
- if(map->map_functions.to_zval_before)
- zval_ptr_dtor(&map->map_functions.to_zval_before);
- if(map->map_functions.to_zval)
- zval_ptr_dtor(&map->map_functions.to_zval);
- if(map->map_functions.to_zval_after)
- zval_ptr_dtor(&map->map_functions.to_zval_after);
- }
- efree(map);
-}
-
-/* Should not need */
-#ifndef ZEND_ENGINE_2
-int my_call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[] TSRMLS_DC)
-{
- if(call_user_function(function_table, object_pp, function_name, retval_ptr, param_count, params TSRMLS_CC) == FAILURE)
- {
- if(Z_OBJCE_PP(object_pp)->handle_function_call != NULL)
- {
- zend_overloaded_element overloaded_element;
- zend_property_reference property_reference;
- zend_function_state function_state;
- zend_function_state *original_function_state_ptr;
- int i;
-
- overloaded_element.element = *function_name;
- overloaded_element.type = OE_IS_METHOD;
-
- function_state.function = (zend_function *) emalloc(sizeof(zend_function));
- function_state.function->type = ZEND_OVERLOADED_FUNCTION;
- function_state.function->common.arg_types = NULL;
- function_state.function->overloaded_function.function_name = Z_STRVAL_P(function_name);
-
- property_reference.object = *object_pp;
- property_reference.type = BP_VAR_NA;
- property_reference.elements_list = (zend_llist *)emalloc(sizeof(zend_llist));
- zend_llist_init(property_reference.elements_list, sizeof(zend_overloaded_element), NULL, 0);
- zend_llist_add_element(property_reference.elements_list, &overloaded_element);
-
- /* Build argument stack */
- for(i = 0;i < param_count;i++)
- zend_ptr_stack_push(&EG(argument_stack), params[i]);
- zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *)param_count, NULL);
-
- original_function_state_ptr = EG(function_state_ptr);
- EG(function_state_ptr) = &function_state;
- Z_OBJCE_PP(object_pp)->handle_function_call(param_count, retval_ptr, *object_pp, 1 TSRMLS_CC, &property_reference);
- EG(function_state_ptr) = original_function_state_ptr;
-
- zend_llist_destroy(property_reference.elements_list);
- efree(property_reference.elements_list);
- efree(function_state.function);
-
- zend_ptr_stack_clear_multiple(TSRMLS_C);
- return SUCCESS;
- }
- }
- return FAILURE;
-}
-#endif
-
-
diff --git a/ext/sockets/CREDITS b/ext/sockets/CREDITS
deleted file mode 100644
index 2be7552d79..0000000000
--- a/ext/sockets/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Sockets
-Chris Vandomelen, Sterling Hughes, Daniel Beulshausen, Jason Greene
diff --git a/ext/sockets/config.m4 b/ext/sockets/config.m4
deleted file mode 100644
index 1509dd80cb..0000000000
--- a/ext/sockets/config.m4
+++ /dev/null
@@ -1,32 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(sockets, whether to enable sockets support,
-[ --enable-sockets Enable sockets support])
-
-if test "$PHP_SOCKETS" != "no"; then
- dnl Check for struct cmsghdr
- AC_CACHE_CHECK([for struct cmsghdr], ac_cv_cmsghdr,
- [
- AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/socket.h>], [struct cmsghdr s; s], ac_cv_cmsghdr=yes, ac_cv_cmsghdr=no)
- ])
-
- if test "$ac_cv_cmsghdr" = yes; then
- AC_DEFINE(HAVE_CMSGHDR,1,[Whether you have struct cmsghdr])
- fi
-
- AC_CHECK_FUNCS([hstrerror])
- AC_CHECK_HEADERS([netdb.h netinet/tcp.h sys/un.h errno.h])
- AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/socket.h>
- ], [static struct msghdr tp; int n = (int) tp.msg_flags; return n],[],
- [AC_DEFINE(MISSING_MSGHDR_MSGFLAGS, 1, [ ])]
- )
- AC_DEFINE([HAVE_SOCKETS], 1, [ ])
-
- PHP_NEW_EXTENSION([sockets], [sockets.c], [$ext_shared])
-fi
diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h
deleted file mode 100644
index fed1dda9a6..0000000000
--- a/ext/sockets/php_sockets.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Chris Vandomelen <chrisv@b0rked.dhs.org> |
- | Sterling Hughes <sterling@php.net> |
- | |
- | WinSock: Daniel Beulshausen <daniel@php4win.de> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_SOCKETS_H
-#define PHP_SOCKETS_H
-
-/* $Id$ */
-
-#if HAVE_SOCKETS
-
-extern zend_module_entry sockets_module_entry;
-#define phpext_sockets_ptr &sockets_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_SOCKETS_API __declspec(dllexport)
-#include <winsock.h>
-#else
-#define PHP_SOCKETS_API
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#endif
-
-PHP_MINIT_FUNCTION(sockets);
-PHP_MINFO_FUNCTION(sockets);
-PHP_RINIT_FUNCTION(sockets);
-PHP_RSHUTDOWN_FUNCTION(sockets);
-
-PHP_FUNCTION(socket_iovec_alloc);
-PHP_FUNCTION(socket_iovec_free);
-PHP_FUNCTION(socket_iovec_set);
-PHP_FUNCTION(socket_iovec_fetch);
-PHP_FUNCTION(socket_iovec_add);
-PHP_FUNCTION(socket_iovec_delete);
-PHP_FUNCTION(socket_select);
-PHP_FUNCTION(socket_create_listen);
-PHP_FUNCTION(socket_create_pair);
-PHP_FUNCTION(socket_accept);
-PHP_FUNCTION(socket_set_nonblock);
-PHP_FUNCTION(socket_set_block);
-PHP_FUNCTION(socket_listen);
-PHP_FUNCTION(socket_close);
-PHP_FUNCTION(socket_write);
-PHP_FUNCTION(socket_read);
-PHP_FUNCTION(socket_getsockname);
-PHP_FUNCTION(socket_getpeername);
-PHP_FUNCTION(socket_create);
-PHP_FUNCTION(socket_connect);
-PHP_FUNCTION(socket_strerror);
-PHP_FUNCTION(socket_bind);
-PHP_FUNCTION(socket_recv);
-PHP_FUNCTION(socket_send);
-PHP_FUNCTION(socket_recvfrom);
-PHP_FUNCTION(socket_sendto);
-#ifdef HAVE_CMSGHDR
-PHP_FUNCTION(socket_recvmsg);
-#endif
-PHP_FUNCTION(socket_sendmsg);
-PHP_FUNCTION(socket_readv);
-PHP_FUNCTION(socket_writev);
-PHP_FUNCTION(socket_get_option);
-PHP_FUNCTION(socket_set_option);
-PHP_FUNCTION(socket_shutdown);
-PHP_FUNCTION(socket_last_error);
-PHP_FUNCTION(socket_clear_error);
-
-typedef struct php_iovec {
- struct iovec *iov_array;
- unsigned int count;
-} php_iovec_t;
-
-#ifndef PHP_WIN32
-typedef int SOCKET;
-#endif
-
-typedef struct {
- SOCKET bsd_socket;
- int type;
- int error;
-} php_socket;
-
-typedef struct {
- zend_bool use_system_read;
-} php_sockets_globals;
-
-/* Prototypes */
-static int php_open_listen_sock(php_socket **php_sock, int port, int backlog TSRMLS_DC);
-static int php_accept_connect(php_socket *in_sock, php_socket **new_sock, struct sockaddr *la TSRMLS_DC);
-static int php_read(int bsd_socket, void *buf, size_t maxlen, int flags);
-static char *php_strerror(int error TSRMLS_DC);
-
-ZEND_BEGIN_MODULE_GLOBALS(sockets)
- int last_error;
- char *strerror_buf;
-ZEND_END_MODULE_GLOBALS(sockets)
-
-#ifdef ZTS
-#define SOCKETS_G(v) TSRMG(sockets_globals_id, zend_sockets_globals *, v)
-#else
-#define SOCKETS_G(v) (sockets_globals.v)
-#endif
-
-#else
-#define phpext_sockets_ptr NULL
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
diff --git a/ext/sockets/php_sockets_win.c b/ext/sockets/php_sockets_win.c
deleted file mode 100644
index 4c11168ea2..0000000000
--- a/ext/sockets/php_sockets_win.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Chris Vandomelen <chrisv@b0rked.dhs.org> |
- | Sterling Hughes <sterling@php.net> |
- | |
- | WinSock: Daniel Beulshausen <daniel@php4win.de> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef PHP_WIN32
-
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "php.h"
-#include "php_sockets.h"
-#include "php_sockets_win.h"
-
-ssize_t readv(SOCKET sock, const struct iovec *iov, int iovcnt) {
- size_t bytes, remain, len, pos = 0;
- ssize_t retval;
- int i;
- char *buffer = NULL;
-
- for(bytes=0, i=0; i<iovcnt; i++) {
- bytes += iov[i].iov_len;
- }
-
- buffer = (char*)emalloc(bytes);
- if (buffer == NULL) {
- return -1;
- }
-
- retval = recv(sock, buffer, bytes, 0);
-
- if(retval < 0) {
- efree(buffer);
- return retval;
- }
-
- remain = bytes = (size_t) retval;
-
- for(i=0; i<iovcnt; i++) {
- len = ((unsigned int)iov[i].iov_len < remain) ? iov[i].iov_len : remain;
- memcpy(iov[i].iov_base, buffer+pos, len);
- pos += len;
- remain -= len;
- }
-
- efree(buffer);
- return bytes;
-}
-
-ssize_t writev(SOCKET sock, const struct iovec *iov, int iovcnt) {
- size_t bytes, pos = 0;
- ssize_t retval;
- int i;
- char *buffer = NULL;
-
- for(bytes=0, i=0; i<iovcnt; i++) {
- bytes += iov[i].iov_len;
- }
-
- buffer = (char*)emalloc(bytes);
-
- if(buffer == NULL) {
- return -1;
- }
-
- for(i=0; i<iovcnt; i++) {
- memcpy(buffer+pos, iov[i].iov_base, iov[i].iov_len);
- pos += iov[i].iov_len;
- }
-
- retval = send(sock, buffer, bytes, 0);
- efree(buffer);
-
- return retval;
-}
-
-ssize_t recvmsg(SOCKET sock, struct msghdr *msg, int flags) {
- set_errno(WSAEOPNOTSUPP);
- return -1;
-}
-
-ssize_t sendmsg(SOCKET sock, struct msghdr *msg, int flags) {
- set_errno(WSAEOPNOTSUPP);
- return -1;
-}
-
-int socketpair(int domain, int type, int protocol, SOCKET sock[2]) {
- struct sockaddr_in address;
- SOCKET redirect;
- int size = sizeof(address);
-
- if(domain != AF_INET) {
- set_errno(WSAENOPROTOOPT);
- return -1;
- }
-
-
- sock[0] = socket(domain, type, protocol);
- address.sin_addr.s_addr = INADDR_ANY;
- address.sin_family = AF_INET;
- address.sin_port = 0;
-
- bind(sock[0], (struct sockaddr*)&address, sizeof(address));
- if(getsockname(sock[0], (struct sockaddr *)&address, &size) != 0) {
-
- }
-
- listen(sock[0], 2);
- sock[1] = socket(domain, type, protocol);
- address.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-
- connect(sock[1], (struct sockaddr*)&address, sizeof(address));
- redirect = accept(sock[0],(struct sockaddr*)&address, &size);
-
- close(sock[0]);
- sock[0] = redirect;
-
- if(sock[0] == INVALID_SOCKET ) {
- close(sock[0]);
- close(sock[1]);
- set_errno(WSAECONNABORTED);
- return -1;
- }
-
- return 0;
-}
-
-int inet_aton(const char *cp, struct in_addr *inp) {
- inp->s_addr = inet_addr(cp);
-
- if (inp->s_addr == INADDR_NONE) {
- return 0;
- }
-
- return 1;
-}
-
-int fcntl(int fd, int cmd, ...) {
- va_list va;
- int retval, io, mode;
-
- va_start(va, cmd);
-
- switch(cmd) {
- case F_GETFL:
- case F_SETFD:
- case F_GETFD:
- default:
- retval = -1;
- break;
-
- case F_SETFL:
- io = va_arg(va, int);
- mode = io == O_NONBLOCK ? 1 : 0;
- retval = ioctlsocket(fd, io, &mode);
- break;
- }
-
- va_end(va);
- return retval;
-}
-#endif
diff --git a/ext/sockets/php_sockets_win.h b/ext/sockets/php_sockets_win.h
deleted file mode 100644
index de40be4cc3..0000000000
--- a/ext/sockets/php_sockets_win.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Chris Vandomelen <chrisv@b0rked.dhs.org> |
- | Sterling Hughes <sterling@php.net> |
- | |
- | WinSock: Daniel Beulshausen <daniel@php4win.de> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef PHP_WIN32
-
-#define F_SETFL 0
-#define F_GETFL 1
-#define F_SETFD 2
-#define F_GETFD 3
-
-#define O_NONBLOCK FIONBIO
-
-#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
-#define ECONNRESET WSAECONNRESET
-
-#ifdef errno
-#undef errno
-#endif
-
-#define errno WSAGetLastError()
-#define h_errno WSAGetLastError()
-#define set_errno(a) WSASetLastError(a)
-#define set_h_errno(a) WSASetLastError(a)
-#define close(a) closesocket(a)
-#define CMSG_DATA(cmsg) ((cmsg)->cmsg_data)
-
-typedef int ssize_t;
-
-struct sockaddr_un {
- short sun_family;
- char sun_path[108];
-};
-
-struct iovec {
- char * iov_base;
- int iov_len;
-};
-
-struct msghdr {
- void* msg_name;
- socklen_t msg_namelen;
- struct iovec* msg_iov;
- int msg_iovlen;
- void* msg_control;
- socklen_t msg_controllen;
- int msg_flags;
-};
-
-struct cmsghdr {
- socklen_t cmsg_len;
- int cmsg_level;
- int cmsg_type;
- unsigned char cmsg_data[];
-};
-
-ssize_t readv(SOCKET sock, const struct iovec *iov, int iovcnt);
-ssize_t writev(SOCKET sock, const struct iovec *iov, int iovcnt);
-ssize_t recvmsg(SOCKET sock, struct msghdr *msg, int flags);
-ssize_t sendmsg(SOCKET sock, struct msghdr *msg, int flags);
-int socketpair(int domain, int type, int protocol, SOCKET sock[2]);
-int inet_aton(const char *cp, struct in_addr *inp);
-int fcntl(int fd, int cmd, ...);
-
-#endif
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
deleted file mode 100644
index f39b97566b..0000000000
--- a/ext/sockets/sockets.c
+++ /dev/null
@@ -1,2304 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Chris Vandomelen <chrisv@b0rked.dhs.org> |
- | Sterling Hughes <sterling@php.net> |
- | Jason Greene <jason@php.net> |
- | WinSock: Daniel Beulshausen <daniel@php4win.de> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_SOCKETS
-
-#ifndef _XOPEN_SOURCE_EXTENDED
-#define _XOPEN_SOURCE_EXTENDED
-#endif
-
-#define _XPG4_2
-#define __EXTENSIONS__
-
-#include "php_network.h"
-#include "ext/standard/info.h"
-#include "php_ini.h"
-
-#ifndef PHP_WIN32
-# include "php_sockets.h"
-# include <sys/types.h>
-# include <sys/socket.h>
-# include <netdb.h>
-# include <netinet/in.h>
-# include <netinet/tcp.h>
-# include <sys/un.h>
-# include <arpa/inet.h>
-# include <sys/time.h>
-# include <unistd.h>
-# include <errno.h>
-# include <fcntl.h>
-# include <signal.h>
-# include <sys/uio.h>
-# define IS_INVALID_SOCKET(a) (a->bsd_socket < 0)
-# define set_errno(a) (errno = a)
-# define set_h_errno(a) (h_errno = a)
-#else /* windows */
-# include "php_sockets.h"
-# include "php_sockets_win.h"
-# define IS_INVALID_SOCKET(a) (a->bsd_socket == INVALID_SOCKET)
-#endif
-
-ZEND_DECLARE_MODULE_GLOBALS(sockets)
-
-#ifndef MSG_WAITALL
-#ifdef LINUX
-#define MSG_WAITALL 0x00000100
-#else
-#define MSG_WAITALL 0x00000000
-#endif
-#endif
-
-#ifndef SUN_LEN
-#define SUN_LEN(su) (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
-#endif
-
-#ifndef PF_INET
-#define PF_INET AF_INET
-#endif
-
-
-#define PHP_NORMAL_READ 0x0001
-#define PHP_BINARY_READ 0x0002
-
-#define PHP_SOCKET_ERROR(socket,msg,errn) socket->error = errn; \
- SOCKETS_G(last_error) = errn; \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s [%d]: %s", msg, errn, php_strerror(errn TSRMLS_CC))
-
-static int le_iov;
-#define le_iov_name "Socket I/O vector"
-static int le_socket;
-#define le_socket_name "Socket"
-
-static unsigned char first_through_third_args_force_ref[] =
-{3, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE};
-
-static unsigned char second_and_third_args_force_ref[] =
-{3, BYREF_NONE, BYREF_FORCE, BYREF_FORCE};
-
-static unsigned char second_arg_of_four_force_ref[] =
-{4, BYREF_NONE, BYREF_FORCE, BYREF_NONE, BYREF_NONE};
-
-static unsigned char fourth_arg_force_ref[] =
-{4, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_FORCE};
-
-static unsigned char second_fifth_and_sixth_args_force_ref[] =
-{6, BYREF_NONE, BYREF_FORCE, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE};
-
-static unsigned char third_through_seventh_args_force_ref[] =
-{7, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE};
-
-/* {{{ sockets_functions[]
- */
-function_entry sockets_functions[] = {
- PHP_FE(socket_iovec_alloc, NULL)
- PHP_FE(socket_iovec_free, NULL)
- PHP_FE(socket_iovec_set, NULL)
- PHP_FE(socket_iovec_fetch, NULL)
- PHP_FE(socket_iovec_add, NULL)
- PHP_FE(socket_iovec_delete, NULL)
- PHP_FE(socket_select, first_through_third_args_force_ref)
- PHP_FE(socket_create, NULL)
- PHP_FE(socket_create_listen, NULL)
- PHP_FE(socket_create_pair, fourth_arg_force_ref)
- PHP_FE(socket_accept, NULL)
- PHP_FE(socket_set_nonblock, NULL)
- PHP_FE(socket_set_block, NULL)
- PHP_FE(socket_listen, NULL)
- PHP_FE(socket_close, NULL)
- PHP_FE(socket_write, NULL)
- PHP_FE(socket_read, NULL)
- PHP_FE(socket_getsockname, second_and_third_args_force_ref)
- PHP_FE(socket_getpeername, second_and_third_args_force_ref)
- PHP_FE(socket_connect, NULL)
- PHP_FE(socket_strerror, NULL)
- PHP_FE(socket_bind, NULL)
- PHP_FE(socket_recv, second_arg_of_four_force_ref)
- PHP_FE(socket_send, NULL)
- PHP_FE(socket_recvfrom, second_fifth_and_sixth_args_force_ref)
- PHP_FE(socket_sendto, NULL)
-#ifdef HAVE_CMSGHDR
- PHP_FE(socket_recvmsg, third_through_seventh_args_force_ref)
-#endif
- PHP_FE(socket_sendmsg, NULL)
- PHP_FE(socket_readv, NULL)
- PHP_FE(socket_writev, NULL)
- PHP_FE(socket_get_option, NULL)
- PHP_FE(socket_set_option, NULL)
- PHP_FE(socket_shutdown, NULL)
- PHP_FE(socket_last_error, NULL)
- PHP_FE(socket_clear_error, NULL)
-
- /* for downwards compatability */
- PHP_FALIAS(socket_getopt, socket_get_option, NULL)
- PHP_FALIAS(socket_setopt, socket_set_option, NULL)
-
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry sockets_module_entry = {
- STANDARD_MODULE_HEADER,
- "sockets",
- sockets_functions,
- PHP_MINIT(sockets),
- NULL,
- PHP_RINIT(sockets),
- PHP_RSHUTDOWN(sockets),
- PHP_MINFO(sockets),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-
-#ifdef COMPILE_DL_SOCKETS
-ZEND_GET_MODULE(sockets)
-#endif
-
-/* inet_ntop should be used instead of inet_ntoa */
-int inet_ntoa_lock = 0;
-
-static void php_destroy_iovec(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- unsigned int i;
- php_iovec_t *iov = (php_iovec_t *) rsrc->ptr;
-
- if (iov->count && iov->iov_array) {
- for (i = 0; i < iov->count; i++) {
- efree(iov->iov_array[i].iov_base);
- }
-
- efree(iov->iov_array);
- efree(iov);
- }
-}
-
-static void php_destroy_socket(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- php_socket *php_sock = (php_socket *) rsrc->ptr;
-
- close(php_sock->bsd_socket);
- efree(php_sock);
-}
-
-static int php_open_listen_sock(php_socket **php_sock, int port, int backlog TSRMLS_DC)
-{
- struct sockaddr_in la;
- struct hostent *hp;
- php_socket *sock = (php_socket*)emalloc(sizeof(php_socket));
-
- *php_sock = sock;
-
-#ifndef PHP_WIN32
- if ((hp = gethostbyname("0.0.0.0")) == NULL) {
-#else
- if ((hp = gethostbyname("localhost")) == NULL) {
-#endif
- efree(sock);
- return 0;
- }
-
- memcpy((char *) &la.sin_addr, hp->h_addr, hp->h_length);
- la.sin_family = hp->h_addrtype;
- la.sin_port = htons((unsigned short) port);
-
- sock->bsd_socket = socket(PF_INET, SOCK_STREAM, 0);
-
- if (IS_INVALID_SOCKET(sock)) {
- PHP_SOCKET_ERROR(sock, "unable to create listening socket", errno);
- efree(sock);
- return 0;
- }
-
- sock->type = PF_INET;
-
- if (bind(sock->bsd_socket, (struct sockaddr *)&la, sizeof(la)) < 0) {
- PHP_SOCKET_ERROR(sock, "unable to bind to given adress", errno);
- close(sock->bsd_socket);
- efree(sock);
- return 0;
- }
-
- if (listen(sock->bsd_socket, backlog) < 0) {
- PHP_SOCKET_ERROR(sock, "unable to listen on socket", errno);
- close(sock->bsd_socket);
- efree(sock);
- return 0;
- }
-
- return 1;
-}
-
-static int php_accept_connect(php_socket *in_sock, php_socket **new_sock, struct sockaddr *la TSRMLS_DC)
-{
- socklen_t salen;
- php_socket *out_sock = (php_socket*)emalloc(sizeof(php_socket));
-
- *new_sock = out_sock;
- salen = sizeof(*la);
-
- out_sock->bsd_socket = accept(in_sock->bsd_socket, la, &salen);
-
- if (IS_INVALID_SOCKET(out_sock)) {
- PHP_SOCKET_ERROR(out_sock, "unable to accept incoming connection", errno);
- efree(out_sock);
- return 0;
- }
-
- return 1;
-}
-
-/* {{{ php_read -- wrapper around read() so that it only reads to a \r or \n. */
-static int php_read(int bsd_socket, void *buf, size_t maxlen, int flags)
-{
- int m = 0;
- size_t n = 0;
- int no_read = 0;
- int nonblock = 0;
- char *t = (char *) buf;
-
- m = fcntl(bsd_socket, F_GETFL);
- if (m < 0) {
- return m;
- }
-
- nonblock = (m & O_NONBLOCK);
- m = 0;
-
- set_errno(0);
-
- while (*t != '\n' && *t != '\r' && n < maxlen) {
- if (m > 0) {
- t++;
- n++;
- } else if (m == 0) {
- no_read++;
- if (nonblock && no_read >= 2) {
- return n;
- /* The first pass, m always is 0, so no_read becomes 1
- * in the first pass. no_read becomes 2 in the second pass,
- * and if this is nonblocking, we should return.. */
- }
-
- if (no_read > 200) {
- set_errno(ECONNRESET);
- return -1;
- }
- }
-
- if (n < maxlen) {
- m = recv(bsd_socket, (void *) t, 1, flags);
- }
-
- if (errno != 0 && errno != ESPIPE && errno != EAGAIN) {
- return -1;
- }
-
- set_errno(0);
- }
-
- if (n < maxlen) {
- n++;
- /* The only reasons it makes it to here is
- * if '\n' or '\r' are encountered. So, increase
- * the return by 1 to make up for the lack of the
- * '\n' or '\r' in the count (since read() takes
- * place at the end of the loop..) */
- }
-
- return n;
-}
-/* }}} */
-
-static char *php_strerror(int error TSRMLS_DC)
-{
- const char *buf;
-
-#ifndef PHP_WIN32
- if (error < -10000) {
- error = -error - 10000;
-
-#ifdef HAVE_HSTRERROR
- buf = hstrerror(error);
-#else
- {
- sprintf(SOCKETS_G(strerror_buf), "Host lookup error %d", error);
- buf = SOCKETS_G(strerror_buf);
- }
-#endif
- } else {
- buf = strerror(error);
- }
-#else
- {
- LPTSTR tmp = NULL;
- buf = NULL;
-
- if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &tmp, 0, NULL)) {
- strlcpy(SOCKETS_G(strerror_buf), (char *) tmp, 10000);
- LocalFree(tmp);
-
- buf = SOCKETS_G(strerror_buf);
- }
- }
-#endif
-
- return (buf ? (char *) buf : "");
-}
-
-#ifdef HAVE_IPV6
-/* Sets addr by hostname, or by ip in string form (AF_INET6) */
-static int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_sock TSRMLS_DC)
-{
- struct in6_addr tmp;
- struct hostent *host_entry;
-
- if (inet_pton(AF_INET6, string, &tmp)) {
- memcpy(&(sin6->sin6_addr.s6_addr), &(tmp.s6_addr), sizeof(struct in6_addr));
- } else {
- if (! (host_entry = gethostbyname2(string, AF_INET6))) {
-#ifdef PHP_WIN32
- PHP_SOCKET_ERROR(php_sock, "Host lookup failed", WSAGetLastError());
-#else
- PHP_SOCKET_ERROR(php_sock, "Host lookup failed", (-10000 - h_errno));
-#endif
- return 0;
- }
- if (host_entry->h_addrtype != AF_INET6) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Host lookup failed: Non AF_INET6 domain returned on AF_INET6 socket");
- return 0;
- }
- memcpy(&(sin6->sin6_addr.s6_addr), host_entry->h_addr_list[0], host_entry->h_length);
- }
-
- return 1;
-}
-#endif
-
-/* Sets addr by hostname, or by ip in string form (AF_INET) */
-static int php_set_inet_addr(struct sockaddr_in *sin, char *string, php_socket *php_sock TSRMLS_DC)
-{
- struct in_addr tmp;
- struct hostent *host_entry;
-
- if (inet_aton(string, &tmp)) {
- sin->sin_addr.s_addr = tmp.s_addr;
- } else {
- if (! (host_entry = gethostbyname(string))) {
- /* Note: < -10000 indicates a host lookup error */
-#ifdef PHP_WIN32
- PHP_SOCKET_ERROR(php_sock, "Host lookup failed", WSAGetLastError());
-#else
- PHP_SOCKET_ERROR(php_sock, "Host lookup failed", (-10000 - h_errno));
-#endif
- return 0;
- }
- if (host_entry->h_addrtype != AF_INET) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Host lookup failed: Non AF_INET domain returned on AF_INET socket");
- return 0;
- }
- memcpy(&(sin->sin_addr.s_addr), host_entry->h_addr_list[0], host_entry->h_length);
- }
-
- return 1;
-}
-
-static void php_sockets_init_globals(zend_sockets_globals *sockets_globals TSRMLS_DC)
-{
- sockets_globals->last_error = 0;
- sockets_globals->strerror_buf = NULL;
-}
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(sockets)
-{
- struct protoent *pe;
-
- ZEND_INIT_MODULE_GLOBALS(sockets, php_sockets_init_globals, NULL);
-
- le_socket = zend_register_list_destructors_ex(php_destroy_socket, NULL, le_socket_name, module_number);
- le_iov = zend_register_list_destructors_ex(php_destroy_iovec, NULL, le_iov_name, module_number);
-
- REGISTER_LONG_CONSTANT("AF_UNIX", AF_UNIX, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("AF_INET", AF_INET, CONST_CS | CONST_PERSISTENT);
-#ifdef HAVE_IPV6
- REGISTER_LONG_CONSTANT("AF_INET6", AF_INET6, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_LONG_CONSTANT("SOCK_STREAM", SOCK_STREAM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOCK_DGRAM", SOCK_DGRAM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOCK_RAW", SOCK_RAW, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOCK_SEQPACKET",SOCK_SEQPACKET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOCK_RDM", SOCK_RDM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSG_OOB", MSG_OOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSG_WAITALL", MSG_WAITALL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSG_PEEK", MSG_PEEK, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSG_DONTROUTE", MSG_DONTROUTE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_DEBUG", SO_DEBUG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_REUSEADDR", SO_REUSEADDR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_KEEPALIVE", SO_KEEPALIVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_DONTROUTE", SO_DONTROUTE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_LINGER", SO_LINGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_BROADCAST", SO_BROADCAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_OOBINLINE", SO_OOBINLINE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_SNDBUF", SO_SNDBUF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_RCVBUF", SO_RCVBUF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_SNDLOWAT", SO_SNDLOWAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_RCVLOWAT", SO_RCVLOWAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_SNDTIMEO", SO_SNDTIMEO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_RCVTIMEO", SO_RCVTIMEO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_TYPE", SO_TYPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOL_SOCKET", SOL_SOCKET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOMAXCONN", SOMAXCONN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PHP_NORMAL_READ", PHP_NORMAL_READ, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PHP_BINARY_READ", PHP_BINARY_READ, CONST_CS | CONST_PERSISTENT);
-
-#ifndef WIN32
-# include "unix_socket_constants.h"
-#else
-# include "win32_socket_constants.h"
-#endif
-
- if ((pe = getprotobyname("tcp"))) {
- REGISTER_LONG_CONSTANT("SOL_TCP", pe->p_proto, CONST_CS | CONST_PERSISTENT);
- }
-
- if ((pe = getprotobyname("udp"))) {
- REGISTER_LONG_CONSTANT("SOL_UDP", pe->p_proto, CONST_CS | CONST_PERSISTENT);
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(sockets)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Sockets Support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION */
-PHP_RINIT_FUNCTION(sockets)
-{
- SOCKETS_G(strerror_buf) = emalloc(16384);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION */
-PHP_RSHUTDOWN_FUNCTION(sockets)
-{
- efree(SOCKETS_G(strerror_buf));
-
- return SUCCESS;
-}
-/* }}} */
-
-static int php_sock_array_to_fd_set(zval *sock_array, fd_set *fds, SOCKET *max_fd TSRMLS_DC)
-{
- zval **element;
- php_socket *php_sock;
-
- if (Z_TYPE_P(sock_array) != IS_ARRAY) return 0;
-
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(sock_array));
- zend_hash_get_current_data(Z_ARRVAL_P(sock_array), (void **) &element) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_P(sock_array))) {
-
- php_sock = (php_socket*) zend_fetch_resource(element TSRMLS_CC, -1, le_socket_name, NULL, 1, le_socket);
- if (!php_sock) continue; /* If element is not a resource, skip it */
-
- FD_SET(php_sock->bsd_socket, fds);
- if (php_sock->bsd_socket > *max_fd) {
- *max_fd = php_sock->bsd_socket;
- }
- }
-
- return 1;
-}
-
-static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds TSRMLS_DC)
-{
- zval **element;
- zval **dest_element;
- php_socket *php_sock;
- HashTable *new_hash;
-
- if (Z_TYPE_P(sock_array) != IS_ARRAY) return 0;
-
- ALLOC_HASHTABLE(new_hash);
- zend_hash_init(new_hash, 0, NULL, ZVAL_PTR_DTOR, 0);
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(sock_array));
- zend_hash_get_current_data(Z_ARRVAL_P(sock_array), (void **) &element) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_P(sock_array))) {
-
- php_sock = (php_socket*) zend_fetch_resource(element TSRMLS_CC, -1, le_socket_name, NULL, 1, le_socket);
- if (!php_sock) continue; /* If element is not a resource, skip it */
-
- if (FD_ISSET(php_sock->bsd_socket, fds)) {
- /* Add fd to new array */
- zend_hash_next_index_insert(new_hash, (void *)element, sizeof(zval *), (void **)&dest_element);
- if (dest_element) zval_add_ref(dest_element);
- }
- }
-
- /* Destroy old array, add new one */
- zend_hash_destroy(Z_ARRVAL_P(sock_array));
- efree(Z_ARRVAL_P(sock_array));
-
- zend_hash_internal_pointer_reset(new_hash);
- Z_ARRVAL_P(sock_array) = new_hash;
-
- return 1;
-}
-
-/* {{{ proto int socket_select(array &read_fds, array &write_fds, &array except_fds, int tv_sec[, int tv_usec])
- Runs the select() system call on the sets mentioned with a timeout specified by tv_sec and tv_usec */
-PHP_FUNCTION(socket_select)
-{
- zval *r_array, *w_array, *e_array, *sec;
- struct timeval tv;
- struct timeval *tv_p = NULL;
- fd_set rfds, wfds, efds;
- SOCKET max_fd = 0;
- int retval, sets = 0;
- long usec = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!a!z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE)
- return;
-
- FD_ZERO(&rfds);
- FD_ZERO(&wfds);
- FD_ZERO(&efds);
-
- if (r_array != NULL) sets += php_sock_array_to_fd_set(r_array, &rfds, &max_fd TSRMLS_CC);
- if (w_array != NULL) sets += php_sock_array_to_fd_set(w_array, &wfds, &max_fd TSRMLS_CC);
- if (e_array != NULL) sets += php_sock_array_to_fd_set(e_array, &efds, &max_fd TSRMLS_CC);
-
- if (!sets) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "no resource arrays were passed to select");
- RETURN_FALSE;
- }
-
- /* If seconds is not set to null, build the timeval, else we wait indefinitely */
- if (sec != NULL) {
- zval tmp;
-
- if (Z_TYPE_P(sec) != IS_LONG) {
- tmp = *sec;
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- sec = &tmp;
- }
- tv.tv_sec = Z_LVAL_P(sec);
- tv.tv_usec = usec;
- tv_p = &tv;
-
- if (sec == &tmp) {
- zval_dtor(&tmp);
- }
- }
-
- retval = select(max_fd+1, &rfds, &wfds, &efds, tv_p);
-
- if (retval == -1) {
- SOCKETS_G(last_error) = errno;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to select [%d]: %s", errno, php_strerror(errno TSRMLS_CC));
- RETURN_FALSE;
- }
-
- if (r_array != NULL) php_sock_array_from_fd_set(r_array, &rfds TSRMLS_CC);
- if (w_array != NULL) php_sock_array_from_fd_set(w_array, &wfds TSRMLS_CC);
- if (e_array != NULL) php_sock_array_from_fd_set(e_array, &efds TSRMLS_CC);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto resource socket_create_listen(int port[, int backlog])
- Opens a socket on port to accept connections */
-PHP_FUNCTION(socket_create_listen)
-{
- php_socket *php_sock;
- long port, backlog = 128;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &port, &backlog) == FAILURE)
- return;
-
- if (!php_open_listen_sock(&php_sock, port, backlog TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, php_sock, le_socket);
-}
-/* }}} */
-
-/* {{{ proto resource socket_accept(resource socket)
- Accepts a connection on the listening socket fd */
-PHP_FUNCTION(socket_accept)
-{
- zval *arg1;
- php_socket *php_sock, *new_sock;
- struct sockaddr_in sa;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
-
- if (!php_accept_connect(php_sock, &new_sock, (struct sockaddr *) &sa TSRMLS_CC)) {
- PHP_SOCKET_ERROR(new_sock, "unable to accept socket connection", errno);
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, new_sock, le_socket);
-}
-/* }}} */
-
-/* {{{ proto bool socket_set_nonblock(resource socket)
- Sets nonblocking mode on a socket resource */
-PHP_FUNCTION(socket_set_nonblock)
-{
- zval *arg1;
- php_socket *php_sock;
- int flags;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
-
- flags = fcntl(php_sock->bsd_socket, F_GETFL);
-
- /* Safely append non blocking to other flags unless the get fails.
- * Note: This does not abort on failure becuse getfl will always fail
- * under the current win32 code. */
- if (flags > -1) flags |= O_NONBLOCK;
- else flags = O_NONBLOCK;
-
- if (fcntl(php_sock->bsd_socket, F_SETFL, flags) > -1) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_set_block(resource socket)
- Sets blocking mode on a socket resource */
-PHP_FUNCTION(socket_set_block)
-{
- zval *arg1;
- php_socket *php_sock;
- int flags;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
-
- flags = fcntl(php_sock->bsd_socket, F_GETFL);
-
- /* Safely remove blocking from flags unless the get fails.
- * Note: This does not abort on failure becuse getfl will always fail
- * under the current win32 code. */
- if (flags > -1) flags &= ~O_NONBLOCK;
- else flags = 0;
-
- if (fcntl(php_sock->bsd_socket, F_SETFL, flags) > -1) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_listen(resource socket[, int backlog])
- Sets the maximum number of connections allowed to be waited for on the socket specified by fd */
-PHP_FUNCTION(socket_listen)
-{
- zval *arg1;
- php_socket *php_sock;
- long backlog = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1, &backlog) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
-
- if (listen(php_sock->bsd_socket, backlog) != 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to listen on socket", errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void socket_close(resource socket)
- Closes a file descriptor */
-PHP_FUNCTION(socket_close)
-{
- zval *arg1;
- php_socket *php_sock;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
- zend_list_delete(Z_RESVAL_P(arg1));
-}
-/* }}} */
-
-/* {{{ proto int socket_write(resource socket, string buf[, int length])
- Writes the buffer to the socket resource, length is optional */
-PHP_FUNCTION(socket_write)
-{
- zval *arg1;
- php_socket *php_sock;
- int retval, str_len;
- long length;
- char *str;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &str, &str_len, &length) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
-
- if (ZEND_NUM_ARGS() < 3) {
- length = str_len;
- }
-
-#ifndef PHP_WIN32
- retval = write(php_sock->bsd_socket, str, MIN(length, str_len));
-#else
- retval = send(php_sock->bsd_socket, str, min(length, str_len), 0);
-#endif
-
- if (retval < 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to write to socket", errno);
- RETURN_FALSE;
- }
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto string socket_read(resource socket, int length [, int type])
- Reads a maximum of length bytes from socket */
-PHP_FUNCTION(socket_read)
-{
- zval *arg1;
- php_socket *php_sock;
- char *tmpbuf;
- int retval;
- long length, type = PHP_BINARY_READ;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &arg1, &length, &type) == FAILURE)
- return;
-
- tmpbuf = emalloc(length + 1);
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
-
- if (type == PHP_NORMAL_READ) {
- retval = php_read(php_sock->bsd_socket, tmpbuf, length, 0);
- } else {
- retval = recv(php_sock->bsd_socket, tmpbuf, length, 0);
- }
-
- if (retval == -1) {
- PHP_SOCKET_ERROR(php_sock, "unable to read from socket", errno);
- efree(tmpbuf);
- RETURN_FALSE;
- }
-
- tmpbuf = erealloc(tmpbuf, retval + 1);
- tmpbuf[retval] = '\0' ;
-
- RETURN_STRINGL(tmpbuf, retval, 0);
-}
-/* }}} */
-
-/* {{{ proto bool socket_getsockname(resource socket, string &addr[, int &port])
- Queries the remote side of the given socket which may either result in host/port or in a UNIX filesystem path, dependent on its type. */
-PHP_FUNCTION(socket_getsockname)
-{
- zval *arg1, *addr, *port = NULL;
- php_sockaddr_storage sa_storage;
- php_socket *php_sock;
- struct sockaddr *sa;
- struct sockaddr_in *sin;
-#ifdef HAVE_IPV6
- struct sockaddr_in6 *sin6;
- char addr6[INET6_ADDRSTRLEN+1];
-#endif
- struct sockaddr_un *s_un;
- char *addr_string;
- socklen_t salen = sizeof(php_sockaddr_storage);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|z", &arg1, &addr, &port) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
-
- sa = (struct sockaddr *) &sa_storage;
-
- if (getsockname(php_sock->bsd_socket, sa, &salen) != 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to retrieve socket name", errno);
- RETURN_FALSE;
- }
-
- switch (sa->sa_family) {
-#ifdef HAVE_IPV6
- case AF_INET6:
- sin6 = (struct sockaddr_in6 *) sa;
- inet_ntop(AF_INET6, &sin6->sin6_addr, addr6, INET6_ADDRSTRLEN);
- zval_dtor(addr);
- ZVAL_STRING(addr, addr6, 1);
-
- if (port != NULL) {
- zval_dtor(port);
- ZVAL_LONG(port, htons(sin6->sin6_port));
- }
- RETURN_TRUE;
- break;
-#endif
- case AF_INET:
- sin = (struct sockaddr_in *) sa;
- while (inet_ntoa_lock == 1);
- inet_ntoa_lock = 1;
- addr_string = inet_ntoa(sin->sin_addr);
- inet_ntoa_lock = 0;
-
- zval_dtor(addr);
- ZVAL_STRING(addr, addr_string, 1);
-
- if (port != NULL) {
- zval_dtor(port);
- ZVAL_LONG(port, htons(sin->sin_port));
- }
- RETURN_TRUE;
- break;
-
- case AF_UNIX:
- s_un = (struct sockaddr_un *) sa;
-
- zval_dtor(addr);
- ZVAL_STRING(addr, s_un->sun_path, 1);
- RETURN_TRUE;
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported address family %d", sa->sa_family);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool socket_getpeername(resource socket, string &addr[, int &port])
- Queries the remote side of the given socket which may either result in host/port or in a UNIX filesystem path, dependent on its type. */
-PHP_FUNCTION(socket_getpeername)
-{
- zval *arg1, *arg2, *arg3 = NULL;
- php_sockaddr_storage sa_storage;
- php_socket *php_sock;
- struct sockaddr *sa;
- struct sockaddr_in *sin;
-#ifdef HAVE_IPV6
- struct sockaddr_in6 *sin6;
- char addr6[INET6_ADDRSTRLEN+1];
-#endif
- struct sockaddr_un *s_un;
- char *addr_string;
- socklen_t salen = sizeof(php_sockaddr_storage);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|z", &arg1, &arg2, &arg3) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
-
- sa = (struct sockaddr *) &sa_storage;
-
- if (getpeername(php_sock->bsd_socket, sa, &salen) < 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to retrieve peer name", errno);
- RETURN_FALSE;
- }
-
- switch (sa->sa_family) {
-#ifdef HAVE_IPV6
- case AF_INET6:
- sin6 = (struct sockaddr_in6 *) sa;
- inet_ntop(AF_INET6, &sin6->sin6_addr, addr6, INET6_ADDRSTRLEN);
- zval_dtor(arg2);
- ZVAL_STRING(arg2, addr6, 1);
-
- if (arg3 != NULL) {
- zval_dtor(arg3);
- ZVAL_LONG(arg3, htons(sin6->sin6_port));
- }
-
- RETURN_TRUE;
- break;
-#endif
- case AF_INET:
- sin = (struct sockaddr_in *) sa;
- while (inet_ntoa_lock == 1);
- inet_ntoa_lock = 1;
- addr_string = inet_ntoa(sin->sin_addr);
- inet_ntoa_lock = 0;
-
- zval_dtor(arg2);
- ZVAL_STRING(arg2, addr_string, 1);
-
- if (arg3 != NULL) {
- zval_dtor(arg3);
- ZVAL_LONG(arg3, htons(sin->sin_port));
- }
-
- RETURN_TRUE;
- break;
-
- case AF_UNIX:
- s_un = (struct sockaddr_un *) sa;
-
- zval_dtor(arg2);
- ZVAL_STRING(arg2, s_un->sun_path, 1);
- RETURN_TRUE;
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported address family %d", sa->sa_family);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto resource socket_create(int domain, int type, int protocol)
- Creates an endpoint for communication in the domain specified by domain, of type specified by type */
-PHP_FUNCTION(socket_create)
-{
- long arg1, arg2, arg3;
- php_socket *php_sock = (php_socket*)emalloc(sizeof(php_socket));
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &arg1, &arg2, &arg3) == FAILURE) {
- efree(php_sock);
- return;
- }
-
- if (arg1 != AF_UNIX
-#ifdef HAVE_IPV6
- && arg1 != AF_INET6
-#endif
- && arg1 != AF_INET) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid socket domain [%d] specified for argument 1, assuming AF_INET", arg1);
- arg1 = AF_INET;
- }
-
- if (arg2 > 10) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid socket type [%d] specified for argument 2, assuming SOCK_STREAM", arg2);
- arg2 = SOCK_STREAM;
- }
-
- php_sock->bsd_socket = socket(arg1, arg2, arg3);
- php_sock->type = arg1;
-
- if (IS_INVALID_SOCKET(php_sock)) {
- SOCKETS_G(last_error) = errno;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create socket [%d]: %s", errno, php_strerror(errno TSRMLS_CC));
- efree(php_sock);
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, php_sock, le_socket);
-}
-/* }}} */
-
-/* {{{ proto bool socket_connect(resource socket, string addr [, int port])
- Opens a connection to addr:port on the socket specified by socket */
-PHP_FUNCTION(socket_connect)
-{
- zval *arg1;
- php_socket *php_sock;
- struct sockaddr_in sin;
-#ifdef HAVE_IPV6
- struct sockaddr_in6 sin6;
-#endif
- struct sockaddr_un s_un;
- char *addr;
- int retval, addr_len;
- long port;
- int argc = ZEND_NUM_ARGS();
-
- if (zend_parse_parameters(argc TSRMLS_CC, "rs|l", &arg1, &addr, &addr_len, &port) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
-
- switch(php_sock->type) {
-#ifdef HAVE_IPV6
- case AF_INET6:
- if (argc != 3) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Socket of type AF_INET6 requires 3 arguments");
- RETURN_FALSE;
- }
-
- sin6.sin6_family = AF_INET6;
- sin6.sin6_port = htons((unsigned short int)port);
-
- if (! php_set_inet6_addr(&sin6, addr, php_sock TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- retval = connect(php_sock->bsd_socket, (struct sockaddr *)&sin6, sizeof(struct sockaddr_in6));
- break;
-#endif
- case AF_INET:
- if (argc != 3) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Socket of type AF_INET requires 3 arguments");
- RETURN_FALSE;
- }
-
- sin.sin_family = AF_INET;
- sin.sin_port = htons((unsigned short int)port);
-
- if (! php_set_inet_addr(&sin, addr, php_sock TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- retval = connect(php_sock->bsd_socket, (struct sockaddr *)&sin, sizeof(struct sockaddr_in));
- break;
-
- case AF_UNIX:
- s_un.sun_family = AF_UNIX;
- snprintf(s_un.sun_path, 108, "%s", addr);
- retval = connect(php_sock->bsd_socket, (struct sockaddr *) &s_un, SUN_LEN(&s_un));
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported socket type %d", php_sock->type);
- RETURN_FALSE;
- }
-
- if (retval != 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to connect", errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string socket_strerror(int errno)
- Returns a string describing an error */
-PHP_FUNCTION(socket_strerror)
-{
- long arg1;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg1) == FAILURE)
- return;
-
- RETURN_STRING(php_strerror(arg1 TSRMLS_CC), 1);
-}
-/* }}} */
-
-/* {{{ proto bool socket_bind(resource socket, string addr [, int port])
- Binds an open socket to a listening port, port is only specified in AF_INET family. */
-PHP_FUNCTION(socket_bind)
-{
- zval *arg1;
- php_sockaddr_storage sa_storage;
- struct sockaddr *sock_type = (struct sockaddr*) &sa_storage;
- php_socket *php_sock;
- char *addr;
- int addr_len;
- long port = 0;
- long retval = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &addr, &addr_len, &port) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
-
- switch(php_sock->type) {
- case AF_UNIX:
- {
- struct sockaddr_un *sa = (struct sockaddr_un *) sock_type;
- memset(sa, 0, sizeof(sa_storage));
- sa->sun_family = AF_UNIX;
- snprintf(sa->sun_path, 108, "%s", addr);
- retval = bind(php_sock->bsd_socket, (struct sockaddr *) sa, SUN_LEN(sa));
- break;
- }
-
- case AF_INET:
- {
- struct sockaddr_in *sa = (struct sockaddr_in *) sock_type;
-
- memset(sa, 0, sizeof(sa_storage)); /* Apparently, Mac OSX needs this */
-
- sa->sin_family = AF_INET;
- sa->sin_port = htons((unsigned short) port);
-
- if (! php_set_inet_addr(sa, addr, php_sock TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- retval = bind(php_sock->bsd_socket, (struct sockaddr *)sa, sizeof(struct sockaddr_in));
- break;
- }
-#ifdef HAVE_IPV6
- case AF_INET6:
- {
- struct sockaddr_in6 *sa = (struct sockaddr_in6 *) sock_type;
-
- memset(sa, 0, sizeof(sa_storage)); /* Apparently, Mac OSX needs this */
-
- sa->sin6_family = AF_INET6;
- sa->sin6_port = htons((unsigned short) port);
-
- if (! php_set_inet6_addr(sa, addr, php_sock TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- retval = bind(php_sock->bsd_socket, (struct sockaddr *)sa, sizeof(struct sockaddr_in6));
- break;
- }
-#endif
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unsupported socket type '%d', must be AF_UNIX, AF_INET, or AF_INET6", php_sock->type);
- RETURN_FALSE;
- }
-
- if (retval != 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to bind address", errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto resource socket_iovec_alloc(int num_vectors [, int ...])
- Builds a 'struct iovec' for use with sendmsg, recvmsg, writev, and readv */
-/* First parameter is number of vectors, each additional parameter is the
- length of the vector to create.
- */
-PHP_FUNCTION(socket_iovec_alloc)
-{
- zval ***args = (zval ***)NULL;
- php_iovec_t *vector;
- struct iovec *vector_array;
- int i, j, num_vectors, argc = ZEND_NUM_ARGS();
-
- args = emalloc(argc*sizeof(zval**));
-
- if (argc < 1 || zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(args[0]);
- num_vectors = Z_LVAL_PP(args[0]);
-
- vector_array = emalloc(sizeof(struct iovec)*(num_vectors+1));
-
- for (i = 0, j = 1; i < num_vectors; i++, j++) {
- convert_to_long_ex(args[j]);
-
- vector_array[i].iov_base = (char*)emalloc(Z_LVAL_PP(args[j]));
- vector_array[i].iov_len = Z_LVAL_PP(args[j]);
- }
-
- efree(args);
-
- vector = emalloc(sizeof(php_iovec_t));
- vector->iov_array = vector_array;
- vector->count = num_vectors;
-
- ZEND_REGISTER_RESOURCE(return_value, vector, le_iov);
-}
-/* }}} */
-
-/* {{{ proto string socket_iovec_fetch(resource iovec, int iovec_position)
- Returns the data held in the iovec specified by iovec_id[iovec_position] */
-PHP_FUNCTION(socket_iovec_fetch)
-{
- zval *iovec_id;
- php_iovec_t *vector;
- unsigned long iovec_position;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &iovec_id, &iovec_position) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(vector, php_iovec_t *, &iovec_id, -1, le_iov_name, le_iov);
-
- if (iovec_position >= vector->count) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "can't access a vector position past the amount of vectors set in the array");
- RETURN_EMPTY_STRING();
- }
-
- RETURN_STRINGL(vector->iov_array[iovec_position].iov_base, vector->iov_array[iovec_position].iov_len, 1);
-}
-/* }}} */
-
-/* {{{ proto bool socket_iovec_set(resource iovec, int iovec_position, string new_val)
- Sets the data held in iovec_id[iovec_position] to new_val */
-PHP_FUNCTION(socket_iovec_set)
-{
- zval *iovec_id;
- php_iovec_t *vector;
- int new_val_len;
- unsigned long iovec_position;
- char *new_val;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls", &iovec_id, &iovec_position, &new_val, &new_val_len) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(vector, php_iovec_t *, &iovec_id, -1, le_iov_name, le_iov);
-
- if (iovec_position >= vector->count) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "can't access a vector position outside of the vector array bounds");
- RETURN_FALSE;
- }
-
- if (vector->iov_array[iovec_position].iov_base) {
- efree(vector->iov_array[iovec_position].iov_base);
- }
-
- vector->iov_array[iovec_position].iov_base = estrdup(new_val);
- vector->iov_array[iovec_position].iov_len = strlen(new_val);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_iovec_add(resource iovec, int iov_len)
- Adds a new vector to the scatter/gather array */
-PHP_FUNCTION(socket_iovec_add)
-{
- zval *iovec_id;
- php_iovec_t *vector;
- struct iovec *vector_array;
- long iov_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &iovec_id, &iov_len) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(vector, php_iovec_t *, &iovec_id, -1, le_iov_name, le_iov);
-
- vector_array = (struct iovec*)emalloc(sizeof(struct iovec) * (vector->count + 2));
- memcpy(vector_array, vector->iov_array, sizeof(struct iovec) * vector->count);
-
- vector_array[vector->count].iov_base = (char*)emalloc(iov_len);
- vector_array[vector->count].iov_len = iov_len;
- efree(vector->iov_array);
- vector->iov_array = vector_array;
- vector->count++;
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto bool socket_iovec_delete(resource iovec, int iov_pos)
- Deletes a vector from an array of vectors */
-PHP_FUNCTION(socket_iovec_delete)
-{
- zval *iovec_id;
- php_iovec_t *vector;
- struct iovec *vector_array;
- unsigned int i;
- unsigned long iov_pos;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &iovec_id, &iov_pos) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(vector, php_iovec_t *, &iovec_id, -1, le_iov_name, le_iov);
-
- if (iov_pos > vector->count) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "can't delete an IO vector that is out of array bounds");
- RETURN_FALSE;
- }
-
- vector_array = emalloc(vector->count * sizeof(struct iovec));
-
- for (i = 0; i < vector->count; i++) {
- if (i < iov_pos) {
- memcpy(&(vector->iov_array[i]), &(vector_array[i]), sizeof(struct iovec));
- } else if (i > iov_pos) {
- memcpy(&(vector->iov_array[i]), &(vector_array[i - 1]), sizeof(struct iovec));
- }
- }
-
- efree(vector->iov_array);
- vector->iov_array = vector_array;
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto bool socket_iovec_free(resource iovec)
- Frees the iovec specified by iovec_id */
-PHP_FUNCTION(socket_iovec_free)
-{
- zval *iovec_id;
- php_iovec_t *vector;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &iovec_id) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(vector, php_iovec_t *, &iovec_id, -1, le_iov_name, le_iov);
-
- zend_list_delete(Z_RESVAL_P(iovec_id));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_readv(resource socket, resource iovec_id)
- Reads from an fd, using the scatter-gather array defined by iovec_id */
-PHP_FUNCTION(socket_readv)
-{
- zval *arg1, *arg2;
- php_iovec_t *vector;
- php_socket *php_sock;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &arg1, &arg2) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
- ZEND_FETCH_RESOURCE(vector, php_iovec_t *, &arg2, -1, le_iov_name, le_iov);
-
- if (readv(php_sock->bsd_socket, vector->iov_array, vector->count) != 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to read from socket", errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_writev(resource socket, resource iovec_id)
- Writes to a file descriptor, fd, using the scatter-gather array defined by iovec_id */
-PHP_FUNCTION(socket_writev)
-{
- zval *arg1, *arg2;
- php_iovec_t *vector;
- php_socket *php_sock;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &arg1, &arg2) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
- ZEND_FETCH_RESOURCE(vector, php_iovec_t *, &arg2, -1, le_iov_name, le_iov);
-
- if (writev(php_sock->bsd_socket, vector->iov_array, vector->count) != 0) {
- PHP_SOCKET_ERROR(php_sock, "Unable to write to socket", errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int socket_recv(resource socket, string &buf, int len, int flags)
- Receives data from a connected socket */
-PHP_FUNCTION(socket_recv)
-{
- zval *php_sock_res, *buf;
- char *recv_buf;
- php_socket *php_sock;
- int retval;
- long len, flags;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzll", &php_sock_res, &buf, &len, &flags) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &php_sock_res, -1, le_socket_name, le_socket);
-
- recv_buf = emalloc(len + 1);
- memset(recv_buf, 0, len + 1);
-
- if ((retval = recv(php_sock->bsd_socket, recv_buf, len, flags)) < 1) {
- efree(recv_buf);
-
- zval_dtor(buf);
- Z_TYPE_P(buf) = IS_NULL;
- } else {
- recv_buf[retval] = '\0';
-
- /* Rebuild buffer zval */
- zval_dtor(buf);
-
- Z_STRVAL_P(buf) = recv_buf;
- Z_STRLEN_P(buf) = retval;
- Z_TYPE_P(buf) = IS_STRING;
- }
-
- if (retval == -1) {
- PHP_SOCKET_ERROR(php_sock, "unable to read from socket", errno);
- RETURN_FALSE;
- }
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int socket_send(resource socket, string buf, int len, int flags)
- Sends data to a connected socket */
-PHP_FUNCTION(socket_send)
-{
- zval *arg1;
- php_socket *php_sock;
- int buf_len, retval;
- long len, flags;
- char *buf;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsll", &arg1, &buf, &buf_len, &len, &flags) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
-
- retval = send(php_sock->bsd_socket, buf, (buf_len < len ? buf_len : len), flags);
-
- if (retval == -1) {
- PHP_SOCKET_ERROR(php_sock, "unable to write to socket", errno);
- RETURN_FALSE;
- }
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int socket_recvfrom(resource socket, string &buf, int len, int flags, string &name [, int &port])
- Receives data from a socket, connected or not */
-PHP_FUNCTION(socket_recvfrom)
-{
- zval *arg1, *arg2, *arg5, *arg6 = NULL;
- php_socket *php_sock;
- struct sockaddr_un s_un;
- struct sockaddr_in sin;
-#ifdef HAVE_IPV6
- struct sockaddr_in6 sin6;
- char addr6[INET6_ADDRSTRLEN];
-#endif
- socklen_t slen;
- int retval;
- long arg3, arg4;
- char *recv_buf, *address;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzllz|z", &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
-
- recv_buf = emalloc(arg3 + 2);
- memset(recv_buf, 0, arg3 + 2);
-
- switch (php_sock->type) {
- case AF_UNIX:
- slen = sizeof(s_un);
- s_un.sun_family = AF_UNIX;
- retval = recvfrom(php_sock->bsd_socket, recv_buf, arg3, arg4, (struct sockaddr *)&s_un, (socklen_t *)&slen);
-
- if (retval < 0) {
- efree(recv_buf);
- PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
- RETURN_FALSE;
- }
-
- zval_dtor(arg2);
- zval_dtor(arg5);
-
- ZVAL_STRINGL(arg2, recv_buf, retval, 0);
- ZVAL_STRING(arg5, s_un.sun_path, 1);
- break;
-
- case AF_INET:
- slen = sizeof(sin);
- memset(&sin, 0, slen);
- sin.sin_family = AF_INET;
-
- if (arg6 == NULL) {
- WRONG_PARAM_COUNT;
- }
-
- retval = recvfrom(php_sock->bsd_socket, recv_buf, arg3, arg4, (struct sockaddr *)&sin, (socklen_t *)&slen);
-
- if (retval < 0) {
- efree(recv_buf);
- PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
- RETURN_FALSE;
- }
-
- zval_dtor(arg2);
- zval_dtor(arg5);
- zval_dtor(arg6);
-
- address = inet_ntoa(sin.sin_addr);
-
- ZVAL_STRINGL(arg2, recv_buf, retval, 0);
- ZVAL_STRING(arg5, address ? address : "0.0.0.0", 1);
- ZVAL_LONG(arg6, ntohs(sin.sin_port));
- break;
-#ifdef HAVE_IPV6
- case AF_INET6:
- slen = sizeof(sin6);
- memset(&sin6, 0, slen);
- sin6.sin6_family = AF_INET6;
-
- if (arg6 == NULL) {
- WRONG_PARAM_COUNT;
- }
-
- retval = recvfrom(php_sock->bsd_socket, recv_buf, arg3, arg4, (struct sockaddr *)&sin6, (socklen_t *)&slen);
-
- if (retval < 0) {
- efree(recv_buf);
- PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
- RETURN_FALSE;
- }
-
- zval_dtor(arg2);
- zval_dtor(arg5);
- zval_dtor(arg6);
-
- inet_ntop(AF_INET6, &sin6.sin6_addr, addr6, INET6_ADDRSTRLEN);
-
- ZVAL_STRINGL(arg2, recv_buf, retval, 0);
- ZVAL_STRING(arg5, addr6 ? addr6 : "::", 1);
- ZVAL_LONG(arg6, ntohs(sin6.sin6_port));
- break;
-#endif
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported socket type %d", php_sock->type);
- RETURN_FALSE;
- }
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int socket_sendto(resource socket, string buf, int len, int flags, string addr [, int port])
- Sends a message to a socket, whether it is connected or not */
-PHP_FUNCTION(socket_sendto)
-{
- zval *arg1;
- php_socket *php_sock;
- struct sockaddr_un s_un;
- struct sockaddr_in sin;
-#ifdef HAVE_IPV6
- struct sockaddr_in6 sin6;
-#endif
- int retval, buf_len, addr_len;
- long len, flags, port = 0;
- char *buf, *addr;
- int argc = ZEND_NUM_ARGS();
-
- if (zend_parse_parameters(argc TSRMLS_CC, "rslls|l", &arg1, &buf, &buf_len, &len, &flags, &addr, &addr_len, &port) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
-
-
- switch (php_sock->type) {
- case AF_UNIX:
- memset(&s_un, 0, sizeof(s_un));
- s_un.sun_family = AF_UNIX;
- snprintf(s_un.sun_path, 108, "%s", addr);
-
- retval = sendto(php_sock->bsd_socket, buf, (len > buf_len) ? buf_len : len, flags, (struct sockaddr *) &s_un, SUN_LEN(&s_un));
- break;
-
- case AF_INET:
- if (argc != 6) {
- WRONG_PARAM_COUNT;
- }
-
- memset(&sin, 0, sizeof(sin));
- sin.sin_family = AF_INET;
- sin.sin_port = htons((unsigned short) port);
-
- if (! php_set_inet_addr(&sin, addr, php_sock TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- retval = sendto(php_sock->bsd_socket, buf, (len > buf_len) ? buf_len : len, flags, (struct sockaddr *) &sin, sizeof(sin));
- break;
-#ifdef HAVE_IPV6
- case AF_INET6:
- if (argc != 6) {
- WRONG_PARAM_COUNT;
- }
-
- memset(&sin6, 0, sizeof(sin6));
- sin6.sin6_family = AF_INET6;
- sin6.sin6_port = htons((unsigned short) port);
-
- if (! php_set_inet6_addr(&sin6, addr, php_sock TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- retval = sendto(php_sock->bsd_socket, buf, (len > buf_len) ? buf_len : len, flags, (struct sockaddr *) &sin, sizeof(sin));
- break;
-#endif
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported socket type %d", php_sock->type);
- RETURN_FALSE;
- }
-
- if (retval == -1) {
- PHP_SOCKET_ERROR(php_sock, "unable to write to socket", errno);
- RETURN_FALSE;
- }
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto bool socket_recvmsg(resource socket, resource iovec, array &control, int &controllen, int &flags, string &addr [, int &port])
- Used to receive messages on a socket, whether connection-oriented or not */
-#ifdef HAVE_CMSGHDR
-PHP_FUNCTION(socket_recvmsg)
-{
- zval *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7 = NULL;
- php_iovec_t *iov;
- struct msghdr hdr;
- php_sockaddr_storage sa_storage;
- php_socket *php_sock;
- struct cmsghdr *ctl_buf;
- struct sockaddr *sa = (struct sockaddr *) &sa_storage;
- struct sockaddr_in *sin = (struct sockaddr_in *) sa;
-#ifdef HAVE_IPV6
- struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa;
-#endif
- struct sockaddr_un *s_un = (struct sockaddr_un *) sa;
- socklen_t salen = sizeof(sa_storage);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrzzzz|z", &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
- ZEND_FETCH_RESOURCE(iov, php_iovec_t *, &arg2, -1, le_iov_name, le_iov);
-
- if (getsockname(php_sock->bsd_socket, sa, &salen) != 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to receive message", errno);
- RETURN_FALSE;
- }
-
- ctl_buf = (Z_LVAL_P(arg4) > sizeof(struct cmsghdr)) ? (struct cmsghdr*)emalloc(Z_LVAL_P(arg4)) : NULL;
-
- switch (sa->sa_family) {
-#ifdef HAVE_IPV6
- case AF_INET6:
-
- if (arg7 == NULL) {
- efree(ctl_buf);
- WRONG_PARAM_COUNT;
- }
-
- memset(sa, 0, sizeof(sa_storage));
- hdr.msg_name = (void *) sin6;
- hdr.msg_namelen = sizeof(sa_storage);
- hdr.msg_iov = iov->iov_array;
- hdr.msg_iovlen = iov->count;
-
- hdr.msg_control = ctl_buf ? (void *) ctl_buf : NULL;
- hdr.msg_controllen = ctl_buf ? Z_LVAL_P(arg4) : 0;
-#ifndef MISSING_MSGHDR_MSGFLAGS
- hdr.msg_flags = 0;
-#endif
-
- if (recvmsg(php_sock->bsd_socket, &hdr, Z_LVAL_P(arg5)) < 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to receive message", errno);
- RETURN_FALSE;
- } else {
- struct cmsghdr *mhdr = (struct cmsghdr *) hdr.msg_control;
-
- zval_dtor(arg3);
- zval_dtor(arg4);
- zval_dtor(arg5);
- zval_dtor(arg6);
- zval_dtor(arg7);
-
- ZVAL_LONG(arg4, hdr.msg_controllen);
-#ifndef MISSING_MSGHDR_MSGFLAGS
- ZVAL_LONG(arg5, hdr.msg_flags);
-#endif
- ZVAL_LONG(arg7, ntohs(sin6->sin6_port));
-
- array_init(arg3);
-
- if (mhdr != NULL) {
- add_assoc_long(arg3, "cmsg_level", mhdr->cmsg_level);
- add_assoc_long(arg3, "cmsg_type", mhdr->cmsg_type);
- add_assoc_string(arg3, "cmsg_data", CMSG_DATA(mhdr), 1);
- }
-
- {
- char tmp[INET6_ADDRSTRLEN+1];
- if (inet_ntop(AF_INET6, &sin6->sin6_addr, tmp, INET6_ADDRSTRLEN)) {
- ZVAL_STRING(arg6, tmp, 1);
- } else {
- ZVAL_STRING(arg6, "::", 1);
- }
- }
-
- RETURN_TRUE;
- }
- break;
-#endif
- case AF_INET:
-
- if (arg7 == NULL) {
- efree(ctl_buf);
- WRONG_PARAM_COUNT;
- }
-
- memset(sa, 0, sizeof(sa_storage));
- hdr.msg_name = (void *) sin;
- hdr.msg_namelen = sizeof(sa_storage);
- hdr.msg_iov = iov->iov_array;
- hdr.msg_iovlen = iov->count;
-
- hdr.msg_control = ctl_buf ? (void *) ctl_buf : NULL;
- hdr.msg_controllen = ctl_buf ? Z_LVAL_P(arg4) : 0;
-#ifndef MISSING_MSGHDR_MSGFLAGS
- hdr.msg_flags = 0;
-#endif
-
- if (recvmsg(php_sock->bsd_socket, &hdr, Z_LVAL_P(arg5)) < 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to receive message", errno);
- RETURN_FALSE;
- } else {
- struct cmsghdr *mhdr = (struct cmsghdr *) hdr.msg_control;
-
- zval_dtor(arg3);
- zval_dtor(arg4);
- zval_dtor(arg5);
- zval_dtor(arg6);
- zval_dtor(arg7);
-
- ZVAL_LONG(arg4, hdr.msg_controllen);
-#ifndef MISSING_MSGHDR_MSGFLAGS
- ZVAL_LONG(arg5, hdr.msg_flags);
-#endif
- ZVAL_LONG(arg7, ntohs(sin->sin_port));
-
- array_init(arg3);
-
- if (mhdr != NULL) {
- add_assoc_long(arg3, "cmsg_level", mhdr->cmsg_level);
- add_assoc_long(arg3, "cmsg_type", mhdr->cmsg_type);
- add_assoc_string(arg3, "cmsg_data", CMSG_DATA(mhdr), 1);
- }
-
- {
- char *tmp = inet_ntoa(sin->sin_addr);
- if (tmp == NULL) {
- ZVAL_STRING(arg6, "0.0.0.0", 1);
- } else {
- ZVAL_STRING(arg6, tmp, 1);
- }
- }
-
- RETURN_TRUE;
- }
- break;
-
- case AF_UNIX:
- memset(sa, 0, sizeof(sa_storage));
- hdr.msg_name = (void *) s_un;
- hdr.msg_namelen = sizeof(struct sockaddr_un);
- hdr.msg_iov = iov->iov_array;
- hdr.msg_iovlen = iov->count;
-
- if (ctl_buf) {
- hdr.msg_control = (void *) ctl_buf;
- hdr.msg_controllen = Z_LVAL_P(arg4);
- } else {
- hdr.msg_control = NULL;
- hdr.msg_controllen = 0;
- }
-#ifndef MISSING_MSGHDR_MSGFLAGS
- hdr.msg_flags = 0;
-#endif
-
-
- if (recvmsg(php_sock->bsd_socket, &hdr, Z_LVAL_P(arg5)) != 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to receive message", errno);
- RETURN_FALSE;
- } else {
- struct cmsghdr *mhdr = (struct cmsghdr *) hdr.msg_control;
-
- if (mhdr != NULL) {
-
- zval_dtor(arg3);
- zval_dtor(arg4);
- zval_dtor(arg5);
- zval_dtor(arg6);
-
- ZVAL_LONG(arg4, hdr.msg_controllen);
-#ifndef MISSING_MSGHDR_MSGFLAGS
- ZVAL_LONG(arg5, hdr.msg_flags);
-#endif
-
- array_init(arg3);
-
- add_assoc_long(arg3, "cmsg_level", mhdr->cmsg_level);
- add_assoc_long(arg3, "cmsg_type", mhdr->cmsg_type);
- add_assoc_string(arg3, "cmsg_data", CMSG_DATA(mhdr), 1);
- }
-
-
- ZVAL_STRING(arg6, s_un->sun_path, 1);
- RETURN_TRUE;
- }
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported address family %d", sa->sa_family);
- RETURN_FALSE;
- }
-}
-#endif
-/* }}} */
-
-/* {{{ proto bool socket_sendmsg(resource socket, resource iovec, int flags, string addr [, int port])
- Sends a message to a socket, regardless of whether it is connection-oriented or not */
-PHP_FUNCTION(socket_sendmsg)
-{
- zval *arg1, *arg2;
- php_iovec_t *iov;
- php_socket *php_sock;
- struct sockaddr sa;
- char *addr;
- socklen_t salen;
- int addr_len;
- long flags, port;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrls|l", &arg1, &arg2, &flags, &addr, &addr_len, &port) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
- ZEND_FETCH_RESOURCE(iov, php_iovec_t *, &arg2, -1, le_iov_name, le_iov);
-
- salen = sizeof(sa);
- if (getsockname(php_sock->bsd_socket, &sa, &salen) != 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to send messge", errno);
- RETURN_FALSE;
- }
-
- switch(sa.sa_family) {
-#ifdef HAVE_IPV6
- case AF_INET6:
- {
- struct msghdr hdr;
- struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) &sa;
-
- set_h_errno(0);
- set_errno(0);
-
- memset(&hdr, 0, sizeof(hdr));
- hdr.msg_name = (void *) &sa;
- hdr.msg_namelen = sizeof(sa);
- hdr.msg_iov = iov->iov_array;
- hdr.msg_iovlen = iov->count;
-
- memset(sin6, 0, sizeof(sa));
-
- sin6->sin6_family = AF_INET6;
- sin6->sin6_port = htons((unsigned short)port);
-
- if (! php_set_inet6_addr(sin6, addr, php_sock TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if (sendmsg(php_sock->bsd_socket, &hdr, flags) == -1) {
- PHP_SOCKET_ERROR(php_sock, "unable to send message", errno);
- }
-
- RETURN_TRUE;
- }
- break;
-#endif
- case AF_INET:
- {
- struct msghdr hdr;
- struct sockaddr_in *sin = (struct sockaddr_in *) &sa;
-
- set_h_errno(0);
- set_errno(0);
-
- memset(&hdr, 0, sizeof(hdr));
- hdr.msg_name = (void *) &sa;
- hdr.msg_namelen = sizeof(sa);
- hdr.msg_iov = iov->iov_array;
- hdr.msg_iovlen = iov->count;
-
- memset(sin, 0, sizeof(sa));
-
- sin->sin_family = AF_INET;
- sin->sin_port = htons((unsigned short)port);
-
- if (! php_set_inet_addr(sin, addr, php_sock TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if (sendmsg(php_sock->bsd_socket, &hdr, flags) == -1) {
- PHP_SOCKET_ERROR(php_sock, "unable to send message", errno);
- }
-
- RETURN_TRUE;
- }
- break;
-
- case AF_UNIX:
- {
- struct msghdr hdr;
- struct sockaddr_un *s_un = (struct sockaddr_un *) &sa;
-
- set_errno(0);
-
- hdr.msg_name = (void *) s_un;
- hdr.msg_iov = iov->iov_array;
- hdr.msg_iovlen = iov->count;
-
- snprintf(s_un->sun_path, 108, "%s", addr);
-
- hdr.msg_namelen = SUN_LEN(s_un);
-
- if (sendmsg(php_sock->bsd_socket, &hdr, flags) == -1) {
- PHP_SOCKET_ERROR(php_sock, "unable to send message", errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
- }
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported address family %d", sa.sa_family);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto mixed socket_get_option(resource socket, int level, int optname)
- Gets socket options for the socket */
-PHP_FUNCTION(socket_get_option)
-{
- zval *arg1;
- struct linger linger_val;
- struct timeval tv;
- socklen_t optlen;
- php_socket *php_sock;
- int other_val;
- long level, optname;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &arg1, &level, &optname) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
-
- switch(optname) {
- case SO_LINGER:
- optlen = sizeof(linger_val);
-
- if (getsockopt(php_sock->bsd_socket, level, optname, (char*)&linger_val, &optlen) != 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to retrieve socket option", errno);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- add_assoc_long(return_value, "l_onoff", linger_val.l_onoff);
- add_assoc_long(return_value, "l_linger", linger_val.l_linger);
-
- break;
- case SO_RCVTIMEO:
- case SO_SNDTIMEO:
- optlen = sizeof(tv);
-
- if (getsockopt(php_sock->bsd_socket, level, optname, (char*)&tv, &optlen) != 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to retrieve socket option", errno);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- add_assoc_long(return_value, "sec", tv.tv_sec);
- add_assoc_long(return_value, "usec", tv.tv_usec);
-
- break;
- default:
- optlen = sizeof(other_val);
-
- if (getsockopt(php_sock->bsd_socket, level, optname, (char*)&other_val, &optlen) != 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to retrieve socket option", errno);
- RETURN_FALSE;
- }
-
- RETURN_LONG(other_val);
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto bool socket_set_option(resource socket, int level, int optname, int|array optval)
- Sets socket options for the socket */
-PHP_FUNCTION(socket_set_option)
-{
- zval *arg1, *arg4;
- struct linger lv;
- struct timeval tv;
- php_socket *php_sock;
- int ov, optlen, retval;
- long level, optname;
- void *opt_ptr;
-
- HashTable *opt_ht;
- zval **l_onoff, **l_linger;
- zval **sec, **usec;
-
- /* key name constants */
- char *l_onoff_key = "l_onoff";
- char *l_linger_key = "l_linger";
- char *sec_key = "sec";
- char *usec_key = "usec";
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllz", &arg1, &level, &optname, &arg4) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
-
- set_errno(0);
-
- switch (optname) {
- case SO_LINGER:
- convert_to_array_ex(&arg4);
- opt_ht = HASH_OF(arg4);
-
- if (zend_hash_find(opt_ht, l_onoff_key, strlen(l_onoff_key) + 1, (void **)&l_onoff) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "no key \"%s\" passed in optval", l_onoff_key);
- RETURN_FALSE;
- }
- if (zend_hash_find(opt_ht, l_linger_key, strlen(l_linger_key) + 1, (void **)&l_linger) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "no key \"%s\" passed in optval", l_linger_key);
- RETURN_FALSE;
- }
-
- convert_to_long_ex(l_onoff);
- convert_to_long_ex(l_linger);
-
- lv.l_onoff = (unsigned short)Z_LVAL_PP(l_onoff);
- lv.l_linger = (unsigned short)Z_LVAL_PP(l_linger);
-
- optlen = sizeof(lv);
- opt_ptr = &lv;
- break;
- case SO_RCVTIMEO:
- case SO_SNDTIMEO:
- convert_to_array_ex(&arg4);
- opt_ht = HASH_OF(arg4);
-
- if (zend_hash_find(opt_ht, sec_key, strlen(sec_key) + 1, (void **)&sec) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "no key \"%s\" passed in optval", sec_key);
- RETURN_FALSE;
- }
- if (zend_hash_find(opt_ht, usec_key, strlen(usec_key) + 1, (void **)&usec) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "no key \"%s\" passed in optval", usec_key);
- RETURN_FALSE;
- }
-
- convert_to_long_ex(sec);
- convert_to_long_ex(usec);
- tv.tv_sec = Z_LVAL_PP(sec);
- tv.tv_usec = Z_LVAL_PP(usec);
-
- optlen = sizeof(tv);
- opt_ptr = &tv;
- break;
- default:
- convert_to_long_ex(&arg4);
- ov = Z_LVAL_P(arg4);
-
- optlen = sizeof(ov);
- opt_ptr = &ov;
- break;
- }
-
- retval = setsockopt(php_sock->bsd_socket, level, optname, opt_ptr, optlen);
-
- if (retval != 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to set socket option", errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_create_pair(int domain, int type, int protocol, array &fd)
- Creates a pair of indistinguishable sockets and stores them in fds. */
-PHP_FUNCTION(socket_create_pair)
-{
- zval *retval[2], *fds_array_zval;
- php_socket *php_sock[2];
- SOCKET fds_array[2];
- long domain, type, protocol;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lllz", &domain, &type, &protocol, &fds_array_zval) == FAILURE)
- return;
-
- php_sock[0] = (php_socket*)emalloc(sizeof(php_socket));
- php_sock[1] = (php_socket*)emalloc(sizeof(php_socket));
-
- if (domain != AF_INET
-#ifdef HAVE_IPV6
- && domain != AF_INET6
-#endif
- && domain != AF_UNIX) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid socket domain [%d] specified for argument 1, assuming AF_INET", domain);
- domain = AF_INET;
- }
-
- if (type > 10) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid socket type [%d] specified for argument 2, assuming SOCK_STREAM", type);
- type = SOCK_STREAM;
- }
-
- if (socketpair(domain, type, protocol, fds_array) != 0) {
- SOCKETS_G(last_error) = errno;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to create socket pair [%d]: %s", errno, php_strerror(errno TSRMLS_CC));
- efree(php_sock[0]);
- efree(php_sock[1]);
- RETURN_FALSE;
- }
-
- zval_dtor(fds_array_zval);
- array_init(fds_array_zval);
-
- MAKE_STD_ZVAL(retval[0]);
- MAKE_STD_ZVAL(retval[1]);
-
- php_sock[0]->bsd_socket = fds_array[0];
- php_sock[1]->bsd_socket = fds_array[1];
- php_sock[0]->type = domain;
- php_sock[1]->type = domain;
-
- ZEND_REGISTER_RESOURCE(retval[0], php_sock[0], le_socket);
- ZEND_REGISTER_RESOURCE(retval[1], php_sock[1], le_socket);
-
- add_index_zval(fds_array_zval, 0, retval[0]);
- add_index_zval(fds_array_zval, 1, retval[1]);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_shutdown(resource socket[, int how])
- Shuts down a socket for receiving, sending, or both. */
-PHP_FUNCTION(socket_shutdown)
-{
- zval *arg1;
- long how_shutdown = 2;
- php_socket *php_sock;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1, &how_shutdown) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, &arg1, -1, le_socket_name, le_socket);
-
- if (shutdown(php_sock->bsd_socket, how_shutdown) != 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to shutdown socket", errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int socket_last_error([resource socket])
- Returns the last socket error (either the last used or the provided socket resource) */
-PHP_FUNCTION(socket_last_error)
-{
- zval *arg1 = NULL;
- php_socket *php_sock;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &arg1) == FAILURE)
- return;
-
- if (arg1) {
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, &arg1, -1, le_socket_name, le_socket);
- RETVAL_LONG(php_sock->error);
- } else {
- RETVAL_LONG(SOCKETS_G(last_error));
- }
-}
-/* }}} */
-
-/* {{{ proto void socket_clear_error([resource socket])
- Clears the error on the socket or the last error code. */
-PHP_FUNCTION(socket_clear_error)
-{
- zval *arg1 = NULL;
- php_socket *php_sock;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &arg1) == FAILURE)
- return;
-
- if (arg1) {
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, &arg1, -1, le_socket_name, le_socket);
- php_sock->error = 0;
- } else {
- SOCKETS_G(last_error) = 0;
- }
-
- return;
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/sockets/sockets.dsp b/ext/sockets/sockets.dsp
deleted file mode 100644
index c4c8a658f3..0000000000
--- a/ext/sockets/sockets.dsp
+++ /dev/null
@@ -1,117 +0,0 @@
-# Microsoft Developer Studio Project File - Name="sockets" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=sockets - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "sockets.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "sockets.mak" CFG="sockets - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "sockets - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "sockets - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "sockets - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SOCKETS_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\bindlib_w32" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_SOCKETS" /D ZTS=1 /D HAVE_SOCKETS=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_sockets.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /debug
-
-!ELSEIF "$(CFG)" == "sockets - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SOCKETS_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\bindlib_w32" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_SOCKETS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SOCKETS=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_sockets.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "sockets - Win32 Release_TS"
-# Name "sockets - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_sockets_win.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\sockets.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_sockets.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_sockets_win.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/sockets/sockets.php b/ext/sockets/sockets.php
deleted file mode 100644
index 3bb624cd57..0000000000
--- a/ext/sockets/sockets.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?
-$module = 'sockets';
-$function = 'confirm_' . $module . '_compiled';
-if (extension_loaded($module)) {
- $str = $function($module);
-} else {
- $str = "Module $module is not compiled in PHP";
-}
-echo "$str\n";
-?>
diff --git a/ext/sockets/tests/ipv4loop.phpt b/ext/sockets/tests/ipv4loop.phpt
deleted file mode 100644
index 7c6c0db31e..0000000000
--- a/ext/sockets/tests/ipv4loop.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-IPv4 Loopback test
---SKIPIF--
-<?php
- if (!extension_loaded('sockets')) {
- die('skip sockets extenion not available.');
- }
-?>
---FILE--
-<?php
- /* Setup socket server */
- $server = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
- if (!$server) {
- die('Unable to create AF_INET socket [server]');
- }
- if (!socket_bind($server, '127.0.0.1', 31337)) {
- die('Unable to bind to 127.0.0.1:31337');
- }
- if (!socket_listen($server, 2)) {
- die('Unable to listen on socket');
- }
-
- /* Connect to it */
- $client = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
- if (!$client) {
- die('Unable to create AF_INET socket [client]');
- }
- if (!socket_connect($client, '127.0.0.1', 31337)) {
- die('Unable to connect to server socket');
- }
-
- /* Accept that connection */
- $socket = socket_accept($server);
- if (!$socket) {
- die('Unable to accept connection');
- }
-
- socket_write($client, "ABCdef123\n");
-
- $data = socket_read($socket, 10, PHP_BINARY_READ);
- var_dump($data);
-
- socket_close($client);
- socket_close($socket);
- socket_close($server);
-?>
---EXPECT--
-string(10) "ABCdef123
-"
diff --git a/ext/sockets/tests/ipv6loop.phpt b/ext/sockets/tests/ipv6loop.phpt
deleted file mode 100644
index 19a2f4fdf0..0000000000
--- a/ext/sockets/tests/ipv6loop.phpt
+++ /dev/null
@@ -1,52 +0,0 @@
---TEST--
-IPv6 Loopback test
---SKIPIF--
-<?php
- if (!extension_loaded('sockets')) {
- die('skip sockets extenion not available.');
- }
- if (!is_defined(AF_INET6)) {
- die('skip no IPv6 support');
- }
-?>
---FILE--
-<?php
- /* Setup socket server */
- $server = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp'));
- if (!$server) {
- die('Unable to create AF_INET6 socket [server]');
- }
- if (!socket_bind($server, '::1', 31337)) {
- die('Unable to bind to [::1]:31337');
- }
- if (!socket_listen($server, 2)) {
- die('Unable to listen on socket');
- }
-
- /* Connect to it */
- $client = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp'));
- if (!$client) {
- die('Unable to create AF_INET6 socket [client]');
- }
- if (!socket_connect($client, '::1', 31337)) {
- die('Unable to connect to server socket');
- }
-
- /* Accept that connection */
- $socket = socket_accept($server);
- if (!$socket) {
- die('Unable to accept connection');
- }
-
- socket_write($client, "ABCdef123\n");
-
- $data = socket_read($socket, 10, PHP_BINARY_READ);
- var_dump($data);
-
- socket_close($client);
- socket_close($socket);
- socket_close($server);
-?>
---EXPECT--
-string(10) "ABCdef123
-"
diff --git a/ext/sockets/unix_socket_constants.h b/ext/sockets/unix_socket_constants.h
deleted file mode 100644
index ccb25fd2db..0000000000
--- a/ext/sockets/unix_socket_constants.h
+++ /dev/null
@@ -1,406 +0,0 @@
-/* This file is to be included by sockets.c */
-
-#ifdef EPERM
- /* Operation not permitted */
- REGISTER_LONG_CONSTANT("SOCKET_EPERM", EPERM, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOENT
- /* No such file or directory */
- REGISTER_LONG_CONSTANT("SOCKET_ENOENT", ENOENT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EINTR
- /* Interrupted system call */
- REGISTER_LONG_CONSTANT("SOCKET_EINTR", EINTR, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EIO
- /* I/O error */
- REGISTER_LONG_CONSTANT("SOCKET_EIO", EIO, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENXIO
- /* No such device or address */
- REGISTER_LONG_CONSTANT("SOCKET_ENXIO", ENXIO, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef E2BIG
- /* Arg list too long */
- REGISTER_LONG_CONSTANT("SOCKET_E2BIG", E2BIG, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EBADF
- /* Bad file number */
- REGISTER_LONG_CONSTANT("SOCKET_EBADF", EBADF, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EAGAIN
- /* Try again */
- REGISTER_LONG_CONSTANT("SOCKET_EAGAIN", EAGAIN, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOMEM
- /* Out of memory */
- REGISTER_LONG_CONSTANT("SOCKET_ENOMEM", ENOMEM, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EACCES
- /* Permission denied */
- REGISTER_LONG_CONSTANT("SOCKET_EACCES", EACCES, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EFAULT
- /* Bad address */
- REGISTER_LONG_CONSTANT("SOCKET_EFAULT", EFAULT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOTBLK
- /* Block device required */
- REGISTER_LONG_CONSTANT("SOCKET_ENOTBLK", ENOTBLK, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EBUSY
- /* Device or resource busy */
- REGISTER_LONG_CONSTANT("SOCKET_EBUSY", EBUSY, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EEXIST
- /* File exists */
- REGISTER_LONG_CONSTANT("SOCKET_EEXIST", EEXIST, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EXDEV
- /* Cross-device link */
- REGISTER_LONG_CONSTANT("SOCKET_EXDEV", EXDEV, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENODEV
- /* No such device */
- REGISTER_LONG_CONSTANT("SOCKET_ENODEV", ENODEV, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOTDIR
- /* Not a directory */
- REGISTER_LONG_CONSTANT("SOCKET_ENOTDIR", ENOTDIR, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EISDIR
- /* Is a directory */
- REGISTER_LONG_CONSTANT("SOCKET_EISDIR", EISDIR, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EINVAL
- /* Invalid argument */
- REGISTER_LONG_CONSTANT("SOCKET_EINVAL", EINVAL, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENFILE
- /* File table overflow */
- REGISTER_LONG_CONSTANT("SOCKET_ENFILE", ENFILE, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EMFILE
- /* Too many open files */
- REGISTER_LONG_CONSTANT("SOCKET_EMFILE", EMFILE, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOTTY
- /* Not a typewriter */
- REGISTER_LONG_CONSTANT("SOCKET_ENOTTY", ENOTTY, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOSPC
- /* No space left on device */
- REGISTER_LONG_CONSTANT("SOCKET_ENOSPC", ENOSPC, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ESPIPE
- /* Illegal seek */
- REGISTER_LONG_CONSTANT("SOCKET_ESPIPE", ESPIPE, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EROFS
- /* Read-only file system */
- REGISTER_LONG_CONSTANT("SOCKET_EROFS", EROFS, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EMLINK
- /* Too many links */
- REGISTER_LONG_CONSTANT("SOCKET_EMLINK", EMLINK, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EPIPE
- /* Broken pipe */
- REGISTER_LONG_CONSTANT("SOCKET_EPIPE", EPIPE, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENAMETOOLONG
- /* File name too long */
- REGISTER_LONG_CONSTANT("SOCKET_ENAMETOOLONG", ENAMETOOLONG, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOLCK
- /* No record locks available */
- REGISTER_LONG_CONSTANT("SOCKET_ENOLCK", ENOLCK, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOSYS
- /* Function not implemented */
- REGISTER_LONG_CONSTANT("SOCKET_ENOSYS", ENOSYS, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOTEMPTY
- /* Directory not empty */
- REGISTER_LONG_CONSTANT("SOCKET_ENOTEMPTY", ENOTEMPTY, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ELOOP
- /* Too many symbolic links encountered */
- REGISTER_LONG_CONSTANT("SOCKET_ELOOP", ELOOP, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EWOULDBLOCK
- /* Operation would block */
- REGISTER_LONG_CONSTANT("SOCKET_EWOULDBLOCK", EWOULDBLOCK, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOMSG
- /* No message of desired type */
- REGISTER_LONG_CONSTANT("SOCKET_ENOMSG", ENOMSG, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EIDRM
- /* Identifier removed */
- REGISTER_LONG_CONSTANT("SOCKET_EIDRM", EIDRM, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ECHRNG
- /* Channel number out of range */
- REGISTER_LONG_CONSTANT("SOCKET_ECHRNG", ECHRNG, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EL2NSYNC
- /* Level 2 not synchronized */
- REGISTER_LONG_CONSTANT("SOCKET_EL2NSYNC", EL2NSYNC, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EL3HLT
- /* Level 3 halted */
- REGISTER_LONG_CONSTANT("SOCKET_EL3HLT", EL3HLT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EL3RST
- /* Level 3 reset */
- REGISTER_LONG_CONSTANT("SOCKET_EL3RST", EL3RST, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ELNRNG
- /* Link number out of range */
- REGISTER_LONG_CONSTANT("SOCKET_ELNRNG", ELNRNG, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EUNATCH
- /* Protocol driver not attached */
- REGISTER_LONG_CONSTANT("SOCKET_EUNATCH", EUNATCH, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOCSI
- /* No CSI structure available */
- REGISTER_LONG_CONSTANT("SOCKET_ENOCSI", ENOCSI, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EL2HLT
- /* Level 2 halted */
- REGISTER_LONG_CONSTANT("SOCKET_EL2HLT", EL2HLT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EBADE
- /* Invalid exchange */
- REGISTER_LONG_CONSTANT("SOCKET_EBADE", EBADE, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EBADR
- /* Invalid request descriptor */
- REGISTER_LONG_CONSTANT("SOCKET_EBADR", EBADR, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EXFULL
- /* Exchange full */
- REGISTER_LONG_CONSTANT("SOCKET_EXFULL", EXFULL, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOANO
- /* No anode */
- REGISTER_LONG_CONSTANT("SOCKET_ENOANO", ENOANO, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EBADRQC
- /* Invalid request code */
- REGISTER_LONG_CONSTANT("SOCKET_EBADRQC", EBADRQC, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EBADSLT
- /* Invalid slot */
- REGISTER_LONG_CONSTANT("SOCKET_EBADSLT", EBADSLT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOSTR
- /* Device not a stream */
- REGISTER_LONG_CONSTANT("SOCKET_ENOSTR", ENOSTR, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENODATA
- /* No data available */
- REGISTER_LONG_CONSTANT("SOCKET_ENODATA", ENODATA, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ETIME
- /* Timer expired */
- REGISTER_LONG_CONSTANT("SOCKET_ETIME", ETIME, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOSR
- /* Out of streams resources */
- REGISTER_LONG_CONSTANT("SOCKET_ENOSR", ENOSR, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENONET
- /* Machine is not on the network */
- REGISTER_LONG_CONSTANT("SOCKET_ENONET", ENONET, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EREMOTE
- /* Object is remote */
- REGISTER_LONG_CONSTANT("SOCKET_EREMOTE", EREMOTE, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOLINK
- /* Link has been severed */
- REGISTER_LONG_CONSTANT("SOCKET_ENOLINK", ENOLINK, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EADV
- /* Advertise error */
- REGISTER_LONG_CONSTANT("SOCKET_EADV", EADV, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ESRMNT
- /* Srmount error */
- REGISTER_LONG_CONSTANT("SOCKET_ESRMNT", ESRMNT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ECOMM
- /* Communication error on send */
- REGISTER_LONG_CONSTANT("SOCKET_ECOMM", ECOMM, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EPROTO
- /* Protocol error */
- REGISTER_LONG_CONSTANT("SOCKET_EPROTO", EPROTO, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EMULTIHOP
- /* Multihop attempted */
- REGISTER_LONG_CONSTANT("SOCKET_EMULTIHOP", EMULTIHOP, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EBADMSG
- /* Not a data message */
- REGISTER_LONG_CONSTANT("SOCKET_EBADMSG", EBADMSG, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOTUNIQ
- /* Name not unique on network */
- REGISTER_LONG_CONSTANT("SOCKET_ENOTUNIQ", ENOTUNIQ, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EBADFD
- /* File descriptor in bad state */
- REGISTER_LONG_CONSTANT("SOCKET_EBADFD", EBADFD, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EREMCHG
- /* Remote address changed */
- REGISTER_LONG_CONSTANT("SOCKET_EREMCHG", EREMCHG, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ERESTART
- /* Interrupted system call should be restarted */
- REGISTER_LONG_CONSTANT("SOCKET_ERESTART", ERESTART, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ESTRPIPE
- /* Streams pipe error */
- REGISTER_LONG_CONSTANT("SOCKET_ESTRPIPE", ESTRPIPE, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EUSERS
- /* Too many users */
- REGISTER_LONG_CONSTANT("SOCKET_EUSERS", EUSERS, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOTSOCK
- /* Socket operation on non-socket */
- REGISTER_LONG_CONSTANT("SOCKET_ENOTSOCK", ENOTSOCK, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EDESTADDRREQ
- /* Destination address required */
- REGISTER_LONG_CONSTANT("SOCKET_EDESTADDRREQ", EDESTADDRREQ, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EMSGSIZE
- /* Message too long */
- REGISTER_LONG_CONSTANT("SOCKET_EMSGSIZE", EMSGSIZE, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EPROTOTYPE
- /* Protocol wrong type for socket */
- REGISTER_LONG_CONSTANT("SOCKET_EPROTOTYPE", EPROTOTYPE, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOPROTOOPT
- /* Protocol not available */
- REGISTER_LONG_CONSTANT("SOCKET_ENOPROTOOPT", ENOPROTOOPT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EPROTONOSUPPORT
- /* Protocol not supported */
- REGISTER_LONG_CONSTANT("SOCKET_EPROTONOSUPPORT", EPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ESOCKTNOSUPPORT
- /* Socket type not supported */
- REGISTER_LONG_CONSTANT("SOCKET_ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EOPNOTSUPP
- /* Operation not supported on transport endpoint */
- REGISTER_LONG_CONSTANT("SOCKET_EOPNOTSUPP", EOPNOTSUPP, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EPFNOSUPPORT
- /* Protocol family not supported */
- REGISTER_LONG_CONSTANT("SOCKET_EPFNOSUPPORT", EPFNOSUPPORT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EAFNOSUPPORT
- /* Address family not supported by protocol */
- REGISTER_LONG_CONSTANT("SOCKET_EAFNOSUPPORT", EAFNOSUPPORT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EADDRINUSE
- /* Address already in use */
- REGISTER_LONG_CONSTANT("SOCKET_EADDRINUSE", EADDRINUSE, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EADDRNOTAVAIL
- /* Cannot assign requested address */
- REGISTER_LONG_CONSTANT("SOCKET_EADDRNOTAVAIL", EADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENETDOWN
- /* Network is down */
- REGISTER_LONG_CONSTANT("SOCKET_ENETDOWN", ENETDOWN, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENETUNREACH
- /* Network is unreachable */
- REGISTER_LONG_CONSTANT("SOCKET_ENETUNREACH", ENETUNREACH, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENETRESET
- /* Network dropped connection because of reset */
- REGISTER_LONG_CONSTANT("SOCKET_ENETRESET", ENETRESET, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ECONNABORTED
- /* Software caused connection abort */
- REGISTER_LONG_CONSTANT("SOCKET_ECONNABORTED", ECONNABORTED, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ECONNRESET
- /* Connection reset by peer */
- REGISTER_LONG_CONSTANT("SOCKET_ECONNRESET", ECONNRESET, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOBUFS
- /* No buffer space available */
- REGISTER_LONG_CONSTANT("SOCKET_ENOBUFS", ENOBUFS, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EISCONN
- /* Transport endpoint is already connected */
- REGISTER_LONG_CONSTANT("SOCKET_EISCONN", EISCONN, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOTCONN
- /* Transport endpoint is not connected */
- REGISTER_LONG_CONSTANT("SOCKET_ENOTCONN", ENOTCONN, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ESHUTDOWN
- /* Cannot send after transport endpoint shutdown */
- REGISTER_LONG_CONSTANT("SOCKET_ESHUTDOWN", ESHUTDOWN, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ETOOMANYREFS
- /* Too many references: cannot splice */
- REGISTER_LONG_CONSTANT("SOCKET_ETOOMANYREFS", ETOOMANYREFS, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ETIMEDOUT
- /* Connection timed out */
- REGISTER_LONG_CONSTANT("SOCKET_ETIMEDOUT", ETIMEDOUT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ECONNREFUSED
- /* Connection refused */
- REGISTER_LONG_CONSTANT("SOCKET_ECONNREFUSED", ECONNREFUSED, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EHOSTDOWN
- /* Host is down */
- REGISTER_LONG_CONSTANT("SOCKET_EHOSTDOWN", EHOSTDOWN, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EHOSTUNREACH
- /* No route to host */
- REGISTER_LONG_CONSTANT("SOCKET_EHOSTUNREACH", EHOSTUNREACH, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EALREADY
- /* Operation already in progress */
- REGISTER_LONG_CONSTANT("SOCKET_EALREADY", EALREADY, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EINPROGRESS
- /* Operation now in progress */
- REGISTER_LONG_CONSTANT("SOCKET_EINPROGRESS", EINPROGRESS, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EISNAM
- /* Is a named type file */
- REGISTER_LONG_CONSTANT("SOCKET_EISNAM", EISNAM, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EREMOTEIO
- /* Remote I/O error */
- REGISTER_LONG_CONSTANT("SOCKET_EREMOTEIO", EREMOTEIO, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EDQUOT
- /* Quota exceeded */
- REGISTER_LONG_CONSTANT("SOCKET_EDQUOT", EDQUOT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef ENOMEDIUM
- /* No medium found */
- REGISTER_LONG_CONSTANT("SOCKET_ENOMEDIUM", ENOMEDIUM, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef EMEDIUMTYPE
- /* Wrong medium type */
- REGISTER_LONG_CONSTANT("SOCKET_EMEDIUMTYPE", EMEDIUMTYPE, CONST_CS | CONST_PERSISTENT);
-#endif
diff --git a/ext/sockets/win32_socket_constants.h b/ext/sockets/win32_socket_constants.h
deleted file mode 100644
index f32e21cd77..0000000000
--- a/ext/sockets/win32_socket_constants.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* This file is to be included by sockets.c */
-
-REGISTER_LONG_CONSTANT("SOCKET_EINTR", WSAEINTR, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EBADF", WSAEBADF, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EACCES", WSAEACCES, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EFAULT", WSAEFAULT, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EINVAL", WSAEINVAL, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EMFILE", WSAEMFILE, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EWOULDBLOCK", WSAEWOULDBLOCK, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EINPROGRESS", WSAEINPROGRESS, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EALREADY", WSAEALREADY, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ENOTSOCK", WSAENOTSOCK, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EDESTADDRREQ", WSAEDESTADDRREQ, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EMSGSIZE", WSAEMSGSIZE, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EPROTOTYPE", WSAEPROTOTYPE, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ENOPROTOOPT", WSAENOPROTOOPT, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EPROTONOSUPPORT", WSAEPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EOPNOTSUPP", WSAEOPNOTSUPP, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EPFNOSUPPORT", WSAEPFNOSUPPORT, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EAFNOSUPPORT", WSAEAFNOSUPPORT, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EADDRINUSE", WSAEADDRINUSE, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EADDRNOTAVAIL", WSAEADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ENETDOWN", WSAENETDOWN, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ENETUNREACH", WSAENETUNREACH, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ENETRESET", WSAENETRESET, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ECONNABORTED", WSAECONNABORTED, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ECONNRESET", WSAECONNRESET, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ENOBUFS", WSAENOBUFS, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EISCONN", WSAEISCONN, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ENOTCONN", WSAENOTCONN, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ESHUTDOWN", WSAESHUTDOWN, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ETOOMANYREFS", WSAETOOMANYREFS, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ETIMEDOUT", WSAETIMEDOUT, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ECONNREFUSED", WSAECONNREFUSED, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ELOOP", WSAELOOP, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ENAMETOOLONG", WSAENAMETOOLONG, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EHOSTDOWN", WSAEHOSTDOWN, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EHOSTUNREACH", WSAEHOSTUNREACH, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ENOTEMPTY", WSAENOTEMPTY, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EPROCLIM", WSAEPROCLIM, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EUSERS", WSAEUSERS, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EDQUOT", WSAEDQUOT, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_ESTALE", WSAESTALE, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EREMOTE", WSAEREMOTE, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_EDISCON", WSAEDISCON, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_SYSNOTREADY", WSASYSNOTREADY, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_VERNOTSUPPORTED", WSAVERNOTSUPPORTED, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_NOTINITIALISED", WSANOTINITIALISED, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_HOST_NOT_FOUND", WSAHOST_NOT_FOUND, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_TRY_AGAIN", WSATRY_AGAIN, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_NO_RECOVERY", WSANO_RECOVERY, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_NO_DATA", WSANO_DATA, CONST_CS | CONST_PERSISTENT);
-REGISTER_LONG_CONSTANT("SOCKET_NO_ADDRESS", WSANO_ADDRESS, CONST_CS | CONST_PERSISTENT);
diff --git a/ext/spl/CREDITS b/ext/spl/CREDITS
deleted file mode 100755
index 8710aac550..0000000000
--- a/ext/spl/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-SPL
-Marcus Boerger
diff --git a/ext/spl/EXPERIMENTAL b/ext/spl/EXPERIMENTAL
deleted file mode 100755
index e69de29bb2..0000000000
--- a/ext/spl/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/spl/README b/ext/spl/README
deleted file mode 100755
index e4d9aaf7a2..0000000000
--- a/ext/spl/README
+++ /dev/null
@@ -1,39 +0,0 @@
-<pre>
-This is an extension that aims to implement some efficient data access
-interfaces and classes.
-
-SPL allows to hook into foreach. Doing so you can do something like
-this:
-
- $obj = new whatever();
- foreach($obj as $key => $value) { ... }
-
-This is meant to be used for database access. For example you could
-grab my patch to sqlite (<a href="http://marcus-boerger.de/php/ext/sqlite/">http://marcus-boerger.de/php/ext/sqlite/</a>) and
-look at the oo tests:
-
- $db = new sqlite($filename);
- foreach($db->query("SELECT....") as $row) { ... }
-
-SQLite offers four access strategies:
-1) sqlite_query + sqlite_fetch_array
-2) sqlite_unbuffered_query + sqlite_fetch_array
-3) sqlite_query + iterators (sqlite_current)
-4) sqlite_unbuffered_query + iterators (sqlite_current)
-
-1) and 3) do "over eager evaluating" since they fetch all rows directly.
-
-2) does "eager evaluating". It always fetches the next row but doesn't
-keep the current row, so that it must be stored elsewhere if it must be
-accessed more then once. For instance this happens when you need to access
-columns separately.
-
-4) does "eager evaluating". But in contrast to 2) it keeps the current row
-hence its name.
-
-There is no efficient way for "lazy or just in time evaluating" so 4) should
-be the best case. And 4) also enables the foreach trick.
-
-To implement 3) and 4) with other db extensions ask me and wait for LT to pass.
-
-</pre> \ No newline at end of file
diff --git a/ext/spl/TODO b/ext/spl/TODO
deleted file mode 100755
index 5311ef6c11..0000000000
--- a/ext/spl/TODO
+++ /dev/null
@@ -1,13 +0,0 @@
-This is the ToDo of ext/spl:
-
-- spl::array_access cals set() which is supposed to return a value.
- Currently you *must* return a value even when it is not used.
- $obj[$idx] = $val; // doesn't use the return value
- $x = $obj[$idx] = $val; // here it is used
- Since array_access.phpt is a test with a return value there
- should be a test without a return value. Maybe an error message
- is required in case there is no return value.
-
-- spl::array_access_ex is not completely done and not tested.
-
-If you have further questions: mailto:helly@php.net
diff --git a/ext/spl/config.m4 b/ext/spl/config.m4
deleted file mode 100755
index bcae05f2fb..0000000000
--- a/ext/spl/config.m4
+++ /dev/null
@@ -1,41 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension SPL
-
-PHP_ARG_ENABLE(spl, enable SPL suppport,
-[ --enable-spl Enable Standard PHP Library])
-
-dnl first enable/disable all hooks
-
-PHP_ARG_ENABLE(spl, enable all hooks,
-[ --enable-spl-hook-all SPL: Enable all hooks])
-
-dnl now all single enable/disable for hooks
-
-PHP_ARG_ENABLE(spl, enable hook on foreach,
-[ --disable-spl-foreach SPL: Disable hook on forach], yes)
-
-PHP_ARG_ENABLE(spl, enable hook on array read,
-[ --enable-spl-array-read SPL: Enable hook on array read])
-
-PHP_ARG_ENABLE(spl, enable hook on array write,
-[ --enable-spl-array-write SPL: Enable hook on array write (+read)])
-
-dnl last do checks on hooks
-
-if test "$PHP_SPL_HOOK_ALL" != "no" -o "$PHP_SPL_FOREACH" != "no"; then
- AC_DEFINE(SPL_FOREACH, 1, [Activate opcode hook on foreach])
- PHP_SPL="yes"
-fi
-if test "$PHP_SPL_HOOK_ALL" != "no" -o "$PHP_SPL_ARRAY_READ" != "no" -o "$PHP_SPL_ARRAY_WRITE" != "no"; then
- AC_DEFINE(SPL_ARRAY_READ, 1, [Activate opcode hook on array read])
- PHP_SPL="yes"
-fi
-if test "$PHP_SPL_HOOK_ALL" != "no" -o "$PHP_SPL_ARRAY_WRITE" != "no"; then
- AC_DEFINE(SPL_ARRAY_WRITE, 1, [Activate opcode hook on array write])
- PHP_SPL="yes"
-fi
-
-if test "$PHP_SPL" != "no"; then
- AC_DEFINE(HAVE_SPL, 1, [Whether you want SPL (Standard Php Library) support])
- PHP_NEW_EXTENSION(spl, php_spl.c spl_functions.c spl_engine.c spl_foreach.c spl_array.c, $ext_shared)
-fi
diff --git a/ext/spl/examples/dba_dump.php b/ext/spl/examples/dba_dump.php
deleted file mode 100755
index d32f1761c9..0000000000
--- a/ext/spl/examples/dba_dump.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-
-/* dba dump utility
- *
- * Usage php dba_dump <file> <handler>
- *
- * Note: configure with --enable-dba
- */
-
-class dba_reader implements spl::iterator {
-
- public $db = NULL;
-
- function __construct($file, $handler) {
- $this->db = dba_open($file, 'r', $handler);
- }
-
- function new_iterator() {
- return new dba_iter($this);
- }
-
- function __destruct() {
- if ($this->db) {
- dba_close($this->db);
- }
- }
-}
-
-class dba_iter implements spl::sequence_assoc {
-
- private $obj;
- private $key = NULL;
- private $val = NULL;
-
- function __construct($obj) {
- $this->obj = $obj;
- }
-
- function reset() {
- if ($this->obj->db) {
- $this->key = dba_firstkey($this->obj->db);
- }
- }
-
- function elem() {
- return $this->val;
- }
-
- function next() {
- $this->key = dba_nextkey($this->obj->db);
- }
-
- function more() {
- if ($this->obj->db && $this->key !== false) {
- $this->val = dba_fetch($this->key, $this->obj->db);
- return true;
- } else {
- return false;
- }
- }
-
- function key() {
- return $this->key;
- }
-}
-
-$db = new dba_reader($argv[1], $argv[2]);
-foreach($db as $key => $val) {
- echo "'$key' => '$val'\n";
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
deleted file mode 100755
index 84f86fa931..0000000000
--- a/ext/spl/php_spl.c
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-#include "spl_foreach.h"
-#include "spl_array.h"
-
-#ifdef COMPILE_DL_SPL
-ZEND_GET_MODULE(spl)
-#endif
-
-ZEND_DECLARE_MODULE_GLOBALS(spl)
-
-/* {{{ spl_functions
- */
-function_entry spl_functions[] = {
- PHP_FE(spl_classes, NULL)
- PHP_FE(class_name, NULL)
- PHP_FE(class_parents, NULL)
- PHP_FE(class_implements, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ spl_module_entry
- */
-zend_module_entry spl_module_entry = {
- STANDARD_MODULE_HEADER,
- "spl",
- spl_functions,
- PHP_MINIT(spl),
- PHP_MSHUTDOWN(spl),
- PHP_RINIT(spl),
- PHP_RSHUTDOWN(spl),
- PHP_MINFO(spl),
- "0.1",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-zend_namespace *spl_ns_spl;
-zend_class_entry *spl_ce_iterator;
-zend_class_entry *spl_ce_forward;
-zend_class_entry *spl_ce_assoc;
-zend_class_entry *spl_ce_sequence;
-zend_class_entry *spl_ce_forward_assoc;
-zend_class_entry *spl_ce_sequence_assoc;
-zend_class_entry *spl_ce_array_read;
-zend_class_entry *spl_ce_array_access;
-zend_class_entry *spl_ce_array_access_ex;
-zend_class_entry *spl_ce_array_writer;
-#ifdef SPL_ARRAY_WRITE
-zend_class_entry *spl_ce_array_writer_default;
-#endif /* SPL_ARRAY_WRITE */
-
-/* {{{ spl_functions_none
- */
-function_entry spl_functions_none[] = {
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-static unsigned char first_of_two_force_ref[] = { 2, BYREF_FORCE, BYREF_NONE };
-
-/* {{{ spl_array_writer_funcs
- */
-function_entry spl_array_writer_funcs[] = {
- SPL_CLASS_FE(array_writer_default, __construct, first_of_two_force_ref)
- SPL_CLASS_FE(array_writer_default, set, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ spl_init_globals
- */
-static void spl_init_globals(zend_spl_globals *spl_globals)
-{
-#ifdef SPL_FOREACH
- ZEND_EXECUTE_HOOK(ZEND_FE_RESET);
- ZEND_EXECUTE_HOOK(ZEND_FE_FETCH);
-#endif
-
-#if defined(SPL_ARRAY_READ) | defined(SPl_ARRAY_WRITE)
- ZEND_EXECUTE_HOOK(ZEND_FETCH_DIM_R);
- ZEND_EXECUTE_HOOK(ZEND_FETCH_DIM_W);
- ZEND_EXECUTE_HOOK(ZEND_FETCH_DIM_RW);
-#endif
-
-#ifdef SPL_ARRAY_WRITE
- ZEND_EXECUTE_HOOK(ZEND_ASSIGN);
-#endif /* SPL_ARRAY_WRITE */
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION(spl)
- */
-PHP_MINIT_FUNCTION(spl)
-{
- ZEND_INIT_MODULE_GLOBALS(spl, spl_init_globals, NULL);
-
- REGISTER_SPL_NAMESPACE(spl);
-
- REGISTER_SPL_INTERFACE(spl, iterator);
- REGISTER_SPL_INTF_FUNC(spl, iterator, new_iterator);
-
- REGISTER_SPL_INTERFACE(spl, forward);
- REGISTER_SPL_INTF_FUNC(spl, forward, current);
- REGISTER_SPL_INTF_FUNC(spl, forward, next);
- REGISTER_SPL_INTF_FUNC(spl, forward, more);
-
- REGISTER_SPL_INTERFACE(spl, sequence);
- REGISTER_SPL_INTF_FUNC(spl, sequence, rewind);
- REGISTER_SPL_IMPLEMENT(spl, sequence, forward);
-
- REGISTER_SPL_INTERFACE(spl, assoc);
- REGISTER_SPL_INTF_FUNC(spl, assoc, key);
-
- REGISTER_SPL_INTERFACE(spl, forward_assoc);
- REGISTER_SPL_IMPLEMENT(spl, forward_assoc, assoc);
- REGISTER_SPL_IMPLEMENT(spl, forward_assoc, forward);
-
- REGISTER_SPL_INTERFACE(spl, sequence_assoc);
- REGISTER_SPL_IMPLEMENT(spl, sequence_assoc, forward_assoc);
- REGISTER_SPL_IMPLEMENT(spl, sequence_assoc, sequence);
-
- REGISTER_SPL_INTERFACE(spl, array_read);
- REGISTER_SPL_INTF_FUNC(spl, array_read, get);
- REGISTER_SPL_INTF_FUNC(spl, array_read, exists);
-
- REGISTER_SPL_INTERFACE(spl, array_access);
- REGISTER_SPL_IMPLEMENT(spl, array_access, array_read);
- REGISTER_SPL_INTF_FUNC(spl, array_access, set);
-
- REGISTER_SPL_INTERFACE(spl, array_access_ex);
- REGISTER_SPL_IMPLEMENT(spl, array_access_ex, array_access);
- REGISTER_SPL_INTF_FUNC(spl, array_access_ex, new_writer);
-
- REGISTER_SPL_INTERFACE(spl, array_writer);
- REGISTER_SPL_INTF_FUNC(spl, array_writer, set);
-
-#ifdef SPL_ARRAY_WRITE
- REGISTER_SPL_STD_CLASS(spl, array_writer_default, spl_array_writer_default_create);
- REGISTER_SPL_FUNCTIONS(spl, array_writer_default, spl_array_writer_funcs);
-#endif
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION(spl)
- */
-PHP_RINIT_FUNCTION(spl)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION(spl)
- */
-PHP_RSHUTDOWN_FUNCTION(spl)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION(spl)
- */
-PHP_MSHUTDOWN_FUNCTION(spl)
-{
- SPL_DEBUG(fprintf(stderr, "%s\n", "Shutting down SPL");)
-
-#ifdef SPL_FOREACH
- ZEND_EXECUTE_HOOK_RESTORE(ZEND_FE_RESET);
- ZEND_EXECUTE_HOOK_RESTORE(ZEND_FE_FETCH);
-#endif
-
-#if defined(SPL_ARRAY_READ) | defined(SPL_ARRAY_WRITE)
- ZEND_EXECUTE_HOOK_RESTORE(ZEND_FETCH_DIM_R);
- ZEND_EXECUTE_HOOK_RESTORE(ZEND_FETCH_DIM_W);
- ZEND_EXECUTE_HOOK_RESTORE(ZEND_FETCH_DIM_RW);
-#endif
-
-#ifdef SPL_ARRAY_WRITE
- ZEND_EXECUTE_HOOK_RESTORE(ZEND_ASSIGN);
-#endif /* SPL_ARRAY_WRITE */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO(spl)
- */
-PHP_MINFO_FUNCTION(spl)
-{
-#ifdef SPL_FOREACH
- char *foreach = "beta";
-#else /* SPL_ARRAY_WRITE */
- char *foreach = "beta, not hooked";
-#endif
-#ifdef SPL_ARRAY_READ
- char *array_read = "beta";
-#else /* SPL_ARRAY_WRITE */
- char *array_read = "beta, not hooked";
-#endif
-#ifdef SPL_ARRAY_WRITE
- char *array_write = "beta";
-#else /* SPL_ARRAY_WRITE */
- char *array_write = "beta, not hooked";
-#endif /* SPL_ARRAY_WRITE */
-
- php_info_print_table_start();
- php_info_print_table_header(2, "SPL support", "enabled");
- php_info_print_table_row(2, "iterator", foreach);
- php_info_print_table_row(2, "forward", foreach);
- php_info_print_table_row(2, "sequence", foreach);
- php_info_print_table_row(2, "assoc", foreach);
- php_info_print_table_row(2, "forward_assoc", foreach);
- php_info_print_table_row(2, "sequence_assoc", foreach);
- php_info_print_table_row(2, "array_read", array_read);
- php_info_print_table_row(2, "array_access", array_write);
- php_info_print_table_row(2, "array_access_ex", array_write);
- php_info_print_table_row(2, "array_writer", array_write);
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ proto string class_name(object)
- Retrieve */
-PHP_FUNCTION(class_name)
-{
- zval *obj;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
- RETURN_FALSE;
- }
- RETURN_STRING(spl_make_fully_qualyfied_name(Z_OBJCE_P(obj) TSRMLS_CC), 0);
-}
-/* }}} */
-
-/* {{{ class_parents
- */
-PHP_FUNCTION(class_parents)
-{
- zval *obj;
- zend_class_entry *parent_class;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
- RETURN_FALSE;
- }
- array_init(return_value);
- parent_class = Z_OBJCE_P(obj)->parent;
- while (parent_class) {
- spl_add_class_name(return_value, parent_class TSRMLS_CC);
- parent_class = parent_class->parent;
- }
-}
-/* }}} */
-
-/* {{{ class_implements
- */
-PHP_FUNCTION(class_implements)
-{
- zval *obj;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
- RETURN_FALSE;
- }
- array_init(return_value);
- spl_add_interfaces(return_value, Z_OBJCE_P(obj) TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ spl_classes */
-PHP_FUNCTION(spl_classes)
-{
- array_init(return_value);
- zend_hash_apply_with_argument(&spl_ns_spl->class_table, (apply_func_arg_t)spl_add_classes, return_value TSRMLS_CC);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/php_spl.h b/ext/spl/php_spl.h
deleted file mode 100755
index 137e451cd5..0000000000
--- a/ext/spl/php_spl.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_SPL_H
-#define PHP_SPL_H
-
-#include "php.h"
-#include <stdarg.h>
-
-#if 0
-#define SPL_DEBUG(x) x
-#else
-#define SPL_DEBUG(x)
-#endif
-
-extern zend_module_entry spl_module_entry;
-#define phpext_spl_ptr &spl_module_entry
-
-#if defined(PHP_WIN32) && !defined(COMPILE_DL_SPL)
-#undef phpext_spl
-#define phpext_spl NULL
-#endif
-
-PHP_MINIT_FUNCTION(spl);
-PHP_MSHUTDOWN_FUNCTION(spl);
-PHP_RINIT_FUNCTION(spl);
-PHP_RSHUTDOWN_FUNCTION(spl);
-PHP_MINFO_FUNCTION(spl);
-
-#define ZEND_EXECUTE_HOOK_PTR(name) \
- opcode_handler_t handler_ ## name
-
-#define ZEND_EXECUTE_HOOK(name) \
- spl_globals->handler_ ## name = zend_opcode_handlers[name]; \
- zend_opcode_handlers[name] = spl_handler_ ## name
-
-#define ZEND_EXECUTE_HOOK_RESTORE(name) \
- zend_opcode_handlers[name] = SPL_G(handler_ ## name)
-
-#define ZEND_EXECUTE_HOOK_ORIGINAL(name) \
- return SPL_G(handler_ ## name)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU)
-
-#define ZEND_EXECUTE_HOOK_FUNCTION(name) \
- int spl_handler_ ## name(ZEND_OPCODE_HANDLER_ARGS)
-
-
-ZEND_BEGIN_MODULE_GLOBALS(spl)
-#ifdef SPL_FOREACH
- ZEND_EXECUTE_HOOK_PTR(ZEND_FE_RESET);
- ZEND_EXECUTE_HOOK_PTR(ZEND_FE_FETCH);
-#endif
-#if defined(SPL_ARRAY_READ) | defined(SPL_ARRAY_WRITE)
- ZEND_EXECUTE_HOOK_PTR(ZEND_FETCH_DIM_R);
- ZEND_EXECUTE_HOOK_PTR(ZEND_FETCH_DIM_W);
- ZEND_EXECUTE_HOOK_PTR(ZEND_FETCH_DIM_RW);
-#endif
-#ifdef SPL_ARRAY_WRITE
- ZEND_EXECUTE_HOOK_PTR(ZEND_ASSIGN);
-#endif
-ZEND_END_MODULE_GLOBALS(spl)
-
-#ifdef ZTS
-# define SPL_G(v) TSRMG(spl_globals_id, zend_spl_globals *, v)
-extern int spl_globals_id;
-#else
-# define SPL_G(v) (spl_globals.v)
-extern zend_spl_globals spl_globals;
-#endif
-
-extern zend_namespace *spl_ns_spl;
-extern zend_class_entry *spl_ce_iterator;
-extern zend_class_entry *spl_ce_forward;
-extern zend_class_entry *spl_ce_sequence;
-extern zend_class_entry *spl_ce_assoc;
-extern zend_class_entry *spl_ce_forward_assoc;
-extern zend_class_entry *spl_ce_sequence_assoc;
-extern zend_class_entry *spl_ce_array_read;
-extern zend_class_entry *spl_ce_array_access;
-extern zend_class_entry *spl_ce_array_access_ex;
-extern zend_class_entry *spl_ce_array_writer;
-#ifdef SPL_ARRAY_WRITE
-extern zend_class_entry *spl_ce_array_writer_default;
-#endif /* SPL_ARRAY_WRITE */
-
-PHP_FUNCTION(spl_classes);
-PHP_FUNCTION(class_name);
-PHP_FUNCTION(class_parents);
-PHP_FUNCTION(class_implements);
-
-#endif /* PHP_SPL_H */
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl.php b/ext/spl/spl.php
deleted file mode 100755
index ee92c0503c..0000000000
--- a/ext/spl/spl.php
+++ /dev/null
@@ -1,306 +0,0 @@
-<?php
-
-/* \brief Standard PHP Library
- *
- * (c) M.Boerger 2003
- */
-namespace spl {
-
- /*! \brief Interface to foreach() construct
- *
- * Any class that implements this interface can for example be used as
- * the input parameter to foreach() calls which would normally be an
- * array.
- *
- * The only thing a class has to do is
- */
- interface iterator {
-
- /*! \brief Create a new iterator
- *
- * used for example in foreach() operator.
- */
- function new_iterator();
- }
-
- /*! \brief Simple forward iterator
- *
- * Any class that implements this interface can be used as the
- * return of a foreach interface. And hence the class itself
- * can be used as a parameter to be iterated (normally an array).
- *
- * \code
- class c implements spl::foreach, spl::forward {
- private $num = 0;
- function new_iterator() {
- $this->num = 0;
- return $this;
- }
- function current() {
- return $this->num;
- }
- function next() {
- $this->num++;
- }
- function has_more() {
- return $this->num < 5;
- }
- }
-
- $t = new c();
-
- foreach($t as $num) {
- echo "$num\n";
- }
- \endcode
- *
- * A very interesting usage scenario are for example database queries.
- * Without this interface you need to do it without foreach or fetch the
- * whole rowset into an array.
- *
- * In the above code the class implements both the foreach and the
- * forward interface. Doing this you cannot have nested foreach calls.
- * If you need this you must split the two parts.
- *
- * \code
- class c implements spl::foreach {
- public $max = 3;
- function new_iterator() {
- return new c_iter($this);
- }
- }
- class c_iter implements spl::forward {
- private $obj;
- private $num = 0;
- function __construct($obj) {
- $this->obj = $obj;
- }
- function current() {
- return $this->num;
- }
- function next() {
- $this->num++;
- }
- function has_more() {
- return $this->num < $this->obj->max;
- }
- }
-
- $t = new c();
-
- foreach($t as $outer) {
- foreach($t as $inner) {
- echo "$outer,$inner\n";
- }
- }
- \endcode
- *
- * You can also use this interface with the for() construct.
- *
- * \code
- class c implements spl::foreach {
- public $max = 3;
- function new_iterator() {
- return new c_iter($this);
- }
- }
- class c_iter implements spl::forward {
- private $obj;
- private $num = 0;
- function __construct($obj) {
- $this->obj = $obj;
- }
- function current() {
- return $this->num;
- }
- function next() {
- $this->num++;
- }
- function has_more() {
- return $this->num < $this->obj->max;
- }
- }
-
- $t = new c();
-
- for ($iter = $t->new_iterator(); $iter->has_more(); $iter->next()) {
- echo $iter->current() . "\n";
- }
- \endcode
- */
- interface forward {
-
- /*! \brief Retrieve the current currentent
- *
- * \return \c mixed current element or \c false if no more elements
- */
- function current();
-
- /*! \brief Forward to next element.
- */
- function next();
-
- /*! \brief Check if more elements are available.
- *
- * \return \c bool whether or not more elements are available
- */
- function has_more();
- }
-
- /*! \brief A restartable iterator.
- *
- * This iterator allows you to implement a restartable iterator. That
- * means the iterator can be rewind to the first element after accessing
- * any number of elements.
- *
- * \note If you use sequence in foreach then rewind() will be called
- * first.
- */
- interface sequence extends forward {
-
- /*! Restart the sequence by positioning it to the first element.
- */
- function rewind();
- }
-
- /*! \brief associative interface
- *
- * This interface allows to implement associative iterators
- * and containers.
- */
- interface assoc {
-
- /*! \brief Retrieve the current elements key
- *
- * \return \c mixed current key or \c false if no more elements
- */
- function key();
- }
-
- /*! \brief associative foreach() interface
- *
- * This interface extends the forward interface to support keys.
- * With this interface you can do:
- * \code
- $t = new c();
- foreach($t as $key => $elem).
- \endcode
- */
- interface assoc_forward extends forward implements assoc {
- }
-
- /*! \brief associative sequence
- */
- interface assoc_sequence extends sequence implements assoc {
- }
-
- /*! \brief array read only access for objects
- */
- interface array_read {
-
- /*! Check whether or not the given index exists.
- * The returned value is interpreted as converted to bool.
- */
- function exists($index);
-
- /*! Read the value at position $index.
- * This function is only beeing called if exists() returns true.
- */
- function get($index);
- }
-
- /*! \brief array read/write access for objects.
- *
- * The following example shows how to use an array_writer:
- * \code
- class array_emulation implemets spl::array_access {
- private $ar = array();
- function exists($index) {
- return array_key_exists($index, $this->ar);
- }
- function get($index) {
- return $this->ar[$index];
- }
- function set($index, $value) {
- $this->ar[$index] = $value;
- }
- }
- \endcode
- */
- interface array_access extends array_read {
-
- /*! Set the value identified by $index to $value.
- */
- function set($value, $index);
- }
-
- /*! \brief array read/write access with customized array_writer
- *
- * The internal structure requires that write access via interfaces
- * is divided into two parts. First the index is used to create an
- * array_writer which will later receive the new value and calls the
- * containers set() method with appropriate parameters.
- *
- * Sometimes it is helpfull to overwrite this behavior and have your
- * own implementation for the array_writer.
- *
- * The following example shows how to use a customized array_writer:
- * \code
- class array_emulation_ex extends array_emulation implemets spl::array_access_ex {
- private $last_index = NULL;
- function new_writer($index) {
- $last_index = $index;
- return new array_write(&$this, $index);
- }
- }
- \endcode
- */
- interface array_access_ex extends array_access {
-
- /*! Create an array_writer interface for the specified index.
- *
- * If your container uses array_access instead of array_access_ex
- * the following code would be equal to the internal new_writer()
- * method:
- \code
- function new_writer($index) {
- return new array_write(&$this, $index);
- }
- \endcode
- */
- function new_writer($index);
- }
-
- /*! \brief array writer interface
- *
- * for every write access to an array_access instance an array_writer
- * is created which receives the originating object and the index as
- * parameters for the constructor call.
- *
- * The following shows the equivalent php code for the default
- * implementation array_write.
- * \code
- class array_write implements array_writer {
- private $obj;
- private $idx;
- function __construct(&$obj, $index = null) {
- $this->obj = $obj;
- $this->idx = $index;
- }
- function set($value) {
- return $this->obj->set($this->idx, $value);
- }
- }
- \endcode
- *
- * See array_access for more.
- */
- interface array_writer {
-
- /*! Set the corresponding value to $value.
- */
- function set($value);
- }
-
-}
-?> \ No newline at end of file
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
deleted file mode 100755
index 7c68d3c06f..0000000000
--- a/ext/spl/spl_array.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "zend_compile.h"
-#include "zend_execute_locks.h"
-
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-#include "spl_array.h"
-
-#define DELETE_ZVAL(z) \
- if ((z)->refcount < 2) { \
- zval_dtor(z); \
- FREE_ZVAL(z); /* maybe safe_free_zval_ptr is needed for the uninitialised things */ \
- }
-
-#define DELETE_RET_ZVAL(z) \
- if ((z)->refcount < 3) { \
- zval_dtor(z); \
- FREE_ZVAL(z); /* maybe safe_free_zval_ptr is needed for the uninitialised things */ \
- }
-
-#define AI_PTR_2_PTR_PTR(ai) \
- (ai).ptr_ptr = &((ai).ptr)
-
-/* {{{ spl_array_writer_default stuff */
-typedef struct {
- zval *obj;
- zval *idx;
-} spl_array_writer_object;
-
-static zend_class_entry *spl_array_writer_default_get_class(zval *object TSRMLS_DC)
-{
-#ifdef SPL_ARRAY_WRITE
- return spl_ce_array_writer_default;
-#else
- return (zend_class_entry *)1; /* force an error here: this ensures not equal */
-#endif
-}
-
-static zend_object_handlers spl_array_writer_default_handlers = {
- ZEND_OBJECTS_STORE_HANDLERS,
-
- NULL, /* read_property */
- NULL, /* write_property */
- NULL, /* get_property_ptr */
- NULL, /* get_property_zval_ptr */
- NULL, /* get */
- NULL, /* set */
- NULL, /* has_property */
- NULL, /* unset_property */
- NULL, /* get_properties */
- NULL, /* get_method */
- NULL, /* call_method */
- NULL, /* get_constructor */
- spl_array_writer_default_get_class, /* get_class_entry */
- NULL, /* get_class_name */
- NULL /* compare_objects */
-};
-/* }}} */
-
-/* {{{ spl_array_writer_dtor */
-void spl_array_writer_default_dtor(void *object, zend_object_handle handle TSRMLS_DC)
-{
- spl_array_writer_object *writer = (spl_array_writer_object*) object;
-
- if (writer->obj)
- {
- writer->obj->refcount--;
-/* DELETE_ZVAL(writer->obj); */
- }
- if (writer->idx)
- {
- writer->idx->refcount--;
- DELETE_ZVAL(writer->idx);
- }
- efree(writer);
-}
-/* }}} */
-
-/* {{{ spl_array_writer_default_create */
-zend_object_value spl_array_writer_default_create(zend_class_entry *class_type TSRMLS_DC)
-{
- zend_object_value retval;
- spl_array_writer_object *intern;
-
- intern = ecalloc(sizeof(spl_array_writer_object), 1);
-
- retval.handle = zend_objects_store_put(intern, spl_array_writer_default_dtor, NULL TSRMLS_CC);
- retval.handlers = &spl_array_writer_default_handlers;
-
- return retval;
-}
-/* }}} */
-
-/* {{{ spl_array_writer_default_set */
-void spl_array_writer_default_set(zval *object, zval *newval, zval **retval TSRMLS_DC)
-{
- zval *obj, *idx;
- spl_array_writer_object *writer;
-
- writer = (spl_array_writer_object *) zend_object_store_get_object(object TSRMLS_CC);
- obj = writer->obj;
- idx = writer->idx;
- spl_begin_method_call_arg_ex2(&obj, "set", retval, &idx, &newval, 0, NULL TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ SPL_CLASS_FUNCTION(array_writer_default, __construct) */
-SPL_CLASS_FUNCTION(array_writer_default, __construct)
-{
- zval *object = getThis();
- zval *obj, *idx;
- spl_array_writer_object *writer;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &obj, &idx) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to parse parameters");
- return;
- }
- writer = (spl_array_writer_object *) zend_object_store_get_object(object TSRMLS_CC);
- writer->obj = obj; obj->refcount++;
- writer->idx = idx; idx->refcount++;
-
-}
-/* }}} */
-
-/* {{{ SPL_CLASS_FUNCTION(array_writer_default, set) */
-SPL_CLASS_FUNCTION(array_writer_default, set)
-{
- zval *object = getThis();
- zval *newval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &newval) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to parse parameters");
- return;
- }
- spl_array_writer_default_set(object, newval, &return_value TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ spl_fetch_dimension_address */
-int spl_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
-{
- zval **container_ptr = spl_get_zval_ptr_ptr(op1, Ts TSRMLS_CC);
-
- if (spl_is_instance_of(container_ptr, spl_ce_array_read TSRMLS_CC)) {
- zval **retval = &(T(result->u.var).var.ptr);
- zval *dim = spl_get_zval_ptr(op2, Ts, &EG(free_op2) TSRMLS_CC);
- zval *exists;
-
- /*ALLOC_ZVAL(exists); not needed */
- spl_begin_method_call_arg_ex1(container_ptr, "exists", &exists, &dim, 0, NULL TSRMLS_CC);
- if (!i_zend_is_true(exists)) {
- if (type == BP_VAR_R || type == BP_VAR_RW) {
- SEPARATE_ZVAL(&dim);
- convert_to_string_ex(&dim);
- zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(dim));
- DELETE_ZVAL(dim);
- }
- if (type == BP_VAR_R || type == BP_VAR_IS) {
- DELETE_RET_ZVAL(exists);
- *retval = &EG(error_zval);
- (*retval)->refcount++;
- FREE_OP(Ts, op2, EG(free_op2));
- SELECTIVE_PZVAL_LOCK(*retval, result);
- return 0;
- }
- }
- DELETE_RET_ZVAL(exists);
- if (type == BP_VAR_R || type == BP_VAR_IS) {
- spl_begin_method_call_arg_ex1(container_ptr, "get", retval, &dim, 0, NULL TSRMLS_CC);
- (*retval)->refcount--;
- } else
-#ifdef SPL_ARRAY_WRITE
- if (spl_is_instance_of(container_ptr, spl_ce_array_access_ex TSRMLS_CC)) {
- /* array_access_ex instaces have their own way of creating an access_writer */
- spl_begin_method_call_arg_ex1(container_ptr, "new_writer", retval, &dim, 0, NULL TSRMLS_CC);
- T(result->u.var).var.ptr = *retval;
- AI_PTR_2_PTR_PTR(T(result->u.var).var);
- SELECTIVE_PZVAL_LOCK(*retval, result);
- } else if (spl_is_instance_of(container_ptr, spl_ce_array_access TSRMLS_CC)) {
- /* array_access instances create the default array_writer: array_write */
- spl_array_writer_object *writer;
- spl_instanciate(spl_ce_array_writer_default, retval TSRMLS_CC);
- T(result->u.var).var.ptr = *retval;
- AI_PTR_2_PTR_PTR(T(result->u.var).var);
- writer = (spl_array_writer_object *) zend_object_store_get_object(*retval TSRMLS_CC);
- writer->obj = *container_ptr; writer->obj->refcount++;
- writer->idx = dim; writer->idx->refcount++;
- SELECTIVE_PZVAL_LOCK(*retval, result);
- } else {
- zend_error(E_ERROR, "Object must implement spl::array_access for write access");
- retval = &EG(error_zval_ptr);
- }
- SELECTIVE_PZVAL_LOCK(*retval, result);
-#else
- zend_error(E_ERROR, "SPL compiled withut array write hook");
-#endif
- FREE_OP(Ts, op2, EG(free_op2));
- return 0;
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_R) */
-#ifdef SPL_ARRAY_READ
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_R)
-{
- if (!spl_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC))
- {
- if (EX(opline)->extended_value == ZEND_FETCH_ADD_LOCK) {
- PZVAL_LOCK(*EX_T(EX(opline)->op1.u.var).var.ptr_ptr);
- }
- spl_unlock_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
-
- AI_PTR_2_PTR_PTR(EX_T(EX(opline)->result.u.var).var);
- NEXT_OPCODE();
- }
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_FETCH_DIM_R);
-}
-#endif
-/* }}} */
-
-/* {{{ ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_W) */
-#ifdef SPL_ARRAY_READ
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_W)
-{
- if (!spl_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_W TSRMLS_CC))
- {
- spl_unlock_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
-
- NEXT_OPCODE();
- }
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_FETCH_DIM_W);
-}
-#endif
-/* }}} */
-
-/* {{{ ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_RW) */
-#ifdef SPL_ARRAY_READ
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_RW)
-{
- if (!spl_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_RW TSRMLS_CC))
- {
- spl_unlock_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
-
- NEXT_OPCODE();
- }
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_FETCH_DIM_RW);
-}
-#endif
-/* }}} */
-
-/* {{{ ZEND_EXECUTE_HOOK_FUNCTION(ZEND_ASSIGN) */
-#ifdef SPL_ARRAY_WRITE
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_ASSIGN)
-{
- zval **writer = spl_get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
- zval *newval, *retval, *target;
- znode *result;
-
- if (writer && *writer && Z_TYPE_PP(writer) == IS_OBJECT) {
- /* optimization: do pre checks and only test for handlers in case of
- * spl::array_writer_default, for spl::array_writer we must use the
- * long way of calling spl_instance
- * if (spl_is_instance_of(writer, spl_ce_array_writer_default TSRMLS_CC))
- */
- if ((*writer)->value.obj.handlers == &spl_array_writer_default_handlers) {
- newval = spl_get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2) TSRMLS_CC);
- spl_array_writer_default_set(*writer, newval, &retval TSRMLS_CC);
- } else if (spl_is_instance_of(writer, spl_ce_array_writer TSRMLS_CC)) {
- newval = spl_get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2) TSRMLS_CC);
- spl_begin_method_call_arg_ex1(writer, "set", &retval, &newval, 0, NULL TSRMLS_CC);
- } else {
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_ASSIGN);
- }
- } else {
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_ASSIGN);
- }
- spl_unlock_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
-
- result = &EX(opline)->result;
- if (result) {
- if (retval->refcount<2) {
- if ((*writer)->value.obj.handlers == &spl_array_writer_default_handlers) {
- spl_array_writer_object *object = (spl_array_writer_object *) zend_object_store_get_object(*writer TSRMLS_CC);
- target = object->obj;
- } else {
- target = *writer;
- }
- zend_error(E_WARNING, "Method %s::set() did not return a value, using NULL", Z_OBJCE_P(target)->name);
- DELETE_ZVAL(retval);
- DELETE_ZVAL(newval);
- /* Unfortunately it doesn't work when trying to return newval.
- * But anyhow it wouldn't make sense...and confuse reference counting and such.
- */
- retval = &EG(uninitialized_zval);
- } else {
- retval->refcount--;
- }
- EX_T(EX(opline)->result.u.var).var.ptr = retval;
- AI_PTR_2_PTR_PTR(EX_T(EX(opline)->result.u.var).var);
- SELECTIVE_PZVAL_LOCK(retval, result);
- } else {
- retval->refcount = 1;
- DELETE_ZVAL(retval);
- }
-
- (*writer)->refcount = 1;
- DELETE_ZVAL(*writer);
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
-
- NEXT_OPCODE();
-}
-#endif
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl_array.h b/ext/spl/spl_array.h
deleted file mode 100755
index 7f27f5dce1..0000000000
--- a/ext/spl/spl_array.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef SPL_ARRAY_H
-#define SPL_ARRAY_H
-
-#include "php.h"
-#include "php_spl.h"
-
-#ifdef SPL_ARRAY_READ
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_R);
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_W);
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_RW);
-#endif
-
-#ifdef SPL_ARRAY_WRITE
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_ASSIGN);
-#endif
-
-SPL_CLASS_FUNCTION(array_writer_default, __construct);
-SPL_CLASS_FUNCTION(array_writer_default, set);
-
-zend_object_value spl_array_writer_default_create(zend_class_entry *class_type TSRMLS_DC);
-
-#endif /* SPL_ARRAY_H */
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c
deleted file mode 100755
index 04dbd75d78..0000000000
--- a/ext/spl/spl_engine.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "zend_compile.h"
-#include "zend_execute_locks.h"
-
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-
-/* {{{ spl_begin_method_call_arg */
-int spl_begin_method_call_arg(zval **ce, char *function_name, zval *retval, zval *arg1 TSRMLS_DC)
-{
- zval *args[1];
- zval fn_name;
-
- ZVAL_STRING(&fn_name, function_name, 0);
-
- args[0] = arg1;
- return call_user_function(&Z_OBJCE_PP(ce)->function_table, ce, &fn_name, retval, 1, args TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ spl_begin_method_call_this */
-int spl_begin_method_call_this(zval **ce, char *function_name, zval *retval TSRMLS_DC)
-{
- zval fn_name;
-
- ZVAL_STRING(&fn_name, function_name, 0);
-
- return call_user_function(&Z_OBJCE_PP(ce)->function_table, ce, &fn_name, retval, 0, NULL TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ spl_begin_method_call_arg_ex1 */
-int spl_begin_method_call_arg_ex1(zval **ce, char *function_name, zval **retval, zval **arg1, int no_separation, HashTable *symbol_table TSRMLS_DC)
-{
- zval **args[1];
- zval fn_name;
-
- ZVAL_STRING(&fn_name, function_name, 0);
-
- args[0] = arg1;
- return call_user_function_ex(&Z_OBJCE_PP(ce)->function_table, ce, &fn_name, retval, 1, args, no_separation, symbol_table TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ spl_begin_method_call_arg_ex2 */
-int spl_begin_method_call_arg_ex2(zval **ce, char *function_name, zval **retval, zval **arg1, zval **arg2, int no_separation, HashTable *symbol_table TSRMLS_DC)
-{
- zval **args[2];
- zval fn_name;
-
- ZVAL_STRING(&fn_name, function_name, 0);
-
- args[0] = arg1;
- args[1] = arg2;
- return call_user_function_ex(&Z_OBJCE_PP(ce)->function_table, ce, &fn_name, retval, 2, args, no_separation, symbol_table TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ spl_instanciate */
-void spl_instanciate(zend_class_entry *pce, zval **object TSRMLS_DC)
-{
- ALLOC_ZVAL(*object);
- object_init_ex(*object, pce);
- (*object)->refcount = 1;
- (*object)->is_ref = 1; /* check if this can be hold always */
-}
-/* }}} */
-
-/* {{{ spl_instanciate_arg_ex2 */
-int spl_instanciate_arg_ex2(zend_class_entry *pce, zval **retval, zval **arg1, zval **arg2, int no_separation, HashTable *symbol_table TSRMLS_DC)
-{
- zval **args[2];
- zval fn_name;
- zval *object;
-
- spl_instanciate(pce, &object TSRMLS_CC);
-
- retval = &EG(uninitialized_zval_ptr);
-
- ZVAL_STRING(&fn_name, pce->constructor->common.function_name, 0);
-
- args[0] = arg1;
- args[1] = arg2;
- call_user_function_ex(&pce->function_table, &object, &fn_name, retval, 2, args, no_separation, symbol_table TSRMLS_CC);
- *retval = object;
- return 0;
-}
-/* }}} */
-
-/* {{{ spl_get_zval_ptr_ptr
- Remember to call spl_unlock_ptr_ptr when needed */
-zval ** spl_get_zval_ptr_ptr(znode *node, temp_variable *Ts TSRMLS_DC)
-{
- if (node->op_type==IS_VAR) {
- return T(node->u.var).var.ptr_ptr;
- } else {
- return NULL;
- }
-}
-/* }}} */
-
-/* {{{ spl_unlock_zval_ptr_ptr */
-void spl_unlock_zval_ptr_ptr(znode *node, temp_variable *Ts TSRMLS_DC)
-{
- if (node->op_type==IS_VAR) {
- if (T(node->u.var).var.ptr_ptr) {
- PZVAL_UNLOCK(*T(node->u.var).var.ptr_ptr);
- } else if (T(node->u.var).EA.type==IS_STRING_OFFSET) {
- PZVAL_UNLOCK(T(node->u.var).EA.data.str_offset.str);
- }
- }
-}
-/* }}} */
-
-/* {{{ spl_get_zval_ptr */
-zval * spl_get_zval_ptr(znode *node, temp_variable *Ts, zval **should_free TSRMLS_DC)
-{
- switch (node->op_type) {
- case IS_CONST:
- *should_free = 0;
- return &node->u.constant;
- break;
- case IS_TMP_VAR:
- return *should_free = &T(node->u.var).tmp_var;
- break;
- case IS_VAR:
- if (T(node->u.var).var.ptr) {
- PZVAL_UNLOCK(T(node->u.var).var.ptr);
- *should_free = 0;
- return T(node->u.var).var.ptr;
- } else {
- *should_free = &T(node->u.var).tmp_var;
-
- switch (T(node->u.var).EA.type) {
- case IS_STRING_OFFSET: {
- temp_variable *T = &T(node->u.var);
- zval *str = T->EA.data.str_offset.str;
-
- if (T->EA.data.str_offset.str->type != IS_STRING
- || (T->EA.data.str_offset.offset<0)
- || (T->EA.data.str_offset.str->value.str.len <= T->EA.data.str_offset.offset)) {
- zend_error(E_NOTICE, "Uninitialized string offset: %d", T->EA.data.str_offset.offset);
- T->tmp_var.value.str.val = empty_string;
- T->tmp_var.value.str.len = 0;
- } else {
- char c = str->value.str.val[T->EA.data.str_offset.offset];
-
- T->tmp_var.value.str.val = estrndup(&c, 1);
- T->tmp_var.value.str.len = 1;
- }
- PZVAL_UNLOCK(str);
- T->tmp_var.refcount=1;
- T->tmp_var.is_ref=1;
- T->tmp_var.type = IS_STRING;
- return &T->tmp_var;
- }
- break;
- }
- }
- break;
- case IS_UNUSED:
- *should_free = 0;
- return NULL;
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- return NULL;
-}
-/* }}} */
-
-/* {{{ */
-inline zend_class_entry *spl_get_class_entry(zval *obj TSRMLS_DC)
-{
- if (obj && Z_TYPE_P(obj) == IS_OBJECT && Z_OBJ_HT_P(obj)->get_class_entry) {
- return Z_OBJ_HT_P(obj)->get_class_entry(obj TSRMLS_CC);
- } else {
- return NULL;
- }
-}
-/* }}} */
-
-/* {{{ spl_is_instance_of */
-int spl_is_instance_of(zval **obj, zend_class_entry *ce TSRMLS_DC)
-{
- /* Ensure everything needed is available before checking for the type.
- */
- zend_class_entry *instance_ce;
-
- if (obj && (instance_ce = spl_get_class_entry(*obj TSRMLS_CC)) != NULL) {
- if (instanceof_function(instance_ce, ce TSRMLS_CC)) {
- return 1;
- }
- }
- return 0;
-}
-/* }}} */
-
-/* {{{ spl_implements */
-int spl_implements(zval **obj, zend_class_entry *ce TSRMLS_DC)
-{
- /* Ensure everything needed is available before checking for the type.
- */
- zend_class_entry *instance_ce;
-
- if (obj && (instance_ce = spl_get_class_entry(*obj TSRMLS_CC)) != NULL) {
- int i;
-
- while (instance_ce) {
- for (i = 0; i < instance_ce->num_interfaces; i++) {
- if (instance_ce->interfaces[i] == ce) {
- return 1;
- }
- }
- instance_ce = instance_ce->parent;
- }
- }
- return spl_is_instance_of(obj, ce TSRMLS_CC);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl_engine.h b/ext/spl/spl_engine.h
deleted file mode 100755
index db61a1982d..0000000000
--- a/ext/spl/spl_engine.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef SPL_ENGINE_H
-#define SPL_ENGINE_H
-
-#include "php.h"
-#include "php_spl.h"
-
-#include "zend_compile.h"
-#include "zend_execute_locks.h"
-
-#undef EX
-#define EX(element) execute_data->element
-#define EX_T(offset) (*(temp_variable *)((char *) EX(Ts) + offset))
-#define T(offset) (*(temp_variable *)((char *) Ts + offset))
-
-#define NEXT_OPCODE() \
- EX(opline)++; \
- return 0;
-
-int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS);
-
-int spl_begin_method_call_arg(zval **ce, char *function_name, zval *retval, zval *arg1 TSRMLS_DC);
-int spl_begin_method_call_this(zval **ce, char *function_name, zval *retval TSRMLS_DC);
-int spl_begin_method_call_arg_ex1(zval **ce, char *function_name, zval **retval, zval **arg1, int no_separation, HashTable *symbol_table TSRMLS_DC);
-int spl_begin_method_call_arg_ex2(zval **ce, char *function_name, zval **retval, zval **arg1, zval **arg2, int no_separation, HashTable *symbol_table TSRMLS_DC);
-
-void spl_instanciate(zend_class_entry *pce, zval **object TSRMLS_DC);
-int spl_instanciate_arg_ex2(zend_class_entry *pce, zval **retval, zval **arg1, zval **arg2, int no_separation, HashTable *symbol_table TSRMLS_DC);
-
-zval ** spl_get_zval_ptr_ptr(znode *node, temp_variable *Ts TSRMLS_DC);
-void spl_unlock_zval_ptr_ptr(znode *node, temp_variable *Ts TSRMLS_DC);
-zval * spl_get_zval_ptr(znode *node, temp_variable *Ts, zval **should_free TSRMLS_DC);
-
-int spl_is_instance_of(zval **obj, zend_class_entry *ce TSRMLS_DC);
-int spl_implements(zval **obj, zend_class_entry *ce TSRMLS_DC);
-
-#endif /* SPL_ENGINE_H */
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl_foreach.c b/ext/spl/spl_foreach.c
deleted file mode 100755
index cbe7dfd1e2..0000000000
--- a/ext/spl/spl_foreach.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "zend_compile.h"
-#include "zend_execute_locks.h"
-
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-#include "spl_foreach.h"
-
-/* {{{ ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FE_RESET) */
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FE_RESET)
-{
- zval **obj, *retval;
-
- if (EX(opline)->extended_value) {
- obj = spl_get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
- if (spl_implements(obj, spl_ce_iterator TSRMLS_CC)) {
- spl_unlock_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
- MAKE_STD_ZVAL(retval);
- spl_begin_method_call_this(obj, "new_iterator", retval TSRMLS_CC);
- EX_T(EX(opline)->result.u.var).var.ptr = retval;
- EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr;
- EX(opline)->op2.u.EA.type = 0; /* missuse as index */
-
- PZVAL_LOCK(retval);
-
- NEXT_OPCODE();
- } else if (spl_implements(obj, spl_ce_forward TSRMLS_CC)) {
- spl_unlock_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
-
- EX_T(EX(opline)->result.u.var).var.ptr = *obj;
- EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr;
- EX(opline)->op2.u.EA.type = 0; /* missuse as index */
-
- (*obj)->refcount++;
- PZVAL_LOCK(*obj);
-
- NEXT_OPCODE();
- }
- }
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_FE_RESET);
-}
-/* }}} */
-
-/* {{{ ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FE_FETCH) */
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FE_FETCH)
-{
- zval **obj = spl_get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
- zval more, tmp, *value, *key, *result;
-
- if (spl_implements(obj, spl_ce_forward TSRMLS_CC)) {
- zend_uint index = EX(opline)->op2.u.EA.type++;
-
- spl_unlock_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
- PZVAL_LOCK(*obj);
-
- if (index) {
- spl_begin_method_call_this(obj, "next", &more TSRMLS_CC);
- } else if (spl_implements(obj, spl_ce_sequence TSRMLS_CC)) {
- spl_begin_method_call_this(obj, "rewind", &more TSRMLS_CC);
- }
-
- spl_begin_method_call_this(obj, "has_more", &more TSRMLS_CC);
- if (zend_is_true(&more)) {
- result = &EX_T(EX(opline)->result.u.var).tmp_var;
- array_init(result);
- ALLOC_ZVAL(value);
-
- spl_begin_method_call_this(obj, "current", value TSRMLS_CC);
-
- zend_hash_index_update(result->value.ht, 0, &value, sizeof(zval *), NULL);
-
- if (spl_implements(obj, spl_ce_assoc TSRMLS_CC)) {
- ALLOC_ZVAL(key);
- spl_begin_method_call_this(obj, "key", key TSRMLS_CC);
- } else {
- /* If someone makes a reference to this value then there is
- * a real problem. And the only way to avoid it is to alloc
- * dealloc this temporary zval then.
- */
- tmp.value.lval = index;
- tmp.type = IS_LONG;
- tmp.refcount = 0;
- tmp.is_ref = 0;
- key = &tmp;
- }
- zend_hash_index_update(result->value.ht, 1, &key, sizeof(zval *), NULL);
-
- NEXT_OPCODE();
- }
- EX(opline) = op_array->opcodes+EX(opline)->op2.u.opline_num;
- return 0;
- }
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_FE_FETCH);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl_foreach.h b/ext/spl/spl_foreach.h
deleted file mode 100755
index 427f331233..0000000000
--- a/ext/spl/spl_foreach.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef SPL_FOREACH_H
-#define SPL_FOREACH_H
-
-#include "php.h"
-#include "php_spl.h"
-
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FE_RESET);
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FE_FETCH);
-
-#endif /* SPL_FOREACH_H */
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c
deleted file mode 100755
index 1977db1ae9..0000000000
--- a/ext/spl/spl_functions.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_spl.h"
-#include "spl_foreach.h"
-
-/* {{{ spl_destroy_class */
-void spl_destroy_class(zend_class_entry ** ppce)
-{
- SPL_DEBUG(fprintf(stderr, "Destroy(%s): %s\n", (*ppce)->type == ZEND_USER_CLASS ? "user" : "other", (*ppce)->name);)
- destroy_zend_class(ppce);
-}
-/* }}} */
-
-/* {{{ spl_register_namespace */
-void spl_register_namespace(zend_namespace ** ppns, char * namespace_name TSRMLS_DC)
-{
- zend_namespace ns;
-
- INIT_NAMESPACE(ns, namespace_name);
- *ppns = zend_register_internal_namespace(&ns TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ spl_register_interface */
-void spl_register_interface(zend_class_entry ** ppce, zend_namespace * namespace_entry, char * class_name TSRMLS_DC)
-{
- zend_class_entry ce;
-
- INIT_CLASS_ENTRY(ce, class_name, NULL);
- ce.num_interfaces = 0;
- *ppce = zend_register_internal_ns_class(&ce, NULL, namespace_entry, NULL TSRMLS_CC);
-
- /* entries changed by initialize */
- (*ppce)->ce_flags = ZEND_ACC_ABSTRACT | ZEND_ACC_INTERFACE;
- (*ppce)->ns = namespace_entry;
-}
-/* }}} */
-
-/* {{{ spl_register_std_class */
-void spl_register_std_class(zend_class_entry ** ppce, zend_namespace * namespace_entry, char * class_name, void * obj_ctor TSRMLS_DC)
-{
- zend_class_entry ce;
- memset(&ce, 0, sizeof(zend_class_entry));
-
- INIT_CLASS_ENTRY(ce, class_name, NULL);
-
- ce.num_interfaces = 0;
-
- *ppce = zend_register_internal_ns_class(&ce, NULL, namespace_entry, NULL TSRMLS_CC);
-
- /* entries changed by initialize */
- (*ppce)->ce_flags = ZEND_ACC_ABSTRACT | ZEND_ACC_INTERFACE;
- (*ppce)->create_object = obj_ctor;
- (*ppce)->ns = namespace_entry;
-}
-/* }}} */
-
-/* {{{ spl_register_interface_function */
-void spl_register_interface_function(zend_class_entry * class_entry, char * fn_name TSRMLS_DC)
-{
- zend_function function, *reg_function;
- zend_internal_function *pfunction = (zend_internal_function *)&function;
-
- pfunction->type = ZEND_INTERNAL_FUNCTION;
- pfunction->handler = NULL;
- pfunction->arg_types = NULL;
- pfunction->function_name = fn_name;
- pfunction->scope = class_entry;
- pfunction->fn_flags = ZEND_ACC_ABSTRACT | ZEND_ACC_PUBLIC;
- pfunction->ns = class_entry->ns;
- pfunction->prototype = NULL;
- zend_hash_add(&class_entry->function_table, fn_name, strlen(fn_name)+1, &function, sizeof(zend_function), (void**)&reg_function);
-}
-/* }}} */
-
-/* {{{ spl_register_parent_ce */
-void spl_register_parent_ce(zend_class_entry * class_entry, zend_class_entry * parent_class TSRMLS_DC)
-{
- class_entry->parent = parent_class;
-}
-/* }}} */
-
-/* {{{ spl_register_implement */
-void spl_register_implement(zend_class_entry * class_entry, zend_class_entry * interface_entry TSRMLS_DC)
-{
- zend_uint num_interfaces = ++class_entry->num_interfaces;
- class_entry->interfaces = (zend_class_entry **) realloc(class_entry->interfaces, sizeof(zend_class_entry *) * num_interfaces);
- class_entry->interfaces[num_interfaces-1] = interface_entry;
-}
-/* }}} */
-
-/* {{{ spl_register_functions */
-void spl_register_functions(zend_class_entry * class_entry, function_entry * function_list TSRMLS_DC)
-{
- zend_register_functions(class_entry, function_list, &class_entry->function_table, MODULE_PERSISTENT TSRMLS_CC);
-}
-/* }}} */
-
-/* {{ spl_make_fully_qualyfied_name */
-char * spl_make_fully_qualyfied_name(zend_class_entry * pce TSRMLS_DC)
-{
- if (pce->ns && (pce->ns != &CG(global_namespace))) {
- char *retval;
-
- spprintf(&retval, 0, "%s::%s", pce->ns->name, pce->name);
- return retval;
- } else {
- return estrdup(pce->name);
- }
-}
-/* }}} */
-
-/* {{{ spl_add_class_name */
-void spl_add_class_name(zval * list, zend_class_entry * pce TSRMLS_DC)
-{
- char * str = spl_make_fully_qualyfied_name(pce TSRMLS_CC);
- zval *tmp;
-
- if (zend_hash_find(Z_ARRVAL_P(list), str, strlen(str)+1, (void*)&tmp) == FAILURE) {
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, 0);
- zend_hash_add(Z_ARRVAL_P(list), str, strlen(str)+1, &tmp, sizeof(zval *), NULL);
- } else {
- efree(str);
- }
-}
-/* }}} */
-
-/* {{{ spl_add_interfaces */
-void spl_add_interfaces(zval *list, zend_class_entry * pce TSRMLS_DC)
-{
- zend_uint num_interfaces;
-
- for (num_interfaces = 0; num_interfaces < pce->num_interfaces; num_interfaces++) {
- spl_add_class_name(list, pce->interfaces[num_interfaces] TSRMLS_CC);
- spl_add_interfaces(list, pce->interfaces[num_interfaces] TSRMLS_CC);
- }
- if (pce->parent) {
- spl_add_class_name(list, pce->parent TSRMLS_CC);
- spl_add_interfaces(list, pce->parent TSRMLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ spl_add_interfaces */
-int spl_add_classes(zend_class_entry ** ppce, zval *list TSRMLS_DC)
-{
- spl_add_class_name(list, *ppce TSRMLS_CC);
- if ((*ppce)->parent) {
- spl_add_classes(&(*ppce)->parent, list TSRMLS_CC);
- }
- spl_add_interfaces(list, *ppce TSRMLS_CC);
- return 0;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h
deleted file mode 100755
index f6a7b57ab4..0000000000
--- a/ext/spl/spl_functions.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_FUNCTIONS_H
-#define PHP_FUNCTIONS_H
-
-#include "php.h"
-
-typedef zend_object_value (*create_object_func_t)(zend_class_entry *class_type TSRMLS_DC);
-
-#define REGISTER_SPL_NAMESPACE(namespace_name) \
- spl_register_namespace(&spl_ns_ ## namespace_name, # namespace_name TSRMLS_CC);
-
-#define REGISTER_SPL_STD_CLASS(namespace_name, class_name, obj_ctor) \
- spl_register_std_class(&spl_ce_ ## class_name, spl_ns_ ## namespace_name, # class_name, obj_ctor TSRMLS_CC);
-
-#define REGISTER_SPL_INTERFACE(namespace_name, class_name) \
- spl_register_interface(&spl_ce_ ## class_name, spl_ns_ ## namespace_name, # class_name TSRMLS_CC);
-
-#define REGISTER_SPL_INTF_FUNC(namespace_name, class_name, function_name) \
- spl_register_interface_function(spl_ce_ ## class_name, # function_name TSRMLS_CC);
-
-#define REGISTER_SPL_PARENT_CE(namespace_name, class_name, parent_class) \
- spl_register_parent_ce(spl_ce_ ## class_name, spl_ce_ ## parent_class TSRMLS_CC);
-
-#define REGISTER_SPL_IMPLEMENT(namespace_name, class_name, interface_name) \
- spl_register_implement(spl_ce_ ## class_name, spl_ce_ ## interface_name TSRMLS_CC);
-
-#define REGISTER_SPL_FUNCTIONS(namespace_name, class_name, function_list) \
- spl_register_functions(spl_ce_ ## class_name, function_list TSRMLS_CC);
-
-void spl_destroy_class(zend_class_entry ** ppce);
-
-void spl_register_namespace(zend_namespace ** ppns, char * namespace_name TSRMLS_DC);
-
-void spl_register_std_class(zend_class_entry ** ppce, zend_namespace * namespace_entry, char * class_name, create_object_func_t ctor TSRMLS_DC);
-
-void spl_register_interface(zend_class_entry ** ppce, zend_namespace * namespace_entry, char * class_name TSRMLS_DC);
-
-void spl_register_interface_function(zend_class_entry * class_entry, char * fn_name TSRMLS_DC);
-void spl_register_parent_ce(zend_class_entry * class_entry, zend_class_entry * parent_class TSRMLS_DC);
-void spl_register_implement(zend_class_entry * class_entry, zend_class_entry * interface_entry TSRMLS_DC);
-void spl_register_functions(zend_class_entry * class_entry, function_entry * function_list TSRMLS_DC);
-
-char * spl_make_fully_qualyfied_name(zend_class_entry * pce TSRMLS_DC);
-void spl_add_class_name(zval * list, zend_class_entry * pce TSRMLS_DC);
-void spl_add_interfaces(zval *list, zend_class_entry * pce TSRMLS_DC);
-int spl_add_classes(zend_class_entry ** ppce, zval *list TSRMLS_DC);
-
-#define SPL_CLASS_FE(class_name, function_name, arg_types) \
- PHP_NAMED_FE( function_name, spl_ ## class_name ## function_name, arg_types)
-
-#define SPL_CLASS_FUNCTION(class_name, function_name) \
- PHP_NAMED_FUNCTION(spl_ ## class_name ## function_name)
-
-#endif /* PHP_FUNCTIONS_H */
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/tests/.htaccess b/ext/spl/tests/.htaccess
deleted file mode 100755
index 5a01a1c16e..0000000000
--- a/ext/spl/tests/.htaccess
+++ /dev/null
@@ -1,3 +0,0 @@
-<IfModule mod_autoindex.c>
- IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t *.php
-</IfModule>
diff --git a/ext/spl/tests/array_access_001.phpt b/ext/spl/tests/array_access_001.phpt
deleted file mode 100755
index 5748a5c594..0000000000
--- a/ext/spl/tests/array_access_001.phpt
+++ /dev/null
@@ -1,127 +0,0 @@
---TEST--
-SPL: array_access
---SKIPIF--
-<?php
- if (!extension_loaded("spl")) die("skip");
- if (!in_array("spl::array_access",spl_classes())) die("skip spl::array_access not present");
-?>
---FILE--
-<?php
-class c implements spl::array_access {
-
- public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
- function exists($index) {
- echo __METHOD__ . "($index)\n";
- return array_key_exists($index, $this->a);
- }
- function get($index) {
- echo __METHOD__ . "($index)\n";
- return $this->a[$index];
- }
- function set($index, $newval) {
- echo __METHOD__ . "($index,$newval)\n";
- return $this->a[$index] = $newval;
- }
-}
-
-$obj = new c();
-
-var_dump($obj->a);
-
-var_dump($obj[0]);
-var_dump($obj[1]);
-var_dump($obj[2]);
-var_dump($obj['4th']);
-var_dump($obj['5th']);
-var_dump($obj[6]);
-
-echo "WRITE 1\n";
-$obj[1] = 'Changed 1';
-var_dump($obj[1]);
-echo "WRITE 2\n";
-$obj['4th'] = 'Changed 4th';
-var_dump($obj['4th']);
-echo "WRITE 3\n";
-$obj['5th'] = 'Added 5th';
-var_dump($obj['5th']);
-echo "WRITE 4\n";
-$obj[6] = 'Added 6';
-var_dump($obj[6]);
-
-var_dump($obj[0]);
-var_dump($obj[2]);
-
-$x = $obj[6] = 'changed 6';
-var_dump($obj[6]);
-var_dump($x);
-
-print "Done\n";
-?>
---EXPECTF--
-array(4) {
- [0]=>
- string(3) "1st"
- [1]=>
- int(1)
- [2]=>
- string(3) "3rd"
- ["4th"]=>
- int(4)
-}
-c::exists(0)
-c::get(0)
-string(3) "1st"
-c::exists(1)
-c::get(1)
-int(1)
-c::exists(2)
-c::get(2)
-string(3) "3rd"
-c::exists(4th)
-c::get(4th)
-int(4)
-c::exists(5th)
-
-Notice: Undefined index: 5th in %s on line %d
-NULL
-c::exists(6)
-
-Notice: Undefined index: 6 in %s on line %d
-NULL
-WRITE 1
-c::exists(1)
-c::set(1,Changed 1)
-c::exists(1)
-c::get(1)
-string(9) "Changed 1"
-WRITE 2
-c::exists(4th)
-c::set(4th,Changed 4th)
-c::exists(4th)
-c::get(4th)
-string(11) "Changed 4th"
-WRITE 3
-c::exists(5th)
-c::set(5th,Added 5th)
-c::exists(5th)
-c::get(5th)
-string(9) "Added 5th"
-WRITE 4
-c::exists(6)
-c::set(6,Added 6)
-c::exists(6)
-c::get(6)
-string(7) "Added 6"
-c::exists(0)
-c::get(0)
-string(3) "1st"
-c::exists(2)
-c::get(2)
-string(3) "3rd"
-c::exists(6)
-c::set(6,changed 6)
-c::exists(6)
-c::get(6)
-string(9) "changed 6"
-string(9) "changed 6"
-Done
diff --git a/ext/spl/tests/array_access_002.phpt b/ext/spl/tests/array_access_002.phpt
deleted file mode 100755
index d415b19248..0000000000
--- a/ext/spl/tests/array_access_002.phpt
+++ /dev/null
@@ -1,137 +0,0 @@
---TEST--
-SPL: array_access without return in set()
---SKIPIF--
-<?php
- if (!extension_loaded("spl")) die("skip");
- if (!in_array("spl::array_access",spl_classes())) die("skip spl::array_access not present");
-?>
---FILE--
-<?php
-class c implements spl::array_access {
-
- public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
- function exists($index) {
- echo __METHOD__ . "($index)\n";
- return array_key_exists($index, $this->a);
- }
- function get($index) {
- echo __METHOD__ . "($index)\n";
- return $this->a[$index];
- }
- function set($index, $newval) {
- echo __METHOD__ . "($index,$newval)\n";
- /* return */ $this->a[$index] = $newval;
- }
-}
-
-$obj = new c();
-
-var_dump($obj->a);
-
-var_dump($obj[0]);
-var_dump($obj[1]);
-var_dump($obj[2]);
-var_dump($obj['4th']);
-var_dump($obj['5th']);
-var_dump($obj[6]);
-
-echo "WRITE 1\n";
-$obj[1] = 'Changed 1';
-var_dump($obj[1]);
-echo "WRITE 2\n";
-$obj['4th'] = 'Changed 4th';
-var_dump($obj['4th']);
-echo "WRITE 3\n";
-$obj['5th'] = 'Added 5th';
-var_dump($obj['5th']);
-echo "WRITE 4\n";
-$obj[6] = 'Added 6';
-var_dump($obj[6]);
-
-var_dump($obj[0]);
-var_dump($obj[2]);
-
-$x = $obj[6] = 'changed 6';
-var_dump($obj[6]);
-var_dump($x);
-
-print "Done\n";
-?>
---EXPECTF--
-array(4) {
- [0]=>
- string(3) "1st"
- [1]=>
- int(1)
- [2]=>
- string(3) "3rd"
- ["4th"]=>
- int(4)
-}
-c::exists(0)
-c::get(0)
-string(3) "1st"
-c::exists(1)
-c::get(1)
-int(1)
-c::exists(2)
-c::get(2)
-string(3) "3rd"
-c::exists(4th)
-c::get(4th)
-int(4)
-c::exists(5th)
-
-Notice: Undefined index: 5th in %s on line %d
-NULL
-c::exists(6)
-
-Notice: Undefined index: 6 in %s on line %d
-NULL
-WRITE 1
-c::exists(1)
-c::set(1,Changed 1)
-
-Warning: Method c::set() did not return a value, using NULL in %s on line %d
-c::exists(1)
-c::get(1)
-string(9) "Changed 1"
-WRITE 2
-c::exists(4th)
-c::set(4th,Changed 4th)
-
-Warning: Method c::set() did not return a value, using NULL in %s on line %d
-c::exists(4th)
-c::get(4th)
-string(11) "Changed 4th"
-WRITE 3
-c::exists(5th)
-c::set(5th,Added 5th)
-
-Warning: Method c::set() did not return a value, using NULL in %s on line %d
-c::exists(5th)
-c::get(5th)
-string(9) "Added 5th"
-WRITE 4
-c::exists(6)
-c::set(6,Added 6)
-
-Warning: Method c::set() did not return a value, using NULL in %s on line %d
-c::exists(6)
-c::get(6)
-string(7) "Added 6"
-c::exists(0)
-c::get(0)
-string(3) "1st"
-c::exists(2)
-c::get(2)
-string(3) "3rd"
-c::exists(6)
-c::set(6,changed 6)
-
-Warning: Method c::set() did not return a value, using NULL in %s on line %d
-c::exists(6)
-c::get(6)
-string(9) "changed 6"
-NULL
-Done
diff --git a/ext/spl/tests/array_access_ex.phpt b/ext/spl/tests/array_access_ex.phpt
deleted file mode 100755
index 2800c0508e..0000000000
--- a/ext/spl/tests/array_access_ex.phpt
+++ /dev/null
@@ -1,154 +0,0 @@
---TEST--
-SPL: array_access
---SKIPIF--
-<?php
- if (!extension_loaded("spl")) die("skip");
- if (!in_array("spl::array_access",spl_classes())) die("skip spl::array_access not present");
-?>
---FILE--
-<?php
-class array_write implements spl::array_writer {
- private $obj;
- private $idx;
-
- function __construct(&$obj, $index = null) {
- $this->obj = &$obj;
- $this->idx = $index;
- }
-
- function set($value) {
- echo __METHOD__ . "($value,".$this->idx.")\n";
- return $this->obj->set($this->idx, $value);
- }
-}
-
-class c implements spl::array_access_ex {
-
- public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
-
- function new_writer($index) {
- return new array_write(&$this, $index);
- }
-
- function exists($index) {
- echo __METHOD__ . "($index)\n";
- return array_key_exists($index, $this->a);
- }
-
- function get($index) {
- echo __METHOD__ . "($index)\n";
- return $this->a[$index];
- }
-
- function set($index, $newval) {
- echo __METHOD__ . "($index,$newval)\n";
- return $this->a[$index] = $newval;
- }
-}
-
-$obj = new c();
-
-var_dump($obj->a);
-
-var_dump($obj[0]);
-var_dump($obj[1]);
-var_dump($obj[2]);
-var_dump($obj['4th']);
-var_dump($obj['5th']);
-var_dump($obj[6]);
-
-echo "WRITE 1\n";
-$obj[1] = 'Changed 1';
-var_dump($obj[1]);
-echo "WRITE 2\n";
-$obj['4th'] = 'Changed 4th';
-var_dump($obj['4th']);
-echo "WRITE 3\n";
-$obj['5th'] = 'Added 5th';
-var_dump($obj['5th']);
-echo "WRITE 4\n";
-$obj[6] = 'Added 6';
-var_dump($obj[6]);
-
-var_dump($obj[0]);
-var_dump($obj[2]);
-
-$x = $obj[6] = 'changed 6';
-var_dump($obj[6]);
-var_dump($x);
-
-print "Done\n";
-?>
---EXPECTF--
-array(4) {
- [0]=>
- string(3) "1st"
- [1]=>
- int(1)
- [2]=>
- string(3) "3rd"
- ["4th"]=>
- int(4)
-}
-c::exists(0)
-c::get(0)
-string(3) "1st"
-c::exists(1)
-c::get(1)
-int(1)
-c::exists(2)
-c::get(2)
-string(3) "3rd"
-c::exists(4th)
-c::get(4th)
-int(4)
-c::exists(5th)
-
-Notice: Undefined index: 5th in /usr/src/php5/ext/spl/tests/array_access_ex.php on line 49
-NULL
-c::exists(6)
-
-Notice: Undefined index: 6 in /usr/src/php5/ext/spl/tests/array_access_ex.php on line 50
-NULL
-WRITE 1
-c::exists(1)
-array_write::set(Changed 1,1)
-c::set(1,Changed 1)
-c::exists(1)
-c::get(1)
-string(9) "Changed 1"
-WRITE 2
-c::exists(4th)
-array_write::set(Changed 4th,4th)
-c::set(4th,Changed 4th)
-c::exists(4th)
-c::get(4th)
-string(11) "Changed 4th"
-WRITE 3
-c::exists(5th)
-array_write::set(Added 5th,5th)
-c::set(5th,Added 5th)
-c::exists(5th)
-c::get(5th)
-string(9) "Added 5th"
-WRITE 4
-c::exists(6)
-array_write::set(Added 6,6)
-c::set(6,Added 6)
-c::exists(6)
-c::get(6)
-string(7) "Added 6"
-c::exists(0)
-c::get(0)
-string(3) "1st"
-c::exists(2)
-c::get(2)
-string(3) "3rd"
-c::exists(6)
-array_write::set(changed 6,6)
-c::set(6,changed 6)
-c::exists(6)
-c::get(6)
-string(9) "changed 6"
-string(9) "changed 6"
-Done
diff --git a/ext/spl/tests/array_read.phpt b/ext/spl/tests/array_read.phpt
deleted file mode 100755
index b1e95fd6a1..0000000000
--- a/ext/spl/tests/array_read.phpt
+++ /dev/null
@@ -1,208 +0,0 @@
---TEST--
-SPL: array_read
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-echo "EXTERNAL\n";
-
-$a = array('1st', 1, 2=>'3rd', '4th'=>4);
-var_dump($a);
-
-class external implements spl::array_read {
-
- function exists($index) {
- echo __METHOD__ . "($index)\n";
- return array_key_exists($index, $GLOBALS['a']);
- }
-
- function get($index) {
- echo __METHOD__ . "($index)\n";
- return $GLOBALS['a'][$index];
- }
-}
-
-$obj = new external();
-
-var_dump($obj->get(0));
-var_dump($obj->get(1));
-var_dump($obj->get(2));
-var_dump($obj->get('4th'));
-var_dump($obj->get('5th'));
-var_dump($obj->get(6));
-
-var_dump($obj[0]);
-var_dump($obj[1]);
-var_dump($obj[2]);
-var_dump($obj['4th']);
-var_dump($obj['5th']);
-var_dump($obj[6]);
-
-$out = $obj[0]; echo "$out\n";
-$out = $obj[1]; echo "$out\n";
-$out = $obj[2]; echo "$out\n";
-$out = $obj['4th']; echo "$out\n";
-
-echo "INTERNAL\n";
-
-class internal implements spl::array_read {
-
- public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
-
- function exists($index) {
- echo __METHOD__ . "($index)\n";
- return array_key_exists($index, $GLOBALS['a']);
- }
-
- function get($index) {
- echo __METHOD__ . "($index)\n";
- return $GLOBALS['a'][$index];
- }
-}
-
-$obj = new internal();
-
-var_dump($obj->a);
-
-var_dump($obj->get(0));
-var_dump($obj->get(1));
-var_dump($obj->get(2));
-var_dump($obj->get('4th'));
-var_dump($obj->get('5th'));
-var_dump($obj->get(6));
-
-var_dump($obj[0]);
-var_dump($obj[1]);
-var_dump($obj[2]);
-var_dump($obj['4th']);
-var_dump($obj['5th']);
-var_dump($obj[6]);
-
-$out = $obj[0]; echo "$out\n";
-$out = $obj[1]; echo "$out\n";
-$out = $obj[2]; echo "$out\n";
-$out = $obj['4th']; echo "$out\n";
-
-print "Done\n";
-?>
---EXPECTF--
-EXTERNAL
-array(4) {
- [0]=>
- string(3) "1st"
- [1]=>
- int(1)
- [2]=>
- string(3) "3rd"
- ["4th"]=>
- int(4)
-}
-external::get(0)
-string(3) "1st"
-external::get(1)
-int(1)
-external::get(2)
-string(3) "3rd"
-external::get(4th)
-int(4)
-external::get(5th)
-
-Notice: Undefined index: 5th in %s on line %d
-NULL
-external::get(6)
-
-Notice: Undefined offset: 6 in %s on line %d
-NULL
-external::exists(0)
-external::get(0)
-string(3) "1st"
-external::exists(1)
-external::get(1)
-int(1)
-external::exists(2)
-external::get(2)
-string(3) "3rd"
-external::exists(4th)
-external::get(4th)
-int(4)
-external::exists(5th)
-
-Notice: Undefined index: 5th in %s on line %d
-NULL
-external::exists(6)
-
-Notice: Undefined index: 6 in %s on line %d
-NULL
-external::exists(0)
-external::get(0)
-1st
-external::exists(1)
-external::get(1)
-1
-external::exists(2)
-external::get(2)
-3rd
-external::exists(4th)
-external::get(4th)
-4
-INTERNAL
-array(4) {
- [0]=>
- string(3) "1st"
- [1]=>
- int(1)
- [2]=>
- string(3) "3rd"
- ["4th"]=>
- int(4)
-}
-internal::get(0)
-string(3) "1st"
-internal::get(1)
-int(1)
-internal::get(2)
-string(3) "3rd"
-internal::get(4th)
-int(4)
-internal::get(5th)
-
-Notice: Undefined index: 5th in %s on line %d
-NULL
-internal::get(6)
-
-Notice: Undefined offset: 6 in %s on line %d
-NULL
-internal::exists(0)
-internal::get(0)
-string(3) "1st"
-internal::exists(1)
-internal::get(1)
-int(1)
-internal::exists(2)
-internal::get(2)
-string(3) "3rd"
-internal::exists(4th)
-internal::get(4th)
-int(4)
-internal::exists(5th)
-
-Notice: Undefined index: 5th in %s on line %d
-NULL
-internal::exists(6)
-
-Notice: Undefined index: 6 in %s on line %d
-NULL
-internal::exists(0)
-internal::get(0)
-1st
-internal::exists(1)
-internal::get(1)
-1
-internal::exists(2)
-internal::get(2)
-3rd
-internal::exists(4th)
-internal::get(4th)
-4
-Done
diff --git a/ext/spl/tests/foreach.phpt b/ext/spl/tests/foreach.phpt
deleted file mode 100755
index 6803e44c27..0000000000
--- a/ext/spl/tests/foreach.phpt
+++ /dev/null
@@ -1,184 +0,0 @@
---TEST--
-SPL: foreach and iterator
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-class c_iter implements spl::forward_assoc {
-
- private $obj;
- private $num = 0;
-
- function __construct($obj) {
- $this->obj = $obj;
- }
- function current() {
- echo __CLASS__ . '::' . __FUNCTION__ . "\n";
- return $this->num;
- }
- function next() {
- echo __CLASS__ . '::' . __FUNCTION__ . "\n";
- $this->num++;
- }
- function has_more() {
- echo __CLASS__ . '::' . __FUNCTION__ . "\n";
- return $this->num < $this->obj->max;
- }
- function key() {
- echo __CLASS__ . '::' . __FUNCTION__ . "\n";
- switch($this->num) {
- case 0: return "1st";
- case 1: return "2nd";
- case 2: return "3rd";
- default: return "???";
- }
- }
-}
-
-class c implements spl::iterator {
-
- public $max = 3;
-
- function new_iterator() {
- echo __CLASS__ . '::' . __FUNCTION__ . "\n";
- return new c_iter($this);
- }
-}
-
-$t = new c();
-
-for ($iter = $t->new_iterator(); $iter->has_more(); $iter->next()) {
- echo $iter->current() . "\n";
-}
-
-$a = array(0,1,2);
-foreach($a as $v) {
- echo "array:$v\n";
-}
-
-foreach($t as $v) {
- echo "object:$v\n";
-}
-
-foreach($t as $v) {
- foreach($t as $w) {
- echo "double:$v:$w\n";
- }
-}
-
-foreach($t as $i => $v) {
- echo "object:$i=>$v\n";
-}
-
-print "Done\n";
-?>
---EXPECT--
-c::new_iterator
-c_iter::has_more
-c_iter::current
-0
-c_iter::next
-c_iter::has_more
-c_iter::current
-1
-c_iter::next
-c_iter::has_more
-c_iter::current
-2
-c_iter::next
-c_iter::has_more
-array:0
-array:1
-array:2
-c::new_iterator
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:0
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:1
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:2
-c_iter::next
-c_iter::has_more
-c::new_iterator
-c_iter::has_more
-c_iter::current
-c_iter::key
-c::new_iterator
-c_iter::has_more
-c_iter::current
-c_iter::key
-double:0:0
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-double:0:1
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-double:0:2
-c_iter::next
-c_iter::has_more
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-c::new_iterator
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-double:1:1
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-double:1:2
-c_iter::next
-c_iter::has_more
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-c::new_iterator
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-double:2:1
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-double:2:2
-c_iter::next
-c_iter::has_more
-c_iter::next
-c_iter::has_more
-c::new_iterator
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:1st=>0
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:2nd=>1
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:3rd=>2
-c_iter::next
-c_iter::has_more
-Done \ No newline at end of file
diff --git a/ext/spl/tests/forward.phpt b/ext/spl/tests/forward.phpt
deleted file mode 100755
index 2c8a584b8a..0000000000
--- a/ext/spl/tests/forward.phpt
+++ /dev/null
@@ -1,115 +0,0 @@
---TEST--
-SPL: forward
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-class c implements spl::forward_assoc {
-
- public $max = 3;
- public $num = 0;
-
- function current() {
- echo __CLASS__ . '::' . __FUNCTION__ . "\n";
- return $this->num;
- }
- function next() {
- echo __CLASS__ . '::' . __FUNCTION__ . "\n";
- $this->num++;
- }
- function has_more() {
- echo __CLASS__ . '::' . __FUNCTION__ . "\n";
- return $this->num < $this->max;
- }
- function key() {
- echo __CLASS__ . '::' . __FUNCTION__ . "\n";
- switch($this->num) {
- case 0: return "1st";
- case 1: return "2nd";
- case 2: return "3rd";
- default: return "???";
- }
- }
-}
-
-$i = new c();
-
-$c_info = array(class_name($i) => array('inheits' => class_parents($i), 'implements' => class_implements($i)));
-print_r($c_info);
-
-echo "1st try\n";
-foreach($i as $w) {
- echo "object:$w\n";
-}
-
-echo "2nd try\n";
-
-foreach($i as $v => $w) {
- echo "object:$v=>$w\n";
-}
-
-echo "3rd try\n";
-$i->num = 0;
-
-foreach($i as $v => $w) {
- echo "object:$v=>$w\n";
-}
-
-print "Done\n";
-?>
---EXPECT--
-Array
-(
- [c] => Array
- (
- [inheits] => Array
- (
- )
-
- [implements] => Array
- (
- [spl::forward_assoc] => spl::forward_assoc
- [spl::assoc] => spl::assoc
- [spl::forward] => spl::forward
- )
-
- )
-
-)
-1st try
-c::has_more
-c::current
-c::key
-object:0
-c::next
-c::has_more
-c::current
-c::key
-object:1
-c::next
-c::has_more
-c::current
-c::key
-object:2
-c::next
-c::has_more
-2nd try
-c::has_more
-3rd try
-c::has_more
-c::current
-c::key
-object:1st=>0
-c::next
-c::has_more
-c::current
-c::key
-object:2nd=>1
-c::next
-c::has_more
-c::current
-c::key
-object:3rd=>2
-c::next
-c::has_more
-Done \ No newline at end of file
diff --git a/ext/spl/tests/sequence.phpt b/ext/spl/tests/sequence.phpt
deleted file mode 100755
index 3608e15c41..0000000000
--- a/ext/spl/tests/sequence.phpt
+++ /dev/null
@@ -1,138 +0,0 @@
---TEST--
-SPL: sequence
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-class c implements spl::iterator {
-
- public $max = 3;
-
- function new_iterator() {
- echo __CLASS__ . '::' . __FUNCTION__ . "\n";
- return new c_iter($this);
- }
-}
-
-class c_iter implements spl::sequence_assoc {
-
- private $obj;
- private $num = 0;
-
- function __construct($obj) {
- $this->obj = $obj;
- }
- function rewind() {
- echo __CLASS__ . '::' . __FUNCTION__ . "\n";
- $this->num = 0;
- }
- function current() {
- echo __CLASS__ . '::' . __FUNCTION__ . "\n";
- return $this->num;
- }
- function next() {
- echo __CLASS__ . '::' . __FUNCTION__ . "\n";
- $this->num++;
- }
- function has_more() {
- echo __CLASS__ . '::' . __FUNCTION__ . "\n";
- return $this->num < $this->obj->max;
- }
- function key() {
- echo __CLASS__ . '::' . __FUNCTION__ . "\n";
- switch($this->num) {
- case 0: return "1st";
- case 1: return "2nd";
- case 2: return "3rd";
- default: return "???";
- }
- }
-}
-
-$t = new c();
-$i = $t->new_iterator();
-
-$c_info = array(class_name($t) => array('inheits' => class_parents($t), 'implements' => class_implements($t)),
- class_name($i) => array('inheits' => class_parents($i), 'implements' => class_implements($i)));
-print_r($c_info);
-
-foreach($i as $w) {
- echo "object:$w\n";
-}
-
-foreach($i as $v => $w) {
- echo "object:$v=>$w\n";
-}
-
-print "Done\n";
-?>
---EXPECT--
-c::new_iterator
-Array
-(
- [c] => Array
- (
- [inheits] => Array
- (
- )
-
- [implements] => Array
- (
- [spl::iterator] => spl::iterator
- )
-
- )
-
- [c_iter] => Array
- (
- [inheits] => Array
- (
- )
-
- [implements] => Array
- (
- [spl::sequence_assoc] => spl::sequence_assoc
- [spl::forward_assoc] => spl::forward_assoc
- [spl::assoc] => spl::assoc
- [spl::forward] => spl::forward
- [spl::sequence] => spl::sequence
- )
-
- )
-
-)
-c_iter::rewind
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:0
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:1
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:2
-c_iter::next
-c_iter::has_more
-c_iter::rewind
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:1st=>0
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:2nd=>1
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:3rd=>2
-c_iter::next
-c_iter::has_more
-Done \ No newline at end of file
diff --git a/ext/sqlite/EXPERIMENTAL b/ext/sqlite/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/sqlite/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/sqlite/libsqlite/src/opcodes.c b/ext/sqlite/libsqlite/src/opcodes.c
deleted file mode 100644
index 0e611abcd3..0000000000
--- a/ext/sqlite/libsqlite/src/opcodes.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Automatically generated file. Do not edit */
-char *sqliteOpcodeNames[] = { "???",
- "Goto",
- "Gosub",
- "Return",
- "Halt",
- "Integer",
- "String",
- "Pop",
- "Dup",
- "Pull",
- "Push",
- "ColumnName",
- "Callback",
- "NullCallback",
- "Concat",
- "Add",
- "Subtract",
- "Multiply",
- "Divide",
- "Remainder",
- "Function",
- "BitAnd",
- "BitOr",
- "ShiftLeft",
- "ShiftRight",
- "AddImm",
- "MustBeInt",
- "Eq",
- "Ne",
- "Lt",
- "Le",
- "Gt",
- "Ge",
- "StrEq",
- "StrNe",
- "StrLt",
- "StrLe",
- "StrGt",
- "StrGe",
- "And",
- "Or",
- "Negative",
- "AbsValue",
- "Not",
- "BitNot",
- "Noop",
- "If",
- "IfNot",
- "IsNull",
- "NotNull",
- "MakeRecord",
- "MakeIdxKey",
- "MakeKey",
- "IncrKey",
- "Checkpoint",
- "Transaction",
- "Commit",
- "Rollback",
- "ReadCookie",
- "SetCookie",
- "VerifyCookie",
- "OpenAux",
- "OpenWrAux",
- "OpenWrite",
- "Open",
- "OpenTemp",
- "RenameCursor",
- "Close",
- "MoveLt",
- "MoveTo",
- "Distinct",
- "NotFound",
- "Found",
- "IsUnique",
- "NotExists",
- "NewRecno",
- "PutIntKey",
- "PutStrKey",
- "Delete",
- "KeyAsData",
- "Column",
- "Recno",
- "FullKey",
- "NullRow",
- "Last",
- "Rewind",
- "Prev",
- "Next",
- "IdxPut",
- "IdxDelete",
- "IdxRecno",
- "IdxLT",
- "IdxGT",
- "IdxGE",
- "Destroy",
- "Clear",
- "CreateIndex",
- "CreateTable",
- "IntegrityCk",
- "ListWrite",
- "ListRewind",
- "ListRead",
- "ListReset",
- "ListPush",
- "ListPop",
- "SortPut",
- "SortMakeRec",
- "SortMakeKey",
- "Sort",
- "SortNext",
- "SortCallback",
- "SortReset",
- "FileOpen",
- "FileRead",
- "FileColumn",
- "MemStore",
- "MemLoad",
- "MemIncr",
- "AggReset",
- "AggInit",
- "AggFunc",
- "AggFocus",
- "AggSet",
- "AggGet",
- "AggNext",
- "SetInsert",
- "SetFound",
- "SetNotFound",
- "SetFirst",
- "SetNext",
-};
diff --git a/ext/sqlite/libsqlite/src/sqlite.w32.h b/ext/sqlite/libsqlite/src/sqlite.w32.h
deleted file mode 100644
index 317eeb137a..0000000000
--- a/ext/sqlite/libsqlite/src/sqlite.w32.h
+++ /dev/null
@@ -1,692 +0,0 @@
-/*
-** 2001 September 15
-**
-** The author disclaims copyright to this source code. In place of
-** a legal notice, here is a blessing:
-**
-** May you do good and not evil.
-** May you find forgiveness for yourself and forgive others.
-** May you share freely, never taking more than you give.
-**
-*************************************************************************
-** This header file defines the interface that the SQLite library
-** presents to client programs.
-**
-** @(#) $Id$
-*/
-#ifndef _SQLITE_H_
-#define _SQLITE_H_
-#include <stdarg.h> /* Needed for the definition of va_list */
-
-/*
-** Make sure we can call this stuff from C++.
-*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** The version of the SQLite library.
-*/
-#define SQLITE_VERSION "2.8.0"
-
-/*
-** The version string is also compiled into the library so that a program
-** can check to make sure that the lib*.a file and the *.h file are from
-** the same version.
-*/
-extern const char sqlite_version[];
-
-/*
-** The SQLITE_UTF8 macro is defined if the library expects to see
-** UTF-8 encoded data. The SQLITE_ISO8859 macro is defined if the
-** iso8859 encoded should be used.
-*/
-#define SQLITE_ISO8859 1
-
-/*
-** The following constant holds one of two strings, "UTF-8" or "iso8859",
-** depending on which character encoding the SQLite library expects to
-** see. The character encoding makes a difference for the LIKE and GLOB
-** operators and for the LENGTH() and SUBSTR() functions.
-*/
-extern const char sqlite_encoding[];
-
-/*
-** Each open sqlite database is represented by an instance of the
-** following opaque structure.
-*/
-typedef struct sqlite sqlite;
-
-/*
-** A function to open a new sqlite database.
-**
-** If the database does not exist and mode indicates write
-** permission, then a new database is created. If the database
-** does not exist and mode does not indicate write permission,
-** then the open fails, an error message generated (if errmsg!=0)
-** and the function returns 0.
-**
-** If mode does not indicates user write permission, then the
-** database is opened read-only.
-**
-** The Truth: As currently implemented, all databases are opened
-** for writing all the time. Maybe someday we will provide the
-** ability to open a database readonly. The mode parameters is
-** provided in anticipation of that enhancement.
-*/
-sqlite *sqlite_open(const char *filename, int mode, char **errmsg);
-
-/*
-** A function to close the database.
-**
-** Call this function with a pointer to a structure that was previously
-** returned from sqlite_open() and the corresponding database will by closed.
-*/
-void sqlite_close(sqlite *);
-
-/*
-** The type for a callback function.
-*/
-typedef int (*sqlite_callback)(void*,int,char**, char**);
-
-/*
-** A function to executes one or more statements of SQL.
-**
-** If one or more of the SQL statements are queries, then
-** the callback function specified by the 3rd parameter is
-** invoked once for each row of the query result. This callback
-** should normally return 0. If the callback returns a non-zero
-** value then the query is aborted, all subsequent SQL statements
-** are skipped and the sqlite_exec() function returns the SQLITE_ABORT.
-**
-** The 4th parameter is an arbitrary pointer that is passed
-** to the callback function as its first parameter.
-**
-** The 2nd parameter to the callback function is the number of
-** columns in the query result. The 3rd parameter to the callback
-** is an array of strings holding the values for each column.
-** The 4th parameter to the callback is an array of strings holding
-** the names of each column.
-**
-** The callback function may be NULL, even for queries. A NULL
-** callback is not an error. It just means that no callback
-** will be invoked.
-**
-** If an error occurs while parsing or evaluating the SQL (but
-** not while executing the callback) then an appropriate error
-** message is written into memory obtained from malloc() and
-** *errmsg is made to point to that message. The calling function
-** is responsible for freeing the memory that holds the error
-** message. Use sqlite_freemem() for this. If errmsg==NULL,
-** then no error message is ever written.
-**
-** The return value is is SQLITE_OK if there are no errors and
-** some other return code if there is an error. The particular
-** return value depends on the type of error.
-**
-** If the query could not be executed because a database file is
-** locked or busy, then this function returns SQLITE_BUSY. (This
-** behavior can be modified somewhat using the sqlite_busy_handler()
-** and sqlite_busy_timeout() functions below.)
-*/
-int sqlite_exec(
- sqlite*, /* An open database */
- const char *sql, /* SQL to be executed */
- sqlite_callback, /* Callback function */
- void *, /* 1st argument to callback function */
- char **errmsg /* Error msg written here */
-);
-
-/*
-** Return values for sqlite_exec() and sqlite_step()
-*/
-#define SQLITE_OK 0 /* Successful result */
-#define SQLITE_ERROR 1 /* SQL error or missing database */
-#define SQLITE_INTERNAL 2 /* An internal logic error in SQLite */
-#define SQLITE_PERM 3 /* Access permission denied */
-#define SQLITE_ABORT 4 /* Callback routine requested an abort */
-#define SQLITE_BUSY 5 /* The database file is locked */
-#define SQLITE_LOCKED 6 /* A table in the database is locked */
-#define SQLITE_NOMEM 7 /* A malloc() failed */
-#define SQLITE_READONLY 8 /* Attempt to write a readonly database */
-#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite_interrupt() */
-#define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */
-#define SQLITE_CORRUPT 11 /* The database disk image is malformed */
-#define SQLITE_NOTFOUND 12 /* (Internal Only) Table or record not found */
-#define SQLITE_FULL 13 /* Insertion failed because database is full */
-#define SQLITE_CANTOPEN 14 /* Unable to open the database file */
-#define SQLITE_PROTOCOL 15 /* Database lock protocol error */
-#define SQLITE_EMPTY 16 /* (Internal Only) Database table is empty */
-#define SQLITE_SCHEMA 17 /* The database schema changed */
-#define SQLITE_TOOBIG 18 /* Too much data for one row of a table */
-#define SQLITE_CONSTRAINT 19 /* Abort due to contraint violation */
-#define SQLITE_MISMATCH 20 /* Data type mismatch */
-#define SQLITE_MISUSE 21 /* Library used incorrectly */
-#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
-#define SQLITE_AUTH 23 /* Authorization denied */
-#define SQLITE_ROW 100 /* sqlite_step() has another row ready */
-#define SQLITE_DONE 101 /* sqlite_step() has finished executing */
-
-/*
-** Each entry in an SQLite table has a unique integer key. (The key is
-** the value of the INTEGER PRIMARY KEY column if there is such a column,
-** otherwise the key is generated at random. The unique key is always
-** available as the ROWID, OID, or _ROWID_ column.) The following routine
-** returns the integer key of the most recent insert in the database.
-**
-** This function is similar to the mysql_insert_id() function from MySQL.
-*/
-int sqlite_last_insert_rowid(sqlite*);
-
-/*
-** This function returns the number of database rows that were changed
-** (or inserted or deleted) by the most recent called sqlite_exec().
-**
-** All changes are counted, even if they were later undone by a
-** ROLLBACK or ABORT. Except, changes associated with creating and
-** dropping tables are not counted.
-**
-** If a callback invokes sqlite_exec() recursively, then the changes
-** in the inner, recursive call are counted together with the changes
-** in the outer call.
-**
-** SQLite implements the command "DELETE FROM table" without a WHERE clause
-** by dropping and recreating the table. (This is much faster than going
-** through and deleting individual elements form the table.) Because of
-** this optimization, the change count for "DELETE FROM table" will be
-** zero regardless of the number of elements that were originally in the
-** table. To get an accurate count of the number of rows deleted, use
-** "DELETE FROM table WHERE 1" instead.
-*/
-int sqlite_changes(sqlite*);
-
-/* If the parameter to this routine is one of the return value constants
-** defined above, then this routine returns a constant text string which
-** descripts (in English) the meaning of the return value.
-*/
-const char *sqlite_error_string(int);
-#define sqliteErrStr sqlite_error_string /* Legacy. Do not use in new code. */
-
-/* This function causes any pending database operation to abort and
-** return at its earliest opportunity. This routine is typically
-** called in response to a user action such as pressing "Cancel"
-** or Ctrl-C where the user wants a long query operation to halt
-** immediately.
-*/
-void sqlite_interrupt(sqlite*);
-
-
-/* This function returns true if the given input string comprises
-** one or more complete SQL statements.
-**
-** The algorithm is simple. If the last token other than spaces
-** and comments is a semicolon, then return true. otherwise return
-** false.
-*/
-int sqlite_complete(const char *sql);
-
-/*
-** This routine identifies a callback function that is invoked
-** whenever an attempt is made to open a database table that is
-** currently locked by another process or thread. If the busy callback
-** is NULL, then sqlite_exec() returns SQLITE_BUSY immediately if
-** it finds a locked table. If the busy callback is not NULL, then
-** sqlite_exec() invokes the callback with three arguments. The
-** second argument is the name of the locked table and the third
-** argument is the number of times the table has been busy. If the
-** busy callback returns 0, then sqlite_exec() immediately returns
-** SQLITE_BUSY. If the callback returns non-zero, then sqlite_exec()
-** tries to open the table again and the cycle repeats.
-**
-** The default busy callback is NULL.
-**
-** Sqlite is re-entrant, so the busy handler may start a new query.
-** (It is not clear why anyone would every want to do this, but it
-** is allowed, in theory.) But the busy handler may not close the
-** database. Closing the database from a busy handler will delete
-** data structures out from under the executing query and will
-** probably result in a coredump.
-*/
-void sqlite_busy_handler(sqlite*, int(*)(void*,const char*,int), void*);
-
-/*
-** This routine sets a busy handler that sleeps for a while when a
-** table is locked. The handler will sleep multiple times until
-** at least "ms" milleseconds of sleeping have been done. After
-** "ms" milleseconds of sleeping, the handler returns 0 which
-** causes sqlite_exec() to return SQLITE_BUSY.
-**
-** Calling this routine with an argument less than or equal to zero
-** turns off all busy handlers.
-*/
-void sqlite_busy_timeout(sqlite*, int ms);
-
-/*
-** This next routine is really just a wrapper around sqlite_exec().
-** Instead of invoking a user-supplied callback for each row of the
-** result, this routine remembers each row of the result in memory
-** obtained from malloc(), then returns all of the result after the
-** query has finished.
-**
-** As an example, suppose the query result where this table:
-**
-** Name | Age
-** -----------------------
-** Alice | 43
-** Bob | 28
-** Cindy | 21
-**
-** If the 3rd argument were &azResult then after the function returns
-** azResult will contain the following data:
-**
-** azResult[0] = "Name";
-** azResult[1] = "Age";
-** azResult[2] = "Alice";
-** azResult[3] = "43";
-** azResult[4] = "Bob";
-** azResult[5] = "28";
-** azResult[6] = "Cindy";
-** azResult[7] = "21";
-**
-** Notice that there is an extra row of data containing the column
-** headers. But the *nrow return value is still 3. *ncolumn is
-** set to 2. In general, the number of values inserted into azResult
-** will be ((*nrow) + 1)*(*ncolumn).
-**
-** After the calling function has finished using the result, it should
-** pass the result data pointer to sqlite_free_table() in order to
-** release the memory that was malloc-ed. Because of the way the
-** malloc() happens, the calling function must not try to call
-** malloc() directly. Only sqlite_free_table() is able to release
-** the memory properly and safely.
-**
-** The return value of this routine is the same as from sqlite_exec().
-*/
-int sqlite_get_table(
- sqlite*, /* An open database */
- const char *sql, /* SQL to be executed */
- char ***resultp, /* Result written to a char *[] that this points to */
- int *nrow, /* Number of result rows written here */
- int *ncolumn, /* Number of result columns written here */
- char **errmsg /* Error msg written here */
-);
-
-/*
-** Call this routine to free the memory that sqlite_get_table() allocated.
-*/
-void sqlite_free_table(char **result);
-
-/*
-** The following routines are wrappers around sqlite_exec() and
-** sqlite_get_table(). The only difference between the routines that
-** follow and the originals is that the second argument to the
-** routines that follow is really a printf()-style format
-** string describing the SQL to be executed. Arguments to the format
-** string appear at the end of the argument list.
-**
-** All of the usual printf formatting options apply. In addition, there
-** is a "%q" option. %q works like %s in that it substitutes a null-terminated
-** string from the argument list. But %q also doubles every '\'' character.
-** %q is designed for use inside a string literal. By doubling each '\''
-** character it escapes that character and allows it to be inserted into
-** the string.
-**
-** For example, so some string variable contains text as follows:
-**
-** char *zText = "It's a happy day!";
-**
-** We can use this text in an SQL statement as follows:
-**
-** sqlite_exec_printf(db, "INSERT INTO table VALUES('%q')",
-** callback1, 0, 0, zText);
-**
-** Because the %q format string is used, the '\'' character in zText
-** is escaped and the SQL generated is as follows:
-**
-** INSERT INTO table1 VALUES('It''s a happy day!')
-**
-** This is correct. Had we used %s instead of %q, the generated SQL
-** would have looked like this:
-**
-** INSERT INTO table1 VALUES('It's a happy day!');
-**
-** This second example is an SQL syntax error. As a general rule you
-** should always use %q instead of %s when inserting text into a string
-** literal.
-*/
-int sqlite_exec_printf(
- sqlite*, /* An open database */
- const char *sqlFormat, /* printf-style format string for the SQL */
- sqlite_callback, /* Callback function */
- void *, /* 1st argument to callback function */
- char **errmsg, /* Error msg written here */
- ... /* Arguments to the format string. */
-);
-int sqlite_exec_vprintf(
- sqlite*, /* An open database */
- const char *sqlFormat, /* printf-style format string for the SQL */
- sqlite_callback, /* Callback function */
- void *, /* 1st argument to callback function */
- char **errmsg, /* Error msg written here */
- va_list ap /* Arguments to the format string. */
-);
-int sqlite_get_table_printf(
- sqlite*, /* An open database */
- const char *sqlFormat, /* printf-style format string for the SQL */
- char ***resultp, /* Result written to a char *[] that this points to */
- int *nrow, /* Number of result rows written here */
- int *ncolumn, /* Number of result columns written here */
- char **errmsg, /* Error msg written here */
- ... /* Arguments to the format string */
-);
-int sqlite_get_table_vprintf(
- sqlite*, /* An open database */
- const char *sqlFormat, /* printf-style format string for the SQL */
- char ***resultp, /* Result written to a char *[] that this points to */
- int *nrow, /* Number of result rows written here */
- int *ncolumn, /* Number of result columns written here */
- char **errmsg, /* Error msg written here */
- va_list ap /* Arguments to the format string */
-);
-char *sqlite_mprintf(const char*,...);
-
-/*
-** Windows systems should call this routine to free memory that
-** is returned in the in the errmsg parameter of sqlite_open() when
-** SQLite is a DLL. For some reason, it does not work to call free()
-** directly.
-*/
-void sqlite_freemem(void *p);
-
-/*
-** Windows systems need functions to call to return the sqlite_version
-** and sqlite_encoding strings.
-*/
-const char *sqlite_libversion(void);
-const char *sqlite_libencoding(void);
-
-/*
-** A pointer to the following structure is used to communicate with
-** the implementations of user-defined functions.
-*/
-typedef struct sqlite_func sqlite_func;
-
-/*
-** Use the following routines to create new user-defined functions. See
-** the documentation for details.
-*/
-int sqlite_create_function(
- sqlite*, /* Database where the new function is registered */
- const char *zName, /* Name of the new function */
- int nArg, /* Number of arguments. -1 means any number */
- void (*xFunc)(sqlite_func*,int,const char**), /* C code to implement */
- void *pUserData /* Available via the sqlite_user_data() call */
-);
-int sqlite_create_aggregate(
- sqlite*, /* Database where the new function is registered */
- const char *zName, /* Name of the function */
- int nArg, /* Number of arguments */
- void (*xStep)(sqlite_func*,int,const char**), /* Called for each row */
- void (*xFinalize)(sqlite_func*), /* Called once to get final result */
- void *pUserData /* Available via the sqlite_user_data() call */
-);
-
-/*
-** Use the following routine to define the datatype returned by a
-** user-defined function. The second argument can be one of the
-** constants SQLITE_NUMERIC, SQLITE_TEXT, or SQLITE_ARGS or it
-** can be an integer greater than or equal to zero. The datatype
-** will be numeric or text (the only two types supported) if the
-** argument is SQLITE_NUMERIC or SQLITE_TEXT. If the argument is
-** SQLITE_ARGS, then the datatype is numeric if any argument to the
-** function is numeric and is text otherwise. If the second argument
-** is an integer, then the datatype of the result is the same as the
-** parameter to the function that corresponds to that integer.
-*/
-int sqlite_function_type(
- sqlite *db, /* The database there the function is registered */
- const char *zName, /* Name of the function */
- int datatype /* The datatype for this function */
-);
-#define SQLITE_NUMERIC (-1)
-#define SQLITE_TEXT (-2)
-#define SQLITE_ARGS (-3)
-
-/*
-** The user function implementations call one of the following four routines
-** in order to return their results. The first parameter to each of these
-** routines is a copy of the first argument to xFunc() or xFinialize().
-** The second parameter to these routines is the result to be returned.
-** A NULL can be passed as the second parameter to sqlite_set_result_string()
-** in order to return a NULL result.
-**
-** The 3rd argument to _string and _error is the number of characters to
-** take from the string. If this argument is negative, then all characters
-** up to and including the first '\000' are used.
-**
-** The sqlite_set_result_string() function allocates a buffer to hold the
-** result and returns a pointer to this buffer. The calling routine
-** (that is, the implmentation of a user function) can alter the content
-** of this buffer if desired.
-*/
-char *sqlite_set_result_string(sqlite_func*,const char*,int);
-void sqlite_set_result_int(sqlite_func*,int);
-void sqlite_set_result_double(sqlite_func*,double);
-void sqlite_set_result_error(sqlite_func*,const char*,int);
-
-/*
-** The pUserData parameter to the sqlite_create_function() and
-** sqlite_create_aggregate() routines used to register user functions
-** is available to the implementation of the function using this
-** call.
-*/
-void *sqlite_user_data(sqlite_func*);
-
-/*
-** Aggregate functions use the following routine to allocate
-** a structure for storing their state. The first time this routine
-** is called for a particular aggregate, a new structure of size nBytes
-** is allocated, zeroed, and returned. On subsequent calls (for the
-** same aggregate instance) the same buffer is returned. The implementation
-** of the aggregate can use the returned buffer to accumulate data.
-**
-** The buffer allocated is freed automatically be SQLite.
-*/
-void *sqlite_aggregate_context(sqlite_func*, int nBytes);
-
-/*
-** The next routine returns the number of calls to xStep for a particular
-** aggregate function instance. The current call to xStep counts so this
-** routine always returns at least 1.
-*/
-int sqlite_aggregate_count(sqlite_func*);
-
-/*
-** This routine registers a callback with the SQLite library. The
-** callback is invoked (at compile-time, not at run-time) for each
-** attempt to access a column of a table in the database. The callback
-** returns SQLITE_OK if access is allowed, SQLITE_DENY if the entire
-** SQL statement should be aborted with an error and SQLITE_IGNORE
-** if the column should be treated as a NULL value.
-*/
-int sqlite_set_authorizer(
- sqlite*,
- int (*xAuth)(void*,int,const char*,const char*),
- void *pUserData
-);
-
-/*
-** The second parameter to the access authorization function above will
-** be one of the values below. These values signify what kind of operation
-** is to be authorized. The 3rd and 4th parameters to the authorization
-** function will be parameters or NULL depending on which of the following
-** codes is used as the second parameter.
-**
-** Arg-3 Arg-4
-*/
-#define SQLITE_COPY 0 /* Table Name File Name */
-#define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */
-#define SQLITE_CREATE_TABLE 2 /* Table Name NULL */
-#define SQLITE_CREATE_TEMP_INDEX 3 /* Index Name Table Name */
-#define SQLITE_CREATE_TEMP_TABLE 4 /* Table Name NULL */
-#define SQLITE_CREATE_TEMP_TRIGGER 5 /* Trigger Name Table Name */
-#define SQLITE_CREATE_TEMP_VIEW 6 /* View Name NULL */
-#define SQLITE_CREATE_TRIGGER 7 /* Trigger Name Table Name */
-#define SQLITE_CREATE_VIEW 8 /* View Name NULL */
-#define SQLITE_DELETE 9 /* Table Name NULL */
-#define SQLITE_DROP_INDEX 10 /* Index Name Table Name */
-#define SQLITE_DROP_TABLE 11 /* Table Name NULL */
-#define SQLITE_DROP_TEMP_INDEX 12 /* Index Name Table Name */
-#define SQLITE_DROP_TEMP_TABLE 13 /* Table Name NULL */
-#define SQLITE_DROP_TEMP_TRIGGER 14 /* Trigger Name Table Name */
-#define SQLITE_DROP_TEMP_VIEW 15 /* View Name NULL */
-#define SQLITE_DROP_TRIGGER 16 /* Trigger Name Table Name */
-#define SQLITE_DROP_VIEW 17 /* View Name NULL */
-#define SQLITE_INSERT 18 /* Table Name NULL */
-#define SQLITE_PRAGMA 19 /* Pragma Name 1st arg or NULL */
-#define SQLITE_READ 20 /* Table Name Column Name */
-#define SQLITE_SELECT 21 /* NULL NULL */
-#define SQLITE_TRANSACTION 22 /* NULL NULL */
-#define SQLITE_UPDATE 23 /* Table Name Column Name */
-
-/*
-** The return value of the authorization function should be one of the
-** following constants:
-*/
-/* #define SQLITE_OK 0 // Allow access (This is actually defined above) */
-#define SQLITE_DENY 1 /* Abort the SQL statement with an error */
-#define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */
-
-/*
-** Register a function that is called at every invocation of sqlite_exec()
-** or sqlite_compile(). This function can be used (for example) to generate
-** a log file of all SQL executed against a database.
-*/
-void *sqlite_trace(sqlite*, void(*xTrace)(void*,const char*), void*);
-
-/*** The Callback-Free API
-**
-** The following routines implement a new way to access SQLite that does not
-** involve the use of callbacks.
-**
-** An sqlite_vm is an opaque object that represents a single SQL statement
-** that is ready to be executed.
-*/
-typedef struct sqlite_vm sqlite_vm;
-
-/*
-** To execute an SQLite query without the use of callbacks, you first have
-** to compile the SQL using this routine. The 1st parameter "db" is a pointer
-** to an sqlite object obtained from sqlite_open(). The 2nd parameter
-** "zSql" is the text of the SQL to be compiled. The remaining parameters
-** are all outputs.
-**
-** *pzTail is made to point to the first character past the end of the first
-** SQL statement in zSql. This routine only compiles the first statement
-** in zSql, so *pzTail is left pointing to what remains uncompiled.
-**
-** *ppVm is left pointing to a "virtual machine" that can be used to execute
-** the compiled statement. Or if there is an error, *ppVm may be set to NULL.
-** If the input text contained no SQL (if the input is and empty string or
-** a comment) then *ppVm is set to NULL.
-**
-** If any errors are detected during compilation, an error message is written
-** into space obtained from malloc() and *pzErrMsg is made to point to that
-** error message. The calling routine is responsible for freeing the text
-** of this message when it has finished with it. Use sqlite_freemem() to
-** free the message. pzErrMsg may be NULL in which case no error message
-** will be generated.
-**
-** On success, SQLITE_OK is returned. Otherwise and error code is returned.
-*/
-int sqlite_compile(
- sqlite *db, /* The open database */
- const char *zSql, /* SQL statement to be compiled */
- const char **pzTail, /* OUT: uncompiled tail of zSql */
- sqlite_vm **ppVm, /* OUT: the virtual machine to execute zSql */
- char **pzErrmsg /* OUT: Error message. */
-);
-
-/*
-** After an SQL statement has been compiled, it is handed to this routine
-** to be executed. This routine executes the statement as far as it can
-** go then returns. The return value will be one of SQLITE_DONE,
-** SQLITE_ERROR, SQLITE_BUSY, SQLITE_ROW, or SQLITE_MISUSE.
-**
-** SQLITE_DONE means that the execute of the SQL statement is complete
-** an no errors have occurred. sqlite_step() should not be called again
-** for the same virtual machine. *pN is set to the number of columns in
-** the result set and *pazColName is set to an array of strings that
-** describe the column names and datatypes. The name of the i-th column
-** is (*pazColName)[i] and the datatype of the i-th column is
-** (*pazColName)[i+*pN]. *pazValue is set to NULL.
-**
-** SQLITE_ERROR means that the virtual machine encountered a run-time
-** error. sqlite_step() should not be called again for the same
-** virtual machine. *pN is set to 0 and *pazColName and *pazValue are set
-** to NULL. Use sqlite_finalize() to obtain the specific error code
-** and the error message text for the error.
-**
-** SQLITE_BUSY means that an attempt to open the database failed because
-** another thread or process is holding a lock. The calling routine
-** can try again to open the database by calling sqlite_step() again.
-** The return code will only be SQLITE_BUSY if no busy handler is registered
-** using the sqlite_busy_handler() or sqlite_busy_timeout() routines. If
-** a busy handler callback has been registered but returns 0, then this
-** routine will return SQLITE_ERROR and sqltie_finalize() will return
-** SQLITE_BUSY when it is called.
-**
-** SQLITE_ROW means that a single row of the result is now available.
-** The data is contained in *pazValue. The value of the i-th column is
-** (*azValue)[i]. *pN and *pazColName are set as described in SQLITE_DONE.
-** Invoke sqlite_step() again to advance to the next row.
-**
-** SQLITE_MISUSE is returned if sqlite_step() is called incorrectly.
-** For example, if you call sqlite_step() after the virtual machine
-** has halted (after a prior call to sqlite_step() has returned SQLITE_DONE)
-** or if you call sqlite_step() with an incorrectly initialized virtual
-** machine or a virtual machine that has been deleted or that is associated
-** with an sqlite structure that has been closed.
-*/
-int sqlite_step(
- sqlite_vm *pVm, /* The virtual machine to execute */
- int *pN, /* OUT: Number of columns in result */
- const char ***pazValue, /* OUT: Column data */
- const char ***pazColName /* OUT: Column names and datatypes */
-);
-
-/*
-** This routine is called to delete a virtual machine after it has finished
-** executing. The return value is the result code. SQLITE_OK is returned
-** if the statement executed successfully and some other value is returned if
-** there was any kind of error. If an error occurred and pzErrMsg is not
-** NULL, then an error message is written into memory obtained from malloc()
-** and *pzErrMsg is made to point to that error message. The calling routine
-** should use sqlite_freemem() to delete this message when it has finished
-** with it.
-**
-** This routine can be called at any point during the execution of the
-** virtual machine. If the virtual machine has not completed execution
-** when this routine is called, that is like encountering an error or
-** an interrupt. (See sqlite_interrupt().) Incomplete updates may be
-** rolled back and transactions cancelled, depending on the circumstances,
-** and the result code returned will be SQLITE_ABORT.
-*/
-int sqlite_finalize(sqlite_vm*, char **pzErrMsg);
-
-/*
-** Attempt to open the file named in the argument as the auxiliary database
-** file. The auxiliary database file is used to store TEMP tables. But
-** by using this API, it is possible to trick SQLite into opening two
-** separate databases and acting on them as if they were one.
-**
-****** THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE. ******
-*/
-int sqlite_open_aux_file(sqlite *db, const char *zName, char **pzErrMsg);
-
-#ifdef __cplusplus
-} /* End of the 'extern "C"' block */
-#endif
-
-#endif /* _SQLITE_H_ */
diff --git a/ext/sqlite/libsqlite/src/sqlite_config.w32.h b/ext/sqlite/libsqlite/src/sqlite_config.w32.h
deleted file mode 100644
index 3903ffe95e..0000000000
--- a/ext/sqlite/libsqlite/src/sqlite_config.w32.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "config.w32.h"
-#if ZTS
-# define THREADSAFE 1
-#endif
-#if !ZEND_DEBUG && !defined(NDEBUG)
-# define NDEBUG
-#endif
-#define SQLITE_PTR_SZ 4 \ No newline at end of file
diff --git a/ext/sqlite/sqlite.dsp b/ext/sqlite/sqlite.dsp
deleted file mode 100644
index d82a636d52..0000000000
--- a/ext/sqlite/sqlite.dsp
+++ /dev/null
@@ -1,316 +0,0 @@
-# Microsoft Developer Studio Project File - Name="sqlite" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=sqlite - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "sqlite.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "sqlite.mak" CFG="sqlite - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "sqlite - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "sqlite - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "sqlite - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SQLITE_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\php4" /I "..\..\..\php4\main" /I "..\..\..\php4\Zend" /I "..\..\..\php4\TSRM" /I "..\..\..\php4\win32" /I "..\..\..\php_build" /I "..\..\..\php_build\include\lcrzo" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_SQLITE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_sqlite.dll" /libpath:"..\..\..\php4\Release_TS" /libpath:"..\..\..\php4\Release_TS_Inline" /libpath:"..\..\..\php_build\release" /libpath:"..\..\..\php_build\lib\lcrzo"
-
-!ELSEIF "$(CFG)" == "sqlite - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SQLITE_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\php4" /I "..\..\..\php4\main" /I "..\..\..\php4\Zend" /I "..\..\..\php4\TSRM" /I "..\..\..\php4\win32" /I "..\..\..\php_build" /I "..\..\..\php_build\include\lcrzo" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_SQLITE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_sqlite.dll" /pdbtype:sept /libpath:"..\..\..\php4\Debug_TS" /libpath:"..\..\..\php_build\release" /libpath:"..\..\..\php_build\lib\lcrzo"
-
-!ENDIF
-
-# Begin Target
-
-# Name "sqlite - Win32 Release_TS"
-# Name "sqlite - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Group "libsqlite"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\libsqlite\src\auth.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\btree.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\build.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\delete.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\encode.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\expr.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\func.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\hash.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\insert.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\main.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\opcodes.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\os.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\pager.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\parse.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\printf.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\random.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\select.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\sqlite.w32.h
-
-!IF "$(CFG)" == "sqlite - Win32 Release_TS"
-
-# Begin Custom Build
-InputDir=.\libsqlite\src
-InputPath=.\libsqlite\src\sqlite.w32.h
-
-"$(InputDir)\sqlite.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputPath) $(InputDir)\sqlite.h
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "sqlite - Win32 Debug_TS"
-
-# Begin Custom Build
-InputDir=.\libsqlite\src
-InputPath=.\libsqlite\src\sqlite.w32.h
-
-"$(InputDir)\sqlite.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputPath) $(InputDir)\sqlite.h
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\sqlite_config.w32.h
-
-!IF "$(CFG)" == "sqlite - Win32 Release_TS"
-
-# Begin Custom Build
-InputDir=.\libsqlite\src
-InputPath=.\libsqlite\src\sqlite_config.w32.h
-
-"$(InputDir)\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputPath) $(InputDir)\config.h
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "sqlite - Win32 Debug_TS"
-
-# Begin Custom Build
-InputDir=.\libsqlite\src
-InputPath=.\libsqlite\src\sqlite_config.w32.h
-
-"$(InputDir)\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputPath) $(InputDir)\config.h
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\table.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\tokenize.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\trigger.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\update.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\util.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\vdbe.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# Begin Source File
-
-SOURCE=.\libsqlite\src\where.c
-# ADD CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# SUBTRACT CPP /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS"
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\sqlite.c
-# ADD CPP /I "libsqlite\src"
-# SUBTRACT CPP /I "..\..\..\php_build\include\lcrzo"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_sqlite.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/sqlite/tests/sqlite_007.phpt b/ext/sqlite/tests/sqlite_007.phpt
deleted file mode 100755
index c68e165a0c..0000000000
--- a/ext/sqlite/tests/sqlite_007.phpt
+++ /dev/null
@@ -1,51 +0,0 @@
---TEST--
-sqlite: Simple insert/select (unbuffered)
---INI--
-sqlite.assoc_case=0
---SKIPIF--
-<?php
-if (!extension_loaded("sqlite")) print "skip"; ?>
---FILE--
-<?php
-include "blankdb.inc";
-
-sqlite_query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))", $db);
-sqlite_query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)", $db);
-$r = sqlite_unbuffered_query("SELECT * from foo", $db);
-var_dump(sqlite_fetch_array($r, SQLITE_BOTH));
-$r = sqlite_unbuffered_query("SELECT * from foo", $db);
-var_dump(sqlite_fetch_array($r, SQLITE_NUM));
-$r = sqlite_unbuffered_query("SELECT * from foo", $db);
-var_dump(sqlite_fetch_array($r, SQLITE_ASSOC));
-?>
---EXPECT--
-array(6) {
- [0]=>
- string(10) "2002-01-02"
- ["c1"]=>
- string(10) "2002-01-02"
- [1]=>
- string(8) "12:49:00"
- ["c2"]=>
- string(8) "12:49:00"
- [2]=>
- NULL
- ["c3"]=>
- NULL
-}
-array(3) {
- [0]=>
- string(10) "2002-01-02"
- [1]=>
- string(8) "12:49:00"
- [2]=>
- NULL
-}
-array(3) {
- ["c1"]=>
- string(10) "2002-01-02"
- ["c2"]=>
- string(8) "12:49:00"
- ["c3"]=>
- NULL
-}
diff --git a/ext/sqlite/tests/sqlite_008.phpt b/ext/sqlite/tests/sqlite_008.phpt
deleted file mode 100755
index 5886e8f73a..0000000000
--- a/ext/sqlite/tests/sqlite_008.phpt
+++ /dev/null
@@ -1,43 +0,0 @@
---TEST--
-sqlite: fetch all (buffered)
---INI--
-sqlite.assoc_case=0
---SKIPIF--
-<?php # vim:ft=php
-if (!extension_loaded("sqlite")) print "skip"; ?>
---FILE--
-<?php
-include "blankdb.inc";
-
-$data = array(
- "one",
- "two",
- "three"
- );
-
-sqlite_query("CREATE TABLE strings(a VARCHAR)", $db);
-
-foreach ($data as $str) {
- sqlite_query("INSERT INTO strings VALUES('$str')", $db);
-}
-
-$r = sqlite_query("SELECT a from strings", $db);
-while ($row = sqlite_fetch_array($r, SQLITE_NUM)) {
- var_dump($row);
-}
-echo "DONE!\n";
-?>
---EXPECT--
-array(1) {
- [0]=>
- string(3) "one"
-}
-array(1) {
- [0]=>
- string(3) "two"
-}
-array(1) {
- [0]=>
- string(5) "three"
-}
-DONE!
diff --git a/ext/sqlite/tests/sqlite_009.phpt b/ext/sqlite/tests/sqlite_009.phpt
deleted file mode 100755
index 990b6c68f3..0000000000
--- a/ext/sqlite/tests/sqlite_009.phpt
+++ /dev/null
@@ -1,43 +0,0 @@
---TEST--
-sqlite: fetch all (unbuffered)
---INI--
-sqlite.assoc_case=0
---SKIPIF--
-<?php # vim:ft=php
-if (!extension_loaded("sqlite")) print "skip"; ?>
---FILE--
-<?php
-include "blankdb.inc";
-
-$data = array(
- "one",
- "two",
- "three"
- );
-
-sqlite_query("CREATE TABLE strings(a VARCHAR)", $db);
-
-foreach ($data as $str) {
- sqlite_query("INSERT INTO strings VALUES('$str')", $db);
-}
-
-$r = sqlite_unbuffered_query("SELECT a from strings", $db);
-while ($row = sqlite_fetch_array($r, SQLITE_NUM)) {
- var_dump($row);
-}
-echo "DONE!\n";
-?>
---EXPECT--
-array(1) {
- [0]=>
- string(3) "one"
-}
-array(1) {
- [0]=>
- string(3) "two"
-}
-array(1) {
- [0]=>
- string(5) "three"
-}
-DONE!
diff --git a/ext/sqlite/tests/sqlite_010.phpt b/ext/sqlite/tests/sqlite_010.phpt
deleted file mode 100755
index 3715747072..0000000000
--- a/ext/sqlite/tests/sqlite_010.phpt
+++ /dev/null
@@ -1,78 +0,0 @@
---TEST--
-sqlite: fetch all (iterator)
---INI--
-sqlite.assoc_case=0
---SKIPIF--
-<?php # vim:ft=php
-if (!extension_loaded("sqlite")) print "skip"; ?>
---FILE--
-<?php
-include "blankdb.inc";
-
-$data = array(
- "one",
- "two",
- "three"
- );
-
-sqlite_query("CREATE TABLE strings(a VARCHAR)", $db);
-
-foreach ($data as $str) {
- sqlite_query("INSERT INTO strings VALUES('$str')", $db);
-}
-
-$r = sqlite_unbuffered_query("SELECT a from strings", $db);
-while (sqlite_has_more($r)) {
- var_dump(sqlite_current($r, SQLITE_NUM));
- sqlite_next($r);
-}
-$r = sqlite_query("SELECT a from strings", $db);
-while (sqlite_has_more($r)) {
- var_dump(sqlite_current($r, SQLITE_NUM));
- sqlite_next($r);
-}
-sqlite_rewind($r);
-while (sqlite_has_more($r)) {
- var_dump(sqlite_current($r, SQLITE_NUM));
- sqlite_next($r);
-}
-echo "DONE!\n";
-?>
---EXPECT--
-array(1) {
- [0]=>
- string(3) "one"
-}
-array(1) {
- [0]=>
- string(3) "two"
-}
-array(1) {
- [0]=>
- string(5) "three"
-}
-array(1) {
- [0]=>
- string(3) "one"
-}
-array(1) {
- [0]=>
- string(3) "two"
-}
-array(1) {
- [0]=>
- string(5) "three"
-}
-array(1) {
- [0]=>
- string(3) "one"
-}
-array(1) {
- [0]=>
- string(3) "two"
-}
-array(1) {
- [0]=>
- string(5) "three"
-}
-DONE!
diff --git a/ext/sqlite/tests/sqlite_011.phpt b/ext/sqlite/tests/sqlite_011.phpt
deleted file mode 100755
index 1aa6704249..0000000000
--- a/ext/sqlite/tests/sqlite_011.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-sqlite: returned associative column names
---INI--
-sqlite.assoc_case=0
---SKIPIF--
-<?php
-if (!extension_loaded("sqlite")) print "skip"; ?>
---FILE--
-<?php
-include "blankdb.inc";
-
-sqlite_query("CREATE TABLE foo (c1 char, c2 char, c3 char)", $db);
-sqlite_query("CREATE TABLE bar (c1 char, c2 char, c3 char)", $db);
-sqlite_query("INSERT INTO foo VALUES ('1', '2', '3')", $db);
-sqlite_query("INSERT INTO bar VALUES ('4', '5', '6')", $db);
-$r = sqlite_query("SELECT * from foo, bar", $db, SQLITE_ASSOC);
-var_dump(sqlite_fetch_array($r));
-?>
---EXPECT--
-array(3) {
- ["c1"]=>
- string(1) "4"
- ["c2"]=>
- string(1) "5"
- ["c3"]=>
- string(1) "6"
-}
diff --git a/ext/sqlite/tests/sqlite_012.phpt b/ext/sqlite/tests/sqlite_012.phpt
deleted file mode 100755
index 531bf8055b..0000000000
--- a/ext/sqlite/tests/sqlite_012.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-sqlite: read field names
---INI--
-sqlite.assoc_case=0
---SKIPIF--
-<?php # vim:ft=php
-if (!extension_loaded("sqlite")) print "skip"; ?>
---FILE--
-<?php
-include "blankdb.inc";
-
-sqlite_query("CREATE TABLE strings(foo VARCHAR, bar VARCHAR, baz VARCHAR)", $db);
-
-echo "Buffered\n";
-$r = sqlite_query("SELECT * from strings", $db);
-for($i=0; $i<sqlite_num_fields($r); $i++) {
- var_dump(sqlite_field_name($r, $i));
-}
-echo "Unbuffered\n";
-$r = sqlite_unbuffered_query("SELECT * from strings", $db);
-for($i=0; $i<sqlite_num_fields($r); $i++) {
- var_dump(sqlite_field_name($r, $i));
-}
-echo "DONE!\n";
-?>
---EXPECT--
-Buffered
-string(3) "foo"
-string(3) "bar"
-string(3) "baz"
-Unbuffered
-string(3) "foo"
-string(3) "bar"
-string(3) "baz"
-DONE!
diff --git a/ext/sqlite/tests/sqlite_013.phpt b/ext/sqlite/tests/sqlite_013.phpt
deleted file mode 100755
index 6ade531c62..0000000000
--- a/ext/sqlite/tests/sqlite_013.phpt
+++ /dev/null
@@ -1,55 +0,0 @@
---TEST--
-sqlite: fetch column
---INI--
-sqlite.assoc_case=0
---SKIPIF--
-<?php # vim:ft=php
-if (!extension_loaded("sqlite")) print "skip"; ?>
---FILE--
-<?php
-include "blankdb.inc";
-
-$data = array(
- array (0 => 'one', 1 => 'two'),
- array (0 => 'three', 1 => 'four')
- );
-
-sqlite_query("CREATE TABLE strings(a VARCHAR, b VARCHAR)", $db);
-
-foreach ($data as $str) {
- sqlite_query("INSERT INTO strings VALUES('${str[0]}','${str[1]}')", $db);
-}
-
-$r = sqlite_unbuffered_query("SELECT a, b from strings", $db);
-while (sqlite_has_more($r)) {
- var_dump(sqlite_current($r, SQLITE_NUM));
- var_dump(sqlite_column($r, 0));
- var_dump(sqlite_column($r, 1));
- var_dump(sqlite_column($r, 'a'));
- var_dump(sqlite_column($r, 'b'));
- sqlite_next($r);
-}
-echo "DONE!\n";
-?>
---EXPECT--
-array(2) {
- [0]=>
- string(3) "one"
- [1]=>
- string(3) "two"
-}
-string(3) "one"
-string(3) "two"
-string(3) "one"
-string(3) "two"
-array(2) {
- [0]=>
- string(5) "three"
- [1]=>
- string(4) "four"
-}
-string(5) "three"
-string(4) "four"
-string(5) "three"
-string(4) "four"
-DONE!
diff --git a/ext/standard/CREDITS b/ext/standard/CREDITS
deleted file mode 100644
index 4021b08860..0000000000
--- a/ext/standard/CREDITS
+++ /dev/null
@@ -1,3 +0,0 @@
-Assert
-Thies C. Arntzen
-
diff --git a/ext/standard/Makefile.frag b/ext/standard/Makefile.frag
deleted file mode 100644
index 79ed05a992..0000000000
--- a/ext/standard/Makefile.frag
+++ /dev/null
@@ -1,10 +0,0 @@
-
-$(srcdir)/parsedate.c: $(srcdir)/parsedate.y
-
-$(srcdir)/var_unserializer.c: $(srcdir)/var_unserializer.re
- re2c -b $(srcdir)/var_unserializer.re > $@
-
-$(srcdir)/url_scanner_ex.c: $(srcdir)/url_scanner_ex.re
- re2c -b $(srcdir)/url_scanner_ex.re > $@
-
-$(srcdir)/info.c: $(builddir)/../../main/build-defs.h
diff --git a/ext/standard/aggregation.c b/ext/standard/aggregation.c
deleted file mode 100644
index 539795ffd9..0000000000
--- a/ext/standard/aggregation.c
+++ /dev/null
@@ -1,658 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Andrei Zmievski <andrei@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "basic_functions.h"
-#include "aggregation.h"
-#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
-#include "ext/pcre/php_pcre.h"
-#endif
-
-static void aggregation_info_dtor(aggregation_info *info)
-{
- /* FIXME: This is here to make it compile with Engine 2 but part of this module will need rewriting */
-
-#ifndef ZEND_ENGINE_2
- destroy_zend_class(info->new_ce);
- efree(info->new_ce);
-#else
- /* FIXME: In ZE2, there seems to be an issue with refcounts or something between
- * this class entry and the original; there are problems when destroying the
- * function table.
- * Skipping deleting here will prevent a segfault but will leak
- * the class name, the static_members hash and the ce itself.
- * */
-
- /* destroy_zend_class(&info->new_ce); */
-#endif
- zval_ptr_dtor(&info->aggr_members);
-
-}
-
-/* {{{ static zval* array_to_hash */
-static zval *array_to_hash(zval *array)
-{
- zval *hash, **entry;
- char *name_lc;
-
- /*
- * Well, this just transposes the array, popularly known as flipping it, or
- * giving it the finger.
- */
- MAKE_STD_ZVAL(hash);
- array_init(hash);
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(array));
- zend_hash_get_current_data(Z_ARRVAL_P(array), (void**)&entry) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_P(array))) {
- if (Z_TYPE_PP(entry) == IS_STRING) {
- /*
- * I hate case-insensitivity. Die, die, die.
- */
- name_lc = estrndup(Z_STRVAL_PP(entry), Z_STRLEN_PP(entry));
- zend_str_tolower(name_lc, Z_STRLEN_PP(entry));
- add_assoc_bool_ex(hash, name_lc, Z_STRLEN_PP(entry)+1, 1);
- efree(name_lc);
- }
- }
-
- return hash;
-}
-/* }}} */
-
-
-/* {{{ static void aggregate_methods() */
-static void aggregate_methods(zend_class_entry *ce, zend_class_entry *from_ce, int aggr_type, zval *aggr_filter, zend_bool exclude, zval *aggr_methods TSRMLS_DC)
-{
- HashPosition pos;
- zend_function *function;
- char *func_name;
- uint func_name_len;
- ulong num_key;
- zval *list_hash = NULL;
-#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
- pcre *re = NULL;
- pcre_extra *re_extra = NULL;
- int re_options = 0;
-#endif
-
- /*
- * Flip the array for easy lookup, or compile the regexp.
- */
- if (aggr_type == AGGREGATE_BY_LIST) {
- list_hash = array_to_hash(aggr_filter);
- }
-#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
- else if (aggr_type == AGGREGATE_BY_REGEXP) {
- if ((re = pcre_get_compiled_regex(Z_STRVAL_P(aggr_filter), &re_extra, &re_options TSRMLS_CC)) == NULL) {
- return;
- }
- }
-#endif
-
- /*
- * "Just because it's not nice doesn't mean it's not miraculous."
- * -- _Interesting Times_, Terry Pratchett
- */
-
- /*
- * Aggregating by list without exclusion can be done more efficiently if we
- * iterate through the list and check against function table instead of the
- * other way around.
- */
- if (aggr_type != AGGREGATE_BY_LIST || exclude) {
- zend_hash_internal_pointer_reset_ex(&from_ce->function_table, &pos);
- while (zend_hash_get_current_data_ex(&from_ce->function_table, (void**)&function, &pos) == SUCCESS) {
- zend_hash_get_current_key_ex(&from_ce->function_table, &func_name, &func_name_len, &num_key, 0, &pos);
-
- /* We do not aggregate:
- * 1. constructors */
- if (!strncmp(func_name, from_ce->name, MIN(func_name_len-1, from_ce->name_length)) ||
- /* 2. private methods (heh, like we really have them) */
- func_name[0] == '_' ||
- /* 3. explicitly excluded methods */
- (aggr_type == AGGREGATE_BY_LIST && zend_hash_exists(Z_ARRVAL_P(list_hash), func_name, func_name_len))
-#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
- ||
- /* 4. methods matching regexp as modified by the exclusion flag */
- (aggr_type == AGGREGATE_BY_REGEXP && (pcre_exec(re, re_extra, func_name, func_name_len-1, 0, 0, NULL, 0) < 0) ^ exclude) == 1
-#endif
- ) {
- zend_hash_move_forward_ex(&from_ce->function_table, &pos);
- continue;
- }
-
- /*
- * This is where the magic happens.
- */
- if (zend_hash_add(&ce->function_table, func_name, func_name_len,
- (void*)function, sizeof(zend_function), NULL) == SUCCESS) {
-
- add_next_index_stringl(aggr_methods, func_name, func_name_len-1, 1);
- }
-
- zend_hash_move_forward_ex(&from_ce->function_table, &pos);
- }
- } else {
- /*
- * This is just like above except the other way around.
- */
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(list_hash));
- while (zend_hash_get_current_key_ex(Z_ARRVAL_P(list_hash), &func_name, &func_name_len, &num_key, 0, NULL) == HASH_KEY_IS_STRING) {
- if (!strncmp(func_name, from_ce->name, MIN(func_name_len-1, from_ce->name_length)) ||
- func_name[0] == '_' ||
- zend_hash_find(&from_ce->function_table, func_name, func_name_len, (void**)&function) == FAILURE) {
- zend_hash_move_forward(Z_ARRVAL_P(list_hash));
- continue;
- }
-
- if (zend_hash_add(&ce->function_table, func_name, func_name_len,
- (void*)function, sizeof(zend_function), NULL) == SUCCESS) {
- add_next_index_stringl(aggr_methods, func_name, func_name_len-1, 1);
- }
-
- zend_hash_move_forward(Z_ARRVAL_P(list_hash));
- }
- }
-
- if (list_hash) {
- zval_ptr_dtor(&list_hash);
- }
-}
-/* }}} */
-
-
-/* {{{ static void aggregate_properties() */
-static void aggregate_properties(zval *obj, zend_class_entry *from_ce, int aggr_type, zval *aggr_filter, zend_bool exclude, zval *aggr_props TSRMLS_DC)
-{
- HashPosition pos;
- zval **prop;
- char *prop_name;
- uint prop_name_len;
- ulong num_key;
- zval *list_hash = NULL;
-#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
- pcre *re = NULL;
- pcre_extra *re_extra = NULL;
- int re_options = 0;
-#endif
-
- if (!from_ce->constants_updated) {
- zend_hash_apply_with_argument(&from_ce->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
- from_ce->constants_updated = 1;
- }
-
- /*
- * Flip the array for easy lookup, or compile the regexp.
- */
- if (aggr_type == AGGREGATE_BY_LIST) {
- list_hash = array_to_hash(aggr_filter);
- }
-#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
- else if (aggr_type == AGGREGATE_BY_REGEXP) {
- if ((re = pcre_get_compiled_regex(Z_STRVAL_P(aggr_filter), &re_extra, &re_options TSRMLS_CC)) == NULL) {
- return;
- }
- }
-#endif
-
- /*
- * "Just because it's not nice doesn't mean it's not miraculous."
- * -- _Interesting Times_, Terry Pratchett
- */
-
- /*
- * Aggregating by list without exclusion can be done more efficiently if we
- * iterate through the list and check against default properties table
- * instead of the other way around.
- */
- if (aggr_type != AGGREGATE_BY_LIST || exclude) {
- zend_hash_internal_pointer_reset_ex(&from_ce->default_properties, &pos);
- while (zend_hash_get_current_data_ex(&from_ce->default_properties, (void**)&prop, &pos) == SUCCESS) {
- zend_hash_get_current_key_ex(&from_ce->default_properties, &prop_name, &prop_name_len, &num_key, 0, &pos);
-
- /* We do not aggregate:
- * 1. private properties (heh, like we really have them) */
- if (prop_name[0] == '_' ||
- /* 2. explicitly excluded properties */
- (aggr_type == AGGREGATE_BY_LIST && zend_hash_exists(Z_ARRVAL_P(list_hash), prop_name, prop_name_len))
-#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
- ||
- /* 3. properties matching regexp as modified by the exclusion flag */
- (aggr_type == AGGREGATE_BY_REGEXP && (pcre_exec(re, re_extra, prop_name, prop_name_len-1, 0, 0, NULL, 0) < 0) ^ exclude) == 1
-#endif
- ) {
- zend_hash_move_forward_ex(&from_ce->default_properties, &pos);
- continue;
- }
-
- /*
- * This is where the magic happens.
- */
- if (zend_hash_add(Z_OBJPROP_P(obj), prop_name, prop_name_len,
- (void*)prop, sizeof(zval *), NULL) == SUCCESS) {
- zval_add_ref(prop);
- add_next_index_stringl(aggr_props, prop_name, prop_name_len-1, 1);
- }
-
- zend_hash_move_forward_ex(&from_ce->default_properties, &pos);
- }
- } else {
- /*
- * This is just like above except the other way around.
- */
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(list_hash));
- while (zend_hash_get_current_key_ex(Z_ARRVAL_P(list_hash), &prop_name, &prop_name_len, &num_key, 0, NULL) == HASH_KEY_IS_STRING) {
- if (prop_name[0] == '_' ||
- zend_hash_find(&from_ce->default_properties, prop_name, prop_name_len, (void**)&prop) == FAILURE) {
- zend_hash_move_forward(Z_ARRVAL_P(list_hash));
- continue;
- }
-
- if (zend_hash_add(Z_OBJPROP_P(obj), prop_name, prop_name_len,
- (void*)prop, sizeof(zval *), NULL) == SUCCESS) {
- zval_add_ref(prop);
- add_next_index_stringl(aggr_props, prop_name, prop_name_len-1, 1);
- }
-
- zend_hash_move_forward(Z_ARRVAL_P(list_hash));
- }
- }
-
- if (list_hash) {
- zval_ptr_dtor(&list_hash);
- }
-}
-/* }}} */
-
-
-/* {{{ static void aggregate() */
-static void aggregate(INTERNAL_FUNCTION_PARAMETERS, int aggr_what, int aggr_type)
-{
- /* Incoming parameters. */
- zval *obj, *aggr_list = NULL;
- char *class_name, *class_name_lc, *aggr_regexp;
- int class_name_len, aggr_regexp_len;
- zend_bool exclude = 0;
-
- /* Other variables. */
- zval **aggr_members, z_aggr_regexp;
- zend_class_entry *ce, *new_ce;
- zend_function tmp_zend_function;
- aggregation_info aggr_info_new, *aggr_info = &aggr_info_new;
- zval *aggr_methods_new, **aggr_methods = &aggr_methods_new;
- zval *aggr_props_new, **aggr_props = &aggr_props_new;
- zval *aggr_filter = NULL;
- int zpp_result = FAILURE;
-
- /*
- * Ah, the beauty of the new parameter parsing API. Almost as good as Heidi Klum.
- */
- switch (aggr_type) {
- case AGGREGATE_ALL:
- zpp_result = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "os", &obj,
- &class_name, &class_name_len);
- break;
-
- case AGGREGATE_BY_LIST:
- zpp_result = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "osa|b", &obj,
- &class_name, &class_name_len,
- &aggr_list, &exclude);
- break;
-
- case AGGREGATE_BY_REGEXP:
- zpp_result = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oss|b", &obj,
- &class_name, &class_name_len,
- &aggr_regexp, &aggr_regexp_len, &exclude);
- ZVAL_STRINGL(&z_aggr_regexp, aggr_regexp, aggr_regexp_len, 0);
- break;
- }
-
- if (zpp_result == FAILURE) {
- return;
- }
-
- /*
- * Case-insensitivity is like that last freaking mutant from horror movies:
- * irradiated, blown in half, its eyes melting in their sockets, yet still
- * dragging itself closer and closer to you until it's pulverized into
- * microscopic pieces via some last-minute contrivance. And even then you
- * are not sure that it's finally dead. But that's just how I feel.
- */
- class_name_lc = estrndup(class_name, class_name_len);
- zend_str_tolower(class_name_lc, class_name_len);
- if (zend_hash_find(EG(class_table), class_name_lc,
- class_name_len+1, (void **)&ce) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expects the second parameter to be a valid class name, '%s' given", class_name);
- efree(class_name_lc);
- return;
- }
-#ifdef ZEND_ENGINE_2
- ce = *(zend_class_entry**)ce;
-#endif
-
- /*
- * And God said, Let there be light; and there was light. But only once.
- */
- if (!BG(aggregation_table)) {
- BG(aggregation_table) = (HashTable *) emalloc(sizeof(HashTable));
- zend_hash_init(BG(aggregation_table), 5, NULL, (dtor_func_t) aggregation_info_dtor, 0);
- }
-
- /*
- * Digging deep in the rabbit hole with a long object.. and coming up
- * more empty than the imagination of whoever made "Battlefield Earth".
- */
- if (zend_hash_index_find(BG(aggregation_table), (long)obj, (void**)&aggr_info) == FAILURE) {
- zval *tmp;
-
- /*
- * You are not expected to understand this.
- */
- new_ce = emalloc(sizeof(zend_class_entry));
- new_ce->type = ZEND_USER_CLASS;
- new_ce->name = estrndup(Z_OBJCE_P(obj)->name, Z_OBJCE_P(obj)->name_length);
- new_ce->name_length = Z_OBJCE_P(obj)->name_length;
- new_ce->parent = Z_OBJCE_P(obj)->parent;
-#ifdef ZEND_ENGINE_2
- new_ce->refcount = 1;
-#else
- new_ce->refcount = (int *) emalloc(sizeof(int));
- *new_ce->refcount = 1;
-#endif
- new_ce->constants_updated = Z_OBJCE_P(obj)->constants_updated;
- zend_hash_init(&new_ce->function_table, 10, NULL, ZEND_FUNCTION_DTOR, 0);
- zend_hash_init(&new_ce->default_properties, 10, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(&new_ce->function_table, &Z_OBJCE_P(obj)->function_table, (copy_ctor_func_t) function_add_ref, &tmp_zend_function, sizeof(zend_function));
- zend_hash_copy(&new_ce->default_properties, &Z_OBJCE_P(obj)->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
-
-#ifdef ZEND_ENGINE_2
- ALLOC_HASHTABLE(new_ce->static_members);
- zend_hash_init(new_ce->static_members, 10, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(new_ce->static_members, Z_OBJCE_P(obj)->static_members, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
- zend_hash_init(&new_ce->constants_table, 10, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(&new_ce->constants_table, &Z_OBJCE_P(obj)->constants_table, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
- zend_hash_init(&new_ce->class_table, 10, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(&new_ce->class_table, &Z_OBJCE_P(obj)->class_table, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
-
- /*
- zend_hash_init(&new_ce->private_properties, 10, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(&new_ce->private_properties, &Z_OBJCE_P(obj)->private_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
- */
-
- new_ce->constructor = Z_OBJCE_P(obj)->constructor;
- new_ce->destructor = Z_OBJCE_P(obj)->destructor;
- new_ce->clone = Z_OBJCE_P(obj)->clone;
-#endif
-
- new_ce->builtin_functions = Z_OBJCE_P(obj)->builtin_functions;
-#ifndef ZEND_ENGINE_2
- new_ce->handle_function_call = Z_OBJCE_P(obj)->handle_function_call;
- new_ce->handle_property_get = Z_OBJCE_P(obj)->handle_property_get;
- new_ce->handle_property_set = Z_OBJCE_P(obj)->handle_property_set;
-#else
- new_ce->__call = Z_OBJCE_P(obj)->__call;
- new_ce->__get = Z_OBJCE_P(obj)->__get;
- new_ce->__set = Z_OBJCE_P(obj)->__set;
-#endif
- /*
- * Okay, that was kind of exhausting. Let's invoke programmer virtue #1
- * and stuff this where it belongs so we don't have to work so hard next
- * time.
- */
- /* OBJECT FIXME!! won't work with non-standard objects */
-#ifndef ZEND_ENGINE_2
- (Z_OBJ_P(obj))->ce = new_ce;
-#endif
- aggr_info_new.new_ce = new_ce;
- MAKE_STD_ZVAL(aggr_info_new.aggr_members);
- array_init(aggr_info_new.aggr_members);
-
- zend_hash_index_update(BG(aggregation_table), (long)obj,
- (void *)&aggr_info_new, sizeof(aggregation_info), NULL);
-
- } else {
- /*
- * Seek and ye shall find.
- */
- new_ce = aggr_info->new_ce;
- }
-
- /*
- * This should be easy to understand. If not, ask Rasmus about it at his
- * next tutorial.
- */
- if (zend_hash_find(Z_ARRVAL_P(aggr_info->aggr_members), class_name_lc,
- class_name_len+1, (void **)&aggr_members) == FAILURE) {
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
- MAKE_STD_ZVAL(aggr_methods_new);
- array_init(aggr_methods_new);
- MAKE_STD_ZVAL(aggr_props_new);
- array_init(aggr_props_new);
- add_assoc_zval_ex(tmp, "methods", sizeof("methods"), aggr_methods_new);
- add_assoc_zval_ex(tmp, "properties", sizeof("properties"), aggr_props_new);
-
- zend_hash_add(Z_ARRVAL_P(aggr_info->aggr_members), class_name_lc,
- class_name_len+1, &tmp, sizeof(zval *), NULL);
- } else {
- zend_hash_find(Z_ARRVAL_PP(aggr_members), "methods", sizeof("methods"), (void**)&aggr_methods);
- zend_hash_find(Z_ARRVAL_PP(aggr_members), "properties", sizeof("properties"), (void**)&aggr_props);
- }
-
- if (aggr_type == AGGREGATE_BY_LIST) {
- aggr_filter = aggr_list;
- } else if (aggr_type == AGGREGATE_BY_REGEXP) {
- aggr_filter = &z_aggr_regexp;
- }
-
- if (aggr_what == AGGREGATE_METHODS || aggr_what == AGGREGATE_ALL) {
- aggregate_methods(new_ce, ce, aggr_type, aggr_filter, exclude, *aggr_methods TSRMLS_CC);
- }
-
- if (aggr_what == AGGREGATE_PROPERTIES || aggr_what == AGGREGATE_ALL) {
- aggregate_properties(obj, ce, aggr_type, aggr_filter, exclude, *aggr_props TSRMLS_CC);
- }
-
- /*
- * Yes, we have to clean up after monsters. Tsk-tsk.
- */
- efree(class_name_lc);
-}
-/* }}} */
-
-
-/* {{{ proto void aggregate(object obj, string class)
- */
-PHP_FUNCTION(aggregate)
-{
- aggregate(INTERNAL_FUNCTION_PARAM_PASSTHRU, AGGREGATE_ALL, AGGREGATE_ALL);
-}
-/* }}} */
-
-
-/* {{{ proto void aggregate_methods(object obj, string class)
- */
-PHP_FUNCTION(aggregate_methods)
-{
- aggregate(INTERNAL_FUNCTION_PARAM_PASSTHRU, AGGREGATE_METHODS, AGGREGATE_ALL);
-}
-/* }}} */
-
-
-/* {{{ proto void aggregate_methods_by_list(object obj, string class, array method_list [, bool exclude])
- */
-PHP_FUNCTION(aggregate_methods_by_list)
-{
- aggregate(INTERNAL_FUNCTION_PARAM_PASSTHRU, AGGREGATE_METHODS, AGGREGATE_BY_LIST);
-}
-/* }}} */
-
-
-/* {{{ proto void aggregate_properties(object obj, string class)
- */
-PHP_FUNCTION(aggregate_properties)
-{
- aggregate(INTERNAL_FUNCTION_PARAM_PASSTHRU, AGGREGATE_PROPERTIES, AGGREGATE_ALL);
-}
-/* }}} */
-
-
-/* {{{ proto void aggregate_properties_by_list(object obj, string class, array props_list [, bool exclude])
- */
-PHP_FUNCTION(aggregate_properties_by_list)
-{
- aggregate(INTERNAL_FUNCTION_PARAM_PASSTHRU, AGGREGATE_PROPERTIES, AGGREGATE_BY_LIST);
-}
-/* }}} */
-
-#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
-/* {{{ proto void aggregate_methods_by_regexp(object obj, string class, string regexp [, bool exclude])
- */
-PHP_FUNCTION(aggregate_methods_by_regexp)
-{
- aggregate(INTERNAL_FUNCTION_PARAM_PASSTHRU, AGGREGATE_METHODS, AGGREGATE_BY_REGEXP);
-}
-/* }}} */
-
-
-/* {{{ proto void aggregate_properties_by_regexp(object obj, string class, string regexp [, bool exclude])
- */
-PHP_FUNCTION(aggregate_properties_by_regexp)
-{
- aggregate(INTERNAL_FUNCTION_PARAM_PASSTHRU, AGGREGATE_PROPERTIES, AGGREGATE_BY_REGEXP);
-}
-/* }}} */
-#endif
-
-
-/* {{{ proto array aggregate_info(object obj)
- */
-PHP_FUNCTION(aggregate_info)
-{
- zval *obj;
- aggregation_info *aggr_info;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
- return;
- }
-
- if (!BG(aggregation_table) ||
- zend_hash_index_find(BG(aggregation_table), (long)obj, (void**)&aggr_info) == FAILURE) {
- RETURN_FALSE;
- }
-
- *return_value = *aggr_info->aggr_members;
- zval_copy_ctor(return_value);
-}
-/* }}} */
-
-
-/* {{{ proto void deaggregate(object obj [, string class])
- */
-PHP_FUNCTION(deaggregate)
-{
- zval *obj;
- char *class_name = NULL, *class_name_lc;
- int class_name_len;
- aggregation_info *aggr_info;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|s", &obj,
- &class_name, &class_name_len) == FAILURE) {
- return;
- }
-
- if (!BG(aggregation_table) ||
- zend_hash_index_find(BG(aggregation_table), (long)obj, (void**)&aggr_info) == FAILURE) {
- return;
- }
-
- if (class_name) {
- zval **aggr_members,
- **aggr_methods,
- **aggr_props,
- **method, **prop;
-
- class_name_lc = estrndup(class_name, class_name_len);
- zend_str_tolower(class_name_lc, class_name_len);
-
- if (zend_hash_find(Z_ARRVAL_P(aggr_info->aggr_members), class_name_lc,
- class_name_len+1, (void **)&aggr_members) == FAILURE) {
- efree(class_name_lc);
- return;
- }
-
- zend_hash_find(Z_ARRVAL_PP(aggr_members), "methods", sizeof("methods"), (void**)&aggr_methods);
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_PP(aggr_methods));
- zend_hash_get_current_data(Z_ARRVAL_PP(aggr_methods), (void**)&method) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_PP(aggr_methods))) {
- zend_hash_del(&Z_OBJCE_P(obj)->function_table, Z_STRVAL_PP(method), Z_STRLEN_PP(method)+1);
- }
-
- zend_hash_find(Z_ARRVAL_PP(aggr_members), "properties", sizeof("properties"), (void**)&aggr_props);
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_PP(aggr_props));
- zend_hash_get_current_data(Z_ARRVAL_PP(aggr_props), (void**)&prop) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_PP(aggr_props))) {
- zend_hash_del(Z_OBJPROP_P(obj), Z_STRVAL_PP(prop), Z_STRLEN_PP(prop)+1);
- }
-
- zend_hash_del(Z_ARRVAL_P(aggr_info->aggr_members), class_name_lc, class_name_len+1);
-
- efree(class_name_lc);
- } else {
- zend_class_entry *orig_ce;
- zval **aggr_members;
- zval **aggr_props, **prop;
-
- if (zend_hash_find(EG(class_table), Z_OBJCE_P(obj)->name,
- Z_OBJCE_P(obj)->name_length+1, (void **)&orig_ce) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Internal deaggregation error");
- return;
- }
-
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(aggr_info->aggr_members));
- zend_hash_get_current_data(Z_ARRVAL_P(aggr_info->aggr_members), (void **)&aggr_members) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_P(aggr_info->aggr_members))) {
- zend_hash_find(Z_ARRVAL_PP(aggr_members), "properties", sizeof("properties"), (void**)&aggr_props);
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_PP(aggr_props));
- zend_hash_get_current_data(Z_ARRVAL_PP(aggr_props), (void**)&prop) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_PP(aggr_props))) {
- zend_hash_del(Z_OBJPROP_P(obj), Z_STRVAL_PP(prop), Z_STRLEN_PP(prop)+1);
- }
- }
-
- /* OBJECT FIXME!! won't work with non-standard objects */
-#ifndef ZEND_ENGINE_2
- (Z_OBJ_P(obj))->ce = orig_ce;
-#endif
- zend_hash_index_del(BG(aggregation_table), (long)obj);
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/aggregation.h b/ext/standard/aggregation.h
deleted file mode 100644
index f4cd010c60..0000000000
--- a/ext/standard/aggregation.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Andrei Zmievski <andrei@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef AGGREGATION_H
-#define AGGREGATION_H
-
-#define AGGREGATE_ALL 0
-
-#define AGGREGATE_METHODS 1
-#define AGGREGATE_PROPERTIES 2
-
-#define AGGREGATE_BY_LIST 1
-#define AGGREGATE_BY_REGEXP 2
-
-/*
- * Data structure that is stored in aggregation_table hashtable for each object.
- */
-typedef struct {
- zend_class_entry *new_ce;
- zval *aggr_members;
-} aggregation_info;
-
-PHP_FUNCTION(aggregate);
-PHP_FUNCTION(aggregate_methods);
-PHP_FUNCTION(aggregate_methods_by_list);
-PHP_FUNCTION(aggregate_methods_by_regexp);
-PHP_FUNCTION(aggregate_properties);
-PHP_FUNCTION(aggregate_properties_by_list);
-PHP_FUNCTION(aggregate_properties_by_regexp);
-PHP_FUNCTION(aggregate);
-PHP_FUNCTION(deaggregate);
-PHP_FUNCTION(aggregate_info);
-
-#endif /* AGGREGATION_H */
diff --git a/ext/standard/array.c b/ext/standard/array.c
deleted file mode 100644
index 89b7c668eb..0000000000
--- a/ext/standard/array.c
+++ /dev/null
@@ -1,3780 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Rasmus Lerdorf <rasmus@php.net> |
- | Andrei Zmievski <andrei@php.net> |
- | Stig Venaas <venaas@php.net> |
- | Jason Greene <jason@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_ini.h"
-#include <stdarg.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include <stdio.h>
-#if HAVE_STRING_H
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-#ifdef PHP_WIN32
-#include "win32/unistd.h"
-#endif
-#include "zend_globals.h"
-#include "php_globals.h"
-#include "php_array.h"
-#include "basic_functions.h"
-#include "php_string.h"
-#include "php_rand.h"
-#include "php_smart_str.h"
-
-#ifdef ZTS
-int array_globals_id;
-#else
-php_array_globals array_globals;
-#endif
-
-#define EXTR_OVERWRITE 0
-#define EXTR_SKIP 1
-#define EXTR_PREFIX_SAME 2
-#define EXTR_PREFIX_ALL 3
-#define EXTR_PREFIX_INVALID 4
-#define EXTR_PREFIX_IF_EXISTS 5
-#define EXTR_IF_EXISTS 6
-
-#define EXTR_REFS 0x100
-
-#define SORT_REGULAR 0
-#define SORT_NUMERIC 1
-#define SORT_STRING 2
-
-#define SORT_DESC 3
-#define SORT_ASC 4
-
-#define CASE_LOWER 0
-#define CASE_UPPER 1
-
-#define COUNT_NORMAL 0
-#define COUNT_RECURSIVE 1
-
-#define DIFF_NORMAL 0
-#define DIFF_ASSOC 1
-
-#define INTERSECT_NORMAL 0
-#define INTERSECT_ASSOC 1
-
-#define DOUBLE_DRIFT_FIX 0.000000000000001
-
-PHP_MINIT_FUNCTION(array)
-{
-#ifdef ZTS
- ts_allocate_id(&array_globals_id, sizeof(php_array_globals), NULL, NULL);
-#endif
-
- REGISTER_LONG_CONSTANT("EXTR_OVERWRITE", EXTR_OVERWRITE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("EXTR_SKIP", EXTR_SKIP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("EXTR_PREFIX_SAME", EXTR_PREFIX_SAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("EXTR_PREFIX_ALL", EXTR_PREFIX_ALL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("EXTR_PREFIX_INVALID", EXTR_PREFIX_INVALID, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("EXTR_PREFIX_IF_EXISTS", EXTR_PREFIX_IF_EXISTS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("EXTR_IF_EXISTS", EXTR_IF_EXISTS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("EXTR_REFS", EXTR_REFS, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("SORT_ASC", SORT_ASC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SORT_DESC", SORT_DESC, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("SORT_REGULAR", SORT_REGULAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SORT_NUMERIC", SORT_NUMERIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SORT_STRING", SORT_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CASE_LOWER", CASE_LOWER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CASE_UPPER", CASE_UPPER, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("COUNT_NORMAL", COUNT_NORMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("COUNT_RECURSIVE", COUNT_RECURSIVE, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(array)
-{
-#ifdef ZTS
- ts_free_id(array_globals_id);
-#endif
-
- return SUCCESS;
-}
-
-static void set_compare_func(int sort_type TSRMLS_DC)
-{
- switch (sort_type) {
- case SORT_NUMERIC:
- ARRAYG(compare_func) = numeric_compare_function;
- break;
-
- case SORT_STRING:
- ARRAYG(compare_func) = string_compare_function;
- break;
-
- case SORT_REGULAR:
- default:
- ARRAYG(compare_func) = compare_function;
- break;
- }
-}
-
-static int array_key_compare(const void *a, const void *b TSRMLS_DC)
-{
- Bucket *f;
- Bucket *s;
- zval result;
- zval first;
- zval second;
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- if (f->nKeyLength == 0) {
- Z_TYPE(first) = IS_LONG;
- Z_LVAL(first) = f->h;
- } else {
- Z_TYPE(first) = IS_STRING;
- Z_STRVAL(first) = f->arKey;
- Z_STRLEN(first) = f->nKeyLength-1;
- }
-
- if (s->nKeyLength == 0) {
- Z_TYPE(second) = IS_LONG;
- Z_LVAL(second) = s->h;
- } else {
- Z_TYPE(second) = IS_STRING;
- Z_STRVAL(second) = s->arKey;
- Z_STRLEN(second) = s->nKeyLength-1;
- }
-
- if (ARRAYG(compare_func)(&result, &first, &second TSRMLS_CC) == FAILURE) {
- return 0;
- }
-
- if (Z_TYPE(result) == IS_DOUBLE) {
- if (Z_DVAL(result) < 0) {
- return -1;
- } else if (Z_DVAL(result) > 0) {
- return 1;
- } else {
- return 0;
- }
- }
-
- convert_to_long(&result);
-
- if (Z_LVAL(result) < 0) {
- return -1;
- } else if (Z_LVAL(result) > 0) {
- return 1;
- }
-
- return 0;
-}
-
-static int array_reverse_key_compare(const void *a, const void *b TSRMLS_DC)
-{
- return array_key_compare(a, b TSRMLS_CC) * -1;
-}
-
-/* {{{ proto bool krsort(array array_arg [, int sort_flags])
- Sort an array by key value in reverse order */
-PHP_FUNCTION(krsort)
-{
- zval *array;
- long sort_type = SORT_REGULAR;
- HashTable *target_hash;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) {
- RETURN_FALSE;
- }
-
- target_hash = HASH_OF(array);
- set_compare_func(sort_type TSRMLS_CC);
-
- if (zend_hash_sort(target_hash, zend_qsort, array_reverse_key_compare, 0 TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ksort(array array_arg [, int sort_flags])
- Sort an array by key */
-PHP_FUNCTION(ksort)
-{
- zval *array;
- long sort_type = SORT_REGULAR;
- HashTable *target_hash;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) {
- RETURN_FALSE;
- }
-
- target_hash = HASH_OF(array);
- set_compare_func(sort_type TSRMLS_CC);
-
- if (zend_hash_sort(target_hash, zend_qsort, array_key_compare, 0 TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-
-static int php_count_recursive(zval *array, long mode TSRMLS_DC)
-{
- long cnt = 0;
- zval **element;
-
- if (Z_TYPE_P(array) == IS_ARRAY) {
- cnt = zend_hash_num_elements(Z_ARRVAL_P(array));
- if (mode == COUNT_RECURSIVE) {
- HashPosition pos;
-
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_P(array), (void **) &element, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos)) {
- cnt += php_count_recursive(*element, COUNT_RECURSIVE TSRMLS_CC);
- }
- }
- }
-
- return cnt;
-}
-
-/* {{{ proto int count(mixed var [, int mode])
- Count the number of elements in a variable (usually an array) */
-PHP_FUNCTION(count)
-{
- zval *array;
- long mode = COUNT_NORMAL;
-
- if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &array, &mode) == FAILURE)
- return;
-
- switch (Z_TYPE_P(array)) {
- case IS_NULL:
- RETURN_LONG(0);
- break;
- case IS_ARRAY:
- RETURN_LONG (php_count_recursive (array, mode TSRMLS_CC));
- break;
- default:
- RETURN_LONG(1);
- break;
- }
-}
-/* }}} */
-
-/* Numbers are always smaller than strings int this function as it
- * anyway doesn't make much sense to compare two different data types.
- * This keeps it consistant and simple.
- *
- * This is not correct any more, depends on what compare_func is set to.
- */
-static int array_data_compare(const void *a, const void *b TSRMLS_DC)
-{
- Bucket *f;
- Bucket *s;
- pval result;
- pval *first;
- pval *second;
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- first = *((pval **) f->pData);
- second = *((pval **) s->pData);
-
- if (ARRAYG(compare_func)(&result, first, second TSRMLS_CC) == FAILURE) {
- return 0;
- }
-
- if (Z_TYPE(result) == IS_DOUBLE) {
- if (Z_DVAL(result) < 0) {
- return -1;
- } else if (Z_DVAL(result) > 0) {
- return 1;
- } else {
- return 0;
- }
- }
-
- convert_to_long(&result);
-
- if (Z_LVAL(result) < 0) {
- return -1;
- } else if (Z_LVAL(result) > 0) {
- return 1;
- }
-
- return 0;
-}
-
-static int array_reverse_data_compare(const void *a, const void *b TSRMLS_DC)
-{
- return array_data_compare(a, b TSRMLS_CC)*-1;
-}
-
-static int array_natural_general_compare(const void *a, const void *b, int fold_case)
-{
- Bucket *f, *s;
- zval *fval, *sval;
- zval first, second;
- int result;
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- fval = *((pval **) f->pData);
- sval = *((pval **) s->pData);
- first = *fval;
- second = *sval;
- if (Z_TYPE_P(fval) != IS_STRING) {
- zval_copy_ctor(&first);
- convert_to_string(&first);
- }
- if (Z_TYPE_P(sval) != IS_STRING) {
- zval_copy_ctor(&second);
- convert_to_string(&second);
- }
-
- result = strnatcmp_ex(Z_STRVAL(first), Z_STRLEN(first), Z_STRVAL(second), Z_STRLEN(second), fold_case);
-
- if (Z_TYPE_P(fval) != IS_STRING)
- zval_dtor(&first);
- if (Z_TYPE_P(sval) != IS_STRING)
- zval_dtor(&second);
-
- return result;
-}
-
-static int array_natural_compare(const void *a, const void *b TSRMLS_DC)
-{
- return array_natural_general_compare(a, b, 0);
-}
-
-static int array_natural_case_compare(const void *a, const void *b TSRMLS_DC)
-{
- return array_natural_general_compare(a, b, 1);
-}
-
-static void php_natsort(INTERNAL_FUNCTION_PARAMETERS, int fold_case)
-{
- zval **array;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- return;
- }
-
- if (fold_case) {
- if (zend_hash_sort(target_hash, zend_qsort, array_natural_case_compare, 0 TSRMLS_CC) == FAILURE) {
- return;
- }
- } else {
- if (zend_hash_sort(target_hash, zend_qsort, array_natural_compare, 0 TSRMLS_CC) == FAILURE) {
- return;
- }
- }
-
- RETURN_TRUE;
-}
-
-
-/* {{{ proto void natsort(array array_arg)
- Sort an array using natural sort */
-PHP_FUNCTION(natsort)
-{
- php_natsort(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-
-/* {{{ proto void natcasesort(array array_arg)
- Sort an array using case-insensitive natural sort */
-PHP_FUNCTION(natcasesort)
-{
- php_natsort(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-/* {{{ proto bool asort(array array_arg [, int sort_flags])
- Sort an array and maintain index association */
-PHP_FUNCTION(asort)
-{
- zval *array;
- long sort_type = SORT_REGULAR;
- HashTable *target_hash;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) {
- RETURN_FALSE;
- }
-
- target_hash = HASH_OF(array);
- set_compare_func(sort_type TSRMLS_CC);
-
- if (zend_hash_sort(target_hash, zend_qsort, array_data_compare, 0 TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool arsort(array array_arg [, int sort_flags])
- Sort an array in reverse order and maintain index association */
-PHP_FUNCTION(arsort)
-{
- zval *array;
- long sort_type = SORT_REGULAR;
- HashTable *target_hash;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) {
- RETURN_FALSE;
- }
-
- target_hash = HASH_OF(array);
- set_compare_func(sort_type TSRMLS_CC);
-
- if (zend_hash_sort(target_hash, zend_qsort, array_reverse_data_compare, 0 TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool sort(array array_arg [, int sort_flags])
- Sort an array */
-PHP_FUNCTION(sort)
-{
- zval *array;
- long sort_type = SORT_REGULAR;
- HashTable *target_hash;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) {
- RETURN_FALSE;
- }
-
- target_hash = HASH_OF(array);
- set_compare_func(sort_type TSRMLS_CC);
-
- if (zend_hash_sort(target_hash, zend_qsort, array_data_compare, 1 TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool rsort(array array_arg [, int sort_flags])
- Sort an array in reverse order */
-PHP_FUNCTION(rsort)
-{
- zval *array;
- long sort_type = SORT_REGULAR;
- HashTable *target_hash;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) {
- RETURN_FALSE;
- }
-
- target_hash = HASH_OF(array);
- set_compare_func(sort_type TSRMLS_CC);
-
- if (zend_hash_sort(target_hash, zend_qsort, array_reverse_data_compare, 1 TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-static int array_user_compare(const void *a, const void *b TSRMLS_DC)
-{
- Bucket *f;
- Bucket *s;
- zval **args[2];
- zval *retval_ptr;
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- args[0] = (zval **) f->pData;
- args[1] = (zval **) s->pData;
-
- if (call_user_function_ex(EG(function_table), NULL, *BG(user_compare_func_name), &retval_ptr, 2, args, 0, NULL TSRMLS_CC)==SUCCESS
- && retval_ptr) {
- long retval;
-
- convert_to_long_ex(&retval_ptr);
- retval = Z_LVAL_P(retval_ptr);
- zval_ptr_dtor(&retval_ptr);
- return retval;
- } else {
- return 0;
- }
-}
-
-/* {{{ proto bool usort(array array_arg, string cmp_function)
- Sort an array by values using a user-defined comparison function */
-PHP_FUNCTION(usort)
-{
- zval **array;
- zval **old_compare_func;
- HashTable *target_hash;
-
- old_compare_func = BG(user_compare_func_name);
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &array, &BG(user_compare_func_name)) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- BG(user_compare_func_name) = old_compare_func;
- RETURN_FALSE;
- }
- if (zend_hash_sort(target_hash, zend_qsort, array_user_compare, 1 TSRMLS_CC) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
- RETURN_FALSE;
- }
- BG(user_compare_func_name) = old_compare_func;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool uasort(array array_arg, string cmp_function)
- Sort an array with a user-defined comparison function and maintain index association */
-PHP_FUNCTION(uasort)
-{
- zval **array;
- zval **old_compare_func;
- HashTable *target_hash;
-
- old_compare_func = BG(user_compare_func_name);
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &array, &BG(user_compare_func_name)) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- BG(user_compare_func_name) = old_compare_func;
- RETURN_FALSE;
- }
- if (zend_hash_sort(target_hash, zend_qsort, array_user_compare, 0 TSRMLS_CC) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
- RETURN_FALSE;
- }
- BG(user_compare_func_name) = old_compare_func;
- RETURN_TRUE;
-}
-/* }}} */
-
-static int array_user_key_compare(const void *a, const void *b TSRMLS_DC)
-{
- Bucket *f;
- Bucket *s;
- pval key1, key2;
- pval *args[2];
- pval retval;
- int status;
-
- args[0] = &key1;
- args[1] = &key2;
- INIT_PZVAL(&key1);
- INIT_PZVAL(&key2);
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- if (f->nKeyLength) {
- Z_STRVAL(key1) = estrndup(f->arKey, f->nKeyLength);
- Z_STRLEN(key1) = f->nKeyLength-1;
- Z_TYPE(key1) = IS_STRING;
- } else {
- Z_LVAL(key1) = f->h;
- Z_TYPE(key1) = IS_LONG;
- }
- if (s->nKeyLength) {
- Z_STRVAL(key2) = estrndup(s->arKey, s->nKeyLength);
- Z_STRLEN(key2) = s->nKeyLength-1;
- Z_TYPE(key2) = IS_STRING;
- } else {
- Z_LVAL(key2) = s->h;
- Z_TYPE(key2) = IS_LONG;
- }
-
- status = call_user_function(EG(function_table), NULL, *BG(user_compare_func_name), &retval, 2, args TSRMLS_CC);
-
- zval_dtor(&key1);
- zval_dtor(&key2);
-
- if (status == SUCCESS) {
- convert_to_long(&retval);
- return Z_LVAL(retval);
- } else {
- return 0;
- }
-}
-
-/* {{{ proto bool uksort(array array_arg, string cmp_function)
- Sort an array by keys using a user-defined comparison function */
-PHP_FUNCTION(uksort)
-{
- zval **array;
- zval **old_compare_func;
- HashTable *target_hash;
-
- old_compare_func = BG(user_compare_func_name);
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &array, &BG(user_compare_func_name)) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- BG(user_compare_func_name) = old_compare_func;
- RETURN_FALSE;
- }
- if (zend_hash_sort(target_hash, zend_qsort, array_user_key_compare, 0 TSRMLS_CC) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
- RETURN_FALSE;
- }
- BG(user_compare_func_name) = old_compare_func;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto mixed end(array array_arg)
- Advances array argument's internal pointer to the last element and return it */
-PHP_FUNCTION(end)
-{
- pval **array, **entry;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passed variable is not an array or object");
- RETURN_FALSE;
- }
- zend_hash_internal_pointer_end(target_hash);
-
- if (return_value_used) {
- if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
- RETURN_FALSE;
- }
-
- *return_value = **entry;
- zval_copy_ctor(return_value);
- }
-}
-/* }}} */
-
-/* {{{ proto mixed prev(array array_arg)
- Move array argument's internal pointer to the previous element and return it */
-PHP_FUNCTION(prev)
-{
- pval **array, **entry;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passed variable is not an array or object");
- RETURN_FALSE;
- }
- zend_hash_move_backwards(target_hash);
-
- if (return_value_used) {
- if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
- RETURN_FALSE;
- }
-
- *return_value = **entry;
- zval_copy_ctor(return_value);
- }
-}
-/* }}} */
-
-/* {{{ proto mixed next(array array_arg)
- Move array argument's internal pointer to the next element and return it */
-PHP_FUNCTION(next)
-{
- pval **array, **entry;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passed variable is not an array or object");
- RETURN_FALSE;
- }
- zend_hash_move_forward(target_hash);
-
- if (return_value_used) {
- if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
- RETURN_FALSE;
- }
-
- *return_value = **entry;
- zval_copy_ctor(return_value);
- }
-}
-/* }}} */
-
-/* {{{ proto mixed reset(array array_arg)
- Set array argument's internal pointer to the first element and return it */
-PHP_FUNCTION(reset)
-{
- pval **array, **entry;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passed variable is not an array or object");
- RETURN_FALSE;
- }
- zend_hash_internal_pointer_reset(target_hash);
-
- if (return_value_used) {
- if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
- RETURN_FALSE;
- }
-
- *return_value = **entry;
- zval_copy_ctor(return_value);
- }
-}
-/* }}} */
-
-/* {{{ proto mixed current(array array_arg)
- Return the element currently pointed to by the internal array pointer */
-PHP_FUNCTION(current)
-{
- pval **array, **entry;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passed variable is not an array or object");
- RETURN_FALSE;
- }
- if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
- RETURN_FALSE;
- }
- *return_value = **entry;
- zval_copy_ctor(return_value);
-}
-/* }}} */
-
-/* {{{ proto mixed key(array array_arg)
- Return the key of the element currently pointed to by the internal array pointer */
-PHP_FUNCTION(key)
-{
- pval **array;
- char *string_key;
- uint string_length;
- ulong num_key;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passed variable is not an array or object");
- RETURN_FALSE;
- }
- switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_length, &num_key, 0, NULL)) {
- case HASH_KEY_IS_STRING:
- RETVAL_STRINGL(string_key, string_length - 1, 1);
- break;
- case HASH_KEY_IS_LONG:
- RETVAL_LONG(num_key);
- break;
- case HASH_KEY_NON_EXISTANT:
- return;
- }
-}
-/* }}} */
-
-/* {{{ proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
- Return the lowest value in an array or a series of arguments */
-PHP_FUNCTION(min)
-{
- int argc=ZEND_NUM_ARGS();
- pval **result;
-
- if (argc<=0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Atleast one value should be passed");
- RETURN_NULL();
- }
- set_compare_func(SORT_REGULAR TSRMLS_CC);
- if (argc == 1) {
- pval **arr;
-
- if (zend_get_parameters_ex(1, &arr) == FAILURE || Z_TYPE_PP(arr) != IS_ARRAY) {
- WRONG_PARAM_COUNT;
- }
- if (zend_hash_minmax(Z_ARRVAL_PP(arr), array_data_compare, 0, (void **) &result TSRMLS_CC) == SUCCESS) {
- *return_value = **result;
- zval_copy_ctor(return_value);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain atleast one element");
- RETURN_FALSE;
- }
- } else {
- pval ***args = (pval ***) emalloc(sizeof(pval **)*ZEND_NUM_ARGS());
- pval **min, result;
- int i;
-
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args)==FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- min = args[0];
-
- for (i=1; i<ZEND_NUM_ARGS(); i++) {
- is_smaller_function(&result, *args[i], *min TSRMLS_CC);
- if (Z_LVAL(result) == 1) {
- min = args[i];
- }
- }
-
- *return_value = **min;
- zval_copy_ctor(return_value);
-
- efree(args);
- }
-}
-/* }}} */
-
-/* {{{ proto mixed max(mixed arg1 [, mixed arg2 [, mixed ...]])
- Return the highest value in an array or a series of arguments */
-PHP_FUNCTION(max)
-{
- int argc=ZEND_NUM_ARGS();
- pval **result;
-
- if (argc<=0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Atleast one value should be passed");
- RETURN_NULL();
- }
- set_compare_func(SORT_REGULAR TSRMLS_CC);
- if (argc == 1) {
- pval **arr;
-
- if (zend_get_parameters_ex(1, &arr) == FAILURE || Z_TYPE_PP(arr) != IS_ARRAY) {
- WRONG_PARAM_COUNT;
- }
- if (zend_hash_minmax(Z_ARRVAL_PP(arr), array_data_compare, 1, (void **) &result TSRMLS_CC) == SUCCESS) {
- *return_value = **result;
- zval_copy_ctor(return_value);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain atleast one element");
- RETURN_FALSE;
- }
- } else {
- pval ***args = (pval ***) emalloc(sizeof(pval **)*ZEND_NUM_ARGS());
- pval **max, result;
- int i;
-
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- max = args[0];
-
- for (i=1; i<ZEND_NUM_ARGS(); i++) {
- is_smaller_or_equal_function(&result, *args[i], *max TSRMLS_CC);
- if (Z_LVAL(result) == 0) {
- max = args[i];
- }
- }
-
- *return_value = **max;
- zval_copy_ctor(return_value);
-
- efree(args);
- }
-}
-/* }}} */
-
-static int php_array_walk(HashTable *target_hash, zval **userdata, int recursive TSRMLS_DC)
-{
- zval **args[3], /* Arguments to userland function */
- *retval_ptr, /* Return value - unused */
- *key; /* Entry key */
- char *string_key;
- uint string_key_len;
- ulong num_key;
- HashPosition pos;
-
- /* Set up known arguments */
- args[1] = &key;
- args[2] = userdata;
-
- zend_hash_internal_pointer_reset_ex(target_hash, &pos);
-
- /* Iterate through hash */
- while (zend_hash_get_current_data_ex(target_hash, (void **)&args[0], &pos) == SUCCESS) {
- if (recursive && Z_TYPE_PP(args[0]) == IS_ARRAY) {
- HashTable *thash;
-
- thash = HASH_OF(*(args[0]));
- if (thash == target_hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");
- return 0;
- }
- php_array_walk(thash, userdata, recursive TSRMLS_CC);
- } else {
- /* Allocate space for key */
- MAKE_STD_ZVAL(key);
-
- /* Set up the key */
- if (zend_hash_get_current_key_ex(target_hash, &string_key, &string_key_len, &num_key, 0, &pos) == HASH_KEY_IS_LONG) {
- Z_TYPE_P(key) = IS_LONG;
- Z_LVAL_P(key) = num_key;
- } else {
- ZVAL_STRINGL(key, string_key, string_key_len-1, 1);
- }
-
- /* Call the userland function */
- if (call_user_function_ex(EG(function_table), NULL, *BG(array_walk_func_name),
- &retval_ptr, userdata ? 3 : 2, args, 0, NULL TSRMLS_CC) == SUCCESS) {
-
- zval_ptr_dtor(&retval_ptr);
- } else {
- char *func_name;
-
- if (zend_is_callable(*BG(array_walk_func_name), 0, &func_name)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", func_name);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s() - function does not exist", func_name);
- }
-
- efree(func_name);
- break;
- }
- }
-
- zval_ptr_dtor(&key);
- zend_hash_move_forward_ex(target_hash, &pos);
- }
-
- return 0;
-}
-
-/* {{{ proto bool array_walk(array input, string funcname [, mixed userdata])
- Apply a user function to every member of an array */
-PHP_FUNCTION(array_walk)
-{
- int argc;
- zval **array,
- **userdata = NULL,
- **old_walk_func_name;
- HashTable *target_hash;
-
- argc = ZEND_NUM_ARGS();
- old_walk_func_name = BG(array_walk_func_name);
- if (argc < 2 || argc > 3 ||
- zend_get_parameters_ex(argc, &array, &BG(array_walk_func_name), &userdata) == FAILURE) {
- BG(array_walk_func_name) = old_walk_func_name;
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- BG(array_walk_func_name) = old_walk_func_name;
- RETURN_FALSE;
- }
- if (Z_TYPE_PP(BG(array_walk_func_name)) != IS_ARRAY &&
- Z_TYPE_PP(BG(array_walk_func_name)) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong syntax for function name");
- BG(array_walk_func_name) = old_walk_func_name;
- RETURN_FALSE;
- }
- php_array_walk(target_hash, userdata, 0 TSRMLS_CC);
- BG(array_walk_func_name) = old_walk_func_name;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool array_walk_recursive(array input, string funcname [, mixed userdata])
- Apply a user function recursively to every member of an array */
-PHP_FUNCTION(array_walk_recursive)
-{
- int argc;
- zval **array,
- **userdata = NULL,
- **old_walk_func_name;
- HashTable *target_hash;
-
- argc = ZEND_NUM_ARGS();
- old_walk_func_name = BG(array_walk_func_name);
- if (argc < 2 || argc > 3 ||
- zend_get_parameters_ex(argc, &array, &BG(array_walk_func_name), &userdata) == FAILURE) {
- BG(array_walk_func_name) = old_walk_func_name;
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- BG(array_walk_func_name) = old_walk_func_name;
- RETURN_FALSE;
- }
- if (Z_TYPE_PP(BG(array_walk_func_name)) != IS_ARRAY && Z_TYPE_PP(BG(array_walk_func_name)) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong syntax for function name");
- BG(array_walk_func_name) = old_walk_func_name;
- RETURN_FALSE;
- }
- php_array_walk(target_hash, userdata, 1 TSRMLS_CC);
- BG(array_walk_func_name) = old_walk_func_name;
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
- * 0 = return boolean
- * 1 = return key
- */
-static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
-{
- zval **value, /* value to check for */
- **array, /* array to check in */
- **strict, /* strict comparison or not */
- **entry, /* pointer to array entry */
- res; /* comparison result */
- HashTable *target_hash; /* array hashtable */
- HashPosition pos; /* hash iterator */
- ulong num_key;
- uint str_key_len;
- char *string_key;
- int (*is_equal_func)(zval *, zval *, zval * TSRMLS_DC) = is_equal_function;
-
- if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &value, &array, &strict) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
-#ifndef ZEND_ENGINE_2
- if (Z_TYPE_PP(value) == IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong datatype for first argument");
- RETURN_FALSE;
- }
-#endif
-
- if (Z_TYPE_PP(array) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong datatype for second argument");
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() == 3) {
- convert_to_boolean_ex(strict);
- if (Z_LVAL_PP(strict)) {
- is_equal_func = is_identical_function;
- }
- }
-
- target_hash = HASH_OF(*array);
- zend_hash_internal_pointer_reset_ex(target_hash, &pos);
- while (zend_hash_get_current_data_ex(target_hash, (void **)&entry, &pos) == SUCCESS) {
- is_equal_func(&res, *value, *entry TSRMLS_CC);
- if (Z_LVAL(res)) {
- if (behavior == 0) {
- RETURN_TRUE;
- } else {
- /* Return current key */
- switch (zend_hash_get_current_key_ex(target_hash, &string_key, &str_key_len, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- RETURN_STRINGL(string_key, str_key_len-1, 1);
- break;
- case HASH_KEY_IS_LONG:
- RETURN_LONG(num_key);
- break;
- }
- }
- }
-
- zend_hash_move_forward_ex(target_hash, &pos);
- }
-
- RETURN_FALSE;
-}
-
-
-/* {{{ proto bool in_array(mixed needle, array haystack [, bool strict])
- Checks if the given value exists in the array */
-PHP_FUNCTION(in_array)
-{
- php_search_array(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto mixed array_search(mixed needle, array haystack [, bool strict])
- Searches the array for a given value and returns the corresponding key if successful */
-PHP_FUNCTION(array_search)
-{
- php_search_array(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-static int php_valid_var_name(char *var_name)
-{
- int len, i;
-
- if (!var_name)
- return 0;
-
- len = strlen(var_name);
-
- if (!isalpha((int)((unsigned char *)var_name)[0]) && var_name[0] != '_')
- return 0;
-
- if (len > 1) {
- for (i=1; i<len; i++) {
- if (!isalnum((int)((unsigned char *)var_name)[i]) && var_name[i] != '_') {
- return 0;
- }
- }
- }
-
- return 1;
-}
-
-
-/* {{{ proto int extract(array var_array [, int extract_type [, string prefix]])
- Imports variables into symbol table from an array */
-PHP_FUNCTION(extract)
-{
- zval **var_array, **z_extract_type, **prefix;
- zval **entry, *data;
- char *var_name;
- smart_str final_name = {0};
- ulong num_key;
- uint var_name_len;
- int var_exists, extract_type, key_type, count = 0;
- zend_bool extract_refs = 0;
- HashPosition pos;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &var_array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- extract_type = EXTR_OVERWRITE;
- break;
-
- case 2:
- if (zend_get_parameters_ex(2, &var_array, &z_extract_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(z_extract_type);
- extract_type = Z_LVAL_PP(z_extract_type);
- extract_refs = (extract_type & EXTR_REFS)>>8;
- extract_type &= 0xff;
- if (extract_type > EXTR_SKIP && extract_type <= EXTR_PREFIX_IF_EXISTS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Prefix expected to be specified");
- return;
- }
- break;
-
- case 3:
- if (zend_get_parameters_ex(3, &var_array, &z_extract_type, &prefix) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(z_extract_type);
- extract_type = Z_LVAL_PP(z_extract_type);
- extract_refs = (extract_type & EXTR_REFS)>>8;
- extract_type &= 0xff;
- convert_to_string_ex(prefix);
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (extract_type < EXTR_OVERWRITE || extract_type > EXTR_IF_EXISTS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown extract type");
- return;
- }
-
- if (Z_TYPE_PP(var_array) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argument should be an array");
- return;
- }
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(var_array), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(var_array), (void **)&entry, &pos) == SUCCESS) {
- key_type = zend_hash_get_current_key_ex(Z_ARRVAL_PP(var_array), &var_name, &var_name_len, &num_key, 0, &pos);
- var_exists = 0;
-
- if (key_type == HASH_KEY_IS_STRING) {
- var_name_len--;
- var_exists = zend_hash_exists(EG(active_symbol_table), var_name, var_name_len + 1);
- } else if (extract_type == EXTR_PREFIX_ALL || extract_type == EXTR_PREFIX_INVALID) {
- smart_str_appendl(&final_name, Z_STRVAL_PP(prefix), Z_STRLEN_PP(prefix));
- smart_str_appendc(&final_name, '_');
- smart_str_append_long(&final_name, num_key);
- } else {
- zend_hash_move_forward_ex(Z_ARRVAL_PP(var_array), &pos);
- continue;
- }
-
- switch (extract_type) {
- case EXTR_IF_EXISTS:
- if (!var_exists) break;
- /* break omitted intentionally */
-
- case EXTR_OVERWRITE:
- smart_str_appendl(&final_name, var_name, var_name_len);
- break;
-
- case EXTR_PREFIX_IF_EXISTS:
- if (var_exists) {
- smart_str_appendl(&final_name, Z_STRVAL_PP(prefix), Z_STRLEN_PP(prefix));
- smart_str_appendc(&final_name, '_');
- smart_str_appendl(&final_name, var_name, var_name_len);
- }
- break;
-
- case EXTR_PREFIX_SAME:
- if (!var_exists)
- smart_str_appendl(&final_name, var_name, var_name_len);
- /* break omitted intentionally */
-
- case EXTR_PREFIX_ALL:
- if (final_name.len == 0) {
- smart_str_appendl(&final_name, Z_STRVAL_PP(prefix), Z_STRLEN_PP(prefix));
- smart_str_appendc(&final_name, '_');
- smart_str_appendl(&final_name, var_name, var_name_len);
- }
- break;
-
- case EXTR_PREFIX_INVALID:
- if (final_name.len == 0) {
- if (!php_valid_var_name(var_name)) {
- smart_str_appendl(&final_name, Z_STRVAL_PP(prefix), Z_STRLEN_PP(prefix));
- smart_str_appendc(&final_name, '_');
- smart_str_appendl(&final_name, var_name, var_name_len);
- } else
- smart_str_appendl(&final_name, var_name, var_name_len);
- }
- break;
-
- default:
- if (!var_exists)
- smart_str_appendl(&final_name, var_name, var_name_len);
- break;
- }
-
- if (final_name.len) {
- smart_str_0(&final_name);
- if (php_valid_var_name(final_name.c)) {
- if (extract_refs) {
- zval **orig_var;
-
- (*entry)->is_ref = 1;
- (*entry)->refcount++;
- if (zend_hash_find(EG(active_symbol_table), final_name.c, final_name.len+1, (void **) &orig_var) == SUCCESS
- && PZVAL_IS_REF(*orig_var)) {
-
- (*entry)->refcount += (*orig_var)->refcount-2;
- zval_dtor(*orig_var);
- FREE_ZVAL(*orig_var);
- *orig_var = *entry;
- } else {
- zend_hash_update(EG(active_symbol_table), final_name.c, final_name.len+1, entry, sizeof(zval *), NULL);
- }
- } else {
- MAKE_STD_ZVAL(data);
- *data = **entry;
- zval_copy_ctor(data);
-
- ZEND_SET_SYMBOL(EG(active_symbol_table), final_name.c, data);
- }
-
- count++;
- }
- final_name.len = 0;
- }
-
- zend_hash_move_forward_ex(Z_ARRVAL_PP(var_array), &pos);
- }
-
- smart_str_free(&final_name);
-
- RETURN_LONG(count);
-}
-/* }}} */
-
-
-static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_value, zval *entry)
-{
- zval **value_ptr, *value, *data;
-
- if (Z_TYPE_P(entry) == IS_STRING) {
- if (zend_hash_find(eg_active_symbol_table, Z_STRVAL_P(entry),
- Z_STRLEN_P(entry)+1, (void **)&value_ptr) != FAILURE) {
- value = *value_ptr;
- ALLOC_ZVAL(data);
- *data = *value;
- zval_copy_ctor(data);
- INIT_PZVAL(data);
-
- zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(entry),
- Z_STRLEN_P(entry)+1, &data, sizeof(zval *), NULL);
- }
- }
- else if (Z_TYPE_P(entry) == IS_ARRAY) {
- HashPosition pos;
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(entry), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_P(entry), (void**)&value_ptr, &pos) == SUCCESS) {
- value = *value_ptr;
-
- php_compact_var(eg_active_symbol_table, return_value, value);
- zend_hash_move_forward_ex(Z_ARRVAL_P(entry), &pos);
- }
- }
-}
-
-
-/* {{{ proto array compact(mixed var_names [, mixed ...])
- Creates a hash containing variables and their values */
-PHP_FUNCTION(compact)
-{
- zval ***args; /* function arguments array */
- int i;
-
- args = (zval ***)emalloc(ZEND_NUM_ARGS() * sizeof(zval **));
-
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- array_init(return_value);
-
- for (i=0; i<ZEND_NUM_ARGS(); i++) {
- php_compact_var(EG(active_symbol_table), return_value, *args[i]);
- }
-
- efree(args);
-}
-/* }}} */
-
-/* {{{ proto array array_fill(int start_key, int num, mixed val)
- Create an array containing num elements starting with index start_key each initialized to val */
-PHP_FUNCTION(array_fill)
-{
- zval **start_key, **num, **val, *newval;
- long i;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &start_key, &num, &val) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* allocate an array for return */
- array_init(return_value);
-
- switch (Z_TYPE_PP(start_key)) {
- case IS_STRING:
- case IS_LONG:
- case IS_DOUBLE:
- if (PZVAL_IS_REF(*val)) {
- SEPARATE_ZVAL(val);
- }
- convert_to_long_ex(start_key);
- zval_add_ref(val);
- zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_PP(start_key), val, sizeof(val), NULL);
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong data type for start key");
- RETURN_FALSE;
- break;
- }
-
- convert_to_long_ex(num);
- i = Z_LVAL_PP(num) - 1;
- if (i < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of elements must be positive");
- RETURN_FALSE;
- }
- newval = *val;
- while (i--) {
-#ifndef ZEND_ENGINE_2
- if (newval->refcount >= 62000) {
- MAKE_STD_ZVAL(newval);
- *newval = **val;
- zval_copy_ctor(newval);
- newval->refcount = 0;
- }
-#endif
- zval_add_ref(&newval);
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &newval, sizeof(zval *), NULL);
- }
-}
-/* }}} */
-
-/* {{{ proto array range(mixed low, mixed high[, int step])
- Create an array containing the range of integers or characters from low to high (inclusive) */
-PHP_FUNCTION(range)
-{
- zval *zlow, *zhigh, *zstep = NULL;
- int err = 0, is_step_double = 0;
- double step = 1.0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/z/|z/", &zlow, &zhigh, &zstep) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (zstep) {
- if (Z_TYPE_P(zstep) == IS_DOUBLE || (Z_TYPE_P(zstep) == IS_STRING && is_numeric_string(Z_STRVAL_P(zstep), Z_STRLEN_P(zstep), NULL, NULL, 0) == IS_DOUBLE)) {
- is_step_double = 1;
- }
-
- convert_to_double_ex(&zstep);
- step = Z_DVAL_P(zstep);
-
- /* We only want positive step values. */
- if (step < 0.0) {
- step *= -1;
- }
- }
-
- /* Initialize the return_value as an array. */
- array_init(return_value);
-
- /* If the range is given as strings, generate an array of characters. */
- if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING) {
- int type1, type2;
- unsigned char *low, *high;
- long lstep = (long) step;
-
- type1 = is_numeric_string(Z_STRVAL_P(zlow), Z_STRLEN_P(zlow), NULL, NULL, 0);
- type2 = is_numeric_string(Z_STRVAL_P(zhigh), Z_STRLEN_P(zhigh), NULL, NULL, 0);
-
- if (type1 == IS_DOUBLE || type2 == IS_DOUBLE || is_step_double) {
- goto double_str;
- } else if (type1 == IS_LONG || type2 == IS_LONG) {
- goto long_str;
- }
-
- convert_to_string(zlow);
- convert_to_string(zhigh);
- low = (unsigned char *)Z_STRVAL_P(zlow);
- high = (unsigned char *)Z_STRVAL_P(zhigh);
-
- if (*low > *high) { /* Negative Steps */
- if (lstep <= 0) {
- err = 1;
- goto err;
- }
- for (; *low >= *high; (*low) -= (unsigned int)lstep) {
- add_next_index_stringl(return_value, low, 1, 1);
- if (((signed int)*low - lstep) < 0) {
- break;
- }
- }
- } else if (*high > *low) { /* Positive Steps */
- if (lstep <= 0) {
- err = 1;
- goto err;
- }
- for (; *low <= *high; (*low) += (unsigned int)lstep) {
- add_next_index_stringl(return_value, low, 1, 1);
- if (((signed int)*low + lstep) > 255) {
- break;
- }
- }
- } else {
- add_next_index_stringl(return_value, low, 1, 1);
- }
-
- } else if (Z_TYPE_P(zlow) == IS_DOUBLE || Z_TYPE_P(zhigh) == IS_DOUBLE || is_step_double) {
- double low, high;
-double_str:
- convert_to_double(zlow);
- convert_to_double(zhigh);
- low = Z_DVAL_P(zlow);
- high = Z_DVAL_P(zhigh);
-
- if (low > high) { /* Negative steps */
- if (low - high < step || step <= 0) {
- err = 1;
- goto err;
- }
- for (; low >= (high - DOUBLE_DRIFT_FIX); low -= step) {
- add_next_index_double(return_value, low);
- }
- } else if (high > low) { /* Positive steps */
- if (high - low < step || step <= 0) {
- err = 1;
- goto err;
- }
- for (; low <= (high + DOUBLE_DRIFT_FIX); low += step) {
- add_next_index_double(return_value, low);
- }
- } else {
- add_next_index_double(return_value, low);
- }
- } else {
- int low, high;
- long lstep;
-long_str:
- convert_to_long(zlow);
- convert_to_long(zhigh);
- low = Z_LVAL_P(zlow);
- high = Z_LVAL_P(zhigh);
- lstep = (long) step;
-
- if (low > high) { /* Negative steps */
- if (low - high < lstep || lstep <= 0) {
- err = 1;
- goto err;
- }
- for (; low >= high; low -= lstep) {
- add_next_index_long(return_value, low);
- }
- } else if (high > low) { /* Positive steps */
- if (high - low < lstep || lstep <= 0) {
- err = 1;
- goto err;
- }
- for (; low <= high; low += lstep) {
- add_next_index_long(return_value, low);
- }
- } else {
- add_next_index_long(return_value, low);
- }
- }
-err:
- if (err) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "step exceeds the specified range");
- zval_dtor(return_value);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-static void array_data_shuffle(zval *array TSRMLS_DC)
-{
- Bucket **elems, *temp;
- HashTable *hash;
- int j, n_elems, rnd_idx, n_left;
-
- n_elems = zend_hash_num_elements(Z_ARRVAL_P(array));
-
- if (n_elems <= 1) {
- return;
- }
-
- elems = (Bucket **)emalloc(n_elems * sizeof(Bucket *));
- hash = Z_ARRVAL_P(array);
- n_left = n_elems;
-
- for (j = 0, temp = hash->pListHead; temp; temp = temp->pListNext)
- elems[j++] = temp;
- while (--n_left) {
- rnd_idx = php_rand(TSRMLS_C);
- RAND_RANGE(rnd_idx, 0, n_left, PHP_RAND_MAX);
- if (rnd_idx != n_left) {
- temp = elems[n_left];
- elems[n_left] = elems[rnd_idx];
- elems[rnd_idx] = temp;
- }
- }
-
- HANDLE_BLOCK_INTERRUPTIONS();
- hash->pListHead = elems[0];
- hash->pListTail = NULL;
- hash->pInternalPointer = hash->pListHead;
-
- for (j = 0; j < n_elems; j++) {
- if (hash->pListTail) {
- hash->pListTail->pListNext = elems[j];
- }
- elems[j]->pListLast = hash->pListTail;
- elems[j]->pListNext = NULL;
- hash->pListTail = elems[j];
- }
- temp = hash->pListHead;
- j = 0;
- while (temp != NULL) {
- temp->nKeyLength = 0;
- temp->h = j++;
- temp = temp->pListNext;
- }
- hash->nNextFreeElement = n_elems;
- zend_hash_rehash(hash);
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
- efree(elems);
-}
-
-/* {{{ proto bool shuffle(array array_arg)
- Randomly shuffle the contents of an array */
-PHP_FUNCTION(shuffle)
-{
- zval *array;
-
- if (zend_parse_parameters(1 TSRMLS_CC, "a", &array) == FAILURE) {
- RETURN_FALSE;
- }
-
- array_data_shuffle(array TSRMLS_CC);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* HashTable* php_splice(HashTable *in_hash, int offset, int length,
- zval ***list, int list_count, HashTable **removed) */
-HashTable* php_splice(HashTable *in_hash, int offset, int length,
- zval ***list, int list_count, HashTable **removed)
-{
- HashTable *out_hash = NULL; /* Output hashtable */
- int num_in, /* Number of entries in the input hashtable */
- pos, /* Current position in the hashtable */
- i; /* Loop counter */
- Bucket *p; /* Pointer to hash bucket */
- zval *entry; /* Hash entry */
-
- /* If input hash doesn't exist, we have nothing to do */
- if (!in_hash)
- return NULL;
-
- /* Get number of entries in the input hash */
- num_in = zend_hash_num_elements(in_hash);
-
- /* Clamp the offset.. */
- if (offset > num_in)
- offset = num_in;
- else if (offset < 0 && (offset=num_in+offset) < 0)
- offset = 0;
-
- /* ..and the length */
- if (length < 0) {
- length = num_in-offset+length;
- } else if (offset+length > num_in) {
- length = num_in-offset;
- }
-
- /* Create and initialize output hash */
- ALLOC_HASHTABLE(out_hash);
- zend_hash_init(out_hash, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- /* Start at the beginning of the input hash and copy entries to output hash until offset is reached */
- for (pos=0, p=in_hash->pListHead; pos<offset && p ; pos++, p=p->pListNext) {
- /* Get entry and increase reference count */
- entry = *((zval **)p->pData);
- entry->refcount++;
-
- /* Update output hash depending on key type */
- if (p->nKeyLength)
- zend_hash_update(out_hash, p->arKey, p->nKeyLength, &entry, sizeof(zval *), NULL);
- else
- zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL);
- }
-
- /* If hash for removed entries exists, go until offset+length and copy the entries to it */
- if (removed != NULL) {
- for ( ; pos<offset+length && p; pos++, p=p->pListNext) {
- entry = *((zval **)p->pData);
- entry->refcount++;
- if (p->nKeyLength)
- zend_hash_update(*removed, p->arKey, p->nKeyLength, &entry, sizeof(zval *), NULL);
- else
- zend_hash_next_index_insert(*removed, &entry, sizeof(zval *), NULL);
- }
- } else /* otherwise just skip those entries */
- for ( ; pos<offset+length && p; pos++, p=p->pListNext);
-
- /* If there are entries to insert.. */
- if (list != NULL) {
- /* ..for each one, create a new zval, copy entry into it and copy it into the output hash */
- for (i=0; i<list_count; i++) {
- entry = *list[i];
- if (entry->refcount>=1000) {
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- *tmp = *entry;
- zval_copy_ctor(tmp);
- tmp->refcount = 1;
- tmp->is_ref = 0;
- entry = tmp;
- } else {
- entry->refcount++;
- }
- zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL);
- }
- }
-
- /* Copy the remaining input hash entries to the output hash */
- for ( ; p ; p=p->pListNext) {
- entry = *((zval **)p->pData);
- entry->refcount++;
- if (p->nKeyLength)
- zend_hash_update(out_hash, p->arKey, p->nKeyLength, &entry, sizeof(zval *), NULL);
- else
- zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL);
- }
-
- zend_hash_internal_pointer_reset(out_hash);
- return out_hash;
-}
-/* }}} */
-
-
-/* {{{ proto int array_push(array stack, mixed var [, mixed ...])
- Pushes elements onto the end of the array */
-PHP_FUNCTION(array_push)
-{
- zval ***args, /* Function arguments array */
- *stack, /* Input array */
- *new_var; /* Variable to be pushed */
- int i, /* Loop counter */
- argc; /* Number of function arguments */
-
- /* Get the argument count and check it */
- argc = ZEND_NUM_ARGS();
- if (argc < 2) {
- WRONG_PARAM_COUNT;
- }
-
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- /* Get first argument and check that it's an array */
- stack = *args[0];
- if (Z_TYPE_P(stack) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argument should be an array");
- efree(args);
- RETURN_FALSE;
- }
-
- /* For each subsequent argument, make it a reference, increase refcount, and add it to the end of the array */
- for (i=1; i<argc; i++) {
- new_var = *args[i];
- new_var->refcount++;
-
- zend_hash_next_index_insert(Z_ARRVAL_P(stack), &new_var, sizeof(zval *), NULL);
- }
-
- /* Clean up and return the number of values in the stack */
- efree(args);
- RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack)));
-}
-/* }}} */
-
-
-/* {{{ void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int which_end) */
-static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
-{
- zval **stack, /* Input stack */
- **val; /* Value to be popped */
- char *key = NULL;
- int key_len = 0;
- ulong index;
-
- /* Get the arguments and do error-checking */
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &stack) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(stack) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- return;
- }
-
- if (zend_hash_num_elements(Z_ARRVAL_PP(stack)) == 0) {
- return;
- }
-
- /* Get the first or last value and copy it into the return value */
- if (off_the_end)
- zend_hash_internal_pointer_end(Z_ARRVAL_PP(stack));
- else
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(stack));
- zend_hash_get_current_data(Z_ARRVAL_PP(stack), (void **)&val);
- *return_value = **val;
- zval_copy_ctor(return_value);
- INIT_PZVAL(return_value);
-
- /* Delete the first or last value */
- zend_hash_get_current_key_ex(Z_ARRVAL_PP(stack), &key, &key_len, &index, 0, NULL);
- zend_hash_del_key_or_index(Z_ARRVAL_PP(stack), key, key_len, index, (key) ? HASH_DEL_KEY : HASH_DEL_INDEX);
-
- /* If we did a shift... re-index like it did before */
- if (!off_the_end) {
- int k = 0;
- int should_rehash = 0;
- Bucket *p = Z_ARRVAL_PP(stack)->pListHead;
- while (p != NULL) {
- if (p->nKeyLength == 0) {
- if (p->h != k) {
- p->h = k++;
- should_rehash = 1;
- } else {
- k++;
- }
- }
- p = p->pListNext;
- }
- Z_ARRVAL_PP(stack)->nNextFreeElement = k;
- if (should_rehash) {
- zend_hash_rehash(Z_ARRVAL_PP(stack));
- }
- } else if (!key_len) {
- Z_ARRVAL_PP(stack)->nNextFreeElement = Z_ARRVAL_PP(stack)->nNextFreeElement - 1;
- }
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(stack));
-}
-/* }}} */
-
-/* {{{ proto mixed array_pop(array stack)
- Pops an element off the end of the array */
-PHP_FUNCTION(array_pop)
-{
- _phpi_pop(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-/* {{{ proto mixed array_shift(array stack)
- Pops an element off the beginning of the array */
-PHP_FUNCTION(array_shift)
-{
- _phpi_pop(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-
-/* {{{ proto int array_unshift(array stack, mixed var [, mixed ...])
- Pushes elements onto the beginning of the array */
-PHP_FUNCTION(array_unshift)
-{
- zval ***args, /* Function arguments array */
- *stack; /* Input stack */
- HashTable *new_hash; /* New hashtable for the stack */
- int argc; /* Number of function arguments */
-
-
- /* Get the argument count and check it */
- argc = ZEND_NUM_ARGS();
- if (argc < 2) {
- WRONG_PARAM_COUNT;
- }
-
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- /* Get first argument and check that it's an array */
- stack = *args[0];
- if (Z_TYPE_P(stack) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument should be an array");
- efree(args);
- RETURN_FALSE;
- }
-
- /* Use splice to insert the elements at the beginning. Destroy old
- hashtable and replace it with new one */
- new_hash = php_splice(Z_ARRVAL_P(stack), 0, 0, &args[1], argc-1, NULL);
- zend_hash_destroy(Z_ARRVAL_P(stack));
- efree(Z_ARRVAL_P(stack));
- Z_ARRVAL_P(stack) = new_hash;
-
- /* Clean up and return the number of elements in the stack */
- efree(args);
- RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack)));
-}
-/* }}} */
-
-
-/* {{{ proto array array_splice(array input, int offset [, int length [, array replacement]])
- Removes the elements designated by offset and length and replace them with supplied array */
-PHP_FUNCTION(array_splice)
-{
- zval ***args, /* Function arguments array */
- *array, /* Input array */
- ***repl = NULL; /* Replacement elements */
- HashTable *new_hash = NULL; /* Output array's hash */
- Bucket *p; /* Bucket used for traversing hash */
- int argc, /* Number of function arguments */
- i,
- offset,
- length,
- repl_num = 0; /* Number of replacement elements */
-
- /* Get the argument count and check it */
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 4) {
- WRONG_PARAM_COUNT;
- }
-
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- /* Get first argument and check that it's an array */
- array = *args[0];
- if (Z_TYPE_P(array) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument should be an array");
- efree(args);
- return;
- }
-
- /* Get the next two arguments. If length is omitted, it's assumed to be until the end of the array */
- convert_to_long_ex(args[1]);
- offset = Z_LVAL_PP(args[1]);
- if (argc > 2) {
- convert_to_long_ex(args[2]);
- length = Z_LVAL_PP(args[2]);
- } else
- length = zend_hash_num_elements(Z_ARRVAL_P(array));
-
- if (argc == 4) {
- /* Make sure the last argument, if passed, is an array */
- convert_to_array_ex(args[3]);
-
- /* Create the array of replacement elements */
- repl_num = zend_hash_num_elements(Z_ARRVAL_PP(args[3]));
- repl = (zval ***)emalloc(repl_num * sizeof(zval **));
- for (p=Z_ARRVAL_PP(args[3])->pListHead, i=0; p; p=p->pListNext, i++) {
- repl[i] = ((zval **)p->pData);
- }
- }
-
- /* Initialize return value */
- array_init(return_value);
-
- /* Perform splice */
- new_hash = php_splice(Z_ARRVAL_P(array), offset, length,
- repl, repl_num,
- &Z_ARRVAL_P(return_value));
-
- /* Replace input array's hashtable with the new one */
- zend_hash_destroy(Z_ARRVAL_P(array));
- efree(Z_ARRVAL_P(array));
- Z_ARRVAL_P(array) = new_hash;
-
- /* Clean up */
- if (argc == 4)
- efree(repl);
- efree(args);
-}
-/* }}} */
-
-
-/* {{{ proto array array_slice(array input, int offset [, int length])
- Returns elements specified by offset and length */
-PHP_FUNCTION(array_slice)
-{
- zval **input, /* Input array */
- **offset, /* Offset to get elements from */
- **length, /* How many elements to get */
- **entry; /* An array entry */
- int offset_val, /* Value of the offset argument */
- length_val, /* Value of the length argument */
- num_in, /* Number of elements in the input array */
- pos, /* Current position in the array */
- argc; /* Number of function arguments */
-
- char *string_key;
- uint string_key_len;
- ulong num_key;
- HashPosition hpos;
-
- /* Get the arguments and do error-checking */
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &input, &offset, &length)) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument should be an array");
- return;
- }
-
- /* Make sure offset and length are integers and assume
- we want all entries from offset to the end if length
- is not passed */
- convert_to_long_ex(offset);
- offset_val = Z_LVAL_PP(offset);
- if (argc == 3) {
- convert_to_long_ex(length);
- length_val = Z_LVAL_PP(length);
- } else {
- length_val = zend_hash_num_elements(Z_ARRVAL_PP(input));
- }
-
- /* Initialize returned array */
- array_init(return_value);
-
- /* Get number of entries in the input hash */
- num_in = zend_hash_num_elements(Z_ARRVAL_PP(input));
-
- /* Clamp the offset.. */
- if (offset_val > num_in)
- return;
- else if (offset_val < 0 && (offset_val=num_in+offset_val) < 0)
- offset_val = 0;
-
- /* ..and the length */
- if (length_val < 0) {
- length_val = num_in-offset_val+length_val;
- } else if (offset_val+length_val > num_in) {
- length_val = num_in-offset_val;
- }
-
- if (length_val == 0)
- return;
-
- /* Start at the beginning and go until we hit offset */
- pos = 0;
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &hpos);
- while (pos < offset_val && zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &hpos) == SUCCESS) {
- pos++;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &hpos);
- }
-
- /* Copy elements from input array to the one that's returned */
- while (pos < offset_val+length_val && zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &hpos) == SUCCESS) {
-
- (*entry)->refcount++;
-
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 0, &hpos)) {
- case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL_P(return_value), string_key, string_key_len,
- entry, sizeof(zval *), NULL);
- break;
-
- case HASH_KEY_IS_LONG:
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value),
- entry, sizeof(zval *), NULL);
- break;
- }
- pos++;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &hpos);
- }
-}
-/* }}} */
-
-
-PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS_DC)
-{
- zval **src_entry, **dest_entry;
- char *string_key;
- uint string_key_len;
- ulong num_key;
- HashPosition pos;
-
- zend_hash_internal_pointer_reset_ex(src, &pos);
- while (zend_hash_get_current_data_ex(src, (void **)&src_entry, &pos) == SUCCESS) {
- switch (zend_hash_get_current_key_ex(src, &string_key, &string_key_len, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- if (recursive &&
- zend_hash_find(dest, string_key, string_key_len, (void **)&dest_entry) == SUCCESS) {
- if (*src_entry == *dest_entry) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");
- return 0;
- }
- SEPARATE_ZVAL(dest_entry);
- convert_to_array_ex(dest_entry);
- convert_to_array_ex(src_entry);
- if (!php_array_merge(Z_ARRVAL_PP(dest_entry),
- Z_ARRVAL_PP(src_entry), recursive TSRMLS_CC))
- return 0;
- } else {
- (*src_entry)->refcount++;
-
- zend_hash_update(dest, string_key, strlen(string_key)+1,
- src_entry, sizeof(zval *), NULL);
- }
- break;
-
- case HASH_KEY_IS_LONG:
- (*src_entry)->refcount++;
- zend_hash_next_index_insert(dest, src_entry, sizeof(zval *), NULL);
- break;
- }
-
- zend_hash_move_forward_ex(src, &pos);
- }
-
- return 1;
-}
-
-static void php_array_merge_wrapper(INTERNAL_FUNCTION_PARAMETERS, int recursive)
-{
- zval ***args = NULL;
- int argc, i;
-
- /* Get the argument count and check it */
- argc = ZEND_NUM_ARGS();
- if (argc < 1) {
- WRONG_PARAM_COUNT;
- }
-
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- array_init(return_value);
-
- for (i=0; i<argc; i++) {
- SEPARATE_ZVAL(args[i]);
- convert_to_array_ex(args[i]);
- php_array_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(args[i]), recursive TSRMLS_CC);
- }
-
- efree(args);
-}
-
-
-/* {{{ proto array array_merge(array arr1, array arr2 [, array ...])
- Merges elements from passed arrays into one array */
-PHP_FUNCTION(array_merge)
-{
- php_array_merge_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-
-/* {{{ proto array array_merge_recursive(array arr1, array arr2 [, array ...])
- Recursively merges elements from passed arrays into one array */
-PHP_FUNCTION(array_merge_recursive)
-{
- php_array_merge_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-/* {{{ proto array array_keys(array input [, mixed search_value])
- Return just the keys from the input array, optionally only for the specified search_value */
-PHP_FUNCTION(array_keys)
-{
- zval **input, /* Input array */
- **search_value, /* Value to search for */
- **entry, /* An entry in the input array */
- res, /* Result of comparison */
- *new_val; /* New value */
- int add_key; /* Flag to indicate whether a key should be added */
- char *string_key; /* String key */
- uint string_key_len;
- ulong num_key; /* Numeric key */
- HashPosition pos;
-
- search_value = NULL;
-
- /* Get arguments and do error-checking */
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &input, &search_value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument should be an array");
- return;
- }
-
- /* Initialize return array */
- array_init(return_value);
- add_key = 1;
-
- /* Go through input array and add keys to the return array */
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &pos) == SUCCESS) {
- if (search_value != NULL) {
- is_equal_function(&res, *search_value, *entry TSRMLS_CC);
- add_key = zval_is_true(&res);
- }
-
- if (add_key) {
- MAKE_STD_ZVAL(new_val);
-
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 1, &pos)) {
- case HASH_KEY_IS_STRING:
- Z_TYPE_P(new_val) = IS_STRING;
- Z_STRVAL_P(new_val) = string_key;
- Z_STRLEN_P(new_val) = string_key_len-1;
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &new_val,
- sizeof(zval *), NULL);
- break;
-
- case HASH_KEY_IS_LONG:
- Z_TYPE_P(new_val) = IS_LONG;
- Z_LVAL_P(new_val) = num_key;
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &new_val,
- sizeof(zval *), NULL);
- break;
- }
- }
-
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &pos);
- }
-}
-/* }}} */
-
-
-/* {{{ proto array array_values(array input)
- Return just the values from the input array */
-PHP_FUNCTION(array_values)
-{
- zval **input, /* Input array */
- **entry; /* An entry in the input array */
- HashPosition pos;
-
- /* Get arguments and do error-checking */
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &input) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- return;
- }
-
- /* Initialize return array */
- array_init(return_value);
-
- /* Go through input array and add values to the return array */
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &pos) == SUCCESS) {
-
- (*entry)->refcount++;
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), entry,
- sizeof(zval *), NULL);
-
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &pos);
- }
-}
-/* }}} */
-
-
-/* {{{ proto array array_count_values(array input)
- Return the value as key and the frequency of that value in input as value */
-PHP_FUNCTION(array_count_values)
-{
- zval **input, /* Input array */
- **entry, /* An entry in the input array */
- **tmp;
- HashTable *myht;
- HashPosition pos;
-
- /* Get arguments and do error-checking */
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &input) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- return;
- }
-
- /* Initialize return array */
- array_init(return_value);
-
- /* Go through input array and add values to the return array */
- myht = Z_ARRVAL_PP(input);
- zend_hash_internal_pointer_reset_ex(myht, &pos);
- while (zend_hash_get_current_data_ex(myht, (void **)&entry, &pos) == SUCCESS) {
- if (Z_TYPE_PP(entry) == IS_LONG) {
- if (zend_hash_index_find(Z_ARRVAL_P(return_value),
- Z_LVAL_PP(entry),
- (void**)&tmp) == FAILURE) {
- zval *data;
- MAKE_STD_ZVAL(data);
- Z_TYPE_P(data) = IS_LONG;
- Z_LVAL_P(data) = 1;
- zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_PP(entry), &data, sizeof(data), NULL);
- } else {
- Z_LVAL_PP(tmp)++;
- }
- } else if (Z_TYPE_PP(entry) == IS_STRING) {
- if (zend_hash_find(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry)+1, (void**)&tmp) == FAILURE) {
- zval *data;
- MAKE_STD_ZVAL(data);
- Z_TYPE_P(data) = IS_LONG;
- Z_LVAL_P(data) = 1;
- zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &data, sizeof(data), NULL);
- } else {
- Z_LVAL_PP(tmp)++;
- }
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only count STRING and INTEGER values!");
- }
-
- zend_hash_move_forward_ex(myht, &pos);
- }
-}
-/* }}} */
-
-
-/* {{{ proto array array_reverse(array input [, bool preserve keys])
- Return input as a new array with the order of the entries reversed */
-PHP_FUNCTION(array_reverse)
-{
- zval **input, /* Input array */
- **z_preserve_keys, /* Flag: whether to preserve keys */
- **entry; /* An entry in the input array */
- char *string_key;
- uint string_key_len;
- ulong num_key;
- zend_bool preserve_keys = 0;
- HashPosition pos;
-
- /* Get arguments and do error-checking */
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &input, &z_preserve_keys) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- return;
- }
-
- if (ZEND_NUM_ARGS() > 1) {
- convert_to_boolean_ex(z_preserve_keys);
- preserve_keys = Z_BVAL_PP(z_preserve_keys);
- }
-
- /* Initialize return array */
- array_init(return_value);
-
- zend_hash_internal_pointer_end_ex(Z_ARRVAL_PP(input), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &pos) == SUCCESS) {
- (*entry)->refcount++;
-
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL_P(return_value), string_key, string_key_len, entry, sizeof(zval *), NULL);
- break;
-
- case HASH_KEY_IS_LONG:
- if (preserve_keys) {
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry, sizeof(zval *), NULL);
- } else {
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), entry, sizeof(zval *), NULL);
- }
- break;
- }
-
- zend_hash_move_backwards_ex(Z_ARRVAL_PP(input), &pos);
- }
-}
-/* }}} */
-
-
-/* {{{ proto array array_pad(array input, int pad_size, mixed pad_value)
- Returns a copy of input array padded with pad_value to size pad_size */
-PHP_FUNCTION(array_pad)
-{
- zval **input; /* Input array */
- zval **pad_size; /* Size to pad to */
- zval **pad_value; /* Padding value obviously */
- zval ***pads; /* Array to pass to splice */
- HashTable *new_hash; /* Return value from splice */
- int input_size; /* Size of the input array */
- int pad_size_abs; /* Absolute value of pad_size */
- int num_pads; /* How many pads do we need */
- int do_pad; /* Whether we should do padding at all */
- int i;
-
- /* Get arguments and do error-checking */
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &input, &pad_size, &pad_value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* Make sure arguments are of the proper type */
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- return;
- }
- convert_to_long_ex(pad_size);
-
- /* Do some initial calculations */
- input_size = zend_hash_num_elements(Z_ARRVAL_PP(input));
- pad_size_abs = abs(Z_LVAL_PP(pad_size));
- do_pad = (input_size >= pad_size_abs) ? 0 : 1;
-
- /* Copy the original array */
- *return_value = **input;
- zval_copy_ctor(return_value);
-
- /* If no need to pad, no need to continue */
- if (!do_pad) {
- return;
- }
-
- /* Populate the pads array */
- num_pads = pad_size_abs - input_size;
- if(num_pads > 1048576) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may only pad up to 1048576 elements at a time");
- RETURN_FALSE;
- }
- pads = (zval ***)emalloc(num_pads * sizeof(zval **));
- for (i = 0; i < num_pads; i++) {
- pads[i] = pad_value;
- }
-
- /* Pad on the right or on the left */
- if (Z_LVAL_PP(pad_size) > 0) {
- new_hash = php_splice(Z_ARRVAL_P(return_value), input_size, 0, pads, num_pads, NULL);
- } else {
- new_hash = php_splice(Z_ARRVAL_P(return_value), 0, 0, pads, num_pads, NULL);
- }
-
- /* Copy the result hash into return value */
- zend_hash_destroy(Z_ARRVAL_P(return_value));
- efree(Z_ARRVAL_P(return_value));
- Z_ARRVAL_P(return_value) = new_hash;
-
- /* Clean up */
- efree(pads);
-}
-/* }}} */
-
-/* {{{ proto array array_flip(array input)
- Return array with key <-> value flipped */
-PHP_FUNCTION(array_flip)
-{
- zval **array, **entry, *data;
- HashTable *target_hash;
- char *string_key;
- uint str_key_len;
- ulong num_key;
- HashPosition pos;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- zend_hash_internal_pointer_reset_ex(target_hash, &pos);
- while (zend_hash_get_current_data_ex(target_hash, (void **)&entry, &pos) == SUCCESS) {
- MAKE_STD_ZVAL(data);
- switch (zend_hash_get_current_key_ex(target_hash, &string_key, &str_key_len, &num_key, 1, &pos)) {
- case HASH_KEY_IS_STRING:
- Z_STRVAL_P(data) = string_key;
- Z_STRLEN_P(data) = str_key_len-1;
- Z_TYPE_P(data) = IS_STRING;
- break;
- case HASH_KEY_IS_LONG:
- Z_TYPE_P(data) = IS_LONG;
- Z_LVAL_P(data) = num_key;
- break;
- }
-
- if (Z_TYPE_PP(entry) == IS_LONG) {
- zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_PP(entry), &data, sizeof(data), NULL);
- } else if (Z_TYPE_PP(entry) == IS_STRING) {
- zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &data, sizeof(data), NULL);
- } else {
- zval_ptr_dtor(&data); /* will free also zval structure */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only flip STRING and INTEGER values!");
- }
-
- zend_hash_move_forward_ex(target_hash, &pos);
- }
-}
-/* }}} */
-
-/* {{{ proto array array_change_key_case(array input [, int case=CASE_LOWER])
- Retuns an array with all string keys lowercased [or uppercased] */
-PHP_FUNCTION(array_change_key_case)
-{
- zval **array, **entry, **to_upper;
- char *string_key;
- char *new_key;
- uint str_key_len;
- ulong num_key;
- ulong change_to_upper=0;
-
- HashPosition pos;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &array, &to_upper) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (ZEND_NUM_ARGS() > 1) {
- convert_to_long_ex(to_upper);
- change_to_upper = Z_LVAL_PP(to_upper);
- }
-
- if (Z_TYPE_PP(array) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(array), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(array), (void **)&entry, &pos) == SUCCESS) {
- (*entry)->refcount++;
-
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(array), &string_key, &str_key_len, &num_key, 0, &pos)) {
- case HASH_KEY_IS_LONG:
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry, sizeof(entry), NULL);
- break;
- case HASH_KEY_IS_STRING:
- new_key=estrndup(string_key,str_key_len);
- if (change_to_upper)
- php_strtoupper(new_key, str_key_len - 1);
- else
- php_strtolower(new_key, str_key_len - 1);
- zend_hash_update(Z_ARRVAL_P(return_value), new_key, str_key_len, entry, sizeof(entry), NULL);
- efree(new_key);
- break;
- }
-
- zend_hash_move_forward_ex(Z_ARRVAL_PP(array), &pos);
- }
-}
-/* }}} */
-
-/* {{{ proto array array_unique(array input)
- Removes duplicate values from array */
-PHP_FUNCTION(array_unique)
-{
- zval **array;
- HashTable *target_hash;
- Bucket *p;
- struct bucketindex {
- Bucket *b;
- unsigned int i;
- };
- struct bucketindex *arTmp, *cmpdata, *lastkept;
- unsigned int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- RETURN_FALSE;
- }
-
- /* copy the argument array */
- *return_value = **array;
- zval_copy_ctor(return_value);
-
- if (target_hash->nNumOfElements <= 1) { /* nothing to do */
- return;
- }
-
- /* create and sort array with pointers to the target_hash buckets */
- arTmp = (struct bucketindex *) pemalloc((target_hash->nNumOfElements + 1) * sizeof(struct bucketindex), target_hash->persistent);
- if (!arTmp) {
- RETURN_FALSE;
- }
- for (i = 0, p = target_hash->pListHead; p; i++, p = p->pListNext) {
- arTmp[i].b = p;
- arTmp[i].i = i;
- }
- arTmp[i].b = NULL;
- set_compare_func(SORT_STRING TSRMLS_CC);
- zend_qsort((void *) arTmp, i, sizeof(struct bucketindex), array_data_compare TSRMLS_CC);
-
- /* go through the sorted array and delete duplicates from the copy */
- lastkept = arTmp;
- for (cmpdata = arTmp + 1; cmpdata->b; cmpdata++) {
- if (array_data_compare(lastkept, cmpdata TSRMLS_CC)) {
- lastkept = cmpdata;
- } else {
- if (lastkept->i > cmpdata->i) {
- p = lastkept->b;
- lastkept = cmpdata;
- } else {
- p = cmpdata->b;
- }
- if (p->nKeyLength) {
- zend_hash_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength);
- } else {
- zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
- }
- }
- }
- pefree(arTmp, target_hash->persistent);
-}
-/* }}} */
-
-static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior)
-{
- zval ***args = NULL;
- HashTable *hash;
- int argc, i, c = 0;
- Bucket ***lists, **list, ***ptrs, *p;
-
- /* Get the argument count and check it */
- argc = ZEND_NUM_ARGS();
- if (argc < 2) {
- WRONG_PARAM_COUNT;
- }
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
- /* for each argument, create and sort list with pointers to the hash buckets */
- lists = (Bucket ***)emalloc(argc * sizeof(Bucket **));
- ptrs = (Bucket ***)emalloc(argc * sizeof(Bucket **));
- set_compare_func(SORT_STRING TSRMLS_CC);
- for (i=0; i<argc; i++) {
- if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is not an array", i+1);
- argc = i; /* only free up to i-1 */
- goto out;
- }
- hash = HASH_OF(*args[i]);
- list = (Bucket **) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket *), hash->persistent);
- if (!list)
- RETURN_FALSE;
- lists[i] = list;
- ptrs[i] = list;
- for (p = hash->pListHead; p; p = p->pListNext)
- *list++ = p;
- *list = NULL;
- if (behavior == INTERSECT_NORMAL) {
- zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket *), array_data_compare TSRMLS_CC);
- } else if (behavior == INTERSECT_ASSOC) {
- zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket *), array_key_compare TSRMLS_CC);
- }
- }
-
- /* copy the argument array */
- *return_value = **args[0];
- zval_copy_ctor(return_value);
-
- /* go through the lists and look for common values */
- while (*ptrs[0]) {
- for (i=1; i<argc; i++) {
- if (behavior == INTERSECT_NORMAL) {
- while (*ptrs[i] && (0 < (c = array_data_compare(ptrs[0], ptrs[i] TSRMLS_CC)))) {
- ptrs[i]++;
- }
- } else if (behavior == INTERSECT_ASSOC) {
- while (*ptrs[i] && (0 < (c = array_key_compare(ptrs[0], ptrs[i] TSRMLS_CC)))) {
- ptrs[i]++;
- }
- if (!c && *ptrs[i]) { /* this means that ptrs[i] is not NULL so we can compare */
- /* and "c==0" is from last operation */
- if (array_data_compare(ptrs[0], ptrs[i] TSRMLS_CC) != 0) {
- c = 1;
- /* we are going to the break */
- } else {
- /* continue looping */
- }
- }
- }
- if (!*ptrs[i]) {
- /* delete any values corresponding to remains of ptrs[0] */
- /* and exit because they do not present in at least one of */
- /* the other arguments */
- for (;;) {
- p = *ptrs[0]++;
- if (!p) {
- goto out;
- }
- if (p->nKeyLength) {
- zend_hash_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength);
- } else {
- zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
- }
- }
- }
- if (c) /* here we get if not all are equal */
- break;
- ptrs[i]++;
- }
- if (c) {
- /* Value of ptrs[0] not in all arguments, delete all entries */
- /* with value < value of ptrs[i] */
- for (;;) {
- p = *ptrs[0];
- if (p->nKeyLength) {
- zend_hash_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength);
- } else {
- zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
- }
- if (!*++ptrs[0]) {
- goto out;
- }
- if (behavior == INTERSECT_NORMAL) {
- if (0 <= array_data_compare(ptrs[0], ptrs[i] TSRMLS_CC)) {
- break;
- }
- } else if (behavior == INTERSECT_ASSOC) {
- /* no need of looping because indexes are unique */
- break;
- }
- }
- } else {
- /* ptrs[0] is present in all the arguments */
- /* Skip all entries with same value as ptrs[0] */
- for (;;) {
- if (!*++ptrs[0]) {
- goto out;
- }
- if (behavior == INTERSECT_NORMAL) {
- if (array_data_compare(ptrs[0]-1, ptrs[0] TSRMLS_CC)) {
- break;
- }
- } else if (behavior == INTERSECT_ASSOC) {
- /* no need of looping because indexes are unique */
- break;
- }
- }
- }
- }
-
-out:
- for (i=0; i<argc; i++) {
- hash = HASH_OF(*args[i]);
- pefree(lists[i], hash->persistent);
- }
- efree(ptrs);
- efree(lists);
- efree(args);
-}
-
-/* {{{ proto array array_intersect(array arr1, array arr2 [, array ...])
- Returns the entries of arr1 that have values which are present in all the other arguments */
-PHP_FUNCTION(array_intersect)
-{
- php_array_intersect(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_NORMAL);
-}
-/* }}} */
-
-/* {{{ proto array array_intersect_assoc(array arr1, array arr2 [, array ...])
- Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrctive check */
-PHP_FUNCTION(array_intersect_assoc)
-{
- php_array_intersect(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_ASSOC);
-}
-/* }}} */
-
-
-static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior)
-{
- zval ***args = NULL;
- HashTable *hash;
- int argc, i, c;
- Bucket ***lists, **list, ***ptrs, *p;
-
- /* Get the argument count and check it */
- argc = ZEND_NUM_ARGS();
- if (argc < 2) {
- WRONG_PARAM_COUNT;
- }
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
- /* for each argument, create and sort list with pointers to the hash buckets */
- lists = (Bucket ***)emalloc(argc * sizeof(Bucket **));
- ptrs = (Bucket ***)emalloc(argc * sizeof(Bucket **));
- set_compare_func(SORT_STRING TSRMLS_CC);
- for (i = 0; i < argc; i++) {
- if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is not an array", i + 1);
- argc = i; /* only free up to i-1 */
- goto out;
- }
- hash = HASH_OF(*args[i]);
- list = (Bucket **) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket *), hash->persistent);
- if (!list) {
- RETURN_FALSE;
- }
- lists[i] = list;
- ptrs[i] = list;
- for (p = hash->pListHead; p; p = p->pListNext) {
- *list++ = p;
- }
- *list = NULL;
- if (behavior == DIFF_NORMAL) {
- zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket *), array_data_compare TSRMLS_CC);
- } else if (behavior == DIFF_ASSOC) {
- zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket *), array_key_compare TSRMLS_CC);
- }
- }
-
- /* copy the argument array */
- *return_value = **args[0];
- zval_copy_ctor(return_value);
-
- /* go through the lists and look for values of ptr[0] that are not in the others */
- while (*ptrs[0]) {
- c = 1;
- for (i = 1; i < argc; i++) {
- if (behavior == DIFF_NORMAL) {
- while (*ptrs[i] && (0 < (c = array_data_compare(ptrs[0], ptrs[i] TSRMLS_CC)))) {
- ptrs[i]++;
- }
- } else if (behavior == DIFF_ASSOC) {
- while (*ptrs[i] && (0 < (c = array_key_compare(ptrs[0], ptrs[i] TSRMLS_CC)))) {
- ptrs[i]++;
- }
- }
- if (!c) {
- if (behavior == DIFF_NORMAL) {
- if (*ptrs[i]) {
- ptrs[i]++;
- }
- break;
- } else if (behavior == DIFF_ASSOC) {
- if (*ptrs[i]) {
- if (array_data_compare(ptrs[0], ptrs[i] TSRMLS_CC) != 0) {
- c = -1;
- } else {
- break;
- }
- }
- }
- }
- }
- if (!c) {
- /* ptrs[0] in one of the other arguments */
- /* delete all entries with value as ptrs[0] */
- for (;;) {
- p = *ptrs[0];
- if (p->nKeyLength) {
- zend_hash_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength);
- } else {
- zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
- }
- if (!*++ptrs[0]) {
- goto out;
- }
- if (behavior == DIFF_NORMAL) {
- if (array_data_compare(ptrs[0] - 1, ptrs[0] TSRMLS_CC)) {
- break;
- }
- } else if (behavior == DIFF_ASSOC) {
- /* in this case no array_key_compare is needed */
- break;
- }
- }
- } else {
- /* ptrs[0] in none of the other arguments */
- /* skip all entries with value as ptrs[0] */
- for (;;) {
- if (!*++ptrs[0]) {
- goto out;
- }
- if (behavior == DIFF_NORMAL) {
- if (array_data_compare(ptrs[0]-1, ptrs[0] TSRMLS_CC)) {
- break;
- }
- } else if (behavior == DIFF_ASSOC) {
- /* in this case no array_key_compare is needed */
- break;
- }
- }
- }
- }
-out:
- for (i = 0; i < argc; i++) {
- hash = HASH_OF(*args[i]);
- pefree(lists[i], hash->persistent);
- }
- efree(ptrs);
- efree(lists);
- efree(args);
-}
-
-/* {{{ proto array array_diff(array arr1, array arr2 [, array ...])
- Returns the entries of arr1 that have values which are not present in any of the others arguments */
-PHP_FUNCTION(array_diff)
-{
- php_array_diff(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_NORMAL);
-}
-/* }}} */
-
-/* {{{ proto array array_diff_assoc(array arr1, array arr2 [, array ...])
- Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal */
-PHP_FUNCTION(array_diff_assoc)
-{
- php_array_diff(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_ASSOC);
-}
-/* }}} */
-
-
-
-#define MULTISORT_ORDER 0
-#define MULTISORT_TYPE 1
-#define MULTISORT_LAST 2
-
-int multisort_compare(const void *a, const void *b TSRMLS_DC)
-{
- Bucket **ab = *(Bucket ***)a;
- Bucket **bb = *(Bucket ***)b;
- int r;
- int result = 0;
- zval temp;
-
- r = 0;
- do {
- set_compare_func(ARRAYG(multisort_flags)[MULTISORT_TYPE][r] TSRMLS_CC);
-
- ARRAYG(compare_func)(&temp, *((zval **)ab[r]->pData), *((zval **)bb[r]->pData) TSRMLS_CC);
- result = ARRAYG(multisort_flags)[MULTISORT_ORDER][r] * Z_LVAL(temp);
- if (result != 0) {
- return result;
- }
- r++;
- } while (ab[r] != NULL);
-
- return result;
-}
-
-#define MULTISORT_ABORT \
- for (k = 0; k < MULTISORT_LAST; k++) \
- efree(ARRAYG(multisort_flags)[k]); \
- efree(arrays); \
- efree(args); \
- RETURN_FALSE;
-
-/* {{{ proto bool array_multisort(array ar1 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING]] [, array ar2 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING]], ...])
- Sort multiple arrays at once similar to how ORDER BY clause works in SQL */
-PHP_FUNCTION(array_multisort)
-{
- zval*** args;
- zval*** arrays;
- Bucket*** indirect;
- Bucket* p;
- HashTable* hash;
- int argc;
- int array_size;
- int num_arrays = 0;
- int parse_state[MULTISORT_LAST]; /* 0 - flag not allowed 1 - flag allowed */
- int sort_order = SORT_ASC;
- int sort_type = SORT_REGULAR;
- int i, k;
-
- /* Get the argument count and check it */
- argc = ZEND_NUM_ARGS();
- if (argc < 1) {
- WRONG_PARAM_COUNT;
- }
-
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- /* Allocate space for storing pointers to input arrays and sort flags. */
- arrays = (zval ***)ecalloc(argc, sizeof(zval **));
- for (i = 0; i < MULTISORT_LAST; i++) {
- parse_state[i] = 0;
- ARRAYG(multisort_flags)[i] = (int *)ecalloc(argc, sizeof(int));
- }
-
- /* Here we go through the input arguments and parse them. Each one can
- * be either an array or a sort flag which follows an array. If not
- * specified, the sort flags defaults to SORT_ASC and SORT_REGULAR
- * accordingly. There can't be two sort flags of the same type after an
- * array, and the very first argument has to be an array.
- */
- for (i = 0; i < argc; i++) {
- if (Z_TYPE_PP(args[i]) == IS_ARRAY) {
- /* We see the next array, so we update the sort flags of
- the previous array and reset the sort flags. */
- if (i > 0) {
- ARRAYG(multisort_flags)[MULTISORT_ORDER][num_arrays-1] = sort_order;
- ARRAYG(multisort_flags)[MULTISORT_TYPE][num_arrays-1] = sort_type;
- sort_order = SORT_ASC;
- sort_type = SORT_REGULAR;
- }
- arrays[num_arrays++] = args[i];
-
- /* Next one may be an array or a list of sort flags. */
- for (k = 0; k < MULTISORT_LAST; k++) {
- parse_state[k] = 1;
- }
- } else if (Z_TYPE_PP(args[i]) == IS_LONG) {
- switch (Z_LVAL_PP(args[i])) {
- case SORT_ASC:
- case SORT_DESC:
- /* flag allowed here */
- if (parse_state[MULTISORT_ORDER] == 1) {
- /* Save the flag and make sure then next arg is not the current flag. */
- sort_order = Z_LVAL_PP(args[i]) == SORT_DESC ? -1 : 1;
- parse_state[MULTISORT_ORDER] = 0;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i+1);
- MULTISORT_ABORT;
- }
- break;
-
- case SORT_REGULAR:
- case SORT_NUMERIC:
- case SORT_STRING:
- /* flag allowed here */
- if (parse_state[MULTISORT_TYPE] == 1) {
- /* Save the flag and make sure then next arg is not the current flag. */
- sort_type = Z_LVAL_PP(args[i]);
- parse_state[MULTISORT_TYPE] = 0;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1);
- MULTISORT_ABORT;
- }
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is an unknown sort flag", i + 1);
- MULTISORT_ABORT;
- break;
-
- }
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is expected to be an array or a sort flag", i + 1);
- MULTISORT_ABORT;
- }
- }
- /* Take care of the last array sort flags. */
- ARRAYG(multisort_flags)[MULTISORT_ORDER][num_arrays-1] = sort_order;
- ARRAYG(multisort_flags)[MULTISORT_TYPE][num_arrays-1] = sort_type;
-
- /* Make sure the arrays are of the same size. */
- array_size = zend_hash_num_elements(Z_ARRVAL_PP(arrays[0]));
- for (i = 0; i < num_arrays; i++) {
- if (zend_hash_num_elements(Z_ARRVAL_PP(arrays[i])) != array_size) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array sizes are inconsistent");
- MULTISORT_ABORT;
- }
- }
-
- /* If all arrays are empty or have only one entry, we don't need to do anything. */
- if (array_size <= 1) {
- for (k = 0; k < MULTISORT_LAST; k++)
- efree(ARRAYG(multisort_flags)[k]);
- efree(arrays);
- efree(args);
- RETURN_TRUE;
- }
-
- /* Create the indirection array. This array is of size MxN, where
- * M is the number of entries in each input array and N is the number
- * of the input arrays + 1. The last column is NULL to indicate the end
- * of the row.
- */
- indirect = (Bucket ***)emalloc(array_size * sizeof(Bucket **));
- for (i = 0; i < array_size; i++)
- indirect[i] = (Bucket **)emalloc((num_arrays+1) * sizeof(Bucket *));
-
- for (i = 0; i < num_arrays; i++) {
- k = 0;
- for (p = Z_ARRVAL_PP(arrays[i])->pListHead; p; p = p->pListNext, k++) {
- indirect[k][i] = p;
- }
- }
- for (k = 0; k < array_size; k++)
- indirect[k][num_arrays] = NULL;
-
- /* Do the actual sort magic - bada-bim, bada-boom. */
- zend_qsort(indirect, array_size, sizeof(Bucket **), multisort_compare TSRMLS_CC);
-
- /* Restructure the arrays based on sorted indirect - this is mostly taken from zend_hash_sort() function. */
- HANDLE_BLOCK_INTERRUPTIONS();
- for (i = 0; i < num_arrays; i++) {
- hash = Z_ARRVAL_PP(arrays[i]);
- hash->pListHead = indirect[0][i];;
- hash->pListTail = NULL;
- hash->pInternalPointer = hash->pListHead;
-
- for (k = 0; k < array_size; k++) {
- if (hash->pListTail) {
- hash->pListTail->pListNext = indirect[k][i];
- }
- indirect[k][i]->pListLast = hash->pListTail;
- indirect[k][i]->pListNext = NULL;
- hash->pListTail = indirect[k][i];
- }
-
- p = hash->pListHead;
- k = 0;
- while (p != NULL) {
- if (p->nKeyLength == 0)
- p->h = k++;
- p = p->pListNext;
- }
- hash->nNextFreeElement = array_size;
- zend_hash_rehash(hash);
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
- /* Clean up. */
- for (i = 0; i < array_size; i++)
- efree(indirect[i]);
- efree(indirect);
- for (k = 0; k < MULTISORT_LAST; k++)
- efree(ARRAYG(multisort_flags)[k]);
- efree(arrays);
- efree(args);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto mixed array_rand(array input [, int num_req])
- Return key/keys for random entry/entries in the array */
-PHP_FUNCTION(array_rand)
-{
- zval **input, **num_req;
- long randval;
- int num_req_val, num_avail, key_type;
- char *string_key;
- uint string_key_len;
- ulong num_key;
- HashPosition pos;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &input, &num_req) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argument has to be an array");
- return;
- }
-
- num_avail = zend_hash_num_elements(Z_ARRVAL_PP(input));
-
- if (ZEND_NUM_ARGS() > 1) {
- convert_to_long_ex(num_req);
- num_req_val = Z_LVAL_PP(num_req);
- if (num_req_val <= 0 || num_req_val > num_avail) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument has to be between 1 and the number of elements in the array");
- return;
- }
- } else
- num_req_val = 1;
-
- /* Make the return value an array only if we need to pass back more than one result. */
- if (num_req_val > 1) {
- array_init(return_value);
- }
-
- /* We can't use zend_hash_index_find() because the array may have string keys or gaps. */
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
- while (num_req_val && (key_type = zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 0, &pos)) != HASH_KEY_NON_EXISTANT) {
-
- randval = php_rand(TSRMLS_C);
-
- if ((double)(randval/(PHP_RAND_MAX+1.0)) < (double)num_req_val/(double)num_avail) {
- /* If we are returning a single result, just do it. */
- if (Z_TYPE_P(return_value) != IS_ARRAY) {
- if (key_type == HASH_KEY_IS_STRING) {
- RETURN_STRINGL(string_key, string_key_len-1, 1);
- } else {
- RETURN_LONG(num_key);
- }
- } else {
- /* Append the result to the return value. */
- if (key_type == HASH_KEY_IS_STRING)
- add_next_index_stringl(return_value, string_key, string_key_len-1, 1);
- else
- add_next_index_long(return_value, num_key);
- }
- num_req_val--;
- }
- num_avail--;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &pos);
- }
-
- if (num_req_val == num_avail) {
- array_data_shuffle(return_value TSRMLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ proto mixed array_sum(array input)
- Returns the sum of the array entries */
-PHP_FUNCTION(array_sum)
-{
- zval **input,
- **entry,
- entry_n;
- int argc = ZEND_NUM_ARGS();
- HashPosition pos;
- double dval;
-
- if (argc != 1 || zend_get_parameters_ex(argc, &input) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- return;
- }
-
- ZVAL_LONG(return_value, 0);
-
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &pos)) {
-
- if (Z_TYPE_PP(entry) == IS_ARRAY || Z_TYPE_PP(entry) == IS_OBJECT)
- continue;
-
- entry_n = **entry;
- zval_copy_ctor(&entry_n);
- convert_scalar_to_number(&entry_n TSRMLS_CC);
-
- if (Z_TYPE(entry_n) == IS_LONG && Z_TYPE_P(return_value) == IS_LONG) {
- dval = (double)Z_LVAL_P(return_value) + (double)Z_LVAL(entry_n);
- if ( (double)LONG_MIN <= dval && dval <= (double)LONG_MAX ) {
- Z_LVAL_P(return_value) += Z_LVAL(entry_n);
- continue;
- }
- }
- convert_to_double(return_value);
- convert_to_double(&entry_n);
- Z_DVAL_P(return_value) += Z_DVAL(entry_n);
- }
-}
-
-/* }}} */
-
-/* {{{ proto mixed array_reduce(array input, mixed callback [, int initial])
- Iteratively reduce the array to a single value via the callback. */
-PHP_FUNCTION(array_reduce)
-{
- zval **input, **callback, **initial;
- zval **args[2];
- zval **operand;
- zval *result = NULL;
- zval *retval;
- char *callback_name;
- HashPosition pos;
- HashTable *htbl;
-
- if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &input, &callback, &initial) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument should be an array");
- return;
- }
-
- if (!zend_is_callable(*callback, 0, &callback_name)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The second argument, '%s', should be a valid callback", callback_name);
- efree(callback_name);
- return;
- }
- efree(callback_name);
-
- if (ZEND_NUM_ARGS() > 2) {
- result = *initial;
- zval_add_ref(&result);
- }
-
- /* (zval **)input points to an element of argument stack
- * the base pointer of which is subject to change.
- * thus we need to keep the pointer to the hashtable for safety */
-
- htbl = Z_ARRVAL_PP(input);
-
- if (zend_hash_num_elements(htbl) == 0) {
- if (result) {
- *return_value = *result;
- zval_copy_ctor(return_value);
- }
- return;
- }
-
- zend_hash_internal_pointer_reset_ex(htbl, &pos);
- while (zend_hash_get_current_data_ex(htbl, (void **)&operand, &pos) == SUCCESS) {
- if (result) {
- args[0] = &result;
- args[1] = operand;
- if (call_user_function_ex(EG(function_table), NULL, *callback, &retval, 2, args, 0, NULL TSRMLS_CC) == SUCCESS && retval) {
- zval_ptr_dtor(&result);
- result = retval;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the reduction callback");
- return;
- }
- } else {
- result = *operand;
- zval_add_ref(&result);
- }
-
- zend_hash_move_forward_ex(htbl, &pos);
- }
-
- *return_value = *result;
- zval_copy_ctor(return_value);
- zval_ptr_dtor(&result);
-}
-/* }}} */
-
-
-/* {{{ proto array array_filter(array input [, mixed callback])
- Filters elements from the array via the callback. */
-PHP_FUNCTION(array_filter)
-{
- zval **input, **callback = NULL;
- zval **operand;
- zval **args[1];
- zval *retval = NULL;
- char *callback_name;
- char *string_key;
- uint string_key_len;
- ulong num_key;
- HashPosition pos;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &input, &callback) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument should be an array");
- return;
- }
-
- if (ZEND_NUM_ARGS() > 1) {
- if (!zend_is_callable(*callback, 0, &callback_name)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The second argument, '%s', should be a valid callback", callback_name);
- efree(callback_name);
- return;
- }
- efree(callback_name);
- }
-
- array_init(return_value);
- if (zend_hash_num_elements(Z_ARRVAL_PP(input)) == 0) {
- return;
- }
-
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&operand, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &pos)) {
-
- if (callback) {
- args[0] = operand;
- if (call_user_function_ex(EG(function_table), NULL, *callback, &retval, 1, args, 0, NULL TSRMLS_CC) == SUCCESS && retval) {
- if (!zend_is_true(retval)) {
- zval_ptr_dtor(&retval);
- continue;
- } else {
- zval_ptr_dtor(&retval);
- }
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the filter callback");
- return;
- }
- } else if (!zend_is_true(*operand)) {
- continue;
- }
-
- zval_add_ref(operand);
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL_P(return_value), string_key, string_key_len, operand, sizeof(zval *), NULL);
- break;
-
- case HASH_KEY_IS_LONG:
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, operand, sizeof(zval *), NULL);
- break;
- }
- }
-}
-/* }}} */
-
-
-/* {{{ proto array array_map(mixed callback, array input1 [, array input2 ,...])
- Applies the callback to the elements in given arrays. */
-PHP_FUNCTION(array_map)
-{
- zval ***pargs = NULL;
- zval ***params;
- zval *callback;
- zval *result, *null;
- HashPosition *array_pos;
- zval **args;
- char *callback_name;
- int i, k, maxlen = 0;
- int *array_len;
-
- if (ZEND_NUM_ARGS() < 2) {
- WRONG_PARAM_COUNT;
- }
-
- RETVAL_NULL();
-
- pargs = (zval ***)safe_emalloc(ZEND_NUM_ARGS(), sizeof(zval **), 0);
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), pargs) == FAILURE) {
- efree(pargs);
- WRONG_PARAM_COUNT;
- }
-
- callback = *pargs[0];
-
- if (Z_TYPE_P(callback) != IS_NULL) {
- if (!zend_is_callable(callback, 0, &callback_name)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument, '%s', should be either NULL or a valid callback", callback_name);
- efree(callback_name);
- efree(pargs);
- return;
- }
- efree(callback_name);
- }
-
- args = (zval **)safe_emalloc(ZEND_NUM_ARGS(), sizeof(zval *), 0);
- array_len = (int *)safe_emalloc(ZEND_NUM_ARGS(), sizeof(int), 0);
- array_pos = (HashPosition *)safe_emalloc(ZEND_NUM_ARGS(), sizeof(HashPosition), 0);
-
- for (i = 1; i < ZEND_NUM_ARGS(); i++) {
- if (Z_TYPE_PP(pargs[i]) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d should be an array", i + 1);
- efree(pargs);
- efree(args);
- efree(array_len);
- efree(array_pos);
- return;
- }
- args[i] = *pargs[i];
- array_len[i] = zend_hash_num_elements(Z_ARRVAL_PP(pargs[i]));
- if (array_len[i] > maxlen) {
- maxlen = array_len[i];
- }
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(pargs[i]), &array_pos[i]);
- }
-
- efree(pargs);
-
- /* Short-circuit: if no callback and only one array, just return it. */
- if (Z_TYPE_P(callback) == IS_NULL && ZEND_NUM_ARGS() == 2) {
- *return_value = *args[1];
- zval_copy_ctor(return_value);
- efree(array_len);
- efree(array_pos);
- efree(args);
- return;
- }
-
- array_init(return_value);
- params = (zval ***)safe_emalloc(ZEND_NUM_ARGS(), sizeof(zval **), 0);
- MAKE_STD_ZVAL(null);
- ZVAL_NULL(null);
-
- /* We iterate through all the arrays at once. */
- for (k = 0; k < maxlen; k++) {
- uint str_key_len;
- ulong num_key;
- char *str_key;
- int key_type = 0;
-
- /*
- * If no callback, the result will be an array, consisting of current
- * entries from all arrays.
- */
- if (Z_TYPE_P(callback) == IS_NULL) {
- MAKE_STD_ZVAL(result);
- array_init(result);
- }
-
- for (i = 1; i < ZEND_NUM_ARGS(); i++) {
- /*
- * If this array still hash elements, add the current one to the
- * parameter list, otherwise use null value.
- */
- if (k < array_len[i]) {
- zend_hash_get_current_data_ex(Z_ARRVAL_P(args[i]), (void **)&params[i], &array_pos[i]);
-
- /*
- * It is safe to store only last value of key type, because
- * this loop will run just once if there is only 1 array.
- */
- if (ZEND_NUM_ARGS() == 2) {
- key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(args[1]), &str_key, &str_key_len, &num_key, 0, &array_pos[i]);
- }
-
- zend_hash_move_forward_ex(Z_ARRVAL_P(args[i]), &array_pos[i]);
- } else {
- params[i] = &null;
- }
-
- if (Z_TYPE_P(callback) == IS_NULL) {
- zval_add_ref(params[i]);
- add_next_index_zval(result, *params[i]);
- }
- }
-
- if (Z_TYPE_P(callback) != IS_NULL) {
- if (!call_user_function_ex(EG(function_table), NULL, callback, &result, ZEND_NUM_ARGS() - 1, &params[1], 0, NULL TSRMLS_CC) == SUCCESS && result) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the map callback");
- efree(array_len);
- efree(args);
- efree(array_pos);
- zval_dtor(return_value);
- RETURN_NULL();
- }
- }
-
- if (ZEND_NUM_ARGS() > 2) {
- add_next_index_zval(return_value, result);
- } else {
- if (key_type == HASH_KEY_IS_STRING) {
- add_assoc_zval_ex(return_value, str_key, str_key_len, result);
- } else {
- add_index_zval(return_value, num_key, result);
- }
- }
- }
-
- zval_ptr_dtor(&null);
- efree(params);
- efree(array_len);
- efree(array_pos);
- efree(args);
-}
-/* }}} */
-
-
-/* {{{ proto bool array_key_exists(mixed key, array search)
- Checks if the given key or index exists in the array */
-PHP_FUNCTION(array_key_exists)
-{
- zval **key, /* key to check for */
- **array; /* array to check in */
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &key, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(array) != IS_ARRAY && Z_TYPE_PP(array) != IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The second argument should be either an array or an object");
- RETURN_FALSE;
- }
-
- switch (Z_TYPE_PP(key)) {
- case IS_STRING:
- if (zend_hash_exists(HASH_OF(*array), Z_STRVAL_PP(key), Z_STRLEN_PP(key)+1)) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-
- case IS_LONG:
- if (zend_hash_index_exists(HASH_OF(*array), Z_LVAL_PP(key))) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
- case IS_NULL:
- if (zend_hash_exists(HASH_OF(*array), "", 1)) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument should be either a string or an integer");
- RETURN_FALSE;
- }
-
-}
-/* }}} */
-
-
-/* {{{ proto array array_chunk(array input, int size [, bool preserve_keys])
- Split array into chunks */
-PHP_FUNCTION(array_chunk)
-{
- int argc = ZEND_NUM_ARGS(), key_type;
- long size, current = 0;
- char *str_key;
- uint str_key_len;
- ulong num_key;
- zend_bool preserve_keys = 0;
- zval *input = NULL;
- zval *chunk = NULL;
- zval **entry;
- HashPosition pos;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "al|b", &input, &size, &preserve_keys) == FAILURE) {
- return;
- }
- /* Do bounds checking for size parameter. */
- if (size < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Size parameter expected to be greater than 0");
- return;
- }
-
- array_init(return_value);
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_P(input), (void**)&entry, &pos) == SUCCESS) {
- /* If new chunk, create and initialize it. */
- if (!chunk) {
- MAKE_STD_ZVAL(chunk);
- array_init(chunk);
- }
-
- /* Add entry to the chunk, preserving keys if necessary. */
- zval_add_ref(entry);
-
- if (preserve_keys) {
- key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &str_key,
- &str_key_len, &num_key, 0, &pos);
- if (key_type == HASH_KEY_IS_STRING) {
- add_assoc_zval_ex(chunk, str_key, str_key_len, *entry);
- } else {
- add_index_zval(chunk, num_key, *entry);
- }
- } else {
- add_next_index_zval(chunk, *entry);
- }
-
- /*
- * If reached the chunk size, add it to the result array, and reset the
- * pointer.
- */
- if (!(++current % size)) {
- add_next_index_zval(return_value, chunk);
- chunk = NULL;
- }
-
- zend_hash_move_forward_ex(Z_ARRVAL_P(input), &pos);
- }
-
- /* Add the final chunk if there is one. */
- if (chunk) {
- add_next_index_zval(return_value, chunk);
- }
-}
-/* }}} */
-
-/* {{{ proto array array_combine(array keys, array values)
- Creates an array by using the elements of the first parameter as keys and the elements of the second as correspoding keys */
-PHP_FUNCTION(array_combine)
-{
- zval *values, *keys;
- HashPosition pos_values, pos_keys;
- zval **entry_keys, **entry_values;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "aa", &keys, &values) == FAILURE) {
- return;
- }
-
- if (zend_hash_num_elements(Z_ARRVAL_P(keys)) == 0 || zend_hash_num_elements(Z_ARRVAL_P(values)) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Both parameters should have number of elements at least 0");
- RETURN_FALSE;
- }
-
-
- if (zend_hash_num_elements(Z_ARRVAL_P(keys)) != zend_hash_num_elements(Z_ARRVAL_P(values))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Both parameters should have equal number of elements");
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(keys), &pos_keys);
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(values), &pos_values);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_P(keys), (void **)&entry_keys, &pos_keys) == SUCCESS &&
- zend_hash_get_current_data_ex(Z_ARRVAL_P(values), (void **)&entry_values, &pos_values) == SUCCESS) {
- if (Z_TYPE_PP(entry_keys) == IS_STRING) {
- zval_add_ref(entry_values);
- add_assoc_zval(return_value, Z_STRVAL_PP(entry_keys), *entry_values);
- } else if (Z_TYPE_PP(entry_keys) == IS_LONG) {
- zval_add_ref(entry_values);
- add_index_zval(return_value, Z_LVAL_PP(entry_keys), *entry_values);
- }
- zend_hash_move_forward_ex(Z_ARRVAL_PP(entry_keys), &pos_keys);
- zend_hash_move_forward_ex(Z_ARRVAL_PP(entry_values), &pos_values);
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
deleted file mode 100644
index 1445ce62ea..0000000000
--- a/ext/standard/assert.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* {{{ includes/startup/misc */
-
-#include "php.h"
-#include "php_assert.h"
-#include "php_ini.h"
-
-ZEND_BEGIN_MODULE_GLOBALS(assert)
- long active;
- long bail;
- long warning;
- long quiet_eval;
- zval *callback;
-ZEND_END_MODULE_GLOBALS(assert)
-
-ZEND_DECLARE_MODULE_GLOBALS(assert)
-
-#ifdef ZTS
-#define ASSERTG(v) TSRMG(assert_globals_id, zend_assert_globals *, v)
-#else
-#define ASSERTG(v) (assert_globals.v)
-#endif
-
-#define SAFE_STRING(s) ((s)?(s):"")
-
-enum {
- ASSERT_ACTIVE=1,
- ASSERT_CALLBACK,
- ASSERT_BAIL,
- ASSERT_WARNING,
- ASSERT_QUIET_EVAL
-};
-
-static PHP_INI_MH(OnChangeCallback)
-{
- if (ASSERTG(callback)) {
- zval_ptr_dtor(&ASSERTG(callback));
- }
-
- MAKE_STD_ZVAL(ASSERTG(callback));
-
- if (new_value) {
- ZVAL_STRINGL(ASSERTG(callback), new_value, new_value_length, 1);
- } else {
- ZVAL_EMPTY_STRING(ASSERTG(callback));
- }
-
- return SUCCESS;
-}
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("assert.active", "1", PHP_INI_ALL, OnUpdateLong, active, zend_assert_globals, assert_globals)
- STD_PHP_INI_ENTRY("assert.bail", "0", PHP_INI_ALL, OnUpdateLong, bail, zend_assert_globals, assert_globals)
- STD_PHP_INI_ENTRY("assert.warning", "1", PHP_INI_ALL, OnUpdateLong, warning, zend_assert_globals, assert_globals)
- PHP_INI_ENTRY ("assert.callback", NULL, PHP_INI_ALL, OnChangeCallback)
- STD_PHP_INI_ENTRY("assert.quiet_eval", "0", PHP_INI_ALL, OnUpdateLong, quiet_eval, zend_assert_globals, assert_globals)
-PHP_INI_END()
-
-static void php_assert_init_globals(zend_assert_globals *assert_globals_p TSRMLS_DC)
-{
- assert_globals_p->callback = NULL;
-}
-
-PHP_MINIT_FUNCTION(assert)
-{
- ZEND_INIT_MODULE_GLOBALS(assert, php_assert_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
-
- REGISTER_LONG_CONSTANT("ASSERT_ACTIVE", ASSERT_ACTIVE, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(assert)
-{
- if (ASSERTG(callback)) {
- zval_ptr_dtor(&ASSERTG(callback));
- ASSERTG(callback) = NULL;
- }
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(assert)
-{
- if (ASSERTG(callback)) {
- zval_ptr_dtor(&ASSERTG(callback));
- ASSERTG(callback) = NULL;
- }
-
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(assert)
-{
- DISPLAY_INI_ENTRIES();
-}
-
-/* }}} */
-/* {{{ internal functions */
-/* }}} */
-/* {{{ proto int assert(string|bool assertion)
- Checks if assertion is false */
-
-PHP_FUNCTION(assert)
-{
- zval **assertion;
- int val;
- char *myeval = NULL;
- char *compiled_string_description;
-
- if (! ASSERTG(active)) {
- RETURN_TRUE;
- }
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &assertion) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(assertion) == IS_STRING) {
- zval retval;
- int old_error_reporting = 0; /* shut up gcc! */
-
- myeval = Z_STRVAL_PP(assertion);
-
- if (ASSERTG(quiet_eval)) {
- old_error_reporting = EG(error_reporting);
- EG(error_reporting) = 0;
- }
-
- compiled_string_description = zend_make_compiled_string_description("assert code" TSRMLS_CC);
- if (zend_eval_string(myeval, &retval, compiled_string_description TSRMLS_CC) == FAILURE) {
- efree(compiled_string_description);
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failure evaluating code:\n%s", myeval);
- /* php_error_docref() does not return in this case. */
- }
- efree(compiled_string_description);
-
- if (ASSERTG(quiet_eval)) {
- EG(error_reporting) = old_error_reporting;
- }
-
- convert_to_boolean(&retval);
- val = Z_LVAL(retval);
- } else {
- convert_to_boolean_ex(assertion);
- val = Z_LVAL_PP(assertion);
- }
-
- if (val) {
- RETURN_TRUE;
- }
-
- if (ASSERTG(callback)) {
- zval *args[3];
- zval *retval;
- int i;
- uint lineno = zend_get_executed_lineno(TSRMLS_C);
- char *filename = zend_get_executed_filename(TSRMLS_C);
-
- MAKE_STD_ZVAL(args[0]);
- MAKE_STD_ZVAL(args[1]);
- MAKE_STD_ZVAL(args[2]);
-
- ZVAL_STRING(args[0], SAFE_STRING(filename), 1);
- ZVAL_LONG (args[1], lineno);
- ZVAL_STRING(args[2], SAFE_STRING(myeval), 1);
-
- MAKE_STD_ZVAL(retval);
- ZVAL_FALSE(retval);
-
- /* XXX do we want to check for error here? */
- call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 3, args TSRMLS_CC);
-
- for (i = 0; i <= 2; i++) {
- zval_ptr_dtor(&(args[i]));
- }
- zval_ptr_dtor(&retval);
- }
-
- if (ASSERTG(warning)) {
- if (myeval) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion \"%s\" failed", myeval);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion failed");
- }
- }
-
- if (ASSERTG(bail)) {
- zend_bailout();
- }
-}
-
-/* }}} */
-/* {{{ proto mixed assert_options(int what [, mixed value])
- Set/get the various assert flags */
-
-PHP_FUNCTION(assert_options)
-{
- pval **what, **value;
- int oldint;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 1 || ac > 2 || zend_get_parameters_ex(ac, &what, &value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(what);
-
- switch (Z_LVAL_PP(what)) {
- case ASSERT_ACTIVE:
- oldint = ASSERTG(active);
- if (ac == 2) {
- convert_to_long_ex(value);
- ASSERTG(active) = Z_LVAL_PP(value);
- }
- RETURN_LONG(oldint);
- break;
-
- case ASSERT_BAIL:
- oldint = ASSERTG(bail);
- if (ac == 2) {
- convert_to_long_ex(value);
- ASSERTG(bail) = Z_LVAL_PP(value);
- }
- RETURN_LONG(oldint);
- break;
-
- case ASSERT_QUIET_EVAL:
- oldint = ASSERTG(quiet_eval);
- if (ac == 2) {
- convert_to_long_ex(value);
- ASSERTG(quiet_eval) = Z_LVAL_PP(value);
- }
- RETURN_LONG(oldint);
- break;
-
- case ASSERT_WARNING:
- oldint = ASSERTG(warning);
- if (ac == 2) {
- convert_to_long_ex(value);
- ASSERTG(warning) = Z_LVAL_PP(value);
- }
- RETURN_LONG(oldint);
- break;
-
- case ASSERT_CALLBACK:
- if (ac == 2) {
- if (ASSERTG(callback)) {
- zval_ptr_dtor(&ASSERTG(callback));
- }
- ASSERTG(callback) = *value;
- zval_add_ref(value);
- }
- RETURN_TRUE;
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown value %d", Z_LVAL_PP(what));
- break;
- }
-
- RETURN_FALSE;
-}
-
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/base64.c b/ext/standard/base64.c
deleted file mode 100644
index 2449fef373..0000000000
--- a/ext/standard/base64.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <string.h>
-
-#include "php.h"
-#include "base64.h"
-
-/* {{{ */
-static const char base64_table[] =
- { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '\0'
- };
-
-static const char base64_pad = '=';
-
-static const short base64_reverse_table[256] = {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
- -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
- -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
-};
-/* }}} */
-
-/* {{{ */
-PHPAPI unsigned char *php_base64_encode(const unsigned char *str, int length, int *ret_length)
-{
- const unsigned char *current = str;
- int i = 0;
- unsigned char *result = (unsigned char *)emalloc(((length + 3 - length % 3) * 4 / 3 + 1) * sizeof(char));
-
- while (length > 2) { /* keep going until we have less than 24 bits */
- result[i++] = base64_table[current[0] >> 2];
- result[i++] = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)];
- result[i++] = base64_table[((current[1] & 0x0f) << 2) + (current[2] >> 6)];
- result[i++] = base64_table[current[2] & 0x3f];
-
- current += 3;
- length -= 3; /* we just handle 3 octets of data */
- }
-
- /* now deal with the tail end of things */
- if (length != 0) {
- result[i++] = base64_table[current[0] >> 2];
- if (length > 1) {
- result[i++] = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)];
- result[i++] = base64_table[(current[1] & 0x0f) << 2];
- result[i++] = base64_pad;
- }
- else {
- result[i++] = base64_table[(current[0] & 0x03) << 4];
- result[i++] = base64_pad;
- result[i++] = base64_pad;
- }
- }
- if(ret_length) {
- *ret_length = i;
- }
- result[i] = '\0';
- return result;
-}
-/* }}} */
-
-/* {{{ */
-/* generate reverse table (do not set index 0 to 64)
-static unsigned short base64_reverse_table[256];
-#define rt base64_reverse_table
-void php_base64_init()
-{
- char *s = emalloc(10240), *sp;
- char *chp;
- short idx;
-
- for(ch = 0; ch < 256; ch++) {
- chp = strchr(base64_table, ch);
- if(ch && chp) {
- idx = chp - base64_table;
- if (idx >= 64) idx = -1;
- rt[ch] = idx;
- } else {
- rt[ch] = -1;
- }
- }
- sp = s;
- sprintf(sp, "static const short base64_reverse_table[256] = {\n");
- for(ch =0; ch < 256;) {
- sp = s+strlen(s);
- sprintf(sp, "\t% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,\n", rt[ch+0], rt[ch+1], rt[ch+2], rt[ch+3], rt[ch+4], rt[ch+5], rt[ch+6], rt[ch+7], rt[ch+8], rt[ch+9], rt[ch+10], rt[ch+11], rt[ch+12], rt[ch+13], rt[ch+14], rt[ch+15]);
- ch += 16;
- }
- sprintf(sp, "};");
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Reverse_table:\n%s", s);
- efree(s);
-}
-*/
-/* }}} */
-
-/* {{{ */
-/* as above, but backwards. :) */
-PHPAPI unsigned char *php_base64_decode(const unsigned char *str, int length, int *ret_length)
-{
- const unsigned char *current = str;
- int ch, i = 0, j = 0, k;
- /* this sucks for threaded environments */
- unsigned char *result;
-
- result = (unsigned char *)emalloc(length + 1);
- if (result == NULL) {
- return NULL;
- }
-
- /* run through the whole string, converting as we go */
- while ((ch = *current++) != '\0' && length-- > 0) {
- if (ch == base64_pad) break;
-
- /* When Base64 gets POSTed, all pluses are interpreted as spaces.
- This line changes them back. It's not exactly the Base64 spec,
- but it is completely compatible with it (the spec says that
- spaces are invalid). This will also save many people considerable
- headache. - Turadg Aleahmad <turadg@wise.berkeley.edu>
- */
-
- if (ch == ' ') ch = '+';
-
- ch = base64_reverse_table[ch];
- if (ch < 0) continue;
-
- switch(i % 4) {
- case 0:
- result[j] = ch << 2;
- break;
- case 1:
- result[j++] |= ch >> 4;
- result[j] = (ch & 0x0f) << 4;
- break;
- case 2:
- result[j++] |= ch >>2;
- result[j] = (ch & 0x03) << 6;
- break;
- case 3:
- result[j++] |= ch;
- break;
- }
- i++;
- }
-
- k = j;
- /* mop things up if we ended on a boundary */
- if (ch == base64_pad) {
- switch(i % 4) {
- case 0:
- case 1:
- efree(result);
- return NULL;
- case 2:
- k++;
- case 3:
- result[k++] = 0;
- }
- }
- if(ret_length) {
- *ret_length = j;
- }
- result[j] = '\0';
- return result;
-}
-/* }}} */
-
-/* {{{ proto string base64_encode(string str)
- Encodes string using MIME base64 algorithm */
-PHP_FUNCTION(base64_encode)
-{
- char *str;
- unsigned char *result;
- int str_len, ret_length;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
- return;
- }
- result = php_base64_encode(str, str_len, &ret_length);
- if (result != NULL) {
- RETVAL_STRINGL(result, ret_length, 0);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto string base64_decode(string str)
- Decodes string using MIME base64 algorithm */
-PHP_FUNCTION(base64_decode)
-{
- char *str;
- unsigned char *result;
- int str_len, ret_length;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
- return;
- }
- result = php_base64_decode(str, str_len, &ret_length);
- if (result != NULL) {
- RETVAL_STRINGL(result, ret_length, 0);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/base64.h b/ext/standard/base64.h
deleted file mode 100644
index ddae163c18..0000000000
--- a/ext/standard/base64.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef BASE64_H
-#define BASE64_H
-
-PHP_FUNCTION(base64_decode);
-PHP_FUNCTION(base64_encode);
-
-PHPAPI extern unsigned char *php_base64_encode(const unsigned char *, int, int *);
-PHPAPI extern unsigned char *php_base64_decode(const unsigned char *, int, int *);
-
-#endif /* BASE64_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
deleted file mode 100644
index 82af90275d..0000000000
--- a/ext/standard/basic_functions.c
+++ /dev/null
@@ -1,3056 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_streams.h"
-#include "php_main.h"
-#include "php_globals.h"
-#include "php_ini.h"
-#include "internal_functions_registry.h"
-#include "php_standard.h"
-#include "php_math.h"
-#include "php_incomplete_class.h"
-#include "ext/standard/info.h"
-#include "ext/session/php_session.h"
-#include "zend_operators.h"
-#include "ext/standard/dns.h"
-
-#include <stdarg.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include <stdio.h>
-
-#ifndef NETWARE
-#include <netdb.h>
-#else
-/*#include "netware/env.h"*/ /* Temporary */
-#ifdef NEW_LIBC /* Same headers hold good for Winsock and Berkeley sockets */
-#include <netinet/in.h>
-/*#include <arpa/inet.h>*/
-#include <netdb.h>
-#else
-#include <sys/socket.h>
-#endif
-#endif
-
-#if HAVE_ARPA_INET_H
-# include <arpa/inet.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
-
-#if HAVE_LOCALE_H
-# include <locale.h>
-#endif
-
-#if HAVE_SYS_MMAN_H
-# include <sys/mman.h>
-#endif
-
-#ifdef HARTMUT_0
-#include <getopt.h>
-#endif
-
-#include "safe_mode.h"
-
-#ifdef PHP_WIN32
-# include "win32/unistd.h"
-#endif
-
-#include "zend_globals.h"
-#include "php_globals.h"
-#include "SAPI.h"
-#include "php_ticks.h"
-
-
-#ifdef ZTS
-int basic_globals_id;
-#else
-php_basic_globals basic_globals;
-#endif
-
-#include "php_fopen_wrappers.h"
-#include "streamsfuncs.h"
-
-static unsigned char first_and_second__args_force_ref[] = { 2, BYREF_FORCE, BYREF_FORCE };
-static unsigned char second_and_third_args_force_ref[] = { 3, BYREF_NONE, BYREF_FORCE, BYREF_FORCE };
-static unsigned char second_args_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
-static unsigned char third_and_fourth_args_force_ref[] = { 4, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE };
-static unsigned char third_and_rest_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE_REST };
-static unsigned char first_through_third_args_force_ref[] = {3, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE};
-static unsigned char fourth_arg_force_ref[] = { 4, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-
-
-typedef struct _php_shutdown_function_entry {
- zval **arguments;
- int arg_count;
-} php_shutdown_function_entry;
-
-typedef struct _user_tick_function_entry {
- zval **arguments;
- int arg_count;
- int calling;
-} user_tick_function_entry;
-
-/* some prototypes for local functions */
-static void user_shutdown_function_dtor(php_shutdown_function_entry *shutdown_function_entry);
-static void user_tick_function_dtor(user_tick_function_entry *tick_function_entry);
-
-/* Demo code. Enable only if you need this. */
-#define ENABLE_TEST_CLASS 0
-
-#if ENABLE_TEST_CLASS
-void test_class_startup(void);
-pval test_class_get_property(zend_property_reference *property_reference);
-int test_class_set_property(zend_property_reference *property_reference, pval *value);
-void test_class_call_function(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
-
-pval test_class_get_property(zend_property_reference *property_reference)
-{
- pval result;
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
-
- printf("Reading a property from a OverloadedTestClass object:\n");
-
- for (element = property_reference->elements_list->head; element; element = element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
-
- switch (Z_TYPE_P(overloaded_property)) {
-
- case OE_IS_ARRAY:
- printf("Array offset: ");
- break;
-
- case OE_IS_OBJECT:
- printf("Object property: ");
- break;
- }
-
- switch (Z_TYPE(overloaded_property->element)) {
-
- case IS_LONG:
- printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
- break;
-
- case IS_STRING:
- printf("'%s'\n", Z_STRVAL(overloaded_property->element));
- break;
- }
- pval_destructor(&overloaded_property->element);
- }
-
- Z_STRVAL(result) = estrndup("testing", 7);
- Z_STRLEN(result) = 7;
- Z_TYPE(result) = IS_STRING;
- return result;
-}
-
-int test_class_set_property(zend_property_reference *property_reference, pval * value)
-{
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
-
- printf("Writing to a property from a OverloadedTestClass object:\n");
- printf("Writing '");
- zend_print_variable(value);
- printf("'\n");
-
- for (element = property_reference->elements_list->head; element; element = element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
-
- switch (Z_TYPE_P(overloaded_property)) {
-
- case OE_IS_ARRAY:
- printf("Array offset: ");
- break;
-
- case OE_IS_OBJECT:
- printf("Object property: ");
- break;
- }
-
- switch (Z_TYPE(overloaded_property->element)) {
-
- case IS_LONG:
- printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
- break;
-
- case IS_STRING:
- printf("'%s'\n", Z_STRVAL(overloaded_property->element));
- break;
- }
- pval_destructor(&overloaded_property->element);
- }
- return 0;
-}
-
-void test_class_call_function(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
-
- printf("Invoking a method on OverloadedTestClass object:\n");
-
- for (element = property_reference->elements_list->head; element; element = element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
-
- switch (Z_TYPE_P(overloaded_property)) {
-
- case OE_IS_ARRAY:
- printf("Array offset: ");
- break;
-
- case OE_IS_OBJECT:
- printf("Object property: ");
- break;
-
- case OE_IS_METHOD:
- printf("Overloaded method: ");
- }
-
- switch (Z_TYPE(overloaded_property->element)) {
-
- case IS_LONG:
- printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
- break;
-
- case IS_STRING:
- printf("'%s'\n", Z_STRVAL(overloaded_property->element));
- break;
- }
- pval_destructor(&overloaded_property->element);
- }
-
- printf("%d arguments\n", ZEND_NUM_ARGS());
- RETVAL_STRING("testing", 1);
-}
-
-void test_class_startup(void)
-{
- zend_class_entry test_class_entry;
- TSRMLS_FETCH();
-
- INIT_OVERLOADED_CLASS_ENTRY(test_class_entry,
- "OverloadedTestClass",
- NULL, test_class_call_function,
- test_class_get_property,
- test_class_set_property);
-
- zend_register_internal_class(&test_class_entry TSRMLS_CC);
-}
-#endif
-
-
-function_entry basic_functions[] = {
- PHP_FE(constant, NULL)
- PHP_FE(bin2hex, NULL)
- PHP_FE(sleep, NULL)
- PHP_FE(usleep, NULL)
- PHP_FE(time, NULL)
- PHP_FE(mktime, NULL)
- PHP_FE(gmmktime, NULL)
-
-#if HAVE_STRFTIME
- PHP_FE(strftime, NULL)
- PHP_FE(gmstrftime, NULL)
-#endif
-
- PHP_FE(strtotime, NULL)
- PHP_FE(date, NULL)
- PHP_FE(idate, NULL)
- PHP_FE(gmdate, NULL)
- PHP_FE(getdate, NULL)
- PHP_FE(localtime, NULL)
- PHP_FE(checkdate, NULL)
-
- PHP_FE(flush, NULL)
- PHP_FE(wordwrap, NULL)
- PHP_FE(htmlspecialchars, NULL)
- PHP_FE(htmlentities, NULL)
- PHP_FE(html_entity_decode, NULL)
- PHP_FE(get_html_translation_table, NULL)
- PHP_FE(sha1, NULL)
- PHP_FE(sha1_file, NULL)
- PHP_NAMED_FE(md5,php_if_md5, NULL)
- PHP_NAMED_FE(md5_file,php_if_md5_file, NULL)
- PHP_NAMED_FE(crc32,php_if_crc32, NULL)
-
- PHP_FE(iptcparse, NULL)
- PHP_FE(iptcembed, NULL)
- PHP_FE(getimagesize, second_args_force_ref)
- PHP_FE(image_type_to_mime_type, NULL)
-
- PHP_FE(phpinfo, NULL)
- PHP_FE(phpversion, NULL)
- PHP_FE(phpcredits, NULL)
- PHP_FE(php_logo_guid, NULL)
- PHP_FE(php_real_logo_guid, NULL)
- PHP_FE(php_egg_logo_guid, NULL)
- PHP_FE(zend_logo_guid, NULL)
- PHP_FE(php_sapi_name, NULL)
- PHP_FE(php_uname, NULL)
- PHP_FE(php_ini_scanned_files, NULL)
-
- PHP_FE(strnatcmp, NULL)
- PHP_FE(strnatcasecmp, NULL)
- PHP_FE(substr_count, NULL)
- PHP_FE(strspn, NULL)
- PHP_FE(strcspn, NULL)
- PHP_FE(strtok, NULL)
- PHP_FE(strtoupper, NULL)
- PHP_FE(strtolower, NULL)
- PHP_FE(strpos, NULL)
- PHP_FE(stripos, NULL)
- PHP_FE(strrpos, NULL)
- PHP_FE(strripos, NULL)
- PHP_FE(strrev, NULL)
- PHP_FE(hebrev, NULL)
- PHP_FE(hebrevc, NULL)
- PHP_FE(nl2br, NULL)
- PHP_FE(basename, NULL)
- PHP_FE(dirname, NULL)
- PHP_FE(pathinfo, NULL)
- PHP_FE(stripslashes, NULL)
- PHP_FE(stripcslashes, NULL)
- PHP_FE(strstr, NULL)
- PHP_FE(stristr, NULL)
- PHP_FE(strrchr, NULL)
- PHP_FE(str_shuffle, NULL)
- PHP_FE(str_word_count, NULL)
- PHP_FE(str_split, NULL)
- PHP_FE(strpbrk, NULL)
-
-#ifdef HAVE_STRCOLL
- PHP_FE(strcoll, NULL)
-#endif
-
-#ifdef HAVE_STRFMON
- PHP_FE(money_format, NULL)
-#endif
-
- PHP_FE(substr, NULL)
- PHP_FE(substr_replace, NULL)
- PHP_FE(quotemeta, NULL)
- PHP_FE(ucfirst, NULL)
- PHP_FE(ucwords, NULL)
- PHP_FE(strtr, NULL)
- PHP_FE(addslashes, NULL)
- PHP_FE(addcslashes, NULL)
- PHP_FE(rtrim, NULL)
- PHP_FE(str_replace, fourth_arg_force_ref)
- PHP_FE(str_ireplace, fourth_arg_force_ref)
- PHP_FE(str_repeat, NULL)
- PHP_FE(count_chars, NULL)
- PHP_FE(chunk_split, NULL)
- PHP_FE(trim, NULL)
- PHP_FE(ltrim, NULL)
- PHP_FE(strip_tags, NULL)
- PHP_FE(similar_text, third_arg_force_ref)
- PHP_FE(explode, NULL)
- PHP_FE(implode, NULL)
- PHP_FE(setlocale, NULL)
- PHP_FE(localeconv, NULL)
-
-#if HAVE_NL_LANGINFO
- PHP_FE(nl_langinfo, NULL)
-#endif
-
- PHP_FE(soundex, NULL)
- PHP_FE(levenshtein, NULL)
- PHP_FE(chr, NULL)
- PHP_FE(ord, NULL)
- PHP_FE(parse_str, second_arg_force_ref)
- PHP_FE(str_pad, NULL)
- PHP_FALIAS(chop, rtrim, NULL)
- PHP_FALIAS(strchr, strstr, NULL)
- PHP_NAMED_FE(sprintf, PHP_FN(user_sprintf), NULL)
- PHP_NAMED_FE(printf, PHP_FN(user_printf), NULL)
- PHP_FE(vprintf, NULL)
- PHP_FE(vsprintf, NULL)
- PHP_FE(fprintf, NULL)
- PHP_FE(vfprintf, NULL)
- PHP_FE(sscanf, third_and_rest_force_ref)
- PHP_FE(fscanf, third_and_rest_force_ref)
- PHP_FE(parse_url, NULL)
- PHP_FE(urlencode, NULL)
- PHP_FE(urldecode, NULL)
- PHP_FE(rawurlencode, NULL)
- PHP_FE(rawurldecode, NULL)
-
-#ifdef HAVE_SYMLINK
- PHP_FE(readlink, NULL)
- PHP_FE(linkinfo, NULL)
- PHP_FE(symlink, NULL)
- PHP_FE(link, NULL)
-#endif
-
- PHP_FE(unlink, NULL)
- PHP_FE(exec, second_and_third_args_force_ref)
- PHP_FE(system, second_arg_force_ref)
- PHP_FE(escapeshellcmd, NULL)
- PHP_FE(escapeshellarg, NULL)
- PHP_FE(passthru, second_arg_force_ref)
- PHP_FE(shell_exec, NULL)
-#ifdef PHP_CAN_SUPPORT_PROC_OPEN
- PHP_FE(proc_open, third_arg_force_ref)
- PHP_FE(proc_close, NULL)
- PHP_FE(proc_terminate, NULL)
- PHP_FE(proc_get_status, NULL)
-#endif
-
-#ifdef HAVE_NICE
- PHP_FE(proc_nice, NULL)
-#endif
-
- PHP_FE(rand, NULL)
- PHP_FE(srand, NULL)
- PHP_FE(getrandmax, NULL)
- PHP_FE(mt_rand, NULL)
- PHP_FE(mt_srand, NULL)
- PHP_FE(mt_getrandmax, NULL)
-
-#if HAVE_GETSERVBYNAME
- PHP_FE(getservbyname, NULL)
-#endif
-
-#if HAVE_GETSERVBYPORT
- PHP_FE(getservbyport, NULL)
-#endif
-
-#if HAVE_GETPROTOBYNAME
- PHP_FE(getprotobyname, NULL)
-#endif
-
-#if HAVE_GETPROTOBYNUMBER
- PHP_FE(getprotobynumber, NULL)
-#endif
-
- PHP_FE(getmyuid, NULL)
- PHP_FE(getmygid, NULL)
- PHP_FE(getmypid, NULL)
- PHP_FE(getmyinode, NULL)
- PHP_FE(getlastmod, NULL)
-
- PHP_FE(base64_decode, NULL)
- PHP_FE(base64_encode, NULL)
-
- PHP_FE(abs, NULL)
- PHP_FE(ceil, NULL)
- PHP_FE(floor, NULL)
- PHP_FE(round, NULL)
- PHP_FE(sin, NULL)
- PHP_FE(cos, NULL)
- PHP_FE(tan, NULL)
- PHP_FE(asin, NULL)
- PHP_FE(acos, NULL)
- PHP_FE(atan, NULL)
- PHP_FE(atan2, NULL)
- PHP_FE(sinh, NULL)
- PHP_FE(cosh, NULL)
- PHP_FE(tanh, NULL)
-
-#ifdef HAVE_ASINH
- PHP_FE(asinh, NULL)
-#endif
-#ifdef HAVE_ACOSH
- PHP_FE(acosh, NULL)
-#endif
-#ifdef HAVE_ATANH
- PHP_FE(atanh, NULL)
-#endif
-#if !defined(PHP_WIN32) && !defined(NETWARE)
- PHP_FE(expm1, NULL)
- PHP_FE(log1p, NULL)
-#endif
-
- PHP_FE(pi, NULL)
- PHP_FE(is_finite, NULL)
- PHP_FE(is_nan, NULL)
- PHP_FE(is_infinite, NULL)
- PHP_FE(pow, NULL)
- PHP_FE(exp, NULL)
- PHP_FE(log, NULL)
- PHP_FE(log10, NULL)
- PHP_FE(sqrt, NULL)
- PHP_FE(hypot, NULL)
- PHP_FE(deg2rad, NULL)
- PHP_FE(rad2deg, NULL)
- PHP_FE(bindec, NULL)
- PHP_FE(hexdec, NULL)
- PHP_FE(octdec, NULL)
- PHP_FE(decbin, NULL)
- PHP_FE(decoct, NULL)
- PHP_FE(dechex, NULL)
- PHP_FE(base_convert, NULL)
- PHP_FE(number_format, NULL)
- PHP_FE(fmod, NULL)
- PHP_FE(ip2long, NULL)
- PHP_FE(long2ip, NULL)
-
- PHP_FE(getenv, NULL)
-#ifdef HAVE_PUTENV
- PHP_FE(putenv, NULL)
-#endif
-
-#ifdef HAVE_GETOPT
- PHP_FE(getopt, NULL)
-#endif
-
-#ifdef HAVE_GETTIMEOFDAY
- PHP_FE(microtime, NULL)
- PHP_FE(gettimeofday, NULL)
-#endif
-
-#ifdef HAVE_GETRUSAGE
- PHP_FE(getrusage, NULL)
-#endif
-
-#ifdef HAVE_GETTIMEOFDAY
- PHP_FE(uniqid, NULL)
-#endif
-
- PHP_FE(quoted_printable_decode, NULL)
- PHP_FE(convert_cyr_string, NULL)
- PHP_FE(get_current_user, NULL)
- PHP_FE(set_time_limit, NULL)
- PHP_FE(get_cfg_var, NULL)
- PHP_FALIAS(magic_quotes_runtime, set_magic_quotes_runtime, NULL)
- PHP_FE(set_magic_quotes_runtime, NULL)
- PHP_FE(get_magic_quotes_gpc, NULL)
- PHP_FE(get_magic_quotes_runtime, NULL)
-
- PHP_FE(import_request_variables, NULL)
- PHP_FE(error_log, NULL)
- PHP_FE(call_user_func, NULL)
- PHP_FE(call_user_func_array, NULL)
- PHP_FE(call_user_method, second_arg_force_ref)
- PHP_FE(call_user_method_array, second_arg_force_ref)
- PHP_FE(serialize, NULL)
- PHP_FE(unserialize, NULL)
-
- PHP_FE(var_dump, NULL)
- PHP_FE(var_export, NULL)
- PHP_FE(debug_zval_dump, NULL)
- PHP_FE(print_r, NULL)
-#if MEMORY_LIMIT
- PHP_FE(memory_get_usage, NULL)
-#endif
-
- PHP_FE(register_shutdown_function, NULL)
- PHP_FE(register_tick_function, NULL)
- PHP_FE(unregister_tick_function, NULL)
-
- PHP_FE(highlight_file, NULL)
- PHP_FALIAS(show_source, highlight_file, NULL)
- PHP_FE(highlight_string, NULL)
-
- PHP_FE(ini_get, NULL)
- PHP_FE(ini_get_all, NULL)
- PHP_FE(ini_set, NULL)
- PHP_FALIAS(ini_alter, ini_set, NULL)
- PHP_FE(ini_restore, NULL)
- PHP_FE(get_include_path, NULL)
- PHP_FE(set_include_path, NULL)
- PHP_FE(restore_include_path, NULL)
-
- PHP_FE(setcookie, NULL)
- PHP_FE(header, NULL)
- PHP_FE(headers_sent, first_and_second__args_force_ref)
-
- PHP_FE(connection_aborted, NULL)
- PHP_FE(connection_status, NULL)
- PHP_FE(ignore_user_abort, NULL)
- PHP_FE(parse_ini_file, NULL)
- PHP_FE(is_uploaded_file, NULL)
- PHP_FE(move_uploaded_file, NULL)
-
- /* functions from dns.c */
- PHP_FE(gethostbyaddr, NULL)
- PHP_FE(gethostbyname, NULL)
- PHP_FE(gethostbynamel, NULL)
-
-#if HAVE_RES_SEARCH && !(defined(__BEOS__) || defined(PHP_WIN32) || defined(NETWARE))
- PHP_FE(dns_check_record, NULL)
- PHP_FALIAS(checkdnsrr, dns_check_record, NULL)
-# if HAVE_DN_SKIPNAME && HAVE_DN_EXPAND
- PHP_FE(dns_get_mx, second_and_third_args_force_ref)
- PHP_FALIAS(getmxrr, dns_get_mx, second_and_third_args_force_ref)
-# endif
-# if HAVE_DNS_FUNCS
- PHP_FE(dns_get_record, third_and_rest_force_ref)
-# endif
-#endif
-
- /* functions from type.c */
- PHP_FE(intval, NULL)
- PHP_FE(floatval, NULL)
- PHP_FALIAS(doubleval, floatval, NULL)
- PHP_FE(strval, NULL)
- PHP_FE(gettype, NULL)
- PHP_FE(settype, first_arg_force_ref)
- PHP_FE(is_null, NULL)
- PHP_FE(is_resource, NULL)
- PHP_FE(is_bool, NULL)
- PHP_FE(is_long, NULL)
- PHP_FE(is_float, NULL)
- PHP_FALIAS(is_int, is_long, NULL)
- PHP_FALIAS(is_integer, is_long, NULL)
- PHP_FALIAS(is_double, is_float, NULL)
- PHP_FALIAS(is_real, is_float, NULL)
- PHP_FE(is_numeric, NULL)
- PHP_FE(is_string, NULL)
- PHP_FE(is_array, NULL)
- PHP_FE(is_object, NULL)
- PHP_FE(is_scalar, NULL)
- PHP_FE(is_callable, third_arg_force_ref)
-
- /* functions from reg.c */
- PHP_FE(ereg, third_arg_force_ref)
- PHP_FE(ereg_replace, NULL)
- PHP_FE(eregi, third_arg_force_ref)
- PHP_FE(eregi_replace, NULL)
- PHP_FE(split, NULL)
- PHP_FE(spliti, NULL)
- PHP_FALIAS(join, implode, NULL)
- PHP_FE(sql_regcase, NULL)
-
- /* functions from dl.c */
- PHP_FE(dl, NULL)
-
- /* functions from file.c */
- PHP_FE(pclose, NULL)
- PHP_FE(popen, NULL)
- PHP_FE(readfile, NULL)
- PHP_FE(rewind, NULL)
- PHP_FE(rmdir, NULL)
- PHP_FE(umask, NULL)
- PHP_FE(fclose, NULL)
- PHP_FE(feof, NULL)
- PHP_FE(fgetc, NULL)
- PHP_FE(fgets, NULL)
- PHP_FE(fgetss, NULL)
- PHP_FE(fread, NULL)
- PHP_STATIC_FE("fopen", php_if_fopen, NULL)
- PHP_FE(fpassthru, NULL)
- PHP_STATIC_FE("ftruncate", php_if_ftruncate, NULL)
- PHP_STATIC_FE("fstat", php_if_fstat, NULL)
- PHP_FE(fseek, NULL)
- PHP_FE(ftell, NULL)
- PHP_FE(fflush, NULL)
- PHP_FE(fwrite, NULL)
- PHP_FALIAS(fputs, fwrite, NULL)
- PHP_FE(mkdir, NULL)
- PHP_FE(rename, NULL)
- PHP_FE(copy, NULL)
- PHP_FE(tempnam, NULL)
- PHP_STATIC_FE("tmpfile", php_if_tmpfile, NULL)
- PHP_FE(file, NULL)
- PHP_FE(file_get_contents, NULL)
- PHP_FE(file_put_contents, NULL)
- PHP_FE(stream_select, first_through_third_args_force_ref)
- PHP_FE(stream_context_create, NULL)
- PHP_FE(stream_context_set_params, NULL)
- PHP_FE(stream_context_set_option, NULL)
- PHP_FE(stream_context_get_options, NULL)
- PHP_FE(stream_filter_prepend, NULL)
- PHP_FE(stream_filter_append, NULL)
- PHP_FE(stream_socket_client, second_and_third_args_force_ref)
- PHP_FE(stream_socket_server, second_and_third_args_force_ref)
- PHP_FE(stream_socket_accept, third_arg_force_ref)
- PHP_FE(stream_socket_get_name, NULL)
- PHP_FE(stream_copy_to_stream, NULL)
- PHP_FE(fgetcsv, NULL)
- PHP_FE(flock, NULL)
- PHP_FE(get_meta_tags, NULL)
- PHP_FE(stream_set_write_buffer, NULL)
- PHP_FALIAS(set_file_buffer, stream_set_write_buffer, NULL)
-
- PHP_FE(set_socket_blocking, NULL)
- PHP_FE(stream_set_blocking, NULL)
- PHP_FALIAS(socket_set_blocking, stream_set_blocking, NULL)
-
- PHP_FE(stream_get_meta_data, NULL)
- PHP_FE(stream_get_line, NULL)
- PHP_FE(stream_register_wrapper, NULL)
- PHP_FE(stream_get_wrappers, NULL)
- PHP_FE(stream_get_transports, NULL)
- PHP_FE(get_headers, NULL)
-
-#if HAVE_SYS_TIME_H || defined(PHP_WIN32)
- PHP_FE(stream_set_timeout, NULL)
- PHP_FALIAS(socket_set_timeout, stream_set_timeout, NULL)
-#endif
-
- PHP_FALIAS(socket_get_status, stream_get_meta_data, NULL)
-
-#if (!defined(PHP_WIN32) && !defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
- PHP_FE(realpath, NULL)
-#endif
-
-#ifdef HAVE_FNMATCH
- PHP_FE(fnmatch, NULL)
-#endif
-
- /* functions from fsock.c */
- PHP_FE(fsockopen, third_and_fourth_args_force_ref)
- PHP_FE(pfsockopen, third_and_fourth_args_force_ref)
-
- /* functions from pack.c */
- PHP_FE(pack, NULL)
- PHP_FE(unpack, NULL)
-
- /* functions from browscap.c */
- PHP_FE(get_browser, NULL)
-
-#if HAVE_CRYPT
- /* functions from crypt.c */
- PHP_FE(crypt, NULL)
-#endif
-
- /* functions from dir.c */
- PHP_FE(opendir, NULL)
- PHP_FE(closedir, NULL)
- PHP_FE(chdir, NULL)
-
-#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
- PHP_FE(chroot, NULL)
-#endif
-
- PHP_FE(getcwd, NULL)
- PHP_FE(rewinddir, NULL)
- PHP_STATIC_FE("readdir", php_if_readdir, NULL)
- PHP_FALIAS(dir, getdir, NULL)
- PHP_FE(scandir, NULL)
-#ifdef HAVE_GLOB
- PHP_FE(glob, NULL)
-#endif
- /* functions from filestat.c */
- PHP_FE(fileatime, NULL)
- PHP_FE(filectime, NULL)
- PHP_FE(filegroup, NULL)
- PHP_FE(fileinode, NULL)
- PHP_FE(filemtime, NULL)
- PHP_FE(fileowner, NULL)
- PHP_FE(fileperms, NULL)
- PHP_FE(filesize, NULL)
- PHP_FE(filetype, NULL)
- PHP_FE(file_exists, NULL)
- PHP_FE(is_writable, NULL)
- PHP_FALIAS(is_writeable, is_writable, NULL)
- PHP_FE(is_readable, NULL)
- PHP_FE(is_executable, NULL)
- PHP_FE(is_file, NULL)
- PHP_FE(is_dir, NULL)
- PHP_FE(is_link, NULL)
- PHP_STATIC_FE("stat", php_if_stat, NULL)
- PHP_STATIC_FE("lstat", php_if_lstat, NULL)
- PHP_FE(chown, NULL)
- PHP_FE(chgrp, NULL)
- PHP_FE(chmod, NULL)
-#if HAVE_UTIME
- PHP_FE(touch, NULL)
-#endif
- PHP_FE(clearstatcache, NULL)
- PHP_FE(disk_total_space, NULL)
- PHP_FE(disk_free_space, NULL)
- PHP_FALIAS(diskfreespace, disk_free_space, NULL)
-
- /* functions from mail.c */
-#ifdef HAVE_SENDMAIL
- PHP_FE(mail, NULL)
- PHP_FE(ezmlm_hash, NULL)
-#endif
-
- /* functions from syslog.c */
-#ifdef HAVE_SYSLOG_H
- PHP_FE(openlog, NULL)
- PHP_FE(syslog, NULL)
- PHP_FE(closelog, NULL)
- PHP_FE(define_syslog_variables, NULL)
-#endif
-
- /* functions from lcg.c */
- PHP_FE(lcg_value, NULL)
-
- /* functions from metaphone.c */
- PHP_FE(metaphone, NULL)
-
- /* functions from output.c */
- PHP_FE(ob_start, NULL)
- PHP_FE(ob_flush, NULL)
- PHP_FE(ob_clean, NULL)
- PHP_FE(ob_end_flush, NULL)
- PHP_FE(ob_end_clean, NULL)
- PHP_FE(ob_get_flush, NULL)
- PHP_FE(ob_get_clean, NULL)
- PHP_FE(ob_get_length, NULL)
- PHP_FE(ob_get_level, NULL)
- PHP_FE(ob_get_status, NULL)
- PHP_FE(ob_get_contents, NULL)
- PHP_FE(ob_implicit_flush, NULL)
- PHP_FE(ob_list_handlers, NULL)
-
- /* functions from array.c */
- PHP_FE(ksort, first_arg_force_ref)
- PHP_FE(krsort, first_arg_force_ref)
- PHP_FE(natsort, first_arg_force_ref)
- PHP_FE(natcasesort, first_arg_force_ref)
- PHP_FE(asort, first_arg_force_ref)
- PHP_FE(arsort, first_arg_force_ref)
- PHP_FE(sort, first_arg_force_ref)
- PHP_FE(rsort, first_arg_force_ref)
- PHP_FE(usort, first_arg_force_ref)
- PHP_FE(uasort, first_arg_force_ref)
- PHP_FE(uksort, first_arg_force_ref)
- PHP_FE(shuffle, first_arg_force_ref)
- PHP_FE(array_walk, first_arg_force_ref)
- PHP_FE(array_walk_recursive, first_arg_force_ref)
- PHP_FE(count, NULL)
- PHP_FE(end, first_arg_force_ref)
- PHP_FE(prev, first_arg_force_ref)
- PHP_FE(next, first_arg_force_ref)
- PHP_FE(reset, first_arg_force_ref)
- PHP_FE(current, first_arg_force_ref)
- PHP_FE(key, first_arg_force_ref)
- PHP_FE(min, NULL)
- PHP_FE(max, NULL)
- PHP_FE(in_array, NULL)
- PHP_FE(array_search, NULL)
- PHP_FE(extract, NULL)
- PHP_FE(compact, NULL)
- PHP_FE(array_fill, NULL)
- PHP_FE(range, NULL)
- PHP_FE(array_multisort, NULL)
- PHP_FE(array_push, first_arg_force_ref)
- PHP_FE(array_pop, first_arg_force_ref)
- PHP_FE(array_shift, first_arg_force_ref)
- PHP_FE(array_unshift, first_arg_force_ref)
- PHP_FE(array_splice, first_arg_force_ref)
- PHP_FE(array_slice, NULL)
- PHP_FE(array_merge, NULL)
- PHP_FE(array_merge_recursive, NULL)
- PHP_FE(array_keys, NULL)
- PHP_FE(array_values, NULL)
- PHP_FE(array_count_values, NULL)
- PHP_FE(array_reverse, NULL)
- PHP_FE(array_reduce, NULL)
- PHP_FE(array_pad, NULL)
- PHP_FE(array_flip, NULL)
- PHP_FE(array_change_key_case, NULL)
- PHP_FE(array_rand, NULL)
- PHP_FE(array_unique, NULL)
- PHP_FE(array_intersect, NULL)
- PHP_FE(array_intersect_assoc, NULL)
- PHP_FE(array_diff, NULL)
- PHP_FE(array_diff_assoc, NULL)
- PHP_FE(array_sum, NULL)
- PHP_FE(array_filter, NULL)
- PHP_FE(array_map, NULL)
- PHP_FE(array_chunk, NULL)
- PHP_FE(array_combine, NULL)
- PHP_FE(array_key_exists, NULL)
-
- /* aliases from array.c */
- PHP_FALIAS(pos, current, first_arg_force_ref)
- PHP_FALIAS(sizeof, count, NULL)
- PHP_FALIAS(key_exists, array_key_exists, NULL)
-
- /* functions from assert.c */
- PHP_FE(assert, NULL)
- PHP_FE(assert_options, NULL)
-
- /* functions from versioning.c */
- PHP_FE(version_compare, NULL)
-
- /* functions from ftok.c*/
-#if HAVE_FTOK
- PHP_FE(ftok, NULL)
-#endif
-
- PHP_FE(str_rot13, NULL)
- PHP_FE(stream_get_filters, NULL)
- PHP_FE(stream_register_filter, NULL)
- PHP_FE(stream_bucket_make_writeable, NULL)
- PHP_FE(stream_bucket_prepend, NULL)
- PHP_FE(stream_bucket_append, NULL)
- PHP_FE(stream_bucket_new, NULL)
-
- /* functions from aggregate.c */
- PHP_FE(aggregate, first_arg_force_ref)
- PHP_FE(aggregate_methods, first_arg_force_ref)
- PHP_FE(aggregate_methods_by_list, first_arg_force_ref)
- PHP_FE(aggregate_properties, first_arg_force_ref)
- PHP_FE(aggregate_properties_by_list, first_arg_force_ref)
-#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
- PHP_FE(aggregate_methods_by_regexp, first_arg_force_ref)
- PHP_FE(aggregate_properties_by_regexp, first_arg_force_ref)
-#endif
- PHP_FE(deaggregate, first_arg_force_ref)
- PHP_FE(aggregate_info, first_arg_force_ref)
- PHP_FALIAS(aggregation_info, aggregate_info, first_arg_force_ref)
-
- PHP_FE(output_add_rewrite_var, NULL)
- PHP_FE(output_reset_rewrite_vars, NULL)
- PHP_FE(date_sunrise, NULL)
- PHP_FE(date_sunset, NULL)
-
- {NULL, NULL, NULL}
-};
-
-
-static PHP_INI_MH(OnUpdateSafeModeProtectedEnvVars)
-{
- char *protected_vars, *protected_var;
- char *token_buf;
- int dummy = 1;
-
- protected_vars = estrndup(new_value, new_value_length);
- zend_hash_clean(&BG(sm_protected_env_vars));
-
- protected_var = php_strtok_r(protected_vars, ", ", &token_buf);
- while (protected_var) {
- zend_hash_update(&BG(sm_protected_env_vars), protected_var, strlen(protected_var), &dummy, sizeof(int), NULL);
- protected_var = php_strtok_r(NULL, ", ", &token_buf);
- }
- efree(protected_vars);
- return SUCCESS;
-}
-
-
-static PHP_INI_MH(OnUpdateSafeModeAllowedEnvVars)
-{
- if (BG(sm_allowed_env_vars)) {
- free(BG(sm_allowed_env_vars));
- }
- BG(sm_allowed_env_vars) = zend_strndup(new_value, new_value_length);
- return SUCCESS;
-}
-
-
-PHP_INI_BEGIN()
- PHP_INI_ENTRY_EX("safe_mode_protected_env_vars", SAFE_MODE_PROTECTED_ENV_VARS, PHP_INI_SYSTEM, OnUpdateSafeModeProtectedEnvVars, NULL)
- PHP_INI_ENTRY_EX("safe_mode_allowed_env_vars", SAFE_MODE_ALLOWED_ENV_VARS, PHP_INI_SYSTEM, OnUpdateSafeModeAllowedEnvVars, NULL)
- PHP_INI_ENTRY("date.default_latitude", DATE_DEFAULT_LATITUDE, PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("date.default_longitude", DATE_DEFAULT_LONGITUDE, PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("date.sunset_zenith", DATE_SUNSET_ZENITH, PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("date.sunrise_zenith", DATE_SUNRISE_ZENITH, PHP_INI_ALL, NULL)
-PHP_INI_END()
-
-
-zend_module_entry basic_functions_module = {
- STANDARD_MODULE_HEADER,
- "standard", /* extension name */
- basic_functions, /* function list */
- PHP_MINIT(basic), /* process startup */
- PHP_MSHUTDOWN(basic), /* process shutdown */
- PHP_RINIT(basic), /* request startup */
- PHP_RSHUTDOWN(basic), /* request shutdown */
- PHP_MINFO(basic), /* extension info */
- PHP_VERSION, /* extension version */
- STANDARD_MODULE_PROPERTIES
-};
-
-
-#if defined(HAVE_PUTENV)
-static void php_putenv_destructor(putenv_entry *pe)
-{
- if (pe->previous_value) {
- putenv(pe->previous_value);
- } else {
-# if HAVE_UNSETENV
- unsetenv(pe->key);
-# else
- char **env;
-
- for (env = environ; env != NULL && *env != NULL; env++) {
- if (!strncmp(*env, pe->key, pe->key_len) && (*env)[pe->key_len] == '=') { /* found it */
- *env = "";
- break;
- }
- }
-# endif
- }
- efree(pe->putenv_string);
- efree(pe->key);
-}
-#endif
-
-
-static void basic_globals_ctor(php_basic_globals *basic_globals_p TSRMLS_DC)
-{
- BG(next) = NULL;
- BG(left) = -1;
- BG(user_tick_functions) = NULL;
- BG(aggregation_table) = NULL;
- BG(user_filter_map) = NULL;
- zend_hash_init(&BG(sm_protected_env_vars), 5, NULL, NULL, 1);
- BG(sm_allowed_env_vars) = NULL;
-
- memset(&BG(url_adapt_state), 0, sizeof(BG(url_adapt_state)));
- memset(&BG(url_adapt_state_ex), 0, sizeof(BG(url_adapt_state_ex)));
-
- BG(incomplete_class) = php_create_incomplete_class(TSRMLS_C);
-}
-
-
-static void basic_globals_dtor(php_basic_globals *basic_globals_p TSRMLS_DC)
-{
- zend_hash_destroy(&BG(sm_protected_env_vars));
- if (BG(sm_allowed_env_vars)) {
- free(BG(sm_allowed_env_vars));
- }
-}
-
-
-PHP_MINIT_FUNCTION(basic)
-{
-#ifdef ZTS
- ts_allocate_id(&basic_globals_id, sizeof(php_basic_globals), (ts_allocate_ctor) basic_globals_ctor, (ts_allocate_dtor) basic_globals_dtor);
-#else
- basic_globals_ctor(&basic_globals TSRMLS_CC);
-#endif
-
- REGISTER_LONG_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CONNECTION_NORMAL", PHP_CONNECTION_NORMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CONNECTION_TIMEOUT", PHP_CONNECTION_TIMEOUT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("INI_USER", ZEND_INI_USER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INI_PERDIR", ZEND_INI_PERDIR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INI_SYSTEM", ZEND_INI_SYSTEM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INI_ALL", ZEND_INI_ALL, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SUNFUNCS_RET_DOUBLE", SUNFUNCS_RET_DOUBLE, CONST_CS | CONST_PERSISTENT);
-
-#define REGISTER_MATH_CONSTANT(x) REGISTER_DOUBLE_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT)
- REGISTER_MATH_CONSTANT(M_E);
- REGISTER_MATH_CONSTANT(M_LOG2E);
- REGISTER_MATH_CONSTANT(M_LOG10E);
- REGISTER_MATH_CONSTANT(M_LN2);
- REGISTER_MATH_CONSTANT(M_LN10);
- REGISTER_MATH_CONSTANT(M_PI);
- REGISTER_MATH_CONSTANT(M_PI_2);
- REGISTER_MATH_CONSTANT(M_PI_4);
- REGISTER_MATH_CONSTANT(M_1_PI);
- REGISTER_MATH_CONSTANT(M_2_PI);
- REGISTER_MATH_CONSTANT(M_2_SQRTPI);
- REGISTER_MATH_CONSTANT(M_SQRT2);
- REGISTER_MATH_CONSTANT(M_SQRT1_2);
-
-#if ENABLE_TEST_CLASS
- test_class_startup();
-#endif
-
- REGISTER_INI_ENTRIES();
-
- register_phpinfo_constants(INIT_FUNC_ARGS_PASSTHRU);
- register_html_constants(INIT_FUNC_ARGS_PASSTHRU);
- register_string_constants(INIT_FUNC_ARGS_PASSTHRU);
-
- PHP_MINIT(regex)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(file)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(pack)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(browscap)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(standard_filters)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(user_filters)(INIT_FUNC_ARGS_PASSTHRU);
-
-#if defined(HAVE_LOCALECONV) && defined(ZTS)
- PHP_MINIT(localeconv)(INIT_FUNC_ARGS_PASSTHRU);
-#endif
-
-#if defined(HAVE_NL_LANGINFO)
- PHP_MINIT(nl_langinfo)(INIT_FUNC_ARGS_PASSTHRU);
-#endif
-
-#if HAVE_CRYPT
- PHP_MINIT(crypt)(INIT_FUNC_ARGS_PASSTHRU);
-#endif
-
- PHP_MINIT(lcg)(INIT_FUNC_ARGS_PASSTHRU);
-
- PHP_MINIT(dir)(INIT_FUNC_ARGS_PASSTHRU);
-#ifdef HAVE_SYSLOG_H
- PHP_MINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU);
-#endif
- PHP_MINIT(array)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(assert)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(url_scanner_ex)(INIT_FUNC_ARGS_PASSTHRU);
-#ifdef PHP_CAN_SUPPORT_PROC_OPEN
- PHP_MINIT(proc_open)(INIT_FUNC_ARGS_PASSTHRU);
-#endif
-
- PHP_MINIT(user_streams)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(imagetypes)(INIT_FUNC_ARGS_PASSTHRU);
-
- php_register_url_stream_wrapper("php", &php_stream_php_wrapper TSRMLS_CC);
-#ifndef PHP_CURL_URL_WRAPPERS
- php_register_url_stream_wrapper("http", &php_stream_http_wrapper TSRMLS_CC);
- php_register_url_stream_wrapper("ftp", &php_stream_ftp_wrapper TSRMLS_CC);
-#endif
-
-#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32) || defined(NETWARE))
-# if HAVE_DNS_FUNCS
- PHP_MINIT(dns)(INIT_FUNC_ARGS_PASSTHRU);
-# endif
-#endif
-
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(basic)
-{
-#ifdef ZTS
- ts_free_id(basic_globals_id);
-#else
- basic_globals_dtor(&basic_globals TSRMLS_CC);
-#endif
-
- php_unregister_url_stream_wrapper("php" TSRMLS_CC);
-#ifndef PHP_CURL_URL_WRAPPERS
- php_unregister_url_stream_wrapper("http" TSRMLS_CC);
- php_unregister_url_stream_wrapper("ftp" TSRMLS_CC);
-#endif
-
- UNREGISTER_INI_ENTRIES();
-
- PHP_MSHUTDOWN(regex)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_MSHUTDOWN(browscap)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_MSHUTDOWN(array)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_MSHUTDOWN(assert)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_MSHUTDOWN(url_scanner_ex)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_MSHUTDOWN(file)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_MSHUTDOWN(standard_filters)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
-#if defined(HAVE_LOCALECONV) && defined(ZTS)
- PHP_MSHUTDOWN(localeconv)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
-#endif
-
- return SUCCESS;
-}
-
-
-PHP_RINIT_FUNCTION(basic)
-{
- memset(BG(strtok_table), 0, 256);
- BG(strtok_string) = NULL;
- BG(strtok_zval) = NULL;
- BG(locale_string) = NULL;
- BG(user_compare_func_name) = NULL;
- BG(array_walk_func_name) = NULL;
- BG(page_uid) = -1;
- BG(page_gid) = -1;
- BG(page_inode) = -1;
- BG(page_mtime) = -1;
-#ifdef HAVE_PUTENV
- if (zend_hash_init(&BG(putenv_ht), 1, NULL, (void (*)(void *)) php_putenv_destructor, 0) == FAILURE) {
- return FAILURE;
- }
-#endif
- BG(user_shutdown_function_names) = NULL;
-
-#if HAVE_CRYPT
- PHP_RINIT(crypt)(INIT_FUNC_ARGS_PASSTHRU);
-#endif
-
- PHP_RINIT(lcg)(INIT_FUNC_ARGS_PASSTHRU);
-
- PHP_RINIT(filestat)(INIT_FUNC_ARGS_PASSTHRU);
-#ifdef HAVE_SYSLOG_H
- PHP_RINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU);
-#endif
- PHP_RINIT(dir)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_RINIT(url_scanner_ex)(INIT_FUNC_ARGS_PASSTHRU);
-
- /* Reset magic_quotes_runtime */
- PG(magic_quotes_runtime) = INI_BOOL("magic_quotes_runtime");
-
- return SUCCESS;
-}
-
-
-PHP_RSHUTDOWN_FUNCTION(basic)
-{
- if (BG(strtok_zval)) {
- zval_ptr_dtor(&BG(strtok_zval));
- }
- BG(strtok_string) = NULL;
- BG(strtok_zval) = NULL;
-#ifdef HAVE_PUTENV
- zend_hash_destroy(&BG(putenv_ht));
-#endif
-
- /* Check if locale was changed and change it back
- to the value in startup environment */
- if (BG(locale_string) != NULL) {
- setlocale(LC_ALL, "C");
- setlocale(LC_CTYPE, "");
- }
- STR_FREE(BG(locale_string));
-
- PHP_RSHUTDOWN(filestat)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
-#ifdef HAVE_SYSLOG_H
- PHP_RSHUTDOWN(syslog)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
-#endif
- PHP_RSHUTDOWN(assert)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_RSHUTDOWN(url_scanner_ex)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_RSHUTDOWN(streams)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
-
- if (BG(user_tick_functions)) {
- zend_llist_destroy(BG(user_tick_functions));
- efree(BG(user_tick_functions));
- BG(user_tick_functions) = NULL;
- }
-
- if (BG(aggregation_table)) {
- zend_hash_destroy(BG(aggregation_table));
- efree(BG(aggregation_table));
- BG(aggregation_table) = NULL;
- }
-
- if (BG(user_filter_map)) {
- zend_hash_destroy(BG(user_filter_map));
- efree(BG(user_filter_map));
- BG(user_filter_map) = NULL;
- }
-
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(basic)
-{
- php_info_print_table_start();
- PHP_MINFO(regex)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU);
- PHP_MINFO(dl)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU);
- PHP_MINFO(mail)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU);
- php_info_print_table_end();
- PHP_MINFO(assert)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU);
-}
-
-
-/* {{{ proto mixed constant(string const_name)
- Given the name of a constant this function will return the constants associated value */
-PHP_FUNCTION(constant)
-{
- zval **const_name;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &const_name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(const_name);
-
- if (!zend_get_constant(Z_STRVAL_PP(const_name), Z_STRLEN_PP(const_name), return_value TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't find constant %s", Z_STRVAL_PP(const_name));
- RETURN_NULL();
- }
-}
-/* }}} */
-
-/* {{{ proto int ip2long(string ip_address)
- Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address */
-PHP_FUNCTION(ip2long)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(str);
-
- RETURN_LONG(ntohl(inet_addr(Z_STRVAL_PP(str))));
-}
-/* }}} */
-
-/* {{{ proto string long2ip(int proper_address)
- Converts an (IPv4) Internet network address into a string in Internet standard dotted format */
-PHP_FUNCTION(long2ip)
-{
- zval **num;
- unsigned long n;
- struct in_addr myaddr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(num);
-
- n = strtoul(Z_STRVAL_PP(num), NULL, 0);
-
- myaddr.s_addr = htonl(n);
- RETURN_STRING(inet_ntoa(myaddr), 1);
-}
-/* }}} */
-
-
-/********************
- * System Functions *
- ********************/
-
-/* {{{ proto string getenv(string varname)
- Get the value of an environment variable */
-PHP_FUNCTION(getenv)
-{
- char *ptr, *str;
- int str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
- RETURN_FALSE;
- }
- ptr = sapi_getenv(str, str_len TSRMLS_CC);
- if (! ptr) {
- ptr = getenv(str);
- }
- if (ptr) {
- RETURN_STRING(ptr, 1);
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-#ifdef HAVE_PUTENV
-/* {{{ proto bool putenv(string setting)
- Set the value of an environment variable */
-PHP_FUNCTION(putenv)
-{
- pval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- if (Z_STRVAL_PP(str) && *(Z_STRVAL_PP(str))) {
- char *p, **env;
- putenv_entry pe;
-
- pe.putenv_string = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
- pe.key = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
- if ((p = strchr(pe.key, '='))) { /* nullify the '=' if there is one */
- *p = '\0';
- }
- pe.key_len = strlen(pe.key);
-
- if (PG(safe_mode)) {
- /* Check the protected list */
- if (zend_hash_exists(&BG(sm_protected_env_vars), pe.key, pe.key_len)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Safe Mode warning: Cannot override protected environment variable '%s'", pe.key);
- efree(pe.putenv_string);
- efree(pe.key);
- RETURN_FALSE;
- }
-
- /* Check the allowed list */
- if (BG(sm_allowed_env_vars) && *BG(sm_allowed_env_vars)) {
- char *allowed_env_vars = estrdup(BG(sm_allowed_env_vars));
- char *allowed_prefix = strtok(allowed_env_vars, ", ");
- zend_bool allowed = 0;
-
- while (allowed_prefix) {
- if (!strncmp(allowed_prefix, pe.key, strlen(allowed_prefix))) {
- allowed = 1;
- break;
- }
- allowed_prefix = strtok(NULL, ", ");
- }
- efree(allowed_env_vars);
- if (!allowed) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Safe Mode warning: Cannot set environment variable '%s' - it's not in the allowed list", pe.key);
- efree(pe.putenv_string);
- efree(pe.key);
- RETURN_FALSE;
- }
- }
- }
-
- zend_hash_del(&BG(putenv_ht), pe.key, pe.key_len+1);
-
- /* find previous value */
- pe.previous_value = NULL;
- for (env = environ; env != NULL && *env != NULL; env++) {
- if (!strncmp(*env, pe.key, pe.key_len) && (*env)[pe.key_len] == '=') { /* found it */
- pe.previous_value = *env;
- break;
- }
- }
-
- if (putenv(pe.putenv_string) == 0) { /* success */
- zend_hash_add(&BG(putenv_ht), pe.key, pe.key_len+1, (void **) &pe, sizeof(putenv_entry), NULL);
-#ifdef HAVE_TZSET
- if (!strncmp(pe.key, "TZ", 2)) {
- tzset();
- }
-#endif
- RETURN_TRUE;
- } else {
- efree(pe.putenv_string);
- efree(pe.key);
- RETURN_FALSE;
- }
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter syntax.");
- RETURN_FALSE;
-}
-/* }}} */
-#endif
-
-#ifdef HAVE_GETOPT
-/* {{{ free_argv
- Free the memory allocated to an argv array. */
-static void free_argv(char **argv, int argc)
-{
- int i;
-
- if (argv) {
- for (i = 0; i < argc; i++) {
- if (argv[i]) {
- efree(argv[i]);
- }
- }
- efree(argv);
- }
-}
-/* }}} */
-
-#ifdef HARTMUT_0
-/* {{{ free_longopts
- Free the memory allocated to an longopt array. */
-static void free_longopts(struct option *longopts)
-{
- struct option *p;
-
- if(longopts) {
- for(p=longopts; p->name; p++) {
- efree((char *)(p->name));
- }
-
- efree(longopts);
- }
-}
-/* }}} */
-#endif
-
-/* {{{ proto array getopt(string options [, array longopts])
- Get options from the command line argument list */
-PHP_FUNCTION(getopt)
-{
- char *options = NULL, **argv = NULL;
- char opt[2] = { '\0' };
- char *optname;
- int argc = 0, options_len = 0, o;
- zval *val, **args = NULL, *p_longopts = NULL;
-#ifdef HARTMUT_0
- struct option *longopts = NULL;
- int longindex = 0;
-#endif
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a",
- &options, &options_len, &p_longopts) == FAILURE) {
- RETURN_FALSE;
- }
-
- /*
- * Get argv from the global symbol table. We calculate argc ourselves
- * in order to be on the safe side, even though it is also available
- * from the symbol table.
- */
- if (zend_hash_find(HASH_OF(PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv"),
- (void **) &args) != FAILURE) {
- int pos = 0;
- zval **arg;
-
- argc = zend_hash_num_elements(Z_ARRVAL_PP(args));
-
- /*
- * Attempt to allocate enough memory to hold all of the arguments
- * and a trailing NULL
- */
- if ((argv = (char **) emalloc((argc + 1) * sizeof(char *))) == NULL) {
- RETURN_FALSE;
- }
-
- /* Reset the array indexes. */
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(args));
-
- /* Iterate over the hash to construct the argv array. */
- while (zend_hash_get_current_data(Z_ARRVAL_PP(args),
- (void **)&arg) == SUCCESS) {
- argv[pos++] = estrdup(Z_STRVAL_PP(arg));
- zend_hash_move_forward(Z_ARRVAL_PP(args));
- }
-
- /*
- * The C Standard requires argv[argc] to be NULL - this might
- * keep some getopt implementations happy.
- */
- argv[argc] = NULL;
- } else {
- /* Return false if we can't find argv. */
- RETURN_FALSE;
- }
-
- if(p_longopts) {
-#ifdef HARTMUT_0
- int len, c = zend_hash_num_elements(Z_ARRVAL_P(p_longopts));
- struct option *p;
- zval **arg;
- char *name;
-
- longopts = (struct option *)ecalloc(c+1, sizeof(struct option));
-
- if(!longopts) RETURN_FALSE;
-
- /* Reset the array indexes. */
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(p_longopts));
- p = longopts;
-
- /* Iterate over the hash to construct the argv array. */
- while (zend_hash_get_current_data(Z_ARRVAL_P(p_longopts),
- (void **)&arg) == SUCCESS) {
-
- p->has_arg = 0;
- name = estrdup(Z_STRVAL_PP(arg));
- len = strlen(name);
- if((len > 0) && (name[len-1] == ':')) {
- p->has_arg++;
- name[len-1] = '\0';
- if((len > 1) && (name[len-2] == ':')) {
- p->has_arg++;
- name[len-2] = '\0';
- }
- }
-
- p->name = name;
- p->flag = NULL;
- p->val = 0;
-
- zend_hash_move_forward(Z_ARRVAL_P(p_longopts));
- p++;
- }
-#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No support for long options in this build");
-#endif
- }
-
- /* Initialize the return value as an array. */
- array_init(return_value);
-
- /* Disable getopt()'s error messages. */
- opterr = 0;
-
- /* Invoke getopt(3) on the argument array. */
-#ifdef HARTMUT_0
- while ((o = getopt_long(argc, argv, options, longopts, &longindex)) != -1) {
-#else
- while ((o = getopt(argc, argv, options)) != -1) {
-#endif
- /* Skip unknown arguments. */
- if (o == '?') {
- continue;
- }
-
- /* Prepare the option character and the argument string. */
- if(o == 0) {
-#ifdef HARTMUT_0
- optname = (char *)longopts[longindex].name;
-#else
- /* o == 0 shall never happen so this only fixes a compiler warning */
- optname = NULL;
-#endif
- } else {
- if(o == 1) o = '-';
- opt[0] = o;
- optname = opt;
- }
-
- MAKE_STD_ZVAL(val);
- if (optarg != NULL) {
- ZVAL_STRING(val, optarg, 1);
- } else {
- ZVAL_FALSE(val);
- }
-
- /* Add this option / argument pair to the result hash. */
- if(zend_hash_find(HASH_OF(return_value), optname, strlen(optname)+1, (void **)&args) != FAILURE) {
- if(Z_TYPE_PP(args) != IS_ARRAY) {
- convert_to_array_ex(args);
- }
- zend_hash_next_index_insert(HASH_OF(*args), (void *)&val, sizeof(zval *), NULL);
- } else {
- zend_hash_add(HASH_OF(return_value), optname, strlen(optname)+1, (void *)&val,
- sizeof(zval *), NULL);
- }
- }
-
- free_argv(argv, argc);
-#ifdef HARTMUT_0
- free_longopts(longopts);
-#endif
-}
-/* }}} */
-#endif
-
-/* {{{ proto void flush(void)
- Flush the output buffer */
-PHP_FUNCTION(flush)
-{
- sapi_flush(TSRMLS_C);
-}
-/* }}} */
-
-/* {{{ proto void sleep(int seconds)
- Delay for a given number of seconds */
-PHP_FUNCTION(sleep)
-{
- pval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(num);
- php_sleep(Z_LVAL_PP(num));
-}
-/* }}} */
-
-/* {{{ proto void usleep(int micro_seconds)
- Delay for a given number of micro seconds */
-PHP_FUNCTION(usleep)
-{
-#if HAVE_USLEEP
- pval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(num);
- usleep(Z_LVAL_PP(num));
-#endif
-}
-/* }}} */
-
-/* {{{ proto string get_current_user(void)
- Get the name of the owner of the current PHP script */
-PHP_FUNCTION(get_current_user)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_STRING(php_get_current_user(), 1);
-}
-/* }}} */
-
-/* {{{ proto string get_cfg_var(string option_name)
- Get the value of a PHP configuration option */
-PHP_FUNCTION(get_cfg_var)
-{
- pval **varname;
- char *value;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &varname) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(varname);
-
- if (cfg_get_string(Z_STRVAL_PP(varname), &value) == FAILURE) {
- RETURN_FALSE;
- }
- RETURN_STRING(value, 1);
-}
-/* }}} */
-
-/* {{{ proto bool set_magic_quotes_runtime(int new_setting)
- Set the current active configuration setting of magic_quotes_runtime and return previous */
-PHP_FUNCTION(set_magic_quotes_runtime)
-{
- pval **new_setting;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &new_setting) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_boolean_ex(new_setting);
-
- PG(magic_quotes_runtime) = (zend_bool) Z_LVAL_PP(new_setting);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int get_magic_quotes_runtime(void)
- Get the current active configuration setting of magic_quotes_runtime */
-PHP_FUNCTION(get_magic_quotes_runtime)
-{
- RETURN_LONG(PG(magic_quotes_runtime));
-}
-
-/* }}} */
-
-/* {{{ proto int get_magic_quotes_gpc(void)
- Get the current active configuration setting of magic_quotes_gpc */
-PHP_FUNCTION(get_magic_quotes_gpc)
-{
- RETURN_LONG(PG(magic_quotes_gpc));
-}
-/* }}} */
-
-/*
- 1st arg = error message
- 2nd arg = error option
- 3rd arg = optional parameters (email address or tcp address)
- 4th arg = used for additional headers if email
-
-error options:
- 0 = send to php_error_log (uses syslog or file depending on ini setting)
- 1 = send via email to 3rd parameter 4th option = additional headers
- 2 = send via tcp/ip to 3rd parameter (name or ip:port)
- 3 = save to file in 3rd parameter
-*/
-
-/* {{{ proto bool error_log(string message [, int message_type [, string destination [, string extra_headers]]])
- Send an error message somewhere */
-PHP_FUNCTION(error_log)
-{
- pval **string, **erropt = NULL, **option = NULL, **emailhead = NULL;
- int opt_err = 0;
- char *message, *opt = NULL, *headers = NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &string) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument 1 invalid");
- RETURN_FALSE;
- }
- break;
-
- case 2:
- if (zend_get_parameters_ex(2, &string, &erropt) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid arguments");
- RETURN_FALSE;
- }
- convert_to_long_ex(erropt);
- opt_err = Z_LVAL_PP(erropt);
- break;
-
- case 3:
- if (zend_get_parameters_ex(3, &string, &erropt, &option) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid arguments");
- RETURN_FALSE;
- }
- convert_to_long_ex(erropt);
- opt_err = Z_LVAL_PP(erropt);
- convert_to_string_ex(option);
- opt = Z_STRVAL_PP(option);
- break;
-
- case 4:
- if (zend_get_parameters_ex (4, &string, &erropt, &option, &emailhead) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid arguments");
- RETURN_FALSE;
- }
- break;
-
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(string);
- message = Z_STRVAL_PP(string);
-
- if (erropt != NULL) {
- convert_to_long_ex(erropt);
- opt_err = Z_LVAL_PP(erropt);
- }
-
- if (option != NULL) {
- convert_to_string_ex(option);
- opt = Z_STRVAL_PP(option);
- }
-
- if (emailhead != NULL) {
- convert_to_string_ex(emailhead);
- headers = Z_STRVAL_PP(emailhead);
- }
-
- if (_php_error_log(opt_err, message, opt, headers TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-
-PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers TSRMLS_DC)
-{
- php_stream *stream = NULL;
-
- switch (opt_err) {
-
- case 1: /*send an email */
- {
-#if HAVE_SENDMAIL
- if (!php_mail(opt, "PHP error_log message", message, headers, NULL TSRMLS_CC)) {
- return FAILURE;
- }
-#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Mail option not available!");
- return FAILURE;
-#endif
- }
- break;
-
- case 2: /*send to an address */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "TCP/IP option not available!");
- return FAILURE;
- break;
-
- case 3: /*save to a file */
- stream = php_stream_open_wrapper(opt, "a", IGNORE_URL | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
- if (!stream)
- return FAILURE;
- php_stream_write(stream, message, strlen(message));
- php_stream_close(stream);
- break;
-
- default:
- php_log_err(message TSRMLS_CC);
- break;
- }
- return SUCCESS;
-}
-
-/* {{{ proto mixed call_user_func(string function_name [, mixed parmeter] [, mixed ...])
- Call a user function which is the first parameter */
-PHP_FUNCTION(call_user_func)
-{
- zval ***params;
- zval *retval_ptr;
- char *name;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 1) {
- WRONG_PARAM_COUNT;
- }
-
- params = emalloc(sizeof(zval **) * argc);
-
- if (zend_get_parameters_array_ex(argc, params) == FAILURE) {
- efree(params);
- RETURN_FALSE;
- }
-
- if (Z_TYPE_PP(params[0]) != IS_STRING && Z_TYPE_PP(params[0]) != IS_ARRAY) {
- SEPARATE_ZVAL(params[0]);
- convert_to_string_ex(params[0]);
- }
-
- if (!zend_is_callable(*params[0], 0, &name)) {
- php_error_docref1(NULL TSRMLS_CC, name, E_WARNING, "First argument is expected to be a valid callback");
- efree(name);
- efree(params);
- RETURN_NULL();
- }
-
- if (call_user_function_ex(EG(function_table), NULL, *params[0], &retval_ptr, argc-1, params+1, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
- } else {
- if (argc > 1) {
- SEPARATE_ZVAL(params[1]);
- convert_to_string_ex(params[1]);
- if (argc > 2) {
- SEPARATE_ZVAL(params[2]);
- convert_to_string_ex(params[2]);
- php_error_docref1(NULL TSRMLS_CC, name, E_WARNING, "Unable to call %s(%s,%s)", name, Z_STRVAL_PP(params[1]), Z_STRVAL_PP(params[2]));
- } else {
- php_error_docref1(NULL TSRMLS_CC, name, E_WARNING, "Unable to call %s(%s)", name, Z_STRVAL_PP(params[1]));
- }
- } else {
- php_error_docref1(NULL TSRMLS_CC, name, E_WARNING, "Unable to call %s()", name);
- }
- }
-
- efree(name);
- efree(params);
-}
-/* }}} */
-
-/* {{{ proto mixed call_user_func_array(string function_name, array parameters)
- Call a user function which is the first parameter with the arguments contained in array */
-PHP_FUNCTION(call_user_func_array)
-{
- zval ***func_params, **func, **params;
- zval *retval_ptr;
- HashTable *func_params_ht;
- char *name;
- int count;
- int current = 0;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &func, &params) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- SEPARATE_ZVAL(params);
- convert_to_array_ex(params);
-
- if (Z_TYPE_PP(func) != IS_STRING && Z_TYPE_PP(func) != IS_ARRAY) {
- SEPARATE_ZVAL(func);
- convert_to_string_ex(func);
- }
-
- if (!zend_is_callable(*func, 0, &name)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argumented is expected to be a valid callback, '%s' was given", name);
- efree(name);
- RETURN_NULL();
- }
-
- func_params_ht = Z_ARRVAL_PP(params);
-
- count = zend_hash_num_elements(func_params_ht);
- func_params = emalloc(sizeof(zval **) * count);
-
- for (zend_hash_internal_pointer_reset(func_params_ht);
- zend_hash_get_current_data(func_params_ht, (void **) &func_params[current]) == SUCCESS;
- zend_hash_move_forward(func_params_ht)
- ) {
- current++;
- }
-
- if (call_user_function_ex(EG(function_table), NULL, *func, &retval_ptr, count, func_params, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", name);
- }
-
- efree(name);
- efree(func_params);
-}
-/* }}} */
-
-#define _CUM_DEPREC "This function is deprecated, use the call_user_func variety with the array(&$obj, \"method\") syntax instead"
-
-/* {{{ proto mixed call_user_method(string method_name, mixed object [, mixed parameter] [, mixed ...])
- Call a user method on a specific object or class */
-PHP_FUNCTION(call_user_method)
-{
- zval ***params;
- zval *retval_ptr;
- int arg_count = ZEND_NUM_ARGS();
-
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", _CUM_DEPREC);
-
- if (arg_count < 2) {
- WRONG_PARAM_COUNT;
- }
- params = (zval ***) emalloc(sizeof(zval **) * arg_count);
-
- if (zend_get_parameters_array_ex(arg_count, params) == FAILURE) {
- efree(params);
- RETURN_FALSE;
- }
- if (Z_TYPE_PP(params[1]) != IS_OBJECT && Z_TYPE_PP(params[1]) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument is not an object or class name");
- efree(params);
- RETURN_FALSE;
- }
-
- SEPARATE_ZVAL(params[0]);
- convert_to_string(*params[0]);
-
- if (call_user_function_ex(EG(function_table), params[1], *params[0], &retval_ptr, arg_count-2, params+2, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", Z_STRVAL_PP(params[0]));
- }
- efree(params);
-}
-/* }}} */
-
-/* {{{ proto mixed call_user_method_array(string method_name, mixed object, array params)
- Call a user method on a specific object or class using a parameter array */
-PHP_FUNCTION(call_user_method_array)
-{
- zval **method_name, **obj, **params, ***method_args = NULL, *retval_ptr;
- HashTable *params_ar;
- int num_elems, element = 0;
-
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", _CUM_DEPREC);
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &method_name, &obj, &params) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(obj) != IS_OBJECT && Z_TYPE_PP(obj) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument is not an object or class name");
- RETURN_FALSE;
- }
-
- SEPARATE_ZVAL(method_name);
- SEPARATE_ZVAL(params);
- convert_to_string_ex(method_name);
- convert_to_array_ex(params);
-
- params_ar = HASH_OF(*params);
- num_elems = zend_hash_num_elements(params_ar);
- method_args = (zval ***) emalloc(sizeof(zval **) *num_elems);
-
- for (zend_hash_internal_pointer_reset(params_ar);
- zend_hash_get_current_data(params_ar, (void **) &(method_args[element])) == SUCCESS;
- zend_hash_move_forward(params_ar)
- ) {
- element++;
- }
-
- if (call_user_function_ex(EG(function_table), obj, *method_name, &retval_ptr, num_elems, method_args, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", Z_STRVAL_PP(method_name));
- }
-
- efree(method_args);
-}
-/* }}} */
-
-
-void user_shutdown_function_dtor(php_shutdown_function_entry *shutdown_function_entry)
-{
- int i;
-
- for (i = 0; i < shutdown_function_entry->arg_count; i++) {
- zval_ptr_dtor(&shutdown_function_entry->arguments[i]);
- }
- efree(shutdown_function_entry->arguments);
-}
-
-void user_tick_function_dtor(user_tick_function_entry *tick_function_entry)
-{
- int i;
-
- for (i = 0; i < tick_function_entry->arg_count; i++) {
- zval_ptr_dtor(&tick_function_entry->arguments[i]);
- }
- efree(tick_function_entry->arguments);
-}
-
-static int user_shutdown_function_call(php_shutdown_function_entry *shutdown_function_entry TSRMLS_DC)
-{
- zval retval;
-
- if (call_user_function( EG(function_table), NULL,
- shutdown_function_entry->arguments[0],
- &retval,
- shutdown_function_entry->arg_count - 1,
- shutdown_function_entry->arguments + 1
- TSRMLS_CC ) == SUCCESS ) {
- zval_dtor(&retval);
-
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s() - function does not exist", Z_STRVAL_P(shutdown_function_entry->arguments[0]));
- }
- return 0;
-}
-
-static void user_tick_function_call(user_tick_function_entry *tick_fe TSRMLS_DC)
-{
- zval retval;
- zval *function = tick_fe->arguments[0];
-
- /* Prevent reentrant calls to the same user ticks function */
- if (! tick_fe->calling) {
- tick_fe->calling = 1;
-
- if (call_user_function( EG(function_table), NULL,
- function,
- &retval,
- tick_fe->arg_count - 1,
- tick_fe->arguments+1
- TSRMLS_CC) == SUCCESS) {
- zval_dtor(&retval);
-
- } else {
- zval **obj, **method;
-
- if (Z_TYPE_P(function) == IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s() - function does not exist", Z_STRVAL_P(function));
- } else if ( Z_TYPE_P(function) == IS_ARRAY
- && zend_hash_index_find(Z_ARRVAL_P(function), 0, (void **) &obj) == SUCCESS
- && zend_hash_index_find(Z_ARRVAL_P(function), 1, (void **) &method) == SUCCESS
- && Z_TYPE_PP(obj) == IS_OBJECT
- && Z_TYPE_PP(method) == IS_STRING ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s::%s() - function does not exist", Z_OBJCE_PP(obj)->name, Z_STRVAL_PP(method));
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call tick function");
- }
- }
-
- tick_fe->calling = 0;
- }
-}
-
-static void run_user_tick_functions(int tick_count)
-{
- TSRMLS_FETCH();
-
- zend_llist_apply(BG(user_tick_functions), (llist_apply_func_t) user_tick_function_call TSRMLS_CC);
-}
-
-static int user_tick_function_compare(user_tick_function_entry * tick_fe1, user_tick_function_entry * tick_fe2)
-{
- zval *func1 = tick_fe1->arguments[0];
- zval *func2 = tick_fe2->arguments[0];
- TSRMLS_FETCH();
-
- if (Z_TYPE_P(func1) == IS_STRING && Z_TYPE_P(func2) == IS_STRING) {
- return (zend_binary_zval_strcmp(func1, func2) == 0);
- } else if (Z_TYPE_P(func1) == IS_ARRAY && Z_TYPE_P(func2) == IS_ARRAY) {
- zval result;
- zend_compare_arrays(&result, func1, func2 TSRMLS_CC);
- return (Z_LVAL(result) == 0);
- } else {
- return 0;
- }
-}
-
-void php_call_shutdown_functions(void)
-{
- TSRMLS_FETCH();
-
- if (BG(user_shutdown_function_names))
- zend_try {
- zend_hash_apply(BG(user_shutdown_function_names), (apply_func_t) user_shutdown_function_call TSRMLS_CC);
- memcpy(&EG(bailout), &orig_bailout, sizeof(jmp_buf));
- zend_hash_destroy(BG(user_shutdown_function_names));
- efree(BG(user_shutdown_function_names));
- }
- zend_end_try();
-}
-
-/* {{{ proto void register_shutdown_function(string function_name)
- Register a user-level function to be called on request termination */
-PHP_FUNCTION(register_shutdown_function)
-{
- php_shutdown_function_entry shutdown_function_entry;
- int i;
-
- shutdown_function_entry.arg_count = ZEND_NUM_ARGS();
-
- if (shutdown_function_entry.arg_count < 1) {
- WRONG_PARAM_COUNT;
- }
-
- shutdown_function_entry.arguments = (pval **) emalloc(sizeof(pval *) *shutdown_function_entry.arg_count);
-
- if (zend_get_parameters_array(ht, shutdown_function_entry.arg_count, shutdown_function_entry.arguments) == FAILURE) {
- RETURN_FALSE;
- }
-
- /* Prevent entering of anything but arrays/strings */
- if (Z_TYPE_P(shutdown_function_entry.arguments[0]) != IS_ARRAY) {
- convert_to_string(shutdown_function_entry.arguments[0]);
- }
-
- if (!BG(user_shutdown_function_names)) {
- ALLOC_HASHTABLE(BG(user_shutdown_function_names));
- zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void (*)(void *)) user_shutdown_function_dtor, 0);
- }
-
- for (i = 0; i < shutdown_function_entry.arg_count; i++) {
- shutdown_function_entry.arguments[i]->refcount++;
- }
- zend_hash_next_index_insert(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry), NULL);
-}
-/* }}} */
-
-
-ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini)
-{
- syntax_highlighter_ini->highlight_comment = INI_STR("highlight.comment");
- syntax_highlighter_ini->highlight_default = INI_STR("highlight.default");
- syntax_highlighter_ini->highlight_html = INI_STR("highlight.html");
- syntax_highlighter_ini->highlight_keyword = INI_STR("highlight.keyword");
- syntax_highlighter_ini->highlight_string = INI_STR("highlight.string");
-}
-
-/* {{{ proto bool highlight_file(string file_name [, bool return] )
- Syntax highlight a source file */
-PHP_FUNCTION(highlight_file)
-{
- zval *filename;
- zend_syntax_highlighter_ini syntax_highlighter_ini;
- zend_bool i = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &filename, &i) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(filename);
-
- if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_P(filename), NULL, CHECKUID_ALLOW_ONLY_FILE))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(Z_STRVAL_P(filename) TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if (i) {
- php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC);
- }
-
- php_get_highlight_struct(&syntax_highlighter_ini);
-
- if (highlight_file(Z_STRVAL_P(filename), &syntax_highlighter_ini TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (i) {
- php_ob_get_buffer (return_value TSRMLS_CC);
- php_end_ob_buffer (0, 0 TSRMLS_CC);
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool highlight_string(string string [, bool return] )
- Syntax highlight a string or optionally return it */
-PHP_FUNCTION(highlight_string)
-{
- zval *expr;
- zend_syntax_highlighter_ini syntax_highlighter_ini;
- char *hicompiled_string_description;
- zend_bool i = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &expr, &i) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(expr);
-
- if (i) {
- php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC);
- }
-
- php_get_highlight_struct(&syntax_highlighter_ini);
-
- hicompiled_string_description = zend_make_compiled_string_description("highlighted code" TSRMLS_CC);
-
- if (highlight_string(expr, &syntax_highlighter_ini, hicompiled_string_description TSRMLS_CC) == FAILURE) {
- efree(hicompiled_string_description);
- RETURN_FALSE;
- }
- efree(hicompiled_string_description);
-
- if (i) {
- php_ob_get_buffer (return_value TSRMLS_CC);
- php_end_ob_buffer (0, 0 TSRMLS_CC);
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto string ini_get(string varname)
- Get a configuration option */
-PHP_FUNCTION(ini_get)
-{
- pval **varname;
- char *str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &varname) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(varname);
-
- str = zend_ini_string(Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, 0);
-
- if (!str) {
- RETURN_FALSE;
- }
-
- RETURN_STRING(str, 1);
-}
-/* }}} */
-
-
-static int php_ini_get_option(zend_ini_entry *ini_entry, int num_args, va_list args, zend_hash_key *hash_key)
-{
- zval *ini_array = va_arg(args, zval *);
- int module_number = va_arg(args, int);
- zval *option;
-
- if (module_number != 0 && ini_entry->module_number != module_number) {
- return 0;
- }
-
- if (hash_key->nKeyLength == 0 || hash_key->arKey[0] != 0) {
-
- MAKE_STD_ZVAL(option);
- array_init(option);
-
- if (ini_entry->orig_value) {
- add_assoc_stringl(option, "global_value", ini_entry->orig_value, ini_entry->orig_value_length, 1);
- } else if (ini_entry->value) {
- add_assoc_stringl(option, "global_value", ini_entry->value, ini_entry->value_length, 1);
- } else {
- add_assoc_null(option, "global_value");
- }
-
- if (ini_entry->value) {
- add_assoc_stringl(option, "local_value", ini_entry->value, ini_entry->value_length, 1);
- } else {
- add_assoc_null(option, "local_value");
- }
-
- add_assoc_long(option, "access", ini_entry->modifyable);
-
- add_assoc_zval_ex(ini_array, ini_entry->name, ini_entry->name_length, option);
- }
- return 0;
-}
-
-/* {{{ proto array ini_get_all([string extension])
- Get all configuration options */
-PHP_FUNCTION(ini_get_all)
-{
- char *extname = NULL;
- int extname_len = 0, extnumber = 0;
- zend_module_entry *module;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &extname, &extname_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- zend_ini_sort_entries(TSRMLS_C);
-
- if (extname) {
- if (zend_hash_find(&module_registry, extname, extname_len+1, (void **) &module) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find extension '%s'", extname);
- RETURN_FALSE;
- }
- extnumber = module->module_number;
- }
-
- array_init(return_value);
- zend_hash_apply_with_arguments(EG(ini_directives), (apply_func_args_t) php_ini_get_option, 2, return_value, extnumber TSRMLS_CC);
-}
-/* }}} */
-
-static int php_ini_check_path(char *option_name, int option_len, char *new_option_name, int new_option_len)
-{
- if ( option_len != (new_option_len-1) ) {
- return 0;
- }
-
- return strncmp(option_name, new_option_name, option_len);
-}
-
-/* {{{ proto string ini_set(string varname, string newvalue)
- Set a configuration option, returns false on error and the old value of the configuration option on success */
-PHP_FUNCTION(ini_set)
-{
- pval **varname, **new_value;
- char *old_value;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &varname, &new_value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(varname);
- convert_to_string_ex(new_value);
-
- old_value = zend_ini_string(Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, 0);
-
- /* copy to return here, because alter might free it! */
- if (old_value) {
- RETVAL_STRING(old_value, 1);
- } else {
- RETVAL_FALSE;
- }
-
-#define _CHECK_PATH(var, ini) php_ini_check_path(Z_STRVAL_PP(var), Z_STRLEN_PP(var), ini, sizeof(ini))
-
- /* safe_mode & basedir check */
- if (PG(safe_mode) || PG(open_basedir)) {
- if (_CHECK_PATH(varname, "error_log") ||
- _CHECK_PATH(varname, "java.class.path") ||
- _CHECK_PATH(varname, "java.home") ||
- _CHECK_PATH(varname, "java.library.path") ||
- _CHECK_PATH(varname, "session.save_path") ||
- _CHECK_PATH(varname, "vpopmail.directory")) {
- if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(new_value), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- zval_dtor(return_value);
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(Z_STRVAL_PP(new_value) TSRMLS_CC)) {
- zval_dtor(return_value);
- RETURN_FALSE;
- }
- }
- }
-
- /* checks that ensure the user does not overwrite certain ini settings when safe_mode is enabled */
- if (PG(safe_mode)) {
- if (!strncmp("max_execution_time", Z_STRVAL_PP(varname), sizeof("max_execution_time")) ||
- !strncmp("memory_limit", Z_STRVAL_PP(varname), sizeof("memory_limit")) ||
- !strncmp("child_terminate", Z_STRVAL_PP(varname), sizeof("child_terminate"))) {
- zval_dtor(return_value);
- RETURN_FALSE;
- }
- }
-
- if (zend_alter_ini_entry(Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, Z_STRVAL_PP(new_value), Z_STRLEN_PP(new_value),
- PHP_INI_USER, PHP_INI_STAGE_RUNTIME) == FAILURE) {
- zval_dtor(return_value);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string ini_restore(string varname)
- Restore the value of a configuration option specified by varname */
-PHP_FUNCTION(ini_restore)
-{
- pval **varname;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &varname) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(varname);
-
- zend_restore_ini_entry(Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, PHP_INI_STAGE_RUNTIME);
-}
-/* }}} */
-
-/* {{{ proto string set_include_path(string varname, string newvalue)
- Sets the include_path configuration option */
-
-PHP_FUNCTION(set_include_path)
-{
- pval **new_value;
- char *old_value;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &new_value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(new_value);
- old_value = zend_ini_string("include_path", sizeof("include_path"), 0);
- /* copy to return here, because alter might free it! */
- if (old_value) {
- RETVAL_STRING(old_value, 1);
- } else {
- RETVAL_FALSE;
- }
- if (zend_alter_ini_entry("include_path", sizeof("include_path"),
- Z_STRVAL_PP(new_value), Z_STRLEN_PP(new_value),
- PHP_INI_USER, PHP_INI_STAGE_RUNTIME) == FAILURE) {
- zval_dtor(return_value);
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto string get_include_path()
- Get the current include_path configuration option */
-
-PHP_FUNCTION(get_include_path)
-{
- char *str;
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
- str = zend_ini_string("include_path", sizeof("include_path"), 0);
- if (str == NULL) {
- RETURN_FALSE;
- }
- RETURN_STRING(str, 1);
-}
-
-/* }}} */
-
-/* {{{ proto string restore_include_path()
- Restore the value of the include_path configuration option */
-
-PHP_FUNCTION(restore_include_path)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- zend_restore_ini_entry("include_path", sizeof("include_path"),
- PHP_INI_STAGE_RUNTIME);
-}
-
-/* }}} */
-
-/* {{{ proto bool print_r(mixed var [, bool return])
- Prints out or returns information about the specified variable */
-PHP_FUNCTION(print_r)
-{
- zval *var;
- zend_bool i = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &var, &i) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (i) {
- php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC);
- }
-
- zend_print_pval_r(var, 0 TSRMLS_CC);
-
- if (i) {
- php_ob_get_buffer (return_value TSRMLS_CC);
- php_end_ob_buffer (0, 0 TSRMLS_CC);
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* This should go back to PHP */
-
-/* {{{ proto int connection_aborted(void)
- Returns true if client disconnected */
-PHP_FUNCTION(connection_aborted)
-{
- RETURN_LONG(PG(connection_status) & PHP_CONNECTION_ABORTED);
-}
-/* }}} */
-
-/* {{{ proto int connection_status(void)
- Returns the connection status bitfield */
-PHP_FUNCTION(connection_status)
-{
- RETURN_LONG(PG(connection_status));
-}
-/* }}} */
-
-/* {{{ proto int ignore_user_abort(bool value)
- Set whether we want to ignore a user abort event or not */
-PHP_FUNCTION(ignore_user_abort)
-{
- pval **arg;
- int old_setting;
-
- old_setting = PG(ignore_user_abort);
- switch (ZEND_NUM_ARGS()) {
-
- case 0:
- break;
-
- case 1:
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(arg);
- zend_alter_ini_entry("ignore_user_abort", sizeof("ignore_user_abort"), Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- RETURN_LONG(old_setting);
-}
-/* }}} */
-
-#if HAVE_GETSERVBYNAME
-/* {{{ proto int getservbyname(string service, string protocol)
- Returns port associated with service. Protocol must be "tcp" or "udp" */
-PHP_FUNCTION(getservbyname)
-{
- pval **name, **proto;
- struct servent *serv;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &name, &proto) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(name);
- convert_to_string_ex(proto);
-
- serv = getservbyname(Z_STRVAL_PP(name), Z_STRVAL_PP(proto));
-
- if (serv == NULL) {
- RETURN_FALSE;
- }
-
- RETURN_LONG(ntohs(serv->s_port));
-}
-/* }}} */
-#endif
-
-#if HAVE_GETSERVBYPORT
-/* {{{ proto string getservbyport(int port, string protocol)
- Returns service name associated with port. Protocol must be "tcp" or "udp" */
-PHP_FUNCTION(getservbyport)
-{
- pval **port, **proto;
- struct servent *serv;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &port, &proto) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(port);
- convert_to_string_ex(proto);
-
- serv = getservbyport(htons((unsigned short) Z_LVAL_PP(port)), Z_STRVAL_PP(proto));
-
- if (serv == NULL) {
- RETURN_FALSE;
- }
-
- RETURN_STRING(serv->s_name, 1);
-}
-/* }}} */
-#endif
-
-#if HAVE_GETPROTOBYNAME
-/* {{{ proto int getprotobyname(string name)
- Returns protocol number associated with name as per /etc/protocols */
-PHP_FUNCTION(getprotobyname)
-{
- pval **name;
- struct protoent *ent;
-
- if (ZEND_NUM_ARGS() != 1
- || zend_get_parameters_ex(1, &name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(name);
-
- ent = getprotobyname(Z_STRVAL_PP(name));
-
- if (ent == NULL) {
- Z_LVAL_P(return_value) = -1;
- Z_TYPE_P(return_value) = IS_LONG;
- RETURN_FALSE;
- }
-
- RETURN_LONG(ent->p_proto);
-}
-/* }}} */
-#endif
-
-#if HAVE_GETPROTOBYNUMBER
-/* {{{ proto string getprotobynumber(int proto)
- Returns protocol name associated with protocol number proto */
-PHP_FUNCTION(getprotobynumber)
-{
- pval **proto;
- struct protoent *ent;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &proto) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(proto);
-
- ent = getprotobynumber(Z_LVAL_PP(proto));
-
- if (ent == NULL) {
- RETURN_FALSE;
- }
-
- RETURN_STRING(ent->p_name, 1);
-}
-/* }}} */
-#endif
-
-/* {{{ proto bool register_tick_function(string function_name [, mixed arg [, mixed ... ]])
- Registers a tick callback function */
-PHP_FUNCTION(register_tick_function)
-{
- user_tick_function_entry tick_fe;
- int i;
-
- tick_fe.calling = 0;
- tick_fe.arg_count = ZEND_NUM_ARGS();
-
- if (tick_fe.arg_count < 1) {
- WRONG_PARAM_COUNT;
- }
-
- tick_fe.arguments = (zval **) emalloc(sizeof(zval *) * tick_fe.arg_count);
-
- if (zend_get_parameters_array(ht, tick_fe.arg_count, tick_fe.arguments) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (Z_TYPE_P(tick_fe.arguments[0]) != IS_ARRAY)
- convert_to_string_ex(&tick_fe.arguments[0]);
-
- if (!BG(user_tick_functions)) {
- BG(user_tick_functions) = (zend_llist *) emalloc(sizeof(zend_llist));
- zend_llist_init(BG(user_tick_functions),
- sizeof(user_tick_function_entry),
- (llist_dtor_func_t) user_tick_function_dtor, 0);
- php_add_tick_function(run_user_tick_functions);
- }
-
- for (i = 0; i < tick_fe.arg_count; i++) {
- tick_fe.arguments[i]->refcount++;
- }
-
- zend_llist_add_element(BG(user_tick_functions), &tick_fe);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void unregister_tick_function(string function_name)
- Unregisters a tick callback function */
-PHP_FUNCTION(unregister_tick_function)
-{
- zval **function;
- user_tick_function_entry tick_fe;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &function)) {
- WRONG_PARAM_COUNT;
- }
-
- if (!BG(user_tick_functions)) {
- return;
- }
-
- if (Z_TYPE_PP(function) != IS_ARRAY) {
- convert_to_string_ex(function);
- }
-
- tick_fe.arguments = (zval **) emalloc(sizeof(zval *));
- tick_fe.arguments[0] = *function;
- tick_fe.arg_count = 1;
- zend_llist_del_element(BG(user_tick_functions), &tick_fe, (int (*)(void *, void *)) user_tick_function_compare);
- efree(tick_fe.arguments);
-}
-/* }}} */
-
-/* {{{ proto bool is_uploaded_file(string path)
- Check if file was created by rfc1867 upload */
-PHP_FUNCTION(is_uploaded_file)
-{
- zval **path;
-
- if (!SG(rfc1867_uploaded_files)) {
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &path) != SUCCESS) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(path);
-
- if (zend_hash_exists(SG(rfc1867_uploaded_files), Z_STRVAL_PP(path), Z_STRLEN_PP(path)+1)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool move_uploaded_file(string path, string new_path)
- Move a file if and only if it was created by an upload */
-PHP_FUNCTION(move_uploaded_file)
-{
- zval **path, **new_path;
- zend_bool successful = 0;
-
- if (!SG(rfc1867_uploaded_files)) {
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &path, &new_path) != SUCCESS) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(path);
- convert_to_string_ex(new_path);
-
- if (!zend_hash_exists(SG(rfc1867_uploaded_files), Z_STRVAL_PP(path), Z_STRLEN_PP(path)+1)) {
- RETURN_FALSE;
- }
-
- if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(new_path), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(Z_STRVAL_PP(new_path) TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- VCWD_UNLINK(Z_STRVAL_PP(new_path));
- if (rename(Z_STRVAL_PP(path), Z_STRVAL_PP(new_path)) == 0) {
- successful = 1;
- } else
- if (php_copy_file(Z_STRVAL_PP(path), Z_STRVAL_PP(new_path) TSRMLS_CC) == SUCCESS) {
- VCWD_UNLINK(Z_STRVAL_PP(path));
- successful = 1;
- }
-
- if (successful) {
- zend_hash_del(SG(rfc1867_uploaded_files), Z_STRVAL_PP(path), Z_STRLEN_PP(path)+1);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to move '%s' to '%s'", Z_STRVAL_PP(path), Z_STRVAL_PP(new_path));
- }
- RETURN_BOOL(successful);
-}
-/* }}} */
-
-
-static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, zval *arr)
-{
- zval *element;
-
- switch (callback_type) {
-
- case ZEND_INI_PARSER_ENTRY:
- if (!arg2) {
- /* bare string - nothing to do */
- break;
- }
- ALLOC_ZVAL(element);
- *element = *arg2;
- zval_copy_ctor(element);
- INIT_PZVAL(element);
- zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &element, sizeof(zval *), NULL);
- break;
-
- case ZEND_INI_PARSER_POP_ENTRY:
- {
- zval *hash, **find_hash;
-
- if (!arg2) {
- /* bare string - nothing to do */
- break;
- }
-
- if (zend_hash_find(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, (void **) &find_hash) == FAILURE) {
- ALLOC_ZVAL(hash);
- INIT_PZVAL(hash);
- array_init(hash);
-
- zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &hash, sizeof(zval *), NULL);
- } else {
- hash = *find_hash;
- }
-
- ALLOC_ZVAL(element);
- *element = *arg2;
- zval_copy_ctor(element);
- INIT_PZVAL(element);
- add_next_index_zval(hash, element);
- }
- break;
-
- case ZEND_INI_PARSER_SECTION:
- break;
- }
-}
-
-static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, int callback_type, zval *arr)
-{
- TSRMLS_FETCH();
-
- if (callback_type == ZEND_INI_PARSER_SECTION) {
- MAKE_STD_ZVAL(BG(active_ini_file_section));
- array_init(BG(active_ini_file_section));
- zend_hash_update( Z_ARRVAL_P(arr),
- Z_STRVAL_P(arg1),
- Z_STRLEN_P(arg1)+1,
- &BG(active_ini_file_section),
- sizeof(zval *), NULL);
- } else if (arg2) {
- zval *active_arr;
-
- if (BG(active_ini_file_section)) {
- active_arr = BG(active_ini_file_section);
- } else {
- active_arr = arr;
- }
-
- php_simple_ini_parser_cb(arg1, arg2, callback_type, active_arr);
- }
-}
-
-
-/* {{{ proto array parse_ini_file(string filename [, bool process_sections])
- Parse configuration file */
-PHP_FUNCTION(parse_ini_file)
-{
- zval **filename, **process_sections;
- zend_file_handle fh;
- zend_ini_parser_cb_t ini_parser_cb;
-
- switch (ZEND_NUM_ARGS()) {
-
- case 1:
- if (zend_get_parameters_ex(1, &filename) == FAILURE) {
- RETURN_FALSE;
- }
- ini_parser_cb = (zend_ini_parser_cb_t) php_simple_ini_parser_cb;
- break;
-
- case 2:
- if (zend_get_parameters_ex(2, &filename, &process_sections) == FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_boolean_ex(process_sections);
-
- if (Z_BVAL_PP(process_sections)) {
- BG(active_ini_file_section) = NULL;
- ini_parser_cb = (zend_ini_parser_cb_t) php_ini_parser_cb_with_sections;
- } else {
- ini_parser_cb = (zend_ini_parser_cb_t) php_simple_ini_parser_cb;
- }
- break;
-
- default:
- ZEND_WRONG_PARAM_COUNT();
- break;
- }
-
- convert_to_string_ex(filename);
-
- memset(&fh, 0, sizeof(fh));
- fh.filename = Z_STRVAL_PP(filename);
- Z_TYPE(fh) = ZEND_HANDLE_FILENAME;
-
- array_init(return_value);
- zend_parse_ini_file(&fh, 0, ini_parser_cb, return_value);
-}
-/* }}} */
-
-static int copy_request_variable(void *pDest, int num_args, va_list args, zend_hash_key *hash_key)
-{
- char *prefix, *new_key;
- uint prefix_len, new_key_len;
- zval **var = (zval **) pDest;
- TSRMLS_FETCH();
-
- if (num_args != 2) {
- return 0;
- }
-
- prefix = va_arg(args, char *);
- prefix_len = va_arg(args, uint);
-
- new_key_len = prefix_len + hash_key->nKeyLength;
- new_key = (char *) emalloc(new_key_len);
-
- memcpy(new_key, prefix, prefix_len);
- memcpy(new_key+prefix_len, hash_key->arKey, hash_key->nKeyLength);
-
- zend_hash_del(&EG(symbol_table), new_key, new_key_len);
- ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table), new_key, new_key_len, *var, (*var)->refcount+1, 0);
-
- efree(new_key);
- return 0;
-}
-
-/* {{{ proto bool import_request_variables(string types [, string prefix])
- Import GET/POST/Cookie variables into the global scope */
-PHP_FUNCTION(import_request_variables)
-{
- zval **z_types, **z_prefix;
- char *types, *prefix;
- uint prefix_len;
- char *p;
-
- switch (ZEND_NUM_ARGS()) {
-
- case 1:
- if (zend_get_parameters_ex(1, &z_types) == FAILURE) {
- RETURN_FALSE;
- }
- prefix = "";
- prefix_len = 0;
- break;
-
- case 2:
- if (zend_get_parameters_ex(2, &z_types, &z_prefix) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(z_prefix);
- prefix = Z_STRVAL_PP(z_prefix);
- prefix_len = Z_STRLEN_PP(z_prefix);
- break;
-
- default:
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (prefix_len == 0) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "No prefix specified - possible security hazard");
- }
-
- convert_to_string_ex(z_types);
- types = Z_STRVAL_PP(z_types);
-
- for (p = types; p && *p; p++) {
- switch (*p) {
-
- case 'g':
- case 'G':
- zend_hash_apply_with_arguments(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_GET]), (apply_func_args_t) copy_request_variable, 2, prefix, prefix_len);
- break;
-
- case 'p':
- case 'P':
- zend_hash_apply_with_arguments(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_POST]), (apply_func_args_t) copy_request_variable, 2, prefix, prefix_len);
- zend_hash_apply_with_arguments(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_FILES]), (apply_func_args_t) copy_request_variable, 2, prefix, prefix_len);
- break;
-
- case 'c':
- case 'C':
- zend_hash_apply_with_arguments(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]), (apply_func_args_t) copy_request_variable, 2, prefix, prefix_len);
- break;
- }
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
-
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
deleted file mode 100644
index 037420c703..0000000000
--- a/ext/standard/basic_functions.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef BASIC_FUNCTIONS_H
-#define BASIC_FUNCTIONS_H
-
-#include <sys/stat.h>
-
-#include "zend_highlight.h"
-
-#include "url_scanner.h"
-#include "url_scanner_ex.h"
-
-extern zend_module_entry basic_functions_module;
-#define basic_functions_module_ptr &basic_functions_module
-
-PHP_MINIT_FUNCTION(basic);
-PHP_MSHUTDOWN_FUNCTION(basic);
-PHP_RINIT_FUNCTION(basic);
-PHP_RSHUTDOWN_FUNCTION(basic);
-PHP_MINFO_FUNCTION(basic);
-
-PHP_FUNCTION(constant);
-PHP_FUNCTION(toggle_short_open_tag);
-PHP_FUNCTION(sleep);
-PHP_FUNCTION(usleep);
-PHP_FUNCTION(flush);
-PHP_FUNCTION(ip2long);
-PHP_FUNCTION(long2ip);
-
-/* system functions */
-PHP_FUNCTION(getenv);
-PHP_FUNCTION(putenv);
-
-PHP_FUNCTION(getopt);
-
-PHP_FUNCTION(get_current_user);
-PHP_FUNCTION(set_time_limit);
-
-PHP_FUNCTION(get_cfg_var);
-PHP_FUNCTION(set_magic_quotes_runtime);
-PHP_FUNCTION(get_magic_quotes_runtime);
-PHP_FUNCTION(get_magic_quotes_gpc);
-
-PHP_FUNCTION(import_request_variables);
-
-PHP_FUNCTION(error_log);
-
-PHP_FUNCTION(call_user_func);
-PHP_FUNCTION(call_user_func_array);
-PHP_FUNCTION(call_user_method);
-PHP_FUNCTION(call_user_method_array);
-
-PHP_FUNCTION(register_shutdown_function);
-PHP_FUNCTION(highlight_file);
-PHP_FUNCTION(highlight_string);
-ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini);
-
-PHP_FUNCTION(ini_get);
-PHP_FUNCTION(ini_get_all);
-PHP_FUNCTION(ini_set);
-PHP_FUNCTION(ini_restore);
-PHP_FUNCTION(get_include_path);
-PHP_FUNCTION(set_include_path);
-PHP_FUNCTION(restore_include_path);
-
-PHP_FUNCTION(print_r);
-PHP_FUNCTION(fprintf);
-PHP_FUNCTION(vfprintf);
-
-PHP_FUNCTION(connection_aborted);
-PHP_FUNCTION(connection_status);
-PHP_FUNCTION(ignore_user_abort);
-
-PHP_FUNCTION(getservbyname);
-PHP_FUNCTION(getservbyport);
-PHP_FUNCTION(getprotobyname);
-PHP_FUNCTION(getprotobynumber);
-
-PHP_NAMED_FUNCTION(php_if_crc32);
-
-PHP_FUNCTION(register_tick_function);
-PHP_FUNCTION(unregister_tick_function);
-
-PHP_FUNCTION(is_uploaded_file);
-PHP_FUNCTION(move_uploaded_file);
-
-/* From the INI parser */
-PHP_FUNCTION(parse_ini_file);
-
-PHP_FUNCTION(str_rot13);
-PHP_FUNCTION(stream_get_filters);
-PHP_FUNCTION(stream_register_filter);
-PHP_FUNCTION(stream_bucket_make_writeable);
-PHP_FUNCTION(stream_bucket_prepend);
-PHP_FUNCTION(stream_bucket_append);
-PHP_FUNCTION(stream_bucket_new);
-PHP_MINIT_FUNCTION(user_filters);
-
-#ifdef PHP_WIN32
-typedef unsigned int php_stat_len;
-#else
-typedef int php_stat_len;
-#endif
-
-PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers TSRMLS_DC);
-
-#if SIZEOF_INT == 4
-/* Most 32-bit and 64-bit systems have 32-bit ints */
-typedef unsigned int php_uint32;
-typedef signed int php_int32;
-#elif SIZEOF_LONG == 4
-/* 16-bit systems? */
-typedef unsigned long php_uint32;
-typedef signed int php_int32;
-#else
-#error Need type which holds 32 bits
-#endif
-
-#define MT_N (624)
-
-typedef struct {
- HashTable *user_shutdown_function_names;
- HashTable putenv_ht;
- zval *strtok_zval;
- char *strtok_string;
- char *locale_string;
- char *strtok_last;
- char strtok_table[256];
- ulong strtok_len;
- char str_ebuf[40];
- zval **array_walk_func_name;
- zval **user_compare_func_name;
- zend_llist *user_tick_functions;
-
- zval *active_ini_file_section;
-
- HashTable sm_protected_env_vars;
- char *sm_allowed_env_vars;
-
- /* pageinfo.c */
- long page_uid;
- long page_gid;
- long page_inode;
- long page_mtime;
-
- /* filestat.c */
- char *CurrentStatFile;
- php_stat_len CurrentStatLength;
- struct stat sb;
- struct stat lsb;
-
- /* rand.c */
- php_uint32 state[MT_N+1]; /* state vector + 1 extra to not violate ANSI C */
- php_uint32 *next; /* next random value is computed from here */
- int left; /* can *next++ this many times before reloading */
-
- unsigned int rand_seed; /* Seed for rand(), in ts version */
-
- zend_bool rand_is_seeded; /* Whether rand() has been seeded */
- zend_bool mt_rand_is_seeded; /* Whether mt_rand() has been seeded */
-
- /* syslog.c */
- int syslog_started;
- char *syslog_device;
-
- /* var.c */
- zend_class_entry *incomplete_class;
-
- /* url_scanner.c */
- url_adapt_state_t url_adapt_state;
- /* url_scanner_ex.re */
- url_adapt_state_ex_t url_adapt_state_ex;
-
-#ifdef HAVE_MMAP
- void *mmap_file;
- size_t mmap_len;
-#endif
-
- HashTable *aggregation_table;
- HashTable *user_filter_map;
-} php_basic_globals;
-
-#ifdef ZTS
-#define BG(v) TSRMG(basic_globals_id, php_basic_globals *, v)
-extern int basic_globals_id;
-#else
-#define BG(v) (basic_globals.v)
-extern php_basic_globals basic_globals;
-#endif
-
-#if HAVE_PUTENV
-typedef struct {
- char *putenv_string;
- char *previous_value;
- char *key;
- int key_len;
-} putenv_entry;
-#endif
-
-/* Values are comma-delimited
- */
-#define SAFE_MODE_PROTECTED_ENV_VARS "LD_LIBRARY_PATH"
-#define SAFE_MODE_ALLOWED_ENV_VARS "PHP_"
-
-#endif /* BASIC_FUNCTIONS_H */
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
deleted file mode 100644
index e1a398f942..0000000000
--- a/ext/standard/browscap.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_regex.h"
-#include "php_browscap.h"
-#include "php_ini.h"
-
-#include "zend_globals.h"
-
-static HashTable browser_hash;
-static zval *current_section;
-
-#define DEFAULT_SECTION_NAME "Default Browser Capability Settings"
-
-/* OBJECTS_FIXME: This whole extension needs going through. The use of objects looks pretty broken here */
-
-static void browscap_entry_dtor(zval *pvalue)
-{
- if (Z_TYPE_P(pvalue) == IS_ARRAY) {
- zend_hash_destroy(Z_ARRVAL_P(pvalue));
- free(Z_ARRVAL_P(pvalue));
- }
-}
-
-/* {{{ convert_browscap_pattern
- */
-static void convert_browscap_pattern(zval *pattern)
-{
- register int i, j;
- char *t;
-
- t = (char *) malloc(Z_STRLEN_P(pattern)*2 + 3);
- t[0] = '^';
-
- for (i=0, j=1; i<Z_STRLEN_P(pattern); i++, j++) {
- switch (Z_STRVAL_P(pattern)[i]) {
- case '?':
- t[j] = '.';
- break;
- case '*':
- t[j++] = '.';
- t[j] = '*';
- break;
- case '.':
- t[j++] = '\\';
- t[j] = '.';
- break;
- default:
- t[j] = Z_STRVAL_P(pattern)[i];
- break;
- }
- }
-
- if (j && (t[j-1] == '.')) {
- t[j++] = '*';
- }
-
- t[j++]='$';
- t[j]=0;
- Z_STRVAL_P(pattern) = t;
- Z_STRLEN_P(pattern) = j;
-}
-/* }}} */
-
-/* {{{ php_browscap_parser_cb
- */
-static void php_browscap_parser_cb(zval *arg1, zval *arg2, int callback_type, void *arg)
-{
- if (!arg1) {
- return;
- }
-
- switch (callback_type) {
- case ZEND_INI_PARSER_ENTRY:
- if (current_section && arg2) {
- zval *new_property;
- char *new_key;
-
- new_property = (zval *) malloc(sizeof(zval));
- INIT_PZVAL(new_property);
- Z_STRVAL_P(new_property) = Z_STRLEN_P(arg2)?zend_strndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)):"";
- Z_STRLEN_P(new_property) = Z_STRLEN_P(arg2);
- Z_TYPE_P(new_property) = IS_STRING;
-
- new_key = zend_strndup(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1));
- zend_str_tolower(new_key, Z_STRLEN_P(arg1));
- zend_hash_update(Z_ARRVAL_P(current_section), new_key, Z_STRLEN_P(arg1)+1, &new_property, sizeof(zval *), NULL);
- free(new_key);
- }
- break;
- case ZEND_INI_PARSER_SECTION: {
- zval *processed;
- zval *unprocessed;
- HashTable *section_properties;
-
- /*printf("'%s' (%d)\n",$1.value.str.val,$1.value.str.len+1);*/
- current_section = (zval *) malloc(sizeof(zval));
- INIT_PZVAL(current_section);
- processed = (zval *) malloc(sizeof(zval));
- INIT_PZVAL(processed);
- unprocessed = (zval *) malloc(sizeof(zval));
- INIT_PZVAL(unprocessed);
-
- section_properties = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init(section_properties, 0, NULL, (dtor_func_t) browscap_entry_dtor, 1);
- current_section->value.ht = section_properties;
- zend_hash_update(&browser_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, (void *) &current_section, sizeof(zval *), NULL);
-
- Z_STRVAL_P(processed) = Z_STRVAL_P(arg1);
- Z_STRLEN_P(processed) = Z_STRLEN_P(arg1);
- Z_TYPE_P(processed) = IS_STRING;
- Z_STRVAL_P(unprocessed) = Z_STRVAL_P(arg1);
- Z_STRLEN_P(unprocessed) = Z_STRLEN_P(arg1);
- Z_TYPE_P(unprocessed) = IS_STRING;
- Z_STRVAL_P(unprocessed) = zend_strndup(Z_STRVAL_P(unprocessed), Z_STRLEN_P(unprocessed));
-
- convert_browscap_pattern(processed);
- zend_hash_update(section_properties, "browser_name_regex", sizeof("browser_name_regex"), (void *) &processed, sizeof(zval *), NULL);
- zend_hash_update(section_properties, "browser_name_pattern", sizeof("browser_name_pattern"), (void *) &unprocessed, sizeof(zval *), NULL);
- }
- break;
- }
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(browscap)
-{
- char *browscap = INI_STR("browscap");
-
- if (browscap) {
- zend_file_handle fh;
- memset(&fh, 0, sizeof(fh));
-
- if (zend_hash_init(&browser_hash, 0, NULL, (dtor_func_t) browscap_entry_dtor, 1)==FAILURE) {
- return FAILURE;
- }
-
- fh.handle.fp = VCWD_FOPEN(browscap, "r");
- if (!fh.handle.fp) {
- php_error_docref(NULL TSRMLS_CC, E_CORE_WARNING, "Cannot open '%s' for reading", browscap);
- return FAILURE;
- }
- fh.filename = browscap;
- Z_TYPE(fh) = ZEND_HANDLE_FP;
- zend_parse_ini_file(&fh, 1, (zend_ini_parser_cb_t) php_browscap_parser_cb, &browser_hash);
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(browscap)
-{
- if (INI_STR("browscap")) {
- zend_hash_destroy(&browser_hash);
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ browser_reg_compare
- */
-static int browser_reg_compare(zval **browser, int num_args, va_list args, zend_hash_key *key)
-{
- zval **browser_name;
- regex_t r;
- char *lookup_browser_name = va_arg(args, char *);
- zval **found_browser_entry = va_arg(args, zval **);
-
- if (*found_browser_entry) { /* already found */
- return 0;
- }
- if (zend_hash_find(Z_ARRVAL_PP(browser), "browser_name_regex", sizeof("browser_name_regex"), (void **) &browser_name) == FAILURE) {
- return 0;
- }
- if (Z_STRVAL_PP(browser_name)[0] != '^') {
- return 0;
- }
- if (regcomp(&r, Z_STRVAL_PP(browser_name), REG_NOSUB)!=0) {
- return 0;
- }
- if (regexec(&r, lookup_browser_name, 0, NULL, 0)==0) {
- *found_browser_entry = *browser;
- }
- regfree(&r);
- return 0;
-}
-/* }}} */
-
-/* {{{ proto mixed get_browser([string browser_name [, bool return_array]])
- Get information about the capabilities of a browser. If browser_name is omitted
- or null, HTTP_USER_AGENT is used. Returns an object by default; if return_array
- is true, returns an array. */
-PHP_FUNCTION(get_browser)
-{
- zval **agent_name = NULL, **agent, **retarr;
- zval *found_browser_entry, *tmp_copy;
- char *lookup_browser_name;
- zend_bool return_array = 0;
-
- if (!INI_STR("browscap")) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "browscap ini directive not set.");
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() > 2 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &agent_name, &retarr) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (agent_name == NULL || Z_TYPE_PP(agent_name) == IS_NULL) {
- zend_is_auto_global("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC);
- if (!PG(http_globals)[TRACK_VARS_SERVER]
- || zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT"), (void **) &agent_name)==FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "HTTP_USER_AGENT variable is not set, cannot determine user agent name");
- RETURN_FALSE;
- }
- }
-
- convert_to_string_ex(agent_name);
-
- if (ZEND_NUM_ARGS() == 2) {
- convert_to_boolean_ex(retarr);
- return_array = Z_LVAL_PP(retarr);
- }
-
- if (zend_hash_find(&browser_hash, Z_STRVAL_PP(agent_name), Z_STRLEN_PP(agent_name)+1, (void **) &agent)==FAILURE) {
- lookup_browser_name = Z_STRVAL_PP(agent_name);
- found_browser_entry = NULL;
- zend_hash_apply_with_arguments(&browser_hash, (apply_func_args_t) browser_reg_compare, 2, lookup_browser_name, &found_browser_entry);
-
- if (found_browser_entry) {
- agent = &found_browser_entry;
- } else if (zend_hash_find(&browser_hash, DEFAULT_SECTION_NAME, sizeof(DEFAULT_SECTION_NAME), (void **) &agent)==FAILURE) {
- RETURN_FALSE;
- }
- }
-
- if (return_array) {
- array_init(return_value);
- zend_hash_copy(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
- }
- else {
- object_init(return_value);
- zend_hash_copy(Z_OBJPROP_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
- }
-
- while (zend_hash_find(Z_ARRVAL_PP(agent), "parent", sizeof("parent"), (void **) &agent_name)==SUCCESS) {
- if (zend_hash_find(&browser_hash, Z_STRVAL_PP(agent_name), Z_STRLEN_PP(agent_name)+1, (void **)&agent)==FAILURE) {
- break;
- }
-
- if (return_array) {
- zend_hash_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *), 0);
- }
- else {
- zend_hash_merge(Z_OBJPROP_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *), 0);
- }
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
deleted file mode 100644
index ca333157b2..0000000000
--- a/ext/standard/config.m4
+++ /dev/null
@@ -1,289 +0,0 @@
-dnl $Id$ -*- sh -*-
-
-divert(3)dnl
-
-dnl
-dnl Check if flush should be called explicitly after buffered io
-dnl
-AC_DEFUN(AC_FLUSH_IO,[
- AC_CACHE_CHECK([whether flush should be called explicitly after a buffered io], ac_cv_flush_io,[
- AC_TRY_RUN( [
-#include <stdio.h>
-#include <stdlib.h>
-
-int main(int argc, char **argv)
-{
- char *filename = tmpnam(NULL);
- char buffer[64];
- int result = 0;
-
- FILE *fp = fopen(filename, "wb");
- if (NULL == fp)
- return 0;
- fputs("line 1\n", fp);
- fputs("line 2\n", fp);
- fclose(fp);
-
- fp = fopen(filename, "rb+");
- if (NULL == fp)
- return 0;
- fgets(buffer, sizeof(buffer), fp);
- fputs("line 3\n", fp);
- rewind(fp);
- fgets(buffer, sizeof(buffer), fp);
- if (0 != strcmp(buffer, "line 1\n"))
- result = 1;
- fgets(buffer, sizeof(buffer), fp);
- if (0 != strcmp(buffer, "line 3\n"))
- result = 1;
- fclose(fp);
- unlink(filename);
-
- exit(result);
-}
-],[
- ac_cv_flush_io=no
-],[
- ac_cv_flush_io=yes
-],[
- ac_cv_flush_io=no
-])])
- if test "$ac_cv_flush_io" = "yes"; then
- AC_DEFINE(HAVE_FLUSHIO, 1, [Define if flush should be called explicitly after a buffered io.])
- fi
-])
-
-dnl
-dnl Check for crypt() capabilities
-dnl
-AC_DEFUN(AC_CRYPT_CAP,[
-
- if test "$ac_cv_func_crypt" = "no"; then
- AC_CHECK_LIB(crypt, crypt, [
- LIBS="-lcrypt $LIBS -lcrypt"
- AC_DEFINE(HAVE_CRYPT, 1, [ ])
- ])
- fi
-
- AC_CACHE_CHECK(for standard DES crypt, ac_cv_crypt_des,[
- AC_TRY_RUN([
-#if HAVE_CRYPT_H
-#include <crypt.h>
-#endif
-
-main() {
-#if HAVE_CRYPT
- exit (strcmp((char *)crypt("rasmuslerdorf","rl"),"rl.3StKT.4T8M"));
-#else
- exit(0);
-#endif
-}],[
- ac_cv_crypt_des=yes
- ],[
- ac_cv_crypt_des=no
- ],[
- ac_cv_crypt_des=yes
- ])
- ])
- if test "$ac_cv_crypt_des" = "yes"; then
- ac_result=1
- else
- ac_result=0
- fi
- AC_DEFINE_UNQUOTED(PHP_STD_DES_CRYPT, $ac_result, [Whether the system supports standard DES salt])
-
- AC_CACHE_CHECK(for extended DES crypt, ac_cv_crypt_ext_des,[
- AC_TRY_RUN([
-#if HAVE_CRYPT_H
-#include <crypt.h>
-#endif
-
-main() {
-#if HAVE_CRYPT
- exit (strcmp((char *)crypt("rasmuslerdorf","_J9..rasm"),"_J9..rasmBYk8r9AiWNc"));
-#else
- exit(0);
-#endif
-}],[
- ac_cv_crypt_ext_des=yes
- ],[
- ac_cv_crypt_ext_des=no
- ],[
- ac_cv_crypt_ext_des=no
- ])
- ])
- if test "$ac_cv_crypt_ext_des" = "yes"; then
- ac_result=1
- else
- ac_result=0
- fi
- AC_DEFINE_UNQUOTED(PHP_EXT_DES_CRYPT, $ac_result, [Whether the system supports extended DES salt])
-
- AC_CACHE_CHECK(for MD5 crypt, ac_cv_crypt_md5,[
- AC_TRY_RUN([
-#if HAVE_CRYPT_H
-#include <crypt.h>
-#endif
-
-main() {
-#if HAVE_CRYPT
- char salt[15], answer[40];
-
- salt[0]='$'; salt[1]='1'; salt[2]='$';
- salt[3]='r'; salt[4]='a'; salt[5]='s';
- salt[6]='m'; salt[7]='u'; salt[8]='s';
- salt[9]='l'; salt[10]='e'; salt[11]='$';
- salt[12]='\0';
- strcpy(answer,salt);
- strcat(answer,"rISCgZzpwk3UhDidwXvin0");
- exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
-#else
- exit(0);
-#endif
-}],[
- ac_cv_crypt_md5=yes
- ],[
- ac_cv_crypt_md5=no
- ],[
- ac_cv_crypt_md5=no
- ])
- ])
- if test "$ac_cv_crypt_md5" = "yes"; then
- ac_result=1
- else
- if test "$ac_cv_crypt_des" != "yes"; then
- PHP_DEBUG_MACRO(debug.log)
- fi
- ac_result=0
- fi
- AC_DEFINE_UNQUOTED(PHP_MD5_CRYPT, $ac_result, [Whether the system supports MD5 salt])
-
- AC_CACHE_CHECK(for Blowfish crypt, ac_cv_crypt_blowfish,[
- AC_TRY_RUN([
-#if HAVE_CRYPT_H
-#include <crypt.h>
-#endif
-
-main() {
-#if HAVE_CRYPT
- char salt[30], answer[70];
-
- salt[0]='$'; salt[1]='2'; salt[2]='a'; salt[3]='$'; salt[4]='0'; salt[5]='7'; salt[6]='$'; salt[7]='\0';
- strcat(salt,"rasmuslerd............");
- strcpy(answer,salt);
- strcpy(&answer[29],"nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra");
- exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
-#else
- exit(0);
-#endif
-}],[
- ac_cv_crypt_blowfish=yes
- ],[
- ac_cv_crypt_blowfish=no
- ],[
- ac_cv_crypt_blowfish=no
- ])
- ])
- if test "$ac_cv_crypt_blowfish" = "yes"; then
- ac_result=1
- else
- ac_result=0
- fi
- AC_DEFINE_UNQUOTED(PHP_BLOWFISH_CRYPT, $ac_result, [Whether the system supports BlowFish salt])
-])
-
-AC_CHECK_FUNCS(getcwd getwd asinh acosh atanh log1p hypot)
-
-AC_CRYPT_CAP
-AC_FLUSH_IO
-
-divert(5)dnl
-
-AC_ARG_WITH(regex,
-[ --with-regex=TYPE regex library type: system, apache, php. Default: php
- WARNING: Do NOT use unless you know what you are doing!],
-[
- case $withval in
- system)
- if test "$PHP_SAPI" = "apache" || test "$PHP_SAPI" = "apache2filter"; then
- REGEX_TYPE=php
- else
- REGEX_TYPE=system
- fi
- ;;
- apache)
- REGEX_TYPE=apache
- ;;
- php)
- REGEX_TYPE=php
- ;;
- *)
- REGEX_TYPE=php
- AC_MSG_WARN(Invalid regex library type. Using default value: php)
- ;;
- esac
-],[
- REGEX_TYPE=php
-])
-
-AC_FUNC_FNMATCH
-
-dnl Take a look and see if there is a support means of creating a new process
-dnl and defining which handles it receives
-AC_DEFUN([PHP_CHECK_IF_SUPPORT_PROC_OPEN],[
-
- AC_CACHE_VAL(php_can_support_proc_open,[
- AC_CHECK_FUNCS(fork CreateProcess, [
- php_can_support_proc_open=yes
- break
- ],[
- php_can_support_proc_open=no
- ])
- ])
-
- AC_MSG_CHECKING([if your OS can spawn processes with inherited handles])
- if test "$php_can_support_proc_open" = "yes"; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(PHP_CAN_SUPPORT_PROC_OPEN,1, [Define if your system has fork/vfork/CreateProcess])
- else
- AC_MSG_RESULT(no)
- fi
-
-])
-
-PHP_CHECK_IF_SUPPORT_PROC_OPEN
-
-dnl getopt long options disabled for now
-dnl as we can't be sure that we get the right getopt.h here
-dnl using the standard AC_CHECK macros
-dnl AC_CHECK_HEADERS(getopt.h)
-dnl AC_CHECK_FUNCS(getopt_long getopt_long_only)
-
-AC_CHECK_FUNCS(glob strfmon nice)
-
-if test "$PHP_SAPI" = "cgi" -o "$PHP_SAPI" = "cli" -o "$PHP_SAPI" = "embed"; then
- AC_DEFINE(ENABLE_CHROOT_FUNC, 1, [Whether to enable chroot() function])
-fi
-
-dnl
-dnl Detect library functions needed by php dns_xxx functions
-dnl ext/standard/dns.h will collect these in a single define: HAVE_DNS_FUNCS
-dnl
-PHP_CHECK_FUNC(res_nmkquery, resolv, bind, socket)
-PHP_CHECK_FUNC(res_nsend, resolv, bind, socket)
-PHP_CHECK_FUNC(dn_expand, resolv, bind, socket)
-dnl already done PHP_CHECK_FUNC(dn_skipname, resolv, bind, socket)
-
-PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.c crypt.c \
- cyr_convert.c datetime.c dir.c dl.c dns.c exec.c file.c filestat.c \
- flock_compat.c formatted_print.c fsock.c head.c html.c image.c \
- info.c iptc.c lcg.c link.c mail.c math.c md5.c metaphone.c \
- microtime.c pack.c pageinfo.c parsedate.c quot_print.c rand.c \
- reg.c soundex.c string.c scanf.c syslog.c type.c uniqid.c url.c \
- url_scanner.c var.c versioning.c assert.c strnatcmp.c levenshtein.c \
- incomplete_class.c url_scanner_ex.c ftp_fopen_wrapper.c \
- http_fopen_wrapper.c php_fopen_wrapper.c credits.c css.c \
- var_unserializer.c ftok.c aggregation.c sha1.c user_filters.c \
- filters.c proc_open.c sunfuncs.c streamsfuncs.c)
-
-PHP_ADD_MAKEFILE_FRAGMENT
diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c
deleted file mode 100644
index c36dc068c4..0000000000
--- a/ext/standard/crc32.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "basic_functions.h"
-#include "crc32.h"
-
-/* {{{ proto string crc32(string str)
- Calculate the crc32 polynomial of a string */
-PHP_NAMED_FUNCTION(php_if_crc32)
-{
- unsigned int crc = ~0;
- char *p;
- int len, nr;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &p, &nr) == FAILURE) {
- return;
- }
-
- len = 0 ;
- for (len += nr; nr--; ++p) {
- CRC32(crc, *p);
- }
- RETVAL_LONG(~crc);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/crc32.h b/ext/standard/crc32.h
deleted file mode 100644
index f1dad697ac..0000000000
--- a/ext/standard/crc32.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- * This code implements the AUTODIN II polynomial
- * The variable corresponding to the macro argument "crc" should
- * be an unsigned long.
- * Oroginal code by Spencer Garrett <srg@quick.com>
- */
-
-#define CRC32(crc, ch) (crc = (crc >> 8) ^ crc32tab[(crc ^ (ch)) & 0xff])
-
-/* generated using the AUTODIN II polynomial
- * x^32 + x^26 + x^23 + x^22 + x^16 +
- * x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + 1
- */
-
-static const unsigned int crc32tab[256] = {
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
- 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
- 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
- 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
- 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
- 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
- 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
- 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
- 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
- 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
- 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
- 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
- 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
- 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
- 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
- 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
- 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
- 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
- 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
- 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
- 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
- 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
- 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
- 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
- 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
- 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
- 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
- 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
- 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
- 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
- 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
- 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
- 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
- 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
- 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
- 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
- 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
- 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
- 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
- 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
- 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
- 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
- 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
- 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
- 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
- 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
- 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
- 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
- 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
- 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
- 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
- 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
- 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
- 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
- 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
- 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
- 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
- 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
- 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
- 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/credits.c b/ext/standard/credits.c
deleted file mode 100644
index 6eaf65e72d..0000000000
--- a/ext/standard/credits.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "info.h"
-
-#define CREDIT_LINE(module, authors) php_info_print_table_row(2, module, authors)
-
-/* {{{ php_print_credits
- */
-PHPAPI void php_print_credits(int flag TSRMLS_DC)
-{
- if (flag & PHP_CREDITS_FULLPAGE) {
- php_print_info_htmlhead(TSRMLS_C);
- }
-
- PUTS("<h1>PHP Credits</h1>\n");
-
- if (flag & PHP_CREDITS_GROUP) {
- /* Group */
-
- php_info_print_table_start();
- php_info_print_table_header(1, "PHP Group");
- php_info_print_table_row(1, "Thies C. Arntzen, Stig Bakken, Shane Caraveo, Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski");
- php_info_print_table_end();
- }
-
- if (flag & PHP_CREDITS_GENERAL) {
- /* Design & Concept */
- php_info_print_table_start();
- php_info_print_table_header(1, "Language Design & Concept");
- php_info_print_table_row(1, "Andi Gutmans, Rasmus Lerdorf, Zeev Suraski");
- php_info_print_table_end();
-
- /* PHP 4 Language */
- php_info_print_table_start();
- php_info_print_table_colspan_header(2, "PHP 4 Authors");
- php_info_print_table_header(2, "Contribution", "Authors");
- CREDIT_LINE("Zend Scripting Language Engine", "Andi Gutmans, Zeev Suraski");
- CREDIT_LINE("Extension Module API", "Andi Gutmans, Zeev Suraski, Andrei Zmievski");
- CREDIT_LINE("UNIX Build and Modularization", "Stig Bakken, Sascha Schumann");
- CREDIT_LINE("Win32 Port", "Shane Caraveo, Zeev Suraski");
- CREDIT_LINE("Server API (SAPI) Abstraction Layer", "Andi Gutmans, Shane Caraveo, Zeev Suraski");
- CREDIT_LINE("Streams Abstraction Layer", "Wez Furlong");
- php_info_print_table_end();
- }
-
- if (flag & PHP_CREDITS_SAPI) {
- /* SAPI Modules */
-
- php_info_print_table_start();
- php_info_print_table_colspan_header(2, "SAPI Modules");
- php_info_print_table_header(2, "Contribution", "Authors");
-#include "credits_sapi.h"
- php_info_print_table_end();
- }
-
- if (flag & PHP_CREDITS_MODULES) {
- /* Modules */
-
- php_info_print_table_start();
- php_info_print_table_colspan_header(2, "Module Authors");
- php_info_print_table_header(2, "Module", "Authors");
-#include "credits_ext.h"
- php_info_print_table_end();
- }
-
- if (flag & PHP_CREDITS_DOCS) {
- php_info_print_table_start();
- php_info_print_table_header(1, "PHP Documentation Team");
- php_info_print_table_row(1, "Jouni Ahto, Alexander Aulbach, Stig Bakken, Rasmus Lerdorf, Egon Schmid, Lars Torben Wilson, Jim Winstead");
- php_info_print_table_row(1, "Edited by: Stig Bakken and Egon Schmid");
- php_info_print_table_end();
- }
-
- if (flag & PHP_CREDITS_QA) {
- php_info_print_table_start();
- php_info_print_table_header(1, "PHP 5.0 Quality Assurance Team");
- php_info_print_table_row(1, "Ilia Alshanetsky, Joerg Behrens, Stefan Esser, Moriyoshi Koizumi, Magnus Maatta, Sebastian Nohn, Derick Rethans, Melvyn Sopacua, Jani Taskinen");
- php_info_print_table_end();
- }
-
- if (flag & PHP_CREDITS_WEB) {
- /* Website Team */
- php_info_print_table_start();
- php_info_print_table_header(1, "PHP Website Team");
- php_info_print_table_row(1, "Gabor Hojtsy, Colin Viebrock, Jim Winstead");
- php_info_print_table_end();
- }
-
- if (flag & PHP_CREDITS_FULLPAGE) {
- PUTS("</center></body></html>\n");
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/credits.h b/ext/standard/credits.h
deleted file mode 100644
index 9e0cb97bb4..0000000000
--- a/ext/standard/credits.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef CREDITS_H
-#define CREDITS_H
-
-#ifndef HAVE_CREDITS_DEFS
-#define HAVE_CREDITS_DEFS
-
-#define PHP_CREDITS_GROUP (1<<0)
-#define PHP_CREDITS_GENERAL (1<<1)
-#define PHP_CREDITS_SAPI (1<<2)
-#define PHP_CREDITS_MODULES (1<<3)
-#define PHP_CREDITS_DOCS (1<<4)
-#define PHP_CREDITS_FULLPAGE (1<<5)
-#define PHP_CREDITS_QA (1<<6)
-#define PHP_CREDITS_WEB (1<<7)
-#define PHP_CREDITS_ALL 0xFFFFFFFF
-
-#endif /* HAVE_CREDITS_DEFS */
-
-PHPAPI void php_print_credits(int flag TSRMLS_DC);
-
-#endif
diff --git a/ext/standard/credits_ext.h b/ext/standard/credits_ext.h
deleted file mode 100644
index 8300c0d05d..0000000000
--- a/ext/standard/credits_ext.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- DO NOT EDIT THIS FILE!
-
- it has been automaticaly created by php4/scripts/credits from
- the information found in the various php4/ext/.../CREDITS and
- php4/sapi/.../CREDITS files
-
- if you want to change an entry you have to edit the appropriate
- CREDITS file instead
-
-*/
-
-CREDIT_LINE("Assert", "Thies C. Arntzen");
-CREDIT_LINE("BC Math", "Andi Gutmans");
-CREDIT_LINE("Bzip2", "Sterling Hughes");
-CREDIT_LINE("Calendar", "Shane Caraveo, Colin Viebrock, Hartmut Holzgraefe, Wez Furlong");
-CREDIT_LINE("cpdf", "Uwe Steinmann");
-CREDIT_LINE("crack", "Alexander Feldman");
-CREDIT_LINE("ctype", "Hartmut Holzgraefe");
-CREDIT_LINE("cURL", "Sterling Hughes");
-CREDIT_LINE("Cyrus", "Sterling Hughes");
-CREDIT_LINE("DBA", "Sascha Schumann, Marcus Boerger");
-CREDIT_LINE("dBase", "Jim Winstead");
-CREDIT_LINE("DBM", "Rasmus Lerdorf, Jim Winstead");
-CREDIT_LINE("dbx (database abstraction)", "Marc Boeren, Rui Hirokawa, Frank M. Kromann");
-CREDIT_LINE("domxml", "Uwe Steinmann, Christian Stocker");
-CREDIT_LINE("dotnet", "Sam Ruby");
-CREDIT_LINE("EXIF", "Rasmus Lerdorf, Marcus Boerger");
-CREDIT_LINE("fam", "Sascha Schumann");
-CREDIT_LINE("FBSQL", "Frank M. Kromann");
-CREDIT_LINE("FDF", "Uwe Steinmann");
-CREDIT_LINE("FilePro", "Chad Robinson");
-CREDIT_LINE("FTP", "Stefan Esser, Andrew Skalski");
-CREDIT_LINE("GD imaging", "Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto, Ilia Alshanetsky, Pierre-Alain Joye");
-CREDIT_LINE("GetText", "Alex Plotnick");
-CREDIT_LINE("GNU GMP support", "Stanislav Malyshev");
-CREDIT_LINE("HwAPI", "Uwe Steinmann");
-CREDIT_LINE("HyperWave", "Uwe Steinmann");
-CREDIT_LINE("Iconv", "Rui Hirokawa, Stig Bakken, Moriyoshi Koizumi ");
-CREDIT_LINE("IMAP", "Rex Logan, Mark Musone, Brian Wang, Kaj-Michael Lang, Antoni Pamies Olive, Rasmus Lerdorf, Andrew Skalski, Chuck Hagenbuch, Daniel R Kalowsky");
-CREDIT_LINE("Informix", "Danny Heijl, Christian Cartus, Corne' Cornelius");
-CREDIT_LINE("Ingres II", "David Hénot");
-CREDIT_LINE("InterBase", "Jouni Ahto, Andrew Avdeev");
-CREDIT_LINE("IRCG", "Sascha Schumann");
-CREDIT_LINE("Java", "Sam Ruby");
-CREDIT_LINE("LDAP", "Amitay Isaacs, Eric Warnke, Rasmus Lerdorf, Gerrit Thomson, Stig Venaas");
-CREDIT_LINE("MCAL", "Mark Musone, Chuck Hagenbuch");
-CREDIT_LINE("mcrypt", "Sascha Schumann, Derick Rethans");
-CREDIT_LINE("MCVE", "Brad House, Chris Faulhaber, Steven Schoch");
-CREDIT_LINE("mhash", "Sascha Schumann");
-CREDIT_LINE("mime_magic", "Hartmut Holzgraefe");
-CREDIT_LINE("MING", "Dave Hayden");
-CREDIT_LINE("mnoGoSearch", "Sergey Kartashoff, Alex Barkov, Ramil Kalimullin");
-CREDIT_LINE("msession", "Mark L. Woodward");
-CREDIT_LINE("mSQL", "Zeev Suraski");
-CREDIT_LINE("MS SQL", "Frank M. Kromann");
-CREDIT_LINE("Multibyte String Functions", "Tsukada Takuya, Rui Hirokawa");
-CREDIT_LINE("MySQLi", "Zak Greant, Georg Richter");
-CREDIT_LINE("MySQL", "Zeev Suraski, Zak Greant, Georg Richter");
-CREDIT_LINE("ncurses", "Ilia Alshanetsky, Wez Furlong, Hartmut Holzgraefe, Georg Richter");
-CREDIT_LINE("OCI8", "Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson, Maxim Maletsky");
-CREDIT_LINE("ODBC", "Stig Bakken, Andreas Karajannis, Frank M. Kromann, Daniel R. Kalowsky");
-CREDIT_LINE("OpenSSL", "Stig Venaas, Wez Furlong, Sascha Kettler");
-CREDIT_LINE("Oracle", "Stig Bakken, Mitch Golden, Rasmus Lerdorf, Andreas Karajannis, Thies C. Arntzen");
-CREDIT_LINE("Ovrimos", "Nikos Mavroyanopoulos");
-CREDIT_LINE("pcntl", "Jason Greene");
-CREDIT_LINE("PDF", "Uwe Steinmann, Rainer Schaaf");
-CREDIT_LINE("Perl Compatible Regexps", "Andrei Zmievski");
-CREDIT_LINE("Posix", "Kristian Köhntopp");
-CREDIT_LINE("PostgreSQL", "Jouni Ahto, Zeev Suraski, Yasuo Ohgaki");
-CREDIT_LINE("Pspell", "Vlad Krupin");
-CREDIT_LINE("qtdom", "Jan Borsodi");
-CREDIT_LINE("Readline", "Thies C. Arntzen");
-CREDIT_LINE("Recode", "Kristian Köhntopp");
-CREDIT_LINE("Sessions", "Sascha Schumann, Andrei Zmievski");
-CREDIT_LINE("Shared Memory Operations", "Slava Poliakov, Ilia Alshanetsky");
-CREDIT_LINE("SNMP", "Rasmus Lerdorf");
-CREDIT_LINE("Sockets", "Chris Vandomelen, Sterling Hughes, Daniel Beulshausen, Jason Greene");
-CREDIT_LINE("SWF", "Sterling Hughes");
-CREDIT_LINE("Sybase-CT", "Zeev Suraski, Tom May, Timm Friebe");
-CREDIT_LINE("Sybase-DB", "Zeev Suraski");
-CREDIT_LINE("System V Message based IPC", "Wez Furlong");
-CREDIT_LINE("System V Semaphores", "Tom May");
-CREDIT_LINE("System V Shared Memory", "Christian Cartus");
-CREDIT_LINE("tokenizer", "Andrei Zmievski");
-CREDIT_LINE("Verisign Payflow Pro", "John Donagher, David Croft");
-CREDIT_LINE("W32API", "James Moore");
-CREDIT_LINE("WDDX", "Andrei Zmievski");
-CREDIT_LINE("Win32 COM", "Alan Brown, Wez Furlong, Harald Radi, Zeev Suraski");
-CREDIT_LINE("xmlrpc", "Dan Libby");
-CREDIT_LINE("XML", "Stig Bakken, Thies C. Arntzen");
-CREDIT_LINE("YAZ", "Adam Dickmeiss");
-CREDIT_LINE("Yellow Pages", "Stephanie Wehner, Fredrik Ohrn");
-CREDIT_LINE("Zip", "Sterling Hughes");
-CREDIT_LINE("Zlib", "Rasmus Lerdorf, Stefan Roehrich, Zeev Suraski, Jade Nicoletti");
diff --git a/ext/standard/credits_sapi.h b/ext/standard/credits_sapi.h
deleted file mode 100644
index 3a691e501b..0000000000
--- a/ext/standard/credits_sapi.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- DO NOT EDIT THIS FILE!
-
- it has been automaticaly created by php4/scripts/credits from
- the information found in the various php4/ext/.../CREDITS and
- php4/sapi/.../CREDITS files
-
- if you want to change an entry you have to edit the appropriate
- CREDITS file instead
-
-*/
-
-CREDIT_LINE("ActiveScript", "Wez Furlong");
-CREDIT_LINE("AOLserver", "Sascha Schumann");
-CREDIT_LINE("Apache 1.3 (apache_hooks)", "Rasmus Lerdorf, Zeev Suraski, Stig Bakken, David Sklar, George Schlossnagle, Lukas Schroeder");
-CREDIT_LINE("Apache 1.3", "Rasmus Lerdorf, Zeev Suraski, Stig Bakken, David Sklar");
-CREDIT_LINE("Apache 2.0 Filter", "Sascha Schumann, Aaron Bannert");
-CREDIT_LINE("Apache 2.0 Handler", "Ian Holsman, Justin Erenkrantz (based on Apache 2.0 Filter code)");
-CREDIT_LINE("Caudium / Roxen", "David Hedbor");
-CREDIT_LINE("CGI / FastCGI", "Rasmus Lerdorf, Stig Bakken, Shane Caraveo");
-CREDIT_LINE("CLI", "Edin Kadribasic, Marcus Boerger");
-CREDIT_LINE("Embed", "Edin Kadribasic");
-CREDIT_LINE("ISAPI", "Andi Gutmans, Zeev Suraski");
-CREDIT_LINE("Java Servlet", "Sam Ruby");
-CREDIT_LINE("NSAPI", "Jayakumar Muthukumarasamy, Uwe Schindler");
-CREDIT_LINE("phttpd", "Thies C. Arntzen");
-CREDIT_LINE("pi3web", "Holger Zimmermann");
-CREDIT_LINE("Sendmail Milter", "Harald Radi");
-CREDIT_LINE("thttpd", "Sascha Schumann");
-CREDIT_LINE("tux", "Sascha Schumann");
-CREDIT_LINE("WebJames", "Alex Waugh");
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
deleted file mode 100644
index f4220699d1..0000000000
--- a/ext/standard/crypt.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Bakken <ssb@gaurdian.no> |
- | Zeev Suraski <zeev@zend.com> |
- | Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-#include <stdlib.h>
-
-#include "php.h"
-
-#if HAVE_CRYPT
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_CRYPT_H
-#include <crypt.h>
-#endif
-#if TM_IN_SYS_TIME
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#if HAVE_STRING_H
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-
-#ifdef PHP_WIN32
-#include <process.h>
-extern char *crypt(char *__key, char *__salt);
-#endif
-
-#include "php_lcg.h"
-#include "php_crypt.h"
-#include "php_rand.h"
-
-/*
- The capabilities of the crypt() function is determined by the test programs
- run by configure from aclocal.m4. They will set PHP_STD_DES_CRYPT,
- PHP_EXT_DES_CRYPT, PHP_MD5_CRYPT and PHP_BLOWFISH_CRYPT as appropriate
- for the target platform
-*/
-#if PHP_STD_DES_CRYPT
-#define PHP_MAX_SALT_LEN 2
-#endif
-
-#if PHP_EXT_DES_CRYPT
-#undef PHP_MAX_SALT_LEN
-#define PHP_MAX_SALT_LEN 9
-#endif
-
-#if PHP_MD5_CRYPT
-#undef PHP_MAX_SALT_LEN
-#define PHP_MAX_SALT_LEN 12
-#endif
-
-#if PHP_BLOWFISH_CRYPT
-#undef PHP_MAX_SALT_LEN
-#define PHP_MAX_SALT_LEN 60
-#endif
-
- /*
- * If the configure-time checks fail, we provide DES.
- * XXX: This is a hack. Fix the real problem
- */
-
-#ifndef PHP_MAX_SALT_LEN
-#define PHP_MAX_SALT_LEN 2
-#undef PHP_STD_DES_CRYPT
-#define PHP_STD_DES_CRYPT 1
-#endif
-
-
-#define PHP_CRYPT_RAND php_rand(TSRMLS_C)
-
-static int php_crypt_rand_seeded=0;
-
-PHP_MINIT_FUNCTION(crypt)
-{
- REGISTER_LONG_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CRYPT_STD_DES", PHP_STD_DES_CRYPT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CRYPT_EXT_DES", PHP_EXT_DES_CRYPT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CRYPT_MD5", PHP_MD5_CRYPT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CRYPT_BLOWFISH", PHP_BLOWFISH_CRYPT, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-
-PHP_RINIT_FUNCTION(crypt)
-{
- if(!php_crypt_rand_seeded) {
- php_srand(time(0) * getpid() * (unsigned long) (php_combined_lcg(TSRMLS_C) * 10000.0) TSRMLS_CC);
- php_crypt_rand_seeded=1;
- }
- return SUCCESS;
-}
-
-
-static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
-static void php_to64(char *s, long v, int n)
-{
- while (--n >= 0) {
- *s++ = itoa64[v&0x3f];
- v >>= 6;
- }
-}
-
-/* {{{ proto string crypt(string str [, string salt])
- Encrypt a string */
-PHP_FUNCTION(crypt)
-{
- char salt[PHP_MAX_SALT_LEN+1];
- char *str, *salt_in = NULL;
- int str_len, salt_in_len;
-
- salt[0]=salt[PHP_MAX_SALT_LEN]='\0';
- /* This will produce suitable results if people depend on DES-encryption
- available (passing always 2-character salt). At least for glibc6.1 */
- memset(&salt[1], '$', PHP_MAX_SALT_LEN-1);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len,
- &salt_in, &salt_in_len) == FAILURE) {
- return;
- }
-
- if (salt_in) {
- memcpy(salt, salt_in, MIN(PHP_MAX_SALT_LEN, salt_in_len));
- }
-
- /* The automatic salt generation only covers standard DES and md5-crypt */
- if(!*salt) {
-#if PHP_MD5_CRYPT
- strcpy(salt, "$1$");
- php_to64(&salt[3], PHP_CRYPT_RAND, 4);
- php_to64(&salt[7], PHP_CRYPT_RAND, 4);
- strcpy(&salt[11], "$");
-#elif PHP_STD_DES_CRYPT
- php_to64(&salt[0], PHP_CRYPT_RAND, 2);
- salt[2] = '\0';
-#endif
- }
-
- RETVAL_STRING(crypt(str, salt), 1);
-}
-/* }}} */
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/css.c b/ext/standard/css.c
deleted file mode 100644
index 7a99d21f1b..0000000000
--- a/ext/standard/css.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Colin Viebrock <colin@easydns.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "info.h"
-
-
-/* {{{ php_info_print_css
- */
-PHPAPI void php_info_print_css(TSRMLS_D)
-{
- PUTS("body {background-color: #ffffff; color: #000000;}\n");
- PUTS("body, td, th, h1, h2 {font-family: sans-serif;}\n");
- PUTS("pre {margin: 0px; font-family: monospace;}\n");
- PUTS("a:link {color: #000099; text-decoration: none;}\n");
- PUTS("a:hover {text-decoration: underline;}\n");
- PUTS("table {border-collapse: collapse;}\n");
- PUTS(".center {text-align: center;}\n");
- PUTS(".center table { margin-left: auto; margin-right: auto; text-align: left;}\n");
- PUTS(".center th { text-align: center; !important }\n");
- PUTS("td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}\n");
- PUTS("h1 {font-size: 150%;}\n");
- PUTS("h2 {font-size: 125%;}\n");
- PUTS(".p {text-align: left;}\n");
- PUTS(".e {background-color: #ccccff; font-weight: bold;}\n");
- PUTS(".h {background-color: #9999cc; font-weight: bold;}\n");
- PUTS(".v {background-color: #cccccc;}\n");
- PUTS(".vr {background-color: #cccccc; text-align: right;}\n");
- PUTS("i {color: #666666;}\n");
- PUTS("img {float: right; border: 0px;}\n");
- PUTS("hr {width: 600px; align: center; background-color: #cccccc; border: 0px; height: 1px;}\n");
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/css.h b/ext/standard/css.h
deleted file mode 100644
index c5a5e4b537..0000000000
--- a/ext/standard/css.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Colin Viebrock <colin@easydns.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef CSS_H
-#define CSS_H
-
-PHPAPI void php_info_print_css(TSRMLS_D);
-
-#endif
diff --git a/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c
deleted file mode 100644
index ed333b42f8..0000000000
--- a/ext/standard/cyr_convert.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Kirill Maximov <kir@rus.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdlib.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include <errno.h>
-
-#include "php.h"
-#include "cyr_convert.h"
-
-#include <stdio.h>
-
-/*****************************************************************************
-* This is codetables for different Cyrillic charsets (relative to koi8-r).
-* Each table contains data for 128-255 symbols from ASCII table.
-* First 256 symbols are for conversion from koi8-r to corresponding charset,
-* second 256 symbols are for reverse conversion, from charset to koi8-r.
-*
-* Here we have the following tables:
-* _cyr_win1251 - for windows-1251 charset
-* _cyr_iso88595 - for iso8859-5 charset
-* _cyr_cp866 - for x-cp866 charset
-* _cyr_mac - for x-mac-cyrillic charset
-*
-*****************************************************************************/
-
-typedef unsigned char _cyr_charset_table[512];
-
-/* {{{ const static _cyr_charset_table _cyr_win1251
- */
-const static _cyr_charset_table _cyr_win1251 = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,
-46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,
-154,174,190,46,159,189,46,46,179,191,180,157,46,46,156,183,
-46,46,182,166,173,46,46,158,163,152,164,155,46,46,46,167,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,184,186,32,179,191,32,32,32,32,32,180,162,32,
-32,32,32,168,170,32,178,175,32,32,32,32,32,165,161,169,
-254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238,
-239,255,240,241,242,243,230,226,252,251,231,248,253,249,247,250,
-222,192,193,214,196,197,212,195,213,200,201,202,203,204,205,206,
-207,223,208,209,210,211,198,194,220,219,199,216,221,217,215,218,
-},
-_cyr_cp866 = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-35,35,35,124,124,124,124,43,43,124,124,43,43,43,43,43,
-43,45,45,124,45,43,124,124,43,43,45,45,124,45,43,45,
-45,45,45,43,43,43,43,43,43,43,43,35,35,124,124,35,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209,
-179,163,180,164,183,167,190,174,32,149,158,32,152,159,148,154,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-205,186,213,241,243,201,32,245,187,212,211,200,190,32,247,198,
-199,204,181,240,242,185,32,244,203,207,208,202,216,32,246,32,
-238,160,161,230,164,165,228,163,229,168,169,170,171,172,173,174,
-175,239,224,225,226,227,166,162,236,235,167,232,237,233,231,234,
-158,128,129,150,132,133,148,131,149,136,137,138,139,140,141,142,
-143,159,144,145,146,147,134,130,156,155,135,152,157,153,151,154,
-},
-_cyr_iso88595 = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,179,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209,
-32,163,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,241,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,161,32,32,32,32,32,32,32,32,32,32,32,32,
-238,208,209,230,212,213,228,211,229,216,217,218,219,220,221,222,
-223,239,224,225,226,227,214,210,236,235,215,232,237,233,231,234,
-206,176,177,198,180,181,196,179,197,184,185,186,187,188,189,190,
-191,207,192,193,194,195,182,178,204,203,183,200,205,201,199,202,
-},
-_cyr_mac = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
-176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
-128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
-144,145,146,147,148,149,150,151,152,153,154,155,156,179,163,209,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,255,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
-208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
-160,161,162,222,164,165,166,167,168,169,170,171,172,173,174,175,
-176,177,178,221,180,181,182,183,184,185,186,187,188,189,190,191,
-254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238,
-239,223,240,241,242,243,230,226,252,251,231,248,253,249,247,250,
-158,128,129,150,132,133,148,131,149,136,137,138,139,140,141,142,
-143,159,144,145,146,147,134,130,156,155,135,152,157,153,151,154,
-};
-/* }}} */
-
-/* {{{ php_convert_cyr_string
-* This is the function that performs real in-place conversion of the string
-* between charsets.
-* Parameters:
-* str - string to be converted
-* from,to - one-symbol label of source and destination charset
-* The following symbols are used as labels:
-* k - koi8-r
-* w - windows-1251
-* i - iso8859-5
-* a - x-cp866
-* d - x-cp866
-* m - x-mac-cyrillic
-*****************************************************************************/
-static char * php_convert_cyr_string(unsigned char *str, int length, char from, char to TSRMLS_DC)
-{
- const unsigned char *from_table, *to_table;
- unsigned char tmp;
- int i;
-
- from_table = NULL;
- to_table = NULL;
-
- switch (toupper((int)(unsigned char)from))
- {
- case 'W':
- from_table = _cyr_win1251;
- break;
- case 'A':
- case 'D':
- from_table = _cyr_cp866;
- break;
- case 'I':
- from_table = _cyr_iso88595;
- break;
- case 'M':
- from_table = _cyr_mac;
- break;
- case 'K':
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown source charset: %c", from);
- break;
- }
-
- switch (toupper((int)(unsigned char)to))
- {
- case 'W':
- to_table = _cyr_win1251;
- break;
- case 'A':
- case 'D':
- to_table = _cyr_cp866;
- break;
- case 'I':
- to_table = _cyr_iso88595;
- break;
- case 'M':
- to_table = _cyr_mac;
- break;
- case 'K':
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown destination charset: %c", to);
- break;
- }
-
-
- if (!str)
- return (char *)str;
-
- for( i = 0; i<length; i++)
- {
- tmp = (from_table == NULL)? str[i] : from_table[ str[i] ];
- str[i] = (to_table == NULL) ? tmp : to_table[tmp + 256];
- }
- return (char *)str;
-}
-/* }}} */
-
-/* {{{ proto string convert_cyr_string(string str, string from, string to)
- Convert from one Cyrillic character set to another */
-PHP_FUNCTION(convert_cyr_string)
-{
- pval **str_arg, **fr_cs, **to_cs;
- unsigned char *str;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3,&str_arg,&fr_cs, &to_cs)==FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str_arg);
- convert_to_string_ex(fr_cs);
- convert_to_string_ex(to_cs);
-
- str = (unsigned char*) estrndup(Z_STRVAL_PP(str_arg), Z_STRLEN_PP(str_arg));
-
- php_convert_cyr_string(str, Z_STRLEN_PP(str_arg), Z_STRVAL_PP(fr_cs)[0], Z_STRVAL_PP(to_cs)[0] TSRMLS_CC);
- RETVAL_STRING((char *)str, 0)
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/cyr_convert.h b/ext/standard/cyr_convert.h
deleted file mode 100644
index c781bc5e17..0000000000
--- a/ext/standard/cyr_convert.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Kirill Maximov <kir@rus.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef CYR_CONVERT_H
-#define CYR_CONVERT_H
-
-PHP_FUNCTION(convert_cyr_string);
-
-#endif /* CYR_CONVERT_H */
-
-
-
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
deleted file mode 100644
index e45e40fb1c..0000000000
--- a/ext/standard/datetime.c
+++ /dev/null
@@ -1,1070 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "zend_operators.h"
-#include "datetime.h"
-#include "php_globals.h"
-
-#include <time.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#include <stdio.h>
-
-#include "php_parsedate.h"
-
-char *mon_full_names[] = {
- "January", "February", "March", "April",
- "May", "June", "July", "August",
- "September", "October", "November", "December"
-};
-
-char *mon_short_names[] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-};
-
-char *day_full_names[] = {
- "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
-};
-
-char *day_short_names[] = {
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
-};
-
-#if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE) && !defined(HAVE_DECLARED_TIMEZONE)
-#if defined(NETWARE) && defined(NEW_LIBC)
-#define timezone _timezone /* timezone is called '_timezone' in new version of LibC */
-#endif
-extern time_t timezone;
-extern int daylight;
-#endif
-
-static int phpday_tab[2][12] = {
- {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
- {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
-};
-
-#define isleap(year) (((year % 4) == 0 && (year % 100) != 0) || (year % 400)==0)
-#define YEAR_BASE 1900
-
-/* {{{ proto int time(void)
- Return current UNIX timestamp */
-PHP_FUNCTION(time)
-{
- RETURN_LONG((long)time(NULL));
-}
-/* }}} */
-
-/* {{{ php_mktime
- */
-void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm)
-{
- pval **arguments[7];
- struct tm *ta, tmbuf;
- time_t t, seconds;
- int i, gmadjust, arg_count = ZEND_NUM_ARGS();
- int is_dst = -1, val, chgsecs = 0;
-
- if (arg_count > 7 || zend_get_parameters_array_ex(arg_count, arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* convert supplied arguments to longs */
- for (i = 0; i < arg_count; i++) {
- convert_to_long_ex(arguments[i]);
- }
- t = time(NULL);
-#ifdef HAVE_TZSET
- tzset();
-#endif
- /*
- ** Set default time parameters with local time values,
- ** EVEN when some GMT time parameters are specified!
- ** This may give strange result, with PHP gmmktime(0, 0, 0),
- ** which is assumed to return GMT midnight time
- ** for today (in localtime), so that the result time may be
- ** AFTER or BEFORE the current time.
- ** May be we should initialize tn using gmtime(), so that
- ** default parameters for PHP gmmktime would be the current
- ** GMT time values...
- */
- ta = php_localtime_r(&t, &tmbuf);
-
- /* Let DST be unknown. mktime() should compute the right value
- ** and behave correctly. Unless the user overrides this.
- */
- ta->tm_isdst = -1;
-
- /*
- ** Now change date values with supplied parameters.
- */
- switch(arg_count) {
- case 7: /* daylight saving time flag */
-#ifdef PHP_WIN32
- if (daylight > 0) {
- ta->tm_isdst = is_dst = Z_LVAL_PP(arguments[6]);
- } else {
- ta->tm_isdst = is_dst = 0;
- }
-#else
- ta->tm_isdst = is_dst = Z_LVAL_PP(arguments[6]);
-#endif
- /* fall-through */
- case 6: /* year */
- /* special case:
- a zero in year, month and day is considered illegal
- as it would be interpreted as 30.11.1999 otherwise
- */
- if ( ( Z_LVAL_PP(arguments[5])==0)
- &&(Z_LVAL_PP(arguments[4])==0)
- &&(Z_LVAL_PP(arguments[3])==0)
- ) {
- RETURN_LONG(-1);
- }
-
- /*
- ** Accept parameter in range 0..1000 interpreted as 1900..2900
- ** (if 100 is given, it means year 2000)
- ** or in range 1001..9999 interpreted as is (this will store
- ** negative tm_year for years in range 1001..1899)
- ** This function is then Y2K ready, and accepts a wide range of
- ** dates including the whole gregorian calendar.
- ** But it cannot represent ancestral dates prior to year 1001.
- ** Additionally, input parameters of 0..70 are mapped to 100..170
- */
- if (Z_LVAL_PP(arguments[5]) < 70)
- ta->tm_year = Z_LVAL_PP(arguments[5]) + 100;
- else
- ta->tm_year = Z_LVAL_PP(arguments[5])
- - ((Z_LVAL_PP(arguments[5]) > 1000) ? 1900 : 0);
- /* fall-through */
- case 5: /* day in month (1-baesd) */
- val = (*arguments[4])->value.lval;
- if (val < 1) {
- chgsecs += (1-val) * 60*60*24;
- val = 1;
- }
- ta->tm_mday = val;
- /* fall-through */
- case 4: /* month (zero-based) */
- val = (*arguments[3])->value.lval - 1;
- while (val < 0) {
- val += 12; ta->tm_year--;
- }
- ta->tm_mon = val;
- /* fall-through */
- case 3: /* second */
- val = (*arguments[2])->value.lval;
- if (val < 1) {
- chgsecs += (1-val); val = 1;
- }
- ta->tm_sec = val;
- /* fall-through */
- case 2: /* minute */
- val = (*arguments[1])->value.lval;
- if (val < 1) {
- chgsecs += (1-val) * 60; val = 1;
- }
- ta->tm_min = val;
- /* fall-through */
- case 1: /* hour */
- val = (*arguments[0])->value.lval;
- if (val < 1) {
- chgsecs += (1-val) * 60*60; val = 1;
- }
- ta->tm_hour = val;
- /* fall-through */
- case 0:
- break;
- }
-
- t = mktime(ta);
-
-#ifdef PHP_WIN32
- if (t - chgsecs < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Windows does not support negative values for this function");
- RETURN_LONG(-1);
- }
-#endif
-
- seconds = t - chgsecs;
-
- if (is_dst == -1) {
- struct tm t1, t2;
- t1 = *localtime(&t);
- t2 = *localtime(&seconds);
-
- if (t1.tm_isdst != t2.tm_isdst) {
- seconds += (t1.tm_isdst == 1) ? 3600 : -3600;
- ta = localtime(&seconds);
- }
-
- is_dst = ta->tm_isdst;
- }
-
- if (gm) {
-#if HAVE_TM_GMTOFF
- /*
- ** mktime(ta) very nicely just filled ta->tm_gmtoff with
- ** the exactly right value for adjustment if we want GMT.
- */
- gmadjust = ta->tm_gmtoff;
-#else
- /*
- ** If correcting for daylight savings time, we set the adjustment to
- ** the value of timezone - 3600 seconds.
- */
-#ifdef __CYGWIN__
- gmadjust = -(is_dst ? _timezone - 3600 : _timezone);
-#else
- gmadjust = -(is_dst ? timezone - 3600 : timezone);
-#endif
-#endif
- seconds += gmadjust;
- }
-
- RETURN_LONG(seconds);
-}
-/* }}} */
-
-/* {{{ proto int mktime(int hour, int min, int sec, int mon, int day, int year)
- Get UNIX timestamp for a date */
-PHP_FUNCTION(mktime)
-{
- php_mktime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int gmmktime(int hour, int min, int sec, int mon, int day, int year)
- Get UNIX timestamp for a GMT date */
-PHP_FUNCTION(gmmktime)
-{
- php_mktime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ php_date
- */
-static void php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
-{
- pval **format, **timestamp;
- time_t the_time;
- struct tm *ta, tmbuf;
- int i, size = 0, length, h, beat, fd, wd, yd, wk;
- char tmp_buff[32];
-#if !HAVE_TM_GMTOFF
- long tzone;
- char *tname[2]= {"GMT Standard Time", "BST"};
-#endif
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &format) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- the_time = time(NULL);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &format, &timestamp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(timestamp);
- the_time = Z_LVAL_PP(timestamp);
-#ifdef PHP_WIN32
- if (the_time < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Windows does not support dates prior to midnight (00:00:00), January 1, 1970");
- RETURN_FALSE;
- }
-#endif
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(format);
-
- if (gm) {
- ta = php_gmtime_r(&the_time, &tmbuf);
-#if !HAVE_TM_GMTOFF
- tzone = 0;
-#endif
- } else {
- ta = php_localtime_r(&the_time, &tmbuf);
-#if !HAVE_TM_GMTOFF
-#ifdef __CYGWIN__
- tzone = _timezone;
-#else
- tzone = timezone;
-#endif
- if (tzname[0] != NULL) {
- tname[0] = tzname[0];
- } else {
- tname[0] = "???";
- }
-#endif
- }
-
- if (!ta) { /* that really shouldn't happen... */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unexpected error");
- RETURN_FALSE;
- }
- for (i = 0; i < Z_STRLEN_PP(format); i++) {
- switch (Z_STRVAL_PP(format)[i]) {
- case 'r': /* rfc822 format */
- size += 31;
- break;
- case 'U': /* seconds since the epoch */
- size += 10;
- break;
- case 'F': /* month, textual, full */
- case 'l': /* day (of the week), textual */
- size += 28;
- break;
- case 'T': /* timezone name */
-#if HAVE_TM_ZONE
- size += strlen(ta->tm_zone);
-#elif HAVE_TZNAME
- if (ta->tm_isdst > 0 ) {
- size += strlen(tname[1]);
- } else {
- size += strlen(tname[0]);
- }
-#endif
- break;
- case 'Z': /* timezone offset in seconds */
- size += 6;
- break;
- case 'O': /* GMT offset in [+-]HHMM format */
- size += 5;
- break;
- case 'Y': /* year, numeric, 4 digits */
- size += 4;
- break;
- case 'M': /* month, textual, 3 letters */
- case 'D': /* day, textual, 3 letters */
- case 'z': /* day of the year, 1 to 366 */
- case 'B': /* Swatch Beat, 3 digits */
- size += 3;
- break;
- case 'y': /* year, numeric, 2 digits */
- case 'm': /* month, numeric */
- case 'n': /* month, numeric, no leading zeroes */
- case 'd': /* day of the month, numeric */
- case 'j': /* day of the month, numeric, no leading zeros */
- case 'H': /* hour, numeric, 24 hour format */
- case 'h': /* hour, numeric, 12 hour format */
- case 'G': /* hour, numeric, 24 hour format, no leading zeroes */
- case 'g': /* hour, numeric, 12 hour format, no leading zeroes */
- case 'i': /* minutes, numeric */
- case 's': /* seconds, numeric */
- case 'A': /* AM/PM */
- case 'a': /* am/pm */
- case 'S': /* standard english suffix for the day of the month (e.g. 3rd, 2nd, etc) */
- case 't': /* days in current month */
- case 'W': /* ISO-8601 week number of year, weeks starting on Monday */
- size += 2;
- break;
- case '\\':
- if (i < Z_STRLEN_PP(format) - 1) {
- i++;
- }
- size ++;
- break;
- case 'L': /* boolean for leap year */
- case 'w': /* day of the week, numeric */
- case 'I': /* DST? */
- default:
- size++;
- break;
- }
- }
-
- Z_STRVAL_P(return_value) = (char *) emalloc(size + 1);
- Z_STRVAL_P(return_value)[0] = '\0';
-
- for (i = 0; i < Z_STRLEN_PP(format); i++) {
- switch (Z_STRVAL_PP(format)[i]) {
- case '\\':
- if (i < Z_STRLEN_PP(format) - 1) {
- char ch[2];
- ch[0]=Z_STRVAL_PP(format)[i + 1];
- ch[1]='\0';
- strcat(Z_STRVAL_P(return_value), ch);
- i++;
- }
- break;
- case 'U': /* seconds since the epoch */
- sprintf(tmp_buff, "%ld", (long)the_time); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'F': /* month, textual, full */
- strcat(Z_STRVAL_P(return_value), mon_full_names[ta->tm_mon]);
- break;
- case 'l': /* day (of the week), textual, full */
- strcat(Z_STRVAL_P(return_value), day_full_names[ta->tm_wday]);
- break;
- case 'Y': /* year, numeric, 4 digits */
- sprintf(tmp_buff, "%d", ta->tm_year + YEAR_BASE); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'M': /* month, textual, 3 letters */
- strcat(Z_STRVAL_P(return_value), mon_short_names[ta->tm_mon]);
- break;
- case 'D': /* day (of the week), textual, 3 letters */
- strcat(Z_STRVAL_P(return_value), day_short_names[ta->tm_wday]);
- break;
- case 'z': /* day (of the year) */
- sprintf(tmp_buff, "%d", ta->tm_yday); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'y': /* year, numeric, 2 digits */
- sprintf(tmp_buff, "%02d", ((ta->tm_year)%100)); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'm': /* month, numeric */
- sprintf(tmp_buff, "%02d", ta->tm_mon + 1); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'n': /* month, numeric, no leading zeros */
- sprintf(tmp_buff, "%d", ta->tm_mon + 1); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'd': /* day of the month, numeric */
- sprintf(tmp_buff, "%02d", ta->tm_mday); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'j':
- sprintf(tmp_buff, "%d", ta->tm_mday); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'H': /* hour, numeric, 24 hour format */
- sprintf(tmp_buff, "%02d", ta->tm_hour); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'h': /* hour, numeric, 12 hour format */
- h = ta->tm_hour % 12; if (h==0) h = 12;
- sprintf(tmp_buff, "%02d", h); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'G': /* hour, numeric, 24 hour format, no leading zeros */
- sprintf(tmp_buff, "%d", ta->tm_hour); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'g': /* hour, numeric, 12 hour format, no leading zeros */
- h = ta->tm_hour % 12; if (h==0) h = 12;
- sprintf(tmp_buff, "%d", h); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'i': /* minutes, numeric */
- sprintf(tmp_buff, "%02d", ta->tm_min); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 's': /* seconds, numeric */
- sprintf(tmp_buff, "%02d", ta->tm_sec); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'A': /* AM/PM */
- strcat(Z_STRVAL_P(return_value), (ta->tm_hour >= 12 ? "PM" : "AM"));
- break;
- case 'a': /* am/pm */
- strcat(Z_STRVAL_P(return_value), (ta->tm_hour >= 12 ? "pm" : "am"));
- break;
- case 'S': /* standard english suffix, e.g. 2nd/3rd for the day of the month */
- if (ta->tm_mday >= 10 && ta->tm_mday <= 19) {
- strcat(Z_STRVAL_P(return_value), "th");
- } else {
- switch (ta->tm_mday % 10) {
- case 1:
- strcat(Z_STRVAL_P(return_value), "st");
- break;
- case 2:
- strcat(Z_STRVAL_P(return_value), "nd");
- break;
- case 3:
- strcat(Z_STRVAL_P(return_value), "rd");
- break;
- default:
- strcat(Z_STRVAL_P(return_value), "th");
- break;
- }
- }
- break;
- case 't': /* days in current month */
- sprintf(tmp_buff, "%2d", phpday_tab[isleap((ta->tm_year+YEAR_BASE))][ta->tm_mon] );
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'w': /* day of the week, numeric EXTENSION */
- sprintf(tmp_buff, "%01d", ta->tm_wday); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'O': /* GMT offset in [+-]HHMM format */
-#if HAVE_TM_GMTOFF
- sprintf(tmp_buff, "%c%02d%02d", (ta->tm_gmtoff < 0) ? '-' : '+', abs(ta->tm_gmtoff / 3600), abs( (ta->tm_gmtoff % 3600) / 60 ));
-#else
- sprintf(tmp_buff, "%c%02d%02d", ((ta->tm_isdst ? tzone - 3600:tzone)>0)?'-':'+', abs((ta->tm_isdst ? tzone - 3600 : tzone) / 3600), abs(((ta->tm_isdst ? tzone - 3600 : tzone) % 3600) / 60));
-#endif
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'Z': /* timezone offset in seconds */
-#if HAVE_TM_GMTOFF
- sprintf(tmp_buff, "%ld", ta->tm_gmtoff);
-#else
- sprintf(tmp_buff, "%ld", ta->tm_isdst ? -(tzone- 3600) : -tzone);
-#endif
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'L': /* boolean for leapyear */
- sprintf(tmp_buff, "%d", (isleap((ta->tm_year+YEAR_BASE)) ? 1 : 0 ) );
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'T': /* timezone name */
-#if HAVE_TM_ZONE
- strcat(Z_STRVAL_P(return_value), ta->tm_zone);
-#elif HAVE_TZNAME
- strcat(Z_STRVAL_P(return_value), ta->tm_isdst ? tname[1] : tname[0]);
-#endif
- break;
- case 'B': /* Swatch Beat a.k.a. Internet Time */
- beat = (((((long)the_time)-(((long)the_time) -
- ((((long)the_time) % 86400) + 3600))) * 10) / 864);
- while (beat < 0) {
- beat += 1000;
- }
- beat = beat % 1000;
- sprintf(tmp_buff, "%03d", beat); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'I':
- sprintf(tmp_buff, "%d", ta->tm_isdst);
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'r':
-#if HAVE_TM_GMTOFF
- sprintf(tmp_buff, "%3s, %2d %3s %04d %02d:%02d:%02d %c%02d%02d",
- day_short_names[ta->tm_wday],
- ta->tm_mday,
- mon_short_names[ta->tm_mon],
- ta->tm_year + YEAR_BASE,
- ta->tm_hour,
- ta->tm_min,
- ta->tm_sec,
- (ta->tm_gmtoff < 0) ? '-' : '+',
- abs(ta->tm_gmtoff / 3600),
- abs( (ta->tm_gmtoff % 3600) / 60 )
- );
-#else
- sprintf(tmp_buff, "%3s, %2d %3s %04d %02d:%02d:%02d %c%02d%02d",
- day_short_names[ta->tm_wday],
- ta->tm_mday,
- mon_short_names[ta->tm_mon],
- ta->tm_year + YEAR_BASE,
- ta->tm_hour,
- ta->tm_min,
- ta->tm_sec,
- ((ta->tm_isdst ? tzone - 3600 : tzone) > 0) ? '-' : '+',
- abs((ta->tm_isdst ? tzone - 3600 : tzone) / 3600),
- abs( ((ta->tm_isdst ? tzone - 3600 : tzone) % 3600) / 60 )
- );
-#endif
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
- case 'W': /* ISO-8601 week number of year, weeks starting on Monday */
- wd = ta->tm_wday == 0 ? 6 : ta->tm_wday - 1; /* weekday */
- yd = ta->tm_yday + 1; /* days since January 1st */
-
- fd = (7 + wd - yd % 7+ 1) % 7; /* weekday (1st January) */
-
- /* week is a last year week (52 or 53) */
- if ((yd <= 7 - fd) && fd > 3){
- wk = (fd == 4 || (fd == 5 && isleap((ta->tm_year + YEAR_BASE - 1)))) ? 53 : 52;
- }
- /* week is a next year week (1) */
- else if (isleap((ta->tm_year+YEAR_BASE)) + 365 - yd < 3 - wd){
- wk = 1;
- }
- /* normal week */
- else {
- wk = (yd + 6 - wd + fd) / 7 - (fd > 3);
- }
-
- sprintf(tmp_buff, "%d", wk); /* SAFE */
- strcat(Z_STRVAL_P(return_value), tmp_buff);
- break;
-
- default:
- length = strlen(Z_STRVAL_P(return_value));
- Z_STRVAL_P(return_value)[length] = Z_STRVAL_PP(format)[i];
- Z_STRVAL_P(return_value)[length + 1] = '\0';
- break;
- }
- }
- Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
- Z_TYPE_P(return_value) = IS_STRING;
-}
-/* }}} */
-
-/* {{{ proto string date(string format [, int timestamp])
- Format a local time/date */
-PHP_FUNCTION(date)
-{
- php_date(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string gmdate(string format [, int timestamp])
- Format a GMT/UTC date/time */
-PHP_FUNCTION(gmdate)
-{
- php_date(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ php_idate
- */
-int php_idate(char format, int timestamp, int gm)
-{
- time_t the_time;
- struct tm *ta, tmbuf;
- int h, beat, fd, wd, yd, wk;
-#if !HAVE_TM_GMTOFF
- long tzone;
- char *tname[2]= {"GMT Standard Time", "BST"};
-#endif
-
- the_time = timestamp;
-
- if (gm) {
- ta = php_gmtime_r(&the_time, &tmbuf);
-#if !HAVE_TM_GMTOFF
- tzone = 0;
-#endif
- } else {
- ta = php_localtime_r(&the_time, &tmbuf);
-#if !HAVE_TM_GMTOFF
-#ifdef __CYGWIN__
- tzone = _timezone;
-#else
- tzone = timezone;
-#endif
- tname[0] = tzname[0];
-#endif
- }
-
- switch (format) {
- case 'U': /* seconds since the epoch */
- return (long)the_time;
- case 'Y': /* year, numeric, 4 digits */
- return ta->tm_year + YEAR_BASE;
- case 'z': /* day (of the year) */
- return ta->tm_yday;
- case 'y': /* year, numeric, 2 digits */
- return (ta->tm_year) % 100;
- case 'm': /* month, numeric */
- case 'n':
- return ta->tm_mon + 1;
- case 'd': /* day of the month, numeric */
- case 'j':
- return ta->tm_mday;
- case 'H': /* hour, numeric, 24 hour format */
- case 'G':
- return ta->tm_hour;
- case 'h': /* hour, numeric, 12 hour format */
- case 'g':
- h = ta->tm_hour % 12;
- if (h == 0) {
- h = 12;
- }
- return h;
- case 'i': /* minutes, numeric */
- return ta->tm_min;
- case 's': /* seconds, numeric */
- return ta->tm_sec;
- case 't': /* days in current month */
- return phpday_tab[isleap((ta->tm_year + YEAR_BASE))][ta->tm_mon];
- case 'w': /* day of the week, numeric EXTENSION */
- return ta->tm_wday;
- case 'Z': /* timezone offset in seconds */
-#if HAVE_TM_GMTOFF
- return ta->tm_gmtoff;
-#else
- return ta->tm_isdst ? -(tzone - 3600) : -tzone;
-#endif
- case 'L': /* boolean for leapyear */
- return isleap(ta->tm_year + YEAR_BASE) ? 1 : 0;
- case 'B': /* Swatch Beat a.k.a. Internet Time */
- beat = (((((long)the_time) - (((long)the_time) - ((((long)the_time) % 86400) + 3600))) * 10) / 864);
- while (beat < 0) {
- beat += 1000;
- }
- beat = beat % 1000;
- return beat;
- case 'I':
- return ta->tm_isdst;
- case 'W': /* ISO-8601 week number of year, weeks starting on Monday */
- wd = (ta->tm_wday == 0) ? 6 : ta->tm_wday - 1; /* weekday */
- yd = ta->tm_yday + 1; /* days since January 1st */
- fd = (7 + wd - yd % 7+ 1) % 7; /* weekday (1st January) */
- if ((yd <= 7 - fd) && fd > 3) { /* week is a last year week (52 or 53) */
- wk = (fd == 4 || (fd == 5 && isleap((ta->tm_year + YEAR_BASE - 1)))) ? 53 : 52;
- }
- /* week is a next year week (1) */
- else if (isleap((ta->tm_year + YEAR_BASE)) + 365 - yd < 3 - wd) {
- wk = 1;
- }
- /* normal week */
- else {
- wk = (yd + 6 - wd + fd) / 7 - (fd > 3);
- }
- return wk;
- break;
- default:
- return 0;
- }
-}
-/* }}} */
-
-/* {{{ proto int idate(string format [, int timestamp])
- Format a local time/date as integer */
-PHP_FUNCTION(idate)
-{
- zval **format, **timestamp;
- int t, ret;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &format) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- t = time(NULL);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &format, &timestamp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(timestamp);
- t = Z_LVAL_PP(timestamp);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(format);
-
- if (Z_STRLEN_PP(format) != 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "idate format is one char");
- RETURN_FALSE;
- }
-
- ret = php_idate(Z_STRVAL_PP(format)[0], t, 0);
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto array localtime([int timestamp [, bool associative_array]])
- Returns the results of the C system call localtime as an associative array if the associative_array argument is set to 1 other wise it is a regular array */
-PHP_FUNCTION(localtime)
-{
- zval **timestamp_arg, **assoc_array_arg;
- struct tm *ta, tmbuf;
- time_t timestamp;
- int assoc_array = 0;
- int arg_count = ZEND_NUM_ARGS();
-
- if (arg_count < 0 || arg_count > 2 ||
- zend_get_parameters_ex(arg_count, &timestamp_arg, &assoc_array_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (arg_count) {
- case 0:
- timestamp = (long)time(NULL);
- break;
- case 1:
- convert_to_long_ex(timestamp_arg);
- timestamp = Z_LVAL_PP(timestamp_arg);
- break;
- case 2:
- convert_to_long_ex(timestamp_arg);
- convert_to_long_ex(assoc_array_arg);
- timestamp = Z_LVAL_PP(timestamp_arg);
- assoc_array = Z_LVAL_PP(assoc_array_arg);
- break;
- }
-
-#ifdef PHP_WIN32
- if (timestamp < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Windows does not support negative values for this function");
- RETURN_FALSE
- }
-#endif
-
- if (NULL == (ta = php_localtime_r(&timestamp, &tmbuf))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid local time");
- RETURN_FALSE;
- }
- array_init(return_value);
-
- if (assoc_array) {
- add_assoc_long(return_value, "tm_sec", ta->tm_sec);
- add_assoc_long(return_value, "tm_min", ta->tm_min);
- add_assoc_long(return_value, "tm_hour", ta->tm_hour);
- add_assoc_long(return_value, "tm_mday", ta->tm_mday);
- add_assoc_long(return_value, "tm_mon", ta->tm_mon);
- add_assoc_long(return_value, "tm_year", ta->tm_year);
- add_assoc_long(return_value, "tm_wday", ta->tm_wday);
- add_assoc_long(return_value, "tm_yday", ta->tm_yday);
- add_assoc_long(return_value, "tm_isdst", ta->tm_isdst);
- } else {
- add_next_index_long(return_value, ta->tm_sec);
- add_next_index_long(return_value, ta->tm_min);
- add_next_index_long(return_value, ta->tm_hour);
- add_next_index_long(return_value, ta->tm_mday);
- add_next_index_long(return_value, ta->tm_mon);
- add_next_index_long(return_value, ta->tm_year);
- add_next_index_long(return_value, ta->tm_wday);
- add_next_index_long(return_value, ta->tm_yday);
- add_next_index_long(return_value, ta->tm_isdst);
- }
-}
-/* }}} */
-
-/* {{{ proto array getdate([int timestamp])
- Get date/time information */
-PHP_FUNCTION(getdate)
-{
- pval **timestamp_arg;
- struct tm *ta, tmbuf;
- time_t timestamp;
-
- if (ZEND_NUM_ARGS() == 0) {
- timestamp = time(NULL);
- } else if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &timestamp_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- } else {
- convert_to_long_ex(timestamp_arg);
- timestamp = Z_LVAL_PP(timestamp_arg);
- }
-
- ta = php_localtime_r(&timestamp, &tmbuf);
- if (!ta) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot perform date calculation");
- return;
- }
- array_init(return_value);
- add_assoc_long(return_value, "seconds", ta->tm_sec);
- add_assoc_long(return_value, "minutes", ta->tm_min);
- add_assoc_long(return_value, "hours", ta->tm_hour);
- add_assoc_long(return_value, "mday", ta->tm_mday);
- add_assoc_long(return_value, "wday", ta->tm_wday);
- add_assoc_long(return_value, "mon", ta->tm_mon + 1);
- add_assoc_long(return_value, "year", ta->tm_year + 1900);
- add_assoc_long(return_value, "yday", ta->tm_yday);
- add_assoc_string(return_value, "weekday", day_full_names[ta->tm_wday], 1);
- add_assoc_string(return_value, "month", mon_full_names[ta->tm_mon], 1);
- add_index_long(return_value, 0, timestamp);
-}
-/* }}} */
-
-/* {{{ php_std_date
- Return date string in standard format for http headers */
-char *php_std_date(time_t t TSRMLS_DC)
-{
- struct tm *tm1, tmbuf;
- char *str;
-
- tm1 = php_gmtime_r(&t, &tmbuf);
- str = emalloc(81);
- if (PG(y2k_compliance)) {
- snprintf(str, 80, "%s, %02d-%s-%04d %02d:%02d:%02d GMT",
- day_short_names[tm1->tm_wday],
- tm1->tm_mday,
- mon_short_names[tm1->tm_mon],
- tm1->tm_year + 1900,
- tm1->tm_hour, tm1->tm_min, tm1->tm_sec);
- } else {
- snprintf(str, 80, "%s, %02d-%s-%02d %02d:%02d:%02d GMT",
- day_short_names[tm1->tm_wday],
- tm1->tm_mday,
- mon_short_names[tm1->tm_mon],
- ((tm1->tm_year) % 100),
- tm1->tm_hour, tm1->tm_min, tm1->tm_sec);
- }
-
- str[79] = 0;
- return (str);
-}
-/* }}} */
-
-/* {{{ proto bool checkdate(int month, int day, int year)
- Returns true(1) if it is a valid date in gregorian calendar */
-PHP_FUNCTION(checkdate)
-{
- pval **month, **day, **year;
- int m, d, y, res=0;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &month, &day, &year) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(year) == IS_STRING) {
- res = is_numeric_string(Z_STRVAL_PP(year), Z_STRLEN_PP(year), NULL, NULL, 0);
- if (res != IS_LONG && res != IS_DOUBLE) {
- RETURN_FALSE;
- }
- }
- convert_to_long_ex(day);
- convert_to_long_ex(month);
- convert_to_long_ex(year);
- y = Z_LVAL_PP(year);
- m = Z_LVAL_PP(month);
- d = Z_LVAL_PP(day);
-
- if (y < 1 || y > 32767) {
- RETURN_FALSE;
- }
- if (m < 1 || m > 12) {
- RETURN_FALSE;
- }
- if (d < 1 || d > phpday_tab[isleap(y)][m - 1]) {
- RETURN_FALSE;
- }
- RETURN_TRUE; /* True : This month, day, year arguments are valid */
-}
-/* }}} */
-
-#if HAVE_STRFTIME
-/* {{{ _php_strftime
- */
-void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm)
-{
- pval **format_arg, **timestamp_arg;
- char *format, *buf;
- time_t timestamp;
- struct tm *ta, tmbuf;
- int max_reallocs = 5;
- size_t buf_len=64, real_len;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &format_arg)==FAILURE) {
- RETURN_FALSE;
- }
- time(&timestamp);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &format_arg, &timestamp_arg)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(timestamp_arg);
- timestamp = Z_LVAL_PP(timestamp_arg);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string_ex(format_arg);
- if (Z_STRLEN_PP(format_arg)==0) {
- RETURN_FALSE;
- }
- if (timestamp < 0) {
- RETURN_FALSE;
- }
- format = Z_STRVAL_PP(format_arg);
- if (gm) {
- ta = php_gmtime_r(&timestamp, &tmbuf);
- } else {
- ta = php_localtime_r(&timestamp, &tmbuf);
- }
-
- buf = (char *) emalloc(buf_len);
- while ((real_len=strftime(buf, buf_len, format, ta))==buf_len || real_len==0) {
- buf_len *= 2;
- buf = (char *) erealloc(buf, buf_len);
- if (!--max_reallocs) {
- break;
- }
- }
-
- if (real_len && real_len != buf_len) {
- buf = (char *) erealloc(buf, real_len + 1);
- RETURN_STRINGL(buf, real_len, 0);
- }
- efree(buf);
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string strftime(string format [, int timestamp])
- Format a local time/date according to locale settings */
-PHP_FUNCTION(strftime)
-{
- _php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string gmstrftime(string format [, int timestamp])
- Format a GMT/UCT time/date according to locale settings */
-PHP_FUNCTION(gmstrftime)
-{
- _php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-#endif
-
-/* {{{ proto int strtotime(string time, int now)
- Convert string representation of date and time to a timestamp */
-PHP_FUNCTION(strtotime)
-{
- zval **z_time, **z_now;
- int argc;
- time_t now;
-
- argc = ZEND_NUM_ARGS();
-
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &z_time, &z_now)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(z_time);
- if (Z_STRLEN_PP(z_time) == 0)
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Called with empty time parameter");
- if (argc == 2) {
- convert_to_long_ex(z_now);
- now = Z_LVAL_PP(z_now);
- RETURN_LONG(php_parse_date(Z_STRVAL_PP(z_time), &now));
- } else {
- RETURN_LONG(php_parse_date(Z_STRVAL_PP(z_time), NULL));
- }
-}
-/* }}} */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/datetime.h b/ext/standard/datetime.h
deleted file mode 100644
index 6f0f368abf..0000000000
--- a/ext/standard/datetime.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef DATETIME_H
-#define DATETIME_H
-
-PHP_FUNCTION(time);
-PHP_FUNCTION(mktime);
-PHP_FUNCTION(gmmktime);
-PHP_FUNCTION(date);
-PHP_FUNCTION(idate);
-PHP_FUNCTION(gmdate);
-PHP_FUNCTION(localtime);
-PHP_FUNCTION(getdate);
-PHP_FUNCTION(checkdate);
-#if HAVE_STRFTIME
-PHP_FUNCTION(strftime);
-PHP_FUNCTION(gmstrftime);
-#endif
-PHP_FUNCTION(strtotime);
-
-int php_idate(char format, int timestamp, int gm);
-extern char *php_std_date(time_t t TSRMLS_DC);
-void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm);
-#if HAVE_STRFTIME
-void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm);
-#endif
-
-#endif /* DATETIME_H */
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
deleted file mode 100644
index 4396a54566..0000000000
--- a/ext/standard/dir.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* {{{ includes/startup/misc */
-
-#include "php.h"
-#include "fopen_wrappers.h"
-#include "file.h"
-#include "php_dir.h"
-#include "php_scandir.h"
-
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <errno.h>
-
-#ifdef PHP_WIN32
-#include "win32/readdir.h"
-#endif
-
-
-#ifdef HAVE_GLOB
-#ifndef PHP_WIN32
-#include <glob.h>
-#else
-#include "win32/glob.h"
-#endif
-#endif
-
-typedef struct {
- int default_dir;
-} php_dir_globals;
-
-#ifdef ZTS
-#define DIRG(v) TSRMG(dir_globals_id, php_dir_globals *, v)
-int dir_globals_id;
-#else
-#define DIRG(v) (dir_globals.v)
-php_dir_globals dir_globals;
-#endif
-
-#if 0
-typedef struct {
- int id;
- DIR *dir;
-} php_dir;
-
-static int le_dirp;
-#endif
-
-static zend_class_entry *dir_class_entry_ptr;
-
-#define FETCH_DIRP() \
- if (ZEND_NUM_ARGS() == 0) { \
- myself = getThis(); \
- if (myself) { \
- if (zend_hash_find(Z_OBJPROP_P(myself), "handle", sizeof("handle"), (void **)&tmp) == FAILURE) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find my handle property"); \
- RETURN_FALSE; \
- } \
- ZEND_FETCH_RESOURCE(dirp, php_stream *, tmp, -1, "Directory", php_file_le_stream()); \
- } else { \
- ZEND_FETCH_RESOURCE(dirp, php_stream *, 0, DIRG(default_dir), "Directory", php_file_le_stream()); \
- } \
- } else if ((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &id) == FAILURE) { \
- WRONG_PARAM_COUNT; \
- } else { \
- dirp = (php_stream *) zend_fetch_resource(id TSRMLS_CC, -1, "Directory", NULL, 1, php_file_le_stream()); \
- if(!dirp) \
- RETURN_FALSE; \
- }
-
-static zend_function_entry php_dir_class_functions[] = {
- PHP_FALIAS(close, closedir, NULL)
- PHP_FALIAS(rewind, rewinddir, NULL)
- PHP_STATIC_FE("read", php_if_readdir, NULL)
- {NULL, NULL, NULL}
-};
-
-
-static void php_set_default_dir(int id TSRMLS_DC)
-{
- if (DIRG(default_dir)!=-1) {
- zend_list_delete(DIRG(default_dir));
- }
-
- if (id != -1) {
- zend_list_addref(id);
- }
-
- DIRG(default_dir) = id;
-}
-
-PHP_RINIT_FUNCTION(dir)
-{
- DIRG(default_dir) = -1;
- return SUCCESS;
-}
-
-PHP_MINIT_FUNCTION(dir)
-{
- static char dirsep_str[2], pathsep_str[2];
- zend_class_entry dir_class_entry;
-
- INIT_CLASS_ENTRY(dir_class_entry, "Directory", php_dir_class_functions);
- dir_class_entry_ptr = zend_register_internal_class(&dir_class_entry TSRMLS_CC);
-
-#ifdef ZTS
- ts_allocate_id(&dir_globals_id, sizeof(php_dir_globals), NULL, NULL);
-#endif
- dirsep_str[0] = DEFAULT_SLASH;
- dirsep_str[1] = '\0';
- REGISTER_STRING_CONSTANT("DIRECTORY_SEPARATOR", dirsep_str, CONST_CS|CONST_PERSISTENT);
- pathsep_str[0] = ZEND_PATHS_SEPARATOR;
- pathsep_str[1] = '\0';
- REGISTER_STRING_CONSTANT("PATH_SEPARATOR", pathsep_str, CONST_CS|CONST_PERSISTENT);
-
-#ifdef HAVE_GLOB
-#ifdef GLOB_BRACE
- REGISTER_LONG_CONSTANT("GLOB_BRACE", GLOB_BRACE, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef GLOB_ONLYDIR
- REGISTER_LONG_CONSTANT("GLOB_ONLYDIR", GLOB_ONLYDIR, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef GLOB_MARK
- REGISTER_LONG_CONSTANT("GLOB_MARK", GLOB_MARK, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef GLOB_NOSORT
- REGISTER_LONG_CONSTANT("GLOB_NOSORT", GLOB_NOSORT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef GLOB_NOCHECK
- REGISTER_LONG_CONSTANT("GLOB_NOCHECK", GLOB_NOCHECK, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef GLOB_NOESCAPE
- REGISTER_LONG_CONSTANT("GLOB_NOESCAPE", GLOB_NOESCAPE, CONST_CS | CONST_PERSISTENT);
-#endif
-#endif
-
- return SUCCESS;
-}
-
-/* }}} */
-/* {{{ internal functions */
-
-static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
-{
- pval **arg;
- php_stream *dirp;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- dirp = php_stream_opendir(Z_STRVAL_PP(arg), ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
-
- if (dirp == NULL) {
- RETURN_FALSE;
- }
-
- php_set_default_dir(dirp->rsrc_id TSRMLS_CC);
-
- if (createobject) {
- object_init_ex(return_value, dir_class_entry_ptr);
- add_property_stringl(return_value, "path", Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), 1);
- add_property_resource(return_value, "handle", dirp->rsrc_id);
- php_stream_auto_cleanup(dirp); /* so we don't get warnings under debug */
- } else {
- php_stream_to_zval(dirp, return_value);
- }
-}
-
-/* }}} */
-/* {{{ proto mixed opendir(string path)
- Open a directory and return a dir_handle */
-
-PHP_FUNCTION(opendir)
-{
- _php_do_opendir(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-
-/* }}} */
-/* {{{ proto object dir(string directory)
- Directory class with properties, handle and class and methods read, rewind and close */
-
-PHP_FUNCTION(getdir)
-{
- _php_do_opendir(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-
-/* }}} */
-/* {{{ proto void closedir([resource dir_handle])
- Close directory connection identified by the dir_handle */
-
-PHP_FUNCTION(closedir)
-{
- pval **id, **tmp, *myself;
- php_stream *dirp;
-
- FETCH_DIRP();
-
- if (dirp->rsrc_id == DIRG(default_dir)) {
- php_set_default_dir(-1 TSRMLS_CC);
- }
-
- zend_list_delete(dirp->rsrc_id);
-}
-
-/* }}} */
-
-#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
-/* {{{ proto bool chroot(string directory)
- Change root directory */
-
-PHP_FUNCTION(chroot)
-{
- char *str;
- int ret, str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- ret = chroot(str);
-
- if (ret != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)", strerror(errno), errno);
- RETURN_FALSE;
- }
-
- ret = chdir("/");
-
- if (ret != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)", strerror(errno), errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-#endif
-
-/* {{{ proto bool chdir(string directory)
- Change the current directory */
-
-PHP_FUNCTION(chdir)
-{
- char *str;
- int ret, str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (PG(safe_mode) && !php_checkuid(str, NULL, CHECKUID_ALLOW_ONLY_FILE)) {
- RETURN_FALSE;
- }
- ret = VCWD_CHDIR(str);
-
- if (ret != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)", strerror(errno), errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-/* {{{ proto mixed getcwd(void)
- Gets the current directory */
-
-PHP_FUNCTION(getcwd)
-{
- char path[MAXPATHLEN];
- char *ret=NULL;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
-#if HAVE_GETCWD
- ret = VCWD_GETCWD(path, MAXPATHLEN);
-#elif HAVE_GETWD
- ret = VCWD_GETWD(path);
-/*
- * #warning is not ANSI C
- * #else
- * #warning no proper getcwd support for your site
- */
-#endif
-
- if (ret) {
- RETURN_STRING(path, 1);
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-/* {{{ proto void rewinddir([resource dir_handle])
- Rewind dir_handle back to the start */
-
-PHP_FUNCTION(rewinddir)
-{
- pval **id, **tmp, *myself;
- php_stream *dirp;
-
- FETCH_DIRP();
-
- php_stream_rewinddir(dirp);
-}
-/* }}} */
-
-/* {{{ proto string readdir([resource dir_handle])
- Read directory entry from dir_handle */
-
-PHP_NAMED_FUNCTION(php_if_readdir)
-{
- pval **id, **tmp, *myself;
- php_stream *dirp;
- php_stream_dirent entry;
-
- FETCH_DIRP();
-
- if (php_stream_readdir(dirp, &entry)) {
- RETURN_STRINGL(entry.d_name, strlen(entry.d_name), 1);
- }
- RETURN_FALSE;
-}
-
-/* }}} */
-
-#ifdef HAVE_GLOB
-/* {{{ proto array glob(string pattern [, int flags])
- Find pathnames matching a pattern */
-PHP_FUNCTION(glob)
-{
- char cwd[MAXPATHLEN];
- int cwd_skip = 0;
-#ifdef ZTS
- char work_pattern[MAXPATHLEN];
- char *result;
-#endif
- char *pattern = NULL;
- int pattern_len;
- long flags = 0;
- glob_t globbuf;
- int n, ret;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &pattern, &pattern_len, &flags) == FAILURE)
- return;
-
-#ifdef ZTS
- if(!IS_ABSOLUTE_PATH(pattern, pattern_len)) {
- result = VCWD_GETCWD(cwd, MAXPATHLEN);
- if (!result) {
- cwd[0] = '\0';
- }
- cwd_skip = strlen(cwd)+1;
- snprintf(work_pattern, MAXPATHLEN, "%s%c%s", cwd, DEFAULT_SLASH, pattern);
- pattern = work_pattern;
- }
-#endif
-
- globbuf.gl_offs = 0;
- if (0 != (ret = glob(pattern, flags, NULL, &globbuf))) {
-#ifdef GLOB_NOMATCH
- if (GLOB_NOMATCH == ret) {
- /* Linux handles no matches as an error condition, but FreeBSD
- * doesn't. This ensure that if no match is found, an empty array
- * is always returned so it can be used without worrying in e.g.
- * foreach() */
- array_init(return_value);
- return;
- }
-#endif
- RETURN_FALSE;
- }
-
- /* we assume that any glob pattern will match files from one directory only
- so checking the dirname of the first match should be sufficient */
- if (!globbuf.gl_pathv) {
- RETURN_FALSE;
- }
- strncpy(cwd, globbuf.gl_pathv[0], MAXPATHLEN);
- if (PG(safe_mode) && (!php_checkuid(cwd, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
- if(php_check_open_basedir(cwd TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
-
- array_init(return_value);
- for (n = 0; n < globbuf.gl_pathc; n++) {
- add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1);
- }
-
- globfree(&globbuf);
-}
-/* }}} */
-#endif
-
-/* {{{ php_alphasortr
-*/
-static int php_alphasortr(const struct dirent **a, const struct dirent **b)
-{
- return strcoll((*b)->d_name, (*a)->d_name);
-}
-/* }}} */
-
-/* {{{ proto array scandir(string dir [, int sorting_order])
- List files & directories inside the specified path */
-PHP_FUNCTION(scandir)
-{
- char *dirn;
- int dirn_len;
- int flags = 0;
- char *path;
- struct dirent **namelist;
- int n, i;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &dirn, &dirn_len, &flags) == FAILURE) {
- return;
- }
-
-#ifdef ZTS
- if(!IS_ABSOLUTE_PATH(dirn, dirn_len)) {
- path = expand_filepath(dirn, NULL TSRMLS_CC);
- } else
-#endif
- path = dirn;
-
- if (PG(safe_mode) && (!php_checkuid(path, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETVAL_FALSE;
- goto err;
- }
- if(php_check_open_basedir(path TSRMLS_CC)) {
- RETVAL_FALSE;
- goto err;
- }
-
- if (!flags) {
- n = php_scandir(path, &namelist, 0, php_alphasort);
- } else {
- n = php_scandir(path, &namelist, 0, (void *) php_alphasortr);
- }
-
- if (n < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "(errno %d): %s", errno, strerror(errno));
- RETVAL_FALSE;
- goto err;
- }
-
- array_init(return_value);
-
- for (i = 0; i < n; i++) {
- add_next_index_string(return_value, namelist[i]->d_name, 1);
- free(namelist[i]);
- }
-
- if (n) {
- free(namelist);
- }
-
-err:
- if (path && path != dirn) {
- efree(path);
- }
-
- return;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
deleted file mode 100644
index c7f996907f..0000000000
--- a/ext/standard/dl.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Brian Schaffner <brian@tool.net> |
- | Shane Caraveo <shane@caraveo.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "dl.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-#include "SAPI.h"
-
-#if defined(HAVE_LIBDL) || HAVE_MACH_O_DYLD_H
-#include <stdlib.h>
-#include <stdio.h>
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-#ifdef PHP_WIN32
-#include "win32/param.h"
-#include "win32/winutil.h"
-#define GET_DL_ERROR() php_win_err()
-#elif defined(NETWARE)
-#ifdef NEW_LIBC
-#include <sys/param.h>
-#else
-#include "netware/param.h"
-#endif
-#define GET_DL_ERROR() dlerror()
-#else
-#include <sys/param.h>
-#define GET_DL_ERROR() DL_ERROR()
-#endif
-
-#endif /* defined(HAVE_LIBDL) || HAVE_MACH_O_DYLD_H */
-
-
-/* {{{ proto int dl(string extension_filename)
- Load a PHP extension at runtime */
-PHP_FUNCTION(dl)
-{
- pval **file;
-
-#ifdef ZTS
- if ((strncmp(sapi_module.name, "cgi", 3)!=0) &&
- (strcmp(sapi_module.name, "cli")!=0) &&
- (strncmp(sapi_module.name, "embed", 5)!=0)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supported in multithreaded Web servers - use extension statements in your php.ini");
- RETURN_FALSE;
- }
-#endif
-
- /* obtain arguments */
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(file);
-
- if (!PG(enable_dl)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Dynamically loaded extentions aren't enabled");
- } else if (PG(safe_mode)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Dynamically loaded extensions aren't allowed when running in Safe Mode");
- } else {
- php_dl(*file, MODULE_TEMPORARY, return_value TSRMLS_CC);
- EG(full_tables_cleanup) = 1;
- }
-}
-
-/* }}} */
-
-
-#if defined(HAVE_LIBDL) || HAVE_MACH_O_DYLD_H
-
-#ifdef ZTS
-#define USING_ZTS 1
-#else
-#define USING_ZTS 0
-#endif
-
-/* {{{ php_dl
- */
-void php_dl(pval *file, int type, pval *return_value TSRMLS_DC)
-{
- void *handle;
- char *libpath;
- zend_module_entry *module_entry, *tmp;
- zend_module_entry *(*get_module)(void);
- int error_type;
- char *extension_dir;
-
- if (type==MODULE_PERSISTENT) {
- /* Use the configuration hash directly, the INI mechanism is not yet initialized */
- if (cfg_get_string("extension_dir", &extension_dir)==FAILURE) {
- extension_dir = PHP_EXTENSION_DIR;
- }
- } else {
- extension_dir = PG(extension_dir);
- }
-
- if (type==MODULE_TEMPORARY) {
- error_type = E_WARNING;
- } else {
- error_type = E_CORE_WARNING;
- }
-
- if (extension_dir && extension_dir[0]){
- int extension_dir_len = strlen(extension_dir);
-
- libpath = emalloc(extension_dir_len+Z_STRLEN_P(file)+2);
-
- if (IS_SLASH(extension_dir[extension_dir_len-1])) {
- sprintf(libpath, "%s%s", extension_dir, Z_STRVAL_P(file)); /* SAFE */
- } else {
- sprintf(libpath, "%s%c%s", extension_dir, DEFAULT_SLASH, Z_STRVAL_P(file)); /* SAFE */
- }
- } else {
- libpath = estrndup(Z_STRVAL_P(file), Z_STRLEN_P(file));
- }
-
- /* load dynamic symbol */
- handle = DL_LOAD(libpath);
- if (!handle) {
- php_error_docref(NULL TSRMLS_CC, error_type, "Unable to load dynamic library '%s' - %s", libpath, GET_DL_ERROR());
- efree(libpath);
- RETURN_FALSE;
- }
-
- efree(libpath);
-
-#ifndef NETWARE
- get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module");
-
- /*
- * some OS prepend _ to symbol names while their dynamic linker
- * does not do that automatically. Thus we check manually for
- * _get_module.
- */
-
- if (!get_module)
- get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "_get_module");
-#else
- /* NetWare doesn't support two NLMs exporting same symbol */
- {
- char symbol_name[64] = "\0";
- int module_name_length = Z_STRLEN_P(file) - 4; /* '.nlm' is 4 characters; knock it off */
-
- /* Take the module name (e.g.: 'php_ldap') and append '@get_module' to it */
- strncpy(symbol_name, Z_STRVAL_P(file), module_name_length);
- symbol_name[module_name_length] = '\0';
- strcat(symbol_name, "@");
- strcat(symbol_name, "get_module");
-
- get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, symbol_name);
- }
- /* NetWare doesn't prepend '_' to symbol names; so the corresponding portion of code is also
- not required for NetWare */
-#endif
-
- if (!get_module) {
- DL_UNLOAD(handle);
- php_error_docref(NULL TSRMLS_CC, error_type, "Invalid library (maybe not a PHP library) '%s' ", Z_STRVAL_P(file));
- RETURN_FALSE;
- }
- module_entry = get_module();
- if ((module_entry->zend_debug != ZEND_DEBUG) || (module_entry->zts != USING_ZTS)
- || (module_entry->zend_api != ZEND_MODULE_API_NO)) {
- /* Check for pre-4.1.0 module which has a slightly different module_entry structure :( */
- struct pre_4_1_0_module_entry {
- char *name;
- zend_function_entry *functions;
- int (*module_startup_func)(INIT_FUNC_ARGS);
- int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS);
- int (*request_startup_func)(INIT_FUNC_ARGS);
- int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS);
- void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS);
- int (*global_startup_func)(void);
- int (*global_shutdown_func)(void);
- int globals_id;
- int module_started;
- unsigned char type;
- void *handle;
- int module_number;
- unsigned char zend_debug;
- unsigned char zts;
- unsigned int zend_api;
- };
-
- char *name;
- int zend_api;
- unsigned char zend_debug, zts;
-
- if(( ((struct pre_4_1_0_module_entry *)module_entry)->zend_api > 20000000)
- &&(((struct pre_4_1_0_module_entry *)module_entry)->zend_api < 20010901)) {
- name = ((struct pre_4_1_0_module_entry *)module_entry)->name;
- zend_api = ((struct pre_4_1_0_module_entry *)module_entry)->zend_api;
- zend_debug = ((struct pre_4_1_0_module_entry *)module_entry)->zend_debug;
- zts = ((struct pre_4_1_0_module_entry *)module_entry)->zts;
- } else {
- name = module_entry->name;
- zend_api = module_entry->zend_api;
- zend_debug = module_entry->zend_debug;
- zts = module_entry->zts;
- }
-
- php_error_docref(NULL TSRMLS_CC, error_type,
- "%s: Unable to initialize module\n"
- "Module compiled with module API=%d, debug=%d, thread-safety=%d\n"
- "PHP compiled with module API=%d, debug=%d, thread-safety=%d\n"
- "These options need to match\n",
- name, zend_api, zend_debug, zts,
- ZEND_MODULE_API_NO, ZEND_DEBUG, USING_ZTS);
- DL_UNLOAD(handle);
- RETURN_FALSE;
- }
- Z_TYPE_P(module_entry) = type;
- module_entry->module_number = zend_next_free_module();
- if (module_entry->module_startup_func) {
- if (module_entry->module_startup_func(type, module_entry->module_number TSRMLS_CC)==FAILURE) {
- php_error_docref(NULL TSRMLS_CC, error_type, "Unable to initialize module '%s'", module_entry->name);
- DL_UNLOAD(handle);
- RETURN_FALSE;
- }
- }
- zend_register_module(module_entry);
-
- if ((type == MODULE_TEMPORARY) && module_entry->request_startup_func) {
- if (module_entry->request_startup_func(type, module_entry->module_number TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, error_type, "Unable to initialize module '%s'", module_entry->name);
- DL_UNLOAD(handle);
- RETURN_FALSE;
- }
- }
-
- /* update the .request_started property... */
- if (zend_hash_find(&module_registry, module_entry->name, strlen(module_entry->name)+1, (void **) &tmp)==FAILURE) {
- php_error_docref(NULL TSRMLS_CC, error_type, "Loaded module '%s' got lost", module_entry->name);
- RETURN_FALSE;
- }
- tmp->handle = handle;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-PHP_MINFO_FUNCTION(dl)
-{
- php_info_print_table_row(2, "Dynamic Library Support", "enabled");
-}
-
-#else
-
-void php_dl(pval *file, int type, pval *return_value TSRMLS_DC)
-{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot dynamically load %s - dynamic modules are not supported", Z_STRVAL_P(file));
- RETURN_FALSE;
-}
-
-PHP_MINFO_FUNCTION(dl)
-{
- PUTS("Dynamic Library support not available<br />.\n");
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/dl.h b/ext/standard/dl.h
deleted file mode 100644
index 34110a4671..0000000000
--- a/ext/standard/dl.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Brian Schaffner <brian@tool.net> |
- | Shane Caraveo <shane@caraveo.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef DL_H
-#define DL_H
-
-void php_dl(pval *file,int type,pval *return_value TSRMLS_DC);
-
-
-/* dynamic loading functions */
-PHP_FUNCTION(dl);
-
-PHP_MINFO_FUNCTION(dl);
-
-#endif /* DL_H */
diff --git a/ext/standard/dns.c b/ext/standard/dns.c
deleted file mode 100644
index 3e08c54c2e..0000000000
--- a/ext/standard/dns.c
+++ /dev/null
@@ -1,797 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: The typical suspects |
- | Pollita <pollita@php.net> |
- | Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* {{{ includes */
-#include "php.h"
-
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifdef PHP_WIN32
-#if HAVE_LIBBIND
-#ifndef WINNT
-#define WINNT 1
-#endif
-/* located in www.php.net/extra/bindlib.zip */
-#if HAVE_ARPA_INET_H
-#include "arpa/inet.h"
-#endif
-#include "netdb.h"
-#if HAVE_ARPA_NAMESERV_H
-#include "arpa/nameser.h"
-#endif
-#if HAVE_RESOLV_H
-#include "resolv.h"
-#endif
-#endif /* HAVE_LIBBIND */
-#include <winsock2.h>
-#else /* This holds good for NetWare too, both for Winsock and Berkeley sockets */
-#include <netinet/in.h>
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#include <netdb.h>
-#ifdef _OSD_POSIX
-#undef STATUS
-#undef T_UNSPEC
-#endif
-#if HAVE_ARPA_NAMESER_H
-#include <arpa/nameser.h>
-#endif
-#if HAVE_RESOLV_H
-#include <resolv.h>
-#endif
-#endif
-
-/* Borrowed from SYS/SOCKET.H */
-#if defined(NETWARE) && defined(USE_WINSOCK)
-#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
-#endif
-
-#include "dns.h"
-/* }}} */
-
-static char *php_gethostbyaddr(char *ip);
-static char *php_gethostbyname(char *name);
-
-/* {{{ proto string gethostbyaddr(string ip_address)
- Get the Internet host name corresponding to a given IP address */
-PHP_FUNCTION(gethostbyaddr)
-{
- zval **arg;
- char *addr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(arg);
-
- addr = php_gethostbyaddr(Z_STRVAL_PP(arg));
-
- if(addr == NULL) {
-#if HAVE_IPV6 && !defined(__MacOSX__)
-/* MacOSX at this time has support for IPv6, but not inet_pton()
- * so disabling IPv6 until further notice. MacOSX 10.1.2 (kalowsky) */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Address is not a valid IPv4 or IPv6 address");
-#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Address is not in a.b.c.d form");
-#endif
- RETVAL_FALSE;
- } else {
- RETVAL_STRING(addr, 0);
- }
-}
-/* }}} */
-
-/* {{{ php_gethostbyaddr */
-static char *php_gethostbyaddr(char *ip)
-{
-#if HAVE_IPV6 && !defined(__MacOSX__)
-/* MacOSX at this time has support for IPv6, but not inet_pton()
- * so disabling IPv6 until further notice. MacOSX 10.1.2 (kalowsky) */
- struct in6_addr addr6;
-#endif
- struct in_addr addr;
- struct hostent *hp;
-
-#if HAVE_IPV6 && !defined(__MacOSX__)
-/* MacOSX at this time has support for IPv6, but not inet_pton()
- * so disabling IPv6 until further notice. MacOSX 10.1.2 (kalowsky) */
- if (inet_pton(AF_INET6, ip, &addr6)) {
- hp = gethostbyaddr((char *) &addr6, sizeof(addr6), AF_INET6);
- } else if (inet_pton(AF_INET, ip, &addr)) {
- hp = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET);
- } else {
- return NULL;
- }
-#else
- addr.s_addr = inet_addr(ip);
-
- if (addr.s_addr == -1) {
- return NULL;
- }
-
- hp = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET);
-#endif
-
- if (!hp || hp->h_name == NULL || hp->h_name[0] == '\0') {
- return estrdup(ip);
- }
-
- return estrdup(hp->h_name);
-}
-/* }}} */
-
-/* {{{ proto string gethostbyname(string hostname)
- Get the IP address corresponding to a given Internet host name */
-PHP_FUNCTION(gethostbyname)
-{
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(arg);
-
- RETVAL_STRING(php_gethostbyname(Z_STRVAL_PP(arg)), 0);
-}
-/* }}} */
-
-/* {{{ proto array gethostbynamel(string hostname)
- Return a list of IP addresses that a given hostname resolves to. */
-PHP_FUNCTION(gethostbynamel)
-{
- zval **arg;
- struct hostent *hp;
- struct in_addr in;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(arg);
-
- array_init(return_value);
-
- hp = gethostbyname(Z_STRVAL_PP(arg));
- if (hp == NULL || hp->h_addr_list == NULL) {
- RETURN_FALSE;
- }
-
- for (i = 0 ; hp->h_addr_list[i] != 0 ; i++) {
- in = *(struct in_addr *) hp->h_addr_list[i];
- add_next_index_string(return_value, inet_ntoa(in), 1);
- }
-}
-/* }}} */
-
-/* {{{ php_gethostbyname */
-static char *php_gethostbyname(char *name)
-{
- struct hostent *hp;
- struct in_addr in;
-
- hp = gethostbyname(name);
-
- if (!hp || !*(hp->h_addr_list)) {
- return estrdup(name);
- }
-
- memcpy(&in.s_addr, *(hp->h_addr_list), sizeof(in.s_addr));
-
- return estrdup(inet_ntoa(in));
-}
-/* }}} */
-
-#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32) || defined(NETWARE))
-
-/* {{{ proto int dns_check_record(string host [, string type])
- Check DNS records corresponding to a given Internet host name or IP address */
-PHP_FUNCTION(dns_check_record)
-{
- zval **arg1, **arg2;
- int type, i;
-#ifndef MAXPACKET
-#define MAXPACKET 8192 /* max packet size used internally by BIND */
-#endif
- u_char ans[MAXPACKET];
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- type = T_MX;
- convert_to_string_ex(arg1);
- break;
-
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
-
- if (!strcasecmp("A", Z_STRVAL_PP(arg2))) type = T_A;
- else if (!strcasecmp("NS", Z_STRVAL_PP(arg2))) type = T_NS;
- else if (!strcasecmp("MX", Z_STRVAL_PP(arg2))) type = T_MX;
- else if (!strcasecmp("PTR", Z_STRVAL_PP(arg2))) type = T_PTR;
- else if (!strcasecmp("ANY", Z_STRVAL_PP(arg2))) type = T_ANY;
- else if (!strcasecmp("SOA", Z_STRVAL_PP(arg2))) type = T_SOA;
- else if (!strcasecmp("CNAME", Z_STRVAL_PP(arg2))) type = T_CNAME;
-#ifdef T_AAAA
- else if (!strcasecmp("AAAA", Z_STRVAL_PP(arg2))) type = T_AAAA;
-#endif
-#ifdef T_SRV
- else if (!strcasecmp("SRV", Z_STRVAL_PP(arg2))) type = T_SRV;
-#endif
-#ifdef T_NAPTR
- else if (!strcasecmp("NAPTR", Z_STRVAL_PP(arg2))) type = T_NAPTR;
-#endif
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type '%s' not supported", Z_STRVAL_PP(arg2));
- RETURN_FALSE;
- }
- break;
-
- default:
- WRONG_PARAM_COUNT;
- }
-
- i = res_search(Z_STRVAL_PP(arg1), C_IN, type, ans, sizeof(ans));
-
- if (i < 0) {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#if HAVE_DNS_FUNCS
-
-#define PHP_DNS_NUM_TYPES 11 /* Number of DNS Types Supported by PHP currently */
-
-#define PHP_DNS_A 0x00000001
-#define PHP_DNS_NS 0x00000002
-#define PHP_DNS_CNAME 0x00000010
-#define PHP_DNS_SOA 0x00000020
-#define PHP_DNS_PTR 0x00000800
-#define PHP_DNS_HINFO 0x00001000
-#define PHP_DNS_MX 0x00004000
-#define PHP_DNS_TXT 0x00008000
-#define PHP_DNS_SRV 0x02000000
-#define PHP_DNS_NAPTR 0x04000000
-#define PHP_DNS_AAAA 0x08000000
-#define PHP_DNS_ANY 0x10000000
-#define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA|PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_MX|PHP_DNS_TXT|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_AAAA)
-
-PHP_MINIT_FUNCTION(dns) {
- REGISTER_LONG_CONSTANT("DNS_A", PHP_DNS_A, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DNS_NS", PHP_DNS_NS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DNS_CNAME", PHP_DNS_CNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DNS_SOA", PHP_DNS_SOA, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DNS_PTR", PHP_DNS_PTR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DNS_HINFO", PHP_DNS_HINFO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DNS_MX", PHP_DNS_MX, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DNS_TXT", PHP_DNS_TXT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DNS_SRV", PHP_DNS_SRV, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DNS_NAPTR", PHP_DNS_NAPTR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DNS_AAAA", PHP_DNS_AAAA, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DNS_ANY", PHP_DNS_ANY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DNS_ALL", PHP_DNS_ALL, CONST_CS | CONST_PERSISTENT);
- return SUCCESS;
-}
-
-#ifndef HFIXEDSZ
-#define HFIXEDSZ 12 /* fixed data in header <arpa/nameser.h> */
-#endif /* HFIXEDSZ */
-
-#ifndef QFIXEDSZ
-#define QFIXEDSZ 4 /* fixed data in query <arpa/nameser.h> */
-#endif /* QFIXEDSZ */
-
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 256
-#endif /* MAXHOSTNAMELEN */
-
-#ifndef MAXRESOURCERECORDS
-#define MAXRESOURCERECORDS 64
-#endif /* MAXRESOURCERECORDS */
-
-typedef union {
- HEADER qb1;
- u_char qb2[65536];
-} querybuf;
-
-/* {{{ php_parserr */
-static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int store, zval **subarray) {
- u_short type, class, dlen;
- u_long ttl;
- long n, i;
- u_short s;
- u_char *tp;
- char name[MAXHOSTNAMELEN];
-
- n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof(name)) - 2);
- if (n < 0) {
- return NULL;
- }
- cp += n;
-
- GETSHORT(type, cp);
- GETSHORT(class, cp);
- GETLONG(ttl, cp);
- GETSHORT(dlen, cp);
- if (type_to_fetch != T_ANY && type != type_to_fetch) {
- *subarray = NULL;
- cp += dlen;
- return cp;
- }
-
- if (!store) {
- *subarray = NULL;
- cp += dlen;
- return cp;
- }
-
- MAKE_STD_ZVAL(*subarray);
- array_init(*subarray);
-
- add_assoc_string(*subarray, "host", name, 1);
- switch (type) {
- case T_A:
- add_assoc_string(*subarray, "type", "A", 1);
- sprintf(name, "%d.%d.%d.%d", cp[0], cp[1], cp[2], cp[3]);
- add_assoc_string(*subarray, "ip", name, 1);
- cp += dlen;
- break;
- case T_MX:
- add_assoc_string(*subarray, "type", "MX", 1);
- GETSHORT(n, cp);
- add_assoc_long(*subarray, "pri", n);
- /* no break; */
- case T_CNAME:
- if (type == T_CNAME)
- add_assoc_string(*subarray, "type", "CNAME", 1);
- /* no break; */
- case T_NS:
- if (type == T_NS)
- add_assoc_string(*subarray, "type", "NS", 1);
- /* no break; */
- case T_PTR:
- if (type == T_PTR)
- add_assoc_string(*subarray, "type", "PTR", 1);
- n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2);
- if (n < 0) {
- return NULL;
- }
- cp += n;
- add_assoc_string(*subarray, "target", name, 1);
- break;
- case T_HINFO:
- /* See RFC 1010 for values */
- add_assoc_string(*subarray, "type", "HINFO", 1);
- n = *cp & 0xFF;
- cp++;
- add_assoc_stringl(*subarray, "cpu", cp, n, 1);
- cp += n;
- n = *cp & 0xFF;
- cp++;
- add_assoc_stringl(*subarray, "os", cp, n, 1);
- cp += n;
- break;
- case T_TXT:
- add_assoc_string(*subarray, "type", "TXT", 1);
- n = cp[0];
- for(i=1; i<=n; i++)
- name[i-1] = cp[i];
- name[i-1] = '\0';
- cp += dlen;
- add_assoc_string(*subarray, "txt", name, 1);
- break;
- case T_SOA:
- add_assoc_string(*subarray, "type", "SOA", 1);
- n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) -2);
- if (n < 0) {
- return NULL;
- }
- cp += n;
- add_assoc_string(*subarray, "mname", name, 1);
- n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) -2);
- if (n < 0) {
- return NULL;
- }
- cp += n;
- add_assoc_string(*subarray, "rname", name, 1);
- GETLONG(n, cp);
- add_assoc_long(*subarray, "serial", n);
- GETLONG(n, cp);
- add_assoc_long(*subarray, "refresh", n);
- GETLONG(n, cp);
- add_assoc_long(*subarray, "retry", n);
- GETLONG(n, cp);
- add_assoc_long(*subarray, "expire", n);
- GETLONG(n, cp);
- add_assoc_long(*subarray, "minimum-ttl", n);
- break;
-
-#ifdef T_AAAA
- case T_AAAA:
- tp = name;
- for(i=0; i < 8; i++) {
- GETSHORT(s, cp);
- if (s > 0) {
- if (tp > (u_char *)name) {
- tp[0] = ':';
- tp++;
- }
- sprintf(tp,"%x",s);
- tp += strlen(tp);
- } else if (s == 0) {
- if ((tp > (u_char *)name) && (tp[-1] != ':')) {
- tp[0] = ':';
- tp++;
- }
- }
- }
- if ((tp > (u_char *)name) && (tp[-1] == ':'))
- tp[-1] = '\0';
- tp[0] = '\0';
- add_assoc_string(*subarray, "type", "AAAA", 1);
- add_assoc_string(*subarray, "ipv6", name, 1);
- break;
-#endif
-#ifdef T_SRV
- case T_SRV:
- add_assoc_string(*subarray, "type", "SRV", 1);
- GETSHORT(n, cp);
- add_assoc_long(*subarray, "pri", n);
- GETSHORT(n, cp);
- add_assoc_long(*subarray, "weight", n);
- GETSHORT(n, cp);
- add_assoc_long(*subarray, "port", n);
- n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2);
- if (n < 0) {
- return NULL;
- }
- cp += n;
- add_assoc_string(*subarray, "target", name, 1);
- break;
-#endif
-#ifdef T_NAPTR
- case T_NAPTR:
- add_assoc_string(*subarray, "type", "NAPTR", 1);
- GETSHORT(n, cp);
- add_assoc_long(*subarray, "order", n);
- GETSHORT(n, cp);
- add_assoc_long(*subarray, "pref", n);
- n = (cp[0] & 0xFF);
- add_assoc_stringl(*subarray, "flags", ++cp, n, 1);
- cp += n;
- n = (cp[0] & 0xFF);
- add_assoc_stringl(*subarray, "services", ++cp, n, 1);
- cp += n;
- n = (cp[0] & 0xFF);
- add_assoc_stringl(*subarray, "regex", ++cp, n, 1);
- cp += n;
- n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2);
- if (n < 0) {
- return NULL;
- }
- cp += n;
- add_assoc_string(*subarray, "replacement", name, 1);
- break;
-#endif
- default:
- cp += dlen;
- }
-
- add_assoc_string(*subarray, "class", "IN", 1);
- add_assoc_long(*subarray, "ttl", ttl);
-
- return cp;
-}
-/* }}} */
-
-/* {{{ proto array|false dns_get_record(string hostname [, int type[, array authns, array addtl]])
- Get any Resource Record corresponding to a given Internet host name */
-PHP_FUNCTION(dns_get_record)
-{
- zval *subarray[MAXRESOURCERECORDS];
- pval *addtl, *host, *authns, *fetch_type;
- int addtl_recs = 0;
- int type_to_fetch, type_param = PHP_DNS_ANY;
- int current_subarray = 0;
- struct __res_state res;
- HEADER *hp;
- querybuf buf, answer, *ans;
- u_char *cp = NULL, *end = NULL;
- long n, qd, an, ns = 0, ar = 0;
- int type, first_query = 1, store_results = 1;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters(ht, 1, &host) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (zend_get_parameters(ht, 2, &host, &fetch_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- type_param = Z_LVAL_P(fetch_type);
- break;
- case 4:
- if (zend_get_parameters(ht, 4, &host, &fetch_type, &authns, &addtl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- type_param = Z_LVAL_P(fetch_type);
- pval_destructor(authns);
- addtl_recs = 1; /* We want the additional Records */
- array_init(authns);
- pval_destructor(addtl);
- array_init(addtl);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(host);
-
- if (type_param&~PHP_DNS_ALL && type_param!=PHP_DNS_ANY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type '%d' not supported", type_param);
- RETURN_FALSE;
- }
-
- /* Initialize the return array */
- array_init(return_value);
-
- /* - We emulate an or'ed type mask by querying type by type. (Steps 0 - NUMTYPES-1 )
- * If additional info is wanted we check again with T_ANY (step NUMTYPES / NUMTYPES+1 )
- * store_results is used to skip storing the results retrieved in step
- * NUMTYPES+1 when results were already fetched.
- * - In case of PHP_DNS_ANY we use the directly fetch T_ANY. (step NUMTYPES+1 )
- */
- for(type = (type_param==PHP_DNS_ANY ? (PHP_DNS_NUM_TYPES + 1) : 0); type < (addtl_recs ? (PHP_DNS_NUM_TYPES + 2) : PHP_DNS_NUM_TYPES) || first_query; type++)
- {
- first_query = 0;
- switch(type) {
- case 0:
- type_to_fetch = type_param&PHP_DNS_A ? T_A : 0;
- break;
- case 1:
- type_to_fetch = type_param&PHP_DNS_NS ? T_NS : 0;
- break;
- case 2:
- type_to_fetch = type_param&PHP_DNS_CNAME ? T_CNAME : 0;
- break;
- case 3:
- type_to_fetch = type_param&PHP_DNS_SOA ? T_SOA : 0;
- break;
- case 4:
- type_to_fetch = type_param&PHP_DNS_PTR ? T_PTR : 0;
- break;
- case 5:
- type_to_fetch = type_param&PHP_DNS_HINFO ? T_HINFO : 0;
- break;
- case 6:
- type_to_fetch = type_param&PHP_DNS_MX ? T_MX : 0;
- break;
- case 7:
- type_to_fetch = type_param&PHP_DNS_TXT ? T_TXT : 0;
- break;
- case 8:
-#ifdef T_AAAA
- type_to_fetch = type_param&PHP_DNS_AAAA ? T_AAAA : 0;
- break;
-#else
- continue;
-#endif
- case 9:
-#ifdef T_SRV
- type_to_fetch = type_param&PHP_DNS_SRV ? T_SRV : 0;
- break;
-#else
- continue;
-#endif
- case 10:
-#ifdef T_NAPTR
- type_to_fetch = type_param&PHP_DNS_NAPTR ? T_NAPTR : 0;
- break;
-#else
- continue;
-#endif
-
- case PHP_DNS_NUM_TYPES:
- store_results = 0;
- continue;
- default:
- case (PHP_DNS_NUM_TYPES + 1):
- type_to_fetch = T_ANY;
- break;
- }
- if (type_to_fetch) {
- res_ninit(&res);
- res.retrans = 5;
- res.options &= ~RES_DEFNAMES;
-
- n = res_nmkquery(&res, QUERY, Z_STRVAL_P(host), C_IN, type_to_fetch, NULL, 0, NULL, buf.qb2, sizeof buf);
- if (n<0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "res_nmkquery() failed");
- zval_dtor(return_value);
- RETURN_FALSE;
- }
- n = res_nsend(&res, buf.qb2, n, answer.qb2, sizeof answer);
- if (n<0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "res_nsend() failed");
- zval_dtor(return_value);
- RETURN_FALSE;
- }
-
- cp = answer.qb2 + HFIXEDSZ;
- end = answer.qb2 + n;
- ans = &answer;
- hp = (HEADER *)ans;
- qd = ntohs(hp->qdcount);
- an = ntohs(hp->ancount);
- ns = ntohs(hp->nscount);
- ar = ntohs(hp->arcount);
-
- /* Skip QD entries, they're only used by dn_expand later on */
- while (qd-- > 0) {
- n = dn_skipname(cp, end);
- if (n < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to parse DNS data received");
- zval_dtor(return_value);
- RETURN_FALSE;
- }
- cp += n + QFIXEDSZ;
- }
-
- /* YAY! Our real answers! */
- while (an-- && cp && cp < end) {
- cp = php_parserr(cp, &answer, type_to_fetch, store_results, &subarray[current_subarray]);
- if (subarray[current_subarray] != NULL && store_results)
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&subarray[current_subarray], sizeof(zval *), NULL);
- current_subarray++;
- }
- res_nclose(&res);
- }
- }
-
- if (addtl_recs) {
- /* List of Authoritative Name Servers */
- while (ns-- > 0 && cp && cp < end) {
- cp = php_parserr(cp, &answer, T_ANY, 1, &subarray[current_subarray]);
- if (subarray[current_subarray] != NULL)
- zend_hash_next_index_insert(HASH_OF(authns), (void *)&subarray[current_subarray], sizeof(zval *), NULL);
- current_subarray++;
- }
- /* Additional records associated with authoritative name servers */
- while (ar-- > 0 && cp && cp < end) {
- cp = php_parserr(cp, &answer, T_ANY, 1, &subarray[current_subarray]);
- if (subarray[current_subarray] != NULL)
- zend_hash_next_index_insert(HASH_OF(addtl), (void *)&subarray[current_subarray], sizeof(zval *), NULL);
- current_subarray++;
- }
- }
-}
-/* }}} */
-#endif /* HAVE_DNS_FUNCS */
-
-#if HAVE_DN_SKIPNAME && HAVE_DN_EXPAND
-/* {{{ proto bool dns_get_mx(string hostname, array mxhosts [, array weight])
- Get MX records corresponding to a given Internet host name */
-PHP_FUNCTION(dns_get_mx)
-{
- pval *host, *mx_list, *weight_list;
- int need_weight = 0;
- int count, qdc;
- u_short type, weight;
- u_char ans[MAXPACKET];
- char buf[MAXHOSTNAMELEN];
- HEADER *hp;
- u_char *cp, *end;
- int i;
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters(ht, 2, &host, &mx_list) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
-
- case 3:
- if (zend_get_parameters(ht, 3, &host, &mx_list, &weight_list) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- need_weight = 1;
- pval_destructor(weight_list); /* start with clean array */
- array_init(weight_list);
- break;
-
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(host);
- pval_destructor(mx_list); /* start with clean array */
- array_init(mx_list);
-
- /* Go! */
- i = res_search(Z_STRVAL_P(host), C_IN, T_MX, (u_char *)&ans, sizeof(ans));
- if (i < 0) {
- RETURN_FALSE;
- }
- if (i > sizeof(ans)) {
- i = sizeof(ans);
- }
- hp = (HEADER *)&ans;
- cp = (u_char *)&ans + HFIXEDSZ;
- end = (u_char *)&ans +i;
- for (qdc = ntohs((unsigned short)hp->qdcount); qdc--; cp += i + QFIXEDSZ) {
- if ((i = dn_skipname(cp, end)) < 0 ) {
- RETURN_FALSE;
- }
- }
- count = ntohs((unsigned short)hp->ancount);
- while (--count >= 0 && cp < end) {
- if ((i = dn_skipname(cp, end)) < 0 ) {
- RETURN_FALSE;
- }
- cp += i;
- GETSHORT(type, cp);
- cp += INT16SZ + INT32SZ;
- GETSHORT(i, cp);
- if (type != T_MX) {
- cp += i;
- continue;
- }
- GETSHORT(weight, cp);
- if ((i = dn_expand(ans, end, cp, buf, sizeof(buf)-1)) < 0) {
- RETURN_FALSE;
- }
- cp += i;
- add_next_index_string(mx_list, buf, 1);
- if (need_weight) {
- add_next_index_long(weight_list, weight);
- }
- }
- RETURN_TRUE;
-}
-/* }}} */
-#endif /* HAVE_DN_SKIPNAME && HAVE_DN_EXPAND */
-
-#endif /* HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32) || defined(NETWARE)) */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/dns.h b/ext/standard/dns.h
deleted file mode 100644
index 303d4705dc..0000000000
--- a/ext/standard/dns.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: The typical suspects |
- | Marcus Boerger <helly@php.net> |
- | Pollita <pollita@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef DNS_H
-#define DNS_H
-
-#if HAVE_RES_NMKQUERY & HAVE_RES_NSEND & HAVE_DN_EXPAND & HAVE_DN_SKIPNAME
-#define HAVE_DNS_FUNCS 1
-#endif
-
-PHP_FUNCTION(gethostbyaddr);
-PHP_FUNCTION(gethostbyname);
-PHP_FUNCTION(gethostbynamel);
-
-#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32))
-
-PHP_FUNCTION(dns_check_record);
-# if HAVE_DN_SKIPNAME && HAVE_DN_EXPAND
-PHP_FUNCTION(dns_get_mx);
-# endif
-
-# if HAVE_DNS_FUNCS
-
-PHP_FUNCTION(dns_get_record);
-
-PHP_MINIT_FUNCTION(dns);
-
-# endif
-#endif
-
-#ifndef INT16SZ
-#define INT16SZ 2
-#endif
-
-#ifndef INT32SZ
-#define INT32SZ 4
-#endif
-
-#endif /* DNS_H */
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
deleted file mode 100644
index da7a854d29..0000000000
--- a/ext/standard/exec.c
+++ /dev/null
@@ -1,445 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@php.net> |
- | Ilia Alshanetsky <iliaa@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdio.h>
-#include "php.h"
-#include <ctype.h>
-#include "php_string.h"
-#include "safe_mode.h"
-#include "ext/standard/head.h"
-#include "ext/standard/file.h"
-#include "exec.h"
-#include "php_globals.h"
-#include "SAPI.h"
-
-#if HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#if HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-
-#if HAVE_NICE && HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-/* {{{ php_exec
- * If type==0, only last line of output is returned (exec)
- * If type==1, all lines will be printed and last lined returned (system)
- * If type==2, all lines will be saved to given array (exec with &$array)
- * If type==3, output will be printed binary, no lines will be saved or returned (passthru)
- *
- */
-int php_exec(int type, char *cmd, pval *array, pval *return_value TSRMLS_DC)
-{
- FILE *fp;
- char *buf, *tmp=NULL;
- int buflen, l, pclose_return;
- char *cmd_p, *b, *c, *d=NULL;
- php_stream *stream;
- size_t bufl = 0;
-#if PHP_SIGCHILD
- void (*sig_handler)();
-#endif
-
- if (PG(safe_mode)) {
- if ((c = strchr(cmd, ' '))) {
- *c = '\0';
- c++;
- }
- if (strstr(cmd, "..")) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No '..' components allowed in path");
- goto err;
- }
- b = strrchr(cmd, PHP_DIR_SEPARATOR);
- spprintf(&d, 0, "%s%s%s%s", PG(safe_mode_exec_dir), (b ? "" : "/"), (b ? b : cmd), (c ? " " : ""), (c ? c : ""));
- if (c) {
- *(c - 1) = ' ';
- }
- cmd_p = php_escape_shell_cmd(d);
- efree(d);
- d = cmd_p;
- } else {
- cmd_p = cmd;
- }
-
-#if PHP_SIGCHILD
- sig_handler = signal (SIGCHLD, SIG_DFL);
-#endif
-
-#ifdef PHP_WIN32
- fp = VCWD_POPEN(cmd_p, "rb");
-#else
- fp = VCWD_POPEN(cmd_p, "r");
-#endif
- if (!fp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to fork [%s]", cmd);
- goto err;
- }
-
- stream = php_stream_fopen_from_pipe(fp, "rb");
-
- buf = (char *) emalloc(EXEC_INPUT_BUF);
- buflen = EXEC_INPUT_BUF;
-
- if (type != 3) {
- b = buf;
-
- while (php_stream_get_line(stream, b, EXEC_INPUT_BUF, &bufl)) {
- /* no new line found, let's read some more */
- if (b[bufl - 1] != '\n' && !php_stream_eof(stream)) {
- if (buflen < (bufl + EXEC_INPUT_BUF)) {
- bufl += b - buf;
- buflen = bufl + EXEC_INPUT_BUF;
- buf = erealloc(buf, buflen);
- b = buf + bufl;
- } else {
- b += bufl;
- }
- continue;
- } else if (b != buf) {
- bufl += buflen - EXEC_INPUT_BUF;
- }
-
- if (type == 1) {
- PHPWRITE(buf, bufl);
- sapi_flush(TSRMLS_C);
- } else if (type == 2) {
- /* strip trailing whitespaces */
- l = bufl;
- while (l-- && isspace(((unsigned char *)buf)[l]));
- if (l != (bufl - 1)) {
- bufl = l + 1;
- buf[bufl] = '\0';
- }
- add_next_index_stringl(array, buf, bufl, 1);
- }
- b = buf;
- }
- if (bufl) {
- /* strip trailing whitespaces if we have not done so already */
- if (type != 2) {
- l = bufl;
- while (l-- && isspace(((unsigned char *)buf)[l]));
- if (l != (bufl - 1)) {
- bufl = l + 1;
- buf[bufl] = '\0';
- }
- }
-
- /* Return last line from the shell command */
- if (PG(magic_quotes_runtime)) {
- int len;
-
- tmp = php_addslashes(buf, bufl, &len, 0 TSRMLS_CC);
- RETVAL_STRINGL(tmp, len, 0);
- } else {
- RETVAL_STRINGL(buf, bufl, 1);
- }
- } else { /* should return NULL, but for BC we return "" */
- RETVAL_EMPTY_STRING();
- }
- } else {
- while((bufl = php_stream_read(stream, buf, EXEC_INPUT_BUF)) > 0) {
- PHPWRITE(buf, bufl);
- }
- }
-
- pclose_return = php_stream_close(stream);
- efree(buf);
-
-done:
-#if PHP_SIGCHILD
- signal (SIGCHLD, sig_handler);
-#endif
- if (d) {
- efree(d);
- }
- return pclose_return;
-err:
- pclose_return = -1;
- goto done;
-}
-/* }}} */
-
-static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- char *cmd;
- int cmd_len;
- zval *ret_code=NULL, *ret_array=NULL;
- int ret;
-
- if (mode) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &cmd, &cmd_len, &ret_code) == FAILURE) {
- RETURN_FALSE;
- }
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zz", &cmd, &cmd_len, &ret_array, &ret_code) == FAILURE) {
- RETURN_FALSE;
- }
- }
- if (!cmd_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot execute a blank command");
- RETURN_FALSE;
- }
-
- if (!ret_array) {
- ret = php_exec(mode, cmd, NULL, return_value TSRMLS_CC);
- } else {
- zval_dtor(ret_array);
- array_init(ret_array);
- ret = php_exec(2, cmd, ret_array, return_value TSRMLS_CC);
- }
- if (ret_code) {
- zval_dtor(ret_code);
- ZVAL_LONG(ret_code, ret);
- }
-}
-
-/* {{{ proto string exec(string command [, array &output [, int &return_value]])
- Execute an external program */
-PHP_FUNCTION(exec)
-{
- php_exec_ex(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-
-/* }}} */
-
-/* {{{ proto int system(string command [, int &return_value])
- Execute an external program and display output */
-PHP_FUNCTION(system)
-{
- php_exec_ex(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto void passthru(string command [, int &return_value])
- Execute an external program and display raw output */
-PHP_FUNCTION(passthru)
-{
- php_exec_ex(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3);
-}
-/* }}} */
-
-/* {{{ php_escape_shell_cmd
- Escape all chars that could possibly be used to
- break out of a shell command
-
- This function emalloc's a string and returns the pointer.
- Remember to efree it when done with it.
-
- *NOT* safe for binary strings
-*/
-char *php_escape_shell_cmd(char *str) {
- register int x, y, l;
- char *cmd;
-
- l = strlen(str);
- cmd = emalloc(2 * l + 1);
-
- for (x = 0, y = 0; x < l; x++) {
- switch (str[x]) {
- case '#': /* This is character-set independent */
- case '&':
- case ';':
- case '`':
- case '\'':
- case '"':
- case '|':
- case '*':
- case '?':
- case '~':
- case '<':
- case '>':
- case '^':
- case '(':
- case ')':
- case '[':
- case ']':
- case '{':
- case '}':
- case '$':
- case '\\':
- case '\x0A': /* excluding these two */
- case '\xFF':
- cmd[y++] = '\\';
- /* fall-through */
- default:
- cmd[y++] = str[x];
-
- }
- }
- cmd[y] = '\0';
- return cmd;
-}
-/* }}} */
-
-/* {{{ php_escape_shell_arg
- */
-char *php_escape_shell_arg(char *str) {
- int x, y, l;
- char *cmd;
-
- y = 0;
- l = strlen(str);
-
- cmd = emalloc(4 * l + 3); /* worst case */
-
- cmd[y++] = '\'';
-
- for (x = 0; x < l; x++) {
- switch (str[x]) {
- case '\'':
- cmd[y++] = '\'';
- cmd[y++] = '\\';
- cmd[y++] = '\'';
- /* fall-through */
- default:
- cmd[y++] = str[x];
- }
- }
- cmd[y++] = '\'';
- cmd[y] = '\0';
- return cmd;
-}
-/* }}} */
-
-/* {{{ proto string escapeshellcmd(string command)
- Escape shell metacharacters */
-PHP_FUNCTION(escapeshellcmd)
-{
- pval **arg1;
- char *cmd = NULL;
-
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- if (Z_STRLEN_PP(arg1)) {
- cmd = php_escape_shell_cmd(Z_STRVAL_PP(arg1));
- RETVAL_STRING(cmd, 1);
- efree(cmd);
- }
-}
-/* }}} */
-
-/* {{{ proto string escapeshellarg(string arg)
- Quote and escape an argument for use in a shell command */
-PHP_FUNCTION(escapeshellarg)
-{
- pval **arg1;
- char *cmd = NULL;
-
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- if (Z_STRLEN_PP(arg1)) {
- cmd = php_escape_shell_arg(Z_STRVAL_PP(arg1));
- RETVAL_STRING(cmd, 1);
- efree(cmd);
- }
-}
-/* }}} */
-
-/* {{{ proto string shell_exec(string cmd)
- Use pclose() for FILE* that has been opened via popen() */
-PHP_FUNCTION(shell_exec)
-{
- FILE *in;
- size_t total_readbytes;
- pval **cmd;
- char *ret;
- php_stream *stream;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &cmd)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (PG(safe_mode)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot execute using backquotes in Safe Mode");
- RETURN_FALSE;
- }
-
- convert_to_string_ex(cmd);
-#ifdef PHP_WIN32
- if ((in=VCWD_POPEN(Z_STRVAL_PP(cmd), "rt"))==NULL) {
-#else
- if ((in=VCWD_POPEN(Z_STRVAL_PP(cmd), "r"))==NULL) {
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to execute '%s'", Z_STRVAL_PP(cmd));
- RETURN_FALSE;
- }
-
- stream = php_stream_fopen_from_pipe(in, "rb");
- total_readbytes = php_stream_copy_to_mem(stream, &ret, PHP_STREAM_COPY_ALL, 0);
- php_stream_close(stream);
-
- if (total_readbytes > 0) {
- RETURN_STRINGL(ret, total_readbytes, 0);
- } else {
- RETURN_NULL();
- }
-}
-/* }}} */
-
-#ifdef HAVE_NICE
-/* {{{ proto bool proc_nice(int priority)
- Change the priority of the current process */
-PHP_FUNCTION(proc_nice)
-{
- long pri;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pri) == FAILURE) {
- RETURN_FALSE;
- }
-
- errno = 0;
- nice(pri);
- if (errno) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only a super user may attempt to increase the priority of a process.");
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/exec.h b/ext/standard/exec.h
deleted file mode 100644
index 6d5fb66f70..0000000000
--- a/ext/standard/exec.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef EXEC_H
-#define EXEC_H
-
-PHP_FUNCTION(system);
-PHP_FUNCTION(exec);
-PHP_FUNCTION(escapeshellcmd);
-PHP_FUNCTION(escapeshellarg);
-PHP_FUNCTION(passthru);
-PHP_FUNCTION(shell_exec);
-PHP_FUNCTION(proc_open);
-PHP_FUNCTION(proc_get_status);
-PHP_FUNCTION(proc_close);
-PHP_FUNCTION(proc_terminate);
-PHP_FUNCTION(proc_nice);
-PHP_MINIT_FUNCTION(proc_open);
-
-char *php_escape_shell_cmd(char *);
-char *php_escape_shell_arg(char *);
-int php_exec(int type, char *cmd, pval *array, pval *return_value TSRMLS_DC);
-
-#endif /* EXEC_H */
diff --git a/ext/standard/file.c b/ext/standard/file.c
deleted file mode 100644
index 784acfca8d..0000000000
--- a/ext/standard/file.c
+++ /dev/null
@@ -1,2027 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Stig Bakken <ssb@php.net> |
- | Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | PHP 4.0 patches by Thies C. Arntzen (thies@thieso.net) |
- | PHP streams by Wez Furlong (wez@thebrainroom.com) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
-
-/* {{{ includes */
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/flock_compat.h"
-#include "ext/standard/exec.h"
-#include "ext/standard/php_filestat.h"
-#include "php_open_temporary_file.h"
-#include "ext/standard/basic_functions.h"
-#include "php_ini.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#ifdef PHP_WIN32
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#include "win32/winutil.h"
-#elif defined(NETWARE) && !defined(NEW_LIBC)
-/*#include <ws2nlm.h>*/
-#include <sys/socket.h>
-#include "netware/param.h"
-#else
-#include <sys/param.h>
-#include <sys/select.h>
-#if defined(NETWARE) && defined(USE_WINSOCK)
-#include <novsock2.h>
-#else
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#endif
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif
-#include "ext/standard/head.h"
-#include "safe_mode.h"
-#include "php_string.h"
-#include "file.h"
-#if HAVE_PWD_H
-#ifdef PHP_WIN32
-#include "win32/pwd.h"
-#elif defined(NETWARE)
-#include "netware/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include "fsock.h"
-#include "fopen_wrappers.h"
-#include "streamsfuncs.h"
-#include "php_globals.h"
-
-#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-
-#if MISSING_FCLOSE_DECL
-extern int fclose(FILE *);
-#endif
-
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-
-#include "scanf.h"
-#include "zend_API.h"
-
-#ifdef ZTS
-int file_globals_id;
-#else
-php_file_globals file_globals;
-#endif
-
-#ifdef HAVE_FNMATCH
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#include <fnmatch.h>
-#endif
-
-/* }}} */
-/* {{{ ZTS-stuff / Globals / Prototypes */
-
-/* sharing globals is *evil* */
-static int le_stream_context = FAILURE;
-
-PHPAPI int php_le_stream_context(void)
-{
- return le_stream_context;
-}
-
-/* }}} */
-/* {{{ Module-Stuff */
-
-static ZEND_RSRC_DTOR_FUNC(file_context_dtor)
-{
- php_stream_context_free((php_stream_context*)rsrc->ptr);
-}
-
-static void file_globals_ctor(php_file_globals *file_globals_p TSRMLS_DC)
-{
- FG(pclose_ret) = 0;
- FG(user_stream_current_filename) = NULL;
- FG(def_chunk_size) = PHP_SOCK_CHUNK_SIZE;
-}
-
-static void file_globals_dtor(php_file_globals *file_globals_p TSRMLS_DC)
-{
-}
-
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("user_agent", NULL, PHP_INI_ALL, OnUpdateString, user_agent, php_file_globals, file_globals)
- STD_PHP_INI_ENTRY("default_socket_timeout", "60", PHP_INI_ALL, OnUpdateLong, default_socket_timeout, php_file_globals, file_globals)
- STD_PHP_INI_ENTRY("auto_detect_line_endings", "0", PHP_INI_ALL, OnUpdateLong, auto_detect_line_endings, php_file_globals, file_globals)
-PHP_INI_END()
-
-PHP_MINIT_FUNCTION(file)
-{
- le_stream_context = zend_register_list_destructors_ex(file_context_dtor, NULL, "stream-context", module_number);
-
-#ifdef ZTS
- ts_allocate_id(&file_globals_id, sizeof(php_file_globals), (ts_allocate_ctor) file_globals_ctor, (ts_allocate_dtor) file_globals_dtor);
-#else
- file_globals_ctor(&file_globals TSRMLS_CC);
-#endif
-
- REGISTER_INI_ENTRIES();
-
- REGISTER_LONG_CONSTANT("SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOCK_SH", 1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOCK_EX", 2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOCK_UN", 3, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOCK_NB", 4, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("STREAM_NOTIFY_CONNECT", PHP_STREAM_NOTIFY_CONNECT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_NOTIFY_AUTH_REQUIRED", PHP_STREAM_NOTIFY_AUTH_REQUIRED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_NOTIFY_AUTH_RESULT", PHP_STREAM_NOTIFY_AUTH_RESULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_NOTIFY_MIME_TYPE_IS", PHP_STREAM_NOTIFY_MIME_TYPE_IS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_NOTIFY_FILE_SIZE_IS", PHP_STREAM_NOTIFY_FILE_SIZE_IS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_NOTIFY_REDIRECTED", PHP_STREAM_NOTIFY_REDIRECTED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_NOTIFY_PROGRESS", PHP_STREAM_NOTIFY_PROGRESS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_NOTIFY_FAILURE", PHP_STREAM_NOTIFY_FAILURE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_NOTIFY_COMPLETED", PHP_STREAM_NOTIFY_COMPLETED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_NOTIFY_RESOLVE", PHP_STREAM_NOTIFY_RESOLVE, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_INFO", PHP_STREAM_NOTIFY_SEVERITY_INFO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_WARN", PHP_STREAM_NOTIFY_SEVERITY_WARN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_ERR", PHP_STREAM_NOTIFY_SEVERITY_ERR, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("STREAM_FILTER_READ", PHP_STREAM_FILTER_READ, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_FILTER_WRITE", PHP_STREAM_FILTER_WRITE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_FILTER_ALL", PHP_STREAM_FILTER_ALL, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("STREAM_CLIENT_PERSISTENT", PHP_STREAM_CLIENT_PERSISTENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_CLIENT_ASYNC_CONNECT", PHP_STREAM_CLIENT_ASYNC_CONNECT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("STREAM_SERVER_BIND", STREAM_XPORT_BIND, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_SERVER_LISTEN", STREAM_XPORT_LISTEN, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("FILE_USE_INCLUDE_PATH", PHP_FILE_USE_INCLUDE_PATH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILE_IGNORE_NEW_LINES", PHP_FILE_IGNORE_NEW_LINES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILE_SKIP_EMPTY_LINES", PHP_FILE_SKIP_EMPTY_LINES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILE_APPEND", PHP_FILE_APPEND, CONST_CS | CONST_PERSISTENT);
-
-#ifdef HAVE_FNMATCH
- REGISTER_LONG_CONSTANT("FNM_NOESCAPE", FNM_NOESCAPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FNM_PATHNAME", FNM_PATHNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FNM_PERIOD", FNM_PERIOD, CONST_CS | CONST_PERSISTENT);
-#ifdef FNM_CASEFOLD /* a GNU extension */ /* TODO emulate if not available */
- REGISTER_LONG_CONSTANT("FNM_CASEFOLD", FNM_CASEFOLD, CONST_CS | CONST_PERSISTENT);
-#endif
-#endif
-
- return SUCCESS;
-}
-
-/* }}} */
-
-PHP_MSHUTDOWN_FUNCTION(file)
-{
-#ifndef ZTS
- file_globals_dtor(&file_globals TSRMLS_CC);
-#endif
- return SUCCESS;
-}
-
-
-
-/* {{{ proto bool flock(resource fp, int operation [, int &wouldblock])
- Portable file locking */
-
-static int flock_values[] = { LOCK_SH, LOCK_EX, LOCK_UN };
-
-PHP_FUNCTION(flock)
-{
- zval *arg1, *arg3 = NULL;
- int fd, act;
- php_stream *stream;
- long operation = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &arg1, &operation, &arg3) == FAILURE) {
- return;
- }
-
- php_stream_from_zval(stream, &arg1);
-
- if (php_stream_cast(stream, PHP_STREAM_AS_FD, (void*)&fd, 1) == FAILURE) {
- RETURN_FALSE;
- }
-
- act = operation & 3;
- if (act < 1 || act > 3) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal operation argument");
- RETURN_FALSE;
- }
-
- /* flock_values contains all possible actions if (operation & 4) we won't block on the lock */
- act = flock_values[act - 1] | (operation & 4 ? LOCK_NB : 0);
- if (!php_stream_lock(stream, act)) {
- if (operation && errno == EWOULDBLOCK && arg3 && PZVAL_IS_REF(arg3)) {
- convert_to_long_ex(&arg3);
- ZVAL_LONG(arg3, 1);
- }
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-
-/* }}} */
-
-#define PHP_META_UNSAFE ".\\+*?[^]$() "
-
-/* {{{ proto array get_meta_tags(string filename [, bool use_include_path])
- Extracts all meta tag content attributes from a file and returns an array */
-
-PHP_FUNCTION(get_meta_tags)
-{
- char *filename;
- int filename_len;
- zend_bool use_include_path = 0;
- int in_tag = 0, done = 0;
- int looking_for_val = 0, have_name = 0, have_content = 0;
- int saw_name = 0, saw_content = 0;
- char *name = NULL, *value = NULL, *temp = NULL;
- php_meta_tags_token tok, tok_last;
- php_meta_tags_data md;
-
- /* Initiailize our structure */
- memset(&md, 0, sizeof(md));
-
- /* Parse arguments */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b",
- &filename, &filename_len, &use_include_path) == FAILURE) {
- return;
- }
-
- md.stream = php_stream_open_wrapper(filename, "rb",
- (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS,
- NULL);
-
- if (!md.stream) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- tok_last = TOK_EOF;
-
- while (!done && (tok = php_next_meta_token(&md TSRMLS_CC)) != TOK_EOF) {
- if (tok == TOK_ID) {
- if (tok_last == TOK_OPENTAG) {
- md.in_meta = !strcasecmp("meta", md.token_data);
- } else if (tok_last == TOK_SLASH && in_tag) {
- if (strcasecmp("head", md.token_data) == 0) {
- /* We are done here! */
- done = 1;
- }
- } else if (tok_last == TOK_EQUAL && looking_for_val) {
- if (saw_name) {
- /* Get the NAME attr (Single word attr, non-quoted) */
- temp = name = estrndup(md.token_data, md.token_len);
-
- while (temp && *temp) {
- if (strchr(PHP_META_UNSAFE, *temp)) {
- *temp = '_';
- }
- temp++;
- }
-
- have_name = 1;
- } else if (saw_content) {
- /* Get the CONTENT attr (Single word attr, non-quoted) */
- if (PG(magic_quotes_runtime)) {
- value = php_addslashes(md.token_data, 0, &md.token_len, 0 TSRMLS_CC);
- } else {
- value = estrndup(md.token_data, md.token_len);
- }
-
- have_content = 1;
- }
-
- looking_for_val = 0;
- } else {
- if (md.in_meta) {
- if (strcasecmp("name", md.token_data) == 0) {
- saw_name = 1;
- saw_content = 0;
- looking_for_val = 1;
- } else if (strcasecmp("content", md.token_data) == 0) {
- saw_name = 0;
- saw_content = 1;
- looking_for_val = 1;
- }
- }
- }
- } else if (tok == TOK_STRING && tok_last == TOK_EQUAL && looking_for_val) {
- if (saw_name) {
- /* Get the NAME attr (Quoted single/double) */
- temp = name = estrndup(md.token_data, md.token_len);
-
- while (temp && *temp) {
- if (strchr(PHP_META_UNSAFE, *temp)) {
- *temp = '_';
- }
- temp++;
- }
-
- have_name = 1;
- } else if (saw_content) {
- /* Get the CONTENT attr (Single word attr, non-quoted) */
- if (PG(magic_quotes_runtime)) {
- value = php_addslashes(md.token_data, 0, &md.token_len, 0 TSRMLS_CC);
- } else {
- value = estrndup(md.token_data, md.token_len);
- }
-
- have_content = 1;
- }
-
- looking_for_val = 0;
- } else if (tok == TOK_OPENTAG) {
- if (looking_for_val) {
- looking_for_val = 0;
- have_name = saw_name = 0;
- have_content = saw_content = 0;
- }
- in_tag = 1;
- } else if (tok == TOK_CLOSETAG) {
- if (have_name) {
- /* For BC */
- php_strtolower(name, strlen(name));
- if (have_content) {
- add_assoc_string(return_value, name, value, 0);
- } else {
- add_assoc_string(return_value, name, empty_string, 0);
- }
-
- efree(name);
- } else if (have_content) {
- efree(value);
- }
-
- name = value = NULL;
-
- /* Reset all of our flags */
- in_tag = looking_for_val = 0;
- have_name = saw_name = 0;
- have_content = saw_content = 0;
- md.in_meta = 0;
- }
-
- tok_last = tok;
-
- if (md.token_data)
- efree(md.token_data);
-
- md.token_data = NULL;
- }
-
- php_stream_close(md.stream);
-}
-
-/* }}} */
-
-/* {{{ proto string file_get_contents(string filename [, bool use_include_path [, resource context]])
- Read the entire file into a string */
-PHP_FUNCTION(file_get_contents)
-{
- char *filename;
- int filename_len;
- char *contents;
- zend_bool use_include_path = 0;
- php_stream *stream;
- int len, newlen;
- zval *zcontext = NULL;
- php_stream_context *context = NULL;
-
- /* Parse arguments */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|br!",
- &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) {
- return;
- }
-
- if (zcontext) {
- context = zend_fetch_resource(&zcontext TSRMLS_CC, -1, "Stream-Context", NULL, 1, php_le_stream_context());
- }
-
- stream = php_stream_open_wrapper_ex(filename, "rb",
- (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS,
- NULL, context);
- if (!stream) {
- RETURN_FALSE;
- }
-
- /* uses mmap if possible */
- if ((len = php_stream_copy_to_mem(stream, &contents, PHP_STREAM_COPY_ALL, 0)) > 0) {
-
- if (PG(magic_quotes_runtime)) {
- contents = php_addslashes(contents, len, &newlen, 1 TSRMLS_CC); /* 1 = free source string */
- len = newlen;
- }
-
- RETVAL_STRINGL(contents, len, 0);
- } else if (len == 0) {
- RETVAL_EMPTY_STRING();
- } else {
- RETVAL_FALSE;
- }
-
- php_stream_close(stream);
-
-}
-/* }}} */
-
-/* {{{ proto string file_put_contents(string file, string data[, int flags[, resource context]])
- Write/Create a file with contents data */
-PHP_FUNCTION(file_put_contents)
-{
- php_stream *stream;
- char *filename, *data;
- size_t filename_len, data_len;
- int numbytes, flags = 0;
- zval *zcontext = NULL;
- php_stream_context *context = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|lr!", &filename, &filename_len,
- &data, &data_len, &flags, &zcontext) == FAILURE) {
- return;
- }
-
- if (zcontext) {
- context = zend_fetch_resource(&zcontext TSRMLS_CC, -1, "Stream-Context", NULL, 1, php_le_stream_context());
- }
-
- stream = php_stream_open_wrapper_ex(filename, (flags & PHP_FILE_APPEND) ? "ab" : "wb",
- ((flags & PHP_FILE_USE_INCLUDE_PATH) ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
- if (stream == NULL) {
- RETURN_FALSE;
- }
-
- if (data_len) {
- numbytes = php_stream_write(stream, data, data_len);
- if (numbytes < 0) {
- RETURN_FALSE;
- }
- }
- php_stream_close(stream);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array file(string filename [, int flags[, resource context]])
- Read entire file into an array */
-
-#define PHP_FILE_BUF_SIZE 80
-
-PHP_FUNCTION(file)
-{
- char *filename;
- int filename_len;
- char *slashed, *target_buf=NULL, *p, *s, *e;
- register int i = 0;
- int target_len, len;
- char eol_marker = '\n';
- long flags = 0;
- zend_bool use_include_path;
- zend_bool include_new_line;
- zend_bool skip_blank_lines;
- php_stream *stream;
- zval *zcontext = NULL;
- php_stream_context *context = NULL;
-
- /* Parse arguments */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lr!", &filename, &filename_len, &flags, &zcontext) == FAILURE) {
- return;
- }
- if (flags < 0 || flags > (PHP_FILE_USE_INCLUDE_PATH | PHP_FILE_IGNORE_NEW_LINES | PHP_FILE_SKIP_EMPTY_LINES)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "'%l' flag is not supported.", flags);
- RETURN_FALSE;
- }
-
- use_include_path = flags & PHP_FILE_USE_INCLUDE_PATH;
- include_new_line = !(flags & PHP_FILE_IGNORE_NEW_LINES);
- skip_blank_lines = flags & PHP_FILE_SKIP_EMPTY_LINES;
-
- if (zcontext) {
- context = zend_fetch_resource(&zcontext TSRMLS_CC, -1, "Stream-Context", NULL, 1, php_le_stream_context());
- }
-
- stream = php_stream_open_wrapper_ex(filename, "rb", (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
- if (!stream) {
- RETURN_FALSE;
- }
-
- /* Initialize return array */
- array_init(return_value);
-
- if ((target_len = php_stream_copy_to_mem(stream, &target_buf, PHP_STREAM_COPY_ALL, 0))) {
- s = target_buf;
- e = target_buf + target_len;
-
- if (!(p = php_stream_locate_eol(stream, target_buf, target_len TSRMLS_CC))) {
- p = e;
- goto parse_eol;
- }
-
- if (stream->flags & PHP_STREAM_FLAG_EOL_MAC) {
- eol_marker = '\r';
- }
-
- /* for performance reasons the code is duplicated, so that the if (include_new_line)
- * will not need to be done for every single line in the file.
- */
- if (include_new_line) {
- do {
- p++;
-parse_eol:
- if (PG(magic_quotes_runtime)) {
- /* s is in target_buf which is freed at the end of the function */
- slashed = php_addslashes(s, (p-s), &len, 0 TSRMLS_CC);
- add_index_stringl(return_value, i++, slashed, len, 0);
- } else {
- add_index_stringl(return_value, i++, estrndup(s, p-s), p-s, 0);
- }
- s = p;
- } while ((p = memchr(p, eol_marker, (e-p))));
- } else {
- do {
- if (skip_blank_lines && !(p-s)) {
- s = ++p;
- continue;
- }
- if (PG(magic_quotes_runtime)) {
- /* s is in target_buf which is freed at the end of the function */
- slashed = php_addslashes(s, (p-s), &len, 0 TSRMLS_CC);
- add_index_stringl(return_value, i++, slashed, len, 0);
- } else {
- add_index_stringl(return_value, i++, estrndup(s, p-s), p-s, 0);
- }
- s = ++p;
- } while ((p = memchr(p, eol_marker, (e-p))));
- }
-
- /* handle any left overs of files without new lines */
- if (s != e) {
- p = e;
- goto parse_eol;
- }
- }
-
- if (target_buf) {
- efree(target_buf);
- }
- php_stream_close(stream);
-}
-/* }}} */
-
-/* {{{ proto string tempnam(string dir, string prefix)
- Create a unique filename in a directory */
-PHP_FUNCTION(tempnam)
-{
- pval **arg1, **arg2;
- char *d;
- char *opened_path;
- char p[64];
- FILE *fp;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
-
- if (php_check_open_basedir(Z_STRVAL_PP(arg1) TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- d = estrndup(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1));
- strlcpy(p, Z_STRVAL_PP(arg2), sizeof(p));
-
- if ((fp = php_open_temporary_file(d, p, &opened_path TSRMLS_CC))) {
- fclose(fp);
- RETVAL_STRING(opened_path, 0);
- } else {
- RETVAL_FALSE;
- }
- efree(d);
-}
-/* }}} */
-
-/* {{{ proto resource tmpfile(void)
- Create a temporary file that will be deleted automatically after use */
-PHP_NAMED_FUNCTION(php_if_tmpfile)
-{
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- stream = php_stream_fopen_tmpfile();
-
- if (stream) {
- php_stream_to_zval(stream, return_value);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
- Open a file or a URL and return a file pointer */
-PHP_NAMED_FUNCTION(php_if_fopen)
-{
- char *filename, *mode;
- int filename_len, mode_len;
- zend_bool use_include_path = 0;
- zval *zcontext = NULL;
- php_stream *stream;
- php_stream_context *context = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|br", &filename, &filename_len,
- &mode, &mode_len, &use_include_path, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
- if (zcontext) {
- ZEND_FETCH_RESOURCE(context, php_stream_context*, &zcontext, -1, "stream-context", le_stream_context);
- }
-
- stream = php_stream_open_wrapper_ex(filename, mode, (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
-
- if (stream == NULL) {
- RETURN_FALSE;
- }
-
- php_stream_to_zval(stream, return_value);
-
- return;
-}
-/* }}} */
-
-/* {{{ proto bool fclose(resource fp)
- Close an open file pointer */
-PHPAPI PHP_FUNCTION(fclose)
-{
- zval **arg1;
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(stream, arg1);
- php_stream_close(stream);
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto resource popen(string command, string mode)
- Execute a command and open either a read or a write pipe to it */
-
-PHP_FUNCTION(popen)
-{
- zval **arg1, **arg2;
- FILE *fp;
- char *p, *tmp = NULL;
- char *b, buf[1024];
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
- p = estrndup(Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2));
- if (PG(safe_mode)){
- b = strchr(Z_STRVAL_PP(arg1), ' ');
- if (!b) {
- b = strrchr(Z_STRVAL_PP(arg1), '/');
- } else {
- char *c;
- c = Z_STRVAL_PP(arg1);
- while((*b != '/') && (b != c)) {
- b--;
- }
- if (b == c) {
- b = NULL;
- }
- }
- if (b) {
- snprintf(buf, sizeof(buf), "%s%s", PG(safe_mode_exec_dir), b);
- } else {
- snprintf(buf, sizeof(buf), "%s/%s", PG(safe_mode_exec_dir), Z_STRVAL_PP(arg1));
- }
-
- tmp = php_escape_shell_cmd(buf);
- fp = VCWD_POPEN(tmp, p);
- efree(tmp);
-
- if (!fp) {
- php_error_docref2(NULL TSRMLS_CC, buf, p, E_WARNING, "%s", strerror(errno));
- RETURN_FALSE;
- }
- } else {
- fp = VCWD_POPEN(Z_STRVAL_PP(arg1), p);
- if (!fp) {
- php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(arg1), p, E_WARNING, "%s", strerror(errno));
- efree(p);
- RETURN_FALSE;
- }
- }
- stream = php_stream_fopen_from_pipe(fp, p);
-
- if (stream == NULL) {
- php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(arg1), p, E_WARNING, "%s", strerror(errno));
- RETVAL_FALSE;
- } else {
- php_stream_to_zval(stream, return_value);
- }
-
- efree(p);
-}
-/* }}} */
-
-/* {{{ proto int pclose(resource fp)
- Close a file pointer opened by popen() */
-PHP_FUNCTION(pclose)
-{
- zval **arg1;
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(stream, arg1);
-
- RETURN_LONG(php_stream_close(stream));
-}
-/* }}} */
-
-/* {{{ proto bool feof(resource fp)
- Test for end-of-file on a file pointer */
-PHPAPI PHP_FUNCTION(feof)
-{
- zval **arg1;
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(stream, arg1);
-
- if (php_stream_eof(stream)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string fgets(resource fp[, int length])
- Get a line from file pointer */
-PHPAPI PHP_FUNCTION(fgets)
-{
- zval **arg1, **arg2;
- int len = 1024;
- char *buf = NULL;
- int argc = ZEND_NUM_ARGS();
- size_t line_len = 0;
- php_stream *stream;
-
- if (argc<1 || argc>2 || zend_get_parameters_ex(argc, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(stream, arg1);
-
- if (argc == 1) {
- /* ask streams to give us a buffer of an appropriate size */
- buf = php_stream_get_line(stream, NULL, 0, &line_len);
- if (buf == NULL) {
- goto exit_failed;
- }
- } else if (argc > 1) {
- convert_to_long_ex(arg2);
- len = Z_LVAL_PP(arg2);
-
- if (len < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter may not be negative");
- RETURN_FALSE;
- }
-
- buf = ecalloc(len + 1, sizeof(char));
- if (php_stream_get_line(stream, buf, len, &line_len) == NULL) {
- goto exit_failed;
- }
- }
-
- if (PG(magic_quotes_runtime)) {
- Z_STRVAL_P(return_value) = php_addslashes(buf, line_len, &Z_STRLEN_P(return_value), 1 TSRMLS_CC);
- Z_TYPE_P(return_value) = IS_STRING;
- } else {
- ZVAL_STRINGL(return_value, buf, line_len, 0);
- /* resize buffer if it's much larger than the result.
- * Only needed if the user requested a buffer size. */
- if (argc > 1 && Z_STRLEN_P(return_value) < len / 2) {
- Z_STRVAL_P(return_value) = erealloc(buf, line_len + 1);
- }
- }
- return;
-
-exit_failed:
- RETVAL_FALSE;
- if (buf) {
- efree(buf);
- }
-}
-/* }}} */
-
-/* {{{ proto string fgetc(resource fp)
- Get a character from file pointer */
-PHPAPI PHP_FUNCTION(fgetc)
-{
- zval **arg1;
- char *buf;
- int result;
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(stream, arg1);
-
- buf = emalloc(2 * sizeof(char));
-
- result = php_stream_getc(stream);
-
- if (result == EOF) {
- efree(buf);
- RETVAL_FALSE;
- } else {
- buf[0] = result;
- buf[1] = '\0';
-
- RETURN_STRINGL(buf, 1, 0);
- }
-}
-/* }}} */
-
-/* {{{ proto string fgetss(resource fp [, int length, string allowable_tags])
- Get a line from file pointer and strip HTML tags */
-PHPAPI PHP_FUNCTION(fgetss)
-{
- zval **fd, **bytes = NULL, **allow=NULL;
- size_t len = 0;
- size_t actual_len, retval_len;
- char *buf = NULL, *retval;
- php_stream *stream;
- char *allowed_tags=NULL;
- int allowed_tags_len=0;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fd) == FAILURE) {
- RETURN_FALSE;
- }
- break;
-
- case 2:
- if (zend_get_parameters_ex(2, &fd, &bytes) == FAILURE) {
- RETURN_FALSE;
- }
- break;
-
- case 3:
- if (zend_get_parameters_ex(3, &fd, &bytes, &allow) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(allow);
- allowed_tags = Z_STRVAL_PP(allow);
- allowed_tags_len = Z_STRLEN_PP(allow);
- break;
-
- default:
- WRONG_PARAM_COUNT;
- /* NOTREACHED */
- break;
- }
-
- php_stream_from_zval(stream, fd);
-
- if (bytes != NULL) {
- convert_to_long_ex(bytes);
- if (Z_LVAL_PP(bytes) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter may not be negative");
- RETURN_FALSE;
- }
-
- len = (size_t) Z_LVAL_PP(bytes);
- buf = emalloc(sizeof(char) * (len + 1));
- /*needed because recv doesnt set null char at end*/
- memset(buf, 0, len + 1);
- }
-
- if ((retval = php_stream_get_line(stream, buf, len, &actual_len)) == NULL) {
- if (buf != NULL) {
- efree(buf);
- }
- RETURN_FALSE;
- }
-
- retval_len = php_strip_tags(retval, actual_len, &stream->fgetss_state, allowed_tags, allowed_tags_len);
-
- RETURN_STRINGL(retval, retval_len, 0);
-}
-/* }}} */
-
-/* {{{ proto mixed fscanf(resource stream, string format [, string ...])
- Implements a mostly ANSI compatible fscanf() */
-PHP_FUNCTION(fscanf)
-{
- int result;
- zval **file_handle, **format_string;
- size_t len;
- int type;
- char *buf;
- void *what;
-
- zval ***args;
- int argCount;
-
- argCount = ZEND_NUM_ARGS();
- if (argCount < 2) {
- WRONG_PARAM_COUNT;
- }
- args = (zval ***)emalloc(argCount * sizeof(zval **));
- if (zend_get_parameters_array_ex(argCount, args) == FAILURE) {
- efree( args );
- WRONG_PARAM_COUNT;
- }
-
- file_handle = args[0];
- format_string = args[1];
-
- what = zend_fetch_resource(file_handle TSRMLS_CC, -1, "File-Handle", &type, 2,
- php_file_le_stream(), php_file_le_pstream());
-
- /*
- * we can't do a ZEND_VERIFY_RESOURCE(what), otherwise we end up
- * with a leak if we have an invalid filehandle. This needs changing
- * if the code behind ZEND_VERIFY_RESOURCE changed. - cc
- */
- if (!what) {
- efree(args);
- RETURN_FALSE;
- }
-
-
- buf = php_stream_get_line((php_stream *) what, NULL, 0, &len);
- if (buf == NULL) {
- efree(args);
- RETURN_FALSE;
- }
-
- convert_to_string_ex(format_string);
- result = php_sscanf_internal(buf, Z_STRVAL_PP(format_string),
- argCount, args, 2, &return_value TSRMLS_CC);
-
- efree(args);
- efree(buf);
-
- if (SCAN_ERROR_WRONG_PARAM_COUNT == result) {
- WRONG_PARAM_COUNT;
- }
-
-}
-/* }}} */
-
-/* {{{ proto int fwrite(resource fp, string str [, int length])
- Binary-safe file write */
-PHPAPI PHP_FUNCTION(fwrite)
-{
- zval **arg1, **arg2, **arg3=NULL;
- int ret;
- int num_bytes;
- char *buffer = NULL;
- php_stream *stream;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(arg2);
- num_bytes = Z_STRLEN_PP(arg2);
- break;
-
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- num_bytes = MIN(Z_LVAL_PP(arg3), Z_STRLEN_PP(arg2));
- break;
-
- default:
- WRONG_PARAM_COUNT;
- /* NOTREACHED */
- break;
- }
-
- php_stream_from_zval(stream, arg1);
-
- if (!arg3 && PG(magic_quotes_runtime)) {
- buffer = estrndup(Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2));
- php_stripslashes(buffer, &num_bytes TSRMLS_CC);
- }
-
- ret = php_stream_write(stream, buffer ? buffer : Z_STRVAL_PP(arg2), num_bytes);
- if (buffer) {
- efree(buffer);
- }
-
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto bool fflush(resource fp)
- Flushes output */
-PHPAPI PHP_FUNCTION(fflush)
-{
- zval **arg1;
- int ret;
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(stream, arg1);
-
- ret = php_stream_flush(stream);
- if (ret) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool rewind(resource fp)
- Rewind the position of a file pointer */
-PHPAPI PHP_FUNCTION(rewind)
-{
- zval **arg1;
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(stream, arg1);
-
- if (-1 == php_stream_rewind(stream)) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ftell(resource fp)
- Get file pointer's read/write position */
-PHPAPI PHP_FUNCTION(ftell)
-{
- zval **arg1;
- long ret;
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(stream, arg1);
-
- ret = php_stream_tell(stream);
- if (ret == -1) {
- RETURN_FALSE;
- }
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto int fseek(resource fp, int offset [, int whence])
- Seek on a file pointer */
-PHPAPI PHP_FUNCTION(fseek)
-{
- zval **arg1, **arg2, **arg3;
- int argcount = ZEND_NUM_ARGS(), whence = SEEK_SET;
- php_stream *stream;
-
- if (argcount < 2 || argcount > 3 || zend_get_parameters_ex(argcount, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(stream, arg1);
-
- convert_to_long_ex(arg2);
- if (argcount > 2) {
- convert_to_long_ex(arg3);
- whence = Z_LVAL_PP(arg3);
- }
-
- RETURN_LONG(php_stream_seek(stream, Z_LVAL_PP(arg2), whence));
-}
-
-/* }}} */
-
-/* {{{ proto int mkdir(char *dir int mode)
-*/
-
-PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC)
-{
- int ret;
-
- if (PG(safe_mode) && (!php_checkuid(dir, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- return -1;
- }
-
- if (php_check_open_basedir(dir TSRMLS_CC)) {
- return -1;
- }
-
- if ((ret = VCWD_MKDIR(dir, (mode_t)mode)) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
- }
-
- return ret;
-}
-/* }}} */
-
-/* {{{ proto bool mkdir(string pathname [, int mode [, bool recursive])
- Create a directory */
-PHP_FUNCTION(mkdir)
-{
- int dir_len, ret;
- long mode = 0777;
- char *dir;
- zend_bool recursive = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lb", &dir, &dir_len, &mode, &recursive) == FAILURE) {
- return;
- }
-
- if (!recursive) {
- ret = php_mkdir(dir, mode TSRMLS_CC);
- } else {
- /* we look for directory separator from the end of string, thus hopefuly reducing our work load */
- char *p, *e, *buf;
- struct stat sb;
-
- buf = estrndup(dir, dir_len);
- e = buf + dir_len;
-
- /* find a top level directory we need to create */
- while ((p = strrchr(buf, DEFAULT_SLASH))) {
- *p = '\0';
- if (VCWD_STAT(buf, &sb) == 0) {
- *p = DEFAULT_SLASH;
- break;
- }
- }
- if (p == buf) {
- ret = php_mkdir(dir, mode TSRMLS_CC);
- } else if (!(ret = php_mkdir(buf, mode TSRMLS_CC))) {
- if (!p) {
- p = buf;
- }
- /* create any needed directories if the creation of the 1st directory worked */
- while (++p != e) {
- if (*p == '\0' && *(p + 1) != '\0') {
- *p = DEFAULT_SLASH;
- if ((ret = VCWD_MKDIR(buf, (mode_t)mode)) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
- break;
- }
- }
- }
- }
- efree(buf);
- }
-
- if (ret < 0) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool rmdir(string dirname)
- Remove a directory */
-PHP_FUNCTION(rmdir)
-{
- zval **arg1;
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
-
- if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(arg1), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(Z_STRVAL_PP(arg1) TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- ret = VCWD_RMDIR(Z_STRVAL_PP(arg1));
- if (ret < 0) {
- php_error_docref1(NULL TSRMLS_CC, Z_STRVAL_PP(arg1), E_WARNING, "%s", strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int readfile(string filename [, bool use_include_path[, resource context]])
- Output a file or a URL */
-PHP_FUNCTION(readfile)
-{
- int size = 0;
- char *filename;
- int filename_len;
- zend_bool use_include_path = 0;
- zval *zcontext = NULL;
- php_stream *stream;
- php_stream_context *context = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (zcontext) {
- context = zend_fetch_resource(&zcontext TSRMLS_CC, -1, "Stream-Context", NULL, 1, php_le_stream_context());
- }
-
- stream = php_stream_open_wrapper_ex(filename, "rb", (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
- if (stream) {
- size = php_stream_passthru(stream);
- php_stream_close(stream);
- RETURN_LONG(size);
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int umask([int mask])
- Return or change the umask */
-PHP_FUNCTION(umask)
-{
- pval **arg1;
- int oldumask;
- int arg_count = ZEND_NUM_ARGS();
-
- oldumask = umask(077);
-
- if (arg_count == 0) {
- umask(oldumask);
- } else {
- if (arg_count > 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- umask(Z_LVAL_PP(arg1));
- }
-
- /* XXX we should maybe reset the umask after each request! */
-
- RETURN_LONG(oldumask);
-}
-
-/* }}} */
-
-/* {{{ proto int fpassthru(resource fp)
- Output all remaining data from a file pointer */
-PHPAPI PHP_FUNCTION(fpassthru)
-{
- zval **arg1;
- int size;
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(stream, arg1);
-
- size = php_stream_passthru(stream);
- RETURN_LONG(size);
-}
-/* }}} */
-
-/* {{{ proto bool rename(string old_name, string new_name)
- Rename a file */
-PHP_FUNCTION(rename)
-{
- zval **old_arg, **new_arg;
- char *old_name, *new_name;
- int ret;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &old_arg, &new_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(old_arg);
- convert_to_string_ex(new_arg);
-
- old_name = Z_STRVAL_PP(old_arg);
- new_name = Z_STRVAL_PP(new_arg);
-
- if (PG(safe_mode) &&(!php_checkuid(old_name, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(old_name TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- ret = VCWD_RENAME(old_name, new_name);
-
- if (ret == -1) {
- php_error_docref2(NULL TSRMLS_CC, old_name, new_name, E_WARNING, "%s", strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool unlink(string filename[, context context])
- Delete a file */
-PHP_FUNCTION(unlink)
-{
- char *filename;
- int filename_len;
- php_stream_wrapper *wrapper;
- zval *zcontext = NULL;
- php_stream_context *context = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r", &filename, &filename_len, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (zcontext) {
- context = zend_fetch_resource(&zcontext TSRMLS_CC, -1, "Stream-Context", NULL, 1, php_le_stream_context());
- }
-
- wrapper = php_stream_locate_url_wrapper(filename, NULL, 0 TSRMLS_CC);
-
- if (!wrapper || !wrapper->wops) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate stream wrapper");
- RETURN_FALSE;
- }
-
- if (!wrapper->wops->unlink) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s does not allow unlinking", wrapper->wops->label ? wrapper->wops->label : "Wrapper");
- RETURN_FALSE;
- }
- RETURN_BOOL(wrapper->wops->unlink(wrapper, filename, context TSRMLS_CC));
-}
-/* }}} */
-
-/* {{{ proto bool ftruncate(resource fp, int size)
- Truncate file to 'size' length */
-PHP_NAMED_FUNCTION(php_if_ftruncate)
-{
- zval **fp , **size;
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fp, &size) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(stream, fp);
-
- convert_to_long_ex(size);
-
- if (!php_stream_truncate_supported(stream)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't truncate this stream!");
- RETURN_FALSE;
- }
-
- RETURN_BOOL(0 == php_stream_truncate_set_size(stream, Z_LVAL_PP(size)));
-}
-/* }}} */
-
-/* {{{ proto int fstat(resource fp)
- Stat() on a filehandle */
-PHP_NAMED_FUNCTION(php_if_fstat)
-{
- zval **fp;
- zval *stat_dev, *stat_ino, *stat_mode, *stat_nlink, *stat_uid, *stat_gid, *stat_rdev,
- *stat_size, *stat_atime, *stat_mtime, *stat_ctime, *stat_blksize, *stat_blocks;
- php_stream *stream;
- php_stream_statbuf stat_ssb;
-
- char *stat_sb_names[13]={"dev", "ino", "mode", "nlink", "uid", "gid", "rdev",
- "size", "atime", "mtime", "ctime", "blksize", "blocks"};
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(stream, fp);
-
- if (php_stream_stat(stream, &stat_ssb)) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- MAKE_LONG_ZVAL_INCREF(stat_dev, stat_ssb.sb.st_dev);
- MAKE_LONG_ZVAL_INCREF(stat_ino, stat_ssb.sb.st_ino);
- MAKE_LONG_ZVAL_INCREF(stat_mode, stat_ssb.sb.st_mode);
- MAKE_LONG_ZVAL_INCREF(stat_nlink, stat_ssb.sb.st_nlink);
- MAKE_LONG_ZVAL_INCREF(stat_uid, stat_ssb.sb.st_uid);
- MAKE_LONG_ZVAL_INCREF(stat_gid, stat_ssb.sb.st_gid);
-#ifdef HAVE_ST_RDEV
- MAKE_LONG_ZVAL_INCREF(stat_rdev, stat_ssb.sb.st_rdev);
-#else
- MAKE_LONG_ZVAL_INCREF(stat_rdev, -1);
-#endif
- MAKE_LONG_ZVAL_INCREF(stat_size, stat_ssb.sb.st_size);
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- MAKE_LONG_ZVAL_INCREF(stat_atime, stat_ssb.sb.st_atime.tv_sec);
- MAKE_LONG_ZVAL_INCREF(stat_mtime, stat_ssb.sb.st_mtime.tv_sec);
- MAKE_LONG_ZVAL_INCREF(stat_ctime, stat_ssb.sb.st_ctime.tv_sec);
-#else
- MAKE_LONG_ZVAL_INCREF(stat_atime, stat_ssb.sb.st_atime);
- MAKE_LONG_ZVAL_INCREF(stat_mtime, stat_ssb.sb.st_mtime);
- MAKE_LONG_ZVAL_INCREF(stat_ctime, stat_ssb.sb.st_ctime);
-#endif
-
-#ifdef HAVE_ST_BLKSIZE
- MAKE_LONG_ZVAL_INCREF(stat_blksize, stat_ssb.sb.st_blksize);
-#else
- MAKE_LONG_ZVAL_INCREF(stat_blksize,-1);
-#endif
-#ifdef HAVE_ST_BLOCKS
- MAKE_LONG_ZVAL_INCREF(stat_blocks, stat_ssb.sb.st_blocks);
-#else
- MAKE_LONG_ZVAL_INCREF(stat_blocks,-1);
-#endif
- /* Store numeric indexes in propper order */
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_dev, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_ino, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_mode, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_nlink, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_uid, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_gid, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_rdev, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_size, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_atime, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_mtime, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_ctime, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_blksize, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_blocks, sizeof(zval *), NULL);
-
- /* Store string indexes referencing the same zval*/
- zend_hash_update(HASH_OF(return_value), stat_sb_names[0], strlen(stat_sb_names[0])+1, (void *)&stat_dev, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[1], strlen(stat_sb_names[1])+1, (void *)&stat_ino, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[2], strlen(stat_sb_names[2])+1, (void *)&stat_mode, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[3], strlen(stat_sb_names[3])+1, (void *)&stat_nlink, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[4], strlen(stat_sb_names[4])+1, (void *)&stat_uid, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[5], strlen(stat_sb_names[5])+1, (void *)&stat_gid, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[6], strlen(stat_sb_names[6])+1, (void *)&stat_rdev, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[7], strlen(stat_sb_names[7])+1, (void *)&stat_size, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[8], strlen(stat_sb_names[8])+1, (void *)&stat_atime, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[9], strlen(stat_sb_names[9])+1, (void *)&stat_mtime, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[10], strlen(stat_sb_names[10])+1, (void *)&stat_ctime, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[11], strlen(stat_sb_names[11])+1, (void *)&stat_blksize, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[12], strlen(stat_sb_names[12])+1, (void *)&stat_blocks, sizeof(zval *), NULL);
-}
-/* }}} */
-
-/* {{{ proto bool copy(string source_file, string destination_file)
- Copy a file */
-PHP_FUNCTION(copy)
-{
- zval **source, **target;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &source, &target) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(source);
- convert_to_string_ex(target);
-
- if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(source), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(Z_STRVAL_PP(source) TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if (php_copy_file(Z_STRVAL_PP(source), Z_STRVAL_PP(target) TSRMLS_CC)==SUCCESS) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_copy_file
- */
-PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC)
-{
- php_stream *srcstream = NULL, *deststream = NULL;
- int ret = FAILURE;
-
- srcstream = php_stream_open_wrapper(src, "rb", STREAM_DISABLE_OPEN_BASEDIR | REPORT_ERRORS, NULL);
-
- if (!srcstream) {
- return ret;
- }
-
- deststream = php_stream_open_wrapper(dest, "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
-
- if (srcstream && deststream) {
- ret = php_stream_copy_to_stream(srcstream, deststream, PHP_STREAM_COPY_ALL) == 0 ? FAILURE : SUCCESS;
- }
- if (srcstream) {
- php_stream_close(srcstream);
- }
- if (deststream) {
- php_stream_close(deststream);
- }
- return ret;
-}
-/* }}} */
-
-/* {{{ proto string fread(resource fp, int length)
- Binary-safe file read */
-PHPAPI PHP_FUNCTION(fread)
-{
- zval **arg1, **arg2;
- int len;
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(stream, arg1);
-
- convert_to_long_ex(arg2);
- len = Z_LVAL_PP(arg2);
- if (len < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter may not be negative");
- RETURN_FALSE;
- }
-
- Z_STRVAL_P(return_value) = emalloc(len + 1);
- Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);
-
- /* needed because recv/read/gzread doesnt put a null at the end*/
- Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
-
- if (PG(magic_quotes_runtime)) {
- Z_STRVAL_P(return_value) = php_addslashes(Z_STRVAL_P(return_value),
- Z_STRLEN_P(return_value), &Z_STRLEN_P(return_value), 1 TSRMLS_CC);
- }
- Z_TYPE_P(return_value) = IS_STRING;
-}
-/* }}} */
-
-/* {{{ proto array fgetcsv(resource fp, int length [, string delimiter [, string enclosure]])
- Get line from file pointer and parse for CSV fields */
-PHP_FUNCTION(fgetcsv)
-{
- char *temp, *tptr, *bptr, *lineEnd;
- char delimiter = ','; /* allow this to be set as parameter */
- char enclosure = '"'; /* allow this to be set as parameter */
-
- /* first section exactly as php_fgetss */
-
- zval **fd, **bytes, **p_delim, **p_enclosure;
- int len, temp_len;
- char *buf;
- php_stream *stream;
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &fd, &bytes) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
-
- case 3:
- if (zend_get_parameters_ex(3, &fd, &bytes, &p_delim) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
-
- case 4:
- if (zend_get_parameters_ex(4, &fd, &bytes, &p_delim, &p_enclosure) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
-
- default:
- WRONG_PARAM_COUNT;
- /* NOTREACHED */
- break;
- }
-
- if (ZEND_NUM_ARGS() >= 3) {
- convert_to_string_ex(p_delim);
- /* Make sure that there is at least one character in string */
- if (Z_STRLEN_PP(p_delim) < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "delimiter must be a character");
- RETURN_FALSE;
- }
- /* use first character from string */
- delimiter = Z_STRVAL_PP(p_delim)[0];
- }
-
- if (ZEND_NUM_ARGS() >= 4) {
- convert_to_string_ex(p_enclosure);
- /* Make sure that there is at least one character in string */
- if (Z_STRLEN_PP(p_enclosure) < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "enclosure must be a character");
- RETURN_FALSE;
- }
- /* use first character from string */
- enclosure = Z_STRVAL_PP(p_enclosure)[0];
- }
-
- php_stream_from_zval(stream, fd);
-
- convert_to_long_ex(bytes);
- len = Z_LVAL_PP(bytes);
- if (len < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter may not be negative");
- RETURN_FALSE;
- }
-
- buf = emalloc(len + 1);
- /* needed because recv/read/gzread doesnt set null char at end */
- memset(buf, 0, len + 1);
-
- if (php_stream_gets(stream, buf, len) == NULL) {
- efree(buf);
- RETURN_FALSE;
- }
-
- /* Now into new section that parses buf for delimiter/enclosure fields */
-
- /* Strip trailing space from buf, saving end of line in case required for enclosure field */
-
- lineEnd = emalloc(len + 1);
- bptr = buf;
- tptr = buf + strlen(buf) -1;
- while ( isspace((int)*(unsigned char *)tptr) && (*tptr!=delimiter) && (tptr > bptr) ) tptr--;
- tptr++;
- strcpy(lineEnd, tptr);
-
- /* add single space - makes it easier to parse trailing null field */
- *tptr++ = ' ';
- *tptr = 0;
-
- /* reserve workspace for building each individual field */
-
- temp_len = len;
- temp = emalloc(temp_len + 1); /* unlikely but possible! */
- tptr = temp;
-
- /* Initialize return array */
- array_init(return_value);
-
- /* Main loop to read CSV fields */
- /* NB this routine will return a single null entry for a blank line */
-
- do {
- /* 1. Strip any leading space */
- while(isspace((int)*(unsigned char *)bptr) && (*bptr!=delimiter)) bptr++;
- /* 2. Read field, leaving bptr pointing at start of next field */
- if (enclosure && *bptr == enclosure) {
- bptr++; /* move on to first character in field */
-
- /* 2A. handle enclosure delimited field */
- while (*bptr) {
- /* we need to determine if the enclosure is 'real' or is it escaped */
- if (*(bptr - 1) == '\\') {
- int escape_cnt = 0;
- char *bptr_p = bptr - 2;
-
- while (bptr_p > buf && *bptr_p == '\\') {
- escape_cnt++;
- bptr_p--;
- }
- if (!(escape_cnt % 2)) {
- goto normal_char;
- continue;
- }
- }
-
- if (*bptr == enclosure) {
- /* handle the enclosure */
- if ( *(bptr+1) == enclosure) {
- /* embedded enclosure */
- *tptr++ = *bptr; bptr +=2;
- } else {
- /* must be end of string - skip to start of next field or end */
- while ( (*bptr != delimiter) && *bptr ) bptr++;
- if (*bptr == delimiter) bptr++;
- *tptr=0; /* terminate temporary string */
- break; /* .. from handling this field - resumes at 3. */
- }
- } else {
-normal_char:
- /* normal character */
- *tptr++ = *bptr++;
-
- if (*bptr == 0) { /* embedded line end? */
- *(tptr-1)=0; /* remove space character added on reading line */
- strcat(temp, lineEnd); /* add the embedded line end to the field */
-
- /* read a new line from input, as at start of routine */
- memset(buf, 0, len+1);
-
- if (php_stream_gets(stream, buf, len) == NULL) {
- /* we've got an unterminated enclosure, assign all the data
- * from the start of the enclosure to end of data to the last element
- */
- if (temp_len > len) {
- break;
- }
-
- efree(lineEnd);
- efree(temp);
- efree(buf);
- zval_dtor(return_value);
- RETURN_FALSE;
- }
-
- temp_len += len;
- temp = erealloc(temp, temp_len+1);
- bptr = buf;
- tptr = buf + strlen(buf) -1;
- while (isspace((int)*(unsigned char *)tptr) && (*tptr!=delimiter) && (tptr > bptr)) {
- tptr--;
- }
- tptr++;
- strcpy(lineEnd, tptr);
- *tptr++ = ' ';
- *tptr = 0;
-
- tptr = temp; /* reset temp pointer to end of field as read so far */
- while (*tptr) {
- tptr++;
- }
- }
- }
- }
- } else {
- /* 2B. Handle non-enclosure field */
- while ((*bptr != delimiter) && *bptr) {
- *tptr++ = *bptr++;
- }
- *tptr=0; /* terminate temporary string */
-
- if (strlen(temp)) {
- tptr--;
- while (isspace((int)*(unsigned char *)tptr) && (*tptr!=delimiter)) {
- *tptr-- = 0; /* strip any trailing spaces */
- }
- }
-
- if (*bptr == delimiter) {
- bptr++;
- }
- }
-
- /* 3. Now pass our field back to php */
- add_next_index_string(return_value, temp, 1);
- tptr = temp;
- } while (*bptr);
-
- efree(lineEnd);
- efree(temp);
- efree(buf);
-}
-/* }}} */
-
-#if (!defined(PHP_WIN32) && !defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
-/* {{{ proto string realpath(string path)
- Return the resolved path */
-PHP_FUNCTION(realpath)
-{
- zval **path;
- char resolved_path_buff[MAXPATHLEN];
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &path) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(path);
-
- if (VCWD_REALPATH(Z_STRVAL_PP(path), resolved_path_buff)) {
- RETURN_STRING(resolved_path_buff, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-#endif
-
-/* See http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2 */
-#define PHP_META_HTML401_CHARS "-_.:"
-
-/* {{{ php_next_meta_token
- Tokenizes an HTML file for get_meta_tags */
-php_meta_tags_token php_next_meta_token(php_meta_tags_data *md TSRMLS_DC)
-{
- int ch = 0, compliment;
- char buff[META_DEF_BUFSIZE + 1];
-
- memset((void *)buff, 0, META_DEF_BUFSIZE + 1);
-
- while (md->ulc || (!php_stream_eof(md->stream) && (ch = php_stream_getc(md->stream)))) {
- if(php_stream_eof(md->stream)) {
- break;
- }
-
- if (md->ulc) {
- ch = md->lc;
- md->ulc = 0;
- }
-
- switch (ch) {
- case '<':
- return TOK_OPENTAG;
- break;
-
- case '>':
- return TOK_CLOSETAG;
- break;
-
- case '=':
- return TOK_EQUAL;
- break;
- case '/':
- return TOK_SLASH;
- break;
-
- case '\'':
- case '"':
- compliment = ch;
- md->token_len = 0;
- while (!php_stream_eof(md->stream) && (ch = php_stream_getc(md->stream)) && ch != compliment && ch != '<' && ch != '>') {
- buff[(md->token_len)++] = ch;
-
- if (md->token_len == META_DEF_BUFSIZE) {
- break;
- }
- }
-
- if (ch == '<' || ch == '>') {
- /* Was just an apostrohpe */
- md->ulc = 1;
- md->lc = ch;
- }
-
- /* We don't need to alloc unless we are in a meta tag */
- if (md->in_meta) {
- md->token_data = (char *) emalloc(md->token_len + 1);
- memcpy(md->token_data, buff, md->token_len+1);
- }
-
- return TOK_STRING;
- break;
-
- case '\n':
- case '\r':
- case '\t':
- break;
-
- case ' ':
- return TOK_SPACE;
- break;
-
- default:
- if (isalnum(ch)) {
- md->token_len = 0;
- buff[(md->token_len)++] = ch;
- while (!php_stream_eof(md->stream) && (ch = php_stream_getc(md->stream)) && (isalnum(ch) || strchr(PHP_META_HTML401_CHARS, ch))) {
- buff[(md->token_len)++] = ch;
-
- if (md->token_len == META_DEF_BUFSIZE) {
- break;
- }
- }
-
- /* This is ugly, but we have to replace ungetc */
- if (!isalpha(ch) && ch != '-') {
- md->ulc = 1;
- md->lc = ch;
- }
-
- md->token_data = (char *) emalloc(md->token_len + 1);
- memcpy(md->token_data, buff, md->token_len+1);
-
- return TOK_ID;
- } else {
- return TOK_OTHER;
- }
- break;
- }
- }
-
- return TOK_EOF;
-}
-
-/* }}} */
-
-#ifdef HAVE_FNMATCH
-/* {{{ proto bool fnmatch(string pattern, string filename [, int flags])
- Match filename against pattern */
-PHP_FUNCTION(fnmatch)
-{
- char *pattern = NULL;
- char *filename = NULL;
- int argc = ZEND_NUM_ARGS();
- int pattern_len;
- int filename_len;
- long flags=0;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "ss|l",
- &pattern, &pattern_len,
- &filename, &filename_len,
- &flags)
- == FAILURE)
- return;
-
- RETURN_BOOL( ! fnmatch( pattern, filename, flags ));
-}
-/* }}} */
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/standard/file.h b/ext/standard/file.h
deleted file mode 100644
index c797bd11fb..0000000000
--- a/ext/standard/file.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* Synced with php 3.0 revision 1.30 1999-06-16 [ssb] */
-
-#ifndef FILE_H
-#define FILE_H
-
-PHP_MINIT_FUNCTION(file);
-PHP_MSHUTDOWN_FUNCTION(file);
-
-PHP_FUNCTION(tempnam);
-PHP_NAMED_FUNCTION(php_if_tmpfile);
-PHP_NAMED_FUNCTION(php_if_fopen);
-PHPAPI PHP_FUNCTION(fclose);
-PHP_FUNCTION(popen);
-PHP_FUNCTION(pclose);
-PHPAPI PHP_FUNCTION(feof);
-PHPAPI PHP_FUNCTION(fread);
-PHPAPI PHP_FUNCTION(fgetc);
-PHPAPI PHP_FUNCTION(fgets);
-PHP_FUNCTION(fscanf);
-PHPAPI PHP_FUNCTION(fgetss);
-PHP_FUNCTION(fgetcsv);
-PHPAPI PHP_FUNCTION(fwrite);
-PHPAPI PHP_FUNCTION(fflush);
-PHPAPI PHP_FUNCTION(rewind);
-PHPAPI PHP_FUNCTION(ftell);
-PHPAPI PHP_FUNCTION(fseek);
-PHP_FUNCTION(mkdir);
-PHP_FUNCTION(rmdir);
-PHPAPI PHP_FUNCTION(fpassthru);
-PHP_FUNCTION(readfile);
-PHP_FUNCTION(umask);
-PHP_FUNCTION(rename);
-PHP_FUNCTION(unlink);
-PHP_FUNCTION(copy);
-PHP_FUNCTION(file);
-PHP_FUNCTION(file_get_contents);
-PHP_FUNCTION(file_put_contents);
-PHP_FUNCTION(get_meta_tags);
-PHP_FUNCTION(flock);
-PHP_FUNCTION(fd_set);
-PHP_FUNCTION(fd_isset);
-#if (!defined(PHP_WIN32) && !defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS)
-PHP_FUNCTION(realpath);
-PHP_FUNCTION(fnmatch);
-#endif
-PHP_NAMED_FUNCTION(php_if_ftruncate);
-PHP_NAMED_FUNCTION(php_if_fstat);
-
-PHP_MINIT_FUNCTION(user_streams);
-
-PHPAPI int php_le_stream_context(void);
-PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC);
-PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC);
-
-#define META_DEF_BUFSIZE 8192
-
-#define PHP_FILE_USE_INCLUDE_PATH 1
-#define PHP_FILE_IGNORE_NEW_LINES 2
-#define PHP_FILE_SKIP_EMPTY_LINES 4
-#define PHP_FILE_APPEND 8
-
-typedef enum _php_meta_tags_token {
- TOK_EOF = 0,
- TOK_OPENTAG,
- TOK_CLOSETAG,
- TOK_SLASH,
- TOK_EQUAL,
- TOK_SPACE,
- TOK_ID,
- TOK_STRING,
- TOK_OTHER
-} php_meta_tags_token;
-
-typedef struct _php_meta_tags_data {
- php_stream *stream;
- int ulc;
- int lc;
- char *input_buffer;
- char *token_data;
- int token_len;
- int in_meta;
-} php_meta_tags_data;
-
-php_meta_tags_token php_next_meta_token(php_meta_tags_data * TSRMLS_DC);
-
-typedef struct {
- int pclose_ret;
- size_t def_chunk_size;
- long auto_detect_line_endings;
- long default_socket_timeout;
- char *user_agent;
- char *user_stream_current_filename; /* for simple recursion protection */
-} php_file_globals;
-
-#ifdef ZTS
-#define FG(v) TSRMG(file_globals_id, php_file_globals *, v)
-extern int file_globals_id;
-#else
-#define FG(v) (file_globals.v)
-extern php_file_globals file_globals;
-#endif
-
-
-#endif /* FILE_H */
-
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
deleted file mode 100644
index 3dd5ab5bdc..0000000000
--- a/ext/standard/filestat.c
+++ /dev/null
@@ -1,932 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "safe_mode.h"
-#include "fopen_wrappers.h"
-#include "php_globals.h"
-
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <time.h>
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_SYS_VFS_H
-# include <sys/vfs.h>
-#endif
-
-#ifdef OS2
-# define INCL_DOS
-# include <os2.h>
-#endif
-
-#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
-# include <sys/statvfs.h>
-#elif defined(HAVE_SYS_STATFS_H) && defined(HAVE_STATFS)
-# include <sys/statfs.h>
-#elif defined(HAVE_SYS_MOUNT_H) && defined(HAVE_STATFS)
-# include <sys/mount.h>
-#endif
-
-#if HAVE_PWD_H
-# ifdef PHP_WIN32
-# include "win32/pwd.h"
-# elif defined(NETWARE)
-# include "netware/pwd.h"
-# else
-# include <pwd.h>
-# endif
-#endif
-
-#if HAVE_GRP_H
-# ifdef PHP_WIN32
-# include "win32/grp.h"
-# else
-# include <grp.h>
-# endif
-#endif
-
-#if HAVE_UTIME
-# ifdef PHP_WIN32
-# include <sys/utime.h>
-# else
-# include <utime.h>
-# endif
-#endif
-
-#include "basic_functions.h"
-#include "php_filestat.h"
-
-#ifndef S_ISDIR
-#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
-#endif
-#ifndef S_ISREG
-#define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG)
-#endif
-#ifndef S_ISLNK
-#define S_ISLNK(mode) (((mode)&S_IFMT) == S_IFLNK)
-#endif
-
-#define S_IXROOT ( S_IXUSR | S_IXGRP | S_IXOTH )
-
-/* Switches for various filestat functions: */
-#define FS_PERMS 0
-#define FS_INODE 1
-#define FS_SIZE 2
-#define FS_OWNER 3
-#define FS_GROUP 4
-#define FS_ATIME 5
-#define FS_MTIME 6
-#define FS_CTIME 7
-#define FS_TYPE 8
-#define FS_IS_W 9
-#define FS_IS_R 10
-#define FS_IS_X 11
-#define FS_IS_FILE 12
-#define FS_IS_DIR 13
-#define FS_IS_LINK 14
-#define FS_EXISTS 15
-#define FS_LSTAT 16
-#define FS_STAT 17
-
-
-PHP_RINIT_FUNCTION(filestat)
-{
- BG(CurrentStatFile)=NULL;
- BG(CurrentStatLength)=0;
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(filestat)
-{
- if (BG(CurrentStatFile)) {
- efree (BG(CurrentStatFile));
- }
- return SUCCESS;
-}
-
-/* {{{ proto float disk_total_space(string path)
- Get total disk space for filesystem that path is on */
-PHP_FUNCTION(disk_total_space)
-{
- pval **path;
-#ifdef WINDOWS
- double bytestotal;
-
- HINSTANCE kernel32;
- FARPROC gdfse;
- typedef BOOL (WINAPI *gdfse_func)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
- gdfse_func func;
-
- /* These are used by GetDiskFreeSpaceEx, if available. */
- ULARGE_INTEGER FreeBytesAvailableToCaller;
- ULARGE_INTEGER TotalNumberOfBytes;
- ULARGE_INTEGER TotalNumberOfFreeBytes;
-
- /* These are used by GetDiskFreeSpace otherwise. */
- DWORD SectorsPerCluster;
- DWORD BytesPerSector;
- DWORD NumberOfFreeClusters;
- DWORD TotalNumberOfClusters;
-
-#else /* not - WINDOWS */
-#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
- struct statvfs buf;
-#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS)
- struct statfs buf;
-#endif
- double bytestotal = 0;
-#endif /* WINDOWS */
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &path)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(path);
-
- if (php_check_open_basedir(Z_STRVAL_PP(path) TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
-#ifdef WINDOWS
- /* GetDiskFreeSpaceEx is only available in NT and Win95 post-OSR2,
- so we have to jump through some hoops to see if the function
- exists. */
- kernel32 = LoadLibrary("kernel32.dll");
- if (kernel32) {
- gdfse = GetProcAddress(kernel32, "GetDiskFreeSpaceExA");
- /* It's available, so we can call it. */
- if (gdfse) {
- func = (gdfse_func)gdfse;
- if (func(Z_STRVAL_PP(path),
- &FreeBytesAvailableToCaller,
- &TotalNumberOfBytes,
- &TotalNumberOfFreeBytes) == 0) RETURN_FALSE;
-
- /* i know - this is ugly, but i works <thies@thieso.net> */
- bytestotal = TotalNumberOfBytes.HighPart *
- (double) (((unsigned long)1) << 31) * 2.0 +
- TotalNumberOfBytes.LowPart;
- }
- /* If it's not available, we just use GetDiskFreeSpace */
- else {
- if (GetDiskFreeSpace(Z_STRVAL_PP(path),
- &SectorsPerCluster, &BytesPerSector,
- &NumberOfFreeClusters, &TotalNumberOfClusters) == 0) RETURN_FALSE;
- bytestotal = (double)TotalNumberOfClusters * (double)SectorsPerCluster * (double)BytesPerSector;
- }
- }
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to load kernel32.dll");
- RETURN_FALSE;
- }
-
-#elif defined(OS2)
- {
- FSALLOCATE fsinfo;
- char drive = Z_STRVAL_PP(path)[0] & 95;
-
- if (DosQueryFSInfo( drive ? drive - 64 : 0, FSIL_ALLOC, &fsinfo, sizeof( fsinfo ) ) == 0)
- bytestotal = (double)fsinfo.cbSector * fsinfo.cSectorUnit * fsinfo.cUnit;
- }
-#else /* WINDOWS, OS/2 */
-#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
- if (statvfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE;
- if (buf.f_frsize) {
- bytestotal = (((double)buf.f_blocks) * ((double)buf.f_frsize));
- } else {
- bytestotal = (((double)buf.f_blocks) * ((double)buf.f_bsize));
- }
-
-#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS)
- if (statfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE;
- bytestotal = (((double)buf.f_bsize) * ((double)buf.f_blocks));
-#endif
-#endif /* WINDOWS */
-
- RETURN_DOUBLE(bytestotal);
-}
-/* }}} */
-
-/* {{{ proto float disk_free_space(string path)
- Get free disk space for filesystem that path is on */
-PHP_FUNCTION(disk_free_space)
-{
- pval **path;
-#ifdef WINDOWS
- double bytesfree;
-
- HINSTANCE kernel32;
- FARPROC gdfse;
- typedef BOOL (WINAPI *gdfse_func)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
- gdfse_func func;
-
- /* These are used by GetDiskFreeSpaceEx, if available. */
- ULARGE_INTEGER FreeBytesAvailableToCaller;
- ULARGE_INTEGER TotalNumberOfBytes;
- ULARGE_INTEGER TotalNumberOfFreeBytes;
-
- /* These are used by GetDiskFreeSpace otherwise. */
- DWORD SectorsPerCluster;
- DWORD BytesPerSector;
- DWORD NumberOfFreeClusters;
- DWORD TotalNumberOfClusters;
-
-#else /* not - WINDOWS */
-#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
- struct statvfs buf;
-#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS)
- struct statfs buf;
-#endif
- double bytesfree = 0;
-#endif /* WINDOWS */
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &path)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(path);
-
- if (php_check_open_basedir(Z_STRVAL_PP(path) TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
-#ifdef WINDOWS
- /* GetDiskFreeSpaceEx is only available in NT and Win95 post-OSR2,
- so we have to jump through some hoops to see if the function
- exists. */
- kernel32 = LoadLibrary("kernel32.dll");
- if (kernel32) {
- gdfse = GetProcAddress(kernel32, "GetDiskFreeSpaceExA");
- /* It's available, so we can call it. */
- if (gdfse) {
- func = (gdfse_func)gdfse;
- if (func(Z_STRVAL_PP(path),
- &FreeBytesAvailableToCaller,
- &TotalNumberOfBytes,
- &TotalNumberOfFreeBytes) == 0) RETURN_FALSE;
-
- /* i know - this is ugly, but i works <thies@thieso.net> */
- bytesfree = FreeBytesAvailableToCaller.HighPart *
- (double) (((unsigned long)1) << 31) * 2.0 +
- FreeBytesAvailableToCaller.LowPart;
- }
- /* If it's not available, we just use GetDiskFreeSpace */
- else {
- if (GetDiskFreeSpace(Z_STRVAL_PP(path),
- &SectorsPerCluster, &BytesPerSector,
- &NumberOfFreeClusters, &TotalNumberOfClusters) == 0) RETURN_FALSE;
- bytesfree = (double)NumberOfFreeClusters * (double)SectorsPerCluster * (double)BytesPerSector;
- }
- }
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to load kernel32.dll");
- RETURN_FALSE;
- }
-
-#elif defined(OS2)
- {
- FSALLOCATE fsinfo;
- char drive = Z_STRVAL_PP(path)[0] & 95;
-
- if (DosQueryFSInfo( drive ? drive - 64 : 0, FSIL_ALLOC, &fsinfo, sizeof( fsinfo ) ) == 0)
- bytesfree = (double)fsinfo.cbSector * fsinfo.cSectorUnit * fsinfo.cUnitAvail;
- }
-#else /* WINDOWS, OS/2 */
-#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
- if (statvfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE;
- if (buf.f_frsize) {
- bytesfree = (((double)buf.f_bavail) * ((double)buf.f_frsize));
- } else {
- bytesfree = (((double)buf.f_bavail) * ((double)buf.f_bsize));
- }
-#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS)
- if (statfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE;
- bytesfree = (((double)buf.f_bsize) * ((double)buf.f_bavail));
-#endif
-#endif /* WINDOWS */
-
- RETURN_DOUBLE(bytesfree);
-}
-/* }}} */
-
-/* {{{ proto bool chgrp(string filename, mixed group)
- Change file group */
-PHP_FUNCTION(chgrp)
-{
-#if !defined(WINDOWS) && !defined(NETWARE) /* I guess 'chgrp' won't be available on NetWare */
- pval **filename, **group;
- gid_t gid;
- struct group *gr=NULL;
- int ret;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &filename, &group)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
- if (Z_TYPE_PP(group) == IS_STRING) {
- gr = getgrnam(Z_STRVAL_PP(group));
- if (!gr) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find gid for %s",
- Z_STRVAL_PP(group));
- RETURN_FALSE;
- }
- gid = gr->gr_gid;
- } else {
- convert_to_long_ex(group);
- gid = Z_LVAL_PP(group);
- }
-
- if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) {
- RETURN_FALSE;
- }
-
- /* Check the basedir */
- if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- ret = VCWD_CHOWN(Z_STRVAL_PP(filename), -1, gid);
- if (ret == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-#else
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto bool chown (string filename, mixed user)
- Change file owner */
-PHP_FUNCTION(chown)
-{
-#if !defined(WINDOWS) && !defined(NETWARE) /* I guess 'chown' won't be available on NetWare */
- pval **filename, **user;
- int ret;
- uid_t uid;
- struct passwd *pw = NULL;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &filename, &user)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
- if (Z_TYPE_PP(user) == IS_STRING) {
- pw = getpwnam(Z_STRVAL_PP(user));
- if (!pw) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find uid for %s",
- Z_STRVAL_PP(user));
- RETURN_FALSE;
- }
- uid = pw->pw_uid;
- } else {
- convert_to_long_ex(user);
- uid = Z_LVAL_PP(user);
- }
-
- if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) {
- RETURN_FALSE;
- }
-
- /* Check the basedir */
- if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- ret = VCWD_CHOWN(Z_STRVAL_PP(filename), uid, -1);
- if (ret == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
- RETURN_FALSE;
- }
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool chmod(string filename, int mode)
- Change file mode */
-PHP_FUNCTION(chmod)
-{
- pval **filename, **mode;
- int ret;
- mode_t imode;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &filename, &mode)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
- convert_to_long_ex(mode);
-
- if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) {
- RETURN_FALSE;
- }
-
- /* Check the basedir */
- if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- imode = (mode_t) Z_LVAL_PP(mode);
- /* in safe mode, do not allow to setuid files.
- Setuiding files could allow users to gain privileges
- that safe mode doesn't give them.
- */
- if(PG(safe_mode))
- imode &= 0777;
-
- ret = VCWD_CHMOD(Z_STRVAL_PP(filename), imode);
- if (ret == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-#if HAVE_UTIME
-/* {{{ proto bool touch(string filename [, int time [, int atime]])
- Set modification time of file */
-PHP_FUNCTION(touch)
-{
- pval **filename, **filetime, **fileatime;
- int ret;
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- struct stat_libc sb;
-#else
- struct stat sb;
-#endif
- FILE *file;
- struct utimbuf newtimebuf;
- struct utimbuf *newtime = NULL;
- int ac = ZEND_NUM_ARGS();
-
-
- if (ac == 1 && zend_get_parameters_ex(1, &filename) != FAILURE) {
-#ifndef HAVE_UTIME_NULL
- newtime = &newtimebuf;
- newtime->modtime = newtime->actime = time(NULL);
-#endif
- } else if (ac == 2 && zend_get_parameters_ex(2, &filename, &filetime) != FAILURE) {
- convert_to_long_ex(filetime);
- newtime = &newtimebuf;
- newtime->modtime = newtime->actime = Z_LVAL_PP(filetime);
- } else if (ac == 3 && zend_get_parameters_ex(3, &filename, &filetime, &fileatime) != FAILURE) {
- convert_to_long_ex(fileatime);
- convert_to_long_ex(filetime);
- newtime = &newtimebuf;
- newtime->actime = Z_LVAL_PP(fileatime);
- newtime->modtime = Z_LVAL_PP(filetime);
- } else {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- /* Check the basedir */
- if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- /* create the file if it doesn't exist already */
- ret = VCWD_STAT(Z_STRVAL_PP(filename), &sb);
- if (ret == -1) {
- file = VCWD_FOPEN(Z_STRVAL_PP(filename), "w");
- if (file == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create file %s because %s", Z_STRVAL_PP(filename), strerror(errno));
- RETURN_FALSE;
- }
- fclose(file);
- }
-
- ret = VCWD_UTIME(Z_STRVAL_PP(filename), newtime);
- if (ret == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Utime failed: %s", strerror(errno));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-/* {{{ proto void clearstatcache(void)
- Clear file stat cache */
-PHP_FUNCTION(clearstatcache)
-{
- if (BG(CurrentStatFile)) {
- efree(BG(CurrentStatFile));
- BG(CurrentStatFile) = NULL;
- }
-}
-/* }}} */
-
-#define IS_LINK_OPERATION(__t) ((__t) == FS_TYPE || (__t) == FS_IS_LINK || (__t) == FS_LSTAT)
-#define IS_EXISTS_CHECK(__t) ((__t) == FS_EXISTS || (__t) == FS_IS_W || (__t) == FS_IS_R || (__t) == FS_IS_X || (__t) == FS_IS_FILE || (__t) == FS_IS_DIR || (__t) == FS_IS_LINK)
-
-/* {{{ php_stat
- */
-static void php_stat(const char *filename, php_stat_len filename_length, int type, pval *return_value TSRMLS_DC)
-{
- zval *stat_dev, *stat_ino, *stat_mode, *stat_nlink, *stat_uid, *stat_gid, *stat_rdev,
- *stat_size, *stat_atime, *stat_mtime, *stat_ctime, *stat_blksize, *stat_blocks;
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- struct stat_libc *stat_sb;
-#else
- struct stat *stat_sb;
-#endif
- int rmask=S_IROTH, wmask=S_IWOTH, xmask=S_IXOTH; /* access rights defaults to other */
- char *stat_sb_names[13]={"dev", "ino", "mode", "nlink", "uid", "gid", "rdev",
- "size", "atime", "mtime", "ctime", "blksize", "blocks"};
-
- if (!filename_length) {
- RETURN_FALSE;
- }
-
- if (PG(safe_mode) &&(!php_checkuid_ex(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR, IS_EXISTS_CHECK(type) ? CHECKUID_NO_ERRORS : 0))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(filename TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- switch (type) {
- case FS_IS_W:
- RETURN_BOOL (!VCWD_ACCESS(filename, W_OK));
- case FS_IS_R:
- RETURN_BOOL (!VCWD_ACCESS(filename, R_OK));
- case FS_IS_X:
- RETURN_BOOL (!VCWD_ACCESS(filename, X_OK));
- case FS_EXISTS:
- RETURN_BOOL (!VCWD_ACCESS(filename, F_OK));
- }
-
- stat_sb = &BG(sb);
-
- if (!BG(CurrentStatFile) || strcmp(filename, BG(CurrentStatFile))) {
- if (!BG(CurrentStatFile) || filename_length > BG(CurrentStatLength)) {
- if (BG(CurrentStatFile)) {
- efree(BG(CurrentStatFile));
- }
- BG(CurrentStatLength) = filename_length;
- BG(CurrentStatFile) = estrndup(filename, filename_length);
- } else {
- memcpy(BG(CurrentStatFile), filename, filename_length+1);
- }
-#if HAVE_SYMLINK
- BG(lsb).st_mode = 0; /* mark lstat buf invalid */
-#endif
- if (VCWD_STAT(BG(CurrentStatFile), &BG(sb)) == -1) {
- if (!IS_LINK_OPERATION(type) && (!IS_EXISTS_CHECK(type) || errno != ENOENT)) { /* fileexists() test must print no error */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Stat failed for %s (errno=%d - %s)", BG(CurrentStatFile), errno, strerror(errno));
- }
- efree(BG(CurrentStatFile));
- BG(CurrentStatFile) = NULL;
-#if HAVE_SYMLINK
- if (!IS_LINK_OPERATION(type)) /* Don't require success for link operation */
-#endif
- RETURN_FALSE;
- }
- }
-
-#if HAVE_SYMLINK
- if (IS_LINK_OPERATION(type) && !BG(lsb).st_mode) {
- /* do lstat if the buffer is empty */
- if (VCWD_LSTAT(filename, &BG(lsb)) == -1) {
- if (!IS_EXISTS_CHECK(type) || errno != ENOENT) { /* fileexists() test must print no error */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Lstat failed for %s (errno=%d - %s)", BG(CurrentStatFile), errno, strerror(errno));
- }
- RETURN_FALSE;
- }
- }
-#endif
-
-
-#ifndef NETWARE
- if (type >= FS_IS_W && type <= FS_IS_X) {
- if(BG(sb).st_uid==getuid()) {
- rmask=S_IRUSR;
- wmask=S_IWUSR;
- xmask=S_IXUSR;
- } else if(BG(sb).st_gid==getgid()) {
- rmask=S_IRGRP;
- wmask=S_IWGRP;
- xmask=S_IXGRP;
- } else {
- int groups, n, i;
- gid_t *gids;
-
- groups = getgroups(0, NULL);
- if(groups) {
- gids=(gid_t *)emalloc(groups*sizeof(gid_t));
- n=getgroups(groups, gids);
- for(i=0;i<n;i++){
- if(BG(sb).st_gid==gids[i]) {
- rmask=S_IRGRP;
- wmask=S_IWGRP;
- xmask=S_IXGRP;
- break;
- }
- }
- efree(gids);
- }
- }
- }
-#endif
-
- switch (type) {
- case FS_PERMS:
- RETURN_LONG((long)BG(sb).st_mode);
- case FS_INODE:
- RETURN_LONG((long)BG(sb).st_ino);
- case FS_SIZE:
-#if defined(NETWARE) && defined(NEW_LIBC)
- RETURN_LONG((long)(stat_sb->st_size));
-#else
- RETURN_LONG((long)BG(sb).st_size);
-#endif
- case FS_OWNER:
- RETURN_LONG((long)BG(sb).st_uid);
- case FS_GROUP:
- RETURN_LONG((long)BG(sb).st_gid);
- case FS_ATIME:
-#if defined(NETWARE) && defined(NEW_LIBC)
- RETURN_LONG((long)((stat_sb->st_atime).tv_sec));
-#else
- RETURN_LONG((long)BG(sb).st_atime);
-#endif
- case FS_MTIME:
-#if defined(NETWARE) && defined(NEW_LIBC)
- RETURN_LONG((long)((stat_sb->st_mtime).tv_sec));
-#else
- RETURN_LONG((long)BG(sb).st_mtime);
-#endif
- case FS_CTIME:
-#if defined(NETWARE) && defined(NEW_LIBC)
- RETURN_LONG((long)((stat_sb->st_ctime).tv_sec));
-#else
- RETURN_LONG((long)BG(sb).st_ctime);
-#endif
- case FS_TYPE:
-#if HAVE_SYMLINK
- if (S_ISLNK(BG(lsb).st_mode)) {
- RETURN_STRING("link", 1);
- }
-#endif
- switch(BG(sb).st_mode&S_IFMT) {
- case S_IFIFO: RETURN_STRING("fifo", 1);
- case S_IFCHR: RETURN_STRING("char", 1);
- case S_IFDIR: RETURN_STRING("dir", 1);
- case S_IFBLK: RETURN_STRING("block", 1);
- case S_IFREG: RETURN_STRING("file", 1);
-#if defined(S_IFSOCK) && !defined(ZEND_WIN32)&&!defined(__BEOS__)
- case S_IFSOCK: RETURN_STRING("socket", 1);
-#endif
- }
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown file type (%d)", BG(sb).st_mode&S_IFMT);
- RETURN_STRING("unknown", 1);
- case FS_IS_W:
-#ifndef NETWARE /* getuid is not available on NetWare */
- if (getuid()==0) {
- RETURN_TRUE; /* root */
- }
-#endif /* NETWARE */
- RETURN_BOOL((BG(sb).st_mode & wmask) != 0);
- case FS_IS_R:
-#ifndef NETWARE /* getuid is not available on NetWare */
- if (getuid()==0) {
- RETURN_TRUE; /* root */
- }
-#endif /* NETWARE */
- RETURN_BOOL((BG(sb).st_mode&rmask)!=0);
- case FS_IS_X:
-#ifndef NETWARE /* getuid is not available on NetWare */
- if (getuid()==0) {
- xmask = S_IXROOT; /* root */
- }
-#endif /* NETWARE */
- RETURN_BOOL((BG(sb).st_mode&xmask)!=0 && !S_ISDIR(BG(sb).st_mode));
- case FS_IS_FILE:
- RETURN_BOOL(S_ISREG(BG(sb).st_mode));
- case FS_IS_DIR:
- RETURN_BOOL(S_ISDIR(BG(sb).st_mode));
- case FS_IS_LINK:
-#if HAVE_SYMLINK
- RETURN_BOOL(S_ISLNK(BG(lsb).st_mode));
-#else
- RETURN_FALSE;
-#endif
- case FS_EXISTS:
- RETURN_TRUE; /* the false case was done earlier */
- case FS_LSTAT:
-#if HAVE_SYMLINK
- stat_sb = &BG(lsb);
-#endif
- /* FALLTHROUGH */
- case FS_STAT:
- array_init(return_value);
-
- MAKE_LONG_ZVAL_INCREF(stat_dev, stat_sb->st_dev);
- MAKE_LONG_ZVAL_INCREF(stat_ino, stat_sb->st_ino);
- MAKE_LONG_ZVAL_INCREF(stat_mode, stat_sb->st_mode);
- MAKE_LONG_ZVAL_INCREF(stat_nlink, stat_sb->st_nlink);
- MAKE_LONG_ZVAL_INCREF(stat_uid, stat_sb->st_uid);
- MAKE_LONG_ZVAL_INCREF(stat_gid, stat_sb->st_gid);
-#ifdef HAVE_ST_RDEV
- MAKE_LONG_ZVAL_INCREF(stat_rdev, stat_sb->st_rdev);
-#else
- MAKE_LONG_ZVAL_INCREF(stat_rdev, -1);
-#endif
- MAKE_LONG_ZVAL_INCREF(stat_size, stat_sb->st_size);
-#if defined(NETWARE) && defined(NEW_LIBC)
- MAKE_LONG_ZVAL_INCREF(stat_atime, (stat_sb->st_atime).tv_sec);
- MAKE_LONG_ZVAL_INCREF(stat_mtime, (stat_sb->st_mtime).tv_sec);
- MAKE_LONG_ZVAL_INCREF(stat_ctime, (stat_sb->st_ctime).tv_sec);
-#else
- MAKE_LONG_ZVAL_INCREF(stat_atime, stat_sb->st_atime);
- MAKE_LONG_ZVAL_INCREF(stat_mtime, stat_sb->st_mtime);
- MAKE_LONG_ZVAL_INCREF(stat_ctime, stat_sb->st_ctime);
-#endif
-#ifdef HAVE_ST_BLKSIZE
- MAKE_LONG_ZVAL_INCREF(stat_blksize, stat_sb->st_blksize);
-#else
- MAKE_LONG_ZVAL_INCREF(stat_blksize,-1);
-#endif
-#ifdef HAVE_ST_BLOCKS
- MAKE_LONG_ZVAL_INCREF(stat_blocks, stat_sb->st_blocks);
-#else
- MAKE_LONG_ZVAL_INCREF(stat_blocks,-1);
-#endif
- /* Store numeric indexes in propper order */
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_dev, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_ino, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_mode, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_nlink, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_uid, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_gid, sizeof(zval *), NULL);
-
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_rdev, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_size, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_atime, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_mtime, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_ctime, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_blksize, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_blocks, sizeof(zval *), NULL);
-
- /* Store string indexes referencing the same zval*/
- zend_hash_update(HASH_OF(return_value), stat_sb_names[0], strlen(stat_sb_names[0])+1, (void *) &stat_dev, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[1], strlen(stat_sb_names[1])+1, (void *) &stat_ino, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[2], strlen(stat_sb_names[2])+1, (void *) &stat_mode, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[3], strlen(stat_sb_names[3])+1, (void *) &stat_nlink, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[4], strlen(stat_sb_names[4])+1, (void *) &stat_uid, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[5], strlen(stat_sb_names[5])+1, (void *) &stat_gid, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[6], strlen(stat_sb_names[6])+1, (void *) &stat_rdev, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[7], strlen(stat_sb_names[7])+1, (void *) &stat_size, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[8], strlen(stat_sb_names[8])+1, (void *) &stat_atime, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[9], strlen(stat_sb_names[9])+1, (void *) &stat_mtime, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[10], strlen(stat_sb_names[10])+1, (void *) &stat_ctime, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[11], strlen(stat_sb_names[11])+1, (void *) &stat_blksize, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value), stat_sb_names[12], strlen(stat_sb_names[12])+1, (void *) &stat_blocks, sizeof(zval *), NULL);
-
- return;
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Didn't understand stat call");
- RETURN_FALSE;
-}
-/* }}} */
-
-/* another quickie macro to make defining similar functions easier */
-#define FileFunction(name, funcnum) \
-void name(INTERNAL_FUNCTION_PARAMETERS) { \
- pval **filename; \
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) { \
- WRONG_PARAM_COUNT; \
- } \
- convert_to_string_ex(filename); \
- php_stat(Z_STRVAL_PP(filename), (php_stat_len) Z_STRLEN_PP(filename), funcnum, return_value TSRMLS_CC); \
-}
-
-/* {{{ proto int fileperms(string filename)
- Get file permissions */
-FileFunction(PHP_FN(fileperms), FS_PERMS)
-/* }}} */
-
-/* {{{ proto int fileinode(string filename)
- Get file inode */
-FileFunction(PHP_FN(fileinode), FS_INODE)
-/* }}} */
-
-/* {{{ proto int filesize(string filename)
- Get file size */
-FileFunction(PHP_FN(filesize), FS_SIZE)
-/* }}} */
-
-/* {{{ proto int fileowner(string filename)
- Get file owner */
-FileFunction(PHP_FN(fileowner), FS_OWNER)
-/* }}} */
-
-/* {{{ proto int filegroup(string filename)
- Get file group */
-FileFunction(PHP_FN(filegroup), FS_GROUP)
-/* }}} */
-
-/* {{{ proto int fileatime(string filename)
- Get last access time of file */
-FileFunction(PHP_FN(fileatime), FS_ATIME)
-/* }}} */
-
-/* {{{ proto int filemtime(string filename)
- Get last modification time of file */
-FileFunction(PHP_FN(filemtime), FS_MTIME)
-/* }}} */
-
-/* {{{ proto int filectime(string filename)
- Get inode modification time of file */
-FileFunction(PHP_FN(filectime), FS_CTIME)
-/* }}} */
-
-/* {{{ proto string filetype(string filename)
- Get file type */
-FileFunction(PHP_FN(filetype), FS_TYPE)
-/* }}} */
-
-/* {{{ proto bool is_writable(string filename)
- Returns true if file can be written */
-FileFunction(PHP_FN(is_writable), FS_IS_W)
-/* }}} */
-
-/* {{{ proto bool is_readable(string filename)
- Returns true if file can be read */
-FileFunction(PHP_FN(is_readable), FS_IS_R)
-/* }}} */
-
-/* {{{ proto bool is_executable(string filename)
- Returns true if file is executable */
-FileFunction(PHP_FN(is_executable), FS_IS_X)
-/* }}} */
-
-/* {{{ proto bool is_file(string filename)
- Returns true if file is a regular file */
-FileFunction(PHP_FN(is_file), FS_IS_FILE)
-/* }}} */
-
-/* {{{ proto bool is_dir(string filename)
- Returns true if file is directory */
-FileFunction(PHP_FN(is_dir), FS_IS_DIR)
-/* }}} */
-
-/* {{{ proto bool is_link(string filename)
- Returns true if file is symbolic link */
-FileFunction(PHP_FN(is_link), FS_IS_LINK)
-/* }}} */
-
-/* {{{ proto bool file_exists(string filename)
- Returns true if filename exists */
-FileFunction(PHP_FN(file_exists), FS_EXISTS)
-/* }}} */
-
-/* {{{ proto array lstat(string filename)
- Give information about a file or symbolic link */
-FileFunction(php_if_lstat, FS_LSTAT)
-/* }}} */
-
-/* {{{ proto array stat(string filename)
- Give information about a file */
-FileFunction(php_if_stat, FS_STAT)
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
deleted file mode 100644
index 4f03514e82..0000000000
--- a/ext/standard/filters.c
+++ /dev/null
@@ -1,1755 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | Wez Furlong (wez@thebrainroom.com) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/basic_functions.h"
-#include "ext/standard/file.h"
-#include "ext/standard/php_string.h"
-#include "ext/standard/php_smart_str.h"
-
-/* {{{ rot13 stream filter implementation */
-static char rot13_from[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
-static char rot13_to[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
-
-static php_stream_filter_status_t strfilter_rot13_filter(
- php_stream *stream,
- php_stream_filter *thisfilter,
- php_stream_bucket_brigade *buckets_in,
- php_stream_bucket_brigade *buckets_out,
- size_t *bytes_consumed,
- int flags
- TSRMLS_DC)
-{
- php_stream_bucket *bucket;
- size_t consumed = 0;
-
- while (buckets_in->head) {
- bucket = php_stream_bucket_make_writeable(buckets_in->head TSRMLS_CC);
-
- php_strtr(bucket->buf, bucket->buflen, rot13_from, rot13_to, 52);
- consumed += bucket->buflen;
-
- php_stream_bucket_append(buckets_out, bucket TSRMLS_CC);
- }
-
- if (bytes_consumed) {
- *bytes_consumed = consumed;
- }
-
- return PSFS_PASS_ON;
-}
-
-static php_stream_filter_ops strfilter_rot13_ops = {
- strfilter_rot13_filter,
- NULL,
- "string.rot13"
-};
-
-static php_stream_filter *strfilter_rot13_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC)
-{
- return php_stream_filter_alloc(&strfilter_rot13_ops, NULL, persistent);
-}
-
-static php_stream_filter_factory strfilter_rot13_factory = {
- strfilter_rot13_create
-};
-/* }}} */
-
-/* {{{ string.toupper / string.tolower stream filter implementation */
-static char lowercase[] = "abcdefghijklmnopqrstuvwxyz";
-static char uppercase[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
-static php_stream_filter_status_t strfilter_toupper_filter(
- php_stream *stream,
- php_stream_filter *thisfilter,
- php_stream_bucket_brigade *buckets_in,
- php_stream_bucket_brigade *buckets_out,
- size_t *bytes_consumed,
- int flags
- TSRMLS_DC)
-{
- php_stream_bucket *bucket;
- size_t consumed = 0;
-
- while (buckets_in->head) {
- bucket = php_stream_bucket_make_writeable(buckets_in->head TSRMLS_CC);
-
- php_strtr(bucket->buf, bucket->buflen, lowercase, uppercase, 26);
- consumed += bucket->buflen;
-
- php_stream_bucket_append(buckets_out, bucket TSRMLS_CC);
- }
-
- if (bytes_consumed) {
- *bytes_consumed = consumed;
- }
-
- return PSFS_PASS_ON;
-}
-
-static php_stream_filter_status_t strfilter_tolower_filter(
- php_stream *stream,
- php_stream_filter *thisfilter,
- php_stream_bucket_brigade *buckets_in,
- php_stream_bucket_brigade *buckets_out,
- size_t *bytes_consumed,
- int flags
- TSRMLS_DC)
-{
- php_stream_bucket *bucket;
- size_t consumed = 0;
-
- while (buckets_in->head) {
- bucket = php_stream_bucket_make_writeable(buckets_in->head TSRMLS_CC);
-
- php_strtr(bucket->buf, bucket->buflen, uppercase, lowercase, 26);
- consumed += bucket->buflen;
-
- php_stream_bucket_append(buckets_out, bucket TSRMLS_CC);
- }
-
- if (bytes_consumed) {
- *bytes_consumed = consumed;
- }
-
- return PSFS_PASS_ON;
-}
-
-static php_stream_filter_ops strfilter_toupper_ops = {
- strfilter_toupper_filter,
- NULL,
- "string.toupper"
-};
-
-static php_stream_filter_ops strfilter_tolower_ops = {
- strfilter_tolower_filter,
- NULL,
- "string.tolower"
-};
-
-static php_stream_filter *strfilter_toupper_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC)
-{
- return php_stream_filter_alloc(&strfilter_toupper_ops, NULL, persistent);
-}
-
-static php_stream_filter *strfilter_tolower_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC)
-{
- return php_stream_filter_alloc(&strfilter_tolower_ops, NULL, persistent);
-}
-
-static php_stream_filter_factory strfilter_toupper_factory = {
- strfilter_toupper_create
-};
-
-static php_stream_filter_factory strfilter_tolower_factory = {
- strfilter_tolower_create
-};
-/* }}} */
-
-/* {{{ strip_tags filter implementation */
-typedef struct _php_strip_tags_filter {
- const char *allowed_tags;
- int allowed_tags_len;
- int state;
- int persistent;
-} php_strip_tags_filter;
-
-static int php_strip_tags_filter_ctor(php_strip_tags_filter *inst, const char *allowed_tags, int allowed_tags_len, int persistent)
-{
- if (allowed_tags != NULL) {
- inst->allowed_tags = pemalloc(allowed_tags_len, persistent);
- memcpy((char *)inst->allowed_tags, allowed_tags, allowed_tags_len);
- inst->allowed_tags_len = allowed_tags_len;
- } else {
- inst->allowed_tags = NULL;
- }
- inst->state = 0;
- inst->persistent = persistent;
-
- return SUCCESS;
-}
-
-static void php_strip_tags_filter_dtor(php_strip_tags_filter *inst)
-{
- if (inst->allowed_tags != NULL) {
- pefree((void *)inst->allowed_tags, inst->persistent);
- }
-}
-
-static php_stream_filter_status_t strfilter_strip_tags_filter(
- php_stream *stream,
- php_stream_filter *thisfilter,
- php_stream_bucket_brigade *buckets_in,
- php_stream_bucket_brigade *buckets_out,
- size_t *bytes_consumed,
- int flags
- TSRMLS_DC)
-{
- php_stream_bucket *bucket;
- size_t consumed = 0;
- php_strip_tags_filter *inst = (php_strip_tags_filter *) thisfilter->abstract;
-
- while (buckets_in->head) {
- bucket = php_stream_bucket_make_writeable(buckets_in->head TSRMLS_CC);
- consumed = bucket->buflen;
-
- bucket->buflen = php_strip_tags(bucket->buf, bucket->buflen, &(inst->state), (char *)inst->allowed_tags, inst->allowed_tags_len);
-
- php_stream_bucket_append(buckets_out, bucket TSRMLS_CC);
- }
-
- if (bytes_consumed) {
- *bytes_consumed = consumed;
- }
-
- return PSFS_PASS_ON;
-}
-
-static void strfilter_strip_tags_dtor(php_stream_filter *thisfilter TSRMLS_DC)
-{
- assert(thisfilter->abstract != NULL);
-
- php_strip_tags_filter_dtor((php_strip_tags_filter *)thisfilter->abstract);
-
- pefree(thisfilter->abstract, ((php_strip_tags_filter *)thisfilter->abstract)->persistent);
-}
-
-static php_stream_filter_ops strfilter_strip_tags_ops = {
- strfilter_strip_tags_filter,
- strfilter_strip_tags_dtor,
- "string.strip_tags"
-};
-
-static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC)
-{
- php_strip_tags_filter *inst;
- smart_str tags_ss = { 0, 0, 0 };
-
- inst = pemalloc(sizeof(php_strip_tags_filter), persistent);
-
- if (inst == NULL) { /* it's possible pemalloc returns NULL
- instead of causing it to bail out */
- return NULL;
- }
-
- if (filterparams != NULL) {
- if (Z_TYPE_P(filterparams) == IS_ARRAY) {
- HashPosition pos;
- zval **tmp;
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(filterparams), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_P(filterparams), (void **) &tmp, &pos) == SUCCESS) {
- convert_to_string_ex(tmp);
- smart_str_appendc(&tags_ss, '<');
- smart_str_appendl(&tags_ss, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
- smart_str_appendc(&tags_ss, '>');
- zend_hash_move_forward_ex(Z_ARRVAL_P(filterparams), &pos);
- }
- smart_str_0(&tags_ss);
- } else {
- /* FIXME: convert_to_* may clutter zvals and lead it into segfault ? */
- convert_to_string_ex(&filterparams);
-
- tags_ss.c = Z_STRVAL_P(filterparams);
- tags_ss.len = Z_STRLEN_P(filterparams);
- tags_ss.a = 0;
- }
- }
-
- if (php_strip_tags_filter_ctor(inst, tags_ss.c, tags_ss.len, persistent) != SUCCESS) {
- if (tags_ss.a != 0) {
- STR_FREE(tags_ss.c);
- }
- pefree(inst, persistent);
- return NULL;
- }
-
- if (tags_ss.a != 0) {
- STR_FREE(tags_ss.c);
- }
-
- return php_stream_filter_alloc(&strfilter_strip_tags_ops, inst, persistent);
-}
-
-static php_stream_filter_factory strfilter_strip_tags_factory = {
- strfilter_strip_tags_create
-};
-
-/* }}} */
-
-/* {{{ base64 / quoted_printable stream filter implementation */
-
-typedef enum _php_conv_err_t {
- PHP_CONV_ERR_SUCCESS = SUCCESS,
- PHP_CONV_ERR_UNKNOWN,
- PHP_CONV_ERR_TOO_BIG,
- PHP_CONV_ERR_INVALID_SEQ,
- PHP_CONV_ERR_UNEXPECTED_EOS,
- PHP_CONV_ERR_EXISTS,
- PHP_CONV_ERR_NOT_FOUND
-} php_conv_err_t;
-
-typedef struct _php_conv php_conv;
-
-typedef php_conv_err_t (*php_conv_convert_func)(php_conv *, const char **, size_t *, char **, size_t *);
-typedef void (*php_conv_dtor_func)(php_conv *);
-
-struct _php_conv {
- php_conv_convert_func convert_op;
- php_conv_dtor_func dtor;
-};
-
-#define php_conv_convert(a, b, c, d, e) ((php_conv *)(a))->convert_op((php_conv *)(a), (b), (c), (d), (e))
-#define php_conv_dtor(a) ((php_conv *)a)->dtor((a))
-
-/* {{{ php_conv_base64_encode */
-typedef struct _php_conv_base64_encode {
- php_conv _super;
-
- unsigned char erem[3];
- size_t erem_len;
- unsigned int line_ccnt;
- unsigned int line_len;
- const char *lbchars;
- int lbchars_dup;
- size_t lbchars_len;
- int persistent;
-} php_conv_base64_encode;
-
-static php_conv_err_t php_conv_base64_encode_convert(php_conv_base64_encode *inst, const char **in_p, size_t *in_left, char **out_p, size_t *out_left);
-static void php_conv_base64_encode_dtor(php_conv_base64_encode *inst);
-
-static unsigned char b64_tbl_enc[256] = {
- 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
- 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
- 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
- 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/',
- 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
- 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
- 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
- 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/',
- 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
- 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
- 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
- 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/',
- 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
- 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
- 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
- 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/'
-};
-
-static php_conv_err_t php_conv_base64_encode_ctor(php_conv_base64_encode *inst, unsigned int line_len, const char *lbchars, size_t lbchars_len, int lbchars_dup, int persistent)
-{
- inst->_super.convert_op = (php_conv_convert_func) php_conv_base64_encode_convert;
- inst->_super.dtor = (php_conv_dtor_func) php_conv_base64_encode_dtor;
- inst->erem_len = 0;
- inst->line_ccnt = line_len;
- inst->line_len = line_len;
- if (lbchars != NULL) {
- inst->lbchars = (lbchars_dup ? pestrdup(lbchars, persistent) : lbchars);
- inst->lbchars_len = lbchars_len;
- } else {
- inst->lbchars = NULL;
- }
- inst->lbchars_dup = lbchars_dup;
- inst->persistent = persistent;
- return SUCCESS;
-}
-
-static void php_conv_base64_encode_dtor(php_conv_base64_encode *inst)
-{
- assert(inst != NULL);
- if (inst->lbchars_dup && inst->lbchars != NULL) {
- pefree((void *)inst->lbchars, inst->persistent);
- }
-}
-
-static php_conv_err_t php_conv_base64_encode_flush(php_conv_base64_encode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p)
-{
- volatile php_conv_err_t err = PHP_CONV_ERR_SUCCESS;
- register unsigned char *pd;
- register size_t ocnt;
- unsigned int line_ccnt;
-
- pd = (unsigned char *)(*out_pp);
- ocnt = *out_left_p;
- line_ccnt = inst->line_ccnt;
-
- switch (inst->erem_len) {
- case 0:
- /* do nothing */
- break;
-
- case 1:
- if (line_ccnt < 4 && inst->lbchars != NULL) {
- if (ocnt < inst->lbchars_len) {
- return PHP_CONV_ERR_TOO_BIG;
- }
- memcpy(pd, inst->lbchars, inst->lbchars_len);
- pd += inst->lbchars_len;
- ocnt -= inst->lbchars_len;
- line_ccnt = inst->line_len;
- }
- if (ocnt < 4) {
- err = PHP_CONV_ERR_TOO_BIG;
- goto out;
- }
- *(pd++) = b64_tbl_enc[(inst->erem[0] >> 2)];
- *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[0] << 4)];
- *(pd++) = '=';
- *(pd++) = '=';
- inst->erem_len = 0;
- ocnt -= 4;
- line_ccnt -= 4;
- break;
-
- case 2:
- if (line_ccnt < 4 && inst->lbchars != NULL) {
- if (ocnt < inst->lbchars_len) {
- return PHP_CONV_ERR_TOO_BIG;
- }
- memcpy(pd, inst->lbchars, inst->lbchars_len);
- pd += inst->lbchars_len;
- ocnt -= inst->lbchars_len;
- line_ccnt = inst->line_len;
- }
- if (ocnt < 4) {
- err = PHP_CONV_ERR_TOO_BIG;
- goto out;
- }
- *(pd++) = b64_tbl_enc[(inst->erem[0] >> 2)];
- *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[0] << 4) | (inst->erem[1] >> 4)];
- *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[1] << 2)];
- *(pd++) = '=';
- inst->erem_len = 0;
- ocnt -=4;
- line_ccnt -= 4;
- break;
-
- default:
- /* should not happen... */
- err = PHP_CONV_ERR_UNKNOWN;
- break;
- }
-out:
- *out_pp = (char *)pd;
- *out_left_p = ocnt;
- inst->line_ccnt = line_ccnt;
- return err;
-}
-
-static php_conv_err_t php_conv_base64_encode_convert(php_conv_base64_encode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p)
-{
- volatile php_conv_err_t err = PHP_CONV_ERR_SUCCESS;
- register size_t ocnt, icnt;
- register unsigned char *ps, *pd;
- register unsigned int line_ccnt;
- size_t nbytes_written;
-
- if (in_pp == NULL || in_left_p == NULL) {
- return php_conv_base64_encode_flush(inst, in_pp, in_left_p, out_pp, out_left_p);
- }
-
- pd = (unsigned char *)(*out_pp);
- ocnt = *out_left_p;
- ps = (unsigned char *)(*in_pp);
- icnt = *in_left_p;
- line_ccnt = inst->line_ccnt;
- nbytes_written = 0;
-
- /* consume the remainder first */
- switch (inst->erem_len) {
- case 1:
- if (icnt >= 2) {
- if (line_ccnt < 4 && inst->lbchars != NULL) {
- if (ocnt < inst->lbchars_len) {
- return PHP_CONV_ERR_TOO_BIG;
- }
- memcpy(pd, inst->lbchars, inst->lbchars_len);
- pd += inst->lbchars_len;
- ocnt -= inst->lbchars_len;
- line_ccnt = inst->line_len;
- }
- if (ocnt < 4) {
- err = PHP_CONV_ERR_TOO_BIG;
- goto out;
- }
- *(pd++) = b64_tbl_enc[(inst->erem[0] >> 2)];
- *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[0] << 4) | (ps[0] >> 4)];
- *(pd++) = b64_tbl_enc[(unsigned char)(ps[0] << 2) | (ps[1] >> 6)];
- *(pd++) = b64_tbl_enc[ps[1]];
- ocnt -= 4;
- ps += 2;
- icnt -= 2;
- inst->erem_len = 0;
- line_ccnt -= 4;
- }
- break;
-
- case 2:
- if (icnt >= 1) {
- if (inst->line_ccnt < 4 && inst->lbchars != NULL) {
- if (ocnt < inst->lbchars_len) {
- return PHP_CONV_ERR_TOO_BIG;
- }
- memcpy(pd, inst->lbchars, inst->lbchars_len);
- pd += inst->lbchars_len;
- ocnt -= inst->lbchars_len;
- line_ccnt = inst->line_len;
- }
- if (ocnt < 4) {
- err = PHP_CONV_ERR_TOO_BIG;
- goto out;
- }
- *(pd++) = b64_tbl_enc[(inst->erem[0] >> 2)];
- *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[0] << 4) | (inst->erem[1] >> 4)];
- *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[1] << 2) | (ps[0] >> 6)];
- *(pd++) = b64_tbl_enc[ps[0]];
- ocnt -= 4;
- ps += 1;
- icnt -= 1;
- inst->erem_len = 0;
- line_ccnt -= 4;
- }
- break;
- }
-
- while (icnt >= 3) {
- if (line_ccnt < 4 && inst->lbchars != NULL) {
- if (ocnt < inst->lbchars_len) {
- err = PHP_CONV_ERR_TOO_BIG;
- goto out;
- }
- memcpy(pd, inst->lbchars, inst->lbchars_len);
- pd += inst->lbchars_len;
- ocnt -= inst->lbchars_len;
- line_ccnt = inst->line_len;
- }
- if (ocnt < 4) {
- err = PHP_CONV_ERR_TOO_BIG;
- goto out;
- }
- *(pd++) = b64_tbl_enc[ps[0] >> 2];
- *(pd++) = b64_tbl_enc[(unsigned char)(ps[0] << 4) | (ps[1] >> 4)];
- *(pd++) = b64_tbl_enc[(unsigned char)(ps[1] << 2) | (ps[2] >> 6)];
- *(pd++) = b64_tbl_enc[ps[2]];
-
- ps += 3;
- icnt -=3;
- ocnt -= 4;
- line_ccnt -= 4;
- }
- for (;icnt > 0; icnt--) {
- inst->erem[inst->erem_len++] = *(ps++);
- }
-
-out:
- *in_pp = (const char *)ps;
- *in_left_p = icnt;
- *out_pp = (char *)pd;
- *out_left_p = ocnt;
- inst->line_ccnt = line_ccnt;
-
- return err;
-}
-
-/* }}} */
-
-/* {{{ php_conv_base64_decode */
-typedef struct _php_conv_base64_decode {
- php_conv _super;
-
- unsigned int urem;
- unsigned int urem_nbits;
- unsigned int ustat;
- int eos;
-} php_conv_base64_decode;
-
-static php_conv_err_t php_conv_base64_decode_convert(php_conv_base64_decode *inst, const char **in_p, size_t *in_left, char **out_p, size_t *out_left);
-static void php_conv_base64_decode_dtor(php_conv_base64_decode *inst);
-
-static unsigned int b64_tbl_dec[256] = {
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64,128, 64, 64,
- 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64,
- 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
-};
-
-static int php_conv_base64_decode_ctor(php_conv_base64_decode *inst)
-{
- inst->_super.convert_op = (php_conv_convert_func) php_conv_base64_decode_convert;
- inst->_super.dtor = (php_conv_dtor_func) php_conv_base64_decode_dtor;
-
- inst->urem = 0;
- inst->urem_nbits = 0;
- inst->ustat = 0;
- inst->eos = 0;
- return SUCCESS;
-}
-
-static void php_conv_base64_decode_dtor(php_conv_base64_decode *inst)
-{
- /* do nothing */
-}
-
-#define bmask(a) (0xffff >> (16 - a))
-static php_conv_err_t php_conv_base64_decode_convert(php_conv_base64_decode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p)
-{
- php_conv_err_t err;
-
- unsigned int urem, urem_nbits;
- unsigned int pack, pack_bcnt;
- unsigned char *ps, *pd;
- size_t icnt, ocnt;
- unsigned int ustat;
-
- const static unsigned int nbitsof_pack = 8;
-
- if (in_pp == NULL || in_left_p == NULL) {
- if (inst->eos || inst->urem_nbits == 0) {
- return SUCCESS;
- }
- return PHP_CONV_ERR_UNEXPECTED_EOS;
- }
-
- err = PHP_CONV_ERR_SUCCESS;
-
- ps = (unsigned char *)*in_pp;
- pd = (unsigned char *)*out_pp;
- icnt = *in_left_p;
- ocnt = *out_left_p;
-
- urem = inst->urem;
- urem_nbits = inst->urem_nbits;
- ustat = inst->ustat;
-
- pack = 0;
- pack_bcnt = nbitsof_pack;
-
- for (;;) {
- if (pack_bcnt >= urem_nbits) {
- pack_bcnt -= urem_nbits;
- pack |= (urem << pack_bcnt);
- urem_nbits = 0;
- } else {
- urem_nbits -= pack_bcnt;
- pack |= (urem >> urem_nbits);
- urem &= bmask(urem_nbits);
- pack_bcnt = 0;
- }
- if (pack_bcnt > 0) {
- unsigned int i;
-
- if (icnt < 1) {
- break;
- }
-
- i = b64_tbl_dec[(unsigned int)*(ps++)];
- icnt--;
- ustat |= i & 0x80;
-
- if (!(i & 0xc0)) {
- if (ustat) {
- err = PHP_CONV_ERR_INVALID_SEQ;
- break;
- }
- if (6 <= pack_bcnt) {
- pack_bcnt -= 6;
- pack |= (i << pack_bcnt);
- urem = 0;
- } else {
- urem_nbits = 6 - pack_bcnt;
- pack |= (i >> urem_nbits);
- urem = i & bmask(urem_nbits);
- pack_bcnt = 0;
- }
- } else if (ustat) {
- if (pack_bcnt == 8 || pack_bcnt == 2) {
- err = PHP_CONV_ERR_INVALID_SEQ;
- break;
- }
- inst->eos = 1;
- }
- }
- if ((pack_bcnt | ustat) == 0) {
- if (ocnt < 1) {
- err = PHP_CONV_ERR_TOO_BIG;
- break;
- }
- *(pd++) = pack;
- ocnt--;
- pack = 0;
- pack_bcnt = nbitsof_pack;
- }
- }
-
- if (urem_nbits >= pack_bcnt) {
- urem |= (pack << (urem_nbits - pack_bcnt));
- urem_nbits += (nbitsof_pack - pack_bcnt);
- } else {
- urem |= (pack >> (pack_bcnt - urem_nbits));
- urem_nbits += (nbitsof_pack - pack_bcnt);
- }
-
- inst->urem = urem;
- inst->urem_nbits = urem_nbits;
- inst->ustat = ustat;
-
- *in_pp = (const char *)ps;
- *in_left_p = icnt;
- *out_pp = (char *)pd;
- *out_left_p = ocnt;
-
- return err;
-}
-#undef bmask
-/* }}} */
-
-/* {{{ php_conv_qprint_encode */
-typedef struct _php_conv_qprint_encode {
- php_conv _super;
-
- int opts;
- unsigned int line_ccnt;
- unsigned int line_len;
- const char *lbchars;
- int lbchars_dup;
- size_t lbchars_len;
- int persistent;
- unsigned int lb_ptr;
- unsigned int lb_cnt;
-} php_conv_qprint_encode;
-
-#define PHP_CONV_QPRINT_OPT_BINARY 0x00000001
-#define PHP_CONV_QPRINT_OPT_FORCE_ENCODE_FIRST 0x00000002
-
-static void php_conv_qprint_encode_dtor(php_conv_qprint_encode *inst);
-static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p);
-
-static void php_conv_qprint_encode_dtor(php_conv_qprint_encode *inst)
-{
- assert(inst != NULL);
- if (inst->lbchars_dup && inst->lbchars != NULL) {
- pefree((void *)inst->lbchars, inst->persistent);
- }
-}
-
-#define NEXT_CHAR(ps, icnt, lb_ptr, lb_cnt, lbchars) \
- ((lb_ptr) < (lb_cnt) ? (lbchars)[(lb_ptr)] : *(ps))
-
-#define CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt) \
- if ((lb_ptr) < (lb_cnt)) { \
- (lb_ptr)++; \
- } else { \
- (lb_cnt) = (lb_ptr) = 0; \
- --(icnt); \
- (ps)++; \
- }
-
-static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p)
-{
- php_conv_err_t err = PHP_CONV_ERR_SUCCESS;
- unsigned char *ps, *pd;
- size_t icnt, ocnt;
- unsigned int c;
- unsigned int line_ccnt;
- unsigned int lb_ptr;
- unsigned int lb_cnt;
- int opts;
- static char qp_digits[] = "0123456789ABCDEF";
-
- line_ccnt = inst->line_ccnt;
- opts = inst->opts;
- lb_ptr = inst->lb_ptr;
- lb_cnt = inst->lb_cnt;
-
- if ((in_pp == NULL || in_left_p == NULL) && (lb_ptr >=lb_cnt)) {
- return PHP_CONV_ERR_SUCCESS;
- }
-
- ps = (unsigned char *)(*in_pp);
- icnt = *in_left_p;
- pd = (unsigned char *)(*out_pp);
- ocnt = *out_left_p;
-
- for (;;) {
- if (!(opts & PHP_CONV_QPRINT_OPT_BINARY) && inst->lbchars != NULL && inst->lbchars_len > 0) {
- /* look ahead for the line break chars to make a right decision
- * how to consume incoming characters */
-
- if (icnt > 0 && *ps == inst->lbchars[lb_cnt]) {
- lb_cnt++;
-
- if (lb_cnt >= inst->lbchars_len) {
- unsigned int i;
-
- if (ocnt < lb_cnt) {
- lb_cnt--;
- err = PHP_CONV_ERR_TOO_BIG;
- break;
- }
-
- for (i = 0; i < lb_cnt; i++) {
- *(pd++) = inst->lbchars[i];
- ocnt--;
- }
- line_ccnt = inst->line_len;
- lb_ptr = lb_cnt = 0;
- }
- ps++, icnt--;
- continue;
- }
- }
-
- if (lb_ptr >= lb_cnt && icnt <= 0) {
- break;
- }
-
- c = NEXT_CHAR(ps, icnt, lb_ptr, lb_cnt, inst->lbchars);
-
- if (!(opts & PHP_CONV_QPRINT_OPT_BINARY) && (c == '\t' || c == ' ')) {
- if (line_ccnt < 2 && inst->lbchars != NULL) {
- if (ocnt < inst->lbchars_len + 1) {
- err = PHP_CONV_ERR_TOO_BIG;
- break;
- }
-
- *(pd++) = '=';
- ocnt--;
- line_ccnt--;
-
- memcpy(pd, inst->lbchars, inst->lbchars_len);
- pd += inst->lbchars_len;
- ocnt -= inst->lbchars_len;
- line_ccnt = inst->line_len;
- } else {
- if (ocnt < 1) {
- err = PHP_CONV_ERR_TOO_BIG;
- break;
- }
- *(pd++) = c;
- ocnt--;
- line_ccnt--;
- CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt);
- }
- } else if ((!(opts & PHP_CONV_QPRINT_OPT_FORCE_ENCODE_FIRST) || line_ccnt < inst->line_len) && ((c >= 33 && c <= 60) || (c >= 62 && c <= 126))) {
- if (line_ccnt < 2) {
- if (ocnt < inst->lbchars_len + 1) {
- err = PHP_CONV_ERR_TOO_BIG;
- break;
- }
- *(pd++) = '=';
- ocnt--;
- line_ccnt--;
-
- memcpy(pd, inst->lbchars, inst->lbchars_len);
- pd += inst->lbchars_len;
- ocnt -= inst->lbchars_len;
- line_ccnt = inst->line_len;
- }
- if (ocnt < 1) {
- err = PHP_CONV_ERR_TOO_BIG;
- break;
- }
- *(pd++) = c;
- ocnt--;
- line_ccnt--;
- CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt);
- } else {
- if (line_ccnt < 4) {
- if (ocnt < inst->lbchars_len + 1) {
- err = PHP_CONV_ERR_TOO_BIG;
- break;
- }
- *(pd++) = '=';
- ocnt--;
- line_ccnt--;
-
- memcpy(pd, inst->lbchars, inst->lbchars_len);
- pd += inst->lbchars_len;
- ocnt -= inst->lbchars_len;
- line_ccnt = inst->line_len;
- }
- if (ocnt < 3) {
- err = PHP_CONV_ERR_TOO_BIG;
- break;
- }
- *(pd++) = '=';
- *(pd++) = qp_digits[(c >> 4)];
- *(pd++) = qp_digits[(c & 0x0f)];
- ocnt -= 3;
- line_ccnt -= 3;
- CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt);
- }
- }
-
- *in_pp = (const char *)ps;
- *in_left_p = icnt;
- *out_pp = (char *)pd;
- *out_left_p = ocnt;
- inst->line_ccnt = line_ccnt;
- inst->lb_ptr = lb_ptr;
- inst->lb_cnt = lb_cnt;
- return err;
-}
-#undef NEXT_CHAR
-#undef CONSUME_CHAR
-
-static php_conv_err_t php_conv_qprint_encode_ctor(php_conv_qprint_encode *inst, unsigned int line_len, const char *lbchars, size_t lbchars_len, int lbchars_dup, int opts, int persistent)
-{
- if (line_len < 4 && lbchars != NULL) {
- return PHP_CONV_ERR_TOO_BIG;
- }
- inst->_super.convert_op = (php_conv_convert_func) php_conv_qprint_encode_convert;
- inst->_super.dtor = (php_conv_dtor_func) php_conv_qprint_encode_dtor;
- inst->line_ccnt = line_len;
- inst->line_len = line_len;
- if (lbchars != NULL) {
- inst->lbchars = (lbchars_dup ? pestrdup(lbchars, persistent) : lbchars);
- inst->lbchars_len = lbchars_len;
- } else {
- inst->lbchars = NULL;
- }
- inst->lbchars_dup = lbchars_dup;
- inst->persistent = persistent;
- inst->opts = opts;
- inst->lb_cnt = inst->lb_ptr = 0;
- return PHP_CONV_ERR_SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_conv_qprint_decode */
-typedef struct _php_conv_qprint_decode {
- php_conv _super;
-
- int scan_stat;
- unsigned int next_char;
- const char *lbchars;
- int lbchars_dup;
- size_t lbchars_len;
- int persistent;
- unsigned int lb_ptr;
- unsigned int lb_cnt;
-} php_conv_qprint_decode;
-
-static void php_conv_qprint_decode_dtor(php_conv_qprint_decode *inst)
-{
- assert(inst != NULL);
- if (inst->lbchars_dup && inst->lbchars != NULL) {
- pefree((void *)inst->lbchars, inst->persistent);
- }
-}
-
-static php_conv_err_t php_conv_qprint_decode_convert(php_conv_qprint_decode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p)
-{
- php_conv_err_t err = PHP_CONV_ERR_SUCCESS;
- size_t icnt, ocnt;
- unsigned char *ps, *pd;
- unsigned int scan_stat;
- unsigned int next_char;
- unsigned int lb_ptr, lb_cnt;
-
- lb_ptr = inst->lb_ptr;
- lb_cnt = inst->lb_cnt;
-
- if ((in_pp == NULL || in_left_p == NULL) && lb_cnt == lb_ptr) {
- if (inst->scan_stat != 0) {
- return PHP_CONV_ERR_UNEXPECTED_EOS;
- }
- return PHP_CONV_ERR_SUCCESS;
- }
-
- ps = (unsigned char *)(*in_pp);
- icnt = *in_left_p;
- pd = (unsigned char *)(*out_pp);
- ocnt = *out_left_p;
- scan_stat = inst->scan_stat;
- next_char = inst->next_char;
-
- for (;;) {
- switch (scan_stat) {
- case 0: {
- if (icnt <= 0) {
- goto out;
- }
- if (*ps == '=') {
- scan_stat = 1;
- } else {
- if (ocnt < 1) {
- err = PHP_CONV_ERR_TOO_BIG;
- goto out;
- }
- *(pd++) = *ps;
- ocnt--;
- }
- ps++, icnt--;
- } break;
-
- case 1: {
- if (icnt <= 0) {
- goto out;
- }
- if (*ps == ' ' || *ps == '\t') {
- scan_stat = 4;
- ps++, icnt--;
- break;
- } else if (lb_cnt < inst->lbchars_len &&
- *ps == (unsigned char)inst->lbchars[lb_cnt]) {
- lb_cnt++;
- scan_stat = 5;
- ps++, icnt--;
- break;
- }
- } /* break is missing intentionally */
-
- case 2: {
- unsigned int nbl;
-
- if (icnt <= 0) {
- goto out;
- }
- nbl = (*ps >= 'A' ? *ps - 0x37 : *ps - 0x30);
-
- if (nbl > 15) {
- err = PHP_CONV_ERR_INVALID_SEQ;
- goto out;
- }
- next_char = (next_char << 4) | nbl;
-
- scan_stat++;
- ps++, icnt--;
- if (scan_stat != 3) {
- break;
- }
- } /* break is missing intentionally */
-
- case 3: {
- if (ocnt < 1) {
- err = PHP_CONV_ERR_TOO_BIG;
- goto out;
- }
- *(pd++) = next_char;
- ocnt--;
- scan_stat = 0;
- } break;
-
- case 4: {
- if (icnt <= 0) {
- goto out;
- }
- if (lb_cnt < inst->lbchars_len &&
- *ps == (unsigned char)inst->lbchars[lb_cnt]) {
- lb_cnt++;
- scan_stat = 5;
- }
- if (*ps != '\t' && *ps != ' ') {
- err = PHP_CONV_ERR_INVALID_SEQ;
- goto out;
- }
- ps++, icnt--;
- } break;
-
- case 5: {
- if (lb_cnt >= inst->lbchars_len) {
- /* soft line break */
- lb_cnt = lb_ptr = 0;
- scan_stat = 0;
- } else if (icnt > 0) {
- if (*ps == (unsigned char)inst->lbchars[lb_cnt]) {
- lb_cnt++;
- ps++, icnt--;
- } else {
- scan_stat = 6; /* no break for short-cut */
- }
- } else {
- goto out;
- }
- } break;
-
- case 6: {
- if (lb_ptr < lb_cnt) {
- if (ocnt < 1) {
- err = PHP_CONV_ERR_TOO_BIG;
- goto out;
- }
- *(pd++) = inst->lbchars[lb_ptr++];
- ocnt--;
- } else {
- scan_stat = 0;
- lb_cnt = lb_ptr = 0;
- }
- } break;
- }
- }
-out:
- *in_pp = (const char *)ps;
- *in_left_p = icnt;
- *out_pp = (char *)pd;
- *out_left_p = ocnt;
- inst->scan_stat = scan_stat;
- inst->lb_ptr = lb_ptr;
- inst->lb_cnt = lb_cnt;
- inst->next_char = next_char;
-
- return err;
-}
-static php_conv_err_t php_conv_qprint_decode_ctor(php_conv_qprint_decode *inst, const char *lbchars, size_t lbchars_len, int lbchars_dup, int persistent)
-{
- inst->_super.convert_op = (php_conv_convert_func) php_conv_qprint_decode_convert;
- inst->_super.dtor = (php_conv_dtor_func) php_conv_qprint_decode_dtor;
- inst->scan_stat = 0;
- inst->next_char = 0;
- inst->lb_ptr = inst->lb_cnt = 0;
- if (lbchars != NULL) {
- inst->lbchars = (lbchars_dup ? pestrdup(lbchars, persistent) : lbchars);
- inst->lbchars_len = lbchars_len;
- } else {
- inst->lbchars = NULL;
- inst->lbchars_len = 0;
- }
- inst->lbchars_dup = lbchars_dup;
- inst->persistent = persistent;
- return PHP_CONV_ERR_SUCCESS;
-}
-/* }}} */
-
-typedef struct _php_convert_filter {
- php_conv *cd;
- int persistent;
- char *filtername;
-} php_convert_filter;
-
-#define PHP_CONV_BASE64_ENCODE 1
-#define PHP_CONV_BASE64_DECODE 2
-#define PHP_CONV_QPRINT_ENCODE 3
-#define PHP_CONV_QPRINT_DECODE 4
-
-static php_conv_err_t php_conv_get_string_prop_ex(const HashTable *ht, char **pretval, size_t *pretval_len, char *field_name, size_t field_name_len, int persistent)
-{
- zval **tmpval;
-
- *pretval = NULL;
- *pretval_len = 0;
-
- if (zend_hash_find((HashTable *)ht, field_name, field_name_len, (void **)&tmpval) == SUCCESS) {
- if (Z_TYPE_PP(tmpval) != IS_STRING) {
- zval zt = **tmpval;
- convert_to_string(&zt);
- *pretval = pemalloc(Z_STRLEN(zt) + 1, persistent);
- *pretval_len = Z_STRLEN(zt);
- memcpy(*pretval, Z_STRVAL(zt), Z_STRLEN(zt) + 1);
- zval_dtor(&zt);
- } else {
- *pretval = pemalloc(Z_STRLEN_PP(tmpval) + 1, persistent);
- *pretval_len = Z_STRLEN_PP(tmpval);
- memcpy(*pretval, Z_STRVAL_PP(tmpval), Z_STRLEN_PP(tmpval) + 1);
- }
- } else {
- return PHP_CONV_ERR_NOT_FOUND;
- }
- return PHP_CONV_ERR_SUCCESS;
-}
-
-static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, long *pretval, char *field_name, size_t field_name_len)
-{
- zval **tmpval;
-
- *pretval = 0;
-
- if (zend_hash_find((HashTable *)ht, field_name, field_name_len, (void **)&tmpval) == SUCCESS) {
- zval tmp, *ztval = *tmpval;
-
- if (Z_TYPE_PP(tmpval) != IS_LONG) {
- tmp = *ztval;
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- ztval = &tmp;
- }
- *pretval = Z_LVAL_P(ztval);
- } else {
- return PHP_CONV_ERR_NOT_FOUND;
- }
- return PHP_CONV_ERR_SUCCESS;
-}
-
-static php_conv_err_t php_conv_get_ulong_prop_ex(const HashTable *ht, unsigned long *pretval, char *field_name, size_t field_name_len)
-{
- zval **tmpval;
-
- *pretval = 0;
-
- if (zend_hash_find((HashTable *)ht, field_name, field_name_len, (void **)&tmpval) == SUCCESS) {
- zval tmp, *ztval = *tmpval;
-
- if (Z_TYPE_PP(tmpval) != IS_LONG) {
- tmp = *ztval;
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- ztval = &tmp;
- }
- if (Z_LVAL_P(ztval) < 0) {
- *pretval = 0;
- } else {
- *pretval = Z_LVAL_P(ztval);
- }
- } else {
- return PHP_CONV_ERR_NOT_FOUND;
- }
- return PHP_CONV_ERR_SUCCESS;
-}
-
-static php_conv_err_t php_conv_get_bool_prop_ex(const HashTable *ht, int *pretval, char *field_name, size_t field_name_len)
-{
- zval **tmpval;
-
- *pretval = 0;
-
- if (zend_hash_find((HashTable *)ht, field_name, field_name_len, (void **)&tmpval) == SUCCESS) {
- zval tmp, *ztval = *tmpval;
-
- if (Z_TYPE_PP(tmpval) != IS_BOOL) {
- tmp = *ztval;
- zval_copy_ctor(&tmp);
- convert_to_boolean(&tmp);
- ztval = &tmp;
- }
- *pretval = Z_BVAL_P(ztval);
- } else {
- return PHP_CONV_ERR_NOT_FOUND;
- }
- return PHP_CONV_ERR_SUCCESS;
-}
-
-
-static int php_conv_get_int_prop_ex(const HashTable *ht, int *pretval, char *field_name, size_t field_name_len)
-{
- long l;
- php_conv_err_t err;
-
- *pretval = 0;
-
- if ((err = php_conv_get_long_prop_ex(ht, &l, field_name, field_name_len)) == PHP_CONV_ERR_SUCCESS) {
- *pretval = l;
- }
- return err;
-}
-
-static int php_conv_get_uint_prop_ex(const HashTable *ht, unsigned int *pretval, char *field_name, size_t field_name_len)
-{
- long l;
- php_conv_err_t err;
-
- *pretval = 0;
-
- if ((err = php_conv_get_ulong_prop_ex(ht, &l, field_name, field_name_len)) == PHP_CONV_ERR_SUCCESS) {
- *pretval = l;
- }
- return err;
-}
-
-#define GET_STR_PROP(ht, var, var_len, fldname, persistent) \
- php_conv_get_string_prop_ex(ht, &var, &var_len, fldname, sizeof(fldname), persistent)
-
-#define GET_INT_PROP(ht, var, fldname) \
- php_conv_get_int_prop_ex(ht, &var, fldname, sizeof(fldname))
-
-#define GET_UINT_PROP(ht, var, fldname) \
- php_conv_get_uint_prop_ex(ht, &var, fldname, sizeof(fldname))
-
-#define GET_BOOL_PROP(ht, var, fldname) \
- php_conv_get_bool_prop_ex(ht, &var, fldname, sizeof(fldname))
-
-static php_conv *php_conv_open(int conv_mode, const HashTable *options, int persistent)
-{
- /* FIXME: I'll have to replace this ugly code by something neat
- (factories?) in the near future. */
- php_conv *retval = NULL;
-
- switch (conv_mode) {
- case PHP_CONV_BASE64_ENCODE: {
- unsigned int line_len = 0;
- char *lbchars = NULL;
- size_t lbchars_len;
-
- if (options != NULL) {
- GET_STR_PROP(options, lbchars, lbchars_len, "line-break-chars", 0);
- GET_UINT_PROP(options, line_len, "line-length");
- if (line_len < 4) {
- if (lbchars != NULL) {
- pefree(lbchars, 0);
- }
- lbchars = NULL;
- } else {
- if (lbchars == NULL) {
- lbchars = pestrdup("\r\n", 0);
- lbchars_len = 2;
- }
- }
- }
- retval = pemalloc(sizeof(php_conv_base64_encode), persistent);
- if (lbchars != NULL) {
- if (php_conv_base64_encode_ctor((php_conv_base64_encode *)retval, line_len, lbchars, lbchars_len, 1, persistent)) {
- if (lbchars != NULL) {
- pefree(lbchars, 0);
- }
- goto out_failure;
- }
- pefree(lbchars, 0);
- } else {
- if (php_conv_base64_encode_ctor((php_conv_base64_encode *)retval, 0, NULL, 0, 0, persistent)) {
- goto out_failure;
- }
- }
- } break;
-
- case PHP_CONV_BASE64_DECODE:
- retval = pemalloc(sizeof(php_conv_base64_decode), persistent);
- if (php_conv_base64_decode_ctor((php_conv_base64_decode *)retval)) {
- goto out_failure;
- }
- break;
-
- case PHP_CONV_QPRINT_ENCODE: {
- unsigned int line_len = 0;
- char *lbchars = NULL;
- size_t lbchars_len;
- int opts = 0;
-
- if (options != NULL) {
- int opt_binary = 0;
- int opt_force_encode_first = 0;
-
- GET_STR_PROP(options, lbchars, lbchars_len, "line-break-chars", 0);
- GET_UINT_PROP(options, line_len, "line-length");
- GET_BOOL_PROP(options, opt_binary, "binary");
- GET_BOOL_PROP(options, opt_force_encode_first, "force-encode-first");
-
- if (line_len < 4) {
- if (lbchars != NULL) {
- pefree(lbchars, 0);
- }
- lbchars = NULL;
- } else {
- if (lbchars == NULL) {
- lbchars = pestrdup("\r\n", 0);
- lbchars_len = 2;
- }
- }
- opts |= (opt_binary ? PHP_CONV_QPRINT_OPT_BINARY : 0);
- opts |= (opt_force_encode_first ? PHP_CONV_QPRINT_OPT_FORCE_ENCODE_FIRST : 0);
- }
- retval = pemalloc(sizeof(php_conv_qprint_encode), persistent);
- if (lbchars != NULL) {
- if (php_conv_qprint_encode_ctor((php_conv_qprint_encode *)retval, line_len, lbchars, lbchars_len, 1, opts, persistent)) {
- pefree(lbchars, 0);
- goto out_failure;
- }
- pefree(lbchars, 0);
- } else {
- if (php_conv_qprint_encode_ctor((php_conv_qprint_encode *)retval, 0, NULL, 0, 0, opts, persistent)) {
- goto out_failure;
- }
- }
- } break;
-
- case PHP_CONV_QPRINT_DECODE: {
- char *lbchars = NULL;
- size_t lbchars_len;
-
- if (options != NULL) {
- GET_STR_PROP(options, lbchars, lbchars_len, "line-break-chars", 0);
- if (lbchars == NULL) {
- lbchars = pestrdup("\r\n", 0);
- lbchars_len = 2;
- }
- }
- retval = pemalloc(sizeof(php_conv_qprint_decode), persistent);
- if (lbchars != NULL) {
- if (php_conv_qprint_decode_ctor((php_conv_qprint_decode *)retval, lbchars, lbchars_len, 1, persistent)) {
- pefree(lbchars, 0);
- goto out_failure;
- }
- pefree(lbchars, 0);
- } else {
- if (php_conv_qprint_decode_ctor((php_conv_qprint_decode *)retval, NULL, 0, 0, persistent)) {
- goto out_failure;
- }
- }
- } break;
-
- default:
- retval = NULL;
- break;
- }
- return retval;
-
-out_failure:
- if (retval != NULL) {
- pefree(retval, persistent);
- }
- return NULL;
-}
-
-#undef GET_STR_PROP
-#undef GET_INT_PROP
-#undef GET_UINT_PROP
-#undef GET_BOOL_PROP
-
-static int php_convert_filter_ctor(php_convert_filter *inst,
- int conv_mode, HashTable *conv_opts,
- const char *filtername, int persistent)
-{
- inst->persistent = persistent;
- inst->filtername = pestrdup(filtername, persistent);
-
- if ((inst->cd = php_conv_open(conv_mode, conv_opts, persistent)) == NULL) {
- goto out_failure;
- }
-
- return SUCCESS;
-
-out_failure:
- if (inst->cd != NULL) {
- php_conv_dtor(inst->cd);
- pefree(inst->cd, persistent);
- }
- if (inst->filtername != NULL) {
- pefree(inst->filtername, persistent);
- }
- return FAILURE;
-}
-
-static void php_convert_filter_dtor(php_convert_filter *inst)
-{
- if (inst->cd != NULL) {
- php_conv_dtor(inst->cd);
- pefree(inst->cd, inst->persistent);
- }
-
- if (inst->filtername != NULL) {
- pefree(inst->filtername, inst->persistent);
- }
-}
-
-static php_stream_filter_status_t strfilter_convert_filter(
- php_stream *stream,
- php_stream_filter *thisfilter,
- php_stream_bucket_brigade *buckets_in,
- php_stream_bucket_brigade *buckets_out,
- size_t *bytes_consumed,
- int flags
- TSRMLS_DC)
-{
- php_stream_bucket *bucket = NULL, *new_bucket;
- size_t consumed = 0;
- php_conv_err_t err;
- php_convert_filter *inst = (php_convert_filter *)thisfilter->abstract;
- char *out_buf = NULL;
- size_t out_buf_size;
- char *pd;
- size_t ocnt;
-
- if (flags != PSFS_FLAG_NORMAL) {
- /* flush operation */
-
- out_buf_size = 64;
- out_buf = pemalloc(out_buf_size, inst->persistent);
- ocnt = out_buf_size;
- pd = out_buf;
-
- /* trying hard to reduce the number of buckets to hand to the
- * next filter */
-
- for (;;) {
- err = php_conv_convert(inst->cd, NULL, NULL, &pd, &ocnt);
-
- switch (err) {
- case PHP_CONV_ERR_UNKNOWN:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): unknown error", inst->filtername, err);
- goto out_failure;
-
- case PHP_CONV_ERR_INVALID_SEQ:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): invalid base64 sequence", inst->filtername, err);
- goto out_failure;
-
- case PHP_CONV_ERR_UNEXPECTED_EOS:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): unexpected end of stream", inst->filtername, err);
- goto out_failure;
-
- default:
- break;
- }
-
- if (err != PHP_CONV_ERR_TOO_BIG) {
- break;
- } else {
- char *new_out_buf;
- size_t new_out_buf_size;
-
- new_out_buf_size = out_buf_size << 1;
-
- if (new_out_buf_size < out_buf_size) {
- /* whoa! no bigger buckets are sold anywhere... */
- new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, inst->persistent TSRMLS_CC);
-
- php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC);
-
- out_buf_size = bucket->buflen;
- out_buf = pemalloc(out_buf_size, inst->persistent);
- ocnt = out_buf_size;
- pd = out_buf;
- } else {
- new_out_buf = perealloc(out_buf, new_out_buf_size, inst->persistent);
- pd = new_out_buf + (pd - out_buf);
- ocnt += (new_out_buf_size - out_buf_size);
- out_buf = new_out_buf;
- out_buf_size = new_out_buf_size;
- }
- }
- }
- /* give output bucket to next in chain */
- if (out_buf_size - ocnt > 0) {
- new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, inst->persistent TSRMLS_CC);
- php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC);
- } else {
- pefree(out_buf, inst->persistent);
- }
- } else {
- while (buckets_in->head != NULL) {
- const char *ps;
- size_t icnt;
-
- bucket = buckets_in->head;
-
- php_stream_bucket_unlink(bucket TSRMLS_CC);
- icnt = bucket->buflen;
- ps = bucket->buf;
-
- out_buf_size = bucket->buflen;
- out_buf = pemalloc(out_buf_size, inst->persistent);
- ocnt = out_buf_size;
- pd = out_buf;
-
- /* trying hard to reduce the number of buckets to hand to the
- * next filter */
-
- while (icnt > 0) {
- err = php_conv_convert(inst->cd, &ps, &icnt, &pd, &ocnt);
-
- switch (err) {
- case PHP_CONV_ERR_UNKNOWN:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): unknown error", inst->filtername, err);
- goto out_failure;
-
- case PHP_CONV_ERR_INVALID_SEQ:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): invalid base64 sequence", inst->filtername, err);
- goto out_failure;
-
- case PHP_CONV_ERR_UNEXPECTED_EOS:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): unexpected end of stream", inst->filtername, err);
- goto out_failure;
-
- default:
- break;
- }
-
- if (err == PHP_CONV_ERR_TOO_BIG) {
- char *new_out_buf;
- size_t new_out_buf_size;
-
- new_out_buf_size = out_buf_size << 1;
-
- if (new_out_buf_size < out_buf_size) {
- /* whoa! no bigger buckets are sold anywhere... */
- new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, inst->persistent TSRMLS_CC);
-
- php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC);
-
- out_buf_size = bucket->buflen;
- out_buf = pemalloc(out_buf_size, inst->persistent);
- ocnt = out_buf_size;
- pd = out_buf;
- } else {
- new_out_buf = perealloc(out_buf, new_out_buf_size, inst->persistent);
- pd = new_out_buf + (pd - out_buf);
- ocnt += (new_out_buf_size - out_buf_size);
- out_buf = new_out_buf;
- out_buf_size = new_out_buf_size;
- }
- }
- }
-
- /* update consumed by the number of bytes just used */
- consumed = bucket->buflen - icnt;
-
- /* give output bucket to next in chain */
- if (out_buf_size - ocnt > 0) {
- new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, inst->persistent TSRMLS_CC);
- php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC);
- } else {
- pefree(out_buf, inst->persistent);
- }
-
- php_stream_bucket_delref(bucket TSRMLS_CC);
- }
- }
-
- if (bytes_consumed) {
- *bytes_consumed = consumed;
- }
-
- return PSFS_PASS_ON;
-
-out_failure:
- if (out_buf != NULL) {
- pefree(out_buf, inst->persistent);
- }
- if (bucket != NULL) {
- php_stream_bucket_delref(bucket TSRMLS_CC);
- }
- return PSFS_ERR_FATAL;
-}
-
-static void strfilter_convert_dtor(php_stream_filter *thisfilter TSRMLS_DC)
-{
- assert(thisfilter->abstract != NULL);
-
- php_convert_filter_dtor((php_convert_filter *)thisfilter->abstract);
- pefree(thisfilter->abstract, ((php_convert_filter *)thisfilter->abstract)->persistent);
-}
-
-static php_stream_filter_ops strfilter_convert_ops = {
- strfilter_convert_filter,
- strfilter_convert_dtor,
- "convert.*"
-};
-
-static php_stream_filter *strfilter_convert_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC)
-{
- php_convert_filter *inst;
- php_stream_filter *retval = NULL;
-
- char *dot;
- int conv_mode;
-
- if (filterparams != NULL && Z_TYPE_P(filterparams) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): invalid filter parameter", filtername);
- return NULL;
- }
-
- if ((dot = strchr(filtername, '.')) == NULL) {
- return NULL;
- }
- ++dot;
-
- inst = pemalloc(sizeof(php_convert_filter), persistent);
-
- if (strcasecmp(dot, "base64-encode") == 0) {
- conv_mode = PHP_CONV_BASE64_ENCODE;
- } else if (strcasecmp(dot, "base64-decode") == 0) {
- conv_mode = PHP_CONV_BASE64_DECODE;
- } else if (strcasecmp(dot, "quoted-printable-encode") == 0) {
- conv_mode = PHP_CONV_QPRINT_ENCODE;
- } else if (strcasecmp(dot, "quoted-printable-decode") == 0) {
- conv_mode = PHP_CONV_QPRINT_DECODE;
- }
-
- if (php_convert_filter_ctor(inst, conv_mode,
- (filterparams != NULL ? Z_ARRVAL_P(filterparams) : NULL),
- filtername, persistent) != SUCCESS) {
- goto out;
- }
-
- retval = php_stream_filter_alloc(&strfilter_convert_ops, inst, persistent);
-out:
- if (retval == NULL) {
- pefree(inst, persistent);
- }
-
- return retval;
-}
-
-static php_stream_filter_factory strfilter_convert_factory = {
- strfilter_convert_create
-};
-/* }}} */
-
-static const struct {
- php_stream_filter_ops *ops;
- php_stream_filter_factory *factory;
-} standard_filters[] = {
- { &strfilter_rot13_ops, &strfilter_rot13_factory },
- { &strfilter_toupper_ops, &strfilter_toupper_factory },
- { &strfilter_tolower_ops, &strfilter_tolower_factory },
- { &strfilter_strip_tags_ops, &strfilter_strip_tags_factory },
- { &strfilter_convert_ops, &strfilter_convert_factory },
- /* additional filters to go here */
- { NULL, NULL }
-};
-
-/* {{{ filter MINIT and MSHUTDOWN */
-PHP_MINIT_FUNCTION(standard_filters)
-{
- int i;
-
- for (i = 0; standard_filters[i].ops; i++) {
- if (FAILURE == php_stream_filter_register_factory(
- standard_filters[i].ops->label,
- standard_filters[i].factory
- TSRMLS_CC)) {
- return FAILURE;
- }
- }
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(standard_filters)
-{
- int i;
-
- for (i = 0; standard_filters[i].ops; i++) {
- php_stream_filter_unregister_factory(standard_filters[i].ops->label TSRMLS_CC);
- }
- return SUCCESS;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/flock_compat.c b/ext/standard/flock_compat.c
deleted file mode 100644
index 776926e2f4..0000000000
--- a/ext/standard/flock_compat.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include <errno.h>
-#include "ext/standard/flock_compat.h"
-
-#if HAVE_STRUCT_FLOCK
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/file.h>
-#endif
-
-#ifdef PHP_WIN32
-#include <io.h>
-#endif
-
-#ifdef NETWARE
-#ifdef NEW_LIBC
-#include <netinet/in.h>
-#else
-#include <sys/socket.h>
-#endif
-#endif
-
-#ifndef HAVE_FLOCK
-PHPAPI int flock(int fd, int operation)
-{
- return php_flock(fd, operation);
-}
-#endif /* !defined(HAVE_FLOCK) */
-
-PHPAPI int php_flock(int fd, int operation)
-#if HAVE_STRUCT_FLOCK
-{
- struct flock flck;
- int ret;
-
- flck.l_start = flck.l_len = 0;
- flck.l_whence = SEEK_SET;
-
- if (operation & LOCK_SH)
- flck.l_type = F_RDLCK;
- else if (operation & LOCK_EX)
- flck.l_type = F_WRLCK;
- else if (operation & LOCK_UN)
- flck.l_type = F_UNLCK;
- else {
- errno = EINVAL;
- return -1;
- }
-
- ret = fcntl(fd, operation & LOCK_NB ? F_SETLK : F_SETLKW, &flck);
-
- if (operation & LOCK_NB && ret == -1 &&
- (errno == EACCES || errno == EAGAIN))
- errno = EWOULDBLOCK;
-
- if (ret != -1) ret = 0;
-
- return ret;
-}
-#elif defined(PHP_WIN32)
-/*
- * Program: Unix compatibility routines
- *
- * Author: Mark Crispin
- * Networks and Distributed Computing
- * Computing & Communications
- * University of Washington
- * Administration Building, AG-44
- * Seattle, WA 98195
- * Internet: MRC@CAC.Washington.EDU
- *
- * Date: 14 September 1996
- * Last Edited: 14 August 1997
- *
- * Copyright 1997 by the University of Washington
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appears in all copies and that both the
- * above copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the University of Washington not be
- * used in advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. This software is made available
- * "as is", and
- * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
- * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
- * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
- * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* DEDICATION
-
- * This file is dedicated to my dog, Unix, also known as Yun-chan and
- * Unix J. Terwilliker Jehosophat Aloysius Monstrosity Animal Beast. Unix
- * passed away at the age of 11 1/2 on September 14, 1996, 12:18 PM PDT, after
- * a two-month bout with cirrhosis of the liver.
- *
- * He was a dear friend, and I miss him terribly.
- *
- * Lift a leg, Yunie. Luv ya forever!!!!
- */
-{
- HANDLE hdl = (HANDLE) _get_osfhandle(fd);
- DWORD low = 1, high = 0;
- OVERLAPPED offset =
- {0, 0, 0, 0, NULL};
- if (hdl < 0)
- return -1; /* error in file descriptor */
- /* bug for bug compatible with Unix */
- UnlockFileEx(hdl, 0, low, high, &offset);
- switch (operation & ~LOCK_NB) { /* translate to LockFileEx() op */
- case LOCK_EX: /* exclusive */
- if (LockFileEx(hdl, LOCKFILE_EXCLUSIVE_LOCK +
- ((operation & LOCK_NB) ? LOCKFILE_FAIL_IMMEDIATELY : 0),
- 0, low, high, &offset))
- return 0;
- break;
- case LOCK_SH: /* shared */
- if (LockFileEx(hdl, ((operation & LOCK_NB) ? LOCKFILE_FAIL_IMMEDIATELY : 0),
- 0, low, high, &offset))
- return 0;
- break;
- case LOCK_UN: /* unlock */
- return 0; /* always succeeds */
- default: /* default */
- break;
- }
- /* Under Win32 MT library, errno is not a variable but a function call,
- * which cannot be assigned to.
- */
-#if !defined(PHP_WIN32)
- errno = EINVAL; /* bad call */
-#endif
- return -1;
-}
-#else
-#warning no proper flock support for your site
-{
- errno = 0;
- return 0;
-}
-#endif
-
-#if !(HAVE_INET_ATON)
-/* {{{ inet_aton
- * Check whether "cp" is a valid ascii representation
- * of an Internet address and convert to a binary address.
- * Returns 1 if the address is valid, 0 if not.
- * This replaces inet_addr, the return value from which
- * cannot distinguish between failure and a local broadcast address.
- */
-int inet_aton(const char *cp, struct in_addr *ap)
-{
- int dots = 0;
- register unsigned long acc = 0, addr = 0;
-
- do {
- register char cc = *cp;
-
- switch (cc) {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- acc = acc * 10 + (cc - '0');
- break;
-
- case '.':
- if (++dots > 3) {
- return 0;
- }
- /* Fall through */
-
- case '\0':
- if (acc > 255) {
- return 0;
- }
- addr = addr << 8 | acc;
- acc = 0;
- break;
-
- default:
- return 0;
- }
- } while (*cp++) ;
-
- /* Normalize the address */
- if (dots < 3) {
- addr <<= 8 * (3 - dots) ;
- }
-
- /* Store it if requested */
- if (ap) {
- ap->s_addr = htonl(addr);
- }
-
- return 1;
-}
-/* }}} */
-#endif /* !HAVE_INET_ATON */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/flock_compat.h b/ext/standard/flock_compat.h
deleted file mode 100644
index 4088036e5b..0000000000
--- a/ext/standard/flock_compat.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef FLOCK_COMPAT_H
-#define FLOCK_COMPAT_H
-
-/* php_flock internally uses fcntl whther or not flock is available
- * This way our php_flock even works on NFS files.
- * More info: /usr/src/linux/Documentation
- */
-PHPAPI int php_flock(int fd, int operation);
-
-#ifndef HAVE_FLOCK
-# define LOCK_SH 1
-# define LOCK_EX 2
-# define LOCK_NB 4
-# define LOCK_UN 8
-PHPAPI int flock(int fd, int operation);
-#endif
-
-#ifdef PHP_WIN32
-#define EWOULDBLOCK WSAEWOULDBLOCK
-# define fsync _commit
-# define ftruncate(a, b) chsize(a, b)
-#endif /* defined(PHP_WIN32) */
-
-#if !HAVE_INET_ATON
-#if HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-
-extern int inet_aton(const char *, struct in_addr *);
-#endif
-
-#endif /* FLOCK_COMPAT_H */
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
deleted file mode 100644
index 111d8e89fd..0000000000
--- a/ext/standard/formatted_print.c
+++ /dev/null
@@ -1,847 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <math.h> /* modf() */
-#include "php.h"
-#include "ext/standard/head.h"
-#include "php_string.h"
-#include "zend_execute.h"
-#include <stdio.h>
-
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
-#define ALIGN_LEFT 0
-#define ALIGN_RIGHT 1
-#define ADJ_WIDTH 1
-#define ADJ_PRECISION 2
-#define NUM_BUF_SIZE 500
-#define NDIG 80
-#define FLOAT_DIGITS 6
-#define FLOAT_PRECISION 6
-#define MAX_FLOAT_DIGITS 38
-#define MAX_FLOAT_PRECISION 40
-
-#if 0
-/* trick to control varargs functions through cpp */
-# define PRINTF_DEBUG(arg) php_printf arg
-#else
-# define PRINTF_DEBUG(arg)
-#endif
-
-static char hexchars[] = "0123456789abcdef";
-static char HEXCHARS[] = "0123456789ABCDEF";
-
-
-/*
- * cvt.c - IEEE floating point formatting routines for FreeBSD
- * from GNU libc-4.6.27
- */
-
-/*
- * php_convert_to_decimal converts to decimal
- * the number of digits is specified by ndigit
- * decpt is set to the position of the decimal point
- * sign is set to 0 for positive, 1 for negative
- */
-static char *php_convert_to_decimal(double arg, int ndigits, int *decpt, int *sign, int eflag)
-{
- register int r2;
- double fi, fj;
- register char *p, *p1;
- /*THREADX*/
-#ifndef THREAD_SAFE
- static char cvt_buf[NDIG];
-#endif
-
- if (ndigits >= NDIG - 1)
- ndigits = NDIG - 2;
- r2 = 0;
- *sign = 0;
- p = &cvt_buf[0];
- if (arg < 0) {
- *sign = 1;
- arg = -arg;
- }
- arg = modf(arg, &fi);
- p1 = &cvt_buf[NDIG];
- /*
- * Do integer part
- */
- if (fi != 0) {
- p1 = &cvt_buf[NDIG];
- while (fi != 0) {
- fj = modf(fi / 10, &fi);
- *--p1 = (int) ((fj + .03) * 10) + '0';
- r2++;
- }
- while (p1 < &cvt_buf[NDIG])
- *p++ = *p1++;
- } else if (arg > 0) {
- while ((fj = arg * 10.0) < 0.9999999) {
- arg = fj;
- r2--;
- }
- }
- p1 = &cvt_buf[ndigits];
- if (eflag == 0)
- p1 += r2;
- *decpt = r2;
- if (p1 < &cvt_buf[0]) {
- cvt_buf[0] = '\0';
- return (cvt_buf);
- }
- while (p <= p1 && p < &cvt_buf[NDIG]) {
- arg *= 10;
- arg = modf(arg, &fj);
- *p++ = (int) fj + '0';
- }
- if (p1 >= &cvt_buf[NDIG]) {
- cvt_buf[NDIG - 1] = '\0';
- return (cvt_buf);
- }
- p = p1;
- *p1 += 5;
- while (*p1 > '9') {
- *p1 = '0';
- if (p1 > cvt_buf)
- ++ * --p1;
- else {
- *p1 = '1';
- (*decpt)++;
- if (eflag == 0) {
- if (p > cvt_buf)
- *p = '0';
- p++;
- }
- }
- }
- *p = '\0';
- return (cvt_buf);
-}
-
-
-inline static void
-php_sprintf_appendchar(char **buffer, int *pos, int *size, char add TSRMLS_DC)
-{
- if ((*pos + 1) >= *size) {
- *size <<= 1;
- PRINTF_DEBUG(("%s(): ereallocing buffer to %d bytes\n", get_active_function_name(TSRMLS_C), *size));
- *buffer = erealloc(*buffer, *size);
- }
- PRINTF_DEBUG(("sprintf: appending '%c', pos=\n", add, *pos));
- (*buffer)[(*pos)++] = add;
-}
-
-
-inline static void
-php_sprintf_appendstring(char **buffer, int *pos, int *size, char *add,
- int min_width, int max_width, char padding,
- int alignment, int len, int sign, int expprec)
-{
- register int npad;
- int req_size;
- int copy_len;
-
- copy_len = (expprec ? MIN(max_width, len) : len);
- npad = min_width - copy_len;
-
- if (npad < 0) {
- npad = 0;
- }
-
- PRINTF_DEBUG(("sprintf: appendstring(%x, %d, %d, \"%s\", %d, '%c', %d)\n",
- *buffer, *pos, *size, add, min_width, padding, alignment));
-
- req_size = *pos + MAX(min_width, copy_len) + 1;
-
- if (req_size > *size) {
- while (req_size > *size) {
- *size <<= 1;
- }
- PRINTF_DEBUG(("sprintf ereallocing buffer to %d bytes\n", *size));
- *buffer = erealloc(*buffer, *size);
- }
- if (alignment == ALIGN_RIGHT) {
- if (sign && padding=='0') {
- (*buffer)[(*pos)++] = '-';
- add++;
- len--;
- }
- while (npad-- > 0) {
- (*buffer)[(*pos)++] = padding;
- }
- }
- PRINTF_DEBUG(("sprintf: appending \"%s\"\n", add));
- memcpy(&(*buffer)[*pos], add, copy_len + 1);
- *pos += copy_len;
- if (alignment == ALIGN_LEFT) {
- while (npad--) {
- (*buffer)[(*pos)++] = padding;
- }
- }
-}
-
-
-inline static void
-php_sprintf_appendint(char **buffer, int *pos, int *size, long number,
- int width, char padding, int alignment,
- int always_sign)
-{
- char numbuf[NUM_BUF_SIZE];
- register unsigned long magn, nmagn;
- register unsigned int i = NUM_BUF_SIZE - 1, neg = 0;
-
- PRINTF_DEBUG(("sprintf: appendint(%x, %x, %x, %d, %d, '%c', %d)\n",
- *buffer, pos, size, number, width, padding, alignment));
- if (number < 0) {
- neg = 1;
- magn = ((unsigned long) -(number + 1)) + 1;
- } else {
- magn = (unsigned long) number;
- }
-
- /* Can't right-pad 0's on integers */
- if(alignment==0 && padding=='0') padding=' ';
-
- numbuf[i] = '\0';
-
- do {
- nmagn = magn / 10;
-
- numbuf[--i] = (unsigned char)(magn - (nmagn * 10)) + '0';
- magn = nmagn;
- }
- while (magn > 0 && i > 0);
- if (neg) {
- numbuf[--i] = '-';
- } else if (always_sign) {
- numbuf[--i] = '+';
- }
- PRINTF_DEBUG(("sprintf: appending %d as \"%s\", i=%d\n",
- number, &numbuf[i], i));
- php_sprintf_appendstring(buffer, pos, size, &numbuf[i], width, 0,
- padding, alignment, (NUM_BUF_SIZE - 1) - i,
- neg, 0);
-}
-
-inline static void
-php_sprintf_appenduint(char **buffer, int *pos, int *size,
- unsigned long number,
- int width, char padding, int alignment, int always_sign)
-{
- char numbuf[NUM_BUF_SIZE];
- register unsigned long magn, nmagn;
- register unsigned int i = NUM_BUF_SIZE - 1;
-
- PRINTF_DEBUG(("sprintf: appenduint(%x, %x, %x, %d, %d, '%c', %d)\n",
- *buffer, pos, size, number, width, padding, alignment));
- magn = (unsigned int) number;
-
- /* Can't right-pad 0's on integers */
- if (alignment == 0 && padding == '0') padding = ' ';
-
- numbuf[i] = '\0';
-
- do {
- nmagn = magn / 10;
-
- numbuf[--i] = (unsigned char)(magn - (nmagn * 10)) + '0';
- magn = nmagn;
- } while (magn > 0 && i > 0);
-
- if (always_sign)
- numbuf[--i] = '+';
- PRINTF_DEBUG(("sprintf: appending %d as \"%s\", i=%d\n", number, &numbuf[i], i));
- php_sprintf_appendstring(buffer, pos, size, &numbuf[i], width, 0,
- padding, alignment, (NUM_BUF_SIZE - 1) - i, 0, 0);
-}
-
-inline static void
-php_sprintf_appenddouble(char **buffer, int *pos,
- int *size, double number,
- int width, char padding,
- int alignment, int precision,
- int adjust, char fmt,
- int always_sign
- TSRMLS_DC)
-{
- char numbuf[NUM_BUF_SIZE];
- char *cvt;
- register int i = 0, j = 0;
- int sign, decpt;
- char decimal_point = EG(float_separator)[0];
-
- PRINTF_DEBUG(("sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n",
- *buffer, pos, size, number, width, padding, alignment, fmt));
- if ((adjust & ADJ_PRECISION) == 0) {
- precision = FLOAT_PRECISION;
- } else if (precision > MAX_FLOAT_PRECISION) {
- precision = MAX_FLOAT_PRECISION;
- }
-
- if (zend_isnan(number)) {
- sign = (number<0);
- php_sprintf_appendstring(buffer, pos, size, "NaN", 3, 0, padding,
- alignment, precision, sign, 0);
- return;
- }
-
- if (zend_isinf(number)) {
- sign = (number<0);
- php_sprintf_appendstring(buffer, pos, size, "INF", 3, 0, padding,
- alignment, precision, sign, 0);
- return;
- }
-
- cvt = php_convert_to_decimal(number, precision, &decpt, &sign, (fmt == 'e'));
-
- if (sign) {
- numbuf[i++] = '-';
- } else if (always_sign) {
- numbuf[i++] = '+';
- }
-
- if (fmt == 'f') {
- if (decpt <= 0) {
- numbuf[i++] = '0';
- if (precision > 0) {
- int k = precision;
- numbuf[i++] = decimal_point;
- while ((decpt++ < 0) && k--) {
- numbuf[i++] = '0';
- }
- }
- } else {
- while (decpt-- > 0)
- numbuf[i++] = cvt[j++];
- if (precision > 0)
- numbuf[i++] = decimal_point;
- }
- } else if (fmt == 'e' || fmt == 'E') {
- char *exp_p;
- int dec2;
-
- decpt--;
-
- numbuf[i++] = cvt[j++];
- numbuf[i++] = decimal_point;
-
- if (precision > 0) {
- int k = precision;
-
- while (k-- && cvt[j]) {
- numbuf[i++] = cvt[j++];
- }
- } else {
- numbuf[i++] = '0';
- }
-
- numbuf[i++] = fmt;
- exp_p = php_convert_to_decimal(decpt, 0, &dec2, &sign, 0);
- numbuf[i++] = sign ? '-' : '+';
- if (*exp_p) {
- while (*exp_p) {
- numbuf[i++] = *(exp_p++);
- }
- } else {
- numbuf[i++] = '0';
- }
- } else {
- numbuf[i++] = cvt[j++];
- if (precision > 0)
- numbuf[i++] = decimal_point;
- }
-
- while (cvt[j]) {
- numbuf[i++] = cvt[j++];
- }
-
- numbuf[i] = '\0';
-
- if (precision > 0) {
- width += (precision + 1);
- }
- php_sprintf_appendstring(buffer, pos, size, numbuf, width, 0, padding,
- alignment, i, sign, 0);
-}
-
-
-inline static void
-php_sprintf_append2n(char **buffer, int *pos, int *size, long number,
- int width, char padding, int alignment, int n,
- char *chartable, int expprec)
-{
- char numbuf[NUM_BUF_SIZE];
- register unsigned long num;
- register unsigned int i = NUM_BUF_SIZE - 1;
- register int andbits = (1 << n) - 1;
-
- PRINTF_DEBUG(("sprintf: append2n(%x, %x, %x, %d, %d, '%c', %d, %d, %x)\n",
- *buffer, pos, size, number, width, padding, alignment, n,
- chartable));
- PRINTF_DEBUG(("sprintf: append2n 2^%d andbits=%x\n", n, andbits));
-
- num = (unsigned long) number;
- numbuf[i] = '\0';
-
- do {
- numbuf[--i] = chartable[(num & andbits)];
- num >>= n;
- }
- while (num > 0);
-
- php_sprintf_appendstring(buffer, pos, size, &numbuf[i], width, 0,
- padding, alignment, (NUM_BUF_SIZE - 1) - i,
- 0, expprec);
-}
-
-
-inline static long
-php_sprintf_getnumber(char *buffer, int *pos)
-{
- char *endptr;
- register long num = strtol(&buffer[*pos], &endptr, 10);
- register int i = 0;
-
- if (endptr != NULL) {
- i = (endptr - &buffer[*pos]);
- }
- PRINTF_DEBUG(("sprintf_getnumber: number was %d bytes long\n", i));
- *pos += i;
- return num;
-}
-
-/* {{{ php_formatted_print
- * New sprintf implementation for PHP.
- *
- * Modifiers:
- *
- * " " pad integers with spaces
- * "-" left adjusted field
- * n field size
- * "."n precision (floats only)
- * "+" Always place a sign (+ or -) in front of a number
- *
- * Type specifiers:
- *
- * "%" literal "%", modifiers are ignored.
- * "b" integer argument is printed as binary
- * "c" integer argument is printed as a single character
- * "d" argument is an integer
- * "f" the argument is a float
- * "o" integer argument is printed as octal
- * "s" argument is a string
- * "x" integer argument is printed as lowercase hexadecimal
- * "X" integer argument is printed as uppercase hexadecimal
- *
- */
-static char *
-php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC)
-{
- zval ***args, **z_format;
- int argc, size = 240, inpos = 0, outpos = 0, temppos;
- int alignment, width, precision, currarg, adjusting, argnum;
- char *format, *result, padding;
- int always_sign;
-
- argc = ZEND_NUM_ARGS();
-
- /* verify the number of args */
- if ((use_array && argc != (2 + format_offset))
- || (!use_array && argc < (1 + format_offset))) {
- WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
- }
- args = (zval ***)emalloc(argc * sizeof(zval *));
-
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
- }
-
- if (use_array) {
- int i = 1;
- zval ***newargs;
- zval **array;
-
- z_format = args[format_offset];
- array = args[1 + format_offset];
-
- SEPARATE_ZVAL(array);
- convert_to_array_ex(array);
-
- argc = 1 + zend_hash_num_elements(Z_ARRVAL_PP(array));
- newargs = (zval ***)emalloc(argc * sizeof(zval *));
- newargs[0] = z_format;
-
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_PP(array));
- zend_hash_get_current_data(Z_ARRVAL_PP(array), (void **)&newargs[i++]) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_PP(array)));
-
- efree(args);
- args = newargs;
- format_offset = 0;
- }
-
- convert_to_string_ex(args[format_offset]);
- format = Z_STRVAL_PP(args[format_offset]);
- result = emalloc(size);
-
- currarg = 1;
-
- while (inpos<Z_STRLEN_PP(args[format_offset])) {
- int expprec = 0;
-
- PRINTF_DEBUG(("sprintf: format[%d]='%c'\n", inpos, format[inpos]));
- PRINTF_DEBUG(("sprintf: outpos=%d\n", outpos));
- if (format[inpos] != '%') {
- php_sprintf_appendchar(&result, &outpos, &size, format[inpos++] TSRMLS_CC);
- } else if (format[inpos + 1] == '%') {
- php_sprintf_appendchar(&result, &outpos, &size, '%' TSRMLS_CC);
- inpos += 2;
- } else {
- if (currarg >= argc && format[inpos + 1] != '%') {
- efree(result);
- efree(args);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too few arguments");
- return NULL;
- }
- /* starting a new format specifier, reset variables */
- alignment = ALIGN_RIGHT;
- adjusting = 0;
- padding = ' ';
- always_sign = 0;
- inpos++; /* skip the '%' */
-
- PRINTF_DEBUG(("sprintf: first looking at '%c', inpos=%d\n",
- format[inpos], inpos));
- if (isascii((int)format[inpos]) && !isalpha((int)format[inpos])) {
- /* first look for argnum */
- temppos = inpos;
- while (isdigit((int)format[temppos])) temppos++;
- if (format[temppos] == '$') {
- argnum = php_sprintf_getnumber(format, &inpos);
-
- if (argnum == 0) {
- efree(result);
- efree(args);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Zero is not a valid argument number");
- return NULL;
- }
-
- inpos++; /* skip the '$' */
- } else {
- argnum = currarg++;
- }
-
- argnum += format_offset;
-
- if (argnum >= argc) {
- efree(result);
- efree(args);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too few arguments");
- return NULL;
- }
-
- /* after argnum comes modifiers */
- PRINTF_DEBUG(("sprintf: looking for modifiers\n"
- "sprintf: now looking at '%c', inpos=%d\n",
- format[inpos], inpos));
- for (;; inpos++) {
- if (format[inpos] == ' ' || format[inpos] == '0') {
- padding = format[inpos];
- } else if (format[inpos] == '-') {
- alignment = ALIGN_LEFT;
- /* space padding, the default */
- } else if (format[inpos] == '+') {
- always_sign = 1;
- } else if (format[inpos] == '\'') {
- padding = format[++inpos];
- } else {
- PRINTF_DEBUG(("sprintf: end of modifiers\n"));
- break;
- }
- }
- PRINTF_DEBUG(("sprintf: padding='%c'\n", padding));
- PRINTF_DEBUG(("sprintf: alignment=%s\n",
- (alignment == ALIGN_LEFT) ? "left" : "right"));
-
-
- /* after modifiers comes width */
- if (isdigit((int)format[inpos])) {
- PRINTF_DEBUG(("sprintf: getting width\n"));
- width = php_sprintf_getnumber(format, &inpos);
- adjusting |= ADJ_WIDTH;
- } else {
- width = 0;
- }
- PRINTF_DEBUG(("sprintf: width=%d\n", width));
-
- /* after width and argnum comes precision */
- if (format[inpos] == '.') {
- inpos++;
- PRINTF_DEBUG(("sprintf: getting precision\n"));
- if (isdigit((int)format[inpos])) {
- precision = php_sprintf_getnumber(format, &inpos);
- adjusting |= ADJ_PRECISION;
- expprec = 1;
- } else {
- precision = 0;
- }
- } else {
- precision = 0;
- }
- PRINTF_DEBUG(("sprintf: precision=%d\n", precision));
- } else {
- width = precision = 0;
- argnum = currarg++ + format_offset;
- }
-
- if (format[inpos] == 'l') {
- inpos++;
- }
- PRINTF_DEBUG(("sprintf: format character='%c'\n", format[inpos]));
- /* now we expect to find a type specifier */
- switch (format[inpos]) {
- case 's':
- convert_to_string_ex(args[argnum]);
- php_sprintf_appendstring(&result, &outpos, &size,
- Z_STRVAL_PP(args[argnum]),
- width, precision, padding,
- alignment,
- Z_STRLEN_PP(args[argnum]),
- 0, expprec);
- break;
-
- case 'd':
- convert_to_long_ex(args[argnum]);
- php_sprintf_appendint(&result, &outpos, &size,
- Z_LVAL_PP(args[argnum]),
- width, padding, alignment,
- always_sign);
- break;
-
- case 'u':
- convert_to_long_ex(args[argnum]);
- php_sprintf_appenduint(&result, &outpos, &size,
- Z_LVAL_PP(args[argnum]),
- width, padding, alignment,
- always_sign);
- break;
-
- case 'e':
- case 'f':
- /* XXX not done */
- convert_to_double_ex(args[argnum]);
- php_sprintf_appenddouble(&result, &outpos, &size,
- Z_DVAL_PP(args[argnum]),
- width, padding, alignment,
- precision, adjusting,
- format[inpos], always_sign
- TSRMLS_CC);
- break;
-
- case 'c':
- convert_to_long_ex(args[argnum]);
- php_sprintf_appendchar(&result, &outpos, &size,
- (char) Z_LVAL_PP(args[argnum]) TSRMLS_CC);
- break;
-
- case 'o':
- convert_to_long_ex(args[argnum]);
- php_sprintf_append2n(&result, &outpos, &size,
- Z_LVAL_PP(args[argnum]),
- width, padding, alignment, 3,
- hexchars, expprec);
- break;
-
- case 'x':
- convert_to_long_ex(args[argnum]);
- php_sprintf_append2n(&result, &outpos, &size,
- Z_LVAL_PP(args[argnum]),
- width, padding, alignment, 4,
- hexchars, expprec);
- break;
-
- case 'X':
- convert_to_long_ex(args[argnum]);
- php_sprintf_append2n(&result, &outpos, &size,
- Z_LVAL_PP(args[argnum]),
- width, padding, alignment, 4,
- HEXCHARS, expprec);
- break;
-
- case 'b':
- convert_to_long_ex(args[argnum]);
- php_sprintf_append2n(&result, &outpos, &size,
- Z_LVAL_PP(args[argnum]),
- width, padding, alignment, 1,
- hexchars, expprec);
- break;
-
- case '%':
- php_sprintf_appendchar(&result, &outpos, &size, '%' TSRMLS_CC);
-
- break;
- default:
- break;
- }
- inpos++;
- }
- }
-
- efree(args);
-
- /* possibly, we have to make sure we have room for the terminating null? */
- result[outpos]=0;
- *len = outpos;
- return result;
-}
-/* }}} */
-
-/* {{{ proto string sprintf(string format [, mixed arg1 [, mixed ...]])
- Return a formatted string */
-PHP_FUNCTION(user_sprintf)
-{
- char *result;
- int len;
-
- if ((result=php_formatted_print(ht, &len, 0, 0 TSRMLS_CC))==NULL) {
- RETURN_FALSE;
- }
- RETVAL_STRINGL(result, len, 0);
-}
-/* }}} */
-
-/* {{{ proto string vsprintf(string format, array args)
- Return a formatted string */
-PHP_FUNCTION(vsprintf)
-{
- char *result;
- int len;
-
- if ((result=php_formatted_print(ht, &len, 1, 0 TSRMLS_CC))==NULL) {
- RETURN_FALSE;
- }
- RETVAL_STRINGL(result, len, 0);
-}
-/* }}} */
-
-/* {{{ proto int printf(string format [, mixed arg1 [, mixed ...]])
- Output a formatted string */
-PHP_FUNCTION(user_printf)
-{
- char *result;
- int len;
-
- if ((result=php_formatted_print(ht, &len, 0, 0 TSRMLS_CC))==NULL) {
- RETURN_FALSE;
- }
- PHPWRITE(result, len);
- efree(result);
-}
-/* }}} */
-
-/* {{{ proto int vprintf(string format, array args)
- Output a formatted string */
-PHP_FUNCTION(vprintf)
-{
- char *result;
- int len;
-
- if ((result=php_formatted_print(ht, &len, 1, 0 TSRMLS_CC))==NULL) {
- RETURN_FALSE;
- }
- PHPWRITE(result, len);
- efree(result);
-}
-/* }}} */
-
-/* {{{ proto int fprintf(resource stream, string format [, mixed arg1 [, mixed ...]])
- Output a formatted string into a stream */
-PHP_FUNCTION(fprintf)
-{
- php_stream *stream;
- zval **arg1;
- char *result;
- int len;
-
- if (ZEND_NUM_ARGS() < 2) {
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(1, &arg1)==FAILURE) {
- RETURN_FALSE;
- }
-
- php_stream_from_zval(stream, arg1);
-
- if ((result=php_formatted_print(ht, &len, 0, 1 TSRMLS_CC))==NULL) {
- RETURN_FALSE;
- }
-
- php_stream_write(stream, result, len);
-
- efree(result);
-
- RETVAL_LONG(len - 1);
-}
-
-/* {{{ proto int vfprintf(resource stream, string format, array args)
- Output a formatted string into a stream */
-PHP_FUNCTION(vfprintf)
-{
- php_stream *stream;
- zval **arg1;
- char *result;
- int len;
-
- if (ZEND_NUM_ARGS() != 3) {
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(1, &arg1)==FAILURE) {
- RETURN_FALSE;
- }
-
- php_stream_from_zval(stream, arg1);
-
- if ((result=php_formatted_print(ht, &len, 1, 1 TSRMLS_CC))==NULL) {
- RETURN_FALSE;
- }
-
- php_stream_write(stream, result, len);
-
- efree(result);
-
- RETVAL_LONG(len - 1);
-}
-
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c
deleted file mode 100644
index 4af044b02c..0000000000
--- a/ext/standard/fsock.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Paul Panotzki - Bunyip Information Systems |
- | Jim Winstead <jimw@php.net> |
- | Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_globals.h"
-#include <stdlib.h>
-#include <stddef.h>
-#include "php_network.h"
-#include "file.h"
-
-/* {{{ php_fsockopen() */
-
-static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- char *host;
- long host_len;
- long port = -1;
- zval *zerrno = NULL, *zerrstr = NULL;
- double timeout = FG(default_socket_timeout);
- unsigned long conv;
- struct timeval tv;
- char *hashkey = NULL;
- php_stream *stream = NULL;
- int err;
- char *hostname = NULL;
- long hostname_len;
- char *errstr = NULL;
-
- RETVAL_FALSE;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lzzd", &host, &host_len, &port, &zerrno, &zerrstr, &timeout) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (persistent) {
- spprintf(&hashkey, 0, "pfsockopen__%s:%d", host, port);
- }
-
- if (port > 0) {
- hostname_len = spprintf(&hostname, 0, "%s:%d", host, port);
- } else {
- hostname_len = host_len;
- hostname = host;
- }
-
- /* prepare the timeout value for use */
- conv = (unsigned long) (timeout * 1000000.0);
- tv.tv_sec = conv / 1000000;
- tv.tv_usec = conv % 1000000;
-
- if (zerrno) {
- zval_dtor(zerrno);
- ZVAL_LONG(zerrno, 0);
- }
- if (zerrstr) {
- zval_dtor(zerrstr);
- ZVAL_STRING(zerrstr, "", 1);
- }
-
- stream = php_stream_xport_create(hostname, hostname_len, ENFORCE_SAFE_MODE | REPORT_ERRORS,
- STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, hashkey, &tv, NULL, &errstr, &err);
-
- if (port > 0) {
- efree(hostname);
- }
- if (stream == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s:%d (%s)", host, port, errstr == NULL ? "Unknown error" : errstr);
- }
-
- if (hashkey) {
- efree(hashkey);
- }
-
- if (stream == NULL) {
- if (zerrno) {
- zval_dtor(zerrno);
- ZVAL_LONG(zerrno, err);
- }
- if (zerrstr && errstr) {
- /* no need to dup; we need to efree buf anyway */
- zval_dtor(zerrstr);
- ZVAL_STRING(zerrstr, errstr, 0);
- }
- RETURN_FALSE;
- }
-
- if (errstr) {
- efree(errstr);
- }
-
- php_stream_to_zval(stream, return_value);
-}
-
-/* }}} */
-
-/* {{{ proto int fsockopen(string hostname, int port [, int errno [, string errstr [, float timeout]]])
- Open Internet or Unix domain socket connection */
-PHP_FUNCTION(fsockopen)
-{
- php_fsockopen_stream(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-/* {{{ proto int pfsockopen(string hostname, int port [, int errno [, string errstr [, float timeout]]])
- Open persistent Internet or Unix domain socket connection */
-PHP_FUNCTION(pfsockopen)
-{
- php_fsockopen_stream(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/fsock.h b/ext/standard/fsock.h
deleted file mode 100644
index 7d263c31e1..0000000000
--- a/ext/standard/fsock.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Paul Panotzki - Bunyip Information Systems |
- | Jim Winstead <jimw@php.net> |
- | Wez Furlong |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* Synced with php 3.0 revision 1.24 1999-06-18 [ssb] */
-
-#ifndef FSOCK_H
-#define FSOCK_H
-
-#ifdef NETWARE
-#ifdef NEW_LIBC
-#include "sys/timeval.h"
-#else
-#include "netware/time_nw.h" /* For 'timeval' */
-#endif
-#endif
-
-#include "file.h"
-
-#include "php_network.h"
-
-PHP_FUNCTION(fsockopen);
-PHP_FUNCTION(pfsockopen);
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim: sw=4 ts=4
- */
-#endif /* FSOCK_H */
diff --git a/ext/standard/ftok.c b/ext/standard/ftok.c
deleted file mode 100644
index 111c51b0a2..0000000000
--- a/ext/standard/ftok.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Andrew Sitnikov <sitnikov@infonet.ee> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-
-#include <sys/types.h>
-
-#ifdef HAVE_SYS_IPC_H
-#include <sys/ipc.h>
-#endif
-
-#if HAVE_FTOK
-/* {{{ proto int ftok(string pathname, string proj)
- Convert a pathname and a project identifier to a System V IPC key */
-PHP_FUNCTION(ftok)
-{
- pval **pathname, **proj;
-
- key_t k;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pathname, &proj) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(pathname);
- convert_to_string_ex(proj);
-
- if (Z_STRLEN_PP(pathname)==0){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argument invalid");
- RETURN_LONG(-1);
- }
-
- if (Z_STRLEN_PP(proj)!=1){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument invalid");
- RETURN_LONG(-1);
- }
-
- k = ftok(Z_STRVAL_PP(pathname),Z_STRVAL_PP(proj)[0]);
-
- RETURN_LONG(k);
-}
-/* }}} */
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
deleted file mode 100644
index 493f5556ae..0000000000
--- a/ext/standard/ftp_fopen_wrapper.c
+++ /dev/null
@@ -1,777 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Jim Winstead <jimw@php.net> |
- | Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_network.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#ifdef PHP_WIN32
-#include <winsock2.h>
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#elif defined(NETWARE)
-/*#include <ws2nlm.h>*/
-/*#include <sys/socket.h>*/
-#ifdef NEW_LIBC
-#include <sys/param.h>
-#else
-#include "netware/param.h"
-#endif
-#else
-#include <sys/param.h>
-#endif
-
-#include "php_standard.h"
-
-#include <sys/types.h>
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifdef PHP_WIN32
-#include <winsock2.h>
-#elif defined(NETWARE) && defined(USE_WINSOCK)
-/*#include <ws2nlm.h>*/
-#include <novsock2.h>
-#else
-#include <netinet/in.h>
-#include <netdb.h>
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif
-
-#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
-#undef AF_UNIX
-#endif
-
-#if defined(AF_UNIX)
-#include <sys/un.h>
-#endif
-
-#include "php_fopen_wrappers.h"
-
-
-static inline int get_ftp_result(php_stream *stream, char *buffer, size_t buffer_size TSRMLS_DC)
-{
- while (php_stream_gets(stream, buffer, buffer_size-1) &&
- !(isdigit((int) buffer[0]) && isdigit((int) buffer[1]) &&
- isdigit((int) buffer[2]) && buffer[3] == ' '));
- return strtol(buffer, NULL, 10);
-}
-#define GET_FTP_RESULT(stream) get_ftp_result((stream), tmp_line, sizeof(tmp_line) TSRMLS_CC)
-
-#define FTPS_ENCRYPT_DATA 1
-
-static int php_stream_ftp_stream_stat(php_stream_wrapper *wrapper,
- php_stream *stream,
- php_stream_statbuf *ssb
- TSRMLS_DC)
-{
- /* For now, we return with a failure code to prevent the underlying
- * file's details from being used instead. */
- return -1;
-}
-
-
-static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper,
- php_stream *stream
- TSRMLS_DC)
-{
- php_stream *controlstream = (php_stream *)stream->wrapperdata;
-
- if (controlstream) {
- php_stream_write_string(controlstream, "QUIT\r\n");
- php_stream_close(controlstream);
- stream->wrapperdata = NULL;
- }
- return 0;
-}
-
-/* {{{ php_ftp_fopen_connect
- */
-static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context,
- php_stream **preuseid, php_url **presource, int *puse_ssl, int *puse_ssl_on_data TSRMLS_DC)
-{
- php_stream *stream = NULL, *reuseid = NULL;
- php_url *resource = NULL;
- int result, use_ssl, use_ssl_on_data = 0;
- char *scratch;
- char tmp_line[512];
-
- resource = php_url_parse((char *) path);
- if (resource == NULL || resource->path == NULL)
- return NULL;
-
- use_ssl = resource->scheme && (strlen(resource->scheme) > 3) && resource->scheme[3] == 's';
-
- /* use port 21 if one wasn't specified */
- if (resource->port == 0)
- resource->port = 21;
-
- stream = php_stream_sock_open_host(resource->host, resource->port, SOCK_STREAM, NULL, 0);
- if (stream == NULL) {
- result = 0; /* silence */
- goto connect_errexit;
- }
-
- php_stream_context_set(stream, context);
- php_stream_notify_info(context, PHP_STREAM_NOTIFY_CONNECT, NULL, 0);
-
- /* Start talking to ftp server */
- result = GET_FTP_RESULT(stream);
- if (result > 299 || result < 200) {
- php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE, tmp_line, result);
- goto connect_errexit;
- }
-
- if (use_ssl) {
-
- /* send the AUTH TLS request name */
- php_stream_write_string(stream, "AUTH TLS\r\n");
-
- /* get the response */
- result = GET_FTP_RESULT(stream);
- if (result != 234) {
- /* AUTH TLS not supported try AUTH SSL */
- php_stream_write_string(stream, "AUTH SSL\r\n");
-
- /* get the response */
- result = GET_FTP_RESULT(stream);
- if (result != 334) {
- use_ssl = 0;
- } else {
- /* we must reuse the old SSL session id */
- /* if we talk to an old ftpd-ssl */
- reuseid = stream;
- }
- } else {
- /* encrypt data etc */
-
-
- }
-
- }
-
- if (use_ssl) {
- if (php_stream_xport_crypto_setup(stream,
- STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0
- || php_stream_xport_crypto_enable(stream, 1 TSRMLS_CC) < 0) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode");
- php_stream_close(stream);
- stream = NULL;
- goto connect_errexit;
- }
-
- /* set PBSZ to 0 */
- php_stream_write_string(stream, "PBSZ 0\r\n");
-
- /* ignore the response */
- result = GET_FTP_RESULT(stream);
-
- /* set data connection protection level */
-#if FTPS_ENCRYPT_DATA
- php_stream_write_string(stream, "PROT P\r\n");
-
- /* get the response */
- result = GET_FTP_RESULT(stream);
- use_ssl_on_data = (result >= 200 && result<=299) || reuseid;
-#else
- php_stream_write_string(stream, "PROT C\r\n");
-
- /* get the response */
- result = GET_FTP_RESULT(stream);
-#endif
- }
-
- /* send the user name */
- php_stream_write_string(stream, "USER ");
- if (resource->user != NULL) {
- php_raw_url_decode(resource->user, strlen(resource->user));
- php_stream_write_string(stream, resource->user);
- } else {
- php_stream_write_string(stream, "anonymous");
- }
- php_stream_write_string(stream, "\r\n");
-
- /* get the response */
- result = GET_FTP_RESULT(stream);
-
- /* if a password is required, send it */
- if (result >= 300 && result <= 399) {
- php_stream_notify_info(context, PHP_STREAM_NOTIFY_AUTH_REQUIRED, tmp_line, 0);
-
- php_stream_write_string(stream, "PASS ");
- if (resource->pass != NULL) {
- php_raw_url_decode(resource->pass, strlen(resource->pass));
- php_stream_write_string(stream, resource->pass);
- } else {
- /* if the user has configured who they are,
- send that as the password */
- if (cfg_get_string("from", &scratch) == SUCCESS) {
- php_stream_write_string(stream, scratch);
- } else {
- php_stream_write_string(stream, "anonymous");
- }
- }
- php_stream_write_string(stream, "\r\n");
-
- /* read the response */
- result = GET_FTP_RESULT(stream);
-
- if (result > 299 || result < 200) {
- php_stream_notify_error(context, PHP_STREAM_NOTIFY_AUTH_RESULT, tmp_line, result);
- } else {
- php_stream_notify_info(context, PHP_STREAM_NOTIFY_AUTH_RESULT, tmp_line, result);
- }
- }
- if (result > 299 || result < 200) {
- goto connect_errexit;
- }
-
- if (puse_ssl) {
- *puse_ssl = use_ssl;
- }
- if (puse_ssl_on_data) {
- *puse_ssl_on_data = use_ssl_on_data;
- }
- if (preuseid) {
- *preuseid = reuseid;
- }
- if (presource) {
- *presource = resource;
- }
-
- return stream;
-
- connect_errexit:
- if (stream) {
- php_stream_close(stream);
- }
-
- return NULL;
-}
-/* }}} */
-
-/* {{{ php_fopen_do_pasv
- */
-static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, int ip_size, char **phoststart TSRMLS_DC)
-{
- char tmp_line[512];
- int result, i;
- unsigned short portno;
- char *tpath, *ttpath, *hoststart=NULL;
-
- /* We try EPSV first, needed for IPv6 and works on some IPv4 servers */
- php_stream_write_string(stream, "EPSV\r\n");
- result = GET_FTP_RESULT(stream);
-
- /* check if we got a 229 response */
- if (result != 229) {
- /* EPSV failed, let's try PASV */
- php_stream_write_string(stream, "PASV\r\n");
- result = GET_FTP_RESULT(stream);
-
- /* make sure we got a 227 response */
- if (result != 227) {
- return 0;
- }
-
- /* parse pasv command (129, 80, 95, 25, 13, 221) */
- tpath = tmp_line;
- /* skip over the "227 Some message " part */
- for (tpath += 4; *tpath && !isdigit((int) *tpath); tpath++);
- if (!*tpath) {
- return 0;
- }
- /* skip over the host ip, to get the port */
- hoststart = tpath;
- for (i = 0; i < 4; i++) {
- for (; isdigit((int) *tpath); tpath++);
- if (*tpath != ',') {
- return 0;
- }
- *tpath='.';
- tpath++;
- }
- tpath[-1] = '\0';
- memcpy(ip, hoststart, ip_size);
- ip[ip_size-1] = '\0';
- hoststart = ip;
-
- /* pull out the MSB of the port */
- portno = (unsigned short) strtoul(tpath, &ttpath, 10) * 256;
- if (ttpath == NULL) {
- /* didn't get correct response from PASV */
- return 0;
- }
- tpath = ttpath;
- if (*tpath != ',') {
- return 0;
- }
- tpath++;
- /* pull out the LSB of the port */
- portno += (unsigned short) strtoul(tpath, &ttpath, 10);
- } else {
- /* parse epsv command (|||6446|) */
- for (i = 0, tpath = tmp_line + 4; *tpath; tpath++) {
- if (*tpath == '|') {
- i++;
- if (i == 3)
- break;
- }
- }
- if (i < 3) {
- return 0;
- }
- /* pull out the port */
- portno = (unsigned short) strtoul(tpath + 1, &ttpath, 10);
- }
-
- if (ttpath == NULL) {
- /* didn't get correct response from EPSV/PASV */
- return 0;
- }
-
- if (phoststart) {
- *phoststart = hoststart;
- }
-
- return portno;
-}
-/* }}} */
-
-/* {{{ php_fopen_url_wrap_ftp
- */
-php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
-{
- php_stream *stream = NULL, *datastream = NULL;
- php_url *resource = NULL;
- char tmp_line[512];
- char ip[sizeof("123.123.123.123")];
- unsigned short portno;
- char *scratch, *hoststart = NULL;
- int result, use_ssl, use_ssl_on_data=0;
- php_stream *reuseid=NULL;
- size_t file_size = 0;
- zval **tmpzval;
- int allow_overwrite = 0;
- int read_write = 0;
-
- tmp_line[0] = '\0';
-
- if (strpbrk(mode, "r+")) {
- read_write = 1; /* Open for reading */
- }
- if (strpbrk(mode, "wa+")) {
- if (read_write) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP does not support simultaneous read/write connections.");
- return NULL;
- }
- if (strchr(mode, 'a')) {
- read_write = 3; /* Open for Appending */
- } else {
- read_write = 2; /* Open for writting */
- }
- }
- if (!read_write) {
- /* No mode specified? */
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unknown file open mode.");
- return NULL;
- }
-
- stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &resource, &use_ssl, &use_ssl_on_data TSRMLS_CC);
- if (!stream) {
- goto errexit;
- }
-
- /* set the connection to be binary */
- php_stream_write_string(stream, "TYPE I\r\n");
- result = GET_FTP_RESULT(stream);
- if (result > 299 || result < 200)
- goto errexit;
-
- /* find out the size of the file (verifying it exists) */
- php_stream_write_string(stream, "SIZE ");
- php_stream_write_string(stream, resource->path);
- php_stream_write_string(stream, "\r\n");
-
- /* read the response */
- result = GET_FTP_RESULT(stream);
- if (read_write == 1) {
- /* Read Mode */
- char *sizestr;
-
- /* when reading file, it must exist */
- if (result > 299 || result < 200) {
- errno = ENOENT;
- goto errexit;
- }
-
- sizestr = strchr(tmp_line, ' ');
- if (sizestr) {
- sizestr++;
- file_size = atoi(sizestr);
- php_stream_notify_file_size(context, file_size, tmp_line, result);
- }
- } else if (read_write == 2) {
- /* when writing file (but not appending), it must NOT exist, unless a context option exists which allows it */
- if (context && php_stream_context_get_option(context, "ftp", "overwrite", &tmpzval) == SUCCESS) {
- allow_overwrite = Z_LVAL_PP(tmpzval);
- }
- if (result <= 299 && result >= 200) {
- if (allow_overwrite) {
- /* Context permits overwritting file,
- so we just delete whatever's there in preparation */
- php_stream_write_string(stream, "DELE ");
- php_stream_write_string(stream, resource->path);
- php_stream_write_string(stream, "\r\n");
- result = GET_FTP_RESULT(stream);
- if (result >= 300 || result <= 199) {
- goto errexit;
- }
- } else {
- errno = EEXIST;
- goto errexit;
- }
- }
- }
-
- /* set up the passive connection */
- portno = php_fopen_do_pasv(stream, ip, sizeof(ip), &hoststart TSRMLS_CC);
-
- if (!portno) {
- goto errexit;
- }
-
- /* Send RETR/STOR command */
- if (read_write == 1) {
- /* retrieve file */
- php_stream_write_string(stream, "RETR ");
- } else if (read_write == 2) {
- /* Write new file */
- php_stream_write_string(stream, "STOR ");
- } else {
- /* Append */
- php_stream_write_string(stream, "APPE ");
- }
- if (resource->path != NULL) {
- php_stream_write_string(stream, resource->path);
- } else {
- php_stream_write_string(stream, "/");
- }
- php_stream_write_string(stream, "\r\n");
-
- /* open the data channel */
- if (hoststart == NULL) {
- hoststart = resource->host;
- }
- datastream = php_stream_sock_open_host(hoststart, portno, SOCK_STREAM, 0, 0);
- if (datastream == NULL) {
- goto errexit;
- }
-
- result = GET_FTP_RESULT(stream);
- if (result != 150 && result != 125) {
- /* Could not retrieve or send the file
- * this data will only be sent to us after connection on the data port was initiated.
- */
- php_stream_close(datastream);
- datastream = NULL;
- goto errexit;
- }
-
- /* close control connection if not in ssl mode */
- if (!use_ssl) {
- php_stream_write_string(stream, "QUIT\r\n");
- php_stream_close(stream);
- stream = NULL;
- }
-
- php_stream_context_set(datastream, context);
- php_stream_notify_progress_init(context, 0, file_size);
-
- if (use_ssl_on_data && (php_stream_xport_crypto_setup(stream,
- STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 ||
- php_stream_xport_crypto_enable(stream, 1 TSRMLS_CC) < 0)) {
-
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode");
- php_stream_close(datastream);
- datastream = NULL;
- goto errexit;
- }
-
- /* remember control stream */
- datastream->wrapperdata = (zval *)stream;
-
- php_url_free(resource);
- return datastream;
-
- errexit:
- php_url_free(resource);
- if (stream) {
- php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE, tmp_line, result);
- php_stream_close(stream);
- }
- if (tmp_line[0] != '\0')
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP server reports %s", tmp_line);
- return NULL;
-}
-/* }}} */
-
-/* {{{ php_ftp_dirsteam_read
- */
-static size_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-{
- php_stream_dirent *ent = (php_stream_dirent *)buf;
- php_stream *innerstream = (php_stream *)stream->abstract;
- size_t tmp_len;
- char *basename;
- int basename_len;
-
- if (count != sizeof(php_stream_dirent)) {
- return 0;
- }
-
- if (php_stream_eof(innerstream)) {
- return 0;
- }
-
- if (!php_stream_get_line(innerstream, ent->d_name, sizeof(ent->d_name), &tmp_len)) {
- return 0;
- }
-
- php_basename(ent->d_name, tmp_len, NULL, 0, &basename, &basename_len);
- if (!basename) {
- return 0;
- }
-
- if (!basename_len) {
- efree(basename);
- return 0;
- }
-
- memcpy(ent->d_name, basename, MIN(sizeof(ent->d_name), basename_len)-1);
- ent->d_name[sizeof(ent->d_name)-1] = '\0';
- efree(basename);
-
- return sizeof(php_stream_dirent);
-}
-/* }}} */
-
-/* {{{ php_ftp_dirstream_close
- */
-static int php_ftp_dirstream_close(php_stream *stream, int close_handle TSRMLS_DC)
-{
- php_stream *innerstream = (php_stream *)stream->abstract;
-
- if (innerstream->wrapperdata) {
- php_stream_close((php_stream *)innerstream->wrapperdata);
- innerstream->wrapperdata = NULL;
- }
- php_stream_close((php_stream *)stream->abstract);
- stream->abstract = NULL;
-
- return 0;
-}
-/* }}} */
-
-/* ftp dirstreams only need to support read and close operations,
- They can't be rewound because the underlying ftp stream can't be rewound. */
-static php_stream_ops php_ftp_dirstream_ops = {
- NULL, /* write */
- php_ftp_dirstream_read, /* read */
- php_ftp_dirstream_close, /* close */
- NULL, /* flush */
- "ftpdir",
- NULL, /* rewind */
- NULL, /* cast */
- NULL, /* stat */
- NULL /* set option */
-};
-
-/* {{{ php_stream_ftp_opendir
- */
-php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
-{
- php_stream *stream, *reuseid, *datastream = NULL;
- php_url *resource;
- int result, use_ssl, use_ssl_on_data = 0;
- char *hoststart = NULL, tmp_line[512];
- char ip[sizeof("123.123.123.123")];
- unsigned short portno;
-
- stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &resource, &use_ssl, &use_ssl_on_data TSRMLS_CC);
-
- /* set the connection to be ascii */
- php_stream_write_string(stream, "TYPE A\r\n");
- result = GET_FTP_RESULT(stream);
- if (result > 299 || result < 200)
- goto opendir_errexit;
-
- /* set up the passive connection */
- portno = php_fopen_do_pasv(stream, ip, sizeof(ip), &hoststart TSRMLS_CC);
-
- if (!portno) {
- goto opendir_errexit;
- }
-
- php_stream_write_string(stream, "NLST ");
- if (resource->path != NULL) {
- php_stream_write_string(stream, resource->path);
- } else {
- php_stream_write_string(stream, "/");
- }
- php_stream_write_string(stream, "\r\n");
-
- /* open the data channel */
- if (hoststart == NULL) {
- hoststart = resource->host;
- }
- datastream = php_stream_sock_open_host(hoststart, portno, SOCK_STREAM, 0, 0);
- if (datastream == NULL) {
- goto opendir_errexit;
- }
-
- result = GET_FTP_RESULT(stream);
- if (result != 150 && result != 125) {
- /* Could not retrieve or send the file
- * this data will only be sent to us after connection on the data port was initiated.
- */
- php_stream_close(datastream);
- datastream = NULL;
- goto opendir_errexit;
- }
-
- /* close control connection if not in ssl mode */
- if (!use_ssl) {
- php_stream_write_string(stream, "QUIT\r\n");
- php_stream_close(stream);
- stream = NULL;
- }
-
- php_stream_context_set(datastream, context);
-
- if (use_ssl_on_data && (php_stream_xport_crypto_setup(stream,
- STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 ||
- php_stream_xport_crypto_enable(stream, 1 TSRMLS_CC) < 0)) {
-
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode");
- php_stream_close(datastream);
- datastream = NULL;
- goto opendir_errexit;
- }
-
- /* remember control stream */
- datastream->wrapperdata = (zval *)stream;
-
- php_url_free(resource);
- return php_stream_alloc(&php_ftp_dirstream_ops, datastream, 0, mode);
-
- opendir_errexit:
- php_url_free(resource);
- if (stream) {
- php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE, tmp_line, result);
- php_stream_close(stream);
- }
- if (tmp_line[0] != '\0')
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP server reports %s", tmp_line);
- return NULL;
-}
-/* }}} */
-
-/* {{{ php_stream_ftp_url_stat
- */
-static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, char *url, php_stream_statbuf *ssb TSRMLS_DC)
-{
- php_stream *stream = NULL;
- php_url *resource;
- int result;
- char tmp_line[512];
-
- /* If ssb is NULL then someone is misbehaving */
- if (!ssb) return -1;
- memset(ssb, 0, sizeof(php_stream_statbuf));
-
- stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, NULL, NULL, &resource, NULL, NULL TSRMLS_CC);
- if (!stream) {
- goto stat_errexit;
- }
-
- /* Size is the only reliable attribute returned by FTP */
- php_stream_write_string(stream, "SIZE ");
- if (resource->path != NULL) {
- php_stream_write_string(stream, resource->path);
- } else {
- php_stream_write_string(stream, "/");
- }
- php_stream_write_string(stream, "\r\n");
-
- result = GET_FTP_RESULT(stream);
- if (result < 200 || result > 299) {
- goto stat_errexit;
- }
-
- sscanf(tmp_line + 4, "%d", &(ssb->sb.st_size));
-
- php_stream_close(stream);
- return 0;
-
- stat_errexit:
- if (stream) {
- php_stream_close(stream);
- }
- return -1;
-}
-/* }}} */
-
-static php_stream_wrapper_ops ftp_stream_wops = {
- php_stream_url_wrap_ftp,
- php_stream_ftp_stream_close, /* stream_close */
- php_stream_ftp_stream_stat,
- php_stream_ftp_url_stat, /* stat_url */
- php_stream_ftp_opendir, /* opendir */
- "FTP",
- NULL /* unlink */
-};
-
-PHPAPI php_stream_wrapper php_stream_ftp_wrapper = {
- &ftp_stream_wops,
- NULL,
- 1 /* is_url */
-};
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/head.c b/ext/standard/head.c
deleted file mode 100644
index 4d38016129..0000000000
--- a/ext/standard/head.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdio.h>
-
-#if defined(NETWARE) && !defined(NEW_LIBC)
-#include <sys/socket.h>
-#endif
-
-#include "php.h"
-#include "ext/standard/php_standard.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "head.h"
-#include "SAPI.h"
-#ifdef TM_IN_SYS_TIME
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-
-#include "php_globals.h"
-#include "safe_mode.h"
-
-
-/* Implementation of the language Header() function */
-/* {{{ proto void header(string header [, bool replace, [int http_response_code]])
- Sends a raw HTTP header */
-PHP_FUNCTION(header)
-{
- zend_bool rep = 1;
- sapi_header_line ctr = {0};
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &ctr.line,
- &ctr.line_len, &rep, &ctr.response_code) == FAILURE)
- return;
-
- sapi_header_op(rep ? SAPI_HEADER_REPLACE:SAPI_HEADER_ADD, &ctr TSRMLS_CC);
-}
-/* }}} */
-
-PHPAPI int php_header(TSRMLS_D)
-{
- if (sapi_send_headers(TSRMLS_C)==FAILURE || SG(request_info).headers_only) {
- return 0; /* don't allow output */
- } else {
- return 1; /* allow output */
- }
-}
-
-
-PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, time_t expires, char *path, int path_len, char *domain, int domain_len, int secure TSRMLS_DC)
-{
- char *cookie, *encoded_value = NULL;
- int len=sizeof("Set-Cookie: ");
- time_t t;
- char *dt;
- sapi_header_line ctr = {0};
- int result;
-
- len += name_len;
- if (value) {
- int encoded_value_len;
-
- encoded_value = php_url_encode(value, value_len, &encoded_value_len);
- len += encoded_value_len;
- }
- if (path) {
- len += path_len;
- }
- if (domain) {
- len += domain_len;
- }
- cookie = emalloc(len + 100);
-
- if (value && value_len == 0) {
- /*
- * MSIE doesn't delete a cookie when you set it to a null value
- * so in order to force cookies to be deleted, even on MSIE, we
- * pick an expiry date 1 year and 1 second in the past
- */
- t = time(NULL) - 31536001;
- dt = php_std_date(t TSRMLS_CC);
- sprintf(cookie, "Set-Cookie: %s=deleted; expires=%s", name, dt);
- efree(dt);
- } else {
- sprintf(cookie, "Set-Cookie: %s=%s", name, value ? encoded_value : "");
- if (expires > 0) {
- strcat(cookie, "; expires=");
- dt = php_std_date(expires TSRMLS_CC);
- strcat(cookie, dt);
- efree(dt);
- }
- }
-
- if (encoded_value) {
- efree(encoded_value);
- }
-
- if (path && path_len > 0) {
- strcat(cookie, "; path=");
- strcat(cookie, path);
- }
- if (domain && domain_len > 0) {
- strcat(cookie, "; domain=");
- strcat(cookie, domain);
- }
- if (secure) {
- strcat(cookie, "; secure");
- }
-
- ctr.line = cookie;
- ctr.line_len = strlen(cookie);
-
- result = sapi_header_op(SAPI_HEADER_ADD, &ctr TSRMLS_CC);
- efree(cookie);
- return result;
-}
-
-
-/* php_set_cookie(name, value, expires, path, domain, secure) */
-/* {{{ proto bool setcookie(string name [, string value [, int expires [, string path [, string domain [, bool secure]]]]])
- Send a cookie */
-PHP_FUNCTION(setcookie)
-{
- char *name, *value = NULL, *path = NULL, *domain = NULL;
- long expires = 0;
- zend_bool secure = 0;
- int name_len, value_len, path_len, domain_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssb", &name,
- &name_len, &value, &value_len, &expires, &path,
- &path_len, &domain, &domain_len, &secure) == FAILURE) {
- return;
- }
-
- if (php_setcookie(name, name_len, value, value_len, expires, path, path_len, domain, domain_len, secure TSRMLS_CC) == SUCCESS) {
- RETVAL_TRUE;
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool headers_sent([string &$file [, int &$line]])
- Returns true if headers have already been sent, false otherwise */
-PHP_FUNCTION(headers_sent)
-{
- zval *arg1, *arg2;
- char *file="";
- int line=0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zz", &arg1, &arg2) == FAILURE)
- return;
-
- if (SG(headers_sent)) {
- line = php_get_output_start_lineno(TSRMLS_C);
- file = php_get_output_start_filename(TSRMLS_C);
- }
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- zval_dtor(arg2);
- ZVAL_LONG(arg2, line);
- case 1:
- zval_dtor(arg1);
- if (file) {
- ZVAL_STRING(arg1, file, 1);
- } else {
- ZVAL_STRING(arg1, "", 1);
- }
- break;
- }
-
- if (SG(headers_sent)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4 * End:
- */
diff --git a/ext/standard/head.h b/ext/standard/head.h
deleted file mode 100644
index 9f37d25f9e..0000000000
--- a/ext/standard/head.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef HEAD_H
-#define HEAD_H
-
-extern PHP_RINIT_FUNCTION(head);
-PHP_FUNCTION(header);
-PHP_FUNCTION(setcookie);
-PHP_FUNCTION(headers_sent);
-
-PHPAPI int php_header(TSRMLS_D);
-PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, time_t expires, char *path, int path_len, char *domain, int domain_len, int secure TSRMLS_DC);
-
-#endif
diff --git a/ext/standard/html.c b/ext/standard/html.c
deleted file mode 100644
index f9c3984b12..0000000000
--- a/ext/standard/html.c
+++ /dev/null
@@ -1,1197 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Jaakko Hyvätti <jaakko.hyvatti@iki.fi> |
- | Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- * HTML entity resources:
- *
- * http://msdn.microsoft.com/workshop/author/dhtml/reference/charsets/charset2.asp
- * http://msdn.microsoft.com/workshop/author/dhtml/reference/charsets/charset3.asp
- * http://www.unicode.org/Public/MAPPINGS/OBSOLETE/UNI2SGML.TXT
- *
- */
-
-#include "php.h"
-#if PHP_WIN32
-#include "config.w32.h"
-#elif defined NETWARE
-#include "config.nw.h"
-#else
-#include "php_config.h"
-#endif
-#include "reg.h"
-#include "html.h"
-#include "php_string.h"
-#include "SAPI.h"
-#if HAVE_LOCALE_H
-#include <locale.h>
-#endif
-#if HAVE_LANGINFO_H
-#include <langinfo.h>
-#endif
-
-#if HAVE_MBSTRING
-# include "ext/mbstring/mbstring.h"
-ZEND_EXTERN_MODULE_GLOBALS(mbstring)
-#endif
-
-enum entity_charset { cs_terminator, cs_8859_1, cs_cp1252,
- cs_8859_15, cs_utf_8, cs_big5, cs_gb2312,
- cs_big5hkscs, cs_sjis, cs_eucjp, cs_koi8r,
- cs_cp1251, cs_8859_5, cs_cp866
- };
-typedef const char *entity_table_t;
-
-/* codepage 1252 is a Windows extension to iso-8859-1. */
-static entity_table_t ent_cp_1252[] = {
- "euro", NULL, "sbquo", "fnof", "bdquo", "hellip", "dagger",
- "Dagger", "circ", "permil", "Scaron", "lsaquo", "OElig",
- NULL, NULL, NULL, NULL, "lsquo", "rsquo", "ldquo", "rdquo",
- "bull", "ndash", "mdash", "tilde", "trade", "scaron", "rsaquo",
- "oelig", NULL, NULL, "Yuml"
-};
-
-static entity_table_t ent_iso_8859_1[] = {
- "nbsp", "iexcl", "cent", "pound", "curren", "yen", "brvbar",
- "sect", "uml", "copy", "ordf", "laquo", "not", "shy", "reg",
- "macr", "deg", "plusmn", "sup2", "sup3", "acute", "micro",
- "para", "middot", "cedil", "sup1", "ordm", "raquo", "frac14",
- "frac12", "frac34", "iquest", "Agrave", "Aacute", "Acirc",
- "Atilde", "Auml", "Aring", "AElig", "Ccedil", "Egrave",
- "Eacute", "Ecirc", "Euml", "Igrave", "Iacute", "Icirc",
- "Iuml", "ETH", "Ntilde", "Ograve", "Oacute", "Ocirc", "Otilde",
- "Ouml", "times", "Oslash", "Ugrave", "Uacute", "Ucirc", "Uuml",
- "Yacute", "THORN", "szlig", "agrave", "aacute", "acirc",
- "atilde", "auml", "aring", "aelig", "ccedil", "egrave",
- "eacute", "ecirc", "euml", "igrave", "iacute", "icirc",
- "iuml", "eth", "ntilde", "ograve", "oacute", "ocirc", "otilde",
- "ouml", "divide", "oslash", "ugrave", "uacute", "ucirc",
- "uuml", "yacute", "thorn", "yuml"
-};
-
-static entity_table_t ent_iso_8859_15[] = {
- "nbsp", "iexcl", "cent", "pound", "euro", "yen", "Scaron",
- "sect", "scaron", "copy", "ordf", "laquo", "not", "shy", "reg",
- "macr", "deg", "plusmn", "sup2", "sup3", NULL, /* Zcaron */
- "micro", "para", "middot", NULL, /* zcaron */ "sup1", "ordm",
- "raquo", "OElig", "oelig", "Yuml", "iquest", "Agrave", "Aacute",
- "Acirc", "Atilde", "Auml", "Aring", "AElig", "Ccedil", "Egrave",
- "Eacute", "Ecirc", "Euml", "Igrave", "Iacute", "Icirc",
- "Iuml", "ETH", "Ntilde", "Ograve", "Oacute", "Ocirc", "Otilde",
- "Ouml", "times", "Oslash", "Ugrave", "Uacute", "Ucirc", "Uuml",
- "Yacute", "THORN", "szlig", "agrave", "aacute", "acirc",
- "atilde", "auml", "aring", "aelig", "ccedil", "egrave",
- "eacute", "ecirc", "euml", "igrave", "iacute", "icirc",
- "iuml", "eth", "ntilde", "ograve", "oacute", "ocirc", "otilde",
- "ouml", "divide", "oslash", "ugrave", "uacute", "ucirc",
- "uuml", "yacute", "thorn", "yuml"
-};
-
-static entity_table_t ent_uni_338_402[] = {
- /* 338 */
- "OElig", "oelig", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- /* 352 */
- "Scaron", "scaron",
- /* 354 - 375 */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* 376 */
- "Yuml",
- /* 377 - 401 */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* 402 */
- "fnof"
-};
-
-static entity_table_t ent_uni_spacing[] = {
- /* 710 */
- "circ",
- /* 711 - 731 */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* 732 */
- "tilde",
-};
-
-static entity_table_t ent_uni_greek[] = {
- /* 913 */
- "Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta", "Eta", "Theta",
- "Iota", "Kappa", "Lambda", "Mu", "Nu", "X1", "Omicron", "P1", "Rho",
- NULL, "Sigma", "Tau", "Upsilon", "Ph1", "Ch1", "Ps1", "Omega",
- /* 938 - 944 are not mapped */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- "alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta",
- "iota", "kappa", "lambda", "mu", "nu", "x1", "omicron", "p1", "rho",
- "sigmaf", "sigma", "tau", "upsilon", "ph1", "ch1", "ps1", "omega",
- /* 970 - 976 are not mapped */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- "thetasym", "ups1h",
- NULL, NULL, NULL,
- "p1v"
-};
-
-static entity_table_t ent_uni_punct[] = {
- /* 8194 */
- "ensp", "emsp", NULL, NULL, NULL, NULL, NULL,
- "thinsp", NULL, NULL, "zwnj", "zwj", "lrm", "rlm",
- NULL, NULL, NULL, "ndash", "mdash", NULL, NULL, NULL,
- "lsquo", "rsquo", "sbquo", NULL, "ldquo", "rdquo", "bdquo",
- "dagger", "Dagger", "bull", NULL, NULL, NULL, "hellip",
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "permil", NULL,
- "prime", "Prime", NULL, NULL, NULL, NULL, NULL, "lsaquo", "rsaquo",
- NULL, NULL, NULL, "oline", NULL, NULL, NULL, NULL, NULL,
- "frasl"
-};
-
-static entity_table_t ent_uni_euro[] = {
- "euro"
-};
-
-static entity_table_t ent_uni_8465_8501[] = {
- /* 8465 */
- "image", NULL, NULL, NULL, NULL, NULL, NULL,
- /* 8472 */
- "weierp", NULL, NULL, NULL,
- /* 8476 */
- "real", NULL, NULL, NULL, NULL, NULL,
- /* 8482 */
- "trade", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* 8501 */
- "alefsym",
-};
-
-static entity_table_t ent_uni_8592_9002[] = {
- /* 8592 (0x2190) */
- "larr", "uarr", "rarr", "darr", "harr", NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* 8608 (0x21a0) */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* 8624 (0x21b0) */
- NULL, NULL, NULL, NULL, "crarr", NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* 8640 (0x21c0) */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* 8656 (0x21d0) */
- "lArr", "uArr", "rArr", "dArr", "hArr", "vArr", NULL, NULL,
- NULL, NULL, "lAarr", "rAarr", NULL, "rarrw", NULL, NULL,
- /* 8672 (0x21e0) */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* 8704 (0x2200) */
- "forall", "comp", "part", "exist", "nexist", "empty", NULL, "nabla",
- "isin", "notin", "epsis", NULL, "ni", "bepsi", NULL, "prod",
- /* 8720 (0x2210) */
- "coprod", "sum", "minus", "mnplus", "plusdo", NULL, "setmn", NULL,
- "compfn", NULL, "radic", NULL, NULL, "prop", "infin", "ang90",
- /* 8736 (0x2220) */
- "ang", "angmsd", "angsph", "mid", "nmid", "par", "npar", "and",
- "or", "cap", "cup", "int", NULL, NULL, "conint", NULL,
- /* 8752 (0x2230) */
- NULL, NULL, NULL, NULL, "there4", "becaus", NULL, NULL,
- NULL, NULL, NULL, NULL, "sim", "bsim", NULL, NULL,
- /* 8768 (0x2240) */
- "wreath", "nsim", NULL, "sime", "nsime", "cong", NULL, "ncong",
- "ap", "nap", "ape", NULL, "bcong", "asymp", "bump", "bumpe",
- /* 8784 (0x2250) */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* 8800 (0x2260) */
- "ne", "equiv", NULL, NULL, "le", "ge", "lE", "gE",
- "lnE", "gnE", "Lt", "Gt", "twixt", NULL, "nlt", "ngt",
- /* 8816 (0x2270) */
- "nles", "nges", "lsim", "gsim", NULL, NULL, "lg", "gl",
- NULL, NULL, "pr", "sc", "cupre", "sscue", "prsim", "scsim",
- /* 8832 (0x2280) */
- "npr", "nsc", "sub", "sup", "nsub", "nsup", "sube", "supe",
- /* 8840 - 8852 */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* 8853 */
- "oplus", NULL, "otimes",
- /* 8856 - 8868 */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* 8869 */
- "perp",
- /* 8870 - 8901 */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL,
- /* 8901 */
- "sdot",
- /* 8902 - 8967 */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL,
- /* 8968 */
- "lceil", "rceil", "lfloor", "rfloor",
- /* 8969 - 9000 */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL,
- /* 9001 */
- "lang", "rang",
-};
-
-static entity_table_t ent_uni_9674[] = {
- /* 9674 */
- "loz"
-};
-
-static entity_table_t ent_uni_9824_9830[] = {
- /* 9824 */
- "spades", NULL, NULL, "clubs", NULL, "hearts", "diams"
-};
-
-static entity_table_t ent_koi8r[] = {
- "#1105", /* "jo "*/
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, "#1025", /* "JO" */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- "#1102", "#1072", "#1073", "#1094", "#1076", "#1077", "#1092",
- "#1075", "#1093", "#1080", "#1081", "#1082", "#1083", "#1084",
- "#1085", "#1086", "#1087", "#1103", "#1088", "#1089", "#1090",
- "#1091", "#1078", "#1074", "#1100", "#1099", "#1079", "#1096",
- "#1101", "#1097", "#1095", "#1098", "#1070", "#1040", "#1041",
- "#1062", "#1044", "#1045", "#1060", "#1043", "#1061", "#1048",
- "#1049", "#1050", "#1051", "#1052", "#1053", "#1054", "#1055",
- "#1071", "#1056", "#1057", "#1058", "#1059", "#1046", "#1042",
- "#1068", "#1067", "#1047", "#1064", "#1069", "#1065", "#1063",
- "#1066"
-};
-
-static entity_table_t ent_cp_1251[] = {
- "#1026", "#1027", "#8218", "#1107", "#8222", "hellip", "dagger",
- "Dagger", "euro", "permil", "#1033", "#8249", "#1034", "#1036",
- "#1035", "#1039", "#1106", "#8216", "#8217", "#8219", "#8220",
- "bull", "ndash", "mdash", NULL, "trade", "#1113", "#8250",
- "#1114", "#1116", "#1115", "#1119", "nbsp", "#1038", "#1118",
- "#1032", "curren", "#1168", "brvbar", "sect", "#1025", "copy",
- "#1028", "laquo", "not", "shy", "reg", "#1031", "deg", "plusmn",
- "#1030", "#1110", "#1169", "micro", "para", "middot", "#1105",
- "#8470", "#1108", "raquo", "#1112", "#1029", "#1109", "#1111",
- "#1040", "#1041", "#1042", "#1043", "#1044", "#1045", "#1046",
- "#1047", "#1048", "#1049", "#1050", "#1051", "#1052", "#1053",
- "#1054", "#1055", "#1056", "#1057", "#1058", "#1059", "#1060",
- "#1061", "#1062", "#1063", "#1064", "#1065", "#1066", "#1067",
- "#1068", "#1069", "#1070", "#1071", "#1072", "#1073", "#1074",
- "#1075", "#1076", "#1077", "#1078", "#1079", "#1080", "#1081",
- "#1082", "#1083", "#1084", "#1085", "#1086", "#1087", "#1088",
- "#1089", "#1090", "#1091", "#1092", "#1093", "#1094", "#1095",
- "#1096", "#1097", "#1098", "#1099", "#1100", "#1101", "#1102",
- "#1103"
-};
-
-static entity_table_t ent_iso_8859_5[] = {
- "#1056", "#1057", "#1058", "#1059", "#1060", "#1061", "#1062",
- "#1063", "#1064", "#1065", "#1066", "#1067", "#1068", "#1069",
- "#1070", "#1071", "#1072", "#1073", "#1074", "#1075", "#1076",
- "#1077", "#1078", "#1079", "#1080", "#1081", "#1082", "#1083",
- "#1084", "#1085", "#1086", "#1087", "#1088", "#1089", "#1090",
- "#1091", "#1092", "#1093", "#1094", "#1095", "#1096", "#1097",
- "#1098", "#1099", "#1100", "#1101", "#1102", "#1103", "#1104",
- "#1105", "#1106", "#1107", "#1108", "#1109", "#1110", "#1111",
- "#1112", "#1113", "#1114", "#1115", "#1116", "#1117", "#1118",
- "#1119"
-};
-
-static entity_table_t ent_cp_866[] = {
-
- "#9492", "#9524", "#9516", "#9500", "#9472", "#9532", "#9566",
- "#9567", "#9562", "#9556", "#9577", "#9574", "#9568", "#9552",
- "#9580", "#9575", "#9576", "#9572", "#9573", "#9561", "#9560",
- "#9554", "#9555", "#9579", "#9578", "#9496", "#9484", "#9608",
- "#9604", "#9612", "#9616", "#9600", "#1088", "#1089", "#1090",
- "#1091", "#1092", "#1093", "#1094", "#1095", "#1096", "#1097",
- "#1098", "#1099", "#1100", "#1101", "#1102", "#1103", "#1025",
- "#1105", "#1028", "#1108", "#1031", "#1111", "#1038", "#1118",
- "#176", "#8729", "#183", "#8730", "#8470", "#164", "#9632",
- "#160"
-};
-
-
-struct html_entity_map {
- enum entity_charset charset; /* charset identifier */
- unsigned short basechar; /* char code at start of table */
- unsigned short endchar; /* last char code in the table */
- entity_table_t *table; /* the table of mappings */
-};
-
-static const struct html_entity_map entity_map[] = {
- { cs_cp1252, 0x80, 0x9f, ent_cp_1252 },
- { cs_cp1252, 0xa0, 0xff, ent_iso_8859_1 },
- { cs_8859_1, 0xa0, 0xff, ent_iso_8859_1 },
- { cs_8859_15, 0xa0, 0xff, ent_iso_8859_15 },
- { cs_utf_8, 0xa0, 0xff, ent_iso_8859_1 },
- { cs_utf_8, 338, 402, ent_uni_338_402 },
- { cs_utf_8, 710, 732, ent_uni_spacing },
- { cs_utf_8, 913, 982, ent_uni_greek },
- { cs_utf_8, 8194, 8260, ent_uni_punct },
- { cs_utf_8, 8364, 8364, ent_uni_euro },
- { cs_utf_8, 8465, 8501, ent_uni_8465_8501 },
- { cs_utf_8, 8592, 9002, ent_uni_8592_9002 },
- { cs_utf_8, 9674, 9674, ent_uni_9674 },
- { cs_utf_8, 9824, 9830, ent_uni_9824_9830 },
- { cs_big5, 0xa0, 0xff, ent_iso_8859_1 },
- { cs_gb2312, 0xa0, 0xff, ent_iso_8859_1 },
- { cs_big5hkscs, 0xa0, 0xff, ent_iso_8859_1 },
- { cs_sjis, 0xa0, 0xff, ent_iso_8859_1 },
- { cs_eucjp, 0xa0, 0xff, ent_iso_8859_1 },
- { cs_koi8r, 0xa3, 0xff, ent_koi8r },
- { cs_cp1251, 0x80, 0xff, ent_cp_1251 },
- { cs_8859_5, 0xc0, 0xff, ent_iso_8859_5 },
- { cs_cp866, 0xc0, 0xff, ent_cp_866 },
- { cs_terminator }
-};
-
-static const struct {
- const char *codeset;
- enum entity_charset charset;
-} charset_map[] = {
- { "ISO-8859-1", cs_8859_1 },
- { "ISO8859-1", cs_8859_1 },
- { "ISO-8859-15", cs_8859_15 },
- { "ISO8859-15", cs_8859_15 },
- { "utf-8", cs_utf_8 },
- { "cp1252", cs_cp1252 },
- { "Windows-1252", cs_cp1252 },
- { "1252", cs_cp1252 },
- { "BIG5", cs_big5 },
- { "950", cs_big5 },
- { "GB2312", cs_gb2312 },
- { "936", cs_gb2312 },
- { "BIG5-HKSCS", cs_big5hkscs },
- { "Shift_JIS", cs_sjis },
- { "SJIS", cs_sjis },
- { "932", cs_sjis },
- { "EUCJP", cs_eucjp },
- { "EUC-JP", cs_eucjp },
- { "KOI8-R", cs_koi8r },
- { "koi8-ru", cs_koi8r },
- { "koi8r", cs_koi8r },
- { "cp1251", cs_cp1251 },
- { "Windows-1251", cs_cp1251 },
- { "win-1251", cs_cp1251 },
- { "iso8859-5", cs_8859_5 },
- { "iso-8859-5", cs_8859_5 },
- { "cp866", cs_cp866 },
- { "866", cs_cp866 },
- { "ibm866", cs_cp866 },
- { NULL }
-};
-
-static const struct {
- unsigned short charcode;
- char *entity;
- int entitylen;
- int flags;
-} basic_entities[] = {
- { '&', "&amp;", 5, 0 },
- { '"', "&quot;", 6, ENT_HTML_QUOTE_DOUBLE },
- { '\'', "&#039;", 6, ENT_HTML_QUOTE_SINGLE },
- { '\'', "&#39;", 5, ENT_HTML_QUOTE_SINGLE },
- { '<', "&lt;", 4, 0 },
- { '>', "&gt;", 4, 0 },
- { 0, NULL, 0, 0 }
-};
-
-#define MB_RETURN { \
- *newpos = pos; \
- mbseq[mbpos] = '\0'; \
- *mbseqlen = mbpos; \
- return this_char; }
-
-#define MB_WRITE(mbchar) { \
- mbspace--; \
- if (mbspace == 0) { \
- MB_RETURN; \
- } \
- mbseq[mbpos++] = (mbchar); }
-
-/* {{{ get_next_char
- */
-inline static unsigned short get_next_char(enum entity_charset charset,
- unsigned char * str,
- int * newpos,
- unsigned char * mbseq,
- int * mbseqlen)
-{
- int pos = *newpos;
- int mbpos = 0;
- int mbspace = *mbseqlen;
- unsigned short this_char = str[pos++];
-
- if (mbspace <= 0) {
- *mbseqlen = 0;
- return this_char;
- }
-
- MB_WRITE((unsigned char)this_char);
-
- switch (charset) {
- case cs_utf_8:
- {
- unsigned long utf = 0;
- int stat = 0;
- int more = 1;
-
- /* unpack utf-8 encoding into a wide char.
- * Code stolen from the mbstring extension */
-
- do {
- if (this_char < 0x80) {
- more = 0;
- break;
- } else if (this_char < 0xc0) {
- switch (stat) {
- case 0x10: /* 2, 2nd */
- case 0x21: /* 3, 3rd */
- case 0x32: /* 4, 4th */
- case 0x43: /* 5, 5th */
- case 0x54: /* 6, 6th */
- /* last byte in sequence */
- more = 0;
- utf |= (this_char & 0x3f);
- this_char = (unsigned short)utf;
- break;
- case 0x20: /* 3, 2nd */
- case 0x31: /* 4, 3rd */
- case 0x42: /* 5, 4th */
- case 0x53: /* 6, 5th */
- /* penultimate char */
- utf |= ((this_char & 0x3f) << 6);
- stat++;
- break;
- case 0x30: /* 4, 2nd */
- case 0x41: /* 5, 3rd */
- case 0x52: /* 6, 4th */
- utf |= ((this_char & 0x3f) << 12);
- stat++;
- break;
- case 0x40: /* 5, 2nd */
- case 0x51:
- utf |= ((this_char & 0x3f) << 18);
- stat++;
- break;
- case 0x50: /* 6, 2nd */
- utf |= ((this_char & 0x3f) << 24);
- stat++;
- default:
- /* invalid */
- more = 0;
- }
- }
- /* lead byte */
- else if (this_char < 0xe0) {
- stat = 0x10; /* 2 byte */
- utf = (this_char & 0x1f) << 6;
- } else if (this_char < 0xf0) {
- stat = 0x20; /* 3 byte */
- utf = (this_char & 0xf) << 12;
- } else if (this_char < 0xf8) {
- stat = 0x30; /* 4 byte */
- utf = (this_char & 0x7) << 18;
- } else if (this_char < 0xfc) {
- stat = 0x40; /* 5 byte */
- utf = (this_char & 0x3) << 24;
- } else if (this_char < 0xfe) {
- stat = 0x50; /* 6 byte */
- utf = (this_char & 0x1) << 30;
- } else {
- /* invalid; bail */
- more = 0;
- break;
- }
-
- if (more) {
- this_char = str[pos++];
- MB_WRITE((unsigned char)this_char);
- }
- } while (more);
- }
- break;
- case cs_big5:
- case cs_gb2312:
- case cs_big5hkscs:
- {
- /* check if this is the first of a 2-byte sequence */
- if (this_char >= 0xa1 && this_char <= 0xf9) {
- /* peek at the next char */
- unsigned char next_char = str[pos];
- if ((next_char >= 0x40 && next_char <= 0x73) ||
- (next_char >= 0xa1 && next_char <= 0xfe)) {
- /* yes, this a wide char */
- this_char <<= 8;
- MB_WRITE(next_char);
- this_char |= next_char;
- pos++;
- }
-
- }
- break;
- }
- case cs_sjis:
- {
- /* check if this is the first of a 2-byte sequence */
- if ( (this_char >= 0x81 && this_char <= 0x9f) ||
- (this_char >= 0xe0 && this_char <= 0xef)
- ) {
- /* peek at the next char */
- unsigned char next_char = str[pos];
- if ((next_char >= 0x40 && next_char <= 0x7e) ||
- (next_char >= 0x80 && next_char <= 0xfc))
- {
- /* yes, this a wide char */
- this_char <<= 8;
- MB_WRITE(next_char);
- this_char |= next_char;
- pos++;
- }
-
- }
- break;
- }
- case cs_eucjp:
- {
- /* check if this is the first of a multi-byte sequence */
- if (this_char >= 0xa1 && this_char <= 0xfe) {
- /* peek at the next char */
- unsigned char next_char = str[pos];
- if (next_char >= 0xa1 && next_char <= 0xfe) {
- /* yes, this a jis kanji char */
- this_char <<= 8;
- MB_WRITE(next_char);
- this_char |= next_char;
- pos++;
- }
-
- } else if (this_char == 0x8e) {
- /* peek at the next char */
- unsigned char next_char = str[pos];
- if (next_char >= 0xa1 && next_char <= 0xdf) {
- /* JIS X 0201 kana */
- this_char <<= 8;
- MB_WRITE(next_char);
- this_char |= next_char;
- pos++;
- }
-
- } else if (this_char == 0x8f) {
- /* peek at the next two char */
- unsigned char next_char = str[pos];
- unsigned char next2_char = str[pos+1];
- if ((next_char >= 0xa1 && next_char <= 0xfe) &&
- (next2_char >= 0xa1 && next2_char <= 0xfe)) {
- /* JIS X 0212 hojo-kanji */
- this_char <<= 8;
- MB_WRITE(next_char);
- this_char |= next_char;
- pos++;
- this_char <<= 8;
- MB_WRITE(next2_char);
- this_char |= next2_char;
- pos++;
- }
-
- }
- break;
- }
- default:
- break;
- }
- MB_RETURN;
-}
-/* }}} */
-
-/* {{{ entity_charset determine_charset
- * returns the charset identifier based on current locale or a hint.
- * defaults to iso-8859-1 */
-static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC)
-{
- int i;
- enum entity_charset charset = cs_8859_1;
- int len = 0;
- zval *uf_result = NULL;
-
- /* Guarantee default behaviour for backwards compatibility */
- if (charset_hint == NULL)
- return cs_8859_1;
-
- if ((len = strlen(charset_hint)) != 0) {
- goto det_charset;
- }
-#if HAVE_MBSTRING
-#if !defined(COMPILE_DL_MBSTRING)
- /* XXX: Ugly things. Why don't we look for a more sophisticated way? */
- switch (MBSTRG(current_internal_encoding)) {
- case mbfl_no_encoding_8859_1:
- return cs_8859_1;
-
- case mbfl_no_encoding_utf8:
- return cs_utf_8;
-
- case mbfl_no_encoding_euc_jp:
- case mbfl_no_encoding_eucjp_win:
- return cs_eucjp;
-
- case mbfl_no_encoding_sjis:
- case mbfl_no_encoding_sjis_win:
- case mbfl_no_encoding_sjis_mac:
- return cs_sjis;
-
- case mbfl_no_encoding_cp1252:
- return cs_cp1252;
-
- case mbfl_no_encoding_8859_15:
- return cs_8859_15;
-
- case mbfl_no_encoding_big5:
- return cs_big5;
-
- case mbfl_no_encoding_euc_cn:
- case mbfl_no_encoding_hz:
- case mbfl_no_encoding_cp936:
- return cs_gb2312;
-
- case mbfl_no_encoding_koi8r:
- return cs_koi8r;
-
- case mbfl_no_encoding_cp866:
- return cs_cp866;
-
- case mbfl_no_encoding_cp1251:
- return cs_cp1251;
-
- case mbfl_no_encoding_8859_5:
- return cs_8859_5;
-
- default:
- ;
- }
-#else
- {
- zval nm_mb_internal_encoding;
-
- ZVAL_STRING(&nm_mb_internal_encoding, "mb_internal_encoding", 0);
-
- if (call_user_function_ex(CG(function_table), NULL, &nm_mb_internal_encoding, &uf_result, 0, NULL, 1, NULL TSRMLS_CC) != FAILURE) {
-
- charset_hint = Z_STRVAL_P(uf_result);
- len = Z_STRLEN_P(uf_result);
-
- goto det_charset;
- }
- }
-#endif
-#endif
-
- charset_hint = SG(default_charset);
- if (charset_hint != NULL && (len=strlen(charset_hint)) != 0) {
- goto det_charset;
- }
-
- /* try to detect the charset for the locale */
-#if HAVE_NL_LANGINFO && HAVE_LOCALE_H && defined(CODESET)
- charset_hint = nl_langinfo(CODESET);
- if (charset_hint != NULL && (len=strlen(charset_hint)) != 0) {
- goto det_charset;
- }
-#endif
-
-#if HAVE_LOCALE_H
- /* try to figure out the charset from the locale */
- {
- char *localename;
- char *dot, *at;
-
- /* lang[_territory][.codeset][@modifier] */
- localename = setlocale(LC_CTYPE, NULL);
-
- dot = strchr(localename, '.');
- if (dot) {
- dot++;
- /* locale specifies a codeset */
- at = strchr(dot, '@');
- if (at)
- len = at - dot;
- else
- len = strlen(dot);
- charset_hint = dot;
- } else {
- /* no explicit name; see if the name itself
- * is the charset */
- charset_hint = localename;
- len = strlen(charset_hint);
- }
- }
-#endif
-
-det_charset:
-
- if (charset_hint) {
- int found = 0;
-
- /* now walk the charset map and look for the codeset */
- for (i = 0; charset_map[i].codeset; i++) {
- if (strncasecmp(charset_hint, charset_map[i].codeset, len) == 0) {
- charset = charset_map[i].charset;
- found = 1;
- break;
- }
- }
- if (!found) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "charset `%s' not supported, assuming iso-8859-1",
- charset_hint);
- }
- }
- if (uf_result != NULL) {
- zval_ptr_dtor(&uf_result);
- }
- return charset;
-}
-/* }}} */
-
-/* {{{ php_utf32_utf8 */
-size_t php_utf32_utf8(unsigned char *buf, int k)
-{
- size_t retval = 0;
-
- if (k < 0x80) {
- buf[0] = k;
- retval = 1;
- } else if (k < 0x800) {
- buf[0] = 0xc0 | (k >> 6);
- buf[1] = 0x80 | (k & 0x3f);
- retval = 2;
- } else if (k < 0x10000) {
- buf[0] = 0xe0 | (k >> 12);
- buf[1] = 0x80 | ((k >> 6) & 0x3f);
- buf[2] = 0x80 | (k & 0x3f);
- retval = 3;
- } else if (k < 0x200000) {
- buf[0] = 0xf0 | (k >> 18);
- buf[1] = 0x80 | ((k >> 12) & 0x3f);
- buf[2] = 0x80 | ((k >> 6) & 0x3f);
- buf[3] = 0x80 | (k & 0x3f);
- retval = 4;
- } else if (k < 0x4000000) {
- buf[0] = 0xf8 | (k >> 24);
- buf[1] = 0x80 | ((k >> 18) & 0x3f);
- buf[2] = 0x80 | ((k >> 12) & 0x3f);
- buf[3] = 0x80 | ((k >> 6) & 0x3f);
- buf[4] = 0x80 | (k & 0x3f);
- retval = 5;
- } else {
- buf[0] = 0xfc | (k >> 30);
- buf[1] = 0x80 | ((k >> 24) & 0x3f);
- buf[2] = 0x80 | ((k >> 18) & 0x3f);
- buf[3] = 0x80 | ((k >> 12) & 0x3f);
- buf[4] = 0x80 | ((k >> 6) & 0x3f);
- buf[5] = 0x80 | (k & 0x3f);
- retval = 6;
- }
- buf[retval] = '\0';
-
- return retval;
-}
-/* }}} */
-
-/* {{{ php_unescape_html_entities
- */
-PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_charset TSRMLS_DC)
-{
- int retlen;
- int j, k;
- char *replaced, *ret, *p, *q, *lim, *next;
- enum entity_charset charset = determine_charset(hint_charset TSRMLS_CC);
- unsigned char replacement[15];
- int replacement_len;
-
- ret = estrdup(old);
- retlen = oldlen;
- if (!retlen) {
- goto empty_source;
- }
-
- if (all) {
- /* look for a match in the maps for this charset */
- for (j = 0; entity_map[j].charset != cs_terminator; j++) {
- if (entity_map[j].charset != charset)
- continue;
-
- for (k = entity_map[j].basechar; k <= entity_map[j].endchar; k++) {
- unsigned char entity[32];
- int entity_length = 0;
-
- if (entity_map[j].table[k - entity_map[j].basechar] == NULL)
- continue;
-
-
- entity[0] = '&';
- entity_length = strlen(entity_map[j].table[k - entity_map[j].basechar]);
- strncpy(&entity[1], entity_map[j].table[k - entity_map[j].basechar], sizeof(entity) - 2);
- entity[entity_length+1] = ';';
- entity[entity_length+2] = '\0';
- entity_length += 2;
-
- /* When we have MBCS entities in the tables above, this will need to handle it */
- replacement_len = 0;
- switch (charset) {
- case cs_8859_1:
- case cs_cp1252:
- case cs_8859_15:
- case cs_cp1251:
- case cs_8859_5:
- case cs_cp866:
- replacement[0] = k;
- replacement[1] = '\0';
- replacement_len = 1;
- break;
-
- case cs_big5:
- case cs_gb2312:
- case cs_big5hkscs:
- case cs_sjis:
- case cs_eucjp:
- /* we cannot properly handle those multibyte encodings
- * with php_str_to_str. skip it. */
- continue;
-
- case cs_utf_8:
- replacement_len = php_utf32_utf8(replacement, k);
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot yet handle MBCS!");
- return 0;
- }
-
- replaced = php_str_to_str(ret, retlen, entity, entity_length, replacement, replacement_len, &retlen);
- efree(ret);
- ret = replaced;
- }
- }
- }
-
- for (j = 0; basic_entities[j].charcode != 0; j++) {
-
- if (basic_entities[j].flags && (quote_style & basic_entities[j].flags) == 0)
- continue;
-
- replacement[0] = (unsigned char)basic_entities[j].charcode;
- replacement[1] = '\0';
-
- replaced = php_str_to_str(ret, retlen, basic_entities[j].entity, basic_entities[j].entitylen, replacement, 1, &retlen);
- efree(ret);
- ret = replaced;
- }
-
- /* replace numeric entities */
- lim = ret + retlen;
- for (p = ret, q = ret; p < lim; p++) {
- int code;
-
- if (p < lim - 1 && p[0] == '&' && p[1] == '#') {
- code = strtol(p + 2, &next, 10);
- if (next != NULL && *next == ';') {
- switch (charset) {
- case cs_utf_8:
- q += php_utf32_utf8(q, code);
- break;
-
- case cs_8859_1:
- case cs_8859_5:
- case cs_8859_15:
- if (0xa0 <= code && code <= 0xff) {
- *(q++) = code;
- }
- break;
-
- case cs_cp1252:
- case cs_cp1251:
- case cs_cp866:
- if (0x80 <= code && code <= 0xff) {
- *(q++) = code;
- }
- break;
-
- case cs_big5:
- case cs_gb2312:
- case cs_big5hkscs:
- case cs_sjis:
- case cs_eucjp:
- if (code <= 0x7f) {
- *(q++) = code;
- }
- break;
-
- default:
- break;
- }
- p = next;
- } else {
- *(q++) = *p;
- }
- } else {
- *(q++) = *p;
- }
- }
- *q = '\0';
- retlen = (size_t)(q - ret);
-empty_source:
- *newlen = retlen;
- return ret;
-}
-/* }}} */
-
-
-
-
-/* {{{ php_escape_html_entities
- */
-PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_charset TSRMLS_DC)
-{
- int i, j, maxlen, len;
- char *replaced;
- enum entity_charset charset = determine_charset(hint_charset TSRMLS_CC);
- int matches_map;
-
- maxlen = 2 * oldlen;
- if (maxlen < 128)
- maxlen = 128;
- replaced = emalloc (maxlen);
- len = 0;
-
- i = 0;
- while (i < oldlen) {
- unsigned char mbsequence[16]; /* allow up to 15 characters in a multibyte sequence */
- int mbseqlen = sizeof(mbsequence);
- unsigned short this_char = get_next_char(charset, old, &i, mbsequence, &mbseqlen);
-
- matches_map = 0;
-
- if (len + 9 > maxlen)
- replaced = erealloc (replaced, maxlen += 128);
-
- if (all) {
- /* look for a match in the maps for this charset */
- unsigned char *rep = NULL;
-
-
- for (j = 0; entity_map[j].charset != cs_terminator; j++) {
- if (entity_map[j].charset == charset
- && this_char >= entity_map[j].basechar
- && this_char <= entity_map[j].endchar) {
- rep = (unsigned char*)entity_map[j].table[this_char - entity_map[j].basechar];
- if (rep == NULL) {
- /* there is no entity for this position; fall through and
- * just output the character itself */
- break;
- }
-
- matches_map = 1;
- break;
- }
- }
-
- if (matches_map) {
- replaced[len++] = '&';
- strcpy(replaced + len, rep);
- len += strlen(rep);
- replaced[len++] = ';';
- }
- }
- if (!matches_map) {
- int is_basic = 0;
-
- for (j = 0; basic_entities[j].charcode != 0; j++) {
- if ((basic_entities[j].charcode != this_char) ||
- (basic_entities[j].flags && (quote_style & basic_entities[j].flags) == 0))
- continue;
-
- memcpy(replaced + len, basic_entities[j].entity, basic_entities[j].entitylen);
- len += basic_entities[j].entitylen;
-
- is_basic = 1;
- break;
-
- }
- if (!is_basic) {
- /* a wide char without a named entity; pass through the original sequence */
- if (mbseqlen > 1) {
- memcpy(replaced + len, mbsequence, mbseqlen);
- len += mbseqlen;
- } else {
- replaced[len++] = (unsigned char)this_char;
- }
- }
- }
- }
- replaced[len] = '\0';
- *newlen = len;
-
- return replaced;
-
-
-}
-/* }}} */
-
-/* {{{ php_html_entities
- */
-static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all)
-{
- char *str, *hint_charset = NULL;
- int str_len, hint_charset_len = 0;
- int len;
- long quote_style = ENT_COMPAT;
- char *replaced;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, &quote_style, &hint_charset, &hint_charset_len) == FAILURE) {
- return;
- }
-
- replaced = php_escape_html_entities(str, str_len, &len, all, quote_style, hint_charset TSRMLS_CC);
- RETVAL_STRINGL(replaced, len, 0);
-}
-/* }}} */
-
-#define HTML_SPECIALCHARS 0
-#define HTML_ENTITIES 1
-
-/* {{{ register_html_constants
- */
-void register_html_constants(INIT_FUNC_ARGS)
-{
- REGISTER_LONG_CONSTANT("HTML_SPECIALCHARS", HTML_SPECIALCHARS, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("HTML_ENTITIES", HTML_ENTITIES, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("ENT_COMPAT", ENT_COMPAT, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("ENT_QUOTES", ENT_QUOTES, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("ENT_NOQUOTES", ENT_NOQUOTES, CONST_PERSISTENT|CONST_CS);
-}
-/* }}} */
-
-/* {{{ proto string htmlspecialchars(string string [, int quote_style][, string charset])
- Convert special characters to HTML entities */
-PHP_FUNCTION(htmlspecialchars)
-{
- php_html_entities(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string html_entity_decode(string string [, int quote_style][, string charset])
- Convert all HTML entities to their applicable characters */
-PHP_FUNCTION(html_entity_decode)
-{
- char *str, *hint_charset = NULL;
- int str_len, hint_charset_len, len;
- long quote_style = ENT_COMPAT;
- char *replaced;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len,
- &quote_style, &hint_charset, &hint_charset_len) == FAILURE) {
- return;
- }
-
- replaced = php_unescape_html_entities(str, str_len, &len, 1, quote_style, hint_charset TSRMLS_CC);
- RETVAL_STRINGL(replaced, len, 0);
-}
-/* }}} */
-
-
-/* {{{ proto string htmlentities(string string [, int quote_style][, string charset])
- Convert all applicable characters to HTML entities */
-PHP_FUNCTION(htmlentities)
-{
- php_html_entities(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto array get_html_translation_table([int table [, int quote_style]])
- Returns the internal translation table used by htmlspecialchars and htmlentities */
-PHP_FUNCTION(get_html_translation_table)
-{
- long which = HTML_SPECIALCHARS, quote_style = ENT_COMPAT;
- int i, j;
- char ind[2];
- enum entity_charset charset = determine_charset(NULL TSRMLS_CC);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &which, &quote_style) == FAILURE) {
- return;
- }
-
- array_init(return_value);
-
- ind[1] = 0;
-
- switch (which) {
- case HTML_ENTITIES:
- for (j=0; entity_map[j].charset != cs_terminator; j++) {
- if (entity_map[j].charset != charset)
- continue;
- for (i = 0; i <= entity_map[j].endchar - entity_map[j].basechar; i++) {
- char buffer[16];
-
- if (entity_map[j].table[i] == NULL)
- continue;
- /* what about wide chars here ?? */
- ind[0] = i + entity_map[j].basechar;
- sprintf(buffer, "&%s;", entity_map[j].table[i]);
- add_assoc_string(return_value, ind, buffer, 1);
-
- }
- }
- /* break thru */
-
- case HTML_SPECIALCHARS:
- for (j = 0; basic_entities[j].charcode != 0; j++) {
-
- if (basic_entities[j].flags && (quote_style & basic_entities[j].flags) == 0)
- continue;
-
- ind[0] = (unsigned char)basic_entities[j].charcode;
- add_assoc_string(return_value, ind, basic_entities[j].entity, 1);
- }
- break;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/html.h b/ext/standard/html.h
deleted file mode 100644
index f47390e764..0000000000
--- a/ext/standard/html.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef HTML_H
-#define HTML_H
-
-#define ENT_HTML_QUOTE_NONE 0
-#define ENT_HTML_QUOTE_SINGLE 1
-#define ENT_HTML_QUOTE_DOUBLE 2
-
-#define ENT_COMPAT ENT_HTML_QUOTE_DOUBLE
-#define ENT_QUOTES (ENT_HTML_QUOTE_DOUBLE | ENT_HTML_QUOTE_SINGLE)
-#define ENT_NOQUOTES ENT_HTML_QUOTE_NONE
-
-void register_html_constants(INIT_FUNC_ARGS);
-
-PHP_FUNCTION(htmlspecialchars);
-PHP_FUNCTION(htmlentities);
-PHP_FUNCTION(html_entity_decode);
-PHP_FUNCTION(get_html_translation_table);
-
-PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_charset TSRMLS_DC);
-
-#endif /* HTML_H */
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
deleted file mode 100644
index 7c76c3ef82..0000000000
--- a/ext/standard/http_fopen_wrapper.c
+++ /dev/null
@@ -1,548 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Jim Winstead <jimw@php.net> |
- | Hartmut Holzgraefe <hholzgra@php.net> |
- | Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_streams.h"
-#include "php_network.h"
-#include "php_ini.h"
-#include "ext/standard/basic_functions.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#ifdef PHP_WIN32
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#elif defined(NETWARE)
-/*#include <ws2nlm.h>*/
-/*#include <sys/socket.h>*/
-#ifdef NEW_LIBC
-#include <sys/param.h>
-#else
-#include "netware/param.h"
-#endif
-#else
-#include <sys/param.h>
-#endif
-
-#include "php_standard.h"
-
-#include <sys/types.h>
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifdef PHP_WIN32
-#include <winsock2.h>
-#elif defined(NETWARE) && defined(USE_WINSOCK)
-/*#include <ws2nlm.h>*/
-#include <novsock2.h>
-#else
-#include <netinet/in.h>
-#include <netdb.h>
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif
-
-#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
-#undef AF_UNIX
-#endif
-
-#if defined(AF_UNIX)
-#include <sys/un.h>
-#endif
-
-#include "php_fopen_wrappers.h"
-
-#define HTTP_HEADER_BLOCK_SIZE 1024
-#define PHP_URL_REDIRECT_MAX 20
-#define HTTP_HEADER_USER_AGENT 1
-#define HTTP_HEADER_HOST 2
-#define HTTP_HEADER_AUTH 4
-#define HTTP_HEADER_FROM 8
-
-php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context, int redirect_max, int header_init STREAMS_DC TSRMLS_DC)
-{
- php_stream *stream = NULL;
- php_url *resource = NULL;
- int use_ssl;
- char *scratch = NULL;
- char *tmp = NULL;
- char *ua_str = NULL;
- zval **ua_zval = NULL, **tmpzval = NULL;
- int scratch_len = 0;
- int body = 0;
- char location[HTTP_HEADER_BLOCK_SIZE];
- zval **response_header = NULL;
- int reqok = 0;
- char *http_header_line = NULL;
- char tmp_line[128];
- size_t chunk_size = 0, file_size = 0;
- int eol_detect;
- char *transport_string, *errstr = NULL;
- int transport_len, have_header = 0;
-
- if (redirect_max < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Circular redirect, aborting.");
- return NULL;
- }
-
- if (strpbrk(mode, "awx+")) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP wrapper does not support writeable connections.");
- return NULL;
- }
-
- resource = php_url_parse(path);
- if (resource == NULL) {
- return NULL;
- }
-
- if (strncasecmp(resource->scheme, "http", sizeof("http")) && strncasecmp(resource->scheme, "https", sizeof("https"))) {
- php_url_free(resource);
- return php_stream_open_wrapper_ex(path, mode, ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
- }
-
- use_ssl = resource->scheme && (strlen(resource->scheme) > 4) && resource->scheme[4] == 's';
- /* choose default ports */
- if (use_ssl && resource->port == 0)
- resource->port = 443;
- else if (resource->port == 0)
- resource->port = 80;
-
- transport_len = spprintf(&transport_string, 0, "%s://%s:%d", use_ssl ? "ssl" : "tcp", resource->host, resource->port);
-
- stream = php_stream_xport_create(transport_string, transport_len, options,
- STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT,
- NULL, NULL, context, &errstr, NULL);
-
- if (errstr) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "%s", errstr);
- efree(errstr);
- errstr = NULL;
- }
-
- efree(transport_string);
-
- if (stream == NULL)
- goto out;
-
- /* avoid buffering issues while reading header */
- if (options & STREAM_WILL_CAST)
- chunk_size = php_stream_set_chunk_size(stream, 1);
-
- /* avoid problems with auto-detecting when reading the headers -> the headers
- * are always in canonical \r\n format */
- eol_detect = stream->flags & (PHP_STREAM_FLAG_DETECT_EOL | PHP_STREAM_FLAG_EOL_MAC);
- stream->flags &= ~(PHP_STREAM_FLAG_DETECT_EOL | PHP_STREAM_FLAG_EOL_MAC);
-
- php_stream_context_set(stream, context);
-
- php_stream_notify_info(context, PHP_STREAM_NOTIFY_CONNECT, NULL, 0);
-
- scratch_len = strlen(path) + 32;
- scratch = emalloc(scratch_len);
-
- if (context &&
- php_stream_context_get_option(context, "http", "method", &tmpzval) == SUCCESS &&
- Z_STRLEN_PP(tmpzval) > 0 &&
- strncasecmp(Z_STRVAL_PP(tmpzval), "POST", Z_STRLEN_PP(tmpzval)) == 0) {
- strcpy(scratch, "POST ");
- } else {
- strcpy(scratch, "GET ");
- }
-
- /* file */
- if (resource->path && *resource->path)
- strlcat(scratch, resource->path, scratch_len);
- else
- strlcat(scratch, "/", scratch_len);
-
- /* query string */
- if (resource->query) {
- strlcat(scratch, "?", scratch_len);
- strlcat(scratch, resource->query, scratch_len);
- }
-
- /* protocol version we are speaking */
- strlcat(scratch, " HTTP/1.0\r\n", scratch_len);
-
- /* send it */
- php_stream_write(stream, scratch, strlen(scratch));
-
- if (context &&
- php_stream_context_get_option(context, "http", "header", &tmpzval) == SUCCESS &&
- Z_STRLEN_PP(tmpzval)) {
- /* Remove newlines and spaces from start and end,
- php_trim will estrndup() */
- tmp = php_trim(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval), NULL, 0, NULL, 3 TSRMLS_CC);
- if (strlen(tmp) > 0) {
- /* Output trimmed headers with \r\n at the end */
- php_stream_write(stream, tmp, strlen(tmp));
- php_stream_write(stream, "\r\n", sizeof("\r\n") - 1);
-
- /* Make lowercase for easy comparison against 'standard' headers */
- php_strtolower(tmp, strlen(tmp));
- if (strstr(tmp, "user-agent:")) {
- have_header |= HTTP_HEADER_USER_AGENT;
- }
- if (strstr(tmp, "host:")) {
- have_header |= HTTP_HEADER_HOST;
- }
- if (strstr(tmp, "from:")) {
- have_header |= HTTP_HEADER_FROM;
- }
- if (strstr(tmp, "authorization:")) {
- have_header |= HTTP_HEADER_AUTH;
- }
- }
- efree(tmp);
- }
-
- /* auth header if it was specified */
- if (((have_header & HTTP_HEADER_AUTH) == 0) && resource->user && resource->pass) {
- /* decode the strings first */
- php_url_decode(resource->user, strlen(resource->user));
- php_url_decode(resource->pass, strlen(resource->pass));
-
- /* scratch is large enough, since it was made large enough for the whole URL */
- strcpy(scratch, resource->user);
- strcat(scratch, ":");
- strcat(scratch, resource->pass);
-
- tmp = php_base64_encode((unsigned char*)scratch, strlen(scratch), NULL);
-
- if (snprintf(scratch, scratch_len, "Authorization: Basic %s\r\n", tmp) > 0) {
- php_stream_write(stream, scratch, strlen(scratch));
- php_stream_notify_info(context, PHP_STREAM_NOTIFY_AUTH_REQUIRED, NULL, 0);
- }
-
- efree(tmp);
- tmp = NULL;
- }
-
- /* if the user has configured who they are, send a From: line */
- if (((have_header & HTTP_HEADER_FROM) == 0) && cfg_get_string("from", &tmp) == SUCCESS) {
- if (snprintf(scratch, scratch_len, "From: %s\r\n", tmp) > 0)
- php_stream_write(stream, scratch, strlen(scratch));
- }
-
- /* Send Host: header so name-based virtual hosts work */
- if ((have_header & HTTP_HEADER_HOST) == 0) {
- if ((use_ssl && resource->port != 443) || (!use_ssl && resource->port != 80)) {
- if (snprintf(scratch, scratch_len, "Host: %s:%i\r\n", resource->host, resource->port) > 0)
- php_stream_write(stream, scratch, strlen(scratch));
- } else {
- if (snprintf(scratch, scratch_len, "Host: %s\r\n", resource->host) > 0) {
- php_stream_write(stream, scratch, strlen(scratch));
- }
- }
- }
-
- if (context &&
- php_stream_context_get_option(context, "http", "user_agent", &ua_zval) == SUCCESS) {
- ua_str = Z_STRVAL_PP(ua_zval);
- } else if (FG(user_agent)) {
- ua_str = FG(user_agent);
- }
-
- if (((have_header & HTTP_HEADER_USER_AGENT) == 0) && ua_str) {
-#define _UA_HEADER "User-Agent: %s\r\n"
- char *ua;
- size_t ua_len;
-
- ua_len = sizeof(_UA_HEADER) + strlen(ua_str);
-
- /* ensure the header is only sent if user_agent is not blank */
- if (ua_len > sizeof(_UA_HEADER)) {
- ua = emalloc(ua_len + 1);
- if ((ua_len = snprintf(ua, ua_len, _UA_HEADER, ua_str)) > 0) {
- ua[ua_len] = 0;
- php_stream_write(stream, ua, ua_len);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot construct User-agent header");
- }
-
- if (ua) {
- efree(ua);
- }
- }
- }
-
- php_stream_write(stream, "\r\n", sizeof("\r\n")-1);
-
- /* Request content, such as for POST requests */
- if (context &&
- php_stream_context_get_option(context, "http", "content", &tmpzval) == SUCCESS &&
- Z_STRLEN_PP(tmpzval) > 0) {
- php_stream_write(stream, Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval));
- php_stream_write(stream, "\r\n\r\n", sizeof("\r\n\r\n")-1);
- }
-
- location[0] = '\0';
-
- if (!header_init && FAILURE == zend_hash_find(EG(active_symbol_table),
- "http_response_header", sizeof("http_response_header"), (void **) &response_header)) {
- header_init = 1;
- }
-
- if (header_init) {
- zval *tmp;
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
- ZEND_SET_SYMBOL(EG(active_symbol_table), "http_response_header", tmp);
-
- zend_hash_find(EG(active_symbol_table),
- "http_response_header", sizeof("http_response_header"), (void **) &response_header);
- }
-
-
- if (!php_stream_eof(stream)) {
- /* get response header */
-
- if (php_stream_gets(stream, tmp_line, sizeof(tmp_line)-1) != NULL) {
- zval *http_response;
- int response_code;
-
- MAKE_STD_ZVAL(http_response);
- ZVAL_NULL(http_response);
-
- response_code = atoi(tmp_line + 9);
- switch(response_code) {
- case 200:
- case 302:
- case 301:
- reqok = 1;
- break;
- case 403:
- php_stream_notify_error(context, PHP_STREAM_NOTIFY_AUTH_RESULT,
- tmp_line, response_code);
- break;
- default:
- php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE,
- tmp_line, response_code);
- }
-
- Z_STRLEN_P(http_response) = strlen(tmp_line);
- Z_STRVAL_P(http_response) = estrndup(tmp_line, Z_STRLEN_P(http_response));
- if (Z_STRVAL_P(http_response)[Z_STRLEN_P(http_response)-1]=='\n') {
- Z_STRVAL_P(http_response)[Z_STRLEN_P(http_response)-1]=0;
- Z_STRLEN_P(http_response)--;
- if (Z_STRVAL_P(http_response)[Z_STRLEN_P(http_response)-1]=='\r') {
- Z_STRVAL_P(http_response)[Z_STRLEN_P(http_response)-1]=0;
- Z_STRLEN_P(http_response)--;
- }
- }
- Z_TYPE_P(http_response) = IS_STRING;
- zend_hash_next_index_insert(Z_ARRVAL_PP(response_header), &http_response, sizeof(zval *), NULL);
- }
- }
-
- /* read past HTTP headers */
-
- http_header_line = emalloc(HTTP_HEADER_BLOCK_SIZE);
-
- while (!body && !php_stream_eof(stream)) {
-
- if (php_stream_gets(stream, http_header_line, HTTP_HEADER_BLOCK_SIZE-1) != NULL) {
- char *p;
- int found_eol = 0;
- int http_header_line_length;
-
- http_header_line[HTTP_HEADER_BLOCK_SIZE-1] = '\0';
-
- p = http_header_line;
- while(*p) {
- while(*p == '\n' || *p == '\r') {
- *p = '\0';
- p--;
- found_eol = 1;
- }
- if (found_eol)
- break;
- p++;
- }
- http_header_line_length = p-http_header_line+1;
-
- if (!strncasecmp(http_header_line, "Location: ", 10)) {
- strlcpy(location, http_header_line + 10, sizeof(location));
- } else if (!strncasecmp(http_header_line, "Content-Type: ", 14)) {
- php_stream_notify_info(context, PHP_STREAM_NOTIFY_MIME_TYPE_IS, http_header_line + 14, 0);
- } else if (!strncasecmp(http_header_line, "Content-Length: ", 16)) {
- file_size = atoi(http_header_line + 16);
- php_stream_notify_file_size(context, file_size, http_header_line, 0);
- }
-
- if (http_header_line[0] == '\0') {
- body = 1;
- } else {
- zval *http_header;
-
- MAKE_STD_ZVAL(http_header);
-
- ZVAL_STRINGL(http_header, http_header_line, http_header_line_length, 1);
-
- zend_hash_next_index_insert(Z_ARRVAL_PP(response_header), &http_header, sizeof(zval *), NULL);
- }
- } else {
- break;
- }
- }
-
- if (!reqok || location[0] != '\0') {
- if (location[0] != '\0')
- php_stream_notify_info(context, PHP_STREAM_NOTIFY_REDIRECTED, location, 0);
-
- php_stream_close(stream);
- stream = NULL;
-
- if (location[0] != '\0') {
-
- zval *entry, **entryp;
- char new_path[HTTP_HEADER_BLOCK_SIZE];
- char loc_path[HTTP_HEADER_BLOCK_SIZE];
-
- *new_path='\0';
- if (strlen(location)<8 || (strncasecmp(location, "http://", sizeof("http://")-1) &&
- strncasecmp(location, "https://", sizeof("https://")-1) &&
- strncasecmp(location, "ftp://", sizeof("ftp://")-1) &&
- strncasecmp(location, "ftps://", sizeof("ftps://")-1)))
- {
- if (*location != '/') {
- if (*(location+1) != '\0' && resource->path) {
- char *s = strrchr(resource->path, '/');
- if (!s) {
- s = resource->path;
- *s = '/';
- }
- s[1] = '\0';
- if (resource->path && *(resource->path) == '/' && *(resource->path + 1) == '\0') {
- snprintf(loc_path, sizeof(loc_path) - 1, "%s%s", resource->path, location);
- } else {
- snprintf(loc_path, sizeof(loc_path) - 1, "%s/%s", resource->path, location);
- }
- } else {
- snprintf(loc_path, sizeof(loc_path) - 1, "/%s", location);
- }
- } else {
- strlcpy(loc_path, location, sizeof(loc_path));
- }
- if ((use_ssl && resource->port != 443) || (!use_ssl && resource->port != 80)) {
- snprintf(new_path, sizeof(new_path) - 1, "%s://%s:%d%s", resource->scheme, resource->host, resource->port, loc_path);
- } else {
- snprintf(new_path, sizeof(new_path) - 1, "%s://%s%s", resource->scheme, resource->host, loc_path);
- }
- } else {
- strlcpy(new_path, location, sizeof(new_path));
- }
- stream = php_stream_url_wrap_http_ex(NULL, new_path, mode, options, opened_path, context, --redirect_max, 0 STREAMS_CC TSRMLS_CC);
- if (stream && stream->wrapperdata) {
- entryp = &entry;
- MAKE_STD_ZVAL(entry);
- ZVAL_EMPTY_STRING(entry);
- zend_hash_next_index_insert(Z_ARRVAL_PP(response_header), entryp, sizeof(zval *), NULL);
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream->wrapperdata));
- while (zend_hash_get_current_data(Z_ARRVAL_P(stream->wrapperdata), (void **)&entryp) == SUCCESS) {
- zval_add_ref(entryp);
- zend_hash_next_index_insert(Z_ARRVAL_PP(response_header), entryp, sizeof(zval *), NULL);
- zend_hash_move_forward(Z_ARRVAL_P(stream->wrapperdata));
- }
- zval_dtor(stream->wrapperdata);
- FREE_ZVAL(stream->wrapperdata);
- }
- } else {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP request failed! %s", tmp_line);
- }
- }
-out:
- if (http_header_line)
- efree(http_header_line);
- if (scratch)
- efree(scratch);
- php_url_free(resource);
-
- if (stream) {
- if (header_init) {
- stream->wrapperdata = *response_header;
- zval_add_ref(response_header);
- }
- php_stream_notify_progress_init(context, 0, file_size);
- /* Restore original chunk size now that we're done with headers */
- if (options & STREAM_WILL_CAST)
- php_stream_set_chunk_size(stream, chunk_size);
-
- /* restore the users auto-detect-line-endings setting */
- stream->flags |= eol_detect;
-
- /* as far as streams are concerned, we are now at the start of
- * the stream */
- stream->position = 0;
- }
-
- return stream;
-}
-
-php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
-{
- return php_stream_url_wrap_http_ex(wrapper, path, mode, options, opened_path, context, PHP_URL_REDIRECT_MAX, 1 STREAMS_CC TSRMLS_CC);
-}
-
-static int php_stream_http_stream_stat(php_stream_wrapper *wrapper,
- php_stream *stream,
- php_stream_statbuf *ssb
- TSRMLS_DC)
-{
- /* one day, we could fill in the details based on Date: and Content-Length:
- * headers. For now, we return with a failure code to prevent the underlying
- * file's details from being used instead. */
- return -1;
-}
-
-static php_stream_wrapper_ops http_stream_wops = {
- php_stream_url_wrap_http,
- NULL, /* stream_close */
- php_stream_http_stream_stat,
- NULL, /* stat_url */
- NULL, /* opendir */
- "HTTP",
- NULL /* unlink */
-};
-
-PHPAPI php_stream_wrapper php_stream_http_wrapper = {
- &http_stream_wops,
- NULL,
- 1 /* is_url */
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/image.c b/ext/standard/image.c
deleted file mode 100644
index 7ee3be27d9..0000000000
--- a/ext/standard/image.c
+++ /dev/null
@@ -1,1285 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include <stdio.h>
-#if defined(NETWARE) && !defined(NEW_LIBC)
-#include <sys/socket.h>
-#endif
-#if HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#include "fopen_wrappers.h"
-#include "ext/standard/fsock.h"
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include "php_image.h"
-
-#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
-#include "zlib.h"
-#endif
-
-/* file type markers */
-PHPAPI const char php_sig_gif[3] = {'G', 'I', 'F'};
-PHPAPI const char php_sig_psd[4] = {'8', 'B', 'P', 'S'};
-PHPAPI const char php_sig_bmp[2] = {'B', 'M'};
-PHPAPI const char php_sig_swf[3] = {'F', 'W', 'S'};
-PHPAPI const char php_sig_swc[3] = {'C', 'W', 'S'};
-PHPAPI const char php_sig_jpg[3] = {(char) 0xff, (char) 0xd8, (char) 0xff};
-PHPAPI const char php_sig_png[8] = {(char) 0x89, (char) 0x50, (char) 0x4e, (char) 0x47,
- (char) 0x0d, (char) 0x0a, (char) 0x1a, (char) 0x0a};
-PHPAPI const char php_sig_tif_ii[4] = {'I','I', (char)0x2A, (char)0x00};
-PHPAPI const char php_sig_tif_mm[4] = {'M','M', (char)0x00, (char)0x2A};
-PHPAPI const char php_sig_jpc[3] = {(char)0xff, (char)0x4f, (char)0xff};
-PHPAPI const char php_sig_jp2[12] = {(char)0x00, (char)0x00, (char)0x00, (char)0x0c,
- (char)0x6a, (char)0x50, (char)0x20, (char)0x20,
- (char)0x0d, (char)0x0a, (char)0x87, (char)0x0a};
-PHPAPI const char php_sig_iff[4] = {'F','O','R','M'};
-
-/* REMEMBER TO ADD MIME-TYPE TO FUNCTION php_image_type_to_mime_type */
-/* PCX must check first 64bytes and byte 0=0x0a and byte2 < 0x06 */
-
-/* return info as a struct, to make expansion easier */
-
-struct gfxinfo {
- unsigned int width;
- unsigned int height;
- unsigned int bits;
- unsigned int channels;
-};
-
-/* {{{ PHP_MINIT_FUNCTION(imagetypes)
- * Register IMAGETYPE_<xxx> constants used by GetImageSize(), image_type_to_mime_type, ext/exif */
-PHP_MINIT_FUNCTION(imagetypes)
-{
- REGISTER_LONG_CONSTANT("IMAGETYPE_GIF", IMAGE_FILETYPE_GIF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMAGETYPE_JPEG", IMAGE_FILETYPE_JPEG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMAGETYPE_PNG", IMAGE_FILETYPE_PNG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMAGETYPE_SWF", IMAGE_FILETYPE_SWF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMAGETYPE_PSD", IMAGE_FILETYPE_PSD, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMAGETYPE_BMP", IMAGE_FILETYPE_BMP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_II", IMAGE_FILETYPE_TIFF_II, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_MM", IMAGE_FILETYPE_TIFF_MM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMAGETYPE_JPC", IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMAGETYPE_JP2", IMAGE_FILETYPE_JP2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMAGETYPE_JPX", IMAGE_FILETYPE_JPX, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMAGETYPE_JB2", IMAGE_FILETYPE_JB2, CONST_CS | CONST_PERSISTENT);
-#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
- REGISTER_LONG_CONSTANT("IMAGETYPE_SWC", IMAGE_FILETYPE_SWC, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_LONG_CONSTANT("IMAGETYPE_IFF", IMAGE_FILETYPE_IFF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMAGETYPE_WBMP", IMAGE_FILETYPE_WBMP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMAGETYPE_JPEG2000",IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); /* keep alias */
- REGISTER_LONG_CONSTANT("IMAGETYPE_XBM", IMAGE_FILETYPE_XBM, CONST_CS | CONST_PERSISTENT);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_handle_gif
- * routine to handle GIF files. If only everything were that easy... ;} */
-static struct gfxinfo *php_handle_gif (php_stream * stream TSRMLS_DC)
-{
- struct gfxinfo *result = NULL;
- unsigned char dim[5];
-
- if (php_stream_seek(stream, 3, SEEK_CUR))
- return NULL;
-
- if (php_stream_read(stream, dim, sizeof(dim)) != sizeof(dim))
- return NULL;
-
- result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo));
- result->width = (unsigned int)dim[0] | (((unsigned int)dim[1])<<8);
- result->height = (unsigned int)dim[2] | (((unsigned int)dim[3])<<8);
- result->bits = dim[4]&0x80 ? ((((unsigned int)dim[4])&0x07) + 1) : 0;
- result->channels = 3; /* allways */
-
- return result;
-}
-/* }}} */
-
-/* {{{ php_handle_psd
- */
-static struct gfxinfo *php_handle_psd (php_stream * stream TSRMLS_DC)
-{
- struct gfxinfo *result = NULL;
- unsigned char dim[8];
-
- if (php_stream_seek(stream, 11, SEEK_CUR))
- return NULL;
-
- if (php_stream_read(stream, dim, sizeof(dim)) != sizeof(dim))
- return NULL;
-
- result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo));
- result->height = (((unsigned int)dim[0]) << 24) + (((unsigned int)dim[1]) << 16) + (((unsigned int)dim[2]) << 8) + ((unsigned int)dim[3]);
- result->width = (((unsigned int)dim[4]) << 24) + (((unsigned int)dim[5]) << 16) + (((unsigned int)dim[6]) << 8) + ((unsigned int)dim[7]);
-
- return result;
-}
-/* }}} */
-
-/* {{{ php_handle_bmp
- */
-static struct gfxinfo *php_handle_bmp (php_stream * stream TSRMLS_DC)
-{
- struct gfxinfo *result = NULL;
- unsigned char dim[12];
-
- if (php_stream_seek(stream, 15, SEEK_CUR))
- return NULL;
-
- if (php_stream_read(stream, dim, sizeof(dim)) != sizeof(dim))
- return NULL;
-
- result = (struct gfxinfo *) ecalloc (1, sizeof(struct gfxinfo));
- result->width = (((unsigned int)dim[ 3]) << 24) + (((unsigned int)dim[ 2]) << 16) + (((unsigned int)dim[ 1]) << 8) + ((unsigned int) dim[ 0]);
- result->height = (((unsigned int)dim[ 7]) << 24) + (((unsigned int)dim[ 6]) << 16) + (((unsigned int)dim[ 5]) << 8) + ((unsigned int) dim[ 4]);
- result->bits = (((unsigned int)dim[11]) << 8) + ((unsigned int)dim[10]);
-
- return result;
-}
-/* }}} */
-
-/* {{{ php_swf_get_bits
- * routines to handle SWF files. */
-static unsigned long int php_swf_get_bits (unsigned char* buffer, unsigned int pos, unsigned int count)
-{
- unsigned int loop;
- unsigned long int result = 0;
-
- for (loop = pos; loop < pos + count; loop++)
- {
- result = result +
- ((((buffer[loop / 8]) >> (7 - (loop % 8))) & 0x01) << (count - (loop - pos) - 1));
- }
- return result;
-}
-/* }}} */
-
-#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
-/* {{{ php_handle_swc
- */
-static struct gfxinfo *php_handle_swc(php_stream * stream TSRMLS_DC)
-{
- struct gfxinfo *result = NULL;
-
- long bits;
- unsigned char a[64];
- unsigned long len=64, szlength;
- int factor=1,maxfactor=16;
- int slength, status=0;
- char *b, *buf=NULL, *bufz=NULL;
-
- b = ecalloc (1, len + 1);
-
- if (php_stream_seek(stream, 5, SEEK_CUR))
- return NULL;
-
- if (php_stream_read(stream, a, sizeof(a)) != sizeof(a))
- return NULL;
-
- if (uncompress(b, &len, a, sizeof(a)) != Z_OK) {
- /* failed to decompress the file, will try reading the rest of the file */
- if (php_stream_seek(stream, 8, SEEK_SET))
- return NULL;
-
- slength = php_stream_copy_to_mem(stream, &bufz, PHP_STREAM_COPY_ALL, 0);
-
- /*
- * zlib::uncompress() wants to know the output data length
- * if none was given as a parameter
- * we try from input length * 2 up to input length * 2^8
- * doubling it whenever it wasn't big enough
- * that should be eneugh for all real life cases
- */
-
- do {
- szlength=slength*(1<<factor++);
- buf = (char *) erealloc(buf,szlength);
- status = uncompress(buf, &szlength, bufz, slength);
- } while ((status==Z_BUF_ERROR)&&(factor<maxfactor));
-
- if (bufz) {
- pefree(bufz, 0);
- }
-
- if (status == Z_OK) {
- memcpy(b, buf, len);
- }
-
- if (buf) {
- efree(buf);
- }
- }
-
- if (!status) {
- result = (struct gfxinfo *) ecalloc (1, sizeof (struct gfxinfo));
- bits = php_swf_get_bits (b, 0, 5);
- result->width = (php_swf_get_bits (b, 5 + bits, bits) -
- php_swf_get_bits (b, 5, bits)) / 20;
- result->height = (php_swf_get_bits (b, 5 + (3 * bits), bits) -
- php_swf_get_bits (b, 5 + (2 * bits), bits)) / 20;
- } else {
- result = NULL;
- }
-
- efree (b);
- return result;
-}
-/* }}} */
-#endif
-
-/* {{{ php_handle_swf
- */
-static struct gfxinfo *php_handle_swf (php_stream * stream TSRMLS_DC)
-{
- struct gfxinfo *result = NULL;
- long bits;
- unsigned char a[32];
-
- if (php_stream_seek(stream, 5, SEEK_CUR))
- return NULL;
-
- if (php_stream_read(stream, a, sizeof(a)) != sizeof(a))
- return NULL;
-
- result = (struct gfxinfo *) ecalloc (1, sizeof (struct gfxinfo));
- bits = php_swf_get_bits (a, 0, 5);
- result->width = (php_swf_get_bits (a, 5 + bits, bits) -
- php_swf_get_bits (a, 5, bits)) / 20;
- result->height = (php_swf_get_bits (a, 5 + (3 * bits), bits) -
- php_swf_get_bits (a, 5 + (2 * bits), bits)) / 20;
- result->bits = 0;
- result->channels = 0;
- return result;
-}
-/* }}} */
-
-/* {{{ php_handle_png
- * routine to handle PNG files */
-static struct gfxinfo *php_handle_png (php_stream * stream TSRMLS_DC)
-{
- struct gfxinfo *result = NULL;
- unsigned char dim[9];
-/* Width: 4 bytes
- * Height: 4 bytes
- * Bit depth: 1 byte
- * Color type: 1 byte
- * Compression method: 1 byte
- * Filter method: 1 byte
- * Interlace method: 1 byte
- */
-
- if (php_stream_seek(stream, 8, SEEK_CUR))
- return NULL;
-
- if((php_stream_read(stream, dim, sizeof(dim))) < sizeof(dim))
- return NULL;
-
- result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo));
- result->width = (((unsigned int)dim[0]) << 24) + (((unsigned int)dim[1]) << 16) + (((unsigned int)dim[2]) << 8) + ((unsigned int)dim[3]);
- result->height = (((unsigned int)dim[4]) << 24) + (((unsigned int)dim[5]) << 16) + (((unsigned int)dim[6]) << 8) + ((unsigned int)dim[7]);
- result->bits = (unsigned int)dim[8];
- return result;
-}
-/* }}} */
-
-/* routines to handle JPEG data */
-
-/* some defines for the different JPEG block types */
-#define M_SOF0 0xC0 /* Start Of Frame N */
-#define M_SOF1 0xC1 /* N indicates which compression process */
-#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */
-#define M_SOF3 0xC3
-#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */
-#define M_SOF6 0xC6
-#define M_SOF7 0xC7
-#define M_SOF9 0xC9
-#define M_SOF10 0xCA
-#define M_SOF11 0xCB
-#define M_SOF13 0xCD
-#define M_SOF14 0xCE
-#define M_SOF15 0xCF
-#define M_SOI 0xD8
-#define M_EOI 0xD9 /* End Of Image (end of datastream) */
-#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */
-#define M_APP0 0xe0
-#define M_APP1 0xe1
-#define M_APP2 0xe2
-#define M_APP3 0xe3
-#define M_APP4 0xe4
-#define M_APP5 0xe5
-#define M_APP6 0xe6
-#define M_APP7 0xe7
-#define M_APP8 0xe8
-#define M_APP9 0xe9
-#define M_APP10 0xea
-#define M_APP11 0xeb
-#define M_APP12 0xec
-#define M_APP13 0xed
-#define M_APP14 0xee
-#define M_APP15 0xef
-#define M_COM 0xFE /* COMment */
-
-#define M_PSEUDO 0xFFD8 /* pseudo marker for start of image(byte 0) */
-
-/* {{{ php_read2
- */
-static unsigned short php_read2(php_stream * stream TSRMLS_DC)
-{
- unsigned char a[2];
-
- /* just return 0 if we hit the end-of-file */
- if((php_stream_read(stream, a, sizeof(a))) <= 0) return 0;
-
- return (((unsigned short) a[ 0 ]) << 8) + ((unsigned short) a[ 1 ]);
-}
-/* }}} */
-
-/* {{{ php_next_marker
- * get next marker byte from file */
-static unsigned int php_next_marker(php_stream * stream, int last_marker, int comment_correction, int ff_read TSRMLS_DC)
-{
- int a=0, marker;
-
- /* get marker byte, swallowing possible padding */
- if ( last_marker==M_COM && comment_correction) {
- /* some software does not count the length bytes of COM section */
- /* one company doing so is very much envolved in JPEG... so we accept too */
- /* by the way: some of those companies changed their code now... */
- comment_correction = 2;
- } else {
- last_marker = 0;
- comment_correction = 0;
- }
- if ( ff_read) {
- a = 1; /* already read 0xff in filetype detection */
- }
- do {
- if ((marker = php_stream_getc(stream)) == EOF)
- {
- return M_EOI;/* we hit EOF */
- }
- if ( last_marker==M_COM && comment_correction>0)
- {
- if ( marker != 0xFF)
- {
- marker = 0xff;
- comment_correction--;
- } else {
- last_marker = M_PSEUDO; /* stop skipping non 0xff for M_COM */
- }
- }
- if ( ++a > 10)
- {
- /* who knows the maxim amount of 0xff? though 7 */
- /* but found other implementations */
- return M_EOI;
- }
- } while ( marker == 0xff);
- if ( a < 2)
- {
- return M_EOI; /* at least one 0xff is needed before marker code */
- }
- if ( last_marker==M_COM && comment_correction)
- {
- return M_EOI; /* ah illegal: char after COM section not 0xFF */
- }
- return (unsigned int)marker;
-}
-/* }}} */
-
-/* {{{ php_skip_variable
- * skip over a variable-length block; assumes proper length marker */
-static void php_skip_variable(php_stream * stream TSRMLS_DC)
-{
- off_t length = ((unsigned int)php_read2(stream TSRMLS_CC));
-
- length = length-2;
- if (length)
- {
- php_stream_seek(stream, (long)length, SEEK_CUR);
- }
-}
-/* }}} */
-
-/* {{{ php_read_APP
- */
-static void php_read_APP(php_stream * stream, unsigned int marker, zval *info TSRMLS_DC)
-{
- unsigned short length;
- unsigned char *buffer;
- unsigned char markername[ 16 ];
- zval *tmp;
-
- length = php_read2(stream TSRMLS_CC);
- length -= 2; /* length includes itself */
-
- buffer = emalloc(length);
-
- if (php_stream_read(stream, buffer, (long) length) <= 0) {
- efree(buffer);
- return;
- }
-
- sprintf(markername, "APP%d", marker - M_APP0);
-
- if (zend_hash_find(Z_ARRVAL_P(info), markername, strlen(markername)+1, (void **) &tmp) == FAILURE) {
- /* XXX we onyl catch the 1st tag of it's kind! */
- add_assoc_stringl(info, markername, buffer, length, 1);
- }
-
- efree(buffer);
-}
-/* }}} */
-
-/* {{{ php_handle_jpeg
- main loop to parse JPEG structure */
-static struct gfxinfo *php_handle_jpeg (php_stream * stream, pval *info TSRMLS_DC)
-{
- struct gfxinfo *result = NULL;
- unsigned int marker = M_PSEUDO;
- unsigned short length, ff_read=1;
-
- for (;;) {
- marker = php_next_marker(stream, marker, 1, ff_read TSRMLS_CC);
- ff_read = 0;
- switch (marker) {
- case M_SOF0:
- case M_SOF1:
- case M_SOF2:
- case M_SOF3:
- case M_SOF5:
- case M_SOF6:
- case M_SOF7:
- case M_SOF9:
- case M_SOF10:
- case M_SOF11:
- case M_SOF13:
- case M_SOF14:
- case M_SOF15:
- if (result == NULL) {
- /* handle SOFn block */
- result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo));
- length = php_read2(stream TSRMLS_CC);
- result->bits = php_stream_getc(stream);
- result->height = php_read2(stream TSRMLS_CC);
- result->width = php_read2(stream TSRMLS_CC);
- result->channels = php_stream_getc(stream);
- if (!info || length<8) /* if we don't want an extanded info -> return */
- return result;
- if (php_stream_seek(stream, length-8, SEEK_CUR)) /* file error after info */
- return result;
- } else {
- php_skip_variable(stream TSRMLS_CC);
- }
- break;
-
- case M_APP0:
- case M_APP1:
- case M_APP2:
- case M_APP3:
- case M_APP4:
- case M_APP5:
- case M_APP6:
- case M_APP7:
- case M_APP8:
- case M_APP9:
- case M_APP10:
- case M_APP11:
- case M_APP12:
- case M_APP13:
- case M_APP14:
- case M_APP15:
- if (info) {
- php_read_APP(stream, marker, info TSRMLS_CC); /* read all the app markes... */
- } else {
- php_skip_variable(stream TSRMLS_CC);
- }
- break;
-
- case M_SOS:
- case M_EOI:
- return result; /* we're about to hit image data, or are at EOF. stop processing. */
-
- default:
- php_skip_variable(stream TSRMLS_CC); /* anything else isn't interesting */
- break;
- }
- }
-
- return result; /* perhaps image broken -> no info but size */
-}
-/* }}} */
-
-/* {{{ php_read4
- */
-static unsigned int php_read4(php_stream * stream TSRMLS_DC)
-{
- unsigned char a[4];
-
- /* just return 0 if we hit the end-of-file */
- if ((php_stream_read(stream, a, sizeof(a))) != sizeof(a)) return 0;
-
- return (((unsigned int)a[0]) << 24)
- + (((unsigned int)a[1]) << 16)
- + (((unsigned int)a[2]) << 8)
- + (((unsigned int)a[3]));
-}
-/* }}} */
-
-/* {{{ JPEG 2000 Marker Codes */
-#define JPEG2000_MARKER_PREFIX 0xFF /* All marker codes start with this */
-#define JPEG2000_MARKER_SOC 0x4F /* Start of Codestream */
-#define JPEG2000_MARKER_SOT 0x90 /* Start of Tile part */
-#define JPEG2000_MARKER_SOD 0x93 /* Start of Data */
-#define JPEG2000_MARKER_EOC 0xD9 /* End of Codestream */
-#define JPEG2000_MARKER_SIZ 0x51 /* Image and tile size */
-#define JPEG2000_MARKER_COD 0x52 /* Coding style default */
-#define JPEG2000_MARKER_COC 0x53 /* Coding style component */
-#define JPEG2000_MARKER_RGN 0x5E /* Region of interest */
-#define JPEG2000_MARKER_QCD 0x5C /* Quantization default */
-#define JPEG2000_MARKER_QCC 0x5D /* Quantization component */
-#define JPEG2000_MARKER_POC 0x5F /* Progression order change */
-#define JPEG2000_MARKER_TLM 0x55 /* Tile-part lengths */
-#define JPEG2000_MARKER_PLM 0x57 /* Packet length, main header */
-#define JPEG2000_MARKER_PLT 0x58 /* Packet length, tile-part header */
-#define JPEG2000_MARKER_PPM 0x60 /* Packed packet headers, main header */
-#define JPEG2000_MARKER_PPT 0x61 /* Packed packet headers, tile part header */
-#define JPEG2000_MARKER_SOP 0x91 /* Start of packet */
-#define JPEG2000_MARKER_EPH 0x92 /* End of packet header */
-#define JPEG2000_MARKER_CRG 0x63 /* Component registration */
-#define JPEG2000_MARKER_COM 0x64 /* Comment */
-/* }}} */
-
-/* {{{ php_handle_jpc
- Main loop to parse JPEG2000 raw codestream structure */
-static struct gfxinfo *php_handle_jpc(php_stream * stream TSRMLS_DC)
-{
- struct gfxinfo *result = NULL;
- unsigned short dummy_short;
- int dummy_int, highest_bit_depth, bit_depth;
- unsigned char first_marker_id;
- unsigned int i;
-
- /* JPEG 2000 components can be vastly different from one another.
- Each component can be sampled at a different resolution, use
- a different colour space, have a seperate colour depth, and
- be compressed totally differently! This makes giving a single
- "bit depth" answer somewhat problematic. For this implementation
- we'll use the highest depth encountered. */
-
- /* Get the single byte that remains after the file type indentification */
- first_marker_id = php_stream_getc(stream);
-
- /* Ensure that this marker is SIZ (as is mandated by the standard) */
- if (first_marker_id != JPEG2000_MARKER_SIZ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "JPEG2000 codestream corrupt(Expected SIZ marker not found after SOC)");
- return NULL;
- }
-
- result = (struct gfxinfo *)ecalloc(1, sizeof(struct gfxinfo));
-
- dummy_short = php_read2(stream TSRMLS_CC); /* Lsiz */
- dummy_short = php_read2(stream TSRMLS_CC); /* Rsiz */
- result->height = php_read4(stream TSRMLS_CC); /* Xsiz */
- result->width = php_read4(stream TSRMLS_CC); /* Ysiz */
-
- dummy_int = php_read4(stream TSRMLS_CC); /* XOsiz */
- dummy_int = php_read4(stream TSRMLS_CC); /* YOsiz */
- dummy_int = php_read4(stream TSRMLS_CC); /* XTsiz */
- dummy_int = php_read4(stream TSRMLS_CC); /* YTsiz */
- dummy_int = php_read4(stream TSRMLS_CC); /* XTOsiz */
- dummy_int = php_read4(stream TSRMLS_CC); /* YTOsiz */
-
- result->channels = php_read2(stream TSRMLS_CC); /* Csiz */
-
- /* Collect bit depth info */
- highest_bit_depth = bit_depth = 0;
- for (i = 0; i < result->channels; i++) {
- bit_depth = php_stream_getc(stream); /* Ssiz[i] */
- bit_depth++;
- if (bit_depth > highest_bit_depth) {
- highest_bit_depth = bit_depth;
- }
-
- php_stream_getc(stream); /* XRsiz[i] */
- php_stream_getc(stream); /* YRsiz[i] */
- }
-
- result->bits = highest_bit_depth;
-
- return result;
-}
-/* }}} */
-
-/* {{{ php_handle_jp2
- main loop to parse JPEG 2000 JP2 wrapper format structure */
-static struct gfxinfo *php_handle_jp2(php_stream *stream TSRMLS_DC)
-{
- struct gfxinfo *result = NULL;
- unsigned int box_length;
- unsigned int box_type;
- char jp2c_box_id[] = {(char)0x6a, (char)0x70, (char)0x32, (char)0x63};
-
- /* JP2 is a wrapper format for JPEG 2000. Data is contained within "boxes".
- Boxes themselves can be contained within "super-boxes". Super-Boxes can
- contain super-boxes which provides us with a hierarchical storage system.
-
- It is valid for a JP2 file to contain multiple individual codestreams.
- We'll just look for the first codestream at the root of the box structure
- and handle that.
- */
-
- for (;;)
- {
- box_length = php_read4(stream TSRMLS_CC); /* LBox */
- /* TBox */
- if (php_stream_read(stream, (void *)&box_type, sizeof(box_type)) != sizeof(box_type)) {
- /* Use this as a general "out of stream" error */
- break;
- }
-
- if (box_length == 1) {
- /* We won't handle XLBoxes */
- return NULL;
- }
-
- if (!memcmp(&box_type, jp2c_box_id, 4))
- {
- /* Skip the first 3 bytes to emulate the file type examination */
- php_stream_seek(stream, 3, SEEK_CUR);
-
- result = php_handle_jpc(stream TSRMLS_CC);
- break;
- }
-
- /* Skip over LBox (Which includes both TBox and LBox itself */
- php_stream_seek(stream, box_length - 8, SEEK_CUR);
- }
-
- if (result == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "JP2 file has no codestreams at root level");
- }
-
- return result;
-}
-/* }}} */
-
-/* {{{ tiff constants
- */
-PHPAPI const int php_tiff_bytes_per_format[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};
-
-/* uncompressed only */
-#define TAG_IMAGEWIDTH 0x0100
-#define TAG_IMAGEHEIGHT 0x0101
-/* compressed images only */
-#define TAG_COMP_IMAGEWIDTH 0xA002
-#define TAG_COMP_IMAGEHEIGHT 0xA003
-
-#define TAG_FMT_BYTE 1
-#define TAG_FMT_STRING 2
-#define TAG_FMT_USHORT 3
-#define TAG_FMT_ULONG 4
-#define TAG_FMT_URATIONAL 5
-#define TAG_FMT_SBYTE 6
-#define TAG_FMT_UNDEFINED 7
-#define TAG_FMT_SSHORT 8
-#define TAG_FMT_SLONG 9
-#define TAG_FMT_SRATIONAL 10
-#define TAG_FMT_SINGLE 11
-#define TAG_FMT_DOUBLE 12
-/* }}} */
-
-/* {{{ php_ifd_get16u
- * Convert a 16 bit unsigned value from file's native byte order */
-static int php_ifd_get16u(void *Short, int motorola_intel)
-{
- if (motorola_intel) {
- return (((unsigned char *)Short)[0] << 8) | ((unsigned char *)Short)[1];
- } else {
- return (((unsigned char *)Short)[1] << 8) | ((unsigned char *)Short)[0];
- }
-}
-/* }}} */
-
-/* {{{ php_ifd_get16s
- * Convert a 16 bit signed value from file's native byte order */
-static signed short php_ifd_get16s(void *Short, int motorola_intel)
-{
- return (signed short)php_ifd_get16u(Short, motorola_intel);
-}
-/* }}} */
-
-/* {{{ php_ifd_get32s
- * Convert a 32 bit signed value from file's native byte order */
-static int php_ifd_get32s(void *Long, int motorola_intel)
-{
- if (motorola_intel) {
- return ((( char *)Long)[0] << 24) | (((unsigned char *)Long)[1] << 16)
- | (((unsigned char *)Long)[2] << 8 ) | (((unsigned char *)Long)[3] << 0 );
- } else {
- return ((( char *)Long)[3] << 24) | (((unsigned char *)Long)[2] << 16)
- | (((unsigned char *)Long)[1] << 8 ) | (((unsigned char *)Long)[0] << 0 );
- }
-}
-/* }}} */
-
-/* {{{ php_ifd_get32u
- * Convert a 32 bit unsigned value from file's native byte order */
-static unsigned php_ifd_get32u(void *Long, int motorola_intel)
-{
- return (unsigned)php_ifd_get32s(Long, motorola_intel) & 0xffffffff;
-}
-/* }}} */
-
-/* {{{ php_handle_tiff
- main loop to parse TIFF structure */
-static struct gfxinfo *php_handle_tiff (php_stream * stream, pval *info, int motorola_intel TSRMLS_DC)
-{
- struct gfxinfo *result = NULL;
- int i, num_entries;
- unsigned char *dir_entry;
- size_t ifd_size, dir_size, entry_value, width=0, height=0, ifd_addr;
- int entry_tag , entry_type;
- char *ifd_data, ifd_ptr[4];
-
- if (php_stream_read(stream, ifd_ptr, 4) != 4)
- return NULL;
- ifd_addr = php_ifd_get32u(ifd_ptr, motorola_intel);
- if (php_stream_seek(stream, ifd_addr-8, SEEK_CUR))
- return NULL;
- ifd_size = 2;
- ifd_data = emalloc(ifd_size);
- if (php_stream_read(stream, ifd_data, 2) != 2) {
- efree(ifd_data);
- return NULL;
- }
- num_entries = php_ifd_get16u(ifd_data, motorola_intel);
- dir_size = 2/*num dir entries*/ +12/*length of entry*/*num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/;
- ifd_size = dir_size;
- ifd_data = erealloc(ifd_data,ifd_size);
- if (php_stream_read(stream, ifd_data+2, dir_size-2) != dir_size-2) {
- efree(ifd_data);
- return NULL;
- }
- /* now we have the directory we can look how long it should be */
- ifd_size = dir_size;
- for(i=0;i<num_entries;i++) {
- dir_entry = ifd_data+2+i*12;
- entry_tag = php_ifd_get16u(dir_entry+0, motorola_intel);
- entry_type = php_ifd_get16u(dir_entry+2, motorola_intel);
- switch(entry_type) {
- case TAG_FMT_BYTE:
- case TAG_FMT_SBYTE:
- entry_value = (size_t)(dir_entry[8]);
- break;
- case TAG_FMT_USHORT:
- entry_value = php_ifd_get16u(dir_entry+8, motorola_intel);
- break;
- case TAG_FMT_SSHORT:
- entry_value = php_ifd_get16s(dir_entry+8, motorola_intel);
- break;
- case TAG_FMT_ULONG:
- entry_value = php_ifd_get32u(dir_entry+8, motorola_intel);
- break;
- case TAG_FMT_SLONG:
- entry_value = php_ifd_get32s(dir_entry+8, motorola_intel);
- break;
- default:
- continue;
- }
- switch(entry_tag) {
- case TAG_IMAGEWIDTH:
- case TAG_COMP_IMAGEWIDTH:
- width = entry_value;
- break;
- case TAG_IMAGEHEIGHT:
- case TAG_COMP_IMAGEHEIGHT:
- height = entry_value;
- break;
- }
- }
- efree(ifd_data);
- if ( width && height) {
- /* not the same when in for-loop */
- result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo));
- result->height = height;
- result->width = width;
- result->bits = 0;
- result->channels = 0;
- return result;
- }
- return NULL;
-}
-/* }}} */
-
-/* {{{ php_handle_psd
- */
-static struct gfxinfo *php_handle_iff(php_stream * stream TSRMLS_DC)
-{
- struct gfxinfo *result = NULL;
- unsigned char a[10];
- int chunkId;
- int size;
-
- if (php_stream_read(stream, a, 8) != 8)
- return NULL;
- if (strncmp(a+4, "ILBM", 4) && strncmp(a+4, "PBM ", 4))
- return NULL;
-
- result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo));
-
- /* loop chunks to find BMHD chunk */
- do {
- if (php_stream_read(stream, a, 8) != 8) {
- efree(result);
- return NULL;
- }
- chunkId = php_ifd_get32s(a+0, 1);
- size = php_ifd_get32s(a+4, 1);
- if ((size & 1) == 1) {
- size++;
- }
- if (chunkId == 0x424d4844) { /* BMHD chunk */
- if (php_stream_read(stream, a, 9) != 9) {
- efree(result);
- return NULL;
- }
- result->width = php_ifd_get16s(a+0, 1);
- result->height = php_ifd_get16s(a+2, 1);
- result->bits = a[8] & 0xff;
- result->channels = 0;
- if (result->width > 0 && result->height > 0 && result->bits > 0 && result->bits < 33)
- return result;
- } else {
- if (php_stream_seek(stream, size, SEEK_CUR)) {
- efree(result);
- return NULL;
- }
- }
- } while (1);
-}
-/* }}} */
-
-/* {{{ php_get_wbmp
- * int WBMP file format type
- * byte Header Type
- * byte Extended Header
- * byte Header Data (type 00 = multibyte)
- * byte Header Data (type 11 = name/pairs)
- * int Number of columns
- * int Number of rows
- */
-static int php_get_wbmp(php_stream *stream, struct gfxinfo **result, int check TSRMLS_DC)
-{
- int i, width = 0, height = 0;
-
- if (php_stream_rewind(stream)) {
- return 0;
- }
-
- /* get type */
- if (php_stream_getc(stream) != 0) {
- return 0;
- }
-
- /* skip header */
- do {
- i = php_stream_getc(stream);
- if (i < 0) {
- return 0;
- }
- } while (i & 0x80);
-
- /* get width */
- do {
- i = php_stream_getc(stream);
- if (i < 0) {
- return 0;
- }
- width = (width << 7) | (i & 0x7f);
- } while (i & 0x80);
-
- /* get height */
- do {
- i = php_stream_getc(stream);
- if (i < 0) {
- return 0;
- }
- height = (height << 7) | (i & 0x7f);
- } while (i & 0x80);
-
- if (!check) {
- (*result)->width = width;
- (*result)->height = height;
- }
-
- return IMAGE_FILETYPE_WBMP;
-}
-/* }}} */
-
-/* {{{ php_handle_wbmp
-*/
-static struct gfxinfo *php_handle_wbmp(php_stream * stream TSRMLS_DC)
-{
- struct gfxinfo *result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo));
-
- if (!php_get_wbmp(stream, &result, 0 TSRMLS_CC)) {
- efree(result);
- return NULL;
- }
-
- return result;
-}
-/* }}} */
-
-/* {{{ php_get_xbm
- */
-static int php_get_xbm(php_stream *stream, struct gfxinfo **result TSRMLS_DC)
-{
- char *fline;
- char *iname;
- char *type;
- int value;
- unsigned int width = 0, height = 0;
-
- if (result) {
- *result = NULL;
- }
- if (php_stream_rewind(stream)) {
- return 0;
- }
- while ((fline=php_stream_gets(stream, NULL, 0)) != NULL) {
- iname = estrdup(fline); /* simple way to get necessary buffer of required size */
- if (sscanf(fline, "#define %s %d", iname, &value) == 2) {
- if (!(type = strrchr(iname, '_'))) {
- type = iname;
- } else {
- type++;
- }
-
- if (!strcmp("width", type)) {
- width = (unsigned int) value;
- if (height) {
- efree(iname);
- break;
- }
- }
- if (!strcmp("height", type)) {
- height = (unsigned int) value;
- if (width) {
- efree(iname);
- break;
- }
- }
- }
- efree(fline);
- efree(iname);
- }
- if (fline) {
- efree(fline);
- }
-
- if (width && height) {
- if (result) {
- *result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo));
- (*result)->width = width;
- (*result)->height = height;
- }
- return IMAGE_FILETYPE_XBM;
- }
-
- return 0;
-}
-/* }}} */
-
-/* {{{ php_handle_xbm
- */
-static struct gfxinfo *php_handle_xbm(php_stream * stream TSRMLS_DC)
-{
- struct gfxinfo *result;
- php_get_xbm(stream, &result TSRMLS_CC);
- return result;
-}
-/* }}} */
-
-/* {{{ php_image_type_to_mime_type
- * Convert internal image_type to mime type */
-PHPAPI const char * php_image_type_to_mime_type(int image_type)
-{
- switch( image_type) {
- case IMAGE_FILETYPE_GIF:
- return "image/gif";
- case IMAGE_FILETYPE_JPEG:
- return "image/jpeg";
- case IMAGE_FILETYPE_PNG:
- return "image/png";
- case IMAGE_FILETYPE_SWF:
- case IMAGE_FILETYPE_SWC:
- return "application/x-shockwave-flash";
- case IMAGE_FILETYPE_PSD:
- return "image/psd";
- case IMAGE_FILETYPE_BMP:
- return "image/bmp";
- case IMAGE_FILETYPE_TIFF_II:
- case IMAGE_FILETYPE_TIFF_MM:
- return "image/tiff";
- case IMAGE_FILETYPE_IFF:
- return "image/iff";
- case IMAGE_FILETYPE_WBMP:
- return "image/vnd.wap.wbmp";
- case IMAGE_FILETYPE_JPC:
- return "application/octet-stream";
- case IMAGE_FILETYPE_JP2:
- return "image/jp2";
- case IMAGE_FILETYPE_XBM:
- return "image/xbm";
- default:
- case IMAGE_FILETYPE_UNKNOWN:
- return "application/octet-stream"; /* suppose binary format */
- }
-}
-/* }}} */
-
-/* {{{ proto string image_type_to_mime_type(int imagetype)
- Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype */
-PHP_FUNCTION(image_type_to_mime_type)
-{
- zval **p_image_type;
- int arg_c = ZEND_NUM_ARGS();
-
- if ((arg_c!=1) || zend_get_parameters_ex(arg_c, &p_image_type) == FAILURE) {
- RETVAL_FALSE;
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(p_image_type);
- ZVAL_STRING(return_value, (char*)php_image_type_to_mime_type(Z_LVAL_PP(p_image_type)), 1);
-}
-/* }}} */
-
-/* {{{ php_imagetype
- detect filetype from first bytes */
-PHPAPI int php_getimagetype(php_stream * stream, char *filetype TSRMLS_DC)
-{
- char tmp[12];
-
- if ( !filetype) filetype = tmp;
- if((php_stream_read(stream, filetype, 3)) != 3) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Read error!");
- return IMAGE_FILETYPE_UNKNOWN;
- }
-
-/* BYTES READ: 3 */
- if (!memcmp(filetype, php_sig_gif, 3)) {
- return IMAGE_FILETYPE_GIF;
- } else if (!memcmp(filetype, php_sig_jpg, 3)) {
- return IMAGE_FILETYPE_JPEG;
- } else if (!memcmp(filetype, php_sig_png, 3)) {
- if (php_stream_read(stream, filetype+3, 5) != 5) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Read error!");
- return IMAGE_FILETYPE_UNKNOWN;
- }
- if (!memcmp(filetype, php_sig_png, 8)) {
- return IMAGE_FILETYPE_PNG;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PNG file corrupted by ASCII conversion");
- return IMAGE_FILETYPE_UNKNOWN;
- }
- } else if (!memcmp(filetype, php_sig_swf, 3)) {
- return IMAGE_FILETYPE_SWF;
- } else if (!memcmp(filetype, php_sig_swc, 3)) {
- return IMAGE_FILETYPE_SWC;
- } else if (!memcmp(filetype, php_sig_psd, 3)) {
- return IMAGE_FILETYPE_PSD;
- } else if (!memcmp(filetype, php_sig_bmp, 2)) {
- return IMAGE_FILETYPE_BMP;
- } else if (!memcmp(filetype, php_sig_jpc, 3)) {
- return IMAGE_FILETYPE_JPC;
- }
-
- if (php_stream_read(stream, filetype+3, 1) != 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Read error!");
- return IMAGE_FILETYPE_UNKNOWN;
- }
-/* BYTES READ: 4 */
- if (!memcmp(filetype, php_sig_tif_ii, 4)) {
- return IMAGE_FILETYPE_TIFF_II;
- } else
- if (!memcmp(filetype, php_sig_tif_mm, 4)) {
- return IMAGE_FILETYPE_TIFF_MM;
- }
- if (!memcmp(filetype, php_sig_iff, 4)) {
- return IMAGE_FILETYPE_IFF;
- }
-
- if (php_stream_read(stream, filetype+4, 8) != 8) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Read error!");
- return IMAGE_FILETYPE_UNKNOWN;
- }
-/* BYTES READ: 12 */
- if (!memcmp(filetype, php_sig_jp2, 12)) {
- return IMAGE_FILETYPE_JP2;
- }
-
-/* AFTER ALL ABOVE FAILED */
- if (php_get_wbmp(stream, NULL, 1 TSRMLS_CC)) {
- return IMAGE_FILETYPE_WBMP;
- }
- if (php_get_xbm(stream, NULL TSRMLS_CC)) {
- return IMAGE_FILETYPE_XBM;
- }
- return IMAGE_FILETYPE_UNKNOWN;
-}
-/* }}} */
-
-/* {{{ proto array getimagesize(string imagefile [, array info])
- Get the size of an image as 4-element array */
-PHP_FUNCTION(getimagesize)
-{
- zval **arg1, **info = NULL;
- int itype = 0;
- char *temp;
- struct gfxinfo *result = NULL;
- php_stream * stream = NULL;
-
- switch(ZEND_NUM_ARGS()) {
-
- case 1:
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- RETVAL_FALSE;
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- break;
-
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &info) == FAILURE) {
- RETVAL_FALSE;
- WRONG_PARAM_COUNT;
- }
- zval_dtor(*info);
-
- array_init(*info);
-
- convert_to_string_ex(arg1);
- break;
-
- default:
- RETVAL_FALSE;
- WRONG_PARAM_COUNT;
- }
-
- stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), "rb", REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE, NULL);
-
- if (!stream) {
- RETURN_FALSE;
- }
-
- itype = php_getimagetype(stream, NULL TSRMLS_CC);
- switch( itype) {
- case IMAGE_FILETYPE_GIF:
- result = php_handle_gif (stream TSRMLS_CC);
- break;
- case IMAGE_FILETYPE_JPEG:
- if (info) {
- result = php_handle_jpeg(stream, *info TSRMLS_CC);
- } else {
- result = php_handle_jpeg(stream, NULL TSRMLS_CC);
- }
- break;
- case IMAGE_FILETYPE_PNG:
- result = php_handle_png(stream TSRMLS_CC);
- break;
- case IMAGE_FILETYPE_SWF:
- result = php_handle_swf(stream TSRMLS_CC);
- break;
-#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
- case IMAGE_FILETYPE_SWC:
- result = php_handle_swc(stream TSRMLS_CC);
- break;
-#endif
- case IMAGE_FILETYPE_PSD:
- result = php_handle_psd(stream TSRMLS_CC);
- break;
- case IMAGE_FILETYPE_BMP:
- result = php_handle_bmp(stream TSRMLS_CC);
- break;
- case IMAGE_FILETYPE_TIFF_II:
- result = php_handle_tiff(stream, NULL, 0 TSRMLS_CC);
- break;
- case IMAGE_FILETYPE_TIFF_MM:
- result = php_handle_tiff(stream, NULL, 1 TSRMLS_CC);
- break;
- case IMAGE_FILETYPE_JPC:
- result = php_handle_jpc(stream TSRMLS_CC);
- break;
- case IMAGE_FILETYPE_JP2:
- result = php_handle_jp2(stream TSRMLS_CC);
- break;
- case IMAGE_FILETYPE_IFF:
- result = php_handle_iff(stream TSRMLS_CC);
- break;
- case IMAGE_FILETYPE_WBMP:
- result = php_handle_wbmp(stream TSRMLS_CC);
- break;
- case IMAGE_FILETYPE_XBM:
- result = php_handle_xbm(stream TSRMLS_CC);
- break;
- default:
- case IMAGE_FILETYPE_UNKNOWN:
- break;
- }
-
- php_stream_close(stream);
-
- if (result) {
- array_init(return_value);
- add_index_long(return_value, 0, result->width);
- add_index_long(return_value, 1, result->height);
- add_index_long(return_value, 2, itype);
- spprintf(&temp, 0, "width=\"%d\" height=\"%d\"", result->width, result->height);
- add_index_string(return_value, 3, temp, 0);
-
- if (result->bits != 0) {
- add_assoc_long(return_value, "bits", result->bits);
- }
- if (result->channels != 0) {
- add_assoc_long(return_value, "channels", result->channels);
- }
- add_assoc_string(return_value, "mime", (char*)php_image_type_to_mime_type(itype), 1);
- efree(result);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c
deleted file mode 100644
index c6f0234cad..0000000000
--- a/ext/standard/incomplete_class.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#include "php.h"
-#include "basic_functions.h"
-#include "php_incomplete_class.h"
-
-#define INCOMPLETE_CLASS_MSG \
- "The script tried to execute a method or " \
- "access a property of an incomplete object. " \
- "Please ensure that the class definition <b>%s</b> of the object " \
- "you are trying to operate on was loaded _before_ " \
- "the session was started"
-
-
-/* {{{ incomplete_class_message
- */
-static void incomplete_class_message(zend_property_reference *ref, int error_type)
-{
- char buf[1024];
- char *class_name;
- TSRMLS_FETCH();
-
- class_name = php_lookup_class_name(ref->object, NULL, 0);
-
- if (!class_name)
- class_name = estrdup("unknown");
-
- snprintf(buf, sizeof(buf)-1, INCOMPLETE_CLASS_MSG, class_name);
-
- efree(class_name);
-
- php_error_docref(NULL TSRMLS_CC, error_type, "%s", buf);
-}
-/* }}} */
-
-/* {{{ incomplete_class_call_func
- */
-static void incomplete_class_call_func(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- incomplete_class_message(property_reference, E_ERROR);
-}
-/* }}} */
-
-/* {{{ incomplete_class_set_property
- */
-static int incomplete_class_set_property(zend_property_reference *property_reference, zval *value)
-{
- incomplete_class_message(property_reference, E_NOTICE);
-
- /* does not reach this point */
- return (0);
-}
-/* }}} */
-
-/* {{{ incomplete_class_get_property
- */
-static zval incomplete_class_get_property(zend_property_reference *property_reference)
-{
- zval foo;
-
- incomplete_class_message(property_reference, E_NOTICE);
-
- /* does not reach this point */
- memset(&foo, 0, sizeof(zval)); /* shut warnings up */
- return (foo);
-}
-/* }}} */
-
-/* {{{ php_create_incomplete_class
- */
-zend_class_entry *php_create_incomplete_class(TSRMLS_D)
-{
- zend_class_entry incomplete_class;
-
- INIT_OVERLOADED_CLASS_ENTRY(incomplete_class, INCOMPLETE_CLASS, NULL,
- incomplete_class_call_func,
- incomplete_class_get_property,
- incomplete_class_set_property);
-
- return zend_register_internal_class(&incomplete_class TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ php_lookup_class_name
- */
-char *php_lookup_class_name(zval *object, size_t *nlen, zend_bool del)
-{
- zval **val;
- char *retval = NULL;
- HashTable *object_properties;
- TSRMLS_FETCH();
-
- object_properties = Z_OBJPROP_P(object);
-
- if (zend_hash_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER), (void **) &val) == SUCCESS) {
- retval = estrndup(Z_STRVAL_PP(val), Z_STRLEN_PP(val));
-
- if (nlen)
- *nlen = Z_STRLEN_PP(val);
-
- if (del)
- zend_hash_del(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER));
- }
-
- return (retval);
-}
-/* }}} */
-
-/* {{{ php_store_class_name
- */
-void php_store_class_name(zval *object, const char *name, size_t len)
-{
- zval *val;
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(val);
-
- Z_TYPE_P(val) = IS_STRING;
- Z_STRVAL_P(val) = estrndup(name, len);
- Z_STRLEN_P(val) = len;
-
- zend_hash_update(Z_OBJPROP_P(object), MAGIC_MEMBER, sizeof(MAGIC_MEMBER), &val, sizeof(val), NULL);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/info.c b/ext/standard/info.c
deleted file mode 100644
index ca14bb7e7d..0000000000
--- a/ext/standard/info.c
+++ /dev/null
@@ -1,1048 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Zeev Suraski <zeev@zend.com> |
- | Colin Viebrock <colin@easydns.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "ext/standard/head.h"
-#include "ext/standard/html.h"
-#include "info.h"
-#include "credits.h"
-#include "css.h"
-#include "SAPI.h"
-#include <time.h>
-#include "php_main.h"
-#include "zend_globals.h" /* needs ELS */
-#include "zend_extensions.h"
-#include "zend_highlight.h"
-#ifdef HAVE_SYS_UTSNAME_H
-#include <sys/utsname.h>
-#endif
-
-#if HAVE_MBSTRING
-#include "ext/mbstring/mbstring.h"
-ZEND_EXTERN_MODULE_GLOBALS(mbstring)
-#endif
-
-#if HAVE_ICONV
-#include "ext/iconv/php_iconv.h"
-ZEND_EXTERN_MODULE_GLOBALS(iconv)
-#endif
-
-#define SECTION(name) if (!sapi_module.phpinfo_as_text) { \
- PUTS("<h2>" name "</h2>\n"); \
- } else { \
- php_info_print_table_start(); \
- php_info_print_table_header(1, name); \
- php_info_print_table_end(); \
- } \
-
-PHPAPI extern char *php_ini_opened_path;
-PHPAPI extern char *php_ini_scanned_files;
-
-/* {{{ _display_module_info
- */
-static int _display_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
-{
- int show_info_func = *((int *) arg);
-
- if (show_info_func && module->info_func) {
- if (!sapi_module.phpinfo_as_text) {
- php_printf("<h2><a name=\"module_%s\">%s</a></h2>\n", module->name, module->name);
- } else {
- php_info_print_table_start();
- php_info_print_table_header(1, module->name);
- php_info_print_table_end();
- }
- module->info_func(module TSRMLS_CC);
- } else if (!show_info_func && !module->info_func) {
- if (!sapi_module.phpinfo_as_text) {
- php_printf("<tr>");
- php_printf("<td>");
- php_printf("%s", module->name);
- php_printf("</td></tr>\n");
- } else {
- php_printf(module->name);
- php_printf("\n");
- }
- }
- return 0;
-}
-/* }}} */
-
-/* {{{ php_print_gpcse_array
- */
-static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC)
-{
- zval **data, **tmp, tmp2;
- char *string_key;
- uint string_len;
- ulong num_key;
- char *elem_esc = NULL;
-
- zend_is_auto_global(name, name_length TSRMLS_CC);
-
- if (zend_hash_find(&EG(symbol_table), name, name_length+1, (void **) &data)!=FAILURE
- && (Z_TYPE_PP(data)==IS_ARRAY)) {
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data));
- while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) &tmp) == SUCCESS) {
- if (!sapi_module.phpinfo_as_text) {
- PUTS("<tr>");
- PUTS("<td class=\"e\">");
-
- }
-
- PUTS(name);
- PUTS("[\"");
-
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL)) {
- case HASH_KEY_IS_STRING:
- if (!sapi_module.phpinfo_as_text) {
- elem_esc = php_info_html_esc(string_key TSRMLS_CC);
- PUTS(elem_esc);
- efree(elem_esc);
- } else {
- PUTS(string_key);
- }
- break;
- case HASH_KEY_IS_LONG:
- php_printf("%ld", num_key);
- break;
- }
- PUTS("\"]");
- if (!sapi_module.phpinfo_as_text) {
- PUTS("</td><td class=\"v\">");
- } else {
- PUTS(" => ");
- }
- if (Z_TYPE_PP(tmp) == IS_ARRAY) {
- if (!sapi_module.phpinfo_as_text) {
- PUTS("<pre>");
- }
- zend_print_zval_r(*tmp, 0 TSRMLS_CC);
- if (!sapi_module.phpinfo_as_text) {
- PUTS("</pre>");
- }
- } else if (Z_TYPE_PP(tmp) != IS_STRING) {
- tmp2 = **tmp;
- zval_copy_ctor(&tmp2);
- convert_to_string(&tmp2);
- if (!sapi_module.phpinfo_as_text) {
- if (Z_STRLEN(tmp2) == 0) {
- PUTS("<i>no value</i>");
- } else {
- elem_esc = php_info_html_esc(Z_STRVAL(tmp2) TSRMLS_CC);
- PUTS(elem_esc);
- efree(elem_esc);
- }
- } else {
- PUTS(Z_STRVAL(tmp2));
- }
- zval_dtor(&tmp2);
- } else {
- if (!sapi_module.phpinfo_as_text) {
- if (Z_STRLEN_PP(tmp) == 0) {
- PUTS("<i>no value</i>");
- } else {
- elem_esc = php_info_html_esc(Z_STRVAL_PP(tmp) TSRMLS_CC);
- PUTS(elem_esc);
- efree(elem_esc);
- }
- } else {
- PUTS(Z_STRVAL_PP(tmp));
- }
- }
- if (!sapi_module.phpinfo_as_text) {
- PUTS("</td></tr>\n");
- } else {
- PUTS("\n");
- }
- zend_hash_move_forward(Z_ARRVAL_PP(data));
- }
- }
-}
-/* }}} */
-
-/* {{{ php_info_print_style
- */
-void php_info_print_style(TSRMLS_D)
-{
- php_printf("<style type=\"text/css\"><!--\n");
- php_info_print_css(TSRMLS_C);
- php_printf("//--></style>\n");
-}
-/* }}} */
-
-
-/* {{{ php_info_html_esc
- */
-PHPAPI char *php_info_html_esc(char *string TSRMLS_DC)
-{
- int new_len;
- return php_escape_html_entities(string, strlen(string), &new_len, 0, ENT_NOQUOTES, NULL TSRMLS_CC);
-}
-/* }}} */
-
-
-/* {{{ php_get_uname
- */
-PHPAPI char *php_get_uname(char mode)
-{
- char *php_uname;
- char tmp_uname[256];
-#ifdef PHP_WIN32
- DWORD dwBuild=0;
- DWORD dwVersion = GetVersion();
- DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
- DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
- DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
- char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
- SYSTEM_INFO SysInfo;
-
- GetComputerName(ComputerName, &dwSize);
- GetSystemInfo(&SysInfo);
-
- if (mode == 's') {
- if (dwVersion < 0x80000000) {
- php_uname = "Windows NT";
- } else {
- php_uname = "Windows 9x";
- }
- } else if (mode == 'r') {
- snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d", dwWindowsMajorVersion, dwWindowsMinorVersion);
- php_uname = tmp_uname;
- } else if (mode == 'n') {
- php_uname = ComputerName;
- } else if (mode == 'v') {
- dwBuild = (DWORD)(HIWORD(dwVersion));
- snprintf(tmp_uname, sizeof(tmp_uname), "build %d", dwBuild);
- php_uname = tmp_uname;
- } else if (mode == 'm') {
- switch (SysInfo.wProcessorArchitecture) {
- case PROCESSOR_ARCHITECTURE_INTEL :
- snprintf(tmp_uname, sizeof(tmp_uname), "i%d", SysInfo.dwProcessorType);
- php_uname = tmp_uname;
- break;
- case PROCESSOR_ARCHITECTURE_MIPS :
- php_uname = "MIPS R4000";
- php_uname = tmp_uname;
- break;
- case PROCESSOR_ARCHITECTURE_ALPHA :
- snprintf(tmp_uname, sizeof(tmp_uname), "Alpha %d", SysInfo.wProcessorLevel);
- php_uname = tmp_uname;
- break;
- case PROCESSOR_ARCHITECTURE_PPC :
- snprintf(tmp_uname, sizeof(tmp_uname), "PPC 6%02d", SysInfo.wProcessorLevel);
- php_uname = tmp_uname;
- break;
- case PROCESSOR_ARCHITECTURE_IA64 :
- php_uname = "IA64";
- break;
-#if defined(PROCESSOR_ARCHITECTURE_IA32_ON_WIN64)
- case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 :
- php_uname = "IA32";
- break;
-#endif
-#if defined(PROCESSOR_ARCHITECTURE_AMD64)
- case PROCESSOR_ARCHITECTURE_AMD64 :
- php_uname = "AMD64";
- break;
-#endif
- case PROCESSOR_ARCHITECTURE_UNKNOWN :
- default :
- php_uname = "Unknown";
- break;
- }
- } else { /* assume mode == 'a' */
- /* Get build numbers for Windows NT or Win95 */
- if (dwVersion < 0x80000000){
- dwBuild = (DWORD)(HIWORD(dwVersion));
- snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d build %d",
- "Windows NT", ComputerName,
- dwWindowsMajorVersion, dwWindowsMinorVersion, dwBuild);
- } else {
- snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d",
- "Windows 9x", ComputerName,
- dwWindowsMajorVersion, dwWindowsMinorVersion);
- }
- php_uname = tmp_uname;
- }
-#else
-#ifdef HAVE_SYS_UTSNAME_H
- struct utsname buf;
- if (uname((struct utsname *)&buf) == -1) {
- php_uname = PHP_UNAME;
- } else {
- if (mode == 's') {
- php_uname = buf.sysname;
- } else if (mode == 'r') {
- php_uname = buf.release;
- } else if (mode == 'n') {
- php_uname = buf.nodename;
- } else if (mode == 'v') {
- php_uname = buf.version;
- } else if (mode == 'm') {
- php_uname = buf.machine;
- } else { /* assume mode == 'a' */
- snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %s %s %s",
- buf.sysname, buf.nodename, buf.release, buf.version,
- buf.machine);
- php_uname = tmp_uname;
- }
- }
-#else
- php_uname = PHP_UNAME;
-#endif
-#endif
- return estrdup(php_uname);
-}
-/* }}} */
-
-
-/* {{{ php_print_info_htmlhead
- */
-PHPAPI void php_print_info_htmlhead(TSRMLS_D)
-{
-
-/*** none of this is needed now ***
-
- const char *charset = NULL;
-
- if (SG(default_charset)) {
- charset = SG(default_charset);
- }
-
-#if HAVE_MBSTRING
- if (php_ob_handler_used("mb_output_handler" TSRMLS_CC)) {
- if (MBSTRG(current_http_output_encoding) == mbfl_no_encoding_pass) {
- charset = "US-ASCII";
- } else {
- charset = mbfl_no2preferred_mime_name(MBSTRG(current_http_output_encoding));
- }
- }
-#endif
-
-#if HAVE_ICONV
- if (php_ob_handler_used("ob_iconv_handler" TSRMLS_CC)) {
- charset = ICONVG(output_encoding);
- }
-#endif
-
- if (!charset || !charset[0]) {
- charset = "US-ASCII";
- }
-
-*** none of that is needed now ***/
-
-
- PUTS("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n");
- PUTS("<html>");
- PUTS("<head>\n");
- php_info_print_style(TSRMLS_C);
- PUTS("<title>phpinfo()</title>");
-/*
- php_printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\" />\n", charset);
-*/
- PUTS("</head>\n");
- PUTS("<body><div class=\"center\">\n");
-}
-/* }}} */
-
-/* {{{ module_name_cmp */
-static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
-{
- Bucket *f = *((Bucket **) a);
- Bucket *s = *((Bucket **) b);
-
- return strcmp(((zend_module_entry *)f->pData)->name,
- ((zend_module_entry *)s->pData)->name);
-}
-/* }}} */
-
-/* {{{ php_print_info
- */
-PHPAPI void php_print_info(int flag TSRMLS_DC)
-{
- char **env, *tmp1, *tmp2;
- char *php_uname;
- int expose_php = INI_INT("expose_php");
-
- if (!sapi_module.phpinfo_as_text) {
- php_print_info_htmlhead(TSRMLS_C);
- } else {
- PUTS("phpinfo()\n");
- }
-
- if (flag & PHP_INFO_GENERAL) {
- char *zend_version = get_zend_version();
- char temp_api[9];
-
- php_uname = php_get_uname('a');
-
- if (!sapi_module.phpinfo_as_text) {
- php_info_print_box_start(1);
- }
-
- if (expose_php && !sapi_module.phpinfo_as_text) {
- PUTS("<a href=\"http://www.php.net/\"><img border=\"0\" src=\"");
- if (SG(request_info).request_uri) {
- PUTS(SG(request_info).request_uri);
- }
- PUTS("?=");
- PUTS(php_logo_guid());
- PUTS("\" alt=\"PHP Logo\" /></a>");
- }
-
- if (!sapi_module.phpinfo_as_text) {
- php_printf("<h1 class=\"p\">PHP Version %s</h1>\n", PHP_VERSION);
- } else {
- php_info_print_table_row(2, "PHP Version", PHP_VERSION);
- }
- php_info_print_box_end();
- php_info_print_table_start();
- php_info_print_table_row(2, "System", php_uname );
- php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__ );
-#ifdef CONFIGURE_COMMAND
- php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND );
-#endif
- if (sapi_module.pretty_name) {
- php_info_print_table_row(2, "Server API", sapi_module.pretty_name );
- }
-
-#ifdef VIRTUAL_DIR
- php_info_print_table_row(2, "Virtual Directory Support", "enabled" );
-#else
- php_info_print_table_row(2, "Virtual Directory Support", "disabled" );
-#endif
-
- php_info_print_table_row(2, "Configuration File (php.ini) Path", php_ini_opened_path?php_ini_opened_path:PHP_CONFIG_FILE_PATH);
-
- if (strlen(PHP_CONFIG_FILE_SCAN_DIR)) {
- php_info_print_table_row(2, "Scan this dir for additional .ini files", PHP_CONFIG_FILE_SCAN_DIR);
- if (php_ini_scanned_files) {
- php_info_print_table_row(2, "additional .ini files parsed", php_ini_scanned_files);
- }
- }
-
- snprintf(temp_api, sizeof(temp_api), "%d", PHP_API_VERSION);
- php_info_print_table_row(2, "PHP API", temp_api);
-
- snprintf(temp_api, sizeof(temp_api), "%d", ZEND_MODULE_API_NO);
- php_info_print_table_row(2, "PHP Extension", temp_api);
-
- snprintf(temp_api, sizeof(temp_api), "%d", ZEND_EXTENSION_API_NO);
- php_info_print_table_row(2, "Zend Extension", temp_api);
-
-#if ZEND_DEBUG
- php_info_print_table_row(2, "Debug Build", "yes" );
-#else
- php_info_print_table_row(2, "Debug Build", "no" );
-#endif
-
-#ifdef ZTS
- php_info_print_table_row(2, "Thread Safety", "enabled" );
-#else
- php_info_print_table_row(2, "Thread Safety", "disabled" );
-#endif
-
- {
- HashTable *url_stream_wrappers_hash;
- char *stream_protocol, *stream_protocols_buf = NULL;
- int stream_protocol_len, stream_protocols_buf_len = 0;
-
- if ((url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash())) {
- for (zend_hash_internal_pointer_reset(url_stream_wrappers_hash);
- zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, &stream_protocol_len, NULL, 0, NULL) == HASH_KEY_IS_STRING;
- zend_hash_move_forward(url_stream_wrappers_hash)) {
- stream_protocols_buf = erealloc(stream_protocols_buf, stream_protocols_buf_len + stream_protocol_len + 2 + 1);
- memcpy(stream_protocols_buf + stream_protocols_buf_len, stream_protocol, stream_protocol_len);
- stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len] = ',';
- stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len + 1] = ' ';
- stream_protocols_buf_len += stream_protocol_len + 2;
- }
- if (stream_protocols_buf) {
- stream_protocols_buf[stream_protocols_buf_len - 2] = ' ';
- stream_protocols_buf[stream_protocols_buf_len] = 0;
- php_info_print_table_row(2, "Registered PHP Streams", stream_protocols_buf);
- efree(stream_protocols_buf);
- } else {
- /* Any chances we will ever hit this? */
- php_info_print_table_row(2, "Registered PHP Streams", "no streams registered");
- }
- } else {
- /* Any chances we will ever hit this? */
- php_info_print_table_row(2, "PHP Streams", "disabled"); /* ?? */
- }
- }
-
- php_info_print_table_end();
-
- /* Zend Engine */
- php_info_print_box_start(0);
- if (expose_php && !sapi_module.phpinfo_as_text) {
- PUTS("<a href=\"http://www.zend.com/\"><img border=\"0\" src=\"");
- if (SG(request_info).request_uri) {
- PUTS(SG(request_info).request_uri);
- }
- PUTS("?="ZEND_LOGO_GUID"\" alt=\"Zend logo\" /></a>\n");
- }
- PUTS("This program makes use of the Zend Scripting Language Engine:");
- PUTS(!sapi_module.phpinfo_as_text?"<br />":"\n");
- if (sapi_module.phpinfo_as_text) {
- PUTS(zend_version);
- } else {
- zend_html_puts(zend_version, strlen(zend_version) TSRMLS_CC);
- }
- php_info_print_box_end();
- efree(php_uname);
- }
-
- if ((flag & PHP_INFO_CREDITS) && expose_php && !sapi_module.phpinfo_as_text) {
- php_info_print_hr();
- PUTS("<h1><a href=\"");
- if (SG(request_info).request_uri) {
- PUTS(SG(request_info).request_uri);
- }
- PUTS("?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000\">");
- PUTS("PHP Credits");
- PUTS("</a></h1>\n");
- }
-
- zend_ini_sort_entries(TSRMLS_C);
-
- if (flag & PHP_INFO_CONFIGURATION) {
- php_info_print_hr();
- if (!sapi_module.phpinfo_as_text) {
- PUTS("<h1>Configuration</h1>\n");
- } else {
- SECTION("Configuration");
- }
- SECTION("PHP Core");
- display_ini_entries(NULL);
- }
-
- if (flag & PHP_INFO_MODULES) {
- int show_info_func;
- HashTable sorted_registry;
- zend_module_entry tmp;
-
- zend_hash_init(&sorted_registry, 50, NULL, NULL, 1);
- zend_hash_copy(&sorted_registry, &module_registry, NULL, &tmp, sizeof(zend_module_entry));
- zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC);
-
- show_info_func = 1;
- zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) _display_module_info, &show_info_func TSRMLS_CC);
-
- SECTION("Additional Modules");
- php_info_print_table_start();
- php_info_print_table_header(1, "Module Name");
- show_info_func = 0;
- zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) _display_module_info, &show_info_func TSRMLS_CC);
- php_info_print_table_end();
-
- zend_hash_destroy(&sorted_registry);
- }
-
- if (flag & PHP_INFO_ENVIRONMENT) {
- SECTION("Environment");
- php_info_print_table_start();
- php_info_print_table_header(2, "Variable", "Value");
- for (env=environ; env!=NULL && *env !=NULL; env++) {
- tmp1 = estrdup(*env);
- if (!(tmp2=strchr(tmp1,'='))) { /* malformed entry? */
- efree(tmp1);
- continue;
- }
- *tmp2 = 0;
- tmp2++;
- php_info_print_table_row(2, tmp1, tmp2);
- efree(tmp1);
- }
- php_info_print_table_end();
- }
-
- if (flag & PHP_INFO_VARIABLES) {
- pval **data;
-
- SECTION("PHP Variables");
-
- php_info_print_table_start();
- php_info_print_table_header(2, "Variable", "Value");
- if (zend_hash_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void **) &data) != FAILURE) {
- php_info_print_table_row(2, "PHP_SELF", Z_STRVAL_PP(data));
- }
- if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE"), (void **) &data) != FAILURE) {
- php_info_print_table_row(2, "PHP_AUTH_TYPE", Z_STRVAL_PP(data));
- }
- if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), (void **) &data) != FAILURE) {
- php_info_print_table_row(2, "PHP_AUTH_USER", Z_STRVAL_PP(data));
- }
- if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) {
- php_info_print_table_row(2, "PHP_AUTH_PW", Z_STRVAL_PP(data));
- }
- php_print_gpcse_array("_REQUEST", sizeof("_REQUEST")-1 TSRMLS_CC);
- php_print_gpcse_array("_GET", sizeof("_GET")-1 TSRMLS_CC);
- php_print_gpcse_array("_POST", sizeof("_POST")-1 TSRMLS_CC);
- php_print_gpcse_array("_FILES", sizeof("_FILES")-1 TSRMLS_CC);
- php_print_gpcse_array("_COOKIE", sizeof("_COOKIE")-1 TSRMLS_CC);
- php_print_gpcse_array("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC);
- php_print_gpcse_array("_ENV", sizeof("_ENV")-1 TSRMLS_CC);
- php_info_print_table_end();
- }
-
- if (flag & PHP_INFO_LICENSE) {
- if (!sapi_module.phpinfo_as_text) {
- SECTION("PHP License");
- php_info_print_box_start(0);
- PUTS("<p>\n");
- PUTS("This program is free software; you can redistribute it and/or modify ");
- PUTS("it under the terms of the PHP License as published by the PHP Group ");
- PUTS("and included in the distribution in the file: LICENSE\n");
- PUTS("</p>\n");
- PUTS("<p>");
- PUTS("This program is distributed in the hope that it will be useful, ");
- PUTS("but WITHOUT ANY WARRANTY; without even the implied warranty of ");
- PUTS("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
- PUTS("</p>\n");
- PUTS("<p>");
- PUTS("If you did not receive a copy of the PHP license, or have any questions about ");
- PUTS("PHP licensing, please contact license@php.net.\n");
- PUTS("</p>\n");
- php_info_print_box_end();
- } else {
- PUTS("\nPHP License\n");
- PUTS("This program is free software; you can redistribute it and/or modify\n");
- PUTS("it under the terms of the PHP License as published by the PHP Group\n");
- PUTS("and included in the distribution in the file: LICENSE\n");
- PUTS("\n");
- PUTS("This program is distributed in the hope that it will be useful,\n");
- PUTS("but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
- PUTS("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
- PUTS("\n");
- PUTS("If you did not receive a copy of the PHP license, or have any\n");
- PUTS("questions about PHP licensing, please contact license@php.net.\n");
- }
- }
- if (!sapi_module.phpinfo_as_text) {
- PUTS("</div></body></html>");
- }
-}
-/* }}} */
-
-
-PHPAPI void php_info_print_table_start()
-{
- if (!sapi_module.phpinfo_as_text) {
- php_printf("<table border=\"0\" cellpadding=\"3\" width=\"600\">\n");
- } else {
- php_printf("\n");
- }
-}
-
-PHPAPI void php_info_print_table_end()
-{
- if (!sapi_module.phpinfo_as_text) {
- php_printf("</table><br />\n");
- }
-
-}
-
-PHPAPI void php_info_print_box_start(int flag)
-{
- php_info_print_table_start();
- if (flag) {
- if (!sapi_module.phpinfo_as_text) {
- php_printf("<tr class=\"h\"><td>\n");
- }
- } else {
- if (!sapi_module.phpinfo_as_text) {
- php_printf("<tr class=\"v\"><td>\n");
- } else {
- php_printf("\n");
- }
- }
-}
-
-PHPAPI void php_info_print_box_end()
-{
- if (!sapi_module.phpinfo_as_text) {
- php_printf("</td></tr>\n");
- }
- php_info_print_table_end();
-}
-
-PHPAPI void php_info_print_hr()
-{
- if (!sapi_module.phpinfo_as_text) {
- php_printf("<hr />\n");
- } else {
- php_printf("\n\n _______________________________________________________________________\n\n");
- }
-}
-
-PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header)
-{
- int spaces;
-
- if (!sapi_module.phpinfo_as_text) {
- php_printf("<tr class=\"h\"><th colspan=\"%d\">%s</th></tr>\n", num_cols, header );
- } else {
- spaces = (74 - strlen(header));
- php_printf("%*s%s%*s\n", (int)(spaces/2), " ", header, (int)(spaces/2), " ");
- }
-}
-
-/* {{{ php_info_print_table_header
- */
-PHPAPI void php_info_print_table_header(int num_cols, ...)
-{
- int i;
- va_list row_elements;
- char *row_element;
-
- TSRMLS_FETCH();
-
- va_start(row_elements, num_cols);
- if (!sapi_module.phpinfo_as_text) {
- php_printf("<tr class=\"h\">");
- }
- for (i=0; i<num_cols; i++) {
- row_element = va_arg(row_elements, char *);
- if (!row_element || !*row_element) {
- row_element = " ";
- }
- if (!sapi_module.phpinfo_as_text) {
- PUTS("<th>");
- PUTS(row_element);
- PUTS("</th>");
- } else {
- PUTS(row_element);
- if (i < num_cols-1) {
- PUTS(" => ");
- } else {
- PUTS("\n");
- }
- }
- }
- if (!sapi_module.phpinfo_as_text) {
- php_printf("</tr>\n");
- }
-
- va_end(row_elements);
-}
-/* }}} */
-
-/* {{{ php_info_print_table_row_internal
- */
-static void php_info_print_table_row_internal(int num_cols,
- const char *value_class, va_list row_elements)
-{
- int i;
- char *row_element;
- char *elem_esc = NULL;
-/*
- int elem_esc_len;
-*/
-
- TSRMLS_FETCH();
-
- if (!sapi_module.phpinfo_as_text) {
- php_printf("<tr>");
- }
- for (i=0; i<num_cols; i++) {
- if (!sapi_module.phpinfo_as_text) {
- php_printf("<td class=\"%s\">",
- (i==0 ? "e" : value_class )
- );
- }
- row_element = va_arg(row_elements, char *);
- if (!row_element || !*row_element) {
- if (!sapi_module.phpinfo_as_text) {
- PUTS( "<i>no value</i>" );
- } else {
- PUTS( " " );
- }
- } else {
- if (!sapi_module.phpinfo_as_text) {
- elem_esc = php_info_html_esc(row_element TSRMLS_CC);
- PUTS(elem_esc);
- efree(elem_esc);
- } else {
- PUTS(row_element);
- if (i < num_cols-1) {
- PUTS(" => ");
- }
- }
- }
- if (!sapi_module.phpinfo_as_text) {
- php_printf(" </td>");
- } else if (i == (num_cols - 1)) {
- PUTS("\n");
- }
- }
- if (!sapi_module.phpinfo_as_text) {
- php_printf("</tr>\n");
- }
-}
-/* }}} */
-
-/* {{{ php_info_print_table_row
- */
-PHPAPI void php_info_print_table_row(int num_cols, ...)
-{
- va_list row_elements;
-
- va_start(row_elements, num_cols);
- php_info_print_table_row_internal(num_cols, "v", row_elements);
- va_end(row_elements);
-}
-/* }}} */
-
-/* {{{ php_info_print_table_row_ex
- */
-PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class,
- ...)
-{
- va_list row_elements;
-
- va_start(row_elements, value_class);
- php_info_print_table_row_internal(num_cols, value_class, row_elements);
- va_end(row_elements);
-}
-/* }}} */
-
-/* {{{ register_phpinfo_constants
- */
-void register_phpinfo_constants(INIT_FUNC_ARGS)
-{
- REGISTER_LONG_CONSTANT("INFO_GENERAL", PHP_INFO_GENERAL, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("INFO_CREDITS", PHP_INFO_CREDITS, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("INFO_CONFIGURATION", PHP_INFO_CONFIGURATION, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("INFO_MODULES", PHP_INFO_MODULES, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("INFO_ENVIRONMENT", PHP_INFO_ENVIRONMENT, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_GROUP", PHP_CREDITS_GROUP, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_GENERAL", PHP_CREDITS_GENERAL, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_SAPI", PHP_CREDITS_SAPI, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_MODULES", PHP_CREDITS_MODULES, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_DOCS", PHP_CREDITS_DOCS, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_FULLPAGE", PHP_CREDITS_FULLPAGE, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_QA", PHP_CREDITS_QA, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_ALL", PHP_CREDITS_ALL, CONST_PERSISTENT|CONST_CS);
-}
-/* }}} */
-
-/* {{{ proto void phpinfo([int what])
- Output a page of useful information about PHP and the current request */
-PHP_FUNCTION(phpinfo)
-{
- int argc = ZEND_NUM_ARGS();
- long flag;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "|l", &flag) == FAILURE) {
- return;
- }
-
- if(!argc) {
- flag = PHP_INFO_ALL;
- }
-
- /* Andale! Andale! Yee-Hah! */
- php_start_ob_buffer(NULL, 4096, 0 TSRMLS_CC);
- php_print_info(flag TSRMLS_CC);
- php_end_ob_buffer(1, 0 TSRMLS_CC);
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string phpversion([string extension])
- Return the current PHP version */
-PHP_FUNCTION(phpversion)
-{
- zval **arg;
- int argc = ZEND_NUM_ARGS();
-
- if (argc == 0) {
- RETURN_STRING(PHP_VERSION, 1);
- } else if (argc == 1 && zend_get_parameters_ex(1, &arg) == SUCCESS) {
- char *version;
- convert_to_string_ex(arg);
- version = zend_get_module_version(Z_STRVAL_PP(arg));
- if (version == NULL) {
- RETURN_FALSE;
- }
- RETURN_STRING(version, 1);
- } else {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-/* {{{ proto void phpcredits([int flag])
- Prints the list of people who've contributed to the PHP project */
-PHP_FUNCTION(phpcredits)
-{
- int argc = ZEND_NUM_ARGS();
- long flag;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "|l", &flag) == FAILURE) {
- return;
- }
-
- if(!argc) {
- flag = PHP_CREDITS_ALL;
- }
-
- php_print_credits(flag TSRMLS_CC);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ php_logo_guid
- */
-PHPAPI char *php_logo_guid()
-{
- char *logo_guid;
-
- time_t the_time;
- struct tm *ta, tmbuf;
-
- the_time = time(NULL);
- ta = php_localtime_r(&the_time, &tmbuf);
-
- if ((ta->tm_mon==3) && (ta->tm_mday==1)) {
- logo_guid = PHP_EGG_LOGO_GUID;
- } else {
- logo_guid = PHP_LOGO_GUID;
- }
-
- return estrdup(logo_guid);
-
-}
-/* }}} */
-
-/* {{{ proto string php_logo_guid(void)
- Return the special ID used to request the PHP logo in phpinfo screens*/
-PHP_FUNCTION(php_logo_guid)
-{
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_STRING(php_logo_guid(), 1);
-}
-/* }}} */
-
-/* {{{ proto string php_real_logo_guid(void)
- Return the special ID used to request the PHP logo in phpinfo screens*/
-PHP_FUNCTION(php_real_logo_guid)
-{
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_STRINGL(PHP_LOGO_GUID, sizeof(PHP_LOGO_GUID)-1, 1);
-}
-/* }}} */
-
-/* {{{ proto string php_egg_logo_guid(void)
- Return the special ID used to request the PHP logo in phpinfo screens*/
-PHP_FUNCTION(php_egg_logo_guid)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_STRINGL(PHP_EGG_LOGO_GUID, sizeof(PHP_EGG_LOGO_GUID)-1, 1);
-}
-/* }}} */
-
-/* {{{ proto string zend_logo_guid(void)
- Return the special ID used to request the Zend logo in phpinfo screens*/
-PHP_FUNCTION(zend_logo_guid)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1);
-}
-/* }}} */
-
-/* {{{ proto string php_sapi_name(void)
- Return the current SAPI module name */
-PHP_FUNCTION(php_sapi_name)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- if (sapi_module.name) {
- RETURN_STRING(sapi_module.name, 1);
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto string php_uname(void)
- Return information about the system PHP was built on */
-PHP_FUNCTION(php_uname)
-{
- char *mode = "a";
- int modelen;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &mode, &modelen) == FAILURE) {
- return;
- }
- RETURN_STRING(php_get_uname(*mode), 0);
-}
-
-/* }}} */
-
-/* {{{ proto string php_ini_scanned_files(void)
- Return comma-separated string of .ini files parsed from the additional ini dir */
-PHP_FUNCTION(php_ini_scanned_files)
-{
- if (strlen(PHP_CONFIG_FILE_SCAN_DIR)) {
- RETURN_STRING(php_ini_scanned_files, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/info.h b/ext/standard/info.h
deleted file mode 100644
index 8a0403d8d1..0000000000
--- a/ext/standard/info.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef INFO_H
-#define INFO_H
-
-#define PHP_ENTRY_NAME_COLOR "#ccccff"
-#define PHP_CONTENTS_COLOR "#cccccc"
-#define PHP_HEADER_COLOR "#9999cc"
-
-#define PHP_INFO_GENERAL (1<<0)
-#define PHP_INFO_CREDITS (1<<1)
-#define PHP_INFO_CONFIGURATION (1<<2)
-#define PHP_INFO_MODULES (1<<3)
-#define PHP_INFO_ENVIRONMENT (1<<4)
-#define PHP_INFO_VARIABLES (1<<5)
-#define PHP_INFO_LICENSE (1<<6)
-#define PHP_INFO_ALL 0xFFFFFFFF
-
-#ifndef HAVE_CREDITS_DEFS
-#define HAVE_CREDITS_DEFS
-
-#define PHP_CREDITS_GROUP (1<<0)
-#define PHP_CREDITS_GENERAL (1<<1)
-#define PHP_CREDITS_SAPI (1<<2)
-#define PHP_CREDITS_MODULES (1<<3)
-#define PHP_CREDITS_DOCS (1<<4)
-#define PHP_CREDITS_FULLPAGE (1<<5)
-#define PHP_CREDITS_QA (1<<6)
-#define PHP_CREDITS_WEB (1<<7)
-#define PHP_CREDITS_ALL 0xFFFFFFFF
-
-#endif /* HAVE_CREDITS_DEFS */
-
-#define PHP_LOGO_GUID "PHPE9568F34-D428-11d2-A769-00AA001ACF42"
-#define PHP_EGG_LOGO_GUID "PHPE9568F36-D428-11d2-A769-00AA001ACF42"
-#define ZEND_LOGO_GUID "PHPE9568F35-D428-11d2-A769-00AA001ACF42"
-#define PHP_CREDITS_GUID "PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000"
-
-PHP_FUNCTION(phpversion);
-PHP_FUNCTION(phpinfo);
-PHP_FUNCTION(phpcredits);
-PHP_FUNCTION(php_logo_guid);
-PHP_FUNCTION(php_real_logo_guid);
-PHP_FUNCTION(zend_logo_guid);
-PHP_FUNCTION(php_egg_logo_guid);
-PHP_FUNCTION(php_sapi_name);
-PHP_FUNCTION(php_uname);
-PHP_FUNCTION(php_ini_scanned_files);
-PHPAPI char *php_info_html_esc(char *string TSRMLS_DC);
-PHPAPI void php_print_info_htmlhead(TSRMLS_D);
-PHPAPI void php_print_info(int flag TSRMLS_DC);
-PHPAPI void php_print_style(void);
-PHPAPI void php_info_print_style(TSRMLS_D);
-PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header);
-PHPAPI void php_info_print_table_header(int num_cols, ...);
-PHPAPI void php_info_print_table_row(int num_cols, ...);
-PHPAPI void php_info_print_table_row_ex(int num_cols, const char *, ...);
-PHPAPI void php_info_print_table_start(void);
-PHPAPI void php_info_print_table_end(void);
-PHPAPI void php_info_print_box_start(int bg);
-PHPAPI void php_info_print_box_end(void);
-PHPAPI void php_info_print_hr(void);
-PHPAPI char *php_logo_guid(void);
-
-void register_phpinfo_constants(INIT_FUNC_ARGS);
-
-#endif /* INFO_H */
diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c
deleted file mode 100644
index 1e69dfa79b..0000000000
--- a/ext/standard/iptc.c
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*
- * Functions to parse & compse IPTC data.
- * PhotoShop >= 3.0 can read and write textual data to JPEG files.
- * ... more to come .....
- *
- * i know, parts of this is now duplicated in image.c
- * but in this case i think it's okay!
- */
-
-/*
- * TODO:
- * - add IPTC translation table
- */
-
-#include "php.h"
-#include "php_iptc.h"
-#include "ext/standard/head.h"
-
-#include <sys/stat.h>
-
-
-/* some defines for the different JPEG block types */
-#define M_SOF0 0xC0 /* Start Of Frame N */
-#define M_SOF1 0xC1 /* N indicates which compression process */
-#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */
-#define M_SOF3 0xC3
-#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */
-#define M_SOF6 0xC6
-#define M_SOF7 0xC7
-#define M_SOF9 0xC9
-#define M_SOF10 0xCA
-#define M_SOF11 0xCB
-#define M_SOF13 0xCD
-#define M_SOF14 0xCE
-#define M_SOF15 0xCF
-#define M_SOI 0xD8
-#define M_EOI 0xD9 /* End Of Image (end of datastream) */
-#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */
-#define M_APP0 0xe0
-#define M_APP1 0xe1
-#define M_APP2 0xe2
-#define M_APP3 0xe3
-#define M_APP4 0xe4
-#define M_APP5 0xe5
-#define M_APP6 0xe6
-#define M_APP7 0xe7
-#define M_APP8 0xe8
-#define M_APP9 0xe9
-#define M_APP10 0xea
-#define M_APP11 0xeb
-#define M_APP12 0xec
-#define M_APP13 0xed
-#define M_APP14 0xee
-#define M_APP15 0xef
-
-/* {{{ php_iptc_put1
- */
-static int php_iptc_put1(FILE *fp, int spool, unsigned char c, unsigned char **spoolbuf TSRMLS_DC)
-{
- if (spool > 0)
- PUTC(c);
-
- if (spoolbuf) *(*spoolbuf)++ = c;
-
- return c;
-}
-/* }}} */
-
-/* {{{ php_iptc_get1
- */
-static int php_iptc_get1(FILE *fp, int spool, unsigned char **spoolbuf TSRMLS_DC)
-{
- int c;
- char cc;
-
- c = getc(fp);
-
- if (c == EOF) return EOF;
-
- if (spool > 0) {
- cc = c;
- PUTC(cc);
- }
-
- if (spoolbuf) *(*spoolbuf)++ = c;
-
- return c;
-}
-/* }}} */
-
-/* {{{ php_iptc_read_remaining
- */
-static int php_iptc_read_remaining(FILE *fp, int spool, unsigned char **spoolbuf TSRMLS_DC)
-{
- while (php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC) != EOF) continue;
-
- return M_EOI;
-}
-/* }}} */
-
-/* {{{ php_iptc_skip_variable
- */
-static int php_iptc_skip_variable(FILE *fp, int spool, unsigned char **spoolbuf TSRMLS_DC)
-{
- unsigned int length;
- int c1, c2;
-
- if ((c1 = php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC)) == EOF) return M_EOI;
-
- if ((c2 = php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC)) == EOF) return M_EOI;
-
- length = (((unsigned char) c1) << 8) + ((unsigned char) c2);
-
- length -= 2;
-
- while (length--)
- if (php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC) == EOF) return M_EOI;
-
- return 0;
-}
-/* }}} */
-
-/* {{{ php_iptc_next_marker
- */
-static int php_iptc_next_marker(FILE *fp, int spool, unsigned char **spoolbuf TSRMLS_DC)
-{
- int c;
-
- /* skip unimportant stuff */
-
- c = php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC);
-
- if (c == EOF) return M_EOI;
-
- while (c != 0xff) {
- if ((c = php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC)) == EOF)
- return M_EOI; /* we hit EOF */
- }
-
- /* get marker byte, swallowing possible padding */
- do {
- c = php_iptc_get1(fp, 0, 0 TSRMLS_CC);
- if (c == EOF)
- return M_EOI; /* we hit EOF */
- else
- if (c == 0xff)
- php_iptc_put1(fp, spool, (unsigned char)c, spoolbuf TSRMLS_CC);
- } while (c == 0xff);
-
- return (unsigned int) c;
-}
-/* }}} */
-
-static char psheader[] = "\xFF\xED\0\0Photoshop 3.0\08BIM\x04\x04\0\0\0\0";
-
-/* {{{ proto array iptcembed(string iptcdata, string jpeg_file_name [, int spool])
- Embed binary IPTC data into a JPEG image. */
-PHP_FUNCTION(iptcembed)
-{
- zval **iptcdata, **jpeg_file, **spool_flag;
- FILE *fp;
- unsigned int marker;
- unsigned int spool = 0, done = 0, inx, len;
- unsigned char *spoolbuf=0, *poi=0;
- struct stat sb;
-
- switch(ZEND_NUM_ARGS()){
- case 3:
- if (zend_get_parameters_ex(3, &iptcdata, &jpeg_file, &spool_flag) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(iptcdata);
- convert_to_string_ex(jpeg_file);
- convert_to_long_ex(spool_flag);
- spool = Z_LVAL_PP(spool_flag);
- break;
-
- case 2:
- if (zend_get_parameters_ex(2, &iptcdata, &jpeg_file) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(iptcdata);
- convert_to_string_ex(jpeg_file);
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (php_check_open_basedir(Z_STRVAL_PP(jpeg_file) TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if ((fp = VCWD_FOPEN(Z_STRVAL_PP(jpeg_file), "rb")) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open %s", Z_STRVAL_PP(jpeg_file));
- RETURN_FALSE;
- }
-
- len = Z_STRLEN_PP(iptcdata);
-
- if (spool < 2) {
- fstat(fileno(fp), &sb);
-
- poi = spoolbuf = emalloc(len + sizeof(psheader) + sb.st_size + 1024);
-
- if (! spoolbuf) {
- fclose(fp);
- RETURN_FALSE;
- }
- }
-
- if (php_iptc_get1(fp, spool, poi?&poi:0 TSRMLS_CC) != 0xFF) {
- fclose(fp);
- RETURN_FALSE;
- }
-
- if (php_iptc_get1(fp, spool, poi?&poi:0 TSRMLS_CC) != 0xD8) {
- fclose(fp);
- RETURN_FALSE;
- }
-
- while (!done) {
- marker = php_iptc_next_marker(fp, spool, poi?&poi:0 TSRMLS_CC);
-
- if (marker == M_EOI) { /* EOF */
- break;
- } else if (marker != M_APP13) {
- php_iptc_put1(fp, spool, (unsigned char)marker, poi?&poi:0 TSRMLS_CC);
- }
-
- switch (marker) {
- case M_APP13:
- /* we are going to write a new APP13 marker, so don't output the old one */
- php_iptc_skip_variable(fp, 0, 0 TSRMLS_CC);
- php_iptc_read_remaining(fp, spool, poi?&poi:0 TSRMLS_CC);
- done = 1;
- break;
-
- case M_APP0:
- /* APP0 is in each and every JPEG, so when we hit APP0 we insert our new APP13! */
- php_iptc_skip_variable(fp, spool, poi?&poi:0 TSRMLS_CC);
-
- if (len & 1) len++; /* make the length even */
-
- psheader[ 2 ] = (len+28)>>8;
- psheader[ 3 ] = (len+28)&0xff;
-
- for (inx = 0; inx < 28; inx++)
- php_iptc_put1(fp, spool, psheader[inx], poi?&poi:0 TSRMLS_CC);
-
- php_iptc_put1(fp, spool, (unsigned char)(len>>8), poi?&poi:0 TSRMLS_CC);
- php_iptc_put1(fp, spool, (unsigned char)(len&0xff), poi?&poi:0 TSRMLS_CC);
-
- for (inx = 0; inx < len; inx++)
- php_iptc_put1(fp, spool, Z_STRVAL_PP(iptcdata)[inx], poi?&poi:0 TSRMLS_CC);
- break;
-
- case M_SOS:
- /* we hit data, no more marker-inserting can be done! */
- php_iptc_read_remaining(fp, spool, poi?&poi:0 TSRMLS_CC);
- done = 1;
- break;
-
- default:
- php_iptc_skip_variable(fp, spool, poi?&poi:0 TSRMLS_CC);
- break;
- }
- }
-
- fclose(fp);
-
- if (spool < 2) {
- RETVAL_STRINGL(spoolbuf, poi - spoolbuf, 0);
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto array iptcparse(string iptcdata)
- Parse binary IPTC-data into associative array */
-PHP_FUNCTION(iptcparse)
-{
- unsigned int length, inx, len, tagsfound;
- unsigned char *buffer;
- unsigned char recnum, dataset;
- unsigned char key[ 16 ];
- zval *values, **str, **element;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- inx = 0;
- length = Z_STRLEN_PP(str);
- buffer = Z_STRVAL_PP(str);
-
- tagsfound = 0; /* number of tags already found */
-
- while (inx < length) { /* find 1st tag */
- if ((buffer[inx] == 0x1c) && (buffer[inx+1] == 0x02)){
- break;
- } else {
- inx++;
- }
- }
-
- while (inx < length) {
- if (buffer[ inx++ ] != 0x1c) {
- break; /* we ran against some data which does not conform to IPTC - stop parsing! */
- }
-
- if ((inx + 4) >= length)
- break;
-
- dataset = buffer[ inx++ ];
- recnum = buffer[ inx++ ];
-
- if (buffer[ inx ] & (unsigned char) 0x80) { /* long tag */
- len = (((long) buffer[ inx + 2 ]) << 24) + (((long) buffer[ inx + 3 ]) << 16) +
- (((long) buffer[ inx + 4 ]) << 8) + (((long) buffer[ inx + 5 ]));
- inx += 6;
- } else { /* short tag */
- len = (((unsigned short) buffer[ inx ])<<8) | (unsigned short)buffer[ inx+1 ];
- inx += 2;
- }
-
- sprintf(key, "%d#%03d", (unsigned int) dataset, (unsigned int) recnum);
-
- if ((len > length) || (inx + len) > length)
- break;
-
- if (tagsfound == 0) { /* found the 1st tag - initialize the return array */
- array_init(return_value);
- }
-
- if (zend_hash_find(Z_ARRVAL_P(return_value), key, strlen(key) + 1, (void **) &element) == FAILURE) {
- ALLOC_ZVAL(values);
- INIT_PZVAL(values);
- array_init(values);
-
- zend_hash_update(Z_ARRVAL_P(return_value), key, strlen(key)+1, (void *) &values, sizeof(pval*), (void **) &element);
- }
-
- add_next_index_stringl(*element, buffer+inx, len, 1);
-
- inx += len;
-
- tagsfound++;
- }
-
- if (! tagsfound) {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c
deleted file mode 100644
index b4d8ee07af..0000000000
--- a/ext/standard/lcg.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_lcg.h"
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#elif defined(NETWARE)
-#ifdef NEW_LIBC
-#include <sys/timeval.h>
-#else
-#include "netware/time_nw.h"
-#endif
-#else
-#include <sys/time.h>
-#endif
-
-#ifdef ZTS
-int lcg_globals_id;
-#else
-static php_lcg_globals lcg_globals;
-#endif
-
-
-#ifdef PHP_WIN32
-#include <process.h>
-#endif
-
-/*
- * combinedLCG() returns a pseudo random number in the range of (0, 1).
- * The function combines two CGs with periods of
- * 2^31 - 85 and 2^31 - 249. The period of this function
- * is equal to the product of both primes.
- */
-
-#define MODMULT(a, b, c, m, s) q = s/a;s=b*(s-a*q)-c*q;if(s<0)s+=m
-
-static void lcg_seed(TSRMLS_D);
-
-PHPAPI double php_combined_lcg(TSRMLS_D)
-{
- php_int32 q;
- php_int32 z;
-
- if (!LCG(seeded)) {
- lcg_seed(TSRMLS_C);
- }
-
- MODMULT(53668, 40014, 12211, 2147483563L, LCG(s1));
- MODMULT(52774, 40692, 3791, 2147483399L, LCG(s2));
-
- z = LCG(s1) - LCG(s2);
- if (z < 1) {
- z += 2147483562;
- }
-
- return z * 4.656613e-10;
-}
-
-static void lcg_seed(TSRMLS_D)
-{
- struct timeval tv;
-
- if (gettimeofday(&tv, NULL) == 0) {
- LCG(s1) = tv.tv_sec ^ (~tv.tv_usec);
- } else {
- LCG(s1) = 1;
- }
-#ifdef ZTS
- LCG(s2) = (long) tsrm_thread_id();
-#else
- LCG(s2) = (long) getpid();
-#endif
-
- LCG(seeded) = 1;
-}
-
-static void lcg_init_globals(php_lcg_globals *lcg_globals_p TSRMLS_DC)
-{
- LCG(seeded) = 0;
-}
-
-PHP_MINIT_FUNCTION(lcg)
-{
-#ifdef ZTS
- ts_allocate_id(&lcg_globals_id, sizeof(php_lcg_globals), (ts_allocate_ctor) lcg_init_globals, NULL);
-#else
- lcg_init_globals(&lcg_globals);
-#endif
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(lcg)
-{
- if (!LCG(seeded)) {
- lcg_seed(TSRMLS_C);
- }
- return SUCCESS;
-}
-
-/* {{{ proto float lcg_value()
- Returns a value from the combined linear congruential generator */
-PHP_FUNCTION(lcg_value)
-{
- RETURN_DOUBLE(php_combined_lcg(TSRMLS_C));
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/levenshtein.c b/ext/standard/levenshtein.c
deleted file mode 100644
index edd85ad958..0000000000
--- a/ext/standard/levenshtein.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include "php_string.h"
-
-#define LEVENSHTEIN_MAX_LENTH 255
-
-/* {{{ reference_levdist
- * reference implementation, only optimized for memory usage, not speed */
-static int reference_levdist(const char *s1, int l1,
- const char *s2, int l2,
- int cost_ins, int cost_rep, int cost_del )
-{
- int *p1, *p2, *tmp;
- int i1, i2, c0, c1, c2;
-
- if(l1==0) return l2*cost_ins;
- if(l2==0) return l1*cost_del;
-
- if((l1>LEVENSHTEIN_MAX_LENTH)||(l2>LEVENSHTEIN_MAX_LENTH))
- return -1;
-
- if(!(p1=emalloc((l2+1)*sizeof(int)))) {
- return -2;
- }
- if(!(p2=emalloc((l2+1)*sizeof(int)))) {
- free(p1);
- return -2;
- }
-
- for(i2=0;i2<=l2;i2++)
- p1[i2] = i2*cost_ins;
-
- for(i1=0;i1<l1;i1++)
- {
- p2[0]=p1[0]+cost_del;
- for(i2=0;i2<l2;i2++)
- {
- c0=p1[i2]+((s1[i1]==s2[i2])?0:cost_rep);
- c1=p1[i2+1]+cost_del; if(c1<c0) c0=c1;
- c2=p2[i2]+cost_ins; if(c2<c0) c0=c2;
- p2[i2+1]=c0;
- }
- tmp=p1; p1=p2; p2=tmp;
- }
-
- c0=p1[l2];
-
- efree(p1);
- efree(p2);
-
- return c0;
-}
-/* }}} */
-
-/* {{{ custom_levdist
- */
-static int custom_levdist(char *str1, char *str2, char *callback_name TSRMLS_DC)
-{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The general Levenshtein support is not there yet");
- /* not there yet */
-
- return -1;
-}
-/* }}} */
-
-/* {{{ proto int levenshtein(string str1, string str2)
- Calculate Levenshtein distance between two strings */
-PHP_FUNCTION(levenshtein)
-{
- zval **str1, **str2, **cost_ins, **cost_rep, **cost_del, **callback_name;
- int distance=-1;
-
- switch(ZEND_NUM_ARGS()) {
- case 2: /* just two string: use maximum performance version */
- if (zend_get_parameters_ex(2, &str1, &str2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str1);
- convert_to_string_ex(str2);
-
- distance = reference_levdist(Z_STRVAL_PP(str1), Z_STRLEN_PP(str1),
- Z_STRVAL_PP(str2), Z_STRLEN_PP(str2), 1, 1, 1);
-
- break;
-
- case 5: /* more general version: calc cost by ins/rep/del weights */
- if (zend_get_parameters_ex(5, &str1, &str2, &cost_ins, &cost_rep, &cost_del) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str1);
- convert_to_string_ex(str2);
- convert_to_long_ex(cost_ins);
- convert_to_long_ex(cost_rep);
- convert_to_long_ex(cost_del);
-
- distance = reference_levdist(Z_STRVAL_PP(str1), Z_STRLEN_PP(str1),
- Z_STRVAL_PP(str2), Z_STRLEN_PP(str2),
- Z_LVAL_PP(cost_ins), Z_LVAL_PP(cost_rep),
- Z_LVAL_PP(cost_del));
-
- break;
-
- case 3: /* most general version: calc cost by user-supplied function */
- if (zend_get_parameters_ex(3, &str1, &str2, &callback_name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str1);
- convert_to_string_ex(str2);
- convert_to_string_ex(callback_name);
-
- distance = custom_levdist(Z_STRVAL_PP(str1), Z_STRVAL_PP(str2),
- Z_STRVAL_PP(callback_name) TSRMLS_CC);
- break;
-
- default:
- WRONG_PARAM_COUNT;
- }
-
- if(distance<0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument string(s) too long");
- }
-
- RETURN_LONG(distance);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/link.c b/ext/standard/link.c
deleted file mode 100644
index b70e9e68bf..0000000000
--- a/ext/standard/link.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_filestat.h"
-#include "php_globals.h"
-
-#ifdef HAVE_SYMLINK
-
-#include <stdlib.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-#include <string.h>
-#if HAVE_PWD_H
-#ifdef PHP_WIN32
-#include "win32/pwd.h"
-#elif defined(NETWARE)
-#include "netware/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-#if HAVE_GRP_H
-#ifdef PHP_WIN32
-#include "win32/grp.h"
-#else
-#include <grp.h>
-#endif
-#endif
-#include <errno.h>
-#include <ctype.h>
-
-#include "safe_mode.h"
-#include "php_link.h"
-
-/* {{{ proto string readlink(string filename)
- Return the target of a symbolic link */
-PHP_FUNCTION(readlink)
-{
- zval **filename;
- char buff[MAXPATHLEN];
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- ret = readlink(Z_STRVAL_PP(filename), buff, MAXPATHLEN-1);
-
- if (ret == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
- RETURN_FALSE;
- }
- /* Append NULL to the end of the string */
- buff[ret] = '\0';
-
- RETURN_STRING(buff, 1);
-}
-/* }}} */
-
-/* {{{ proto int linkinfo(string filename)
- Returns the st_dev field of the UNIX C stat structure describing the link */
-PHP_FUNCTION(linkinfo)
-{
- zval **filename;
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- struct stat_libc sb;
-#else
- struct stat sb;
-#endif
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- ret = VCWD_LSTAT(Z_STRVAL_PP(filename), &sb);
- if (ret == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
- RETURN_LONG(-1L);
- }
-
- RETURN_LONG((long) sb.st_dev);
-}
-/* }}} */
-
-/* {{{ proto int symlink(string target, string link)
- Create a symbolic link */
-PHP_FUNCTION(symlink)
-{
- zval **topath, **frompath;
- int ret;
- char source_p[MAXPATHLEN];
- char dest_p[MAXPATHLEN];
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &topath, &frompath) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(topath);
- convert_to_string_ex(frompath);
-
- expand_filepath(Z_STRVAL_PP(frompath), source_p TSRMLS_CC);
- expand_filepath(Z_STRVAL_PP(topath), dest_p TSRMLS_CC);
-
- if (php_stream_locate_url_wrapper(source_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) ||
- php_stream_locate_url_wrapper(dest_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) )
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to symlink to a URL");
- RETURN_FALSE;
- }
-
- if (PG(safe_mode) && !php_checkuid(dest_p, NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
- RETURN_FALSE;
- }
-
- if (PG(safe_mode) && !php_checkuid(source_p, NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(dest_p TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(source_p TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
-#ifndef ZTS
- ret = symlink(Z_STRVAL_PP(topath), Z_STRVAL_PP(frompath));
-#else
- ret = symlink(dest_p, source_p);
-#endif
- if (ret == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int link(string target, string link)
- Create a hard link */
-PHP_FUNCTION(link)
-{
- zval **topath, **frompath;
- int ret;
- char source_p[MAXPATHLEN];
- char dest_p[MAXPATHLEN];
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &topath, &frompath) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(topath);
- convert_to_string_ex(frompath);
-
- expand_filepath(Z_STRVAL_PP(frompath), source_p TSRMLS_CC);
- expand_filepath(Z_STRVAL_PP(topath), dest_p TSRMLS_CC);
-
- if (php_stream_locate_url_wrapper(source_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) ||
- php_stream_locate_url_wrapper(dest_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) )
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to link to a URL");
- RETURN_FALSE;
- }
-
- if (PG(safe_mode) && !php_checkuid(dest_p, NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
- RETURN_FALSE;
- }
-
- if (PG(safe_mode) && !php_checkuid(source_p, NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(dest_p TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(source_p TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
-#ifndef ZTS
- ret = link(Z_STRVAL_PP(topath), Z_STRVAL_PP(frompath));
-#else
- ret = link(dest_p, source_p);
-#endif
- if (ret == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
deleted file mode 100644
index 6b4f701734..0000000000
--- a/ext/standard/mail.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdio.h>
-#include "php.h"
-#include "ext/standard/info.h"
-
-#if HAVE_SYSEXITS_H
-#include <sysexits.h>
-#endif
-#if HAVE_SYS_SYSEXITS_H
-#include <sys/sysexits.h>
-#endif
-
-#include "php_mail.h"
-#include "php_ini.h"
-#include "safe_mode.h"
-#include "exec.h"
-
-#if HAVE_SENDMAIL
-#ifdef PHP_WIN32
-#include "win32/sendmail.h"
-#endif
-
-#ifdef NETWARE
-#include "netware/pipe.h" /* For popen(), pclose() */
-#include "netware/sysexits.h" /* For exit status codes like EX_OK */
-#endif
-
-#define SKIP_LONG_HEADER_SEP(str, pos) \
- if (str[pos] == '\r' && str[pos + 1] == '\n' && (str[pos + 2] == ' ' || str[pos + 2] == '\t')) { \
- pos += 3; \
- while (str[pos] == ' ' || str[pos] == '\t') { \
- pos++; \
- } \
- continue; \
- } \
-
-/* {{{ proto int ezmlm_hash(string addr)
- Calculate EZMLM list hash value. */
-PHP_FUNCTION(ezmlm_hash)
-{
- char *str = NULL;
- unsigned long h = 5381L;
- int j, str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
- &str, &str_len) == FAILURE) {
- return;
- }
-
- for (j = 0; j < str_len; j++) {
- h = (h + (h << 5)) ^ (unsigned long) (unsigned char) tolower(str[j]);
- }
-
- h = (h % 53);
-
- RETURN_LONG((int) h);
-}
-/* }}} */
-
-/* {{{ proto int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
- Send an email message */
-PHP_FUNCTION(mail)
-{
- char *to=NULL, *message=NULL, *headers=NULL;
- char *subject=NULL, *extra_cmd=NULL;
- int to_len, message_len, headers_len;
- int subject_len, extra_cmd_len, i;
- char *force_extra_parameters = INI_STR("mail_force_extra_parameters");
-
- if (PG(safe_mode) && (ZEND_NUM_ARGS() == 5)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE.");
- RETURN_FALSE;
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ss",
- &to, &to_len,
- &subject, &subject_len,
- &message, &message_len,
- &headers, &headers_len,
- &extra_cmd, &extra_cmd_len
- ) == FAILURE) {
- return;
- }
-
- if (to_len > 0) {
- for (; to_len; to_len--) {
- if (!isspace((unsigned char) to[to_len - 1])) {
- break;
- }
- to[to_len - 1] = '\0';
- }
- for (i = 0; to[i]; i++) {
- if (iscntrl((unsigned char) to[i])) {
- /* According to RFC 822, section 3.1.1 long headers may be separated into
- * parts using CRLF followed at least one linear-white-space character ('\t' or ' ').
- * To prevent these separators from being replaced with a space, we use the
- * SKIP_LONG_HEADER_SEP to skip over them.
- */
- SKIP_LONG_HEADER_SEP(to, i);
- to[i] = ' ';
- }
- }
- }
-
- if (subject_len > 0) {
- for (; subject_len; subject_len--) {
- if (!isspace((unsigned char) subject[subject_len - 1])) {
- break;
- }
- subject[subject_len - 1] = '\0';
- }
- for(i = 0; subject[i]; i++) {
- if (iscntrl((unsigned char) subject[i])) {
- SKIP_LONG_HEADER_SEP(subject, i);
- subject[i] = ' ';
- }
- }
- }
-
- if (force_extra_parameters) {
- extra_cmd = estrdup(force_extra_parameters);
- } else if (extra_cmd) {
- extra_cmd = php_escape_shell_cmd(extra_cmd);
- }
-
- if (php_mail(to, subject, message, headers, extra_cmd TSRMLS_CC)) {
- RETVAL_TRUE;
- } else {
- RETVAL_FALSE;
- }
-
- if (extra_cmd) {
- efree (extra_cmd);
- }
-}
-/* }}} */
-
-/* {{{ php_mail
- */
-PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd TSRMLS_DC)
-{
-#if (defined PHP_WIN32 || defined NETWARE)
- int tsm_err;
- char *tsm_errmsg = NULL;
-#endif
- FILE *sendmail;
- int ret;
- char *sendmail_path = INI_STR("sendmail_path");
- char *sendmail_cmd = NULL;
-
- if (!sendmail_path) {
-#if (defined PHP_WIN32 || defined NETWARE)
- /* handle old style win smtp sending */
- if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, headers, subject, to, message, NULL, NULL, NULL) == FAILURE) {
- if (tsm_errmsg) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", tsm_errmsg);
- efree(tsm_errmsg);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", GetSMErrorText(tsm_err));
- }
- return 0;
- }
- return 1;
-#else
- return 0;
-#endif
- }
- if (extra_cmd != NULL) {
- sendmail_cmd = emalloc (strlen (sendmail_path) + strlen (extra_cmd) + 2);
- strcpy (sendmail_cmd, sendmail_path);
- strcat (sendmail_cmd, " ");
- strcat (sendmail_cmd, extra_cmd);
- } else {
- sendmail_cmd = sendmail_path;
- }
-
-#ifdef PHP_WIN32
- sendmail = popen(sendmail_cmd, "wb");
-#else
- /* Since popen() doesn't indicate if the internal fork() doesn't work
- * (e.g. the shell can't be executed) we explicitely set it to 0 to be
- * sure we don't catch any older errno value. */
- errno = 0;
- sendmail = popen(sendmail_cmd, "w");
-#endif
- if (extra_cmd != NULL)
- efree (sendmail_cmd);
-
- if (sendmail) {
-#ifndef PHP_WIN32
- if (EACCES == errno) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Permission denied: unable to execute shell to run mail delivery binary");
- pclose(sendmail);
- return 0;
- }
-#endif
- fprintf(sendmail, "To: %s\n", to);
- fprintf(sendmail, "Subject: %s\n", subject);
- if (headers != NULL) {
- fprintf(sendmail, "%s\n", headers);
- }
- fprintf(sendmail, "\n%s\n", message);
- ret = pclose(sendmail);
-#ifdef PHP_WIN32
- if (ret == -1)
-#else
-#if defined(EX_TEMPFAIL)
- if ((ret != EX_OK)&&(ret != EX_TEMPFAIL))
-#elif defined(EX_OK)
- if (ret != EX_OK)
-#else
- if (ret != 0)
-#endif
-#endif
- {
- return 0;
- } else {
- return 1;
- }
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute mail delivery program");
- return 0;
- }
-
- return 1; /* never reached */
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(mail)
-{
- char *sendmail_path = INI_STR("sendmail_path");
-
-#ifdef PHP_WIN32
- if (!sendmail_path) {
- php_info_print_table_row(2, "Internal Sendmail Support for Windows", "enabled");
- } else {
- php_info_print_table_row(2, "Path to sendmail", sendmail_path);
- }
-#else
- php_info_print_table_row(2, "Path to sendmail", sendmail_path);
-#endif
-}
-/* }}} */
-
-#else
-
-PHP_FUNCTION(mail) {}
-PHP_MINFO_FUNCTION(mail) {}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/math.c b/ext/standard/math.c
deleted file mode 100644
index 1772097e52..0000000000
--- a/ext/standard/math.c
+++ /dev/null
@@ -1,1150 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jim Winstead <jimw@php.net> |
- | Stig Sæther Bakken <ssb@php.net> |
- | Zeev Suraski <zeev@zend.com> |
- | PHP 4.0 patches by Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_math.h"
-
-#include <math.h>
-#include <float.h>
-#include <stdlib.h>
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-/* {{{ proto int abs(int number)
- Return the absolute value of the number */
-
-PHP_FUNCTION(abs)
-{
- zval **value;
-
- if (ZEND_NUM_ARGS()!=1||zend_get_parameters_ex(1, &value)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_scalar_to_number_ex(value);
-
- if (Z_TYPE_PP(value) == IS_DOUBLE) {
- RETURN_DOUBLE(fabs(Z_DVAL_PP(value)));
- } else if (Z_TYPE_PP(value) == IS_LONG) {
- if (Z_LVAL_PP(value) == LONG_MIN) {
- RETURN_DOUBLE(-(double)LONG_MIN);
- } else {
- RETURN_LONG(Z_LVAL_PP(value) < 0 ? -Z_LVAL_PP(value) : Z_LVAL_PP(value));
- }
- }
-
- RETURN_FALSE;
-}
-
-/* }}} */
-/* {{{ proto float ceil(float number)
- Returns the next highest integer value of the number */
-PHP_FUNCTION(ceil)
-{
- zval **value;
-
- if (ZEND_NUM_ARGS()!=1||zend_get_parameters_ex(1, &value)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_scalar_to_number_ex(value);
-
- if (Z_TYPE_PP(value) == IS_DOUBLE) {
- RETURN_DOUBLE(ceil(Z_DVAL_PP(value)));
- } else if (Z_TYPE_PP(value) == IS_LONG) {
- convert_to_double_ex(value);
- RETURN_DOUBLE(Z_DVAL_PP(value));
- }
-
- RETURN_FALSE;
-}
-
-/* }}} */
-/* {{{ proto float floor(float number)
- Returns the next lowest integer value from the number */
-PHP_FUNCTION(floor)
-{
- zval **value;
-
- if (ZEND_NUM_ARGS()!=1||zend_get_parameters_ex(1, &value)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_scalar_to_number_ex(value);
-
- if (Z_TYPE_PP(value) == IS_DOUBLE) {
- RETURN_DOUBLE(floor(Z_DVAL_PP(value)));
- } else if (Z_TYPE_PP(value) == IS_LONG) {
- convert_to_double_ex(value);
- RETURN_DOUBLE(Z_DVAL_PP(value));
- }
-
- RETURN_FALSE;
-}
-
-/* }}} */
-
-
-/* {{{ proto float round(float number [, int precision])
- Returns the number rounded to specified precision */
-PHP_FUNCTION(round)
-{
- zval **value, **precision;
- int places = 0;
- double f, return_val;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &value, &precision) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (ZEND_NUM_ARGS() == 2) {
- convert_to_long_ex(precision);
- places = (int) Z_LVAL_PP(precision);
- }
-
- convert_scalar_to_number_ex(value);
-
- switch (Z_TYPE_PP(value)) {
- case IS_LONG:
- /* Simple case - long that doesn't need to be rounded. */
- if (places >= 0) {
- RETURN_DOUBLE((double) Z_LVAL_PP(value));
- }
- /* break omitted intentionally */
-
- case IS_DOUBLE:
- return_val = (Z_TYPE_PP(value) == IS_LONG) ?
- (double)Z_LVAL_PP(value) : Z_DVAL_PP(value);
-
- f = pow(10.0, (double) places);
-
- return_val *= f;
- if (return_val >= 0.0)
- return_val = floor(return_val + 0.5);
- else
- return_val = ceil(return_val - 0.5);
- return_val /= f;
-
- RETURN_DOUBLE(return_val);
- break;
-
- default:
- RETURN_FALSE;
- break;
- }
-}
-/* }}} */
-/* {{{ proto float sin(float number)
- Returns the sine of the number in radians */
-
-PHP_FUNCTION(sin)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = sin(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto float cos(float number)
- Returns the cosine of the number in radians */
-
-PHP_FUNCTION(cos)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = cos(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-/* }}} */
-/* {{{ proto float tan(float number)
- Returns the tangent of the number in radians */
-PHP_FUNCTION(tan)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = tan(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto float asin(float number)
- Returns the arc sine of the number in radians */
-
-PHP_FUNCTION(asin)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = asin(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto float acos(float number)
- Return the arc cosine of the number in radians */
-
-PHP_FUNCTION(acos)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = acos(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto float atan(float number)
- Returns the arc tangent of the number in radians */
-
-PHP_FUNCTION(atan)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = atan(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto float atan2(float y, float x)
- Returns the arc tangent of y/x, with the resulting quadrant determined by the signs of y and x */
-
-PHP_FUNCTION(atan2)
-{
- zval **num1, **num2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &num1, &num2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num1);
- convert_to_double_ex(num2);
- Z_DVAL_P(return_value) = atan2(Z_DVAL_PP(num1), Z_DVAL_PP(num2));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto float sinh(float number)
- Returns the hyperbolic sine of the number, defined as (exp(number) - exp(-number))/2 */
-
-PHP_FUNCTION(sinh)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = sinh(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto float cosh(float number)
- Returns the hyperbolic cosine of the number, defined as (exp(number) + exp(-number))/2 */
-
-PHP_FUNCTION(cosh)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = cosh(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-/* }}} */
-/* {{{ proto float tanh(float number)
- Returns the hyperbolic tangent of the number, defined as sinh(number)/cosh(number) */
-PHP_FUNCTION(tanh)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = tanh(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-
-/* }}} */
-
-#if !defined(PHP_WIN32) && !defined(NETWARE)
-#ifdef HAVE_ASINH
-/* {{{ proto float asinh(float number)
- Returns the inverse hyperbolic sine of the number, i.e. the value whose hyperbolic sine is number */
-PHP_FUNCTION(asinh)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = asinh(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-/* }}} */
-#endif /* HAVE_ASINH */
-
-#ifdef HAVE_ACOSH
-/* {{{ proto float acosh(float number)
- Returns the inverse hyperbolic cosine of the number, i.e. the value whose hyperbolic cosine is number */
-PHP_FUNCTION(acosh)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = acosh(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-/* }}} */
-#endif /* HAVE_ACOSH */
-
-#ifdef HAVE_ATANH
-/* {{{ proto float atanh(float number)
- Returns the inverse hyperbolic tangent of the number, i.e. the value whose hyperbolic tangent is number */
-PHP_FUNCTION(atanh)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = atanh(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-/* }}} */
-#endif /* HAVE_ATANH */
-#endif /* !defined(PHP_WIN32) && !defined(NETWARE) */
-
-
-/* {{{ proto float pi(void)
- Returns an approximation of pi */
-PHP_FUNCTION(pi)
-{
- Z_DVAL_P(return_value) = M_PI;
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-/* }}} */
-
-
-/* {{{ proto bool is_finite(float val)
- Returns whether argument is finite */
-PHP_FUNCTION(is_finite)
-{
- double dval;
-
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &dval) == FAILURE) {
- return;
- }
- RETURN_BOOL(zend_finite(dval));
-}
-/* }}} */
-
-/* {{{ proto bool is_infinite(float val)
- Returns whether argument is infinite */
-PHP_FUNCTION(is_infinite)
-{
- double dval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &dval) == FAILURE) {
- return;
- }
- RETURN_BOOL(zend_isinf(dval));
-}
-/* }}} */
-
-/* {{{ proto bool is_nan(float val)
- Returns whether argument is not a number */
-PHP_FUNCTION(is_nan)
-{
- double dval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &dval) == FAILURE) {
- return;
- }
- RETURN_BOOL(zend_isnan(dval));
-}
-/* }}} */
-
-/* {{{ proto number pow(number base, number exponent)
- Returns base raised to the power of exponent. Returns integer result when possible */
-PHP_FUNCTION(pow)
-{
- zval *zbase, *zexp;
- double dval;
- zend_bool wantlong;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/z/", &zbase, &zexp) == FAILURE) {
- return;
- }
-
- /* make sure we're dealing with numbers */
- convert_scalar_to_number(zbase TSRMLS_CC);
- convert_scalar_to_number(zexp TSRMLS_CC);
-
- /* if both base and exponent were longs, we'll try to get a long out */
- wantlong = Z_TYPE_P(zbase) == IS_LONG
- && Z_TYPE_P(zexp ) == IS_LONG && Z_LVAL_P(zexp) >= 0;
-
- convert_to_double(zbase);
- convert_to_double(zexp);
-
- /* go ahead and calculate things. */
- dval = pow(Z_DVAL_P(zbase),Z_DVAL_P(zexp));
-
- /* if we wanted a long, and dval < LONG_MAX, it must be a long. */
- if (wantlong && zend_finite(dval) && dval <= (double)LONG_MAX) {
- RETURN_LONG((long)dval);
- }
-
- /* otherwise just return the double. */
- RETURN_DOUBLE(dval);
-}
-/* }}} */
-
-/* {{{ proto float exp(float number)
- Returns e raised to the power of the number */
-
-PHP_FUNCTION(exp)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = exp(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-
-/* }}} */
-
-
-#if !defined(PHP_WIN32) && !defined(NETWARE)
-/* {{{ proto float expm1(float number)
- Returns exp(number) - 1, computed in a way that accurate even when the value of number is close to zero */
-
-/*
- WARNING: this function is expermental: it could change its name or
- disappear in the next version of PHP!
-*/
-
-PHP_FUNCTION(expm1)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = expm1(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto float log1p(float number)
- Returns log(1 + number), computed in a way that accurate even when the value of number is close to zero */
-
-/*
- WARNING: this function is expermental: it could change its name or
- disappear in the next version of PHP!
-*/
-
-PHP_FUNCTION(log1p)
-{
-#ifdef HAVE_LOG1P
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = log1p(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-#endif
-}
-
-/* }}} */
-
-#endif
-/* {{{ proto float log(float number, [float base])
- Returns the natural logarithm of the number, or the base log if base is specified */
-
-PHP_FUNCTION(log)
-{
- zval **num, **base;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- RETURN_DOUBLE(log(Z_DVAL_PP(num)));
- case 2:
- if (zend_get_parameters_ex(2, &num, &base) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- convert_to_double_ex(base);
-
- if (Z_DVAL_PP(base) <= 0.0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "base must be greater than 0");
- RETURN_FALSE;
- }
- RETURN_DOUBLE(log(Z_DVAL_PP(num)) / log(Z_DVAL_PP(base)));
- default:
- WRONG_PARAM_COUNT;
- }
-}
-
-/* }}} */
-/* {{{ proto float log10(float number)
- Returns the base-10 logarithm of the number */
-
-PHP_FUNCTION(log10)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = log10(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto float sqrt(float number)
- Returns the square root of the number */
-
-PHP_FUNCTION(sqrt)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = sqrt(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-
-/* }}} */
-
-
-/* {{{ proto float hypot(float num1, float num2)
- Returns sqrt(num1*num1 + num2*num2) */
-
-/*
- WARNING: this function is expermental: it could change its name or
- disappear in the next version of PHP!
-*/
-
-PHP_FUNCTION(hypot)
-{
-#ifdef HAVE_HYPOT
- zval **num1, **num2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &num1, &num2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num1);
- convert_to_double_ex(num2);
- Z_DVAL_P(return_value) = hypot(Z_DVAL_PP(num1), Z_DVAL_PP(num2));
- Z_TYPE_P(return_value) = IS_DOUBLE;
-#endif
-}
-
-/* }}} */
-
-/* {{{ proto float deg2rad(float number)
- Converts the number in degrees to the radian equivalent */
-
-PHP_FUNCTION(deg2rad)
-{
- zval **deg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &deg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(deg);
- RETVAL_DOUBLE((Z_DVAL_PP(deg) / 180.0) * M_PI);
-}
-
-/* }}} */
-/* {{{ proto float rad2deg(float number)
- Converts the radian number to the equivalent number in degrees */
-
-PHP_FUNCTION(rad2deg)
-{
- zval **rad;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &rad) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(rad);
- RETVAL_DOUBLE((Z_DVAL_PP(rad) / M_PI) * 180);
-}
-
-/* }}} */
-/* {{{ _php_math_basetolong */
-
-/*
- * Convert a string representation of a base(2-36) number to a long.
- */
-PHPAPI long
-_php_math_basetolong(zval *arg, int base) {
- long num = 0, digit, onum;
- int i;
- char c, *s;
-
- if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) {
- return 0;
- }
-
- s = Z_STRVAL_P(arg);
-
- for (i = Z_STRLEN_P(arg); i > 0; i--) {
- c = *s++;
-
- digit = (c >= '0' && c <= '9') ? c - '0'
- : (c >= 'A' && c <= 'Z') ? c - 'A' + 10
- : (c >= 'a' && c <= 'z') ? c - 'a' + 10
- : base;
-
- if (digit >= base) {
- continue;
- }
-
- onum = num;
- num = num * base + digit;
- if (num > onum)
- continue;
-
- {
- TSRMLS_FETCH();
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number '%s' is too big to fit in long", s);
- return LONG_MAX;
- }
- }
-
- return num;
-}
-
-/* }}} */
-/* {{{ _php_math_longtobase */
-
-/* {{{ _php_math_basetozval */
-
-/*
- * Convert a string representation of a base(2-36) number to a zval.
- */
-PHPAPI int
-_php_math_basetozval(zval *arg, int base, zval *ret) {
- long num = 0;
- double fnum = 0;
- int i;
- int mode = 0;
- char c, *s;
- long cutoff;
- int cutlim;
-
- if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) {
- return FAILURE;
- }
-
- s = Z_STRVAL_P(arg);
-
- cutoff = LONG_MAX / base;
- cutlim = LONG_MAX % base;
-
- for (i = Z_STRLEN_P(arg); i > 0; i--) {
- c = *s++;
-
- /* might not work for EBCDIC */
- if (c >= '0' && c <= '9')
- c -= '0';
- else if (c >= 'A' && c <= 'Z')
- c -= 'A' - 10;
- else if (c >= 'a' && c <= 'z')
- c -= 'a' - 10;
- else
- continue;
-
- if (c >= base)
- continue;
-
- switch (mode) {
- case 0: /* Integer */
- if (num < cutoff || (num == cutoff && c <= cutlim)) {
- num = num * base + c;
- break;
- } else {
- fnum = num;
- mode = 1;
- }
- /* fall-through */
- case 1: /* Float */
- fnum = fnum * base + c;
- }
- }
-
- if (mode == 1) {
- ZVAL_DOUBLE(ret, fnum);
- } else {
- ZVAL_LONG(ret, num);
- }
- return SUCCESS;
-}
-
-/* }}} */
-/* {{{ _php_math_longtobase */
-
-/*
- * Convert a long to a string containing a base(2-36) representation of
- * the number.
- */
-PHPAPI char *
-_php_math_longtobase(zval *arg, int base)
-{
- static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
- char buf[(sizeof(unsigned long) << 3) + 1];
- char *ptr, *end;
- unsigned long value;
-
- if (Z_TYPE_P(arg) != IS_LONG || base < 2 || base > 36) {
- return empty_string;
- }
-
- value = Z_LVAL_P(arg);
-
- end = ptr = buf + sizeof(buf) - 1;
- *ptr = '\0';
-
- do {
- *--ptr = digits[value % base];
- value /= base;
- } while (ptr > buf && value);
-
- return estrndup(ptr, end - ptr);
-}
-
-/* }}} */
-/* {{{ _php_math_zvaltobase */
-
-/*
- * Convert a zval to a string containing a base(2-36) representation of
- * the number.
- */
-PHPAPI char *
-_php_math_zvaltobase(zval *arg, int base TSRMLS_DC)
-{
- static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
-
- if ((Z_TYPE_P(arg) != IS_LONG && Z_TYPE_P(arg) != IS_DOUBLE) || base < 2 || base > 36) {
- return empty_string;
- }
-
- if (Z_TYPE_P(arg) == IS_DOUBLE) {
- double fvalue = floor(Z_DVAL_P(arg)); /* floor it just in case */
- char *ptr, *end;
- char buf[(sizeof(double) << 3) + 1];
-
- /* Don't try to convert +/- infinity */
- if (fvalue == HUGE_VAL || fvalue == -HUGE_VAL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number too large");
- return empty_string;
- }
-
- end = ptr = buf + sizeof(buf) - 1;
- *ptr = '\0';
-
- do {
- *--ptr = digits[(int) fmod(fvalue, base)];
- fvalue /= base;
- } while (ptr > buf && fabs(fvalue) >= 1);
-
- return estrndup(ptr, end - ptr);
- }
-
- return _php_math_longtobase(arg, base);
-}
-
-/* }}} */
-/* {{{ proto int bindec(string binary_number)
- Returns the decimal equivalent of the binary number */
-
-PHP_FUNCTION(bindec)
-{
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg);
- if(_php_math_basetozval(*arg, 2, return_value) != SUCCESS) {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-/* {{{ proto int hexdec(string hexadecimal_number)
- Returns the decimal equivalent of the hexadecimal number */
-
-PHP_FUNCTION(hexdec)
-{
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg);
-
- if(_php_math_basetozval(*arg, 16, return_value) != SUCCESS) {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-/* {{{ proto int octdec(string octal_number)
- Returns the decimal equivalent of an octal string */
-
-PHP_FUNCTION(octdec)
-{
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg);
-
- if(_php_math_basetozval(*arg, 8, return_value) != SUCCESS) {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-/* {{{ proto string decbin(int decimal_number)
- Returns a string containing a binary representation of the number */
-
-PHP_FUNCTION(decbin)
-{
- zval **arg;
- char *result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg);
-
- result = _php_math_longtobase(*arg, 2);
- Z_TYPE_P(return_value) = IS_STRING;
- Z_STRLEN_P(return_value) = strlen(result);
- Z_STRVAL_P(return_value) = result;
-}
-
-/* }}} */
-/* {{{ proto string decoct(int decimal_number)
- Returns a string containing an octal representation of the given number */
-
-PHP_FUNCTION(decoct)
-{
- zval **arg;
- char *result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg);
-
- result = _php_math_longtobase(*arg, 8);
- Z_TYPE_P(return_value) = IS_STRING;
- Z_STRLEN_P(return_value) = strlen(result);
- Z_STRVAL_P(return_value) = result;
-}
-
-/* }}} */
-/* {{{ proto string dechex(int decimal_number)
- Returns a string containing a hexadecimal representation of the given number */
-
-PHP_FUNCTION(dechex)
-{
- zval **arg;
- char *result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg);
-
- result = _php_math_longtobase(*arg, 16);
- Z_TYPE_P(return_value) = IS_STRING;
- Z_STRLEN_P(return_value) = strlen(result);
- Z_STRVAL_P(return_value) = result;
-}
-
-/* }}} */
-/* {{{ proto string base_convert(string number, int frombase, int tobase)
- Converts a number in a string from any base <= 36 to any base <= 36 */
-
-PHP_FUNCTION(base_convert)
-{
- zval **number, **frombase, **tobase, temp;
- char *result;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &number, &frombase, &tobase) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(number);
- convert_to_long_ex(frombase);
- convert_to_long_ex(tobase);
- if (Z_LVAL_PP(frombase) < 2 || Z_LVAL_PP(frombase) > 36) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid `from base' (%d)", Z_LVAL_PP(frombase));
- RETURN_FALSE;
- }
- if (Z_LVAL_PP(tobase) < 2 || Z_LVAL_PP(tobase) > 36) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid `to base' (%d)", Z_LVAL_PP(tobase));
- RETURN_FALSE;
- }
-
- if(_php_math_basetozval(*number, Z_LVAL_PP(frombase), &temp) != SUCCESS) {
- RETURN_FALSE;
- }
- result = _php_math_zvaltobase(&temp, Z_LVAL_PP(tobase) TSRMLS_CC);
- RETVAL_STRING(result, 0);
-}
-
-/* }}} */
-/* {{{ _php_math_number_format */
-
-PHPAPI char *_php_math_number_format(double d, int dec, char dec_point, char thousand_sep)
-{
- char *tmpbuf = NULL, *resbuf;
- char *s, *t; /* source, target */
- char *dp;
- int integral;
- int tmplen, reslen=0;
- int count=0;
- int is_negative=0;
-
- if (d < 0) {
- is_negative = 1;
- d = -d;
- }
- dec = MAX(0, dec);
-
- tmplen = spprintf(&tmpbuf, 0, "%.*f", dec, d);
-
- if (tmpbuf == NULL || !isdigit((int)tmpbuf[0])) {
- return tmpbuf;
- }
-
- /* calculate the length of the return buffer */
- dp = strchr(tmpbuf, '.');
- if (dp) {
- integral = dp - tmpbuf;
- } else {
- /* no decimal point was found */
- integral = tmplen;
- }
-
- /* allow for thousand separators */
- if (thousand_sep) {
- integral += (integral-1) / 3;
- }
-
- reslen = integral;
-
- if (dec) {
- reslen += 1 + dec;
- }
-
- /* add a byte for minus sign */
- if (is_negative) {
- reslen++;
- }
- resbuf = (char *) emalloc(reslen+1); /* +1 for NUL terminator */
-
- s = tmpbuf+tmplen-1;
- t = resbuf+reslen;
- *t-- = '\0';
-
- /* copy the decimal places.
- * Take care, as the sprintf implementation may return less places than
- * we requested due to internal buffer limitations */
- if (dec) {
- int declen = dp ? strlen(dp+1) : 0;
- int topad = declen > 0 ? dec - declen : 0;
-
- /* pad with '0's */
-
- while (topad--) {
- *t-- = '0';
- }
-
- if (dp) {
- /* now copy the chars after the point */
- memcpy(t - declen + 1, dp + 1, declen);
-
- t -= declen;
- s -= declen;
- }
-
- /* add decimal point */
- *t-- = dec_point;
- s--;
- }
-
- /* copy the numbers before the decimal place, adding thousand
- * separator every three digits */
- while(s >= tmpbuf) {
- *t-- = *s--;
- if (thousand_sep && (++count%3)==0 && s>=tmpbuf) {
- *t-- = thousand_sep;
- }
- }
-
- /* and a minus sign, if needed */
- if (is_negative) {
- *t-- = '-';
- }
-
- efree(tmpbuf);
-
- return resbuf;
-}
-
-/* }}} */
-/* {{{ proto string number_format(float number [, int num_decimal_places [, string dec_seperator, string thousands_seperator]])
- Formats a number with grouped thousands */
-
-PHP_FUNCTION(number_format)
-{
- zval **num, **dec, **t_s, **d_p;
- char thousand_sep=',', dec_point='.';
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &num)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_double_ex(num);
- RETURN_STRING(_php_math_number_format(Z_DVAL_PP(num), 0, dec_point, thousand_sep), 0);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &num, &dec)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_double_ex(num);
- convert_to_long_ex(dec);
- RETURN_STRING(_php_math_number_format(Z_DVAL_PP(num), Z_LVAL_PP(dec), dec_point, thousand_sep), 0);
- break;
- case 4:
- if (zend_get_parameters_ex(4, &num, &dec, &d_p, &t_s)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_double_ex(num);
- convert_to_long_ex(dec);
- convert_to_string_ex(d_p);
- convert_to_string_ex(t_s);
- if (Z_STRLEN_PP(d_p)==1) {
- dec_point=Z_STRVAL_PP(d_p)[0];
- }
- if (Z_STRLEN_PP(t_s)==1) {
- thousand_sep=Z_STRVAL_PP(t_s)[0];
- } else if(Z_STRLEN_PP(t_s)==0) {
- thousand_sep=0;
- }
- RETURN_STRING(_php_math_number_format(Z_DVAL_PP(num), Z_LVAL_PP(dec), dec_point, thousand_sep), 0);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto float fmod(float x, float y)
- Returns the remainder of dividing x by y as a float */
-PHP_FUNCTION(fmod)
-{
- double num1, num2;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &num1, &num2) == FAILURE) {
- return;
- }
-
- Z_DVAL_P(return_value) = fmod(num1, num2);
- Z_TYPE_P(return_value) = IS_DOUBLE;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/standard/md5.c b/ext/standard/md5.c
deleted file mode 100644
index c833e09048..0000000000
--- a/ext/standard/md5.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Lachlan Roche |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- * md5.c - Copyright 1997 Lachlan Roche
- * md5_file() added by Alessandro Astarita <aleast@capri.it>
- */
-
-#include <stdio.h>
-#include "php.h"
-
-#include "md5.h"
-
-PHPAPI void make_digest(char *md5str, unsigned char *digest)
-{
- int i;
-
- for (i = 0; i < 16; i++) {
- sprintf(md5str, "%02x", digest[i]);
- md5str += 2;
- }
-
- *md5str = '\0';
-}
-
-/* {{{ proto string md5(string str, [ bool raw_output])
- Calculate the md5 hash of a string */
-PHP_NAMED_FUNCTION(php_if_md5)
-{
- char *arg;
- int arg_len;
- zend_bool raw_output = 0;
- char md5str[33];
- PHP_MD5_CTX context;
- unsigned char digest[16];
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
-
- md5str[0] = '\0';
- PHP_MD5Init(&context);
- PHP_MD5Update(&context, arg, arg_len);
- PHP_MD5Final(digest, &context);
- if (raw_output) {
- RETURN_STRINGL(digest, 16, 1);
- } else {
- make_digest(md5str, digest);
- RETVAL_STRING(md5str, 1);
- }
-
-}
-/* }}} */
-
-/* {{{ proto string md5_file(string filename [, bool raw_output])
- Calculate the md5 hash of given filename */
-PHP_NAMED_FUNCTION(php_if_md5_file)
-{
- char *arg;
- int arg_len;
- zend_bool raw_output = 0;
- char md5str[33];
- unsigned char buf[1024];
- unsigned char digest[16];
- PHP_MD5_CTX context;
- int n;
- FILE *fp;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
-
- if (PG(safe_mode) && (!php_checkuid(arg, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(arg TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if ((fp = VCWD_FOPEN(arg, "rb")) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open file");
- RETURN_FALSE;
- }
-
- PHP_MD5Init(&context);
-
- while ((n = fread(buf, 1, sizeof(buf), fp)) > 0) {
- PHP_MD5Update(&context, buf, n);
- }
-
- PHP_MD5Final(digest, &context);
-
- if (ferror(fp)) {
- fclose(fp);
- RETURN_FALSE;
- }
-
- fclose(fp);
-
- if (raw_output) {
- RETURN_STRINGL(digest, 16, 1);
- } else {
- make_digest(md5str, digest);
- RETVAL_STRING(md5str, 1);
- }
-}
-/* }}} */
-
-/*
- * The remaining code is the reference MD5 code (md5c.c) from rfc1321
- */
-/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- rights reserved.
-
- License to copy and use this software is granted provided that it
- is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- Algorithm" in all material mentioning or referencing this software
- or this function.
-
- License is also granted to make and use derivative works provided
- that such works are identified as "derived from the RSA Data
- Security, Inc. MD5 Message-Digest Algorithm" in all material
- mentioning or referencing the derived work.
-
- RSA Data Security, Inc. makes no representations concerning either
- the merchantability of this software or the suitability of this
- software for any particular purpose. It is provided "as is"
- without express or implied warranty of any kind.
-
- These notices must be retained in any copies of any part of this
- documentation and/or software.
- */
-
-/* Constants for MD5Transform routine.
- */
-
-
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
-
-static void MD5Transform(php_uint32[4], const unsigned char[64]);
-static void Encode(unsigned char *, php_uint32 *, unsigned int);
-static void Decode(php_uint32 *, const unsigned char *, unsigned int);
-
-static unsigned char PADDING[64] =
-{
- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/* F, G, H and I are basic MD5 functions.
- */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
-
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
- Rotation is separate from addition to prevent recomputation.
- */
-#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (php_uint32)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (php_uint32)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (php_uint32)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (php_uint32)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-
-/* {{{ PHP_MD5Init
- * MD5 initialization. Begins an MD5 operation, writing a new context.
- */
-PHPAPI void PHP_MD5Init(PHP_MD5_CTX * context)
-{
- context->count[0] = context->count[1] = 0;
- /* Load magic initialization constants.
- */
- context->state[0] = 0x67452301;
- context->state[1] = 0xefcdab89;
- context->state[2] = 0x98badcfe;
- context->state[3] = 0x10325476;
-}
-/* }}} */
-
-/* {{{ PHP_MD5Update
- MD5 block update operation. Continues an MD5 message-digest
- operation, processing another message block, and updating the
- context.
- */
-PHPAPI void PHP_MD5Update(PHP_MD5_CTX * context, const unsigned char *input,
- unsigned int inputLen)
-{
- unsigned int i, index, partLen;
-
- /* Compute number of bytes mod 64 */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
-
- /* Update number of bits */
- if ((context->count[0] += ((php_uint32) inputLen << 3))
- < ((php_uint32) inputLen << 3))
- context->count[1]++;
- context->count[1] += ((php_uint32) inputLen >> 29);
-
- partLen = 64 - index;
-
- /* Transform as many times as possible.
- */
- if (inputLen >= partLen) {
- memcpy
- ((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
- MD5Transform(context->state, context->buffer);
-
- for (i = partLen; i + 63 < inputLen; i += 64)
- MD5Transform(context->state, &input[i]);
-
- index = 0;
- } else
- i = 0;
-
- /* Buffer remaining input */
- memcpy
- ((unsigned char*) & context->buffer[index], (unsigned char*) & input[i],
- inputLen - i);
-}
-/* }}} */
-
-/* {{{ PHP_MD5Final
- MD5 finalization. Ends an MD5 message-digest operation, writing the
- the message digest and zeroizing the context.
- */
-PHPAPI void PHP_MD5Final(unsigned char digest[16], PHP_MD5_CTX * context)
-{
- unsigned char bits[8];
- unsigned int index, padLen;
-
- /* Save number of bits */
- Encode(bits, context->count, 8);
-
- /* Pad out to 56 mod 64.
- */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
- padLen = (index < 56) ? (56 - index) : (120 - index);
- PHP_MD5Update(context, PADDING, padLen);
-
- /* Append length (before padding) */
- PHP_MD5Update(context, bits, 8);
-
- /* Store state in digest */
- Encode(digest, context->state, 16);
-
- /* Zeroize sensitive information.
- */
- memset((unsigned char*) context, 0, sizeof(*context));
-}
-/* }}} */
-
-/* {{{ MD5Transform
- * MD5 basic transformation. Transforms state based on block.
- */
-static void MD5Transform(state, block)
-php_uint32 state[4];
-const unsigned char block[64];
-{
- php_uint32 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
-
- Decode(x, block, 64);
-
- /* Round 1 */
- FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */
- FF(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */
- FF(c, d, a, b, x[2], S13, 0x242070db); /* 3 */
- FF(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */
- FF(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */
- FF(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */
- FF(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */
- FF(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */
- FF(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */
- FF(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */
- FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
- FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
- FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
- FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
- FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
- FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
-
- /* Round 2 */
- GG(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */
- GG(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */
- GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
- GG(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */
- GG(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */
- GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */
- GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
- GG(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */
- GG(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */
- GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
- GG(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */
- GG(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */
- GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
- GG(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */
- GG(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */
- GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
-
- /* Round 3 */
- HH(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */
- HH(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */
- HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
- HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
- HH(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */
- HH(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */
- HH(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */
- HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
- HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
- HH(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */
- HH(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */
- HH(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */
- HH(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */
- HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
- HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
- HH(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */
-
- /* Round 4 */
- II(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */
- II(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */
- II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
- II(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */
- II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
- II(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */
- II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
- II(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */
- II(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */
- II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
- II(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */
- II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
- II(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */
- II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
- II(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */
- II(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */
-
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
-
- /* Zeroize sensitive information. */
- memset((unsigned char*) x, 0, sizeof(x));
-}
-/* }}} */
-
-/* {{{ Encode
- Encodes input (php_uint32) into output (unsigned char). Assumes len is
- a multiple of 4.
- */
-static void Encode(output, input, len)
-unsigned char *output;
-php_uint32 *input;
-unsigned int len;
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4) {
- output[j] = (unsigned char) (input[i] & 0xff);
- output[j + 1] = (unsigned char) ((input[i] >> 8) & 0xff);
- output[j + 2] = (unsigned char) ((input[i] >> 16) & 0xff);
- output[j + 3] = (unsigned char) ((input[i] >> 24) & 0xff);
- }
-}
-/* }}} */
-
-/* {{{ Decode
- Decodes input (unsigned char) into output (php_uint32). Assumes len is
- a multiple of 4.
- */
-static void Decode(output, input, len)
-php_uint32 *output;
-const unsigned char *input;
-unsigned int len;
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4)
- output[i] = ((php_uint32) input[j]) | (((php_uint32) input[j + 1]) << 8) |
- (((php_uint32) input[j + 2]) << 16) | (((php_uint32) input[j + 3]) << 24);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/md5.h b/ext/standard/md5.h
deleted file mode 100644
index f355ea7627..0000000000
--- a/ext/standard/md5.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef MD5_H
-#define MD5_H
-/* MD5.H - header file for MD5C.C
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- rights reserved.
-
- License to copy and use this software is granted provided that it
- is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- Algorithm" in all material mentioning or referencing this software
- or this function.
-
- License is also granted to make and use derivative works provided
- that such works are identified as "derived from the RSA Data
- Security, Inc. MD5 Message-Digest Algorithm" in all material
- mentioning or referencing the derived work.
-
- RSA Data Security, Inc. makes no representations concerning either
- the merchantability of this software or the suitability of this
- software for any particular purpose. It is provided "as is"
- without express or implied warranty of any kind.
-
- These notices must be retained in any copies of any part of this
- documentation and/or software.
- */
-
-#include "ext/standard/basic_functions.h"
-
-/* MD5 context. */
-typedef struct {
- php_uint32 state[4]; /* state (ABCD) */
- php_uint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */
- unsigned char buffer[64]; /* input buffer */
-} PHP_MD5_CTX;
-
-PHPAPI void make_digest(char *md5str, unsigned char *digest);
-PHPAPI void PHP_MD5Init(PHP_MD5_CTX *);
-PHPAPI void PHP_MD5Update(PHP_MD5_CTX *, const unsigned char *, unsigned int);
-PHPAPI void PHP_MD5Final(unsigned char[16], PHP_MD5_CTX *);
-
-PHP_NAMED_FUNCTION(php_if_md5);
-PHP_NAMED_FUNCTION(php_if_md5_file);
-
-#endif
diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c
deleted file mode 100644
index 716f109b64..0000000000
--- a/ext/standard/metaphone.c
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- Based on CPANs "Text-Metaphone-1.96" by Michael G Schwern <schwern@pobox.com>
-*/
-
-#include "php.h"
-#include "php_metaphone.h"
-
-static int metaphone(char *word, int word_len, int max_phonemes, char **phoned_word, int traditional);
-
-PHP_FUNCTION(metaphone);
-
-/* {{{ proto string metaphone(string text, int phones)
- Break english phrases down into their phonemes */
-PHP_FUNCTION(metaphone)
-{
- char *str;
- char *result = 0;
- int str_len;
- long phones = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len,
- &phones) == FAILURE) {
- return;
- }
-
- if (metaphone(str, str_len, phones, &result, 1) == 0) {
- RETVAL_STRING(result, 0);
- } else {
- if (result) {
- efree(result);
- }
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/*
- this is now the original code by Michael G Schwern:
- i've changed it just a slightly bit (use emalloc,
- get rid of includes etc)
- - thies - 13.09.1999
-*/
-
-/*----------------------------- */
-/* this used to be "metaphone.h" */
-/*----------------------------- */
-
-/* Special encodings */
-#define SH 'X'
-#define TH '0'
-
-/*----------------------------- */
-/* end of "metaphone.h" */
-/*----------------------------- */
-
-/*----------------------------- */
-/* this used to be "metachar.h" */
-/*----------------------------- */
-
-/* Metachar.h ... little bits about characters for metaphone */
-/*-- Character encoding array & accessing macros --*/
-/* Stolen directly out of the book... */
-char _codes[26] =
-{
- 1, 16, 4, 16, 9, 2, 4, 16, 9, 2, 0, 2, 2, 2, 1, 4, 0, 2, 4, 4, 1, 0, 0, 0, 8, 0
-/* a b c d e f g h i j k l m n o p q r s t u v w x y z */
-};
-
-
-#define ENCODE(c) (isalpha(c) ? _codes[((toupper(c)) - 'A')] : 0)
-
-#define isvowel(c) (ENCODE(c) & 1) /* AEIOU */
-
-/* These letters are passed through unchanged */
-#define NOCHANGE(c) (ENCODE(c) & 2) /* FJMNR */
-
-/* These form dipthongs when preceding H */
-#define AFFECTH(c) (ENCODE(c) & 4) /* CGPST */
-
-/* These make C and G soft */
-#define MAKESOFT(c) (ENCODE(c) & 8) /* EIY */
-
-/* These prevent GH from becoming F */
-#define NOGHTOF(c) (ENCODE(c) & 16) /* BDH */
-
-/*----------------------------- */
-/* end of "metachar.h" */
-/*----------------------------- */
-
-/* I suppose I could have been using a character pointer instead of
- * accesssing the array directly... */
-
-/* Look at the next letter in the word */
-#define Next_Letter (toupper(word[w_idx+1]))
-/* Look at the current letter in the word */
-#define Curr_Letter (toupper(word[w_idx]))
-/* Go N letters back. */
-#define Look_Back_Letter(n) (w_idx >= n ? toupper(word[w_idx-n]) : '\0')
-/* Previous letter. I dunno, should this return null on failure? */
-#define Prev_Letter (Look_Back_Letter(1))
-/* Look two letters down. It makes sure you don't walk off the string. */
-#define After_Next_Letter (Next_Letter != '\0' ? toupper(word[w_idx+2]) \
- : '\0')
-#define Look_Ahead_Letter(n) (toupper(Lookahead(word+w_idx, n)))
-
-
-/* Allows us to safely look ahead an arbitrary # of letters */
-/* I probably could have just used strlen... */
-static char Lookahead(char *word, int how_far)
-{
- char letter_ahead = '\0'; /* null by default */
- int idx;
- for (idx = 0; word[idx] != '\0' && idx < how_far; idx++);
- /* Edge forward in the string... */
-
- letter_ahead = word[idx]; /* idx will be either == to how_far or
- * at the end of the string
- */
- return letter_ahead;
-}
-
-
-/* phonize one letter
- * We don't know the buffers size in advance. On way to solve this is to just
- * re-allocate the buffer size. We're using an extra of 2 characters (this
- * could be one though; or more too). */
-#define Phonize(c) { \
- if (p_idx >= max_buffer_len) { \
- *phoned_word = erealloc(*phoned_word, max_buffer_len + 2); \
- max_buffer_len += 2; \
- } \
- (*phoned_word)[p_idx++] = c; \
- }
-/* Slap a null character on the end of the phoned word */
-#define End_Phoned_Word {(*phoned_word)[p_idx] = '\0';}
-/* How long is the phoned word? */
-#define Phone_Len (p_idx)
-
-/* Note is a letter is a 'break' in the word */
-#define Isbreak(c) (!isalpha(c))
-
-/* {{{ metaphone
- */
-static int metaphone(char *word, int word_len, int max_phonemes, char **phoned_word, int traditional)
-{
- int w_idx = 0; /* point in the phonization we're at. */
- int p_idx = 0; /* end of the phoned phrase */
- int max_buffer_len = 0; /* maximum length of the destination buffer */
-
-/*-- Parameter checks --*/
- /* Negative phoneme length is meaningless */
-
- if (max_phonemes < 0)
- return -1;
-
- /* Empty/null string is meaningless */
- /* Overly paranoid */
- /* assert(word != NULL && word[0] != '\0'); */
-
- if (word == NULL)
- return -1;
-
-/*-- Allocate memory for our phoned_phrase --*/
- if (max_phonemes == 0) { /* Assume largest possible */
- max_buffer_len = word_len;
- *phoned_word = emalloc(sizeof(char) * word_len + 1);
- } else {
- max_buffer_len = max_phonemes;
- *phoned_word = emalloc(sizeof(char) * max_phonemes + 1);
- }
-
-
-/*-- The first phoneme has to be processed specially. --*/
- /* Find our first letter */
- for (; !isalpha(Curr_Letter); w_idx++) {
- /* On the off chance we were given nothing but crap... */
- if (Curr_Letter == '\0') {
- End_Phoned_Word
- return SUCCESS; /* For testing */
- }
- }
-
- switch (Curr_Letter) {
- /* AE becomes E */
- case 'A':
- if (Next_Letter == 'E') {
- Phonize('E');
- w_idx += 2;
- }
- /* Remember, preserve vowels at the beginning */
- else {
- Phonize('A');
- w_idx++;
- }
- break;
- /* [GKP]N becomes N */
- case 'G':
- case 'K':
- case 'P':
- if (Next_Letter == 'N') {
- Phonize('N');
- w_idx += 2;
- }
- break;
- /* WH becomes H,
- WR becomes R
- W if followed by a vowel */
- case 'W':
- if (Next_Letter == 'H' ||
- Next_Letter == 'R') {
- Phonize(Next_Letter);
- w_idx += 2;
- } else if (isvowel(Next_Letter)) {
- Phonize('W');
- w_idx += 2;
- }
- /* else ignore */
- break;
- /* X becomes S */
- case 'X':
- Phonize('S');
- w_idx++;
- break;
- /* Vowels are kept */
- /* We did A already
- case 'A':
- case 'a':
- */
- case 'E':
- case 'I':
- case 'O':
- case 'U':
- Phonize(Curr_Letter);
- w_idx++;
- break;
- default:
- /* do nothing */
- break;
- }
-
-
-
- /* On to the metaphoning */
- for (; Curr_Letter != '\0' &&
- (max_phonemes == 0 || Phone_Len < max_phonemes);
- w_idx++) {
- /* How many letters to skip because an eariler encoding handled
- * multiple letters */
- unsigned short int skip_letter = 0;
-
-
- /* THOUGHT: It would be nice if, rather than having things like...
- * well, SCI. For SCI you encode the S, then have to remember
- * to skip the C. So the phonome SCI invades both S and C. It would
- * be better, IMHO, to skip the C from the S part of the encoding.
- * Hell, I'm trying it.
- */
-
- /* Ignore non-alphas */
- if (!isalpha(Curr_Letter))
- continue;
-
- /* Drop duplicates, except CC */
- if (Curr_Letter == Prev_Letter &&
- Curr_Letter != 'C')
- continue;
-
- switch (Curr_Letter) {
- /* B -> B unless in MB */
- case 'B':
- if (Prev_Letter != 'M')
- Phonize('B');
- break;
- /* 'sh' if -CIA- or -CH, but not SCH, except SCHW.
- * (SCHW is handled in S)
- * S if -CI-, -CE- or -CY-
- * dropped if -SCI-, SCE-, -SCY- (handed in S)
- * else K
- */
- case 'C':
- if (MAKESOFT(Next_Letter)) { /* C[IEY] */
- if (After_Next_Letter == 'A' &&
- Next_Letter == 'I') { /* CIA */
- Phonize(SH);
- }
- /* SC[IEY] */
- else if (Prev_Letter == 'S') {
- /* Dropped */
- } else {
- Phonize('S');
- }
- } else if (Next_Letter == 'H') {
- if ((!traditional) && (After_Next_Letter == 'R' || Prev_Letter == 'S')) { /* Christ, School */
- Phonize('K');
- } else {
- Phonize(SH);
- }
- skip_letter++;
- } else {
- Phonize('K');
- }
- break;
- /* J if in -DGE-, -DGI- or -DGY-
- * else T
- */
- case 'D':
- if (Next_Letter == 'G' &&
- MAKESOFT(After_Next_Letter)) {
- Phonize('J');
- skip_letter++;
- } else
- Phonize('T');
- break;
- /* F if in -GH and not B--GH, D--GH, -H--GH, -H---GH
- * else dropped if -GNED, -GN,
- * else dropped if -DGE-, -DGI- or -DGY- (handled in D)
- * else J if in -GE-, -GI, -GY and not GG
- * else K
- */
- case 'G':
- if (Next_Letter == 'H') {
- if (!(NOGHTOF(Look_Back_Letter(3)) ||
- Look_Back_Letter(4) == 'H')) {
- Phonize('F');
- skip_letter++;
- } else {
- /* silent */
- }
- } else if (Next_Letter == 'N') {
- if (Isbreak(After_Next_Letter) ||
- (After_Next_Letter == 'E' &&
- Look_Ahead_Letter(3) == 'D')) {
- /* dropped */
- } else
- Phonize('K');
- } else if (MAKESOFT(Next_Letter) &&
- Prev_Letter != 'G') {
- Phonize('J');
- } else {
- Phonize('K');
- }
- break;
- /* H if before a vowel and not after C,G,P,S,T */
- case 'H':
- if (isvowel(Next_Letter) &&
- !AFFECTH(Prev_Letter))
- Phonize('H');
- break;
- /* dropped if after C
- * else K
- */
- case 'K':
- if (Prev_Letter != 'C')
- Phonize('K');
- break;
- /* F if before H
- * else P
- */
- case 'P':
- if (Next_Letter == 'H') {
- Phonize('F');
- } else {
- Phonize('P');
- }
- break;
- /* K
- */
- case 'Q':
- Phonize('K');
- break;
- /* 'sh' in -SH-, -SIO- or -SIA- or -SCHW-
- * else S
- */
- case 'S':
- if (Next_Letter == 'I' &&
- (After_Next_Letter == 'O' ||
- After_Next_Letter == 'A')) {
- Phonize(SH);
- } else if (Next_Letter == 'H') {
- Phonize(SH);
- skip_letter++;
- } else if ((!traditional) && (Next_Letter == 'C' && Look_Ahead_Letter(2) == 'H' && Look_Ahead_Letter(3) == 'W')) {
- Phonize(SH);
- skip_letter += 2;
- } else {
- Phonize('S');
- }
- break;
- /* 'sh' in -TIA- or -TIO-
- * else 'th' before H
- * else T
- */
- case 'T':
- if (Next_Letter == 'I' &&
- (After_Next_Letter == 'O' ||
- After_Next_Letter == 'A')) {
- Phonize(SH);
- } else if (Next_Letter == 'H') {
- Phonize(TH);
- skip_letter++;
- } else {
- Phonize('T');
- }
- break;
- /* F */
- case 'V':
- Phonize('F');
- break;
- /* W before a vowel, else dropped */
- case 'W':
- if (isvowel(Next_Letter))
- Phonize('W');
- break;
- /* KS */
- case 'X':
- Phonize('K');
- Phonize('S');
- break;
- /* Y if followed by a vowel */
- case 'Y':
- if (isvowel(Next_Letter))
- Phonize('Y');
- break;
- /* S */
- case 'Z':
- Phonize('S');
- break;
- /* No transformation */
- case 'F':
- case 'J':
- case 'L':
- case 'M':
- case 'N':
- case 'R':
- Phonize(Curr_Letter);
- break;
- default:
- /* nothing */
- break;
- } /* END SWITCH */
-
- w_idx += skip_letter;
- } /* END FOR */
-
- End_Phoned_Word;
-
- return 0;
-} /* END metaphone */
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c
deleted file mode 100644
index 414bd027dc..0000000000
--- a/ext/standard/microtime.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Paul Panotzki - Bunyip Information Systems |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#elif defined(NETWARE)
-#ifdef NEW_LIBC
-#include <sys/timeval.h>
-#else
-#include "netware/time_nw.h"
-#endif
-#else
-#include <sys/time.h>
-#endif
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-
-#include "microtime.h"
-
-#define NUL '\0'
-#define MICRO_IN_SEC 1000000.00
-#define SEC_IN_MIN 60
-
-/* {{{ proto string microtime(void)
- Returns a string containing the current time in seconds and microseconds */
-#ifdef HAVE_GETTIMEOFDAY
-PHP_FUNCTION(microtime)
-{
- struct timeval tp;
- long sec = 0L;
- double msec = 0.0;
- char ret[100];
-
- if (gettimeofday((struct timeval *) &tp, (NUL)) == 0) {
- msec = (double) (tp.tv_usec / MICRO_IN_SEC);
- sec = tp.tv_sec;
-
- if (msec >= 1.0) msec -= (long) msec;
- snprintf(ret, 100, "%.8f %ld", msec, sec);
- RETVAL_STRING(ret,1);
- } else {
- RETURN_FALSE;
- }
-}
-#endif
-/* }}} */
-
-/* {{{ proto array gettimeofday(void)
- Returns the current time as array */
-#ifdef HAVE_GETTIMEOFDAY
-PHP_FUNCTION(gettimeofday)
-{
- struct timeval tp;
- struct timezone tz;
-
- memset(&tp, 0, sizeof(tp));
- memset(&tz, 0, sizeof(tz));
- if(gettimeofday(&tp, &tz) == 0) {
- array_init(return_value);
- add_assoc_long(return_value, "sec", tp.tv_sec);
- add_assoc_long(return_value, "usec", tp.tv_usec);
-#ifdef PHP_WIN32
- add_assoc_long(return_value, "minuteswest", tz.tz_minuteswest/SEC_IN_MIN);
-#else
- add_assoc_long(return_value, "minuteswest", tz.tz_minuteswest);
-#endif
- add_assoc_long(return_value, "dsttime", tz.tz_dsttime);
- return;
- } else {
- RETURN_FALSE;
- }
-}
-#endif
-/* }}} */
-
-#ifdef HAVE_GETRUSAGE
-/* {{{ proto array getrusage([int who])
- Returns an array of usage statistics */
-PHP_FUNCTION(getrusage)
-{
- struct rusage usg;
- int ac = ZEND_NUM_ARGS();
- pval **pwho;
- int who = RUSAGE_SELF;
-
- if(ac == 1 &&
- zend_get_parameters_ex(ac, &pwho) != FAILURE) {
- convert_to_long_ex(pwho);
- if(Z_LVAL_PP(pwho) == 1)
- who = RUSAGE_CHILDREN;
- }
-
- memset(&usg, 0, sizeof(usg));
- if(getrusage(who, &usg) == -1) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-#define PHP_RUSAGE_PARA(a) \
- add_assoc_long(return_value, #a, usg.a)
-#if !defined( _OSD_POSIX) && !defined(__BEOS__) /* BS2000 has only a few fields in the rusage struct */
- PHP_RUSAGE_PARA(ru_oublock);
- PHP_RUSAGE_PARA(ru_inblock);
- PHP_RUSAGE_PARA(ru_msgsnd);
- PHP_RUSAGE_PARA(ru_msgrcv);
- PHP_RUSAGE_PARA(ru_maxrss);
- PHP_RUSAGE_PARA(ru_ixrss);
- PHP_RUSAGE_PARA(ru_idrss);
- PHP_RUSAGE_PARA(ru_minflt);
- PHP_RUSAGE_PARA(ru_majflt);
- PHP_RUSAGE_PARA(ru_nsignals);
- PHP_RUSAGE_PARA(ru_nvcsw);
- PHP_RUSAGE_PARA(ru_nivcsw);
-#endif /*_OSD_POSIX*/
- PHP_RUSAGE_PARA(ru_utime.tv_usec);
- PHP_RUSAGE_PARA(ru_utime.tv_sec);
- PHP_RUSAGE_PARA(ru_stime.tv_usec);
- PHP_RUSAGE_PARA(ru_stime.tv_sec);
-#undef PHP_RUSAGE_PARA
-}
-#endif /* HAVE_GETRUSAGE */
-
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/microtime.h b/ext/standard/microtime.h
deleted file mode 100644
index 5dcf6cd62a..0000000000
--- a/ext/standard/microtime.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Paul Panotzki - Bunyip Information Systems |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef MICROTIME_H
-#define MICROTIME_H
-
-#ifdef HAVE_GETTIMEOFDAY
-PHP_FUNCTION(microtime);
-PHP_FUNCTION(gettimeofday);
-#endif
-#ifdef HAVE_GETRUSAGE
-PHP_FUNCTION(getrusage);
-#endif
-
-#endif /* MICROTIME_H */
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
deleted file mode 100644
index 3b855f8f77..0000000000
--- a/ext/standard/pack.c
+++ /dev/null
@@ -1,918 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Chris Schneider <cschneid@relog.ch> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#ifdef PHP_WIN32
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#elif defined(NETWARE)
-#ifdef USE_WINSOCK
-/*#include <ws2nlm.h>*/
-#include <novsock2.h>
-#else
-#include <sys/socket.h>
-#endif
-#ifdef NEW_LIBC
-#include <sys/param.h>
-#else
-#include "netware/param.h"
-#endif
-#else
-#include <sys/param.h>
-#endif
-#include "ext/standard/head.h"
-#include "safe_mode.h"
-#include "php_string.h"
-#include "pack.h"
-#if HAVE_PWD_H
-#ifdef PHP_WIN32
-#include "win32/pwd.h"
-#elif defined(NETWARE)
-#include "netware/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-#include "fsock.h"
-#if HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-/* Whether machine is little endian */
-char machine_little_endian;
-
-/* Mapping of byte from char (8bit) to long for machine endian */
-static int byte_map[1];
-
-/* Mappings of bytes from int (machine dependant) to int for machine endian */
-static int int_map[sizeof(int)];
-
-/* Mappings of bytes from shorts (16bit) for all endian environments */
-static int machine_endian_short_map[2];
-static int big_endian_short_map[2];
-static int little_endian_short_map[2];
-
-/* Mappings of bytes from longs (32bit) for all endian environments */
-static int machine_endian_long_map[4];
-static int big_endian_long_map[4];
-static int little_endian_long_map[4];
-
-/* {{{ php_pack
- */
-static void php_pack(zval **val, int size, int *map, char *output)
-{
- int i;
- char *v;
-
- convert_to_long_ex(val);
- v = (char *) &Z_LVAL_PP(val);
-
- for (i = 0; i < size; i++) {
- *output++ = v[map[i]];
- }
-}
-/* }}} */
-
-/* pack() idea stolen from Perl (implemented formats behave the same as there)
- * Implemented formats are A, a, h, H, c, C, s, S, i, I, l, L, n, N, f, d, x, X, @.
- */
-/* {{{ proto string pack(string format, mixed arg1 [, mixed arg2 [, mixed ...]])
- Takes one or more arguments and packs them into a binary string according to the format argument */
-PHP_FUNCTION(pack)
-{
- zval ***argv;
- int argc, i;
- int currentarg;
- char *format;
- int formatlen;
- char *formatcodes;
- int *formatargs;
- int formatcount = 0;
- int outputpos = 0, outputsize = 0;
- char *output;
-
- argc = ZEND_NUM_ARGS();
-
- if (argc < 1) {
- WRONG_PARAM_COUNT;
- }
-
- argv = emalloc(argc * sizeof(zval **));
-
- if (zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- efree(argv);
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(argv[0]);
- format = Z_STRVAL_PP(argv[0]);
- formatlen = Z_STRLEN_PP(argv[0]);
-
- /* We have a maximum of <formatlen> format codes to deal with */
- formatcodes = emalloc(formatlen * sizeof(*formatcodes));
- formatargs = emalloc(formatlen * sizeof(*formatargs));
- currentarg = 1;
-
- /* Preprocess format into formatcodes and formatargs */
- for (i = 0; i < formatlen; formatcount++) {
- char code = format[i++];
- int arg = 1;
-
- /* Handle format arguments if any */
- if (i < formatlen) {
- char c = format[i];
-
- if (c == '*') {
- arg = -1;
- i++;
- }
- else if (c >= '0' && c <= '9') {
- arg = atoi(&format[i]);
-
- while (format[i] >= '0' && format[i] <= '9' && i < formatlen) {
- i++;
- }
- }
- }
-
- /* Handle special arg '*' for all codes and check argv overflows */
- switch ((int) code) {
- /* Never uses any args */
- case 'x':
- case 'X':
- case '@':
- if (arg < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: '*' ignored", code);
- arg = 1;
- }
- break;
-
- /* Always uses one arg */
- case 'a':
- case 'A':
- case 'h':
- case 'H':
- if (currentarg >= argc) {
- efree(argv);
- efree(formatcodes);
- efree(formatargs);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: not enough arguments", code);
- RETURN_FALSE;
- }
-
- if (arg < 0) {
- arg = Z_STRLEN_PP(argv[currentarg]);
- }
-
- currentarg++;
- break;
-
- /* Use as many args as specified */
- case 'c':
- case 'C':
- case 's':
- case 'S':
- case 'i':
- case 'I':
- case 'l':
- case 'L':
- case 'n':
- case 'N':
- case 'v':
- case 'V':
- case 'f':
- case 'd':
- if (arg < 0) {
- arg = argc - currentarg;
- }
-
- currentarg += arg;
-
- if (currentarg > argc) {
- efree(argv);
- efree(formatcodes);
- efree(formatargs);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: too few arguments", code);
- RETURN_FALSE;
- }
- break;
-
- default:
- efree(argv);
- efree(formatcodes);
- efree(formatargs);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: unknown format code", code);
- RETURN_FALSE;
- }
-
- formatcodes[formatcount] = code;
- formatargs[formatcount] = arg;
- }
-
- if (currentarg < argc) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d arguments unused", (argc - currentarg));
- }
-
- /* Calculate output length and upper bound while processing*/
- for (i = 0; i < formatcount; i++) {
- int code = (int) formatcodes[i];
- int arg = formatargs[i];
-
- switch ((int) code) {
- case 'h':
- case 'H':
- outputpos += (arg + 1) / 2; /* 4 bit per arg */
- break;
-
- case 'a':
- case 'A':
- case 'c':
- case 'C':
- case 'x':
- outputpos += arg; /* 8 bit per arg */
- break;
-
- case 's':
- case 'S':
- case 'n':
- case 'v':
- outputpos += arg * 2; /* 16 bit per arg */
- break;
-
- case 'i':
- case 'I':
- outputpos += arg * sizeof(int);
- break;
-
- case 'l':
- case 'L':
- case 'N':
- case 'V':
- outputpos += arg * 4; /* 32 bit per arg */
- break;
-
- case 'f':
- outputpos += arg * sizeof(float);
- break;
-
- case 'd':
- outputpos += arg * sizeof(double);
- break;
-
- case 'X':
- outputpos -= arg;
-
- if (outputpos < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: outside of string", code);
- outputpos = 0;
- }
- break;
-
- case '@':
- outputpos = arg;
- break;
- }
-
- if (outputsize < outputpos) {
- outputsize = outputpos;
- }
- }
-
- output = emalloc(outputsize + 1);
- outputpos = 0;
- currentarg = 1;
-
- /* Do actual packing */
- for (i = 0; i < formatcount; i++) {
- int code = (int) formatcodes[i];
- int arg = formatargs[i];
- zval **val;
-
- switch ((int) code) {
- case 'a':
- case 'A':
- memset(&output[outputpos], (code == 'a') ? '\0' : ' ', arg);
- val = argv[currentarg++];
- convert_to_string_ex(val);
- memcpy(&output[outputpos], Z_STRVAL_PP(val),
- (Z_STRLEN_PP(val) < arg) ? Z_STRLEN_PP(val) : arg);
- outputpos += arg;
- break;
-
- case 'h':
- case 'H': {
- int nibbleshift = (code == 'h') ? 0 : 4;
- int first = 1;
- char *v;
-
- val = argv[currentarg++];
- convert_to_string_ex(val);
- v = Z_STRVAL_PP(val);
- outputpos--;
- if(arg > Z_STRLEN_PP(val)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: not enough characters in string", code);
- arg = Z_STRLEN_PP(val);
- }
-
- while (arg-- > 0) {
- char n = *v++;
-
- if (n >= '0' && n <= '9') {
- n -= '0';
- } else if (n >= 'A' && n <= 'F') {
- n -= ('A' - 10);
- } else if (n >= 'a' && n <= 'f') {
- n -= ('a' - 10);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: illegal hex digit %c", code, n);
- n = 0;
- }
-
- if (first--) {
- output[++outputpos] = 0;
- } else {
- first = 1;
- }
-
- output[outputpos] |= (n << nibbleshift);
- nibbleshift = (nibbleshift + 4) & 7;
- }
-
- outputpos++;
- break;
- }
-
- case 'c':
- case 'C':
- while (arg-- > 0) {
- php_pack(argv[currentarg++], 1, byte_map, &output[outputpos]);
- outputpos++;
- }
- break;
-
- case 's':
- case 'S':
- case 'n':
- case 'v': {
- int *map = machine_endian_short_map;
-
- if (code == 'n') {
- map = big_endian_short_map;
- } else if (code == 'v') {
- map = little_endian_short_map;
- }
-
- while (arg-- > 0) {
- php_pack(argv[currentarg++], 2, map, &output[outputpos]);
- outputpos += 2;
- }
- break;
- }
-
- case 'i':
- case 'I':
- while (arg-- > 0) {
- php_pack(argv[currentarg++], sizeof(int), int_map, &output[outputpos]);
- outputpos += sizeof(int);
- }
- break;
-
- case 'l':
- case 'L':
- case 'N':
- case 'V': {
- int *map = machine_endian_long_map;
-
- if (code == 'N') {
- map = big_endian_long_map;
- } else if (code == 'V') {
- map = little_endian_long_map;
- }
-
- while (arg-- > 0) {
- php_pack(argv[currentarg++], 4, map, &output[outputpos]);
- outputpos += 4;
- }
- break;
- }
-
- case 'f': {
- float v;
-
- while (arg-- > 0) {
- val = argv[currentarg++];
- convert_to_double_ex(val);
- v = (float) Z_DVAL_PP(val);
- memcpy(&output[outputpos], &v, sizeof(v));
- outputpos += sizeof(v);
- }
- break;
- }
-
- case 'd': {
- double v;
-
- while (arg-- > 0) {
- val = argv[currentarg++];
- convert_to_double_ex(val);
- v = (double) Z_DVAL_PP(val);
- memcpy(&output[outputpos], &v, sizeof(v));
- outputpos += sizeof(v);
- }
- break;
- }
-
- case 'x':
- memset(&output[outputpos], '\0', arg);
- outputpos += arg;
- break;
-
- case 'X':
- outputpos -= arg;
-
- if (outputpos < 0) {
- outputpos = 0;
- }
- break;
-
- case '@':
- if (arg > outputpos) {
- memset(&output[outputpos], '\0', arg - outputpos);
- }
- outputpos = arg;
- break;
- }
- }
-
- efree(argv);
- efree(formatcodes);
- efree(formatargs);
- output[outputpos] = '\0';
- RETVAL_STRINGL(output, outputpos, 1);
- efree(output);
-}
-/* }}} */
-
-/* {{{ php_unpack
- */
-static long php_unpack(char *data, int size, int issigned, int *map)
-{
- long result;
- char *cresult = (char *) &result;
- int i;
-
- result = issigned ? -1 : 0;
-
- for (i = 0; i < size; i++) {
- cresult[map[i]] = *data++;
- }
-
- return result;
-}
-/* }}} */
-
-/* unpack() is based on Perl's unpack(), but is modified a bit from there.
- * Rather than depending on error-prone ordered lists or syntactically
- * unpleasant pass-by-reference, we return an object with named paramters
- * (like *_fetch_object()). Syntax is "f[repeat]name/...", where "f" is the
- * formatter char (like pack()), "[repeat]" is the optional repeater argument,
- * and "name" is the name of the variable to use.
- * Example: "c2chars/nints" will return an object with fields
- * chars1, chars2, and ints.
- * Numeric pack types will return numbers, a and A will return strings,
- * f and d will return doubles.
- * Implemented formats are A, a, h, H, c, C, s, S, i, I, l, L, n, N, f, d, x, X, @.
- */
-/* {{{ proto array unpack(string format, string input)
- Unpack binary string into named array elements according to format argument */
-PHP_FUNCTION(unpack)
-{
- zval **formatarg;
- zval **inputarg;
- char *format;
- char *input;
- int formatlen;
- int inputpos, inputlen;
- int i;
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &formatarg, &inputarg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(formatarg);
- convert_to_string_ex(inputarg);
-
- format = Z_STRVAL_PP(formatarg);
- formatlen = Z_STRLEN_PP(formatarg);
- input = Z_STRVAL_PP(inputarg);
- inputlen = Z_STRLEN_PP(inputarg);
- inputpos = 0;
-
- array_init(return_value);
-
- while (formatlen-- > 0) {
- char type = *(format++);
- char c;
- int arg = 1;
- char *name;
- int namelen;
- int size=0;
-
- /* Handle format arguments if any */
- if (formatlen > 0) {
- c = *format;
-
- if (c >= '0' && c <= '9') {
- arg = atoi(format);
-
- while (formatlen > 0 && *format >= '0' && *format <= '9') {
- format++;
- formatlen--;
- }
- } else if (c == '*') {
- arg = -1;
- format++;
- formatlen--;
- }
- }
-
- /* Get of new value in array */
- name = format;
-
- while (formatlen > 0 && *format != '/') {
- formatlen--;
- format++;
- }
-
- namelen = format - name;
-
- if (namelen > 200)
- namelen = 200;
-
- switch ((int) type) {
- /* Never use any input */
- case 'X':
- size = -1;
- break;
-
- case '@':
- size = 0;
- break;
-
- case 'a':
- case 'A':
- size = arg;
- arg = 1;
- break;
-
- case 'h':
- case 'H':
- size = (arg > 0) ? arg / 2 : arg;
- arg = 1;
- break;
-
- /* Use 1 byte of input */
- case 'c':
- case 'C':
- case 'x':
- size = 1;
- break;
-
- /* Use 2 bytes of input */
- case 's':
- case 'S':
- case 'n':
- case 'v':
- size = 2;
- break;
-
- /* Use sizeof(int) bytes of input */
- case 'i':
- case 'I':
- size = sizeof(int);
- break;
-
- /* Use 4 bytes of input */
- case 'l':
- case 'L':
- case 'N':
- case 'V':
- size = 4;
- break;
-
- /* Use sizeof(float) bytes of input */
- case 'f':
- size = sizeof(float);
- break;
-
- /* Use sizeof(double) bytes of input */
- case 'd':
- size = sizeof(double);
- break;
- }
-
- /* Do actual unpacking */
- for (i = 0; i != arg; i++ ) {
- /* Space for name + number, safe as namelen is ensured <= 200 */
- char n[256];
-
- if (arg != 1) {
- /* Need to add element number to name */
- sprintf(n, "%.*s%d", namelen, name, i + 1);
- } else {
- /* Truncate name to next format code or end of string */
- sprintf(n, "%.*s", namelen, name);
- }
-
- if ((inputpos + size) <= inputlen) {
- switch ((int) type) {
- case 'a':
- case 'A': {
- char pad = (type == 'a') ? '\0' : ' ';
- int len = inputlen - inputpos; /* Remaining string */
-
- /* If size was given take minimum of len and size */
- if ((size >= 0) && (len > size)) {
- len = size;
- }
-
- size = len;
-
- /* Remove padding chars from unpacked data */
- while (--len >= 0) {
- if (input[inputpos + len] != pad)
- break;
- }
-
- add_assoc_stringl(return_value, n, &input[inputpos], len + 1, 1);
- break;
- }
-
- case 'h':
- case 'H': {
- int len = (inputlen - inputpos) * 2; /* Remaining */
- int nibbleshift = (type == 'h') ? 0 : 4;
- int first = 1;
- char *buf;
- int ipos, opos;
-
- /* If size was given take minimum of len and size */
- if (size >= 0 && len > (size * 2)) {
- len = size * 2;
- }
-
- buf = emalloc(len + 1);
-
- for (ipos = opos = 0; opos < len; opos++) {
- char c = (input[inputpos + ipos] >> nibbleshift) & 0xf;
-
- if (c < 10) {
- c += '0';
- } else {
- c += 'a' - 10;
- }
-
- buf[opos] = c;
- nibbleshift = (nibbleshift + 4) & 7;
-
- if (first-- == 0) {
- ipos++;
- first = 1;
- }
- }
-
- buf[len] = '\0';
- add_assoc_stringl(return_value, n, buf, len, 1);
- efree(buf);
- break;
- }
-
- case 'c':
- case 'C': {
- int issigned = (type == 'c') ? (input[inputpos] & 0x80) : 0;
- long v = php_unpack(&input[inputpos], 1, issigned, byte_map);
- add_assoc_long(return_value, n, v);
- break;
- }
-
- case 's':
- case 'S':
- case 'n':
- case 'v': {
- long v;
- int issigned = 0;
- int *map = machine_endian_short_map;
-
- if (type == 's') {
- issigned = input[inputpos + (machine_little_endian ? 1 : 0)] & 0x80;
- } else if (type == 'n') {
- map = big_endian_short_map;
- } else if (type == 'v') {
- map = little_endian_short_map;
- }
-
- v = php_unpack(&input[inputpos], 2, issigned, map);
- add_assoc_long(return_value, n, v);
- break;
- }
-
- case 'i':
- case 'I': {
- long v;
- int issigned = 0;
-
- if (type == 'i') {
- issigned = input[inputpos + (machine_little_endian ? (sizeof(int) - 1) : 0)] & 0x80;
- }
-
- v = php_unpack(&input[inputpos], sizeof(int), issigned, int_map);
- add_assoc_long(return_value, n, v);
- break;
- }
-
- case 'l':
- case 'L':
- case 'N':
- case 'V': {
- int issigned = 0;
- int *map = machine_endian_long_map;
- long v;
-
- if (type == 'l') {
- issigned = input[inputpos + (machine_little_endian ? 3 : 0)] & 0x80;
- } else if (type == 'N') {
- map = big_endian_long_map;
- } else if (type == 'V') {
- map = little_endian_long_map;
- }
-
- v = php_unpack(&input[inputpos], 4, issigned, map);
- add_assoc_long(return_value, n, v);
- break;
- }
-
- case 'f': {
- float v;
-
- memcpy(&v, &input[inputpos], sizeof(float));
- add_assoc_double(return_value, n, (double)v);
- break;
- }
-
- case 'd': {
- double v;
-
- memcpy(&v, &input[inputpos], sizeof(double));
- add_assoc_double(return_value, n, v);
- break;
- }
-
- case 'x':
- /* Do nothing with input, just skip it */
- break;
-
- case 'X':
- if (inputpos < size) {
- inputpos = -size;
- i = arg - 1; /* Break out of for loop */
-
- if (arg >= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: outside of string", type);
- }
- }
- break;
-
- case '@':
- if (arg <= inputlen) {
- inputpos = arg;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: outside of string", type);
- }
-
- i = arg - 1; /* Done, break out of for loop */
- break;
- }
-
- inputpos += size;
- } else if (arg < 0) {
- /* Reached end of input for '*' repeater */
- break;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: not enough input, need %d, have %d", type, size, inputlen - inputpos);
- zval_dtor(return_value);
- RETURN_FALSE;
- }
- }
-
- formatlen--; /* Skip '/' separator, does no harm if inputlen == 0 */
- format++;
- }
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(pack)
-{
- int machine_endian_check = 1;
- int i;
-
- machine_little_endian = ((char *)&machine_endian_check)[0];
-
- if (machine_little_endian) {
- /* Where to get lo to hi bytes from */
- byte_map[0] = 0;
-
- for (i = 0; i < sizeof(int); i++) {
- int_map[i] = i;
- }
-
- machine_endian_short_map[0] = 0;
- machine_endian_short_map[1] = 1;
- big_endian_short_map[0] = 1;
- big_endian_short_map[1] = 0;
- little_endian_short_map[0] = 0;
- little_endian_short_map[1] = 1;
-
- machine_endian_long_map[0] = 0;
- machine_endian_long_map[1] = 1;
- machine_endian_long_map[2] = 2;
- machine_endian_long_map[3] = 3;
- big_endian_long_map[0] = 3;
- big_endian_long_map[1] = 2;
- big_endian_long_map[2] = 1;
- big_endian_long_map[3] = 0;
- little_endian_long_map[0] = 0;
- little_endian_long_map[1] = 1;
- little_endian_long_map[2] = 2;
- little_endian_long_map[3] = 3;
- }
- else {
- zval val;
- int size = sizeof(Z_LVAL(val));
- Z_LVAL(val)=0; /*silence a warning*/
-
- /* Where to get hi to lo bytes from */
- byte_map[0] = size - 1;
-
- for (i = 0; i < sizeof(int); i++) {
- int_map[i] = size - (sizeof(int) - i);
- }
-
- machine_endian_short_map[0] = size - 2;
- machine_endian_short_map[1] = size - 1;
- big_endian_short_map[0] = size - 2;
- big_endian_short_map[1] = size - 1;
- little_endian_short_map[0] = size - 1;
- little_endian_short_map[1] = size - 2;
-
- machine_endian_long_map[0] = size - 4;
- machine_endian_long_map[1] = size - 3;
- machine_endian_long_map[2] = size - 2;
- machine_endian_long_map[3] = size - 1;
- big_endian_long_map[0] = size - 4;
- big_endian_long_map[1] = size - 3;
- big_endian_long_map[2] = size - 2;
- big_endian_long_map[3] = size - 1;
- little_endian_long_map[0] = size - 1;
- little_endian_long_map[1] = size - 2;
- little_endian_long_map[2] = size - 3;
- little_endian_long_map[3] = size - 4;
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/standard/pack.h b/ext/standard/pack.h
deleted file mode 100644
index d3414e2aad..0000000000
--- a/ext/standard/pack.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PACK_H
-#define PACK_H
-
-PHP_MINIT_FUNCTION(pack);
-PHP_FUNCTION(pack);
-PHP_FUNCTION(unpack);
-
-#endif /* PACK_H */
diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c
deleted file mode 100644
index 43e7b338fb..0000000000
--- a/ext/standard/pageinfo.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "pageinfo.h"
-#include "SAPI.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#if HAVE_PWD_H
-#ifdef PHP_WIN32
-#include "win32/pwd.h"
-#elif defined(NETWARE)
-#ifdef ZTS
-extern int basic_globals_id;
-#endif
-#include "netware/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-#if HAVE_GRP_H
-# ifdef PHP_WIN32
-# include "win32/grp.h"
-# else
-# include <grp.h>
-# endif
-#endif
-#ifdef PHP_WIN32
-#undef getgid
-#define getgroups(a, b) 0
-#define getgid() 1
-#define getuid() 1
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-#include <sys/types.h>
-#ifdef PHP_WIN32
-#include <process.h>
-#endif
-
-#include "ext/standard/basic_functions.h"
-
-/* {{{ php_statpage
- */
-PHPAPI void php_statpage(TSRMLS_D)
-{
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- struct stat_libc *pstat;
-#else
- struct stat *pstat;
-#endif
-
- pstat = sapi_get_stat(TSRMLS_C);
-
- if (BG(page_uid)==-1 || BG(page_gid)==-1) {
- if(pstat) {
- BG(page_uid) = pstat->st_uid;
- BG(page_gid) = pstat->st_gid;
- BG(page_inode) = pstat->st_ino;
-#if defined(NETWARE) && defined(NEW_LIBC)
- BG(page_mtime) = (pstat->st_mtime).tv_nsec;
-#else
- BG(page_mtime) = pstat->st_mtime;
-#endif
- } else { /* handler for situations where there is no source file, ex. php -r */
- BG(page_uid) = getuid();
- BG(page_gid) = getgid();
- }
- }
-}
-/* }}} */
-
-/* {{{ php_getuid
- */
-long php_getuid(void)
-{
- TSRMLS_FETCH();
-
- php_statpage(TSRMLS_C);
- return (BG(page_uid));
-}
-/* }}} */
-
-long php_getgid(void)
-{
- TSRMLS_FETCH();
-
- php_statpage(TSRMLS_C);
- return (BG(page_gid));
-}
-
-/* {{{ proto int getmyuid(void)
- Get PHP script owner's UID */
-PHP_FUNCTION(getmyuid)
-{
- long uid;
-
- uid = php_getuid();
- if (uid < 0) {
- RETURN_FALSE;
- } else {
- RETURN_LONG(uid);
- }
-}
-/* }}} */
-
-/* {{{ proto int getmygid(void)
- Get PHP script owner's GID */
-PHP_FUNCTION(getmygid)
-{
- long gid;
-
- gid = php_getgid();
- if (gid < 0) {
- RETURN_FALSE;
- } else {
- RETURN_LONG(gid);
- }
-}
-/* }}} */
-
-/* {{{ proto int getmypid(void)
- Get current process ID */
-PHP_FUNCTION(getmypid)
-{
- int pid;
-
- pid = getpid();
- if (pid < 0) {
- RETURN_FALSE;
- } else {
- RETURN_LONG((long) pid);
- }
-}
-/* }}} */
-
-/* {{{ proto int getmyinode(void)
- Get the inode of the current script being parsed */
-PHP_FUNCTION(getmyinode)
-{
- php_statpage(TSRMLS_C);
- if (BG(page_inode) < 0) {
- RETURN_FALSE;
- } else {
- RETURN_LONG(BG(page_inode));
- }
-}
-/* }}} */
-
-PHPAPI long php_getlastmod(TSRMLS_D)
-{
- php_statpage(TSRMLS_C);
- return BG(page_mtime);
-}
-
-/* {{{ proto int getlastmod(void)
- Get time of last page modification */
-PHP_FUNCTION(getlastmod)
-{
- long lm = php_getlastmod(TSRMLS_C);
- if (lm < 0) {
- RETURN_FALSE;
- } else {
- RETURN_LONG(lm);
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/pageinfo.h b/ext/standard/pageinfo.h
deleted file mode 100644
index 93cc0f4e1c..0000000000
--- a/ext/standard/pageinfo.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PAGEINFO_H
-#define PAGEINFO_H
-
-PHP_FUNCTION(getmyuid);
-PHP_FUNCTION(getmygid);
-PHP_FUNCTION(getmypid);
-PHP_FUNCTION(getmyinode);
-PHP_FUNCTION(getlastmod);
-
-PHPAPI void php_statpage(TSRMLS_D);
-PHPAPI long php_getlastmod(TSRMLS_D);
-extern long php_getuid(void);
-extern long php_getgid(void);
-
-#endif
diff --git a/ext/standard/parsedate.y b/ext/standard/parsedate.y
deleted file mode 100644
index 28ba0cd401..0000000000
--- a/ext/standard/parsedate.y
+++ /dev/null
@@ -1,1019 +0,0 @@
-%{
-/*
-** Originally written by Steven M. Bellovin <smb@research.att.com> while
-** at the University of North Carolina at Chapel Hill. Later tweaked by
-** a couple of people on Usenet. Completely overhauled by Rich $alz
-** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
-**
-** This code is in the public domain and has no copyright.
-*/
-
-/* $Id$ */
-
-#include "php.h"
-
-#ifdef PHP_WIN32
-#include <malloc.h>
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <time.h>
-#include <ctype.h>
-
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#ifdef PHP_WIN32
-# include "win32/time.h"
-#endif
-
-#include "php_parsedate.h"
-
-#if HAVE_STDLIB_H
-# include <stdlib.h> /* for `free'; used by Bison 1.27 */
-#endif
-
-#if defined(_HPUX_SOURCE)
-#include <alloca.h>
-#endif
-
-#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
-# define IN_CTYPE_DOMAIN(c) 1
-#else
-# define IN_CTYPE_DOMAIN(c) isascii(c)
-#endif
-
-#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
-#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
-#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
-#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
-
-/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
- - Its arg may be any int or unsigned int; it need not be an unsigned char.
- - It's guaranteed to evaluate its argument exactly once.
- - It's typically faster.
- Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
- only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
- it's important to use the locale's definition of `digit' even when the
- host does not conform to Posix. */
-#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
-
-#if defined (STDC_HEADERS) || defined (USG)
-# include <string.h>
-#endif
-
-#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-# define __attribute__(x)
-#endif
-
-#ifndef ATTRIBUTE_UNUSED
-# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
-#endif
-
-/* Some old versions of bison generate parsers that use bcopy.
- That loses on systems that don't provide the function, so we have
- to redefine it here. */
-#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
-# define bcopy(from, to, len) memcpy ((to), (from), (len))
-#endif
-
-/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
- as well as gratuitiously global symbol names, so we can have multiple
- yacc generated parsers in the same program. Note that these are only
- the variables produced by yacc. If other parser generators (bison,
- byacc, etc) produce additional global names that conflict at link time,
- then those parser generators need to be fixed instead of adding those
- names to this list. */
-
-#define yyparse php_gd_parse
-#define yylex php_gd_lex
-
-static int yyerror ();
-
-#define EPOCH 1970
-#define HOUR(x) ((x) * 60)
-
-#define MAX_BUFF_LEN 128 /* size of buffer to read the date into */
-
-/*
-** An entry in the lexical lookup table.
-*/
-typedef struct _TABLE {
- const char *name;
- int type;
- int value;
-} TABLE;
-
-
-/*
-** Meridian: am, pm, or 24-hour style.
-*/
-typedef enum _MERIDIAN {
- MERam, MERpm, MER24
-} MERIDIAN;
-
-struct date_yy {
- const char *yyInput;
- int yyDayOrdinal;
- int yyDayNumber;
- int yyHaveDate;
- int yyHaveDay;
- int yyHaveRel;
- int yyHaveTime;
- int yyHaveZone;
- int yyTimezone;
- int yyDay;
- int yyHour;
- int yyMinutes;
- int yyMonth;
- int yySeconds;
- int yyYear;
- MERIDIAN yyMeridian;
- int yyRelDay;
- int yyRelHour;
- int yyRelMinutes;
- int yyRelMonth;
- int yyRelSeconds;
- int yyRelYear;
-};
-
-typedef union _date_ll {
- int Number;
- enum _MERIDIAN Meridian;
-} date_ll;
-
-#define YYPARSE_PARAM parm
-#define YYLEX_PARAM parm
-#define YYSTYPE date_ll
-#define YYLTYPE void
-
-%}
-
-/* This grammar has 14 shift/reduce conflicts. */
-%expect 14
-%pure_parser
-
-%token tAGO tDAY tDAY_UNIT tDAYZONE tDST tHOUR_UNIT tID
-%token tMERIDIAN tMINUTE_UNIT tMONTH tMONTH_UNIT
-%token tSEC_UNIT tSNUMBER tUNUMBER tYEAR_UNIT tZONE
-
-%type <Number> tDAY tDAY_UNIT tDAYZONE tHOUR_UNIT tMINUTE_UNIT
-%type <Number> tMONTH tMONTH_UNIT
-%type <Number> tSEC_UNIT tSNUMBER tUNUMBER tYEAR_UNIT tZONE
-%type <Meridian> tMERIDIAN o_merid
-
-%%
-
-spec : /* NULL */
- | spec item
- ;
-
-item : time {
- ((struct date_yy *)parm)->yyHaveTime++;
- }
- | zone {
- ((struct date_yy *)parm)->yyHaveZone++;
- }
- | date {
- ((struct date_yy *)parm)->yyHaveDate++;
- }
- | day {
- ((struct date_yy *)parm)->yyHaveDay++;
- }
- | rel {
- ((struct date_yy *)parm)->yyHaveRel++;
- }
- | number
- ;
-
-time : tUNUMBER tMERIDIAN {
- ((struct date_yy *)parm)->yyHour = $1;
- ((struct date_yy *)parm)->yyMinutes = 0;
- ((struct date_yy *)parm)->yySeconds = 0;
- ((struct date_yy *)parm)->yyMeridian = $2;
- }
- | tUNUMBER ':' tUNUMBER o_merid {
- ((struct date_yy *)parm)->yyHour = $1;
- ((struct date_yy *)parm)->yyMinutes = $3;
- ((struct date_yy *)parm)->yySeconds = 0;
- ((struct date_yy *)parm)->yyMeridian = $4;
- }
- | tUNUMBER ':' tUNUMBER tSNUMBER {
- ((struct date_yy *)parm)->yyHour = $1;
- ((struct date_yy *)parm)->yyMinutes = $3;
- ((struct date_yy *)parm)->yyMeridian = MER24;
- ((struct date_yy *)parm)->yyHaveZone++;
- ((struct date_yy *)parm)->yyTimezone = ($4 < 0
- ? -$4 % 100 + (-$4 / 100) * 60
- : - ($4 % 100 + ($4 / 100) * 60));
- }
- | tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {
- ((struct date_yy *)parm)->yyHour = $1;
- ((struct date_yy *)parm)->yyMinutes = $3;
- ((struct date_yy *)parm)->yySeconds = $5;
- ((struct date_yy *)parm)->yyMeridian = $6;
- }
- | tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER {
- /* ISO 8601 format. hh:mm:ss[+-][0-9]{2}([0-9]{2})?. */
- ((struct date_yy *)parm)->yyHour = $1;
- ((struct date_yy *)parm)->yyMinutes = $3;
- ((struct date_yy *)parm)->yySeconds = $5;
- ((struct date_yy *)parm)->yyMeridian = MER24;
- ((struct date_yy *)parm)->yyHaveZone++;
- if ($6 <= -100 || $6 >= 100) {
- ((struct date_yy *)parm)->yyTimezone =
- -$6 % 100 + (-$6 / 100) * 60;
- } else {
- ((struct date_yy *)parm)->yyTimezone = -$6 * 60;
- }
- }
- ;
-
-zone : tZONE {
- ((struct date_yy *)parm)->yyTimezone = $1;
- }
- | tDAYZONE {
- ((struct date_yy *)parm)->yyTimezone = $1 - 60;
- }
- |
- tZONE tDST {
- ((struct date_yy *)parm)->yyTimezone = $1 - 60;
- }
- ;
-
-day : tDAY {
- ((struct date_yy *)parm)->yyDayOrdinal = 1;
- ((struct date_yy *)parm)->yyDayNumber = $1;
- }
- | tDAY ',' {
- ((struct date_yy *)parm)->yyDayOrdinal = 1;
- ((struct date_yy *)parm)->yyDayNumber = $1;
- }
- | tUNUMBER tDAY {
- ((struct date_yy *)parm)->yyDayOrdinal = $1;
- ((struct date_yy *)parm)->yyDayNumber = $2;
- }
- ;
-
-date : tUNUMBER '/' tUNUMBER {
- ((struct date_yy *)parm)->yyMonth = $1;
- ((struct date_yy *)parm)->yyDay = $3;
- }
- | tUNUMBER '/' tUNUMBER '/' tUNUMBER {
- /* Interpret as YYYY/MM/DD if $1 >= 1000, otherwise as MM/DD/YY.
- The goal in recognizing YYYY/MM/DD is solely to support legacy
- machine-generated dates like those in an RCS log listing. If
- you want portability, use the ISO 8601 format. */
- if ($1 >= 1000)
- {
- ((struct date_yy *)parm)->yyYear = $1;
- ((struct date_yy *)parm)->yyMonth = $3;
- ((struct date_yy *)parm)->yyDay = $5;
- }
- else
- {
- ((struct date_yy *)parm)->yyMonth = $1;
- ((struct date_yy *)parm)->yyDay = $3;
- ((struct date_yy *)parm)->yyYear = $5;
- }
- }
- | tUNUMBER tSNUMBER tSNUMBER {
- /* ISO 8601 format. yyyy-mm-dd. */
- ((struct date_yy *)parm)->yyYear = $1;
- ((struct date_yy *)parm)->yyMonth = -$2;
- ((struct date_yy *)parm)->yyDay = -$3;
- }
- | tUNUMBER tMONTH tSNUMBER {
- /* e.g. 17-JUN-1992. */
- ((struct date_yy *)parm)->yyDay = $1;
- ((struct date_yy *)parm)->yyMonth = $2;
- ((struct date_yy *)parm)->yyYear = -$3;
- }
- | tMONTH tUNUMBER tUNUMBER {
- ((struct date_yy *)parm)->yyMonth = $1;
- ((struct date_yy *)parm)->yyDay = $2;
- ((struct date_yy *)parm)->yyYear = $3;
- }
- | tMONTH tUNUMBER {
- ((struct date_yy *)parm)->yyMonth = $1;
- ((struct date_yy *)parm)->yyDay = $2;
- }
- | tMONTH tUNUMBER ',' tUNUMBER {
- ((struct date_yy *)parm)->yyMonth = $1;
- ((struct date_yy *)parm)->yyDay = $2;
- ((struct date_yy *)parm)->yyYear = $4;
- }
- | tUNUMBER tMONTH {
- ((struct date_yy *)parm)->yyMonth = $2;
- ((struct date_yy *)parm)->yyDay = $1;
- }
- | tUNUMBER tMONTH tUNUMBER {
- ((struct date_yy *)parm)->yyMonth = $2;
- ((struct date_yy *)parm)->yyDay = $1;
- ((struct date_yy *)parm)->yyYear = $3;
- }
- ;
-
-rel : relunit tAGO {
- ((struct date_yy *)parm)->yyRelSeconds =
- -((struct date_yy *)parm)->yyRelSeconds;
- ((struct date_yy *)parm)->yyRelMinutes =
- -((struct date_yy *)parm)->yyRelMinutes;
- ((struct date_yy *)parm)->yyRelHour =
- -((struct date_yy *)parm)->yyRelHour;
- ((struct date_yy *)parm)->yyRelDay =
- -((struct date_yy *)parm)->yyRelDay;
- ((struct date_yy *)parm)->yyRelMonth =
- -((struct date_yy *)parm)->yyRelMonth;
- ((struct date_yy *)parm)->yyRelYear =
- -((struct date_yy *)parm)->yyRelYear;
- }
- | relunit
- ;
-
-relunit : tUNUMBER tYEAR_UNIT {
- ((struct date_yy *)parm)->yyRelYear += $1 * $2;
- }
- | tSNUMBER tYEAR_UNIT {
- ((struct date_yy *)parm)->yyRelYear += $1 * $2;
- }
- | tYEAR_UNIT {
- ((struct date_yy *)parm)->yyRelYear += $1;
- }
- | tUNUMBER tMONTH_UNIT {
- ((struct date_yy *)parm)->yyRelMonth += $1 * $2;
- }
- | tSNUMBER tMONTH_UNIT {
- ((struct date_yy *)parm)->yyRelMonth += $1 * $2;
- }
- | tMONTH_UNIT {
- ((struct date_yy *)parm)->yyRelMonth += $1;
- }
- | tUNUMBER tDAY_UNIT {
- ((struct date_yy *)parm)->yyRelDay += $1 * $2;
- }
- | tSNUMBER tDAY_UNIT {
- ((struct date_yy *)parm)->yyRelDay += $1 * $2;
- }
- | tDAY_UNIT {
- ((struct date_yy *)parm)->yyRelDay += $1;
- }
- | tUNUMBER tHOUR_UNIT {
- ((struct date_yy *)parm)->yyRelHour += $1 * $2;
- }
- | tSNUMBER tHOUR_UNIT {
- ((struct date_yy *)parm)->yyRelHour += $1 * $2;
- }
- | tHOUR_UNIT {
- ((struct date_yy *)parm)->yyRelHour += $1;
- }
- | tUNUMBER tMINUTE_UNIT {
- ((struct date_yy *)parm)->yyRelMinutes += $1 * $2;
- }
- | tSNUMBER tMINUTE_UNIT {
- ((struct date_yy *)parm)->yyRelMinutes += $1 * $2;
- }
- | tMINUTE_UNIT {
- ((struct date_yy *)parm)->yyRelMinutes += $1;
- }
- | tUNUMBER tSEC_UNIT {
- ((struct date_yy *)parm)->yyRelSeconds += $1 * $2;
- }
- | tSNUMBER tSEC_UNIT {
- ((struct date_yy *)parm)->yyRelSeconds += $1 * $2;
- }
- | tSEC_UNIT {
- ((struct date_yy *)parm)->yyRelSeconds += $1;
- }
- ;
-
-number : tUNUMBER
- {
- if (((struct date_yy *)parm)->yyHaveTime &&
- ((struct date_yy *)parm)->yyHaveDate &&
- !((struct date_yy *)parm)->yyHaveRel)
- ((struct date_yy *)parm)->yyYear = $1;
- else
- {
- if ($1>10000)
- {
- ((struct date_yy *)parm)->yyHaveDate++;
- ((struct date_yy *)parm)->yyDay= ($1)%100;
- ((struct date_yy *)parm)->yyMonth= ($1/100)%100;
- ((struct date_yy *)parm)->yyYear = $1/10000;
- }
- else
- {
- ((struct date_yy *)parm)->yyHaveTime++;
- if ($1 < 100)
- {
- ((struct date_yy *)parm)->yyHour = $1;
- ((struct date_yy *)parm)->yyMinutes = 0;
- }
- else
- {
- ((struct date_yy *)parm)->yyHour = $1 / 100;
- ((struct date_yy *)parm)->yyMinutes = $1 % 100;
- }
- ((struct date_yy *)parm)->yySeconds = 0;
- ((struct date_yy *)parm)->yyMeridian = MER24;
- }
- }
- }
- ;
-
-o_merid : /* NULL */
- {
- $$ = MER24;
- }
- | tMERIDIAN
- {
- $$ = $1;
- }
- ;
-
-%%
-
-time_t get_date (char *p, time_t *now);
-
-#ifndef PHP_WIN32
-extern struct tm *gmtime();
-extern struct tm *localtime();
-extern time_t mktime();
-#endif
-
-/* Month and day table. */
-static TABLE const MonthDayTable[] = {
- { "january", tMONTH, 1 },
- { "february", tMONTH, 2 },
- { "march", tMONTH, 3 },
- { "april", tMONTH, 4 },
- { "may", tMONTH, 5 },
- { "june", tMONTH, 6 },
- { "july", tMONTH, 7 },
- { "august", tMONTH, 8 },
- { "september", tMONTH, 9 },
- { "sept", tMONTH, 9 },
- { "october", tMONTH, 10 },
- { "november", tMONTH, 11 },
- { "december", tMONTH, 12 },
- { "sunday", tDAY, 0 },
- { "monday", tDAY, 1 },
- { "tuesday", tDAY, 2 },
- { "tues", tDAY, 2 },
- { "wednesday", tDAY, 3 },
- { "wednes", tDAY, 3 },
- { "thursday", tDAY, 4 },
- { "thur", tDAY, 4 },
- { "thurs", tDAY, 4 },
- { "friday", tDAY, 5 },
- { "saturday", tDAY, 6 },
- { NULL, 0, 0 }
-};
-
-/* Time units table. */
-static TABLE const UnitsTable[] = {
- { "year", tYEAR_UNIT, 1 },
- { "month", tMONTH_UNIT, 1 },
- { "fortnight", tDAY_UNIT, 14 },
- { "week", tDAY_UNIT, 7 },
- { "day", tDAY_UNIT, 1 },
- { "hour", tHOUR_UNIT, 1 },
- { "minute", tMINUTE_UNIT, 1 },
- { "min", tMINUTE_UNIT, 1 },
- { "second", tSEC_UNIT, 1 },
- { "sec", tSEC_UNIT, 1 },
- { NULL, 0, 0 }
-};
-
-/* Assorted relative-time words. */
-static TABLE const OtherTable[] = {
- { "tomorrow", tDAY_UNIT, 1 },
- { "yesterday", tDAY_UNIT, -1 },
- { "today", tDAY_UNIT, 0 },
- { "now", tDAY_UNIT, 0 },
- { "last", tUNUMBER, -1 },
- { "this", tMINUTE_UNIT, 0 },
- { "next", tUNUMBER, 2 },
- { "first", tUNUMBER, 1 },
-/* { "second", tUNUMBER, 2 }, */
- { "third", tUNUMBER, 3 },
- { "fourth", tUNUMBER, 4 },
- { "fifth", tUNUMBER, 5 },
- { "sixth", tUNUMBER, 6 },
- { "seventh", tUNUMBER, 7 },
- { "eighth", tUNUMBER, 8 },
- { "ninth", tUNUMBER, 9 },
- { "tenth", tUNUMBER, 10 },
- { "eleventh", tUNUMBER, 11 },
- { "twelfth", tUNUMBER, 12 },
- { "ago", tAGO, 1 },
- { NULL, 0, 0 }
-};
-
-/* The timezone table. */
-static TABLE const TimezoneTable[] = {
- { "gmt", tZONE, HOUR ( 0) }, /* Greenwich Mean */
- { "ut", tZONE, HOUR ( 0) }, /* Universal (Coordinated) */
- { "utc", tZONE, HOUR ( 0) },
- { "wet", tZONE, HOUR ( 0) }, /* Western European */
- { "bst", tDAYZONE, HOUR ( 0) }, /* British Summer */
- { "wat", tZONE, HOUR ( 1) }, /* West Africa */
- { "at", tZONE, HOUR ( 2) }, /* Azores */
-#if 0
- /* For completeness. BST is also British Summer, and GST is
- * also Guam Standard. */
- { "bst", tZONE, HOUR ( 3) }, /* Brazil Standard */
- { "gst", tZONE, HOUR ( 3) }, /* Greenland Standard */
-#endif
-#if 0
- { "nft", tZONE, HOUR (3.5) }, /* Newfoundland */
- { "nst", tZONE, HOUR (3.5) }, /* Newfoundland Standard */
- { "ndt", tDAYZONE, HOUR (3.5) }, /* Newfoundland Daylight */
-#endif
- { "ast", tZONE, HOUR ( 4) }, /* Atlantic Standard */
- { "adt", tDAYZONE, HOUR ( 4) }, /* Atlantic Daylight */
- { "est", tZONE, HOUR ( 5) }, /* Eastern Standard */
- { "edt", tDAYZONE, HOUR ( 5) }, /* Eastern Daylight */
- { "cst", tZONE, HOUR ( 6) }, /* Central Standard */
- { "cdt", tDAYZONE, HOUR ( 6) }, /* Central Daylight */
- { "mst", tZONE, HOUR ( 7) }, /* Mountain Standard */
- { "mdt", tDAYZONE, HOUR ( 7) }, /* Mountain Daylight */
- { "pst", tZONE, HOUR ( 8) }, /* Pacific Standard */
- { "pdt", tDAYZONE, HOUR ( 8) }, /* Pacific Daylight */
- { "yst", tZONE, HOUR ( 9) }, /* Yukon Standard */
- { "ydt", tDAYZONE, HOUR ( 9) }, /* Yukon Daylight */
- { "hst", tZONE, HOUR (10) }, /* Hawaii Standard */
- { "hdt", tDAYZONE, HOUR (10) }, /* Hawaii Daylight */
- { "cat", tZONE, HOUR (10) }, /* Central Alaska */
- { "akst", tZONE, HOUR (10) }, /* Alaska Standard */
- { "akdt", tZONE, HOUR (10) }, /* Alaska Daylight */
- { "ahst", tZONE, HOUR (10) }, /* Alaska-Hawaii Standard */
- { "nt", tZONE, HOUR (11) }, /* Nome */
- { "idlw", tZONE, HOUR (12) }, /* International Date Line West */
- { "cet", tZONE, -HOUR (1) }, /* Central European */
- { "met", tZONE, -HOUR (1) }, /* Middle European */
- { "mewt", tZONE, -HOUR (1) }, /* Middle European Winter */
- { "mest", tDAYZONE, -HOUR (1) }, /* Middle European Summer */
- { "mesz", tDAYZONE, -HOUR (1) }, /* Middle European Summer */
- { "swt", tZONE, -HOUR (1) }, /* Swedish Winter */
- { "sst", tDAYZONE, -HOUR (1) }, /* Swedish Summer */
- { "fwt", tZONE, -HOUR (1) }, /* French Winter */
- { "fst", tDAYZONE, -HOUR (1) }, /* French Summer */
- { "eet", tZONE, -HOUR (2) }, /* Eastern Europe, USSR Zone 1 */
- { "bt", tZONE, -HOUR (3) }, /* Baghdad, USSR Zone 2 */
-#if 0
- { "it", tZONE, -HOUR (3.5) },/* Iran */
-#endif
- { "zp4", tZONE, -HOUR (4) }, /* USSR Zone 3 */
- { "zp5", tZONE, -HOUR (5) }, /* USSR Zone 4 */
-#if 0
- { "ist", tZONE, -HOUR (5.5) },/* Indian Standard */
-#endif
- { "zp6", tZONE, -HOUR (6) }, /* USSR Zone 5 */
-#if 0
- /* For completeness. NST is also Newfoundland Standard, and SST is
- * also Swedish Summer. */
- { "nst", tZONE, -HOUR (6.5) },/* North Sumatra */
- { "sst", tZONE, -HOUR (7) }, /* South Sumatra, USSR Zone 6 */
-#endif /* 0 */
- { "wast", tZONE, -HOUR (7) }, /* West Australian Standard */
- { "wadt", tDAYZONE, -HOUR (7) }, /* West Australian Daylight */
-#if 0
- { "jt", tZONE, -HOUR (7.5) },/* Java (3pm in Cronusland!) */
-#endif
- { "cct", tZONE, -HOUR (8) }, /* China Coast, USSR Zone 7 */
- { "jst", tZONE, -HOUR (9) }, /* Japan Standard, USSR Zone 8 */
-#if 0
- { "cast", tZONE, -HOUR (9.5) },/* Central Australian Standard */
- { "cadt", tDAYZONE, -HOUR (9.5) },/* Central Australian Daylight */
-#endif
- { "east", tZONE, -HOUR (10) }, /* Eastern Australian Standard */
- { "eadt", tDAYZONE, -HOUR (10) }, /* Eastern Australian Daylight */
- { "gst", tZONE, -HOUR (10) }, /* Guam Standard, USSR Zone 9 */
- { "nzt", tZONE, -HOUR (12) }, /* New Zealand */
- { "nzst", tZONE, -HOUR (12) }, /* New Zealand Standard */
- { "nzdt", tDAYZONE, -HOUR (12) }, /* New Zealand Daylight */
- { "idle", tZONE, -HOUR (12) }, /* International Date Line East */
- { NULL, 0, 0 }
-};
-
-/* Military timezone table. */
-static TABLE const MilitaryTable[] = {
- { "a", tZONE, HOUR ( 1) },
- { "b", tZONE, HOUR ( 2) },
- { "c", tZONE, HOUR ( 3) },
- { "d", tZONE, HOUR ( 4) },
- { "e", tZONE, HOUR ( 5) },
- { "f", tZONE, HOUR ( 6) },
- { "g", tZONE, HOUR ( 7) },
- { "h", tZONE, HOUR ( 8) },
- { "i", tZONE, HOUR ( 9) },
- { "k", tZONE, HOUR ( 10) },
- { "l", tZONE, HOUR ( 11) },
- { "m", tZONE, HOUR ( 12) },
- { "n", tZONE, HOUR (- 1) },
- { "o", tZONE, HOUR (- 2) },
- { "p", tZONE, HOUR (- 3) },
- { "q", tZONE, HOUR (- 4) },
- { "r", tZONE, HOUR (- 5) },
- { "s", tZONE, HOUR (- 6) },
- { "t", tZONE, HOUR (- 7) },
- { "u", tZONE, HOUR (- 8) },
- { "v", tZONE, HOUR (- 9) },
- { "w", tZONE, HOUR (-10) },
- { "x", tZONE, HOUR (-11) },
- { "y", tZONE, HOUR (-12) },
- { "z", tZONE, HOUR ( 0) },
- { NULL, 0, 0 }
-};
-
-
-
-
-/* ARGSUSED */
-static int
-yyerror (s)
- char *s ATTRIBUTE_UNUSED;
-{
- return 0;
-}
-
-static int
-ToHour (Hours, Meridian)
- int Hours;
- MERIDIAN Meridian;
-{
- switch (Meridian)
- {
- case MER24:
- if (Hours < 0 || Hours > 23)
- return -1;
- return Hours;
- case MERam:
- if (Hours < 1 || Hours > 12)
- return -1;
- if (Hours == 12)
- Hours = 0;
- return Hours;
- case MERpm:
- if (Hours < 1 || Hours > 12)
- return -1;
- if (Hours == 12)
- Hours = 0;
- return Hours + 12;
- default:
- abort ();
- }
- /* NOTREACHED */
-}
-
-static int
-ToYear (Year)
- int Year;
-{
- if (Year < 0)
- Year = -Year;
-
- /* XPG4 suggests that years 00-68 map to 2000-2068, and
- years 69-99 map to 1969-1999. */
- if (Year < 69)
- Year += 2000;
- else if (Year < 100)
- Year += 1900;
-
- return Year;
-}
-
-static int
-LookupWord (lvalp,buff)
- YYSTYPE *lvalp;
- char *buff;
-{
- register char *p;
- register char *q;
- register const TABLE *tp;
- int i;
- int abbrev;
-
- /* Make it lowercase. */
- for (p = buff; *p; p++)
- if (ISUPPER ((unsigned char) *p))
- *p = tolower (*p);
-
- if (strcmp (buff, "am") == 0 || strcmp (buff, "a.m.") == 0)
- {
- lvalp->Meridian = MERam;
- return tMERIDIAN;
- }
- if (strcmp (buff, "pm") == 0 || strcmp (buff, "p.m.") == 0)
- {
- lvalp->Meridian = MERpm;
- return tMERIDIAN;
- }
-
- /* See if we have an abbreviation for a month. */
- if (strlen (buff) == 3)
- abbrev = 1;
- else if (strlen (buff) == 4 && buff[3] == '.')
- {
- abbrev = 1;
- buff[3] = '\0';
- }
- else
- abbrev = 0;
-
- for (tp = MonthDayTable; tp->name; tp++)
- {
- if (abbrev)
- {
- if (strncmp (buff, tp->name, 3) == 0)
- {
- lvalp->Number = tp->value;
- return tp->type;
- }
- }
- else if (strcmp (buff, tp->name) == 0)
- {
- lvalp->Number = tp->value;
- return tp->type;
- }
- }
-
- for (tp = TimezoneTable; tp->name; tp++)
- if (strcmp (buff, tp->name) == 0)
- {
- lvalp->Number = tp->value;
- return tp->type;
- }
-
- if (strcmp (buff, "dst") == 0)
- return tDST;
-
- for (tp = UnitsTable; tp->name; tp++)
- if (strcmp (buff, tp->name) == 0)
- {
- lvalp->Number = tp->value;
- return tp->type;
- }
-
- /* Strip off any plural and try the units table again. */
- i = strlen (buff) - 1;
- if (buff[i] == 's')
- {
- buff[i] = '\0';
- for (tp = UnitsTable; tp->name; tp++)
- if (strcmp (buff, tp->name) == 0)
- {
- lvalp->Number = tp->value;
- return tp->type;
- }
- buff[i] = 's'; /* Put back for "this" in OtherTable. */
- }
-
- for (tp = OtherTable; tp->name; tp++)
- if (strcmp (buff, tp->name) == 0)
- {
- lvalp->Number = tp->value;
- return tp->type;
- }
-
- /* Military timezones. */
- if (buff[1] == '\0' && ISALPHA ((unsigned char) *buff))
- {
- for (tp = MilitaryTable; tp->name; tp++)
- if (strcmp (buff, tp->name) == 0)
- {
- lvalp->Number = tp->value;
- return tp->type;
- }
- }
-
- /* Drop out any periods and try the timezone table again. */
- for (i = 0, p = q = buff; *q; q++)
- if (*q != '.')
- *p++ = *q;
- else
- i++;
- *p = '\0';
- if (i)
- for (tp = TimezoneTable; tp->name; tp++)
- if (strcmp (buff, tp->name) == 0)
- {
- lvalp->Number = tp->value;
- return tp->type;
- }
-
- return tID;
-}
-
-yylex (YYSTYPE *lvalp, void *parm)
-{
- register unsigned char c;
- register char *p;
- char buff[20];
- int Count;
- int sign;
- struct date_yy * date = (struct date_yy *)parm;
-
- for (;;)
- {
- while (ISSPACE ((unsigned char) *date->yyInput))
- date->yyInput++;
-
- if (ISDIGIT (c = *date->yyInput) || c == '-' || c == '+')
- {
- if (c == '-' || c == '+')
- {
- sign = c == '-' ? -1 : 1;
- if (!ISDIGIT (*++date->yyInput))
- /* skip the '-' sign */
- continue;
- }
- else
- sign = 0;
- for (lvalp->Number = 0; ISDIGIT (c = *date->yyInput++);)
- lvalp->Number = 10 * lvalp->Number + c - '0';
- date->yyInput--;
- if (sign < 0)
- lvalp->Number = -lvalp->Number;
- /* Ignore ordinal suffixes on numbers */
- c = *date->yyInput;
- if (c == 's' || c == 'n' || c == 'r' || c == 't') {
- c = *++date->yyInput;
- if (c == 't' || c == 'd' || c == 'h') {
- date->yyInput++;
- } else {
- date->yyInput--;
- }
- }
- return sign ? tSNUMBER : tUNUMBER;
- }
- if (ISALPHA (c))
- {
- for (p = buff; (c = *date->yyInput++, ISALPHA (c)) || c == '.';)
- if (p < &buff[sizeof buff - 1])
- *p++ = c;
- *p = '\0';
- date->yyInput--;
- return LookupWord (lvalp, buff);
- }
- if (c != '(')
- return *date->yyInput++;
- Count = 0;
- do
- {
- c = *date->yyInput++;
- if (c == '\0')
- return c;
- if (c == '(')
- Count++;
- else if (c == ')')
- Count--;
- }
- while (Count > 0);
- }
-}
-
-#define TM_YEAR_ORIGIN 1900
-
-/* Yield A - B, measured in seconds. */
-static long
-difftm (struct tm *a, struct tm *b)
-{
- int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
- int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
- long days = (
- /* difference in day of year */
- a->tm_yday - b->tm_yday
- /* + intervening leap days */
- + ((ay >> 2) - (by >> 2))
- - (ay / 100 - by / 100)
- + ((ay / 100 >> 2) - (by / 100 >> 2))
- /* + difference in years * 365 */
- + (long) (ay - by) * 365
- );
- return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
- + (a->tm_min - b->tm_min))
- + (a->tm_sec - b->tm_sec));
-}
-
-time_t php_parse_date(char *p, time_t *now)
-{
- struct tm tm, tm0, *tmp;
- time_t Start;
- struct date_yy date;
-
- date.yyInput = p;
- Start = now ? *now : time ((time_t *) NULL);
- tmp = localtime (&Start);
- if (!tmp)
- return -1;
- date.yyYear = tmp->tm_year + TM_YEAR_ORIGIN;
- date.yyMonth = tmp->tm_mon + 1;
- date.yyDay = tmp->tm_mday;
- date.yyHour = tmp->tm_hour;
- date.yyMinutes = tmp->tm_min;
- date.yySeconds = tmp->tm_sec;
- tm.tm_isdst = tmp->tm_isdst;
- date.yyMeridian = MER24;
- date.yyRelSeconds = 0;
- date.yyRelMinutes = 0;
- date.yyRelHour = 0;
- date.yyRelDay = 0;
- date.yyRelMonth = 0;
- date.yyRelYear = 0;
- date.yyHaveDate = 0;
- date.yyHaveDay = 0;
- date.yyHaveRel = 0;
- date.yyHaveTime = 0;
- date.yyHaveZone = 0;
-
- if (yyparse ((void *)&date)
- || date.yyHaveTime > 1 || date.yyHaveZone > 1
- || date.yyHaveDate > 1 || date.yyHaveDay > 1)
- return -1;
-
- tm.tm_year = ToYear (date.yyYear) - TM_YEAR_ORIGIN + date.yyRelYear;
- tm.tm_mon = date.yyMonth - 1 + date.yyRelMonth;
- tm.tm_mday = date.yyDay + date.yyRelDay;
- if (date.yyHaveTime || (date.yyHaveRel && !date.yyHaveDate && !date.yyHaveDay))
- {
- tm.tm_hour = ToHour (date.yyHour, date.yyMeridian);
- if (tm.tm_hour < 0)
- return -1;
- tm.tm_min = date.yyMinutes;
- tm.tm_sec = date.yySeconds;
- }
- else
- {
- tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
- }
- tm.tm_hour += date.yyRelHour;
- tm.tm_min += date.yyRelMinutes;
- tm.tm_sec += date.yyRelSeconds;
-
- /* Let mktime deduce tm_isdst if we have an absolute timestamp,
- or if the relative timestamp mentions days, months, or years. */
- if (date.yyHaveDate | date.yyHaveDay | date.yyHaveTime | date.yyRelDay | date.yyRelMonth | date.yyRelYear)
- tm.tm_isdst = -1;
-
- tm0 = tm;
-
- Start = mktime (&tm);
-
- if (Start == (time_t) -1)
- {
-
- /* Guard against falsely reporting errors near the time_t boundaries
- when parsing times in other time zones. For example, if the min
- time_t value is 1970-01-01 00:00:00 UTC and we are 8 hours ahead
- of UTC, then the min localtime value is 1970-01-01 08:00:00; if
- we apply mktime to 1970-01-01 00:00:00 we will get an error, so
- we apply mktime to 1970-01-02 08:00:00 instead and adjust the time
- zone by 24 hours to compensate. This algorithm assumes that
- there is no DST transition within a day of the time_t boundaries. */
- if (date.yyHaveZone)
- {
- tm = tm0;
- if (tm.tm_year <= EPOCH - TM_YEAR_ORIGIN)
- {
- tm.tm_mday++;
- date.yyTimezone -= 24 * 60;
- }
- else
- {
- tm.tm_mday--;
- date.yyTimezone += 24 * 60;
- }
- Start = mktime (&tm);
- }
-
- if (Start == (time_t) -1)
- return Start;
- }
-
- if (date.yyHaveDay && !date.yyHaveDate)
- {
- tm.tm_mday += ((date.yyDayNumber - tm.tm_wday + 7) % 7
- + 7 * (date.yyDayOrdinal - (0 < date.yyDayOrdinal)));
- Start = mktime (&tm);
- if (Start == (time_t) -1)
- return Start;
- }
-
- if (date.yyHaveZone)
- {
- long delta;
- struct tm *gmt = gmtime (&Start);
- if (!gmt)
- return -1;
- delta = date.yyTimezone * 60L + difftm (&tm, gmt);
- if ((Start + delta < Start) != (delta < 0))
- return -1; /* time_t overflow */
- Start += delta;
- }
-
- return Start;
-}
diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h
deleted file mode 100644
index 8b0c0f1965..0000000000
--- a/ext/standard/php_array.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Rasmus Lerdorf <rasmus@php.net> |
- | Andrei Zmievski <andrei@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_ARRAY_H
-#define PHP_ARRAY_H
-
-PHP_MINIT_FUNCTION(array);
-PHP_MSHUTDOWN_FUNCTION(array);
-
-PHP_FUNCTION(ksort);
-PHP_FUNCTION(krsort);
-PHP_FUNCTION(natsort);
-PHP_FUNCTION(natcasesort);
-PHP_FUNCTION(asort);
-PHP_FUNCTION(arsort);
-PHP_FUNCTION(sort);
-PHP_FUNCTION(rsort);
-PHP_FUNCTION(usort);
-PHP_FUNCTION(uasort);
-PHP_FUNCTION(uksort);
-PHP_FUNCTION(array_walk);
-PHP_FUNCTION(array_walk_recursive);
-PHP_FUNCTION(count);
-PHP_FUNCTION(end);
-PHP_FUNCTION(prev);
-PHP_FUNCTION(next);
-PHP_FUNCTION(reset);
-PHP_FUNCTION(current);
-PHP_FUNCTION(key);
-PHP_FUNCTION(min);
-PHP_FUNCTION(max);
-PHP_FUNCTION(in_array);
-PHP_FUNCTION(array_search);
-PHP_FUNCTION(extract);
-PHP_FUNCTION(compact);
-PHP_FUNCTION(array_fill);
-PHP_FUNCTION(range);
-PHP_FUNCTION(shuffle);
-PHP_FUNCTION(array_multisort);
-PHP_FUNCTION(array_push);
-PHP_FUNCTION(array_pop);
-PHP_FUNCTION(array_shift);
-PHP_FUNCTION(array_unshift);
-PHP_FUNCTION(array_splice);
-PHP_FUNCTION(array_slice);
-PHP_FUNCTION(array_merge);
-PHP_FUNCTION(array_merge_recursive);
-PHP_FUNCTION(array_keys);
-PHP_FUNCTION(array_values);
-PHP_FUNCTION(array_count_values);
-PHP_FUNCTION(array_reverse);
-PHP_FUNCTION(array_reduce);
-PHP_FUNCTION(array_pad);
-PHP_FUNCTION(array_flip);
-PHP_FUNCTION(array_change_key_case);
-PHP_FUNCTION(array_rand);
-PHP_FUNCTION(array_unique);
-PHP_FUNCTION(array_intersect);
-PHP_FUNCTION(array_intersect_assoc);
-PHP_FUNCTION(array_diff);
-PHP_FUNCTION(array_diff_assoc);
-PHP_FUNCTION(array_sum);
-PHP_FUNCTION(array_filter);
-PHP_FUNCTION(array_map);
-PHP_FUNCTION(array_key_exists);
-PHP_FUNCTION(array_chunk);
-PHP_FUNCTION(array_combine);
-
-HashTable* php_splice(HashTable *, int, int, zval ***, int, HashTable **);
-PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS_DC);
-int multisort_compare(const void *a, const void *b TSRMLS_DC);
-
-typedef struct {
- int *multisort_flags[2];
- int (*compare_func)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-} php_array_globals;
-
-#ifdef ZTS
-#define ARRAYG(v) TSRMG(array_globals_id, php_array_globals *, v)
-extern int array_globals_id;
-#else
-#define ARRAYG(v) (array_globals.v)
-extern php_array_globals array_globals;
-#endif
-
-#endif /* PHP_ARRAY_H */
diff --git a/ext/standard/php_assert.h b/ext/standard/php_assert.h
deleted file mode 100644
index 54900db991..0000000000
--- a/ext/standard/php_assert.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_ASSERT_H
-#define PHP_ASSERT_H
-
-PHP_MINIT_FUNCTION(assert);
-PHP_MSHUTDOWN_FUNCTION(assert);
-PHP_RINIT_FUNCTION(assert);
-PHP_RSHUTDOWN_FUNCTION(assert);
-PHP_MINFO_FUNCTION(assert);
-PHP_FUNCTION(assert);
-PHP_FUNCTION(assert_options);
-
-#endif /* PHP_ASSERT_H */
diff --git a/ext/standard/php_browscap.h b/ext/standard/php_browscap.h
deleted file mode 100644
index 5318fdaffb..0000000000
--- a/ext/standard/php_browscap.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_BROWSCAP_H
-#define PHP_BROWSCAP_H
-
-PHP_MINIT_FUNCTION(browscap);
-PHP_MSHUTDOWN_FUNCTION(browscap);
-
-PHP_FUNCTION(get_browser);
-
-#endif /* PHP_BROWSCAP_H */
diff --git a/ext/standard/php_crypt.h b/ext/standard/php_crypt.h
deleted file mode 100644
index e4983015ba..0000000000
--- a/ext/standard/php_crypt.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Bakken <ssb@gaurdian.no> |
- | Zeev Suraski <zeev@zend.com> |
- | Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_CRYPT_H
-#define PHP_CRYPT_H
-
-PHP_FUNCTION(crypt);
-#if HAVE_CRYPT
-PHP_MINIT_FUNCTION(crypt);
-PHP_RINIT_FUNCTION(crypt);
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/php_dir.h b/ext/standard/php_dir.h
deleted file mode 100644
index 40c29ffd55..0000000000
--- a/ext/standard/php_dir.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_DIR_H
-#define PHP_DIR_H
-
-/* directory functions */
-PHP_MINIT_FUNCTION(dir);
-PHP_RINIT_FUNCTION(dir);
-PHP_FUNCTION(opendir);
-PHP_FUNCTION(closedir);
-PHP_FUNCTION(chdir);
-#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
-PHP_FUNCTION(chroot);
-#endif
-PHP_FUNCTION(getcwd);
-PHP_FUNCTION(rewinddir);
-PHP_NAMED_FUNCTION(php_if_readdir);
-PHP_FUNCTION(getdir);
-PHP_FUNCTION(glob);
-PHP_FUNCTION(scandir);
-
-#endif /* PHP_DIR_H */
diff --git a/ext/standard/php_ext_syslog.h b/ext/standard/php_ext_syslog.h
deleted file mode 100644
index 3942bf6af7..0000000000
--- a/ext/standard/php_ext_syslog.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_EXT_SYSLOG_H
-#define PHP_EXT_SYSLOG_H
-
-#ifdef HAVE_SYSLOG_H
-
-#include "php_syslog.h"
-
-PHP_MINIT_FUNCTION(syslog);
-PHP_RINIT_FUNCTION(syslog);
-PHP_RSHUTDOWN_FUNCTION(syslog);
-
-PHP_FUNCTION(openlog);
-PHP_FUNCTION(syslog);
-PHP_FUNCTION(closelog);
-PHP_FUNCTION(define_syslog_variables);
-
-#endif
-
-#endif /* PHP_EXT_SYSLOG_H */
diff --git a/ext/standard/php_filestat.h b/ext/standard/php_filestat.h
deleted file mode 100644
index 39d08ecfc7..0000000000
--- a/ext/standard/php_filestat.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_FILESTAT_H
-#define PHP_FILESTAT_H
-
-PHP_RINIT_FUNCTION(filestat);
-PHP_RSHUTDOWN_FUNCTION(filestat);
-
-PHP_FUNCTION(clearstatcache);
-PHP_FUNCTION(fileatime);
-PHP_FUNCTION(filectime);
-PHP_FUNCTION(filegroup);
-PHP_FUNCTION(fileinode);
-PHP_FUNCTION(filemtime);
-PHP_FUNCTION(fileowner);
-PHP_FUNCTION(fileperms);
-PHP_FUNCTION(filesize);
-PHP_FUNCTION(filetype);
-PHP_FUNCTION(is_writable);
-PHP_FUNCTION(is_readable);
-PHP_FUNCTION(is_executable);
-PHP_FUNCTION(is_file);
-PHP_FUNCTION(is_dir);
-PHP_FUNCTION(is_link);
-PHP_FUNCTION(file_exists);
-PHP_NAMED_FUNCTION(php_if_stat);
-PHP_NAMED_FUNCTION(php_if_lstat);
-PHP_FUNCTION(disk_total_space);
-PHP_FUNCTION(disk_free_space);
-PHP_FUNCTION(chown);
-PHP_FUNCTION(chgrp);
-PHP_FUNCTION(chmod);
-#if HAVE_UTIME
-PHP_FUNCTION(touch);
-#endif
-PHP_FUNCTION(clearstatcache);
-
-#define MAKE_LONG_ZVAL_INCREF(name, val)\
- MAKE_STD_ZVAL(name); \
- ZVAL_LONG(name, val); \
- name->refcount++;
-
-#ifdef PHP_WIN32
-#define S_IRUSR S_IREAD
-#define S_IWUSR S_IWRITE
-#define S_IXUSR S_IEXEC
-#define S_IRGRP S_IREAD
-#define S_IWGRP S_IWRITE
-#define S_IXGRP S_IEXEC
-#define S_IROTH S_IREAD
-#define S_IWOTH S_IWRITE
-#define S_IXOTH S_IEXEC
-
-#undef getgid
-#define getgroups(a, b) 0
-#define getgid() 1
-#define getuid() 1
-#endif
-
-#endif /* PHP_FILESTAT_H */
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
deleted file mode 100644
index e163827a5e..0000000000
--- a/ext/standard/php_fopen_wrapper.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Jim Winstead <jimw@php.net> |
- | Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_standard.h"
-#include "php_fopen_wrappers.h"
-#include "SAPI.h"
-
-static size_t php_stream_output_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
-{
- PHPWRITE(buf, count);
- return count;
-}
-
-static size_t php_stream_output_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-{
- stream->eof = 1;
- return 0;
-}
-
-static int php_stream_output_close(php_stream *stream, int close_handle TSRMLS_DC)
-{
- return 0;
-}
-
-static int php_stream_output_flush(php_stream *stream TSRMLS_DC)
-{
- sapi_flush(TSRMLS_C);
- return 0;
-}
-
-php_stream_ops php_stream_output_ops = {
- php_stream_output_write,
- php_stream_output_read,
- php_stream_output_close,
- php_stream_output_flush,
- "Output",
- NULL, /* seek */
- NULL, /* cast */
- NULL, /* stat */
- NULL /* set_option */
-};
-
-static size_t php_stream_input_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
-{
- return -1;
-}
-
-static size_t php_stream_input_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-{
- size_t read_bytes = 0;
- if(!stream->eof) {
- if(SG(request_info).raw_post_data) { /* data has already been read by a post handler */
- read_bytes = SG(request_info).raw_post_data_length - stream->position;
- if(read_bytes <= count) {
- stream->eof = 1;
- } else {
- read_bytes = count;
- }
- if(read_bytes) {
- memcpy(buf, SG(request_info).raw_post_data + stream->position, read_bytes);
- }
- } else if(sapi_module.read_post) {
- read_bytes = sapi_module.read_post(buf, count TSRMLS_CC);
- if(read_bytes <= 0){
- stream->eof = 1;
- read_bytes = 0;
- }
- } else {
- stream->eof = 1;
- }
- }
-
- SG(read_post_bytes) += read_bytes;
- return read_bytes;
-}
-
-static int php_stream_input_close(php_stream *stream, int close_handle TSRMLS_DC)
-{
- return 0;
-}
-
-static int php_stream_input_flush(php_stream *stream TSRMLS_DC)
-{
- return -1;
-}
-
-php_stream_ops php_stream_input_ops = {
- php_stream_input_write,
- php_stream_input_read,
- php_stream_input_close,
- php_stream_input_flush,
- "Input",
- NULL, /* seek */
- NULL, /* cast */
- NULL, /* stat */
- NULL /* set_option */
-};
-
-static void php_stream_apply_filter_list(php_stream *stream, char *filterlist, int read_chain, int write_chain TSRMLS_DC) {
- char *p, *token;
- php_stream_filter *temp_filter;
-
- p = php_strtok_r(filterlist, "|", &token);
- while (p) {
- if (read_chain) {
- if ((temp_filter = php_stream_filter_create(p, NULL, php_stream_is_persistent(stream) TSRMLS_CC))) {
- php_stream_filter_append(&stream->readfilters, temp_filter);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create filter (%s)\n", p);
- }
- }
- if (write_chain) {
- if ((temp_filter = php_stream_filter_create(p, NULL, php_stream_is_persistent(stream) TSRMLS_CC))) {
- php_stream_filter_append(&stream->writefilters, temp_filter);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create filter (%s)\n", p);
- }
- }
- p = php_strtok_r(NULL, "|", &token);
- }
-}
-
-
-php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
-{
- int fd = -1;
- int mode_rw = 0;
- php_stream * stream = NULL;
- char *p, *token, *pathdup;
-
- if (!strncasecmp(path, "php://", 6))
- path += 6;
-
- if (!strcasecmp(path, "output")) {
- return php_stream_alloc(&php_stream_output_ops, NULL, 0, "wb");
- }
-
- if (!strcasecmp(path, "input")) {
- return php_stream_alloc(&php_stream_input_ops, NULL, 0, "rb");
- }
-
- if (!strcasecmp(path, "stdin")) {
- fd = dup(STDIN_FILENO);
- } else if (!strcasecmp(path, "stdout")) {
- fd = dup(STDOUT_FILENO);
- } else if (!strcasecmp(path, "stderr")) {
- fd = dup(STDERR_FILENO);
- } else if (!strncasecmp(path, "filter/", 7)) {
- /* Save time/memory when chain isn't specified */
- if (strchr(mode, 'r') || strchr(mode, '+')) {
- mode_rw |= PHP_STREAM_FILTER_READ;
- }
- if (strchr(mode, 'w') || strchr(mode, '+') || strchr(mode, 'a')) {
- mode_rw |= PHP_STREAM_FILTER_WRITE;
- }
- pathdup = estrndup(path + 6, strlen(path + 6));
- p = strstr(pathdup, "/resource=");
- if (!p) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "No URL resource specified.");
- efree(pathdup);
- return NULL;
- }
- if (!(stream = php_stream_open_wrapper(p + 10, mode, options, opened_path))) {
- efree(pathdup);
- return NULL;
- }
-
- *p = '\0';
-
- p = php_strtok_r(pathdup + 1, "/", &token);
- while (p) {
- if (!strncasecmp(p, "read=", 5)) {
- php_stream_apply_filter_list(stream, p + 5, 1, 0 TSRMLS_CC);
- } else if (!strncasecmp(p, "write=", 6)) {
- php_stream_apply_filter_list(stream, p + 6, 0, 1 TSRMLS_CC);
- } else {
- php_stream_apply_filter_list(stream, p, mode_rw & PHP_STREAM_FILTER_READ, mode_rw & PHP_STREAM_FILTER_WRITE TSRMLS_CC);
- }
- p = php_strtok_r(NULL, "/", &token);
- }
- efree(pathdup);
-
- return stream;
- } else {
- /* invalid php://thingy */
- return NULL;
- }
-
- /* must be stdin, stderr or stdout */
- if (fd == -1) {
- /* failed to dup */
- return NULL;
- }
-
- stream = php_stream_fopen_from_fd(fd, mode, NULL);
- if (stream == NULL) {
- close(fd);
- }
-
- return stream;
-}
-
-static php_stream_wrapper_ops php_stdio_wops = {
- php_stream_url_wrap_php,
- NULL, /* close */
- NULL, /* fstat */
- NULL, /* stat */
- NULL, /* opendir */
- "PHP",
- NULL /* unlink */
-};
-
-php_stream_wrapper php_stream_php_wrapper = {
- &php_stdio_wops,
- NULL,
- 0, /* is_url */
-};
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/php_fopen_wrappers.h b/ext/standard/php_fopen_wrappers.h
deleted file mode 100644
index d3769b4970..0000000000
--- a/ext/standard/php_fopen_wrappers.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Jim Winstead <jimw@php.net> |
- | Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_FOPEN_WRAPPERS_H
-#define PHP_FOPEN_WRAPPERS_H
-
-php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
-php_stream *php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
-extern PHPAPI php_stream_wrapper php_stream_http_wrapper;
-extern PHPAPI php_stream_wrapper php_stream_ftp_wrapper;
-extern php_stream_wrapper php_stream_php_wrapper;
-
-#endif
diff --git a/ext/standard/php_ftok.h b/ext/standard/php_ftok.h
deleted file mode 100644
index 69c0e8fa75..0000000000
--- a/ext/standard/php_ftok.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Andrew Sitnikov <sitnikov@infonet.ee> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_FTOK_H
-#define PHP_FTOK_H
-
-#if HAVE_FTOK
-PHP_FUNCTION(ftok);
-#endif
-
-#endif /* PHP_FTOK_H */
diff --git a/ext/standard/php_image.h b/ext/standard/php_image.h
deleted file mode 100644
index 0b5cb0171f..0000000000
--- a/ext/standard/php_image.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_IMAGE_H
-#define PHP_IMAGE_H
-
-PHP_FUNCTION(getimagesize);
-
-PHP_FUNCTION(image_type_to_mime_type);
-
-/* {{{ enum image_filetype
- This enum is used to have ext/standard/image.c and ext/exif/exif.c use
- the same constants for file types.
-*/
-typedef enum
-{ IMAGE_FILETYPE_UNKNOWN=0,
- IMAGE_FILETYPE_GIF=1,
- IMAGE_FILETYPE_JPEG,
- IMAGE_FILETYPE_PNG,
- IMAGE_FILETYPE_SWF,
- IMAGE_FILETYPE_PSD,
- IMAGE_FILETYPE_BMP,
- IMAGE_FILETYPE_TIFF_II, /* intel */
- IMAGE_FILETYPE_TIFF_MM, /* motorola */
- IMAGE_FILETYPE_JPC,
- IMAGE_FILETYPE_JP2,
- IMAGE_FILETYPE_JPX,
- IMAGE_FILETYPE_JB2,
- IMAGE_FILETYPE_SWC,
- IMAGE_FILETYPE_IFF,
- IMAGE_FILETYPE_WBMP,
- /* IMAGE_FILETYPE_JPEG2000 is a userland alias for IMAGE_FILETYPE_JPC */
- IMAGE_FILETYPE_XBM
-/* WHEN EXTENDING: PLEASE ALSO REGISTER IN image.c:PHP_MINIT_FUNCTION(imagetypes) */
-} image_filetype;
-/* }}} */
-
-PHP_MINIT_FUNCTION(imagetypes);
-
-PHPAPI int php_getimagetype(php_stream *stream, char *filetype TSRMLS_DC);
-
-PHPAPI const char * php_image_type_to_mime_type(int image_type);
-
-#endif /* PHP_IMAGE_H */
diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h
deleted file mode 100644
index e0f5a7875f..0000000000
--- a/ext/standard/php_incomplete_class.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_INCOMPLETE_CLASS_H
-#define PHP_INCOMPLETE_CLASS_H
-
-#include "ext/standard/basic_functions.h"
-
-#define PHP_IC_ENTRY \
- BG(incomplete_class)
-
-#define PHP_SET_CLASS_ATTRIBUTES(struc) \
- /* OBJECTS_FIXME: Fix for new object model */ \
- if (Z_OBJCE_P(struc) == BG(incomplete_class)) { \
- class_name = php_lookup_class_name(struc, &name_len, 1); \
- free_class_name = 1; \
- } else { \
- class_name = Z_OBJCE_P(struc)->name; \
- name_len = Z_OBJCE_P(struc)->name_length; \
- }
-
-#define PHP_CLEANUP_CLASS_ATTRIBUTES() \
- if (free_class_name) efree(class_name)
-
-#define PHP_CLASS_ATTRIBUTES \
- char *class_name; \
- size_t name_len; \
- zend_bool free_class_name = 0 \
-
-#define INCOMPLETE_CLASS "__PHP_Incomplete_Class"
-#define MAGIC_MEMBER "__PHP_Incomplete_Class_Name"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-zend_class_entry *php_create_incomplete_class(TSRMLS_D);
-
-char *php_lookup_class_name(zval *object, size_t *nlen, zend_bool del);
-void php_store_class_name(zval *object, const char *name, size_t len);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif
diff --git a/ext/standard/php_iptc.h b/ext/standard/php_iptc.h
deleted file mode 100644
index d4a61a8660..0000000000
--- a/ext/standard/php_iptc.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_IPTC_H
-#define PHP_IPTC_H
-
-PHP_FUNCTION(iptcparse);
-PHP_FUNCTION(iptcembed);
-
-#endif /* PHP_IPTC_H */
diff --git a/ext/standard/php_lcg.h b/ext/standard/php_lcg.h
deleted file mode 100644
index 746ec46d60..0000000000
--- a/ext/standard/php_lcg.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_LCG_H
-#define PHP_LCG_H
-
-#include "ext/standard/basic_functions.h"
-
-typedef struct {
- php_int32 s1;
- php_int32 s2;
- int seeded;
-} php_lcg_globals;
-
-PHPAPI double php_combined_lcg(TSRMLS_D);
-PHP_FUNCTION(lcg_value);
-
-PHP_MINIT_FUNCTION(lcg);
-PHP_RINIT_FUNCTION(lcg);
-
-#ifdef ZTS
-#define LCG(v) TSRMG(lcg_globals_id, php_lcg_globals *, v)
-#else
-#define LCG(v) (lcg_globals.v)
-#endif
-
-#endif
diff --git a/ext/standard/php_link.h b/ext/standard/php_link.h
deleted file mode 100644
index f6c05ddde4..0000000000
--- a/ext/standard/php_link.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_LINK_H
-#define PHP_LINK_H
-
-#ifdef HAVE_SYMLINK
-
-PHP_FUNCTION(link);
-PHP_FUNCTION(readlink);
-PHP_FUNCTION(linkinfo);
-PHP_FUNCTION(symlink);
-
-#endif
-
-#endif /* PHP_LINK_H */
diff --git a/ext/standard/php_mail.h b/ext/standard/php_mail.h
deleted file mode 100644
index b9d73047d6..0000000000
--- a/ext/standard/php_mail.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_MAIL_H
-#define PHP_MAIL_H
-
-PHP_FUNCTION(mail);
-PHP_MINFO_FUNCTION(mail);
-
-#if HAVE_SENDMAIL
-
-PHP_FUNCTION(ezmlm_hash);
-PHPAPI extern int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd TSRMLS_DC);
-
-#endif
-
-#endif /* PHP_MAIL_H */
diff --git a/ext/standard/php_math.h b/ext/standard/php_math.h
deleted file mode 100644
index 5285011cd1..0000000000
--- a/ext/standard/php_math.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jim Winstead <jimw@php.net> |
- | Stig Sæther Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_MATH_H
-#define PHP_MATH_H
-
-PHPAPI char *_php_math_number_format(double, int, char , char);
-
-PHP_FUNCTION(sin);
-PHP_FUNCTION(cos);
-PHP_FUNCTION(tan);
-PHP_FUNCTION(asin);
-PHP_FUNCTION(acos);
-PHP_FUNCTION(atan);
-PHP_FUNCTION(atan2);
-PHP_FUNCTION(pi);
-PHP_FUNCTION(exp);
-PHP_FUNCTION(log);
-PHP_FUNCTION(log10);
-PHP_FUNCTION(is_finite);
-PHP_FUNCTION(is_infinite);
-PHP_FUNCTION(is_nan);
-PHP_FUNCTION(pow);
-PHP_FUNCTION(sqrt);
-PHP_FUNCTION(srand);
-PHP_FUNCTION(rand);
-PHP_FUNCTION(getrandmax);
-PHP_FUNCTION(mt_srand);
-PHP_FUNCTION(mt_rand);
-PHP_FUNCTION(mt_getrandmax);
-PHP_FUNCTION(abs);
-PHP_FUNCTION(ceil);
-PHP_FUNCTION(floor);
-PHP_FUNCTION(round);
-PHP_FUNCTION(decbin);
-PHP_FUNCTION(dechex);
-PHP_FUNCTION(decoct);
-PHP_FUNCTION(bindec);
-PHP_FUNCTION(hexdec);
-PHP_FUNCTION(octdec);
-PHP_FUNCTION(base_convert);
-PHP_FUNCTION(number_format);
-PHP_FUNCTION(fmod);
-PHP_FUNCTION(deg2rad);
-PHP_FUNCTION(rad2deg);
-
- /*
- WARNING: these functions are expermental: they could change their names or
- disappear in the next version of PHP!
- */
-PHP_FUNCTION(hypot);
-PHP_FUNCTION(expm1);
-PHP_FUNCTION(log1p);
-
-
-PHP_FUNCTION(sinh);
-PHP_FUNCTION(cosh);
-PHP_FUNCTION(tanh);
-
-#ifdef HAVE_ASINH
-PHP_FUNCTION(asinh);
-#endif
-#ifdef HAVE_ACOSH
-PHP_FUNCTION(acosh);
-#endif
-#ifdef HAVE_ATANH
-PHP_FUNCTION(atanh);
-#endif
-
-#include <math.h>
-
-#ifndef M_E
-#define M_E 2.7182818284590452354 /* e */
-#endif
-
-#ifndef M_LOG2E
-#define M_LOG2E 1.4426950408889634074 /* log_2 e */
-#endif
-
-#ifndef M_LOG10E
-#define M_LOG10E 0.43429448190325182765 /* log_10 e */
-#endif
-
-#ifndef M_LN2
-#define M_LN2 0.69314718055994530942 /* log_e 2 */
-#endif
-
-#ifndef M_LN10
-#define M_LN10 2.30258509299404568402 /* log_e 10 */
-#endif
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846 /* pi */
-#endif
-
-#ifndef M_PI_2
-#define M_PI_2 1.57079632679489661923 /* pi/2 */
-#endif
-
-#ifndef M_PI_4
-#define M_PI_4 0.78539816339744830962 /* pi/4 */
-#endif
-
-#ifndef M_1_PI
-#define M_1_PI 0.31830988618379067154 /* 1/pi */
-#endif
-
-#ifndef M_2_PI
-#define M_2_PI 0.63661977236758134308 /* 2/pi */
-#endif
-
-#ifndef M_SQRTPI
-#define M_SQRTPI 1.77245385090551602729 /* sqrt(pi) */
-#endif
-
-#ifndef M_2_SQRTPI
-#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
-#endif
-
-#ifndef M_LNPI
-#define M_LNPI 1.14472988584940017414 /* ln(pi) */
-#endif
-
-#ifndef M_EULER
-#define M_EULER 0.57721566490153286061 /* Euler constant */
-#endif
-
-#ifndef M_SQRT2
-#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
-#endif
-
-#ifndef M_SQRT1_2
-#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
-#endif
-
-#ifndef M_SQRT3
-#define M_SQRT3 1.73205080756887729352 /* sqrt(3) */
-#endif
-
-#endif /* PHP_MATH_H */
diff --git a/ext/standard/php_metaphone.h b/ext/standard/php_metaphone.h
deleted file mode 100644
index 37fea230fc..0000000000
--- a/ext/standard/php_metaphone.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_METAPHONE_H
-#define PHP_METAPHONE_H
-
-PHP_FUNCTION(metaphone);
-
-#endif
diff --git a/ext/standard/php_parsedate.h b/ext/standard/php_parsedate.h
deleted file mode 100644
index 883267cdd7..0000000000
--- a/ext/standard/php_parsedate.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_PARSEDATE_H
-#define PHP_PARSEDATE_H
-
-#include <time.h>
-
-time_t php_parse_date(char *p, time_t *now);
-
-#endif
diff --git a/ext/standard/php_rand.h b/ext/standard/php_rand.h
deleted file mode 100644
index 2b0a631d68..0000000000
--- a/ext/standard/php_rand.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Zeev Suraski <zeev@zend.com> |
- | Pedro Melo <melo@ip.pt> |
- | Sterling Hughes <sterling@php.net> |
- | |
- | Based on code from: Shawn Cokus <Cokus@math.washington.edu> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef PHP_RAND_H
-#define PHP_RAND_H
-
-#include <stdlib.h>
-#include "basic_functions.h"
-
-/* System Rand functions */
-#ifndef RAND_MAX
-#define RAND_MAX (1<<15)
-#endif
-
-#if HAVE_LRAND48
-#define PHP_RAND_MAX 2147483647
-#else
-#define PHP_RAND_MAX RAND_MAX
-#endif
-
-#define RAND_RANGE(__n, __min, __max, __tmax) \
- (__n) = (__min) + (long) ((double) ((__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0)))
-
-/* MT Rand */
-#define PHP_MT_RAND_MAX ((long) (0x7FFFFFFF)) /* (1<<31) - 1 */
-
-PHPAPI void php_srand(long seed TSRMLS_DC);
-PHPAPI long php_rand(TSRMLS_D);
-PHPAPI void php_mt_srand(php_uint32 seed TSRMLS_DC);
-PHPAPI php_uint32 php_mt_rand(TSRMLS_D);
-
-#endif /* PHP_RAND_H */
diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h
deleted file mode 100644
index 8ee845079a..0000000000
--- a/ext/standard/php_smart_str.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_SMART_STR_H
-#define PHP_SMART_STR_H
-
-#include "php_smart_str_public.h"
-
-#include <stdlib.h>
-#ifndef SMART_STR_USE_REALLOC
-#include <zend.h>
-#endif
-
-#define smart_str_0(x) do { \
- if ((x)->c) { \
- (x)->c[(x)->len] = '\0'; \
- } \
-} while (0)
-
-#ifndef SMART_STR_PREALLOC
-#define SMART_STR_PREALLOC 128
-#endif
-
-#ifdef SMART_STR_USE_REALLOC
-#define SMART_STR_REALLOC(a,b,c) realloc((a),(b))
-#else
-#define SMART_STR_REALLOC(a,b,c) perealloc((a),(b),(c))
-#endif
-
-
-#define smart_str_alloc4(d, n, what, newlen) do { \
- if (!(d)->c) (d)->len = (d)->a = 0; \
- newlen = (d)->len + (n); \
- if (newlen >= (d)->a) { \
- (d)->a = newlen + SMART_STR_PREALLOC; \
- (d)->c = SMART_STR_REALLOC((d)->c, (d)->a + 1, (what)); \
- } \
-} while (0)
-
-#define smart_str_alloc(d, n, what) \
- smart_str_alloc4((d), (n), (what), newlen)
-
-/* wrapper */
-
-#define smart_str_appends_ex(dest, src, what) \
- smart_str_appendl_ex((dest), (src), strlen(src), (what))
-#define smart_str_appends(dest, src) \
- smart_str_appendl((dest), (src), strlen(src))
-
-#define smart_str_appendc(dest, c) \
- smart_str_appendc_ex((dest), (c), 0)
-#define smart_str_free(s) \
- smart_str_free_ex((s), 0)
-#define smart_str_appendl(dest, src, len) \
- smart_str_appendl_ex((dest), (src), (len), 0)
-#define smart_str_append(dest, src) \
- smart_str_append_ex((dest), (src), 0)
-#define smart_str_append_long(dest, val) \
- smart_str_append_long_ex((dest), (val), 0)
-#define smart_str_append_off_t(dest, val) \
- smart_str_append_off_t_ex((dest), (val), 0)
-#define smart_str_append_unsigned(dest, val) \
- smart_str_append_unsigned_ex((dest), (val), 0)
-
-#define smart_str_appendc_ex(dest, ch, what) do { \
- register size_t __nl; \
- smart_str_alloc4((dest), 1, (what), __nl); \
- (dest)->len = __nl; \
- ((unsigned char *) (dest)->c)[(dest)->len - 1] = (ch); \
-} while (0)
-
-#define smart_str_free_ex(s, what) do { \
- smart_str *__s = (smart_str *) (s); \
- if (__s->c) { \
- pefree(__s->c, what); \
- __s->c = NULL; \
- } \
- __s->a = __s->len = 0; \
-} while (0)
-
-#define smart_str_appendl_ex(dest, src, nlen, what) do { \
- register size_t __nl; \
- smart_str *__dest = (smart_str *) (dest); \
- \
- smart_str_alloc4(__dest, (nlen), (what), __nl); \
- memcpy(__dest->c + __dest->len, (src), (nlen)); \
- __dest->len = __nl; \
-} while (0)
-
-/* input: buf points to the END of the buffer */
-#define smart_str_print_unsigned4(buf, num, vartype, result) do { \
- char *__p = (buf); \
- vartype __num = (num); \
- *__p = '\0'; \
- do { \
- *--__p = (char) (__num % 10) + '0'; \
- __num /= 10; \
- } while (__num > 0); \
- result = __p; \
-} while (0)
-
-/* buf points to the END of the buffer */
-#define smart_str_print_long4(buf, num, vartype, result) do { \
- if (num < 0) { \
- /* this might cause problems when dealing with LONG_MIN \
- and machines which don't support long long. Works \
- flawlessly on 32bit x86 */ \
- smart_str_print_unsigned4((buf), -(num), vartype, (result)); \
- *--(result) = '-'; \
- } else { \
- smart_str_print_unsigned4((buf), (num), vartype, (result)); \
- } \
-} while (0)
-
-/*
- * these could be replaced using a braced-group inside an expression
- * for GCC compatible compilers, e.g.
- *
- * #define f(..) ({char *r;..;__r;})
- */
-
-static inline char *smart_str_print_long(char *buf, long num) {
- char *r;
- smart_str_print_long4(buf, num, unsigned long, r);
- return r;
-}
-
-static inline char *smart_str_print_unsigned(char *buf, long num) {
- char *r;
- smart_str_print_unsigned4(buf, num, unsigned long, r);
- return r;
-}
-
-#define smart_str_append_generic_ex(dest, num, type, vartype, func) do { \
- char __b[32]; \
- char *__t; \
- smart_str_print##func##4 (__b + sizeof(__b) - 1, (num), vartype, __t); \
- smart_str_appendl_ex((dest), __t, __b + sizeof(__b) - 1 - __t, (type)); \
-} while (0)
-
-#define smart_str_append_unsigned_ex(dest, num, type) \
- smart_str_append_generic_ex((dest), (num), (type), unsigned long, _unsigned)
-
-#define smart_str_append_long_ex(dest, num, type) \
- smart_str_append_generic_ex((dest), (num), (type), unsigned long, _long)
-
-#define smart_str_append_off_t_ex(dest, num, type) \
- smart_str_append_generic_ex((dest), (num), (type), off_t, _long)
-
-#define smart_str_append_ex(dest, src, what) \
- smart_str_appendl_ex((dest), ((smart_str *)(src))->c, \
- ((smart_str *)(src))->len, (what));
-
-
-#define smart_str_setl(dest, src, nlen) do { \
- (dest)->len = (nlen); \
- (dest)->a = (nlen) + 1; \
- (dest)->c = (char *) (src); \
-} while (0)
-
-#define smart_str_sets(dest, src) \
- smart_str_setl((dest), (src), strlen(src));
-
-#endif
diff --git a/ext/standard/php_smart_str_public.h b/ext/standard/php_smart_str_public.h
deleted file mode 100644
index 9eac1b7ad8..0000000000
--- a/ext/standard/php_smart_str_public.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_SMART_STR_PUBLIC_H
-#define PHP_SMART_STR_PUBLIC_H
-
-#include <sys/types.h>
-
-typedef struct {
- char *c;
- size_t len;
- size_t a;
-} smart_str;
-
-#endif
diff --git a/ext/standard/php_standard.h b/ext/standard/php_standard.h
deleted file mode 100644
index aaa52bd6cb..0000000000
--- a/ext/standard/php_standard.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "basic_functions.h"
-#include "php_math.h"
-#include "php_string.h"
-#include "base64.h"
-#include "php_dir.h"
-#include "dns.h"
-#include "reg.h"
-#include "php_mail.h"
-#include "md5.h"
-#include "sha1.h"
-#include "html.h"
-#include "exec.h"
-#include "file.h"
-#include "php_ext_syslog.h"
-#include "php_filestat.h"
-#include "php_browscap.h"
-#include "pack.h"
-#include "datetime.h"
-#include "microtime.h"
-#include "url.h"
-#include "pageinfo.h"
-#include "cyr_convert.h"
-#include "php_link.h"
-#include "fsock.h"
-#include "php_image.h"
-#include "php_iptc.h"
-#include "info.h"
-#include "uniqid.h"
-#include "php_var.h"
-#include "quot_print.h"
-#include "dl.h"
-#include "php_crypt.h"
-#include "head.h"
-#include "php_lcg.h"
-#include "php_metaphone.h"
-#include "php_output.h"
-#include "php_array.h"
-#include "php_assert.h"
-#include "php_versioning.h"
-#include "php_ftok.h"
-#include "php_type.h"
-#include "aggregation.h"
-#include "php_sunfuncs.h"
-
-#define phpext_standard_ptr basic_functions_module_ptr
-PHP_MINIT_FUNCTION(standard_filters);
-PHP_MSHUTDOWN_FUNCTION(standard_filters);
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h
deleted file mode 100644
index fa682e7012..0000000000
--- a/ext/standard/php_string.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Stig Sæther Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */
-
-#ifndef PHP_STRING_H
-#define PHP_STRING_H
-
-PHP_FUNCTION(strspn);
-PHP_FUNCTION(strcspn);
-PHP_FUNCTION(str_replace);
-PHP_FUNCTION(str_ireplace);
-PHP_FUNCTION(rtrim);
-PHP_FUNCTION(trim);
-PHP_FUNCTION(ltrim);
-PHP_FUNCTION(soundex);
-PHP_FUNCTION(levenshtein);
-
-PHP_FUNCTION(count_chars);
-PHP_FUNCTION(wordwrap);
-PHP_FUNCTION(explode);
-PHP_FUNCTION(implode);
-PHP_FUNCTION(strtok);
-PHP_FUNCTION(strtoupper);
-PHP_FUNCTION(strtolower);
-PHP_FUNCTION(basename);
-PHP_FUNCTION(dirname);
-PHP_FUNCTION(pathinfo);
-PHP_FUNCTION(strstr);
-PHP_FUNCTION(strpos);
-PHP_FUNCTION(stripos);
-PHP_FUNCTION(strrpos);
-PHP_FUNCTION(strripos);
-PHP_FUNCTION(strrchr);
-PHP_FUNCTION(substr);
-PHP_FUNCTION(quotemeta);
-PHP_FUNCTION(ucfirst);
-PHP_FUNCTION(ucwords);
-PHP_FUNCTION(strtr);
-PHP_FUNCTION(strrev);
-PHP_FUNCTION(hebrev);
-PHP_FUNCTION(hebrevc);
-PHP_FUNCTION(user_sprintf);
-PHP_FUNCTION(user_printf);
-PHP_FUNCTION(vprintf);
-PHP_FUNCTION(vsprintf);
-PHP_FUNCTION(addcslashes);
-PHP_FUNCTION(addslashes);
-PHP_FUNCTION(stripcslashes);
-PHP_FUNCTION(stripslashes);
-PHP_FUNCTION(chr);
-PHP_FUNCTION(ord);
-PHP_FUNCTION(nl2br);
-PHP_FUNCTION(setlocale);
-PHP_FUNCTION(localeconv);
-PHP_FUNCTION(nl_langinfo);
-PHP_FUNCTION(stristr);
-PHP_FUNCTION(chunk_split);
-PHP_FUNCTION(parse_str);
-PHP_FUNCTION(bin2hex);
-PHP_FUNCTION(similar_text);
-PHP_FUNCTION(strip_tags);
-PHP_FUNCTION(str_repeat);
-PHP_FUNCTION(substr_replace);
-PHP_FUNCTION(strnatcmp);
-PHP_FUNCTION(strnatcasecmp);
-PHP_FUNCTION(substr_count);
-PHP_FUNCTION(str_pad);
-PHP_FUNCTION(sscanf);
-PHP_FUNCTION(str_shuffle);
-PHP_FUNCTION(str_word_count);
-PHP_FUNCTION(str_split);
-PHP_FUNCTION(strpbrk);
-#ifdef HAVE_STRCOLL
-PHP_FUNCTION(strcoll);
-#endif
-#if HAVE_STRFMON
-PHP_FUNCTION(money_format);
-#endif
-
-#if defined(HAVE_LOCALECONV) && defined(ZTS)
-PHP_MINIT_FUNCTION(localeconv);
-PHP_MSHUTDOWN_FUNCTION(localeconv);
-#endif
-#if HAVE_NL_LANGINFO
-PHP_MINIT_FUNCTION(nl_langinfo);
-#endif
-
-#define strnatcmp(a, b) \
- strnatcmp_ex(a, strlen(a), b, strlen(b), 0)
-#define strnatcasecmp(a, b) \
- strnatcmp_ex(a, strlen(a), b, strlen(b), 1)
-PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int fold_case);
-
-#ifdef HAVE_LOCALECONV
-struct lconv *localeconv_r(struct lconv *out);
-#endif
-
-PHPAPI char *php_strtoupper(char *s, size_t len);
-PHPAPI char *php_strtolower(char *s, size_t len);
-PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen);
-PHPAPI char *php_addslashes(char *str, int length, int *new_length, int freeit TSRMLS_DC);
-PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int freeit, char *what, int wlength TSRMLS_DC);
-PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC);
-PHPAPI void php_stripcslashes(char *str, int *len);
-PHPAPI void php_basename(char *str, size_t len , char *suffix, size_t sufflen, char **p_ret, int *p_len);
-PHPAPI size_t php_dirname(char *str, size_t len);
-PHPAPI char *php_stristr(unsigned char *s, unsigned char *t, size_t s_len, size_t t_len);
-PHPAPI char *php_str_to_str_ex(char *haystack, int length, char *needle,
- int needle_len, char *str, int str_len, int *_new_length, int case_sensitivity, int *replace_count);
-PHPAPI char *php_str_to_str(char *haystack, int length, char *needle,
- int needle_len, char *str, int str_len, int *_new_length);
-PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval *return_value, int mode TSRMLS_DC);
-PHPAPI size_t php_strip_tags(char *rbuf, int len, int *state, char *allow, int allow_len);
-PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, pval *result);
-PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value);
-PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, int limit);
-
-PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end);
-PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end);
-
-#ifndef HAVE_STRERROR
-PHPAPI char *php_strerror(int errnum);
-#define strerror php_strerror
-#endif
-
-void register_string_constants(INIT_FUNC_ARGS);
-
-#endif /* PHP_STRING_H */
diff --git a/ext/standard/php_sunfuncs.h b/ext/standard/php_sunfuncs.h
deleted file mode 100644
index bb79c58094..0000000000
--- a/ext/standard/php_sunfuncs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Moshe Doron <mosdoron@netvision.net.il> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SUNFUNCS_H
-#define PHP_SUNFUNCS_H
-
-/* default ini entries: */
-/* Jerusalem one. */
-#define DATE_DEFAULT_LATITUDE "31.7667"
-#define DATE_DEFAULT_LONGITUDE "35.2333"
-
-/* on 90'50; common jewish sunset declaration (start of sun body appear) */
-#define DATE_SUNSET_ZENITH "90.83"
-
-/* on 90'50; common jewish sunrise declaration (sun body disappeared) */
-#define DATE_SUNRISE_ZENITH "90.83"
-
-#define SUNFUNCS_RET_TIMESTAMP 0
-#define SUNFUNCS_RET_STRING 1
-#define SUNFUNCS_RET_DOUBLE 2
-
-PHP_FUNCTION(date_sunrise);
-PHP_FUNCTION(date_sunset);
-
-#endif /* PHP_SUNFUNCS_H */
diff --git a/ext/standard/php_type.h b/ext/standard/php_type.h
deleted file mode 100644
index e6f46fb3bb..0000000000
--- a/ext/standard/php_type.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_TYPE_H
-#define PHP_TYPE_H
-
-PHP_FUNCTION(intval);
-PHP_FUNCTION(floatval);
-PHP_FUNCTION(strval);
-PHP_FUNCTION(gettype);
-PHP_FUNCTION(settype);
-PHP_FUNCTION(is_null);
-PHP_FUNCTION(is_resource);
-PHP_FUNCTION(is_bool);
-PHP_FUNCTION(is_long);
-PHP_FUNCTION(is_float);
-PHP_FUNCTION(is_numeric);
-PHP_FUNCTION(is_string);
-PHP_FUNCTION(is_array);
-PHP_FUNCTION(is_object);
-PHP_FUNCTION(is_scalar);
-PHP_FUNCTION(is_callable);
-
-#endif
diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h
deleted file mode 100644
index 5f05b7f69f..0000000000
--- a/ext/standard/php_var.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jani Lehtimäki <jkl@njet.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_VAR_H
-#define PHP_VAR_H
-
-#include "ext/standard/php_smart_str_public.h"
-
-PHP_FUNCTION(var_dump);
-PHP_FUNCTION(var_export);
-PHP_FUNCTION(debug_zval_dump);
-PHP_FUNCTION(serialize);
-PHP_FUNCTION(unserialize);
-#if MEMORY_LIMIT
-PHP_FUNCTION(memory_get_usage);
-#endif
-
-PHPAPI void php_var_dump(zval **struc, int level TSRMLS_DC);
-PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC);
-PHPAPI void php_debug_zval_dump(zval **struc, int level TSRMLS_DC);
-
-/* typdef HashTable php_serialize_data_t; */
-#define php_serialize_data_t HashTable
-
-struct php_unserialize_data {
- void *first;
-};
-
-typedef struct php_unserialize_data php_unserialize_data_t;
-
-PHPAPI void php_var_serialize(smart_str *buf, zval **struc, php_serialize_data_t *var_hash TSRMLS_DC);
-PHPAPI int php_var_unserialize(zval **rval, const char **p, const char *max, php_unserialize_data_t *var_hash TSRMLS_DC);
-
-#define PHP_VAR_SERIALIZE_INIT(var_hash) \
- zend_hash_init(&(var_hash), 10, NULL, NULL, 0)
-#define PHP_VAR_SERIALIZE_DESTROY(var_hash) \
- zend_hash_destroy(&(var_hash))
-
-#define PHP_VAR_UNSERIALIZE_INIT(var_hash) \
- (var_hash).first = 0
-#define PHP_VAR_UNSERIALIZE_DESTROY(var_hash) \
- var_destroy(&(var_hash))
-
-PHPAPI void var_replace(php_unserialize_data_t *var_hash, zval *ozval, zval **nzval);
-PHPAPI void var_destroy(php_unserialize_data_t *var_hash);
-
-#define PHP_VAR_UNSERIALIZE_ZVAL_CHANGED(var_hash, ozval, nzval) \
- var_replace((var_hash), (ozval), &(nzval))
-
-PHPAPI zend_class_entry *php_create_empty_class(char *class_name, int len);
-
-#endif /* PHP_VAR_H */
diff --git a/ext/standard/php_versioning.h b/ext/standard/php_versioning.h
deleted file mode 100644
index fa71d49f80..0000000000
--- a/ext/standard/php_versioning.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_VERSIONING_H
-#define PHP_VERSIONING_H
-
-#include "ext/standard/basic_functions.h"
-
-PHPAPI char *php_canonicalize_version(const char *);
-PHPAPI int php_version_compare(const char *, const char *);
-PHP_FUNCTION(version_compare);
-
-#endif
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
deleted file mode 100644
index 1ab6f44b0c..0000000000
--- a/ext/standard/proc_open.c
+++ /dev/null
@@ -1,813 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdio.h>
-#include "php.h"
-#include <ctype.h>
-#include "php_string.h"
-#include "safe_mode.h"
-#include "ext/standard/head.h"
-#include "ext/standard/file.h"
-#include "exec.h"
-#include "php_globals.h"
-#include "SAPI.h"
-
-#if HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#if HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-
-/* This symbol is defined in ext/standard/config.m4.
- * Essentially, it is set if you HAVE_FORK || PHP_WIN32
- * Otherplatforms may modify that configure check and add suitable #ifdefs
- * around the alternate code.
- * */
-#ifdef PHP_CAN_SUPPORT_PROC_OPEN
-
-#include "proc_open.h"
-
-static int le_proc_open;
-
-/* {{{ _php_array_to_envp */
-static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent TSRMLS_DC)
-{
- zval **element;
- php_process_env_t env;
- char *string_key, *data;
-#ifndef PHP_WIN32
- char **ep;
-#endif
- char *p;
- uint string_length, cnt, l, sizeenv=0, el_len;
- ulong num_key;
- HashTable *target_hash;
- HashPosition pos;
-
- memset(&env, 0, sizeof(env));
-
- if (!environment) {
- return env;
- }
-
- cnt = zend_hash_num_elements(Z_ARRVAL_P(environment));
-
- if (cnt < 1) {
- return env;
- }
-
- target_hash = HASH_OF(environment);
- if (!target_hash) {
- return env;
- }
-
- /* first, we have to get the size of all the elements in the hash */
- for (zend_hash_internal_pointer_reset_ex(target_hash, &pos);
- zend_hash_get_current_data_ex(target_hash, (void **) &element, &pos) == SUCCESS;
- zend_hash_move_forward_ex(target_hash, &pos)) {
-
- convert_to_string_ex(element);
- el_len = Z_STRLEN_PP(element);
- if (el_len == 0) {
- continue;
- }
-
- sizeenv += el_len+1;
-
- switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_length, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- if (string_length == 0) {
- continue;
- }
- sizeenv += string_length+1;
- break;
- }
- }
-
-#ifndef PHP_WIN32
- ep = env.envarray = (char **) pecalloc(cnt + 1, sizeof(char *), is_persistent);
-#endif
- p = env.envp = (char *) pecalloc(sizeenv + 4, 1, is_persistent);
-
- for (zend_hash_internal_pointer_reset_ex(target_hash, &pos);
- zend_hash_get_current_data_ex(target_hash, (void **) &element, &pos) == SUCCESS;
- zend_hash_move_forward_ex(target_hash, &pos)) {
-
- convert_to_string_ex(element);
- el_len = Z_STRLEN_PP(element);
-
- if (el_len == 0) {
- continue;
- }
-
- data = Z_STRVAL_PP(element);
- switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_length, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- if (string_length == 0) {
- continue;
- }
- l = string_length + el_len + 1;
- memcpy(p, string_key, string_length);
- strcat(p, "=");
- strcat(p, data);
-
-#ifndef PHP_WIN32
- *ep = p;
- ++ep;
-#endif
- p += l;
- break;
- case HASH_KEY_IS_LONG:
- memcpy(p,data,el_len);
-#ifndef PHP_WIN32
- *ep = p;
- ++ep;
-#endif
- p += el_len + 1;
- break;
- case HASH_KEY_NON_EXISTANT:
- break;
- }
- }
-
- assert(p - env.envp <= sizeenv);
-
- zend_hash_internal_pointer_reset_ex(target_hash, &pos);
-
- return env;
-}
-/* }}} */
-
-/* {{{ _php_free_envp */
-static void _php_free_envp(php_process_env_t env, int is_persistent)
-{
-#ifndef PHP_WIN32
- if (env.envarray) {
- pefree(env.envarray, is_persistent);
- }
-#endif
- if (env.envp) {
- pefree(env.envp, is_persistent);
- }
-}
-/* }}} */
-
-
-static void proc_open_rsrc_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- struct php_process_handle *proc = (struct php_process_handle*)rsrc->ptr;
- int i;
-#ifdef PHP_WIN32
- DWORD wstatus;
-#elif HAVE_SYS_WAIT_H
- int wstatus;
- pid_t wait_pid;
-#endif
-
- /* Close all handles to avoid a deadlock */
- for (i = 0; i < proc->npipes; i++) {
- if (proc->pipes[i] != 0) {
- zend_list_delete(proc->pipes[i]);
- proc->pipes[i] = 0;
- }
- }
-
-#ifdef PHP_WIN32
-
- WaitForSingleObject(proc->child, INFINITE);
- GetExitCodeProcess(proc->child, &wstatus);
- FG(pclose_ret) = wstatus;
-
-#elif HAVE_SYS_WAIT_H
-
- do {
- wait_pid = waitpid(proc->child, &wstatus, 0);
- } while (wait_pid == -1 && errno == EINTR);
-
- if (wait_pid == -1)
- FG(pclose_ret) = -1;
- else {
- if (WIFEXITED(wstatus))
- wstatus = WEXITSTATUS(wstatus);
- FG(pclose_ret) = wstatus;
- }
-
-#else
- FG(pclose_ret) = -1;
-#endif
- _php_free_envp(proc->env, proc->is_persistent);
- pefree(proc->command, proc->is_persistent);
- pefree(proc, proc->is_persistent);
-
-}
-
-/* {{{ php_make_safe_mode_command */
-static int php_make_safe_mode_command(char *cmd, char **safecmd, int is_persistent TSRMLS_DC)
-{
- int lcmd, larg0, ldir, len, overflow_limit;
- char *space, *sep, *arg0;
-
- if (!PG(safe_mode)) {
- *safecmd = pestrdup(cmd, is_persistent);
- return SUCCESS;
- }
-
- lcmd = strlen(cmd);
- ldir = strlen(PG(safe_mode_exec_dir));
- len = lcmd + ldir + 2;
- overflow_limit = len;
-
- arg0 = emalloc(len);
-
- strcpy(arg0, cmd);
-
- space = strchr(arg0, ' ');
- if (space) {
- *space = '\0';
- }
- larg0 = strlen(arg0);
-
- if (strstr(arg0, "..")) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No '..' components allowed in path");
- efree(arg0);
- return FAILURE;
- }
-
- *safecmd = emalloc(len);
- strcpy(*safecmd, PG(safe_mode_exec_dir));
- overflow_limit -= ldir;
-
- sep = strrchr(arg0, PHP_DIR_SEPARATOR);
- if (sep) {
- strcat(*safecmd, sep);
- overflow_limit -= strlen(sep);
- } else {
- strcat(*safecmd, "/");
- strcat(*safecmd, arg0);
- overflow_limit -= larg0 + 1;
- }
- if (space) {
- strncat(*safecmd, cmd + larg0, overflow_limit);
- }
- efree(arg0);
- arg0 = php_escape_shell_cmd(*safecmd);
- efree(*safecmd);
- if (is_persistent) {
- *safecmd = pestrdup(arg0, 1);
- efree(arg0);
- } else {
- *safecmd = arg0;
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-PHP_MINIT_FUNCTION(proc_open)
-{
- le_proc_open = zend_register_list_destructors_ex(proc_open_rsrc_dtor, NULL, "process", module_number);
- return SUCCESS;
-}
-
-
-/* {{{ proto int proc_terminate(resource process [, long signal])
- kill a process opened by proc_open */
-PHP_FUNCTION(proc_terminate)
-{
- zval *zproc;
- struct php_process_handle *proc;
- long sig_no = SIGTERM;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zproc, &sig_no) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(proc, struct php_process_handle *, &zproc, -1, "process", le_proc_open);
-
-#ifdef PHP_WIN32
- TerminateProcess(proc->child, 255);
-#else
- kill(proc->child, sig_no);
-#endif
-
- zend_list_delete(Z_LVAL_P(zproc));
- RETURN_LONG(FG(pclose_ret));
-}
-/* }}} */
-
-
-/* {{{ proto int proc_close(resource process)
- close a process opened by proc_open */
-PHP_FUNCTION(proc_close)
-{
- zval *zproc;
- struct php_process_handle *proc;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zproc) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(proc, struct php_process_handle *, &zproc, -1, "process", le_proc_open);
-
- zend_list_delete(Z_LVAL_P(zproc));
- RETURN_LONG(FG(pclose_ret));
-}
-/* }}} */
-
-/* {{{ proto array proc_get_status(resource process)
- get information about a process opened by proc_open */
-PHP_FUNCTION(proc_get_status)
-{
- zval *zproc;
- struct php_process_handle *proc;
-#ifdef PHP_WIN32
- DWORD wstatus;
-#elif HAVE_SYS_WAIT_H
- int wstatus;
- pid_t wait_pid;
-#endif
- int running = 1, signaled = 0, stopped = 0;
- int exitcode = -1, termsig = 0, stopsig = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zproc) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(proc, struct php_process_handle *, &zproc, -1, "process", le_proc_open);
-
- array_init(return_value);
-
- add_assoc_string(return_value, "command", proc->command, 1);
- add_assoc_long(return_value, "pid", (long) proc->child);
-
-#ifdef PHP_WIN32
-
- GetExitCodeProcess(proc->child, &wstatus);
-
- running = wstatus == STILL_ACTIVE;
- exitcode == STILL_ACTIVE ? -1 : wstatus;
-
-#elif HAVE_SYS_WAIT_H
-
- errno = 0;
- wait_pid = waitpid(proc->child, &wstatus, WNOHANG|WUNTRACED);
-
- if (wait_pid == proc->child) {
- if (WIFEXITED(wstatus)) {
- running = 0;
- exitcode = WEXITSTATUS(wstatus);
- }
- if (WIFSIGNALED(wstatus)) {
- signaled = 1;
- termsig = WTERMSIG(wstatus);
- }
- if (WIFSTOPPED(wstatus)) {
- stopped = 1;
- stopsig = WSTOPSIG(wstatus);
- }
- }
-#endif
-
- add_assoc_bool(return_value, "running", running);
- add_assoc_bool(return_value, "signaled", signaled);
- add_assoc_bool(return_value, "stopped", stopped);
- add_assoc_long(return_value, "exitcode", exitcode);
- add_assoc_long(return_value, "termsig", termsig);
- add_assoc_long(return_value, "stopsig", stopsig);
-}
-/* }}} */
-
-/* {{{ handy definitions for portability/readability */
-#ifdef PHP_WIN32
-# define pipe(pair) (CreatePipe(&pair[0], &pair[1], &security, 2048L) ? 0 : -1)
-
-# define COMSPEC_NT "cmd.exe"
-# define COMSPEC_9X "command.com"
-
-static inline HANDLE dup_handle(HANDLE src, BOOL inherit, BOOL closeorig)
-{
- HANDLE copy, self = GetCurrentProcess();
-
- if (!DuplicateHandle(self, src, self, &copy, 0, inherit, DUPLICATE_SAME_ACCESS |
- (closeorig ? DUPLICATE_CLOSE_SOURCE : 0)))
- return NULL;
- return copy;
-}
-
-static inline HANDLE dup_fd_as_handle(int fd)
-{
- return dup_handle((HANDLE)_get_osfhandle(fd), TRUE, FALSE);
-}
-
-# define close_descriptor(fd) CloseHandle(fd)
-#else
-# define close_descriptor(fd) close(fd)
-#endif
-
-#define DESC_PIPE 1
-#define DESC_FILE 2
-#define DESC_PARENT_MODE_WRITE 8
-
-struct php_proc_open_descriptor_item {
- int index; /* desired fd number in child process */
- php_file_descriptor_t parentend, childend; /* fds for pipes in parent/child */
- int mode; /* mode for proc_open code */
- int mode_flags; /* mode flags for opening fds */
-};
-/* }}} */
-
-/* {{{ proto resource proc_open(string command, array descriptorspec, array &pipes [, string cwd [, array env]])
- Run a process with more control over it's file descriptors */
-PHP_FUNCTION(proc_open)
-{
-
- char *command, *cwd=NULL;
- long command_len, cwd_len;
- zval *descriptorspec;
- zval *pipes;
- zval *environment = NULL;
- php_process_env_t env;
- int ndesc = 0;
- int i;
- zval **descitem = NULL;
- HashPosition pos;
- struct php_proc_open_descriptor_item descriptors[PHP_PROC_OPEN_MAX_DESCRIPTORS];
-#ifdef PHP_WIN32
- PROCESS_INFORMATION pi;
- STARTUPINFO si;
- BOOL newprocok;
- SECURITY_ATTRIBUTES security;
- char *command_with_cmd;
-#endif
- php_process_id_t child;
- struct php_process_handle *proc;
- int is_persistent = 0; /* TODO: ensure that persistent procs will work */
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "saz/|s!a!", &command,
- &command_len, &descriptorspec, &pipes, &cwd, &cwd_len, &environment) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (FAILURE == php_make_safe_mode_command(command, &command, is_persistent TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- command_len = strlen(command);
-
- if (environment) {
- env = _php_array_to_envp(environment, is_persistent TSRMLS_CC);
- } else {
- memset(&env, 0, sizeof(env));
- }
-
- memset(descriptors, 0, sizeof(descriptors));
-
-#ifdef PHP_WIN32
- /* we use this to allow the child to inherit handles */
- memset(&security, 0, sizeof(security));
- security.nLength = sizeof(security);
- security.bInheritHandle = TRUE;
- security.lpSecurityDescriptor = NULL;
-#endif
-
- /* walk the descriptor spec and set up files/pipes */
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(descriptorspec), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_P(descriptorspec), (void **)&descitem, &pos) == SUCCESS) {
- char *str_index;
- ulong nindex;
- zval **ztype;
-
- str_index = NULL;
- zend_hash_get_current_key_ex(Z_ARRVAL_P(descriptorspec), &str_index, NULL, &nindex, 0, &pos);
-
- if (str_index) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "descriptor spec must be an integer indexed array");
- goto exit_fail;
- }
-
- descriptors[ndesc].index = nindex;
-
- if (Z_TYPE_PP(descitem) == IS_RESOURCE) {
- /* should be a stream - try and dup the descriptor */
- php_stream *stream;
- int fd;
-
- php_stream_from_zval(stream, descitem);
-
- if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **)&fd, REPORT_ERRORS)) {
- goto exit_fail;
- }
-
-#ifdef PHP_WIN32
- descriptors[ndesc].childend = dup_fd_as_handle(fd);
- if (descriptors[ndesc].childend == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to dup File-Handle for descriptor %d", nindex);
- goto exit_fail;
- }
-#else
- descriptors[ndesc].childend = dup(fd);
- if (descriptors[ndesc].childend < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to dup File-Handle for descriptor %d - %s", nindex, strerror(errno));
- goto exit_fail;
- }
-#endif
- descriptors[ndesc].mode = DESC_FILE;
-
- } else if (Z_TYPE_PP(descitem) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Descriptor item must be either an array or a File-Handle");
- goto exit_fail;
- } else {
-
- if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 0, (void **)&ztype) == SUCCESS) {
- convert_to_string_ex(ztype);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing handle qualifier in array");
- goto exit_fail;
- }
-
- if (strcmp(Z_STRVAL_PP(ztype), "pipe") == 0) {
- php_file_descriptor_t newpipe[2];
- zval **zmode;
-
- if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 1, (void **)&zmode) == SUCCESS) {
- convert_to_string_ex(zmode);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing mode parameter for 'pipe'", Z_STRVAL_PP(ztype));
- goto exit_fail;
- }
-
- descriptors[ndesc].mode = DESC_PIPE;
-
- if (0 != pipe(newpipe)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to create pipe %s", strerror(errno));
- goto exit_fail;
- }
-
- if (strcmp(Z_STRVAL_PP(zmode), "w") != 0) {
- descriptors[ndesc].parentend = newpipe[1];
- descriptors[ndesc].childend = newpipe[0];
- descriptors[ndesc].mode |= DESC_PARENT_MODE_WRITE;
- } else {
- descriptors[ndesc].parentend = newpipe[0];
- descriptors[ndesc].childend = newpipe[1];
- }
-#ifdef PHP_WIN32
- /* don't let the child inherit the parent side of the pipe */
- descriptors[ndesc].parentend = dup_handle(descriptors[ndesc].parentend, FALSE, TRUE);
-#endif
- descriptors[ndesc].mode_flags = descriptors[ndesc].mode & DESC_PARENT_MODE_WRITE ? O_WRONLY : O_RDONLY;
-#ifdef PHP_WIN32
- if (Z_STRLEN_PP(zmode) >= 2 && Z_STRVAL_PP(zmode)[1] == 'b')
- descriptors[ndesc].mode_flags |= O_BINARY;
-#endif
-
-
-
- } else if (strcmp(Z_STRVAL_PP(ztype), "file") == 0) {
- zval **zfile, **zmode;
- int fd;
- php_stream *stream;
-
- descriptors[ndesc].mode = DESC_FILE;
-
- if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 1, (void **)&zfile) == SUCCESS) {
- convert_to_string_ex(zfile);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing file name parameter for 'file'", Z_STRVAL_PP(ztype));
- goto exit_fail;
- }
-
- if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 2, (void **)&zmode) == SUCCESS) {
- convert_to_string_ex(zmode);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing mode parameter for 'file'", Z_STRVAL_PP(ztype));
- goto exit_fail;
- }
-
- /* try a wrapper */
- stream = php_stream_open_wrapper(Z_STRVAL_PP(zfile), Z_STRVAL_PP(zmode),
- ENFORCE_SAFE_MODE|REPORT_ERRORS|STREAM_WILL_CAST, NULL);
-
- /* force into an fd */
- if (stream == NULL || FAILURE == php_stream_cast(stream,
- PHP_STREAM_CAST_RELEASE|PHP_STREAM_AS_FD,
- (void **)&fd, REPORT_ERRORS)) {
- goto exit_fail;
- }
-
-#ifdef PHP_WIN32
- descriptors[ndesc].childend = (HANDLE)_get_osfhandle(fd);
-#else
- descriptors[ndesc].childend = fd;
-#endif
-
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a valid descriptor spec/mode", Z_STRVAL_PP(ztype));
- goto exit_fail;
- }
- }
-
- zend_hash_move_forward_ex(Z_ARRVAL_P(descriptorspec), &pos);
- if (++ndesc == PHP_PROC_OPEN_MAX_DESCRIPTORS)
- break;
- }
-
-#ifdef PHP_WIN32
- memset(&si, 0, sizeof(si));
- si.cb = sizeof(si);
- si.dwFlags = STARTF_USESTDHANDLES;
-
- si.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
- si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
- si.hStdError = GetStdHandle(STD_ERROR_HANDLE);
-
- /* redirect stdin/stdout/stderr if requested */
- for (i = 0; i < ndesc; i++) {
- switch(descriptors[i].index) {
- case 0:
- si.hStdInput = descriptors[i].childend;
- break;
- case 1:
- si.hStdOutput = descriptors[i].childend;
- break;
- case 2:
- si.hStdError = descriptors[i].childend;
- break;
- }
- }
-
-
- memset(&pi, 0, sizeof(pi));
-
- command_with_cmd = emalloc(command_len + sizeof(COMSPEC_9X) + 1 + sizeof(" /c "));
- sprintf(command_with_cmd, "%s /c %s", GetVersion() < 0x80000000 ? COMSPEC_NT : COMSPEC_9X, command);
- newprocok = CreateProcess(NULL, command_with_cmd, &security, &security, TRUE, NORMAL_PRIORITY_CLASS, env.envp, cwd, &si, &pi);
- efree(command_with_cmd);
-
- if (FALSE == newprocok) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "CreateProcess failed");
- goto exit_fail;
- }
-
- child = pi.hProcess;
- CloseHandle(pi.hThread);
-
-#elif HAVE_FORK
- /* the unix way */
- child = fork();
-
- if (child == 0) {
- /* this is the child process */
-
- /* close those descriptors that we just opened for the parent stuff,
- * dup new descriptors into required descriptors and close the original
- * cruft */
- for (i = 0; i < ndesc; i++) {
- switch (descriptors[i].mode & ~DESC_PARENT_MODE_WRITE) {
- case DESC_PIPE:
- close(descriptors[i].parentend);
- break;
- }
- if (dup2(descriptors[i].childend, descriptors[i].index) < 0)
- perror("dup2");
- if (descriptors[i].childend != descriptors[i].index)
- close(descriptors[i].childend);
- }
- if (cwd) {
- chdir(cwd);
- }
-
- if (env.envarray) {
- execle("/bin/sh", "sh", "-c", command, NULL, env.envarray);
- } else {
- execl("/bin/sh", "sh", "-c", command, NULL);
- }
- _exit(127);
-
- } else if (child < 0) {
- /* failed to fork() */
-
- /* clean up all the descriptors */
- for (i = 0; i < ndesc; i++) {
- close(descriptors[i].childend);
- close(descriptors[i].parentend);
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "fork failed - %s", strerror(errno));
-
- goto exit_fail;
-
- }
-#else
-# error You lose (configure should not have let you get here)
-#endif
- /* we forked/spawned and this is the parent */
-
- proc = (struct php_process_handle*)pemalloc(sizeof(struct php_process_handle), is_persistent);
- proc->is_persistent = is_persistent;
- proc->command = command;
- proc->npipes = ndesc;
- proc->child = child;
- proc->env = env;
-
- array_init(pipes);
-
- /* clean up all the child ends and then open streams on the parent
- * ends, where appropriate */
- for (i = 0; i < ndesc; i++) {
- FILE *fp;
- char *mode_string=NULL;
- php_stream *stream;
-
- close_descriptor(descriptors[i].childend);
-
- switch (descriptors[i].mode & ~DESC_PARENT_MODE_WRITE) {
- case DESC_PIPE:
- switch(descriptors[i].mode_flags) {
-#ifdef PHP_WIN32
- case O_WRONLY|O_BINARY:
- mode_string = "wb";
- break;
- case O_RDONLY|O_BINARY:
- mode_string = "rb";
- break;
-#endif
- case O_WRONLY:
- mode_string = "w";
- break;
- case O_RDONLY:
- mode_string = "r";
- break;
- }
-#ifdef PHP_WIN32
- fp = _fdopen(_open_osfhandle((long)descriptors[i].parentend,
- descriptors[i].mode_flags), mode_string);
-#else
- fp = fdopen(descriptors[i].parentend, mode_string);
-#endif
- if (fp) {
- stream = php_stream_fopen_from_file(fp, mode_string);
- if (stream) {
- zval *retfp;
-
- MAKE_STD_ZVAL(retfp);
- php_stream_to_zval(stream, retfp);
- add_index_zval(pipes, descriptors[i].index, retfp);
-
- proc->pipes[i] = Z_LVAL_P(retfp);
- }
- }
- break;
- default:
- proc->pipes[i] = 0;
- }
- }
-
- ZEND_REGISTER_RESOURCE(return_value, proc, le_proc_open);
- return;
-
-exit_fail:
- _php_free_envp(env, is_persistent);
- pefree(command, is_persistent);
- RETURN_FALSE;
-
-}
-/* }}} */
-
-#endif /* PHP_CAN_SUPPORT_PROC_OPEN */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/proc_open.h b/ext/standard/proc_open.h
deleted file mode 100644
index 26375054a5..0000000000
--- a/ext/standard/proc_open.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifdef PHP_WIN32
-typedef HANDLE php_file_descriptor_t;
-typedef HANDLE php_process_id_t;
-#else
-typedef int php_file_descriptor_t;
-typedef pid_t php_process_id_t;
-#endif
-
-#define PHP_PROC_OPEN_MAX_DESCRIPTORS 16
-
-/* Environment block under win32 is a NUL terminated sequence of NUL terminated
- * name=value strings.
- * Under unix, it is an argv style array.
- * */
-typedef struct _php_process_env {
- char *envp;
-#ifndef PHP_WIN32
- char **envarray;
-#endif
-} php_process_env_t;
-
-struct php_process_handle {
- php_process_id_t child;
- int npipes;
- long pipes[PHP_PROC_OPEN_MAX_DESCRIPTORS];
- char *command;
- int is_persistent;
- php_process_env_t env;
-};
-
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
deleted file mode 100644
index 1e3137e397..0000000000
--- a/ext/standard/quot_print.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Kirill Maximov <kir@actimind.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdlib.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include <errno.h>
-
-#include "php.h"
-#include "quot_print.h"
-
-#include <stdio.h>
-
-/*
-* Converting HEX char to INT value
-*/
-static char php_hex2int(int c)
-{
- if (isdigit(c)) {
- return c - '0';
- }
- else if (c >= 'A' && c <= 'F') {
- return c - 'A' + 10;
- }
- else if (c >= 'a' && c <= 'f') {
- return c - 'a' + 10;
- }
- else {
- return -1;
- }
-}
-
-PHPAPI unsigned char *php_quot_print_decode(const unsigned char *str, size_t length, size_t *ret_length)
-{
- register unsigned int i;
- register unsigned const char *p1;
- register unsigned char *p2;
- register unsigned int h_nbl, l_nbl;
-
- size_t decoded_len, buf_size;
- unsigned char *retval;
-
- static unsigned int hexval_tbl[256] = {
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 32, 16, 64, 64, 16, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 32, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 64, 64, 64, 64, 64, 64,
- 64, 10, 11, 12, 13, 14, 15, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
- };
-
- i = length, p1 = str; buf_size = length;
-
- while (i > 1 && *p1 != '\0') {
- if (*p1 == '=') {
- buf_size -= 2;
- p1++;
- i--;
- }
- p1++;
- i--;
- }
-
- retval = emalloc(buf_size + 1);
- i = length; p1 = str; p2 = retval;
- decoded_len = 0;
-
- while (i > 0 && *p1 != '\0') {
- if (*p1 == '=') {
- i--, p1++;
- if (i == 0 || *p1 == '\0') {
- break;
- }
- h_nbl = hexval_tbl[*p1];
- if (h_nbl < 16) {
- /* next char should be a hexadecimal digit */
- if ((--i) == 0 || (l_nbl = hexval_tbl[*(++p1)]) >= 16) {
- efree(retval);
- return NULL;
- }
- *(p2++) = (h_nbl << 4) | l_nbl, decoded_len++;
- i--, p1++;
- } else if (h_nbl < 64) {
- /* soft line break */
- while (h_nbl == 32) {
- if (--i == 0 || (h_nbl = hexval_tbl[*(++p1)]) == 64) {
- efree(retval);
- return NULL;
- }
- }
- if (p1[0] == '\r' && i >= 2 && p1[1] == '\n') {
- i--, p1++;
- }
- i--, p1++;
- } else {
- efree(retval);
- return NULL;
- }
- } else {
- *(p2++) = *p1;
- i--, p1++, decoded_len++;
- }
- }
-
- *p2 = '\0';
- *ret_length = decoded_len;
- return retval;
-}
-
-
-/*
-*
-* Decoding Quoted-printable string.
-*
-*/
-/* {{{ proto string quoted_printable_decode(string str)
- Convert a quoted-printable string to an 8 bit string */
-PHP_FUNCTION(quoted_printable_decode)
-{
- pval **arg1;
- char *str_in, *str_out;
- int i = 0, j = 0, k;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
-
- if (Z_STRLEN_PP(arg1) == 0) {
- /* shortcut */
- RETURN_EMPTY_STRING();
- }
-
- str_in = Z_STRVAL_PP(arg1);
- str_out = emalloc(Z_STRLEN_PP(arg1) + 1);
- while (str_in[i]) {
- switch (str_in[i]) {
- case '=':
- if (str_in[i + 1] && str_in[i + 2] &&
- isxdigit((int) str_in[i + 1]) &&
- isxdigit((int) str_in[i + 2]))
- {
- str_out[j++] = (php_hex2int((int) str_in[i + 1]) << 4)
- + php_hex2int((int) str_in[i + 2]);
- i += 3;
- } else /* check for soft line break according to RFC 2045*/ {
- k = 1;
- while (str_in[i + k] && ((str_in[i + k] == 32) || (str_in[i + k] == 9))) {
- /* Possibly, skip spaces/tabs at the end of line */
- k++;
- }
- if (!str_in[i + k]) {
- /* End of line reached */
- i += k;
- }
- else if ((str_in[i + k] == 13) && (str_in[i + k + 1] == 10)) {
- /* CRLF */
- i += k + 2;
- }
- else if ((str_in[i + k] == 13) || (str_in[i + k] == 10)) {
- /* CR or LF */
- i += k + 1;
- }
- else {
- str_out[j++] = str_in[i++];
- }
- }
- break;
- default:
- str_out[j++] = str_in[i++];
- }
- }
- str_out[j] = '\0';
-
- RETVAL_STRINGL(str_out, j, 0);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/quot_print.h b/ext/standard/quot_print.h
deleted file mode 100644
index 9ca350c6a2..0000000000
--- a/ext/standard/quot_print.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Kirill Maximov (kir@rus.net) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef QUOT_PRINT_H
-#define QUOT_PRINT_H
-
-PHPAPI unsigned char *php_quot_print_decode(const unsigned char *str, size_t length, size_t *ret_length);
-
-PHP_FUNCTION(quoted_printable_decode);
-
-#endif /* QUOT_PRINT_H */
diff --git a/ext/standard/rand.c b/ext/standard/rand.c
deleted file mode 100644
index 04f98b34f9..0000000000
--- a/ext/standard/rand.c
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Zeev Suraski <zeev@zend.com> |
- | Pedro Melo <melo@ip.pt> |
- | Sterling Hughes <sterling@php.net> |
- | |
- | Based on code from: Shawn Cokus <Cokus@math.washington.edu> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdlib.h>
-
-#if defined(NETWARE) && !defined(NEW_LIBC) /* For getpid() used below */
-#include "netware/pwd.h"
-#endif
-
-#include "php.h"
-#include "php_math.h"
-#include "php_rand.h"
-#include "php_lcg.h"
-
-#include "basic_functions.h"
-
-
-/* SYSTEM RAND FUNCTIONS */
-
-/* {{{ php_srand
- */
-PHPAPI void php_srand(long seed TSRMLS_DC)
-{
-#ifdef ZTS
- BG(rand_seed) = (unsigned int) seed;
-#else
-# if defined(HAVE_SRANDOM)
- srandom((unsigned int) seed);
-# elif defined(HAVE_SRAND48)
- srand48(seed);
-# else
- srand((unsigned int) seed);
-# endif
-#endif
-}
-/* }}} */
-
-/* {{{ php_rand
- */
-PHPAPI long php_rand(TSRMLS_D)
-{
- long ret;
-
-#ifdef ZTS
- ret = php_rand_r(&BG(rand_seed));
-#else
-# if defined(HAVE_RANDOM)
- ret = random();
-# elif defined(HAVE_LRAND48)
- ret = lrand48();
-# else
- ret = rand();
-# endif
-#endif
-
- return ret;
-}
-/* }}} */
-
-
-/* MT RAND FUNCTIONS */
-
-/*
- This is the ``Mersenne Twister'' random number generator MT19937, which
- generates pseudorandom integers uniformly distributed in 0..(2^32 - 1)
- starting from any odd seed in 0..(2^32 - 1). This version is a recode
- by Shawn Cokus (Cokus@math.washington.edu) on March 8, 1998 of a version by
- Takuji Nishimura (who had suggestions from Topher Cooper and Marc Rieffel in
- July-August 1997).
-
- Effectiveness of the recoding (on Goedel2.math.washington.edu, a DEC Alpha
- running OSF/1) using GCC -O3 as a compiler: before recoding: 51.6 sec. to
- generate 300 million random numbers; after recoding: 24.0 sec. for the same
- (i.e., 46.5% of original time), so speed is now about 12.5 million random
- number generations per second on this machine.
-
- According to the URL <http://www.math.keio.ac.jp/~matumoto/emt.html>
- (and paraphrasing a bit in places), the Mersenne Twister is ``designed
- with consideration of the flaws of various existing generators,'' has
- a period of 2^19937 - 1, gives a sequence that is 623-dimensionally
- equidistributed, and ``has passed many stringent tests, including the
- die-hard test of G. Marsaglia and the load test of P. Hellekalek and
- S. Wegenkittl.'' It is efficient in memory usage (typically using 2506
- to 5012 bytes of static data, depending on data type sizes, and the code
- is quite short as well). It generates random numbers in batches of 624
- at a time, so the caching and pipelining of modern systems is exploited.
- It is also divide- and mod-free.
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published by
- the Free Software Foundation (either version 2 of the License or, at your
- option, any later version). This library is distributed in the hope that
- it will be useful, but WITHOUT ANY WARRANTY, without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- the GNU Library General Public License for more details. You should have
- received a copy of the GNU Library General Public License along with this
- library; if not, write to the Free Software Foundation, Inc., 59 Temple
- Place, Suite 330, Boston, MA 02111-1307, USA.
-
- The code as Shawn received it included the following notice:
-
- Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura. When
- you use this, send an e-mail to <matumoto@math.keio.ac.jp> with
- an appropriate reference to your work.
-
- It would be nice to CC: <Cokus@math.washington.edu> when you write.
-
-
-
- php_uint32 must be an unsigned integer type capable of holding at least 32
- bits; exactly 32 should be fastest, but 64 is better on an Alpha with
- GCC at -O3 optimization so try your options and see what's best for you
-
- Melo: we should put some ifdefs here to catch those alphas...
-*/
-#define N MT_N /* length of state vector */
-#define M (397) /* a period parameter */
-#define K (0x9908B0DFU) /* a magic constant */
-#define hiBit(u) ((u) & 0x80000000U) /* mask all but highest bit of u */
-#define loBit(u) ((u) & 0x00000001U) /* mask all but lowest bit of u */
-#define loBits(u) ((u) & 0x7FFFFFFFU) /* mask the highest bit of u */
-#define mixBits(u, v) (hiBit(u)|loBits(v)) /* move hi bit of u to hi bit of v */
-
-/* {{{ php_mt_srand
- */
-PHPAPI void php_mt_srand(php_uint32 seed TSRMLS_DC)
-{
- /*
- We initialize state[0..(N-1)] via the generator
-
- x_new = (69069 * x_old) mod 2^32
-
- from Line 15 of Table 1, p. 106, Sec. 3.3.4 of Knuth's
- _The Art of Computer Programming_, Volume 2, 3rd ed.
-
- Notes (SJC): I do not know what the initial state requirements
- of the Mersenne Twister are, but it seems this seeding generator
- could be better. It achieves the maximum period for its modulus
- (2^30) iff x_initial is odd (p. 20-21, Sec. 3.2.1.2, Knuth); if
- x_initial can be even, you have sequences like 0, 0, 0, ...;
- 2^31, 2^31, 2^31, ...; 2^30, 2^30, 2^30, ...; 2^29, 2^29 + 2^31,
- 2^29, 2^29 + 2^31, ..., etc. so I force seed to be odd below.
-
-
- Even if x_initial is odd, if x_initial is 1 mod 4 then
-
- the lowest bit of x is always 1,
- the next-to-lowest bit of x is always 0,
- the 2nd-from-lowest bit of x alternates ... 0 1 0 1 0 1 0 1 ... ,
- the 3rd-from-lowest bit of x 4-cycles ... 0 1 1 0 0 1 1 0 ... ,
- the 4th-from-lowest bit of x has the 8-cycle ... 0 0 0 1 1 1 1 0 ... ,
- ...
-
- and if x_initial is 3 mod 4 then
-
- the lowest bit of x is always 1,
- the next-to-lowest bit of x is always 1,
- the 2nd-from-lowest bit of x alternates ... 0 1 0 1 0 1 0 1 ... ,
- the 3rd-from-lowest bit of x 4-cycles ... 0 0 1 1 0 0 1 1 ... ,
- the 4th-from-lowest bit of x has the 8-cycle ... 0 0 1 1 1 1 0 0 ... ,
- ...
-
- The generator's potency (min. s>=0 with (69069-1)^s = 0 mod 2^32) is
- 16, which seems to be alright by p. 25, Sec. 3.2.1.3 of Knuth. It
- also does well in the dimension 2..5 spectral tests, but it could be
- better in dimension 6 (Line 15, Table 1, p. 106, Sec. 3.3.4, Knuth).
-
- Note that the random number user does not see the values generated
- here directly since reloadMT() will always munge them first, so maybe
- none of all of this matters. In fact, the seed values made here could
- even be extra-special desirable if the Mersenne Twister theory says
- so-- that's why the only change I made is to restrict to odd seeds.
- */
-
- register php_uint32 x = (seed | 1U) & 0xFFFFFFFFU, *s = BG(state);
- register int j;
-
- for (BG(left) = 0, *s++ = x, j = N; --j;
- *s++ = (x *= 69069U) & 0xFFFFFFFFU);
-}
-/* }}} */
-
-/* {{{ php_mt_reload
- */
-static php_uint32 php_mt_reload(TSRMLS_D)
-{
- register php_uint32 *p0 = BG(state), *p2 = BG(state) + 2, *pM = BG(state) + M, s0, s1;
- register int j;
-
- if (BG(left) < -1)
- php_mt_srand(4357U TSRMLS_CC);
-
- BG(left) = N - 1, BG(next) = BG(state) + 1;
-
- for (s0 = BG(state)[0], s1 = BG(state)[1], j = N - M + 1; --j; s0 = s1, s1 = *p2++)
- *p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
-
- for (pM = BG(state), j = M; --j; s0 = s1, s1 = *p2++)
- *p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
-
- s1 = BG(state)[0], *p0 = *pM ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
- s1 ^= (s1 >> 11);
- s1 ^= (s1 << 7) & 0x9D2C5680U;
- s1 ^= (s1 << 15) & 0xEFC60000U;
-
- return s1 ^ (s1 >> 18);
-}
-/* }}} */
-
-/* {{{ php_mt_rand
- */
-PHPAPI php_uint32 php_mt_rand(TSRMLS_D)
-{
- php_uint32 y;
-
- if (--BG(left) < 0)
- return php_mt_reload(TSRMLS_C);
-
- y = *BG(next)++;
- y ^= (y >> 11);
- y ^= (y << 7) & 0x9D2C5680U;
- y ^= (y << 15) & 0xEFC60000U;
-
- return y ^ (y >> 18);
-}
-/* }}} */
-
-#ifdef PHP_WIN32
-#define GENERATE_SEED() ((long) (time(0) * GetCurrentProcessId() * 1000000 * php_combined_lcg(TSRMLS_C)))
-#else
-#define GENERATE_SEED() ((long) (time(0) * getpid() * 1000000 * php_combined_lcg(TSRMLS_C)))
-#endif
-
-/* {{{ proto void srand([int seed])
- Seeds random number generator */
-PHP_FUNCTION(srand)
-{
- long seed;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &seed) == FAILURE)
- return;
-
- if (ZEND_NUM_ARGS() == 0)
- seed = GENERATE_SEED();
-
- php_srand(seed TSRMLS_CC);
- BG(rand_is_seeded) = 1;
-}
-/* }}} */
-
-/* {{{ proto void mt_srand([int seed])
- Seeds Mersenne Twister random number generator */
-PHP_FUNCTION(mt_srand)
-{
- long seed;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &seed) == FAILURE)
- return;
-
- if (ZEND_NUM_ARGS() == 0)
- seed = GENERATE_SEED();
-
- php_mt_srand(seed TSRMLS_CC);
- BG(mt_rand_is_seeded) = 1;
-}
-/* }}} */
-
-
-/*
- * A bit of tricky math here. We want to avoid using a modulus because
- * that simply tosses the high-order bits and might skew the distribution
- * of random values over the range. Instead we map the range directly.
- *
- * We need to map the range from 0...M evenly to the range a...b
- * Let n = the random number and n' = the mapped random number
- *
- * Then we have: n' = a + n(b-a)/M
- *
- * We have a problem here in that only n==M will get mapped to b which
- # means the chances of getting b is much much less than getting any of
- # the other values in the range. We can fix this by increasing our range
- # artifically and using:
- #
- # n' = a + n(b-a+1)/M
- *
- # Now we only have a problem if n==M which would cause us to produce a
- # number of b+1 which would be bad. So we bump M up by one to make sure
- # this will never happen, and the final algorithm looks like this:
- #
- # n' = a + n(b-a+1)/(M+1)
- *
- * -RL
- */
-
-/* {{{ proto int rand([int min, int max])
- Returns a random number */
-PHP_FUNCTION(rand)
-{
- long min;
- long max;
- long number;
- int argc = ZEND_NUM_ARGS();
-
- if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE)
- return;
-
- if (!BG(rand_is_seeded)) {
- php_srand(GENERATE_SEED() TSRMLS_CC);
- }
-
- number = php_rand(TSRMLS_C);
- if (argc == 2) {
- RAND_RANGE(number, min, max, PHP_RAND_MAX);
- }
-
- RETURN_LONG(number);
-}
-/* }}} */
-
-/* {{{ proto int mt_rand([int min, int max])
- Returns a random number from Mersenne Twister */
-PHP_FUNCTION(mt_rand)
-{
- long min;
- long max;
- long number;
- int argc = ZEND_NUM_ARGS();
-
- if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE)
- return;
-
- if (!BG(mt_rand_is_seeded)) {
- php_mt_srand(GENERATE_SEED() TSRMLS_CC);
- }
-
- /*
- * Melo: hmms.. randomMT() returns 32 random bits...
- * Yet, the previous php_rand only returns 31 at most.
- * So I put a right shift to loose the lsb. It *seems*
- * better than clearing the msb.
- * Update:
- * I talked with Cokus via email and it won't ruin the algorithm
- */
- number = (long) (php_mt_rand(TSRMLS_C) >> 1);
- if (argc == 2) {
- RAND_RANGE(number, min, max, PHP_MT_RAND_MAX);
- }
-
- RETURN_LONG(number);
-}
-/* }}} */
-
-/* {{{ proto int getrandmax(void)
- Returns the maximum value a random number can have */
-PHP_FUNCTION(getrandmax)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_LONG(PHP_RAND_MAX);
-}
-/* }}} */
-
-/* {{{ proto int mt_getrandmax(void)
- Returns the maximum value a random number from Mersenne Twister can have */
-PHP_FUNCTION(mt_getrandmax)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- /*
- * Melo: it could be 2^^32 but we only use 2^^31 to maintain
- * compatibility with the previous php_rand
- */
- RETURN_LONG(PHP_MT_RAND_MAX); /* 2^^31 */
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/standard/reg.c b/ext/standard/reg.c
deleted file mode 100644
index e76dee7c0d..0000000000
--- a/ext/standard/reg.c
+++ /dev/null
@@ -1,637 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Jim Winstead <jimw@php.net> |
- | Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "php.h"
-#include "php_string.h"
-#include "reg.h"
-#include "ext/standard/info.h"
-
-ZEND_DECLARE_MODULE_GLOBALS(reg)
-
-typedef struct {
- regex_t preg;
- int cflags;
-} reg_cache;
-
-/* {{{ _php_regcomp
- */
-static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
-{
- int r = 0;
- int patlen = strlen(pattern);
- reg_cache *rc = NULL;
- TSRMLS_FETCH();
-
- if(zend_hash_find(&REG(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == FAILURE ||
- rc->cflags != cflags) {
- r = regcomp(preg, pattern, cflags);
- if(!r) {
- reg_cache rcp;
-
- rcp.cflags = cflags;
- memcpy(&rcp.preg, preg, sizeof(*preg));
- zend_hash_update(&REG(ht_rc), (char *) pattern, patlen+1,
- (void *) &rcp, sizeof(rcp), NULL);
- }
- } else {
- memcpy(preg, &rc->preg, sizeof(*preg));
- }
-
- return r;
-}
-/* }}} */
-
-static void _free_reg_cache(reg_cache *rc)
-{
- regfree(&rc->preg);
-}
-
-#undef regfree
-#define regfree(a);
-#undef regcomp
-#define regcomp(a, b, c) _php_regcomp(a, b, c)
-
-static void php_reg_init_globals(zend_reg_globals *reg_globals TSRMLS_DC)
-{
- zend_hash_init(&reg_globals->ht_rc, 0, NULL, (void (*)(void *)) _free_reg_cache, 1);
-}
-
-static void php_reg_destroy_globals(zend_reg_globals *reg_globals TSRMLS_DC)
-{
- zend_hash_destroy(&reg_globals->ht_rc);
-}
-
-PHP_MINIT_FUNCTION(regex)
-{
- ZEND_INIT_MODULE_GLOBALS(reg, php_reg_init_globals, php_reg_destroy_globals);
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(regex)
-{
-#ifndef ZTS
- php_reg_destroy_globals(&reg_globals TSRMLS_CC);
-#endif
-
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(regex)
-{
-#if HSREGEX
- php_info_print_table_row(2, "Regex Library", "Bundled library enabled");
-#else
- php_info_print_table_row(2, "Regex Library", "System library enabled");
-#endif
-}
-
-
-/* {{{ php_reg_eprint
- * php_reg_eprint - convert error number to name
- */
-static void php_reg_eprint(int err, regex_t *re) {
- char *buf = NULL, *message = NULL;
- size_t len;
- size_t buf_len;
-
-#ifdef REG_ITOA
- /* get the length of the message */
- buf_len = regerror(REG_ITOA | err, re, NULL, 0);
- if (buf_len) {
- buf = (char *)emalloc(buf_len * sizeof(char));
- if (!buf) return; /* fail silently */
- /* finally, get the error message */
- regerror(REG_ITOA | err, re, buf, buf_len);
- }
-#else
- buf_len = 0;
-#endif
- len = regerror(err, re, NULL, 0);
- if (len) {
- TSRMLS_FETCH();
-
- message = (char *)emalloc((buf_len + len + 2) * sizeof(char));
- if (!message) {
- return; /* fail silently */
- }
- if (buf_len) {
- snprintf(message, buf_len, "%s: ", buf);
- buf_len += 1; /* so pointer math below works */
- }
- /* drop the message into place */
- regerror(err, re, message + buf_len, len);
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", message);
- }
-
- STR_FREE(buf);
- STR_FREE(message);
-}
-/* }}} */
-
-/* {{{ php_ereg
- */
-static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
-{
- pval **regex, /* Regular expression */
- **findin, /* String to apply expression to */
- **array = NULL; /* Optional register array */
- regex_t re;
- regmatch_t *subs;
- int err, match_len, string_len;
- uint i;
- int copts = 0;
- off_t start, end;
- char *buf = NULL;
- char *string = NULL;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 ||
- zend_get_parameters_ex(argc, &regex, &findin, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (icase)
- copts |= REG_ICASE;
-
- if (argc == 2)
- copts |= REG_NOSUB;
-
- /* compile the regular expression from the supplied regex */
- if (Z_TYPE_PP(regex) == IS_STRING) {
- err = regcomp(&re, Z_STRVAL_PP(regex), REG_EXTENDED | copts);
- } else {
- /* we convert numbers to integers and treat them as a string */
- if (Z_TYPE_PP(regex) == IS_DOUBLE)
- convert_to_long_ex(regex); /* get rid of decimal places */
- convert_to_string_ex(regex);
- /* don't bother doing an extended regex with just a number */
- err = regcomp(&re, Z_STRVAL_PP(regex), copts);
- }
-
- if (err) {
- php_reg_eprint(err, &re);
- RETURN_FALSE;
- }
-
- /* make a copy of the string we're looking in */
- convert_to_string_ex(findin);
- string = estrndup(Z_STRVAL_PP(findin), Z_STRLEN_PP(findin));
-
- /* allocate storage for (sub-)expression-matches */
- subs = (regmatch_t *)ecalloc(sizeof(regmatch_t),re.re_nsub+1);
-
- /* actually execute the regular expression */
- err = regexec(&re, string, re.re_nsub+1, subs, 0);
- if (err && err != REG_NOMATCH) {
- php_reg_eprint(err, &re);
- regfree(&re);
- efree(subs);
- RETURN_FALSE;
- }
- match_len = 1;
-
- if (array && err != REG_NOMATCH) {
- match_len = (int) (subs[0].rm_eo - subs[0].rm_so);
- string_len = Z_STRLEN_PP(findin) + 1;
-
- buf = emalloc(string_len);
-
- zval_dtor(*array); /* start with clean array */
- array_init(*array);
-
- for (i = 0; i <= re.re_nsub; i++) {
- start = subs[i].rm_so;
- end = subs[i].rm_eo;
- if (start != -1 && end > 0 && start < string_len && end < string_len && start < end) {
- add_index_stringl(*array, i, string+start, end-start, 1);
- } else {
- add_index_bool(*array, i, 0);
- }
- }
- efree(buf);
- }
-
- efree(subs);
- efree(string);
- if (err == REG_NOMATCH) {
- RETVAL_FALSE;
- } else {
- if (match_len == 0)
- match_len = 1;
- RETVAL_LONG(match_len);
- }
- regfree(&re);
-}
-/* }}} */
-
-/* {{{ proto int ereg(string pattern, string string [, array registers])
- Regular expression match */
-PHP_FUNCTION(ereg)
-{
- php_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int eregi(string pattern, string string [, array registers])
- Case-insensitive regular expression match */
-PHP_FUNCTION(eregi)
-{
- php_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ php_reg_replace
- * this is the meat and potatoes of regex replacement! */
-PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended)
-{
- regex_t re;
- regmatch_t *subs;
-
- char *buf, /* buf is where we build the replaced string */
- *nbuf, /* nbuf is used when we grow the buffer */
- *walkbuf; /* used to walk buf when replacing backrefs */
- const char *walk; /* used to walk replacement string for backrefs */
- int buf_len;
- int pos, tmp, string_len, new_l;
- int err, copts = 0;
-
- string_len = strlen(string);
-
- if (icase) {
- copts = REG_ICASE;
- }
- if (extended) {
- copts |= REG_EXTENDED;
- }
-
- err = regcomp(&re, pattern, copts);
- if (err) {
- php_reg_eprint(err, &re);
- return ((char *) -1);
- }
-
-
- /* allocate storage for (sub-)expression-matches */
- subs = (regmatch_t *)ecalloc(sizeof(regmatch_t),re.re_nsub+1);
-
- /* start with a buffer that is twice the size of the stringo
- we're doing replacements in */
- buf_len = 2 * string_len + 1;
- buf = emalloc(buf_len * sizeof(char));
-
- err = pos = 0;
- buf[0] = '\0';
- while (!err) {
- err = regexec(&re, &string[pos], re.re_nsub+1, subs, (pos ? REG_NOTBOL : 0));
-
- if (err && err != REG_NOMATCH) {
- php_reg_eprint(err, &re);
- efree(subs);
- efree(buf);
- regfree(&re);
- return ((char *) -1);
- }
-
- if (!err) {
- /* backref replacement is done in two passes:
- 1) find out how long the string will be, and allocate buf
- 2) copy the part before match, replacement and backrefs to buf
-
- Jaakko Hyvätti <Jaakko.Hyvatti@iki.fi>
- */
-
- new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
- walk = replace;
- while (*walk) {
- if ('\\' == *walk && isdigit((unsigned char)walk[1]) && ((unsigned char)walk[1]) - '0' <= re.re_nsub) {
- if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) {
- new_l += subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
- }
- walk += 2;
- } else {
- new_l++;
- walk++;
- }
- }
- if (new_l + 1 > buf_len) {
- buf_len = 1 + buf_len + 2 * new_l;
- nbuf = emalloc(buf_len);
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- tmp = strlen(buf);
- /* copy the part of the string before the match */
- strncat(buf, &string[pos], subs[0].rm_so);
-
- /* copy replacement and backrefs */
- walkbuf = &buf[tmp + subs[0].rm_so];
- walk = replace;
- while (*walk) {
- if ('\\' == *walk && isdigit(walk[1]) && walk[1] - '0' <= (int)re.re_nsub) {
- if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1
- /* this next case shouldn't happen. it does. */
- && subs[walk[1] - '0'].rm_so <= subs[walk[1] - '0'].rm_eo) {
-
- tmp = subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
- memcpy (walkbuf, &string[pos + subs[walk[1] - '0'].rm_so], tmp);
- walkbuf += tmp;
- }
- walk += 2;
- } else {
- *walkbuf++ = *walk++;
- }
- }
- *walkbuf = '\0';
-
- /* and get ready to keep looking for replacements */
- if (subs[0].rm_so == subs[0].rm_eo) {
- if (subs[0].rm_so + pos >= string_len) {
- break;
- }
- new_l = strlen (buf) + 1;
- if (new_l + 1 > buf_len) {
- buf_len = 1 + buf_len + 2 * new_l;
- nbuf = emalloc(buf_len * sizeof(char));
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- pos += subs[0].rm_eo + 1;
- buf [new_l-1] = string [pos-1];
- buf [new_l] = '\0';
- } else {
- pos += subs[0].rm_eo;
- }
- } else { /* REG_NOMATCH */
- new_l = strlen(buf) + strlen(&string[pos]);
- if (new_l + 1 > buf_len) {
- buf_len = new_l + 1; /* now we know exactly how long it is */
- nbuf = emalloc(buf_len * sizeof(char));
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- /* stick that last bit of string on our output */
- strcat(buf, &string[pos]);
- }
- }
-
- /* don't want to leak memory .. */
- efree(subs);
- regfree(&re);
-
- /* whew. */
- return (buf);
-}
-/* }}} */
-
-/* {{{ php_ereg_replace
- */
-static void php_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase)
-{
- pval **arg_pattern,
- **arg_replace,
- **arg_string;
- char *pattern;
- char *string;
- char *replace;
- char *ret;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &arg_pattern, &arg_replace, &arg_string) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(arg_pattern) == IS_STRING) {
- if (Z_STRVAL_PP(arg_pattern) && Z_STRLEN_PP(arg_pattern))
- pattern = estrndup(Z_STRVAL_PP(arg_pattern), Z_STRLEN_PP(arg_pattern));
- else
- pattern = empty_string;
- } else {
- convert_to_long_ex(arg_pattern);
- pattern = emalloc(2);
- pattern[0] = (char) Z_LVAL_PP(arg_pattern);
- pattern[1] = '\0';
- }
-
- if (Z_TYPE_PP(arg_replace) == IS_STRING) {
- if (Z_STRVAL_PP(arg_replace) && Z_STRLEN_PP(arg_replace))
- replace = estrndup(Z_STRVAL_PP(arg_replace), Z_STRLEN_PP(arg_replace));
- else
- replace = empty_string;
- } else {
- convert_to_long_ex(arg_replace);
- replace = emalloc(2);
- replace[0] = (char) Z_LVAL_PP(arg_replace);
- replace[1] = '\0';
- }
-
- convert_to_string_ex(arg_string);
- if (Z_STRVAL_PP(arg_string) && Z_STRLEN_PP(arg_string))
- string = estrndup(Z_STRVAL_PP(arg_string), Z_STRLEN_PP(arg_string));
- else
- string = empty_string;
-
- /* do the actual work */
- ret = php_reg_replace(pattern, replace, string, icase, 1);
- if (ret == (char *) -1) {
- RETVAL_FALSE;
- } else {
- RETVAL_STRING(ret, 1);
- STR_FREE(ret);
- }
-
- STR_FREE(string);
- STR_FREE(replace);
- STR_FREE(pattern);
-}
-/* }}} */
-
-/* {{{ proto string ereg_replace(string pattern, string replacement, string string)
- Replace regular expression */
-PHP_FUNCTION(ereg_replace)
-{
- php_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string eregi_replace(string pattern, string replacement, string string)
- Case insensitive replace regular expression */
-PHP_FUNCTION(eregi_replace)
-{
- php_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ php_split
- */
-static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase)
-{
- zval **spliton, **str, **arg_count = NULL;
- regex_t re;
- regmatch_t subs[1];
- char *strp, *endp;
- int err, size, count = -1, copts = 0;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 ||
- zend_get_parameters_ex(argc, &spliton, &str, &arg_count) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc > 2) {
- convert_to_long_ex(arg_count);
- count = Z_LVAL_PP(arg_count);
- }
-
- if (icase)
- copts = REG_ICASE;
-
- convert_to_string_ex(spliton);
- convert_to_string_ex(str);
-
- strp = Z_STRVAL_PP(str);
- endp = strp + Z_STRLEN_PP(str);
-
- err = regcomp(&re, Z_STRVAL_PP(spliton), REG_EXTENDED | copts);
- if (err) {
- php_reg_eprint(err, &re);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- /* churn through str, generating array entries as we go */
- while ((count == -1 || count > 1) && !(err = regexec(&re, strp, 1, subs, 0))) {
- if (subs[0].rm_so == 0 && subs[0].rm_eo) {
- /* match is at start of string, return empty string */
- add_next_index_stringl(return_value, empty_string, 0, 1);
- /* skip ahead the length of the regex match */
- strp += subs[0].rm_eo;
- } else if (subs[0].rm_so == 0 && subs[0].rm_eo == 0) {
- /* No more matches */
- regfree(&re);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Regular Expression to split()");
- zend_hash_destroy(Z_ARRVAL_P(return_value));
- efree(Z_ARRVAL_P(return_value));
- RETURN_FALSE;
- } else {
- /* On a real match */
-
- /* make a copy of the substring */
- size = subs[0].rm_so;
-
- /* add it to the array */
- add_next_index_stringl(return_value, strp, size, 1);
-
- /* point at our new starting point */
- strp = strp + subs[0].rm_eo;
- }
-
- /* if we're only looking for a certain number of points,
- stop looking once we hit it */
- if (count != -1) {
- count--;
- }
- }
-
- /* see if we encountered an error */
- if (err && err != REG_NOMATCH) {
- php_reg_eprint(err, &re);
- regfree(&re);
- zend_hash_destroy(Z_ARRVAL_P(return_value));
- efree(Z_ARRVAL_P(return_value));
- RETURN_FALSE;
- }
-
- /* otherwise we just have one last element to add to the array */
- size = endp - strp;
-
- add_next_index_stringl(return_value, strp, size, 1);
-
- regfree(&re);
-}
-/* }}} */
-
-/* {{{ proto array split(string pattern, string string [, int limit])
- Split string into array by regular expression */
-PHP_FUNCTION(split)
-{
- php_split(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto array spliti(string pattern, string string [, int limit])
- Split string into array by regular expression case-insensitive */
-
-PHP_FUNCTION(spliti)
-{
- php_split(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-
-/* }}} */
-
-/* {{{ proto string sql_regcase(string string)
- Make regular expression for case insensitive match */
-PHPAPI PHP_FUNCTION(sql_regcase)
-{
- zval **string;
- char *tmp;
- unsigned char c;
- register int i, j;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &string)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(string);
-
- tmp = emalloc((Z_STRLEN_PP(string) * 4) + 1);
-
- for (i = j = 0; i < Z_STRLEN_PP(string); i++) {
- c = (unsigned char) Z_STRVAL_PP(string)[i];
- if(isalpha(c)) {
- tmp[j++] = '[';
- tmp[j++] = toupper(c);
- tmp[j++] = tolower(c);
- tmp[j++] = ']';
- } else {
- tmp[j++] = c;
- }
- }
- tmp[j] = 0;
-
- RETVAL_STRINGL(tmp, j, 1);
- efree(tmp);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/standard/reg.h b/ext/standard/reg.h
deleted file mode 100644
index c2d9251c5f..0000000000
--- a/ext/standard/reg.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-
-/* $Id$ */
-
-#ifndef REG_H
-#define REG_H
-
-PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended);
-
-PHP_FUNCTION(ereg);
-PHP_FUNCTION(eregi);
-PHP_FUNCTION(eregi_replace);
-PHP_FUNCTION(ereg_replace);
-PHP_FUNCTION(split);
-PHP_FUNCTION(spliti);
-PHPAPI PHP_FUNCTION(sql_regcase);
-
-ZEND_BEGIN_MODULE_GLOBALS(reg)
- HashTable ht_rc;
-ZEND_END_MODULE_GLOBALS(reg)
-
-PHP_MINIT_FUNCTION(regex);
-PHP_MSHUTDOWN_FUNCTION(regex);
-PHP_MINFO_FUNCTION(regex);
-
-
-#ifdef ZTS
-#define REG(v) TSRMG(reg_globals_id, zend_reg_globals *, v)
-#else
-#define REG(v) (reg_globals.v)
-#endif
-
-#endif /* REG_H */
diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c
deleted file mode 100644
index 54723e1b0a..0000000000
--- a/ext/standard/scanf.c
+++ /dev/null
@@ -1,1259 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Clayton Collie <clcollie@mindspring.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- scanf.c --
-
- This file contains the base code which implements sscanf and by extension
- fscanf. Original code is from TCL8.3.0 and bears the following copyright
-
-
-
- This software is copyrighted by the Regents of the University of
- California, Sun Microsystems, Inc., Scriptics Corporation,
- and other parties. The following terms apply to all files associated
- with the software unless explicitly disclaimed in individual files.
-
- The authors hereby grant permission to use, copy, modify, distribute,
- and license this software and its documentation for any purpose, provided
- that existing copyright notices are retained in all copies and that this
- notice is included verbatim in any distributions. No written agreement,
- license, or royalty fee is required for any of the authorized uses.
- Modifications to this software may be copyrighted by their authors
- and need not follow the licensing terms described here, provided that
- the new terms are clearly indicated on the first page of each file where
- they apply.
-
- IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
- FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
- DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
- THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
- IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
- NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
- MODIFICATIONS.
-
- GOVERNMENT USE: If you are acquiring this software on behalf of the
- U.S. government, the Government shall have only "Restricted Rights"
- in the software and related documentation as defined in the Federal
- Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
- are acquiring the software on behalf of the Department of Defense, the
- software shall be classified as "Commercial Computer Software" and the
- Government shall have only "Restricted Rights" as defined in Clause
- 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
- authors grant the U.S. Government and others acting in its behalf
- permission to use and distribute the software in accordance with the
- terms specified in this license.
-
- */
-
-#include <stdio.h>
-#include <limits.h>
-#include <ctype.h>
-#include "php.h"
-#include "php_variables.h"
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-#include "zend_execute.h"
-#include "zend_operators.h"
-#include "php_globals.h"
-#include "basic_functions.h"
-#include "scanf.h"
-
-/*
- * Flag values used internally by [f|s]canf.
- */
-
-#define SCAN_NOSKIP 0x1 /* Don't skip blanks. */
-#define SCAN_SUPPRESS 0x2 /* Suppress assignment. */
-#define SCAN_UNSIGNED 0x4 /* Read an unsigned value. */
-#define SCAN_WIDTH 0x8 /* A width value was supplied. */
-
-#define SCAN_SIGNOK 0x10 /* A +/- character is allowed. */
-#define SCAN_NODIGITS 0x20 /* No digits have been scanned. */
-#define SCAN_NOZERO 0x40 /* No zero digits have been scanned. */
-#define SCAN_XOK 0x80 /* An 'x' is allowed. */
-#define SCAN_PTOK 0x100 /* Decimal point is allowed. */
-#define SCAN_EXPOK 0x200 /* An exponent is allowed. */
-
-#define UCHAR(x) (zend_uchar)(x)
-
-
-
-/*
- * The following structure contains the information associated with
- * a character set.
- */
-
-typedef struct CharSet {
- int exclude; /* 1 if this is an exclusion set. */
- int nchars;
- char *chars;
- int nranges;
- struct Range {
- char start;
- char end;
- } *ranges;
-} CharSet;
-
-/*
- * Declarations for functions used only in this file.
- */
-
-static char *BuildCharSet(CharSet *cset, char *format);
-static int CharInSet(CharSet *cset, int ch);
-static void ReleaseCharSet(CharSet *cset);
-static inline void scan_set_error_return(int numVars, pval **return_value);
-
-
-/* {{{ BuildCharSet
- *----------------------------------------------------------------------
- *
- * BuildCharSet --
- *
- * This function examines a character set format specification
- * and builds a CharSet containing the individual characters and
- * character ranges specified.
- *
- * Results:
- * Returns the next format position.
- *
- * Side effects:
- * Initializes the charset.
- *
- *----------------------------------------------------------------------
- */
-static char * BuildCharSet(CharSet *cset, char *format)
-{
- char *ch, start;
- int nranges;
- char *end;
-
- memset(cset, 0, sizeof(CharSet));
-
- ch = format;
- if (*ch == '^') {
- cset->exclude = 1;
- ch = ++format;
- }
- end = format + 1; /* verify this - cc */
-
- /*
- * Find the close bracket so we can overallocate the set.
- */
-
- if (*ch == ']') {
- ch = end++;
- }
- nranges = 0;
- while (*ch != ']') {
- if (*ch == '-') {
- nranges++;
- }
- ch = end++;
- }
-
- cset->chars = (char *) emalloc(sizeof(char) * (end - format - 1));
- if (nranges > 0) {
- cset->ranges = (struct Range *) emalloc(sizeof(struct Range)*nranges);
- } else {
- cset->ranges = NULL;
- }
-
- /*
- * Now build the character set.
- */
-
- cset->nchars = cset->nranges = 0;
- ch = format++;
- start = *ch;
- if (*ch == ']' || *ch == '-') {
- cset->chars[cset->nchars++] = *ch;
- ch = format++;
- }
- while (*ch != ']') {
- if (*format == '-') {
- /*
- * This may be the first character of a range, so don't add
- * it yet.
- */
-
- start = *ch;
- } else if (*ch == '-') {
- /*
- * Check to see if this is the last character in the set, in which
- * case it is not a range and we should add the previous character
- * as well as the dash.
- */
-
- if (*format == ']') {
- cset->chars[cset->nchars++] = start;
- cset->chars[cset->nchars++] = *ch;
- } else {
- ch = format++;
-
- /*
- * Check to see if the range is in reverse order.
- */
-
- if (start < *ch) {
- cset->ranges[cset->nranges].start = start;
- cset->ranges[cset->nranges].end = *ch;
- } else {
- cset->ranges[cset->nranges].start = *ch;
- cset->ranges[cset->nranges].end = start;
- }
- cset->nranges++;
- }
- } else {
- cset->chars[cset->nchars++] = *ch;
- }
- ch = format++;
- }
- return format;
-}
-/* }}} */
-
-/* {{{ CharInSet
- *----------------------------------------------------------------------
- *
- * CharInSet --
- *
- * Check to see if a character matches the given set.
- *
- * Results:
- * Returns non-zero if the character matches the given set.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-static int CharInSet(CharSet *cset, int c)
-{
- char ch = (char) c;
- int i, match = 0;
-
- for (i = 0; i < cset->nchars; i++) {
- if (cset->chars[i] == ch) {
- match = 1;
- break;
- }
- }
- if (!match) {
- for (i = 0; i < cset->nranges; i++) {
- if ((cset->ranges[i].start <= ch)
- && (ch <= cset->ranges[i].end)) {
- match = 1;
- break;
- }
- }
- }
- return (cset->exclude ? !match : match);
-}
-/* }}} */
-
-/* {{{ ReleaseCharSet
- *----------------------------------------------------------------------
- *
- * ReleaseCharSet --
- *
- * Free the storage associated with a character set.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-static void ReleaseCharSet(CharSet *cset)
-{
- efree((char *)cset->chars);
- if (cset->ranges) {
- efree((char *)cset->ranges);
- }
-}
-/* }}} */
-
-/* {{{ ValidateFormat
- *----------------------------------------------------------------------
- *
- * ValidateFormat --
- *
- * Parse the format string and verify that it is properly formed
- * and that there are exactly enough variables on the command line.
- *
- * Results:
- * FAILURE or SUCCESS.
- *
- * Side effects:
- * May set php_error based on abnormal conditions.
- *
- * Parameters :
- * format The format string.
- * numVars The number of variables passed to the scan command.
- * totalSubs The number of variables that will be required.
- *
- *----------------------------------------------------------------------
-*/
-PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs)
-{
-#define STATIC_LIST_SIZE 16
- int gotXpg, gotSequential, value, i, flags;
- char *end, *ch = NULL;
- int staticAssign[STATIC_LIST_SIZE];
- int *nassign = staticAssign;
- int objIndex, xpgSize, nspace = STATIC_LIST_SIZE;
- TSRMLS_FETCH();
-
- /*
- * Initialize an array that records the number of times a variable
- * is assigned to by the format string. We use this to detect if
- * a variable is multiply assigned or left unassigned.
- */
-
- if (numVars > nspace) {
- nassign = (int*)emalloc(sizeof(int) * numVars);
- nspace = numVars;
- }
- for (i = 0; i < nspace; i++) {
- nassign[i] = 0;
- }
-
- xpgSize = objIndex = gotXpg = gotSequential = 0;
-
- while (*format != '\0') {
- ch = format++;
- flags = 0;
-
- if (*ch != '%') {
- continue;
- }
- ch = format++;
- if (*ch == '%') {
- continue;
- }
- if (*ch == '*') {
- flags |= SCAN_SUPPRESS;
- ch = format++;
- goto xpgCheckDone;
- }
-
- if ( isdigit( (int)*ch ) ) {
- /*
- * Check for an XPG3-style %n$ specification. Note: there
- * must not be a mixture of XPG3 specs and non-XPG3 specs
- * in the same format string.
- */
-
- value = strtoul(format-1, &end, 10);
- if (*end != '$') {
- goto notXpg;
- }
- format = end+1;
- ch = format++;
- gotXpg = 1;
- if (gotSequential) {
- goto mixedXPG;
- }
- objIndex = value - 1;
- if ((objIndex < 0) || (numVars && (objIndex >= numVars))) {
- goto badIndex;
- } else if (numVars == 0) {
- /*
- * In the case where no vars are specified, the user can
- * specify %9999$ legally, so we have to consider special
- * rules for growing the assign array. 'value' is
- * guaranteed to be > 0.
- */
-
- /* set a lower artificial limit on this
- * in the interest of security and resource friendliness
- * 255 arguments should be more than enough. - cc
- */
- if (value > SCAN_MAX_ARGS) {
- goto badIndex;
- }
-
- xpgSize = (xpgSize > value) ? xpgSize : value;
- }
- goto xpgCheckDone;
- }
-
- notXpg:
- gotSequential = 1;
- if (gotXpg) {
- mixedXPG:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot mix \"%\" and \"%n$\" conversion specifiers");
- goto error;
- }
-
- xpgCheckDone:
- /*
- * Parse any width specifier.
- */
-
- if (isdigit(UCHAR(*ch))) {
- value = strtoul(format-1, &format, 10);
- flags |= SCAN_WIDTH;
- ch = format++;
- }
-
- /*
- * Ignore size specifier.
- */
-
- if ((*ch == 'l') || (*ch == 'L') || (*ch == 'h')) {
- ch = format++;
- }
-
- if (!(flags & SCAN_SUPPRESS) && numVars && (objIndex >= numVars)) {
- goto badIndex;
- }
-
- /*
- * Handle the various field types.
- */
-
- switch (*ch) {
- case 'n':
- case 'd':
- case 'D':
- case 'i':
- case 'o':
- case 'x':
- case 'X':
- case 'u':
- case 'f':
- case 'e':
- case 'E':
- case 'g':
- case 's':
- break;
- case 'c':
- /* we differ here with the TCL implementation in allowing for */
- /* a character width specification, to be more consistent with */
- /* ANSI. since Zend auto allocates space for vars, this is no */
- /* problem - cc */
- /*
- if (flags & SCAN_WIDTH) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field width may not be specified in %c conversion");
- goto error;
- }
- */
- break;
- case '[':
- if (*format == '\0') {
- goto badSet;
- }
- ch = format++;
- if (*ch == '^') {
- if (*format == '\0') {
- goto badSet;
- }
- ch = format++;
- }
- if (*ch == ']') {
- if (*format == '\0') {
- goto badSet;
- }
- ch = format++;
- }
- while (*ch != ']') {
- if (*format == '\0') {
- goto badSet;
- }
- ch = format++;
- }
- break;
- badSet:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unmatched [ in format string");
- goto error;
- default:
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad scan conversion character \"%c\"", ch);
- goto error;
- }
- }
- if (!(flags & SCAN_SUPPRESS)) {
- if (objIndex >= nspace) {
- /*
- * Expand the nassign buffer. If we are using XPG specifiers,
- * make sure that we grow to a large enough size. xpgSize is
- * guaranteed to be at least one larger than objIndex.
- */
- value = nspace;
- if (xpgSize) {
- nspace = xpgSize;
- } else {
- nspace += STATIC_LIST_SIZE;
- }
- if (nassign == staticAssign) {
- nassign = (void *)emalloc(nspace * sizeof(int));
- for (i = 0; i < STATIC_LIST_SIZE; ++i) {
- nassign[i] = staticAssign[i];
- }
- } else {
- nassign = (void *)erealloc((void *)nassign, nspace * sizeof(int));
- }
- for (i = value; i < nspace; i++) {
- nassign[i] = 0;
- }
- }
- nassign[objIndex]++;
- objIndex++;
- }
- } /* while (*format != '\0') */
-
- /*
- * Verify that all of the variable were assigned exactly once.
- */
-
- if (numVars == 0) {
- if (xpgSize) {
- numVars = xpgSize;
- } else {
- numVars = objIndex;
- }
- }
- if (totalSubs) {
- *totalSubs = numVars;
- }
- for (i = 0; i < numVars; i++) {
- if (nassign[i] > 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variable is assigned by multiple \"%n$\" conversion specifiers");
- goto error;
- } else if (!xpgSize && (nassign[i] == 0)) {
- /*
- * If the space is empty, and xpgSize is 0 (means XPG wasn't
- * used, and/or numVars != 0), then too many vars were given
- */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variable is not assigned by any conversion specifiers");
- goto error;
- }
- }
-
- if (nassign != staticAssign) {
- efree((char *)nassign);
- }
- return SCAN_SUCCESS;
-
-badIndex:
- if (gotXpg) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "\"%n$\" argument index out of range");
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Different numbers of variable names and field specifiers");
- }
-
-error:
- if (nassign != staticAssign) {
- efree((char *)nassign);
- }
- return SCAN_ERROR_INVALID_FORMAT;
-#undef STATIC_LIST_SIZE
-}
-/* }}} */
-
-/* {{{ php_sscanf_internal
- * This is the internal function which does processing on behalf of
- * both sscanf() and fscanf()
- *
- * parameters :
- * string literal string to be processed
- * format format string
- * argCount total number of elements in the args array
- * args arguments passed in from user function (f|s)scanf
- * varStart offset (in args) of 1st variable passed in to (f|s)scanf
- * return_value set with the results of the scan
- */
-
-PHPAPI int php_sscanf_internal( char *string, char *format,
- int argCount, zval ***args,
- int varStart, pval **return_value TSRMLS_DC)
-{
- int numVars, nconversions, totalVars = -1;
- int i, value, result;
- int objIndex;
- char *end, *baseString;
- zval **current;
- char op = 0;
- int base = 0;
- int underflow = 0;
- size_t width;
- long (*fn)() = NULL;
- char *ch, sch;
- int flags;
- char buf[64]; /* Temporary buffer to hold scanned
- * number strings before they are
- * passed to strtoul. */
-
-
- /* do some sanity checking */
- if ((varStart > argCount) || (varStart < 0)){
- varStart = SCAN_MAX_ARGS + 1;
- }
- numVars = argCount - varStart;
- if (numVars < 0) {
- numVars = 0;
- }
-
-#if 0
- zend_printf("<br>in sscanf_internal : <br> string is \"%s\", format = \"%s\"<br> NumVars = %d. VarStart = %d<br>-------------------------<br>",
- string, format, numVars, varStart);
-#endif
- /*
- * Check for errors in the format string.
- */
- if (ValidateFormat(format, numVars, &totalVars) != SCAN_SUCCESS) {
- scan_set_error_return( numVars, return_value );
- return SCAN_ERROR_INVALID_FORMAT;
- }
-
- objIndex = numVars ? varStart : 0;
-
- /*
- * If any variables are passed, make sure they are all passed by reference
- */
- if (numVars) {
- for (i = varStart;i < argCount;i++){
- if ( ! PZVAL_IS_REF( *args[ i ] ) ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter %d must be passed by reference", i);
- scan_set_error_return(numVars, return_value);
- return SCAN_ERROR_VAR_PASSED_BYVAL;
- }
- }
- }
-
-
- /*
- * Allocate space for the result objects. Only happens when no variables
- * are specified
- */
-
- if (!numVars) {
- /* allocate an array for return */
- array_init(*return_value);
-
- for (i = 0; i < totalVars; i++) {
- if (add_next_index_null(*return_value) == FAILURE) {
- scan_set_error_return(0, return_value);
- return FAILURE;
- }
- }
- }
-
- baseString = string;
-
- /*
- * Iterate over the format string filling in the result objects until
- * we reach the end of input, the end of the format string, or there
- * is a mismatch.
- */
-
- nconversions = 0;
- /* note ! - we need to limit the loop for objIndex to keep it in bounds */
-
- while (*format != '\0') {
-
- ch = format++;
-
- flags = 0;
-
- /*
- * If we see whitespace in the format, skip whitespace in the string.
- */
-
- if ( isspace( (int)*ch ) ) {
- sch = *string;
- while ( isspace( (int)sch ) ) {
- if (*string == '\0') {
- goto done;
- }
- string++;
- sch = *string;
- }
- continue;
- }
-
- if (*ch != '%') {
- literal:
- if (*string == '\0') {
- underflow = 1;
- goto done;
- }
- sch = *string;
- string++;
- if (*ch != sch) {
- goto done;
- }
- continue;
- }
-
- ch = format++;
- if (*ch == '%') {
- goto literal;
- }
-
- /*
- * Check for assignment suppression ('*') or an XPG3-style
- * assignment ('%n$').
- */
-
- if (*ch == '*') {
- flags |= SCAN_SUPPRESS;
- ch = format++;
- } else if ( isdigit(UCHAR(*ch))) {
- value = strtoul(format-1, &end, 10);
- if (*end == '$') {
- format = end+1;
- ch = format++;
- objIndex = varStart + value;
- }
- }
-
- /*
- * Parse any width specifier.
- */
-
- if ( isdigit(UCHAR(*ch))) {
- width = strtoul(format-1, &format, 10);
- ch = format++;
- } else {
- width = 0;
- }
-
- /*
- * Ignore size specifier.
- */
-
- if ((*ch == 'l') || (*ch == 'L') || (*ch == 'h')) {
- ch = format++;
- }
-
- /*
- * Handle the various field types.
- */
-
- switch (*ch) {
- case 'n':
- if (!(flags & SCAN_SUPPRESS)) {
- if (numVars) {
- zend_uint refcount;
-
- current = args[objIndex++];
- refcount = (*current)->refcount;
- zval_dtor( *current );
- ZVAL_LONG( *current, (long)(string - baseString) );
- (*current)->refcount = refcount;
- (*current)->is_ref = 1;
- } else {
- add_index_long(*return_value, objIndex++, string - baseString);
- }
- }
- nconversions++;
- continue;
-
- case 'd':
- case 'D':
- op = 'i';
- base = 10;
- fn = (long (*)())strtol;
- break;
- case 'i':
- op = 'i';
- base = 0;
- fn = (long (*)())strtol;
- break;
- case 'o':
- op = 'i';
- base = 8;
- fn = (long (*)())strtol;
- break;
- case 'x':
- op = 'i';
- base = 16;
- fn = (long (*)())strtol;
- break;
- case 'u':
- op = 'i';
- base = 10;
- flags |= SCAN_UNSIGNED;
- fn = (long (*)())strtoul;
- break;
-
- case 'f':
- case 'e':
- case 'E':
- case 'g':
- op = 'f';
- break;
-
- case 's':
- op = 's';
- break;
-
- case 'c':
- op = 's';
- flags |= SCAN_NOSKIP;
- /*-cc-*/
- if (0 == width) {
- width = 1;
- }
- /*-cc-*/
- break;
- case '[':
- op = '[';
- flags |= SCAN_NOSKIP;
- break;
- } /* switch */
-
- /*
- * At this point, we will need additional characters from the
- * string to proceed.
- */
-
- if (*string == '\0') {
- underflow = 1;
- goto done;
- }
-
- /*
- * Skip any leading whitespace at the beginning of a field unless
- * the format suppresses this behavior.
- */
-
- if (!(flags & SCAN_NOSKIP)) {
- while (*string != '\0') {
- sch = *string;
- if (! isspace((int)sch) ) {
- break;
- }
- string++;
- }
- if (*string == '\0') {
- underflow = 1;
- goto done;
- }
- }
-
- /*
- * Perform the requested scanning operation.
- */
-
- switch (op) {
- case 'c':
- case 's':
- /*
- * Scan a string up to width characters or whitespace.
- */
-
- if (width == 0) {
- width = (size_t) ~0;
- }
- end = string;
- while (*end != '\0') {
- sch = *end;
- if ( isspace( (int)sch ) ) {
- break;
- }
- end++;
- if (--width == 0) {
- break;
- }
- }
- if (!(flags & SCAN_SUPPRESS)) {
- if (numVars) {
- zend_uint refcount;
-
- current = args[objIndex++];
- refcount = (*current)->refcount;
- zval_dtor( *current );
- ZVAL_STRINGL( *current, string, end-string, 1);
- (*current)->refcount = refcount;
- (*current)->is_ref = 1;
- } else {
- add_index_stringl( *return_value, objIndex++, string, end-string, 1);
- }
- }
- string = end;
- break;
-
- case '[': {
- CharSet cset;
-
- if (width == 0) {
- width = (size_t) ~0;
- }
- end = string;
-
- format = BuildCharSet(&cset, format);
- while (*end != '\0') {
- sch = *end;
- if (!CharInSet(&cset, (int)sch)) {
- break;
- }
- end++;
- if (--width == 0) {
- break;
- }
- }
- ReleaseCharSet(&cset);
-
- if (string == end) {
- /*
- * Nothing matched the range, stop processing
- */
- goto done;
- }
- if (!(flags & SCAN_SUPPRESS)) {
- if (numVars) {
- current = args[objIndex++];
- convert_to_string( *current );
- ZVAL_STRINGL( *current, string, end-string, 1);
- } else {
- add_index_stringl(*return_value, objIndex++, string, end-string, 1);
- }
- }
- string = end;
-
- break;
- }
- /*
- case 'c':
- / Scan a single character./
-
- sch = *string;
- string++;
- if (!(flags & SCAN_SUPPRESS)) {
- if (numVars) {
- char __buf[2];
- __buf[0] = sch;
- __buf[1] = '\0';;
- current = args[objIndex++];
- convert_to_string_ex( current );
- ZVAL_STRINGL( *current, __buf, 1, 1);
- } else {
- add_index_stringl(*return_value, objIndex++, &sch, 1, 1);
- }
- }
- break;
- */
- case 'i':
- /*
- * Scan an unsigned or signed integer.
- */
-
- /*-cc-*/
- buf[0] = '\0';
- /*-cc-*/
- if ((width == 0) || (width > sizeof(buf) - 1)) {
- width = sizeof(buf) - 1;
- }
-
- flags |= SCAN_SIGNOK | SCAN_NODIGITS | SCAN_NOZERO;
- for (end = buf; width > 0; width--) {
- switch (*string) {
- /*
- * The 0 digit has special meaning at the beginning of
- * a number. If we are unsure of the base, it
- * indicates that we are in base 8 or base 16 (if it is
- * followed by an 'x').
- */
- case '0':
- /*-cc-*/
- if (base == 16) {
- flags |= SCAN_XOK;
- }
- /*-cc-*/
- if (base == 0) {
- base = 8;
- flags |= SCAN_XOK;
- }
- if (flags & SCAN_NOZERO) {
- flags &= ~(SCAN_SIGNOK | SCAN_NODIGITS | SCAN_NOZERO);
- } else {
- flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS);
- }
- goto addToInt;
-
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7':
- if (base == 0) {
- base = 10;
- }
- flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS);
- goto addToInt;
-
- case '8': case '9':
- if (base == 0) {
- base = 10;
- }
- if (base <= 8) {
- break;
- }
- flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS);
- goto addToInt;
-
- case 'A': case 'B': case 'C':
- case 'D': case 'E': case 'F':
- case 'a': case 'b': case 'c':
- case 'd': case 'e': case 'f':
- if (base <= 10) {
- break;
- }
- flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS);
- goto addToInt;
-
- case '+': case '-':
- if (flags & SCAN_SIGNOK) {
- flags &= ~SCAN_SIGNOK;
- goto addToInt;
- }
- break;
-
- case 'x': case 'X':
- if ((flags & SCAN_XOK) && (end == buf+1)) {
- base = 16;
- flags &= ~SCAN_XOK;
- goto addToInt;
- }
- break;
- }
-
- /*
- * We got an illegal character so we are done accumulating.
- */
-
- break;
-
- addToInt:
- /*
- * Add the character to the temporary buffer.
- */
- *end++ = *string++;
- if (*string == '\0') {
- break;
- }
- }
-
- /*
- * Check to see if we need to back up because we only got a
- * sign or a trailing x after a 0.
- */
-
- if (flags & SCAN_NODIGITS) {
- if (*string == '\0') {
- underflow = 1;
- }
- goto done;
- } else if (end[-1] == 'x' || end[-1] == 'X') {
- end--;
- string--;
- }
-
-
- /*
- * Scan the value from the temporary buffer. If we are
- * returning a large unsigned value, we have to convert it back
- * to a string since PHP only supports signed values.
- */
-
- if (!(flags & SCAN_SUPPRESS)) {
- *end = '\0';
- value = (int) (*fn)(buf, NULL, base);
- if ((flags & SCAN_UNSIGNED) && (value < 0)) {
- sprintf(buf, "%u", value); /* INTL: ISO digit */
- if (numVars) {
- /* change passed value type to string */
- current = args[objIndex++];
- convert_to_string( *current );
- ZVAL_STRING( *current, buf, 1 );
- } else {
- add_index_string(*return_value, objIndex++, buf, 1);
- }
- } else {
- if (numVars) {
- current = args[objIndex++];
- convert_to_long( *current );
- Z_LVAL(**current) = value;
- } else {
- add_index_long(*return_value, objIndex++, value);
- }
- }
- }
-
- break;
-
- case 'f':
- /*
- * Scan a floating point number
- */
- buf[0] = '\0'; /* call me pedantic */
- if ((width == 0) || (width > sizeof(buf) - 1)) {
- width = sizeof(buf) - 1;
- }
- flags |= SCAN_SIGNOK | SCAN_NODIGITS | SCAN_PTOK | SCAN_EXPOK;
- for (end = buf; width > 0; width--) {
- switch (*string) {
- case '0': case '1': case '2': case '3':
- case '4': case '5': case '6': case '7':
- case '8': case '9':
- flags &= ~(SCAN_SIGNOK | SCAN_NODIGITS);
- goto addToFloat;
- case '+': case '-':
- if (flags & SCAN_SIGNOK) {
- flags &= ~SCAN_SIGNOK;
- goto addToFloat;
- }
- break;
- case '.':
- if (flags & SCAN_PTOK) {
- flags &= ~(SCAN_SIGNOK | SCAN_PTOK);
- goto addToFloat;
- }
- break;
- case 'e': case 'E':
- /*
- * An exponent is not allowed until there has
- * been at least one digit.
- */
-
- if ((flags & (SCAN_NODIGITS | SCAN_EXPOK)) == SCAN_EXPOK) {
- flags = (flags & ~(SCAN_EXPOK|SCAN_PTOK))
- | SCAN_SIGNOK | SCAN_NODIGITS;
- goto addToFloat;
- }
- break;
- }
-
- /*
- * We got an illegal character so we are done accumulating.
- */
-
- break;
-
- addToFloat:
- /*
- * Add the character to the temporary buffer.
- */
-
- *end++ = *string++;
- if (*string == '\0') {
- break;
- }
- }
-
- /*
- * Check to see if we need to back up because we saw a
- * trailing 'e' or sign.
- */
-
- if (flags & SCAN_NODIGITS) {
- if (flags & SCAN_EXPOK) {
- /*
- * There were no digits at all so scanning has
- * failed and we are done.
- */
- if (*string == '\0') {
- underflow = 1;
- }
- goto done;
- }
-
- /*
- * We got a bad exponent ('e' and maybe a sign).
- */
-
- end--;
- string--;
- if (*end != 'e' && *end != 'E') {
- end--;
- string--;
- }
- }
-
- /*
- * Scan the value from the temporary buffer.
- */
-
- if (!(flags & SCAN_SUPPRESS)) {
- double dvalue;
- *end = '\0';
- dvalue = strtod(buf, NULL);
- if (numVars) {
- current = args[objIndex++];
- convert_to_double( *current );
- Z_DVAL_PP( current ) = dvalue;
- } else {
- add_index_double( *return_value, objIndex++, dvalue );
- }
- }
- break;
- } /* switch (op) */
- nconversions++;
- } /* while (*format != '\0') */
-
-done:
- result = SCAN_SUCCESS;
-
- if (underflow && (0==nconversions)) {
- scan_set_error_return( numVars, return_value );
- result = SCAN_ERROR_EOF;
- } else if (numVars) {
- convert_to_long( *return_value );
- Z_LVAL_PP(return_value) = nconversions;
- } else if (nconversions < totalVars) {
- /* to do : not all elements converted. we need to prune the list - cc
- */
- }
-
- return result;
-}
-/* }}} */
-
-/* the compiler choked when i tried to make this a macro */
-static inline void scan_set_error_return(int numVars, pval **return_value)
-{
- if (numVars) {
- Z_TYPE_PP(return_value) = IS_LONG;
- Z_LVAL_PP(return_value) = SCAN_ERROR_EOF; /* EOF marker */
- } else {
- /* pval_destructor( *return_value ); */
- /* convert_to_null calls destructor */
- convert_to_null( *return_value );
- }
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h
deleted file mode 100644
index c18a961602..0000000000
--- a/ext/standard/scanf.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Clayton Collie <clcollie@mindspring.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef SCANF_H
-#define SCANF_H
-
-
-#define SCAN_MAX_ARGS 0xFF /* Maximum number of variable which can be */
- /* passed to (f|s)scanf. This is an artifical */
- /* upper limit to keep resources in check and */
- /* minimize the possibility of exploits */
-
-#define SCAN_SUCCESS SUCCESS
-#define SCAN_ERROR_EOF -1 /* indicates premature termination of scan */
- /* can be caused by bad parameters or format*/
- /* string. */
-#define SCAN_ERROR_INVALID_FORMAT (SCAN_ERROR_EOF - 1)
-#define SCAN_ERROR_VAR_PASSED_BYVAL (SCAN_ERROR_INVALID_FORMAT - 1)
-#define SCAN_ERROR_WRONG_PARAM_COUNT (SCAN_ERROR_VAR_PASSED_BYVAL - 1)
-#define SCAN_ERROR_INTERNAL (SCAN_ERROR_WRONG_PARAM_COUNT - 1)
-
-
-/*
- * The following are here solely for the benefit of the scanf type functions
- * e.g. fscanf
- */
-PHPAPI int ValidateFormat(char *format, int numVars, int *totalVars);
-PHPAPI int php_sscanf_internal(char *string,char *format,int argCount,zval ***args,
- int varStart, pval **return_value TSRMLS_DC);
-
-
-#endif /* SCANF_H */
diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c
deleted file mode 100644
index 38027f247f..0000000000
--- a/ext/standard/sha1.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stefan Esser <sesser@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <stdio.h>
-#include "php.h"
-
-/* This code is heavily based on the PHP md5 implementation */
-
-#include "sha1.h"
-
-PHPAPI void make_sha1_digest(char *sha1str, unsigned char *digest)
-{
- int i;
-
- for (i = 0; i < 20; i++) {
- sprintf(sha1str, "%02x", digest[i]);
- sha1str += 2;
- }
-
- *sha1str = '\0';
-}
-
-/* {{{ proto string sha1(string str [, bool raw_output])
- Calculate the sha1 hash of a string */
-PHP_FUNCTION(sha1)
-{
- char *arg;
- int arg_len;
- zend_bool raw_output = 0;
- char sha1str[41];
- PHP_SHA1_CTX context;
- unsigned char digest[20];
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
-
- sha1str[0] = '\0';
- PHP_SHA1Init(&context);
- PHP_SHA1Update(&context, arg, arg_len);
- PHP_SHA1Final(digest, &context);
- if (raw_output) {
- RETURN_STRINGL(digest, 20, 1);
- } else {
- make_sha1_digest(sha1str, digest);
- RETVAL_STRING(sha1str, 1);
- }
-
-}
-
-/* }}} */
-
-/* {{{ proto string sha1_file(string filename [, bool raw_output])
- Calculate the sha1 hash of given filename */
-PHP_FUNCTION(sha1_file)
-{
- char *arg;
- int arg_len;
- zend_bool raw_output = 0;
- char sha1str[41];
- unsigned char buf[1024];
- unsigned char digest[20];
- PHP_SHA1_CTX context;
- int n;
- FILE *fp;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
-
- if (PG(safe_mode) && (!php_checkuid(arg, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(arg TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if ((fp = VCWD_FOPEN(arg, "rb")) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open file");
- RETURN_FALSE;
- }
-
- PHP_SHA1Init(&context);
-
- while ((n = fread(buf, 1, sizeof(buf), fp)) > 0) {
- PHP_SHA1Update(&context, buf, n);
- }
-
- PHP_SHA1Final(digest, &context);
-
- if (ferror(fp)) {
- fclose(fp);
- RETURN_FALSE;
- }
-
- fclose(fp);
-
- if (raw_output) {
- RETURN_STRINGL(digest, 20, 1);
- } else {
- make_sha1_digest(sha1str, digest);
- RETVAL_STRING(sha1str, 1);
- }
-}
-/* }}} */
-
-
-static void SHA1Transform(php_uint32[5], const unsigned char[64]);
-static void SHA1Encode(unsigned char *, php_uint32 *, unsigned int);
-static void SHA1Decode(php_uint32 *, const unsigned char *, unsigned int);
-
-static unsigned char PADDING[64] =
-{
- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/* F, G, H and I are basic SHA1 functions.
- */
-#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
-#define G(x, y, z) ((x) ^ (y) ^ (z))
-#define H(x, y, z) (((x) & (y)) | ((z) & ((x) | (y))))
-#define I(x, y, z) ((x) ^ (y) ^ (z))
-
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* W[i]
- */
-#define W(i) ( tmp=x[(i-3)&15]^x[(i-8)&15]^x[(i-14)&15]^x[i&15], \
- (x[i&15]=ROTATE_LEFT(tmp, 1)) )
-
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
- */
-#define FF(a, b, c, d, e, w) { \
- (e) += F ((b), (c), (d)) + (w) + (php_uint32)(0x5A827999); \
- (e) += ROTATE_LEFT ((a), 5); \
- (b) = ROTATE_LEFT((b), 30); \
- }
-#define GG(a, b, c, d, e, w) { \
- (e) += G ((b), (c), (d)) + (w) + (php_uint32)(0x6ED9EBA1); \
- (e) += ROTATE_LEFT ((a), 5); \
- (b) = ROTATE_LEFT((b), 30); \
- }
-#define HH(a, b, c, d, e, w) { \
- (e) += H ((b), (c), (d)) + (w) + (php_uint32)(0x8F1BBCDC); \
- (e) += ROTATE_LEFT ((a), 5); \
- (b) = ROTATE_LEFT((b), 30); \
- }
-#define II(a, b, c, d, e, w) { \
- (e) += I ((b), (c), (d)) + (w) + (php_uint32)(0xCA62C1D6); \
- (e) += ROTATE_LEFT ((a), 5); \
- (b) = ROTATE_LEFT((b), 30); \
- }
-
-
-/* {{{ PHP_SHA1Init
- * SHA1 initialization. Begins an SHA1 operation, writing a new context.
- */
-PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX * context)
-{
- context->count[0] = context->count[1] = 0;
- /* Load magic initialization constants.
- */
- context->state[0] = 0x67452301;
- context->state[1] = 0xefcdab89;
- context->state[2] = 0x98badcfe;
- context->state[3] = 0x10325476;
- context->state[4] = 0xc3d2e1f0;
-}
-/* }}} */
-
-/* {{{ PHP_SHA1Update
- SHA1 block update operation. Continues an SHA1 message-digest
- operation, processing another message block, and updating the
- context.
- */
-PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX * context, const unsigned char *input,
- unsigned int inputLen)
-{
- unsigned int i, index, partLen;
-
- /* Compute number of bytes mod 64 */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
-
- /* Update number of bits */
- if ((context->count[0] += ((php_uint32) inputLen << 3))
- < ((php_uint32) inputLen << 3))
- context->count[1]++;
- context->count[1] += ((php_uint32) inputLen >> 29);
-
- partLen = 64 - index;
-
- /* Transform as many times as possible.
- */
- if (inputLen >= partLen) {
- memcpy
- ((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
- SHA1Transform(context->state, context->buffer);
-
- for (i = partLen; i + 63 < inputLen; i += 64)
- SHA1Transform(context->state, &input[i]);
-
- index = 0;
- } else
- i = 0;
-
- /* Buffer remaining input */
- memcpy
- ((unsigned char*) & context->buffer[index], (unsigned char*) & input[i],
- inputLen - i);
-}
-/* }}} */
-
-/* {{{ PHP_SHA1Final
- SHA1 finalization. Ends an SHA1 message-digest operation, writing the
- the message digest and zeroizing the context.
- */
-PHPAPI void PHP_SHA1Final(unsigned char digest[20], PHP_SHA1_CTX * context)
-{
- unsigned char bits[8];
- unsigned int index, padLen;
-
- /* Save number of bits */
- bits[7] = context->count[0] & 0xFF;
- bits[6] = (context->count[0] >> 8) & 0xFF;
- bits[5] = (context->count[0] >> 16) & 0xFF;
- bits[4] = (context->count[0] >> 24) & 0xFF;
- bits[3] = context->count[1] & 0xFF;
- bits[2] = (context->count[1] >> 8) & 0xFF;
- bits[1] = (context->count[1] >> 16) & 0xFF;
- bits[0] = (context->count[1] >> 24) & 0xFF;
-
- /* Pad out to 56 mod 64.
- */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
- padLen = (index < 56) ? (56 - index) : (120 - index);
- PHP_SHA1Update(context, PADDING, padLen);
-
- /* Append length (before padding) */
- PHP_SHA1Update(context, bits, 8);
-
- /* Store state in digest */
- SHA1Encode(digest, context->state, 20);
-
- /* Zeroize sensitive information.
- */
- memset((unsigned char*) context, 0, sizeof(*context));
-}
-/* }}} */
-
-/* {{{ SHA1Transform
- * SHA1 basic transformation. Transforms state based on block.
- */
-static void SHA1Transform(state, block)
-php_uint32 state[5];
-const unsigned char block[64];
-{
- php_uint32 a = state[0], b = state[1], c = state[2];
- php_uint32 d = state[3], e = state[4], x[16], tmp;
-
- SHA1Decode(x, block, 64);
-
- /* Round 1 */
- FF(a, b, c, d, e, x[0]); /* 1 */
- FF(e, a, b, c, d, x[1]); /* 2 */
- FF(d, e, a, b, c, x[2]); /* 3 */
- FF(c, d, e, a, b, x[3]); /* 4 */
- FF(b, c, d, e, a, x[4]); /* 5 */
- FF(a, b, c, d, e, x[5]); /* 6 */
- FF(e, a, b, c, d, x[6]); /* 7 */
- FF(d, e, a, b, c, x[7]); /* 8 */
- FF(c, d, e, a, b, x[8]); /* 9 */
- FF(b, c, d, e, a, x[9]); /* 10 */
- FF(a, b, c, d, e, x[10]); /* 11 */
- FF(e, a, b, c, d, x[11]); /* 12 */
- FF(d, e, a, b, c, x[12]); /* 13 */
- FF(c, d, e, a, b, x[13]); /* 14 */
- FF(b, c, d, e, a, x[14]); /* 15 */
- FF(a, b, c, d, e, x[15]); /* 16 */
- FF(e, a, b, c, d, W(16)); /* 17 */
- FF(d, e, a, b, c, W(17)); /* 18 */
- FF(c, d, e, a, b, W(18)); /* 19 */
- FF(b, c, d, e, a, W(19)); /* 20 */
-
- /* Round 2 */
- GG(a, b, c, d, e, W(20)); /* 21 */
- GG(e, a, b, c, d, W(21)); /* 22 */
- GG(d, e, a, b, c, W(22)); /* 23 */
- GG(c, d, e, a, b, W(23)); /* 24 */
- GG(b, c, d, e, a, W(24)); /* 25 */
- GG(a, b, c, d, e, W(25)); /* 26 */
- GG(e, a, b, c, d, W(26)); /* 27 */
- GG(d, e, a, b, c, W(27)); /* 28 */
- GG(c, d, e, a, b, W(28)); /* 29 */
- GG(b, c, d, e, a, W(29)); /* 30 */
- GG(a, b, c, d, e, W(30)); /* 31 */
- GG(e, a, b, c, d, W(31)); /* 32 */
- GG(d, e, a, b, c, W(32)); /* 33 */
- GG(c, d, e, a, b, W(33)); /* 34 */
- GG(b, c, d, e, a, W(34)); /* 35 */
- GG(a, b, c, d, e, W(35)); /* 36 */
- GG(e, a, b, c, d, W(36)); /* 37 */
- GG(d, e, a, b, c, W(37)); /* 38 */
- GG(c, d, e, a, b, W(38)); /* 39 */
- GG(b, c, d, e, a, W(39)); /* 40 */
-
- /* Round 3 */
- HH(a, b, c, d, e, W(40)); /* 41 */
- HH(e, a, b, c, d, W(41)); /* 42 */
- HH(d, e, a, b, c, W(42)); /* 43 */
- HH(c, d, e, a, b, W(43)); /* 44 */
- HH(b, c, d, e, a, W(44)); /* 45 */
- HH(a, b, c, d, e, W(45)); /* 46 */
- HH(e, a, b, c, d, W(46)); /* 47 */
- HH(d, e, a, b, c, W(47)); /* 48 */
- HH(c, d, e, a, b, W(48)); /* 49 */
- HH(b, c, d, e, a, W(49)); /* 50 */
- HH(a, b, c, d, e, W(50)); /* 51 */
- HH(e, a, b, c, d, W(51)); /* 52 */
- HH(d, e, a, b, c, W(52)); /* 53 */
- HH(c, d, e, a, b, W(53)); /* 54 */
- HH(b, c, d, e, a, W(54)); /* 55 */
- HH(a, b, c, d, e, W(55)); /* 56 */
- HH(e, a, b, c, d, W(56)); /* 57 */
- HH(d, e, a, b, c, W(57)); /* 58 */
- HH(c, d, e, a, b, W(58)); /* 59 */
- HH(b, c, d, e, a, W(59)); /* 60 */
-
- /* Round 4 */
- II(a, b, c, d, e, W(60)); /* 61 */
- II(e, a, b, c, d, W(61)); /* 62 */
- II(d, e, a, b, c, W(62)); /* 63 */
- II(c, d, e, a, b, W(63)); /* 64 */
- II(b, c, d, e, a, W(64)); /* 65 */
- II(a, b, c, d, e, W(65)); /* 66 */
- II(e, a, b, c, d, W(66)); /* 67 */
- II(d, e, a, b, c, W(67)); /* 68 */
- II(c, d, e, a, b, W(68)); /* 69 */
- II(b, c, d, e, a, W(69)); /* 70 */
- II(a, b, c, d, e, W(70)); /* 71 */
- II(e, a, b, c, d, W(71)); /* 72 */
- II(d, e, a, b, c, W(72)); /* 73 */
- II(c, d, e, a, b, W(73)); /* 74 */
- II(b, c, d, e, a, W(74)); /* 75 */
- II(a, b, c, d, e, W(75)); /* 76 */
- II(e, a, b, c, d, W(76)); /* 77 */
- II(d, e, a, b, c, W(77)); /* 78 */
- II(c, d, e, a, b, W(78)); /* 79 */
- II(b, c, d, e, a, W(79)); /* 80 */
-
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
- state[4] += e;
-
- /* Zeroize sensitive information. */
- memset((unsigned char*) x, 0, sizeof(x));
-}
-/* }}} */
-
-/* {{{ SHA1Encode
- Encodes input (php_uint32) into output (unsigned char). Assumes len is
- a multiple of 4.
- */
-static void SHA1Encode(output, input, len)
-unsigned char *output;
-php_uint32 *input;
-unsigned int len;
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4) {
- output[j] = (unsigned char) ((input[i] >> 24) & 0xff);
- output[j + 1] = (unsigned char) ((input[i] >> 16) & 0xff);
- output[j + 2] = (unsigned char) ((input[i] >> 8) & 0xff);
- output[j + 3] = (unsigned char) (input[i] & 0xff);
- }
-}
-/* }}} */
-
-/* {{{ SHA1Decode
- Decodes input (unsigned char) into output (php_uint32). Assumes len is
- a multiple of 4.
- */
-static void SHA1Decode(output, input, len)
-php_uint32 *output;
-const unsigned char *input;
-unsigned int len;
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4)
- output[i] = ((php_uint32) input[j + 3]) | (((php_uint32) input[j + 2]) << 8) |
- (((php_uint32) input[j + 1]) << 16) | (((php_uint32) input[j]) << 24);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/sha1.h b/ext/standard/sha1.h
deleted file mode 100644
index 73711bb7c8..0000000000
--- a/ext/standard/sha1.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stefan Esser <sesser@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef SHA1_H
-#define SHA1_H
-
-#include "ext/standard/basic_functions.h"
-
-/* SHA1 context. */
-typedef struct {
- php_uint32 state[5]; /* state (ABCD) */
- php_uint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */
- unsigned char buffer[64]; /* input buffer */
-} PHP_SHA1_CTX;
-
-PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX *);
-PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX *, const unsigned char *, unsigned int);
-PHPAPI void PHP_SHA1Final(unsigned char[20], PHP_SHA1_CTX *);
-
-PHP_FUNCTION(sha1);
-PHP_FUNCTION(sha1_file);
-
-#endif
diff --git a/ext/standard/soundex.c b/ext/standard/soundex.c
deleted file mode 100644
index 7dc86b066f..0000000000
--- a/ext/standard/soundex.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Bjørn Borud - Guardian Networks AS <borud@guardian.no> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include "php_string.h"
-
-/* Simple soundex algorithm as described by Knuth in TAOCP, vol 3 */
-/* {{{ proto string soundex(string str)
- Calculate the soundex key of a string */
-PHP_FUNCTION(soundex)
-{
- char *str;
- int i, _small, str_len, code, last;
- char soundex[4 + 1];
-
- static char soundex_table[26] =
- {0, /* A */
- '1', /* B */
- '2', /* C */
- '3', /* D */
- 0, /* E */
- '1', /* F */
- '2', /* G */
- 0, /* H */
- 0, /* I */
- '2', /* J */
- '2', /* K */
- '4', /* L */
- '5', /* M */
- '5', /* N */
- 0, /* O */
- '1', /* P */
- '2', /* Q */
- '6', /* R */
- '2', /* S */
- '3', /* T */
- 0, /* U */
- '1', /* V */
- 0, /* W */
- '2', /* X */
- 0, /* Y */
- '2'}; /* Z */
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
- return;
- }
- if (str_len == 0) {
- RETURN_FALSE;
- }
-
- /* build soundex string */
- last = -1;
- for (i = 0, _small = 0; i < str_len && _small < 4; i++) {
- /* convert chars to upper case and strip non-letter chars */
- /* BUG: should also map here accented letters used in non */
- /* English words or names (also found in English text!): */
- /* esstsett, thorn, n-tilde, c-cedilla, s-caron, ... */
- code = toupper(str[i]);
- if (code >= 'A' && code <= 'Z') {
- if (_small == 0) {
- /* remember first valid char */
- soundex[_small++] = code;
- last = soundex_table[code - 'A'];
- }
- else {
- /* ignore sequences of consonants with same soundex */
- /* code in trail, and vowels unless they separate */
- /* consonant letters */
- code = soundex_table[code - 'A'];
- if (code != last) {
- if (code != 0) {
- soundex[_small++] = code;
- }
- last = code;
- }
- }
- }
- }
- /* pad with '0' and terminate with 0 ;-) */
- while (_small < 4) {
- soundex[_small++] = '0';
- }
- soundex[_small] = '\0';
-
- RETURN_STRINGL(soundex, _small, 1);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
deleted file mode 100644
index ee57d0da86..0000000000
--- a/ext/standard/streamsfuncs.c
+++ /dev/null
@@ -1,1025 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <wez@thebrainroom.com> |
- | Sara Golemon <pollita@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/flock_compat.h"
-#include "ext/standard/file.h"
-#include "ext/standard/php_filestat.h"
-#include "php_open_temporary_file.h"
-#include "ext/standard/basic_functions.h"
-#include "php_ini.h"
-#include "streamsfuncs.h"
-#include "php_network.h"
-#include "php_string.h"
-
-#ifndef PHP_WIN32
-#define php_select(m, r, w, e, t) select(m, r, w, e, t)
-#else
-#include "win32/select.h"
-#endif
-
-static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC);
-
-/* Streams based network functions */
-
-/* {{{ proto resource stream_socket_client(string remoteaddress [, long &errcode, string &errstring, double timeout, long flags, resource context])
- Open a client connection to a remote address */
-PHP_FUNCTION(stream_socket_client)
-{
- char *host;
- long host_len;
- zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL;
- double timeout = FG(default_socket_timeout);
- unsigned long conv;
- struct timeval tv;
- char *hashkey = NULL;
- php_stream *stream = NULL;
- int err;
- long flags = 0;
- char *errstr = NULL;
- php_stream_context *context = NULL;
-
- RETVAL_FALSE;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zzd!lr", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (zcontext) {
- context = decode_context_param(zcontext TSRMLS_CC);
- }
-
- if (flags & PHP_STREAM_CLIENT_PERSISTENT) {
- spprintf(&hashkey, 0, "stream_socket_client__%s", host);
- }
-
- /* prepare the timeout value for use */
- conv = (unsigned long) (timeout * 1000000.0);
- tv.tv_sec = conv / 1000000;
- tv.tv_usec = conv % 1000000;
-
- if (zerrno) {
- zval_dtor(zerrno);
- ZVAL_LONG(zerrno, 0);
- }
- if (zerrstr) {
- zval_dtor(zerrstr);
- ZVAL_STRING(zerrstr, "", 1);
- }
-
- stream = php_stream_xport_create(host, host_len, ENFORCE_SAFE_MODE | REPORT_ERRORS,
- STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT |
- (flags & PHP_STREAM_CLIENT_ASYNC_CONNECT ? STREAM_XPORT_CONNECT_ASYNC : 0),
- hashkey, &tv, context, &errstr, &err);
-
- if (stream == NULL) {
- /* host might contain binary characters */
- char *quoted_host = php_addslashes(host, host_len, NULL, 0 TSRMLS_CC);
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s (%s)", quoted_host, errstr == NULL ? "Unknown error" : errstr);
- efree(quoted_host);
- }
-
- if (hashkey) {
- efree(hashkey);
- }
-
- if (stream == NULL) {
- if (zerrno) {
- zval_dtor(zerrno);
- ZVAL_LONG(zerrno, err);
- }
- if (zerrstr && errstr) {
- /* no need to dup; we need to efree buf anyway */
- zval_dtor(zerrstr);
- ZVAL_STRING(zerrstr, errstr, 0);
- } else if (errstr) {
- efree(errstr);
- }
- RETURN_FALSE;
- }
-
- if (errstr) {
- efree(errstr);
- }
-
- php_stream_to_zval(stream, return_value);
-}
-/* }}} */
-
-/* {{{ proto resource stream_socket_server(string localaddress [, long &errcode, string &errstring, long flags, resource context])
- Create a server socket bound to localaddress */
-PHP_FUNCTION(stream_socket_server)
-{
- char *host;
- long host_len;
- zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL;
- php_stream *stream = NULL;
- int err;
- long flags = STREAM_XPORT_BIND | STREAM_XPORT_LISTEN;
- char *errstr = NULL;
- php_stream_context *context = NULL;
-
- RETVAL_FALSE;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zzlr", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (zcontext) {
- context = decode_context_param(zcontext TSRMLS_CC);
- }
-
- if (zerrno) {
- zval_dtor(zerrno);
- ZVAL_LONG(zerrno, 0);
- }
- if (zerrstr) {
- zval_dtor(zerrstr);
- ZVAL_STRING(zerrstr, "", 1);
- }
-
- stream = php_stream_xport_create(host, host_len, ENFORCE_SAFE_MODE | REPORT_ERRORS,
- STREAM_XPORT_SERVER | flags,
- NULL, NULL, context, &errstr, &err);
-
- if (stream == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s (%s)", host, errstr == NULL ? "Unknown error" : errstr);
- }
-
- if (stream == NULL) {
- if (zerrno) {
- zval_dtor(zerrno);
- ZVAL_LONG(zerrno, err);
- }
- if (zerrstr && errstr) {
- /* no need to dup; we need to efree buf anyway */
- zval_dtor(zerrstr);
- ZVAL_STRING(zerrstr, errstr, 0);
- }
- RETURN_FALSE;
- }
-
- if (errstr) {
- efree(errstr);
- }
-
- php_stream_to_zval(stream, return_value);
-
-}
-/* }}} */
-
-/* {{{ proto resource stream_socket_accept(resource serverstream, [ double timeout, string &peername ])
- Accept a client connection from a server socket */
-PHP_FUNCTION(stream_socket_accept)
-{
- double timeout = FG(default_socket_timeout);
- zval *peername = NULL;
- unsigned long conv;
- struct timeval tv;
- php_stream *stream = NULL, *clistream = NULL;
- zval *zstream;
-
- char *errstr = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|dz", &zstream, &timeout, &peername) == FAILURE) {
- RETURN_FALSE;
- }
-
- php_stream_from_zval(stream, &zstream);
-
- /* prepare the timeout value for use */
- conv = (unsigned long) (timeout * 1000000.0);
- tv.tv_sec = conv / 1000000;
- tv.tv_usec = conv % 1000000;
-
- if (peername) {
- zval_dtor(peername);
- ZVAL_STRING(peername, "", 1);
- }
-
- if (0 == php_stream_xport_accept(stream, &clistream,
- peername ? &Z_STRVAL_P(peername) : NULL,
- peername ? &Z_STRLEN_P(peername) : NULL,
- NULL, NULL,
- &tv, &errstr
- TSRMLS_CC) && clistream) {
-
- php_stream_to_zval(clistream, return_value);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "accept failed: %s", errstr ? errstr : "Unknown error");
-
- RETVAL_FALSE;
- }
-
- if (errstr) {
- efree(errstr);
- }
-}
-/* }}} */
-
-/* {{{ proto string stream_socket_get_name(resource stream, bool want_peer)
- Returns either the locally bound or remote name for a socket stream */
-PHP_FUNCTION(stream_socket_get_name)
-{
- php_stream *stream;
- zval *zstream;
- zend_bool want_peer;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &zstream, &want_peer) == FAILURE) {
- RETURN_FALSE;
- }
-
- php_stream_from_zval(stream, &zstream);
-
- Z_TYPE_P(return_value) = IS_STRING;
-
- if (0 != php_stream_xport_get_name(stream, want_peer,
- &Z_STRVAL_P(return_value),
- &Z_STRLEN_P(return_value),
- NULL, NULL
- TSRMLS_CC)) {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto long stream_copy_to_stream(resource source, resource dest [, long maxlen ])
- Reads up to maxlen bytes from source stream and writes them to dest stream. */
-PHP_FUNCTION(stream_copy_to_stream)
-{
- php_stream *src, *dest;
- zval *zsrc, *zdest;
- long maxlen = PHP_STREAM_COPY_ALL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &zsrc, &zdest, &maxlen) == FAILURE) {
- RETURN_FALSE;
- }
-
- php_stream_from_zval(src, &zsrc);
- php_stream_from_zval(dest, &zdest);
-
- RETURN_LONG(php_stream_copy_to_stream(src, dest, maxlen));
-}
-/* }}} */
-
-/* {{{ proto resource stream_get_meta_data(resource fp)
- Retrieves header/meta data from streams/file pointers */
-PHP_FUNCTION(stream_get_meta_data)
-{
- zval **arg1;
- php_stream *stream;
- zval *newval;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- php_stream_from_zval(stream, arg1);
-
- array_init(return_value);
-
- if (stream->wrapperdata) {
- MAKE_STD_ZVAL(newval);
- *newval = *(stream->wrapperdata);
- zval_copy_ctor(newval);
-
- add_assoc_zval(return_value, "wrapper_data", newval);
- }
- if (stream->wrapper) {
- add_assoc_string(return_value, "wrapper_type", (char *)stream->wrapper->wops->label, 1);
- }
- add_assoc_string(return_value, "stream_type", (char *)stream->ops->label, 1);
-
- add_assoc_string(return_value, "mode", stream->mode, 1);
-
-#if 0 /* TODO: needs updating for new filter API */
- if (stream->filterhead) {
- php_stream_filter *filter;
-
- MAKE_STD_ZVAL(newval);
- array_init(newval);
-
- for (filter = stream->filterhead; filter != NULL; filter = filter->next) {
- add_next_index_string(newval, (char *)filter->fops->label, 1);
- }
-
- add_assoc_zval(return_value, "filters", newval);
- }
-#endif
-
- add_assoc_long(return_value, "unread_bytes", stream->writepos - stream->readpos);
-
- if (!php_stream_populate_meta_data(stream, return_value)) {
- add_assoc_bool(return_value, "timed_out", 0);
- add_assoc_bool(return_value, "blocked", 1);
- add_assoc_bool(return_value, "eof", php_stream_eof(stream));
- }
-
-}
-/* }}} */
-
-/* {{{ proto array stream_get_transports()
- Retrieves list of registered socket transports */
-PHP_FUNCTION(stream_get_transports)
-{
- HashTable *stream_xport_hash;
- char *stream_xport;
- int stream_xport_len;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- if ((stream_xport_hash = php_stream_xport_get_hash())) {
- array_init(return_value);
- zend_hash_internal_pointer_reset(stream_xport_hash);
- while (zend_hash_get_current_key_ex(stream_xport_hash,
- &stream_xport, &stream_xport_len,
- NULL, 0, NULL) == HASH_KEY_IS_STRING) {
- add_next_index_stringl(return_value, stream_xport, stream_xport_len, 1);
- zend_hash_move_forward(stream_xport_hash);
- }
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array stream_get_wrappers()
- Retrieves list of registered stream wrappers */
-PHP_FUNCTION(stream_get_wrappers)
-{
- HashTable *url_stream_wrappers_hash;
- char *stream_protocol;
- int key_flags, stream_protocol_len = 0;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- if ((url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash())) {
- array_init(return_value);
- for(zend_hash_internal_pointer_reset(url_stream_wrappers_hash);
- (key_flags = zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, &stream_protocol_len, NULL, 0, NULL)) != HASH_KEY_NON_EXISTANT;
- zend_hash_move_forward(url_stream_wrappers_hash)) {
- if (key_flags == HASH_KEY_IS_STRING) {
- add_next_index_stringl(return_value, stream_protocol, stream_protocol_len, 1);
- }
- }
- } else {
- RETURN_FALSE;
- }
-
-}
-/* }}} */
-
-/* {{{ stream_select related functions */
-static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, php_socket_t *max_fd TSRMLS_DC)
-{
- zval **elem;
- php_stream *stream;
- php_socket_t this_fd;
-
- if (Z_TYPE_P(stream_array) != IS_ARRAY) {
- return 0;
- }
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream_array));
- zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) &elem) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_P(stream_array))) {
-
- php_stream_from_zval_no_verify(stream, elem);
- if (stream == NULL) {
- continue;
- }
- /* get the fd.
- * NB: Most other code will NOT use the PHP_STREAM_CAST_INTERNAL flag
- * when casting. It is only used here so that the buffered data warning
- * is not displayed.
- * */
- if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1)) {
- FD_SET(this_fd, fds);
- if (this_fd > *max_fd) {
- *max_fd = this_fd;
- }
- }
- }
- return 1;
-}
-
-static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC)
-{
- zval **elem, **dest_elem;
- php_stream *stream;
- HashTable *new_hash;
- int this_fd, ret = 0;
-
- if (Z_TYPE_P(stream_array) != IS_ARRAY) {
- return 0;
- }
- ALLOC_HASHTABLE(new_hash);
- zend_hash_init(new_hash, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream_array));
- zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) &elem) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_P(stream_array))) {
-
- php_stream_from_zval_no_verify(stream, elem);
- if (stream == NULL) {
- continue;
- }
- /* get the fd
- * NB: Most other code will NOT use the PHP_STREAM_CAST_INTERNAL flag
- * when casting. It is only used here so that the buffered data warning
- * is not displayed.
- */
- if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1)) {
- if (FD_ISSET(this_fd, fds)) {
- zend_hash_next_index_insert(new_hash, (void *)elem, sizeof(zval *), (void **)&dest_elem);
- if (dest_elem) {
- zval_add_ref(dest_elem);
- }
- ret++;
- continue;
- }
- }
- }
-
- /* destroy old array and add new one */
- zend_hash_destroy(Z_ARRVAL_P(stream_array));
- efree(Z_ARRVAL_P(stream_array));
-
- zend_hash_internal_pointer_reset(new_hash);
- Z_ARRVAL_P(stream_array) = new_hash;
-
- return ret;
-}
-
-static int stream_array_emulate_read_fd_set(zval *stream_array TSRMLS_DC)
-{
- zval **elem, **dest_elem;
- php_stream *stream;
- HashTable *new_hash;
- int ret = 0;
-
- if (Z_TYPE_P(stream_array) != IS_ARRAY) {
- return 0;
- }
- ALLOC_HASHTABLE(new_hash);
- zend_hash_init(new_hash, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream_array));
- zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) &elem) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_P(stream_array))) {
-
- php_stream_from_zval_no_verify(stream, elem);
- if (stream == NULL) {
- continue;
- }
- if ((stream->writepos - stream->readpos) > 0) {
- /* allow readable non-descriptor based streams to participate in stream_select.
- * Non-descriptor streams will only "work" if they have previously buffered the
- * data. Not ideal, but better than nothing.
- * This branch of code also allows blocking streams with buffered data to
- * operate correctly in stream_select.
- * */
- zend_hash_next_index_insert(new_hash, (void *)elem, sizeof(zval *), (void **)&dest_elem);
- if (dest_elem) {
- zval_add_ref(dest_elem);
- }
- ret++;
- continue;
- }
- }
-
- if (ret > 0) {
- /* destroy old array and add new one */
- zend_hash_destroy(Z_ARRVAL_P(stream_array));
- efree(Z_ARRVAL_P(stream_array));
-
- zend_hash_internal_pointer_reset(new_hash);
- Z_ARRVAL_P(stream_array) = new_hash;
- } else {
- zend_hash_destroy(new_hash);
- FREE_HASHTABLE(new_hash);
- }
-
- return ret;
-}
-/* }}} */
-
-/* {{{ proto int stream_select(array &read_streams, array &write_streams, array &except_streams, int tv_sec[, int tv_usec])
- Runs the select() system call on the sets of streams with a timeout specified by tv_sec and tv_usec */
-PHP_FUNCTION(stream_select)
-{
- zval *r_array, *w_array, *e_array, *sec;
- struct timeval tv;
- struct timeval *tv_p = NULL;
- fd_set rfds, wfds, efds;
- int max_fd = 0;
- int retval, sets = 0, usec = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!a!z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE)
- return;
-
- FD_ZERO(&rfds);
- FD_ZERO(&wfds);
- FD_ZERO(&efds);
-
- if (r_array != NULL) sets += stream_array_to_fd_set(r_array, &rfds, &max_fd TSRMLS_CC);
- if (w_array != NULL) sets += stream_array_to_fd_set(w_array, &wfds, &max_fd TSRMLS_CC);
- if (e_array != NULL) sets += stream_array_to_fd_set(e_array, &efds, &max_fd TSRMLS_CC);
-
- if (!sets) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No stream arrays were passed");
- RETURN_FALSE;
- }
-
- /* If seconds is not set to null, build the timeval, else we wait indefinitely */
- if (sec != NULL) {
- convert_to_long_ex(&sec);
- tv.tv_sec = Z_LVAL_P(sec);
- tv.tv_usec = usec;
- tv_p = &tv;
- }
-
- /* slight hack to support buffered data; if there is data sitting in the
- * read buffer of any of the streams in the read array, let's pretend
- * that we selected, but return only the readable sockets */
- if (r_array != NULL) {
-
- retval = stream_array_emulate_read_fd_set(r_array TSRMLS_CC);
- if (retval > 0) {
- RETURN_LONG(retval);
- }
- }
-
- retval = php_select(max_fd+1, &rfds, &wfds, &efds, tv_p);
-
- if (retval == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to select [%d]: %s (max_fd=%d)",
- errno, strerror(errno), max_fd);
- RETURN_FALSE;
- }
-
- if (r_array != NULL) stream_array_from_fd_set(r_array, &rfds TSRMLS_CC);
- if (w_array != NULL) stream_array_from_fd_set(w_array, &wfds TSRMLS_CC);
- if (e_array != NULL) stream_array_from_fd_set(e_array, &efds TSRMLS_CC);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ stream_context related functions */
-static void user_space_stream_notifier(php_stream_context *context, int notifycode, int severity,
- char *xmsg, int xcode, size_t bytes_sofar, size_t bytes_max, void * ptr TSRMLS_DC)
-{
- zval *callback = (zval*)context->notifier->ptr;
- zval *retval = NULL;
- zval zvs[6];
- zval *ps[6];
- zval **ptps[6];
- int i;
-
- for (i = 0; i < 6; i++) {
- INIT_ZVAL(zvs[i]);
- ps[i] = &zvs[i];
- ptps[i] = &ps[i];
- }
-
- ZVAL_LONG(ps[0], notifycode);
- ZVAL_LONG(ps[1], severity);
- if (xmsg) {
- ZVAL_STRING(ps[2], xmsg, 0);
- } else {
- ZVAL_NULL(ps[2]);
- }
- ZVAL_LONG(ps[3], xcode);
- ZVAL_LONG(ps[4], bytes_sofar);
- ZVAL_LONG(ps[5], bytes_max);
-
- if (FAILURE == call_user_function_ex(EG(function_table), NULL, callback, &retval, 6, ptps, 0, NULL TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to call user notifier");
- }
- if (retval) {
- zval_ptr_dtor(&retval);
- }
-}
-
-static int parse_context_options(php_stream_context *context, zval *options)
-{
- HashPosition pos, opos;
- zval **wval, **oval;
- char *wkey, *okey;
- int wkey_len, okey_len;
- int ret = SUCCESS;
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(options), &pos);
- while (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_P(options), (void**)&wval, &pos)) {
- if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(options), &wkey, &wkey_len, NULL, 0, &pos)
- && Z_TYPE_PP(wval) == IS_ARRAY) {
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(wval), &opos);
- while (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(wval), (void**)&oval, &opos)) {
-
- if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_PP(wval), &okey, &okey_len, NULL, 0, &opos)) {
- ZVAL_ADDREF(*oval);
- php_stream_context_set_option(context, wkey, okey, *oval);
- }
- zend_hash_move_forward_ex(Z_ARRVAL_PP(wval), &opos);
- }
-
- } else {
- zend_error(E_WARNING, "options should have the form [\"wrappername\"][\"optionname\"] = $value");
- }
- zend_hash_move_forward_ex(Z_ARRVAL_P(options), &pos);
- }
-
- return ret;
-}
-
-static int parse_context_params(php_stream_context *context, zval *params)
-{
- int ret = SUCCESS;
- zval **tmp;
-
- if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "notification", sizeof("notification"), (void**)&tmp)) {
-
- if (context->notifier) {
- php_stream_notification_free(context->notifier);
- context->notifier = NULL;
- }
-
- context->notifier = php_stream_notification_alloc();
- context->notifier->func = user_space_stream_notifier;
- context->notifier->ptr = *tmp;
- ZVAL_ADDREF(*tmp);
- }
- if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "options", sizeof("options"), (void**)&tmp)) {
- parse_context_options(context, *tmp);
- }
-
- return ret;
-}
-
-/* given a zval which is either a stream or a context, return the underlying
- * stream_context. If it is a stream that does not have a context assigned, it
- * will create and assign a context and return that. */
-static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC)
-{
- php_stream_context *context = NULL;
-
- context = zend_fetch_resource(&contextresource TSRMLS_CC, -1, "Stream-Context", NULL, 1, php_le_stream_context());
- if (context == NULL) {
- php_stream *stream;
-
- php_stream_from_zval_no_verify(stream, &contextresource);
-
- if (stream) {
- context = stream->context;
- if (context == NULL) {
- context = stream->context = php_stream_context_alloc();
- }
- }
- }
-
- return context;
-}
-/* }}} */
-
-/* {{{ proto array stream_context_get_options(resource context|resource stream)
- Retrieve options for a stream/wrapper/context */
-PHP_FUNCTION(stream_context_get_options)
-{
- zval *zcontext;
- php_stream_context *context;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
- context = decode_context_param(zcontext TSRMLS_CC);
- ZEND_VERIFY_RESOURCE(context);
-
- array_init(return_value);
- *return_value = *context->options;
- zval_copy_ctor(return_value);
-
-}
-/* }}} */
-
-/* {{{ proto bool stream_context_set_option(resource context|resource stream, string wrappername, string optionname, mixed value)
- Set an option for a wrapper */
-PHP_FUNCTION(stream_context_set_option)
-{
- zval *options = NULL, *zcontext = NULL, *zvalue = NULL;
- php_stream_context *context;
- char *wrappername, *optionname;
- int wrapperlen, optionlen;
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
- "rssz", &zcontext, &wrappername, &wrapperlen,
- &optionname, &optionlen, &zvalue) == FAILURE) {
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
- "ra", &zcontext, &options) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "called with wrong number or type of parameters; please RTM");
- RETURN_FALSE;
- }
- }
-
- /* figure out where the context is coming from exactly */
- context = decode_context_param(zcontext TSRMLS_CC);
- ZEND_VERIFY_RESOURCE(context);
-
- if (options) {
- /* handle the array syntax */
- RETVAL_BOOL(parse_context_options(context, options) == SUCCESS);
- } else {
- ZVAL_ADDREF(zvalue);
- php_stream_context_set_option(context, wrappername, optionname, zvalue);
- RETVAL_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool stream_context_set_params(resource context|resource stream, array options)
- Set parameters for a file context */
-PHP_FUNCTION(stream_context_set_params)
-{
- zval *params, *zcontext;
- php_stream_context *context;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra", &zcontext, &params) == FAILURE) {
- RETURN_FALSE;
- }
-
- context = decode_context_param(zcontext TSRMLS_CC);
- ZEND_VERIFY_RESOURCE(context);
-
- RETVAL_BOOL(parse_context_params(context, params) == SUCCESS);
-}
-/* }}} */
-
-/* {{{ proto resource stream_context_create([array options])
- Create a file context and optionally set parameters */
-PHP_FUNCTION(stream_context_create)
-{
- zval *params = NULL;
- php_stream_context *context;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a", &params) == FAILURE) {
- RETURN_FALSE;
- }
-
- context = php_stream_context_alloc();
-
- if (params) {
- parse_context_options(context, params);
- }
-
- ZEND_REGISTER_RESOURCE(return_value, context, php_le_stream_context());
-}
-/* }}} */
-
-/* {{{ streams filter functions */
-static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS)
-{
- zval *zstream;
- php_stream *stream;
- char *filtername;
- int filternamelen, read_write = 0;
- zval *filterparams = NULL;
- php_stream_filter *filter;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lz", &zstream,
- &filtername, &filternamelen, &read_write, &filterparams) == FAILURE) {
- RETURN_FALSE;
- }
-
- php_stream_from_zval(stream, &zstream);
-
- if ((read_write & PHP_STREAM_FILTER_ALL) == 0) {
- /* Chain not specified.
- * Examine stream->mode to determine which filters are needed
- * There's no harm in attaching a filter to an unused chain,
- * but why waste the memory and clock cycles?
- */
- if (strchr(stream->mode, 'r') || strchr(stream->mode, '+')) {
- read_write |= PHP_STREAM_FILTER_READ;
- }
- if (strchr(stream->mode, 'w') || strchr(stream->mode, '+') || strchr(stream->mode, 'a')) {
- read_write |= PHP_STREAM_FILTER_WRITE;
- }
- }
-
- if (read_write & PHP_STREAM_FILTER_READ) {
- filter = php_stream_filter_create(filtername, filterparams, php_stream_is_persistent(stream) TSRMLS_CC);
- if (filter == NULL) {
- RETURN_FALSE;
- }
-
- if (append) {
- php_stream_filter_append(&stream->readfilters, filter);
- } else {
- php_stream_filter_prepend(&stream->readfilters, filter);
- }
- }
-
- if (read_write & PHP_STREAM_FILTER_WRITE) {
- filter = php_stream_filter_create(filtername, filterparams, php_stream_is_persistent(stream) TSRMLS_CC);
- if (filter == NULL) {
- RETURN_FALSE;
- }
-
- if (append) {
- php_stream_filter_append(&stream->writefilters, filter);
- } else {
- php_stream_filter_prepend(&stream->writefilters, filter);
- }
- }
-
- RETURN_TRUE;
-}
-
-/* {{{ proto bool stream_filter_prepend(resource stream, string filtername[, int read_write[, string filterparams]])
- Prepend a filter to a stream */
-PHP_FUNCTION(stream_filter_prepend)
-{
- apply_filter_to_stream(0, INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto bool stream_filter_append(resource stream, string filtername[, int read_write[, string filterparams]])
- Append a filter to a stream */
-PHP_FUNCTION(stream_filter_append)
-{
- apply_filter_to_stream(1, INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* }}} */
-
-/* {{{ proto string stream_get_line(resource stream, int maxlen, string ending)
- Read up to maxlen bytes from a stream or until the ending string is found */
-PHP_FUNCTION(stream_get_line)
-{
- char *str;
- int str_len;
- long max_length;
- zval *zstream;
- char *buf;
- size_t buf_size;
- php_stream *stream;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls", &zstream, &max_length, &str, &str_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (max_length < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The maximum allowed length must be greater then or equal to zero.");
- RETURN_FALSE;
- }
-
- php_stream_from_zval(stream, &zstream);
-
- if ((buf = php_stream_get_record(stream, max_length, &buf_size, str, str_len TSRMLS_CC))) {
- RETURN_STRINGL(buf, buf_size, 0);
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto bool stream_set_blocking(resource socket, int mode)
- Set blocking/non-blocking mode on a socket or stream */
-PHP_FUNCTION(stream_set_blocking)
-{
- zval **arg1, **arg2;
- int block;
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(stream, arg1);
-
- convert_to_long_ex(arg2);
- block = Z_LVAL_PP(arg2);
-
- if (php_stream_set_option(stream, PHP_STREAM_OPTION_BLOCKING, block == 0 ? 0 : 1, NULL) == -1)
- RETURN_FALSE;
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto bool set_socket_blocking(resource socket, int mode)
- Set blocking/non-blocking mode on a socket */
-PHP_FUNCTION(set_socket_blocking)
-{
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "This function is deprecated, use stream_set_blocking() instead");
- PHP_FN(stream_set_blocking)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto bool stream_set_timeout(resource stream, int seconds, int microseconds)
- Set timeout on stream read to seconds + microseonds */
-#if HAVE_SYS_TIME_H || defined(PHP_WIN32)
-PHP_FUNCTION(stream_set_timeout)
-{
- zval **socket, **seconds, **microseconds;
- struct timeval t;
- php_stream *stream;
-
- if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &socket, &seconds, &microseconds)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- php_stream_from_zval(stream, socket);
-
- convert_to_long_ex(seconds);
- t.tv_sec = Z_LVAL_PP(seconds);
-
- if (ZEND_NUM_ARGS() == 3) {
- convert_to_long_ex(microseconds);
- t.tv_usec = Z_LVAL_PP(microseconds) % 1000000;
- t.tv_sec += Z_LVAL_PP(microseconds) / 1000000;
- }
- else
- t.tv_usec = 0;
-
- if (PHP_STREAM_OPTION_RETURN_OK == php_stream_set_option(stream, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &t)) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-#endif /* HAVE_SYS_TIME_H || defined(PHP_WIN32) */
-/* }}} */
-
-/* {{{ proto int stream_set_write_buffer(resource fp, int buffer)
- Set file write buffer */
-PHP_FUNCTION(stream_set_write_buffer)
-{
- zval **arg1, **arg2;
- int ret;
- size_t buff;
- php_stream *stream;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- /* NOTREACHED */
- break;
- }
-
- php_stream_from_zval(stream, arg1);
-
- convert_to_long_ex(arg2);
- buff = Z_LVAL_PP(arg2);
-
- /* if buff is 0 then set to non-buffered */
- if (buff == 0) {
- ret = php_stream_set_option(stream, PHP_STREAM_OPTION_WRITE_BUFFER, PHP_STREAM_BUFFER_NONE, NULL);
- } else {
- ret = php_stream_set_option(stream, PHP_STREAM_OPTION_WRITE_BUFFER, PHP_STREAM_BUFFER_FULL, &buff);
- }
-
- RETURN_LONG(ret == 0 ? 0 : EOF);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
-
diff --git a/ext/standard/streamsfuncs.h b/ext/standard/streamsfuncs.h
deleted file mode 100644
index 95c1271d97..0000000000
--- a/ext/standard/streamsfuncs.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* Flags for stream_socket_client */
-#define PHP_STREAM_CLIENT_PERSISTENT 1
-#define PHP_STREAM_CLIENT_ASYNC_CONNECT 2
-
-PHP_FUNCTION(stream_socket_client);
-PHP_FUNCTION(stream_socket_server);
-PHP_FUNCTION(stream_socket_accept);
-PHP_FUNCTION(stream_socket_get_name);
-
-PHP_FUNCTION(stream_copy_to_stream);
-
-PHP_FUNCTION(set_socket_blocking); /* deprecated */
-PHP_FUNCTION(stream_set_blocking);
-PHP_FUNCTION(stream_select);
-PHP_FUNCTION(stream_set_timeout);
-PHP_FUNCTION(stream_set_write_buffer);
-PHP_FUNCTION(stream_get_transports);
-PHP_FUNCTION(stream_get_wrappers);
-PHP_FUNCTION(stream_get_line);
-PHP_FUNCTION(stream_get_meta_data);
-PHP_FUNCTION(stream_register_wrapper);
-PHP_FUNCTION(stream_context_create);
-PHP_FUNCTION(stream_context_set_params);
-PHP_FUNCTION(stream_context_set_option);
-PHP_FUNCTION(stream_context_get_options);
-PHP_FUNCTION(stream_filter_prepend);
-PHP_FUNCTION(stream_filter_append);
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
-
diff --git a/ext/standard/string.c b/ext/standard/string.c
deleted file mode 100644
index 861c6bfffe..0000000000
--- a/ext/standard/string.c
+++ /dev/null
@@ -1,4637 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Stig Sæther Bakken <ssb@php.net> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
-
-#include <stdio.h>
-#include "php.h"
-#include "reg.h"
-#include "php_rand.h"
-#include "php_string.h"
-#include "php_variables.h"
-#ifdef HAVE_LOCALE_H
-# include <locale.h>
-#endif
-#ifdef HAVE_LANGINFO_H
-# include <langinfo.h>
-#endif
-#ifdef HAVE_MONETARY_H
-# include <monetary.h>
-#endif
-
-#include <math.h>
-
-#include "scanf.h"
-#include "zend_API.h"
-#include "zend_execute.h"
-#include "php_globals.h"
-#include "basic_functions.h"
-#include "php_smart_str.h"
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-#define STR_PAD_LEFT 0
-#define STR_PAD_RIGHT 1
-#define STR_PAD_BOTH 2
-#define PHP_PATHINFO_DIRNAME 1
-#define PHP_PATHINFO_BASENAME 2
-#define PHP_PATHINFO_EXTENSION 4
-#define PHP_PATHINFO_ALL (PHP_PATHINFO_DIRNAME | PHP_PATHINFO_BASENAME | PHP_PATHINFO_EXTENSION)
-
-#define STR_STRSPN 0
-#define STR_STRCSPN 1
-
-/* {{{ register_string_constants
- */
-void register_string_constants(INIT_FUNC_ARGS)
-{
- REGISTER_LONG_CONSTANT("STR_PAD_LEFT", STR_PAD_LEFT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STR_PAD_RIGHT", STR_PAD_RIGHT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STR_PAD_BOTH", STR_PAD_BOTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PATHINFO_DIRNAME", PHP_PATHINFO_DIRNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PATHINFO_BASENAME", PHP_PATHINFO_BASENAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_CS | CONST_PERSISTENT);
-
-#ifdef HAVE_LOCALECONV
- /* If last members of struct lconv equal CHAR_MAX, no grouping is done */
-
-/* This is bad, but since we are going to be hardcoding in the POSIX stuff anyway... */
-# ifndef HAVE_LIMITS_H
-# define CHAR_MAX 127
-# endif
-
- REGISTER_LONG_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT);
-#endif
-
-#ifdef HAVE_LOCALE_H
- REGISTER_LONG_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LC_TIME", LC_TIME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LC_COLLATE", LC_COLLATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LC_MONETARY", LC_MONETARY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LC_ALL", LC_ALL, CONST_CS | CONST_PERSISTENT);
-# ifdef LC_MESSAGES
- REGISTER_LONG_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_CS | CONST_PERSISTENT);
-# endif
-#endif
-
-}
-/* }}} */
-
-int php_tag_find(char *tag, int len, char *set);
-
-/* this is read-only, so it's ok */
-static char hexconvtab[] = "0123456789abcdef";
-
-/* localeconv mutex */
-#ifdef ZTS
-static MUTEX_T locale_mutex = NULL;
-#endif
-
-/* {{{ php_bin2hex
- */
-static char *php_bin2hex(const unsigned char *old, const size_t oldlen, size_t *newlen)
-{
- register unsigned char *result = NULL;
- size_t i, j;
-
- result = (char *) emalloc(oldlen * 2 * sizeof(char) + 1);
-
- for (i = j = 0; i < oldlen; i++) {
- result[j++] = hexconvtab[old[i] >> 4];
- result[j++] = hexconvtab[old[i] & 15];
- }
- result[j] = '\0';
-
- if (newlen)
- *newlen = oldlen * 2 * sizeof(char);
-
- return result;
-}
-/* }}} */
-
-#ifdef HAVE_LOCALECONV
-/* {{{ localeconv_r
- * glibc's localeconv is not reentrant, so lets make it so ... sorta */
-struct lconv *localeconv_r(struct lconv *out)
-{
- struct lconv *res;
-
-# ifdef ZTS
- tsrm_mutex_lock( locale_mutex );
-# endif
-
- /* localeconv doesn't return an error condition */
- res = localeconv();
-
- *out = *res;
-
-# ifdef ZTS
- tsrm_mutex_unlock( locale_mutex );
-# endif
-
- return out;
-}
-/* }}} */
-
-# ifdef ZTS
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(localeconv)
-{
- locale_mutex = tsrm_mutex_alloc();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(localeconv)
-{
- tsrm_mutex_free( locale_mutex );
- locale_mutex = NULL;
- return SUCCESS;
-}
-/* }}} */
-# endif
-#endif
-
-/* {{{ proto string bin2hex(string data)
- Converts the binary representation of data to hex */
-PHP_FUNCTION(bin2hex)
-{
- zval **data;
- char *result;
- size_t newlen;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &data) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(data);
-
- result = php_bin2hex(Z_STRVAL_PP(data), Z_STRLEN_PP(data), &newlen);
-
- if (!result) {
- RETURN_FALSE;
- }
-
- RETURN_STRINGL(result, newlen, 0);
-}
-/* }}} */
-
-static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior)
-{
- char *s11, *s22;
- int len1, len2;
- long start, len;
-
- start = 0;
- len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", &s11, &len1,
- &s22, &len2, &start, &len) == FAILURE) {
- return;
- }
-
- if (ZEND_NUM_ARGS() < 4) {
- len = len1;
- }
-
- /* look at substr() function for more information */
-
- if (start < 0) {
- start += len1;
- if (start < 0) {
- start = 0;
- }
- } else if (start > len1) {
- RETURN_FALSE;
- }
-
- if (len < 0) {
- len += (len1 - start);
- if (len < 0) {
- len = 0;
- }
- }
-
- if ((start + len) > len1) {
- len = len1 - start;
- }
-
- if (behavior == STR_STRSPN) {
- RETURN_LONG(php_strspn(s11 + start /*str1_start*/,
- s22 /*str2_start*/,
- s11 + start + len /*str1_end*/,
- s22 + len2 /*str2_end*/));
- } else if (behavior == STR_STRCSPN) {
- RETURN_LONG(php_strcspn(s11 + start /*str1_start*/,
- s22 /*str2_start*/,
- s11 + start + len /*str1_end*/,
- s22 + len2 /*str2_end*/));
- }
-
-}
-
-/* {{{ proto int strspn(string str, string mask [, start [, len]])
- Finds length of initial segment consisting entirely of characters found in mask. If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) */
-PHP_FUNCTION(strspn)
-{
- php_spn_common_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU, STR_STRSPN);
-}
-/* }}} */
-
-/* {{{ proto int strcspn(string str, string mask [, start [, len]])
- Finds length of initial segment consisting entirely of characters not found in mask. If start or/and length is provide works like strcspn(substr($s,$start,$len),$bad_chars) */
-PHP_FUNCTION(strcspn)
-{
- php_spn_common_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU, STR_STRCSPN);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION(nl_langinfo) */
-#if HAVE_NL_LANGINFO
-PHP_MINIT_FUNCTION(nl_langinfo)
-{
-#define REGISTER_NL_LANGINFO_CONSTANT(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT)
-#ifdef ABDAY_1
- REGISTER_NL_LANGINFO_CONSTANT(ABDAY_1);
- REGISTER_NL_LANGINFO_CONSTANT(ABDAY_2);
- REGISTER_NL_LANGINFO_CONSTANT(ABDAY_3);
- REGISTER_NL_LANGINFO_CONSTANT(ABDAY_4);
- REGISTER_NL_LANGINFO_CONSTANT(ABDAY_5);
- REGISTER_NL_LANGINFO_CONSTANT(ABDAY_6);
- REGISTER_NL_LANGINFO_CONSTANT(ABDAY_7);
-#endif
-#ifdef DAY_1
- REGISTER_NL_LANGINFO_CONSTANT(DAY_1);
- REGISTER_NL_LANGINFO_CONSTANT(DAY_2);
- REGISTER_NL_LANGINFO_CONSTANT(DAY_3);
- REGISTER_NL_LANGINFO_CONSTANT(DAY_4);
- REGISTER_NL_LANGINFO_CONSTANT(DAY_5);
- REGISTER_NL_LANGINFO_CONSTANT(DAY_6);
- REGISTER_NL_LANGINFO_CONSTANT(DAY_7);
-#endif
-#ifdef ABMON_1
- REGISTER_NL_LANGINFO_CONSTANT(ABMON_1);
- REGISTER_NL_LANGINFO_CONSTANT(ABMON_2);
- REGISTER_NL_LANGINFO_CONSTANT(ABMON_3);
- REGISTER_NL_LANGINFO_CONSTANT(ABMON_4);
- REGISTER_NL_LANGINFO_CONSTANT(ABMON_5);
- REGISTER_NL_LANGINFO_CONSTANT(ABMON_6);
- REGISTER_NL_LANGINFO_CONSTANT(ABMON_7);
- REGISTER_NL_LANGINFO_CONSTANT(ABMON_8);
- REGISTER_NL_LANGINFO_CONSTANT(ABMON_9);
- REGISTER_NL_LANGINFO_CONSTANT(ABMON_10);
- REGISTER_NL_LANGINFO_CONSTANT(ABMON_11);
- REGISTER_NL_LANGINFO_CONSTANT(ABMON_12);
-#endif
-#ifdef MON_1
- REGISTER_NL_LANGINFO_CONSTANT(MON_1);
- REGISTER_NL_LANGINFO_CONSTANT(MON_2);
- REGISTER_NL_LANGINFO_CONSTANT(MON_3);
- REGISTER_NL_LANGINFO_CONSTANT(MON_4);
- REGISTER_NL_LANGINFO_CONSTANT(MON_5);
- REGISTER_NL_LANGINFO_CONSTANT(MON_6);
- REGISTER_NL_LANGINFO_CONSTANT(MON_7);
- REGISTER_NL_LANGINFO_CONSTANT(MON_8);
- REGISTER_NL_LANGINFO_CONSTANT(MON_9);
- REGISTER_NL_LANGINFO_CONSTANT(MON_10);
- REGISTER_NL_LANGINFO_CONSTANT(MON_11);
- REGISTER_NL_LANGINFO_CONSTANT(MON_12);
-#endif
-#ifdef AM_STR
- REGISTER_NL_LANGINFO_CONSTANT(AM_STR);
-#endif
-#ifdef PM_STR
- REGISTER_NL_LANGINFO_CONSTANT(PM_STR);
-#endif
-#ifdef D_T_FMT
- REGISTER_NL_LANGINFO_CONSTANT(D_T_FMT);
-#endif
-#ifdef D_FMT
- REGISTER_NL_LANGINFO_CONSTANT(D_FMT);
-#endif
-#ifdef T_FMT
- REGISTER_NL_LANGINFO_CONSTANT(T_FMT);
-#endif
-#ifdef T_FMT_AMPM
- REGISTER_NL_LANGINFO_CONSTANT(T_FMT_AMPM);
-#endif
-#ifdef ERA
- REGISTER_NL_LANGINFO_CONSTANT(ERA);
-#endif
-#ifdef ERA_YEAR
- REGISTER_NL_LANGINFO_CONSTANT(ERA_YEAR);
-#endif
-#ifdef ERA_D_T_FMT
- REGISTER_NL_LANGINFO_CONSTANT(ERA_D_T_FMT);
-#endif
-#ifdef ERA_D_FMT
- REGISTER_NL_LANGINFO_CONSTANT(ERA_D_FMT);
-#endif
-#ifdef ERA_T_FMT
- REGISTER_NL_LANGINFO_CONSTANT(ERA_T_FMT);
-#endif
-#ifdef ALT_DIGITS
- REGISTER_NL_LANGINFO_CONSTANT(ALT_DIGITS);
-#endif
-#ifdef INT_CURR_SYMBOL
- REGISTER_NL_LANGINFO_CONSTANT(INT_CURR_SYMBOL);
-#endif
-#ifdef CURRENCY_SYMBOL
- REGISTER_NL_LANGINFO_CONSTANT(CURRENCY_SYMBOL);
-#endif
-#ifdef CRNCYSTR
- REGISTER_NL_LANGINFO_CONSTANT(CRNCYSTR);
-#endif
-#ifdef MON_DECIMAL_POINT
- REGISTER_NL_LANGINFO_CONSTANT(MON_DECIMAL_POINT);
-#endif
-#ifdef MON_THOUSANDS_SEP
- REGISTER_NL_LANGINFO_CONSTANT(MON_THOUSANDS_SEP);
-#endif
-#ifdef MON_GROUPING
- REGISTER_NL_LANGINFO_CONSTANT(MON_GROUPING);
-#endif
-#ifdef POSITIVE_SIGN
- REGISTER_NL_LANGINFO_CONSTANT(POSITIVE_SIGN);
-#endif
-#ifdef NEGATIVE_SIGN
- REGISTER_NL_LANGINFO_CONSTANT(NEGATIVE_SIGN);
-#endif
-#ifdef INT_FRAC_DIGITS
- REGISTER_NL_LANGINFO_CONSTANT(INT_FRAC_DIGITS);
-#endif
-#ifdef FRAC_DIGITS
- REGISTER_NL_LANGINFO_CONSTANT(FRAC_DIGITS);
-#endif
-#ifdef P_CS_PRECEDES
- REGISTER_NL_LANGINFO_CONSTANT(P_CS_PRECEDES);
-#endif
-#ifdef P_SEP_BY_SPACE
- REGISTER_NL_LANGINFO_CONSTANT(P_SEP_BY_SPACE);
-#endif
-#ifdef N_CS_PRECEDES
- REGISTER_NL_LANGINFO_CONSTANT(N_CS_PRECEDES);
-#endif
-#ifdef N_SEP_BY_SPACE
- REGISTER_NL_LANGINFO_CONSTANT(N_SEP_BY_SPACE);
-#endif
-#ifdef P_SIGN_POSN
- REGISTER_NL_LANGINFO_CONSTANT(P_SIGN_POSN);
-#endif
-#ifdef N_SIGN_POSN
- REGISTER_NL_LANGINFO_CONSTANT(N_SIGN_POSN);
-#endif
-#ifdef DECIMAL_POINT
- REGISTER_NL_LANGINFO_CONSTANT(DECIMAL_POINT);
-#endif
-#ifdef RADIXCHAR
- REGISTER_NL_LANGINFO_CONSTANT(RADIXCHAR);
-#endif
-#ifdef THOUSANDS_SEP
- REGISTER_NL_LANGINFO_CONSTANT(THOUSANDS_SEP);
-#endif
-#ifdef THOUSEP
- REGISTER_NL_LANGINFO_CONSTANT(THOUSEP);
-#endif
-#ifdef GROUPING
- REGISTER_NL_LANGINFO_CONSTANT(GROUPING);
-#endif
-#ifdef YESEXPR
- REGISTER_NL_LANGINFO_CONSTANT(YESEXPR);
-#endif
-#ifdef NOEXPR
- REGISTER_NL_LANGINFO_CONSTANT(NOEXPR);
-#endif
-#ifdef YESSTR
- REGISTER_NL_LANGINFO_CONSTANT(YESSTR);
-#endif
-#ifdef NOSTR
- REGISTER_NL_LANGINFO_CONSTANT(NOSTR);
-#endif
-#ifdef CODESET
- REGISTER_NL_LANGINFO_CONSTANT(CODESET);
-#endif
-#undef REGISTER_NL_LANGINFO_CONSTANT
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto string nl_langinfo(int item)
- Query language and locale information */
-PHP_FUNCTION(nl_langinfo)
-{
- zval **item;
- char *value;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &item) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(item);
-
- value = nl_langinfo(Z_LVAL_PP(item));
- if (value == NULL) {
- RETURN_FALSE;
- } else {
- RETURN_STRING(value, 1);
- }
-}
-#endif
-/* }}} */
-
-#ifdef HAVE_STRCOLL
-/* {{{ proto int strcoll(string str1, string str2)
- Compares two strings using the current locale */
-PHP_FUNCTION(strcoll)
-{
- zval **s1, **s2;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
-
- RETURN_LONG(strcoll((const char *) Z_STRVAL_PP(s1),
- (const char *) Z_STRVAL_PP(s2)));
-}
-/* }}} */
-#endif
-
-/* {{{ php_charmask
- * Fills a 256-byte bytemask with input. You can specify a range like 'a..z',
- * it needs to be incrementing.
- * Returns: FAILURE/SUCCESS wether the input was correct (i.e. no range errors)
- */
-static inline int php_charmask(unsigned char *input, int len, char *mask TSRMLS_DC)
-{
- unsigned char *end;
- unsigned char c;
- int result = SUCCESS;
-
- memset(mask, 0, 256);
- for (end = input+len; input < end; input++) {
- c=*input;
- if ((input+3 < end) && input[1] == '.' && input[2] == '.'
- && input[3] >= c) {
- memset(mask+c, 1, input[3] - c + 1);
- input+=3;
- } else if ((input+1 < end) && input[0] == '.' && input[1] == '.') {
- /* Error, try to be as helpful as possible:
- (a range ending/starting with '.' won't be captured here) */
- if (end-len >= input) { /* there was no 'left' char */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range, no character to the left of '..'.");
- result = FAILURE;
- continue;
- }
- if (input+2 >= end) { /* there is no 'right' char */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range, no character to the right of '..'.");
- result = FAILURE;
- continue;
- }
- if (input[-1] > input[2]) { /* wrong order */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range, '..'-range needs to be incrementing.");
- result = FAILURE;
- continue;
- }
- /* FIXME: better error (a..b..c is the only left possibility?) */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range.");
- result = FAILURE;
- continue;
- } else {
- mask[c]=1;
- }
- }
- return result;
-}
-/* }}} */
-
-/* {{{ php_trim()
- * mode 1 : trim left
- * mode 2 : trim right
- * mode 3 : trim left and right
- * what indicates which chars are to be trimmed. NULL->default (' \t\n\r\v\0')
- */
-PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval *return_value, int mode TSRMLS_DC)
-{
- register int i;
- int trimmed = 0;
- char mask[256];
-
- if (what) {
- php_charmask(what, what_len, mask TSRMLS_CC);
- } else {
- php_charmask(" \n\r\t\v\0", 6, mask TSRMLS_CC);
- }
-
- if (mode & 1) {
- for (i = 0; i < len; i++) {
- if (mask[(unsigned char)c[i]]) {
- trimmed++;
- } else {
- break;
- }
- }
- len -= trimmed;
- c += trimmed;
- }
- if (mode & 2) {
- for (i = len - 1; i >= 0; i--) {
- if (mask[(unsigned char)c[i]]) {
- len--;
- } else {
- break;
- }
- }
- }
-
- if (return_value) {
- RETVAL_STRINGL(c, len, 1);
- } else {
- return estrndup(c, len);
- }
- return "";
-}
-/* }}} */
-
-/* {{{ php_do_trim
- * Base for trim(), rtrim() and ltrim() functions.
- */
-static void php_do_trim(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- zval **str;
- zval **what = NULL;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &str, &what) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(str);
-
- if (argc > 1) {
- convert_to_string_ex(what);
- php_trim(Z_STRVAL_PP(str), Z_STRLEN_PP(str), Z_STRVAL_PP(what), Z_STRLEN_PP(what), return_value, mode TSRMLS_CC);
- } else {
- php_trim(Z_STRVAL_PP(str), Z_STRLEN_PP(str), NULL, 0, return_value, mode TSRMLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ proto string trim(string str [, string character_mask])
- Strips whitespace from the beginning and end of a string */
-PHP_FUNCTION(trim)
-{
- php_do_trim(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3);
-}
-/* }}} */
-
-/* {{{ proto string rtrim(string str [, string character_mask])
- Removes trailing whitespace */
-PHP_FUNCTION(rtrim)
-{
- php_do_trim(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);
-}
-/* }}} */
-
-/* {{{ proto string ltrim(string str [, string character_mask])
- Strips whitespace from the beginning of a string */
-PHP_FUNCTION(ltrim)
-{
- php_do_trim(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto string wordwrap(string str [, int width [, string break [, boolean cut]]])
- Wraps buffer to selected number of characters using string break char */
-PHP_FUNCTION(wordwrap)
-{
- const char *text, *breakchar = "\n";
- char *newtext;
- int textlen, breakcharlen = 1, newtextlen, alloced, chk;
- long current = 0, laststart = 0, lastspace = 0;
- long linelength = 75;
- zend_bool docut = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lsb", &text, &textlen, &linelength, &breakchar, &breakcharlen, &docut) == FAILURE) {
- return;
- }
-
- if (textlen == 0)
- RETURN_FALSE;
-
- if (linelength == 0 && docut) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't force cut when width is zero.");
- RETURN_FALSE;
- }
-
- /* Special case for a single-character break as it needs no
- additional storage space */
- if (breakcharlen == 1 && !docut) {
- newtext = estrndup(text, textlen);
-
- laststart = lastspace = 0;
- for (current = 0; current < textlen; current++) {
- if (text[current] == breakchar[0]) {
- laststart = lastspace = current;
- } else if (text[current] == ' ') {
- if (current - laststart >= linelength) {
- newtext[current] = breakchar[0];
- laststart = current;
- }
- lastspace = current;
- } else if (current - laststart >= linelength && laststart != lastspace) {
- newtext[lastspace] = breakchar[0];
- laststart = lastspace;
- }
- }
-
- RETURN_STRINGL(newtext, textlen, 0);
- } else {
- /* Multiple character line break or forced cut */
- if (linelength > 0) {
- chk = (int)(textlen/linelength + 1);
- alloced = textlen + chk * breakcharlen + 1;
- } else {
- chk = textlen;
- alloced = textlen * (breakcharlen + 1) + 1;
- }
- newtext = emalloc(alloced);
-
- /* now keep track of the actual new text length */
- newtextlen = 0;
-
- laststart = lastspace = 0;
- for (current = 0; current < textlen; current++) {
- if (chk <= 0) {
- alloced += (int) (((textlen - current + 1)/linelength + 1) * breakcharlen) + 1;
- newtext = erealloc(newtext, alloced);
- chk = (int) ((textlen - current)/linelength) + 1;
- }
- /* when we hit an existing break, copy to new buffer, and
- * fix up laststart and lastspace */
- if (text[current] == breakchar[0]
- && current + breakcharlen < textlen
- && !strncmp(text+current, breakchar, breakcharlen)) {
- memcpy(newtext+newtextlen, text+laststart, current-laststart+breakcharlen);
- newtextlen += current-laststart+breakcharlen;
- current += breakcharlen - 1;
- laststart = lastspace = current + 1;
- chk--;
- }
- /* if it is a space, check if it is at the line boundary,
- * copy and insert a break, or just keep track of it */
- else if (text[current] == ' ') {
- if (current - laststart >= linelength) {
- memcpy(newtext+newtextlen, text+laststart, current-laststart);
- newtextlen += current - laststart;
- memcpy(newtext+newtextlen, breakchar, breakcharlen);
- newtextlen += breakcharlen;
- laststart = current + 1;
- chk--;
- }
- lastspace = current;
- }
- /* if we are cutting, and we've accumulated enough
- * characters, and we haven't see a space for this line,
- * copy and insert a break. */
- else if (current - laststart >= linelength
- && docut && laststart >= lastspace) {
- memcpy(newtext+newtextlen, text+laststart, current-laststart);
- newtextlen += current - laststart;
- memcpy(newtext+newtextlen, breakchar, breakcharlen);
- newtextlen += breakcharlen;
- laststart = lastspace = current;
- chk--;
- }
- /* if the current word puts us over the linelength, copy
- * back up until the last space, insert a break, and move
- * up the laststart */
- else if (current - laststart >= linelength
- && laststart < lastspace) {
- memcpy(newtext+newtextlen, text+laststart, lastspace-laststart);
- newtextlen += lastspace - laststart;
- memcpy(newtext+newtextlen, breakchar, breakcharlen);
- newtextlen += breakcharlen;
- laststart = lastspace = lastspace + 1;
- chk--;
- }
- }
-
- /* copy over any stragglers */
- if (laststart != current) {
- memcpy(newtext+newtextlen, text+laststart, current-laststart);
- newtextlen += current - laststart;
- }
-
- newtext[newtextlen] = '\0';
- /* free unused memory */
- newtext = erealloc(newtext, newtextlen+1);
-
- RETURN_STRINGL(newtext, newtextlen, 0);
- }
-}
-/* }}} */
-
-/* {{{ php_explode
- */
-PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, int limit)
-{
- char *p1, *p2, *endp;
-
- endp = Z_STRVAL_P(str) + Z_STRLEN_P(str);
-
- p1 = Z_STRVAL_P(str);
- p2 = php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp);
-
- if (p2 == NULL) {
- add_next_index_stringl(return_value, p1, Z_STRLEN_P(str), 1);
- } else {
- do {
- add_next_index_stringl(return_value, p1, p2 - p1, 1);
- p1 = p2 + Z_STRLEN_P(delim);
- } while ((p2 = php_memnstr(p1, Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp)) != NULL &&
- (limit == -1 || --limit > 1));
-
- if (p1 <= endp)
- add_next_index_stringl(return_value, p1, endp-p1, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto array explode(string separator, string str [, int limit])
- Splits a string on string separator and return array of components */
-PHP_FUNCTION(explode)
-{
- zval **str, **delim, **zlimit = NULL;
- int limit = -1;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &delim, &str, &zlimit) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
- convert_to_string_ex(delim);
-
- if (argc > 2) {
- convert_to_long_ex(zlimit);
- limit = Z_LVAL_PP(zlimit);
- }
-
- if (! Z_STRLEN_PP(delim)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter.");
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- if (limit == 0 || limit == 1) {
- add_index_stringl(return_value, 0, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
- } else {
- php_explode(*delim, *str, return_value, limit);
- }
-}
-/* }}} */
-
-/* {{{ proto string join(array src, string glue)
- An alias for implode */
-/* }}} */
-
-/* {{{ php_implode
- */
-PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value)
-{
- zval **tmp;
- HashPosition pos;
- smart_str implstr = {0};
- int numelems, i = 0;
-
- numelems = zend_hash_num_elements(Z_ARRVAL_P(arr));
-
- if (numelems == 0) {
- RETURN_EMPTY_STRING();
- }
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos);
-
- while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **) &tmp, &pos) == SUCCESS) {
- SEPARATE_ZVAL(tmp);
- convert_to_string(*tmp);
-
- smart_str_appendl(&implstr, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
- if (++i != numelems) {
- smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRLEN_P(delim));
- }
- zend_hash_move_forward_ex(Z_ARRVAL_P(arr), &pos);
- }
- smart_str_0(&implstr);
-
- RETURN_STRINGL(implstr.c, implstr.len, 0);
-}
-/* }}} */
-
-/* {{{ proto string implode([string glue,] array pieces)
- Joins array elements placing glue string between items and return one string */
-PHP_FUNCTION(implode)
-{
- zval **arg1 = NULL, **arg2 = NULL, *delim, *arr;
- int argc = ZEND_NUM_ARGS();
- int arg1_separated = 0, arg2_separated = 0, delim_needs_dtor = 0;
-
- if (argc < 1 || argc > 2 ||
- zend_get_parameters_ex(argc, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 1) {
- if (Z_TYPE_PP(arg1) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument to implode must be an array.");
- return;
- }
-
- MAKE_STD_ZVAL(delim);
-#define _IMPL_EMPTY ""
- ZVAL_STRINGL(delim, _IMPL_EMPTY, sizeof(_IMPL_EMPTY) - 1, 0);
-
- SEPARATE_ZVAL(arg1);
- arg1_separated = 1;
- delim_needs_dtor = 1;
- arr = *arg1;
- } else {
- if (Z_TYPE_PP(arg1) == IS_ARRAY) {
- SEPARATE_ZVAL(arg1);
- arg1_separated = 1;
- arr = *arg1;
- convert_to_string_ex(arg2);
- delim = *arg2;
- } else if (Z_TYPE_PP(arg2) == IS_ARRAY) {
- SEPARATE_ZVAL(arg2);
- arg2_separated = 1;
- arr = *arg2;
- convert_to_string_ex(arg1);
- delim = *arg1;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad arguments.");
- return;
- }
- }
-
- php_implode(delim, arr, return_value);
-
- if (arg1 != NULL && arg1_separated) {
- zval_ptr_dtor(arg1);
- }
- if (arg2 != NULL && arg2_separated) {
- zval_ptr_dtor(arg2);
- }
- if (delim_needs_dtor) {
- FREE_ZVAL(delim);
- }
-}
-/* }}} */
-
-#define STRTOK_TABLE(p) BG(strtok_table)[(unsigned char) *p]
-
-/* {{{ proto string strtok([string str,] string token)
- Tokenize a string */
-PHP_FUNCTION(strtok)
-{
- zval **args[2];
- zval **tok, **str;
- char *token;
- char *token_end;
- char *p;
- char *pe;
- int skipped = 0;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- tok = args[0];
- break;
-
- default:
- case 2:
- str = args[0];
- tok = args[1];
- convert_to_string_ex(str);
-
- zval_add_ref(str);
- if (BG(strtok_zval)) {
- zval_ptr_dtor(&BG(strtok_zval));
- }
- BG(strtok_zval) = *str;
- BG(strtok_last) = BG(strtok_string) = Z_STRVAL_PP(str);
- BG(strtok_len) = Z_STRLEN_PP(str);
- break;
- }
-
- p = BG(strtok_last); /* Where we start to search */
- pe = BG(strtok_string) + BG(strtok_len);
-
- if (!p || p >= pe) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(tok);
-
- token = Z_STRVAL_PP(tok);
- token_end = token + Z_STRLEN_PP(tok);
-
- while (token < token_end) {
- STRTOK_TABLE(token++) = 1;
- }
-
- /* Skip leading delimiters */
- while (STRTOK_TABLE(p)) {
- if (++p >= pe) {
- /* no other chars left */
- BG(strtok_last) = NULL;
- RETVAL_FALSE;
- goto restore;
- }
- skipped++;
- }
-
- /* We know at this place that *p is no delimiter, so skip it */
- while (++p < pe) {
- if (STRTOK_TABLE(p)) {
- goto return_token;
- }
- }
-
- if (p - BG(strtok_last)) {
-return_token:
- RETVAL_STRINGL(BG(strtok_last) + skipped, (p - BG(strtok_last)) - skipped, 1);
- BG(strtok_last) = p + 1;
- } else {
- RETVAL_FALSE;
- BG(strtok_last) = NULL;
- }
-
- /* Restore table -- usually faster then memset'ing the table on every invocation */
-restore:
- token = Z_STRVAL_PP(tok);
-
- while (token < token_end) {
- STRTOK_TABLE(token++) = 0;
- }
-}
-/* }}} */
-
-/* {{{ php_strtoupper
- */
-PHPAPI char *php_strtoupper(char *s, size_t len)
-{
- unsigned char *c, *e;
-
- c = s;
- e = c+len;
-
- while (c < e) {
- *c = toupper(*c);
- c++;
- }
- return s;
-}
-/* }}} */
-
-/* {{{ proto string strtoupper(string str)
- Makes a string uppercase */
-PHP_FUNCTION(strtoupper)
-{
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- *return_value = **arg;
- zval_copy_ctor(return_value);
- php_strtoupper(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value));
-}
-/* }}} */
-
-/* {{{ php_strtolower
- */
-PHPAPI char *php_strtolower(char *s, size_t len)
-{
- unsigned char *c, *e;
-
- c = s;
- e = c+len;
-
- while (c < e) {
- *c = tolower(*c);
- c++;
- }
- return s;
-}
-/* }}} */
-
-/* {{{ proto string strtolower(string str)
- Makes a string lowercase */
-PHP_FUNCTION(strtolower)
-{
- zval **str;
- char *ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- *return_value = **str;
- zval_copy_ctor(return_value);
- ret = php_strtolower(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value));
-}
-/* }}} */
-
-/* {{{ php_basename
- */
-PHPAPI void php_basename(char *s, size_t len, char *suffix, size_t sufflen, char **p_ret, int *p_len)
-{
- char *ret=NULL, *c;
- c = s + len - 1;
-
- /* strip trailing slashes */
- while (*c == '/'
-#ifdef PHP_WIN32
- || (*c == '\\' && !IsDBCSLeadByte(*(c-1)))
-#endif
- ) {
- c--;
- len--;
- }
-
- /* do suffix removal as the unix command does */
- if (suffix && (len > sufflen)) {
- if (!memcmp(suffix, c-sufflen+1, sufflen)) {
- if( (*(c-sufflen) != '/')
-#ifdef PHP_WIN32
- && ( *(c-sufflen) != '\\' || IsDBCSLeadByte(*(c-sufflen-1)))
-#endif
- ) {
- c -= sufflen;
- len -= sufflen;
- }
- }
- }
-
- while(c>=s) {
- if(*c == '/'
-#ifdef PHP_WIN32
- || ( *c == '\\' && !IsDBCSLeadByte(*c-1))
-#endif
- ) {
- c++;
- break;
- }
- c--;
- }
-
- if (c<s) c=s;
-
- len -= (c-s);
- ret = emalloc(len+1);
- memcpy(ret, c, len);
- ret[len] = '\0';
-
- if(p_ret) *p_ret = ret;
- if(p_len) *p_len = len;
-}
-/* }}} */
-
-/* {{{ proto string basename(string path [, string suffix])
- Returns the filename component of the path */
-PHP_FUNCTION(basename)
-{
- char *string, *suffix = NULL, *ret;
- int string_len, suffix_len = 0, ret_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &string, &string_len, &suffix, &suffix_len) == FAILURE) {
- return;
- }
-
- php_basename(string, string_len, suffix, suffix_len, &ret, &ret_len);
- RETURN_STRINGL(ret, ret_len, 0);
-}
-/* }}} */
-
-/* {{{ php_dirname
- Returns directory name component of path */
-PHPAPI size_t php_dirname(char *path, size_t len)
-{
- register char *end = path + len - 1;
- unsigned int len_adjust = 0;
-
-#ifdef PHP_WIN32
- /* Note that on Win32 CWD is per drive (heritage from CP/M).
- * This means dirname("c:foo") maps to "c:." or "c:" - which means CWD on C: drive.
- */
- if ((2 <= len) && isalpha((int)((unsigned char *)path)[0]) && (':' == path[1])) {
- /* Skip over the drive spec (if any) so as not to change */
- path += 2;
- len_adjust += 2;
- if (2 == len) {
- /* Return "c:" on Win32 for dirname("c:").
- * It would be more consistent to return "c:."
- * but that would require making the string *longer*.
- */
- return len;
- }
- }
-#endif
-
- if (len == 0) {
- /* Illegal use of this function */
- return 0;
- }
-
- /* Strip trailing slashes */
- while (end >= path && IS_SLASH_P(end)) {
- end--;
- }
- if (end < path) {
- /* The path only contained slashes */
- path[0] = DEFAULT_SLASH;
- path[1] = '\0';
- return 1 + len_adjust;
- }
-
- /* Strip filename */
- while (end >= path && !IS_SLASH_P(end)) {
- end--;
- }
- if (end < path) {
- /* No slash found, therefore return '.' */
- path[0] = '.';
- path[1] = '\0';
- return 1 + len_adjust;
- }
-
- /* Strip slashes which came before the file name */
- while (end >= path && IS_SLASH_P(end)) {
- end--;
- }
- if (end < path) {
- path[0] = DEFAULT_SLASH;
- path[1] = '\0';
- return 1 + len_adjust;
- }
- *(end+1) = '\0';
-
- return (size_t)(end + 1 - path) + len_adjust;
-}
-/* }}} */
-
-/* {{{ proto string dirname(string path)
- Returns the directory name component of the path */
-PHP_FUNCTION(dirname)
-{
- zval **str;
- char *ret;
- size_t ret_len;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- ret = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
- ret_len = php_dirname(ret, Z_STRLEN_PP(str));
-
- RETURN_STRINGL(ret, ret_len, 0);
-}
-/* }}} */
-
-/* {{{ proto array pathinfo(string path)
- Returns information about a certain string */
-PHP_FUNCTION(pathinfo)
-{
- zval *tmp;
- char *path, *ret = NULL;
- int path_len, ret_len;
- long opt = PHP_PATHINFO_ALL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &path_len, &opt) == FAILURE) {
- return;
- }
-
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
-
- if ((opt & PHP_PATHINFO_DIRNAME) == PHP_PATHINFO_DIRNAME) {
- ret = estrndup(path, path_len);
- php_dirname(ret, path_len);
- if (*ret) {
- add_assoc_string(tmp, "dirname", ret, 1);
- }
- efree(ret);
- }
-
- if ((opt & PHP_PATHINFO_BASENAME) == PHP_PATHINFO_BASENAME) {
- php_basename(path, path_len, NULL, 0, &ret, &ret_len);
- add_assoc_stringl(tmp, "basename", ret, ret_len, 0);
- }
-
- if ((opt & PHP_PATHINFO_EXTENSION) == PHP_PATHINFO_EXTENSION) {
- char *p;
- int idx;
- int ret_len;
- int have_basename = ((opt & PHP_PATHINFO_BASENAME) == PHP_PATHINFO_BASENAME);
-
- /* Have we alrady looked up the basename? */
- if (!have_basename) {
- php_basename(path, path_len, NULL, 0, &ret, &ret_len);
- }
-
- p = strrchr(ret, '.');
-
- if (p) {
- idx = p - ret;
- add_assoc_stringl(tmp, "extension", ret + idx + 1, ret_len - idx - 1, 1);
- }
-
- if (!have_basename) {
- efree(ret);
- }
- }
-
- if (opt == PHP_PATHINFO_ALL) {
- *return_value = *tmp;
- } else {
- zval **element;
- if (zend_hash_get_current_data(Z_ARRVAL_P(tmp), (void **) &element) == SUCCESS) {
- *return_value = **element;
- } else {
- ZVAL_EMPTY_STRING(return_value);
- }
- }
-
- zval_copy_ctor(return_value);
- zval_dtor(tmp);
- efree(tmp);
-}
-/* }}} */
-
-/* {{{ php_stristr
- case insensitve strstr */
-PHPAPI char *php_stristr(unsigned char *s, unsigned char *t, size_t s_len, size_t t_len)
-{
- php_strtolower(s, s_len);
- php_strtolower(t, t_len);
- return php_memnstr(s, t, t_len, s + s_len);
-}
-/* }}} */
-
-/* {{{ php_strspn
- */
-PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end)
-{
- register const char *p = s1, *spanp;
- register char c = *p;
-
-cont:
- for (spanp = s2; p != s1_end && spanp != s2_end;) {
- if (*spanp++ == c) {
- c = *(++p);
- goto cont;
- }
- }
- return (p - s1);
-}
-/* }}} */
-
-/* {{{ php_strcspn
- */
-PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end)
-{
- register const char *p, *spanp;
- register char c = *s1;
-
- for (p = s1;;) {
- spanp = s2;
- do {
- if (*spanp == c || p == s1_end) {
- return p - s1;
- }
- } while (spanp++ < s2_end);
- c = *++p;
- }
- /* NOTREACHED */
-}
-/* }}} */
-
-/* {{{ proto string stristr(string haystack, string needle)
- Finds first occurrence of a string within another, case insensitive */
-PHP_FUNCTION(stristr)
-{
- zval **haystack, **needle;
- char *found = NULL;
- int found_offset;
- char *haystack_orig;
- char needle_char[2];
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &haystack, &needle) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- SEPARATE_ZVAL(haystack);
- SEPARATE_ZVAL(needle);
-
- convert_to_string_ex(haystack);
-
- haystack_orig = estrndup(Z_STRVAL_PP(haystack), Z_STRLEN_PP(haystack));
-
- if (Z_TYPE_PP(needle) == IS_STRING) {
- if (!Z_STRLEN_PP(needle)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter.");
- efree(haystack_orig);
- zval_ptr_dtor(haystack);
- zval_ptr_dtor(needle);
- RETURN_FALSE;
- }
-
- found = php_stristr(Z_STRVAL_PP(haystack),
- Z_STRVAL_PP(needle),
- Z_STRLEN_PP(haystack),
- Z_STRLEN_PP(needle));
- } else {
- convert_to_long_ex(needle);
- needle_char[0] = (char) Z_LVAL_PP(needle);
- needle_char[1] = 0;
-
- found = php_stristr(Z_STRVAL_PP(haystack),
- needle_char,
- Z_STRLEN_PP(haystack),
- 1);
- }
-
- if (found) {
- found_offset = found - Z_STRVAL_PP(haystack);
- RETVAL_STRINGL(haystack_orig + found_offset, Z_STRLEN_PP(haystack) - found_offset, 1);
- } else {
- RETVAL_FALSE;
- }
-
- zval_ptr_dtor(haystack);
- zval_ptr_dtor(needle);
- efree(haystack_orig);
-}
-/* }}} */
-
-/* {{{ proto string strstr(string haystack, string needle)
- Finds first occurrence of a string within another */
-PHP_FUNCTION(strstr)
-{
- zval **haystack, **needle;
- char *found = NULL;
- char needle_char[2];
- long found_offset;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &haystack, &needle) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(haystack);
-
- if (Z_TYPE_PP(needle) == IS_STRING) {
- if (!Z_STRLEN_PP(needle)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter.");
- RETURN_FALSE;
- }
-
- found = php_memnstr(Z_STRVAL_PP(haystack),
- Z_STRVAL_PP(needle),
- Z_STRLEN_PP(needle),
- Z_STRVAL_PP(haystack) + Z_STRLEN_PP(haystack));
- } else {
- convert_to_long_ex(needle);
- needle_char[0] = (char) Z_LVAL_PP(needle);
- needle_char[1] = 0;
-
- found = php_memnstr(Z_STRVAL_PP(haystack),
- needle_char,
- 1,
- Z_STRVAL_PP(haystack) + Z_STRLEN_PP(haystack));
- }
-
- if (found) {
- found_offset = found - Z_STRVAL_PP(haystack);
- RETURN_STRINGL(found, Z_STRLEN_PP(haystack) - found_offset, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string strchr(string haystack, string needle)
- An alias for strstr */
-/* }}} */
-
-/* {{{ proto int strpos(string haystack, string needle [, int offset])
- Finds position of first occurrence of a string within another */
-PHP_FUNCTION(strpos)
-{
- zval **haystack, **needle, **z_offset;
- char *found = NULL;
- char needle_char[2];
- int offset = 0;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &haystack, &needle, &z_offset) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(haystack);
-
- if (argc > 2) {
- convert_to_long_ex(z_offset);
- offset = Z_LVAL_PP(z_offset);
- }
-
- if (offset < 0 || offset > Z_STRLEN_PP(haystack)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string.");
- RETURN_FALSE;
- }
-
- if (Z_TYPE_PP(needle) == IS_STRING) {
- if (!Z_STRLEN_PP(needle)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter.");
- RETURN_FALSE;
- }
-
- found = php_memnstr(Z_STRVAL_PP(haystack) + offset,
- Z_STRVAL_PP(needle),
- Z_STRLEN_PP(needle),
- Z_STRVAL_PP(haystack) + Z_STRLEN_PP(haystack));
- } else {
- convert_to_long_ex(needle);
- needle_char[0] = (char) Z_LVAL_PP(needle);
- needle_char[1] = 0;
-
- found = php_memnstr(Z_STRVAL_PP(haystack) + offset,
- needle_char,
- 1,
- Z_STRVAL_PP(haystack) + Z_STRLEN_PP(haystack));
- }
-
- if (found) {
- RETURN_LONG(found - Z_STRVAL_PP(haystack));
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int stripos(string haystack, string needle [, int offset])
- Finds position of first occurrence of a string within another, case insensitive */
-PHP_FUNCTION(stripos)
-{
- char *found = NULL;
- char *haystack;
- int haystack_len;
- long offset = 0;
- char *needle_dup = NULL, *haystack_dup;
- char needle_char[2];
- zval *needle;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) {
- return;
- }
-
- if (offset < 0 || offset > haystack_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string.");
- RETURN_FALSE;
- }
-
- haystack_dup = estrndup(haystack, haystack_len);
- php_strtolower(haystack_dup, haystack_len);
-
- if (Z_TYPE_P(needle) == IS_STRING) {
- needle_dup = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle));
- php_strtolower(needle_dup, Z_STRLEN_P(needle));
- found = php_memnstr(haystack_dup + offset, needle_dup, Z_STRLEN_P(needle), haystack_dup + haystack_len);
- } else {
- switch (Z_TYPE_P(needle)) {
- case IS_LONG:
- case IS_BOOL:
- needle_char[0] = tolower((char) Z_LVAL_P(needle));
- break;
- case IS_DOUBLE:
- needle_char[0] = tolower((char) Z_DVAL_P(needle));
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "needle is not a string or an integer.");
- efree(haystack_dup);
- RETURN_FALSE;
- break;
-
- }
- needle_char[1] = '\0';
- found = php_memnstr(haystack_dup + offset,
- needle_char,
- sizeof(needle_char) - 1,
- haystack_dup + haystack_len);
- }
-
- efree(haystack_dup);
- if (needle_dup) {
- efree(needle_dup);
- }
-
- if (found) {
- RETURN_LONG(found - haystack_dup);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int strrpos(string haystack, string needle [, int offset])
- Finds position of last occurrence of a string within another string */
-PHP_FUNCTION(strrpos)
-{
- char *needle, *haystack;
- int needle_len, haystack_len, offset = 0;
- char *p, *e;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &haystack, &haystack_len, &needle, &needle_len, &offset) == FAILURE) {
- RETURN_FALSE;
- }
-
- if ((haystack_len == 0) || (needle_len == 0)) {
- RETURN_FALSE;
- }
-
- if (offset >= 0) {
- p = haystack + offset;
- e = haystack + haystack_len - needle_len;
- } else {
- p = haystack;
- if (needle_len > -offset) {
- e = haystack + haystack_len - needle_len;
- } else {
- e = haystack + haystack_len + offset;
- }
- }
-
- while (e >= p) {
- if (memcmp(e, needle, needle_len) == 0) {
- RETURN_LONG(e - p);
- }
- e--;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int strripos(string haystack, string needle [, int offset])
- Finds position of last occurrence of a string within another string */
-PHP_FUNCTION(strripos)
-{
- char *needle, *haystack;
- int needle_len, haystack_len, offset = 0;
- char *p, *e;
- char *needle_dup, *haystack_dup;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &haystack, &haystack_len, &needle, &needle_len, &offset) == FAILURE) {
- RETURN_FALSE;
- }
-
- if ((haystack_len == 0) || (needle_len == 0)) {
- RETURN_FALSE;
- }
-
- needle_dup = estrndup(needle, needle_len);
- php_strtolower(needle_dup, needle_len);
- haystack_dup = estrndup(haystack, haystack_len);
- php_strtolower(haystack_dup, haystack_len);
-
- if (offset >= 0) {
- p = haystack_dup + offset;
- e = haystack_dup + haystack_len - needle_len;
- } else {
- p = haystack_dup;
- if (needle_len > -offset) {
- e = haystack_dup + haystack_len - needle_len;
- } else {
- e = haystack_dup + haystack_len + offset;
- }
- }
-
- while (e >= p) {
- if (memcmp(e, needle_dup, needle_len) == 0) {
- efree(haystack_dup);
- efree(needle_dup);
- RETURN_LONG(e - p);
- }
- e--;
- }
-
- efree(haystack_dup);
- efree(needle_dup);
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string strrchr(string haystack, string needle)
- Finds the last occurrence of a character in a string within another */
-PHP_FUNCTION(strrchr)
-{
- zval **haystack, **needle;
- char *found = NULL;
- long found_offset;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &haystack, &needle) ==
- FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(haystack);
-
- if (Z_TYPE_PP(needle) == IS_STRING) {
- found = strrchr(Z_STRVAL_PP(haystack), *Z_STRVAL_PP(needle));
- } else {
- convert_to_long_ex(needle);
- found = strrchr(Z_STRVAL_PP(haystack), (char) Z_LVAL_PP(needle));
- }
-
- if (found) {
- found_offset = found - Z_STRVAL_PP(haystack);
- RETURN_STRINGL(found, Z_STRLEN_PP(haystack) - found_offset, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_chunk_split
- */
-static char *php_chunk_split(char *src, int srclen, char *end, int endlen, int chunklen, int *destlen)
-{
- char *dest;
- char *p, *q;
- int chunks; /* complete chunks! */
- int restlen;
-
- chunks = srclen / chunklen;
- restlen = srclen - chunks * chunklen; /* srclen % chunklen */
-
- dest = emalloc((srclen + (chunks + 1) * endlen + 1) * sizeof(char));
-
- for (p = src, q = dest; p < (src + srclen - chunklen + 1); ) {
- memcpy(q, p, chunklen);
- q += chunklen;
- memcpy(q, end, endlen);
- q += endlen;
- p += chunklen;
- }
-
- if (restlen) {
- memcpy(q, p, restlen);
- q += restlen;
- memcpy(q, end, endlen);
- q += endlen;
- }
-
- *q = '\0';
- if (destlen) {
- *destlen = q - dest;
- }
-
- return(dest);
-}
-/* }}} */
-
-/* {{{ proto string chunk_split(string str [, int chunklen [, string ending]])
- Returns split line */
-PHP_FUNCTION(chunk_split)
-{
- zval **p_str, **p_chunklen, **p_ending;
- char *result;
- char *end = "\r\n";
- int endlen = 2;
- int chunklen = 76;
- int result_len;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 1 || argc > 3 || zend_get_parameters_ex(argc, &p_str, &p_chunklen, &p_ending) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(p_str);
-
- if (argc > 1) {
- convert_to_long_ex(p_chunklen);
- chunklen = Z_LVAL_PP(p_chunklen);
- }
-
- if (argc > 2) {
- convert_to_string_ex(p_ending);
- end = Z_STRVAL_PP(p_ending);
- endlen = Z_STRLEN_PP(p_ending);
- }
-
- if (chunklen <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Chunk length should be greater than zero.");
- RETURN_FALSE;
- }
-
- if (!Z_STRLEN_PP(p_str)) {
- RETURN_EMPTY_STRING();
- }
-
- result = php_chunk_split(Z_STRVAL_PP(p_str), Z_STRLEN_PP(p_str), end, endlen, chunklen, &result_len);
-
- if (result) {
- RETURN_STRINGL(result, result_len, 0);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string substr(string str, int start [, int length])
- Returns part of a string */
-PHP_FUNCTION(substr)
-{
- zval **str, **from, **len;
- int l;
- int f;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &str, &from, &len) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(str);
- convert_to_long_ex(from);
-
- if (argc > 2) {
- convert_to_long_ex(len);
- l = Z_LVAL_PP(len);
- } else {
- l = Z_STRLEN_PP(str);
- }
-
- f = Z_LVAL_PP(from);
-
- /* if "from" position is negative, count start position from the end
- * of the string
- */
- if (f < 0) {
- f = Z_STRLEN_PP(str) + f;
- if (f < 0) {
- f = 0;
- }
- }
-
- /* if "length" position is negative, set it to the length
- * needed to stop that many chars from the end of the string
- */
- if (l < 0) {
- l = (Z_STRLEN_PP(str) - f) + l;
- if (l < 0) {
- l = 0;
- }
- }
-
- if (f >= Z_STRLEN_PP(str)) {
- RETURN_FALSE;
- }
-
- if ((f + l) > Z_STRLEN_PP(str)) {
- l = Z_STRLEN_PP(str) - f;
- }
-
- RETURN_STRINGL(Z_STRVAL_PP(str) + f, l, 1);
-}
-/* }}} */
-
-
-/* {{{ proto mixed substr_replace(mixed str, mixed repl, mixed start [, mixed length])
- Replaces part of a string with another string */
-PHP_FUNCTION(substr_replace)
-{
- zval **str;
- zval **from;
- zval **len = NULL;
- zval **repl;
- char *result;
- int result_len;
- int l;
- int f;
- int argc = ZEND_NUM_ARGS();
-
- HashPosition pos_str, pos_from, pos_repl, pos_len;
- zval **tmp_str = NULL, **tmp_from = NULL, **tmp_repl = NULL, **tmp_len= NULL;
-
-
- if (argc < 3 || argc > 4 || zend_get_parameters_ex(argc, &str, &repl, &from, &len) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(str) != IS_ARRAY) {
- convert_to_string_ex(str);
- }
- if (Z_TYPE_PP(repl) != IS_ARRAY) {
- convert_to_string_ex(repl);
- }
- if (Z_TYPE_PP(from) != IS_ARRAY) {
- convert_to_long_ex(from);
- }
-
- if (argc > 3) {
- if (Z_TYPE_PP(len) != IS_ARRAY) {
- convert_to_long_ex(len);
- l = Z_LVAL_PP(len);
- }
- } else {
- if (Z_TYPE_PP(str) != IS_ARRAY) {
- l = Z_STRLEN_PP(str);
- }
- }
-
- if (Z_TYPE_PP(str) == IS_STRING) {
- if (
- (argc == 3 && Z_TYPE_PP(from) == IS_ARRAY)
- ||
- (argc == 4 && Z_TYPE_PP(from) != Z_TYPE_PP(len))
- ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "'from' and 'len' should be of same type - numerical or array ");
- RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
- }
- if (argc == 4 && Z_TYPE_PP(from) == IS_ARRAY) {
- if (zend_hash_num_elements(Z_ARRVAL_PP(from)) != zend_hash_num_elements(Z_ARRVAL_PP(len))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "'from' and 'len' should have the same number of elements");
- RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
- }
- }
- }
-
-
- if (Z_TYPE_PP(str) != IS_ARRAY) {
- if (Z_TYPE_PP(from) != IS_ARRAY) {
- int repl_len = 0;
-
- f = Z_LVAL_PP(from);
-
- /* if "from" position is negative, count start position from the end
- * of the string
- */
- if (f < 0) {
- f = Z_STRLEN_PP(str) + f;
- if (f < 0) {
- f = 0;
- }
- } else if (f > Z_STRLEN_PP(str)) {
- f = Z_STRLEN_PP(str);
- }
- /* if "length" position is negative, set it to the length
- * needed to stop that many chars from the end of the string
- */
- if (l < 0) {
- l = (Z_STRLEN_PP(str) - f) + l;
- if (l < 0) {
- l = 0;
- }
- }
-
- if ((f + l) > Z_STRLEN_PP(str)) {
- l = Z_STRLEN_PP(str) - f;
- }
- if (Z_TYPE_PP(repl) == IS_ARRAY) {
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(repl), &pos_repl);
- if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(repl), (void **) &tmp_repl, &pos_repl)) {
- convert_to_string_ex(tmp_repl);
- repl_len = Z_STRLEN_PP(tmp_repl);
- }
- result_len = Z_STRLEN_PP(str) - l + repl_len;
- result = ecalloc(result_len + 1, sizeof(char *));
-
- memcpy(result, Z_STRVAL_PP(str), f);
- if (repl_len) {
- memcpy(&result[f], Z_STRVAL_PP(tmp_repl), repl_len);
- }
- } else {
- repl_len = Z_STRLEN_PP(repl);
- result_len = Z_STRLEN_PP(str) - l + repl_len;
- result = ecalloc(result_len + 1, sizeof(char *));
-
- memcpy(result, Z_STRVAL_PP(str), f);
- memcpy(&result[f], Z_STRVAL_PP(repl), repl_len);
- }
- memcpy(&result[f + repl_len], Z_STRVAL_PP(str) + f + l, Z_STRLEN_PP(str) - f - l);
- RETURN_STRINGL(result, result_len, 0);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Functionality of 'from' and 'len' as arrays is not implemented.");
- RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
- }
- } else { /* str is array of strings */
-
- array_init(return_value);
-
- if (Z_TYPE_PP(from) == IS_ARRAY) {
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(from), &pos_from);
- }
-
- if (argc > 3 && Z_TYPE_PP(len) == IS_ARRAY) {
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(len), &pos_len);
- }
-
- if (Z_TYPE_PP(repl) == IS_ARRAY) {
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(repl), &pos_repl);
- }
-
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(str), &pos_str);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(str), (void **) &tmp_str, &pos_str) == SUCCESS) {
- convert_to_string_ex(tmp_str);
-
- if (Z_TYPE_PP(from) == IS_ARRAY) {
- if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(from), (void **) &tmp_from, &pos_from)) {
- convert_to_long_ex(tmp_from);
-
- f = Z_LVAL_PP(tmp_from);
- if (f < 0) {
- f = Z_STRLEN_PP(tmp_str) + f;
- if (f < 0) {
- f = 0;
- }
- } else if (f > Z_STRLEN_PP(tmp_str)) {
- f = Z_STRLEN_PP(tmp_str);
- }
- zend_hash_move_forward_ex(Z_ARRVAL_PP(from), &pos_from);
- } else {
- f = 0;
- }
- } else {
- f = Z_LVAL_PP(from);
- if (f < 0) {
- f = Z_STRLEN_PP(tmp_str) + f;
- if (f < 0) {
- f = 0;
- }
- } else if (f > Z_STRLEN_PP(tmp_str)) {
- f = Z_STRLEN_PP(tmp_str);
- }
- }
-
-
- if (argc > 3 && Z_TYPE_PP(len) == IS_ARRAY) {
- if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(len), (void **) &tmp_len, &pos_len)) {
- convert_to_long_ex(tmp_len);
-
- l = Z_LVAL_PP(tmp_len);
- zend_hash_move_forward_ex(Z_ARRVAL_PP(len), &pos_len);
- } else {
- l = Z_STRLEN_PP(tmp_str);
- }
- } else if (argc > 3) {
- l = Z_LVAL_PP(len);
- } else {
- l = Z_STRLEN_PP(tmp_str);
- }
-
- if (l < 0) {
- l = (Z_STRLEN_PP(tmp_str) - f) + l;
- if (l < 0) {
- l = 0;
- }
- }
-
-
- if ((f + l) > Z_STRLEN_PP(tmp_str)) {
- l = Z_STRLEN_PP(tmp_str) - f;
- }
-
- result_len = Z_STRLEN_PP(tmp_str) - l;
-
- if (Z_TYPE_PP(repl) == IS_ARRAY) {
- if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(repl), (void **) &tmp_repl, &pos_repl)) {
- convert_to_string_ex(tmp_repl);
- result_len += Z_STRLEN_PP(tmp_repl);
- zend_hash_move_forward_ex(Z_ARRVAL_PP(repl), &pos_repl);
- result = ecalloc(result_len + 1, sizeof(char *));
-
- memcpy(result, Z_STRVAL_PP(tmp_str), f);
- memcpy(&result[f], Z_STRVAL_PP(tmp_repl), Z_STRLEN_PP(tmp_repl));
- memcpy(&result[f + Z_STRLEN_PP(tmp_repl)], Z_STRVAL_PP(tmp_str) + f + l, Z_STRLEN_PP(tmp_str) - f - l);
- } else {
- result = ecalloc(result_len + 1, sizeof(char *));
-
- memcpy(result, Z_STRVAL_PP(tmp_str), f);
- memcpy(&result[f], Z_STRVAL_PP(tmp_str) + f + l, Z_STRLEN_PP(tmp_str) - f - l);
- }
-
- } else {
- result_len += Z_STRLEN_PP(repl);
-
- result = ecalloc(result_len + 1, sizeof(char *));
-
-
- memcpy(result, Z_STRVAL_PP(tmp_str), f);
- memcpy(&result[f], Z_STRVAL_PP(repl), Z_STRLEN_PP(repl));
- memcpy(&result[f + Z_STRLEN_PP(repl)], Z_STRVAL_PP(tmp_str) + f + l, Z_STRLEN_PP(tmp_str) - f - l);
- }
-
-
- add_next_index_stringl(return_value, result, result_len, 0);
-
- zend_hash_move_forward_ex(Z_ARRVAL_PP(str), &pos_str);
- } /*while*/
- } /* if */
-}
-/* }}} */
-
-
-
-
-/* {{{ proto string quotemeta(string str)
- Quotes meta characters */
-PHP_FUNCTION(quotemeta)
-{
- zval **arg;
- char *str, *old;
- char *old_end;
- char *p, *q;
- char c;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg);
-
- old = Z_STRVAL_PP(arg);
- old_end = Z_STRVAL_PP(arg) + Z_STRLEN_PP(arg);
-
- if (old == old_end) {
- RETURN_FALSE;
- }
-
- str = emalloc(2 * Z_STRLEN_PP(arg) + 1);
-
- for (p = old, q = str; p != old_end; p++) {
- c = *p;
- switch (c) {
- case '.':
- case '\\':
- case '+':
- case '*':
- case '?':
- case '[':
- case '^':
- case ']':
- case '$':
- case '(':
- case ')':
- *q++ = '\\';
- /* break is missing _intentionally_ */
- default:
- *q++ = c;
- }
- }
- *q = 0;
-
- RETURN_STRINGL(erealloc(str, q - str + 1), q - str, 0);
-}
-/* }}} */
-
-/* {{{ proto int ord(string character)
- Returns ASCII value of character */
-PHP_FUNCTION(ord)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- RETURN_LONG((unsigned char) Z_STRVAL_PP(str)[0]);
-}
-/* }}} */
-
-/* {{{ proto string chr(int ascii)
- Converts ASCII code to a character */
-PHP_FUNCTION(chr)
-{
- zval **num;
- char temp[2];
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(num);
-
- temp[0] = (char) Z_LVAL_PP(num);
- temp[1] = 0;
-
- RETVAL_STRINGL(temp, 1, 1);
-}
-/* }}} */
-
-/* {{{ proto string ucfirst(string str)
- Makes a string's first character uppercase */
-PHP_FUNCTION(ucfirst)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- if (!Z_STRLEN_PP(str)) {
- RETURN_EMPTY_STRING();
- }
-
- ZVAL_STRINGL(return_value, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
- *Z_STRVAL_P(return_value) = toupper((unsigned char) *Z_STRVAL_P(return_value));
-}
-/* }}} */
-
-/* {{{ proto string ucwords(string str)
- Uppercase the first character of every word in a string */
-PHP_FUNCTION(ucwords)
-{
- zval **str;
- register char *r, *r_end;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- if (!Z_STRLEN_PP(str)) {
- RETURN_EMPTY_STRING();
- }
-
- ZVAL_STRINGL(return_value, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
- r = Z_STRVAL_P(return_value);
-
- *r = toupper((unsigned char) *r);
- for (r_end = r + Z_STRLEN_P(return_value) - 1; r < r_end; ) {
- if (isspace((int) *(unsigned char *)r++)) {
- *r = toupper((unsigned char) *r);
- }
- }
-}
-/* }}} */
-
-/* {{{ php_strtr
- */
-PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen)
-{
- int i;
- unsigned char xlat[256];
-
- if ((trlen < 1) || (len < 1)) {
- return str;
- }
-
- for (i = 0; i < 256; xlat[i] = i, i++);
-
- for (i = 0; i < trlen; i++) {
- xlat[(unsigned char) str_from[i]] = str_to[i];
- }
-
- for (i = 0; i < len; i++) {
- str[i] = xlat[(unsigned char) str[i]];
- }
-
- return str;
-}
-/* }}} */
-
-/* {{{ php_strtr_array
- */
-static void php_strtr_array(zval *return_value, char *str, int slen, HashTable *hash)
-{
- zval **entry;
- char *string_key;
- uint string_key_len;
- zval **trans;
- zval ctmp;
- ulong num_key;
- int minlen = 128*1024;
- int maxlen = 0, pos, len, found;
- char *key;
- HashPosition hpos;
- smart_str result = {0};
-
- zend_hash_internal_pointer_reset_ex(hash, &hpos);
- while (zend_hash_get_current_data_ex(hash, (void **)&entry, &hpos) == SUCCESS) {
- switch (zend_hash_get_current_key_ex(hash, &string_key, &string_key_len, &num_key, 0, &hpos)) {
- case HASH_KEY_IS_STRING:
- len = string_key_len-1;
- if (len > maxlen) {
- maxlen = len;
- }
- if (len < minlen) {
- minlen = len;
- }
- break;
-
- case HASH_KEY_IS_LONG:
- Z_TYPE(ctmp) = IS_LONG;
- Z_LVAL(ctmp) = num_key;
-
- convert_to_string(&ctmp);
- len = Z_STRLEN(ctmp);
- zval_dtor(&ctmp);
-
- if (len > maxlen) {
- maxlen = len;
- }
- if (len < minlen) {
- minlen = len;
- }
- break;
- }
- zend_hash_move_forward_ex(hash, &hpos);
- }
-
- key = emalloc(maxlen+1);
- pos = 0;
-
- while (pos < slen) {
- if ((pos + maxlen) > slen) {
- maxlen = slen - pos;
- }
-
- found = 0;
- memcpy(key, str+pos, maxlen);
-
- for (len = maxlen; len >= minlen; len--) {
- key[len] = 0;
-
- if (zend_hash_find(hash, key, len+1, (void**)&trans) == SUCCESS) {
- char *tval;
- int tlen;
- zval tmp;
-
- if (Z_TYPE_PP(trans) != IS_STRING) {
- tmp = **trans;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- tval = Z_STRVAL(tmp);
- tlen = Z_STRLEN(tmp);
- } else {
- tval = Z_STRVAL_PP(trans);
- tlen = Z_STRLEN_PP(trans);
- }
-
- smart_str_appendl(&result, tval, tlen);
- pos += len;
- found = 1;
-
- if (Z_TYPE_PP(trans) != IS_STRING) {
- zval_dtor(&tmp);
- }
- break;
- }
- }
-
- if (! found) {
- smart_str_appendc(&result, str[pos++]);
- }
- }
-
- efree(key);
- smart_str_0(&result);
- RETVAL_STRINGL(result.c, result.len, 0);
-}
-/* }}} */
-
-/* {{{ proto string strtr(string str, string from, string to)
- Translates characters in str using given translation tables */
-PHP_FUNCTION(strtr)
-{
- zval **str, **from, **to;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 2 || ac > 3 || zend_get_parameters_ex(ac, &str, &from, &to) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (ac == 2 && Z_TYPE_PP(from) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The second argument is not an array.");
- RETURN_FALSE;
- }
-
- convert_to_string_ex(str);
-
- /* shortcut for empty string */
- if (Z_STRLEN_PP(str) == 0) {
- RETURN_EMPTY_STRING();
- }
-
- if (ac == 2) {
- php_strtr_array(return_value, Z_STRVAL_PP(str), Z_STRLEN_PP(str), HASH_OF(*from));
- } else {
- convert_to_string_ex(from);
- convert_to_string_ex(to);
-
- ZVAL_STRINGL(return_value, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
-
- php_strtr(Z_STRVAL_P(return_value),
- Z_STRLEN_P(return_value),
- Z_STRVAL_PP(from),
- Z_STRVAL_PP(to),
- MIN(Z_STRLEN_PP(from),
- Z_STRLEN_PP(to)));
- }
-}
-/* }}} */
-
-/* {{{ proto string strrev(string str)
- Reverse a string */
-PHP_FUNCTION(strrev)
-{
- zval **str;
- char *s, *e, *n, *p;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- n = emalloc(Z_STRLEN_PP(str)+1);
- p = n;
-
- s = Z_STRVAL_PP(str);
- e = s + Z_STRLEN_PP(str);
-
- while (--e>=s) {
- *p++ = *e;
- }
-
- *p = '\0';
-
- RETVAL_STRINGL(n, Z_STRLEN_PP(str), 0);
-}
-/* }}} */
-
-/* {{{ php_similar_str
- */
-static void php_similar_str(const char *txt1, int len1, const char *txt2, int len2, int *pos1, int *pos2, int *max)
-{
- char *p, *q;
- char *end1 = (char *) txt1 + len1;
- char *end2 = (char *) txt2 + len2;
- int l;
-
- *max = 0;
- for (p = (char *) txt1; p < end1; p++) {
- for (q = (char *) txt2; q < end2; q++) {
- for (l = 0; (p + l < end1) && (q + l < end2) && (p[l] == q[l]); l++);
- if (l > *max) {
- *max = l;
- *pos1 = p - txt1;
- *pos2 = q - txt2;
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ php_similar_char
- */
-static int php_similar_char(const char *txt1, int len1, const char *txt2, int len2)
-{
- int sum;
- int pos1, pos2, max;
-
- php_similar_str(txt1, len1, txt2, len2, &pos1, &pos2, &max);
- if ((sum = max)) {
- if (pos1 && pos2) {
- sum += php_similar_char(txt1, pos1,
- txt2, pos2);
- }
- if ((pos1 + max < len1) && (pos2 + max < len2)) {
- sum += php_similar_char(txt1 + pos1 + max, len1 - pos1 - max,
- txt2 + pos2 + max, len2 - pos2 - max);
- }
- }
-
- return sum;
-}
-/* }}} */
-
-/* {{{ proto int similar_text(string str1, string str2 [, float percent])
- Calculates the similarity between two strings */
-PHP_FUNCTION(similar_text)
-{
- zval **t1, **t2, **percent;
- int ac = ZEND_NUM_ARGS();
- int sim;
-
- if (ac < 2 || ac > 3 || zend_get_parameters_ex(ac, &t1, &t2, &percent) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(t1);
- convert_to_string_ex(t2);
-
- if (ac > 2) {
- convert_to_double_ex(percent);
- }
-
- if (Z_STRLEN_PP(t1) + Z_STRLEN_PP(t2) == 0) {
- if (ac > 2) {
- Z_DVAL_PP(percent) = 0;
- }
-
- RETURN_LONG(0);
- }
-
- sim = php_similar_char(Z_STRVAL_PP(t1), Z_STRLEN_PP(t1), Z_STRVAL_PP(t2), Z_STRLEN_PP(t2));
-
- if (ac > 2) {
- Z_DVAL_PP(percent) = sim * 200.0 / (Z_STRLEN_PP(t1) + Z_STRLEN_PP(t2));
- }
-
- RETURN_LONG(sim);
-}
-/* }}} */
-
-/* {{{ php_stripslashes
- *
- * be careful, this edits the string in-place */
-PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC)
-{
- char *s, *t;
- int l;
-
- if (len != NULL) {
- l = *len;
- } else {
- l = strlen(str);
- }
- s = str;
- t = str;
-
- if (PG(magic_quotes_sybase)) {
- while (l > 0) {
- if (*t == '\'') {
- if ((l > 0) && (t[1] == '\'')) {
- t++;
- if (len != NULL) {
- (*len)--;
- }
- l--;
- }
- *s++ = *t++;
- } else if (*t == '\\' && t[1] == '0' && l > 0) {
- *s++='\0';
- t+=2;
- if (len != NULL) {
- (*len)--;
- }
- l--;
- } else {
- *s++ = *t++;
- }
- l--;
- }
- *s = '\0';
-
- return;
- }
-
- while (l > 0) {
- if (*t == '\\') {
- t++; /* skip the slash */
- if (len != NULL) {
- (*len)--;
- }
- l--;
- if (l > 0) {
- if (*t == '0') {
- *s++='\0';
- t++;
- } else {
- *s++ = *t++; /* preserve the next character */
- }
- l--;
- }
- } else {
- *s++ = *t++;
- l--;
- }
- }
- if (s != t) {
- *s = '\0';
- }
-}
-/* }}} */
-
-/* {{{ proto string addcslashes(string str, string charlist)
- Escapes all chars mentioned in charlist with backslash. It creates octal representations if asked to backslash characters with 8th bit set or with ASCII<32 (except '\n', '\r', '\t' etc...) */
-PHP_FUNCTION(addcslashes)
-{
- zval **str, **what;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &str, &what) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
- convert_to_string_ex(what);
-
- if (Z_STRLEN_PP(str) == 0) {
- RETURN_EMPTY_STRING();
- }
-
- if (Z_STRLEN_PP(what) == 0) {
- RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
- }
-
- RETURN_STRING(php_addcslashes(Z_STRVAL_PP(str),
- Z_STRLEN_PP(str),
- &Z_STRLEN_P(return_value), 0,
- Z_STRVAL_PP(what),
- Z_STRLEN_PP(what) TSRMLS_CC), 0);
-}
-/* }}} */
-
-/* {{{ proto string addslashes(string str)
- Escapes single quote, double quotes and backslash characters in a string with backslashes */
-PHP_FUNCTION(addslashes)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- if (Z_STRLEN_PP(str) == 0) {
- RETURN_EMPTY_STRING();
- }
-
- RETURN_STRING(php_addslashes(Z_STRVAL_PP(str),
- Z_STRLEN_PP(str),
- &Z_STRLEN_P(return_value), 0
- TSRMLS_CC), 0);
-}
-/* }}} */
-
-/* {{{ proto string stripcslashes(string str)
- Strips backslashes from a string. Uses C-style conventions */
-PHP_FUNCTION(stripcslashes)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- ZVAL_STRINGL(return_value, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
- php_stripcslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value));
-}
-/* }}} */
-
-/* {{{ proto string stripslashes(string str)
- Strips backslashes from a string */
-PHP_FUNCTION(stripslashes)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- ZVAL_STRINGL(return_value, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
- php_stripslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value) TSRMLS_CC);
-}
-/* }}} */
-
-#ifndef HAVE_STRERROR
-/* {{{ php_strerror
- */
-char *php_strerror(int errnum)
-{
- extern int sys_nerr;
- extern char *sys_errlist[];
- TSRMLS_FETCH();
-
- if ((unsigned int) errnum < sys_nerr) {
- return(sys_errlist[errnum]);
- }
-
- (void) sprintf(BG(str_ebuf), "Unknown error: %d", errnum);
- return(BG(str_ebuf));
-}
-/* }}} */
-#endif
-
-/* {{{ php_stripcslashes
- */
-PHPAPI void php_stripcslashes(char *str, int *len)
-{
- char *source, *target, *end;
- int nlen = *len, i;
- char numtmp[4];
-
- for (source=str, end=str+nlen, target=str; source < end; source++) {
- if (*source == '\\' && source+1 < end) {
- source++;
- switch (*source) {
- case 'n': *target++='\n'; nlen--; break;
- case 'r': *target++='\r'; nlen--; break;
- case 'a': *target++='\a'; nlen--; break;
- case 't': *target++='\t'; nlen--; break;
- case 'v': *target++='\v'; nlen--; break;
- case 'b': *target++='\b'; nlen--; break;
- case 'f': *target++='\f'; nlen--; break;
- case '\\': *target++='\\'; nlen--; break;
- case 'x':
- if (source+1 < end && isxdigit((int)(*(source+1)))) {
- numtmp[0] = *++source;
- if (source+1 < end && isxdigit((int)(*(source+1)))) {
- numtmp[1] = *++source;
- numtmp[2] = '\0';
- nlen-=3;
- } else {
- numtmp[1] = '\0';
- nlen-=2;
- }
- *target++=(char)strtol(numtmp, NULL, 16);
- break;
- }
- /* break is left intentionally */
- default:
- i=0;
- while (source < end && *source >= '0' && *source <= '7' && i<3) {
- numtmp[i++] = *source++;
- }
- if (i) {
- numtmp[i]='\0';
- *target++=(char)strtol(numtmp, NULL, 8);
- nlen-=i;
- source--;
- } else {
- *target++=*source;
- nlen--;
- }
- }
- } else {
- *target++=*source;
- }
- }
-
- if (nlen != 0) {
- *target='\0';
- }
-
- *len = nlen;
-}
-/* }}} */
-
-/* {{{ php_addcslashes
- */
-PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int should_free, char *what, int wlength TSRMLS_DC)
-{
- char flags[256];
- char *new_str = emalloc((length?length:(length=strlen(str)))*4+1);
- char *source, *target;
- char *end;
- char c;
- int newlen;
-
- if (!wlength) {
- wlength = strlen(what);
- }
-
- if (!length) {
- length = strlen(str);
- }
-
- php_charmask(what, wlength, flags TSRMLS_CC);
-
- for (source = str, end = source + length, target = new_str; (c = *source) || (source < end); source++) {
- if (flags[(unsigned char)c]) {
- if ((unsigned char) c < 32 || (unsigned char) c > 126) {
- *target++ = '\\';
- switch (c) {
- case '\n': *target++ = 'n'; break;
- case '\t': *target++ = 't'; break;
- case '\r': *target++ = 'r'; break;
- case '\a': *target++ = 'a'; break;
- case '\v': *target++ = 'v'; break;
- case '\b': *target++ = 'b'; break;
- case '\f': *target++ = 'f'; break;
- default: target += sprintf(target, "%03o", (unsigned char) c);
- }
- continue;
- }
- *target++ = '\\';
- }
- *target++ = c;
- }
- *target = 0;
- newlen = target - new_str;
- if (target - new_str < length * 4) {
- new_str = erealloc(new_str, newlen + 1);
- }
- if (new_length) {
- *new_length = newlen;
- }
- if (should_free) {
- STR_FREE(str);
- }
- return new_str;
-}
-/* }}} */
-
-/* {{{ php_addslashes
- */
-PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_free TSRMLS_DC)
-{
- /* maximum string length, worst case situation */
- char *new_str;
- char *source, *target;
- char *end;
- int local_new_length;
-
- if (!new_length) {
- new_length = &local_new_length;
- }
- if (!str) {
- *new_length = 0;
- return str;
- }
- new_str = (char *) emalloc((length ? length : (length = strlen(str))) * 2 + 1);
- source = str;
- end = source + length;
- target = new_str;
-
- if (PG(magic_quotes_sybase)) {
- while (source < end) {
- switch (*source) {
- case '\0':
- *target++ = '\\';
- *target++ = '0';
- break;
- case '\'':
- *target++ = '\'';
- *target++ = '\'';
- break;
- default:
- *target++ = *source;
- break;
- }
- source++;
- }
- } else {
- while (source < end) {
- switch (*source) {
- case '\0':
- *target++ = '\\';
- *target++ = '0';
- break;
- case '\'':
- case '\"':
- case '\\':
- *target++ = '\\';
- /* break is missing *intentionally* */
- default:
- *target++ = *source;
- break;
- }
-
- source++;
- }
- }
-
- *target = 0;
- *new_length = target - new_str;
- if (should_free) {
- STR_FREE(str);
- }
- new_str = (char *) erealloc(new_str, *new_length + 1);
- return new_str;
-}
-/* }}} */
-
-#define _HEB_BLOCK_TYPE_ENG 1
-#define _HEB_BLOCK_TYPE_HEB 2
-#define isheb(c) (((((unsigned char) c) >= 224) && (((unsigned char) c) <= 250)) ? 1 : 0)
-#define _isblank(c) (((((unsigned char) c) == ' ' || ((unsigned char) c) == '\t')) ? 1 : 0)
-#define _isnewline(c) (((((unsigned char) c) == '\n' || ((unsigned char) c) == '\r')) ? 1 : 0)
-
-/* {{{ php_char_to_str
- */
-PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, zval *result)
-{
- int char_count = 0;
- int replaced = 0;
- char *source, *target, *tmp, *source_end=str+len, *tmp_end = NULL;
-
- for (source = str; source < source_end; source++) {
- if (*source == from) {
- char_count++;
- }
- }
-
- if (char_count == 0) {
- ZVAL_STRINGL(result, str, len, 1);
- return 0;
- }
-
- Z_STRLEN_P(result) = len + (char_count * (to_len - 1));
- Z_STRVAL_P(result) = target = emalloc(Z_STRLEN_P(result) + 1);
- Z_TYPE_P(result) = IS_STRING;
-
- for (source = str; source < source_end; source++) {
- if (*source == from) {
- replaced = 1;
- for (tmp = to, tmp_end = tmp+to_len; tmp < tmp_end; tmp++) {
- *target = *tmp;
- target++;
- }
- } else {
- *target = *source;
- target++;
- }
- }
- *target = 0;
- return replaced;
-}
-/* }}} */
-
-/* {{{ php_str_to_str_ex
- */
-PHPAPI char *php_str_to_str_ex(char *haystack, int length,
- char *needle, int needle_len, char *str, int str_len, int *_new_length, int case_sensitivity, int *replace_count)
-{
- char *new_str;
-
- if (needle_len < length) {
- char *end, *haystack_dup, *needle_dup;
- char *e, *s, *p, *r;
-
- if (needle_len == str_len) {
- new_str = estrndup(haystack, length);
- *_new_length = length;
-
- if (case_sensitivity) {
- end = new_str + length;
- for (p = new_str; (r = php_memnstr(p, needle, needle_len, end)); p = r + needle_len) {
- memcpy(r, str, str_len);
- if (replace_count) {
- (*replace_count)++;
- }
- }
- } else {
- haystack_dup = estrndup(haystack, length);
- needle_dup = estrndup(needle, needle_len);
- php_strtolower(haystack_dup, length);
- php_strtolower(needle_dup, needle_len);
- end = haystack_dup + length;
- for (p = haystack_dup; (r = php_memnstr(p, needle_dup, needle_len, end)); p = r + needle_len) {
- memcpy(new_str + (r - haystack_dup), str, str_len);
- if (replace_count) {
- (*replace_count)++;
- }
- }
- efree(haystack_dup);
- efree(needle_dup);
- }
- return new_str;
- } else {
- if (str_len < needle_len) {
- new_str = emalloc(length + 1);
- } else {
- new_str = emalloc((length / needle_len + 1) * str_len);
- }
-
- e = s = new_str;
-
- if (case_sensitivity) {
- end = haystack + length;
- for (p = haystack; (r = php_memnstr(p, needle, needle_len, end)); p = r + needle_len) {
- memcpy(e, p, r - p);
- e += r - p;
- memcpy(e, str, str_len);
- e += str_len;
- if (replace_count) {
- (*replace_count)++;
- }
- }
-
- if (p < end) {
- memcpy(e, p, end - p);
- e += end - p;
- }
- } else {
- haystack_dup = estrndup(haystack, length);
- needle_dup = estrndup(needle, needle_len);
- php_strtolower(haystack_dup, length);
- php_strtolower(needle_dup, needle_len);
-
- end = haystack_dup + length;
-
- for (p = haystack_dup; (r = php_memnstr(p, needle_dup, needle_len, end)); p = r + needle_len) {
- memcpy(e, haystack + (p - haystack_dup), r - p);
- e += r - p;
- memcpy(e, str, str_len);
- e += str_len;
- if (replace_count) {
- (*replace_count)++;
- }
- }
-
- if (p < end) {
- memcpy(e, haystack + (p - haystack_dup), end - p);
- e += end - p;
- }
- efree(haystack_dup);
- efree(needle_dup);
- }
-
- *e = '\0';
- *_new_length = e - s;
-
- new_str = erealloc(new_str, *_new_length + 1);
- return new_str;
- }
- } else if (needle_len > length) {
-nothing_todo:
- *_new_length = length;
- new_str = estrndup(haystack, length);
- return new_str;
- } else {
- if (case_sensitivity ? strncmp(haystack, needle, length) : strncasecmp(haystack, needle, length)) {
- goto nothing_todo;
- } else {
- *_new_length = str_len;
- new_str = estrndup(str, str_len);
- if (replace_count) {
- (*replace_count)++;
- }
- return new_str;
- }
- }
-
-}
-/* }}} */
-
-/* {{{ php_str_to_str
- */
-PHPAPI char *php_str_to_str(char *haystack, int length,
- char *needle, int needle_len, char *str, int str_len, int *_new_length)
-{
- return php_str_to_str_ex(haystack, length, needle, needle_len, str, str_len, _new_length, 1, NULL);
-}
-/* }}}
- */
-
-/* {{{ php_str_replace_in_subject
- */
-static void php_str_replace_in_subject(zval *search, zval *replace, zval **subject, zval *result, int case_sensitivity, int *replace_count)
-{
- zval **search_entry,
- **replace_entry = NULL,
- temp_result;
- char *replace_value = NULL;
- int replace_len = 0;
-
- /* Make sure we're dealing with strings. */
- convert_to_string_ex(subject);
- Z_TYPE_P(result) = IS_STRING;
- if (Z_STRLEN_PP(subject) == 0) {
- ZVAL_STRINGL(result, empty_string, 0, 1);
- return;
- }
-
- /* If search is an array */
- if (Z_TYPE_P(search) == IS_ARRAY) {
- /* Duplicate subject string for repeated replacement */
- *result = **subject;
- zval_copy_ctor(result);
- INIT_PZVAL(result);
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(search));
-
- if (Z_TYPE_P(replace) == IS_ARRAY) {
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(replace));
- } else {
- /* Set replacement value to the passed one */
- replace_value = Z_STRVAL_P(replace);
- replace_len = Z_STRLEN_P(replace);
- }
-
- /* For each entry in the search array, get the entry */
- while (zend_hash_get_current_data(Z_ARRVAL_P(search), (void **) &search_entry) == SUCCESS) {
- /* Make sure we're dealing with strings. */
- SEPARATE_ZVAL(search_entry);
- convert_to_string(*search_entry);
- if (Z_STRLEN_PP(search_entry) == 0) {
- zend_hash_move_forward(Z_ARRVAL_P(search));
- continue;
- }
-
- /* If replace is an array. */
- if (Z_TYPE_P(replace) == IS_ARRAY) {
- /* Get current entry */
- if (zend_hash_get_current_data(Z_ARRVAL_P(replace), (void **)&replace_entry) == SUCCESS) {
- /* Make sure we're dealing with strings. */
- convert_to_string_ex(replace_entry);
-
- /* Set replacement value to the one we got from array */
- replace_value = Z_STRVAL_PP(replace_entry);
- replace_len = Z_STRLEN_PP(replace_entry);
-
- zend_hash_move_forward(Z_ARRVAL_P(replace));
- } else {
- /* We've run out of replacement strings, so use an empty one. */
- replace_value = empty_string;
- replace_len = 0;
- }
- }
-
- if (Z_STRLEN_PP(search_entry) == 1) {
- php_char_to_str(Z_STRVAL_P(result),
- Z_STRLEN_P(result),
- Z_STRVAL_PP(search_entry)[0],
- replace_value,
- replace_len,
- &temp_result);
- } else if (Z_STRLEN_PP(search_entry) > 1) {
- Z_STRVAL(temp_result) = php_str_to_str_ex(Z_STRVAL_P(result), Z_STRLEN_P(result),
- Z_STRVAL_PP(search_entry), Z_STRLEN_PP(search_entry),
- replace_value, replace_len, &Z_STRLEN(temp_result), case_sensitivity, replace_count);
- }
-
- efree(Z_STRVAL_P(result));
- Z_STRVAL_P(result) = Z_STRVAL(temp_result);
- Z_STRLEN_P(result) = Z_STRLEN(temp_result);
-
- if (Z_STRLEN_P(result) == 0) {
- return;
- }
-
- zend_hash_move_forward(Z_ARRVAL_P(search));
- }
- } else {
- if (Z_STRLEN_P(search) == 1) {
- php_char_to_str(Z_STRVAL_PP(subject),
- Z_STRLEN_PP(subject),
- Z_STRVAL_P(search)[0],
- Z_STRVAL_P(replace),
- Z_STRLEN_P(replace),
- result);
- } else if (Z_STRLEN_P(search) > 1) {
- Z_STRVAL_P(result) = php_str_to_str_ex(Z_STRVAL_PP(subject), Z_STRLEN_PP(subject),
- Z_STRVAL_P(search), Z_STRLEN_P(search),
- Z_STRVAL_P(replace), Z_STRLEN_P(replace), &Z_STRLEN_P(result), case_sensitivity, replace_count);
- } else {
- *result = **subject;
- zval_copy_ctor(result);
- INIT_PZVAL(result);
- }
- }
-}
-/* }}} */
-
-/* {{{ php_str_replace_common
- */
-static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensitivity)
-{
- zval **subject, **search, **replace, **subject_entry, **zcount;
- zval *result;
- char *string_key;
- uint string_key_len;
- ulong num_key;
- int count = 0;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 3 || argc > 4 ||
- zend_get_parameters_ex(argc, &search, &replace, &subject, &zcount) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- SEPARATE_ZVAL(search);
- SEPARATE_ZVAL(replace);
- SEPARATE_ZVAL(subject);
-
- /* Make sure we're dealing with strings and do the replacement. */
- if (Z_TYPE_PP(search) != IS_ARRAY) {
- convert_to_string_ex(search);
- convert_to_string_ex(replace);
- } else if (Z_TYPE_PP(replace) != IS_ARRAY) {
- convert_to_string_ex(replace);
- }
-
- /* if subject is an array */
- if (Z_TYPE_PP(subject) == IS_ARRAY) {
- array_init(return_value);
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(subject));
-
- /* For each subject entry, convert it to string, then perform replacement
- and add the result to the return_value array. */
- while (zend_hash_get_current_data(Z_ARRVAL_PP(subject), (void **)&subject_entry) == SUCCESS) {
- MAKE_STD_ZVAL(result);
- php_str_replace_in_subject(*search, *replace, subject_entry, result, case_sensitivity, (argc > 3) ? &count : NULL);
- /* Add to return array */
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(subject), &string_key,
- &string_key_len, &num_key, 0, NULL)) {
- case HASH_KEY_IS_STRING:
- add_assoc_zval_ex(return_value, string_key, string_key_len, result);
- break;
-
- case HASH_KEY_IS_LONG:
- add_index_zval(return_value, num_key, result);
- break;
- }
-
- zend_hash_move_forward(Z_ARRVAL_PP(subject));
- }
- } else { /* if subject is not an array */
- php_str_replace_in_subject(*search, *replace, subject, return_value, case_sensitivity, (argc > 3) ? &count : NULL);
- }
- if (argc > 3) {
- Z_LVAL_PP(zcount) = count;
- }
-}
-/* }}} */
-
-/* {{{ proto mixed str_replace(mixed search, mixed replace, mixed subject [, int &replace_count])
- Replaces all occurrences of search in haystack with replace */
-PHP_FUNCTION(str_replace)
-{
- php_str_replace_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto mixed str_ireplace(mixed search, mixed replace, mixed subject [, int &replace_count])
- Replaces all occurrences of search in haystack with replace / case-insensitive */
-PHP_FUNCTION(str_ireplace)
-{
- php_str_replace_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ php_hebrev
- *
- * Converts Logical Hebrew text (Hebrew Windows style) to Visual text
- * Cheers/complaints/flames - Zeev Suraski <zeev@php.net>
- */
-static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
-{
- zval **str, **max_chars_per_line;
- char *heb_str, *tmp, *target, *broken_str;
- int block_start, block_end, block_type, block_length, i;
- long max_chars=0;
- int begin, end, char_count, orig_begin;
-
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &str) == FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &str, &max_chars_per_line) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(max_chars_per_line);
- max_chars = Z_LVAL_PP(max_chars_per_line);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string_ex(str);
-
- if (Z_STRLEN_PP(str) == 0) {
- RETURN_FALSE;
- }
-
- tmp = Z_STRVAL_PP(str);
- block_start=block_end=0;
-
- heb_str = (char *) emalloc(Z_STRLEN_PP(str)+1);
- target = heb_str+Z_STRLEN_PP(str);
- *target = 0;
- target--;
-
- block_length=0;
-
- if (isheb(*tmp)) {
- block_type = _HEB_BLOCK_TYPE_HEB;
- } else {
- block_type = _HEB_BLOCK_TYPE_ENG;
- }
-
- do {
- if (block_type == _HEB_BLOCK_TYPE_HEB) {
- while ((isheb((int)*(tmp+1)) || _isblank((int)*(tmp+1)) || ispunct((int)*(tmp+1)) || (int)*(tmp+1)=='\n' ) && block_end<Z_STRLEN_PP(str)-1) {
- tmp++;
- block_end++;
- block_length++;
- }
- for (i = block_start; i<= block_end; i++) {
- *target = Z_STRVAL_PP(str)[i];
- switch (*target) {
- case '(':
- *target = ')';
- break;
- case ')':
- *target = '(';
- break;
- case '[':
- *target = ']';
- break;
- case ']':
- *target = '[';
- break;
- case '{':
- *target = '}';
- break;
- case '}':
- *target = '{';
- break;
- case '<':
- *target = '>';
- break;
- case '>':
- *target = '<';
- break;
- case '\\':
- *target = '/';
- break;
- case '/':
- *target = '\\';
- break;
- default:
- break;
- }
- target--;
- }
- block_type = _HEB_BLOCK_TYPE_ENG;
- } else {
- while (!isheb(*(tmp+1)) && (int)*(tmp+1)!='\n' && block_end < Z_STRLEN_PP(str)-1) {
- tmp++;
- block_end++;
- block_length++;
- }
- while ((_isblank((int)*tmp) || ispunct((int)*tmp)) && *tmp!='/' && *tmp!='-' && block_end > block_start) {
- tmp--;
- block_end--;
- }
- for (i = block_end; i >= block_start; i--) {
- *target = Z_STRVAL_PP(str)[i];
- target--;
- }
- block_type = _HEB_BLOCK_TYPE_HEB;
- }
- block_start=block_end+1;
- } while (block_end < Z_STRLEN_PP(str)-1);
-
-
- broken_str = (char *) emalloc(Z_STRLEN_PP(str)+1);
- begin=end=Z_STRLEN_PP(str)-1;
- target = broken_str;
-
- while (1) {
- char_count=0;
- while ((!max_chars || char_count < max_chars) && begin > 0) {
- char_count++;
- begin--;
- if (begin <= 0 || _isnewline(heb_str[begin])) {
- while (begin > 0 && _isnewline(heb_str[begin-1])) {
- begin--;
- char_count++;
- }
- break;
- }
- }
- if (char_count == max_chars) { /* try to avoid breaking words */
- int new_char_count=char_count, new_begin=begin;
-
- while (new_char_count > 0) {
- if (_isblank(heb_str[new_begin]) || _isnewline(heb_str[new_begin])) {
- break;
- }
- new_begin++;
- new_char_count--;
- }
- if (new_char_count > 0) {
- char_count=new_char_count;
- begin=new_begin;
- }
- }
- orig_begin=begin;
-
- if (_isblank(heb_str[begin])) {
- heb_str[begin]='\n';
- }
- while (begin <= end && _isnewline(heb_str[begin])) { /* skip leading newlines */
- begin++;
- }
- for (i = begin; i <= end; i++) { /* copy content */
- *target = heb_str[i];
- target++;
- }
- for (i = orig_begin; i <= end && _isnewline(heb_str[i]); i++) {
- *target = heb_str[i];
- target++;
- }
- begin=orig_begin;
-
- if (begin <= 0) {
- *target = 0;
- break;
- }
- begin--;
- end=begin;
- }
- efree(heb_str);
-
- if (convert_newlines) {
- php_char_to_str(broken_str, Z_STRLEN_PP(str),'\n', "<br />\n", 7, return_value);
- efree(broken_str);
- } else {
- Z_STRVAL_P(return_value) = broken_str;
- Z_STRLEN_P(return_value) = Z_STRLEN_PP(str);
- Z_TYPE_P(return_value) = IS_STRING;
- }
-}
-/* }}} */
-
-/* {{{ proto string hebrev(string str [, int max_chars_per_line])
- Converts logical Hebrew text to visual text */
-PHP_FUNCTION(hebrev)
-{
- php_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string hebrevc(string str [, int max_chars_per_line])
- Converts logical Hebrew text to visual text with newline conversion */
-PHP_FUNCTION(hebrevc)
-{
- php_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-/* {{{ proto string nl2br(string str)
- Converts newlines to HTML line breaks */
-PHP_FUNCTION(nl2br)
-{
- /* in brief this inserts <br /> before matched regexp \n\r?|\r\n? */
- zval **zstr;
- char *tmp, *str;
- int new_length;
- char *end, *target;
- int repl_cnt = 0;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(zstr);
-
- str = Z_STRVAL_PP(zstr);
- end = str + Z_STRLEN_PP(zstr);
-
- /* it is really faster to scan twice and allocate mem once insted scanning once
- and constantly reallocing */
- while (str < end) {
- if (*str == '\r') {
- if (*(str+1) == '\n') {
- str++;
- }
- repl_cnt++;
- } else if (*str == '\n') {
- if (*(str+1) == '\r') {
- str++;
- }
- repl_cnt++;
- }
-
- str++;
- }
-
- if (repl_cnt == 0) {
- RETURN_STRINGL(Z_STRVAL_PP(zstr), Z_STRLEN_PP(zstr), 1);
- }
-
- new_length = Z_STRLEN_PP(zstr) + repl_cnt * (sizeof("<br />") - 1);
- tmp = target = emalloc(new_length + 1);
-
- str = Z_STRVAL_PP(zstr);
-
- while (str < end) {
- switch (*str) {
- case '\r':
- case '\n':
- *target++ = '<';
- *target++ = 'b';
- *target++ = 'r';
- *target++ = ' ';
- *target++ = '/';
- *target++ = '>';
-
- if ((*str == '\r' && *(str+1) == '\n') || (*str == '\n' && *(str+1) == '\r')) {
- *target++ = *str++;
- }
- /* lack of a break; is intentional */
- default:
- *target++ = *str;
- }
-
- str++;
- }
-
- *target = '\0';
-
- RETURN_STRINGL(tmp, new_length, 0);
-}
-/* }}} */
-
-
-/* {{{ proto string strip_tags(string str [, string allowable_tags])
- Strips HTML and PHP tags from a string */
-PHP_FUNCTION(strip_tags)
-{
- char *buf;
- zval **str, **allow=NULL;
- char *allowed_tags=NULL;
- int allowed_tags_len=0;
- size_t retval_len;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &str) == FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &str, &allow) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(allow);
- allowed_tags = Z_STRVAL_PP(allow);
- allowed_tags_len = Z_STRLEN_PP(allow);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(str);
- buf = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
- retval_len = php_strip_tags(buf, Z_STRLEN_PP(str), NULL, allowed_tags, allowed_tags_len);
- RETURN_STRINGL(buf, retval_len, 0);
-}
-/* }}} */
-
-/* {{{ proto string setlocale(mixed category, string locale [, string ...])
- Set locale information */
-PHP_FUNCTION(setlocale)
-{
- pval ***args = (pval ***) emalloc(sizeof(pval **)*ZEND_NUM_ARGS());
- zval **pcategory, **plocale;
- int i, cat, n_args=ZEND_NUM_ARGS();
- char *loc, *retval;
-
- if (zend_get_parameters_array_ex(n_args, args) == FAILURE || n_args < 2) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-#ifdef HAVE_SETLOCALE
- pcategory = args[0];
- if (Z_TYPE_PP(pcategory) == IS_LONG) {
- convert_to_long_ex(pcategory);
- cat = Z_LVAL_PP(pcategory);
- } else { /* FIXME: The following behaviour should be removed. */
- char *category;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passing locale category name as string is deprecated. Use the LC_* -constants instead.");
- convert_to_string_ex(pcategory);
- category = Z_STRVAL_P(*pcategory);
-
- if (!strcasecmp ("LC_ALL", category))
- cat = LC_ALL;
- else if (!strcasecmp ("LC_COLLATE", category))
- cat = LC_COLLATE;
- else if (!strcasecmp ("LC_CTYPE", category))
- cat = LC_CTYPE;
-#ifdef LC_MESSAGES
- else if (!strcasecmp ("LC_MESSAGES", category))
- cat = LC_MESSAGES;
-#endif
- else if (!strcasecmp ("LC_MONETARY", category))
- cat = LC_MONETARY;
- else if (!strcasecmp ("LC_NUMERIC", category))
- cat = LC_NUMERIC;
- else if (!strcasecmp ("LC_TIME", category))
- cat = LC_TIME;
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid locale category name %s, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME.", category);
- efree(args);
- RETURN_FALSE;
- }
- }
-
- if (Z_TYPE_PP(args[1]) == IS_ARRAY) {
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(args[1]));
- i=0; /* not needed in this case: only kill a compiler warning */
- } else {
- i=1;
- }
- while (1) {
- if (Z_TYPE_PP(args[1]) == IS_ARRAY) {
- if (!zend_hash_num_elements(Z_ARRVAL_PP(args[1]))) {
- break;
- }
- zend_hash_get_current_data(Z_ARRVAL_PP(args[1]),(void **)&plocale);
- } else {
- plocale = args[i];
- }
-
- convert_to_string_ex(plocale);
-
- if (!strcmp ("0", Z_STRVAL_PP(plocale))) {
- loc = NULL;
- } else {
- loc = Z_STRVAL_PP(plocale);
- }
-
- retval = setlocale (cat, loc);
- if (retval) {
- /* Remember if locale was changed */
- if (loc) {
- STR_FREE(BG(locale_string));
- BG(locale_string) = estrdup(retval);
- }
-
- efree(args);
- RETVAL_STRING(retval, 1);
-
- if (cat == LC_NUMERIC || cat == LC_ALL) {
- struct lconv lc;
- localeconv_r(&lc);
-
- EG(float_separator)[0] = (lc.decimal_point)[0];
-
- if ((lc.decimal_point)[0] != '.') {
- /* set locale back to C */
- setlocale(LC_NUMERIC, "C");
- }
- }
-
- return;
- }
-
- if (Z_TYPE_PP(args[1]) == IS_ARRAY) {
- if (zend_hash_move_forward(Z_ARRVAL_PP(args[1])) == FAILURE) break;
- } else {
- if (++i >= n_args) break;
- }
- }
-
-#endif
- efree(args);
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto void parse_str(string encoded_string [, array result])
- Parses GET/POST/COOKIE data and sets global variables */
-PHP_FUNCTION(parse_str)
-{
- zval **arg;
- zval **arrayArg;
- zval *sarg;
- char *res = NULL;
- int argCount;
- int old_rg;
-
- argCount = ZEND_NUM_ARGS();
- if (argCount < 1 || argCount > 2 || zend_get_parameters_ex(argCount, &arg, &arrayArg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg);
- sarg = *arg;
- if (Z_STRVAL_P(sarg) && *Z_STRVAL_P(sarg)) {
- res = estrndup(Z_STRVAL_P(sarg), Z_STRLEN_P(sarg));
- }
-
- old_rg = PG(register_globals);
- if (argCount == 1) {
- PG(register_globals) = 1;
- sapi_module.treat_data(PARSE_STRING, res, NULL TSRMLS_CC);
- } else {
- PG(register_globals) = 0;
- /* Clear out the array that was passed in. */
- zval_dtor(*arrayArg);
- array_init(*arrayArg);
-
- sapi_module.treat_data(PARSE_STRING, res, *arrayArg TSRMLS_CC);
- }
- PG(register_globals) = old_rg;
-}
-/* }}} */
-
-#define PHP_TAG_BUF_SIZE 1023
-
-/* {{{ php_tag_find
- *
- * Check if tag is in a set of tags
- *
- * states:
- *
- * 0 start tag
- * 1 first non-whitespace char seen
- */
-int php_tag_find(char *tag, int len, char *set) {
- char c, *n, *t;
- int state=0, done=0;
- char *norm = emalloc(len+1);
-
- n = norm;
- t = tag;
- c = tolower(*t);
- /*
- normalize the tag removing leading and trailing whitespace
- and turn any <a whatever...> into just <a> and any </tag>
- into <tag>
- */
- if (!len) {
- return 0;
- }
- while (!done) {
- switch (c) {
- case '<':
- *(n++) = c;
- break;
- case '>':
- done =1;
- break;
- default:
- if (!isspace((int)c)) {
- if (state == 0) {
- state=1;
- if (c != '/')
- *(n++) = c;
- } else {
- *(n++) = c;
- }
- } else {
- if (state == 1)
- done=1;
- }
- break;
- }
- c = tolower(*(++t));
- }
- *(n++) = '>';
- *n = '\0';
- if (strstr(set, norm)) {
- done=1;
- } else {
- done=0;
- }
- efree(norm);
- return done;
-}
-/* }}} */
-
-/* {{{ php_strip_tags
-
- A simple little state-machine to strip out html and php tags
-
- State 0 is the output state, State 1 means we are inside a
- normal html tag and state 2 means we are inside a php tag.
-
- The state variable is passed in to allow a function like fgetss
- to maintain state across calls to the function.
-
- lc holds the last significant character read and br is a bracket
- counter.
-
- When an allow string is passed in we keep track of the string
- in state 1 and when the tag is closed check it against the
- allow string to see if we should allow it.
-
- swm: Added ability to strip <?xml tags without assuming it PHP
- code.
-*/
-PHPAPI size_t php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int allow_len)
-{
- char *tbuf, *buf, *p, *tp, *rp, c, lc;
- int br, i=0, depth=0;
- int state = 0;
-
- if (stateptr)
- state = *stateptr;
-
- buf = estrndup(rbuf, len);
- c = *buf;
- lc = '\0';
- p = buf;
- rp = rbuf;
- br = 0;
- if (allow) {
- php_strtolower(allow, allow_len);
- tbuf = emalloc(PHP_TAG_BUF_SIZE+1);
- tp = tbuf;
- } else {
- tbuf = tp = NULL;
- }
-
- while (i < len) {
- switch (c) {
- case '<':
- if (isspace(*(p + 1))) {
- goto reg_char;
- }
- if (state == 0) {
- lc = '<';
- state = 1;
- if (allow) {
- *(tp++) = '<';
- }
- } else if (state == 1) {
- depth++;
- }
- break;
-
- case '(':
- if (state == 2) {
- if (lc != '"' && lc != '\'') {
- lc = '(';
- br++;
- }
- } else if (allow && state == 1) {
- *(tp++) = c;
- } else if (state == 0) {
- *(rp++) = c;
- }
- break;
-
- case ')':
- if (state == 2) {
- if (lc != '"' && lc != '\'') {
- lc = ')';
- br--;
- }
- } else if (allow && state == 1) {
- *(tp++) = c;
- } else if (state == 0) {
- *(rp++) = c;
- }
- break;
-
- case '>':
- if (depth) {
- depth--;
- break;
- }
-
- switch (state) {
- case 1: /* HTML/XML */
- lc = '>';
- state = 0;
- if (allow) {
- *(tp++) = '>';
- *tp='\0';
- if (php_tag_find(tbuf, tp-tbuf, allow)) {
- memcpy(rp, tbuf, tp-tbuf);
- rp += tp-tbuf;
- }
- tp = tbuf;
- }
- break;
-
- case 2: /* PHP */
- if (!br && lc != '\"' && *(p-1) == '?') {
- state = 0;
- tp = tbuf;
- }
- break;
-
- case 3:
- state = 0;
- tp = tbuf;
- break;
-
- case 4: /* JavaScript/CSS/etc... */
- if (p >= buf + 2 && *(p-1) == '-' && *(p-2) == '-') {
- state = 0;
- tp = tbuf;
- }
- break;
-
- default:
- *(rp++) = c;
- break;
- }
- break;
-
- case '"':
- case '\'':
- if (state == 2 && *(p-1) != '\\') {
- if (lc == c) {
- lc = '\0';
- } else if (lc != '\\') {
- lc = c;
- }
- } else if (state == 0) {
- *(rp++) = c;
- } else if (allow && state == 1) {
- *(tp++) = c;
- }
- break;
-
- case '!':
- /* JavaScript & Other HTML scripting languages */
- if (state == 1 && *(p-1) == '<') {
- state = 3;
- lc = c;
- } else {
- if (state == 0) {
- *(rp++) = c;
- } else if (allow && state == 1) {
- *(tp++) = c;
- if ( (tp-tbuf) >= PHP_TAG_BUF_SIZE ) {
- /* prevent buffer overflows */
- tp = tbuf;
- }
- }
- }
- break;
-
- case '-':
- if (state == 3 && p >= buf + 2 && *(p-1) == '-' && *(p-2) == '!') {
- state = 4;
- }
- break;
-
- case '?':
-
- if (state == 1 && *(p-1)=='<') {
- br=0;
- state=2;
- break;
- }
-
- case 'E':
- case 'e':
- /* !DOCTYPE exception */
- if (state==3 && p > buf+6
- && tolower(*(p-1)) == 'p'
- && tolower(*(p-2)) == 'y'
- && tolower(*(p-3)) == 't'
- && tolower(*(p-4)) == 'c'
- && tolower(*(p-5)) == 'o'
- && tolower(*(p-6)) == 'd') {
- state = 1;
- break;
- }
- /* fall-through */
-
- case 'l':
-
- /* swm: If we encounter '<?xml' then we shouldn't be in
- * state == 2 (PHP). Switch back to HTML.
- */
-
- if (state == 2 && p > buf+2 && *(p-1) == 'm' && *(p-2) == 'x') {
- state = 1;
- break;
- }
-
- /* fall-through */
- default:
-reg_char:
- if (state == 0) {
- *(rp++) = c;
- } else if (allow && state == 1) {
- *(tp++) = c;
- if ( (tp-tbuf) >= PHP_TAG_BUF_SIZE ) { /* no buffer overflows */
- tp = tbuf;
- }
- }
- break;
- }
- c = *(++p);
- i++;
- }
- if (rp < rbuf + len) {
- *rp = '\0';
- }
- efree(buf);
- if (allow)
- efree(tbuf);
- if (stateptr)
- *stateptr = state;
-
- return (size_t)(rp - rbuf);
-}
-/* }}} */
-
-/* {{{ proto string str_repeat(string input, int mult)
- Returns the input string repeat mult times */
-PHP_FUNCTION(str_repeat)
-{
- zval **input_str; /* Input string */
- zval **mult; /* Multiplier */
- char *result; /* Resulting string */
- int result_len; /* Length of the resulting string */
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &input_str, &mult) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* Make sure we're dealing with proper types */
- convert_to_string_ex(input_str);
- convert_to_long_ex(mult);
-
- if (Z_LVAL_PP(mult) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument has to be greater than or equal to 0.");
- return;
- }
-
- /* Don't waste our time if it's empty */
- if (Z_STRLEN_PP(input_str) == 0)
- RETURN_STRINGL(empty_string, 0, 1);
-
- /* ... or if the multiplier is zero */
- if (Z_LVAL_PP(mult) == 0)
- RETURN_STRINGL(empty_string, 0, 1);
-
- /* Initialize the result string */
- result_len = Z_STRLEN_PP(input_str) * Z_LVAL_PP(mult);
- if (result_len < 1 || result_len > 2147483647) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may not create strings longer then 2147483647 bytes");
- RETURN_FALSE;
- }
- result = (char *)emalloc(result_len + 1);
-
- /* Heavy optimization for situations where input string is 1 byte long */
- if (Z_STRLEN_PP(input_str) == 1) {
- memset(result, *(Z_STRVAL_PP(input_str)), Z_LVAL_PP(mult));
- } else {
- char *s, *e, *ee;
- int l=0;
- memcpy(result, Z_STRVAL_PP(input_str), Z_STRLEN_PP(input_str));
- s = result;
- e = result + Z_STRLEN_PP(input_str);
- ee = result + result_len;
-
- while (e<ee) {
- l = (e-s) < (ee-e) ? (e-s) : (ee-e);
- memmove(e, s, l);
- e += l;
- }
- }
-
- result[result_len] = '\0';
-
- RETURN_STRINGL(result, result_len, 0);
-}
-/* }}} */
-
-/* {{{ proto mixed count_chars(string input [, int mode])
- Returns info about what characters are used in input */
-PHP_FUNCTION(count_chars)
-{
- zval **input, **mode;
- int chars[256];
- int ac=ZEND_NUM_ARGS();
- int mymode=0;
- unsigned char *buf;
- int len, inx;
- char retstr[256];
- int retlen=0;
-
- if (ac < 1 || ac > 2 || zend_get_parameters_ex(ac, &input, &mode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(input);
-
- if (ac == 2) {
- convert_to_long_ex(mode);
- mymode = Z_LVAL_PP(mode);
-
- if (mymode < 0 || mymode > 4) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown mode.");
- RETURN_FALSE;
- }
- }
-
- len = Z_STRLEN_PP(input);
- buf = (unsigned char *) Z_STRVAL_PP(input);
- memset((void*) chars, 0, sizeof(chars));
-
- while (len > 0) {
- chars[*buf]++;
- buf++;
- len--;
- }
-
- if (mymode < 3) {
- array_init(return_value);
- }
-
- for (inx = 0; inx < 256; inx++) {
- switch (mymode) {
- case 0:
- add_index_long(return_value, inx, chars[inx]);
- break;
- case 1:
- if (chars[inx] != 0) {
- add_index_long(return_value, inx, chars[inx]);
- }
- break;
- case 2:
- if (chars[inx] == 0) {
- add_index_long(return_value, inx, chars[inx]);
- }
- break;
- case 3:
- if (chars[inx] != 0) {
- retstr[retlen++] = inx;
- }
- break;
- case 4:
- if (chars[inx] == 0) {
- retstr[retlen++] = inx;
- }
- break;
- }
- }
-
- if (mymode >= 3 && mymode <= 4) {
- RETURN_STRINGL(retstr, retlen, 1);
- }
-}
-/* }}} */
-
-/* {{{ php_strnatcmp
- */
-static void php_strnatcmp(INTERNAL_FUNCTION_PARAMETERS, int fold_case)
-{
- zval **s1, **s2;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
-
- RETURN_LONG(strnatcmp_ex(Z_STRVAL_PP(s1), Z_STRLEN_PP(s1),
- Z_STRVAL_PP(s2), Z_STRLEN_PP(s2),
- fold_case));
-}
-/* }}} */
-
-/* {{{ proto int strnatcmp(string s1, string s2)
- Returns the result of string comparison using 'natural' algorithm */
-PHP_FUNCTION(strnatcmp)
-{
- php_strnatcmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto array localeconv(void)
- Returns numeric formatting information based on the current locale */
-PHP_FUNCTION(localeconv)
-{
- zval *grouping, *mon_grouping;
- int len, i;
-
- /* We don't need no stinkin' parameters... */
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- MAKE_STD_ZVAL(grouping);
- MAKE_STD_ZVAL(mon_grouping);
-
- array_init(return_value);
- array_init(grouping);
- array_init(mon_grouping);
-
-#ifdef HAVE_LOCALECONV
- {
- struct lconv currlocdata;
-
- localeconv_r( &currlocdata );
-
- /* Grab the grouping data out of the array */
- len = strlen(currlocdata.grouping);
-
- for (i = 0; i < len; i++) {
- add_index_long(grouping, i, currlocdata.grouping[i]);
- }
-
- /* Grab the monetary grouping data out of the array */
- len = strlen(currlocdata.mon_grouping);
-
- for (i = 0; i < len; i++) {
- add_index_long(mon_grouping, i, currlocdata.mon_grouping[i]);
- }
-
- add_assoc_string(return_value, "decimal_point", currlocdata.decimal_point, 1);
- add_assoc_string(return_value, "thousands_sep", currlocdata.thousands_sep, 1);
- add_assoc_string(return_value, "int_curr_symbol", currlocdata.int_curr_symbol, 1);
- add_assoc_string(return_value, "currency_symbol", currlocdata.currency_symbol, 1);
- add_assoc_string(return_value, "mon_decimal_point", currlocdata.mon_decimal_point, 1);
- add_assoc_string(return_value, "mon_thousands_sep", currlocdata.mon_thousands_sep, 1);
- add_assoc_string(return_value, "positive_sign", currlocdata.positive_sign, 1);
- add_assoc_string(return_value, "negative_sign", currlocdata.negative_sign, 1);
- add_assoc_long( return_value, "int_frac_digits", currlocdata.int_frac_digits );
- add_assoc_long( return_value, "frac_digits", currlocdata.frac_digits );
- add_assoc_long( return_value, "p_cs_precedes", currlocdata.p_cs_precedes );
- add_assoc_long( return_value, "p_sep_by_space", currlocdata.p_sep_by_space );
- add_assoc_long( return_value, "n_cs_precedes", currlocdata.n_cs_precedes );
- add_assoc_long( return_value, "n_sep_by_space", currlocdata.n_sep_by_space );
- add_assoc_long( return_value, "p_sign_posn", currlocdata.p_sign_posn );
- add_assoc_long( return_value, "n_sign_posn", currlocdata.n_sign_posn );
- }
-#else
- /* Ok, it doesn't look like we have locale info floating around, so I guess it
- wouldn't hurt to just go ahead and return the POSIX locale information? */
-
- add_index_long(grouping, 0, -1);
- add_index_long(mon_grouping, 0, -1);
-
- add_assoc_string(return_value, "decimal_point", "\x2E", 1);
- add_assoc_string(return_value, "thousands_sep", "", 1);
- add_assoc_string(return_value, "int_curr_symbol", "", 1);
- add_assoc_string(return_value, "currency_symbol", "", 1);
- add_assoc_string(return_value, "mon_decimal_point", "\x2E", 1);
- add_assoc_string(return_value, "mon_thousands_sep", "", 1);
- add_assoc_string(return_value, "positive_sign", "", 1);
- add_assoc_string(return_value, "negative_sign", "", 1);
- add_assoc_long( return_value, "int_frac_digits", CHAR_MAX );
- add_assoc_long( return_value, "frac_digits", CHAR_MAX );
- add_assoc_long( return_value, "p_cs_precedes", CHAR_MAX );
- add_assoc_long( return_value, "p_sep_by_space", CHAR_MAX );
- add_assoc_long( return_value, "n_cs_precedes", CHAR_MAX );
- add_assoc_long( return_value, "n_sep_by_space", CHAR_MAX );
- add_assoc_long( return_value, "p_sign_posn", CHAR_MAX );
- add_assoc_long( return_value, "n_sign_posn", CHAR_MAX );
-#endif
-
- zend_hash_update(Z_ARRVAL_P(return_value), "grouping", 9, &grouping, sizeof(zval *), NULL);
- zend_hash_update(Z_ARRVAL_P(return_value), "mon_grouping", 13, &mon_grouping, sizeof(zval *), NULL);
-}
-/* }}} */
-
-/* {{{ proto int strnatcasecmp(string s1, string s2)
- Returns the result of case-insensitive string comparison using 'natural' algorithm */
-PHP_FUNCTION(strnatcasecmp)
-{
- php_strnatcmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int substr_count(string haystack, string needle)
- Returns the number of times a substring occurs in the string */
-PHP_FUNCTION(substr_count)
-{
- zval **haystack, **needle;
- int count = 0;
- char *p, *endp, cmp;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &haystack, &needle) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(haystack);
- convert_to_string_ex(needle);
-
- if (Z_STRLEN_PP(needle) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty substring.");
- RETURN_FALSE;
- }
-
- p = Z_STRVAL_PP(haystack);
- endp = p + Z_STRLEN_PP(haystack);
-
- if (Z_STRLEN_PP(needle) == 1) {
- cmp = Z_STRVAL_PP(needle)[0];
-
- while (p < endp) {
- if (*(p++) == cmp) {
- count++;
- }
- }
- } else {
- while ((p = php_memnstr(p, Z_STRVAL_PP(needle), Z_STRLEN_PP(needle), endp))) {
- p += Z_STRLEN_PP(needle);
- count++;
- }
- }
-
- RETURN_LONG(count);
-}
-/* }}} */
-
-/* {{{ proto string str_pad(string input, int pad_length [, string pad_string [, int pad_type]])
- Returns input string padded on the left or right to specified length with pad_string */
-PHP_FUNCTION(str_pad)
-{
- /* Input arguments */
- zval **input, /* Input string */
- **pad_length, /* Length to pad to */
- **pad_string, /* Padding string */
- **pad_type; /* Padding type (left/right/both) */
-
- /* Helper variables */
- int num_pad_chars; /* Number of padding characters (total - input size) */
- char *result = NULL; /* Resulting string */
- int result_len = 0; /* Length of the resulting string */
- char *pad_str_val = " "; /* Pointer to padding string */
- int pad_str_len = 1; /* Length of the padding string */
- int pad_type_val = STR_PAD_RIGHT; /* The padding type value */
- int i, left_pad=0, right_pad=0;
-
-
- if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 4 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &input, &pad_length, &pad_string, &pad_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* Perform initial conversion to expected data types. */
- convert_to_string_ex(input);
- convert_to_long_ex(pad_length);
-
- num_pad_chars = Z_LVAL_PP(pad_length) - Z_STRLEN_PP(input);
-
- /* If resulting string turns out to be shorter than input string,
- we simply copy the input and return. */
- if (num_pad_chars < 0) {
- *return_value = **input;
- zval_copy_ctor(return_value);
- return;
- }
-
- /* Setup the padding string values if specified. */
- if (ZEND_NUM_ARGS() > 2) {
- convert_to_string_ex(pad_string);
- if (Z_STRLEN_PP(pad_string) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Padding string cannot be empty.");
- return;
- }
- pad_str_val = Z_STRVAL_PP(pad_string);
- pad_str_len = Z_STRLEN_PP(pad_string);
-
- if (ZEND_NUM_ARGS() > 3) {
- convert_to_long_ex(pad_type);
- pad_type_val = Z_LVAL_PP(pad_type);
- if (pad_type_val < STR_PAD_LEFT || pad_type_val > STR_PAD_BOTH) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH.");
- return;
- }
- }
- }
-
- result = (char *)emalloc(Z_STRLEN_PP(input) + num_pad_chars + 1);
-
- /* We need to figure out the left/right padding lengths. */
- switch (pad_type_val) {
- case STR_PAD_RIGHT:
- left_pad = 0;
- right_pad = num_pad_chars;
- break;
-
- case STR_PAD_LEFT:
- left_pad = num_pad_chars;
- right_pad = 0;
- break;
-
- case STR_PAD_BOTH:
- left_pad = num_pad_chars / 2;
- right_pad = num_pad_chars - left_pad;
- break;
- }
-
- /* First we pad on the left. */
- for (i = 0; i < left_pad; i++)
- result[result_len++] = pad_str_val[i % pad_str_len];
-
- /* Then we copy the input string. */
- memcpy(result + result_len, Z_STRVAL_PP(input), Z_STRLEN_PP(input));
- result_len += Z_STRLEN_PP(input);
-
- /* Finally, we pad on the right. */
- for (i = 0; i < right_pad; i++)
- result[result_len++] = pad_str_val[i % pad_str_len];
-
- result[result_len] = '\0';
-
- RETURN_STRINGL(result, result_len, 0);
-}
-/* }}} */
-
-/* {{{ proto mixed sscanf(string str, string format [, string ...])
- Implements an ANSI C compatible sscanf */
-PHP_FUNCTION(sscanf)
-{
- zval ***args;
- int result;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2) {
- WRONG_PARAM_COUNT;
- }
-
- args = (zval ***) emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(args[0]);
- convert_to_string_ex(args[1]);
-
- result = php_sscanf_internal(Z_STRVAL_PP(args[0]),
- Z_STRVAL_PP(args[1]),
- argc, args,
- 2, &return_value TSRMLS_CC);
- efree(args);
-
- if (SCAN_ERROR_WRONG_PARAM_COUNT == result) {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-static char rot13_from[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
-static char rot13_to[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
-
-/* {{{ proto string str_rot13(string str)
- Perform the rot13 transform on a string */
-PHP_FUNCTION(str_rot13)
-{
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
- *return_value = **arg;
- zval_copy_ctor(return_value);
-
- php_strtr(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), rot13_from, rot13_to, 52);
-}
-/* }}} */
-
-
-static void php_string_shuffle(char *str, long len TSRMLS_DC)
-{
- long n_elems, rnd_idx, n_left;
- char temp;
- /* The implementation is stolen from array_data_shuffle */
- /* Thus the characteristics of the randomization are the same */
- n_elems = len;
-
- if (n_elems <= 1) {
- return;
- }
-
- n_left = n_elems;
-
- while (--n_left) {
- rnd_idx = php_rand(TSRMLS_C);
- RAND_RANGE(rnd_idx, 0, n_left, PHP_RAND_MAX);
- if (rnd_idx != n_left) {
- temp = str[n_left];
- str[n_left] = str[rnd_idx];
- str[rnd_idx] = temp;
- }
- }
-}
-
-
-/* {{{ proto void str_shuffle(string str)
- Shuffles string. One permutation of all possible is created */
-PHP_FUNCTION(str_shuffle)
-{
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg);
- *return_value = **arg;
- zval_copy_ctor(return_value);
- if (Z_STRLEN_P(return_value) > 1) {
- php_string_shuffle(Z_STRVAL_P(return_value), (long) Z_STRLEN_P(return_value) TSRMLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ proto void str_word_count(string str, [int format])
- Counts the number of words inside a string. If format of 1 is specified,
- then the function will return an array containing all the words
- found inside the string. If format of 2 is specified, then the function
- will return an associated array where the position of the word is the key
- and the word itself is the value.
-
- For the purpose of this function, 'word' is defined as a locale dependent
- string containing alphabetic characters, which also may contain, but not start
- with "'" and "-" characters.
-*/
-PHP_FUNCTION(str_word_count)
-{
- zval **str, **o_format;
- char *s, *e, *p, *buf;
- int word_count = 0;
- int type = 0;
- int n_args = ZEND_NUM_ARGS();
-
- if (n_args > 2 || n_args < 1 || zend_get_parameters_ex(n_args, &str, &o_format) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (n_args == 2) {
- convert_to_long_ex(o_format);
- type = Z_LVAL_PP(o_format);
-
- if (type != 1 && type != 2) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The specified format parameter, '%d' is invalid.", type);
- RETURN_FALSE;
- }
- }
-
- convert_to_string_ex(str);
-
- p = s = Z_STRVAL_PP(str);
- e = Z_STRVAL_PP(str) + Z_STRLEN_PP(str);
-
- if (type == 1 || type == 2) {
- array_init(return_value);
- }
-
- while (p < e) {
- if (isalpha(*p++)) {
- s = p - 1;
- while (isalpha(*p) || *p == '\'' || (*p == '-' && isalpha(*(p+1)))) {
- p++;
- }
-
- switch (type)
- {
- case 1:
- buf = estrndup(s, (p-s));
- add_next_index_stringl(return_value, buf, (p-s), 1);
- efree(buf);
- break;
- case 2:
- buf = estrndup(s, (p-s));
- add_index_stringl(return_value, (s - Z_STRVAL_PP(str)), buf, p-s, 1);
- efree(buf);
- break;
- default:
- word_count++;
- break;
- }
- }
- }
-
- if (!type) {
- RETURN_LONG(word_count);
- }
-}
-
-/* }}} */
-
-#if HAVE_STRFMON
-/* {{{ proto string money_format(string format , float value)
- Convert monetary value(s) to string */
-PHP_FUNCTION(money_format)
-{
- int format_len = 0, str_len;
- char *format, *str;
- double value;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sd", &format, &format_len, &value) == FAILURE) {
- return;
- }
-
- str_len = format_len + 1024;
- str = emalloc(str_len);
- if ((str_len = strfmon(str, str_len, format, value)) < 0) {
- efree(str);
- RETURN_FALSE;
- }
- str[str_len] = 0;
-
- RETURN_STRINGL(erealloc(str, str_len + 1), str_len, 0);
-}
-/* }}} */
-#endif
-
-/* {{{ proto array str_split(string str [, int split_length])
- Convert a string to an array. If split_length is specified, break the string down into chunks each split_length characters long. */
-PHP_FUNCTION(str_split)
-{
- char *str;
- int str_len;
- long split_length = 1;
- char *p;
- int n_reg_segments;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &split_length) == FAILURE) {
- return;
- }
-
- if (split_length <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The the length of each segment must be greater then zero.");
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- n_reg_segments = floor(str_len / split_length);
- p = str;
-
- while (n_reg_segments-- > 0) {
- add_next_index_stringl(return_value, p, split_length, 1);
- p += split_length;
- }
-
- if (p != (str + str_len)) {
- add_next_index_stringl(return_value, p, (str + str_len - p), 1);
- }
-}
-/* }}} */
-
-/* {{{ proto array strpbrk(string haystack, string char_list)
- Search a string for any of a set of characters */
-PHP_FUNCTION(strpbrk)
-{
- char *haystack, *char_list;
- int haystack_len, char_list_len;
- char *p;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &haystack, &haystack_len, &char_list, &char_list_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (!char_list_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The character list cannot be empty.");
- RETURN_FALSE;
- }
-
- if ((p = strpbrk(haystack, char_list))) {
- RETURN_STRINGL(p, (haystack + haystack_len - p), 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/standard/strnatcmp.c b/ext/standard/strnatcmp.c
deleted file mode 100644
index f0cc8f8672..0000000000
--- a/ext/standard/strnatcmp.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/* -*- mode: c; c-file-style: "k&r" -*-
-
- Modified for PHP by Andrei Zmievski <andrei@ispi.net>
-
- strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
- Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include <ctype.h>
-#include <string.h>
-#include <assert.h>
-#include <stdio.h>
-
-#include "php.h"
-#include "php_string.h"
-
-#if defined(__GNUC__)
-# define UNUSED __attribute__((__unused__))
-#else
-# define UNUSED
-#endif
-
-#if 0
-static char const *version UNUSED =
- "$Id$";
-#endif
-/* {{{ compare_right
- */
-static int
-compare_right(char const **a, char const *aend, char const **b, char const *bend)
-{
- int bias = 0;
-
- /* The longest run of digits wins. That aside, the greatest
- value wins, but we can't know that it will until we've scanned
- both numbers to know that they have the same magnitude, so we
- remember it in BIAS. */
- for(;; (*a)++, (*b)++) {
- if ((*a == aend || !isdigit((int)(unsigned char)**a)) &&
- (*b == bend || !isdigit((int)(unsigned char)**b)))
- return bias;
- else if (*a == aend || !isdigit((int)(unsigned char)**a))
- return -1;
- else if (*b == bend || !isdigit((int)(unsigned char)**b))
- return +1;
- else if (**a < **b) {
- if (!bias)
- bias = -1;
- } else if (**a > **b) {
- if (!bias)
- bias = +1;
- }
- }
-
- return 0;
-}
-/* }}} */
-
-/* {{{ compare_left
- */
-static int
-compare_left(char const **a, char const *aend, char const **b, char const *bend)
-{
- /* Compare two left-aligned numbers: the first to have a
- different value wins. */
- for(;; (*a)++, (*b)++) {
- if ((*a == aend || !isdigit((int)(unsigned char)**a)) &&
- (*b == bend || !isdigit((int)(unsigned char)**b)))
- return 0;
- else if (*a == aend || !isdigit((int)(unsigned char)**a))
- return -1;
- else if (*b == bend || !isdigit((int)(unsigned char)**b))
- return +1;
- else if (**a < **b)
- return -1;
- else if (**a > **b)
- return +1;
- }
-
- return 0;
-}
-/* }}} */
-
-/* {{{ strnatcmp_ex
- */
-PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int fold_case)
-{
- char ca, cb;
- char const *ap, *bp;
- char const *aend = a + a_len,
- *bend = b + b_len;
- int fractional, result;
-
- if (a_len == 0 || b_len == 0)
- return a_len - b_len;
-
- ap = a;
- bp = b;
- while (1) {
- ca = *ap; cb = *bp;
-
- /* skip over leading spaces or zeros */
- while (isspace((int)(unsigned char)ca))
- ca = *++ap;
-
- while (isspace((int)(unsigned char)cb))
- cb = *++bp;
-
- /* process run of digits */
- if (isdigit((int)(unsigned char)ca) && isdigit((int)(unsigned char)cb)) {
- fractional = (ca == '0' || cb == '0');
-
- if (fractional)
- result = compare_left(&ap, aend, &bp, bend);
- else
- result = compare_right(&ap, aend, &bp, bend);
-
- if (result != 0)
- return result;
- else if (ap == aend && bp == bend)
- /* End of the strings. Let caller sort them out. */
- return 0;
- else {
- /* Keep on comparing from the current point. */
- ca = *ap; cb = *bp;
- }
- }
-
- if (fold_case) {
- ca = toupper((int)(unsigned char)ca);
- cb = toupper((int)(unsigned char)cb);
- }
-
- if (ca < cb)
- return -1;
- else if (ca > cb)
- return +1;
-
- ++ap; ++bp;
- if (ap == aend && bp == bend)
- /* The strings compare the same. Perhaps the caller
- will want to call strcmp to break the tie. */
- return 0;
- else if (ap == aend)
- return -1;
- else if (bp == bend)
- return 1;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/sunfuncs.c b/ext/standard/sunfuncs.c
deleted file mode 100644
index 58bab3258e..0000000000
--- a/ext/standard/sunfuncs.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Moshe Doron <mosdoron@netvision.net.il> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- The sun position algorithm taken from the 'US Naval Observatory's
- Almanac for Computers', implemented by Ken Bloom <kekabloom@ucdavis.edu>
- for the zmanim project <http://sourceforge.net/projects/zmanim/>
- and finally converted to C by Moshe Doron <mosdoron@netvision.net.il>.
-*/
-
-#include "php.h"
-#include "php_sunfuncs.h"
-#include "datetime.h"
-#include "php_ini.h"
-
-#include <assert.h>
-#include <math.h>
-#include <stdlib.h>
-
-/* {{{ macros and constants
- */
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#define to_rad(degrees) (degrees * M_PI / 180)
-#define to_rad_with_min(degrees) (degrees + minutes / 60)
-#define to_deg(rad) (rad * 180 / M_PI)
-/* }}} */
-
-/* {{{ php_sunrise_sunset
- returns time in UTC */
-static double php_sunrise_sunset(long N, double latitude, double longitude, double zenith, int calc_sunset)
-{
- double lngHour, t, M, L, Lx, RA, RAx, Lquadrant, RAquadrant, sinDec, cosDec, cosH, H, T, UT, UTx;
-
- /* step 1: First calculate the day of the year
- int N = theday - date(1, 1, theday.year()) + 1;
- */
-
- /* step 2: convert the longitude to hour value and calculate an approximate time */
- lngHour = longitude / 15;
-
- /* use 18 for sunset instead of 6 */
- if (calc_sunset) {
- t = (double) N + ((18 - lngHour) / 24); /* Sunset */
- } else {
- t = (double) N + ((6 - lngHour) / 24); /* Sunrise */
- }
-
- /* step 3: calculate the sun's mean anomaly */
- M = (0.9856 * t) - 3.289;
-
- /* step 4: calculate the sun's true longitude */
- L = M + (1.916 * sin(to_rad(M))) + (0.020 * sin (to_rad(2 * M))) + 282.634;
-
- while (L < 0) {
- Lx = L + 360;
- assert (Lx != L); /* askingtheguru: realy needed? */
- L = Lx;
- }
-
- while (L >= 360) {
- Lx = L - 360;
- assert (Lx != L); /* askingtheguru: realy needed? */
- L = Lx;
- }
-
- /* step 5a: calculate the sun's right ascension */
- RA = to_deg(atan(0.91764 * tan(to_rad(L))));
-
- while (RA < 0) {
- RAx = RA + 360;
- assert (RAx != RA); /* askingtheguru: realy needed? */
- RA = RAx;
- }
-
- while (RA >= 360) {
- RAx = RA - 360;
- assert (RAx != RA); /* askingtheguru: realy needed? */
- RA = RAx;
- }
-
- /* step 5b: right ascension value needs to be in the same quadrant as L */
- Lquadrant = floor(L / 90) * 90;
- RAquadrant = floor(RA / 90) * 90;
- RA = RA + (Lquadrant - RAquadrant);
-
- /* step 5c: right ascension value needs to be converted into hours */
- RA /= 15;
-
- /* step 6: calculate the sun's declination */
- sinDec = 0.39782 * sin(to_rad(L));
- cosDec = cos(asin(sinDec));
-
- /* step 7a: calculate the sun's local hour angle */
- cosH = (cos(to_rad(zenith)) - (sinDec * sin(to_rad(latitude)))) / (cosDec * cos(to_rad(latitude)));
-
- /* XXX: What's the use of this block.. ?
- * if (!calc_sunset && cosH > 1 || calc_sunset && cosH < -1) {
- * throw doesnthappen();
- * }
- */
-
- /* step 7b: finish calculating H and convert into hours */
- if (calc_sunset) {
- H = to_deg(acos(cosH)); /* Sunset */
- } else {
- H = 360 - to_deg(acos(cosH)); /* Sunrise */
- }
- H = H / 15;
-
- /* step 8: calculate local mean time */
- T = H + RA - (0.06571 * t) - 6.622;
-
- /* step 9: convert to UTC */
- UT = T - lngHour;
-
- while (UT < 0) {
- UTx = UT + 24;
- assert (UTx != UT); /* askingtheguru: realy needed? */
- UT = UTx;
- }
-
- while (UT >= 24) {
- UTx = UT - 24;
- assert (UTx != UT); /* askingtheguru: realy needed? */
- UT = UTx;
- }
-
- return UT;
-}
-/* }}} */
-
-/* {{{ php_do_date_sunrise_sunset
- * Common for date_sunrise() and date_sunset() functions
- */
-static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_sunset)
-{
- zval *date;
- double latitude, longitude, zenith, gmt_offset, ret;
- int time, N, retformat;
- char retstr[6];
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ldddd", &date, &retformat, &latitude, &longitude, &zenith, &gmt_offset) == FAILURE) {
- RETURN_FALSE;
- }
-
- switch (Z_TYPE_P(date)) {
- case IS_LONG:
- time = Z_LVAL_P(date);
- break;
- case IS_STRING:
- /* todo: more user friendly format */
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "date must be timestamp for now");
- RETURN_FALSE;
- }
-
- N = php_idate('z', time, 0) + 1;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- retformat = SUNFUNCS_RET_STRING;
- case 2:
- latitude = INI_FLT("date.default_latitude");
- case 3:
- longitude = INI_FLT("date.default_longitude");
- case 4:
- if (calc_sunset) {
- zenith = INI_FLT("date.sunset_zenith");
- } else {
- zenith = INI_FLT("date.sunrise_zenith");
- }
- case 5:
- gmt_offset = php_idate('Z', time, 0) / 3600;
- default:
- break;
- }
-
- ret = php_sunrise_sunset(N, latitude, longitude, zenith, calc_sunset) + gmt_offset;
-
- switch (retformat) {
- case SUNFUNCS_RET_TIMESTAMP:
- RETURN_LONG((int) (time - (time % (24 * 3600))) + (int) (60 * ret));
- break;
- case SUNFUNCS_RET_STRING:
- N = (int) ret;
- sprintf(retstr, "%02d:%02d", N, (int) (60 * (ret - (double) N)));
- RETVAL_STRINGL(retstr, 5, 1);
- break;
- case SUNFUNCS_RET_DOUBLE:
- RETURN_DOUBLE(ret);
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid format");
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
- Returns time of sunrise for a given day & location */
-PHP_FUNCTION(date_sunrise)
-{
- php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
- Returns time of sunset for a given day & location */
-PHP_FUNCTION(date_sunset)
-{
- php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c
deleted file mode 100644
index b6103b991a..0000000000
--- a/ext/standard/syslog.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#ifdef HAVE_SYSLOG_H
-#include "php_ini.h"
-#include "zend_globals.h"
-
-#include <stdlib.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-
-#include <stdio.h>
-#include "basic_functions.h"
-#include "php_ext_syslog.h"
-
-static void start_syslog(TSRMLS_D);
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(syslog)
-{
- /* error levels */
- REGISTER_LONG_CONSTANT("LOG_EMERG", LOG_EMERG, CONST_CS | CONST_PERSISTENT); /* system unusable */
- REGISTER_LONG_CONSTANT("LOG_ALERT", LOG_ALERT, CONST_CS | CONST_PERSISTENT); /* immediate action required */
- REGISTER_LONG_CONSTANT("LOG_CRIT", LOG_CRIT, CONST_CS | CONST_PERSISTENT); /* critical conditions */
- REGISTER_LONG_CONSTANT("LOG_ERR", LOG_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_WARNING", LOG_WARNING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_NOTICE", LOG_NOTICE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_INFO", LOG_INFO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_DEBUG", LOG_DEBUG, CONST_CS | CONST_PERSISTENT);
- /* facility: type of program logging the message */
- REGISTER_LONG_CONSTANT("LOG_KERN", LOG_KERN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_USER", LOG_USER, CONST_CS | CONST_PERSISTENT); /* generic user level */
- REGISTER_LONG_CONSTANT("LOG_MAIL", LOG_MAIL, CONST_CS | CONST_PERSISTENT); /* log to email */
- REGISTER_LONG_CONSTANT("LOG_DAEMON", LOG_DAEMON, CONST_CS | CONST_PERSISTENT); /* other system daemons */
- REGISTER_LONG_CONSTANT("LOG_AUTH", LOG_AUTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_SYSLOG", LOG_SYSLOG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LPR", LOG_LPR, CONST_CS | CONST_PERSISTENT);
-#ifdef LOG_NEWS
- /* No LOG_NEWS on HP-UX */
- REGISTER_LONG_CONSTANT("LOG_NEWS", LOG_NEWS, CONST_CS | CONST_PERSISTENT); /* usenet new */
-#endif
-#ifdef LOG_UUCP
- /* No LOG_UUCP on HP-UX */
- REGISTER_LONG_CONSTANT("LOG_UUCP", LOG_UUCP, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef LOG_CRON
- /* apparently some systems don't have this one */
- REGISTER_LONG_CONSTANT("LOG_CRON", LOG_CRON, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef LOG_AUTHPRIV
- /* AIX doesn't have LOG_AUTHPRIV */
- REGISTER_LONG_CONSTANT("LOG_AUTHPRIV", LOG_AUTHPRIV, CONST_CS | CONST_PERSISTENT);
-#endif
-#if !defined(PHP_WIN32) && !defined(NETWARE)
- REGISTER_LONG_CONSTANT("LOG_LOCAL0", LOG_LOCAL0, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL1", LOG_LOCAL1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL2", LOG_LOCAL2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL3", LOG_LOCAL3, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL4", LOG_LOCAL4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL5", LOG_LOCAL5, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL6", LOG_LOCAL6, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL7", LOG_LOCAL7, CONST_CS | CONST_PERSISTENT);
-#endif
- /* options */
- REGISTER_LONG_CONSTANT("LOG_PID", LOG_PID, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_CONS", LOG_CONS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_ODELAY", LOG_ODELAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_NDELAY", LOG_NDELAY, CONST_CS | CONST_PERSISTENT);
-#ifdef LOG_NOWAIT
- REGISTER_LONG_CONSTANT("LOG_NOWAIT", LOG_NOWAIT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef LOG_PERROR
- /* AIX doesn't have LOG_PERROR */
- REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-PHP_RINIT_FUNCTION(syslog)
-{
- if (INI_INT("define_syslog_variables")) {
- start_syslog(TSRMLS_C);
- } else {
- BG(syslog_started)=0;
- }
- BG(syslog_device)=NULL;
- return SUCCESS;
-}
-
-
-PHP_RSHUTDOWN_FUNCTION(syslog)
-{
- if (BG(syslog_device)) {
- efree(BG(syslog_device));
- }
- return SUCCESS;
-}
-
-/* {{{ start_syslog
- */
-static void start_syslog(TSRMLS_D)
-{
- /* error levels */
- SET_VAR_LONG("LOG_EMERG", LOG_EMERG); /* system unusable */
- SET_VAR_LONG("LOG_ALERT", LOG_ALERT); /* immediate action required */
- SET_VAR_LONG("LOG_CRIT", LOG_CRIT); /* critical conditions */
- SET_VAR_LONG("LOG_ERR", LOG_ERR);
- SET_VAR_LONG("LOG_WARNING", LOG_WARNING);
- SET_VAR_LONG("LOG_NOTICE", LOG_NOTICE);
- SET_VAR_LONG("LOG_INFO", LOG_INFO);
- SET_VAR_LONG("LOG_DEBUG", LOG_DEBUG);
- /* facility: type of program logging the message */
- SET_VAR_LONG("LOG_KERN", LOG_KERN);
- SET_VAR_LONG("LOG_USER", LOG_USER); /* generic user level */
- SET_VAR_LONG("LOG_MAIL", LOG_MAIL); /* log to email */
- SET_VAR_LONG("LOG_DAEMON", LOG_DAEMON); /* other system daemons */
- SET_VAR_LONG("LOG_AUTH", LOG_AUTH);
- SET_VAR_LONG("LOG_SYSLOG", LOG_SYSLOG);
- SET_VAR_LONG("LOG_LPR", LOG_LPR);
-#ifdef LOG_NEWS
- /* No LOG_NEWS on HP-UX */
- SET_VAR_LONG("LOG_NEWS", LOG_NEWS); /* usenet new */
-#endif
-#ifdef LOG_UUCP
- /* No LOG_UUCP on HP-UX */
- SET_VAR_LONG("LOG_UUCP", LOG_UUCP);
-#endif
-#ifdef LOG_CRON
- /* apparently some systems don't have this one */
- SET_VAR_LONG("LOG_CRON", LOG_CRON);
-#endif
-#ifdef LOG_AUTHPRIV
- /* AIX doesn't have LOG_AUTHPRIV */
- SET_VAR_LONG("LOG_AUTHPRIV", LOG_AUTHPRIV);
-#endif
-#if !defined(PHP_WIN32) && !defined(NETWARE)
- SET_VAR_LONG("LOG_LOCAL0", LOG_LOCAL0);
- SET_VAR_LONG("LOG_LOCAL1", LOG_LOCAL1);
- SET_VAR_LONG("LOG_LOCAL2", LOG_LOCAL2);
- SET_VAR_LONG("LOG_LOCAL3", LOG_LOCAL3);
- SET_VAR_LONG("LOG_LOCAL4", LOG_LOCAL4);
- SET_VAR_LONG("LOG_LOCAL5", LOG_LOCAL5);
- SET_VAR_LONG("LOG_LOCAL6", LOG_LOCAL6);
- SET_VAR_LONG("LOG_LOCAL7", LOG_LOCAL7);
-#endif
- /* options */
- SET_VAR_LONG("LOG_PID", LOG_PID);
- SET_VAR_LONG("LOG_CONS", LOG_CONS);
- SET_VAR_LONG("LOG_ODELAY", LOG_ODELAY);
- SET_VAR_LONG("LOG_NDELAY", LOG_NDELAY);
-#ifdef LOG_NOWAIT
- /* BeOS doesn't have LOG_NOWAIT */
- SET_VAR_LONG("LOG_NOWAIT", LOG_NOWAIT);
-#endif
-#ifdef LOG_PERROR
- /* AIX doesn't have LOG_PERROR */
- SET_VAR_LONG("LOG_PERROR", LOG_PERROR); /*log to stderr*/
-#endif
-
- BG(syslog_started)=1;
-}
-/* }}} */
-
-/* {{{ proto void define_syslog_variables(void)
- Initializes all syslog-related variables */
-PHP_FUNCTION(define_syslog_variables)
-{
- if (ZEND_NUM_ARGS() != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects no parameters, %d given", ZEND_NUM_ARGS());
- return;
- }
-
- if (!BG(syslog_started)) {
- start_syslog(TSRMLS_C);
- }
-}
-/* }}} */
-
-/* {{{ proto bool openlog(string ident, int option, int facility)
- Open connection to system logger */
-/*
- ** OpenLog("nettopp", $LOG_PID, $LOG_LOCAL1);
- ** Syslog($LOG_EMERG, "help me!")
- ** CloseLog();
- */
-PHP_FUNCTION(openlog)
-{
- char *ident;
- long option, facility;
- int ident_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll", &ident,
- &ident_len, &option, &facility) == FAILURE) {
- return;
- }
- if (BG(syslog_device)) {
- efree(BG(syslog_device));
- }
- BG(syslog_device) = estrndup(ident, ident_len);
- openlog(BG(syslog_device), option, facility);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool closelog(void)
- Close connection to system logger */
-PHP_FUNCTION(closelog)
-{
- if (ZEND_NUM_ARGS() != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects no parameters, %d given", ZEND_NUM_ARGS());
- return;
- }
-
- closelog();
- if (BG(syslog_device)) {
- efree(BG(syslog_device));
- BG(syslog_device)=NULL;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool syslog(int priority, string message)
- Generate a system log message */
-PHP_FUNCTION(syslog)
-{
- long priority;
- char *message;
- int message_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &priority,
- &message, &message_len) == FAILURE) {
- return;
- }
-
- /*
- * CAVEAT: if the message contains patterns such as "%s",
- * this will cause problems.
- */
-
- php_syslog(priority, "%.500s", message);
- RETURN_TRUE;
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/tests/aggregation/aggregate.lib b/ext/standard/tests/aggregation/aggregate.lib
deleted file mode 100644
index 3799285f75..0000000000
--- a/ext/standard/tests/aggregation/aggregate.lib
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-
-class simple {
- var $simple_prop = 100;
-
- function simple()
- {
- print "I'm alive!\n";
- }
-}
-
-class helper {
- var $my_prop = 5;
- var $your_prop = array('init' => PHP_VERSION);
- var $our_prop = '****';
- var $_priv_prop = null;
-
- function helper()
- {
- print "just trying to help\n";
- }
-
- function do_this()
- {
- print "I'm helping!\n";
- }
-
- function do_that()
- {
- print "I'm aggregating!\n";
- }
-
- function just_another_method()
- {
- print "yep, that's me\n";
- }
-
- function _private()
- {
- print "Don't touch me!\n";
- }
-
- function __wakeup()
- {
- }
-}
-
-class mixin {
- var $simple_prop = true;
- var $mix = true;
-
- function mix_it()
- {
- print "mixing\n";
- }
-}
-
-class moby {
- function mix_it()
- {
- print "I'm redundant!\n";
- }
-}
-
-?>
diff --git a/ext/standard/tests/aggregation/aggregate.phpt b/ext/standard/tests/aggregation/aggregate.phpt
deleted file mode 100644
index 46aa9133b6..0000000000
--- a/ext/standard/tests/aggregation/aggregate.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-aggregating everything
---FILE--
-<?php
-
-include "ext/standard/tests/aggregation/aggregate.lib";
-
-$obj = new simple();
-aggregate($obj, 'helper');
-$obj->do_this();
-$obj->do_that();
-print $obj->our_prop;
-
-?>
---EXPECT--
-I'm alive!
-I'm helping!
-I'm aggregating!
-****
diff --git a/ext/standard/tests/aggregation/aggregate_methods.phpt b/ext/standard/tests/aggregation/aggregate_methods.phpt
deleted file mode 100644
index b612881c59..0000000000
--- a/ext/standard/tests/aggregation/aggregate_methods.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-aggregating all methods
---POST--
---GET--
---FILE--
-<?php
-include "ext/standard/tests/aggregation/aggregate.lib";
-
-$obj = new simple();
-aggregate_methods($obj, 'mixin');
-$obj->mix_it();
-print $obj->simple_prop."\n";
-print implode(',', get_class_methods($obj))."\n";
-print implode(',', array_keys(get_object_vars($obj)))."\n";
-aggregate_methods($obj, 'moby');
-$obj->mix_it();
-
-?>
---EXPECT--
-I'm alive!
-mixing
-100
-simple,mix_it
-simple_prop
-mixing
diff --git a/ext/standard/tests/aggregation/aggregate_methods_by_list.phpt b/ext/standard/tests/aggregation/aggregate_methods_by_list.phpt
deleted file mode 100644
index 312a57d1b2..0000000000
--- a/ext/standard/tests/aggregation/aggregate_methods_by_list.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-aggregating methods specified in the list
---POST--
---GET--
---FILE--
-<?php
-include "ext/standard/tests/aggregation/aggregate.lib";
-
-$obj = new simple();
-aggregate_methods_by_list($obj, 'helper', array('just_another_method'));
-print implode(',', get_class_methods($obj))."\n";
-$obj2 = new simple();
-aggregate_methods_by_list($obj2, 'helper', array('just_another_method'), true);
-print implode(',', get_class_methods($obj2))."\n";
-$obj->just_another_method();
-?>
---EXPECT--
-I'm alive!
-simple,just_another_method
-I'm alive!
-simple,do_this,do_that
-yep, that's me
diff --git a/ext/standard/tests/aggregation/aggregate_methods_by_regexp.phpt b/ext/standard/tests/aggregation/aggregate_methods_by_regexp.phpt
deleted file mode 100644
index 6525e50cff..0000000000
--- a/ext/standard/tests/aggregation/aggregate_methods_by_regexp.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-aggregating methods matching regular expression
---POST--
---GET--
---FILE--
-<?php
-include "ext/standard/tests/aggregation/aggregate.lib";
-
-$obj = new simple();
-aggregate_methods_by_regexp($obj, 'helper', '/^do/');
-print implode(',', get_class_methods($obj))."\n";
-$obj2 = new simple();
-aggregate_methods_by_regexp($obj2, 'helper', '/^do/', true);
-print implode(',', get_class_methods($obj2))."\n";
-?>
---EXPECT--
-I'm alive!
-simple,do_this,do_that
-I'm alive!
-simple,just_another_method
diff --git a/ext/standard/tests/aggregation/aggregate_properties.phpt b/ext/standard/tests/aggregation/aggregate_properties.phpt
deleted file mode 100644
index 2a976c71a7..0000000000
--- a/ext/standard/tests/aggregation/aggregate_properties.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-aggregating all default properties
---POST--
---GET--
---FILE--
-<?php
-include "ext/standard/tests/aggregation/aggregate.lib";
-
-$obj = new simple();
-aggregate_properties($obj, 'mixin');
-print implode(',', array_keys(get_object_vars($obj)))."\n";
-print $obj->simple_prop."\n";
-print implode(',', get_class_methods($obj))."\n";
-?>
---EXPECT--
-I'm alive!
-simple_prop,mix
-100
-simple
diff --git a/ext/standard/tests/aggregation/aggregate_properties_by_list.phpt b/ext/standard/tests/aggregation/aggregate_properties_by_list.phpt
deleted file mode 100644
index fa12d36bcb..0000000000
--- a/ext/standard/tests/aggregation/aggregate_properties_by_list.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-aggregating default properties specified in the list
---POST--
---GET--
---FILE--
-<?php
-include "ext/standard/tests/aggregation/aggregate.lib";
-
-$obj = new simple();
-aggregate_properties_by_list($obj, 'helper', array('my_prop', 'our_prop'));
-print implode(',', array_keys(get_object_vars($obj)))."\n";
-$obj2 = new simple();
-aggregate_properties_by_list($obj2, 'helper', array('my_prop'), true);
-print implode(',', array_keys(get_object_vars($obj2)))."\n";
-?>
---EXPECT--
-I'm alive!
-simple_prop,my_prop,our_prop
-I'm alive!
-simple_prop,your_prop,our_prop
diff --git a/ext/standard/tests/aggregation/aggregate_properties_by_regexp.phpt b/ext/standard/tests/aggregation/aggregate_properties_by_regexp.phpt
deleted file mode 100644
index 9a74f5536d..0000000000
--- a/ext/standard/tests/aggregation/aggregate_properties_by_regexp.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-aggregating default properties matching regular expression
---SKIPIF--
-<?php if (!function_exists('aggregate_properties_by_regexp')) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-include "ext/standard/tests/aggregation/aggregate.lib";
-
-$obj = new simple();
-aggregate_properties_by_regexp($obj, 'helper', '/^my/');
-print implode(',', array_keys(get_object_vars($obj)))."\n";
-$obj2 = new simple();
-aggregate_properties_by_regexp($obj2, 'helper', '/^my/', true);
-print implode(',', array_keys(get_object_vars($obj2)))."\n";
-?>
---EXPECT--
-I'm alive!
-simple_prop,my_prop
-I'm alive!
-simple_prop,your_prop,our_prop
diff --git a/ext/standard/tests/aggregation/aggregation_info.phpt b/ext/standard/tests/aggregation/aggregation_info.phpt
deleted file mode 100644
index 8dd943cbcc..0000000000
--- a/ext/standard/tests/aggregation/aggregation_info.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-retrieving aggregation info
---POST--
---GET--
---FILE--
-<?php
-include "ext/standard/tests/aggregation/aggregate.lib";
-
-$obj = new simple();
-aggregate($obj, 'mixin');
-print_r(aggregation_info($obj));
-?>
---EXPECT--
-I'm alive!
-Array
-(
- [mixin] => Array
- (
- [methods] => Array
- (
- [0] => mix_it
- )
-
- [properties] => Array
- (
- [0] => mix
- )
-
- )
-
-)
diff --git a/ext/standard/tests/aggregation/deaggregate.phpt b/ext/standard/tests/aggregation/deaggregate.phpt
deleted file mode 100644
index 5c551d75bd..0000000000
--- a/ext/standard/tests/aggregation/deaggregate.phpt
+++ /dev/null
@@ -1,72 +0,0 @@
---TEST--
-deaggreating
---POST--
---GET--
---FILE--
-<?php
-include "ext/standard/tests/aggregation/aggregate.lib";
-
-$obj = new simple();
-aggregate($obj, 'helper');
-aggregate($obj, 'mixin');
-print_r(aggregation_info($obj));
-deaggregate($obj, 'helper');
-print_r(aggregation_info($obj));
-deaggregate($obj);
-var_dump(aggregation_info($obj));
-?>
---EXPECT--
-I'm alive!
-Array
-(
- [helper] => Array
- (
- [methods] => Array
- (
- [0] => do_this
- [1] => do_that
- [2] => just_another_method
- )
-
- [properties] => Array
- (
- [0] => my_prop
- [1] => your_prop
- [2] => our_prop
- )
-
- )
-
- [mixin] => Array
- (
- [methods] => Array
- (
- [0] => mix_it
- )
-
- [properties] => Array
- (
- [0] => mix
- )
-
- )
-
-)
-Array
-(
- [mixin] => Array
- (
- [methods] => Array
- (
- [0] => mix_it
- )
-
- [properties] => Array
- (
- [0] => mix
- )
-
- )
-
-)
-bool(false)
diff --git a/ext/standard/tests/array/001.phpt b/ext/standard/tests/array/001.phpt
deleted file mode 100644
index 3917f46f25..0000000000
--- a/ext/standard/tests/array/001.phpt
+++ /dev/null
@@ -1,159 +0,0 @@
---TEST--
-Test array_merge and array_walk
---POST--
---GET--
---INI--
-precision=14
---FILE--
-<?php
-require('ext/standard/tests/array/data.inc');
-/*
-** Create sample arrays
-** Test alpha, numeric (decimal, hex, octal) and special data
-**
-**
-*/
-
-/* Helper function to build testing arrays */
-function make_nested_array ($depth, $breadth, $function = NULL, $args = array ()) {
- for ($x = 0; $x < $breadth; ++$x) {
- if (NULL === $function) {
- $array = array (0);
- } else {
- $array = array (call_user_func_array ($function, $args));
- }
- for ($y = 1; $y < $depth; ++$y) {
- $array[0] = array ($array[0]);
- }
- $temp[$x] = $array;
- }
- return $temp;
-}
-
-/* Nested array */
-$data2 = make_nested_array (3, 3);
-$data = array_merge($data, $data2);
-
-var_dump ($data);
-
-function echo_kv ($value, $key) {
- var_dump ($key);
- var_dump ($value);
-}
-
-echo " -- Testing array_walk() -- \n";
-array_walk ($data, 'echo_kv');
-
-?>
---EXPECT--
-array(11) {
- [0]=>
- string(3) "PHP"
- [1]=>
- string(27) "PHP: Hypertext Preprocessor"
- [2]=>
- string(4) "Test"
- ["test"]=>
- int(27)
- [3]=>
- string(4) "test"
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- [4]=>
- string(6) "monkey"
- [5]=>
- float(-0.33333333333333)
- [6]=>
- array(1) {
- [0]=>
- array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- }
- }
- [7]=>
- array(1) {
- [0]=>
- array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- }
- }
- [8]=>
- array(1) {
- [0]=>
- array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- }
- }
-}
- -- Testing array_walk() --
-int(0)
-string(3) "PHP"
-int(1)
-string(27) "PHP: Hypertext Preprocessor"
-int(2)
-string(4) "Test"
-string(4) "test"
-int(27)
-int(3)
-string(4) "test"
-string(5) "-1000"
-array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
-}
-int(4)
-string(6) "monkey"
-int(5)
-float(-0.33333333333333)
-int(6)
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- }
-}
-int(7)
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- }
-}
-int(8)
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- }
-}
diff --git a/ext/standard/tests/array/002.phpt b/ext/standard/tests/array/002.phpt
deleted file mode 100644
index 94e0b35c59..0000000000
--- a/ext/standard/tests/array/002.phpt
+++ /dev/null
@@ -1,644 +0,0 @@
---TEST--
-Test arsort, asort, krsort, ksort, rsort, and sort
---INI--
-precision=14
---FILE--
-<?php
-require('ext/standard/tests/array/data.inc');
-
-function test_sort ($sort_function, $data) {
- echo "\n -- Testing $sort_function() -- \n";
- echo "No second argument:\n";
- $sort_function ($data);
- var_dump ($data);
- echo "Using SORT_REGULAR:\n";
- $sort_function ($data, SORT_REGULAR);
- var_dump ($data);
- echo "Using SORT_NUMERIC:\n";
- $sort_function ($data, SORT_NUMERIC);
- var_dump ($data);
- echo "Using SORT_STRING\n";
- $sort_function ($data, SORT_STRING);
- var_dump ($data);
-}
-
-echo "Unsorted data:\n";
-var_dump ($data);
-foreach (array ('arsort', 'asort', 'krsort', 'ksort', 'rsort', 'sort') as $test_function) {
- test_sort ($test_function, $data);
-}
-
-?>
---EXPECT--
-Unsorted data:
-array(8) {
- [0]=>
- string(3) "PHP"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [5]=>
- string(4) "Test"
- ["test"]=>
- int(27)
- [1000]=>
- string(4) "test"
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- [1001]=>
- string(6) "monkey"
- [16777216]=>
- float(-0.33333333333333)
-}
-
- -- Testing arsort() --
-No second argument:
-array(8) {
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- ["test"]=>
- int(27)
- [1000]=>
- string(4) "test"
- [1001]=>
- string(6) "monkey"
- [5]=>
- string(4) "Test"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [0]=>
- string(3) "PHP"
- [16777216]=>
- float(-0.33333333333333)
-}
-Using SORT_REGULAR:
-array(8) {
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- ["test"]=>
- int(27)
- [1000]=>
- string(4) "test"
- [1001]=>
- string(6) "monkey"
- [5]=>
- string(4) "Test"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [0]=>
- string(3) "PHP"
- [16777216]=>
- float(-0.33333333333333)
-}
-Using SORT_NUMERIC:
-array(8) {
- ["test"]=>
- int(27)
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- [0]=>
- string(3) "PHP"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [1001]=>
- string(6) "monkey"
- [5]=>
- string(4) "Test"
- [1000]=>
- string(4) "test"
- [16777216]=>
- float(-0.33333333333333)
-}
-Using SORT_STRING
-array(8) {
- [1000]=>
- string(4) "test"
- [1001]=>
- string(6) "monkey"
- [5]=>
- string(4) "Test"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [0]=>
- string(3) "PHP"
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- ["test"]=>
- int(27)
- [16777216]=>
- float(-0.33333333333333)
-}
-
- -- Testing asort() --
-No second argument:
-array(8) {
- [16777216]=>
- float(-0.33333333333333)
- [0]=>
- string(3) "PHP"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [5]=>
- string(4) "Test"
- [1001]=>
- string(6) "monkey"
- [1000]=>
- string(4) "test"
- ["test"]=>
- int(27)
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
-}
-Using SORT_REGULAR:
-array(8) {
- [16777216]=>
- float(-0.33333333333333)
- [0]=>
- string(3) "PHP"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [5]=>
- string(4) "Test"
- [1001]=>
- string(6) "monkey"
- [1000]=>
- string(4) "test"
- ["test"]=>
- int(27)
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
-}
-Using SORT_NUMERIC:
-array(8) {
- [16777216]=>
- float(-0.33333333333333)
- [1001]=>
- string(6) "monkey"
- [1000]=>
- string(4) "test"
- [5]=>
- string(4) "Test"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [0]=>
- string(3) "PHP"
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- ["test"]=>
- int(27)
-}
-Using SORT_STRING
-array(8) {
- [16777216]=>
- float(-0.33333333333333)
- ["test"]=>
- int(27)
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- [0]=>
- string(3) "PHP"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [5]=>
- string(4) "Test"
- [1001]=>
- string(6) "monkey"
- [1000]=>
- string(4) "test"
-}
-
- -- Testing krsort() --
-No second argument:
-array(8) {
- [16777216]=>
- float(-0.33333333333333)
- [1001]=>
- string(6) "monkey"
- [1000]=>
- string(4) "test"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [5]=>
- string(4) "Test"
- ["test"]=>
- int(27)
- [0]=>
- string(3) "PHP"
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
-}
-Using SORT_REGULAR:
-array(8) {
- [16777216]=>
- float(-0.33333333333333)
- [1001]=>
- string(6) "monkey"
- [1000]=>
- string(4) "test"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [5]=>
- string(4) "Test"
- [0]=>
- string(3) "PHP"
- ["test"]=>
- int(27)
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
-}
-Using SORT_NUMERIC:
-array(8) {
- [16777216]=>
- float(-0.33333333333333)
- [1001]=>
- string(6) "monkey"
- [1000]=>
- string(4) "test"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [5]=>
- string(4) "Test"
- ["test"]=>
- int(27)
- [0]=>
- string(3) "PHP"
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
-}
-Using SORT_STRING
-array(8) {
- ["test"]=>
- int(27)
- [5]=>
- string(4) "Test"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [16777216]=>
- float(-0.33333333333333)
- [1001]=>
- string(6) "monkey"
- [1000]=>
- string(4) "test"
- [0]=>
- string(3) "PHP"
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
-}
-
- -- Testing ksort() --
-No second argument:
-array(8) {
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- [0]=>
- string(3) "PHP"
- ["test"]=>
- int(27)
- [5]=>
- string(4) "Test"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [1000]=>
- string(4) "test"
- [1001]=>
- string(6) "monkey"
- [16777216]=>
- float(-0.33333333333333)
-}
-Using SORT_REGULAR:
-array(8) {
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- ["test"]=>
- int(27)
- [0]=>
- string(3) "PHP"
- [5]=>
- string(4) "Test"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [1000]=>
- string(4) "test"
- [1001]=>
- string(6) "monkey"
- [16777216]=>
- float(-0.33333333333333)
-}
-Using SORT_NUMERIC:
-array(8) {
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- [0]=>
- string(3) "PHP"
- ["test"]=>
- int(27)
- [5]=>
- string(4) "Test"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [1000]=>
- string(4) "test"
- [1001]=>
- string(6) "monkey"
- [16777216]=>
- float(-0.33333333333333)
-}
-Using SORT_STRING
-array(8) {
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- [0]=>
- string(3) "PHP"
- [1000]=>
- string(4) "test"
- [1001]=>
- string(6) "monkey"
- [16777216]=>
- float(-0.33333333333333)
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [5]=>
- string(4) "Test"
- ["test"]=>
- int(27)
-}
-
- -- Testing rsort() --
-No second argument:
-array(8) {
- [0]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- [1]=>
- int(27)
- [2]=>
- string(4) "test"
- [3]=>
- string(6) "monkey"
- [4]=>
- string(4) "Test"
- [5]=>
- string(27) "PHP: Hypertext Preprocessor"
- [6]=>
- string(3) "PHP"
- [7]=>
- float(-0.33333333333333)
-}
-Using SORT_REGULAR:
-array(8) {
- [0]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- [1]=>
- int(27)
- [2]=>
- string(4) "test"
- [3]=>
- string(6) "monkey"
- [4]=>
- string(4) "Test"
- [5]=>
- string(27) "PHP: Hypertext Preprocessor"
- [6]=>
- string(3) "PHP"
- [7]=>
- float(-0.33333333333333)
-}
-Using SORT_NUMERIC:
-array(8) {
- [0]=>
- int(27)
- [1]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- [2]=>
- string(3) "PHP"
- [3]=>
- string(27) "PHP: Hypertext Preprocessor"
- [4]=>
- string(6) "monkey"
- [5]=>
- string(4) "Test"
- [6]=>
- string(4) "test"
- [7]=>
- float(-0.33333333333333)
-}
-Using SORT_STRING
-array(8) {
- [0]=>
- string(4) "test"
- [1]=>
- string(6) "monkey"
- [2]=>
- string(4) "Test"
- [3]=>
- string(27) "PHP: Hypertext Preprocessor"
- [4]=>
- string(3) "PHP"
- [5]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- [6]=>
- int(27)
- [7]=>
- float(-0.33333333333333)
-}
-
- -- Testing sort() --
-No second argument:
-array(8) {
- [0]=>
- float(-0.33333333333333)
- [1]=>
- string(3) "PHP"
- [2]=>
- string(27) "PHP: Hypertext Preprocessor"
- [3]=>
- string(4) "Test"
- [4]=>
- string(6) "monkey"
- [5]=>
- string(4) "test"
- [6]=>
- int(27)
- [7]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
-}
-Using SORT_REGULAR:
-array(8) {
- [0]=>
- float(-0.33333333333333)
- [1]=>
- string(3) "PHP"
- [2]=>
- string(27) "PHP: Hypertext Preprocessor"
- [3]=>
- string(4) "Test"
- [4]=>
- string(6) "monkey"
- [5]=>
- string(4) "test"
- [6]=>
- int(27)
- [7]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
-}
-Using SORT_NUMERIC:
-array(8) {
- [0]=>
- float(-0.33333333333333)
- [1]=>
- string(6) "monkey"
- [2]=>
- string(4) "test"
- [3]=>
- string(4) "Test"
- [4]=>
- string(27) "PHP: Hypertext Preprocessor"
- [5]=>
- string(3) "PHP"
- [6]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- [7]=>
- int(27)
-}
-Using SORT_STRING
-array(8) {
- [0]=>
- float(-0.33333333333333)
- [1]=>
- int(27)
- [2]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- [3]=>
- string(3) "PHP"
- [4]=>
- string(27) "PHP: Hypertext Preprocessor"
- [5]=>
- string(4) "Test"
- [6]=>
- string(6) "monkey"
- [7]=>
- string(4) "test"
-}
diff --git a/ext/standard/tests/array/003.phpt b/ext/standard/tests/array/003.phpt
deleted file mode 100644
index 9c61605900..0000000000
--- a/ext/standard/tests/array/003.phpt
+++ /dev/null
@@ -1,104 +0,0 @@
---TEST--
-Test usort, uksort and uasort
---INI--
-precision=14
---FILE--
-<?php
-require('ext/standard/tests/array/data.inc');
-
-function cmp ($a, $b) {
- is_array ($a)
- and $a = array_sum ($a);
- is_array ($b)
- and $b = array_sum ($b);
- return strcmp ($a, $b);
-}
-
-echo " -- Testing uasort() -- \n";
-uasort ($data, 'cmp');
-var_dump ($data);
-
-
-echo "\n -- Testing uksort() -- \n";
-uksort ($data, 'cmp');
-var_dump ($data);
-
-echo "\n -- Testing usort() -- \n";
-usort ($data, 'cmp');
-var_dump ($data);
-?>
---EXPECT--
--- Testing uasort() --
-array(8) {
- [16777216]=>
- float(-0.33333333333333)
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- ["test"]=>
- int(27)
- [0]=>
- string(3) "PHP"
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [5]=>
- string(4) "Test"
- [1001]=>
- string(6) "monkey"
- [1000]=>
- string(4) "test"
-}
-
- -- Testing uksort() --
-array(8) {
- ["-1000"]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- [0]=>
- string(3) "PHP"
- [1000]=>
- string(4) "test"
- [1001]=>
- string(6) "monkey"
- [16777216]=>
- float(-0.33333333333333)
- [17]=>
- string(27) "PHP: Hypertext Preprocessor"
- [5]=>
- string(4) "Test"
- ["test"]=>
- int(27)
-}
-
- -- Testing usort() --
-array(8) {
- [0]=>
- float(-0.33333333333333)
- [1]=>
- array(2) {
- [0]=>
- string(6) "banana"
- [1]=>
- string(6) "orange"
- }
- [2]=>
- int(27)
- [3]=>
- string(3) "PHP"
- [4]=>
- string(27) "PHP: Hypertext Preprocessor"
- [5]=>
- string(4) "Test"
- [6]=>
- string(6) "monkey"
- [7]=>
- string(4) "test"
-}
diff --git a/ext/standard/tests/array/004.phpt b/ext/standard/tests/array/004.phpt
deleted file mode 100644
index 1074134890..0000000000
--- a/ext/standard/tests/array/004.phpt
+++ /dev/null
@@ -1,59 +0,0 @@
---TEST--
-Test natsort and natcasesort
---INI--
-precision=14
---FILE--
-<?php
-$data = array(
- 'Test1',
- 'teST2'=>0,
- 5=>'test2',
- 'abc'=>'test10',
- 'test21'
-);
-
-var_dump($data);
-
-natsort($data);
-var_dump($data);
-
-natcasesort($data);
-var_dump($data);
-?>
---EXPECT--
-array(5) {
- [0]=>
- string(5) "Test1"
- ["teST2"]=>
- int(0)
- [5]=>
- string(5) "test2"
- ["abc"]=>
- string(6) "test10"
- [6]=>
- string(6) "test21"
-}
-array(5) {
- ["teST2"]=>
- int(0)
- [0]=>
- string(5) "Test1"
- [5]=>
- string(5) "test2"
- ["abc"]=>
- string(6) "test10"
- [6]=>
- string(6) "test21"
-}
-array(5) {
- ["teST2"]=>
- int(0)
- [0]=>
- string(5) "Test1"
- [5]=>
- string(5) "test2"
- ["abc"]=>
- string(6) "test10"
- [6]=>
- string(6) "test21"
-} \ No newline at end of file
diff --git a/ext/standard/tests/array/005.phpt b/ext/standard/tests/array/005.phpt
deleted file mode 100644
index cdf731827d..0000000000
--- a/ext/standard/tests/array/005.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test array_shift behaviour
---FILE--
-<?php
-
-array_shift($GLOBALS);
-
-$a = array("foo", "bar", "fubar");
-$b = array("3" => "foo", "4" => "bar", "5" => "fubar");
-$c = array("a" => "foo", "b" => "bar", "c" => "fubar");
-
-/* simple array */
-echo array_shift($a), "\n";
-var_dump($a);
-
-/* numerical assoc indices */
-echo array_shift($b), "\n";
-var_dump($b);
-
-/* assoc indices */
-echo array_shift($c), "\n";
-var_dump($c);
-
-?>
---EXPECT--
-foo
-array(2) {
- [0]=>
- string(3) "bar"
- [1]=>
- string(5) "fubar"
-}
-foo
-array(2) {
- [0]=>
- string(3) "bar"
- [1]=>
- string(5) "fubar"
-}
-foo
-array(2) {
- ["b"]=>
- string(3) "bar"
- ["c"]=>
- string(5) "fubar"
-}
diff --git a/ext/standard/tests/array/006.phpt b/ext/standard/tests/array/006.phpt
deleted file mode 100644
index 4893ad3f06..0000000000
--- a/ext/standard/tests/array/006.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-Test array_pop behaviour
---FILE--
-<?php
-
-array_pop($GLOBALS);
-
-$a = array("foo", "bar", "fubar");
-$b = array("3" => "foo", "4" => "bar", "5" => "fubar");
-$c = array("a" => "foo", "b" => "bar", "c" => "fubar");
-
-/* simple array */
-echo array_pop($a), "\n";
-array_push($a, "foobar");
-var_dump($a);
-
-/* numerical assoc indices */
-echo array_pop($b), "\n";
-var_dump($b);
-
-/* assoc indices */
-echo array_pop($c), "\n";
-var_dump($c);
-
-?>
---EXPECT--
-fubar
-array(3) {
- [0]=>
- string(3) "foo"
- [1]=>
- string(3) "bar"
- [2]=>
- string(6) "foobar"
-}
-fubar
-array(2) {
- [3]=>
- string(3) "foo"
- [4]=>
- string(3) "bar"
-}
-fubar
-array(2) {
- ["a"]=>
- string(3) "foo"
- ["b"]=>
- string(3) "bar"
-}
diff --git a/ext/standard/tests/array/007.phpt b/ext/standard/tests/array/007.phpt
deleted file mode 100644
index 82f4edd4bd..0000000000
--- a/ext/standard/tests/array/007.phpt
+++ /dev/null
@@ -1,175 +0,0 @@
---TEST--
-Test array_diff and array_diff_assoc behaviour
---FILE--
-<?php
-$a = array(1,"big"=>2,3,6,3,5,3,3,3,3,3,3,3,3,3,3);
-$b = array(2,2,3,3,3,3,3,3,3,3,3,3,3,3,3);
-$c = array(-1,1);
-echo '$a='.var_export($a,TRUE).";\n";
-echo '$b='.var_export($b,TRUE).";\n";
-echo '$c='.var_export($c,TRUE).";\n";
-var_dump(array_diff($a,$b,$c));
-var_dump(array_diff_assoc($a,$b,$c));
-$a = array(
-'a'=>2,
-'b'=>'some',
-'c'=>'done',
-'z'=>'foo',
-'f'=>5,
-'fan'=>'fen',
-7=>18,
-9=>25,
-11=>42,
-12=>42,
-45=>42,
-73=>'foo',
-95=>'some',
-'som3'=>'some',
-'want'=>'wanna');
-$b = array(
-'a'=>7,
-7=>18,
-9=>13,
-11=>42,
-45=>46,
-'som3'=>'some',
-'foo'=>'some',
-'goo'=>'foo',
-'f'=>5,
-'z'=>'equal'
-);
-$c = array(
-73=>'foo',
-95=>'some');
-echo '$a='.var_export($a,TRUE).";\n";
-echo '$b='.var_export($b,TRUE).";\n";
-echo '$c='.var_export($c,TRUE).";\n";
-echo "Results:\n\n";
-var_dump(array_diff($a,$b,$c));
-var_dump(array_diff_assoc($a,$b,$c));
-?>
---EXPECT--
-$a=array (
- 0 => 1,
- 'big' => 2,
- 1 => 3,
- 2 => 6,
- 3 => 3,
- 4 => 5,
- 5 => 3,
- 6 => 3,
- 7 => 3,
- 8 => 3,
- 9 => 3,
- 10 => 3,
- 11 => 3,
- 12 => 3,
- 13 => 3,
- 14 => 3,
-);
-$b=array (
- 0 => 2,
- 1 => 2,
- 2 => 3,
- 3 => 3,
- 4 => 3,
- 5 => 3,
- 6 => 3,
- 7 => 3,
- 8 => 3,
- 9 => 3,
- 10 => 3,
- 11 => 3,
- 12 => 3,
- 13 => 3,
- 14 => 3,
-);
-$c=array (
- 0 => -1,
- 1 => 1,
-);
-array(2) {
- [2]=>
- int(6)
- [4]=>
- int(5)
-}
-array(5) {
- [0]=>
- int(1)
- ["big"]=>
- int(2)
- [1]=>
- int(3)
- [2]=>
- int(6)
- [4]=>
- int(5)
-}
-$a=array (
- 'a' => 2,
- 'b' => 'some',
- 'c' => 'done',
- 'z' => 'foo',
- 'f' => 5,
- 'fan' => 'fen',
- 7 => 18,
- 9 => 25,
- 11 => 42,
- 12 => 42,
- 45 => 42,
- 73 => 'foo',
- 95 => 'some',
- 'som3' => 'some',
- 'want' => 'wanna',
-);
-$b=array (
- 'a' => 7,
- 7 => 18,
- 9 => 13,
- 11 => 42,
- 45 => 46,
- 'som3' => 'some',
- 'foo' => 'some',
- 'goo' => 'foo',
- 'f' => 5,
- 'z' => 'equal',
-);
-$c=array (
- 73 => 'foo',
- 95 => 'some',
-);
-Results:
-
-array(5) {
- ["a"]=>
- int(2)
- ["c"]=>
- string(4) "done"
- ["fan"]=>
- string(3) "fen"
- [9]=>
- int(25)
- ["want"]=>
- string(5) "wanna"
-}
-array(9) {
- ["a"]=>
- int(2)
- ["b"]=>
- string(4) "some"
- ["c"]=>
- string(4) "done"
- ["z"]=>
- string(3) "foo"
- ["fan"]=>
- string(3) "fen"
- [9]=>
- int(25)
- [12]=>
- int(42)
- [45]=>
- int(42)
- ["want"]=>
- string(5) "wanna"
-}
diff --git a/ext/standard/tests/array/008.phpt b/ext/standard/tests/array/008.phpt
deleted file mode 100644
index a3dde36296..0000000000
--- a/ext/standard/tests/array/008.phpt
+++ /dev/null
@@ -1,310 +0,0 @@
---TEST--
-Test array_intersect and array_intersect_assoc behaviour
---FILE--
-<?php
-//-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=- TEST 1 -=-=-=-=-
-$a = array(1,"big"=>2,2,6,3,5,3,3,454,'some_string',3,3,3,3,3,3,3,3,17);
-$b = array(2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,17,25,'some_string',7,8,9,109,78,17);
-$c = array(-1,2,1,15,25,17);
-echo str_repeat("-=",10)." TEST 1 ".str_repeat("-=",20)."\n";
-echo '$a='.var_export($a,TRUE).";\n";
-echo '$b='.var_export($b,TRUE).";\n";
-echo '$c='.var_export($c,TRUE).";\n";
-
-echo 'array_intersect($a,$b,$c);'."\n";
-var_dump(array_intersect($a,$b,$c));
-
-echo 'array_intersect_assoc($a,$b,$c);'."\n";
-var_dump(array_intersect_assoc($a,$b,$c));
-
-echo 'array_intersect($a,$b);'."\n";
-var_dump(array_intersect($a,$b));
-
-echo 'array_intersect_assoc($a,$b);'."\n";
-var_dump(array_intersect_assoc($a,$b));
-
-//-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=- TEST 2 -=-=-=-=-=-
-$a = array(
-'a'=>2,
-'b'=>'some',
-'c'=>'done',
-'z'=>'foo',
-'f'=>5,
-'fan'=>'fen',
-'bad'=>'bed',
-'gate'=>'web',
-7=>18,
-9=>25,
-11=>42,
-12=>42,
-45=>42,
-73=>'foo',
-95=>'some',
-'som3'=>'some',
-'want'=>'wanna');
-
-
-$b = array(
-'a'=>7,
-7=>18,
-9=>13,
-11=>42,
-45=>46,
-'som3'=>'some',
-'foo'=>'some',
-'goo'=>'foo',
-'f'=>5,
-'z'=>'equal',
-'gate'=>'web'
-);
-$c = array(
-'gate'=>'web',
-73=>'foo',
-95=>'some'
-);
-
-echo str_repeat("-=",10)." TEST 2 ".str_repeat("-=",20)."\n";
-echo '$a='.var_export($a,TRUE).";\n";
-echo '$b='.var_export($b,TRUE).";\n";
-echo '$c='.var_export($c,TRUE).";\n";
-echo "\n\nResults:\n\n";
-
-echo 'array_intersect($a,$b,$c);'."\n";
-var_dump(array_intersect($a,$b,$c));
-
-echo 'array_intersect_assoc($a,$b,$c);'."\n";
-var_dump(array_intersect_assoc($a,$b,$c));
-
-echo 'array_intersect($a,$b);'."\n";
-var_dump(array_intersect($a,$b));
-
-echo 'array_intersect_assoc($a,$b);'."\n";
-var_dump(array_intersect_assoc($a,$b));
-?>
---EXPECT--
--=-=-=-=-=-=-=-=-=-= TEST 1 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-$a=array (
- 0 => 1,
- 'big' => 2,
- 1 => 2,
- 2 => 6,
- 3 => 3,
- 4 => 5,
- 5 => 3,
- 6 => 3,
- 7 => 454,
- 8 => 'some_string',
- 9 => 3,
- 10 => 3,
- 11 => 3,
- 12 => 3,
- 13 => 3,
- 14 => 3,
- 15 => 3,
- 16 => 3,
- 17 => 17,
-);
-$b=array (
- 0 => 2,
- 1 => 2,
- 2 => 3,
- 3 => 3,
- 4 => 3,
- 5 => 3,
- 6 => 3,
- 7 => 3,
- 8 => 3,
- 9 => 3,
- 10 => 3,
- 11 => 3,
- 12 => 3,
- 13 => 3,
- 14 => 3,
- 15 => 17,
- 16 => 25,
- 17 => 'some_string',
- 18 => 7,
- 19 => 8,
- 20 => 9,
- 21 => 109,
- 22 => 78,
- 23 => 17,
-);
-$c=array (
- 0 => -1,
- 1 => 2,
- 2 => 1,
- 3 => 15,
- 4 => 25,
- 5 => 17,
-);
-array_intersect($a,$b,$c);
-array(3) {
- ["big"]=>
- int(2)
- [1]=>
- int(2)
- [17]=>
- int(17)
-}
-array_intersect_assoc($a,$b,$c);
-array(1) {
- [1]=>
- int(2)
-}
-array_intersect($a,$b);
-array(15) {
- ["big"]=>
- int(2)
- [1]=>
- int(2)
- [3]=>
- int(3)
- [5]=>
- int(3)
- [6]=>
- int(3)
- [8]=>
- string(11) "some_string"
- [9]=>
- int(3)
- [10]=>
- int(3)
- [11]=>
- int(3)
- [12]=>
- int(3)
- [13]=>
- int(3)
- [14]=>
- int(3)
- [15]=>
- int(3)
- [16]=>
- int(3)
- [17]=>
- int(17)
-}
-array_intersect_assoc($a,$b);
-array(10) {
- [1]=>
- int(2)
- [3]=>
- int(3)
- [5]=>
- int(3)
- [6]=>
- int(3)
- [9]=>
- int(3)
- [10]=>
- int(3)
- [11]=>
- int(3)
- [12]=>
- int(3)
- [13]=>
- int(3)
- [14]=>
- int(3)
-}
--=-=-=-=-=-=-=-=-=-= TEST 2 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-$a=array (
- 'a' => 2,
- 'b' => 'some',
- 'c' => 'done',
- 'z' => 'foo',
- 'f' => 5,
- 'fan' => 'fen',
- 'bad' => 'bed',
- 'gate' => 'web',
- 7 => 18,
- 9 => 25,
- 11 => 42,
- 12 => 42,
- 45 => 42,
- 73 => 'foo',
- 95 => 'some',
- 'som3' => 'some',
- 'want' => 'wanna',
-);
-$b=array (
- 'a' => 7,
- 7 => 18,
- 9 => 13,
- 11 => 42,
- 45 => 46,
- 'som3' => 'some',
- 'foo' => 'some',
- 'goo' => 'foo',
- 'f' => 5,
- 'z' => 'equal',
- 'gate' => 'web',
-);
-$c=array (
- 'gate' => 'web',
- 73 => 'foo',
- 95 => 'some',
-);
-
-
-Results:
-
-array_intersect($a,$b,$c);
-array(6) {
- ["b"]=>
- string(4) "some"
- ["z"]=>
- string(3) "foo"
- ["gate"]=>
- string(3) "web"
- [73]=>
- string(3) "foo"
- [95]=>
- string(4) "some"
- ["som3"]=>
- string(4) "some"
-}
-array_intersect_assoc($a,$b,$c);
-array(1) {
- ["gate"]=>
- string(3) "web"
-}
-array_intersect($a,$b);
-array(11) {
- ["b"]=>
- string(4) "some"
- ["z"]=>
- string(3) "foo"
- ["f"]=>
- int(5)
- ["gate"]=>
- string(3) "web"
- [7]=>
- int(18)
- [11]=>
- int(42)
- [12]=>
- int(42)
- [45]=>
- int(42)
- [73]=>
- string(3) "foo"
- [95]=>
- string(4) "some"
- ["som3"]=>
- string(4) "some"
-}
-array_intersect_assoc($a,$b);
-array(5) {
- ["f"]=>
- int(5)
- ["gate"]=>
- string(3) "web"
- [7]=>
- int(18)
- [11]=>
- int(42)
- ["som3"]=>
- string(4) "some"
-}
diff --git a/ext/standard/tests/array/array_change_key_case.phpt b/ext/standard/tests/array/array_change_key_case.phpt
deleted file mode 100644
index 0cd1d8203a..0000000000
--- a/ext/standard/tests/array/array_change_key_case.phpt
+++ /dev/null
@@ -1,769 +0,0 @@
---TEST--
-array_change_key_case()
---FILE--
-<?php
-$arrays = array (
- array (),
- array (0),
- array (1),
- array (-1),
- array (0, 2, 3, 4, 5),
- array (1, 2, 3, 4, 5),
- array ("" => 1),
- array ("a" => 1),
- array ("Z" => 1),
- array ("one" => 1),
- array ("ONE" => 1),
- array ("OnE" => 1),
- array ("oNe" => 1),
- array ("one" => 1, "two" => 2),
- array ("ONE" => 1, "two" => 2),
- array ("OnE" => 1, "two" => 2),
- array ("oNe" => 1, "two" => 2),
- array ("one" => 1, "TWO" => 2),
- array ("ONE" => 1, "TWO" => 2),
- array ("OnE" => 1, "TWO" => 2),
- array ("oNe" => 1, "TWO" => 2),
- array ("one" => 1, "TwO" => 2),
- array ("ONE" => 1, "TwO" => 2),
- array ("OnE" => 1, "TwO" => 2),
- array ("oNe" => 1, "TwO" => 2),
- array ("one" => 1, "tWo" => 2),
- array ("ONE" => 1, "tWo" => 2),
- array ("OnE" => 1, "tWo" => 2),
- array ("oNe" => 1, "tWo" => 2),
- array ("one" => 1, 2),
- array ("ONE" => 1, 2),
- array ("OnE" => 1, 2),
- array ("oNe" => 1, 2),
- array ("ONE" => 1, "TWO" => 2, "THREE" => 3, "FOUR" => "four"),
- array ("one" => 1, "two" => 2, "three" => 3, "four" => "FOUR"),
- array ("ONE" => 1, "TWO" => 2, "three" => 3, "four" => "FOUR"),
- array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four")
-);
-
-foreach ($arrays as $item) {
- var_dump(array_change_key_case($item));
- var_dump(array_change_key_case($item, CASE_UPPER));
- var_dump(array_change_key_case($item, CASE_LOWER));
- echo "\n";
-}
-echo "end\n";
-?>
---EXPECT--
-array(0) {
-}
-array(0) {
-}
-array(0) {
-}
-
-array(1) {
- [0]=>
- int(0)
-}
-array(1) {
- [0]=>
- int(0)
-}
-array(1) {
- [0]=>
- int(0)
-}
-
-array(1) {
- [0]=>
- int(1)
-}
-array(1) {
- [0]=>
- int(1)
-}
-array(1) {
- [0]=>
- int(1)
-}
-
-array(1) {
- [0]=>
- int(-1)
-}
-array(1) {
- [0]=>
- int(-1)
-}
-array(1) {
- [0]=>
- int(-1)
-}
-
-array(5) {
- [0]=>
- int(0)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
-}
-array(5) {
- [0]=>
- int(0)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
-}
-array(5) {
- [0]=>
- int(0)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
-}
-
-array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
-}
-array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
-}
-array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
-}
-
-array(1) {
- [""]=>
- int(1)
-}
-array(1) {
- [""]=>
- int(1)
-}
-array(1) {
- [""]=>
- int(1)
-}
-
-array(1) {
- ["a"]=>
- int(1)
-}
-array(1) {
- ["A"]=>
- int(1)
-}
-array(1) {
- ["a"]=>
- int(1)
-}
-
-array(1) {
- ["z"]=>
- int(1)
-}
-array(1) {
- ["Z"]=>
- int(1)
-}
-array(1) {
- ["z"]=>
- int(1)
-}
-
-array(1) {
- ["one"]=>
- int(1)
-}
-array(1) {
- ["ONE"]=>
- int(1)
-}
-array(1) {
- ["one"]=>
- int(1)
-}
-
-array(1) {
- ["one"]=>
- int(1)
-}
-array(1) {
- ["ONE"]=>
- int(1)
-}
-array(1) {
- ["one"]=>
- int(1)
-}
-
-array(1) {
- ["one"]=>
- int(1)
-}
-array(1) {
- ["ONE"]=>
- int(1)
-}
-array(1) {
- ["one"]=>
- int(1)
-}
-
-array(1) {
- ["one"]=>
- int(1)
-}
-array(1) {
- ["ONE"]=>
- int(1)
-}
-array(1) {
- ["one"]=>
- int(1)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- [0]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- [0]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- [0]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
-}
-
-array(2) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
-}
-array(2) {
- ["ONE"]=>
- int(1)
- [0]=>
- int(2)
-}
-array(2) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
-}
-
-array(4) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
- ["three"]=>
- int(3)
- ["four"]=>
- string(4) "four"
-}
-array(4) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
- ["THREE"]=>
- int(3)
- ["FOUR"]=>
- string(4) "four"
-}
-array(4) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
- ["three"]=>
- int(3)
- ["four"]=>
- string(4) "four"
-}
-
-array(4) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
- ["three"]=>
- int(3)
- ["four"]=>
- string(4) "FOUR"
-}
-array(4) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
- ["THREE"]=>
- int(3)
- ["FOUR"]=>
- string(4) "FOUR"
-}
-array(4) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
- ["three"]=>
- int(3)
- ["four"]=>
- string(4) "FOUR"
-}
-
-array(4) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
- ["three"]=>
- int(3)
- ["four"]=>
- string(4) "FOUR"
-}
-array(4) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
- ["THREE"]=>
- int(3)
- ["FOUR"]=>
- string(4) "FOUR"
-}
-array(4) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
- ["three"]=>
- int(3)
- ["four"]=>
- string(4) "FOUR"
-}
-
-array(4) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
- ["three"]=>
- int(3)
- ["four"]=>
- string(4) "four"
-}
-array(4) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
- ["THREE"]=>
- int(3)
- ["FOUR"]=>
- string(4) "four"
-}
-array(4) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
- ["three"]=>
- int(3)
- ["four"]=>
- string(4) "four"
-}
-
-end
diff --git a/ext/standard/tests/array/array_chunk.phpt b/ext/standard/tests/array/array_chunk.phpt
deleted file mode 100644
index 061c6994bf..0000000000
--- a/ext/standard/tests/array/array_chunk.phpt
+++ /dev/null
@@ -1,5326 +0,0 @@
---TEST--
-array_chunk()
---FILE--
-<?php
-$arrays = array (
- array (),
- array (0),
- array (1),
- array (-1),
- array (0, 2),
- array (1, 2, 3),
-
- array (1 => 0),
- array (2 => 1),
- array (3 => -1),
-
- array (1 => 0, 2 => 2),
- array (1 => 1, 2 => 2, 3 => 3),
- array (0 => 0, 3 => 2),
- array (1 => 1, 5 => 2, 8 => 3),
-
- array (1, 2),
- array (0, 1, 2),
- array (1, 2, 3),
- array (0, 1, 2, 3),
- array (1, 2, 3, 4),
- array (0, 1, 2, 3, 4),
- array (1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
- array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
-
- array ("a" => 1),
- array ("b" => 1, "c" => 2),
- array ("p" => 1, "q" => 2, "r" => 3, "s" => 4, "u" => 5, "v" => 6),
-
- array ("a" => "A"),
- array ("p" => "A", "q" => "B", "r" => "C", "s" => "D", "u" => "E", "v" => "F"),
-);
-
-foreach ($arrays as $item) {
- echo "===========================================\n";
- var_dump ($item);
- echo "-------------------------------------------\n";
- for ($i = 0; $i < (sizeof($item) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($item, $i));
- var_dump (@array_chunk ($item, $i, TRUE));
- var_dump (@array_chunk ($item, $i, FALSE));
- echo "\n";
- }
- echo "\n";
-}
-echo "end\n";
-?>
---EXPECT--
-===========================================
-array(0) {
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-
-===========================================
-array(1) {
- [0]=>
- int(0)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
-}
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
-}
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
-}
-
-
-===========================================
-array(1) {
- [0]=>
- int(1)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
-}
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
-}
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
-}
-
-
-===========================================
-array(1) {
- [0]=>
- int(-1)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(-1)
- }
-}
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(-1)
- }
-}
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(-1)
- }
-}
-
-
-===========================================
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(2)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(2) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
-}
-array(2) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [1]=>
- int(2)
- }
-}
-array(2) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
-}
-
-[2]
-array(1) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(2)
- }
-}
-array(1) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(2)
- }
-}
-array(1) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(2)
- }
-}
-
-
-===========================================
-array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(3) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
- [2]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-array(3) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [1]=>
- int(2)
- }
- [2]=>
- array(1) {
- [2]=>
- int(3)
- }
-}
-array(3) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
- [2]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-
-[2]
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(1) {
- [2]=>
- int(3)
- }
-}
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-
-[3]
-array(1) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
-}
-array(1) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
-}
-array(1) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
-}
-
-
-===========================================
-array(1) {
- [1]=>
- int(0)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
-}
-array(1) {
- [0]=>
- array(1) {
- [1]=>
- int(0)
- }
-}
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
-}
-
-
-===========================================
-array(1) {
- [2]=>
- int(1)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
-}
-array(1) {
- [0]=>
- array(1) {
- [2]=>
- int(1)
- }
-}
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
-}
-
-
-===========================================
-array(1) {
- [3]=>
- int(-1)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(-1)
- }
-}
-array(1) {
- [0]=>
- array(1) {
- [3]=>
- int(-1)
- }
-}
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(-1)
- }
-}
-
-
-===========================================
-array(2) {
- [1]=>
- int(0)
- [2]=>
- int(2)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(2) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
-}
-array(2) {
- [0]=>
- array(1) {
- [1]=>
- int(0)
- }
- [1]=>
- array(1) {
- [2]=>
- int(2)
- }
-}
-array(2) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
-}
-
-[2]
-array(1) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(2)
- }
-}
-array(1) {
- [0]=>
- array(2) {
- [1]=>
- int(0)
- [2]=>
- int(2)
- }
-}
-array(1) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(2)
- }
-}
-
-
-===========================================
-array(3) {
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(3) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
- [2]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-array(3) {
- [0]=>
- array(1) {
- [1]=>
- int(1)
- }
- [1]=>
- array(1) {
- [2]=>
- int(2)
- }
- [2]=>
- array(1) {
- [3]=>
- int(3)
- }
-}
-array(3) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
- [2]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-
-[2]
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-array(2) {
- [0]=>
- array(2) {
- [1]=>
- int(1)
- [2]=>
- int(2)
- }
- [1]=>
- array(1) {
- [3]=>
- int(3)
- }
-}
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-
-[3]
-array(1) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
-}
-array(1) {
- [0]=>
- array(3) {
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- }
-}
-array(1) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
-}
-
-
-===========================================
-array(2) {
- [0]=>
- int(0)
- [3]=>
- int(2)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(2) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
-}
-array(2) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [3]=>
- int(2)
- }
-}
-array(2) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
-}
-
-[2]
-array(1) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(2)
- }
-}
-array(1) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [3]=>
- int(2)
- }
-}
-array(1) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(2)
- }
-}
-
-
-===========================================
-array(3) {
- [1]=>
- int(1)
- [5]=>
- int(2)
- [8]=>
- int(3)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(3) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
- [2]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-array(3) {
- [0]=>
- array(1) {
- [1]=>
- int(1)
- }
- [1]=>
- array(1) {
- [5]=>
- int(2)
- }
- [2]=>
- array(1) {
- [8]=>
- int(3)
- }
-}
-array(3) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
- [2]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-
-[2]
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-array(2) {
- [0]=>
- array(2) {
- [1]=>
- int(1)
- [5]=>
- int(2)
- }
- [1]=>
- array(1) {
- [8]=>
- int(3)
- }
-}
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-
-[3]
-array(1) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
-}
-array(1) {
- [0]=>
- array(3) {
- [1]=>
- int(1)
- [5]=>
- int(2)
- [8]=>
- int(3)
- }
-}
-array(1) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
-}
-
-
-===========================================
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(2) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
-}
-array(2) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [1]=>
- int(2)
- }
-}
-array(2) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
-}
-
-[2]
-array(1) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
-}
-array(1) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
-}
-array(1) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
-}
-
-
-===========================================
-array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(3) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [0]=>
- int(1)
- }
- [2]=>
- array(1) {
- [0]=>
- int(2)
- }
-}
-array(3) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [1]=>
- int(1)
- }
- [2]=>
- array(1) {
- [2]=>
- int(2)
- }
-}
-array(3) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [0]=>
- int(1)
- }
- [2]=>
- array(1) {
- [0]=>
- int(2)
- }
-}
-
-[2]
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
-}
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- }
- [1]=>
- array(1) {
- [2]=>
- int(2)
- }
-}
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
-}
-
-[3]
-array(1) {
- [0]=>
- array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- }
-}
-array(1) {
- [0]=>
- array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- }
-}
-array(1) {
- [0]=>
- array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- }
-}
-
-
-===========================================
-array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(3) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
- [2]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-array(3) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [1]=>
- int(2)
- }
- [2]=>
- array(1) {
- [2]=>
- int(3)
- }
-}
-array(3) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
- [2]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-
-[2]
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(1) {
- [2]=>
- int(3)
- }
-}
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-
-[3]
-array(1) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
-}
-array(1) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
-}
-array(1) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
-}
-
-
-===========================================
-array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(4) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [0]=>
- int(1)
- }
- [2]=>
- array(1) {
- [0]=>
- int(2)
- }
- [3]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-array(4) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [1]=>
- int(1)
- }
- [2]=>
- array(1) {
- [2]=>
- int(2)
- }
- [3]=>
- array(1) {
- [3]=>
- int(3)
- }
-}
-array(4) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [0]=>
- int(1)
- }
- [2]=>
- array(1) {
- [0]=>
- int(2)
- }
- [3]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-
-[2]
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- }
- [1]=>
- array(2) {
- [0]=>
- int(2)
- [1]=>
- int(3)
- }
-}
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- }
- [1]=>
- array(2) {
- [2]=>
- int(2)
- [3]=>
- int(3)
- }
-}
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- }
- [1]=>
- array(2) {
- [0]=>
- int(2)
- [1]=>
- int(3)
- }
-}
-
-[3]
-array(2) {
- [0]=>
- array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- }
- [1]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-array(2) {
- [0]=>
- array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- }
- [1]=>
- array(1) {
- [3]=>
- int(3)
- }
-}
-array(2) {
- [0]=>
- array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- }
- [1]=>
- array(1) {
- [0]=>
- int(3)
- }
-}
-
-[4]
-array(1) {
- [0]=>
- array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- }
-}
-array(1) {
- [0]=>
- array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- }
-}
-array(1) {
- [0]=>
- array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- }
-}
-
-
-===========================================
-array(4) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(4) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
- [2]=>
- array(1) {
- [0]=>
- int(3)
- }
- [3]=>
- array(1) {
- [0]=>
- int(4)
- }
-}
-array(4) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [1]=>
- int(2)
- }
- [2]=>
- array(1) {
- [2]=>
- int(3)
- }
- [3]=>
- array(1) {
- [3]=>
- int(4)
- }
-}
-array(4) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
- [2]=>
- array(1) {
- [0]=>
- int(3)
- }
- [3]=>
- array(1) {
- [0]=>
- int(4)
- }
-}
-
-[2]
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(2) {
- [0]=>
- int(3)
- [1]=>
- int(4)
- }
-}
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(2) {
- [2]=>
- int(3)
- [3]=>
- int(4)
- }
-}
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(2) {
- [0]=>
- int(3)
- [1]=>
- int(4)
- }
-}
-
-[3]
-array(2) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- [1]=>
- array(1) {
- [0]=>
- int(4)
- }
-}
-array(2) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- [1]=>
- array(1) {
- [3]=>
- int(4)
- }
-}
-array(2) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- [1]=>
- array(1) {
- [0]=>
- int(4)
- }
-}
-
-[4]
-array(1) {
- [0]=>
- array(4) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- }
-}
-array(1) {
- [0]=>
- array(4) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- }
-}
-array(1) {
- [0]=>
- array(4) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- }
-}
-
-
-===========================================
-array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(5) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [0]=>
- int(1)
- }
- [2]=>
- array(1) {
- [0]=>
- int(2)
- }
- [3]=>
- array(1) {
- [0]=>
- int(3)
- }
- [4]=>
- array(1) {
- [0]=>
- int(4)
- }
-}
-array(5) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [1]=>
- int(1)
- }
- [2]=>
- array(1) {
- [2]=>
- int(2)
- }
- [3]=>
- array(1) {
- [3]=>
- int(3)
- }
- [4]=>
- array(1) {
- [4]=>
- int(4)
- }
-}
-array(5) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [0]=>
- int(1)
- }
- [2]=>
- array(1) {
- [0]=>
- int(2)
- }
- [3]=>
- array(1) {
- [0]=>
- int(3)
- }
- [4]=>
- array(1) {
- [0]=>
- int(4)
- }
-}
-
-[2]
-array(3) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- }
- [1]=>
- array(2) {
- [0]=>
- int(2)
- [1]=>
- int(3)
- }
- [2]=>
- array(1) {
- [0]=>
- int(4)
- }
-}
-array(3) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- }
- [1]=>
- array(2) {
- [2]=>
- int(2)
- [3]=>
- int(3)
- }
- [2]=>
- array(1) {
- [4]=>
- int(4)
- }
-}
-array(3) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- }
- [1]=>
- array(2) {
- [0]=>
- int(2)
- [1]=>
- int(3)
- }
- [2]=>
- array(1) {
- [0]=>
- int(4)
- }
-}
-
-[3]
-array(2) {
- [0]=>
- array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- }
- [1]=>
- array(2) {
- [0]=>
- int(3)
- [1]=>
- int(4)
- }
-}
-array(2) {
- [0]=>
- array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- }
- [1]=>
- array(2) {
- [3]=>
- int(3)
- [4]=>
- int(4)
- }
-}
-array(2) {
- [0]=>
- array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- }
- [1]=>
- array(2) {
- [0]=>
- int(3)
- [1]=>
- int(4)
- }
-}
-
-[4]
-array(2) {
- [0]=>
- array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- }
- [1]=>
- array(1) {
- [0]=>
- int(4)
- }
-}
-array(2) {
- [0]=>
- array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- }
- [1]=>
- array(1) {
- [4]=>
- int(4)
- }
-}
-array(2) {
- [0]=>
- array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- }
- [1]=>
- array(1) {
- [0]=>
- int(4)
- }
-}
-
-[5]
-array(1) {
- [0]=>
- array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- }
-}
-array(1) {
- [0]=>
- array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- }
-}
-array(1) {
- [0]=>
- array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- }
-}
-
-
-===========================================
-array(10) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- [7]=>
- int(8)
- [8]=>
- int(9)
- [9]=>
- int(10)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(10) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
- [2]=>
- array(1) {
- [0]=>
- int(3)
- }
- [3]=>
- array(1) {
- [0]=>
- int(4)
- }
- [4]=>
- array(1) {
- [0]=>
- int(5)
- }
- [5]=>
- array(1) {
- [0]=>
- int(6)
- }
- [6]=>
- array(1) {
- [0]=>
- int(7)
- }
- [7]=>
- array(1) {
- [0]=>
- int(8)
- }
- [8]=>
- array(1) {
- [0]=>
- int(9)
- }
- [9]=>
- array(1) {
- [0]=>
- int(10)
- }
-}
-array(10) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [1]=>
- int(2)
- }
- [2]=>
- array(1) {
- [2]=>
- int(3)
- }
- [3]=>
- array(1) {
- [3]=>
- int(4)
- }
- [4]=>
- array(1) {
- [4]=>
- int(5)
- }
- [5]=>
- array(1) {
- [5]=>
- int(6)
- }
- [6]=>
- array(1) {
- [6]=>
- int(7)
- }
- [7]=>
- array(1) {
- [7]=>
- int(8)
- }
- [8]=>
- array(1) {
- [8]=>
- int(9)
- }
- [9]=>
- array(1) {
- [9]=>
- int(10)
- }
-}
-array(10) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
- [2]=>
- array(1) {
- [0]=>
- int(3)
- }
- [3]=>
- array(1) {
- [0]=>
- int(4)
- }
- [4]=>
- array(1) {
- [0]=>
- int(5)
- }
- [5]=>
- array(1) {
- [0]=>
- int(6)
- }
- [6]=>
- array(1) {
- [0]=>
- int(7)
- }
- [7]=>
- array(1) {
- [0]=>
- int(8)
- }
- [8]=>
- array(1) {
- [0]=>
- int(9)
- }
- [9]=>
- array(1) {
- [0]=>
- int(10)
- }
-}
-
-[2]
-array(5) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(2) {
- [0]=>
- int(3)
- [1]=>
- int(4)
- }
- [2]=>
- array(2) {
- [0]=>
- int(5)
- [1]=>
- int(6)
- }
- [3]=>
- array(2) {
- [0]=>
- int(7)
- [1]=>
- int(8)
- }
- [4]=>
- array(2) {
- [0]=>
- int(9)
- [1]=>
- int(10)
- }
-}
-array(5) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(2) {
- [2]=>
- int(3)
- [3]=>
- int(4)
- }
- [2]=>
- array(2) {
- [4]=>
- int(5)
- [5]=>
- int(6)
- }
- [3]=>
- array(2) {
- [6]=>
- int(7)
- [7]=>
- int(8)
- }
- [4]=>
- array(2) {
- [8]=>
- int(9)
- [9]=>
- int(10)
- }
-}
-array(5) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(2) {
- [0]=>
- int(3)
- [1]=>
- int(4)
- }
- [2]=>
- array(2) {
- [0]=>
- int(5)
- [1]=>
- int(6)
- }
- [3]=>
- array(2) {
- [0]=>
- int(7)
- [1]=>
- int(8)
- }
- [4]=>
- array(2) {
- [0]=>
- int(9)
- [1]=>
- int(10)
- }
-}
-
-[3]
-array(4) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- [1]=>
- array(3) {
- [0]=>
- int(4)
- [1]=>
- int(5)
- [2]=>
- int(6)
- }
- [2]=>
- array(3) {
- [0]=>
- int(7)
- [1]=>
- int(8)
- [2]=>
- int(9)
- }
- [3]=>
- array(1) {
- [0]=>
- int(10)
- }
-}
-array(4) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- [1]=>
- array(3) {
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- }
- [2]=>
- array(3) {
- [6]=>
- int(7)
- [7]=>
- int(8)
- [8]=>
- int(9)
- }
- [3]=>
- array(1) {
- [9]=>
- int(10)
- }
-}
-array(4) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- [1]=>
- array(3) {
- [0]=>
- int(4)
- [1]=>
- int(5)
- [2]=>
- int(6)
- }
- [2]=>
- array(3) {
- [0]=>
- int(7)
- [1]=>
- int(8)
- [2]=>
- int(9)
- }
- [3]=>
- array(1) {
- [0]=>
- int(10)
- }
-}
-
-[4]
-array(3) {
- [0]=>
- array(4) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- }
- [1]=>
- array(4) {
- [0]=>
- int(5)
- [1]=>
- int(6)
- [2]=>
- int(7)
- [3]=>
- int(8)
- }
- [2]=>
- array(2) {
- [0]=>
- int(9)
- [1]=>
- int(10)
- }
-}
-array(3) {
- [0]=>
- array(4) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- }
- [1]=>
- array(4) {
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- [7]=>
- int(8)
- }
- [2]=>
- array(2) {
- [8]=>
- int(9)
- [9]=>
- int(10)
- }
-}
-array(3) {
- [0]=>
- array(4) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- }
- [1]=>
- array(4) {
- [0]=>
- int(5)
- [1]=>
- int(6)
- [2]=>
- int(7)
- [3]=>
- int(8)
- }
- [2]=>
- array(2) {
- [0]=>
- int(9)
- [1]=>
- int(10)
- }
-}
-
-[5]
-array(2) {
- [0]=>
- array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- }
- [1]=>
- array(5) {
- [0]=>
- int(6)
- [1]=>
- int(7)
- [2]=>
- int(8)
- [3]=>
- int(9)
- [4]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- }
- [1]=>
- array(5) {
- [5]=>
- int(6)
- [6]=>
- int(7)
- [7]=>
- int(8)
- [8]=>
- int(9)
- [9]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- }
- [1]=>
- array(5) {
- [0]=>
- int(6)
- [1]=>
- int(7)
- [2]=>
- int(8)
- [3]=>
- int(9)
- [4]=>
- int(10)
- }
-}
-
-[6]
-array(2) {
- [0]=>
- array(6) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- }
- [1]=>
- array(4) {
- [0]=>
- int(7)
- [1]=>
- int(8)
- [2]=>
- int(9)
- [3]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(6) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- }
- [1]=>
- array(4) {
- [6]=>
- int(7)
- [7]=>
- int(8)
- [8]=>
- int(9)
- [9]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(6) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- }
- [1]=>
- array(4) {
- [0]=>
- int(7)
- [1]=>
- int(8)
- [2]=>
- int(9)
- [3]=>
- int(10)
- }
-}
-
-[7]
-array(2) {
- [0]=>
- array(7) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- }
- [1]=>
- array(3) {
- [0]=>
- int(8)
- [1]=>
- int(9)
- [2]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(7) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- }
- [1]=>
- array(3) {
- [7]=>
- int(8)
- [8]=>
- int(9)
- [9]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(7) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- }
- [1]=>
- array(3) {
- [0]=>
- int(8)
- [1]=>
- int(9)
- [2]=>
- int(10)
- }
-}
-
-[8]
-array(2) {
- [0]=>
- array(8) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- [7]=>
- int(8)
- }
- [1]=>
- array(2) {
- [0]=>
- int(9)
- [1]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(8) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- [7]=>
- int(8)
- }
- [1]=>
- array(2) {
- [8]=>
- int(9)
- [9]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(8) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- [7]=>
- int(8)
- }
- [1]=>
- array(2) {
- [0]=>
- int(9)
- [1]=>
- int(10)
- }
-}
-
-[9]
-array(2) {
- [0]=>
- array(9) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- [7]=>
- int(8)
- [8]=>
- int(9)
- }
- [1]=>
- array(1) {
- [0]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(9) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- [7]=>
- int(8)
- [8]=>
- int(9)
- }
- [1]=>
- array(1) {
- [9]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(9) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- [7]=>
- int(8)
- [8]=>
- int(9)
- }
- [1]=>
- array(1) {
- [0]=>
- int(10)
- }
-}
-
-[10]
-array(1) {
- [0]=>
- array(10) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- [7]=>
- int(8)
- [8]=>
- int(9)
- [9]=>
- int(10)
- }
-}
-array(1) {
- [0]=>
- array(10) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- [7]=>
- int(8)
- [8]=>
- int(9)
- [9]=>
- int(10)
- }
-}
-array(1) {
- [0]=>
- array(10) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- [7]=>
- int(8)
- [8]=>
- int(9)
- [9]=>
- int(10)
- }
-}
-
-
-===========================================
-array(11) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- [7]=>
- int(7)
- [8]=>
- int(8)
- [9]=>
- int(9)
- [10]=>
- int(10)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(11) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [0]=>
- int(1)
- }
- [2]=>
- array(1) {
- [0]=>
- int(2)
- }
- [3]=>
- array(1) {
- [0]=>
- int(3)
- }
- [4]=>
- array(1) {
- [0]=>
- int(4)
- }
- [5]=>
- array(1) {
- [0]=>
- int(5)
- }
- [6]=>
- array(1) {
- [0]=>
- int(6)
- }
- [7]=>
- array(1) {
- [0]=>
- int(7)
- }
- [8]=>
- array(1) {
- [0]=>
- int(8)
- }
- [9]=>
- array(1) {
- [0]=>
- int(9)
- }
- [10]=>
- array(1) {
- [0]=>
- int(10)
- }
-}
-array(11) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [1]=>
- int(1)
- }
- [2]=>
- array(1) {
- [2]=>
- int(2)
- }
- [3]=>
- array(1) {
- [3]=>
- int(3)
- }
- [4]=>
- array(1) {
- [4]=>
- int(4)
- }
- [5]=>
- array(1) {
- [5]=>
- int(5)
- }
- [6]=>
- array(1) {
- [6]=>
- int(6)
- }
- [7]=>
- array(1) {
- [7]=>
- int(7)
- }
- [8]=>
- array(1) {
- [8]=>
- int(8)
- }
- [9]=>
- array(1) {
- [9]=>
- int(9)
- }
- [10]=>
- array(1) {
- [10]=>
- int(10)
- }
-}
-array(11) {
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
- [1]=>
- array(1) {
- [0]=>
- int(1)
- }
- [2]=>
- array(1) {
- [0]=>
- int(2)
- }
- [3]=>
- array(1) {
- [0]=>
- int(3)
- }
- [4]=>
- array(1) {
- [0]=>
- int(4)
- }
- [5]=>
- array(1) {
- [0]=>
- int(5)
- }
- [6]=>
- array(1) {
- [0]=>
- int(6)
- }
- [7]=>
- array(1) {
- [0]=>
- int(7)
- }
- [8]=>
- array(1) {
- [0]=>
- int(8)
- }
- [9]=>
- array(1) {
- [0]=>
- int(9)
- }
- [10]=>
- array(1) {
- [0]=>
- int(10)
- }
-}
-
-[2]
-array(6) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- }
- [1]=>
- array(2) {
- [0]=>
- int(2)
- [1]=>
- int(3)
- }
- [2]=>
- array(2) {
- [0]=>
- int(4)
- [1]=>
- int(5)
- }
- [3]=>
- array(2) {
- [0]=>
- int(6)
- [1]=>
- int(7)
- }
- [4]=>
- array(2) {
- [0]=>
- int(8)
- [1]=>
- int(9)
- }
- [5]=>
- array(1) {
- [0]=>
- int(10)
- }
-}
-array(6) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- }
- [1]=>
- array(2) {
- [2]=>
- int(2)
- [3]=>
- int(3)
- }
- [2]=>
- array(2) {
- [4]=>
- int(4)
- [5]=>
- int(5)
- }
- [3]=>
- array(2) {
- [6]=>
- int(6)
- [7]=>
- int(7)
- }
- [4]=>
- array(2) {
- [8]=>
- int(8)
- [9]=>
- int(9)
- }
- [5]=>
- array(1) {
- [10]=>
- int(10)
- }
-}
-array(6) {
- [0]=>
- array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- }
- [1]=>
- array(2) {
- [0]=>
- int(2)
- [1]=>
- int(3)
- }
- [2]=>
- array(2) {
- [0]=>
- int(4)
- [1]=>
- int(5)
- }
- [3]=>
- array(2) {
- [0]=>
- int(6)
- [1]=>
- int(7)
- }
- [4]=>
- array(2) {
- [0]=>
- int(8)
- [1]=>
- int(9)
- }
- [5]=>
- array(1) {
- [0]=>
- int(10)
- }
-}
-
-[3]
-array(4) {
- [0]=>
- array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- }
- [1]=>
- array(3) {
- [0]=>
- int(3)
- [1]=>
- int(4)
- [2]=>
- int(5)
- }
- [2]=>
- array(3) {
- [0]=>
- int(6)
- [1]=>
- int(7)
- [2]=>
- int(8)
- }
- [3]=>
- array(2) {
- [0]=>
- int(9)
- [1]=>
- int(10)
- }
-}
-array(4) {
- [0]=>
- array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- }
- [1]=>
- array(3) {
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- }
- [2]=>
- array(3) {
- [6]=>
- int(6)
- [7]=>
- int(7)
- [8]=>
- int(8)
- }
- [3]=>
- array(2) {
- [9]=>
- int(9)
- [10]=>
- int(10)
- }
-}
-array(4) {
- [0]=>
- array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- }
- [1]=>
- array(3) {
- [0]=>
- int(3)
- [1]=>
- int(4)
- [2]=>
- int(5)
- }
- [2]=>
- array(3) {
- [0]=>
- int(6)
- [1]=>
- int(7)
- [2]=>
- int(8)
- }
- [3]=>
- array(2) {
- [0]=>
- int(9)
- [1]=>
- int(10)
- }
-}
-
-[4]
-array(3) {
- [0]=>
- array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- }
- [1]=>
- array(4) {
- [0]=>
- int(4)
- [1]=>
- int(5)
- [2]=>
- int(6)
- [3]=>
- int(7)
- }
- [2]=>
- array(3) {
- [0]=>
- int(8)
- [1]=>
- int(9)
- [2]=>
- int(10)
- }
-}
-array(3) {
- [0]=>
- array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- }
- [1]=>
- array(4) {
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- [7]=>
- int(7)
- }
- [2]=>
- array(3) {
- [8]=>
- int(8)
- [9]=>
- int(9)
- [10]=>
- int(10)
- }
-}
-array(3) {
- [0]=>
- array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- }
- [1]=>
- array(4) {
- [0]=>
- int(4)
- [1]=>
- int(5)
- [2]=>
- int(6)
- [3]=>
- int(7)
- }
- [2]=>
- array(3) {
- [0]=>
- int(8)
- [1]=>
- int(9)
- [2]=>
- int(10)
- }
-}
-
-[5]
-array(3) {
- [0]=>
- array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- }
- [1]=>
- array(5) {
- [0]=>
- int(5)
- [1]=>
- int(6)
- [2]=>
- int(7)
- [3]=>
- int(8)
- [4]=>
- int(9)
- }
- [2]=>
- array(1) {
- [0]=>
- int(10)
- }
-}
-array(3) {
- [0]=>
- array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- }
- [1]=>
- array(5) {
- [5]=>
- int(5)
- [6]=>
- int(6)
- [7]=>
- int(7)
- [8]=>
- int(8)
- [9]=>
- int(9)
- }
- [2]=>
- array(1) {
- [10]=>
- int(10)
- }
-}
-array(3) {
- [0]=>
- array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- }
- [1]=>
- array(5) {
- [0]=>
- int(5)
- [1]=>
- int(6)
- [2]=>
- int(7)
- [3]=>
- int(8)
- [4]=>
- int(9)
- }
- [2]=>
- array(1) {
- [0]=>
- int(10)
- }
-}
-
-[6]
-array(2) {
- [0]=>
- array(6) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- }
- [1]=>
- array(5) {
- [0]=>
- int(6)
- [1]=>
- int(7)
- [2]=>
- int(8)
- [3]=>
- int(9)
- [4]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(6) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- }
- [1]=>
- array(5) {
- [6]=>
- int(6)
- [7]=>
- int(7)
- [8]=>
- int(8)
- [9]=>
- int(9)
- [10]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(6) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- }
- [1]=>
- array(5) {
- [0]=>
- int(6)
- [1]=>
- int(7)
- [2]=>
- int(8)
- [3]=>
- int(9)
- [4]=>
- int(10)
- }
-}
-
-[7]
-array(2) {
- [0]=>
- array(7) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- }
- [1]=>
- array(4) {
- [0]=>
- int(7)
- [1]=>
- int(8)
- [2]=>
- int(9)
- [3]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(7) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- }
- [1]=>
- array(4) {
- [7]=>
- int(7)
- [8]=>
- int(8)
- [9]=>
- int(9)
- [10]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(7) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- }
- [1]=>
- array(4) {
- [0]=>
- int(7)
- [1]=>
- int(8)
- [2]=>
- int(9)
- [3]=>
- int(10)
- }
-}
-
-[8]
-array(2) {
- [0]=>
- array(8) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- [7]=>
- int(7)
- }
- [1]=>
- array(3) {
- [0]=>
- int(8)
- [1]=>
- int(9)
- [2]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(8) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- [7]=>
- int(7)
- }
- [1]=>
- array(3) {
- [8]=>
- int(8)
- [9]=>
- int(9)
- [10]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(8) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- [7]=>
- int(7)
- }
- [1]=>
- array(3) {
- [0]=>
- int(8)
- [1]=>
- int(9)
- [2]=>
- int(10)
- }
-}
-
-[9]
-array(2) {
- [0]=>
- array(9) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- [7]=>
- int(7)
- [8]=>
- int(8)
- }
- [1]=>
- array(2) {
- [0]=>
- int(9)
- [1]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(9) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- [7]=>
- int(7)
- [8]=>
- int(8)
- }
- [1]=>
- array(2) {
- [9]=>
- int(9)
- [10]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(9) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- [7]=>
- int(7)
- [8]=>
- int(8)
- }
- [1]=>
- array(2) {
- [0]=>
- int(9)
- [1]=>
- int(10)
- }
-}
-
-[10]
-array(2) {
- [0]=>
- array(10) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- [7]=>
- int(7)
- [8]=>
- int(8)
- [9]=>
- int(9)
- }
- [1]=>
- array(1) {
- [0]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(10) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- [7]=>
- int(7)
- [8]=>
- int(8)
- [9]=>
- int(9)
- }
- [1]=>
- array(1) {
- [10]=>
- int(10)
- }
-}
-array(2) {
- [0]=>
- array(10) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- [7]=>
- int(7)
- [8]=>
- int(8)
- [9]=>
- int(9)
- }
- [1]=>
- array(1) {
- [0]=>
- int(10)
- }
-}
-
-[11]
-array(1) {
- [0]=>
- array(11) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- [7]=>
- int(7)
- [8]=>
- int(8)
- [9]=>
- int(9)
- [10]=>
- int(10)
- }
-}
-array(1) {
- [0]=>
- array(11) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- [7]=>
- int(7)
- [8]=>
- int(8)
- [9]=>
- int(9)
- [10]=>
- int(10)
- }
-}
-array(1) {
- [0]=>
- array(11) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
- [6]=>
- int(6)
- [7]=>
- int(7)
- [8]=>
- int(8)
- [9]=>
- int(9)
- [10]=>
- int(10)
- }
-}
-
-
-===========================================
-array(1) {
- ["a"]=>
- int(1)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
-}
-array(1) {
- [0]=>
- array(1) {
- ["a"]=>
- int(1)
- }
-}
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
-}
-
-
-===========================================
-array(2) {
- ["b"]=>
- int(1)
- ["c"]=>
- int(2)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(2) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
-}
-array(2) {
- [0]=>
- array(1) {
- ["b"]=>
- int(1)
- }
- [1]=>
- array(1) {
- ["c"]=>
- int(2)
- }
-}
-array(2) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
-}
-
-[2]
-array(1) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
-}
-array(1) {
- [0]=>
- array(2) {
- ["b"]=>
- int(1)
- ["c"]=>
- int(2)
- }
-}
-array(1) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
-}
-
-
-===========================================
-array(6) {
- ["p"]=>
- int(1)
- ["q"]=>
- int(2)
- ["r"]=>
- int(3)
- ["s"]=>
- int(4)
- ["u"]=>
- int(5)
- ["v"]=>
- int(6)
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(6) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
- [2]=>
- array(1) {
- [0]=>
- int(3)
- }
- [3]=>
- array(1) {
- [0]=>
- int(4)
- }
- [4]=>
- array(1) {
- [0]=>
- int(5)
- }
- [5]=>
- array(1) {
- [0]=>
- int(6)
- }
-}
-array(6) {
- [0]=>
- array(1) {
- ["p"]=>
- int(1)
- }
- [1]=>
- array(1) {
- ["q"]=>
- int(2)
- }
- [2]=>
- array(1) {
- ["r"]=>
- int(3)
- }
- [3]=>
- array(1) {
- ["s"]=>
- int(4)
- }
- [4]=>
- array(1) {
- ["u"]=>
- int(5)
- }
- [5]=>
- array(1) {
- ["v"]=>
- int(6)
- }
-}
-array(6) {
- [0]=>
- array(1) {
- [0]=>
- int(1)
- }
- [1]=>
- array(1) {
- [0]=>
- int(2)
- }
- [2]=>
- array(1) {
- [0]=>
- int(3)
- }
- [3]=>
- array(1) {
- [0]=>
- int(4)
- }
- [4]=>
- array(1) {
- [0]=>
- int(5)
- }
- [5]=>
- array(1) {
- [0]=>
- int(6)
- }
-}
-
-[2]
-array(3) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(2) {
- [0]=>
- int(3)
- [1]=>
- int(4)
- }
- [2]=>
- array(2) {
- [0]=>
- int(5)
- [1]=>
- int(6)
- }
-}
-array(3) {
- [0]=>
- array(2) {
- ["p"]=>
- int(1)
- ["q"]=>
- int(2)
- }
- [1]=>
- array(2) {
- ["r"]=>
- int(3)
- ["s"]=>
- int(4)
- }
- [2]=>
- array(2) {
- ["u"]=>
- int(5)
- ["v"]=>
- int(6)
- }
-}
-array(3) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- }
- [1]=>
- array(2) {
- [0]=>
- int(3)
- [1]=>
- int(4)
- }
- [2]=>
- array(2) {
- [0]=>
- int(5)
- [1]=>
- int(6)
- }
-}
-
-[3]
-array(2) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- [1]=>
- array(3) {
- [0]=>
- int(4)
- [1]=>
- int(5)
- [2]=>
- int(6)
- }
-}
-array(2) {
- [0]=>
- array(3) {
- ["p"]=>
- int(1)
- ["q"]=>
- int(2)
- ["r"]=>
- int(3)
- }
- [1]=>
- array(3) {
- ["s"]=>
- int(4)
- ["u"]=>
- int(5)
- ["v"]=>
- int(6)
- }
-}
-array(2) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- [1]=>
- array(3) {
- [0]=>
- int(4)
- [1]=>
- int(5)
- [2]=>
- int(6)
- }
-}
-
-[4]
-array(2) {
- [0]=>
- array(4) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- }
- [1]=>
- array(2) {
- [0]=>
- int(5)
- [1]=>
- int(6)
- }
-}
-array(2) {
- [0]=>
- array(4) {
- ["p"]=>
- int(1)
- ["q"]=>
- int(2)
- ["r"]=>
- int(3)
- ["s"]=>
- int(4)
- }
- [1]=>
- array(2) {
- ["u"]=>
- int(5)
- ["v"]=>
- int(6)
- }
-}
-array(2) {
- [0]=>
- array(4) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- }
- [1]=>
- array(2) {
- [0]=>
- int(5)
- [1]=>
- int(6)
- }
-}
-
-[5]
-array(2) {
- [0]=>
- array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- }
- [1]=>
- array(1) {
- [0]=>
- int(6)
- }
-}
-array(2) {
- [0]=>
- array(5) {
- ["p"]=>
- int(1)
- ["q"]=>
- int(2)
- ["r"]=>
- int(3)
- ["s"]=>
- int(4)
- ["u"]=>
- int(5)
- }
- [1]=>
- array(1) {
- ["v"]=>
- int(6)
- }
-}
-array(2) {
- [0]=>
- array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- }
- [1]=>
- array(1) {
- [0]=>
- int(6)
- }
-}
-
-[6]
-array(1) {
- [0]=>
- array(6) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- }
-}
-array(1) {
- [0]=>
- array(6) {
- ["p"]=>
- int(1)
- ["q"]=>
- int(2)
- ["r"]=>
- int(3)
- ["s"]=>
- int(4)
- ["u"]=>
- int(5)
- ["v"]=>
- int(6)
- }
-}
-array(1) {
- [0]=>
- array(6) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- }
-}
-
-
-===========================================
-array(1) {
- ["a"]=>
- string(1) "A"
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- string(1) "A"
- }
-}
-array(1) {
- [0]=>
- array(1) {
- ["a"]=>
- string(1) "A"
- }
-}
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- string(1) "A"
- }
-}
-
-
-===========================================
-array(6) {
- ["p"]=>
- string(1) "A"
- ["q"]=>
- string(1) "B"
- ["r"]=>
- string(1) "C"
- ["s"]=>
- string(1) "D"
- ["u"]=>
- string(1) "E"
- ["v"]=>
- string(1) "F"
-}
--------------------------------------------
-[0]
-NULL
-NULL
-NULL
-
-[1]
-array(6) {
- [0]=>
- array(1) {
- [0]=>
- string(1) "A"
- }
- [1]=>
- array(1) {
- [0]=>
- string(1) "B"
- }
- [2]=>
- array(1) {
- [0]=>
- string(1) "C"
- }
- [3]=>
- array(1) {
- [0]=>
- string(1) "D"
- }
- [4]=>
- array(1) {
- [0]=>
- string(1) "E"
- }
- [5]=>
- array(1) {
- [0]=>
- string(1) "F"
- }
-}
-array(6) {
- [0]=>
- array(1) {
- ["p"]=>
- string(1) "A"
- }
- [1]=>
- array(1) {
- ["q"]=>
- string(1) "B"
- }
- [2]=>
- array(1) {
- ["r"]=>
- string(1) "C"
- }
- [3]=>
- array(1) {
- ["s"]=>
- string(1) "D"
- }
- [4]=>
- array(1) {
- ["u"]=>
- string(1) "E"
- }
- [5]=>
- array(1) {
- ["v"]=>
- string(1) "F"
- }
-}
-array(6) {
- [0]=>
- array(1) {
- [0]=>
- string(1) "A"
- }
- [1]=>
- array(1) {
- [0]=>
- string(1) "B"
- }
- [2]=>
- array(1) {
- [0]=>
- string(1) "C"
- }
- [3]=>
- array(1) {
- [0]=>
- string(1) "D"
- }
- [4]=>
- array(1) {
- [0]=>
- string(1) "E"
- }
- [5]=>
- array(1) {
- [0]=>
- string(1) "F"
- }
-}
-
-[2]
-array(3) {
- [0]=>
- array(2) {
- [0]=>
- string(1) "A"
- [1]=>
- string(1) "B"
- }
- [1]=>
- array(2) {
- [0]=>
- string(1) "C"
- [1]=>
- string(1) "D"
- }
- [2]=>
- array(2) {
- [0]=>
- string(1) "E"
- [1]=>
- string(1) "F"
- }
-}
-array(3) {
- [0]=>
- array(2) {
- ["p"]=>
- string(1) "A"
- ["q"]=>
- string(1) "B"
- }
- [1]=>
- array(2) {
- ["r"]=>
- string(1) "C"
- ["s"]=>
- string(1) "D"
- }
- [2]=>
- array(2) {
- ["u"]=>
- string(1) "E"
- ["v"]=>
- string(1) "F"
- }
-}
-array(3) {
- [0]=>
- array(2) {
- [0]=>
- string(1) "A"
- [1]=>
- string(1) "B"
- }
- [1]=>
- array(2) {
- [0]=>
- string(1) "C"
- [1]=>
- string(1) "D"
- }
- [2]=>
- array(2) {
- [0]=>
- string(1) "E"
- [1]=>
- string(1) "F"
- }
-}
-
-[3]
-array(2) {
- [0]=>
- array(3) {
- [0]=>
- string(1) "A"
- [1]=>
- string(1) "B"
- [2]=>
- string(1) "C"
- }
- [1]=>
- array(3) {
- [0]=>
- string(1) "D"
- [1]=>
- string(1) "E"
- [2]=>
- string(1) "F"
- }
-}
-array(2) {
- [0]=>
- array(3) {
- ["p"]=>
- string(1) "A"
- ["q"]=>
- string(1) "B"
- ["r"]=>
- string(1) "C"
- }
- [1]=>
- array(3) {
- ["s"]=>
- string(1) "D"
- ["u"]=>
- string(1) "E"
- ["v"]=>
- string(1) "F"
- }
-}
-array(2) {
- [0]=>
- array(3) {
- [0]=>
- string(1) "A"
- [1]=>
- string(1) "B"
- [2]=>
- string(1) "C"
- }
- [1]=>
- array(3) {
- [0]=>
- string(1) "D"
- [1]=>
- string(1) "E"
- [2]=>
- string(1) "F"
- }
-}
-
-[4]
-array(2) {
- [0]=>
- array(4) {
- [0]=>
- string(1) "A"
- [1]=>
- string(1) "B"
- [2]=>
- string(1) "C"
- [3]=>
- string(1) "D"
- }
- [1]=>
- array(2) {
- [0]=>
- string(1) "E"
- [1]=>
- string(1) "F"
- }
-}
-array(2) {
- [0]=>
- array(4) {
- ["p"]=>
- string(1) "A"
- ["q"]=>
- string(1) "B"
- ["r"]=>
- string(1) "C"
- ["s"]=>
- string(1) "D"
- }
- [1]=>
- array(2) {
- ["u"]=>
- string(1) "E"
- ["v"]=>
- string(1) "F"
- }
-}
-array(2) {
- [0]=>
- array(4) {
- [0]=>
- string(1) "A"
- [1]=>
- string(1) "B"
- [2]=>
- string(1) "C"
- [3]=>
- string(1) "D"
- }
- [1]=>
- array(2) {
- [0]=>
- string(1) "E"
- [1]=>
- string(1) "F"
- }
-}
-
-[5]
-array(2) {
- [0]=>
- array(5) {
- [0]=>
- string(1) "A"
- [1]=>
- string(1) "B"
- [2]=>
- string(1) "C"
- [3]=>
- string(1) "D"
- [4]=>
- string(1) "E"
- }
- [1]=>
- array(1) {
- [0]=>
- string(1) "F"
- }
-}
-array(2) {
- [0]=>
- array(5) {
- ["p"]=>
- string(1) "A"
- ["q"]=>
- string(1) "B"
- ["r"]=>
- string(1) "C"
- ["s"]=>
- string(1) "D"
- ["u"]=>
- string(1) "E"
- }
- [1]=>
- array(1) {
- ["v"]=>
- string(1) "F"
- }
-}
-array(2) {
- [0]=>
- array(5) {
- [0]=>
- string(1) "A"
- [1]=>
- string(1) "B"
- [2]=>
- string(1) "C"
- [3]=>
- string(1) "D"
- [4]=>
- string(1) "E"
- }
- [1]=>
- array(1) {
- [0]=>
- string(1) "F"
- }
-}
-
-[6]
-array(1) {
- [0]=>
- array(6) {
- [0]=>
- string(1) "A"
- [1]=>
- string(1) "B"
- [2]=>
- string(1) "C"
- [3]=>
- string(1) "D"
- [4]=>
- string(1) "E"
- [5]=>
- string(1) "F"
- }
-}
-array(1) {
- [0]=>
- array(6) {
- ["p"]=>
- string(1) "A"
- ["q"]=>
- string(1) "B"
- ["r"]=>
- string(1) "C"
- ["s"]=>
- string(1) "D"
- ["u"]=>
- string(1) "E"
- ["v"]=>
- string(1) "F"
- }
-}
-array(1) {
- [0]=>
- array(6) {
- [0]=>
- string(1) "A"
- [1]=>
- string(1) "B"
- [2]=>
- string(1) "C"
- [3]=>
- string(1) "D"
- [4]=>
- string(1) "E"
- [5]=>
- string(1) "F"
- }
-}
-
-
-end
diff --git a/ext/standard/tests/array/array_count_values.phpt b/ext/standard/tests/array/array_count_values.phpt
deleted file mode 100644
index d9a3ba3d5a..0000000000
--- a/ext/standard/tests/array/array_count_values.phpt
+++ /dev/null
@@ -1,95 +0,0 @@
---TEST--
-array_count_values()
---FILE--
-<?php
-$arrays = array (
- array (),
- array (0),
- array (1),
- array (-1),
- array (0, 0),
- array (0, 1),
- array (1, 1),
- array (1, "hello", 1, "world", "hello"),
- array ("hello", "world", "hello"),
- array ("", "world", "", "hello", "world", "hello", "hello", "world", "hello"),
- array (0, array (1, "hello", 1, "world", "hello")),
- array (1, array (1, "hello", 1, "world", "hello"), array (1, "hello", 1, "world", "hello"), array (1, "hello", 1, "world", "hello")),
-);
-
-foreach ($arrays as $item) {
- var_dump (@array_count_values ($item));
- echo "\n";
-}
-?>
---EXPECT--
-array(0) {
-}
-
-array(1) {
- [0]=>
- int(1)
-}
-
-array(1) {
- [1]=>
- int(1)
-}
-
-array(1) {
- [-1]=>
- int(1)
-}
-
-array(1) {
- [0]=>
- int(2)
-}
-
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(1)
-}
-
-array(1) {
- [1]=>
- int(2)
-}
-
-array(3) {
- [1]=>
- int(2)
- ["hello"]=>
- int(2)
- ["world"]=>
- int(1)
-}
-
-array(2) {
- ["hello"]=>
- int(2)
- ["world"]=>
- int(1)
-}
-
-array(3) {
- [""]=>
- int(2)
- ["world"]=>
- int(3)
- ["hello"]=>
- int(4)
-}
-
-array(1) {
- [0]=>
- int(1)
-}
-
-array(1) {
- [1]=>
- int(1)
-}
-
diff --git a/ext/standard/tests/array/array_search.phpt b/ext/standard/tests/array/array_search.phpt
deleted file mode 100644
index 9c21de94e4..0000000000
--- a/ext/standard/tests/array/array_search.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-search_array and in_array (including bug 13567)
---FILE--
-<?php
-
-$arr1 = array('a','b','c');
-$arr2 = array();
-$arr3 = array('c','key'=>'d');
-$arr4 = array("a\0b"=>'e','key'=>'d', 'f');
-
-$tests = <<<TESTS
-FALSE === in_array(123, \$arr1)
-FALSE === array_search(123, \$arr1)
-TRUE === in_array('a', \$arr1)
-0 === array_search('a', \$arr1)
-"a\\0b"=== array_search('e', \$arr4)
-'key'=== array_search('d', \$arr4)
-TESTS;
-
-include('tests/quicktester.inc');
-
---EXPECT--
-OK
diff --git a/ext/standard/tests/array/bug12776.phpt b/ext/standard/tests/array/bug12776.phpt
deleted file mode 100644
index 54c6f6fceb..0000000000
--- a/ext/standard/tests/array/bug12776.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-Bug #12776 (array_walk crash)
---FILE--
-<?php
-
-function test($val,$key)
-{
- global $globalArray;
- $globalArray[]=$key; // this will end up crashing
- $globalArray[]=(string)$key; // this will end up OK
- print "val: $val; key: $key\n"; flush();
-}
-
-$arr=array('k'=>'v');
-array_walk($arr,'test');
-
-print "First value: ".$globalArray[0];
-
-print "\nDone\n";
-
-?>
---EXPECT--
-val: v; key: k
-First value: k
-Done
diff --git a/ext/standard/tests/array/bug20381.phpt b/ext/standard/tests/array/bug20381.phpt
deleted file mode 100644
index 1adaa863b7..0000000000
--- a/ext/standard/tests/array/bug20381.phpt
+++ /dev/null
@@ -1,79 +0,0 @@
---TEST--
-Bug #20381 (array_merge_recursive mangles input arrays)
---FILE--
-<?php
-$a = array(
- 'a1' => 1,
- 'a2' => array( 1, 2, 3 ),
- 'a3' => array(
- 'a' => array( 10, 20, 30 ),
- 'b' => 'b'
- )
- );
-$b = array( 'a1' => 2,
- 'a2' => array( 3, 4, 5 ),
- 'a3' => array(
- 'c' => 'cc',
- 'a' => array( 10, 40 )
- )
- );
-
-var_dump($a);
-array_merge_recursive( $a, $b );
-var_dump($a);
-?>
---EXPECT--
-array(3) {
- ["a1"]=>
- int(1)
- ["a2"]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- ["a3"]=>
- array(2) {
- ["a"]=>
- array(3) {
- [0]=>
- int(10)
- [1]=>
- int(20)
- [2]=>
- int(30)
- }
- ["b"]=>
- string(1) "b"
- }
-}
-array(3) {
- ["a1"]=>
- int(1)
- ["a2"]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- ["a3"]=>
- array(2) {
- ["a"]=>
- array(3) {
- [0]=>
- int(10)
- [1]=>
- int(20)
- [2]=>
- int(30)
- }
- ["b"]=>
- string(1) "b"
- }
-}
diff --git a/ext/standard/tests/array/bug20865.phpt b/ext/standard/tests/array/bug20865.phpt
deleted file mode 100644
index f1edbabab5..0000000000
--- a/ext/standard/tests/array/bug20865.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-Bug #20865 (array_key_exists and NULL key)
---FILE--
-<?php
- $ta = array(1, 2, 3);
- $ta[NULL] = "Null Value";
-
- var_dump(array_key_exists(NULL, $ta));
-?>
---EXPECT--
-bool(true)
diff --git a/ext/standard/tests/array/bug21182.phpt b/ext/standard/tests/array/bug21182.phpt
deleted file mode 100644
index af4602ab74..0000000000
--- a/ext/standard/tests/array/bug21182.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Bug #21182 (range modifies arguments)
---FILE--
-<?php
-$a = "20"; $b = "30";
-echo "a1: $a\n";
-$result = range($a, $b);
-echo "a2: $a : type : " . gettype($a) . "\n";
-?>
---EXPECT--
-a1: 20
-a2: 20 : type : string
diff --git a/ext/standard/tests/array/bug21998.phpt b/ext/standard/tests/array/bug21998.phpt
deleted file mode 100644
index aa52dc590a..0000000000
--- a/ext/standard/tests/array/bug21998.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Bug #21998 (array_pop() does not reset the current array position)
---FILE--
-<?php
-
-$a = array("a", "b", "c");
-
-var_dump(key($a));
-var_dump(array_pop($a));
-var_dump(key($a));
-var_dump(array_pop($a));
-var_dump(key($a));
-var_dump(array_pop($a));
-var_dump(key($a));
-
-?>
---EXPECT--
-int(0)
-string(1) "c"
-int(0)
-string(1) "b"
-int(0)
-string(1) "a"
-NULL
diff --git a/ext/standard/tests/array/bug22088.phpt b/ext/standard/tests/array/bug22088.phpt
deleted file mode 100644
index 4352cff914..0000000000
--- a/ext/standard/tests/array/bug22088.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Bug #22088 (array_shift() leaves next index to be +1 too much)
---FILE--
-<?php
-
-$a = array('a', 'b', 'c');
-$last = array_shift ($a);
-$a[] = 'a';
-var_dump($a);
-
-$a = array('a' => 1, 'b' => 2, 'c' => 3);
-$last = array_shift ($a);
-$a[] = 'a';
-var_dump($a);
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- string(1) "b"
- [1]=>
- string(1) "c"
- [2]=>
- string(1) "a"
-}
-array(3) {
- ["b"]=>
- int(2)
- ["c"]=>
- int(3)
- [0]=>
- string(1) "a"
-}
diff --git a/ext/standard/tests/array/bug22463.phpt b/ext/standard/tests/array/bug22463.phpt
deleted file mode 100644
index dcede511bb..0000000000
--- a/ext/standard/tests/array/bug22463.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-Bug #22463 (array_reduce() segfaults)
---FILE--
-<?php
-
-function a($ary) {
- return (is_array($ary) ? array_reduce($ary, 'cb', 0) : 1);
-}
-
-function cb($v, $elem) {
- return $v + a($elem);
-}
-
-$ary = array(
- array(
- array(
- array(
- array(
- array(0, 1, 2, 3, 4)
- )
- )
- )
- )
-);
-
-var_dump(a($ary));
-?>
---EXPECT--
-int(5)
diff --git a/ext/standard/tests/array/bug23581.phpt b/ext/standard/tests/array/bug23581.phpt
deleted file mode 100644
index 06e1e388ef..0000000000
--- a/ext/standard/tests/array/bug23581.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-Bug #23581 (array_map(NULL, array, array, ...) yields an undefined result)
---FILE--
-<?php
-var_dump(
- array_map(
- NULL,
- array(1,2,3),
- array(4,5,6),
- array(7,8,9)
- )
-);
-?>
---EXPECT--
-array(3) {
- [0]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(4)
- [2]=>
- int(7)
- }
- [1]=>
- array(3) {
- [0]=>
- int(2)
- [1]=>
- int(5)
- [2]=>
- int(8)
- }
- [2]=>
- array(3) {
- [0]=>
- int(3)
- [1]=>
- int(6)
- [2]=>
- int(9)
- }
-}
-
diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt
deleted file mode 100644
index e6824ab0e5..0000000000
--- a/ext/standard/tests/array/count_recursive.phpt
+++ /dev/null
@@ -1,52 +0,0 @@
---TEST--
-count
---FILE--
-<?php
-print "Testing NULL...\n";
-$arr = NULL;
-print "COUNT_NORMAL: should be 0, is ".count($arr, COUNT_NORMAL)."\n";
-print "COUNT_RECURSIVE: should be 0, is ".count($arr, COUNT_RECURSIVE)."\n";
-
-print "Testing arrays...\n";
-$arr = array(1, array(3, 4, array(6, array(8))));
-print "COUNT_NORMAL: should be 2, is ".count($arr, COUNT_NORMAL)."\n";
-print "COUNT_RECURSIVE: should be 8, is ".count($arr, COUNT_RECURSIVE)."\n";
-
-print "Testing hashes...\n";
-$arr = array("a" => 1, "b" => 2, array("c" => 3, array("d" => 5)));
-print "COUNT_NORMAL: should be 3, is ".count($arr, COUNT_NORMAL)."\n";
-print "COUNT_RECURSIVE: should be 6, is ".count($arr, COUNT_RECURSIVE)."\n";
-
-print "Testing strings...\n";
-print "COUNT_NORMAL: should be 1, is ".count("string", COUNT_NORMAL)."\n";
-print "COUNT_RECURSIVE: should be 1, is ".count("string", COUNT_RECURSIVE)."\n";
-
-print "Testing various types with no second argument.\n";
-print "COUNT_NORMAL: should be 1, is ".count("string")."\n";
-print "COUNT_NORMAL: should be 2, is ".count(array("a", array("b")))."\n";
-
-$arr = array('a'=>array(NULL, NULL, NULL), 1=>array(NULL=>1, 1=>NULL),
- array(array(array(array(array(NULL))))));
-print "Testing really cool arrays ;)\n";
-print "COUNT_NORMAL: should be 3, is ".count($arr, COUNT_NORMAL)."\n";
-print "COUNT_RECURSIVE: should be 13, is ".count($arr, COUNT_RECURSIVE)."\n";
-?>
---EXPECT--
-Testing NULL...
-COUNT_NORMAL: should be 0, is 0
-COUNT_RECURSIVE: should be 0, is 0
-Testing arrays...
-COUNT_NORMAL: should be 2, is 2
-COUNT_RECURSIVE: should be 8, is 8
-Testing hashes...
-COUNT_NORMAL: should be 3, is 3
-COUNT_RECURSIVE: should be 6, is 6
-Testing strings...
-COUNT_NORMAL: should be 1, is 1
-COUNT_RECURSIVE: should be 1, is 1
-Testing various types with no second argument.
-COUNT_NORMAL: should be 1, is 1
-COUNT_NORMAL: should be 2, is 2
-Testing really cool arrays ;)
-COUNT_NORMAL: should be 3, is 3
-COUNT_RECURSIVE: should be 13, is 13
diff --git a/ext/standard/tests/array/data.inc b/ext/standard/tests/array/data.inc
deleted file mode 100644
index 2991274be8..0000000000
--- a/ext/standard/tests/array/data.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-$tmp = pow(2,24);
-$data = array(
- 'PHP',
- 17=>'PHP: Hypertext Preprocessor',
- 5=>'Test',
- 'test'=>27,
- 1000=>'test',
- "-1000"=>array('banana', 'orange'),
- 'monkey',
- $tmp=>-1/3
-);
-?>
diff --git a/ext/standard/tests/array/range.phpt b/ext/standard/tests/array/range.phpt
deleted file mode 100644
index 23fb985f86..0000000000
--- a/ext/standard/tests/array/range.phpt
+++ /dev/null
@@ -1,1345 +0,0 @@
---TEST--
-range()
---FILE--
-<?php
- var_dump(range(1, 100));
- var_dump(range(100, 1));
-
- var_dump(range("1", "100"));
- var_dump(range("100", "1"));
-
- var_dump(range("a", "z"));
- var_dump(range("z", "a"));
- var_dump(range("q", "q"));
-
- var_dump(range(5, 5));
-
- var_dump(range(5.1, 10.1));
- var_dump(range(10.1, 5.1));
-
- var_dump(range("5.1", "10.1"));
- var_dump(range("10.1", "5.1"));
-
- var_dump(range(1, 5, 0.1));
- var_dump(range(5, 1, 0.1));
-
- var_dump(range(1, 5, "0.1"));
- var_dump(range("1", "5", 0.1));
-?>
---EXPECT--
-array(100) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- [7]=>
- int(8)
- [8]=>
- int(9)
- [9]=>
- int(10)
- [10]=>
- int(11)
- [11]=>
- int(12)
- [12]=>
- int(13)
- [13]=>
- int(14)
- [14]=>
- int(15)
- [15]=>
- int(16)
- [16]=>
- int(17)
- [17]=>
- int(18)
- [18]=>
- int(19)
- [19]=>
- int(20)
- [20]=>
- int(21)
- [21]=>
- int(22)
- [22]=>
- int(23)
- [23]=>
- int(24)
- [24]=>
- int(25)
- [25]=>
- int(26)
- [26]=>
- int(27)
- [27]=>
- int(28)
- [28]=>
- int(29)
- [29]=>
- int(30)
- [30]=>
- int(31)
- [31]=>
- int(32)
- [32]=>
- int(33)
- [33]=>
- int(34)
- [34]=>
- int(35)
- [35]=>
- int(36)
- [36]=>
- int(37)
- [37]=>
- int(38)
- [38]=>
- int(39)
- [39]=>
- int(40)
- [40]=>
- int(41)
- [41]=>
- int(42)
- [42]=>
- int(43)
- [43]=>
- int(44)
- [44]=>
- int(45)
- [45]=>
- int(46)
- [46]=>
- int(47)
- [47]=>
- int(48)
- [48]=>
- int(49)
- [49]=>
- int(50)
- [50]=>
- int(51)
- [51]=>
- int(52)
- [52]=>
- int(53)
- [53]=>
- int(54)
- [54]=>
- int(55)
- [55]=>
- int(56)
- [56]=>
- int(57)
- [57]=>
- int(58)
- [58]=>
- int(59)
- [59]=>
- int(60)
- [60]=>
- int(61)
- [61]=>
- int(62)
- [62]=>
- int(63)
- [63]=>
- int(64)
- [64]=>
- int(65)
- [65]=>
- int(66)
- [66]=>
- int(67)
- [67]=>
- int(68)
- [68]=>
- int(69)
- [69]=>
- int(70)
- [70]=>
- int(71)
- [71]=>
- int(72)
- [72]=>
- int(73)
- [73]=>
- int(74)
- [74]=>
- int(75)
- [75]=>
- int(76)
- [76]=>
- int(77)
- [77]=>
- int(78)
- [78]=>
- int(79)
- [79]=>
- int(80)
- [80]=>
- int(81)
- [81]=>
- int(82)
- [82]=>
- int(83)
- [83]=>
- int(84)
- [84]=>
- int(85)
- [85]=>
- int(86)
- [86]=>
- int(87)
- [87]=>
- int(88)
- [88]=>
- int(89)
- [89]=>
- int(90)
- [90]=>
- int(91)
- [91]=>
- int(92)
- [92]=>
- int(93)
- [93]=>
- int(94)
- [94]=>
- int(95)
- [95]=>
- int(96)
- [96]=>
- int(97)
- [97]=>
- int(98)
- [98]=>
- int(99)
- [99]=>
- int(100)
-}
-array(100) {
- [0]=>
- int(100)
- [1]=>
- int(99)
- [2]=>
- int(98)
- [3]=>
- int(97)
- [4]=>
- int(96)
- [5]=>
- int(95)
- [6]=>
- int(94)
- [7]=>
- int(93)
- [8]=>
- int(92)
- [9]=>
- int(91)
- [10]=>
- int(90)
- [11]=>
- int(89)
- [12]=>
- int(88)
- [13]=>
- int(87)
- [14]=>
- int(86)
- [15]=>
- int(85)
- [16]=>
- int(84)
- [17]=>
- int(83)
- [18]=>
- int(82)
- [19]=>
- int(81)
- [20]=>
- int(80)
- [21]=>
- int(79)
- [22]=>
- int(78)
- [23]=>
- int(77)
- [24]=>
- int(76)
- [25]=>
- int(75)
- [26]=>
- int(74)
- [27]=>
- int(73)
- [28]=>
- int(72)
- [29]=>
- int(71)
- [30]=>
- int(70)
- [31]=>
- int(69)
- [32]=>
- int(68)
- [33]=>
- int(67)
- [34]=>
- int(66)
- [35]=>
- int(65)
- [36]=>
- int(64)
- [37]=>
- int(63)
- [38]=>
- int(62)
- [39]=>
- int(61)
- [40]=>
- int(60)
- [41]=>
- int(59)
- [42]=>
- int(58)
- [43]=>
- int(57)
- [44]=>
- int(56)
- [45]=>
- int(55)
- [46]=>
- int(54)
- [47]=>
- int(53)
- [48]=>
- int(52)
- [49]=>
- int(51)
- [50]=>
- int(50)
- [51]=>
- int(49)
- [52]=>
- int(48)
- [53]=>
- int(47)
- [54]=>
- int(46)
- [55]=>
- int(45)
- [56]=>
- int(44)
- [57]=>
- int(43)
- [58]=>
- int(42)
- [59]=>
- int(41)
- [60]=>
- int(40)
- [61]=>
- int(39)
- [62]=>
- int(38)
- [63]=>
- int(37)
- [64]=>
- int(36)
- [65]=>
- int(35)
- [66]=>
- int(34)
- [67]=>
- int(33)
- [68]=>
- int(32)
- [69]=>
- int(31)
- [70]=>
- int(30)
- [71]=>
- int(29)
- [72]=>
- int(28)
- [73]=>
- int(27)
- [74]=>
- int(26)
- [75]=>
- int(25)
- [76]=>
- int(24)
- [77]=>
- int(23)
- [78]=>
- int(22)
- [79]=>
- int(21)
- [80]=>
- int(20)
- [81]=>
- int(19)
- [82]=>
- int(18)
- [83]=>
- int(17)
- [84]=>
- int(16)
- [85]=>
- int(15)
- [86]=>
- int(14)
- [87]=>
- int(13)
- [88]=>
- int(12)
- [89]=>
- int(11)
- [90]=>
- int(10)
- [91]=>
- int(9)
- [92]=>
- int(8)
- [93]=>
- int(7)
- [94]=>
- int(6)
- [95]=>
- int(5)
- [96]=>
- int(4)
- [97]=>
- int(3)
- [98]=>
- int(2)
- [99]=>
- int(1)
-}
-array(100) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
- [5]=>
- int(6)
- [6]=>
- int(7)
- [7]=>
- int(8)
- [8]=>
- int(9)
- [9]=>
- int(10)
- [10]=>
- int(11)
- [11]=>
- int(12)
- [12]=>
- int(13)
- [13]=>
- int(14)
- [14]=>
- int(15)
- [15]=>
- int(16)
- [16]=>
- int(17)
- [17]=>
- int(18)
- [18]=>
- int(19)
- [19]=>
- int(20)
- [20]=>
- int(21)
- [21]=>
- int(22)
- [22]=>
- int(23)
- [23]=>
- int(24)
- [24]=>
- int(25)
- [25]=>
- int(26)
- [26]=>
- int(27)
- [27]=>
- int(28)
- [28]=>
- int(29)
- [29]=>
- int(30)
- [30]=>
- int(31)
- [31]=>
- int(32)
- [32]=>
- int(33)
- [33]=>
- int(34)
- [34]=>
- int(35)
- [35]=>
- int(36)
- [36]=>
- int(37)
- [37]=>
- int(38)
- [38]=>
- int(39)
- [39]=>
- int(40)
- [40]=>
- int(41)
- [41]=>
- int(42)
- [42]=>
- int(43)
- [43]=>
- int(44)
- [44]=>
- int(45)
- [45]=>
- int(46)
- [46]=>
- int(47)
- [47]=>
- int(48)
- [48]=>
- int(49)
- [49]=>
- int(50)
- [50]=>
- int(51)
- [51]=>
- int(52)
- [52]=>
- int(53)
- [53]=>
- int(54)
- [54]=>
- int(55)
- [55]=>
- int(56)
- [56]=>
- int(57)
- [57]=>
- int(58)
- [58]=>
- int(59)
- [59]=>
- int(60)
- [60]=>
- int(61)
- [61]=>
- int(62)
- [62]=>
- int(63)
- [63]=>
- int(64)
- [64]=>
- int(65)
- [65]=>
- int(66)
- [66]=>
- int(67)
- [67]=>
- int(68)
- [68]=>
- int(69)
- [69]=>
- int(70)
- [70]=>
- int(71)
- [71]=>
- int(72)
- [72]=>
- int(73)
- [73]=>
- int(74)
- [74]=>
- int(75)
- [75]=>
- int(76)
- [76]=>
- int(77)
- [77]=>
- int(78)
- [78]=>
- int(79)
- [79]=>
- int(80)
- [80]=>
- int(81)
- [81]=>
- int(82)
- [82]=>
- int(83)
- [83]=>
- int(84)
- [84]=>
- int(85)
- [85]=>
- int(86)
- [86]=>
- int(87)
- [87]=>
- int(88)
- [88]=>
- int(89)
- [89]=>
- int(90)
- [90]=>
- int(91)
- [91]=>
- int(92)
- [92]=>
- int(93)
- [93]=>
- int(94)
- [94]=>
- int(95)
- [95]=>
- int(96)
- [96]=>
- int(97)
- [97]=>
- int(98)
- [98]=>
- int(99)
- [99]=>
- int(100)
-}
-array(100) {
- [0]=>
- int(100)
- [1]=>
- int(99)
- [2]=>
- int(98)
- [3]=>
- int(97)
- [4]=>
- int(96)
- [5]=>
- int(95)
- [6]=>
- int(94)
- [7]=>
- int(93)
- [8]=>
- int(92)
- [9]=>
- int(91)
- [10]=>
- int(90)
- [11]=>
- int(89)
- [12]=>
- int(88)
- [13]=>
- int(87)
- [14]=>
- int(86)
- [15]=>
- int(85)
- [16]=>
- int(84)
- [17]=>
- int(83)
- [18]=>
- int(82)
- [19]=>
- int(81)
- [20]=>
- int(80)
- [21]=>
- int(79)
- [22]=>
- int(78)
- [23]=>
- int(77)
- [24]=>
- int(76)
- [25]=>
- int(75)
- [26]=>
- int(74)
- [27]=>
- int(73)
- [28]=>
- int(72)
- [29]=>
- int(71)
- [30]=>
- int(70)
- [31]=>
- int(69)
- [32]=>
- int(68)
- [33]=>
- int(67)
- [34]=>
- int(66)
- [35]=>
- int(65)
- [36]=>
- int(64)
- [37]=>
- int(63)
- [38]=>
- int(62)
- [39]=>
- int(61)
- [40]=>
- int(60)
- [41]=>
- int(59)
- [42]=>
- int(58)
- [43]=>
- int(57)
- [44]=>
- int(56)
- [45]=>
- int(55)
- [46]=>
- int(54)
- [47]=>
- int(53)
- [48]=>
- int(52)
- [49]=>
- int(51)
- [50]=>
- int(50)
- [51]=>
- int(49)
- [52]=>
- int(48)
- [53]=>
- int(47)
- [54]=>
- int(46)
- [55]=>
- int(45)
- [56]=>
- int(44)
- [57]=>
- int(43)
- [58]=>
- int(42)
- [59]=>
- int(41)
- [60]=>
- int(40)
- [61]=>
- int(39)
- [62]=>
- int(38)
- [63]=>
- int(37)
- [64]=>
- int(36)
- [65]=>
- int(35)
- [66]=>
- int(34)
- [67]=>
- int(33)
- [68]=>
- int(32)
- [69]=>
- int(31)
- [70]=>
- int(30)
- [71]=>
- int(29)
- [72]=>
- int(28)
- [73]=>
- int(27)
- [74]=>
- int(26)
- [75]=>
- int(25)
- [76]=>
- int(24)
- [77]=>
- int(23)
- [78]=>
- int(22)
- [79]=>
- int(21)
- [80]=>
- int(20)
- [81]=>
- int(19)
- [82]=>
- int(18)
- [83]=>
- int(17)
- [84]=>
- int(16)
- [85]=>
- int(15)
- [86]=>
- int(14)
- [87]=>
- int(13)
- [88]=>
- int(12)
- [89]=>
- int(11)
- [90]=>
- int(10)
- [91]=>
- int(9)
- [92]=>
- int(8)
- [93]=>
- int(7)
- [94]=>
- int(6)
- [95]=>
- int(5)
- [96]=>
- int(4)
- [97]=>
- int(3)
- [98]=>
- int(2)
- [99]=>
- int(1)
-}
-array(26) {
- [0]=>
- string(1) "a"
- [1]=>
- string(1) "b"
- [2]=>
- string(1) "c"
- [3]=>
- string(1) "d"
- [4]=>
- string(1) "e"
- [5]=>
- string(1) "f"
- [6]=>
- string(1) "g"
- [7]=>
- string(1) "h"
- [8]=>
- string(1) "i"
- [9]=>
- string(1) "j"
- [10]=>
- string(1) "k"
- [11]=>
- string(1) "l"
- [12]=>
- string(1) "m"
- [13]=>
- string(1) "n"
- [14]=>
- string(1) "o"
- [15]=>
- string(1) "p"
- [16]=>
- string(1) "q"
- [17]=>
- string(1) "r"
- [18]=>
- string(1) "s"
- [19]=>
- string(1) "t"
- [20]=>
- string(1) "u"
- [21]=>
- string(1) "v"
- [22]=>
- string(1) "w"
- [23]=>
- string(1) "x"
- [24]=>
- string(1) "y"
- [25]=>
- string(1) "z"
-}
-array(26) {
- [0]=>
- string(1) "z"
- [1]=>
- string(1) "y"
- [2]=>
- string(1) "x"
- [3]=>
- string(1) "w"
- [4]=>
- string(1) "v"
- [5]=>
- string(1) "u"
- [6]=>
- string(1) "t"
- [7]=>
- string(1) "s"
- [8]=>
- string(1) "r"
- [9]=>
- string(1) "q"
- [10]=>
- string(1) "p"
- [11]=>
- string(1) "o"
- [12]=>
- string(1) "n"
- [13]=>
- string(1) "m"
- [14]=>
- string(1) "l"
- [15]=>
- string(1) "k"
- [16]=>
- string(1) "j"
- [17]=>
- string(1) "i"
- [18]=>
- string(1) "h"
- [19]=>
- string(1) "g"
- [20]=>
- string(1) "f"
- [21]=>
- string(1) "e"
- [22]=>
- string(1) "d"
- [23]=>
- string(1) "c"
- [24]=>
- string(1) "b"
- [25]=>
- string(1) "a"
-}
-array(1) {
- [0]=>
- string(1) "q"
-}
-array(1) {
- [0]=>
- int(5)
-}
-array(6) {
- [0]=>
- float(5.1)
- [1]=>
- float(6.1)
- [2]=>
- float(7.1)
- [3]=>
- float(8.1)
- [4]=>
- float(9.1)
- [5]=>
- float(10.1)
-}
-array(6) {
- [0]=>
- float(10.1)
- [1]=>
- float(9.1)
- [2]=>
- float(8.1)
- [3]=>
- float(7.1)
- [4]=>
- float(6.1)
- [5]=>
- float(5.1)
-}
-array(6) {
- [0]=>
- float(5.1)
- [1]=>
- float(6.1)
- [2]=>
- float(7.1)
- [3]=>
- float(8.1)
- [4]=>
- float(9.1)
- [5]=>
- float(10.1)
-}
-array(6) {
- [0]=>
- float(10.1)
- [1]=>
- float(9.1)
- [2]=>
- float(8.1)
- [3]=>
- float(7.1)
- [4]=>
- float(6.1)
- [5]=>
- float(5.1)
-}
-array(41) {
- [0]=>
- float(1)
- [1]=>
- float(1.1)
- [2]=>
- float(1.2)
- [3]=>
- float(1.3)
- [4]=>
- float(1.4)
- [5]=>
- float(1.5)
- [6]=>
- float(1.6)
- [7]=>
- float(1.7)
- [8]=>
- float(1.8)
- [9]=>
- float(1.9)
- [10]=>
- float(2)
- [11]=>
- float(2.1)
- [12]=>
- float(2.2)
- [13]=>
- float(2.3)
- [14]=>
- float(2.4)
- [15]=>
- float(2.5)
- [16]=>
- float(2.6)
- [17]=>
- float(2.7)
- [18]=>
- float(2.8)
- [19]=>
- float(2.9)
- [20]=>
- float(3)
- [21]=>
- float(3.1)
- [22]=>
- float(3.2)
- [23]=>
- float(3.3)
- [24]=>
- float(3.4)
- [25]=>
- float(3.5)
- [26]=>
- float(3.6)
- [27]=>
- float(3.7)
- [28]=>
- float(3.8)
- [29]=>
- float(3.9)
- [30]=>
- float(4)
- [31]=>
- float(4.1)
- [32]=>
- float(4.2)
- [33]=>
- float(4.3)
- [34]=>
- float(4.4)
- [35]=>
- float(4.5)
- [36]=>
- float(4.6)
- [37]=>
- float(4.7)
- [38]=>
- float(4.8)
- [39]=>
- float(4.9)
- [40]=>
- float(5)
-}
-array(41) {
- [0]=>
- float(5)
- [1]=>
- float(4.9)
- [2]=>
- float(4.8)
- [3]=>
- float(4.7)
- [4]=>
- float(4.6)
- [5]=>
- float(4.5)
- [6]=>
- float(4.4)
- [7]=>
- float(4.3)
- [8]=>
- float(4.2)
- [9]=>
- float(4.1)
- [10]=>
- float(4)
- [11]=>
- float(3.9)
- [12]=>
- float(3.8)
- [13]=>
- float(3.7)
- [14]=>
- float(3.6)
- [15]=>
- float(3.5)
- [16]=>
- float(3.4)
- [17]=>
- float(3.3)
- [18]=>
- float(3.2)
- [19]=>
- float(3.1)
- [20]=>
- float(3)
- [21]=>
- float(2.9)
- [22]=>
- float(2.8)
- [23]=>
- float(2.7)
- [24]=>
- float(2.6)
- [25]=>
- float(2.5)
- [26]=>
- float(2.4)
- [27]=>
- float(2.3)
- [28]=>
- float(2.2)
- [29]=>
- float(2.1)
- [30]=>
- float(2)
- [31]=>
- float(1.9)
- [32]=>
- float(1.8)
- [33]=>
- float(1.7)
- [34]=>
- float(1.6)
- [35]=>
- float(1.5)
- [36]=>
- float(1.4)
- [37]=>
- float(1.3)
- [38]=>
- float(1.2)
- [39]=>
- float(1.1)
- [40]=>
- float(1)
-}
-array(41) {
- [0]=>
- float(1)
- [1]=>
- float(1.1)
- [2]=>
- float(1.2)
- [3]=>
- float(1.3)
- [4]=>
- float(1.4)
- [5]=>
- float(1.5)
- [6]=>
- float(1.6)
- [7]=>
- float(1.7)
- [8]=>
- float(1.8)
- [9]=>
- float(1.9)
- [10]=>
- float(2)
- [11]=>
- float(2.1)
- [12]=>
- float(2.2)
- [13]=>
- float(2.3)
- [14]=>
- float(2.4)
- [15]=>
- float(2.5)
- [16]=>
- float(2.6)
- [17]=>
- float(2.7)
- [18]=>
- float(2.8)
- [19]=>
- float(2.9)
- [20]=>
- float(3)
- [21]=>
- float(3.1)
- [22]=>
- float(3.2)
- [23]=>
- float(3.3)
- [24]=>
- float(3.4)
- [25]=>
- float(3.5)
- [26]=>
- float(3.6)
- [27]=>
- float(3.7)
- [28]=>
- float(3.8)
- [29]=>
- float(3.9)
- [30]=>
- float(4)
- [31]=>
- float(4.1)
- [32]=>
- float(4.2)
- [33]=>
- float(4.3)
- [34]=>
- float(4.4)
- [35]=>
- float(4.5)
- [36]=>
- float(4.6)
- [37]=>
- float(4.7)
- [38]=>
- float(4.8)
- [39]=>
- float(4.9)
- [40]=>
- float(5)
-}
-array(41) {
- [0]=>
- float(1)
- [1]=>
- float(1.1)
- [2]=>
- float(1.2)
- [3]=>
- float(1.3)
- [4]=>
- float(1.4)
- [5]=>
- float(1.5)
- [6]=>
- float(1.6)
- [7]=>
- float(1.7)
- [8]=>
- float(1.8)
- [9]=>
- float(1.9)
- [10]=>
- float(2)
- [11]=>
- float(2.1)
- [12]=>
- float(2.2)
- [13]=>
- float(2.3)
- [14]=>
- float(2.4)
- [15]=>
- float(2.5)
- [16]=>
- float(2.6)
- [17]=>
- float(2.7)
- [18]=>
- float(2.8)
- [19]=>
- float(2.9)
- [20]=>
- float(3)
- [21]=>
- float(3.1)
- [22]=>
- float(3.2)
- [23]=>
- float(3.3)
- [24]=>
- float(3.4)
- [25]=>
- float(3.5)
- [26]=>
- float(3.6)
- [27]=>
- float(3.7)
- [28]=>
- float(3.8)
- [29]=>
- float(3.9)
- [30]=>
- float(4)
- [31]=>
- float(4.1)
- [32]=>
- float(4.2)
- [33]=>
- float(4.3)
- [34]=>
- float(4.4)
- [35]=>
- float(4.5)
- [36]=>
- float(4.6)
- [37]=>
- float(4.7)
- [38]=>
- float(4.8)
- [39]=>
- float(4.9)
- [40]=>
- float(5)
-}
diff --git a/ext/standard/tests/array/var_export.phpt b/ext/standard/tests/array/var_export.phpt
deleted file mode 100644
index 7b9df14624..0000000000
--- a/ext/standard/tests/array/var_export.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-var_export() and objects with numeric indexes properties
---FILE--
-<?php
-$a = (object) array (1, 3, "foo" => "bar");
-var_export($a);
-?>
---EXPECT--
-class stdClass {
- var $foo = 'bar';
-}
diff --git a/ext/standard/tests/assert/assert.phpt b/ext/standard/tests/assert/assert.phpt
deleted file mode 100644
index 21924902a8..0000000000
--- a/ext/standard/tests/assert/assert.phpt
+++ /dev/null
@@ -1,39 +0,0 @@
---TEST--
-assert()
---POST--
---GET--
---FILE--
-<?php
-function a($file,$line,$myev)
-{
- echo "assertion failed $line,\"$myev\"\n";
-}
-
-class a
-{
- function assert($file,$line,$myev)
- {
- echo "class assertion failed $line,\"$myev\"\n";
- }
-}
-
-assert_options(ASSERT_ACTIVE,1);
-assert_options(ASSERT_QUIET_EVAL,1);
-assert_options(ASSERT_WARNING,0);
-
-$a = 0;
-
-assert_options(ASSERT_CALLBACK,"a");
-assert('$a != 0');
-
-assert_options(ASSERT_CALLBACK,array("a","assert"));
-assert('$a != 0');
-
-$obj = new a();
-assert_options(ASSERT_CALLBACK,array(&$obj,"assert"));
-assert('$a != 0');
-?>
---EXPECT--
-assertion failed 22,"$a != 0"
-class assertion failed 25,"$a != 0"
-class assertion failed 29,"$a != 0"
diff --git a/ext/standard/tests/file/001-win32.phpt b/ext/standard/tests/file/001-win32.phpt
deleted file mode 100644
index d18ee325a6..0000000000
--- a/ext/standard/tests/file/001-win32.phpt
+++ /dev/null
@@ -1,127 +0,0 @@
---TEST--
-File type functions
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip only for Windows');
-}
-?>
---POST--
---GET--
---FILE--
-<?php
-chdir(dirname(__FILE__));
-@unlink('test.file');
-@unlink('test.link');
-if (file_exists('test.file')) {
- echo "test.file exists\n";
-} else {
- echo "test.file does not exist\n";
-}
-fclose (fopen('test.file', 'w'));
-chmod ('test.file', 0744);
-if (file_exists('test.file')) {
- echo "test.file exists\n";
-} else {
- echo "test.file does not exist\n";
-}
-sleep (2);
-if (file_exists('test.link')) {
- echo "test.link exists\n";
-} else {
- echo "test.link does not exist\n";
-}
-if (is_link('test.file')) {
- echo "test.file is a symlink\n";
-} else {
- echo "test.file is not a symlink\n";
-}
-if (is_link('test.link')) {
- echo "test.link is a symlink\n";
-} else {
- echo "test.link is not a symlink\n";
-}
-if (file_exists('test.file')) {
- echo "test.file exists\n";
-} else {
- echo "test.file does not exist\n";
-}
-$s = stat ('test.file');
-$ls = lstat ('test.file');
-for ($i = 0; $i <= 12; $i++) {
- if ($ls[$i] != $s[$i]) {
- echo "test.file lstat and stat differ at element $i\n";
- }
-}
-echo "test.file is " . filetype('test.file') . "\n";
-echo "test.link is " . filetype('test.link') . "\n";
-printf ("test.file permissions are 0%o\n", 0777 & fileperms('test.file'));
-echo "test.file size is " . filesize('test.file') . "\n";
-if (is_writeable('test.file')) {
- echo "test.file is writeable\n";
-} else {
- echo "test.file is not writeable\n";
-}
-if (is_readable('test.file')) {
- echo "test.file is readable\n";
-} else {
- echo "test.file is not readable\n";
-}
-if (is_file('test.file')) {
- echo "test.file is a regular file\n";
-} else {
- echo "test.file is not a regular file\n";
-}
-if (is_file('test.link')) {
- echo "test.link is a regular file\n";
-} else {
- echo "test.link is not a regular file\n";
-}
-if (is_dir('test.link')) {
- echo "test.link is a directory\n";
-} else {
- echo "test.link is not a directory\n";
-}
-if (is_dir('../file')) {
- echo "../file is a directory\n";
-} else {
- echo "../file is not a directory\n";
-}
-if (is_dir('test.file')) {
- echo "test.file is a directory\n";
-} else {
- echo "test.file is not a directory\n";
-}
-unlink('test.file');
-if (file_exists('test.file')) {
- echo "test.file exists (cached)\n";
-} else {
- echo "test.file does not exist\n";
-}
-clearstatcache();
-if (file_exists('test.file')) {
- echo "test.file exists\n";
-} else {
- echo "test.file does not exist\n";
-}
-?>
---EXPECT--
-test.file does not exist
-test.file exists
-test.link does not exist
-test.file is not a symlink
-test.link is not a symlink
-test.file exists
-test.file is file
-test.link is file
-test.file permissions are 0666
-test.file size is 0
-test.file is writeable
-test.file is readable
-test.file is a regular file
-test.link is not a regular file
-test.link is not a directory
-../file is a directory
-test.file is not a directory
-test.file does not exist
-test.file does not exist
diff --git a/ext/standard/tests/file/001.phpt b/ext/standard/tests/file/001.phpt
deleted file mode 100644
index 2191fa23d6..0000000000
--- a/ext/standard/tests/file/001.phpt
+++ /dev/null
@@ -1,148 +0,0 @@
---TEST--
-File type functions
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip no symlinks on Windows');
-}
-?>
---POST--
---GET--
---FILE--
-<?php
-chdir(dirname(__FILE__));
-@unlink('test.file');
-@unlink('test.link');
-if (file_exists('test.file')) {
- echo "test.file exists\n";
-} else {
- echo "test.file does not exist\n";
-}
-fclose (fopen('test.file', 'w'));
-chmod ('test.file', 0744);
-if (file_exists('test.file')) {
- echo "test.file exists\n";
-} else {
- echo "test.file does not exist\n";
-}
-sleep (2);
-symlink('test.file','test.link');
-if (file_exists('test.link')) {
- echo "test.link exists\n";
-} else {
- echo "test.link does not exist\n";
-}
-if (is_link('test.file')) {
- echo "test.file is a symlink\n";
-} else {
- echo "test.file is not a symlink\n";
-}
-if (is_link('test.link')) {
- echo "test.link is a symlink\n";
-} else {
- echo "test.link is not a symlink\n";
-}
-if (file_exists('test.file')) {
- echo "test.file exists\n";
-} else {
- echo "test.file does not exist\n";
-}
-$s = stat ('test.file');
-$ls = lstat ('test.file');
-for ($i = 0; $i <= 12; $i++) {
- if ($ls[$i] != $s[$i]) {
- echo "test.file lstat and stat differ at element $i\n";
- }
-}
-$s = stat ('test.link');
-$ls = lstat ('test.link');
-for ($i = 0; $i <= 11; $i++) {
- if ($ls[$i] != $s[$i]) {
- if ($i != 6 && $i != 11) echo "test.link lstat and stat differ at element $i\n";
- }
-}
-echo "test.file is " . filetype('test.file') . "\n";
-echo "test.link is " . filetype('test.link') . "\n";
-printf ("test.file permissions are 0%o\n", 0777 & fileperms('test.file'));
-echo "test.file size is " . filesize('test.file') . "\n";
-if (is_writeable('test.file')) {
- echo "test.file is writeable\n";
-} else {
- echo "test.file is not writeable\n";
-}
-if (is_readable('test.file')) {
- echo "test.file is readable\n";
-} else {
- echo "test.file is not readable\n";
-}
-if (is_executable('test.file')) {
- echo "test.file is executable\n";
-} else {
- echo "test.file is not executable\n";
-}
-if (is_file('test.file')) {
- echo "test.file is a regular file\n";
-} else {
- echo "test.file is not a regular file\n";
-}
-if (is_file('test.link')) {
- echo "test.link is a regular file\n";
-} else {
- echo "test.link is not a regular file\n";
-}
-if (is_dir('test.link')) {
- echo "test.link is a directory\n";
-} else {
- echo "test.link is not a directory\n";
-}
-if (is_dir('../file')) {
- echo "../file is a directory\n";
-} else {
- echo "../file is not a directory\n";
-}
-if (is_dir('test.file')) {
- echo "test.file is a directory\n";
-} else {
- echo "test.file is not a directory\n";
-}
-unlink('test.file');
-unlink('test.link');
-if (file_exists('test.file')) {
- echo "test.file exists (cached)\n";
-} else {
- echo "test.file does not exist\n";
-}
-clearstatcache();
-if (file_exists('test.file')) {
- echo "test.file exists\n";
-} else {
- echo "test.file does not exist\n";
-}
-?>
---EXPECT--
-test.file does not exist
-test.file exists
-test.link exists
-test.file is not a symlink
-test.link is a symlink
-test.file exists
-test.link lstat and stat differ at element 1
-test.link lstat and stat differ at element 2
-test.link lstat and stat differ at element 7
-test.link lstat and stat differ at element 8
-test.link lstat and stat differ at element 9
-test.link lstat and stat differ at element 10
-test.file is file
-test.link is link
-test.file permissions are 0744
-test.file size is 0
-test.file is writeable
-test.file is readable
-test.file is executable
-test.file is a regular file
-test.link is a regular file
-test.link is not a directory
-../file is a directory
-test.file is not a directory
-test.file does not exist
-test.file does not exist
diff --git a/ext/standard/tests/file/002.phpt b/ext/standard/tests/file/002.phpt
deleted file mode 100644
index 4642bac366..0000000000
--- a/ext/standard/tests/file/002.phpt
+++ /dev/null
@@ -1,54 +0,0 @@
---TEST--
-File/Stream functions
---POST--
---GET--
---FILE--
-<?php
-
-$data = <<<EOD
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-EOD;
-
-$name = tempnam("./ext/standard/tests/file/", "php");
-$fp = fopen($name, "w");
-fwrite($fp, $data);
-fclose($fp);
-
-//readfile($name);
-echo file_get_contents($name);
-
-unlink($name);
-
-?>
---EXPECT--
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
-blah blah blah blah blah blah blah
diff --git a/ext/standard/tests/file/003.phpt b/ext/standard/tests/file/003.phpt
deleted file mode 100644
index 2b75bdccee..0000000000
--- a/ext/standard/tests/file/003.phpt
+++ /dev/null
@@ -1,43 +0,0 @@
---TEST--
-is_*() and file_exists() return values are boolean.
---POST--
---GET--
---FILE--
-<?php
-
-$funcs = array(
- 'is_writable',
- 'is_readable',
- 'is_executable',
- 'is_file',
- 'file_exists',
-);
-
-$filename="";
-
-foreach ($funcs as $test) {
- $bb = $test($filename);
- echo gettype($bb)."\n";
- clearstatcache();
-}
-
-$filename="run-tests.php";
-
-foreach ($funcs as $test) {
- $bb = $test($filename);
- echo gettype($bb)."\n";
- clearstatcache();
-}
-
-?>
---EXPECT--
-boolean
-boolean
-boolean
-boolean
-boolean
-boolean
-boolean
-boolean
-boolean
-boolean
diff --git a/ext/standard/tests/file/bug12556.phpt b/ext/standard/tests/file/bug12556.phpt
deleted file mode 100644
index 6d8763245f..0000000000
--- a/ext/standard/tests/file/bug12556.phpt
+++ /dev/null
@@ -1,50 +0,0 @@
---TEST--
-Bug #12556: fgetcvs ignores lengths when quotes not closed
---POST--
---GET--
---FILE--
-<?php
-$fp = fopen(dirname(__FILE__)."/test.csv", "r");
-while($line = fgetcsv($fp, 24)) {
- $line = str_replace("\x0d\x0a", "\x0a", $line);
- var_dump($line);
-}
-fclose($fp);
-?>
---EXPECT--
-array(4) {
- [0]=>
- string(1) "6"
- [1]=>
- string(1) "7"
- [2]=>
- string(1) "8"
- [3]=>
- string(5) "line1"
-}
-array(4) {
- [0]=>
- string(1) "1"
- [1]=>
- string(1) "2"
- [2]=>
- string(1) "3"
- [3]=>
- string(186) "line2
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-"
-}
diff --git a/ext/standard/tests/file/bug20424.phpt b/ext/standard/tests/file/bug20424.phpt
deleted file mode 100644
index 0352d46f8e..0000000000
--- a/ext/standard/tests/file/bug20424.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Bug #20424: stream_get_meta_data craches on a normal file stream
---POST--
---GET--
---FILE--
-<?php
-$f = fopen("run-tests.php", "r");
-$dummy = var_export(stream_get_meta_data($f), TRUE);
-echo "I'm alive!\n";
-?>
---EXPECT--
-I'm alive!
diff --git a/ext/standard/tests/file/bug22382.phpt b/ext/standard/tests/file/bug22382.phpt
deleted file mode 100644
index 5255eaf350..0000000000
--- a/ext/standard/tests/file/bug22382.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Bug #22382: fgetcvs does not handle escaped quotes correctly
---POST--
---GET--
---FILE--
-<?php
-$fp = fopen(dirname(__FILE__)."/test2.csv", "r");
-while(($line = fgetcsv($fp, 1024))) {
- var_dump($line);
-}
-fclose($fp);
-?>
---EXPECT--
-array(6) {
- [0]=>
- string(3) "One"
- [1]=>
- string(7) "\"Two\""
- [2]=>
- string(7) "Three\""
- [3]=>
- string(4) "Four"
- [4]=>
- string(2) "\\"
- [5]=>
- string(28) "\\\\\\\\\\\\\\\\\\\\\\\"\\\\"
-} \ No newline at end of file
diff --git a/ext/standard/tests/file/bug22414.phpt b/ext/standard/tests/file/bug22414.phpt
deleted file mode 100644
index a1462958d6..0000000000
--- a/ext/standard/tests/file/bug22414.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-Bug #22414: passthru() does not read data correctly
---SKIPIF--
-<?php
- if (ini_get("safe_mode")) {
- die('skip this test cannot be run under safe-mode');
- }
-?>
---POST--
---GET--
---FILE--
-<?php
- $php = getenv('TEST_PHP_EXECUTABLE');
- $pwd = realpath(dirname(__FILE__));
-
- /* Regular Data Test */
- passthru($php . ' -r " echo \"HELLO\"; "');
-
- echo "\n";
-
- /* Binary Data Test */
- @unlink($pwd . '/passthru_test');
-
- $cmd = $php . " -r \\\" readfile(@getenv(TEST_PHP_EXECUTABLE)); \\\"";
- $cmd = $php . ' -r \' passthru("'.$cmd.'"); \' > ' . $pwd . '/passthru_test';
- exec($cmd);
-
- if (md5_file($php) == md5_file($pwd . '/passthru_test')) {
- echo "Works\n";
- } else {
- echo "Does not work\n";
- }
-
- @unlink($pwd . '/passthru_test');
-?>
---EXPECT--
-HELLO
-Works
diff --git a/ext/standard/tests/file/fopencookie.phpt b/ext/standard/tests/file/fopencookie.phpt
deleted file mode 100644
index 4043f85f89..0000000000
--- a/ext/standard/tests/file/fopencookie.phpt
+++ /dev/null
@@ -1,86 +0,0 @@
---TEST--
-fopencookie detected and working (or cast mechanism works)
---FILE--
-<?php
-# vim600:syn=php:
-
-/* This test verifies that the casting mechanism is working correctly.
- * On systems with fopencookie, a FILE* is created around the user
- * stream and that is passed back to the ZE to include.
- * On systems without fopencookie, the stream is fed into a temporary
- * file, and that temporary file is passed back to the ZE.
- * The important thing here is really fopencookie; the glibc people
- * changed the binary interface, so if haven't detected it correctly,
- * you can expect this test to segfault.
- *
- * FIXME: the test really needs something to fseek(3) on the FILE*
- * used internally for this test to be really effective.
- */
-
-class userstream {
- var $position = 0;
- var $data = "If you can read this, it worked";
-
- function stream_open($path, $mode, $options, &$opened_path)
- {
- return true;
- }
-
- function stream_read($count)
- {
- $ret = substr($this->data, $this->position, $count);
- $this->position += strlen($ret);
- return $ret;
- }
-
- function stream_tell()
- {
- return $this->position;
- }
-
- function stream_eof()
- {
- return $this->position >= strlen($this->data);
- }
-
- function stream_seek($offset, $whence)
- {
- switch($whence) {
- case SEEK_SET:
- if ($offset < strlen($this->data) && $offset >= 0) {
- $this->position = $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_CUR:
- if ($offset >= 0) {
- $this->position += $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_END:
- if (strlen($this->data) + $offset >= 0) {
- $this->position = strlen($this->data) + $offset;
- return true;
- } else {
- return false;
- }
- break;
- default:
- return false;
- }
- }
-
-}
-
-stream_register_wrapper("cookietest", "userstream");
-
-include("cookietest://foo");
-
-?>
---EXPECT--
-If you can read this, it worked
diff --git a/ext/standard/tests/file/test.csv b/ext/standard/tests/file/test.csv
deleted file mode 100644
index d99984c2ab..0000000000
--- a/ext/standard/tests/file/test.csv
+++ /dev/null
@@ -1,17 +0,0 @@
-6,7,8,line1
-1,2,3,"line2
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
-2,4,5,line3
diff --git a/ext/standard/tests/file/test2.csv b/ext/standard/tests/file/test2.csv
deleted file mode 100644
index d816464170..0000000000
--- a/ext/standard/tests/file/test2.csv
+++ /dev/null
@@ -1 +0,0 @@
-"One","\"Two\"","Three\"","Four","\\","\\\\\\\\\\\\\\\\\\\\\\\"\\\\"
diff --git a/ext/standard/tests/file/userfilters.phpt b/ext/standard/tests/file/userfilters.phpt
deleted file mode 100644
index 72930ee65a..0000000000
--- a/ext/standard/tests/file/userfilters.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-stream userfilter test
---FILE--
-<?php
-# vim600:syn=php:
-class testfilter extends php_user_filter {
- function filter($in, $out, &$consumed, $closing) {
- while ($bucket = stream_bucket_make_writeable($in)) {
- $bucket->data = strtoupper($bucket->data);
- $consumed += strlen($bucket->data);
- stream_bucket_append($out, $bucket);
- }
- return PSFS_PASS_ON;
- }
-
- function oncreate() {
- echo "params: {$this->params}\n";
- }
-}
-
-stream_register_filter('testfilter','testfilter');
-
-$text = "Hello There!";
-
-$fp = tmpfile();
-fwrite($fp, $text);
-
-rewind($fp);
-stream_filter_append($fp, 'testfilter', STREAM_FILTER_READ, 'testuserfilter');
-
-var_dump(fgets($fp));
-fclose($fp);
-
-?>
---EXPECT--
-params: testuserfilter
-string(12) "HELLO THERE!"
diff --git a/ext/standard/tests/file/userstreams.phpt b/ext/standard/tests/file/userstreams.phpt
deleted file mode 100644
index efc2880f9a..0000000000
--- a/ext/standard/tests/file/userstreams.phpt
+++ /dev/null
@@ -1,325 +0,0 @@
---TEST--
-User-space streams
---FILE--
-<?php
-# vim600:syn=php:
-
-/* This is a fairly aggressive test that looks at
- * user streams and also gives the seek/gets/buffer
- * layer of streams a thorough testing */
-
-$lyrics = <<<EOD
-...and the road becomes my bride
-I have stripped of all but pride
-so in her I do confide
-and she keeps me satisfied
-gives me all I need
-...and with dust in throat I crave
-to the game you stay a slave
-rover wanderer
-nomad vagabond
-call me what you will
- But Ill take my time anywhere
- Free to speak my mind anywhere
- and Ill redefine anywhere
- Anywhere I roam
- Where I lay my head is home
-...and the earth becomes my throne
-I adapt to the unknown
-under wandering stars Ive grown
-by myself but not alone
-I ask no one
-...and my ties are severed clean
-the less I have the more I gain
-off the beaten path I reign
-rover wanderer
-nomad vagabond
-call me what you will
- But Ill take my time anywhere
- Free to speak my mind anywhere
- and Ill never mind anywhere
- Anywhere I roam
- Where I lay my head is home
- But Ill take my time anywhere
- Free to speak my mind anywhere
- and Ill take my find anywhere
- Anywhere I roam
- Where I lay my head is home
- carved upon my stone
- my body lie but still I roam
- Wherever I may roam.
-
-Wherever I May Roam
-
-EOD;
-
-/* repeat the data a few times so that it grows larger than
- * the default cache chunk size and that we have something
- * to seek around... */
-$DATA = "";
-for ($i = 0; $i < 30; $i++) {
- if ($i % 2 == 0)
- $DATA .= str_rot13($lyrics);
- else
- $DATA .= $lyrics;
-}
-
-/* store the data in a regular file so that we can compare
- * the results */
-$tf = tmpfile();
-fwrite($tf, $DATA);
-$n = ftell($tf);
-rewind($tf) or die("failed to rewind tmp file!");
-if (ftell($tf) != 0)
- die("tmpfile is not at start!");
-$DATALEN = strlen($DATA);
-if ($n != $DATALEN)
- die("tmpfile stored $n bytes; should be $DATALEN!");
-
-class uselessstream
-{
-}
-
-class mystream
-{
- var $path;
- var $mode;
- var $options;
-
- var $position;
- var $varname;
-
- function stream_open($path, $mode, $options, &$opened_path)
- {
- $this->path = $path;
- $this->mode = $mode;
- $this->options = $options;
-
- $split = parse_url($path);
- $this->varname = $split["host"];
-
- if (strchr($mode, 'a'))
- $this->position = strlen($GLOBALS[$this->varname]);
- else
- $this->position = 0;
-
- return true;
- }
-
- function stream_read($count)
- {
- $ret = substr($GLOBALS[$this->varname], $this->position, $count);
- $this->position += strlen($ret);
- return $ret;
- }
-
- function stream_tell()
- {
- return $this->position;
- }
-
- function stream_eof()
- {
- return $this->position >= strlen($GLOBALS[$this->varname]);
- }
-
- function stream_seek($offset, $whence)
- {
- switch($whence) {
- case SEEK_SET:
- if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
- $this->position = $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_CUR:
- if ($offset >= 0) {
- $this->position += $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_END:
- if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
- $this->position = strlen($GLOBALS[$this->varname]) + $offset;
- return true;
- } else {
- return false;
- }
- break;
- default:
- return false;
- }
- }
-
-}
-
-if (@stream_register_wrapper("bogus", "class_not_exist")) {
- die("Registered a non-existant class!!!???");
-}
-echo "Not Registered\n";
-
-if (!stream_register_wrapper("test", "mystream")) {
- die("test wrapper registration failed");
-}
-echo "Registered\n";
-
-if (!stream_register_wrapper("bogon", "uselessstream")) {
- die("bogon wrapper registration failed");
-}
-echo "Registered\n";
-
-$b = @fopen("bogon://url", "rb");
-if (is_resource($b)) {
- die("Opened a bogon??");
-}
-
-$fp = fopen("test://DATA", "rb");
-if (!$fp || !is_resource($fp)) {
- die("Failed to open resource");
-}
-
-/* some default seeks that will cause buffer/cache misses */
-$seeks = array(
- array(SEEK_SET, 0, 0),
- array(SEEK_CUR, 8450, 8450),
- array(SEEK_CUR, -7904, 546),
- array(SEEK_CUR, 12456, 13002),
-
- /* end up at BOF so that randomly generated seek offsets
- * below will know where they are supposed to be */
- array(SEEK_SET, 0, 0)
-);
-
-$whence_map = array(
- SEEK_CUR,
- SEEK_SET,
- SEEK_END
-);
-$whence_names = array(
- SEEK_CUR => "SEEK_CUR",
- SEEK_SET => "SEEK_SET",
- SEEK_END => "SEEK_END"
- );
-
-/* generate some random seek offsets */
-$position = 0;
-for ($i = 0; $i < 256; $i++) {
- $whence = $whence_map[array_rand($whence_map, 1)];
- switch($whence) {
- case SEEK_SET:
- $offset = rand(0, $DATALEN);
- $position = $offset;
- break;
- case SEEK_END:
- $offset = -rand(0, $DATALEN);
- $position = $DATALEN + $offset;
- break;
- case SEEK_CUR:
- $offset = rand(0, $DATALEN);
- $offset -= $position;
- $position += $offset;
- break;
- }
-
- $seeks[] = array($whence, $offset, $position);
-}
-
-/* we compare the results of fgets using differing line lengths to
- * test the fgets layer also */
-$line_lengths = array(1024, 256, 64, 16);
-$fail_count = 0;
-
-ob_start();
-foreach($line_lengths as $line_length) {
- /* now compare the real stream with the user stream */
- $j = 0;
- rewind($tf);
- rewind($fp);
- foreach($seeks as $seekdata) {
- list($whence, $offset, $position) = $seekdata;
-
- $rpb = ftell($tf);
- $rr = (int)fseek($tf, $offset, $whence);
- $rpa = ftell($tf);
- $rline = fgets($tf, $line_length);
- (int)fseek($tf, - strlen($rline), SEEK_CUR);
-
- $upb = ftell($fp);
- $ur = (int)fseek($fp, $offset, $whence);
- $upa = ftell($fp);
- $uline = fgets($fp, $line_length);
- (int)fseek($fp, - strlen($uline), SEEK_CUR);
-
- printf("\n--[%d] whence=%s offset=%d line_length=%d position_should_be=%d --\n",
- $j, $whence_names[$whence], $offset, $line_length, $position);
- printf("REAL: pos=(%d,%d,%d) ret=%d line[%d]=`%s'\n", $rpb, $rpa, ftell($tf), $rr, strlen($rline), $rline);
- printf("USER: pos=(%d,%d,%d) ret=%d line[%d]=`%s'\n", $upb, $upa, ftell($fp), $ur, strlen($uline), $uline);
-
- if ($rr != $ur || $rline != $uline || $rpa != $position || $upa != $position) {
- $fail_count++;
- echo "###################################### FAIL!\n";
- $dat = stream_get_meta_data($fp);
- var_dump($dat);
- break;
- }
-
- $j++;
- }
- if ($fail_count)
- break;
-}
-
-if ($fail_count == 0) {
- ob_end_clean();
- echo "SEEK: OK\n";
-} else {
- echo "SEEK: FAIL\n";
- ob_end_flush();
-}
-
-$fail_count = 0;
-
-fseek($fp, $DATALEN / 2, SEEK_SET);
-fseek($tf, $DATALEN / 2, SEEK_SET);
-
-if (ftell($fp) != ftell($tf)) {
- echo "SEEK: positions do not match!\n";
-}
-
-$n = 0;
-while(!feof($fp)) {
- $uline = fgets($fp, 1024);
- $rline = fgets($tf, 1024);
-
- if ($uline != $rline) {
- echo "FGETS: FAIL\niter=$n user=$uline [pos=" . ftell($fp) . "]\nreal=$rline [pos=" . ftell($tf) . "]\n";
- $fail_count++;
- break;
- }
-}
-
-if ($fail_count == 0) {
- echo "FGETS: OK\n";
-}
-
-/* One final test to see if the position is respected when opened for append */
-$fp = fopen("test://lyrics", "a+");
-rewind($fp);
-var_dump(ftell($fp));
-$data = fgets($fp);
-fclose($fp);
-echo $data . "\n";
-
-?>
---EXPECT--
-Not Registered
-Registered
-Registered
-SEEK: OK
-FGETS: OK
-int(0)
-...and the road becomes my bride
diff --git a/ext/standard/tests/filters/basic.phpt b/ext/standard/tests/filters/basic.phpt
deleted file mode 100644
index 702c1ddadd..0000000000
--- a/ext/standard/tests/filters/basic.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-basic stream filter tests
---FILE--
-<?php
-# vim600:syn=php:
-
-$text = "Hello There!";
-$filters = array("string.rot13", "string.toupper", "string.tolower");
-
-function filter_test($names)
-{
- $fp = tmpfile();
- fwrite($fp, $GLOBALS["text"]);
- rewind($fp);
- foreach ($names as $name) {
- echo "filter: $name\n";
- var_dump(stream_filter_prepend($fp, $name));
- }
- var_dump(fgets($fp));
- fclose($fp);
-}
-
-foreach ($filters as $filter) {
- filter_test(array($filter));
-}
-
-filter_test(array($filters[0], $filters[1]));
-
-?>
---EXPECT--
-filter: string.rot13
-bool(true)
-string(12) "Uryyb Gurer!"
-filter: string.toupper
-bool(true)
-string(12) "HELLO THERE!"
-filter: string.tolower
-bool(true)
-string(12) "hello there!"
-filter: string.rot13
-bool(true)
-filter: string.toupper
-bool(true)
-string(12) "URYYB GURER!"
diff --git a/ext/standard/tests/filters/bug22538.phpt b/ext/standard/tests/filters/bug22538.phpt
deleted file mode 100644
index c01978730b..0000000000
--- a/ext/standard/tests/filters/bug22538.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-Bug #22538 (filtered stream doesn't update file pointer)
---FILE--
-<?php
-function my_stream_copy_to_stream($fin, $fout) {
- while (!feof($fin)) {
- fwrite($fout, fread($fin, 4096));
- }
-}
-
-$size = 65536;
-
-do {
- $path1 = sprintf("%s/%s%da", dirname(__FILE__), uniqid(), time());
- $path2 = sprintf("%s/%s%db", dirname(__FILE__), uniqid(), time());
-} while ($path1 == $path2);
-
-$fp = fopen($path1, "w");
-$str = "abcdefghijklmnopqrstuvwxyz\n";
-$str_len = strlen($str);
-$cnt = $size;
-while (($cnt -= $str_len) > 0) {
- fwrite($fp, $str);
-}
-$cnt = $size - ($str_len + $cnt);
-fclose($fp);
-$fin = fopen($path1, "r");
-$fout = fopen($path2, "w");
-stream_filter_append($fout, "string.rot13");
-my_stream_copy_to_stream($fin, $fout);
-fclose($fout);
-fclose($fin);
-var_dump($cnt);
-var_dump(filesize($path2));
-var_dump(md5_file($path1));
-var_dump(md5_file($path2));
-unlink($path1);
-unlink($path2);
-?>
---EXPECT--
-int(65529)
-int(65529)
-string(32) "e10e3d1ae81b084b822e8592d019b57a"
-string(32) "931f0fbf8a72312e3bab9965b1d1081c"
diff --git a/ext/standard/tests/general_functions/001.phpt b/ext/standard/tests/general_functions/001.phpt
deleted file mode 100644
index e84622902c..0000000000
--- a/ext/standard/tests/general_functions/001.phpt
+++ /dev/null
@@ -1,69 +0,0 @@
---TEST--
-sprintf() function
---POST--
---GET--
---FILE--
-<?php
-
-$agent = sprintf("%.5s", "James Bond, 007");
-
-echo("sprintf string truncate test: ");
-if ($agent == "James") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo("sprintf padding and align test: ");
-$test = sprintf("abc%04d %-20s%c", 20, "fisketur", 33);
-if ($test == "abc0020 fisketur !") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo("sprintf octal and hex test: ");
-$test = sprintf("%4o %4x %4X %0"."8x", 128, 1024, 49151, 3457925);
-if ($test == " 200 400 BFFF 0034c385") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo("sprintf octal binary test: ");
-$test = sprintf("%b", 3457925);
-if ($test == "1101001100001110000101") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo("sprintf float test: ");
-$test = sprintf("%0"."06.2f", 10000/3.0);
-if ($test == "003333.33") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo sprintf("%.2f\n", "99.00");
-echo sprintf("%.2f\n", 99.00);
-
-echo sprintf("%e\n", 1.234E-18);
-echo sprintf("%e\n", 1.234E+18);
-echo sprintf("%e\n", 9843243.12);
-echo sprintf("%e\n", -9843243.12);
-
-?>
---EXPECT--
-sprintf string truncate test: passed
-sprintf padding and align test: passed
-sprintf octal and hex test: passed
-sprintf octal binary test: passed
-sprintf float test: passed
-99.00
-99.00
-1.23400e-18
-1.23400e+18
-9.84324e+6
--9.84324e+6
diff --git a/ext/standard/tests/general_functions/002.phpt b/ext/standard/tests/general_functions/002.phpt
deleted file mode 100644
index 8ab1a72f07..0000000000
--- a/ext/standard/tests/general_functions/002.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-quoted_printable_decode() function test
---POST--
---GET--
---FILE--
-<?php echo quoted_printable_decode("=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A=
-=20=D4=cf=D2=C7=CF=D7=D9=C5=
-=20=
-=D0=
-=D2=CF=C5=CB=D4=D9"); ?>
---EXPECT--
-úwow-factorÁÐÕÝÅÎÎÙÅ
- ÔÏÒÇÏ×ÙÅ ÐÒÏÅËÔÙ
diff --git a/ext/standard/tests/general_functions/003.phpt b/ext/standard/tests/general_functions/003.phpt
deleted file mode 100644
index 141b4d7052..0000000000
--- a/ext/standard/tests/general_functions/003.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-levenshtein() function test
---POST--
---GET--
---FILE--
-<?php
-
-function test_me($title,$expect,$text1,$text2,$cost1=0,$cost2=0,$cost3=0) {
-
- if($cost1==0)
- $result=levenshtein($text1,$text2);
- else
- $result=levenshtein($text1,$text2,$cost1,$cost2,$cost3);
-
- if($result==$expect) return 0;
-
- echo "$title: result is $result instead of $expect ";
- echo "for '$text1'/'$text2' ";
- if($cost1) echo "($cost1:$cost2:$cost3)";
- echo "\n";
-
- return 1;
-}
-
-$n=0;
-
-$n += test_me("equal" , 0, "12345", "12345");
-$n += test_me("1st empty" , 3, "", "xzy");
-$n += test_me("2nd empty" , 3, "xzy", "");
-$n += test_me("both empty" , 0, "", "");
-$n += test_me("1 char" , 1, "1", "2");
-$n += test_me("2 char swap", 2, "12", "21");
-
-$n += test_me("inexpensive delete", 2, "2121", "11", 2, 1, 1);
-$n += test_me("expensive delete" , 10, "2121", "11", 2, 1, 5);
-$n += test_me("inexpensive insert", 2, "11", "2121", 1, 1, 1);
-$n += test_me("expensive insert" , 10, "11", "2121", 5, 1, 1);
-
-$n += test_me("expensive replace" , 3, "111", "121", 2, 3, 2);
-$n += test_me("very expensive replace", 4, "111", "121", 2, 9, 2);
-
-$n += test_me("bug #7368", 2, "13458", "12345");
-$n += test_me("bug #7368", 2, "1345", "1234");
-
-$n += test_me("bug #6562", 1, "debugg", "debug");
-$n += test_me("bug #6562", 1, "ddebug", "debug");
-$n += test_me("bug #6562", 2, "debbbug", "debug");
-$n += test_me("bug #6562", 1, "debugging", "debuging");
-
-$n += test_me("bug #16473", 2, "a", "bc");
-$n += test_me("bug #16473", 2, "xa", "xbc");
-$n += test_me("bug #16473", 2, "xax", "xbcx");
-$n += test_me("bug #16473", 2, "ax", "bcx");
-
-
-echo ($n==0)?"all passed\n":"$n failed\n";
-
-?>
---EXPECT--
-all passed
diff --git a/ext/standard/tests/general_functions/004.data b/ext/standard/tests/general_functions/004.data
deleted file mode 100644
index 5dd0832842..0000000000
--- a/ext/standard/tests/general_functions/004.data
+++ /dev/null
@@ -1,4 +0,0 @@
-name value comment
-true 1 boolean true
-false 0 boolean false
-empty nothing
diff --git a/ext/standard/tests/general_functions/004.phpt b/ext/standard/tests/general_functions/004.phpt
deleted file mode 100644
index 3bd1fb1eac..0000000000
--- a/ext/standard/tests/general_functions/004.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-fgetcsv() with tab delimited fields (BUG #8258)
---POST--
---GET--
---FILE--
-<?php
-chdir(dirname(__FILE__));
-$fp=fopen("004.data","r");
-while($a=fgetcsv($fp,100,"\t")) {
- echo join(",",$a)."\n";
-}
-fclose($fp);
-?>
---EXPECT--
-name,value,comment
-true,1,boolean true
-false,0,boolean false
-empty,,nothing
diff --git a/ext/standard/tests/general_functions/005.phpt b/ext/standard/tests/general_functions/005.phpt
deleted file mode 100644
index 329d46e764..0000000000
--- a/ext/standard/tests/general_functions/005.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-is_scalar() function test
---POST--
---GET--
---FILE--
-<?php
-class foo {}
-var_dump (is_scalar (TRUE));
-var_dump (is_scalar (1));
-var_dump (is_scalar (1.0));
-var_dump (is_scalar ("Hi!"));
-var_dump (is_scalar (NULL));
-var_dump (is_scalar (array ()));
-var_dump (is_scalar (new foo()));
-var_dump (is_scalar (opendir('.')));
-?>
---EXPECT--
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-
diff --git a/ext/standard/tests/general_functions/006.phpt b/ext/standard/tests/general_functions/006.phpt
deleted file mode 100644
index 9db1ca3280..0000000000
--- a/ext/standard/tests/general_functions/006.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-quoted_printable_decode() function test with CR/LF
---POST--
---GET--
---FILE--
-<?php echo quoted_printable_decode("=FAwow-factor=C1=D0=D5=DD=C5=CE=CE=D9=C5=0A=
-=20=D4=CF=D2=C7=CF=D7=D9=C5=
-=20=
-=D0=
-=D2=CF=C5=CB=D4=D9"); ?>
---EXPECT--
-úwow-factorÁÐÕÝÅÎÎÙÅ
- ÔÏÒÇÏ×ÙÅ ÐÒÏÅËÔÙ
diff --git a/ext/standard/tests/general_functions/007.phpt b/ext/standard/tests/general_functions/007.phpt
deleted file mode 100644
index 422ff3d94f..0000000000
--- a/ext/standard/tests/general_functions/007.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-MD5 / Base64
---POST--
---GET--
---FILE--
-<?php
-function test($str) {
- $res = md5(base64_decode(base64_encode($str)))."\n";
- return $res;
-}
-echo test("");
-echo test("a");
-echo test("abc");
-echo test("message digest");
-echo test("abcdefghijklmnopqrstuvwxyz");
-echo test("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
-echo test("12345678901234567890123456789012345678901234567890123456789012345678901234567890");
-?>
---EXPECT--
-d41d8cd98f00b204e9800998ecf8427e
-0cc175b9c0f1b6a831c399e269772661
-900150983cd24fb0d6963f7d28e17f72
-f96b697d7cb7938d525a2f31aaf161d0
-c3fcd3d76192e4007dfb496cca67e13b
-d174ab98d277d9f5a5611c2c9f419d9f
-57edf4a22be3c955ac49da2e2107b67a
diff --git a/ext/standard/tests/general_functions/008.phpt b/ext/standard/tests/general_functions/008.phpt
deleted file mode 100644
index bb633c334d..0000000000
--- a/ext/standard/tests/general_functions/008.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-var_dump float test
---INI--
-precision=12
---FILE--
-<?php
-// this checks f,g,G conversion for snprintf/spprintf
-var_dump(array(ini_get('precision'),.012,-.012,.12,-.12,1.2,-1.2,12.,-12.,0.000123,.0000123,123456789012.0,1234567890123.0,12345678901234567890.0));
-?>
---EXPECT--
-array(14) {
- [0]=>
- string(2) "12"
- [1]=>
- float(0.012)
- [2]=>
- float(-0.012)
- [3]=>
- float(0.12)
- [4]=>
- float(-0.12)
- [5]=>
- float(1.2)
- [6]=>
- float(-1.2)
- [7]=>
- float(12)
- [8]=>
- float(-12)
- [9]=>
- float(0.000123)
- [10]=>
- float(1.23E-5)
- [11]=>
- float(123456789012)
- [12]=>
- float(1234567890120)
- [13]=>
- float(1.23456789012E+19)
-} \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/009.phpt b/ext/standard/tests/general_functions/009.phpt
deleted file mode 100644
index 68c1f4d87b..0000000000
--- a/ext/standard/tests/general_functions/009.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-SHA1
---POST--
---GET--
---FILE--
-<?php
-function test($str) {
- $res = sha1($str)."\n";
- return $res;
-}
-echo test("");
-echo test("a");
-echo test("abc");
-echo test("message digest");
-echo test("abcdefghijklmnopqrstuvwxyz");
-echo test("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
-echo test("12345678901234567890123456789012345678901234567890123456789012345678901234567890");
-?>
---EXPECT--
-da39a3ee5e6b4b0d3255bfef95601890afd80709
-86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
-a9993e364706816aba3e25717850c26c9cd0d89d
-c12252ceda8be8994d5fa0290a47231c1d16aae3
-32d10c7b8cf96570ca04ce37f2a19d84240d3a89
-761c457bf73b14d27e9e9265c46f4b4dda11f940
-50abf5706a150990a08b2c5ea40fa0e585554732
diff --git a/ext/standard/tests/general_functions/getopt.phpt b/ext/standard/tests/general_functions/getopt.phpt
deleted file mode 100644
index 13a4fa558f..0000000000
--- a/ext/standard/tests/general_functions/getopt.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-getopt
---ARGS--
--v -h -d test -m 1234 -t -j
---SKIPIF--
-<?php
- if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip getopt() is currently not available on Windows');
- }
- if (!ini_get('register_argc_argv')) {
- die("skip this test needs register_argc_argv to be enabled");
- }
-?>
---FILE--
-<?php
- var_dump(getopt("d:m:j:vht"));
-?>
---EXPECT--
-array(5) {
- ["v"]=>
- bool(false)
- ["h"]=>
- bool(false)
- ["d"]=>
- string(4) "test"
- ["m"]=>
- string(4) "1234"
- ["t"]=>
- bool(false)
-}
diff --git a/ext/standard/tests/general_functions/proc_open.phpt b/ext/standard/tests/general_functions/proc_open.phpt
deleted file mode 100644
index 0cd08bd6b2..0000000000
--- a/ext/standard/tests/general_functions/proc_open.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-proc_open
---SKIPIF--
-<?php # vim:syn=php
-if (!is_executable("/bin/cat")) echo "skip";
-if (!function_exists("proc_open")) echo "skip proc_open() is not available";
-?>
---POST--
---GET--
---FILE--
-<?php
-$ds = array(
- 0 => array("pipe", "r"),
- 1 => array("pipe", "w"),
- 2 => array("pipe", "w")
- );
-
-$cat = proc_open(
- "/bin/cat",
- $ds,
- $pipes
- );
-
-proc_close($cat);
-
-echo "I didn't segfault!\n";
-
-?>
---EXPECT--
-I didn't segfault!
diff --git a/ext/standard/tests/general_functions/sunfuncts.phpt b/ext/standard/tests/general_functions/sunfuncts.phpt
deleted file mode 100644
index 9f3af6e7f9..0000000000
--- a/ext/standard/tests/general_functions/sunfuncts.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-date_sunrise() and date_sunset() functions
---INI--
-precision = 14
---FILE--
-<?
-
-putenv ("TZ=Asia/Jerusalem");
-
-for($a=1;$a<=12;$a++){
- echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." ";
- echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." ";
- echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n";
-
- echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." ";
- echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." ";
- echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n";
-}
-?>
---EXPECT--
-1041293199 06:39 6.6524557618962
-1041293806 16:46 16.769374867459
-1043971592 06:32 6.5453702926602
-1043972233 17:13 17.217524708736
-1046390766 06:06 6.1156526756851
-1046391456 17:36 17.6108549623
-1049069128 05:28 5.4727420290691
-1049069878 17:58 17.972552584375
-1051661094 04:54 4.9012299828593
-1051661898 18:18 18.313688769483
-1054339474 04:34 4.5744292894498
-1054340319 18:39 18.656400943241
-1056931476 04:36 4.6161204505189
-1056932328 18:48 18.808871657766
-1059609894 04:54 4.9068825098365
-1059610715 18:35 18.599286002028
-1062288314 05:14 5.2368895570738
-1062289083 18:03 18.060541787879
-1064880332 05:32 5.542366581139
-1064881044 17:24 17.411505614917
-1067558754 05:54 5.9162088420581
-1067559410 16:50 16.833698570628
-1070150780 06:20 6.3462215520697
-1070151395 16:35 16.583589055537
diff --git a/ext/standard/tests/image/246x247.png b/ext/standard/tests/image/246x247.png
deleted file mode 100644
index 648a64e0aa..0000000000
--- a/ext/standard/tests/image/246x247.png
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/image/384x385.png b/ext/standard/tests/image/384x385.png
deleted file mode 100644
index 843ddfaf08..0000000000
--- a/ext/standard/tests/image/384x385.png
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/image/bug13213.jpg b/ext/standard/tests/image/bug13213.jpg
deleted file mode 100644
index b90c7a4059..0000000000
--- a/ext/standard/tests/image/bug13213.jpg
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/image/bug13213.phpt b/ext/standard/tests/image/bug13213.phpt
deleted file mode 100644
index c97b7016b4..0000000000
--- a/ext/standard/tests/image/bug13213.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Bug #13213 (GetImageSize and wrong JPEG Comments)
---FILE--
-<?php
-var_dump(GetImageSize(dirname(__FILE__).'/bug13213.jpg'));
-?>
---EXPECT--
-array(7) {
- [0]=>
- int(1)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- string(20) "width="1" height="1""
- ["bits"]=>
- int(8)
- ["channels"]=>
- int(3)
- ["mime"]=>
- string(10) "image/jpeg"
-}
diff --git a/ext/standard/tests/image/getimagesize.phpt b/ext/standard/tests/image/getimagesize.phpt
deleted file mode 100644
index 46003cffac..0000000000
--- a/ext/standard/tests/image/getimagesize.phpt
+++ /dev/null
@@ -1,196 +0,0 @@
---TEST--
-GetImageSize()
---SKIPIF--
-<?php
- require_once('skipif_imagetype.inc');
-?>
---FILE--
-<?php
- // Note: SWC requires zlib
- $dir = opendir(dirname(__FILE__)) or die('cannot open directory: '.dirname(__FILE__));
- $result = array();
- $files = array();
- while (($file = readdir($dir)) !== FALSE) {
- if (preg_match('/^test.+pix\./',$file) && $file != "test13pix.swf") {
- $files[] = $file;
- }
- }
- closedir($dir);
- sort($files);
- foreach($files as $file) {
- $result[$file] = getimagesize(dirname(__FILE__)."/$file");
- }
- var_dump($result);
-?>
---EXPECT--
-array(11) {
- ["test1pix.bmp"]=>
- array(6) {
- [0]=>
- int(1)
- [1]=>
- int(1)
- [2]=>
- int(6)
- [3]=>
- string(20) "width="1" height="1""
- ["bits"]=>
- int(24)
- ["mime"]=>
- string(9) "image/bmp"
- }
- ["test1pix.jp2"]=>
- array(7) {
- [0]=>
- int(1)
- [1]=>
- int(1)
- [2]=>
- int(10)
- [3]=>
- string(20) "width="1" height="1""
- ["bits"]=>
- int(8)
- ["channels"]=>
- int(3)
- ["mime"]=>
- string(9) "image/jp2"
- }
- ["test1pix.jpc"]=>
- array(7) {
- [0]=>
- int(1)
- [1]=>
- int(1)
- [2]=>
- int(9)
- [3]=>
- string(20) "width="1" height="1""
- ["bits"]=>
- int(8)
- ["channels"]=>
- int(3)
- ["mime"]=>
- string(24) "application/octet-stream"
- }
- ["test1pix.jpg"]=>
- array(7) {
- [0]=>
- int(1)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- string(20) "width="1" height="1""
- ["bits"]=>
- int(8)
- ["channels"]=>
- int(3)
- ["mime"]=>
- string(10) "image/jpeg"
- }
- ["test2pix.gif"]=>
- array(7) {
- [0]=>
- int(2)
- [1]=>
- int(1)
- [2]=>
- int(1)
- [3]=>
- string(20) "width="2" height="1""
- ["bits"]=>
- int(1)
- ["channels"]=>
- int(3)
- ["mime"]=>
- string(9) "image/gif"
- }
- ["test4pix.gif"]=>
- array(7) {
- [0]=>
- int(4)
- [1]=>
- int(1)
- [2]=>
- int(1)
- [3]=>
- string(20) "width="4" height="1""
- ["bits"]=>
- int(2)
- ["channels"]=>
- int(3)
- ["mime"]=>
- string(9) "image/gif"
- }
- ["test4pix.iff"]=>
- array(6) {
- [0]=>
- int(4)
- [1]=>
- int(1)
- [2]=>
- int(14)
- [3]=>
- string(20) "width="4" height="1""
- ["bits"]=>
- int(4)
- ["mime"]=>
- string(9) "image/iff"
- }
- ["test4pix.png"]=>
- array(6) {
- [0]=>
- int(4)
- [1]=>
- int(1)
- [2]=>
- int(3)
- [3]=>
- string(20) "width="4" height="1""
- ["bits"]=>
- int(4)
- ["mime"]=>
- string(9) "image/png"
- }
- ["test4pix.psd"]=>
- array(5) {
- [0]=>
- int(4)
- [1]=>
- int(1)
- [2]=>
- int(5)
- [3]=>
- string(20) "width="4" height="1""
- ["mime"]=>
- string(9) "image/psd"
- }
- ["test4pix.swf"]=>
- array(5) {
- [0]=>
- int(550)
- [1]=>
- int(400)
- [2]=>
- int(4)
- [3]=>
- string(24) "width="550" height="400""
- ["mime"]=>
- string(29) "application/x-shockwave-flash"
- }
- ["test4pix.tif"]=>
- array(5) {
- [0]=>
- int(4)
- [1]=>
- int(1)
- [2]=>
- int(7)
- [3]=>
- string(20) "width="4" height="1""
- ["mime"]=>
- string(10) "image/tiff"
- }
-}
diff --git a/ext/standard/tests/image/getimagesize_246x247.phpt b/ext/standard/tests/image/getimagesize_246x247.phpt
deleted file mode 100644
index e5a0aea779..0000000000
--- a/ext/standard/tests/image/getimagesize_246x247.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-GetImageSize() with 246x247 pixels
---SKIPIF--
-<?php
- require_once('skipif_imagetype.inc');
-?>
---FILE--
-<?php
- // Note: SWC requires zlib
- $dir = opendir(dirname(__FILE__)) or die('cannot open directory: '.dirname(__FILE__));
- $result = array();
- $files = array();
- while (($file = readdir($dir)) !== FALSE) {
- if (preg_match('/^246x247\./',$file)) {
- $files[] = $file;
- }
- }
- closedir($dir);
- sort($files);
- foreach($files as $file) {
- $result[$file] = getimagesize(dirname(__FILE__)."/$file");
- }
- var_dump($result);
-?>
---EXPECT--
-array(1) {
- ["246x247.png"]=>
- array(6) {
- [0]=>
- int(246)
- [1]=>
- int(247)
- [2]=>
- int(3)
- [3]=>
- string(24) "width="246" height="247""
- ["bits"]=>
- int(4)
- ["mime"]=>
- string(9) "image/png"
- }
-}
diff --git a/ext/standard/tests/image/getimagesize_384x385.phpt b/ext/standard/tests/image/getimagesize_384x385.phpt
deleted file mode 100644
index 0051df71e0..0000000000
--- a/ext/standard/tests/image/getimagesize_384x385.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-GetImageSize() with 384x385 pixels
---SKIPIF--
-<?php
- require_once('skipif_imagetype.inc');
-?>
---FILE--
-<?php
- // Note: SWC requires zlib
- $dir = opendir(dirname(__FILE__)) or die('cannot open directory: '.dirname(__FILE__));
- $result = array();
- $files = array();
- while (($file = readdir($dir)) !== FALSE) {
- if (preg_match('/^384x385\./',$file)) {
- $files[] = $file;
- }
- }
- closedir($dir);
- sort($files);
- foreach($files as $file) {
- $result[$file] = getimagesize(dirname(__FILE__)."/$file");
- }
- var_dump($result);
-?>
---EXPECT--
-array(1) {
- ["384x385.png"]=>
- array(6) {
- [0]=>
- int(384)
- [1]=>
- int(385)
- [2]=>
- int(3)
- [3]=>
- string(24) "width="384" height="385""
- ["bits"]=>
- int(1)
- ["mime"]=>
- string(9) "image/png"
- }
-}
diff --git a/ext/standard/tests/image/getimagesize_swc.phpt b/ext/standard/tests/image/getimagesize_swc.phpt
deleted file mode 100644
index b9b83f4373..0000000000
--- a/ext/standard/tests/image/getimagesize_swc.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-GetImageSize() for compressed swf files
---SKIPIF--
-<?php
- if (!defined("IMAGETYPE_SWC") || !extension_loaded('zlib')) {
- die("skip zlib extension is not avaliable");
- }
-?>
---FILE--
-<?php
- var_dump(getimagesize(dirname(__FILE__) . "/test13pix.swf"));
-?>
---EXPECT--
-array(5) {
- [0]=>
- int(550)
- [1]=>
- int(400)
- [2]=>
- int(13)
- [3]=>
- string(24) "width="550" height="400""
- ["mime"]=>
- string(29) "application/x-shockwave-flash"
-}
diff --git a/ext/standard/tests/image/image_type_to_mime_type.phpt b/ext/standard/tests/image/image_type_to_mime_type.phpt
deleted file mode 100644
index 94aabba0b9..0000000000
--- a/ext/standard/tests/image/image_type_to_mime_type.phpt
+++ /dev/null
@@ -1,51 +0,0 @@
---TEST--
-image_type_to_mime_type()
---SKIPIF--
-<?php
- if (!function_exists('image_type_to_mime_type')) die('skip image_type_to_mime_type() not available');
- require_once('skipif_imagetype.inc');
-?>
---FILE--
-<?php
- // Note: SWC requires zlib
- $dir = opendir(dirname(__FILE__)) or die('cannot open directory: '.dirname(__FILE__));
- $result = array();
- $files = array();
- while (($file = readdir($dir)) !== FALSE) {
- if (preg_match('/^test.+pix\./',$file) && $file != "test13pix.swf") {
- $files[] = $file;
- }
- }
- closedir($dir);
- sort($files);
- foreach($files as $file) {
- $result[$file] = getimagesize(dirname(__FILE__)."/$file");
- $result[$file] = image_type_to_mime_type($result[$file][2]);
- }
- var_dump($result);
-?>
---EXPECT--
-array(11) {
- ["test1pix.bmp"]=>
- string(9) "image/bmp"
- ["test1pix.jp2"]=>
- string(9) "image/jp2"
- ["test1pix.jpc"]=>
- string(24) "application/octet-stream"
- ["test1pix.jpg"]=>
- string(10) "image/jpeg"
- ["test2pix.gif"]=>
- string(9) "image/gif"
- ["test4pix.gif"]=>
- string(9) "image/gif"
- ["test4pix.iff"]=>
- string(9) "image/iff"
- ["test4pix.png"]=>
- string(9) "image/png"
- ["test4pix.psd"]=>
- string(9) "image/psd"
- ["test4pix.swf"]=>
- string(29) "application/x-shockwave-flash"
- ["test4pix.tif"]=>
- string(10) "image/tiff"
-} \ No newline at end of file
diff --git a/ext/standard/tests/image/skipif_imagetype.inc b/ext/standard/tests/image/skipif_imagetype.inc
deleted file mode 100644
index 827f10c179..0000000000
--- a/ext/standard/tests/image/skipif_imagetype.inc
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-if (!defined('IMAGETYPE_GIF')) die('skip images of type GIF not supported');
-if (!defined('IMAGETYPE_JPEG')) die('skip images of type JPEG not supported');
-if (!defined('IMAGETYPE_PNG')) die('skip images of type PNG not supported');
-if (!defined('IMAGETYPE_SWF')) die('skip images of type SWF not supported');
-if (!defined('IMAGETYPE_PSD')) die('skip images of type PSD not supported');
-if (!defined('IMAGETYPE_BMP')) die('skip images of type BMP not supported');
-if (!defined('IMAGETYPE_TIFF_II')) die('skip images of type TIFF not supported');
-if (!defined('IMAGETYPE_TIFF_MM')) die('skip images of type TIFF not supported');
-if (!defined('IMAGETYPE_JPC')) die('skip images of type JPC not supported');
-//if (!defined('IMAGETYPE_JP2')) die('skip images of type JP2 not supported');
-//if (!defined('IMAGETYPE_JPX')) die('skip images of type JPX not supported');
-//if (!defined('IMAGETYPE_JB2')) die('skip images of type JB2 not supported');
-if (!defined('IMAGETYPE_IFF')) die('skip images of type IFF not supported');
-?>
diff --git a/ext/standard/tests/image/test13pix.swf b/ext/standard/tests/image/test13pix.swf
deleted file mode 100755
index 0d40cb743e..0000000000
--- a/ext/standard/tests/image/test13pix.swf
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/image/test1pix.bmp b/ext/standard/tests/image/test1pix.bmp
deleted file mode 100644
index f3799d2d1e..0000000000
--- a/ext/standard/tests/image/test1pix.bmp
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/image/test1pix.jp2 b/ext/standard/tests/image/test1pix.jp2
deleted file mode 100644
index 8a1172e10d..0000000000
--- a/ext/standard/tests/image/test1pix.jp2
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/image/test1pix.jpc b/ext/standard/tests/image/test1pix.jpc
deleted file mode 100644
index ac11c6bc81..0000000000
--- a/ext/standard/tests/image/test1pix.jpc
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/image/test1pix.jpg b/ext/standard/tests/image/test1pix.jpg
deleted file mode 100644
index 121decb65a..0000000000
--- a/ext/standard/tests/image/test1pix.jpg
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/image/test2pix.gif b/ext/standard/tests/image/test2pix.gif
deleted file mode 100644
index c4d4483544..0000000000
--- a/ext/standard/tests/image/test2pix.gif
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/image/test4pix.gif b/ext/standard/tests/image/test4pix.gif
deleted file mode 100644
index a02ebe9784..0000000000
--- a/ext/standard/tests/image/test4pix.gif
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/image/test4pix.iff b/ext/standard/tests/image/test4pix.iff
deleted file mode 100644
index fe9daebbae..0000000000
--- a/ext/standard/tests/image/test4pix.iff
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/image/test4pix.png b/ext/standard/tests/image/test4pix.png
deleted file mode 100644
index 2b75ac5fb2..0000000000
--- a/ext/standard/tests/image/test4pix.png
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/image/test4pix.psd b/ext/standard/tests/image/test4pix.psd
deleted file mode 100644
index 4c378239d7..0000000000
--- a/ext/standard/tests/image/test4pix.psd
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/image/test4pix.swf b/ext/standard/tests/image/test4pix.swf
deleted file mode 100755
index b1d41c6766..0000000000
--- a/ext/standard/tests/image/test4pix.swf
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/image/test4pix.tif b/ext/standard/tests/image/test4pix.tif
deleted file mode 100644
index 13367ee173..0000000000
--- a/ext/standard/tests/image/test4pix.tif
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/math/abs.phpt b/ext/standard/tests/math/abs.phpt
deleted file mode 100644
index e4e5587897..0000000000
--- a/ext/standard/tests/math/abs.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-Simple math tests
---POST--
---GET--
---FILE--
-<?php // $Id$
-
-define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
-define('LONG_MIN', -LONG_MAX - 1);
-printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
- is_int(LONG_MIN-1),is_int(LONG_MAX+1));
-
-$tests = <<<TESTS
- 1 === abs(-1)
- 1.5 === abs(-1.5)
- 1 === abs("-1")
- 1.5 === abs("-1.5")
--LONG_MIN+1 === abs(LONG_MIN-1)
--LONG_MIN === abs(LONG_MIN)
--(LONG_MIN+1) === abs(LONG_MIN+1)
-TESTS;
-
-include('tests/quicktester.inc');
---EXPECT--
-1,1,0,0
-OK
diff --git a/ext/standard/tests/math/bug21523.phpt b/ext/standard/tests/math/bug21523.phpt
deleted file mode 100644
index aaeb8e865c..0000000000
--- a/ext/standard/tests/math/bug21523.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-Bug #21523 (number_format tries to allocate negative amount of memory)
---FILE--
-<?php // $Id$ vim600:syn=php
-
-var_dump(number_format(-2000, 2768));
-echo "OK";
-?>
---EXPECT--
-string(2775) "-2,000.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
-OK
diff --git a/ext/standard/tests/math/floorceil.phpt b/ext/standard/tests/math/floorceil.phpt
deleted file mode 100644
index 3ac2094610..0000000000
--- a/ext/standard/tests/math/floorceil.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Tests for floor en ceil
---POST--
---GET--
---FILE--
-<?php
- $a = ceil (-0); $b = ceil (-1); $c = ceil (-1.5);
- $d = ceil (-1.8); $e = ceil (-2.7);
- var_dump ($a, $b, $c, $d, $e);
-
- $a = ceil (0); $b = ceil (0.5); $c = ceil (1);
- $d = ceil (1.5); $e = ceil (1.8); $f = ceil (2.7);
- var_dump ($a, $b, $c, $d, $e, $f);
-
- $a = floor (-0); $b = floor (-0.5); $c = floor (-1);
- $d = floor (-1.5); $e = floor (-1.8); $f = floor (-2.7);
- var_dump ($a, $b, $c, $d, $e, $f);
-
- $a = floor (0); $b = floor (0.5); $c = floor (1);
- $d = floor (1.5); $e = floor (1.8); $f = floor (2.7);
- var_dump ($a, $b, $c, $d, $e, $f);
-?>
---EXPECT--
-float(0)
-float(-1)
-float(-1)
-float(-1)
-float(-2)
-float(0)
-float(1)
-float(1)
-float(2)
-float(2)
-float(3)
-float(0)
-float(-1)
-float(-1)
-float(-2)
-float(-2)
-float(-3)
-float(0)
-float(0)
-float(1)
-float(1)
-float(1)
-float(2)
diff --git a/ext/standard/tests/math/hexdec.phpt b/ext/standard/tests/math/hexdec.phpt
deleted file mode 100644
index d8ff71f1ce..0000000000
--- a/ext/standard/tests/math/hexdec.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-overflow check for _php_math_basetozval
---FILE--
-<?php
-
-var_dump(hexdec("012345"));
-var_dump(hexdec("12345"));
-var_dump(hexdec("q12345"));
-var_dump(hexdec("12345+?!"));
-var_dump(hexdec("12345q"));
-var_dump((float)hexdec("1234500001"));
-var_dump((float)hexdec("17fffffff"));
-
-?>
---EXPECT--
-int(74565)
-int(74565)
-int(74565)
-int(74565)
-int(74565)
-float(78187069441)
-float(6442450943)
diff --git a/ext/standard/tests/math/log.phpt b/ext/standard/tests/math/log.phpt
deleted file mode 100644
index 285b19c853..0000000000
--- a/ext/standard/tests/math/log.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-log() tests
---POST--
---GET--
---FILE--
-<?php // $Id$
-echo "On failure, please mail result to php-dev@lists.php.net\n";
-for ($x = 0, $count= 0; $x < 200; $x++) {
- $x2 = (int) exp(log($x));
- // e ^ log(x) should be close in range to x
- if (($x2 < ($x + 2)) && ($x2 > ($x - 2))) {
- $count++;
- } else {
- print "$x : $x2\n";
- }
-}
-print $count . "\n";
-
-// Now test the base form of log
-for ($base = 2; $base < 11; $base++) {
- for ($x = 0, $count= 0; $x < 50; $x++) {
- $x2 = (int) pow($base, log($x, $base));
- // base ^ log(x) should be close in range to x
- if (($x2 < ($x + 2)) && ($x2 > ($x - 2))) {
- $count++;
- } else {
- print "base $base: $x : $x2\n";
- }
- }
- print $count . "\n";
-}
-?>
---EXPECT--
-On failure, please mail result to php-dev@lists.php.net
-200
-50
-50
-50
-50
-50
-50
-50
-50
-50
diff --git a/ext/standard/tests/math/pow.phpt b/ext/standard/tests/math/pow.phpt
deleted file mode 100644
index 12170f4f3a..0000000000
--- a/ext/standard/tests/math/pow.phpt
+++ /dev/null
@@ -1,151 +0,0 @@
---TEST--
-Various pow() tests
---POST--
---GET--
---FILE--
-<?php // $Id$
-
-define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
-define('LONG_MIN', -LONG_MAX - 1);
-printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
- is_int(LONG_MIN-1),is_int(LONG_MAX+1));
-
-$tests = <<<TESTS
- 0.25 === pow(-2,-2)
--0.5 === pow(-2,-1)
- 1 === pow(-2, 0)
--2 === pow(-2, 1)
- 4 === pow(-2, 2)
- 1.0 === pow(-1,-2)
--1.0 === pow(-1,-1)
- 1 === pow(-1, 0)
--1 === pow(-1, 1)
- 1 === pow(-1, 2)
- TRUE === is_infinite(pow(0,-2))
- TRUE === is_infinite(pow(0,-1))
- 1 === pow( 0, 0)
- 0 === pow( 0, 1)
- 0 === pow( 0, 2)
- 1.0 === pow( 1,-2)
- 1.0 === pow( 1,-1)
- 1 === pow( 1, 0)
- 1 === pow( 1, 1)
- 1 === pow( 1, 2)
- 0.25 === pow( 2,-2)
- 0.5 === pow( 2,-1)
- 1 === pow( 2, 0)
- 2 === pow( 2, 1)
- 4 === pow( 2, 2)
- 0.25 === pow(-2,-2.0)
--0.5 === pow(-2,-1.0)
- 1.0 === pow(-2, 0.0)
--2.0 === pow(-2, 1.0)
- 4.0 === pow(-2, 2.0)
- 1.0 === pow(-1,-2.0)
--1.0 === pow(-1,-1.0)
- 1.0 === pow(-1, 0.0)
--1.0 === pow(-1, 1.0)
- 1.0 === pow(-1, 2.0)
- TRUE === is_infinite(pow(0,-2.0))
- TRUE === is_infinite(pow(0,-1.0))
- 1.0 === pow( 0, 0.0)
- 0.0 === pow( 0, 1.0)
- 0.0 === pow( 0, 2.0)
- 1.0 === pow( 1,-2.0)
- 1.0 === pow( 1,-1.0)
- 1.0 === pow( 1, 0.0)
- 1.0 === pow( 1, 1.0)
- 1.0 === pow( 1, 2.0)
- 0.25 === pow( 2,-2.0)
- 0.5 === pow( 2,-1.0)
- 1.0 === pow( 2, 0.0)
- 2.0 === pow( 2, 1.0)
- 4.0 === pow( 2, 2.0)
- 2147483648 === pow(2,31)
--2147483648 ~== pow(-2,31)
- 1000000000 === pow(10,9)
- 100000000 === pow(-10,8)
- 1 === pow(-1,1443279822)
--1 === pow(-1,1443279821)
-sqrt(2) ~== pow(2,1/2)
- 0.25 === pow(-2.0,-2.0)
--0.5 === pow(-2.0,-1.0)
- 1.0 === pow(-2.0, 0.0)
--2.0 === pow(-2.0, 1.0)
- 4.0 === pow(-2.0, 2.0)
- 1.0 === pow(-1.0,-2.0)
--1.0 === pow(-1.0,-1.0)
- 1.0 === pow(-1.0, 0.0)
--1.0 === pow(-1.0, 1.0)
- 1.0 === pow(-1.0, 2.0)
- TRUE === is_infinite(pow(0.0,-2.0))
- TRUE === is_infinite(pow(0.0,-1.0))
- 1.0 === pow( 0.0, 0.0)
- 0.0 === pow( 0.0, 1.0)
- 0.0 === pow( 0.0, 2.0)
- 1.0 === pow( 1.0,-2.0)
- 1.0 === pow( 1.0,-1.0)
- 1.0 === pow( 1.0, 0.0)
- 1.0 === pow( 1.0, 1.0)
- 1.0 === pow( 1.0, 2.0)
- 0.25 === pow( 2.0,-2.0)
- 0.5 === pow( 2.0,-1.0)
- 1.0 === pow( 2.0, 0.0)
- 2.0 === pow( 2.0, 1.0)
- 4.0 === pow( 2.0, 2.0)
- 0.25 === pow(-2.0,-2)
--0.5 === pow(-2.0,-1)
- 1.0 === pow(-2.0, 0)
--2.0 === pow(-2.0, 1)
- 4.0 === pow(-2.0, 2)
- 1.0 === pow(-1.0,-2)
--1.0 === pow(-1.0,-1)
- 1.0 === pow(-1.0, 0)
--1.0 === pow(-1.0, 1)
- 1.0 === pow(-1.0, 2)
- TRUE === is_infinite(pow( 0.0,-2))
- TRUE === is_infinite(pow( 0.0,-1))
- 1.0 === pow( 0.0, 0)
- 0.0 === pow( 0.0, 1)
- 0.0 === pow( 0.0, 2)
- 1.0 === pow( 1.0,-2)
- 1.0 === pow( 1.0,-1)
- 1.0 === pow( 1.0, 0)
- 1.0 === pow( 1.0, 1)
- 1.0 === pow( 1.0, 2)
- 0.25 === pow( 2.0,-2)
- 0.5 === pow( 2.0,-1)
- 1.0 === pow( 2.0, 0)
- 2.0 === pow( 2.0, 1)
- 4.0 === pow( 2.0, 2)
- 2.0 === pow( 4, 0.5)
- 2.0 === pow( 4.0, 0.5)
- 3.0 === pow( 27, 1/3)
- 3.0 === pow(27.0, 1/3)
- 0.5 === pow( 4, -0.5)
- 0.5 === pow( 4.0, -0.5)
-LONG_MAX-1 === pow(LONG_MAX-1,1)
-LONG_MIN+1 === pow(LONG_MIN+1,1)
-(LONG_MAX-1)*(LONG_MAX-1) ~== pow(LONG_MAX-1,2)
-(LONG_MIN+1)*(LONG_MIN+1) ~== pow(LONG_MIN+1,2)
-(float)(LONG_MAX-1) === pow(LONG_MAX-1,1.0)
-(float)(LONG_MIN+1) === pow(LONG_MIN+1,1.0)
-(LONG_MAX-1)*(LONG_MAX-1) ~== pow(LONG_MAX-1,2.0)
-(LONG_MIN+1)*(LONG_MIN+1) ~== pow(LONG_MIN+1,2.0)
-LONG_MAX === pow(LONG_MAX,1)
-LONG_MIN === pow(LONG_MIN,1)
-LONG_MAX*LONG_MAX ~== pow(LONG_MAX,2)
-LONG_MIN*LONG_MIN ~== pow(LONG_MIN,2)
-(float)LONG_MAX === pow(LONG_MAX,1.0)
-(float)LONG_MIN === pow(LONG_MIN,1.0)
-LONG_MAX*LONG_MAX ~== pow(LONG_MAX,2.0)
-LONG_MIN*LONG_MIN ~== pow(LONG_MIN,2.0)
-TESTS;
-
- echo "On failure, please mail result to php-dev@lists.php.net\n";
- include('tests/quicktester.inc');
-
---EXPECT--
-1,1,0,0
-On failure, please mail result to php-dev@lists.php.net
-OK
diff --git a/ext/standard/tests/math/round.phpt b/ext/standard/tests/math/round.phpt
deleted file mode 100644
index 49eabed606..0000000000
--- a/ext/standard/tests/math/round.phpt
+++ /dev/null
@@ -1,39 +0,0 @@
---TEST--
-Simple math tests
---POST--
---GET--
---FILE--
-<?php // $Id$
-
-define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
-define('LONG_MIN', -LONG_MAX - 1);
-printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
- is_int(LONG_MIN-1),is_int(LONG_MAX+1));
-
-$tests = <<<TESTS
--1 ~== ceil(-1.5)
- 2 ~== ceil( 1.5)
--2 ~== floor(-1.5)
- 1 ~== floor(1.5)
- LONG_MIN ~== ceil(LONG_MIN - 0.5)
- LONG_MIN+1 ~== ceil(LONG_MIN + 0.5)
- LONG_MIN-1 ~== round(LONG_MIN - 0.6)
- LONG_MIN ~== round(LONG_MIN - 0.4)
- LONG_MIN ~== round(LONG_MIN + 0.4)
- LONG_MIN+1 ~== round(LONG_MIN + 0.6)
- LONG_MIN-1 ~== floor(LONG_MIN - 0.5)
- LONG_MIN ~== floor(LONG_MIN + 0.5)
- LONG_MAX ~== ceil(LONG_MAX - 0.5)
- LONG_MAX+1 ~== ceil(LONG_MAX + 0.5)
- LONG_MAX-1 ~== round(LONG_MAX - 0.6)
- LONG_MAX ~== round(LONG_MAX - 0.4)
- LONG_MAX ~== round(LONG_MAX + 0.4)
- LONG_MAX+1 ~== round(LONG_MAX + 0.6)
- LONG_MAX-1 ~== floor(LONG_MAX - 0.5)
- LONG_MAX ~== floor(LONG_MAX + 0.5)
-TESTS;
-
-include('tests/quicktester.inc');
---EXPECT--
-1,1,0,0
-OK
diff --git a/ext/standard/tests/network/bug20134.phpt b/ext/standard/tests/network/bug20134.phpt
deleted file mode 100644
index e311f892f7..0000000000
--- a/ext/standard/tests/network/bug20134.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Bug #20134 (UDP reads from invalid ports)
---FILE--
-<?php
-# vim600:syn=php:
-$fp = fsockopen("udp://localhost", 65534, $errno, $errstr);
-if (!$fp) {
- /* UDP will never cause a connection error, as it is
- * a connection-LESS protocol */
- echo "ERROR: $errno - $errstr<br>\n";
-}
-else {
- /* Likewise, writes will always appear to succeed */
- $x = fwrite($fp,"\n");
- var_dump($x);
- /* But reads should always fail */
- $content = fread($fp, 40);
- var_dump($content);
- fclose($fp);
-}
-?>
---EXPECT--
-int(1)
-string(0) ""
diff --git a/ext/standard/tests/reg/001.phpt b/ext/standard/tests/reg/001.phpt
deleted file mode 100644
index f63c252518..0000000000
--- a/ext/standard/tests/reg/001.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-RegReplace test 1
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","def",$a)?>
---EXPECT--
-abcdef
diff --git a/ext/standard/tests/reg/002.phpt b/ext/standard/tests/reg/002.phpt
deleted file mode 100644
index a9b7aaa00a..0000000000
--- a/ext/standard/tests/reg/002.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-RegReplace test 2
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","",$a)?>
---EXPECT--
-abc
diff --git a/ext/standard/tests/reg/003.phpt b/ext/standard/tests/reg/003.phpt
deleted file mode 100644
index edd9c05969..0000000000
--- a/ext/standard/tests/reg/003.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-ereg_replace single-quote test
---POST--
---GET--
---FILE--
-<?php $a="\\'test";
- echo ereg_replace("\\\\'","'",$a)
-?>
---EXPECT--
-'test
diff --git a/ext/standard/tests/reg/004.phpt b/ext/standard/tests/reg/004.phpt
deleted file mode 100644
index 1f60ff4900..0000000000
--- a/ext/standard/tests/reg/004.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-simple ereg test
---POST--
---GET--
---FILE--
-<?php $a="This is a nice and simple string";
- if (ereg(".*nice and simple.*",$a)) {
- echo "ok\n";
- }
- if (!ereg(".*doesn't exist.*",$a)) {
- echo "ok\n";
- }
-?>
---EXPECT--
-ok
-ok
diff --git a/ext/standard/tests/reg/005.phpt b/ext/standard/tests/reg/005.phpt
deleted file mode 100644
index 78c0a0912a..0000000000
--- a/ext/standard/tests/reg/005.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Test Regular expression register support in ereg
---POST--
---GET--
---FILE--
-<?php $a="This is a nice and simple string";
- echo ereg(".*(is).*(is).*",$a,$registers);
- echo "\n";
- echo $registers[0];
- echo "\n";
- echo $registers[1];
- echo "\n";
- echo $registers[2];
- echo "\n";
-?>
---EXPECT--
-32
-This is a nice and simple string
-is
-is
diff --git a/ext/standard/tests/reg/006.phpt b/ext/standard/tests/reg/006.phpt
deleted file mode 100644
index 50b6dbfd3a..0000000000
--- a/ext/standard/tests/reg/006.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Test ereg_replace of start-of-line
---POST--
---GET--
---FILE--
-<?php $a="This is a nice and simple string";
- echo ereg_replace("^This","That",$a);
-?>
---EXPECT--
-That is a nice and simple string
diff --git a/ext/standard/tests/reg/007.phpt b/ext/standard/tests/reg/007.phpt
deleted file mode 100644
index b2646f842f..0000000000
--- a/ext/standard/tests/reg/007.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Test empty result buffer in reg_replace
---POST--
---GET--
---FILE--
-<?php
- $a="abcd";
- $b=ereg_replace("abcd","",$a);
- echo "strlen(\$b)=".strlen($b);
-?>
---EXPECT--
-strlen($b)=0
diff --git a/ext/standard/tests/reg/008.phpt b/ext/standard/tests/reg/008.phpt
deleted file mode 100644
index db61d1ca07..0000000000
--- a/ext/standard/tests/reg/008.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Test back-references in regular expressions
---POST--
---GET--
---FILE--
-<?php
- echo ereg_replace("([a-z]*)([-=+|]*)([0-9]+)","\\3 \\1 \\2\n","abc+-|=123");
-?>
---EXPECT--
-123 abc +-|=
diff --git a/ext/standard/tests/reg/009.phpt b/ext/standard/tests/reg/009.phpt
deleted file mode 100644
index 4996ef4c97..0000000000
--- a/ext/standard/tests/reg/009.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Test split()
---POST--
---GET--
---FILE--
-<?php
- $a=split("[[:space:]]","this is a
-test");
- echo count($a) . "\n";
- for ($i = 0; $i < count($a); $i++) {
- echo $a[$i] . "\n";
- }
-?>
---EXPECT--
-4
-this
-is
-a
-test
diff --git a/ext/standard/tests/reg/010.phpt b/ext/standard/tests/reg/010.phpt
deleted file mode 100644
index 30d28fd02f..0000000000
--- a/ext/standard/tests/reg/010.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-Long back references
---POST--
---GET--
---FILE--
-<?php $a="abc122222222223";
- echo ereg_replace("1(2*)3","\\1def\\1",$a)?>
---EXPECT--
-abc2222222222def2222222222
diff --git a/ext/standard/tests/reg/011.phpt b/ext/standard/tests/reg/011.phpt
deleted file mode 100644
index 4eda774f58..0000000000
--- a/ext/standard/tests/reg/011.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-\0 back reference
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","def\\0ghi",$a)?>
---EXPECT--
-abcdef123ghi
diff --git a/ext/standard/tests/reg/012.phpt b/ext/standard/tests/reg/012.phpt
deleted file mode 100644
index d5342c7436..0000000000
--- a/ext/standard/tests/reg/012.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-nonexisting back reference
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123",'def\1ghi',$a)?>
---EXPECT--
-abcdef\1ghi
diff --git a/ext/standard/tests/reg/013.phpt b/ext/standard/tests/reg/013.phpt
deleted file mode 100644
index ec3329fa7c..0000000000
--- a/ext/standard/tests/reg/013.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-escapes in replace string
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","def\\g\\\\hi\\",$a)?>
---EXPECT--
-abcdef\g\\hi\
diff --git a/ext/standard/tests/reg/014.phpt b/ext/standard/tests/reg/014.phpt
deleted file mode 100644
index ec4d19ed0e..0000000000
--- a/ext/standard/tests/reg/014.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-backreferences not replaced recursively
---POST--
---GET--
---FILE--
-<?php $a="a\\2bxc";
- echo ereg_replace("a(.*)b(.*)c","\\1",$a)?>
---EXPECT--
-\2
diff --git a/ext/standard/tests/reg/015.phpt b/ext/standard/tests/reg/015.phpt
deleted file mode 100644
index 961a60fa76..0000000000
--- a/ext/standard/tests/reg/015.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-replace empty matches
---POST--
---GET--
---FILE--
-<?php echo ereg_replace("^","z","abc123")?>
---EXPECT--
-zabc123
diff --git a/ext/standard/tests/reg/016.phpt b/ext/standard/tests/reg/016.phpt
deleted file mode 100644
index a24816f182..0000000000
--- a/ext/standard/tests/reg/016.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-test backslash handling in regular expressions
---POST--
---GET--
---FILE--
-<?php echo ereg_replace('\?',"abc","?123?")?>
---EXPECT--
-abc123abc
diff --git a/ext/standard/tests/serialize/001.phpt b/ext/standard/tests/serialize/001.phpt
deleted file mode 100644
index f9fb6ae4b4..0000000000
--- a/ext/standard/tests/serialize/001.phpt
+++ /dev/null
@@ -1,117 +0,0 @@
---TEST--
-serialize()/unserialize()/var_dump()
---POST--
---GET--
---FILE--
-<?php
-class t
-{
- function t()
- {
- $this->a = "hallo";
- }
-}
-
-class s
-{
- function s()
- {
- $this->a = "hallo";
- $this->b = "php";
- $this->c = "world";
- }
-
- function __sleep()
- {
- echo "__sleep called\n";
- return array("a","c");
- }
-
- function __wakeup()
- {
- echo "__wakeup called\n";
- }
-}
-
-
-echo serialize(NULL)."\n";
-echo serialize((bool) true)."\n";
-echo serialize((bool) false)."\n";
-echo serialize(1)."\n";
-echo serialize(0)."\n";
-echo serialize(-1)."\n";
-echo serialize(2147483647)."\n";
-echo serialize(-2147483647)."\n";
-echo serialize(1.123456789)."\n";
-echo serialize(1.0)."\n";
-echo serialize(0.0)."\n";
-echo serialize(-1.0)."\n";
-echo serialize(-1.123456789)."\n";
-echo serialize("hallo")."\n";
-echo serialize(array(1,1.1,"hallo",NULL,true,array()))."\n";
-
-$t = new t();
-$data = serialize($t);
-echo "$data\n";
-$t = unserialize($data);
-var_dump($t);
-
-$t = new s();
-$data = serialize($t);
-echo "$data\n";
-$t = unserialize($data);
-var_dump($t);
-
-$a = array("a" => "test");
-$a[ "b" ] = &$a[ "a" ];
-var_dump($a);
-$data = serialize($a);
-echo "$data\n";
-$a = unserialize($data);
-var_dump($a);
-?>
---EXPECTF--
-N;
-b:1;
-b:0;
-i:1;
-i:0;
-i:-1;
-i:2147483647;
-i:-2147483647;
-d:1.123456789000000011213842299184761941432952880859375;
-d:1;
-d:0;
-d:-1;
-d:-1.123456789000000011213842299184761941432952880859375;
-s:5:"hallo";
-a:6:{i:0;i:1;i:1;d:1.100000000000000088817841970012523233890533447265625;i:2;s:5:"hallo";i:3;N;i:4;b:1;i:5;a:0:{}}
-O:1:"t":1:{s:1:"a";s:5:"hallo";}
-object(t)#%d (1) {
- ["a"]=>
- string(5) "hallo"
-}
-__sleep called
-O:1:"s":2:{s:1:"a";s:5:"hallo";s:1:"c";s:5:"world";}
-__wakeup called
-object(s)#%d (3) {
- ["a"]=>
- string(5) "hallo"
- ["b"]=>
- NULL
- ["c"]=>
- string(5) "world"
-}
-array(2) {
- ["a"]=>
- &string(4) "test"
- ["b"]=>
- &string(4) "test"
-}
-a:2:{s:1:"a";s:4:"test";s:1:"b";R:2;}
-array(2) {
- ["a"]=>
- &string(4) "test"
- ["b"]=>
- &string(4) "test"
-}
diff --git a/ext/standard/tests/serialize/003.phpt b/ext/standard/tests/serialize/003.phpt
deleted file mode 100644
index b4fbcc1200..0000000000
--- a/ext/standard/tests/serialize/003.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-unserialize() floats with E notation (#18654)
---POST--
---GET--
---FILE--
-<?php
-foreach(array(1e2, 5.2e25, 85.29e-23, 9e-9) AS $value) {
- echo ($ser = serialize($value))."\n";
- var_dump(unserialize($ser));
- echo "\n";
-}
-?>
---EXPECT--
-d:100;
-float(100)
-
-d:5.2E+25;
-float(5.2E+25)
-
-d:8.528999999999999914734871708787977695465087890625E-22;
-float(8.529E-22)
-
-d:9.0000000000000017763568394002504646778106689453125E-9;
-float(9.E-9)
diff --git a/ext/standard/tests/serialize/bug14293.phpt b/ext/standard/tests/serialize/bug14293.phpt
deleted file mode 100644
index 976eeffc0e..0000000000
--- a/ext/standard/tests/serialize/bug14293.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-Bug #14293 (serialize() and __sleep())
---FILE--
-<?php
-class t
-{
- function t()
- {
- $this->a = 'hello';
- }
-
- function __sleep()
- {
- echo "__sleep called\n";
- return array('a','b');
- }
-}
-
-$t = new t();
-$data = serialize($t);
-echo "$data\n";
-$t = unserialize($data);
-var_dump($t);
-
-?>
---EXPECTF--
-__sleep called
-O:1:"t":2:{s:1:"a";s:5:"hello";s:1:"b";N;}
-object(t)#%d (2) {
- ["a"]=>
- string(5) "hello"
- ["b"]=>
- NULL
-}
diff --git a/ext/standard/tests/serialize/bug23298.phpt b/ext/standard/tests/serialize/bug23298.phpt
deleted file mode 100644
index a5305cf37c..0000000000
--- a/ext/standard/tests/serialize/bug23298.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Bug #23298 (serialize() and floats/doubles)
---INI--
-serialize_precision=100
---FILE--
-<?php
- ini_set('precision', 12);
- $foo = 1.428571428571428647642857142;
- $bar = unserialize(serialize($foo));
- var_dump(($foo === $bar));
-?>
---EXPECT--
-bool(true)
diff --git a/ext/standard/tests/strings/004.phpt b/ext/standard/tests/strings/004.phpt
deleted file mode 100644
index b9904c614a..0000000000
--- a/ext/standard/tests/strings/004.phpt
+++ /dev/null
@@ -1,84 +0,0 @@
---TEST--
-Testing randomization of shuffle() and str_shuffle().
---FILE--
-<?php
-function stats($f, $a) {
- $times = 90000;
- print "$f\n";
- ksort($a);
- foreach($a as $k => $v)
- print "$k: $v: " . sprintf('%0.3f', $v / $times) . "\n";
-}
-$a = array();
-$times = 90000;
-for ($i = 0; $i < $times; $i++) {
- $p = range(1,4);
- shuffle($p);
- $s = join('', $p);
- if (empty($a[$s])) $a[$s] = 0;
- $a[$s]++;
-}
-
-stats('shuffle', $a);
-$a = array();
-$times = 90000;
-for ($i = 0; $i < $times; $i++) {
- $p = '1234';
- $s = str_shuffle($p);
- if (empty($a[$s])) $a[$s] = 0;
- $a[$s]++;
-}
-
-stats('str_shuffle', $a);
-?>
---EXPECTREGEX--
-shuffle
-1234: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-1243: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-1324: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-1342: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-1423: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-1432: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-2134: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-2143: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-2314: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-2341: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-2413: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-2431: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-3124: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-3142: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-3214: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-3241: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-3412: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-3421: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-4123: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-4132: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-4213: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-4231: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-4312: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-4321: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-str_shuffle
-1234: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-1243: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-1324: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-1342: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-1423: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-1432: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-2134: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-2143: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-2314: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-2341: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-2413: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-2431: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-3124: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-3142: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-3214: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-3241: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-3412: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-3421: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-4123: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-4132: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-4213: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-4231: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-4312: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
-4321: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
diff --git a/ext/standard/tests/strings/add-and-stripcslashes.phpt b/ext/standard/tests/strings/add-and-stripcslashes.phpt
deleted file mode 100644
index f231156e88..0000000000
--- a/ext/standard/tests/strings/add-and-stripcslashes.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-addcslashes() and stripcslashes() function
---POST--
---GET--
---FILE--
-<?php
-echo addcslashes("", "")."\n";
-echo addcslashes("", "burp")."\n";
-echo addcslashes("kaboemkara!", "")."\n";
-echo addcslashes("foobarbaz", 'bar')."\n";
-echo addcslashes('foo[ ]', 'A..z')."\n";
-echo @addcslashes("zoo['.']", 'z..A')."\n";
-echo addcslashes('abcdefghijklmnopqrstuvwxyz', "a\145..\160z")."\n";
-echo "\n\r" == stripcslashes('\n\r'),"\n";
-echo stripcslashes('\065\x64')."\n";
-echo stripcslashes('')."\n";
-?>
---EXPECT--
-
-
-kaboemkara!
-foo\b\a\r\b\az
-\f\o\o\[ \]
-\zoo['\.']
-\abcd\e\f\g\h\i\j\k\l\m\n\o\pqrstuvwxy\z
-1
-5d
-
diff --git a/ext/standard/tests/strings/add-and-stripslashes.phpt b/ext/standard/tests/strings/add-and-stripslashes.phpt
deleted file mode 100644
index 1c65aefda6..0000000000
--- a/ext/standard/tests/strings/add-and-stripslashes.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-addslashes() and stripslashes() functions, normal and sybase-style
---POST--
---GET--
---FILE--
-<?php
-
-$input = '';
-for($i=0; $i<512; $i++) {
- $input .= chr($i%256);
-}
-
-echo "Normal: ";
-ini_set('magic_quotes_sybase', 0);
-if($input === stripslashes(addslashes($input))) {
- echo "OK\n";
-} else {
- echo "FAILED\n";
-}
-
-echo "Sybase: ";
-ini_set('magic_quotes_sybase', 1);
-if($input === stripslashes(addslashes($input))) {
- echo "OK\n";
-} else {
- echo "FAILED\n";
-}
-
-?>
---EXPECT--
-Normal: OK
-Sybase: OK
diff --git a/ext/standard/tests/strings/basename.phpt b/ext/standard/tests/strings/basename.phpt
deleted file mode 100644
index b1ccdfdd1d..0000000000
--- a/ext/standard/tests/strings/basename.phpt
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/strings/bin2hex.phpt b/ext/standard/tests/strings/bin2hex.phpt
deleted file mode 100644
index 5753a74dc0..0000000000
--- a/ext/standard/tests/strings/bin2hex.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-bin2hex() function
---POST--
---GET--
---FILE--
-<?php
-$s = '';
-for($i=0; $i<256; $i++) {
- $s .= chr($i);
-}
-echo bin2hex($s)."\n";
-echo bin2hex("abc")."\n";
-?>
---EXPECT--
-000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
-616263
diff --git a/ext/standard/tests/strings/bug20108.phpt b/ext/standard/tests/strings/bug20108.phpt
deleted file mode 100644
index 0993412500..0000000000
--- a/ext/standard/tests/strings/bug20108.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Bug #20108 (Segfault on printf statement)
---SKIPIF--
---FILE--
-<?php
- $a = "boo";
- $z = sprintf("%580.58s\n", $a);
- var_dump($z);
-?>
---EXPECT--
-string(581) " boo
-"
diff --git a/ext/standard/tests/strings/bug20169.phpt b/ext/standard/tests/strings/bug20169.phpt
deleted file mode 100644
index c606578677..0000000000
--- a/ext/standard/tests/strings/bug20169.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-Bug #20169 (implode() clobbers first argument)
---FILE--
-<?php
- @set_time_limit(5);
- $delimiter = "|";
-
- echo "delimiter: $delimiter\n";
- implode($delimiter, array("foo", "bar"));
- echo "delimiter: $delimiter\n";
-?>
---EXPECT--
-delimiter: |
-delimiter: |
diff --git a/ext/standard/tests/strings/bug20261.phpt b/ext/standard/tests/strings/bug20261.phpt
deleted file mode 100644
index 163e905a4a..0000000000
--- a/ext/standard/tests/strings/bug20261.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-Bug #20261 (str_rot13() changes too much)
---FILE--
-<?php
- $first = "boo";
- $second = $first;
- $rot = "";
-
- echo "1: ".$first."\n";
- echo "2: ".$second."\n";
- echo "3: ".$rot."\n";
-
- $rot = str_rot13($second);
-
- echo "1: ".$first."\n";
- echo "2: ".$second."\n";
- echo "3: ".$rot."\n";
-?>
---EXPECT--
-1: boo
-2: boo
-3:
-1: boo
-2: boo
-3: obb
-
diff --git a/ext/standard/tests/strings/bug20927.phpt b/ext/standard/tests/strings/bug20927.phpt
deleted file mode 100644
index 5b7c904c65..0000000000
--- a/ext/standard/tests/strings/bug20927.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Bug #20927 (Segfault on wordwrap statement)
---SKIPIF--
---FILE--
-<?php
-$string = str_repeat("1234567890 X ", 10);
-$break = str_repeat("a-very-long-break-string-to-clobber-the-heap", 8);
-$linelength = 10;
-
-echo "Length of original string: ".strlen($string)."\n";
-echo "Length of break string: ".strlen($break)."\n";
-
-var_dump(wordwrap($string, $linelength, $break, 1));
-?>
---EXPECT--
-Length of original string: 130
-Length of break string: 352
-string(6799) "1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapX "
diff --git a/ext/standard/tests/strings/bug20934.phpt b/ext/standard/tests/strings/bug20934.phpt
deleted file mode 100644
index 0d95081d54..0000000000
--- a/ext/standard/tests/strings/bug20934.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Bug #20934 (htmlspecialchars returns latin1 from UTF-8)
---SKIPIF--
-<?php
-if (!function_exists("utf8_encode") || !function_exists("utf8_decode")) {
- die("SKIP Neither utf8_encode() nor utf8_decode() are available");
-}
-?>
---FILE--
-<?php
-$str = utf8_encode("\xe0\xe1");
-var_dump(utf8_decode($str));
-var_dump(utf8_decode(htmlspecialchars($str, ENT_COMPAT, "UTF-8")));
-?>
---EXPECT--
-string(2) "àá"
-string(2) "àá"
diff --git a/ext/standard/tests/strings/bug21338.phpt b/ext/standard/tests/strings/bug21338.phpt
deleted file mode 100644
index c84576563e..0000000000
--- a/ext/standard/tests/strings/bug21338.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Bug #20934 (html_entity_decode() crash when "" is passed)
---FILE--
-<?php
- var_dump(html_entity_decode(NULL));
- var_dump(html_entity_decode(""));
-?>
---EXPECT--
-string(0) ""
-string(0) ""
diff --git a/ext/standard/tests/strings/bug21453.phpt b/ext/standard/tests/strings/bug21453.phpt
deleted file mode 100644
index 40d89dd1b4..0000000000
--- a/ext/standard/tests/strings/bug21453.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Bug #21453 (handling of non-encoded <)
---FILE--
-<?php
-$test = "
-<table>
- <tr><td>first cell before < first cell after</td></tr>
- <tr><td>second cell before < second cell after</td></tr>
-</table>";
-
- var_dump(strip_tags($test));
-?>
---EXPECT--
-string(80) "
-
- first cell before < first cell after
- second cell before < second cell after
-"
diff --git a/ext/standard/tests/strings/bug21730.phpt b/ext/standard/tests/strings/bug21730.phpt
deleted file mode 100644
index 8d40e204ce..0000000000
--- a/ext/standard/tests/strings/bug21730.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-Bug #21730 (*scanf "%n" conversion flag gives string instead of integer)
---FILE--
-<?php
-$foo = "ABC = DEF";
-$fmt = "%s = %s %n";
-$res_a = array();
-
-/* $res_a[2] is supposed to be a integer value that
- * represents the number of characters consumed so far
- */
-sscanf($foo, $fmt, $res_a[0], $res_a[1], $res_a[2]);
-
-$res_b = sscanf($foo, $fmt);
-
-var_dump($res_a);
-var_dump($res_b);
-?>
---EXPECT--
-array(3) {
- [0]=>
- string(3) "ABC"
- [1]=>
- string(3) "DEF"
- [2]=>
- int(9)
-}
-array(3) {
- [0]=>
- string(3) "ABC"
- [1]=>
- string(3) "DEF"
- [2]=>
- int(9)
-}
diff --git a/ext/standard/tests/strings/bug21744.phpt b/ext/standard/tests/strings/bug21744.phpt
deleted file mode 100644
index 925dac3fa0..0000000000
--- a/ext/standard/tests/strings/bug21744.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Bug #21744 (strip_tags misses exclamation marks in alt text)
---FILE--
-<?php
-$test = <<< HERE
-<a href="test?test\\!!!test">test</a>
-<!-- test -->
-HERE;
-
-print strip_tags($test, '');
-print strip_tags($test, '<a>');
-?>
---EXPECT--
-test
-<a href="test?test\!!!test">test</a>
diff --git a/ext/standard/tests/strings/bug22008.phpt b/ext/standard/tests/strings/bug22008.phpt
deleted file mode 100644
index 0965337e64..0000000000
--- a/ext/standard/tests/strings/bug22008.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Bug #22008 (strip_tags() eliminates too much)
---FILE--
-<?php
-$html = <<< HERE
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>test</title>
-</head>
-<body>
-<b>PHP!</b>
-</body>
-</html>
-
-HERE;
-
-echo trim(strip_tags($html, '<b>'))."\n";
-?>
---EXPECT--
-test
-
-
-<b>PHP!</b>
diff --git a/ext/standard/tests/strings/bug22187.phpt b/ext/standard/tests/strings/bug22187.phpt
deleted file mode 100644
index dccaccc04d..0000000000
--- a/ext/standard/tests/strings/bug22187.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Bug #22187 (possible crash in number_format() function)
---FILE--
-<?php
- var_dump(number_format(0.0001, 1));
- var_dump(number_format(0.0001, 0));
-?>
---EXPECT--
-string(3) "0.0"
-string(1) "0"
diff --git a/ext/standard/tests/strings/bug22207.phpt b/ext/standard/tests/strings/bug22207.phpt
deleted file mode 100644
index 1623fb8e41..0000000000
--- a/ext/standard/tests/strings/bug22207.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-Bug #22207 (missing 0 when using the e notation in *printf functions)
---FILE--
-<?php
- printf("%10.5e\n", 1.1);
- var_dump(sprintf("%10.5e\n", 1.1));
-?>
---EXPECT--
-1.1000e+0
-string(17) " 1.1000e+0
-"
diff --git a/ext/standard/tests/strings/bug22224.phpt b/ext/standard/tests/strings/bug22224.phpt
deleted file mode 100644
index d64fc0acfc..0000000000
--- a/ext/standard/tests/strings/bug22224.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-Bug #22224 (implode changes object references in array)
---INI--
-error_reporting=0
---FILE--
-<?php
-class foo {
-}
-
-
-$a = new foo();
-
-$arr = array(0=>&$a, 1=>&$a);
-var_dump(implode(",",$arr));
-var_dump($arr)
-?>
---EXPECTF--
-string(13) "Object,Object"
-array(2) {
- [0]=>
- &object(foo)#%d (0) {
- }
- [1]=>
- &object(foo)#%d (0) {
- }
-}
diff --git a/ext/standard/tests/strings/bug22227.phpt b/ext/standard/tests/strings/bug22227.phpt
deleted file mode 100644
index eb980f9865..0000000000
--- a/ext/standard/tests/strings/bug22227.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-Bug #22227 (printf() field limiters broke between 4.2.3 and 4.3.0)
---FILE--
-<?php
-printf("%-3.3s", "abcdef");
-print "\n";
-?>
---EXPECT--
-abc
diff --git a/ext/standard/tests/strings/bug22904.phpt b/ext/standard/tests/strings/bug22904.phpt
deleted file mode 100644
index 3c56e1a414..0000000000
--- a/ext/standard/tests/strings/bug22904.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Bug #22904 (magic mode failed for cybase with '\0')
---FILE--
-not active yet
-<?php
-
-/*
-ini_set("magic_quotes_sybase","on");
-test();
-ini_set("magic_quotes_sybase","off");
-test();
-*/
-function test(){
- $buf = 'g\g"\0g'."'";
- $slashed = addslashes($buf);
- echo "$buf\n";
- echo "$slashed\n";
- echo stripslashes($slashed."\n");
-/*
-g\g"\0g'
-g\\g"\\0g''
-g\g"\0g'
-g\g"\0g'
-g\\g\"\\0g\'
-g\g"\0g'
-*/
-}
-?>
---EXPECT--
-not active yet
diff --git a/ext/standard/tests/strings/chr_ord.phpt b/ext/standard/tests/strings/chr_ord.phpt
deleted file mode 100644
index 266f61be04..0000000000
--- a/ext/standard/tests/strings/chr_ord.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-chr() and ord() functions
---POST--
---GET--
---FILE--
-<?php
-echo "Testing ord() & chr()...";
-for($i=0; $i<256; $i++) echo !ord(chr($i)) == $i;
-echo " done";
-?>
---EXPECT--
-Testing ord() & chr()... done
diff --git a/ext/standard/tests/strings/chunk_split.phpt b/ext/standard/tests/strings/chunk_split.phpt
deleted file mode 100644
index 6c0f3fac84..0000000000
--- a/ext/standard/tests/strings/chunk_split.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-chunk_split() function
---POST--
---GET--
---FILE--
-<?php
-echo chunk_split('abc', 1, '-')."\n";
-echo chunk_split('foooooooooooooooo', 5)."\n";
-echo chunk_split(str_repeat('X', 2*76))."\n";
-?>
---EXPECT--
-a-b-c-
-foooo
-ooooo
-ooooo
-oo
-
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
diff --git a/ext/standard/tests/strings/count_chars.phpt b/ext/standard/tests/strings/count_chars.phpt
deleted file mode 100644
index 0006b4232f..0000000000
--- a/ext/standard/tests/strings/count_chars.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-count_chars() function
---POST--
---GET--
---FILE--
-<?php
-$s = "het leven is net erwtensoep - je kunt er geen touw aan vastknopen";
-for($i=0; $i<3; $i++) {
- echo implode(count_chars($s, $i))."\n";
-}
-echo $a = count_chars($s, 3), "\n";
-echo (int) strlen(count_chars($s, 4)) == 256-strlen($a),"\n";
-
-?>
---EXPECT--
-000000000000000000000000000000001200000000000010000000000000000000000000000000000000000000000000003000120111121083202362220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-121312111121832236222
-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
- -aeghijklnoprstuvw
-1
diff --git a/ext/standard/tests/strings/crc32.phpt b/ext/standard/tests/strings/crc32.phpt
deleted file mode 100644
index 8074c5e6f9..0000000000
--- a/ext/standard/tests/strings/crc32.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-crc32() function
---POST--
---GET--
---FILE--
-<?php
-$input = array("foo", "bar", "baz", "grldsajkopallkjasd");
-foreach($input AS $i) {
- printf("%u\n", crc32($i));
-}
-?>
---EXPECT--
-2356372769
-1996459178
-2015626392
-824412087
diff --git a/ext/standard/tests/strings/crypt.phpt b/ext/standard/tests/strings/crypt.phpt
deleted file mode 100644
index 06f3e941b9..0000000000
--- a/ext/standard/tests/strings/crypt.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-crypt() function
---FILE--
-<?php
-
-$str = 'rasmuslerdorf';
-$salt1 = 'rl';
-$res_1 = 'rl.3StKT.4T8M';
-$salt2 = '_J9..rasm';
-$res_2 = '_J9..rasmBYk8r9AiWNc';
-$salt3 = '$1$rasmusle$';
-$res_3 = '$1$rasmusle$rISCgZzpwk3UhDidwXvin0';
-$salt4 = '$2a$07$rasmuslerd............';
-$res_4 = '$2a$07$rasmuslerd............nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra';
-
-echo (CRYPT_STD_DES) ? ((crypt($str, $salt1) === $res_1) ? 'STD' : 'STD - ERROR') : 'STD', "\n";
-echo (CRYPT_EXT_DES) ? ((crypt($str, $salt2) === $res_2) ? 'EXT' : 'EXT - ERROR') : 'EXT', "\n";
-echo (CRYPT_MD5) ? ((crypt($str, $salt3) === $res_3) ? 'MD5' : 'MD5 - ERROR') : 'MD5', "\n";
-echo (CRYPT_BLOWFISH) ? ((crypt($str, $salt4) === $res_4) ? 'BLO' : 'BLO - ERROR') : 'BLO', "\n";
-
-?>
---EXPECT--
-STD
-EXT
-MD5
-BLO
diff --git a/ext/standard/tests/strings/explode.phpt b/ext/standard/tests/strings/explode.phpt
deleted file mode 100644
index 94d947fc4f..0000000000
--- a/ext/standard/tests/strings/explode.phpt
+++ /dev/null
@@ -1,116 +0,0 @@
---TEST--
-explode() function
---POST--
---GET--
---INI--
-error_reporting=2047
---FILE--
-<?php
-/* From http://bugs.php.net/19865 */
-echo md5(var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE));
-echo "\n";
-var_dump(@explode("", ""));
-var_dump(@explode("", NULL));
-var_dump(@explode(NULL, ""));
-var_dump(@explode("a", ""));
-var_dump(@explode("a", "a"));
-var_dump(@explode("a", NULL));
-var_dump(@explode(NULL, a));
-var_dump(@explode("abc", "acb"));
-var_dump(@explode("somestring", "otherstring"));
-var_dump(@explode("a", "aaaaaa"));
-var_dump(@explode("==", str_repeat("-=".ord(0)."=-", 10)));
-var_dump(@explode("=", str_repeat("-=".ord(0)."=-", 10)));
-?>
---EXPECTF--
-26d4e18734cb2582df5055e2175223df
-bool(false)
-bool(false)
-bool(false)
-array(1) {
- [0]=>
- string(0) ""
-}
-array(2) {
- [0]=>
- string(0) ""
- [1]=>
- string(0) ""
-}
-array(1) {
- [0]=>
- string(0) ""
-}
-bool(false)
-array(1) {
- [0]=>
- string(3) "acb"
-}
-array(1) {
- [0]=>
- string(11) "otherstring"
-}
-array(7) {
- [0]=>
- string(0) ""
- [1]=>
- string(0) ""
- [2]=>
- string(0) ""
- [3]=>
- string(0) ""
- [4]=>
- string(0) ""
- [5]=>
- string(0) ""
- [6]=>
- string(0) ""
-}
-array(1) {
- [0]=>
- string(60) "-=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=-"
-}
-array(21) {
- [0]=>
- string(1) "-"
- [1]=>
- string(2) "48"
- [2]=>
- string(2) "--"
- [3]=>
- string(2) "48"
- [4]=>
- string(2) "--"
- [5]=>
- string(2) "48"
- [6]=>
- string(2) "--"
- [7]=>
- string(2) "48"
- [8]=>
- string(2) "--"
- [9]=>
- string(2) "48"
- [10]=>
- string(2) "--"
- [11]=>
- string(2) "48"
- [12]=>
- string(2) "--"
- [13]=>
- string(2) "48"
- [14]=>
- string(2) "--"
- [15]=>
- string(2) "48"
- [16]=>
- string(2) "--"
- [17]=>
- string(2) "48"
- [18]=>
- string(2) "--"
- [19]=>
- string(2) "48"
- [20]=>
- string(1) "-"
-}
diff --git a/ext/standard/tests/strings/htmlentities.phpt b/ext/standard/tests/strings/htmlentities.phpt
deleted file mode 100644
index 743651ecad..0000000000
--- a/ext/standard/tests/strings/htmlentities.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-HTML entities
---INI--
-output_handler=
---FILE--
-<?php
-setlocale (LC_CTYPE, "C");
-$sc_encoded = htmlspecialchars ("<>\"&åÄ\n");
-echo $sc_encoded;
-$ent_encoded = htmlentities ("<>\"&åÄ\n");
-echo $ent_encoded;
-echo html_entity_decode($sc_encoded);
-echo html_entity_decode($ent_encoded);
-?>
---EXPECT--
-&lt;&gt;&quot;&amp;åÄ
-&lt;&gt;&quot;&amp;&aring;&Auml;
-<>"&åÄ
-<>"&åÄ
diff --git a/ext/standard/tests/strings/htmlentities01.phpt b/ext/standard/tests/strings/htmlentities01.phpt
deleted file mode 100644
index 4ab49472d1..0000000000
--- a/ext/standard/tests/strings/htmlentities01.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-htmlentities() test 1 (cp1252)
---INI--
-output_handler=
-mbstring.internal_encoding=pass
---FILE--
-<?php
- var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, 'cp1252'));
- var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, 'cp1252'));
-?>
---EXPECT--
-string(28) "&sbquo;&dagger;&trade;&Yuml;"
-string(32) "&euro;&cent;&pound;&curren;&yen;"
diff --git a/ext/standard/tests/strings/htmlentities02.phpt b/ext/standard/tests/strings/htmlentities02.phpt
deleted file mode 100644
index 3158cf44c6..0000000000
--- a/ext/standard/tests/strings/htmlentities02.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-htmlentities() test 2 (setlocale / fr_FR.ISO-8859-15)
---SKIPIF--
-<?php
-$result = (bool)setlocale(LC_CTYPE, "fr_FR.ISO-8859-15", "fr_FR.ISO8859-15");
-if (!$result || preg_match('/ISO/i', setlocale(LC_CTYPE, 0)) == 0) {
- die("skip setlocale() failed\n");
-}
-?>
---INI--
-output_handler=
-default_charset=
-mbstring.internal_encoding=none
---FILE--
-<?php
- setlocale( LC_CTYPE, "fr_FR.ISO-8859-15", "fr_FR.ISO8859-15" );
- var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, ''));
-?>
---EXPECT--
-string(20) "&OElig;&oelig;&Yuml;"
diff --git a/ext/standard/tests/strings/htmlentities03.phpt b/ext/standard/tests/strings/htmlentities03.phpt
deleted file mode 100644
index 7e933544fe..0000000000
--- a/ext/standard/tests/strings/htmlentities03.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-htmlentities() test 3 (setlocale / de_DE.ISO-8859-1)
---SKIPIF--
-<?php
-$result = (bool)setlocale(LC_CTYPE, "de_DE.ISO-8859-1", "de_DE.ISO8859-1");
-if (!$result || preg_match('/ISO/i', setlocale(LC_CTYPE, 0)) == 0) {
- die("skip setlocale() failed\n");
-}
-?>
---INI--
-output_handler=
-default_charset=
-mbstring.internal_encoding=none
---FILE--
-<?php
- setlocale( LC_CTYPE, "de_DE.ISO-8859-1", "de_DE.ISO8859-1");
- var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, ''));
-?>
---EXPECT--
-string(18) "&auml;&ouml;&uuml;"
diff --git a/ext/standard/tests/strings/htmlentities04.phpt b/ext/standard/tests/strings/htmlentities04.phpt
deleted file mode 100644
index 8e362d073c..0000000000
--- a/ext/standard/tests/strings/htmlentities04.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-htmlentities() test 4 (setlocale / ja_JP.EUC-JP)
---SKIPIF--
-<?php
-$result = (bool)setlocale(LC_CTYPE, "ja_JP.EUC-JP", "ja_JP.eucJP");
-if (!$result || preg_match('/EUC[^a-zA-Z]*JP/i', setlocale(LC_CTYPE, 0)) == 0) {
- die("skip setlocale() failed\n");
-}
-?>
---INI--
-output_handler=
-default_charset=
-mbstring.internal_encoding=none
---FILE--
-<?php
- setlocale( LC_CTYPE, "ja_JP.EUC-JP", "ja_JP.eucJP" );
- var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, ''));
-?>
---EXPECT--
-string(6) "¡¢¡£¡¤"
diff --git a/ext/standard/tests/strings/htmlentities05.phpt b/ext/standard/tests/strings/htmlentities05.phpt
deleted file mode 100644
index 779cf289b0..0000000000
--- a/ext/standard/tests/strings/htmlentities05.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-htmlentities() test 5 (mbstring / cp1252)
---INI--
-output_handler=
---SKIPIF--
-<?php
- extension_loaded("mbstring") or die("skip mbstring not available\n");
- mb_internal_encoding('cp1252');
- $php_errormsg = NULL;
- @htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, '');
- if ($php_errormsg) {
- die("skip cp1252 chracter set is not supported on this platform.\n");
- }
-?>
---FILE--
-<?php
- mb_internal_encoding('cp1252');
- print mb_internal_encoding()."\n";
- var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, ''));
- var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, ''));
-?>
---EXPECT--
-Windows-1252
-string(28) "&sbquo;&dagger;&trade;&Yuml;"
-string(32) "&euro;&cent;&pound;&curren;&yen;"
diff --git a/ext/standard/tests/strings/htmlentities06.phpt b/ext/standard/tests/strings/htmlentities06.phpt
deleted file mode 100644
index 44d1466da9..0000000000
--- a/ext/standard/tests/strings/htmlentities06.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-htmlentities() test 6 (mbstring / ISO-8859-15)
---INI--
-output_handler=
---SKIPIF--
-<?php
- extension_loaded("mbstring") or die("skip mbstring not available\n");
- @mb_internal_encoding('ISO-8859-15');
- @htmlentities("\xbc\xbd\xbe", ENT_QUOTES, '');
- if (@$php_errormsg) {
- die("skip ISO-8859-15 chracter set is not supported on this platform.\n");
- }
-?>
---FILE--
-<?php
- mb_internal_encoding('ISO-8859-15');
- print mb_internal_encoding()."\n";
- var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, ''));
-?>
---EXPECT--
-ISO-8859-15
-string(20) "&OElig;&oelig;&Yuml;"
diff --git a/ext/standard/tests/strings/htmlentities07.phpt b/ext/standard/tests/strings/htmlentities07.phpt
deleted file mode 100644
index efd06f08ad..0000000000
--- a/ext/standard/tests/strings/htmlentities07.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-htmlentities() test 7 (mbstring / ISO-8859-1)
---INI--
-output_handler=
---SKIPIF--
-<?php
- extension_loaded("mbstring") or die("skip mbstring not available\n");
- mb_internal_encoding('ISO-8859-1');
- $php_errormsg = NULL;
- @htmlentities("\xe4\xf6\xfc", ENT_QUOTES, '');
- if ($php_errormsg) {
- die("skip ISO-8859-1 chracter set is not supported on this platform.\n");
- }
-?>
---FILE--
-<?php
- mb_internal_encoding('ISO-8859-1');
- print mb_internal_encoding()."\n";
- var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, ''));
-?>
---EXPECT--
-ISO-8859-1
-string(18) "&auml;&ouml;&uuml;"
diff --git a/ext/standard/tests/strings/htmlentities08.phpt b/ext/standard/tests/strings/htmlentities08.phpt
deleted file mode 100644
index 0f8f912f27..0000000000
--- a/ext/standard/tests/strings/htmlentities08.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-htmlentities() test 8 (mbstring / EUC-JP)
---INI--
-output_handler=
---SKIPIF--
-<?php
- extension_loaded("mbstring") or die("skip mbstring not available\n");
- mb_internal_encoding('EUC-JP');
- $php_errormsg = NULL;
- @htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, '');
- if ($php_errormsg) {
- die("skip EUC-JP chracter set is not supported on this platform.\n");
- }
-?>
---FILE--
-<?php
- mb_internal_encoding('EUC-JP');
- print mb_internal_encoding()."\n";
- var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, ''));
-?>
---EXPECT--
-EUC-JP
-string(6) "¡¢¡£¡¤"
diff --git a/ext/standard/tests/strings/htmlentities09.phpt b/ext/standard/tests/strings/htmlentities09.phpt
deleted file mode 100644
index 4c6ef60c74..0000000000
--- a/ext/standard/tests/strings/htmlentities09.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-htmlentities() test 9 (mbstring / Shift_JIS)
---INI--
-output_handler=
---SKIPIF--
-<?php
- extension_loaded("mbstring") or die("skip mbstring not available\n");
- mb_internal_encoding('Shift_JIS');
- $php_errormsg = NULL;
- @htmlentities("\x81\x41\x81\x42\x81\x43", ENT_QUOTES, '');
- if ($php_errormsg) {
- die("skip Shift_JIS chracter set is not supported on this platform.\n");
- }
-?>
---FILE--
-<?php
- mb_internal_encoding('Shift_JIS');
- print mb_internal_encoding()."\n";
- var_dump(htmlentities("\x81\x41\x81\x42\x81\x43", ENT_QUOTES, ''));
-?>
---EXPECT--
-SJIS
-string(6) "ABC"
diff --git a/ext/standard/tests/strings/htmlentities10.phpt b/ext/standard/tests/strings/htmlentities10.phpt
deleted file mode 100644
index ee5099cf34..0000000000
--- a/ext/standard/tests/strings/htmlentities10.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-htmlentities() test 10 (default_charset / cp1252)
---INI--
-output_handler=
-mbstring.internal_encoding=pass
-default_charset=cp1252
---FILE--
-<?php
- print ini_get('default_charset')."\n";
- var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, ''));
- var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, ''));
-?>
---EXPECT--
-cp1252
-string(28) "&sbquo;&dagger;&trade;&Yuml;"
-string(32) "&euro;&cent;&pound;&curren;&yen;"
diff --git a/ext/standard/tests/strings/htmlentities11.phpt b/ext/standard/tests/strings/htmlentities11.phpt
deleted file mode 100644
index 62b6aec7c8..0000000000
--- a/ext/standard/tests/strings/htmlentities11.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-htmlentities() test 11 (default_charset / ISO-8859-15)
---INI--
-output_handler=
-mbstring.internal_encoding=pass
-default_charset=ISO-8859-15
---FILE--
-<?php
- print ini_get('default_charset')."\n";
- var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, ''));
-?>
---EXPECT--
-ISO-8859-15
-string(20) "&OElig;&oelig;&Yuml;"
diff --git a/ext/standard/tests/strings/htmlentities12.phpt b/ext/standard/tests/strings/htmlentities12.phpt
deleted file mode 100644
index 826706680d..0000000000
--- a/ext/standard/tests/strings/htmlentities12.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-htmlentities() test 12 (default_charset / ISO-8859-1)
---INI--
-output_handler=
-mbstring.internal_encoding=pass
-default_charset=ISO-8859-1
---FILE--
-<?php
- print ini_get('default_charset')."\n";
- var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, ''));
-?>
---EXPECT--
-ISO-8859-1
-string(18) "&auml;&ouml;&uuml;"
diff --git a/ext/standard/tests/strings/htmlentities13.phpt b/ext/standard/tests/strings/htmlentities13.phpt
deleted file mode 100644
index 2c559916e9..0000000000
--- a/ext/standard/tests/strings/htmlentities13.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-htmlentities() test 13 (default_charset / EUC-JP)
---INI--
-output_handler=
-mbstring.internal_encoding=pass
-default_charset=EUC-JP
---FILE--
-<?php
- print ini_get('default_charset')."\n";
- var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, ''));
-?>
---EXPECT--
-EUC-JP
-string(6) "¡¢¡£¡¤"
diff --git a/ext/standard/tests/strings/htmlentities14.phpt b/ext/standard/tests/strings/htmlentities14.phpt
deleted file mode 100644
index 9190d26515..0000000000
--- a/ext/standard/tests/strings/htmlentities14.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-htmlentities() test 14 (default_charset / Shift_JIS)
---INI--
-output_handler=
-mbstring.internal_encoding=pass
-default_charset=Shift_JIS
---FILE--
-<?php
- print ini_get('default_charset')."\n";
- var_dump(htmlentities("\x81\x41\x81\x42\x81\x43", ENT_QUOTES, ''));
-?>
---EXPECT--
-Shift_JIS
-string(6) "ABC"
diff --git a/ext/standard/tests/strings/htmlentities15.phpt b/ext/standard/tests/strings/htmlentities15.phpt
deleted file mode 100644
index a0e534aba0..0000000000
--- a/ext/standard/tests/strings/htmlentities15.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-htmlentities() test 15 (setlocale / KOI8-R)
---INI--
-output_handler=
-default_charset=
-mbstring.internal_encoding=none
---SKIPIF--
-<?php
-$result = (bool)setlocale(LC_CTYPE, "ru_RU.koi8r");
-if (!$result || preg_match('/koi8/i', setlocale(LC_CTYPE, 0)) == 0) {
- die("skip setlocale() failed\n");
-}
-?>
---FILE--
-<?php
-setlocale(LC_CTYPE, "ru_RU.koi8r");
-$str = "ÒÏÓËÏÛÎÙÊ";
-var_dump($str, htmlentities($str, ENT_QUOTES, ''));
-?>
---EXPECT--
-string(9) "ÒÏÓËÏÛÎÙÊ"
-string(63) "&#1088;&#1086;&#1089;&#1082;&#1086;&#1096;&#1085;&#1099;&#1081;"
diff --git a/ext/standard/tests/strings/htmlentities16.phpt b/ext/standard/tests/strings/htmlentities16.phpt
deleted file mode 100644
index 0f945280b5..0000000000
--- a/ext/standard/tests/strings/htmlentities16.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-htmlentities() test 16 (mbstring / cp1251)
---INI--
-output_handler=
---SKIPIF--
-<?php
- extension_loaded("mbstring") or die("skip mbstring not available\n");
- if (!@mb_internal_encoding('cp1251') ||
- @htmlentities("\x88\xa9\xd2\xcf\xd3\xcb\xcf\xdb\xce\xd9\xca", ENT_QUOTES, '') == '') {
- die("skip cp1251 character set is not available in this build.\n");
- }
-?>
---FILE--
-<?php
-mb_internal_encoding('cp1251');
-$str = "\x88\xa9\xf0\xee\xf1\xea\xee\xf8\xed\xfb\xe9";
-var_dump($str, htmlentities($str, ENT_QUOTES, ''));
-?>
---EXPECT--
-string(11) "ˆ©ðîñêîøíûé"
-string(75) "&euro;&copy;&#1088;&#1086;&#1089;&#1082;&#1086;&#1096;&#1085;&#1099;&#1081;"
diff --git a/ext/standard/tests/strings/implode.phpt b/ext/standard/tests/strings/implode.phpt
deleted file mode 100644
index 66d6c435ae..0000000000
--- a/ext/standard/tests/strings/implode.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-implode() function
---POST--
---GET--
---INI--
-error_reporting=2047
-log_errors=0
-display_errors=0
-track_errors=1
---FILE--
-<?php
-echo implode(array())."\n";
-echo implode('nothing', array())."\n";
-echo implode(array('foo', 'bar', 'baz'))."\n";
-echo implode(':', array('foo', 'bar', 'baz'))."\n";
-echo implode(':', array('foo', array('bar', 'baz'), 'burp'))."\n";
-echo $php_errormsg."\n";
-?>
---EXPECTF--
-
-
-foobarbaz
-foo:bar:baz
-foo:Array:burp
-Array to string conversion
diff --git a/ext/standard/tests/strings/md5.phpt b/ext/standard/tests/strings/md5.phpt
deleted file mode 100644
index 32dba03609..0000000000
--- a/ext/standard/tests/strings/md5.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-md5() with ASCII output
---FILE--
-<?php
-echo md5("")."\n";
-echo md5("a")."\n";
-echo md5("abc")."\n";
-echo md5("message digest")."\n";
-echo md5("abcdefghijklmnopqrstuvwxyz")."\n";
-echo md5("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")."\n";
-echo md5("12345678901234567890123456789012345678901234567890123456789012345678901234567890")."\n";
-?>
---EXPECT--
-d41d8cd98f00b204e9800998ecf8427e
-0cc175b9c0f1b6a831c399e269772661
-900150983cd24fb0d6963f7d28e17f72
-f96b697d7cb7938d525a2f31aaf161d0
-c3fcd3d76192e4007dfb496cca67e13b
-d174ab98d277d9f5a5611c2c9f419d9f
-57edf4a22be3c955ac49da2e2107b67a
diff --git a/ext/standard/tests/strings/md5raw.phpt b/ext/standard/tests/strings/md5raw.phpt
deleted file mode 100644
index 8f71ea6d0e..0000000000
--- a/ext/standard/tests/strings/md5raw.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-md5() with RAW output
---FILE--
-<?php
-echo bin2hex(md5("", TRUE))."\n";
-echo bin2hex(md5("a", TRUE))."\n";
-echo bin2hex(md5("abc", TRUE))."\n";
-echo bin2hex(md5("message digest", TRUE))."\n";
-echo bin2hex(md5("abcdefghijklmnopqrstuvwxyz", TRUE))."\n";
-echo bin2hex(md5("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", TRUE))."\n";
-echo bin2hex(md5("12345678901234567890123456789012345678901234567890123456789012345678901234567890", TRUE))."\n";
-?>
---EXPECT--
-d41d8cd98f00b204e9800998ecf8427e
-0cc175b9c0f1b6a831c399e269772661
-900150983cd24fb0d6963f7d28e17f72
-f96b697d7cb7938d525a2f31aaf161d0
-c3fcd3d76192e4007dfb496cca67e13b
-d174ab98d277d9f5a5611c2c9f419d9f
-57edf4a22be3c955ac49da2e2107b67a
diff --git a/ext/standard/tests/strings/nl2br.phpt b/ext/standard/tests/strings/nl2br.phpt
deleted file mode 100644
index 63801afb66..0000000000
--- a/ext/standard/tests/strings/nl2br.phpt
+++ /dev/null
@@ -1,62 +0,0 @@
---TEST--
-nl2br() function
---POST--
---GET--
---FILE--
-<?php
- var_dump(nl2br("test"));
- var_dump(nl2br(""));
- var_dump(nl2br(NULL));
- var_dump(nl2br("\r\n"));
- var_dump(nl2br("\n"));
- var_dump(nl2br("\r"));
- var_dump(nl2br("\n\r"));
-
- var_dump(nl2br("\n\r\r\n\r\r\r\r"));
- var_dump(nl2br("\n\r\n\n\r\n\r\r\n\r\n"));
- var_dump(nl2br("\n\r\n\n\n\n\r\r\r\r\n\r"));
-
-?>
---EXPECT--
-string(4) "test"
-string(0) ""
-string(0) ""
-string(8) "<br />
-"
-string(7) "<br />
-"
-string(7) "<br />
-"
-string(8) "<br />
-
-"
-string(44) "<br />
-
-<br />
-<br />
-<br />
-<br />
-<br />
-"
-string(47) "<br />
-
-<br />
-<br />
-
-<br />
-
-<br />
-<br />
-"
-string(66) "<br />
-
-<br />
-<br />
-<br />
-<br />
-
-<br />
-<br />
-<br />
-<br />
-"
diff --git a/ext/standard/tests/strings/sha1.phpt b/ext/standard/tests/strings/sha1.phpt
deleted file mode 100644
index c405eedde5..0000000000
--- a/ext/standard/tests/strings/sha1.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-sha1() with ASCII output
---FILE--
-<?php
-echo sha1("abc")."\n";
-echo sha1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")."\n";
-echo sha1("a")."\n";
-echo sha1("0123456701234567012345670123456701234567012345670123456701234567")."\n";
-?>
---EXPECT--
-a9993e364706816aba3e25717850c26c9cd0d89d
-84983e441c3bd26ebaae4aa1f95129e5e54670f1
-86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
-e0c094e867ef46c350ef54a7f59dd60bed92ae83
diff --git a/ext/standard/tests/strings/sha1raw.phpt b/ext/standard/tests/strings/sha1raw.phpt
deleted file mode 100644
index 6777cab3ee..0000000000
--- a/ext/standard/tests/strings/sha1raw.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-sha1() with RAW output
---FILE--
-<?php
-echo bin2hex(sha1("abc", TRUE))."\n";
-echo bin2hex(sha1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", TRUE))."\n";
-echo bin2hex(sha1("a", TRUE))."\n";
-echo bin2hex(sha1("0123456701234567012345670123456701234567012345670123456701234567", TRUE))."\n";
-?>
---EXPECT--
-a9993e364706816aba3e25717850c26c9cd0d89d
-84983e441c3bd26ebaae4aa1f95129e5e54670f1
-86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
-e0c094e867ef46c350ef54a7f59dd60bed92ae83
diff --git a/ext/standard/tests/strings/str_repeat.phpt b/ext/standard/tests/strings/str_repeat.phpt
deleted file mode 100644
index 406e811af7..0000000000
--- a/ext/standard/tests/strings/str_repeat.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-str_repeat() function
---POST--
---GET--
---FILE--
-<?php
-$input = array('a', 'foo', 'barbazbax');
-foreach($input AS $i) {
- for($n=0; $n<5; $n++) {
- echo str_repeat($i, $n)."\n";
- }
-}
-?>
---EXPECT--
-
-a
-aa
-aaa
-aaaa
-
-foo
-foofoo
-foofoofoo
-foofoofoofoo
-
-barbazbax
-barbazbaxbarbazbax
-barbazbaxbarbazbaxbarbazbax
-barbazbaxbarbazbaxbarbazbaxbarbazbax
diff --git a/ext/standard/tests/strings/str_shuffle.phpt b/ext/standard/tests/strings/str_shuffle.phpt
deleted file mode 100644
index cf6a07304b..0000000000
--- a/ext/standard/tests/strings/str_shuffle.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Testing str_shuffle.
---FILE--
-<?php
-/* Do not change this test it is a REATME.TESTING example. */
-$s = '123';
-var_dump(str_shuffle($s));
-var_dump($s);
-?>
---EXPECTF--
-string(3) %s
-string(3) "123" \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn.phpt b/ext/standard/tests/strings/strcspn.phpt
deleted file mode 100644
index 88bcee5c19..0000000000
--- a/ext/standard/tests/strings/strcspn.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Test strcspn() behavior
---FILE--
-<?php
-$a = "22222222aaaa bbb1111 cccc";
-$b = "1234";
-var_dump($a);
-var_dump($b);
-var_dump(strcspn($a,$b));
-var_dump(strcspn($a,$b,9));
-var_dump(strcspn($a,$b,9,6));
-?>
---EXPECT--
-string(25) "22222222aaaa bbb1111 cccc"
-string(4) "1234"
-int(0)
-int(7)
-int(6)
diff --git a/ext/standard/tests/strings/strings001.phpt b/ext/standard/tests/strings/strings001.phpt
deleted file mode 100644
index 87f8489b8a..0000000000
--- a/ext/standard/tests/strings/strings001.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Test whether strstr() and strrchr() are binary safe.
---FILE--
-<?php
-/* Do not change this test it is a README.TESTING example. */
-$s = "alabala nica".chr(0)."turska panica";
-var_dump(strstr($s, "nic"));
-var_dump(strrchr($s," nic"));
-?>
---EXPECTREGEX--
-string\(18\) \"nica\x00turska panica\"
-string\(19\) \" nica\x00turska panica\"
diff --git a/ext/standard/tests/strings/strip_tags.phpt b/ext/standard/tests/strings/strip_tags.phpt
deleted file mode 100644
index 9c55bc6465..0000000000
--- a/ext/standard/tests/strings/strip_tags.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-strip_tags() function
---POST--
---GET--
---FILE--
-<?php
- echo strip_tags('NEAT <? cool < blah ?> STUFF');
- echo "\n";
- echo strip_tags('NEAT <? cool > blah ?> STUFF');
- echo "\n";
- echo strip_tags('NEAT <!-- cool < blah --> STUFF');
- echo "\n";
- echo strip_tags('NEAT <!-- cool > blah --> STUFF');
- echo "\n";
- echo strip_tags('NEAT <? echo \"\\\"\"?> STUFF');
- echo "\n";
- echo strip_tags('NEAT <? echo \'\\\'\'?> STUFF');
- echo "\n";
- echo strip_tags('TESTS ?!!?!?!!!?!!');
- echo "\n";
-?>
---EXPECT--
-NEAT STUFF
-NEAT STUFF
-NEAT STUFF
-NEAT STUFF
-NEAT STUFF
-NEAT STUFF
-TESTS ?!!?!?!!!?!!
diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt
deleted file mode 100644
index 7a9af70940..0000000000
--- a/ext/standard/tests/strings/strpos.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-strpos() function
---POST--
---GET--
---FILE--
-<?php
- var_dump(strpos("test string", "test"));
- var_dump(strpos("test string", "string"));
- var_dump(strpos("test string", "strin"));
- var_dump(strpos("test string", "t s"));
- var_dump(strpos("test string", "g"));
- var_dump(strpos("te".chr(0)."st", chr(0)));
- var_dump(strpos("tEst", "test"));
- var_dump(strpos("teSt", "test"));
- var_dump(@strpos("", ""));
- var_dump(@strpos("a", ""));
- var_dump(@strpos("", "a"));
- var_dump(@strpos("\\\\a", "\\a"));
-?>
---EXPECT--
-int(0)
-int(5)
-int(5)
-int(3)
-int(10)
-int(2)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-int(1)
diff --git a/ext/standard/tests/strings/strrev.phpt b/ext/standard/tests/strings/strrev.phpt
deleted file mode 100644
index 6eb892b135..0000000000
--- a/ext/standard/tests/strings/strrev.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-strrev() function
---POST--
---GET--
---FILE--
-<?php
- $i = 0;
- $str = '';
-
- while ($i<256) {
- $str .= chr($i++);
- }
-
- var_dump(md5(strrev($str)));
- var_dump(strrev(NULL));
- var_dump(strrev(""));
-?>
---EXPECT--
-string(32) "ec6df70f2569891eae50321a9179eb82"
-string(0) ""
-string(0) ""
diff --git a/ext/standard/tests/strings/strripos.phpt b/ext/standard/tests/strings/strripos.phpt
deleted file mode 100644
index c9c6eae7e3..0000000000
--- a/ext/standard/tests/strings/strripos.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-strripos() function
---POST--
---GET--
---FILE--
-<?php
- var_dump(strripos("test test string", "test"));
- var_dump(strripos("test string sTring", "string"));
- var_dump(strripos("test strip string strand", "str"));
- var_dump(strripos("I am what I am and that's all what I am", "am", -3));
- var_dump(strripos("test string", "g"));
- var_dump(strripos("te".chr(0)."st", chr(0)));
- var_dump(strripos("tEst", "test"));
- var_dump(strripos("teSt", "test"));
- var_dump(@strripos("foo", "f", 1));
- var_dump(@strripos("", ""));
- var_dump(@strripos("a", ""));
- var_dump(@strripos("", "a"));
- var_dump(@strripos("\\\\a", "\\a"));
-?>
---EXPECT--
-int(5)
-int(12)
-int(18)
-int(12)
-int(10)
-int(2)
-int(0)
-int(0)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-int(1)
-
diff --git a/ext/standard/tests/strings/strrpos.phpt b/ext/standard/tests/strings/strrpos.phpt
deleted file mode 100644
index 0d4337605a..0000000000
--- a/ext/standard/tests/strings/strrpos.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-strrpos() function
---POST--
---GET--
---FILE--
-<?php
- var_dump(strrpos("test test string", "test"));
- var_dump(strrpos("test string sTring", "string"));
- var_dump(strrpos("test strip string strand", "str"));
- var_dump(strrpos("I am what I am and that's all what I am", "am", -3));
- var_dump(strrpos("test string", "g"));
- var_dump(strrpos("te".chr(0)."st", chr(0)));
- var_dump(strrpos("tEst", "test"));
- var_dump(strrpos("teSt", "test"));
- var_dump(@strrpos("foo", "f", 1));
- var_dump(@strrpos("", ""));
- var_dump(@strrpos("a", ""));
- var_dump(@strrpos("", "a"));
- var_dump(@strrpos("\\\\a", "\\a"));
-?>
---EXPECT--
-int(5)
-int(5)
-int(18)
-int(12)
-int(10)
-int(2)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-int(1)
diff --git a/ext/standard/tests/strings/strspn.phpt b/ext/standard/tests/strings/strspn.phpt
deleted file mode 100644
index 9f498b84d6..0000000000
--- a/ext/standard/tests/strings/strspn.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Test strspn() behavior
---FILE--
-<?php
-$a = "22222222aaaa bbb1111 cccc";
-$b = "1234";
-var_dump($a);
-var_dump($b);
-var_dump(strspn($a,$b));
-var_dump(strspn($a,$b,2));
-var_dump(strspn($a,$b,2,3));
-?>
---EXPECT--
-string(25) "22222222aaaa bbb1111 cccc"
-string(4) "1234"
-int(8)
-int(6)
-int(3)
diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt
deleted file mode 100644
index 29cd30a2a9..0000000000
--- a/ext/standard/tests/strings/strstr.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-strstr() function
---POST--
---GET--
---FILE--
-<?php
- var_dump(strstr("test string", "test"));
- var_dump(strstr("test string", "string"));
- var_dump(strstr("test string", "strin"));
- var_dump(strstr("test string", "t s"));
- var_dump(strstr("test string", "g"));
- var_dump(md5(strstr("te".chr(0)."st", chr(0))));
- var_dump(strstr("tEst", "test"));
- var_dump(strstr("teSt", "test"));
- var_dump(@strstr("", ""));
- var_dump(@strstr("a", ""));
- var_dump(@strstr("", "a"));
- var_dump(md5(@strstr("\\\\a\\", "\\a")));
-?>
---EXPECT--
-string(11) "test string"
-string(6) "string"
-string(6) "string"
-string(8) "t string"
-string(1) "g"
-string(32) "7272696018bdeb2c9a3f8d01fc2a9273"
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-string(32) "6ec19f52f0766c463f3bb240f4396913"
diff --git a/ext/standard/tests/strings/strtoupper.phpt b/ext/standard/tests/strings/strtoupper.phpt
deleted file mode 100644
index 41bc5e6080..0000000000
--- a/ext/standard/tests/strings/strtoupper.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Test strtoupper on non-ASCII characters
---SKIPIF--
-<?php
-if (!setlocale(LC_CTYPE, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1")) {
- die("skip locale needed for this test is not supported on this platform");
-}
-?>
---FILE--
-<?php
-$chars = "äöü";
-// Not sure which is most portable. BSD's answer to
-// this one. A small array based on PHP_OS should
-// cover a majority of systems and makes the problem
-// of locales transparent for the end user.
-setlocale(LC_CTYPE, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1");
-echo strtoupper($chars)."\n";
-?>
---EXPECT--
-ÄÖÜ
diff --git a/ext/standard/tests/strings/strtr.phpt b/ext/standard/tests/strings/strtr.phpt
deleted file mode 100644
index 7d9bd31d14..0000000000
--- a/ext/standard/tests/strings/strtr.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-strtr() function
---FILE--
-<?php
-/* Do not change this test it is a REATME.TESTING example. */
-$trans = array("hello"=>"hi", "hi"=>"hello", "a"=>"A", "world"=>"planet");
-var_dump(strtr("# hi all, I said hello world! #", $trans));
-?>
---EXPECT--
-string(32) "# hello All, I sAid hi planet! #" \ No newline at end of file
diff --git a/ext/standard/tests/strings/substr_count.phpt b/ext/standard/tests/strings/substr_count.phpt
deleted file mode 100644
index 29f43dfae2..0000000000
--- a/ext/standard/tests/strings/substr_count.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-substr_count() function
---POST--
---GET--
---FILE--
-<?php
- var_dump(@substr_count("", ""));
- var_dump(@substr_count("a", ""));
- var_dump(@substr_count("", "a"));
- var_dump(@substr_count("", "a"));
- var_dump(@substr_count("", chr(0)));
-
- $a = str_repeat("abcacba", 100);
- var_dump(@substr_count($a, "bca"));
-
- $a = str_repeat("abcacbabca", 100);
- var_dump(@substr_count($a, "bca"));
-?>
---EXPECT--
-bool(false)
-bool(false)
-int(0)
-int(0)
-int(0)
-int(100)
-int(200)
diff --git a/ext/standard/tests/strings/substr_replace.phpt b/ext/standard/tests/strings/substr_replace.phpt
deleted file mode 100644
index ada02eb83f..0000000000
--- a/ext/standard/tests/strings/substr_replace.phpt
+++ /dev/null
@@ -1,812 +0,0 @@
---TEST--
-substr_replace() function
---POST--
---GET--
---FILE--
-<?php
-$str = "try this";
-$repl = "bala ";
-$start = 2;
-echo "\n";
-
-
-echo "substr_replace('$str', '$repl', $start)\n";
-var_dump(substr_replace($str, $repl, $start));
-echo "\n";
-
-$len = 3;
-echo "substr_replace('$str', '$repl', $start, $len)\n";
-var_dump(substr_replace($str, $repl, $start, $len));
-echo "\n";
-
-$len = 0;
-echo "substr_replace('$str', '$repl', $start, $len)\n";
-var_dump(substr_replace($str, $repl, $start, $len));
-echo "\n";
-
-$len = -2;
-echo "substr_replace('$str', '$repl', $start, $len)\n";
-var_dump(substr_replace($str, $repl, $start, $len));
-echo "\n";
-echo "\n";
-echo "\n";
-
-
-$str = "try this";
-$repl = array("bala ");
-$start = 4;
-$len = 3;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1)."")."\n";
-var_dump(substr_replace($str, $repl, $start))."\n";
-echo "\n";
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1)."")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-echo "\n";
-echo "\n";
-echo "\n";
-
-
-
-$str = array("ala portokala");
-$repl = array("bala ");
-$start = array(4);
-$len = array(3);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1)."")."\n";
-var_dump(substr_replace($str, $repl, $start))."\n";
-echo "\n";
-
-$len = array(3);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-$len = array(0);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-$len = array(-2);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-echo "\n";
-
-
-
-
-$str = array("ala portokala");
-$repl = "bala ";
-$start = 4;
-$len = 3;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start))."\n";
-echo "\n";
-echo "\n";
-
-
-
-$str = array("ala portokala", "try this");
-$repl = array("bala ");
-$start = 4;
-$len = 3;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = "bala ";
-$start = 4;
-$len = 3;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = array("bala ");
-$start = 4;
-$len = 0;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = "bala ";
-$start = 4;
-$len = 0;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-$str = array("ala portokala", "try this");
-$repl = array("bala ");
-$start = 4;
-$len = -2;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = "bala ";
-$start = 4;
-$len = -2;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-echo "\n";
-echo "\n";
-echo "\n";
-echo "\n";
-
-
-
-
-$str = array("ala portokala");
-$repl = "bala ";
-$start = array(4);
-$len = 3;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start))."\n";
-echo "\n";
-echo "\n";
-
-
-
-$str = array("ala portokala", "try this");
-$repl = array("bala ");
-$start = array(4);
-$len = 3;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = "bala ";
-$start = array(4);
-$len = 3;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = array("bala ");
-$start = array(4);
-$len = 0;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = "bala ";
-$start = array(4);
-$len = 0;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-$str = array("ala portokala", "try this");
-$repl = array("bala ");
-$start = array(4);
-$len = -2;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = "bala ";
-$start = array(4);
-$len = -2;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-
-echo "\n";
-echo "\n";
-echo "\n";
-echo "\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala");
-$repl = "bala ";
-$start = array(4,2);
-$len = 3;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start))."\n";
-echo "\n";
-echo "\n";
-
-
-
-$str = array("ala portokala", "try this");
-$repl = array("bala ");
-$start = array(4,2);
-$len = 3;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = "bala ";
-$start = array(4,2);
-$len = 3;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = array("bala ");
-$start = array(4,2);
-$len = 0;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = "bala ";
-$start = array(4,2);
-$len = 0;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-$str = array("ala portokala", "try this");
-$repl = array("bala ");
-$start = array(4,2);
-$len = -2;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = "bala ";
-$start = array(4,2);
-$len = -2;
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-
-
-echo "\n";
-echo "\n";
-echo "\n";
-echo "\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala");
-$repl = "bala ";
-$start = array(4,2);
-$len = array(3);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start))."\n";
-echo "\n";
-echo "\n";
-
-
-
-$str = array("ala portokala", "try this");
-$repl = array("bala ");
-$start = array(4,2);
-$len = array(3);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = "bala ";
-$start = array(4,2);
-$len = array(3);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = array("bala ");
-$start = array(4,2);
-$len = array(0);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = "bala ";
-$start = array(4,2);
-$len = array(0);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-$str = array("ala portokala", "try this");
-$repl = array("bala ");
-$start = array(4,2);
-$len = array(-2);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = "bala ";
-$start = array(4,2);
-$len = array(-2);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-
-echo "\n";
-echo "\n";
-echo "\n";
-echo "\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala");
-$repl = "bala ";
-$start = array(4,2);
-$len = array(3,2);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start))."\n";
-echo "\n";
-echo "\n";
-
-
-
-$str = array("ala portokala", "try this");
-$repl = array("bala ");
-$start = array(4,2);
-$len = array(3,2);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = "bala ";
-$start = array(4,2);
-$len = array(3,2);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = array("bala ");
-$start = array(4,2);
-$len = array(0,0);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = "bala ";
-$start = array(4,2);
-$len = array(0,0);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-$str = array("ala portokala", "try this");
-$repl = array("bala ");
-$start = array(4,2);
-$len = array(-2,-3);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-echo "\n";
-
-
-$str = array("ala portokala", "try this");
-$repl = "bala ";
-$start = array(4,2);
-$len = array(-2,-3);
-echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
-var_dump(substr_replace($str, $repl, $start, $len))."\n";
-echo "\n";
-
-
-
-
-?>
---EXPECT--
-substr_replace('try this', 'bala ', 2)
-string(7) "trbala "
-
-substr_replace('try this', 'bala ', 2, 3)
-string(10) "trbala his"
-
-substr_replace('try this', 'bala ', 2, 0)
-string(13) "trbala y this"
-
-substr_replace('try this', 'bala ', 2, -2)
-string(9) "trbala is"
-
-
-
-substr_replace('try this', array ( 0 => 'bala ',), 4
-string(9) "try bala "
-
-substr_replace('try this', array ( 0 => 'bala ',), 4
-string(10) "try bala s"
-
-
-
-
-substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,)
-array(1) {
- [0]=>
- string(9) "ala bala "
-}
-
-substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,), array ( 0 => 3,))
-array(1) {
- [0]=>
- string(15) "ala bala tokala"
-}
-
-substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,), array ( 0 => 0,))
-array(1) {
- [0]=>
- string(18) "ala bala portokala"
-}
-
-substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,), array ( 0 => -2,))
-array(1) {
- [0]=>
- string(11) "ala bala la"
-}
-
-
-
-substr_replace(array ( 0 => 'ala portokala',), 'bala ',4)
-array(1) {
- [0]=>
- string(9) "ala bala "
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),4, 3)
-array(2) {
- [0]=>
- string(15) "ala bala tokala"
- [1]=>
- string(5) "try s"
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',4, 3)
-array(2) {
- [0]=>
- string(15) "ala bala tokala"
- [1]=>
- string(10) "try bala s"
-}
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),4, 0)
-array(2) {
- [0]=>
- string(18) "ala bala portokala"
- [1]=>
- string(8) "try this"
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',4, 0)
-array(2) {
- [0]=>
- string(18) "ala bala portokala"
- [1]=>
- string(13) "try bala this"
-}
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),4, -2)
-array(2) {
- [0]=>
- string(11) "ala bala la"
- [1]=>
- string(6) "try is"
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',4, -2)
-array(2) {
- [0]=>
- string(11) "ala bala la"
- [1]=>
- string(11) "try bala is"
-}
-
-
-
-
-
-
-substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4,))
-array(1) {
- [0]=>
- string(9) "ala bala "
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4,), 3)
-array(2) {
- [0]=>
- string(15) "ala bala tokala"
- [1]=>
- string(5) " this"
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4,), 3)
-array(2) {
- [0]=>
- string(15) "ala bala tokala"
- [1]=>
- string(10) "bala this"
-}
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4,), 0)
-array(2) {
- [0]=>
- string(18) "ala bala portokala"
- [1]=>
- string(8) "try this"
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4,), 0)
-array(2) {
- [0]=>
- string(18) "ala bala portokala"
- [1]=>
- string(13) "bala try this"
-}
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4,), -2)
-array(2) {
- [0]=>
- string(11) "ala bala la"
- [1]=>
- string(2) "is"
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4,), -2)
-array(2) {
- [0]=>
- string(11) "ala bala la"
- [1]=>
- string(7) "bala is"
-}
-
-
-
-
-
-
-
-substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4, 1 => 2,))
-array(1) {
- [0]=>
- string(9) "ala bala "
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), 3)
-array(2) {
- [0]=>
- string(15) "ala bala tokala"
- [1]=>
- string(5) "trhis"
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), 3)
-array(2) {
- [0]=>
- string(15) "ala bala tokala"
- [1]=>
- string(10) "trbala his"
-}
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), 0)
-array(2) {
- [0]=>
- string(18) "ala bala portokala"
- [1]=>
- string(8) "try this"
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), 0)
-array(2) {
- [0]=>
- string(18) "ala bala portokala"
- [1]=>
- string(13) "trbala y this"
-}
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), -2)
-array(2) {
- [0]=>
- string(11) "ala bala la"
- [1]=>
- string(4) "tris"
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), -2)
-array(2) {
- [0]=>
- string(11) "ala bala la"
- [1]=>
- string(9) "trbala is"
-}
-
-
-
-
-
-
-
-substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4, 1 => 2,))
-array(1) {
- [0]=>
- string(9) "ala bala "
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 3,))
-array(2) {
- [0]=>
- string(15) "ala bala tokala"
- [1]=>
- string(2) "tr"
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 3,))
-array(2) {
- [0]=>
- string(15) "ala bala tokala"
- [1]=>
- string(7) "trbala "
-}
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 0,))
-array(2) {
- [0]=>
- string(18) "ala bala portokala"
- [1]=>
- string(2) "tr"
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 0,))
-array(2) {
- [0]=>
- string(18) "ala bala portokala"
- [1]=>
- string(7) "trbala "
-}
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => -2,))
-array(2) {
- [0]=>
- string(11) "ala bala la"
- [1]=>
- string(2) "tr"
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => -2,))
-array(2) {
- [0]=>
- string(11) "ala bala la"
- [1]=>
- string(7) "trbala "
-}
-
-
-
-
-
-
-
-substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4, 1 => 2,))
-array(1) {
- [0]=>
- string(9) "ala bala "
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 3, 1 => 2,))
-array(2) {
- [0]=>
- string(15) "ala bala tokala"
- [1]=>
- string(6) "trthis"
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 3, 1 => 2,))
-array(2) {
- [0]=>
- string(15) "ala bala tokala"
- [1]=>
- string(11) "trbala this"
-}
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 0, 1 => 0,))
-array(2) {
- [0]=>
- string(18) "ala bala portokala"
- [1]=>
- string(8) "try this"
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 0, 1 => 0,))
-array(2) {
- [0]=>
- string(18) "ala bala portokala"
- [1]=>
- string(13) "trbala y this"
-}
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => -2, 1 => -3,))
-array(2) {
- [0]=>
- string(11) "ala bala la"
- [1]=>
- string(5) "trhis"
-}
-
-
-substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => -2, 1 => -3,))
-array(2) {
- [0]=>
- string(11) "ala bala la"
- [1]=>
- string(10) "trbala his"
-}
-
diff --git a/ext/standard/tests/strings/trim.phpt b/ext/standard/tests/strings/trim.phpt
deleted file mode 100644
index 881064d7e4..0000000000
--- a/ext/standard/tests/strings/trim.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-trim(), rtrim() and ltrim() functions
---POST--
---GET--
---FILE--
-<?php
-
-$tests = <<<TESTS
-'ABC' === trim('ABC')
-'ABC' === ltrim('ABC')
-'ABC' === rtrim('ABC')
-'ABC' === trim(" \\0\\t\\nABC \\0\\t\\n")
-"ABC \\0\\t\\n" === ltrim(" \\0\\t\\nABC \\0\\t\\n")
-" \\0\\t\\nABC" === rtrim(" \\0\\t\\nABC \\0\\t\\n")
-" \\0\\t\\nABC \\0\\t\\n" === trim(" \\0\\t\\nABC \\0\\t\\n",'')
-" \\0\\t\\nABC \\0\\t\\n" === ltrim(" \\0\\t\\nABC \\0\\t\\n",'')
-" \\0\\t\\nABC \\0\\t\\n" === rtrim(" \\0\\t\\nABC \\0\\t\\n",'')
-"ABC\\x50\\xC1" === trim("ABC\\x50\\xC1\\x60\\x90","\\x51..\\xC0")
-"ABC\\x50" === trim("ABC\\x50\\xC1\\x60\\x90","\\x51..\\xC1")
-"ABC" === trim("ABC\\x50\\xC1\\x60\\x90","\\x50..\\xC1")
-"ABC\\x50\\xC1" === trim("ABC\\x50\\xC1\\x60\\x90","\\x51..\\xC0")
-"ABC\\x50" === trim("ABC\\x50\\xC1\\x60\\x90","\\x51..\\xC1")
-"ABC" === trim("ABC\\x50\\xC1\\x60\\x90","\\x50..\\xC1")
-TESTS;
-
-include('tests/quicktester.inc');
-
---EXPECT--
-OK
diff --git a/ext/standard/tests/strings/url_t.phpt b/ext/standard/tests/strings/url_t.phpt
deleted file mode 100644
index 78a6706f54..0000000000
--- a/ext/standard/tests/strings/url_t.phpt
+++ /dev/null
@@ -1,618 +0,0 @@
---TEST--
-parse_url() function
---POST--
---GET--
---FILE--
-<?php
-$sample_urls = array (
-'',
-'64.246.30.37',
-'http://64.246.30.37',
-'http://64.246.30.37/',
-'64.246.30.37/',
-'64.246.30.37:80/',
-'php.net',
-'php.net/',
-'http://php.net',
-'http://php.net/',
-'www.php.net',
-'www.php.net/',
-'http://www.php.net',
-'http://www.php.net/',
-'www.php.net:80',
-'http://www.php.net:80',
-'http://www.php.net:80/',
-'http://www.php.net/index.php',
-'www.php.net/?',
-'www.php.net:80/?',
-'http://www.php.net/?',
-'http://www.php.net:80/?',
-'http://www.php.net:80/index.php',
-'http://www.php.net:80/foo/bar/index.php',
-'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php',
-'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5',
-'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/',
-'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php',
-'http://www.php.net:80/this/../a/../deep/directory',
-'http://www.php.net:80/this/../a/../deep/directory/',
-'http://www.php.net:80/this/is/a/very/deep/directory/../file.php',
-'http://www.php.net:80/index.php',
-'http://www.php.net:80/index.php?',
-'http://www.php.net:80/#foo',
-'http://www.php.net:80/?#',
-'http://www.php.net:80/?test=1',
-'http://www.php.net/?test=1&',
-'http://www.php.net:80/?&',
-'http://www.php.net:80/index.php?test=1&',
-'http://www.php.net/index.php?&',
-'http://www.php.net:80/index.php?foo&',
-'http://www.php.net/index.php?&foo',
-'http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI',
-'www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
-'http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
-'http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
-'http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
-'http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
-'http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
-'http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
-'nntp://news.php.net',
-'ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz',
-'zlib:http://foo@bar',
-'zlib:filename.txt',
-'zlib:/path/to/my/file/file.txt',
-'foo://foo@bar',
-'mailto:me@mydomain.com',
-'/foo.php?a=b&c=d',
-'foo.php?a=b&c=d',
-'http://user:passwd@www.example.com:8080?bar=1&boom=0'
-);
-
- foreach ($sample_urls as $url) {
- var_dump(@parse_url($url));
- }
-?>
---EXPECT--
-array(1) {
- ["path"]=>
- string(0) ""
-}
-array(1) {
- ["path"]=>
- string(12) "64.246.30.37"
-}
-array(2) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(12) "64.246.30.37"
-}
-array(3) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(12) "64.246.30.37"
- ["path"]=>
- string(1) "/"
-}
-array(1) {
- ["path"]=>
- string(13) "64.246.30.37/"
-}
-array(3) {
- ["host"]=>
- string(12) "64.246.30.37"
- ["port"]=>
- int(80)
- ["path"]=>
- string(1) "/"
-}
-array(1) {
- ["path"]=>
- string(7) "php.net"
-}
-array(1) {
- ["path"]=>
- string(8) "php.net/"
-}
-array(2) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(7) "php.net"
-}
-array(3) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(7) "php.net"
- ["path"]=>
- string(1) "/"
-}
-array(1) {
- ["path"]=>
- string(11) "www.php.net"
-}
-array(1) {
- ["path"]=>
- string(12) "www.php.net/"
-}
-array(2) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
-}
-array(3) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["path"]=>
- string(1) "/"
-}
-array(2) {
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
-}
-array(3) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(1) "/"
-}
-array(3) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["path"]=>
- string(10) "/index.php"
-}
-array(1) {
- ["path"]=>
- string(12) "www.php.net/"
-}
-array(3) {
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(1) "/"
-}
-array(3) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["path"]=>
- string(1) "/"
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(1) "/"
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(10) "/index.php"
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(18) "/foo/bar/index.php"
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
-}
-array(5) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
- ["query"]=>
- string(37) "lots=1&of=2&parameters=3&too=4&here=5"
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(45) "/this/is/a/very/deep/directory/structure/and/"
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(28) "/this/../a/../deep/directory"
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(29) "/this/../a/../deep/directory/"
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(42) "/this/is/a/very/deep/directory/../file.php"
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(10) "/index.php"
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(10) "/index.php"
-}
-array(5) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(1) "/"
- ["fragment"]=>
- string(3) "foo"
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(1) "/"
-}
-array(5) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(1) "/"
- ["query"]=>
- string(6) "test=1"
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["path"]=>
- string(1) "/"
- ["query"]=>
- string(7) "test=1&"
-}
-array(5) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(1) "/"
- ["query"]=>
- string(1) "&"
-}
-array(5) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(10) "/index.php"
- ["query"]=>
- string(7) "test=1&"
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["path"]=>
- string(10) "/index.php"
- ["query"]=>
- string(1) "&"
-}
-array(5) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(10) "/index.php"
- ["query"]=>
- string(4) "foo&"
-}
-array(4) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["path"]=>
- string(10) "/index.php"
- ["query"]=>
- string(4) "&foo"
-}
-array(5) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(10) "/index.php"
- ["query"]=>
- string(31) "test=1&test2=char&test3=mixesCI"
-}
-array(5) {
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["path"]=>
- string(10) "/index.php"
- ["query"]=>
- string(31) "test=1&test2=char&test3=mixesCI"
- ["fragment"]=>
- string(16) "some_page_ref123"
-}
-array(7) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["user"]=>
- string(6) "secret"
- ["path"]=>
- string(10) "/index.php"
- ["query"]=>
- string(31) "test=1&test2=char&test3=mixesCI"
- ["fragment"]=>
- string(16) "some_page_ref123"
-}
-array(6) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["user"]=>
- string(6) "secret"
- ["path"]=>
- string(10) "/index.php"
- ["query"]=>
- string(31) "test=1&test2=char&test3=mixesCI"
- ["fragment"]=>
- string(16) "some_page_ref123"
-}
-array(7) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["pass"]=>
- string(7) "hideout"
- ["path"]=>
- string(10) "/index.php"
- ["query"]=>
- string(31) "test=1&test2=char&test3=mixesCI"
- ["fragment"]=>
- string(16) "some_page_ref123"
-}
-array(7) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["user"]=>
- string(6) "secret"
- ["pass"]=>
- string(7) "hideout"
- ["path"]=>
- string(10) "/index.php"
- ["query"]=>
- string(31) "test=1&test2=char&test3=mixesCI"
- ["fragment"]=>
- string(16) "some_page_ref123"
-}
-array(7) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(19) "hideout@www.php.net"
- ["port"]=>
- int(80)
- ["user"]=>
- string(6) "secret"
- ["path"]=>
- string(10) "/index.php"
- ["query"]=>
- string(31) "test=1&test2=char&test3=mixesCI"
- ["fragment"]=>
- string(16) "some_page_ref123"
-}
-array(8) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(11) "www.php.net"
- ["port"]=>
- int(80)
- ["user"]=>
- string(6) "secret"
- ["pass"]=>
- string(7) "hid:out"
- ["path"]=>
- string(10) "/index.php"
- ["query"]=>
- string(31) "test=1&test2=char&test3=mixesCI"
- ["fragment"]=>
- string(16) "some_page_ref123"
-}
-array(2) {
- ["scheme"]=>
- string(4) "nntp"
- ["host"]=>
- string(12) "news.php.net"
-}
-array(3) {
- ["scheme"]=>
- string(3) "ftp"
- ["host"]=>
- string(11) "ftp.gnu.org"
- ["path"]=>
- string(22) "/gnu/glic/glibc.tar.gz"
-}
-array(2) {
- ["scheme"]=>
- string(4) "zlib"
- ["path"]=>
- string(14) "http://foo@bar"
-}
-array(2) {
- ["scheme"]=>
- string(4) "zlib"
- ["path"]=>
- string(12) "filename.txt"
-}
-array(2) {
- ["scheme"]=>
- string(4) "zlib"
- ["path"]=>
- string(25) "/path/to/my/file/file.txt"
-}
-array(3) {
- ["scheme"]=>
- string(3) "foo"
- ["host"]=>
- string(3) "bar"
- ["user"]=>
- string(3) "foo"
-}
-array(2) {
- ["scheme"]=>
- string(6) "mailto"
- ["path"]=>
- string(15) "me@mydomain.com"
-}
-array(2) {
- ["path"]=>
- string(8) "/foo.php"
- ["query"]=>
- string(7) "a=b&c=d"
-}
-array(2) {
- ["path"]=>
- string(7) "foo.php"
- ["query"]=>
- string(7) "a=b&c=d"
-}
-array(6) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(15) "www.example.com"
- ["port"]=>
- int(8080)
- ["user"]=>
- string(4) "user"
- ["pass"]=>
- string(6) "passwd"
- ["query"]=>
- string(12) "bar=1&boom=0"
-}
diff --git a/ext/standard/tests/strings/wordwrap.phpt b/ext/standard/tests/strings/wordwrap.phpt
deleted file mode 100644
index 3fc8f1d880..0000000000
--- a/ext/standard/tests/strings/wordwrap.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-wordwrap() function
---POST--
---GET--
---FILE--
-<?php
-
-$tests = <<<TESTS
-"12345 12345 12345 12345" === wordwrap("12345 12345 12345 12345")
-"12345 12345\\n1234567890\\n1234567890" === wordwrap("12345 12345 1234567890 1234567890",12)
-"12345\\n12345\\n12345\\n12345" === wordwrap("12345 12345 12345 12345",0)
-"12345ab12345ab12345ab12345" === wordwrap("12345 12345 12345 12345",0,"ab")
-"12345 12345ab1234567890ab1234567890" === wordwrap("12345 12345 1234567890 1234567890",12,"ab")
-"123ab123ab123" === wordwrap("123ab123ab123", 3, "ab")
-"123ab123ab123" === wordwrap("123ab123ab123", 5, "ab")
-"123ab 123ab123" === wordwrap("123 123ab123", 3, "ab")
-"123ab123ab123" === wordwrap("123 123ab123", 5, "ab")
-"123 123ab123" === wordwrap("123 123 123", 10, "ab")
-
-"123ab123ab123" === wordwrap("123ab123ab123", 3, "ab", 1)
-"123ab123ab123" === wordwrap("123ab123ab123", 5, "ab", 1)
-"123ab 12ab3ab123" === wordwrap("123 123ab123", 3, "ab", 1)
-"123 ab123ab123" === wordwrap("123 123ab123", 5, "ab", 1)
-"123 123ab 123" === wordwrap("123 123 123", 8, "ab", 1)
-"123 ab12345 ab123" === wordwrap("123 12345 123", 8, "ab", 1)
-"1ab2ab3ab4" === wordwrap("1234", 1, "ab", 1)
-
-"12345|12345|67890" === wordwrap("12345 1234567890", 5, "|", 1)
-
-"123|==1234567890|==123" === wordwrap("123 1234567890 123", 10, "|==", 1)
-
-TESTS;
-
-include('tests/quicktester.inc');
-
---EXPECT--
-OK
diff --git a/ext/standard/tests/time/001.phpt b/ext/standard/tests/time/001.phpt
deleted file mode 100644
index e1a422957c..0000000000
--- a/ext/standard/tests/time/001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-microtime() function
---SKIPIF--
-<?php if (!function_exists('microtime')) die('skip microtime() not available'); ?>
---FILE--
-<?php
-$passed = 0;
-$failed = 0;
-$last_m = 0;
-$last_t = 0;
-$result = '';
-
-set_time_limit(0);
-
-for ($i=1;$i<=100000;$i++) {
- list($micro,$time)=explode(" ",microtime());
- if ($time > $last_t || ($time == $last_t && $micro > $last_m)) {
- $passed++;
- } else if ($failed++ <=10) {
- $result .= sprintf('%06d', $i).": $time $micro < $last_t $last_m\n";
- }
- $last_m = $micro;
- $last_t = $time;
-}
-echo "Passed: $passed\n";
-echo "Failed: $failed\n";
-echo $result;
-?>
---EXPECT--
-Passed: 100000
-Failed: 0
diff --git a/ext/standard/tests/time/002-win32.phpt b/ext/standard/tests/time/002-win32.phpt
deleted file mode 100644
index 1d7ef57153..0000000000
--- a/ext/standard/tests/time/002-win32.phpt
+++ /dev/null
@@ -1,66 +0,0 @@
---TEST--
-strtotime() function
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- print 'skip test for win32 only';
-}
-if (!@putenv("TZ=GST-1GDT") || getenv("TZ") != 'GST-1GDT') {
- die("skip unable to change TZ enviroment variable\n");
-}
-?>
---FILE--
-<?php
- $dates = array (
- "1999-10-13",
- "Oct 13 1999",
- "2000-01-19",
- "Jan 19 2000",
- "2001-12-21",
- "Dec 21 2001",
- "2001-12-21 12:16",
- "Dec 21 2001 12:16",
- "2001-10-22 21:19:58",
- "2001-10-22 21:19:58-02",
- "2001-10-22 21:19:58-0213",
- "2001-10-22 21:19:58+02",
- "2001-10-22 21:19:58+0213"
- );
-
- putenv ("TZ=GMT");
- foreach ($dates as $date) {
- echo date("Y-m-d H:i:s\n", strtotime ($date));
- }
-
- putenv ("TZ=GST-1GDT");
- foreach ($dates as $date) {
- echo date("Y-m-d H:i:s\n", strtotime ($date));
- }
-?>
---EXPECT--
-1999-10-13 00:00:00
-1999-10-13 00:00:00
-2000-01-19 00:00:00
-2000-01-19 00:00:00
-2001-12-21 00:00:00
-2001-12-21 00:00:00
-2001-12-21 12:16:00
-2001-12-21 12:16:00
-2001-10-22 21:19:58
-2001-10-22 23:19:58
-2001-10-22 23:32:58
-2001-10-22 19:19:58
-2001-10-22 19:06:58
-1999-10-13 00:00:00
-1999-10-13 00:00:00
-2000-01-19 00:00:00
-2000-01-19 00:00:00
-2001-12-21 00:00:00
-2001-12-21 00:00:00
-2001-12-21 12:16:00
-2001-12-21 12:16:00
-2001-10-22 21:19:58
-2001-10-23 01:19:58
-2001-10-23 01:32:58
-2001-10-22 21:19:58
-2001-10-22 21:06:58
diff --git a/ext/standard/tests/time/002.phpt b/ext/standard/tests/time/002.phpt
deleted file mode 100644
index 6051047276..0000000000
--- a/ext/standard/tests/time/002.phpt
+++ /dev/null
@@ -1,69 +0,0 @@
---TEST--
-strtotime() function
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip Windows does not support dates prior to midnight (00:00:00), January 1, 1970');
-}
-if (!@putenv("TZ=EST5") || getenv("TZ") != 'EST5') {
- die("skip unable to change TZ enviroment variable\n");
-}
-?>
---FILE--
-<?php
- $dates = array (
- "1999-10-13",
- "Oct 13 1999",
- "2000-01-19",
- "Jan 19 2000",
- "2001-12-21",
- "Dec 21 2001",
- "2001-12-21 12:16",
- "Dec 21 2001 12:16",
- "Dec 21 12:16",
- "2001-10-22 21:19:58",
- "2001-10-22 21:19:58-02",
- "2001-10-22 21:19:58-0213",
- "2001-10-22 21:19:58+02",
- "2001-10-22 21:19:58+0213"
- );
-
- putenv ("TZ=GMT0");
- foreach ($dates as $date) {
- echo date ("Y-m-d H:i:s\n", strtotime ($date));
- }
-
- putenv ("TZ=US/Eastern");
- foreach ($dates as $date) {
- echo date ("Y-m-d H:i:s\n", strtotime ($date));
- }
-?>
---EXPECT--
-1999-10-13 00:00:00
-1999-10-13 00:00:00
-2000-01-19 00:00:00
-2000-01-19 00:00:00
-2001-12-21 00:00:00
-2001-12-21 00:00:00
-2001-12-21 12:16:00
-2001-12-21 12:16:00
-1969-12-31 23:59:59
-2001-10-22 21:19:58
-2001-10-22 23:19:58
-2001-10-22 23:32:58
-2001-10-22 19:19:58
-2001-10-22 19:06:58
-1999-10-13 00:00:00
-1999-10-13 00:00:00
-2000-01-19 00:00:00
-2000-01-19 00:00:00
-2001-12-21 00:00:00
-2001-12-21 00:00:00
-2001-12-21 12:16:00
-2001-12-21 12:16:00
-1969-12-31 18:59:59
-2001-10-22 21:19:58
-2001-10-22 19:19:58
-2001-10-22 19:32:58
-2001-10-22 15:19:58
-2001-10-22 15:06:58
diff --git a/ext/standard/tests/time/003.phpt b/ext/standard/tests/time/003.phpt
deleted file mode 100644
index 2da8121b6a..0000000000
--- a/ext/standard/tests/time/003.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-Check for mktime with out-of-range parameters
---SKIPIF--
---POST--
---GET--
---FILE--
-<?php
- # MacOS/X libc implementation doesn't treat out-of-range values
- # the same way other unices do (Bug# 10686) so some extra code
- # was added to datetime.c to take care of this
- echo date("Y-m-d", mktime( 12, 0, 0, 3, 0, 2000)) ."\n";
- echo date("Y-m-d", mktime( 12, 0, 0, 3, -1, 2000)) ."\n";
- echo date("Y-m-d", mktime( 12, 0, 0, 2, 29, 2000)) ."\n";
- echo date("Y-m-d", mktime( 12, 0, 0, 3, 0, 2001)) ."\n";
- echo date("Y-m-d", mktime( 12, 0, 0, 2, 29, 2001)) ."\n";
- echo date("Y-m-d", mktime( 12, 0, 0, 0, 0, 2000)) ."\n";
-
- putenv("TZ=GST-1GDT");
- echo date("Y-m-d H:i:s", mktime(12,0,0,3,+90,2000,-1))."\n";
- echo date("Y-m-d H:i:s", mktime(12,0,0,3,+90,2000,0))."\n";
- echo date("Y-m-d H:i:s", mktime(12,0,0,3,+90,2000,1))."\n";
- echo date("Y-m-d H:i:s", mktime(12,0,0,5,-90,2000,-1))."\n";
- echo date("Y-m-d H:i:s", mktime(12,0,0,5,-90,2000,0))."\n";
- echo date("Y-m-d H:i:s", mktime(12,0,0,5,-90,2000,1))."\n";
- echo date("Y-m-d H:i:s", mktime(12,0,0,5,-1,2000,-1))."\n";
- echo date("Y-m-d H:i:s", mktime(12,0,0,5,-1,2000,0))."\n";
- echo date("Y-m-d H:i:s", mktime(12,0,0,5,-1,2000,1))."\n";
-?>
---EXPECT--
-2000-02-29
-2000-02-28
-2000-02-29
-2001-02-28
-2001-03-01
-1999-11-30
-2000-05-29 12:00:00
-2000-05-29 13:00:00
-2000-05-29 12:00:00
-2000-01-31 12:00:00
-2000-01-31 12:00:00
-2000-01-31 11:00:00
-2000-04-29 12:00:00
-2000-04-29 13:00:00
-2000-04-29 12:00:00
diff --git a/ext/standard/tests/time/idate.phpt b/ext/standard/tests/time/idate.phpt
deleted file mode 100644
index 485f9804af..0000000000
--- a/ext/standard/tests/time/idate.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-idate() function
---FILE--
-<?php
-putenv ("TZ=GMT0");
-
-$tmp = "UYzymndjHGhgistwLBIW";
-for($a = 0;$a < strlen($tmp); $a++){
- echo $tmp{$a}, ': ', idate($tmp{$a}, 1043324459)."\n";
-}
-?>
---EXPECT--
-U: 1043324459
-Y: 2003
-z: 22
-y: 3
-m: 1
-n: 1
-d: 23
-j: 23
-H: 12
-G: 12
-h: 12
-g: 12
-i: 20
-s: 59
-t: 31
-w: 4
-L: 0
-B: 556
-I: 0
-W: 4
diff --git a/ext/standard/tests/time/mktime.phpt b/ext/standard/tests/time/mktime.phpt
deleted file mode 100644
index 95d40b9b17..0000000000
--- a/ext/standard/tests/time/mktime.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-mktime()
---FILE--
-<?php
-$timezones = array(
- 'GMT0',
- 'GST-1GDT'
-);
-
-foreach($timezones as $timezone)
-{
- putenv('TZ='.$timezone);
-
- /* status of daylight saving time unknown */
- var_dump(mktime(0, 0, 0, 1, 1, 2002));
- /* status of daylight saving time unknown */
- var_dump(mktime(0, 0, 0, 1, 1, 2002, -1));
- /* daylight saving time is not in affect */
- var_dump(mktime(0, 0, 0, 1, 1, 2002, 0));
- /* daylight saving time is in affect */
- var_dump(mktime(0, 0, 0, 1, 1, 2002, 1));
-
- /* status of daylight saving time unknown */
- var_dump(mktime(0, 0, 0, 7, 1, 2002));
- /* status of daylight saving time unknown */
- var_dump(mktime(0, 0, 0, 7, 1, 2002, -1));
- /* daylight saving time is not in affect */
- var_dump(mktime(0, 0, 0, 7, 1, 2002, 0));
- /* daylight saving time is in affect */
- var_dump(mktime(0, 0, 0, 7, 1, 2002, 1));
-}
-?>
---EXPECT--
-int(1009843200)
-int(1009843200)
-int(1009843200)
-int(1009843200)
-int(1025481600)
-int(1025481600)
-int(1025481600)
-int(1025481600)
-int(1009839600)
-int(1009839600)
-int(1009839600)
-int(1009836000)
-int(1025474400)
-int(1025474400)
-int(1025478000)
-int(1025474400)
diff --git a/ext/standard/tests/versioning/version_compare.phpt b/ext/standard/tests/versioning/version_compare.phpt
deleted file mode 100644
index 6ef49ba777..0000000000
--- a/ext/standard/tests/versioning/version_compare.phpt
+++ /dev/null
@@ -1,600 +0,0 @@
---TEST--
-version_compare test
---FILE--
-<?php
-
-print "TESTING COMPARE\n";
-$special_forms = array("-dev", "a1", "b1", "RC1", "", "pl1");
-$operators = array(
- "lt", "<",
- "le", "<=",
- "gt", ">",
- "ge", ">=",
- "eq", "=", "==",
- "ne", "<>", "!="
-);
-test("1", "2");
-test("10", "2");
-test("1.0", "1.1");
-test("1.2", "1.0.1");
-foreach ($special_forms as $f1) {
- foreach ($special_forms as $f2) {
- test("1.0$f1", "1.0$f2");
- }
-}
-print "TESTING OPERATORS\n";
-foreach ($special_forms as $f1) {
- foreach ($special_forms as $f2) {
- foreach ($operators as $op) {
- $v1 = "1.0$f1";
- $v2 = "1.0$f2";
- $test = version_compare($v1, $v2, $op) ? "true" : "false";
- printf("%7s %2s %-7s : %s\n", $v1, $op, $v2, $test);
- }
- }
-}
-
-function test($v1, $v2) {
- $compare = version_compare($v1, $v2);
- switch ($compare) {
- case -1:
- print "$v1 < $v2\n";
- break;
- case 1:
- print "$v1 > $v2\n";
- break;
- case 0:
- default:
- print "$v1 = $v2\n";
- break;
- }
-}
-
-?>
---EXPECT--
-TESTING COMPARE
-1 < 2
-10 > 2
-1.0 < 1.1
-1.2 > 1.0.1
-1.0-dev = 1.0-dev
-1.0-dev < 1.0a1
-1.0-dev < 1.0b1
-1.0-dev < 1.0RC1
-1.0-dev < 1.0
-1.0-dev < 1.0pl1
-1.0a1 > 1.0-dev
-1.0a1 = 1.0a1
-1.0a1 < 1.0b1
-1.0a1 < 1.0RC1
-1.0a1 < 1.0
-1.0a1 < 1.0pl1
-1.0b1 > 1.0-dev
-1.0b1 > 1.0a1
-1.0b1 = 1.0b1
-1.0b1 < 1.0RC1
-1.0b1 < 1.0
-1.0b1 < 1.0pl1
-1.0RC1 > 1.0-dev
-1.0RC1 > 1.0a1
-1.0RC1 > 1.0b1
-1.0RC1 = 1.0RC1
-1.0RC1 < 1.0
-1.0RC1 < 1.0pl1
-1.0 > 1.0-dev
-1.0 > 1.0a1
-1.0 > 1.0b1
-1.0 > 1.0RC1
-1.0 = 1.0
-1.0 < 1.0pl1
-1.0pl1 > 1.0-dev
-1.0pl1 > 1.0a1
-1.0pl1 > 1.0b1
-1.0pl1 > 1.0RC1
-1.0pl1 > 1.0
-1.0pl1 = 1.0pl1
-TESTING OPERATORS
-1.0-dev lt 1.0-dev : false
-1.0-dev < 1.0-dev : false
-1.0-dev le 1.0-dev : true
-1.0-dev <= 1.0-dev : true
-1.0-dev gt 1.0-dev : false
-1.0-dev > 1.0-dev : false
-1.0-dev ge 1.0-dev : true
-1.0-dev >= 1.0-dev : true
-1.0-dev eq 1.0-dev : true
-1.0-dev = 1.0-dev : true
-1.0-dev == 1.0-dev : true
-1.0-dev ne 1.0-dev : false
-1.0-dev <> 1.0-dev : false
-1.0-dev != 1.0-dev : false
-1.0-dev lt 1.0a1 : true
-1.0-dev < 1.0a1 : true
-1.0-dev le 1.0a1 : true
-1.0-dev <= 1.0a1 : true
-1.0-dev gt 1.0a1 : false
-1.0-dev > 1.0a1 : false
-1.0-dev ge 1.0a1 : false
-1.0-dev >= 1.0a1 : false
-1.0-dev eq 1.0a1 : false
-1.0-dev = 1.0a1 : false
-1.0-dev == 1.0a1 : false
-1.0-dev ne 1.0a1 : true
-1.0-dev <> 1.0a1 : true
-1.0-dev != 1.0a1 : true
-1.0-dev lt 1.0b1 : true
-1.0-dev < 1.0b1 : true
-1.0-dev le 1.0b1 : true
-1.0-dev <= 1.0b1 : true
-1.0-dev gt 1.0b1 : false
-1.0-dev > 1.0b1 : false
-1.0-dev ge 1.0b1 : false
-1.0-dev >= 1.0b1 : false
-1.0-dev eq 1.0b1 : false
-1.0-dev = 1.0b1 : false
-1.0-dev == 1.0b1 : false
-1.0-dev ne 1.0b1 : true
-1.0-dev <> 1.0b1 : true
-1.0-dev != 1.0b1 : true
-1.0-dev lt 1.0RC1 : true
-1.0-dev < 1.0RC1 : true
-1.0-dev le 1.0RC1 : true
-1.0-dev <= 1.0RC1 : true
-1.0-dev gt 1.0RC1 : false
-1.0-dev > 1.0RC1 : false
-1.0-dev ge 1.0RC1 : false
-1.0-dev >= 1.0RC1 : false
-1.0-dev eq 1.0RC1 : false
-1.0-dev = 1.0RC1 : false
-1.0-dev == 1.0RC1 : false
-1.0-dev ne 1.0RC1 : true
-1.0-dev <> 1.0RC1 : true
-1.0-dev != 1.0RC1 : true
-1.0-dev lt 1.0 : true
-1.0-dev < 1.0 : true
-1.0-dev le 1.0 : true
-1.0-dev <= 1.0 : true
-1.0-dev gt 1.0 : false
-1.0-dev > 1.0 : false
-1.0-dev ge 1.0 : false
-1.0-dev >= 1.0 : false
-1.0-dev eq 1.0 : false
-1.0-dev = 1.0 : false
-1.0-dev == 1.0 : false
-1.0-dev ne 1.0 : true
-1.0-dev <> 1.0 : true
-1.0-dev != 1.0 : true
-1.0-dev lt 1.0pl1 : true
-1.0-dev < 1.0pl1 : true
-1.0-dev le 1.0pl1 : true
-1.0-dev <= 1.0pl1 : true
-1.0-dev gt 1.0pl1 : false
-1.0-dev > 1.0pl1 : false
-1.0-dev ge 1.0pl1 : false
-1.0-dev >= 1.0pl1 : false
-1.0-dev eq 1.0pl1 : false
-1.0-dev = 1.0pl1 : false
-1.0-dev == 1.0pl1 : false
-1.0-dev ne 1.0pl1 : true
-1.0-dev <> 1.0pl1 : true
-1.0-dev != 1.0pl1 : true
- 1.0a1 lt 1.0-dev : false
- 1.0a1 < 1.0-dev : false
- 1.0a1 le 1.0-dev : false
- 1.0a1 <= 1.0-dev : false
- 1.0a1 gt 1.0-dev : true
- 1.0a1 > 1.0-dev : true
- 1.0a1 ge 1.0-dev : true
- 1.0a1 >= 1.0-dev : true
- 1.0a1 eq 1.0-dev : false
- 1.0a1 = 1.0-dev : false
- 1.0a1 == 1.0-dev : false
- 1.0a1 ne 1.0-dev : true
- 1.0a1 <> 1.0-dev : true
- 1.0a1 != 1.0-dev : true
- 1.0a1 lt 1.0a1 : false
- 1.0a1 < 1.0a1 : false
- 1.0a1 le 1.0a1 : true
- 1.0a1 <= 1.0a1 : true
- 1.0a1 gt 1.0a1 : false
- 1.0a1 > 1.0a1 : false
- 1.0a1 ge 1.0a1 : true
- 1.0a1 >= 1.0a1 : true
- 1.0a1 eq 1.0a1 : true
- 1.0a1 = 1.0a1 : true
- 1.0a1 == 1.0a1 : true
- 1.0a1 ne 1.0a1 : false
- 1.0a1 <> 1.0a1 : false
- 1.0a1 != 1.0a1 : false
- 1.0a1 lt 1.0b1 : true
- 1.0a1 < 1.0b1 : true
- 1.0a1 le 1.0b1 : true
- 1.0a1 <= 1.0b1 : true
- 1.0a1 gt 1.0b1 : false
- 1.0a1 > 1.0b1 : false
- 1.0a1 ge 1.0b1 : false
- 1.0a1 >= 1.0b1 : false
- 1.0a1 eq 1.0b1 : false
- 1.0a1 = 1.0b1 : false
- 1.0a1 == 1.0b1 : false
- 1.0a1 ne 1.0b1 : true
- 1.0a1 <> 1.0b1 : true
- 1.0a1 != 1.0b1 : true
- 1.0a1 lt 1.0RC1 : true
- 1.0a1 < 1.0RC1 : true
- 1.0a1 le 1.0RC1 : true
- 1.0a1 <= 1.0RC1 : true
- 1.0a1 gt 1.0RC1 : false
- 1.0a1 > 1.0RC1 : false
- 1.0a1 ge 1.0RC1 : false
- 1.0a1 >= 1.0RC1 : false
- 1.0a1 eq 1.0RC1 : false
- 1.0a1 = 1.0RC1 : false
- 1.0a1 == 1.0RC1 : false
- 1.0a1 ne 1.0RC1 : true
- 1.0a1 <> 1.0RC1 : true
- 1.0a1 != 1.0RC1 : true
- 1.0a1 lt 1.0 : true
- 1.0a1 < 1.0 : true
- 1.0a1 le 1.0 : true
- 1.0a1 <= 1.0 : true
- 1.0a1 gt 1.0 : false
- 1.0a1 > 1.0 : false
- 1.0a1 ge 1.0 : false
- 1.0a1 >= 1.0 : false
- 1.0a1 eq 1.0 : false
- 1.0a1 = 1.0 : false
- 1.0a1 == 1.0 : false
- 1.0a1 ne 1.0 : true
- 1.0a1 <> 1.0 : true
- 1.0a1 != 1.0 : true
- 1.0a1 lt 1.0pl1 : true
- 1.0a1 < 1.0pl1 : true
- 1.0a1 le 1.0pl1 : true
- 1.0a1 <= 1.0pl1 : true
- 1.0a1 gt 1.0pl1 : false
- 1.0a1 > 1.0pl1 : false
- 1.0a1 ge 1.0pl1 : false
- 1.0a1 >= 1.0pl1 : false
- 1.0a1 eq 1.0pl1 : false
- 1.0a1 = 1.0pl1 : false
- 1.0a1 == 1.0pl1 : false
- 1.0a1 ne 1.0pl1 : true
- 1.0a1 <> 1.0pl1 : true
- 1.0a1 != 1.0pl1 : true
- 1.0b1 lt 1.0-dev : false
- 1.0b1 < 1.0-dev : false
- 1.0b1 le 1.0-dev : false
- 1.0b1 <= 1.0-dev : false
- 1.0b1 gt 1.0-dev : true
- 1.0b1 > 1.0-dev : true
- 1.0b1 ge 1.0-dev : true
- 1.0b1 >= 1.0-dev : true
- 1.0b1 eq 1.0-dev : false
- 1.0b1 = 1.0-dev : false
- 1.0b1 == 1.0-dev : false
- 1.0b1 ne 1.0-dev : true
- 1.0b1 <> 1.0-dev : true
- 1.0b1 != 1.0-dev : true
- 1.0b1 lt 1.0a1 : false
- 1.0b1 < 1.0a1 : false
- 1.0b1 le 1.0a1 : false
- 1.0b1 <= 1.0a1 : false
- 1.0b1 gt 1.0a1 : true
- 1.0b1 > 1.0a1 : true
- 1.0b1 ge 1.0a1 : true
- 1.0b1 >= 1.0a1 : true
- 1.0b1 eq 1.0a1 : false
- 1.0b1 = 1.0a1 : false
- 1.0b1 == 1.0a1 : false
- 1.0b1 ne 1.0a1 : true
- 1.0b1 <> 1.0a1 : true
- 1.0b1 != 1.0a1 : true
- 1.0b1 lt 1.0b1 : false
- 1.0b1 < 1.0b1 : false
- 1.0b1 le 1.0b1 : true
- 1.0b1 <= 1.0b1 : true
- 1.0b1 gt 1.0b1 : false
- 1.0b1 > 1.0b1 : false
- 1.0b1 ge 1.0b1 : true
- 1.0b1 >= 1.0b1 : true
- 1.0b1 eq 1.0b1 : true
- 1.0b1 = 1.0b1 : true
- 1.0b1 == 1.0b1 : true
- 1.0b1 ne 1.0b1 : false
- 1.0b1 <> 1.0b1 : false
- 1.0b1 != 1.0b1 : false
- 1.0b1 lt 1.0RC1 : true
- 1.0b1 < 1.0RC1 : true
- 1.0b1 le 1.0RC1 : true
- 1.0b1 <= 1.0RC1 : true
- 1.0b1 gt 1.0RC1 : false
- 1.0b1 > 1.0RC1 : false
- 1.0b1 ge 1.0RC1 : false
- 1.0b1 >= 1.0RC1 : false
- 1.0b1 eq 1.0RC1 : false
- 1.0b1 = 1.0RC1 : false
- 1.0b1 == 1.0RC1 : false
- 1.0b1 ne 1.0RC1 : true
- 1.0b1 <> 1.0RC1 : true
- 1.0b1 != 1.0RC1 : true
- 1.0b1 lt 1.0 : true
- 1.0b1 < 1.0 : true
- 1.0b1 le 1.0 : true
- 1.0b1 <= 1.0 : true
- 1.0b1 gt 1.0 : false
- 1.0b1 > 1.0 : false
- 1.0b1 ge 1.0 : false
- 1.0b1 >= 1.0 : false
- 1.0b1 eq 1.0 : false
- 1.0b1 = 1.0 : false
- 1.0b1 == 1.0 : false
- 1.0b1 ne 1.0 : true
- 1.0b1 <> 1.0 : true
- 1.0b1 != 1.0 : true
- 1.0b1 lt 1.0pl1 : true
- 1.0b1 < 1.0pl1 : true
- 1.0b1 le 1.0pl1 : true
- 1.0b1 <= 1.0pl1 : true
- 1.0b1 gt 1.0pl1 : false
- 1.0b1 > 1.0pl1 : false
- 1.0b1 ge 1.0pl1 : false
- 1.0b1 >= 1.0pl1 : false
- 1.0b1 eq 1.0pl1 : false
- 1.0b1 = 1.0pl1 : false
- 1.0b1 == 1.0pl1 : false
- 1.0b1 ne 1.0pl1 : true
- 1.0b1 <> 1.0pl1 : true
- 1.0b1 != 1.0pl1 : true
- 1.0RC1 lt 1.0-dev : false
- 1.0RC1 < 1.0-dev : false
- 1.0RC1 le 1.0-dev : false
- 1.0RC1 <= 1.0-dev : false
- 1.0RC1 gt 1.0-dev : true
- 1.0RC1 > 1.0-dev : true
- 1.0RC1 ge 1.0-dev : true
- 1.0RC1 >= 1.0-dev : true
- 1.0RC1 eq 1.0-dev : false
- 1.0RC1 = 1.0-dev : false
- 1.0RC1 == 1.0-dev : false
- 1.0RC1 ne 1.0-dev : true
- 1.0RC1 <> 1.0-dev : true
- 1.0RC1 != 1.0-dev : true
- 1.0RC1 lt 1.0a1 : false
- 1.0RC1 < 1.0a1 : false
- 1.0RC1 le 1.0a1 : false
- 1.0RC1 <= 1.0a1 : false
- 1.0RC1 gt 1.0a1 : true
- 1.0RC1 > 1.0a1 : true
- 1.0RC1 ge 1.0a1 : true
- 1.0RC1 >= 1.0a1 : true
- 1.0RC1 eq 1.0a1 : false
- 1.0RC1 = 1.0a1 : false
- 1.0RC1 == 1.0a1 : false
- 1.0RC1 ne 1.0a1 : true
- 1.0RC1 <> 1.0a1 : true
- 1.0RC1 != 1.0a1 : true
- 1.0RC1 lt 1.0b1 : false
- 1.0RC1 < 1.0b1 : false
- 1.0RC1 le 1.0b1 : false
- 1.0RC1 <= 1.0b1 : false
- 1.0RC1 gt 1.0b1 : true
- 1.0RC1 > 1.0b1 : true
- 1.0RC1 ge 1.0b1 : true
- 1.0RC1 >= 1.0b1 : true
- 1.0RC1 eq 1.0b1 : false
- 1.0RC1 = 1.0b1 : false
- 1.0RC1 == 1.0b1 : false
- 1.0RC1 ne 1.0b1 : true
- 1.0RC1 <> 1.0b1 : true
- 1.0RC1 != 1.0b1 : true
- 1.0RC1 lt 1.0RC1 : false
- 1.0RC1 < 1.0RC1 : false
- 1.0RC1 le 1.0RC1 : true
- 1.0RC1 <= 1.0RC1 : true
- 1.0RC1 gt 1.0RC1 : false
- 1.0RC1 > 1.0RC1 : false
- 1.0RC1 ge 1.0RC1 : true
- 1.0RC1 >= 1.0RC1 : true
- 1.0RC1 eq 1.0RC1 : true
- 1.0RC1 = 1.0RC1 : true
- 1.0RC1 == 1.0RC1 : true
- 1.0RC1 ne 1.0RC1 : false
- 1.0RC1 <> 1.0RC1 : false
- 1.0RC1 != 1.0RC1 : false
- 1.0RC1 lt 1.0 : true
- 1.0RC1 < 1.0 : true
- 1.0RC1 le 1.0 : true
- 1.0RC1 <= 1.0 : true
- 1.0RC1 gt 1.0 : false
- 1.0RC1 > 1.0 : false
- 1.0RC1 ge 1.0 : false
- 1.0RC1 >= 1.0 : false
- 1.0RC1 eq 1.0 : false
- 1.0RC1 = 1.0 : false
- 1.0RC1 == 1.0 : false
- 1.0RC1 ne 1.0 : true
- 1.0RC1 <> 1.0 : true
- 1.0RC1 != 1.0 : true
- 1.0RC1 lt 1.0pl1 : true
- 1.0RC1 < 1.0pl1 : true
- 1.0RC1 le 1.0pl1 : true
- 1.0RC1 <= 1.0pl1 : true
- 1.0RC1 gt 1.0pl1 : false
- 1.0RC1 > 1.0pl1 : false
- 1.0RC1 ge 1.0pl1 : false
- 1.0RC1 >= 1.0pl1 : false
- 1.0RC1 eq 1.0pl1 : false
- 1.0RC1 = 1.0pl1 : false
- 1.0RC1 == 1.0pl1 : false
- 1.0RC1 ne 1.0pl1 : true
- 1.0RC1 <> 1.0pl1 : true
- 1.0RC1 != 1.0pl1 : true
- 1.0 lt 1.0-dev : false
- 1.0 < 1.0-dev : false
- 1.0 le 1.0-dev : false
- 1.0 <= 1.0-dev : false
- 1.0 gt 1.0-dev : true
- 1.0 > 1.0-dev : true
- 1.0 ge 1.0-dev : true
- 1.0 >= 1.0-dev : true
- 1.0 eq 1.0-dev : false
- 1.0 = 1.0-dev : false
- 1.0 == 1.0-dev : false
- 1.0 ne 1.0-dev : true
- 1.0 <> 1.0-dev : true
- 1.0 != 1.0-dev : true
- 1.0 lt 1.0a1 : false
- 1.0 < 1.0a1 : false
- 1.0 le 1.0a1 : false
- 1.0 <= 1.0a1 : false
- 1.0 gt 1.0a1 : true
- 1.0 > 1.0a1 : true
- 1.0 ge 1.0a1 : true
- 1.0 >= 1.0a1 : true
- 1.0 eq 1.0a1 : false
- 1.0 = 1.0a1 : false
- 1.0 == 1.0a1 : false
- 1.0 ne 1.0a1 : true
- 1.0 <> 1.0a1 : true
- 1.0 != 1.0a1 : true
- 1.0 lt 1.0b1 : false
- 1.0 < 1.0b1 : false
- 1.0 le 1.0b1 : false
- 1.0 <= 1.0b1 : false
- 1.0 gt 1.0b1 : true
- 1.0 > 1.0b1 : true
- 1.0 ge 1.0b1 : true
- 1.0 >= 1.0b1 : true
- 1.0 eq 1.0b1 : false
- 1.0 = 1.0b1 : false
- 1.0 == 1.0b1 : false
- 1.0 ne 1.0b1 : true
- 1.0 <> 1.0b1 : true
- 1.0 != 1.0b1 : true
- 1.0 lt 1.0RC1 : false
- 1.0 < 1.0RC1 : false
- 1.0 le 1.0RC1 : false
- 1.0 <= 1.0RC1 : false
- 1.0 gt 1.0RC1 : true
- 1.0 > 1.0RC1 : true
- 1.0 ge 1.0RC1 : true
- 1.0 >= 1.0RC1 : true
- 1.0 eq 1.0RC1 : false
- 1.0 = 1.0RC1 : false
- 1.0 == 1.0RC1 : false
- 1.0 ne 1.0RC1 : true
- 1.0 <> 1.0RC1 : true
- 1.0 != 1.0RC1 : true
- 1.0 lt 1.0 : false
- 1.0 < 1.0 : false
- 1.0 le 1.0 : true
- 1.0 <= 1.0 : true
- 1.0 gt 1.0 : false
- 1.0 > 1.0 : false
- 1.0 ge 1.0 : true
- 1.0 >= 1.0 : true
- 1.0 eq 1.0 : true
- 1.0 = 1.0 : true
- 1.0 == 1.0 : true
- 1.0 ne 1.0 : false
- 1.0 <> 1.0 : false
- 1.0 != 1.0 : false
- 1.0 lt 1.0pl1 : true
- 1.0 < 1.0pl1 : true
- 1.0 le 1.0pl1 : true
- 1.0 <= 1.0pl1 : true
- 1.0 gt 1.0pl1 : false
- 1.0 > 1.0pl1 : false
- 1.0 ge 1.0pl1 : false
- 1.0 >= 1.0pl1 : false
- 1.0 eq 1.0pl1 : false
- 1.0 = 1.0pl1 : false
- 1.0 == 1.0pl1 : false
- 1.0 ne 1.0pl1 : true
- 1.0 <> 1.0pl1 : true
- 1.0 != 1.0pl1 : true
- 1.0pl1 lt 1.0-dev : false
- 1.0pl1 < 1.0-dev : false
- 1.0pl1 le 1.0-dev : false
- 1.0pl1 <= 1.0-dev : false
- 1.0pl1 gt 1.0-dev : true
- 1.0pl1 > 1.0-dev : true
- 1.0pl1 ge 1.0-dev : true
- 1.0pl1 >= 1.0-dev : true
- 1.0pl1 eq 1.0-dev : false
- 1.0pl1 = 1.0-dev : false
- 1.0pl1 == 1.0-dev : false
- 1.0pl1 ne 1.0-dev : true
- 1.0pl1 <> 1.0-dev : true
- 1.0pl1 != 1.0-dev : true
- 1.0pl1 lt 1.0a1 : false
- 1.0pl1 < 1.0a1 : false
- 1.0pl1 le 1.0a1 : false
- 1.0pl1 <= 1.0a1 : false
- 1.0pl1 gt 1.0a1 : true
- 1.0pl1 > 1.0a1 : true
- 1.0pl1 ge 1.0a1 : true
- 1.0pl1 >= 1.0a1 : true
- 1.0pl1 eq 1.0a1 : false
- 1.0pl1 = 1.0a1 : false
- 1.0pl1 == 1.0a1 : false
- 1.0pl1 ne 1.0a1 : true
- 1.0pl1 <> 1.0a1 : true
- 1.0pl1 != 1.0a1 : true
- 1.0pl1 lt 1.0b1 : false
- 1.0pl1 < 1.0b1 : false
- 1.0pl1 le 1.0b1 : false
- 1.0pl1 <= 1.0b1 : false
- 1.0pl1 gt 1.0b1 : true
- 1.0pl1 > 1.0b1 : true
- 1.0pl1 ge 1.0b1 : true
- 1.0pl1 >= 1.0b1 : true
- 1.0pl1 eq 1.0b1 : false
- 1.0pl1 = 1.0b1 : false
- 1.0pl1 == 1.0b1 : false
- 1.0pl1 ne 1.0b1 : true
- 1.0pl1 <> 1.0b1 : true
- 1.0pl1 != 1.0b1 : true
- 1.0pl1 lt 1.0RC1 : false
- 1.0pl1 < 1.0RC1 : false
- 1.0pl1 le 1.0RC1 : false
- 1.0pl1 <= 1.0RC1 : false
- 1.0pl1 gt 1.0RC1 : true
- 1.0pl1 > 1.0RC1 : true
- 1.0pl1 ge 1.0RC1 : true
- 1.0pl1 >= 1.0RC1 : true
- 1.0pl1 eq 1.0RC1 : false
- 1.0pl1 = 1.0RC1 : false
- 1.0pl1 == 1.0RC1 : false
- 1.0pl1 ne 1.0RC1 : true
- 1.0pl1 <> 1.0RC1 : true
- 1.0pl1 != 1.0RC1 : true
- 1.0pl1 lt 1.0 : false
- 1.0pl1 < 1.0 : false
- 1.0pl1 le 1.0 : false
- 1.0pl1 <= 1.0 : false
- 1.0pl1 gt 1.0 : true
- 1.0pl1 > 1.0 : true
- 1.0pl1 ge 1.0 : true
- 1.0pl1 >= 1.0 : true
- 1.0pl1 eq 1.0 : false
- 1.0pl1 = 1.0 : false
- 1.0pl1 == 1.0 : false
- 1.0pl1 ne 1.0 : true
- 1.0pl1 <> 1.0 : true
- 1.0pl1 != 1.0 : true
- 1.0pl1 lt 1.0pl1 : false
- 1.0pl1 < 1.0pl1 : false
- 1.0pl1 le 1.0pl1 : true
- 1.0pl1 <= 1.0pl1 : true
- 1.0pl1 gt 1.0pl1 : false
- 1.0pl1 > 1.0pl1 : false
- 1.0pl1 ge 1.0pl1 : true
- 1.0pl1 >= 1.0pl1 : true
- 1.0pl1 eq 1.0pl1 : true
- 1.0pl1 = 1.0pl1 : true
- 1.0pl1 == 1.0pl1 : true
- 1.0pl1 ne 1.0pl1 : false
- 1.0pl1 <> 1.0pl1 : false
- 1.0pl1 != 1.0pl1 : false
diff --git a/ext/standard/type.c b/ext/standard/type.c
deleted file mode 100644
index b6fdd65a03..0000000000
--- a/ext/standard/type.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_incomplete_class.h"
-
-/* {{{ proto string gettype(mixed var)
- Returns the type of the variable */
-PHP_FUNCTION(gettype)
-{
- pval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (Z_TYPE_PP(arg)) {
- case IS_NULL:
- RETVAL_STRING("NULL", 1);
- break;
-
- case IS_BOOL:
- RETVAL_STRING("boolean", 1);
- break;
-
- case IS_LONG:
- RETVAL_STRING("integer", 1);
- break;
-
- case IS_RESOURCE:
- RETVAL_STRING("resource", 1);
- break;
-
- case IS_DOUBLE:
- RETVAL_STRING("double", 1);
- break;
-
- case IS_STRING:
- RETVAL_STRING("string", 1);
- break;
-
- case IS_ARRAY:
- RETVAL_STRING("array", 1);
- break;
-
- case IS_OBJECT:
- RETVAL_STRING("object", 1);
- /*
- {
- char *result;
- int res_len;
-
- res_len = sizeof("object of type ")-1 + Z_OBJCE_P(arg)->name_length;
- result = (char *) emalloc(res_len+1);
- sprintf(result, "object of type %s", Z_OBJCE_P(arg)->name);
- RETVAL_STRINGL(result, res_len, 0);
- }
- */
- break;
-
- default:
- RETVAL_STRING("unknown type", 1);
- }
-}
-/* }}} */
-
-/* {{{ proto bool settype(mixed var, string type)
- Set the type of the variable */
-PHP_FUNCTION(settype)
-{
- pval **var, **type;
- char *new_type;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &var, &type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(type);
- new_type = Z_STRVAL_PP(type);
-
- if (!strcasecmp(new_type, "integer")) {
- convert_to_long(*var);
- } else if (!strcasecmp(new_type, "int")) {
- convert_to_long(*var);
- } else if (!strcasecmp(new_type, "float")) {
- convert_to_double(*var);
- } else if (!strcasecmp(new_type, "double")) { /* deprecated */
- convert_to_double(*var);
- } else if (!strcasecmp(new_type, "string")) {
- convert_to_string(*var);
- } else if (!strcasecmp(new_type, "array")) {
- convert_to_array(*var);
- } else if (!strcasecmp(new_type, "object")) {
- convert_to_object(*var);
- } else if (!strcasecmp(new_type, "bool")) {
- convert_to_boolean(*var);
- } else if (!strcasecmp(new_type, "boolean")) {
- convert_to_boolean(*var);
- } else if (!strcasecmp(new_type, "null")) {
- convert_to_null(*var);
- } else if (!strcasecmp(new_type, "resource")) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot convert to resource type");
- RETURN_FALSE;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid type");
- RETURN_FALSE;
- }
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int intval(mixed var [, int base])
- Get the integer value of a variable using the optional base for the conversion */
-PHP_FUNCTION(intval)
-{
- pval **num, **arg_base;
- int base;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- base = 10;
- break;
-
- case 2:
- if (zend_get_parameters_ex(2, &num, &arg_base) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg_base);
- base = Z_LVAL_PP(arg_base);
- break;
-
- default:
- WRONG_PARAM_COUNT;
- }
-
- *return_value = **num;
- zval_copy_ctor(return_value);
- convert_to_long_base(return_value, base);
-}
-/* }}} */
-
-/* {{{ proto float floatval(mixed var)
- Get the float value of a variable */
-PHP_FUNCTION(floatval)
-{
- pval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- *return_value = **num;
- zval_copy_ctor(return_value);
- convert_to_double(return_value);
-}
-/* }}} */
-
-/* {{{ proto string strval(mixed var)
- Get the string value of a variable */
-PHP_FUNCTION(strval)
-{
- pval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- *return_value = **num;
- zval_copy_ctor(return_value);
- convert_to_string(return_value);
-}
-/* }}} */
-
-static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
-{
- pval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only one argument expected");
- RETURN_FALSE;
- }
-
- if (Z_TYPE_PP(arg) == type) {
- if (type == IS_OBJECT) {
- zend_class_entry *ce;
- ce = Z_OBJCE_PP(arg);
- if (!strcmp(ce->name, INCOMPLETE_CLASS)) {
- RETURN_FALSE;
- }
- }
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-
-
-/* {{{ proto bool is_null(mixed var)
- Returns true if variable is null */
-PHP_FUNCTION(is_null)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_NULL);
-}
-/* }}} */
-
-/* {{{ proto bool is_resource(mixed var)
- Returns true if variable is a resource */
-PHP_FUNCTION(is_resource)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_RESOURCE);
-}
-/* }}} */
-
-/* {{{ proto bool is_bool(mixed var)
- Returns true if variable is a boolean */
-PHP_FUNCTION(is_bool)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_BOOL);
-}
-/* }}} */
-
-/* {{{ proto bool is_long(mixed var)
- Returns true if variable is a long (integer) */
-PHP_FUNCTION(is_long)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_LONG);
-}
-/* }}} */
-
-/* {{{ proto bool is_float(mixed var)
- Returns true if variable is float point*/
-PHP_FUNCTION(is_float)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_DOUBLE);
-}
-/* }}} */
-
-/* {{{ proto bool is_string(mixed var)
- Returns true if variable is a string */
-PHP_FUNCTION(is_string)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_STRING);
-}
-/* }}} */
-
-/* {{{ proto bool is_array(mixed var)
- Returns true if variable is an array */
-PHP_FUNCTION(is_array)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_ARRAY);
-}
-/* }}} */
-
-/* {{{ proto bool is_object(mixed var)
- Returns true if variable is an object */
-PHP_FUNCTION(is_object)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_OBJECT);
-}
-/* }}} */
-
-/* {{{ proto bool is_numeric(mixed value)
- Returns true if value is a number or a numeric string */
-PHP_FUNCTION(is_numeric)
-{
- zval **arg;
- int result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (Z_TYPE_PP(arg)) {
- case IS_LONG:
- case IS_DOUBLE:
- RETURN_TRUE;
- break;
-
- case IS_STRING:
- result = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), NULL, NULL, 0);
- if (result == IS_LONG || result == IS_DOUBLE) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
- break;
-
- default:
- RETURN_FALSE;
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto bool is_scalar(mixed value)
- Returns true if value is a scalar */
-PHP_FUNCTION(is_scalar)
-{
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (Z_TYPE_PP(arg)) {
- case IS_BOOL:
- case IS_DOUBLE:
- case IS_LONG:
- case IS_STRING:
- RETURN_TRUE;
- break;
-
- default:
- RETURN_FALSE;
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto bool is_callable(mixed var [, bool syntax_only [, string callable_name]])
- Returns true if var is callable. */
-PHP_FUNCTION(is_callable)
-{
- zval **var, **syntax_only, **callable_name;
- char *name;
- zend_bool retval;
- zend_bool syntax = 0;
- int argc=ZEND_NUM_ARGS();
-
- if (argc < 1 || argc > 3 || zend_get_parameters_ex(argc, &var, &syntax_only, &callable_name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc > 1) {
- convert_to_boolean_ex(syntax_only);
- syntax = Z_BVAL_PP(syntax_only);
- }
-
- if (argc > 2) {
- retval = zend_is_callable(*var, syntax, &name);
- zval_dtor(*callable_name);
- ZVAL_STRING(*callable_name, name, 0);
- } else {
- retval = zend_is_callable(*var, syntax, NULL);
- }
-
- RETURN_BOOL(retval);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c
deleted file mode 100644
index 5842fc4b36..0000000000
--- a/ext/standard/uniqid.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#include <stdlib.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-
-#include <stdio.h>
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#else
-#include <sys/time.h>
-#endif
-
-#include "php_lcg.h"
-#include "uniqid.h"
-
-/* {{{ proto string uniqid([string prefix , bool more_entropy])
- Generates a unique ID */
-#ifdef HAVE_GETTIMEOFDAY
-PHP_FUNCTION(uniqid)
-{
- char *prefix = "";
-#if defined(__CYGWIN__)
- zend_bool more_entropy = 1;
-#else
- zend_bool more_entropy = 0;
-#endif
- char *uniqid;
- int sec, usec, argc, prefix_len = 0;
- struct timeval tv;
-
- argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "|sb", &prefix, &prefix_len,
- &more_entropy)) {
- return;
- }
-
-#if HAVE_USLEEP && !defined(PHP_WIN32)
- if (!more_entropy) {
-#if defined(__CYGWIN__)
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "You must use 'more entropy' under CYGWIN.");
- return;
-#else
- usleep(1);
-#endif
- }
-#endif
- gettimeofday((struct timeval *) &tv, (struct timezone *) NULL);
- sec = (int) tv.tv_sec;
- usec = (int) (tv.tv_usec % 0x100000);
-
- /* The max value usec can have is 0xF423F, so we use only five hex
- * digits for usecs.
- */
- if (more_entropy) {
- spprintf(&uniqid, 0, "%s%08x%05x%.8f", prefix, sec, usec, php_combined_lcg(TSRMLS_C) * 10);
- } else {
- spprintf(&uniqid, 0, "%s%08x%05x", prefix, sec, usec);
- }
-
- RETURN_STRING(uniqid, 0);
-}
-#endif
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/uniqid.h b/ext/standard/uniqid.h
deleted file mode 100644
index 480bdb66ad..0000000000
--- a/ext/standard/uniqid.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef UNIQID_H
-#define UNIQID_H
-
-#ifdef HAVE_GETTIMEOFDAY
-PHP_FUNCTION(uniqid);
-#endif
-
-#endif /* UNIQID_H */
diff --git a/ext/standard/url.c b/ext/standard/url.c
deleted file mode 100644
index 9ad6580caf..0000000000
--- a/ext/standard/url.c
+++ /dev/null
@@ -1,630 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-
-#include "php.h"
-
-#include "url.h"
-#ifdef _OSD_POSIX
-#ifndef APACHE
-#error On this EBCDIC platform, PHP is only supported as an Apache module.
-#else /*APACHE*/
-#ifndef CHARSET_EBCDIC
-#define CHARSET_EBCDIC /* this machine uses EBCDIC, not ASCII! */
-#endif
-#include "ebcdic.h"
-#endif /*APACHE*/
-#endif /*_OSD_POSIX*/
-
-/* {{{ free_url
- */
-PHPAPI void php_url_free(php_url *theurl)
-{
- if (theurl->scheme)
- efree(theurl->scheme);
- if (theurl->user)
- efree(theurl->user);
- if (theurl->pass)
- efree(theurl->pass);
- if (theurl->host)
- efree(theurl->host);
- if (theurl->path)
- efree(theurl->path);
- if (theurl->query)
- efree(theurl->query);
- if (theurl->fragment)
- efree(theurl->fragment);
- efree(theurl);
-}
-/* }}} */
-
-/* {{{ php_replace_controlchars
- */
-PHPAPI char *php_replace_controlchars(char *str)
-{
- unsigned char *s = (unsigned char *)str;
-
- if (!str) {
- return (NULL);
- }
-
- while (*s) {
-
- if (iscntrl(*s)) {
- *s='_';
- }
- s++;
- }
-
- return (str);
-}
-/* }}} */
-
-
-/* {{{ php_url_parse
- */
-PHPAPI php_url *php_url_parse(char *str)
-{
- int length = strlen(str);
- char port_buf[5];
- php_url *ret = ecalloc(1, sizeof(php_url));
- char *s, *e, *p, *pp, *ue;
-
- s = str;
- ue = s + length;
-
- /* parse scheme */
- if ((e = strchr(s, ':')) && (e-s)) {
- /*
- * certain schemas like mailto: and zlib: may not have any / after them
- * this check ensures we support those.
- */
- if (*(e+1) != '/') {
- /* check if the data we get is a port this allows us to
- * correctly parse things like a.com:80
- */
- p = e + 1;
- while (isdigit(*p)) {
- p++;
- }
-
- if ((*p) == '\0' || *p == '/') {
- goto parse_port;
- }
-
- ret->scheme = estrndup(s, (e-s));
- php_replace_controlchars(ret->scheme);
-
- length -= ++e - s;
- s = e;
- goto just_path;
- } else {
- ret->scheme = estrndup(s, (e-s));
- php_replace_controlchars(ret->scheme);
-
- if (*(e+2) == '/') {
- s = e + 3;
- if (!strncasecmp("file", ret->scheme, sizeof("file"))) {
- goto nohost;
- }
- } else {
- s = e + 1;
- if (!strncasecmp("file", ret->scheme, sizeof("file"))) {
- goto nohost;
- } else {
- length -= ++e - s;
- s = e;
- goto just_path;
- }
- }
- }
- } else if (e) { /* no scheme, look for port */
- parse_port:
- p = e + 1;
- pp = p;
-
- while (pp-p < 6 && isdigit(*pp)) {
- pp++;
- }
-
- if (pp-p < 6 && (*pp == '/' || *pp == '\0')) {
- memcpy(port_buf, p, (pp-p));
- port_buf[pp-p] = '\0';
- ret->port = atoi(port_buf);
- } else {
- goto just_path;
- }
- } else {
- just_path:
- ue = s + length;
- goto nohost;
- }
-
- e = ue;
-
- if (!(p = strchr(s, '/'))) {
- if ((p = strchr(s, '?'))) {
- e = p;
- }
- } else {
- e = p;
- }
-
- /* check for login and password */
- if ((p = memchr(s, '@', (e-s)))) {
- if ((pp = memchr(s, ':', (p-s)))) {
- if ((pp-s) > 0) {
- ret->user = estrndup(s, (pp-s));
- php_replace_controlchars(ret->user);
- }
-
- pp++;
- if (p-pp > 0) {
- ret->pass = estrndup(pp, (p-pp));
- php_replace_controlchars(ret->pass);
- }
- } else {
- ret->user = estrndup(s, (p-s));
- php_replace_controlchars(ret->user);
- }
-
- s = p + 1;
- }
-
- /* check for port */
- if ((p = memchr(s, ':', (e-s)))) {
- if (!ret->port) {
- p++;
- if ( e-p > 5 || e-p < 1 ) { /* port cannot be longer then 5 characters */
- STR_FREE(ret->scheme);
- STR_FREE(ret->user);
- STR_FREE(ret->pass);
- efree(ret);
- return NULL;
- }
-
- memcpy(port_buf, p, (e-p));
- port_buf[e-p] = '\0';
- ret->port = atoi(port_buf);
- p--;
- }
- } else {
- p = e;
- }
-
- /* check if we have a valid host, if we don't reject the string as url */
- if ((p-s) < 1) {
- STR_FREE(ret->scheme);
- STR_FREE(ret->user);
- STR_FREE(ret->pass);
- efree(ret);
- return NULL;
- }
-
- ret->host = estrndup(s, (p-s));
- php_replace_controlchars(ret->host);
-
- if (e == ue) {
- return ret;
- }
-
- s = e;
-
- nohost:
-
- if ((p = strchr(s, '?'))) {
- pp = strchr(s, '#');
-
- if (pp && pp < p) {
- p = pp;
- pp = strchr(pp+2, '#');
- }
-
- if (p - s) {
- ret->path = estrndup(s, (p-s));
- php_replace_controlchars(ret->path);
- }
-
- if (pp) {
- if (pp - ++p) {
- ret->query = estrndup(p, (pp-p));
- php_replace_controlchars(ret->query);
- }
- p = pp;
- goto label_parse;
- } else if (++p - ue) {
- ret->query = estrndup(p, (ue-p));
- php_replace_controlchars(ret->query);
- }
- } else if ((p = strchr(s, '#'))) {
- if (p - s) {
- ret->path = estrndup(s, (p-s));
- php_replace_controlchars(ret->path);
- }
-
- label_parse:
- p++;
-
- if (ue - p) {
- ret->fragment = estrndup(p, (ue-p));
- php_replace_controlchars(ret->fragment);
- }
- } else {
- ret->path = estrndup(s, (ue-s));
- php_replace_controlchars(ret->path);
- }
-
- return ret;
-}
-/* }}} */
-
-/* {{{ proto array parse_url(string url)
- Parse a URL and return its components */
-PHP_FUNCTION(parse_url)
-{
- char *str;
- int str_len;
- php_url *resource;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
- return;
- }
-
- resource = php_url_parse(str);
- if (resource == NULL) {
- php_error_docref1(NULL TSRMLS_CC, str, E_WARNING, "Unable to parse url");
- RETURN_FALSE;
- }
-
- /* allocate an array for return */
- array_init(return_value);
-
- /* add the various elements to the array */
- if (resource->scheme != NULL)
- add_assoc_string(return_value, "scheme", resource->scheme, 1);
- if (resource->host != NULL)
- add_assoc_string(return_value, "host", resource->host, 1);
- if (resource->port != 0)
- add_assoc_long(return_value, "port", resource->port);
- if (resource->user != NULL)
- add_assoc_string(return_value, "user", resource->user, 1);
- if (resource->pass != NULL)
- add_assoc_string(return_value, "pass", resource->pass, 1);
- if (resource->path != NULL)
- add_assoc_string(return_value, "path", resource->path, 1);
- if (resource->query != NULL)
- add_assoc_string(return_value, "query", resource->query, 1);
- if (resource->fragment != NULL)
- add_assoc_string(return_value, "fragment", resource->fragment, 1);
-
- php_url_free(resource);
-}
-/* }}} */
-
-/* {{{ php_htoi
- */
-static int php_htoi(char *s)
-{
- int value;
- int c;
-
- c = s[0];
- if (isupper(c))
- c = tolower(c);
- value = (c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10) * 16;
-
- c = s[1];
- if (isupper(c))
- c = tolower(c);
- value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10;
-
- return (value);
-}
-/* }}} */
-
-/* rfc1738:
-
- ...The characters ";",
- "/", "?", ":", "@", "=" and "&" are the characters which may be
- reserved for special meaning within a scheme...
-
- ...Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
- reserved characters used for their reserved purposes may be used
- unencoded within a URL...
-
- For added safety, we only leave -_. unencoded.
- */
-
-static unsigned char hexchars[] = "0123456789ABCDEF";
-
-/* {{{ php_url_encode
- */
-PHPAPI char *php_url_encode(char *s, int len, int *new_length)
-{
- register unsigned char c;
- unsigned char *to, *from, *start;
- unsigned char *end;
-
- from = s;
- end = s + len;
- start = to = (unsigned char *) emalloc(3 * len + 1);
-
- while (from < end) {
- c = *from++;
-
- if (c == ' ') {
- *to++ = '+';
-#ifndef CHARSET_EBCDIC
- } else if ((c < '0' && c != '-' && c != '.') ||
- (c < 'A' && c > '9') ||
- (c > 'Z' && c < 'a' && c != '_') ||
- (c > 'z')) {
- to[0] = '%';
- to[1] = hexchars[(unsigned char) c >> 4];
- to[2] = hexchars[(unsigned char) c & 15];
- to += 3;
-#else /*CHARSET_EBCDIC*/
- } else if (!isalnum(c) && strchr("_-.", c) == NULL) {
- /* Allow only alphanumeric chars and '_', '-', '.'; escape the rest */
- to[0] = '%';
- to[1] = hexchars[os_toascii[(unsigned char) c] >> 4];
- to[2] = hexchars[os_toascii[(unsigned char) c] & 15];
- to += 3;
-#endif /*CHARSET_EBCDIC*/
- } else {
- *to++ = c;
- }
- }
- *to = 0;
- if (new_length) {
- *new_length = to - start;
- }
- return (char *) start;
-}
-/* }}} */
-
-/* {{{ proto string urlencode(string str)
- URL-encodes string */
-PHP_FUNCTION(urlencode)
-{
- char *in_str, *out_str;
- int in_str_len, out_str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str,
- &in_str_len) == FAILURE) {
- return;
- }
-
- out_str = php_url_encode(in_str, in_str_len, &out_str_len);
- RETURN_STRINGL(out_str, out_str_len, 0);
-}
-/* }}} */
-
-/* {{{ proto string urldecode(string str)
- Decodes URL-encoded string */
-PHP_FUNCTION(urldecode)
-{
- char *in_str, *out_str;
- int in_str_len, out_str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str,
- &in_str_len) == FAILURE) {
- return;
- }
-
- out_str = estrndup(in_str, in_str_len);
- out_str_len = php_url_decode(out_str, in_str_len);
-
- RETURN_STRINGL(out_str, out_str_len, 0);
-}
-/* }}} */
-
-/* {{{ php_url_decode
- */
-PHPAPI int php_url_decode(char *str, int len)
-{
- char *dest = str;
- char *data = str;
-
- while (len--) {
- if (*data == '+')
- *dest = ' ';
- else if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && isxdigit((int) *(data + 2))) {
-#ifndef CHARSET_EBCDIC
- *dest = (char) php_htoi(data + 1);
-#else
- *dest = os_toebcdic[(char) php_htoi(data + 1)];
-#endif
- data += 2;
- len -= 2;
- } else
- *dest = *data;
- data++;
- dest++;
- }
- *dest = '\0';
- return dest - str;
-}
-/* }}} */
-
-/* {{{ php_raw_url_encode
- */
-PHPAPI char *php_raw_url_encode(char *s, int len, int *new_length)
-{
- register int x, y;
- unsigned char *str;
-
- str = (unsigned char *) emalloc(3 * len + 1);
- for (x = 0, y = 0; len--; x++, y++) {
- str[y] = (unsigned char) s[x];
-#ifndef CHARSET_EBCDIC
- if ((str[y] < '0' && str[y] != '-' && str[y] != '.') ||
- (str[y] < 'A' && str[y] > '9') ||
- (str[y] > 'Z' && str[y] < 'a' && str[y] != '_') ||
- (str[y] > 'z')) {
- str[y++] = '%';
- str[y++] = hexchars[(unsigned char) s[x] >> 4];
- str[y] = hexchars[(unsigned char) s[x] & 15];
-#else /*CHARSET_EBCDIC*/
- if (!isalnum(str[y]) && strchr("_-.", str[y]) != NULL) {
- str[y++] = '%';
- str[y++] = hexchars[os_toascii[(unsigned char) s[x]] >> 4];
- str[y] = hexchars[os_toascii[(unsigned char) s[x]] & 15];
-#endif /*CHARSET_EBCDIC*/
- }
- }
- str[y] = '\0';
- if (new_length) {
- *new_length = y;
- }
- return ((char *) str);
-}
-/* }}} */
-
-/* {{{ proto string rawurlencode(string str)
- URL-encodes string */
-PHP_FUNCTION(rawurlencode)
-{
- char *in_str, *out_str;
- int in_str_len, out_str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str,
- &in_str_len) == FAILURE) {
- return;
- }
-
- out_str = php_raw_url_encode(in_str, in_str_len, &out_str_len);
- RETURN_STRINGL(out_str, out_str_len, 0);
-}
-/* }}} */
-
-/* {{{ proto string rawurldecode(string str)
- Decodes URL-encodes string */
-PHP_FUNCTION(rawurldecode)
-{
- char *in_str, *out_str;
- int in_str_len, out_str_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str,
- &in_str_len) == FAILURE) {
- return;
- }
-
- out_str = estrndup(in_str, in_str_len);
- out_str_len = php_raw_url_decode(out_str, in_str_len);
-
- RETURN_STRINGL(out_str, out_str_len, 0);
-}
-/* }}} */
-
-/* {{{ php_raw_url_decode
- */
-PHPAPI int php_raw_url_decode(char *str, int len)
-{
- char *dest = str;
- char *data = str;
-
- while (len--) {
- if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && isxdigit((int) *(data + 2))) {
-#ifndef CHARSET_EBCDIC
- *dest = (char) php_htoi(data + 1);
-#else
- *dest = os_toebcdic[(char) php_htoi(data + 1)];
-#endif
- data += 2;
- len -= 2;
- } else
- *dest = *data;
- data++;
- dest++;
- }
- *dest = '\0';
- return dest - str;
-}
-/* }}} */
-
-/* {{{ proto array get_headers(string url)
- fetches all the headers sent by the server in response to a HTTP request */
-PHP_FUNCTION(get_headers)
-{
- char *url, *url_len;
- php_stream_context *context = NULL;
- php_stream *stream;
- zval **prev_val, **hdr = NULL;
- HashPosition pos;
- long format = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &url, &url_len, &format) == FAILURE) {
- return;
- }
-
- if (!(stream = php_stream_open_wrapper_ex(url, "r", REPORT_ERRORS | STREAM_USE_URL | STREAM_ONLY_GET_HEADERS, NULL, context))) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- zend_hash_internal_pointer_reset_ex(HASH_OF(stream->wrapperdata), &pos);
- while (zend_hash_get_current_data_ex(HASH_OF(stream->wrapperdata), (void**)&hdr, &pos) != FAILURE) {
- if (!format) {
-no_name_header:
- add_next_index_stringl(return_value, Z_STRVAL_PP(hdr), Z_STRLEN_PP(hdr), 1);
- } else {
- char c;
- char *s, *p;
-
- if ((p = strchr(Z_STRVAL_PP(hdr), ':'))) {
- c = *p;
- *p = '\0';
- s = p + 1;
- while (isspace(*s)) {
- s++;
- }
-
- if (zend_hash_find(HASH_OF(return_value), Z_STRVAL_PP(hdr), (p - Z_STRVAL_PP(hdr) + 1), (void **) &prev_val) == FAILURE) {
- add_assoc_stringl_ex(return_value, Z_STRVAL_PP(hdr), (p - Z_STRVAL_PP(hdr) + 1), s, (Z_STRLEN_PP(hdr) - (s - Z_STRVAL_PP(hdr))), 1);
- } else { /* some headers may occur more then once, therefor we need to remake the string into an array */
- convert_to_array(*prev_val);
- add_next_index_stringl(*prev_val, s, (Z_STRLEN_PP(hdr) - (s - Z_STRVAL_PP(hdr))), 1);
- }
-
- *p = c;
- } else {
- goto no_name_header;
- }
- }
- zend_hash_move_forward_ex(HASH_OF(stream->wrapperdata), &pos);
- }
-
- php_stream_close(stream);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/url.h b/ext/standard/url.h
deleted file mode 100644
index 2a3b980be0..0000000000
--- a/ext/standard/url.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef URL_H
-#define URL_H
-
-typedef struct php_url {
- char *scheme;
- char *user;
- char *pass;
- char *host;
- unsigned short port;
- char *path;
- char *query;
- char *fragment;
-} php_url;
-
-PHPAPI void php_url_free(php_url *theurl);
-PHPAPI php_url *php_url_parse(char *str);
-PHPAPI int php_url_decode(char *str, int len); /* return value: length of decoded string */
-PHPAPI int php_raw_url_decode(char *str, int len); /* return value: length of decoded string */
-PHPAPI char *php_url_encode(char *s, int len, int *new_length);
-PHPAPI char *php_raw_url_encode(char *s, int len, int *new_length);
-
-PHP_FUNCTION(parse_url);
-PHP_FUNCTION(urlencode);
-PHP_FUNCTION(urldecode);
-PHP_FUNCTION(rawurlencode);
-PHP_FUNCTION(rawurldecode);
-PHP_FUNCTION(get_headers);
-
-#endif /* URL_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/url_scanner.c b/ext/standard/url_scanner.c
deleted file mode 100644
index b77931eaa5..0000000000
--- a/ext/standard/url_scanner.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-
-#include "php_globals.h"
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "basic_functions.h"
-#include "url_scanner.h"
-
-#ifndef BUFSIZE
-#define BUFSIZE 256
-#endif
-
-int php_url_scanner_activate(TSRMLS_D)
-{
- url_adapt(NULL,0,NULL,NULL);
- return SUCCESS;
-}
-
-
-int php_url_scanner_deactivate(TSRMLS_D)
-{
- url_adapt(NULL,0,NULL,NULL);
- return SUCCESS;
-}
-
-/* {{{ url_attr_addon
- */
-static char *url_attr_addon(const char *tag,const char *attr,const char *val,const char *buf)
-{
- int flag = 0;
- TSRMLS_FETCH();
-
- if(!strcasecmp(tag,"a") && !strcasecmp(attr,"href")) {
- flag = 1;
- } else if(!strcasecmp(tag,"area" ) && !strcasecmp(attr,"href" )) {
- flag = 1;
- } else if(!strcasecmp(tag,"form" ) && !strcasecmp(attr,"action" )) {
- flag = 1;
- } else if(!strcasecmp(tag,"frame") && !strcasecmp(attr,"source" )) {
- flag = 1;
- } else if(!strcasecmp(tag,"img" ) && !strcasecmp(attr,"action" )) {
- flag = 1;
- }
- if(flag) {
- if(!strstr(val,buf)&&!strchr(val,':'))
- {
- char *result = (char *)emalloc(strlen(buf)+strlen(PG(arg_separator).output)+1);
- int n;
-
- if(strchr(val,'?')) {
- strcpy(result,PG(arg_separator).output);
- n=strlen(PG(arg_separator).output);
- } else {
- *result='?';
- n=1;
- }
- strcpy(result+n,buf);
- return result;
- }
- }
- return NULL;
-}
-/* }}} */
-
-#define US BG(url_adapt_state)
-
-/* {{{ url_adapt_ext
- */
-char *url_adapt_ext(const char *src, uint srclen, const char *name, const char *val, size_t *newlen)
-{
- char buf[1024];
-
- snprintf(buf, sizeof(buf)-1, "%s=%s", name, val);
-
- return url_adapt(src, srclen, buf, newlen);
-}
-/* }}} */
-
-/* {{{ url_adapt
- */
-char *url_adapt(const char *src, size_t srclen, const char *data, size_t *newlen)
-{
- char *out,*outp;
- int maxl,n;
- TSRMLS_FETCH();
-
- if(src==NULL) {
- US.state=STATE_NORMAL;
- if(US.tag) { efree(US.tag); US.tag =NULL; }
- if(US.attr) { efree(US.attr); US.attr=NULL; }
- if(US.val) { efree(US.val); US.val =NULL; }
- return NULL;
- }
-
- if(srclen==0)
- srclen=strlen(src);
-
- out=malloc(srclen+1);
- maxl=srclen;
- n=srclen;
-
- *newlen=0;
- outp=out;
-
- while(n--) {
- switch(US.state) {
- case STATE_NORMAL:
- if(*src=='<')
- US.state=STATE_TAG_START;
- break;
-
- case STATE_TAG_START:
- if(! isalnum(*src))
- US.state=STATE_NORMAL;
- US.state=STATE_TAG;
- US.ml=BUFSIZE;
- US.p=US.tag=erealloc(US.tag,US.ml);
- *(US.p)++=*src;
- US.l=1;
- break;
-
- case STATE_TAG:
- if(isalnum(*src)) {
- *(US.p)++ = *src;
- US.l++;
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.tag=erealloc(US.tag,US.ml);
- US.p = US.tag+US.l;
- }
- } else if (isspace(*src)) {
- US.state = STATE_IN_TAG;
- *US.p='\0';
- US.tag=erealloc(US.tag,US.l);
- } else {
- US.state = STATE_NORMAL;
- efree(US.tag);
- US.tag=NULL;
- }
- break;
-
- case STATE_IN_TAG:
- if(isalnum(*src)) {
- US.state=STATE_TAG_ATTR;
- US.ml=BUFSIZE;
- US.p=US.attr=erealloc(US.attr,US.ml);
- *(US.p)++=*src;
- US.l=1;
- } else if (! isspace(*src)) {
- US.state = STATE_NORMAL;
- efree(US.tag);
- US.tag=NULL;
- }
- break;
-
- case STATE_TAG_ATTR:
- if(isalnum(*src)) {
- *US.p++=*src;
- ++US.l;
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.attr=erealloc(US.attr,US.ml);
- US.p = US.attr+US.l;
- }
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.attr=erealloc(US.attr,US.ml);
- US.p = US.attr+US.l;
- }
- } else if(isspace(*src)||(*src=='=')){
- US.state=STATE_TAG_IS;
- *US.p=0;
- US.attr=erealloc(US.attr,US.l);
- } else if(*src=='>') {
- US.state=STATE_NORMAL;
- } else {
- efree(US.attr);
- US.attr=NULL;
- US.state=STATE_IN_TAG;
- }
- break;
-
- case STATE_TAG_IS:
- case STATE_TAG_IS2:
- if(*src=='>'){
- US.state=STATE_NORMAL;
- if(! (US.attr_done)) {
- char *p;
- p=url_attr_addon(US.tag,US.attr,"",data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strcpy(outp,p);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- } else if(*src=='#') {
- if(! (US.attr_done)) {
- char *p;
- US.attr_done=1;
- p=url_attr_addon(US.tag,US.attr,"#",data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strcpy(outp,p);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- } else if(!isspace(*src)&&(*src!='=')) {
- US.ml=BUFSIZE;
- US.p=US.val=erealloc(US.val,US.ml);
- US.l=0;
- US.attr_done=0;
- if((*src=='"')||(*src=='\'')) {
- US.state=STATE_TAG_QVAL2;
- US.delim=*src;
- } else {
- US.state=STATE_TAG_VAL;
- *US.p++=*src;
- US.l++;
- }
- }
- break;
-
-
- case STATE_TAG_QVAL2:
- if(*src=='#') {
- if(! (US.attr_done)) {
- char *p;
- US.attr_done=1;
- *US.p='\0';
- p=url_attr_addon(US.tag,US.attr,US.val,data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strcpy(outp,p);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- } else if(*src==US.delim) {
- US.state=STATE_IN_TAG;
- *US.p='\0';
- if(! (US.attr_done)) {
- char *p;
- p=url_attr_addon(US.tag,US.attr,US.val,data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strcpy(outp,p);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- break;
- } else if(*src=='\\') {
- US.state=STATE_TAG_QVAL2b;
- } else if (*src=='>') {
- US.state=STATE_NORMAL;
- }
-
- *US.p++=*src;
- ++US.l;
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.val=erealloc(US.val,US.ml);
- US.p = US.val+US.l;
- }
-
- break;
-
- case STATE_TAG_QVAL2b:
- US.state=STATE_TAG_QVAL2;
- *US.p++=*src;
- ++US.l;
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.val=erealloc(US.val,US.ml);
- US.p = US.val+US.l;
- }
- break;
-
- case STATE_TAG_VAL:
- case STATE_TAG_VAL2:
- if(*src=='#') {
- if(! (US.attr_done)) {
- char *p;
- US.attr_done=1;
- *US.p='\0';
- p=url_attr_addon(US.tag,US.attr,US.val,data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strcpy(outp,p);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- } else if(isspace(*src)||(*src=='>')) {
- US.state=(*src=='>')?STATE_NORMAL:STATE_IN_TAG;
- *US.p='\0';
- if(! (US.attr_done)) {
- char *p;
- p=url_attr_addon(US.tag,US.attr,US.val,data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strcpy(outp,p);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- } else {
- *US.p++=*src;
- US.l++;
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.val=erealloc(US.val,US.ml);
- US.p = US.val+US.l;
- }
- }
- break;
- default:
- break;
- }
-
- *outp++=*src++;
- *newlen+=1;
- }
- *outp='\0';
- return out;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/url_scanner.h b/ext/standard/url_scanner.h
deleted file mode 100644
index daf78a0778..0000000000
--- a/ext/standard/url_scanner.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef URI_SCANNER_H
-#define URI_SCANNER_H
-
-int php_url_scanner_activate(TSRMLS_D);
-int php_url_scanner_deactivate(TSRMLS_D);
-
-char *url_adapt(const char *src, size_t srclen, const char *data, size_t *newlen);
-
-enum url_state {
- STATE_NORMAL,
- STATE_TAG_START,
- STATE_TAG,
- STATE_IN_TAG,
- STATE_TAG_ATTR,
- STATE_TAG_IS,
- STATE_TAG_IS2,
- STATE_TAG_VAL,
- STATE_TAG_VAL2,
- STATE_TAG_QVAL1,
- STATE_TAG_QVAL2,
- STATE_TAG_QVAL2b
-};
-
-typedef struct url_adapt_struct {
- enum url_state state;
- char *tag;
- char *attr;
- char *val;
- char delim;
- char *p;
- int l, ml;
- int attr_done;
-} url_adapt_state_t;
-
-#endif
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
deleted file mode 100644
index f82dbce2ed..0000000000
--- a/ext/standard/url_scanner_ex.c
+++ /dev/null
@@ -1,1018 +0,0 @@
-/* Generated by re2c 0.5 on Thu Apr 17 05:49:48 2003 */
-#line 1 "url_scanner_ex.re"
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-#include "php.h"
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "php_ini.h"
-#include "php_globals.h"
-#define STATE_TAG SOME_OTHER_STATE_TAG
-#include "basic_functions.h"
-#include "url.h"
-#undef STATE_TAG
-
-#define url_scanner url_scanner_ex
-
-#include "php_smart_str.h"
-
-static PHP_INI_MH(OnUpdateTags)
-{
- url_adapt_state_ex_t *ctx;
- char *key;
- char *lasts;
- char *tmp;
-
- ctx = &BG(url_adapt_state_ex);
-
- tmp = estrndup(new_value, new_value_length);
-
- if (ctx->tags)
- zend_hash_destroy(ctx->tags);
- else
- ctx->tags = malloc(sizeof(HashTable));
-
- zend_hash_init(ctx->tags, 0, NULL, NULL, 1);
-
- for (key = php_strtok_r(tmp, ",", &lasts);
- key;
- key = php_strtok_r(NULL, ",", &lasts)) {
- char *val;
-
- val = strchr(key, '=');
- if (val) {
- char *q;
- int keylen;
-
- *val++ = '\0';
- for (q = key; *q; q++)
- *q = tolower(*q);
- keylen = q - key;
- /* key is stored withOUT NUL
- val is stored WITH NUL */
- zend_hash_add(ctx->tags, key, keylen, val, strlen(val)+1, NULL);
- }
- }
-
- efree(tmp);
-
- return SUCCESS;
-}
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("url_rewriter.tags", "a=href,area=href,frame=src,form=,fieldset=", PHP_INI_ALL, OnUpdateTags, url_adapt_state_ex, php_basic_globals, basic_globals)
-PHP_INI_END()
-
-#line 95
-
-
-#define YYFILL(n) goto done
-#define YYCTYPE unsigned char
-#define YYCURSOR p
-#define YYLIMIT q
-#define YYMARKER r
-
-static inline void append_modified_url(smart_str *url, smart_str *dest, smart_str *url_app, const char *separator)
-{
- register const char *p, *q;
- const char *bash = NULL;
- const char *sep = "?";
-
- q = (p = url->c) + url->len;
-
-scan:
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- static unsigned char yybm[] = {
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 0, 128, 128, 128, 128, 0,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- };
- goto yy0;
-yy1: ++YYCURSOR;
-yy0:
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- if(yybm[0+yych] & 128) goto yy8;
- if(yych <= '9') goto yy6;
- if(yych >= ';') goto yy4;
-yy2: yych = *++YYCURSOR;
-yy3:
-#line 113
- { smart_str_append(dest, url); return; }
-yy4: yych = *++YYCURSOR;
-yy5:
-#line 114
- { sep = separator; goto scan; }
-yy6: yych = *++YYCURSOR;
-yy7:
-#line 115
- { bash = p - 1; goto done; }
-yy8: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy9: if(yybm[0+yych] & 128) goto yy8;
-yy10:
-#line 116
- { goto scan; }
-}
-#line 117
-
-done:
-
- /* Don't modify URLs of the format "#mark" */
- if (bash && bash - url->c == 0) {
- smart_str_append(dest, url);
- return;
- }
-
- if (bash)
- smart_str_appendl(dest, url->c, bash - url->c);
- else
- smart_str_append(dest, url);
-
- smart_str_appends(dest, sep);
- smart_str_append(dest, url_app);
-
- if (bash)
- smart_str_appendl(dest, bash, q - bash);
-}
-
-
-#undef YYFILL
-#undef YYCTYPE
-#undef YYCURSOR
-#undef YYLIMIT
-#undef YYMARKER
-
-static inline void tag_arg(url_adapt_state_ex_t *ctx, char quotes, char type TSRMLS_DC)
-{
- char f = 0;
-
- if (strncasecmp(ctx->arg.c, ctx->lookup_data, ctx->arg.len) == 0)
- f = 1;
-
- if (quotes)
- smart_str_appendc(&ctx->result, type);
- if (f) {
- append_modified_url(&ctx->val, &ctx->result, &ctx->url_app, PG(arg_separator).output);
- } else {
- smart_str_append(&ctx->result, &ctx->val);
- }
- if (quotes)
- smart_str_appendc(&ctx->result, type);
-}
-
-enum {
- STATE_PLAIN = 0,
- STATE_TAG,
- STATE_NEXT_ARG,
- STATE_ARG,
- STATE_BEFORE_VAL,
- STATE_VAL
-};
-
-#define YYFILL(n) goto stop
-#define YYCTYPE unsigned char
-#define YYCURSOR xp
-#define YYLIMIT end
-#define YYMARKER q
-#define STATE ctx->state
-
-#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR TSRMLS_DC
-#define STD_ARGS ctx, start, xp TSRMLS_CC
-
-#if SCANNER_DEBUG
-#define scdebug(x) printf x
-#else
-#define scdebug(x)
-#endif
-
-static inline void passthru(STD_PARA)
-{
- scdebug(("appending %d chars, starting with %c\n", YYCURSOR-start, *start));
- smart_str_appendl(&ctx->result, start, YYCURSOR - start);
-}
-
-/*
- * This function appends a hidden input field after a <form> or
- * <fieldset>. The latter is important for XHTML.
- */
-
-static void handle_form(STD_PARA)
-{
- int doit = 0;
-
- if (ctx->form_app.len > 0) {
- switch (ctx->tag.len) {
-
-#define RECOGNIZE(x) do { \
- case sizeof(x)-1: \
- if (strncasecmp(ctx->tag.c, x, sizeof(x)-1) == 0) \
- doit = 1; \
- break; \
-} while (0)
-
- RECOGNIZE("form");
- RECOGNIZE("fieldset");
- }
-
- if (doit)
- smart_str_append(&ctx->result, &ctx->form_app);
- }
-}
-
-
-
-/*
- * HANDLE_TAG copies the HTML Tag and checks whether we
- * have that tag in our table. If we might modify it,
- * we continue to scan the tag, otherwise we simply copy the complete
- * HTML stuff to the result buffer.
- */
-
-static inline void handle_tag(STD_PARA)
-{
- int ok = 0;
- int i;
-
- ctx->tag.len = 0;
- smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
- for (i = 0; i < ctx->tag.len; i++)
- ctx->tag.c[i] = tolower((int)(unsigned char)ctx->tag.c[i]);
- if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS)
- ok = 1;
- STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN;
-}
-
-static inline void handle_arg(STD_PARA)
-{
- ctx->arg.len = 0;
- smart_str_appendl(&ctx->arg, start, YYCURSOR - start);
-}
-
-static inline void handle_val(STD_PARA, char quotes, char type)
-{
- smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2);
- tag_arg(ctx, quotes, type TSRMLS_CC);
-}
-
-static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen TSRMLS_DC)
-{
- char *end, *q;
- char *xp;
- char *start;
- int rest;
-
- smart_str_appendl(&ctx->buf, newdata, newlen);
-
- YYCURSOR = ctx->buf.c;
- YYLIMIT = ctx->buf.c + ctx->buf.len;
-
- switch (STATE) {
- case STATE_PLAIN: goto state_plain;
- case STATE_TAG: goto state_tag;
- case STATE_NEXT_ARG: goto state_next_arg;
- case STATE_ARG: goto state_arg;
- case STATE_BEFORE_VAL: goto state_before_val;
- case STATE_VAL: goto state_val;
- }
-
-
-state_plain_begin:
- STATE = STATE_PLAIN;
-
-state_plain:
- start = YYCURSOR;
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- static unsigned char yybm[] = {
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 0, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- };
- goto yy11;
-yy12: ++YYCURSOR;
-yy11:
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- if(yybm[0+yych] & 128) goto yy15;
-yy13: yych = *++YYCURSOR;
-yy14:
-#line 285
- { passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; }
-yy15: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy16: if(yybm[0+yych] & 128) goto yy15;
-yy17:
-#line 286
- { passthru(STD_ARGS); goto state_plain; }
-}
-#line 287
-
-
-state_tag:
- start = YYCURSOR;
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
- goto yy18;
-yy19: ++YYCURSOR;
-yy18:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- if(yych <= '@') goto yy22;
- if(yych <= 'Z') goto yy20;
- if(yych <= '`') goto yy22;
- if(yych >= '{') goto yy22;
-yy20: yych = *++YYCURSOR;
- goto yy25;
-yy21:
-#line 292
- { handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; }
-yy22: yych = *++YYCURSOR;
-yy23:
-#line 293
- { passthru(STD_ARGS); goto state_plain_begin; }
-yy24: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy25: if(yybm[0+yych] & 128) goto yy24;
- goto yy21;
-}
-#line 294
-
-
-state_next_arg_begin:
- STATE = STATE_NEXT_ARG;
-
-state_next_arg:
- start = YYCURSOR;
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 128, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
- goto yy26;
-yy27: ++YYCURSOR;
-yy26:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- if(yych <= '='){
- if(yych <= '\v'){
- if(yych <= '\b') goto yy34;
- goto yy30;
- } else {
- if(yych == ' ') goto yy30;
- goto yy34;
- }
- } else {
- if(yych <= 'Z'){
- if(yych <= '>') goto yy28;
- if(yych <= '@') goto yy34;
- goto yy32;
- } else {
- if(yych <= '`') goto yy34;
- if(yych <= 'z') goto yy32;
- goto yy34;
- }
- }
-yy28: yych = *++YYCURSOR;
-yy29:
-#line 302
- { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
-yy30: yych = *++YYCURSOR;
- goto yy37;
-yy31:
-#line 303
- { passthru(STD_ARGS); goto state_next_arg; }
-yy32: yych = *++YYCURSOR;
-yy33:
-#line 304
- { --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
-yy34: yych = *++YYCURSOR;
-yy35:
-#line 305
- { passthru(STD_ARGS); goto state_plain_begin; }
-yy36: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy37: if(yybm[0+yych] & 128) goto yy36;
- goto yy31;
-}
-#line 306
-
-
-state_arg:
- start = YYCURSOR;
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 128, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
- goto yy38;
-yy39: ++YYCURSOR;
-yy38:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- if(yych <= '@') goto yy42;
- if(yych <= 'Z') goto yy40;
- if(yych <= '`') goto yy42;
- if(yych >= '{') goto yy42;
-yy40: yych = *++YYCURSOR;
- goto yy45;
-yy41:
-#line 311
- { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; }
-yy42: yych = *++YYCURSOR;
-yy43:
-#line 312
- { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; }
-yy44: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy45: if(yybm[0+yych] & 128) goto yy44;
- goto yy41;
-}
-#line 313
-
-
-state_before_val:
- start = YYCURSOR;
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 128, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
- goto yy46;
-yy47: ++YYCURSOR;
-yy46:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- if(yych == ' ') goto yy48;
- if(yych == '=') goto yy50;
- goto yy52;
-yy48: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if(yych == ' ') goto yy55;
- if(yych == '=') goto yy53;
-yy49:
-#line 319
- { --YYCURSOR; goto state_next_arg_begin; }
-yy50: yych = *++YYCURSOR;
- goto yy54;
-yy51:
-#line 318
- { passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; }
-yy52: yych = *++YYCURSOR;
- goto yy49;
-yy53: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy54: if(yybm[0+yych] & 128) goto yy53;
- goto yy51;
-yy55: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy56: if(yych == ' ') goto yy55;
- if(yych == '=') goto yy53;
-yy57: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy49;
- }
-}
-#line 320
-
-
-
-state_val:
- start = YYCURSOR;
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- static unsigned char yybm[] = {
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 160, 160, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 160, 248, 56, 248, 248, 248, 248, 200,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 0, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- };
- goto yy58;
-yy59: ++YYCURSOR;
-yy58:
- if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
- yych = *YYCURSOR;
- if(yych <= '!'){
- if(yych <= '\n'){
- if(yych <= '\b') goto yy63;
- goto yy64;
- } else {
- if(yych == ' ') goto yy64;
- goto yy63;
- }
- } else {
- if(yych <= '\''){
- if(yych <= '"') goto yy60;
- if(yych <= '&') goto yy63;
- goto yy62;
- } else {
- if(yych == '>') goto yy64;
- goto yy63;
- }
- }
-yy60: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy77;
-yy61:
-#line 328
- { handle_val(STD_ARGS, 0, '\0'); goto state_next_arg_begin; }
-yy62: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy69;
-yy63: yych = *++YYCURSOR;
- goto yy67;
-yy64: yych = *++YYCURSOR;
-yy65:
-#line 329
- { passthru(STD_ARGS); goto state_next_arg_begin; }
-yy66: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy67: if(yybm[0+yych] & 8) goto yy66;
- goto yy61;
-yy68: yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy69: if(yybm[0+yych] & 16) goto yy68;
- if(yych <= '&') goto yy72;
- if(yych >= '(') goto yy61;
-yy70: yych = *++YYCURSOR;
- if(yybm[0+yych] & 8) goto yy66;
-yy71:
-#line 327
- { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
-yy72: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy73: if(yybm[0+yych] & 32) goto yy72;
- if(yych <= '=') goto yy75;
-yy74: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy61;
- }
-yy75: yych = *++YYCURSOR;
- goto yy71;
-yy76: yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy77: if(yybm[0+yych] & 64) goto yy76;
- if(yych <= '!') goto yy80;
- if(yych >= '#') goto yy61;
-yy78: yych = *++YYCURSOR;
- if(yybm[0+yych] & 8) goto yy66;
-yy79:
-#line 326
- { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
-yy80: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy81: if(yybm[0+yych] & 128) goto yy80;
- if(yych >= '>') goto yy74;
-yy82: yych = *++YYCURSOR;
- goto yy79;
-}
-#line 330
-
-
-stop:
- rest = YYLIMIT - start;
- scdebug(("stopped in state %d at pos %d (%d:%c) %d\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *YYCURSOR, rest));
- /* XXX: Crash avoidance. Need to work with reporter to figure out what goes wrong */
- if (rest < 0) rest = 0;
-
- if (rest) memmove(ctx->buf.c, start, rest);
- ctx->buf.len = rest;
-}
-
-char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen TSRMLS_DC)
-{
- smart_str surl = {0};
- smart_str buf = {0};
- smart_str url_app = {0};
-
- smart_str_setl(&surl, url, urllen);
-
- smart_str_appends(&url_app, name);
- smart_str_appendc(&url_app, '=');
- smart_str_appends(&url_app, value);
-
- append_modified_url(&surl, &buf, &url_app, PG(arg_separator).output);
-
- smart_str_0(&buf);
- if (newlen) *newlen = buf.len;
-
- smart_str_free(&url_app);
-
- return buf.c;
-}
-
-
-static char *url_adapt_ext(const char *src, size_t srclen, size_t *newlen, zend_bool do_flush TSRMLS_DC)
-{
- url_adapt_state_ex_t *ctx;
- char *retval;
-
- ctx = &BG(url_adapt_state_ex);
-
- xx_mainloop(ctx, src, srclen TSRMLS_CC);
-
- *newlen = ctx->result.len;
- if (!ctx->result.c) {
- smart_str_appendl(&ctx->result, "", 0);
- }
- smart_str_0(&ctx->result);
- if (do_flush) {
- smart_str_appendl(&ctx->result, ctx->buf.c, ctx->buf.len);
- *newlen += ctx->buf.len;
- smart_str_free(&ctx->buf);
- }
- retval = ctx->result.c;
- ctx->result.c = NULL;
- ctx->result.len = 0;
- return retval;
-}
-
-int php_url_scanner_ex_activate(TSRMLS_D)
-{
- url_adapt_state_ex_t *ctx;
-
- ctx = &BG(url_adapt_state_ex);
-
- memset(ctx, 0, ((size_t) &((url_adapt_state_ex_t *)0)->tags));
-
- return SUCCESS;
-}
-
-int php_url_scanner_ex_deactivate(TSRMLS_D)
-{
- url_adapt_state_ex_t *ctx;
-
- ctx = &BG(url_adapt_state_ex);
-
- smart_str_free(&ctx->result);
- smart_str_free(&ctx->buf);
- smart_str_free(&ctx->tag);
- smart_str_free(&ctx->arg);
-
- return SUCCESS;
-}
-
-static void php_url_scanner_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC)
-{
- size_t len;
-
- if (BG(url_adapt_state_ex).url_app.len != 0) {
- *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode&PHP_OUTPUT_HANDLER_END ? 1 : 0) TSRMLS_CC);
- if (sizeof(uint) < sizeof(size_t)) {
- if (len > UINT_MAX)
- len = UINT_MAX;
- }
- *handled_output_len = len;
- } else {
- *handled_output = NULL;
- }
-}
-
-int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC)
-{
- char *encoded;
- int encoded_len;
- smart_str val;
-
- if (! BG(url_adapt_state_ex).active) {
- php_url_scanner_ex_activate(TSRMLS_C);
- php_ob_set_internal_handler(php_url_scanner_output_handler, 0, "URL-Rewriter", 1 TSRMLS_CC);
- BG(url_adapt_state_ex).active = 1;
- }
-
-
- if (BG(url_adapt_state_ex).url_app.len != 0) {
- smart_str_appends(&BG(url_adapt_state_ex).url_app, PG(arg_separator).output);
- }
-
- if (urlencode) {
- encoded = php_url_encode(value, value_len, &encoded_len);
- smart_str_setl(&val, encoded, encoded_len);
- } else {
- smart_str_setl(&val, value, value_len);
- }
-
- smart_str_appendl(&BG(url_adapt_state_ex).url_app, name, name_len);
- smart_str_appendc(&BG(url_adapt_state_ex).url_app, '=');
- smart_str_append(&BG(url_adapt_state_ex).url_app, &val);
-
- smart_str_appends(&BG(url_adapt_state_ex).form_app, "<input type=\"hidden\" name=\"");
- smart_str_appendl(&BG(url_adapt_state_ex).form_app, name, name_len);
- smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" value=\"");
- smart_str_append(&BG(url_adapt_state_ex).form_app, &val);
- smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" />");
-
- if (urlencode)
- efree(encoded);
-
- return SUCCESS;
-}
-
-int php_url_scanner_reset_vars(TSRMLS_D)
-{
- BG(url_adapt_state_ex).form_app.len = 0;
- BG(url_adapt_state_ex).url_app.len = 0;
-
- return FAILURE;
-}
-
-PHP_MINIT_FUNCTION(url_scanner)
-{
- BG(url_adapt_state_ex).tags = NULL;
-
- BG(url_adapt_state_ex).form_app.c = BG(url_adapt_state_ex).url_app.c = 0;
- BG(url_adapt_state_ex).form_app.len = BG(url_adapt_state_ex).url_app.len = 0;
-
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(url_scanner)
-{
- UNREGISTER_INI_ENTRIES();
- zend_hash_destroy(BG(url_adapt_state_ex).tags);
- free(BG(url_adapt_state_ex).tags);
-
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(url_scanner)
-{
- BG(url_adapt_state_ex).active = 0;
-
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(url_scanner)
-{
- if (BG(url_adapt_state_ex).active) {
- php_url_scanner_ex_deactivate(TSRMLS_C);
- BG(url_adapt_state_ex).active = 0;
- }
-
- smart_str_free(&BG(url_adapt_state_ex).form_app);
- smart_str_free(&BG(url_adapt_state_ex).url_app);
-
- return SUCCESS;
-}
diff --git a/ext/standard/url_scanner_ex.h b/ext/standard/url_scanner_ex.h
deleted file mode 100644
index e35743baf3..0000000000
--- a/ext/standard/url_scanner_ex.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef URL_SCANNER_EX_H
-#define URL_SCANNER_EX_H
-
-PHP_MINIT_FUNCTION(url_scanner_ex);
-PHP_MSHUTDOWN_FUNCTION(url_scanner_ex);
-
-PHP_RINIT_FUNCTION(url_scanner_ex);
-PHP_RSHUTDOWN_FUNCTION(url_scanner_ex);
-
-char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen TSRMLS_DC);
-
-int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC);
-int php_url_scanner_reset_vars(TSRMLS_D);
-
-int php_url_scanner_ex_activate(TSRMLS_D);
-int php_url_scanner_ex_deactivate(TSRMLS_D);
-
-#include "php_smart_str_public.h"
-
-typedef struct {
- /* Used by the mainloop of the scanner */
- smart_str tag; /* read only */
- smart_str arg; /* read only */
- smart_str val; /* read only */
- smart_str buf;
-
- /* The result buffer */
- smart_str result;
-
- /* The data which is appended to each relative URL/FORM */
- smart_str form_app, url_app;
-
- int active;
-
- char *lookup_data;
- int state;
-
- /* Everything above is zeroed in RINIT */
- HashTable *tags;
-} url_adapt_state_ex_t;
-
-typedef struct {
- smart_str var;
- smart_str val;
-} url_adapt_var_t;
-
-#endif
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
deleted file mode 100644
index 7f85c06b38..0000000000
--- a/ext/standard/url_scanner_ex.re
+++ /dev/null
@@ -1,517 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-#include "php.h"
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "php_ini.h"
-#include "php_globals.h"
-#define STATE_TAG SOME_OTHER_STATE_TAG
-#include "basic_functions.h"
-#include "url.h"
-#undef STATE_TAG
-
-#define url_scanner url_scanner_ex
-
-#include "php_smart_str.h"
-
-static PHP_INI_MH(OnUpdateTags)
-{
- url_adapt_state_ex_t *ctx;
- char *key;
- char *lasts;
- char *tmp;
-
- ctx = &BG(url_adapt_state_ex);
-
- tmp = estrndup(new_value, new_value_length);
-
- if (ctx->tags)
- zend_hash_destroy(ctx->tags);
- else
- ctx->tags = malloc(sizeof(HashTable));
-
- zend_hash_init(ctx->tags, 0, NULL, NULL, 1);
-
- for (key = php_strtok_r(tmp, ",", &lasts);
- key;
- key = php_strtok_r(NULL, ",", &lasts)) {
- char *val;
-
- val = strchr(key, '=');
- if (val) {
- char *q;
- int keylen;
-
- *val++ = '\0';
- for (q = key; *q; q++)
- *q = tolower(*q);
- keylen = q - key;
- /* key is stored withOUT NUL
- val is stored WITH NUL */
- zend_hash_add(ctx->tags, key, keylen, val, strlen(val)+1, NULL);
- }
- }
-
- efree(tmp);
-
- return SUCCESS;
-}
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("url_rewriter.tags", "a=href,area=href,frame=src,form=,fieldset=", PHP_INI_ALL, OnUpdateTags, url_adapt_state_ex, php_basic_globals, basic_globals)
-PHP_INI_END()
-
-/*!re2c
-any = [\000-\377];
-N = (any\[<]);
-alpha = [a-zA-Z];
-alphadash = ([a-zA-Z] | "-");
-*/
-
-#define YYFILL(n) goto done
-#define YYCTYPE unsigned char
-#define YYCURSOR p
-#define YYLIMIT q
-#define YYMARKER r
-
-static inline void append_modified_url(smart_str *url, smart_str *dest, smart_str *url_app, const char *separator)
-{
- register const char *p, *q;
- const char *bash = NULL;
- const char *sep = "?";
-
- q = (p = url->c) + url->len;
-
-scan:
-/*!re2c
- ":" { smart_str_append(dest, url); return; }
- "?" { sep = separator; goto scan; }
- "#" { bash = p - 1; goto done; }
- (any\[:?#])+ { goto scan; }
-*/
-done:
-
- /* Don't modify URLs of the format "#mark" */
- if (bash && bash - url->c == 0) {
- smart_str_append(dest, url);
- return;
- }
-
- if (bash)
- smart_str_appendl(dest, url->c, bash - url->c);
- else
- smart_str_append(dest, url);
-
- smart_str_appends(dest, sep);
- smart_str_append(dest, url_app);
-
- if (bash)
- smart_str_appendl(dest, bash, q - bash);
-}
-
-
-#undef YYFILL
-#undef YYCTYPE
-#undef YYCURSOR
-#undef YYLIMIT
-#undef YYMARKER
-
-static inline void tag_arg(url_adapt_state_ex_t *ctx, char quotes, char type TSRMLS_DC)
-{
- char f = 0;
-
- if (strncasecmp(ctx->arg.c, ctx->lookup_data, ctx->arg.len) == 0)
- f = 1;
-
- if (quotes)
- smart_str_appendc(&ctx->result, type);
- if (f) {
- append_modified_url(&ctx->val, &ctx->result, &ctx->url_app, PG(arg_separator).output);
- } else {
- smart_str_append(&ctx->result, &ctx->val);
- }
- if (quotes)
- smart_str_appendc(&ctx->result, type);
-}
-
-enum {
- STATE_PLAIN = 0,
- STATE_TAG,
- STATE_NEXT_ARG,
- STATE_ARG,
- STATE_BEFORE_VAL,
- STATE_VAL
-};
-
-#define YYFILL(n) goto stop
-#define YYCTYPE unsigned char
-#define YYCURSOR xp
-#define YYLIMIT end
-#define YYMARKER q
-#define STATE ctx->state
-
-#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR TSRMLS_DC
-#define STD_ARGS ctx, start, xp TSRMLS_CC
-
-#if SCANNER_DEBUG
-#define scdebug(x) printf x
-#else
-#define scdebug(x)
-#endif
-
-static inline void passthru(STD_PARA)
-{
- scdebug(("appending %d chars, starting with %c\n", YYCURSOR-start, *start));
- smart_str_appendl(&ctx->result, start, YYCURSOR - start);
-}
-
-/*
- * This function appends a hidden input field after a <form> or
- * <fieldset>. The latter is important for XHTML.
- */
-
-static void handle_form(STD_PARA)
-{
- int doit = 0;
-
- if (ctx->form_app.len > 0) {
- switch (ctx->tag.len) {
-
-#define RECOGNIZE(x) do { \
- case sizeof(x)-1: \
- if (strncasecmp(ctx->tag.c, x, sizeof(x)-1) == 0) \
- doit = 1; \
- break; \
-} while (0)
-
- RECOGNIZE("form");
- RECOGNIZE("fieldset");
- }
-
- if (doit)
- smart_str_append(&ctx->result, &ctx->form_app);
- }
-}
-
-
-
-/*
- * HANDLE_TAG copies the HTML Tag and checks whether we
- * have that tag in our table. If we might modify it,
- * we continue to scan the tag, otherwise we simply copy the complete
- * HTML stuff to the result buffer.
- */
-
-static inline void handle_tag(STD_PARA)
-{
- int ok = 0;
- int i;
-
- ctx->tag.len = 0;
- smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
- for (i = 0; i < ctx->tag.len; i++)
- ctx->tag.c[i] = tolower((int)(unsigned char)ctx->tag.c[i]);
- if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS)
- ok = 1;
- STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN;
-}
-
-static inline void handle_arg(STD_PARA)
-{
- ctx->arg.len = 0;
- smart_str_appendl(&ctx->arg, start, YYCURSOR - start);
-}
-
-static inline void handle_val(STD_PARA, char quotes, char type)
-{
- smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2);
- tag_arg(ctx, quotes, type TSRMLS_CC);
-}
-
-static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen TSRMLS_DC)
-{
- char *end, *q;
- char *xp;
- char *start;
- int rest;
-
- smart_str_appendl(&ctx->buf, newdata, newlen);
-
- YYCURSOR = ctx->buf.c;
- YYLIMIT = ctx->buf.c + ctx->buf.len;
-
- switch (STATE) {
- case STATE_PLAIN: goto state_plain;
- case STATE_TAG: goto state_tag;
- case STATE_NEXT_ARG: goto state_next_arg;
- case STATE_ARG: goto state_arg;
- case STATE_BEFORE_VAL: goto state_before_val;
- case STATE_VAL: goto state_val;
- }
-
-
-state_plain_begin:
- STATE = STATE_PLAIN;
-
-state_plain:
- start = YYCURSOR;
-/*!re2c
- "<" { passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; }
- N+ { passthru(STD_ARGS); goto state_plain; }
-*/
-
-state_tag:
- start = YYCURSOR;
-/*!re2c
- alpha+ { handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; }
- any { passthru(STD_ARGS); goto state_plain_begin; }
-*/
-
-state_next_arg_begin:
- STATE = STATE_NEXT_ARG;
-
-state_next_arg:
- start = YYCURSOR;
-/*!re2c
- ">" { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
- [ \v\t\n]+ { passthru(STD_ARGS); goto state_next_arg; }
- alpha { --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
- any { passthru(STD_ARGS); goto state_plain_begin; }
-*/
-
-state_arg:
- start = YYCURSOR;
-/*!re2c
- alpha alphadash* { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; }
- any { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; }
-*/
-
-state_before_val:
- start = YYCURSOR;
-/*!re2c
- [ ]* "=" [ ]* { passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; }
- any { --YYCURSOR; goto state_next_arg_begin; }
-*/
-
-
-state_val:
- start = YYCURSOR;
-/*!re2c
- ["] (any\[">])* ["] { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
- ['] (any\['>])* ['] { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
- (any\[ \t\n>])+ { handle_val(STD_ARGS, 0, '\0'); goto state_next_arg_begin; }
- any { passthru(STD_ARGS); goto state_next_arg_begin; }
-*/
-
-stop:
- rest = YYLIMIT - start;
- scdebug(("stopped in state %d at pos %d (%d:%c) %d\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *YYCURSOR, rest));
- /* XXX: Crash avoidance. Need to work with reporter to figure out what goes wrong */
- if (rest < 0) rest = 0;
-
- if (rest) memmove(ctx->buf.c, start, rest);
- ctx->buf.len = rest;
-}
-
-char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen TSRMLS_DC)
-{
- smart_str surl = {0};
- smart_str buf = {0};
- smart_str url_app = {0};
-
- smart_str_setl(&surl, url, urllen);
-
- smart_str_appends(&url_app, name);
- smart_str_appendc(&url_app, '=');
- smart_str_appends(&url_app, value);
-
- append_modified_url(&surl, &buf, &url_app, PG(arg_separator).output);
-
- smart_str_0(&buf);
- if (newlen) *newlen = buf.len;
-
- smart_str_free(&url_app);
-
- return buf.c;
-}
-
-
-static char *url_adapt_ext(const char *src, size_t srclen, size_t *newlen, zend_bool do_flush TSRMLS_DC)
-{
- url_adapt_state_ex_t *ctx;
- char *retval;
-
- ctx = &BG(url_adapt_state_ex);
-
- xx_mainloop(ctx, src, srclen TSRMLS_CC);
-
- *newlen = ctx->result.len;
- if (!ctx->result.c) {
- smart_str_appendl(&ctx->result, "", 0);
- }
- smart_str_0(&ctx->result);
- if (do_flush) {
- smart_str_appendl(&ctx->result, ctx->buf.c, ctx->buf.len);
- *newlen += ctx->buf.len;
- smart_str_free(&ctx->buf);
- }
- retval = ctx->result.c;
- ctx->result.c = NULL;
- ctx->result.len = 0;
- return retval;
-}
-
-int php_url_scanner_ex_activate(TSRMLS_D)
-{
- url_adapt_state_ex_t *ctx;
-
- ctx = &BG(url_adapt_state_ex);
-
- memset(ctx, 0, ((size_t) &((url_adapt_state_ex_t *)0)->tags));
-
- return SUCCESS;
-}
-
-int php_url_scanner_ex_deactivate(TSRMLS_D)
-{
- url_adapt_state_ex_t *ctx;
-
- ctx = &BG(url_adapt_state_ex);
-
- smart_str_free(&ctx->result);
- smart_str_free(&ctx->buf);
- smart_str_free(&ctx->tag);
- smart_str_free(&ctx->arg);
-
- return SUCCESS;
-}
-
-static void php_url_scanner_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC)
-{
- size_t len;
-
- if (BG(url_adapt_state_ex).url_app.len != 0) {
- *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode&PHP_OUTPUT_HANDLER_END ? 1 : 0) TSRMLS_CC);
- if (sizeof(uint) < sizeof(size_t)) {
- if (len > UINT_MAX)
- len = UINT_MAX;
- }
- *handled_output_len = len;
- } else {
- *handled_output = NULL;
- }
-}
-
-int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC)
-{
- char *encoded;
- int encoded_len;
- smart_str val;
-
- if (! BG(url_adapt_state_ex).active) {
- php_url_scanner_ex_activate(TSRMLS_C);
- php_ob_set_internal_handler(php_url_scanner_output_handler, 0, "URL-Rewriter", 1 TSRMLS_CC);
- BG(url_adapt_state_ex).active = 1;
- }
-
-
- if (BG(url_adapt_state_ex).url_app.len != 0) {
- smart_str_appends(&BG(url_adapt_state_ex).url_app, PG(arg_separator).output);
- }
-
- if (urlencode) {
- encoded = php_url_encode(value, value_len, &encoded_len);
- smart_str_setl(&val, encoded, encoded_len);
- } else {
- smart_str_setl(&val, value, value_len);
- }
-
- smart_str_appendl(&BG(url_adapt_state_ex).url_app, name, name_len);
- smart_str_appendc(&BG(url_adapt_state_ex).url_app, '=');
- smart_str_append(&BG(url_adapt_state_ex).url_app, &val);
-
- smart_str_appends(&BG(url_adapt_state_ex).form_app, "<input type=\"hidden\" name=\"");
- smart_str_appendl(&BG(url_adapt_state_ex).form_app, name, name_len);
- smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" value=\"");
- smart_str_append(&BG(url_adapt_state_ex).form_app, &val);
- smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" />");
-
- if (urlencode)
- efree(encoded);
-
- return SUCCESS;
-}
-
-int php_url_scanner_reset_vars(TSRMLS_D)
-{
- BG(url_adapt_state_ex).form_app.len = 0;
- BG(url_adapt_state_ex).url_app.len = 0;
-
- return FAILURE;
-}
-
-PHP_MINIT_FUNCTION(url_scanner)
-{
- BG(url_adapt_state_ex).tags = NULL;
-
- BG(url_adapt_state_ex).form_app.c = BG(url_adapt_state_ex).url_app.c = 0;
- BG(url_adapt_state_ex).form_app.len = BG(url_adapt_state_ex).url_app.len = 0;
-
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(url_scanner)
-{
- UNREGISTER_INI_ENTRIES();
- zend_hash_destroy(BG(url_adapt_state_ex).tags);
- free(BG(url_adapt_state_ex).tags);
-
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(url_scanner)
-{
- BG(url_adapt_state_ex).active = 0;
-
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(url_scanner)
-{
- if (BG(url_adapt_state_ex).active) {
- php_url_scanner_ex_deactivate(TSRMLS_C);
- BG(url_adapt_state_ex).active = 0;
- }
-
- smart_str_free(&BG(url_adapt_state_ex).form_app);
- smart_str_free(&BG(url_adapt_state_ex).url_app);
-
- return SUCCESS;
-}
diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c
deleted file mode 100644
index 55b7da551e..0000000000
--- a/ext/standard/user_filters.c
+++ /dev/null
@@ -1,514 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | Wez Furlong (wez@thebrainroom.com) |
- | Sara Golemon (pollita@php.net) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- * TODO: Rewrite for buckets.
- * Concept:
- * The user defined filter class should implement a method named
- * "filter" with the following proto:
- * long filter(object brigade_in, object brigade_out, long &consumed, long flags);
- *
- * brigade_in and brigade_out are overloaded objects that wrap around
- * the php_stream_bucket_brigades passed to the underlying filter method.
- * The brigades have methods for retrieving the head of the brigade as
- * an overloaded bucket object, a method for appending a
- * bucket object to the end of the brigade, and a method for creating a new
- * bucket at the end of the brigade.
- *
- * The bucket object has methods to unlink it from it's containing brigade,
- * split into two buckets, and retrieve the buffer from a bucket.
- *
- * This approach means that there doesn't need to be very much magic between
- * userspace and the real C interface.
- */
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/basic_functions.h"
-#include "ext/standard/file.h"
-
-#define PHP_STREAM_BRIGADE_RES_NAME "userfilter.bucket brigade"
-#define PHP_STREAM_BUCKET_RES_NAME "userfilter.bucket"
-#define PHP_STREAM_FILTER_RES_NAME "userfilter.filter"
-#define PHP_STREAM_RES_NAME "userfilter.stream"
-
-struct php_user_filter_data {
- zend_class_entry *ce;
- /* variable length; this *must* be last in the structure */
- char classname[1];
-};
-
-/* to provide context for calling into the next filter from user-space */
-static int le_userfilters;
-static int le_bucket_brigade;
-static int le_bucket;
-static int le_stream;
-
-#define GET_FILTER_FROM_OBJ() { \
- zval **tmp; \
- if (FAILURE == zend_hash_index_find(Z_OBJPROP_P(this_ptr), 0, (void**)&tmp)) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "filter property vanished"); \
- RETURN_FALSE; \
- } \
- ZEND_FETCH_RESOURCE(filter, php_stream_filter*, tmp, -1, "filter", le_userfilters); \
-}
-
-/* define the base filter class */
-
-PHP_FUNCTION(user_filter_nop)
-{
-}
-
-static zend_function_entry user_filter_class_funcs[] = {
- PHP_NAMED_FE(filter, PHP_FN(user_filter_nop), NULL)
- PHP_NAMED_FE(oncreate, PHP_FN(user_filter_nop), NULL)
- PHP_NAMED_FE(onclose, PHP_FN(user_filter_nop), NULL)
- { NULL, NULL, NULL }
-};
-
-static zend_class_entry user_filter_class_entry;
-
-PHP_MINIT_FUNCTION(user_filters)
-{
- /* init the filter class ancestor */
- INIT_CLASS_ENTRY(user_filter_class_entry, "php_user_filter", user_filter_class_funcs);
- if (NULL == zend_register_internal_class(&user_filter_class_entry TSRMLS_CC)) {
- return FAILURE;
- }
-
- /* init the filter resource; it has no dtor, as streams will always clean it up
- * at the correct time */
- le_userfilters = zend_register_list_destructors_ex(NULL, NULL, PHP_STREAM_FILTER_RES_NAME, 0);
-
- if (le_userfilters == FAILURE) {
- return FAILURE;
- }
-
- le_bucket_brigade = zend_register_list_destructors_ex(NULL, NULL, PHP_STREAM_BRIGADE_RES_NAME, module_number);
- le_bucket = zend_register_list_destructors_ex(NULL, NULL, PHP_STREAM_BUCKET_RES_NAME, module_number);
- le_stream = zend_register_list_destructors_ex(NULL, NULL, PHP_STREAM_RES_NAME, module_number);
-
- if (le_bucket_brigade == FAILURE) {
- return FAILURE;
- }
-
- REGISTER_LONG_CONSTANT("PSFS_PASS_ON", PSFS_PASS_ON, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PSFS_FEED_ME", PSFS_FEED_ME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PSFS_ERR_FATAL", PSFS_ERR_FATAL, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("PSFS_FLAG_NORMAL", PSFS_FLAG_NORMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PSFS_FLAG_FLUSH_INC", PSFS_FLAG_FLUSH_INC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PSFS_FLAG_FLUSH_CLOSE", PSFS_FLAG_FLUSH_CLOSE, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-static void userfilter_dtor(php_stream_filter *thisfilter TSRMLS_DC)
-{
- zval *obj = (zval*)thisfilter->abstract;
- zval func_name;
- zval *retval = NULL;
- zval **tmp;
-
- ZVAL_STRINGL(&func_name, "onclose", sizeof("onclose")-1, 0);
-
- call_user_function_ex(NULL,
- &obj,
- &func_name,
- &retval,
- 0, NULL,
- 0, NULL TSRMLS_CC);
-
- if (retval)
- zval_ptr_dtor(&retval);
-
- if (SUCCESS == zend_hash_find(Z_OBJPROP_P(obj), "filter", sizeof("filter"), (void**)&tmp)) {
- zend_list_delete(Z_LVAL_PP(tmp));
- FREE_ZVAL(*tmp);
- }
-
- /* kill the object */
- zval_ptr_dtor(&obj);
-}
-
-php_stream_filter_status_t userfilter_filter(
- php_stream *stream,
- php_stream_filter *thisfilter,
- php_stream_bucket_brigade *buckets_in,
- php_stream_bucket_brigade *buckets_out,
- size_t *bytes_consumed,
- int flags
- TSRMLS_DC)
-{
- int ret = PSFS_ERR_FATAL;
- zval *obj = (zval*)thisfilter->abstract;
- zval func_name;
- zval *retval = NULL;
- zval **args[4];
- zval *zclosing, *zconsumed, *zin, *zout, *zstream;
- int call_result;
-
- if (FAILURE == zend_hash_find(Z_OBJPROP_P(obj), "stream", sizeof("stream"), (void**)&zstream)) {
- /* Give the userfilter class a hook back to the stream */
- ALLOC_INIT_ZVAL(zstream);
- ZEND_REGISTER_RESOURCE(zstream, stream, le_stream);
- add_property_zval(obj, "stream", zstream);
- /* add_property_zval increments the refcount which is unwanted here */
- zval_ptr_dtor(&zstream);
- }
-
- ZVAL_STRINGL(&func_name, "filter", sizeof("filter")-1, 0);
-
- /* Setup calling arguments */
- ALLOC_INIT_ZVAL(zin);
- ZEND_REGISTER_RESOURCE(zin, buckets_in, le_bucket_brigade);
- args[0] = &zin;
-
- ALLOC_INIT_ZVAL(zout);
- ZEND_REGISTER_RESOURCE(zout, buckets_out, le_bucket_brigade);
- args[1] = &zout;
-
- ALLOC_INIT_ZVAL(zconsumed);
- if (bytes_consumed) {
- ZVAL_LONG(zconsumed, *bytes_consumed);
- } else {
- ZVAL_NULL(zconsumed);
- }
- args[2] = &zconsumed;
-
- ALLOC_INIT_ZVAL(zclosing);
- ZVAL_BOOL(zclosing, flags & PSFS_FLAG_FLUSH_CLOSE);
- args[3] = &zclosing;
-
- call_result = call_user_function_ex(NULL,
- &obj,
- &func_name,
- &retval,
- 4, args,
- 0, NULL TSRMLS_CC);
-
- if (call_result == SUCCESS && retval != NULL) {
- convert_to_long(retval);
- ret = Z_LVAL_P(retval);
- } else if (call_result == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to call filter function");
- }
-
- if (bytes_consumed) {
- *bytes_consumed = Z_LVAL_P(zconsumed);
- }
-
- if (retval)
- zval_ptr_dtor(&retval);
- zval_ptr_dtor(&zclosing);
- zval_ptr_dtor(&zconsumed);
- zval_ptr_dtor(&zout);
- zval_ptr_dtor(&zin);
-
- return ret;
-}
-
-static php_stream_filter_ops userfilter_ops = {
- userfilter_filter,
- userfilter_dtor,
- "user-filter"
-};
-
-static php_stream_filter *user_filter_factory_create(const char *filtername,
- zval *filterparams, int persistent TSRMLS_DC)
-{
- struct php_user_filter_data *fdat = NULL;
- php_stream_filter *filter;
- zval *obj, *zfilter;
- zval func_name;
- zval *retval = NULL;
-
- /* some sanity checks */
- if (persistent) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "cannot use a user-space filter with a persistent stream");
- return NULL;
- }
-
- /* determine the classname/class entry */
- if (FAILURE == zend_hash_find(BG(user_filter_map), (char*)filtername,
- strlen(filtername), (void**)&fdat)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "Err, filter \"%s\" is not in the user-filter map, but somehow the user-filter-factory was invoked for it!?", filtername);
- return NULL;
- }
-
- /* bind the classname to the actual class */
- if (fdat->ce == NULL) {
- if (FAILURE == zend_hash_find(EG(class_table), fdat->classname, strlen(fdat->classname)+1,
- (void **)&fdat->ce)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "user-filter \"%s\" requires class \"%s\", but that class is not defined",
- filtername, fdat->classname);
- return NULL;
- }
-#ifdef ZEND_ENGINE_2
- fdat->ce = *(zend_class_entry**)fdat->ce;
-#endif
-
- }
-
- filter = php_stream_filter_alloc(&userfilter_ops, NULL, 0);
- if (filter == NULL) {
- return NULL;
- }
-
- ALLOC_INIT_ZVAL(zfilter);
- ZEND_REGISTER_RESOURCE(zfilter, filter, le_userfilters);
-
- /* create the object */
- ALLOC_ZVAL(obj);
- object_init_ex(obj, fdat->ce);
- ZVAL_REFCOUNT(obj) = 1;
- PZVAL_IS_REF(obj) = 1;
-
- /* set the filter property */
- filter->abstract = obj;
-
- add_property_zval(obj, "filter", zfilter);
-
- /* filtername */
- add_property_string(obj, "filtername", (char*)filtername, 1);
-
- /* and the parameters, if any */
- if (filterparams) {
- add_property_zval(obj, "params", filterparams);
- } else {
- add_property_null(obj, "params");
- }
-
- /* invoke the constructor */
- ZVAL_STRINGL(&func_name, "oncreate", sizeof("oncreate")-1, 0);
-
- call_user_function_ex(NULL,
- &obj,
- &func_name,
- &retval,
- 0, NULL,
- 0, NULL TSRMLS_CC);
-
- if (retval)
- zval_ptr_dtor(&retval);
- return filter;
-}
-
-static php_stream_filter_factory user_filter_factory = {
- user_filter_factory_create
-};
-
-static void filter_item_dtor(struct php_user_filter_data *fdat)
-{
-}
-
-/* {{{ proto object stream_bucket_make_writeable(resource brigade)
- Return a bucket object from the brigade for operating on */
-PHP_FUNCTION(stream_bucket_make_writeable)
-{
- zval *zbrigade, *zbucket;
- php_stream_bucket_brigade *brigade;
- php_stream_bucket *bucket;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zbrigade) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(brigade, php_stream_bucket_brigade *, &zbrigade, -1, PHP_STREAM_BRIGADE_RES_NAME, le_bucket_brigade);
-
- ZVAL_NULL(return_value);
-
- if (brigade->head && (bucket = php_stream_bucket_make_writeable(brigade->head TSRMLS_CC))) {
- ALLOC_INIT_ZVAL(zbucket);
- ZEND_REGISTER_RESOURCE(zbucket, bucket, le_bucket);
- object_init(return_value);
- add_property_zval(return_value, "bucket", zbucket);
- /* add_property_zval increments the refcount which is unwanted here */
- zval_ptr_dtor(&zbucket);
- add_property_stringl(return_value, "data", bucket->buf, bucket->buflen, 1);
- add_property_long(return_value, "datalen", bucket->buflen);
- }
-}
-/* }}} */
-
-/* {{{ php_stream_bucket_attach */
-static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS)
-{
- zval *zbrigade, *zobject;
- zval **pzbucket, **pzdata;
- php_stream_bucket_brigade *brigade;
- php_stream_bucket *bucket;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zo", &zbrigade, &zobject) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (FAILURE == zend_hash_find(Z_OBJPROP_P(zobject), "bucket", 7, (void**)&pzbucket)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Object has no bucket property");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(brigade, php_stream_bucket_brigade *, &zbrigade, -1, PHP_STREAM_BRIGADE_RES_NAME, le_bucket_brigade);
- ZEND_FETCH_RESOURCE(bucket, php_stream_bucket *, pzbucket, -1, PHP_STREAM_BUCKET_RES_NAME, le_bucket);
-
- if (SUCCESS == zend_hash_find(Z_OBJPROP_P(zobject), "data", 5, (void**)&pzdata) && (*pzdata)->type == IS_STRING) {
- if (!bucket->own_buf) {
- bucket = php_stream_bucket_make_writeable(bucket TSRMLS_CC);
- }
- if (bucket->buflen != Z_STRLEN_PP(pzdata)) {
- bucket->buf = perealloc(bucket->buf, Z_STRLEN_PP(pzdata), bucket->is_persistent);
- bucket->buflen = Z_STRLEN_PP(pzdata);
- }
- memcpy(bucket->buf, Z_STRVAL_PP(pzdata), bucket->buflen);
- }
-
- if (append) {
- php_stream_bucket_append(brigade, bucket TSRMLS_CC);
- } else {
- php_stream_bucket_prepend(brigade, bucket TSRMLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ proto void stream_bucket_prepend(resource brigade, resource bucket)
- Prepend bucket to brigade */
-PHP_FUNCTION(stream_bucket_prepend)
-{
- php_stream_bucket_attach(0, INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto void stream_bucket_append(resource brigade, resource bucket)
- Append bucket to brigade */
-PHP_FUNCTION(stream_bucket_append)
-{
- php_stream_bucket_attach(1, INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto resource stream_bucket_new(resource stream, string buffer)
- Create a new bucket for use on the current stream */
-PHP_FUNCTION(stream_bucket_new)
-{
- zval *zstream, *zbucket;
- php_stream *stream;
- char *buffer;
- char *pbuffer;
- int buffer_len;
- php_stream_bucket *bucket;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &zstream, &buffer, &buffer_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(stream, php_stream *, &zstream, -1, PHP_STREAM_RES_NAME, le_stream);
-
- if (!(pbuffer = pemalloc(buffer_len, php_stream_is_persistent(stream)))) {
- RETURN_FALSE;
- }
-
- memcpy(pbuffer, buffer, buffer_len);
-
- bucket = php_stream_bucket_new(stream, pbuffer, buffer_len, 1, php_stream_is_persistent(stream) TSRMLS_CC);
-
- ALLOC_INIT_ZVAL(zbucket);
- ZEND_REGISTER_RESOURCE(zbucket, bucket, le_bucket);
- object_init(return_value);
- add_property_zval(return_value, "bucket", zbucket);
- add_property_stringl(return_value, "data", bucket->buf, bucket->buflen, 1);
- add_property_long(return_value, "datalen", bucket->buflen);
-}
-/* }}} */
-
-/* {{{ proto array stream_get_filters(void)
- Returns a list of registered filters */
-PHP_FUNCTION(stream_get_filters)
-{
- char *filter_name;
- int key_flags, filter_name_len = 0;
- HashTable *filters_hash;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- array_init(return_value);
-
- filters_hash = php_get_stream_filters_hash();
-
- if (filters_hash) {
- for(zend_hash_internal_pointer_reset(filters_hash);
- (key_flags = zend_hash_get_current_key_ex(filters_hash, &filter_name, &filter_name_len, NULL, 0, NULL)) != HASH_KEY_NON_EXISTANT;
- zend_hash_move_forward(filters_hash))
- if (key_flags == HASH_KEY_IS_STRING)
- add_next_index_stringl(return_value, filter_name, filter_name_len, 1);
- }
- /* It's okay to return an empty array if no filters are registered */
-}
-/* }}} */
-
-/* {{{ proto bool stream_register_filter(string filtername, string classname)
- Registers a custom filter handler class */
-PHP_FUNCTION(stream_register_filter)
-{
- char *filtername, *classname;
- int filtername_len, classname_len;
- struct php_user_filter_data *fdat;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &filtername, &filtername_len,
- &classname, &classname_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- RETVAL_FALSE;
-
- if (!BG(user_filter_map)) {
- BG(user_filter_map) = (HashTable*) emalloc(sizeof(HashTable));
- zend_hash_init(BG(user_filter_map), 5, NULL, (dtor_func_t) filter_item_dtor, 0);
- }
-
- fdat = ecalloc(1, sizeof(*fdat) + classname_len);
- memcpy(fdat->classname, classname, classname_len);
- zend_str_tolower(fdat->classname, classname_len);
-
- if (zend_hash_add(BG(user_filter_map), filtername, filtername_len, (void*)fdat,
- sizeof(*fdat) + classname_len, NULL) == SUCCESS &&
- php_stream_filter_register_factory(filtername, &user_filter_factory TSRMLS_CC) == SUCCESS) {
- RETVAL_TRUE;
- }
-
- efree(fdat);
-}
-/* }}} */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/var.c b/ext/standard/var.c
deleted file mode 100644
index b641c8b365..0000000000
--- a/ext/standard/var.c
+++ /dev/null
@@ -1,720 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jani Lehtimäki <jkl@njet.net> |
- | Thies C. Arntzen <thies@thieso.net> |
- | Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-
-/* {{{ includes
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "php.h"
-#include "php_string.h"
-#include "php_var.h"
-#include "php_smart_str.h"
-#include "basic_functions.h"
-#include "php_incomplete_class.h"
-
-#define COMMON ((*struc)->is_ref ? "&" : "")
-#define Z_REFCOUNT_PP(a) ((*a)->refcount)
-
-/* }}} */
-/* {{{ php_var_dump */
-
-static int php_array_element_dump(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
-{
- int level;
- TSRMLS_FETCH();
-
- level = va_arg(args, int);
-
- if (hash_key->nKeyLength==0) { /* numeric key */
- php_printf("%*c[%ld]=>\n", level + 1, ' ', hash_key->h);
- } else { /* string key */
- php_printf("%*c[\"%s\"]=>\n", level + 1, ' ', hash_key->arKey);
- }
- php_var_dump(zv, level + 2 TSRMLS_CC);
- return 0;
-}
-
-PHPAPI void php_var_dump(zval **struc, int level TSRMLS_DC)
-{
- HashTable *myht = NULL;
- char *class_name;
- zend_uint class_name_len;
- zend_class_entry *ce;
-
- if (level > 1) {
- php_printf("%*c", level - 1, ' ');
- }
-
- switch (Z_TYPE_PP(struc)) {
- case IS_BOOL:
- php_printf("%sbool(%s)\n", COMMON, Z_LVAL_PP(struc)?"true":"false");
- break;
- case IS_NULL:
- php_printf("%sNULL\n", COMMON);
- break;
- case IS_LONG:
- php_printf("%sint(%ld)\n", COMMON, Z_LVAL_PP(struc));
- break;
- case IS_DOUBLE:
- php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_PP(struc));
- break;
- case IS_STRING:
- php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_PP(struc));
- PHPWRITE(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc));
- PUTS("\"\n");
- break;
- case IS_ARRAY:
- myht = Z_ARRVAL_PP(struc);
- if (myht->nApplyCount > 1) {
- PUTS("*RECURSION*\n");
- return;
- }
- php_printf("%sarray(%d) {\n", COMMON, zend_hash_num_elements(myht));
- goto head_done;
- case IS_OBJECT:
- myht = Z_OBJPROP_PP(struc);
- if (myht && myht->nApplyCount > 1) {
- PUTS("*RECURSION*\n");
- return;
- }
-
- ce = Z_OBJCE(**struc);
-
- Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC);
- php_printf("%sobject(%s)#%d (%d) {\n", COMMON, class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0);
- efree(class_name);
-head_done:
- if (myht) {
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) php_array_element_dump, 1, level);
- }
- if (level > 1) {
- php_printf("%*c", level-1, ' ');
- }
- PUTS("}\n");
- break;
- case IS_RESOURCE: {
- char *type_name;
-
- type_name = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(struc) TSRMLS_CC);
- php_printf("%sresource(%ld) of type (%s)\n", COMMON, Z_LVAL_PP(struc), type_name ? type_name : "Unknown");
- break;
- }
- default:
- php_printf("%sUNKNOWN:0\n", COMMON);
- break;
- }
-}
-
-/* }}} */
-
-
-
-/* {{{ proto void var_dump(mixed var)
- Dumps a string representation of variable to output */
-PHP_FUNCTION(var_dump)
-{
- zval ***args;
- int argc;
- int i;
-
- argc = ZEND_NUM_ARGS();
-
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (ZEND_NUM_ARGS() == 0 || zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- for (i=0; i<argc; i++)
- php_var_dump(args[i], 1 TSRMLS_CC);
-
- efree(args);
-}
-/* }}} */
-
-/* {{{ debug_zval_dump */
-
-static int zval_array_element_dump(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
-{
- int level;
- TSRMLS_FETCH();
-
- level = va_arg(args, int);
-
- if (hash_key->nKeyLength==0) { /* numeric key */
- php_printf("%*c[%ld]=>\n", level + 1, ' ', hash_key->h);
- } else { /* string key */
- php_printf("%*c[\"%s\"]=>\n", level + 1, ' ', hash_key->arKey);
- }
- php_debug_zval_dump(zv, level + 2 TSRMLS_CC);
- return 0;
-}
-
-PHPAPI void php_debug_zval_dump(zval **struc, int level TSRMLS_DC)
-{
- HashTable *myht = NULL;
- char *class_name;
- zend_uint class_name_len;
- zend_class_entry *ce;
-
- if (level > 1) {
- php_printf("%*c", level - 1, ' ');
- }
-
- switch (Z_TYPE_PP(struc)) {
- case IS_BOOL:
- php_printf("%sbool(%s) refcount(%u)\n", COMMON, Z_LVAL_PP(struc)?"true":"false", Z_REFCOUNT_PP(struc));
- break;
- case IS_NULL:
- php_printf("%sNULL refcount(%u)\n", COMMON, Z_REFCOUNT_PP(struc));
- break;
- case IS_LONG:
- php_printf("%slong(%ld) refcount(%u)\n", COMMON, Z_LVAL_PP(struc), Z_REFCOUNT_PP(struc));
- break;
- case IS_DOUBLE:
- php_printf("%sdouble(%.*G) refcount(%u)\n", COMMON, (int) EG(precision), Z_DVAL_PP(struc), Z_REFCOUNT_PP(struc));
- break;
- case IS_STRING:
- php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_PP(struc));
- PHPWRITE(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc));
- php_printf("\" refcount(%u)\n", Z_REFCOUNT_PP(struc));
- break;
- case IS_ARRAY:
- myht = Z_ARRVAL_PP(struc);
- php_printf("%sarray(%d) refcount(%u){\n", COMMON, zend_hash_num_elements(myht), Z_REFCOUNT_PP(struc));
- goto head_done;
- case IS_OBJECT:
- myht = Z_OBJPROP_PP(struc);
- ce = Z_OBJCE(**struc);
- Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC);
- php_printf("%sobject(%s)#%d (%d) refcount(%u){\n", COMMON, class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0, Z_REFCOUNT_PP(struc));
- efree(class_name);
-head_done:
- if (myht) {
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) zval_array_element_dump, 1, level);
- }
- if (level > 1) {
- php_printf("%*c", level-1, ' ');
- }
- PUTS("}\n");
- break;
- case IS_RESOURCE: {
- char *type_name;
-
- type_name = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(struc) TSRMLS_CC);
- php_printf("%sresource(%ld) of type (%s) refcount(%u)\n", COMMON, Z_LVAL_PP(struc), type_name ? type_name : "Unknown", Z_REFCOUNT_PP(struc));
- break;
- }
- default:
- php_printf("%sUNKNOWN:0\n", COMMON);
- break;
- }
-}
-
-/* }}} */
-
-/* {{{ proto void debug_zval_dump(mixed var)
- Dumps a string representation of an internal zend value to output. */
-PHP_FUNCTION(debug_zval_dump)
-{
- zval ***args;
- int argc;
- int i;
-
- argc = ZEND_NUM_ARGS();
-
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (ZEND_NUM_ARGS() == 0 || zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- for (i=0; i<argc; i++)
- php_debug_zval_dump(args[i], 1 TSRMLS_CC);
-
- efree(args);
-}
-/* }}} */
-
-
-/* {{{ php_var_export */
-
-static int php_array_element_export(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
-{
- int level;
- TSRMLS_FETCH();
-
- level = va_arg(args, int);
-
- if (hash_key->nKeyLength==0) { /* numeric key */
- php_printf("%*c%ld => ", level + 1, ' ', hash_key->h);
- } else { /* string key */
- php_printf("%*c'%s' => ", level + 1, ' ', hash_key->arKey);
- }
- php_var_export(zv, level + 2 TSRMLS_CC);
- PUTS (",\n");
- return 0;
-}
-
-static int php_object_element_export(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
-{
- int level;
- TSRMLS_FETCH();
-
- level = va_arg(args, int);
-
- if (hash_key->nKeyLength != 0) {
- php_printf("%*cvar $%s = ", level + 1, ' ', hash_key->arKey);
- php_var_export(zv, level + 2 TSRMLS_CC);
- PUTS (";\n");
- }
- return 0;
-}
-
-PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC)
-{
- HashTable *myht;
- char* tmp_str;
- int tmp_len;
- char *class_name;
- zend_uint class_name_len;
-
- switch (Z_TYPE_PP(struc)) {
- case IS_BOOL:
- php_printf("%s", Z_LVAL_PP(struc) ? "true" : "false");
- break;
- case IS_NULL:
- php_printf("NULL");
- break;
- case IS_LONG:
- php_printf("%ld", Z_LVAL_PP(struc));
- break;
- case IS_DOUBLE:
- php_printf("%.*G", (int) EG(precision), Z_DVAL_PP(struc));
- break;
- case IS_STRING:
- tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\", 2 TSRMLS_CC);
- PUTS ("'");
- PHPWRITE(tmp_str, tmp_len);
- PUTS ("'");
- efree (tmp_str);
- break;
- case IS_ARRAY:
- myht = Z_ARRVAL_PP(struc);
- if (level > 1) {
- php_printf("\n%*c", level - 1, ' ');
- }
- PUTS ("array (\n");
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) php_array_element_export, 1, level);
- if (level > 1) {
- php_printf("%*c", level - 1, ' ');
- }
- PUTS(")");
- break;
- case IS_OBJECT:
- myht = Z_OBJPROP_PP(struc);
- if (level > 1) {
- php_printf("\n%*c", level - 1, ' ');
- }
- Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC);
- php_printf ("class %s {\n", class_name);
- efree(class_name);
- if (myht) {
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) php_object_element_export, 1, level);
- }
- if (level > 1) {
- php_printf("%*c", level - 1, ' ');
- }
- PUTS("}");
- break;
- default:
- PUTS ("NULL");
- break;
- }
-}
-
-/* }}} */
-
-
-/* {{{ proto mixed var_export(mixed var [, bool return])
- Outputs or returns a string representation of a variable */
-PHP_FUNCTION(var_export)
-{
- zval *var;
- zend_bool return_output = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &var, &return_output) == FAILURE) {
- return;
- }
-
- if (return_output) {
- php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC);
- }
-
- php_var_export(&var, 1 TSRMLS_CC);
-
- if (return_output) {
- php_ob_get_buffer (return_value TSRMLS_CC);
- php_end_ob_buffer (0, 0 TSRMLS_CC);
- }
-}
-/* }}} */
-
-
-
-/* {{{ php_var_serialize */
-
-static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *var_hash TSRMLS_DC);
-
-static inline int php_add_var_hash(HashTable *var_hash, zval *var, void *var_old)
-{
- ulong var_no;
- char id[32], *p;
- register int len;
-
- /* relies on "(long)" being a perfect hash function for data pointers */
- p = smart_str_print_long(id + sizeof(id) - 1, (long) var);
- len = id + sizeof(id) - 1 - p;
-
- if (var_old && zend_hash_find(var_hash, p, len, var_old) == SUCCESS) {
- if (!var->is_ref) {
- /* we still need to bump up the counter, since non-refs will
- be counted separately by unserializer */
- var_no = -1;
- zend_hash_next_index_insert(var_hash, &var_no, sizeof(var_no), NULL);
- }
- return FAILURE;
- }
-
- /* +1 because otherwise hash will think we are trying to store NULL pointer */
- var_no = zend_hash_num_elements(var_hash) + 1;
- zend_hash_add(var_hash, p, len, &var_no, sizeof(var_no), NULL);
- return SUCCESS;
-}
-
-static inline void php_var_serialize_long(smart_str *buf, long val)
-{
- smart_str_appendl(buf, "i:", 2);
- smart_str_append_long(buf, val);
- smart_str_appendc(buf, ';');
-}
-
-static inline void php_var_serialize_string(smart_str *buf, char *str, int len)
-{
- smart_str_appendl(buf, "s:", 2);
- smart_str_append_long(buf, len);
- smart_str_appendl(buf, ":\"", 2);
- smart_str_appendl(buf, str, len);
- smart_str_appendl(buf, "\";", 2);
-}
-
-static inline void php_var_serialize_class_name(smart_str *buf, zval **struc TSRMLS_DC)
-{
- PHP_CLASS_ATTRIBUTES;
-
- PHP_SET_CLASS_ATTRIBUTES(*struc);
- smart_str_appendl(buf, "O:", 2);
- smart_str_append_long(buf, name_len);
- smart_str_appendl(buf, ":\"", 2);
- smart_str_appendl(buf, class_name, name_len);
- smart_str_appendl(buf, "\":", 2);
- PHP_CLEANUP_CLASS_ATTRIBUTES();
-}
-
-static void php_var_serialize_class(smart_str *buf, zval **struc, zval *retval_ptr, HashTable *var_hash TSRMLS_DC)
-{
- int count;
-
- php_var_serialize_class_name(buf, struc TSRMLS_CC);
- /* count after serializing name, since php_var_serialize_class_name
- changes the count if the variable is incomplete class */
- count = zend_hash_num_elements(HASH_OF(retval_ptr));
- smart_str_append_long(buf, count);
- smart_str_appendl(buf, ":{", 2);
-
- if (count > 0) {
- char *key;
- zval **d, **name;
- ulong index;
- HashPosition pos;
- int i;
- zval nval, *nvalp;
-
- ZVAL_NULL(&nval);
- nvalp = &nval;
-
- zend_hash_internal_pointer_reset_ex(HASH_OF(retval_ptr), &pos);
-
- for (;; zend_hash_move_forward_ex(HASH_OF(retval_ptr), &pos)) {
- i = zend_hash_get_current_key_ex(HASH_OF(retval_ptr), &key, NULL,
- &index, 0, &pos);
-
- if (i == HASH_KEY_NON_EXISTANT)
- break;
-
- zend_hash_get_current_data_ex(HASH_OF(retval_ptr),
- (void **) &name, &pos);
-
- if (Z_TYPE_PP(name) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only "
- "containing the names of instance-variables to "
- "serialize.");
- /* we should still add element even if it's not OK,
- since we already wrote the length of the array before */
- smart_str_appendl(buf,"s:0:\"\";N;", 9);
- continue;
- }
-
- php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRLEN_PP(name));
-
- if (zend_hash_find(Z_OBJPROP_PP(struc), Z_STRVAL_PP(name),
- Z_STRLEN_PP(name) + 1, (void *) &d) == SUCCESS) {
- php_var_serialize_intern(buf, d, var_hash TSRMLS_CC);
- } else {
- php_var_serialize_intern(buf, &nvalp, var_hash TSRMLS_CC);
- }
- }
- }
- smart_str_appendc(buf, '}');
-}
-
-
-static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *var_hash TSRMLS_DC)
-{
- int i;
- ulong *var_already;
- HashTable *myht;
-
- if(var_hash
- && php_add_var_hash(var_hash, *struc, (void *) &var_already) == FAILURE
- && (*struc)->is_ref) {
- smart_str_appendl(buf, "R:", 2);
- smart_str_append_long(buf, *var_already);
- smart_str_appendc(buf, ';');
- return;
- }
-
- switch (Z_TYPE_PP(struc)) {
- case IS_BOOL:
- smart_str_appendl(buf, "b:", 2);
- smart_str_append_long(buf, Z_LVAL_PP(struc));
- smart_str_appendc(buf, ';');
- return;
-
- case IS_NULL:
- smart_str_appendl(buf, "N;", 2);
- return;
-
- case IS_LONG:
- php_var_serialize_long(buf, Z_LVAL_PP(struc));
- return;
-
- case IS_DOUBLE: {
- char *s;
- ulong slen;
-
- slen = spprintf(&s, 0, "d:%.*G;", PG(serialize_precision), Z_DVAL_PP(struc));
- smart_str_appendl(buf, s, slen);
- efree(s);
- return;
- }
-
- case IS_STRING:
- php_var_serialize_string(buf, Z_STRVAL_PP(struc), Z_STRLEN_PP(struc));
- return;
-
- case IS_OBJECT: {
- zval *retval_ptr = NULL;
- zval fname;
- int res;
-
- INIT_PZVAL(&fname);
- ZVAL_STRINGL(&fname, "__sleep", sizeof("__sleep") - 1, 0);
- res = call_user_function_ex(CG(function_table), struc, &fname,
- &retval_ptr, 0, 0, 1, NULL TSRMLS_CC);
-
- if (res == SUCCESS) {
- if (retval_ptr) {
- if (HASH_OF(retval_ptr)) {
- php_var_serialize_class(buf, struc, retval_ptr,
- var_hash TSRMLS_CC);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only "
- "containing the names of instance-variables to "
- "serialize.");
- }
-
- zval_ptr_dtor(&retval_ptr);
- }
- return;
- }
- if (retval_ptr)
- zval_ptr_dtor(&retval_ptr);
- /* fall-through */
- }
- case IS_ARRAY:
- myht = HASH_OF(*struc);
- if (Z_TYPE_PP(struc) == IS_ARRAY) {
- smart_str_appendl(buf, "a:", 2);
- } else {
- php_var_serialize_class_name(buf, struc TSRMLS_CC);
- }
- /* count after serializing name, since php_var_serialize_class_name
- changes the count if the variable is incomplete class */
- i = zend_hash_num_elements(myht);
- smart_str_append_long(buf, i);
- smart_str_appendl(buf, ":{", 2);
- if (i > 0) {
- char *key;
- zval **data;
- ulong index;
- uint key_len;
- HashPosition pos;
-
- zend_hash_internal_pointer_reset_ex(myht, &pos);
- for (;; zend_hash_move_forward_ex(myht, &pos)) {
- i = zend_hash_get_current_key_ex(myht, &key, &key_len,
- &index, 0, &pos);
- if (i == HASH_KEY_NON_EXISTANT)
- break;
-
- switch (i) {
- case HASH_KEY_IS_LONG:
- php_var_serialize_long(buf, index);
- break;
- case HASH_KEY_IS_STRING:
- php_var_serialize_string(buf, key, key_len - 1);
- break;
- }
-
- /* we should still add element even if it's not OK,
- since we already wrote the length of the array before */
- if (zend_hash_get_current_data_ex(myht,
- (void **) &data, &pos) != SUCCESS
- || !data
- || data == struc) {
- smart_str_appendl(buf, "N;", 2);
- } else {
- php_var_serialize_intern(buf, data, var_hash TSRMLS_CC);
- }
- }
- }
- smart_str_appendc(buf, '}');
- return;
- default:
- smart_str_appendl(buf, "i:0;", 4);
- return;
- }
-}
-
-PHPAPI void php_var_serialize(smart_str *buf, zval **struc, HashTable *var_hash TSRMLS_DC)
-{
- php_var_serialize_intern(buf, struc, var_hash TSRMLS_CC);
- smart_str_0(buf);
-}
-
-/* }}} */
-
-/* {{{ proto string serialize(mixed variable)
- Returns a string representation of variable (which can later be unserialized) */
-PHP_FUNCTION(serialize)
-{
- zval **struc;
- php_serialize_data_t var_hash;
- smart_str buf = {0};
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &struc) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- Z_TYPE_P(return_value) = IS_STRING;
- Z_STRVAL_P(return_value) = NULL;
- Z_STRLEN_P(return_value) = 0;
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&buf, struc, &var_hash TSRMLS_CC);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- if (buf.c) {
- RETURN_STRINGL(buf.c, buf.len, 0);
- } else {
- RETURN_NULL();
- }
-}
-
-/* }}} */
-/* {{{ proto mixed unserialize(string variable_representation)
- Takes a string representation of variable and recreates it */
-
-
-PHP_FUNCTION(unserialize)
-{
- zval **buf;
- php_unserialize_data_t var_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &buf) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(buf) == IS_STRING) {
- const char *p = Z_STRVAL_PP(buf);
-
- if (Z_STRLEN_PP(buf) == 0) {
- RETURN_FALSE;
- }
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&return_value, &p, p + Z_STRLEN_PP(buf), &var_hash TSRMLS_CC)) {
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- zval_dtor(return_value);
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset %d of %d bytes", p - Z_STRVAL_PP(buf), Z_STRLEN_PP(buf));
- RETURN_FALSE;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Argument is not an string");
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-#if MEMORY_LIMIT
-/* {{{ proto int memory_get_usage()
- Returns the allocated by PHP memory */
-PHP_FUNCTION(memory_get_usage) {
- RETURN_LONG(AG(allocated_memory));
-}
-/* }}} */
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c
deleted file mode 100644
index 255a9925b7..0000000000
--- a/ext/standard/var_unserializer.c
+++ /dev/null
@@ -1,807 +0,0 @@
-/* Generated by re2c 0.5 on Thu Apr 17 05:53:08 2003 */
-#line 1 "var_unserializer.re"
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "ext/standard/php_var.h"
-#include "php_incomplete_class.h"
-
-/* {{{ reference-handling for unserializer: var_* */
-#define VAR_ENTRIES_MAX 1024
-
-typedef struct {
- zval *data[VAR_ENTRIES_MAX];
- int used_slots;
- void *next;
-} var_entries;
-
-static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval)
-{
- var_entries *var_hash = var_hashx->first, *prev = NULL;
-
- while (var_hash && var_hash->used_slots == VAR_ENTRIES_MAX) {
- prev = var_hash;
- var_hash = var_hash->next;
- }
-
- if (!var_hash) {
- var_hash = emalloc(sizeof(var_entries));
- var_hash->used_slots = 0;
- var_hash->next = 0;
-
- if (!var_hashx->first)
- var_hashx->first = var_hash;
- else
- prev->next = var_hash;
- }
-
- var_hash->data[var_hash->used_slots++] = *rval;
-}
-
-PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **nzval)
-{
- int i;
- var_entries *var_hash = var_hashx->first;
-
- while (var_hash) {
- for (i = 0; i < var_hash->used_slots; i++) {
- if (var_hash->data[i] == ozval) {
- var_hash->data[i] = *nzval;
- return;
- }
- }
- var_hash = var_hash->next;
- }
-}
-
-static int var_access(php_unserialize_data_t *var_hashx, int id, zval ***store)
-{
- var_entries *var_hash = var_hashx->first;
-
- while (id >= VAR_ENTRIES_MAX && var_hash && var_hash->used_slots == VAR_ENTRIES_MAX) {
- var_hash = var_hash->next;
- id -= VAR_ENTRIES_MAX;
- }
-
- if (!var_hash) return !SUCCESS;
-
- if (id >= var_hash->used_slots) return !SUCCESS;
-
- *store = &var_hash->data[id];
-
- return SUCCESS;
-}
-
-PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
-{
- void *next;
- var_entries *var_hash = var_hashx->first;
-
- while (var_hash) {
- next = var_hash->next;
- efree(var_hash);
- var_hash = next;
- }
-}
-
-/* }}} */
-
-#define YYFILL(n) do { } while (0)
-#define YYCTYPE unsigned char
-#define YYCURSOR cursor
-#define YYLIMIT limit
-#define YYMARKER marker
-
-
-#line 117
-
-
-
-
-static inline int parse_iv2(const char *p, const char **q)
-{
- char cursor;
- int result = 0;
- int neg = 0;
-
- switch (*p) {
- case '-':
- neg++;
- /* fall-through */
- case '+':
- p++;
- }
-
- while (1) {
- cursor = *p;
- if (cursor >= '0' && cursor <= '9') {
- result = result * 10 + cursor - '0';
- } else {
- break;
- }
- p++;
- }
- if (q) *q = p;
- if (neg) return -result;
- return result;
-}
-
-static inline int parse_iv(const char *p)
-{
- return parse_iv2(p, NULL);
-}
-
-#define UNSERIALIZE_PARAMETER zval **rval, const char **p, const char *max, php_unserialize_data_t *var_hash TSRMLS_DC
-#define UNSERIALIZE_PASSTHRU rval, p, max, var_hash TSRMLS_CC
-
-static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, int elements)
-{
- while (elements-- > 0) {
- zval *key, *data;
-
- ALLOC_INIT_ZVAL(key);
-
- if (!php_var_unserialize(&key, p, max, NULL TSRMLS_CC)) {
- zval_dtor(key);
- FREE_ZVAL(key);
- return 0;
- }
-
- ALLOC_INIT_ZVAL(data);
-
- if (!php_var_unserialize(&data, p, max, var_hash TSRMLS_CC)) {
- zval_dtor(key);
- FREE_ZVAL(key);
- zval_dtor(data);
- FREE_ZVAL(data);
- return 0;
- }
-
- switch (Z_TYPE_P(key)) {
- case IS_LONG:
- zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL);
- break;
- case IS_STRING:
- zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);
- break;
-
- }
-
- zval_dtor(key);
- FREE_ZVAL(key);
- }
-
- return 1;
-}
-
-static inline int finish_nested_data(UNSERIALIZE_PARAMETER)
-{
- if (*((*p)++) == '}')
- return 1;
-
-#if SOMETHING_NEW_MIGHT_LEAD_TO_CRASH_ENABLE_IF_YOU_ARE_BRAVE
- zval_ptr_dtor(rval);
-#endif
- return 0;
-}
-
-static inline int object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
-{
- int elements;
-
- elements = parse_iv2((*p) + 2, p);
-
- (*p) += 2;
-
- object_init_ex(*rval, ce);
- return elements;
-}
-
-static inline int object_common2(UNSERIALIZE_PARAMETER, int elements)
-{
- zval *retval_ptr = NULL;
- zval fname;
-
- if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_OBJPROP_PP(rval), elements)) {
- return 0;
- }
-
- INIT_PZVAL(&fname);
- ZVAL_STRINGL(&fname, "__wakeup", sizeof("__wakeup") - 1, 0);
- call_user_function_ex(CG(function_table), rval, &fname, &retval_ptr, 0, 0, 1, NULL TSRMLS_CC);
-
- if (retval_ptr)
- zval_ptr_dtor(&retval_ptr);
-
- return finish_nested_data(UNSERIALIZE_PASSTHRU);
-
-}
-
-PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
-{
- const unsigned char *cursor, *limit, *marker, *start;
- zval **rval_ref;
-
- limit = cursor = *p;
-
- if (var_hash && cursor[0] != 'R') {
- var_push(var_hash, rval);
- }
-
- start = cursor;
-
-
-
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
- goto yy0;
-yy1: ++YYCURSOR;
-yy0:
- if((YYLIMIT - YYCURSOR) < 5) YYFILL(5);
- yych = *YYCURSOR;
- if(yych <= 'd'){
- if(yych <= 'R'){
- if(yych <= 'N'){
- if(yych <= 'M') goto yy15;
- goto yy5;
- } else {
- if(yych <= 'O') goto yy12;
- if(yych <= 'Q') goto yy15;
- goto yy3;
- }
- } else {
- if(yych <= 'a'){
- if(yych <= '`') goto yy15;
- goto yy10;
- } else {
- if(yych <= 'b') goto yy6;
- if(yych <= 'c') goto yy15;
- goto yy8;
- }
- }
- } else {
- if(yych <= 'r'){
- if(yych <= 'i'){
- if(yych <= 'h') goto yy15;
- goto yy7;
- } else {
- if(yych == 'o') goto yy11;
- goto yy15;
- }
- } else {
- if(yych <= '|'){
- if(yych <= 's') goto yy9;
- goto yy15;
- } else {
- if(yych <= '}') goto yy13;
- if(yych <= '\277') goto yy15;
- }
- }
- }
-yy2: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy4;
- }
-yy3: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if(yych == ':') goto yy75;
-yy4:
-#line 430
- { return 0; }
-yy5: yych = *++YYCURSOR;
- if(yych == ';') goto yy73;
- goto yy4;
-yy6: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if(yych == ':') goto yy67;
- goto yy4;
-yy7: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if(yych == ':') goto yy61;
- goto yy4;
-yy8: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if(yych == ':') goto yy44;
- goto yy4;
-yy9: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if(yych == ':') goto yy37;
- goto yy4;
-yy10: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if(yych == ':') goto yy30;
- goto yy4;
-yy11: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if(yych == ':') goto yy23;
- goto yy4;
-yy12: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if(yych == ':') goto yy16;
- goto yy4;
-yy13: yych = *++YYCURSOR;
-yy14:
-#line 424
- {
- /* this is the case where we have less data than planned */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unexpected end of serialized data");
- return 0; /* not sure if it should be 0 or 1 here? */
-}
-yy15: yych = *++YYCURSOR;
- goto yy4;
-yy16: yych = *++YYCURSOR;
- if(yybm[0+yych] & 128) goto yy18;
- if(yych == '+') goto yy17;
- if(yych != '-') goto yy2;
-yy17: yych = *++YYCURSOR;
- if(yybm[0+yych] & 128) goto yy18;
- goto yy2;
-yy18: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy19: if(yybm[0+yych] & 128) goto yy18;
- if(yych != ':') goto yy2;
-yy20: yych = *++YYCURSOR;
- if(yych != '"') goto yy2;
-yy21: yych = *++YYCURSOR;
-yy22:
-#line 350
- {
- int len;
- int elements;
- int len2;
- char *class_name;
- zend_class_entry *ce;
- int incomplete_class = 0;
-
- zval *user_func;
- zval *retval_ptr;
- zval **args[1];
- zval *arg_func_name;
-
- INIT_PZVAL(*rval);
- len2 = len = parse_iv(start + 2);
- if (len == 0)
- return 0;
-
- class_name = estrndup(YYCURSOR, len);
- YYCURSOR += len;
-
- while (len-- > 0) {
- if (class_name[len] >= 'A' && class_name[len] <= 'Z') {
- class_name[len] = class_name[len] - 'A' + 'a';
- }
- }
-
- if (zend_hash_find(CG(class_table), class_name, len2 + 1, (void **) &ce) != SUCCESS) {
- if ((PG(unserialize_callback_func) == NULL) || (PG(unserialize_callback_func)[0] == '\0')) {
- incomplete_class = 1;
- ce = PHP_IC_ENTRY;
- } else {
- MAKE_STD_ZVAL(user_func);
- ZVAL_STRING(user_func, PG(unserialize_callback_func), 1);
-
- args[0] = &arg_func_name;
- MAKE_STD_ZVAL(arg_func_name);
- ZVAL_STRING(arg_func_name, class_name, 1);
-
- if (call_user_function_ex(CG(function_table), NULL, user_func, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "defined (%s) but not found", user_func->value.str.val);
- incomplete_class = 1;
- ce = PHP_IC_ENTRY;
- } else {
- if (zend_hash_find(CG(class_table), class_name, len2 + 1, (void **) &ce) != SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "(%s) hasn't defined the class it was called for", user_func->value.str.val);
- incomplete_class = 1;
- ce = PHP_IC_ENTRY;
- } else {
-#ifdef ZEND_ENGINE_2
- ce = *(zend_class_entry **)ce; /* Bad hack, TBF! */
-#endif
- efree(class_name);
- }
- }
- }
- } else {
-#ifdef ZEND_ENGINE_2
- ce = *(zend_class_entry **)ce; /* Bad hack, TBF! */
-#endif
- efree(class_name);
- }
-
- *p = YYCURSOR;
- elements = object_common1(UNSERIALIZE_PASSTHRU, ce);
-
- if (incomplete_class) {
- php_store_class_name(*rval, class_name, len2);
- efree(class_name);
- }
-
- return object_common2(UNSERIALIZE_PASSTHRU, elements);
-}
-yy23: yych = *++YYCURSOR;
- if(yych <= ','){
- if(yych != '+') goto yy2;
- } else {
- if(yych <= '-') goto yy24;
- if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy25;
- goto yy2;
- }
-yy24: yych = *++YYCURSOR;
- if(yych <= '/') goto yy2;
- if(yych >= ':') goto yy2;
-yy25: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy26: if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy25;
- if(yych >= ';') goto yy2;
-yy27: yych = *++YYCURSOR;
- if(yych != '"') goto yy2;
-yy28: yych = *++YYCURSOR;
-yy29:
-#line 342
- {
-
- INIT_PZVAL(*rval);
-
- return object_common2(UNSERIALIZE_PASSTHRU,
- object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR));
-}
-yy30: yych = *++YYCURSOR;
- if(yych <= ','){
- if(yych != '+') goto yy2;
- } else {
- if(yych <= '-') goto yy31;
- if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy32;
- goto yy2;
- }
-yy31: yych = *++YYCURSOR;
- if(yych <= '/') goto yy2;
- if(yych >= ':') goto yy2;
-yy32: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy33: if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy32;
- if(yych >= ';') goto yy2;
-yy34: yych = *++YYCURSOR;
- if(yych != '{') goto yy2;
-yy35: yych = *++YYCURSOR;
-yy36:
-#line 324
- {
- int elements = parse_iv(start + 2);
-
- *p = YYCURSOR;
-
- INIT_PZVAL(*rval);
- Z_TYPE_PP(rval) = IS_ARRAY;
- ALLOC_HASHTABLE(Z_ARRVAL_PP(rval));
-
- zend_hash_init(Z_ARRVAL_PP(rval), elements + 1, NULL, ZVAL_PTR_DTOR, 0);
-
- if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_ARRVAL_PP(rval), elements)) {
- return 0;
- }
-
- return finish_nested_data(UNSERIALIZE_PASSTHRU);
-}
-yy37: yych = *++YYCURSOR;
- if(yych <= ','){
- if(yych != '+') goto yy2;
- } else {
- if(yych <= '-') goto yy38;
- if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy39;
- goto yy2;
- }
-yy38: yych = *++YYCURSOR;
- if(yych <= '/') goto yy2;
- if(yych >= ':') goto yy2;
-yy39: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy40: if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy39;
- if(yych >= ';') goto yy2;
-yy41: yych = *++YYCURSOR;
- if(yych != '"') goto yy2;
-yy42: yych = *++YYCURSOR;
-yy43:
-#line 304
- {
- int len;
- char *str;
-
- len = parse_iv(start + 2);
-
- if (len == 0) {
- str = empty_string;
- } else {
- str = estrndup(YYCURSOR, len);
- }
-
- YYCURSOR += len + 2;
- *p = YYCURSOR;
-
- INIT_PZVAL(*rval);
- ZVAL_STRINGL(*rval, str, len, 0);
- return 1;
-}
-yy44: yych = *++YYCURSOR;
- if(yych <= '-'){
- if(yych == '+') goto yy45;
- if(yych <= ',') goto yy2;
- } else {
- if(yych <= '.') goto yy48;
- if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy46;
- goto yy2;
- }
-yy45: yych = *++YYCURSOR;
- if(yych == '.') goto yy48;
- if(yych <= '/') goto yy2;
- if(yych >= ':') goto yy2;
-yy46: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy47: if(yych <= ':'){
- if(yych <= '.'){
- if(yych <= '-') goto yy2;
- goto yy58;
- } else {
- if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy46;
- goto yy2;
- }
- } else {
- if(yych <= 'E'){
- if(yych <= ';') goto yy51;
- if(yych <= 'D') goto yy2;
- goto yy53;
- } else {
- if(yych == 'e') goto yy53;
- goto yy2;
- }
- }
-yy48: yych = *++YYCURSOR;
- if(yych <= '/') goto yy2;
- if(yych >= ':') goto yy2;
-yy49: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy50: if(yych <= ';'){
- if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy49;
- if(yych <= ':') goto yy2;
- } else {
- if(yych <= 'E'){
- if(yych <= 'D') goto yy2;
- goto yy53;
- } else {
- if(yych == 'e') goto yy53;
- goto yy2;
- }
- }
-yy51: yych = *++YYCURSOR;
-yy52:
-#line 297
- {
- *p = YYCURSOR;
- INIT_PZVAL(*rval);
- ZVAL_DOUBLE(*rval, atof(start + 2));
- return 1;
-}
-yy53: yych = *++YYCURSOR;
- if(yych <= ','){
- if(yych != '+') goto yy2;
- } else {
- if(yych <= '-') goto yy54;
- if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy55;
- goto yy2;
- }
-yy54: yych = *++YYCURSOR;
- if(yych <= ','){
- if(yych == '+') goto yy57;
- goto yy2;
- } else {
- if(yych <= '-') goto yy57;
- if(yych <= '/') goto yy2;
- if(yych >= ':') goto yy2;
- }
-yy55: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy56: if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy55;
- if(yych == ';') goto yy51;
- goto yy2;
-yy57: yych = *++YYCURSOR;
- if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy55;
- goto yy2;
-yy58: yych = *++YYCURSOR;
- if(yych <= '/') goto yy2;
- if(yych >= ':') goto yy2;
-yy59: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
- yych = *YYCURSOR;
-yy60: if(yych <= ';'){
- if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy59;
- if(yych <= ':') goto yy2;
- goto yy51;
- } else {
- if(yych <= 'E'){
- if(yych <= 'D') goto yy2;
- goto yy53;
- } else {
- if(yych == 'e') goto yy53;
- goto yy2;
- }
- }
-yy61: yych = *++YYCURSOR;
- if(yych <= ','){
- if(yych != '+') goto yy2;
- } else {
- if(yych <= '-') goto yy62;
- if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy63;
- goto yy2;
- }
-yy62: yych = *++YYCURSOR;
- if(yych <= '/') goto yy2;
- if(yych >= ':') goto yy2;
-yy63: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy64: if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy63;
- if(yych != ';') goto yy2;
-yy65: yych = *++YYCURSOR;
-yy66:
-#line 290
- {
- *p = YYCURSOR;
- INIT_PZVAL(*rval);
- ZVAL_LONG(*rval, parse_iv(start + 2));
- return 1;
-}
-yy67: yych = *++YYCURSOR;
- if(yych <= ','){
- if(yych != '+') goto yy2;
- } else {
- if(yych <= '-') goto yy68;
- if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy69;
- goto yy2;
- }
-yy68: yych = *++YYCURSOR;
- if(yych <= '/') goto yy2;
- if(yych >= ':') goto yy2;
-yy69: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy70: if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy69;
- if(yych != ';') goto yy2;
-yy71: yych = *++YYCURSOR;
-yy72:
-#line 283
- {
- *p = YYCURSOR;
- INIT_PZVAL(*rval);
- ZVAL_BOOL(*rval, parse_iv(start + 2));
- return 1;
-}
-yy73: yych = *++YYCURSOR;
-yy74:
-#line 276
- {
- *p = YYCURSOR;
- INIT_PZVAL(*rval);
- ZVAL_NULL(*rval);
- return 1;
-}
-yy75: yych = *++YYCURSOR;
- if(yych <= ','){
- if(yych != '+') goto yy2;
- } else {
- if(yych <= '-') goto yy76;
- if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy77;
- goto yy2;
- }
-yy76: yych = *++YYCURSOR;
- if(yych <= '/') goto yy2;
- if(yych >= ':') goto yy2;
-yy77: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy78: if(yych <= '/') goto yy2;
- if(yych <= '9') goto yy77;
- if(yych != ';') goto yy2;
-yy79: yych = *++YYCURSOR;
-yy80:
-#line 257
- {
- int id;
-
- *p = YYCURSOR;
- if (!var_hash) return 0;
-
- id = parse_iv(start + 2) - 1;
- if (id == -1 || var_access(var_hash, id, &rval_ref) != SUCCESS) {
- return 0;
- }
-
- zval_ptr_dtor(rval);
- *rval = *rval_ref;
- (*rval)->refcount++;
- (*rval)->is_ref = 1;
-
- return 1;
-}
-}
-#line 432
-
-
- return 0;
-}
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
deleted file mode 100644
index 883e372ce6..0000000000
--- a/ext/standard/var_unserializer.re
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "ext/standard/php_var.h"
-#include "php_incomplete_class.h"
-
-/* {{{ reference-handling for unserializer: var_* */
-#define VAR_ENTRIES_MAX 1024
-
-typedef struct {
- zval *data[VAR_ENTRIES_MAX];
- int used_slots;
- void *next;
-} var_entries;
-
-static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval)
-{
- var_entries *var_hash = var_hashx->first, *prev = NULL;
-
- while (var_hash && var_hash->used_slots == VAR_ENTRIES_MAX) {
- prev = var_hash;
- var_hash = var_hash->next;
- }
-
- if (!var_hash) {
- var_hash = emalloc(sizeof(var_entries));
- var_hash->used_slots = 0;
- var_hash->next = 0;
-
- if (!var_hashx->first)
- var_hashx->first = var_hash;
- else
- prev->next = var_hash;
- }
-
- var_hash->data[var_hash->used_slots++] = *rval;
-}
-
-PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **nzval)
-{
- int i;
- var_entries *var_hash = var_hashx->first;
-
- while (var_hash) {
- for (i = 0; i < var_hash->used_slots; i++) {
- if (var_hash->data[i] == ozval) {
- var_hash->data[i] = *nzval;
- return;
- }
- }
- var_hash = var_hash->next;
- }
-}
-
-static int var_access(php_unserialize_data_t *var_hashx, int id, zval ***store)
-{
- var_entries *var_hash = var_hashx->first;
-
- while (id >= VAR_ENTRIES_MAX && var_hash && var_hash->used_slots == VAR_ENTRIES_MAX) {
- var_hash = var_hash->next;
- id -= VAR_ENTRIES_MAX;
- }
-
- if (!var_hash) return !SUCCESS;
-
- if (id >= var_hash->used_slots) return !SUCCESS;
-
- *store = &var_hash->data[id];
-
- return SUCCESS;
-}
-
-PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
-{
- void *next;
- var_entries *var_hash = var_hashx->first;
-
- while (var_hash) {
- next = var_hash->next;
- efree(var_hash);
- var_hash = next;
- }
-}
-
-/* }}} */
-
-#define YYFILL(n) do { } while (0)
-#define YYCTYPE unsigned char
-#define YYCURSOR cursor
-#define YYLIMIT limit
-#define YYMARKER marker
-
-
-/*!re2c
-iv = [+-]? [0-9]+;
-nv = [+-]? ([0-9]* "." [0-9]+|[0-9]+ "." [0-9]+);
-nvexp = (iv | nv) [eE] [+-]? iv;
-any = [\000-\277];
-*/
-
-
-
-static inline int parse_iv2(const char *p, const char **q)
-{
- char cursor;
- int result = 0;
- int neg = 0;
-
- switch (*p) {
- case '-':
- neg++;
- /* fall-through */
- case '+':
- p++;
- }
-
- while (1) {
- cursor = *p;
- if (cursor >= '0' && cursor <= '9') {
- result = result * 10 + cursor - '0';
- } else {
- break;
- }
- p++;
- }
- if (q) *q = p;
- if (neg) return -result;
- return result;
-}
-
-static inline int parse_iv(const char *p)
-{
- return parse_iv2(p, NULL);
-}
-
-#define UNSERIALIZE_PARAMETER zval **rval, const char **p, const char *max, php_unserialize_data_t *var_hash TSRMLS_DC
-#define UNSERIALIZE_PASSTHRU rval, p, max, var_hash TSRMLS_CC
-
-static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, int elements)
-{
- while (elements-- > 0) {
- zval *key, *data;
-
- ALLOC_INIT_ZVAL(key);
-
- if (!php_var_unserialize(&key, p, max, NULL TSRMLS_CC)) {
- zval_dtor(key);
- FREE_ZVAL(key);
- return 0;
- }
-
- ALLOC_INIT_ZVAL(data);
-
- if (!php_var_unserialize(&data, p, max, var_hash TSRMLS_CC)) {
- zval_dtor(key);
- FREE_ZVAL(key);
- zval_dtor(data);
- FREE_ZVAL(data);
- return 0;
- }
-
- switch (Z_TYPE_P(key)) {
- case IS_LONG:
- zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL);
- break;
- case IS_STRING:
- zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);
- break;
-
- }
-
- zval_dtor(key);
- FREE_ZVAL(key);
- }
-
- return 1;
-}
-
-static inline int finish_nested_data(UNSERIALIZE_PARAMETER)
-{
- if (*((*p)++) == '}')
- return 1;
-
-#if SOMETHING_NEW_MIGHT_LEAD_TO_CRASH_ENABLE_IF_YOU_ARE_BRAVE
- zval_ptr_dtor(rval);
-#endif
- return 0;
-}
-
-static inline int object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
-{
- int elements;
-
- elements = parse_iv2((*p) + 2, p);
-
- (*p) += 2;
-
- object_init_ex(*rval, ce);
- return elements;
-}
-
-static inline int object_common2(UNSERIALIZE_PARAMETER, int elements)
-{
- zval *retval_ptr = NULL;
- zval fname;
-
- if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_OBJPROP_PP(rval), elements)) {
- return 0;
- }
-
- INIT_PZVAL(&fname);
- ZVAL_STRINGL(&fname, "__wakeup", sizeof("__wakeup") - 1, 0);
- call_user_function_ex(CG(function_table), rval, &fname, &retval_ptr, 0, 0, 1, NULL TSRMLS_CC);
-
- if (retval_ptr)
- zval_ptr_dtor(&retval_ptr);
-
- return finish_nested_data(UNSERIALIZE_PASSTHRU);
-
-}
-
-PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
-{
- const unsigned char *cursor, *limit, *marker, *start;
- zval **rval_ref;
-
- limit = cursor = *p;
-
- if (var_hash && cursor[0] != 'R') {
- var_push(var_hash, rval);
- }
-
- start = cursor;
-
-
-
-/*!re2c
-
-"R:" iv ";" {
- int id;
-
- *p = YYCURSOR;
- if (!var_hash) return 0;
-
- id = parse_iv(start + 2) - 1;
- if (id == -1 || var_access(var_hash, id, &rval_ref) != SUCCESS) {
- return 0;
- }
-
- zval_ptr_dtor(rval);
- *rval = *rval_ref;
- (*rval)->refcount++;
- (*rval)->is_ref = 1;
-
- return 1;
-}
-
-"N;" {
- *p = YYCURSOR;
- INIT_PZVAL(*rval);
- ZVAL_NULL(*rval);
- return 1;
-}
-
-"b:" iv ";" {
- *p = YYCURSOR;
- INIT_PZVAL(*rval);
- ZVAL_BOOL(*rval, parse_iv(start + 2));
- return 1;
-}
-
-"i:" iv ";" {
- *p = YYCURSOR;
- INIT_PZVAL(*rval);
- ZVAL_LONG(*rval, parse_iv(start + 2));
- return 1;
-}
-
-"d:" (iv | nv | nvexp) ";" {
- *p = YYCURSOR;
- INIT_PZVAL(*rval);
- ZVAL_DOUBLE(*rval, atof(start + 2));
- return 1;
-}
-
-"s:" iv ":" ["] {
- int len;
- char *str;
-
- len = parse_iv(start + 2);
-
- if (len == 0) {
- str = empty_string;
- } else {
- str = estrndup(YYCURSOR, len);
- }
-
- YYCURSOR += len + 2;
- *p = YYCURSOR;
-
- INIT_PZVAL(*rval);
- ZVAL_STRINGL(*rval, str, len, 0);
- return 1;
-}
-
-"a:" iv ":" "{" {
- int elements = parse_iv(start + 2);
-
- *p = YYCURSOR;
-
- INIT_PZVAL(*rval);
- Z_TYPE_PP(rval) = IS_ARRAY;
- ALLOC_HASHTABLE(Z_ARRVAL_PP(rval));
-
- zend_hash_init(Z_ARRVAL_PP(rval), elements + 1, NULL, ZVAL_PTR_DTOR, 0);
-
- if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_ARRVAL_PP(rval), elements)) {
- return 0;
- }
-
- return finish_nested_data(UNSERIALIZE_PASSTHRU);
-}
-
-"o:" iv ":" ["] {
-
- INIT_PZVAL(*rval);
-
- return object_common2(UNSERIALIZE_PASSTHRU,
- object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR));
-}
-
-"O:" iv ":" ["] {
- int len;
- int elements;
- int len2;
- char *class_name;
- zend_class_entry *ce;
- int incomplete_class = 0;
-
- zval *user_func;
- zval *retval_ptr;
- zval **args[1];
- zval *arg_func_name;
-
- INIT_PZVAL(*rval);
- len2 = len = parse_iv(start + 2);
- if (len == 0)
- return 0;
-
- class_name = estrndup(YYCURSOR, len);
- YYCURSOR += len;
-
- while (len-- > 0) {
- if (class_name[len] >= 'A' && class_name[len] <= 'Z') {
- class_name[len] = class_name[len] - 'A' + 'a';
- }
- }
-
- if (zend_hash_find(CG(class_table), class_name, len2 + 1, (void **) &ce) != SUCCESS) {
- if ((PG(unserialize_callback_func) == NULL) || (PG(unserialize_callback_func)[0] == '\0')) {
- incomplete_class = 1;
- ce = PHP_IC_ENTRY;
- } else {
- MAKE_STD_ZVAL(user_func);
- ZVAL_STRING(user_func, PG(unserialize_callback_func), 1);
-
- args[0] = &arg_func_name;
- MAKE_STD_ZVAL(arg_func_name);
- ZVAL_STRING(arg_func_name, class_name, 1);
-
- if (call_user_function_ex(CG(function_table), NULL, user_func, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "defined (%s) but not found", user_func->value.str.val);
- incomplete_class = 1;
- ce = PHP_IC_ENTRY;
- } else {
- if (zend_hash_find(CG(class_table), class_name, len2 + 1, (void **) &ce) != SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "(%s) hasn't defined the class it was called for", user_func->value.str.val);
- incomplete_class = 1;
- ce = PHP_IC_ENTRY;
- } else {
-#ifdef ZEND_ENGINE_2
- ce = *(zend_class_entry **)ce; /* Bad hack, TBF! */
-#endif
- efree(class_name);
- }
- }
- }
- } else {
-#ifdef ZEND_ENGINE_2
- ce = *(zend_class_entry **)ce; /* Bad hack, TBF! */
-#endif
- efree(class_name);
- }
-
- *p = YYCURSOR;
- elements = object_common1(UNSERIALIZE_PASSTHRU, ce);
-
- if (incomplete_class) {
- php_store_class_name(*rval, class_name, len2);
- efree(class_name);
- }
-
- return object_common2(UNSERIALIZE_PASSTHRU, elements);
-}
-
-"}" {
- /* this is the case where we have less data than planned */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unexpected end of serialized data");
- return 0; /* not sure if it should be 0 or 1 here? */
-}
-
-any { return 0; }
-
-*/
-
- return 0;
-}
diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c
deleted file mode 100644
index c2fccb65b5..0000000000
--- a/ext/standard/versioning.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include "php.h"
-#include "php_versioning.h"
-
-#define sign(n) ((n)<0?-1:((n)>0?1:0))
-
-/* {{{ php_canonicalize_version() */
-
-PHPAPI char *
-php_canonicalize_version(const char *version)
-{
- int len = strlen(version);
- char *buf = emalloc(len * 2 + 1), *q, lp, lq;
- const char *p;
-
- if (len == 0) {
- *buf = '\0';
- return buf;
- }
-
- p = version;
- q = buf;
- *q++ = lp = *p++;
- lq = '\0';
- while (*p) {
-/* s/[-_+]/./g;
- * s/([^\d\.])([^\D\.])/$1.$2/g;
- * s/([^\D\.])([^\d\.])/$1.$2/g;
- */
-#define isdig(x) (isdigit(x)&&(x)!='.')
-#define isndig(x) (!isdigit(x)&&(x)!='.')
-#define isspecialver(x) ((x)=='-'||(x)=='_'||(x)=='+')
-
- lq = *(q - 1);
- if (isspecialver(*p)) {
- if (lq != '.') {
- lq = *q++ = '.';
- }
- } else if ((isndig(lp) && isdig(*p)) || (isdig(lp) && isndig(*p))) {
- if (lq != '.') {
- *q++ = '.';
- }
- lq = *q++ = *p;
- } else if (!isalnum(*p)) {
- if (lq != '.') {
- lq = *q++ = '.';
- }
- } else {
- lq = *q++ = *p;
- }
- lp = *p++;
- }
- *q++ = '\0';
- return buf;
-}
-
-/* }}} */
-/* {{{ compare_special_version_forms() */
-
-typedef struct {
- const char *name;
- int order;
-} special_forms_t;
-
-static int
-compare_special_version_forms(char *form1, char *form2)
-{
- int found1 = -1, found2 = -1;
- special_forms_t special_forms[9] = {
- {"dev", 0},
- {"alpha", 1},
- {"a", 1},
- {"beta", 2},
- {"b", 2},
- {"RC", 3},
- {"#", 4},
- {"pl", 5},
- {NULL, 0},
- };
- special_forms_t *pp;
-
- for (pp = special_forms; pp && pp->name; pp++) {
- if (strncmp(form1, pp->name, strlen(pp->name)) == 0) {
- found1 = pp->order;
- break;
- }
- }
- for (pp = special_forms; pp && pp->name; pp++) {
- if (strncmp(form2, pp->name, strlen(pp->name)) == 0) {
- found2 = pp->order;
- break;
- }
- }
- return sign(found1 - found2);
-}
-
-/* }}} */
-/* {{{ php_version_compare() */
-
-PHPAPI int
-php_version_compare(const char *orig_ver1, const char *orig_ver2)
-{
- char *ver1;
- char *ver2;
- char *p1, *p2, *n1, *n2;
- long l1, l2;
- int compare = 0;
-
- if (!*orig_ver1 || !*orig_ver2) {
- if (!*orig_ver1 && !*orig_ver2) {
- return 0;
- } else {
- return *orig_ver1 ? 1 : -1;
- }
- }
- if (orig_ver1[0] == '#') {
- ver1 = estrdup(orig_ver1);
- } else {
- ver1 = php_canonicalize_version(orig_ver1);
- }
- if (orig_ver2[0] == '#') {
- ver2 = estrdup(orig_ver2);
- } else {
- ver2 = php_canonicalize_version(orig_ver2);
- }
- p1 = n1 = ver1;
- p2 = n2 = ver2;
- while (*p1 && *p2 && n1 && n2) {
- if ((n1 = strchr(p1, '.')) != NULL) {
- *n1 = '\0';
- }
- if ((n2 = strchr(p2, '.')) != NULL) {
- *n2 = '\0';
- }
- if (isdigit(*p1) && isdigit(*p2)) {
- /* compare element numerically */
- l1 = strtol(p1, NULL, 10);
- l2 = strtol(p2, NULL, 10);
- compare = sign(l1 - l2);
- } else if (!isdigit(*p1) && !isdigit(*p2)) {
- /* compare element names */
- compare = compare_special_version_forms(p1, p2);
- } else {
- /* mix of names and numbers */
- if (isdigit(*p1)) {
- compare = compare_special_version_forms("#N#", p2);
- } else {
- compare = compare_special_version_forms(p1, "#N#");
- }
- }
- if (compare != 0) {
- break;
- }
- if (n1 != NULL) {
- p1 = n1 + 1;
- }
- if (n2 != NULL) {
- p2 = n2 + 1;
- }
- }
- if (compare == 0) {
- if (n1 != NULL) {
- if (isdigit(*p1)) {
- compare = 1;
- } else {
- compare = php_version_compare(p1, "#N#");
- }
- } else if (n2 != NULL) {
- if (isdigit(*p2)) {
- compare = -1;
- } else {
- compare = php_version_compare("#N#", p2);
- }
- }
- }
- efree(ver1);
- efree(ver2);
- return compare;
-}
-
-/* }}} */
-/* {{{ do_version_compare() */
-
-/* {{{ proto int version_compare(string ver1, string ver2 [, string oper])
- Compares two "PHP-standardized" version number strings */
-
-PHP_FUNCTION(version_compare)
-{
- char *v1, *v2, *op;
- int v1_len, v2_len, op_len;
- int compare, argc;
-
- argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "ss|s", &v1, &v1_len, &v2,
- &v2_len, &op, &op_len) == FAILURE) {
- return;
- }
- compare = php_version_compare(v1, v2);
- if (argc == 2) {
- RETURN_LONG(compare);
- }
- if (!strncmp(op, "<", op_len) || !strncmp(op, "lt", op_len)) {
- RETURN_BOOL(compare == -1);
- }
- if (!strncmp(op, "<=", op_len) || !strncmp(op, "le", op_len)) {
- RETURN_BOOL(compare != 1);
- }
- if (!strncmp(op, ">", op_len) || !strncmp(op, "gt", op_len)) {
- RETURN_BOOL(compare == 1);
- }
- if (!strncmp(op, ">=", op_len) || !strncmp(op, "ge", op_len)) {
- RETURN_BOOL(compare != -1);
- }
- if (!strncmp(op, "==", op_len) || !strncmp(op, "=", op_len) || !strncmp(op, "eq", op_len)) {
- RETURN_BOOL(compare == 0);
- }
- if (!strncmp(op, "!=", op_len) || !strncmp(op, "<>", op_len) || !strncmp(op, "ne", op_len)) {
- RETURN_BOOL(compare != 0);
- }
- RETURN_NULL();
-}
-
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/swf/CREDITS b/ext/swf/CREDITS
deleted file mode 100644
index a215076e37..0000000000
--- a/ext/swf/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-SWF
-Sterling Hughes
diff --git a/ext/swf/config.m4 b/ext/swf/config.m4
deleted file mode 100644
index 69f90e12a7..0000000000
--- a/ext/swf/config.m4
+++ /dev/null
@@ -1,35 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(swf, for libswf support,
-[ --with-swf[=DIR] Include swf support])
-
-if test "$PHP_SWF" != "no"; then
- if test -r $PHP_SWF/lib/libswf.a; then
- SWF_DIR=$PHP_SWF
- else
- AC_MSG_CHECKING(for libswf in default path)
- for i in /usr/local /usr; do
- if test -r $i/lib/libswf.a; then
- SWF_DIR=$i
- AC_MSG_RESULT(found in $i)
- fi
- done
- fi
-
- if test -z "$SWF_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the libswf distribution -
- swf.h should be <swf-dir>/include and
- libswf.a should be in <swf-dir>/lib)
- fi
-
- PHP_ADD_INCLUDE($SWF_DIR/include)
-
- PHP_SUBST(SWF_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(swf, $SWF_DIR/lib, SWF_SHARED_LIBADD)
- AC_DEFINE(HAVE_SWF,1,[ ])
-
- PHP_NEW_EXTENSION(swf, swf.c, $ext_shared)
-fi
diff --git a/ext/swf/php_swf.h b/ext/swf/php_swf.h
deleted file mode 100644
index 1b0158e409..0000000000
--- a/ext/swf/php_swf.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SWF_H
-#define PHP_SWF_H
-
-#if HAVE_SWF
-
-extern zend_module_entry swf_module_entry;
-#define swf_module_ptr &swf_module_entry
-
-PHP_MINIT_FUNCTION(swf);
-PHP_MINFO_FUNCTION(swf);
-PHP_RINIT_FUNCTION(swf);
-void php_swf_define(INTERNAL_FUNCTION_PARAMETERS, int opt);
-void php_swf_fill_bitmap(INTERNAL_FUNCTION_PARAMETERS, int opt);
-void php_swf_geo_same(INTERNAL_FUNCTION_PARAMETERS, int opt);
-PHP_FUNCTION(swf_openfile);
-PHP_FUNCTION(swf_closefile);
-PHP_FUNCTION(swf_labelframe);
-PHP_FUNCTION(swf_showframe);
-PHP_FUNCTION(swf_setframe);
-PHP_FUNCTION(swf_getframe);
-PHP_FUNCTION(swf_mulcolor);
-PHP_FUNCTION(swf_addcolor);
-PHP_FUNCTION(swf_placeobject);
-PHP_FUNCTION(swf_modifyobject);
-PHP_FUNCTION(swf_removeobject);
-PHP_FUNCTION(swf_nextid);
-PHP_FUNCTION(swf_startdoaction);
-PHP_FUNCTION(swf_enddoaction);
-PHP_FUNCTION(swf_actiongotoframe);
-PHP_FUNCTION(swf_actiongeturl);
-PHP_FUNCTION(swf_actionnextframe);
-PHP_FUNCTION(swf_actionprevframe);
-PHP_FUNCTION(swf_actionplay);
-PHP_FUNCTION(swf_actionstop);
-PHP_FUNCTION(swf_actiontogglequality);
-PHP_FUNCTION(swf_actionwaitforframe);
-PHP_FUNCTION(swf_actionsettarget);
-PHP_FUNCTION(swf_actiongotolabel);
-PHP_FUNCTION(swf_defineline);
-PHP_FUNCTION(swf_definerect);
-PHP_FUNCTION(swf_definepoly);
-PHP_FUNCTION(swf_startshape);
-PHP_FUNCTION(swf_shapelinesolid);
-PHP_FUNCTION(swf_shapefilloff);
-PHP_FUNCTION(swf_shapefillsolid);
-PHP_FUNCTION(swf_shapefillbitmapclip);
-PHP_FUNCTION(swf_shapefillbitmaptile);
-PHP_FUNCTION(swf_shapemoveto);
-PHP_FUNCTION(swf_shapelineto);
-PHP_FUNCTION(swf_shapecurveto);
-PHP_FUNCTION(swf_shapecurveto3);
-PHP_FUNCTION(swf_shapearc);
-PHP_FUNCTION(swf_endshape);
-PHP_FUNCTION(swf_definefont);
-PHP_FUNCTION(swf_setfont);
-PHP_FUNCTION(swf_fontsize);
-PHP_FUNCTION(swf_fontslant);
-PHP_FUNCTION(swf_fonttracking);
-PHP_FUNCTION(swf_getfontinfo);
-PHP_FUNCTION(swf_definetext);
-PHP_FUNCTION(swf_textwidth);
-PHP_FUNCTION(swf_definebitmap);
-PHP_FUNCTION(swf_getbitmapinfo);
-PHP_FUNCTION(swf_startsymbol);
-PHP_FUNCTION(swf_endsymbol);
-PHP_FUNCTION(swf_startbutton);
-PHP_FUNCTION(swf_addbuttonrecord);
-PHP_FUNCTION(swf_oncondition);
-PHP_FUNCTION(swf_endbutton);
-PHP_FUNCTION(swf_viewport);
-PHP_FUNCTION(swf_ortho);
-PHP_FUNCTION(swf_ortho2);
-PHP_FUNCTION(swf_perspective);
-PHP_FUNCTION(swf_polarview);
-PHP_FUNCTION(swf_lookat);
-PHP_FUNCTION(swf_pushmatrix);
-PHP_FUNCTION(swf_popmatrix);
-PHP_FUNCTION(swf_scale);
-PHP_FUNCTION(swf_translate);
-PHP_FUNCTION(swf_rotate);
-PHP_FUNCTION(swf_posround);
-
-
-ZEND_BEGIN_MODULE_GLOBALS(swf)
- int use_file;
- char *tmpfile_name;
-ZEND_END_MODULE_GLOBALS(swf)
-
-#ifdef ZTS
-#define SWFG(v) TSRMG(swf_globals_id, zend_swf_globals *, v)
-#else
-#define SWFG(v) (swf_globals.v)
-#endif
-
-#else
-#define swf_module_ptr NULL
-#endif /* HAVE_FLASH */
-#define phpext_swf_ptr swf_module_ptr
-#endif /* _PHP_FLASH_H */
diff --git a/ext/swf/swf.c b/ext/swf/swf.c
deleted file mode 100644
index 8c10df882f..0000000000
--- a/ext/swf/swf.c
+++ /dev/null
@@ -1,1263 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_SWF
-#include <stdio.h>
-#include <swf.h>
-#include "ext/standard/info.h"
-#include "php_open_temporary_file.h"
-#include "php_swf.h"
-
-ZEND_DECLARE_MODULE_GLOBALS(swf)
-
-/* {{{ swf_functions[]
- */
-function_entry swf_functions[] = {
- PHP_FE(swf_openfile, NULL)
- PHP_FE(swf_closefile, NULL)
- PHP_FE(swf_labelframe, NULL)
- PHP_FE(swf_showframe, NULL)
- PHP_FE(swf_setframe, NULL)
- PHP_FE(swf_getframe, NULL)
- PHP_FE(swf_mulcolor, NULL)
- PHP_FE(swf_addcolor, NULL)
- PHP_FE(swf_placeobject, NULL)
- PHP_FE(swf_modifyobject, NULL)
- PHP_FE(swf_removeobject, NULL)
- PHP_FE(swf_nextid, NULL)
- PHP_FE(swf_startdoaction, NULL)
- PHP_FE(swf_enddoaction, NULL)
- PHP_FE(swf_actiongotoframe, NULL)
- PHP_FE(swf_actiongeturl, NULL)
- PHP_FE(swf_actionnextframe, NULL)
- PHP_FE(swf_actionprevframe, NULL)
- PHP_FE(swf_actionplay, NULL)
- PHP_FE(swf_actionstop, NULL)
- PHP_FE(swf_actiontogglequality, NULL)
- PHP_FE(swf_actionwaitforframe, NULL)
- PHP_FE(swf_actionsettarget, NULL)
- PHP_FE(swf_actiongotolabel, NULL)
- PHP_FE(swf_defineline, NULL)
- PHP_FE(swf_definerect, NULL)
- PHP_FE(swf_definepoly, NULL)
- PHP_FE(swf_startshape, NULL)
- PHP_FE(swf_shapelinesolid, NULL)
- PHP_FE(swf_shapefilloff, NULL)
- PHP_FE(swf_shapefillsolid, NULL)
- PHP_FE(swf_shapefillbitmapclip, NULL)
- PHP_FE(swf_shapefillbitmaptile, NULL)
- PHP_FE(swf_shapemoveto, NULL)
- PHP_FE(swf_shapelineto, NULL)
- PHP_FE(swf_shapecurveto, NULL)
- PHP_FE(swf_shapecurveto3, NULL)
- PHP_FE(swf_shapearc, NULL)
- PHP_FE(swf_endshape, NULL)
- PHP_FE(swf_definefont, NULL)
- PHP_FE(swf_setfont, NULL)
- PHP_FE(swf_fontsize, NULL)
- PHP_FE(swf_fontslant, NULL)
- PHP_FE(swf_fonttracking, NULL)
- PHP_FE(swf_getfontinfo, NULL)
- PHP_FE(swf_definetext, NULL)
- PHP_FE(swf_textwidth, NULL)
- PHP_FE(swf_definebitmap, NULL)
- PHP_FE(swf_getbitmapinfo, NULL)
- PHP_FE(swf_startsymbol, NULL)
- PHP_FE(swf_endsymbol, NULL)
- PHP_FE(swf_startbutton, NULL)
- PHP_FE(swf_addbuttonrecord, NULL)
- PHP_FE(swf_oncondition, NULL)
- PHP_FE(swf_endbutton, NULL)
- PHP_FE(swf_viewport, NULL)
- PHP_FE(swf_ortho, NULL)
- PHP_FE(swf_ortho2, NULL)
- PHP_FE(swf_perspective, NULL)
- PHP_FE(swf_polarview, NULL)
- PHP_FE(swf_lookat, NULL)
- PHP_FE(swf_pushmatrix, NULL)
- PHP_FE(swf_popmatrix, NULL)
- PHP_FE(swf_scale, NULL)
- PHP_FE(swf_translate, NULL)
- PHP_FE(swf_rotate, NULL)
- PHP_FE(swf_posround, NULL)
- {NULL,NULL,NULL}
-};
-/* }}} */
-
-/* {{{ swf_module_entry
- */
-zend_module_entry swf_module_entry = {
- STANDARD_MODULE_HEADER,
- "swf",
- swf_functions,
- PHP_MINIT(swf),
- NULL,
- PHP_RINIT(swf),
- NULL,
- PHP_MINFO(swf),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_SWF
-ZEND_GET_MODULE(swf)
-#endif
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(swf)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "swf support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ _swf_init_globals
- */
-static void _swf_init_globals(zend_swf_globals *sg)
-{
- memset(sg, 0, sizeof(zend_swf_globals));
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(swf)
-{
- ZEND_INIT_MODULE_GLOBALS(swf, _swf_init_globals, NULL);
-
- REGISTER_LONG_CONSTANT("MOD_COLOR", MOD_COLOR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MOD_MATRIX", MOD_MATRIX, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("TYPE_PUSHBUTTON", TYPE_PUSHBUTTON, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("TYPE_MENUBUTTON", TYPE_MENUBUTTON, CONST_CS | CONST_PERSISTENT);
- REGISTER_DOUBLE_CONSTANT("BSHitTest", BSHitTest, CONST_CS | CONST_PERSISTENT);
- REGISTER_DOUBLE_CONSTANT("BSDown", BSDown, CONST_CS | CONST_PERSISTENT);
- REGISTER_DOUBLE_CONSTANT("BSOver", BSOver, CONST_CS | CONST_PERSISTENT);
- REGISTER_DOUBLE_CONSTANT("BSUp", BSUp, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OverDowntoIdle", OverDowntoIdle, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IdletoOverDown", IdletoOverDown, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OutDowntoIdle", OutDowntoIdle, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OutDowntoOverDown", OutDowntoOverDown, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OverDowntoOutDown", OverDowntoOutDown, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OverUptoOverDown", OverUptoOverDown, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OverUptoIdle", OverUptoIdle, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IdletoOverUp", IdletoOverUp, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ButtonEnter", ButtonEnter, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ButtonExit", ButtonExit, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MenuEnter", MenuEnter, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MenuExit", MenuExit, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(swf)
-{
- SWFG(use_file) = 0;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto void swf_openfile(string name, float xsize, float ysize, float framerate, float r, float g, float b)
- Create a Shockwave Flash file given by name, with width xsize and height ysize at a frame rate of framerate and a background color specified by a red value of r, green value of g and a blue value of b */
-PHP_FUNCTION(swf_openfile)
-{
- zval **name, **sizeX, **sizeY, **frameRate, **r, **g, **b;
- char *na, *tmpna;
- zend_bool free_na = 0;
-
- if (ZEND_NUM_ARGS() != 7 ||
- zend_get_parameters_ex(7, &name, &sizeX, &sizeY, &frameRate, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(name);
- convert_to_double_ex(sizeX);
- convert_to_double_ex(sizeY);
- convert_to_double_ex(frameRate);
- convert_to_double_ex(r);
- convert_to_double_ex(g);
- convert_to_double_ex(b);
-
-
- tmpna = Z_STRVAL_PP(name);
-
- if (strcasecmp("php://stdout", tmpna) == 0) {
- FILE *fp;
-
- fp = php_open_temporary_file(NULL, "php_swf_stdout", &na TSRMLS_CC);
- if (!fp) {
- free_na = 0;
- RETURN_FALSE;
- }
- VCWD_UNLINK((const char *)na);
- fclose(fp);
- free_na = 1;
- SWFG(use_file) = 0;
- } else {
- na = tmpna;
- SWFG(use_file) = 1;
- }
-
-#ifdef VIRTUAL_DIR
- if (virtual_filepath(na, &tmpna TSRMLS_CC)) {
- if (free_na) {
- efree(na);
- }
- return;
- }
- if (free_na) {
- efree(na);
- }
- na = tmpna;
-#endif
- if (!SWFG(use_file))
- SWFG(tmpfile_name) = na;
-
- swf_openfile(na,(float)Z_DVAL_PP(sizeX), (float)Z_DVAL_PP(sizeY),
- (float)Z_DVAL_PP(frameRate), (float)Z_DVAL_PP(r),
- (float)Z_DVAL_PP(g), (float)Z_DVAL_PP(b));
-#ifdef VIRTUAL_DIR
- free(na);
-#endif
-}
-/* }}} */
-
-/* {{{ proto void swf_closefile(void)
- Close a Shockwave flash file that was opened with swf_openfile */
-PHP_FUNCTION(swf_closefile)
-{
- swf_closefile();
-
- if (!SWFG(use_file)) {
- FILE *f;
- char buf[4096];
- int b;
-
- if ((f = VCWD_FOPEN(SWFG(tmpfile_name), "r")) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create temporary file for stdout support with SWF");
- RETURN_NULL();
- }
-
- while ((b = fread(buf, 1, sizeof(buf), f)) > 0)
- php_write(buf, b TSRMLS_CC);
-
- fclose(f);
-
- VCWD_UNLINK((const char *)SWFG(tmpfile_name));
- efree(SWFG(tmpfile_name));
- }
-}
-/* }}} */
-
-/* {{{ proto void swf_labelframe(string name)
- Adds string name to the current frame */
-PHP_FUNCTION(swf_labelframe)
-{
- zval **name;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(name);
- swf_labelframe(Z_STRVAL_PP(name));
-}
-/* }}} */
-
-/* {{{ proto void swf_showframe(void)
- Finish the current frame */
-PHP_FUNCTION(swf_showframe)
-{
- swf_showframe();
-}
-/* }}} */
-
-/* {{{ proto void swf_setframe(int frame_number)
- Set the current frame number to the number given by frame_number */
-PHP_FUNCTION(swf_setframe)
-{
- zval **frameno;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &frameno) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(frameno);
-
- swf_setframe(Z_LVAL_PP(frameno));
-}
-/* }}} */
-
-/* {{{ proto int swf_getframe(void)
- Returns the current frame */
-PHP_FUNCTION(swf_getframe)
-{
- RETURN_LONG(swf_getframe());
-}
-/* }}} */
-
-/* {{{ col_swf
- */
-void col_swf(INTERNAL_FUNCTION_PARAMETERS, int opt) {
- zval **r, **g, **b, **a;
- if (ZEND_NUM_ARGS() != 4 ||
- zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(r);
- convert_to_double_ex(g);
- convert_to_double_ex(b);
- convert_to_double_ex(a);
- if (opt) {
- swf_addcolor((float)Z_DVAL_PP(r), (float)Z_DVAL_PP(g), (float)Z_DVAL_PP(b), (float)Z_DVAL_PP(a));
- } else {
- swf_mulcolor((float)Z_DVAL_PP(r), (float)Z_DVAL_PP(g), (float)Z_DVAL_PP(b), (float)Z_DVAL_PP(a));
- }
-}
-/* }}} */
-
-/* {{{ proto void swf_mulcolor(float r, float g, float b, float a)
- Sets the global multiply color to the rgba value specified */
-PHP_FUNCTION(swf_mulcolor)
-{
- col_swf(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto void swf_addcolor(float r, float g, float b, float a)
- Set the global add color to the rgba value specified */
-PHP_FUNCTION(swf_addcolor)
-{
- col_swf(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto void swf_placeobject(int objid, int depth)
- Places the object, objid, in the current frame at depth, depth */
-PHP_FUNCTION(swf_placeobject)
-{
- zval **objid, **depth;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &objid, &depth) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(objid);
- convert_to_long_ex(depth);
- swf_placeobject(Z_LVAL_PP(objid), Z_LVAL_PP(depth));
-}
-/* }}} */
-
-/* {{{ proto void swf_modifyobject(int depth, int how)
- Updates the position and/or color of the object */
-PHP_FUNCTION(swf_modifyobject)
-{
- zval **depth, **how;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &depth, &how) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(depth);
- convert_to_long_ex(how);
-
- swf_modifyobject(Z_LVAL_PP(depth), Z_LVAL_PP(how));
-}
-/* }}} */
-
-/* {{{ proto void swf_removeobject(int depth)
- Removes the object at the specified depth */
-PHP_FUNCTION(swf_removeobject)
-{
- zval **depth;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &depth) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(depth);
-
- swf_removeobject(Z_LVAL_PP(depth));
-}
-/* }}} */
-
-/* {{{ proto int swf_nextid(void)
- Returns a free objid */
-PHP_FUNCTION(swf_nextid)
-{
- RETURN_LONG(swf_nextid());
-}
-/* }}} */
-
-/* {{{ proto void swf_startdoaction(void)
- Starts the description of an action list for the current frame */
-PHP_FUNCTION(swf_startdoaction)
-{
- swf_startdoaction();
-}
-/* }}} */
-
-/* {{{ proto void swf_enddoaction(void)
- Ends the list of actions to perform for the current frame */
-PHP_FUNCTION(swf_enddoaction)
-{
- swf_enddoaction();
-}
-/* }}} */
-
-/* {{{ proto void swf_actiongotoframe(int frame_number)
- Causes the Flash movie to display the specified frame, frame_number, and then stop. */
-PHP_FUNCTION(swf_actiongotoframe)
-{
- zval **frameno;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &frameno) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(frameno);
-
- swf_actionGotoFrame(Z_LVAL_PP(frameno));
-}
-/* }}} */
-
-/* {{{ proto void swf_actiongeturl(string url, string target)
- Gets the specified url */
-PHP_FUNCTION(swf_actiongeturl)
-{
- zval **url, **target;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &url, &target) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(url);
- convert_to_string_ex(target);
-
- swf_actionGetURL(Z_STRVAL_PP(url), Z_STRVAL_PP(target));
-}
-/* }}} */
-
-/* {{{ proto void swf_actionnextframe(void)
- Goes foward one frame */
-PHP_FUNCTION(swf_actionnextframe)
-{
- swf_actionNextFrame();
-}
-/* }}} */
-
-/* {{{ proto void swf_actionprevframe(void)
- Goes backward one frame */
-PHP_FUNCTION(swf_actionprevframe)
-{
- swf_actionPrevFrame();
-}
-/* }}} */
-
-/* {{{ proto void swf_actionplay(void)
- Starts playing the Flash movie from the current frame */
-PHP_FUNCTION(swf_actionplay)
-{
- swf_actionPlay();
-}
-/* }}} */
-
-/* {{{ proto void swf_actionstop(void)
- Stops playing the Flash movie at the current frame */
-PHP_FUNCTION(swf_actionstop)
-{
- swf_actionStop();
-}
-/* }}} */
-
-/* {{{ proto void swf_actiontogglequality(void)
- Toggles between high and low quality */
-PHP_FUNCTION(swf_actiontogglequality)
-{
- swf_actionToggleQuality();
-}
-/* }}} */
-
-/* {{{ proto void swf_actionwaitforframe(int frame, int skipcount)
- If the specified frame has not been loaded, skip the specified number of actions in the action list */
-PHP_FUNCTION(swf_actionwaitforframe)
-{
- zval **frame, **skipcount;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &frame, &skipcount) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(frame);
- convert_to_long_ex(skipcount);
- swf_actionWaitForFrame(Z_LVAL_PP(frame), Z_LVAL_PP(skipcount));
-}
-/* }}} */
-
-/* {{{ proto void swf_actionsettarget(string target)
- Sets the context for actions */
-PHP_FUNCTION(swf_actionsettarget)
-{
- zval **target;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &target) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(target);
- swf_actionSetTarget(Z_STRVAL_PP(target));
-}
-/* }}} */
-
-/* {{{ proto void swf_actiongotolabel(string label)
- Causes the flash movie to display the frame with the given label and then stop */
-PHP_FUNCTION(swf_actiongotolabel)
-{
- zval **label;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &label) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(label);
- swf_actionGoToLabel(Z_STRVAL_PP(label));
-}
-/* }}} */
-
-/* {{{ php_swf_define
- */
-void php_swf_define(INTERNAL_FUNCTION_PARAMETERS, int opt)
-{
- zval **objid, **x1, **y1, **x2, **y2, **width;
- if (ZEND_NUM_ARGS() != 6 ||
- zend_get_parameters_ex(6, &objid, &x1, &y1, &x2, &y2, &width) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(objid);
- convert_to_double_ex(x1);
- convert_to_double_ex(y1);
- convert_to_double_ex(x2);
- convert_to_double_ex(y2);
- convert_to_double_ex(width);
-
- if (opt) {
- swf_defineline(Z_LVAL_PP(objid), (float)Z_DVAL_PP(x1), (float)Z_DVAL_PP(y1),
- (float)Z_DVAL_PP(x2), (float)Z_DVAL_PP(y2), (float)Z_DVAL_PP(width));
- } else {
- swf_definerect(Z_LVAL_PP(objid), (float)Z_DVAL_PP(x1), (float)Z_DVAL_PP(y1),
- (float)Z_DVAL_PP(x2), (float)Z_DVAL_PP(y2), (float)Z_DVAL_PP(width));
- }
-}
-/* }}} */
-
-/* {{{ proto void swf_defineline(int objid, float x1, float y1, float x2, float y2, float width)
- Create a line with object id, objid, starting from x1, y1 and going to x2, y2 with width, width */
-PHP_FUNCTION(swf_defineline)
-{
- php_swf_define(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto void swf_definerect(int objid, float x1, float y1, float x2, float y2, float width)
- Create a rectangle with object id, objid, the upper lefthand coordinate is given by x1, y1 the bottom right coordinate is x2, y2 and with is the width of the line */
-PHP_FUNCTION(swf_definerect)
-{
- php_swf_define(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto void swf_definepoly(int obj_id, array coords, int npoints, float width)
- Define a Polygon from an array of x,y coordinates, coords. */
-PHP_FUNCTION(swf_definepoly)
-{
- zval **obj_id, **coordinates, **NumPoints, **width, **var;
- int npoints, i;
- float coords[256][2];
-
- if (ZEND_NUM_ARGS() != 4 ||
- zend_get_parameters_ex(4, &obj_id, &coordinates, &NumPoints, &width) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(obj_id);
- convert_to_long_ex(NumPoints);
- convert_to_double_ex(width);
-
- if (Z_TYPE_PP(coordinates) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong datatype of second argument to swf_definepoly");
- RETURN_FALSE;
- }
-
- npoints = Z_LVAL_PP(NumPoints);
- for (i = 0; i < npoints; i++)
- {
- if (zend_hash_index_find(Z_ARRVAL_PP(coordinates), (i * 2), (void **)&var) == SUCCESS) {
- SEPARATE_ZVAL(var);
- convert_to_double_ex(var);
- coords[i][0] = (float)Z_DVAL_PP(var);
- }
-
- if (zend_hash_index_find(Z_ARRVAL_PP(coordinates), (i * 2) + 1, (void **)&var) == SUCCESS) {
- SEPARATE_ZVAL(var);
- convert_to_double_ex(var);
- coords[i][1] = (float)Z_DVAL_PP(var);
- }
-
- }
- swf_definepoly(Z_LVAL_PP(obj_id), coords, npoints, (float)Z_DVAL_PP(width));
-}
-/* }}} */
-
-/* {{{ proto void swf_startshape(int objid)
- Initialize a new shape with object id, objid */
-PHP_FUNCTION(swf_startshape)
-{
- zval **objid;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &objid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(objid);
- swf_startshape(Z_LVAL_PP(objid));
-}
-/* }}} */
-
-/* {{{ proto void swf_shapelinesolid(float r, float g, float b, float a, float width)
- Create a line with color defined by rgba, and a width of width */
-PHP_FUNCTION(swf_shapelinesolid)
-{
- zval **r, **g, **b, **a, **width;
- if (ZEND_NUM_ARGS() != 5 ||
- zend_get_parameters_ex(5, &r, &g, &b, &a, &width) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(r);
- convert_to_double_ex(g);
- convert_to_double_ex(b);
- convert_to_double_ex(a);
- convert_to_double_ex(width);
- swf_shapelinesolid((float)Z_DVAL_PP(r), (float)Z_DVAL_PP(g), (float)Z_DVAL_PP(b), (float)Z_DVAL_PP(a),
- (float)Z_DVAL_PP(width));
-}
-/* }}} */
-
-/* {{{ proto void swf_shapefilloff(void)
- Turns off filling */
-PHP_FUNCTION(swf_shapefilloff)
-{
- swf_shapefilloff();
-}
-/* }}} */
-
-/* {{{ proto void swf_shapefillsolid(float r, float g, float b, float a)
- Sets the current fill style to a solid fill with the specified rgba color */
-PHP_FUNCTION(swf_shapefillsolid)
-{
- zval **r, **g, **b, **a;
- if (ZEND_NUM_ARGS() != 4 ||
- zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(r);
- convert_to_double_ex(g);
- convert_to_double_ex(b);
- convert_to_double_ex(a);
-
- swf_shapefillsolid((float)Z_DVAL_PP(r), (float)Z_DVAL_PP(g), (float)Z_DVAL_PP(b), (float)Z_DVAL_PP(a));
-}
-/* }}} */
-
-/* {{{ php_swf_fill_bitmap
- */
-void php_swf_fill_bitmap(INTERNAL_FUNCTION_PARAMETERS, int opt)
-{
- zval **bitmapid;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &bitmapid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(bitmapid);
-
- if (opt) {
- swf_shapefillbitmapclip(Z_LVAL_PP(bitmapid));
- } else {
- swf_shapefillbitmaptile(Z_LVAL_PP(bitmapid));
- }
-}
-/* }}} */
-
-/* {{{ proto void swf_shapefillbitmapclip(int bitmapid)
- Sets the current fill mode to clipped bitmap fill. Pixels from the previously defined bitmapid will be used to fill areas */
-PHP_FUNCTION(swf_shapefillbitmapclip)
-{
- php_swf_fill_bitmap(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto void swf_shapefillbitmaptile(int bitmapid)
- Sets the current fill mode to tiled bitmap fill. Pixels from the previously defined bitmapid will be used to fill areas */
-PHP_FUNCTION(swf_shapefillbitmaptile)
-{
- php_swf_fill_bitmap(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ php_swf_shape
- */
-void php_swf_shape(INTERNAL_FUNCTION_PARAMETERS, int opt)
-{
- zval **x, **y;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- if (opt) {
- swf_shapemoveto((float)Z_DVAL_PP(x), (float)Z_DVAL_PP(y));
- } else {
- swf_shapelineto((float)Z_DVAL_PP(x), (float)Z_DVAL_PP(y));
- }
-}
-/* }}} */
-
-/* {{{ proto void swf_shapemoveto(float x, float y)
- swf_shapemoveto moves the current position to the given x,y. */
-PHP_FUNCTION(swf_shapemoveto)
-{
- php_swf_shape(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto void swf_shapelineto(float x, float y)
- Draws a line from the current position to x,y, the current position is then set to x,y */
-PHP_FUNCTION(swf_shapelineto)
-{
- php_swf_shape(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto void swf_shapecurveto(float x1, float y1, float x2, float y2)
- Draws a quadratic bezier curve starting at the current position using x1, y1 as an off curve control point and using x2, y2 as the end point. The current position is then set to x2, y2. */
-PHP_FUNCTION(swf_shapecurveto)
-{
- zval **x1, **y1, **x2, **y2;
- if (ZEND_NUM_ARGS() != 4 ||
- zend_get_parameters_ex(4, &x1, &y1, &x2, &y2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x1);
- convert_to_double_ex(y1);
- convert_to_double_ex(x2);
- convert_to_double_ex(y2);
-
- swf_shapecurveto((float)Z_DVAL_PP(x1), (float)Z_DVAL_PP(y1), (float)Z_DVAL_PP(x2), (float)Z_DVAL_PP(y2));
-}
-/* }}} */
-
-/* {{{ proto void swf_shapecurveto3(float x1, float y1, float x2, float y2, float x3, float y3)
- Draws a cubic bezier curve starting at the current position using x1, y1 and x2, y2 as off curve control points and using x3,y3 as the end point. The current position is then sent to x3, y3 */
-PHP_FUNCTION(swf_shapecurveto3)
-{
- zval **x1, **y1, **x2, **y2, **x3, **y3;
- if (ZEND_NUM_ARGS() != 6 ||
- zend_get_parameters_ex(6, &x1, &y1, &x2, &y2, &x3, &y3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x1);
- convert_to_double_ex(y1);
- convert_to_double_ex(x2);
- convert_to_double_ex(y2);
- convert_to_double_ex(x3);
- convert_to_double_ex(y3);
-
- swf_shapecurveto3((float)Z_DVAL_PP(x1), (float)Z_DVAL_PP(y1), (float)Z_DVAL_PP(x2), (float)Z_DVAL_PP(y2),
- (float)Z_DVAL_PP(x3), (float)Z_DVAL_PP(y3));
-}
-/* }}} */
-
-/* {{{ proto void swf_shapearc(float x, float y, float r, float ang1, float ang2)
- Draws a circular arc from ang1 to ang2. The center of the circle is given by x, and y. r specifies the radius of the arc */
-PHP_FUNCTION(swf_shapearc)
-{
- zval **x, **y, **r, **ang1, **ang2;
- if (ZEND_NUM_ARGS() != 5 ||
- zend_get_parameters_ex(5, &x, &y, &r, &ang1, &ang2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- convert_to_double_ex(r);
- convert_to_double_ex(ang1);
- convert_to_double_ex(ang2);
-
- swf_shapearc((float)Z_DVAL_PP(x), (float)Z_DVAL_PP(y), (float)Z_DVAL_PP(r), (float)Z_DVAL_PP(ang1),
- (float)Z_DVAL_PP(ang2));
-}
-/* }}} */
-
-/* {{{ proto void swf_endshape(void)
- Completes the definition of the current shape */
-PHP_FUNCTION(swf_endshape)
-{
- swf_endshape();
-}
-/* }}} */
-
-/* {{{ proto void swf_definefont(int fontid, string name)
- Defines a font. name specifies the PostScript name of the font to use. This font also becomes the current font. */
-PHP_FUNCTION(swf_definefont)
-{
- zval **fontid, **name;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &fontid, &name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(fontid);
- convert_to_string_ex(name);
-
- swf_definefont(Z_LVAL_PP(fontid), Z_STRVAL_PP(name));
-}
-/* }}} */
-
-/* {{{ proto void swf_setfont(int fontid)
- Sets fontid to the current font */
-PHP_FUNCTION(swf_setfont)
-{
- zval **fontid;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &fontid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(fontid);
- swf_setfont(Z_LVAL_PP(fontid));
-}
-/* }}} */
-
-/* {{{ proto void swf_fontsize(float height)
- Sets the current font's height to the value specified by height */
-PHP_FUNCTION(swf_fontsize)
-{
- zval **height;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &height) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(height);
-
- swf_fontsize((float)Z_DVAL_PP(height));
-}
-/* }}} */
-
-/* {{{ proto void swf_fontslant(float slant)
- Set the current font slant to the angle indicated by slant */
-PHP_FUNCTION(swf_fontslant)
-{
- zval **slant;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &slant) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(slant);
-
- swf_fontslant((float)Z_DVAL_PP(slant));
-}
-/* }}} */
-
-/* {{{ proto void swf_fonttracking(track)
- Sets the current font tracking to the specified value, track */
-PHP_FUNCTION(swf_fonttracking)
-{
- zval **track;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &track) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(track);
- swf_fonttracking((float)Z_DVAL_PP(track));
-}
-/* }}} */
-
-/* {{{ proto array swf_getfontinfo(void)
- Get information about the current font */
-PHP_FUNCTION(swf_getfontinfo)
-{
- float A_height, x_height;
- swf_getfontinfo(&A_height, &x_height);
-
- array_init(return_value);
- add_assoc_double(return_value, "Aheight", A_height);
- add_assoc_double(return_value, "xheight", x_height);
-}
-/* }}} */
-
-/* {{{ proto void swf_definetext(int objid, string str, int docCenter)
- defines a text string using the current font, current fontsize and current font slant. If docCenter is 1, the word is centered in x */
-PHP_FUNCTION(swf_definetext)
-{
- zval **objid, **str, **docCenter;
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &objid, &str, &docCenter) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(objid);
- convert_to_string_ex(str);
- convert_to_long_ex(docCenter);
-
- swf_definetext(Z_LVAL_PP(objid), Z_STRVAL_PP(str), Z_LVAL_PP(docCenter));
-}
-/* }}} */
-
-/* {{{ proto void swf_textwidth(string str)
- Calculates the width of a string, str, using the current fontsize & current font */
-PHP_FUNCTION(swf_textwidth)
-{
- zval **str;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
- RETURN_DOUBLE((double)swf_textwidth(Z_STRVAL_PP(str)));
-}
-/* }}} */
-
-/* {{{ proto void swf_definebitmap(int objid, string imgname)
- Defines a bitmap given the name of a .gif .rgb .jpeg or .fi image. The image will be converted into Flash jpeg or Flash color map format */
-PHP_FUNCTION(swf_definebitmap)
-{
- zval **objid, **imgname;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &objid, &imgname) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(objid);
- convert_to_string_ex(imgname);
-
- swf_definebitmap(Z_LVAL_PP(objid), Z_STRVAL_PP(imgname));
-}
-/* }}} */
-
-/* {{{ proto array swf_getbitmapinfo(int bitmapid)
- Returns an array of information about a bitmap specified by bitmapid */
-PHP_FUNCTION(swf_getbitmapinfo)
-{
- zval **bitmapid;
- int size, width, height;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &bitmapid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(bitmapid);
-
- size = swf_getbitmapinfo(Z_LVAL_PP(bitmapid), &width, &height);
-
- array_init(return_value);
-
- add_assoc_long(return_value, "size", size);
- add_assoc_long(return_value, "width", width);
- add_assoc_long(return_value, "height", height);
-}
-/* }}} */
-
-/* {{{ proto void swf_startsymbol(int objid)
- Create a new symbol with object id, objid */
-PHP_FUNCTION(swf_startsymbol)
-{
- zval **objid;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &objid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(objid);
-
- swf_startsymbol(Z_LVAL_PP(objid));
-}
-/* }}} */
-
-/* {{{ proto void swf_endsymbol(void)
- End the current symbol */
-PHP_FUNCTION(swf_endsymbol)
-{
- swf_endsymbol();
-}
-/* }}} */
-
-/* {{{ proto void swf_startbutton(int objid, int type)
- Start a button with an object id, objid and a type of either TYPE_MENUBUTTON or TYPE_PUSHBUTTON */
-PHP_FUNCTION(swf_startbutton)
-{
- zval **objid, **type;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &objid, &type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(objid);
- convert_to_long_ex(type);
-
- swf_startbutton(Z_LVAL_PP(objid), Z_LVAL_PP(type)); /* TYPE_MENUBUTTON, TYPE_PUSHBUTTON */
-}
-/* }}} */
-
-/* {{{ proto void swf_addbuttonrecord(int state, int objid, int depth)
- Controls the location, appearance and active area of the current button */
-PHP_FUNCTION(swf_addbuttonrecord)
-{
- zval **state, **objid, **depth;
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &state, &objid, &depth) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(state);
- convert_to_long_ex(objid);
- convert_to_long_ex(depth);
-
- swf_addbuttonrecord(Z_LVAL_PP(state), Z_LVAL_PP(objid), Z_LVAL_PP(depth));
-}
-/* }}} */
-
-/* {{{ proto void swf_oncondition(int transitions)
- Describes a transition used to trigger an action list */
-PHP_FUNCTION(swf_oncondition)
-{
- zval **transitions;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &transitions) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(transitions);
-
- swf_oncondition(Z_LVAL_PP(transitions));
-}
-/* }}} */
-
-/* {{{ proto void swf_endbutton(void)
- Complete the definition of the current button */
-PHP_FUNCTION(swf_endbutton)
-{
- swf_endbutton();
-}
-/* }}} */
-
-/* {{{ php_swf_geo_same
- */
-void php_swf_geo_same(INTERNAL_FUNCTION_PARAMETERS, int opt)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- if (ZEND_NUM_ARGS() != 4 ||
- zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(arg1);
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
-
- if (opt == 0) {
- swf_viewport(Z_DVAL_PP(arg1), Z_DVAL_PP(arg2), Z_DVAL_PP(arg3),
- Z_DVAL_PP(arg4));
- } else if (opt == 1) {
- swf_ortho2(Z_DVAL_PP(arg1), Z_DVAL_PP(arg2), Z_DVAL_PP(arg3),
- Z_DVAL_PP(arg4));
- } else if (opt == 2) {
- swf_polarview(Z_DVAL_PP(arg1), Z_DVAL_PP(arg2), Z_DVAL_PP(arg3),
- Z_DVAL_PP(arg4));
- } else if (opt == 3) {
- swf_perspective(Z_DVAL_PP(arg1), Z_DVAL_PP(arg2), Z_DVAL_PP(arg3),
- Z_DVAL_PP(arg4));
- }
-}
-/* }}} */
-
-/* {{{ proto void swf_viewport(float xmin, float xmax, float ymin, float ymax)
- Selects an area on the drawing surface for future drawing */
-PHP_FUNCTION(swf_viewport)
-{
- php_swf_geo_same(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto void swf_ortho2(float xmin, float xmax, float ymin, float ymax)
- Defines a 2-D orthographic mapping of user coordinates onto the current viewport */
-PHP_FUNCTION(swf_ortho2)
-{
- php_swf_geo_same(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto void swf_ortho(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)
- Defines an orthographic mapping of user coordinates onto the current viewport */
-PHP_FUNCTION(swf_ortho)
-{
- zval **xmin, **xmax, **ymin, **ymax, **zmin, **zmax;
- if (ZEND_NUM_ARGS() != 6 ||
- zend_get_parameters_ex(6, &xmin, &xmax, &ymin, &ymax, &zmin, &zmax) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(xmin);
- convert_to_double_ex(xmax);
- convert_to_double_ex(ymin);
- convert_to_double_ex(ymax);
- convert_to_double_ex(zmin);
- convert_to_double_ex(zmax);
-
- swf_ortho(Z_DVAL_PP(xmin), Z_DVAL_PP(xmax),
- Z_DVAL_PP(ymin), Z_DVAL_PP(ymax),
- Z_DVAL_PP(zmin), Z_DVAL_PP(zmax));
-}
-/* }}} */
-
-/* {{{ proto void swf_polarview(float dist, float azimuth, float incidence, float twist)
- Defines he viewer's position in polar coordinates */
-PHP_FUNCTION(swf_polarview)
-{
- php_swf_geo_same(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);
-}
-/* }}} */
-
-/* {{{ proto void swf_perspective(float fovy, float aspect, float near, float far)
- Define a perspective projection transformation. */
-PHP_FUNCTION(swf_perspective)
-{
- php_swf_geo_same(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3);
-}
-/* }}} */
-
-/* {{{ proto void swf_lookat(float vx, float vy, float vz, float px, float py, float pz, float twist)
- Defines a viewing transformation by giving the view position vx, vy, vz, and the coordinates of a reference point in the scene at px, py, pz. Twist controls a rotation along the viewer's z axis */
-PHP_FUNCTION(swf_lookat)
-{
- zval **vx, **vy, **vz, **px, **py, **pz, **twist;
- if (ZEND_NUM_ARGS() != 7 ||
- zend_get_parameters_ex(7, &vx, &vy, &vz, &px, &py, &pz, &twist) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(vx);
- convert_to_double_ex(vy);
- convert_to_double_ex(vz);
- convert_to_double_ex(px);
- convert_to_double_ex(py);
- convert_to_double_ex(pz);
- convert_to_double_ex(twist);
-
- swf_lookat(Z_DVAL_PP(vx), Z_DVAL_PP(vy), Z_DVAL_PP(vz),
- Z_DVAL_PP(px), Z_DVAL_PP(py), Z_DVAL_PP(pz), Z_DVAL_PP(twist));
-}
-/* }}} */
-
-/* {{{ proto void swf_pushmatrix(void)
- Push the current transformation matrix onto the stack */
-PHP_FUNCTION(swf_pushmatrix)
-{
- swf_pushmatrix();
-}
-/* }}} */
-
-/* {{{ proto void swf_popmatrix(void)
- Restore a previous transformation matrix */
-PHP_FUNCTION(swf_popmatrix)
-{
- swf_popmatrix();
-}
-/* }}} */
-
-/* {{{ proto void swf_scale(float x, float y, float z)
- Scale the current transformation */
-PHP_FUNCTION(swf_scale)
-{
- zval **x, **y, **z;
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &x, &y, &z) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- convert_to_double_ex(z);
-
- swf_scale(Z_DVAL_PP(x), Z_DVAL_PP(y), Z_DVAL_PP(z));
-}
-/* }}} */
-
-/* {{{ proto void swf_translate(float x, float y, float z)
- Translate the current transformation */
-PHP_FUNCTION(swf_translate)
-{
- zval **x, **y, **z;
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &x, &y, &z) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- convert_to_double_ex(z);
-
- swf_translate(Z_DVAL_PP(x), Z_DVAL_PP(y), Z_DVAL_PP(z));
-}
-/* }}} */
-
-/* {{{ proto void swf_rotate(float angle, string axis)
- Rotate the current transformation by the given angle about x, y, or z axis. The axis may be 'x', 'y', or 'z' */
-PHP_FUNCTION(swf_rotate)
-{
- zval **angle, **axis;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &angle, &axis) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(angle);
- convert_to_string_ex(axis);
-
- swf_rotate(Z_DVAL_PP(angle), (char)(Z_STRVAL_PP(axis))[0]);
-}
-/* }}} */
-
-/* {{{ proto void swf_posround(int doit)
- This enables or disables rounding of the translation when objects are places or moved */
-PHP_FUNCTION(swf_posround)
-{
- zval **doit;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &doit) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(doit);
-
- swf_posround(Z_LVAL_PP(doit));
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/sybase/CREDITS b/ext/sybase/CREDITS
deleted file mode 100644
index 632dcce0ca..0000000000
--- a/ext/sybase/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Sybase-DB
-Zeev Suraski
diff --git a/ext/sybase/config.m4 b/ext/sybase/config.m4
deleted file mode 100644
index 5d0c25f73f..0000000000
--- a/ext/sybase/config.m4
+++ /dev/null
@@ -1,30 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(sybase,for Sybase support,
-[ --with-sybase[=DIR] Include Sybase-DB support. DIR is the Sybase home
- directory, defaults to /home/sybase.])
-
-
-if test "$PHP_SYBASE" != "no"; then
- if test "$PHP_SYBASE" = "yes"; then
- SYBASE_INCDIR=/home/sybase/include
- SYBASE_LIBDIR=/home/sybase/lib
- else
- SYBASE_INCDIR=$PHP_SYBASE/include
- SYBASE_LIBDIR=$PHP_SYBASE/lib
- fi
- PHP_ADD_INCLUDE($SYBASE_INCDIR)
- PHP_ADD_LIBRARY_WITH_PATH(sybdb, $SYBASE_LIBDIR, SYBASE_SHARED_LIBADD)
- PHP_NEW_EXTENSION(sybase, php_sybase_db.c, $ext_shared)
- AC_CHECK_LIB(dnet_stub, dnet_addr,
- [ PHP_ADD_LIBRARY_WITH_PATH(dnet_stub,,SYBASE_SHARED_LIBADD)
- AC_DEFINE(HAVE_LIBDNET_STUB,1,[ ])
- ])
- AC_DEFINE(HAVE_SYBASE,1,[ ])
- AC_CHECK_LIB(sybdb, tdsdbopen,
- [ AC_DEFINE(PHP_SYBASE_DBOPEN,tdsdbopen,[ ])
- AC_DEFINE(DBMFIX,1,[ ]) ],
- [ AC_DEFINE(PHP_SYBASE_DBOPEN,dbopen,[ ]) ])
-fi
diff --git a/ext/sybase/php_sybase_db.c b/ext/sybase/php_sybase_db.c
deleted file mode 100644
index dff1e56bcf..0000000000
--- a/ext/sybase/php_sybase_db.c
+++ /dev/null
@@ -1,1409 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- | php_sybase_get_column_content_with_type() based on code by: |
- | Muhammad A Muquit <MA_Muquit@fccc.edu> |
- | Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_sybase_db.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-#include "php_globals.h"
-
-#if HAVE_SYBASE
-
-#include <sybfront.h>
-#include <sybdb.h>
-#include <syberror.h>
-
-#if BROKEN_SYBASE_PCONNECTS
-#include "http_log.h"
-#endif
-
-/* Moved these structures/defines into the .c file (or into a *private* header),
- because leaving them in php_sybase_db.h caused namespace pollution in
- main/internal_functions.c. */
-
-#define coltype(j) dbcoltype(sybase_ptr->link,j)
-#define intcol(i) ((int) *(DBINT *) dbdata(sybase_ptr->link,i))
-#define smallintcol(i) ((int) *(DBSMALLINT *) dbdata(sybase_ptr->link,i))
-#define tinyintcol(i) ((int) *(DBTINYINT *) dbdata(sybase_ptr->link,i))
-#define anyintcol(j) (coltype(j)==SYBINT4?intcol(j):(coltype(j)==SYBINT2?smallintcol(j):tinyintcol(j)))
-#define charcol(i) ((DBCHAR *) dbdata(sybase_ptr->link,i))
-#define floatcol(i) ((float) *(DBFLT8 *) dbdata(sybase_ptr->link,i))
-
-typedef struct sybase_link_struct sybase_link;
-
-struct sybase_link_struct {
- LOGINREC *login;
- DBPROCESS *link;
- int valid;
-};
-
-#define SYBASE_ROWS_BLOCK 128
-
-typedef struct {
- char *name,*column_source;
- int max_length, numeric;
- int type;
-} sybase_field;
-
-typedef struct {
- pval ***data;
- sybase_field *fields;
- sybase_link *sybase_ptr;
- int cur_row,cur_field;
- int num_rows,num_fields;
-} sybase_result;
-
-
-function_entry sybase_functions[] = {
- PHP_FE(sybase_connect, NULL)
- PHP_FE(sybase_pconnect, NULL)
- PHP_FE(sybase_close, NULL)
- PHP_FE(sybase_select_db, NULL)
- PHP_FE(sybase_query, NULL)
- PHP_FE(sybase_free_result, NULL)
- PHP_FE(sybase_get_last_message, NULL)
- PHP_FE(sybase_num_rows, NULL)
- PHP_FE(sybase_num_fields, NULL)
- PHP_FE(sybase_fetch_row, NULL)
- PHP_FE(sybase_fetch_array, NULL)
- PHP_FE(sybase_fetch_object, NULL)
- PHP_FE(sybase_data_seek, NULL)
- PHP_FE(sybase_fetch_field, NULL)
- PHP_FE(sybase_field_seek, NULL)
- PHP_FE(sybase_result, NULL)
- PHP_FE(sybase_affected_rows, NULL)
- PHP_FE(sybase_min_error_severity, NULL)
- PHP_FE(sybase_min_message_severity, NULL)
- PHP_FALIAS(mssql_connect, sybase_connect, NULL)
- PHP_FALIAS(mssql_pconnect, sybase_pconnect, NULL)
- PHP_FALIAS(mssql_close, sybase_close, NULL)
- PHP_FALIAS(mssql_select_db, sybase_select_db, NULL)
- PHP_FALIAS(mssql_query, sybase_query, NULL)
- PHP_FALIAS(mssql_free_result, sybase_free_result, NULL)
- PHP_FALIAS(mssql_get_last_message, sybase_get_last_message, NULL)
- PHP_FALIAS(mssql_num_rows, sybase_num_rows, NULL)
- PHP_FALIAS(mssql_num_fields, sybase_num_fields, NULL)
- PHP_FALIAS(mssql_fetch_row, sybase_fetch_row, NULL)
- PHP_FALIAS(mssql_fetch_array, sybase_fetch_array, NULL)
- PHP_FALIAS(mssql_fetch_object, sybase_fetch_object, NULL)
- PHP_FALIAS(mssql_data_seek, sybase_data_seek, NULL)
- PHP_FALIAS(mssql_fetch_field, sybase_fetch_field, NULL)
- PHP_FALIAS(mssql_field_seek, sybase_field_seek, NULL)
- PHP_FALIAS(mssql_result, sybase_result, NULL)
- PHP_FALIAS(mssql_affected_rows, sybase_affected_rows, NULL)
- PHP_FALIAS(mssql_min_error_severity, sybase_min_error_severity, NULL)
- PHP_FALIAS(mssql_min_message_severity, sybase_min_message_severity, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry sybase_module_entry = {
- STANDARD_MODULE_HEADER,
- "sybase", sybase_functions, PHP_MINIT(sybase), PHP_MSHUTDOWN(sybase), PHP_RINIT(sybase), PHP_RSHUTDOWN(sybase), PHP_MINFO(sybase), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_SYBASE
-ZEND_GET_MODULE(sybase)
-#endif
-
-THREAD_LS sybase_module php_sybase_module;
-
-
-#define CHECK_LINK(link) { if (link==-1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: A link to the server could not be established"); RETURN_FALSE; } }
-
-
-static void php_sybase_get_column_content(sybase_link *sybase_ptr,int offset,pval **result_ptr, int column_type);
-
-/* error handler */
-static int php_sybase_error_handler(DBPROCESS *dbproc,int severity,int dberr,
- int oserr,char *dberrstr,char *oserrstr)
-{
- if (severity >= php_sybase_module.min_error_severity) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase error: %s (severity %d)",dberrstr,severity);
- }
- return INT_CANCEL;
-}
-
-/* message handler */
-static int php_sybase_message_handler(DBPROCESS *dbproc,DBINT msgno,int msgstate,
- int severity,char *msgtext,char *srvname,
- char *procname,DBUSMALLINT line)
-{
- if (severity >= php_sybase_module.min_message_severity) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase message: %s (severity %d)",msgtext,severity);
- }
- STR_FREE(php_sybase_module.server_message);
- php_sybase_module.server_message = estrdup(msgtext);
- return 0;
-}
-
-
-static int _clean_invalid_results(list_entry *le TSRMLS_DC)
-{
- if (Z_TYPE_P(le) == php_sybase_module.le_result) {
- sybase_link *sybase_ptr = ((sybase_result *) le->ptr)->sybase_ptr;
-
- if (!sybase_ptr->valid) {
- return 1;
- }
- }
- return 0;
-}
-
-
-static void _free_sybase_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- sybase_result *result = (sybase_result *)rsrc->ptr;
- int i,j;
-
- if (result->data) {
- for (i=0; i<result->num_rows; i++) {
- for (j=0; j<result->num_fields; j++) {
- zval_ptr_dtor(&result->data[i][j]);
- }
- efree(result->data[i]);
- }
- efree(result->data);
- }
-
- if (result->fields) {
- for (i=0; i<result->num_fields; i++) {
- STR_FREE(result->fields[i].name);
- STR_FREE(result->fields[i].column_source);
- }
- efree(result->fields);
- }
- efree(result);
-}
-
-
-static void _close_sybase_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- sybase_link *sybase_ptr = (sybase_link *)rsrc->ptr;
-
- sybase_ptr->valid = 0;
-
- /*
- this can cause crashes in the current model.
- if the resource gets destroyed via destroy_resource_list() resource_list
- will *not* be in a consistent state. thies@thieso.net
- */
-
- zend_hash_apply(&EG(regular_list), (apply_func_t) _clean_invalid_results TSRMLS_CC);
- dbclose(sybase_ptr->link);
- dbloginfree(sybase_ptr->login);
- efree(sybase_ptr);
- php_sybase_module.num_links--;
-}
-
-
-static void _close_sybase_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- sybase_link *sybase_ptr = (sybase_link *)rsrc->ptr;
-
- dbclose(sybase_ptr->link);
- dbloginfree(sybase_ptr->login);
- free(sybase_ptr);
- php_sybase_module.num_persistent--;
- php_sybase_module.num_links--;
-}
-
-
-PHP_MINIT_FUNCTION(sybase)
-{
- char *interface_file;
-
- if (dbinit()==FAIL) {
- return FAILURE;
- }
- dberrhandle((EHANDLEFUNC) php_sybase_error_handler);
- dbmsghandle((MHANDLEFUNC) php_sybase_message_handler);
-
- if (cfg_get_string("sybase.interface_file",&interface_file)==SUCCESS) {
- dbsetifile(interface_file);
- }
- if (cfg_get_long("sybase.allow_persistent",&php_sybase_module.allow_persistent)==FAILURE) {
- php_sybase_module.allow_persistent=1;
- }
- if (cfg_get_long("sybase.max_persistent",&php_sybase_module.max_persistent)==FAILURE) {
- php_sybase_module.max_persistent=-1;
- }
- if (cfg_get_long("sybase.max_links",&php_sybase_module.max_links)==FAILURE) {
- php_sybase_module.max_links=-1;
- }
- if (cfg_get_long("sybase.min_error_severity",&php_sybase_module.cfg_min_error_severity)==FAILURE) {
- php_sybase_module.cfg_min_error_severity=10;
- }
- if (cfg_get_long("sybase.min_message_severity",&php_sybase_module.cfg_min_message_severity)==FAILURE) {
- php_sybase_module.cfg_min_message_severity=10;
- }
- if (cfg_get_long("sybase.compatability_mode",&php_sybase_module.compatability_mode)==FAILURE) {
- php_sybase_module.compatability_mode = 0;
- }
-
- php_sybase_module.num_persistent=0;
- php_sybase_module.le_link = zend_register_list_destructors_ex(_close_sybase_link, NULL, "sybase-db link", module_number);
- php_sybase_module.le_plink = zend_register_list_destructors_ex(NULL, _close_sybase_plink, "sybase-db link persistent", module_number);
- php_sybase_module.le_result = zend_register_list_destructors_ex(_free_sybase_result, NULL, "sybase-db result", module_number);
-
- return SUCCESS;
-}
-
-
-PHP_RINIT_FUNCTION(sybase)
-{
- php_sybase_module.default_link=-1;
- php_sybase_module.num_links = php_sybase_module.num_persistent;
- php_sybase_module.appname = estrndup("PHP 4.0",7);
- php_sybase_module.server_message = empty_string;
- php_sybase_module.min_error_severity = php_sybase_module.cfg_min_error_severity;
- php_sybase_module.min_message_severity = php_sybase_module.cfg_min_message_severity;
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(sybase)
-{
- dbexit();
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(sybase)
-{
- efree(php_sybase_module.appname);
- STR_FREE(php_sybase_module.server_message);
- return SUCCESS;
-}
-
-static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
-{
- char *user=NULL,*passwd=NULL,*host=NULL,*charset=NULL,*appname=NULL;
- char *hashed_details;
- int hashed_details_length;
- sybase_link sybase,*sybase_ptr;
-
- switch(ZEND_NUM_ARGS()) {
- case 0: /* defaults */
- hashed_details_length=6+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- strcpy(hashed_details,"sybase___");
- break;
- case 1: {
- zval **yyhost;
-
- if (zend_get_parameters_ex(1, &yyhost) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(yyhost);
- host = Z_STRVAL_PP(yyhost);
- hashed_details_length = Z_STRLEN_PP(yyhost)+6+5;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"sybase_%s____", Z_STRVAL_PP(yyhost));
- }
- break;
- case 2: {
- zval **yyhost, **yyuser;
-
- if (zend_get_parameters_ex(ht, 2, &yyhost, &yyuser) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(yyhost);
- convert_to_string_ex(yyuser);
- host = Z_STRVAL_PP(yyhost);
- user = Z_STRVAL_PP(yyuser);
- hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+6+5;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"sybase_%s_%s___",Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser));
- }
- break;
- case 3: {
- zval **yyhost, **yyuser,**yypasswd;
-
- if (zend_get_parameters_ex(3, &yyhost, &yyuser, &yypasswd) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(yyhost);
- convert_to_string_ex(yyuser);
- convert_to_string_ex(yypasswd);
- host = Z_STRVAL_PP(yyhost);
- user = Z_STRVAL_PP(yyuser);
- passwd = Z_STRVAL_PP(yypasswd);
- hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+Z_STRLEN_PP(yypasswd)+6+5;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"sybase_%s_%s_%s__",Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser),Z_STRVAL_PP(yypasswd)); /* SAFE */
- }
- break;
- case 4: {
- zval **yyhost, **yyuser, **yypasswd, **yycharset;
-
- if (zend_get_parameters_ex(4, &yyhost, &yyuser, &yypasswd, &yycharset) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(yyhost);
- convert_to_string_ex(yyuser);
- convert_to_string_ex(yypasswd);
- convert_to_string_ex(yycharset);
- host = Z_STRVAL_PP(yyhost);
- user = Z_STRVAL_PP(yyuser);
- passwd = Z_STRVAL_PP(yypasswd);
- charset = Z_STRVAL_PP(yycharset);
- hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+Z_STRLEN_PP(yypasswd)+Z_STRLEN_PP(yycharset)+6+5;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"sybase_%s_%s_%s_%s_",Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser),Z_STRVAL_PP(yypasswd),Z_STRVAL_PP(yycharset)); /* SAFE */
- }
- break;
- case 5: {
- zval **yyhost, **yyuser, **yypasswd, **yycharset, **yyappname;
-
- if (zend_get_parameters_ex(5, &yyhost, &yyuser, &yypasswd, &yycharset, &yyappname) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(yyhost);
- convert_to_string_ex(yyuser);
- convert_to_string_ex(yypasswd);
- convert_to_string_ex(yycharset);
- convert_to_string_ex(yyappname);
- host = Z_STRVAL_PP(yyhost);
- user = Z_STRVAL_PP(yyuser);
- passwd = Z_STRVAL_PP(yypasswd);
- charset = Z_STRVAL_PP(yycharset);
- appname = Z_STRVAL_PP(yyappname);
- hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+Z_STRLEN_PP(yypasswd)+Z_STRLEN_P(yycharset)+Z_STRLEN_PP(yyappname)+6+5;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"sybase_%s_%s_%s_%s_%s",Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser),Z_STRVAL_PP(yypasswd),Z_STRVAL_PP(yycharset),Z_STRVAL_PP(yyappname)); /* SAFE */
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
-
- /* set a DBLOGIN record */
- if ((sybase.login=dblogin())==NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Unable to allocate login record");
- goto err;
- }
-
- if (user) {
- DBSETLUSER(sybase.login,user);
- }
- if (passwd) {
- DBSETLPWD(sybase.login,passwd);
- }
- if (charset) {
- DBSETLCHARSET(sybase.login,charset);
- }
- if (appname) {
- DBSETLAPP(sybase.login,appname);
- } else {
- DBSETLAPP(sybase.login,php_sybase_module.appname);
- }
-
- sybase.valid = 1;
-
- if (!php_sybase_module.allow_persistent) {
- persistent=0;
- }
- if (persistent) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
-
- if (php_sybase_module.max_links!=-1 && php_sybase_module.num_links>=php_sybase_module.max_links) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Too many open links (%d)",php_sybase_module.num_links);
- goto err_login;
- }
- if (php_sybase_module.max_persistent!=-1 && php_sybase_module.num_persistent>=php_sybase_module.max_persistent) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Too many open persistent links (%d)",php_sybase_module.num_persistent);
- goto err_login;
- }
- /* create the link */
- if ((sybase.link=PHP_SYBASE_DBOPEN(sybase.login,host))==FAIL) {
- /*php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Unable to connect to server: %s",sybase_error(sybase));*/
- goto err_login;
- }
-
- if (dbsetopt(sybase.link,DBBUFFER,"2",-1)==FAIL) {
- goto err_link;
- }
-
- /* hash it up */
- sybase_ptr = (sybase_link *) malloc(sizeof(sybase_link));
- memcpy(sybase_ptr,&sybase,sizeof(sybase_link));
- Z_TYPE(new_le) = php_sybase_module.le_plink;
- new_le.ptr = sybase_ptr;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry),NULL)==FAILURE) {
- free(sybase_ptr);
- goto err_link;
- }
- php_sybase_module.num_persistent++;
- php_sybase_module.num_links++;
- } else { /* we do */
- if (Z_TYPE_P(le) != php_sybase_module.le_plink) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Hashed persistent link is not a Sybase link!");
- goto err_login;
- }
-
- sybase_ptr = (sybase_link *) le->ptr;
- /* test that the link hasn't died */
- if (DBDEAD(sybase_ptr->link)==TRUE) {
- if ((sybase_ptr->link=PHP_SYBASE_DBOPEN(sybase_ptr->login,host))==FAIL) {
- /*php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Link to server lost, unable to reconnect");*/
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1);
- goto err_login;
- }
- if (dbsetopt(sybase_ptr->link,DBBUFFER,"2",-1)==FAIL) {
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1);
- goto err_login;
- }
- }
- }
- Z_LVAL_P(return_value) = zend_list_insert(sybase_ptr,php_sybase_module.le_plink);
- Z_TYPE_P(return_value) = IS_LONG;
- } else { /* non persistent */
- list_entry *index_ptr,new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual sybase link sits.
- * if it doesn't, open a new sybase link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list),hashed_details,hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
- int type,link;
- void *ptr;
-
- if (Z_TYPE_P(index_ptr) != le_index_ptr) {
- goto err_login;
- }
- link = (int) index_ptr->ptr;
- ptr = zend_list_find(link,&type); /* check if the link is still there */
- if (ptr && (type==php_sybase_module.le_link || type==php_sybase_module.le_plink)) {
- Z_LVAL_P(return_value) = php_sybase_module.default_link = link;
- Z_TYPE_P(return_value) = IS_LONG;
- efree(hashed_details);
- dbloginfree(sybase.login);
- return;
- } else {
- zend_hash_del(&EG(regular_list),hashed_details,hashed_details_length+1);
- }
- }
- if (php_sybase_module.max_links!=-1 && php_sybase_module.num_links>=php_sybase_module.max_links) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Too many open links (%d)",php_sybase_module.num_links);
- goto err_login;
- }
-
- if ((sybase.link=PHP_SYBASE_DBOPEN(sybase.login,host))==NULL) {
- /*php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Unable to connect to server: %s",sybase_error(sybase));*/
- goto err_login;
- }
-
- if (dbsetopt(sybase.link,DBBUFFER,"2",-1)==FAIL) {
- goto err_link;
- }
-
- /* add it to the list */
- sybase_ptr = (sybase_link *) emalloc(sizeof(sybase_link));
- memcpy(sybase_ptr,&sybase,sizeof(sybase_link));
- Z_LVAL_P(return_value) = zend_list_insert(sybase_ptr,php_sybase_module.le_link);
- Z_TYPE_P(return_value) = IS_LONG;
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
- Z_TYPE(new_index_ptr) = le_index_ptr;
- if (zend_hash_update(&EG(regular_list),hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry),NULL)==FAILURE) {
- goto err_link;
- }
- php_sybase_module.num_links++;
- }
- efree(hashed_details);
- php_sybase_module.default_link=Z_LVAL_P(return_value);
- return;
-
-err_link:
- dbclose(sybase.link);
-err_login:
- dbloginfree(sybase.login);
-err:
- efree(hashed_details);
- RETURN_FALSE;
-}
-
-
-static int php_sybase_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
-{
- if (php_sybase_module.default_link==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_sybase_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
- }
- return php_sybase_module.default_link;
-}
-
-
-/* {{{ proto int sybase_connect([string host [, string user [, string password [, string charset [, string appname]]]]])
- Open Sybase server connection */
-PHP_FUNCTION(sybase_connect)
-{
- php_sybase_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-/* }}} */
-
-/* {{{ proto int sybase_pconnect([string host [, string user [, string password [, string charset [, string appname]]]]])
- Open persistent Sybase connection */
-PHP_FUNCTION(sybase_pconnect)
-{
- php_sybase_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ proto bool sybase_close([int link_id])
- Close Sybase connection */
-PHP_FUNCTION(sybase_close)
-{
- zval **sybase_link_index;
- int id,type;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_sybase_module.default_link;
- break;
- case 1:
- if (zend_get_parameters_ex(1, &sybase_link_index) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(sybase_link_index);
- id = Z_LVAL_PP(sybase_link_index);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- zend_list_find(id,&type);
- if (type!=php_sybase_module.le_link && type!=php_sybase_module.le_plink) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"%d is not a Sybase link index",id);
- RETURN_FALSE;
- }
-
- zend_list_delete(id);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto bool sybase_select_db(string database [, int link_id])
- Select Sybase database */
-PHP_FUNCTION(sybase_select_db)
-{
- zval *db, **sybase_link_index;
- int id,type;
- sybase_link *sybase_ptr;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &db) == FAILURE) {
- RETURN_FALSE;
- }
- id = php_sybase_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &db, &sybase_link_index) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(sybase_link_index);
- id = Z_LVAL_PP(sybase_link_index);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- CHECK_LINK(id);
-
- sybase_ptr = (sybase_link *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_link && type!=php_sybase_module.le_plink) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"%d is not a Sybase link index",id);
- RETURN_FALSE;
- }
-
- convert_to_string(db);
-
- if (dbuse(sybase_ptr->link,Z_STRVAL_PP(db))==FAIL) {
- /*php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Unable to select database: %s",sybase_error(sybase));*/
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-
-static void php_sybase_get_column_content(sybase_link *sybase_ptr,int offset,pval **result_ptr, int column_type)
-{
- zval *result;
-
- ALLOC_INIT_ZVAL(result);
- *result_ptr = result;
-
- if (dbdatlen(sybase_ptr->link,offset) == 0) {
- ZVAL_FALSE(result);
- return;
- }
-
- switch (column_type)
- {
- case SYBINT2:
- case SYBINT4: {
- Z_LVAL_P(result) = (long) anyintcol(offset);
- Z_TYPE_P(result) = IS_LONG;
- break;
- }
- case SYBCHAR:
- case SYBTEXT: {
- int length;
- char *data = charcol(offset);
-
- length=dbdatlen(sybase_ptr->link,offset);
- while (length>0 && charcol(offset)[length-1] == ' ') { /* nuke trailing whitespace */
- length--;
- }
- Z_STRVAL_P(result) = estrndup(data,length);
- Z_STRLEN_P(result) = length;
- Z_TYPE_P(result) = IS_STRING;
- break;
- }
- /*case SYBFLT8:*/
- case SYBREAL: {
- Z_DVAL_P(result) = (double) floatcol(offset);
- Z_TYPE_P(result) = IS_DOUBLE;
- break;
- }
- default: {
- if (dbwillconvert(coltype(offset),SYBCHAR)) {
- char *res_buf;
- int res_length = dbdatlen(sybase_ptr->link,offset);
- int src_length = res_length;
- register char *p;
-
- switch (coltype(offset)) {
- case SYBBINARY:
- case SYBVARBINARY:
- case SYBIMAGE:
- res_length *= 2;
- break;
- case SYBCHAR:
- case SYBVARCHAR:
- case SYBTEXT:
- break;
- default:
- /* take no chances, no telling how big the result would really be */
- res_length += 20;
- break;
- }
-
- res_buf = (char *) emalloc(res_length+1);
- memset(res_buf,' ',res_length+1); /* XXX i'm sure there's a better way
- but i don't have sybase here to test
- 991105 thies@thieso.net */
- dbconvert(NULL,coltype(offset),dbdata(sybase_ptr->link,offset), src_length,SYBCHAR,res_buf,res_length);
-
- /* get rid of trailing spaces */
- p = res_buf + res_length;
- while (p >= res_buf && (*p == ' ' || *p == '\0')) {
- p--;
- }
- *(++p) = 0; /* put a trailing NULL */
- res_length = p - res_buf;
-
-
- Z_STRLEN_P(result) = res_length;
- Z_STRVAL_P(result) = res_buf;
- Z_TYPE_P(result) = IS_STRING;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: column %d has unknown data type (%d)", offset, coltype(offset));
- ZVAL_FALSE(result);
- }
- }
- }
-}
-
-
-/* {{{ proto int sybase_query(string query [, int link_id])
- Send Sybase query */
-PHP_FUNCTION(sybase_query)
-{
- zval **query, **sybase_link_index;
- int id,type,retvalue;
- sybase_link *sybase_ptr;
- sybase_result *result;
- int num_fields;
- int blocks_initialized=1;
- int i,j;
- int *column_types;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &query) == FAILURE) {
- RETURN_FALSE;
- }
- id = php_sybase_module.default_link;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &query, &sybase_link_index) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(sybase_link_index);
- id = Z_LVAL_PP(sybase_link_index);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- sybase_ptr = (sybase_link *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_link && type!=php_sybase_module.le_plink) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"%d is not a Sybase link index",id);
- RETURN_FALSE;
- }
-
- convert_to_string_ex(query);
- if (dbcmd(sybase_ptr->link,Z_STRVAL_PP(query))==FAIL) {
- /*php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Unable to set query");*/
- RETURN_FALSE;
- }
- if (dbsqlexec(sybase_ptr->link)==FAIL || dbresults(sybase_ptr->link)==FAIL) {
- /*php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Query failed");*/
- RETURN_FALSE;
- }
-
- /* The following is more or less the equivalent of mysql_store_result().
- * fetch all rows from the server into the row buffer, thus:
- * 1) Being able to fire up another query without explicitly reading all rows
- * 2) Having numrows accessible
- */
-
- retvalue=dbnextrow(sybase_ptr->link);
-
- if (retvalue==FAIL) {
- RETURN_FALSE;
- }
-
- num_fields = dbnumcols(sybase_ptr->link);
- if (num_fields<=0) {
- RETURN_TRUE;
- }
-
- column_types = (int *) emalloc(sizeof(int) * num_fields);
- for (i=0; i<num_fields; i++) {
- column_types[i] = coltype(i+1);
- }
-
- result = (sybase_result *) emalloc(sizeof(sybase_result));
- result->data = (pval ***) emalloc(sizeof(pval **)*SYBASE_ROWS_BLOCK);
- result->sybase_ptr = sybase_ptr;
- result->cur_field=result->cur_row=result->num_rows=0;
- result->num_fields = num_fields;
-
- i=0;
- while (retvalue!=FAIL && retvalue!=NO_MORE_ROWS) {
- result->num_rows++;
- if (result->num_rows > blocks_initialized*SYBASE_ROWS_BLOCK) {
- result->data = (pval ***) erealloc(result->data,sizeof(pval **)*SYBASE_ROWS_BLOCK*(++blocks_initialized));
- }
- result->data[i] = (pval **) emalloc(sizeof(pval *)*num_fields);
- for (j=1; j<=num_fields; j++) {
- php_sybase_get_column_content(sybase_ptr, j, &result->data[i][j-1], column_types[j-1]);
- if (!php_sybase_module.compatability_mode) {
- zval *cur_value = result->data[i][j-1];
-
- convert_to_string(cur_value);
- if (PG(magic_quotes_runtime)) {
- Z_STRVAL_P(cur_value) = php_addslashes(Z_STRVAL_P(cur_value), Z_STRLEN_P(cur_value), &Z_STRLEN_P(cur_value),0 TSRMLS_CC);
- }
- }
- }
- retvalue=dbnextrow(sybase_ptr->link);
- dbclrbuf(sybase_ptr->link,DBLASTROW(sybase_ptr->link)-1);
- i++;
- }
- result->num_rows = DBCOUNT(sybase_ptr->link);
-
- result->fields = (sybase_field *) emalloc(sizeof(sybase_field)*num_fields);
- j=0;
- for (i=0; i<num_fields; i++) {
- char *fname = dbcolname(sybase_ptr->link,i+1);
- char computed_buf[16];
-
- if (*fname) {
- result->fields[i].name = estrdup(fname);
- } else {
- if (j>0) {
- snprintf(computed_buf,16,"computed%d",j);
- } else {
- strcpy(computed_buf,"computed");
- }
- result->fields[i].name = estrdup(computed_buf);
- j++;
- }
- result->fields[i].max_length = dbcollen(sybase_ptr->link,i+1);
- result->fields[i].column_source = estrdup(dbcolsource(sybase_ptr->link,i+1));
- if (!result->fields[i].column_source) {
- result->fields[i].column_source = empty_string;
- }
- Z_TYPE(result->fields[i]) = column_types[i];
- /* set numeric flag */
- switch (column_types[i]) {
- case SYBINT2:
- case SYBINT4:
- case SYBFLT8:
- case SYBREAL:
- result->fields[i].numeric = 1;
- break;
- case SYBCHAR:
- case SYBTEXT:
- default:
- result->fields[i].numeric = 0;
- break;
- }
- }
- efree(column_types);
- Z_LVAL_P(return_value) = zend_list_insert(result,php_sybase_module.le_result);
- Z_TYPE_P(return_value) = IS_LONG;
-}
-/* }}} */
-
-
-/* {{{ proto bool sybase_free_result(int result)
- Free result memory */
-PHP_FUNCTION(sybase_free_result)
-{
- zval **sybase_result_index;
- sybase_result *result;
- int type;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &sybase_result_index) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sybase_result_index);~
- if (Z_LVAL_PP(sybase_result_index)==0) {
- RETURN_FALSE;
- }
- result = (sybase_result *) zend_list_find(Z_LVAL_PP(sybase_result_index),&type);
-
- if (type!=php_sybase_module.le_result) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"%d is not a Sybase result index",Z_LVAL_PP(sybase_result_index));
- RETURN_FALSE;
- }
- zend_list_delete(Z_LVAL_P(sybase_result_index));
- RETURN_TRUE;
-}
-/* }}} */
-
-
-
-/* {{{ proto string sybase_get_last_message(void)
- Returns the last message from server (over min_message_severity) */
-PHP_FUNCTION(sybase_get_last_message)
-{
- RETURN_STRING(php_sybase_module.server_message,1);
-}
-/* }}} */
-
-/* {{{ proto int sybase_num_rows(int result)
- Get number of rows in result */
-PHP_FUNCTION(sybase_num_rows)
-{
- zval **result_index;
- int type,id;
- sybase_result *result;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &result_index) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(result_index);
- id = Z_LVAL_PP(result_index);
-
- result = (sybase_result *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_result) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"%d is not a Sybase result index",id);
- RETURN_FALSE;
- }
-
- Z_LVAL_P(return_value) = result->num_rows;
- Z_TYPE_P(return_value) = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto int sybase_num_fields(int result)
- Get number of fields in result */
-PHP_FUNCTION(sybase_num_fields)
-{
- zval **result_index;
- int type,id;
- sybase_result *result;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &result_index) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(result_index);
- id = Z_LVAL_PP(result_index);
-
- result = (sybase_result *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_result) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"%d is not a Sybase result index",id);
- RETURN_FALSE;
- }
-
- Z_LVAL_P(return_value) = result->num_fields;
- Z_TYPE_P(return_value) = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto array sybase_fetch_row(int result)
- Get row as enumerated array */
-PHP_FUNCTION(sybase_fetch_row)
-{
- zval **sybase_result_index;
- int type,i,id;
- sybase_result *result;
- pval *field_content;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &sybase_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sybase_result_index);
- id = Z_LVAL_PP(sybase_result_index);
-
- result = (sybase_result *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_result) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"%d is not a Sybase result index",id);
- RETURN_FALSE;
- }
-
- if (result->cur_row >= result->num_rows) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- for (i=0; i<result->num_fields; i++) {
- ZVAL_ADDREF(result->data[result->cur_row][i]);
- zend_hash_index_update(Z_ARRVAL_P(return_value), i, (void *) &result->data[result->cur_row][i], sizeof(pval *), NULL);
- }
- result->cur_row++;
-}
-/* }}} */
-
-
-static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval **sybase_result_index;
- sybase_result *result;
- int type;
- int i;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &sybase_result_index) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sybase_result_index);
- result = (sybase_result *) zend_list_find(Z_LVAL_PP(sybase_result_index),&type);
-
- if (type!=php_sybase_module.le_result) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"%d is not a Sybase result index",Z_LVAL_PP(sybase_result_index));
- RETURN_FALSE;
- }
-
- if (result->cur_row >= result->num_rows) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- for (i=0; i<result->num_fields; i++) {
- ZVAL_ADDREF(result->data[result->cur_row][i]);
- zend_hash_index_update(Z_ARRVAL_P(return_value), i, (void *) &result->data[result->cur_row][i], sizeof(pval *), NULL);
- ZVAL_ADDREF(result->data[result->cur_row][i]);
- zend_hash_update(Z_ARRVAL_P(return_value), result->fields[i].name, strlen(result->fields[i].name)+1, (void *) &result->data[result->cur_row][i], sizeof(pval *), NULL);
- }
- result->cur_row++;
-}
-
-
-/* {{{ proto object sybase_fetch_object(int result)
- Fetch row as object */
-PHP_FUNCTION(sybase_fetch_object)
-{
- php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- if (Z_TYPE_P(return_value)==IS_ARRAY) {
- Z_TYPE_P(return_value)=IS_OBJECT;
- Z_OBJPROP_P(return_value) = Z_ARRVAL_P(return_value);
- Z_OBJCE_P(return_value) = ZEND_STANDARD_CLASS_DEF_PTR;
- }
-}
-/* }}} */
-
-/* {{{ proto array sybase_fetch_array(int result)
- Fetch row as array */
-PHP_FUNCTION(sybase_fetch_array)
-{
- php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto bool sybase_data_seek(int result, int offset)
- Move internal row pointer */
-PHP_FUNCTION(sybase_data_seek)
-{
- zval **sybase_result_index, **offset;
- int type,id;
- sybase_result *result;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &sybase_result_index, &offset) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sybase_result_index);
- id = Z_LVAL_PP(sybase_result_index);
-
- result = (sybase_result *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_result) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"%d is not a Sybase result index",id);
- RETURN_FALSE;
- }
-
- convert_to_long_ex(offset);
- if (Z_LVAL_PP(offset)<0 || Z_LVAL_PP(offset)>=result->num_rows) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Bad row offset");
- RETURN_FALSE;
- }
-
- result->cur_row = Z_LVAL_PP(offset);
- RETURN_TRUE;
-}
-/* }}} */
-
-static char *php_sybase_get_field_name(int type)
-{
- switch (type) {
- case SYBBINARY:
- case SYBVARBINARY:
- return "blob";
- break;
- case SYBCHAR:
- case SYBVARCHAR:
- case SYBTEXT:
- return "string";
- case SYBDATETIME:
- case SYBDATETIME4:
- case SYBDATETIMN:
- return "datetime";
- break;
- case SYBDECIMAL:
- case SYBFLT8:
- case SYBFLTN:
- case SYBREAL:
- case SYBNUMERIC:
- return "real";
- break;
- case SYBINT1:
- case SYBINT2:
- case SYBINT4:
- case SYBINTN:
- return "int";
- break;
- case SYBMONEY:
- case SYBMONEY4:
- case SYBMONEYN:
- return "money";
- break;
- case SYBBIT:
- return "bit";
- break;
- case SYBIMAGE:
- return "image";
- break;
- default:
- return "unknown";
- break;
- }
-}
-
-
-/* {{{ proto object sybase_fetch_field(int result [, int offset])
- Get field information */
-PHP_FUNCTION(sybase_fetch_field)
-{
- zval **sybase_result_index, **offset;
- int type,id,field_offset;
- sybase_result *result;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &sybase_result_index) == FAILURE) {
- RETURN_FALSE;
- }
- field_offset=-1;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &sybase_result_index, &offset) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(offset);
- field_offset = Z_LVAL_PP(offset);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_long_ex(sybase_result_index);
- id = Z_LVAL_PP(sybase_result_index);
-
- result = (sybase_result *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_result) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"%d is not a Sybase result index",id);
- RETURN_FALSE;
- }
-
- if (field_offset==-1) {
- field_offset = result->cur_field;
- result->cur_field++;
- }
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Bad column offset");
- }
- RETURN_FALSE;
- }
-
- object_init(return_value);
-
- add_property_string(return_value, "name",result->fields[field_offset].name, 1);
- add_property_long(return_value, "max_length",result->fields[field_offset].max_length);
- add_property_string(return_value, "column_source",result->fields[field_offset].column_source, 1);
- add_property_long(return_value, "numeric", result->fields[field_offset].numeric);
- add_property_string(return_value, "type", php_sybase_get_field_name(Z_TYPE(result->fields[field_offset])), 1);
-}
-/* }}} */
-
-/* {{{ proto bool sybase_field_seek(int result, int offset)
- Set field offset */
-PHP_FUNCTION(sybase_field_seek)
-{
- zval **sybase_result_index, **offset;
- int type,id,field_offset;
- sybase_result *result;
-
- if (ZEND_NUM_ARGS() !=2 || zend_get_parameters_ex(2, &sybase_result_index, &offset) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sybase_result_index);
- id = Z_LVAL_PP(sybase_result_index);
-
- result = (sybase_result *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_result) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"%d is not a Sybase result index",id);
- RETURN_FALSE;
- }
-
- convert_to_long_ex(offset);
- field_offset = Z_LVAL_PP(offset);
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Bad column offset");
- RETURN_FALSE;
- }
-
- result->cur_field = field_offset;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string sybase_result(int result, int row, mixed field)
- Get result data */
-PHP_FUNCTION(sybase_result)
-{
- zval **row, **field, **sybase_result_index;
- int id,type,field_offset=0;
- sybase_result *result;
-
-
- if (ZEND_NUM_ARGS() !=3 || zend_get_parameters_ex(3, &sybase_result_index, &row, &field) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sybase_result_index);
- id = Z_LVAL_PP(sybase_result_index);
-
- result = (sybase_result *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_result) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"%d is not a Sybase result index",id);
- RETURN_FALSE;
- }
-
- convert_to_long_ex(row);
- if (Z_LVAL_PP(row)<0 || Z_LVAL_PP(row)>=result->num_rows) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Bad row offset (%d)",Z_LVAL_PP(row));
- RETURN_FALSE;
- }
-
- switch(Z_TYPE_PP(field)) {
- case IS_STRING: {
- int i;
-
- for (i=0; i<result->num_fields; i++) {
- if (!strcasecmp(result->fields[i].name,Z_STRVAL_P(field))) {
- field_offset = i;
- break;
- }
- }
- if (i>=result->num_fields) { /* no match found */
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: %s field not found in result",Z_STRVAL_PP(field));
- RETURN_FALSE;
- }
- break;
- }
- default:
- convert_to_long_ex(field);
- field_offset = Z_LVAL_PP(field);
- if (field_offset<0 || field_offset>=result->num_fields) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Sybase: Bad column offset specified");
- RETURN_FALSE;
- }
- break;
- }
-
- *return_value = *result->data[Z_LVAL_PP(row)][field_offset];
- pval_copy_constructor(return_value);
-}
-/* }}} */
-
-
-/* {{{ proto int sybase_affected_rows([int link_id])
- Get number of affected rows in last query */
-PHP_FUNCTION(sybase_affected_rows)
-{
- zval *sybase_link_index = NULL;
- sybase_link *sybase_ptr = NULL;
- int id = 0;
- int type = 0;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = php_sybase_module.default_link;
- break;
- case 1:
- if (zend_get_parameters_ex(ht, 1, &sybase_link_index) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(sybase_link_index);
- id = Z_LVAL_PP(sybase_link_index);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- sybase_ptr = (sybase_link *)zend_list_find(id, &type);
-
- if(type != php_sybase_module.le_link && type != php_sybase_module.le_plink) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"%d is not a Sybase link index",id);
- RETURN_FALSE;
- }
-
- Z_LVAL_P(return_value) = DBCOUNT(sybase_ptr->link);
- Z_TYPE_P(return_value) = IS_LONG;
-}
-
-
-PHP_MINFO_FUNCTION(sybase)
-{
- char maxp[32], maxl[32];
-
- if (php_sybase_module.max_persistent==-1) {
- snprintf(maxp, 31, "%ld/unlimited", php_sybase_module.num_persistent );
- } else {
- snprintf(maxp, 31, "%ld/%ld", php_sybase_module.num_persistent, php_sybase_module.max_persistent);
- }
- maxp[31]=0;
-
- if (php_sybase_module.max_links==-1) {
- snprintf(maxl, 31, "%ld/unlimited", php_sybase_module.num_links );
- } else {
- snprintf(maxl, 31, "%ld/%ld", php_sybase_module.num_links, php_sybase_module.max_links);
- }
- maxl[31]=0;
-
- php_info_print_table_start();
- php_info_print_table_row(2, "Sybase Support", "enabled");
- php_info_print_table_row(2, "Allow Persistent Links", (php_sybase_module.allow_persistent?"Yes":"No") );
- php_info_print_table_row(2, "Persistent Links", maxp);
- php_info_print_table_row(2, "Total Links", maxl);
- php_info_print_table_row(2, "Application Name", php_sybase_module.appname );
- php_info_print_table_row(2, "Client API Version", dbversion() );
- php_info_print_table_end();
-
-}
-
-
-/* {{{ proto void sybase_min_error_severity(int severity)
- Sets the minimum error severity */
-PHP_FUNCTION(sybase_min_error_severity)
-{
- zval **severity;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &severity) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(severity);
- php_sybase_module.min_error_severity = Z_LVAL_PP(severity);
-}
-/* }}} */
-
-/* {{{ proto void sybase_min_message_severity(int severity)
- Sets the minimum message severity */
-PHP_FUNCTION(sybase_min_message_severity)
-{
- zval **severity;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &severity) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(severity);
- php_sybase_module.min_message_severity = Z_LVAL_PP(severity);
-}
-/* }}} */
-
-#endif
diff --git a/ext/sybase/php_sybase_db.h b/ext/sybase/php_sybase_db.h
deleted file mode 100644
index 940cd647b6..0000000000
--- a/ext/sybase/php_sybase_db.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SYBASE_DB_H
-#define PHP_SYBASE_DB_H
-
-#if HAVE_SYBASE
-
-extern zend_module_entry sybase_module_entry;
-#define sybase_module_ptr &sybase_module_entry
-
-PHP_MINIT_FUNCTION(sybase);
-PHP_RINIT_FUNCTION(sybase);
-PHP_MSHUTDOWN_FUNCTION(sybase);
-PHP_RSHUTDOWN_FUNCTION(sybase);
-PHP_MINFO_FUNCTION(sybase);
-PHP_FUNCTION(sybase_connect);
-PHP_FUNCTION(sybase_pconnect);
-PHP_FUNCTION(sybase_close);
-PHP_FUNCTION(sybase_select_db);
-PHP_FUNCTION(sybase_query);
-PHP_FUNCTION(sybase_free_result);
-PHP_FUNCTION(sybase_get_last_message);
-PHP_FUNCTION(sybase_num_rows);
-PHP_FUNCTION(sybase_num_fields);
-PHP_FUNCTION(sybase_fetch_row);
-PHP_FUNCTION(sybase_fetch_array);
-PHP_FUNCTION(sybase_fetch_object);
-PHP_FUNCTION(sybase_data_seek);
-PHP_FUNCTION(sybase_affected_rows);
-PHP_FUNCTION(sybase_result);
-PHP_FUNCTION(sybase_field_seek);
-PHP_FUNCTION(sybase_min_error_severity);
-PHP_FUNCTION(sybase_min_message_severity);
-
-PHP_FUNCTION(sybase_db_query);
-PHP_FUNCTION(sybase_list_fields);
-PHP_FUNCTION(sybase_fetch_lengths);
-PHP_FUNCTION(sybase_fetch_field);
-PHP_FUNCTION(sybase_field_seek);
-PHP_FUNCTION(sybase_free_result);
-PHP_FUNCTION(sybase_field_name);
-PHP_FUNCTION(sybase_field_table);
-PHP_FUNCTION(sybase_field_len);
-PHP_FUNCTION(sybase_field_type);
-PHP_FUNCTION(sybase_field_flags);
-
-
-typedef struct {
- long default_link;
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
- char *appname;
- char *server_message;
- int le_link,le_plink,le_result;
- long min_error_severity,min_message_severity;
- long cfg_min_error_severity,cfg_min_message_severity;
- long compatability_mode;
-} sybase_module;
-
-extern sybase_module php_sybase_module;
-
-#else
-
-#define sybase_module_ptr NULL
-
-#endif
-
-#define phpext_sybase_ptr sybase_module_ptr
-
-#endif /* PHP_SYBASE_DB_H */
diff --git a/ext/sybase_ct/CREDITS b/ext/sybase_ct/CREDITS
deleted file mode 100644
index f739a533c4..0000000000
--- a/ext/sybase_ct/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Sybase-CT
-Zeev Suraski, Tom May, Timm Friebe
diff --git a/ext/sybase_ct/config.m4 b/ext/sybase_ct/config.m4
deleted file mode 100644
index dcceab32e8..0000000000
--- a/ext/sybase_ct/config.m4
+++ /dev/null
@@ -1,56 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(sybase-ct, for Sybase-CT support,
-[ --with-sybase-ct[=DIR] Include Sybase-CT support. DIR is the Sybase home
- directory. Defaults to /home/sybase.])
-
-if test "$PHP_SYBASE_CT" != "no"; then
-
- if test "$PHP_SYBASE" != "no"; then
- AC_MSG_ERROR([You can not use both --with-sybase and --with-sybase-ct in same build!])
- fi
-
- AC_DEFINE(HAVE_SYBASE_CT,1,[ ])
- PHP_NEW_EXTENSION(sybase_ct, php_sybase_ct.c, $ext_shared)
- PHP_SUBST(SYBASE_CT_SHARED_LIBADD)
-
- if test "$PHP_SYBASE_CT" = "yes"; then
- SYBASE_CT_INCDIR=/home/sybase/include
- SYBASE_CT_LIBDIR=/home/sybase/lib
- else
- SYBASE_CT_INCDIR=$PHP_SYBASE_CT/include
- SYBASE_CT_LIBDIR=$PHP_SYBASE_CT/lib
- fi
-
- if test -f $SYBASE_CT_INCDIR/ctpublic.h; then
- PHP_ADD_INCLUDE($SYBASE_CT_INCDIR)
- else
- AC_MSG_ERROR([ctpublic.h missing!])
- fi
-
- PHP_ADD_LIBPATH($SYBASE_CT_LIBDIR, SYBASE_CT_SHARED_LIBADD)
- if test -f $SYBASE_CT_INCDIR/tds.h; then
- PHP_ADD_LIBRARY(ct,, SYBASE_CT_SHARED_LIBADD)
- SYBASE_CT_LIBS="-L$SYBASE_CT_LIBDIR -lct"
- else
- PHP_ADD_LIBRARY(cs,, SYBASE_CT_SHARED_LIBADD)
- PHP_ADD_LIBRARY(ct,, SYBASE_CT_SHARED_LIBADD)
- PHP_ADD_LIBRARY(comn,, SYBASE_CT_SHARED_LIBADD)
- PHP_ADD_LIBRARY(intl,, SYBASE_CT_SHARED_LIBADD)
-
- SYBASE_CT_LIBS="-L$SYBASE_CT_LIBDIR -lcs -lct -lcomn -lintl"
-
- PHP_CHECK_LIBRARY(tcl, netg_errstr, [
- PHP_ADD_LIBRARY(tcl,,SYBASE_CT_SHARED_LIBADD)
- ],[
- PHP_ADD_LIBRARY(sybtcl,,SYBASE_CT_SHARED_LIBADD)
- ],[
- $SYBASE_CT_LIBS
- ])
-
- PHP_CHECK_LIBRARY(insck, insck__getVdate, [PHP_ADD_LIBRARY(insck,, SYBASE_CT_SHARED_LIBADD)],[],[-L$SYBASE_CT_LIBDIR])
- PHP_CHECK_LIBRARY(insck, bsd_tcp, [PHP_ADD_LIBRARY(insck,, SYBASE_CT_SHARED_LIBADD)],[],[-L$SYBASE_CT_LIBDIR])
- fi
-fi
diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c
deleted file mode 100644
index a4065b6151..0000000000
--- a/ext/sybase_ct/php_sybase_ct.c
+++ /dev/null
@@ -1,2083 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- | Tom May <tom@go2net.com> |
- | Timm Friebe <php_sybase_ct@thekid.de> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_sybase_ct.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-#include "php_globals.h"
-#include "php_ini.h"
-
-/* True globals, no need for thread safety */
-static int le_link, le_plink, le_result;
-
-#if HAVE_SYBASE_CT
-
-function_entry sybase_functions[] = {
- PHP_FE(sybase_connect, NULL)
- PHP_FE(sybase_pconnect, NULL)
- PHP_FE(sybase_close, NULL)
- PHP_FE(sybase_select_db, NULL)
- PHP_FE(sybase_query, NULL)
- PHP_FE(sybase_unbuffered_query, NULL)
- PHP_FE(sybase_free_result, NULL)
- PHP_FE(sybase_get_last_message, NULL)
- PHP_FE(sybase_num_rows, NULL)
- PHP_FE(sybase_num_fields, NULL)
- PHP_FE(sybase_fetch_row, NULL)
- PHP_FE(sybase_fetch_array, NULL)
- PHP_FE(sybase_fetch_assoc, NULL)
- PHP_FE(sybase_fetch_object, NULL)
- PHP_FE(sybase_data_seek, NULL)
- PHP_FE(sybase_fetch_field, NULL)
- PHP_FE(sybase_field_seek, NULL)
- PHP_FE(sybase_result, NULL)
- PHP_FE(sybase_affected_rows, NULL)
- PHP_FE(sybase_min_client_severity, NULL)
- PHP_FE(sybase_min_server_severity, NULL)
- PHP_FE(sybase_set_message_handler, NULL)
- PHP_FE(sybase_deadlock_retry_count, NULL)
-
- PHP_FALIAS(mssql_connect, sybase_connect, NULL)
- PHP_FALIAS(mssql_pconnect, sybase_pconnect, NULL)
- PHP_FALIAS(mssql_close, sybase_close, NULL)
- PHP_FALIAS(mssql_select_db, sybase_select_db, NULL)
- PHP_FALIAS(mssql_query, sybase_query, NULL)
- PHP_FALIAS(mssql_unbuffered_query, sybase_unbuffered_query, NULL)
- PHP_FALIAS(mssql_free_result, sybase_free_result, NULL)
- PHP_FALIAS(mssql_get_last_message, sybase_get_last_message, NULL)
- PHP_FALIAS(mssql_num_rows, sybase_num_rows, NULL)
- PHP_FALIAS(mssql_num_fields, sybase_num_fields, NULL)
- PHP_FALIAS(mssql_fetch_row, sybase_fetch_row, NULL)
- PHP_FALIAS(mssql_fetch_array, sybase_fetch_array, NULL)
- PHP_FALIAS(mssql_fetch_assoc, sybase_fetch_assoc, NULL)
- PHP_FALIAS(mssql_fetch_object, sybase_fetch_object, NULL)
- PHP_FALIAS(mssql_data_seek, sybase_data_seek, NULL)
- PHP_FALIAS(mssql_fetch_field, sybase_fetch_field, NULL)
- PHP_FALIAS(mssql_field_seek, sybase_field_seek, NULL)
- PHP_FALIAS(mssql_result, sybase_result, NULL)
- PHP_FALIAS(mssql_affected_rows, sybase_affected_rows, NULL)
- PHP_FALIAS(mssql_min_client_severity, sybase_min_client_severity, NULL)
- PHP_FALIAS(mssql_min_server_severity, sybase_min_server_severity, NULL)
- PHP_FALIAS(mssql_set_message_handler, sybase_set_message_handler, NULL)
- PHP_FALIAS(mssql_deadlock_retry_count, sybase_deadlock_retry_count, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry sybase_module_entry = {
- STANDARD_MODULE_HEADER,
- "sybase_ct", sybase_functions, PHP_MINIT(sybase), PHP_MSHUTDOWN(sybase), PHP_RINIT(sybase), PHP_RSHUTDOWN(sybase), PHP_MINFO(sybase), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES
-};
-
-ZEND_DECLARE_MODULE_GLOBALS(sybase)
-/* static CS_CONTEXT *context; */
-
-#ifdef COMPILE_DL_SYBASE_CT
-ZEND_GET_MODULE(sybase)
-#endif
-
-ZEND_DECLARE_MODULE_GLOBALS(sybase)
-
-#define CHECK_LINK(link) { if (link==-1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: A link to the server could not be established"); RETURN_FALSE; } }
-
-
-static int _clean_invalid_results(list_entry *le TSRMLS_DC)
-{
- if (Z_TYPE_P(le) == le_result) {
- sybase_link *sybase_ptr = ((sybase_result *) le->ptr)->sybase_ptr;
-
- if (!sybase_ptr->valid) {
- return 1;
- }
- }
- return 0;
-}
-
-
-static void _free_sybase_result(sybase_result *result)
-{
- int i, j;
-
- if (result->data) {
- for (i=0; i<(result->store ? result->num_rows : 0); i++) {
- for (j=0; j<result->num_fields; j++) {
- zval_dtor(&result->data[i][j]);
- }
- efree(result->data[i]);
- }
- efree(result->data);
- }
-
- if (result->fields) {
- for (i=0; i<result->num_fields; i++) {
- STR_FREE(result->fields[i].name);
- STR_FREE(result->fields[i].column_source);
- }
- efree(result->fields);
- }
-
- efree(result);
-}
-
-static void php_free_sybase_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- sybase_result *result = (sybase_result *)rsrc->ptr;
-
- _free_sybase_result(result);
-}
-
-static void _close_sybase_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- sybase_link *sybase_ptr = (sybase_link *)rsrc->ptr;
- CS_INT con_status;
-
- sybase_ptr->valid = 0;
-
- zend_hash_apply(&EG(regular_list), (apply_func_t) _clean_invalid_results TSRMLS_CC);
-
- /* Non-persistent connections will always be connected or we wouldn't
- * get here, but since we want to check the death status anyway
- * we might as well double-check the connect status.
- */
- if (ct_con_props(sybase_ptr->connection, CS_GET, CS_CON_STATUS,
- &con_status, CS_UNUSED, NULL)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to get connection status on close");
- /* Assume the worst. */
- con_status = CS_CONSTAT_CONNECTED | CS_CONSTAT_DEAD;
- }
- if (con_status & CS_CONSTAT_CONNECTED) {
- if ((con_status & CS_CONSTAT_DEAD) || ct_close(sybase_ptr->connection, CS_UNUSED)!=CS_SUCCEED) {
- ct_close(sybase_ptr->connection, CS_FORCE_CLOSE);
- }
- }
-
- ct_con_drop(sybase_ptr->connection);
- efree(sybase_ptr);
- SybCtG(num_links)--;
-}
-
-
-static void _close_sybase_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- sybase_link *sybase_ptr = (sybase_link *)rsrc->ptr;
- CS_INT con_status;
-
- /* Persistent connections may have been closed before a failed
- * reopen attempt.
- */
- if (ct_con_props(sybase_ptr->connection, CS_GET, CS_CON_STATUS,
- &con_status, CS_UNUSED, NULL)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to get connection status on close");
- /* Assume the worst. */
- con_status = CS_CONSTAT_CONNECTED | CS_CONSTAT_DEAD;
- }
- if (con_status & CS_CONSTAT_CONNECTED) {
- if ((con_status & CS_CONSTAT_DEAD) || ct_close(sybase_ptr->connection, CS_UNUSED)!=CS_SUCCEED) {
- ct_close(sybase_ptr->connection, CS_FORCE_CLOSE);
- }
- }
-
- ct_con_drop(sybase_ptr->connection);
- free(sybase_ptr);
- SybCtG(num_persistent)--;
- SybCtG(num_links)--;
-}
-
-
-static CS_RETCODE CS_PUBLIC _client_message_handler(CS_CONTEXT *context, CS_CONNECTION *connection, CS_CLIENTMSG *errmsg)
-{
- TSRMLS_FETCH();
-
- if (CS_SEVERITY(errmsg->msgnumber) >= SybCtG(min_client_severity)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Client message: %s (severity %d)", errmsg->msgstring, CS_SEVERITY(errmsg->msgnumber));
- }
- STR_FREE(SybCtG(server_message));
- SybCtG(server_message) = estrdup(errmsg->msgstring);
-
-
- /* If this is a timeout message, return CS_FAIL to cancel the
- * operation and mark the connection as dead.
- */
- if (CS_SEVERITY(errmsg->msgnumber) == CS_SV_RETRY_FAIL &&
- CS_NUMBER(errmsg->msgnumber) == 63 &&
- CS_ORIGIN(errmsg->msgnumber) == 2 &&
- CS_LAYER(errmsg->msgnumber) == 1)
- {
- return CS_FAIL;
- }
-
- return CS_SUCCEED;
-}
-
-
-static CS_RETCODE CS_PUBLIC _server_message_handler(CS_CONTEXT *context, CS_CONNECTION *connection, CS_SERVERMSG *srvmsg)
-{
- zval *retval = NULL;
- zval severity, msgnumber, state, line, text;
- zval *ptrs[5]= {&msgnumber, &severity, &state, &line, &text};
- zval **args[5]= {&ptrs[0], &ptrs[1], &ptrs[2], &ptrs[3], &ptrs[4]};
- int handled= 0;
-
- TSRMLS_FETCH();
-
- if (srvmsg->severity >= SybCtG(min_server_severity)) {
- if (SybCtG(callback_name) != NULL) {
- INIT_ZVAL(msgnumber);
- INIT_ZVAL(severity);
- INIT_ZVAL(state);
- INIT_ZVAL(line);
- INIT_ZVAL(text);
-
- ZVAL_LONG(&msgnumber, srvmsg->msgnumber);
- ZVAL_LONG(&severity, srvmsg->severity);
- ZVAL_LONG(&state, srvmsg->state);
- ZVAL_LONG(&line, srvmsg->line);
- ZVAL_STRING(&text, srvmsg->text, 0);
-
- if (call_user_function_ex(EG(function_table), NULL, SybCtG(callback_name), &retval, 5, args, 0, NULL TSRMLS_CC)== FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Cannot call the messagehandler %s", Z_STRVAL_P(SybCtG(callback_name)));
- }
- if (retval) {
- handled= ((Z_TYPE_P(retval) != IS_BOOL) || (Z_BVAL_P(retval) != 0));
- zval_ptr_dtor(&retval);
- }
- }
-
- if (!handled) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Server message: %s (severity %d, procedure %s)",
- srvmsg->text, srvmsg->severity, ((srvmsg->proclen>0) ? srvmsg->proc : "N/A"));
- }
- }
- STR_FREE(SybCtG(server_message));
- SybCtG(server_message) = estrdup(srvmsg->text);
-
- /* If this is a deadlock message, set the connection's deadlock flag
- * so we will retry the request. Sorry about the bare constant here,
- * but it's not defined anywhere and it's a "well-known" number.
- */
- if (srvmsg->msgnumber == 1205) {
- sybase_link *sybase;
-
- if (ct_con_props(connection, CS_GET, CS_USERDATA, &sybase, CS_SIZEOF(sybase), NULL)==CS_SUCCEED) {
- sybase->deadlock = 1;
- } else {
- /* oh well */
- }
- }
-
- return CS_SUCCEED;
-}
-
-
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("sybct.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong, allow_persistent, zend_sybase_globals, sybase_globals)
- STD_PHP_INI_ENTRY_EX("sybct.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_persistent, zend_sybase_globals, sybase_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("sybct.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_links, zend_sybase_globals, sybase_globals, display_link_numbers)
- STD_PHP_INI_ENTRY("sybct.min_server_severity", "10", PHP_INI_ALL, OnUpdateLong, min_server_severity, zend_sybase_globals, sybase_globals)
- STD_PHP_INI_ENTRY("sybct.min_client_severity", "10", PHP_INI_ALL, OnUpdateLong, min_client_severity, zend_sybase_globals, sybase_globals)
- STD_PHP_INI_ENTRY("sybct.hostname", NULL, PHP_INI_ALL, OnUpdateString, hostname, zend_sybase_globals, sybase_globals)
- STD_PHP_INI_ENTRY_EX("sybct.deadlock_retry_count", "-1", PHP_INI_ALL, OnUpdateLong, deadlock_retry_count, zend_sybase_globals, sybase_globals, display_link_numbers)
-PHP_INI_END()
-
-
-static void php_sybase_init_globals(zend_sybase_globals *sybase_globals)
-{
- long timeout;
- TSRMLS_FETCH();
-
- if (cs_ctx_alloc(CTLIB_VERSION, &sybase_globals->context)!=CS_SUCCEED || ct_init(sybase_globals->context, CTLIB_VERSION)!=CS_SUCCEED) {
- return;
- }
-
- /* Initialize message handlers */
- if (ct_callback(sybase_globals->context, NULL, CS_SET, CS_SERVERMSG_CB, (CS_VOID *)_server_message_handler)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to set server message handler");
- }
-
- if (ct_callback(sybase_globals->context, NULL, CS_SET, CS_CLIENTMSG_CB, (CS_VOID *)_client_message_handler)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to set client message handler");
- }
-
- /* Set datetime conversion format to "Nov 3 1998 8:06PM".
- * This is the default format for the ct-lib that comes with
- * Sybase ASE 11.5.1 for Solaris, but the Linux libraries that
- * come with 11.0.3.3 default to "03/11/98" which is singularly
- * useless. This levels the playing field for all platforms.
- */
- {
- CS_INT dt_convfmt = CS_DATES_SHORT;
- if (cs_dt_info(sybase_globals->context, CS_SET, NULL, CS_DT_CONVFMT, CS_UNUSED, &dt_convfmt, sizeof(dt_convfmt), NULL)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to set datetime conversion format");
- }
- }
-
- /* Set the login and command timeouts. These are per-context and
- * can't be set with ct_con_props(), so set them globally from
- * their config values if requested. The defaults are 1 minute
- * for CS_LOGIN_TIMEOUT and CS_NO_LIMIT for CS_TIMEOUT. The latter
- * especially is fairly useless for web applications.
- * Note that depite some noise in the documentation about using
- * signals to implement timeouts, they are actually implemented
- * by using poll() or select() on Solaris and Linux.
- */
- if (cfg_get_long("sybct.login_timeout", &timeout)==SUCCESS) {
- CS_INT cs_login_timeout = timeout;
- if (ct_config(sybase_globals->context, CS_SET, CS_LOGIN_TIMEOUT, &cs_login_timeout, CS_UNUSED, NULL)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to set login timeout");
- }
- }
- if (cfg_get_long("sybct.timeout", &timeout)==SUCCESS) {
- CS_INT cs_timeout = timeout;
- if (ct_config(sybase_globals->context, CS_SET, CS_TIMEOUT, &cs_timeout, CS_UNUSED, NULL)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to set timeout");
- }
- }
- sybase_globals->num_persistent=0;
- sybase_globals->callback_name = NULL;
-}
-
-
-static void php_sybase_destroy_globals(zend_sybase_globals *sybase_globals)
-{
- ct_exit(sybase_globals->context, CS_UNUSED);
- cs_ctx_drop(sybase_globals->context);
-}
-
-PHP_MINIT_FUNCTION(sybase)
-{
- ZEND_INIT_MODULE_GLOBALS(sybase, php_sybase_init_globals, php_sybase_destroy_globals);
-
- REGISTER_INI_ENTRIES();
-
- le_link = zend_register_list_destructors_ex(_close_sybase_link, NULL, "sybase-ct link", module_number);
- le_plink = zend_register_list_destructors_ex(NULL, _close_sybase_plink, "sybase-ct link persistent", module_number);
- le_result = zend_register_list_destructors_ex(php_free_sybase_result, NULL, "sybase-ct result", module_number);
-
- return SUCCESS;
-}
-
-
-
-PHP_RINIT_FUNCTION(sybase)
-{
- SybCtG(default_link)=-1;
- SybCtG(num_links) = SybCtG(num_persistent);
- SybCtG(appname) = estrndup("PHP 4.0", 7);
- SybCtG(server_message) = empty_string;
- return SUCCESS;
-}
-
-
-
-PHP_MSHUTDOWN_FUNCTION(sybase)
-{
- UNREGISTER_INI_ENTRIES();
-#if 0
- ct_exit(context, CS_UNUSED);
- cs_ctx_drop(context);
-#endif
- return SUCCESS;
-}
-
-
-PHP_RSHUTDOWN_FUNCTION(sybase)
-{
- efree(SybCtG(appname));
- if (SybCtG(callback_name)) {
- zval_ptr_dtor(&SybCtG(callback_name));
- SybCtG(callback_name)= NULL;
- }
- STR_FREE(SybCtG(server_message));
- return SUCCESS;
-}
-
-
-static int php_sybase_do_connect_internal(sybase_link *sybase, char *host, char *user, char *passwd, char *charset, char *appname)
-{
- CS_LOCALE *tmp_locale;
- TSRMLS_FETCH();
-
- /* set a CS_CONNECTION record */
- if (ct_con_alloc(SybCtG(context), &sybase->connection)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to allocate connection record");
- return 0;
- }
-
- /* Note - this saves a copy of sybase, not a pointer to it. */
- if (ct_con_props(sybase->connection, CS_SET, CS_USERDATA, &sybase, CS_SIZEOF(sybase), NULL)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to set userdata");
- ct_con_drop(sybase->connection);
- return 0;
- }
-
- if (user) {
- ct_con_props(sybase->connection, CS_SET, CS_USERNAME, user, CS_NULLTERM, NULL);
- }
- if (passwd) {
- ct_con_props(sybase->connection, CS_SET, CS_PASSWORD, passwd, CS_NULLTERM, NULL);
- }
- if (appname) {
- ct_con_props(sybase->connection, CS_SET, CS_APPNAME, appname, CS_NULLTERM, NULL);
- } else {
- ct_con_props(sybase->connection, CS_SET, CS_APPNAME, SybCtG(appname), CS_NULLTERM, NULL);
- }
-
- if (SybCtG(hostname)) {
- ct_con_props(sybase->connection, CS_SET, CS_HOSTNAME, SybCtG(hostname), CS_NULLTERM, NULL);
- }
-
- if (charset) {
- if (cs_loc_alloc(SybCtG(context), &tmp_locale)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to allocate locale information.");
- } else {
- if (cs_locale(SybCtG(context), CS_SET, tmp_locale, CS_LC_ALL, NULL, CS_NULLTERM, NULL)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to load default locale data.");
- } else {
- if (cs_locale(SybCtG(context), CS_SET, tmp_locale, CS_SYB_CHARSET, charset, CS_NULLTERM, NULL)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update character set.");
- } else {
- if (ct_con_props(sybase->connection, CS_SET, CS_LOC_PROP, tmp_locale, CS_UNUSED, NULL)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update connection properties.");
- }
- }
- }
- }
- }
-
- sybase->valid = 1;
- sybase->dead = 0;
- sybase->active_result_index = 0;
-
- /* create the link */
- if (ct_connect(sybase->connection, host, CS_NULLTERM)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to connect");
- ct_con_drop(sybase->connection);
- return 0;
- }
-
- if (ct_cmd_alloc(sybase->connection, &sybase->cmd)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to allocate command record");
- ct_close(sybase->connection, CS_UNUSED);
- ct_con_drop(sybase->connection);
- return 0;
- }
-
- return 1;
-}
-
-
-static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- char *user, *passwd, *host, *charset, *appname;
- char *hashed_details;
- int hashed_details_length;
- sybase_link *sybase_ptr;
-
- switch(ZEND_NUM_ARGS()) {
- case 0: /* defaults */
- host=user=passwd=charset=appname=NULL;
- hashed_details_length=6+5;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- strcpy(hashed_details, "sybase_____");
- break;
- case 1: {
- zval **yyhost;
-
- if (zend_get_parameters_ex(1, &yyhost) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(yyhost);
- host = Z_STRVAL_PP(yyhost);
- user=passwd=charset=appname=NULL;
- hashed_details_length = Z_STRLEN_PP(yyhost)+6+5;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "sybase_%s____", Z_STRVAL_PP(yyhost));
- }
- break;
- case 2: {
- zval **yyhost, **yyuser;
-
- if (zend_get_parameters_ex(2, &yyhost, &yyuser) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(yyhost);
- convert_to_string_ex(yyuser);
- host = Z_STRVAL_PP(yyhost);
- user = Z_STRVAL_PP(yyuser);
- passwd=charset=appname=NULL;
- hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+6+5;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "sybase_%s_%s___", Z_STRVAL_PP(yyhost), Z_STRVAL_PP(yyuser));
- }
- break;
- case 3: {
- zval **yyhost, **yyuser, **yypasswd;
-
- if (zend_get_parameters_ex(3, &yyhost, &yyuser, &yypasswd) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(yyhost);
- convert_to_string_ex(yyuser);
- convert_to_string_ex(yypasswd);
- host = Z_STRVAL_PP(yyhost);
- user = Z_STRVAL_PP(yyuser);
- passwd = Z_STRVAL_PP(yypasswd);
- charset=appname=NULL;
- hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+Z_STRLEN_PP(yypasswd)+6+5;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "sybase_%s_%s_%s__", Z_STRVAL_PP(yyhost), Z_STRVAL_PP(yyuser), Z_STRVAL_PP(yypasswd));
- }
- break;
- case 4: {
- zval **yyhost, **yyuser, **yypasswd, **yycharset;
-
- if (zend_get_parameters_ex(4, &yyhost, &yyuser, &yypasswd, &yycharset) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(yyhost);
- convert_to_string_ex(yyuser);
- convert_to_string_ex(yypasswd);
- convert_to_string_ex(yycharset);
- host = Z_STRVAL_PP(yyhost);
- user = Z_STRVAL_PP(yyuser);
- passwd = Z_STRVAL_PP(yypasswd);
- charset = Z_STRVAL_PP(yycharset);
- appname=NULL;
- hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+Z_STRLEN_PP(yypasswd)+Z_STRLEN_PP(yycharset)+6+5;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "sybase_%s_%s_%s_%s_", Z_STRVAL_PP(yyhost), Z_STRVAL_PP(yyuser), Z_STRVAL_PP(yypasswd), Z_STRVAL_PP(yycharset));
- }
- break;
- case 5: {
- zval **yyhost, **yyuser, **yypasswd, **yycharset, **yyappname;
-
- if (zend_get_parameters_ex(5, &yyhost, &yyuser, &yypasswd, &yycharset, &yyappname) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(yyhost);
- convert_to_string_ex(yyuser);
- convert_to_string_ex(yypasswd);
- convert_to_string_ex(yycharset);
- convert_to_string_ex(yyappname);
- host = Z_STRVAL_PP(yyhost);
- user = Z_STRVAL_PP(yyuser);
- passwd = Z_STRVAL_PP(yypasswd);
- charset = Z_STRVAL_PP(yycharset);
- appname = Z_STRVAL_PP(yyappname);
- hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+Z_STRLEN_PP(yypasswd)+Z_STRLEN_PP(yycharset)+Z_STRLEN_PP(yyappname)+6+5;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "sybase_%s_%s_%s_%s_%s", Z_STRVAL_PP(yyhost), Z_STRVAL_PP(yyuser), Z_STRVAL_PP(yypasswd), Z_STRVAL_PP(yycharset), Z_STRVAL_PP(yyappname));
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
-
- if (!SybCtG(allow_persistent)) {
- persistent=0;
- }
- if (persistent) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
-
- if (SybCtG(max_links)!=-1 && SybCtG(num_links)>=SybCtG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Too many open links (%d)", SybCtG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (SybCtG(max_persistent)!=-1 && SybCtG(num_persistent)>=SybCtG(max_persistent)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Too many open persistent links (%d)", SybCtG(num_persistent));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- sybase_ptr = (sybase_link *) malloc(sizeof(sybase_link));
- if (!php_sybase_do_connect_internal(sybase_ptr, host, user, passwd, charset, appname)) {
- free(sybase_ptr);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* hash it up */
- Z_TYPE(new_le) = le_plink;
- new_le.ptr = sybase_ptr;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
- ct_close(sybase_ptr->connection, CS_UNUSED);
- ct_con_drop(sybase_ptr->connection);
- free(sybase_ptr);
- efree(hashed_details);
- RETURN_FALSE;
- }
- SybCtG(num_persistent)++;
- SybCtG(num_links)++;
- } else { /* we do */
- CS_INT con_status;
-
- if (Z_TYPE_P(le) != le_plink) {
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- sybase_ptr = (sybase_link *) le->ptr;
-
- /* If the link has died, close it and overwrite it with a new one. */
-
- if (ct_con_props(sybase_ptr->connection, CS_GET, CS_CON_STATUS,
- &con_status, CS_UNUSED, NULL)!=CS_SUCCEED) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to get connection status");
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (!(con_status & CS_CONSTAT_CONNECTED) || (con_status & CS_CONSTAT_DEAD) || sybase_ptr->dead) {
- sybase_link sybase;
-
- if (con_status & CS_CONSTAT_CONNECTED) {
- ct_close(sybase_ptr->connection, CS_FORCE_CLOSE);
- }
- /* Create a new connection, then replace the old
- * connection. If we fail to create a new connection,
- * put the old one back so there will be a connection,
- * even if it is a non-functional one. This is because
- * code may still be holding an id for this connection
- * so we can't free the CS_CONNECTION.
- * (This is actually totally hokey, it would be better
- * to just ct_con_drop() the connection and set
- * sybase_ptr->connection to NULL, then test it for
- * NULL before trying to use it elsewhere . . .)
- */
- memcpy(&sybase, sybase_ptr, sizeof(sybase_link));
- if (!php_sybase_do_connect_internal(sybase_ptr, host, user, passwd, charset, appname)) {
- memcpy(sybase_ptr, &sybase, sizeof(sybase_link));
- efree(hashed_details);
- RETURN_FALSE;
- }
- ct_con_drop(sybase.connection); /* drop old connection */
- }
- }
- ZEND_REGISTER_RESOURCE(return_value, sybase_ptr, le_plink);
- } else { /* non persistent */
- list_entry *index_ptr, new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual sybase link sits.
- * if it doesn't, open a new sybase link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length+1, (void **) &index_ptr)==SUCCESS) {
- int type, link;
- void *ptr;
-
- if (Z_TYPE_P(index_ptr) != le_index_ptr) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- link = (int) index_ptr->ptr;
- ptr = zend_list_find(link, &type); /* check if the link is still there */
- if (ptr && (type==le_link || type==le_plink)) {
- zend_list_addref(link);
- Z_LVAL_P(return_value) = SybCtG(default_link) = link;
- Z_TYPE_P(return_value) = IS_RESOURCE;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length+1);
- }
- }
- if (SybCtG(max_links)!=-1 && SybCtG(num_links)>=SybCtG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Too many open links (%d)", SybCtG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- sybase_ptr = (sybase_link *) emalloc(sizeof(sybase_link));
- if (!php_sybase_do_connect_internal(sybase_ptr, host, user, passwd, charset, appname)) {
- efree(sybase_ptr);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* add it to the list */
- ZEND_REGISTER_RESOURCE(return_value, sybase_ptr, le_link);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
- Z_TYPE(new_index_ptr) = le_index_ptr;
- if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1, (void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
- ct_close(sybase_ptr->connection, CS_UNUSED);
- ct_con_drop(sybase_ptr->connection);
- efree(sybase_ptr);
- efree(hashed_details);
- RETURN_FALSE;
- }
- SybCtG(num_links)++;
- }
- efree(hashed_details);
- SybCtG(default_link)=Z_LVAL_P(return_value);
- zend_list_addref(SybCtG(default_link));
-}
-
-
-static int php_sybase_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
-{
- if (SybCtG(default_link)==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_sybase_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
- }
- return SybCtG(default_link);
-}
-
-
-/* {{{ proto int sybase_connect([string host [, string user [, string password [, string charset [, string appname]]]]])
- Open Sybase server connection */
-PHP_FUNCTION(sybase_connect)
-{
- php_sybase_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-
-/* }}} */
-
-/* {{{ proto int sybase_pconnect([string host [, string user [, string password [, string charset [, string appname]]]]])
- Open persistent Sybase connection */
-PHP_FUNCTION(sybase_pconnect)
-{
- php_sybase_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-
-/* }}} */
-
-
-/* {{{ proto bool sybase_close([int link_id])
- Close Sybase connection */
-PHP_FUNCTION(sybase_close)
-{
- zval **sybase_link_index = 0;
- int id;
- sybase_link *sybase_ptr;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = SybCtG(default_link);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &sybase_link_index) == FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, sybase_link_index, id, "Sybase-Link", le_link, le_plink);
-
- if (id == -1) { /* explicit resource number */
- zend_list_delete(Z_RESVAL_PP(sybase_link_index));
- }
-
- if (id != -1 || (sybase_link_index && Z_RESVAL_PP(sybase_link_index)==SybCtG(default_link))) {
- zend_list_delete(SybCtG(default_link));
- SybCtG(default_link) = -1;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-
-static int exec_cmd(sybase_link *sybase_ptr, char *cmdbuf)
-{
- CS_RETCODE retcode;
- CS_INT restype;
- int failure=0;
-
- /* Fail if we already marked this connection dead. */
-
- if (sybase_ptr->dead) {
- return FAILURE;
- }
-
- /*
- ** Get a command handle, store the command string in it, and
- ** send it to the server.
- */
-
- if (ct_command(sybase_ptr->cmd, CS_LANG_CMD, cmdbuf, CS_NULLTERM, CS_UNUSED)!=CS_SUCCEED) {
- sybase_ptr->dead = 1;
- return FAILURE;
- }
- if (ct_send(sybase_ptr->cmd)!=CS_SUCCEED) {
- sybase_ptr->dead = 1;
- return FAILURE;
- }
-
- while ((retcode = ct_results(sybase_ptr->cmd, &restype))==CS_SUCCEED) {
- switch ((int) restype) {
- case CS_CMD_SUCCEED:
- case CS_CMD_DONE:
- break;
-
- case CS_CMD_FAIL:
- failure=1;
- break;
-
- case CS_STATUS_RESULT:
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_CURRENT);
- break;
-
- default:
- failure=1;
- break;
- }
- if (failure) {
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
- return FAILURE;
- }
- }
-
- switch (retcode) {
- case CS_END_RESULTS:
- return SUCCESS;
- break;
-
- case CS_FAIL:
- /* Hopefully this either cleans up the connection, or the
- * connection ends up marked dead so it will be reopened
- * if it is persistent. We may want to do
- * ct_close(CS_FORCE_CLOSE) if ct_cancel() fails; see the
- * doc for ct_results()==CS_FAIL.
- */
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
- /* Don't take chances with the vagaries of ct-lib. Mark it
- * dead ourselves.
- */
- sybase_ptr->dead = 1;
- return FAILURE;
-
- default:
- return FAILURE;
- }
-}
-
-
-/* {{{ proto bool sybase_select_db(string database [, int link_id])
- Select Sybase database */
-PHP_FUNCTION(sybase_select_db)
-{
- zval **db, **sybase_link_index;
- int id;
- char *cmdbuf;
- sybase_link *sybase_ptr;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &db) == FAILURE) {
- RETURN_FALSE;
- }
- id = php_sybase_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &db, &sybase_link_index) == FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, sybase_link_index, id, "Sybase-Link", le_link, le_plink);
-
- convert_to_string_ex(db);
- cmdbuf = (char *) emalloc(sizeof("use ")+Z_STRLEN_PP(db)+1);
- sprintf(cmdbuf, "use %s", Z_STRVAL_PP(db)); /* SAFE */
-
- if (exec_cmd(sybase_ptr, cmdbuf)==FAILURE) {
- efree(cmdbuf);
- RETURN_FALSE;
- } else {
- efree(cmdbuf);
- RETURN_TRUE;
- }
-}
-
-/* }}} */
-
-static void php_sybase_finish_results (sybase_result *result)
-{
- int i;
- CS_RETCODE retcode;
- CS_INT restype;
- TSRMLS_FETCH();
-
- efree(result->datafmt);
- efree(result->lengths);
- efree(result->indicators);
- efree(result->numerics);
- efree(result->types);
- for (i=0; i<result->num_fields; i++) {
- efree(result->tmp_buffer[i]);
- }
- efree(result->tmp_buffer);
-
- /* Indicate we have read all rows */
- result->sybase_ptr->active_result_index= 0;
-
- /* The only restype we should get now is CS_CMD_DONE, possibly
- * followed by a CS_STATUS_RESULT/CS_CMD_SUCCEED/CS_CMD_DONE
- * sequence if the command was a stored procedure call. But we
- * still need to read and discard unexpected results. We might
- * want to return a failure in this case because the application
- * won't be getting all the results it asked for.
- */
- while ((retcode = ct_results(result->sybase_ptr->cmd, &restype))==CS_SUCCEED) {
- switch ((int) restype) {
- case CS_CMD_SUCCEED:
- case CS_CMD_DONE:
- break;
-
- case CS_CMD_FAIL:
- _free_sybase_result(result);
- result = NULL;
- break;
-
- case CS_COMPUTE_RESULT:
- case CS_CURSOR_RESULT:
- case CS_PARAM_RESULT:
- case CS_ROW_RESULT:
- /* Unexpected results, cancel them. */
- case CS_STATUS_RESULT:
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Unexpected results, cancelling current");
- ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_CURRENT);
- break;
-
- default:
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Unexpected results, cancelling all");
- ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL);
- break;
- }
- }
-
- switch (retcode) {
- case CS_END_RESULTS:
- /* Normal. */
- break;
-
- case CS_FAIL:
- /* Hopefully this either cleans up the connection, or the
- * connection ends up marked dead so it will be reopened
- * if it is persistent. We may want to do
- * ct_close(CS_FORCE_CLOSE) if ct_cancel() fails; see the
- * doc for ct_results()==CS_FAIL.
- */
- ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL);
- /* Don't take chances with the vagaries of ct-lib. Mark it
- * dead ourselves.
- */
- result->sybase_ptr->dead = 1;
-
- case CS_CANCELED:
- default:
- _free_sybase_result(result);
- result = NULL;
- break;
- }
-}
-
-static int php_sybase_fetch_result_row (sybase_result *result, int numrows)
-{
- int i, j;
- CS_INT retcode;
-
- /* We've already fetched everything */
- if (result->last_retcode == CS_END_DATA) {
- return CS_END_DATA;
- }
-
- if (numrows!=-1) numrows+= result->num_rows;
- while ((retcode=ct_fetch(result->sybase_ptr->cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, NULL))==CS_SUCCEED
- || retcode==CS_ROW_FAIL) {
- /*
- if (retcode==CS_ROW_FAIL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Error reading row %d", result->num_rows);
- }
- */
-
- /* i= result->num_rows++; */
- result->num_rows++;
- i= result->store ? result->num_rows- 1 : 0;
- if (i >= result->blocks_initialized*SYBASE_ROWS_BLOCK) {
- result->data = (zval **) erealloc(result->data, sizeof(zval *)*SYBASE_ROWS_BLOCK*(++result->blocks_initialized));
- }
- if (result->store || 1 == result->num_rows) {
- result->data[i] = (zval *) emalloc(sizeof(zval)*result->num_fields);
- }
-
- for (j=0; j<result->num_fields; j++) {
- if (result->indicators[j] == -1) { /* null value */
- ZVAL_NULL(&result->data[i][j]);
- } else {
- Z_STRLEN(result->data[i][j]) = result->lengths[j]-1; /* we don't need the NULL in the length */
- Z_STRVAL(result->data[i][j]) = estrndup(result->tmp_buffer[j], result->lengths[j]);
- Z_TYPE(result->data[i][j]) = IS_STRING;
-
- switch (result->numerics[j]) {
- case 1:
- convert_to_long(&result->data[i][j]);
- break;
- case 2:
- convert_to_double(&result->data[i][j]);
- break;
- }
- }
- }
- if (numrows!=-1 && result->num_rows>=numrows) break;
- }
-
- result->last_retcode= retcode;
-
- switch (retcode) {
- case CS_END_DATA:
- php_sybase_finish_results(result);
- break;
-
- case CS_ROW_FAIL:
- case CS_SUCCEED:
- break;
-
- default:
- _free_sybase_result(result);
- result = NULL;
- break;
- }
-
- return retcode;
-}
-
-static sybase_result * php_sybase_fetch_result_set (sybase_link *sybase_ptr, int buffered, int store)
-{
- int num_fields;
- sybase_result *result;
- int i, j;
- CS_INT retcode;
-
- /* The following (if unbuffered) is more or less the equivalent of mysql_store_result().
- * fetch all rows from the server into the row buffer, thus:
- * 1) Being able to fire up another query without explicitly reading all rows
- * 2) Having numrows accessible
- */
- if (ct_res_info(sybase_ptr->cmd, CS_NUMDATA, &num_fields, CS_UNUSED, NULL)!=CS_SUCCEED) {
- return NULL;
- }
-
- result = (sybase_result *) emalloc(sizeof(sybase_result));
- result->data = (zval **) emalloc(sizeof(zval *)*SYBASE_ROWS_BLOCK);
- result->fields = NULL;
- result->sybase_ptr = sybase_ptr;
- result->cur_field=result->cur_row=result->num_rows=0;
- result->num_fields = num_fields;
- result->last_retcode = 0;
- result->store= store;
- result->blocks_initialized= 1;
- result->tmp_buffer = (char **) emalloc(sizeof(char *)*num_fields);
- result->lengths = (CS_INT *) emalloc(sizeof(CS_INT)*num_fields);
- result->indicators = (CS_SMALLINT *) emalloc(sizeof(CS_INT)*num_fields);
- result->datafmt = (CS_DATAFMT *) emalloc(sizeof(CS_DATAFMT)*num_fields);
- result->numerics = (unsigned char *) emalloc(sizeof(unsigned char)*num_fields);
- result->types = (CS_INT *) emalloc(sizeof(CS_INT)*num_fields);
-
- for (i=0; i<num_fields; i++) {
- ct_describe(sybase_ptr->cmd, i+1, &result->datafmt[i]);
- result->types[i] = result->datafmt[i].datatype;
- switch (result->datafmt[i].datatype) {
- case CS_CHAR_TYPE:
- case CS_VARCHAR_TYPE:
- case CS_TEXT_TYPE:
- case CS_IMAGE_TYPE:
- result->datafmt[i].maxlength++;
- result->numerics[i] = 0;
- break;
- case CS_BINARY_TYPE:
- case CS_VARBINARY_TYPE:
- result->datafmt[i].maxlength *= 2;
- result->datafmt[i].maxlength++;
- result->numerics[i] = 0;
- break;
- case CS_BIT_TYPE:
- case CS_TINYINT_TYPE:
- result->datafmt[i].maxlength = 4;
- result->numerics[i] = 1;
- break;
- case CS_SMALLINT_TYPE:
- result->datafmt[i].maxlength = 7;
- result->numerics[i] = 1;
- break;
- case CS_INT_TYPE:
- result->datafmt[i].maxlength = 12;
- result->numerics[i] = 1;
- break;
- case CS_REAL_TYPE:
- case CS_FLOAT_TYPE:
- result->datafmt[i].maxlength = 24;
- result->numerics[i] = 2;
- break;
- case CS_MONEY_TYPE:
- case CS_MONEY4_TYPE:
- result->datafmt[i].maxlength = 24;
- result->numerics[i] = 2;
- break;
- case CS_DATETIME_TYPE:
- case CS_DATETIME4_TYPE:
- result->datafmt[i].maxlength = 30;
- result->numerics[i] = 0;
- break;
- case CS_NUMERIC_TYPE:
- case CS_DECIMAL_TYPE:
- result->datafmt[i].maxlength = result->datafmt[i].precision + 3;
- /* numeric(10) vs numeric(10, 1) */
- result->numerics[i] = (result->datafmt[i].scale == 0 && result->datafmt[i].precision <= 10) ? 1 : 2;
- break;
- default:
- result->datafmt[i].maxlength++;
- result->numerics[i] = 0;
- break;
- }
- result->tmp_buffer[i] = (char *)emalloc(result->datafmt[i].maxlength);
- result->datafmt[i].datatype = CS_CHAR_TYPE;
- result->datafmt[i].format = CS_FMT_NULLTERM;
- ct_bind(sybase_ptr->cmd, i+1, &result->datafmt[i], result->tmp_buffer[i], &result->lengths[i], &result->indicators[i]);
- }
-
- result->fields = (sybase_field *) emalloc(sizeof(sybase_field)*num_fields);
- j=0;
- for (i=0; i<num_fields; i++) {
- char computed_buf[16];
-
- if (result->datafmt[i].namelen>0) {
- result->fields[i].name = estrndup(result->datafmt[i].name, result->datafmt[i].namelen);
- } else {
- if (j>0) {
- snprintf(computed_buf, 16, "computed%d", j);
- } else {
- strcpy(computed_buf, "computed");
- }
- result->fields[i].name = estrdup(computed_buf);
- j++;
- }
- result->fields[i].column_source = empty_string;
- result->fields[i].max_length = result->datafmt[i].maxlength-1;
- result->fields[i].numeric = result->numerics[i];
- Z_TYPE(result->fields[i]) = result->types[i];
- }
-
- retcode= php_sybase_fetch_result_row(result, buffered ? 1 : -1);
-
- return result;
-}
-
-static void php_sybase_query (INTERNAL_FUNCTION_PARAMETERS, int buffered)
-{
- zval **query, **sybase_link_index=NULL;
- zval **store_mode= NULL;
- int id, deadlock_count, store;
- sybase_link *sybase_ptr;
- sybase_result *result;
- CS_INT restype;
- CS_RETCODE retcode;
- enum {
- Q_RESULT, /* Success with results. */
- Q_SUCCESS, /* Success but no results. */
- Q_FAILURE, /* Failure, no results. */
- } status;
-
- store= 1;
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &query)==FAILURE) {
- RETURN_FALSE;
- }
- id = SybCtG(default_link);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &query, &sybase_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &query, &sybase_link_index, &store_mode)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- convert_to_long_ex(store_mode);
- store= (Z_LVAL_PP(store_mode) != 0);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, sybase_link_index, id, "Sybase-Link", le_link, le_plink);
-
- convert_to_string_ex(query);
-
- /* Fail if we already marked this connection dead. */
- if (sybase_ptr->dead) {
- RETURN_FALSE;
- }
-
- /* Check to see if a previous sybase_unbuffered_query has read all rows */
- if (sybase_ptr->active_result_index) {
- zval *tmp = NULL;
-
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "called without first fetching all rows from a previous unbuffered query");
- if (sybase_ptr->cmd) {
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
- }
-
- /* Get the resultset and free it */
- ALLOC_ZVAL(tmp);
- Z_LVAL_P(tmp)= sybase_ptr->active_result_index;
- Z_TYPE_P(tmp)= IS_RESOURCE;
- INIT_PZVAL(tmp);
- ZEND_FETCH_RESOURCE(result, sybase_result *, &tmp, -1, "Sybase result", le_result);
-
- /* Causes the following segfault:
- Program received signal SIGSEGV, Segmentation fault.
- 0x8144380 in _efree (ptr=0x81fe024, __zend_filename=0x81841a0 "php4/ext/sybase_ct/php_sybase_ct.c",
- __zend_lineno=946, __zend_orig_filename=0x0, __zend_orig_lineno=0) at php4/Zend/zend_alloc.c:229
- php4/Zend/zend_alloc.c:229:7284:beg:0x8144380
- */
- #if O_TIMM
- if (result) {
- php_sybase_finish_results(result);
- }
- #endif
-
- zval_ptr_dtor(&tmp);
- zend_list_delete(sybase_ptr->active_result_index);
- sybase_ptr->active_result_index= 0;
- }
-
- /* Repeat until we don't deadlock. */
- deadlock_count= 0;
- for (;;) {
- result = NULL;
- sybase_ptr->deadlock = 0;
- sybase_ptr->affected_rows = 0;
-
- /* On Solaris 11.5, ct_command() can be moved outside the
- * loop, but not on Linux 11.0.
- */
- if (ct_command(sybase_ptr->cmd, CS_LANG_CMD, Z_STRVAL_PP(query), CS_NULLTERM, CS_UNUSED)!=CS_SUCCEED) {
- /* If this didn't work, the connection is screwed but
- * ct-lib might not set CS_CONSTAT_DEAD. So set our own
- * flag. This happens sometimes when the database is restarted
- * and/or its machine is rebooted, and ct_command() returns
- * CS_BUSY for some reason.
- */
- sybase_ptr->dead = 1;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Connection is dead");
- RETURN_FALSE;
- }
-
- if (ct_send(sybase_ptr->cmd)!=CS_SUCCEED) {
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
- sybase_ptr->dead = 1;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Cannot send command");
- RETURN_FALSE;
- }
-
- /* Use the first result set or succeed/fail status and discard the
- * others. Applications really shouldn't be making calls that
- * return multiple result sets, but if they do then we need to
- * properly read or cancel them or the connection will become
- * unusable.
- */
- if (ct_results(sybase_ptr->cmd, &restype)!=CS_SUCCEED) {
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
- sybase_ptr->dead = 1;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Cannot read results");
- RETURN_FALSE;
- }
-
- switch ((int) restype) {
- case CS_CMD_FAIL:
- default:
- status = Q_FAILURE;
- break;
- case CS_CMD_SUCCEED:
- case CS_CMD_DONE: {
- CS_INT row_count;
- if (ct_res_info(sybase_ptr->cmd, CS_ROW_COUNT, &row_count, CS_UNUSED, NULL)==CS_SUCCEED) {
- sybase_ptr->affected_rows = (long)row_count;
- }
- }
- /* Fall through */
- case CS_COMPUTEFMT_RESULT:
- case CS_ROWFMT_RESULT:
- case CS_DESCRIBE_RESULT:
- case CS_MSG_RESULT:
- buffered= 0; /* These queries have no need for buffering */
- status = Q_SUCCESS;
- break;
- case CS_COMPUTE_RESULT:
- case CS_CURSOR_RESULT:
- case CS_PARAM_RESULT:
- case CS_ROW_RESULT:
- case CS_STATUS_RESULT:
- result = php_sybase_fetch_result_set(sybase_ptr, buffered, store);
- if (result == NULL) {
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
- sybase_ptr->dead = 1;
- RETURN_FALSE;
- }
- status = Q_RESULT;
- break;
- }
-
- /* Check for left-over results */
- if (!buffered && status != Q_RESULT) {
- while ((retcode = ct_results(sybase_ptr->cmd, &restype))==CS_SUCCEED) {
- switch ((int) restype) {
- case CS_CMD_SUCCEED:
- case CS_CMD_DONE:
- break;
-
- case CS_CMD_FAIL:
- status = Q_FAILURE;
- break;
-
- case CS_COMPUTE_RESULT:
- case CS_CURSOR_RESULT:
- case CS_PARAM_RESULT:
- case CS_ROW_RESULT:
- /* Unexpected results, cancel them. */
- case CS_STATUS_RESULT:
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_CURRENT);
- break;
-
- default:
- status = Q_FAILURE;
- break;
- }
- if (status == Q_FAILURE) {
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
- }
- }
-
- switch (retcode) {
- case CS_END_RESULTS:
- /* Normal. */
- break;
-
- case CS_FAIL:
- /* Hopefully this either cleans up the connection, or the
- * connection ends up marked dead so it will be reopened
- * if it is persistent. We may want to do
- * ct_close(CS_FORCE_CLOSE) if ct_cancel() fails; see the
- * doc for ct_results()==CS_FAIL.
- */
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
- /* Don't take chances with the vagaries of ct-lib. Mark it
- * dead ourselves.
- */
- sybase_ptr->dead = 1;
- case CS_CANCELED:
- default:
- status = Q_FAILURE;
- break;
- }
- }
-
- /* Retry deadlocks up until deadlock_retry_count times */
- if (sybase_ptr->deadlock && SybCtG(deadlock_retry_count) != -1 && ++deadlock_count > SybCtG(deadlock_retry_count)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Retried deadlock %d times [max: %d], giving up\n", deadlock_count- 1, SybCtG(deadlock_retry_count));
- if (result != NULL) {
- _free_sybase_result(result);
- }
- break;
- }
-
- /* If query completed without deadlock, break out of the loop.
- * Sometimes deadlock results in failures and sometimes not,
- * it seems to depend on the server flavor. But we want to
- * retry all deadlocks.
- */
- if (sybase_ptr->dead || sybase_ptr->deadlock == 0) {
- break;
- }
-
- /* Get rid of any results we may have fetched. This happens:
- * e.g., our result set may be a stored procedure status which
- * is returned even if the stored procedure deadlocks. As an
- * optimization, we could try not to fetch results in known
- * deadlock conditions, but deadlock is (should be) rare.
- */
- if (result != NULL) {
- _free_sybase_result(result);
- }
- }
-
- if (status == Q_SUCCESS) {
- RETURN_TRUE;
- }
-
- if (status == Q_FAILURE) {
- if (result != NULL) {
- _free_sybase_result(result);
- }
- RETURN_FALSE;
- }
-
- /* Indicate we have data in case of buffered queries */
- id= ZEND_REGISTER_RESOURCE(return_value, result, le_result);
- sybase_ptr->active_result_index= buffered ? id : 0;
-}
-
-/* {{{ proto int sybase_query(string query [, int link_id])
- Send Sybase query */
-PHP_FUNCTION(sybase_query)
-{
- php_sybase_query(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int sybase_unbuffered_query(string query [, int link_id])
- Send Sybase query */
-PHP_FUNCTION(sybase_unbuffered_query)
-{
- php_sybase_query(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-
-
-/* {{{ proto bool sybase_free_result(int result)
- Free result memory */
-PHP_FUNCTION(sybase_free_result)
-{
- zval **sybase_result_index;
- sybase_result *result;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &sybase_result_index) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(sybase_result_index) == IS_RESOURCE && Z_LVAL_PP(sybase_result_index) == 0) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, sybase_result_index, -1, "Sybase result", le_result);
-
- /* Did we fetch up until the end? */
- if (result->last_retcode != CS_END_DATA) {
- /* php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Cancelling the rest of the results\n"); */
- ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL);
- php_sybase_finish_results(result);
- }
-
- zend_list_delete(Z_LVAL_PP(sybase_result_index));
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string sybase_get_last_message(void)
- Returns the last message from server (over min_message_severity) */
-PHP_FUNCTION(sybase_get_last_message)
-{
- RETURN_STRING(SybCtG(server_message), 1);
-}
-/* }}} */
-
-/* {{{ proto int sybase_num_rows(int result)
- Get number of rows in result */
-PHP_FUNCTION(sybase_num_rows)
-{
- zval **sybase_result_index;
- sybase_result *result;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &sybase_result_index) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, sybase_result_index, -1, "Sybase result", le_result);
-
- Z_LVAL_P(return_value) = result->num_rows;
- Z_TYPE_P(return_value) = IS_LONG;
-}
-
-/* }}} */
-
-/* {{{ proto int sybase_num_fields(int result)
- Get number of fields in result */
-PHP_FUNCTION(sybase_num_fields)
-{
- zval **sybase_result_index;
- sybase_result *result;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &sybase_result_index) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, sybase_result_index, -1, "Sybase result", le_result);
-
- Z_LVAL_P(return_value) = result->num_fields;
- Z_TYPE_P(return_value) = IS_LONG;
-}
-
-/* }}} */
-
-/* {{{ proto array sybase_fetch_row(int result)
- Get row as enumerated array */
-PHP_FUNCTION(sybase_fetch_row)
-{
- zval **sybase_result_index;
- int i;
- sybase_result *result;
- zval *field_content;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &sybase_result_index) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, sybase_result_index, -1, "Sybase result", le_result);
-
- /* Unbuffered? */
- if (result->last_retcode != CS_END_DATA) {
- php_sybase_fetch_result_row(result, 1);
- }
-
- /* At the end? */
- if (result->cur_row >= result->num_rows) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- for (i=0; i<result->num_fields; i++) {
- ALLOC_ZVAL(field_content);
- *field_content = result->data[result->store ? result->cur_row : 0][i];
- INIT_PZVAL(field_content);
- zval_copy_ctor(field_content);
- zend_hash_index_update(Z_ARRVAL_P(return_value), i, (void *) &field_content, sizeof(zval* ), NULL);
- }
- result->cur_row++;
-}
-
-/* }}} */
-
-static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int numerics)
-{
- zval **sybase_result_index;
- sybase_result *result;
- int i, j;
- zval *tmp;
- char name[32];
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &sybase_result_index) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, sybase_result_index, -1, "Sybase result", le_result);
-
- /* Unbuffered ? Fetch next row */
- if (result->last_retcode != CS_END_DATA) {
- php_sybase_fetch_result_row(result, 1);
- }
-
- /* At the end? */
- if (result->cur_row >= result->num_rows) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- j= 1;
- for (i=0; i<result->num_fields; i++) {
- ALLOC_ZVAL(tmp);
- *tmp = result->data[result->store ? result->cur_row : 0][i];
- INIT_PZVAL(tmp);
- if (PG(magic_quotes_runtime) && Z_TYPE_P(tmp) == IS_STRING) {
- Z_STRVAL_P(tmp) = php_addslashes(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), &Z_STRLEN_P(tmp), 0 TSRMLS_CC);
- } else {
- zval_copy_ctor(tmp);
- }
- if (numerics) {
- zend_hash_index_update(Z_ARRVAL_P(return_value), i, (void *) &tmp, sizeof(zval *), NULL);
- tmp->refcount++;
- }
-
- if (zend_hash_exists(Z_ARRVAL_P(return_value), result->fields[i].name, strlen(result->fields[i].name)+1)) {
- snprintf(name, 32, "%s%d", result->fields[i].name, j);
- result->fields[i].name= estrdup(name);
- j++;
- }
- zend_hash_update(Z_ARRVAL_P(return_value), result->fields[i].name, strlen(result->fields[i].name)+1, (void *) &tmp, sizeof(zval *), NULL);
- }
- result->cur_row++;
-}
-
-
-/* {{{ proto object sybase_fetch_object(int result [, mixed object])
- Fetch row as object */
-PHP_FUNCTION(sybase_fetch_object)
-{
- zval **object= NULL;
- zval *sybase_result_index;
- zend_class_entry *ce= NULL;
-
- /* Was a second parameter given? */
- if (2 == ZEND_NUM_ARGS()) {
- if (zend_get_parameters_ex(2, &sybase_result_index, &object) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (Z_TYPE_PP(object)) {
- case IS_OBJECT:
- ce= Z_OBJCE_PP(object);
- break;
- default:
- convert_to_string_ex(object);
- zend_str_tolower(Z_STRVAL_PP(object), Z_STRLEN_PP(object));
- zend_hash_find(EG(class_table), Z_STRVAL_PP(object), Z_STRLEN_PP(object)+1, (void **)&ce);
-
- if (!ce) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Class %s has not been declared", Z_STRVAL_PP(object));
- ce= ZEND_STANDARD_CLASS_DEF_PTR;
- }
- }
-
- ht= 1;
- }
-
- php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
- if (Z_TYPE_P(return_value)==IS_ARRAY) {
- object_and_properties_init(
- return_value,
- object ? ce : ZEND_STANDARD_CLASS_DEF_PTR,
- Z_ARRVAL_P(return_value)
- );
- }
-}
-/* }}} */
-
-/* {{{ proto array sybase_fetch_array(int result)
- Fetch row as array */
-PHP_FUNCTION(sybase_fetch_array)
-{
- php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto array sybase_fetch_assoc(int result)
- Fetch row as array without numberic indices */
-PHP_FUNCTION(sybase_fetch_assoc)
-{
- php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto bool sybase_data_seek(int result, int offset)
- Move internal row pointer */
-PHP_FUNCTION(sybase_data_seek)
-{
- zval **sybase_result_index, **offset;
- sybase_result *result;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &sybase_result_index, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, sybase_result_index, -1, "Sybase result", le_result);
-
- convert_to_long_ex(offset);
-
- /* Unbuffered ? */
- if (result->last_retcode != CS_END_DATA && Z_LVAL_PP(offset)>=result->num_rows) {
- php_sybase_fetch_result_row(result, Z_LVAL_PP(offset));
- }
-
- if (Z_LVAL_PP(offset)<0 || Z_LVAL_PP(offset)>=result->num_rows) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Bad row offset");
- RETURN_FALSE;
- }
-
- result->cur_row = Z_LVAL_PP(offset);
- RETURN_TRUE;
-}
-/* }}} */
-
-static char *php_sybase_get_field_name(CS_INT type)
-{
- switch (type) {
- case CS_CHAR_TYPE:
- case CS_VARCHAR_TYPE:
- case CS_TEXT_TYPE:
- return "string";
- break;
- case CS_IMAGE_TYPE:
- return "image";
- break;
- case CS_BINARY_TYPE:
- case CS_VARBINARY_TYPE:
- return "blob";
- break;
- case CS_BIT_TYPE:
- return "bit";
- break;
- case CS_TINYINT_TYPE:
- case CS_SMALLINT_TYPE:
- case CS_INT_TYPE:
- return "int";
- break;
- case CS_REAL_TYPE:
- case CS_FLOAT_TYPE:
- case CS_NUMERIC_TYPE:
- case CS_DECIMAL_TYPE:
- return "real";
- break;
- case CS_MONEY_TYPE:
- case CS_MONEY4_TYPE:
- return "money";
- break;
- case CS_DATETIME_TYPE:
- case CS_DATETIME4_TYPE:
- return "datetime";
- break;
- default:
- return "unknown";
- break;
- }
-}
-
-
-/* {{{ proto object sybase_fetch_field(int result [, int offset])
- Get field information */
-PHP_FUNCTION(sybase_fetch_field)
-{
- zval **sybase_result_index, **offset;
- int field_offset;
- sybase_result *result;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &sybase_result_index) == FAILURE) {
- RETURN_FALSE;
- }
- field_offset=-1;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &sybase_result_index, &offset) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(offset);
- field_offset = Z_LVAL_PP(offset);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, sybase_result_index, -1, "Sybase result", le_result);
-
- if (field_offset==-1) {
- field_offset = result->cur_field;
- result->cur_field++;
- }
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Bad column offset");
- }
- RETURN_FALSE;
- }
-
- object_init(return_value);
-
- add_property_string(return_value, "name", result->fields[field_offset].name, 1);
- add_property_long(return_value, "max_length", result->fields[field_offset].max_length);
- add_property_string(return_value, "column_source", result->fields[field_offset].column_source, 1);
- add_property_long(return_value, "numeric", result->fields[field_offset].numeric);
- add_property_string(return_value, "type", php_sybase_get_field_name(Z_TYPE(result->fields[field_offset])), 1);
-}
-/* }}} */
-
-
-/* {{{ proto bool sybase_field_seek(int result, int offset)
- Set field offset */
-PHP_FUNCTION(sybase_field_seek)
-{
- zval **sybase_result_index, **offset;
- int field_offset;
- sybase_result *result;
-
- if (ZEND_NUM_ARGS() !=2 || zend_get_parameters_ex(2, &sybase_result_index, &offset) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, sybase_result_index, -1, "Sybase result", le_result);
-
- convert_to_long_ex(offset);
- field_offset = Z_LVAL_PP(offset);
-
- /* Unbuffered ? */
- if (result->last_retcode != CS_END_DATA && field_offset>=result->num_rows) {
- php_sybase_fetch_result_row(result, field_offset);
- }
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Bad column offset");
- RETURN_FALSE;
- }
-
- result->cur_field = field_offset;
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto string sybase_result(int result, int row, mixed field)
- Get result data */
-PHP_FUNCTION(sybase_result)
-{
- zval **row, **field, **sybase_result_index;
- int field_offset=0;
- sybase_result *result;
-
- if (ZEND_NUM_ARGS() !=3 || zend_get_parameters_ex(3, &sybase_result_index, &row, &field)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, sybase_result_index, -1, "Sybase result", le_result);
-
- convert_to_long_ex(row);
-
- /* Unbuffered ? */
- if (result->last_retcode != CS_END_DATA && Z_LVAL_PP(row) >= result->num_rows) {
- php_sybase_fetch_result_row(result, Z_LVAL_PP(row));
- }
-
- if (Z_LVAL_PP(row) < 0 || Z_LVAL_PP(row) >= result->num_rows) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Bad row offset (%d)", Z_LVAL_PP(row));
- RETURN_FALSE;
- }
-
- switch(Z_TYPE_PP(field)) {
- case IS_STRING: {
- int i;
-
- for (i=0; i<result->num_fields; i++) {
- if (!strcasecmp(result->fields[i].name, Z_STRVAL_PP(field))) {
- field_offset = i;
- break;
- }
- }
- if (i>=result->num_fields) { /* no match found */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: %s field not found in result", Z_STRVAL_PP(field));
- RETURN_FALSE;
- }
- break;
- }
- default:
- convert_to_long_ex(field);
- field_offset = Z_LVAL_PP(field);
- if (field_offset<0 || field_offset>=result->num_fields) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Bad column offset specified");
- RETURN_FALSE;
- }
- break;
- }
-
- *return_value = result->data[Z_LVAL_PP(row)][field_offset];
- zval_copy_ctor(return_value);
-}
-/* }}} */
-
-
-/* {{{ proto int sybase_affected_rows([int link_id])
- Get number of affected rows in last query */
-PHP_FUNCTION(sybase_affected_rows)
-{
- zval **sybase_link_index;
- sybase_link *sybase_ptr;
- int id;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = php_sybase_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &sybase_link_index) == FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, sybase_link_index, id, "Sybase-Link", le_link, le_plink);
-
- Z_LVAL_P(return_value) = sybase_ptr->affected_rows;
- Z_TYPE_P(return_value) = IS_LONG;
-}
-/* }}} */
-
-
-PHP_MINFO_FUNCTION(sybase)
-{
- char buf[32];
-
- php_info_print_table_start();
- php_info_print_table_header(2, "Sybase_CT Support", "enabled" );
- sprintf(buf, "%ld", SybCtG(num_persistent));
- php_info_print_table_row(2, "Active Persistent Links", buf);
- sprintf(buf, "%ld", SybCtG(num_links));
- php_info_print_table_row(2, "Active Links", buf);
- sprintf(buf, "%ld", SybCtG(min_server_severity));
- php_info_print_table_row(2, "Min server severity", buf);
- sprintf(buf, "%ld", SybCtG(min_client_severity));
- php_info_print_table_row(2, "Min client severity", buf);
- php_info_print_table_row(2, "Application Name", SybCtG(appname));
- sprintf(buf, "%ld", SybCtG(deadlock_retry_count));
- php_info_print_table_row(2, "Deadlock retry count", buf);
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-
-/* {{{ proto void sybase_min_client_severity(int severity)
- Sets minimum client severity */
-PHP_FUNCTION(sybase_min_client_severity)
-{
- zval **severity;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &severity) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(severity);
- SybCtG(min_client_severity) = Z_LVAL_PP(severity);
-}
-/* }}} */
-
-
-/* {{{ proto void sybase_min_server_severity(int severity)
- Sets minimum server severity */
-PHP_FUNCTION(sybase_min_server_severity)
-{
- zval **severity;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &severity) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(severity);
- SybCtG(min_server_severity) = Z_LVAL_PP(severity);
-}
-/* }}} */
-
-/* {{{ proto void sybase_deadlock_retry_count(int retry_count)
- Sets deadlock retry count */
-PHP_FUNCTION(sybase_deadlock_retry_count)
-{
- zval **retry_count;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &retry_count) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(retry_count);
- SybCtG(deadlock_retry_count) = Z_LVAL_PP(retry_count);
-}
-/* }}} */
-
-
-/* {{{ proto bool sybase_set_message_handler(mixed error_func)
- Set the error handler, to be called when a server message is raised.
- If error_func is NULL the handler will be deleted */
-PHP_FUNCTION(sybase_set_message_handler)
-{
- zval ***params;
- char *name;
- int argc = ZEND_NUM_ARGS();
-
- if (argc != 1) {
- WRONG_PARAM_COUNT;
- }
-
- params = emalloc(sizeof(zval **) * argc);
-
- if (zend_get_parameters_array_ex(argc, params) == FAILURE) {
- efree(params);
- RETURN_FALSE;
- }
-
- if (SybCtG(callback_name)) {
- zval_dtor(SybCtG(callback_name));
- SybCtG(callback_name)= NULL;
- }
-
- if (Z_TYPE_PP(params[0]) == IS_NULL) {
- efree(params);
- RETURN_TRUE;
- }
-
- if (!zend_is_callable(*params[0], 0, &name)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argumented is expected to be a valid callback, '%s' was given", name);
- efree(name);
- efree(params);
- RETURN_FALSE;
- }
-
- ALLOC_ZVAL(SybCtG(callback_name));
- *SybCtG(callback_name) = **params[0];
- INIT_PZVAL(SybCtG(callback_name));
- zval_copy_ctor(SybCtG(callback_name));
- efree(params);
- efree(name);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/sybase_ct/php_sybase_ct.h b/ext/sybase_ct/php_sybase_ct.h
deleted file mode 100644
index c2622d242d..0000000000
--- a/ext/sybase_ct/php_sybase_ct.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- | Timm Friebe <php_sybase_ct@thekid.de> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SYBASE_CT_H
-#define PHP_SYBASE_CT_H
-
-#if HAVE_SYBASE_CT
-
-#define CTLIB_VERSION CS_VERSION_100
-
-extern zend_module_entry sybase_module_entry;
-#define sybase_module_ptr &sybase_module_entry
-
-PHP_MINIT_FUNCTION(sybase);
-PHP_MSHUTDOWN_FUNCTION(sybase);
-PHP_RINIT_FUNCTION(sybase);
-PHP_RSHUTDOWN_FUNCTION(sybase);
-PHP_MINFO_FUNCTION(sybase);
-
-PHP_FUNCTION(sybase_connect);
-PHP_FUNCTION(sybase_pconnect);
-PHP_FUNCTION(sybase_close);
-PHP_FUNCTION(sybase_select_db);
-PHP_FUNCTION(sybase_query);
-PHP_FUNCTION(sybase_unbuffered_query);
-PHP_FUNCTION(sybase_free_result);
-PHP_FUNCTION(sybase_get_last_message);
-PHP_FUNCTION(sybase_num_rows);
-PHP_FUNCTION(sybase_num_fields);
-PHP_FUNCTION(sybase_fetch_row);
-PHP_FUNCTION(sybase_fetch_array);
-PHP_FUNCTION(sybase_fetch_assoc);
-PHP_FUNCTION(sybase_fetch_object);
-PHP_FUNCTION(sybase_data_seek);
-PHP_FUNCTION(sybase_result);
-PHP_FUNCTION(sybase_affected_rows);
-PHP_FUNCTION(sybase_field_seek);
-PHP_FUNCTION(sybase_min_client_severity);
-PHP_FUNCTION(sybase_min_server_severity);
-PHP_FUNCTION(sybase_fetch_field);
-PHP_FUNCTION(sybase_set_message_handler);
-PHP_FUNCTION(sybase_deadlock_retry_count);
-
-#include <ctpublic.h>
-
-ZEND_BEGIN_MODULE_GLOBALS(sybase)
- long default_link;
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
- char *appname;
- char *hostname;
- char *server_message;
- long min_server_severity, min_client_severity;
- long deadlock_retry_count;
- zval *callback_name;
- CS_CONTEXT *context;
-ZEND_END_MODULE_GLOBALS(sybase)
-
-typedef struct {
- CS_CONNECTION *connection;
- CS_COMMAND *cmd;
- int valid;
- int deadlock;
- int dead;
- int active_result_index;
- long affected_rows;
-} sybase_link;
-
-#define SYBASE_ROWS_BLOCK 128
-
-typedef struct {
- char *name,*column_source;
- int max_length, numeric;
- CS_INT type;
-} sybase_field;
-
-typedef struct {
- pval **data;
- sybase_field *fields;
- sybase_link *sybase_ptr;
- int cur_row,cur_field;
- int num_rows,num_fields;
-
- /* For unbuffered reads */
- CS_INT *lengths;
- CS_SMALLINT *indicators;
- char **tmp_buffer;
- unsigned char *numerics;
- CS_INT *types;
- CS_DATAFMT *datafmt;
- int blocks_initialized;
- CS_RETCODE last_retcode;
- int store;
-} sybase_result;
-
-#ifdef ZTS
-# define SybCtG(v) TSRMG(sybase_globals_id, zend_sybase_globals *, v)
-#else
-# define SybCtG(v) (sybase_globals.v)
-#endif
-
-#else
-
-#define sybase_module_ptr NULL
-
-#endif
-
-#define phpext_sybase_ct_ptr sybase_module_ptr
-
-#endif /* PHP_SYBASE_CT_H */
diff --git a/ext/sybase_ct/sybase_ct.dsp b/ext/sybase_ct/sybase_ct.dsp
deleted file mode 100644
index f1a1abf4d1..0000000000
--- a/ext/sybase_ct/sybase_ct.dsp
+++ /dev/null
@@ -1,114 +0,0 @@
-# Microsoft Developer Studio Project File - Name="sybase_ct" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=sybase_ct - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "sybase_ct.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "sybase_ct.mak" CFG="sybase_ct - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "sybase_ct - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "sybase_ct - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "sybase_ct - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SYBASE_CT_EXPORTS" /D "COMPILE_DL_SYBASE_CT" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "SYBASE_CT_EXPORTS" /D "COMPILE_DL_SYBASE_CT" /D HAVE_SYBASE_CT=1 /D ZTS=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libct.lib libcs.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_sybase_ct.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "sybase_ct - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SYBASE_CT_EXPORTS" /D "COMPILE_DL_SYBASE_CT" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SYBASE_CT_EXPORTS" /D "COMPILE_DL_SYBASE_CT" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SYBASE_CT=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_sybase_ct.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "sybase_ct - Win32 Release_TS"
-# Name "sybase_ct - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_sybase_ct.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_sybase_ct.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/sysvmsg/CREDITS b/ext/sysvmsg/CREDITS
deleted file mode 100644
index 6b150d5301..0000000000
--- a/ext/sysvmsg/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-System V Message based IPC
-Wez Furlong
diff --git a/ext/sysvmsg/EXPERIMENTAL b/ext/sysvmsg/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/sysvmsg/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/sysvmsg/config.m4 b/ext/sysvmsg/config.m4
deleted file mode 100644
index 28f03e76d9..0000000000
--- a/ext/sysvmsg/config.m4
+++ /dev/null
@@ -1,9 +0,0 @@
-dnl $Id$
-
-PHP_ARG_ENABLE(sysvmsg,whether to enable System V IPC support,
-[ --enable-sysvmsg Enable sysvmsg support])
-
-if test "$PHP_SYSVMSG" != "no"; then
- AC_DEFINE(HAVE_SYSVMSG, 1, [ ])
- PHP_NEW_EXTENSION(sysvmsg, sysvmsg.c, $ext_shared)
-fi
diff --git a/ext/sysvmsg/php_sysvmsg.h b/ext/sysvmsg/php_sysvmsg.h
deleted file mode 100644
index 1b13955bb1..0000000000
--- a/ext/sysvmsg/php_sysvmsg.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SYSVMSG_H
-#define PHP_SYSVMSG_H
-
-#if HAVE_SYSVMSG
-
-extern zend_module_entry sysvmsg_module_entry;
-#define phpext_sysvmsg_ptr &sysvmsg_module_entry
-
-#ifndef __USE_GNU
-/* we want to use mtype instead of __mtype */
-#define __USE_GNU
-#endif
-
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-PHP_MINIT_FUNCTION(sysvmsg);
-PHP_MSHUTDOWN_FUNCTION(sysvmsg);
-PHP_RINIT_FUNCTION(sysvmsg);
-PHP_RSHUTDOWN_FUNCTION(sysvmsg);
-PHP_MINFO_FUNCTION(sysvmsg);
-
-PHP_FUNCTION(msg_get_queue);
-PHP_FUNCTION(msg_remove_queue);
-PHP_FUNCTION(msg_stat_queue);
-PHP_FUNCTION(msg_set_queue);
-PHP_FUNCTION(msg_send);
-PHP_FUNCTION(msg_receive);
-
-typedef struct {
- key_t key;
- long id;
-} sysvmsg_queue_t;
-
-struct php_msgbuf {
- long mtype;
- char mtext[1];
-};
-
-#endif /* HAVE_SYSVMSG */
-
-#endif /* PHP_SYSVMSG_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c
deleted file mode 100644
index a21ff52da2..0000000000
--- a/ext/sysvmsg/sysvmsg.c
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_sysvmsg.h"
-#include "ext/standard/php_var.h"
-#include "ext/standard/php_smart_str.h"
-
-/* In order to detect MSG_EXCEPT use at run time; we have no way
- * of knowing what the bit definitions are, so we can't just define
- * out own MSG_EXCEPT value. */
-#define PHP_MSG_IPC_NOWAIT 1
-#define PHP_MSG_NOERROR 2
-#define PHP_MSG_EXCEPT 4
-
-/* True global resources - no need for thread safety here */
-static int le_sysvmsg;
-
-static unsigned char sixth_arg_force_ref[] = { 6, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-static unsigned char msg_receive_args_force_ref[] = { 8, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_NONE, BYREF_FORCE, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-
-/* {{{ sysvmsg_functions[]
- *
- * Every user visible function must have an entry in sysvmsg_functions[].
- */
-function_entry sysvmsg_functions[] = {
- PHP_FE(msg_get_queue, NULL)
- PHP_FE(msg_send, sixth_arg_force_ref)
- PHP_FE(msg_receive, msg_receive_args_force_ref)
- PHP_FE(msg_remove_queue, NULL)
- PHP_FE(msg_stat_queue, NULL)
- PHP_FE(msg_set_queue, NULL)
- {NULL, NULL, NULL} /* Must be the last line in sysvmsg_functions[] */
-};
-/* }}} */
-
-/* {{{ sysvmsg_module_entry
- */
-zend_module_entry sysvmsg_module_entry = {
- STANDARD_MODULE_HEADER,
- "sysvmsg",
- sysvmsg_functions,
- PHP_MINIT(sysvmsg),
- PHP_MSHUTDOWN(sysvmsg),
- NULL,
- NULL,
- PHP_MINFO(sysvmsg),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_SYSVMSG
-ZEND_GET_MODULE(sysvmsg)
-#endif
-
-/* {{{ PHP_INI
- */
-/* Remove comments and fill if you need to have entries in php.ini
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("sysvmsg.value", "42", PHP_INI_ALL, OnUpdateLong, global_value, zend_sysvmsg_globals, sysvmsg_globals)
- STD_PHP_INI_ENTRY("sysvmsg.string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_sysvmsg_globals, sysvmsg_globals)
-PHP_INI_END()
-*/
-/* }}} */
-
-static void sysvmsg_release(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- sysvmsg_queue_t * mq = (sysvmsg_queue_t *) rsrc->ptr;
- efree(mq);
-}
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(sysvmsg)
-{
- le_sysvmsg = zend_register_list_destructors_ex(sysvmsg_release, NULL, "sysvmsg queue", module_number);
- REGISTER_LONG_CONSTANT("MSG_IPC_NOWAIT", PHP_MSG_IPC_NOWAIT, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("MSG_NOERROR", PHP_MSG_NOERROR, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("MSG_EXCEPT", PHP_MSG_EXCEPT, CONST_PERSISTENT|CONST_CS);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(sysvmsg)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(sysvmsg)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "sysvmsg support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision$");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ proto array msg_set_queue(resource queue, array data)
- Set information for a message queue */
-PHP_FUNCTION(msg_set_queue)
-{
- zval *queue, *data;
- sysvmsg_queue_t *mq = NULL;
- struct msqid_ds stat;
-
- RETVAL_FALSE;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra", &queue, &data) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(mq, sysvmsg_queue_t *, &queue, -1, "sysvmsg queue", le_sysvmsg);
-
- if (msgctl(mq->id, IPC_STAT, &stat) == 0) {
- zval **item;
-
- /* now pull out members of data and set them in the stat buffer */
- if (zend_hash_find(Z_ARRVAL_P(data), "msg_perm.uid", sizeof("msg_perm.uid"), (void **) &item) == SUCCESS) {
- convert_to_long_ex(item);
- stat.msg_perm.uid = Z_LVAL_PP(item);
- }
- if (zend_hash_find(Z_ARRVAL_P(data), "msg_perm.gid", sizeof("msg_perm.gid"), (void **) &item) == SUCCESS) {
- convert_to_long_ex(item);
- stat.msg_perm.gid = Z_LVAL_PP(item);
- }
- if (zend_hash_find(Z_ARRVAL_P(data), "msg_perm.mode", sizeof("msg_perm.mode"), (void **) &item) == SUCCESS) {
- convert_to_long_ex(item);
- stat.msg_perm.mode = Z_LVAL_PP(item);
- }
- if (zend_hash_find(Z_ARRVAL_P(data), "msg_qbytes", sizeof("msg_qbytes"), (void **) &item) == SUCCESS) {
- convert_to_long_ex(item);
- stat.msg_qbytes = Z_LVAL_PP(item);
- }
- if (msgctl(mq->id, IPC_SET, &stat) == 0) {
- RETVAL_TRUE;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto array msg_stat_queue(resource queue)
- Returns information about a message queue */
-PHP_FUNCTION(msg_stat_queue)
-{
- zval *queue;
- sysvmsg_queue_t *mq = NULL;
- struct msqid_ds stat;
-
- RETVAL_FALSE;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &queue) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(mq, sysvmsg_queue_t *, &queue, -1, "sysvmsg queue", le_sysvmsg);
-
- if (msgctl(mq->id, IPC_STAT, &stat) == 0) {
- array_init(return_value);
-
- add_assoc_long(return_value, "msg_perm.uid", stat.msg_perm.uid);
- add_assoc_long(return_value, "msg_perm.gid", stat.msg_perm.gid);
- add_assoc_long(return_value, "msg_perm.mode", stat.msg_perm.mode);
- add_assoc_long(return_value, "msg_stime", stat.msg_stime);
- add_assoc_long(return_value, "msg_rtime", stat.msg_rtime);
- add_assoc_long(return_value, "msg_ctime", stat.msg_ctime);
- add_assoc_long(return_value, "msg_qnum", stat.msg_qnum);
- add_assoc_long(return_value, "msg_qbytes", stat.msg_qbytes);
- add_assoc_long(return_value, "msg_lspid", stat.msg_lspid);
- add_assoc_long(return_value, "msg_lrpid", stat.msg_lrpid);
- }
-}
-/* }}} */
-
-/* {{{ proto resource msg_get_queue(long key [, long perms])
- Attach to a message queue */
-PHP_FUNCTION(msg_get_queue)
-{
- long key;
- long perms = 0666;
- sysvmsg_queue_t *mq;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &key, &perms) == FAILURE) {
- return;
- }
-
- mq = (sysvmsg_queue_t *) emalloc(sizeof(sysvmsg_queue_t));
-
- mq->key = key;
- mq->id = msgget(key, 0);
- if (mq->id < 0) {
- /* doesn't already exist; create it */
- mq->id = msgget(key, IPC_CREAT | IPC_EXCL | perms);
- if (mq->id < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x: %s", key, strerror(errno));
- efree(mq);
- RETURN_FALSE;
- }
- }
- RETVAL_RESOURCE(zend_list_insert(mq, le_sysvmsg));
-}
-/* }}} */
-
-/* {{{ proto bool msg_remove_queue(resource queue)
- Destroy the queue */
-PHP_FUNCTION(msg_remove_queue)
-{
- zval *queue;
- sysvmsg_queue_t *mq = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &queue) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(mq, sysvmsg_queue_t *, &queue, -1, "sysvmsg queue", le_sysvmsg);
-
- if (msgctl(mq->id, IPC_RMID, NULL) == 0) {
- RETVAL_TRUE;
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto mixed msg_receive(resource queue, long desiredmsgtype, long &msgtype, long maxsize, mixed message [, bool unserialize=true [, long flags=0 [, long errorcode]]])
- Send a message of type msgtype (must be > 0) to a message queue */
-PHP_FUNCTION(msg_receive)
-{
- zval *out_message, *queue, *out_msgtype, *zerrcode = NULL;
- long desiredmsgtype, maxsize, flags = 0;
- long realflags = 0;
- zend_bool do_unserialize = 1;
- sysvmsg_queue_t *mq = NULL;
- struct php_msgbuf *messagebuffer = NULL; /* buffer to transmit */
- int result;
-
- RETVAL_FALSE;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlzlz|blz",
- &queue, &desiredmsgtype, &out_msgtype, &maxsize,
- &out_message, &do_unserialize, &flags, &zerrcode) == FAILURE) {
- return;
- }
-
- if (flags != 0) {
- if (flags & PHP_MSG_EXCEPT) {
-#ifndef MSG_EXCEPT
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "MSG_EXCEPT is not supported on your system");
- RETURN_FALSE;
-#else
- realflags |= MSG_EXCEPT;
-#endif
- }
- if (flags & PHP_MSG_NOERROR) {
- realflags |= MSG_NOERROR;
- }
- if (flags & PHP_MSG_IPC_NOWAIT) {
- realflags |= IPC_NOWAIT;
- }
- }
-
- ZEND_FETCH_RESOURCE(mq, sysvmsg_queue_t *, &queue, -1, "sysvmsg queue", le_sysvmsg);
-
- messagebuffer = (struct php_msgbuf *) emalloc(sizeof(struct php_msgbuf) + maxsize);
-
- result = msgrcv(mq->id, messagebuffer, maxsize, desiredmsgtype, realflags);
-
- zval_dtor(out_msgtype);
- zval_dtor(out_message);
- ZVAL_LONG(out_msgtype, 0);
- ZVAL_FALSE(out_message);
-
- if (zerrcode) {
- zval_dtor(zerrcode);
- ZVAL_LONG(zerrcode, 0);
- }
-
- if (result >= 0) {
- /* got it! */
- ZVAL_LONG(out_msgtype, messagebuffer->mtype);
-
- if (do_unserialize) {
- php_unserialize_data_t var_hash;
- zval *tmp = NULL;
- const char *p = (const char *) messagebuffer->mtext;
-
- MAKE_STD_ZVAL(tmp);
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&tmp, &p, p + result, &var_hash TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "message corrupted");
- RETVAL_FALSE;
- }
- REPLACE_ZVAL_VALUE(&out_message, tmp, 0);
- FREE_ZVAL(tmp);
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- } else {
- ZVAL_STRINGL(out_message, messagebuffer->mtext, result, 1);
- }
- RETVAL_TRUE;
- } else if (zerrcode) {
- ZVAL_LONG(zerrcode, errno);
- }
- efree(messagebuffer);
-}
-/* }}} */
-
-/* {{{ proto bool msg_send(resource queue, long msgtype, mixed message [, bool serialize=true [, bool blocking=true [, long errorcode]]])
- Send a message of type msgtype (must be > 0) to a message queue */
-PHP_FUNCTION(msg_send)
-{
- zval *message, *queue, *zerror=NULL;
- long msgtype;
- zend_bool do_serialize = 1, blocking = 1;
- sysvmsg_queue_t * mq = NULL;
- struct php_msgbuf * messagebuffer = NULL; /* buffer to transmit */
- int result;
- int message_len = 0;
-
- RETVAL_FALSE;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz|bbz",
- &queue, &msgtype, &message, &do_serialize, &blocking, &zerror) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(mq, sysvmsg_queue_t*, &queue, -1, "sysvmsg queue", le_sysvmsg);
-
- if (do_serialize) {
- smart_str msg_var = {0};
- php_serialize_data_t var_hash;
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&msg_var, &message, &var_hash TSRMLS_CC);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- /* NB: php_msgbuf is 1 char bigger than a long, so there is no need to
- * allocate the extra byte. */
- messagebuffer = emalloc(sizeof(struct php_msgbuf) + msg_var.len);
- memcpy(messagebuffer->mtext, msg_var.c, msg_var.len + 1);
- message_len = msg_var.len;
- smart_str_free(&msg_var);
- } else {
- convert_to_string_ex(&message);
- messagebuffer = emalloc(sizeof(struct php_msgbuf) + Z_STRLEN_P(message));
- memcpy(messagebuffer->mtext, Z_STRVAL_P(message), Z_STRLEN_P(message) + 1);
- message_len = Z_STRLEN_P(message);
- }
-
- /* set the message type */
- messagebuffer->mtype = msgtype;
-
- result = msgsnd(mq->id, messagebuffer, message_len, blocking ? 0 : IPC_NOWAIT);
-
- efree(messagebuffer);
-
- if (result == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "msgsnd failed: %s", strerror(errno));
- if (zerror) {
- ZVAL_LONG(zerror, errno);
- }
- } else {
- RETVAL_TRUE;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 tw=78 fdm=marker
- * vim<600: noet sw=4 ts=4 tw=78
- */
diff --git a/ext/sysvmsg/tests/001.phpt b/ext/sysvmsg/tests/001.phpt
deleted file mode 100644
index bc1691316b..0000000000
--- a/ext/sysvmsg/tests/001.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-send/receive serialized message.
---SKIPIF--
-<?php // vim600:syn=php
-if (!extension_loaded("sysvmsg")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-$key = ftok("./ext/sysvmsg/tests/001.phpt", "p");
-$q = msg_get_queue($key);
-msg_send($q, 1, "hello") or print "FAIL\n";
-$type = null;
-if (msg_receive($q, 0, $type, 1024, $message)) {
- echo "TYPE: $type\n";
- echo "DATA: $message\n";
-}
-if (!msg_remove_queue($q)) {
- echo "BAD: queue removal failed\n";
-}
-?>
---EXPECT--
-TYPE: 1
-DATA: hello
diff --git a/ext/sysvsem/CREDITS b/ext/sysvsem/CREDITS
deleted file mode 100644
index 45232809f0..0000000000
--- a/ext/sysvsem/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-System V Semaphores
-Tom May
diff --git a/ext/sysvsem/config.m4 b/ext/sysvsem/config.m4
deleted file mode 100644
index 0b635d6dde..0000000000
--- a/ext/sysvsem/config.m4
+++ /dev/null
@@ -1,29 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(sysvsem,whether to enable System V semaphore support,
-[ --enable-sysvsem Enable System V semaphore support.])
-
-if test "$PHP_SYSVSEM" != "no"; then
- PHP_NEW_EXTENSION(sysvsem, sysvsem.c, $ext_shared)
- AC_DEFINE(HAVE_SYSVSEM, 1, [ ])
- AC_CACHE_CHECK(for union semun,php_cv_semun,
- AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
- ],
- [union semun x;],
- [
- php_cv_semun=yes
- ],[
- php_cv_semun=no
- ])
- )
- if test "$php_cv_semun" = "yes"; then
- AC_DEFINE(HAVE_SEMUN, 1, [ ])
- else
- AC_DEFINE(HAVE_SEMUN, 0, [ ])
- fi
-fi
diff --git a/ext/sysvsem/php_sysvsem.h b/ext/sysvsem/php_sysvsem.h
deleted file mode 100644
index 66d1645900..0000000000
--- a/ext/sysvsem/php_sysvsem.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Tom May <tom@go2net.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SYSVSEM_H
-#define PHP_SYSVSEM_H
-
-#if HAVE_SYSVSEM
-
-extern zend_module_entry sysvsem_module_entry;
-#define sysvsem_module_ptr &sysvsem_module_entry
-
-PHP_MINIT_FUNCTION(sysvsem);
-PHP_FUNCTION(sem_get);
-PHP_FUNCTION(sem_acquire);
-PHP_FUNCTION(sem_release);
-PHP_FUNCTION(sem_remove);
-
-typedef struct {
- int le_sem;
-} sysvsem_module;
-
-typedef struct {
- int id; /* For error reporting. */
- int key; /* For error reporting. */
- int semid; /* Returned by semget(). */
- int count; /* Acquire count for auto-release. */
- int auto_release; /* flag that says to auto-release. */
-} sysvsem_sem;
-
-extern sysvsem_module php_sysvsem_module;
-
-#else
-
-#define sysvsem_module_ptr NULL
-
-#endif
-
-#define phpext_sysvsem_ptr sysvsem_module_ptr
-
-#endif /* PHP_SYSVSEM_H */
diff --git a/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c
deleted file mode 100644
index f849863f5a..0000000000
--- a/ext/sysvsem/sysvsem.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Tom May <tom@go2net.com> |
- | Gavin Sherry <gavin@linuxworld.com.au> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* Latest update build anc tested on Linux 2.2.14
- *
- * This has been built and tested on Solaris 2.6 and Linux 2.1.122.
- * It may not compile or execute correctly on other systems.
- *
- * sas: Works for me on Linux 2.0.36 and FreeBSD 3.0-current
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_SYSVSEM
-
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-#include <errno.h>
-
-#include "php_sysvsem.h"
-
-#if !HAVE_SEMUN
-
-union semun {
- int val; /* value for SETVAL */
- struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */
- unsigned short int *array; /* array for GETALL, SETALL */
- struct seminfo *__buf; /* buffer for IPC_INFO */
-};
-
-#undef HAVE_SEMUN
-#define HAVE_SEMUN 1
-
-#endif
-
-/* {{{ sysvsem_functions[]
- */
-function_entry sysvsem_functions[] = {
- PHP_FE(sem_get, NULL)
- PHP_FE(sem_acquire, NULL)
- PHP_FE(sem_release, NULL)
- PHP_FE(sem_remove, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ sysvsem_module_entry
- */
-zend_module_entry sysvsem_module_entry = {
- STANDARD_MODULE_HEADER,
- "sysvsem",
- sysvsem_functions,
- PHP_MINIT(sysvsem),
- NULL,
- NULL,
- NULL,
- NULL,
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_SYSVSEM
-ZEND_GET_MODULE(sysvsem)
-#endif
-
-
-THREAD_LS sysvsem_module php_sysvsem_module;
-
-/* Semaphore functions using System V semaphores. Each semaphore
- * actually consists of three semaphores allocated as a unit under the
- * same key. Semaphore 0 (SYSVSEM_SEM) is the actual semaphore, it is
- * initialized to max_acquire and decremented as processes acquire it.
- * The value of semaphore 1 (SYSVSEM_USAGE) is a count of the number
- * of processes using the semaphore. After calling semget(), if a
- * process finds that the usage count is 1, it will set the value of
- * SYSVSEM_SEM to max_acquire. This allows max_acquire to be set and
- * track the PHP code without having a global init routine or external
- * semaphore init code. Except see the bug regarding a race condition
- * php_sysvsem_get(). Semaphore 2 (SYSVSEM_SETVAL) serializes the
- * calls to GETVAL SYSVSEM_USAGE and SETVAL SYSVSEM_SEM. It can be
- * acquired only when it is zero.
- */
-
-#define SYSVSEM_SEM 0
-#define SYSVSEM_USAGE 1
-#define SYSVSEM_SETVAL 2
-
-/* {{{ release_sysvsem_sem
- */
-static void release_sysvsem_sem(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- sysvsem_sem *sem_ptr = (sysvsem_sem *)rsrc->ptr;
- struct sembuf sop[2];
- int opcount = 1;
-/*
- * if count == -1, semaphore has been removed
- * Need better way to handle this
- */
-
- if (sem_ptr->count == -1 || !sem_ptr->auto_release) {
- efree(sem_ptr);
- return;
- }
- /* Decrement the usage count. */
-
- sop[0].sem_num = SYSVSEM_USAGE;
- sop[0].sem_op = -1;
- sop[0].sem_flg = SEM_UNDO;
-
- /* Release the semaphore if it has been acquired but not released. */
-
- if (sem_ptr->count) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Releasing SysV semaphore id %d key 0x%x in request cleanup", sem_ptr->id, sem_ptr->key);
-
- sop[1].sem_num = SYSVSEM_SEM;
- sop[1].sem_op = sem_ptr->count;
- sop[1].sem_flg = SEM_UNDO;
-
- opcount++;
- }
- if (semop(sem_ptr->semid, sop, opcount) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed in release_sysvsem_sem for key 0x%x: %s", sem_ptr->key, strerror(errno));
- }
-
- efree(sem_ptr);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(sysvsem)
-{
- php_sysvsem_module.le_sem = zend_register_list_destructors_ex(release_sysvsem_sem, NULL, "sysvsem", module_number);
- return SUCCESS;
-}
-/* }}} */
-
-#define SETVAL_WANTS_PTR
-
-#if defined(_AIX)
-#undef SETVAL_WANTS_PTR
-#endif
-
-/* {{{ proto int sem_get(int key [, int max_acquire [, int perm [, int auto_release]])
- Return an id for the semaphore with the given key, and allow max_acquire (default 1) processes to acquire it simultaneously */
-PHP_FUNCTION(sem_get)
-{
- long key, max_acquire, perm, auto_release = 1;
- int semid;
- struct sembuf sop[3];
- int count;
- sysvsem_sem *sem_ptr;
-#if HAVE_SEMUN
- union semun un;
-#endif
-
- max_acquire = 1;
- perm = 0666;
-
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|lll", &key, &max_acquire, &perm, &auto_release)) {
- RETURN_FALSE;
- }
-
- /* Get/create the semaphore. Note that we rely on the semaphores
- * being zeroed when they are created. Despite the fact that
- * the(?) Linux semget() man page says they are not initialized,
- * the kernel versions 2.0.x and 2.1.z do in fact zero them.
- */
-
- semid = semget(key, 3, perm|IPC_CREAT);
- if (semid == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x: %s", key, strerror(errno));
- RETURN_FALSE;
- }
-
- /* Find out how many processes are using this semaphore. Note
- * that on Linux (at least) there is a race condition here because
- * semaphore undo on process exit is not atomic, so we could
- * acquire SYSVSEM_SETVAL before a crashed process has decremented
- * SYSVSEM_USAGE in which case count will be greater than it
- * should be and we won't set max_acquire. Fortunately this
- * doesn't actually matter in practice.
- */
-
- /* Wait for sem 1 to be zero . . . */
-
- sop[0].sem_num = SYSVSEM_SETVAL;
- sop[0].sem_op = 0;
- sop[0].sem_flg = 0;
-
- /* . . . and increment it so it becomes non-zero . . . */
-
- sop[1].sem_num = SYSVSEM_SETVAL;
- sop[1].sem_op = 1;
- sop[1].sem_flg = SEM_UNDO;
-
- /* . . . and increment the usage count. */
-
- sop[2].sem_num = SYSVSEM_USAGE;
- sop[2].sem_op = 1;
- sop[2].sem_flg = SEM_UNDO;
- while (semop(semid, sop, 3) == -1) {
- if (errno != EINTR) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed acquiring SYSVSEM_SETVAL for key 0x%x: %s", key, strerror(errno));
- break;
- }
- }
-
- /* Get the usage count. */
-#if HAVE_SEMUN
- count = semctl(semid, SYSVSEM_USAGE, GETVAL, un);
-#else
- count = semctl(semid, SYSVSEM_USAGE, GETVAL, NULL);
-#endif
- if (count == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x: %s", key, strerror(errno));
- }
-
- /* If we are the only user, then take this opportunity to set the max. */
-
- if (count == 1) {
-#if HAVE_SEMUN
- /* This is correct for Linux which has union semun. */
- union semun semarg;
- semarg.val = max_acquire;
- if (semctl(semid, SYSVSEM_SEM, SETVAL, semarg) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x: %s", key, strerror(errno));
- }
-#elif defined(SETVAL_WANTS_PTR)
- /* This is correct for Solaris 2.6 which does not have union semun. */
- if (semctl(semid, SYSVSEM_SEM, SETVAL, &max_acquire) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x: %s", key, strerror(errno));
- }
-#else
- /* This works for i.e. AIX */
- if (semctl(semid, SYSVSEM_SEM, SETVAL, max_acquire) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x: %s", key, strerror(errno));
- }
-#endif
- }
-
- /* Set semaphore 1 back to zero. */
-
- sop[0].sem_num = SYSVSEM_SETVAL;
- sop[0].sem_op = -1;
- sop[0].sem_flg = SEM_UNDO;
- while (semop(semid, sop, 1) == -1) {
- if (errno != EINTR) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed releasing SYSVSEM_SETVAL for key 0x%x: %s", key, strerror(errno));
- break;
- }
- }
-
- sem_ptr = (sysvsem_sem *) emalloc(sizeof(sysvsem_sem));
- sem_ptr->key = key;
- sem_ptr->semid = semid;
- sem_ptr->count = 0;
- sem_ptr->auto_release = auto_release;
-
- sem_ptr->id = ZEND_REGISTER_RESOURCE(return_value, sem_ptr, php_sysvsem_module.le_sem);
-}
-/* }}} */
-
-/* {{{ php_sysvsem_semop
- */
-static void php_sysvsem_semop(INTERNAL_FUNCTION_PARAMETERS, int acquire)
-{
- zval **arg_id;
- sysvsem_sem *sem_ptr;
- struct sembuf sop;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &arg_id)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(sem_ptr, sysvsem_sem *, arg_id, -1, "SysV semphore", php_sysvsem_module.le_sem);
-
- if (!acquire && sem_ptr->count == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %d (key 0x%x) is not currently acquired", Z_LVAL_PP(arg_id), sem_ptr->key);
- RETURN_FALSE;
- }
-
- sop.sem_num = SYSVSEM_SEM;
- sop.sem_op = acquire ? -1 : 1;
- sop.sem_flg = SEM_UNDO;
-
- while (semop(sem_ptr->semid, &sop, 1) == -1) {
- if (errno != EINTR) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x: %s", acquire ? "acquire" : "release", sem_ptr->key, strerror(errno));
- RETURN_FALSE;
- }
- }
-
- sem_ptr->count -= acquire ? -1 : 1;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int sem_acquire(int id)
- Acquires the semaphore with the given id, blocking if necessary */
-PHP_FUNCTION(sem_acquire)
-{
- php_sysvsem_semop(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int sem_release(int id)
- Releases the semaphore with the given id */
-PHP_FUNCTION(sem_release)
-{
- php_sysvsem_semop(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int sem_remove(int id)
- Removes semaphore from Unix systems */
-
-/*
- * contributed by Gavin Sherry gavin@linuxworld.com.au
- * Fri Mar 16 00:50:13 EST 2001
- */
-
-PHP_FUNCTION(sem_remove)
-{
- zval **arg_id;
- sysvsem_sem *sem_ptr;
-#if HAVE_SEMUN
- union semun un;
- struct semid_ds buf;
-#endif
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(sem_ptr, sysvsem_sem *, arg_id, -1, "SysV semphore", php_sysvsem_module.le_sem);
-
-#if HAVE_SEMUN
- un.buf = &buf;
- if (semctl(sem_ptr->semid, 0, IPC_STAT, un) < 0) {
-#else
- if (semctl(sem_ptr->semid, 0, IPC_STAT, NULL) < 0) {
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semphore %d does not (any longer) exist", Z_LVAL_PP(arg_id));
- RETURN_FALSE;
- }
-
-#if HAVE_SEMUN
- if (semctl(sem_ptr->semid, 0, IPC_RMID, un) < 0) {
-#else
- if (semctl(sem_ptr->semid, 0, IPC_RMID, NULL) < 0) {
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for SysV sempphore %d: %s", Z_LVAL_PP(arg_id), strerror(errno));
- RETURN_FALSE;
- }
-
- /* let release_sysvsem_sem know we have removed
- * the semaphore to avoid issues with releasing.
- */
-
- sem_ptr->count = -1;
- RETURN_TRUE;
-}
-
-/* }}} */
-
-#endif /* HAVE_SYSVSEM */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/sysvsem/tests/sysv.phpt b/ext/sysvsem/tests/sysv.phpt
deleted file mode 100644
index f7d95f7f48..0000000000
--- a/ext/sysvsem/tests/sysv.phpt
+++ /dev/null
@@ -1,114 +0,0 @@
---TEST--
-General semaphore and shared memory test
---SKIPIF--
-<?php // vim600: ts=4 sw=4 syn=php fdm=marker
-if(!extension_loaded('sysvsem') || !extension_loaded('sysvshm')) {
- die("skip Both sysvsem and sysvshm required");
-}
-?>
---INI--
-magic_quotes_runtime=0
---FILE--
-<?php
-$MEMSIZE = 512; // size of shared memory to allocate
-$SEMKEY = 1; // Semaphore key
-$SHMKEY = 2; // Shared memory key
-
-echo "Start.\n";
-// Get semaphore
-$sem_id = sem_get($SEMKEY, 1);
-if ($sem_id === FALSE) {
- echo "Fail to get semaphore";
- exit;
-}
-echo "Got semaphore $sem_id.\n";
-
-// Accuire semaphore
-if (! sem_acquire($sem_id)) {
- echo "Fail to aquire semaphore $sem_id.\n";
- sem_remove($sem_id);
- exit;
-}
-echo "Success aquire semaphore $sem_id.\n";
-
-$shm_id = shm_attach($SHMKEY, $MEMSIZE);
-if ($shm_id === FALSE) {
- echo "Fail to attach shared memory.\n";
- sem_remove($sem_id);
- exit;
-}
-echo "Success to attach shared memory : $shm_id.\n";
-
-// Write variable 1
-if (!shm_put_var($shm_id, 1, "Variable 1")) {
- echo "Fail to put var 1 on shared memory $shm_id.\n";
- sem_remove($sem_id);
- shm_remove ($shm_id);
- exit;
-}
-echo "Write var1 to shared memory.\n";
-
-// Write variable 2
-if (!shm_put_var($shm_id, 2, "Variable 2")) {
- echo "Fail to put var 2 on shared memory $shm_id.\n";
- sem_remove($sem_id);
- shm_remove ($shm_id);
- exit;
-}
-echo "Write var2 to shared memory.\n";
-
-// Read variable 1
-$var1 = shm_get_var ($shm_id, 1);
-if ($var1 === FALSE) {
- echo "Fail to retrieve Var 1 from Shared memory $shm_id, return value=$var1.\n";
-} else {
- echo "Read var1=$var1.\n";
-}
-
-// Read variable 1
-$var2 = shm_get_var ($shm_id, 2);
-if ($var1 === FALSE) {
- echo "Fail to retrieve Var 2 from Shared memory $shm_id, return value=$var2.\n";
-} else {
- echo "Read var2=$var2.\n";
-}
-// Release semaphore
-if (!sem_release($sem_id)) {
- echo "Fail to release $sem_id semaphore.\n";
-} else {
- echo "Semaphore $sem_id released.\n";
-}
-
-// remove shared memory segmant from SysV
-if (shm_remove ($shm_id)) {
- echo "Shared memory successfully removed from SysV.\n";
-} else {
- echo "Fail to remove $shm_id shared memory from SysV.\n";
-}
-
-// Remove semaphore
-if (sem_remove($sem_id)) {
- echo "semaphore removed successfully from SysV.\n";
-} else {
- echo "Fail to remove $sem_id semaphore from SysV.\n";
-}
-echo "End.\n";
-/* NOTE: assigned semids differ depending on the kernel, since
- * there are actually 3 semaphores per PHP-created
- * semaphores in effect, to keep state information.
- * That's the reason for EXPECTF.
- */
-?>
---EXPECTF--
-Start.
-Got semaphore Resource id #%i.
-Success aquire semaphore Resource id #%i.
-Success to attach shared memory : %i.
-Write var1 to shared memory.
-Write var2 to shared memory.
-Read var1=Variable 1.
-Read var2=Variable 2.
-Semaphore Resource id #%i released.
-Shared memory successfully removed from SysV.
-semaphore removed successfully from SysV.
-End.
diff --git a/ext/sysvshm/CREDITS b/ext/sysvshm/CREDITS
deleted file mode 100644
index 65a30ceb0c..0000000000
--- a/ext/sysvshm/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-System V Shared Memory
-Christian Cartus
diff --git a/ext/sysvshm/config.m4 b/ext/sysvshm/config.m4
deleted file mode 100644
index 671d050463..0000000000
--- a/ext/sysvshm/config.m4
+++ /dev/null
@@ -1,11 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(sysvshm,whether to enable System V shared memory support,
-[ --enable-sysvshm Enable the System V shared memory support.])
-
-if test "$PHP_SYSVSHM" != "no"; then
- AC_DEFINE(HAVE_SYSVSHM, 1, [ ])
- PHP_NEW_EXTENSION(sysvshm, sysvshm.c, $ext_shared)
-fi
diff --git a/ext/sysvshm/php_sysvshm.h b/ext/sysvshm/php_sysvshm.h
deleted file mode 100644
index 6399eb0cc9..0000000000
--- a/ext/sysvshm/php_sysvshm.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Christian Cartus <cartus@atrior.de> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SYSVSHM_H
-#define PHP_SYSVSHM_H
-
-#if HAVE_SYSVSHM
-
-extern zend_module_entry sysvshm_module_entry;
-#define sysvshm_module_ptr &sysvshm_module_entry
-
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
-typedef struct {
- int le_shm;
- long init_mem;
-} sysvshm_module;
-
-typedef struct {
- long key;
- long length;
- long next;
- char mem;
-} sysvshm_chunk;
-
-typedef struct {
- char magic[8];
- long start;
- long end;
- long free;
- long total;
-} sysvshm_chunk_head;
-
-typedef struct {
- key_t key; /* Key set by user */
- long id; /* Returned by shmget. */
- sysvshm_chunk_head *ptr; /* memoryaddress of shared memory */
-} sysvshm_shm;
-
-PHP_MINIT_FUNCTION(sysvshm);
-PHP_FUNCTION(shm_attach);
-PHP_FUNCTION(shm_detach);
-PHP_FUNCTION(shm_remove);
-PHP_FUNCTION(shm_put_var);
-PHP_FUNCTION(shm_get_var);
-PHP_FUNCTION(shm_remove_var);
-
-static int php_put_shm_data(sysvshm_chunk_head *ptr,long key,char *data, long len);
-static long php_check_shm_data(sysvshm_chunk_head *ptr, long key);
-static int php_remove_shm_data(sysvshm_chunk_head *ptr, long shm_varpos);
-
-extern sysvshm_module php_sysvshm;
-
-#else
-
-#define sysvshm_module_ptr NULL
-
-#endif
-
-#define phpext_sysvshm_ptr sysvshm_module_ptr
-
-#endif /* PHP_SYSVSHM_H */
diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c
deleted file mode 100644
index 02238407b5..0000000000
--- a/ext/sysvshm/sysvshm.c
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Christian Cartus <cartus@atrior.de> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* This has been built and tested on Linux 2.2.14
- *
- * This has been built and tested on Solaris 2.6.
- * It may not compile or execute correctly on other systems.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_SYSVSHM
-
-#include <errno.h>
-
-#include "php_sysvshm.h"
-#include "ext/standard/php_var.h"
-#include "ext/standard/php_smart_str.h"
-
-/* {{{ sysvshm_functions[]
- */
-function_entry sysvshm_functions[] = {
- PHP_FE(shm_attach, NULL)
- PHP_FE(shm_remove, NULL)
- PHP_FE(shm_detach, NULL)
- PHP_FE(shm_put_var, NULL)
- PHP_FE(shm_get_var, NULL)
- PHP_FE(shm_remove_var, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ sysvshm_module_entry
- */
-zend_module_entry sysvshm_module_entry = {
- STANDARD_MODULE_HEADER,
- "sysvshm",
- sysvshm_functions,
- PHP_MINIT(sysvshm),
- NULL,
- NULL,
- NULL,
- NULL,
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_SYSVSHM
-ZEND_GET_MODULE(sysvshm)
-#endif
-
-#undef shm_ptr /* undefine AIX-specific macro */
-
-THREAD_LS sysvshm_module php_sysvshm;
-
-/* {{{ php_release_sysvshm
- */
-static void php_release_sysvshm(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- sysvshm_shm *shm_ptr = (sysvshm_shm *) rsrc->ptr;
- shmdt((void *) shm_ptr->ptr);
- efree(shm_ptr);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(sysvshm)
-{
- php_sysvshm.le_shm = zend_register_list_destructors_ex(php_release_sysvshm, NULL, "sysvshm", module_number);
-
- if (cfg_get_long("sysvshm.init_mem", &php_sysvshm.init_mem) == FAILURE) {
- php_sysvshm.init_mem=10000;
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto int shm_attach(int key [, int memsize [, int perm]])
- Creates or open a shared memory segment */
-PHP_FUNCTION(shm_attach)
-{
- zval **arg_key, **arg_size, **arg_flag;
- long shm_size, shm_flag;
- sysvshm_shm *shm_list_ptr;
- char *shm_ptr;
- sysvshm_chunk_head *chunk_ptr;
- key_t shm_key = (key_t) 0;
- long shm_id, list_id;
- int ac = ZEND_NUM_ARGS();
-
- shm_flag = 0666;
- shm_size = php_sysvshm.init_mem;
-
- if (ac < 1 || ac > 3 || zend_get_parameters_ex(ac, &arg_key, &arg_size, &arg_flag) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (ac) {
- case 3:
- convert_to_long_ex(arg_flag);
- shm_flag = Z_LVAL_PP(arg_flag);
- case 2:
- convert_to_long_ex(arg_size);
- shm_size= Z_LVAL_PP(arg_size);
- case 1:
- convert_to_long_ex(arg_key);
- shm_key = Z_LVAL_PP(arg_key);
- }
-
- if ((shm_list_ptr = (sysvshm_shm *) emalloc(sizeof(sysvshm_shm))) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x: cannot allocate internal listelement", shm_key);
- RETURN_FALSE;
- }
-
- /* get the id from a specified key or create new shared memory */
- if ((shm_id = shmget(shm_key, 0, 0)) < 0) {
- if (shm_size < sizeof(sysvshm_chunk_head)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x: memorysize too small", shm_key);
- RETURN_FALSE;
- }
- if ((shm_id = shmget(shm_key, shm_size, shm_flag | IPC_CREAT | IPC_EXCL)) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x: %s", shm_key, strerror(errno));
- RETURN_FALSE;
- }
- }
-
- if ((shm_ptr = shmat(shm_id, NULL, 0)) == (void *) - 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x: %s", shm_key, strerror(errno));
- RETURN_FALSE;
- }
-
- /* check if shm is already initialized */
- chunk_ptr = (sysvshm_chunk_head *) shm_ptr;
- if (strcmp((char*) &(chunk_ptr->magic), "PHP_SM") != 0) {
- strcpy((char*) &(chunk_ptr->magic), "PHP_SM");
- chunk_ptr->start = sizeof(sysvshm_chunk_head);
- chunk_ptr->end = chunk_ptr->start;
- chunk_ptr->total = shm_size;
- chunk_ptr->free = shm_size-chunk_ptr->end;
- }
-
- shm_list_ptr->key = shm_key;
- shm_list_ptr->id = shm_id;
- shm_list_ptr->ptr = chunk_ptr;
- list_id = zend_list_insert(shm_list_ptr, php_sysvshm.le_shm);
- RETURN_LONG(list_id);
-}
-/* }}} */
-
-/* {{{ proto int shm_detach(int shm_identifier)
- Disconnects from shared memory segment */
-PHP_FUNCTION(shm_detach)
-{
- zval **arg_id;
- long id;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg_id);
- id = Z_LVAL_PP(arg_id);
- zend_list_delete(id);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int shm_remove(int shm_identifier)
- Removes shared memory from Unix systems */
-PHP_FUNCTION(shm_remove)
-{
- zval **arg_id;
- long id;
- int type;
- sysvshm_shm *shm_list_ptr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg_id);
- id = Z_LVAL_PP(arg_id);
- shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type);
-
- if (!shm_list_ptr) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The parameter is not a valid shm_indentifier");
- RETURN_FALSE;
- }
-
- if (shmctl(shm_list_ptr->id, IPC_RMID,NULL) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x, id %i: %s", shm_list_ptr->key, id, strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int shm_put_var(int shm_identifier, int variable_key, mixed variable)
- Inserts or updates a variable in shared memory */
-PHP_FUNCTION(shm_put_var)
-{
- zval **arg_id, **arg_key, **arg_var;
- long key, id;
- sysvshm_shm *shm_list_ptr;
- int type;
- smart_str shm_var = {0};
- int ret;
- php_serialize_data_t var_hash;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg_id, &arg_key, &arg_var) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg_id);
- id = Z_LVAL_PP(arg_id);
- convert_to_long_ex(arg_key);
- key = Z_LVAL_PP(arg_key);
-
- shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type);
- if (type != php_sysvshm.le_shm) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a SysV shared memory index", id);
- RETURN_FALSE;
- }
-
- /* setup string-variable and serialize */
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&shm_var, arg_var, &var_hash TSRMLS_CC);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
- /* insert serialized variable into shared memory */
- ret = php_put_shm_data(shm_list_ptr->ptr, key, shm_var.c, shm_var.len);
-
- /* free string */
- smart_str_free(&shm_var);
-
- if (ret == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "not enough shared memory left");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto mixed shm_get_var(int id, int variable_key)
- Returns a variable from shared memory */
-PHP_FUNCTION(shm_get_var)
-{
- zval **arg_id, **arg_key;
- long key, id;
- sysvshm_shm *shm_list_ptr;
- int type;
- char *shm_data;
- long shm_varpos;
- sysvshm_chunk *shm_var;
- php_unserialize_data_t var_hash;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg_id, &arg_key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg_id);
- id = Z_LVAL_PP(arg_id);
- convert_to_long_ex(arg_key);
- key = Z_LVAL_PP(arg_key);
-
- shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type);
- if (type != php_sysvshm.le_shm) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a SysV shared memory index", id);
- RETURN_FALSE;
- }
-
- /* setup string-variable and serialize */
- /* get serialized variable from shared memory */
- shm_varpos = php_check_shm_data((shm_list_ptr->ptr), key);
-
- if (shm_varpos < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "variable key %d doesn't exist", key);
- RETURN_FALSE;
- }
- shm_var = (sysvshm_chunk*) ((char *)shm_list_ptr->ptr + shm_varpos);
- shm_data = &shm_var->mem;
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (php_var_unserialize(&return_value, (const char **) &shm_data, shm_data + shm_var->length, &var_hash TSRMLS_CC) != 1) {
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "variable data in shared memory is corruped");
- RETURN_FALSE;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-}
-/* }}} */
-
-/* {{{ proto int shm_remove_var(int id, int variable_key)
- Removes variable from shared memory */
-PHP_FUNCTION(shm_remove_var)
-{
- zval **arg_id, **arg_key;
- long key, id;
- sysvshm_shm *shm_list_ptr;
- int type;
- long shm_varpos;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg_id, &arg_key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg_id);
- id = Z_LVAL_PP(arg_id);
- convert_to_long_ex(arg_key);
- key = Z_LVAL_PP(arg_key);
-
- shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type);
- if (type != php_sysvshm.le_shm) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a SysV shared memory index", id);
- RETURN_FALSE;
- }
-
- shm_varpos = php_check_shm_data((shm_list_ptr->ptr), key);
-
- if (shm_varpos < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "variable key %d doesn't exist", key);
- RETURN_FALSE;
- }
- php_remove_shm_data((shm_list_ptr->ptr), shm_varpos);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ php_put_shm_data
- * inserts an ascii-string into shared memory */
-static int php_put_shm_data(sysvshm_chunk_head *ptr, long key, char *data, long len)
-{
- sysvshm_chunk *shm_var;
- long total_size;
- long shm_varpos;
-
- total_size = ((long) (len + sizeof(sysvshm_chunk) - 1) / 4) * 4 + 4; /* 4-byte alligment */
-
- if ((shm_varpos = php_check_shm_data(ptr, key)) > 0) {
- php_remove_shm_data(ptr, shm_varpos);
- }
-
- if (ptr->free < total_size) {
- return -1; /* not enough memeory */
- }
-
- shm_var = (sysvshm_chunk *) ((char *) ptr + ptr->end);
- shm_var->key = key;
- shm_var->length = len;
- shm_var->next = total_size;
- memcpy(&(shm_var->mem), data, len);
- ptr->end += total_size;
- ptr->free -= total_size;
- return 0;
-}
-/* }}} */
-
-/* {{{ php_check_shm_data
- */
-static long php_check_shm_data(sysvshm_chunk_head *ptr, long key)
-{
- long pos;
- sysvshm_chunk *shm_var;
-
- pos = ptr->start;
-
- for (;;) {
- if (pos >= ptr->end) {
- return -1;
- }
- shm_var = (sysvshm_chunk*) ((char *) ptr + pos);
- if (shm_var->key == key) {
- return pos;
- }
- pos += shm_var->next;
- }
- return -1;
-}
-/* }}} */
-
-/* {{{ php_remove_shm_data
- */
-static int php_remove_shm_data(sysvshm_chunk_head *ptr, long shm_varpos)
-{
- sysvshm_chunk *chunk_ptr, *next_chunk_ptr;
- long memcpy_len;
-
- chunk_ptr = (sysvshm_chunk *) ((char *) ptr + shm_varpos);
- next_chunk_ptr = (sysvshm_chunk *) ((char *) ptr + shm_varpos + chunk_ptr->next);
-
- memcpy_len = ptr->end-shm_varpos - chunk_ptr->next;
- ptr->free += chunk_ptr->next;
- ptr->end -= chunk_ptr->next;
- if (memcpy_len > 0) {
- memcpy(chunk_ptr, next_chunk_ptr, memcpy_len);
- }
- return 0;
-}
-/* }}} */
-
-#endif /* HAVE_SYSVSHM */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/tokenizer/CREDITS b/ext/tokenizer/CREDITS
deleted file mode 100644
index c2879dd4ee..0000000000
--- a/ext/tokenizer/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-tokenizer
-Andrei Zmievski
diff --git a/ext/tokenizer/Makefile.frag b/ext/tokenizer/Makefile.frag
deleted file mode 100644
index a612d6819f..0000000000
--- a/ext/tokenizer/Makefile.frag
+++ /dev/null
@@ -1 +0,0 @@
-$(builddir)/tokenizer.lo: Zend/zend_language_parser.h
diff --git a/ext/tokenizer/config.m4 b/ext/tokenizer/config.m4
deleted file mode 100644
index eed403626e..0000000000
--- a/ext/tokenizer/config.m4
+++ /dev/null
@@ -1,12 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension tokenizer
-
-dnl Otherwise use enable:
-
-PHP_ARG_ENABLE(tokenizer, whether to enable tokenizer support,
-[ --disable-tokenizer Disable tokenizer support], yes)
-
-if test "$PHP_TOKENIZER" != "no"; then
- PHP_NEW_EXTENSION(tokenizer, tokenizer.c, $ext_shared)
- PHP_ADD_MAKEFILE_FRAGMENT
-fi
diff --git a/ext/tokenizer/php_tokenizer.h b/ext/tokenizer/php_tokenizer.h
deleted file mode 100644
index 0f3952d98b..0000000000
--- a/ext/tokenizer/php_tokenizer.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Andrei Zmievski <andrei@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_TOKENIZER_H
-#define PHP_TOKENIZER_H
-
-extern zend_module_entry tokenizer_module_entry;
-#define phpext_tokenizer_ptr &tokenizer_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_TOKENIZER_API __declspec(dllexport)
-#else
-#define PHP_TOKENIZER_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-PHP_MINIT_FUNCTION(tokenizer);
-PHP_MSHUTDOWN_FUNCTION(tokenizer);
-PHP_RINIT_FUNCTION(tokenizer);
-PHP_RSHUTDOWN_FUNCTION(tokenizer);
-PHP_MINFO_FUNCTION(tokenizer);
-
-PHP_FUNCTION(confirm_tokenizer_compiled); /* For testing, remove later. */
-PHP_FUNCTION(token_get_all);
-PHP_FUNCTION(token_name);
-
-#ifdef ZTS
-#define TOKENIZER_G(v) TSRMG(tokenizer_globals_id, zend_tokenizer_globals *, v)
-#else
-#define TOKENIZER_G(v) (tokenizer_globals.v)
-#endif
-
-#endif /* PHP_TOKENIZER_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c
deleted file mode 100644
index b5cb9d5f63..0000000000
--- a/ext/tokenizer/tokenizer.c
+++ /dev/null
@@ -1,552 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Andrei Zmievski <andrei@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_tokenizer.h"
-
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-typedef unsigned int yy_size_t;
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
- };
-
-#include "zend.h"
-#include "zend_language_scanner.h"
-#include "zend_language_parser.h"
-
-#define zendtext LANG_SCNG(yy_text)
-#define zendleng LANG_SCNG(yy_leng)
-/* If you declare any globals in php_tokenizer.h uncomment this:
-ZEND_DECLARE_MODULE_GLOBALS(tokenizer)
-*/
-
-/* True global resources - no need for thread safety here */
-/* static int le_tokenizer; */
-
-/* {{{ tokenizer_functions[]
- *
- * Every user visible function must have an entry in tokenizer_functions[].
- */
-function_entry tokenizer_functions[] = {
- PHP_FE(token_get_all, NULL)
- PHP_FE(token_name, NULL)
- {NULL, NULL, NULL} /* Must be the last line in tokenizer_functions[] */
-};
-/* }}} */
-
-/* {{{ tokenizer_module_entry
- */
-zend_module_entry tokenizer_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
- "tokenizer",
- tokenizer_functions,
- PHP_MINIT(tokenizer),
- PHP_MSHUTDOWN(tokenizer),
- PHP_RINIT(tokenizer), /* Replace with NULL if there's nothing to do at request start */
- PHP_RSHUTDOWN(tokenizer), /* Replace with NULL if there's nothing to do at request end */
- PHP_MINFO(tokenizer),
-#if ZEND_MODULE_API_NO >= 20010901
- "0.1", /* Replace with version number for your extension */
-#endif
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_TOKENIZER
-ZEND_GET_MODULE(tokenizer)
-#endif
-
-/* {{{ PHP_INI
- */
-/* Remove comments and fill if you need to have entries in php.ini
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("tokenizer.global_value", "42", PHP_INI_ALL, OnUpdateLong, global_value, zend_tokenizer_globals, tokenizer_globals)
- STD_PHP_INI_ENTRY("tokenizer.global_string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_tokenizer_globals, tokenizer_globals)
-PHP_INI_END()
-*/
-/* }}} */
-
-/* {{{ php_tokenizer_init_globals
- */
-/* Uncomment this function if you have INI entries
-static void php_tokenizer_init_globals(zend_tokenizer_globals *tokenizer_globals)
-{
- tokenizer_globals->global_value = 0;
- tokenizer_globals->global_string = NULL;
-}
-*/
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(tokenizer)
-{
- /* If you have INI entries, uncomment these lines
- ZEND_INIT_MODULE_GLOBALS(tokenizer, php_tokenizer_init_globals, NULL);
- REGISTER_INI_ENTRIES();
- */
-
- REGISTER_LONG_CONSTANT("T_INCLUDE", T_INCLUDE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_INCLUDE_ONCE", T_INCLUDE_ONCE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_EVAL", T_EVAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_REQUIRE", T_REQUIRE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_REQUIRE_ONCE", T_REQUIRE_ONCE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_LOGICAL_OR", T_LOGICAL_OR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_LOGICAL_XOR", T_LOGICAL_XOR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_LOGICAL_AND", T_LOGICAL_AND, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_PRINT", T_PRINT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_PLUS_EQUAL", T_PLUS_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_MINUS_EQUAL", T_MINUS_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_MUL_EQUAL", T_MUL_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_DIV_EQUAL", T_DIV_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_CONCAT_EQUAL", T_CONCAT_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_MOD_EQUAL", T_MOD_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_AND_EQUAL", T_AND_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_OR_EQUAL", T_OR_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_XOR_EQUAL", T_XOR_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_SL_EQUAL", T_SL_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_SR_EQUAL", T_SR_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_BOOLEAN_OR", T_BOOLEAN_OR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_BOOLEAN_AND", T_BOOLEAN_AND, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_IS_EQUAL", T_IS_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_IS_NOT_EQUAL", T_IS_NOT_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_IS_IDENTICAL", T_IS_IDENTICAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_IS_NOT_IDENTICAL", T_IS_NOT_IDENTICAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_IS_SMALLER_OR_EQUAL", T_IS_SMALLER_OR_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_IS_GREATER_OR_EQUAL", T_IS_GREATER_OR_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_SL", T_SL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_SR", T_SR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_INC", T_INC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_DEC", T_DEC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_INT_CAST", T_INT_CAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_DOUBLE_CAST", T_DOUBLE_CAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_STRING_CAST", T_STRING_CAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_ARRAY_CAST", T_ARRAY_CAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_OBJECT_CAST", T_OBJECT_CAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_BOOL_CAST", T_BOOL_CAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_UNSET_CAST", T_UNSET_CAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_NEW", T_NEW, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_EXIT", T_EXIT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_IF", T_IF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_ELSEIF", T_ELSEIF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_ELSE", T_ELSE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_ENDIF", T_ENDIF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_LNUMBER", T_LNUMBER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_DNUMBER", T_DNUMBER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_STRING", T_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_STRING_VARNAME", T_STRING_VARNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_VARIABLE", T_VARIABLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_NUM_STRING", T_NUM_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_INLINE_HTML", T_INLINE_HTML, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_CHARACTER", T_CHARACTER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_BAD_CHARACTER", T_BAD_CHARACTER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_ENCAPSED_AND_WHITESPACE", T_ENCAPSED_AND_WHITESPACE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_CONSTANT_ENCAPSED_STRING", T_CONSTANT_ENCAPSED_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_ECHO", T_ECHO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_DO", T_DO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_WHILE", T_WHILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_ENDWHILE", T_ENDWHILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_FOR", T_FOR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_ENDFOR", T_ENDFOR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_FOREACH", T_FOREACH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_ENDFOREACH", T_ENDFOREACH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_DECLARE", T_DECLARE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_ENDDECLARE", T_ENDDECLARE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_AS", T_AS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_SWITCH", T_SWITCH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_ENDSWITCH", T_ENDSWITCH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_CASE", T_CASE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_DEFAULT", T_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_BREAK", T_BREAK, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_CONTINUE", T_CONTINUE, CONST_CS | CONST_PERSISTENT);
-#ifndef ZEND_ENGINE_2
- REGISTER_LONG_CONSTANT("T_OLD_FUNCTION", T_OLD_FUNCTION, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_LONG_CONSTANT("T_FUNCTION", T_FUNCTION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_CONST", T_CONST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_RETURN", T_RETURN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_USE", T_USE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_GLOBAL", T_GLOBAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_STATIC", T_STATIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_VAR", T_VAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_UNSET", T_UNSET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_ISSET", T_ISSET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_EMPTY", T_EMPTY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_CLASS", T_CLASS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_EXTENDS", T_EXTENDS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_OBJECT_OPERATOR", T_OBJECT_OPERATOR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_DOUBLE_ARROW", T_DOUBLE_ARROW, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_LIST", T_LIST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_ARRAY", T_ARRAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_CLASS_C", T_CLASS_C, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_FUNC_C", T_FUNC_C, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_LINE", T_LINE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_FILE", T_FILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_COMMENT", T_COMMENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_DOC_COMMENT", T_DOC_COMMENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_OPEN_TAG", T_OPEN_TAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_OPEN_TAG_WITH_ECHO", T_OPEN_TAG_WITH_ECHO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_CLOSE_TAG", T_CLOSE_TAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_WHITESPACE", T_WHITESPACE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_START_HEREDOC", T_START_HEREDOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_END_HEREDOC", T_END_HEREDOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_DOLLAR_OPEN_CURLY_BRACES", T_DOLLAR_OPEN_CURLY_BRACES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_CURLY_OPEN", T_CURLY_OPEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_PAAMAYIM_NEKUDOTAYIM", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_DOUBLE_COLON", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT);
-#ifdef ZEND_ENGINE_2
- REGISTER_LONG_CONSTANT("T_ABSTRACT", T_ABSTRACT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_CATCH", T_CATCH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_FINAL", T_FINAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_FROM", T_FROM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_IMPORT", T_IMPORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_INSTANCEOF", T_INSTANCEOF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_NAMESPACE", T_NAMESPACE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_NAMESPACE_NAME", T_NAMESPACE_NAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_PRIVATE", T_PRIVATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_PROTECTED", T_PROTECTED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_PUBLIC", T_PUBLIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_THROW", T_THROW, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("T_TRY", T_TRY, CONST_CS | CONST_PERSISTENT);
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(tokenizer)
-{
- /* uncomment this line if you have INI entries
- UNREGISTER_INI_ENTRIES();
- */
- return SUCCESS;
-}
-/* }}} */
-
-/* Remove if there's nothing to do at request start */
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(tokenizer)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* Remove if there's nothing to do at request end */
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(tokenizer)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(tokenizer)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Tokenizer Support", "enabled");
- php_info_print_table_end();
-
- /* Remove comments if you have entries in php.ini
- DISPLAY_INI_ENTRIES();
- */
-}
-/* }}} */
-
-static void tokenize(zval *return_value TSRMLS_DC)
-{
- zval token;
- zval *keyword;
- int token_type;
- zend_bool destroy;
-
- array_init(return_value);
-
- ZVAL_NULL(&token);
- while ((token_type = lex_scan(&token TSRMLS_CC))) {
- destroy = 1;
- switch (token_type) {
- case T_OPEN_TAG:
- case T_OPEN_TAG_WITH_ECHO:
- case T_WHITESPACE:
- case T_COMMENT:
- case T_CLOSE_TAG:
- destroy = 0;
- break;
- }
-
- if (token_type >= 256) {
- MAKE_STD_ZVAL(keyword);
- array_init(keyword);
- add_next_index_long(keyword, token_type);
- add_next_index_stringl(keyword, zendtext, zendleng, 1);
- add_next_index_zval(return_value, keyword);
- } else {
- add_next_index_stringl(return_value, zendtext, zendleng, 1);
- }
- if (destroy && Z_TYPE(token) != IS_NULL) {
- zval_dtor(&token);
- }
- ZVAL_NULL(&token);
- }
-}
-
-static char *
-get_token_type_name(int token_type)
-{
- switch (token_type) {
- case T_INCLUDE: return "T_INCLUDE";
- case T_INCLUDE_ONCE: return "T_INCLUDE_ONCE";
- case T_EVAL: return "T_EVAL";
- case T_REQUIRE: return "T_REQUIRE";
- case T_REQUIRE_ONCE: return "T_REQUIRE_ONCE";
- case T_LOGICAL_OR: return "T_LOGICAL_OR";
- case T_LOGICAL_XOR: return "T_LOGICAL_XOR";
- case T_LOGICAL_AND: return "T_LOGICAL_AND";
- case T_PRINT: return "T_PRINT";
- case T_PLUS_EQUAL: return "T_PLUS_EQUAL";
- case T_MINUS_EQUAL: return "T_MINUS_EQUAL";
- case T_MUL_EQUAL: return "T_MUL_EQUAL";
- case T_DIV_EQUAL: return "T_DIV_EQUAL";
- case T_CONCAT_EQUAL: return "T_CONCAT_EQUAL";
- case T_MOD_EQUAL: return "T_MOD_EQUAL";
- case T_AND_EQUAL: return "T_AND_EQUAL";
- case T_OR_EQUAL: return "T_OR_EQUAL";
- case T_XOR_EQUAL: return "T_XOR_EQUAL";
- case T_SL_EQUAL: return "T_SL_EQUAL";
- case T_SR_EQUAL: return "T_SR_EQUAL";
- case T_BOOLEAN_OR: return "T_BOOLEAN_OR";
- case T_BOOLEAN_AND: return "T_BOOLEAN_AND";
- case T_IS_EQUAL: return "T_IS_EQUAL";
- case T_IS_NOT_EQUAL: return "T_IS_NOT_EQUAL";
- case T_IS_IDENTICAL: return "T_IS_IDENTICAL";
- case T_IS_NOT_IDENTICAL: return "T_IS_NOT_IDENTICAL";
- case T_IS_SMALLER_OR_EQUAL: return "T_IS_SMALLER_OR_EQUAL";
- case T_IS_GREATER_OR_EQUAL: return "T_IS_GREATER_OR_EQUAL";
- case T_SL: return "T_SL";
- case T_SR: return "T_SR";
- case T_INC: return "T_INC";
- case T_DEC: return "T_DEC";
- case T_INT_CAST: return "T_INT_CAST";
- case T_DOUBLE_CAST: return "T_DOUBLE_CAST";
- case T_STRING_CAST: return "T_STRING_CAST";
- case T_ARRAY_CAST: return "T_ARRAY_CAST";
- case T_OBJECT_CAST: return "T_OBJECT_CAST";
- case T_BOOL_CAST: return "T_BOOL_CAST";
- case T_UNSET_CAST: return "T_UNSET_CAST";
- case T_NEW: return "T_NEW";
- case T_EXIT: return "T_EXIT";
- case T_IF: return "T_IF";
- case T_ELSEIF: return "T_ELSEIF";
- case T_ELSE: return "T_ELSE";
- case T_ENDIF: return "T_ENDIF";
- case T_LNUMBER: return "T_LNUMBER";
- case T_DNUMBER: return "T_DNUMBER";
- case T_STRING: return "T_STRING";
- case T_STRING_VARNAME: return "T_STRING_VARNAME";
- case T_VARIABLE: return "T_VARIABLE";
- case T_NUM_STRING: return "T_NUM_STRING";
- case T_INLINE_HTML: return "T_INLINE_HTML";
- case T_CHARACTER: return "T_CHARACTER";
- case T_BAD_CHARACTER: return "T_BAD_CHARACTER";
- case T_ENCAPSED_AND_WHITESPACE: return "T_ENCAPSED_AND_WHITESPACE";
- case T_CONSTANT_ENCAPSED_STRING: return "T_CONSTANT_ENCAPSED_STRING";
- case T_ECHO: return "T_ECHO";
- case T_DO: return "T_DO";
- case T_WHILE: return "T_WHILE";
- case T_ENDWHILE: return "T_ENDWHILE";
- case T_FOR: return "T_FOR";
- case T_ENDFOR: return "T_ENDFOR";
- case T_FOREACH: return "T_FOREACH";
- case T_ENDFOREACH: return "T_ENDFOREACH";
- case T_DECLARE: return "T_DECLARE";
- case T_ENDDECLARE: return "T_ENDDECLARE";
- case T_AS: return "T_AS";
- case T_SWITCH: return "T_SWITCH";
- case T_ENDSWITCH: return "T_ENDSWITCH";
- case T_CASE: return "T_CASE";
- case T_DEFAULT: return "T_DEFAULT";
- case T_BREAK: return "T_BREAK";
- case T_CONTINUE: return "T_CONTINUE";
-#ifndef ZEND_ENGINE_2
- case T_OLD_FUNCTION: return "T_OLD_FUNCTION";
-#endif
- case T_FUNCTION: return "T_FUNCTION";
- case T_CONST: return "T_CONST";
- case T_RETURN: return "T_RETURN";
- case T_USE: return "T_USE";
- case T_GLOBAL: return "T_GLOBAL";
- case T_STATIC: return "T_STATIC";
- case T_VAR: return "T_VAR";
- case T_UNSET: return "T_UNSET";
- case T_ISSET: return "T_ISSET";
- case T_EMPTY: return "T_EMPTY";
- case T_CLASS: return "T_CLASS";
- case T_EXTENDS: return "T_EXTENDS";
- case T_OBJECT_OPERATOR: return "T_OBJECT_OPERATOR";
- case T_DOUBLE_ARROW: return "T_DOUBLE_ARROW";
- case T_LIST: return "T_LIST";
- case T_ARRAY: return "T_ARRAY";
- case T_CLASS_C: return "T_CLASS_C";
- case T_FUNC_C: return "T_FUNC_C";
- case T_LINE: return "T_LINE";
- case T_FILE: return "T_FILE";
- case T_COMMENT: return "T_COMMENT";
- case T_OPEN_TAG: return "T_OPEN_TAG";
- case T_OPEN_TAG_WITH_ECHO: return "T_OPEN_TAG_WITH_ECHO";
- case T_CLOSE_TAG: return "T_CLOSE_TAG";
- case T_WHITESPACE: return "T_WHITESPACE";
- case T_START_HEREDOC: return "T_START_HEREDOC";
- case T_END_HEREDOC: return "T_END_HEREDOC";
- case T_DOLLAR_OPEN_CURLY_BRACES: return "T_DOLLAR_OPEN_CURLY_BRACES";
- case T_CURLY_OPEN: return "T_CURLY_OPEN";
- case T_PAAMAYIM_NEKUDOTAYIM: return "T_DOUBLE_COLON";
-#ifdef ZEND_ENGINE_2
- case T_DOC_COMMENT: return "T_DOC_COMMENT";
- case T_ABSTRACT: return "T_ABSTRACT";
- case T_CATCH: return "T_CATCH";
- case T_FINAL: return "T_FINAL";
- case T_FROM: return "T_FROM";
- case T_IMPORT: return "T_IMPORT";
- case T_INSTANCEOF: return "T_INSTANCEOF";
- case T_NAMESPACE: return "T_NAMESPACE";
- case T_NAMESPACE_NAME: return "T_NAMESPACE_NAME";
- case T_PRIVATE: return "T_PRIVATE";
- case T_PROTECTED: return "T_PROTECTED";
- case T_PUBLIC: return "T_PUBLIC";
- case T_THROW: return "T_THROW";
- case T_TRY: return "T_TRY";
-#endif
- }
- return "UNKNOWN";
-}
-
-/* {{{ proto array token_get_all(string source)
- */
-PHP_FUNCTION(token_get_all)
-{
- char *source = NULL;
- int argc = ZEND_NUM_ARGS();
- int source_len;
- zval source_z;
- zend_lex_state original_lex_state;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "s", &source, &source_len) == FAILURE)
- return;
-
- ZVAL_STRINGL(&source_z, source, source_len, 1);
- zend_save_lexical_state(&original_lex_state TSRMLS_CC);
-
- if (zend_prepare_string_for_scanning(&source_z, "" TSRMLS_CC) == FAILURE) {
- RETURN_EMPTY_STRING();
- }
-
- tokenize(return_value TSRMLS_CC);
-
- zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
- zval_dtor(&source_z);
-}
-/* }}} */
-
-/* {{{ proto string token_name(int type)
- */
-PHP_FUNCTION(token_name)
-{
- int argc = ZEND_NUM_ARGS();
- long type;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "l", &type) == FAILURE) {
- return;
- }
- RETVAL_STRING(get_token_type_name(type), 1);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/tokenizer/tokenizer.dsp b/ext/tokenizer/tokenizer.dsp
deleted file mode 100644
index a131efe8a2..0000000000
--- a/ext/tokenizer/tokenizer.dsp
+++ /dev/null
@@ -1,108 +0,0 @@
-# Microsoft Developer Studio Project File - Name="tokenizer" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=tokenizer - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "tokenizer.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "tokenizer.mak" CFG="tokenizer - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "tokenizer - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "tokenizer - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "tokenizer - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TOKENIZER_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_TOKENIZER" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_TOKENIZER=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_tokenizer.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "tokenizer - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TOKENIZER_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_TOKENIZER" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_TOKENIZER=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_tokenizer.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "tokenizer - Win32 Release_TS"
-# Name "tokenizer - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\tokenizer.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_tokenizer.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/tokenizer/tokenizer.php b/ext/tokenizer/tokenizer.php
deleted file mode 100644
index c13063c628..0000000000
--- a/ext/tokenizer/tokenizer.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-if(!extension_loaded('tokenizer')) {
- dl('tokenizer.so');
-}
-
-$fp = fopen('php://stdin', 'r');
-while (!feof($fp)) {
- $content .= fread($fp, 4096);
-}
-fclose($fp);
-
-$tokens = token_get_all($content);
-
-$count = count($tokens);
-$state = 0;
-for ($i = 0; $i < $count; $i++) {
- $token = $tokens[$i];
- if (is_array($token)) {
- if ($state == 1 && $token[0] == T_STRING) {
- $token[1] = preg_replace('!([a-z])([A-Z])!e', '"$1_".strtolower("$2")', $token[1]);
- $state = 0;
- } else if ($token[0] == T_FUNCTION) {
- $state = 1;
- }
- $chunk = $token[1];
- } else {
- $chunk = $token;
- }
- $output .= $chunk;
-}
-
-print $output;
-
-?>
diff --git a/ext/w32api/CREDITS b/ext/w32api/CREDITS
deleted file mode 100644
index 8d55cfc6b2..0000000000
--- a/ext/w32api/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-W32API
-James Moore
diff --git a/ext/w32api/EXPERIMENTAL b/ext/w32api/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/w32api/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/w32api/README b/ext/w32api/README
deleted file mode 100644
index 66a65ee747..0000000000
--- a/ext/w32api/README
+++ /dev/null
@@ -1,5 +0,0 @@
-Win 32 API Extension
-====================
-/* $Revision$ */
-
-See notes in w32api.c \ No newline at end of file
diff --git a/ext/w32api/TODO b/ext/w32api/TODO
deleted file mode 100644
index 771ad3b384..0000000000
--- a/ext/w32api/TODO
+++ /dev/null
@@ -1,3 +0,0 @@
- TODO
- ====
-.... LOTS .... \ No newline at end of file
diff --git a/ext/w32api/php_w32api.h b/ext/w32api/php_w32api.h
deleted file mode 100644
index 05a353265f..0000000000
--- a/ext/w32api/php_w32api.h
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: James Moore <jmoore@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#if HAVE_W32API
-
-#ifndef PHP_W32API_H
-#define PHP_W32API_H
-
-/* ================================================================================================
- * Type Definitions
- * ================================================================================================
- */
-typedef struct _w32api_lib_handle w32api_lib_handle;
-typedef struct _w32api_func_handle w32api_func_handle;
-typedef struct _w32api_type_handle w32api_type_handle;
-typedef struct _w32api_type_instance w32api_type_instance;
-typedef struct _arguments arguments;
-typedef struct _argument argument;
-typedef union _w32api_parser_function_definition_union w32api_parser_function_definition_union;
-typedef struct _w32api_func_handle_ptr w32api_func_handle_ptr;
-typedef struct _w32api_type_handle_ptr w32api_type_handle_ptr;
-typedef union _w32api_parser_type_definition_union w32api_parser_type_definition_union;
-typedef struct _member member;
-typedef struct _members members;
-typedef union _w32api_result w32api_result;
-typedef struct _w32api_dynamic_param w32api_dynamic_param;
-
-struct _w32api_lib_handle
-{
- HINSTANCE handle; /* Handle for our library */
- char *library_name; /* name of our library */
- int ref_count; /* reference counter */
-};
-
-struct _w32api_func_handle_ptr /* Temporary structure */
-{ /* To work around problems */
- w32api_func_handle *hnd; /* at 3am.. Ill sort it out */
-}; /* When I can think straight */
-
-struct _w32api_type_handle_ptr /* Ditto.. should really combine */
-{ /* These two into a union at least */
- w32api_type_handle *hnd;
-};
-
-struct _w32api_type_handle
-{
- char *type_name; /* Name of our type */
- long size; /* Size of type */
- members *member_list; /* Pointer List of members */
- long member_count; /* Number of members */
-};
-
-struct _w32api_type_instance
-{
- w32api_type_handle *type; /* pointer to w32api_type_handle */
- zval **values; /* First element of an array of ptr's to zvals */
-};
-
-struct _w32api_func_handle
-{
- FARPROC handle; /* Handle for our function */
- w32api_lib_handle *lib; /* Pointer to the library handle */
- char *function_name; /* Name of our function (Alias is store if supplied) */
- long return_type_id; /* ID of return type */
- char *return_type_name; /* Name of return type (if W32API_COMPLEX) */
- long flags; /* Flags for function */
- arguments *argument_list; /* Pointer List of arguments */
-};
-
-struct _arguments
-{
- argument *arg; /* Current Argument */
- arguments *next_arg; /* Next Arugment */
- arguments *prev_arg; /* Previous Argument */
-};
-
-struct _argument
-{
- long type_id; /* ID of the return type */
- char *type_name; /* Name of type (if W32API_COMPLEX) */
- char *argument_name; /* Name of argument, currently not used */
- long flags; /* Currently used for byref/byval */
-};
-
-struct _member
-{
- char *member_name;
- long member_type_id;
- char *member_type_name;
- long flags;
- long offset;
-};
-
-struct _members
-{
- member *member;
- members *next_member;
- members *prev_member;
-};
-
-union _w32api_result
-{
- int ival;
- unsigned long lval;
- DWORD dwval;
- void *ptr;
- float fval;
- double dval;
- __int64 i64val;
-};
-
-struct _w32api_dynamic_param
-{
- long flags;
- int width;
- union {
- unsigned long argument;
- void *argument_ptr;
- };
-};
-
-
-union _w32api_parser_function_definition_union
-{
- char *s;
- arguments *arg;
-};
-
-union _w32api_parser_type_definition_union
-{
- char *s;
- members *type;
-};
-
-/* ================================================================================================
- * Constants
- * ================================================================================================
- */
-
-/* Recognised Base types */
-#define W32API_UNKNOWN -1
-#define W32API_NULL 1
-#define W32API_INT 2
-#define W32API_LONG 3
-#define W32API_DOUBLE 4
-#define W32API_FLOAT 5
-#define W32API_STRING 6
-#define W32API_BYTE 7
-#define W32API_BOOL 8
-#define W32API_COMPLEX 9
-
-/* Function Flags */
-#define W32API_ARGPTR (1<<0)
-#define W32API_BORLAND (1<<1)
-#define W32API_CDECL (1<<2)
-#define W32API_REAL4 (1<<3)
-#define W32API_REAL8 (1<<4)
-
-/* ================================================================================================
- * Utility Macros
- * ================================================================================================
- */
-#define PROP_SET_ARGS zend_property_reference *property_reference, pval *value
-#define PROP_GET_ARGS zend_property_reference *property_reference
-
-#define W32API_PROP_SET_FUNCTION_N(class_name) w32api_set_property_handler_##class_name
-#define W32API_PROP_GET_FUNCTION_N(class_name) w32api_get_property_handler_##class_name
-#define W32API_CALL_FUNCTION_N(class_name) w32api_call_handler_##class_name
-
-#define W32API_PROP_SET_FUNCTION(class_name) PHP_W32API_API int W32API_PROP_SET_FUNCTION_N(class_name)(PROP_SET_ARGS)
-#define W32API_PROP_GET_FUNCTION(class_name) PHP_W32API_API zval W32API_PROP_GET_FUNCTION_N(class_name)(PROP_GET_ARGS)
-#define W32API_CALL_FUNCITON(class_name) PHP_W32API_API void W32API_CALL_FUNCTION_N(class_name)(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-
-#define W32API_CLASS_FUNCTION(class_name, function_name) PHP_FUNCTION(##class_name##function_name)
-#define W32API_CLASS_FN(class_name, function_name) PHP_FN(##class_name##function_name)
-#define W32API_CLASS_FE(class_name, function_name, function_args) {#function_name, W32API_CLASS_FN(class_name, function_name), function_args},
-
-/* ================================================================================================
- * Module exports, Global Variables and General Definitions
- * ================================================================================================
- */
-extern zend_module_entry w32api_module_entry;
-#define phpext_w32api_ptr &w32api_module_entry;
-
-#define PHP_W32API_API __declspec(dllexport)
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif /* ZTS */
-
-ZEND_BEGIN_MODULE_GLOBALS(w32api)
- zend_class_entry *win32_ce; /* The class entry for our win32 class */
- zend_class_entry *type_ce; /* The class entry for our type class */
- HashTable *funcs; /* Functions we registered */
- HashTable *libraries; /* Libraries we load using LoadLibrary */
- HashTable *types; /* Types we have registed with us */
- HashTable *callbacks; /* Callbacks we have registered with us */
- long le_type_instance; /* Resource hanlde for runtime instances */
-ZEND_END_MODULE_GLOBALS(w32api)
-
-ZEND_DECLARE_MODULE_GLOBALS(w32api)
-
-#ifdef ZTS
-#define WG(v) TSRMG(w32api_globals_id, zend_w32api_globals *, v)
-#else
-#define WG(v) (w32api_globals.v)
-#endif
-
-
-/* ================================================================================================
- * Startup, Shutdown and Info Functions
- * ================================================================================================
- */
-PHP_MINIT_FUNCTION(w32api);
-PHP_MSHUTDOWN_FUNCTION(w32api);
-PHP_RINIT_FUNCTION(w32api);
-PHP_RSHUTDOWN_FUNCTION(w32api);
-PHP_MINFO_FUNCTION(w32api);
-static void php_w32api_init_globals(zend_w32api_globals *w32api_globals);
-static void php_w32api_hash_lib_dtor(void *data);
-static void php_w32api_hash_func_dtor(void *data);
-static void php_w32api_hash_callback_dtor(void *data);
-static void php_w32api_hash_type_dtor(void *data);
-static void w32api_type_instance_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-
-/* ================================================================================================
- * Win32 Class Functions
- * ================================================================================================
- */
-int win32_class_init(TSRMLS_D);
-int win32_class_rshutdown(TSRMLS_D);
-W32API_CLASS_FUNCTION(win32, registerfunction);
-W32API_CLASS_FUNCTION(win32, unregisterfunction);
-W32API_CLASS_FUNCTION(win32, registercallback);
-W32API_CLASS_FUNCTION(win32, definetype);
-W32API_CLASS_FUNCTION(win32, gettypesize);
-W32API_CLASS_FUNCTION(win32, inittype);
-W32API_CLASS_FUNCTION(win32, decref);
-W32API_CLASS_FUNCTION(win32, invokefunction);
-
-
-/* ================================================================================================
- * Type Class Functions
- * ================================================================================================
- */
-int type_class_init(TSRMLS_DC);
-
-W32API_CLASS_FUNCTION(type, clone);
-W32API_PROP_SET_FUNCTION(type);
-W32API_PROP_GET_FUNCTION(type);
-
-/* ================================================================================================
- * Utility Functions
- * ================================================================================================
- */
-
-static int php_w32api_load_function (char *definition, int definition_len, int flags TSRMLS_DC);
-static void php_w32api_unload_function (w32api_func_handle **fh TSRMLS_DC);
-
-static int php_w32api_load_library (char *library_name, w32api_lib_handle **lh TSRMLS_DC);
-static void php_w32api_unload_library (w32api_lib_handle *lh, int flags TSRMLS_DC);
-
-static int php_w32api_register_callback(char *function_definition, int function_definition_len TSRMLS_DC);
-
-static void php_w32api_free_arguments(arguments *argument_list);
-static void php_w32api_free_members(members *member_list);
-
-static int php_w32api_get_type_id_from_name(char *type);
-static unsigned char *php_w32api_do_arg_types(arguments **arguments);
-
-void php_w32api_marshall_zval_to_c(argument *arg, w32api_dynamic_param *dp, zval *pzval TSRMLS_DC);
-
-static void php_w32api_init_type(w32api_type_handle *th, zval *obj TSRMLS_DC);
-static int php_w32api_do_prop_get(zval *object, zval *return_value, zend_llist_element **element TSRMLS_DC);
-static int php_w32api_do_prop_set(zval *object, zval *value, zend_llist_element **element TSRMLS_DC);
-static void *php_w32api_complex_marshall_zval_to_c(zval *pzval, int *width, void *data TSRMLS_DC);
-
-/* ================================================================================================
- * Parser & Scanner Functions
- * ================================================================================================
- */
-#define w32api_parser_load_alias_function w32api_parser_load_function_ex
-#define w32api_parser_load_function(return_type, function_name, arguments, library_name) w32api_parser_load_function_ex (return_type, function_name, NULL, arguments, library_name)
-#define w32api_parser_make_argument_byref(arg_type, arg_name) w32api_parser_make_argument(arg_type, arg_name, BYREF_FORCE)
-#define w32api_parser_make_argument_byval(arg_type, arg_name) w32api_parser_make_argument(arg_type, arg_name, BYREF_NONE)
-
-#define w32api_parser_type_make_byref_value(member_name, member_type) w32api_parser_type_make_value(member_name, member_type, BYREF_FORCE)
-#define w32api_parser_type_make_byval_value(member_name, member_type) w32api_parser_type_make_value(member_name, member_type, BYREF_NONE)
-
-w32api_func_handle *w32api_parser_load_function_ex(char *return_type, char *function_name, char *alias_name, arguments *argument_list, char *library_name);
-arguments *w32api_parser_make_argument(char *arg_type, char *arg_name, int byref);
-arguments *w32api_parser_join_arguments(arguments *lval, arguments *rval);
-int w32api_function_definition_error(char *s);
-
-w32api_type_handle *w32api_parser_register_type(char *type_name, members *member_list);
-members *w32api_parser_type_make_value(char *member_name, char *type_name, long flags);
-members *w32api_parser_type_join_values(members *lval, members *rval);
-int w32api_type_definition_error(char *s);
-
-struct yy_buffer_state *w32api_function_definition_scan_bytes(char *bytes, int len); /* Definied in w32api_function_definition_scanner.c */
-int w32api_function_definition_parse(void *fh); /* Definied in w32api_function_definition_parser.c */
-
-struct yy_buffer_state *w32api_type_definition_scan_bytes(char *bytes, int len); /* Definied in w32api_type_definition_scanner.c */
-int w32api_type_definition_parse(void *th); /* Definied in w32api_type_definition_parser.c */
-
-
-/* ================================================================================================
- * Various Debugging Functions
- * ================================================================================================
- */
-#ifndef NDEBUG
-W32API_CLASS_FUNCTION(win32, dump_library_hash);
-W32API_CLASS_FUNCTION(win32, dump_function_hash);
-W32API_CLASS_FUNCTION(win32, dump_callback_hash);
-W32API_CLASS_FUNCTION(win32, dump_type_hash);
-
-int php_w32api_dump_library_hash_cb(void *pData TSRMLS_DC);
-int php_w32api_dump_function_hash_cb(void *pData TSRMLS_DC);
-int php_w32api_dump_callback_hash_cb(void *pData TSRMLS_DC);
-int php_w32api_dump_type_hash_cb(void *pData TSRMLS_DC);
-
-void php_w32api_print_arguments(arguments *argument_list);
-void php_w32api_print_members(members *member_list);
-
-#endif /* ifndef NDEBUG */
-
-#endif /* ifndef PHP_W32API_H */
-#endif /* if HAVE_W32API */ \ No newline at end of file
diff --git a/ext/w32api/w32api.c b/ext/w32api/w32api.c
deleted file mode 100644
index 71073d5bb5..0000000000
--- a/ext/w32api/w32api.c
+++ /dev/null
@@ -1,2286 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: James Moore <jmoore@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*
- * Win32 API Extension for PHP 4
- * =============================
- *
- * This extension allows PHP Developers to access the underlying functions in the
- * Win32 API Dll's in a generic way, it provides a mechanism for the user to load
- * and register functions from dll's and then to call them, it also implements a
- * generic callback handler which allows the user to pass a pointer to one of
- * their PHP functions to act as a callback from the C function enabling the PHP
- * programmer to handle callbacks in PHP seemlessly. Finally the extension marshalls
- * from PHP types (Zvals) to C structures seemlessly once it has been told about them
- *
- * I would like to thank Ton Plooy for his article on a similar subject which gave me
- * the initial idea for a generic dll caller and some good pointers on how to actaully
- * implement it.
- */
-
-/*
- * Interface the PHP Programmer Sees
- * ==================================
- *
- * To keep namespaces tidy the module will introduce two classes, the first is
- * the win32 class which has several functions to load and register functions from
- * the underlying DLL's. The Win32 class also has functions for informing the
- * module about the C types we will be using so it can marshall and demarshall to and from
- * the C Interface. . Our second class is the Type class. The type class is our container
- * for complex C types which are registered and initiated using our win32 class functions.
- *
- * Win32 Class Functions
- * =====================
- *
- * static int Win32::RegisterFunction( string Definition, long flags )
- * -------------------------------------------------------------------
- *
- * This function is used for registering a dll function with the module. The Definition should take
- * the form:
- * Definition: <return_type> <function_name> [Alias <alias_name] (<argument_list>) From <some_dll>
- *
- * return_type :- Either a simple type or a type that has
- * been registered with the module
- *
- * function_name :- The name of the function within the dll, if this is not found
- * we append an A to the function name to check for a ASCII version,
- * if this is not found we fail.
- *
- * alias_name :- If this is provided then we register the function under this name
- * in the PHP Symbol table.
- *
- * argument_list :- A comma seperated list of arguments in the form <argument_type>
- * [&]argument_name.
- *
- * argument_type :- Argument type is a type known to the module
- *
- * argument_name :- This is not currently used although if it is proceeded by an
- * & (Ampersand) then a pointer is passed rather than the value.
- *
- * some_dll :- This is the name of the dll to find the function in.
- *
- * On success the function returns TRUE, on error FALSE, The function issues appropriate errors
- * to allow the PHP Progammer to catch individual errors.
- *
- * static int Win32::UnregisterFunction(string FunctionName)
- * ---------------------------------------------------------
- *
- * Allows the PHP programmer to force a function to be unregistered saving on memory resources. Can
- * be useful in long running scripts.
- *
- * Returns TRUE on success, FALSE on error.
- *
- *
- * static int Win32::DefineType( string Definition )
- * -------------------------------------------------
- *
- * This function is used to register a C-Type which will be used when calling a function, it only
- * supports the equivilent of C structures at this time so if you need to use a union you must use the
- * largest member of that union as the type in the struct for this to work.
- *
- * The definition string takes the form:
- *
- * Definition: <type_name> { <type_list> }
- *
- * type_name :- A unique name for this type.
- *
- * type_list :- Takes for form <member_type> [&]<member_name>
- *
- * member_type :- The type of this member.
- *
- * member_name :- The name for this member, if an & (ampersand) preceeds
- * the name it will be stripped and a pointer rather than
- * the value will be used.
- *
- * Returns TRUE on success, FALSE on error.
- *
- *
- * static int Win32::GetTypeSize(mixed TypeHandle)
- * -----------------------------------------------
- *
- * This function returns the size of a type registered with the module. The parameter should
- * either be the name of the type or an instance of it. The Function returns FALSE on error
- * ***USE === to distinguish between this and a size of 0*** or the size of the type on success.
- *
- *
- * static mixed Win32::InitType(String TypeName)
- * ---------------------------------------------
- *
- * Creates an instance of the type so that the PHP Programmer can assign values and then pass
- * it to a C Function. Returns NULL on error.
- *
- * static int Win32::DecRef(mixed var)
- * -----------------------------------
- * Decreases the reference count on a variable only if we incremented the refcount when passing
- * the variable to a C function.
- *
- * TYPE Functions
- * ==============
- *
- * mixed Type::Type(String TypeName)
- * ---------------------------------
- * See Win32::InitType,
- *
- * mixed Type::Clone()
- * -------------------
- *
- * Allows you to make an exact copy of the class, this should be used rather than the &= syntax
- * Due to the nesting within classes. This function WILL become redundant in PHP 5.
- */
-
-/*
- * Implementation Details
- * ======================
- *
- * This module will only work on the Intel platform.
- *
- * We basically want to set up this structure:
- *
- * +-----------+
- * | PHP |
- * +-----------+
- * Call | /|\
- * \|/ | call_user_function_ex
- * +------------------------+
- * | Win 32 API Extension |
- * +------------------------+
- * | /|\
- * \|/ | Callback
- * +-------------+
- * | C-Space |
- * +-------------+
- *
- * Win32 Needs to then Marshall between zvals and
- *
- * Marshalling from ZVAL's to C Types.
- * -----------------------------------
- * For simple types this is very easy as we either just copy the value or a pointer
- * to it onto the stack, if we copy a pointer then we must increase the refcount on
- * the zval and must also make sure we get it passed to us by reference.
- *
- * The problem here is when to dereference the zval again as we may get into the following
- * situation
- *
- * We call somefunction giving it an argument by reference (IE we pass a pointer to the value union of a zval)
- * we must increase the ref count on the zval to avoid the possibility of a GPE (IE the zval is dtord and then
- * the function uses the zval in some sort of callback we could end up with a GPE)
- * But if we increase the zval's refcount without dtoring it anywhere it would cause a mem leak.
- *
- * Therefore we probably need to keep a local reference table so we can either allow the user to call
- * Win32::DecRef($var) to decrement the reference count (We would want to keep a local table to avoid anyone
- * breaking Zend's handling off it as well..))
- *
- * Then at MSHUTDOWN we free this hashtable decrementing the refcount as needed..
- *
- * Complex types are less clear cut on how to handle them. My prefered method is to always
- * keep these in a C Format but to allow access to these via a wrapper object which calculates
- * the offset of the data to allow access to it from PHP. This also allows us to do no conversion
- * when dealing with C types coming to us allowing us to deal with pointers in a more clear way.
- *
- *
- * Enabling C Code to call PHP Code in a generic fashion
- * -----------------------------------------------------
- * What we do here is we use _declspec(naked) to tell the compiler we will handle all stack operations
- * ourself, we also then create (At runtime) function prologues which we place on the heap which push
- * extra arguments onto the stack which tell us which php_function is being called back and the callback type
- * which has been registered with us.
- *
- */
-
-#if HAVE_W32API
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-#include "php_w32api.h"
-
-
-/* =====================================================================================================
- * PHP Module Startup, Shutdown & Info Code
- * =====================================================================================================
- */
-
-#ifdef COMPILE_DL_W32API
-ZEND_GET_MODULE(w32api)
-#endif
-
-/* {{{ w32api_module_entry
- */
-zend_module_entry w32api_module_entry = {
- STANDARD_MODULE_HEADER,
- "Win32 API",
- NULL, /* We define no global functions */
- PHP_MINIT(w32api),
- PHP_MSHUTDOWN(w32api),
- PHP_RINIT(w32api),
- PHP_RSHUTDOWN(w32api),
- PHP_MINFO(w32api),
- "0.2",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(w32api)
-{
- /* Setup out module globals */
- ZEND_INIT_MODULE_GLOBALS(w32api, php_w32api_init_globals, NULL);
-
-
- if(win32_class_init(TSRMLS_C) != SUCCESS)
- {
- return FAILURE;
- }
-
- if(type_class_init(TSRMLS_C) != SUCCESS)
- {
- return FAILURE;
- }
-
- WG(le_type_instance) = zend_register_list_destructors_ex(w32api_type_instance_dtor, NULL, "Type Instance", module_number);
-
- /* Function Flags */
- REGISTER_LONG_CONSTANT( "W32API_ARGPTR", W32API_ARGPTR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT( "W32API_BORLAND", W32API_BORLAND, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT( "W32API_CDECL", W32API_CDECL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT( "W32API_REAL4", W32API_REAL4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT( "W32API_REAL8", W32API_REAL8, CONST_CS | CONST_PERSISTENT);
-
-
- return SUCCESS;
-
-};
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(w32api)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(w32api)
-{
- /* Allocate Request Specific HT's here
- */
- ALLOC_HASHTABLE(WG(funcs));
- zend_hash_init(WG(funcs), 1, NULL, php_w32api_hash_func_dtor, 1);
-
- ALLOC_HASHTABLE(WG(libraries));
- zend_hash_init(WG(libraries), 1, NULL, php_w32api_hash_lib_dtor, 1);
-
- ALLOC_HASHTABLE(WG(callbacks));
- zend_hash_init(WG(callbacks), 1, NULL, php_w32api_hash_callback_dtor, 1);
-
- ALLOC_HASHTABLE(WG(types));
- zend_hash_init(WG(types), 1, NULL, php_w32api_hash_type_dtor, 1);
-
-
- return SUCCESS;
-
-};
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(w32api)
-{
-
- win32_class_rshutdown(TSRMLS_C);
-
- /* Must be dtor'd before libraries */
- zend_hash_destroy(WG(funcs));
- FREE_HASHTABLE(WG(funcs));
-
- zend_hash_destroy(WG(libraries));
- FREE_HASHTABLE(WG(libraries)); /* we may only want to do this on MSHUTDOWN but for now it can be here */
-
- zend_hash_destroy(WG(callbacks));
- FREE_HASHTABLE(WG(callbacks));
-
- zend_hash_destroy(WG(types));
- FREE_HASHTABLE(WG(types));
-
-
- return SUCCESS;
-}
-/* }}} */
-
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(w32api)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Win32 API Support", "enabled" );
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ php_w32api_init_globals
- */
-static void php_w32api_init_globals(zend_w32api_globals *w32api_globals)
-{
- w32api_globals->win32_ce = NULL;
- w32api_globals->type_ce = NULL;
- w32api_globals->funcs = NULL;
- w32api_globals->libraries = NULL;
- w32api_globals->callbacks = NULL;
- w32api_globals->types = NULL;
-}
-/* }}} */
-
-/* {{{ php_w32api_hash_lib_dtor (void *data)
- * Dtor function called when hash is destroied, unloads library
- */
-static void php_w32api_hash_lib_dtor(void *data)
-{
- w32api_lib_handle *lh; /* Library Handle */
- TSRMLS_FETCH(); /* Get thread safe stuff */
- lh = (w32api_lib_handle *)data;
-
- FreeLibrary(lh->handle);
- efree(lh->library_name);
-}
-/* }}} */
-
-/* {{{ php_w32api_hash_func_dtor (void *data)
- * Dtor function called when hash is destroied, unloads function.
- */
-static void php_w32api_hash_func_dtor(void *data)
-{
- w32api_func_handle **fh; /* Function Handle */
- TSRMLS_FETCH(); /* Get thread safe stuff */
-
- fh = (w32api_func_handle **)data;
- php_w32api_unload_function(fh TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ php_w32api_hash_callback_dtor
- * DTOR function called when hash is destroied, removes callback.
- */
-static void php_w32api_hash_callback_dtor(void *data)
-{
- w32api_func_handle **fh;
-
- fh = (w32api_func_handle **)data;
-
- php_w32api_free_arguments((*fh)->argument_list);
- efree((*fh)->function_name);
-
- if((*fh)->return_type_name)
- efree((*fh)->return_type_name);
-
- efree(*fh);
-}
-
-/* {{{ php_w32api_hash_type_dtor
- * DTOR function called when hash is destroied, removes callback.
- */
-static void php_w32api_hash_type_dtor(void *data)
-{
- w32api_type_handle **th;
-
- th = (w32api_type_handle **)data;
-
- php_w32api_free_members((*th)->member_list);
- efree((*th)->type_name);
- efree(*th);
-}
-
-static void w32api_type_instance_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- w32api_type_instance *ti;
- int i = 0;
-
- if(!rsrc || !rsrc->ptr)
- return;
-
- ti = (w32api_type_instance *)rsrc->ptr;
-
- for(i = 0; i < ti->type->member_count; i++)
- {
- if(ti->values[i])
- zval_ptr_dtor(&ti->values[i]);
- }
-
- efree(ti);
-
- return;
-}
-/* =====================================================================================================
- * Utility Functions
- * =====================================================================================================
- */
-
-/* {{{ php_w32api_unload_library
- * Expects two arguments, the first is the pointer to a w32api_lib_handle
- * and the second is a flag, if the flag is 0 then the reference counter is
- * use if it is one then the library is unloaded irrespective of the reference
- * counter
- */
-static void php_w32api_unload_library (w32api_lib_handle *lh, int flags TSRMLS_DC)
-{
-
- if(flags == 0)
- {
- lh->ref_count--;
- }
-
- if((flags == 1) || (lh->ref_count == 0))
- {
- /* remove outselves from the hashtable */
- zend_hash_del(WG(libraries), lh->library_name, strlen(lh->library_name) + 1);
- }
-}
-/* }}} */
-
-/* {{{ php_w32api_unload_function
- * Expects one argument, a pointer to a w32api_func_handle, unloads this
- * function from both the function table internally and the PHP function
- * table then it decrements the reference counter on the library.
- */
-static void php_w32api_unload_function (w32api_func_handle **fh TSRMLS_DC)
-{
- zend_function *function = NULL;
-
- efree((*fh)->return_type_name);
- php_w32api_free_arguments((*fh)->argument_list);
-
- /* If needs be we need to retrieve function ptr from hash table
- * and free anything we allocate when creating them at runtime (most notably
- * arg_types
- */
- if(zend_hash_find( &WG(win32_ce)->function_table,
- (*fh)->function_name,
- strlen((*fh)->function_name) + 1,
- (void **)&function) == SUCCESS)
- {
- zend_internal_function *internal_function = (zend_internal_function *)function;
- if(internal_function->arg_types)
- efree(internal_function->arg_types);
- }
-
- /* Remove from Function Table */
- zend_hash_del(&WG(win32_ce)->function_table, (*fh)->function_name, strlen((*fh)->function_name) + 1);
- php_w32api_unload_library((*fh)->lib, 0 TSRMLS_CC);
-
- efree((*fh)->function_name);
- efree(*fh);
-
-}
-/* }}} */
-
-/* {{{ php_w32api_load_function
- * Expects three arguments, The definition of the function in string format, the definitions length
- * and a pointer to a pointer to a function handle. returns SUCCESS or FAILURE.
- */
-static int php_w32api_load_function (char *definition, int definition_len, int flags TSRMLS_DC)
-{
- zend_function function;
- zend_internal_function *internal_function = (zend_internal_function *)&function;
- w32api_func_handle **fh;
- w32api_func_handle_ptr hnd;
-
- fh = emalloc(sizeof(w32api_func_handle *));
- *fh = NULL;
-
- /* Parse function */
- w32api_function_definition_scan_bytes(definition, definition_len);
- if((w32api_function_definition_parse((void *)&hnd) != 0))
- {
- *fh = hnd.hnd;
- if(*fh != NULL)
- efree(*fh);
-
- efree(fh);
- return FAILURE;
- }
- *fh = hnd.hnd;
-
- if(!*fh)
- return FAILURE;
-
-
- if(zend_hash_exists(&WG(win32_ce)->function_table, (*fh)->function_name, strlen((*fh)->function_name) + 1))
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "A function by the name %s already has been registered, cannot redefine function",
- (*fh)->function_name);
-
- /* We dont want to unload function as it already exists so lets just free it ourselves */
- php_w32api_unload_library((*fh)->lib, 0 TSRMLS_CC);
- php_w32api_free_arguments((*fh)->argument_list);
- efree((*fh)->return_type_name);
- efree((*fh)->function_name);
- efree(*fh);
- efree(fh);
-
- return FAILURE;
- }
-
- /* Insert it into our hash table */
- if(zend_hash_add( WG(funcs),
- (*fh)->function_name,
- strlen((*fh)->function_name) + 1,
- fh,
- sizeof(w32api_func_handle),
- NULL) != SUCCESS)
- {
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "Loading of function %s failed: Could not insert function handle into hash",
- (*fh)->function_name);
-
- /* Tidy up */
- zend_hash_del(WG(funcs), (*fh)->function_name, strlen((*fh)->function_name) +1);
- return FAILURE;
- }
-
- /* Insert function into win32_ce's function_table */
- internal_function->type = ZEND_INTERNAL_FUNCTION;
- internal_function->handler = W32API_CLASS_FN(win32, invokefunction);
- internal_function->function_name = (*fh)->function_name;
- internal_function->arg_types = php_w32api_do_arg_types(&(*fh)->argument_list);
-
- if(zend_hash_add(&WG(win32_ce)->function_table, (*fh)->function_name,
- strlen((*fh)->function_name) + 1, &function, sizeof(zend_function), NULL) == FAILURE)
- {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not register function %s into function table", (*fh)->function_name);
- zend_hash_del(WG(funcs), (*fh)->function_name, strlen((*fh)->function_name) +1);
-
- return FAILURE;;
- }
-
- if(flags)
- {
- (*fh)->flags = (*fh)->flags | flags;
- }
-
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_w32api_unload_type
- * Expects one argument, a pointer to a w32api_type_handle, unloads this
- * type.
- */
-static void php_w32api_unload_type (w32api_type_handle **th TSRMLS_DC)
-{
- php_w32api_free_members((*th)->member_list);
-
- zend_hash_del(WG(types), (*th)->type_name, strlen((*th)->type_name) + 1);
-
-}
-/* }}} */
-
-/* {{{ php_w32api_register_type
- */
-static int php_w32api_register_type(char *type_definition, int type_definition_len TSRMLS_DC)
-{
- w32api_type_handle **th;
- w32api_type_handle_ptr hnd;
-
- th = emalloc(sizeof(w32api_type_handle *));
- *th = NULL;
-
- w32api_type_definition_scan_bytes(type_definition, type_definition_len);
- if(w32api_type_definition_parse((void *)&hnd) != 0)
- {
- *th = hnd.hnd;
-
- /* Leaks */
- if(*th != NULL)
- efree(*th);
-
- efree(th);
- return FAILURE;
- }
-
- *th = hnd.hnd;
-
- if(!*th)
- return FAILURE;
-
- if((zend_hash_exists(WG(callbacks), (*th)->type_name, strlen((*th)->type_name) +1)) ||
- (zend_hash_exists(WG(types), (*th)->type_name, strlen((*th)->type_name) + 1)))
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "A type or callback by the name %s already has been registered, cannot redefine type or callback",
- (*th)->type_name);
-
- /* We dont want to unload function as it already exists so lets just free it ourselves */
- php_w32api_free_members((*th)->member_list);
- efree((*th)->type_name);
- efree(*th);
- efree(th);
-
- return FAILURE;
- }
-
- /* Insert it into our hash table */
- if(zend_hash_add( WG(types),
- (*th)->type_name,
- strlen((*th)->type_name) + 1,
- th,
- sizeof(w32api_type_handle *),
- NULL) != SUCCESS)
- {
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "Loading of type %s failed: Could not insert type handle into hash",
- (*th)->type_name);
-
- /* Tidy up */
- zend_hash_del(WG(types), (*th)->type_name, strlen((*th)->type_name) + 1);
- return FAILURE;
- }
-
- return SUCCESS;
-
-}
-/* }}} */
-
-
-/* {{{ php_w32api_register_callback
- */
-static int php_w32api_register_callback(char *function_definition, int function_definition_len TSRMLS_DC)
-{
- w32api_func_handle **fh;
- w32api_func_handle_ptr hnd;
-
- char *new_definition = NULL;
-
- fh = emalloc(sizeof(w32api_func_handle *));
- *fh = NULL;
-
- new_definition = emalloc(function_definition_len + sizeof(" from cb.cb"));
-
- snprintf(new_definition, function_definition_len + sizeof(" from cb.cb"), "%s from cb.cb", function_definition);
-
-
- /* Parse function */
- w32api_function_definition_scan_bytes(new_definition, function_definition_len + sizeof(" from cb.cb"));
- if(w32api_function_definition_parse((void *)&hnd) != 0)
- {
- *fh = hnd.hnd;
-
- /* Leaks */
- if(*fh != NULL)
- efree(*fh);
-
- efree(fh);
- return FAILURE;
- }
- *fh = hnd.hnd;
-
- if(!*fh)
- return FAILURE;
-
-
- if(zend_hash_exists(WG(callbacks), (*fh)->function_name, strlen((*fh)->function_name) + 1))
- {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "A callback by the name %s already has been registered, cannot redefine type",
- (*fh)->function_name);
-
- /* We dont want to unload function as it already exists so lets just free it ourselves */
- php_w32api_free_arguments((*fh)->argument_list);
- efree((*fh)->return_type_name);
- efree((*fh)->function_name);
- efree(*fh);
- efree(fh);
-
- return FAILURE;
- }
-
- /* Insert it into our hash table */
- if(zend_hash_add( WG(callbacks),
- (*fh)->function_name,
- strlen((*fh)->function_name) + 1,
- fh,
- sizeof(w32api_func_handle *),
- NULL) != SUCCESS)
- {
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "Loading of function %s failed: Could not insert function handle into hash",
- (*fh)->function_name);
-
- /* Tidy up */
- zend_hash_del(WG(callbacks), (*fh)->function_name, strlen((*fh)->function_name) + 1);
- return FAILURE;
- }
-
- return SUCCESS;
-
-
-
-}
-/* }}} */
-
-
-/* {{{ php_w32api_free_arguments
- * Expects one argument, the head of a list of arguments to free
- */
-static void php_w32api_free_arguments(arguments *argument_list)
-{
- if(argument_list == NULL)
- return;
-
- efree(argument_list->arg->argument_name);
- efree(argument_list->arg->type_name);
- efree(argument_list->arg);
-
- if(argument_list->next_arg != NULL)
- {
- php_w32api_free_arguments(argument_list->next_arg);
- }
-
- efree(argument_list);
-
- return;
-}
-/* }}} */
-
-/* {{{ php_w32api_free_members
- * Expects one argument, the head of a list of members to free
- */
-static void php_w32api_free_members(members *member_list)
-{
- if(member_list == NULL)
- return;
-
- efree(member_list->member->member_name);
-
- if(member_list->member->member_type_name != NULL)
- efree(member_list->member->member_type_name);
-
- efree(member_list->member);
-
- php_w32api_free_members(member_list->next_member);
- efree(member_list);
- return;
-}
-/* }}} */
-
-/* {{{ php_w32api_load_library
- * Expects two parameters, first is libraries name the second is a pointer
- * to a pointer to w32api_lib_handle which will recieve the resultant handle.
- * returns SUCCESS on success and FAILURE on failure.
- */
-static int php_w32api_load_library (char *library_name, w32api_lib_handle **lh TSRMLS_DC)
-{
- if(zend_hash_find(WG(libraries), library_name, strlen(library_name) + 1, (void **)lh) == SUCCESS)
- {
- (*lh)->ref_count++;
- return SUCCESS;
- }
-
- *lh = (w32api_lib_handle *) emalloc( sizeof(w32api_lib_handle) );
- (*lh)->ref_count = 1;
- (*lh)->library_name = estrdup(library_name);
-
- (*lh)->handle = LoadLibrary((*lh)->library_name);
-
- if(!(*lh)->handle) /* Could not load library */
- {
- LPVOID message_buffer;
- FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR)&message_buffer,
- 0,
- NULL);
-
- /* Tidy up */
- efree((*lh)->library_name);
- efree(*lh);
- efree(lh);
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Loading of library failed: %s", message_buffer);
- LocalFree(message_buffer);
-
- return FAILURE;
- }
-
- /* Add to hash */
- if(zend_hash_add( WG(libraries),
- (*lh)->library_name,
- strlen((*lh)->library_name) + 1,
- *lh,
- sizeof(w32api_lib_handle),
- NULL) != SUCCESS)
- {
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "Loading of library %s failed: Could not insert library handle into hash",
- (*lh)->library_name);
-
- /* Tidy up */
- efree((*lh)->library_name);
- efree(*lh);
- efree(lh);
-
- return FAILURE;
- }
-
-
- return SUCCESS;
-
-}
-/* }}} */
-
-
-/* {{{ php_w32api_do_arg_types
- */
-static unsigned char *php_w32api_do_arg_types(arguments **argument_list)
-{
- int i = 0;
- int j = 0;
- arguments *curr_arg = NULL;
- unsigned char *retval = NULL;
-
- if(!(argument_list) || !(*argument_list))
- return NULL;
-
- curr_arg = *argument_list;
-
- /* See how much room we need to emalloc */
- while(curr_arg)
- {
- i++;
-
- if(curr_arg->arg->flags & BYREF_FORCE)
- {
- j = i;
- }
-
- curr_arg = curr_arg->next_arg;
- }
-
- /* Check to see if any args are by ref */
- if( j == 0 )
- return NULL;
-
- retval = (unsigned char *)emalloc(sizeof(unsigned char) * j + 1);
- retval[0] = (unsigned char)j;
-
- curr_arg = *argument_list;
-
- for(i=1; i <= j; i++)
- {
-
- retval[i] = (unsigned char)curr_arg->arg->flags;
- curr_arg = curr_arg->next_arg;
-
- }
-
- return retval;
-}
-/* }}} */
-
-static int php_w32api_get_type_size(int type_id, char *type_name, int flags)
-{
- TSRMLS_FETCH();
-
- if(flags & BYREF_FORCE)
- {
- return sizeof(void *); /* Pointers are always the same size */
- }
-
- switch(type_id)
- {
- case W32API_NULL:
- return sizeof(void *);
- case W32API_INT:
- return sizeof(int);
- case W32API_LONG:
- return sizeof(long);
- case W32API_DOUBLE:
- return sizeof(double);
- case W32API_FLOAT:
- return sizeof(float);
- case W32API_STRING:
- return sizeof(char *);
- case W32API_BYTE:
- return sizeof(char);
- case W32API_BOOL:
- return sizeof(int);
- case W32API_COMPLEX:
- {
- w32api_type_handle **th;
-
- if(zend_hash_find(WG(types), type_name, strlen(type_name) +1, (void **)&th) != SUCCESS)
- {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unknown type %s", type_name);
- return -1;
- }
-
- return (*th)->size;
-
- }
- break;
- case W32API_UNKNOWN:
- default:
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unknown type %s", type_name);
- return -1;
- }
-}
-
-static int php_w32api_get_type_id_from_name(char *type)
-{
-
- TSRMLS_FETCH();
-
- if(!strcmp(type, "long"))
- {
- return W32API_LONG;
- }
- else if(!strcmp(type, "int"))
- {
- return W32API_INT;
- }
- else if (!strcmp(type, "string"))
- {
- return W32API_STRING;
- }
- else if (!strcmp(type, "byte"))
- {
- return W32API_BYTE;
- }
- else if (!strcmp(type, "bool"))
- {
- return W32API_BOOL;
- }
- else if (!strcmp(type, "double"))
- {
- return W32API_DOUBLE;
- }
- else if (!strcmp(type, "float"))
- {
- return W32API_FLOAT;
- }
- else if (!strcmp(type, "void"))
- {
- return W32API_NULL;
- }
- else
- {
- if(zend_hash_exists(WG(types), type, strlen(type) +1))
- {
- return W32API_COMPLEX;
- }
- else
- {
- return W32API_UNKNOWN;
- }
- }
-}
-
-static void php_w32api_init_type(w32api_type_handle *th, zval *obj TSRMLS_DC)
-{
- w32api_type_instance *ti;
- zval *rsrc_handle = NULL;
-
- ti = emalloc(sizeof(w32api_type_instance));
-
- if(!obj)
- MAKE_STD_ZVAL(obj);
-
- object_init_ex(obj, WG(type_ce));
-
- ti->type = th;
- ti->values = emalloc(sizeof(zval *) * th->member_count);
- memset(ti->values, '\0', sizeof(zval *) * th->member_count);
-
- MAKE_STD_ZVAL(rsrc_handle);
- ZEND_REGISTER_RESOURCE(rsrc_handle, ti, WG(le_type_instance));
-
- zend_hash_index_update(Z_OBJPROP_P(obj), 0, &rsrc_handle, sizeof(zval *), NULL);
-}
-
-
-static int php_w32api_do_prop_get(zval *object, zval *return_value, zend_llist_element **element TSRMLS_DC)
-{
- w32api_type_instance *th;
- zval **type_instance_handle;
- members *current_member;
- char *property_name;
- int i = 0;
-
- zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &type_instance_handle);
-
- th = (w32api_type_instance *)zend_fetch_resource(type_instance_handle TSRMLS_CC,
- -1, "Complex Type Instance", NULL,
- 1, WG(le_type_instance));
-
- if(!th)
- return FAILURE;
-
- property_name = Z_STRVAL(((zend_overloaded_element *)(*element)->data)->element);
-
- current_member = th->type->member_list;
-
- while(strcmp(current_member->member->member_name, property_name) != 0)
- {
- i++;
-
- if(current_member->next_member != NULL)
- current_member = current_member->next_member;
- else
- return FAILURE;
- }
-
- *return_value = *(th->values[i]);
- zval_copy_ctor(return_value);
-
- return SUCCESS;
-}
-
-static int php_w32api_do_prop_set(zval *object, zval *value, zend_llist_element **element TSRMLS_DC)
-{
- w32api_type_instance *th;
- zval **type_instance_handle;
- zval *new_var;
- members *current_member;
- char *property_name;
- int i = 0;
-
- zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &type_instance_handle);
-
- th = (w32api_type_instance *)zend_fetch_resource(type_instance_handle TSRMLS_CC,
- -1, "Complex Type Instance", NULL,
- 1, WG(le_type_instance));
-
- if(!th)
- return FAILURE;
-
- property_name = Z_STRVAL(((zend_overloaded_element *)(*element)->data)->element);
-
- current_member = th->type->member_list;
-
- while(strcmp(current_member->member->member_name, property_name) != 0)
- {
- i++;
-
- if(current_member->next_member != NULL)
- current_member = current_member->next_member;
- else
- return FAILURE;
- }
-
- if(current_member->member->flags & BYREF_FORCE)
- {
- if(th->values[i])
- zval_ptr_dtor(&th->values[i]);
-
- MAKE_STD_ZVAL(new_var);
- *new_var = *value;
- zval_copy_ctor(new_var);
- th->values[i] = new_var;
-
- }
- else
- {
- th->values[i] = value;
- zval_add_ref(&value);
- }
-
- return SUCCESS;
-}
-
-w32api_result php_w32api_do_dynamic_dll_call(w32api_func_handle *fh, int argc, w32api_dynamic_param *params, void *return_buffer, int return_buffer_size)
-{
-
- /**
- * Theory Behind Implementation
- * ============================
- * We have four main jobs:
- * 1) Push arguments onto stach aligned at 4 bytes.
- * 2) Call Function
- * 3) Get Return Values
- * 4) Perform any cleanup needed.
- *
- * Pushing arguments onto the stack is fairly simple, just push from right to left
- * so for a function with the prototype int sum(int a, int b) we would push b and
- * then a in that order.
- *
- * Calling the function is fine as we already have the pointer to the function which
- * we can use with call [function_pointer] to make the actual call.
- *
- * Return values are where we begin to get complicated. Now for simple return values up
- * to 8 bytes they are returned via the EAX/EDX register pair. This means we can just
- * copy the EAX/EDX pair to the win32_result sturcture and be sure we get any simple
- * return type. If the return type is more than 8 bytes then things get complicated.
- * When calling we must pass a hidden argument on the stach which points to a tempory
- * buffer with enough memory to hold the return value, this return value is then copied
- * to the correct varaible by us. Microsoft being the nice bunnies they are, decided to
- * copy an optimization Borland introduced under win16 which is to pass structs of under
- * 8 bytes directly via EAX/EDX pair. One final notable exception is dealing with floating
- * point return types where we need to retrive the floating point number of the systems
- * math coprocessor stack using the fstp call.
- *
- * Finally if its a __cdecl call we have to clean up the stack, otherwise the callee does this.
- *
- */
-
- w32api_result result = { 0 };
- DWORD *stack_pointer, stack_size = 0, eaxv, edxv;
- BYTE *arg_ptr = NULL;
- int size = 0, i = 0;
- FARPROC fp = fh->handle;
-
- _asm mov stack_pointer, esp // Store stack pointer (esp) in stack_pointer
- _asm sub esp, 0x100 // Give ourselves 256 bytes on the stack
-
-
- for(i = (argc - 1); i >= 0; i--)
- {
- size = (params[i].width + 3)/4 * 4;
- arg_ptr = (unsigned char *)params[i].argument_ptr + size - 4;
- stack_size += (unsigned long)size;
-
- while(size > 0)
- {
- stack_pointer--;
- if(params[i].flags == W32API_ARGPTR)
- {
- *stack_pointer = *(unsigned long *)arg_ptr;
- arg_ptr -= 4;
- }
- else
- {
- *stack_pointer = params[i].argument;
- }
-
- size -= 4;
- }
- }
-
- if((return_buffer) && ((fh->flags & W32API_BORLAND) || (return_buffer_size > 8)))
- {
-
- stack_size += 4;
- stack_pointer--;
- *stack_pointer = (unsigned long)return_buffer;
- }
-
- _asm add esp, 0x100
- _asm sub esp, stack_size
- _asm call [fp]
- _asm mov eaxv, eax
- _asm mov edxv, edx
-
- if(fh->flags & W32API_CDECL)
- {
- _asm add esp, stack_size
- }
-
- if(fh->flags & W32API_REAL4)
- _asm fstp dword ptr [result]
- else if (fh->flags & W32API_REAL8)
- _asm fstp qword ptr [result]
- else if (!return_buffer)
- {
- _asm mov eax, [eaxv]
- _asm mov edx, [edxv]
- _asm mov DWORD PTR [result], eax
- _asm mov DWORD PTR [result + 4], edx
- }
- else if (!(fh->flags & W32API_BORLAND) && (return_buffer_size <= 8))
- {
- _asm mov ecx, DWORD PTR [return_buffer]
- _asm mov eax, [eaxv]
- _asm mov DWORD PTR [ecx], eax
- _asm mov edx, [edxv]
- _asm mov DWORD PTR [ecx + 4], edx
- }
-
- return result;
-}
-
-void php_w32api_marshall_zval_to_c(argument *arg, w32api_dynamic_param *dp, zval *pzval TSRMLS_DC)
-{
- dp->flags = 0;
-
- /* We should have been passed a write reference when
- * BYREF_FORCE is Set so we just add a reference
- * when we pass it to the function,
- * TODO: register the reference internally for safe unreferencing
- */
-
- switch(arg->type_id)
- {
- case W32API_INT:
- convert_to_long_ex(&pzval);
- if(arg->flags & BYREF_FORCE)
- {
- dp->argument = (unsigned long)&pzval->value.lval;
- dp->width = sizeof(int *);
-
- }
- else
- {
- dp->argument = (int)pzval->value.lval;
- dp->width = sizeof(int);
- }
- break;
- case W32API_LONG:
- convert_to_long_ex(&pzval);
-
- if(arg->flags & BYREF_FORCE)
- {
- dp->argument = (unsigned long)&pzval->value.lval;
- dp->width = sizeof(int *);
- zval_add_ref(&pzval);
- }
- else
- {
- dp->argument = pzval->value.lval;
- dp->width = sizeof(int);
- }
- break;
- case W32API_STRING:
-
- convert_to_string_ex(&pzval);
- if(!(arg->flags & BYREF_FORCE))
- {
- /* Need to free this when we demarshall */
- dp->argument = (unsigned long)estrndup(Z_STRVAL_P(pzval), Z_STRLEN_P(pzval));
- }
- else
- {
- dp->argument = (unsigned long)Z_STRVAL_P(pzval);
- zval_add_ref(&pzval);
- }
-
- dp->width = sizeof(char *);
- break;
-
- case W32API_DOUBLE:
- convert_to_double_ex(&pzval);
-
- if(arg->flags & BYREF_FORCE)
- {
- dp->argument = (unsigned long)&pzval->value.dval;
- dp->width = sizeof(double *);
- zval_add_ref(&pzval);
- }
- else
- {
- dp->argument_ptr = &pzval->value.dval;
- dp->width = sizeof(double);
- dp->flags = W32API_ARGPTR;
- }
- break;
- case W32API_FLOAT:
- convert_to_double_ex(&pzval);
-
- if(arg->flags & BYREF_FORCE)
- {
- dp->argument = (unsigned long)&pzval->value.dval;
- dp->width = sizeof(double *);
- zval_add_ref(&pzval);
- }
- else
- {
- dp->argument_ptr = &pzval->value.dval;
- dp->width = sizeof(float);
- dp->flags = W32API_ARGPTR;
- }
- break;
- case W32API_BYTE:
- /* Thanks sterling */
- convert_to_string_ex(&pzval);
- if(arg->flags & BYREF_FORCE)
- {
- dp->argument = (unsigned long)&Z_STRVAL_P(pzval);
- dp->width = sizeof(char *);
- zval_add_ref(&pzval);
- }
- else
- {
- dp->argument = (char)Z_STRVAL_P(pzval)[0];
- dp->width = sizeof(char);
- }
- break;
- case W32API_BOOL:
- convert_to_boolean_ex(&pzval);
-
- if(arg->flags & BYREF_FORCE)
- {
- dp->argument = (unsigned long)&pzval->value.lval;
- dp->width = sizeof(int *);
- zval_add_ref(&pzval);
- }
- else
- {
- dp->argument = (int)pzval->value.lval;
- dp->width = sizeof(int);
- }
- break;
- case W32API_COMPLEX:
- if(Z_TYPE_P(pzval) != IS_OBJECT)
- {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Variable passed as complex value is not an object");
- break;
- }
-
- if(arg->flags & BYREF_FORCE)
- {
- int width= 0;
- void **ptr = NULL;
- ptr = emalloc(sizeof(void *));
- *ptr = php_w32api_complex_marshall_zval_to_c(pzval, &width, NULL TSRMLS_CC);
- dp->argument = (unsigned long)ptr;
- dp->width = width;
- }
- else
- {
- int width= 0;
- dp->argument_ptr = php_w32api_complex_marshall_zval_to_c(pzval, &width, NULL TSRMLS_CC);
- dp->width = width;
- }
- break;
-
- case W32API_UNKNOWN:
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unknown type when calling function, marshalling failed");
- break;
- }
-
-}
-
-static void *php_w32api_complex_marshall_zval_to_c(zval *pzval, int *width, void *return_value TSRMLS_DC)
-{
- w32api_type_instance *th;
- zval **type_instance_handle;
- members *current_member;
- char *offset = return_value;
- int i = 0;
-
-
- if(return_value == NULL)
- {
- /* First call */
-/* return_value = emalloc(th->type->size);
-
- zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &type_instance_handle);
- th = (w32api_type_instance *)zend_fetch_resource(type_instance_handle TSRMLS_CC,
- -1, "Complex Type Instance", NULL,
- 1, WG(le_type_instance));
-
- if(!th)
- return NULL;
-
-
- for(i = 0; i < th->type->member_count; i++)
- {
-
-
- }
-*/ }
-
-
-}
-
-
-/* =====================================================================================================
- * Win32 Class Code
- * =====================================================================================================
- */
-
-/* {{{ win32_class_functions[]
- */
-function_entry win32_class_functions[] = {
- W32API_CLASS_FE(win32, registerfunction, NULL)
- W32API_CLASS_FE(win32, unregisterfunction, NULL)
- W32API_CLASS_FE(win32, registercallback, NULL)
- W32API_CLASS_FE(win32, definetype, NULL)
- W32API_CLASS_FE(win32, gettypesize, NULL)
- W32API_CLASS_FE(win32, inittype, NULL)
- W32API_CLASS_FE(win32, decref, NULL)
-#ifndef NDEBUG
- W32API_CLASS_FE(win32, dump_function_hash, NULL)
- W32API_CLASS_FE(win32, dump_library_hash, NULL)
- W32API_CLASS_FE(win32, dump_callback_hash, NULL)
- W32API_CLASS_FE(win32, dump_type_hash, NULL)
-#endif
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ win32_class_init(TSRMLS_D)
- */
-int win32_class_init(TSRMLS_D)
-{
- zend_class_entry ce;
-
- INIT_CLASS_ENTRY(ce,
- "win32",
- win32_class_functions);
-
- WG(win32_ce) = zend_register_internal_class(&ce TSRMLS_CC);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ win32_class_rshutdown(TSRMLS_D)
- * Cleans up at the end of the shutdown removing and freeing anything we added to the function
- * table.
- */
-int win32_class_rshutdown(TSRMLS_D)
-{
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto: int Win32::RegisterFunction(string definition [, int flags])
- * Registers and Loads a function from an underlying Dll
- */
-W32API_CLASS_FUNCTION(win32, registerfunction)
-{
- char *function_definition = NULL;
- int function_definition_len;
- long flags = 0;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l",
- &function_definition,
- &function_definition_len,
- &flags) == FAILURE)
- {
- return;
- }
-
- if(php_w32api_load_function(function_definition, function_definition_len, flags TSRMLS_CC) != SUCCESS)
- {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Registering Function %s failed", function_definition);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-
-
-}
-/* }}} */
-
-/* {{{ proto: int Win32::UnregisterFunction(string function_name)
- * Unregisters a previously loaded function
- */
-W32API_CLASS_FUNCTION(win32, unregisterfunction)
-{
- char *function_name = NULL;
- int function_name_len;
- w32api_func_handle **fh = NULL;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l",
- &function_name,
- &function_name_len) == FAILURE)
- {
- return;
- }
-
- /* Our deleteor handler removes us from the WG(win32_ce)->function_table
- * so no need to delete specifically from there
- */
- zend_hash_del(WG(funcs), function_name, strlen(function_name) + 1);
-
- RETURN_TRUE;
-
-}
-/* }}} */
-
-/* {{{ proto: int Win32::RegisterCallback(string definition)
- * Registers a callback type
- */
-W32API_CLASS_FUNCTION(win32, registercallback)
-{
- char *function_definition = NULL;
- int function_definition_len;
- w32api_func_handle **fh = NULL;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l",
- &function_definition,
- &function_definition_len) == FAILURE)
- {
- return;
- }
-
- if(php_w32api_register_callback(function_definition, function_definition_len TSRMLS_CC) != SUCCESS)
- {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-
-}
-/* }}} */
-
-
-/* {{{ proto: int Win32::DefineType(string definition)
- * Defines a C Like Type for use.
- */
-W32API_CLASS_FUNCTION(win32, definetype)
-{
- char *type_definition = NULL;
- int type_definition_len;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
- &type_definition,
- &type_definition_len) == FAILURE)
- {
- return;
- }
-
- if(php_w32api_register_type(type_definition, type_definition_len TSRMLS_CC) != SUCCESS)
- {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Registering Type %s failed", type_definition);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-
-}
-/* }}} */
-
-/* {{{ proto: int Win32::GetTypeSize(string type_name)
- * Returns the size of a registered type
- */
-W32API_CLASS_FUNCTION(win32, gettypesize)
-{
- char *type = NULL;
- int type_len;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
- &type,
- &type_len) == FAILURE)
- {
- return;
- }
-
- RETURN_LONG(php_w32api_get_type_size(php_w32api_get_type_id_from_name(type), type, BYREF_NONE));
-
-
-}
-/* }}} */
-
-/* {{{ proto: int Win32::InitType(string TypeName)
- * Creates an instance of type TypeName
- */
-W32API_CLASS_FUNCTION(win32, inittype)
-{
- char *type_name = NULL;
- int type_name_len = 0;
- w32api_type_handle **th = NULL;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
- &type_name, &type_name_len) == FAILURE)
- {
- return;
- }
-
- if(zend_hash_find(WG(types), type_name, type_name_len +1, (void **)&th) == FAILURE)
- {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not retrieve type handle for type %s from hash table", type_name);
- RETURN_FALSE;
- }
-
- php_w32api_init_type(*th, return_value TSRMLS_CC);
-
-}
-/* }}} */
-
-/* {{{ proto: int Win32::DecRef(mixed Variable)
- * Decreases the reference count on a variable
- */
-W32API_CLASS_FUNCTION(win32, decref)
-{
-
-}
-/* }}} */
-
-/* {{{ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- * THIS FUNCTION IS NOT PUBLICALLY ACCESSABLE
- * IT IS USED AS A GENERIC HANDLER FOR W32API
- * CALLS.
- */
-W32API_CLASS_FUNCTION(win32, invokefunction)
-{
- char *function_name = get_active_function_name(TSRMLS_C);
- int argc = ZEND_NUM_ARGS();
- int i = 0;
- w32api_dynamic_param *params = NULL;
- w32api_dynamic_param *current_dynamic_param = NULL;
- w32api_func_handle **fh = NULL;
- w32api_result res = {0};
- void *w32api_return_buffer = NULL;
- int w32api_return_buffer_size = 0;
- zval **func_arguments = NULL;
- zval *current_zval = NULL;
- arguments *curr_arg = NULL;
- w32api_type_handle *th = NULL;
-
- if(zend_hash_find(WG(funcs), function_name, strlen(function_name) +1, (void **)&fh) == FAILURE)
- {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not retrieve function handle from hash table");
- RETURN_FALSE;
- }
-
- if(argc)
- {
- if(zend_get_parameters_array_ex(argc, &func_arguments) == FAILURE)
- {
- WRONG_PARAM_COUNT
- }
-
- params = (w32api_dynamic_param *)emalloc(sizeof(w32api_dynamic_param) * argc);
-
- curr_arg = (*fh)->argument_list;
- current_dynamic_param = params;
-
- for(i = 0; i < argc; i++)
- {
- current_zval = func_arguments[i];
- php_w32api_marshall_zval_to_c(curr_arg->arg, current_dynamic_param, current_zval TSRMLS_CC);
-
- current_dynamic_param++;
- curr_arg = curr_arg->next_arg;
- }
- }
- else
- {
- params = NULL;
- }
-
- if((*fh)->return_type_id == W32API_COMPLEX)
- {
- if(zend_hash_find(WG(types), (*fh)->return_type_name, strlen((*fh)->return_type_name) +1, (void **)&th) != SUCCESS)
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not find type handle for type %s", (*fh)->return_type_name);
-
- w32api_return_buffer = emalloc(th->size);
- w32api_return_buffer_size = th->size;
- }
-
-
-
- res = php_w32api_do_dynamic_dll_call(*fh, argc, params, w32api_return_buffer, w32api_return_buffer_size);
-
- if(argc)
- /* We should demarshall here not just efree */
- efree(params);
-
- switch((*fh)->return_type_id)
- {
- case W32API_LONG:
- RETURN_LONG(res.lval);
- break;
- case W32API_INT:
- RETURN_LONG(res.ival);
- break;
- case W32API_STRING:
- case W32API_BYTE:
- RETURN_STRING(res.ptr, 1);
- break;
- case W32API_DOUBLE:
- RETURN_DOUBLE(res.dval);
- break;
- case W32API_FLOAT:
- RETURN_DOUBLE(res.fval);
- break;
- case W32API_BOOL:
- if(res.ival)
- {
- RETURN_TRUE;
- }
- else
- {
- RETURN_FALSE;
- }
- break;
- case W32API_COMPLEX:
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown return type %s", (*fh)->return_type_name);
- }
-
-}
-/* }}} */
-
-#ifndef NDEBUG
-W32API_CLASS_FUNCTION(win32, dump_library_hash)
-{
- zend_hash_apply(WG(libraries), (apply_func_t)php_w32api_dump_library_hash_cb TSRMLS_CC);
-}
-
-W32API_CLASS_FUNCTION(win32, dump_function_hash)
-{
- zend_hash_apply(WG(funcs), (apply_func_t)php_w32api_dump_function_hash_cb TSRMLS_CC);
-}
-
-W32API_CLASS_FUNCTION(win32, dump_callback_hash)
-{
-
- zend_hash_apply(WG(callbacks), (apply_func_t)php_w32api_dump_callback_hash_cb TSRMLS_CC);
-}
-
-
-W32API_CLASS_FUNCTION(win32, dump_type_hash)
-{
-
- zend_hash_apply(WG(types), (apply_func_t)php_w32api_dump_type_hash_cb TSRMLS_CC);
-}
-
-int php_w32api_dump_library_hash_cb(void *pData TSRMLS_DC)
-{
- w32api_lib_handle *lh = pData;
-
- printf("=====================================================================\n");
- printf("Library Name: \t\t%s\n", lh->library_name);
- printf("Reference Count: \t\t%d\n", lh->ref_count);
- printf("Library Handle: \t\t%p\n", lh->handle);
- printf("Lib ptr loc \t\t%p\n", lh);
- printf("ll n loc \t\t%p\n", &lh->ref_count);
-
- printf("=====================================================================\n");
-
- return 0;
-}
-
-int php_w32api_dump_function_hash_cb(void *pData TSRMLS_DC)
-{
- w32api_func_handle **fh = pData;
-
- printf("=====================================================================\n");
- printf("Function Name: \t\t%s\n", (*fh)->function_name);
- printf("Return Type Name: \t\t%s\n", (*fh)->return_type_name);
- printf("Library Name: \t\t%s\n", (*fh)->lib->library_name );
- printf("Function Flags: \t\t%d\n", (*fh)->flags);
- printf("Function Handle: \t\t%p\n", (*fh)->handle);
- printf("Return Type ID: \t\t%d\n", (*fh)->return_type_id);
- printf("Return Type Name: \t\t%s\n", (*fh)->return_type_name);
- printf("## Arguments ##\n");
- printf("---------------------------------------------------------------------\n");
- php_w32api_print_arguments((*fh)->argument_list);
- printf("=====================================================================\n\n");
-
- return 0;
-}
-
-int php_w32api_dump_callback_hash_cb(void *pData TSRMLS_DC)
-{
- w32api_func_handle **fh = pData;
-
- printf("=====================================================================\n");
- printf("Callback Name: \t\t%s\n", (*fh)->function_name);
- printf("Return Type Name: \t\t%s\n", (*fh)->return_type_name);
- printf("Callback Flags: \t\t%d\n", (*fh)->flags);
- printf("Return Type ID: \t\t%d\n", (*fh)->return_type_id);
- printf("Return Type Name: \t\t%s\n", (*fh)->return_type_name);
- printf("## Arguments ##\n");
- printf("---------------------------------------------------------------------\n");
- php_w32api_print_arguments((*fh)->argument_list);
- printf("=====================================================================\n\n");
-
- return 0;
-}
-
-int php_w32api_dump_type_hash_cb(void *pData TSRMLS_DC)
-{
- w32api_type_handle **th = pData;
-
-
- printf("=====================================================================\n");
- printf("Type Name: \t\t%s\n", (*th)->type_name);
- printf("Type Size: \t\t%d\n", (*th)->size);
- printf("Member Count: \t\t%d\n", (*th)->member_count);
- printf("## Members ##\n");
- printf("---------------------------------------------------------------------\n");
- php_w32api_print_members((*th)->member_list);
- printf("=====================================================================\n\n");
-
- return 0;
-}
-
-void php_w32api_print_members(members *member_list)
-{
- if(member_list == NULL)
- return;
-
- printf("\tMember Name: \t%s\n", member_list->member->member_name);
- printf("\tMember Flags: \t%d\n", member_list->member->flags);
- printf("\tMember Type ID: \t%d\n", member_list->member->member_type_id);
- printf("\tMember Type Name:\t%s\n", member_list->member->member_type_name);
- printf("\tMember Offset: \t%d\n", member_list->member->offset);
- printf("---------------------------------------------------------------------\n");
-
- php_w32api_print_members(member_list->next_member);
-
-}
-void php_w32api_print_arguments(arguments *argument_list)
-{
- if(argument_list == NULL)
- return;
-
- printf("\tArgument Name: \t%s\n", argument_list->arg->argument_name);
- printf("\tArgument Flags: \t%d\n", argument_list->arg->flags);
- printf("\tArgument Type ID:\t%d\n", argument_list->arg->type_id);
- printf("\tArg Type Name: \t%s\n", argument_list->arg->type_name);
- printf("---------------------------------------------------------------------\n");
-
- php_w32api_print_arguments(argument_list->next_arg);
-}
-#endif
-/* =====================================================================================================
- * Type Class Code
- * =====================================================================================================
- */
-
-/* {{{ type_class_functions[]
- */
-function_entry type_class_functions[] = {
- W32API_CLASS_FE(type, clone, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-
-/* {{{ type_class_init(TSRMLS_DC)
- */
-int type_class_init(TSRMLS_D)
-{
- zend_class_entry ce;
-
- INIT_OVERLOADED_CLASS_ENTRY(ce,
- "type",
- type_class_functions,
- NULL,
- W32API_PROP_GET_FUNCTION_N(type),
- W32API_PROP_SET_FUNCTION_N(type));
-
- WG(type_ce) = zend_register_internal_class(&ce TSRMLS_CC);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ W32API_PROP_SET_FUNCTION(type)
- */
-/* Most of this code is borrowed from php-gtk. Thanks to Andrei and Zeev for their
- * help with the prop-get/set functions
- */
-W32API_PROP_SET_FUNCTION(type)
-{
- zval result, temp;
- zval *temp_ptr = &temp;
- zval *new_val;
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
- zval **object = &property_reference->object;
- int setter_retval, getter_retval;
- TSRMLS_FETCH();
-
-
- /* If we have $foo->bar->baz->boo->bin we have to do sucessive propgets
- * Until we can do our prop set (thanks Zeev, Andrei)
- */
- for (element=property_reference->elements_list->head; element != property_reference->elements_list->tail; element=element->next) {
- overloaded_property = (zend_overloaded_element *)element->data;
-
- getter_retval = FAILURE;
- if (Z_TYPE_P(overloaded_property) == OE_IS_OBJECT) {
- if (Z_TYPE_PP(object) == IS_NULL ||
- (Z_TYPE_PP(object) == IS_BOOL && Z_LVAL_PP(object) == 0) ||
- (Z_TYPE_PP(object) == IS_STRING && Z_STRLEN_PP(object) == 0)) {
- object_init(*object);
- }
-
-
- /* Trying to access a property on a non-object. */
- if (Z_TYPE_PP(object) != IS_OBJECT) {
- return FAILURE;
- }
-
- getter_retval = php_w32api_do_prop_get(*object, &result, &element TSRMLS_CC);
-
- if (getter_retval == SUCCESS) {
- temp = result;
- object = &temp_ptr;
- } else {
- if ((getter_retval = zend_hash_find(Z_OBJPROP_PP(object),
- Z_STRVAL(overloaded_property->element),
- Z_STRLEN(overloaded_property->element)+1,
- (void **)&object)) == FAILURE) {
- MAKE_STD_ZVAL(new_val);
- ZVAL_NULL(new_val);
- zend_hash_update(Z_OBJPROP_PP(object),
- Z_STRVAL(overloaded_property->element),
- Z_STRLEN(overloaded_property->element)+1,
- &new_val, sizeof(void *), (void **)&object);
- }
- }
-
- } else if (Z_TYPE_P(overloaded_property) == OE_IS_ARRAY) {
- if (Z_TYPE_PP(object) == IS_NULL ||
- (Z_TYPE_PP(object) == IS_BOOL && Z_LVAL_PP(object) == 0) ||
- (Z_TYPE_PP(object) == IS_STRING && Z_STRLEN_PP(object) == 0)) {
- array_init(*object);
- }
-
- /* Trying to access index on a non-array. */
- if (Z_TYPE_PP(object) != IS_ARRAY) {
- return FAILURE;
- }
-
- if (Z_TYPE(overloaded_property->element) == IS_STRING) {
- getter_retval = zend_hash_find(Z_ARRVAL_PP(object),
- Z_STRVAL(overloaded_property->element),
- Z_STRLEN(overloaded_property->element)+1,
- (void **)&object);
- } else if (Z_TYPE(overloaded_property->element) == IS_LONG) {
- getter_retval = zend_hash_index_find(Z_ARRVAL_PP(object),
- Z_LVAL(overloaded_property->element),
- (void **)&object);
- }
-
- if (getter_retval == FAILURE) {
- MAKE_STD_ZVAL(new_val);
- ZVAL_NULL(new_val);
-
- if (Z_TYPE(overloaded_property->element) == IS_STRING) {
- zend_hash_update(Z_ARRVAL_PP(object),
- Z_STRVAL(overloaded_property->element),
- Z_STRLEN(overloaded_property->element)+1,
- &new_val, sizeof(void *), (void **)&object);
- } else if (Z_TYPE(overloaded_property->element) == IS_LONG) {
- zend_hash_index_update(Z_ARRVAL_PP(object),
- Z_LVAL(overloaded_property->element),
- &new_val, sizeof(void *), (void **)&object);
- }
- }
- }
-
- zval_dtor(&overloaded_property->element);
- }
-
- /* object is now the object we want to set our property on */
- overloaded_property = (zend_overloaded_element *) element->data;
- setter_retval = php_w32api_do_prop_set(*object, value, &element TSRMLS_CC);
- zval_dtor(&overloaded_property->element);
-
- return setter_retval;
-
-}
-/* }}} */
-
-/* {{{ W32API_PROP_GET_FUNCTION(type)
- */
-W32API_PROP_GET_FUNCTION(type)
-{
- zval result;
- zval *result_ptr = &result;
- zval **prop_result;
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
- zval object = *property_reference->object;
- int getter_retval;
- TSRMLS_FETCH();
-
- for (element=property_reference->elements_list->head; element; element=element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
-
- getter_retval = FAILURE;
- ZVAL_NULL(&result);
- if (Z_TYPE_P(overloaded_property) == OE_IS_OBJECT) {
- /* Trying to access a property on a non-object. */
- if (Z_TYPE(object) != IS_OBJECT ||
- Z_TYPE(overloaded_property->element) != IS_STRING) {
- return result;
- }
-
- if ((getter_retval = php_w32api_do_prop_get(&object, &result, &element TSRMLS_CC) == FAILURE)) {
- if ((getter_retval = zend_hash_find(Z_OBJPROP(object),
- Z_STRVAL(overloaded_property->element),
- Z_STRLEN(overloaded_property->element)+1,
- (void **)&prop_result)) == SUCCESS) {
- result = **prop_result;
- }
- }
- } else if (Z_TYPE_P(overloaded_property) == OE_IS_ARRAY) {
- /* Trying to access index on a non-array. */
- if (Z_TYPE(object) != IS_ARRAY) {
- return result;
- }
-
- if (Z_TYPE(overloaded_property->element) == IS_STRING) {
- getter_retval = zend_hash_find(Z_ARRVAL(object),
- Z_STRVAL(overloaded_property->element),
- Z_STRLEN(overloaded_property->element)+1,
- (void **)&prop_result);
- } else if (Z_TYPE(overloaded_property->element) == IS_LONG) {
- getter_retval = zend_hash_index_find(Z_ARRVAL(object),
- Z_LVAL(overloaded_property->element),
- (void **)&prop_result);
- }
- if (getter_retval == SUCCESS)
- result = **prop_result;
- }
-
- zval_dtor(&overloaded_property->element);
-
- object = result;
-
- if (getter_retval == FAILURE) {
- return result;
- }
- }
-
- zval_add_ref(&result_ptr);
- SEPARATE_ZVAL(&result_ptr);
- return *result_ptr;
-}
-/* }}} */
-
-/* {{{ proto: Type Type::Clone()
- * Creates an exact clone of the object.
- */
-W32API_CLASS_FUNCTION(type, clone)
-{
-
-}
-/* }}} */
-
-/* =====================================================================================================
- * Scanner & Parser Functions
- * =====================================================================================================
- */
-
-/* -----------------------------
- * Function Definition Functions
- * -----------------------------
- */
-
-/* {{{ w32api_parser_load_function_ex
- * Callback for the parser, if the library name is cb.cb we are registering a
- * callback so the LoadLibary and GetProcAddress code is skipped
- */
-w32api_func_handle *w32api_parser_load_function_ex(char *return_type, char *function_name, char *alias_name, arguments *argument_list, char *library_name)
-{
- w32api_func_handle *return_value;
- TSRMLS_FETCH();
-
- return_value = (w32api_func_handle *)emalloc(sizeof(w32api_func_handle));
- memset(return_value, '\0', sizeof(w32api_func_handle));
-
- return_value->argument_list = argument_list;
- return_value->flags = 0;
- return_value->function_name = (alias_name)?alias_name:function_name; /* This is estrdup'd in the Scanner already!! */
- return_value->return_type_name = return_type; /* This is estrdup'd in the Scanner already!! */
- return_value->return_type_id = php_w32api_get_type_id_from_name(return_type);
-
- if(strcmp("cb.cb", library_name)) /* Bit of a hack but we are registering a callback */
- {
- php_w32api_load_library(library_name, &return_value->lib TSRMLS_CC);
-
- if(!return_value->lib)
- {
- /* php_w32api_load_library has already given error */
- efree(return_value);
- return NULL;
- }
-
- return_value->handle = GetProcAddress(return_value->lib->handle, function_name);
-
- if(!return_value->handle)
- {
- /* Check for variation ending with A */
- char *ascii_name = NULL;
-
- ascii_name = emalloc(strlen(function_name) + 2);
- strcpy(ascii_name, function_name);
- ascii_name[strlen(function_name)] = 'A';
- ascii_name[strlen(function_name) + 1] = '\0';
- return_value->handle = GetProcAddress(return_value->lib->handle, ascii_name);
- efree(ascii_name);
-
- if(!return_value->handle)
- {
- /* TODO: php_error_docref and GetLastError etc */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not load function %s", function_name);
- efree(return_value);
- return NULL;
- }
- }
- }
-
- /* We want function_name in lowercase now */
- php_strtolower(return_value->function_name, strlen(return_value->function_name));
-
- /* Free it if we have a alias */
- if(alias_name)
- efree(function_name);
-
- return return_value;
-}
-/* }}} */
-
-/* {{{ w32api_parser_make_argument
- * Helper function for the parser
- */
-arguments *w32api_parser_make_argument(char *arg_type, char *arg_name, int byref)
-{
- arguments *return_value = NULL; /* Pointer to our return value */
- argument *argument_value = NULL; /* Our actual argument */
-
- argument_value = emalloc(sizeof(argument));
- return_value = emalloc(sizeof(arguments));
-
- return_value->arg = argument_value;
- return_value->next_arg = return_value->prev_arg = NULL;
-
- argument_value->flags = byref;
- argument_value->argument_name = arg_name;
- argument_value->type_name = arg_type;
- argument_value->type_id = php_w32api_get_type_id_from_name(arg_type);
-
- if(argument_value->type_id == W32API_UNKNOWN) {
- TSRMLS_FETCH();
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown type %s used as arugment type", arg_type);
- }
-
- return return_value;
-}
-/* }}} */
-
-/* {{{ w32api_parser_join_arguments
- * Helper function for the parser
- */
-arguments *w32api_parser_join_arguments(arguments *lval, arguments *rval)
-{
- lval->next_arg = rval;
- rval->prev_arg = lval;
-
- return lval;
-}
-/* }}} */
-
-/* {{{ w32api_function_definition_error
- * Error function for the parser
- */
-int w32api_function_definition_error(char *s)
-{
- TSRMLS_FETCH();
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Function Definition Parse Error: %s", s);
- return 0;
-}
-/* }}} */
-
-/* -------------------------
- * Type Definition Functions
- * -------------------------
- */
-w32api_type_handle *w32api_parser_register_type(char *type_name, members *member_list)
-{
- w32api_type_handle *return_value = NULL;
- members *current_member;
- int offset = 0;
- int member_count = 0;
-
- return_value = emalloc(sizeof(w32api_type_handle));
-
- return_value->member_list = member_list;
- return_value->type_name = type_name; /* estrdup'd in parser */
- return_value->member_count = 0;
-
- current_member = return_value->member_list;
-
-
- while(current_member != NULL)
- {
- return_value->member_count++;
- current_member->member->offset = offset;
- offset += php_w32api_get_type_size(current_member->member->member_type_id, current_member->member->member_type_name, current_member->member->flags);
- current_member = current_member->next_member;
- }
-
-
- return_value->size = offset;
-
- return return_value;
-
-
-}
-
-members *w32api_parser_type_make_value(char *type_name, char *member_name, long flags)
-{
- members *return_value = NULL; /* Pointer to our return value */
- member *member_value = NULL; /* Our actual member */
-
- member_value = emalloc(sizeof(member));
- return_value = emalloc(sizeof(members));
-
- return_value->member = member_value;
- return_value->next_member = return_value->prev_member = NULL;
-
- member_value->member_name = member_name; /* estrdup'd in parser */
- member_value->member_type_name = type_name; /* estrdup'd in parser */
- member_value->member_type_id = php_w32api_get_type_id_from_name(type_name);
- member_value->flags = flags;
-
- return return_value;
-}
-
-
-members *w32api_parser_type_join_values(members *lval, members *rval)
-{
- lval->next_member = rval;
- rval->prev_member = lval;
-
- return lval;
-}
-
-/* {{{ w32api_function_definition_error
- * Error function for the parser
- */
-int w32api_type_definition_error(char *s)
-{
- TSRMLS_FETCH();
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Type Definition Parse Error: %s", s);
- return 0;
-}
-/* }}} */
-
-
-#endif /* HAVE_W32API */
diff --git a/ext/w32api/w32api.dsp b/ext/w32api/w32api.dsp
deleted file mode 100644
index 71eaaf57e5..0000000000
--- a/ext/w32api/w32api.dsp
+++ /dev/null
@@ -1,281 +0,0 @@
-# Microsoft Developer Studio Project File - Name="w32api" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=w32api - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "w32api.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "w32api.mak" CFG="w32api - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "w32api - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "w32api - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "w32api - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "w32api___Win32_Debug_TS"
-# PROP BASE Intermediate_Dir "w32api___Win32_Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../../Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "W32API_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "W32API_EXPORTS" /D HAVE_W32API=1 /D "COMPILE_DL_W32API" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x809 /d "_DEBUG"
-# ADD RSC /l 0x809 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../../Debug_TS/php_w32api.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "w32api - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "w32api___Win32_Release_TS"
-# PROP BASE Intermediate_Dir "w32api___Win32_Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../../Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "W32API_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "W32API_EXPORTS" /D "HAVE_W32API" /D "COMPILE_DL_W32API" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /YX /FD /c
-# SUBTRACT CPP /WX /Fr
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x809 /d "NDEBUG"
-# ADD RSC /l 0x809 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /debugtype:both /machine:I386 /out:"../../Release_TS/php_w32api.dll" /libpath:"..\..\Release_TS"
-# SUBTRACT LINK32 /incremental:yes
-
-!ENDIF
-
-# Begin Target
-
-# Name "w32api - Win32 Debug_TS"
-# Name "w32api - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\w32api.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\w32api_function_definition_parser.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\w32api_function_definition_scanner.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\w32api_type_definition_parser.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\w32api_type_definition_scanner.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_w32api.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\w32api_function_definition_parser.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\w32api_type_definition_parser.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Group "Parsers"
-
-# PROP Default_Filter ".y"
-# Begin Source File
-
-SOURCE=.\w32api_function_definition_parser.y
-
-!IF "$(CFG)" == "w32api - Win32 Debug_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\w32api_function_definition_parser.y
-
-BuildCmds= \
- bison --output=w32api_function_definition_parser.c -v -d -p w32api_function_definition_ w32api_function_definition_parser.y
-
-"$(InputDir)/w32api_function_definition_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)/w32api_function_definition_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "w32api - Win32 Release_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\w32api_function_definition_parser.y
-
-BuildCmds= \
- bison --output=w32api_function_definition_parser.c -v -d -p w32api_function_definition_ w32api_function_definition_parser.y
-
-"$(InputDir)/w32api_function_definition_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)/w32api_function_definition_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\w32api_type_definition_parser.y
-
-!IF "$(CFG)" == "w32api - Win32 Debug_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\w32api_type_definition_parser.y
-
-BuildCmds= \
- bison --output=w32api_type_definition_parser.c -v -d -p w32api_type_definition_ w32api_type_definition_parser.y
-
-"$(InputDir)/w32api_type_definition_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)/w32api_type_definition_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "w32api - Win32 Release_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\w32api_type_definition_parser.y
-
-BuildCmds= \
- bison --output=w32api_type_definition_parser.c -v -d -p w32api_type_definition_ w32api_type_definition_parser.y
-
-"$(InputDir)/w32api_type_definition_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)/w32api_type_definition_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Scanners"
-
-# PROP Default_Filter ".l"
-# Begin Source File
-
-SOURCE=.\w32api_function_definition_scanner.l
-
-!IF "$(CFG)" == "w32api - Win32 Debug_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\w32api_function_definition_scanner.l
-
-"$(InputDir)\w32api_function_definition_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Pw32api_function_definition -ow32api_function_definition_scanner.c w32api_function_definition_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "w32api - Win32 Release_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\w32api_function_definition_scanner.l
-
-"$(InputDir)\w32api_function_definition_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Pw32api_function_definition -ow32api_function_definition_scanner.c w32api_function_definition_scanner.l
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\w32api_type_definition_scanner.l
-
-!IF "$(CFG)" == "w32api - Win32 Debug_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\w32api_type_definition_scanner.l
-
-"$(InputDir)/w32api_type_definition_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Pw32api_type_definition -ow32api_type_definition_scanner.c w32api_type_definition_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "w32api - Win32 Release_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\w32api_type_definition_scanner.l
-
-"$(InputDir)/w32api_type_definition_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Pw32api_type_definition -ow32api_type_definition_scanner.c w32api_type_definition_scanner.l
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/w32api/w32api_function_definition_parser.y b/ext/w32api/w32api_function_definition_parser.y
deleted file mode 100644
index 98b2875b19..0000000000
--- a/ext/w32api/w32api_function_definition_parser.y
+++ /dev/null
@@ -1,67 +0,0 @@
-%{
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: James Moore <jmoore@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <string.h>
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-#include "php_w32api.h"
-
-
-#define YYSTYPE w32api_parser_function_definition_union
-#define YYPARSE_PARAM fh
-
-int w32api_function_definition_lex(w32api_parser_function_definition_union *funcdef_lval);
-
-%}
-
-%pure_parser
-
-%token tFROM
-%token tBYREF
-%token tALIAS
-%token <s> tIDENTIFIER
-%token <s> tFILENAME
-
-%type <arg> argument argument_list
-
-%start funcdef
-
-%%
-
-funcdef: tIDENTIFIER tIDENTIFIER tALIAS tIDENTIFIER'(' argument_list ')' tFROM tFILENAME {((w32api_func_handle_ptr *)fh)->hnd = w32api_parser_load_alias_function($1, $2, $4, $6, $9);}
- | tIDENTIFIER tIDENTIFIER '(' argument_list ')' tFROM tFILENAME {((w32api_func_handle_ptr *)fh)->hnd = w32api_parser_load_function($1, $2, $4, $7);}
-;
-
-argument_list: argument ',' argument_list { $$ = w32api_parser_join_arguments($1, $3);}
- | argument {$$ = $1;}
- | {$$ = NULL;}
-;
-
-argument: tIDENTIFIER tIDENTIFIER { $$ = w32api_parser_make_argument_byval($1, $2); }
- | tIDENTIFIER tBYREF tIDENTIFIER { $$ = w32api_parser_make_argument_byref($1, $3); }
-;
diff --git a/ext/w32api/w32api_function_definition_scanner.l b/ext/w32api/w32api_function_definition_scanner.l
deleted file mode 100644
index aaf088404b..0000000000
--- a/ext/w32api/w32api_function_definition_scanner.l
+++ /dev/null
@@ -1,63 +0,0 @@
-%{
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: James Moore <jmoore@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <string.h>
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-#include "php_w32api.h"
-#include "w32api_function_definition_parser.h"
-
-#ifdef YYSTYPE
-#undef YYSTYPE
-#endif
-
-#define YYSTYPE w32api_parser_function_definition_union
-
-#define YY_DECL int w32api_function_definition_lex(w32api_parser_function_definition_union *funcdef_lval)
-
-
-%}
-
-ID [A-Za-z][A-Za-z0-9_]*
-FILENAME {ID}\.{ID}
-
-%option noyywrap
-
-%%
-
-"from" {return tFROM;}
-"alias" {return tALIAS;}
-"&" {return tBYREF;}
-{FILENAME} {funcdef_lval->s = estrdup(yytext); return tFILENAME;}
-{ID} {funcdef_lval->s = estrdup(yytext); return tIDENTIFIER;}
-[ \r\t\n] /* Ignore Whitespace */
-. {return *yytext;}
-
-%%
-
diff --git a/ext/w32api/w32api_type_definition_parser.y b/ext/w32api/w32api_type_definition_parser.y
deleted file mode 100644
index 2e60a12b21..0000000000
--- a/ext/w32api/w32api_type_definition_parser.y
+++ /dev/null
@@ -1,67 +0,0 @@
-%{
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: James Moore <jmoore@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <string.h>
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-#include "php_w32api.h"
-
-#define YYSTYPE w32api_parser_type_definition_union
-#define YYPARSE_PARAM th
-
-int w32api_type_definition_lex(w32api_parser_type_definition_union *typedef_lval);
-
-%}
-
-%pure_parser
-
-%token <s> tTYPEID
-%token tBYREF
-
-%type <type> value_list value
-
-%%
-
-start:
- type_definition
-;
-
-type_definition:
- tTYPEID '{' value_list '}' {((w32api_type_handle_ptr *)th)->hnd = w32api_parser_register_type($1, $3);}
-;
-
-value_list:
- value ';' value_list {$$ = w32api_parser_type_join_values($1, $3);}
- | value ';' {$$ = $1;}
-;
-
-value:
- tTYPEID tTYPEID {$$ = w32api_parser_type_make_byval_value($1, $2);}
- | tTYPEID tBYREF tTYPEID {$$ = w32api_parser_type_make_byref_value($1, $3);}
-;
-
diff --git a/ext/w32api/w32api_type_definition_scanner.l b/ext/w32api/w32api_type_definition_scanner.l
deleted file mode 100644
index c6e89d0b2a..0000000000
--- a/ext/w32api/w32api_type_definition_scanner.l
+++ /dev/null
@@ -1,56 +0,0 @@
-%{
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: James Moore <jmoore@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <string.h>
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-#include "php_w32api.h"
-#include "w32api_type_definition_parser.h"
-
-#ifdef YYSTYPE
-#undef YYSTYPE
-#endif
-
-#define YYSTYPE w32api_parser_type_definition_union
-
-#define YY_DECL int w32api_type_definition_lex(w32api_parser_type_definition_union *typedef_lval)
-
-%}
-
-TYPEID [A-Za-z][A-Za-z0-9_]*
-
-%option noyywrap
-
-%%
-
-"&" {return tBYREF;}
-{TYPEID} {typedef_lval->s = estrdup(yytext); return tTYPEID;}
-[ \r\t\n] /* Ignore Whitespace */
-. {return *yytext;}
-
-%% \ No newline at end of file
diff --git a/ext/wddx/CREDITS b/ext/wddx/CREDITS
deleted file mode 100644
index 4c98513048..0000000000
--- a/ext/wddx/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-WDDX
-Andrei Zmievski
diff --git a/ext/wddx/config.m4 b/ext/wddx/config.m4
deleted file mode 100644
index 856af34f52..0000000000
--- a/ext/wddx/config.m4
+++ /dev/null
@@ -1,15 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(wddx,whether to enable WDDX support,
-[ --enable-wddx Enable WDDX support.])
-
-if test "$PHP_WDDX" != "no"; then
- if test "$ext_shared" != "yes" && test "$enable_xml" = "no"; then
- AC_MSG_WARN(Activating XML)
- enable_xml=yes
- fi
- AC_DEFINE(HAVE_WDDX, 1, [ ])
- PHP_NEW_EXTENSION(wddx, wddx.c, $ext_shared)
-fi
diff --git a/ext/wddx/php_wddx.h b/ext/wddx/php_wddx.h
deleted file mode 100644
index 4223d7c431..0000000000
--- a/ext/wddx/php_wddx.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Andrei Zmievski <andrei@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_WDDX_H
-#define PHP_WDDX_H
-
-#if HAVE_WDDX
-
-#include <expat.h>
-
-extern zend_module_entry wddx_module_entry;
-#define wddx_module_ptr &wddx_module_entry
-
-PHP_FUNCTION(wddx_serialize_value);
-PHP_FUNCTION(wddx_serialize_vars);
-PHP_FUNCTION(wddx_packet_start);
-PHP_FUNCTION(wddx_packet_end);
-PHP_FUNCTION(wddx_add_vars);
-PHP_FUNCTION(wddx_deserialize);
-
-#else
-
-#define wddx_module_ptr NULL
-
-#endif /* HAVE_WDDX */
-
-#define phpext_wddx_ptr wddx_module_ptr
-
-#endif /* !PHP_WDDX_H */
diff --git a/ext/wddx/php_wddx_api.h b/ext/wddx/php_wddx_api.h
deleted file mode 100644
index 313feb037e..0000000000
--- a/ext/wddx/php_wddx_api.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Andrei Zmievski <andrei@ispi.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_WDDX_API_H
-#define PHP_WDDX_API_H
-
-#include "ext/standard/php_smart_str.h"
-
-#define WDDX_ARRAY_S "<array length='%d'>"
-#define WDDX_ARRAY_E "</array>"
-#define WDDX_BINARY_S "<binary>"
-#define WDDX_BINARY_E "</binary>"
-#define WDDX_BOOLEAN "<boolean value='%s'/>"
-#define WDDX_CHAR "<char code='%02X'/>"
-#define WDDX_COMMENT_S "<comment>"
-#define WDDX_COMMENT_E "</comment>"
-#define WDDX_DATA_S "<data>"
-#define WDDX_DATA_E "</data>"
-#define WDDX_HEADER "<header/>"
-#define WDDX_HEADER_S "<header>"
-#define WDDX_HEADER_E "</header>"
-#define WDDX_NULL "<null/>"
-#define WDDX_NUMBER "<number>%s</number>"
-#define WDDX_PACKET_S "<wddxPacket version='1.0'>"
-#define WDDX_PACKET_E "</wddxPacket>"
-#define WDDX_STRING_S "<string>"
-#define WDDX_STRING_E "</string>"
-#define WDDX_STRUCT_S "<struct>"
-#define WDDX_STRUCT_E "</struct>"
-#define WDDX_VAR_S "<var name='%s'>"
-#define WDDX_VAR_E "</var>"
-
-#define php_wddx_add_chunk(packet, str) smart_str_appends(packet, str)
-#define php_wddx_add_chunk_ex(packet, str, len) smart_str_appendl(packet, str, len)
-#define php_wddx_add_chunk_static(packet, str) smart_str_appendl(packet, str, sizeof(str)-1)
-
-typedef smart_str wddx_packet;
-
-wddx_packet* php_wddx_constructor(void);
-void php_wddx_destructor(wddx_packet *packet);
-
-void php_wddx_packet_start(wddx_packet *packet, char *comment, int comment_len);
-void php_wddx_packet_end(wddx_packet *packet);
-
-void php_wddx_serialize_var(wddx_packet *packet, zval *var, char *name, int name_len TSRMLS_DC);
-int php_wddx_deserialize_ex(char *, int, zval *return_value);
-#define php_wddx_gather(packet) estrndup(packet->c, packet->len)
-
-#endif /* PHP_WDDX_API_H */
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
deleted file mode 100644
index f2af34979c..0000000000
--- a/ext/wddx/wddx.c
+++ /dev/null
@@ -1,1290 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Andrei Zmievski <andrei@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_wddx.h"
-
-#if HAVE_WDDX
-
-#include "php_wddx_api.h"
-#define PHP_XML_INTERNAL
-#include "ext/xml/php_xml.h"
-#include "ext/standard/php_incomplete_class.h"
-#include "ext/standard/base64.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_smart_str.h"
-#include "ext/standard/html.h"
-#include "ext/standard/php_string.h"
-
-#define WDDX_BUF_LEN 256
-#define PHP_CLASS_NAME_VAR "php_class_name"
-
-#define EL_ARRAY "array"
-#define EL_BINARY "binary"
-#define EL_BOOLEAN "boolean"
-#define EL_CHAR "char"
-#define EL_CHAR_CODE "code"
-#define EL_NULL "null"
-#define EL_NUMBER "number"
-#define EL_PACKET "wddxPacket"
-#define EL_STRING "string"
-#define EL_STRUCT "struct"
-#define EL_VALUE "value"
-#define EL_VAR "var"
-#define EL_NAME "name"
-#define EL_VERSION "version"
-#define EL_RECORDSET "recordset"
-#define EL_FIELD "field"
-
-#define php_wddx_deserialize(a,b) \
- php_wddx_deserialize_ex((a)->value.str.val, (a)->value.str.len, (b))
-
-#define SET_STACK_VARNAME \
- if (stack->varname) { \
- ent.varname = estrdup(stack->varname); \
- efree(stack->varname); \
- stack->varname = NULL; \
- } else \
- ent.varname = NULL; \
-
-static int le_wddx;
-
-typedef struct {
- zval *data;
- enum {
- ST_ARRAY,
- ST_BOOLEAN,
- ST_NULL,
- ST_NUMBER,
- ST_STRING,
- ST_BINARY,
- ST_STRUCT,
- ST_RECORDSET,
- ST_FIELD
- } type;
- char *varname;
-} st_entry;
-
-typedef struct {
- int top, max;
- char *varname;
- zend_bool done;
- void **elements;
-} wddx_stack;
-
-
-static void php_wddx_process_data(void *user_data, const char *s, int len);
-
-/* {{{ wddx_functions[]
- */
-function_entry wddx_functions[] = {
- PHP_FE(wddx_serialize_value, NULL)
- PHP_FE(wddx_serialize_vars, NULL)
- PHP_FE(wddx_packet_start, NULL)
- PHP_FE(wddx_packet_end, NULL)
- PHP_FE(wddx_add_vars, NULL)
- PHP_FE(wddx_deserialize, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-PHP_MINIT_FUNCTION(wddx);
-PHP_MINFO_FUNCTION(wddx);
-
-/* {{{ dynamically loadable module stuff */
-#ifdef COMPILE_DL_WDDX
-ZEND_GET_MODULE(wddx)
-#endif /* COMPILE_DL_WDDX */
-/* }}} */
-
-/* {{{ wddx_module_entry
- */
-zend_module_entry wddx_module_entry = {
- STANDARD_MODULE_HEADER,
- "wddx",
- wddx_functions,
- PHP_MINIT(wddx),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(wddx),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-/* {{{ wddx_stack_init
- */
-static int wddx_stack_init(wddx_stack *stack)
-{
- stack->top = 0;
- stack->elements = (void **) emalloc(sizeof(void **) * STACK_BLOCK_SIZE);
- stack->max = STACK_BLOCK_SIZE;
- stack->varname = NULL;
- stack->done = 0;
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ wddx_stack_push
- */
-static int wddx_stack_push(wddx_stack *stack, void *element, int size)
-{
- if (stack->top >= stack->max) { /* we need to allocate more memory */
- stack->elements = (void **) erealloc(stack->elements,
- (sizeof(void **) * (stack->max += STACK_BLOCK_SIZE)));
- }
- stack->elements[stack->top] = (void *) emalloc(size);
- memcpy(stack->elements[stack->top], element, size);
- return stack->top++;
-}
-/* }}} */
-
-/* {{{ wddx_stack_top
- */
-static int wddx_stack_top(wddx_stack *stack, void **element)
-{
- if (stack->top > 0) {
- *element = stack->elements[stack->top - 1];
- return SUCCESS;
- } else {
- *element = NULL;
- return FAILURE;
- }
-}
-/* }}} */
-
-/* {{{ wddx_stack_is_empty
- */
-static int wddx_stack_is_empty(wddx_stack *stack)
-{
- if (stack->top == 0) {
- return 1;
- } else {
- return 0;
- }
-}
-/* }}} */
-
-/* {{{ wddx_stack_destroy
- */
-static int wddx_stack_destroy(wddx_stack *stack)
-{
- register int i;
-
- if (stack->elements) {
- for (i = 0; i < stack->top; i++) {
- if (((st_entry *)stack->elements[i])->data)
- {
- zval_ptr_dtor(&((st_entry *)stack->elements[i])->data);
- }
- if (((st_entry *)stack->elements[i])->varname)
- efree(((st_entry *)stack->elements[i])->varname);
- efree(stack->elements[i]);
- }
- efree(stack->elements);
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ release_wddx_packet_rsrc
- */
-static void release_wddx_packet_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- smart_str *str = (smart_str *)rsrc->ptr;
- smart_str_free(str);
- efree(str);
-}
-/* }}} */
-
-#include "ext/session/php_session.h"
-
-#if HAVE_PHP_SESSION
-/* {{{ PS_SERIALIZER_ENCODE_FUNC
- */
-PS_SERIALIZER_ENCODE_FUNC(wddx)
-{
- wddx_packet *packet;
- PS_ENCODE_VARS;
-
- packet = php_wddx_constructor();
-
- php_wddx_packet_start(packet, NULL, 0);
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
-
- PS_ENCODE_LOOP(
- php_wddx_serialize_var(packet, *struc, key, key_length TSRMLS_CC);
- );
-
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
- php_wddx_packet_end(packet);
- *newstr = php_wddx_gather(packet);
- php_wddx_destructor(packet);
-
- if (newlen)
- *newlen = strlen(*newstr);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PS_SERIALIZER_DECODE_FUNC
- */
-PS_SERIALIZER_DECODE_FUNC(wddx)
-{
- zval *retval;
- zval **ent;
- char *key;
- uint key_length;
- char tmp[128];
- ulong idx;
- int hash_type;
- int ret;
-
- if (vallen == 0)
- return SUCCESS;
-
- MAKE_STD_ZVAL(retval);
-
- if ((ret = php_wddx_deserialize_ex((char *)val, vallen, retval)) == SUCCESS) {
-
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(retval));
- zend_hash_get_current_data(Z_ARRVAL_P(retval), (void **) &ent) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_P(retval))) {
- hash_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(retval), &key, &key_length, &idx, 0, NULL);
-
- switch (hash_type) {
- case HASH_KEY_IS_LONG:
- sprintf(tmp, "%ld", idx);
- key = tmp;
- /* fallthru */
- case HASH_KEY_IS_STRING:
- php_set_session_var(key, key_length-1, *ent, NULL TSRMLS_CC);
- PS_ADD_VAR(key);
- }
- }
- }
-
- zval_ptr_dtor(&retval);
-
- return ret;
-}
-/* }}} */
-#endif
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(wddx)
-{
- le_wddx = zend_register_list_destructors_ex(release_wddx_packet_rsrc, NULL, "wddx", module_number);
-
-#if HAVE_PHP_SESSION
- php_session_register_serializer("wddx",
- PS_SERIALIZER_ENCODE_NAME(wddx),
- PS_SERIALIZER_DECODE_NAME(wddx));
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(wddx)
-{
- php_info_print_table_start();
-#if HAVE_PHP_SESSION
- php_info_print_table_header(2, "WDDX Support", "enabled" );
- php_info_print_table_row(2, "WDDX Session Serializer", "enabled" );
-#else
- php_info_print_table_row(2, "WDDX Support", "enabled" );
-#endif
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ php_wddx_packet_start
- */
-void php_wddx_packet_start(wddx_packet *packet, char *comment, int comment_len)
-{
- php_wddx_add_chunk_static(packet, WDDX_PACKET_S);
- if (comment) {
- php_wddx_add_chunk_static(packet, WDDX_HEADER_S);
- php_wddx_add_chunk_static(packet, WDDX_COMMENT_S);
- php_wddx_add_chunk_ex(packet, comment, comment_len);
- php_wddx_add_chunk_static(packet, WDDX_COMMENT_E);
- php_wddx_add_chunk_static(packet, WDDX_HEADER_E);
- } else
- php_wddx_add_chunk_static(packet, WDDX_HEADER);
- php_wddx_add_chunk_static(packet, WDDX_DATA_S);
-}
-/* }}} */
-
-/* {{{ php_wddx_packet_end
- */
-void php_wddx_packet_end(wddx_packet *packet)
-{
- php_wddx_add_chunk_static(packet, WDDX_DATA_E);
- php_wddx_add_chunk_static(packet, WDDX_PACKET_E);
-}
-/* }}} */
-
-#define FLUSH_BUF() \
- if (l > 0) { \
- php_wddx_add_chunk_ex(packet, buf, l); \
- l = 0; \
- }
-
-/* {{{ php_wddx_serialize_string
- */
-static void php_wddx_serialize_string(wddx_packet *packet, zval *var)
-{
- char *buf,
- *p,
- *vend,
- control_buf[WDDX_BUF_LEN];
- int l;
-
- php_wddx_add_chunk_static(packet, WDDX_STRING_S);
-
- if (Z_STRLEN_P(var) > 0) {
- l = 0;
- vend = Z_STRVAL_P(var) + Z_STRLEN_P(var);
- buf = (char *)emalloc(Z_STRLEN_P(var) + 1);
-
- for(p = Z_STRVAL_P(var); p != vend; p++) {
- switch (*p) {
- case '<':
- FLUSH_BUF();
- php_wddx_add_chunk_static(packet, "&lt;");
- break;
-
- case '&':
- FLUSH_BUF();
- php_wddx_add_chunk_static(packet, "&amp;");
- break;
-
- case '>':
- FLUSH_BUF();
- php_wddx_add_chunk_static(packet, "&gt;");
- break;
-
- default:
- if (iscntrl((int)*p)) {
- FLUSH_BUF();
- sprintf(control_buf, WDDX_CHAR, *p);
- php_wddx_add_chunk(packet, control_buf);
- } else
- buf[l++] = *p;
- break;
- }
- }
-
- FLUSH_BUF();
- efree(buf);
- }
-
- php_wddx_add_chunk_static(packet, WDDX_STRING_E);
-}
-/* }}} */
-
-/* {{{ php_wddx_serialize_number
- */
-static void php_wddx_serialize_number(wddx_packet *packet, zval *var)
-{
- char tmp_buf[WDDX_BUF_LEN];
- zval tmp;
-
- tmp = *var;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- sprintf(tmp_buf, WDDX_NUMBER, Z_STRVAL(tmp));
- zval_dtor(&tmp);
-
- php_wddx_add_chunk(packet, tmp_buf);
-}
-/* }}} */
-
-/* {{{ php_wddx_serialize_boolean
- */
-static void php_wddx_serialize_boolean(wddx_packet *packet, zval *var)
-{
- char tmp_buf[WDDX_BUF_LEN];
-
- sprintf(tmp_buf, WDDX_BOOLEAN, Z_LVAL_P(var) ? "true" : "false");
- php_wddx_add_chunk(packet, tmp_buf);
-}
-/* }}} */
-
-/* {{{ php_wddx_serialize_unset
- */
-static void php_wddx_serialize_unset(wddx_packet *packet)
-{
- php_wddx_add_chunk_static(packet, WDDX_NULL);
-}
-/* }}} */
-
-/* {{{ php_wddx_serialize_object
- */
-static void php_wddx_serialize_object(wddx_packet *packet, zval *obj)
-{
-/* OBJECTS_FIXME */
- zval **ent, *fname, **varname;
- zval *retval = NULL;
- char *key;
- ulong idx;
- char tmp_buf[WDDX_BUF_LEN];
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(fname);
- ZVAL_STRING(fname, "__sleep", 1);
-
- /*
- * We try to call __sleep() method on object. It's supposed to return an
- * array of property names to be serialized.
- */
- if (call_user_function_ex(CG(function_table), &obj, fname, &retval, 0, 0, 1, NULL TSRMLS_CC) == SUCCESS) {
- if (retval && HASH_OF(retval)) {
- PHP_CLASS_ATTRIBUTES;
-
- PHP_SET_CLASS_ATTRIBUTES(obj);
-
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
- sprintf(tmp_buf, WDDX_VAR_S, PHP_CLASS_NAME_VAR);
- php_wddx_add_chunk(packet, tmp_buf);
- php_wddx_add_chunk_static(packet, WDDX_STRING_S);
- php_wddx_add_chunk_ex(packet, class_name, name_len);
- php_wddx_add_chunk_static(packet, WDDX_STRING_E);
- php_wddx_add_chunk_static(packet, WDDX_VAR_E);
-
- PHP_CLEANUP_CLASS_ATTRIBUTES();
-
- for (zend_hash_internal_pointer_reset(HASH_OF(retval));
- zend_hash_get_current_data(HASH_OF(retval), (void **)&varname) == SUCCESS;
- zend_hash_move_forward(HASH_OF(retval))) {
- if (Z_TYPE_PP(varname) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only containing the names of instance-variables to serialize.");
- continue;
- }
-
- if (zend_hash_find(HASH_OF(obj), Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, (void **)&ent) == SUCCESS) {
- php_wddx_serialize_var(packet, *ent, Z_STRVAL_PP(varname), Z_STRLEN_PP(varname) TSRMLS_CC);
- }
- }
-
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
- }
- } else {
- uint key_len;
-
- PHP_CLASS_ATTRIBUTES;
-
- PHP_SET_CLASS_ATTRIBUTES(obj);
-
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
- sprintf(tmp_buf, WDDX_VAR_S, PHP_CLASS_NAME_VAR);
- php_wddx_add_chunk(packet, tmp_buf);
- php_wddx_add_chunk_static(packet, WDDX_STRING_S);
- php_wddx_add_chunk_ex(packet, class_name, name_len);
- php_wddx_add_chunk_static(packet, WDDX_STRING_E);
- php_wddx_add_chunk_static(packet, WDDX_VAR_E);
-
- PHP_CLEANUP_CLASS_ATTRIBUTES();
-
- for (zend_hash_internal_pointer_reset(HASH_OF(obj));
- zend_hash_get_current_data(HASH_OF(obj), (void**)&ent) == SUCCESS;
- zend_hash_move_forward(HASH_OF(obj))) {
- if (*ent == obj)
- continue;
-
- if (zend_hash_get_current_key_ex(HASH_OF(obj), &key, &key_len, &idx, 0, NULL) == HASH_KEY_IS_STRING) {
- php_wddx_serialize_var(packet, *ent, key, key_len TSRMLS_CC);
- } else {
- key_len = sprintf(tmp_buf, "%ld", idx);
- php_wddx_serialize_var(packet, *ent, tmp_buf, key_len TSRMLS_CC);
- }
- }
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
- }
-
- zval_dtor(fname);
- FREE_ZVAL(fname);
-
- if (retval) {
- zval_ptr_dtor(&retval);
- }
-}
-/* }}} */
-
-/* {{{ php_wddx_serialize_array
- */
-static void php_wddx_serialize_array(wddx_packet *packet, zval *arr)
-{
- zval **ent;
- char *key;
- uint key_len;
- int is_struct = 0, ent_type;
- ulong idx;
- HashTable *target_hash;
- char tmp_buf[WDDX_BUF_LEN];
- ulong ind = 0;
- int type;
- TSRMLS_FETCH();
-
- target_hash = HASH_OF(arr);
-
- for (zend_hash_internal_pointer_reset(target_hash);
- zend_hash_get_current_data(target_hash, (void**)&ent) == SUCCESS;
- zend_hash_move_forward(target_hash)) {
-
- type = zend_hash_get_current_key(target_hash, &key, &idx, 0);
-
- if (type == HASH_KEY_IS_STRING) {
- is_struct = 1;
- break;
- }
-
- if (idx != ind) {
- is_struct = 1;
- break;
- }
-
- ind++;
- }
-
- if (is_struct) {
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
- } else {
- sprintf(tmp_buf, WDDX_ARRAY_S, zend_hash_num_elements(target_hash));
- php_wddx_add_chunk(packet, tmp_buf);
- }
-
- for (zend_hash_internal_pointer_reset(target_hash);
- zend_hash_get_current_data(target_hash, (void**)&ent) == SUCCESS;
- zend_hash_move_forward(target_hash)) {
- if (*ent == arr)
- continue;
-
- if (is_struct) {
- ent_type = zend_hash_get_current_key_ex(target_hash, &key, &key_len, &idx, 0, NULL);
-
- if (ent_type == HASH_KEY_IS_STRING) {
- php_wddx_serialize_var(packet, *ent, key, key_len TSRMLS_CC);
- } else {
- key_len = sprintf(tmp_buf, "%ld", idx);
- php_wddx_serialize_var(packet, *ent, tmp_buf, key_len TSRMLS_CC);
- }
- } else
- php_wddx_serialize_var(packet, *ent, NULL, 0 TSRMLS_CC);
- }
-
- if (is_struct) {
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
- } else {
- php_wddx_add_chunk_static(packet, WDDX_ARRAY_E);
- }
-}
-/* }}} */
-
-/* {{{ php_wddx_serialize_var
- */
-void php_wddx_serialize_var(wddx_packet *packet, zval *var, char *name, int name_len TSRMLS_DC)
-{
- char tmp_buf[WDDX_BUF_LEN];
- char *name_esc;
- int name_esc_len;
-
- if (name) {
- name_esc = php_escape_html_entities(name, name_len, &name_esc_len, 0, ENT_QUOTES, NULL TSRMLS_CC);
- sprintf(tmp_buf, WDDX_VAR_S, name_esc);
- php_wddx_add_chunk(packet, tmp_buf);
- efree(name_esc);
- }
-
- switch(Z_TYPE_P(var)) {
- case IS_STRING:
- php_wddx_serialize_string(packet, var);
- break;
-
- case IS_LONG:
- case IS_DOUBLE:
- php_wddx_serialize_number(packet, var);
- break;
-
- case IS_BOOL:
- php_wddx_serialize_boolean(packet, var);
- break;
-
- case IS_NULL:
- php_wddx_serialize_unset(packet);
- break;
-
- case IS_ARRAY:
- php_wddx_serialize_array(packet, var);
- break;
-
- case IS_OBJECT:
- php_wddx_serialize_object(packet, var);
- break;
- }
-
- if (name) {
- php_wddx_add_chunk_static(packet, WDDX_VAR_E);
- }
-}
-/* }}} */
-
-/* {{{ php_wddx_add_var
- */
-static void php_wddx_add_var(wddx_packet *packet, zval *name_var)
-{
- zval **val;
- HashTable *target_hash;
- TSRMLS_FETCH();
-
- if (Z_TYPE_P(name_var) == IS_STRING)
- {
- if (zend_hash_find(EG(active_symbol_table), Z_STRVAL_P(name_var),
- Z_STRLEN_P(name_var)+1, (void**)&val) != FAILURE) {
- php_wddx_serialize_var(packet, *val, Z_STRVAL_P(name_var), Z_STRLEN_P(name_var) TSRMLS_CC);
- }
- }
- else if (Z_TYPE_P(name_var) == IS_ARRAY || Z_TYPE_P(name_var) == IS_OBJECT)
- {
- target_hash = HASH_OF(name_var);
-
- zend_hash_internal_pointer_reset(target_hash);
-
- while(zend_hash_get_current_data(target_hash, (void**)&val) == SUCCESS) {
- php_wddx_add_var(packet, *val);
-
- zend_hash_move_forward(target_hash);
- }
- }
-}
-/* }}} */
-
-/* {{{ php_wddx_push_element
- */
-static void php_wddx_push_element(void *user_data, const char *name, const char **atts)
-{
- st_entry ent;
- wddx_stack *stack = (wddx_stack *)user_data;
-
- if (!strcmp(name, EL_PACKET)) {
- int i;
-
- for (i=0; atts[i]; i++) {
- if (!strcmp(atts[i], EL_VERSION)) {
- /* nothing for now */
- }
- }
- } else if (!strcmp(name, EL_STRING)) {
- ent.type = ST_STRING;
- SET_STACK_VARNAME;
-
- ALLOC_ZVAL(ent.data);
- INIT_PZVAL(ent.data);
- Z_TYPE_P(ent.data) = IS_STRING;
- Z_STRVAL_P(ent.data) = empty_string;
- Z_STRLEN_P(ent.data) = 0;
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- } else if (!strcmp(name, EL_BINARY)) {
- ent.type = ST_BINARY;
- SET_STACK_VARNAME;
-
- ALLOC_ZVAL(ent.data);
- INIT_PZVAL(ent.data);
- Z_TYPE_P(ent.data) = IS_STRING;
- Z_STRVAL_P(ent.data) = empty_string;
- Z_STRLEN_P(ent.data) = 0;
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- } else if (!strcmp(name, EL_CHAR)) {
- int i;
-
- for (i = 0; atts[i]; i++) {
- if (!strcmp(atts[i], EL_CHAR_CODE) && atts[++i] && atts[i][0]) {
- char tmp_buf[2];
-
- sprintf(tmp_buf, "%c", (char)strtol(atts[i], NULL, 16));
- php_wddx_process_data(user_data, tmp_buf, strlen(tmp_buf));
- break;
- }
- }
- } else if (!strcmp(name, EL_NUMBER)) {
- ent.type = ST_NUMBER;
- SET_STACK_VARNAME;
-
- ALLOC_ZVAL(ent.data);
- INIT_PZVAL(ent.data);
- Z_TYPE_P(ent.data) = IS_LONG;
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- } else if (!strcmp(name, EL_BOOLEAN)) {
- int i;
-
- for (i = 0; atts[i]; i++) {
- if (!strcmp(atts[i], EL_VALUE) && atts[++i] && atts[i][0]) {
- ent.type = ST_BOOLEAN;
- SET_STACK_VARNAME;
-
- ALLOC_ZVAL(ent.data);
- INIT_PZVAL(ent.data);
- Z_TYPE_P(ent.data) = IS_BOOL;
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- php_wddx_process_data(user_data, atts[i], strlen(atts[i]));
- break;
- }
- }
- } else if (!strcmp(name, EL_NULL)) {
- ent.type = ST_NULL;
- SET_STACK_VARNAME;
-
- ALLOC_ZVAL(ent.data);
- INIT_PZVAL(ent.data);
- ZVAL_NULL(ent.data);
-
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- } else if (!strcmp(name, EL_ARRAY)) {
- ent.type = ST_ARRAY;
- SET_STACK_VARNAME;
-
- ALLOC_ZVAL(ent.data);
- array_init(ent.data);
- INIT_PZVAL(ent.data);
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- } else if (!strcmp(name, EL_STRUCT)) {
- ent.type = ST_STRUCT;
- SET_STACK_VARNAME;
-
- ALLOC_ZVAL(ent.data);
- array_init(ent.data);
- INIT_PZVAL(ent.data);
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- } else if (!strcmp(name, EL_VAR)) {
- int i;
-
- for (i = 0; atts[i]; i++) {
- if (!strcmp(atts[i], EL_NAME) && atts[++i] && atts[i][0]) {
- char *decoded;
- int decoded_len;
- decoded = xml_utf8_decode(atts[i], strlen(atts[i]), &decoded_len, "ISO-8859-1");
- stack->varname = decoded;
- break;
- }
- }
- } else if (!strcmp(name, EL_RECORDSET)) {
- int i;
-
- ent.type = ST_RECORDSET;
- SET_STACK_VARNAME;
- MAKE_STD_ZVAL(ent.data);
- array_init(ent.data);
-
- for (i = 0; atts[i]; i++) {
- if (!strcmp(atts[i], "fieldNames") && atts[++i] && atts[i][0]) {
- zval *tmp;
- char *key;
- char *p1, *p2, *endp;
- char *decoded;
- int decoded_len;
-
- decoded = xml_utf8_decode(atts[i], strlen(atts[i]), &decoded_len, "ISO-8859-1");
- endp = (char *)decoded + decoded_len;
- p1 = (char *)decoded;
- while ((p2 = php_memnstr(p1, ",", sizeof(",")-1, endp)) != NULL) {
- key = estrndup(p1, p2 - p1);
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
- add_assoc_zval_ex(ent.data, key, p2 - p1 + 1, tmp);
- p1 = p2 + sizeof(",")-1;
- efree(key);
- }
-
- if (p1 <= endp) {
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
- add_assoc_zval_ex(ent.data, p1, endp - p1 + 1, tmp);
- }
-
- efree(decoded);
- break;
- }
- }
-
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- } else if (!strcmp(name, EL_FIELD)) {
- int i;
- st_entry ent;
-
- ent.type = ST_FIELD;
- ent.varname = NULL;
- ent.data = NULL;
-
- for (i = 0; atts[i]; i++) {
- if (!strcmp(atts[i], EL_NAME) && atts[++i] && atts[i][0]) {
- char *decoded;
- int decoded_len;
- st_entry *recordset;
- zval **field;
-
- decoded = xml_utf8_decode(atts[i], strlen(atts[i]), &decoded_len, "ISO-8859-1");
- if (wddx_stack_top(stack, (void**)&recordset) == SUCCESS &&
- recordset->type == ST_RECORDSET &&
- zend_hash_find(Z_ARRVAL_P(recordset->data), decoded, decoded_len+1, (void**)&field) == SUCCESS) {
- ent.data = *field;
- }
-
- efree(decoded);
- break;
- }
- }
-
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- }
-}
-/* }}} */
-
-/* {{{ php_wddx_pop_element
- */
-static void php_wddx_pop_element(void *user_data, const char *name)
-{
- st_entry *ent1, *ent2;
- wddx_stack *stack = (wddx_stack *)user_data;
- HashTable *target_hash;
- zend_class_entry *ce;
- zval *obj;
- zval *tmp;
- TSRMLS_FETCH();
-
-/* OBJECTS_FIXME */
- if (stack->top == 0)
- return;
-
- if (!strcmp(name, EL_STRING) || !strcmp(name, EL_NUMBER) ||
- !strcmp(name, EL_BOOLEAN) || !strcmp(name, EL_NULL) ||
- !strcmp(name, EL_ARRAY) || !strcmp(name, EL_STRUCT) ||
- !strcmp(name, EL_RECORDSET) || !strcmp(name, EL_BINARY)) {
- wddx_stack_top(stack, (void**)&ent1);
-
- if (!strcmp(name, EL_BINARY)) {
- int new_len=0;
- unsigned char *new_str;
-
- new_str = php_base64_decode(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data), &new_len);
- STR_FREE(Z_STRVAL_P(ent1->data));
- Z_STRVAL_P(ent1->data) = new_str;
- Z_STRLEN_P(ent1->data) = new_len;
- }
-
- /* Call __wakeup() method on the object. */
- if (Z_TYPE_P(ent1->data) == IS_OBJECT) {
- zval *fname, *retval = NULL;
-
- MAKE_STD_ZVAL(fname);
- ZVAL_STRING(fname, "__wakeup", 1);
-
- call_user_function_ex(NULL, &ent1->data, fname, &retval, 0, 0, 0, NULL TSRMLS_CC);
-
- zval_dtor(fname);
- FREE_ZVAL(fname);
- if (retval)
- zval_ptr_dtor(&retval);
- }
-
- if (stack->top > 1) {
- stack->top--;
- wddx_stack_top(stack, (void**)&ent2);
-
- /* if non-existent field */
- if (ent2->type == ST_FIELD && ent2->data == NULL) {
- zval_ptr_dtor(&ent1->data);
- efree(ent1);
- return;
- }
-
- if (Z_TYPE_P(ent2->data) == IS_ARRAY || Z_TYPE_P(ent2->data) == IS_OBJECT) {
- target_hash = HASH_OF(ent2->data);
-
- if (ent1->varname) {
- if (!strcmp(ent1->varname, PHP_CLASS_NAME_VAR) &&
- Z_TYPE_P(ent1->data) == IS_STRING && Z_STRLEN_P(ent1->data)) {
- zend_bool incomplete_class = 0;
-
- zend_str_tolower(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));
- if (zend_hash_find(EG(class_table), Z_STRVAL_P(ent1->data),
- Z_STRLEN_P(ent1->data)+1, (void **) &ce)==FAILURE) {
- incomplete_class = 1;
- ce = PHP_IC_ENTRY;
- }
-
- /* Initialize target object */
- MAKE_STD_ZVAL(obj);
- INIT_PZVAL(obj);
- object_init_ex(obj, ce);
-
- /* Merge current hashtable with object's default properties */
- zend_hash_merge(Z_OBJPROP_P(obj),
- Z_ARRVAL_P(ent2->data),
- (void (*)(void *)) zval_add_ref,
- (void *) &tmp, sizeof(zval *), 0);
-
- if (incomplete_class) {
- php_store_class_name(obj, Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));
- }
-
- /* Clean up old array entry */
- zval_ptr_dtor(&ent2->data);
-
- /* Set stack entry to point to the newly created object */
- ent2->data = obj;
-
- /* Clean up class name var entry */
- zval_ptr_dtor(&ent1->data);
- } else
- zend_hash_update(target_hash,
- ent1->varname, strlen(ent1->varname)+1,
- &ent1->data, sizeof(zval *), NULL);
- efree(ent1->varname);
- } else {
- zend_hash_next_index_insert(target_hash,
- &ent1->data,
- sizeof(zval *), NULL);
- }
- }
- efree(ent1);
- } else
- stack->done = 1;
- } else if (!strcmp(name, EL_VAR) && stack->varname) {
- efree(stack->varname);
- } else if (!strcmp(name, EL_FIELD)) {
- st_entry *ent;
- wddx_stack_top(stack, (void **)&ent);
- efree(ent);
- stack->top--;
- }
-}
-/* }}} */
-
-/* {{{ php_wddx_process_data
- */
-static void php_wddx_process_data(void *user_data, const char *s, int len)
-{
- st_entry *ent;
- wddx_stack *stack = (wddx_stack *)user_data;
- char *decoded;
- int decoded_len;
- TSRMLS_FETCH();
-
- if (!wddx_stack_is_empty(stack) && !stack->done) {
- wddx_stack_top(stack, (void**)&ent);
- switch (Z_TYPE_P(ent)) {
- case ST_STRING:
- decoded = xml_utf8_decode(s, len, &decoded_len, "ISO-8859-1");
-
- if (Z_STRLEN_P(ent->data) == 0) {
- Z_STRVAL_P(ent->data) = estrndup(decoded, decoded_len);
- Z_STRLEN_P(ent->data) = decoded_len;
- } else {
- Z_STRVAL_P(ent->data) = erealloc(Z_STRVAL_P(ent->data),
- Z_STRLEN_P(ent->data) + decoded_len + 1);
- strncpy(Z_STRVAL_P(ent->data)+Z_STRLEN_P(ent->data), decoded, decoded_len);
- Z_STRLEN_P(ent->data) += decoded_len;
- Z_STRVAL_P(ent->data)[Z_STRLEN_P(ent->data)] = '\0';
- }
-
- efree(decoded);
- break;
-
- case ST_BINARY:
- if (Z_STRLEN_P(ent->data) == 0) {
- Z_STRVAL_P(ent->data) = estrndup(s, len + 1);
- } else {
- Z_STRVAL_P(ent->data) = erealloc(Z_STRVAL_P(ent->data), Z_STRLEN_P(ent->data) + len + 1);
- memcpy(Z_STRVAL_P(ent->data) + Z_STRLEN_P(ent->data), s, len);
- }
- Z_STRLEN_P(ent->data) += len;
- Z_STRVAL_P(ent->data)[Z_STRLEN_P(ent->data)] = '\0';
- break;
-
- case ST_NUMBER:
- Z_TYPE_P(ent->data) = IS_STRING;
- Z_STRLEN_P(ent->data) = len;
- Z_STRVAL_P(ent->data) = estrndup(s, len);
- convert_scalar_to_number(ent->data TSRMLS_CC);
- break;
-
- case ST_BOOLEAN:
- if (!strcmp(s, "true"))
- Z_LVAL_P(ent->data) = 1;
- else if (!strcmp(s, "false"))
- Z_LVAL_P(ent->data) = 0;
- else {
- stack->top--;
- zval_ptr_dtor(&ent->data);
- if (ent->varname)
- efree(ent->varname);
- efree(ent);
- }
- break;
-
- default:
- break;
- }
- }
-}
-/* }}} */
-
-/* {{{ php_wddx_deserialize_ex
- */
-int php_wddx_deserialize_ex(char *value, int vallen, zval *return_value)
-{
- wddx_stack stack;
- XML_Parser parser;
- st_entry *ent;
- int retval;
-
- wddx_stack_init(&stack);
- parser = XML_ParserCreate("ISO-8859-1");
-
- XML_SetUserData(parser, &stack);
- XML_SetElementHandler(parser, php_wddx_push_element, php_wddx_pop_element);
- XML_SetCharacterDataHandler(parser, php_wddx_process_data);
-
- XML_Parse(parser, value, vallen, 1);
-
- XML_ParserFree(parser);
-
- if (stack.top == 1) {
- wddx_stack_top(&stack, (void**)&ent);
- *return_value = *(ent->data);
- zval_copy_ctor(return_value);
- retval = SUCCESS;
- } else
- retval = FAILURE;
-
- wddx_stack_destroy(&stack);
-
- return retval;
-}
-/* }}} */
-
-/* {{{ proto string wddx_serialize_value(mixed var [, string comment])
- Creates a new packet and serializes the given value */
-PHP_FUNCTION(wddx_serialize_value)
-{
- zval *var;
- char *comment = NULL;
- int comment_len = 0;
- wddx_packet *packet;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|s",
- &var, &comment, &comment_len) == FAILURE)
- return;
-
- packet = php_wddx_constructor();
-
- php_wddx_packet_start(packet, comment, comment_len);
- php_wddx_serialize_var(packet, var, NULL, 0 TSRMLS_CC);
- php_wddx_packet_end(packet);
-
- ZVAL_STRINGL(return_value, packet->c, packet->len, 1);
- smart_str_free(packet);
- efree(packet);
-}
-/* }}} */
-
-/* {{{ proto string wddx_serialize_vars(mixed var_name [, mixed ...])
- Creates a new packet and serializes given variables into a struct */
-PHP_FUNCTION(wddx_serialize_vars)
-{
- int argc, i;
- wddx_packet *packet;
- zval ***args;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1) {
- WRONG_PARAM_COUNT;
- }
-
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- packet = php_wddx_constructor();
-
- php_wddx_packet_start(packet, NULL, 0);
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
-
- for (i=0; i<argc; i++) {
- if (Z_TYPE_PP(args[i]) != IS_ARRAY && Z_TYPE_PP(args[i]) != IS_OBJECT)
- convert_to_string_ex(args[i]);
- php_wddx_add_var(packet, *args[i]);
- }
-
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
- php_wddx_packet_end(packet);
-
- efree(args);
-
- ZVAL_STRINGL(return_value, packet->c, packet->len, 1);
- smart_str_free(packet);
- efree(packet);
-}
-/* }}} */
-
-/* {{{ php_wddx_constructor
- */
-wddx_packet *php_wddx_constructor(void)
-{
- smart_str *packet;
-
- packet = (smart_str *)emalloc(sizeof(smart_str));
- packet->c = NULL;
-
- return packet;
-}
-/* }}} */
-
-/* {{{ php_wddx_destructor
- */
-void php_wddx_destructor(wddx_packet *packet)
-{
- smart_str_free(packet);
- efree(packet);
-}
-/* }}} */
-
-/* {{{ proto int wddx_packet_start([string comment])
- Starts a WDDX packet with optional comment and returns the packet id */
-PHP_FUNCTION(wddx_packet_start)
-{
- char *comment = NULL;
- int comment_len = 0;
- wddx_packet *packet;
-
- comment = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &comment, &comment_len) == FAILURE)
- return;
-
- packet = php_wddx_constructor();
-
- php_wddx_packet_start(packet, comment, comment_len);
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
-
- ZEND_REGISTER_RESOURCE(return_value, packet, le_wddx);
-}
-/* }}} */
-
-/* {{{ proto string wddx_packet_end(int packet_id)
- Ends specified WDDX packet and returns the string containing the packet */
-PHP_FUNCTION(wddx_packet_end)
-{
- zval *packet_id;
- wddx_packet *packet = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &packet_id) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(packet, wddx_packet *, &packet_id, -1, "WDDX packet ID", le_wddx);
-
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
-
- php_wddx_packet_end(packet);
-
- ZVAL_STRINGL(return_value, packet->c, packet->len, 1);
-
- zend_list_delete(Z_LVAL_P(packet_id));
-}
-/* }}} */
-
-/* {{{ proto int wddx_add_vars(int packet_id, mixed var_names [, mixed ...])
- Serializes given variables and adds them to packet given by packet_id */
-PHP_FUNCTION(wddx_add_vars)
-{
- int argc, i;
- zval ***args;
- zval **packet_id;
- wddx_packet *packet = NULL;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2) {
- WRONG_PARAM_COUNT;
- }
-
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- packet_id = args[0];
-
- packet = (wddx_packet *)zend_fetch_resource(packet_id TSRMLS_CC, -1, "WDDX packet ID", NULL, 1, le_wddx);
- if (!packet)
- {
- efree(args);
- RETURN_FALSE;
- }
-
- for (i=1; i<argc; i++) {
- if (Z_TYPE_PP(args[i]) != IS_ARRAY && Z_TYPE_PP(args[i]) != IS_OBJECT)
- convert_to_string_ex(args[i]);
- php_wddx_add_var(packet, (*args[i]));
- }
-
- efree(args);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto mixed wddx_deserialize(string packet)
- Deserializes given packet and returns a PHP value */
-PHP_FUNCTION(wddx_deserialize)
-{
- char *packet;
- int packet_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &packet, &packet_len) == FAILURE)
- return;
-
- if (packet_len == 0)
- return;
-
- php_wddx_deserialize_ex(packet, packet_len, return_value);
-}
-/* }}} */
-
-#endif /* HAVE_LIBEXPAT */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/xml/CREDITS b/ext/xml/CREDITS
deleted file mode 100644
index b9cbfdd5af..0000000000
--- a/ext/xml/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-XML
-Stig Bakken, Thies C. Arntzen, Sterling Hughes
diff --git a/ext/xml/compat.c b/ext/xml/compat.c
deleted file mode 100644
index 3000f0d663..0000000000
--- a/ext/xml/compat.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#include "php.h"
-#include "expat_compat.h"
-
-#ifdef LIBXML_EXPAT_COMPAT
-
-#define IS_NS_DECL(__ns) \
- ((__ns) != NULL && strlen(__ns) == 5 && *(__ns) == 'x' && *((__ns)+1) == 'm' && \
- *((__ns)+2) == 'l' && *((__ns)+3) == 'n' && *((__ns)+4) == 's')
-
-static void
-_find_namespace_decl(XML_Parser parser, const xmlChar *tagname, const xmlChar **attr)
-{
- xmlChar **attr_p = (xmlChar **) attr;
- xmlChar *name;
- xmlChar *value;
- xmlChar *partial;
- xmlChar *namespace;
-
- while (attr_p && *attr_p) {
- name = attr_p[0];
- value = xmlStrdup(attr_p[1]);
-
- partial = xmlSplitQName(parser->parser, name, &namespace);
- if (IS_NS_DECL(namespace)) {
- if (parser->h_start_ns) {
- parser->h_start_ns(parser->user, partial, (const XML_Char *) value);
- }
- xmlHashAddEntry(parser->_ns_map, partial, value);
- xmlHashAddEntry(parser->_reverse_ns_map, tagname, xmlStrdup(partial));
- break;
- }
-
- xmlFree(value);
- attr_p += 2;
- }
-}
-
-static void
-_qualify_namespace(XML_Parser parser, const xmlChar *name, xmlChar **qualified)
-{
- xmlChar *partial;
- xmlChar *namespace;
- int len;
-
- partial = xmlSplitQName(parser->parser, name, &namespace);
- if (namespace) {
- xmlChar *nsvalue;
-
- nsvalue = xmlHashLookup(parser->_ns_map, namespace);
- if (nsvalue) {
- len = strlen(nsvalue) + strlen(partial) + 1; /* colon */
- *qualified = malloc(len+1);
- memcpy(*qualified, nsvalue, strlen(nsvalue));
- memcpy(*qualified + strlen(nsvalue), ":", 1);
- memcpy(*qualified + strlen(nsvalue) + 1, partial, strlen(partial));
- (*qualified)[len] = '\0';
- } else {
- *qualified = xmlStrdup(name);
- }
- } else {
- *qualified = xmlStrdup(name);
- }
-}
-
-static void
-_start_element_handler(void *user, const xmlChar *name, const xmlChar **attributes)
-{
- XML_Parser parser = (XML_Parser) user;
- xmlChar *qualified_name = NULL;
-
- if (parser->h_start_element == NULL) {
- return;
- }
-
- if (parser->namespace) {
- _find_namespace_decl(parser, name, attributes);
- _qualify_namespace(parser, name, &qualified_name);
- } else {
- qualified_name = xmlStrdup(name);
- }
-
- parser->h_start_element(parser->user, (const XML_Char *) qualified_name, (const XML_Char **) attributes);
-
- xmlFree(qualified_name);
-}
-
-static void
-_end_element_handler(void *user, const xmlChar *name)
-{
- xmlChar *qualified_name;
- XML_Parser parser = (XML_Parser) user;
-
- if (parser->h_end_element == NULL) {
- return;
- }
-
- if (parser->namespace) {
- xmlChar *nsname;
-
- nsname = xmlHashLookup(parser->_reverse_ns_map, name);
- if (nsname && parser->h_end_ns) {
- parser->h_end_ns(parser->user, nsname);
- }
-
- _qualify_namespace(parser, name, &qualified_name);
- } else {
- qualified_name = xmlStrdup(name);
- }
-
- parser->h_end_element(parser->user, (const XML_Char *) qualified_name);
-
- xmlFree(qualified_name);
-}
-
-static void
-_cdata_handler(void *user, const xmlChar *cdata, int cdata_len)
-{
- XML_Parser parser = (XML_Parser) user;
-
- if (parser->h_cdata == NULL) {
- return;
- }
-
- parser->h_cdata(parser->user, (const XML_Char *) cdata, cdata_len);
-}
-
-static void
-_pi_handler(void *user, const xmlChar *target, const xmlChar *data)
-{
- XML_Parser parser = (XML_Parser) user;
-
- if (parser->h_pi == NULL) {
- return;
- }
-
- parser->h_pi(parser->user, (const XML_Char *) target, (const XML_Char *) data);
-}
-
-static void
-_unparsed_entity_decl_handler(void *user,
- const xmlChar *name,
- const xmlChar *sys_id,
- const xmlChar *pub_id,
- const xmlChar *notation)
-{
- XML_Parser parser = (XML_Parser) user;
-
- if (parser->h_unparsed_entity_decl == NULL) {
- return;
- }
-
- parser->h_unparsed_entity_decl(parser->user, name, NULL, sys_id, pub_id, notation);
-}
-
-static void
-_notation_decl_handler(void *user, const xmlChar *notation, const xmlChar *sys_id, const xmlChar *pub_id)
-{
- XML_Parser parser = (XML_Parser) user;
-
- if (parser->h_notation_decl == NULL) {
- return;
- }
-
- parser->h_notation_decl(parser->user, notation, NULL, sys_id, pub_id);
-}
-
-static void
-_external_entity_ref_handler(void *user, const xmlChar *names, int type, const xmlChar *sys_id, const xmlChar *pub_id, xmlChar *content)
-{
- XML_Parser parser = (XML_Parser) user;
-
- if (parser->h_external_entity_ref == NULL) {
- return;
- }
-
- parser->h_external_entity_ref(parser, names, NULL, sys_id, pub_id);
-}
-
-static xmlSAXHandler
-php_xml_compat_handlers = {
- NULL, /* internalSubset */
- NULL, /* isStandalone */
- NULL, /* hasInternalSubset */
- NULL, /* hasExternalSubset */
- NULL, /* resolveEntity */
- NULL, /* getEntity */
- _external_entity_ref_handler, /* entityDecl */
- _notation_decl_handler,
- NULL, /* attributeDecl */
- NULL, /* elementDecl */
- _unparsed_entity_decl_handler, /* unparsedEntity */
- NULL, /* setDocumentLocator */
- NULL, /* startDocument */
- NULL, /* endDocument */
- _start_element_handler,
- _end_element_handler,
- NULL, /* reference */
- _cdata_handler,
- NULL, /* ignorableWhitespace */
- _pi_handler,
- NULL, /* comment */
- NULL, /* warning */
- NULL, /* error */
- NULL /* fatalError */
-};
-
-XML_Parser
-XML_ParserCreate(const XML_Char *encoding)
-{
- return XML_ParserCreate_MM(encoding, NULL, NULL);
-}
-
-XML_Parser
-XML_ParserCreateNS(const XML_Char *encoding, const XML_Char sep)
-{
- XML_Char tmp[2];
- tmp[0] = sep;
- tmp[1] = '\0';
- return XML_ParserCreate_MM(encoding, NULL, tmp);
-}
-
-static void *(*_expat_cpt_malloc_fcn)(size_t sz);
-
-static char *_expat_cpt_intn_strdup(const char *str)
-{
- size_t len;
- char *retval;
-
- len = strlen(str);
- if ((retval = _expat_cpt_malloc_fcn(len + 1)) == NULL) {
- return NULL;
- }
- memcpy(retval, str, len + 1);
-
- return retval;
-}
-
-XML_Parser
-XML_ParserCreate_MM(const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, const XML_Char *sep)
-{
- XML_Parser parser;
- static XML_Memory_Handling_Suite mtemp_i = { malloc, realloc, free };
-
- if (memsuite == NULL) {
- memsuite = &mtemp_i;
- }
-
- _expat_cpt_malloc_fcn = memsuite->malloc_fcn; /* FIXME: not reentrant ! */
-
- xmlMemSetup(memsuite->free_fcn, memsuite->malloc_fcn, memsuite->realloc_fcn, _expat_cpt_intn_strdup); /* WHOCANFIXME: not reentrant ! */
-
- parser = (XML_Parser) memsuite->malloc_fcn(sizeof(struct _XML_Parser));
- memset(parser, 0, sizeof(struct _XML_Parser));
- parser->namespace = 0;
- parser->mem_hdlrs = *memsuite;
- parser->parser = xmlCreatePushParserCtxt((xmlSAXHandlerPtr) &php_xml_compat_handlers, (void *) parser, NULL, 0, NULL);
- if (parser->parser == NULL) {
- parser->mem_hdlrs.free_fcn(parser->parser);
- return NULL;
- }
- parser->parser->encoding = xmlStrdup(encoding);
- if (sep != NULL) {
- parser->namespace = 1;
- parser->_ns_map = xmlHashCreate(10);
- parser->_reverse_ns_map = xmlHashCreate(10);
- }
- return parser;
-}
-
-void
-XML_SetUserData(XML_Parser parser, void *user)
-{
- parser->user = user;
-}
-
-void *
-XML_GetUserData(XML_Parser parser)
-{
- return parser->user;
-}
-
-void
-XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end)
-{
- parser->h_start_element = start;
- parser->h_end_element = end;
-}
-
-void
-XML_SetCharacterDataHandler(XML_Parser parser, XML_CharacterDataHandler cdata)
-{
- parser->h_cdata = cdata;
-}
-
-void
-XML_SetProcessingInstructionHandler(XML_Parser parser, XML_ProcessingInstructionHandler pi)
-{
- parser->h_pi = pi;
-}
-
-void
-XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler d)
-{
- parser->h_default = d;
-}
-
-void
-XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler unparsed_decl)
-{
- parser->h_unparsed_entity_decl = unparsed_decl;
-}
-
-void
-XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler notation_decl)
-{
- parser->h_notation_decl = notation_decl;
-}
-
-void
-XML_SetExternalEntityRefHandler(XML_Parser parser, XML_ExternalEntityRefHandler ext_entity)
-{
- parser->h_external_entity_ref = ext_entity;
-}
-
-void
-XML_SetStartNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start_ns)
-{
- parser->h_start_ns = start_ns;
-}
-
-void
-XML_SetEndNamespaceDeclHandler(XML_Parser parser, XML_EndNamespaceDeclHandler end_ns)
-{
- parser->h_end_ns = end_ns;
-}
-
-int
-XML_Parse(XML_Parser parser, const XML_Char *data, int data_len, int is_final)
-{
- return !xmlParseChunk(parser->parser, data, data_len, is_final);
-}
-
-int
-XML_GetErrorCode(XML_Parser parser)
-{
- return parser->parser->errNo;
-}
-
-const XML_Char *error_mapping[] = {
- "NO ERROR",
- "XML_ERROR_INTERNAL_ERROR",
- "XML_NO_MEMORY",
- "XML_ERR_DOCUMENT_START",
- "XML_ERR_DOCUMENT_EMPTY",
- "XML_ERR_DOCUMENT_END",
- "XML_ERR_INVALID_HEX_CHARREF",
- "XML_ERR_INVALID_DEC_CHARREF",
- "XML_ERR_INVALID_CHARREF",
- "XML_ERR_INVALID_CHAR",
- "XML_ERR_CHARREF_AT_EOF",
- "XML_ERR_CHARREF_IN_PROLOG",
- "XML_ERR_CHARREF_IN_EPILOG",
- "XML_ERR_CHARREF_IN_DTD",
- "XML_ERR_ENTITYREF_AT_EOF",
- "XML_ERR_ENTITYREF_IN_PROLOG",
- "XML_ERR_ENTITYREF_IN_EPILOG",
- "XML_ERR_ENTITYREF_IN_DTD",
- "XML_ERR_PEREF_AT_EOF",
- "XML_ERR_PEREF_IN_PROLOG",
- "XML_ERR_PEREF_IN_EPILOG",
- "XML_ERR_PEREF_IN_INT_SUBSET",
- "XML_ERR_ENTITYREF_NO_NAME",
- "XML_ERR_ENTITYREF_SEMICOL_MISSING",
- "XML_ERR_PEREF_NO_NAME",
- "XML_ERR_PEREF_SEMICOL_MISSING",
- "XML_ERR_UNDECLARED_ENTITY",
- "XML_WAR_UNDECLARED_ENTITY",
- "XML_ERR_UNPARSED_ENTITY",
- "XML_ERR_ENTITY_IS_EXTERNAL",
- "XML_ERR_ENTITY_IS_PARAMETER",
- "XML_ERR_UNKNOWN_ENCODING",
- "XML_ERR_UNSUPPORTED_ENCODING",
- "XML_ERR_STRING_NOT_STARTED",
- "XML_ERR_STRING_NOT_CLOSED",
- "XML_ERR_NS_DECL_ERROR",
- "XML_ERR_ENTITY_NOT_STARTED",
- "XML_ERR_ENTITY_NOT_FINISHED",
- "XML_ERR_LT_IN_ATTRIBUTE",
- "XML_ERR_ATTRIBUTE_NOT_STARTED",
- "XML_ERR_ATTRIBUTE_NOT_FINISHED",
- "XML_ERR_ATTRIBUTE_WITHOUT_VALUE",
- "XML_ERR_ATTRIBUTE_REDEFINED",
- "XML_ERR_LITERAL_NOT_STARTED",
- "XML_ERR_LITERAL_NOT_FINISHED",
- /* "XML_ERR_COMMENT_NOT_STARTED", <= eliminated on purpose */
- "XML_ERR_COMMENT_NOT_FINISHED",
- "XML_ERR_PI_NOT_STARTED",
- "XML_ERR_PI_NOT_FINISHED",
- "XML_ERR_NOTATION_NOT_STARTED",
- "XML_ERR_NOTATION_NOT_FINISHED",
- "XML_ERR_ATTLIST_NOT_STARTED",
- "XML_ERR_ATTLIST_NOT_FINISHED",
- "XML_ERR_MIXED_NOT_STARTED",
- "XML_ERR_MIXED_NOT_FINISHED",
- "XML_ERR_ELEMCONTENT_NOT_STARTED",
- "XML_ERR_ELEMCONTENT_NOT_FINISHED",
- "XML_ERR_XMLDECL_NOT_STARTED",
- "XML_ERR_XMLDECL_NOT_FINISHED",
- "XML_ERR_CONDSEC_NOT_STARTED",
- "XML_ERR_CONDSEC_NOT_FINISHED",
- "XML_ERR_EXT_SUBSET_NOT_FINISHED",
- "XML_ERR_DOCTYPE_NOT_FINISHED",
- "XML_ERR_MISPLACED_CDATA_END",
- "XML_ERR_CDATA_NOT_FINISHED",
- "XML_ERR_RESERVED_XML_NAME",
- "XML_ERR_SPACE_REQUIRED",
- "XML_ERR_SEPARATOR_REQUIRED",
- "XML_ERR_NMTOKEN_REQUIRED",
- "XML_ERR_NAME_REQUIRED",
- "XML_ERR_PCDATA_REQUIRED",
- "XML_ERR_URI_REQUIRED",
- "XML_ERR_PUBID_REQUIRED",
- "XML_ERR_LT_REQUIRED",
- "XML_ERR_GT_REQUIRED",
- "XML_ERR_LTSLASH_REQUIRED",
- "XML_ERR_EQUAL_REQUIRED",
- "XML_ERR_TAG_NAME_MISMATCH",
- "XML_ERR_TAG_NOT_FINISHED",
- "XML_ERR_STANDALONE_VALUE",
- "XML_ERR_ENCODING_NAME",
- "XML_ERR_HYPHEN_IN_COMMENT",
- "XML_ERR_INVALID_ENCODING",
- "XML_ERR_EXT_ENTITY_STANDALONE",
- "XML_ERR_CONDSEC_INVALID",
- "XML_ERR_VALUE_REQUIRED",
- "XML_ERR_NOT_WELL_BALANCED",
- "XML_ERR_EXTRA_CONTENT",
- "XML_ERR_ENTITY_CHAR_ERROR",
- "XML_ERR_ENTITY_PE_INTERNAL",
- "XML_ERR_ENTITY_LOOP",
- "XML_ERR_ENTITY_BOUNDARY",
- "XML_ERR_INVALID_URI",
- "XML_ERR_URI_FRAGMENT",
- "XML_WAR_CATALOG_PI",
- "XML_ERR_NO_DTD"
-};
-
-const XML_Char *
-XML_ErrorString(int code)
-{
- if (code < 0 || code >= sizeof(error_mapping)) {
- return "Unknown";
- }
- return error_mapping[code];
-}
-
-int
-XML_GetCurrentLineNumber(XML_Parser parser)
-{
- return parser->parser->input->line;
-}
-
-int
-XML_GetCurrentColumnNumber(XML_Parser parser)
-{
- return parser->parser->input->col;
-}
-
-int
-XML_GetCurrentByteIndex(XML_Parser parser)
-{
- return parser->parser->input->consumed;
-}
-
-const XML_Char *XML_ExpatVersion(void)
-{
- return "1.0";
-}
-
-static void
-_free_ns_name(void *ptr, xmlChar *name)
-{
- xmlFree(ptr);
-}
-
-void
-XML_ParserFree(XML_Parser parser)
-{
- if (parser->namespace) {
- xmlHashFree(parser->_ns_map, _free_ns_name);
- xmlHashFree(parser->_reverse_ns_map, _free_ns_name);
- }
- xmlFreeParserCtxt(parser->parser);
- parser->mem_hdlrs.free_fcn(parser);
-}
-
-#endif /* LIBXML_EXPAT_COMPAT */
-
-/**
- * Local Variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- * vim600: fdm=marker
- * vim: ts=4 noet sw=4
- */
diff --git a/ext/xml/config.m4 b/ext/xml/config.m4
deleted file mode 100644
index c4c2de4aa6..0000000000
--- a/ext/xml/config.m4
+++ /dev/null
@@ -1,16 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(xml,whether to enable XML support,
-[ --disable-xml Disable XML support using bundled expat lib], yes)
-
-if test "$PHP_XML" = "yes"; then
- AC_DEFINE(HAVE_XML, 1, [ ])
-
- if test "$PHP_BUNDLE_EXPAT" = "no" && test "$PHP_BUNDLE_LIBXML" = "no"; then
- AC_MSG_ERROR(xml support is enabled, however both xml libraries have been disabled.)
- fi
-
- PHP_NEW_EXTENSION(xml, compat.c xml.c, $ext_shared)
-fi
diff --git a/ext/xml/expat_compat.h b/ext/xml/expat_compat.h
deleted file mode 100644
index 1926afae28..0000000000
--- a/ext/xml/expat_compat.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_EXPAT_COMPAT_H
-#define PHP_EXPAT_COMPAT_H
-
-#if !defined(HAVE_LIBEXPAT) && defined(HAVE_LIBXML)
-#define LIBXML_EXPAT_COMPAT 1
-
-#include <libxml/hash.h>
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-#include <libxml/tree.h>
-
-typedef xmlChar XML_Char;
-
-typedef void (*XML_StartElementHandler)(void *, const XML_Char *, const XML_Char **);
-typedef void (*XML_EndElementHandler)(void *, const XML_Char *);
-typedef void (*XML_CharacterDataHandler)(void *, const XML_Char *, int);
-typedef void (*XML_ProcessingInstructionHandler)(void *, const XML_Char *, const XML_Char *);
-typedef void (*XML_DefaultHandler)(void *, const XML_Char *, int);
-typedef void (*XML_UnparsedEntityDeclHandler)(void *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *);
-typedef void (*XML_NotationDeclHandler)(void *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *);
-typedef int (*XML_ExternalEntityRefHandler)(void *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *);
-typedef void (*XML_StartNamespaceDeclHandler)(void *, const XML_Char *, const XML_Char *);
-typedef void (*XML_EndNamespaceDeclHandler)(void *, const XML_Char *);
-
-typedef struct _XML_Memory_Handling_Suite {
- void *(*malloc_fcn)(size_t size);
- void *(*realloc_fcn)(void *ptr, size_t size);
- void (*free_fcn)(void *ptr);
-} XML_Memory_Handling_Suite;
-
-typedef struct _XML_Parser {
- int namespace;
-
- xmlHashTablePtr _ns_map;
- xmlHashTablePtr _reverse_ns_map;
-
- void *user;
- xmlParserCtxtPtr parser;
-
- XML_Memory_Handling_Suite mem_hdlrs;
-
- XML_StartElementHandler h_start_element;
- XML_EndElementHandler h_end_element;
- XML_CharacterDataHandler h_cdata;
- XML_ProcessingInstructionHandler h_pi;
- XML_DefaultHandler h_default;
- XML_UnparsedEntityDeclHandler h_unparsed_entity_decl;
- XML_NotationDeclHandler h_notation_decl;
- XML_ExternalEntityRefHandler h_external_entity_ref;
- XML_StartNamespaceDeclHandler h_start_ns;
- XML_EndNamespaceDeclHandler h_end_ns;
-} *XML_Parser;
-
-enum XML_Error {
- XML_ERROR_NONE,
- XML_ERROR_NO_MEMORY,
- XML_ERROR_SYNTAX,
- XML_ERROR_NO_ELEMENTS,
- XML_ERROR_INVALID_TOKEN,
- XML_ERROR_UNCLOSED_TOKEN,
- XML_ERROR_PARTIAL_CHAR,
- XML_ERROR_TAG_MISMATCH,
- XML_ERROR_DUPLICATE_ATTRIBUTE,
- XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
- XML_ERROR_PARAM_ENTITY_REF,
- XML_ERROR_UNDEFINED_ENTITY,
- XML_ERROR_RECURSIVE_ENTITY_REF,
- XML_ERROR_ASYNC_ENTITY,
- XML_ERROR_BAD_CHAR_REF,
- XML_ERROR_BINARY_ENTITY_REF,
- XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
- XML_ERROR_MISPLACED_XML_PI,
- XML_ERROR_UNKNOWN_ENCODING,
- XML_ERROR_INCORRECT_ENCODING,
- XML_ERROR_UNCLOSED_CDATA_SECTION,
- XML_ERROR_EXTERNAL_ENTITY_HANDLING,
- XML_ERROR_NOT_STANDALONE,
- XML_ERROR_UNEXPECTED_STATE,
- XML_ERROR_ENTITY_DECLARED_IN_PE,
- XML_ERROR_FEATURE_REQUIRES_XML_DTD,
- XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING
-};
-
-enum XML_Content_Type {
- XML_CTYPE_EMPTY = 1,
- XML_CTYPE_ANY,
- XML_CTYPE_MIXED,
- XML_CTYPE_NAME,
- XML_CTYPE_CHOICE,
- XML_CTYPE_SEQ
-};
-
-XML_Parser XML_ParserCreate(const XML_Char *);
-XML_Parser XML_ParserCreateNS(const XML_Char *, const XML_Char);
-XML_Parser XML_ParserCreate_MM(const XML_Char *, const XML_Memory_Handling_Suite *, const XML_Char *);
-void XML_SetUserData(XML_Parser, void *);
-void *XML_GetUserData(XML_Parser);
-void XML_SetElementHandler(XML_Parser, XML_StartElementHandler, XML_EndElementHandler);
-void XML_SetCharacterDataHandler(XML_Parser, XML_CharacterDataHandler);
-void XML_SetProcessingInstructionHandler(XML_Parser, XML_ProcessingInstructionHandler);
-void XML_SetDefaultHandler(XML_Parser, XML_DefaultHandler);
-void XML_SetUnparsedEntityDeclHandler(XML_Parser, XML_UnparsedEntityDeclHandler);
-void XML_SetNotationDeclHandler(XML_Parser, XML_NotationDeclHandler);
-void XML_SetExternalEntityRefHandler(XML_Parser, XML_ExternalEntityRefHandler);
-void XML_SetStartNamespaceDeclHandler(XML_Parser, XML_StartNamespaceDeclHandler);
-void XML_SetEndNamespaceDeclHandler(XML_Parser, XML_EndNamespaceDeclHandler);
-int XML_Parse(XML_Parser, const XML_Char *, int data_len, int is_final);
-int XML_GetErrorCode(XML_Parser);
-const XML_Char *XML_ErrorString(int);
-int XML_GetCurrentLineNumber(XML_Parser);
-int XML_GetCurrentColumnNumber(XML_Parser);
-int XML_GetCurrentByteIndex(XML_Parser);
-const XML_Char *XML_ExpatVersion(void);
-void XML_ParserFree(XML_Parser);
-
-#else
-#include <expat.h>
-#endif /* HAVE_LIBEXPAT */
-
-#endif /* PHP_EXPAT_COMPAT_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/xml/php_xml.h b/ext/xml/php_xml.h
deleted file mode 100644
index ca77d3d224..0000000000
--- a/ext/xml/php_xml.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@php.net> |
- | Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_XML_H
-#define PHP_XML_H
-
-#ifdef HAVE_XML
-extern zend_module_entry xml_module_entry;
-#define xml_module_ptr &xml_module_entry
-#else
-#define xml_module_ptr NULL
-#endif
-
-#ifdef HAVE_XML
-
-#include "ext/xml/expat_compat.h"
-
-#ifdef PHP_WIN32
-#define PHP_XML_API __declspec(dllexport)
-#else
-#define PHP_XML_API
-#endif
-
-
-#ifdef XML_UNICODE
-#error "UTF-16 Unicode support not implemented!"
-#endif
-
-typedef struct {
- XML_Char *default_encoding;
-} php_xml_globals;
-
-typedef struct {
- int index;
- int case_folding;
- XML_Parser parser;
- XML_Char *target_encoding;
- zval *startElementHandler;
- zval *endElementHandler;
- zval *characterDataHandler;
- zval *processingInstructionHandler;
- zval *defaultHandler;
- zval *unparsedEntityDeclHandler;
- zval *notationDeclHandler;
- zval *externalEntityRefHandler;
- zval *unknownEncodingHandler;
- zval *startNamespaceDeclHandler;
- zval *endNamespaceDeclHandler;
- zval *object;
-
- zval *data;
- zval *info;
- int level;
- int toffset;
- int curtag;
- pval **ctag;
- char **ltags;
- int lastwasopen;
- int skipwhite;
-
- XML_Char *baseURI;
-} xml_parser;
-
-
-typedef struct {
- XML_Char *name;
- char (*decoding_function)(unsigned short);
- unsigned short (*encoding_function)(unsigned char);
-} xml_encoding;
-
-
-enum php_xml_option {
- PHP_XML_OPTION_CASE_FOLDING = 1,
- PHP_XML_OPTION_TARGET_ENCODING,
- PHP_XML_OPTION_SKIP_TAGSTART,
- PHP_XML_OPTION_SKIP_WHITE
-};
-
-/* for xml_parse_into_struct */
-
-#define XML_MAXLEVEL 255 /* XXX this should be dynamic */
-
-PHP_FUNCTION(xml_parser_create);
-PHP_FUNCTION(xml_parser_create_ns);
-PHP_FUNCTION(xml_set_object);
-PHP_FUNCTION(xml_set_element_handler);
-PHP_FUNCTION(xml_set_character_data_handler);
-PHP_FUNCTION(xml_set_processing_instruction_handler);
-PHP_FUNCTION(xml_set_default_handler);
-PHP_FUNCTION(xml_set_unparsed_entity_decl_handler);
-PHP_FUNCTION(xml_set_notation_decl_handler);
-PHP_FUNCTION(xml_set_external_entity_ref_handler);
-PHP_FUNCTION(xml_set_start_namespace_decl_handler);
-PHP_FUNCTION(xml_set_end_namespace_decl_handler);
-PHP_FUNCTION(xml_parse);
-PHP_FUNCTION(xml_get_error_code);
-PHP_FUNCTION(xml_error_string);
-PHP_FUNCTION(xml_get_current_line_number);
-PHP_FUNCTION(xml_get_current_column_number);
-PHP_FUNCTION(xml_get_current_byte_index);
-PHP_FUNCTION(xml_parser_free);
-PHP_FUNCTION(xml_parser_set_option);
-PHP_FUNCTION(xml_parser_get_option);
-PHP_FUNCTION(utf8_encode);
-PHP_FUNCTION(utf8_decode);
-PHP_FUNCTION(xml_parse_into_struct);
-
-PHPAPI char *_xml_zval_strdup(zval *val);
-PHPAPI char *xml_utf8_decode(const XML_Char *, int, int *, const XML_Char *);
-
-#endif /* HAVE_LIBEXPAT */
-
-#define phpext_xml_ptr xml_module_ptr
-
-#ifdef ZTS
-#define XML(v) TSRMG(xml_globals_id, php_xml_globals *, v)
-#else
-#define XML(v) (xml_globals.v)
-#endif
-
-#endif /* PHP_XML_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/xml/tests/inc.ent b/ext/xml/tests/inc.ent
deleted file mode 100644
index 8f86465c2a..0000000000
--- a/ext/xml/tests/inc.ent
+++ /dev/null
@@ -1 +0,0 @@
-<!ENTITY included-entity "This is text included from an entity">
diff --git a/ext/xml/tests/skipif.inc b/ext/xml/tests/skipif.inc
deleted file mode 100644
index 44898f3da6..0000000000
--- a/ext/xml/tests/skipif.inc
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-// DO NOT dl load extension
-//if (!extension_loaded("xml")) {
-// $dlext = (substr(PHP_OS, 0, 3) == "WIN") ? ".dll" : ".so";
-// @dl("xml$dlext");
-//}
-if (!extension_loaded("xml")) {
- die('skip xml extension not available');
-}
-?>
diff --git a/ext/xml/tests/xml001.phpt b/ext/xml/tests/xml001.phpt
deleted file mode 100644
index b7c678eade..0000000000
--- a/ext/xml/tests/xml001.phpt
+++ /dev/null
@@ -1,96 +0,0 @@
---TEST--
-XML parser test, function callbacks
---SKIPIF--
-<?php include("skipif.inc"); ?>
---INI--
-magic_quotes_runtime=0
---FILE--
-<?php
-chdir(dirname(__FILE__));
-
-$xml_parser = xml_parser_create();
-xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1);
-xml_set_element_handler($xml_parser, "startElement", "endElement");
-xml_set_character_data_handler($xml_parser, "characterData");
-xml_set_processing_instruction_handler($xml_parser, "PIHandler");
-xml_set_default_handler($xml_parser, "defaultHandler");
-xml_set_external_entity_ref_handler($xml_parser, "externalEntityRefHandler");
-
-if (!($fp = @fopen("xmltest.xml", "r"))) {
- die("could not open XML input");
-}
-
-while ($data = fread($fp, 4096)) {
- if (!xml_parse($xml_parser, $data, feof($fp))) {
- die(sprintf("XML error: %s at line %d\n",
- xml_error_string(xml_get_error_code($xml_parser)),
- xml_get_current_line_number($xml_parser)));
- }
-}
-print "parse complete\n";
-xml_parser_free($xml_parser);
-
-function startElement($parser, $name, $attribs)
-{
- print "\{$name";
- if (sizeof($attribs)) {
- while (list($k, $v) = each($attribs)) {
- print " $k=\"$v\"";
- }
- }
- print "}";
-}
-
-function endElement($parser, $name)
-{
- print "\{/$name}";
-}
-
-function characterData($parser, $data)
-{
- print "\{CDATA[$data]}";
-}
-
-function PIHandler($parser, $target, $data)
-{
- print "\{PI[$target,$data]}";
-}
-
-function defaultHandler($parser, $data)
-{
- if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
- print "\{ENTREF[$data]}";
- } else {
- print "\{?[$data]}";
- }
-}
-
-function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId)
-{
- print "\{EXTENTREF[$openEntityNames,$base,$systemId,$publicId]}\n";
- return true;
-}
-
-?>
---EXPECT--
-{?[<?xml version="1.0" encoding="ISO-8859-1"?>]}{?[
-]}{?[<!DOCTYPE]}{?[ ]}{?[phptest]}{?[ ]}{?[SYSTEM]}{?[ ]}{?["notfound.dtd"]}{?[ ]}{?[[]}{?[
-]}{?[<!ENTITY]}{?[ ]}{?[%]}{?[ ]}{?[incent]}{?[ ]}{?[SYSTEM]}{?[ ]}{?["inc.ent"]}{?[>]}{?[
-]}{?[%incent;]}{?[
-]}{?[]]}{?[>]}{?[
-]}{ROOT ID="elem1"}{CDATA[
-]}{CDATA[ Plain text.]}{CDATA[
-]}{CDATA[ ]}{ELEM1}{CDATA[
-]}{CDATA[ ]}{?[<!-- comment -->]}{CDATA[
-]}{CDATA[ ]}{ELEM2}{CDATA[
-]}{CDATA[ ]}{?[<![CDATA[]}{CDATA[CDATA block]}{?[]]>]}{CDATA[
-]}{CDATA[ ]}{ELEM3}{CDATA[
-]}{CDATA[ ]}{ENTREF[&included-entity;]}{CDATA[
-]}{CDATA[ ]}{ELEM4}{CDATA[
-]}{CDATA[ ]}{PI[test,processing instruction ]}{CDATA[
-]}{CDATA[ ]}{/ELEM4}{CDATA[
-]}{CDATA[ ]}{/ELEM3}{CDATA[
-]}{CDATA[ ]}{/ELEM2}{CDATA[
-]}{CDATA[ ]}{/ELEM1}{CDATA[
-]}{/ROOT}{?[
-]}parse complete
diff --git a/ext/xml/tests/xml002.phpt b/ext/xml/tests/xml002.phpt
deleted file mode 100644
index 7954c7918e..0000000000
--- a/ext/xml/tests/xml002.phpt
+++ /dev/null
@@ -1,97 +0,0 @@
---TEST--
-XML parser test, object tuple callbacks
---SKIPIF--
-<?php include("skipif.inc"); ?>
---INI--
-magic_quotes_runtime=0
---FILE--
-<?php
-chdir(dirname(__FILE__));
-
-class myclass
-{
- function startElement($parser, $name, $attribs)
- {
- print "\{$name";
- if (sizeof($attribs)) {
- while (list($k, $v) = each($attribs)) {
- print " $k=\"$v\"";
- }
- }
- print "}";
- }
- function endElement($parser, $name)
- {
- print "\{/$name}";
- }
- function characterData($parser, $data)
- {
- print "\{CDATA[$data]}";
- }
- function PIHandler($parser, $target, $data)
- {
- print "\{PI[$target,$data]}";
- }
- function defaultHandler($parser, $data)
- {
- if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
- print "\{ENTREF[$data]}";
- } else {
- print "\{?[$data]}";
- }
- }
- function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId)
- {
- print "\{EXTENTREF[$openEntityNames,$base,$systemId,$publicId]}\n";
- return true;
- }
-}
-
-$xml_parser = xml_parser_create();
-$obj = new myclass;
-xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1);
-xml_set_element_handler($xml_parser, array($obj,"startElement"),
-array($obj, "endElement"));
-xml_set_character_data_handler($xml_parser, array($obj, "characterData"));
-xml_set_processing_instruction_handler($xml_parser, array($obj, "PIHandler"));
-xml_set_default_handler($xml_parser, array($obj, "defaultHandler"));
-xml_set_external_entity_ref_handler($xml_parser,
-array($obj, "externalEntityRefHandler"));
-
-if (!($fp = @fopen("xmltest.xml", "r"))) {
- die("could not open XML input");
-}
-
-while ($data = fread($fp, 4096)) {
- if (!xml_parse($xml_parser, $data, feof($fp))) {
- die(sprintf("XML error: %s at line %d\n",
- xml_error_string(xml_get_error_code($xml_parser)),
- xml_get_current_line_number($xml_parser)));
- }
-}
-print "parse complete\n";
-xml_parser_free($xml_parser);
-
-?>
---EXPECT--
-{?[<?xml version="1.0" encoding="ISO-8859-1"?>]}{?[
-]}{?[<!DOCTYPE]}{?[ ]}{?[phptest]}{?[ ]}{?[SYSTEM]}{?[ ]}{?["notfound.dtd"]}{?[ ]}{?[[]}{?[
-]}{?[<!ENTITY]}{?[ ]}{?[%]}{?[ ]}{?[incent]}{?[ ]}{?[SYSTEM]}{?[ ]}{?["inc.ent"]}{?[>]}{?[
-]}{?[%incent;]}{?[
-]}{?[]]}{?[>]}{?[
-]}{ROOT ID="elem1"}{CDATA[
-]}{CDATA[ Plain text.]}{CDATA[
-]}{CDATA[ ]}{ELEM1}{CDATA[
-]}{CDATA[ ]}{?[<!-- comment -->]}{CDATA[
-]}{CDATA[ ]}{ELEM2}{CDATA[
-]}{CDATA[ ]}{?[<![CDATA[]}{CDATA[CDATA block]}{?[]]>]}{CDATA[
-]}{CDATA[ ]}{ELEM3}{CDATA[
-]}{CDATA[ ]}{ENTREF[&included-entity;]}{CDATA[
-]}{CDATA[ ]}{ELEM4}{CDATA[
-]}{CDATA[ ]}{PI[test,processing instruction ]}{CDATA[
-]}{CDATA[ ]}{/ELEM4}{CDATA[
-]}{CDATA[ ]}{/ELEM3}{CDATA[
-]}{CDATA[ ]}{/ELEM2}{CDATA[
-]}{CDATA[ ]}{/ELEM1}{CDATA[
-]}{/ROOT}{?[
-]}parse complete
diff --git a/ext/xml/tests/xml003.phpt b/ext/xml/tests/xml003.phpt
deleted file mode 100644
index bae4dad5f5..0000000000
--- a/ext/xml/tests/xml003.phpt
+++ /dev/null
@@ -1,95 +0,0 @@
---TEST--
-XML parser test, xml_set_object callbacks
---SKIPIF--
-<?php include("skipif.inc"); ?>
---INI--
-magic_quotes_runtime=0
---FILE--
-<?php
-chdir(dirname(__FILE__));
-
-class myclass
-{
- function startElement($parser, $name, $attribs)
- {
- print "\{$name";
- if (sizeof($attribs)) {
- while (list($k, $v) = each($attribs)) {
- print " $k=\"$v\"";
- }
- }
- print "}";
- }
- function endElement($parser, $name)
- {
- print "\{/$name}";
- }
- function characterData($parser, $data)
- {
- print "\{CDATA[$data]}";
- }
- function PIHandler($parser, $target, $data)
- {
- print "\{PI[$target,$data]}";
- }
- function defaultHandler($parser, $data)
- {
- if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
- print "\{ENTREF[$data]}";
- } else {
- print "\{?[$data]}";
- }
- }
- function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId)
- {
- print "\{EXTENTREF[$openEntityNames,$base,$systemId,$publicId]}\n";
- return true;
- }
-}
-
-$xml_parser = xml_parser_create();
-$obj = new myclass;
-xml_set_object($xml_parser, $obj);
-xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1);
-xml_set_element_handler($xml_parser, "startElement", "endElement");
-xml_set_character_data_handler($xml_parser, "characterData");
-xml_set_processing_instruction_handler($xml_parser, "PIHandler");
-xml_set_default_handler($xml_parser, "defaultHandler");
-xml_set_external_entity_ref_handler($xml_parser, "externalEntityRefHandler");
-
-if (!($fp = @fopen("xmltest.xml", "r"))) {
- die("could not open XML input");
-}
-
-while ($data = fread($fp, 4096)) {
- if (!xml_parse($xml_parser, $data, feof($fp))) {
- die(sprintf("XML error: %s at line %d\n",
- xml_error_string(xml_get_error_code($xml_parser)),
- xml_get_current_line_number($xml_parser)));
- }
-}
-print "parse complete\n";
-xml_parser_free($xml_parser);
-?>
---EXPECT--
-{?[<?xml version="1.0" encoding="ISO-8859-1"?>]}{?[
-]}{?[<!DOCTYPE]}{?[ ]}{?[phptest]}{?[ ]}{?[SYSTEM]}{?[ ]}{?["notfound.dtd"]}{?[ ]}{?[[]}{?[
-]}{?[<!ENTITY]}{?[ ]}{?[%]}{?[ ]}{?[incent]}{?[ ]}{?[SYSTEM]}{?[ ]}{?["inc.ent"]}{?[>]}{?[
-]}{?[%incent;]}{?[
-]}{?[]]}{?[>]}{?[
-]}{ROOT ID="elem1"}{CDATA[
-]}{CDATA[ Plain text.]}{CDATA[
-]}{CDATA[ ]}{ELEM1}{CDATA[
-]}{CDATA[ ]}{?[<!-- comment -->]}{CDATA[
-]}{CDATA[ ]}{ELEM2}{CDATA[
-]}{CDATA[ ]}{?[<![CDATA[]}{CDATA[CDATA block]}{?[]]>]}{CDATA[
-]}{CDATA[ ]}{ELEM3}{CDATA[
-]}{CDATA[ ]}{ENTREF[&included-entity;]}{CDATA[
-]}{CDATA[ ]}{ELEM4}{CDATA[
-]}{CDATA[ ]}{PI[test,processing instruction ]}{CDATA[
-]}{CDATA[ ]}{/ELEM4}{CDATA[
-]}{CDATA[ ]}{/ELEM3}{CDATA[
-]}{CDATA[ ]}{/ELEM2}{CDATA[
-]}{CDATA[ ]}{/ELEM1}{CDATA[
-]}{/ROOT}{?[
-]}parse complete
diff --git a/ext/xml/tests/xml004.phpt b/ext/xml/tests/xml004.phpt
deleted file mode 100644
index 78840ee122..0000000000
--- a/ext/xml/tests/xml004.phpt
+++ /dev/null
@@ -1,64 +0,0 @@
---TEST--
-XML parser case folding test
---SKIPIF--
-<?php include("skipif.inc"); ?>
---INI--
-magic_quotes_runtime=0
---FILE--
-<?php
-chdir(dirname(__FILE__));
-
-$xp = xml_parser_create();
-xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
-xml_set_element_handler($xp, "start_element", "end_element");
-$fp = fopen("xmltest.xml", "r");
-while ($data = fread($fp, 4096)) {
- xml_parse($xp, $data, feof($fp));
-}
-xml_parser_free($xp);
-$xp = xml_parser_create();
-xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, true);
-xml_set_element_handler($xp, "start_element", "end_element");
-$fp = fopen("xmltest.xml", "r");
-while ($data = fread($fp, 4096)) {
- xml_parse($xp, $data, feof($fp));
-}
-xml_parser_free($xp);
-
-function start_element($xp, $elem, $attribs)
-{
- print "<$elem";
- if (sizeof($attribs)) {
- while (list($k, $v) = each($attribs)) {
- print " $k=\"$v\"";
- }
- }
- print ">\n";
-}
-
-function end_element($xp, $elem)
-{
- print "</$elem>\n";
-}
-?>
---EXPECT--
-<root id="elem1">
-<elem1>
-<elem2>
-<elem3>
-<elem4>
-</elem4>
-</elem3>
-</elem2>
-</elem1>
-</root>
-<ROOT ID="elem1">
-<ELEM1>
-<ELEM2>
-<ELEM3>
-<ELEM4>
-</ELEM4>
-</ELEM3>
-</ELEM2>
-</ELEM1>
-</ROOT>
diff --git a/ext/xml/tests/xml006.phpt b/ext/xml/tests/xml006.phpt
deleted file mode 100644
index c714e85913..0000000000
--- a/ext/xml/tests/xml006.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-UTF-8<->ISO Latin 1 encoding/decoding test
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-printf("%s -> %s\n", urlencode("æ"), urlencode(utf8_encode("æ")));
-printf("%s <- %s\n", urlencode(utf8_decode(urldecode("%C3%A6"))), "%C3%A6");
-?>
---EXPECT--
-%E6 -> %C3%A6
-%E6 <- %C3%A6
diff --git a/ext/xml/tests/xml007.phpt b/ext/xml/tests/xml007.phpt
deleted file mode 100644
index 377475bb1c..0000000000
--- a/ext/xml/tests/xml007.phpt
+++ /dev/null
@@ -1,53 +0,0 @@
---TEST--
-xml_parse_into_struct/umlauts in tags
---SKIPIF--
-<?php // vim600: syn=php
-include("skipif.inc");
-if(strtoupper("äöüß") != "ÄÖÜß")
-{
- die("skip strtoupper on non-ascii not supported on this platform");
-}
-?>
---FILE--
-<?php
-function startHandler($parser,$tag,$attr)
-{
- var_dump($tag,$attr);
-}
-
-function endHandler($parser,$tag)
-{
- var_dump($tag);
-}
-
-$xmldata = '<?xml version="1.0" encoding="ISO-8859-1"?><äöü üäß="Üäß">ÄÖÜ</äöü>';
-$parser = xml_parser_create('ISO-8859-1');
-xml_set_element_handler($parser, "startHandler", "endHandler");
-xml_parse_into_struct($parser, $xmldata, $struct, $index);
-var_dump($struct);
-?>
---EXPECT--
-string(3) "ÄÖÜ"
-array(1) {
- ["ÜÄß"]=>
- string(3) "Üäß"
-}
-string(3) "ÄÖÜ"
-array(1) {
- [0]=>
- array(5) {
- ["tag"]=>
- string(3) "ÄÖÜ"
- ["type"]=>
- string(8) "complete"
- ["level"]=>
- int(1)
- ["attributes"]=>
- array(1) {
- ["ÜÄß"]=>
- string(3) "Üäß"
- }
- ["value"]=>
- string(3) "ÄÖÜ"
- }
-}
diff --git a/ext/xml/tests/xmltest.xml b/ext/xml/tests/xmltest.xml
deleted file mode 100644
index c15d6ea1ab..0000000000
--- a/ext/xml/tests/xmltest.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE phptest SYSTEM "notfound.dtd" [
-<!ENTITY % incent SYSTEM "inc.ent">
-%incent;
-]>
-<root id="elem1">
- Plain text.
- <elem1>
- <!-- comment -->
- <elem2>
- <![CDATA[CDATA block]]>
- <elem3>
- &included-entity;
- <elem4>
- <?test processing instruction ?>
- </elem4>
- </elem3>
- </elem2>
- </elem1>
-</root>
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
deleted file mode 100644
index 378ae2f55a..0000000000
--- a/ext/xml/xml.c
+++ /dev/null
@@ -1,1599 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@php.net> |
- | Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#define IS_EXT_MODULE
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#define PHP_XML_INTERNAL
-#include "zend_variables.h"
-#include "ext/standard/php_string.h"
-#include "ext/standard/info.h"
-
-#if HAVE_XML
-
-#include "php_xml.h"
-# include "ext/standard/head.h"
-
-/* Short-term TODO list:
- * - Implement XML_ExternalEntityParserCreate()
- * - XML_SetCommentHandler
- * - XML_SetCdataSectionHandler
- * - XML_SetParamEntityParsing
- */
-
-/* Long-term TODO list:
- * - Fix the expat library so you can install your own memory manager
- * functions
- */
-
-/* Known bugs:
- * - Weird things happen with <![CDATA[]]> sections.
- */
-
-#ifdef ZTS
-int xml_globals_id;
-#else
-PHP_XML_API php_xml_globals xml_globals;
-#endif
-
-/* {{{ dynamically loadable module stuff */
-#ifdef COMPILE_DL_XML
-ZEND_GET_MODULE(xml)
-#endif /* COMPILE_DL_XML */
-/* }}} */
-
-/* {{{ function prototypes */
-PHP_MINIT_FUNCTION(xml);
-PHP_RINIT_FUNCTION(xml);
-PHP_MSHUTDOWN_FUNCTION(xml);
-PHP_RSHUTDOWN_FUNCTION(xml);
-PHP_MINFO_FUNCTION(xml);
-
-static void xml_parser_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-static void xml_set_handler(zval **, zval **);
-inline static unsigned short xml_encode_iso_8859_1(unsigned char);
-inline static char xml_decode_iso_8859_1(unsigned short);
-inline static unsigned short xml_encode_us_ascii(unsigned char);
-inline static char xml_decode_us_ascii(unsigned short);
-static XML_Char *xml_utf8_encode(const char *, int, int *, const XML_Char *);
-static zval *xml_call_handler(xml_parser *, zval *, int, zval **);
-static zval *_xml_xmlchar_zval(const XML_Char *, int, const XML_Char *);
-static int _xml_xmlcharlen(const XML_Char *);
-static void _xml_add_to_info(xml_parser *parser,char *name);
-inline static char *_xml_decode_tag(xml_parser *parser, const char *tag);
-
-void _xml_startElementHandler(void *, const XML_Char *, const XML_Char **);
-void _xml_endElementHandler(void *, const XML_Char *);
-void _xml_characterDataHandler(void *, const XML_Char *, int);
-void _xml_processingInstructionHandler(void *, const XML_Char *, const XML_Char *);
-void _xml_defaultHandler(void *, const XML_Char *, int);
-void _xml_unparsedEntityDeclHandler(void *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *);
-void _xml_notationDeclHandler(void *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *);
-int _xml_externalEntityRefHandler(XML_Parser, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *);
-
-void _xml_startNamespaceDeclHandler(void *, const XML_Char *, const XML_Char *);
-void _xml_endNamespaceDeclHandler(void *, const XML_Char *);
-/* }}} */
-
-/* {{{ extension definition structures */
-static unsigned char third_and_fourth_args_force_ref[] = { 4, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE };
-
-function_entry xml_functions[] = {
- PHP_FE(xml_parser_create, NULL)
- PHP_FE(xml_parser_create_ns, NULL)
- PHP_FE(xml_set_object, second_arg_force_ref)
- PHP_FE(xml_set_element_handler, NULL)
- PHP_FE(xml_set_character_data_handler, NULL)
- PHP_FE(xml_set_processing_instruction_handler, NULL)
- PHP_FE(xml_set_default_handler, NULL)
- PHP_FE(xml_set_unparsed_entity_decl_handler, NULL)
- PHP_FE(xml_set_notation_decl_handler, NULL)
- PHP_FE(xml_set_external_entity_ref_handler, NULL)
- PHP_FE(xml_set_start_namespace_decl_handler, NULL)
- PHP_FE(xml_set_end_namespace_decl_handler, NULL)
- PHP_FE(xml_parse, NULL)
- PHP_FE(xml_parse_into_struct, third_and_fourth_args_force_ref)
- PHP_FE(xml_get_error_code, NULL)
- PHP_FE(xml_error_string, NULL)
- PHP_FE(xml_get_current_line_number, NULL)
- PHP_FE(xml_get_current_column_number, NULL)
- PHP_FE(xml_get_current_byte_index, NULL)
- PHP_FE(xml_parser_free, NULL)
- PHP_FE(xml_parser_set_option, NULL)
- PHP_FE(xml_parser_get_option, NULL)
- PHP_FE(utf8_encode, NULL)
- PHP_FE(utf8_decode, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry xml_module_entry = {
- STANDARD_MODULE_HEADER,
- "xml", /* extension name */
- xml_functions, /* extension function list */
- PHP_MINIT(xml), /* extension-wide startup function */
- PHP_MSHUTDOWN(xml), /* extension-wide shutdown function */
- PHP_RINIT(xml), /* per-request startup function */
- PHP_RSHUTDOWN(xml), /* per-request shutdown function */
- PHP_MINFO(xml), /* information function */
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-/* All the encoding functions are set to NULL right now, since all
- * the encoding is currently done internally by expat/xmltok.
- */
-xml_encoding xml_encodings[] = {
- { "ISO-8859-1", xml_decode_iso_8859_1, xml_encode_iso_8859_1 },
- { "US-ASCII", xml_decode_us_ascii, xml_encode_us_ascii },
- { "UTF-8", NULL, NULL },
- { NULL, NULL, NULL }
-};
-
-static XML_Memory_Handling_Suite php_xml_mem_hdlrs;
-
-/* True globals, no need for thread safety */
-static int le_xml_parser;
-
-/* }}} */
-
-/* {{{ startup, shutdown and info functions */
-#ifdef ZTS
-static void php_xml_init_globals(php_xml_globals *xml_globals_p TSRMLS_DC)
-{
- XML(default_encoding) = "ISO-8859-1";
-}
-#endif
-
-static void *php_xml_malloc_wrapper(size_t sz)
-{
- return emalloc(sz);
-}
-
-static void *php_xml_realloc_wrapper(void *ptr, size_t sz)
-{
- return erealloc(ptr, sz);
-}
-
-static void php_xml_free_wrapper(void *ptr)
-{
- efree(ptr);
-}
-
-PHP_MINIT_FUNCTION(xml)
-{
- le_xml_parser = zend_register_list_destructors_ex(xml_parser_dtor, NULL, "xml", module_number);
-
-#ifdef ZTS
- ts_allocate_id(&xml_globals_id, sizeof(php_xml_globals), (ts_allocate_ctor) php_xml_init_globals, NULL);
-#else
- XML(default_encoding) = "ISO-8859-1";
-#endif
-
- REGISTER_LONG_CONSTANT("XML_ERROR_NONE", XML_ERROR_NONE, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_NO_MEMORY", XML_ERROR_NO_MEMORY, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_SYNTAX", XML_ERROR_SYNTAX, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_NO_ELEMENTS", XML_ERROR_NO_ELEMENTS, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_INVALID_TOKEN", XML_ERROR_INVALID_TOKEN, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_UNCLOSED_TOKEN", XML_ERROR_UNCLOSED_TOKEN, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_PARTIAL_CHAR", XML_ERROR_PARTIAL_CHAR, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_TAG_MISMATCH", XML_ERROR_TAG_MISMATCH, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_DUPLICATE_ATTRIBUTE", XML_ERROR_DUPLICATE_ATTRIBUTE, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_JUNK_AFTER_DOC_ELEMENT", XML_ERROR_JUNK_AFTER_DOC_ELEMENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_PARAM_ENTITY_REF", XML_ERROR_PARAM_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_UNDEFINED_ENTITY", XML_ERROR_UNDEFINED_ENTITY, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_RECURSIVE_ENTITY_REF", XML_ERROR_RECURSIVE_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_ASYNC_ENTITY", XML_ERROR_ASYNC_ENTITY, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_BAD_CHAR_REF", XML_ERROR_BAD_CHAR_REF, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_BINARY_ENTITY_REF", XML_ERROR_BINARY_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF", XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_MISPLACED_XML_PI", XML_ERROR_MISPLACED_XML_PI, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_UNKNOWN_ENCODING", XML_ERROR_UNKNOWN_ENCODING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_INCORRECT_ENCODING", XML_ERROR_INCORRECT_ENCODING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_UNCLOSED_CDATA_SECTION", XML_ERROR_UNCLOSED_CDATA_SECTION, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_EXTERNAL_ENTITY_HANDLING", XML_ERROR_EXTERNAL_ENTITY_HANDLING, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("XML_OPTION_CASE_FOLDING", PHP_XML_OPTION_CASE_FOLDING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_OPTION_TARGET_ENCODING", PHP_XML_OPTION_TARGET_ENCODING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_OPTION_SKIP_TAGSTART", PHP_XML_OPTION_SKIP_TAGSTART, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_OPTION_SKIP_WHITE", PHP_XML_OPTION_SKIP_WHITE, CONST_CS|CONST_PERSISTENT);
-
- /* this object should not be pre-initialised at compile time,
- as the order of members may vary */
-
- php_xml_mem_hdlrs.malloc_fcn = php_xml_malloc_wrapper;
- php_xml_mem_hdlrs.realloc_fcn = php_xml_realloc_wrapper;
- php_xml_mem_hdlrs.free_fcn = php_xml_free_wrapper;
-
-#ifdef LIBXML_EXPAT_COMPAT
- xmlInitThreads();
-#endif
- return SUCCESS;
-}
-
-
-PHP_RINIT_FUNCTION(xml)
-{
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(xml)
-{
- return SUCCESS;
-}
-
-
-PHP_RSHUTDOWN_FUNCTION(xml)
-{
-#ifdef LIBXML_EXPAT_COMPAT
- xmlCleanupParser();
-#endif
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(xml)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "XML Support", "active");
- php_info_print_table_row(2, "XML Namespace Support", "active");
- php_info_print_table_row(2, "EXPAT Version",XML_ExpatVersion());
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ extension-internal functions */
-static zval *_xml_resource_zval(long value)
-{
- zval *ret;
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(ret);
-
- Z_TYPE_P(ret) = IS_RESOURCE;
- Z_LVAL_P(ret) = value;
-
- zend_list_addref(value);
-
- return ret;
-}
-
-static zval *_xml_string_zval(const char *str)
-{
- zval *ret;
- int len = strlen(str);
- MAKE_STD_ZVAL(ret);
-
- Z_TYPE_P(ret) = IS_STRING;
- Z_STRLEN_P(ret) = len;
- Z_STRVAL_P(ret) = estrndup(str, len);
- return ret;
-}
-
-static zval *_xml_xmlchar_zval(const XML_Char *s, int len, const XML_Char *encoding)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
-
- if (s == NULL) {
- ZVAL_FALSE(ret);
- return ret;
- }
- if (len == 0) {
- len = _xml_xmlcharlen(s);
- }
- Z_TYPE_P(ret) = IS_STRING;
- Z_STRVAL_P(ret) = xml_utf8_decode(s, len, &Z_STRLEN_P(ret), encoding);
- return ret;
-}
-/* }}} */
-
-/* {{{ xml_parser_dtor() */
-static void xml_parser_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- xml_parser *parser = (xml_parser *)rsrc->ptr;
-
- if (parser->parser) {
- XML_ParserFree(parser->parser);
- }
- if (parser->ltags) {
- int inx;
- for (inx = 0; inx < parser->level; inx++)
- efree(parser->ltags[ inx ]);
- efree(parser->ltags);
- }
- if (parser->startElementHandler) {
- zval_ptr_dtor(&parser->startElementHandler);
- }
- if (parser->endElementHandler) {
- zval_ptr_dtor(&parser->endElementHandler);
- }
- if (parser->characterDataHandler) {
- zval_ptr_dtor(&parser->characterDataHandler);
- }
- if (parser->processingInstructionHandler) {
- zval_ptr_dtor(&parser->processingInstructionHandler);
- }
- if (parser->defaultHandler) {
- zval_ptr_dtor(&parser->defaultHandler);
- }
- if (parser->unparsedEntityDeclHandler) {
- zval_ptr_dtor(&parser->unparsedEntityDeclHandler);
- }
- if (parser->notationDeclHandler) {
- zval_ptr_dtor(&parser->notationDeclHandler);
- }
- if (parser->externalEntityRefHandler) {
- zval_ptr_dtor(&parser->externalEntityRefHandler);
- }
- if (parser->unknownEncodingHandler) {
- zval_ptr_dtor(&parser->unknownEncodingHandler);
- }
- if (parser->startNamespaceDeclHandler) {
- zval_ptr_dtor(&parser->startNamespaceDeclHandler);
- }
- if (parser->endNamespaceDeclHandler) {
- zval_ptr_dtor(&parser->endNamespaceDeclHandler);
- }
- if (parser->baseURI) {
- efree(parser->baseURI);
- }
-
- efree(parser);
-}
-/* }}} */
-
-/* {{{ xml_set_handler() */
-static void xml_set_handler(zval **handler, zval **data)
-{
- /* IS_ARRAY might indicate that we're using array($obj, 'method') syntax */
- if (Z_TYPE_PP(data) != IS_ARRAY) {
- convert_to_string_ex(data);
- }
-
- /* If we have already a handler, release it */
- if (*handler) {
- zval_ptr_dtor(handler);
- }
-
- zval_add_ref(data);
- *handler = *data;
-}
-/* }}} */
-
-/* {{{ xml_call_handler() */
-static zval *xml_call_handler(xml_parser *parser, zval *handler, int argc, zval **argv)
-{
- TSRMLS_FETCH();
-
- if (parser && handler) {
- zval *retval;
- int i;
- int result;
-
- MAKE_STD_ZVAL(retval);
- ZVAL_FALSE(retval);
-
- result = call_user_function(EG(function_table), &parser->object, handler, retval, argc, argv TSRMLS_CC);
-
- if (result == FAILURE) {
- zval **method;
- zval **obj;
-
- if (Z_TYPE_P(handler) == IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", Z_STRVAL_P(handler));
- } else if (zend_hash_index_find(Z_ARRVAL_P(handler), 0, (void **) &obj) == SUCCESS &&
- zend_hash_index_find(Z_ARRVAL_P(handler), 1, (void **) &method) == SUCCESS &&
- Z_TYPE_PP(obj) == IS_OBJECT &&
- Z_TYPE_PP(method) == IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s::%s()", Z_OBJCE_PP(obj)->name, Z_STRVAL_PP(method));
- } else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler");
-
- zval_dtor(retval);
- efree(retval);
- }
-
- for (i = 0; i < argc; i++) {
- zval_ptr_dtor(&(argv[i]));
- }
-
- if (result == FAILURE) {
- return NULL;
- } else {
- return retval;
- }
- }
- return NULL;
-}
-/* }}} */
-
-/* {{{ xml_encode_iso_8859_1() */
-inline static unsigned short xml_encode_iso_8859_1(unsigned char c)
-{
- return (unsigned short)c;
-}
-/* }}} */
-
-/* {{{ xml_decode_iso_8859_1() */
-inline static char xml_decode_iso_8859_1(unsigned short c)
-{
- return (char)(c > 0xff ? '?' : c);
-}
-/* }}} */
-
-/* {{{ xml_encode_us_ascii() */
-inline static unsigned short xml_encode_us_ascii(unsigned char c)
-{
- return (unsigned short)c;
-}
-/* }}} */
-
-/* {{{ xml_decode_us_ascii() */
-inline static char xml_decode_us_ascii(unsigned short c)
-{
- return (char)(c > 0x7f ? '?' : c);
-}
-/* }}} */
-
-/* {{{ xml_get_encoding() */
-static xml_encoding *xml_get_encoding(const XML_Char *name)
-{
- xml_encoding *enc = &xml_encodings[0];
-
- while (enc && enc->name) {
- if (strcasecmp(name, enc->name) == 0) {
- return enc;
- }
- enc++;
- }
- return NULL;
-}
-/* }}} */
-
-/* {{{ xml_utf8_encode */
-static XML_Char *xml_utf8_encode(const char *s, int len, int *newlen, const XML_Char *encoding)
-{
- int pos = len;
- char *newbuf;
- unsigned short c;
- unsigned short (*encoder)(unsigned char) = NULL;
- xml_encoding *enc = xml_get_encoding(encoding);
-
- *newlen = 0;
- if (enc) {
- encoder = enc->encoding_function;
- } else {
- /* If the target encoding was unknown, fail */
- return NULL;
- }
- if (encoder == NULL) {
- /* If no encoder function was specified, return the data as-is.
- */
- newbuf = emalloc(len + 1);
- memcpy(newbuf, s, len);
- *newlen = len;
- newbuf[*newlen] = '\0';
- return newbuf;
- }
- /* This is the theoretical max (will never get beyond len * 2 as long
- * as we are converting from single-byte characters, though) */
- newbuf = emalloc(len * 4 + 1);
- while (pos > 0) {
- c = encoder ? encoder((unsigned char)(*s)) : (unsigned short)(*s);
- if (c < 0x80) {
- newbuf[(*newlen)++] = (char) c;
- } else if (c < 0x800) {
- newbuf[(*newlen)++] = (0xc0 | (c >> 6));
- newbuf[(*newlen)++] = (0x80 | (c & 0x3f));
- } else if (c < 0x10000) {
- newbuf[(*newlen)++] = (0xe0 | (c >> 12));
- newbuf[(*newlen)++] = (0xc0 | ((c >> 6) & 0x3f));
- newbuf[(*newlen)++] = (0x80 | (c & 0x3f));
- } else if (c < 0x200000) {
- newbuf[(*newlen)++] = (0xf0 | (c >> 18));
- newbuf[(*newlen)++] = (0xe0 | ((c >> 12) & 0x3f));
- newbuf[(*newlen)++] = (0xc0 | ((c >> 6) & 0x3f));
- newbuf[(*newlen)++] = (0x80 | (c & 0x3f));
- }
- pos--;
- s++;
- }
- newbuf[*newlen] = 0;
- newbuf = erealloc(newbuf, (*newlen)+1);
- return newbuf;
-}
-/* }}} */
-
-/* {{{ xml_utf8_decode */
-PHPAPI char *xml_utf8_decode(const XML_Char *s, int len, int *newlen, const XML_Char *encoding)
-{
- int pos = len;
- char *newbuf = emalloc(len + 1);
- unsigned short c;
- char (*decoder)(unsigned short) = NULL;
- xml_encoding *enc = xml_get_encoding(encoding);
-
- *newlen = 0;
- if (enc) {
- decoder = enc->decoding_function;
- }
- if (decoder == NULL) {
- /* If the target encoding was unknown, or no decoder function
- * was specified, return the UTF-8-encoded data as-is.
- */
- memcpy(newbuf, s, len);
- *newlen = len;
- newbuf[*newlen] = '\0';
- return newbuf;
- }
- while (pos > 0) {
- c = (unsigned char)(*s);
- if (c >= 0xf0) { /* four bytes encoded, 21 bits */
- c = ((s[0]&7)<<18) | ((s[1]&63)<<12) | ((s[2]&63)<<6) | (s[3]&63);
- s += 4;
- pos -= 4;
- } else if (c >= 0xe0) { /* three bytes encoded, 16 bits */
- c = ((s[0]&63)<<12) | ((s[1]&63)<<6) | (s[2]&63);
- s += 3;
- pos -= 3;
- } else if (c >= 0xc0) { /* two bytes encoded, 11 bits */
- c = ((s[0]&63)<<6) | (s[1]&63);
- s += 2;
- pos -= 2;
- } else {
- s++;
- pos--;
- }
- newbuf[*newlen] = decoder ? decoder(c) : c;
- ++*newlen;
- }
- if (*newlen < len) {
- newbuf = erealloc(newbuf, *newlen + 1);
- }
- newbuf[*newlen] = '\0';
- return newbuf;
-}
-/* }}} */
-
-/* {{{ _xml_xmlcharlen() */
-static int _xml_xmlcharlen(const XML_Char *s)
-{
- int len = 0;
-
- while (*s) {
- len++;
- s++;
- }
- return len;
-}
-/* }}} */
-
-/* {{{ _xml_zval_strdup() */
-PHPAPI char *_xml_zval_strdup(zval *val)
-{
- if (Z_TYPE_P(val) == IS_STRING) {
- char *buf = emalloc(Z_STRLEN_P(val) + 1);
- memcpy(buf, Z_STRVAL_P(val), Z_STRLEN_P(val));
- buf[Z_STRLEN_P(val)] = '\0';
- return buf;
- }
- return NULL;
-}
-/* }}} */
-
-/* {{{ _xml_add_to_info */
-static void _xml_add_to_info(xml_parser *parser,char *name)
-{
- zval **element, *values;
-
- if (! parser->info) {
- return;
- }
-
- if (zend_hash_find(Z_ARRVAL_P(parser->info),name,strlen(name) + 1,(void **) &element) == FAILURE) {
- MAKE_STD_ZVAL(values);
-
- array_init(values);
-
- zend_hash_update(Z_ARRVAL_P(parser->info), name, strlen(name)+1, (void *) &values, sizeof(zval*), (void **) &element);
- }
-
- add_next_index_long(*element,parser->curtag);
-
- parser->curtag++;
-}
-/* }}} */
-
-/* {{{ _xml_decode_tag() */
-static char *_xml_decode_tag(xml_parser *parser, const char *tag)
-{
- char *newstr;
- int out_len;
-
- newstr = xml_utf8_decode(tag, strlen(tag), &out_len, parser->target_encoding);
-
- if (parser->case_folding) {
- php_strtoupper(newstr, out_len);
- }
-
- return newstr;
-}
-/* }}} */
-
-/* {{{ _xml_startElementHandler() */
-void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Char **attributes)
-{
- xml_parser *parser = (xml_parser *)userData;
- const char **attrs = attributes;
- char *tag_name;
- char *att, *val;
- int val_len;
- zval *retval, *args[3];
-
- if (parser) {
- parser->level++;
-
- tag_name = _xml_decode_tag(parser, name);
-
- if (parser->startElementHandler) {
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_string_zval(tag_name);
- MAKE_STD_ZVAL(args[2]);
- array_init(args[2]);
-
- while (attributes && *attributes) {
- att = _xml_decode_tag(parser, attributes[0]);
- val = xml_utf8_decode(attributes[1], strlen(attributes[1]), &val_len, parser->target_encoding);
-
- add_assoc_stringl(args[2], att, val, val_len, 0);
-
- attributes += 2;
-
- efree(att);
- }
-
- if ((retval = xml_call_handler(parser, parser->startElementHandler, 3, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-
- if (parser->data) {
- zval *tag, *atr;
- int atcnt = 0;
-
- MAKE_STD_ZVAL(tag);
- MAKE_STD_ZVAL(atr);
-
- array_init(tag);
- array_init(atr);
-
- _xml_add_to_info(parser,((char *) tag_name) + parser->toffset);
-
- add_assoc_string(tag,"tag",((char *) tag_name) + parser->toffset,1); /* cast to avoid gcc-warning */
- add_assoc_string(tag,"type","open",1);
- add_assoc_long(tag,"level",parser->level);
-
- parser->ltags[parser->level-1] = estrdup(tag_name);
- parser->lastwasopen = 1;
-
- attributes = attrs;
-
- while (attributes && *attributes) {
- att = _xml_decode_tag(parser, attributes[0]);
- val = xml_utf8_decode(attributes[1], strlen(attributes[1]), &val_len, parser->target_encoding);
-
- add_assoc_stringl(atr,att,val,val_len,0);
-
- atcnt++;
- attributes += 2;
-
- efree(att);
- }
-
- if (atcnt) {
- zend_hash_add(Z_ARRVAL_P(tag),"attributes",sizeof("attributes"),&atr,sizeof(zval*),NULL);
- } else {
- zval_dtor(atr);
- FREE_ZVAL(atr);
- }
-
- zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),(void *) &parser->ctag);
- }
-
- efree(tag_name);
- }
-}
-/* }}} */
-
-/* {{{ _xml_endElementHandler() */
-void _xml_endElementHandler(void *userData, const XML_Char *name)
-{
- xml_parser *parser = (xml_parser *)userData;
- char *tag_name;
-
- if (parser) {
- zval *retval, *args[2];
-
- tag_name = _xml_decode_tag(parser, name);
-
- if (parser->endElementHandler) {
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_string_zval(tag_name);
-
- if ((retval = xml_call_handler(parser, parser->endElementHandler, 2, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-
- if (parser->data) {
- zval *tag;
-
- if (parser->lastwasopen) {
- add_assoc_string(*(parser->ctag),"type","complete",1);
- } else {
- MAKE_STD_ZVAL(tag);
-
- array_init(tag);
-
- _xml_add_to_info(parser,((char *) tag_name) + parser->toffset);
-
- add_assoc_string(tag,"tag",((char *) tag_name) + parser->toffset,1); /* cast to avoid gcc-warning */
- add_assoc_string(tag,"type","close",1);
- add_assoc_long(tag,"level",parser->level);
-
- zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),NULL);
- }
-
- parser->lastwasopen = 0;
- }
-
- efree(tag_name);
-
- if (parser->ltags) {
- efree(parser->ltags[parser->level-1]);
- }
-
- parser->level--;
- }
-}
-/* }}} */
-
-/* {{{ _xml_characterDataHandler() */
-void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
-{
- xml_parser *parser = (xml_parser *)userData;
-
- if (parser) {
- zval *retval, *args[2];
-
- if (parser->characterDataHandler) {
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(s, len, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->characterDataHandler, 2, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-
- if (parser->data) {
- int i;
- int doprint = 0;
-
- char *decoded_value;
- int decoded_len;
-
- decoded_value = xml_utf8_decode(s,len,&decoded_len,parser->target_encoding);
- for (i = 0; i < decoded_len; i++) {
- switch (decoded_value[i]) {
- case ' ':
- case '\t':
- case '\n':
- continue;
- default:
- doprint = 1;
- break;
- }
- if (doprint) {
- break;
- }
- }
- if (doprint || (! parser->skipwhite)) {
- if (parser->lastwasopen) {
- zval **myval;
-
- /* check if the current tag already has a value - if yes append to that! */
- if (zend_hash_find(Z_ARRVAL_PP(parser->ctag),"value",sizeof("value"),(void **) &myval) == SUCCESS) {
- int newlen = Z_STRLEN_PP(myval) + decoded_len;
- Z_STRVAL_PP(myval) = erealloc(Z_STRVAL_PP(myval),newlen+1);
- strcpy(Z_STRVAL_PP(myval) + Z_STRLEN_PP(myval),decoded_value);
- Z_STRLEN_PP(myval) += decoded_len;
- efree(decoded_value);
- } else {
- add_assoc_string(*(parser->ctag),"value",decoded_value,0);
- }
-
- } else {
- zval *tag;
-
- MAKE_STD_ZVAL(tag);
-
- array_init(tag);
-
- _xml_add_to_info(parser,parser->ltags[parser->level-1] + parser->toffset);
-
- add_assoc_string(tag,"tag",parser->ltags[parser->level-1] + parser->toffset,1);
- add_assoc_string(tag,"value",decoded_value,0);
- add_assoc_string(tag,"type","cdata",1);
- add_assoc_long(tag,"level",parser->level);
-
- zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),NULL);
- }
- } else {
- efree(decoded_value);
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ _xml_processingInstructionHandler() */
-void _xml_processingInstructionHandler(void *userData, const XML_Char *target, const XML_Char *data)
-{
- xml_parser *parser = (xml_parser *)userData;
-
- if (parser && parser->processingInstructionHandler) {
- zval *retval, *args[3];
-
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(target, 0, parser->target_encoding);
- args[2] = _xml_xmlchar_zval(data, 0, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->processingInstructionHandler, 3, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-}
-/* }}} */
-
-/* {{{ _xml_defaultHandler() */
-void _xml_defaultHandler(void *userData, const XML_Char *s, int len)
-{
- xml_parser *parser = (xml_parser *)userData;
-
- if (parser && parser->defaultHandler) {
- zval *retval, *args[2];
-
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(s, len, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->defaultHandler, 2, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-}
-/* }}} */
-
-/* {{{ _xml_unparsedEntityDeclHandler() */
-void _xml_unparsedEntityDeclHandler(void *userData,
- const XML_Char *entityName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId,
- const XML_Char *notationName)
-{
- xml_parser *parser = (xml_parser *)userData;
-
- if (parser && parser->unparsedEntityDeclHandler) {
- zval *retval, *args[6];
-
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(entityName, 0, parser->target_encoding);
- args[2] = _xml_xmlchar_zval(base, 0, parser->target_encoding);
- args[3] = _xml_xmlchar_zval(systemId, 0, parser->target_encoding);
- args[4] = _xml_xmlchar_zval(publicId, 0, parser->target_encoding);
- args[5] = _xml_xmlchar_zval(notationName, 0, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->unparsedEntityDeclHandler, 6, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-}
-/* }}} */
-
-/* {{{ _xml_notationDeclHandler() */
-void _xml_notationDeclHandler(void *userData,
- const XML_Char *notationName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
-{
- xml_parser *parser = (xml_parser *)userData;
-
- if (parser && parser->notationDeclHandler) {
- zval *retval, *args[5];
-
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(notationName, 0, parser->target_encoding);
- args[2] = _xml_xmlchar_zval(base, 0, parser->target_encoding);
- args[3] = _xml_xmlchar_zval(systemId, 0, parser->target_encoding);
- args[4] = _xml_xmlchar_zval(publicId, 0, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->notationDeclHandler, 5, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-}
-/* }}} */
-
-/* {{{ _xml_externalEntityRefHandler() */
-int _xml_externalEntityRefHandler(XML_Parser parserPtr,
- const XML_Char *openEntityNames,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
-{
- xml_parser *parser = XML_GetUserData(parserPtr);
- int ret = 0; /* abort if no handler is set (should be configurable?) */
-
- if (parser && parser->externalEntityRefHandler) {
- zval *retval, *args[5];
-
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(openEntityNames, 0, parser->target_encoding);
- args[2] = _xml_xmlchar_zval(base, 0, parser->target_encoding);
- args[3] = _xml_xmlchar_zval(systemId, 0, parser->target_encoding);
- args[4] = _xml_xmlchar_zval(publicId, 0, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->externalEntityRefHandler, 5, args))) {
- convert_to_long(retval);
- ret = Z_LVAL_P(retval);
- efree(retval);
- } else {
- ret = 0;
- }
- }
- return ret;
-}
-/* }}} */
-
-/* {{{ _xml_startNamespaceDeclHandler() */
-void _xml_startNamespaceDeclHandler(void *userData,const XML_Char *prefix, const XML_Char *uri)
-{
- xml_parser *parser = (xml_parser *)userData;
-
- if (parser && parser->startNamespaceDeclHandler) {
- zval *retval, *args[3];
-
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(prefix, 0, parser->target_encoding);
- args[2] = _xml_xmlchar_zval(uri, 0, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->startNamespaceDeclHandler, 3, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-}
-/* }}} */
-
-/* {{{ _xml_endNamespaceDeclHandler() */
-void _xml_endNamespaceDeclHandler(void *userData, const XML_Char *prefix)
-{
- xml_parser *parser = (xml_parser *)userData;
-
- if (parser && parser->endNamespaceDeclHandler) {
- zval *retval, *args[2];
-
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(prefix, 0, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->endNamespaceDeclHandler, 2, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-}
-/* }}} */
-
-/************************* EXTENSION FUNCTIONS *************************/
-
-static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_support)
-{
- xml_parser *parser;
- int auto_detect = 0;
-
- char *encoding_param = NULL;
- int encoding_param_len = 0;
-
- char *ns_param = NULL;
- int ns_param_len = 0;
-
- XML_Char *encoding;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, (ns_support ? "|ss": "|s"), &encoding_param, &encoding_param_len, &ns_param, &ns_param_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (encoding_param != NULL) {
- /* The supported encoding types are hardcoded here because
- * we are limited to the encodings supported by expat/xmltok.
- */
- if (encoding_param_len == 0) {
- encoding = XML(default_encoding);
- auto_detect = 1;
- } else if (strcasecmp(encoding_param, "ISO-8859-1") == 0) {
- encoding = "ISO-8859-1";
- } else if (strcasecmp(encoding_param, "UTF-8") == 0) {
- encoding = "UTF-8";
- } else if (strcasecmp(encoding_param, "US-ASCII") == 0) {
- encoding = "US-ASCII";
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unsupported source encoding \"%s\"", encoding_param);
- RETURN_FALSE;
- }
- } else {
- encoding = XML(default_encoding);
- }
-
- if (ns_support && ns_param == NULL){
- ns_param = ":";
- }
-
- parser = ecalloc(sizeof(xml_parser), 1);
- parser->parser = XML_ParserCreate_MM((auto_detect ? NULL : encoding),
- &php_xml_mem_hdlrs, ns_param);
-
- parser->target_encoding = encoding;
- parser->case_folding = 1;
- parser->object = NULL;
- XML_SetUserData(parser->parser, parser);
-
- ZEND_REGISTER_RESOURCE(return_value, parser,le_xml_parser);
- parser->index = Z_LVAL_P(return_value);
-}
-
-/* {{{ proto resource xml_parser_create([string encoding])
- Create an XML parser */
-PHP_FUNCTION(xml_parser_create)
-{
- php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto resource xml_parser_create_ns([string encoding [, string sep]])
- Create an XML parser */
-PHP_FUNCTION(xml_parser_create_ns)
-{
- php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int xml_set_object(resource parser, object &obj)
- Set up object which should be used for callbacks */
-PHP_FUNCTION(xml_set_object)
-{
- xml_parser *parser;
- zval **pind, **mythis;
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &pind, &mythis) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(mythis) != IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument 2 has wrong type");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *,pind, -1, "XML Parser", le_xml_parser);
-
- /* please leave this commented - or ask thies@thieso.net before doing it (again) */
-#ifdef ZEND_ENGINE_2
- if (parser->object) {
- zval_ptr_dtor(&parser->object);
- }
-#endif
-
- parser->object = *mythis;
-
- /* please leave this commented - or ask thies@thieso.net before doing it (again) */
-/* #ifdef ZEND_ENGINE_2
- zval_add_ref(&parser->object);
-#endif */
-
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_element_handler(resource parser, string shdl, string ehdl)
- Set up start and end element handlers */
-PHP_FUNCTION(xml_set_element_handler)
-{
- xml_parser *parser;
- zval **pind, **shdl, **ehdl;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &pind, &shdl, &ehdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *,pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->startElementHandler, shdl);
- xml_set_handler(&parser->endElementHandler, ehdl);
- XML_SetElementHandler(parser->parser, _xml_startElementHandler, _xml_endElementHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_character_data_handler(resource parser, string hdl)
- Set up character data handler */
-PHP_FUNCTION(xml_set_character_data_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->characterDataHandler, hdl);
- XML_SetCharacterDataHandler(parser->parser, _xml_characterDataHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_processing_instruction_handler(resource parser, string hdl)
- Set up processing instruction (PI) handler */
-PHP_FUNCTION(xml_set_processing_instruction_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->processingInstructionHandler, hdl);
- XML_SetProcessingInstructionHandler(parser->parser, _xml_processingInstructionHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_default_handler(resource parser, string hdl)
- Set up default handler */
-PHP_FUNCTION(xml_set_default_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->defaultHandler, hdl);
- XML_SetDefaultHandler(parser->parser, _xml_defaultHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_unparsed_entity_decl_handler(resource parser, string hdl)
- Set up unparsed entity declaration handler */
-PHP_FUNCTION(xml_set_unparsed_entity_decl_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->unparsedEntityDeclHandler, hdl);
- XML_SetUnparsedEntityDeclHandler(parser->parser, _xml_unparsedEntityDeclHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_notation_decl_handler(resource parser, string hdl)
- Set up notation declaration handler */
-PHP_FUNCTION(xml_set_notation_decl_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->notationDeclHandler, hdl);
- XML_SetNotationDeclHandler(parser->parser, _xml_notationDeclHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_external_entity_ref_handler(resource parser, string hdl)
- Set up external entity reference handler */
-PHP_FUNCTION(xml_set_external_entity_ref_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->externalEntityRefHandler, hdl);
- XML_SetExternalEntityRefHandler(parser->parser, _xml_externalEntityRefHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_start_namespace_decl_handler(resource parser, string hdl)
- Set up character data handler */
-PHP_FUNCTION(xml_set_start_namespace_decl_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->startNamespaceDeclHandler, hdl);
- XML_SetStartNamespaceDeclHandler(parser->parser, _xml_startNamespaceDeclHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_end_namespace_decl_handler(resource parser, string hdl)
- Set up character data handler */
-PHP_FUNCTION(xml_set_end_namespace_decl_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->endNamespaceDeclHandler, hdl);
- XML_SetEndNamespaceDeclHandler(parser->parser, _xml_endNamespaceDeclHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_parse(resource parser, string data [, int isFinal])
- Start parsing an XML document */
-PHP_FUNCTION(xml_parse)
-{
- xml_parser *parser;
- zval **pind, **data, **final;
- int argc, isFinal, ret;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &pind, &data, &final) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- convert_to_string_ex(data);
-
- if (argc == 3) {
- convert_to_long_ex(final);
- isFinal = Z_LVAL_PP(final);
- } else {
- isFinal = 0;
- }
-
- ret = XML_Parse(parser->parser, Z_STRVAL_PP(data), Z_STRLEN_PP(data), isFinal);
- RETVAL_LONG(ret);
-}
-
-/* }}} */
-
-/* {{{ proto int xml_parse_into_struct(resource parser, string data, array &struct, array &index)
- Parsing a XML document */
-
-PHP_FUNCTION(xml_parse_into_struct)
-{
- xml_parser *parser;
- zval **pind, **data, **xdata, **info = 0;
- int argc, ret;
-
- argc = ZEND_NUM_ARGS();
- if (zend_get_parameters_ex(4, &pind, &data, &xdata,&info) == SUCCESS) {
- zval_dtor(*info);
- array_init(*info);
- } else if (zend_get_parameters_ex(3, &pind, &data, &xdata) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- convert_to_string_ex(data);
- zval_dtor(*xdata);
- array_init(*xdata);
-
- parser->data = *xdata;
- if (info)
- parser->info = *info;
- parser->level = 0;
- parser->ltags = emalloc(XML_MAXLEVEL * sizeof(char *));
-
- XML_SetDefaultHandler(parser->parser, _xml_defaultHandler);
- XML_SetElementHandler(parser->parser, _xml_startElementHandler, _xml_endElementHandler);
- XML_SetCharacterDataHandler(parser->parser, _xml_characterDataHandler);
-
- ret = XML_Parse(parser->parser, Z_STRVAL_PP(data), Z_STRLEN_PP(data), 1);
-
- RETVAL_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto int xml_get_error_code(resource parser)
- Get XML parser error code */
-PHP_FUNCTION(xml_get_error_code)
-{
- xml_parser *parser;
- zval **pind;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- RETVAL_LONG((long)XML_GetErrorCode(parser->parser));
-}
-/* }}} */
-
-/* {{{ proto string xml_error_string(int code)
- Get XML parser error string */
-PHP_FUNCTION(xml_error_string)
-{
- zval **code;
- char *str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &code) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(code);
- str = (char *)XML_ErrorString((int)Z_LVAL_PP(code));
- if (str) {
- RETVAL_STRING(str, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto int xml_get_current_line_number(resource parser)
- Get current line number for an XML parser */
-PHP_FUNCTION(xml_get_current_line_number)
-{
- xml_parser *parser;
- zval **pind;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- RETVAL_LONG(XML_GetCurrentLineNumber(parser->parser));
-}
-/* }}} */
-
-/* {{{ proto int xml_get_current_column_number(resource parser)
- Get current column number for an XML parser */
-PHP_FUNCTION(xml_get_current_column_number)
-{
- xml_parser *parser;
- zval **pind;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- RETVAL_LONG(XML_GetCurrentColumnNumber(parser->parser));
-}
-/* }}} */
-
-/* {{{ proto int xml_get_current_byte_index(resource parser)
- Get current byte index for an XML parser */
-PHP_FUNCTION(xml_get_current_byte_index)
-{
- xml_parser *parser;
- zval **pind;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- RETVAL_LONG(XML_GetCurrentByteIndex(parser->parser));
-}
-/* }}} */
-
-/* {{{ proto int xml_parser_free(resource parser)
- Free an XML parser */
-PHP_FUNCTION(xml_parser_free)
-{
- zval **pind;
- xml_parser *parser;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- if (zend_list_delete(parser->index) == FAILURE) {
- RETURN_FALSE;
- }
-
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_parser_set_option(resource parser, int option, mixed value)
- Set options in an XML parser */
-PHP_FUNCTION(xml_parser_set_option)
-{
- xml_parser *parser;
- zval **pind, **opt, **val;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &pind, &opt, &val) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- convert_to_long_ex(opt);
-
- switch (Z_LVAL_PP(opt)) {
- case PHP_XML_OPTION_CASE_FOLDING:
- convert_to_long_ex(val);
- parser->case_folding = Z_LVAL_PP(val);
- break;
- case PHP_XML_OPTION_SKIP_TAGSTART:
- convert_to_long_ex(val);
- parser->toffset = Z_LVAL_PP(val);
- break;
- case PHP_XML_OPTION_SKIP_WHITE:
- convert_to_long_ex(val);
- parser->skipwhite = Z_LVAL_PP(val);
- break;
- case PHP_XML_OPTION_TARGET_ENCODING: {
- xml_encoding *enc;
- convert_to_string_ex(val);
- enc = xml_get_encoding(Z_STRVAL_PP(val));
- if (enc == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported target encoding \"%s\"", Z_STRVAL_PP(val));
- RETURN_FALSE;
- }
- parser->target_encoding = enc->name;
- break;
- }
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option");
- RETURN_FALSE;
- break;
- }
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_parser_get_option(resource parser, int option)
- Get options from an XML parser */
-PHP_FUNCTION(xml_parser_get_option)
-{
- xml_parser *parser;
- zval **pind, **opt;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &opt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- convert_to_long_ex(opt);
-
- switch (Z_LVAL_PP(opt)) {
- case PHP_XML_OPTION_CASE_FOLDING:
- RETURN_LONG(parser->case_folding);
- break;
- case PHP_XML_OPTION_TARGET_ENCODING:
- RETURN_STRING(parser->target_encoding, 1);
- break;
- default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option");
- RETURN_FALSE;
- break;
- }
-
- RETVAL_FALSE; /* never reached */
-}
-/* }}} */
-
-/* {{{ proto string utf8_encode(string data)
- Encodes an ISO-8859-1 string to UTF-8 */
-PHP_FUNCTION(utf8_encode)
-{
- zval **arg;
- XML_Char *encoded;
- int len;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
- encoded = xml_utf8_encode(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &len, "ISO-8859-1");
- if (encoded == NULL) {
- RETURN_FALSE;
- }
- RETVAL_STRINGL(encoded, len, 0);
-}
-/* }}} */
-
-/* {{{ proto string utf8_decode(string data)
- Converts a UTF-8 encoded string to ISO-8859-1 */
-PHP_FUNCTION(utf8_decode)
-{
- zval **arg;
- XML_Char *decoded;
- int len;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
- decoded = xml_utf8_decode(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &len, "ISO-8859-1");
- if (decoded == NULL) {
- RETURN_FALSE;
- }
- RETVAL_STRINGL(decoded, len, 0);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/xml/xml.mak b/ext/xml/xml.mak
deleted file mode 100644
index 971008d661..0000000000
--- a/ext/xml/xml.mak
+++ /dev/null
@@ -1,172 +0,0 @@
-# Temporarily here -- later may go into some batch file
-# which will set this as an environment variable
-PROJECT_ROOT = ..\..
-
-# Module details
-MODULE_NAME = php_xml
-MODULE_DESC = "PHP 4.3 - XML Extension"
-VMAJ = 3
-VMIN = 0
-VREV = 0
-
-#include the common settings
-include $(PROJECT_ROOT)/netware/common.mif
-
-# Extensions of all input and output files
-.SUFFIXES:
-.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d
-
-# Source files
-C_SRC = xml.c \
- start.c
-
-CPP_SRC_NODIR = $(notdir $(CPP_SRC))
-C_SRC_NODIR = $(notdir $(C_SRC))
-SRC_DIR = $(dir $(CPP_SRC) $(C_SRC))
-
-# Library files
-LIBRARY =
-
-# Destination directories and files
-OBJ_DIR = $(BUILD)
-FINAL_DIR = $(BUILD)
-MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map
-OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.obj) $(C_SRC_NODIR:.c=.obj))
-DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.d) $(C_SRC_NODIR:.c=.d))
-
-# Binary file
-ifndef BINARY
- BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm
-endif
-
-# Compile flags
-C_FLAGS += -c -maxerrors 25 -msgstyle gcc
-C_FLAGS += -wchar_t on -bool on
-C_FLAGS += -processor Pentium
-C_FLAGS += -nostdinc -nosyspath
-C_FLAGS += -relax_pointers # To remove type-casting errors
-C_FLAGS += -DNETWARE -DZTS
-C_FLAGS += -DNEW_LIBC
-C_FLAGS += -DCOMPILE_DL_XML -DHAVE_LIBEXPAT=1
-C_FLAGS += -I. -I- -I$(PROJECT_ROOT) -I$(PROJECT_ROOT)/main
-C_FLAGS += -I$(PROJECT_ROOT)/ext/standard -I$(PROJECT_ROOT)/netware
-C_FLAGS += -I$(PROJECT_ROOT)/zend -I$(PROJECT_ROOT)/tsrm
-C_FLAGS += -I$(SDK_DIR)/include -I$(MWCIncludes)
-C_FLAGS += -I$(EXPAT_DIR)/include
-
-ifndef STACK_SIZE
-STACK_SIZE=8192
-endif
-
-# Extra stuff based on debug / release builds
-ifeq '$(BUILD)' 'debug'
- SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym
- C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -sym internal -DDEBUGGING -DDKFBPON
- C_FLAGS += -exc cw -DZEND_DEBUG=1
- LD_FLAGS += -sym on -sym codeview4 -osym $(SYM_FILE)
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib
-else
- C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off
- C_FLAGS += -opt intrinsics
- C_FLAGS += -opt level=4 -DZEND_DEBUG=0
- LD_FLAGS += -sym off
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
-endif
-
-# Dependencies
-MODULE = LibC \
- expatlbc \
- phplib
-IMPORT = @$(SDK_DIR)/imports/libc.imp \
- @$(SDK_DIR)/imports/ws2nlm.imp \
- @$(MPK_DIR)/import/mpkOrg.imp \
- @$(EXPAT_DIR)/imports/expatlbc.imp \
- @$(PROJECT_ROOT)/netware/phplib.imp
-EXPORT = ($(MODULE_NAME)) get_module
-API = OutputToScreen
-
-
-# Virtual paths
-vpath %.cpp .
-vpath %.c . ..\..\netware
-vpath %.obj $(OBJ_DIR)
-
-
-all: prebuild project
-
-.PHONY: all
-
-prebuild:
- @if not exist $(OBJ_DIR) md $(OBJ_DIR)
-
-project: $(BINARY)
- @echo Build complete.
-
-$(OBJ_DIR)/%.d: %.cpp
- @echo Building Dependencies for $(<F)
- @$(CC) -M $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.d: %.c
- @echo Building Dependencies for $(<F)
- @$(CC) -M $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.obj: %.cpp
- @echo Compiling $?...
- @$(CC) $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.obj: %.c
- @echo Compiling $?...
- @$(CC) $< $(C_FLAGS) -o $@
-
-
-$(BINARY): $(OBJECTS)
- @echo Import $(IMPORT) > $(basename $@).def
-ifdef API
- @echo Import $(API) >> $(basename $@).def
-endif
- @echo Module $(MODULE) >> $(basename $@).def
-ifdef EXPORT
- @echo Export $(EXPORT) >> $(basename $@).def
-endif
- @echo AutoUnload >> $(basename $@).def
-ifeq '$(BUILD)' 'debug'
- @echo Debug >> $(basename $@).def
-endif
- @echo Flag_On 0x00000008 >> $(basename $@).def
- @echo Start _LibCPrelude >> $(basename $@).def
- @echo Exit _LibCPostlude >> $(basename $@).def
-
- $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc
- @echo xdcdata $(basename $@).xdc >> $(basename $@).def
-
- @echo Linking $@...
- @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link
- @echo $(LIBRARY) $(OBJECTS) >> $(basename $@).link
-
- @$(LINK) @$(basename $@).link
-
-
-.PHONY: clean
-clean: cleanobj cleanbin
-
-.PHONY: cleand
-cleand:
- @echo Deleting all dependency files...
- -@del "$(OBJ_DIR)\*.d"
-
-.PHONY: cleanobj
-cleanobj:
- @echo Deleting all object files...
- -@del "$(OBJ_DIR)\*.obj"
-
-.PHONY: cleanbin
-cleanbin:
- @echo Deleting binary files...
- -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm"
- @echo Deleting MAP, DEF files, etc....
- -@del "$(FINAL_DIR)\$(MODULE_NAME).map"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).def"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).link"
-ifeq '$(BUILD)' 'debug'
- -@del $(FINAL_DIR)\$(MODULE_NAME).sym
-endif
diff --git a/ext/xmlrpc/CREDITS b/ext/xmlrpc/CREDITS
deleted file mode 100644
index cfb14faf80..0000000000
--- a/ext/xmlrpc/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-xmlrpc
-Dan Libby
diff --git a/ext/xmlrpc/EXPERIMENTAL b/ext/xmlrpc/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/xmlrpc/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/xmlrpc/config.m4 b/ext/xmlrpc/config.m4
deleted file mode 100644
index 712e240470..0000000000
--- a/ext/xmlrpc/config.m4
+++ /dev/null
@@ -1,93 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-sinclude(ext/xmlrpc/libxmlrpc/acinclude.m4)
-sinclude(ext/xmlrpc/libxmlrpc/xmlrpc.m4)
-sinclude(libxmlrpc/acinclude.m4)
-sinclude(libxmlrpc/xmlrpc.m4)
-
-PHP_ARG_WITH(xmlrpc, for XMLRPC-EPI support,
-[ --with-xmlrpc[=DIR] Include XMLRPC-EPI support.])
-
-PHP_ARG_WITH(expat-dir, libexpat dir for XMLRPC-EPI,
-[ --with-expat-dir=DIR XMLRPC-EPI: libexpat dir for XMLRPC-EPI.],yes,no)
-
-PHP_ARG_WITH(iconv-dir, iconv dir for XMLRPC-EPI,
-[ --with-iconv-dir=DIR XMLRPC-EPI: iconv dir for XMLRPC-EPI.],yes,no)
-
-if test "$PHP_XMLRPC" != "no"; then
-
- PHP_SUBST(XMLRPC_SHARED_LIBADD)
- AC_DEFINE(HAVE_XMLRPC,1,[ ])
-
- testval=no
- for i in /usr /usr/local $PHP_EXPAT_DIR $XMLRPC_DIR; do
- if test -f $i/lib/libexpat.a -o -f $i/lib/libexpat.$SHLIB_SUFFIX_NAME; then
- AC_DEFINE(HAVE_LIBEXPAT2,1,[ ])
- PHP_ADD_LIBRARY_WITH_PATH(expat, $i/lib, XMLRPC_SHARED_LIBADD)
- PHP_ADD_INCLUDE($i/include)
- testval=yes
- fi
- done
-
- if test "$testval" = "no"; then
- AC_MSG_ERROR(XML-RPC support requires libexpat. Use --with-expat-dir=<DIR>)
- fi
-
- if test "$PHP_ICONV_DIR" != "no"; then
- PHP_ICONV=$PHP_ICONV_DIR
- fi
-
- if test "$PHP_ICONV" = "no"; then
- PHP_ICONV=yes
- fi
-
- PHP_SETUP_ICONV(XMLRPC_SHARED_LIBADD, [], [
- AC_MSG_ERROR([iconv not found, in order to build xmlrpc you need the iconv library])
- ])
-fi
-
-
-if test "$PHP_XMLRPC" = "yes"; then
- XMLRPC_CHECKS
- PHP_NEW_EXTENSION(xmlrpc,xmlrpc-epi-php.c libxmlrpc/base64.c \
- libxmlrpc/simplestring.c libxmlrpc/xml_to_dandarpc.c \
- libxmlrpc/xmlrpc_introspection.c libxmlrpc/encodings.c \
- libxmlrpc/system_methods.c libxmlrpc/xml_to_xmlrpc.c \
- libxmlrpc/queue.c libxmlrpc/xml_element.c libxmlrpc/xmlrpc.c \
- libxmlrpc/xml_to_soap.c,$ext_shared,,
- -I@ext_srcdir@/libxmlrpc -DVERSION="0.50")
- PHP_ADD_BUILD_DIR($ext_builddir/libxmlrpc)
- XMLRPC_MODULE_TYPE=builtin
-
-elif test "$PHP_XMLRPC" != "no"; then
-
- if test -r $PHP_XMLRPC/include/xmlrpc.h; then
- XMLRPC_DIR=$PHP_XMLRPC/include
- elif test -r $PHP_XMLRPC/include/xmlrpc-epi/xmlrpc.h; then
-dnl some xmlrpc-epi header files have generic file names like
-dnl queue.h or base64.h. Distributions have to create dir
-dnl for xmlrpc-epi because of this.
- XMLRPC_DIR=$PHP_XMLRPC/include/xmlrpc-epi
- else
- AC_MSG_CHECKING(for XMLRPC-EPI in default path)
- for i in /usr/local /usr; do
- if test -r $i/include/xmlrpc.h; then
- XMLRPC_DIR=$i/include
- AC_MSG_RESULT(found in $i)
- fi
- done
- fi
-
- if test -z "$XMLRPC_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the XMLRPC-EPI distribution)
- fi
-
- PHP_ADD_INCLUDE($XMLRPC_DIR)
- PHP_ADD_LIBRARY_WITH_PATH(xmlrpc, $XMLRPC_DIR/lib, XMLRPC_SHARED_LIBADD)
-
-fi
-
-
diff --git a/ext/xmlrpc/libxmlrpc/README b/ext/xmlrpc/libxmlrpc/README
deleted file mode 100644
index 323edfa671..0000000000
--- a/ext/xmlrpc/libxmlrpc/README
+++ /dev/null
@@ -1,17 +0,0 @@
-organization of this directory is moving towards this approach:
-
-<module>.h -- public API and data types
-<module>_private.h -- protected API and data types
-<module>.c -- implementation and private API / types
-
-The rules are:
-.c files may include *_private.h.
-.h files may not include *_private.h
-
-This allows us to have a nicely encapsulated C api with opaque data types and private functions
-that are nonetheless shared between source files without redundant extern declarations..
-
-
-
-
-
diff --git a/ext/xmlrpc/libxmlrpc/acinclude.m4 b/ext/xmlrpc/libxmlrpc/acinclude.m4
deleted file mode 100644
index 07bf4f0b07..0000000000
--- a/ext/xmlrpc/libxmlrpc/acinclude.m4
+++ /dev/null
@@ -1,32 +0,0 @@
-# Local macros for automake & autoconf
-
-AC_DEFUN(XMLRPC_FUNCTION_CHECKS,[
-
-# Standard XMLRPC list
-AC_CHECK_FUNCS( \
- strtoul strtoull snprintf \
- strstr strpbrk strerror\
- memcpy memmove)
-
-])
-
-AC_DEFUN(XMLRPC_HEADER_CHECKS,[
-AC_HEADER_STDC
-AC_CHECK_HEADERS(xmlparse.h xmltok.h stdlib.h strings.h string.h)
-])
-
-AC_DEFUN(XMLRPC_TYPE_CHECKS,[
-
-AC_REQUIRE([AC_C_CONST])
-AC_REQUIRE([AC_C_INLINE])
-AC_CHECK_SIZEOF(char, 1)
-
-AC_CHECK_SIZEOF(int, 4)
-AC_CHECK_SIZEOF(long, 4)
-AC_CHECK_SIZEOF(long long, 8)
-AC_TYPE_SIZE_T
-AC_HEADER_TIME
-AC_TYPE_UID_T
-
-
-])
diff --git a/ext/xmlrpc/libxmlrpc/base64.c b/ext/xmlrpc/libxmlrpc/base64.c
deleted file mode 100644
index 6ae8b73c08..0000000000
--- a/ext/xmlrpc/libxmlrpc/base64.c
+++ /dev/null
@@ -1,192 +0,0 @@
-static const char rcsid[] = "#(@) $Id$";
-
-/*
-
- Encode or decode file as MIME base64 (RFC 1341)
-
- by John Walker
- http://www.fourmilab.ch/
-
- This program is in the public domain.
-
-*/
-#include <stdio.h>
-
-/* ENCODE -- Encode binary file into base64. */
-#include <stdlib.h>
-#include <ctype.h>
-
-#include "base64.h"
-
-static unsigned char dtable[512];
-
-void buffer_new(struct buffer_st *b)
-{
- b->length = 512;
- b->data = malloc(sizeof(char)*(b->length));
- b->data[0] = 0;
- b->ptr = b->data;
- b->offset = 0;
-}
-
-void buffer_add(struct buffer_st *b, char c)
-{
- *(b->ptr++) = c;
- b->offset++;
- if (b->offset == b->length) {
- b->length += 512;
- b->data = realloc(b->data, b->length);
- b->ptr = b->data + b->offset;
- }
-}
-
-void buffer_delete(struct buffer_st *b)
-{
- free(b->data);
- b->length = 0;
- b->offset = 0;
- b->ptr = NULL;
- b->data = NULL;
-}
-
-void base64_encode(struct buffer_st *b, const char *source, int length)
-{
- int i, hiteof = 0;
- int offset = 0;
- int olen;
-
- olen = 0;
-
- buffer_new(b);
-
- /* Fill dtable with character encodings. */
-
- for (i = 0; i < 26; i++) {
- dtable[i] = 'A' + i;
- dtable[26 + i] = 'a' + i;
- }
- for (i = 0; i < 10; i++) {
- dtable[52 + i] = '0' + i;
- }
- dtable[62] = '+';
- dtable[63] = '/';
-
- while (!hiteof) {
- unsigned char igroup[3], ogroup[4];
- int c, n;
-
- igroup[0] = igroup[1] = igroup[2] = 0;
- for (n = 0; n < 3; n++) {
- c = *(source++);
- offset++;
- if (offset > length) {
- hiteof = 1;
- break;
- }
- igroup[n] = (unsigned char) c;
- }
- if (n > 0) {
- ogroup[0] = dtable[igroup[0] >> 2];
- ogroup[1] = dtable[((igroup[0] & 3) << 4) | (igroup[1] >> 4)];
- ogroup[2] = dtable[((igroup[1] & 0xF) << 2) | (igroup[2] >> 6)];
- ogroup[3] = dtable[igroup[2] & 0x3F];
-
- /* Replace characters in output stream with "=" pad
- characters if fewer than three characters were
- read from the end of the input stream. */
-
- if (n < 3) {
- ogroup[3] = '=';
- if (n < 2) {
- ogroup[2] = '=';
- }
- }
- for (i = 0; i < 4; i++) {
- buffer_add(b, ogroup[i]);
- if (!(b->offset % 72)) {
- // buffer_add(b, '\r');
- buffer_add(b, '\n');
- }
- }
- }
- }
- // buffer_add(b, '\r');
- buffer_add(b, '\n');
-}
-
-void base64_decode(struct buffer_st *bfr, const char *source, int length)
-{
- int i;
- int offset = 0;
- int endoffile;
- int count;
-
- buffer_new(bfr);
-
- for (i = 0; i < 255; i++) {
- dtable[i] = 0x80;
- }
- for (i = 'A'; i <= 'Z'; i++) {
- dtable[i] = 0 + (i - 'A');
- }
- for (i = 'a'; i <= 'z'; i++) {
- dtable[i] = 26 + (i - 'a');
- }
- for (i = '0'; i <= '9'; i++) {
- dtable[i] = 52 + (i - '0');
- }
- dtable['+'] = 62;
- dtable['/'] = 63;
- dtable['='] = 0;
-
- endoffile = 0;
-
- /*CONSTANTCONDITION*/
- while (1) {
- unsigned char a[4], b[4], o[3];
-
- for (i = 0; i < 4; i++) {
- int c;
- while (1) {
- c = *(source++);
- offset++;
- if (offset > length) endoffile = 1;
- if (isspace(c) || c == '\n' || c == '\r') continue;
- break;
- }
-
- if (endoffile) {
- /*
- if (i > 0) {
- fprintf(stderr, "Input file incomplete.\n");
- exit(1);
- }
- */
- return;
- }
-
- if (dtable[c] & 0x80) {
- /*
- fprintf(stderr, "Offset %i length %i\n", offset, length);
- fprintf(stderr, "character '%c:%x:%c' in input file.\n", c, c, dtable[c]);
- exit(1);
- */
- i--;
- continue;
- }
- a[i] = (unsigned char) c;
- b[i] = (unsigned char) dtable[c];
- }
- o[0] = (b[0] << 2) | (b[1] >> 4);
- o[1] = (b[1] << 4) | (b[2] >> 2);
- o[2] = (b[2] << 6) | b[3];
- i = a[2] == '=' ? 1 : (a[3] == '=' ? 2 : 3);
- count = 0;
- while (count < i) {
- buffer_add(bfr, o[count++]);
- }
- if (i < 3) {
- return;
- }
- }
-}
diff --git a/ext/xmlrpc/libxmlrpc/base64.h b/ext/xmlrpc/libxmlrpc/base64.h
deleted file mode 100644
index 4cf156ad1e..0000000000
--- a/ext/xmlrpc/libxmlrpc/base64.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-
- Encode or decode file as MIME base64 (RFC 1341)
-
- by John Walker
- http://www.fourmilab.ch/
-
- This program is in the public domain.
-
-*/
-
-
-struct buffer_st {
- char *data;
- int length;
- char *ptr;
- int offset;
-};
-
-void buffer_new(struct buffer_st *b);
-void buffer_add(struct buffer_st *b, char c);
-void buffer_delete(struct buffer_st *b);
-
-void base64_encode(struct buffer_st *b, const char *source, int length);
-void base64_decode(struct buffer_st *b, const char *source, int length);
-
-/*
-#define DEBUG_MALLOC
- */
-
-#ifdef DEBUG_MALLOC
-void *_malloc_real(size_t s, char *file, int line);
-void _free_real(void *p, char *file, int line);
-
-#define malloc(s) _malloc_real(s,__FILE__,__LINE__)
-#define free(p) _free_real(p, __FILE__,__LINE__)
-#endif
-
diff --git a/ext/xmlrpc/libxmlrpc/encodings.c b/ext/xmlrpc/libxmlrpc/encodings.c
deleted file mode 100644
index 8f7d33ea43..0000000000
--- a/ext/xmlrpc/libxmlrpc/encodings.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifndef PHP_WIN32
-#include <php_config.h>
-#else
-#include <config.w32.h>
-#include <stdlib.h>
-#endif
-
-static const char rcsid[] = "#(@) $Id$";
-
-#include <errno.h>
-
-#ifdef HAVE_GICONV_H
-#include <giconv.h>
-#else
-#include <iconv.h>
-#endif
-
-#include "encodings.h"
-
-static char* convert(const char* src, int src_len, int *new_len, const char* from_enc, const char* to_enc) {
- char* outbuf = 0;
-
- if(src && src_len && from_enc && to_enc) {
- int outlenleft = src_len;
- int outlen = src_len;
- int inlenleft = src_len;
- iconv_t ic = iconv_open(to_enc, from_enc);
- char* src_ptr = (char*)src;
- char* out_ptr = 0;
-
- if(ic != (iconv_t)-1) {
- size_t st;
- outbuf = (char*)malloc(outlen + 1);
-
- if(outbuf) {
- out_ptr = (char*)outbuf;
- while(inlenleft) {
- st = iconv(ic, &src_ptr, &inlenleft, &out_ptr, &outlenleft);
- if(st == -1) {
- if(errno == E2BIG) {
- int diff = out_ptr - outbuf;
- outlen += inlenleft;
- outlenleft += inlenleft;
- outbuf = (char*)realloc(outbuf, outlen + 1);
- if(!outbuf) {
- break;
- }
- out_ptr = outbuf + diff;
- }
- else {
- free(outbuf);
- outbuf = 0;
- break;
- }
- }
- }
- }
- iconv_close(ic);
- }
- outlen -= outlenleft;
-
- if(new_len) {
- *new_len = outbuf ? outlen : 0;
- }
- if(outbuf) {
- outbuf[outlen] = 0;
- }
- }
- return outbuf;
-}
-
-/* returns a new string that must be freed */
-char* utf8_encode(const char *s, int len, int *newlen, const char* encoding)
-{
- return convert(s, len, newlen, encoding, "UTF-8");
-}
-
-/* returns a new string, possibly decoded */
-char* utf8_decode(const char *s, int len, int *newlen, const char* encoding)
-{
- return convert(s, len, newlen, "UTF-8", encoding);
-}
-
diff --git a/ext/xmlrpc/libxmlrpc/encodings.h b/ext/xmlrpc/libxmlrpc/encodings.h
deleted file mode 100644
index 486360b1be..0000000000
--- a/ext/xmlrpc/libxmlrpc/encodings.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-#ifndef __ENCODINGS__H
-#define __ENCODINGS__H
-
-/* these defines are for legacy purposes. */
-#define encoding_utf_8 "UTF-8"
-typedef const char* ENCODING_ID;
-#define utf8_get_encoding_id_string(desired_enc) ((const char*)desired_enc)
-#define utf8_get_encoding_id_from_string(id_string) ((ENCODING_ID)id_string)
-
-char* utf8_encode(const char *s, int len, int *newlen, ENCODING_ID encoding);
-char* utf8_decode(const char *s, int len, int *newlen, ENCODING_ID encoding);
-
-#endif /* __ENCODINGS__H */
diff --git a/ext/xmlrpc/libxmlrpc/queue.c b/ext/xmlrpc/libxmlrpc/queue.c
deleted file mode 100644
index 24187383fd..0000000000
--- a/ext/xmlrpc/libxmlrpc/queue.c
+++ /dev/null
@@ -1,982 +0,0 @@
-static const char rcsid[] = "#(@) $Id$";
-
-/*
- * Date last modified: Jan 2001
- * Modifications by Dan Libby (dan@libby.com), including:
- * - various fixes, null checks, etc
- * - addition of Q_Iter funcs, macros
- */
-
-
-/*-**************************************************************
- *
- * File : q.c
- *
- * Author: Peter Yard [1993.01.02] -- 02 Jan 1993
- *
- * Disclaimer: This code is released to the public domain.
- *
- * Description:
- * Generic double ended queue (Deque pronounced DEK) for handling
- * any data types, with sorting.
- *
- * By use of various functions in this module the caller
- * can create stacks, queues, lists, doubly linked lists,
- * sorted lists, indexed lists. All lists are dynamic.
- *
- * It is the responsibility of the caller to malloc and free
- * memory for insertion into the queue. A pointer to the object
- * is used so that not only can any data be used but various kinds
- * of data can be pushed on the same queue if one so wished e.g.
- * various length string literals mixed with pointers to structures
- * or integers etc.
- *
- * Enhancements:
- * A future improvement would be the option of multiple "cursors"
- * so that multiple locations could occur in the one queue to allow
- * placemarkers and additional flexibility. Perhaps even use queue
- * itself to have a list of cursors.
- *
- * Usage:
- *
- * /x init queue x/
- * queue q;
- * Q_Init(&q);
- *
- * To create a stack :
- *
- * Q_PushHead(&q, &mydata1); /x push x/
- * Q_PushHead(&q, &mydata2);
- * .....
- * data_ptr = Q_PopHead(&q); /x pop x/
- * .....
- * data_ptr = Q_Head(&q); /x top of stack x/
- *
- * To create a FIFO:
- *
- * Q_PushHead(&q, &mydata1);
- * .....
- * data_ptr = Q_PopTail(&q);
- *
- * To create a double list:
- *
- * data_ptr = Q_Head(&q);
- * ....
- * data_ptr = Q_Next(&q);
- * data_ptr = Q_Tail(&q);
- * if (Q_IsEmpty(&q)) ....
- * .....
- * data_ptr = Q_Previous(&q);
- *
- * To create a sorted list:
- *
- * Q_PushHead(&q, &mydata1); /x push x/
- * Q_PushHead(&q, &mydata2);
- * .....
- * if (!Q_Sort(&q, MyFunction))
- * .. error ..
- *
- * /x fill in key field of mydata1.
- * * NB: Q_Find does linear search
- * x/
- *
- * if (Q_Find(&q, &mydata1, MyFunction))
- * {
- * /x found it, queue cursor now at correct record x/
- * /x can retrieve with x/
- * data_ptr = Q_Get(&q);
- *
- * /x alter data , write back with x/
- * Q_Put(&q, data_ptr);
- * }
- *
- * /x Search with binary search x/
- * if (Q_Seek(&q, &mydata, MyFunction))
- * /x etc x/
- *
- *
- ****************************************************************/
-
-#ifdef _WIN32
-#include "xmlrpc_win32.h"
-#endif
-#include <stdlib.h>
-#include "queue.h"
-
-
-static void QuickSort(void *list[], int low, int high,
- int (*Comp)(const void *, const void *));
-static int Q_BSearch(queue *q, void *key,
- int (*Comp)(const void *, const void *));
-
-/* The index: a pointer to pointers */
-
-static void **index;
-static datanode **posn_index;
-
-
-/***
- *
- ** function : Q_Init
- *
- ** purpose : Initialise queue object and pointers.
- *
- ** parameters : 'queue' pointer.
- *
- ** returns : True_ if init successful else False_
- *
- ** comments :
- ***/
-
-int Q_Init(queue *q)
-{
- if(q) {
- q->head = q->tail = NULL;
- q->cursor = q->head;
- q->size = 0;
- q->sorted = False_;
- }
-
- return True_;
-}
-
-/***
- *
- ** function : Q_AtHead
- *
- ** purpose : tests if cursor is at head of queue
- *
- ** parameters : 'queue' pointer.
- *
- ** returns : boolean - True_ is at head else False_
- *
- ** comments :
- *
- ***/
-
-int Q_AtHead(queue *q)
-{
- return(q && q->cursor == q->head);
-}
-
-
-/***
- *
- ** function : Q_AtTail
- *
- ** purpose : boolean test if cursor at tail of queue
- *
- ** parameters : 'queue' pointer to test.
- *
- ** returns : True_ or False_
- *
- ** comments :
- *
- ***/
-
-int Q_AtTail(queue *q)
-{
- return(q && q->cursor == q->tail);
-}
-
-
-/***
- *
- ** function : Q_IsEmpty
- *
- ** purpose : test if queue has nothing in it.
- *
- ** parameters : 'queue' pointer
- *
- ** returns : True_ if IsEmpty queue, else False_
- *
- ** comments :
- *
- ***/
-
-inline int Q_IsEmpty(queue *q)
-{
- return(!q || q->size == 0);
-}
-
-/***
- *
- ** function : Q_Size
- *
- ** purpose : return the number of elements in the queue
- *
- ** parameters : queue pointer
- *
- ** returns : number of elements
- *
- ** comments :
- *
- ***/
-
-int Q_Size(queue *q)
-{
- return q ? q->size : 0;
-}
-
-
-/***
- *
- ** function : Q_Head
- *
- ** purpose : position queue cursor to first element (head) of queue.
- *
- ** parameters : 'queue' pointer
- *
- ** returns : pointer to data at head. If queue is IsEmpty returns NULL
- *
- ** comments :
- *
- ***/
-
-void *Q_Head(queue *q)
-{
- if(Q_IsEmpty(q))
- return NULL;
-
- q->cursor = q->head;
-
- return q->cursor->data;
-}
-
-
-/***
- *
- ** function : Q_Tail
- *
- ** purpose : locate cursor at tail of queue.
- *
- ** parameters : 'queue' pointer
- *
- ** returns : pointer to data at tail , if queue IsEmpty returns NULL
- *
- ** comments :
- *
- ***/
-
-void *Q_Tail(queue *q)
-{
- if(Q_IsEmpty(q))
- return NULL;
-
- q->cursor = q->tail;
-
- return q->cursor->data;
-}
-
-
-/***
- *
- ** function : Q_PushHead
- *
- ** purpose : put a data pointer at the head of the queue
- *
- ** parameters : 'queue' pointer, void pointer to the data.
- *
- ** returns : True_ if success else False_ if unable to push data.
- *
- ** comments :
- *
- ***/
-
-int Q_PushHead(queue *q, void *d)
-{
- if(q && d) {
- node *n;
- datanode *p;
-
- p = malloc(sizeof(datanode));
- if(p == NULL)
- return False_;
-
- n = q->head;
-
- q->head = (node*)p;
- q->head->prev = NULL;
-
- if(q->size == 0) {
- q->head->next = NULL;
- q->tail = q->head;
- }
- else {
- q->head->next = (datanode*)n;
- n->prev = q->head;
- }
-
- q->head->data = d;
- q->size++;
-
- q->cursor = q->head;
-
- q->sorted = False_;
-
- return True_;
- }
- return False_;
-}
-
-
-
-/***
- *
- ** function : Q_PushTail
- *
- ** purpose : put a data element pointer at the tail of the queue
- *
- ** parameters : queue pointer, pointer to the data
- *
- ** returns : True_ if data pushed, False_ if data not inserted.
- *
- ** comments :
- *
- ***/
-
-int Q_PushTail(queue *q, void *d)
-{
- if(q && d) {
- node *p;
- datanode *n;
-
- n = malloc(sizeof(datanode));
- if(n == NULL)
- return False_;
-
- p = q->tail;
- q->tail = (node *)n;
-
- if(q->size == 0) {
- q->tail->prev = NULL;
- q->head = q->tail;
- }
- else {
- q->tail->prev = (datanode *)p;
- p->next = q->tail;
- }
-
- q->tail->next = NULL;
-
- q->tail->data = d;
- q->cursor = q->tail;
- q->size++;
-
- q->sorted = False_;
-
- return True_;
- }
- return False_;
-}
-
-
-
-/***
- *
- ** function : Q_PopHead
- *
- ** purpose : remove and return the top element at the head of the
- * queue.
- *
- ** parameters : queue pointer
- *
- ** returns : pointer to data element or NULL if queue is IsEmpty.
- *
- ** comments :
- *
- ***/
-
-void *Q_PopHead(queue *q)
-{
- datanode *n;
- void *d;
-
- if(Q_IsEmpty(q))
- return NULL;
-
- d = q->head->data;
- n = q->head->next;
- free(q->head);
-
- q->size--;
-
- if(q->size == 0)
- q->head = q->tail = q->cursor = NULL;
- else {
- q->head = (node *)n;
- q->head->prev = NULL;
- q->cursor = q->head;
- }
-
- q->sorted = False_;
-
- return d;
-}
-
-
-/***
- *
- ** function : Q_PopTail
- *
- ** purpose : remove element from tail of queue and return data.
- *
- ** parameters : queue pointer
- *
- ** returns : pointer to data element that was at tail. NULL if queue
- * IsEmpty.
- *
- ** comments :
- *
- ***/
-
-void *Q_PopTail(queue *q)
-{
- datanode *p;
- void *d;
-
- if(Q_IsEmpty(q))
- return NULL;
-
- d = q->tail->data;
- p = q->tail->prev;
- free(q->tail);
- q->size--;
-
- if(q->size == 0)
- q->head = q->tail = q->cursor = NULL;
- else {
- q->tail = (node *)p;
- q->tail->next = NULL;
- q->cursor = q->tail;
- }
-
- q->sorted = False_;
-
- return d;
-}
-
-
-
-/***
- *
- ** function : Q_Next
- *
- ** purpose : Move to the next element in the queue without popping
- *
- ** parameters : queue pointer.
- *
- ** returns : pointer to data element of new element or NULL if end
- * of the queue.
- *
- ** comments : This uses the cursor for the current position. Q_Next
- * only moves in the direction from the head of the queue
- * to the tail.
- ***/
-
-void *Q_Next(queue *q)
-{
- if(!q)
- return NULL;
-
- if(!q->cursor || q->cursor->next == NULL)
- return NULL;
-
- q->cursor = (node *)q->cursor->next;
-
- return q->cursor->data ;
-}
-
-
-
-/***
- *
- ** function : Q_Previous
- *
- ** purpose : Opposite of Q_Next. Move to next element closer to the
- * head of the queue.
- *
- ** parameters : pointer to queue
- *
- ** returns : pointer to data of new element else NULL if queue IsEmpty
- *
- ** comments : Makes cursor move towards the head of the queue.
- *
- ***/
-
-void *Q_Previous(queue *q)
-{
- if(!q)
- return NULL;
-
- if(q->cursor->prev == NULL)
- return NULL;
-
- q->cursor = (node *)q->cursor->prev;
-
- return q->cursor->data;
-}
-
-
-void *Q_Iter_Del(queue *q, q_iter iter)
-{
- void *d;
- datanode *n, *p;
-
- if(!q)
- return NULL;
-
- if(iter == NULL)
- return NULL;
-
- if(iter == (q_iter)q->head)
- return Q_PopHead(q);
-
- if(iter == (q_iter)q->tail)
- return Q_PopTail(q);
-
- n = ((node*)iter)->next;
- p = ((node*)iter)->prev;
- d = ((node*)iter)->data;
-
- free(iter);
-
- if(p) {
- p->next = n;
- }
- if (q->cursor == (node*)iter) {
- if (p) {
- q->cursor = p;
- } else {
- q->cursor = n;
- }
- }
-
-
- if (n != NULL) {
- n->prev = p;
- }
-
- q->size--;
-
- q->sorted = False_;
-
- return d;
-}
-
-
-
-/***
- *
- ** function : Q_DelCur
- *
- ** purpose : Delete the current queue element as pointed to by
- * the cursor.
- *
- ** parameters : queue pointer
- *
- ** returns : pointer to data element.
- *
- ** comments : WARNING! It is the responsibility of the caller to
- * free any memory. Queue cannot distinguish between
- * pointers to literals and malloced memory.
- *
- ***/
-
-void *Q_DelCur(queue* q) {
- if(q) {
- return Q_Iter_Del(q, (q_iter)q->cursor);
- }
- return 0;
-}
-
-
-/***
- *
- ** function : Q_Destroy
- *
- ** purpose : Free all queue resources
- *
- ** parameters : queue pointer
- *
- ** returns : null.
- *
- ** comments : WARNING! It is the responsibility of the caller to
- * free any memory. Queue cannot distinguish between
- * pointers to literals and malloced memory.
- *
- ***/
-
-void Q_Destroy(queue *q)
-{
- while(!Q_IsEmpty(q)) {
- Q_PopHead(q);
- }
-}
-
-
-/***
- *
- ** function : Q_Get
- *
- ** purpose : get the pointer to the data at the cursor location
- *
- ** parameters : queue pointer
- *
- ** returns : data element pointer
- *
- ** comments :
- *
- ***/
-
-void *Q_Get(queue *q)
-{
- if(!q)
- return NULL;
-
- if(q->cursor == NULL)
- return NULL;
- return q->cursor->data;
-}
-
-
-
-/***
- *
- ** function : Q_Put
- *
- ** purpose : replace pointer to data with new pointer to data.
- *
- ** parameters : queue pointer, data pointer
- *
- ** returns : boolean- True_ if successful, False_ if cursor at NULL
- *
- ** comments :
- *
- ***/
-
-int Q_Put(queue *q, void *data)
-{
- if(q && data) {
- if(q->cursor == NULL)
- return False_;
-
- q->cursor->data = data;
- return True_;
- }
- return False_;
-}
-
-
-/***
- *
- ** function : Q_Find
- *
- ** purpose : Linear search of queue for match with key in *data
- *
- ** parameters : queue pointer q, data pointer with data containing key
- * comparison function here called Comp.
- *
- ** returns : True_ if found , False_ if not in queue.
- *
- ** comments : Useful for small queues that are constantly changing
- * and would otherwise need constant sorting with the
- * Q_Seek function.
- * For description of Comp see Q_Sort.
- * Queue cursor left on position found item else at end.
- *
- ***/
-
-int Q_Find(queue *q, void *data,
- int (*Comp)(const void *, const void *))
-{
- void *d;
-
- if (q == NULL) {
- return False_;
- }
-
- d = Q_Head(q);
- do {
- if(Comp(d, data) == 0)
- return True_;
- d = Q_Next(q);
- } while(!Q_AtTail(q));
-
- if(Comp(d, data) == 0)
- return True_;
-
- return False_;
-}
-
-/*======== Sorted Queue and Index functions ========= */
-
-
-static void QuickSort(void *list[], int low, int high,
- int (*Comp)(const void *, const void *))
-{
- int flag = 1, i, j;
- void *key, *temp;
-
- if(low < high) {
- i = low;
- j = high + 1;
-
- key = list[ low ];
-
- while(flag) {
- i++;
- while(Comp(list[i], key) < 0)
- i++;
-
- j--;
- while(Comp(list[j], key) > 0)
- j--;
-
- if(i < j) {
- temp = list[i];
- list[i] = list[j];
- list[j] = temp;
- }
- else flag = 0;
- }
-
- temp = list[low];
- list[low] = list[j];
- list[j] = temp;
-
- QuickSort(list, low, j-1, Comp);
- QuickSort(list, j+1, high, Comp);
- }
-}
-
-
-/***
- *
- ** function : Q_Sort
- *
- ** purpose : sort the queue and allow index style access.
- *
- ** parameters : queue pointer, comparison function compatible with
- * with 'qsort'.
- *
- ** returns : True_ if sort succeeded. False_ if error occurred.
- *
- ** comments : Comp function supplied by caller must return
- * -1 if data1 < data2
- * 0 if data1 == data2
- * +1 if data1 > data2
- *
- * for Comp(data1, data2)
- *
- * If queue is already sorted it frees the memory of the
- * old index and starts again.
- *
- ***/
-
-int Q_Sort(queue *q, int (*Comp)(const void *, const void *))
-{
- int i;
- void *d;
- datanode *dn;
-
- /* if already sorted free memory for tag array */
-
- if(q->sorted) {
- free(index);
- free(posn_index);
- q->sorted = False_;
- }
-
- /* Now allocate memory of array, array of pointers */
-
- index = malloc(q->size * sizeof(q->cursor->data));
- if(index == NULL)
- return False_;
-
- posn_index = malloc(q->size * sizeof(q->cursor));
- if(posn_index == NULL) {
- free(index);
- return False_;
- }
-
- /* Walk queue putting pointers into array */
-
- d = Q_Head(q);
- for(i=0; i < q->size; i++) {
- index[i] = d;
- posn_index[i] = q->cursor;
- d = Q_Next(q);
- }
-
- /* Now sort the index */
-
- QuickSort(index, 0, q->size - 1, Comp);
-
- /* Rearrange the actual queue into correct order */
-
- dn = q->head;
- i = 0;
- while(dn != NULL) {
- dn->data = index[i++];
- dn = dn->next;
- }
-
- /* Re-position to original element */
-
- if(d != NULL)
- Q_Find(q, d, Comp);
- else Q_Head(q);
-
- q->sorted = True_;
-
- return True_;
-}
-
-
-/***
- *
- ** function : Q_BSearch
- *
- ** purpose : binary search of queue index for node containing key
- *
- ** parameters : queue pointer 'q', data pointer of key 'key',
- * Comp comparison function.
- *
- ** returns : integer index into array of node pointers,
- * or -1 if not found.
- *
- ** comments : see Q_Sort for description of 'Comp' function.
- *
- ***/
-
-static int Q_BSearch( queue *q, void *key,
- int (*Comp)(const void *, const void*))
-{
- int low, mid, hi, val;
-
- low = 0;
- hi = q->size - 1;
-
- while(low <= hi) {
- mid = (low + hi) / 2;
- val = Comp(key, index[ mid ]);
-
- if(val < 0)
- hi = mid - 1;
-
- else if(val > 0)
- low = mid + 1;
-
- else /* Success */
- return mid;
- }
-
- /* Not Found */
-
- return -1;
-}
-
-
-/***
- *
- ** function : Q_Seek
- *
- ** purpose : use index to locate data according to key in 'data'
- *
- ** parameters : queue pointer 'q', data pointer 'data', Comp comparison
- * function.
- *
- ** returns : pointer to data or NULL if could not find it or could
- * not sort queue.
- *
- ** comments : see Q_Sort for description of 'Comp' function.
- *
- ***/
-
-void *Q_Seek(queue *q, void *data, int (*Comp)(const void *, const void *))
-{
- int idx;
-
- if (q == NULL) {
- return NULL;
- }
-
- if(!q->sorted) {
- if(!Q_Sort(q, Comp))
- return NULL;
- }
-
- idx = Q_BSearch(q, data, Comp);
-
- if(idx < 0)
- return NULL;
-
- q->cursor = posn_index[idx];
-
- return index[idx];
-}
-
-
-
-/***
- *
- ** function : Q_Insert
- *
- ** purpose : Insert an element into an indexed queue
- *
- ** parameters : queue pointer 'q', data pointer 'data', Comp comparison
- * function.
- *
- ** returns : pointer to data or NULL if could not find it or could
- * not sort queue.
- *
- ** comments : see Q_Sort for description of 'Comp' function.
- * WARNING! This code can be very slow since each new
- * element means a new Q_Sort. Should only be used for
- * the insertion of the odd element ,not the piecemeal
- * building of an entire queue.
- ***/
-
-int Q_Insert(queue *q, void *data, int (*Comp)(const void *, const void *))
-{
- if (q == NULL) {
- return False_;
- }
-
- Q_PushHead(q, data);
-
- if(!Q_Sort(q, Comp))
- return False_;
-
- return True_;
-}
-
-/* read only funcs for iterating through queue. above funcs modify queue */
-q_iter Q_Iter_Head(queue *q) {
- return q ? (q_iter)q->head : NULL;
-}
-
-q_iter Q_Iter_Tail(queue *q) {
- return q ? (q_iter)q->tail : NULL;
-}
-
-q_iter Q_Iter_Next(q_iter qi) {
- return qi ? (q_iter)((node*)qi)->next : NULL;
-}
-
-q_iter Q_Iter_Prev(q_iter qi) {
- return qi ? (q_iter)((node*)qi)->prev : NULL;
-}
-
-void * Q_Iter_Get(q_iter qi) {
- return qi ? ((node*)qi)->data : NULL;
-}
-
-int Q_Iter_Put(q_iter qi, void* data) {
- if(qi) {
- ((node*)qi)->data = data;
- return True_;
- }
- return False_;
-}
diff --git a/ext/xmlrpc/libxmlrpc/queue.h b/ext/xmlrpc/libxmlrpc/queue.h
deleted file mode 100644
index e850b57e6c..0000000000
--- a/ext/xmlrpc/libxmlrpc/queue.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Date last modified: Jan 2001
- * Modifications by Dan Libby (dan@libby.com), including:
- * - various fixes, null checks, etc
- * - addition of Q_Iter funcs, macros
- */
-
-/*
- * File : q.h
- *
- * Peter Yard 02 Jan 1993.
- *
- * Disclaimer: This code is released to the public domain.
- */
-
-#ifndef Q__H
-#define Q__H
-
-#ifndef False_
- #define False_ 0
-#endif
-
-#ifndef True_
- #define True_ 1
-#endif
-
-typedef struct nodeptr datanode;
-
-typedef struct nodeptr {
- void *data ;
- datanode *prev, *next ;
-} node ;
-
-/* For external use with Q_Iter* funcs */
-typedef struct nodeptr* q_iter;
-
-typedef struct {
- node *head, *tail, *cursor;
- int size, sorted, item_deleted;
-} queue;
-
-typedef struct {
- void *dataptr;
- node *loc ;
-} index_elt ;
-
-
-int Q_Init(queue *q);
-void Q_Destroy(queue *q);
-int Q_IsEmpty(queue *q);
-int Q_Size(queue *q);
-int Q_AtHead(queue *q);
-int Q_AtTail(queue *q);
-int Q_PushHead(queue *q, void *d);
-int Q_PushTail(queue *q, void *d);
-void *Q_Head(queue *q);
-void *Q_Tail(queue *q);
-void *Q_PopHead(queue *q);
-void *Q_PopTail(queue *q);
-void *Q_Next(queue *q);
-void *Q_Previous(queue *q);
-void *Q_DelCur(queue *q);
-void *Q_Get(queue *q);
-int Q_Put(queue *q, void *data);
-int Q_Sort(queue *q, int (*Comp)(const void *, const void *));
-int Q_Find(queue *q, void *data,
- int (*Comp)(const void *, const void *));
-void *Q_Seek(queue *q, void *data,
- int (*Comp)(const void *, const void *));
-int Q_Insert(queue *q, void *data,
- int (*Comp)(const void *, const void *));
-
-/* read only funcs for iterating through queue. above funcs modify queue */
-q_iter Q_Iter_Head(queue *q);
-q_iter Q_Iter_Tail(queue *q);
-q_iter Q_Iter_Next(q_iter qi);
-q_iter Q_Iter_Prev(q_iter qi);
-void* Q_Iter_Get(q_iter qi);
-int Q_Iter_Put(q_iter qi, void* data); // not read only! here for completeness.
-void* Q_Iter_Del(queue *q, q_iter iter); // not read only! here for completeness.
-
-/* Fast (macro'd) versions of above */
-#define Q_Iter_Head_F(q) (q ? (q_iter)((queue*)q)->head : NULL)
-#define Q_Iter_Tail_F(q) (q ? (q_iter)((queue*)q)->tail : NULL)
-#define Q_Iter_Next_F(qi) (qi ? (q_iter)((node*)qi)->next : NULL)
-#define Q_Iter_Prev_F(qi) (qi ? (q_iter)((node*)qi)->prev : NULL)
-#define Q_Iter_Get_F(qi) (qi ? ((node*)qi)->data : NULL)
-
-#endif /* Q__H */
diff --git a/ext/xmlrpc/libxmlrpc/simplestring.c b/ext/xmlrpc/libxmlrpc/simplestring.c
deleted file mode 100644
index 011c253225..0000000000
--- a/ext/xmlrpc/libxmlrpc/simplestring.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-static const char rcsid[] = "#(@) $Id$";
-
-
-#define SIMPLESTRING_INCR 32
-
-/****h* ABOUT/simplestring
- * NAME
- * simplestring
- * AUTHOR
- * Dan Libby, aka danda (dan@libby.com)
- * CREATION DATE
- * 06/2000
- * HISTORY
- * $Log$
- * Revision 1.2 2002/07/05 04:43:53 danda
- * merged in updates from SF project. bring php repository up to date with xmlrpc-epi version 0.51
- *
- * Revision 1.4 2002/02/13 20:58:50 danda
- * patch to make source more windows friendly, contributed by Jeff Lawson
- *
- * Revision 1.3 2001/09/29 21:58:05 danda
- * adding cvs log to history section
- *
- * 10/15/2000 -- danda -- adding robodoc documentation
- * PORTABILITY
- * Coded on RedHat Linux 6.2. Builds on Solaris x86. Should build on just
- * about anything with minor mods.
- * NOTES
- * This code was written primarily for xmlrpc, but has found some other uses.
- *
- * simplestring is, as the name implies, a simple API for dealing with C strings.
- * Why would I write yet another string API? Because I couldn't find any that were
- * a) free / GPL, b) simple/lightweight, c) fast, not doing unneccesary strlens all
- * over the place. So. It is simple, and it seems to work, and it is pretty fast.
- *
- * Oh, and it is also binary safe, ie it can handle strings with embedded NULLs,
- * so long as the real length is passed in.
- *
- * And the masses rejoiced.
- *
- * BUGS
- * there must be some.
- ******/
-
-#include <stdlib.h>
-#include "simplestring.h"
-
-#define my_free(thing) if(thing) {free(thing); thing = 0;}
-
-/*----------------------**
-* Begin String Functions *
-*-----------------------*/
-
-/****f* FUNC/simplestring_init
- * NAME
- * simplestring_init
- * SYNOPSIS
- * void simplestring_init(simplestring* string)
- * FUNCTION
- * initialize string
- * INPUTS
- * string - pointer to a simplestring struct that will be initialized
- * RESULT
- * void
- * NOTES
- * SEE ALSO
- * simplestring_free ()
- * simplestring_clear ()
- * SOURCE
- */
-void simplestring_init(simplestring* string) {
- memset(string, 0, sizeof(simplestring));
-}
-/******/
-
-static void simplestring_init_str(simplestring* string) {
- string->str = (char*)malloc(SIMPLESTRING_INCR);
- if(string->str) {
- string->str[0] = 0;
- string->len = 0;
- string->size = SIMPLESTRING_INCR;
- }
- else {
- string->size = 0;
- }
-}
-
-/****f* FUNC/simplestring_clear
- * NAME
- * simplestring_clear
- * SYNOPSIS
- * void simplestring_clear(simplestring* string)
- * FUNCTION
- * clears contents of a string
- * INPUTS
- * string - the string value to clear
- * RESULT
- * void
- * NOTES
- * This function is very fast as it does not de-allocate any memory.
- * SEE ALSO
- *
- * SOURCE
- */
-void simplestring_clear(simplestring* string) {
- if(string->str) {
- string->str[0] = 0;
- }
- string->len = 0;
-}
-/******/
-
-/****f* FUNC/simplestring_free
- * NAME
- * simplestring_free
- * SYNOPSIS
- * void simplestring_free(simplestring* string)
- * FUNCTION
- * frees contents of a string, if any. Does *not* free the simplestring struct itself.
- * INPUTS
- * string - value containing string to be free'd
- * RESULT
- * void
- * NOTES
- * caller is responsible for allocating and freeing simplestring* struct itself.
- * SEE ALSO
- * simplestring_init ()
- * SOURCE
- */
-void simplestring_free(simplestring* string) {
- if(string && string->str) {
- my_free(string->str);
- string->len = 0;
- }
-}
-/******/
-
-/****f* FUNC/simplestring_addn
- * NAME
- * simplestring_addn
- * SYNOPSIS
- * void simplestring_addn(simplestring* string, const char* add, int add_len)
- * FUNCTION
- * copies n characters from source to target string
- * INPUTS
- * target - target string
- * source - source string
- * add_len - number of characters to copy
- * RESULT
- * void
- * NOTES
- * SEE ALSO
- * simplestring_add ()
- * SOURCE
- */
-void simplestring_addn(simplestring* target, const char* source, int add_len) {
- if(target && source) {
- if(!target->str) {
- simplestring_init_str(target);
- }
- if(target->len + add_len + 1 > target->size) {
- /* newsize is current length + new length */
- int newsize = target->len + add_len + 1;
- int incr = target->size * 2;
-
- /* align to SIMPLESTRING_INCR increments */
- newsize = newsize - (newsize % incr) + incr;
- target->str = (char*)realloc(target->str, newsize);
-
- target->size = target->str ? newsize : 0;
- }
-
- if(target->str) {
- if(add_len) {
- memcpy(target->str + target->len, source, add_len);
- }
- target->len += add_len;
- target->str[target->len] = 0; /* null terminate */
- }
- }
-}
-/******/
-
-/****f* FUNC/simplestring_add
- * NAME
- * simplestring_add
- * SYNOPSIS
- * void simplestring_add(simplestring* string, const char* add)
- * FUNCTION
- * appends a string of unknown length from source to target
- * INPUTS
- * target - the target string to append to
- * source - the source string of unknown length
- * RESULT
- * void
- * NOTES
- * SEE ALSO
- * simplestring_addn ()
- * SOURCE
- */
-void simplestring_add(simplestring* target, const char* source) {
- if(target && source) {
- simplestring_addn(target, source, strlen(source));
- }
-}
-/******/
-
-
-/*----------------------
-* End String Functions *
-*--------------------**/
diff --git a/ext/xmlrpc/libxmlrpc/simplestring.h b/ext/xmlrpc/libxmlrpc/simplestring.h
deleted file mode 100644
index c5d98cf1d8..0000000000
--- a/ext/xmlrpc/libxmlrpc/simplestring.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-#ifndef __SIMPLESTRING_H__
- #define __SIMPLESTRING_H__
-
-/*-********************************
-* begin simplestring header stuff *
-**********************************/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /****s* struct/simplestring
- * NAME
- * simplestring
- * NOTES
- * represents a string efficiently for fast appending, etc.
- * SOURCE
- */
-typedef struct _simplestring {
- char* str; /* string buf */
- int len; /* length of string/buf */
- int size; /* size of allocated buffer */
-} simplestring;
-/******/
-
-#ifndef NULL
- #define NULL 0
-#endif
-
-void simplestring_init(simplestring* string);
-void simplestring_clear(simplestring* string);
-void simplestring_free(simplestring* string);
-void simplestring_add(simplestring* string, const char* add);
-void simplestring_addn(simplestring* string, const char* add, int add_len);
-
-#ifdef __cplusplus
-}
-#endif
-
-/*-******************************
-* end simplestring header stuff *
-********************************/
-
-#endif /* __SIMPLESTRING_H__ */
diff --git a/ext/xmlrpc/libxmlrpc/system_methods.c b/ext/xmlrpc/libxmlrpc/system_methods.c
deleted file mode 100644
index c47236df14..0000000000
--- a/ext/xmlrpc/libxmlrpc/system_methods.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2001 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-/****h* ABOUT/system_methods
- * AUTHOR
- * Dan Libby, aka danda (dan@libby.com)
- * HISTORY
- * $Log$
- * Revision 1.7 2001/09/29 21:58:05 danda
- * adding cvs log to history section
- *
- * 4/28/2001 -- danda -- adding system.multicall and separating out system methods.
- * TODO
- * NOTES
- *******/
-
-
-#include "queue.h"
-#include "xmlrpc.h"
-#include "xmlrpc_private.h"
-#include "xmlrpc_introspection_private.h"
-#include "system_methods_private.h"
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-
-static const char* xsm_introspection_xml =
-"<?xml version='1.0' ?>"
-
-"<introspection version='1.0'>"
- "<typeList>"
-
- "<typeDescription name='system.value' basetype='struct' desc='description of a value'>"
- "<value type='string' name='name' optional='yes'>value identifier</value>"
- "<value type='string' name='type'>value&apos;s xmlrpc or user-defined type</value>"
- "<value type='string' name='description'>value&apos;s textual description</value> "
- "<value type='boolean' name='optional'>true if value is optional, else it is required</value> "
- "<value type='any' name='member' optional='yes'>a child of this element. n/a for scalar types</value> "
- "</typeDescription>"
-
- "<typeDescription name='system.valueList' basetype='array' desc='list of value descriptions'>"
- "<value type='system.value'/>"
- "</typeDescription>"
-
- "<typeDescription name='system.stringList' basetype='array' desc='list of strings'>"
- "<value type='string'/>"
- "</typeDescription>"
-
-
- "</typeList>"
-
- "<methodList>"
-
- "<!-- system.describeMethods -->"
- "<methodDescription name='system.describeMethods'>"
- "<author>Dan Libby</author>"
- "<purpose>fully describes the methods and types implemented by this XML-RPC server.</purpose>"
- "<version>1.1</version>"
- "<signatures>"
- "<signature>"
- "<params>"
- "<value type='array' name='methodList' optional='yes' desc='a list of methods to be described. if omitted, all are described.'>"
- "<value type='string'>a valid method name</value>"
- "</value>"
- "</params>"
- "<returns>"
- "<value type='struct' desc='contains methods list and types list'>"
- "<value type='array' name='methodList' desc='a list of methods'>"
- "<value type='struct' desc='representation of a single method'>"
- "<value type='string' name='name'>method name</value>"
- "<value type='string' name='version' optional='yes'>method version</value>"
- "<value type='string' name='author' optional='yes'>method author</value>"
- "<value type='string' name='purpose' optional='yes'>method purpose</value>"
- "<value type='array' name='signatures' desc='list of method signatures'>"
- "<value type='struct' desc='representation of a single signature'>"
- "<value type='system.valueList' name='params' optional='yes'>parameter list</value>"
- "<value type='system.valueList' name='returns' optional='yes'>return value list</value>"
- "</value>"
- "</value>"
- "<value type='system.stringList' name='bugs' optional='yes'>list of known bugs</value>"
- "<value type='system.stringList' name='errors' optional='yes'>list of possible errors and error codes</value>"
- "<value type='system.stringList' name='examples' optional='yes'>list of examples</value>"
- "<value type='system.stringList' name='history' optional='yes'>list of modifications</value>"
- "<value type='system.stringList' name='notes' optional='yes'>list of notes</value>"
- "<value type='system.stringList' name='see' optional='yes'>see also. list of related methods</value>"
- "<value type='system.stringList' name='todo' optional='yes'>list of unimplemented features</value>"
- "</value>"
- "</value>"
- "<value type='array' name='typeList' desc='a list of type descriptions. Typically used for referencing complex types'>"
- "<value type='system.value'>a type description</value>"
- "</value>"
- "</value>"
- "</returns>"
- "</signature>"
- "</signatures>"
- "<see>"
- "<item name='system.listMethods' />"
- "<item name='system.methodSignature' />"
- "<item name='system.methodHelp' />"
- "</see>"
- "<example/>"
- "<error/>"
- "<note/>"
- "<bug/>"
- "<todo/>"
- "</methodDescription>"
-
- "<!-- system.listMethods -->"
- "<methodDescription name='system.listMethods'>"
- "<author>Dan Libby</author>"
- "<purpose>enumerates the methods implemented by this XML-RPC server.</purpose>"
- "<version>1.0</version>"
- "<signatures>"
- "<signature>"
- "<returns>"
- "<value type='array' desc='an array of strings'>"
- "<value type='string'>name of a method implemented by the server.</value>"
- "</value>"
- "</returns>"
- "</signature>"
- "</signatures>"
- "<see>"
- "<item name='system.describeMethods' />"
- "<item name='system.methodSignature' />"
- "<item name='system.methodHelp' />"
- "</see>"
- "<example/>"
- "<error/>"
- "<note/>"
- "<bug/>"
- "<todo/>"
- "</methodDescription>"
-
- "<!-- system.methodHelp -->"
- "<methodDescription name='system.methodHelp'>"
- "<author>Dan Libby</author>"
- "<purpose>provides documentation string for a single method</purpose>"
- "<version>1.0</version>"
- "<signatures>"
- "<signature>"
- "<params>"
- "<value type='string' name='methodName'>name of the method for which documentation is desired</value>"
- "</params>"
- "<returns>"
- "<value type='string'>help text if defined for the method passed, otherwise an empty string</value>"
- "</returns>"
- "</signature>"
- "</signatures>"
- "<see>"
- "<item name='system.listMethods' />"
- "<item name='system.methodSignature' />"
- "<item name='system.methodHelp' />"
- "</see>"
- "<example/>"
- "<error/>"
- "<note/>"
- "<bug/>"
- "<todo/>"
- "</methodDescription>"
-
- "<!-- system.methodSignature -->"
- "<methodDescription name='system.methodSignature'>"
- "<author>Dan Libby</author>"
- "<purpose>provides 1 or more signatures for a single method</purpose>"
- "<version>1.0</version>"
- "<signatures>"
- "<signature>"
- "<params>"
- "<value type='string' name='methodName'>name of the method for which documentation is desired</value>"
- "</params>"
- "<returns>"
- "<value type='array' desc='a list of arrays, each representing a signature'>"
- "<value type='array' desc='a list of strings. the first element represents the method return value. subsequent elements represent parameters.'>"
- "<value type='string'>a string indicating the xmlrpc type of a value. one of: string, int, double, base64, datetime, array, struct</value>"
- "</value>"
- "</value>"
- "</returns>"
- "</signature>"
- "</signatures>"
- "<see>"
- "<item name='system.listMethods' />"
- "<item name='system.methodHelp' />"
- "<item name='system.describeMethods' />"
- "</see>"
- "<example/>"
- "<error/>"
- "<note/>"
- "<bug/>"
- "<todo/>"
- "</methodDescription>"
-
- "<!-- system.multiCall -->"
- "<methodDescription name='system.multiCall'>"
- "<author>Dan Libby</author>"
- "<purpose>executes multiple methods in sequence and returns the results</purpose>"
- "<version>1.0</version>"
- "<signatures>"
- "<signature>"
- "<params>"
- "<value type='array' name='methodList' desc='an array of method call structs'>"
- "<value type='struct' desc='a struct representing a single method call'>"
- "<value type='string' name='methodName' desc='name of the method to be executed'/>"
- "<value type='array' name='params' desc='an array representing the params to a method. sub-elements should match method signature'/>"
- "</value>"
- "</value>"
- "</params>"
- "<returns>"
- "<value type='array' desc='an array of method responses'>"
- "<value type='array' desc='an array containing a single value, which is the method&apos;s response'/>"
- "</value>"
- "</returns>"
- "</signature>"
- "</signatures>"
- "<see>"
- "<item name='system.listMethods' />"
- "<item name='system.methodHelp' />"
- "<item name='system.describeMethods' />"
- "</see>"
- "<example/>"
- "<error/>"
- "<note/>"
- "<bug/>"
- "<todo/>"
- "</methodDescription>"
-
- "<!-- system.getCapabilities -->"
- "<methodDescription name='system.getCapabilities'>"
- "<author>Dan Libby</author>"
- "<purpose>returns a list of capabilities supported by this server</purpose>"
- "<version>1.0</version>"
- "<notes><item>spec url: http://groups.yahoo.com/group/xml-rpc/message/2897</item></notes>"
- "<signatures>"
- "<signature>"
- "<returns>"
- "<value type='struct' desc='list of capabilities, each with a unique key defined by the capability&apos;s spec'>"
- "<value type='struct' desc='definition of a single capability'>"
- "<value type='string' name='specURL'>www address of the specification defining this capability</value>"
- "<value type='int' name='specVersion'>version of the spec that this server's implementation conforms to</value>"
- "</value>"
- "</value>"
- "</returns>"
- "</signature>"
- "</signatures>"
- "<see>"
- "<item name='system.listMethods' />"
- "<item name='system.methodHelp' />"
- "<item name='system.describeMethods' />"
- "</see>"
- "<example/>"
- "<error/>"
- "<note/>"
- "<bug/>"
- "<todo/>"
- "</methodDescription>"
-
- "</methodList>"
-"</introspection>";
-
-
-/* forward declarations for static (non public, non api) funcs */
-static XMLRPC_VALUE xsm_system_multicall_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData);
-static XMLRPC_VALUE xsm_system_get_capabilities_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData);
-
-/*-*******************
-* System Methods API *
-*********************/
-
-static void xsm_lazy_doc_methods_cb(XMLRPC_SERVER server, void* userData) {
- XMLRPC_VALUE xDesc = XMLRPC_IntrospectionCreateDescription(xsm_introspection_xml, NULL);
- XMLRPC_ServerAddIntrospectionData(server, xDesc);
- XMLRPC_CleanupValue(xDesc);
-}
-
-void xsm_register(XMLRPC_SERVER server) {
- xi_register_system_methods(server);
-
- XMLRPC_ServerRegisterMethod(server, xsm_token_system_multicall, xsm_system_multicall_cb);
- XMLRPC_ServerRegisterMethod(server, xsm_token_system_get_capabilities, xsm_system_get_capabilities_cb);
-
- /* callback for documentation generation should it be requested */
- XMLRPC_ServerRegisterIntrospectionCallback(server, xsm_lazy_doc_methods_cb);
-}
-
-XMLRPC_VALUE xsm_system_multicall_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData) {
- XMLRPC_VALUE xArray = XMLRPC_VectorRewind(XMLRPC_RequestGetData(input));
- XMLRPC_VALUE xReturn = XMLRPC_CreateVector(0, xmlrpc_vector_array);
-
- if (xArray) {
- XMLRPC_VALUE xMethodIter = XMLRPC_VectorRewind(xArray);
-
- while (xMethodIter) {
- XMLRPC_REQUEST request = XMLRPC_RequestNew();
- if(request) {
- const char* methodName = XMLRPC_VectorGetStringWithID(xMethodIter, "methodName");
- XMLRPC_VALUE params = XMLRPC_VectorGetValueWithID(xMethodIter, "params");
-
- if(methodName && params) {
- XMLRPC_VALUE xRandomArray = XMLRPC_CreateVector(0, xmlrpc_vector_array);
- XMLRPC_RequestSetMethodName(request, methodName);
- XMLRPC_RequestSetData(request, params);
- XMLRPC_RequestSetRequestType(request, xmlrpc_request_call);
-
- XMLRPC_AddValueToVector(xRandomArray,
- XMLRPC_ServerCallMethod(server, request, userData));
-
- XMLRPC_AddValueToVector(xReturn, xRandomArray);
- }
- XMLRPC_RequestFree(request, 1);
- }
- xMethodIter = XMLRPC_VectorNext(xArray);
- }
- }
- return xReturn;
-}
-
-
-XMLRPC_VALUE xsm_system_get_capabilities_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData) {
- XMLRPC_VALUE xReturn = XMLRPC_CreateVector(0, xmlrpc_vector_struct);
- XMLRPC_VALUE xFaults = XMLRPC_CreateVector("faults_interop", xmlrpc_vector_struct);
- XMLRPC_VALUE xIntro = XMLRPC_CreateVector("introspection", xmlrpc_vector_struct);
-
- /* support for fault spec */
- XMLRPC_VectorAppendString(xFaults, "specURL", "http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php", 0);
- XMLRPC_VectorAppendInt(xFaults, "specVersion", 20010516);
-
- /* support for introspection spec */
- XMLRPC_VectorAppendString(xIntro, "specURL", "http://xmlrpc-epi.sourceforge.net/specs/rfc.introspection.php", 0);
- XMLRPC_VectorAppendInt(xIntro, "specVersion", 20010516);
-
- XMLRPC_AddValuesToVector(xReturn,
- xFaults,
- xIntro,
- NULL);
-
- return xReturn;
-
-}
-
-/*-***********************
-* End System Methods API *
-*************************/
-
-
-
diff --git a/ext/xmlrpc/libxmlrpc/system_methods_private.h b/ext/xmlrpc/libxmlrpc/system_methods_private.h
deleted file mode 100644
index 72408fd3c4..0000000000
--- a/ext/xmlrpc/libxmlrpc/system_methods_private.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2001 Dan Libby, Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-/* IMPORTANT!
- *
- * only non-public things should be in this file. It is fine for any .c file
- * in xmlrpc/src to include it, but users of the public API should never
- * include it, and thus *.h files that are part of the public API should
- * never include it, or they would break if this file is not present.
- */
-
-
-#ifndef __SYSTEM_METHODS_PRIVATE_H
-/*
- * Avoid include redundancy.
- */
-#define __SYSTEM_METHODS_PRIVATE_H
-
-/*----------------------------------------------------------------------------
- * system_methods_private.h
- *
- * Purpose:
- * define non-public system.* methods
- * Comments:
- * xsm = xmlrpc system methods
- */
-
-/*----------------------------------------------------------------------------
- * Constants
- */
-#define xsm_token_system_multicall "system.multiCall"
-#define xsm_token_system_get_capabilities "system.getCapabilities"
-
-
-/*----------------------------------------------------------------------------
- * Includes
- */
-
-/*----------------------------------------------------------------------------
- * Structures
- */
-
-/*----------------------------------------------------------------------------
- * Globals
- */
-
-/*----------------------------------------------------------------------------
- * Functions
- */
-void xsm_register(XMLRPC_SERVER server);
-int xsm_is_system_method(XMLRPC_Callback cb);
-
-/*----------------------------------------------------------------------------
- * Macros
- */
-
-
-#endif /* __SYSTEM_METHODS_PRIVATE_H */
-
-
-
-
diff --git a/ext/xmlrpc/libxmlrpc/xml_element.c b/ext/xmlrpc/libxmlrpc/xml_element.c
deleted file mode 100644
index 3b2335c408..0000000000
--- a/ext/xmlrpc/libxmlrpc/xml_element.c
+++ /dev/null
@@ -1,734 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-static const char rcsid[] = "#(@) $Id$";
-
-
-
-/****h* ABOUT/xml_element
- * NAME
- * xml_element
- * AUTHOR
- * Dan Libby, aka danda (dan@libby.com)
- * CREATION DATE
- * 06/2000
- * HISTORY
- * $Log$
- * Revision 1.3 2002/07/05 04:43:53 danda
- * merged in updates from SF project. bring php repository up to date with xmlrpc-epi version 0.51
- *
- * Revision 1.9 2002/07/03 20:54:30 danda
- * root element should not have a parent. patch from anon SF user
- *
- * Revision 1.8 2002/05/23 17:46:51 danda
- * patch from mukund - fix non utf-8 encoding conversions
- *
- * Revision 1.7 2002/02/13 20:58:50 danda
- * patch to make source more windows friendly, contributed by Jeff Lawson
- *
- * Revision 1.6 2002/01/08 01:06:55 danda
- * enable <?xml version="1.0"?> format for parsers that are very picky.
- *
- * Revision 1.5 2001/09/29 21:58:05 danda
- * adding cvs log to history section
- *
- * 10/15/2000 -- danda -- adding robodoc documentation
- * TODO
- * Nicer external API. Get rid of macros. Make opaque types, etc.
- * PORTABILITY
- * Coded on RedHat Linux 6.2. Builds on Solaris x86. Should build on just
- * about anything with minor mods.
- * NOTES
- * This code incorporates ideas from expat-ensor from http://xml.ensor.org.
- *
- * It was coded primarily to act as a go-between for expat and xmlrpc. To this
- * end, it stores xml elements, their sub-elements, and their attributes in an
- * in-memory tree. When expat is done parsing, the tree can be walked, thus
- * retrieving the values. The code can also be used to build a tree via API then
- * write out the tree to a buffer, thus "serializing" the xml.
- *
- * It turns out this is useful for other purposes, such as parsing config files.
- * YMMV.
- *
- * Some Features:
- * - output option for xml escaping data. Choices include no escaping, entity escaping,
- * or CDATA sections.
- * - output option for character encoding. Defaults to (none) utf-8.
- * - output option for verbosity/readability. ultra-compact, newlines, pretty/level indented.
- *
- * BUGS
- * there must be some.
- ******/
-
-#ifdef _WIN32
-#include "xmlrpc_win32.h"
-#endif
-#include <stdlib.h>
-#include <string.h>
-
-#include "xml_element.h"
-#include "queue.h"
-#include "expat.h"
-#include "encodings.h"
-
-#define my_free(thing) if(thing) {free(thing); thing = 0;}
-
-#define XML_DECL_START "<?xml"
-#define XML_DECL_START_LEN sizeof(XML_DECL_START) - 1
-#define XML_DECL_VERSION "version=\"1.0\""
-#define XML_DECL_VERSION_LEN sizeof(XML_DECL_VERSION) - 1
-#define XML_DECL_ENCODING_ATTR "encoding"
-#define XML_DECL_ENCODING_ATTR_LEN sizeof(XML_DECL_ENCODING_ATTR) - 1
-#define XML_DECL_ENCODING_DEFAULT "utf-8"
-#define XML_DECL_ENCODING_DEFAULT_LEN sizeof(XML_DECL_ENCODING_DEFAULT) - 1
-#define XML_DECL_END "?>"
-#define XML_DECL_END_LEN sizeof(XML_DECL_END) - 1
-#define START_TOKEN_BEGIN "<"
-#define START_TOKEN_BEGIN_LEN sizeof(START_TOKEN_BEGIN) - 1
-#define START_TOKEN_END ">"
-#define START_TOKEN_END_LEN sizeof(START_TOKEN_END) - 1
-#define EMPTY_START_TOKEN_END "/>"
-#define EMPTY_START_TOKEN_END_LEN sizeof(EMPTY_START_TOKEN_END) - 1
-#define END_TOKEN_BEGIN "</"
-#define END_TOKEN_BEGIN_LEN sizeof(END_TOKEN_BEGIN) - 1
-#define END_TOKEN_END ">"
-#define END_TOKEN_END_LEN sizeof(END_TOKEN_END) - 1
-#define ATTR_DELIMITER "\""
-#define ATTR_DELIMITER_LEN sizeof(ATTR_DELIMITER) - 1
-#define CDATA_BEGIN "<![CDATA["
-#define CDATA_BEGIN_LEN sizeof(CDATA_BEGIN) - 1
-#define CDATA_END "]]>"
-#define CDATA_END_LEN sizeof(CDATA_END) - 1
-#define EQUALS "="
-#define EQUALS_LEN sizeof(EQUALS) - 1
-#define WHITESPACE " "
-#define WHITESPACE_LEN sizeof(WHITESPACE) - 1
-#define NEWLINE "\n"
-#define NEWLINE_LEN sizeof(NEWLINE) - 1
-#define MAX_VAL_BUF 144
-#define SCALAR_STR "SCALAR"
-#define SCALAR_STR_LEN sizeof(SCALAR_STR) - 1
-#define VECTOR_STR "VECTOR"
-#define VECTOR_STR_LEN sizeof(VECTOR_STR) - 1
-#define RESPONSE_STR "RESPONSE"
-#define RESPONSE_STR_LEN sizeof(RESPONSE_STR) - 1
-
-
-/*-----------------------------
-- Begin xml_element Functions -
------------------------------*/
-
-/****f* xml_element/xml_elem_free_non_recurse
- * NAME
- * xml_elem_free_non_recurse
- * SYNOPSIS
- * void xml_elem_free_non_recurse(xml_element* root)
- * FUNCTION
- * free a single xml element. child elements will not be freed.
- * INPUTS
- * root - the element to free
- * RESULT
- * void
- * NOTES
- * SEE ALSO
- * xml_elem_free ()
- * xml_elem_new ()
- * SOURCE
- */
-void xml_elem_free_non_recurse(xml_element* root) {
- if(root) {
- xml_element_attr* attrs = Q_Head(&root->attrs);
- while(attrs) {
- my_free(attrs->key);
- my_free(attrs->val);
- my_free(attrs);
- attrs = Q_Next(&root->attrs);
- }
-
- Q_Destroy(&root->children);
- Q_Destroy(&root->attrs);
- my_free((char*)root->name);
- simplestring_free(&root->text);
- my_free(root);
- }
-}
-/******/
-
-/****f* xml_element/xml_elem_free
- * NAME
- * xml_elem_free
- * SYNOPSIS
- * void xml_elem_free(xml_element* root)
- * FUNCTION
- * free an xml element and all of its child elements
- * INPUTS
- * root - the root of an xml tree you would like to free
- * RESULT
- * void
- * NOTES
- * SEE ALSO
- * xml_elem_free_non_recurse ()
- * xml_elem_new ()
- * SOURCE
- */
-void xml_elem_free(xml_element* root) {
- if(root) {
- xml_element* kids = Q_Head(&root->children);
- while(kids) {
- xml_elem_free(kids);
- kids = Q_Next(&root->children);
- }
- xml_elem_free_non_recurse(root);
- }
-}
-/******/
-
-/****f* xml_element/xml_elem_new
- * NAME
- * xml_elem_new
- * SYNOPSIS
- * xml_element* xml_elem_new()
- * FUNCTION
- * allocates and initializes a new xml_element
- * INPUTS
- * none
- * RESULT
- * xml_element* or NULL. NULL indicates an out-of-memory condition.
- * NOTES
- * SEE ALSO
- * xml_elem_free ()
- * xml_elem_free_non_recurse ()
- * SOURCE
- */
-xml_element* xml_elem_new() {
- xml_element* elem = calloc(1, sizeof(xml_element));
- if(elem) {
- Q_Init(&elem->children);
- Q_Init(&elem->attrs);
- simplestring_init(&elem->text);
-
- /* init empty string in case we don't find any char data */
- simplestring_addn(&elem->text, "", 0);
- }
- return elem;
-}
-/******/
-
-static int xml_elem_writefunc(int (*fptr)(void *data, const char *text, int size), const char *text, void *data, int len)
-{
- return fptr && text ? fptr(data, text, len ? len : strlen(text)) : 0;
-}
-
-
-
-static int create_xml_escape(char *pString, unsigned char c)
-{
- int counter = 0;
-
- pString[counter++] = '&';
- pString[counter++] = '#';
- if(c >= 100) {
- pString[counter++] = c / 100 + '0';
- c = c % 100;
- }
- if(c >= 10) {
- pString[counter++] = c / 10 + '0';
- c = c % 10;
- }
- pString[counter++] = c + '0';
- pString[counter++] = ';';
- return counter;
-}
-
-#define non_ascii(c) (c > 127)
-#define non_print(c) (!isprint(c))
-#define markup(c) (c == '&' || c == '\"' || c == '>' || c == '<')
-#define entity_length(c) ( (c >= 100) ? 3 : ((c >= 10) ? 2 : 1) ) + 3; /* "&#" + c + ";" */
-
-/*
- * xml_elem_entity_escape
- *
- * Purpose:
- * escape reserved xml chars and non utf-8 chars as xml entities
- * Comments:
- * The return value may be a new string, or null if no
- * conversion was performed. In the latter case, *newlen will
- * be 0.
- * Flags (to escape)
- * xml_elem_no_escaping = 0x000,
- * xml_elem_entity_escaping = 0x002, // escape xml special chars as entities
- * xml_elem_non_ascii_escaping = 0x008, // escape chars above 127
- * xml_elem_cdata_escaping = 0x010, // wrap in cdata
- */
-static char* xml_elem_entity_escape(const char* buf, int old_len, int *newlen, XML_ELEM_ESCAPING flags) {
- char *pRetval = 0;
- int iNewBufLen=0;
-
-#define should_escape(c, flag) ( ((flag & xml_elem_markup_escaping) && markup(c)) || \
- ((flag & xml_elem_non_ascii_escaping) && non_ascii(c)) || \
- ((flag & xml_elem_non_print_escaping) && non_print(c)) )
-
- if(buf && *buf) {
- const unsigned char *bufcopy;
- char *NewBuffer;
- int ToBeXmlEscaped=0;
- int iLength;
- bufcopy = buf;
- iLength= old_len ? old_len : strlen(buf);
- while(*bufcopy) {
- if( should_escape(*bufcopy, flags) ) {
- /* the length will increase by length of xml escape - the character length */
- iLength += entity_length(*bufcopy);
- ToBeXmlEscaped=1;
- }
- bufcopy++;
- }
-
- if(ToBeXmlEscaped) {
-
- NewBuffer= malloc(iLength+1);
- if(NewBuffer) {
- bufcopy=buf;
- while(*bufcopy) {
- if(should_escape(*bufcopy, flags)) {
- iNewBufLen += create_xml_escape(NewBuffer+iNewBufLen,*bufcopy);
- }
- else {
- NewBuffer[iNewBufLen++]=*bufcopy;
- }
- bufcopy++;
- }
- NewBuffer[iNewBufLen] = 0;
- pRetval = NewBuffer;
- }
- }
- }
-
- if(newlen) {
- *newlen = iNewBufLen;
- }
-
- return pRetval;
-}
-
-
-static void xml_element_serialize(xml_element *el, int (*fptr)(void *data, const char *text, int size), void *data, XML_ELEM_OUTPUT_OPTIONS options, int depth)
-{
- int i;
- static STRUCT_XML_ELEM_OUTPUT_OPTIONS default_opts = {xml_elem_pretty, xml_elem_markup_escaping | xml_elem_non_print_escaping, XML_DECL_ENCODING_DEFAULT};
- static char whitespace[] = " "
- " "
- " ";
- depth++;
-
- if(!el) {
- fprintf(stderr, "Nothing to write\n");
- return;
- }
- if(!options) {
- options = &default_opts;
- }
-
- /* print xml declaration if at root level */
- if(depth == 1) {
- xml_elem_writefunc(fptr, XML_DECL_START, data, XML_DECL_START_LEN);
- xml_elem_writefunc(fptr, WHITESPACE, data, WHITESPACE_LEN);
- xml_elem_writefunc(fptr, XML_DECL_VERSION, data, XML_DECL_VERSION_LEN);
- if(options->encoding && *options->encoding) {
- xml_elem_writefunc(fptr, WHITESPACE, data, WHITESPACE_LEN);
- xml_elem_writefunc(fptr, XML_DECL_ENCODING_ATTR, data, XML_DECL_ENCODING_ATTR_LEN);
- xml_elem_writefunc(fptr, EQUALS, data, EQUALS_LEN);
- xml_elem_writefunc(fptr, ATTR_DELIMITER, data, ATTR_DELIMITER_LEN);
- xml_elem_writefunc(fptr, options->encoding, data, 0);
- xml_elem_writefunc(fptr, ATTR_DELIMITER, data, ATTR_DELIMITER_LEN);
- }
- xml_elem_writefunc(fptr, XML_DECL_END, data, XML_DECL_END_LEN);
- if(options->verbosity != xml_elem_no_white_space) {
- xml_elem_writefunc(fptr, NEWLINE, data, NEWLINE_LEN);
- }
- }
-
- if(options->verbosity == xml_elem_pretty && depth > 2) {
- xml_elem_writefunc(fptr, whitespace, data, depth - 2);
- }
- /* begin element */
- xml_elem_writefunc(fptr,START_TOKEN_BEGIN, data, START_TOKEN_BEGIN_LEN);
- if(el->name) {
- xml_elem_writefunc(fptr, el->name, data, 0);
-
- /* write attrs, if any */
- if(Q_Size(&el->attrs)) {
- xml_element_attr* iter = Q_Head(&el->attrs);
- while( iter ) {
- xml_elem_writefunc(fptr, WHITESPACE, data, WHITESPACE_LEN);
- xml_elem_writefunc(fptr, iter->key, data, 0);
- xml_elem_writefunc(fptr, EQUALS, data, EQUALS_LEN);
- xml_elem_writefunc(fptr, ATTR_DELIMITER, data, ATTR_DELIMITER_LEN);
- xml_elem_writefunc(fptr, iter->val, data, 0);
- xml_elem_writefunc(fptr, ATTR_DELIMITER, data, ATTR_DELIMITER_LEN);
-
- iter = Q_Next(&el->attrs);
- }
- }
- }
- else {
- xml_elem_writefunc(fptr, "None", data, 0);
- }
- /* if no text and no children, use abbreviated form, eg: <foo/> */
- if(!el->text.len && !Q_Size(&el->children)) {
- xml_elem_writefunc(fptr, EMPTY_START_TOKEN_END, data, EMPTY_START_TOKEN_END_LEN);
- }
- /* otherwise, print element contents */
- else {
- xml_elem_writefunc(fptr, START_TOKEN_END, data, START_TOKEN_END_LEN);
-
- /* print text, if any */
- if(el->text.len) {
- char* escaped_str = el->text.str;
- int buflen = el->text.len;
-
- if(options->escaping && options->escaping != xml_elem_cdata_escaping) {
- escaped_str = xml_elem_entity_escape(el->text.str, buflen, &buflen, options->escaping );
- if(!escaped_str) {
- escaped_str = el->text.str;
- }
- }
-
- if(options->escaping & xml_elem_cdata_escaping) {
- xml_elem_writefunc(fptr, CDATA_BEGIN, data, CDATA_BEGIN_LEN);
- }
-
- xml_elem_writefunc(fptr, escaped_str, data, buflen);
-
- if(escaped_str != el->text.str) {
- my_free(escaped_str);
- }
-
- if(options->escaping & xml_elem_cdata_escaping) {
- xml_elem_writefunc(fptr, CDATA_END, data, CDATA_END_LEN);
- }
- }
- /* no text, so print child elems */
- else {
- xml_element *kids = Q_Head(&el->children);
- i = 0;
- while( kids ) {
- if(i++ == 0) {
- if(options->verbosity != xml_elem_no_white_space) {
- xml_elem_writefunc(fptr, NEWLINE, data, NEWLINE_LEN);
- }
- }
- xml_element_serialize(kids, fptr, data, options, depth);
- kids = Q_Next(&el->children);
- }
- if(i) {
- if(options->verbosity == xml_elem_pretty && depth > 2) {
- xml_elem_writefunc(fptr, whitespace, data, depth - 2);
- }
- }
- }
-
- xml_elem_writefunc(fptr, END_TOKEN_BEGIN, data, END_TOKEN_BEGIN_LEN);
- xml_elem_writefunc(fptr,el->name ? el->name : "None", data, 0);
- xml_elem_writefunc(fptr, END_TOKEN_END, data, END_TOKEN_END_LEN);
- }
- if(options->verbosity != xml_elem_no_white_space) {
- xml_elem_writefunc(fptr, NEWLINE, data, NEWLINE_LEN);
- }
-}
-
-/* print buf to file */
-static file_out_fptr(void *f, const char *text, int size)
-{
- fputs(text, (FILE *)f);
-}
-
-/* print buf to simplestring */
-static simplestring_out_fptr(void *f, const char *text, int size)
-{
- simplestring* buf = (simplestring*)f;
- if(buf) {
- simplestring_addn(buf, text, size);
- }
-}
-
-/****f* xml_element/xml_elem_serialize_to_string
- * NAME
- * xml_elem_serialize_to_string
- * SYNOPSIS
- * void xml_element_serialize_to_string(xml_element *el, XML_ELEM_OUTPUT_OPTIONS options, int *buf_len)
- * FUNCTION
- * writes element tree as XML into a newly allocated buffer
- * INPUTS
- * el - root element of tree
- * options - options determining how output is written. see XML_ELEM_OUTPUT_OPTIONS
- * buf_len - length of returned buffer, if not null.
- * RESULT
- * char* or NULL. Must be free'd by caller.
- * NOTES
- * SEE ALSO
- * xml_elem_serialize_to_stream ()
- * xml_elem_parse_buf ()
- * SOURCE
- */
-char* xml_elem_serialize_to_string(xml_element *el, XML_ELEM_OUTPUT_OPTIONS options, int *buf_len)
-{
- simplestring buf;
- simplestring_init(&buf);
-
- xml_element_serialize(el, simplestring_out_fptr, (void *)&buf, options, 0);
-
- if(buf_len) {
- *buf_len = buf.len;
- }
-
- return buf.str;
-}
-/******/
-
-/****f* xml_element/xml_elem_serialize_to_stream
- * NAME
- * xml_elem_serialize_to_stream
- * SYNOPSIS
- * void xml_elem_serialize_to_stream(xml_element *el, FILE *output, XML_ELEM_OUTPUT_OPTIONS options)
- * FUNCTION
- * writes element tree as XML into a stream (typically an opened file)
- * INPUTS
- * el - root element of tree
- * output - stream handle
- * options - options determining how output is written. see XML_ELEM_OUTPUT_OPTIONS
- * RESULT
- * void
- * NOTES
- * SEE ALSO
- * xml_elem_serialize_to_string ()
- * xml_elem_parse_buf ()
- * SOURCE
- */
-void xml_elem_serialize_to_stream(xml_element *el, FILE *output, XML_ELEM_OUTPUT_OPTIONS options)
-{
- xml_element_serialize(el, file_out_fptr, (void *)output, options, 0);
-}
-/******/
-
-/*--------------------------*
-* End xml_element Functions *
-*--------------------------*/
-
-
-/*----------------------
-* Begin Expat Handlers *
-*---------------------*/
-
-typedef struct _xml_elem_data {
- xml_element* root;
- xml_element* current;
- XML_ELEM_INPUT_OPTIONS input_options;
- int needs_enc_conversion;
-} xml_elem_data;
-
-
-/* expat start of element handler */
-static void startElement(void *userData, const char *name, const char **attrs)
-{
- xml_element *c;
- xml_elem_data* mydata = (xml_elem_data*)userData;
- const char** p = attrs;
-
- if(mydata) {
- c = mydata->current;
-
- mydata->current = xml_elem_new();
- mydata->current->name = (char*)strdup(name);
- mydata->current->parent = c;
-
- /* init attrs */
- while(p && *p) {
- xml_element_attr* attr = malloc(sizeof(xml_element_attr));
- if(attr) {
- attr->key = strdup(*p);
- attr->val = strdup(*(p+1));
- Q_PushTail(&mydata->current->attrs, attr);
-
- p += 2;
- }
- }
- }
-}
-
-/* expat end of element handler */
-static void endElement(void *userData, const char *name)
-{
- xml_elem_data* mydata = (xml_elem_data*)userData;
-
- if(mydata && mydata->current && mydata->current->parent) {
- Q_PushTail(&mydata->current->parent->children, mydata->current);
-
- mydata->current = mydata->current->parent;
- }
-}
-
-/* expat char data handler */
-static void charHandler(void *userData,
- const char *s,
- int len)
-{
- xml_elem_data* mydata = (xml_elem_data*)userData;
- if(mydata && mydata->current) {
-
- /* Check if we need to decode utf-8 parser output to another encoding */
- if(mydata->needs_enc_conversion && mydata->input_options->encoding) {
- int new_len = 0;
- char* add_text = utf8_decode(s, len, &new_len, mydata->input_options->encoding);
- if(add_text) {
- len = new_len;
- simplestring_addn(&mydata->current->text, add_text, len);
- free(add_text);
- return;
- }
- }
- simplestring_addn(&mydata->current->text, s, len);
- }
-}
-/******/
-
-/*-------------------*
-* End Expat Handlers *
-*-------------------*/
-
-/*-------------------*
-* xml_elem_parse_buf *
-*-------------------*/
-
-/****f* xml_element/xml_elem_parse_buf
- * NAME
- * xml_elem_parse_buf
- * SYNOPSIS
- * xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTIONS options, XML_ELEM_ERROR error)
- * FUNCTION
- * parse a buffer containing XML into an xml_element in-memory tree
- * INPUTS
- * in_buf - buffer containing XML document
- * len - length of buffer
- * options - input options. optional
- * error - error result data. optional. check if result is null.
- * RESULT
- * void
- * NOTES
- * The returned data must be free'd by caller
- * SEE ALSO
- * xml_elem_serialize_to_string ()
- * xml_elem_free ()
- * SOURCE
- */
-xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTIONS options, XML_ELEM_ERROR error)
-{
- xml_element* xReturn = NULL;
- char buf[100] = "";
- static STRUCT_XML_ELEM_INPUT_OPTIONS default_opts = {encoding_utf_8};
-
- if(!options) {
- options = &default_opts;
- }
-
- if(in_buf) {
- XML_Parser parser;
- xml_elem_data mydata = {0};
-
- parser = XML_ParserCreate(NULL);
-
- mydata.root = xml_elem_new();
- mydata.current = mydata.root;
- mydata.input_options = options;
- mydata.needs_enc_conversion = options->encoding && strcmp(options->encoding, encoding_utf_8);
-
- XML_SetElementHandler(parser, startElement, endElement);
- XML_SetCharacterDataHandler(parser, charHandler);
-
- /* pass the xml_elem_data struct along */
- XML_SetUserData(parser, (void*)&mydata);
-
- if(!len) {
- len = strlen(in_buf);
- }
-
- /* parse the XML */
- if(XML_Parse(parser, in_buf, len, 1) == 0) {
- enum XML_Error err_code = XML_GetErrorCode(parser);
- int line_num = XML_GetCurrentLineNumber(parser);
- int col_num = XML_GetCurrentColumnNumber(parser);
- long byte_idx = XML_GetCurrentByteIndex(parser);
- int byte_total = XML_GetCurrentByteCount(parser);
- const char * error_str = XML_ErrorString(err_code);
- if(byte_idx >= 0) {
- snprintf(buf,
- sizeof(buf),
- "\n\tdata beginning %i before byte index: %s\n",
- byte_idx > 10 ? 10 : byte_idx,
- in_buf + (byte_idx > 10 ? byte_idx - 10 : byte_idx));
- }
-
- fprintf(stderr, "expat reports error code %i\n"
- "\tdescription: %s\n"
- "\tline: %i\n"
- "\tcolumn: %i\n"
- "\tbyte index: %i\n"
- "\ttotal bytes: %i\n%s ",
- err_code, error_str, line_num,
- col_num, byte_idx, byte_total, buf);
-
-
- /* error condition */
- if(error) {
- error->parser_code = (long)err_code;
- error->line = line_num;
- error->column = col_num;
- error->byte_index = byte_idx;
- error->parser_error = error_str;
- }
- }
- else {
- xReturn = (xml_element*)Q_Head(&mydata.root->children);
- xReturn->parent = NULL;
- }
-
- XML_ParserFree(parser);
-
-
- xml_elem_free_non_recurse(mydata.root);
- }
-
- return xReturn;
-}
-
-/******/
diff --git a/ext/xmlrpc/libxmlrpc/xml_element.h b/ext/xmlrpc/libxmlrpc/xml_element.h
deleted file mode 100644
index cfe7ca2483..0000000000
--- a/ext/xmlrpc/libxmlrpc/xml_element.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-#ifndef __XML_ELEMENT_H__
- #define __XML_ELEMENT_H__
-
-/* includes */
-#include <stdio.h>
-#include "queue.h"
-#include "simplestring.h"
-#include "encodings.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/****d* enum/XML_ELEM_VERBOSITY
- * NAME
- * XML_ELEM_VERBOSITY
- * NOTES
- * verbosity/readability options for generated xml
- * SEE ALSO
- * XML_ELEM_OUTPUT_OPTIONS
- * SOURCE
- */
-typedef enum _xml_elem_verbosity {
- xml_elem_no_white_space, /* compact xml with no white space */
- xml_elem_newlines_only, /* add newlines for enhanced readability */
- xml_elem_pretty /* add newlines and indent accordint to depth */
-} XML_ELEM_VERBOSITY;
-/******/
-
-
-/****d* enum/XML_ELEM_ESCAPING
- * NAME
- * XML_ELEM_ESCAPING
- * NOTES
- * xml escaping options for generated xml
- * SEE ALSO
- * XML_ELEM_OUTPUT_OPTIONS
- * SOURCE
- */
-typedef enum _xml_elem_escaping {
- xml_elem_no_escaping = 0x000,
- xml_elem_markup_escaping = 0x002, /* entity escape xml special chars */
- xml_elem_non_ascii_escaping = 0x008, /* entity escape chars above 127 */
- xml_elem_non_print_escaping = 0x010, /* entity escape non print (illegal) chars */
- xml_elem_cdata_escaping = 0x020, /* wrap in cdata section */
-} XML_ELEM_ESCAPING;
-/******/
-
-
-/****s* struct/XML_ELEM_OUTPUT_OPTIONS
- * NAME
- * XML_ELEM_OUTPUT_OPTIONS
- * NOTES
- * defines various output options
- * SOURCE
- */
-typedef struct _xml_output_options {
- XML_ELEM_VERBOSITY verbosity; /* length/verbosity of xml */
- XML_ELEM_ESCAPING escaping; /* how to escape special chars */
- const char* encoding; /* <?xml encoding="<encoding>" ?> */
-} STRUCT_XML_ELEM_OUTPUT_OPTIONS, *XML_ELEM_OUTPUT_OPTIONS;
-/******/
-
-/****s* struct/XML_ELEM_INPUT_OPTIONS
- * NAME
- * XML_ELEM_INPUT_OPTIONS
- * NOTES
- * defines various input options
- * SOURCE
- */
-typedef struct _xml_input_options {
- ENCODING_ID encoding; /* which encoding to use. */
-} STRUCT_XML_ELEM_INPUT_OPTIONS, *XML_ELEM_INPUT_OPTIONS;
-/******/
-
-/****s* struct/XML_ELEM_ERROR
- * NAME
- * XML_ELEM_ERROR
- * NOTES
- * defines an xml parser error
- * SOURCE
- */
-typedef struct _xml_elem_error {
- int parser_code;
- const char* parser_error;
- long line;
- long column;
- long byte_index;
-} STRUCT_XML_ELEM_ERROR, *XML_ELEM_ERROR;
-/******/
-
-
-/*-************************
-* begin xml element stuff *
-**************************/
-
-/****s* struct/xml_elem_attr
- * NAME
- * xml_elem_attr
- * NOTES
- * representation of an xml attribute, foo="bar"
- * SOURCE
- */
-typedef struct _xml_element_attr {
- char* key; /* attribute key */
- char* val; /* attribute value */
-} xml_element_attr;
-/******/
-
-/****s* struct/xml_elem_attr
- * NAME
- * xml_elem_attr
- * NOTES
- * representation of an xml element, eg <candidate name="Harry Browne" party="Libertarian"/>
- * SOURCE
- */
-typedef struct _xml_element {
- const char* name; /* element identifier */
- simplestring text; /* text contained between element begin/end pairs */
- struct _xml_element* parent; /* element's parent */
-
- queue attrs; /* attribute list */
- queue children; /* child element list */
-} xml_element;
-/******/
-
-void xml_elem_free(xml_element* root);
-void xml_elem_free_non_recurse(xml_element* root);
-xml_element* xml_elem_new(void);
-char* xml_elem_serialize_to_string(xml_element *el, XML_ELEM_OUTPUT_OPTIONS options, int *buf_len);
-void xml_elem_serialize_to_stream(xml_element *el, FILE *output, XML_ELEM_OUTPUT_OPTIONS options);
-xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTIONS options, XML_ELEM_ERROR error);
-
-/*-**********************
-* end xml element stuff *
-************************/
-
-/*-**********************
-* Begin xml_element API *
-************************/
-
-/****d* VALUE/XMLRPC_MACROS
- * NAME
- * Some Helpful Macros
- * NOTES
- * Some macros for making life easier. Should be self-explanatory.
- * SEE ALSO
- * XMLRPC_AddValueToVector ()
- * XMLRPC_VectorGetValueWithID_Case ()
- * XMLRPC_VALUE
- * SOURCE
- */
-#define xml_elem_next_element(el) ((el) ? (xml_element *)Q_Next(&el->children) : NULL)
-#define xml_elem_head_element(el) ((el) ? (xml_element *)Q_Head(&el->children) : NULL)
-#define xml_elem_next_attr(el) ((el) ? (xml_element_attr *)Q_Next(&el->attrs) : NULL)
-#define xml_elem_head_attr(el) ((el) ? (xml_element_attr *)Q_Head(&el->attrs) : NULL)
-#define xml_elem_get_name(el) (char *)((el) ? el->name : NULL)
-#define xml_elem_get_val(el) (char *)((el) ? el->text.str : NULL)
-/******/
-
-
-/*-********************
-* End xml_element API *
-**********************/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __XML_ELEMENT_H__ */
diff --git a/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.c b/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.c
deleted file mode 100644
index b51d991723..0000000000
--- a/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-#ifdef _WIN32
-#include "xmlrpc_win32.h"
-#endif
-#include <string.h>
-#include <stdlib.h>
-#include "xml_to_dandarpc.h"
-#include "base64.h"
-
-/* list of tokens used in vocab */
-#define ELEM_METHODCALL "methodCall"
-#define ELEM_METHODNAME "methodName"
-#define ELEM_METHODRESPONSE "methodResponse"
-#define ELEM_ROOT "simpleRPC"
-
-#define ATTR_ARRAY "array"
-#define ATTR_BASE64 "base64"
-#define ATTR_BOOLEAN "boolean"
-#define ATTR_DATETIME "dateTime.iso8601"
-#define ATTR_DOUBLE "double"
-#define ATTR_ID "id"
-#define ATTR_INT "int"
-#define ATTR_MIXED "mixed"
-#define ATTR_SCALAR "scalar"
-#define ATTR_STRING "string"
-#define ATTR_STRUCT "struct"
-#define ATTR_TYPE "type"
-#define ATTR_VECTOR "vector"
-#define ATTR_VERSION "version"
-
-#define VAL_VERSION_0_9 "0.9"
-
-
-XMLRPC_VALUE xml_element_to_DANDARPC_REQUEST_worker(XMLRPC_REQUEST request, XMLRPC_VALUE xCurrent, xml_element* el) {
- if(!xCurrent) {
- xCurrent = XMLRPC_CreateValueEmpty();
- }
-
- if(el->name) {
- const char* id = NULL;
- const char* type = NULL;
- xml_element_attr* attr_iter = Q_Head(&el->attrs);
-
- while(attr_iter) {
- if(!strcmp(attr_iter->key, ATTR_ID)) {
- id = attr_iter->val;
- }
- if(!strcmp(attr_iter->key, ATTR_TYPE)) {
- type = attr_iter->val;
- }
- attr_iter = Q_Next(&el->attrs);
- }
-
- if(id) {
- XMLRPC_SetValueID_Case(xCurrent, id, 0, xmlrpc_case_exact);
- }
-
- if(!strcmp(el->name, ATTR_SCALAR)) {
- if(!type || !strcmp(type, ATTR_STRING)) {
- XMLRPC_SetValueString(xCurrent, el->text.str, el->text.len);
- }
- else if(!strcmp(type, ATTR_INT)) {
- XMLRPC_SetValueInt(xCurrent, atoi(el->text.str));
- }
- else if(!strcmp(type, ATTR_BOOLEAN)) {
- XMLRPC_SetValueBoolean(xCurrent, atoi(el->text.str));
- }
- else if(!strcmp(type, ATTR_DOUBLE)) {
- XMLRPC_SetValueDouble(xCurrent, atof(el->text.str));
- }
- else if(!strcmp(type, ATTR_DATETIME)) {
- XMLRPC_SetValueDateTime_ISO8601(xCurrent, el->text.str);
- }
- else if(!strcmp(type, ATTR_BASE64)) {
- struct buffer_st buf;
- base64_decode(&buf, el->text.str, el->text.len);
- XMLRPC_SetValueBase64(xCurrent, buf.data, buf.offset);
- buffer_delete(&buf);
- }
- }
- else if(!strcmp(el->name, ATTR_VECTOR)) {
- xml_element* iter = (xml_element*)Q_Head(&el->children);
-
- if(!type || !strcmp(type, ATTR_MIXED)) {
- XMLRPC_SetIsVector(xCurrent, xmlrpc_vector_mixed);
- }
- else if(!strcmp(type, ATTR_ARRAY)) {
- XMLRPC_SetIsVector(xCurrent, xmlrpc_vector_array);
- }
- else if(!strcmp(type, ATTR_STRUCT)) {
- XMLRPC_SetIsVector(xCurrent, xmlrpc_vector_struct);
- }
- while( iter ) {
- XMLRPC_VALUE xNext = XMLRPC_CreateValueEmpty();
- xml_element_to_DANDARPC_REQUEST_worker(request, xNext, iter);
- XMLRPC_AddValueToVector(xCurrent, xNext);
- iter = (xml_element*)Q_Next(&el->children);
- }
- }
- else {
- xml_element* iter = (xml_element*)Q_Head(&el->children);
- while( iter ) {
- xml_element_to_DANDARPC_REQUEST_worker(request, xCurrent, iter);
- iter = (xml_element*)Q_Next(&el->children);
- }
-
- if(!strcmp(el->name, ELEM_METHODCALL)) {
- if(request) {
- XMLRPC_RequestSetRequestType(request, xmlrpc_request_call);
- }
- }
- else if(!strcmp(el->name, ELEM_METHODRESPONSE)) {
- if(request) {
- XMLRPC_RequestSetRequestType(request, xmlrpc_request_response);
- }
- }
- else if(!strcmp(el->name, ELEM_METHODNAME)) {
- if(request) {
- XMLRPC_RequestSetMethodName(request, el->text.str);
- }
- }
- }
- }
- return xCurrent;
-}
-
-XMLRPC_VALUE xml_element_to_DANDARPC_VALUE(xml_element* el)
-{
- return xml_element_to_DANDARPC_REQUEST_worker(NULL, NULL, el);
-}
-
-XMLRPC_VALUE xml_element_to_DANDARPC_REQUEST(XMLRPC_REQUEST request, xml_element* el)
-{
- if(request) {
- return XMLRPC_RequestSetData(request, xml_element_to_DANDARPC_REQUEST_worker(request, NULL, el));
- }
- return NULL;
-}
-
-xml_element* DANDARPC_to_xml_element_worker(XMLRPC_REQUEST request, XMLRPC_VALUE node) {
-#define BUF_SIZE 512
- xml_element* root = NULL;
- if(node) {
- char buf[BUF_SIZE];
- const char* id = XMLRPC_GetValueID(node);
- XMLRPC_VALUE_TYPE type = XMLRPC_GetValueType(node);
- XMLRPC_REQUEST_OUTPUT_OPTIONS output = XMLRPC_RequestGetOutputOptions(request);
- int bNoAddType = (type == xmlrpc_string && request && output && output->xml_elem_opts.verbosity == xml_elem_no_white_space);
- xml_element* elem_val = xml_elem_new();
- const char* pAttrType = NULL;
-
- xml_element_attr* attr_type = bNoAddType ? NULL : malloc(sizeof(xml_element_attr));
-
- if(attr_type) {
- attr_type->key = strdup(ATTR_TYPE);
- attr_type->val = 0;
- Q_PushTail(&elem_val->attrs, attr_type);
- }
-
- elem_val->name = (type == xmlrpc_vector) ? strdup(ATTR_VECTOR) : strdup(ATTR_SCALAR);
-
- if(id && *id) {
- xml_element_attr* attr_id = malloc(sizeof(xml_element_attr));
- if(attr_id) {
- attr_id->key = strdup(ATTR_ID);
- attr_id->val = strdup(id);
- Q_PushTail(&elem_val->attrs, attr_id);
- }
- }
-
- switch(type) {
- case xmlrpc_string:
- pAttrType = ATTR_STRING;
- simplestring_addn(&elem_val->text, XMLRPC_GetValueString(node), XMLRPC_GetValueStringLen(node));
- break;
- case xmlrpc_int:
- pAttrType = ATTR_INT;
- snprintf(buf, BUF_SIZE, "%i", XMLRPC_GetValueInt(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_boolean:
- pAttrType = ATTR_BOOLEAN;
- snprintf(buf, BUF_SIZE, "%i", XMLRPC_GetValueBoolean(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_double:
- pAttrType = ATTR_DOUBLE;
- snprintf(buf, BUF_SIZE, "%f", XMLRPC_GetValueDouble(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_datetime:
- pAttrType = ATTR_DATETIME;
- simplestring_add(&elem_val->text, XMLRPC_GetValueDateTime_ISO8601(node));
- break;
- case xmlrpc_base64:
- {
- struct buffer_st buf;
- pAttrType = ATTR_BASE64;
- base64_encode(&buf, XMLRPC_GetValueBase64(node), XMLRPC_GetValueStringLen(node));
- simplestring_addn(&elem_val->text, buf.data, buf.offset );
- buffer_delete(&buf);
- }
- break;
- case xmlrpc_vector:
- {
- XMLRPC_VECTOR_TYPE my_type = XMLRPC_GetVectorType(node);
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(node);
-
- switch(my_type) {
- case xmlrpc_vector_array:
- pAttrType = ATTR_ARRAY;
- break;
- case xmlrpc_vector_mixed:
- pAttrType = ATTR_MIXED;
- break;
- case xmlrpc_vector_struct:
- pAttrType = ATTR_STRUCT;
- break;
- default:
- break;
- }
-
- /* recurse through sub-elements */
- while( xIter ) {
- xml_element* next_el = DANDARPC_to_xml_element_worker(request, xIter);
- if(next_el) {
- Q_PushTail(&elem_val->children, next_el);
- }
- xIter = XMLRPC_VectorNext(node);
- }
- }
- break;
- default:
- break;
- }
- if(pAttrType && attr_type && !bNoAddType) {
- attr_type->val = strdup(pAttrType);
- }
- root = elem_val;
- }
- return root;
-}
-
-xml_element* DANDARPC_VALUE_to_xml_element(XMLRPC_VALUE node) {
- return DANDARPC_to_xml_element_worker(NULL, node);
-}
-
-xml_element* DANDARPC_REQUEST_to_xml_element(XMLRPC_REQUEST request) {
- xml_element* wrapper = NULL;
- xml_element* root = NULL;
- if(request) {
- XMLRPC_REQUEST_TYPE request_type = XMLRPC_RequestGetRequestType(request);
- const char* pStr = NULL;
- xml_element_attr* version = malloc(sizeof(xml_element_attr));
- version->key = strdup(ATTR_VERSION);
- version->val = strdup(VAL_VERSION_0_9);
-
- wrapper = xml_elem_new();
-
- if(request_type == xmlrpc_request_response) {
- pStr = ELEM_METHODRESPONSE;
- }
- else if(request_type == xmlrpc_request_call) {
- pStr = ELEM_METHODCALL;
- }
- if(pStr) {
- wrapper->name = strdup(pStr);
- }
-
- root = xml_elem_new();
- root->name = strdup(ELEM_ROOT);
- Q_PushTail(&root->attrs, version);
- Q_PushTail(&root->children, wrapper);
-
- pStr = XMLRPC_RequestGetMethodName(request);
-
- if(pStr) {
- xml_element* method = xml_elem_new();
- method->name = strdup(ELEM_METHODNAME);
- simplestring_add(&method->text, pStr);
- Q_PushTail(&wrapper->children, method);
- }
- Q_PushTail(&wrapper->children,
- DANDARPC_to_xml_element_worker(request, XMLRPC_RequestGetData(request)));
- }
- return root;
-}
-
diff --git a/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.h b/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.h
deleted file mode 100644
index 6facb55778..0000000000
--- a/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-#ifndef XML_TO_DANDARPC_H
- #define XML_TO_DANDARPC_H
-
-#include "time.h"
-#include "xmlrpc.h"
-
-XMLRPC_VALUE xml_element_to_DANDARPC_VALUE(xml_element* el);
-XMLRPC_VALUE xml_element_to_DANDARPC_REQUEST(XMLRPC_REQUEST request, xml_element* el);
-xml_element* DANDARPC_VALUE_to_xml_element(XMLRPC_VALUE node);
-xml_element* DANDARPC_REQUEST_to_xml_element(XMLRPC_REQUEST request);
-
-#endif /* XML_TO_DANDARPC_H */
diff --git a/ext/xmlrpc/libxmlrpc/xml_to_soap.c b/ext/xmlrpc/libxmlrpc/xml_to_soap.c
deleted file mode 100644
index a09131aad6..0000000000
--- a/ext/xmlrpc/libxmlrpc/xml_to_soap.c
+++ /dev/null
@@ -1,673 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
-*/
-
-
-/*-**********************************************************************
-* TODO: *
-* - [SOAP-ENC:position] read sparse arrays (and write?) *
-* - [SOAP-ENC:offset] read partially transmitted arrays (and write?) *
-* - read "flattened" multi-dimensional arrays. (don't bother writing) *
-* *
-* BUGS: *
-* - does not read schema. thus only knows soap pre-defined types. *
-* - references (probably) do not work. untested. *
-* - does not expose SOAP-ENV:Header to application at all. *
-* - does not use namespaces correctly, thus: *
-* - namespaces are hard-coded in comparison tokens *
-* - if a sender uses another namespace identifer, it will break *
-************************************************************************/
-
-
-static const char rcsid[] = "#(@) $Id:";
-
-#ifdef _WIN32
-#include "xmlrpc_win32.h"
-#endif
-#include <string.h>
-#include <stdlib.h>
-#include "xml_to_soap.h"
-#include "base64.h"
-
-/* list of tokens used in vocab */
-#define TOKEN_ANY "xsd:ur-type"
-#define TOKEN_ARRAY "SOAP-ENC:Array"
-#define TOKEN_ARRAY_TYPE "SOAP-ENC:arrayType"
-#define TOKEN_BASE64 "SOAP-ENC:base64"
-#define TOKEN_BOOLEAN "xsd:boolean"
-#define TOKEN_DATETIME "xsd:timeInstant"
-#define TOKEN_DOUBLE "xsd:double"
-#define TOKEN_FLOAT "xsd:float"
-#define TOKEN_ID "id"
-#define TOKEN_INT "xsd:int"
-#define TOKEN_NULL "xsi:null"
-#define TOKEN_STRING "xsd:string"
-#define TOKEN_STRUCT "xsd:struct"
-#define TOKEN_TYPE "xsi:type"
-#define TOKEN_FAULT "SOAP-ENV:Fault"
-#define TOKEN_MUSTUNDERSTAND "SOAP-ENV:mustUnderstand"
-#define TOKEN_ACTOR "SOAP-ENV:actor"
-#define TOKEN_ACTOR_NEXT "http://schemas.xmlsoap.org/soap/actor/next"
-
-#define TOKEN_XMLRPC_FAULTCODE "faultCode"
-#define TOKEN_XMLRPC_FAULTSTRING "faultString"
-#define TOKEN_SOAP_FAULTCODE "faultcode"
-#define TOKEN_SOAP_FAULTSTRING "faultstring"
-#define TOKEN_SOAP_FAULTDETAILS "details"
-#define TOKEN_SOAP_FAULTACTOR "actor"
-
-
-// determine if a string represents a soap type, as used in
-// element names
-static inline int is_soap_type(const char* soap_type) {
- return(strstr(soap_type, "SOAP-ENC:") || strstr(soap_type, "xsd:")) ? 1 : 0;
-}
-
-/* utility func to generate a new attribute. possibly should be in xml_element.c?? */
-static xml_element_attr* new_attr(const char* key, const char* val) {
- xml_element_attr* attr = malloc(sizeof(xml_element_attr));
- if (attr) {
- attr->key = key ? strdup(key) : NULL;
- attr->val = val ? strdup(val) : NULL;
- }
- return attr;
-}
-
-struct array_info {
- char kids_type[30];
- unsigned long size;
- /* ... ? */
-};
-
-
-/* parses soap arrayType attribute to generate an array_info structure.
- * TODO: should deal with sparse, flattened, & multi-dimensional arrays
- */
-static struct array_info* parse_array_type_info(const char* array_type) {
- struct array_info* ai = NULL;
- if (array_type) {
- ai = (struct array_info*)calloc(1, sizeof(struct array_info));
- if (ai) {
- char buf[128], *p;
- snprintf(buf, sizeof(buf), "%s", array_type);
- p = strchr(buf, '[');
- if (p) {
- *p = 0;
- }
- strcpy(ai->kids_type, buf);
- }
- }
- return ai;
-}
-
-/* performs heuristics on an xmlrpc_vector_array to determine
- * appropriate soap arrayType string.
- */
-static const char* get_array_soap_type(XMLRPC_VALUE node) {
- XMLRPC_VALUE_TYPE_EASY type = xmlrpc_type_none;
-
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(node);
- int loopCount = 0;
- const char* soapType = TOKEN_ANY;
-
- type = XMLRPC_GetValueTypeEasy(xIter);
- xIter = XMLRPC_VectorNext(node);
-
- while (xIter) {
- /* 50 seems like a decent # of loops. That will likely
- * cover most cases. Any more and we start to sacrifice
- * performance.
- */
- if ( (XMLRPC_GetValueTypeEasy(xIter) != type) || loopCount >= 50) {
- type = xmlrpc_type_none;
- break;
- }
- loopCount ++;
-
- xIter = XMLRPC_VectorNext(node);
- }
- switch (type) {
- case xmlrpc_type_none:
- soapType = TOKEN_ANY;
- break;
- case xmlrpc_type_empty:
- soapType = TOKEN_NULL;
- break;
- case xmlrpc_type_int:
- soapType = TOKEN_INT;
- break;
- case xmlrpc_type_double:
- soapType = TOKEN_DOUBLE;
- break;
- case xmlrpc_type_boolean:
- soapType = TOKEN_BOOLEAN;
- break;
- case xmlrpc_type_string:
- soapType = TOKEN_STRING;
- break;
- case xmlrpc_type_base64:
- soapType = TOKEN_BASE64;
- break;
- case xmlrpc_type_datetime:
- soapType = TOKEN_DATETIME;
- break;
- case xmlrpc_type_struct:
- soapType = TOKEN_STRUCT;
- break;
- case xmlrpc_type_array:
- soapType = TOKEN_ARRAY;
- break;
- case xmlrpc_type_mixed:
- soapType = TOKEN_STRUCT;
- break;
- }
- return soapType;
-}
-
-/* determines wether a node is a fault or not, and of which type:
- * 0 = not a fault,
- * 1 = xmlrpc style fault
- * 2 = soap style fault.
- */
-static inline int get_fault_type(XMLRPC_VALUE node) {
- if (XMLRPC_VectorGetValueWithID(node, TOKEN_XMLRPC_FAULTCODE) &&
- XMLRPC_VectorGetValueWithID(node, TOKEN_XMLRPC_FAULTSTRING)) {
- return 1;
- }
- else if (XMLRPC_VectorGetValueWithID(node, TOKEN_SOAP_FAULTCODE) &&
- XMLRPC_VectorGetValueWithID(node, TOKEN_SOAP_FAULTSTRING)) {
- return 2;
- }
- return 0;
-}
-
-/* input: an XMLRPC_VALUE representing a fault struct in xml-rpc style.
- * output: an XMLRPC_VALUE representing a fault struct in soap style,
- * with xmlrpc codes mapped to soap codes, and all other values preserved.
- * note that the returned value is a completely new value, and must be freed.
- * the input value is untouched.
- */
-static XMLRPC_VALUE gen_fault_xmlrpc(XMLRPC_VALUE node, xml_element* el_target) {
- XMLRPC_VALUE xDup = XMLRPC_DupValueNew(node);
- XMLRPC_VALUE xCode = XMLRPC_VectorGetValueWithID(xDup, TOKEN_XMLRPC_FAULTCODE);
- XMLRPC_VALUE xStr = XMLRPC_VectorGetValueWithID(xDup, TOKEN_XMLRPC_FAULTSTRING);
-
- XMLRPC_SetValueID(xCode, TOKEN_SOAP_FAULTCODE, 0);
- XMLRPC_SetValueID(xStr, TOKEN_SOAP_FAULTSTRING, 0);
-
- /* rough mapping of xmlrpc fault codes to soap codes */
- switch (XMLRPC_GetValueInt(xCode)) {
- case -32700: // "parse error. not well formed",
- case -32701: // "parse error. unsupported encoding"
- case -32702: // "parse error. invalid character for encoding"
- case -32600: // "server error. invalid xml-rpc. not conforming to spec."
- case -32601: // "server error. requested method not found"
- case -32602: // "server error. invalid method parameters"
- XMLRPC_SetValueString(xCode, "SOAP-ENV:Client", 0);
- break;
- case -32603: // "server error. internal xml-rpc error"
- case -32500: // "application error"
- case -32400: // "system error"
- case -32300: // "transport error
- XMLRPC_SetValueString(xCode, "SOAP-ENV:Server", 0);
- break;
- }
- return xDup;
-}
-
-// returns a new XMLRPC_VALUE representing a soap fault, comprised of a struct with four keys.
-static XMLRPC_VALUE gen_soap_fault(const char* fault_code, const char* fault_string,
- const char* actor, const char* details) {
- XMLRPC_VALUE xReturn = XMLRPC_CreateVector(TOKEN_FAULT, xmlrpc_vector_struct);
- XMLRPC_AddValuesToVector(xReturn,
- XMLRPC_CreateValueString(TOKEN_SOAP_FAULTCODE, fault_code, 0),
- XMLRPC_CreateValueString(TOKEN_SOAP_FAULTSTRING, fault_string, 0),
- XMLRPC_CreateValueString(TOKEN_SOAP_FAULTACTOR, actor, 0),
- XMLRPC_CreateValueString(TOKEN_SOAP_FAULTDETAILS, details, 0),
- NULL);
- return xReturn;
-}
-
-/* translates xml soap dom to native data structures. recursive. */
-XMLRPC_VALUE xml_element_to_SOAP_REQUEST_worker(XMLRPC_REQUEST request,
- XMLRPC_VALUE xParent,
- struct array_info* parent_array,
- XMLRPC_VALUE xCurrent,
- xml_element* el,
- int depth) {
- XMLRPC_REQUEST_TYPE rtype = xmlrpc_request_none;
-
- // no current element on first call
- if (!xCurrent) {
- xCurrent = XMLRPC_CreateValueEmpty();
- }
-
- // increment recursion depth guage
- depth ++;
-
- // safety first. must have a valid element
- if (el && el->name) {
- const char* id = NULL;
- const char* type = NULL, *arrayType=NULL, *actor = NULL;
- xml_element_attr* attr_iter = Q_Head(&el->attrs);
- int b_must_understand = 0;
-
- // in soap, types may be specified in either element name -or- with xsi:type attribute.
- if (is_soap_type(el->name)) {
- type = el->name;
- }
- // if our parent node, by definition a vector, is not an array, then
- // our element name must be our key identifier.
- else if (XMLRPC_GetVectorType(xParent) != xmlrpc_vector_array) {
- id = el->name;
- if(!strcmp(id, "item")) {
- }
- }
-
- // iterate through element attributes, pick out useful stuff.
- while (attr_iter) {
- // element's type
- if (!strcmp(attr_iter->key, TOKEN_TYPE)) {
- type = attr_iter->val;
- }
- // array type
- else if (!strcmp(attr_iter->key, TOKEN_ARRAY_TYPE)) {
- arrayType = attr_iter->val;
- }
- // must understand, sometimes present in headers.
- else if (!strcmp(attr_iter->key, TOKEN_MUSTUNDERSTAND)) {
- b_must_understand = strchr(attr_iter->val, '1') ? 1 : 0;
- }
- // actor, used in conjuction with must understand.
- else if (!strcmp(attr_iter->key, TOKEN_ACTOR)) {
- actor = attr_iter->val;
- }
- attr_iter = Q_Next(&el->attrs);
- }
-
- // check if caller says we must understand something in a header.
- if (b_must_understand) {
- // is must understand actually indended for us?
- // BUG: spec says we should also determine if actor is our URL, but
- // we do not have that information.
- if (!actor || !strcmp(actor, TOKEN_ACTOR_NEXT)) {
- // TODO: implement callbacks or other mechanism for applications
- // to "understand" these headers. For now, we just bail if we
- // get a mustUnderstand header intended for us.
- XMLRPC_RequestSetError(request,
- gen_soap_fault("SOAP-ENV:MustUnderstand",
- "SOAP Must Understand Error",
- "", ""));
- return xCurrent;
- }
- }
-
- // set id (key) if one was found.
- if (id) {
- XMLRPC_SetValueID_Case(xCurrent, id, 0, xmlrpc_case_exact);
- }
-
- // according to soap spec,
- // depth 1 = Envelope, 2 = Header, Body & Fault, 3 = methodcall or response.
- if (depth == 3) {
- const char* methodname = el->name;
- char* p = NULL;
-
- // BUG: we determine request or response type using presence of "Response" in element name.
- // According to spec, this is only recommended, not required. Apparently, implementations
- // are supposed to know the type of action based on state, which strikes me as a bit lame.
- // Anyway, we don't have that state info, thus we use Response as a heuristic.
- rtype =
-#ifdef strcasestr
- strcasestr(el->name, "response") ? xmlrpc_request_response : xmlrpc_request_call;
-#else
- strstr(el->name, "esponse") ? xmlrpc_request_response : xmlrpc_request_call;
-#endif
- XMLRPC_RequestSetRequestType(request, rtype);
-
- // Get methodname. strip xml namespace crap.
- p = strchr(el->name, ':');
- if (p) {
- methodname = p + 1;
- }
- if (rtype == xmlrpc_request_call) {
- XMLRPC_RequestSetMethodName(request, methodname);
- }
- }
-
-
- // Next, we begin to convert actual values.
- // if no children, then must be a scalar value.
- if (!Q_Size(&el->children)) {
- if (!type && parent_array && parent_array->kids_type[0]) {
- type = parent_array->kids_type;
- }
- if (!type || !strcmp(type, TOKEN_STRING)) {
- XMLRPC_SetValueString(xCurrent, el->text.str, el->text.len);
- }
- else if (!strcmp(type, TOKEN_INT)) {
- XMLRPC_SetValueInt(xCurrent, atoi(el->text.str));
- }
- else if (!strcmp(type, TOKEN_BOOLEAN)) {
- XMLRPC_SetValueBoolean(xCurrent, atoi(el->text.str));
- }
- else if (!strcmp(type, TOKEN_DOUBLE) ||
- !strcmp(type, TOKEN_FLOAT)) {
- XMLRPC_SetValueDouble(xCurrent, atof(el->text.str));
- }
- else if (!strcmp(type, TOKEN_NULL)) {
- // already an empty val. do nothing.
- }
- else if (!strcmp(type, TOKEN_DATETIME)) {
- XMLRPC_SetValueDateTime_ISO8601(xCurrent, el->text.str);
- }
- else if (!strcmp(type, TOKEN_BASE64)) {
- struct buffer_st buf;
- base64_decode(&buf, el->text.str, el->text.len);
- XMLRPC_SetValueBase64(xCurrent, buf.data, buf.offset);
- buffer_delete(&buf);
- }
- }
- // Element has children, thus a vector, or "compound type" in soap-speak.
- else {
- struct array_info* ai = NULL;
- xml_element* iter = (xml_element*)Q_Head(&el->children);
-
- if (!type || !strcmp(type, TOKEN_STRUCT)) {
- XMLRPC_SetIsVector(xCurrent, xmlrpc_vector_struct);
- }
- else if (!strcmp(type, TOKEN_ARRAY) || arrayType != NULL) {
- // determine magic associated with soap array type.
- // this is passed down as we recurse, so our children have access to the info.
- ai = parse_array_type_info(arrayType); // alloc'ed ai free'd below.
- XMLRPC_SetIsVector(xCurrent, xmlrpc_vector_array);
- }
- else {
- // mixed is probably closest thing we have to compound type.
- XMLRPC_SetIsVector(xCurrent, xmlrpc_vector_mixed);
- }
- // Recurse, adding values as we go. Check for error during recursion
- // and if found, bail. this short-circuits us out of the recursion.
- while ( iter && !XMLRPC_RequestGetError(request) ) {
- XMLRPC_VALUE xNext = NULL;
- // top level elements don't actually represent values, so we just pass the
- // current value along until we are deep enough.
- if ( depth <= 2 ||
- (rtype == xmlrpc_request_response && depth <= 3) ) {
- xml_element_to_SOAP_REQUEST_worker(request, NULL, ai, xCurrent, iter, depth);
- }
- // ready to do some actual de-serialization. create a new empty value and
- // pass that along to be init'd, then add it to our current vector.
- else {
- xNext = XMLRPC_CreateValueEmpty();
- xml_element_to_SOAP_REQUEST_worker(request, xCurrent, ai, xNext, iter, depth);
- XMLRPC_AddValueToVector(xCurrent, xNext);
- }
- iter = (xml_element*)Q_Next(&el->children);
- }
- // cleanup
- if (ai) {
- free(ai);
- }
- }
- }
- return xCurrent;
-}
-
-// Convert soap xml dom to XMLRPC_VALUE, sans request info. untested.
-XMLRPC_VALUE xml_element_to_SOAP_VALUE(xml_element* el)
-{
- return xml_element_to_SOAP_REQUEST_worker(NULL, NULL, NULL, NULL, el, 0);
-}
-
-// Convert soap xml dom to XMLRPC_REQUEST
-XMLRPC_VALUE xml_element_to_SOAP_REQUEST(XMLRPC_REQUEST request, xml_element* el)
-{
- if (request) {
- return XMLRPC_RequestSetData(request, xml_element_to_SOAP_REQUEST_worker(request, NULL, NULL, NULL, el, 0));
- }
- return NULL;
-}
-
-
-/* translates data structures to soap/xml. recursive */
-xml_element* SOAP_to_xml_element_worker(XMLRPC_REQUEST request, XMLRPC_VALUE node) {
-#define BUF_SIZE 128
- xml_element* elem_val = NULL;
- if (node) {
- int bFreeNode = 0; /* sometimes we may need to free 'node' variable */
- char buf[BUF_SIZE];
- XMLRPC_VALUE_TYPE_EASY type = XMLRPC_GetValueTypeEasy(node);
- char* pName = NULL, *pAttrType = NULL;
-
- // create our return value element
- elem_val = xml_elem_new();
-
- switch (type) {
- case xmlrpc_type_struct:
- case xmlrpc_type_mixed:
- case xmlrpc_type_array:
- if (type == xmlrpc_type_array) {
- // array's are _very_ special in soap.
- // TODO: Should handle sparse/partial arrays here.
-
- // determine soap array type.
- const char* type = get_array_soap_type(node);
- xml_element_attr* attr_array_type = NULL;
-
- // specify array kids type and array size.
- snprintf(buf, sizeof(buf), "%s[%i]", type, XMLRPC_VectorSize(node));
- attr_array_type = new_attr(TOKEN_ARRAY_TYPE, buf);
-
- Q_PushTail(&elem_val->attrs, attr_array_type);
-
- pAttrType = TOKEN_ARRAY;
- }
- // check for fault, which is a rather special case.
- // (can't these people design anything consistent/simple/elegant?)
- else if (type == xmlrpc_type_struct) {
- int fault_type = get_fault_type(node);
- if (fault_type) {
- if (fault_type == 1) {
- // gen fault from xmlrpc style fault codes
- // notice that we get a new node, which must be freed herein.
- node = gen_fault_xmlrpc(node, elem_val);
- bFreeNode = 1;
- }
- pName = TOKEN_FAULT;
- }
- }
-
- {
- /* recurse through sub-elements */
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(node);
- while ( xIter ) {
- xml_element* next_el = SOAP_to_xml_element_worker(request, xIter);
- if (next_el) {
- Q_PushTail(&elem_val->children, next_el);
- }
- xIter = XMLRPC_VectorNext(node);
- }
- }
-
- break;
-
- // handle scalar types
- case xmlrpc_type_empty:
- pAttrType = TOKEN_NULL;
- break;
- case xmlrpc_type_string:
- pAttrType = TOKEN_STRING;
- simplestring_addn(&elem_val->text, XMLRPC_GetValueString(node), XMLRPC_GetValueStringLen(node));
- break;
- case xmlrpc_type_int:
- pAttrType = TOKEN_INT;
- snprintf(buf, BUF_SIZE, "%i", XMLRPC_GetValueInt(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_type_boolean:
- pAttrType = TOKEN_BOOLEAN;
- snprintf(buf, BUF_SIZE, "%i", XMLRPC_GetValueBoolean(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_type_double:
- pAttrType = TOKEN_DOUBLE;
- snprintf(buf, BUF_SIZE, "%f", XMLRPC_GetValueDouble(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_type_datetime:
- {
- time_t tt = XMLRPC_GetValueDateTime(node);
- struct tm *tm = localtime (&tt);
- pAttrType = TOKEN_DATETIME;
- if(strftime (buf, BUF_SIZE, "%Y-%m-%dT%H:%M:%SZ", tm)) {
- simplestring_add(&elem_val->text, buf);
- }
- }
- break;
- case xmlrpc_type_base64:
- {
- struct buffer_st buf;
- pAttrType = TOKEN_BASE64;
- base64_encode(&buf, XMLRPC_GetValueBase64(node), XMLRPC_GetValueStringLen(node));
- simplestring_addn(&elem_val->text, buf.data, buf.offset );
- buffer_delete(&buf);
- }
- break;
- break;
- default:
- break;
- }
-
- // determining element's name is a bit tricky, due to soap semantics.
- if (!pName) {
- // if the value's type is known...
- if (pAttrType) {
- // see if it has an id (key). If so, use that as name,
- // and type as an attribute.
- pName = (char*)XMLRPC_GetValueID(node);
- if (pName) {
- Q_PushTail(&elem_val->attrs, new_attr(TOKEN_TYPE, pAttrType));
- }
-
- // otherwise, use the type as the name.
- else {
- pName = pAttrType;
- }
- }
- // if the value's type is not known... (a rare case?)
- else {
- // see if it has an id (key). otherwise, default to generic "item"
- pName = (char*)XMLRPC_GetValueID(node);
- if (!pName) {
- pName = "item";
- }
- }
- }
- elem_val->name = strdup(pName);
-
- // cleanup
- if (bFreeNode) {
- XMLRPC_CleanupValue(node);
- }
- }
- return elem_val;
-}
-
-// convert XMLRPC_VALUE to soap xml dom. untested.
-xml_element* SOAP_VALUE_to_xml_element(XMLRPC_VALUE node) {
- return SOAP_to_xml_element_worker(NULL, node);
-}
-
-// convert XMLRPC_REQUEST to soap xml dom.
-xml_element* SOAP_REQUEST_to_xml_element(XMLRPC_REQUEST request) {
- xml_element* root = xml_elem_new();
-
- // safety first.
- if (root) {
- xml_element* body = xml_elem_new();
- root->name = strdup("SOAP-ENV:Envelope");
-
- /* silly namespace stuff */
- Q_PushTail(&root->attrs, new_attr("xmlns:SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"));
- Q_PushTail(&root->attrs, new_attr("xmlns:xsi", "http://www.w3.org/1999/XMLSchema-instance"));
- Q_PushTail(&root->attrs, new_attr("xmlns:xsd", "http://www.w3.org/1999/XMLSchema"));
- Q_PushTail(&root->attrs, new_attr("xmlns:SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/"));
- Q_PushTail(&root->attrs, new_attr("xmlns:si", "http://soapinterop.org/xsd"));
- Q_PushTail(&root->attrs, new_attr("xmlns:ns6", "http://testuri.org"));
- Q_PushTail(&root->attrs, new_attr("SOAP-ENV:encodingStyle", "http://schemas.xmlsoap.org/soap/encoding/"));
-
- //Q_PushHead(&root->attrs, new_attr("xmlns:ks", "http://kitchen.sink.org/soap/everything/under/sun"));
- // JUST KIDDING!! :-) ----> -------------------------------------------------
-
- if (body) {
- // go ahead and serialize first...
- xml_element* el_serialized =
- SOAP_to_xml_element_worker(request,
- XMLRPC_RequestGetData(request));
-
- /* check for fault, in which case, there is no intermediate element */
- if (el_serialized && !strcmp(el_serialized->name, TOKEN_FAULT)) {
- Q_PushTail(&body->children, el_serialized);
- }
- // usual case: not a fault. Add Response element in between.
- else {
- xml_element* rpc = xml_elem_new();
-
- if (rpc) {
- const char* methodname = XMLRPC_RequestGetMethodName(request);
- XMLRPC_REQUEST_TYPE rtype = XMLRPC_RequestGetRequestType(request);
-
- // if we are making a request, we want to use the methodname as is.
- if (rtype == xmlrpc_request_call) {
- if (methodname) {
- rpc->name = strdup(methodname);
- }
- }
- // if it's a response, we append "Response". Also, given xmlrpc-epi
- // API/architecture, it's likely that we don't have a methodname for
- // the response, so we have to check that.
- else {
- char buf[128];
- snprintf(buf, sizeof(buf), "%s%s",
- methodname ? methodname : "",
- "Response");
-
- rpc->name = strdup(buf);
- }
-
- // add serialized data to method call/response.
- // add method call/response to body element
- if (rpc->name) {
- if(el_serialized) {
- if(Q_Size(&el_serialized->children) && rtype == xmlrpc_request_call) {
- xml_element* iter = (xml_element*)Q_Head(&el_serialized->children);
- while(iter) {
- Q_PushTail(&rpc->children, iter);
- iter = (xml_element*)Q_Next(&el_serialized->children);
- }
- xml_elem_free_non_recurse(el_serialized);
- }
- else {
- Q_PushTail(&rpc->children, el_serialized);
- }
- }
-
- Q_PushTail(&body->children, rpc);
- }
- else {
- // no method name?!
- // TODO: fault here...?
- }
- }
- }
- body->name = strdup("SOAP-ENV:Body");
- Q_PushTail(&root->children, body);
- }
- }
-
- return root;
-}
-
diff --git a/ext/xmlrpc/libxmlrpc/xml_to_soap.h b/ext/xmlrpc/libxmlrpc/xml_to_soap.h
deleted file mode 100644
index 9ae9308b22..0000000000
--- a/ext/xmlrpc/libxmlrpc/xml_to_soap.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-#ifndef XML_TO_SOAP_H
- #define XML_TO_SOAP_H
-
-#include "xmlrpc.h"
-
-XMLRPC_VALUE xml_element_to_SOAP_VALUE(xml_element* el);
-XMLRPC_VALUE xml_element_to_SOAP_REQUEST(XMLRPC_REQUEST request, xml_element* el);
-xml_element* SOAP_VALUE_to_xml_element(XMLRPC_VALUE node);
-xml_element* SOAP_REQUEST_to_xml_element(XMLRPC_REQUEST request);
-
-#endif /* XML_TO_XMLRPC_H */
diff --git a/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c b/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c
deleted file mode 100644
index c45d3ec3db..0000000000
--- a/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-static const char rcsid[] = "#(@) $Id$";
-
-#ifdef _WIN32
-#include "xmlrpc_win32.h"
-#endif
-#include <string.h>
-#include <stdlib.h>
-#include "xml_to_xmlrpc.h"
-#include "base64.h"
-
-/* list of tokens used in vocab */
-#define ELEM_ARRAY "array"
-#define ELEM_BASE64 "base64"
-#define ELEM_BOOLEAN "boolean"
-#define ELEM_DATA "data"
-#define ELEM_DATETIME "dateTime.iso8601"
-#define ELEM_DOUBLE "double"
-#define ELEM_FAULT "fault"
-#define ELEM_FAULTCODE "faultCode"
-#define ELEM_FAULTSTRING "faultString"
-#define ELEM_I4 "i4"
-#define ELEM_INT "int"
-#define ELEM_MEMBER "member"
-#define ELEM_METHODCALL "methodCall"
-#define ELEM_METHODNAME "methodName"
-#define ELEM_METHODRESPONSE "methodResponse"
-#define ELEM_NAME "name"
-#define ELEM_PARAM "param"
-#define ELEM_PARAMS "params"
-#define ELEM_STRING "string"
-#define ELEM_STRUCT "struct"
-#define ELEM_VALUE "value"
-
-
-XMLRPC_VALUE xml_element_to_XMLRPC_REQUEST_worker(XMLRPC_REQUEST request, XMLRPC_VALUE parent_vector, XMLRPC_VALUE current_val, xml_element* el) {
- if (!current_val) {
- /* This should only be the case for the first element */
- current_val = XMLRPC_CreateValueEmpty();
- }
-
- if (el->name) {
-
- /* first, deal with the crazy/stupid fault format */
- if (!strcmp(el->name, ELEM_FAULT)) {
- xml_element* fault_value = (xml_element*)Q_Head(&el->children);
- XMLRPC_SetIsVector(current_val, xmlrpc_vector_struct);
-
- if(fault_value) {
- xml_element* fault_struct = (xml_element*)Q_Head(&fault_value->children);
- if(fault_struct) {
- xml_element* iter = (xml_element*)Q_Head(&fault_struct->children);
-
- while (iter) {
- XMLRPC_VALUE xNextVal = XMLRPC_CreateValueEmpty();
- xml_element_to_XMLRPC_REQUEST_worker(request, current_val, xNextVal, iter);
- XMLRPC_AddValueToVector(current_val, xNextVal);
- iter = (xml_element*)Q_Next(&fault_struct->children);
- }
- }
- }
- }
- else if (!strcmp(el->name, ELEM_DATA) /* should be ELEM_ARRAY, but there is an extra level. weird */
- || (!strcmp(el->name, ELEM_PARAMS) &&
- (XMLRPC_RequestGetRequestType(request) == xmlrpc_request_call)) ) { /* this "PARAMS" concept is silly. dave?! */
- xml_element* iter = (xml_element*)Q_Head(&el->children);
- XMLRPC_SetIsVector(current_val, xmlrpc_vector_array);
-
- while (iter) {
- XMLRPC_VALUE xNextVal = XMLRPC_CreateValueEmpty();
- xml_element_to_XMLRPC_REQUEST_worker(request, current_val, xNextVal, iter);
- XMLRPC_AddValueToVector(current_val, xNextVal);
- iter = (xml_element*)Q_Next(&el->children);
- }
- }
- else if (!strcmp(el->name, ELEM_STRUCT)) {
- xml_element* iter = (xml_element*)Q_Head(&el->children);
- XMLRPC_SetIsVector(current_val, xmlrpc_vector_struct);
-
- while ( iter ) {
- XMLRPC_VALUE xNextVal = XMLRPC_CreateValueEmpty();
- xml_element_to_XMLRPC_REQUEST_worker(request, current_val, xNextVal, iter);
- XMLRPC_AddValueToVector(current_val, xNextVal);
- iter = (xml_element*)Q_Next(&el->children);
- }
- }
- else if (!strcmp(el->name, ELEM_STRING) ||
- (!strcmp(el->name, ELEM_VALUE) && Q_Size(&el->children) == 0)) {
- XMLRPC_SetValueString(current_val, el->text.str, el->text.len);
- }
- else if (!strcmp(el->name, ELEM_NAME)) {
- XMLRPC_SetValueID_Case(current_val, el->text.str, 0, xmlrpc_case_exact);
- }
- else if (!strcmp(el->name, ELEM_INT) || !strcmp(el->name, ELEM_I4)) {
- XMLRPC_SetValueInt(current_val, atoi(el->text.str));
- }
- else if (!strcmp(el->name, ELEM_BOOLEAN)) {
- XMLRPC_SetValueBoolean(current_val, atoi(el->text.str));
- }
- else if (!strcmp(el->name, ELEM_DOUBLE)) {
- XMLRPC_SetValueDouble(current_val, atof(el->text.str));
- }
- else if (!strcmp(el->name, ELEM_DATETIME)) {
- XMLRPC_SetValueDateTime_ISO8601(current_val, el->text.str);
- }
- else if (!strcmp(el->name, ELEM_BASE64)) {
- struct buffer_st buf;
- base64_decode(&buf, el->text.str, el->text.len);
- XMLRPC_SetValueBase64(current_val, buf.data, buf.offset);
- buffer_delete(&buf);
- }
- else {
- xml_element* iter;
-
- if (!strcmp(el->name, ELEM_METHODCALL)) {
- if (request) {
- XMLRPC_RequestSetRequestType(request, xmlrpc_request_call);
- }
- }
- else if (!strcmp(el->name, ELEM_METHODRESPONSE)) {
- if (request) {
- XMLRPC_RequestSetRequestType(request, xmlrpc_request_response);
- }
- }
- else if (!strcmp(el->name, ELEM_METHODNAME)) {
- if (request) {
- XMLRPC_RequestSetMethodName(request, el->text.str);
- }
- }
-
- iter = (xml_element*)Q_Head(&el->children);
- while ( iter ) {
- xml_element_to_XMLRPC_REQUEST_worker(request, parent_vector,
- current_val, iter);
- iter = (xml_element*)Q_Next(&el->children);
- }
- }
- }
- return current_val;
-}
-
-XMLRPC_VALUE xml_element_to_XMLRPC_VALUE(xml_element* el)
-{
- return xml_element_to_XMLRPC_REQUEST_worker(NULL, NULL, NULL, el);
-}
-
-XMLRPC_VALUE xml_element_to_XMLRPC_REQUEST(XMLRPC_REQUEST request, xml_element* el)
-{
- if (request) {
- return XMLRPC_RequestSetData(request, xml_element_to_XMLRPC_REQUEST_worker(request, NULL, NULL, el));
- }
- return NULL;
-}
-
-xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VALUE node,
- XMLRPC_REQUEST_TYPE request_type, int depth) {
-#define BUF_SIZE 512
- xml_element* root = NULL;
- if (node) {
- char buf[BUF_SIZE];
- XMLRPC_VALUE_TYPE type = XMLRPC_GetValueType(node);
- XMLRPC_VECTOR_TYPE vtype = XMLRPC_GetVectorType(node);
- xml_element* elem_val = xml_elem_new();
-
- /* special case for when root element is not an array */
- if (depth == 0 &&
- !(type == xmlrpc_vector &&
- vtype == xmlrpc_vector_array &&
- request_type == xmlrpc_request_call) ) {
- int bIsFault = (vtype == xmlrpc_vector_struct && XMLRPC_VectorGetValueWithID(node, ELEM_FAULTCODE));
-
- xml_element* next_el = XMLRPC_to_xml_element_worker(NULL, node, request_type, depth + 1);
- if (next_el) {
- Q_PushTail(&elem_val->children, next_el);
- }
- elem_val->name = strdup(bIsFault ? ELEM_FAULT : ELEM_PARAMS);
- }
- else {
- switch (type) {
- case xmlrpc_empty: // treat null value as empty string in xmlrpc.
- case xmlrpc_string:
- elem_val->name = strdup(ELEM_STRING);
- simplestring_addn(&elem_val->text, XMLRPC_GetValueString(node), XMLRPC_GetValueStringLen(node));
- break;
- case xmlrpc_int:
- elem_val->name = strdup(ELEM_INT);
- snprintf(buf, BUF_SIZE, "%i", XMLRPC_GetValueInt(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_boolean:
- elem_val->name = strdup(ELEM_BOOLEAN);
- snprintf(buf, BUF_SIZE, "%i", XMLRPC_GetValueBoolean(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_double:
- elem_val->name = strdup(ELEM_DOUBLE);
- snprintf(buf, BUF_SIZE, "%f", XMLRPC_GetValueDouble(node));
- simplestring_add(&elem_val->text, buf);
- break;
- case xmlrpc_datetime:
- elem_val->name = strdup(ELEM_DATETIME);
- simplestring_add(&elem_val->text, XMLRPC_GetValueDateTime_ISO8601(node));
- break;
- case xmlrpc_base64:
- {
- struct buffer_st buf;
- elem_val->name = strdup(ELEM_BASE64);
- base64_encode(&buf, XMLRPC_GetValueBase64(node), XMLRPC_GetValueStringLen(node));
- simplestring_addn(&elem_val->text, buf.data, buf.offset );
- buffer_delete(&buf);
- }
- break;
- case xmlrpc_vector:
- {
- XMLRPC_VECTOR_TYPE my_type = XMLRPC_GetVectorType(node);
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(node);
- xml_element* root_vector_elem = elem_val;
-
- switch (my_type) {
- case xmlrpc_vector_array:
- {
- if(depth == 0) {
- elem_val->name = strdup(ELEM_PARAMS);
- }
- else {
- /* Hi my name is Dave and I like to make things as confusing
- * as possible, thus I will throw in this 'data' element
- * where it absolutely does not belong just so that people
- * cannot code arrays and structs in a similar and straight
- * forward manner. Have a good day.
- *
- * GRRRRRRRRR!
- */
- xml_element* data = xml_elem_new();
- data->name = strdup(ELEM_DATA);
-
- elem_val->name = strdup(ELEM_ARRAY);
- Q_PushTail(&elem_val->children, data);
- root_vector_elem = data;
- }
- }
- break;
- case xmlrpc_vector_mixed: /* not officially supported */
- case xmlrpc_vector_struct:
- elem_val->name = strdup(ELEM_STRUCT);
- break;
- default:
- break;
- }
-
- /* recurse through sub-elements */
- while ( xIter ) {
- xml_element* next_el = XMLRPC_to_xml_element_worker(node, xIter, request_type, depth + 1);
- if (next_el) {
- Q_PushTail(&root_vector_elem->children, next_el);
- }
- xIter = XMLRPC_VectorNext(node);
- }
- }
- break;
- default:
- break;
- }
- }
-
- {
- XMLRPC_VECTOR_TYPE vtype = XMLRPC_GetVectorType(current_vector);
-
- if (depth == 1) {
- xml_element* value = xml_elem_new();
- value->name = strdup(ELEM_VALUE);
-
- /* yet another hack for the "fault" crap */
- if (XMLRPC_VectorGetValueWithID(node, ELEM_FAULTCODE)) {
- root = value;
- }
- else {
- xml_element* param = xml_elem_new();
- param->name = strdup(ELEM_PARAM);
-
- Q_PushTail(&param->children, value);
-
- root = param;
- }
- Q_PushTail(&value->children, elem_val);
- }
- else if (vtype == xmlrpc_vector_struct || vtype == xmlrpc_vector_mixed) {
- xml_element* member = xml_elem_new();
- xml_element* name = xml_elem_new();
- xml_element* value = xml_elem_new();
-
- member->name = strdup(ELEM_MEMBER);
- name->name = strdup(ELEM_NAME);
- value->name = strdup(ELEM_VALUE);
-
- simplestring_add(&name->text, XMLRPC_GetValueID(node));
-
- Q_PushTail(&member->children, name);
- Q_PushTail(&member->children, value);
- Q_PushTail(&value->children, elem_val);
-
- root = member;
- }
- else if (vtype == xmlrpc_vector_array) {
- xml_element* value = xml_elem_new();
-
- value->name = strdup(ELEM_VALUE);
-
- Q_PushTail(&value->children, elem_val);
-
- root = value;
- }
- else if (vtype == xmlrpc_vector_none) {
- /* no parent. non-op */
- root = elem_val;
- }
- else {
- xml_element* value = xml_elem_new();
-
- value->name = strdup(ELEM_VALUE);
-
- Q_PushTail(&value->children, elem_val);
-
- root = value;
- }
- }
- }
- return root;
-}
-
-xml_element* XMLRPC_VALUE_to_xml_element(XMLRPC_VALUE node) {
- return XMLRPC_to_xml_element_worker(NULL, node, xmlrpc_request_none, 0);
-}
-
-xml_element* XMLRPC_REQUEST_to_xml_element(XMLRPC_REQUEST request) {
- xml_element* wrapper = NULL;
- if (request) {
- const char* pStr = NULL;
- XMLRPC_REQUEST_TYPE request_type = XMLRPC_RequestGetRequestType(request);
- XMLRPC_VALUE xParams = XMLRPC_RequestGetData(request);
-
- wrapper = xml_elem_new();
-
- if (request_type == xmlrpc_request_call) {
- pStr = ELEM_METHODCALL;
- }
- else if (request_type == xmlrpc_request_response) {
- pStr = ELEM_METHODRESPONSE;
- }
- if (pStr) {
- wrapper->name = strdup(pStr);
- }
-
- if(request_type == xmlrpc_request_call) {
- pStr = XMLRPC_RequestGetMethodName(request);
-
- if (pStr) {
- xml_element* method = xml_elem_new();
- method->name = strdup(ELEM_METHODNAME);
- simplestring_add(&method->text, pStr);
- Q_PushTail(&wrapper->children, method);
- }
- }
- if (xParams) {
- Q_PushTail(&wrapper->children,
- XMLRPC_to_xml_element_worker(NULL, XMLRPC_RequestGetData(request), XMLRPC_RequestGetRequestType(request), 0));
- }
- else {
- /* Despite the spec, the xml-rpc list folk want me to send an empty params element */
- xml_element* params = xml_elem_new();
- params->name = strdup(ELEM_PARAMS);
- Q_PushTail(&wrapper->children, params);
- }
- }
- return wrapper;
-}
-
diff --git a/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.h b/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.h
deleted file mode 100644
index 234a153460..0000000000
--- a/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-#ifndef XML_TO_XMLRPC_H
- #define XML_TO_XMLRPC_H
-
-#include "time.h"
-#include "xmlrpc.h"
-
-XMLRPC_VALUE xml_element_to_XMLRPC_VALUE(xml_element* el);
-XMLRPC_VALUE xml_element_to_XMLRPC_REQUEST(XMLRPC_REQUEST request, xml_element* el);
-xml_element* XMLRPC_VALUE_to_xml_element(XMLRPC_VALUE node);
-xml_element* XMLRPC_REQUEST_to_xml_element(XMLRPC_REQUEST request);
-
-#endif /* XML_TO_XMLRPC_H */
diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc.c b/ext/xmlrpc/libxmlrpc/xmlrpc.c
deleted file mode 100644
index 3eca7065a8..0000000000
--- a/ext/xmlrpc/libxmlrpc/xmlrpc.c
+++ /dev/null
@@ -1,2956 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-static const char rcsid[] = "#(@) $Id$";
-
-
-/****h* ABOUT/xmlrpc
- * NAME
- * XMLRPC_VALUE
- * AUTHOR
- * Dan Libby, aka danda (dan@libby.com)
- * CREATION DATE
- * 9/1999 - 10/2000
- * HISTORY
- * $Log$
- * Revision 1.22 2002/03/09 23:15:44 danda
- * add fault interrogation funcs
- *
- * Revision 1.21 2002/03/09 22:27:41 danda
- * win32 build patches contributed by Jeff Lawson
- *
- * Revision 1.20 2002/02/13 20:58:50 danda
- * patch to make source more windows friendly, contributed by Jeff Lawson
- *
- * Revision 1.19 2001/10/12 23:25:54 danda
- * default to writing xmlrpc
- *
- * Revision 1.18 2001/09/29 21:58:05 danda
- * adding cvs log to history section
- *
- * 10/15/2000 -- danda -- adding robodoc documentation
- * 08/2000 -- danda -- PHP C extension that uses XMLRPC
- * 08/2000 -- danda -- support for two vocabularies: danda-rpc and xml-rpc
- * 09/1999 -- danda -- Initial API, before I even knew of standard XMLRPC vocab. Response only.
- * 07/2000 -- danda -- wrote new implementation to be compatible with xmlrpc standard and
- * incorporated some ideas from ensor, most notably the separation of
- * xml dom from xmlrpc api.
- * 06/2000 -- danda -- played with expat-ensor from www.ensor.org. Cool, but some flaws.
- * TODO
- * PORTABILITY
- * Coded on RedHat Linux 6.2. Builds on Solaris x86. Should build on just
- * about anything with minor mods.
- * NOTES
- * Welcome to XMLRPC. For more info on the specification and history, see
- * http://www.xmlrpc.org.
- *
- * This code aims to be a full-featured C implementation of XMLRPC. It does not
- * have any networking code. Rather, it is intended to be plugged into apps
- * or libraries with existing networking facilities, eg PHP, apache, perl, mozilla,
- * home-brew application servers, etc.
- *
- * Usage Paradigm:
- * The user of this library will typically be implementing either an XMLRPC server,
- * an XMLRPC client, or both. The client will use the library to build an in-memory
- * representation of a request, and then serialize (encode) that request into XML. The
- * client will then send the XML to the server via external mechanism. The server will
- * de-serialize the XML back into an binary representation, call the appropriate registered
- * method -- thereby generating a response. The response will be serialized into XML and
- * sent back to the client. The client will de-serialize it into memory, and can
- * iterate through the results via API.
- *
- * Both the request and the response may consist of arbitrarily long, arbitrarily nested
- * values. The values may be one of several types, as defined by XMLRPC_VALUE_TYPE.
- *
- * Features and Architecture:
- * - The XML parsing (xml_element.c) is completely independent of the XMLRPC api. In fact,
- * it can be used as a standalone dom implementation.
- * - Because of this, the same XMLRPC data can be serialized into multiple xml vocabularies.
- * It is simply a matter of writing a transport. So far, two transports have been defined.
- * The default xmlrpc vocab (xml_to_xmlrpc.c), and simple-rpc (xml_to_dandarpc.c) which is
- * proprietary, but imho more readable, and nice for proprietary legacy reasons.
- * - Various output options, including: xml escaping via CDATA or entity, case folding,
- * vocab version, and character encoding.
- * - One to One mapping between C structures and actual values, unlike ensor which forces
- * one to understand the arcana of the xmlrpc vocab.
- * - support for mixed indexed/keyed vector types, making it more compatible with
- * languages such as PHP.
- * - quite speedy compared to implementations written in interpreted languages. Also, uses
- * intelligent string handling, so not many strlen() calls, etc.
- * - comprehensive API for manipulation of values
- *******/
-
-
-#ifdef _WIN32
-#include "xmlrpc_win32.h"
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <time.h>
-
-#include "queue.h"
-#include "xmlrpc.h"
-#include "expat.h"
-#include "base64.h"
-
-#include "xml_to_xmlrpc.h"
-#include "xml_to_dandarpc.h"
-#include "xml_to_soap.h"
-#include "xml_element.h"
-#include "xmlrpc_private.h"
-#include "xmlrpc_introspection_private.h"
-#include "system_methods_private.h"
-
-
-
-/*-*********************
-* Begin Time Functions *
-***********************/
-
-static int date_from_ISO8601 (const char *text, time_t * value) {
- struct tm tm;
- int n;
- int i;
- char buf[18];
-
- if (strchr (text, '-')) {
- char *p = (char *) text, *p2 = buf;
- while (p && *p) {
- if (*p != '-') {
- *p2 = *p;
- p2++;
- }
- p++;
- }
- text = buf;
- }
-
-
- tm.tm_isdst = -1;
-
- if(strlen(text) < 17) {
- return -1;
- }
-
- n = 1000;
- tm.tm_year = 0;
- for(i = 0; i < 4; i++) {
- tm.tm_year += (text[i]-'0')*n;
- n /= 10;
- }
- n = 10;
- tm.tm_mon = 0;
- for(i = 0; i < 2; i++) {
- tm.tm_mon += (text[i+4]-'0')*n;
- n /= 10;
- }
- tm.tm_mon --;
-
- n = 10;
- tm.tm_mday = 0;
- for(i = 0; i < 2; i++) {
- tm.tm_mday += (text[i+6]-'0')*n;
- n /= 10;
- }
-
- n = 10;
- tm.tm_hour = 0;
- for(i = 0; i < 2; i++) {
- tm.tm_hour += (text[i+9]-'0')*n;
- n /= 10;
- }
-
- n = 10;
- tm.tm_min = 0;
- for(i = 0; i < 2; i++) {
- tm.tm_min += (text[i+12]-'0')*n;
- n /= 10;
- }
-
- n = 10;
- tm.tm_sec = 0;
- for(i = 0; i < 2; i++) {
- tm.tm_sec += (text[i+15]-'0')*n;
- n /= 10;
- }
-
- tm.tm_year -= 1900;
-
- *value = mktime(&tm);
-
- return 0;
-
-}
-
-static int date_to_ISO8601 (time_t value, char *buf, int length) {
- struct tm *tm;
- tm = localtime(&value);
-#if 0 // TODO: soap seems to favor this method. xmlrpc the latter.
- return strftime (buf, length, "%Y-%m-%dT%H:%M:%SZ", tm);
-#else
- return strftime(buf, length, "%Y%m%dT%H:%M:%S", tm);
-#endif
-}
-
-/*-*******************
-* End Time Functions *
-*********************/
-
-
-/*-***************************
-* Begin XMLRPC_REQUEST funcs *
-*****************************/
-
-/****f* REQUEST/XMLRPC_RequestNew
- * NAME
- * XMLRPC_RequestNew
- * SYNOPSIS
- * XMLRPC_REQUEST XMLRPC_RequestNew()
- * FUNCTION
- * Creates a new XMLRPC_Request data struct
- * INPUTS
- * none
- * SEE ALSO
- * XMLRPC_RequestFree ()
- * SOURCE
- */
-XMLRPC_REQUEST XMLRPC_RequestNew() {
- XMLRPC_REQUEST xRequest = calloc(1, sizeof(STRUCT_XMLRPC_REQUEST));
- if(xRequest) {
- simplestring_init(&xRequest->methodName);
- }
- return xRequest;
-}
-
-/*******/
-
-/****f* REQUEST/XMLRPC_RequestFree
- * NAME
- * XMLRPC_RequestFree
- * SYNOPSIS
- * void XMLRPC_RequestFree(XMLRPC_REQUEST request, int bFreeIO)
- * FUNCTION
- * Free XMLRPC Request and all sub-values
- * INPUTS
- * request -- previously allocated request struct
- * bFreeIO -- 1 = also free request value data, if any, 0 = ignore.
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_CleanupValue ()
- * SOURCE
- */
-void XMLRPC_RequestFree(XMLRPC_REQUEST request, int bFreeIO) {
- if(request) {
- simplestring_free(&request->methodName);
-
- if(request->io && bFreeIO) {
- XMLRPC_CleanupValue(request->io);
- }
- if(request->error) {
- XMLRPC_CleanupValue(request->error);
- }
- my_free(request);
- }
-}
-
-/*******/
-
-/* Set Method Name to call */
-/****f* REQUEST/XMLRPC_RequestSetMethodName
- * NAME
- * XMLRPC_RequestSetMethodName
- * SYNOPSIS
- * const char* XMLRPC_RequestSetMethodName(XMLRPC_REQUEST request, const char* methodName)
- * FUNCTION
- * Set name of method to call with this request.
- * INPUTS
- * request -- previously allocated request struct
- * methodName -- name of method
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestGetMethodName ()
- * XMLRPC_RequestFree ()
- * SOURCE
- */
-const char* XMLRPC_RequestSetMethodName(XMLRPC_REQUEST request, const char* methodName) {
- if(request) {
- simplestring_clear(&request->methodName);
- simplestring_add(&request->methodName, methodName);
- return request->methodName.str;
- }
- return NULL;
-}
-
-/*******/
-
-/****f* REQUEST/XMLRPC_RequestGetMethodName
- * NAME
- * XMLRPC_RequestGetMethodName
- * SYNOPSIS
- * const char* XMLRPC_RequestGetMethodName(XMLRPC_REQUEST request)
- * FUNCTION
- * Get name of method called by this request
- * INPUTS
- * request -- previously allocated request struct
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestSetMethodName ()
- * XMLRPC_RequestFree ()
- * SOURCE
- */
-const char* XMLRPC_RequestGetMethodName(XMLRPC_REQUEST request) {
- return request ? request->methodName.str : NULL;
-}
-
-/*******/
-
-/****f* REQUEST/XMLRPC_RequestSetRequestType
- * NAME
- * XMLRPC_RequestSetRequestType
- * SYNOPSIS
- * XMLRPC_REQUEST_TYPE XMLRPC_RequestSetRequestType(XMLRPC_REQUEST request, XMLRPC_REQUEST_TYPE type)
- * FUNCTION
- * A request struct may be allocated by a caller or by xmlrpc
- * in response to a request. This allows setting the
- * request type.
- * INPUTS
- * request -- previously allocated request struct
- * type -- request type [xmlrpc_method_call | xmlrpc_method_response]
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestGetRequestType ()
- * XMLRPC_RequestFree ()
- * XMLRPC_REQUEST_TYPE
- * SOURCE
- */
-XMLRPC_REQUEST_TYPE XMLRPC_RequestSetRequestType (XMLRPC_REQUEST request,
- XMLRPC_REQUEST_TYPE type) {
- if(request) {
- request->request_type = type;
- return request->request_type;
- }
- return xmlrpc_request_none;
-}
-
-/*******/
-
-/****f* REQUEST/XMLRPC_RequestGetRequestType
- * NAME
- * XMLRPC_RequestGetRequestType
- * SYNOPSIS
- * XMLRPC_REQUEST_TYPE XMLRPC_RequestGetRequestType(XMLRPC_REQUEST request)
- * FUNCTION
- * A request struct may be allocated by a caller or by xmlrpc
- * in response to a request. This allows setting the
- * request type.
- * INPUTS
- * request -- previously allocated request struct
- * RESULT
- * type -- request type [xmlrpc_method_call | xmlrpc_method_response]
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestSetRequestType ()
- * XMLRPC_RequestFree ()
- * XMLRPC_REQUEST_TYPE
- * SOURCE
- */
-XMLRPC_REQUEST_TYPE XMLRPC_RequestGetRequestType(XMLRPC_REQUEST request) {
- return request ? request->request_type : xmlrpc_request_none;
-}
-
-/*******/
-
-
-/****f* REQUEST/XMLRPC_RequestSetData
- * NAME
- * XMLRPC_RequestSetData
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_RequestSetData(XMLRPC_REQUEST request, XMLRPC_VALUE data)
- * FUNCTION
- * Associates a block of xmlrpc data with the request. The
- * data is *not* copied. A pointer is kept. The caller
- * should be careful not to doubly free the data value,
- * which may optionally be free'd by XMLRPC_RequestFree().
- * INPUTS
- * request -- previously allocated request struct
- * data -- previously allocated data struct
- * RESULT
- * XMLRPC_VALUE -- pointer to value stored, or NULL
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestGetData ()
- * XMLRPC_RequestFree ()
- * XMLRPC_REQUEST
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_RequestSetData(XMLRPC_REQUEST request, XMLRPC_VALUE data) {
- if(request && data) {
- if (request->io) {
- XMLRPC_CleanupValue (request->io);
- }
- request->io = XMLRPC_CopyValue(data);
- return request->io;
- }
- return NULL;
-}
-
-/*******/
-
-/****f* REQUEST/XMLRPC_RequestGetData
- * NAME
- * XMLRPC_RequestGetData
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_RequestGetData(XMLRPC_REQUEST request)
- * FUNCTION
- * Returns data associated with request, if any.
- * INPUTS
- * request -- previously allocated request struct
- * RESULT
- * XMLRPC_VALUE -- pointer to value stored, or NULL
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestSetData ()
- * XMLRPC_RequestFree ()
- * XMLRPC_REQUEST
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_RequestGetData(XMLRPC_REQUEST request) {
- return request ? request->io : NULL;
-}
-
-/*******/
-
-/****f* REQUEST/XMLRPC_RequestSetError
- * NAME
- * XMLRPC_RequestSetError
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_RequestSetError(XMLRPC_REQUEST request, XMLRPC_VALUE error)
- * FUNCTION
- * Associates a block of xmlrpc data, representing an error
- * condition, with the request.
- * INPUTS
- * request -- previously allocated request struct
- * error -- previously allocated error code or struct
- * RESULT
- * XMLRPC_VALUE -- pointer to value stored, or NULL
- * NOTES
- * This is a private function for usage by internals only.
- * SEE ALSO
- * XMLRPC_RequestGetError ()
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_RequestSetError (XMLRPC_REQUEST request, XMLRPC_VALUE error) {
- if (request && error) {
- if (request->error) {
- XMLRPC_CleanupValue (request->error);
- }
- request->error = XMLRPC_CopyValue (error);
- return request->error;
- }
- return NULL;
-}
-
-/*******/
-
-/****f* REQUEST/XMLRPC_RequestGetError
- * NAME
- * XMLRPC_RequestGetError
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_RequestGetError(XMLRPC_REQUEST request)
- * FUNCTION
- * Returns error data associated with request, if any.
- * INPUTS
- * request -- previously allocated request struct
- * RESULT
- * XMLRPC_VALUE -- pointer to error value stored, or NULL
- * NOTES
- * This is a private function for usage by internals only.
- * SEE ALSO
- * XMLRPC_RequestSetError ()
- * XMLRPC_RequestFree ()
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_RequestGetError (XMLRPC_REQUEST request) {
- return request ? request->error : NULL;
-}
-
-/*******/
-
-
-/****f* REQUEST/XMLRPC_RequestSetOutputOptions
- * NAME
- * XMLRPC_RequestSetOutputOptions
- * SYNOPSIS
- * XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestSetOutputOptions(XMLRPC_REQUEST request, XMLRPC_REQUEST_OUTPUT_OPTIONS output)
- * FUNCTION
- * Sets output options used for generating XML. The output struct
- * is copied, and may be freed by the caller.
- * INPUTS
- * request -- previously allocated request struct
- * output -- output options struct initialized by caller
- * RESULT
- * XMLRPC_REQUEST_OUTPUT_OPTIONS -- pointer to value stored, or NULL
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestGetOutputOptions ()
- * XMLRPC_RequestFree ()
- * XMLRPC_REQUEST
- * XMLRPC_REQUEST_OUTPUT_OPTIONS
- * SOURCE
- */
-XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestSetOutputOptions(XMLRPC_REQUEST request, XMLRPC_REQUEST_OUTPUT_OPTIONS output) {
- if(request && output) {
- memcpy (&request->output, output,
- sizeof (STRUCT_XMLRPC_REQUEST_OUTPUT_OPTIONS));
- return &request->output;
- }
- return NULL;
-}
-
-/*******/
-
-
-/****f* REQUEST/XMLRPC_RequestGetOutputOptions
- * NAME
- * XMLRPC_RequestGetOutputOptions
- * SYNOPSIS
- * XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestGetOutputOptions(XMLRPC_REQUEST request)
- * FUNCTION
- * Gets a pointer to output options used for generating XML.
- * INPUTS
- * request -- previously allocated request struct
- * RESULT
- * XMLRPC_REQUEST_OUTPUT_OPTIONS -- pointer to options stored, or NULL
- * SEE ALSO
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestSetOutputOptions ()
- * XMLRPC_RequestFree ()
- * XMLRPC_REQUEST
- * XMLRPC_REQUEST_OUTPUT_OPTIONS
- * SOURCE
- */
-XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestGetOutputOptions(XMLRPC_REQUEST request) {
- return request ? &request->output : NULL;
-}
-
-/*******/
-
-/*-*************************
-* End XMLRPC_REQUEST funcs *
-***************************/
-
-
-/*-***************************
-* Begin Serializiation funcs *
-*****************************/
-
-/****f* SERIALIZE/XMLRPC_VALUE_ToXML
- * NAME
- * XMLRPC_VALUE_ToXML
- * SYNOPSIS
- * char* XMLRPC_VALUE_ToXML(XMLRPC_VALUE val)
- * FUNCTION
- * encode XMLRPC_VALUE into XML buffer. Note that the generated
- * buffer will not contain a methodCall.
- * INPUTS
- * val -- previously allocated XMLRPC_VALUE
- * buf_len -- length of returned buffer, if not null
- * RESULT
- * char* -- newly allocated buffer containing XML.
- * It is the caller's responsibility to free it.
- * SEE ALSO
- * XMLRPC_REQUEST_ToXML ()
- * XMLRPC_VALUE_FromXML ()
- * XMLRPC_Free ()
- * XMLRPC_VALUE
- * SOURCE
- */
-char* XMLRPC_VALUE_ToXML(XMLRPC_VALUE val, int* buf_len) {
- xml_element *root_elem = XMLRPC_VALUE_to_xml_element(val);
- char* pRet = NULL;
-
- if(root_elem) {
- pRet = xml_elem_serialize_to_string(root_elem, NULL, buf_len);
- xml_elem_free(root_elem);
- }
- return pRet;
-}
-
-/*******/
-
-/****f* SERIALIZE/XMLRPC_REQUEST_ToXML
- * NAME
- * XMLRPC_REQUEST_ToXML
- * SYNOPSIS
- * char* XMLRPC_REQUEST_ToXML(XMLRPC_REQUEST request)
- * FUNCTION
- * encode XMLRPC_REQUEST into XML buffer
- * INPUTS
- * request -- previously allocated XMLRPC_REQUEST
- * buf_len -- size of returned buf, if not null
- * RESULT
- * char* -- newly allocated buffer containing XML.
- * It is the caller's responsibility to free it.
- * SEE ALSO
- * XMLRPC_REQUEST_ToXML ()
- * XMLRPC_REQUEST_FromXML ()
- * XMLRPC_Free ()
- * XMLRPC_VALUE_ToXML ()
- * XMLRPC_REQUEST
- * SOURCE
- */
-char* XMLRPC_REQUEST_ToXML(XMLRPC_REQUEST request, int* buf_len) {
- char* pRet = NULL;
- if (request) {
- xml_element *root_elem = NULL;
- if (request->output.version == xmlrpc_version_simple) {
- root_elem = DANDARPC_REQUEST_to_xml_element (request);
- }
- else if (request->output.version == xmlrpc_version_1_0 ||
- request->output.version == xmlrpc_version_none) {
- root_elem = XMLRPC_REQUEST_to_xml_element (request);
- }
- else if (request->output.version == xmlrpc_version_soap_1_1) {
- root_elem = SOAP_REQUEST_to_xml_element (request);
- }
-
- if(root_elem) {
- pRet =
- xml_elem_serialize_to_string (root_elem,
- &request->output.xml_elem_opts,
- buf_len);
- xml_elem_free(root_elem);
- }
- }
- return pRet;
-}
-
-/*******/
-
-/****f* SERIALIZE/XMLRPC_VALUE_FromXML
- * NAME
- * XMLRPC_VALUE_FromXML
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_VALUE_FromXML(const char* in_buf, int le
- * FUNCTION
- * Retrieve XMLRPC_VALUE from XML buffer. Note that this will
- * ignore any methodCall. See XMLRPC_REQUEST_FromXML
- * INPUTS
- * in_buf -- character buffer containing XML
- * len -- length of buffer
- * RESULT
- * XMLRPC_VALUE -- newly allocated data, or NULL if error. Should
- * be free'd by caller.
- * SEE ALSO
- * XMLRPC_VALUE_ToXML ()
- * XMLRPC_REQUEST_FromXML ()
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_VALUE_FromXML (const char *in_buf, int len, XMLRPC_REQUEST_INPUT_OPTIONS in_options) {
- XMLRPC_VALUE xResponse = NULL;
- XMLRPC_REQUEST req = XMLRPC_REQUEST_FromXML(in_buf, len, in_options);
-
- if(req) {
- xResponse = req->io;
- XMLRPC_RequestFree(req, 0);
- }
- return xResponse;
-}
-
-/*******/
-
-/* map parser errors to standard xml-rpc errors */
-static XMLRPC_VALUE map_expat_errors(XML_ELEM_ERROR error) {
- XMLRPC_VALUE xReturn = NULL;
- if(error) {
- XMLRPC_ERROR_CODE code;
- char buf[1024];
- snprintf(buf, sizeof(buf),
- "error occurred at line %i, column %i, byte index %i",
- error->line, error->column, error->byte_index);
-
- /* expat specific errors */
- switch(error->parser_code) {
- case XML_ERROR_UNKNOWN_ENCODING:
- code = xmlrpc_error_parse_unknown_encoding;
- break;
- case XML_ERROR_INCORRECT_ENCODING:
- code = xmlrpc_error_parse_bad_encoding;
- break;
- default:
- code = xmlrpc_error_parse_xml_syntax;
- break;
- }
- xReturn = XMLRPC_UtilityCreateFault(code, buf);
- }
- return xReturn;
-}
-
-/****f* SERIALIZE/XMLRPC_REQUEST_FromXML
- * NAME
- * XMLRPC_REQUEST_FromXML
- * SYNOPSIS
- * XMLRPC_REQUEST XMLRPC_REQUEST_FromXML(const char* in_buf, int le
- * FUNCTION
- * Retrieve XMLRPC_REQUEST from XML buffer
- * INPUTS
- * in_buf -- character buffer containing XML
- * len -- length of buffer
- * RESULT
- * XMLRPC_REQUEST -- newly allocated data, or NULL if error. Should
- * be free'd by caller.
- * SEE ALSO
- * XMLRPC_REQUEST_ToXML ()
- * XMLRPC_VALUE_FromXML ()
- * XMLRPC_REQUEST
- * SOURCE
- */
-XMLRPC_REQUEST XMLRPC_REQUEST_FromXML (const char *in_buf, int len,
- XMLRPC_REQUEST_INPUT_OPTIONS in_options) {
- XMLRPC_REQUEST request = XMLRPC_RequestNew();
- STRUCT_XML_ELEM_ERROR error = {0};
-
- if(request) {
- xml_element *root_elem =
- xml_elem_parse_buf (in_buf, len,
- (in_options ? &in_options->xml_elem_opts : NULL),
- &error);
-
- if(root_elem) {
- if(!strcmp(root_elem->name, "simpleRPC")) {
- request->output.version = xmlrpc_version_simple;
- xml_element_to_DANDARPC_REQUEST(request, root_elem);
- }
- else if (!strcmp (root_elem->name, "SOAP-ENV:Envelope")) {
- request->output.version = xmlrpc_version_soap_1_1;
- xml_element_to_SOAP_REQUEST (request, root_elem);
- }
- else {
- request->output.version = xmlrpc_version_1_0;
- xml_element_to_XMLRPC_REQUEST(request, root_elem);
- }
- xml_elem_free(root_elem);
- }
- else {
- if(error.parser_error) {
- XMLRPC_RequestSetError (request, map_expat_errors (&error));
- }
- }
- }
-
- return request;
-}
-
-/*******/
-
-/*-************************
-* End Serialization Funcs *
-**************************/
-
-
-
-/****f* VALUE/XMLRPC_CreateValueEmpty
- * NAME
- * XMLRPC_CreateValueEmpty
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueEmpty ()
- * FUNCTION
- * Create an XML value to be used/modified elsewhere.
- * INPUTS
- * RESULT
- * XMLRPC_VALUE. The new value, or NULL on failure.
- * SEE ALSO
- * XMLRPC_CleanupValue ()
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueEmpty() {
- XMLRPC_VALUE v = calloc(1, sizeof(STRUCT_XMLRPC_VALUE));
- if(v) {
-#ifdef XMLRPC_DEBUG_REFCOUNT
- printf ("calloc'd 0x%x\n", v);
-#endif
- v->type = xmlrpc_empty;
- simplestring_init(&v->id);
- simplestring_init(&v->str);
- }
- return v;
-}
-
-static const char* get_string(const char* buf, int bDup) {
- if(bDup) {
- return strdup(buf);
- }
- return buf;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_SetValueID_Case
- * NAME
- * XMLRPC_SetValueID_Case
- * SYNOPSIS
- * const char *XMLRPC_SetValueID_Case(XMLRPC_VALUE value, const char* id, int len, XMLRPC_CASE id_case)
- * FUNCTION
- * Assign an ID (key) to an XMLRPC value.
- * INPUTS
- * value The xml value who's ID we will set.
- * id The desired new id.
- * len length of id string if known, or 0 if unknown.
- * id_case one of XMLRPC_CASE
- * RESULT
- * const char* pointer to the newly allocated id string, or NULL
- * SEE ALSO
- * XMLRPC_SetValueID ()
- * XMLRPC_GetValueID ()
- * XMLRPC_VALUE
- * XMLRPC_CASE
- * SOURCE
- */
-const char *XMLRPC_SetValueID_Case(XMLRPC_VALUE value, const char* id, int len, XMLRPC_CASE id_case) {
- const char* pRetval = NULL;
- if(value) {
- if(id) {
- simplestring_clear(&value->id);
- (len > 0) ? simplestring_addn(&value->id, id, len) :
- simplestring_add(&value->id, id);
-
- /* upper or lower case string in place if required. could be a seperate func. */
- if(id_case == xmlrpc_case_lower || id_case == xmlrpc_case_upper) {
- int i;
- for(i = 0; i < value->id.len; i++) {
- value->id.str[i] =
- (id_case ==
- xmlrpc_case_lower) ? tolower (value->id.
- str[i]) : toupper (value->
- id.
- str[i]);
- }
- }
-
- pRetval = value->id.str;
-
-#ifdef XMLRPC_DEBUG_REFCOUNT
- printf("set value id: %s\n", pRetval);
-#endif
- }
- }
-
- return pRetval;
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_SetValueString
- * NAME
- * XMLRPC_SetValueString
- * SYNOPSIS
- * const char *XMLRPC_SetValueString(XMLRPC_VALUE value, const char* val, int len)
- * FUNCTION
- * Assign a string value to an XMLRPC_VALUE, and set it to type xmlrpc_string
- * INPUTS
- * value The xml value who's ID we will set.
- * val The desired new string val.
- * len length of val string if known, or 0 if unknown.
- * RESULT
- * const char* pointer to the newly allocated value string, or NULL
- * SEE ALSO
- * XMLRPC_GetValueString ()
- * XMLRPC_VALUE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-const char *XMLRPC_SetValueString(XMLRPC_VALUE value, const char* val, int len) {
- char *pRetval = NULL;
- if(value && val) {
- simplestring_clear(&value->str);
- (len > 0) ? simplestring_addn(&value->str, val, len) :
- simplestring_add(&value->str, val);
- value->type = xmlrpc_string;
- pRetval = (char *)value->str.str;
- }
-
- return pRetval;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_SetValueInt
- * NAME
- * XMLRPC_SetValueInt
- * SYNOPSIS
- * void XMLRPC_SetValueInt(XMLRPC_VALUE value, int val)
- * FUNCTION
- * Assign an int value to an XMLRPC_VALUE, and set it to type xmlrpc_int
- * INPUTS
- * value The xml value who's ID we will set.
- * val The desired new integer value
- * RESULT
- * SEE ALSO
- * XMLRPC_GetValueInt ()
- * XMLRPC_VALUE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-void XMLRPC_SetValueInt(XMLRPC_VALUE value, int val) {
- if(value) {
- value->type = xmlrpc_int;
- value->i = val;
- }
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_SetValueBoolean
- * NAME
- * XMLRPC_SetValueBoolean
- * SYNOPSIS
- * void XMLRPC_SetValueBoolean(XMLRPC_VALUE value, int val)
- * FUNCTION
- * Assign a boolean value to an XMLRPC_VALUE, and set it to type xmlrpc_boolean
- * INPUTS
- * value The xml value who's value we will set.
- * val The desired new boolean value. [0 | 1]
- * RESULT
- * SEE ALSO
- * XMLRPC_GetValueBoolean ()
- * XMLRPC_VALUE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-void XMLRPC_SetValueBoolean(XMLRPC_VALUE value, int val) {
- if(value) {
- value->type = xmlrpc_boolean;
- value->i = val ? 1 : 0;
- }
-}
-
-/*******/
-
-
-/****f* VECTOR/XMLRPC_SetIsVector
- * NAME
- * XMLRPC_SetIsVector
- * SYNOPSIS
- * int XMLRPC_SetIsVector(XMLRPC_VALUE value, XMLRPC_VECTOR_TYPE type)
- * FUNCTION
- * Set the XMLRPC_VALUE to be a vector (list) type. The vector may be one of
- * [xmlrpc_array | xmlrpc_struct | xmlrpc_mixed]. An array has only index values.
- * A struct has key/val pairs. Mixed allows both index and key/val combinations.
- * INPUTS
- * value The xml value who's vector type we will set
- * type New type of vector as enumerated by XMLRPC_VECTOR_TYPE
- * RESULT
- * int 1 if successful, 0 otherwise
- * SEE ALSO
- * XMLRPC_GetValueType ()
- * XMLRPC_GetVectorType ()
- * XMLRPC_VALUE
- * XMLRPC_VECTOR_TYPE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-int XMLRPC_SetIsVector(XMLRPC_VALUE value, XMLRPC_VECTOR_TYPE type) {
- int bSuccess = 0;
-
- if (value) {
- // we can change the type so long as nothing is currently stored.
- if(value->type == xmlrpc_vector) {
- if(value->v) {
- if(!Q_Size(value->v->q)) {
- value->v->type = type;
- }
- }
- }
- else {
- value->v = calloc(1, sizeof(STRUCT_XMLRPC_VECTOR));
- if(value->v) {
- value->v->q = (queue*)malloc(sizeof(queue));
- if(value->v->q) {
- Q_Init(value->v->q);
- value->v->type = type;
- value->type = xmlrpc_vector;
- bSuccess = 1;
- }
- }
- }
- }
-
- return bSuccess;
-}
-
-/*******/
-
-/****f* VECTOR/XMLRPC_CreateVector
- * NAME
- * XMLRPC_CreateVector
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateVector(const char* id, XMLRPC_VECTOR_TYPE type)
- * FUNCTION
- * Create a new vector and optionally set an id.
- * INPUTS
- * id The id of the vector, or NULL
- * type New type of vector as enumerated by XMLRPC_VECTOR_TYPE
- * RESULT
- * XMLRPC_VALUE The new vector, or NULL on failure.
- * SEE ALSO
- * XMLRPC_CreateValueEmpty ()
- * XMLRPC_SetIsVector ()
- * XMLRPC_GetValueType ()
- * XMLRPC_GetVectorType ()
- * XMLRPC_VALUE
- * XMLRPC_VECTOR_TYPE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateVector(const char* id, XMLRPC_VECTOR_TYPE type) {
- XMLRPC_VALUE val = NULL;
-
- val = XMLRPC_CreateValueEmpty();
- if(val) {
- XMLRPC_VECTOR *pSIV = NULL;
-
- if(XMLRPC_SetIsVector(val, type)) {
- if(id) {
- const char *pSVI = NULL;
-
- pSVI = XMLRPC_SetValueID(val, id, 0);
- if(NULL == pSVI) {
- val = NULL;
- }
- }
- }
- else {
- val = NULL;
- }
- }
- return val;
-}
-
-/*******/
-
-
-/* Not yet implemented.
- *
- * This should use a hash to determine if a given target id has already
- * been appended.
- *
- * Alternately, it could walk the entire vector, but that could be quite
- * slow for very large lists.
- */
-static int isDuplicateEntry(XMLRPC_VALUE target, XMLRPC_VALUE source) {
- return 0;
-}
-
-/****f* VECTOR/XMLRPC_AddValueToVector
- * NAME
- * XMLRPC_AddValueToVector
- * SYNOPSIS
- * int XMLRPC_AddValueToVector(XMLRPC_VALUE target, XMLRPC_VALUE source)
- * FUNCTION
- * Add (append) an existing XMLRPC_VALUE to a vector.
- * INPUTS
- * target The target vector
- * source The source value to append
- * RESULT
- * int 1 if successful, else 0
- * SEE ALSO
- * XMLRPC_AddValuesToVector ()
- * XMLRPC_VectorGetValueWithID_Case ()
- * XMLRPC_VALUE
- * NOTES
- * The function will fail and return 0 if an attempt is made to add
- * a value with an ID into a vector of type xmlrpc_vector_array. Such
- * values can only be added to xmlrpc_vector_struct.
- * SOURCE
- */
-int XMLRPC_AddValueToVector(XMLRPC_VALUE target, XMLRPC_VALUE source) {
- if(target && source) {
- if(target->type == xmlrpc_vector && target->v &&
- target->v->q && target->v->type != xmlrpc_vector_none) {
-
- /* guard against putting value of unknown type into vector */
- switch(source->type) {
- case xmlrpc_empty:
- case xmlrpc_base64:
- case xmlrpc_boolean:
- case xmlrpc_datetime:
- case xmlrpc_double:
- case xmlrpc_int:
- case xmlrpc_string:
- case xmlrpc_vector:
- /* Guard against putting a key/val pair into an array vector */
- if( !(source->id.len && target->v->type == xmlrpc_vector_array) ) {
- if (isDuplicateEntry (target, source)
- || Q_PushTail (target->v->q, XMLRPC_CopyValue (source))) {
- return 1;
- }
- }
- else {
- fprintf (stderr,
- "xmlrpc: attempted to add key/val pair to vector of type array\n");
- }
- break;
- default:
- fprintf (stderr,
- "xmlrpc: attempted to add value of unknown type to vector\n");
- break;
- }
- }
- }
- return 0;
-}
-
-/*******/
-
-
-/****f* VECTOR/XMLRPC_AddValuesToVector
- * NAME
- * XMLRPC_AddValuesToVector
- * SYNOPSIS
- * XMLRPC_AddValuesToVector ( target, val1, val2, val3, val(n), 0 )
- * XMLRPC_AddValuesToVector( XMLRPC_VALUE, ... )
- * FUNCTION
- * Add (append) a series of existing XMLRPC_VALUE to a vector.
- * INPUTS
- * target The target vector
- * ... The source value(s) to append. The last item *must* be 0.
- * RESULT
- * int 1 if successful, else 0
- * SEE ALSO
- * XMLRPC_AddValuesToVector ()
- * XMLRPC_VectorGetValueWithID_Case ()
- * XMLRPC_VALUE
- * NOTES
- * This function may actually return failure after it has already modified
- * or added items to target. You can not trust the state of target
- * if this function returns failure.
- * SOURCE
- */
-int XMLRPC_AddValuesToVector(XMLRPC_VALUE target, ...) {
- int iRetval = 0;
-
- if(target) {
- if(target->type == xmlrpc_vector) {
- XMLRPC_VALUE v = NULL;
- va_list vl;
-
- va_start(vl, target);
-
- do {
- v = va_arg(vl, XMLRPC_VALUE);
- if(v) {
- if(!XMLRPC_AddValueToVector(target, v)) {
- iRetval = 0;
- break;
- }
- }
- }
- while (v);
-
- va_end(vl);
-
- if(NULL == v) {
- iRetval = 1;
- }
- }
- }
- return iRetval;
-}
-
-/*******/
-
-
-/****f* VECTOR/XMLRPC_VectorGetValueWithID_Case
- * NAME
- * XMLRPC_VectorGetValueWithID_Case
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_VectorGetValueWithID_Case(XMLRPC_VALUE vector, const char* id, XMLRPC_CASE_COMPARISON id_case)
- * FUNCTION
- * Get value from vector matching id (key)
- * INPUTS
- * vector The source vector
- * id The key to find
- * id_case Rule for how to match key
- * RESULT
- * int 1 if successful, else 0
- * SEE ALSO
- * XMLRPC_SetValueID_Case ()
- * XMLRPC_VALUE
- * XMLRPC_CASE_COMPARISON
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_VectorGetValueWithID_Case (XMLRPC_VALUE vector, const char *id,
- XMLRPC_CASE_COMPARISON id_case) {
- if(vector && vector->v && vector->v->q) {
- q_iter qi = Q_Iter_Head_F(vector->v->q);
-
- while(qi) {
- XMLRPC_VALUE xIter = Q_Iter_Get_F(qi);
- if(xIter && xIter->id.str) {
- if(id_case == xmlrpc_case_sensitive) {
- if(!strcmp(xIter->id.str, id)) {
- return xIter;
- }
- }
- else if(id_case == xmlrpc_case_insensitive) {
- if(!strcasecmp(xIter->id.str, id)) {
- return xIter;
- }
- }
- }
- qi = Q_Iter_Next_F(qi);
- }
- }
- return NULL;
-}
-
-/*******/
-
-
-int XMLRPC_VectorRemoveValue(XMLRPC_VALUE vector, XMLRPC_VALUE value) {
- if(vector && vector->v && vector->v->q && value) {
- q_iter qi = Q_Iter_Head_F(vector->v->q);
-
- while(qi) {
- XMLRPC_VALUE xIter = Q_Iter_Get_F(qi);
- if(xIter == value) {
- XMLRPC_CleanupValue(xIter);
- Q_Iter_Del(vector->v->q, qi);
- return 1;
- }
- qi = Q_Iter_Next_F(qi);
- }
- }
- return 0;
-}
-
-
-/****f* VALUE/XMLRPC_CreateValueString
- * NAME
- * XMLRPC_CreateValueString
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueString(const char* id, const char* val, int len)
- * FUNCTION
- * Create an XMLRPC_VALUE, and assign a string to it
- * INPUTS
- * id The id of the value, or NULL
- * val The desired new string val.
- * len length of val string if known, or 0 if unknown.
- * RESULT
- * newly allocated XMLRPC_VALUE, or NULL
- * SEE ALSO
- * XMLRPC_GetValueString ()
- * XMLRPC_CreateValueEmpty ()
- * XMLRPC_VALUE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueString(const char* id, const char* val, int len) {
- XMLRPC_VALUE value = NULL;
- if(val) {
- value = XMLRPC_CreateValueEmpty();
- if(value) {
- XMLRPC_SetValueString(value, val, len);
- if(id) {
- XMLRPC_SetValueID(value, id, 0);
- }
- }
- }
- return value;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_CreateValueInt
- * NAME
- * XMLRPC_CreateValueInt
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueInt(const char* id, int i)
- * FUNCTION
- * Create an XMLRPC_VALUE, and assign an int to it
- * INPUTS
- * id The id of the value, or NULL
- * i The desired new int val.
- * RESULT
- * newly allocated XMLRPC_VALUE, or NULL
- * SEE ALSO
- * XMLRPC_GetValueInt ()
- * XMLRPC_CreateValueEmpty ()
- * XMLRPC_VALUE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueInt(const char* id, int i) {
- XMLRPC_VALUE val = XMLRPC_CreateValueEmpty();
- if(val) {
- XMLRPC_SetValueInt(val, i);
- if(id) {
- XMLRPC_SetValueID(val, id, 0);
- }
- }
- return val;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_CreateValueBoolean
- * NAME
- * XMLRPC_CreateValueBoolean
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueBoolean(const char* id, int i)
- * FUNCTION
- * Create an XMLRPC_VALUE, and assign an int to it
- * INPUTS
- * id The id of the value, or NULL
- * i The desired new int val.
- * RESULT
- * newly allocated XMLRPC_VALUE, or NULL
- * SEE ALSO
- * XMLRPC_GetValueBoolean ()
- * XMLRPC_CreateValueEmpty ()
- * XMLRPC_VALUE
- * XMLRPC_VALUE_TYPE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueBoolean(const char* id, int i) {
- XMLRPC_VALUE val = XMLRPC_CreateValueEmpty();
- if(val) {
- XMLRPC_SetValueBoolean(val, i);
- if(id) {
- XMLRPC_SetValueID(val, id, 0);
- }
- }
- return val;
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_CleanupValue
- * NAME
- * XMLRPC_CleanupValue
- * SYNOPSIS
- * void XMLRPC_CleanupValue(XMLRPC_VALUE value)
- * FUNCTION
- * Frees all memory allocated for an XMLRPC_VALUE and any of its children (if a vector)
- * INPUTS
- * value The id of the value to be cleaned up.
- * RESULT
- * void
- * NOTES
- * Normally this function will be called for the topmost vector, thus free-ing
- * all children. If a child of a vector is free'd first, results are undefined.
- * Failure to call this function *will* cause memory leaks.
- *
- * Also, this function is implemented using reference counting. Thus a value
- * may be added and freed from multiple parents so long as a reference is added
- * first using XMLRPC_CopyValue()
- * SEE ALSO
- * XMLRPC_RequestFree ()
- * XMLRPC_CreateValueEmpty ()
- * XMLRPC_CopyValue()
- * XMLRPC_VALUE
- * SOURCE
- */
-void XMLRPC_CleanupValue(XMLRPC_VALUE value) {
- if(value) {
- if(value->iRefCount > 0) {
- value->iRefCount --;
- }
-
-#ifdef XMLRPC_DEBUG_REFCOUNT
- if(value->id.str) {
- printf ("decremented refcount of %s, now %i\n", value->id.str,
- value->iRefCount);
- }
- else {
- printf ("decremented refcount of 0x%x, now %i\n", value,
- value->iRefCount);
- }
-#endif
-
- if(value->type == xmlrpc_vector) {
- if(value->v) {
- if(value->iRefCount == 0) {
- XMLRPC_VALUE cur = (XMLRPC_VALUE)Q_Head(value->v->q);
- while( cur ) {
- XMLRPC_CleanupValue(cur);
-
- /* Make sure some idiot didn't include a vector as a child of itself
- * and thus it would have already free'd these.
- */
- if(value->v && value->v->q) {
- cur = Q_Next(value->v->q);
- }
- else {
- break;
- }
- }
-
- Q_Destroy(value->v->q);
- my_free(value->v->q);
- my_free(value->v);
- }
- }
- }
-
-
- if(value->iRefCount == 0) {
-
- /* guard against freeing invalid types */
- switch(value->type) {
- case xmlrpc_empty:
- case xmlrpc_base64:
- case xmlrpc_boolean:
- case xmlrpc_datetime:
- case xmlrpc_double:
- case xmlrpc_int:
- case xmlrpc_string:
- case xmlrpc_vector:
-#ifdef XMLRPC_DEBUG_REFCOUNT
- if(value->id.str) {
- printf("free'd %s\n", value->id.str);
- }
- else {
- printf("free'd 0x%x\n", value);
- }
-#endif
- simplestring_free(&value->id);
- simplestring_free(&value->str);
-
- memset(value, 0, sizeof(STRUCT_XMLRPC_VALUE));
- my_free(value);
- break;
- default:
- fprintf (stderr,
- "xmlrpc: attempted to free value of invalid type\n");
- break;
- }
- }
- }
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_SetValueDateTime
- * NAME
- * XMLRPC_SetValueDateTime
- * SYNOPSIS
- * void XMLRPC_SetValueDateTime(XMLRPC_VALUE value, time_t time)
- * FUNCTION
- * Assign time value to XMLRPC_VALUE
- * INPUTS
- * value The target XMLRPC_VALUE
- * time The desired new unix time value (time_t)
- * RESULT
- * void
- * SEE ALSO
- * XMLRPC_GetValueDateTime ()
- * XMLRPC_SetValueDateTime_ISO8601 ()
- * XMLRPC_CreateValueDateTime ()
- * XMLRPC_VALUE
- * SOURCE
- */
-void XMLRPC_SetValueDateTime(XMLRPC_VALUE value, time_t time) {
- if(value) {
- char timeBuf[30];
- value->type = xmlrpc_datetime;
- value->i = time;
-
- timeBuf[0] = 0;
-
- date_to_ISO8601(time, timeBuf, sizeof(timeBuf));
-
- if(timeBuf[0]) {
- simplestring_clear(&value->str);
- simplestring_add(&value->str, timeBuf);
- }
- }
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_CopyValue
- * NAME
- * XMLRPC_CopyValue
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CopyValue(XMLRPC_VALUE value)
- * FUNCTION
- * Make a copy (reference) of an XMLRPC_VALUE
- * INPUTS
- * value The target XMLRPC_VALUE
- * RESULT
- * XMLRPC_VALUE -- address of the copy
- * SEE ALSO
- * XMLRPC_CleanupValue ()
- * XMLRPC_DupValueNew ()
- * NOTES
- * This function is implemented via reference counting, so the
- * returned value is going to be the same as the passed in value.
- * The value must be freed the same number of times it is copied
- * or there will be a memory leak.
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CopyValue(XMLRPC_VALUE value) {
- if(value) {
- value->iRefCount ++;
-#ifdef XMLRPC_DEBUG_REFCOUNT
- if(value->id.str) {
- printf ("incremented refcount of %s, now %i\n", value->id.str,
- value->iRefCount);
- }
- else {
- printf ("incremented refcount of 0x%x, now %i\n", value,
- value->iRefCount);
- }
-#endif
- }
- return value;
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_DupValueNew
- * NAME
- * XMLRPC_DupValueNew
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_DupValueNew(XMLRPC_VALUE value)
- * FUNCTION
- * Make a duplicate (non reference) of an XMLRPC_VALUE with newly allocated mem.
- * INPUTS
- * value The source XMLRPC_VALUE to duplicate
- * RESULT
- * XMLRPC_VALUE -- address of the duplicate value
- * SEE ALSO
- * XMLRPC_CleanupValue ()
- * XMLRPC_CopyValue ()
- * NOTES
- * Use this when function when you need to modify the contents of
- * the copied value seperately from the original.
- *
- * this function is recursive, thus the value and all of its children
- * (if any) will be duplicated.
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_DupValueNew (XMLRPC_VALUE xSource) {
- XMLRPC_VALUE xReturn = NULL;
- if (xSource) {
- xReturn = XMLRPC_CreateValueEmpty ();
- if (xSource->id.len) {
- XMLRPC_SetValueID (xReturn, xSource->id.str, xSource->id.len);
- }
-
- switch (xSource->type) {
- case xmlrpc_int:
- case xmlrpc_boolean:
- XMLRPC_SetValueInt (xReturn, xSource->i);
- break;
- case xmlrpc_string:
- case xmlrpc_base64:
- XMLRPC_SetValueString (xReturn, xSource->str.str, xSource->str.len);
- break;
- case xmlrpc_datetime:
- XMLRPC_SetValueDateTime (xReturn, xSource->i);
- break;
- case xmlrpc_double:
- XMLRPC_SetValueDouble (xReturn, xSource->d);
- break;
- case xmlrpc_vector:
- {
- q_iter qi = Q_Iter_Head_F (xSource->v->q);
- XMLRPC_SetIsVector (xReturn, xSource->v->type);
-
- while (qi) {
- XMLRPC_VALUE xIter = Q_Iter_Get_F (qi);
- XMLRPC_AddValueToVector (xReturn, XMLRPC_DupValueNew (xIter));
- qi = Q_Iter_Next_F (qi);
- }
- }
- break;
- }
- }
- return xReturn;
-}
-
-/*******/
-
-
-
-/****f* VALUE/XMLRPC_CreateValueDateTime
- * NAME
- * XMLRPC_CreateValueDateTime
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueDateTime(const char* id, time_t time)
- * FUNCTION
- * Create new datetime value from time_t
- * INPUTS
- * id id of the new value, or NULL
- * time The desired unix time value (time_t)
- * RESULT
- * void
- * SEE ALSO
- * XMLRPC_GetValueDateTime ()
- * XMLRPC_SetValueDateTime ()
- * XMLRPC_CreateValueDateTime_ISO8601 ()
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueDateTime(const char* id, time_t time) {
- XMLRPC_VALUE val = XMLRPC_CreateValueEmpty();
- if(val) {
- XMLRPC_SetValueDateTime(val, time);
- if(id) {
- XMLRPC_SetValueID(val, id, 0);
- }
- }
- return val;
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_SetValueDateTime_ISO8601
- * NAME
- * XMLRPC_SetValueDateTime_ISO8601
- * SYNOPSIS
- * void XMLRPC_SetValueDateTime_ISO8601(XMLRPC_VALUE value, const char* s)
- * FUNCTION
- * Set datetime value from IS08601 encoded string
- * INPUTS
- * value The target XMLRPC_VALUE
- * s The desired new time value
- * RESULT
- * void
- * BUGS
- * This function currently attempts to convert the time string to a valid unix time
- * value before passing it. Behavior when the string is invalid or out of range
- * is not well defined, but will probably result in Jan 1, 1970 (0) being passed.
- * SEE ALSO
- * XMLRPC_GetValueDateTime_ISO8601 ()
- * XMLRPC_CreateValueDateTime_ISO8601 ()
- * XMLRPC_CreateValueDateTime ()
- * XMLRPC_VALUE
- * SOURCE
- */
-void XMLRPC_SetValueDateTime_ISO8601(XMLRPC_VALUE value, const char* s) {
- if(value) {
- time_t time_val = 0;
- if(s) {
- date_from_ISO8601(s, &time_val);
- XMLRPC_SetValueDateTime(value, time_val);
- }
- }
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_CreateValueDateTime_ISO8601
- * NAME
- * XMLRPC_CreateValueDateTime_ISO8601
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueDateTime_ISO8601(const char* id, const char *s)
- * FUNCTION
- * Create datetime value from IS08601 encoded string
- * INPUTS
- * id The id of the new value, or NULL
- * s The desired new time value
- * RESULT
- * newly allocated XMLRPC_VALUE, or NULL if no value created.
- * BUGS
- * See XMLRPC_SetValueDateTime_ISO8601 ()
- * SEE ALSO
- * XMLRPC_GetValueDateTime_ISO8601 ()
- * XMLRPC_SetValueDateTime_ISO8601 ()
- * XMLRPC_CreateValueDateTime ()
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueDateTime_ISO8601(const char* id, const char *s) {
- XMLRPC_VALUE val = XMLRPC_CreateValueEmpty();
- if(val) {
- XMLRPC_SetValueDateTime_ISO8601(val, s);
- if(id) {
- XMLRPC_SetValueID(val, id, 0);
- }
- }
- return val;
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_SetValueBase64
- * NAME
- * XMLRPC_SetValueBase64
- * SYNOPSIS
- * void XMLRPC_SetValueBase64(XMLRPC_VALUE value, const char* s, int len)
- * FUNCTION
- * Set base64 value. Base64 is useful for transferring binary data, such as an image.
- * INPUTS
- * value The target XMLRPC_VALUE
- * s The desired new binary value
- * len The length of s, or NULL. If buffer is not null terminated, len *must* be passed.
- * RESULT
- * void
- * NOTES
- * Data is set/stored/retrieved as passed in, but is base64 encoded for XML transfer, and
- * decoded on the other side. This is transparent to the caller.
- * SEE ALSO
- * XMLRPC_GetValueBase64 ()
- * XMLRPC_CreateValueBase64 ()
- * XMLRPC_VALUE
- * SOURCE
- */
-void XMLRPC_SetValueBase64(XMLRPC_VALUE value, const char* s, int len) {
- if(value && s) {
- simplestring_clear(&value->str);
- (len > 0) ? simplestring_addn(&value->str, s, len) :
- simplestring_add(&value->str, s);
- value->type = xmlrpc_base64;
- }
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_CreateValueBase64
- * NAME
- * XMLRPC_CreateValueBase64
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueBase64(const char* id, const char* s, int len)
- * FUNCTION
- * Create base64 value. Base64 is useful for transferring binary data, such as an image.
- * INPUTS
- * id id of the new value, or NULL
- * s The desired new binary value
- * len The length of s, or NULL. If buffer is not null terminated, len *must* be passed.
- * RESULT
- * newly allocated XMLRPC_VALUE, or NULL if error
- * NOTES
- * See XMLRPC_SetValueBase64 ()
- * SEE ALSO
- * XMLRPC_GetValueBase64 ()
- * XMLRPC_SetValueBase64 ()
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueBase64(const char* id, const char* s, int len) {
- XMLRPC_VALUE val = XMLRPC_CreateValueEmpty();
- if(val) {
- XMLRPC_SetValueBase64(val, s, len);
- if(id) {
- XMLRPC_SetValueID(val, id, 0);
- }
- }
- return val;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_SetValueDouble
- * NAME
- * XMLRPC_SetValueDouble
- * SYNOPSIS
- * void XMLRPC_SetValueDouble(XMLRPC_VALUE value, double val)
- * FUNCTION
- * Set double (floating point) value.
- * INPUTS
- * value The target XMLRPC_VALUE
- * val The desired new double value
- * RESULT
- * void
- * SEE ALSO
- * XMLRPC_GetValueDouble ()
- * XMLRPC_CreateValueDouble ()
- * XMLRPC_VALUE
- * SOURCE
- */
-void XMLRPC_SetValueDouble(XMLRPC_VALUE value, double val) {
- if(value) {
- value->type = xmlrpc_double;
- value->d = val;
- }
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_CreateValueDouble
- * NAME
- * XMLRPC_CreateValueDouble
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_CreateValueDouble(const char* id, double d)
- * FUNCTION
- * Create double (floating point) value.
- * INPUTS
- * id id of the newly created value, or NULL
- * d The desired new double value
- * RESULT
- * void
- * SEE ALSO
- * XMLRPC_GetValueDouble ()
- * XMLRPC_CreateValueDouble ()
- * XMLRPC_VALUE
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_CreateValueDouble(const char* id, double d) {
- XMLRPC_VALUE val = XMLRPC_CreateValueEmpty();
- if(val) {
- XMLRPC_SetValueDouble(val, d);
- if(id) {
- XMLRPC_SetValueID(val, id, 0);
- }
- }
- return val;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueString
- * NAME
- * XMLRPC_GetValueString
- * SYNOPSIS
- * const char* XMLRPC_GetValueString(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve string value
- * INPUTS
- * value source XMLRPC_VALUE of type xmlrpc_string
- * RESULT
- * void
- * SEE ALSO
- * XMLRPC_SetValueString ()
- * XMLRPC_GetValueType ()
- * XMLRPC_VALUE
- * SOURCE
- */
-const char* XMLRPC_GetValueString(XMLRPC_VALUE value) {
- return ((value && value->type == xmlrpc_string) ? value->str.str : 0);
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueStringLen
- * NAME
- * XMLRPC_GetValueStringLen
- * SYNOPSIS
- * int XMLRPC_GetValueStringLen(XMLRPC_VALUE value)
- * FUNCTION
- * determine length of string value
- * INPUTS
- * value XMLRPC_VALUE of type xmlrpc_string
- * RESULT
- * length of string, or 0
- * NOTES
- * SEE ALSO
- * XMLRPC_SetValueString ()
- * XMLRPC_GetValueString ()
- * SOURCE
- */
-int XMLRPC_GetValueStringLen(XMLRPC_VALUE value) {
- return ((value) ? value->str.len : 0);
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueInt
- * NAME
- * XMLRPC_GetValueInt
- * SYNOPSIS
- * int XMLRPC_GetValueInt(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve integer value.
- * INPUTS
- * value XMLRPC_VALUE of type xmlrpc_int
- * RESULT
- * integer value or 0 if value is not valid int
- * NOTES
- * use XMLRPC_GetValueType () to be sure if 0 is real return value or not
- * SEE ALSO
- * XMLRPC_SetValueInt ()
- * XMLRPC_CreateValueInt ()
- * SOURCE
- */
-int XMLRPC_GetValueInt(XMLRPC_VALUE value) {
- return ((value && value->type == xmlrpc_int) ? value->i : 0);
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueBoolean
- * NAME
- * XMLRPC_GetValueBoolean
- * SYNOPSIS
- * int XMLRPC_GetValueBoolean(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve boolean value.
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_boolean
- * RESULT
- * boolean value or 0 if value is not valid boolean
- * NOTES
- * use XMLRPC_GetValueType() to be sure if 0 is real value or not
- * SEE ALSO
- * XMLRPC_SetValueBoolean ()
- * XMLRPC_CreateValueBoolean ()
- * SOURCE
- */
-int XMLRPC_GetValueBoolean(XMLRPC_VALUE value) {
- return ((value && value->type == xmlrpc_boolean) ? value->i : 0);
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueDouble
- * NAME
- * XMLRPC_GetValueDouble
- * SYNOPSIS
- * double XMLRPC_GetValueDouble(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve double value
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_double
- * RESULT
- * double value or 0 if value is not valid double.
- * NOTES
- * use XMLRPC_GetValueType() to be sure if 0 is real value or not
- * SEE ALSO
- * XMLRPC_SetValueDouble ()
- * XMLRPC_CreateValueDouble ()
- * SOURCE
- */
-double XMLRPC_GetValueDouble(XMLRPC_VALUE value) {
- return ((value && value->type == xmlrpc_double) ? value->d : 0);
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueBase64
- * NAME
- * XMLRPC_GetValueBase64
- * SYNOPSIS
- * const char* XMLRPC_GetValueBase64(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve binary value
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_base64
- * RESULT
- * pointer to binary value or 0 if value is not valid.
- * SEE ALSO
- * XMLRPC_SetValueBase64 ()
- * XMLRPC_CreateValueBase64 ()
- * NOTES
- * Call XMLRPC_GetValueStringLen() to retrieve real length of binary data. strlen()
- * will not be accurate, as returned data may contain embedded nulls.
- * SOURCE
- */
-const char* XMLRPC_GetValueBase64(XMLRPC_VALUE value) {
- return ((value && value->type == xmlrpc_base64) ? value->str.str : 0);
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueDateTime
- * NAME
- * XMLRPC_GetValueDateTime
- * SYNOPSIS
- * time_t XMLRPC_GetValueDateTime(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve time_t value
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_datetime
- * RESULT
- * time_t value or 0 if value is not valid datetime.
- * NOTES
- * use XMLRPC_GetValueType() to be sure if 0 is real value or not
- * SEE ALSO
- * XMLRPC_SetValueDateTime ()
- * XMLRPC_GetValueDateTime_ISO8601 ()
- * XMLRPC_CreateValueDateTime ()
- * SOURCE
- */
-time_t XMLRPC_GetValueDateTime(XMLRPC_VALUE value) {
- return (time_t)((value && value->type == xmlrpc_datetime) ? value->i : 0);
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueDateTime_IOS8601
- * NAME
- * XMLRPC_GetValueDateTime_IOS8601
- * SYNOPSIS
- * const char* XMLRPC_GetValueDateTime_IOS8601(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve ISO8601 formatted time value
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_datetime
- * RESULT
- * const char* value or 0 if value is not valid datetime.
- * SEE ALSO
- * XMLRPC_SetValueDateTime_IOS8601 ()
- * XMLRPC_GetValueDateTime ()
- * XMLRPC_CreateValueDateTime_IOS8601 ()
- * SOURCE
- */
-const char* XMLRPC_GetValueDateTime_ISO8601(XMLRPC_VALUE value) {
- return ((value && value->type == xmlrpc_datetime) ? value->str.str : 0);
-}
-
-/*******/
-
-/* Get ID (key) of value or NULL */
-/****f* VALUE/XMLRPC_GetValueID
- * NAME
- * XMLRPC_GetValueID
- * SYNOPSIS
- * const char* XMLRPC_GetValueID(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve id (key) of value
- * INPUTS
- * XMLRPC_VALUE of any type
- * RESULT
- * const char* pointer to id of value, or NULL
- * NOTES
- * SEE ALSO
- * XMLRPC_SetValueID()
- * XMLRPC_CreateValueEmpty()
- * SOURCE
- */
-const char* XMLRPC_GetValueID(XMLRPC_VALUE value) {
- return (const char*)((value && value->id.len) ? value->id.str : 0);
-}
-
-/*******/
-
-
-/****f* VECTOR/XMLRPC_VectorSize
- * NAME
- * XMLRPC_VectorSize
- * SYNOPSIS
- * int XMLRPC_VectorSize(XMLRPC_VALUE value)
- * FUNCTION
- * retrieve size of vector
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_vector
- * RESULT
- * count of items in vector
- * NOTES
- * This is a cheap operation even on large vectors. Vector size is
- * maintained by queue during add/remove ops.
- * SEE ALSO
- * XMLRPC_AddValueToVector ()
- * SOURCE
- */
-int XMLRPC_VectorSize(XMLRPC_VALUE value) {
- int size = 0;
- if(value && value->type == xmlrpc_vector && value->v) {
- size = Q_Size(value->v->q);
- }
- return size;
-}
-
-/*******/
-
-/****f* VECTOR/XMLRPC_VectorRewind
- * NAME
- * XMLRPC_VectorRewind
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_VectorRewind(XMLRPC_VALUE value)
- * FUNCTION
- * reset vector to first item
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_vector
- * RESULT
- * first XMLRPC_VALUE in list, or NULL if empty or error.
- * NOTES
- * Be careful to rewind any vector passed in to you if you expect to
- * iterate through the entire list.
- * SEE ALSO
- * XMLRPC_VectorNext ()
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_VectorRewind(XMLRPC_VALUE value) {
- XMLRPC_VALUE xReturn = NULL;
- if(value && value->type == xmlrpc_vector && value->v) {
- xReturn = (XMLRPC_VALUE)Q_Head(value->v->q);
- }
- return xReturn;
-}
-
-/*******/
-
-/****f* VECTOR/XMLRPC_VectorNext
- * NAME
- * XMLRPC_VectorNext
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_VectorNext(XMLRPC_VALUE value)
- * FUNCTION
- * Iterate vector to next item in list.
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_vector
- * RESULT
- * Next XMLRPC_VALUE in vector, or NULL if at end.
- * NOTES
- * SEE ALSO
- * XMLRPC_VectorRewind ()
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_VectorNext(XMLRPC_VALUE value) {
- XMLRPC_VALUE xReturn = NULL;
- if(value && value->type == xmlrpc_vector && value->v) {
- xReturn = (XMLRPC_VALUE)Q_Next(value->v->q);
- }
- return xReturn;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueType
- * NAME
- * XMLRPC_GetValueType
- * SYNOPSIS
- * XMLRPC_VALUE_TYPE XMLRPC_GetValueType(XMLRPC_VALUE value)
- * FUNCTION
- * determine data type of the XMLRPC_VALUE
- * INPUTS
- * XMLRPC_VALUE target of query
- * RESULT
- * data type of value as enumerated by XMLRPC_VALUE_TYPE
- * NOTES
- * all values are of type xmlrpc_empty until set.
- * Deprecated for public use. See XMLRPC_GetValueTypeEasy
- * SEE ALSO
- * XMLRPC_SetValue*
- * XMLRPC_CreateValue*
- * XMLRPC_Append*
- * XMLRPC_GetValueTypeEasy ()
- * SOURCE
- */
-XMLRPC_VALUE_TYPE XMLRPC_GetValueType(XMLRPC_VALUE value) {
- return value ? value->type : xmlrpc_empty;
-}
-
-/*******/
-
-/* Vector type accessor */
-/****f* VALUE/XMLRPC_GetVectorType
- * NAME
- * XMLRPC_GetVectorType
- * SYNOPSIS
- * XMLRPC_VECTOR_TYPE XMLRPC_GetVectorType(XMLRPC_VALUE value)
- * FUNCTION
- * determine vector type of the XMLRPC_VALUE
- * INPUTS
- * XMLRPC_VALUE of type xmlrpc_vector
- * RESULT
- * vector type of value as enumerated by XMLRPC_VECTOR_TYPE.
- * xmlrpc_none if not a value.
- * NOTES
- * xmlrpc_none is returned if value is not a vector
- * Deprecated for public use. See XMLRPC_GetValueTypeEasy
- * SEE ALSO
- * XMLRPC_SetIsVector ()
- * XMLRPC_GetValueType ()
- * XMLRPC_GetValueTypeEasy ()
- * SOURCE
- */
-XMLRPC_VECTOR_TYPE XMLRPC_GetVectorType(XMLRPC_VALUE value) {
- return(value && value->v) ? value->v->type : xmlrpc_none;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetValueTypeEasy
- * NAME
- * XMLRPC_GetValueTypeEasy
- * SYNOPSIS
- * XMLRPC_VALUE_TYPE_EASY XMLRPC_GetValueTypeEasy(XMLRPC_VALUE value)
- * FUNCTION
- * determine data type of the XMLRPC_VALUE. includes vector types.
- * INPUTS
- * XMLRPC_VALUE target of query
- * RESULT
- * data type of value as enumerated by XMLRPC_VALUE_TYPE_EASY
- * xmlrpc_type_none if not a value.
- * NOTES
- * all values are of type xmlrpc_type_empty until set.
- * SEE ALSO
- * XMLRPC_SetValue*
- * XMLRPC_CreateValue*
- * XMLRPC_Append*
- * SOURCE
- */
-XMLRPC_VALUE_TYPE_EASY XMLRPC_GetValueTypeEasy (XMLRPC_VALUE value) {
- if (value) {
- switch (value->type) {
- case xmlrpc_vector:
- switch (value->v->type) {
- case xmlrpc_vector_none:
- return xmlrpc_type_none;
- case xmlrpc_vector_struct:
- return xmlrpc_type_struct;
- case xmlrpc_vector_mixed:
- return xmlrpc_type_mixed;
- case xmlrpc_vector_array:
- return xmlrpc_type_array;
- }
- default:
- /* evil cast, but we know they are the same */
- return(XMLRPC_VALUE_TYPE_EASY) value->type;
- }
- }
- return xmlrpc_none;
-}
-
-/*******/
-
-
-
-/*-*******************
-* Begin Server Funcs *
-*********************/
-
-
-/****f* VALUE/XMLRPC_ServerCreate
- * NAME
- * XMLRPC_ServerCreate
- * SYNOPSIS
- * XMLRPC_SERVER XMLRPC_ServerCreate()
- * FUNCTION
- * Allocate/Init XMLRPC Server Resources.
- * INPUTS
- * none
- * RESULT
- * newly allocated XMLRPC_SERVER
- * NOTES
- * SEE ALSO
- * XMLRPC_ServerDestroy ()
- * XMLRPC_GetGlobalServer ()
- * SOURCE
- */
-XMLRPC_SERVER XMLRPC_ServerCreate() {
- XMLRPC_SERVER server = calloc(1, sizeof(STRUCT_XMLRPC_SERVER));
- if(server) {
- Q_Init(&server->methodlist);
- Q_Init(&server->docslist);
-
- /* register system methods */
- xsm_register(server);
- }
- return server;
-}
-
-/*******/
-
-/* Return global server. Not locking! Not Thread Safe! */
-/****f* VALUE/XMLRPC_GetGlobalServer
- * NAME
- * XMLRPC_GetGlobalServer
- * SYNOPSIS
- * XMLRPC_SERVER XMLRPC_GetGlobalServer()
- * FUNCTION
- * Allocates a global (process-wide) server, or returns pointer if pre-existing.
- * INPUTS
- * none
- * RESULT
- * pointer to global server, or 0 if error.
- * NOTES
- * ***WARNING*** This function is not thread safe. It is included only for the very lazy.
- * Multi-threaded programs that use this may experience problems.
- * BUGS
- * There is currently no way to cleanup the global server gracefully.
- * SEE ALSO
- * XMLRPC_ServerCreate ()
- * SOURCE
- */
-XMLRPC_SERVER XMLRPC_GetGlobalServer() {
- static XMLRPC_SERVER xsServer = 0;
- if(!xsServer) {
- xsServer = XMLRPC_ServerCreate();
- }
- return xsServer;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_ServerDestroy
- * NAME
- * XMLRPC_ServerDestroy
- * SYNOPSIS
- * void XMLRPC_ServerDestroy(XMLRPC_SERVER server)
- * FUNCTION
- * Free Server Resources
- * INPUTS
- * server The server to be free'd
- * RESULT
- * void
- * NOTES
- * This frees the server struct and any methods that have been added.
- * SEE ALSO
- * XMLRPC_ServerCreate ()
- * SOURCE
- */
-void XMLRPC_ServerDestroy(XMLRPC_SERVER server) {
- if(server) {
- doc_method* dm = Q_Head(&server->docslist);
- server_method* sm = Q_Head(&server->methodlist);
- while( dm ) {
- my_free(dm);
- dm = Q_Next(&server->docslist);
- }
- while( sm ) {
- if(sm->name) {
- my_free(sm->name);
- }
- if(sm->desc) {
- XMLRPC_CleanupValue(sm->desc);
- }
- my_free(sm);
- sm = Q_Next(&server->methodlist);
- }
- if(server->xIntrospection) {
- XMLRPC_CleanupValue(server->xIntrospection);
- }
-
- Q_Destroy(&server->methodlist);
- Q_Destroy(&server->docslist);
- my_free(server);
- }
-}
-
-/*******/
-
-
-/****f* VALUE/XMLRPC_ServerRegisterMethod
- * NAME
- * XMLRPC_ServerRegisterMethod
- * SYNOPSIS
- * void XMLRPC_ServerRegisterMethod(XMLRPC_SERVER server, const char *name, XMLRPC_Callback cb)
- * FUNCTION
- * Register new XMLRPC method with server
- * INPUTS
- * server The XMLRPC_SERVER to register the method with
- * name public name of the method
- * cb C function that implements the method
- * RESULT
- * int - 1 if success, else 0
- * NOTES
- * A C function must be registered for every "method" that the server recognizes. The
- * method name is equivalent to <methodCall><name> method name </name></methodCall> in the
- * XML syntax.
- * SEE ALSO
- * XMLRPC_ServerFindMethod ()
- * XMLRPC_ServerCallMethod ()
- * SOURCE
- */
-int XMLRPC_ServerRegisterMethod(XMLRPC_SERVER server, const char *name, XMLRPC_Callback cb) {
- if(server && name && cb) {
-
- server_method* sm = malloc(sizeof(server_method));
-
- if(sm) {
- sm->name = strdup(name);
- sm->method = cb;
- sm->desc = NULL;
-
- return Q_PushTail(&server->methodlist, sm);
- }
- }
- return 0;
-}
-
-/*******/
-
-server_method* find_method(XMLRPC_SERVER server, const char* name) {
- server_method* sm;
-
- q_iter qi = Q_Iter_Head_F(&server->methodlist);
-
- while( qi ) {
- sm = Q_Iter_Get_F(qi);
- if(sm && !strcmp(sm->name, name)) {
- return sm;
- }
- qi = Q_Iter_Next_F(qi);
- }
- return NULL;
-}
-
-
-const char* type_to_str(XMLRPC_VALUE_TYPE type, XMLRPC_VECTOR_TYPE vtype) {
- switch(type) {
- case xmlrpc_none:
- return "none";
- case xmlrpc_empty:
- return "empty";
- case xmlrpc_base64:
- return "base64";
- case xmlrpc_boolean:
- return "boolean";
- case xmlrpc_datetime:
- return "datetime";
- case xmlrpc_double:
- return "double";
- case xmlrpc_int:
- return "int";
- case xmlrpc_string:
- return "string";
- case xmlrpc_vector:
- switch(vtype) {
- case xmlrpc_vector_none:
- return "none";
- case xmlrpc_vector_array:
- return "array";
- case xmlrpc_vector_mixed:
- return "mixed vector (struct)";
- case xmlrpc_vector_struct:
- return "struct";
- }
- }
-}
-
-/****f* VALUE/XMLRPC_ServerFindMethod
- * NAME
- * XMLRPC_ServerFindMethod
- * SYNOPSIS
- * XMLRPC_Callback XMLRPC_ServerFindMethod(XMLRPC_SERVER server, const char* callName)
- * FUNCTION
- * retrieve C callback associated with a given method name.
- * INPUTS
- * server The XMLRPC_SERVER the method is registered with
- * callName the method to find
- * RESULT
- * previously registered XMLRPC_Callback, or NULL
- * NOTES
- * Typically, this is used to determine if a requested method exists, without actually calling it.
- * SEE ALSO
- * XMLRPC_ServerCallMethod ()
- * XMLRPC_ServerRegisterMethod ()
- * SOURCE
- */
-XMLRPC_Callback XMLRPC_ServerFindMethod(XMLRPC_SERVER server, const char* callName) {
- if(server && callName) {
- q_iter qi = Q_Iter_Head_F(&server->methodlist);
- while( qi ) {
- server_method* sm = Q_Iter_Get_F(qi);
- if(sm && !strcmp(sm->name, callName)) {
- return sm->method;
- }
- qi = Q_Iter_Next_F(qi);
- }
- }
- return NULL;
-}
-
-/*******/
-
-
-/* Call method specified in request */
-/****f* VALUE/XMLRPC_ServerCallMethod
- * NAME
- * XMLRPC_ServerCallMethod
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_ServerCallMethod(XMLRPC_SERVER server, XMLRPC_REQUEST request, void* userData)
- * FUNCTION
- *
- * INPUTS
- * server The XMLRPC_SERVER the method is registered with
- * request the request to handle
- * userData any additional data to pass to the C callback, or NULL
- * RESULT
- * XMLRPC_VALUE allocated by the callback, or NULL
- * NOTES
- * It is typically the caller's responsibility to free the returned value.
- *
- * Often the caller will want to serialize the result as XML, via
- * XMLRPC_VALUE_To_XML () or XMLRPC_REQUEST_To_XML ()
- * SEE ALSO
- * XMLRPC_ServerFindMethod ()
- * XMLRPC_ServerRegisterMethod ()
- * XMLRPC_CleanupValue ()
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_ServerCallMethod(XMLRPC_SERVER server, XMLRPC_REQUEST request, void* userData) {
- XMLRPC_VALUE xReturn = NULL;
-
- /* check for error set during request parsing / generation */
- if(request && request->error) {
- xReturn = XMLRPC_CopyValue(request->error);
- }
- else if (server && request) {
- XMLRPC_Callback cb =
- XMLRPC_ServerFindMethod (server, request->methodName.str);
- if(cb) {
- xReturn = cb(server, request, userData);
- }
- else {
- xReturn =
- XMLRPC_UtilityCreateFault (xmlrpc_error_unknown_method,
- request->methodName.str);
- }
- }
- return xReturn;
-}
-
-/*******/
-
-/*-*****************
-* End server funcs *
-*******************/
-
-
-/*-***********************************
-* Begin XMLRPC General Options funcs *
-*************************************/
-
-/* For options used by XMLRPC_VALUE funcs that otherwise do not have
- * parameters for options. Kind of gross. :(
- */
-typedef struct _xmlrpc_options {
- XMLRPC_CASE id_case;
- XMLRPC_CASE_COMPARISON id_case_compare;
-}
-STRUCT_XMLRPC_OPTIONS, *XMLRPC_OPTIONS;
-
-static XMLRPC_OPTIONS XMLRPC_GetDefaultOptions() {
- static STRUCT_XMLRPC_OPTIONS options = {
- xmlrpc_case_exact,
- xmlrpc_case_sensitive
- };
- return &options;
-}
-
-/****f* VALUE/XMLRPC_GetDefaultIdCase
- * NAME
- * XMLRPC_GetDefaultIdCase
- * SYNOPSIS
- * XMLRPC_CASE XMLRPC_GetDefaultIdCase()
- * FUNCTION
- * Gets default case options used by XMLRPC_VALUE funcs
- * INPUTS
- * none
- * RESULT
- * XMLRPC_CASE
- * BUGS
- * Nasty and gross. Should be server specific, but that requires changing all
- * the XMLRPC_VALUE api's.
- * SEE ALSO
- * XMLRPC_SetDefaultIdCase ()
- * SOURCE
- */
-XMLRPC_CASE XMLRPC_GetDefaultIdCase() {
- XMLRPC_OPTIONS options = XMLRPC_GetDefaultOptions();
- return options->id_case;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_SetDefaultIdCase
- * NAME
- * XMLRPC_SetDefaultIdCase
- * SYNOPSIS
- * XMLRPC_CASE XMLRPC_SetDefaultIdCase(XMLRPC_CASE id_case)
- * FUNCTION
- * Sets default case options used by XMLRPC_VALUE funcs
- * INPUTS
- * id_case case options as enumerated by XMLRPC_CASE
- * RESULT
- * XMLRPC_CASE -- newly set option
- * BUGS
- * Nasty and gross. Should be server specific, but that requires changing all
- * the XMLRPC_VALUE api's.
- * SEE ALSO
- * XMLRPC_GetDefaultIdCase ()
- * SOURCE
- */
-XMLRPC_CASE XMLRPC_SetDefaultIdCase(XMLRPC_CASE id_case) {
- XMLRPC_OPTIONS options = XMLRPC_GetDefaultOptions();
- options->id_case = id_case;
- return options->id_case;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_GetDefaultIdCaseComparison
- * NAME
- * XMLRPC_GetDefaultIdCaseComparison
- * SYNOPSIS
- * XMLRPC_CASE XMLRPC_GetDefaultIdCaseComparison( )
- * FUNCTION
- * Gets default case comparison options used by XMLRPC_VALUE funcs
- * INPUTS
- * none
- * RESULT
- * XMLRPC_CASE_COMPARISON default
- * BUGS
- * Nasty and gross. Should be server specific, but that requires changing all
- * the XMLRPC_VALUE api's.
- * SEE ALSO
- * XMLRPC_SetDefaultIdCaseComparison ()
- * SOURCE
- */
-XMLRPC_CASE_COMPARISON XMLRPC_GetDefaultIdCaseComparison() {
- XMLRPC_OPTIONS options = XMLRPC_GetDefaultOptions();
- return options->id_case_compare;
-}
-
-/*******/
-
-/****f* VALUE/XMLRPC_SetDefaultIdCaseComparison
- * NAME
- * XMLRPC_SetDefaultIdCaseComparison
- * SYNOPSIS
- * XMLRPC_CASE XMLRPC_SetDefaultIdCaseComparison( XMLRPC_CASE_COMPARISON id_case_compare )
- * FUNCTION
- * Gets default case comparison options used by XMLRPC_VALUE funcs
- * INPUTS
- * id_case_compare case comparison rule to set as default
- * RESULT
- * XMLRPC_CASE_COMPARISON newly set default
- * BUGS
- * Nasty and gross. Should be server specific, but that requires changing all
- * the XMLRPC_VALUE api's.
- * SEE ALSO
- * XMLRPC_GetDefaultIdCaseComparison ()
- * SOURCE
- */
-XMLRPC_CASE_COMPARISON XMLRPC_SetDefaultIdCaseComparison(XMLRPC_CASE_COMPARISON id_case_compare) {
- XMLRPC_OPTIONS options = XMLRPC_GetDefaultOptions();
- options->id_case_compare = id_case_compare;
- return options->id_case_compare;
-}
-
-/*******/
-
-/*-*********************************
-* End XMLRPC General Options funcs *
-***********************************/
-
-
-/*-******************
-* Fault API funcs *
-********************/
-
-/****f* UTILITY/XMLRPC_UtilityCreateFault
- * NAME
- * XMLRPC_UtilityCreateFault
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_UtilityCreateFault( int fault_code, const char* fault_string )
- * FUNCTION
- * generates a struct containing a string member with id "faultString" and an int member
- * with id "faultCode". When using the xmlrpc xml serialization, these will be translated
- * to <fault><value><struct>... format.
- * INPUTS
- * fault_code application specific error code. can be 0.
- * fault_string application specific error string. cannot be null.
- * RESULT
- * XMLRPC_VALUE a newly created struct vector representing the error, or null on error.
- * NOTES
- * This is a utility function. xmlrpc "faults" are not directly represented in this xmlrpc
- * API or data structures. It is the author's view, that this API is intended for simple
- * data types, and a "fault" is a complex data type consisting of multiple simple data
- * types. This function is provided for convenience only, the same result could be
- * achieved directly by the application.
- *
- * This function now supports some "standardized" fault codes, as specified at.
- * http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php.
- * If one of these fault codes is received, the description string will automatically
- * be prefixed with a standard error string and 2 newlines.
- *
- * The actual transformation between this complex type and the xml "<fault>" element takes
- * place in the xmlrpc to xml serialization layer. This step is not performed when using the
- * simplerpc serialization, meaning that there will be no "<fault>" element in that
- * serialization. There will simply be a standard struct with 2 child elements.
- * imho, the "<fault>" element is unnecessary and/or out of place as part of the standard API.
- *
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_UtilityCreateFault(int fault_code, const char* fault_string) {
- XMLRPC_VALUE xOutput = NULL;
-
- char* string = NULL;
- simplestring description;
- simplestring_init(&description);
-
- switch (fault_code) {
- case xmlrpc_error_parse_xml_syntax:
- string = xmlrpc_error_parse_xml_syntax_str;
- break;
- case xmlrpc_error_parse_unknown_encoding:
- string = xmlrpc_error_parse_unknown_encoding_str;
- break;
- case xmlrpc_error_parse_bad_encoding:
- string = xmlrpc_error_parse_bad_encoding_str;
- break;
- case xmlrpc_error_invalid_xmlrpc:
- string = xmlrpc_error_invalid_xmlrpc_str;
- break;
- case xmlrpc_error_unknown_method:
- string = xmlrpc_error_unknown_method_str;
- break;
- case xmlrpc_error_invalid_params:
- string = xmlrpc_error_invalid_params_str;
- break;
- case xmlrpc_error_internal_server:
- string = xmlrpc_error_internal_server_str;
- break;
- case xmlrpc_error_application:
- string = xmlrpc_error_application_str;
- break;
- case xmlrpc_error_system:
- string = xmlrpc_error_system_str;
- break;
- case xmlrpc_error_transport:
- string = xmlrpc_error_transport_str;
- break;
- }
-
- simplestring_add(&description, string);
-
- if(string && fault_string) {
- simplestring_add(&description, "\n\n");
- }
- simplestring_add(&description, fault_string);
-
-
- if(description.len) {
- xOutput = XMLRPC_CreateVector(NULL, xmlrpc_vector_struct);
-
- XMLRPC_VectorAppendString (xOutput, "faultString", description.str,
- description.len);
- XMLRPC_VectorAppendInt(xOutput, "faultCode", fault_code);
- }
-
- simplestring_free(&description);
-
- return xOutput;
-}
-
-/*******/
-
-
-/****f* FAULT/XMLRPC_ValueIsFault
- * NAME
- * XMLRPC_ValueIsFault
- * SYNOPSIS
- * int XMLRPC_ValueIsFault (XMLRPC_VALUE value)
- * FUNCTION
- * Determines if a value encapsulates a fault "object"
- * INPUTS
- * value any XMLRPC_VALUE
- * RESULT
- * 1 if it is a fault, else 0
- * SEE ALSO
- * XMLRPC_ResponseIsFault ()
- * SOURCE
- */
-int XMLRPC_ValueIsFault (XMLRPC_VALUE value) {
- if( XMLRPC_VectorGetValueWithID(value, "faultCode") &&
- XMLRPC_VectorGetValueWithID(value, "faultString") ) {
- return 1;
- }
- return 0;
-}
-/*******/
-
-
-/****f* FAULT/XMLRPC_ResponseIsFault
- * NAME
- * XMLRPC_ResponseIsFault
- * SYNOPSIS
- * int XMLRPC_ResponseIsFault (XMLRPC_REQUEST response)
- * FUNCTION
- * Determines if a response contains an encapsulated fault "object"
- * INPUTS
- * value any XMLRPC_REQUEST. typically of type xmlrpc_request_response
- * RESULT
- * 1 if it contains a fault, else 0
- * SEE ALSO
- * XMLRPC_ValueIsFault ()
- * SOURCE
- */
-int XMLRPC_ResponseIsFault(XMLRPC_REQUEST response) {
- return XMLRPC_ValueIsFault( XMLRPC_RequestGetData(response) );
-}
-
-/*******/
-
-/****f* FAULT/XMLRPC_GetValueFaultCode
- * NAME
- * XMLRPC_GetValueFaultCode
- * SYNOPSIS
- * int XMLRPC_GetValueFaultCode (XMLRPC_VALUE value)
- * FUNCTION
- * returns fault code from a struct, if any
- * INPUTS
- * value XMLRPC_VALUE of type xmlrpc_vector_struct.
- * RESULT
- * fault code, else 0.
- * BUGS
- * impossible to distinguish faultCode == 0 from faultCode not present.
- * SEE ALSO
- * XMLRPC_GetResponseFaultCode ()
- * SOURCE
- */
-int XMLRPC_GetValueFaultCode (XMLRPC_VALUE value) {
- return XMLRPC_VectorGetIntWithID(value, "faultCode");
-}
-
-/*******/
-
-/****f* FAULT/XMLRPC_GetResponseFaultCode
- * NAME
- * XMLRPC_GetResponseFaultCode
- * SYNOPSIS
- * int XMLRPC_GetResponseFaultCode(XMLRPC_REQUEST response)
- * FUNCTION
- * returns fault code from a response, if any
- * INPUTS
- * response XMLRPC_REQUEST. typically of type xmlrpc_request_response.
- * RESULT
- * fault code, else 0.
- * BUGS
- * impossible to distinguish faultCode == 0 from faultCode not present.
- * SEE ALSO
- * XMLRPC_GetValueFaultCode ()
- * SOURCE
- */
-int XMLRPC_GetResponseFaultCode(XMLRPC_REQUEST response) {
- return XMLRPC_GetValueFaultCode( XMLRPC_RequestGetData(response) );
-}
-
-/*******/
-
-
-/****f* FAULT/XMLRPC_GetValueFaultString
- * NAME
- * XMLRPC_GetValueFaultString
- * SYNOPSIS
- * const char* XMLRPC_GetValueFaultString (XMLRPC_VALUE value)
- * FUNCTION
- * returns fault string from a struct, if any
- * INPUTS
- * value XMLRPC_VALUE of type xmlrpc_vector_struct.
- * RESULT
- * fault string, else 0.
- * SEE ALSO
- * XMLRPC_GetResponseFaultString ()
- * SOURCE
- */
-const char* XMLRPC_GetValueFaultString (XMLRPC_VALUE value) {
- return XMLRPC_VectorGetStringWithID(value, "faultString");
-}
-
-/*******/
-
-/****f* FAULT/XMLRPC_GetResponseFaultString
- * NAME
- * XMLRPC_GetResponseFaultString
- * SYNOPSIS
- * const char* XMLRPC_GetResponseFaultString (XMLRPC_REQUEST response)
- * FUNCTION
- * returns fault string from a response, if any
- * INPUTS
- * response XMLRPC_REQUEST. typically of type xmlrpc_request_response.
- * RESULT
- * fault string, else 0.
- * SEE ALSO
- * XMLRPC_GetValueFaultString ()
- * SOURCE
- */
-const char* XMLRPC_GetResponseFaultString (XMLRPC_REQUEST response) {
- return XMLRPC_GetValueFaultString( XMLRPC_RequestGetData(response) );
-}
-
-/*******/
-
-
-/*-******************
-* Utility API funcs *
-********************/
-
-
-/****f* UTILITY/XMLRPC_Free
- * NAME
- * XMLRPC_Free
- * SYNOPSIS
- * void XMLRPC_Free(void* mem)
- * FUNCTION
- * frees a block of memory allocated by xmlrpc.
- * INPUTS
- * mem memory to free
- * RESULT
- * void
- * NOTES
- * Useful for OS's where memory must be free'd
- * in the same library in which it is allocated.
- * SOURCE
- */
-void XMLRPC_Free(void* mem) {
- my_free(mem);
-}
-
-/*******/
-
-
-/****f* UTILITY/XMLRPC_GetVersionString
- * NAME
- * XMLRPC_GetVersionString
- * SYNOPSIS
- * const char* XMLRPC_GetVersionString()
- * FUNCTION
- * returns library version string
- * INPUTS
- *
- * RESULT
- * const char*
- * NOTES
- * SOURCE
- */
-const char* XMLRPC_GetVersionString() {
- return XMLRPC_VERSION_STR;
-}
-
-/*******/
-
-
-/*-**********************
-* End Utility API funcs *
-************************/
diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc.h b/ext/xmlrpc/libxmlrpc/xmlrpc.h
deleted file mode 100644
index dde3d5e122..0000000000
--- a/ext/xmlrpc/libxmlrpc/xmlrpc.h
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-#ifndef XMLRPC_ALREADY_INCLUDED
-#define XMLRPC_ALREADY_INCLUDED 1
-
-/* includes */
-#include "xml_element.h"
-#include <time.h> /* for time_t */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* allow version to be specified via compile line define */
-#ifndef XMLRPC_LIB_VERSION
- #define XMLRPC_LIB_VERSION "0.51"
-#endif
-
-/* this number, representing the date, must be increased each time the API changes */
-#define XMLRPC_API_NO 20020623
-
-/* this string should be changed with each packaged release */
-#define XMLRPC_VERSION_STR "xmlrpc-epi v. " XMLRPC_LIB_VERSION
-
-/* where to find more info. shouldn't need to change much */
-#define XMLRPC_HOME_PAGE_STR "http://xmlprc-epi.sourceforge.net/"
-
-
-/****d* VALUE/XMLRPC_VALUE_TYPE
- * NAME
- * XMLRPC_VALUE_TYPE
- * NOTES
- * Defines data types for XMLRPC_VALUE
- * Deprecated for public use. See XMLRPC_VALUE_TYPE_EASY
- * SEE ALSO
- * XMLRPC_VECTOR_TYPE
- * XMLRPC_REQUEST_TYPE
- * SOURCE
- */
-typedef enum _XMLRPC_VALUE_TYPE {
- xmlrpc_none, /* not a value */
- xmlrpc_empty, /* empty value, eg NULL */
- xmlrpc_base64, /* base64 value, eg binary data */
- xmlrpc_boolean, /* boolean [0 | 1] */
- xmlrpc_datetime, /* datetime [ISO8601 | time_t] */
- xmlrpc_double, /* double / floating point */
- xmlrpc_int, /* integer */
- xmlrpc_string, /* string */
- xmlrpc_vector /* vector, aka list, array */
-} XMLRPC_VALUE_TYPE;
-/*******/
-
-/****d* VALUE/XMLRPC_VECTOR_TYPE
- * NAME
- * XMLRPC_VECTOR_TYPE
- * NOTES
- * Defines data types for XMLRPC_VECTOR.
- * Deprecated for public use. See XMLRPC_VALUE_TYPE_EASY
- * SEE ALSO
- * XMLRPC_VALUE_TYPE
- * XMLRPC_REQUEST_TYPE
- * SOURCE
- */
-typedef enum _XMLRPC_VECTOR_TYPE {
- xmlrpc_vector_none, /* not an array */
- xmlrpc_vector_array, /* no values may have key names */
- xmlrpc_vector_mixed, /* some values may have key names */
- xmlrpc_vector_struct /* all values must have key names */
-} XMLRPC_VECTOR_TYPE;
-/*******/
-
-/****d* VALUE/XMLRPC_VALUE_TYPE_EASY
- * NAME
- * XMLRPC_VALUE_TYPE_EASY
- * NOTES
- * Defines data types for XMLRPC_VALUE, including vector types.
- * SEE ALSO
- * XMLRPC_VECTOR_TYPE
- * XMLRPC_REQUEST_TYPE
- * SOURCE
- */
-typedef enum _XMLRPC_VALUE_TYPE_EASY {
- xmlrpc_type_none, /* not a value */
- xmlrpc_type_empty, /* empty value, eg NULL */
- xmlrpc_type_base64, /* base64 value, eg binary data */
- xmlrpc_type_boolean, /* boolean [0 | 1] */
- xmlrpc_type_datetime, /* datetime [ISO8601 | time_t] */
- xmlrpc_type_double, /* double / floating point */
- xmlrpc_type_int, /* integer */
- xmlrpc_type_string, /* string */
-/* -- IMPORTANT: identical to XMLRPC_VALUE_TYPE to this point. -- */
- xmlrpc_type_array, /* vector array */
- xmlrpc_type_mixed, /* vector mixed */
- xmlrpc_type_struct /* vector struct */
-} XMLRPC_VALUE_TYPE_EASY;
-/*******/
-
-
-/****d* VALUE/XMLRPC_REQUEST_TYPE
- * NAME
- * XMLRPC_REQUEST_TYPE
- * NOTES
- * Defines data types for XMLRPC_REQUEST
- * SEE ALSO
- * XMLRPC_VALUE_TYPE
- * XMLRPC_VECTOR_TYPE
- * SOURCE
- */
-typedef enum _xmlrpc_request_type {
- xmlrpc_request_none, /* not a valid request */
- xmlrpc_request_call, /* calling/invoking a method */
- xmlrpc_request_response, /* responding to a method call */
-} XMLRPC_REQUEST_TYPE;
-/*******/
-
-/****d* VALUE/XMLRPC_ERROR_CODE
- * NAME
- * XMLRPC_ERROR_CODE
- * NOTES
- * All existing error codes
- * SEE ALSO
- * XMLRPC_REQUEST_ERROR
- * SOURCE
- */
-typedef enum _xmlrpc_error_code {
- xmlrpc_error_none = 0, /* not an error */
- xmlrpc_error_parse_xml_syntax = -32700,
- xmlrpc_error_parse_unknown_encoding = -32701,
- xmlrpc_error_parse_bad_encoding = -32702,
- xmlrpc_error_invalid_xmlrpc = -32600,
- xmlrpc_error_unknown_method = -32601,
- xmlrpc_error_invalid_params = -32602,
- xmlrpc_error_internal_server = -32603,
- xmlrpc_error_application = -32500,
- xmlrpc_error_system = -32400,
- xmlrpc_error_transport = -32300
-} XMLRPC_ERROR_CODE;
-/******/
-
-#define xmlrpc_error_parse_xml_syntax_str "parse error. not well formed."
-#define xmlrpc_error_parse_unknown_encoding_str "parse error. unknown encoding"
-#define xmlrpc_error_parse_bad_encoding_str "parse error. invalid character for encoding"
-#define xmlrpc_error_invalid_xmlrpc_str "server error. xml-rpc not conforming to spec"
-#define xmlrpc_error_unknown_method_str "server error. method not found."
-#define xmlrpc_error_invalid_params_str "server error. invalid method parameters"
-#define xmlrpc_error_internal_server_str "server error. internal xmlrpc library error"
-#define xmlrpc_error_application_str "application error."
-#define xmlrpc_error_system_str "system error."
-#define xmlrpc_error_transport_str "transport error."
-
-
-
-/****d* VALUE/XMLRPC_VERSION
- * NAME
- * XMLRPC_VERSION
- * NOTES
- * Defines xml vocabulary used for generated xml
- * SEE ALSO
- * XMLRPC_REQUEST_OUTPUT_OPTIONS
- * XMLRPC_REQUEST_To_XML ()
- * SOURCE
- */
-typedef enum _xmlrpc_version {
- xmlrpc_version_none = 0, /* not a recognized vocabulary */
- xmlrpc_version_1_0 = 1, /* xmlrpc 1.0 standard vocab */
- xmlrpc_version_simple = 2, /* alt more readable vocab */
- xmlrpc_version_danda = 2, /* same as simple. legacy */
- xmlrpc_version_soap_1_1 = 3 /* SOAP. version 1.1 */
-} XMLRPC_VERSION;
-/******/
-
-/****s* VALUE/XMLRPC_REQUEST_OUTPUT_OPTIONS
- * NAME
- * XMLRPC_REQUEST_OUTPUT_OPTIONS
- * NOTES
- * Defines output options for generated xml
- * SEE ALSO
- * XMLRPC_VERSION
- * XML_ELEM_OUTPUT_OPTIONS
- * XMLRPC_REQUEST_To_XML ()
- * SOURCE
- */
-typedef struct _xmlrpc_request_output_options {
- STRUCT_XML_ELEM_OUTPUT_OPTIONS xml_elem_opts; /* xml_element specific output options */
- XMLRPC_VERSION version; /* xml vocabulary to use */
-} STRUCT_XMLRPC_REQUEST_OUTPUT_OPTIONS, *XMLRPC_REQUEST_OUTPUT_OPTIONS;
-/******/
-
-/****s* VALUE/XMLRPC_REQUEST_INPUT_OPTIONS
- * NAME
- * XMLRPC_REQUEST_INPUT_OPTIONS
- * NOTES
- * Defines options for reading in xml data
- * SEE ALSO
- * XMLRPC_VERSION
- * XML_ELEM_INPUT_OPTIONS
- * XMLRPC_REQUEST_From_XML ()
- * SOURCE
- */
-typedef struct _xmlrpc_request_input_options {
- STRUCT_XML_ELEM_INPUT_OPTIONS xml_elem_opts; /* xml_element specific output options */
-} STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS, *XMLRPC_REQUEST_INPUT_OPTIONS;
-/******/
-
-/****s* VALUE/XMLRPC_ERROR
- * NAME
- * XMLRPC_ERROR
- * NOTES
- * For the reporting and handling of errors
- * SOURCE
- */
-typedef struct _xmlrpc_error {
- XMLRPC_ERROR_CODE code;
- STRUCT_XML_ELEM_ERROR xml_elem_error; /* xml_element errors (parser errors) */
-} STRUCT_XMLRPC_ERROR, *XMLRPC_ERROR;
-/******/
-
-
-/****d* VALUE/XMLRPC_CASE_COMPARISON
- * NAME
- * XMLRPC_CASE_COMPARISON
- * NOTES
- * Defines case comparison options for XMLRPC_VALUE/VECTOR API's
- * SEE ALSO
- * XMLRPC_CASE
- * XMLRPC_VALUE
- * SOURCE
- */
-typedef enum _xmlrpc_case_comparison {
- xmlrpc_case_insensitive, /* use case-insensitive compare */
- xmlrpc_case_sensitive /* use case-sensitive compare */
-} XMLRPC_CASE_COMPARISON;
-/******/
-
-/****d* VALUE/XMLRPC_CASE
- * NAME
- * XMLRPC_CASE
- * NOTES
- * Defines case behavior when setting IDs in XMLRPC_VALUE API's
- * SEE ALSO
- * XMLRPC_CASE_COMPARISON
- * XMLRPC_VALUE
- * SOURCE
- */
-typedef enum _xmlrpc_case {
- xmlrpc_case_exact, /* leave case alone */
- xmlrpc_case_lower, /* lower-case id */
- xmlrpc_case_upper /* upper-case id */
-} XMLRPC_CASE;
-/******/
-
-/* if you don't like these defaults, you can set them with XMLRPC_SetDefaultIdCase*() */
-#define XMLRPC_DEFAULT_ID_CASE XMLRPC_GetDefaultIdCase()
-#define XMLRPC_DEFAULT_ID_CASE_SENSITIVITY XMLRPC_GetDefaultIdCaseComparison()
-
-/* opaque (non-public) types. defined locally in xmlrpc.c */
-typedef struct _xmlrpc_request* XMLRPC_REQUEST;
-typedef struct _xmlrpc_server* XMLRPC_SERVER;
-typedef struct _xmlrpc_value* XMLRPC_VALUE;
-
-/****d* VALUE/XMLRPC_Callback
- * NAME
- * XMLRPC_Callback
- * NOTES
- * Function prototype for user defined method handlers (callbacks).
- * SEE ALSO
- * XMLRPC_ServerRegisterMethod ()
- * XMLRPC_ServerCallMethod ()
- * XMLRPC_REQUEST
- * XMLRPC_VALUE
- * SOURCE
- */
-typedef XMLRPC_VALUE (*XMLRPC_Callback)(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData);
-/******/
-
-/* ID Case Defaults */
-XMLRPC_CASE XMLRPC_GetDefaultIdCase(void);
-XMLRPC_CASE XMLRPC_SetDefaultIdCase(XMLRPC_CASE id_case);
-XMLRPC_CASE_COMPARISON XMLRPC_GetDefaultIdCaseComparison(void);
-XMLRPC_CASE_COMPARISON XMLRPC_SetDefaultIdCaseComparison(XMLRPC_CASE_COMPARISON id_case);
-
-/* Vector manipulation */
-int XMLRPC_VectorSize(XMLRPC_VALUE value);
-XMLRPC_VALUE XMLRPC_VectorRewind(XMLRPC_VALUE value);
-XMLRPC_VALUE XMLRPC_VectorNext(XMLRPC_VALUE value);
-int XMLRPC_SetIsVector(XMLRPC_VALUE value, XMLRPC_VECTOR_TYPE type);
-int XMLRPC_AddValueToVector(XMLRPC_VALUE target, XMLRPC_VALUE source);
-int XMLRPC_AddValuesToVector(XMLRPC_VALUE target, ...);
-int XMLRPC_VectorRemoveValue(XMLRPC_VALUE vector, XMLRPC_VALUE value);
-XMLRPC_VALUE XMLRPC_VectorGetValueWithID_Case(XMLRPC_VALUE vector, const char* id, XMLRPC_CASE_COMPARISON id_case);
-
-
-/* Create values */
-XMLRPC_VALUE XMLRPC_CreateValueBoolean(const char* id, int truth);
-XMLRPC_VALUE XMLRPC_CreateValueBase64(const char* id, const char* s, int len);
-XMLRPC_VALUE XMLRPC_CreateValueDateTime(const char* id, time_t time);
-XMLRPC_VALUE XMLRPC_CreateValueDateTime_ISO8601(const char* id, const char *s);
-XMLRPC_VALUE XMLRPC_CreateValueDouble(const char* id, double f);
-XMLRPC_VALUE XMLRPC_CreateValueInt(const char* id, int i);
-XMLRPC_VALUE XMLRPC_CreateValueString(const char* id, const char* s, int len);
-XMLRPC_VALUE XMLRPC_CreateValueEmpty(void);
-XMLRPC_VALUE XMLRPC_CreateVector(const char* id, XMLRPC_VECTOR_TYPE type);
-
-/* Cleanup values */
-void XMLRPC_CleanupValue(XMLRPC_VALUE value);
-
-/* Request error */
-XMLRPC_VALUE XMLRPC_RequestSetError (XMLRPC_REQUEST request, XMLRPC_VALUE error);
-XMLRPC_VALUE XMLRPC_RequestGetError (XMLRPC_REQUEST request);
-
-/* Copy values */
-XMLRPC_VALUE XMLRPC_CopyValue(XMLRPC_VALUE value);
-XMLRPC_VALUE XMLRPC_DupValueNew(XMLRPC_VALUE xSource);
-
-/* Set Values */
-void XMLRPC_SetValueDateTime(XMLRPC_VALUE value, time_t time);
-void XMLRPC_SetValueDateTime_ISO8601(XMLRPC_VALUE value, const char* s);
-void XMLRPC_SetValueDouble(XMLRPC_VALUE value, double val);
-void XMLRPC_SetValueInt(XMLRPC_VALUE value, int val);
-void XMLRPC_SetValueBoolean(XMLRPC_VALUE value, int val);
-const char *XMLRPC_SetValueString(XMLRPC_VALUE value, const char* s, int len);
-void XMLRPC_SetValueBase64(XMLRPC_VALUE value, const char* s, int len);
-const char *XMLRPC_SetValueID_Case(XMLRPC_VALUE value, const char* id, int len, XMLRPC_CASE id_case);
-#define XMLRPC_SetValueID(value, id, len) XMLRPC_SetValueID_Case(value, id, len, XMLRPC_DEFAULT_ID_CASE)
-
-/* Get Values */
-const char* XMLRPC_GetValueString(XMLRPC_VALUE value);
-int XMLRPC_GetValueStringLen(XMLRPC_VALUE value);
-int XMLRPC_GetValueInt(XMLRPC_VALUE value);
-int XMLRPC_GetValueBoolean(XMLRPC_VALUE value);
-double XMLRPC_GetValueDouble(XMLRPC_VALUE value);
-const char* XMLRPC_GetValueBase64(XMLRPC_VALUE value);
-time_t XMLRPC_GetValueDateTime(XMLRPC_VALUE value);
-const char* XMLRPC_GetValueDateTime_ISO8601(XMLRPC_VALUE value);
-const char* XMLRPC_GetValueID(XMLRPC_VALUE value);
-
-/* Type introspection */
-XMLRPC_VALUE_TYPE XMLRPC_GetValueType(XMLRPC_VALUE v);
-XMLRPC_VALUE_TYPE_EASY XMLRPC_GetValueTypeEasy(XMLRPC_VALUE v);
-XMLRPC_VECTOR_TYPE XMLRPC_GetVectorType(XMLRPC_VALUE v);
-
-/* Parsing and Creating XML */
-XMLRPC_REQUEST XMLRPC_REQUEST_FromXML(const char* in_buf, int len, XMLRPC_REQUEST_INPUT_OPTIONS in_options);
-XMLRPC_VALUE XMLRPC_VALUE_FromXML(const char* in_buf, int len, XMLRPC_REQUEST_INPUT_OPTIONS in_options);
-char* XMLRPC_REQUEST_ToXML(XMLRPC_REQUEST request, int *buf_len);
-char* XMLRPC_VALUE_ToXML(XMLRPC_VALUE val, int* buf_len);
-
-/* Request manipulation funcs */
-const char* XMLRPC_RequestSetMethodName(XMLRPC_REQUEST request, const char* methodName);
-const char* XMLRPC_RequestGetMethodName(XMLRPC_REQUEST request);
-XMLRPC_REQUEST XMLRPC_RequestNew(void);
-void XMLRPC_RequestFree(XMLRPC_REQUEST request, int bFreeIO);
-XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestSetOutputOptions(XMLRPC_REQUEST request, XMLRPC_REQUEST_OUTPUT_OPTIONS output);
-XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestGetOutputOptions(XMLRPC_REQUEST request);
-XMLRPC_VALUE XMLRPC_RequestSetData(XMLRPC_REQUEST request, XMLRPC_VALUE data);
-XMLRPC_VALUE XMLRPC_RequestGetData(XMLRPC_REQUEST request);
-XMLRPC_REQUEST_TYPE XMLRPC_RequestSetRequestType(XMLRPC_REQUEST request, XMLRPC_REQUEST_TYPE type);
-XMLRPC_REQUEST_TYPE XMLRPC_RequestGetRequestType(XMLRPC_REQUEST request);
-
-/* Server Creation/Destruction; Method Registration and Invocation */
-XMLRPC_SERVER XMLRPC_ServerCreate(void);
-XMLRPC_SERVER XMLRPC_GetGlobalServer(void); /* better to use XMLRPC_ServerCreate if you can */
-void XMLRPC_ServerDestroy(XMLRPC_SERVER server);
-int XMLRPC_ServerRegisterMethod(XMLRPC_SERVER server, const char *name, XMLRPC_Callback cb);
-XMLRPC_Callback XMLRPC_ServerFindMethod(XMLRPC_SERVER server, const char* callName);
-XMLRPC_VALUE XMLRPC_ServerCallMethod(XMLRPC_SERVER server, XMLRPC_REQUEST request, void* userData);
-
-#include "xmlrpc_introspection.h"
-
-/* Fault interrogation funcs */
-int XMLRPC_ValueIsFault (XMLRPC_VALUE value);
-int XMLRPC_ResponseIsFault(XMLRPC_REQUEST response);
-int XMLRPC_GetValueFaultCode (XMLRPC_VALUE value);
-int XMLRPC_GetResponseFaultCode(XMLRPC_REQUEST response);
-const char* XMLRPC_GetValueFaultString (XMLRPC_VALUE value);
-const char* XMLRPC_GetResponseFaultString (XMLRPC_REQUEST response);
-
-
-/* Public Utility funcs */
-XMLRPC_VALUE XMLRPC_UtilityCreateFault(int fault_code, const char* fault_string);
-void XMLRPC_Free(void* mem);
-const char* XMLRPC_GetVersionString(void);
-
-/****d* VALUE/XMLRPC_MACROS
- * NAME
- * Some Helpful Macros
- * NOTES
- * Some macros for making life easier. Should be self-explanatory.
- * SEE ALSO
- * XMLRPC_AddValueToVector ()
- * XMLRPC_VectorGetValueWithID_Case ()
- * XMLRPC_VALUE
- * SOURCE
- */
-
-/* Append values to vector */
-#define XMLRPC_VectorAppendString(vector, id, s, len) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueString(id, s, len))
-#define XMLRPC_VectorAppendBase64(vector, id, s, len) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueBase64(id, s, len))
-#define XMLRPC_VectorAppendDateTime(vector, id, time) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueDateTime(id, time))
-#define XMLRPC_VectorAppendDateTime_ISO8601(vector, id, s) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueDateTime_ISO8601(id, s))
-#define XMLRPC_VectorAppendDouble(vector, id, f) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueDouble(id, f))
-#define XMLRPC_VectorAppendInt(vector, id, i) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueInt(id, i))
-#define XMLRPC_VectorAppendBoolean(vector, id, i) XMLRPC_AddValueToVector(vector, XMLRPC_CreateValueBoolean(id, i))
-
-/* Get named values from vector */
-#define XMLRPC_VectorGetValueWithID(vector, id) XMLRPC_VectorGetValueWithID_Case(vector, id, XMLRPC_DEFAULT_ID_CASE_SENSITIVITY)
-#define XMLRPC_VectorGetStringWithID(vector, id) XMLRPC_GetValueString(XMLRPC_VectorGetValueWithID(vector, id))
-#define XMLRPC_VectorGetBase64WithID(vector, id) XMLRPC_GetValueBase64(XMLRPC_VectorGetValueWithID(vector, id))
-#define XMLRPC_VectorGetDateTimeWithID(vector, id) XMLRPC_GetValueDateTime(XMLRPC_VectorGetValueWithID(vector, id))
-#define XMLRPC_VectorGetDoubleWithID(vector, id) XMLRPC_GetValueDouble(XMLRPC_VectorGetValueWithID(vector, id))
-#define XMLRPC_VectorGetIntWithID(vector, id) XMLRPC_GetValueInt(XMLRPC_VectorGetValueWithID(vector, id))
-#define XMLRPC_VectorGetBooleanWithID(vector, id) XMLRPC_GetValueBoolean(XMLRPC_VectorGetValueWithID(vector, id))
-
-/******/
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* not XMLRPC_ALREADY_INCLUDED */
-
-
-
diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc.m4 b/ext/xmlrpc/libxmlrpc/xmlrpc.m4
deleted file mode 100644
index e89c245f02..0000000000
--- a/ext/xmlrpc/libxmlrpc/xmlrpc.m4
+++ /dev/null
@@ -1,12 +0,0 @@
-AC_DEFUN(XMLRPC_CHECKS,[
-
-AC_REQUIRE([AC_PROG_CC])
-AC_REQUIRE([AC_PROG_LN_S])
-AC_REQUIRE([AC_PROG_RANLIB])
-
-AC_DEFINE(UNDEF_THREADS_HACK,,[ ])
-
-XMLRPC_HEADER_CHECKS
-XMLRPC_TYPE_CHECKS
-XMLRPC_FUNCTION_CHECKS
-])
diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c b/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c
deleted file mode 100644
index bc1853ea73..0000000000
--- a/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c
+++ /dev/null
@@ -1,598 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2001 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-
-/****h* ABOUT/xmlrpc_introspection
- * AUTHOR
- * Dan Libby, aka danda (dan@libby.com)
- * HISTORY
- * $Log$
- * Revision 1.9 2001/09/29 21:58:05 danda
- * adding cvs log to history section
- *
- * 4/10/2001 -- danda -- initial introspection support
- * TODO
- * NOTES
- *******/
-
-
-#ifdef _WIN32
-#include "xmlrpc_win32.h"
-#endif
-#include "queue.h"
-#include "xmlrpc.h"
-#include "xmlrpc_private.h"
-#include "xmlrpc_introspection_private.h"
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-
-/* forward declarations for static (non public, non api) funcs */
-static XMLRPC_VALUE xi_system_describe_methods_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData);
-static XMLRPC_VALUE xi_system_list_methods_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData);
-static XMLRPC_VALUE xi_system_method_signature_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData);
-static XMLRPC_VALUE xi_system_method_help_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData);
-
-
-/*-**********************************
-* Introspection Callbacks (methods) *
-************************************/
-
-/* iterates through a list of structs and finds the one with key "name" matching
- * needle. slow, would benefit from a struct key hash.
- */
-inline XMLRPC_VALUE find_named_value(XMLRPC_VALUE list, const char* needle) {
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(list);
- while(xIter) {
- const char* name = XMLRPC_VectorGetStringWithID(xIter, xi_token_name);
- if(name && !strcmp(name, needle)) {
- return xIter;
- }
- xIter = XMLRPC_VectorNext(list);
- }
- return NULL;
-}
-
-
-/* iterates through docs callbacks and calls any that have not yet been called */
-static void check_docs_loaded(XMLRPC_SERVER server, void* userData) {
- if(server) {
- q_iter qi = Q_Iter_Head_F(&server->docslist);
- while( qi ) {
- doc_method* dm = Q_Iter_Get_F(qi);
- if(dm && !dm->b_called) {
- dm->method(server, userData);
- dm->b_called = 1;
- }
- qi = Q_Iter_Next_F(qi);
- }
- }
-}
-
-
-/* utility function for xi_system_describe_methods_cb */
-inline void describe_method(XMLRPC_SERVER server, XMLRPC_VALUE vector, const char* method) {
- if(method) {
- server_method* sm = find_method(server, method);
- if(sm) {
- XMLRPC_AddValueToVector(vector, sm->desc);
- }
- }
-}
-
-
-
-/* system.describeMethods() callback */
-static XMLRPC_VALUE xi_system_describe_methods_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData) {
- XMLRPC_VALUE xParams = XMLRPC_VectorRewind(XMLRPC_RequestGetData(input));
- XMLRPC_VALUE xResponse = XMLRPC_CreateVector(NULL, xmlrpc_vector_struct);
- XMLRPC_VALUE xMethodList = XMLRPC_CreateVector("methodList", xmlrpc_vector_array);
- XMLRPC_VALUE xTypeList = NULL;
- int bAll = 1;
-
- /* lazy loading of introspection data */
- check_docs_loaded(server, userData);
-
- xTypeList = XMLRPC_VectorGetValueWithID(server->xIntrospection, "typeList");
-
- XMLRPC_AddValueToVector(xResponse, xTypeList);
- XMLRPC_AddValueToVector(xResponse, xMethodList);
-
- /* check if we have any param */
- if(xParams) {
- /* check if string or vector (1 or n) */
- XMLRPC_VALUE_TYPE type = XMLRPC_GetValueType(xParams);
- if(type == xmlrpc_string) {
- /* just one. spit it out. */
- describe_method(server, xMethodList, XMLRPC_GetValueString(xParams));
- bAll = 0;
- }
- else if(type == xmlrpc_vector) {
- /* multiple. spit all out */
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(xParams);
- while(xIter) {
- describe_method(server, xMethodList, XMLRPC_GetValueString(xIter));
- xIter = XMLRPC_VectorNext(xParams);
- }
- bAll = 0;
- }
- }
-
- /* otherwise, default to sending all methods */
- if(bAll) {
- q_iter qi = Q_Iter_Head_F(&server->methodlist);
- while( qi ) {
- server_method* sm = Q_Iter_Get_F(qi);
- if(sm) {
- XMLRPC_AddValueToVector(xMethodList, sm->desc);
- }
- qi = Q_Iter_Next_F(qi);
- }
- }
-
- return xResponse;
-}
-
-/* this complies with system.listMethods as defined at http://xmlrpc.usefulinc.com/doc/reserved.html */
-static XMLRPC_VALUE xi_system_list_methods_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData) {
- XMLRPC_VALUE xResponse = XMLRPC_CreateVector(NULL, xmlrpc_vector_array);
-
- q_iter qi = Q_Iter_Head_F(&server->methodlist);
- while( qi ) {
- server_method* sm = Q_Iter_Get_F(qi);
- if(sm) {
- XMLRPC_VectorAppendString(xResponse, 0, sm->name, 0);
- }
- qi = Q_Iter_Next_F(qi);
- }
- return xResponse;
-}
-
-/* this complies with system.methodSignature as defined at
- * http://xmlrpc.usefulinc.com/doc/sysmethodsig.html
- */
-static XMLRPC_VALUE xi_system_method_signature_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData) {
- const char* method = XMLRPC_GetValueString(XMLRPC_VectorRewind(XMLRPC_RequestGetData(input)));
- XMLRPC_VALUE xResponse = NULL;
-
- /* lazy loading of introspection data */
- check_docs_loaded(server, userData);
-
- if(method) {
- server_method* sm = find_method(server, method);
- if(sm && sm->desc) {
- XMLRPC_VALUE xTypesArray = XMLRPC_CreateVector(NULL, xmlrpc_vector_array);
- XMLRPC_VALUE xIter, xParams, xSig, xSigIter;
- const char* type;
-
- /* array of possible signatures. */
- xResponse = XMLRPC_CreateVector(NULL, xmlrpc_vector_array);
-
- /* find first signature */
- xSig = XMLRPC_VectorGetValueWithID(sm->desc, xi_token_signatures);
- xSigIter = XMLRPC_VectorRewind( xSig );
-
- /* iterate through sigs */
- while(xSigIter) {
- /* first type is the return value */
- type = XMLRPC_VectorGetStringWithID(XMLRPC_VectorRewind(
- XMLRPC_VectorGetValueWithID(xSigIter, xi_token_returns)),
- xi_token_type);
- XMLRPC_AddValueToVector(xTypesArray,
- XMLRPC_CreateValueString(NULL,
- type ? type : type_to_str(xmlrpc_none, 0),
- 0));
-
- /* the rest are parameters */
- xParams = XMLRPC_VectorGetValueWithID(xSigIter, xi_token_params);
- xIter = XMLRPC_VectorRewind(xParams);
-
- /* iter through params, adding to types array */
- while(xIter) {
- XMLRPC_AddValueToVector(xTypesArray,
- XMLRPC_CreateValueString(NULL,
- XMLRPC_VectorGetStringWithID(xIter, xi_token_type),
- 0));
- xIter = XMLRPC_VectorNext(xParams);
- }
-
- /* add types for this signature */
- XMLRPC_AddValueToVector(xResponse, xTypesArray);
-
- xSigIter = XMLRPC_VectorNext( xSig );
- }
- }
- }
-
- return xResponse;
-}
-
-/* this complies with system.methodHelp as defined at
- * http://xmlrpc.usefulinc.com/doc/sysmethhelp.html
- */
-static XMLRPC_VALUE xi_system_method_help_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData) {
- const char* method = XMLRPC_GetValueString(XMLRPC_VectorRewind(XMLRPC_RequestGetData(input)));
- XMLRPC_VALUE xResponse = NULL;
-
- /* lazy loading of introspection data */
- check_docs_loaded(server, userData);
-
- if(method) {
- server_method* sm = find_method(server, method);
- if(sm && sm->desc) {
- const char* help = XMLRPC_VectorGetStringWithID(sm->desc, xi_token_purpose);
-
- /* returns a documentation string, or empty string */
- xResponse = XMLRPC_CreateValueString(NULL, help ? help : xi_token_empty, 0);
- }
- }
-
- return xResponse;
-}
-
-/*-**************************************
-* End Introspection Callbacks (methods) *
-****************************************/
-
-
-/*-************************
-* Introspection Utilities *
-**************************/
-
-/* performs registration of introspection methods */
-void xi_register_system_methods(XMLRPC_SERVER server) {
- XMLRPC_ServerRegisterMethod(server, xi_token_system_list_methods, xi_system_list_methods_cb);
- XMLRPC_ServerRegisterMethod(server, xi_token_system_method_help, xi_system_method_help_cb);
- XMLRPC_ServerRegisterMethod(server, xi_token_system_method_signature, xi_system_method_signature_cb);
- XMLRPC_ServerRegisterMethod(server, xi_token_system_describe_methods, xi_system_describe_methods_cb);
-}
-
-/* describe a value (param, return, type) */
-static XMLRPC_VALUE describeValue_worker(const char* type, const char* id, const char* desc, int optional, const char* default_val, XMLRPC_VALUE sub_params) {
- XMLRPC_VALUE xParam = NULL;
- if(id || desc) {
- xParam = XMLRPC_CreateVector(NULL, xmlrpc_vector_struct);
- XMLRPC_VectorAppendString(xParam, xi_token_name, id, 0);
- XMLRPC_VectorAppendString(xParam, xi_token_type, type, 0);
- XMLRPC_VectorAppendString(xParam, xi_token_description, desc, 0);
- if(optional != 2) {
- XMLRPC_VectorAppendInt(xParam, xi_token_optional, optional);
- }
- if(optional == 1 && default_val) {
- XMLRPC_VectorAppendString(xParam, xi_token_default, default_val, 0);
- }
- XMLRPC_AddValueToVector(xParam, sub_params);
- }
- return xParam;
-}
-
-
-/* convert an xml tree conforming to spec <url tbd> to XMLRPC_VALUE
- * suitable for use with XMLRPC_ServerAddIntrospectionData
- */
-XMLRPC_VALUE xml_element_to_method_description(xml_element* el, XMLRPC_ERROR err) {
- XMLRPC_VALUE xReturn = NULL;
-
- if(el->name) {
- const char* name = NULL;
- const char* type = NULL;
- const char* basetype = NULL;
- const char* desc = NULL;
- const char* def = NULL;
- int optional = 0;
- xml_element_attr* attr_iter = Q_Head(&el->attrs);
-
- /* grab element attributes up front to save redundant while loops */
- while(attr_iter) {
- if(!strcmp(attr_iter->key, "name")) {
- name = attr_iter->val;
- }
- else if(!strcmp(attr_iter->key, "type")) {
- type = attr_iter->val;
- }
- else if(!strcmp(attr_iter->key, "basetype")) {
- basetype = attr_iter->val;
- }
- else if(!strcmp(attr_iter->key, "desc")) {
- desc = attr_iter->val;
- }
- else if(!strcmp(attr_iter->key, "optional")) {
- if(attr_iter->val && !strcmp(attr_iter->val, "yes")) {
- optional = 1;
- }
- }
- else if(!strcmp(attr_iter->key, "default")) {
- def = attr_iter->val;
- }
- attr_iter = Q_Next(&el->attrs);
- }
-
- /* value and typeDescription behave about the same */
- if(!strcmp(el->name, "value") || !strcmp(el->name, "typeDescription")) {
- XMLRPC_VALUE xSubList = NULL;
- const char* ptype = !strcmp(el->name, "value") ? type : basetype;
- if(ptype) {
- if(Q_Size(&el->children) &&
- !strcmp(ptype, "array") || !strcmp(ptype, "struct") || !strcmp(ptype, "mixed")) {
- xSubList = XMLRPC_CreateVector("member", xmlrpc_vector_array);
-
- if(xSubList) {
- xml_element* elem_iter = Q_Head(&el->children);
- while(elem_iter) {
- XMLRPC_AddValueToVector(xSubList,
- xml_element_to_method_description(elem_iter, err));
- elem_iter = Q_Next(&el->children);
- }
- }
- }
- xReturn = describeValue_worker(ptype, name, (desc ? desc : (xSubList ? NULL : el->text.str)), optional, def, xSubList);
- }
- }
-
- /* these three kids are about equivalent */
- else if(!strcmp(el->name, "params") ||
- !strcmp(el->name, "returns") ||
- !strcmp(el->name, "signature")) {
- if(Q_Size(&el->children)) {
- xml_element* elem_iter = Q_Head(&el->children);
- xReturn = XMLRPC_CreateVector(!strcmp(el->name, "signature") ? NULL : el->name, xmlrpc_vector_struct);
-
-
- while(elem_iter) {
- XMLRPC_AddValueToVector(xReturn,
- xml_element_to_method_description(elem_iter, err));
- elem_iter = Q_Next(&el->children);
- }
- }
- }
-
-
- else if(!strcmp(el->name, "methodDescription")) {
- xml_element* elem_iter = Q_Head(&el->children);
- xReturn = XMLRPC_CreateVector(NULL, xmlrpc_vector_struct);
-
- XMLRPC_VectorAppendString(xReturn, xi_token_name, name, 0);
-
- while(elem_iter) {
- XMLRPC_AddValueToVector(xReturn,
- xml_element_to_method_description(elem_iter, err));
- elem_iter = Q_Next(&el->children);
- }
- }
-
- /* items are slightly special */
- else if(!strcmp(el->name, "item")) {
- xReturn = XMLRPC_CreateValueString(name, el->text.str, el->text.len);
- }
-
- /* sure. we'll let any ol element with children through */
- else if(Q_Size(&el->children)) {
- xml_element* elem_iter = Q_Head(&el->children);
- xReturn = XMLRPC_CreateVector(el->name, xmlrpc_vector_mixed);
-
- while(elem_iter) {
- XMLRPC_AddValueToVector(xReturn,
- xml_element_to_method_description(elem_iter, err));
- elem_iter = Q_Next(&el->children);
- }
- }
-
- /* or anything at all really, so long as its got some text.
- * no reason being all snotty about a spec, right?
- */
- else if(el->name && el->text.len) {
- xReturn = XMLRPC_CreateValueString(el->name, el->text.str, el->text.len);
- }
- }
-
- return xReturn;
-}
-
-/*-****************************
-* End Introspection Utilities *
-******************************/
-
-
-
-/*-******************
-* Introspection API *
-********************/
-
-
-/****f* VALUE/XMLRPC_IntrospectionCreateDescription
- * NAME
- * XMLRPC_IntrospectionCreateDescription
- * SYNOPSIS
- * XMLRPC_VALUE XMLRPC_IntrospectionCreateDescription(const char* xml, XMLRPC_ERROR err)
- * FUNCTION
- * converts raw xml describing types and methods into an
- * XMLRPC_VALUE suitable for use with XMLRPC_ServerAddIntrospectionData()
- * INPUTS
- * xml - xml data conforming to introspection spec at <url tbd>
- * err - optional pointer to error struct. filled in if error occurs and not NULL.
- * RESULT
- * XMLRPC_VALUE - newly created value, or NULL if fatal error.
- * BUGS
- * Currently does little or no validation of xml.
- * Only parse errors are currently reported in err, not structural errors.
- * SEE ALSO
- * XMLRPC_ServerAddIntrospectionData ()
- * SOURCE
- */
-XMLRPC_VALUE XMLRPC_IntrospectionCreateDescription(const char* xml, XMLRPC_ERROR err) {
- XMLRPC_VALUE xReturn = NULL;
- xml_element* root = xml_elem_parse_buf(xml, 0, 0, err ? &err->xml_elem_error : NULL);
-
- if(root) {
- xReturn = xml_element_to_method_description(root, err);
-
- xml_elem_free(root);
- }
-
- return xReturn;
-
-}
-/*******/
-
-
-/****f* SERVER/XMLRPC_ServerAddIntrospectionData
- * NAME
- * XMLRPC_ServerAddIntrospectionData
- * SYNOPSIS
- * int XMLRPC_ServerAddIntrospectionData(XMLRPC_SERVER server, XMLRPC_VALUE desc)
- * FUNCTION
- * updates server with additional introspection data
- * INPUTS
- * server - target server
- * desc - introspection data, should be a struct generated by
- * XMLRPC_IntrospectionCreateDescription ()
- * RESULT
- * int - 1 if success, else 0
- * NOTES
- * - function will fail if neither typeList nor methodList key is present in struct.
- * - if method or type already exists, it will be replaced.
- * - desc is never freed by the server. caller is responsible for cleanup.
- * BUGS
- * - horribly slow lookups. prime candidate for hash improvements.
- * - uglier and more complex than I like to see for API functions.
- * SEE ALSO
- * XMLRPC_ServerAddIntrospectionData ()
- * XMLRPC_ServerRegisterIntrospectionCallback ()
- * XMLRPC_CleanupValue ()
- * SOURCE
- */
-int XMLRPC_ServerAddIntrospectionData(XMLRPC_SERVER server, XMLRPC_VALUE desc) {
- int bSuccess = 0;
- if(server && desc) {
- XMLRPC_VALUE xNewTypes = XMLRPC_VectorGetValueWithID(desc, "typeList");
- XMLRPC_VALUE xNewMethods = XMLRPC_VectorGetValueWithID(desc, "methodList");
- XMLRPC_VALUE xServerTypes = XMLRPC_VectorGetValueWithID(server->xIntrospection, "typeList");
-
- if(xNewMethods) {
- XMLRPC_VALUE xMethod = XMLRPC_VectorRewind(xNewMethods);
-
- while(xMethod) {
- const char* name = XMLRPC_VectorGetStringWithID(xMethod, xi_token_name);
- server_method* sm = find_method(server, name);
-
- if(sm) {
- if(sm->desc) {
- XMLRPC_CleanupValue(sm->desc);
- }
- sm->desc = XMLRPC_CopyValue(xMethod);
- bSuccess = 1;
- }
-
- xMethod = XMLRPC_VectorNext(xNewMethods);
- }
- }
- if(xNewTypes) {
- if(!xServerTypes) {
- if(!server->xIntrospection) {
- server->xIntrospection = XMLRPC_CreateVector(NULL, xmlrpc_vector_struct);
- }
-
- XMLRPC_AddValueToVector(server->xIntrospection, xNewTypes);
- bSuccess = 1;
- }
- else {
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(xNewTypes);
- while(xIter) {
- /* get rid of old values */
- XMLRPC_VALUE xPrev = find_named_value(xServerTypes, XMLRPC_VectorGetStringWithID(xIter, xi_token_name));
- if(xPrev) {
- XMLRPC_VectorRemoveValue(xServerTypes, xPrev);
- }
- XMLRPC_AddValueToVector(xServerTypes, xIter);
- bSuccess = 1;
- xIter = XMLRPC_VectorNext(xNewTypes);
- }
- }
- }
- }
- return bSuccess;
-}
-/*******/
-
-
-/****f* SERVER/XMLRPC_ServerRegisterIntrospectionCallback
- * NAME
- * XMLRPC_ServerRegisterIntrospectionCallback
- * SYNOPSIS
- * int XMLRPC_ServerRegisterIntrospectionCallback(XMLRPC_SERVER server, XMLRPC_IntrospectionCallback cb)
- * FUNCTION
- * registers a callback for lazy generation of introspection data
- * INPUTS
- * server - target server
- * cb - callback that will generate introspection data
- * RESULT
- * int - 1 if success, else 0
- * NOTES
- * parsing xml and generating introspection data is fairly expensive, thus a
- * server may wish to wait until this data is actually requested before generating
- * it. Any number of callbacks may be registered at any time. A given callback
- * will only ever be called once, the first time an introspection request is
- * processed after the time of callback registration.
- * SEE ALSO
- * XMLRPC_ServerAddIntrospectionData ()
- * XMLRPC_IntrospectionCreateDescription ()
- * SOURCE
- */
-int XMLRPC_ServerRegisterIntrospectionCallback(XMLRPC_SERVER server, XMLRPC_IntrospectionCallback cb) {
- int bSuccess = 0;
- if(server && cb) {
-
- doc_method* dm = calloc(1, sizeof(doc_method));
-
- if(dm) {
- dm->method = cb;
- dm->b_called = 0;
-
- if(Q_PushTail(&server->docslist, dm)) {
- bSuccess = 1;
- }
- else {
- my_free(dm);
- }
- }
- }
- return 0;
-}
-/*******/
-
-/*-**********************
-* End Introspection API *
-************************/
-
-
-
diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.h b/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.h
deleted file mode 100644
index 656e441b96..0000000000
--- a/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-/* IMPORTANT!
- *
- * only public (official API) things should be in this file. Anything else
- * should go in <group>_private.h, or in the appropriate .c file.
- */
-
-
-#ifndef __XI_INTROSPECTION_H
-/*
- * Avoid include redundancy.
- */
-#define __XI_INTROSPECTION_H
-
-/*----------------------------------------------------------------------------
- * xmlrpc_introspection.h
- *
- * Purpose:
- * define public introspection API
- * Comments:
- */
-
-/*----------------------------------------------------------------------------
- * Constants
- */
- #define xi_token_params "params"
- #define xi_token_returns "returns"
- #define xi_token_related "related"
- #define xi_token_sub "sub"
-
-
-/*----------------------------------------------------------------------------
- * Includes
- */
-
-/*----------------------------------------------------------------------------
- * Structures
- */
-
- /****d* VALUE/XMLRPC_IntrospectionCallback
- * NAME
- * XMLRPC_IntrospectionCallback
- * NOTES
- * Function prototype for lazy documentation generation (not generated until requested).
- * SOURCE
- */
-typedef void (*XMLRPC_IntrospectionCallback)(XMLRPC_SERVER server, void* userData);
-/******/
-
-
-/*----------------------------------------------------------------------------
- * Globals
- */
-
-/*----------------------------------------------------------------------------
- * Functions
- */
-XMLRPC_VALUE XMLRPC_IntrospectionCreateDescription(const char* xml, XMLRPC_ERROR error);
-int XMLRPC_ServerAddIntrospectionData(XMLRPC_SERVER server, XMLRPC_VALUE desc);
-int XMLRPC_ServerRegisterIntrospectionCallback(XMLRPC_SERVER server, XMLRPC_IntrospectionCallback cb);
-
-/*----------------------------------------------------------------------------
- * Macros
- */
-
-
-#endif /* __XI_INTROSPECTION_H */
-
-
-
diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h b/ext/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h
deleted file mode 100644
index 7b97fa7ed7..0000000000
--- a/ext/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2001 Dan Libby, Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-/* IMPORTANT!
- *
- * only non-public things should be in this file. It is fine for any .c file
- * in xmlrpc/src to include it, but users of the public API should never
- * include it, and thus *.h files that are part of the public API should
- * never include it, or they would break if this file is not present.
- */
-
-
-#ifndef __XI_INTROSPECTION_PRIVATE_H
-/*
- * Avoid include redundancy.
- */
-#define __XI_INTROSPECTION_PRIVATE_H
-
-/*----------------------------------------------------------------------------
- * xmlrpc_introspection_private.h
- *
- * Purpose:
- * define non-public introspection routines
- * Comments:
- */
-
-/*----------------------------------------------------------------------------
- * Constants
- */
-#define xi_token_default "default"
-#define xi_token_description "description"
-#define xi_token_name "name"
-#define xi_token_optional "optional"
-#define xi_token_params "params"
-#define xi_token_purpose "purpose"
-#define xi_token_returns "returns"
-#define xi_token_signatures "signatures"
-#define xi_token_type "type"
-#define xi_token_version "version"
-#define xi_token_empty ""
-#define xi_token_system_describe_methods "system.describeMethods"
-#define xi_token_system_list_methods "system.listMethods"
-#define xi_token_system_method_help "system.methodHelp"
-#define xi_token_system_method_signature "system.methodSignature"
-
-
-/*----------------------------------------------------------------------------
- * Includes
- */
-
-/*----------------------------------------------------------------------------
- * Structures
- */
-typedef struct _doc_method {
- XMLRPC_IntrospectionCallback method;
- int b_called;
-} doc_method;
-
-/*----------------------------------------------------------------------------
- * Globals
- */
-
-/*----------------------------------------------------------------------------
- * Functions
- */
-void xi_register_system_methods(XMLRPC_SERVER server);
-
-/*----------------------------------------------------------------------------
- * Macros
- */
-
-
-#endif /* __XI_INTROSPECTION_PRIVATE_H */
-
-
-
-
diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc_private.h b/ext/xmlrpc/libxmlrpc/xmlrpc_private.h
deleted file mode 100644
index 65c6b136a6..0000000000
--- a/ext/xmlrpc/libxmlrpc/xmlrpc_private.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- This file is part of libXMLRPC - a C library for xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2000 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-/* only non-public things should be in this file. It is fine for any .c file
- * in xmlrpc/src to include it, but users of the public API should never
- * include it, and thus *.h files that are part of the public API should
- * never include it, or they would break if this file is not present.
- */
-
-#ifndef XMLRPC_PRIVATE_ALREADY_INCLUDED
-/*
- * Avoid include redundancy.
- */
-#define XMLRPC_PRIVATE_ALREADY_INCLUDED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*----------------------------------------------------------------------------
- * xmlrpc_private.h
- *
- * Purpose:
- * define non-public intra-library routines & data
- * Comments:
- */
-
-/*----------------------------------------------------------------------------
- * Constants
- */
-
-
-/*----------------------------------------------------------------------------
- * Includes
- */
-
-/*----------------------------------------------------------------------------
- * Structures
- */
-
-/* Some of these are typedef'd in xmlrpc.h for public use */
-
-typedef struct _xmlrpc_vector* XMLRPC_VECTOR;
-
-/****s* VALUE/XMLRPC_VALUE
- * NAME
- * XMLRPC_VALUE
- * NOTES
- * A value of variable data type. The most important object in this API. :)
- *
- * This struct is opaque to callers and should be accessed only via accessor functions.
- * SEE ALSO
- * XMLRPC_REQUEST
- * XMLRPC_CreateValueEmpty ()
- * XMLRPC_CleanupValue ()
- * SOURCE
- */
-typedef struct _xmlrpc_value {
- XMLRPC_VALUE_TYPE type; /* data type of this value */
- XMLRPC_VECTOR v; /* vector type specific info */
- simplestring str; /* string value buffer */
- simplestring id; /* id of this value. possibly empty. */
- int i; /* integer value. */
- double d; /* double value */
- int iRefCount; /* So we know when we can delete the value . */
-} STRUCT_XMLRPC_VALUE;
-/******/
-
-/****s* VALUE/XMLRPC_REQUEST
- * NAME
- * XMLRPC_REQUEST
- * NOTES
- * Internal representation of an XML request.
- *
- * This struct is opaque to callers and should be accessed only via accessor functions.
- *
- * SEE ALSO
- * XMLRPC_VALUE
- * XMLRPC_RequestNew ()
- * XMLRPC_RequestFree ()
- * SOURCE
- */
-typedef struct _xmlrpc_request {
- XMLRPC_VALUE io; /* data associated with this request */
- simplestring methodName; /* name of method being called */
- XMLRPC_REQUEST_TYPE request_type; /* type of request */
- STRUCT_XMLRPC_REQUEST_OUTPUT_OPTIONS output; /* xml output options */
- XMLRPC_VALUE error; /* error codes */
-} STRUCT_XMLRPC_REQUEST;
-/******/
-
-/* Vector type. Used by XMLRPC_VALUE. Never visible to users of the API. */
-typedef struct _xmlrpc_vector {
- XMLRPC_VECTOR_TYPE type; /* vector type */
- queue *q; /* list of child values */
-} STRUCT_XMLRPC_VECTOR;
-/******/
-
-/****s* VALUE/XMLRPC_SERVER
- * NAME
- * XMLRPC_SERVER
- * NOTES
- * internal representation of an xmlrpc server
- *
- * This struct is opaque to callers and should be accessed only via accessor functions.
- *
- * SEE ALSO
- * XMLRPC_ServerCreate ()
- * XMLRPC_ServerDestroy ()
- * SOURCE
- */
-typedef struct _xmlrpc_server {
- queue methodlist; /* list of callback methods */
- queue docslist; /* list of introspection callbacks */
- XMLRPC_VALUE xIntrospection;
-} STRUCT_XMLRPC_SERVER;
-/******/
-
-typedef struct _server_method {
- char* name;
- XMLRPC_VALUE desc;
- XMLRPC_Callback method;
-} server_method;
-
-
-/*----------------------------------------------------------------------------
- * Globals
- */
-
-/*----------------------------------------------------------------------------
- * Functions
- */
-server_method* find_method(XMLRPC_SERVER server, const char* name);
-const char* type_to_str(XMLRPC_VALUE_TYPE type, XMLRPC_VECTOR_TYPE vtype);
-
-/*----------------------------------------------------------------------------
- * Macros
- */
-#define my_free(thing) if(thing) {free(thing); thing = 0;}
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* XMLRPC_PRIVATE_ALREADY_INCLUDED */
-
diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc_win32.h b/ext/xmlrpc/libxmlrpc/xmlrpc_win32.h
deleted file mode 100644
index 58c54bbb80..0000000000
--- a/ext/xmlrpc/libxmlrpc/xmlrpc_win32.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _XMLRPC_WIN32_H
-#define _XMLRPC_WIN32_H
-/* just some things needed to compile win32 */
-#include <windows.h>
-#include <stdlib.h>
-#define inline __inline
-#define snprintf _snprintf
-#define strcasecmp(s1, s2) stricmp(s1, s2)
-
-
-#endif \ No newline at end of file
diff --git a/ext/xmlrpc/php_xmlrpc.h b/ext/xmlrpc/php_xmlrpc.h
deleted file mode 100644
index c69a7e7581..0000000000
--- a/ext/xmlrpc/php_xmlrpc.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- This file is part of, or distributed with, libXMLRPC - a C library for
- xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2001 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-/* auto-generated portions of this file are also subject to the php license */
-
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Dan Libby |
- +----------------------------------------------------------------------+
- */
-
-#ifndef _PHP_XMLRPC_H
-#define _PHP_XMLRPC_H
-
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined.
-*/
-#if 1 /* HAVE_XMLRPC */
-
-extern zend_module_entry xmlrpc_module_entry;
-#define phpext_xmlrpc_ptr &xmlrpc_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_XMLRPC_API __declspec(dllexport)
-#else
-#define PHP_XMLRPC_API
-#endif
-
-PHP_MINIT_FUNCTION(xmlrpc);
-PHP_MSHUTDOWN_FUNCTION(xmlrpc);
-PHP_RINIT_FUNCTION(xmlrpc);
-PHP_RSHUTDOWN_FUNCTION(xmlrpc);
-PHP_MINFO_FUNCTION(xmlrpc);
-
-PHP_FUNCTION(xmlrpc_encode);
-PHP_FUNCTION(xmlrpc_decode);
-PHP_FUNCTION(xmlrpc_decode_request);
-PHP_FUNCTION(xmlrpc_encode_request);
-PHP_FUNCTION(xmlrpc_get_type);
-PHP_FUNCTION(xmlrpc_set_type);
-PHP_FUNCTION(xmlrpc_is_fault);
-PHP_FUNCTION(xmlrpc_server_create);
-PHP_FUNCTION(xmlrpc_server_destroy);
-PHP_FUNCTION(xmlrpc_server_register_method);
-PHP_FUNCTION(xmlrpc_server_call_method);
-PHP_FUNCTION(xmlrpc_parse_method_descriptions);
-PHP_FUNCTION(xmlrpc_server_add_introspection_data);
-PHP_FUNCTION(xmlrpc_server_register_introspection_callback);
-
-/* Fill in this structure and use entries in it
- for thread safety instead of using true globals.
-*/
-typedef struct {
- int x; /* fix error in msvc, cannot have empty structs */
-} zend_xmlrpc_globals;
-
-/* In every function that needs to use variables in zend_xmlrpc_globals,
- do call XMLRPCLS_FETCH(); after declaring other variables used by
- that function, and always refer to them as XMLRPCG(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#else
-
-#define phpext_xmlrpc_ptr NULL
-
-#endif
-
-#endif /* _PHP_XMLRPC_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c
deleted file mode 100644
index 0ce1a99b00..0000000000
--- a/ext/xmlrpc/xmlrpc-epi-php.c
+++ /dev/null
@@ -1,1485 +0,0 @@
-/*
- This file is part of, or distributed with, libXMLRPC - a C library for
- xml-encoded function calls.
-
- Author: Dan Libby (dan@libby.com)
- Epinions.com may be contacted at feedback@epinions-inc.com
-*/
-
-/*
- Copyright 2001 Epinions, Inc.
-
- Subject to the following 3 conditions, Epinions, Inc. permits you, free
- of charge, to (a) use, copy, distribute, modify, perform and display this
- software and associated documentation files (the "Software"), and (b)
- permit others to whom the Software is furnished to do so as well.
-
- 1) The above copyright notice and this permission notice shall be included
- without modification in all copies or substantial portions of the
- Software.
-
- 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
- ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
- IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE OR NONINFRINGEMENT.
-
- 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
- OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
- NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
- DAMAGES.
-
-*/
-
-/* auto-generated portions of this file are also subject to the php license */
-
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Dan Libby |
- +----------------------------------------------------------------------+
- */
-
-/**********************************************************************
-* BUGS: *
-* - when calling a php user function, there appears to be no way to *
-* distinguish between a return value of null, and no return value *
-* at all. The xml serialization layer(s) will then return a value *
-* of null, when the right thing may be no value at all. (SOAP) *
-**********************************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/info.h"
-#include "php_ini.h"
-#include "php_xmlrpc.h"
-#include "xmlrpc.h"
-
-#define PHP_EXT_VERSION "0.51"
-
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined. */
-
-ZEND_DECLARE_MODULE_GLOBALS(xmlrpc)
-
-static int le_xmlrpc_server;
-
-static unsigned char second_args_force_ref[] = { 3, BYREF_NONE, BYREF_FORCE, BYREF_NONE };
-static unsigned char first_args_force_ref[] = { 2, BYREF_FORCE, BYREF_NONE };
-
-function_entry xmlrpc_functions[] = {
- PHP_FE(xmlrpc_encode, NULL)
- PHP_FE(xmlrpc_decode, NULL)
- PHP_FE(xmlrpc_decode_request, second_args_force_ref)
- PHP_FE(xmlrpc_encode_request, NULL)
- PHP_FE(xmlrpc_get_type, NULL)
- PHP_FE(xmlrpc_set_type, first_args_force_ref)
- PHP_FE(xmlrpc_is_fault, NULL)
- PHP_FE(xmlrpc_server_create, NULL)
- PHP_FE(xmlrpc_server_destroy, NULL)
- PHP_FE(xmlrpc_server_register_method, NULL)
- PHP_FE(xmlrpc_server_call_method, NULL)
- PHP_FE(xmlrpc_parse_method_descriptions, NULL)
- PHP_FE(xmlrpc_server_add_introspection_data, NULL)
- PHP_FE(xmlrpc_server_register_introspection_callback, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry xmlrpc_module_entry = {
- STANDARD_MODULE_HEADER,
- "xmlrpc",
- xmlrpc_functions,
- PHP_MINIT(xmlrpc),
- PHP_MSHUTDOWN(xmlrpc),
- PHP_RINIT(xmlrpc), /* Replace with NULL if there's nothing to do at request start */
- PHP_RSHUTDOWN(xmlrpc), /* Replace with NULL if there's nothing to do at request end */
- PHP_MINFO(xmlrpc),
- PHP_EXT_VERSION,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_XMLRPC
-ZEND_GET_MODULE(xmlrpc)
-#endif
-
-/*******************************
-* local structures and defines *
-*******************************/
-
-/* per server data */
-typedef struct _xmlrpc_server_data {
- zval* method_map;
- zval* introspection_map;
- XMLRPC_SERVER server_ptr;
-} xmlrpc_server_data;
-
-
-/* how to format output */
-typedef struct _php_output_options {
- int b_php_out;
- int b_auto_version;
- STRUCT_XMLRPC_REQUEST_OUTPUT_OPTIONS xmlrpc_out;
-} php_output_options;
-
-/* data passed to C callback */
-typedef struct _xmlrpc_callback_data {
- zval* xmlrpc_method;
- zval* php_function;
- zval* caller_params;
- zval* return_data;
- xmlrpc_server_data* server;
- char php_executed;
-} xmlrpc_callback_data;
-
-/* output options */
-#define OUTPUT_TYPE_KEY "output_type"
-#define OUTPUT_TYPE_KEY_LEN (sizeof(OUTPUT_TYPE_KEY) - 1)
-#define OUTPUT_TYPE_VALUE_PHP "php"
-#define OUTPUT_TYPE_VALUE_XML "xml"
-
-#define VERBOSITY_KEY "verbosity"
-#define VERBOSITY_KEY_LEN (sizeof(VERBOSITY_KEY) - 1)
-#define VERBOSITY_VALUE_NO_WHITE_SPACE "no_white_space"
-#define VERBOSITY_VALUE_NEWLINES_ONLY "newlines_only"
-#define VERBOSITY_VALUE_PRETTY "pretty"
-
-#define ESCAPING_KEY "escaping"
-#define ESCAPING_KEY_LEN (sizeof(ESCAPING_KEY) - 1)
-#define ESCAPING_VALUE_CDATA "cdata"
-#define ESCAPING_VALUE_NON_ASCII "non-ascii"
-#define ESCAPING_VALUE_NON_PRINT "non-print"
-#define ESCAPING_VALUE_MARKUP "markup"
-
-#define VERSION_KEY "version"
-#define VERSION_KEY_LEN (sizeof(VERSION_KEY) - 1)
-#define VERSION_VALUE_SIMPLE "simple"
-#define VERSION_VALUE_XMLRPC "xmlrpc"
-#define VERSION_VALUE_SOAP11 "soap 1.1"
-#define VERSION_VALUE_AUTO "auto"
-
-#define ENCODING_KEY "encoding"
-#define ENCODING_KEY_LEN (sizeof(ENCODING_KEY) - 1)
-#define ENCODING_DEFAULT "iso-8859-1"
-
-/* value types */
-#define OBJECT_TYPE_ATTR "xmlrpc_type"
-#define OBJECT_VALUE_ATTR "scalar"
-#define OBJECT_VALUE_TS_ATTR "timestamp"
-
-/* faults */
-#define FAULT_CODE "faultCode"
-#define FAULT_CODE_LEN (sizeof(FAULT_CODE) - 1)
-#define FAULT_STRING "faultString"
-#define FAULT_STRING_LEN (sizeof(FAULT_STRING) - 1)
-
-/***********************
-* forward declarations *
-***********************/
-XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval** newvalue);
-static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data);
-int sset_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE type);
-zval* decode_request_worker(zval* xml_in, zval* encoding_in, zval* method_name_out);
-const char* xmlrpc_type_as_str(XMLRPC_VALUE_TYPE type, XMLRPC_VECTOR_TYPE vtype);
-XMLRPC_VALUE_TYPE xmlrpc_str_as_type(const char* str);
-XMLRPC_VECTOR_TYPE xmlrpc_str_as_vector_type(const char* str);
-int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE type);
-
-/*********************
-* startup / shutdown *
-*********************/
-
-static void destroy_server_data(xmlrpc_server_data *server)
-{
- if (server) {
- XMLRPC_ServerDestroy(server->server_ptr);
-
- zval_dtor(server->method_map);
- FREE_ZVAL(server->method_map);
-
- zval_dtor(server->introspection_map);
- FREE_ZVAL(server->introspection_map);
-
- efree(server);
- }
-}
-
-/* called when server is being destructed. either when xmlrpc_server_destroy
- * is called, or when request ends. */
-static void xmlrpc_server_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- if (rsrc && rsrc->ptr) {
- destroy_server_data((xmlrpc_server_data*) rsrc->ptr);
- }
-}
-
-/* module init */
-PHP_MINIT_FUNCTION(xmlrpc)
-{
- le_xmlrpc_server = zend_register_list_destructors_ex(xmlrpc_server_destructor, NULL, "xmlrpc server", module_number);
-
- return SUCCESS;
-}
-
-/* module shutdown */
-PHP_MSHUTDOWN_FUNCTION(xmlrpc)
-{
- return SUCCESS;
-}
-
-/* Remove if there's nothing to do at request start */
-PHP_RINIT_FUNCTION(xmlrpc)
-{
- return SUCCESS;
-}
-
-/* Remove if there's nothing to do at request end */
-PHP_RSHUTDOWN_FUNCTION(xmlrpc)
-{
- return SUCCESS;
-}
-
-/* display info in phpinfo() */
-PHP_MINFO_FUNCTION(xmlrpc)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "core library version", XMLRPC_GetVersionString());
- php_info_print_table_row(2, "php extension version", PHP_EXT_VERSION);
- php_info_print_table_row(2, "author", "Dan Libby");
- php_info_print_table_row(2, "homepage", "http://xmlrpc-epi.sourceforge.net");
- php_info_print_table_row(2, "open sourced by", "Epinions.com");
- php_info_print_table_end();
-}
-
-/*******************
-* random utilities *
-*******************/
-
-/* Utility functions for adding data types to arrays, with or without key (assoc, non-assoc).
- * Could easily be further generalized to work with objects.
- */
-#if 0
-static int add_long(zval* list, char* id, int num) {
- if(id) return add_assoc_long(list, id, num);
- else return add_next_index_long(list, num);
-}
-
-static int add_double(zval* list, char* id, double num) {
- if(id) return add_assoc_double(list, id, num);
- else return add_next_index_double(list, num);
-}
-
-static int add_string(zval* list, char* id, char* string, int duplicate) {
- if(id) return add_assoc_string(list, id, string, duplicate);
- else return add_next_index_string(list, string, duplicate);
-}
-
-static int add_stringl(zval* list, char* id, char* string, uint length, int duplicate) {
- if(id) return add_assoc_stringl(list, id, string, length, duplicate);
- else return add_next_index_stringl(list, string, length, duplicate);
-}
-
-#endif
-
-static int add_zval(zval* list, const char* id, zval** val)
-{
- if (list && val) {
- if (id) {
- return zend_hash_update(Z_ARRVAL_P(list), (char*) id, strlen(id) + 1, (void *) val, sizeof(zval **), NULL);
- } else {
- return zend_hash_next_index_insert(Z_ARRVAL_P(list), (void *) val, sizeof(zval **), NULL);
- }
- }
- /* what is the correct return on error? */
- return 0;
-}
-
-#define my_zend_hash_get_current_key(ht, my_key, num_index) zend_hash_get_current_key(ht, my_key, num_index, 0)
-
-
-/*************************
-* input / output options *
-*************************/
-
-/* parse an array (user input) into output options suitable for use by xmlrpc engine
- * and determine whether to return data as xml or php vars */
-static void set_output_options(php_output_options* options, zval* output_opts)
-{
- if (options) {
-
- /* defaults */
- options->b_php_out = 0;
- options->b_auto_version = 1;
- options->xmlrpc_out.version = xmlrpc_version_1_0;
- options->xmlrpc_out.xml_elem_opts.encoding = ENCODING_DEFAULT;
- options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_pretty;
- options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_markup_escaping | xml_elem_non_ascii_escaping | xml_elem_non_print_escaping;
-
- if (output_opts && Z_TYPE_P(output_opts) == IS_ARRAY) {
- zval** val;
-
- /* type of output (xml/php) */
- if (zend_hash_find(Z_ARRVAL_P(output_opts), OUTPUT_TYPE_KEY, OUTPUT_TYPE_KEY_LEN + 1, (void**) &val) == SUCCESS) {
- if (Z_TYPE_PP(val) == IS_STRING) {
- if (!strcmp(Z_STRVAL_PP(val), OUTPUT_TYPE_VALUE_PHP)) {
- options->b_php_out = 1;
- } else if (!strcmp(Z_STRVAL_PP(val), OUTPUT_TYPE_VALUE_XML)) {
- options->b_php_out = 0;
- }
- }
- }
-
- /* verbosity of generated xml */
- if (zend_hash_find(Z_ARRVAL_P(output_opts), VERBOSITY_KEY, VERBOSITY_KEY_LEN + 1, (void**) &val) == SUCCESS) {
- if (Z_TYPE_PP(val) == IS_STRING) {
- if (!strcmp(Z_STRVAL_PP(val), VERBOSITY_VALUE_NO_WHITE_SPACE)) {
- options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_no_white_space;
- } else if (!strcmp(Z_STRVAL_PP(val), VERBOSITY_VALUE_NEWLINES_ONLY)) {
- options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_newlines_only;
- } else if (!strcmp(Z_STRVAL_PP(val), VERBOSITY_VALUE_PRETTY)) {
- options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_pretty;
- }
- }
- }
-
- /* version of xml to output */
- if (zend_hash_find(Z_ARRVAL_P(output_opts), VERSION_KEY, VERSION_KEY_LEN + 1, (void**) &val) == SUCCESS) {
- if (Z_TYPE_PP(val) == IS_STRING) {
- options->b_auto_version = 0;
- if (!strcmp(Z_STRVAL_PP(val), VERSION_VALUE_XMLRPC)) {
- options->xmlrpc_out.version = xmlrpc_version_1_0;
- } else if (!strcmp(Z_STRVAL_PP(val), VERSION_VALUE_SIMPLE)) {
- options->xmlrpc_out.version = xmlrpc_version_simple;
- } else if (!strcmp((*val)->value.str.val, VERSION_VALUE_SOAP11)) {
- options->xmlrpc_out.version = xmlrpc_version_soap_1_1;
- } else { /* if(!strcmp((*val)->value.str.val, VERSION_VALUE_AUTO)) { */
- options->b_auto_version = 1;
- }
- }
- }
-
- /* encoding code set */
- if(zend_hash_find(Z_ARRVAL_P(output_opts),
- ENCODING_KEY, ENCODING_KEY_LEN + 1,
- (void**)&val) == SUCCESS) {
- if(Z_TYPE_PP(val) == IS_STRING) {
- options->xmlrpc_out.xml_elem_opts.encoding = estrdup(Z_STRVAL_PP(val));
- }
- }
-
- /* escaping options */
- if(zend_hash_find(Z_ARRVAL_P(output_opts),
- ESCAPING_KEY, ESCAPING_KEY_LEN + 1,
- (void**)&val) == SUCCESS) {
- /* multiple values allowed. check if array */
- if(Z_TYPE_PP(val) == IS_ARRAY) {
- zval** iter_val;
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(val));
- options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_no_escaping;
- while(1) {
- if(zend_hash_get_current_data(Z_ARRVAL_PP(val), (void**)&iter_val) == SUCCESS) {
- if(Z_TYPE_PP(iter_val) == IS_STRING && Z_STRVAL_PP(iter_val)) {
- if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_CDATA)) {
- options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_cdata_escaping;
- }
- else if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_NON_ASCII)) {
- options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_non_ascii_escaping;
- }
- else if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_NON_PRINT)) {
- options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_non_print_escaping;
- }
- else if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_MARKUP)) {
- options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_markup_escaping;
- }
- }
- }
- else {
- break;
- }
-
- zend_hash_move_forward(Z_ARRVAL_PP(val));
- }
- }
- /* else, check for single value */
- else if(Z_TYPE_PP(val) == IS_STRING) {
- if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_CDATA)) {
- options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_cdata_escaping;
- }
- else if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_NON_ASCII)) {
- options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_non_ascii_escaping;
- }
- else if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_NON_PRINT)) {
- options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_non_print_escaping;
- }
- else if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_MARKUP)) {
- options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_markup_escaping;
- }
- }
- }
- }
- }
-}
-
-
-/******************
-* encode / decode *
-******************/
-
-/* php arrays have no distinction between array and struct types.
- * they even allow mixed. Thus, we determine the type by iterating
- * through the entire array and figuring out each element.
- * room for some optimation here if we stop after a specific # of elements.
- */
-static XMLRPC_VECTOR_TYPE determine_vector_type (HashTable *ht)
-{
- int bArray = 0, bStruct = 0, bMixed = 0;
- unsigned long num_index;
- char* my_key;
-
- zend_hash_internal_pointer_reset(ht);
- while(1) {
- int res = my_zend_hash_get_current_key(ht, &my_key, &num_index);
- if(res == HASH_KEY_IS_LONG) {
- if(bStruct) {
- bMixed = 1;
- break;
- }
- bArray = 1;
- }
- else if(res == HASH_KEY_NON_EXISTANT) {
- break;
- }
- else if(res == HASH_KEY_IS_STRING) {
- if(bArray) {
- bMixed = 1;
- break;
- }
- bStruct = 1;
- }
-
- zend_hash_move_forward(ht);
- }
- return bMixed ? xmlrpc_vector_mixed : (bStruct ? xmlrpc_vector_struct : xmlrpc_vector_array);
-}
-
-/* recursively convert php values into xmlrpc values */
-static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int depth)
-{
- XMLRPC_VALUE xReturn = NULL;
- if(in_val) {
- zval* val = NULL;
- XMLRPC_VALUE_TYPE type = get_zval_xmlrpc_type(in_val, &val);
- if(val) {
- switch(type) {
- case xmlrpc_base64:
- if(Z_TYPE_P(val) == IS_NULL) {
- xReturn = XMLRPC_CreateValueEmpty();
- XMLRPC_SetValueID(xReturn, key, 0);
- }
- else {
- xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL_P(val), Z_STRLEN_P(val));
- }
- break;
- case xmlrpc_datetime:
- convert_to_string(val);
- xReturn = XMLRPC_CreateValueDateTime_ISO8601(key, Z_STRVAL_P(val));
- break;
- case xmlrpc_boolean:
- convert_to_boolean(val);
- xReturn = XMLRPC_CreateValueBoolean(key, Z_LVAL_P(val));
- break;
- case xmlrpc_int:
- convert_to_long(val);
- xReturn = XMLRPC_CreateValueInt(key, Z_LVAL_P(val));
- break;
- case xmlrpc_double:
- convert_to_double(val);
- xReturn = XMLRPC_CreateValueDouble(key, Z_DVAL_P(val));
- break;
- case xmlrpc_string:
- convert_to_string(val);
- xReturn = XMLRPC_CreateValueString(key, Z_STRVAL_P(val), Z_STRLEN_P(val));
- break;
- case xmlrpc_vector:
- {
- unsigned long num_index;
- zval** pIter;
- char* my_key;
-
- convert_to_array(val);
-
- xReturn = XMLRPC_CreateVector(key, determine_vector_type(Z_ARRVAL_P(val)));
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(val));
- while(1) {
- int res = my_zend_hash_get_current_key(Z_ARRVAL_P(val), &my_key, &num_index);
- if(res == HASH_KEY_IS_LONG) {
- if(zend_hash_get_current_data(Z_ARRVAL_P(val), (void**)&pIter) == SUCCESS) {
- XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(0, *pIter, depth++));
- }
- }
- else if(res == HASH_KEY_NON_EXISTANT) {
- break;
- }
- else if(res == HASH_KEY_IS_STRING) {
- if(zend_hash_get_current_data(Z_ARRVAL_P(val), (void**)&pIter) == SUCCESS) {
- XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(my_key, *pIter, depth++));
- }
- }
-
- zend_hash_move_forward(Z_ARRVAL_P(val));
- }
- }
- break;
- default:
- break;
- }
- }
- }
- return xReturn;
-}
-
-static XMLRPC_VALUE PHP_to_XMLRPC(zval* root_val)
-{
- return PHP_to_XMLRPC_worker(NULL, root_val, 0);
-}
-
-/* recursively convert xmlrpc values into php values */
-static zval* XMLRPC_to_PHP(XMLRPC_VALUE el)
-{
- zval* elem = NULL;
- const char* pStr;
-
- if(el) {
- XMLRPC_VALUE_TYPE type = XMLRPC_GetValueType(el);
-
- MAKE_STD_ZVAL(elem); /* init. very important. spent a frustrating day finding this out. */
-
- switch(type) {
- case xmlrpc_empty:
- Z_TYPE_P(elem) = IS_NULL;
- break;
- case xmlrpc_string:
- pStr = XMLRPC_GetValueString(el);
- if(pStr) {
- Z_STRLEN_P(elem) = XMLRPC_GetValueStringLen(el);
- Z_STRVAL_P(elem) = estrndup(pStr, Z_STRLEN_P(elem));
- Z_TYPE_P(elem) = IS_STRING;
- }
- break;
- case xmlrpc_int:
- Z_LVAL_P(elem) = XMLRPC_GetValueInt(el);
- Z_TYPE_P(elem) = IS_LONG;
- break;
- case xmlrpc_boolean:
- Z_LVAL_P(elem) = XMLRPC_GetValueBoolean(el);
- Z_TYPE_P(elem) = IS_BOOL;
- break;
- case xmlrpc_double:
- Z_DVAL_P(elem) = XMLRPC_GetValueDouble(el);
- Z_TYPE_P(elem) = IS_DOUBLE;
- break;
- case xmlrpc_datetime:
- Z_STRLEN_P(elem) = XMLRPC_GetValueStringLen(el);
- Z_STRVAL_P(elem) = estrndup(XMLRPC_GetValueDateTime_ISO8601(el), Z_STRLEN_P(elem));
- Z_TYPE_P(elem) = IS_STRING;
- break;
- case xmlrpc_base64:
- pStr = XMLRPC_GetValueBase64(el);
- if(pStr) {
- Z_STRLEN_P(elem) = XMLRPC_GetValueStringLen(el);
- Z_STRVAL_P(elem) = estrndup(pStr, Z_STRLEN_P(elem));
- Z_TYPE_P(elem) = IS_STRING;
- }
- break;
- case xmlrpc_vector:
- array_init(elem);
- {
- XMLRPC_VALUE xIter = XMLRPC_VectorRewind(el);
-
- while( xIter ) {
- zval *val = XMLRPC_to_PHP(xIter);
- if (val) {
- add_zval(elem, XMLRPC_GetValueID(xIter), &val);
- }
- xIter = XMLRPC_VectorNext(el);
- }
- }
- break;
- default:
- break;
- }
- set_zval_xmlrpc_type(elem, type);
- }
- return elem;
-}
-
-/* {{{ proto string xmlrpc_encode_request(string method, mixed params)
- Generates XML for a method request */
-PHP_FUNCTION(xmlrpc_encode_request)
-{
- XMLRPC_REQUEST xRequest = NULL;
- zval **method, **vals, **out_opts;
- char* outBuf;
- php_output_options out;
-
- if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 || (zend_get_parameters_ex(ZEND_NUM_ARGS(), &method, &vals, &out_opts) == FAILURE)) {
- WRONG_PARAM_COUNT; /* prints/logs a warning and returns */
- }
-
- set_output_options(&out, (ZEND_NUM_ARGS() == 3) ? *out_opts : 0);
-
- if(return_value_used) {
- xRequest = XMLRPC_RequestNew();
-
- if(xRequest) {
- XMLRPC_RequestSetOutputOptions(xRequest, &out.xmlrpc_out);
- if (Z_TYPE_PP(method) == IS_NULL) {
- XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_response);
- } else {
- XMLRPC_RequestSetMethodName(xRequest, Z_STRVAL_PP(method));
- XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_call);
- }
- if (Z_TYPE_PP(vals) != IS_NULL) {
- XMLRPC_RequestSetData(xRequest, PHP_to_XMLRPC(*vals));
- }
-
- outBuf = XMLRPC_REQUEST_ToXML(xRequest, 0);
- if(outBuf) {
- RETVAL_STRING(outBuf, 1);
- free(outBuf);
- }
- XMLRPC_RequestFree(xRequest, 1);
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string xmlrpc_encode(mixed value)
- Generates XML for a PHP value */
-PHP_FUNCTION(xmlrpc_encode)
-{
- XMLRPC_VALUE xOut = NULL;
- zval **arg1;
- char *outBuf;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &arg1) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- if( return_value_used ) {
- /* convert native php type to xmlrpc type */
- xOut = PHP_to_XMLRPC(*arg1);
-
- /* generate raw xml from xmlrpc data */
- outBuf = XMLRPC_VALUE_ToXML(xOut, 0);
-
- if(xOut) {
- if(outBuf) {
- RETVAL_STRING(outBuf, 1);
- free(outBuf);
- }
- /* cleanup */
- XMLRPC_CleanupValue(xOut);
- }
- }
-}
-/* }}} */
-
-
-zval* decode_request_worker (zval* xml_in, zval* encoding_in, zval* method_name_out)
-{
- zval* retval = NULL;
- XMLRPC_REQUEST response;
- STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS opts = {{0}};
- opts.xml_elem_opts.encoding = encoding_in ? utf8_get_encoding_id_from_string(Z_STRVAL_P(encoding_in)) : ENCODING_DEFAULT;
-
- /* generate XMLRPC_REQUEST from raw xml */
- response = XMLRPC_REQUEST_FromXML(Z_STRVAL_P(xml_in), Z_STRLEN_P(xml_in), &opts);
- if(response) {
- /* convert xmlrpc data to native php types */
- retval = XMLRPC_to_PHP(XMLRPC_RequestGetData(response));
-
- if(XMLRPC_RequestGetRequestType(response) == xmlrpc_request_call) {
- if(method_name_out) {
- convert_to_string(method_name_out);
- Z_TYPE_P(method_name_out) = IS_STRING;
- Z_STRVAL_P(method_name_out) = estrdup(XMLRPC_RequestGetMethodName(response));
- Z_STRLEN_P(method_name_out) = strlen(Z_STRVAL_P(method_name_out));
- }
- }
-
- /* dust, sweep, and mop */
- XMLRPC_RequestFree(response, 1);
- }
- return retval;
-}
-
-/* {{{ proto array xmlrpc_decode_request(string xml, string& method [, string encoding])
- Decodes XML into native PHP types */
-PHP_FUNCTION(xmlrpc_decode_request)
-{
- zval **xml, **method, **encoding = NULL;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 || (zend_get_parameters_ex(argc, &xml, &method, &encoding) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(xml);
- convert_to_string_ex(method);
- if(argc == 3) {
- convert_to_string_ex(encoding);
- }
-
- if(return_value_used) {
- zval* retval = decode_request_worker(*xml, encoding ? *encoding : NULL, *method);
- if(retval) {
- *return_value = *retval;
- FREE_ZVAL(retval);
- }
- }
-}
-/* }}} */
-
-
-/* {{{ proto array xmlrpc_decode(string xml [, string encoding])
- Decodes XML into native PHP types */
-PHP_FUNCTION(xmlrpc_decode)
-{
- zval **arg1, **arg2 = NULL;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 1 || argc > 2 || (zend_get_parameters_ex(argc, &arg1, &arg2) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- if(argc == 2) {
- convert_to_string_ex(arg2);
- }
-
- if(return_value_used) {
- zval* retval = decode_request_worker(*arg1, arg2 ? *arg2 : NULL, NULL);
- if(retval) {
- *return_value = *retval;
- FREE_ZVAL(retval);
- }
- }
-}
-/* }}} */
-
-
-/*************************
-* server related methods *
-*************************/
-
-/* {{{ proto resource xmlrpc_server_create(void)
- Creates an xmlrpc server */
-PHP_FUNCTION(xmlrpc_server_create)
-{
- if(ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- if(return_value_used) {
- zval *method_map, *introspection_map;
- xmlrpc_server_data *server = emalloc(sizeof(xmlrpc_server_data));
- MAKE_STD_ZVAL(method_map);
- MAKE_STD_ZVAL(introspection_map);
-
- array_init(method_map);
- array_init(introspection_map);
-
- /* allocate server data. free'd in destroy_server_data() */
- server->method_map = method_map;
- server->introspection_map = introspection_map;
- server->server_ptr = XMLRPC_ServerCreate();
-
- XMLRPC_ServerRegisterIntrospectionCallback(server->server_ptr, php_xmlrpc_introspection_callback);
-
- /* store for later use */
- ZEND_REGISTER_RESOURCE(return_value,server, le_xmlrpc_server);
- }
-}
-/* }}} */
-
-/* {{{ proto void xmlrpc_server_destroy(resource server)
- Destroys server resources */
-PHP_FUNCTION(xmlrpc_server_destroy)
-{
- zval **arg1;
- int bSuccess = FAILURE;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &arg1) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- if(Z_TYPE_PP(arg1) == IS_RESOURCE) {
- int type;
-
- xmlrpc_server_data *server = zend_list_find(Z_LVAL_PP(arg1), &type);
-
- if(server && type == le_xmlrpc_server) {
- bSuccess = zend_list_delete(Z_LVAL_PP(arg1));
-
- /* called by hashtable destructor
- * destroy_server_data(server);
- */
- }
- }
- RETVAL_LONG(bSuccess == SUCCESS);
-}
-/* }}} */
-
-
-/* called by xmlrpc C engine as method handler for all registered methods.
- * it then calls the corresponding PHP function to handle the method.
- */
-static XMLRPC_VALUE php_xmlrpc_callback(XMLRPC_SERVER server, XMLRPC_REQUEST xRequest, void* data)
-{
- xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data;
- zval* xmlrpc_params;
- zval* callback_params[3];
- TSRMLS_FETCH();
-
- /* convert xmlrpc to native php types */
- xmlrpc_params = XMLRPC_to_PHP(XMLRPC_RequestGetData(xRequest));
-
- /* setup data hoojum */
- callback_params[0] = pData->xmlrpc_method;
- callback_params[1] = xmlrpc_params;
- callback_params[2] = pData->caller_params;
-
- /* Use same C function for all methods */
-
- /* php func prototype: function user_func($method_name, $xmlrpc_params, $user_params) */
- call_user_function(CG(function_table), NULL, pData->php_function, pData->return_data, 3, callback_params TSRMLS_CC);
-
- pData->php_executed = 1;
-
- zval_dtor(xmlrpc_params);
- FREE_ZVAL(xmlrpc_params);
-
- return NULL;
-}
-
-/* called by the C server when it first receives an introspection request. We pass this on to
- * our PHP listeners, if any
- */
-static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data)
-{
- zval *retval_ptr, **php_function;
- zval* callback_params[1];
- xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data;
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(retval_ptr);
- Z_TYPE_P(retval_ptr) = IS_NULL;
-
- /* setup data hoojum */
- callback_params[0] = pData->caller_params;
-
- /* loop through and call all registered callbacks */
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(pData->server->introspection_map));
- while(1) {
- if(zend_hash_get_current_data(Z_ARRVAL_P(pData->server->introspection_map),
- (void**)&php_function) == SUCCESS) {
-
- /* php func prototype: function string user_func($user_params) */
- if(call_user_function(CG(function_table), NULL, *php_function,
- retval_ptr, 1, callback_params TSRMLS_CC) == SUCCESS) {
- XMLRPC_VALUE xData;
- STRUCT_XMLRPC_ERROR err = {0};
-
- /* return value should be a string */
- convert_to_string(retval_ptr);
-
- xData = XMLRPC_IntrospectionCreateDescription(Z_STRVAL_P(retval_ptr), &err);
-
- if(xData) {
- if(!XMLRPC_ServerAddIntrospectionData(server, xData)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add introspection data returned from %s(), improper element structure", Z_STRVAL_PP(php_function));
- }
- XMLRPC_CleanupValue(xData);
- }
- else {
- /* could not create description */
- if(err.xml_elem_error.parser_code) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "xml parse error: [line %i, column %i, message: %s] Unable to add introspection data returned from %s()",
- err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error, Z_STRVAL_PP(php_function));
- }
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add introspection data returned from %s()",
- Z_STRVAL_PP(php_function));
- }
- }
- }
- else {
- /* user func failed */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error calling user introspection callback: %s()", Z_STRVAL_PP(php_function));
- }
- }
- else {
- break;
- }
-
- zend_hash_move_forward(Z_ARRVAL_P(pData->server->introspection_map));
- }
-
- /* so we don't call the same callbacks ever again */
- zend_hash_clean(Z_ARRVAL_P(pData->server->introspection_map));
-}
-
-/* {{{ proto bool xmlrpc_server_register_method(resource server, string method_name, string function)
- Register a PHP function to handle method matching method_name */
-PHP_FUNCTION(xmlrpc_server_register_method)
-{
- zval **method_key, **method_name, **handle, *method_name_save;
- int type;
- xmlrpc_server_data* server;
-
- if (ZEND_NUM_ARGS() != 3 || (zend_get_parameters_ex(3, &handle, &method_key, &method_name) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- server = zend_list_find(Z_LVAL_PP(handle), &type);
-
- if(type == le_xmlrpc_server) {
- /* register with C engine. every method just calls our standard callback,
- * and it then dispatches to php as necessary
- */
- if(XMLRPC_ServerRegisterMethod(server->server_ptr, Z_STRVAL_PP(method_key), php_xmlrpc_callback)) {
- /* save for later use */
- MAKE_STD_ZVAL(method_name_save);
- *method_name_save = **method_name;
- zval_copy_ctor(method_name_save);
-
- /* register our php method */
- add_zval(server->method_map, Z_STRVAL_PP(method_key), &method_name_save);
-
- RETURN_BOOL(1);
- }
- }
- RETURN_BOOL(0);
-}
-/* }}} */
-
-
-/* {{{ proto bool xmlrpc_server_register_introspection_callback(resource server, string function)
- Register a PHP function to generate documentation */
-PHP_FUNCTION(xmlrpc_server_register_introspection_callback)
-{
- zval **method_name, **handle, *method_name_save;
- int type;
- xmlrpc_server_data* server;
-
- if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &handle, &method_name) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- server = zend_list_find(Z_LVAL_PP(handle), &type);
-
- if(type == le_xmlrpc_server) {
- /* save for later use */
- MAKE_STD_ZVAL(method_name_save);
- *method_name_save = **method_name;
- zval_copy_ctor(method_name_save);
-
- /* register our php method */
- add_zval(server->introspection_map, NULL, &method_name_save);
-
- RETURN_BOOL(1);
- }
- RETURN_BOOL(0);
-}
-/* }}} */
-
-
-/* this function is itchin for a re-write */
-
-/* {{{ proto mixed xmlrpc_server_call_method(resource server, string xml, mixed user_data [, array output_options])
- Parses XML requests and call methods */
-PHP_FUNCTION(xmlrpc_server_call_method)
-{
- xmlrpc_callback_data data = {0};
- XMLRPC_REQUEST xRequest;
- STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS input_opts;
- xmlrpc_server_data* server;
- zval **rawxml, **caller_params, **handle, **output_opts = NULL;
- int type;
- php_output_options out;
- int argc =ZEND_NUM_ARGS();
-
- if (argc < 3 || argc > 4 || (zend_get_parameters_ex(argc, &handle, &rawxml, &caller_params, &output_opts) != SUCCESS)) {
- WRONG_PARAM_COUNT;
- }
- /* user output options */
- set_output_options(&out, *output_opts);
-
- server = zend_list_find(Z_LVAL_PP(handle), &type);
-
- if(type == le_xmlrpc_server) {
- /* HACK: use output encoding for now */
- input_opts.xml_elem_opts.encoding = utf8_get_encoding_id_from_string(out.xmlrpc_out.xml_elem_opts.encoding);
-
- /* generate an XMLRPC_REQUEST from the raw xml input */
- xRequest = XMLRPC_REQUEST_FromXML(Z_STRVAL_PP(rawxml), Z_STRLEN_PP(rawxml), &input_opts);
-
- if(xRequest) {
- const char* methodname = XMLRPC_RequestGetMethodName(xRequest);
- zval **php_function;
- XMLRPC_VALUE xAnswer = NULL;
- MAKE_STD_ZVAL(data.xmlrpc_method); /* init. very important. spent a frustrating day finding this out. */
- MAKE_STD_ZVAL(data.return_data);
- Z_TYPE_P(data.return_data) = IS_NULL; /* in case value is never init'd, we don't dtor to think it is a string or something */
- Z_TYPE_P(data.xmlrpc_method) = IS_NULL;
-
- if (!methodname) {
- methodname = "";
- }
-
- /* setup some data to pass to the callback function */
- Z_STRVAL_P(data.xmlrpc_method) = estrdup(methodname);
- Z_STRLEN_P(data.xmlrpc_method) = strlen(methodname);
- Z_TYPE_P(data.xmlrpc_method) = IS_STRING;
- data.caller_params = *caller_params;
- data.php_executed = 0;
- data.server = server;
-
- /* check if the called method has been previous registered */
- if(zend_hash_find(Z_ARRVAL_P(server->method_map),
- Z_STRVAL_P(data.xmlrpc_method),
- Z_STRLEN_P(data.xmlrpc_method) + 1,
- (void**)&php_function) == SUCCESS) {
-
- data.php_function = *php_function;
- }
-
- /* We could just call the php method directly ourselves at this point, but we do this
- * with a C callback in case the xmlrpc library ever implements some cool usage stats,
- * or somesuch.
- */
- xAnswer = XMLRPC_ServerCallMethod(server->server_ptr, xRequest, &data);
- if(xAnswer && out.b_php_out) {
- zval_dtor(data.return_data);
- FREE_ZVAL(data.return_data);
- data.return_data = XMLRPC_to_PHP(xAnswer);
- } else if(data.php_executed && !out.b_php_out) {
- xAnswer = PHP_to_XMLRPC(data.return_data);
- }
-
- /* should we return data as xml? */
- if(!out.b_php_out) {
- XMLRPC_REQUEST xResponse = XMLRPC_RequestNew();
- if(xResponse) {
- char *outBuf = 0;
- int buf_len = 0;
-
- /* automagically determine output serialization type from request type */
- if (out.b_auto_version) {
- XMLRPC_REQUEST_OUTPUT_OPTIONS opts = XMLRPC_RequestGetOutputOptions(xRequest);
- if (opts) {
- out.xmlrpc_out.version = opts->version;
- }
- }
- /* set some required request hoojum */
- XMLRPC_RequestSetOutputOptions(xResponse, &out.xmlrpc_out);
- XMLRPC_RequestSetRequestType(xResponse, xmlrpc_request_response);
- XMLRPC_RequestSetData(xResponse, xAnswer);
- XMLRPC_RequestSetMethodName(xResponse, methodname);
-
- /* generate xml */
- outBuf = XMLRPC_REQUEST_ToXML(xResponse, &buf_len);
- if(outBuf) {
- RETVAL_STRINGL(outBuf, buf_len, 1);
- free(outBuf);
- }
- /* cleanup after ourselves. what a sty! */
- XMLRPC_RequestFree(xResponse, 0);
- }
- } else { /* or as native php types? */
- *return_value = *data.return_data;
- zval_copy_ctor(return_value);
- }
-
- /* cleanup after ourselves. what a sty! */
- zval_dtor(data.xmlrpc_method);
- FREE_ZVAL(data.xmlrpc_method);
- zval_dtor(data.return_data);
- FREE_ZVAL(data.return_data);
-
- if(xAnswer) {
- XMLRPC_CleanupValue(xAnswer);
- }
-
- XMLRPC_RequestFree(xRequest, 1);
- }
- }
-}
-/* }}} */
-
-
-/* {{{ proto int xmlrpc_server_add_introspection_data(resource server, array desc)
- Adds introspection documentation */
-PHP_FUNCTION(xmlrpc_server_add_introspection_data)
-{
- zval **handle, **desc;
- int type;
- xmlrpc_server_data* server;
-
- if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &handle, &desc) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- server = zend_list_find(Z_LVAL_PP(handle), &type);
-
- if (type == le_xmlrpc_server) {
- XMLRPC_VALUE xDesc = PHP_to_XMLRPC(*desc);
- if (xDesc) {
- int retval = XMLRPC_ServerAddIntrospectionData(server->server_ptr, xDesc);
- XMLRPC_CleanupValue(xDesc);
- RETURN_LONG(retval);
- }
- }
- RETURN_LONG(0);
-}
-/* }}} */
-
-
-/* {{{ proto array xmlrpc_parse_method_descriptions(string xml)
- Decodes XML into a list of method descriptions */
-PHP_FUNCTION(xmlrpc_parse_method_descriptions)
-{
- zval **arg1, *retval;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &arg1) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
-
- if(return_value_used) {
- STRUCT_XMLRPC_ERROR err = {0};
- XMLRPC_VALUE xVal = XMLRPC_IntrospectionCreateDescription(Z_STRVAL_PP(arg1), &err);
- if(xVal) {
- retval = XMLRPC_to_PHP(xVal);
-
- if(retval) {
- *return_value = *retval;
- zval_copy_ctor(return_value);
- }
- /* dust, sweep, and mop */
- XMLRPC_CleanupValue(xVal);
- } else {
- /* could not create description */
- if(err.xml_elem_error.parser_code) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "xml parse error: [line %i, column %i, message: %s] Unable to create introspection data",
- err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid xml structure. Unable to create introspection data");
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "xml parse error. no method description created");
- }
- }
-}
-/* }}} */
-
-
-/************
-* type data *
-************/
-
-#define XMLRPC_TYPE_COUNT 9
-#define XMLRPC_VECTOR_TYPE_COUNT 4
-#define TYPE_STR_MAP_SIZE (XMLRPC_TYPE_COUNT + XMLRPC_VECTOR_TYPE_COUNT)
-
-/* return a string matching a given xmlrpc type */
-static const char** get_type_str_mapping(void)
-{
- static const char* str_mapping[TYPE_STR_MAP_SIZE];
- static int first = 1;
- if (first) {
- /* warning. do not add/delete without changing size define */
- str_mapping[xmlrpc_none] = "none";
- str_mapping[xmlrpc_empty] = "empty";
- str_mapping[xmlrpc_base64] = "base64";
- str_mapping[xmlrpc_boolean] = "boolean";
- str_mapping[xmlrpc_datetime] = "datetime";
- str_mapping[xmlrpc_double] = "double";
- str_mapping[xmlrpc_int] = "int";
- str_mapping[xmlrpc_string] = "string";
- str_mapping[xmlrpc_vector] = "vector";
- str_mapping[XMLRPC_TYPE_COUNT + xmlrpc_vector_none] = "none";
- str_mapping[XMLRPC_TYPE_COUNT + xmlrpc_vector_array] = "array";
- str_mapping[XMLRPC_TYPE_COUNT + xmlrpc_vector_mixed] = "mixed";
- str_mapping[XMLRPC_TYPE_COUNT + xmlrpc_vector_struct] = "struct";
- first = 0;
- }
- return (const char**)str_mapping;
-}
-
-/* map an xmlrpc type to a string */
-const char* xmlrpc_type_as_str(XMLRPC_VALUE_TYPE type, XMLRPC_VECTOR_TYPE vtype)
-{
- const char** str_mapping = get_type_str_mapping();
-
- if (vtype == xmlrpc_vector_none) {
- return str_mapping[type];
- } else {
- return str_mapping[XMLRPC_TYPE_COUNT + vtype];
- }
-}
-
-/* map a string to an xmlrpc type */
-XMLRPC_VALUE_TYPE xmlrpc_str_as_type(const char* str)
-{
- const char** str_mapping = get_type_str_mapping();
- int i;
-
- if (str) {
- for (i = 0; i < XMLRPC_TYPE_COUNT; i++) {
- if (!strcmp(str_mapping[i], str)) {
- return (XMLRPC_VALUE_TYPE) i;
- }
- }
- }
- return xmlrpc_none;
-}
-
-/* map a string to an xmlrpc vector type */
-XMLRPC_VECTOR_TYPE xmlrpc_str_as_vector_type(const char* str)
-{
- const char** str_mapping = get_type_str_mapping();
- int i;
-
- if (str) {
- for (i = XMLRPC_TYPE_COUNT; i < TYPE_STR_MAP_SIZE; i++) {
- if (!strcmp(str_mapping[i], str)) {
- return (XMLRPC_VECTOR_TYPE) (i - XMLRPC_TYPE_COUNT);
- }
- }
- }
- return xmlrpc_none;
-}
-
-
-/* set a given value to a particular type.
- * note: this only works on strings, and only for date and base64,
- * which do not have native php types. black magic lies herein.
- */
-int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype)
-{
- int bSuccess = FAILURE;
- TSRMLS_FETCH();
-
- /* we only really care about strings because they can represent
- * base64 and datetime. all other types have corresponding php types
- */
- if (Z_TYPE_P(value) == IS_STRING) {
- if (newtype == xmlrpc_base64 || newtype == xmlrpc_datetime) {
- const char* typestr = xmlrpc_type_as_str(newtype, xmlrpc_vector_none);
- zval* type;
-
- MAKE_STD_ZVAL(type);
-
- Z_TYPE_P(type) = IS_STRING;
- Z_STRVAL_P(type) = estrdup(typestr);
- Z_STRLEN_P(type) = strlen(typestr);
-
- if(newtype == xmlrpc_datetime) {
- XMLRPC_VALUE v = XMLRPC_CreateValueDateTime_ISO8601(NULL, value->value.str.val);
- if(v) {
- time_t timestamp = XMLRPC_GetValueDateTime(v);
- if(timestamp) {
- pval* ztimestamp;
-
- MAKE_STD_ZVAL(ztimestamp);
-
- ztimestamp->type = IS_LONG;
- ztimestamp->value.lval = timestamp;
-
- convert_to_object(value);
- if(SUCCESS == zend_hash_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void *) &type, sizeof(zval *), NULL)) {
- bSuccess = zend_hash_update(Z_OBJPROP_P(value), OBJECT_VALUE_TS_ATTR, sizeof(OBJECT_VALUE_TS_ATTR), (void *) &ztimestamp, sizeof(zval *), NULL);
- }
- }
- XMLRPC_CleanupValue(v);
- }
- }
- else {
- convert_to_object(value);
- bSuccess = zend_hash_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void *) &type, sizeof(zval *), NULL);
- }
- }
- }
-
- return bSuccess;
-}
-
-/* return xmlrpc type of a php value */
-XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval** newvalue)
-{
- XMLRPC_VALUE_TYPE type = xmlrpc_none;
- TSRMLS_FETCH();
-
- if (value) {
- switch (Z_TYPE_P(value)) {
- case IS_NULL:
- type = xmlrpc_base64;
- break;
-#ifndef BOOL_AS_LONG
-
- /* Right thing to do, but it breaks some legacy code. */
- case IS_BOOL:
- type = xmlrpc_boolean;
- break;
-#else
- case IS_BOOL:
-#endif
- case IS_LONG:
- case IS_RESOURCE:
- type = xmlrpc_int;
- break;
- case IS_DOUBLE:
- type = xmlrpc_double;
- break;
- case IS_CONSTANT:
- type = xmlrpc_string;
- break;
- case IS_STRING:
- type = xmlrpc_string;
- break;
- case IS_ARRAY:
- case IS_CONSTANT_ARRAY:
- type = xmlrpc_vector;
- break;
- case IS_OBJECT:
- {
- zval** attr;
- type = xmlrpc_vector;
-
- if (zend_hash_find(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void**) &attr) == SUCCESS) {
- if (Z_TYPE_PP(attr) == IS_STRING) {
- type = xmlrpc_str_as_type(Z_STRVAL_PP(attr));
- }
- }
- break;
- }
- }
-
- /* if requested, return an unmolested (magic removed) copy of the value */
- if (newvalue) {
- zval** val;
-
- if ((type == xmlrpc_base64 && Z_TYPE_P(value) != IS_NULL) || type == xmlrpc_datetime) {
- if (zend_hash_find(Z_OBJPROP_P(value), OBJECT_VALUE_ATTR, sizeof(OBJECT_VALUE_ATTR), (void**) &val) == SUCCESS) {
- *newvalue = *val;
- }
- } else {
- *newvalue = value;
- }
- }
- }
-
- return type;
-}
-
-
-/* {{{ proto bool xmlrpc_set_type(string value, string type)
- Sets xmlrpc type, base64 or datetime, for a PHP string value */
-PHP_FUNCTION(xmlrpc_set_type)
-{
- zval **arg, **type;
- XMLRPC_VALUE_TYPE vtype;
-
- if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &arg, &type) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(type);
- vtype = xmlrpc_str_as_type(Z_STRVAL_PP(type));
- if (vtype != xmlrpc_none) {
- if (set_zval_xmlrpc_type(*arg, vtype) == SUCCESS) {
- RETURN_TRUE;
- }
- } else {
- zend_error(E_WARNING,"invalid type '%s' passed to xmlrpc_set_type()", Z_STRVAL_PP(type));
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string xmlrpc_get_type(mixed value)
- Gets xmlrpc type for a PHP value. Especially useful for base64 and datetime strings */
-PHP_FUNCTION(xmlrpc_get_type)
-{
- zval **arg;
- XMLRPC_VALUE_TYPE type;
- XMLRPC_VECTOR_TYPE vtype = xmlrpc_vector_none;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &arg) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- type = get_zval_xmlrpc_type(*arg, 0);
- if (type == xmlrpc_vector) {
- vtype = determine_vector_type(Z_ARRVAL_PP(arg));
- }
-
- RETURN_STRING((char*) xmlrpc_type_as_str(type, vtype), 1);
-}
-/* }}} */
-
-/* {{{ proto string xmlrpc_is_fault(array)
- Determines if an array value represents an XMLRPC fault. */
-PHP_FUNCTION(xmlrpc_is_fault)
-{
- zval **arg, **val;
-
- if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &arg) == FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(arg) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array argument expected");
- } else {
- /* The "correct" way to do this would be to call the xmlrpc
- * library XMLRPC_ValueIsFault() func. However, doing that
- * would require us to create an xmlrpc value from the php
- * array, which is rather expensive, especially if it was
- * a big array. Thus, we resort to this not so clever hackery.
- */
- if (zend_hash_find(Z_ARRVAL_PP(arg), FAULT_CODE, FAULT_CODE_LEN + 1, (void**) &val) == SUCCESS &&
- zend_hash_find(Z_ARRVAL_PP(arg), FAULT_STRING, FAULT_STRING_LEN + 1, (void**) &val) == SUCCESS) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
diff --git a/ext/xmlrpc/xmlrpc.dsp b/ext/xmlrpc/xmlrpc.dsp
deleted file mode 100644
index 9c2303721b..0000000000
--- a/ext/xmlrpc/xmlrpc.dsp
+++ /dev/null
@@ -1,211 +0,0 @@
-# Microsoft Developer Studio Project File - Name="xmlrpc" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=xmlrpc - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc.mak" CFG="xmlrpc - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xmlrpc - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "xmlrpc - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xmlrpc - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "libxmlrpc" /I "..\..\bundle\expat" /D HAVE_XMLRPC=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /D ZTS=1 /D COMPILE_DL_XMLRPC=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x1009 /d "_DEBUG"
-# ADD RSC /l 0x1009 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 iconv.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_xmlrpc.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "xmlrpc - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "libxmlrpc" /I "..\..\bundle\expat" /D HAVE_XMLRPC=1 /D "ZEND_WIN32" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D ZTS=1 /D COMPILE_DL_XMLRPC=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x1009 /d "NDEBUG"
-# ADD RSC /l 0x1009 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 iconv.lib php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_xmlrpc.dll" /libpath:"..\..\Release_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "xmlrpc - Win32 Debug_TS"
-# Name "xmlrpc - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=".\xmlrpc-epi-php.c"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_xmlrpc.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Group "libxmlrpc"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\libxmlrpc\base64.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\base64.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\encodings.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\encodings.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\queue.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\queue.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\simplestring.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\simplestring.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\system_methods.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\system_methods_private.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_element.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_element.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_dandarpc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_dandarpc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_soap.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_soap.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_xmlrpc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_xmlrpc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_introspection.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_introspection.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_introspection_private.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_private.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/xslt/README.XSLT-BACKENDS b/ext/xslt/README.XSLT-BACKENDS
deleted file mode 100644
index b779c952ef..0000000000
--- a/ext/xslt/README.XSLT-BACKENDS
+++ /dev/null
@@ -1,285 +0,0 @@
-+------------------------------------------------------------------------------+
-| CREATING XSLT BACKENDS |
-+------------------------------------------------------------------------------+
-
- Author(s): Sterling Hughes <sterling@php.net>
-
- Introduction
- -------------------------------------------------------------------------------
- Truth be told, at this point in time there are about a zillion and two
- different XSLT libraries, each with their own unique merits and faults. If you
- provide a Sablotron extension, people will clamor for a Xalan extension, if you
- provide a Xalan extension people will clamor for a libxslt extension.
-
- In order to be as user friendly as possible, we try and provide the most
- options to the user. At the same time we must try to keep a level of
- consistency, so the user does not need to remember 15 different syntaxes, etc.
- for each XSLT extension, and when switching from XSLT backends, no changes in
- the PHP code should be necessary (akin to the concept of a database independent
- api, but with XSLT libraries).
-
- At the same time, you'll also notice that in some cases extensions seem to
- duplicate each others functionality. All extensions need code for calling
- user-defined handlers, omitting debug messages, etc. In the interests of
- laziness, we must also try to make these as minimal as possible.
-
- Therefore, I've created a processor independent api for XSLT, aka, the XSLT
- extension (but doesn't "A processor independent API for XSLT" sound cooler?).
- It defines a set of functions which every XSLT backend must provide, as well
- as a syntax which those functions must adhere to. Furthermore, the underlying
- code, provides a "library" if you will, of code that is relevant to all XSLT
- extensions.
-
- The API
- -------------------------------------------------------------------------------
- Every extension must define the following functions:
-
- - xslt_create()
- - xslt_set_scheme_handlers()
- - xslt_set_sax_handlers()
- - xslt_set_error_handler()
- - xslt_set_log()
- - xslt_set_object()
- - xslt_process()
- - xslt_error()
- - xslt_errno()
- - xslt_free()
-
- These functions are common or implementable with every single XSLT library that
- I've come across so far (at least every C library) and should there for be
- defined by the extension.
-
-
- resource xslt_create(void)
-
- The XSLT create function allocates a new XSLT processor and returns a resource
- pointer to the XSLT processor. It also handles any initialization that the
- processor requires.
-
-
- void xslt_set_scheme_handlers(resource processor, array handlers)
-
- Registers the scheme handlers for the document (aka XPath handlers), given a
- XSLT processor resource (allocated by xslt_create()) and an array in the
- following format:
-
- array(
- "get_all" => function,
- "open" => function,
- "get" => function,
- "put" => function,
- "close" => function
- )
-
- Where function is either a function name or an array in the following format:
-
- array(&$obj, "method")
-
- Note: You do not need to handle the array(&$obj, "method") syntax by yourself
- as this is handled in the call_xslt_function() library function (and
- more specifically, Zend's call_user_function_ex() function.
- Note: The given array does not need to contain all of the different scheme
- handler elements (although it can), but it only needs to conform to
- the "handler" => "function" format described above.
-
- Each of the individual scheme handler functions called are in the formats
- below:
-
- string get_all(resource processor, string scheme, string rest)
- resource open(resource processor, string scheme, string rest)
- int get(resource processor, resource fp, string &data)
- int put(resource processor, resource fp, string data)
- void close(resource processor, resource fp)
-
-
- void xslt_set_sax_handlers(resource processor, array handlers)
-
- Registers the SAX handlers for the document, given a XSLT processor resource
- (allocated by xslt_create()) and an array in the following format:
-
- array(
- "document" => array(document_start_function,
- document_end_function),
- "element" => array(element_start_function,
- element_end_function),
- "namespace" => array(namespace_start_function,
- namespace_end_function),
- "comment" => function,
- "pi" => function,
- "character" => function
- )
-
- Where the functions follow the syntax described for the scheme handler
- functions.
-
- Each of the individual SAX handler functions are in the format below:
-
- void start_doc(resource processor)
- void end_doc(resource processor)
- void start_element(resource processor, string name, array attributes)
- void end_element(resource processor, string name)
- void start_namespace(resource processor, string prefix, string uri)
- void end_namespace(resource processor, string prefix)
- void comment(resource processor, string contents)
- void pi(resource processor, string target, string contents)
- void characters(resource processor, string contents)
-
-
- void xslt_set_error_handler(resource processor, function error_handler)
-
- This function sets the user defined error handler to be called when a
- processing or any other type of error occurs. It is given a XSLT
- processor resource (allocated by xslt_create()) and an error function of
- the same syntax described for the scheme handler function.
-
- The user defined error handler as the following syntax:
-
- void error(resource processor, int level, int error, array info)
-
-
- void xslt_set_log(resource processor, string logname)
-
- Sets the XSLT log to record log information (processor messages, not errors).
- Its given a XSLT processor (allocated by xslt_create()) and a string containing
- the name of the log file. If the string is "php://stderr" then the logging
- should go to standard error (stderr). Also the default place to send log
- messages is standard error (if no log file is set).
-
-
- mixed xslt_process(resource processor,
- string xml,
- string xsl[,
- string result[,
- array arguments[,
- array parameters]]])
-
- This function performs the magic, it takes the user's data, performs the
- transformation and depending on the context either saves the result to a file
- or returns the data to the user.
-
- To understand the way the xslt_process() function works, you must first
- understand the concept of "argument buffers". Argument buffers are equivalent
- to the concept of symlinks on a Unix system, take the following example:
-
- <?php
-
- /**
- * $xml contains the contents of an XML file and $xsl contains
- * the contents of an XSLT stylesheet
- */
- $args = array("/_xml" => $xml,
- "/_xsl" => $xsl);
-
- $xh = xslt_create();
- $data = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args);
- xslt_free($xh);
-
- print( "The results of the transformation were\n" );
- print( "<br>\n<hr>\n<br>" );
- print( $data );
- print( "<br>\n<hr>\n<br>" );
- ?>
-
- See what was done? The argument buffer was declared ($args) and the different
- arguments were defined. Then when the xslt_process() function was called
- instead of giving the XML filename and XSLT filename we instead gave
- "arguments", which correspond to the XML and XSLT data in the argument buffers.
-
- This concept is a bit foreign to some people, however, I find it the best way
- to handle processing xsl data. If you're still having trouble with this, try
- playing around with the sablotron backend a bit, you should be able to catch on
- pretty quickly.
-
- In order to use argument buffers, the XSLT extension provides a couple of easy
- to use API functions, you can use them as follows:
-
- {
- zval **arguments_zp;
- char **arguments_cp;
- xslt_args *arguments;
- char *types[] = { "file", "data" };
-
- /* Fetch the arguments from the user into a zval ** */
-
- /* Translate the zval array into a character array */
- xslt_make_array(&arguments_cp, arguments_zp);
-
- /* Translate the character array into an xslt_arg * structure */
- arguments = xslt_parse_arguments(arguments_cp);
-
- /* Print out the resulting xslt_arg * structure */
- php_printf("XML type: %s\n", types[arguments->xml.type]);
- php_printf("XML data: %s\n", arguments->xml.ptr);
- PUTS("\n");
- php_printf("XSLT type: %s\n", types[arguments->xsl.type]);
- php_printf("XSLT data: %s\n", arguments->xsl.ptr);
- PUTS("\n");
- php_printf("Result type: %s\n", types[arguments->result.type]);
- php_printf("Result data: %s\n", arguments->result.ptr);
- PUTS("\n");
- }
-
- You can also test the "type" field by using the XSLT_IS_FILE and XSLT_IS_DATA
- constants.
-
- Anyway back to the syntax of the xslt_process() function. The first argument
- to the xslt_process() function is a resource pointer to the XSLT processor to
- be used. The second argument is either an "argument buffer" pointing to the
- XML data or the name of a file containing the XML data. The third argument is
- either an argument buffer pointing to the XSLT data or a file containing the
- XSLT data. The fourth argument is optional, it either contains the name of the
- file to place the results of the transformation into, NULL or "arg:/_result",
- in the latter 2 cases, the results of the transformation will be returned. The
- fifth optional argument is the "argument buffer" itself, it is an associative
- PHP array of "argument_name" => "value" pairs, or NULL, if no arguments are to
- be passed. The final optional argument is a set of parameters to pass to the
- XSLT stylesheet. The parameter argument is an associative array of
- "parameter_name" => "value" pairs.
-
-
- string xslt_error(resource processor)
-
- The xslt_error() function returns the last error that occured, given a XSLT
- processor resource (allocated by xslt_create()).
-
-
- int xslt_errno(resource processor)
-
- The xslt_errno() function returns the last error number that occured given a
- XSLT processor resource (allocated by xslt_create()).
-
-
- void xslt_free(resource processor)
-
- The xslt_free() function free's the given XSLT processor resource (allocated
- by xslt_create()).
-
-
- Config.m4
- -------------------------------------------------------------------------------
-
- The XSLT extension's "magic" really occurs in the config.m4 file. Here you
- must add a couple of things in order for your backend to be enabled. Its a bit
- too complex to describe (but easy to implement and understand). Take a look at
- config.m4 (which is well commented) to see what is necessary.
-
-
- Makefile.in
- -------------------------------------------------------------------------------
-
- Simply add the source files for your backend to the LTLIBRARY_SOURCES variable
- and you're all set with this file.
-
-
- Conclusion
- -------------------------------------------------------------------------------
-
- Nobody's perfect, I'm sure I've made some mistakes while thinking this whole
- thing through and I would be glad to hear from any of you who think I'm a
- colossal moron and think you have a better way to do it. Please e-mail at
- sterling@php.net, this extension will only get better with feedback.
-
- With that said, the concepts here may take a little bit of time to sink in, I
- know I've written a whole lot. My suggestion to you, if you're planning on
- writing an XSLT backend is simply to go off and implement, taking the api
- section as a guide and making sure you match that api as closely as possible.
diff --git a/ext/xslt/TODO b/ext/xslt/TODO
deleted file mode 100644
index cf85d7c264..0000000000
--- a/ext/xslt/TODO
+++ /dev/null
@@ -1,31 +0,0 @@
-To Do List
-
-This informal list is the working list for the php sablotron extension. It is
-maintained and used by the people on sab-php@gingerall.cz. See
-http://www.gingerall.org/charlie/ga/xml/m_ml.xml for more information.
-
-The numbering of the items on the list does not imply priority. Rather it is
-simply a means for efficient communication on the mailing lists.
-
-$Id$
-
-Short Term
-==========
-1. Add streams support for file paths in 4th and 5th arg of xslt_process
-2. Use zend_parse_parameters and related API's
-3. SDOM_* stuff which does xpath queries.
- - Melvyn
-
-
-Long Term
-=========
-1. Documentation of the wide variety of functions now available.
- - Roy Huggins
-2. remove TSRMLS_FETCH() and expand user_data parameter to forward the
-actual tsrmls value.
- - suggested by Marcus Boerger
-
-3. Evaluate OO functions, ZE2
- - All
-4. Prolly an API rewrite, for php5
- - All
diff --git a/ext/xslt/config.m4 b/ext/xslt/config.m4
deleted file mode 100644
index e29e244093..0000000000
--- a/ext/xslt/config.m4
+++ /dev/null
@@ -1,164 +0,0 @@
-dnl
-dnl $Id$
-dnl
-dnl +------------------------------------------------------------------------------+
-dnl | This is where the magic of the extension reallly is. Depending on what |
-dnl | backend the user chooses, this script performs the magic |
-dnl +------------------------------------------------------------------------------+
-
-PHP_ARG_ENABLE(xslt, whether to enable xslt support,
-[ --enable-xslt Enable xslt support.])
-
-PHP_ARG_WITH(xslt-sablot, for XSLT Sablotron backend,
-[ --with-xslt-sablot=DIR XSLT: Enable the sablotron backend.], no, no)
-
-PHP_ARG_WITH(expat-dir, for libexpat dir for Sablotron XSL support,
-[ --with-expat-dir=DIR XSLT: libexpat dir for Sablotron.], no, no)
-
-PHP_ARG_WITH(iconv-dir, for iconv dir for Sablotron XSL support,
-[ --with-iconv-dir=DIR XSLT: iconv dir for Sablotron.], no, no)
-
-PHP_ARG_WITH(sablot-js, for JavaScript for Sablotron XSL support,
-[ --with-sablot-js=DIR XSLT: enable JavaScript support for Sablotron.], no, no)
-
-
-if test "$PHP_XSLT" != "no"; then
-
- PHP_NEW_EXTENSION(xslt, xslt.c sablot.c, $ext_shared)
- PHP_SUBST(XSLT_SHARED_LIBADD)
-
- if test "$PHP_XSLT_SABLOT" != "no"; then
- XSLT_CHECK_DIR=$PHP_XSLT_SABLOT
- XSLT_TEST_FILE=/include/sablot.h
- XSLT_BACKEND_NAME=Sablotron
- XSLT_LIBNAME=sablot
- fi
-
- if test -z "$XSLT_BACKEND_NAME"; then
- AC_MSG_ERROR([No backend specified for XSLT extension.])
- fi
-
- condition="$XSLT_CHECK_DIR$XSLT_TEST_FILE"
-
- if test -r $condition; then
- XSLT_DIR=$XSLT_CHECK_DIR
- else
- AC_MSG_CHECKING(for $XSLT_BACKEND_NAME libraries in the default path)
- for i in /usr /usr/local; do
- condition="$i$XSLT_TEST_FILE"
- if test -r $condition; then
- XSLT_DIR=$i
- fi
- done
- AC_MSG_RESULT(found in $XSLT_DIR)
- fi
-
- if test -z "$XSLT_DIR"; then
- AC_MSG_ERROR([not found. Please re-install the $XSLT_BACKEND_NAME distribution.])
- fi
-
- if test "$PHP_XSLT_SABLOT" != "no"; then
- AC_MSG_CHECKING([for sablot-config])
- if test -x $XSLT_DIR/bin/sablot-config ; then
- AC_MSG_RESULT(found)
- AC_DEFINE(HAVE_SABLOT_CONFIG, 1, [Whether the Sablotron config file is found])
- dnl Use this script to register this information in phpinfo()
- SABINF_CFLAGS=`$XSLT_DIR/bin/sablot-config --cflags`
- SABINF_LIBS=`$XSLT_DIR/bin/sablot-config --libs`
- SABINF_PREFIX=`$XSLT_DIR/bin/sablot-config --prefix`
- SABINF_ALL="\"Cflags: $SABINF_CFLAGS\nLibs: $SABINF_LIBS\nPrefix: $SABINF_PREFIX\""
- PHP_DEFINE(SAB_INFO, "$SABINF_ALL")
- else
- AC_MSG_RESULT(not found)
- fi
- AC_MSG_CHECKING([for Sablotron version])
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS -I$XSLT_DIR/include"
- AC_TRY_RUN([
-#include <stdlib.h>
-#include <sablot.h>
-
-int main ()
-{
- double version;
- version = atof(SAB_VERSION);
-
- if (version >= 0.96) {
- exit(0);
- }
- exit(255);
-}
- ],[
- AC_MSG_RESULT([>= 0.96])
- ],[
- AC_MSG_ERROR([Sablotron version 0.96 or greater required.])
- ])
- CPPFLAGS=$old_CPPFLAGS
-
- found_expat=no
- for i in $PHP_EXPAT_DIR $XSLT_DIR /usr/local /usr; do
- if test -f $i/lib/libexpat.a -o -f $i/lib/libexpat.$SHLIB_SUFFIX_NAME; then
- AC_DEFINE(HAVE_LIBEXPAT2, 1, [ ])
- PHP_ADD_INCLUDE($i/include)
- PHP_ADD_LIBRARY_WITH_PATH(expat, $i/lib, XSLT_SHARED_LIBADD)
- found_expat=yes
- break
- fi
- done
-
- if test "$found_expat" = "no"; then
- AC_MSG_ERROR([expat not found. To build sablotron you need the expat library.])
- fi
-
- if test "$PHP_ICONV_DIR" != "no"; then
- PHP_ICONV=$PHP_ICONV_DIR
- fi
-
- if test "$PHP_ICONV" = "no"; then
- PHP_ICONV=yes
- fi
-
- PHP_SETUP_ICONV(XSLT_SHARED_LIBADD, [], [
- AC_MSG_ERROR([iconv not found. To build sablotron you need the iconv library.])
- ])
-
- if test "$PHP_SABLOT_JS" != "no"; then
- for i in /usr/local /usr $PHP_SABLOT_JS; do
- if test -f $i/lib/libjs.a -o -f $i/lib/libjs.$SHLIB_SUFFIX_NAME; then
- PHP_SABLOT_JS_DIR=$i
- fi
- done
-
- PHP_CHECK_LIBRARY(js, JS_GetRuntime,
- [
- PHP_ADD_LIBRARY_WITH_PATH(js, $PHP_SABLOT_JS_DIR/lib, XSLT_SHARED_LIBADD)
- ], [
- AC_MSG_ERROR([libjs not found. Please check config.log for more information.])
- ], [
- -L$PHP_SABLOT_JS_DIR/lib
- ])
- fi
-
- PHP_CHECK_LIBRARY(sablot, SablotSetEncoding,
- [
- AC_DEFINE(HAVE_SABLOT_SET_ENCODING, 1, [ ])
- ], [], [
- -L$XSLT_DIR/lib
- ])
-
- dnl SablotSetOptions implemented in Sablotron CVS > 2002/10/31
- PHP_CHECK_LIBRARY(sablot, SablotGetOptions,
- [
- AC_DEFINE(HAVE_SABLOT_GET_OPTIONS, 1, [Whether Sablotron supports SablotGetOptions])
- ], [], [
- -L$XSLT_DIR/lib
- ])
-
- AC_DEFINE(HAVE_SABLOT_BACKEND, 1, [ ])
- fi
-
- PHP_ADD_INCLUDE($XSLT_DIR/include)
- PHP_ADD_LIBRARY_WITH_PATH($XSLT_LIBNAME, $XSLT_DIR/lib, XSLT_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_XSLT, 1, [ ])
-fi
diff --git a/ext/xslt/php_sablot.h b/ext/xslt/php_sablot.h
deleted file mode 100644
index 7f4b415c18..0000000000
--- a/ext/xslt/php_sablot.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_XSLT_H
-#define PHP_XSLT_H
-
-#include "php.h"
-
-#if HAVE_SABLOT_BACKEND
-
-#include "php_xslt.h"
-
-#include <sablot.h>
-
-extern zend_module_entry xslt_module_entry;
-#define phpext_xslt_ptr &xslt_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_XSLT_API __declspec(dllexport)
-#else
-#define PHP_XSLT_API
-#endif
-
-#define XSLT_SCHEME(handle) ((handle)->handlers->scheme)
-#define XSLT_SAX(handle) ((handle)->handlers->sax)
-#define XSLT_ERROR(handle) ((handle)->handlers->error)
-
-#define XSLT_PROCESSOR(handle) ((handle)->processor.ptr)
-#define XSLT_SITUATION(handle) ((handle)->processor.sit)
-
-#define XSLT_ERRNO(handle) ((handle)->err->no)
-#define XSLT_ERRSTR(handle) ((handle)->err->str)
-#define XSLT_LOG(handle) ((handle)->err->log)
-#define XSLT_BASE_ISSET(handle) ((handle)->base_isset)
-
-#define XSLT_FUNCH_FREE(__var) if (__var) zval_ptr_dtor(&(__var));
-#define XSLT_REG_ERRMSG(msg, handle) if (XSLT_ERRSTR(handle)) efree(XSLT_ERRSTR(handle)); \
- XSLT_ERRSTR(handle) = estrdup(msg);
-#define XSLT_NO_INFO "No information available."
-
-PHP_MINIT_FUNCTION(xslt);
-PHP_MINFO_FUNCTION(xslt);
-
-PHP_FUNCTION(xslt_create);
-PHP_FUNCTION(xslt_set_sax_handlers);
-PHP_FUNCTION(xslt_set_scheme_handlers);
-PHP_FUNCTION(xslt_set_error_handler);
-PHP_FUNCTION(xslt_set_base);
-PHP_FUNCTION(xslt_set_encoding);
-PHP_FUNCTION(xslt_set_log);
-PHP_FUNCTION(xslt_process);
-PHP_FUNCTION(xslt_error);
-PHP_FUNCTION(xslt_errno);
-PHP_FUNCTION(xslt_free);
-PHP_FUNCTION(xslt_set_object);
-PHP_FUNCTION(xslt_setopt);
-#ifdef HAVE_SABLOT_GET_OPTIONS
-PHP_FUNCTION(xslt_getopt);
-#endif
-PHP_FUNCTION(xslt_backend_version);
-PHP_FUNCTION(xslt_backend_name);
-PHP_FUNCTION(xslt_backend_info);
-
-struct scheme_handlers {
- zval *sh_get_all;
- zval *sh_open;
- zval *sh_get;
- zval *sh_put;
- zval *sh_close;
-};
-
-struct sax_handlers {
- zval *doc_start;
- zval *element_start;
- zval *element_end;
- zval *namespace_start;
- zval *namespace_end;
- zval *comment;
- zval *pi;
- zval *characters;
- zval *doc_end;
-};
-
-struct xslt_handlers {
- struct scheme_handlers scheme;
- struct sax_handlers sax;
- zval *error;
-};
-
-struct xslt_processor {
- SablotHandle ptr;
- SablotSituation sit;
- long idx;
-};
-
-struct xslt_log {
- char *path;
- int fd;
- int do_log;
-};
-
-struct xslt_error {
- struct xslt_log log;
- char *str;
- int no;
-};
-
-typedef struct {
- struct xslt_handlers *handlers;
- struct xslt_processor processor;
- struct xslt_error *err;
- zval *object;
- unsigned short base_isset;
-} php_xslt;
-
-#else
-#define phpext_xslt_ptr NULL
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/xslt/php_xslt.h b/ext/xslt/php_xslt.h
deleted file mode 100644
index 4c73b3df0b..0000000000
--- a/ext/xslt/php_xslt.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef _PHP_XSLT_H
-#define _PHP_XSLT_H
-
-#include "php.h"
-#include "ext/standard/php_filestat.h"
-
-#ifdef HAVE_XSLT
-
-#define XSLT_OBJ(__func) (&(__func)->obj)
-#define XSLT_FUNC(__func) ((__func)->func)
-
-#define XSLT_IS_FILE 0
-#define XSLT_IS_DATA 1
-
-struct xslt_function {
- zval *obj;
- zval *func;
-};
-
-struct _xslt_argument {
- char *ptr;
- int type;
-};
-
-typedef struct {
- struct _xslt_argument xml;
- struct _xslt_argument xsl;
- struct _xslt_argument result;
-} xslt_args;
-
-extern xslt_args *xslt_parse_arguments(char *, char *, char *, char **);
-extern void xslt_free_arguments(xslt_args *);
-
-extern void xslt_assign_handler(struct xslt_function **, zval **);
-extern void xslt_free_handler(struct xslt_function *);
-extern void xslt_call_function(char *, zval *, zval *, int, zval **, zval **);
-
-extern void xslt_debug(char *, char *, ...);
-
-extern void xslt_make_array(zval **zarr, char ***carr);
-extern void xslt_free_array(char **arr);
-
-#endif
-
-#endif
diff --git a/ext/xslt/sablot.c b/ext/xslt/sablot.c
deleted file mode 100644
index e10fe841bd..0000000000
--- a/ext/xslt/sablot.c
+++ /dev/null
@@ -1,1821 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- | David Viner <dviner@php.net> |
- | Lenar Lohmus <flex@php.net> |
- | Melvyn Sopacua <msopacua@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_xslt.h"
-#include "php_sablot.h"
-#include "ext/standard/info.h"
-
-#if HAVE_SABLOT_BACKEND
-
-#ifdef HAVE_SABLOT_CONFIG
-#include "php_sab_info.h"
-#endif
-#include <sablot.h>
-
-#include <string.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-/* functions relating to handlers */
-static void register_sax_handler_pair(zval **, zval **, zval ** TSRMLS_DC);
-
-/* Free processor */
-static void free_processor(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-
-/* Scheme handler functions */
-static int scheme_getall(void *, SablotHandle, const char *, const char *, char **, int *);
-static int scheme_freememory(void *, SablotHandle, char *);
-static int scheme_open(void *, SablotHandle, const char *, const char *, int *);
-static int scheme_get(void *, SablotHandle, int, char *, int *);
-static int scheme_put(void *, SablotHandle, int, const char *, int *);
-static int scheme_close(void *, SablotHandle, int);
-
-/* Sax handler functions */
-static SAX_RETURN sax_startdoc(void *, SablotHandle);
-static SAX_RETURN sax_startelement(void *, SablotHandle, const char *, const char **);
-static SAX_RETURN sax_endelement(void *, SablotHandle, const char *);
-static SAX_RETURN sax_startnamespace(void *, SablotHandle, const char *, const char *);
-static SAX_RETURN sax_endnamespace(void *, SablotHandle, const char *);
-static SAX_RETURN sax_comment(void *, SablotHandle, const char *);
-static SAX_RETURN sax_pi(void *, SablotHandle, const char *, const char *);
-static SAX_RETURN sax_characters(void *, SablotHandle, const char *, int);
-static SAX_RETURN sax_enddoc(void *, SablotHandle);
-
-/* Error handlers */
-static MH_ERROR error_makecode(void *, SablotHandle, int, unsigned short, unsigned short);
-static MH_ERROR error_log(void *, SablotHandle, MH_ERROR, MH_LEVEL, char **);
-static MH_ERROR error_print(void *, SablotHandle, MH_ERROR, MH_LEVEL, char **);
-
-/* Resource related */
-#define le_xslt_name "XSLT Processor"
-static int le_xslt;
-
-/* {{{ xslt_functions[]
- */
-static unsigned char second_args_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
-
-function_entry xslt_functions[] = {
- PHP_FE(xslt_create, NULL)
- PHP_FE(xslt_set_sax_handlers, NULL)
- PHP_FE(xslt_set_scheme_handlers, NULL)
- PHP_FE(xslt_set_error_handler, NULL)
- PHP_FE(xslt_set_base, NULL)
-#ifdef HAVE_SABLOT_SET_ENCODING
- PHP_FE(xslt_set_encoding, NULL)
-#endif
- PHP_FE(xslt_set_log, NULL)
- PHP_FE(xslt_process, NULL)
- PHP_FE(xslt_error, NULL)
- PHP_FE(xslt_errno, NULL)
- PHP_FE(xslt_free, NULL)
- PHP_FE(xslt_set_object, second_args_force_ref)
- PHP_FE(xslt_setopt, NULL)
-#ifdef HAVE_SABLOT_GET_OPTIONS
- PHP_FE(xslt_getopt, NULL)
-#endif
- PHP_FE(xslt_backend_version, NULL)
- PHP_FE(xslt_backend_name, NULL)
- PHP_FE(xslt_backend_info, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ xslt_module_entry
- */
-zend_module_entry xslt_module_entry = {
- STANDARD_MODULE_HEADER,
- "xslt",
- xslt_functions,
- PHP_MINIT(xslt),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(xslt),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_XSLT
-ZEND_GET_MODULE(xslt)
-#endif
-
-/* {{{ handler structs
- A structure containing the sax handlers, automatically
- registered whether the user defines them or not */
-static SAXHandler sax_handlers =
-{
- sax_startdoc,
- sax_startelement,
- sax_endelement,
- sax_startnamespace,
- sax_endnamespace,
- sax_comment,
- sax_pi,
- sax_characters,
- sax_enddoc
-};
-
-/* Error handlers, automatically registered */
-static MessageHandler message_handler = {
- error_makecode,
- error_log,
- error_print
-};
-
-/* Scheme handlers automatically registered */
-static SchemeHandler scheme_handler = {
- scheme_getall,
- scheme_freememory,
- scheme_open,
- scheme_get,
- scheme_put,
- scheme_close
-};
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(xslt)
-{
- le_xslt = zend_register_list_destructors_ex(free_processor, NULL, le_xslt_name, module_number);
-
- /* Generic options, which can apply to 'all' xslt processors */
- REGISTER_LONG_CONSTANT("XSLT_OPT_SILENT", SAB_NO_ERROR_REPORTING, CONST_CS | CONST_PERSISTENT);
-
- /* Error constants, which are useful in userspace. */
- REGISTER_LONG_CONSTANT("XSLT_ERR_UNSUPPORTED_SCHEME", SH_ERR_UNSUPPORTED_SCHEME, CONST_CS | CONST_PERSISTENT);
- /* Sablotron specific options */
- REGISTER_LONG_CONSTANT("XSLT_SABOPT_PARSE_PUBLIC_ENTITIES", SAB_PARSE_PUBLIC_ENTITIES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSLT_SABOPT_DISABLE_ADDING_META", SAB_DISABLE_ADDING_META, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSLT_SABOPT_DISABLE_STRIPPING", SAB_DISABLE_STRIPPING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSLT_SABOPT_IGNORE_DOC_NOT_FOUND", SAB_IGNORE_DOC_NOT_FOUND, CONST_CS | CONST_PERSISTENT);
-/* hack: implemented at the same time, so should work.
- Otherwise we need to check the enum type of SablotFlag in <sablot.h> */
-#ifdef HAVE_SABLOT_GET_OPTIONS
- REGISTER_LONG_CONSTANT("XSLT_SABOPT_FILES_TO_HANDLER", SAB_FILES_TO_HANDLER, CONST_CS | CONST_PERSISTENT);
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(xslt)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "XSLT support", "enabled");
- php_info_print_table_row(2, "Backend", "Sablotron");
-#ifdef SAB_VERSION
- php_info_print_table_row(2, "Sablotron Version", SAB_VERSION);
-#endif
-#ifdef HAVE_SABLOT_CONFIG
- php_info_print_table_row(2, "Sablotron Information", SAB_INFO);
-#endif
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ proto resource xslt_create(void)
- Create a new XSLT processor */
-PHP_FUNCTION(xslt_create)
-{
- php_xslt *handle; /* The php -> sablotron handle */
- SablotHandle processor; /* The sablotron processor */
- SablotSituation sit; /* The sablotron Situation handle */
- int error; /* The error container */
-
- /* Allocate the php-sablotron handle */
- handle = ecalloc(1, sizeof(php_xslt));
- handle->handlers = ecalloc(1, sizeof(struct xslt_handlers));
- handle->err = ecalloc(1, sizeof(struct xslt_error));
- handle->object = NULL;
- handle->base_isset = 0;
-
- XSLT_LOG(handle).path = NULL;
-
- /* Allocate the actual processor itself, via sablotron */
- SablotCreateSituation(&sit);
- error = SablotCreateProcessorForSituation(sit, &processor);
- if (error) {
- XSLT_ERRNO(handle) = error;
- RETURN_FALSE;
- }
-
- /* Save the processor and set the default handlers */
- XSLT_PROCESSOR(handle) = processor;
- XSLT_SITUATION(handle) = sit;
- SablotRegHandler(XSLT_PROCESSOR(handle), HLR_SAX, (void *) &sax_handlers, (void *) handle);
- SablotRegHandler(XSLT_PROCESSOR(handle), HLR_MESSAGE, (void *) &message_handler, (void *) handle);
- SablotRegHandler(XSLT_PROCESSOR(handle), HLR_SCHEME, (void *) &scheme_handler, (void *) handle);
-
- /* Register the processor as a resource and return it to the user */
- ZEND_REGISTER_RESOURCE(return_value, handle, le_xslt);
-
- /* The resource index, save it for later use */
- handle->processor.idx = Z_LVAL_P(return_value);
-}
-/* }}} */
-
-/* {{{ proto void xslt_set_sax_handlers(resource processor, array handlers)
- Set the SAX handlers to be called when the XML document gets processed */
-PHP_FUNCTION(xslt_set_sax_handlers)
-{
- zval **processor_p, /* Resource pointer to the php->sablotron handle */
- **sax_handlers_p, /* Pointer to the sax handlers php array */
- **handler; /* Individual handler, or handler pair */
- HashTable *sax_handlers; /* PHP array of sax handlers */
- php_xslt *handle; /* Pointer to a php_xslt handle */
- char *string_key; /* String key for the hash */
- ulong num_key; /* (unused) hash's numerical key */
- int key_type; /* The type of the current hash key */
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &processor_p, &sax_handlers_p) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
-
- /* Convert the sax_handlers_p zval ** to a hash table we can process */
- sax_handlers = HASH_OF(*sax_handlers_p);
- if (!sax_handlers) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expecting an array as the second argument");
- return;
- }
-
- /* Loop through the HashTable containing the SAX handlers */
- for (zend_hash_internal_pointer_reset(sax_handlers);
- zend_hash_get_current_data(sax_handlers, (void **) &handler) == SUCCESS;
- zend_hash_move_forward(sax_handlers)) {
-
- key_type = zend_hash_get_current_key(sax_handlers, &string_key, &num_key, 0);
- if (key_type == HASH_KEY_IS_LONG) {
- convert_to_string_ex(handler);
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Skipping numerical index %d (with value %s)",
- num_key, Z_STRVAL_PP(handler));
- continue;
- }
-
- /* Document handlers (document start, document end) */
- if (strcasecmp(string_key, "document") == 0) {
- SEPARATE_ZVAL(handler);
- register_sax_handler_pair(&XSLT_SAX(handle).doc_start,
- &XSLT_SAX(handle).doc_end,
- handler TSRMLS_CC);
- }
- /* Element handlers, start of an element, and end of an element */
- else if (strcasecmp(string_key, "element") == 0) {
- SEPARATE_ZVAL(handler);
- register_sax_handler_pair(&XSLT_SAX(handle).element_start,
- &XSLT_SAX(handle).element_end,
- handler TSRMLS_CC);
- }
- /* Namespace handlers, start of a namespace, end of a namespace */
- else if (strcasecmp(string_key, "namespace") == 0) {
- SEPARATE_ZVAL(handler);
- register_sax_handler_pair(&XSLT_SAX(handle).namespace_start,
- &XSLT_SAX(handle).namespace_end,
- handler TSRMLS_CC);
- }
- /* Comment handlers, called when a comment is reached */
- else if (strcasecmp(string_key, "comment") == 0) {
- XSLT_SAX(handle).comment = *handler;
- zval_add_ref(&XSLT_SAX(handle).comment);
- }
- /* Processing instructions handler called when processing instructions
- (<? ?>) */
- else if (strcasecmp(string_key, "pi") == 0) {
- XSLT_SAX(handle).pi = *handler;
- zval_add_ref(&XSLT_SAX(handle).pi);
- }
- /* Character handler, called when data is found */
- else if (strcasecmp(string_key, "character") == 0) {
- XSLT_SAX(handle).characters = *handler;
- zval_add_ref(&XSLT_SAX(handle).characters);
- }
- /* Invalid handler name, tsk, tsk, tsk :) */
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid option: %s", string_key);
- }
- }
-}
-/* }}} */
-
-/* {{{ proto void xslt_set_scheme_handlers(resource processor, array handlers)
- Set the scheme handlers for the XSLT processor */
-PHP_FUNCTION(xslt_set_scheme_handlers)
-{
- zval **processor_p, /* Resource pointer to the php->sablotron handle */
- **scheme_handlers_p, /* Pointer to the scheme handler array */
- **handler; /* Individual scheme handler */
- zval **assign_handle; /* The handler to assign to */
- HashTable *scheme_handlers; /* Scheme handler array */
- php_xslt *handle; /* php->sablotron handle */
- char *string_key; /* Hash key (string) */
- ulong num_key; /* (unused) Hash key (number) */
- int key_type; /* The type of the current key */
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &processor_p, &scheme_handlers_p) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
-
- scheme_handlers = HASH_OF(*scheme_handlers_p);
- if (!scheme_handlers) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument must be an array");
- return;
- }
-
- /* Loop through the scheme handlers array, setting the given
- scheme handlers */
- for (zend_hash_internal_pointer_reset(scheme_handlers);
- zend_hash_get_current_data(scheme_handlers, (void **) &handler) == SUCCESS;
- zend_hash_move_forward(scheme_handlers)) {
-
- key_type = zend_hash_get_current_key(scheme_handlers, &string_key, &num_key, 0);
- if (key_type == HASH_KEY_IS_LONG) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Numerical key %d (with value %s) being ignored",
- num_key, Z_STRVAL_PP(handler));
- continue;
- }
-
- /* Open the URI and return the whole string */
- if (strcasecmp(string_key, "get_all") == 0) {
- assign_handle = &XSLT_SCHEME(handle).sh_get_all;
- }
- /* Open the URI and return a handle */
- else if (strcasecmp(string_key, "open") == 0) {
- assign_handle = &XSLT_SCHEME(handle).sh_open;
- }
- /* Retrieve data from the URI */
- else if (strcasecmp(string_key, "get") == 0) {
- assign_handle = &XSLT_SCHEME(handle).sh_get;
- }
- /* Save data to the URI */
- else if (strcasecmp(string_key, "put") == 0) {
- assign_handle = &XSLT_SCHEME(handle).sh_put;
- }
- /* Close the URI */
- else if (strcasecmp(string_key, "close") == 0) {
- assign_handle = &XSLT_SCHEME(handle).sh_close;
- }
- /* Invalid handler name */
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid option '%s', skipping", string_key);
- continue;
- }
-
- *assign_handle = *handler;
- zval_add_ref(assign_handle);
- }
-}
-/* }}} */
-
-/* {{{ proto void xslt_set_error_handler(resource processor, mixed error_func)
- Set the error handler, to be called when an XSLT error happens */
-PHP_FUNCTION(xslt_set_error_handler)
-{
- zval **processor_p, /* Resource Pointer to a PHP-XSLT processor */
- **error_func; /* Name of the user defined error function */
- php_xslt *handle; /* A PHP-XSLT processor */
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &processor_p, &error_func) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
-
- XSLT_ERROR(handle) = *error_func;
- zval_add_ref(&XSLT_ERROR(handle));
-}
-/* }}} */
-
-/* {{{ proto void xslt_set_base(resource processor, string base)
- Sets the base URI for all XSLT transformations */
-PHP_FUNCTION(xslt_set_base)
-{
- zval **processor_p, /* Resource Pointer to a PHP-XSLT processor */
- **base; /* The base URI for the transformation */
- php_xslt *handle; /* A PHP-XSLT processor */
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &processor_p, &base) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
- convert_to_string_ex(base);
-
- /* Set the base */
- SablotSetBase(XSLT_PROCESSOR(handle), Z_STRVAL_PP(base));
- XSLT_BASE_ISSET(handle) = 1;
-}
-/* }}} */
-
-/* {{{ proto void xslt_set_encoding(resource processor, string encoding)
- Set the output encoding for the current stylesheet */
-PHP_FUNCTION(xslt_set_encoding)
-{
-/* The user has to explicitly compile sablotron with sablotron
- encoding functions in order for SablotSetEncoding to be
- enabled. config.m4 automatically checks for this... */
-
-#ifdef HAVE_SABLOT_SET_ENCODING
- zval **processor_p, /* Resource Pointer to a PHP-XSLT processor */
- **encoding; /* The encoding to use for the output */
- php_xslt *handle; /* A PHP-XSLT processor */
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &processor_p, &encoding) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
- convert_to_string_ex(encoding);
-
- /* Set the encoding */
- SablotSetEncoding(XSLT_PROCESSOR(handle), Z_STRVAL_PP(encoding));
-#endif
-
-}
-/* }}} */
-
-/* {{{ proto void xslt_set_log(resource processor, string logfile)
- Set the log file to write the errors to (defaults to stderr) */
-PHP_FUNCTION(xslt_set_log)
-{
- zval **processor_p, /* Resource pointer to a PHP-XSLT processor */
- **logfile; /* Path to the logfile */
- php_xslt *handle; /* A PHP-XSLT processor */
- int argc = ZEND_NUM_ARGS(); /* Argument count */
-
- if (argc < 1 || argc > 2 ||
- zend_get_parameters_ex(argc, &processor_p, &logfile) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
-
- if (Z_TYPE_PP(logfile) == IS_LONG || Z_TYPE_PP(logfile) == IS_BOOL || Z_TYPE_PP(logfile) == IS_DOUBLE) {
- XSLT_LOG(handle).do_log = Z_LVAL_PP(logfile);
- RETURN_NULL();
- }
- else {
- convert_to_string_ex(logfile);
- }
-
- /* If the log file already exists, free it */
- if (XSLT_LOG(handle).path) {
- efree(XSLT_LOG(handle).path);
- }
-
- /* Copy the path */
- XSLT_LOG(handle).path = estrndup(Z_STRVAL_PP(logfile),
- Z_STRLEN_PP(logfile));
-}
-/* }}} */
-
-/* {{{ proto string xslt_process(resource processor, string xml, string xslt[, mixed result[, array args[, array params]]])
- Perform the xslt transformation */
-PHP_FUNCTION(xslt_process)
-{
- zval **processor_p, /* Resource Pointer to a PHP-XSLT processor */
- **xml_p, /* A zval pointer to the XML data */
- **xslt_p, /* A zval pointer to the XSLT data */
- **result_p, /* A zval pointer to the transformation results */
- **params_p, /* A zval pointer to the XSLT parameters array */
- **args_p; /* A zval pointer to the XSLT arguments array */
- php_xslt *handle; /* A PHP-XSLT processor */
- char **params = NULL; /* A Sablotron parameter array (derived from the zval parameter array) */
- char **args = NULL; /* A Sablotron argument array (derived from the zval argument array) */
- char *xslt; /* The XSLT stylesheet or argument buffer (pointer to xslt_p) */
- char *xml; /* The XML stylesheet or argument buffer (pointer to xml_p) */
- char *result; /* The result file or argument buffer */
- int argc = ZEND_NUM_ARGS(); /* The number of arguments given */
- int error; /* Our error container */
- int i; /* iterator for Situation */
-
- if (argc < 3 || argc > 6 ||
- zend_get_parameters_ex(argc, &processor_p, &xml_p, &xslt_p, &result_p, &args_p, &params_p) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
- convert_to_string_ex(xml_p);
- convert_to_string_ex(xslt_p);
-
- xml = Z_STRVAL_PP(xml_p);
- xslt = Z_STRVAL_PP(xslt_p);
-
- /* Well, no result file was given or result buffer, that means (guess what?)
- we're returning the result yipp di doo! */
- if (argc < 4 || Z_TYPE_PP(result_p) == IS_NULL) {
- result = "arg:/_result";
- }
- /* The result buffer to place the data into, either a file or an argument buffer, etc. */
- else {
- convert_to_string_ex(result_p);
- result = Z_STRVAL_PP(result_p);
- }
-
- /* Translate a PHP array into a Sablotron array */
- if (argc > 4) {
- xslt_make_array(args_p, &args);
- /* Can return NULL */
- if (args) {
- TSRMLS_FETCH();
- i=0;
- while (args[i]) {
- /* We can safely add args[i+1] since xslt_make_array sets args[i] to NULL if
- a key on the array is missing. */
- /* For now, we don't care about the error. So don't store it. */
- SablotAddArgBuffer(XSLT_SITUATION(handle), XSLT_PROCESSOR(handle), args[i], args[i+1]);
- i += 2;
- }
-
- /* Since we have args passed, we need to set the base uri, so pull in executor
- globals and set the base, using the current filename, specifcally for the
- 'arg' scheme */
- if(XSLT_BASE_ISSET(handle) == 0)
- {
- char *baseuri;
- spprintf(&baseuri, 0, "file://%s", zend_get_executed_filename(TSRMLS_C));
- SablotSetBaseForScheme(XSLT_PROCESSOR(handle), "arg", baseuri);
-
- if(baseuri)
- efree(baseuri);
- }
- }
- }
-
- if (argc > 5) {
- xslt_make_array(params_p, &params);
- /* Can return NULL */
- if (params) {
- i=0;
- while (params[i]) {
- SablotAddParam(XSLT_SITUATION(handle), XSLT_PROCESSOR(handle), params[i], params[i+1]);
- i += 2;
- }
- }
- }
-
- /* Perform transformation */
- error = SablotRunProcessorGen(XSLT_SITUATION(handle), XSLT_PROCESSOR(handle), xslt, xml, result);
- if (error) {
- XSLT_ERRNO(handle) = error;
-
- if (params) xslt_free_array(params);
- if (args) xslt_free_array(args);
-
- RETURN_FALSE;
- }
-
- /* If the result buffer is specified, then we return the results of the XSLT
- transformation */
- if (!strcmp(result, "arg:/_result")) {
- char *trans_result;
-
- /* Fetch the result buffer into trans_result */
- error = SablotGetResultArg(handle->processor.ptr, "arg:/_result", &trans_result);
- if (error) {
- /* Save the error number */
- XSLT_ERRNO(handle) = error;
-
- /* Cleanup */
- if (params) xslt_free_array(params);
- if (args) xslt_free_array(args);
-
- RETURN_FALSE;
- }
-
- RETVAL_STRING(trans_result, 1);
- SablotFree(trans_result);
- }
- else {
- RETVAL_TRUE;
- }
-
- /* Cleanup */
- if (params) xslt_free_array(params);
- if (args) xslt_free_array(args);
-}
-/* }}} */
-
-/* {{{ proto int xslt_errno(resource processor)
- Error number */
-PHP_FUNCTION(xslt_errno)
-{
- zval **processor_p; /* Resource pointer to a PHP-XSLT processor */
- php_xslt *handle; /* A PHP-XSLT processor */
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &processor_p) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
-
- RETURN_LONG(XSLT_ERRNO(handle));
-}
-/* }}} */
-
-/* {{{ proto string xslt_error(resource processor)
- Error string */
-PHP_FUNCTION(xslt_error)
-{
- zval **processor_p; /* Resource pointer to a PHP-XSLT processor */
- php_xslt *handle; /* A PHP-XSLT processor */
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &processor_p) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
-
- if (XSLT_ERRSTR(handle)) {
- RETURN_STRING(XSLT_ERRSTR(handle), 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto void xslt_free(resource processor)
- Free the xslt processor up */
-PHP_FUNCTION(xslt_free)
-{
- zval **processor_p; /* Resource pointer to a php-xslt processor */
- php_xslt *handle; /* A PHP-XSLT processor */
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &processor_p) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
-
- /* Remove the entry from the list */
- zend_list_delete(Z_LVAL_PP(processor_p));
-}
-/* }}} */
-
-/* {{{ proto int xslt_set_object(resource parser, object obj)
- sets the object in which to resolve callback functions */
-PHP_FUNCTION(xslt_set_object)
-{
- zval *processor_p; /* Resource pointer to a PHP-XSLT processor */
- zval *myobj; /* The object that will handle the callback */
- php_xslt *handle; /* A PHP-XSLT processor */
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zo", &processor_p, &myobj) == FAILURE)
- return;
-
- ZEND_FETCH_RESOURCE(handle, php_xslt *, &processor_p, -1, le_xslt_name, le_xslt);
-
- handle->object = myobj;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xslt_setopt(resource processor, int newmask)
- Set options on a given xsl processor */
-PHP_FUNCTION(xslt_setopt)
-{
- zval **processor_p; /* Resource pointer to a PHP-XSLT processor */
- zval **zbitmask; /* A bitmask created by through processor specific constants */
- php_xslt *handle; /* A PHP-XSLT processor */
- int error; /* Error return codes */
- int newmask; /* New mask */
-#ifdef HAVE_SABLOT_GET_OPTIONS
- int prevmask; /* Previous mask */
-#endif
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &processor_p, &zbitmask) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
- convert_to_long_ex(zbitmask);
-
- newmask = Z_LVAL_PP(zbitmask);
- if (newmask < 0) {
- php_error_docref("function.xslt-setopt" TSRMLS_CC, E_WARNING, "Invalid bitmask: %i", newmask);
- RETURN_FALSE;
- }
-
-#ifdef HAVE_SABLOT_GET_OPTIONS
- prevmask = SablotGetOptions(XSLT_SITUATION(handle));
-#endif
- error = SablotSetOptions(XSLT_SITUATION(handle), newmask);
- if (error) {
- /* FIXME: Need to analyze the return code to give a more verbose error description */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Failed to set options");
- }
-
-#ifdef HAVE_SABLOT_GET_OPTIONS
- RETURN_LONG(prevmask);
-#else
- RETURN_TRUE;
-#endif
-}
-
-/* }}} */
-
-#ifdef HAVE_SABLOT_GET_OPTIONS
-/* {{{ proto int xslt_getopt(resource processor)
- Get options on a given xsl processor */
-PHP_FUNCTION(xslt_getopt)
-{
- zval **processor_p; /* Resource pointer to a PHP-XSLT processor */
- php_xslt *handle; /* A PHP-XSLT processor */
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &processor_p) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
-
- RETURN_LONG(SablotGetOptions(XSLT_SITUATION(handle)));
-}
-
-/* }}} */
-#endif
-
-/* {{{ proto string xslt_backend_version()
- Returns the version number of Sablotron (if available) */
-PHP_FUNCTION(xslt_backend_version)
-{
-#ifdef SAB_VERSION
- RETURN_STRING(SAB_VERSION,1);
-#else
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto string xslt_backend_name()
- Returns the name of the Backend (here "Sablotron")*/
-PHP_FUNCTION(xslt_backend_name)
-{
- RETURN_STRING("Sablotron",1);
-}
-/* }}} */
-
-/* {{{ proto string xslt_backend_info()
- Returns the information on the compilation settings of the backend */
-PHP_FUNCTION(xslt_backend_info)
-{
-#ifdef HAVE_SABLOT_CONFIG
- RETURN_STRING(SAB_INFO, strlen(SAB_INFO));
-#else
- RETURN_STRING(XSLT_NO_INFO, strlen(XSLT_NO_INFO));
-#endif
-}
-/* }}} */
-/* {{{ free_processor()
- Free an XSLT processor */
-static void free_processor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- php_xslt *handle = (php_xslt *) rsrc->ptr; /* A PHP-XSLT processor */
-
- /* Free the processor */
- if (XSLT_PROCESSOR(handle)) {
- SablotUnregHandler(XSLT_PROCESSOR(handle), HLR_MESSAGE, NULL, NULL);
- SablotUnregHandler(XSLT_PROCESSOR(handle), HLR_SAX, NULL, NULL);
- SablotUnregHandler(XSLT_PROCESSOR(handle), HLR_SCHEME, NULL, NULL);
- SablotDestroyProcessor(XSLT_PROCESSOR(handle));
- SablotDestroySituation(XSLT_SITUATION(handle));
- }
-
- /* Free Scheme handlers */
- XSLT_FUNCH_FREE(XSLT_SCHEME(handle).sh_get_all);
- XSLT_FUNCH_FREE(XSLT_SCHEME(handle).sh_open);
- XSLT_FUNCH_FREE(XSLT_SCHEME(handle).sh_get);
- XSLT_FUNCH_FREE(XSLT_SCHEME(handle).sh_put);
- XSLT_FUNCH_FREE(XSLT_SCHEME(handle).sh_close);
- /* Free SAX handlers */
- XSLT_FUNCH_FREE(XSLT_SAX(handle).doc_start);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).element_start);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).element_end);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).namespace_start);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).namespace_end);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).comment);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).pi);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).characters);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).doc_end);
- /* Free error handler */
- XSLT_FUNCH_FREE(XSLT_ERROR(handle));
-
- /* Free error message, if any */
- if (XSLT_ERRSTR(handle)) {
- efree(XSLT_ERRSTR(handle));
- }
-
- /* Close log file */
- if (XSLT_LOG(handle).fd) {
- close(XSLT_LOG(handle).fd);
- }
-
- /* Free log file path */
- if (XSLT_LOG(handle).path) {
- efree(XSLT_LOG(handle).path);
- }
-
- /* Free up the handle */
- efree(handle->handlers);
- efree(handle->err);
- efree(handle);
-}
-/* }}} */
-
-/* {{{ register_sax_handler_pair()
- Register a pair of sax handlers */
-static void register_sax_handler_pair(zval **handler1, zval **handler2, zval **handler TSRMLS_DC)
-{
- zval **current; /* The current handler we're grabbing */
-
- /* Grab and assign handler 1 */
- if (zend_hash_index_find(Z_ARRVAL_PP(handler), 0, (void **) &current) == SUCCESS) {
- *handler1 = *current;
- zval_add_ref(handler1);
- }
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong format of arguments");
- return;
- }
-
- /* Grab and assign handler 2 */
- if (zend_hash_index_find(Z_ARRVAL_PP(handler), 1, (void **) &current) == SUCCESS) {
- *handler2 = *current;
- zval_add_ref(handler2);
- }
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong format of arguments");
- return;
- }
-}
-/* }}} */
-
-/* {{{ scheme_getall()
- The getall scheme handler */
-static int scheme_getall(void *user_data, SablotHandle proc, const char *scheme, const char *rest, char **buffer, int *byte_count)
-{
- zval *argv[3]; /* Arguments to the scheme getall function */
- zval *retval; /* Return value from the scheme getall function */
- int result;
- php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */
- TSRMLS_FETCH();
-
- /* If the scheme handler get all function doesn't
- exist, exit out */
- if (!XSLT_SCHEME(handle).sh_get_all) {
- return 0;
- }
-
- /* Allocate and initialize */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Scheme (string)
- Argument 3: Rest (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) scheme, 1);
- ZVAL_STRING(argv[2], (char *) rest, 1);
-
- xslt_call_function("scheme get all", XSLT_SCHEME(handle).sh_get_all, handle->object,
- 3, argv, &retval);
-
- if (!retval) {
- /* return failure */
- return 1;
- }
-
- if ((Z_TYPE_P(retval) == IS_BOOL && Z_LVAL_P(retval) == 0) || (Z_TYPE_P(retval) == IS_NULL)) {
- result = 1;
- } else {
- /* Convert the return value to string if needed */
- if (Z_TYPE_P(retval) != IS_STRING)
- convert_to_string_ex(&retval);
-
- /* Save the return value in the buffer (copying it) */
- *buffer = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
- *byte_count = Z_STRLEN_P(retval);
- result = 0;
- }
-
- /* Free return value */
- zval_ptr_dtor(&retval);
-
- return result;
-}
-/* }}} */
-
-/* {{{ scheme_handler_is_registered()
- Check to see if the scheme handler is registered with the user */
-static int scheme_handler_is_registered(php_xslt *handle)
-{
- /* If one of the functions is exists, then scheme
- handlers are registered */
- if (XSLT_SCHEME(handle).sh_get_all ||
- XSLT_SCHEME(handle).sh_open ||
- XSLT_SCHEME(handle).sh_get ||
- XSLT_SCHEME(handle).sh_put ||
- XSLT_SCHEME(handle).sh_close)
- return 1;
- /* otherwise, no cigar */
- else
- return 0;
-}
-/* }}} */
-
-/* {{{ scheme_freememory()
- Called when sablotron needs to free memory related to scheme handling */
-static int scheme_freememory(void *user_data, SablotHandle proc, char *buffer)
-{
- /* If we don't have any scheme handler's registered, then emalloc() wasn't
- used, and if emalloc() wasn't then efree shouldn't be used */
- if (!scheme_handler_is_registered((php_xslt *) user_data)) {
- return 0;
- }
-
- /* Free the memory using efree() and remove it from the register */
- efree(buffer);
-
- return 0;
-}
-/* }}} */
-
-/* {{{ scheme_open()
- Called when the URI needs to be opened */
-static int scheme_open(void *user_data, SablotHandle proc, const char *scheme, const char *rest, int *fd)
-{
- zval *argv[3]; /* Arguments to the scheme open function */
- zval *retval; /* The return value from the scheme open function */
- php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */
- TSRMLS_FETCH();
-
- /* If no open handler exists, let's exit */
- if (!XSLT_SCHEME(handle).sh_open) {
- return 0;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
-
- /* Argument 1: XSLT Processor (resource)
- Argument 2: Scheme (string)
- Argument 3: Rest (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) scheme, 1);
- ZVAL_STRING(argv[2], (char *) rest, 1);
-
- /* Call the function */
- xslt_call_function("scheme open", XSLT_SCHEME(handle).sh_open, handle->object,
- 3, argv, &retval);
-
- if (!retval) {
- /* return failure */
- return 1;
- }
-
- /* Return value is a resource pointer to an open file */
- *fd = Z_LVAL_P(retval);
-
- /* Free it all up */
- zval_ptr_dtor(&retval);
-
- if (!*fd) {
- /* return failure - unsupported scheme */
- return SH_ERR_UNSUPPORTED_SCHEME;
- }
-
- /* return success */
- return 0;
-}
-/* }}} */
-
-/* {{{ scheme_get()
- Called when data needs to be fetched from the URI */
-static int scheme_get(void *user_data, SablotHandle proc, int fd, char *buffer, int *byte_count)
-{
- zval *argv[3]; /* Arguments to the scheme get function */
- zval *retval; /* Return value from the scheme get function */
- php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */
- TSRMLS_FETCH();
-
- /* If no get handler exists, let's exit */
- if (!XSLT_SCHEME(handle).sh_get) {
- return 0;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
-
- /* Argument 1: XSLT Processor (resource)
- Argument 2: File Pointer (resource)
- Argument 3: Data (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_RESOURCE(argv[1], fd);
- zend_list_addref(fd);
- ZVAL_STRINGL(argv[2], buffer, *byte_count, 0);
-
- /* Call the function */
- xslt_call_function("scheme get", XSLT_SCHEME(handle).sh_get, handle->object,
- 3, argv, &retval);
-
- if (!retval) {
- /* return failure */
- return 1;
- }
-
- /* Returns the number of bytes read */
- *byte_count = Z_LVAL_P(retval);
-
- /* Free things up */
- zval_ptr_dtor(&retval);
-
- /* return success */
- return 0;
-}
-/* }}} */
-
-/* {{{ scheme_put()
- Called when data needs to be written */
-static int scheme_put(void *user_data, SablotHandle proc, int fd, const char *buffer, int *byte_count)
-{
- zval *argv[3]; /* Arguments to the scheme put function */
- zval *retval; /* Return value from the scheme put function */
- php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */
- TSRMLS_FETCH();
-
- /* If no put handler exists, let's exit */
- if (!XSLT_SCHEME(handle).sh_put) {
- return 0;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: File pointer (resource)
- Argument 3: Data (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_RESOURCE(argv[1], fd);
- zend_list_addref(fd);
- ZVAL_STRINGL(argv[2], (char *) buffer, *byte_count, 1);
-
- /* Call the scheme put function already */
- xslt_call_function("scheme put", XSLT_SCHEME(handle).sh_put, handle->object,
- 3, argv, &retval);
-
- if (!retval) {
- /* return failure */
- return 1;
- }
-
- /* The return value is the number of bytes written */
- *byte_count = Z_LVAL_P(retval);
-
- /* Free everything up */
- zval_ptr_dtor(&retval);
-
- /* Return success */
- return 0;
-}
-/* }}} */
-
-/* {{{ scheme_close()
- Called when its time to close the fd */
-static int scheme_close(void *user_data, SablotHandle proc, int fd)
-{
- zval *argv[2]; /* Arguments to the scheme close function*/
- zval *retval; /* Return value from the scheme close function */
- php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */
- TSRMLS_FETCH();
-
- /* if no close handler exists, exit */
- if (!XSLT_SCHEME(handle).sh_close) {
- return 0;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: File pointer (resource)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_RESOURCE(argv[1], fd);
- zend_list_addref(fd);
-
- /* Call the scheme handler close function */
- xslt_call_function("scheme close", XSLT_SCHEME(handle).sh_close, handle->object,
- 2, argv, &retval);
-
- if (!retval) {
- /* return failure */
- return 1;
- }
-
- /* Free everything up */
- zval_ptr_dtor(&retval);
-
- /* Return success */
- return 0;
-}
-/* }}} */
-
-/* {{{ sax_startdoc()
- Called when the document starts to be processed */
-static SAX_RETURN sax_startdoc(void *ctx, SablotHandle processor)
-{
- zval *argv[1]; /* Arguments to the sax start doc function */
- zval *retval; /* Return value from sax start doc function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
- TSRMLS_FETCH();
-
- /* if no document start function exists, exit */
- if (!XSLT_SAX(handle).doc_start) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
-
- /* Argument 1: XSLT processor (resource) */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
-
- /* Call the Sax start doc function */
- xslt_call_function("sax start doc", XSLT_SAX(handle).doc_start, handle->object,
- 1, argv, &retval);
-
- /* Cleanup */
- if (retval)
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ sax_startelement()
- Called when an element is begun to be processed */
-static SAX_RETURN sax_startelement(void *ctx, SablotHandle processor,
- const char *name,
- const char **attr)
-{
- zval *argv[3]; /* Arguments to the sax start element function */
- zval *retval; /* Return value from the sax start element function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
- char **p; /* Pointer to attributes */
- TSRMLS_FETCH();
-
- /* If no element start function is found, exit */
- if (!XSLT_SAX(handle).element_start) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
- array_init(argv[2]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Element name (string)
- Argument 3: Element attributes (array)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) name, 1);
-
- /* loop through the attributes array, copying it onto our
- php array */
- p = (char **) attr;
- while (p && *p) {
- add_assoc_string(argv[2], *p, *(p + 1), 1);
- p += 2;
- }
-
- /* Call the sax element start function */
- xslt_call_function("sax start element", XSLT_SAX(handle).element_start, handle->object,
- 3, argv, &retval);
-
- /* Cleanup */
- if (retval)
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ xslt_sax_endelement()
- Called when an ending XML element is encountered */
-static SAX_RETURN sax_endelement(void *ctx, SablotHandle processor, const char *name)
-{
- zval *argv[2]; /* Arguments to the sax end element function */
- zval *retval; /* Return value from the sax end element function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
- TSRMLS_FETCH();
-
- /* If no element end function exists, exit */
- if (!XSLT_SAX(handle).element_end) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Element name (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) name, 1);
-
- /* Call the sax end element function */
- xslt_call_function("sax end element", XSLT_SAX(handle).element_end, handle->object,
- 2, argv, &retval);
-
- /* Cleanup */
- if (retval)
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ sax_startnamespace()
- Called at the beginning of the parsing of a new namespace */
-static SAX_RETURN sax_startnamespace(void *ctx, SablotHandle processor,
- const char *prefix,
- const char *uri)
-{
- zval *argv[3]; /* Arguments to the sax start namespace function */
- zval *retval; /* Return value from the sax start namespace function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
- TSRMLS_FETCH();
-
- /* if no namespace start function exists, exit */
- if (!XSLT_SAX(handle).namespace_start) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Prefix (string)
- Argument 3: URI (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) prefix, 1);
- ZVAL_STRING(argv[2], (char *) uri, 1);
-
- /* Call the sax start namespace function */
- xslt_call_function("sax start namespace", XSLT_SAX(handle).namespace_start, handle->object,
- 3, argv, &retval);
-
- /* Cleanup */
- if (retval)
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ sax_endnamespace()
- Called when a new namespace is finished being parsed */
-static SAX_RETURN sax_endnamespace(void *ctx, SablotHandle processor, const char *prefix)
-{
- zval *argv[2]; /* Arguments to the sax end namespace function */
- zval *retval; /* Return value from the sax end namespace function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
- TSRMLS_FETCH();
-
- /* If no namespace end function exists, exit */
- if (!XSLT_SAX(handle).namespace_end) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Prefix (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) prefix, 1);
-
- /* Call the sax end namespace function */
- xslt_call_function("sax end namespace", XSLT_SAX(handle).namespace_end, handle->object,
- 2, argv, &retval);
-
- /* Cleanup */
- if (retval)
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ sax_comment()
- Called when a comment is found */
-static SAX_RETURN sax_comment(void *ctx, SablotHandle processor, const char *contents)
-{
- zval *argv[2]; /* Arguments to the sax comment function */
- zval *retval; /* Return value from the sax comment function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
- TSRMLS_FETCH();
-
- /* if no comment function exists, exit */
- if (!XSLT_SAX(handle).comment) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Comment contents (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) contents, 1);
-
- /* Call the sax comment function */
- xslt_call_function("sax comment", XSLT_SAX(handle).comment, handle->object,
- 2, argv, &retval);
-
- /* Cleanup */
- if (retval)
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ sax_pi()
- Called when processing instructions are found */
-static SAX_RETURN sax_pi(void *ctx, SablotHandle processor,
- const char *target,
- const char *contents)
-{
- zval *argv[3]; /* Arguments to the sax processing instruction function */
- zval *retval; /* Return value from the sax processing instruction function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
- TSRMLS_FETCH();
-
- /* If no processing instructions function exists, exit */
- if (!XSLT_SAX(handle).pi) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Target of the pi (string)
- Argument 3: Contents of the pi (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) target, 1);
- ZVAL_STRING(argv[2], (char *) contents, 1);
-
- /* Call processing instructions function */
- xslt_call_function("sax processing instructions", XSLT_SAX(handle).pi, handle->object,
- 3, argv, &retval);
-
- /* Cleanup */
- if (retval)
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ sax_characters()
- Called when characters are come upon */
-static SAX_RETURN sax_characters(void *ctx, SablotHandle processor,
- const char *contents,
- int length)
-{
- zval *argv[2]; /* Arguments to the sax characters function */
- zval *retval; /* Return value to the sax characters function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
- TSRMLS_FETCH();
-
- /* If no characters function exists, exit */
- if (!XSLT_SAX(handle).characters) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Contents (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRINGL(argv[1], (char *) contents, length, 1);
-
- /* Call characters function */
- xslt_call_function("sax characters", XSLT_SAX(handle).characters, handle->object,
- 2, argv, &retval);
-
- /* Cleanup */
- if (retval)
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ sax_enddoc()
- Called when the document is finished being parsed */
-static SAX_RETURN sax_enddoc(void *ctx, SablotHandle processor)
-{
- zval *argv[1]; /* Arguments to the end document function */
- zval *retval; /* Return value from the end document function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
- TSRMLS_FETCH();
-
- /* If no end document function exists, exit */
- if (!XSLT_SAX(handle).doc_end) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
-
- /* Argument 1: XSLT Processor (resource)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
-
- /* Call the function */
- xslt_call_function("sax end doc", XSLT_SAX(handle).doc_end, handle->object,
- 1, argv, &retval);
-
- /* Cleanup */
- if (retval)
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ error_makecode()
- Make the error code */
-static MH_ERROR error_makecode(void *user_data, SablotHandle proc, int severity, unsigned short facility, unsigned short code)
-{
- return 0;
-}
-/* }}} */
-
-/* {{{ error_log()
- Called when its time to log data */
-static MH_ERROR error_log(void *user_data, SablotHandle proc, MH_ERROR code, MH_LEVEL level, char **fields)
-{
- php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */
- char *errmsg = NULL; /* Error message*/
- char *errtype = NULL; /* Error type */
- char *errline = NULL; /* Error line */
- char *msgbuf = NULL; /* Message buffer */
- char msgformat[] = "Sablotron Message on line %s, level %s: %s\n"; /* Message format */
- int error = 0; /* Error container */
- TSRMLS_FETCH();
-
- if (!XSLT_LOG(handle).do_log)
- return 0;
-
- /* Parse the error array */
- /* Loop through the error array */
- if (fields) {
- while (*fields) {
- char *key; /* Key to for the message */
- char *val; /* The message itself */
- char *ptr; /* Pointer to the location of the ':' (separator) */
- int pos; /* Position of the ':' (separator) */
- int len; /* Length of the string */
-
- len = strlen(*fields);
-
- /* Grab the separator's position */
- ptr = strchr(*fields, ':');
- if (!ptr) {
- continue;
- }
- pos = ptr - *fields;
-
- /* Allocate the key and value and copy the data onto them */
- key = emalloc(pos + 1);
- val = emalloc((len - pos) + 1);
-
- strlcpy(key, *fields, pos + 1);
- strlcpy(val, *fields + pos + 1, len - pos);
-
- /* Check to see whether or not we want to save the data */
- if (!strcmp(key, "msg")) {
- errmsg = estrndup(val, len - pos);
- }
- else if (!strcmp(key, "type")) {
- errtype = estrndup(val, len - pos);
- }
- else if (!strcmp(key, "line")) {
- errline = estrndup(val, len - pos);
- }
- /* Haven't seen this yet, but turning it on during dev, to see
- what we can encounter -- MRS
- else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Got key %s with val %s", key, val);
- }
- */
-
- /* Cleanup */
- if (key) efree(key);
- if (val) efree(val);
-
- /* Next key:value pair please :) */
- fields++;
- }
- }
-
- /* If no error line is given, then place none in the
- file */
- if (!errline) {
- errline = estrndup("none", sizeof("none") - 1);
- }
-
- /* Default type is a log handle */
- if (!errtype) {
- errtype = estrndup("log", sizeof("log") - 1);
- }
-
- /* No error message, no cry */
- if (!errmsg) {
- errmsg = estrndup("unknown error", sizeof("unknown error") - 1);
- }
-
- /* Allocate the message buf and copy the data into it */
- msgbuf = emalloc((sizeof(msgformat) - 6) +
- strlen(errmsg) +
- strlen(errline) +
- strlen(errtype) + 1);
- sprintf(msgbuf, msgformat, errline, errtype, errmsg);
-
- /* If the error is serious enough, copy it to our error buffer
- which will show up when someone calls the xslt_error() function */
- if (level == MH_LEVEL_WARN ||
- level == MH_LEVEL_ERROR ||
- level == MH_LEVEL_CRITICAL) {
- XSLT_REG_ERRMSG(errmsg, handle);
- }
-
- /* If we haven't allocated and opened the file yet */
- if (!XSLT_LOG(handle).fd) {
- /* Lets open up a file */
- if (XSLT_LOG(handle).path && strcmp(XSLT_LOG(handle).path, "php://stderr")) {
- /* open for append */
- XSLT_LOG(handle).fd = open(XSLT_LOG(handle).path,
- O_WRONLY|O_CREAT|O_APPEND,
- S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR);
- if (XSLT_LOG(handle).fd == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot open log file, %s [%d]: %s",
- XSLT_LOG(handle).path, errno, strerror(errno));
- XSLT_LOG(handle).fd = 0;
- }
- }
- /* Default is stderr, or if the user provided "php://stderr" that's the
- stream */
- else {
- XSLT_LOG(handle).fd = 2;
- }
- }
-
- /* Write the error to the file */
- error = write(XSLT_LOG(handle).fd, msgbuf, strlen(msgbuf));
- if (error == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot write data to log file, %s, with fd, %d [%d]: %s",
- (XSLT_LOG(handle).path ? XSLT_LOG(handle).path : "stderr"),
- XSLT_LOG(handle).fd,
- errno,
- strerror(errno));
- return 0;
- }
-
- /* Cleanup */
- if (msgbuf) efree(msgbuf);
- if (errtype) efree(errtype);
- if (errline) efree(errline);
- if (errmsg) efree(errmsg);
-
- return 0;
-}
-/* }}} */
-
-/* {{{ error_print()
- Print out an error message or call the error handler */
-static MH_ERROR error_print(void *user_data, SablotHandle proc, MH_ERROR code, MH_LEVEL level, char **fields)
-{
- php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */
- TSRMLS_FETCH();
-
- if (XSLT_ERROR(handle)) {
- zval *argv[4]; /* Arguments to the error function */
- zval *retval; /* Return value from the error function */
-
- /* Allocate and initialize */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
- MAKE_STD_ZVAL(argv[3]);
- array_init(argv[3]);
-
- /* Argument 1: XSLT Processor (resource)
- Argument 2: Error level (long)
- Argument 3: Error code (long)
- Argument 4: Error messages (array)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_LONG(argv[1], level);
- ZVAL_LONG(argv[2], code);
-
- if (fields) {
- while (*fields) {
- char *key; /* Key to for the message */
- char *val; /* The message itself */
- char *ptr; /* Pointer to the location of the ':' (separator) */
- int pos; /* Position of the ':' (separator) */
- int len; /* Length of the string */
-
- len = strlen(*fields);
-
- /* Grab the separator's position */
- ptr = strchr(*fields, ':');
- if (!ptr) {
- continue;
- }
- pos = ptr - *fields;
-
- /* Allocate the key and value and copy the data onto them */
- key = emalloc(pos + 1);
- val = emalloc((len - pos) + 1);
-
- strlcpy(key, *fields, pos + 1);
- strlcpy(val, *fields + pos + 1, len - pos);
-
- /* Add it */
- add_assoc_stringl_ex(argv[3], key, pos + 1, val, len - pos - 1, 1);
-
- /* Cleanup */
- efree(key);
- efree(val);
-
- /* Next field please */
- fields++;
- }
- }
-
- /* Call the function */
- xslt_call_function("error handler", XSLT_ERROR(handle), handle->object,
- 4, argv, &retval);
-
- /* Free up */
- if (retval)
- zval_ptr_dtor(&retval);
- }
- else {
- char *errmsg = NULL; /* Error message */
- char *errline = NULL; /* Error line */
- char *msgbuf = NULL; /* Message buffer */
- char msgformat[] = "Sablotron error on line %s: %s"; /* Message format */
-
- /* If the error is not serious, exit out */
- if (code == MH_LEVEL_WARN ||
- code == MH_LEVEL_ERROR ||
- code == MH_LEVEL_CRITICAL) {
- return 0;
- }
-
- /* Loop through and extract the error message and the
- error line */
- if (fields) {
- while (fields && *fields) {
- char *key; /* Key to for the message */
- char *val; /* The message itself */
- char *ptr; /* Pointer to the location of the ':' (separator) */
- int pos; /* Position of the ':' (separator) */
- int len; /* Length of the string */
-
- len = strlen(*fields);
-
- /* Grab the separator's position */
- ptr = strchr(*fields, ':');
- if (!ptr) {
- continue;
- }
- pos = ptr - *fields;
-
- /* Allocate the key and value and copy the data onto them */
- key = emalloc(pos + 1);
- val = emalloc((len - pos) + 1);
-
- strlcpy(key, *fields, pos + 1);
- strlcpy(val, *fields + pos + 1, len - pos);
-
- /* Check to see whether or not we want to save the data */
- if (!strcmp(key, "msg")) {
- errmsg = estrndup(val, len - pos);
- }
- else if (!strcmp(key, "line")) {
- errline = estrndup(val, len - pos);
- }
-
- /* Cleanup */
- if (key) efree(key);
- if (val) efree(val);
-
- /* Next key:value pair please :) */
- fields++;
- }
- }
-
- if (!errline) {
- errline = estrndup("none", sizeof("none") - 1);
- }
-
- if (!errmsg) {
- errmsg = estrndup("unkown error", sizeof("unkown error") - 1);
- }
-
- /* Allocate the message buffer and copy the data onto it */
- msgbuf = emalloc((sizeof(msgformat) - 4) + strlen(errmsg) + strlen(errline) + 1);
- sprintf(msgbuf, msgformat, errline, errmsg);
-
- XSLT_REG_ERRMSG(errmsg, handle);
-
- /* Output a warning */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", msgbuf);
-
- /* Cleanup */
- efree(msgbuf);
- efree(errmsg);
- efree(errline);
- }
-
- return(0);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/xslt/tests/args.xsl b/ext/xslt/tests/args.xsl
deleted file mode 100755
index 4ff140c777..0000000000
--- a/ext/xslt/tests/args.xsl
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output encoding="ISO-8859-1" method="text" omit-xml-declaration="yes" />
- <xsl:template match="/qa">
- <xsl:apply-templates select="test" />
- </xsl:template>
- <xsl:template match="test[@type = 'simple']">
- <xsl:value-of select="." />
- </xsl:template>
-</xsl:stylesheet>
diff --git a/ext/xslt/tests/bug17791.phpt b/ext/xslt/tests/bug17791.phpt
deleted file mode 100644
index 0a9446e1b0..0000000000
--- a/ext/xslt/tests/bug17791.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Pass long string to 'file' argument, bug #17791
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-$xmlstring = str_repeat('x', 512);
-$xslstring = 'x';
-$xh = xslt_create();
-$result = @xslt_process($xh, $xmlstring, $xslstring);
-@xslt_free($xh);
-echo("OK");
-?>
---EXPECT--
-OK
diff --git a/ext/xslt/tests/bug17931.phpt b/ext/xslt/tests/bug17931.phpt
deleted file mode 100644
index a85dd0674e..0000000000
--- a/ext/xslt/tests/bug17931.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-Pass object for xslt_error_handler, bug #17931
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-class xsl {
-
- function xsl() {
- $this->_parser = xslt_create();
- }
-
- function set_error() {
- xslt_set_error_handler($this->_parser, array($this, 'xslt_trap_error'));
- echo "OK";
- }
-
- function xslt_trap_error($parser, $errorno, $level, $fields) {
- return TRUE;
- }
- function clean() {
- xslt_free($this->_parser);
- }
-}
-
-$x = new xsl;
-// work-around for possible '$this does not exist' bug in constructor
-$x->set_error();
-$x->clean();
-?>
---EXPECT--
-OK
diff --git a/ext/xslt/tests/bug20177.phpt b/ext/xslt/tests/bug20177.phpt
deleted file mode 100644
index 3c1695b351..0000000000
--- a/ext/xslt/tests/bug20177.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-Relative and absolute arg handling
---SKIPIF--
-<?php
-include("skipif.inc");
-if(!function_exists('utf8_encode')) {
- die("skip function utf8_encode() not available");
-}
-?>
---INI--
-magic_quotes_runtime=0
---FILE--
-<?php
-error_reporting(E_ALL);
-$xslfile = dirname(__FILE__) . '/args.xsl';
-$xslsheet = @implode('', @file($xslfile));
-$xmldata = '<?xml version="1.0" encoding="ISO-8859-1"?>';
-$xmldata .= '<!DOCTYPE qa SYSTEM "qa.dtd">' . "\n";
-$xmldata .='
-<qa>
- <test type="simple">Test has passed</test>
- <test type="complex" />
-</qa>';
-
-$xh = xslt_create();
-$result = xslt_process($xh, 'arg:/_xml', $xslfile, NULL, array('/_xml' => $xmldata));
-print "$result\n";
-$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmldata, '/_xsl' => $xslsheet));
-print "$result\n";
-xslt_free($xh);
-?>
---EXPECT--
-Test has passed
-Test has passed
diff --git a/ext/xslt/tests/bug20518.phpt b/ext/xslt/tests/bug20518.phpt
deleted file mode 100644
index bf0a8f9f8d..0000000000
--- a/ext/xslt/tests/bug20518.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Don't override xslt_set_base (bug #20518)
---SKIPIF--
-<?php // vim600: syn=php ts=4 sw=4
-include("skipif.inc");
-mkdir(dirname(__FILE__) . '/tmp', 0777) or die("skip Cannot create working directory");
-?>
---INI--
-magic_quotes_runtime=0
---FILE--
-<?php
-error_reporting(E_ALL);
-copy(dirname(__FILE__) . '/qa.dtd', dirname(__FILE__) . '/tmp/qa.dtd');
-$xslfile = dirname(__FILE__) . '/args.xsl';
-$xslsheet = @implode('', @file($xslfile));
-$xmldata = '<?xml version="1.0" encoding="ISO-8859-1"?>';
-$xmldata .= '<!DOCTYPE qa SYSTEM "qa.dtd">' . "\n";
-$xmldata .='
-<qa>
- <test type="simple">Test has passed</test>
- <test type="complex" />
-</qa>';
-
-$xh = xslt_create();
-xslt_set_base($xh, 'file://' . dirname(__FILE__) . '/tmp/');
-$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmldata, '/_xsl' => $xslsheet));
-print "$result\n";
-xslt_free($xh);
-unlink(dirname(__FILE__) . '/tmp/qa.dtd');
-rmdir(dirname(__FILE__) . '/tmp');
-?>
---EXPECT--
-Test has passed
diff --git a/ext/xslt/tests/param.xsl b/ext/xslt/tests/param.xsl
deleted file mode 100644
index 64b78fafe7..0000000000
--- a/ext/xslt/tests/param.xsl
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="text" omit-xml-declaration="yes" encoding="ISO-8859-1" />
- <xsl:param name="insertion">Test failed</xsl:param>
- <xsl:template match="/qa">
- <xsl:apply-templates select="test" />
- </xsl:template>
- <xsl:template match="test">
- <xsl:choose>
- <xsl:when test="@type != 'simple'">
- <xsl:value-of select="$insertion" />
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-</xsl:stylesheet>
diff --git a/ext/xslt/tests/public.xml b/ext/xslt/tests/public.xml
deleted file mode 100755
index d5de9a8bd5..0000000000
--- a/ext/xslt/tests/public.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE qa PUBLIC "-//PHP-QA//PHP Quality Assurance DTD //EN" "qa.dtd">
-<qa>
- <test type="simple">PHP QA&reg;</test>
-</qa>
diff --git a/ext/xslt/tests/qa.dtd b/ext/xslt/tests/qa.dtd
deleted file mode 100755
index 8b807ead44..0000000000
--- a/ext/xslt/tests/qa.dtd
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!ELEMENT qa (test+)>
-<!ELEMENT test (#PCDATA)>
-<!ATTLIST test
- type CDATA #IMPLIED
->
-<!ENTITY reg "&#174;">
diff --git a/ext/xslt/tests/skipif.inc b/ext/xslt/tests/skipif.inc
deleted file mode 100644
index 7cffae6c66..0000000000
--- a/ext/xslt/tests/skipif.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-if(!extension_loaded("xslt")) {
- die("skip xslt extension not available");
-}
-?>
diff --git a/ext/xslt/tests/test.xml b/ext/xslt/tests/test.xml
deleted file mode 100644
index f7c69d4c4a..0000000000
--- a/ext/xslt/tests/test.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<qa>
- <test type="simple">Test has passed</test>
- <test type="complex" />
-</qa>
diff --git a/ext/xslt/tests/xslt-001.phpt b/ext/xslt/tests/xslt-001.phpt
deleted file mode 100644
index eeb1c6d769..0000000000
--- a/ext/xslt/tests/xslt-001.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Memoryleak in error printing
---SKIPIF--
-<?php include("skipif.inc"); ?>
---INI--
-error_reporting=2047
-display_errors=0
-track_errors=1
---FILE--
-<?php
-$xmlfile = 'ext/xslt/tests/non-existent.xml';
-$xslfile = 'ext/xslt/tests/non-existent.xsl';
-
-$xh = xslt_create();
-$result = xslt_process($xh, $xmlfile, $xslfile, NULL);
-xslt_free($xh);
-
-echo $php_errormsg."\n";
-?>
---EXPECTF--
-Sablotron error on line none: cannot open file '%s/ext/xslt/tests/non-existent.xsl'
diff --git a/ext/xslt/tests/xslt.phpt b/ext/xslt/tests/xslt.phpt
deleted file mode 100644
index 3270c3f20e..0000000000
--- a/ext/xslt/tests/xslt.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Check for xslt presence
---SKIPIF--
-<?php if (!extension_loaded("xslt")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "xslt extension is available";
-?>
---EXPECT--
-xslt extension is available \ No newline at end of file
diff --git a/ext/xslt/tests/xslt_backend_info.phpt b/ext/xslt/tests/xslt_backend_info.phpt
deleted file mode 100644
index 1fd849c48f..0000000000
--- a/ext/xslt/tests/xslt_backend_info.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-xslt_backend_info: examples for detection of backend features
---SKIPIF--
-<?php // vim600: noet sw=4 ts=4 syn=php ai si tw=78
-include("skipif.inc");
-if(!function_exists('xslt_backend_info')) {
- die("skip\n");
-}
-// Yeah-right-but-still
-if(xslt_backend_name() != "Sablotron") {
- die("skip This test currently only supports Sablotron");
-}
-if("No information available." == xslt_backend_info()) {
- die("skip Information could not be detected.");
-}
-?>
---FILE--
-<?php
-/*
- * Test xslt_backend_info: basically this test is provided as a how-to for
- * x-platform packages, which rely on certain features which may or may
- * not be available depending on what has been linked into the backend.
- */
-
-$tmp = explode("\n", xslt_backend_info());
-$info = array();
-foreach($tmp AS $line) {
- list($key, $value) = explode(": ", $line, 2);
- $info[strtolower($key)] = $value;
-}
-
-if(FALSE === strstr($info['libs'], " -lexpat")) {
- die("You're configuration is missing expat, which conflicts with sanity.");
-}
-
-if(FALSE === strstr($info['libs'], " -liconv")) {
- echo("You don't have iconv support\n");
-} else {
- echo("You have iconv support\n");
-}
-if(FALSE === strstr($info['libs'], " -ljs")) {
- echo("You don't have JavaScript support\n");
-} else {
- echo("You have JavaScript support\n");
-}
-?>
---EXPECTREGEX--
-You (don't )?have iconv support
-You (don't )?have JavaScript support
diff --git a/ext/xslt/tests/xslt_getopt.phpt b/ext/xslt/tests/xslt_getopt.phpt
deleted file mode 100644
index a00a875fac..0000000000
--- a/ext/xslt/tests/xslt_getopt.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-xslt_getopt function
---SKIPIF--
-<?php
-include("skipif.inc");
-if(!function_exists('xslt_getopt')) {
- die("skip\n");
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL);
-
-$xh = xslt_create();
-xslt_setopt($xh, XSLT_SABOPT_PARSE_PUBLIC_ENTITIES);
-if(xslt_getopt($xh) == XSLT_SABOPT_PARSE_PUBLIC_ENTITIES)
- print("OK\n");
-else
- var_dump(xslt_getopt($xh));
-
-xslt_setopt($xh, XSLT_SABOPT_PARSE_PUBLIC_ENTITIES | XSLT_SABOPT_DISABLE_ADDING_META);
-if(xslt_getopt($xh) == XSLT_SABOPT_PARSE_PUBLIC_ENTITIES | XSLT_SABOPT_DISABLE_ADDING_META)
- print("OK\n");
-else
- var_dump(xslt_getopt($xh));
-
-xslt_setopt($xh, xslt_getopt($xh) | XSLT_OPT_SILENT);
-if(xslt_getopt($xh) == XSLT_SABOPT_PARSE_PUBLIC_ENTITIES | XSLT_SABOPT_DISABLE_ADDING_META | XSLT_OPT_SILENT)
- print("OK\n");
-else
- var_dump(xslt_getopt($xh));
-xslt_free($xh);
-?>
---EXPECT--
-OK
-OK
-OK
diff --git a/ext/xslt/tests/xslt_process-001.phpt b/ext/xslt/tests/xslt_process-001.phpt
deleted file mode 100644
index 15f9cae262..0000000000
--- a/ext/xslt/tests/xslt_process-001.phpt
+++ /dev/null
@@ -1,62 +0,0 @@
---TEST--
-Various ways to provide xml and xslt arguments and params
---SKIPIF--
-<?php
-include("skipif.inc");
-if(!function_exists('utf8_encode')) {
- die("skip function utf8_encode() not available");
-}
-?>
---INI--
-magic_quotes_runtime=0
---FILE--
-<?php
-error_reporting(E_ALL);
-$xmlfile = 'ext/xslt/tests/test.xml';
-$xslfile = 'ext/xslt/tests/args.xsl';
-$xmldata = @implode('', @file($xmlfile));
-$xslsheet = @implode('', @file($xslfile));
-
-$xh = xslt_create();
-$result = xslt_process($xh, $xmlfile, $xslfile);
-print "$result\n";
-$result = xslt_process($xh, 'arg:/_xml', $xslfile, NULL, array('/_xml' => $xmldata));
-print "$result\n";
-$result = xslt_process($xh, $xmlfile, 'arg:/_xsl', NULL, array('/_xsl' => $xslsheet));
-print "$result\n";
-$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmldata, '/_xsl' => $xslsheet));
-print "$result\n";
-
-// The same, with params
-$xslfile = 'ext/xslt/tests/param.xsl';
-$xslsheet = implode('', file($xslfile));
-$params = array("Test has passed", "PHP QA®");
-
-foreach($params AS $val)
-{
- $val = utf8_encode($val);
- $result = xslt_process($xh, $xmlfile, $xslfile, NULL, NULL, array('insertion' => $val));
- print "$result\n";
- $result = xslt_process($xh, 'arg:/_xml', $xslfile, NULL, array('/_xml' => $xmldata), array('insertion' => $val));
- print "$result\n";
- $result = xslt_process($xh, $xmlfile, 'arg:/_xsl', NULL, array('/_xsl' => $xslsheet), array('insertion' => $val));
- print "$result\n";
- $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmldata, '/_xsl' => $xslsheet), array('insertion' => $val));
- print "$result\n";
-}
-
-xslt_free($xh);
-?>
---EXPECT--
-Test has passed
-Test has passed
-Test has passed
-Test has passed
-Test has passed
-Test has passed
-Test has passed
-Test has passed
-PHP QA®
-PHP QA®
-PHP QA®
-PHP QA®
diff --git a/ext/xslt/tests/xslt_process-002.phpt b/ext/xslt/tests/xslt_process-002.phpt
deleted file mode 100644
index 7c6f14fa45..0000000000
--- a/ext/xslt/tests/xslt_process-002.phpt
+++ /dev/null
@@ -1,74 +0,0 @@
---TEST--
-Crash xslt_process with reused handler (this test may take a while)
---SKIPIF--
-<?php
-include("skipif.inc");
-if(!function_exists('utf8_encode')) {
- die("skip\n");
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL);
-$xmlfile = 'ext/xslt/tests/test.xml';
-$xslfile = 'ext/xslt/tests/param.xsl';
-$xmldata = @implode('', @file($xmlfile));
-$xslsheet = @implode('', @file($xslfile));
-
-/*
- * Tested on a Cyrix 200MMX/128MB took 2 secs. Should be a reasonable margin.
- *
- * It's not meant as an actual speed test, but if it's slower than this,
- * there must be something significantly off in the php/sablot/expat trio.
- * Emulation OS's come to mind...
- */
-$want_time = 6;
-
-function make_param()
-{
- $ret_val = '';
- $numchars = mt_rand(2,16);
- $illegal = array(0,256,512);
- for($i=0;$i<$numchars;$i++)
- {
- $char=0;
- while(in_array($char, $illegal))
- {
- $char .= mt_rand(32, 512);
- }
- $ret_val .= chr($char);
- }
-
- return utf8_encode($ret_val);
-}
-
-function decode($string)
-{
- $ret_val = '';
- for($i=0; $i<strlen($string);$i++)
- {
- $ret_val .= ord(substr($string,$i,1)) . " ";
- }
- return $ret_val;
-}
-
-
-$xh = xslt_create();
-
-$t1 = time();
-for ($i=0; $i<50; $i++)
-{
- $val = make_param();
- $result = xslt_process($xh, $xmlfile, $xslfile, NULL, NULL, array('insertion' => $val));
- if(!$result or $result != utf8_decode($val))
- print "Failed $i / ".utf8_decode($val).": $result\n\tDecode: " . decode(utf8_decode($val)) . "\n" ;
-}
-print "OK\n";
-xslt_free($xh);
-$t2 = time();
-$op_time = $t2 - $t1;
-if($op_time > $want_time)
- print "This test took more than $want_time seconds. Either you have a very slow / busy machine, or there's something very wrong with the speed. Your time: $op_time";
-?>
---EXPECT--
-OK
diff --git a/ext/xslt/tests/xslt_set_object.phpt b/ext/xslt/tests/xslt_set_object.phpt
deleted file mode 100644
index fdc0291a4d..0000000000
--- a/ext/xslt/tests/xslt_set_object.phpt
+++ /dev/null
@@ -1,89 +0,0 @@
---TEST--
-xslt_set_object function
---SKIPIF--
-<?php
-include("skipif.inc");
-if(!function_exists('xslt_set_object')) {
- die("skip function xslt_set_object() not available");
-}
-?>
---INI--
-magic_quotes_runtime=0
---FILE--
-<?php
-error_reporting(E_ALL);
-class XSLTTester
-{
- var $_success = false;
- var $_success2 = false;
-
- function XSLTTester()
- {}
-
- // this function will register this object as the
- // callback object.
- function test1($xmlfile,$xslfile)
- {
- $xh = xslt_create();
- xslt_set_object($xh,$this);
- $handlers = array('get_all'=> 'handle_getall');
- xslt_set_scheme_handlers($xh,$handlers);
- $res = xslt_process($xh,$xmlfile,$xslfile);
- xslt_free($xh);
- return 1;
- }
-
- // this function will pass this object as in set_scheme_handler
- function test2($xmlfile,$xslfile)
- {
- $xh = xslt_create();
- $handlers = array('get_all'=> array(&$this,'handle_getall2'));
- xslt_set_scheme_handlers($xh,$handlers);
- $res = xslt_process($xh,$xmlfile,$xslfile);
- xslt_free($xh);
- return 1;
- }
- function handle_getall($xh,$scheme,$rest)
- {
- $this->_success = true;
- $rest = substr($rest,2);
- return implode('', file('ext/xslt/tests/'.$rest));
- }
- function handle_getall2($xh,$scheme,$rest)
- {
- $this->_success2 = true;
- $rest = substr($rest,2);
- return implode('', file('ext/xslt/tests/'.$rest));
- }
- function testSucceeded()
- {
- return $this->_success;
- }
- function test2Succeeded()
- {
- return $this->_success2;
- }
-}
-
-$xmlfile = 'ext/xslt/tests/test.xml';
-$xslfile = 'ext/xslt/tests/xslt_set_object.xsl';
-
-$testobj = new XSLTTester();
-$testobj->test1($xmlfile,$xslfile);
-
-$testobj->test2($xmlfile,$xslfile);
-
-if ($testobj->testSucceeded())
- print "OK\n";
-else
- print "FAILED\n";
-
-if ($testobj->test2Succeeded())
- print "OK\n";
-else
- print "FAILED\n";
-
-?>
---EXPECT--
-OK
-OK
diff --git a/ext/xslt/tests/xslt_set_object.xsl b/ext/xslt/tests/xslt_set_object.xsl
deleted file mode 100644
index 9618f42e21..0000000000
--- a/ext/xslt/tests/xslt_set_object.xsl
+++ /dev/null
@@ -1,3 +0,0 @@
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<xsl:import href="http://param.xsl" />
-</xsl:stylesheet>
diff --git a/ext/xslt/tests/xslt_set_scheme_handlers-001.phpt b/ext/xslt/tests/xslt_set_scheme_handlers-001.phpt
deleted file mode 100644
index c8b7b236f2..0000000000
--- a/ext/xslt/tests/xslt_set_scheme_handlers-001.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Set a non-existing scheme handler
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-function bar()
-{
- return 1;
-}
-$xh = xslt_create();
-$xmlstring = '<foo><barred /></foo>';
-$xslstring = '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/1999/XSL/Transform"><xsl:for-each select="/"><xsl:value-of select="document(\'bogus://foo\')" /></xsl:for-each></xsl:stylesheet>';
-xslt_set_scheme_handlers($xh, array('get_all' => 'foo'));
-$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmlstring, '/_xsl' => $xslstring));
-xslt_free($xh);
-echo("OK");
-?>
---EXPECT--
-OK
diff --git a/ext/xslt/tests/xslt_set_scheme_handlers-002.phpt b/ext/xslt/tests/xslt_set_scheme_handlers-002.phpt
deleted file mode 100644
index 3658b378a1..0000000000
--- a/ext/xslt/tests/xslt_set_scheme_handlers-002.phpt
+++ /dev/null
@@ -1,57 +0,0 @@
---TEST--
-Override Sablotron file handler
---SKIPIF--
-<?php
-include("skipif.inc");
-if(!defined("XSLT_SABOPT_FILES_TO_HANDLER")) {
- die("skip Sab CVS > 20021031 needed");
-}
-?>
---INI--
-magic_quotes_runtime=0
---FILE--
-<?php
-function handle_files_all($xh, $proto, $rest_uri)
-{
- $error = "Cannot resolve $proto:$rest_uri on handle $xh";
-
- if($proto != 'file')
- return $error;
-
- $rest_uri = substr($rest_uri, 2); // strip protocol separators //
- if(substr($rest_uri, 0, 1) == '/')
- {
- return (file_exists($rest_uri)) ? implode('', file($rest_uri)) : $error;
- }
- else
- {
- $f = dirname(__FILE__) . '/' . $rest_uri;
- return (file_exists($f)) ? implode('', file($f)) : $error;
- }
-}
-
-$xh = xslt_create();
-xslt_setopt($xh, XSLT_SABOPT_FILES_TO_HANDLER);
-$xmlstring='<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE qa SYSTEM "file://qa.dtd">
-<qa>
- <test type="simple">PHP QA</test>
-</qa>';
-$xslstring='<?xml version="1.0" encoding="ISO-8859-1"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="text" omit-xml-declaration="yes" encoding="ISO-8859-1" />
- <xsl:param name="insertion">Test failed</xsl:param>
- <xsl:template match="/qa">
- <xsl:apply-templates select="test" />
- </xsl:template>
- <xsl:template match="test">
- <xsl:value-of select="concat(@type, \': \', .)" />
- </xsl:template>
-</xsl:stylesheet>';
-xslt_set_scheme_handlers($xh, array('get_all' => 'handle_files_all'));
-$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmlstring, '/_xsl' => $xslstring));
-echo $result;
-xslt_free($xh);
-?>
---EXPECT--
-simple: PHP QA
diff --git a/ext/xslt/tests/xslt_set_scheme_handlers-003.phpt b/ext/xslt/tests/xslt_set_scheme_handlers-003.phpt
deleted file mode 100644
index c5bca5c0b6..0000000000
--- a/ext/xslt/tests/xslt_set_scheme_handlers-003.phpt
+++ /dev/null
@@ -1,47 +0,0 @@
---TEST--
-Core dump when returning FALSE in a handler
---SKIPIF--
-<?php
-include("skipif.inc");
-if(!defined("XSLT_SABOPT_FILES_TO_HANDLER")) {
- die("skip Sablotron CVS > 20021031 needed");
-}
-?>
---INI--
-magic_quotes_runtime=0
---FILE--
-<?php
-function handle_files_all($xh, $proto, $rest_uri)
-{
- return FALSE;
-}
-
-$xh = xslt_create();
-xslt_setopt($xh, XSLT_SABOPT_FILES_TO_HANDLER);
-$xmlstring='<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE qa SYSTEM "file://qa.dtd">
-<qa>
- <test type="simple">PHP QA</test>
-</qa>';
-$xslstring='<?xml version="1.0" encoding="ISO-8859-1"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="text" omit-xml-declaration="yes" encoding="ISO-8859-1" />
- <xsl:param name="insertion">Test failed</xsl:param>
- <xsl:template match="/qa">
- <xsl:apply-templates select="test" />
- </xsl:template>
- <xsl:template match="test">
- <xsl:value-of select="concat(@type, \': \', .)" />
- </xsl:template>
-</xsl:stylesheet>';
-xslt_set_scheme_handlers($xh, array('get_all' => 'handle_files_all'));
-/* This is intended to be silent!
- * The result is known to be invalid, but if it doesn't core dump, the test
- * has succeeded. */
-$result = @xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmlstring, '/_xsl' => $xslstring));
-echo "OK";
-xslt_free($xh);
-?>
---EXPECT--
-OK
-
diff --git a/ext/xslt/tests/xslt_setopt.phpt b/ext/xslt/tests/xslt_setopt.phpt
deleted file mode 100644
index ce45c46e1c..0000000000
--- a/ext/xslt/tests/xslt_setopt.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-xslt_setopt function and public entities
---SKIPIF--
-<?php
-include("skipif.inc");
-if(!function_exists('xslt_setopt')) {
- die("skip function xslt_setopt() is not available\n");
-}
-?>
---INI--
-magic_quotes_runtime=0
---FILE--
-<?php
-error_reporting(E_ALL);
-$xmlfile = dirname(__FILE__).'/public.xml';
-$xslfile = dirname(__FILE__).'/args.xsl';
-
-$xh = xslt_create();
-// Tell Sablotron to process public entities
-xslt_setopt($xh, XSLT_SABOPT_PARSE_PUBLIC_ENTITIES);
-
-$result = xslt_process($xh, $xmlfile, $xslfile);
-print "$result\n";
-
-$xslstring = implode('', file($xslfile));
-$xslstring = str_replace('method="text"', 'method="html"', $xslstring);
-$xslstring = str_replace('<xsl:value-of select="." />', '<html><head><title>foo</title></head><body><p><xsl:value-of select="." /></p></body></html>', $xslstring);
-// DEBUG: print $xslstring;
-
-xslt_setopt($xh, XSLT_SABOPT_PARSE_PUBLIC_ENTITIES | XSLT_SABOPT_DISABLE_ADDING_META);
-var_dump(xslt_process($xh, $xmlfile, 'arg:/_xsl', NULL, array('/_xsl' => $xslstring)));
-
-
-xslt_setopt($xh, XSLT_SABOPT_PARSE_PUBLIC_ENTITIES);
-var_dump(xslt_process($xh, $xmlfile, 'arg:/_xsl', NULL, array('/_xsl' => $xslstring)));
-// DEBUG: print "$result_meta\n";
-
-xslt_free($xh);
-?>
---EXPECT--
-PHP QA®
-string(95) "<html>
- <head>
- <title>foo</title>
- </head>
- <body>
- <p>PHP QA®</p>
- </body>
-</html>
-"
-string(172) "<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>foo</title>
- </head>
- <body>
- <p>PHP QA®</p>
- </body>
-</html>
-"
diff --git a/ext/xslt/xslt.c b/ext/xslt/xslt.c
deleted file mode 100644
index 9cabbf5ae0..0000000000
--- a/ext/xslt/xslt.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_xslt.h"
-
-#if HAVE_XSLT
-
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-
-#define XSLT_DEBUG 0
-
-/* {{{ xslt_debug()
- Output a debug message if debugging is enabled */
-extern void xslt_debug(char *function_name, char *format, ...)
-{
-#if DEBUG
- va_list argv;
- char buffer[1024];
-
- va_start(argv, format);
- vsnprintf(buffer, sizeof(buffer) - 1, format, argv);
- va_end(argv);
-
- buffer[sizeof(buffer) - 1] = '\0';
-
- php_printf("<b>XSLT Debug</b>: %s: %s<br />\n",
- function_name, buffer);
-#endif
-}
-/* }}} */
-
-/* {{{ find_xslt_argument()
- Find and return an xslt argument from the argument buffer */
-static char *_find_xslt_argument(const char **argv, const char *key)
-{
- char **ptr; /* Pointer to the passed char ** array */
- char *return_value = NULL; /* Value to return from the function */
-
- if (! argv)
- return NULL;
-
- /* Loop through the array searching for the value */
- ptr = (char **) argv;
- while (*ptr) {
- /* If we have a match, save the value and exit out */
- if (! strcmp(*ptr, key)) {
- return_value = estrdup(*ptr);
- break;
- }
-
- ++ptr;
- }
-
- return return_value;
-}
-/* }}} */
-
-/* {{{ xslt_make_array()
- Make an XSLT array (char **) from a zval array (HashTable *) */
-extern void xslt_make_array(zval **zarr, char ***carr)
-{
- zval **current;
- HashTable *arr;
- int idx = 0;
- TSRMLS_FETCH();
-
- /* Skip a warning, when 'NULL' is provided as argument */
- if ( Z_TYPE_PP(zarr) == IS_NULL)
- return;
-
- arr = HASH_OF(*zarr);
- if (! arr) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument or parameter array");
- return;
- }
-
- *carr = emalloc(((zend_hash_num_elements(arr) * 2) + 1) * sizeof(char *));
-
- for (zend_hash_internal_pointer_reset(arr);
- zend_hash_get_current_data(arr, (void **) &current) == SUCCESS;
- zend_hash_move_forward(arr)) {
- char *string_key = NULL;
- ulong num_key;
- int type;
-
- SEPARATE_ZVAL(current);
- convert_to_string_ex(current);
-
- type = zend_hash_get_current_key(arr, &string_key, &num_key, 0);
- if (type == HASH_KEY_IS_LONG) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid key value for argument or parameter array");
- /* Make the next index NULL, so it signals the end of the array
- this will protect against invalid arrays, like:
- array('foo'=>'bar', 'foobarred', 'oops') */
- (*carr)[idx] = NULL;
- return;
- }
-
- (*carr)[idx++] = estrdup(string_key);
- (*carr)[idx++] = estrndup(Z_STRVAL_PP(current), Z_STRLEN_PP(current));
- }
-
- (*carr)[idx] = NULL;
-}
-/* }}} */
-
-/* {{{ xslt_free_array()
- Free an xslt array built by xslt_make_array() */
-extern void xslt_free_array(char **arr)
-{
- char **ptr = arr;
-
- while (*ptr != NULL) {
- efree(*ptr);
- ptr++;
- }
-
- efree(arr);
-}
-/* }}} */
-
-/* {{{ xslt_parse_arguments()
- Parse an XSLT argument buffer */
-extern xslt_args *xslt_parse_arguments(char *xml,
- char *xsl,
- char *result,
- char **argv)
-{
- xslt_args *return_value; /* The value to return from the function */
-
- return_value = emalloc(sizeof(xslt_args));
-
- /* The xml argument */
- if (! strncasecmp(xml, "arg:", 4)) {
- char *key = xml + 5;
-
- return_value->xml.type = XSLT_IS_DATA;
- return_value->xml.ptr = _find_xslt_argument((const char **) argv,
- (const char *) key);
- }
- else {
- return_value->xml.type = XSLT_IS_FILE;
- return_value->xml.ptr = estrdup(xml);
- }
-
- /* The xslt arguments */
- if (! strncasecmp(xsl, "arg:", 4)) {
- char *key = xsl + 5;
-
- return_value->xsl.type = XSLT_IS_DATA;
- return_value->xsl.ptr = _find_xslt_argument((const char **) argv,
- (const char *) key);
- }
- else {
- return_value->xsl.type = XSLT_IS_FILE;
- return_value->xsl.ptr = estrdup(xsl);
- }
-
- /* The result argument */
- if (! strncasecmp(result, "arg:", 4)) {
- char *key = result + 5;
-
- return_value->result.type = XSLT_IS_DATA;
- return_value->result.ptr = _find_xslt_argument((const char **) argv,
- (const char *) key);
- }
- else {
- return_value->result.type = XSLT_IS_FILE;
- return_value->result.ptr = estrdup(result);
- }
-
- return return_value;
-}
-/* }}} */
-
-/* {{{ free_xslt_arguments()
- Free's an XSLT argument list returned from parse_xslt_arguments() */
-extern void xslt_free_arguments(xslt_args *to_free)
-{
- if (to_free->xml.ptr) {
- efree(to_free->xml.ptr);
- }
-
- if (to_free->xsl.ptr) {
- efree(to_free->xsl.ptr);
- }
-
- if (to_free->result.ptr) {
- efree(to_free->result.ptr);
- }
-
- efree(to_free);
-}
-/* }}} */
-
-/* {{{ call_xslt_function()
- Call an XSLT handler */
-extern void xslt_call_function(char *name,
- zval *function,
- zval *object,
- int argc,
- zval **user_args,
- zval **retval)
-{
- zval ***argv; /* Argument container, maps around for call_user_function_ex() */
- int error; /* Error container */
- int idx; /* Idx, when looping through and free'ing the arguments */
- TSRMLS_FETCH(); /* For TS mode, fetch the executor globals */
-
- argv = emalloc(argc * sizeof(zval **));
- for (idx = 0; idx < argc; idx++) {
- argv[idx] = &user_args[idx];
- }
-
-
- /* Call the function (with object when appropriate)*/
- if (object == NULL)
- {
- error = call_user_function_ex(EG(function_table),
- NULL, function,
- retval, argc, argv, 0, NULL TSRMLS_CC);
- }
- else
- {
- error = call_user_function_ex(EG(function_table),
- &object, function,
- retval, argc, argv, 0, NULL TSRMLS_CC);
- }
-
- if (error == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the %s handler: %s",
- name, Z_STRVAL_P(function));
- }
-
- /* Cleanup arguments */
- for (idx = 0; idx < argc; idx++) {
- /* Decrease refcount and free if refcount is <= 0 */
- zval_ptr_dtor(argv[idx]);
- }
-
- efree(argv);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/xslt/xslt.dsp b/ext/xslt/xslt.dsp
deleted file mode 100644
index 80ef1d6976..0000000000
--- a/ext/xslt/xslt.dsp
+++ /dev/null
@@ -1,115 +0,0 @@
-# Microsoft Developer Studio Project File - Name="xslt" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=xslt - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xslt.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xslt.mak" CFG="xslt - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xslt - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "xslt - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xslt - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XSLT_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\win32" /I "C:\Program Files\Sablot-0.96\include" /D "COMPILE_DL_XSLT" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_XSLT=1 /D "HAVE_SABLOT_BACKEND" /D "HAVE_SABLOT_SET_ENCODING" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib php4ts.lib sablot.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_xslt.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"C:\Program Files\Sablot-0.96\lib"
-
-!ELSEIF "$(CFG)" == "xslt - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XSLT_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D COMPILE_DL_XSLT=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_XSLT=1 /D "HAVE_SABLOT_BACKEND" /D "HAVE_SABLOT_SET_ENCODING" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib php4ts_debug.lib sablot.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_xslt.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "xslt - Win32 Release_TS"
-# Name "xslt - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\sablot.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\xslt.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_sablot.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_xslt.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/yaz/CREDITS b/ext/yaz/CREDITS
deleted file mode 100644
index e44f215df0..0000000000
--- a/ext/yaz/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-YAZ
-Adam Dickmeiss
diff --git a/ext/yaz/README b/ext/yaz/README
deleted file mode 100644
index 2ee3ac1781..0000000000
--- a/ext/yaz/README
+++ /dev/null
@@ -1,5 +0,0 @@
-This extension implements a Z39.50 client for PHP using the YAZ toolkit.
-
-Find more information at:
- http://www.indexdata.dk/phpyaz/
- http://www.indexdata.dk/yaz/
diff --git a/ext/yaz/config.m4 b/ext/yaz/config.m4
deleted file mode 100644
index 1ca755c2b5..0000000000
--- a/ext/yaz/config.m4
+++ /dev/null
@@ -1,53 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(yaz,for YAZ support,
-[ --with-yaz[=DIR] Include YAZ support (ANSI/NISO Z39.50).
- DIR is the YAZ bin install directory.])
-
-
-if test "$PHP_YAZ" != "no"; then
- yazconfig=NONE
- if test "$PHP_YAZ" = "yes"; then
- AC_PATH_PROG(yazconfig, yaz-config, NONE)
- else
- if test -r ${PHP_YAZ}/yaz-config; then
- yazconfig=${PHP_YAZ}/yaz-config
- else
- yazconfig=${PHP_YAZ}/bin/yaz-config
- fi
- fi
-
- if test -f $yazconfig; then
- AC_DEFINE(HAVE_YAZ,1,[Whether you have YAZ])
- . $yazconfig
-
- dnl Check version (2.0 or greater required)
- AC_MSG_CHECKING([for YAZ version])
- yaz_version=`echo $YAZVERSION | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
- if test "$yaz_version" -ge 2000000; then
- AC_MSG_RESULT([$YAZVERSION])
- else
- AC_MSG_ERROR([YAZ version 2.0 or later required.])
- fi
-
- for c in $YAZLIB; do
- case $c in
- -L*)
- dir=`echo $c|cut -c 3-|sed 's%/\.libs%%g'`
- PHP_ADD_LIBPATH($dir,YAZ_SHARED_LIBADD)
- ;;
- -l*)
- lib=`echo $c|cut -c 3-`
- PHP_ADD_LIBRARY($lib,,YAZ_SHARED_LIBADD)
- ;;
- esac
- done
- PHP_EVAL_INCLINE($YAZINC)
- PHP_NEW_EXTENSION(yaz, php_yaz.c, $ext_shared)
- PHP_SUBST(YAZ_SHARED_LIBADD)
- else
- AC_MSG_ERROR([YAZ not found (missing $yazconfig)])
- fi
-fi
diff --git a/ext/yaz/php_yaz.c b/ext/yaz/php_yaz.c
deleted file mode 100644
index 99fd814f1a..0000000000
--- a/ext/yaz/php_yaz.c
+++ /dev/null
@@ -1,1599 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Adam Dickmeiss <adam@indexdata.dk> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-
-#if HAVE_YAZ
-
-#include "ext/standard/info.h"
-#include "php_yaz.h"
-
-#include <yaz/yaz-version.h>
-
-#ifndef YAZ_VERSIONL
-#error YAZ version 2.0 or later must be used.
-#elif YAZ_VERSIONL < 0x020000
-#error YAZ version 2.0 or later must be used.
-#endif
-
-#ifdef PHP_WIN32
-#include <process.h>
-#endif
-
-#include <yaz/proto.h>
-#include <yaz/marcdisp.h>
-#include <yaz/yaz-util.h>
-#include <yaz/yaz-ccl.h>
-#include <yaz/zoom.h>
-
-#define MAX_ASSOC 100
-
-typedef struct Yaz_AssociationInfo *Yaz_Association;
-
-struct Yaz_AssociationInfo {
- CCL_parser ccl_parser;
- ZOOM_connection zoom_conn;
- ZOOM_resultset zoom_set;
- ZOOM_scanset zoom_scan;
- ZOOM_package zoom_package;
- char *sort_criteria;
- int persistent;
- int in_use;
- int order;
- int zval_resource;
-};
-
-static Yaz_Association yaz_association_mk()
-{
- Yaz_Association p = xmalloc (sizeof(*p));
-
- p->zoom_conn = ZOOM_connection_create (0);
- p->zoom_set = 0;
- p->zoom_scan = 0;
- p->zoom_package = 0;
- ZOOM_connection_option_set(p->zoom_conn, "implementationName", "PHP");
- ZOOM_connection_option_set(p->zoom_conn, "async", "1");
- p->sort_criteria = 0;
- p->in_use = 0;
- p->order = 0;
- p->persistent = 0;
- p->ccl_parser = ccl_parser_create();
- p->ccl_parser->bibset = 0;
- return p;
-}
-
-static void yaz_association_destroy (Yaz_Association p)
-{
- if (!p) {
- return;
- }
-
- ZOOM_resultset_destroy(p->zoom_set);
- ZOOM_scanset_destroy(p->zoom_scan);
- ZOOM_package_destroy(p->zoom_package);
- ZOOM_connection_destroy(p->zoom_conn);
- xfree(p->sort_criteria);
- ccl_qual_rm(&p->ccl_parser->bibset);
- ccl_parser_destroy(p->ccl_parser);
-}
-
-#ifdef ZTS
-static MUTEX_T yaz_mutex;
-#endif
-
-ZEND_DECLARE_MODULE_GLOBALS(yaz);
-
-static Yaz_Association *shared_associations;
-static int order_associations;
-static int le_link;
-
-static unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-static unsigned char second_argument_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
-
-function_entry yaz_functions [] = {
- PHP_FE(yaz_connect, NULL)
- PHP_FE(yaz_close, NULL)
- PHP_FE(yaz_search, NULL)
- PHP_FE(yaz_wait, second_argument_force_ref)
- PHP_FE(yaz_errno, NULL)
- PHP_FE(yaz_error, NULL)
- PHP_FE(yaz_addinfo, NULL)
- PHP_FE(yaz_hits, NULL)
- PHP_FE(yaz_record, NULL)
- PHP_FE(yaz_syntax, NULL)
- PHP_FE(yaz_element, NULL)
- PHP_FE(yaz_range, NULL)
- PHP_FE(yaz_itemorder, NULL)
- PHP_FE(yaz_es_result, NULL)
- PHP_FE(yaz_scan, NULL)
- PHP_FE(yaz_scan_result, second_argument_force_ref)
- PHP_FE(yaz_present, NULL)
- PHP_FE(yaz_ccl_conf, NULL)
- PHP_FE(yaz_ccl_parse, third_argument_force_ref)
- PHP_FE(yaz_database, NULL)
- PHP_FE(yaz_sort, NULL)
- PHP_FE(yaz_schema, NULL)
- PHP_FE(yaz_set_option, NULL)
- PHP_FE(yaz_get_option, NULL)
- {NULL, NULL, NULL}
-};
-
-static void get_assoc(INTERNAL_FUNCTION_PARAMETERS, pval **id, Yaz_Association *assocp)
-{
- Yaz_Association *as = 0;
-
- *assocp = 0;
-#ifdef ZTS
- tsrm_mutex_lock (yaz_mutex);
-#endif
-
- ZEND_FETCH_RESOURCE(as, Yaz_Association *, id, -1, "YAZ link", le_link);
-
- if (as && *as && (*as)->order == YAZSG(assoc_seq) && (*as)->in_use) {
- *assocp = *as;
- } else {
-#ifdef ZTS
- tsrm_mutex_unlock (yaz_mutex);
-#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid YAZ handle");
- }
-}
-
-static void release_assoc(Yaz_Association assoc)
-{
-#ifdef ZTS
- if (assoc) {
- tsrm_mutex_unlock(yaz_mutex);
- }
-#endif
-}
-
-static const char *array_lookup_string(HashTable *ht, const char *idx)
-{
- pval **pvalue;
-
- if (ht && zend_hash_find(ht, (char *) idx, strlen(idx) + 1, (void **) &pvalue) == SUCCESS) {
- SEPARATE_ZVAL(pvalue);
- convert_to_string(*pvalue);
- return (*pvalue)->value.str.val;
- }
- return 0;
-}
-
-static long *array_lookup_long(HashTable *ht, const char *idx)
-{
- pval **pvalue;
-
- if (ht && zend_hash_find(ht, (char *) idx, strlen(idx) + 1, (void **) &pvalue) == SUCCESS) {
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- return &(*pvalue)->value.lval;
- }
- return 0;
-}
-
-static long *array_lookup_bool(HashTable *ht, const char *idx)
-{
- pval **pvalue;
-
- if (ht && zend_hash_find(ht, (char *) idx, strlen(idx) + 1, (void **) &pvalue) == SUCCESS) {
- SEPARATE_ZVAL(pvalue);
- convert_to_boolean(*pvalue);
- return &(*pvalue)->value.lval;
- }
- return 0;
-}
-
-static const char *option_get(Yaz_Association as, const char *name)
-{
- if (!as) {
- return 0;
- }
- return ZOOM_connection_option_get(as->zoom_conn, name);
-}
-
-static int option_get_int(Yaz_Association as, const char *name, int def)
-{
- const char *v;
-
- v = ZOOM_connection_option_get(as->zoom_conn, name);
-
- if (!v) {
- return def;
- }
-
- return atoi(v);
-}
-
-static void option_set(Yaz_Association as, const char *name, const char *value)
-{
- if (as && value) {
- ZOOM_connection_option_set(as->zoom_conn, name, value);
- }
-}
-
-static void option_set_int(Yaz_Association as, const char *name, int v)
-{
- if (as) {
- char s[30];
-
- sprintf (s, "%d", v);
- ZOOM_connection_option_set(as->zoom_conn, name, s);
- }
-}
-
-static int strcmp_null(const char *s1, const char *s2)
-{
- if (s1 == 0 && s2 == 0) {
- return 0;
- }
- if (s1 == 0 || s2 == 0) {
- return -1;
- }
- return strcmp(s1, s2);
-}
-
-/* {{{ proto int yaz_connect(string zurl [, array options])
- Create target with given zurl. Returns positive id if successful. */
-PHP_FUNCTION(yaz_connect)
-{
- int i;
- char *cp;
- char *zurl_str;
- const char *user_str = 0, *group_str = 0, *pass_str = 0;
- const char *cookie_str = 0, *proxy_str = 0;
- const char *charset_str = 0;
- const char *client_IP = 0;
- const char *otherInfo[3];
- int persistent = 1;
- int piggyback = 1;
- pval **zurl, **user = 0;
- Yaz_Association as;
-
- otherInfo[0] = otherInfo[1] = otherInfo[2] = 0;
-
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex (1, &zurl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 2) {
- if (zend_get_parameters_ex (2, &zurl, &user) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(user) == IS_ARRAY) {
- long *persistent_val;
- long *piggyback_val;
- HashTable *ht = Z_ARRVAL_PP(user);
-
- user_str = array_lookup_string(ht, "user");
- group_str = array_lookup_string(ht, "group");
- pass_str = array_lookup_string(ht, "password");
- cookie_str = array_lookup_string(ht, "cookie");
- proxy_str = array_lookup_string(ht, "proxy");
- charset_str = array_lookup_string(ht, "charset");
- persistent_val = array_lookup_bool(ht, "persistent");
- if (persistent_val) {
- persistent = *persistent_val;
- }
- piggyback_val = array_lookup_bool(ht, "piggyback");
- if (piggyback_val) {
- piggyback = *piggyback_val;
- }
- otherInfo[0] = array_lookup_string(ht, "otherInfo0");
- otherInfo[1] = array_lookup_string(ht, "otherInfo1");
- otherInfo[2] = array_lookup_string(ht, "otherInfo2");
- } else {
- convert_to_string_ex(user);
- user_str = (*user)->value.str.val;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(zurl);
- zurl_str = (*zurl)->value.str.val;
- for (cp = zurl_str; *cp && strchr("\t\n ", *cp); cp++);
- if (!*cp) {
- RETURN_LONG(0);
- }
- /* see if we have it already ... */
-#ifdef ZTS
- tsrm_mutex_lock(yaz_mutex);
-#endif
- for (i = 0; i < YAZSG(max_links); i++) {
- as = shared_associations[i];
- if (persistent && as && !as->in_use &&
- !strcmp_null(option_get(as, "host"), zurl_str) &&
- !strcmp_null(option_get(as, "proxy"), proxy_str) &&
- !strcmp_null(option_get(as, "user"), user_str) &&
- !strcmp_null(option_get(as, "group"), group_str) &&
- !strcmp_null(option_get(as, "pass"), pass_str) &&
- !strcmp_null(option_get(as, "cookie"), cookie_str) &&
- !strcmp_null(option_get(as, "charset"), charset_str))
- break;
- }
- if (i == YAZSG(max_links)) {
- /* we didn't have it (or already in use) */
- int i0 = -1;
- int min_order = 2000000000;
-
- /* find completely free slot or the oldest one */
- for (i = 0; i < YAZSG(max_links) && shared_associations[i]; i++) {
- as = shared_associations[i];
- if (persistent && !as->in_use && as->order < min_order) {
- min_order = as->order;
- i0 = i;
- }
- }
-
- if (i == YAZSG(max_links)) {
- i = i0;
- if (i == -1) {
-#ifdef ZTS
- tsrm_mutex_unlock (yaz_mutex);
-#endif
- RETURN_LONG(0); /* no free slot */
- } else { /* "best" free slot */
- yaz_association_destroy(shared_associations[i]);
- }
- }
- shared_associations[i] = as = yaz_association_mk ();
-
- option_set(as, "proxy", proxy_str);
- option_set(as, "user", user_str);
- option_set(as, "group", group_str);
- option_set(as, "pass", pass_str);
- option_set(as, "cookie", cookie_str);
- option_set(as, "charset", charset_str);
- }
- option_set(as, "otherInfo0", otherInfo[0]);
- option_set(as, "otherInfo1", otherInfo[1]);
- option_set(as, "otherInfo2", otherInfo[2]);
- option_set(as, "clientIP", client_IP);
- option_set(as, "piggyback", piggyback ? "1" : "0");
- ZOOM_connection_connect(as->zoom_conn, zurl_str, 0);
- as->in_use = 1;
- as->persistent = persistent;
- as->order = YAZSG(assoc_seq);
-
-#ifdef ZTS
- tsrm_mutex_unlock (yaz_mutex);
-#endif
-
- ZEND_REGISTER_RESOURCE(return_value, &shared_associations[i], le_link);
- as->zval_resource = Z_LVAL_P(return_value);
-}
-/* }}} */
-
-/* {{{ proto int yaz_close(resource id)
- Destory and close target */
-PHP_FUNCTION(yaz_close)
-{
- Yaz_Association p;
- pval **id;
-
- if (ZEND_NUM_ARGS() != 1) {
- WRONG_PARAM_COUNT;
- }
- if (zend_get_parameters_ex (1, &id) == FAILURE) {
- RETURN_FALSE;
- }
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p);
- if (!p) {
- RETURN_FALSE;
- }
- release_assoc(p);
- zend_list_delete((*id)->value.lval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int yaz_search(resource id, string type, string query)
- Specify query of type for search - returns true if successful */
-PHP_FUNCTION(yaz_search)
-{
- char *query_str, *type_str;
- pval **id, **type, **query;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &id, &type, &query) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p);
- if (!p) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(type);
- type_str = (*type)->value.str.val;
- convert_to_string_ex(query);
- query_str = (*query)->value.str.val;
-
- ZOOM_resultset_destroy(p->zoom_set);
- p->zoom_set = 0;
-
- if (!strcmp(type_str, "rpn")) {
- ZOOM_query q = ZOOM_query_create();
- ZOOM_query_prefix(q, query_str);
- if (p->sort_criteria) {
- ZOOM_query_sortby(q, p->sort_criteria);
- }
- xfree(p->sort_criteria);
- p->sort_criteria = 0;
- p->zoom_set = ZOOM_connection_search(p->zoom_conn, q);
- ZOOM_query_destroy(q);
- RETVAL_TRUE;
- }
- if (!strcmp(type_str, "cql")) {
- ZOOM_query q = ZOOM_query_create();
- ZOOM_query_cql(q, query_str);
- if (p->sort_criteria) {
- ZOOM_query_sortby(q, p->sort_criteria);
- }
- xfree (p->sort_criteria);
- p->sort_criteria = 0;
- p->zoom_set = ZOOM_connection_search(p->zoom_conn, q);
- ZOOM_query_destroy(q);
- RETVAL_TRUE;
- } else {
- RETVAL_FALSE;
- }
- release_assoc(p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_present(resource id)
- Retrieve records */
-PHP_FUNCTION(yaz_present)
-{
- pval **id;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 1) {
- WRONG_PARAM_COUNT;
- }
- if (zend_get_parameters_ex(1, &id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p);
- if (!p) {
- RETURN_FALSE;
- }
-
- if (p->zoom_set) {
- size_t start = option_get_int(p, "start", 0);
- size_t count = option_get_int(p, "count", 0);
- if (count > 0) {
- ZOOM_resultset_records(p->zoom_set, 0 /* recs */, start, count);
- }
- }
- release_assoc(p);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int yaz_wait([array options])
- Process events. */
-PHP_FUNCTION(yaz_wait)
-{
- pval **pval_options = 0;
- int event_mode = 0;
- int no = 0;
- ZOOM_connection conn_ar[MAX_ASSOC];
- int i, timeout = 15;
-
- if (ZEND_NUM_ARGS() == 1) {
- long *val = 0;
- long *event_bool = 0;
- HashTable *options_ht = 0;
- if (zend_get_parameters_ex(1, &pval_options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (Z_TYPE_PP(pval_options) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array parameter");
- RETURN_FALSE;
- }
- options_ht = Z_ARRVAL_PP(pval_options);
- val = array_lookup_long(options_ht, "timeout");
- if (val) {
- timeout = *val;
- }
- event_bool = array_lookup_bool(options_ht, "event");
- if (event_bool && *event_bool)
- event_mode = 1;
- }
-#ifdef ZTS
- tsrm_mutex_lock(yaz_mutex);
-#endif
- for (i = 0; i<YAZSG(max_links); i++) {
- Yaz_Association p = shared_associations[i];
- if (p && p->order == YAZSG(assoc_seq)) {
- char str[20];
-
- sprintf(str, "%d", timeout);
- ZOOM_connection_option_set(p->zoom_conn, "timeout", str);
- conn_ar[no++] = p->zoom_conn;
- }
- }
-#ifdef ZTS
- tsrm_mutex_unlock(yaz_mutex);
-#endif
- if (event_mode) {
- long ev = ZOOM_event(no, conn_ar);
- if (ev <= 0) {
- RETURN_FALSE;
- } else {
- Yaz_Association p = shared_associations[ev-1];
- int event_code = ZOOM_connection_last_event(p->zoom_conn);
-
- add_assoc_long(*pval_options, "eventcode", event_code);
-
- zend_list_addref(p->zval_resource);
- Z_LVAL_P(return_value) = p->zval_resource;
- Z_TYPE_P(return_value) = IS_RESOURCE;
- return;
- }
- }
-
- if (no) {
- while (ZOOM_event (no, conn_ar))
- ;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int yaz_errno(resource id)
- Return last error number (>0 for bib-1 diagnostic, <0 for other error, 0 for no error */
-PHP_FUNCTION(yaz_errno)
-{
- pval **id;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p);
- if (!p) {
- RETURN_LONG(0);
- }
- RETVAL_LONG(ZOOM_connection_errcode(p->zoom_conn));
- release_assoc(p);
-}
-/* }}} */
-
-/* {{{ proto string yaz_error(resource id)
- Return last error message */
-PHP_FUNCTION(yaz_error)
-{
- pval **id;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p);
- if (p) {
- int code = ZOOM_connection_errcode(p->zoom_conn);
- const char *msg = ZOOM_connection_errmsg(p->zoom_conn);
-
- if (!code) {
- msg = "";
- }
- return_value->value.str.len = strlen(msg);
- return_value->value.str.val = estrndup(msg, return_value->value.str.len);
- return_value->type = IS_STRING;
- }
- release_assoc(p);
-}
-/* }}} */
-
-/* {{{ proto string yaz_addinfo(resource id)
- Return additional info for last error (empty string if none) */
-PHP_FUNCTION(yaz_addinfo)
-{
- pval **id;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p);
- if (p) {
- const char *addinfo = ZOOM_connection_addinfo(p->zoom_conn);
-
- return_value->value.str.len = strlen(addinfo);
- return_value->value.str.val = estrndup(addinfo, return_value->value.str.len);
- return_value->type = IS_STRING;
- }
- release_assoc(p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_hits(resource id)
- Return number of hits (result count) for last search */
-PHP_FUNCTION(yaz_hits)
-{
- pval **id;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p);
- if (p && p->zoom_set) {
- RETVAL_LONG(ZOOM_resultset_size(p->zoom_set));
- } else {
- RETVAL_LONG(0);
- }
- release_assoc(p);
-}
-/* }}} */
-
-static Z_GenericRecord *marc_to_grs1(const char *buf, ODR o)
-{
- int entry_p;
- int record_length;
- int indicator_length;
- int identifier_length;
- int base_address;
- int length_data_entry;
- int length_starting;
- int length_implementation;
- int max_elements = 256;
- Z_GenericRecord *r = odr_malloc (o, sizeof(*r));
- r->elements = odr_malloc (o, sizeof(*r->elements) * max_elements);
- r->num_elements = 0;
-
- record_length = atoi_n(buf, 5);
- if (record_length < 25) {
- return 0;
- }
- indicator_length = atoi_n(buf + 10, 1);
- identifier_length = atoi_n(buf + 11, 1);
- base_address = atoi_n(buf + 12, 5);
-
- length_data_entry = atoi_n(buf + 20, 1);
- length_starting = atoi_n(buf + 21, 1);
- length_implementation = atoi_n(buf + 22, 1);
-
- for (entry_p = 24; buf[entry_p] != ISO2709_FS; ) {
- entry_p += 3 + length_data_entry + length_starting;
- if (entry_p >= record_length) {
- return 0;
- }
- }
- base_address = entry_p + 1;
- for (entry_p = 24; buf[entry_p] != ISO2709_FS; ) {
- Z_TaggedElement *tag;
- int data_length;
- int data_offset;
- int end_offset;
- int i;
- char tag_str[4];
- int identifier_flag = 1;
-
- memcpy(tag_str, buf+entry_p, 3);
- entry_p += 3;
- tag_str[3] = '\0';
-
- if ((r->num_elements + 1) >= max_elements) {
- Z_TaggedElement **tmp = r->elements;
-
- /* double array space, throw away old buffer (nibble memory) */
- r->elements = odr_malloc(o, sizeof(*r->elements) * (max_elements *= 2));
- memcpy(r->elements, tmp, r->num_elements * sizeof(*tmp));
- }
- tag = r->elements[r->num_elements++] = odr_malloc(o, sizeof(*tag));
- tag->tagType = odr_malloc(o, sizeof(*tag->tagType));
- *tag->tagType = 3;
- tag->tagOccurrence = 0;
- tag->metaData = 0;
- tag->appliedVariant = 0;
- tag->tagValue = odr_malloc (o, sizeof(*tag->tagValue));
- tag->tagValue->which = Z_StringOrNumeric_string;
- tag->tagValue->u.string = odr_strdup(o, tag_str);
-
- tag->content = odr_malloc(o, sizeof(*tag->content));
- tag->content->which = Z_ElementData_subtree;
-
- tag->content->u.subtree = odr_malloc(o, sizeof(*tag->content->u.subtree));
- tag->content->u.subtree->elements = odr_malloc(o, sizeof(*r->elements));
- tag->content->u.subtree->num_elements = 1;
-
- tag = tag->content->u.subtree->elements[0] = odr_malloc(o, sizeof(**tag->content->u.subtree->elements));
-
- tag->tagType = odr_malloc(o, sizeof(*tag->tagType));
- *tag->tagType = 3;
- tag->tagOccurrence = 0;
- tag->metaData = 0;
- tag->appliedVariant = 0;
- tag->tagValue = odr_malloc(o, sizeof(*tag->tagValue));
- tag->tagValue->which = Z_StringOrNumeric_string;
- tag->content = odr_malloc(o, sizeof(*tag->content));
-
- data_length = atoi_n(buf + entry_p, length_data_entry);
- entry_p += length_data_entry;
- data_offset = atoi_n(buf + entry_p, length_starting);
- entry_p += length_starting;
- i = data_offset + base_address;
- end_offset = i + data_length - 1;
-
- if (indicator_length > 0 && indicator_length < 5) {
- if (buf[i + indicator_length] != ISO2709_IDFS) {
- identifier_flag = 0;
- }
- } else if (!memcmp (tag_str, "00", 2)) {
- identifier_flag = 0;
- }
-
- if (identifier_flag && indicator_length) {
- /* indicator */
- tag->tagValue->u.string = odr_malloc(o, indicator_length + 1);
- memcpy(tag->tagValue->u.string, buf + i, indicator_length);
- tag->tagValue->u.string[indicator_length] = '\0';
- i += indicator_length;
-
- tag->content->which = Z_ElementData_subtree;
-
- tag->content->u.subtree = odr_malloc(o, sizeof(*tag->content->u.subtree));
- tag->content->u.subtree->elements = odr_malloc(o, 256 * sizeof(*r->elements));
- tag->content->u.subtree->num_elements = 0;
-
- while (buf[i] != ISO2709_RS && buf[i] != ISO2709_FS && i < end_offset) {
- int i0;
- /* prepare tag */
- Z_TaggedElement *parent_tag = tag;
- Z_TaggedElement *tag = odr_malloc (o, sizeof(*tag));
-
- if (parent_tag->content->u.subtree->num_elements < 256) {
- parent_tag->content->u.subtree->elements[
- parent_tag->content->u.subtree->num_elements++] = tag;
- }
-
- tag->tagType = odr_malloc(o, sizeof(*tag->tagType));
- *tag->tagType = 3;
- tag->tagOccurrence = 0;
- tag->metaData = 0;
- tag->appliedVariant = 0;
- tag->tagValue = odr_malloc (o, sizeof(*tag->tagValue));
- tag->tagValue->which = Z_StringOrNumeric_string;
-
- /* sub field */
- tag->tagValue->u.string = odr_malloc(o, identifier_length);
- memcpy(tag->tagValue->u.string, buf + i + 1, identifier_length - 1);
- tag->tagValue->u.string[identifier_length - 1] = '\0';
- i += identifier_length;
-
- /* data ... */
- tag->content = odr_malloc(o, sizeof(*tag->content));
- tag->content->which = Z_ElementData_string;
-
- i0 = i;
- while ( buf[i] != ISO2709_RS &&
- buf[i] != ISO2709_IDFS &&
- buf[i] != ISO2709_FS && i < end_offset) {
- i++;
- }
-
- tag->content->u.string = odr_malloc(o, i - i0 + 1);
- memcpy(tag->content->u.string, buf + i0, i - i0);
- tag->content->u.string[i - i0] = '\0';
- }
- } else {
- int i0 = i;
-
- tag->tagValue->u.string = "@";
- tag->content->which = Z_ElementData_string;
-
- while (buf[i] != ISO2709_RS && buf[i] != ISO2709_FS && i < end_offset) {
- i++;
- }
- tag->content->u.string = odr_malloc(o, i - i0 +1);
- memcpy(tag->content->u.string, buf + i0, i - i0);
- tag->content->u.string[i-i0] = '\0';
- }
- }
- return r;
-}
-
-static void retval_grs1(zval *return_value, Z_GenericRecord *p)
-{
- Z_GenericRecord *grs[20];
- int eno[20];
- int level = 0;
-
- array_init(return_value);
- eno[level] = 0;
- grs[level] = p;
-
- while (level >= 0) {
- zval *my_zval;
- Z_TaggedElement *e = 0;
- Z_GenericRecord *p = grs[level];
- int i;
- char tag[256];
- int taglen = 0;
-
- if (eno[level] >= p->num_elements) {
- --level;
- if (level >= 0) {
- eno[level]++;
- }
- continue;
- }
- /* eno[level]++; */
-
- *tag = '\0';
- for (i = 0; i <= level; i++) {
- int tag_type = 3;
- e = grs[i]->elements[eno[i]];
-
- if (e->tagType) {
- tag_type = *e->tagType;
- }
- taglen = strlen(tag);
- sprintf(tag + taglen, "(%d,", tag_type);
- taglen = strlen(tag);
-
- if (e->tagValue->which == Z_StringOrNumeric_string) {
- int len = strlen(e->tagValue->u.string);
-
- memcpy(tag + taglen, e->tagValue->u.string, len);
- tag[taglen+len] = '\0';
- } else if (e->tagValue->which == Z_StringOrNumeric_numeric) {
- sprintf(tag + taglen, "%d", *e->tagValue->u.numeric);
- }
- taglen = strlen(tag);
- strcpy(tag + taglen, ")");
- }
-
- ALLOC_ZVAL(my_zval);
- array_init(my_zval);
- INIT_PZVAL(my_zval);
-
- add_next_index_string(my_zval, tag, 1);
-
- switch (e->content->which) {
- case Z_ElementData_string:
- add_next_index_string(my_zval, e->content->u.string, 1);
- break;
- case Z_ElementData_numeric:
- add_next_index_long(my_zval, *e->content->u.numeric);
- break;
- case Z_ElementData_trueOrFalse:
- add_next_index_long(my_zval, *e->content->u.trueOrFalse);
- break;
- case Z_ElementData_subtree:
- level++;
- grs[level] = e->content->u.subtree;
- eno[level] = -1;
- }
-
- zend_hash_next_index_insert(return_value->value.ht, (void *) &my_zval, sizeof(zval *), NULL);
- eno[level]++;
- }
-}
-
-
-/* {{{ proto string yaz_record(resource id, int pos, string type)
- Return record information at given result set position */
-PHP_FUNCTION(yaz_record)
-{
- pval **pval_id, **pval_pos, **pval_type;
- Yaz_Association p;
- int pos;
- char *type;
-
- if (ZEND_NUM_ARGS() != 3) {
- WRONG_PARAM_COUNT;
- }
- if (zend_get_parameters_ex(3, &pval_id, &pval_pos, &pval_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
-
- convert_to_long_ex(pval_pos);
- pos = (*pval_pos)->value.lval;
- convert_to_string_ex(pval_type);
- type = (*pval_type)->value.str.val;
-
- if (p && p->zoom_set) {
- ZOOM_record r = ZOOM_resultset_record(p->zoom_set, pos-1);
- if (!strcmp(type, "string")) {
- type = "render";
- }
- if (r) {
- if (!strcmp(type, "array")) {
- Z_External *ext = (Z_External *) ZOOM_record_get(r, "ext", 0);
- if (ext) {
- oident *ent = oid_getentbyoid(ext->direct_reference);
-
- if (ext->which == Z_External_grs1 && ent->value == VAL_GRS1) {
- retval_grs1(return_value, ext->u.grs1);
- } else if (ext->which == Z_External_octet) {
- char *buf = (char *) (ext->u.octet_aligned->buf);
- ODR odr = odr_createmem(ODR_DECODE);
- Z_GenericRecord *rec = 0;
-
- switch (ent->value) {
- case VAL_SOIF:
- case VAL_HTML:
- break;
- case VAL_TEXT_XML:
- case VAL_APPLICATION_XML:
- /* text2grs1(&buf, &len, t->odr_in, 0, 0); */
- break;
- default:
- rec = marc_to_grs1(buf, odr);
- }
- if (rec) {
- retval_grs1(return_value, rec);
- }
- odr_destroy(odr);
- }
- }
- } else {
- int rlen;
- const char *info = ZOOM_record_get(r, type, &rlen);
-
- return_value->value.str.len = (rlen > 0) ? rlen : 0;
- return_value->value.str.val = estrndup(info, return_value->value.str.len);
- return_value->type = IS_STRING;
- }
- }
- }
- release_assoc (p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_syntax(resource id, string syntax)
- Set record syntax for retrieval */
-PHP_FUNCTION(yaz_syntax)
-{
- pval **pval_id, **pval_syntax;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pval_id, &pval_syntax) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- convert_to_string_ex(pval_syntax);
- option_set(p, "preferredRecordSyntax", (*pval_syntax)->value.str.val);
- release_assoc(p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_element(resource id, string elementsetname)
- Set Element-Set-Name for retrieval */
-PHP_FUNCTION(yaz_element)
-{
- pval **pval_id, **pval_element;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pval_id, &pval_element) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
-
- convert_to_string_ex(pval_element);
- option_set(p, "elementSetName", (*pval_element)->value.str.val);
- release_assoc(p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_schema(resource id, string schema)
- Set Schema for retrieval */
-PHP_FUNCTION(yaz_schema)
-{
- pval **pval_id, **pval_element;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pval_id, &pval_element) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- convert_to_string_ex(pval_element);
- option_set(p, "schema", (*pval_element)->value.str.val);
- release_assoc(p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_set_option(resource id, mixed options)
- Set Option(s) for connection */
-PHP_FUNCTION(yaz_set_option)
-{
- pval **pval_ar, **pval_name, **pval_val, **pval_id;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() == 2) {
- if (zend_get_parameters_ex(2, &pval_id, &pval_ar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (Z_TYPE_PP(pval_ar) != IS_ARRAY) {
- WRONG_PARAM_COUNT;
- }
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- if (p) {
- HashPosition pos;
- HashTable *ht;
- zval **ent;
-
- ht = Z_ARRVAL_PP(pval_ar);
- for(zend_hash_internal_pointer_reset_ex(ht, &pos);
- zend_hash_get_current_data_ex(ht, (void**) &ent, &pos) == SUCCESS;
- zend_hash_move_forward_ex(ht, &pos)
- ) {
- char *key;
- ulong idx;
-#if PHP_API_VERSION > 20010101
- int type = zend_hash_get_current_key_ex(ht, &key, 0, &idx, 0, &pos);
-#else
- int type = zend_hash_get_current_key_ex(ht, &key, 0, &idx, &pos);
-#endif
- if (type != HASH_KEY_IS_STRING || Z_TYPE_PP(ent) != IS_STRING) {
- continue;
- }
- option_set(p, key, (*ent)->value.str.val);
- }
- release_assoc (p);
- }
- } else if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &pval_id, &pval_name, &pval_val) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- convert_to_string_ex(pval_name);
- convert_to_string_ex(pval_val);
- option_set(p, (*pval_name)->value.str.val, (*pval_val)->value.str.val);
-
- release_assoc(p);
- } else {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-/* {{{ proto string yaz_get_option(resource id, string name)
- Set Option(s) for connection */
-PHP_FUNCTION(yaz_get_option)
-{
- pval **pval_id, **pval_name;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 2) {
- WRONG_PARAM_COUNT;
- }
- if (zend_get_parameters_ex(2, &pval_id, &pval_name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- if (p) {
- const char *name_str, *v;
- convert_to_string_ex (pval_name);
- name_str = (*pval_name)->value.str.val;
-
- v = option_get(p, name_str);
- if (!v) {
- v = "";
- }
- return_value->value.str.len = strlen(v);
- return_value->value.str.val = estrndup(v, return_value->value.str.len);
- return_value->type = IS_STRING;
- } else {
- RETVAL_FALSE;
- }
- release_assoc(p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_range(resource id, int start, int number)
- Set result set start point and number of records to request */
-PHP_FUNCTION(yaz_range)
-{
- pval **pval_id, **pval_start, **pval_number;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &pval_id, &pval_start, &pval_number) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- convert_to_long_ex(pval_start);
- convert_to_long_ex(pval_number);
- option_set_int(p, "start", (*pval_start)->value.lval - 1);
- option_set_int(p, "count", (*pval_number)->value.lval);
- release_assoc(p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_sort(resource id, string sortspec)
- Set result set sorting criteria */
-PHP_FUNCTION(yaz_sort)
-{
- pval **pval_id, **pval_criteria;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pval_id, &pval_criteria) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- if (p) {
- convert_to_string_ex(pval_criteria);
- xfree(p->sort_criteria);
- p->sort_criteria = xstrdup((*pval_criteria)->value.str.val);
- }
- release_assoc(p);
-}
-/* }}} */
-
-const char *ill_array_lookup (void *handle, const char *name)
-{
- return array_lookup_string((HashTable *) handle, name);
-}
-
-/* {{{ proto int yaz_itemorder(resource id, array package)
- Sends Item Order request */
-PHP_FUNCTION(yaz_itemorder)
-{
- pval **pval_id, **pval_package;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pval_id, &pval_package) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (Z_TYPE_PP(pval_package) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array parameter");
- RETURN_FALSE;
- }
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- if (p) {
- ZOOM_options options = ZOOM_options_create();
-
- ZOOM_options_set_callback(options, ill_array_lookup, Z_ARRVAL_PP(pval_package));
- ZOOM_package_destroy(p->zoom_package);
- p->zoom_package = ZOOM_connection_package(p->zoom_conn, options);
- ZOOM_package_send(p->zoom_package, "itemorder");
- ZOOM_options_destroy (options);
- }
- release_assoc(p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_scan(resource id, type, query [, flags])
- Sends Scan Request */
-PHP_FUNCTION(yaz_scan)
-{
- pval **pval_id, **pval_type, **pval_query, **pval_flags = 0;
- HashTable *flags_ht = 0;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &pval_id, &pval_type, &pval_query) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &pval_id, &pval_type, &pval_query, &pval_flags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (Z_TYPE_PP(pval_flags) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad flags parameter");
- RETURN_FALSE;
- }
- flags_ht = Z_ARRVAL_PP(pval_flags);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(pval_type);
- convert_to_string_ex(pval_query);
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- ZOOM_scanset_destroy(p->zoom_scan);
- p->zoom_scan = 0;
- if (p) {
- option_set(p, "number", array_lookup_string(flags_ht, "number"));
- option_set(p, "position", array_lookup_string(flags_ht, "position"));
- option_set(p, "stepSize", array_lookup_string(flags_ht, "stepsize"));
- p->zoom_scan = ZOOM_connection_scan(p->zoom_conn, Z_STRVAL_PP(pval_query));
- }
- release_assoc(p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_es_result(resource id)
- Inspects Extended Services Result */
-PHP_FUNCTION(yaz_es_result)
-{
- pval **pval_id;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pval_id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- array_init(return_value);
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- if (p && p->zoom_package) {
- const char *str = ZOOM_package_option_get(p->zoom_package, "targetReference");
-
- if (str) {
- add_assoc_string(return_value, "targetReference", (char *) str, 1);
- }
- }
- release_assoc(p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_scan_result(resource id [, array options])
- Inspects Scan Result */
-PHP_FUNCTION(yaz_scan_result)
-{
- pval **pval_id, **pval_opt = 0;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() == 2) {
- if (zend_get_parameters_ex(2, &pval_id, &pval_opt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &pval_id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-
- array_init(return_value);
-
- if (pval_opt && array_init(*pval_opt) == FAILURE) {
- RETURN_FALSE;
- }
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- if (p && p->zoom_scan) {
- int pos = 0;
- int occ, len;
- int size = ZOOM_scanset_size(p->zoom_scan);
-
- for (pos = 0; pos < size; pos++) {
- const char *term = ZOOM_scanset_term(p->zoom_scan, pos, &occ, &len);
- zval *my_zval;
-
- ALLOC_ZVAL(my_zval);
- array_init(my_zval);
- INIT_PZVAL(my_zval);
-
- add_next_index_string(my_zval, "term", 1);
-
- if (term) {
- add_next_index_stringl(my_zval, (char*) term, len, 1);
- } else {
- add_next_index_string(my_zval, "?", 1);
- }
- add_next_index_long(my_zval, occ);
- zend_hash_next_index_insert(return_value->value.ht, (void *) &my_zval, sizeof(zval *), NULL);
- }
-
- if (pval_opt) {
- const char *v;
-
- add_assoc_long(*pval_opt, "number", size);
-
- v = ZOOM_scanset_option_get(p->zoom_scan, "stepSize");
- if (v) {
- add_assoc_long(*pval_opt, "stepsize", atoi(v));
- }
- v = ZOOM_scanset_option_get(p->zoom_scan, "position");
- if (v) {
- add_assoc_long(*pval_opt, "position", atoi(v));
- }
- v = ZOOM_scanset_option_get(p->zoom_scan, "scanStatus");
- if (v) {
- add_assoc_long(*pval_opt, "status", atoi(v));
- }
- }
- }
- release_assoc(p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_ccl_conf(resource id, array package)
- Configure CCL package */
-PHP_FUNCTION(yaz_ccl_conf)
-{
- pval **pval_id, **pval_package;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pval_id, &pval_package) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(pval_package) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array parameter");
- RETURN_FALSE;
- }
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- if (p) {
- HashTable *ht = Z_ARRVAL_PP(pval_package);
- HashPosition pos;
- zval **ent;
- char *key;
-
- ccl_qual_rm(&p->ccl_parser->bibset);
- p->ccl_parser->bibset = ccl_qual_mk();
-
- for(zend_hash_internal_pointer_reset_ex(ht, &pos);
- zend_hash_get_current_data_ex(ht, (void**) &ent, &pos) == SUCCESS;
- zend_hash_move_forward_ex(ht, &pos)
- ) {
- ulong idx;
-#if PHP_API_VERSION > 20010101
- int type = zend_hash_get_current_key_ex(ht, &key, 0, &idx, 0, &pos);
-#else
- int type = zend_hash_get_current_key_ex(ht, &key, 0, &idx, &pos);
-#endif
- if (type != HASH_KEY_IS_STRING || Z_TYPE_PP(ent) != IS_STRING) {
- continue;
- }
- ccl_qual_fitem(p->ccl_parser->bibset, (*ent)->value.str.val, key);
- }
- }
- release_assoc (p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_ccl_parse(resource id, string query, array res)
- Parse a CCL query */
-PHP_FUNCTION(yaz_ccl_parse)
-{
- pval **pval_id, **pval_query, **pval_res = 0;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &pval_id, &pval_query, &pval_res) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- pval_destructor(*pval_res);
- array_init(*pval_res);
- convert_to_string_ex (pval_query);
-
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- if (p) {
- const char *query_str = (*pval_query)->value.str.val;
- struct ccl_rpn_node *rpn;
- struct ccl_token *token_list = ccl_parser_tokenize(p->ccl_parser, query_str);
-
- rpn = ccl_parser_find(p->ccl_parser, token_list);
- ccl_token_del(token_list);
- add_assoc_long(*pval_res, "errorcode", p->ccl_parser->error_code);
-
- if (p->ccl_parser->error_code) {
- add_assoc_string(*pval_res, "errorstring", (char *) ccl_err_msg(p->ccl_parser->error_code), 1);
- add_assoc_long(*pval_res, "errorpos", p->ccl_parser->error_pos - query_str);
- RETVAL_FALSE;
- } else {
- WRBUF wrbuf_pqf = wrbuf_alloc();
- ccl_pquery(wrbuf_pqf, rpn);
- add_assoc_stringl(*pval_res, "rpn", wrbuf_buf(wrbuf_pqf), wrbuf_len(wrbuf_pqf), 1);
- wrbuf_free(wrbuf_pqf, 1);
- RETVAL_TRUE;
- }
- ccl_rpn_delete(rpn);
- } else {
- RETVAL_FALSE;
- }
- release_assoc(p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_database (resource id, string databases)
- Specify the databases within a session */
-PHP_FUNCTION(yaz_database)
-{
- pval **pval_id, **pval_database;
- Yaz_Association p;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pval_id, &pval_database) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(pval_database);
- get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- option_set(p, "databaseName", (*pval_database)->value.str.val);
- RETVAL_TRUE;
- release_assoc(p);
-}
-/* }}} */
-
-/* {{{ php_yaz_init_globals
- */
-static void php_yaz_init_globals(zend_yaz_globals *yaz_globals)
-{
- yaz_globals->assoc_seq = 0;
-}
-/* }}} */
-
-static void yaz_close_session(Yaz_Association *as TSRMLS_DC)
-{
- if (*as && (*as)->order == YAZSG(assoc_seq)) {
- if ((*as)->persistent) {
- (*as)->in_use = 0;
- } else {
- yaz_association_destroy(*as);
- *as = 0;
- }
- }
-}
-
-static void yaz_close_link (zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- Yaz_Association *as = (Yaz_Association *) rsrc->ptr;
- yaz_close_session(as TSRMLS_CC);
-}
-
-/* {{{ PHP_INI_BEGIN
- */
-PHP_INI_BEGIN()
-#if PHP_MAJOR_VERSION >= 5
- STD_PHP_INI_ENTRY("yaz.max_links", "100", PHP_INI_ALL, OnUpdateLong, max_links, zend_yaz_globals, yaz_globals)
-#else
- STD_PHP_INI_ENTRY("yaz.max_links", "100", PHP_INI_ALL, OnUpdateInt, max_links, zend_yaz_globals, yaz_globals)
-#endif
- STD_PHP_INI_ENTRY("yaz.log_file", NULL, PHP_INI_ALL, OnUpdateString, log_file, zend_yaz_globals, yaz_globals)
-PHP_INI_END()
-/* }}} */
-
-PHP_MINIT_FUNCTION(yaz)
-{
- int i;
- nmem_init();
-#ifdef ZTS
- yaz_mutex = tsrm_mutex_alloc();
-#endif
-
- ZEND_INIT_MODULE_GLOBALS(yaz, php_yaz_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
-
- if (YAZSG(log_file)) {
- yaz_log_init_level(LOG_ALL);
- yaz_log_init_file(YAZSG(log_file));
- } else {
- yaz_log_init_level(0);
- }
-
- le_link = zend_register_list_destructors_ex (yaz_close_link, 0, "YAZ link", module_number);
-
- order_associations = 1;
- shared_associations = xmalloc(sizeof(*shared_associations) * MAX_ASSOC);
- for (i = 0; i < MAX_ASSOC; i++) {
- shared_associations[i] = 0;
- }
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(yaz)
-{
- int i;
-
- if (shared_associations) {
- for (i = 0; i < MAX_ASSOC; i++) {
- yaz_association_destroy (shared_associations[i]);
- }
- xfree(shared_associations);
- shared_associations = 0;
- nmem_exit();
- }
-#ifdef ZTS
- tsrm_mutex_free (yaz_mutex);
-#endif
-
- if (yaz_log_file()) {
- fclose(yaz_log_file());
- }
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(yaz)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "YAZ Support", "enabled");
- php_info_print_table_row(2, "YAZ Version", YAZ_VERSION);
- php_info_print_table_row(2, "ZOOM", "enabled");
- php_info_print_table_end();
-}
-
-PHP_RSHUTDOWN_FUNCTION(yaz)
-{
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(yaz)
-{
- char pidstr[20];
-
- sprintf(pidstr, "%ld", (long) getpid());
-#ifdef ZTS
- tsrm_mutex_lock(yaz_mutex);
-#endif
- YAZSG(assoc_seq) = order_associations++;
-#ifdef ZTS
- tsrm_mutex_unlock(yaz_mutex);
-#endif
- yaz_log_init_prefix(pidstr);
- return SUCCESS;
-}
-
-zend_module_entry yaz_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
- "yaz",
- yaz_functions,
- PHP_MINIT(yaz),
- PHP_MSHUTDOWN(yaz),
- PHP_RINIT(yaz),
- PHP_RSHUTDOWN(yaz),
- PHP_MINFO(yaz),
-#if ZEND_MODULE_API_NO >= 20010901
- NO_VERSION_YET,
-#endif
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_YAZ
-ZEND_GET_MODULE(yaz)
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/yaz/php_yaz.h b/ext/yaz/php_yaz.h
deleted file mode 100644
index 3b9066b54e..0000000000
--- a/ext/yaz/php_yaz.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Adam Dickmeiss <adam@indexdata.dk> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_YAZ_H
-#define PHP_YAZ_H
-
-#if HAVE_YAZ
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-extern zend_module_entry yaz_module_entry;
-#define yaz_module_ptr &yaz_module_entry
-
-PHP_FUNCTION(yaz_connect);
-PHP_FUNCTION(yaz_close);
-PHP_FUNCTION(yaz_search);
-PHP_FUNCTION(yaz_wait);
-PHP_FUNCTION(yaz_errno);
-PHP_FUNCTION(yaz_error);
-PHP_FUNCTION(yaz_addinfo);
-PHP_FUNCTION(yaz_hits);
-PHP_FUNCTION(yaz_record);
-PHP_FUNCTION(yaz_syntax);
-PHP_FUNCTION(yaz_element);
-PHP_FUNCTION(yaz_range);
-PHP_FUNCTION(yaz_itemorder);
-PHP_FUNCTION(yaz_scan);
-PHP_FUNCTION(yaz_scan_result);
-PHP_FUNCTION(yaz_es_result);
-PHP_FUNCTION(yaz_present);
-PHP_FUNCTION(yaz_ccl_conf);
-PHP_FUNCTION(yaz_ccl_parse);
-PHP_FUNCTION(yaz_database);
-PHP_FUNCTION(yaz_sort);
-PHP_FUNCTION(yaz_schema);
-PHP_FUNCTION(yaz_set_option);
-PHP_FUNCTION(yaz_get_option);
-
-ZEND_BEGIN_MODULE_GLOBALS(yaz)
- int assoc_seq;
- long max_links;
- char *log_file;
-ZEND_END_MODULE_GLOBALS(yaz)
-
-#ifdef ZTS
-#define YAZSG(v) TSRMG(yaz_globals_id, zend_yaz_globals *, v)
-#else
-#define YAZSG(v) (yaz_globals.v)
-#endif
-
-#else
-
-#define yaz_module_ptr NULL
-#endif
-
-#define phpext_yaz_ptr yaz_module_ptr
-#endif
diff --git a/ext/yaz/yaz.dsp b/ext/yaz/yaz.dsp
deleted file mode 100644
index ee9d6ee163..0000000000
--- a/ext/yaz/yaz.dsp
+++ /dev/null
@@ -1,111 +0,0 @@
-# Microsoft Developer Studio Project File - Name="yaz" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=yaz - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "yaz.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "yaz.mak" CFG="yaz - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "yaz - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "yaz - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "yaz - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "YAZ_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_YAZ" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_YAZ=1 /D ZTS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib yaz.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_yaz.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "yaz - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "YAZ_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_YAZ" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_YAZ=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts-debug.lib yaz.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_yaz.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "yaz - Win32 Release_TS"
-# Name "yaz - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_yaz.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_yaz.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\README
-# End Source File
-# End Target
-# End Project
diff --git a/ext/yp/CREDITS b/ext/yp/CREDITS
deleted file mode 100644
index 4c52145877..0000000000
--- a/ext/yp/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Yellow Pages
-Stephanie Wehner, Fredrik Ohrn
diff --git a/ext/yp/config.m4 b/ext/yp/config.m4
deleted file mode 100644
index 3bdc76552b..0000000000
--- a/ext/yp/config.m4
+++ /dev/null
@@ -1,38 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(yp,whether to include YP support,
-[ --enable-yp Include YP support.])
-
-if test "$PHP_YP" != "no"; then
-
- AC_CHECK_LIB(nsl, yp_match, [
- YP_LIBS=nsl
- YP_CHECK_IN_LIB=nsl
- ],
- AC_CHECK_LIB(c, yp_match, [
- YP_LIBS=
- YP_CHECK_IN_LIB=c
- ],[
- AC_MSG_ERROR(Unable to find required yp/nis library)
- ])
- )
-
-
- AC_DEFINE(HAVE_YP,1,[ ])
- PHP_NEW_EXTENSION(yp, yp.c, $ext_shared)
-
- PHP_SUBST(YP_SHARED_LIBADD)
-
- if test -n "$YP_LIBS"; then
- PHP_ADD_LIBRARY_WITH_PATH($YP_LIBS, $YP_LIBDIR, YP_SHARED_LIBADD)
- fi
-
-
-
- case $host_alias in
- *solaris*)
- AC_DEFINE(SOLARIS_YP,1,[ ]) ;;
- esac
-fi
diff --git a/ext/yp/php_yp.h b/ext/yp/php_yp.h
deleted file mode 100644
index 10c77c1d4f..0000000000
--- a/ext/yp/php_yp.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stephanie Wehner <_@r4k.net> |
- | Fredrik Ohrn |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_YP_H
-#define PHP_YP_H
-
-#if HAVE_YP
-
-#ifdef PHP_WIN32
-#define PHP_YP_API __declspec(dllexport)
-#else
-#define PHP_YP_API
-#endif
-
-extern zend_module_entry yp_module_entry;
-#define yp_module_ptr &yp_module_entry
-
-/* yp.c functions */
-PHP_FUNCTION(yp_get_default_domain);
-PHP_FUNCTION(yp_order);
-PHP_FUNCTION(yp_master);
-PHP_FUNCTION(yp_match);
-PHP_FUNCTION(yp_first);
-PHP_FUNCTION(yp_next);
-PHP_FUNCTION(yp_all);
-PHP_FUNCTION(yp_cat);
-PHP_FUNCTION(yp_errno);
-PHP_FUNCTION(yp_err_string);
-PHP_MINIT_FUNCTION(yp);
-PHP_RINIT_FUNCTION(yp);
-PHP_MINFO_FUNCTION(yp);
-
-typedef struct {
- int error;
-} php_yp_globals;
-
-#ifdef ZTS
-#define YP(v) TSRMG(yp_globals_id, php_yp_globals *, v)
-#else
-#define YP(v) (yp_globals.v)
-#endif
-
-#else
-
-#define yp_module_ptr NULL
-
-#endif /* HAVE_YP */
-
-#define phpext_yp_ptr yp_module_ptr
-
-#endif /* PHP_YP_H */
diff --git a/ext/yp/yp.c b/ext/yp/yp.c
deleted file mode 100644
index 28ff8e3e4f..0000000000
--- a/ext/yp/yp.c
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stephanie Wehner <_@r4k.net> |
- | Fredrik Ohrn |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/info.h"
-
-#if HAVE_YP
-
-#include "php_yp.h"
-
-#include <rpcsvc/ypclnt.h>
-
-/* {{{ thread safety stuff */
-
-#ifdef ZTS
-int yp_globals_id;
-#else
-PHP_YP_API php_yp_globals yp_globals;
-#endif
-
-/* }}} */
-
-function_entry yp_functions[] = {
- PHP_FE(yp_get_default_domain, NULL)
- PHP_FE(yp_order, NULL)
- PHP_FE(yp_master, NULL)
- PHP_FE(yp_match, NULL)
- PHP_FE(yp_first, NULL)
- PHP_FE(yp_next, NULL)
- PHP_FE(yp_all, NULL)
- PHP_FE(yp_cat, NULL)
- PHP_FE(yp_errno, NULL)
- PHP_FE(yp_err_string, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry yp_module_entry = {
- STANDARD_MODULE_HEADER,
- "yp",
- yp_functions,
- PHP_MINIT(yp),
- NULL,
- PHP_RINIT(yp),
- NULL,
- PHP_MINFO(yp),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_YP
-ZEND_GET_MODULE(yp)
-#endif
-
-/* {{{ proto string yp_get_default_domain(void)
- Returns the domain or false */
-PHP_FUNCTION(yp_get_default_domain)
-{
- char *outdomain;
-
- if((YP(error) = yp_get_default_domain(&outdomain))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", yperr_string (YP(error)));
- RETURN_FALSE;
- }
- RETVAL_STRING(outdomain,1);
-}
-/* }}} */
-
-/* {{{ proto int yp_order(string domain, string map)
- Returns the order number or false */
-PHP_FUNCTION(yp_order)
-{
- pval **domain, **map;
-
-#if SOLARIS_YP
- unsigned long outval;
-#else
- int outval;
-#endif
-
- if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2,&domain,&map) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(domain);
- convert_to_string_ex(map);
-
- if((YP(error) = yp_order(Z_STRVAL_PP (domain), Z_STRVAL_PP (map), &outval))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", yperr_string (YP(error)));
- RETURN_FALSE;
- }
-
- RETVAL_LONG(outval);
-}
-/* }}} */
-
-/* {{{ proto string yp_master(string domain, string map)
- Returns the machine name of the master */
-PHP_FUNCTION(yp_master)
-{
- pval **domain, **map;
- char *outname;
-
- if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2,&domain,&map) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(domain);
- convert_to_string_ex(map);
-
- if((YP(error) = yp_master(Z_STRVAL_PP (domain), Z_STRVAL_PP (map), &outname))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", yperr_string (YP(error)));
- RETURN_FALSE;
- }
-
- RETVAL_STRING(outname,1);
-}
-/* }}} */
-
-/* {{{ proto string yp_match(string domain, string map, string key)
- Returns the matched line or false */
-PHP_FUNCTION(yp_match)
-{
- pval **domain, **map, **key;
- char *outval;
- int outvallen;
-
- if((ZEND_NUM_ARGS() != 3) || zend_get_parameters_ex(3,&domain,&map,&key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(domain);
- convert_to_string_ex(map);
- convert_to_string_ex(key);
-
- if((YP(error) = yp_match(Z_STRVAL_PP (domain), Z_STRVAL_PP (map), Z_STRVAL_PP (key), Z_STRLEN_PP (key), &outval, &outvallen))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", yperr_string (YP(error)));
- RETURN_FALSE;
- }
-
- RETVAL_STRINGL(outval,outvallen,1);
-}
-/* }}} */
-
-/* {{{ proto array yp_first(string domain, string map)
- Returns the first key as array with $var[$key] and the the line as the value */
-PHP_FUNCTION(yp_first)
-{
- pval **domain, **map;
- char *outval, *outkey;
- int outvallen, outkeylen;
-
- if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2,&domain,&map) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(domain);
- convert_to_string_ex(map);
-
- if((YP(error) = yp_first(Z_STRVAL_PP (domain), Z_STRVAL_PP (map), &outkey, &outkeylen, &outval, &outvallen))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", yperr_string (YP(error)));
- RETURN_FALSE;
- }
- array_init(return_value);
- add_assoc_stringl_ex(return_value,outkey,outkeylen,outval,outvallen,1);
-
- /* Deprecated */
- add_assoc_stringl(return_value,"key",outkey,outkeylen,1);
- add_assoc_stringl(return_value,"value",outval,outvallen,1);
-}
-/* }}} */
-
-/* {{{ proto array yp_next(string domain, string map, string key)
- Returns an array with $var[$key] and the the line as the value */
-PHP_FUNCTION(yp_next)
-{
- pval **domain, **map, **key;
- char *outval, *outkey;
- int outvallen, outkeylen;
-
- if((ZEND_NUM_ARGS() != 3) || zend_get_parameters_ex(3,&domain,&map,&key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(domain);
- convert_to_string_ex(map);
- convert_to_string_ex(key);
-
- if((YP(error) = yp_next(Z_STRVAL_PP (domain), Z_STRVAL_PP (map), Z_STRVAL_PP (key), Z_STRLEN_PP (key), &outkey, &outkeylen, &outval, &outvallen))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", yperr_string (YP(error)));
- RETURN_FALSE;
- }
-
- array_init(return_value);
- add_assoc_stringl_ex(return_value,outkey,outkeylen,outval,outvallen,1);
-}
-/* }}} */
-
-/* {{{ php_foreach_all
- */
-static int php_foreach_all (int instatus, char *inkey, int inkeylen, char *inval, int invallen, char *indata)
-{
- int r;
- zval *status, *key, *value;
- zval **args [3];
- zval *retval;
- TSRMLS_FETCH();
-
- args[0] = &status;
- args[1] = &key;
- args[2] = &value;
-
- MAKE_STD_ZVAL (status);
- ZVAL_LONG (status, ypprot_err (instatus));
-
- MAKE_STD_ZVAL (key);
- ZVAL_STRINGL (key, inkey, inkeylen, 1);
-
- MAKE_STD_ZVAL (value);
- ZVAL_STRINGL (value, inval, invallen, 1);
-
- if(call_user_function_ex(CG(function_table), NULL, *((zval **)indata), &retval, 3, args, 0, NULL TSRMLS_CC) != SUCCESS)
- {
- zval_ptr_dtor(&status);
- zval_ptr_dtor(&key);
- zval_ptr_dtor(&value);
-
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Function call failed");
- return 1;
- }
-
- convert_to_long_ex(&retval);
- r = Z_LVAL_P (retval);
-
- zval_ptr_dtor(&retval);
-
- zval_ptr_dtor(&status);
- zval_ptr_dtor(&key);
- zval_ptr_dtor(&value);
-
- return r;
-}
-/* }}} */
-
-/* {{{ proto void yp_all(string domain, string map, string callback)
- Traverse the map and call a function on each entry */
-PHP_FUNCTION(yp_all)
-{
- pval **domain, **map, **php_callback;
- struct ypall_callback callback;
-
- if((ZEND_NUM_ARGS() != 3) || zend_get_parameters_ex(3,&domain,&map,&php_callback) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(domain);
- convert_to_string_ex(map);
-
- callback.foreach = php_foreach_all;
- callback.data = (char *) php_callback;
-
- yp_all(Z_STRVAL_PP(domain),Z_STRVAL_PP(map),&callback);
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ php_foreach_cat
- */
-static int php_foreach_cat (int instatus, char *inkey, int inkeylen, char *inval, int invallen, char *indata)
-{
- int err;
-
- err = ypprot_err (instatus);
-
- if (!err)
- {
- if (inkeylen) {
- char *key = emalloc(inkeylen+1);
- if(key) {
- strlcpy(key, inkey, inkeylen+1);
- add_assoc_stringl_ex((zval *) indata, key, inkeylen+1, inval, invallen, 1);
- efree(key);
- } else {
- php_error(E_WARNING, "Can't allocate %d bytes for key buffer in yp_cat()");
- }
- }
-
- return 0;
- }
-
- if (err != YPERR_NOMORE)
- {
- TSRMLS_FETCH();
-
- YP(error) = err;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", yperr_string (err));
- }
-
- return 0;
-}
-/* }}} */
-
-/* {{{ proto array yp_cat(string domain, string map)
- Return an array containing the entire map */
-PHP_FUNCTION(yp_cat)
-{
- pval **domain, **map;
- struct ypall_callback callback;
-
- if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2,&domain,&map) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(domain);
- convert_to_string_ex(map);
-
- array_init(return_value);
-
- callback.foreach = php_foreach_cat;
- callback.data = (char *) return_value;
-
- yp_all(Z_STRVAL_PP(domain),Z_STRVAL_PP(map),&callback);
-}
-/* }}} */
-
-/* {{{ proto int yp_errno()
- Returns the error code from the last call or 0 if no error occured */
-PHP_FUNCTION(yp_errno)
-{
- if((ZEND_NUM_ARGS() != 0)) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_LONG (YP(error));
-}
-/* }}} */
-
-/* {{{ proto string yp_err_string(int errorcode)
- Returns the corresponding error string for the given error code */
-PHP_FUNCTION(yp_err_string)
-{
- pval **error;
- char *string;
-
- if((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1,&error) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(error);
-
- if((string = yperr_string(Z_LVAL_PP(error))) == NULL) {
- RETURN_FALSE;
- }
-
- RETVAL_STRING(string,1);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(yp)
-{
-#ifdef ZTS
- ts_allocate_id(&yp_globals_id, sizeof(php_yp_globals), NULL, NULL);
-#endif
-
- REGISTER_LONG_CONSTANT("YPERR_BADARGS", YPERR_BADARGS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_BADDB", YPERR_BADDB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_BUSY", YPERR_BUSY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_DOMAIN", YPERR_DOMAIN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_KEY", YPERR_KEY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_MAP", YPERR_MAP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_NODOM", YPERR_NODOM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_NOMORE", YPERR_NOMORE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_PMAP", YPERR_PMAP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_RESRC", YPERR_RESRC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_RPC", YPERR_RPC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_YPBIND", YPERR_YPBIND, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_YPERR", YPERR_YPERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_YPSERV", YPERR_YPSERV, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_VERS", YPERR_VERS, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-PHP_RINIT_FUNCTION(yp)
-{
- YP(error) = 0;
-
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(yp)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "YP Support", "enabled");
- php_info_print_table_end();
-}
-#endif /* HAVE_YP */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/zip/CREDITS b/ext/zip/CREDITS
deleted file mode 100644
index be2c5a2b44..0000000000
--- a/ext/zip/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Zip
-Sterling Hughes
diff --git a/ext/zip/config.m4 b/ext/zip/config.m4
deleted file mode 100644
index 8c66d6f5d0..0000000000
--- a/ext/zip/config.m4
+++ /dev/null
@@ -1,39 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(zip,for ZIP support,
-[ --with-zip[=DIR] Include ZIP support (requires zziplib >= 0.10.6).])
-
-if test "$PHP_ZIP" != "no"; then
- for i in $PHP_ZIP /usr/local /usr ; do
- if test -f $i/include/zzlib/zziplib.h; then
- ZZIPLIB_DIR=$i
- ZZIPLIB_INCDIR=$i/include/zzlib
- elif test -f $i/include/zziplib.h; then
- ZZIPLIB_DIR=$i
- ZZIPLIB_INCDIR=$i/include
- fi
- done
-
- if test -z "$ZZIPLIB_DIR"; then
- AC_MSG_ERROR(Cannot find libzzip)
- fi
-
- ZZIPLIB_LIBDIR=$ZZIPLIB_DIR/lib
-
- PHP_CHECK_LIBRARY(zzip, zzip_open,
- [
- AC_DEFINE(HAVE_ZZIPLIB,1,[ ])
- ], [
- AC_MSG_ERROR(zziplib module requires zzlib >= 0.10.6.)
- ], [
- -L$ZZIPLIB_LIBDIR
- ])
-
- PHP_ADD_LIBRARY_WITH_PATH(zzip, $ZZIPLIB_LIBDIR, ZIP_SHARED_LIBADD)
- PHP_ADD_INCLUDE($ZZIPLIB_INCDIR)
-
- PHP_NEW_EXTENSION(zip, zip.c, $ext_shared)
- PHP_SUBST(ZIP_SHARED_LIBADD)
-fi
diff --git a/ext/zip/php_zip.h b/ext/zip/php_zip.h
deleted file mode 100644
index 62f170d7f2..0000000000
--- a/ext/zip/php_zip.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_ZIP_H
-#define PHP_ZIP_H
-
-#if HAVE_ZZIPLIB
-
-#include <zziplib.h>
-
-extern zend_module_entry zip_module_entry;
-#define phpext_zip_ptr &zip_module_entry
-
-#define PHP_ZZIPLIB_API
-#ifdef PHP_WIN32
-#undef PHP_ZZIPLIB_API
-#ifdef ZIP_EXPORTS
-#define PHP_ZZIPLIB_API __declspec(dllexport)
-#else
-#define PHP_ZZIPLIB_API __declspec(dllimport)
-#endif
-#endif
-
-PHP_MINIT_FUNCTION(zip);
-PHP_MINFO_FUNCTION(zip);
-
-PHP_FUNCTION(zip_open);
-PHP_FUNCTION(zip_read);
-PHP_FUNCTION(zip_close);
-PHP_FUNCTION(zip_entry_name);
-PHP_FUNCTION(zip_entry_compressedsize);
-PHP_FUNCTION(zip_entry_filesize);
-PHP_FUNCTION(zip_entry_compressionmethod);
-PHP_FUNCTION(zip_entry_open);
-PHP_FUNCTION(zip_entry_read);
-PHP_FUNCTION(zip_entry_close);
-
-typedef struct {
- ZZIP_FILE *fp;
- ZZIP_DIRENT dirent;
-} php_zzip_dirent;
-
-#else
-#define phpext_zziplib_ptr NULL
-#endif
-
-#endif /* PHP_ZZIPLIB_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/zip/tests/001.phpt b/ext/zip/tests/001.phpt
deleted file mode 100644
index 787ade9722..0000000000
--- a/ext/zip/tests/001.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Check for zziplib presence
---SKIPIF--
-<?php if (!extension_loaded("zip")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "zip extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php4/tests/README for further information on
- writing regression tests
-*/
-?>
---EXPECT--
-zip extension is available
diff --git a/ext/zip/zip.c b/ext/zip/zip.c
deleted file mode 100644
index d2d6db0250..0000000000
--- a/ext/zip/zip.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_zip.h"
-
-#if HAVE_ZZIPLIB
-
-#include "ext/standard/info.h"
-#include <zziplib.h>
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-static int le_zip_dir;
-#define le_zip_dir_name "Zip Directory"
-static int le_zip_entry;
-#define le_zip_entry_name "Zip Entry"
-
-/* {{{ zip_functions[]
- */
-function_entry zip_functions[] = {
- PHP_FE(zip_open, NULL)
- PHP_FE(zip_read, NULL)
- PHP_FE(zip_close, NULL)
- PHP_FE(zip_entry_name, NULL)
- PHP_FE(zip_entry_compressedsize, NULL)
- PHP_FE(zip_entry_filesize, NULL)
- PHP_FE(zip_entry_compressionmethod, NULL)
- PHP_FE(zip_entry_open, NULL)
- PHP_FE(zip_entry_read, NULL)
- PHP_FE(zip_entry_close, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ zip_module_entry
- */
-zend_module_entry zip_module_entry = {
- STANDARD_MODULE_HEADER,
- "zip",
- zip_functions,
- PHP_MINIT(zip),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(zip),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_ZIP
-ZEND_GET_MODULE(zip)
-#endif
-
-/* {{{ php_zip_free_dir
- */
-static void php_zip_free_dir(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- ZZIP_DIR *z_dir = (ZZIP_DIR *) rsrc->ptr;
- zzip_closedir(z_dir);
-}
-/* }}} */
-
-/* {{{ php_zip_free_entry
- */
-static void php_zip_free_entry(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- php_zzip_dirent *entry = (php_zzip_dirent *) rsrc->ptr;
-
- if (entry->fp)
- zzip_close(entry->fp);
-
- efree(entry);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(zip)
-{
- le_zip_dir = zend_register_list_destructors_ex(php_zip_free_dir, NULL, le_zip_dir_name, module_number);
- le_zip_entry = zend_register_list_destructors_ex(php_zip_free_entry, NULL, le_zip_entry_name, module_number);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(zip)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Zip support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ proto resource zip_open(string filename)
- Open a new zip archive for reading */
-PHP_FUNCTION(zip_open)
-{
- char *filename;
- ZZIP_DIR *archive_p = NULL;
- int filename_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
- return;
- }
-
- if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(filename TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- archive_p = zzip_opendir(filename);
- if (archive_p == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot open zip archive %s", filename);
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, archive_p, le_zip_dir);
-}
-/* }}} */
-
-/* {{{ proto resource zip_read(resource zip)
- Returns the next file in the archive */
-PHP_FUNCTION(zip_read)
-{
- zval *zzip_dp;
- ZZIP_DIR *archive_p = NULL;
- php_zzip_dirent *entry = NULL;
- int ret;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zzip_dp) == FAILURE) {
- return;
- }
- ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *, &zzip_dp, -1, le_zip_dir_name, le_zip_dir);
-
- entry = emalloc(sizeof(php_zzip_dirent));
- ret = zzip_dir_read(archive_p, &entry->dirent);
- if (ret == 0) {
- efree(entry);
- RETURN_FALSE;
- }
- entry->fp = NULL;
-
- ZEND_REGISTER_RESOURCE(return_value, entry, le_zip_entry);
-}
-/* }}} */
-
-/* {{{ proto void zip_close(resource zip)
- Close a Zip archive */
-PHP_FUNCTION(zip_close)
-{
- zval *zzip_dp;
- ZZIP_DIR *archive_p = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zzip_dp) == FAILURE) {
- return;
- }
- ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *, &zzip_dp, -1, le_zip_dir_name, le_zip_dir);
-
- zend_list_delete(Z_LVAL_P(zzip_dp));
-}
-/* }}} */
-
-/* {{{ php_zzip_get_entry
- */
-static void php_zzip_get_entry(INTERNAL_FUNCTION_PARAMETERS, int opt)
-{
- zval *zzip_ent;
- php_zzip_dirent *entry = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zzip_ent) == FAILURE) {
- return;
- }
- ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, &zzip_ent, -1, le_zip_entry_name, le_zip_entry);
-
- switch (opt) {
- case 0:
- RETURN_STRING(entry->dirent.d_name, 1);
- break;
- case 1:
- RETURN_LONG(entry->dirent.d_csize);
- break;
- case 2:
- RETURN_LONG(entry->dirent.st_size);
- break;
- case 3:
- RETURN_STRING((char *) zzip_compr_str(entry->dirent.d_compr), 1);
- break;
- }
-
-}
-/* }}} */
-
-/* {{{ proto string zip_entry_name(resource zip_entry)
- Return the name given a ZZip entry */
-PHP_FUNCTION(zip_entry_name)
-{
- php_zzip_get_entry(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int zip_entry_compressedsize(resource zip_entry)
- Return the compressed size of a ZZip entry */
-PHP_FUNCTION(zip_entry_compressedsize)
-{
- php_zzip_get_entry(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int zip_entry_filesize(resource zip_entry)
- Return the actual filesize of a ZZip entry */
-PHP_FUNCTION(zip_entry_filesize)
-{
- php_zzip_get_entry(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);
-}
-/* }}} */
-
-/* {{{ proto string zip_entry_compressionmethod(resource zip_entry)
- Return a string containing the compression method used on a particular entry */
-PHP_FUNCTION(zip_entry_compressionmethod)
-{
- php_zzip_get_entry(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3);
-}
-/* }}} */
-
-/* {{{ proto bool zip_entry_open(resource zip_dp, resource zip_entry, string mode)
- Open a Zip File, pointed by the resource entry */
-PHP_FUNCTION(zip_entry_open)
-{
- zval *zzip_dp;
- zval *zzip_ent;
- ZZIP_DIR *archive_p = NULL;
- php_zzip_dirent *entry = NULL;
- char *mode;
- int mode_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|s", &zzip_dp, &zzip_ent, &mode, &mode_len) == FAILURE) {
- return;
- }
- ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *, &zzip_dp, -1, le_zip_dir_name, le_zip_dir);
- ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, &zzip_ent, -1, le_zip_entry_name, le_zip_entry);
-
- entry->fp = zzip_file_open(archive_p, entry->dirent.d_name, O_RDONLY | O_BINARY);
-
- RETURN_BOOL((int) entry->fp);
-}
-/* }}} */
-
-/* {{{ proto string zip_entry_read(resource zip_ent)
- Read X bytes from an opened zip entry */
-PHP_FUNCTION(zip_entry_read)
-{
- zval *zzip_ent;
- php_zzip_dirent *entry = NULL;
- char *buf = NULL;
- long len = 1024;
- int ret = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zzip_ent, &len) == FAILURE) {
- return;
- }
- ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, &zzip_ent, -1, le_zip_entry_name, le_zip_entry);
-
- buf = emalloc(len + 1);
- ret = zzip_read(entry->fp, buf, len);
- buf[ret] = 0;
- if (ret == 0) {
- RETURN_FALSE;
- } else {
- RETURN_STRINGL(buf, ret, 0);
- }
-}
-/* }}} */
-
-/* {{{ proto void zip_entry_close(resource zip_ent)
- Close a zip entry */
-PHP_FUNCTION(zip_entry_close)
-{
- zval *zzip_ent;
- php_zzip_dirent *entry = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zzip_ent) == FAILURE) {
- return;
- }
- ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, &zzip_ent, -1, le_zip_entry_name, le_zip_entry);
-
- zend_list_delete(Z_LVAL_P(zzip_ent));
-}
-/* }}} */
-
-#endif /* HAVE_ZZIPLIB */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/zip/zip.dsp b/ext/zip/zip.dsp
deleted file mode 100644
index 4034db7d33..0000000000
--- a/ext/zip/zip.dsp
+++ /dev/null
@@ -1,108 +0,0 @@
-# Microsoft Developer Studio Project File - Name="zip" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=zip - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "zip.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "zip.mak" CFG="zip - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "zip - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "zip - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "zip - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZIP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_ZIP" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_ZIP=1 /D "PHP_ZIP_EXPORTS" /D "HAVE_ZZIPLIB" /D "ZZIP_DLL" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 zziplib.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_zip.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\release"
-
-!ELSEIF "$(CFG)" == "zip - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZIP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_ZIP" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_ZIP=1 /D "PHP_ZIP_EXPORTS" /D "HAVE_ZZIPLIB" /D "ZZIP_DLL" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib zziplib.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_zip.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\release"
-
-!ENDIF
-
-# Begin Target
-
-# Name "zip - Win32 Release_TS"
-# Name "zip - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\zip.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_zip.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/zlib/CREDITS b/ext/zlib/CREDITS
deleted file mode 100644
index c0a47dd293..0000000000
--- a/ext/zlib/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Zlib
-Rasmus Lerdorf, Stefan Roehrich, Zeev Suraski, Jade Nicoletti
diff --git a/ext/zlib/config0.m4 b/ext/zlib/config0.m4
deleted file mode 100644
index e407ff0742..0000000000
--- a/ext/zlib/config0.m4
+++ /dev/null
@@ -1,53 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(zlib,for ZLIB support,
-[ --with-zlib[=DIR] Include ZLIB support (requires zlib >= 1.0.9).])
-
-PHP_ARG_WITH(zlib-dir,if the location of ZLIB install directory is defined,
-[ --with-zlib-dir=<DIR> Define the location of zlib install directory], no, no)
-
-if test "$PHP_ZLIB" != "no" -o "$PHP_ZLIB_DIR" != "no"; then
- PHP_NEW_EXTENSION(zlib, zlib.c zlib_fopen_wrapper.c, $ext_shared)
- PHP_SUBST(ZLIB_SHARED_LIBADD)
-
- if test "$PHP_ZLIB" != "yes" -a "$PHP_ZLIB" != "no"; then
- if test -f $PHP_ZLIB/include/zlib/zlib.h; then
- ZLIB_DIR=$PHP_ZLIB
- ZLIB_INCDIR=$ZLIB_DIR/include/zlib
- elif test -f $PHP_ZLIB/include/zlib.h; then
- ZLIB_DIR=$PHP_ZLIB
- ZLIB_INCDIR=$ZLIB_DIR/include
- fi
- else
- for i in /usr/local /usr $PHP_ZLIB_DIR; do
- if test -f $i/include/zlib/zlib.h; then
- ZLIB_DIR=$i
- ZLIB_INCDIR=$i/include/zlib
- elif test -f $i/include/zlib.h; then
- ZLIB_DIR=$i
- ZLIB_INCDIR=$i/include
- fi
- done
- fi
-
- if test -z "$ZLIB_DIR"; then
- AC_MSG_ERROR(Cannot find libz)
- fi
-
- PHP_CHECK_LIBRARY(z, gzgets, [
- AC_DEFINE(HAVE_ZLIB,1,[ ])
- ],[
- AC_MSG_ERROR(ZLIB extension requires zlib >= 1.0.9)
- ],[
- -L$ZLIB_DIR/lib
- ])
-
- PHP_ADD_LIBPATH($ZLIB_DIR/lib, ZLIB_SHARED_LIBADD)
-
- PHP_ZLIB_DIR=$ZLIB_DIR
- PHP_ADD_LIBRARY(z,, ZLIB_SHARED_LIBADD)
- PHP_ADD_INCLUDE($ZLIB_INCDIR)
-
-fi
diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h
deleted file mode 100644
index c399862dc1..0000000000
--- a/ext/zlib/php_zlib.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Stefan Röhrich <sr@linux.de> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_ZLIB_H
-#define PHP_ZLIB_H
-
-#include <zlib.h>
-
-ZEND_BEGIN_MODULE_GLOBALS(zlib)
- /* variables for transparent gzip encoding */
- int compression_coding;
- z_stream stream;
- uLong crc;
- int ob_gzhandler_status;
- int ob_gzip_coding;
- long output_compression;
- long output_compression_level;
- char *output_handler;
-ZEND_END_MODULE_GLOBALS(zlib)
-
-extern zend_module_entry php_zlib_module_entry;
-#define zlib_module_ptr &php_zlib_module_entry
-
-PHP_MINIT_FUNCTION(zlib);
-PHP_MSHUTDOWN_FUNCTION(zlib);
-PHP_RINIT_FUNCTION(zlib);
-PHP_MINFO_FUNCTION(zlib);
-PHP_FUNCTION(gzopen);
-PHP_FUNCTION(readgzfile);
-PHP_FUNCTION(gzfile);
-PHP_FUNCTION(gzcompress);
-PHP_FUNCTION(gzuncompress);
-PHP_FUNCTION(gzdeflate);
-PHP_FUNCTION(gzinflate);
-PHP_FUNCTION(gzencode);
-PHP_FUNCTION(ob_gzhandler);
-PHP_FUNCTION(zlib_get_coding_type);
-
-int php_enable_output_compression(int buffer_size TSRMLS_DC);
-int php_ob_gzhandler_check(TSRMLS_D);
-
-php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
-extern php_stream_ops php_stream_gzio_ops;
-extern php_stream_wrapper php_stream_gzip_wrapper;
-
-#ifdef ZTS
-#define ZLIBG(v) TSRMG(zlib_globals_id, zend_zlib_globals *, v)
-#else
-#define ZLIBG(v) (zlib_globals.v)
-#endif
-
-#define phpext_zlib_ptr zlib_module_ptr
-
-#define CODING_GZIP 1
-#define CODING_DEFLATE 2
-
-#endif /* PHP_ZLIB_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/zlib/tests/001.phpt b/ext/zlib/tests/001.phpt
deleted file mode 100644
index 40b84c6f07..0000000000
--- a/ext/zlib/tests/001.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-gzdeflate()/gzinflate()
---SKIPIF--
-<?php if (!extension_loaded("zlib")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-$original = str_repeat("hallo php",4096);
-$packed=gzdeflate($original);
-echo strlen($packed)." ".strlen($original)."\n";
-$unpacked=gzinflate($packed);
-if (strcmp($original,$unpacked)==0) echo "Strings are equal";
-
-echo "\n";
-$original = 'aaaaaaaaaaaaaaa';
-$packed=gzdeflate($original);
-echo strlen($packed)." ".strlen($original)."\n";
-$unpacked=gzinflate($packed);
-if (strcmp($original,$unpacked)==0) echo "Strings are equal";
-?>
---EXPECT--
-100 36864
-Strings are equal
-5 15
-Strings are equal \ No newline at end of file
diff --git a/ext/zlib/tests/002.phpt b/ext/zlib/tests/002.phpt
deleted file mode 100644
index 24ad827e32..0000000000
--- a/ext/zlib/tests/002.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-gzcompress()/gzuncompress()
---SKIPIF--
-<?php if (!extension_loaded("zlib")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-$original = str_repeat("hallo php",4096);
-$packed=gzcompress($original);
-echo strlen($packed)." ".strlen($original)."\n";
-$unpacked=gzuncompress($packed);
-if (strcmp($original,$unpacked)==0) echo "Strings are equal";
-?>
---EXPECT--
-106 36864
-Strings are equal
diff --git a/ext/zlib/tests/003.phpt b/ext/zlib/tests/003.phpt
deleted file mode 100644
index 254a4563ad..0000000000
--- a/ext/zlib/tests/003.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-gzencode()/base64_encode()
---SKIPIF--
-<?php if (!extension_loaded("zlib")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-$original = str_repeat("hallo php",4096);
-$packed=gzencode($original);
-echo strlen($packed)." ".strlen($original)."\n";
-if (strcmp(base64_encode($packed),"H4sIAAAAAAAAA+3GoQ0AQAgEsFV+NdwJEthf/R6kVU11z9tsRERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERETu5gPlQAe9AJAAAA==")==0) echo "Strings are equal";
-?>
---EXPECT--
-118 36864
-Strings are equal
diff --git a/ext/zlib/tests/gzreadgzwrite.phpt b/ext/zlib/tests/gzreadgzwrite.phpt
deleted file mode 100644
index f8a71e72fd..0000000000
--- a/ext/zlib/tests/gzreadgzwrite.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-gzopen(), gzread(), gzwrite()
---SKIPIF--
-<?php # vim600:syn=php:
-if (!extension_loaded("zlib")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-$original = str_repeat("hallo php",4096);
-$filename = tempnam("/tmp", "phpt");
-
-$fp = gzopen($filename, "wb");
-gzwrite($fp, $original);
-var_dump(strlen($original));
-var_dump(gztell($fp));
-fclose($fp);
-
-$fp = gzopen($filename, "rb");
-$data = gzread($fp, strlen($original));
-if ($data == $original) {
- echo "Strings are equal\n";
-} else {
- echo "Strings are not equal\n";
- var_dump($data);
-}
-gzclose($fp);
-unlink($filename);
-?>
---EXPECT--
-int(36864)
-int(36864)
-Strings are equal
diff --git a/ext/zlib/tests/gzreadgzwriteplain.phpt b/ext/zlib/tests/gzreadgzwriteplain.phpt
deleted file mode 100644
index 4710b1edbc..0000000000
--- a/ext/zlib/tests/gzreadgzwriteplain.phpt
+++ /dev/null
@@ -1,47 +0,0 @@
---TEST--
-gzopen(), gzread(), gzwrite() for non-compressed data
---SKIPIF--
-<?php # vim600:syn=php:
-if (!extension_loaded("zlib")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-$original = str_repeat("hallo php",4096);
-$filename = tempnam("/tmp", "phpt");
-
-$fp = fopen($filename, "wb");
-fwrite($fp, $original);
-var_dump(strlen($original));
-var_dump(ftell($fp));
-fclose($fp);
-
-$fp = gzopen($filename, "rb");
-$data = gzread($fp, strlen($original));
-if ($data == $original) {
- echo "Strings are equal\n";
-} else {
- echo "Strings are not equal\n";
- var_dump($data);
-}
-
-gzseek($fp, strlen($original) / 2);
-$data = gzread($fp, strlen($original));
-
-var_dump(strlen($data));
-if ($data == substr($original, strlen($original) / 2)) {
- echo "Strings are equal\n";
-} else {
- echo "Strings are not equal\n";
- var_dump($data);
-}
-
-gzclose($fp);
-unlink($filename);
-?>
---EXPECT--
-int(36864)
-int(36864)
-Strings are equal
-int(18432)
-Strings are equal
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
deleted file mode 100644
index 1e6ce2f286..0000000000
--- a/ext/zlib/zlib.c
+++ /dev/null
@@ -1,1087 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Stefan Röhrich <sr@linux.de> |
- | Zeev Suraski <zeev@zend.com> |
- | Jade Nicoletti <nicoletti@nns.ch> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "SAPI.h"
-#include "php_ini.h"
-
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#ifdef PHP_WIN32
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#else
-#include <sys/param.h>
-/* #include <sys/uio.h> */
-#endif
-#include "ext/standard/head.h"
-#include "safe_mode.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-#include "php_zlib.h"
-#include "fopen_wrappers.h"
-#if HAVE_PWD_H
-#ifdef PHP_WIN32
-#include "win32/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-#if defined(HAVE_UNISTD_H) && defined(PHP_WIN32)
-#undef HAVE_UNISTD_H
-#endif
-
-#ifdef COMPILE_DL_ZLIB
-#ifndef PUTS
-#define PUTS(a) php_printf("%s",a)
-#endif
-#ifndef PUTC
-#define PUTC(a) PUTS(a)
-#endif
-#ifndef PHPWRITE
-#define PHPWRITE(a,n) php_write((a),(n) TSRMLS_CC)
-#endif
-#endif
-
-#define OS_CODE 0x03 /* FIXME */
-#define GZIP_HEADER_LENGTH 10
-#define GZIP_FOOTER_LENGTH 8
-
-/* True globals, no need for thread safety */
-static int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
-
-/* {{{ php_zlib_functions[]
- */
-function_entry php_zlib_functions[] = {
- PHP_FE(readgzfile, NULL)
- PHP_FALIAS(gzrewind, rewind, NULL)
- PHP_FALIAS(gzclose, fclose, NULL)
- PHP_FALIAS(gzeof, feof, NULL)
- PHP_FALIAS(gzgetc, fgetc, NULL)
- PHP_FALIAS(gzgets, fgets, NULL)
- PHP_FALIAS(gzgetss, fgetss, NULL)
- PHP_FALIAS(gzread, fread, NULL)
- PHP_FE(gzopen, NULL)
- PHP_FALIAS(gzpassthru, fpassthru, NULL)
- PHP_FALIAS(gzseek, fseek, NULL)
- PHP_FALIAS(gztell, ftell, NULL)
- PHP_FALIAS(gzwrite, fwrite, NULL)
- PHP_FALIAS(gzputs, fwrite, NULL)
- PHP_FE(gzfile, NULL)
- PHP_FE(gzcompress, NULL)
- PHP_FE(gzuncompress, NULL)
- PHP_FE(gzdeflate, NULL)
- PHP_FE(gzinflate, NULL)
- PHP_FE(gzencode, NULL)
- PHP_FE(ob_gzhandler, NULL)
- PHP_FE(zlib_get_coding_type, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ php_zlib_module_entry
- */
-zend_module_entry php_zlib_module_entry = {
- STANDARD_MODULE_HEADER,
- "zlib",
- php_zlib_functions,
- PHP_MINIT(zlib),
- PHP_MSHUTDOWN(zlib),
- PHP_RINIT(zlib),
- NULL,
- PHP_MINFO(zlib),
- "1.1",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-ZEND_DECLARE_MODULE_GLOBALS(zlib)
-
-#ifdef COMPILE_DL_ZLIB
-ZEND_GET_MODULE(php_zlib)
-#endif
-
-/* {{{ OnUpdate_zlib_output_compression */
-static PHP_INI_MH(OnUpdate_zlib_output_compression)
-{
- char *ini_value;
-
- if (new_value == NULL) {
- return FAILURE;
- }
-
- if (!strncasecmp(new_value, "off", sizeof("off"))) {
- new_value = "0";
- new_value_length = sizeof("0");
- } else if (!strncasecmp(new_value, "on", sizeof("on"))) {
- new_value = "1";
- new_value_length = sizeof("1");
- }
-
- ini_value = zend_ini_string("output_handler", sizeof("output_handler"), 0);
- if (ini_value != NULL && strlen(ini_value) != 0 && zend_atoi(new_value, new_value_length) != 0) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_CORE_ERROR, "Cannot use both zlib.output_compression and output_handler together!!");
- return FAILURE;
- }
-
- if (stage == PHP_INI_STAGE_RUNTIME && SG(headers_sent) && !SG(request_info).no_headers) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "Cannot change zlib.output_compression - headers already sent");
- return FAILURE;
- }
-
- OnUpdateLong(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ OnUpdate_zlib_output_compression_level */
-static PHP_INI_MH(OnUpdate_zlib_output_compression_level)
-{
- OnUpdateLong(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ OnUpdate_zlib_output_handler */
-static PHP_INI_MH(OnUpdate_zlib_output_handler)
-{
- if (stage == PHP_INI_STAGE_RUNTIME && SG(headers_sent) && !SG(request_info).no_headers) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "Cannot change zlib.output_handler - headers already sent");
- return FAILURE;
- }
-
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
-
- return SUCCESS;
-}
-/* }}} */
-
-
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_ALL, OnUpdate_zlib_output_compression, output_compression, zend_zlib_globals, zlib_globals)
- STD_PHP_INI_ENTRY("zlib.output_compression_level", "-1", PHP_INI_ALL, OnUpdate_zlib_output_compression_level, output_compression_level, zend_zlib_globals, zlib_globals)
- STD_PHP_INI_ENTRY("zlib.output_handler", "", PHP_INI_ALL, OnUpdate_zlib_output_handler, output_handler, zend_zlib_globals, zlib_globals)
-PHP_INI_END()
-
-#ifdef ZTS
-/* {{{ php_zlib_init_globals
- */
-static void php_zlib_init_globals(zend_zlib_globals *zlib_globals_p TSRMLS_DC)
-{
-}
-/* }}} */
-#endif
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(zlib)
-{
-#ifdef ZTS
- ts_allocate_id(&zlib_globals_id, sizeof(zend_zlib_globals), (ts_allocate_ctor) php_zlib_init_globals, NULL);
-#endif
- php_register_url_stream_wrapper("compress.zlib", &php_stream_gzip_wrapper TSRMLS_CC);
-
- REGISTER_LONG_CONSTANT("FORCE_GZIP", CODING_GZIP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FORCE_DEFLATE", CODING_DEFLATE, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INI_ENTRIES();
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(zlib)
-{
- uint chunk_size = ZLIBG(output_compression);
-
- ZLIBG(ob_gzhandler_status) = 0;
- ZLIBG(ob_gzip_coding) = 0;
- if (chunk_size) {
- if (chunk_size == 1) {
- chunk_size = 4096; /* use the default size */
- ZLIBG(output_compression) = chunk_size;
- }
- php_enable_output_compression(chunk_size TSRMLS_CC);
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(zlib)
-{
- php_unregister_url_stream_wrapper("zlib" TSRMLS_CC);
-
- UNREGISTER_INI_ENTRIES();
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(zlib)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "ZLib Support", "enabled");
- php_info_print_table_row(2, "Compiled Version", ZLIB_VERSION);
- php_info_print_table_row(2, "Linked Version", (char *) zlibVersion());
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-/* }}} */
-
-/* {{{ proto array gzfile(string filename [, int use_include_path])
- Read und uncompress entire .gz-file into an array */
-PHP_FUNCTION(gzfile)
-{
- zval **filename, **arg2;
- char *slashed, buf[8192];
- register int i = 0;
- int use_include_path = 0;
- php_stream *stream;
-
- /* check args */
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1,&filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2,&filename,&arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg2);
- use_include_path = Z_LVAL_PP(arg2) ? USE_PATH : 0;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- /* using a stream here is a bit more efficient (resource wise) than php_gzopen_wrapper */
- stream = php_stream_gzopen(NULL, Z_STRVAL_PP(filename), "rb", use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, NULL STREAMS_CC TSRMLS_CC);
- if (stream == NULL) {
- /* Error reporting is already done by stream code */
- RETURN_FALSE;
- }
-
- /* Initialize return array */
- array_init(return_value);
-
- /* Now loop through the file and do the magic quotes thing if needed */
- memset(buf,0,sizeof(buf));
-
- while (php_stream_gets(stream, buf, sizeof(buf) - 1) != NULL) {
- if (PG(magic_quotes_runtime)) {
- int len;
-
- slashed = php_addslashes(buf, 0, &len, 0 TSRMLS_CC); /* 0 = don't free source string */
- add_index_stringl(return_value, i++, slashed, len, 0);
- } else {
- add_index_string(return_value, i++, buf, 1);
- }
- }
- php_stream_close(stream);
-}
-/* }}} */
-
-/* {{{ proto int gzopen(string filename, string mode [, int use_include_path])
- Open a .gz-file and return a .gz-file pointer */
-PHP_FUNCTION(gzopen)
-{
- zval **arg1, **arg2, **arg3;
- php_stream *stream;
- char *p;
- int use_include_path = 0;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg3);
- use_include_path = Z_LVAL_PP(arg3) ? USE_PATH : 0;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
-
- p = estrndup(Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2));
-
- stream = php_stream_gzopen(NULL, Z_STRVAL_PP(arg1), p, use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, NULL STREAMS_CC TSRMLS_CC);
- if (!stream) {
- RETURN_FALSE;
- }
- efree(p);
- php_stream_to_zval(stream, return_value);
-}
-/* }}} */
-
-/*
- * Read a file and write the ouput to stdout
- */
-/* {{{ proto int readgzfile(string filename [, int use_include_path])
- Output a .gz-file */
-PHP_FUNCTION(readgzfile)
-{
- zval **arg1, **arg2;
- php_stream *stream;
- int size;
- int use_include_path = 0;
-
- /* check args */
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1,&arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2,&arg1,&arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg2);
- use_include_path = Z_LVAL_PP(arg2) ? USE_PATH : 0;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
-
- stream = php_stream_gzopen(NULL, Z_STRVAL_PP(arg1), "rb", use_include_path | ENFORCE_SAFE_MODE, NULL, NULL STREAMS_CC TSRMLS_CC);
- if (!stream) {
- RETURN_FALSE;
- }
- size = php_stream_passthru(stream);
- php_stream_close(stream);
- RETURN_LONG(size);
-}
-/* }}} */
-
-/* {{{ proto string gzcompress(string data [, int level])
- Gzip-compress a string */
-PHP_FUNCTION(gzcompress)
-{
- zval **data, **zlimit = NULL;
- int limit, status;
- unsigned long l2;
- char *s2;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &data) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- limit = -1;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &data, &zlimit) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(zlimit);
- limit = Z_LVAL_PP(zlimit);
- if ((limit < 0) || (limit > 9)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "compression level(%d) must be within 0..9", limit);
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(data);
-
- l2 = Z_STRLEN_PP(data) + (Z_STRLEN_PP(data) / 1000) + 15 + 1; /* room for \0 */
- s2 = (char *) emalloc(l2);
- if (!s2) {
- RETURN_FALSE;
- }
-
- if (limit >= 0) {
- status = compress2(s2, &l2, Z_STRVAL_PP(data), Z_STRLEN_PP(data), limit);
- } else {
- status = compress(s2, &l2, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- }
-
- if (status == Z_OK) {
- s2 = erealloc(s2, l2 + 1);
- s2[l2] = '\0';
- RETURN_STRINGL(s2, l2, 0);
- } else {
- efree(s2);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", zError(status));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string gzuncompress(string data [, int length])
- Unzip a gzip-compressed string */
-PHP_FUNCTION(gzuncompress)
-{
- zval **data, **zlimit = NULL;
- int status, factor=1, maxfactor=16;
- unsigned long plength=0, length;
- char *s1=NULL, *s2=NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &data) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- length = 0;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &data, &zlimit) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(zlimit);
- if (Z_LVAL_PP(zlimit) <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be greater zero");
- RETURN_FALSE;
- }
- plength = Z_LVAL_PP(zlimit);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(data);
-
- /*
- zlib::uncompress() wants to know the output data length
- if none was given as a parameter
- we try from input length * 2 up to input length * 2^15
- doubling it whenever it wasn't big enough
- that should be eneugh for all real life cases
- */
- do {
- length = plength ? plength : Z_STRLEN_PP(data) * (1 << factor++);
- s2 = (char *) erealloc(s1, length);
- status = uncompress(s2, &length, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- s1 = s2;
- } while ((status == Z_BUF_ERROR) && (!plength) && (factor < maxfactor));
-
- if (status == Z_OK) {
- s2 = erealloc(s2, length + 1); /* space for \0 */
- s2[ length ] = '\0';
- RETURN_STRINGL(s2, length, 0);
- } else {
- efree(s2);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", zError(status));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string gzdeflate(string data [, int level])
- Gzip-compress a string */
-PHP_FUNCTION(gzdeflate)
-{
- zval **data, **zlimit = NULL;
- int level,status;
- z_stream stream;
- char *s2;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &data) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- level = Z_DEFAULT_COMPRESSION;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &data, &zlimit) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(zlimit);
- level = Z_LVAL_PP(zlimit);
- if ((level < 0) || (level > 9)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "compression level(%d) must be within 0..9", level);
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(data);
-
- stream.data_type = Z_ASCII;
- stream.zalloc = (alloc_func) Z_NULL;
- stream.zfree = (free_func) Z_NULL;
- stream.opaque = (voidpf) Z_NULL;
-
- stream.next_in = (Bytef *) Z_STRVAL_PP(data);
- stream.avail_in = Z_STRLEN_PP(data);
-
- stream.avail_out = stream.avail_in + (stream.avail_in / 1000) + 15 + 1; /* room for \0 */
-
- s2 = (char *) emalloc(stream.avail_out);
- if (!s2) {
- RETURN_FALSE;
- }
-
- stream.next_out = s2;
-
- /* init with -MAX_WBITS disables the zlib internal headers */
- status = deflateInit2(&stream, level, Z_DEFLATED, -MAX_WBITS, MAX_MEM_LEVEL, 0);
- if (status == Z_OK) {
- status = deflate(&stream, Z_FINISH);
- if (status != Z_STREAM_END) {
- deflateEnd(&stream);
- if (status == Z_OK) {
- status = Z_BUF_ERROR;
- }
- } else {
- status = deflateEnd(&stream);
- }
- }
-
- if (status == Z_OK) {
- s2 = erealloc(s2,stream.total_out + 1); /* resize to buffer to the "right" size */
- s2[ stream.total_out ] = '\0';
- RETURN_STRINGL(s2, stream.total_out, 0);
- } else {
- efree(s2);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", zError(status));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string gzinflate(string data [, int length])
- Unzip a gzip-compressed string */
-PHP_FUNCTION(gzinflate)
-{
- zval **data, **zlimit = NULL;
- int status, factor=1, maxfactor=16;
- unsigned long plength=0, length;
- char *s1=NULL, *s2=NULL;
- z_stream stream;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &data) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- length = 0;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &data, &zlimit) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(zlimit);
- if (Z_LVAL_PP(zlimit) <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be greater zero");
- RETURN_FALSE;
- }
- plength = Z_LVAL_PP(zlimit);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(data);
-
- /*
- stream.avail_out wants to know the output data length
- if none was given as a parameter
- we try from input length * 2 up to input length * 2^15
- doubling it whenever it wasn't big enough
- that should be enaugh for all real life cases
- */
-
- stream.zalloc = (alloc_func) Z_NULL;
- stream.zfree = (free_func) Z_NULL;
-
- do {
- length = plength ? plength : Z_STRLEN_PP(data) * (1 << factor++);
- s2 = (char *) erealloc(s1, length);
-
- if (!s2 && s1) {
- efree(s1);
- RETURN_FALSE;
- }
-
- stream.next_in = (Bytef *) Z_STRVAL_PP(data);
- stream.avail_in = (uInt) Z_STRLEN_PP(data) + 1; /* there is room for \0 */
-
- stream.next_out = s2;
- stream.avail_out = (uInt) length;
-
- /* init with -MAX_WBITS disables the zlib internal headers */
- status = inflateInit2(&stream, -MAX_WBITS);
- if (status == Z_OK) {
- status = inflate(&stream, Z_FINISH);
- if (status != Z_STREAM_END) {
- inflateEnd(&stream);
- if (status == Z_OK) {
- status = Z_BUF_ERROR;
- }
- } else {
- status = inflateEnd(&stream);
- }
- }
- s1 = s2;
-
- } while ((status == Z_BUF_ERROR) && (!plength) && (factor < maxfactor));
-
- if (status == Z_OK) {
- s2 = erealloc(s2, stream.total_out + 1); /* room for \0 */
- s2[ stream.total_out ] = '\0';
- RETURN_STRINGL(s2, stream.total_out, 0);
- } else {
- efree(s2);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", zError(status));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string zlib_get_coding_type(void)
- Returns the coding type used for output compression */
-PHP_FUNCTION(zlib_get_coding_type)
-{
- switch (ZLIBG(ob_gzip_coding)) {
- case CODING_GZIP:
- RETURN_STRINGL("gzip", sizeof("gzip") - 1, 1);
-
- case CODING_DEFLATE:
- RETURN_STRINGL("deflate", sizeof("deflate") - 1, 1);
- }
-
- RETURN_FALSE;
-}
-
-/* {{{ php_do_deflate
- */
-static int php_do_deflate(uint str_length, Bytef **p_buffer, uint *p_buffer_len, zend_bool do_start, zend_bool do_end TSRMLS_DC)
-{
- Bytef *buffer;
- uInt prev_outlen, outlen;
- int err;
- int start_offset = (do_start ? 10 : 0);
- int end_offset = (do_end ? 8 : 0);
-
- outlen = (uint) (sizeof(char) * (str_length * 1.001f + 12) + 1); /* leave some room for a trailing \0 */
- if ((outlen + start_offset + end_offset) > *p_buffer_len) {
- buffer = (Bytef *) emalloc(outlen + start_offset + end_offset);
- } else {
- buffer = *p_buffer;
- }
-
- ZLIBG(stream).next_out = buffer + start_offset;
- ZLIBG(stream).avail_out = outlen;
-
- err = deflate(&ZLIBG(stream), Z_SYNC_FLUSH);
- while (err == Z_OK && !ZLIBG(stream).avail_out) {
- prev_outlen = outlen;
- outlen *= 3;
- if ((outlen + start_offset + end_offset) > *p_buffer_len) {
- buffer = erealloc(buffer, outlen + start_offset + end_offset);
- }
-
- ZLIBG(stream).next_out = buffer + start_offset + prev_outlen;
- ZLIBG(stream).avail_out = prev_outlen * 2;
-
- err = deflate(&ZLIBG(stream), Z_SYNC_FLUSH);
- }
-
- if (do_end) {
- err = deflate(&ZLIBG(stream), Z_FINISH);
- }
-
- *p_buffer = buffer;
- *p_buffer_len = outlen - ZLIBG(stream).avail_out;
-
- return err;
-}
-/* }}} */
-
-/* {{{ php_deflate_string
- */
-static int php_deflate_string(const char *str, uint str_length, char **newstr, uint *new_length, int coding, zend_bool do_start, zend_bool do_end, int compression_level TSRMLS_DC)
-{
- int err;
-
- ZLIBG(compression_coding) = coding;
-
- if (do_start) {
- ZLIBG(stream).zalloc = Z_NULL;
- ZLIBG(stream).zfree = Z_NULL;
- ZLIBG(stream).opaque = Z_NULL;
-
- switch (coding) {
- case CODING_GZIP:
- /* windowBits is passed < 0 to suppress zlib header & trailer */
- if (deflateInit2(&ZLIBG(stream), compression_level, Z_DEFLATED, -MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY) != Z_OK) {
- /* TODO: print out error */
- return FAILURE;
- }
-
- ZLIBG(crc) = crc32(0L, Z_NULL, 0);
- break;
-
- case CODING_DEFLATE:
- if (deflateInit(&ZLIBG(stream), compression_level) != Z_OK) {
- /* TODO: print out error */
- return FAILURE;
- }
- break;
- }
- }
-
- ZLIBG(stream).next_in = (Bytef *) str;
- ZLIBG(stream).avail_in = (uInt) str_length;
-
- if (ZLIBG(compression_coding) == 1) {
- ZLIBG(crc) = crc32(ZLIBG(crc), (const Bytef *) str, str_length);
- }
-
- err = php_do_deflate(str_length, (Bytef **) newstr, new_length, do_start, do_end TSRMLS_CC);
- /* TODO: error handling (err may be Z_STREAM_ERROR, Z_BUF_ERROR, ?) */
-
- if (do_start) {
- /* Write a very simple .gz header: */
- (*newstr)[0] = gz_magic[0];
- (*newstr)[1] = gz_magic[1];
- (*newstr)[2] = Z_DEFLATED;
- (*newstr)[3] = (*newstr)[4] = (*newstr)[5] = (*newstr)[6] = (*newstr)[7] = (*newstr)[8] = 0;
- (*newstr)[9] = OS_CODE;
- *new_length += 10;
- }
- if (do_end) {
- if (ZLIBG(compression_coding) == 1) {
- char *trailer = (*newstr) + (*new_length);
-
- /* write crc & stream.total_in in LSB order */
- trailer[0] = (char) ZLIBG(crc) & 0xFF;
- trailer[1] = (char) (ZLIBG(crc) >> 8) & 0xFF;
- trailer[2] = (char) (ZLIBG(crc) >> 16) & 0xFF;
- trailer[3] = (char) (ZLIBG(crc) >> 24) & 0xFF;
- trailer[4] = (char) ZLIBG(stream).total_in & 0xFF;
- trailer[5] = (char) (ZLIBG(stream).total_in >> 8) & 0xFF;
- trailer[6] = (char) (ZLIBG(stream).total_in >> 16) & 0xFF;
- trailer[7] = (char) (ZLIBG(stream).total_in >> 24) & 0xFF;
- trailer[8] = '\0';
- *new_length += 8;
- }
- deflateEnd(&ZLIBG(stream));
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto string gzencode(string data [, int level [, int encoding_mode]])
- GZ encode a string */
-PHP_FUNCTION(gzencode)
-{
- char *data, *s2;
- int data_len;
- long level = Z_DEFAULT_COMPRESSION, coding = CODING_GZIP;
- int status;
- z_stream stream;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &data, &data_len, &level, &coding) == FAILURE) {
- return;
- }
-
- if ((level < -1) || (level > 9)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "compression level(%d) must be within -1..9", level);
- RETURN_FALSE;
- }
-
- if ((coding != CODING_GZIP) && (coding != CODING_DEFLATE)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "encoding mode must be FORCE_GZIP or FORCE_DEFLATE");
- RETURN_FALSE;
- }
-
- stream.zalloc = Z_NULL;
- stream.zfree = Z_NULL;
- stream.opaque = Z_NULL;
-
- stream.next_in = (Bytef *) data;
- stream.avail_in = data_len;
-
- stream.avail_out = stream.avail_in + (stream.avail_in / 1000) + 15 + 1; /* room for \0 */
- s2 = (char *) emalloc(stream.avail_out + GZIP_HEADER_LENGTH + (coding == CODING_GZIP ? GZIP_FOOTER_LENGTH : 0));
-
- /* add gzip file header */
- s2[0] = gz_magic[0];
- s2[1] = gz_magic[1];
- s2[2] = Z_DEFLATED;
- s2[3] = s2[4] = s2[5] = s2[6] = s2[7] = s2[8] = 0; /* time set to 0 */
- s2[9] = OS_CODE;
-
- stream.next_out = &(s2[GZIP_HEADER_LENGTH]);
-
- switch (coding) {
- case CODING_GZIP:
- /* windowBits is passed < 0 to suppress zlib header & trailer */
- if ((status = deflateInit2(&stream, level, Z_DEFLATED, -MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY)) != Z_OK) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", zError(status));
- RETURN_FALSE;
- }
-
- break;
- case CODING_DEFLATE:
- if ((status = deflateInit(&stream, level)) != Z_OK) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", zError(status));
- RETURN_FALSE;
- }
- break;
- }
-
- status = deflate(&stream, Z_FINISH);
- if (status != Z_STREAM_END) {
- deflateEnd(&stream);
- if (status == Z_OK) {
- status = Z_BUF_ERROR;
- }
- } else {
- status = deflateEnd(&stream);
- }
-
- if (status == Z_OK) {
- /* resize to buffer to the "right" size */
- s2 = erealloc(s2, stream.total_out + GZIP_HEADER_LENGTH + (coding == CODING_GZIP ? GZIP_FOOTER_LENGTH : 0) + 1);
-
- if (coding == CODING_GZIP) {
- char *trailer = s2 + (stream.total_out + GZIP_HEADER_LENGTH);
- uLong crc = crc32(0L, Z_NULL, 0);
-
- crc = crc32(crc, (const Bytef *) data, data_len);
-
- /* write crc & stream.total_in in LSB order */
- trailer[0] = (char) crc & 0xFF;
- trailer[1] = (char) (crc >> 8) & 0xFF;
- trailer[2] = (char) (crc >> 16) & 0xFF;
- trailer[3] = (char) (crc >> 24) & 0xFF;
- trailer[4] = (char) stream.total_in & 0xFF;
- trailer[5] = (char) (stream.total_in >> 8) & 0xFF;
- trailer[6] = (char) (stream.total_in >> 16) & 0xFF;
- trailer[7] = (char) (stream.total_in >> 24) & 0xFF;
- trailer[8] = '\0';
- }
- RETURN_STRINGL(s2, stream.total_out + GZIP_HEADER_LENGTH + (coding == CODING_GZIP ? GZIP_FOOTER_LENGTH : 0), 0);
- } else {
- efree(s2);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", zError(status));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_ob_gzhandler_check
- */
-int php_ob_gzhandler_check(TSRMLS_D)
-{
- /* check for wrong usages */
- if (OG(ob_nesting_level > 0)) {
- if (php_ob_handler_used("ob_gzhandler" TSRMLS_CC)) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler 'ob_gzhandler' cannot be used twice");
- return FAILURE;
- }
- if (php_ob_handler_used("mb_output_handler" TSRMLS_CC)) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler 'ob_gzhandler' cannot be used after 'mb_output_handler'");
- return FAILURE;
- }
- if (php_ob_handler_used("URL-Rewriter" TSRMLS_CC)) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler 'ob_gzhandler' cannot be used after 'URL-Rewriter'");
- return FAILURE;
- }
- if (php_ob_init_conflict("ob_gzhandler", "zlib output compression" TSRMLS_CC)) {
- return FAILURE;
- }
- }
-
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ proto string ob_gzhandler(string str, int mode)
- Encode str based on accept-encoding setting - designed to be called from ob_start() */
-PHP_FUNCTION(ob_gzhandler)
-{
- int coding;
- zval **zv_string, **zv_mode;
- zval **data, **a_encoding;
- zend_bool return_original = 0;
- zend_bool do_start, do_end;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &zv_string, &zv_mode) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (ZLIBG(ob_gzhandler_status) == -1
- || zend_hash_find(&EG(symbol_table), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), (void **) &data) == FAILURE
- || Z_TYPE_PP(data) != IS_ARRAY
- || zend_hash_find(Z_ARRVAL_PP(data), "HTTP_ACCEPT_ENCODING", sizeof("HTTP_ACCEPT_ENCODING"), (void **) &a_encoding) == FAILURE
- ) {
- ZLIBG(ob_gzhandler_status) = -1;
- RETURN_FALSE;
- }
-
- convert_to_string_ex(a_encoding);
- if (php_memnstr(Z_STRVAL_PP(a_encoding), "gzip", 4, Z_STRVAL_PP(a_encoding) + Z_STRLEN_PP(a_encoding))) {
- coding = CODING_GZIP;
- } else if (php_memnstr(Z_STRVAL_PP(a_encoding), "deflate", 7, Z_STRVAL_PP(a_encoding) + Z_STRLEN_PP(a_encoding))) {
- coding = CODING_DEFLATE;
- } else {
- ZLIBG(ob_gzhandler_status) = -1;
- RETURN_FALSE;
- }
-
- convert_to_long_ex(zv_mode);
- do_start = ((Z_LVAL_PP(zv_mode) & PHP_OUTPUT_HANDLER_START) ? 1 : 0);
- do_end = ((Z_LVAL_PP(zv_mode) & PHP_OUTPUT_HANDLER_END) ? 1 : 0);
- Z_STRVAL_P(return_value) = NULL;
- Z_STRLEN_P(return_value) = 0;
-
- if (php_deflate_string(Z_STRVAL_PP(zv_string), Z_STRLEN_PP(zv_string), &Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value), coding, do_start, do_end, ZLIBG(output_compression_level) TSRMLS_CC) == SUCCESS) {
- Z_TYPE_P(return_value) = IS_STRING;
- if (do_start) {
- switch (coding) {
- case CODING_GZIP:
- if (sapi_add_header("Content-Encoding: gzip", sizeof("Content-Encoding: gzip") - 1, 1) == FAILURE) {
- return_original = 1;
- }
- if (sapi_add_header("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1) == FAILURE) {
- return_original = 1;
- }
- break;
- case CODING_DEFLATE:
- if (sapi_add_header("Content-Encoding: deflate", sizeof("Content-Encoding: deflate") - 1, 1) == FAILURE) {
- return_original = 1;
- }
- if (sapi_add_header("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1) == FAILURE) {
- return_original = 1;
- }
- break;
- default:
- return_original = 1;
- break;
- }
- }
-
- if (return_original) {
- zval_dtor(return_value);
- }
-
- } else {
- return_original = 1;
- }
-
- if (return_original) {
- /* return the original string */
- *return_value = **zv_string;
- zval_copy_ctor(return_value);
- }
-}
-/* }}} */
-
-/* {{{ php_gzip_output_handler
- */
-static void php_gzip_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC)
-{
- zend_bool do_start, do_end;
-
- if (!ZLIBG(output_compression)) {
- *handled_output = NULL;
- } else {
- do_start = (mode & PHP_OUTPUT_HANDLER_START ? 1 : 0);
- do_end = (mode & PHP_OUTPUT_HANDLER_END ? 1 : 0);
- if (php_deflate_string(output, output_len, handled_output, handled_output_len, ZLIBG(ob_gzip_coding), do_start, do_end, ZLIBG(output_compression_level) TSRMLS_CC) != SUCCESS) {
- zend_error(E_ERROR, "Compression failed");
- }
- }
-}
-/* }}} */
-
-/* {{{ php_enable_output_compression
- */
-int php_enable_output_compression(int buffer_size TSRMLS_DC)
-{
- zval **a_encoding, **data;
-
- if (zend_hash_find(&EG(symbol_table), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), (void **) &data) == FAILURE
- || Z_TYPE_PP(data) != IS_ARRAY
- || zend_hash_find(Z_ARRVAL_PP(data), "HTTP_ACCEPT_ENCODING", sizeof("HTTP_ACCEPT_ENCODING"), (void **) &a_encoding) == FAILURE
- ) {
- return FAILURE;
- }
-
- convert_to_string_ex(a_encoding);
-
- if (php_memnstr(Z_STRVAL_PP(a_encoding), "gzip", 4, Z_STRVAL_PP(a_encoding) + Z_STRLEN_PP(a_encoding))) {
- ZLIBG(ob_gzip_coding) = CODING_GZIP;
- } else if (php_memnstr(Z_STRVAL_PP(a_encoding), "deflate", 7, Z_STRVAL_PP(a_encoding) + Z_STRLEN_PP(a_encoding))) {
- ZLIBG(ob_gzip_coding) = CODING_DEFLATE;
- } else {
- return FAILURE;
- }
-
- php_ob_set_internal_handler(php_gzip_output_handler, (uint)buffer_size, "zlib output compression", 0 TSRMLS_CC);
-
- if (ZLIBG(output_handler) && strlen(ZLIBG(output_handler))) {
- php_start_ob_buffer_named(ZLIBG(output_handler), 0, 1 TSRMLS_CC);
- }
- return SUCCESS;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/zlib/zlib.dsp b/ext/zlib/zlib.dsp
deleted file mode 100644
index 999953f306..0000000000
--- a/ext/zlib/zlib.dsp
+++ /dev/null
@@ -1,117 +0,0 @@
-# Microsoft Developer Studio Project File - Name="zlib" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=zlib - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "zlib.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "zlib.mak" CFG="zlib - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "zlib - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "zlib - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "zlib - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_ZLIB" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZLIB_EXPORTS" /D "COMPILE_DL_ZLIB" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_ZLIB=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib zlib.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_zlib.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\zlib\Release" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "zlib - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_ZLIB" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZLIB_EXPORTS" /D "COMPILE_DL_ZLIB" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_ZLIB=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib zlib.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_zlib.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\zlib\Debug"
-
-!ENDIF
-
-# Begin Target
-
-# Name "zlib - Win32 Release_TS"
-# Name "zlib - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\zlib.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zlib_fopen_wrapper.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_zlib.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c
deleted file mode 100644
index f49ccbc273..0000000000
--- a/ext/zlib/zlib_fopen_wrapper.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com>, based on work by: |
- | Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#define _GNU_SOURCE
-
-#include "php.h"
-#include "php_zlib.h"
-#include "fopen_wrappers.h"
-
-struct php_gz_stream_data_t {
- gzFile gz_file;
-};
-
-static size_t php_gziop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-{
- struct php_gz_stream_data_t *self = (struct php_gz_stream_data_t *) stream->abstract;
- int read;
-
- read = gzread(self->gz_file, buf, count);
-
- if (gzeof(self->gz_file)) {
- stream->eof = 1;
- }
-
- return (read < 0) ? 0 : read;
-}
-
-static size_t php_gziop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
-{
- struct php_gz_stream_data_t *self = (struct php_gz_stream_data_t *) stream->abstract;
- int wrote;
-
- wrote = gzwrite(self->gz_file, (char *) buf, count);
-
- return (wrote < 0) ? 0 : wrote;
-}
-
-static int php_gziop_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC)
-{
- struct php_gz_stream_data_t *self = (struct php_gz_stream_data_t *) stream->abstract;
- int ret;
-
- assert(self != NULL);
-
- ret = gzseek(self->gz_file, offset, whence);
- *newoffs = gztell(self->gz_file);
-
- return (ret < 0) ? -1 : 0;
-}
-
-static int php_gziop_close(php_stream *stream, int close_handle TSRMLS_DC)
-{
- struct php_gz_stream_data_t *self = (struct php_gz_stream_data_t *) stream->abstract;
- int ret = EOF;
-
- if (close_handle) {
- if (self->gz_file) {
- ret = gzclose(self->gz_file);
- self->gz_file = NULL;
- }
- }
- efree(self);
-
- return ret;
-}
-
-static int php_gziop_flush(php_stream *stream TSRMLS_DC)
-{
- struct php_gz_stream_data_t *self = (struct php_gz_stream_data_t *) stream->abstract;
-
- return gzflush(self->gz_file, Z_SYNC_FLUSH);
-}
-
-php_stream_ops php_stream_gzio_ops = {
- php_gziop_write, php_gziop_read,
- php_gziop_close, php_gziop_flush,
- "ZLIB",
- php_gziop_seek,
- NULL, /* cast */
- NULL, /* stat */
- NULL /* set_option */
-};
-
-php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, char *path, char *mode, int options,
- char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
-{
- struct php_gz_stream_data_t *self;
- php_stream *stream = NULL, *innerstream = NULL;
-
- /* sanity check the stream: it can be either read-only or write-only */
- if (strchr(mode, '+')) {
- if (options & REPORT_ERRORS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot open a zlib stream for reading and writing at the same time!");
- }
- return NULL;
- }
-
- self = emalloc(sizeof(*self));
-
- if (strncasecmp("compress.zlib://", path, 16) == 0) {
- path += 16;
- } else if (strncasecmp("zlib:", path, 5) == 0) {
- path += 5;
- }
-
- innerstream = php_stream_open_wrapper(path, mode, STREAM_MUST_SEEK | options | STREAM_WILL_CAST, opened_path);
-
- if (innerstream) {
- int fd;
-
- if (SUCCESS == php_stream_cast(innerstream, PHP_STREAM_AS_FD | PHP_STREAM_CAST_RELEASE, (void **) &fd, REPORT_ERRORS)) {
- self->gz_file = gzdopen(fd, mode);
- if (self->gz_file) {
- stream = php_stream_alloc_rel(&php_stream_gzio_ops, self, 0, mode);
- if (stream) {
- stream->flags |= PHP_STREAM_FLAG_NO_BUFFER;
- return stream;
- }
- gzclose(self->gz_file);
- }
- if (options & REPORT_ERRORS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "gzopen failed");
- }
- } else if (innerstream) {
- php_stream_close(innerstream);
- }
- }
-
- if (stream) {
- php_stream_close(stream);
- }
-
- if (self) {
- efree(self);
- }
-
- return NULL;
-}
-
-static php_stream_wrapper_ops gzip_stream_wops = {
- php_stream_gzopen,
- NULL, /* close */
- NULL, /* stat */
- NULL, /* stat_url */
- NULL, /* opendir */
- "ZLIB",
- NULL /* unlink */
-};
-
-php_stream_wrapper php_stream_gzip_wrapper = {
- &gzip_stream_wops,
- NULL,
- 0, /* is_url */
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/zlib/zlib_win32_howto.txt b/ext/zlib/zlib_win32_howto.txt
deleted file mode 100644
index 72e767ac5e..0000000000
--- a/ext/zlib/zlib_win32_howto.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Rules for building ZLIB
------------------------
-
-The zlib project requires the folowing files:
-
-php_build\zlib\include\zlib.h
-php_build\zlib\include\zconf.h
-php_build\zlib\lib\zlibstat.lib
-
-php_build is a directory at the same level as php4.
-
-Start Visual Studio, load php_modules.dsw, select the ZLIB projects, and build
-it.
-
-
- \ No newline at end of file
diff --git a/footer b/footer
deleted file mode 100644
index 64d3768113..0000000000
--- a/footer
+++ /dev/null
@@ -1,9 +0,0 @@
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/genfiles b/genfiles
deleted file mode 100755
index c20115f2eb..0000000000
--- a/genfiles
+++ /dev/null
@@ -1,14 +0,0 @@
-#! /bin/sh
-
-STD='make -f Makefile.frag LEX="flex -L" YACC="bison -y -l" srcdir=Zend builddir=Zend'
-
-(eval "$STD Zend/zend_language_parser.c Zend/zend_language_scanner.c Zend/zend_ini_parser.c Zend/zend_ini_scanner.c")
-
-set -x
-bison -d -y -l ext/standard/parsedate.y -o ext/standard/parsedate.c
-
-for f in ext/standard/url_scanner_ex.c ext/standard/var_unserializer.c; do
- cp $f $f.orig
- grep -v '#line ' $f.orig > $f
-done
-
diff --git a/header b/header
deleted file mode 100644
index 32bfdc1f85..0000000000
--- a/header
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
diff --git a/ltmain.sh b/ltmain.sh
deleted file mode 100644
index 7e0c9f487c..0000000000
--- a/ltmain.sh
+++ /dev/null
@@ -1,5062 +0,0 @@
-# ltmain.sh - Provide generalized library-building support services.
-# NOTE: Changing this file will not affect anything until you rerun configure.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
-# Free Software Foundation, Inc.
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Check that we have a working $echo.
-if test "X$1" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
-elif test "X$1" = X--fallback-echo; then
- # Avoid inline document here, it may be left over
- :
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
- # Yippee, $echo works!
- :
-else
- # Restart under the correct shell, and then maybe $echo will work.
- exec $SHELL "$0" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
- # used as fallback echo
- shift
- cat <<EOF
-$*
-EOF
- exit 0
-fi
-
-# The name of this program.
-progname=`$echo "$0" | ${SED} 's%^.*/%%'`
-modename="$progname"
-
-# Constants.
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION=1.4.3
-TIMESTAMP=" (1.922.2.110 2002/10/23 01:39:54)"
-
-default_mode=
-help="Try \`$progname --help' for more information."
-magic="%%%MAGIC variable%%%"
-mkdir="mkdir"
-mv="mv -f"
-rm="rm -f"
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed="${SED}"' -e 1s/^X//'
-sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
-# test EBCDIC or ASCII
-case `echo A|od -x` in
- *[Cc]1*) # EBCDIC based system
- SP2NL="tr '\100' '\n'"
- NL2SP="tr '\r\n' '\100\100'"
- ;;
- *) # Assume ASCII based system
- SP2NL="tr '\040' '\012'"
- NL2SP="tr '\015\012' '\040\040'"
- ;;
-esac
-
-# NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-# We save the old values to restore during execute mode.
-if test "${LC_ALL+set}" = set; then
- save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
-fi
-if test "${LANG+set}" = set; then
- save_LANG="$LANG"; LANG=C; export LANG
-fi
-
-# Make sure IFS has a sensible default
-: ${IFS=" "}
-
-if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
- echo "$modename: not configured to build any kind of library" 1>&2
- echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit 1
-fi
-
-# Global variables.
-mode=$default_mode
-nonopt=
-prev=
-prevopt=
-run=
-show="$echo"
-show_help=
-execute_dlfiles=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-
-# Parse our command line options once, thoroughly.
-while test $# -gt 0
-do
- arg="$1"
- shift
-
- case $arg in
- -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case $prev in
- execute_dlfiles)
- execute_dlfiles="$execute_dlfiles $arg"
- ;;
- *)
- eval "$prev=\$arg"
- ;;
- esac
-
- prev=
- prevopt=
- continue
- fi
-
- # Have we seen a non-optional argument yet?
- case $arg in
- --help)
- show_help=yes
- ;;
-
- --version)
- echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
- exit 0
- ;;
-
- --config)
- ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
- exit 0
- ;;
-
- --debug)
- echo "$progname: enabling shell trace mode"
- set -x
- ;;
-
- --dry-run | -n)
- run=:
- ;;
-
- --features)
- echo "host: $host"
- if test "$build_libtool_libs" = yes; then
- echo "enable shared libraries"
- else
- echo "disable shared libraries"
- fi
- if test "$build_old_libs" = yes; then
- echo "enable static libraries"
- else
- echo "disable static libraries"
- fi
- exit 0
- ;;
-
- --finish) mode="finish" ;;
-
- --mode) prevopt="--mode" prev=mode ;;
- --mode=*) mode="$optarg" ;;
-
- --preserve-dup-deps) duplicate_deps="yes" ;;
-
- --quiet | --silent)
- show=:
- ;;
-
- -dlopen)
- prevopt="-dlopen"
- prev=execute_dlfiles
- ;;
-
- -*)
- $echo "$modename: unrecognized option \`$arg'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
-
- *)
- nonopt="$arg"
- break
- ;;
- esac
-done
-
-if test -n "$prevopt"; then
- $echo "$modename: option \`$prevopt' requires an argument" 1>&2
- $echo "$help" 1>&2
- exit 1
-fi
-
-# If this variable is set in any of the actions, the command in it
-# will be execed at the end. This prevents here-documents from being
-# left over by shells.
-exec_cmd=
-
-if test -z "$show_help"; then
-
- # Infer the operation mode.
- if test -z "$mode"; then
- case $nonopt in
- *cc | *++ | gcc* | *-gcc* | xlc*)
- mode=link
- for arg
- do
- case $arg in
- -c)
- mode=compile
- break
- ;;
- esac
- done
- ;;
- *db | *dbx | *strace | *truss)
- mode=execute
- ;;
- *install*|cp|mv)
- mode=install
- ;;
- *rm)
- mode=uninstall
- ;;
- *)
- # If we have no mode, but dlfiles were specified, then do execute mode.
- test -n "$execute_dlfiles" && mode=execute
-
- # Just use the default operation mode.
- if test -z "$mode"; then
- if test -n "$nonopt"; then
- $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
- else
- $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
- fi
- fi
- ;;
- esac
- fi
-
- # Only execute mode is allowed to have -dlopen flags.
- if test -n "$execute_dlfiles" && test "$mode" != execute; then
- $echo "$modename: unrecognized option \`-dlopen'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Change the help message to a mode-specific one.
- generic_help="$help"
- help="Try \`$modename --help --mode=$mode' for more information."
-
- # These modes are in order of execution frequency so that they run quickly.
- case $mode in
- # libtool compile mode
- compile)
- modename="$modename: compile"
- # Get the compilation command and the source file.
- base_compile=
- prev=
- lastarg=
- srcfile="$nonopt"
- suppress_output=
-
- user_target=no
- for arg
- do
- case $prev in
- "") ;;
- xcompiler)
- # Aesthetically quote the previous argument.
- prev=
- lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
-
- case $arg in
- # Double-quote args containing other shell metacharacters.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
-
- # Add the previous argument to base_compile.
- if test -z "$base_compile"; then
- base_compile="$lastarg"
- else
- base_compile="$base_compile $lastarg"
- fi
- continue
- ;;
- esac
-
- # Accept any command-line options.
- case $arg in
- -o)
- if test "$user_target" != "no"; then
- $echo "$modename: you cannot specify \`-o' more than once" 1>&2
- exit 1
- fi
- user_target=next
- ;;
-
- -static)
- build_old_libs=yes
- continue
- ;;
-
- -prefer-pic)
- pic_mode=yes
- continue
- ;;
-
- -prefer-non-pic)
- pic_mode=no
- continue
- ;;
-
- -Xcompiler)
- prev=xcompiler
- continue
- ;;
-
- -Wc,*)
- args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
- lastarg=
- save_ifs="$IFS"; IFS=','
- for arg in $args; do
- IFS="$save_ifs"
-
- # Double-quote args containing other shell metacharacters.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- lastarg="$lastarg $arg"
- done
- IFS="$save_ifs"
- lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
-
- # Add the arguments to base_compile.
- if test -z "$base_compile"; then
- base_compile="$lastarg"
- else
- base_compile="$base_compile $lastarg"
- fi
- continue
- ;;
- esac
-
- case $user_target in
- next)
- # The next one is the -o target name
- user_target=yes
- continue
- ;;
- yes)
- # We got the output file
- user_target=set
- libobj="$arg"
- continue
- ;;
- esac
-
- # Accept the current argument as the source file.
- lastarg="$srcfile"
- srcfile="$arg"
-
- # Aesthetically quote the previous argument.
-
- # Backslashify any backslashes, double quotes, and dollar signs.
- # These are the only characters that are still specially
- # interpreted inside of double-quoted scrings.
- lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
-
- # Double-quote args containing other shell metacharacters.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
- case $lastarg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- lastarg="\"$lastarg\""
- ;;
- esac
-
- # Add the previous argument to base_compile.
- if test -z "$base_compile"; then
- base_compile="$lastarg"
- else
- base_compile="$base_compile $lastarg"
- fi
- done
-
- case $user_target in
- set)
- ;;
- no)
- # Get the name of the library object.
- libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
- ;;
- *)
- $echo "$modename: you must specify a target with \`-o'" 1>&2
- exit 1
- ;;
- esac
-
- # Recognize several different file suffixes.
- # If the user specifies -o file.o, it is replaced with file.lo
- xform='[cCFSfmso]'
- case $libobj in
- *.ada) xform=ada ;;
- *.adb) xform=adb ;;
- *.ads) xform=ads ;;
- *.asm) xform=asm ;;
- *.c++) xform=c++ ;;
- *.cc) xform=cc ;;
- *.cpp) xform=cpp ;;
- *.cxx) xform=cxx ;;
- *.f90) xform=f90 ;;
- *.for) xform=for ;;
- esac
-
- libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
-
- case $libobj in
- *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
- *)
- $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
- exit 1
- ;;
- esac
-
- if test -z "$base_compile"; then
- $echo "$modename: you must specify a compilation command" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Delete any leftover library objects.
- if test "$build_old_libs" = yes; then
- removelist="$obj $libobj"
- else
- removelist="$libobj"
- fi
-
- $run $rm $removelist
- trap "$run $rm $removelist; exit 1" 1 2 15
-
- # On Cygwin there's no "real" PIC flag so we must build both object types
- case $host_os in
- cygwin* | mingw* | pw32* | os2*)
- pic_mode=default
- ;;
- esac
- if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
- # non-PIC code in shared libraries is not supported
- pic_mode=default
- fi
-
- # Calculate the filename of the output object if compiler does
- # not support -o with -c
- if test "$compiler_c_o" = no; then
- output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
- lockfile="$output_obj.lock"
- removelist="$removelist $output_obj $lockfile"
- trap "$run $rm $removelist; exit 1" 1 2 15
- else
- need_locks=no
- lockfile=
- fi
-
- # Lock this critical section if it is needed
- # We use this script file to make the link, it avoids creating a new file
- if test "$need_locks" = yes; then
- until $run ln "$0" "$lockfile" 2>/dev/null; do
- $show "Waiting for $lockfile to be removed"
- sleep 2
- done
- elif test "$need_locks" = warn; then
- if test -f "$lockfile"; then
- echo "\
-*** ERROR, $lockfile exists and contains:
-`cat $lockfile 2>/dev/null`
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit 1
- fi
- echo $srcfile > "$lockfile"
- fi
-
- if test -n "$fix_srcfile_path"; then
- eval srcfile=\"$fix_srcfile_path\"
- fi
-
- # Only build a PIC object if we are building libtool libraries.
- if test "$build_libtool_libs" = yes; then
- # Without this assignment, base_compile gets emptied.
- fbsd_hideous_sh_bug=$base_compile
-
- if test "$pic_mode" != no; then
- # All platforms use -DPIC, to notify preprocessed assembler code.
- command="$base_compile $srcfile $pic_flag -DPIC"
- else
- # Don't build PIC code
- command="$base_compile $srcfile"
- fi
- if test "$build_old_libs" = yes; then
- lo_libobj="$libobj"
- dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$dir" = "X$libobj"; then
- dir="$objdir"
- else
- dir="$dir/$objdir"
- fi
- libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
-
- if test -d "$dir"; then
- $show "$rm $libobj"
- $run $rm $libobj
- else
- $show "$mkdir $dir"
- $run $mkdir $dir
- status=$?
- if test $status -ne 0 && test ! -d $dir; then
- exit $status
- fi
- fi
- fi
- if test "$compiler_o_lo" = yes; then
- output_obj="$libobj"
- command="$command -o $output_obj"
- elif test "$compiler_c_o" = yes; then
- output_obj="$obj"
- command="$command -o $output_obj"
- fi
-
- $run $rm "$output_obj"
- $show "$command"
- if $run eval "$command"; then :
- else
- test -n "$output_obj" && $run $rm $removelist
- exit 1
- fi
-
- if test "$need_locks" = warn &&
- test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
- echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit 1
- fi
-
- # Just move the object if needed, then go on to compile the next one
- if test x"$output_obj" != x"$libobj"; then
- $show "$mv $output_obj $libobj"
- if $run $mv $output_obj $libobj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
-
- # If we have no pic_flag, then copy the object into place and finish.
- if (test -z "$pic_flag" || test "$pic_mode" != default) &&
- test "$build_old_libs" = yes; then
- # Rename the .lo from within objdir to obj
- if test -f $obj; then
- $show $rm $obj
- $run $rm $obj
- fi
-
- $show "$mv $libobj $obj"
- if $run $mv $libobj $obj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
-
- xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$obj"; then
- xdir="."
- else
- xdir="$xdir"
- fi
- baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
- libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
- # Now arrange that obj and lo_libobj become the same file
- $show "(cd $xdir && $LN_S $baseobj $libobj)"
- if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
- # Unlock the critical section if it was locked
- if test "$need_locks" != no; then
- $run $rm "$lockfile"
- fi
- exit 0
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
-
- # Allow error messages only from the first compilation.
- suppress_output=' >/dev/null 2>&1'
- fi
-
- # Only build a position-dependent object if we build old libraries.
- if test "$build_old_libs" = yes; then
- if test "$pic_mode" != yes; then
- # Don't build PIC code
- command="$base_compile $srcfile"
- else
- # All platforms use -DPIC, to notify preprocessed assembler code.
- command="$base_compile $srcfile $pic_flag -DPIC"
- fi
- if test "$compiler_c_o" = yes; then
- command="$command -o $obj"
- output_obj="$obj"
- fi
-
- # Suppress compiler output if we already did a PIC compilation.
- command="$command$suppress_output"
- $run $rm "$output_obj"
- $show "$command"
- if $run eval "$command"; then :
- else
- $run $rm $removelist
- exit 1
- fi
-
- if test "$need_locks" = warn &&
- test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
- echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit 1
- fi
-
- # Just move the object if needed
- if test x"$output_obj" != x"$obj"; then
- $show "$mv $output_obj $obj"
- if $run $mv $output_obj $obj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
-
- # Create an invalid libtool object if no PIC, so that we do not
- # accidentally link it into a program.
- if test "$build_libtool_libs" != yes; then
- $show "echo timestamp > $libobj"
- $run eval "echo timestamp > \$libobj" || exit $?
- else
- # Move the .lo from within objdir
- $show "$mv $libobj $lo_libobj"
- if $run $mv $libobj $lo_libobj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
- fi
-
- # Unlock the critical section if it was locked
- if test "$need_locks" != no; then
- $run $rm "$lockfile"
- fi
-
- exit 0
- ;;
-
- # libtool link mode
- link | relink)
- modename="$modename: link"
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- # It is impossible to link a dll without this setting, and
- # we shouldn't force the makefile maintainer to figure out
- # which system we are compiling for in order to pass an extra
- # flag for every libtool invokation.
- # allow_undefined=no
-
- # FIXME: Unfortunately, there are problems with the above when trying
- # to make a dll which has undefined symbols, in which case not
- # even a static library is built. For now, we need to specify
- # -no-undefined on the libtool link line when we can be certain
- # that all symbols are satisfied, otherwise we get a static library.
- allow_undefined=yes
- ;;
- *)
- allow_undefined=yes
- ;;
- esac
- libtool_args="$nonopt"
- compile_command="$nonopt"
- finalize_command="$nonopt"
-
- compile_rpath=
- finalize_rpath=
- compile_shlibpath=
- finalize_shlibpath=
- convenience=
- old_convenience=
- deplibs=
- old_deplibs=
- compiler_flags=
- linker_flags=
- dllsearchpath=
- lib_search_path=`pwd`
-
- avoid_version=no
- dlfiles=
- dlprefiles=
- dlself=no
- export_dynamic=no
- export_symbols=
- export_symbols_regex=
- generated=
- libobjs=
- ltlibs=
- module=no
- no_install=no
- objs=
- prefer_static_libs=no
- preload=no
- prev=
- prevarg=
- release=
- rpath=
- xrpath=
- perm_rpath=
- temp_rpath=
- thread_safe=no
- vinfo=
-
- # We need to know -static, to get the right output filenames.
- for arg
- do
- case $arg in
- -all-static | -static)
- if test "X$arg" = "X-all-static"; then
- if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
- $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
- fi
- if test -n "$link_static_flag"; then
- dlopen_self=$dlopen_self_static
- fi
- else
- if test -z "$pic_flag" && test -n "$link_static_flag"; then
- dlopen_self=$dlopen_self_static
- fi
- fi
- build_libtool_libs=no
- build_old_libs=yes
- prefer_static_libs=yes
- break
- ;;
- esac
- done
-
- # See if our shared archives depend on static archives.
- test -n "$old_archive_from_new_cmds" && build_old_libs=yes
-
- # Go through the arguments, transforming them on the way.
- while test $# -gt 0; do
- arg="$1"
- shift
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
- ;;
- *) qarg=$arg ;;
- esac
- libtool_args="$libtool_args $qarg"
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case $prev in
- output)
- compile_command="$compile_command @OUTPUT@"
- finalize_command="$finalize_command @OUTPUT@"
- ;;
- esac
-
- case $prev in
- dlfiles|dlprefiles)
- if test "$preload" = no; then
- # Add the symbol object into the linking commands.
- compile_command="$compile_command @SYMFILE@"
- finalize_command="$finalize_command @SYMFILE@"
- preload=yes
- fi
- case $arg in
- *.la | *.lo) ;; # We handle these cases below.
- force)
- if test "$dlself" = no; then
- dlself=needless
- export_dynamic=yes
- fi
- prev=
- continue
- ;;
- self)
- if test "$prev" = dlprefiles; then
- dlself=yes
- elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
- dlself=yes
- else
- dlself=needless
- export_dynamic=yes
- fi
- prev=
- continue
- ;;
- *)
- if test "$prev" = dlfiles; then
- dlfiles="$dlfiles $arg"
- else
- dlprefiles="$dlprefiles $arg"
- fi
- prev=
- continue
- ;;
- esac
- ;;
- expsyms)
- export_symbols="$arg"
- if test ! -f "$arg"; then
- $echo "$modename: symbol file \`$arg' does not exist"
- exit 1
- fi
- prev=
- continue
- ;;
- expsyms_regex)
- export_symbols_regex="$arg"
- prev=
- continue
- ;;
- release)
- release="-$arg"
- prev=
- continue
- ;;
- rpath | xrpath)
- # We need an absolute path.
- case $arg in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- $echo "$modename: only absolute run-paths are allowed" 1>&2
- exit 1
- ;;
- esac
- if test "$prev" = rpath; then
- case "$rpath " in
- *" $arg "*) ;;
- *) rpath="$rpath $arg" ;;
- esac
- else
- case "$xrpath " in
- *" $arg "*) ;;
- *) xrpath="$xrpath $arg" ;;
- esac
- fi
- prev=
- continue
- ;;
- xcompiler)
- compiler_flags="$compiler_flags $qarg"
- prev=
- compile_command="$compile_command $qarg"
- finalize_command="$finalize_command $qarg"
- continue
- ;;
- xlinker)
- linker_flags="$linker_flags $qarg"
- compiler_flags="$compiler_flags $wl$qarg"
- prev=
- compile_command="$compile_command $wl$qarg"
- finalize_command="$finalize_command $wl$qarg"
- continue
- ;;
- *)
- eval "$prev=\"\$arg\""
- prev=
- continue
- ;;
- esac
- fi # test -n $prev
-
- prevarg="$arg"
-
- case $arg in
- -all-static)
- if test -n "$link_static_flag"; then
- compile_command="$compile_command $link_static_flag"
- finalize_command="$finalize_command $link_static_flag"
- fi
- continue
- ;;
-
- -allow-undefined)
- # FIXME: remove this flag sometime in the future.
- $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
- continue
- ;;
-
- -avoid-version)
- avoid_version=yes
- continue
- ;;
-
- -dlopen)
- prev=dlfiles
- continue
- ;;
-
- -dlpreopen)
- prev=dlprefiles
- continue
- ;;
-
- -export-dynamic)
- export_dynamic=yes
- continue
- ;;
-
- -export-symbols | -export-symbols-regex)
- if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
- $echo "$modename: more than one -exported-symbols argument is not allowed"
- exit 1
- fi
- if test "X$arg" = "X-export-symbols"; then
- prev=expsyms
- else
- prev=expsyms_regex
- fi
- continue
- ;;
-
- # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
- # so, if we see these flags be careful not to treat them like -L
- -L[A-Z][A-Z]*:*)
- case $with_gcc/$host in
- no/*-*-irix* | no/*-*-nonstopux*)
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- ;;
- esac
- continue
- ;;
-
- -L*)
- dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- absdir=`cd "$dir" && pwd`
- if test -z "$absdir"; then
- $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
- exit 1
- fi
- dir="$absdir"
- ;;
- esac
- case "$deplibs " in
- *" -L$dir "*) ;;
- *)
- deplibs="$deplibs -L$dir"
- lib_search_path="$lib_search_path $dir"
- ;;
- esac
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- case :$dllsearchpath: in
- *":$dir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$dir";;
- esac
- ;;
- esac
- continue
- ;;
-
- -l*)
- if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
- case $host in
- *-*-cygwin* | *-*-pw32* | *-*-beos*)
- # These systems don't actually have a C or math library (as such)
- continue
- ;;
- *-*-mingw* | *-*-os2*)
- # These systems don't actually have a C library (as such)
- test "X$arg" = "X-lc" && continue
- ;;
- *-*-openbsd* | *-*-freebsd*)
- # Do not include libc due to us having libc/libc_r.
- test "X$arg" = "X-lc" && continue
- ;;
- esac
- elif test "X$arg" = "X-lc_r"; then
- case $host in
- *-*-openbsd* | *-*-freebsd*)
- # Do not include libc_r directly, use -pthread flag.
- continue
- ;;
- esac
- fi
- deplibs="$deplibs $arg"
- continue
- ;;
-
- -module)
- module=yes
- continue
- ;;
-
- -no-fast-install)
- fast_install=no
- continue
- ;;
-
- -no-install)
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- # The PATH hackery in wrapper scripts is required on Windows
- # in order for the loader to find any dlls it needs.
- $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
- $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
- fast_install=no
- ;;
- *) no_install=yes ;;
- esac
- continue
- ;;
-
- -no-undefined)
- allow_undefined=no
- continue
- ;;
-
- -o) prev=output ;;
-
- -release)
- prev=release
- continue
- ;;
-
- -rpath)
- prev=rpath
- continue
- ;;
-
- -R)
- prev=xrpath
- continue
- ;;
-
- -R*)
- dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- $echo "$modename: only absolute run-paths are allowed" 1>&2
- exit 1
- ;;
- esac
- case "$xrpath " in
- *" $dir "*) ;;
- *) xrpath="$xrpath $dir" ;;
- esac
- continue
- ;;
-
- -static)
- # The effects of -static are defined in a previous loop.
- # We used to do the same as -all-static on platforms that
- # didn't have a PIC flag, but the assumption that the effects
- # would be equivalent was wrong. It would break on at least
- # Digital Unix and AIX.
- continue
- ;;
-
- -thread-safe)
- thread_safe=yes
- continue
- ;;
-
- -version-info)
- prev=vinfo
- continue
- ;;
-
- -Wc,*)
- args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
- arg=
- save_ifs="$IFS"; IFS=','
- for flag in $args; do
- IFS="$save_ifs"
- case $flag in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- flag="\"$flag\""
- ;;
- esac
- arg="$arg $wl$flag"
- compiler_flags="$compiler_flags $flag"
- done
- IFS="$save_ifs"
- arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
- ;;
-
- -Wl,*)
- args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
- arg=
- save_ifs="$IFS"; IFS=','
- for flag in $args; do
- IFS="$save_ifs"
- case $flag in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- flag="\"$flag\""
- ;;
- esac
- arg="$arg $wl$flag"
- compiler_flags="$compiler_flags $wl$flag"
- linker_flags="$linker_flags $flag"
- done
- IFS="$save_ifs"
- arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
- ;;
-
- -Xcompiler)
- prev=xcompiler
- continue
- ;;
-
- -Xlinker)
- prev=xlinker
- continue
- ;;
-
- # Some other compiler flag.
- -* | +*)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- ;;
-
- *.lo | *.$objext)
- # A library or standard object.
- if test "$prev" = dlfiles; then
- # This file was specified with -dlopen.
- if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
- dlfiles="$dlfiles $arg"
- prev=
- continue
- else
- # If libtool objects are unsupported, then we need to preload.
- prev=dlprefiles
- fi
- fi
-
- if test "$prev" = dlprefiles; then
- # Preload the old-style object.
- dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
- prev=
- else
- case $arg in
- *.lo) libobjs="$libobjs $arg" ;;
- *) objs="$objs $arg" ;;
- esac
- fi
- ;;
-
- *.$libext)
- # An archive.
- deplibs="$deplibs $arg"
- old_deplibs="$old_deplibs $arg"
- continue
- ;;
-
- *.la)
- # A libtool-controlled library.
-
- if test "$prev" = dlfiles; then
- # This library was specified with -dlopen.
- dlfiles="$dlfiles $arg"
- prev=
- elif test "$prev" = dlprefiles; then
- # The library was specified with -dlpreopen.
- dlprefiles="$dlprefiles $arg"
- prev=
- else
- deplibs="$deplibs $arg"
- fi
- continue
- ;;
-
- # Some other compiler argument.
- *)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- ;;
- esac # arg
-
- # Now actually substitute the argument into the commands.
- if test -n "$arg"; then
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- fi
- done # argument parsing loop
-
- if test -n "$prev"; then
- $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
- eval arg=\"$export_dynamic_flag_spec\"
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- fi
-
- # calculate the name of the file, without its directory
- outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
- libobjs_save="$libobjs"
-
- if test -n "$shlibpath_var"; then
- # get the directories listed in $shlibpath_var
- eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
- else
- shlib_search_path=
- fi
- eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
- eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
-
- output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$output_objdir" = "X$output"; then
- output_objdir="$objdir"
- else
- output_objdir="$output_objdir/$objdir"
- fi
- # Create the object directory.
- if test ! -d $output_objdir; then
- $show "$mkdir $output_objdir"
- $run $mkdir $output_objdir
- status=$?
- if test $status -ne 0 && test ! -d $output_objdir; then
- exit $status
- fi
- fi
-
- # Determine the type of output
- case $output in
- "")
- $echo "$modename: you must specify an output file" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
- *.$libext) linkmode=oldlib ;;
- *.lo | *.$objext) linkmode=obj ;;
- *.la) linkmode=lib ;;
- *) linkmode=prog ;; # Anything else should be a program.
- esac
-
- specialdeplibs=
- libs=
- # Find all interdependent deplibs by searching for libraries
- # that are linked more than once (e.g. -la -lb -la)
- for deplib in $deplibs; do
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- libs="$libs $deplib"
- done
- deplibs=
- newdependency_libs=
- newlib_search_path=
- need_relink=no # whether we're linking any uninstalled libtool libraries
- notinst_deplibs= # not-installed libtool libraries
- notinst_path= # paths that contain not-installed libtool libraries
- case $linkmode in
- lib)
- passes="conv link"
- for file in $dlfiles $dlprefiles; do
- case $file in
- *.la) ;;
- *)
- $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
- exit 1
- ;;
- esac
- done
- ;;
- prog)
- compile_deplibs=
- finalize_deplibs=
- alldeplibs=no
- newdlfiles=
- newdlprefiles=
- passes="conv scan dlopen dlpreopen link"
- ;;
- *) passes="conv"
- ;;
- esac
- for pass in $passes; do
- if test $linkmode = prog; then
- # Determine which files to process
- case $pass in
- dlopen)
- libs="$dlfiles"
- save_deplibs="$deplibs" # Collect dlpreopened libraries
- deplibs=
- ;;
- dlpreopen) libs="$dlprefiles" ;;
- link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
- esac
- fi
- for deplib in $libs; do
- lib=
- found=no
- case $deplib in
- -l*)
- if test $linkmode = oldlib && test $linkmode = obj; then
- $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
- continue
- fi
- if test $pass = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
- name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
- for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
- # Search the libtool library
- lib="$searchdir/lib${name}.la"
- if test -f "$lib"; then
- found=yes
- break
- fi
- done
- if test "$found" != yes; then
- # deplib doesn't seem to be a libtool library
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- deplibs="$deplib $deplibs"
- test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
- fi
- continue
- fi
- ;; # -l
- -L*)
- case $linkmode in
- lib)
- deplibs="$deplib $deplibs"
- test $pass = conv && continue
- newdependency_libs="$deplib $newdependency_libs"
- newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
- ;;
- prog)
- if test $pass = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
- if test $pass = scan; then
- deplibs="$deplib $deplibs"
- newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
- else
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- fi
- ;;
- *)
- $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
- ;;
- esac # linkmode
- continue
- ;; # -L
- -R*)
- if test $pass = link; then
- dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
- # Make sure the xrpath contains only unique directories.
- case "$xrpath " in
- *" $dir "*) ;;
- *) xrpath="$xrpath $dir" ;;
- esac
- fi
- deplibs="$deplib $deplibs"
- continue
- ;;
- *.la) lib="$deplib" ;;
- *.$libext)
- if test $pass = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
- case $linkmode in
- lib)
- if test "$deplibs_check_method" != pass_all; then
- echo
- echo "*** Warning: Trying to link with static lib archive $deplib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have"
- echo "*** because the file extensions .$libext of this argument makes me believe"
- echo "*** that it is just a static archive that I should not used here."
- else
- echo
- echo "*** Warning: Linking the shared library $output against the"
- echo "*** static library $deplib is not portable!"
- deplibs="$deplib $deplibs"
- fi
- continue
- ;;
- prog)
- if test $pass != link; then
- deplibs="$deplib $deplibs"
- else
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- fi
- continue
- ;;
- esac # linkmode
- ;; # *.$libext
- *.lo | *.$objext)
- if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
- # If there is no dlopen support or we're linking statically,
- # we need to preload.
- newdlprefiles="$newdlprefiles $deplib"
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- newdlfiles="$newdlfiles $deplib"
- fi
- continue
- ;;
- %DEPLIBS%)
- alldeplibs=yes
- continue
- ;;
- esac # case $deplib
- if test $found = yes || test -f "$lib"; then :
- else
- $echo "$modename: cannot find the library \`$lib'" 1>&2
- exit 1
- fi
-
- # Check to see that this really is a libtool archive.
- if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- exit 1
- fi
-
- ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$ladir" = "X$lib" && ladir="."
-
- dlname=
- dlopen=
- dlpreopen=
- libdir=
- library_names=
- old_library=
- # If the library was installed with an old release of libtool,
- # it will not redefine variable installed.
- installed=yes
-
- # Read the .la file
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
-
- if test "$linkmode,$pass" = "lib,link" ||
- test "$linkmode,$pass" = "prog,scan" ||
- { test $linkmode = oldlib && test $linkmode = obj; }; then
- # Add dl[pre]opened files of deplib
- test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
- test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
- fi
-
- if test $pass = conv; then
- # Only check for convenience libraries
- deplibs="$lib $deplibs"
- if test -z "$libdir"; then
- if test -z "$old_library"; then
- $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
- exit 1
- fi
- # It is a libtool convenience library, so add in its objects.
- convenience="$convenience $ladir/$objdir/$old_library"
- old_convenience="$old_convenience $ladir/$objdir/$old_library"
- tmp_libs=
- for deplib in $dependency_libs; do
- deplibs="$deplib $deplibs"
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done
- elif test $linkmode != prog && test $linkmode != lib; then
- $echo "$modename: \`$lib' is not a convenience library" 1>&2
- exit 1
- fi
- continue
- fi # $pass = conv
-
- # Get the name of the library we link against.
- linklib=
- for l in $old_library $library_names; do
- linklib="$l"
- done
- if test -z "$linklib"; then
- $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
- exit 1
- fi
-
- # This library was specified with -dlopen.
- if test $pass = dlopen; then
- if test -z "$libdir"; then
- $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
- exit 1
- fi
- if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
- # If there is no dlname, no dlopen support or we're linking
- # statically, we need to preload.
- dlprefiles="$dlprefiles $lib"
- else
- newdlfiles="$newdlfiles $lib"
- fi
- continue
- fi # $pass = dlopen
-
- # We need an absolute path.
- case $ladir in
- [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
- *)
- abs_ladir=`cd "$ladir" && pwd`
- if test -z "$abs_ladir"; then
- $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
- $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
- abs_ladir="$ladir"
- fi
- ;;
- esac
- laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
-
- # Find the relevant object directory and library name.
- if test "X$installed" = Xyes; then
- if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
- $echo "$modename: warning: library \`$lib' was moved." 1>&2
- dir="$ladir"
- absdir="$abs_ladir"
- libdir="$abs_ladir"
- else
- dir="$libdir"
- absdir="$libdir"
- fi
- else
- dir="$ladir/$objdir"
- absdir="$abs_ladir/$objdir"
- # Remove this search path later
- notinst_path="$notinst_path $abs_ladir"
- fi # $installed = yes
- name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
-
- # This library was specified with -dlpreopen.
- if test $pass = dlpreopen; then
- if test -z "$libdir"; then
- $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
- exit 1
- fi
- # Prefer using a static library (so that no silly _DYNAMIC symbols
- # are required to link).
- if test -n "$old_library"; then
- newdlprefiles="$newdlprefiles $dir/$old_library"
- # Otherwise, use the dlname, so that lt_dlopen finds it.
- elif test -n "$dlname"; then
- newdlprefiles="$newdlprefiles $dir/$dlname"
- else
- newdlprefiles="$newdlprefiles $dir/$linklib"
- fi
- fi # $pass = dlpreopen
-
- if test -z "$libdir"; then
- # Link the convenience library
- if test $linkmode = lib; then
- deplibs="$dir/$old_library $deplibs"
- elif test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$dir/$old_library $compile_deplibs"
- finalize_deplibs="$dir/$old_library $finalize_deplibs"
- else
- deplibs="$lib $deplibs"
- fi
- continue
- fi
-
- if test $linkmode = prog && test $pass != link; then
- newlib_search_path="$newlib_search_path $ladir"
- deplibs="$lib $deplibs"
-
- linkalldeplibs=no
- if test "$link_all_deplibs" != no || test -z "$library_names" ||
- test "$build_libtool_libs" = no; then
- linkalldeplibs=yes
- fi
-
- tmp_libs=
- for deplib in $dependency_libs; do
- case $deplib in
- -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
- esac
- # Need to link against all dependency_libs?
- if test $linkalldeplibs = yes; then
- deplibs="$deplib $deplibs"
- else
- # Need to hardcode shared library paths
- # or/and link against static libraries
- newdependency_libs="$deplib $newdependency_libs"
- fi
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done # for deplib
- continue
- fi # $linkmode = prog...
-
- link_static=no # Whether the deplib will be linked statically
- if test -n "$library_names" &&
- { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
- # Link against this shared library
-
- if test "$linkmode,$pass" = "prog,link" ||
- { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
- # Hardcode the library path.
- # Skip directories that are in the system default run-time
- # search path.
- case " $sys_lib_dlsearch_path " in
- *" $absdir "*) ;;
- *)
- case "$compile_rpath " in
- *" $absdir "*) ;;
- *) compile_rpath="$compile_rpath $absdir"
- esac
- ;;
- esac
- case " $sys_lib_dlsearch_path " in
- *" $libdir "*) ;;
- *)
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir"
- esac
- ;;
- esac
- if test $linkmode = prog; then
- # We need to hardcode the library path
- if test -n "$shlibpath_var"; then
- # Make sure the rpath contains only unique directories.
- case "$temp_rpath " in
- *" $dir "*) ;;
- *" $absdir "*) ;;
- *) temp_rpath="$temp_rpath $dir" ;;
- esac
- fi
- fi
- fi # $linkmode,$pass = prog,link...
-
- if test "$alldeplibs" = yes &&
- { test "$deplibs_check_method" = pass_all ||
- { test "$build_libtool_libs" = yes &&
- test -n "$library_names"; }; }; then
- # We only need to search for static libraries
- continue
- fi
-
- if test "$installed" = no; then
- notinst_deplibs="$notinst_deplibs $lib"
- need_relink=yes
- fi
-
- if test -n "$old_archive_from_expsyms_cmds"; then
- # figure out the soname
- set dummy $library_names
- realname="$2"
- shift; shift
- libname=`eval \\$echo \"$libname_spec\"`
- # use dlname if we got it. it's perfectly good, no?
- if test -n "$dlname"; then
- soname="$dlname"
- elif test -n "$soname_spec"; then
- # bleh windows
- case $host in
- *cygwin*)
- major=`expr $current - $age`
- versuffix="-$major"
- ;;
- esac
- eval soname=\"$soname_spec\"
- else
- soname="$realname"
- fi
-
- # Make a new name for the extract_expsyms_cmds to use
- soroot="$soname"
- soname=`echo $soroot | ${SED} -e 's/^.*\///'`
- newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
-
- # If the library has no export list, then create one now
- if test -f "$output_objdir/$soname-def"; then :
- else
- $show "extracting exported symbol list from \`$soname'"
- save_ifs="$IFS"; IFS='~'
- eval cmds=\"$extract_expsyms_cmds\"
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- # Create $newlib
- if test -f "$output_objdir/$newlib"; then :; else
- $show "generating import library for \`$soname'"
- save_ifs="$IFS"; IFS='~'
- eval cmds=\"$old_archive_from_expsyms_cmds\"
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
- # make sure the library variables are pointing to the new library
- dir=$output_objdir
- linklib=$newlib
- fi # test -n $old_archive_from_expsyms_cmds
-
- if test $linkmode = prog || test "$mode" != relink; then
- add_shlibpath=
- add_dir=
- add=
- lib_linked=yes
- case $hardcode_action in
- immediate | unsupported)
- if test "$hardcode_direct" = no; then
- add="$dir/$linklib"
- elif test "$hardcode_minus_L" = no; then
- case $host in
- *-*-sunos*) add_shlibpath="$dir" ;;
- esac
- add_dir="-L$dir"
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = no; then
- add_shlibpath="$dir"
- add="-l$name"
- else
- lib_linked=no
- fi
- ;;
- relink)
- if test "$hardcode_direct" = yes; then
- add="$dir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- add_dir="-L$dir"
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- add_shlibpath="$dir"
- add="-l$name"
- else
- lib_linked=no
- fi
- ;;
- *) lib_linked=no ;;
- esac
-
- if test "$lib_linked" != yes; then
- $echo "$modename: configuration error: unsupported hardcode properties"
- exit 1
- fi
-
- if test -n "$add_shlibpath"; then
- case :$compile_shlibpath: in
- *":$add_shlibpath:"*) ;;
- *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
- esac
- fi
- if test $linkmode = prog; then
- test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
- test -n "$add" && compile_deplibs="$add $compile_deplibs"
- else
- test -n "$add_dir" && deplibs="$add_dir $deplibs"
- test -n "$add" && deplibs="$add $deplibs"
- if test "$hardcode_direct" != yes && \
- test "$hardcode_minus_L" != yes && \
- test "$hardcode_shlibpath_var" = yes; then
- case :$finalize_shlibpath: in
- *":$libdir:"*) ;;
- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
- esac
- fi
- fi
- fi
-
- if test $linkmode = prog || test "$mode" = relink; then
- add_shlibpath=
- add_dir=
- add=
- # Finalize command for both is simple: just hardcode it.
- if test "$hardcode_direct" = yes; then
- add="$libdir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- add_dir="-L$libdir"
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- case :$finalize_shlibpath: in
- *":$libdir:"*) ;;
- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
- esac
- add="-l$name"
- else
- # We cannot seem to hardcode it, guess we'll fake it.
- add_dir="-L$libdir"
- add="-l$name"
- fi
-
- if test $linkmode = prog; then
- test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
- test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
- else
- test -n "$add_dir" && deplibs="$add_dir $deplibs"
- test -n "$add" && deplibs="$add $deplibs"
- fi
- fi
- elif test $linkmode = prog; then
- if test "$alldeplibs" = yes &&
- { test "$deplibs_check_method" = pass_all ||
- { test "$build_libtool_libs" = yes &&
- test -n "$library_names"; }; }; then
- # We only need to search for static libraries
- continue
- fi
-
- # Try to link the static library
- # Here we assume that one of hardcode_direct or hardcode_minus_L
- # is not unsupported. This is valid on all known static and
- # shared platforms.
- if test "$hardcode_direct" != unsupported; then
- test -n "$old_library" && linklib="$old_library"
- compile_deplibs="$dir/$linklib $compile_deplibs"
- finalize_deplibs="$dir/$linklib $finalize_deplibs"
- else
- compile_deplibs="-l$name -L$dir $compile_deplibs"
- finalize_deplibs="-l$name -L$dir $finalize_deplibs"
- fi
- elif test "$build_libtool_libs" = yes; then
- # Not a shared library
- if test "$deplibs_check_method" != pass_all; then
- # We're trying link a shared library against a static one
- # but the system doesn't support it.
-
- # Just print a warning and add the library to dependency_libs so
- # that the program can be linked against the static library.
- echo
- echo "*** Warning: This system can not link to static lib archive $lib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have."
- if test "$module" = yes; then
- echo "*** But as you try to build a module library, libtool will still create "
- echo "*** a static module, that should work as long as the dlopening application"
- echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
- if test -z "$global_symbol_pipe"; then
- echo
- echo "*** However, this would only work if libtool was able to extract symbol"
- echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
- echo "*** not find such a program. So, this module is probably useless."
- echo "*** \`nm' from GNU binutils and a full rebuild may help."
- fi
- if test "$build_old_libs" = no; then
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- fi
- else
- convenience="$convenience $dir/$old_library"
- old_convenience="$old_convenience $dir/$old_library"
- deplibs="$dir/$old_library $deplibs"
- link_static=yes
- fi
- fi # link shared/static library?
-
- if test $linkmode = lib; then
- if test -n "$dependency_libs" &&
- { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
- test $link_static = yes; }; then
- # Extract -R from dependency_libs
- temp_deplibs=
- for libdir in $dependency_libs; do
- case $libdir in
- -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
- case " $xrpath " in
- *" $temp_xrpath "*) ;;
- *) xrpath="$xrpath $temp_xrpath";;
- esac;;
- *) temp_deplibs="$temp_deplibs $libdir";;
- esac
- done
- dependency_libs="$temp_deplibs"
- fi
-
- newlib_search_path="$newlib_search_path $absdir"
- # Link against this library
- test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
- # ... and its dependency_libs
- tmp_libs=
- for deplib in $dependency_libs; do
- newdependency_libs="$deplib $newdependency_libs"
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done
-
- if test $link_all_deplibs != no; then
- # Add the search paths of all dependency libraries
- for deplib in $dependency_libs; do
- case $deplib in
- -L*) path="$deplib" ;;
- *.la)
- dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$deplib" && dir="."
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
- *)
- absdir=`cd "$dir" && pwd`
- if test -z "$absdir"; then
- $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
- absdir="$dir"
- fi
- ;;
- esac
- if grep "^installed=no" $deplib > /dev/null; then
- path="-L$absdir/$objdir"
- else
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
- if test -z "$libdir"; then
- $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
- exit 1
- fi
- if test "$absdir" != "$libdir"; then
- $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
- fi
- path="-L$absdir"
- fi
- ;;
- *) continue ;;
- esac
- case " $deplibs " in
- *" $path "*) ;;
- *) deplibs="$deplibs $path" ;;
- esac
- done
- fi # link_all_deplibs != no
- fi # linkmode = lib
- done # for deplib in $libs
- if test $pass = dlpreopen; then
- # Link the dlpreopened libraries before other libraries
- for deplib in $save_deplibs; do
- deplibs="$deplib $deplibs"
- done
- fi
- if test $pass != dlopen; then
- test $pass != scan && dependency_libs="$newdependency_libs"
- if test $pass != conv; then
- # Make sure lib_search_path contains only unique directories.
- lib_search_path=
- for dir in $newlib_search_path; do
- case "$lib_search_path " in
- *" $dir "*) ;;
- *) lib_search_path="$lib_search_path $dir" ;;
- esac
- done
- newlib_search_path=
- fi
-
- if test "$linkmode,$pass" != "prog,link"; then
- vars="deplibs"
- else
- vars="compile_deplibs finalize_deplibs"
- fi
- for var in $vars dependency_libs; do
- # Add libraries to $var in reverse order
- eval tmp_libs=\"\$$var\"
- new_libs=
- for deplib in $tmp_libs; do
- case $deplib in
- -L*) new_libs="$deplib $new_libs" ;;
- *)
- case " $specialdeplibs " in
- *" $deplib "*) new_libs="$deplib $new_libs" ;;
- *)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$deplib $new_libs" ;;
- esac
- ;;
- esac
- ;;
- esac
- done
- tmp_libs=
- for deplib in $new_libs; do
- case $deplib in
- -L*)
- case " $tmp_libs " in
- *" $deplib "*) ;;
- *) tmp_libs="$tmp_libs $deplib" ;;
- esac
- ;;
- *) tmp_libs="$tmp_libs $deplib" ;;
- esac
- done
- eval $var=\"$tmp_libs\"
- done # for var
- fi
- if test "$pass" = "conv" &&
- { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
- libs="$deplibs" # reset libs
- deplibs=
- fi
- done # for pass
- if test $linkmode = prog; then
- dlfiles="$newdlfiles"
- dlprefiles="$newdlprefiles"
- fi
-
- case $linkmode in
- oldlib)
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
- fi
-
- if test -n "$rpath"; then
- $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
- fi
-
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
- fi
-
- if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
- $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
- fi
-
- # Now set the variables for building old libraries.
- build_libtool_libs=no
- oldlibs="$output"
- objs="$objs$old_deplibs"
- ;;
-
- lib)
- # Make sure we only generate libraries of the form `libNAME.la'.
- case $outputname in
- lib*)
- name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
- eval libname=\"$libname_spec\"
- ;;
- *)
- if test "$module" = no; then
- $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
- if test "$need_lib_prefix" != no; then
- # Add the "lib" prefix for modules if required
- name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
- eval libname=\"$libname_spec\"
- else
- libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
- fi
- ;;
- esac
-
- if test -n "$objs"; then
- if test "$deplibs_check_method" != pass_all; then
- $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
- exit 1
- else
- echo
- echo "*** Warning: Linking the shared library $output against the non-libtool"
- echo "*** objects $objs is not portable!"
- libobjs="$libobjs $objs"
- fi
- fi
-
- if test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
- fi
-
- set dummy $rpath
- if test $# -gt 2; then
- $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
- fi
- install_libdir="$2"
-
- oldlibs=
- if test -z "$rpath"; then
- if test "$build_libtool_libs" = yes; then
- # Building a libtool convenience library.
- libext=al
- oldlibs="$output_objdir/$libname.$libext $oldlibs"
- build_libtool_libs=convenience
- build_old_libs=yes
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
- fi
- else
-
- # Parse the version information argument.
- save_ifs="$IFS"; IFS=':'
- set dummy $vinfo 0 0 0
- IFS="$save_ifs"
-
- if test -n "$8"; then
- $echo "$modename: too many parameters to \`-version-info'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- current="$2"
- revision="$3"
- age="$4"
-
- # Check that each of the things are valid numbers.
- case $current in
- 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
- *)
- $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- case $revision in
- 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
- *)
- $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- case $age in
- 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
- *)
- $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- if test $age -gt $current; then
- $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit 1
- fi
-
- # Calculate the version variables.
- major=
- versuffix=
- verstring=
- case $version_type in
- none) ;;
-
- darwin)
- # Like Linux, but with the current version available in
- # verstring for coding it into the library header
- major=.`expr $current - $age`
- versuffix="$major.$age.$revision"
- # Darwin ld doesn't like 0 for these options...
- minor_current=`expr $current + 1`
- verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
- ;;
-
- freebsd-aout)
- major=".$current"
- versuffix=".$current.$revision";
- ;;
-
- freebsd-elf)
- major=".$current"
- versuffix=".$current";
- ;;
-
- irix | nonstopux)
- major=`expr $current - $age + 1`
-
- case $version_type in
- nonstopux) verstring_prefix=nonstopux ;;
- *) verstring_prefix=sgi ;;
- esac
- verstring="$verstring_prefix$major.$revision"
-
- # Add in all the interfaces that we are compatible with.
- loop=$revision
- while test $loop != 0; do
- iface=`expr $revision - $loop`
- loop=`expr $loop - 1`
- verstring="$verstring_prefix$major.$iface:$verstring"
- done
-
- # Before this point, $major must not contain `.'.
- major=.$major
- versuffix="$major.$revision"
- ;;
-
- linux)
- major=.`expr $current - $age`
- versuffix="$major.$age.$revision"
- ;;
-
- osf)
- major=.`expr $current - $age`
- versuffix=".$current.$age.$revision"
- verstring="$current.$age.$revision"
-
- # Add in all the interfaces that we are compatible with.
- loop=$age
- while test $loop != 0; do
- iface=`expr $current - $loop`
- loop=`expr $loop - 1`
- verstring="$verstring:${iface}.0"
- done
-
- # Make executables depend on our current version.
- verstring="$verstring:${current}.0"
- ;;
-
- sunos)
- major=".$current"
- versuffix=".$current.$revision"
- ;;
-
- windows)
- # Use '-' rather than '.', since we only want one
- # extension on DOS 8.3 filesystems.
- major=`expr $current - $age`
- versuffix="-$major"
- ;;
-
- *)
- $echo "$modename: unknown library version type \`$version_type'" 1>&2
- echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit 1
- ;;
- esac
-
- # Clear the version info if we defaulted, and they specified a release.
- if test -z "$vinfo" && test -n "$release"; then
- major=
- verstring="0.0"
- case $version_type in
- darwin)
- # we can't check for "0.0" in archive_cmds due to quoting
- # problems, so we reset it completely
- verstring=""
- ;;
- *)
- verstring="0.0"
- ;;
- esac
- if test "$need_version" = no; then
- versuffix=
- else
- versuffix=".0.0"
- fi
- fi
-
- # Remove version info from name if versioning should be avoided
- if test "$avoid_version" = yes && test "$need_version" = no; then
- major=
- versuffix=
- verstring=""
- fi
-
- # Check to see if the archive will have undefined symbols.
- if test "$allow_undefined" = yes; then
- if test "$allow_undefined_flag" = unsupported; then
- $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
- build_libtool_libs=no
- build_old_libs=yes
- fi
- else
- # Don't allow undefined symbols.
- allow_undefined_flag="$no_undefined_flag"
- fi
- fi
-
- if test "$mode" != relink; then
- # Remove our outputs.
- $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
- $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
- fi
-
- # Now set the variables for building old libraries.
- if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
- oldlibs="$oldlibs $output_objdir/$libname.$libext"
-
- # Transform .lo files to .o files.
- oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
- fi
-
- # Eliminate all temporary directories.
- for path in $notinst_path; do
- lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
- deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
- dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
- done
-
- if test -n "$xrpath"; then
- # If the user specified any rpath flags, then add them.
- temp_xrpath=
- for libdir in $xrpath; do
- temp_xrpath="$temp_xrpath -R$libdir"
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir" ;;
- esac
- done
- if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
- dependency_libs="$temp_xrpath $dependency_libs"
- fi
- fi
-
- # Make sure dlfiles contains only unique files that won't be dlpreopened
- old_dlfiles="$dlfiles"
- dlfiles=
- for lib in $old_dlfiles; do
- case " $dlprefiles $dlfiles " in
- *" $lib "*) ;;
- *) dlfiles="$dlfiles $lib" ;;
- esac
- done
-
- # Make sure dlprefiles contains only unique files
- old_dlprefiles="$dlprefiles"
- dlprefiles=
- for lib in $old_dlprefiles; do
- case "$dlprefiles " in
- *" $lib "*) ;;
- *) dlprefiles="$dlprefiles $lib" ;;
- esac
- done
-
- if test "$build_libtool_libs" = yes; then
- if test -n "$rpath"; then
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
- # these systems don't actually have a c library (as such)!
- ;;
- *-*-rhapsody* | *-*-darwin1.[012])
- # Rhapsody C library is in the System framework
- deplibs="$deplibs -framework System"
- ;;
- *-*-netbsd*)
- # Don't link with libc until the a.out ld.so is fixed.
- ;;
- *-*-openbsd* | *-*-freebsd*)
- # Do not include libc due to us having libc/libc_r.
- ;;
- *)
- # Add libc to deplibs on all other systems if necessary.
- if test $build_libtool_need_lc = "yes"; then
- deplibs="$deplibs -lc"
- fi
- ;;
- esac
- fi
-
- # Transform deplibs into only deplibs that can be linked in shared.
- name_save=$name
- libname_save=$libname
- release_save=$release
- versuffix_save=$versuffix
- major_save=$major
- # I'm not sure if I'm treating the release correctly. I think
- # release should show up in the -l (ie -lgmp5) so we don't want to
- # add it in twice. Is that correct?
- release=""
- versuffix=""
- major=""
- newdeplibs=
- droppeddeps=no
- case $deplibs_check_method in
- pass_all)
- # Don't check for shared/static. Everything works.
- # This might be a little naive. We might want to check
- # whether the library exists or not. But this is on
- # osf3 & osf4 and I'm not really sure... Just
- # implementing what was already the behaviour.
- newdeplibs=$deplibs
- ;;
- test_compile)
- # This code stresses the "libraries are programs" paradigm to its
- # limits. Maybe even breaks it. We compile a program, linking it
- # against the deplibs as a proxy for the library. Then we can check
- # whether they linked in statically or dynamically with ldd.
- $rm conftest.c
- cat > conftest.c <<EOF
- int main() { return 0; }
-EOF
- $rm conftest
- $CC -o conftest conftest.c $deplibs
- if test $? -eq 0 ; then
- ldd_output=`ldd conftest`
- for i in $deplibs; do
- name="`expr $i : '-l\(.*\)'`"
- # If $name is empty we are operating on a -L argument.
- if test -n "$name" && test "$name" != "0"; then
- libname=`eval \\$echo \"$libname_spec\"`
- deplib_matches=`eval \\$echo \"$library_names_spec\"`
- set dummy $deplib_matches
- deplib_match=$2
- if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- newdeplibs="$newdeplibs $i"
- else
- droppeddeps=yes
- echo
- echo "*** Warning: dynamic linker does not accept needed library $i."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which I believe you do not have"
- echo "*** because a test_compile did reveal that the linker did not use it for"
- echo "*** its dynamic dependency list that programs get resolved with at runtime."
- fi
- else
- newdeplibs="$newdeplibs $i"
- fi
- done
- else
- # Error occured in the first compile. Let's try to salvage
- # the situation: Compile a separate program for each library.
- for i in $deplibs; do
- name="`expr $i : '-l\(.*\)'`"
- # If $name is empty we are operating on a -L argument.
- if test -n "$name" && test "$name" != "0"; then
- $rm conftest
- $CC -o conftest conftest.c $i
- # Did it work?
- if test $? -eq 0 ; then
- ldd_output=`ldd conftest`
- libname=`eval \\$echo \"$libname_spec\"`
- deplib_matches=`eval \\$echo \"$library_names_spec\"`
- set dummy $deplib_matches
- deplib_match=$2
- if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- newdeplibs="$newdeplibs $i"
- else
- droppeddeps=yes
- echo
- echo "*** Warning: dynamic linker does not accept needed library $i."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have"
- echo "*** because a test_compile did reveal that the linker did not use this one"
- echo "*** as a dynamic dependency that programs can get resolved with at runtime."
- fi
- else
- droppeddeps=yes
- echo
- echo "*** Warning! Library $i is needed by this library but I was not able to"
- echo "*** make it link in! You will probably need to install it or some"
- echo "*** library that it depends on before this library will be fully"
- echo "*** functional. Installing it before continuing would be even better."
- fi
- else
- newdeplibs="$newdeplibs $i"
- fi
- done
- fi
- ;;
- file_magic*)
- set dummy $deplibs_check_method
- file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
- for a_deplib in $deplibs; do
- name="`expr $a_deplib : '-l\(.*\)'`"
- # If $name is empty we are operating on a -L argument.
- if test -n "$name" && test "$name" != "0"; then
- libname=`eval \\$echo \"$libname_spec\"`
- for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
- potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
- for potent_lib in $potential_libs; do
- # Follow soft links.
- if ls -lLd "$potent_lib" 2>/dev/null \
- | grep " -> " >/dev/null; then
- continue
- fi
- # The statement above tries to avoid entering an
- # endless loop below, in case of cyclic links.
- # We might still enter an endless loop, since a link
- # loop can be closed while we follow links,
- # but so what?
- potlib="$potent_lib"
- while test -h "$potlib" 2>/dev/null; do
- potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
- case $potliblink in
- [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
- *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
- esac
- done
- if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
- | ${SED} 10q \
- | egrep "$file_magic_regex" > /dev/null; then
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- break 2
- fi
- done
- done
- if test -n "$a_deplib" ; then
- droppeddeps=yes
- echo
- echo "*** Warning: linker path does not have real file for library $a_deplib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have"
- echo "*** because I did check the linker path looking for a file starting"
- if test -z "$potlib" ; then
- echo "*** with $libname but no candidates were found. (...for file magic test)"
- else
- echo "*** with $libname and none of the candidates passed a file format test"
- echo "*** using a file magic. Last file checked: $potlib"
- fi
- fi
- else
- # Add a -L argument.
- newdeplibs="$newdeplibs $a_deplib"
- fi
- done # Gone through all deplibs.
- ;;
- match_pattern*)
- set dummy $deplibs_check_method
- match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
- for a_deplib in $deplibs; do
- name="`expr $a_deplib : '-l\(.*\)'`"
- # If $name is empty we are operating on a -L argument.
- if test -n "$name" && test "$name" != "0"; then
- libname=`eval \\$echo \"$libname_spec\"`
- for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
- potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
- for potent_lib in $potential_libs; do
- potlib="$potent_lib" # see symlink-check below in file_magic test
- if eval echo \"$potent_lib\" 2>/dev/null \
- | ${SED} 10q \
- | egrep "$match_pattern_regex" > /dev/null; then
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- break 2
- fi
- done
- done
- if test -n "$a_deplib" ; then
- droppeddeps=yes
- echo
- echo "*** Warning: linker path does not have real file for library $a_deplib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have"
- echo "*** because I did check the linker path looking for a file starting"
- if test -z "$potlib" ; then
- echo "*** with $libname but no candidates were found. (...for regex pattern test)"
- else
- echo "*** with $libname and none of the candidates passed a file format test"
- echo "*** using a regex pattern. Last file checked: $potlib"
- fi
- fi
- else
- # Add a -L argument.
- newdeplibs="$newdeplibs $a_deplib"
- fi
- done # Gone through all deplibs.
- ;;
- none | unknown | *)
- newdeplibs=""
- if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
- -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
- grep . >/dev/null; then
- echo
- if test "X$deplibs_check_method" = "Xnone"; then
- echo "*** Warning: inter-library dependencies are not supported in this platform."
- else
- echo "*** Warning: inter-library dependencies are not known to be supported."
- fi
- echo "*** All declared inter-library dependencies are being dropped."
- droppeddeps=yes
- fi
- ;;
- esac
- versuffix=$versuffix_save
- major=$major_save
- release=$release_save
- libname=$libname_save
- name=$name_save
-
- case $host in
- *-*-rhapsody* | *-*-darwin1.[012])
- # On Rhapsody replace the C library is the System framework
- newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
- ;;
- esac
-
- if test "$droppeddeps" = yes; then
- if test "$module" = yes; then
- echo
- echo "*** Warning: libtool could not satisfy all declared inter-library"
- echo "*** dependencies of module $libname. Therefore, libtool will create"
- echo "*** a static module, that should work as long as the dlopening"
- echo "*** application is linked with the -dlopen flag."
- if test -z "$global_symbol_pipe"; then
- echo
- echo "*** However, this would only work if libtool was able to extract symbol"
- echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
- echo "*** not find such a program. So, this module is probably useless."
- echo "*** \`nm' from GNU binutils and a full rebuild may help."
- fi
- if test "$build_old_libs" = no; then
- oldlibs="$output_objdir/$libname.$libext"
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- else
- echo "*** The inter-library dependencies that have been dropped here will be"
- echo "*** automatically added whenever a program is linked with this library"
- echo "*** or is declared to -dlopen it."
-
- if test $allow_undefined = no; then
- echo
- echo "*** Since this library must not contain undefined symbols,"
- echo "*** because either the platform does not support them or"
- echo "*** it was explicitly requested with -no-undefined,"
- echo "*** libtool will only create a static version of it."
- if test "$build_old_libs" = no; then
- oldlibs="$output_objdir/$libname.$libext"
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- fi
- fi
- fi
- # Done checking deplibs!
- deplibs=$newdeplibs
- fi
-
- # All the library-specific variables (install_libdir is set above).
- library_names=
- old_library=
- dlname=
-
- # Test again, we may have decided not to build it any more
- if test "$build_libtool_libs" = yes; then
- if test $hardcode_into_libs = yes; then
- # Hardcode the library paths
- hardcode_libdirs=
- dep_rpath=
- rpath="$finalize_rpath"
- test "$mode" != relink && rpath="$compile_rpath$rpath"
- for libdir in $rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- dep_rpath="$dep_rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval dep_rpath=\"$hardcode_libdir_flag_spec\"
- fi
- if test -n "$runpath_var" && test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
- fi
- test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
- fi
-
- shlibpath="$finalize_shlibpath"
- test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
- if test -n "$shlibpath"; then
- eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
- fi
-
- # Get the real and link names of the library.
- eval library_names=\"$library_names_spec\"
- set dummy $library_names
- realname="$2"
- shift; shift
-
- if test -n "$soname_spec"; then
- eval soname=\"$soname_spec\"
- else
- soname="$realname"
- fi
- test -z "$dlname" && dlname=$soname
-
- lib="$output_objdir/$realname"
- for link
- do
- linknames="$linknames $link"
- done
-
- # Ensure that we have .o objects for linkers which dislike .lo
- # (e.g. aix) in case we are running --disable-static
- for obj in $libobjs; do
- xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$obj"; then
- xdir="."
- else
- xdir="$xdir"
- fi
- baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
- oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
- if test ! -f $xdir/$oldobj; then
- $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
- $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
- fi
- done
-
- # Use standard objects if they are pic
- test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-
- # Prepare the list of exported symbols
- if test -z "$export_symbols"; then
- if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
- $show "generating symbol list for \`$libname.la'"
- export_symbols="$output_objdir/$libname.exp"
- $run $rm $export_symbols
- eval cmds=\"$export_symbols_cmds\"
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- if test -n "$export_symbols_regex"; then
- $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
- $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
- $show "$mv \"${export_symbols}T\" \"$export_symbols\""
- $run eval '$mv "${export_symbols}T" "$export_symbols"'
- fi
- fi
- fi
-
- if test -n "$export_symbols" && test -n "$include_expsyms"; then
- $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
- fi
-
- if test -n "$convenience"; then
- if test -n "$whole_archive_flag_spec"; then
- eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
- else
- gentop="$output_objdir/${outputname}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "mkdir $gentop"
- $run mkdir "$gentop"
- status=$?
- if test $status -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
- generated="$generated $gentop"
-
- for xlib in $convenience; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "mkdir $xdir"
- $run mkdir "$xdir"
- status=$?
- if test $status -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
-
- libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
- done
- fi
- fi
-
- if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
- eval flag=\"$thread_safe_flag_spec\"
- linker_flags="$linker_flags $flag"
- fi
-
- # Make a backup of the uninstalled library when relinking
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
- fi
-
- # Do each of the archive commands.
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- eval cmds=\"$archive_expsym_cmds\"
- else
- save_deplibs="$deplibs"
- for conv in $convenience; do
- tmp_deplibs=
- for test_deplib in $deplibs; do
- if test "$test_deplib" != "$conv"; then
- tmp_deplibs="$tmp_deplibs $test_deplib"
- fi
- done
- deplibs="$tmp_deplibs"
- done
- eval cmds=\"$archive_cmds\"
- deplibs="$save_deplibs"
- fi
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
- exit 0
- fi
-
- # Create links to the real library.
- for linkname in $linknames; do
- if test "$realname" != "$linkname"; then
- $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
- $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
- fi
- done
-
- # If -module or -export-dynamic was specified, set the dlname.
- if test "$module" = yes || test "$export_dynamic" = yes; then
- # On all known operating systems, these are identical.
- dlname="$soname"
- fi
- fi
- ;;
-
- obj)
- if test -n "$deplibs"; then
- $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
- fi
-
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
- fi
-
- if test -n "$rpath"; then
- $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
- fi
-
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
- fi
-
- case $output in
- *.lo)
- if test -n "$objs$old_deplibs"; then
- $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
- exit 1
- fi
- libobj="$output"
- obj=`$echo "X$output" | $Xsed -e "$lo2o"`
- ;;
- *)
- libobj=
- obj="$output"
- ;;
- esac
-
- # Delete the old objects.
- $run $rm $obj $libobj
-
- # Objects from convenience libraries. This assumes
- # single-version convenience libraries. Whenever we create
- # different ones for PIC/non-PIC, this we'll have to duplicate
- # the extraction.
- reload_conv_objs=
- gentop=
- # reload_cmds runs $LD directly, so let us get rid of
- # -Wl from whole_archive_flag_spec
- wl=
-
- if test -n "$convenience"; then
- if test -n "$whole_archive_flag_spec"; then
- eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
- else
- gentop="$output_objdir/${obj}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "mkdir $gentop"
- $run mkdir "$gentop"
- status=$?
- if test $status -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
- generated="$generated $gentop"
-
- for xlib in $convenience; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "mkdir $xdir"
- $run mkdir "$xdir"
- status=$?
- if test $status -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
-
- reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
- done
- fi
- fi
-
- # Create the old-style object.
- reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
-
- output="$obj"
- eval cmds=\"$reload_cmds\"
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Exit if we aren't doing a library object file.
- if test -z "$libobj"; then
- if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
- fi
-
- exit 0
- fi
-
- if test "$build_libtool_libs" != yes; then
- if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
- fi
-
- # Create an invalid libtool object if no PIC, so that we don't
- # accidentally link it into a program.
- $show "echo timestamp > $libobj"
- $run eval "echo timestamp > $libobj" || exit $?
- exit 0
- fi
-
- if test -n "$pic_flag" || test "$pic_mode" != default; then
- # Only do commands if we really have different PIC objects.
- reload_objs="$libobjs $reload_conv_objs"
- output="$libobj"
- eval cmds=\"$reload_cmds\"
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- else
- # Just create a symlink.
- $show $rm $libobj
- $run $rm $libobj
- xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$libobj"; then
- xdir="."
- else
- xdir="$xdir"
- fi
- baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
- oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
- $show "(cd $xdir && $LN_S $oldobj $baseobj)"
- $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
- fi
-
- if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
- fi
-
- exit 0
- ;;
-
- prog)
- case $host in
- *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
- esac
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
- fi
-
- if test "$preload" = yes; then
- if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
- test "$dlopen_self_static" = unknown; then
- $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
- fi
- fi
-
- case $host in
- *-*-rhapsody* | *-*-darwin1.[012])
- # On Rhapsody replace the C library is the System framework
- compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
- finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
- case $host in
- *darwin*)
- # Don't allow lazy linking, it breaks C++ global constructors
- compile_command="$compile_command ${wl}-bind_at_load"
- finalize_command="$finalize_command ${wl}-bind_at_load"
- ;;
- esac
- ;;
- esac
-
- compile_command="$compile_command $compile_deplibs"
- finalize_command="$finalize_command $finalize_deplibs"
-
- if test -n "$rpath$xrpath"; then
- # If the user specified any rpath flags, then add them.
- for libdir in $rpath $xrpath; do
- # This is the magic to use -rpath.
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir" ;;
- esac
- done
- fi
-
- # Now hardcode the library paths
- rpath=
- hardcode_libdirs=
- for libdir in $compile_rpath $finalize_rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- case :$dllsearchpath: in
- *":$libdir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$libdir";;
- esac
- ;;
- esac
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval rpath=\" $hardcode_libdir_flag_spec\"
- fi
- compile_rpath="$rpath"
-
- rpath=
- hardcode_libdirs=
- for libdir in $finalize_rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$finalize_perm_rpath " in
- *" $libdir "*) ;;
- *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
- esac
- fi
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval rpath=\" $hardcode_libdir_flag_spec\"
- fi
- finalize_rpath="$rpath"
-
- if test -n "$libobjs" && test "$build_old_libs" = yes; then
- # Transform all the library objects into standard objects.
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- fi
-
- dlsyms=
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- if test -n "$NM" && test -n "$global_symbol_pipe"; then
- dlsyms="${outputname}S.c"
- else
- $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
- fi
- fi
-
- if test -n "$dlsyms"; then
- case $dlsyms in
- "") ;;
- *.c)
- # Discover the nlist of each of the dlfiles.
- nlist="$output_objdir/${outputname}.nm"
-
- $show "$rm $nlist ${nlist}S ${nlist}T"
- $run $rm "$nlist" "${nlist}S" "${nlist}T"
-
- # Parse the name list into a source file.
- $show "creating $output_objdir/$dlsyms"
-
- test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
-/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
-/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
-
-#ifdef __cplusplus
-extern \"C\" {
-#endif
-
-/* Prevent the only kind of declaration conflicts we can make. */
-#define lt_preloaded_symbols some_other_symbol
-
-/* External symbol declarations for the compiler. */\
-"
-
- if test "$dlself" = yes; then
- $show "generating symbol list for \`$output'"
-
- test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
-
- # Add our own program objects to the symbol list.
- progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- for arg in $progfiles; do
- $show "extracting global C symbols from \`$arg'"
- $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
- done
-
- if test -n "$exclude_expsyms"; then
- $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
- $run eval '$mv "$nlist"T "$nlist"'
- fi
-
- if test -n "$export_symbols_regex"; then
- $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
- $run eval '$mv "$nlist"T "$nlist"'
- fi
-
- # Prepare the list of exported symbols
- if test -z "$export_symbols"; then
- export_symbols="$output_objdir/$output.exp"
- $run $rm $export_symbols
- $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
- else
- $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
- $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
- $run eval 'mv "$nlist"T "$nlist"'
- fi
- fi
-
- for arg in $dlprefiles; do
- $show "extracting global C symbols from \`$arg'"
- name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
- $run eval 'echo ": $name " >> "$nlist"'
- $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
- done
-
- if test -z "$run"; then
- # Make sure we have at least an empty file.
- test -f "$nlist" || : > "$nlist"
-
- if test -n "$exclude_expsyms"; then
- egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
- $mv "$nlist"T "$nlist"
- fi
-
- # Try sorting and uniquifying the output.
- if grep -v "^: " < "$nlist" |
- if sort -k 3 </dev/null >/dev/null 2>&1; then
- sort -k 3
- else
- sort +2
- fi |
- uniq > "$nlist"S; then
- :
- else
- grep -v "^: " < "$nlist" > "$nlist"S
- fi
-
- if test -f "$nlist"S; then
- eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
- else
- echo '/* NONE */' >> "$output_objdir/$dlsyms"
- fi
-
- $echo >> "$output_objdir/$dlsyms" "\
-
-#undef lt_preloaded_symbols
-
-#if defined (__STDC__) && __STDC__
-# define lt_ptr void *
-#else
-# define lt_ptr char *
-# define const
-#endif
-
-/* The mapping between symbol names and symbols. */
-const struct {
- const char *name;
- lt_ptr address;
-}
-lt_preloaded_symbols[] =
-{\
-"
-
- eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
-
- $echo >> "$output_objdir/$dlsyms" "\
- {0, (lt_ptr) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
- return lt_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif\
-"
- fi
-
- pic_flag_for_symtable=
- case $host in
- # compiling the symbol table file with pic_flag works around
- # a FreeBSD bug that causes programs to crash when -lm is
- # linked before any other PIC object. But we must not use
- # pic_flag when linking with -static. The problem exists in
- # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
- *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
- case "$compile_command " in
- *" -static "*) ;;
- *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
- esac;;
- *-*-hpux*)
- case "$compile_command " in
- *" -static "*) ;;
- *) pic_flag_for_symtable=" $pic_flag -DPIC";;
- esac
- esac
-
- # Now compile the dynamic symbol file.
- $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
- $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
-
- # Clean up the generated files.
- $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
- $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
-
- # Transform the symbol file into the correct name.
- compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
- ;;
- *)
- $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
- exit 1
- ;;
- esac
- else
- # We keep going just in case the user didn't refer to
- # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
- # really was required.
-
- # Nullify the symbol file.
- compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
- fi
-
- if test $need_relink = no || test "$build_libtool_libs" != yes; then
- # Replace the output file specification.
- compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
- link_command="$compile_command$compile_rpath"
-
- # We have no uninstalled library dependencies, so finalize right now.
- $show "$link_command"
- $run eval "$link_command"
- status=$?
-
- # Delete the generated files.
- if test -n "$dlsyms"; then
- $show "$rm $output_objdir/${outputname}S.${objext}"
- $run $rm "$output_objdir/${outputname}S.${objext}"
- fi
-
- exit $status
- fi
-
- if test -n "$shlibpath_var"; then
- # We should set the shlibpath_var
- rpath=
- for dir in $temp_rpath; do
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*)
- # Absolute path.
- rpath="$rpath$dir:"
- ;;
- *)
- # Relative path: add a thisdir entry.
- rpath="$rpath\$thisdir/$dir:"
- ;;
- esac
- done
- temp_rpath="$rpath"
- fi
-
- if test -n "$compile_shlibpath$finalize_shlibpath"; then
- compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
- fi
- if test -n "$finalize_shlibpath"; then
- finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
- fi
-
- compile_var=
- finalize_var=
- if test -n "$runpath_var"; then
- if test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
- fi
- if test -n "$finalize_perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $finalize_perm_rpath; do
- rpath="$rpath$dir:"
- done
- finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
- fi
- fi
-
- if test "$no_install" = yes; then
- # We don't need to create a wrapper script.
- link_command="$compile_var$compile_command$compile_rpath"
- # Replace the output file specification.
- link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
- # Delete the old output file.
- $run $rm $output
- # Link the executable and exit
- $show "$link_command"
- $run eval "$link_command" || exit $?
- exit 0
- fi
-
- if test "$hardcode_action" = relink; then
- # Fast installation is not supported
- link_command="$compile_var$compile_command$compile_rpath"
- relink_command="$finalize_var$finalize_command$finalize_rpath"
-
- $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
- $echo "$modename: \`$output' will be relinked during installation" 1>&2
- else
- if test "$fast_install" != no; then
- link_command="$finalize_var$compile_command$finalize_rpath"
- if test "$fast_install" = yes; then
- relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
- else
- # fast_install is set to needless
- relink_command=
- fi
- else
- link_command="$compile_var$compile_command$compile_rpath"
- relink_command="$finalize_var$finalize_command$finalize_rpath"
- fi
- fi
-
- # Replace the output file specification.
- link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
-
- # Delete the old output files.
- $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
-
- $show "$link_command"
- $run eval "$link_command" || exit $?
-
- # Now create the wrapper script.
- $show "creating $output"
-
- # Quote the relink command for shipping.
- if test -n "$relink_command"; then
- # Preserve any variables that may affect compiler behavior
- for var in $variables_saved_for_relink; do
- if eval test -z \"\${$var+set}\"; then
- relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
- elif eval var_value=\$$var; test -z "$var_value"; then
- relink_command="$var=; export $var; $relink_command"
- else
- var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
- relink_command="$var=\"$var_value\"; export $var; $relink_command"
- fi
- done
- relink_command="(cd `pwd`; $relink_command)"
- relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
- fi
-
- # Quote $echo for shipping.
- if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
- case $0 in
- [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
- *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
- esac
- qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
- else
- qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
- fi
-
- # Only actually do things if our run command is non-null.
- if test -z "$run"; then
- # win32 will think the script is a binary if it has
- # a .exe suffix, so we strip it off here.
- case $output in
- *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
- esac
- # test for cygwin because mv fails w/o .exe extensions
- case $host in
- *cygwin*) exeext=.exe ;;
- *) exeext= ;;
- esac
- $rm $output
- trap "$rm $output; exit 1" 1 2 15
-
- $echo > $output "\
-#! $SHELL
-
-# $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of the build directory.
-# If it is, it will not operate correctly.
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed="${SED}"' -e 1s/^X//'
-sed_quote_subst='$sed_quote_subst'
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
-
-relink_command=\"$relink_command\"
-
-# This environment variable determines our operation mode.
-if test \"\$libtool_install_magic\" = \"$magic\"; then
- # install mode needs the following variable:
- notinst_deplibs='$notinst_deplibs'
-else
- # When we are sourced in execute mode, \$file and \$echo are already set.
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- echo=\"$qecho\"
- file=\"\$0\"
- # Make sure echo works.
- if test \"X\$1\" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
- elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
- # Yippee, \$echo works!
- :
- else
- # Restart under the correct shell, and then maybe \$echo will work.
- exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
- fi
- fi\
-"
- $echo >> $output "\
-
- # Find the directory that this script lives in.
- thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
- test \"x\$thisdir\" = \"x\$file\" && thisdir=.
-
- # Follow symbolic links until we get to the real thisdir.
- file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
- while test -n \"\$file\"; do
- destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
-
- # If there was a directory component, then change thisdir.
- if test \"x\$destdir\" != \"x\$file\"; then
- case \"\$destdir\" in
- [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
- *) thisdir=\"\$thisdir/\$destdir\" ;;
- esac
- fi
-
- file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
- file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
- done
-
- # Try to get the absolute directory name.
- absdir=\`cd \"\$thisdir\" && pwd\`
- test -n \"\$absdir\" && thisdir=\"\$absdir\"
-"
-
- if test "$fast_install" = yes; then
- echo >> $output "\
- program=lt-'$outputname'$exeext
- progdir=\"\$thisdir/$objdir\"
-
- if test ! -f \"\$progdir/\$program\" || \\
- { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
- test \"X\$file\" != \"X\$progdir/\$program\"; }; then
-
- file=\"\$\$-\$program\"
-
- if test ! -d \"\$progdir\"; then
- $mkdir \"\$progdir\"
- else
- $rm \"\$progdir/\$file\"
- fi"
-
- echo >> $output "\
-
- # relink executable if necessary
- if test -n \"\$relink_command\"; then
- if relink_command_output=\`eval \$relink_command 2>&1\`; then :
- else
- $echo \"\$relink_command_output\" >&2
- $rm \"\$progdir/\$file\"
- exit 1
- fi
- fi
-
- $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
- { $rm \"\$progdir/\$program\";
- $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
- $rm \"\$progdir/\$file\"
- fi"
- else
- echo >> $output "\
- program='$outputname'
- progdir=\"\$thisdir/$objdir\"
-"
- fi
-
- echo >> $output "\
-
- if test -f \"\$progdir/\$program\"; then"
-
- # Export our shlibpath_var if we have one.
- if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
- $echo >> $output "\
- # Add our own library path to $shlibpath_var
- $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
-
- # Some systems cannot cope with colon-terminated $shlibpath_var
- # The second colon is a workaround for a bug in BeOS R4 ${SED}
- $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
-
- export $shlibpath_var
-"
- fi
-
- # fixup the dll searchpath if we need to.
- if test -n "$dllsearchpath"; then
- $echo >> $output "\
- # Add the dll search path components to the executable PATH
- PATH=$dllsearchpath:\$PATH
-"
- fi
-
- $echo >> $output "\
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- # Run the actual program with our arguments.
-"
- case $host in
- # win32 systems need to use the prog path for dll
- # lookup to work
- *-*-cygwin* | *-*-pw32*)
- $echo >> $output "\
- exec \$progdir/\$program \${1+\"\$@\"}
-"
- ;;
-
- # Backslashes separate directories on plain windows
- *-*-mingw | *-*-os2*)
- $echo >> $output "\
- exec \$progdir\\\\\$program \${1+\"\$@\"}
-"
- ;;
-
- *)
- $echo >> $output "\
- # Export the path to the program.
- PATH=\"\$progdir:\$PATH\"
- export PATH
-
- exec \$program \${1+\"\$@\"}
-"
- ;;
- esac
- $echo >> $output "\
- \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
- exit 1
- fi
- else
- # The program doesn't exist.
- \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
- \$echo \"This script is just a wrapper for \$program.\" 1>&2
- echo \"See the $PACKAGE documentation for more information.\" 1>&2
- exit 1
- fi
-fi\
-"
- chmod +x $output
- fi
- exit 0
- ;;
- esac
-
- # See if we need to build an old-fashioned archive.
- for oldlib in $oldlibs; do
-
- if test "$build_libtool_libs" = convenience; then
- oldobjs="$libobjs_save"
- addlibs="$convenience"
- build_libtool_libs=no
- else
- if test "$build_libtool_libs" = module; then
- oldobjs="$libobjs_save"
- build_libtool_libs=no
- else
- oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
- fi
- addlibs="$old_convenience"
- fi
-
- if test -n "$addlibs"; then
- gentop="$output_objdir/${outputname}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "mkdir $gentop"
- $run mkdir "$gentop"
- status=$?
- if test $status -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
- generated="$generated $gentop"
-
- # Add in members from convenience archives.
- for xlib in $addlibs; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "mkdir $xdir"
- $run mkdir "$xdir"
- status=$?
- if test $status -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
-
- oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
- done
- fi
-
- # Do each command in the archive commands.
- if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
- eval cmds=\"$old_archive_from_new_cmds\"
- else
- # Ensure that we have .o objects in place in case we decided
- # not to build a shared library, and have fallen back to building
- # static libs even though --disable-static was passed!
- for oldobj in $oldobjs; do
- if test ! -f $oldobj; then
- xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$oldobj"; then
- xdir="."
- else
- xdir="$xdir"
- fi
- baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
- obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
- $show "(cd $xdir && ${LN_S} $obj $baseobj)"
- $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
- fi
- done
-
- eval cmds=\"$old_archive_cmds\"
- fi
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- done
-
- if test -n "$generated"; then
- $show "${rm}r$generated"
- $run ${rm}r$generated
- fi
-
- # Now create the libtool archive.
- case $output in
- *.la)
- old_library=
- test "$build_old_libs" = yes && old_library="$libname.$libext"
- $show "creating $output"
-
- # Preserve any variables that may affect compiler behavior
- for var in $variables_saved_for_relink; do
- if eval test -z \"\${$var+set}\"; then
- relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
- elif eval var_value=\$$var; test -z "$var_value"; then
- relink_command="$var=; export $var; $relink_command"
- else
- var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
- relink_command="$var=\"$var_value\"; export $var; $relink_command"
- fi
- done
- # Quote the link command for shipping.
- relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
- relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
-
- # Only create the output if not a dry run.
- if test -z "$run"; then
- for installed in no yes; do
- if test "$installed" = yes; then
- if test -z "$install_libdir"; then
- break
- fi
- output="$output_objdir/$outputname"i
- # Replace all uninstalled libtool libraries with the installed ones
- newdependency_libs=
- for deplib in $dependency_libs; do
- case $deplib in
- *.la)
- name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
- if test -z "$libdir"; then
- $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
- exit 1
- fi
- newdependency_libs="$newdependency_libs $libdir/$name"
- ;;
- *) newdependency_libs="$newdependency_libs $deplib" ;;
- esac
- done
- dependency_libs="$newdependency_libs"
- newdlfiles=
- for lib in $dlfiles; do
- name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
- if test -z "$libdir"; then
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- exit 1
- fi
- newdlfiles="$newdlfiles $libdir/$name"
- done
- dlfiles="$newdlfiles"
- newdlprefiles=
- for lib in $dlprefiles; do
- name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
- if test -z "$libdir"; then
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- exit 1
- fi
- newdlprefiles="$newdlprefiles $libdir/$name"
- done
- dlprefiles="$newdlprefiles"
- fi
- $rm $output
- # place dlname in correct position for cygwin
- tdlname=$dlname
- case $host,$output,$installed,$module,$dlname in
- *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
- esac
- $echo > $output "\
-# $outputname - a libtool library file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='$tdlname'
-
-# Names of this library.
-library_names='$library_names'
-
-# The name of the static archive.
-old_library='$old_library'
-
-# Libraries that this one depends upon.
-dependency_libs='$dependency_libs'
-
-# Version information for $libname.
-current=$current
-age=$age
-revision=$revision
-
-# Is this an already installed library?
-installed=$installed
-
-# Files to dlopen/dlpreopen
-dlopen='$dlfiles'
-dlpreopen='$dlprefiles'
-
-# Directory that this library needs to be installed in:
-libdir='$install_libdir'"
- if test "$installed" = no && test $need_relink = yes; then
- $echo >> $output "\
-relink_command=\"$relink_command\""
- fi
- done
- fi
-
- # Do a symbolic link so that the libtool archive can be found in
- # LD_LIBRARY_PATH before the program is installed.
- $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
- $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
- ;;
- esac
- exit 0
- ;;
-
- # libtool install mode
- install)
- modename="$modename: install"
-
- # There may be an optional sh(1) argument at the beginning of
- # install_prog (especially on Windows NT).
- if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
- # Allow the use of GNU shtool's install command.
- $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
- # Aesthetically quote it.
- arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$arg "
- arg="$1"
- shift
- else
- install_prog=
- arg="$nonopt"
- fi
-
- # The real first argument should be the name of the installation program.
- # Aesthetically quote it.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog$arg"
-
- # We need to accept at least all the BSD install flags.
- dest=
- files=
- opts=
- prev=
- install_type=
- isdir=no
- stripme=
- for arg
- do
- if test -n "$dest"; then
- files="$files $dest"
- dest="$arg"
- continue
- fi
-
- case $arg in
- -d) isdir=yes ;;
- -f) prev="-f" ;;
- -g) prev="-g" ;;
- -m) prev="-m" ;;
- -o) prev="-o" ;;
- -s)
- stripme=" -s"
- continue
- ;;
- -*) ;;
-
- *)
- # If the previous option needed an argument, then skip it.
- if test -n "$prev"; then
- prev=
- else
- dest="$arg"
- continue
- fi
- ;;
- esac
-
- # Aesthetically quote the argument.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog $arg"
- done
-
- if test -z "$install_prog"; then
- $echo "$modename: you must specify an install program" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- if test -n "$prev"; then
- $echo "$modename: the \`$prev' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- if test -z "$files"; then
- if test -z "$dest"; then
- $echo "$modename: no file or destination specified" 1>&2
- else
- $echo "$modename: you must specify a destination" 1>&2
- fi
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Strip any trailing slash from the destination.
- dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
-
- # Check to see that the destination is a directory.
- test -d "$dest" && isdir=yes
- if test "$isdir" = yes; then
- destdir="$dest"
- destname=
- else
- destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
- test "X$destdir" = "X$dest" && destdir=.
- destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
-
- # Not a directory, so check to see that there is only one file specified.
- set dummy $files
- if test $# -gt 2; then
- $echo "$modename: \`$dest' is not a directory" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
- fi
- case $destdir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- for file in $files; do
- case $file in
- *.lo) ;;
- *)
- $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
- esac
- done
- ;;
- esac
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- staticlibs=
- future_libdirs=
- current_libdirs=
- for file in $files; do
-
- # Do each installation.
- case $file in
- *.$libext)
- # Do the static libraries later.
- staticlibs="$staticlibs $file"
- ;;
-
- *.la)
- # Check to see that this really is a libtool archive.
- if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- library_names=
- old_library=
- relink_command=
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Add the libdir to current_libdirs if it is the destination.
- if test "X$destdir" = "X$libdir"; then
- case "$current_libdirs " in
- *" $libdir "*) ;;
- *) current_libdirs="$current_libdirs $libdir" ;;
- esac
- else
- # Note the libdir as a future libdir.
- case "$future_libdirs " in
- *" $libdir "*) ;;
- *) future_libdirs="$future_libdirs $libdir" ;;
- esac
- fi
-
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
- test "X$dir" = "X$file/" && dir=
- dir="$dir$objdir"
-
- if test -n "$relink_command"; then
- $echo "$modename: warning: relinking \`$file'" 1>&2
- $show "$relink_command"
- if $run eval "$relink_command"; then :
- else
- $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
- continue
- fi
- fi
-
- # See the names of the shared library.
- set dummy $library_names
- if test -n "$2"; then
- realname="$2"
- shift
- shift
-
- srcname="$realname"
- test -n "$relink_command" && srcname="$realname"T
-
- # Install the shared library and build the symlinks.
- $show "$install_prog $dir/$srcname $destdir/$realname"
- $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
- if test -n "$stripme" && test -n "$striplib"; then
- $show "$striplib $destdir/$realname"
- $run eval "$striplib $destdir/$realname" || exit $?
- fi
-
- if test $# -gt 0; then
- # Delete the old symlinks, and create new ones.
- for linkname
- do
- if test "$linkname" != "$realname"; then
- $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
- $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
- fi
- done
- fi
-
- # Do each command in the postinstall commands.
- lib="$destdir/$realname"
- eval cmds=\"$postinstall_cmds\"
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- # Install the pseudo-library for information purposes.
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- instname="$dir/$name"i
- $show "$install_prog $instname $destdir/$name"
- $run eval "$install_prog $instname $destdir/$name" || exit $?
-
- # Maybe install the static library, too.
- test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
- ;;
-
- *.lo)
- # Install (i.e. copy) a libtool object.
-
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- destfile="$destdir/$destfile"
- fi
-
- # Deduce the name of the destination old-style object file.
- case $destfile in
- *.lo)
- staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
- ;;
- *.$objext)
- staticdest="$destfile"
- destfile=
- ;;
- *)
- $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
- esac
-
- # Install the libtool object if requested.
- if test -n "$destfile"; then
- $show "$install_prog $file $destfile"
- $run eval "$install_prog $file $destfile" || exit $?
- fi
-
- # Install the old object if enabled.
- if test "$build_old_libs" = yes; then
- # Deduce the name of the old-style object file.
- staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
-
- $show "$install_prog $staticobj $staticdest"
- $run eval "$install_prog \$staticobj \$staticdest" || exit $?
- fi
- exit 0
- ;;
-
- *)
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- destfile="$destdir/$destfile"
- fi
-
- # Do a test to see if this is really a libtool program.
- case $host in
- *cygwin*|*mingw*)
- wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
- ;;
- *)
- wrapper=$file
- ;;
- esac
- if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
- notinst_deplibs=
- relink_command=
-
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $wrapper ;;
- *) . ./$wrapper ;;
- esac
-
- # Check the variables that should have been set.
- if test -z "$notinst_deplibs"; then
- $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
- exit 1
- fi
-
- finalize=yes
- for lib in $notinst_deplibs; do
- # Check to see that each library is installed.
- libdir=
- if test -f "$lib"; then
- # If there is no directory component, then add one.
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
- fi
- libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
- if test -n "$libdir" && test ! -f "$libfile"; then
- $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
- finalize=no
- fi
- done
-
- relink_command=
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $wrapper ;;
- *) . ./$wrapper ;;
- esac
-
- outputname=
- if test "$fast_install" = no && test -n "$relink_command"; then
- if test "$finalize" = yes && test -z "$run"; then
- tmpdir="/tmp"
- test -n "$TMPDIR" && tmpdir="$TMPDIR"
- tmpdir="$tmpdir/libtool-$$"
- if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
- else
- $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
- continue
- fi
- file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- outputname="$tmpdir/$file"
- # Replace the output file specification.
- relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
-
- $show "$relink_command"
- if $run eval "$relink_command"; then :
- else
- $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
- ${rm}r "$tmpdir"
- continue
- fi
- file="$outputname"
- else
- $echo "$modename: warning: cannot relink \`$file'" 1>&2
- fi
- else
- # Install the binary that we compiled earlier.
- file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
- fi
- fi
-
- # remove .exe since cygwin /usr/bin/install will append another
- # one anyways
- case $install_prog,$host in
- /usr/bin/install*,*cygwin*)
- case $file:$destfile in
- *.exe:*.exe)
- # this is ok
- ;;
- *.exe:*)
- destfile=$destfile.exe
- ;;
- *:*.exe)
- destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
- ;;
- esac
- ;;
- esac
- $show "$install_prog$stripme $file $destfile"
- $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
- test -n "$outputname" && ${rm}r "$tmpdir"
- ;;
- esac
- done
-
- for file in $staticlibs; do
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-
- # Set up the ranlib parameters.
- oldlib="$destdir/$name"
-
- $show "$install_prog $file $oldlib"
- $run eval "$install_prog \$file \$oldlib" || exit $?
-
- if test -n "$stripme" && test -n "$striplib"; then
- $show "$old_striplib $oldlib"
- $run eval "$old_striplib $oldlib" || exit $?
- fi
-
- # Do each command in the postinstall commands.
- eval cmds=\"$old_postinstall_cmds\"
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- done
-
- if test -n "$future_libdirs"; then
- $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
- fi
-
- if test -n "$current_libdirs"; then
- # Maybe just do a dry run.
- test -n "$run" && current_libdirs=" -n$current_libdirs"
- exec_cmd='$SHELL $0 --finish$current_libdirs'
- else
- exit 0
- fi
- ;;
-
- # libtool finish mode
- finish)
- modename="$modename: finish"
- libdirs="$nonopt"
- admincmds=
-
- if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
- for dir
- do
- libdirs="$libdirs $dir"
- done
-
- for libdir in $libdirs; do
- if test -n "$finish_cmds"; then
- # Do each command in the finish commands.
- eval cmds=\"$finish_cmds\"
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || admincmds="$admincmds
- $cmd"
- done
- IFS="$save_ifs"
- fi
- if test -n "$finish_eval"; then
- # Do the single finish_eval.
- eval cmds=\"$finish_eval\"
- $run eval "$cmds" || admincmds="$admincmds
- $cmds"
- fi
- done
- fi
-
- # Exit here if they wanted silent mode.
- test "$show" = ":" && exit 0
-
- echo "----------------------------------------------------------------------"
- echo "Libraries have been installed in:"
- for libdir in $libdirs; do
- echo " $libdir"
- done
- echo
- echo "If you ever happen to want to link against installed libraries"
- echo "in a given directory, LIBDIR, you must either use libtool, and"
- echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
- echo "flag during linking and do at least one of the following:"
- if test -n "$shlibpath_var"; then
- echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
- echo " during execution"
- fi
- if test -n "$runpath_var"; then
- echo " - add LIBDIR to the \`$runpath_var' environment variable"
- echo " during linking"
- fi
- if test -n "$hardcode_libdir_flag_spec"; then
- libdir=LIBDIR
- eval flag=\"$hardcode_libdir_flag_spec\"
-
- echo " - use the \`$flag' linker flag"
- fi
- if test -n "$admincmds"; then
- echo " - have your system administrator run these commands:$admincmds"
- fi
- if test -f /etc/ld.so.conf; then
- echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
- fi
- echo
- echo "See any operating system documentation about shared libraries for"
- echo "more information, such as the ld(1) and ld.so(8) manual pages."
- echo "----------------------------------------------------------------------"
- exit 0
- ;;
-
- # libtool execute mode
- execute)
- modename="$modename: execute"
-
- # The first argument is the command name.
- cmd="$nonopt"
- if test -z "$cmd"; then
- $echo "$modename: you must specify a COMMAND" 1>&2
- $echo "$help"
- exit 1
- fi
-
- # Handle -dlopen flags immediately.
- for file in $execute_dlfiles; do
- if test ! -f "$file"; then
- $echo "$modename: \`$file' is not a file" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- dir=
- case $file in
- *.la)
- # Check to see that this really is a libtool archive.
- if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Read the libtool library.
- dlname=
- library_names=
-
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Skip this library if it cannot be dlopened.
- if test -z "$dlname"; then
- # Warn if it was a shared library.
- test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
- continue
- fi
-
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
-
- if test -f "$dir/$objdir/$dlname"; then
- dir="$dir/$objdir"
- else
- $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
- exit 1
- fi
- ;;
-
- *.lo)
- # Just add the directory containing the .lo file.
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
- ;;
-
- *)
- $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
- continue
- ;;
- esac
-
- # Get the absolute pathname.
- absdir=`cd "$dir" && pwd`
- test -n "$absdir" && dir="$absdir"
-
- # Now add the directory to shlibpath_var.
- if eval "test -z \"\$$shlibpath_var\""; then
- eval "$shlibpath_var=\"\$dir\""
- else
- eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
- fi
- done
-
- # This variable tells wrapper scripts just to set shlibpath_var
- # rather than running their programs.
- libtool_execute_magic="$magic"
-
- # Check if any of the arguments is a wrapper script.
- args=
- for file
- do
- case $file in
- -*) ;;
- *)
- # Do a test to see if this is really a libtool program.
- if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Transform arg to wrapped name.
- file="$progdir/$program"
- fi
- ;;
- esac
- # Quote arguments (to preserve shell metacharacters).
- file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
- args="$args \"$file\""
- done
-
- if test -z "$run"; then
- if test -n "$shlibpath_var"; then
- # Export the shlibpath_var.
- eval "export $shlibpath_var"
- fi
-
- # Restore saved enviroment variables
- if test "${save_LC_ALL+set}" = set; then
- LC_ALL="$save_LC_ALL"; export LC_ALL
- fi
- if test "${save_LANG+set}" = set; then
- LANG="$save_LANG"; export LANG
- fi
-
- # Now prepare to actually exec the command.
- exec_cmd="\$cmd$args"
- else
- # Display what would be done.
- if test -n "$shlibpath_var"; then
- eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
- $echo "export $shlibpath_var"
- fi
- $echo "$cmd$args"
- exit 0
- fi
- ;;
-
- # libtool clean and uninstall mode
- clean | uninstall)
- modename="$modename: $mode"
- rm="$nonopt"
- files=
- rmforce=
- exit_status=0
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- for arg
- do
- case $arg in
- -f) rm="$rm $arg"; rmforce=yes ;;
- -*) rm="$rm $arg" ;;
- *) files="$files $arg" ;;
- esac
- done
-
- if test -z "$rm"; then
- $echo "$modename: you must specify an RM program" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- rmdirs=
-
- for file in $files; do
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$dir" = "X$file"; then
- dir=.
- objdir="$objdir"
- else
- objdir="$dir/$objdir"
- fi
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- test $mode = uninstall && objdir="$dir"
-
- # Remember objdir for removal later, being careful to avoid duplicates
- if test $mode = clean; then
- case " $rmdirs " in
- *" $objdir "*) ;;
- *) rmdirs="$rmdirs $objdir" ;;
- esac
- fi
-
- # Don't error if the file doesn't exist and rm -f was used.
- if (test -L "$file") >/dev/null 2>&1 \
- || (test -h "$file") >/dev/null 2>&1 \
- || test -f "$file"; then
- :
- elif test -d "$file"; then
- exit_status=1
- continue
- elif test "$rmforce" = yes; then
- continue
- fi
-
- rmfiles="$file"
-
- case $name in
- *.la)
- # Possibly a libtool archive, so verify it.
- if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- . $dir/$name
-
- # Delete the libtool libraries and symlinks.
- for n in $library_names; do
- rmfiles="$rmfiles $objdir/$n"
- done
- test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
- test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
-
- if test $mode = uninstall; then
- if test -n "$library_names"; then
- # Do each command in the postuninstall commands.
- eval cmds=\"$postuninstall_cmds\"
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd"
- if test $? != 0 && test "$rmforce" != yes; then
- exit_status=1
- fi
- done
- IFS="$save_ifs"
- fi
-
- if test -n "$old_library"; then
- # Do each command in the old_postuninstall commands.
- eval cmds=\"$old_postuninstall_cmds\"
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd"
- if test $? != 0 && test "$rmforce" != yes; then
- exit_status=1
- fi
- done
- IFS="$save_ifs"
- fi
- # FIXME: should reinstall the best remaining shared library.
- fi
- fi
- ;;
-
- *.lo)
- if test "$build_old_libs" = yes; then
- oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
- rmfiles="$rmfiles $dir/$oldobj"
- fi
- ;;
-
- *)
- # Do a test to see if this is a libtool program.
- if test $mode = clean &&
- (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- relink_command=
- . $dir/$file
-
- rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
- if test "$fast_install" = yes && test -n "$relink_command"; then
- rmfiles="$rmfiles $objdir/lt-$name"
- fi
- fi
- ;;
- esac
- $show "$rm $rmfiles"
- $run $rm $rmfiles || exit_status=1
- done
-
- # Try to remove the ${objdir}s in the directories where we deleted files
- for dir in $rmdirs; do
- if test -d "$dir"; then
- $show "rmdir $dir"
- $run rmdir $dir >/dev/null 2>&1
- fi
- done
-
- exit $exit_status
- ;;
-
- "")
- $echo "$modename: you must specify a MODE" 1>&2
- $echo "$generic_help" 1>&2
- exit 1
- ;;
- esac
-
- if test -z "$exec_cmd"; then
- $echo "$modename: invalid operation mode \`$mode'" 1>&2
- $echo "$generic_help" 1>&2
- exit 1
- fi
-fi # test -z "$show_help"
-
-if test -n "$exec_cmd"; then
- eval exec $exec_cmd
- exit 1
-fi
-
-# We need to display help for each of the modes.
-case $mode in
-"") $echo \
-"Usage: $modename [OPTION]... [MODE-ARG]...
-
-Provide generalized library-building support services.
-
- --config show all configuration variables
- --debug enable verbose shell tracing
--n, --dry-run display commands without modifying any files
- --features display basic configuration information and exit
- --finish same as \`--mode=finish'
- --help display this help message and exit
- --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
- --quiet same as \`--silent'
- --silent don't print informational messages
- --version print version information
-
-MODE must be one of the following:
-
- clean remove files from the build directory
- compile compile a source file into a libtool object
- execute automatically set library path, then run a program
- finish complete the installation of libtool libraries
- install install libraries or executables
- link create a library or an executable
- uninstall remove libraries from an installed directory
-
-MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
-a more detailed description of MODE."
- exit 0
- ;;
-
-clean)
- $echo \
-"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
-
-Remove files from the build directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, object or program, all the files associated
-with it are deleted. Otherwise, only FILE itself is deleted using RM."
- ;;
-
-compile)
- $echo \
-"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-This mode accepts the following additional options:
-
- -o OUTPUT-FILE set the output file name to OUTPUT-FILE
- -prefer-pic try to building PIC objects only
- -prefer-non-pic try to building non-PIC objects only
- -static always build a \`.o' file suitable for static linking
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'."
- ;;
-
-execute)
- $echo \
-"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
-
-Automatically set library path, then run a program.
-
-This mode accepts the following additional options:
-
- -dlopen FILE add the directory containing FILE to the library path
-
-This mode sets the library path environment variable according to \`-dlopen'
-flags.
-
-If any of the ARGS are libtool executable wrappers, then they are translated
-into their corresponding uninstalled binary, and any of their required library
-directories are added to the library path.
-
-Then, COMMAND is executed, with ARGS as arguments."
- ;;
-
-finish)
- $echo \
-"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges. Use
-the \`--dry-run' option if you just want to see what would be executed."
- ;;
-
-install)
- $echo \
-"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command. The first component should be
-either the \`install' or \`cp' program.
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized)."
- ;;
-
-link)
- $echo \
-"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
- -all-static do not do any dynamic linking at all
- -avoid-version do not add a version suffix if possible
- -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
- -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
- -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
- -export-symbols SYMFILE
- try to export only the symbols listed in SYMFILE
- -export-symbols-regex REGEX
- try to export only the symbols matching REGEX
- -LLIBDIR search LIBDIR for required installed libraries
- -lNAME OUTPUT-FILE requires the installed library libNAME
- -module build a library that can dlopened
- -no-fast-install disable the fast-install mode
- -no-install link a not-installable executable
- -no-undefined declare that a library does not refer to external symbols
- -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
- -release RELEASE specify package release information
- -rpath LIBDIR the created library will eventually be installed in LIBDIR
- -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
- -static do not do any dynamic linking of libtool libraries
- -version-info CURRENT[:REVISION[:AGE]]
- specify library version info [each variable defaults to 0]
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename. Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
-only library objects (\`.lo' files) may be specified, and \`-rpath' is
-required, except when creating a convenience library.
-
-If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
-using \`ar' and \`ranlib', or on Windows using \`lib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
-is created, otherwise an executable program is created."
- ;;
-
-uninstall)
- $echo \
-"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM."
- ;;
-
-*)
- $echo "$modename: invalid operation mode \`$mode'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
-esac
-
-echo
-$echo "Try \`$modename --help' for more information about other modes."
-
-exit 0
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
diff --git a/main/SAPI.c b/main/SAPI.c
deleted file mode 100644
index 94a333c967..0000000000
--- a/main/SAPI.c
+++ /dev/null
@@ -1,909 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Original design: Shane Caraveo <shane@caraveo.com> |
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <ctype.h>
-#include <sys/stat.h>
-
-#include "php.h"
-#include "SAPI.h"
-#include "php_ini.h"
-#include "ext/standard/php_string.h"
-#include "ext/standard/pageinfo.h"
-#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
-#include "ext/pcre/php_pcre.h"
-#endif
-#if HAVE_ZLIB
-#include "ext/zlib/php_zlib.h"
-#endif
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-#include "rfc1867.h"
-
-#ifdef PHP_WIN32
-#define STRCASECMP stricmp
-#else
-#define STRCASECMP strcasecmp
-#endif
-
-#include "php_content_types.h"
-
-static HashTable known_post_content_types;
-
-#ifdef ZTS
-SAPI_API int sapi_globals_id;
-#else
-sapi_globals_struct sapi_globals;
-#endif
-
-static void sapi_globals_ctor(sapi_globals_struct *sapi_globals TSRMLS_DC)
-{
- memset(sapi_globals, 0, sizeof(*sapi_globals));
-}
-
-/* True globals (no need for thread safety) */
-SAPI_API sapi_module_struct sapi_module;
-
-
-SAPI_API void sapi_startup(sapi_module_struct *sf)
-{
- sapi_module = *sf;
- zend_hash_init_ex(&known_post_content_types, 5, NULL, NULL, 1, 0);
-
-#ifdef ZTS
- ts_allocate_id(&sapi_globals_id, sizeof(sapi_globals_struct), (ts_allocate_ctor) sapi_globals_ctor, NULL);
-#else
- sapi_globals_ctor(&sapi_globals TSRMLS_CC);
-#endif
-
-#ifdef VIRTUAL_DIR
- virtual_cwd_startup(); /* Could use shutdown to free the main cwd but it would just slow it down for CGI */
-#endif
-
-#ifdef PHP_WIN32
- tsrm_win32_startup();
-#endif
-
- reentrancy_startup();
-}
-
-SAPI_API void sapi_shutdown(void)
-{
- reentrancy_shutdown();
-#ifdef VIRTUAL_DIR
- virtual_cwd_shutdown();
-#endif
-
-#ifdef PHP_WIN32
- tsrm_win32_shutdown();
-#endif
-
- zend_hash_destroy(&known_post_content_types);
-}
-
-
-SAPI_API void sapi_free_header(sapi_header_struct *sapi_header)
-{
- efree(sapi_header->header);
-}
-
-
-SAPI_API void sapi_handle_post(void *arg TSRMLS_DC)
-{
- if (SG(request_info).post_entry && SG(request_info).content_type_dup) {
- SG(request_info).post_entry->post_handler(SG(request_info).content_type_dup, arg TSRMLS_CC);
- if (SG(request_info).post_data) {
- efree(SG(request_info).post_data);
- SG(request_info).post_data = NULL;
- }
- efree(SG(request_info).content_type_dup);
- SG(request_info).content_type_dup = NULL;
- }
-}
-
-static void sapi_read_post_data(TSRMLS_D)
-{
- sapi_post_entry *post_entry;
- uint content_type_length = strlen(SG(request_info).content_type);
- char *content_type = estrndup(SG(request_info).content_type, content_type_length);
- char *p;
- char oldchar=0;
- void (*post_reader_func)(TSRMLS_D) = NULL;
-
-
- /* dedicated implementation for increased performance:
- * - Make the content type lowercase
- * - Trim descriptive data, stay with the content-type only
- */
- for (p=content_type; p<content_type+content_type_length; p++) {
- switch (*p) {
- case ';':
- case ',':
- case ' ':
- content_type_length = p-content_type;
- oldchar = *p;
- *p = 0;
- break;
- default:
- *p = tolower(*p);
- break;
- }
- }
-
- /* now try to find an appropriate POST content handler */
- if (zend_hash_find(&known_post_content_types, content_type, content_type_length+1, (void **) &post_entry) == SUCCESS) {
- /* found one, register it for use */
- SG(request_info).post_entry = post_entry;
- post_reader_func = post_entry->post_reader;
- } else {
- /* fallback */
- SG(request_info).post_entry = NULL;
- if (!sapi_module.default_post_reader) {
- /* no default reader ? */
- sapi_module.sapi_error(E_WARNING, "Unsupported content type: '%s'", content_type);
- return;
- }
- }
- if (oldchar) {
- *(p-1) = oldchar;
- }
-
- SG(request_info).content_type_dup = content_type;
-
- if(post_reader_func) {
- post_reader_func(TSRMLS_C);
- }
-
- if(sapi_module.default_post_reader) {
- sapi_module.default_post_reader(TSRMLS_C);
- }
-}
-
-
-SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
-{
- int read_bytes;
- int allocated_bytes=SAPI_POST_BLOCK_SIZE+1;
-
- if (SG(request_info).content_length > SG(post_max_size)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "POST Content-Length of %d bytes exceeds the limit of %d bytes",
- SG(request_info).content_length, SG(post_max_size));
- return;
- }
- SG(request_info).post_data = emalloc(allocated_bytes);
-
- for (;;) {
- read_bytes = sapi_module.read_post(SG(request_info).post_data+SG(read_post_bytes), SAPI_POST_BLOCK_SIZE TSRMLS_CC);
- if (read_bytes<=0) {
- break;
- }
- SG(read_post_bytes) += read_bytes;
- if (SG(read_post_bytes) > SG(post_max_size)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Actual POST length does not match Content-Length, and exceeds %d bytes", SG(post_max_size));
- return;
- }
- if (read_bytes < SAPI_POST_BLOCK_SIZE) {
- break;
- }
- if (SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE >= allocated_bytes) {
- allocated_bytes = SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE+1;
- SG(request_info).post_data = erealloc(SG(request_info).post_data, allocated_bytes);
- }
- }
- SG(request_info).post_data[SG(read_post_bytes)] = 0; /* terminating NULL */
- SG(request_info).post_data_length = SG(read_post_bytes);
-}
-
-
-SAPI_API char *sapi_get_default_content_type(TSRMLS_D)
-{
- char *mimetype, *charset, *content_type;
-
- mimetype = SG(default_mimetype) ? SG(default_mimetype) : SAPI_DEFAULT_MIMETYPE;
- charset = SG(default_charset) ? SG(default_charset) : SAPI_DEFAULT_CHARSET;
-
- if (strncasecmp(mimetype, "text/", 5) == 0 && *charset) {
- int len = strlen(mimetype) + sizeof("; charset=") + strlen(charset); /* sizeof() includes \0 */
- content_type = emalloc(len);
- snprintf(content_type, len, "%s; charset=%s", mimetype, charset);
- } else {
- content_type = estrdup(mimetype);
- }
- return content_type;
-}
-
-
-SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_header TSRMLS_DC)
-{
- char *default_content_type = sapi_get_default_content_type(TSRMLS_C);
- int default_content_type_len = strlen(default_content_type);
-
- default_header->header_len = (sizeof("Content-type: ")-1) + default_content_type_len;
- default_header->header = emalloc(default_header->header_len+1);
- memcpy(default_header->header, "Content-type: ", sizeof("Content-type: "));
- memcpy(default_header->header+sizeof("Content-type: ")-1, default_content_type, default_content_type_len);
- default_header->header[default_header->header_len] = 0;
- efree(default_content_type);
-}
-
-/*
- * Add charset on content-type header if the MIME type starts with
- * "text/", the default_charset directive is not empty and
- * there is not already a charset option in there.
- *
- * If "mimetype" is non-NULL, it should point to a pointer allocated
- * with emalloc(). If a charset is added, the string will be
- * re-allocated and the new length is returned. If mimetype is
- * unchanged, 0 is returned.
- *
- */
-SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len TSRMLS_DC)
-{
- char *charset, *newtype;
- size_t newlen;
- charset = SG(default_charset) ? SG(default_charset) : SAPI_DEFAULT_CHARSET;
-
- if (*mimetype != NULL) {
- if (*charset && strncmp(*mimetype, "text/", 5) == 0 && strstr(*mimetype, "charset=") == NULL) {
- newlen = len + (sizeof(";charset=")-1) + strlen(charset);
- newtype = emalloc(newlen + 1);
- PHP_STRLCPY(newtype, *mimetype, newlen + 1, len);
- strlcat(newtype, ";charset=", newlen + 1);
- strlcat(newtype, charset, newlen + 1);
- efree(*mimetype);
- *mimetype = newtype;
- return newlen;
- }
- }
- return 0;
-}
-
-SAPI_API void sapi_activate_headers_only(TSRMLS_D)
-{
- if (SG(request_info).headers_read == 1)
- return;
- SG(request_info).headers_read = 1;
- zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct),
- (void (*)(void *)) sapi_free_header, 0);
- SG(sapi_headers).send_default_content_type = 1;
-
- /* SG(sapi_headers).http_response_code = 200; */
- SG(sapi_headers).http_status_line = NULL;
- SG(request_info).current_user = NULL;
- SG(request_info).current_user_length = 0;
- SG(request_info).no_headers = 0;
-
- /*
- * It's possible to override this general case in the activate() callback,
- * if necessary.
- */
- if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) {
- SG(request_info).headers_only = 1;
- } else {
- SG(request_info).headers_only = 0;
- }
- if (SG(server_context)) {
- SG(request_info).cookie_data = sapi_module.read_cookies(TSRMLS_C);
- if (sapi_module.activate) {
- sapi_module.activate(TSRMLS_C);
- }
- }
-}
-
-/*
- * Called from php_request_startup() for every request.
- */
-
-SAPI_API void sapi_activate(TSRMLS_D)
-{
- zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), (void (*)(void *)) sapi_free_header, 0);
- SG(sapi_headers).send_default_content_type = 1;
-
- /*
- SG(sapi_headers).http_response_code = 200;
- */
- SG(sapi_headers).http_status_line = NULL;
- SG(headers_sent) = 0;
- SG(read_post_bytes) = 0;
- SG(request_info).post_data = NULL;
- SG(request_info).raw_post_data = NULL;
- SG(request_info).current_user = NULL;
- SG(request_info).current_user_length = 0;
- SG(request_info).no_headers = 0;
-
- /* It's possible to override this general case in the activate() callback, if
- * necessary.
- */
- if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) {
- SG(request_info).headers_only = 1;
- } else {
- SG(request_info).headers_only = 0;
- }
- SG(rfc1867_uploaded_files) = NULL;
-
- /* handle request mehtod */
- if (SG(server_context)) {
- if ( SG(request_info).request_method) {
- if(!strcmp(SG(request_info).request_method, "POST")
- && (SG(request_info).content_type)) {
- /* HTTP POST -> may contain form data to be read into variables
- depending on content type given
- */
- sapi_read_post_data(TSRMLS_C);
- } else {
- /* any other method with content payload will fill
- $HTTP_RAW_POST_DATA if enabled by always_populate_raw_post_data
- it is up to the webserver to decide whether to allow a method or not
- */
- SG(request_info).content_type_dup = NULL;
- if(sapi_module.default_post_reader) {
- sapi_module.default_post_reader(TSRMLS_C);
- }
- }
- } else {
- SG(request_info).content_type_dup = NULL;
- }
-
- /* Cookies */
- SG(request_info).cookie_data = sapi_module.read_cookies(TSRMLS_C);
- if (sapi_module.activate) {
- sapi_module.activate(TSRMLS_C);
- }
- }
-}
-
-
-static void sapi_send_headers_free(TSRMLS_D)
-{
- if (SG(sapi_headers).http_status_line) {
- efree(SG(sapi_headers).http_status_line);
- SG(sapi_headers).http_status_line = NULL;
- }
-}
-
-SAPI_API void sapi_deactivate(TSRMLS_D)
-{
- zend_llist_destroy(&SG(sapi_headers).headers);
- if (SG(request_info).post_data) {
- efree(SG(request_info).post_data);
- } else if (SG(server_context)) {
- if(sapi_module.read_post) {
- /* make sure we've consumed all request input data */
- char dummy[SAPI_POST_BLOCK_SIZE];
- int read_bytes;
-
- while((read_bytes = sapi_module.read_post(dummy, sizeof(dummy)-1 TSRMLS_CC)) > 0) {
- SG(read_post_bytes) += read_bytes;
- }
- }
- }
- if (SG(request_info).raw_post_data) {
- efree(SG(request_info).raw_post_data);
- }
- if (SG(request_info).auth_user) {
- efree(SG(request_info).auth_user);
- }
- if (SG(request_info).auth_password) {
- efree(SG(request_info).auth_password);
- }
- if (SG(request_info).content_type_dup) {
- efree(SG(request_info).content_type_dup);
- }
- if (SG(request_info).current_user) {
- efree(SG(request_info).current_user);
- }
- if (sapi_module.deactivate) {
- sapi_module.deactivate(TSRMLS_C);
- }
- if (SG(rfc1867_uploaded_files)) {
- destroy_uploaded_files_hash(TSRMLS_C);
- }
- if (SG(sapi_headers).mimetype) {
- efree(SG(sapi_headers).mimetype);
- SG(sapi_headers).mimetype = NULL;
- }
- sapi_send_headers_free(TSRMLS_C);
- SG(sapi_started) = 0;
- SG(headers_sent) = 0;
- SG(request_info).headers_read = 0;
-}
-
-
-SAPI_API void sapi_initialize_empty_request(TSRMLS_D)
-{
- SG(server_context) = NULL;
- SG(request_info).request_method = NULL;
- SG(request_info).auth_user = SG(request_info).auth_password = NULL;
- SG(request_info).content_type_dup = NULL;
-}
-
-
-static int sapi_extract_response_code(const char *header_line)
-{
- int code = 200;
- const char *ptr;
-
- for (ptr = header_line; *ptr; ptr++) {
- if (*ptr == ' ' && *(ptr + 1) != ' ') {
- code = atoi(ptr + 1);
- break;
- }
- }
-
- return code;
-}
-
-
-static void sapi_update_response_code(int ncode TSRMLS_DC)
-{
- if (SG(sapi_headers).http_status_line) {
- efree(SG(sapi_headers).http_status_line);
- SG(sapi_headers).http_status_line = NULL;
- }
- SG(sapi_headers).http_response_code = ncode;
-}
-
-static int sapi_find_matching_header(void *element1, void *element2)
-{
- return strncasecmp(((sapi_header_struct*)element1)->header, (char*)element2, strlen((char*)element2)) == 0;
-}
-
-SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace TSRMLS_DC)
-{
- sapi_header_line ctr = {0};
- int r;
-
- ctr.line = header_line;
- ctr.line_len = header_line_len;
-
- r = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD,
- &ctr TSRMLS_CC);
-
- if (!duplicate)
- efree(header_line);
-
- return r;
-}
-
-SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
-{
- int retval;
- sapi_header_struct sapi_header;
- char *colon_offset;
- long myuid = 0L;
- char *header_line;
- uint header_line_len;
- zend_bool replace;
- int http_response_code;
-
- if (SG(headers_sent) && !SG(request_info).no_headers) {
- char *output_start_filename = php_get_output_start_filename(TSRMLS_C);
- int output_start_lineno = php_get_output_start_lineno(TSRMLS_C);
-
- if (output_start_filename) {
- sapi_module.sapi_error(E_WARNING, "Cannot modify header information - headers already sent by (output started at %s:%d)",
- output_start_filename, output_start_lineno);
- } else {
- sapi_module.sapi_error(E_WARNING, "Cannot modify header information - headers already sent");
- }
- return FAILURE;
- }
-
- switch (op) {
- case SAPI_HEADER_SET_STATUS:
- sapi_update_response_code((int) arg TSRMLS_CC);
- return SUCCESS;
-
- case SAPI_HEADER_REPLACE:
- case SAPI_HEADER_ADD: {
- sapi_header_line *p = arg;
- header_line = p->line;
- header_line_len = p->line_len;
- http_response_code = p->response_code;
- replace = (op == SAPI_HEADER_REPLACE);
- break;
- }
-
- default:
- return FAILURE;
- }
-
- header_line = estrndup(header_line, header_line_len);
-
- /* cut of trailing spaces, linefeeds and carriage-returns */
- while(isspace(header_line[header_line_len-1]))
- header_line[--header_line_len]='\0';
-
-
- sapi_header.header = header_line;
- sapi_header.header_len = header_line_len;
- sapi_header.replace = replace;
-
- /* Check the header for a few cases that we have special support for in SAPI */
- if (header_line_len>=5
- && !strncasecmp(header_line, "HTTP/", 5)) {
- /* filter out the response code */
- sapi_update_response_code(sapi_extract_response_code(header_line) TSRMLS_CC);
- SG(sapi_headers).http_status_line = header_line;
- return SUCCESS;
- } else {
- colon_offset = strchr(header_line, ':');
- if (colon_offset) {
- *colon_offset = 0;
- if (!STRCASECMP(header_line, "Content-Type")) {
- char *ptr = colon_offset+1, *mimetype = NULL, *newheader;
- size_t len = header_line_len - (ptr - header_line), newlen;
- while (*ptr == ' ' && *ptr != '\0') {
- ptr++;
- }
-#if HAVE_ZLIB
- if(!strncmp(ptr, "image/", sizeof("image/")-1)) {
- zend_alter_ini_entry("zlib.output_compression", sizeof("zlib.output_compression"), "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- }
-#endif
- mimetype = estrdup(ptr);
- newlen = sapi_apply_default_charset(&mimetype, len TSRMLS_CC);
- if (!SG(sapi_headers).mimetype){
- SG(sapi_headers).mimetype = estrdup(mimetype);
- }
-
- if (newlen != 0) {
- newlen += sizeof("Content-type: ");
- newheader = emalloc(newlen);
- PHP_STRLCPY(newheader, "Content-type: ", newlen, sizeof("Content-type: ")-1);
- strlcat(newheader, mimetype, newlen);
- sapi_header.header = newheader;
- sapi_header.header_len = newlen - 1;
- efree(header_line);
- }
- efree(mimetype);
- SG(sapi_headers).send_default_content_type = 0;
- } else if (!STRCASECMP(header_line, "Location")) {
- if (SG(sapi_headers).http_response_code < 300 ||
- SG(sapi_headers).http_response_code > 307) {
- /* Return a Found Redirect if one is not already specified */
- sapi_update_response_code(302 TSRMLS_CC);
- }
- } else if (!STRCASECMP(header_line, "WWW-Authenticate")) { /* HTTP Authentication */
- int newlen;
- char *result, *newheader;
-
- sapi_update_response_code(401 TSRMLS_CC); /* authentication-required */
-
- if(PG(safe_mode))
-#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
- {
- zval *repl_temp;
- char *ptr = colon_offset+1;
- int ptr_len=0, result_len = 0;
-
- myuid = php_getuid();
-
- ptr_len = strlen(ptr);
- MAKE_STD_ZVAL(repl_temp);
- Z_TYPE_P(repl_temp) = IS_STRING;
- Z_STRVAL_P(repl_temp) = emalloc(32);
- Z_STRLEN_P(repl_temp) = sprintf(Z_STRVAL_P(repl_temp), "realm=\"\\1-%ld\"", myuid);
- /* Modify quoted realm value */
- result = php_pcre_replace("/realm=\"(.*?)\"/i", 16,
- ptr, ptr_len,
- repl_temp,
- 0, &result_len, -1 TSRMLS_CC);
- if(result_len==ptr_len) {
- efree(result);
- sprintf(Z_STRVAL_P(repl_temp), "realm=\\1-%ld\\2", myuid);
- /* modify unquoted realm value */
- result = php_pcre_replace("/realm=([^\\s]+)(.*)/i", 21,
- ptr, ptr_len,
- repl_temp,
- 0, &result_len, -1 TSRMLS_CC);
- if(result_len==ptr_len) {
- char *lower_temp = estrdup(ptr);
- char conv_temp[32];
- int conv_len;
-
- php_strtolower(lower_temp,strlen(lower_temp));
- /* If there is no realm string at all, append one */
- if(!strstr(lower_temp,"realm")) {
- efree(result);
- conv_len = sprintf(conv_temp, " realm=\"%ld\"",myuid);
- result = emalloc(ptr_len+conv_len+1);
- result_len = ptr_len+conv_len;
- memcpy(result, ptr, ptr_len);
- memcpy(result+ptr_len, conv_temp, conv_len);
- *(result+ptr_len+conv_len) = '\0';
- }
- efree(lower_temp);
- }
- }
- newlen = sizeof("WWW-Authenticate: ") + result_len;
- newheader = emalloc(newlen+1);
- sprintf(newheader,"WWW-Authenticate: %s", result);
- efree(header_line);
- sapi_header.header = newheader;
- sapi_header.header_len = newlen;
- efree(result);
- efree(Z_STRVAL_P(repl_temp));
- efree(repl_temp);
- }
-#else
- {
- myuid = php_getuid();
- result = emalloc(sizeof("WWW-Authenticate: ")+20);
- newlen = sprintf(result, "WWW-Authenticate: %ld", myuid);
- newheader = estrndup(result,newlen);
- efree(header_line);
- sapi_header.header = newheader;
- sapi_header.header_len = newlen;
- efree(result);
- }
-#endif
- }
- if (sapi_header.header==header_line) {
- *colon_offset = ':';
- }
- }
- }
- if (http_response_code) {
- sapi_update_response_code(http_response_code TSRMLS_CC);
- }
- if (sapi_module.header_handler) {
- retval = sapi_module.header_handler(&sapi_header, &SG(sapi_headers) TSRMLS_CC);
- } else {
- retval = SAPI_HEADER_ADD;
- }
- if (retval & SAPI_HEADER_DELETE_ALL) {
- zend_llist_clean(&SG(sapi_headers).headers);
- }
- if (retval & SAPI_HEADER_ADD) {
- /* in replace mode first remove the header if it already exists in the headers llist */
- if (replace) {
- colon_offset = strchr(sapi_header.header, ':');
- if (colon_offset) {
- char sav;
- colon_offset++;
- sav = *colon_offset;
- *colon_offset = 0;
- zend_llist_del_element(&SG(sapi_headers).headers, sapi_header.header, (int(*)(void*, void*))sapi_find_matching_header);
- *colon_offset = sav;
- }
- }
-
- zend_llist_add_element(&SG(sapi_headers).headers, (void *) &sapi_header);
- }
- return SUCCESS;
-}
-
-
-SAPI_API int sapi_send_headers(TSRMLS_D)
-{
- int retval;
- int ret = FAILURE;
-
- if (SG(headers_sent) || SG(request_info).no_headers) {
- return SUCCESS;
- }
-
-#if HAVE_ZLIB
- /* Add output compression headers at this late stage in order to make
- it possible to switch it off inside the script. */
-
- if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) {
- zval nm_zlib_get_coding_type;
- zval *uf_result = NULL;
-
- ZVAL_STRINGL(&nm_zlib_get_coding_type, "zlib_get_coding_type", sizeof("zlib_get_coding_type") - 1, 0);
-
- if (call_user_function_ex(CG(function_table), NULL, &nm_zlib_get_coding_type, &uf_result, 0, NULL, 1, NULL TSRMLS_CC) != FAILURE && uf_result != NULL && Z_TYPE_P(uf_result) == IS_STRING) {
- char buf[128];
- int len;
-
- assert(Z_STRVAL_P(uf_result) != NULL);
-
- len = snprintf(buf, sizeof(buf), "Content-Encoding: %s", Z_STRVAL_P(uf_result));
- if (len <= 0 || sapi_add_header(buf, len, 1) == FAILURE) {
- return FAILURE;
- }
- if (sapi_add_header("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1) == FAILURE) {
- return FAILURE;
- }
- }
- if (uf_result != NULL) {
- zval_ptr_dtor(&uf_result);
- }
- }
-#endif
-
- /* Success-oriented. We set headers_sent to 1 here to avoid an infinite loop
- * in case of an error situation.
- */
- SG(headers_sent) = 1;
-
- if (sapi_module.send_headers) {
- retval = sapi_module.send_headers(&SG(sapi_headers) TSRMLS_CC);
- } else {
- retval = SAPI_HEADER_DO_SEND;
- }
-
- switch (retval) {
- case SAPI_HEADER_SENT_SUCCESSFULLY:
- ret = SUCCESS;
- break;
- case SAPI_HEADER_DO_SEND: {
- sapi_header_struct http_status_line;
- char buf[255];
-
- if (SG(sapi_headers).http_status_line) {
- http_status_line.header = SG(sapi_headers).http_status_line;
- http_status_line.header_len = strlen(SG(sapi_headers).http_status_line);
- } else {
- http_status_line.header = buf;
- http_status_line.header_len = sprintf(buf, "HTTP/1.0 %d X", SG(sapi_headers).http_response_code);
- }
- sapi_module.send_header(&http_status_line, SG(server_context) TSRMLS_CC);
- }
- zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t) sapi_module.send_header, SG(server_context) TSRMLS_CC);
- if(SG(sapi_headers).send_default_content_type) {
- sapi_header_struct default_header;
-
- sapi_get_default_content_type_header(&default_header TSRMLS_CC);
- sapi_module.send_header(&default_header, SG(server_context) TSRMLS_CC);
- sapi_free_header(&default_header);
- }
- sapi_module.send_header(NULL, SG(server_context) TSRMLS_CC);
- ret = SUCCESS;
- break;
- case SAPI_HEADER_SEND_FAILED:
- SG(headers_sent) = 0;
- ret = FAILURE;
- break;
- }
-
- sapi_send_headers_free(TSRMLS_C);
-
- return ret;
-}
-
-
-SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entries)
-{
- sapi_post_entry *p=post_entries;
-
- while (p->content_type) {
- if (sapi_register_post_entry(p) == FAILURE) {
- return FAILURE;
- }
- p++;
- }
- return SUCCESS;
-}
-
-
-SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry)
-{
- return zend_hash_add(&known_post_content_types, post_entry->content_type, post_entry->content_type_len+1, (void *) post_entry, sizeof(sapi_post_entry), NULL);
-}
-
-SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry)
-{
- zend_hash_del(&known_post_content_types, post_entry->content_type, post_entry->content_type_len+1);
-}
-
-
-SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRMLS_D))
-{
- sapi_module.default_post_reader = default_post_reader;
- return SUCCESS;
-}
-
-
-SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC))
-{
- sapi_module.treat_data = treat_data;
- return SUCCESS;
-}
-
-SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len TSRMLS_DC))
-{
- sapi_module.input_filter = input_filter;
- return SUCCESS;
-}
-
-SAPI_API int sapi_flush(TSRMLS_D)
-{
- if (sapi_module.flush) {
- sapi_module.flush(SG(server_context));
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-SAPI_API struct stat *sapi_get_stat(TSRMLS_D)
-{
- if (sapi_module.get_stat) {
- return sapi_module.get_stat(TSRMLS_C);
- } else {
- if (!SG(request_info).path_translated || (VCWD_STAT(SG(request_info).path_translated, &SG(global_stat)) == -1)) {
- return NULL;
- }
- return &SG(global_stat);
- }
-}
-
-
-SAPI_API char *sapi_getenv(char *name, size_t name_len TSRMLS_DC)
-{
- if (sapi_module.getenv) {
- return sapi_module.getenv(name, name_len TSRMLS_CC);
- } else {
- return NULL;
- }
-}
-
-SAPI_API int sapi_get_fd(int *fd TSRMLS_DC)
-{
- if (sapi_module.get_fd) {
- return sapi_module.get_fd(fd TSRMLS_CC);
- } else {
- return FAILURE;
- }
-}
-
-SAPI_API int sapi_force_http_10(TSRMLS_D)
-{
- if (sapi_module.force_http_10) {
- return sapi_module.force_http_10(TSRMLS_C);
- } else {
- return FAILURE;
- }
-}
-
-
-SAPI_API int sapi_get_target_uid(uid_t *obj TSRMLS_DC)
-{
- if (sapi_module.get_target_uid) {
- return sapi_module.get_target_uid(obj TSRMLS_CC);
- } else {
- return FAILURE;
- }
-}
-
-SAPI_API int sapi_get_target_gid(gid_t *obj TSRMLS_DC)
-{
- if (sapi_module.get_target_gid) {
- return sapi_module.get_target_gid(obj TSRMLS_CC);
- } else {
- return FAILURE;
- }
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/SAPI.h b/main/SAPI.h
deleted file mode 100644
index 63e3534b06..0000000000
--- a/main/SAPI.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef SAPI_H
-#define SAPI_H
-
-#include "zend.h"
-#include "zend_llist.h"
-#include "zend_operators.h"
-#include <sys/stat.h>
-
-#define SAPI_OPTION_NO_CHDIR 1
-
-#define SAPI_POST_BLOCK_SIZE 4000
-
-#ifdef PHP_WIN32
-# ifdef SAPI_EXPORTS
-# define SAPI_API __declspec(dllexport)
-# else
-# define SAPI_API __declspec(dllimport)
-# endif
-#else
-#define SAPI_API
-#endif
-
-#undef shutdown
-
-typedef struct {
- char *header;
- uint header_len;
- zend_bool replace;
-} sapi_header_struct;
-
-
-typedef struct {
- zend_llist headers;
- int http_response_code;
- unsigned char send_default_content_type;
- char *mimetype;
- char *http_status_line;
-} sapi_headers_struct;
-
-
-typedef struct _sapi_post_entry sapi_post_entry;
-typedef struct _sapi_module_struct sapi_module_struct;
-
-
-extern SAPI_API sapi_module_struct sapi_module; /* true global */
-
-/* Some values in this structure needs to be filled in before
- * calling sapi_activate(). We WILL change the `char *' entries,
- * so make sure that you allocate a separate buffer for them
- * and that you free them after sapi_deactivate().
- */
-
-typedef struct {
- const char *request_method;
- char *query_string;
- char *post_data, *raw_post_data;
- char *cookie_data;
- long content_length;
- uint post_data_length, raw_post_data_length;
-
- char *path_translated;
- char *request_uri;
-
- const char *content_type;
-
- zend_bool headers_only;
- zend_bool no_headers;
- zend_bool headers_read;
-
- sapi_post_entry *post_entry;
-
- char *content_type_dup;
-
- /* for HTTP authentication */
- char *auth_user;
- char *auth_password;
-
- /* this is necessary for the CGI SAPI module */
- char *argv0;
-
- /* this is necessary for Safe Mode */
- char *current_user;
- int current_user_length;
-
- /* this is necessary for CLI module */
- int argc;
- char **argv;
-} sapi_request_info;
-
-
-typedef struct _sapi_globals_struct {
- void *server_context;
- sapi_request_info request_info;
- sapi_headers_struct sapi_headers;
- int read_post_bytes;
- unsigned char headers_sent;
- struct stat global_stat;
- char *default_mimetype;
- char *default_charset;
- HashTable *rfc1867_uploaded_files;
- long post_max_size;
- int options;
- zend_bool sapi_started;
-} sapi_globals_struct;
-
-
-#ifdef ZTS
-# define SG(v) TSRMG(sapi_globals_id, sapi_globals_struct *, v)
-SAPI_API extern int sapi_globals_id;
-#else
-# define SG(v) (sapi_globals.v)
-extern SAPI_API sapi_globals_struct sapi_globals;
-#endif
-
-SAPI_API void sapi_startup(sapi_module_struct *sf);
-SAPI_API void sapi_shutdown(void);
-SAPI_API void sapi_activate(TSRMLS_D);
-SAPI_API void sapi_deactivate(TSRMLS_D);
-SAPI_API void sapi_initialize_empty_request(TSRMLS_D);
-
-/*
- * This is the preferred and maintained API for
- * operating on HTTP headers.
- */
-
-/*
- * Always specify a sapi_header_line this way:
- *
- * sapi_header_line ctr = {0};
- */
-
-typedef struct {
- char *line; /* If you allocated this, you need to free it yourself */
- uint line_len;
- long response_code; /* long due to zend_parse_parameters compatibility */
-} sapi_header_line;
-
-typedef enum { /* Parameter: */
- SAPI_HEADER_REPLACE, /* sapi_header_line* */
- SAPI_HEADER_ADD, /* sapi_header_line* */
- SAPI_HEADER_SET_STATUS /* int */
-} sapi_header_op_enum;
-
-SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC);
-
-
-/* Deprecated functions. Use sapi_header_op instead. */
-SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace TSRMLS_DC);
-#define sapi_add_header(a, b, c) sapi_add_header_ex((a),(b),(c),1 TSRMLS_CC)
-
-
-SAPI_API int sapi_send_headers(TSRMLS_D);
-SAPI_API void sapi_free_header(sapi_header_struct *sapi_header);
-SAPI_API void sapi_handle_post(void *arg TSRMLS_DC);
-
-SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entry);
-SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry);
-SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry);
-SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRMLS_D));
-SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC));
-SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len TSRMLS_DC));
-
-SAPI_API int sapi_flush(TSRMLS_D);
-SAPI_API struct stat *sapi_get_stat(TSRMLS_D);
-SAPI_API char *sapi_getenv(char *name, size_t name_len TSRMLS_DC);
-
-SAPI_API char *sapi_get_default_content_type(TSRMLS_D);
-SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_header TSRMLS_DC);
-SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len TSRMLS_DC);
-SAPI_API void sapi_activate_headers_only(TSRMLS_D);
-
-SAPI_API int sapi_get_fd(int *fd TSRMLS_DC);
-SAPI_API int sapi_force_http_10(TSRMLS_D);
-
-SAPI_API int sapi_get_target_uid(uid_t * TSRMLS_DC);
-SAPI_API int sapi_get_target_gid(gid_t * TSRMLS_DC);
-
-struct _sapi_module_struct {
- char *name;
- char *pretty_name;
-
- int (*startup)(struct _sapi_module_struct *sapi_module);
- int (*shutdown)(struct _sapi_module_struct *sapi_module);
-
- int (*activate)(TSRMLS_D);
- int (*deactivate)(TSRMLS_D);
-
- int (*ub_write)(const char *str, unsigned int str_length TSRMLS_DC);
- void (*flush)(void *server_context);
- struct stat *(*get_stat)(TSRMLS_D);
- char *(*getenv)(char *name, size_t name_len TSRMLS_DC);
-
- void (*sapi_error)(int type, const char *error_msg, ...);
-
- int (*header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC);
- int (*send_headers)(sapi_headers_struct *sapi_headers TSRMLS_DC);
- void (*send_header)(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC);
-
- int (*read_post)(char *buffer, uint count_bytes TSRMLS_DC);
- char *(*read_cookies)(TSRMLS_D);
-
- void (*register_server_variables)(zval *track_vars_array TSRMLS_DC);
- void (*log_message)(char *message);
-
- char *php_ini_path_override;
-
- void (*block_interruptions)(void);
- void (*unblock_interruptions)(void);
-
- void (*default_post_reader)(TSRMLS_D);
- void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC);
- char *executable_location;
-
- int php_ini_ignore;
-
- int (*get_fd)(int *fd TSRMLS_DC);
-
- int (*force_http_10)(TSRMLS_D);
-
- int (*get_target_uid)(uid_t * TSRMLS_DC);
- int (*get_target_gid)(gid_t * TSRMLS_DC);
-
- unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len TSRMLS_DC);
-
- void (*ini_defaults)(HashTable *configuration_hash);
- int phpinfo_as_text;
-};
-
-
-struct _sapi_post_entry {
- char *content_type;
- uint content_type_len;
- void (*post_reader)(TSRMLS_D);
- void (*post_handler)(char *content_type_dup, void *arg TSRMLS_DC);
-};
-
-/* header_handler() constants */
-#define SAPI_HEADER_ADD (1<<0)
-#define SAPI_HEADER_DELETE_ALL (1<<1)
-#define SAPI_HEADER_SEND_NOW (1<<2)
-
-
-#define SAPI_HEADER_SENT_SUCCESSFULLY 1
-#define SAPI_HEADER_DO_SEND 2
-#define SAPI_HEADER_SEND_FAILED 3
-
-#define SAPI_DEFAULT_MIMETYPE "text/html"
-#define SAPI_DEFAULT_CHARSET ""
-#define SAPI_PHP_VERSION_HEADER "X-Powered-By: PHP/" PHP_VERSION
-
-#define SAPI_POST_READER_FUNC(post_reader) void post_reader(TSRMLS_D)
-#define SAPI_POST_HANDLER_FUNC(post_handler) void post_handler(char *content_type_dup, void *arg TSRMLS_DC)
-
-#define SAPI_TREAT_DATA_FUNC(treat_data) void treat_data(int arg, char *str, zval* destArray TSRMLS_DC)
-#define SAPI_INPUT_FILTER_FUNC(input_filter) unsigned int input_filter(int arg, char *var, char **val, unsigned int val_len TSRMLS_DC)
-
-SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data);
-SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader);
-SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data);
-SAPI_API SAPI_INPUT_FILTER_FUNC(php_default_input_filter);
-
-#define STANDARD_SAPI_MODULE_PROPERTIES
-
-#endif /* SAPI_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/alloca.c b/main/alloca.c
deleted file mode 100644
index ae28159913..0000000000
--- a/main/alloca.c
+++ /dev/null
@@ -1,501 +0,0 @@
-/* alloca.c -- allocate automatically reclaimed memory
- (Mostly) portable public-domain implementation -- D A Gwyn
-
- This implementation of the PWB library alloca function,
- which is used to allocate space off the run-time stack so
- that it is automatically reclaimed upon procedure exit,
- was inspired by discussions with J. Q. Johnson of Cornell.
- J.Otto Tennant <jot@cray.com> contributed the Cray support.
-
- There are some preprocessor constants that can
- be defined when compiling for your specific system, for
- improved efficiency; however, the defaults should be okay.
-
- The general concept of this implementation is to keep
- track of all alloca-allocated blocks, and reclaim any
- that are found to be deeper in the stack than the current
- invocation. This heuristic does not reclaim storage as
- soon as it becomes invalid, but it will do so eventually.
-
- As a special case, alloca(0) reclaims storage without
- allocating any. It is a good idea to use alloca(0) in
- your main control loop, etc. to force garbage collection. */
-
-/* $Id$ */
-
-#include "php_config.h"
-
-#if !HAVE_ALLOCA
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef emacs
-#include "blockinput.h"
-#endif
-
-/* If compiling with GCC 2, this file's not needed. */
-#if !defined (__GNUC__) || __GNUC__ < 2
-
-/* If someone has defined alloca as a macro,
- there must be some other way alloca is supposed to work. */
-#ifndef alloca
-
-#ifdef emacs
-#ifdef static
-/* actually, only want this if static is defined as ""
- -- this is for usg, in which emacs must undefine static
- in order to make unexec workable
- */
-#ifndef STACK_DIRECTION
-you
-lose
--- must know STACK_DIRECTION at compile-time
-#endif /* STACK_DIRECTION undefined */
-#endif /* static */
-#endif /* emacs */
-
-/* If your stack is a linked list of frames, you have to
- provide an "address metric" ADDRESS_FUNCTION macro. */
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-long i00afunc ();
-#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
-#else
-#define ADDRESS_FUNCTION(arg) &(arg)
-#endif
-
-#if __STDC__
-typedef void *pointer;
-#else
-typedef char *pointer;
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* Define STACK_DIRECTION if you know the direction of stack
- growth for your system; otherwise it will be automatically
- deduced at run-time.
-
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-
-#ifndef STACK_DIRECTION
-#define STACK_DIRECTION 0 /* Direction unknown. */
-#endif
-
-#if STACK_DIRECTION != 0
-
-#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
-
-#else /* STACK_DIRECTION == 0; need run-time code. */
-
-static int stack_dir; /* 1 or -1 once known. */
-#define STACK_DIR stack_dir
-
-static void
-find_stack_direction ()
-{
- static char *addr = NULL; /* Address of first `dummy', once known. */
- auto char dummy; /* To get stack address. */
-
- if (addr == NULL)
- { /* Initial entry. */
- addr = ADDRESS_FUNCTION (dummy);
-
- find_stack_direction (); /* Recurse once. */
- }
- else
- {
- /* Second entry. */
- if (ADDRESS_FUNCTION (dummy) > addr)
- stack_dir = 1; /* Stack grew upward. */
- else
- stack_dir = -1; /* Stack grew downward. */
- }
-}
-
-#endif /* STACK_DIRECTION == 0 */
-
-/* An "alloca header" is used to:
- (a) chain together all alloca'ed blocks;
- (b) keep track of stack depth.
-
- It is very important that sizeof(header) agree with malloc
- alignment chunk size. The following default should work okay. */
-
-#ifndef ALIGN_SIZE
-#define ALIGN_SIZE sizeof(double)
-#endif
-
-typedef union hdr
-{
- char align[ALIGN_SIZE]; /* To force sizeof(header). */
- struct
- {
- union hdr *next; /* For chaining headers. */
- char *deep; /* For stack depth measure. */
- } h;
-} header;
-
-static header *last_alloca_header = NULL; /* -> last alloca header. */
-
-/* Return a pointer to at least SIZE bytes of storage,
- which will be automatically reclaimed upon exit from
- the procedure that called alloca. Originally, this space
- was supposed to be taken from the current stack frame of the
- caller, but that method cannot be made to work for some
- implementations of C, for example under Gould's UTX/32. */
-
-pointer
-alloca (size)
- size_t size;
-{
- auto char probe; /* Probes stack depth: */
- register char *depth = ADDRESS_FUNCTION (probe);
-
-#if STACK_DIRECTION == 0
- if (STACK_DIR == 0) /* Unknown growth direction. */
- find_stack_direction ();
-#endif
-
- /* Reclaim garbage, defined as all alloca'd storage that
- was allocated from deeper in the stack than currently. */
-
- {
- register header *hp; /* Traverses linked list. */
-
-#ifdef emacs
- BLOCK_INPUT;
-#endif
-
- for (hp = last_alloca_header; hp != NULL;)
- if ((STACK_DIR > 0 && hp->h.deep > depth)
- || (STACK_DIR < 0 && hp->h.deep < depth))
- {
- register header *np = hp->h.next;
-
- free ((pointer) hp); /* Collect garbage. */
-
- hp = np; /* -> next header. */
- }
- else
- break; /* Rest are not deeper. */
-
- last_alloca_header = hp; /* -> last valid storage. */
-
-#ifdef emacs
- UNBLOCK_INPUT;
-#endif
- }
-
- if (size == 0)
- return NULL; /* No allocation required. */
-
- /* Allocate combined header + user data storage. */
-
- {
- register pointer new = malloc (sizeof (header) + size);
- /* Address of header. */
-
- if (new == 0)
- abort();
-
- ((header *) new)->h.next = last_alloca_header;
- ((header *) new)->h.deep = depth;
-
- last_alloca_header = (header *) new;
-
- /* User storage begins just after header. */
-
- return (pointer) ((char *) new + sizeof (header));
- }
-}
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-
-#ifdef DEBUG_I00AFUNC
-#include <stdio.h>
-#endif
-
-#ifndef CRAY_STACK
-#define CRAY_STACK
-#ifndef CRAY2
-/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
-struct stack_control_header
- {
- long shgrow:32; /* Number of times stack has grown. */
- long shaseg:32; /* Size of increments to stack. */
- long shhwm:32; /* High water mark of stack. */
- long shsize:32; /* Current size of stack (all segments). */
- };
-
-/* The stack segment linkage control information occurs at
- the high-address end of a stack segment. (The stack
- grows from low addresses to high addresses.) The initial
- part of the stack segment linkage control information is
- 0200 (octal) words. This provides for register storage
- for the routine which overflows the stack. */
-
-struct stack_segment_linkage
- {
- long ss[0200]; /* 0200 overflow words. */
- long sssize:32; /* Number of words in this segment. */
- long ssbase:32; /* Offset to stack base. */
- long:32;
- long sspseg:32; /* Offset to linkage control of previous
- segment of stack. */
- long:32;
- long sstcpt:32; /* Pointer to task common address block. */
- long sscsnm; /* Private control structure number for
- microtasking. */
- long ssusr1; /* Reserved for user. */
- long ssusr2; /* Reserved for user. */
- long sstpid; /* Process ID for pid based multi-tasking. */
- long ssgvup; /* Pointer to multitasking thread giveup. */
- long sscray[7]; /* Reserved for Cray Research. */
- long ssa0;
- long ssa1;
- long ssa2;
- long ssa3;
- long ssa4;
- long ssa5;
- long ssa6;
- long ssa7;
- long sss0;
- long sss1;
- long sss2;
- long sss3;
- long sss4;
- long sss5;
- long sss6;
- long sss7;
- };
-
-#else /* CRAY2 */
-/* The following structure defines the vector of words
- returned by the STKSTAT library routine. */
-struct stk_stat
- {
- long now; /* Current total stack size. */
- long maxc; /* Amount of contiguous space which would
- be required to satisfy the maximum
- stack demand to date. */
- long high_water; /* Stack high-water mark. */
- long overflows; /* Number of stack overflow ($STKOFEN) calls. */
- long hits; /* Number of internal buffer hits. */
- long extends; /* Number of block extensions. */
- long stko_mallocs; /* Block allocations by $STKOFEN. */
- long underflows; /* Number of stack underflow calls ($STKRETN). */
- long stko_free; /* Number of deallocations by $STKRETN. */
- long stkm_free; /* Number of deallocations by $STKMRET. */
- long segments; /* Current number of stack segments. */
- long maxs; /* Maximum number of stack segments so far. */
- long pad_size; /* Stack pad size. */
- long current_address; /* Current stack segment address. */
- long current_size; /* Current stack segment size. This
- number is actually corrupted by STKSTAT to
- include the fifteen word trailer area. */
- long initial_address; /* Address of initial segment. */
- long initial_size; /* Size of initial segment. */
- };
-
-/* The following structure describes the data structure which trails
- any stack segment. I think that the description in 'asdef' is
- out of date. I only describe the parts that I am sure about. */
-
-struct stk_trailer
- {
- long this_address; /* Address of this block. */
- long this_size; /* Size of this block (does not include
- this trailer). */
- long unknown2;
- long unknown3;
- long link; /* Address of trailer block of previous
- segment. */
- long unknown5;
- long unknown6;
- long unknown7;
- long unknown8;
- long unknown9;
- long unknown10;
- long unknown11;
- long unknown12;
- long unknown13;
- long unknown14;
- };
-
-#endif /* CRAY2 */
-#endif /* not CRAY_STACK */
-
-#ifdef CRAY2
-/* Determine a "stack measure" for an arbitrary ADDRESS.
- I doubt that "lint" will like this much. */
-
-static long
-i00afunc (long *address)
-{
- struct stk_stat status;
- struct stk_trailer *trailer;
- long *block, size;
- long result = 0;
-
- /* We want to iterate through all of the segments. The first
- step is to get the stack status structure. We could do this
- more quickly and more directly, perhaps, by referencing the
- $LM00 common block, but I know that this works. */
-
- STKSTAT (&status);
-
- /* Set up the iteration. */
-
- trailer = (struct stk_trailer *) (status.current_address
- + status.current_size
- - 15);
-
- /* There must be at least one stack segment. Therefore it is
- a fatal error if "trailer" is null. */
-
- if (trailer == 0)
- abort ();
-
- /* Discard segments that do not contain our argument address. */
-
- while (trailer != 0)
- {
- block = (long *) trailer->this_address;
- size = trailer->this_size;
- if (block == 0 || size == 0)
- abort ();
- trailer = (struct stk_trailer *) trailer->link;
- if ((block <= address) && (address < (block + size)))
- break;
- }
-
- /* Set the result to the offset in this segment and add the sizes
- of all predecessor segments. */
-
- result = address - block;
-
- if (trailer == 0)
- {
- return result;
- }
-
- do
- {
- if (trailer->this_size <= 0)
- abort ();
- result += trailer->this_size;
- trailer = (struct stk_trailer *) trailer->link;
- }
- while (trailer != 0);
-
- /* We are done. Note that if you present a bogus address (one
- not in any segment), you will get a different number back, formed
- from subtracting the address of the first block. This is probably
- not what you want. */
-
- return (result);
-}
-
-#else /* not CRAY2 */
-/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
- Determine the number of the cell within the stack,
- given the address of the cell. The purpose of this
- routine is to linearize, in some sense, stack addresses
- for alloca. */
-
-static long
-i00afunc (long address)
-{
- long stkl = 0;
-
- long size, pseg, this_segment, stack;
- long result = 0;
-
- struct stack_segment_linkage *ssptr;
-
- /* Register B67 contains the address of the end of the
- current stack segment. If you (as a subprogram) store
- your registers on the stack and find that you are past
- the contents of B67, you have overflowed the segment.
-
- B67 also points to the stack segment linkage control
- area, which is what we are really interested in. */
-
- stkl = CRAY_STACKSEG_END ();
- ssptr = (struct stack_segment_linkage *) stkl;
-
- /* If one subtracts 'size' from the end of the segment,
- one has the address of the first word of the segment.
-
- If this is not the first segment, 'pseg' will be
- nonzero. */
-
- pseg = ssptr->sspseg;
- size = ssptr->sssize;
-
- this_segment = stkl - size;
-
- /* It is possible that calling this routine itself caused
- a stack overflow. Discard stack segments which do not
- contain the target address. */
-
- while (!(this_segment <= address && address <= stkl))
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
-#endif
- if (pseg == 0)
- break;
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- this_segment = stkl - size;
- }
-
- result = address - this_segment;
-
- /* If you subtract pseg from the current end of the stack,
- you get the address of the previous stack segment's end.
- This seems a little convoluted to me, but I'll bet you save
- a cycle somewhere. */
-
- while (pseg != 0)
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o\n", pseg, size);
-#endif
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- result += size;
- }
- return (result);
-}
-
-#endif /* not CRAY2 */
-#endif /* CRAY */
-
-#endif /* no alloca */
-#endif /* not GCC version 2 */
-#endif /* HAVE_ALLOCA */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/build-defs.h.in b/main/build-defs.h.in
deleted file mode 100644
index 81f20744d0..0000000000
--- a/main/build-defs.h.in
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- C -*-
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2002 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#define CONFIGURE_COMMAND "@CONFIGURE_COMMAND@"
-#define PHP_ADA_INCLUDE ""
-#define PHP_ADA_LFLAGS ""
-#define PHP_ADA_LIBS ""
-#define PHP_APACHE_INCLUDE ""
-#define PHP_APACHE_TARGET ""
-#define PHP_FHTTPD_INCLUDE ""
-#define PHP_FHTTPD_LIB ""
-#define PHP_FHTTPD_TARGET ""
-#define PHP_CFLAGS "@CFLAGS@"
-#define PHP_DBASE_LIB ""
-#define PHP_BUILD_DEBUG "@DEBUG_CFLAGS@"
-#define PHP_GDBM_INCLUDE ""
-#define PHP_HSREGEX ""
-#define PHP_IBASE_INCLUDE ""
-#define PHP_IBASE_LFLAGS ""
-#define PHP_IBASE_LIBS ""
-#define PHP_IFX_INCLUDE ""
-#define PHP_IFX_LFLAGS ""
-#define PHP_IFX_LIBS ""
-#define PHP_INSTALL_IT "@INSTALL_IT@"
-#define PHP_IODBC_INCLUDE ""
-#define PHP_IODBC_LFLAGS ""
-#define PHP_IODBC_LIBS ""
-#define PHP_MSQL_INCLUDE ""
-#define PHP_MSQL_LFLAGS ""
-#define PHP_MSQL_LIBS ""
-#define PHP_MYSQL_INCLUDE "@MYSQL_INCLUDE@"
-#define PHP_MYSQL_LIBS "@MYSQL_LIBS@"
-#define PHP_MYSQL_TYPE "@MYSQL_MODULE_TYPE@"
-#define PHP_ODBC_INCLUDE "@ODBC_INCLUDE@"
-#define PHP_ODBC_LFLAGS "@ODBC_LFLAGS@"
-#define PHP_ODBC_LIBS "@ODBC_LIBS@"
-#define PHP_ODBC_TYPE "@ODBC_TYPE@"
-#define PHP_OCI8_SHARED_LIBADD "@OCI8_SHARED_LIBADD@"
-#define PHP_OCI8_DIR "@OCI8_DIR@"
-#define PHP_OCI8_VERSION "@OCI8_VERSION@"
-#define PHP_ORACLE_SHARED_LIBADD "@ORACLE_SHARED_LIBADD@"
-#define PHP_ORACLE_DIR "@ORACLE_DIR@"
-#define PHP_ORACLE_VERSION "@ORACLE_VERSION@"
-#define PHP_PGSQL_INCLUDE ""
-#define PHP_PGSQL_LFLAGS ""
-#define PHP_PGSQL_LIBS ""
-#define PHP_PROG_SENDMAIL "@PROG_SENDMAIL@"
-#define PHP_REGEX_LIB ""
-#define PHP_SOLID_INCLUDE ""
-#define PHP_SOLID_LIBS ""
-#define PHP_EMPRESS_INCLUDE ""
-#define PHP_EMPRESS_LIBS ""
-#define PHP_SYBASE_INCLUDE ""
-#define PHP_SYBASE_LFLAGS ""
-#define PHP_SYBASE_LIBS ""
-#define PHP_DBM_TYPE ""
-#define PHP_DBM_LIB ""
-#define PHP_LDAP_LFLAGS ""
-#define PHP_LDAP_INCLUDE ""
-#define PHP_LDAP_LIBS ""
-#define PHP_BIRDSTEP_INCLUDE ""
-#define PHP_BIRDSTEP_LIBS ""
-#define PEAR_INSTALLDIR "@EXPANDED_PEAR_INSTALLDIR@"
-#define PHP_INCLUDE_PATH "@INCLUDE_PATH@"
-#define PHP_EXTENSION_DIR "@EXPANDED_EXTENSION_DIR@"
-#define PHP_PREFIX "@prefix@"
-#define PHP_BINDIR "@EXPANDED_BINDIR@"
-#define PHP_LIBDIR "@EXPANDED_LIBDIR@"
-#define PHP_DATADIR "@EXPANDED_DATADIR@"
-#define PHP_SYSCONFDIR "@EXPANDED_SYSCONFDIR@"
-#define PHP_LOCALSTATEDIR "@EXPANDED_LOCALSTATEDIR@"
-#define PHP_CONFIG_FILE_PATH "@EXPANDED_PHP_CONFIG_FILE_PATH@"
-#define PHP_CONFIG_FILE_SCAN_DIR "@EXPANDED_PHP_CONFIG_FILE_SCAN_DIR@"
-#define PHP_SHLIB_SUFFIX "@SHLIB_SUFFIX_NAME@"
diff --git a/main/config.nw.h b/main/config.nw.h
deleted file mode 100644
index e7b392ee1d..0000000000
--- a/main/config.nw.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* config.nw.h. Configure file for NetWare platform */
-
-
-/* Define if PHP to setup it's own SIGCHLD handler (not needed on NetWare) */
-#define PHP_SIGCHILD 0
-
-/* dns functions found in resolv.lib */
-#define HAVE_LIBBIND 1
-
-#define HAVE_GETSERVBYNAME 1
-#define HAVE_GETSERVBYPORT 1
-#define HAVE_GETPROTOBYNAME 1
-#define HAVE_GETPROTOBYNUMBER 1
-
-/* set to enable bcmath */
-#define WITH_BCMATH 1
-
-/* set to enable mysql */
-#define HAVE_MYSQL 1
-
-/* set to enable FTP support */
-#define HAVE_FTP 1
-
-/* set to enable SNMP */
-/*#define HAVE_SNMP 1*/
-
-/* defines for PostgreSQL extension */
-#define HAVE_PGSQL 1
-#define PHP_PGSQL_PRIVATE 1
-#define HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT 1
-#define HAVE_PQCLIENTENCODING 1
-#define HAVE_PQCMDTUPLES 1
-#define HAVE_PQOIDVALUE 1
-
-/* set to enable bundled PCRE library */
-#define HAVE_BUNDLED_PCRE 1
-
-/* set to enable bundled expat library */
-/* #define HAVE_LIBEXPAT 1 */ /* For now */
-#define HAVE_WDDX 0
-
-/* set to enable the crypt command */
-/* #define HAVE_CRYPT 1 */
-/* #define HAVE_CRYPT_H 1 */
-
-/* set to enable force cgi redirect */
-#define FORCE_CGI_REDIRECT 0
-
-/* should be added to runtime config*/
-#define PHP_URL_FOPEN 1
-
-#define STDIN_FILENO 0
-#define STDOUT_FILENO 1
-#define STDERR_FILENO 2
-
-/* ----------------------------------------------------------------
- The following are defaults for run-time configuration
- ---------------------------------------------------------------*/
-
-#define PHP_SAFE_MODE 0
-#define MAGIC_QUOTES 0
-
-
-/* Undefine if you want stricter XML/SGML compliance by default */
-/* this disables "<?expression?>" and "<?=expression?>" */
-#define DEFAULT_SHORT_OPEN_TAG "1"
-
-
-/* ----------------------------------------------------------------
- The following defines are for those modules which require
- external libraries to compile. These will be removed from
- here in a future beta, as these modules will be moved out to dll's
- ---------------------------------------------------------------*/
-#define HAVE_ERRMSG_H 0 /*needed for mysql 3.21.17 and up*/
-#undef HAVE_ADABAS
-#undef HAVE_SOLID
-
-
-/* ----------------------------------------------------------------
- The following may or may not be (or need to be) ported to the
- windows environment.
- ---------------------------------------------------------------*/
-
-/* Define if you have the link function. */
-#undef HAVE_LINK
-
-/* Define if you have the symlink function. */
-#undef HAVE_SYMLINK
-
-/* Define if you have the usleep function. */
-#undef HAVE_USLEEP
-
-#define HAVE_GETCWD 1
-/* #define HAVE_POSIX_READDIR_R 1 */ /* We will use readdir() from LibC */
-
-#define NEED_ISBLANK 1
-
-/* ----------------------------------------------------------------
- The following should never need to be played with
- Functions defined to 0 or remarked out are either already
- handled by the standard VC libraries, or are no longer needed, or
- simply will/can not be ported.
-
- DONT TOUCH!!!!! Unless you realy know what your messing with!
- ---------------------------------------------------------------*/
-
-#define DISCARD_PATH 0
-#undef HAVE_SETITIMER
-#undef HAVE_IODBC
-#define HAVE_UODBC 1
-#define HAVE_LIBDL 1
-#define HAVE_SENDMAIL 1
-
-/* Define if you have the gettimeofday function. */
-#define HAVE_GETTIMEOFDAY 1
-
-/* Define if you have the putenv function. */
-#define HAVE_PUTENV 1
-
-#define HAVE_LIMITS_H 1
-
-#define HAVE_TZSET 1
-#define HAVE_TZNAME 1
-
-/* Define if you have the flock function. */
-#undef HAVE_FLOCK
-
-/* Define if you have alloca, as a function or macro. */
-/* Though we have alloca(), this seems to be causing some problem with the stack pointer -- hence not using it */
-/* #define HAVE_ALLOCA 1 */
-
-/* Define if you have <sys/time.h> */
-#undef HAVE_SYS_TIME_H
-
-/* Define if you have <signal.h> */
-#define HAVE_SIGNAL_H 1
-
-/* Define if your struct stat has st_blksize. */
-#define HAVE_ST_BLKSIZE
-
-/* Define if your struct stat has st_blocks. */
-#define HAVE_ST_BLOCKS
-
-/* Define if your struct stat has st_rdev. */
-#define HAVE_ST_RDEV 1
-
-/* Define if utime(file, NULL) sets file's timestamp to the present. */
-#define HAVE_UTIME_NULL 1
-
-/* Define if you have the vprintf function. */
-#define HAVE_VPRINTF 1
-
-/* Define if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define both of these if you want the bundled REGEX library */
-#define REGEX 1
-#define HSREGEX 1
-
-#define HAVE_PCRE 1
-
-#define HAVE_LDAP 1
-
-/* Define if you have the gcvt function. */
-/* #define HAVE_GCVT 1 */
-
-/* Define if you have the getlogin function. */
-/* #define HAVE_GETLOGIN 1 */
-
-/* Define if you have the memcpy function. */
-#define HAVE_MEMCPY 1
-
-/* Define if you have the memmove function. */
-#define HAVE_MEMMOVE 1
-
-/* Define if you have the regcomp function. */
-#define HAVE_REGCOMP 1
-
-/* Define if you have the setlocale function. */
-/* #define HAVE_SETLOCALE 1 */ /* LibC doesn't seem to be supporting fully -- hence commenting for now */
-
-#define HAVE_LOCALECONV 1
-
-#define HAVE_LOCALE_H 1
-
-/* Define if you have the setvbuf function. */
-#ifndef HAVE_LIBBIND
-#define HAVE_SETVBUF 1
-#endif
-
-/* Define if you have the snprintf function. */
-#define HAVE_SNPRINTF 1
-#define HAVE_VSNPRINTF 1
-/* Define if you have the strcasecmp function. */
-#define HAVE_STRCASECMP 1
-
-/* Define if you have the strdup function. */
-#define HAVE_STRDUP 1
-
-/* Define if you have the strerror function. */
-#define HAVE_STRERROR 1
-
-/* Define if you have the strstr function. */
-#define HAVE_STRSTR 1
-
-/* Define if you have the tempnam function. */
-#define HAVE_TEMPNAM 1
-
-/* Define if you have the utime function. */
-#define HAVE_UTIME 1
-
-/* Define if you have the <dirent.h> header file. */
-#define HAVE_DIRENT_H 1
-
-/* Define if you have the <fcntl.h> header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define if you have the <grp.h> header file. */
-#define HAVE_GRP_H 0
-
-/* Define if you have the <pwd.h> header file. */
-#define HAVE_PWD_H 1
-
-/* Define if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define if you have the <sys/file.h> header file. */
-#undef HAVE_SYS_FILE_H
-
-/* Define if you have the <sys/socket.h> header file. */
-#ifdef USE_WINSOCK
-#undef HAVE_SYS_SOCKET_H
-#else
-#define HAVE_SYS_SOCKET_H 1 /* Added '1' for '#if' to work */
-#endif
-
-/* Define if you have the <sys/wait.h> header file. */
-#undef HAVE_SYS_WAIT_H
-
-/* Define if you have the <syslog.h> header file. */
-/* #define HAVE_SYSLOG_H 1 */
-
-/* Define if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1 /* Added '1' for '#if' to work */
-
-/* Define if you have the dl library (-ldl). */
-#define HAVE_LIBDL 1
-
-/* Define if you have the m library (-lm). */
-#define HAVE_LIBM 1
-
-/* Define if you have the cuserid function. */
-#define HAVE_CUSERID 0
-
-/* Define if you have the rint function. */
-#undef HAVE_RINT
-
-#define HAVE_STRFTIME 1
-
-/* Defined since unsetenv function is defined in LibC.
- * This is used to destroy env values in the function php_putenv_destructor.
- * If we do not use unsetenv, then the environment variables are directlt manipulated.
- * This will then result in LibC not being able to do the maintenance
- * that is required for NetWare.
- */
-#define HAVE_UNSETENV 1
-
-/* Default directory for loading extensions. */
-#define PHP_EXTENSION_DIR "sys:/php/ext"
-
-#define SIZEOF_INT 4
-
-/* Define directory constants for PHP and PEAR */
-
-/* This is the default configuration file to read */
-#define CONFIGURATION_FILE_PATH "php.ini"
-
-#define APACHE_MODULE_DIR "sys:/apache/modules"
-#define PHP_BINDIR "sys:/php"
-#define PHP_LIBDIR PHP_BINDIR
-#define PHP_DATADIR PHP_BINDIR
-#define PHP_SYSCONFDIR PHP_BINDIR
-#define PHP_LOCALSTATEDIR PHP_BINDIR
-#define PHP_CONFIG_FILE_PATH "sys:/php"
-#define PEAR_INSTALLDIR "sys:/php/pear"
-
-#define PHP_CONFIG_FILE_SCAN_DIR NULL
-#define PHP_EXTENSION_DIR "sys:/php/ext"
-
-#define PHP_INCLUDE_PATH NULL
-
-#define PHP_PREFIX "sys:/php"
-#define PHP_SHLIB_SUFFIX "nlm"
-
-#define USE_CONFIG_FILE 1
-
diff --git a/main/config.w32.h b/main/config.w32.h
deleted file mode 100644
index 8654cb2fb1..0000000000
--- a/main/config.w32.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- Build Configuration for Win32.
- This has only been tested with MS VisualC++ 6 (and later).
-
- $Id$
-*/
-
-/* Default PHP / PEAR directories */
-#define CONFIGURATION_FILE_PATH "php.ini"
-#define PEAR_INSTALLDIR "c:\\php4\\pear"
-#define PHP_BINDIR "c:\\php4"
-#define PHP_CONFIG_FILE_PATH (getenv("SystemRoot"))?getenv("SystemRoot"):""
-#define PHP_CONFIG_FILE_SCAN_DIR ""
-#define PHP_DATADIR "c:\\php4"
-#define PHP_EXTENSION_DIR "c:\\php4"
-#define PHP_INCLUDE_PATH ".;c:\\php4\\pear"
-#define PHP_LIBDIR "c:\\php4"
-#define PHP_LOCALSTATEDIR "c:\\php4"
-#define PHP_PREFIX "c:\\php4"
-#define PHP_SYSCONFDIR "c:\\php4"
-
-/* Enable / Disable BCMATH extension (default: enabled) */
-#define WITH_BCMATH 1
-
-/* Enable / Disable crypt() function (default: enabled) */
-#define HAVE_CRYPT 1
-#define PHP_STD_DES_CRYPT 1
-#define PHP_EXT_DES_CRYPT 0
-#define PHP_MD5_CRYPT 1
-#define PHP_BLOWFISH_CRYPT 0
-
-/* Enable / Disable CALENDAR extension (default: enabled) */
-#define HAVE_CALENDAR 1
-
-/* Enable / Disable RPC extension (default: enabled) */
-#define HAVE_RPC 1
-
-/* Enable / Disable COM extension (default: enabled) */
-#define HAVE_COM 1
-
-/* Enable / Disable CTYPE extension (default: enabled) */
-#define HAVE_CTYPE 1
-
-/* Enable / Disable FTP extension (default: enabled) */
-#define HAVE_FTP 1
-
-/* Enable / Disable MBSTRING extension (default: disabled) */
-/* #define HAVE_MBSTRING 0 */
-/* #define HAVE_MBREGEX 0 */
-/* #define HAVE_MBSTR_CN 0 */
-/* #define HAVE_MBSTR_JA 0 */
-/* #define HAVE_MBSTR_KR 0 */
-/* #define HAVE_MBSTR_RU 0 */
-/* #define HAVE_MBSTR_TW 0 */
-
-/* Enable / Disable MySQL extension (default: enabled) */
-#define HAVE_MYSQL 1
-
-/* Enable / Disable ODBC extension (default: enabled) */
-#define HAVE_UODBC 1
-
-/* Enable / Disable PCRE extension (default: enabled) */
-#define HAVE_BUNDLED_PCRE 1
-#define HAVE_PCRE 1
-
-/* Enable / Disable SESSION extension (default: enabled) */
-#define HAVE_SESSION 1
-
-/* Enable / Disable TOKENIZER extension (default: enabled) */
-#define HAVE_TOKENIZER 1
-
-/* Enable / Disable WDDX extension (default: enabled) */
-#define HAVE_WDDX 1
-
-/* Enable / Disable XML extension (default: enabled) */
-#define HAVE_LIBEXPAT 1
-
-/* Enable / Disable ZLIB extension (default: enabled) */
-#define HAVE_ZLIB 1
-
-/* PHP Runtime Configuration */
-#define FORCE_CGI_REDIRECT 1
-#define PHP_URL_FOPEN 1
-#define PHP_SAFE_MODE 0
-#define MAGIC_QUOTES 0
-#define USE_CONFIG_FILE 1
-#define DEFAULT_SHORT_OPEN_TAG "1"
-#define ENABLE_PATHINFO_CHECK 1
-
-/* Platform-Specific Configuration. Should not be changed. */
-#define PHP_SIGCHILD 0
-#define HAVE_LIBBIND 1
-#define HAVE_GETSERVBYNAME 1
-#define HAVE_GETSERVBYPORT 1
-#define HAVE_GETPROTOBYNAME 1
-#define HAVE_GETPROTOBYNUMBER 1
-#define STDIN_FILENO 0
-#define STDOUT_FILENO 1
-#define STDERR_FILENO 2
-#define HAVE_ERRMSG_H 0
-#undef HAVE_ADABAS
-#undef HAVE_SOLID
-#undef HAVE_LINK
-#undef HAVE_SYMLINK
-#undef HAVE_USLEEP
-#define HAVE_GETCWD 1
-#define HAVE_POSIX_READDIR_R 1
-#define NEED_ISBLANK 1
-#define DISCARD_PATH 0
-#undef HAVE_SETITIMER
-#undef HAVE_IODBC
-#define HAVE_LIBDL 1
-#define HAVE_SENDMAIL 1
-#define HAVE_GETTIMEOFDAY 1
-#define HAVE_PUTENV 1
-#define HAVE_LIMITS_H 1
-#define HAVE_TZSET 1
-#define HAVE_TZNAME 1
-#undef HAVE_FLOCK
-#define HAVE_ALLOCA 1
-#undef HAVE_SYS_TIME_H
-#define HAVE_SIGNAL_H 1
-#undef HAVE_ST_BLKSIZE
-#undef HAVE_ST_BLOCKS
-#define HAVE_ST_RDEV 1
-#define HAVE_UTIME_NULL 1
-#define HAVE_VPRINTF 1
-#define STDC_HEADERS 1
-#define REGEX 1
-#define HSREGEX 1
-#define HAVE_GCVT 1
-#define HAVE_GETLOGIN 1
-#define HAVE_GETTIMEOFDAY 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_PUTENV 1
-#define HAVE_REGCOMP 1
-#define HAVE_SETLOCALE 1
-#define HAVE_LOCALECONV 1
-#define HAVE_LOCALE_H 1
-#ifndef HAVE_LIBBIND
-#define HAVE_SETVBUF 1
-#endif
-#define HAVE_SHUTDOWN 1
-#define HAVE_SNPRINTF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRDUP 1
-#define HAVE_STRERROR 1
-#define HAVE_STRSTR 1
-#define HAVE_TEMPNAM 1
-#define HAVE_UTIME 1
-#undef HAVE_DIRENT_H
-#define HAVE_ASSERT_H 1
-#define HAVE_FCNTL_H 1
-#define HAVE_GRP_H 0
-#define HAVE_PWD_H 1
-#define HAVE_STRING_H 1
-#undef HAVE_SYS_FILE_H
-#undef HAVE_SYS_SOCKET_H
-#undef HAVE_SYS_WAIT_H
-#define HAVE_SYSLOG_H 1
-#undef HAVE_UNISTD_H
-#define HAVE_LIBDL 1
-#define HAVE_LIBM 1
-#define HAVE_CUSERID 0
-#undef HAVE_RINT
-#define HAVE_STRFTIME 1
-#define SIZEOF_INT 4
-#define HAVE_GLOB
-#define PHP_SHLIB_SUFFIX "dll"
-
-/* Win32 supports strcoll */
-#define HAVE_STRCOLL 1
-
-/* Win32 support proc_open */
-#define PHP_CAN_SUPPORT_PROC_OPEN 1
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
deleted file mode 100644
index d56d6c91e5..0000000000
--- a/main/fopen_wrappers.c
+++ /dev/null
@@ -1,570 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* {{{ includes
- */
-#include "php.h"
-#include "php_globals.h"
-#include "SAPI.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#ifdef PHP_WIN32
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#elif defined(NETWARE)
-/*#include <ws2nlm.h>*/
-/*#include <sys/socket.h>*/
-#ifdef NEW_LIBC
-#include <sys/param.h>
-#else
-#include "netware/param.h"
-#endif
-#else
-#include <sys/param.h>
-#endif
-
-#include "safe_mode.h"
-#include "ext/standard/head.h"
-#include "ext/standard/php_standard.h"
-#include "zend_compile.h"
-#include "php_network.h"
-
-#if HAVE_PWD_H
-#ifdef PHP_WIN32
-#include "win32/pwd.h"
-#elif defined(NETWARE)
-#include "netware/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-
-#include <sys/types.h>
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifndef S_ISREG
-#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
-#endif
-
-#ifdef PHP_WIN32
-#include <winsock2.h>
-#elif defined(NETWARE) && defined(USE_WINSOCK)
-/*#include <ws2nlm.h>*/
-#include <novsock2.h>
-#else
-#include <netinet/in.h>
-#include <netdb.h>
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif
-
-#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
-#undef AF_UNIX
-#endif
-
-#if defined(AF_UNIX)
-#include <sys/un.h>
-#endif
-/* }}} */
-
-/* {{{ php_check_specific_open_basedir
- When open_basedir is not NULL, check if the given filename is located in
- open_basedir. Returns -1 if error or not in the open_basedir, else 0
-
- When open_basedir is NULL, always return 0
-*/
-PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path TSRMLS_DC)
-{
- char resolved_name[MAXPATHLEN];
- char resolved_basedir[MAXPATHLEN];
- char local_open_basedir[MAXPATHLEN];
- int local_open_basedir_pos;
- int resolved_basedir_len;
- int resolved_name_len;
-
- /* Special case basedir==".": Use script-directory */
- if ((strcmp(basedir, ".") == 0) &&
- SG(request_info).path_translated &&
- *SG(request_info).path_translated
- ) {
- strlcpy(local_open_basedir, SG(request_info).path_translated, sizeof(local_open_basedir));
- local_open_basedir_pos = strlen(local_open_basedir) - 1;
-
- /* Strip filename */
- while (!IS_SLASH(local_open_basedir[local_open_basedir_pos])
- && (local_open_basedir_pos >= 0)) {
- local_open_basedir[local_open_basedir_pos--] = 0;
- }
- } else {
- /* Else use the unmodified path */
- strlcpy(local_open_basedir, basedir, sizeof(local_open_basedir));
- }
-
- /* Resolve the real path into resolved_name */
- if ((expand_filepath(path, resolved_name TSRMLS_CC) != NULL) && (expand_filepath(local_open_basedir, resolved_basedir TSRMLS_CC) != NULL)) {
- /* Handler for basedirs that end with a / */
- if (basedir[strlen(basedir)-1] == PHP_DIR_SEPARATOR) {
- resolved_basedir_len = strlen(resolved_basedir);
- resolved_basedir[resolved_basedir_len] = '/';
- resolved_basedir[++resolved_basedir_len] = '\0';
- } else {
- resolved_basedir_len = strlen(resolved_basedir);
- }
-
- if (path[strlen(path)-1] == PHP_DIR_SEPARATOR) {
- resolved_name_len = strlen(resolved_name);
- resolved_name[resolved_name_len] = '/';
- resolved_name[++resolved_name_len] = '\0';
- }
-
- /* Check the path */
-#ifdef PHP_WIN32
- if (strncasecmp(resolved_basedir, resolved_name, resolved_basedir_len) == 0) {
-#else
- if (strncmp(resolved_basedir, resolved_name, resolved_basedir_len) == 0) {
-#endif
- /* File is in the right directory */
- return 0;
- } else {
- return -1;
- }
- } else {
- /* Unable to resolve the real path, return -1 */
- return -1;
- }
-}
-/* }}} */
-
-/* {{{ php_check_open_basedir
- */
-PHPAPI int php_check_open_basedir(const char *path TSRMLS_DC)
-{
- /* Only check when open_basedir is available */
- if (PG(open_basedir) && *PG(open_basedir)) {
- char *pathbuf;
- char *ptr;
- char *end;
-
- pathbuf = estrdup(PG(open_basedir));
-
- ptr = pathbuf;
-
- while (ptr && *ptr) {
- end = strchr(ptr, DEFAULT_DIR_SEPARATOR);
- if (end != NULL) {
- *end = '\0';
- end++;
- }
-
- if (php_check_specific_open_basedir(ptr, path TSRMLS_CC) == 0) {
- efree(pathbuf);
- return 0;
- }
-
- ptr = end;
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s)", path, PG(open_basedir));
- efree(pathbuf);
- errno = EPERM; /* we deny permission to open it */
- return -1;
- }
-
- /* Nothing to check... */
- return 0;
-}
-/* }}} */
-
-/* {{{ php_check_safe_mode_include_dir
- */
-PHPAPI int php_check_safe_mode_include_dir(char *path TSRMLS_DC)
-{
- /* Only check when safe_mode or open_basedir is on and safe_mode_include_dir is available */
- if (((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) &&
- PG(safe_mode_include_dir) && *PG(safe_mode_include_dir))
- {
- char *pathbuf;
- char *ptr;
- char *end;
- char resolved_name[MAXPATHLEN];
-
- /* Resolve the real path into resolved_name */
- if (expand_filepath(path, resolved_name TSRMLS_CC) == NULL)
- return -1;
-
- pathbuf = estrdup(PG(safe_mode_include_dir));
-
- ptr = pathbuf;
-
- while (ptr && *ptr) {
- end = strchr(ptr, DEFAULT_DIR_SEPARATOR);
- if (end != NULL) {
- *end = '\0';
- end++;
- }
-
- /* Check the path */
-#ifdef PHP_WIN32
- if (strncasecmp(ptr, resolved_name, strlen(ptr)) == 0)
-#else
- if (strncmp(ptr, resolved_name, strlen(ptr)) == 0)
-#endif
- {
- /* File is in the right directory */
- efree(pathbuf);
- return 0;
- }
-
- ptr = end;
- }
- efree(pathbuf);
- return -1;
- }
-
- /* Nothing to check... */
- return 0;
-}
-/* }}} */
-
-/* {{{ php_fopen_and_set_opened_path
- */
-static FILE *php_fopen_and_set_opened_path(const char *path, char *mode, char **opened_path TSRMLS_DC)
-{
- FILE *fp;
-
- if (php_check_open_basedir((char *)path TSRMLS_CC)) {
- return NULL;
- }
- fp = VCWD_FOPEN(path, mode);
- if (fp && opened_path) {
- *opened_path = expand_filepath(path, NULL TSRMLS_CC);
- }
- return fp;
-}
-/* }}} */
-
-/* {{{ php_fopen_primary_script
- */
-PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC)
-{
- FILE *fp;
- struct stat st;
- char *path_info, *filename;
- int length;
-
- filename = SG(request_info).path_translated;
- path_info = SG(request_info).request_uri;
-#if HAVE_PWD_H
- if (PG(user_dir) && *PG(user_dir)
- && path_info && '/' == path_info[0] && '~' == path_info[1]) {
-
- char user[32];
- struct passwd *pw;
- char *s = strchr(path_info + 2, '/');
-
- filename = NULL; /* discard the original filename, it must not be used */
- if (s) { /* if there is no path name after the file, do not bother */
- /* to try open the directory */
- length = s - (path_info + 2);
- if (length > sizeof(user) - 1)
- length = sizeof(user) - 1;
- memcpy(user, path_info + 2, length);
- user[length] = '\0';
-
- pw = getpwnam(user);
- if (pw && pw->pw_dir) {
- filename = emalloc(strlen(PG(user_dir)) + strlen(path_info) + strlen(pw->pw_dir) + 4);
- if (filename) {
- sprintf(filename, "%s%c%s%c%s", pw->pw_dir, PHP_DIR_SEPARATOR,
- PG(user_dir), PHP_DIR_SEPARATOR, s+1); /* Safe */
- STR_FREE(SG(request_info).path_translated);
- SG(request_info).path_translated = filename;
- }
- }
- }
- } else
-#endif
- if (PG(doc_root) && path_info) {
- length = strlen(PG(doc_root));
- if (IS_ABSOLUTE_PATH(PG(doc_root), length)) {
- filename = emalloc(length + strlen(path_info) + 2);
- if (filename) {
- memcpy(filename, PG(doc_root), length);
- if (!IS_SLASH(filename[length - 1])) { /* length is never 0 */
- filename[length++] = PHP_DIR_SEPARATOR;
- }
- if (IS_SLASH(path_info[0])) {
- length--;
- }
- strcpy(filename + length, path_info);
- STR_FREE(SG(request_info).path_translated);
- SG(request_info).path_translated = filename;
- }
- }
- } /* if doc_root && path_info */
-
- if (!filename) {
- /* we have to free SG(request_info).path_translated here because
- php_destroy_request_info assumes that it will get
- freed when the include_names hash is emptied, but
- we're not adding it in this case */
- STR_FREE(SG(request_info).path_translated);
- SG(request_info).path_translated = NULL;
- return FAILURE;
- }
- fp = VCWD_FOPEN(filename, "rb");
-
- /* refuse to open anything that is not a regular file */
- if (fp && (0 > fstat(fileno(fp), &st) || !S_ISREG(st.st_mode))) {
- fclose(fp);
- fp = NULL;
- }
- if (!fp) {
- STR_FREE(SG(request_info).path_translated); /* for same reason as above */
- SG(request_info).path_translated = NULL;
- return FAILURE;
- }
-
- file_handle->opened_path = expand_filepath(filename, NULL TSRMLS_CC);
-
- if (!(SG(options) & SAPI_OPTION_NO_CHDIR)) {
- VCWD_CHDIR_FILE(filename);
- }
- SG(request_info).path_translated = filename;
-
- file_handle->filename = SG(request_info).path_translated;
- file_handle->free_filename = 0;
- file_handle->handle.fp = fp;
- file_handle->type = ZEND_HANDLE_FP;
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_fopen_with_path
- * Tries to open a file with a PATH-style list of directories.
- * If the filename starts with "." or "/", the path is ignored.
- */
-PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **opened_path TSRMLS_DC)
-{
- char *pathbuf, *ptr, *end;
- char *exec_fname;
- char trypath[MAXPATHLEN];
- struct stat sb;
- FILE *fp;
- int path_length;
- int filename_length;
- int exec_fname_length;
-
- if (opened_path) {
- *opened_path = NULL;
- }
-
- if(!filename) {
- return NULL;
- }
-
- filename_length = strlen(filename);
-
- /* Relative path open */
- if (*filename == '.') {
- if (PG(safe_mode) && (!php_checkuid(filename, mode, CHECKUID_CHECK_MODE_PARAM))) {
- return NULL;
- }
- return php_fopen_and_set_opened_path(filename, mode, opened_path TSRMLS_CC);
- }
-
- /*
- * files in safe_mode_include_dir (or subdir) are excluded from
- * safe mode GID/UID checks
- */
-
- /* Absolute path open */
- if (IS_ABSOLUTE_PATH(filename, filename_length)) {
- if ((php_check_safe_mode_include_dir(filename TSRMLS_CC)) == 0)
- /* filename is in safe_mode_include_dir (or subdir) */
- return php_fopen_and_set_opened_path(filename, mode, opened_path TSRMLS_CC);
-
- if (PG(safe_mode) && (!php_checkuid(filename, mode, CHECKUID_CHECK_MODE_PARAM)))
- return NULL;
-
- return php_fopen_and_set_opened_path(filename, mode, opened_path TSRMLS_CC);
- }
-
- if (!path || (path && !*path)) {
- if (PG(safe_mode) && (!php_checkuid(filename, mode, CHECKUID_CHECK_MODE_PARAM))) {
- return NULL;
- }
- return php_fopen_and_set_opened_path(filename, mode, opened_path TSRMLS_CC);
- }
-
- /* check in provided path */
- /* append the calling scripts' current working directory
- * as a fall back case
- */
- if (zend_is_executing(TSRMLS_C)) {
- exec_fname = zend_get_executed_filename(TSRMLS_C);
- exec_fname_length = strlen(exec_fname);
- path_length = strlen(path);
-
- while ((--exec_fname_length >= 0) && !IS_SLASH(exec_fname[exec_fname_length]));
- if ((exec_fname && exec_fname[0] == '[')
- || exec_fname_length<=0) {
- /* [no active file] or no path */
- pathbuf = estrdup(path);
- } else {
- pathbuf = (char *) emalloc(exec_fname_length + path_length +1 +1);
- memcpy(pathbuf, path, path_length);
- pathbuf[path_length] = DEFAULT_DIR_SEPARATOR;
- memcpy(pathbuf+path_length+1, exec_fname, exec_fname_length);
- pathbuf[path_length + exec_fname_length +1] = '\0';
- }
- } else {
- pathbuf = estrdup(path);
- }
-
- ptr = pathbuf;
-
- while (ptr && *ptr) {
- end = strchr(ptr, DEFAULT_DIR_SEPARATOR);
- if (end != NULL) {
- *end = '\0';
- end++;
- }
- snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename);
- if (PG(safe_mode)) {
- if (VCWD_STAT(trypath, &sb) == 0) {
- /* file exists ... check permission */
- if ((php_check_safe_mode_include_dir(trypath TSRMLS_CC) == 0) ||
- php_checkuid(trypath, mode, CHECKUID_CHECK_MODE_PARAM))
- /* UID ok, or trypath is in safe_mode_include_dir */
- fp = php_fopen_and_set_opened_path(trypath, mode, opened_path TSRMLS_CC);
- else
- fp = NULL;
-
- efree(pathbuf);
- return fp;
- }
- }
- fp = php_fopen_and_set_opened_path(trypath, mode, opened_path TSRMLS_CC);
- if (fp) {
- efree(pathbuf);
- return fp;
- }
- ptr = end;
- } /* end provided path */
-
- efree(pathbuf);
- return NULL;
-}
-/* }}} */
-
-/* {{{ php_strip_url_passwd
- */
-PHPAPI char *php_strip_url_passwd(char *url)
-{
- register char *p, *url_start;
-
- if (url == NULL) {
- return "";
- }
-
- p = url;
-
- while (*p) {
- if (*p==':' && *(p+1)=='/' && *(p+2)=='/') {
- /* found protocol */
- url_start = p = p+3;
-
- while (*p) {
- if (*p=='@') {
- int i;
-
- for (i=0; i<3 && url_start<p; i++, url_start++) {
- *url_start = '.';
- }
- for (; *p; p++) {
- *url_start++ = *p;
- }
- *url_start=0;
- break;
- }
- p++;
- }
- return url;
- }
- p++;
- }
- return url;
-}
-/* }}} */
-
-/* {{{ expand_filepath
- */
-PHPAPI char *expand_filepath(const char *filepath, char *real_path TSRMLS_DC)
-{
- cwd_state new_state;
- char cwd[MAXPATHLEN];
- char *result;
-
- result = VCWD_GETCWD(cwd, MAXPATHLEN);
- if (!result) {
- cwd[0] = '\0';
- }
-
- new_state.cwd = strdup(cwd);
- new_state.cwd_length = strlen(cwd);
-
- if(virtual_file_ex(&new_state, filepath, NULL, 1)) {
- free(new_state.cwd);
- return NULL;
- }
-
- if(real_path) {
- int copy_len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length;
- memcpy(real_path, new_state.cwd, copy_len);
- real_path[copy_len]='\0';
- } else {
- real_path = estrndup(new_state.cwd, new_state.cwd_length);
- }
- free(new_state.cwd);
-
- return real_path;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h
deleted file mode 100644
index 331360c267..0000000000
--- a/main/fopen_wrappers.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef FOPEN_WRAPPERS_H
-#define FOPEN_WRAPPERS_H
-
-BEGIN_EXTERN_C()
-#include "php_globals.h"
-
-PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC);
-PHPAPI char *expand_filepath(const char *filepath, char *real_path TSRMLS_DC);
-
-PHPAPI int php_check_open_basedir(const char *path TSRMLS_DC);
-PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path TSRMLS_DC);
-
-PHPAPI int php_check_safe_mode_include_dir(char *path TSRMLS_DC);
-
-PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **opened_path TSRMLS_DC);
-
-PHPAPI int php_is_url(char *path);
-PHPAPI char *php_strip_url_passwd(char *path);
-END_EXTERN_C()
-
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/internal_functions.c.in b/main/internal_functions.c.in
deleted file mode 100644
index 2af72800ac..0000000000
--- a/main/internal_functions.c.in
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- C -*-
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2002 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_main.h"
-#include "zend_modules.h"
-#include "internal_functions_registry.h"
-#include "zend_compile.h"
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#if HAVE_OPENSSL_EXT
-/* zlib typedefs free_func which causes problems if the SSL includes happen
- * after zlib.h is included */
-# include <openssl/ssl.h>
-#endif
-
-@EXT_INCLUDE_CODE@
-
-zend_module_entry *php_builtin_extensions[] = {
-@EXT_MODULE_PTRS@
-};
-
-#define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *))
-
-
-int php_startup_internal_extensions(void)
-{
- return php_startup_extensions(php_builtin_extensions, EXTCOUNT);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/internal_functions_nw.c b/main/internal_functions_nw.c
deleted file mode 100644
index 6d83ae60a2..0000000000
--- a/main/internal_functions_nw.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Modified for NetWare: Novell, Inc. |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* {{{ includes
- */
-#include "php.h"
-#include "php_main.h"
-#include "zend_modules.h"
-#include "internal_functions_registry.h"
-#include "zend_compile.h"
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "ext/bcmath/php_bcmath.h"
-#include "ext/gd/php_gd.h"
-#include "ext/standard/dl.h"
-#include "ext/standard/file.h"
-#include "ext/standard/fsock.h"
-#include "ext/standard/head.h"
-#include "ext/standard/pack.h"
-#include "ext/standard/php_browscap.h"
-/*#include "ext/standard/php_crypt.h"*/
-#include "ext/standard/php_dir.h"
-#include "ext/standard/php_filestat.h"
-#include "ext/standard/php_mail.h"
-/*#include "ext/standard/php_ext_syslog.h"*/
-#include "ext/standard/php_standard.h"
-#include "ext/standard/php_lcg.h"
-#include "ext/standard/php_array.h"
-#include "ext/standard/php_assert.h"
-#include "ext/calendar/php_calendar.h"
-/*#include "ext/com/php_COM.h"
-#include "ext/com/php_VARIANT.h"*/
-#include "ext/ftp/php_ftp.h"
-#include "ext/standard/reg.h"
-#include "ext/pcre/php_pcre.h"
-/*#include "ext/odbc/php_odbc.h"*/ /* Commented out for now */
-#include "ext/session/php_session.h"
-/*#include "ext/xml/php_xml.h"
-#include "ext/wddx/php_wddx.h"
-#include "ext/mysql/php_mysql.h"*/ /* Commented out for now */
-/* }}} */
-
-/* {{{ php_builtin_extensions[]
- */
-zend_module_entry *php_builtin_extensions[] = {
- phpext_standard_ptr,
-#if WITH_BCMATH
- phpext_bcmath_ptr,
-#endif
- phpext_calendar_ptr,
-/* COM_module_ptr,*/
- phpext_ftp_ptr,
-#if defined(MBSTR_ENC_TRANS)
- phpext_mbstring_ptr,
-#endif
-/* phpext_mysql_ptr,*/ /* Commented out for now */
-/* phpext_odbc_ptr, */ /* Commented out for now */
- phpext_pcre_ptr,
- phpext_session_ptr,
-/* phpext_xml_ptr,
- phpext_wddx_ptr */ /* Commented out for now */
-};
-/* }}} */
-
-#define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *))
-
-
-int php_startup_internal_extensions(void)
-{
- return php_startup_extensions(php_builtin_extensions, EXTCOUNT);
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/internal_functions_registry.h b/main/internal_functions_registry.h
deleted file mode 100644
index 60b254893a..0000000000
--- a/main/internal_functions_registry.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef INTERNAL_FUNCTIONS_REGISTRY_H
-#define INTERNAL_FUNCTIONS_REGISTRY_H
-
-extern int php_init_mime(INIT_FUNC_ARGS);
-
-/* environment functions */
-extern int php_init_environment(void);
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/internal_functions_win32.c b/main/internal_functions_win32.c
deleted file mode 100644
index 69d8cab177..0000000000
--- a/main/internal_functions_win32.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* {{{ includes
- */
-#include "php.h"
-#include "php_main.h"
-#include "zend_modules.h"
-#include "internal_functions_registry.h"
-#include "zend_compile.h"
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#ifndef ZEND_ENGINE_2
-#error HEAD does not work with ZendEngine1 anymore
-#endif
-
-#include "ext/standard/dl.h"
-#include "ext/standard/file.h"
-#include "ext/standard/fsock.h"
-#include "ext/standard/head.h"
-#include "ext/standard/pack.h"
-#include "ext/standard/php_browscap.h"
-#include "ext/standard/php_crypt.h"
-#include "ext/standard/php_dir.h"
-#include "ext/standard/php_filestat.h"
-#include "ext/standard/php_mail.h"
-#include "ext/standard/php_ext_syslog.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/php_lcg.h"
-#include "ext/standard/php_array.h"
-#include "ext/standard/php_assert.h"
-#if WITH_BCMATH
-#include "ext/bcmath/php_bcmath.h"
-#endif
-#if HAVE_CALENDAR
-#include "ext/calendar/php_calendar.h"
-#endif
-#if HAVE_CTYPE
-#include "ext/ctype/php_ctype.h"
-#endif
-#if HAVE_RPC
-#include "ext/rpc/php_rpc.h"
-#if HAVE_COM
-#include "ext/rpc/com/php_com.h"
-#endif
-#endif
-#if HAVE_FTP
-#include "ext/ftp/php_ftp.h"
-#endif
-#include "ext/standard/reg.h"
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
-#include "ext/pcre/php_pcre.h"
-#endif
-#if HAVE_UODBC
-#include "ext/odbc/php_odbc.h"
-#endif
-#if HAVE_SESSION
-#include "ext/session/php_session.h"
-#endif
-#if HAVE_LIBEXPAT
-#include "ext/xml/php_xml.h"
-#endif
-#if HAVE_LIBEXPAT && HAVE_WDDX
-#include "ext/wddx/php_wddx.h"
-#endif
-#if HAVE_MYSQL
-#include "ext/mysql/php_mysql.h"
-#endif
-#if HAVE_MBSTRING
-#include "ext/mbstring/mbstring.h"
-#endif
-#if HAVE_TOKENIZER
-#include "ext/tokenizer/php_tokenizer.h"
-#endif
-#if HAVE_ZLIB
-#include "ext/zlib/php_zlib.h"
-#endif
-/* }}} */
-
-/* {{{ php_builtin_extensions[]
- */
-zend_module_entry *php_builtin_extensions[] = {
- phpext_standard_ptr
-#if WITH_BCMATH
- ,phpext_bcmath_ptr
-#endif
-#if HAVE_CALENDAR
- ,phpext_calendar_ptr
-#endif
-#if HAVE_CTYPE
- ,phpext_ctype_ptr
-#endif
-#if HAVE_RPC
- ,phpext_rpc_ptr
-#if HAVE_COM
- ,phpext_com_ptr
-#endif
-#endif
-#if HAVE_FTP
- ,phpext_ftp_ptr
-#endif
-#if HAVE_MBSTRING
- ,phpext_mbstring_ptr
-#endif
-#if HAVE_MYSQL
- ,phpext_mysql_ptr
-#endif
-#if HAVE_UODBC
- ,phpext_odbc_ptr
-#endif
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
- ,phpext_pcre_ptr
-#endif
-#if HAVE_SESSION
- ,phpext_session_ptr
-#endif
-#if HAVE_TOKENIZER
- ,phpext_tokenizer_ptr
-#endif
-#if HAVE_LIBEXPAT
- ,phpext_xml_ptr
-#endif
-#if HAVE_LIBEXPAT && HAVE_WDDX
- ,phpext_wddx_ptr
-#endif
-#if HAVE_ZLIB
- ,phpext_zlib_ptr
-#endif
-};
-/* }}} */
-
-#define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *))
-
-int php_startup_internal_extensions(void)
-{
- return php_startup_extensions(php_builtin_extensions, EXTCOUNT);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/logos.h b/main/logos.h
deleted file mode 100644
index e175ec3aa8..0000000000
--- a/main/logos.h
+++ /dev/null
@@ -1,1544 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#define CONTEXT_TYPE_IMAGE_GIF "Content-Type: image/gif"
-
-unsigned char zend_logo[] = {
- 71, 73, 70, 56, 57, 97, 100, 0, 58, 0,
- 247, 255, 0, 255, 255, 255, 8, 8, 8, 24,
- 24, 24, 57, 57, 57, 74, 74, 74, 90, 90,
- 90, 99, 99, 99, 123, 123, 123, 132, 132, 132,
- 140, 140, 140, 148, 148, 148, 189, 189, 189, 214,
- 214, 214, 231, 231, 231, 239, 239, 239, 90, 99,
- 99, 222, 231, 239, 57, 66, 74, 165, 173, 181,
- 0, 8, 16, 214, 222, 231, 57, 66, 82, 16,
- 33, 66, 0, 8, 24, 24, 41, 82, 222, 231,
- 255, 57, 66, 90, 198, 206, 231, 181, 189, 214,
- 99, 107, 132, 0, 8, 33, 189, 198, 231, 123,
- 132, 165, 148, 165, 231, 123, 140, 206, 123, 148,
- 239, 49, 66, 132, 24, 33, 66, 49, 74, 165,
- 214, 222, 255, 206, 214, 247, 181, 189, 222, 148,
- 156, 189, 123, 132, 173, 156, 173, 247, 132, 148,
- 214, 99, 115, 181, 49, 57, 90, 41, 49, 82,
- 90, 107, 181, 82, 99, 173, 24, 33, 74, 57,
- 82, 189, 49, 74, 173, 16, 24, 57, 8, 16,
- 49, 198, 206, 247, 181, 189, 231, 165, 173, 214,
- 99, 107, 148, 74, 82, 123, 140, 156, 239, 66,
- 74, 115, 115, 132, 222, 41, 49, 90, 57, 74,
- 165, 49, 66, 148, 49, 66, 156, 41, 57, 140,
- 57, 82, 206, 33, 49, 123, 57, 82, 214, 16,
- 24, 66, 198, 206, 255, 181, 189, 239, 189, 198,
- 255, 156, 165, 214, 140, 148, 198, 132, 140, 189,
- 115, 123, 173, 90, 99, 148, 132, 148, 247, 123,
- 140, 239, 107, 123, 214, 115, 132, 231, 57, 66,
- 115, 107, 123, 222, 115, 132, 239, 57, 66, 123,
- 99, 115, 214, 90, 107, 214, 74, 90, 181, 74,
- 90, 189, 66, 82, 173, 57, 74, 173, 49, 66,
- 165, 66, 90, 231, 49, 66, 173, 24, 33, 90,
- 41, 57, 156, 33, 49, 140, 8, 16, 66, 181,
- 189, 247, 165, 173, 231, 148, 156, 214, 132, 140,
- 198, 115, 123, 181, 82, 90, 148, 49, 57, 115,
- 99, 115, 231, 90, 107, 231, 82, 99, 214, 82,
- 99, 222, 74, 90, 206, 82, 99, 231, 66, 82,
- 189, 33, 41, 99, 57, 74, 189, 57, 74, 198,
- 57, 74, 206, 49, 66, 181, 41, 57, 165, 24,
- 33, 99, 16, 24, 82, 8, 16, 74, 173, 181,
- 247, 173, 181, 255, 165, 173, 247, 140, 148, 214,
- 156, 165, 239, 165, 173, 255, 156, 165, 247, 132,
- 140, 214, 140, 148, 231, 99, 107, 173, 107, 115,
- 189, 115, 123, 206, 123, 132, 222, 99, 107, 189,
- 82, 90, 165, 90, 99, 181, 74, 82, 156, 82,
- 90, 173, 90, 99, 189, 66, 74, 140, 57, 66,
- 140, 57, 66, 148, 41, 49, 115, 74, 90, 222,
- 74, 90, 231, 41, 49, 132, 66, 82, 222, 33,
- 41, 115, 33, 41, 123, 24, 33, 107, 24, 33,
- 123, 16, 24, 90, 148, 156, 247, 140, 148, 239,
- 132, 140, 231, 140, 148, 247, 132, 140, 239, 123,
- 132, 231, 107, 115, 206, 123, 132, 239, 123, 132,
- 247, 99, 107, 206, 99, 107, 214, 82, 90, 181,
- 90, 99, 206, 49, 57, 148, 41, 49, 148, 33,
- 41, 140, 239, 239, 247, 247, 247, 255, 198, 198,
- 206, 214, 214, 222, 173, 173, 181, 189, 189, 198,
- 148, 148, 156, 156, 156, 165, 231, 231, 247, 239,
- 239, 255, 173, 173, 189, 90, 90, 99, 231, 231,
- 255, 222, 222, 247, 140, 140, 156, 66, 66, 74,
- 132, 132, 148, 198, 198, 222, 123, 123, 140, 173,
- 173, 198, 107, 107, 123, 222, 222, 255, 57, 57,
- 66, 49, 49, 57, 156, 156, 181, 198, 198, 231,
- 140, 140, 165, 181, 181, 214, 90, 90, 107, 214,
- 214, 255, 165, 165, 198, 82, 82, 99, 123, 123,
- 148, 74, 74, 90, 115, 115, 140, 33, 33, 41,
- 99, 99, 123, 156, 156, 198, 90, 90, 115, 132,
- 132, 173, 173, 173, 231, 165, 165, 222, 24, 24,
- 33, 82, 82, 115, 156, 156, 222, 115, 115, 165,
- 57, 57, 82, 107, 107, 156, 123, 123, 181, 33,
- 33, 49, 156, 156, 231, 82, 82, 123, 49, 49,
- 74, 107, 107, 165, 74, 74, 115, 148, 148, 231,
- 57, 57, 90, 41, 41, 66, 82, 82, 132, 66,
- 66, 107, 132, 132, 214, 140, 140, 231, 99, 99,
- 165, 123, 123, 206, 66, 66, 115, 82, 82, 148,
- 123, 123, 222, 66, 66, 123, 8, 8, 16, 41,
- 41, 82, 49, 49, 99, 24, 24, 49, 41, 41,
- 90, 24, 24, 66, 8, 8, 24, 16, 16, 57,
- 8, 8, 41, 8, 8, 49, 8, 8, 57, 0,
- 0, 8, 0, 0, 16, 0, 0, 24, 0, 0,
- 0, 44, 0, 0, 0, 0, 100, 0, 58, 0,
- 0, 8, 255, 0, 255, 9, 28, 72, 176, 160,
- 193, 131, 8, 19, 42, 92, 200, 176, 161, 195,
- 135, 188, 146, 37, 131, 246, 176, 226, 193, 94,
- 188, 10, 6, 203, 104, 177, 99, 67, 99, 31,
- 140, 25, 75, 230, 177, 227, 200, 130, 39, 75,
- 170, 60, 104, 12, 87, 128, 103, 198, 40, 174,
- 108, 248, 1, 87, 193, 154, 51, 115, 10, 52,
- 198, 236, 31, 175, 15, 196, 124, 246, 58, 150,
- 17, 227, 203, 0, 2, 122, 9, 240, 121, 140,
- 232, 191, 94, 201, 130, 57, 229, 213, 148, 227,
- 63, 103, 199, 96, 218, 36, 104, 172, 89, 47,
- 140, 2, 159, 57, 19, 232, 236, 153, 206, 143,
- 199, 130, 33, 43, 118, 213, 216, 50, 96, 31,
- 4, 24, 139, 230, 204, 152, 179, 100, 198, 4,
- 240, 50, 166, 2, 88, 76, 144, 200, 144, 17,
- 53, 86, 12, 46, 69, 188, 133, 113, 114, 229,
- 11, 55, 104, 49, 14, 1, 226, 113, 56, 118,
- 150, 33, 72, 99, 207, 2, 252, 3, 70, 249,
- 222, 200, 98, 199, 122, 141, 236, 165, 226, 159,
- 138, 98, 206, 150, 113, 240, 92, 44, 192, 215,
- 211, 169, 145, 45, 93, 214, 235, 95, 128, 148,
- 3, 63, 4, 179, 13, 172, 54, 177, 145, 184,
- 140, 5, 173, 172, 176, 37, 87, 146, 255, 70,
- 23, 251, 0, 90, 119, 114, 99, 28, 158, 45,
- 197, 45, 50, 250, 210, 228, 200, 21, 15, 52,
- 254, 175, 169, 192, 99, 129, 41, 19, 255, 231,
- 103, 142, 31, 203, 158, 3, 139, 45, 227, 5,
- 19, 26, 94, 96, 204, 66, 82, 124, 187, 173,
- 236, 94, 244, 255, 150, 173, 103, 159, 177, 24,
- 178, 8, 120, 225, 183, 211, 49, 196, 224, 149,
- 76, 63, 252, 252, 6, 212, 66, 252, 152, 87,
- 145, 57, 30, 176, 132, 156, 64, 208, 112, 0,
- 82, 52, 255, 64, 163, 155, 0, 31, 44, 67,
- 33, 50, 74, 228, 128, 12, 52, 184, 85, 8,
- 24, 69, 208, 32, 35, 18, 78, 14, 254, 19,
- 82, 72, 102, 245, 211, 207, 63, 130, 49, 56,
- 163, 69, 48, 208, 115, 16, 52, 154, 17, 20,
- 0, 49, 215, 253, 131, 75, 60, 255, 108, 227,
- 141, 64, 252, 208, 163, 193, 112, 60, 22, 68,
- 204, 112, 3, 17, 3, 141, 0, 68, 182, 56,
- 37, 49, 247, 8, 116, 207, 5, 117, 89, 117,
- 80, 63, 19, 180, 248, 144, 61, 230, 204, 196,
- 15, 130, 252, 120, 83, 130, 152, 30, 177, 57,
- 80, 63, 30, 168, 224, 97, 66, 112, 186, 217,
- 208, 61, 224, 220, 168, 210, 4, 253, 204, 80,
- 142, 78, 13, 30, 196, 143, 7, 214, 96, 67,
- 103, 62, 122, 90, 196, 79, 59, 24, 204, 212,
- 79, 60, 232, 228, 3, 168, 157, 255, 240, 147,
- 143, 62, 148, 122, 224, 1, 165, 13, 149, 160,
- 205, 13, 156, 50, 228, 79, 62, 80, 72, 170,
- 83, 162, 5, 121, 80, 70, 62, 108, 242, 51,
- 65, 62, 155, 170, 255, 212, 15, 15, 226, 220,
- 224, 15, 159, 97, 226, 10, 230, 174, 97, 54,
- 24, 232, 160, 85, 156, 147, 37, 160, 168, 34,
- 233, 1, 31, 248, 120, 208, 107, 131, 23, 232,
- 147, 44, 167, 215, 228, 115, 77, 177, 72, 222,
- 144, 134, 19, 24, 224, 3, 171, 7, 247, 116,
- 219, 45, 183, 223, 198, 19, 79, 0, 174, 246,
- 67, 135, 33, 166, 2, 122, 129, 160, 249, 240,
- 177, 71, 62, 247, 140, 27, 192, 61, 250, 240,
- 161, 15, 181, 3, 221, 67, 79, 56, 229, 192,
- 96, 14, 168, 3, 241, 19, 128, 7, 108, 4,
- 98, 141, 59, 24, 216, 99, 195, 194, 12, 51,
- 76, 15, 61, 210, 114, 235, 129, 61, 46, 208,
- 17, 79, 168, 22, 249, 211, 42, 63, 55, 136,
- 161, 7, 18, 55, 72, 124, 195, 30, 72, 196,
- 202, 96, 60, 54, 148, 179, 195, 57, 155, 186,
- 26, 207, 61, 54, 72, 130, 130, 25, 138, 68,
- 194, 198, 36, 56, 231, 140, 51, 29, 98, 204,
- 96, 129, 13, 244, 76, 130, 134, 17, 218, 226,
- 235, 209, 5, 254, 20, 196, 207, 61, 248, 232,
- 145, 137, 30, 51, 148, 64, 143, 13, 30, 235,
- 67, 228, 67, 150, 142, 115, 142, 61, 19, 220,
- 35, 173, 13, 108, 120, 146, 203, 18, 158, 88,
- 49, 69, 22, 103, 79, 113, 202, 217, 169, 116,
- 65, 2, 29, 116, 44, 242, 13, 36, 249, 228,
- 179, 79, 62, 73, 43, 250, 101, 132, 72, 242,
- 255, 19, 143, 7, 72, 104, 194, 10, 17, 152,
- 96, 48, 131, 38, 152, 204, 224, 193, 197, 21,
- 45, 61, 79, 19, 240, 212, 51, 3, 6, 24,
- 24, 241, 67, 18, 174, 228, 146, 196, 18, 156,
- 115, 190, 249, 18, 130, 128, 194, 69, 23, 228,
- 152, 33, 9, 61, 209, 210, 83, 198, 13, 23,
- 152, 23, 232, 5, 30, 92, 19, 175, 140, 247,
- 132, 121, 177, 157, 253, 232, 179, 110, 131, 127,
- 95, 51, 3, 38, 171, 124, 177, 138, 17, 70,
- 168, 66, 7, 62, 215, 244, 26, 112, 131, 50,
- 226, 126, 13, 36, 213, 144, 19, 131, 36, 108,
- 64, 50, 133, 31, 185, 0, 0, 128, 43, 220,
- 111, 207, 125, 230, 126, 72, 177, 4, 14, 93,
- 248, 140, 4, 29, 152, 32, 206, 70, 21, 243,
- 200, 83, 78, 57, 219, 208, 115, 65, 60, 176,
- 75, 235, 79, 188, 189, 146, 75, 16, 63, 251,
- 232, 115, 143, 223, 250, 154, 129, 24, 44, 49,
- 4, 46, 60, 162, 17, 142, 24, 67, 61, 44,
- 128, 4, 120, 45, 235, 76, 19, 208, 212, 176,
- 12, 210, 143, 124, 96, 33, 16, 56, 240, 132,
- 41, 136, 113, 13, 1, 64, 163, 131, 83, 10,
- 161, 7, 71, 8, 141, 10, 173, 65, 18, 139,
- 64, 68, 54, 190, 145, 142, 67, 24, 129, 14,
- 51, 136, 161, 13, 22, 39, 174, 111, 105, 10,
- 92, 241, 242, 155, 175, 252, 182, 15, 36, 220,
- 205, 3, 55, 176, 128, 24, 255, 38, 65, 132,
- 24, 112, 224, 131, 196, 88, 132, 17, 48, 161,
- 135, 61, 36, 235, 30, 254, 64, 218, 61, 36,
- 72, 169, 165, 221, 192, 29, 223, 80, 70, 18,
- 130, 212, 144, 3, 228, 226, 15, 102, 248, 195,
- 33, 26, 177, 10, 34, 104, 98, 6, 72, 128,
- 88, 180, 174, 113, 13, 77, 229, 227, 6, 55,
- 88, 216, 195, 110, 208, 70, 111, 141, 235, 101,
- 251, 224, 4, 39, 98, 136, 129, 122, 16, 81,
- 8, 136, 128, 133, 102, 4, 16, 131, 49, 172,
- 34, 19, 154, 216, 195, 221, 46, 85, 55, 88,
- 5, 74, 80, 241, 200, 135, 5, 136, 48, 133,
- 36, 200, 164, 33, 3, 112, 133, 45, 146, 48,
- 10, 35, 120, 12, 19, 155, 96, 162, 24, 12,
- 103, 1, 123, 32, 97, 97, 37, 40, 193, 228,
- 48, 48, 202, 61, 76, 78, 106, 106, 236, 86,
- 62, 108, 160, 7, 77, 100, 2, 19, 153, 176,
- 4, 17, 134, 16, 132, 64, 106, 230, 26, 169,
- 192, 195, 42, 44, 161, 9, 78, 32, 161, 12,
- 251, 184, 193, 182, 254, 87, 197, 8, 218, 0,
- 3, 68, 24, 197, 53, 4, 114, 0, 90, 40,
- 64, 1, 214, 196, 102, 2, 122, 244, 143, 5,
- 0, 224, 15, 93, 152, 68, 61, 244, 64, 7,
- 75, 144, 161, 140, 150, 120, 33, 220, 198, 57,
- 78, 244, 101, 194, 8, 233, 92, 34, 220, 48,
- 144, 74, 160, 77, 13, 3, 182, 36, 3, 17,
- 86, 49, 255, 134, 47, 212, 160, 14, 63, 16,
- 228, 63, 4, 144, 5, 47, 172, 130, 137, 122,
- 68, 22, 188, 186, 165, 49, 133, 136, 139, 30,
- 208, 252, 196, 117, 24, 160, 73, 87, 120, 15,
- 0, 10, 24, 72, 1, 0, 224, 135, 57, 168,
- 179, 156, 252, 12, 131, 72, 195, 96, 130, 49,
- 8, 65, 8, 68, 72, 233, 42, 134, 240, 133,
- 48, 124, 1, 15, 97, 168, 193, 23, 136, 96,
- 137, 121, 174, 18, 19, 68, 24, 67, 30, 90,
- 234, 133, 158, 210, 32, 160, 154, 129, 70, 22,
- 194, 64, 4, 158, 113, 130, 100, 250, 192, 155,
- 140, 16, 148, 16, 129, 121, 109, 18, 159, 176,
- 69, 1, 8, 64, 0, 6, 36, 193, 15, 75,
- 224, 158, 50, 100, 209, 35, 1, 52, 64, 25,
- 169, 136, 196, 11, 49, 161, 203, 49, 132, 1,
- 15, 115, 136, 195, 35, 82, 193, 5, 60, 224,
- 161, 167, 117, 240, 66, 29, 236, 96, 135, 59,
- 164, 53, 21, 143, 216, 66, 35, 134, 64, 4,
- 156, 97, 2, 158, 121, 16, 41, 30, 234, 192,
- 133, 84, 164, 226, 13, 63, 104, 192, 32, 181,
- 16, 6, 98, 138, 225, 168, 253, 83, 214, 163,
- 152, 218, 212, 123, 148, 128, 17, 202, 88, 2,
- 10, 114, 193, 89, 63, 68, 97, 9, 0, 56,
- 65, 18, 134, 49, 16, 90, 184, 226, 10, 38,
- 176, 4, 206, 140, 144, 83, 19, 112, 225, 16,
- 211, 136, 192, 147, 152, 241, 4, 45, 255, 20,
- 225, 8, 69, 200, 130, 26, 180, 112, 132, 31,
- 104, 195, 25, 79, 170, 64, 52, 92, 224, 5,
- 33, 68, 66, 8, 47, 29, 108, 29, 70, 225,
- 4, 102, 12, 131, 24, 195, 152, 70, 44, 130,
- 154, 133, 47, 212, 84, 12, 123, 80, 100, 200,
- 226, 209, 60, 78, 249, 45, 31, 116, 168, 6,
- 14, 78, 225, 136, 69, 40, 34, 11, 109, 16,
- 196, 38, 205, 48, 139, 129, 16, 0, 0, 102,
- 224, 66, 95, 233, 48, 9, 18, 32, 247, 17,
- 29, 224, 162, 64, 152, 33, 2, 74, 180, 161,
- 25, 241, 56, 70, 19, 6, 96, 16, 1, 116,
- 96, 11, 255, 164, 171, 29, 226, 192, 4, 3,
- 112, 83, 32, 93, 29, 170, 37, 244, 128, 93,
- 146, 193, 138, 187, 143, 106, 230, 196, 214, 144,
- 132, 63, 160, 226, 164, 65, 208, 130, 25, 132,
- 225, 7, 65, 80, 96, 154, 3, 109, 64, 46,
- 74, 225, 5, 44, 76, 130, 172, 95, 152, 67,
- 58, 182, 114, 16, 98, 84, 163, 52, 182, 185,
- 218, 65, 162, 17, 135, 34, 220, 246, 13, 41,
- 240, 146, 65, 160, 97, 138, 26, 212, 116, 15,
- 144, 213, 135, 7, 118, 69, 89, 131, 44, 45,
- 31, 51, 88, 135, 25, 112, 80, 8, 68, 168,
- 227, 15, 73, 232, 195, 21, 212, 107, 128, 129,
- 40, 0, 0, 75, 40, 69, 28, 186, 16, 132,
- 71, 152, 226, 19, 228, 216, 141, 64, 226, 97,
- 128, 4, 32, 32, 255, 40, 1, 136, 5, 10,
- 40, 64, 128, 130, 16, 32, 1, 9, 192, 15,
- 63, 156, 112, 132, 75, 196, 161, 15, 248, 129,
- 70, 48, 20, 16, 140, 32, 9, 64, 11, 214,
- 213, 68, 133, 241, 161, 100, 127, 112, 247, 145,
- 78, 134, 147, 13, 230, 97, 8, 52, 152, 193,
- 12, 125, 72, 135, 35, 226, 224, 7, 87, 112,
- 85, 32, 196, 216, 222, 85, 253, 208, 135, 68,
- 252, 128, 173, 77, 232, 17, 47, 24, 144, 1,
- 205, 66, 160, 154, 56, 176, 130, 39, 40, 64,
- 96, 219, 208, 98, 108, 56, 104, 197, 116, 5,
- 130, 11, 55, 92, 34, 20, 18, 24, 136, 1,
- 40, 176, 1, 28, 216, 162, 1, 5, 160, 144,
- 41, 172, 107, 84, 69, 42, 25, 195, 77, 118,
- 114, 0, 250, 225, 53, 123, 204, 67, 156, 154,
- 216, 130, 25, 92, 161, 139, 225, 4, 224, 21,
- 218, 115, 69, 6, 250, 112, 138, 26, 212, 128,
- 6, 90, 232, 242, 63, 136, 225, 128, 64, 248,
- 186, 18, 159, 64, 1, 14, 220, 0, 6, 48,
- 4, 130, 22, 2, 33, 192, 18, 172, 64, 137,
- 74, 80, 1, 5, 25, 29, 168, 40, 42, 145,
- 3, 153, 48, 99, 3, 87, 168, 4, 37, 172,
- 128, 3, 197, 14, 84, 194, 154, 192, 64, 118,
- 35, 203, 221, 71, 51, 200, 101, 23, 160, 135,
- 17, 216, 161, 12, 205, 97, 72, 32, 193, 8,
- 119, 18, 72, 81, 4, 185, 114, 193, 20, 104,
- 255, 144, 137, 2, 62, 144, 182, 44, 200, 65,
- 14, 112, 0, 195, 37, 46, 209, 134, 93, 228,
- 91, 20, 245, 190, 4, 37, 164, 0, 129, 171,
- 165, 193, 10, 183, 128, 48, 7, 124, 61, 243,
- 75, 80, 129, 2, 65, 77, 69, 99, 233, 128,
- 100, 39, 42, 121, 169, 209, 174, 108, 61, 92,
- 96, 134, 19, 152, 161, 19, 77, 24, 136, 0,
- 28, 224, 10, 18, 183, 129, 176, 113, 240, 47,
- 1, 184, 25, 128, 178, 151, 29, 26, 33, 184,
- 132, 204, 213, 238, 6, 155, 255, 131, 0, 35,
- 152, 121, 191, 229, 128, 130, 90, 175, 96, 4,
- 1, 231, 69, 40, 212, 206, 247, 43, 8, 84,
- 0, 203, 46, 234, 99, 157, 173, 172, 71, 99,
- 140, 31, 54, 192, 130, 33, 206, 144, 229, 40,
- 148, 34, 10, 164, 21, 72, 44, 92, 177, 132,
- 78, 148, 66, 10, 140, 95, 66, 20, 164, 32,
- 100, 130, 8, 160, 26, 107, 151, 121, 27, 18,
- 144, 111, 82, 168, 93, 230, 149, 88, 66, 157,
- 255, 177, 130, 30, 32, 64, 32, 5, 104, 131,
- 204, 103, 47, 10, 129, 10, 245, 11, 47, 60,
- 234, 30, 86, 181, 56, 4, 69, 189, 32, 253,
- 192, 64, 19, 86, 152, 142, 31, 156, 162, 13,
- 109, 216, 129, 123, 1, 96, 11, 206, 157, 64,
- 24, 202, 16, 134, 43, 146, 16, 138, 206, 107,
- 253, 12, 106, 127, 185, 27, 174, 224, 118, 2,
- 72, 129, 18, 148, 224, 187, 255, 18, 86, 223,
- 122, 210, 251, 196, 215, 179, 55, 250, 223, 171,
- 251, 194, 236, 42, 116, 201, 221, 69, 72, 60,
- 110, 0, 133, 38, 184, 163, 10, 144, 112, 196,
- 90, 219, 160, 142, 235, 4, 128, 1, 218, 195,
- 124, 87, 245, 7, 125, 80, 11, 40, 16, 10,
- 178, 16, 11, 215, 129, 0, 177, 208, 128, 177,
- 176, 0, 125, 32, 7, 200, 87, 9, 96, 208,
- 118, 55, 151, 126, 151, 96, 6, 228, 23, 10,
- 177, 32, 16, 2, 240, 3, 51, 71, 123, 72,
- 55, 80, 169, 48, 4, 158, 52, 3, 72, 197,
- 45, 59, 36, 40, 212, 118, 14, 58, 208, 14,
- 51, 80, 5, 141, 176, 127, 165, 128, 31, 8,
- 176, 61, 2, 120, 2, 182, 80, 104, 2, 32,
- 1, 161, 48, 2, 102, 160, 110, 5, 96, 117,
- 75, 96, 6, 75, 48, 8, 161, 112, 5, 107,
- 87, 115, 249, 38, 5, 124, 167, 118, 26, 40,
- 16, 43, 112, 116, 87, 19, 13, 49, 199, 119,
- 84, 0, 1, 65, 245, 8, 145, 64, 7, 24,
- 128, 4, 72, 160, 100, 247, 64, 89, 110, 194,
- 60, 215, 112, 14, 213, 176, 14, 238, 112, 8,
- 234, 224, 9, 81, 48, 8, 108, 145, 111, 1,
- 200, 124, 39, 160, 61, 201, 246, 15, 180, 48,
- 8, 143, 183, 0, 3, 17, 12, 74, 112, 5,
- 110, 208, 6, 82, 64, 13, 221, 32, 7, 106,
- 55, 122, 55, 87, 116, 50, 55, 126, 2, 65,
- 13, 116, 255, 103, 126, 252, 176, 3, 68, 39,
- 7, 103, 96, 126, 132, 100, 4, 245, 128, 4,
- 140, 54, 134, 190, 98, 35, 55, 240, 4, 214,
- 128, 3, 40, 160, 12, 186, 32, 12, 181, 112,
- 73, 4, 16, 12, 6, 160, 138, 170, 184, 138,
- 50, 113, 107, 202, 208, 113, 119, 248, 15, 222,
- 16, 12, 218, 192, 13, 117, 22, 15, 210, 0,
- 7, 151, 96, 129, 111, 39, 10, 69, 167, 118,
- 125, 176, 122, 212, 112, 9, 61, 208, 10, 80,
- 18, 1, 59, 0, 2, 191, 16, 121, 235, 22,
- 3, 147, 48, 3, 16, 83, 59, 24, 179, 63,
- 150, 50, 3, 88, 224, 8, 136, 64, 8, 133,
- 208, 1, 21, 65, 11, 39, 240, 7, 161, 240,
- 9, 27, 0, 37, 67, 150, 13, 148, 160, 5,
- 110, 199, 11, 137, 64, 87, 113, 112, 4, 71,
- 16, 133, 255, 0, 2, 151, 0, 7, 31, 240,
- 10, 250, 69, 16, 241, 80, 12, 93, 128, 9,
- 22, 32, 59, 58, 134, 53, 93, 51, 75, 208,
- 164, 6, 22, 65, 11, 61, 64, 3, 65, 16,
- 4, 34, 192, 0, 2, 18, 37, 177, 240, 1,
- 71, 160, 5, 181, 241, 15, 3, 128, 8, 38,
- 240, 79, 62, 86, 13, 28, 1, 2, 240, 152,
- 5, 186, 240, 10, 181, 86, 16, 188, 32, 11,
- 136, 144, 7, 116, 80, 2, 139, 83, 141, 144,
- 228, 1, 244, 64, 2, 128, 48, 11, 5, 96,
- 0, 52, 89, 147, 54, 121, 147, 6, 255, 240,
- 10, 202, 176, 5, 186, 20, 4, 236, 0, 1,
- 177, 96, 0, 3, 80, 66, 5, 64, 11, 13,
- 144, 3, 169, 96, 7, 169, 112, 11, 52, 169,
- 0, 79, 112, 92, 95, 48, 87, 57, 160, 0,
- 52, 169, 2, 115, 32, 87, 89, 176, 1, 174,
- 64, 11, 5, 80, 66, 196, 96, 0, 177, 224,
- 11, 46, 96, 72, 116, 64, 15, 226, 194, 146,
- 210, 70, 15, 144, 208, 7, 228, 160, 3, 27,
- 176, 89, 22, 53, 135, 114, 201, 124, 40, 96,
- 12, 56, 96, 6, 142, 64, 7, 36, 176, 10,
- 143, 144, 13, 40, 160, 11, 181, 80, 11, 20,
- 128, 12, 135, 16, 4, 66, 96, 2, 142, 160,
- 3, 190, 224, 11, 28, 176, 6, 116, 0, 79,
- 253, 36, 2, 34, 97, 12, 78, 32, 4, 67,
- 160, 10, 95, 208, 5, 45, 240, 1, 186, 208,
- 10, 181, 0, 1, 41, 224, 4, 144, 128, 9,
- 100, 165, 7, 55, 240, 63, 109, 130, 50, 139,
- 96, 6, 139, 128, 1, 147, 224, 8, 160, 160,
- 12, 182, 240, 61, 180, 201, 61, 182, 144, 1,
- 127, 224, 8, 70, 32, 4, 132, 240, 7, 144,
- 128, 62, 171, 144, 7, 93, 32, 3, 50, 208,
- 8, 238, 96, 4, 171, 69, 60, 150, 224, 98,
- 243, 64, 7, 64, 0, 55, 172, 69, 4, 40,
- 133, 5, 99, 5, 79, 252, 20, 4, 142, 32,
- 3, 139, 224, 14, 108, 0, 55, 64, 32, 6,
- 233, 211, 64, 97, 255, 98, 17, 55, 48, 15,
- 238, 128, 6, 235, 80, 15, 11, 83, 15, 143,
- 96, 6, 185, 96, 11, 39, 16, 139, 242, 41,
- 159, 89, 150, 8, 150, 16, 53, 24, 192, 8,
- 103, 208, 8, 191, 179, 10, 100, 80, 83, 60,
- 83, 15, 125, 36, 6, 236, 100, 56, 62, 19,
- 67, 98, 0, 55, 152, 96, 83, 148, 163, 160,
- 240, 4, 160, 134, 83, 2, 63, 3, 134, 217,
- 85, 50, 104, 249, 15, 254, 160, 50, 220, 32,
- 14, 24, 112, 49, 94, 35, 6, 138, 176, 4,
- 154, 131, 105, 127, 80, 162, 38, 90, 162, 234,
- 208, 8, 245, 0, 49, 249, 80, 2, 144, 32,
- 2, 104, 132, 75, 122, 64, 74, 11, 99, 1,
- 22, 16, 67, 104, 36, 71, 83, 131, 4, 172,
- 68, 97, 72, 160, 48, 54, 96, 74, 24, 64,
- 78, 154, 64, 97, 51, 0, 52, 209, 178, 45,
- 30, 160, 15, 145, 197, 146, 23, 80, 14, 47,
- 176, 80, 174, 243, 55, 245, 128, 8, 162, 24,
- 8, 228, 64, 8, 234, 176, 165, 92, 170, 14,
- 233, 192, 8, 147, 176, 15, 220, 34, 46, 30,
- 0, 15, 80, 128, 15, 72, 160, 7, 31, 3,
- 71, 215, 160, 76, 55, 128, 15, 101, 112, 74,
- 110, 250, 166, 72, 224, 46, 21, 10, 71, 116,
- 138, 100, 106, 42, 6, 167,
- 4, 43, 221, 34, 47, 211, 6, 68, 254, 131,
- 49, 247, 16, 14, 124, 179, 63, 3, 83, 15,
- 104, 128, 2, 214, 255, 192, 14, 134, 96, 8,
- 235, 16, 169, 146, 186, 14, 80, 128, 14, 42,
- 121, 150, 126, 131, 15, 162, 89, 167, 198, 164,
- 76, 117, 3, 71, 61, 84, 6, 248, 0, 71,
- 111, 116, 3, 117, 154, 93, 36, 163, 45, 111,
- 234, 46, 122, 164, 71, 32, 67, 67, 191, 34,
- 16, 21, 148, 44, 191, 151, 47, 244, 80, 69,
- 247, 0, 5, 74, 144, 6, 231, 208, 14, 47,
- 80, 15, 47, 48, 15, 47, 16, 172, 243, 32,
- 172, 51, 112, 154, 14, 226, 58, 248, 0, 5,
- 108, 80, 161, 154, 114, 1, 223, 114, 41, 73,
- 245, 172, 83, 84, 55, 76, 250, 67, 83, 228,
- 1, 118, 83, 167, 238, 210, 64, 204, 116, 16,
- 23, 208, 72, 173, 243, 37, 183, 218, 84, 51,
- 224, 4, 91, 211, 72, 55, 36, 65, 235, 106,
- 113, 4, 209, 15, 123, 224, 14, 98, 128, 55,
- 227, 178, 67, 13, 18, 38, 228, 66, 46, 190,
- 18, 15, 19, 96, 120, 2, 243, 40, 110, 196,
- 45, 70, 83, 41, 174, 114, 63, 13, 165, 143,
- 215, 16, 42, 30, 176, 3, 232, 176, 146, 249,
- 154, 175, 13, 82, 118, 2, 3, 105, 111, 178,
- 15, 108, 208, 14, 172, 210, 56, 149, 34, 40,
- 145, 193, 93, 88, 179, 52, 209, 54, 176, 2,
- 33, 15, 207, 224, 1, 250, 170, 52, 27, 203,
- 32, 118, 99, 3, 225, 144, 46, 57, 225, 58,
- 23, 138, 36, 227, 137, 53, 227, 240, 2, 140,
- 61, 163, 18, 131, 146, 15, 220, 229, 13, 19,
- 100, 38, 20, 139, 53, 34, 171, 52, 224, 80,
- 14, 181, 90, 17, 21, 212, 58, 253, 48, 45,
- 47, 187, 130, 29, 241, 179, 10, 193, 15, 225,
- 16, 14, 183, 131, 36, 109, 2, 173, 14, 114,
- 179, 12, 225, 58, 78, 102, 175, 109, 226, 32,
- 1, 1, 0, 59 };
-
-unsigned char php_logo[] = {
- 71, 73, 70, 56, 57, 97, 120, 0, 67, 0,
- 247, 255, 0, 0, 0, 0, 73, 72, 73, 233,
- 231, 234, 228, 224, 232, 65, 64, 67, 228, 227,
- 230, 80, 78, 86, 61, 60, 64, 215, 213, 223,
- 201, 199, 213, 99, 97, 116, 84, 83, 92, 192,
- 190, 208, 105, 103, 127, 102, 100, 123, 183, 181,
- 203, 216, 215, 225, 143, 141, 174, 89, 88, 104,
- 160, 158, 186, 95, 94, 109, 106, 105, 133, 98,
- 97, 121, 165, 164, 189, 175, 174, 199, 151, 150,
- 196, 145, 144, 178, 161, 160, 194, 152, 151, 183,
- 7, 7, 10, 28, 28, 38, 14, 14, 19, 138,
- 138, 185, 129, 129, 173, 102, 102, 137, 151, 151,
- 202, 146, 146, 195, 145, 145, 194, 130, 130, 174,
- 116, 116, 155, 97, 97, 130, 152, 152, 202, 151,
- 151, 201, 149, 149, 198, 148, 148, 197, 147, 147,
- 196, 145, 145, 193, 142, 142, 189, 140, 140, 186,
- 137, 137, 182, 136, 136, 181, 133, 133, 177, 128,
- 128, 170, 113, 113, 150, 106, 106, 141, 101, 101,
- 134, 90, 90, 120, 3, 3, 4, 127, 127, 168,
- 99, 99, 131, 40, 40, 53, 146, 146, 192, 133,
- 133, 174, 120, 120, 157, 96, 96, 126, 48, 48,
- 63, 131, 131, 171, 101, 101, 130, 100, 100, 127,
- 135, 135, 170, 155, 155, 194, 138, 138, 172, 101,
- 101, 126, 113, 113, 140, 100, 100, 124, 170, 170,
- 199, 222, 222, 239, 217, 217, 234, 206, 206, 220,
- 58, 58, 61, 211, 211, 220, 231, 231, 238, 220,
- 220, 227, 215, 215, 220, 196, 196, 199, 209, 209,
- 211, 183, 183, 185, 253, 253, 254, 102, 103, 143,
- 138, 139, 188, 98, 99, 134, 124, 125, 168, 108,
- 109, 147, 133, 134, 180, 103, 104, 139, 99, 100,
- 134, 122, 123, 163, 144, 145, 188, 149, 150, 193,
- 127, 128, 165, 131, 132, 169, 157, 158, 199, 111,
- 115, 176, 113, 117, 178, 93, 96, 144, 116, 119,
- 178, 127, 131, 192, 118, 121, 178, 107, 110, 162,
- 120, 123, 180, 118, 121, 176, 115, 118, 171, 126,
- 129, 186, 120, 123, 177, 117, 120, 173, 106, 109,
- 155, 75, 77, 109, 113, 115, 163, 127, 130, 182,
- 110, 112, 157, 99, 101, 140, 98, 100, 137, 148,
- 151, 203, 119, 121, 163, 145, 148, 198, 139, 142,
- 189, 148, 151, 199, 55, 56, 74, 152, 155, 203,
- 153, 156, 203, 150, 153, 200, 154, 157, 204, 102,
- 104, 135, 76, 77, 100, 71, 72, 90, 194, 196,
- 227, 211, 212, 236, 207, 208, 231, 217, 218, 239,
- 223, 224, 242, 215, 216, 234, 212, 213, 229, 89,
- 93, 142, 112, 116, 176, 114, 118, 178, 113, 117,
- 177, 114, 118, 177, 116, 120, 179, 115, 120, 178,
- 115, 119, 178, 109, 113, 169, 117, 121, 180, 119,
- 123, 182, 118, 122, 180, 117, 122, 179, 124, 128,
- 188, 123, 127, 187, 122, 126, 185, 120, 124, 182,
- 119, 124, 181, 118, 122, 179, 102, 106, 155, 126,
- 130, 190, 124, 128, 187, 123, 127, 186, 121, 125,
- 183, 120, 124, 181, 119, 123, 180, 81, 84, 122,
- 118, 122, 177, 117, 121, 176, 125, 129, 185, 124,
- 128, 184, 123, 127, 183, 120, 124, 178, 123, 127,
- 181, 127, 131, 186, 96, 99, 141, 127, 131, 185,
- 102, 105, 149, 33, 34, 48, 132, 136, 190, 130,
- 134, 188, 63, 65, 91, 96, 99, 137, 136, 140,
- 192, 141, 145, 196, 146, 150, 200, 149, 153, 202,
- 146, 149, 193, 160, 163, 207, 167, 170, 212, 174,
- 177, 216, 186, 189, 224, 181, 184, 218, 200, 202,
- 231, 192, 194, 222, 203, 205, 233, 199, 201, 227,
- 203, 205, 228, 220, 221, 236, 231, 232, 247, 219,
- 220, 234, 220, 221, 234, 223, 224, 235, 97, 102,
- 150, 222, 223, 233, 226, 227, 237, 20, 21, 28,
- 216, 217, 224, 235, 236, 239, 217, 218, 219, 192,
- 192, 192, 4, 4, 2, 2, 2, 1, 3, 3,
- 2, 7, 7, 6, 21, 21, 19, 13, 13, 12,
- 28, 28, 26, 34, 34, 32, 16, 16, 15, 58,
- 58, 55, 93, 93, 89, 66, 66, 63, 23, 23,
- 22, 85, 85, 82, 88, 88, 85, 60, 60, 58,
- 58, 58, 56, 109, 109, 106, 104, 104, 101, 99,
- 99, 96, 80, 80, 78, 49, 49, 48, 46, 46,
- 45, 52, 52, 51, 152, 152, 150, 144, 144, 142,
- 169, 169, 168, 160, 160, 159, 122, 121, 119, 115,
- 114, 112, 137, 136, 134, 129, 128, 126, 55, 54,
- 53, 31, 30, 30, 62, 61, 61, 176, 176, 176,
- 39, 39, 39, 10, 10, 10, 8, 8, 8, 5,
- 5, 5, 1, 1, 1, 255, 255, 255, 0, 0,
- 0, 33, 249, 4, 1, 0, 0, 212, 0, 44,
- 0, 0, 0, 0, 120, 0, 67, 0, 64, 8,
- 255, 0, 169, 9, 28, 72, 176, 160, 193, 131,
- 8, 19, 42, 92, 200, 176, 161, 195, 135, 16,
- 9, 142, 88, 209, 194, 8, 134, 4, 80, 162,
- 33, 72, 240, 192, 8, 43, 72, 145, 42, 93,
- 202, 116, 170, 164, 201, 147, 39, 51, 93, 90,
- 201, 114, 36, 202, 151, 48, 79, 98, 50, 229,
- 201, 211, 169, 58, 92, 42, 40, 160, 192, 211,
- 193, 15, 24, 44, 84, 164, 136, 152, 48, 5,
- 11, 24, 71, 52, 112, 128, 97, 234, 82, 204,
- 83, 160, 162, 74, 157, 74, 245, 41, 168, 82,
- 78, 212, 1, 216, 186, 181, 27, 20, 88, 105,
- 166, 146, 124, 10, 149, 170, 89, 169, 100, 79,
- 117, 242, 132, 67, 29, 183, 117, 92, 90, 140,
- 64, 168, 226, 197, 157, 59, 117, 210, 158, 188,
- 100, 43, 10, 55, 174, 91, 243, 77, 153, 2,
- 165, 112, 2, 43, 237, 196, 237, 3, 220, 181,
- 10, 162, 119, 140, 1, 152, 171, 66, 165, 50,
- 21, 43, 240, 208, 233, 139, 156, 46, 81, 173,
- 4, 155, 1, 171, 155, 70, 216, 176, 21, 119,
- 1, 172, 69, 222, 54, 37, 215, 164, 152, 152,
- 68, 253, 1, 240, 97, 207, 10, 106, 38, 208,
- 56, 98, 83, 74, 175, 201, 71, 136, 230, 69,
- 182, 242, 43, 210, 75, 51, 193, 220, 69, 86,
- 39, 45, 31, 227, 122, 199, 60, 129, 58, 25,
- 9, 88, 187, 200, 237, 134, 17, 251, 198, 248,
- 154, 149, 93, 105, 142, 27, 255, 19, 206, 56,
- 0, 179, 82, 211, 201, 114, 66, 147, 163, 131,
- 137, 21, 49, 106, 228, 137, 197, 198, 38, 217,
- 74, 130, 160, 132, 142, 204, 31, 64, 191, 124,
- 243, 84, 81, 76, 45, 102, 152, 145, 136, 114,
- 140, 225, 3, 72, 37, 123, 193, 2, 69, 54,
- 140, 173, 195, 204, 47, 248, 244, 103, 225, 53,
- 234, 184, 35, 197, 48, 176, 24, 231, 219, 41,
- 106, 160, 178, 21, 29, 51, 176, 80, 144, 10,
- 46, 152, 80, 131, 22, 121, 224, 130, 197, 27,
- 165, 152, 2, 74, 38, 140, 140, 195, 152, 54,
- 211, 240, 193, 224, 135, 60, 146, 5, 74, 43,
- 77, 120, 195, 88, 54, 209, 212, 226, 84, 143,
- 40, 121, 162, 6, 27, 180, 108, 197, 131, 23,
- 52, 188, 112, 27, 81, 212, 164, 176, 130, 11,
- 49, 208, 112, 130, 13, 59, 160, 240, 133, 22,
- 90, 224, 49, 203, 29, 114, 96, 82, 147, 41,
- 72, 166, 201, 163, 39, 157, 108, 210, 73, 29,
- 56, 24, 194, 14, 55, 219, 108, 195, 195, 45,
- 64, 212, 176, 133, 12, 82, 206, 69, 229, 159,
- 12, 165, 160, 130, 10, 43, 176, 64, 130, 11,
- 47, 192, 0, 66, 12, 50, 204, 224, 168, 9,
- 144, 70, 42, 233, 164, 144, 58, 42, 131, 12,
- 32, 192, 240, 130, 11, 36, 176, 176, 194, 10,
- 42, 248, 9, 232, 168, 163, 166, 48, 2, 161,
- 44, 148, 177, 196, 3, 12, 64, 1, 1, 2,
- 176, 66, 255, 145, 64, 2, 12, 60, 128, 193,
- 18, 27, 24, 193, 65, 24, 97, 192, 192, 104,
- 23, 93, 204, 96, 66, 8, 91, 20, 187, 71,
- 29, 117, 204, 17, 74, 51, 186, 57, 226, 72,
- 44, 177, 228, 33, 2, 23, 39, 108, 49, 195,
- 11, 65, 141, 48, 20, 169, 68, 9, 74, 66,
- 24, 19, 96, 240, 192, 18, 98, 180, 2, 201,
- 145, 106, 162, 148, 70, 46, 2, 108, 195, 88,
- 58, 140, 200, 152, 174, 111, 152, 116, 114, 10,
- 23, 18, 4, 160, 111, 5, 82, 110, 219, 144,
- 81, 50, 128, 49, 6, 13, 109, 140, 245, 84,
- 26, 124, 88, 81, 141, 133, 253, 113, 227, 206,
- 51, 197, 101, 98, 198, 33, 241, 48, 220, 223,
- 58, 239, 32, 147, 75, 37, 146, 248, 98, 133,
- 197, 252, 229, 3, 207, 51, 190, 68, 98, 240,
- 73, 157, 128, 242, 71, 53, 252, 0, 33, 215,
- 64, 46, 212, 129, 70, 40, 233, 249, 150, 73,
- 38, 199, 128, 195, 216, 62, 9, 232, 18, 30,
- 74, 102, 12, 115, 29, 99, 227, 84, 177, 24,
- 96, 241, 32, 226, 161, 73, 102, 32, 130, 32,
- 96, 237, 252, 146, 72, 61, 140, 217, 35, 77,
- 45, 175, 1, 109, 140, 57, 145, 153, 51, 140,
- 25, 100, 153, 82, 74, 147, 127, 188, 32, 3,
- 22, 104, 52, 195, 227, 35, 192, 60, 205, 85,
- 58, 86, 224, 35, 55, 62, 240, 208, 35, 14,
- 132, 145, 137, 131, 12, 35, 1, 84, 255, 125,
- 245, 207, 37, 85, 226, 199, 20, 218, 188, 75,
- 140, 48, 228, 1, 38, 15, 21, 114, 199, 221,
- 78, 60, 233, 20, 222, 117, 50, 112, 100, 29,
- 118, 39, 65, 0, 192, 195, 12, 2, 173, 0,
- 3, 24, 55, 180, 88, 31, 76, 151, 56, 136,
- 55, 87, 219, 64, 49, 202, 36, 55, 183, 174,
- 87, 235, 176, 147, 5, 251, 205, 147, 216, 146,
- 64, 55, 140, 129, 243, 76, 43, 172, 199, 158,
- 174, 41, 33, 246, 163, 249, 15, 49, 176, 224,
- 239, 65, 35, 176, 240, 130, 9, 39, 220, 128,
- 66, 139, 120, 204, 161, 10, 38, 152, 160, 53,
- 239, 245, 37, 157, 149, 102, 41, 155, 168, 66,
- 135, 7, 91, 65, 99, 72, 13, 58, 128, 240,
- 50, 183, 7, 9, 186, 2, 9, 102, 135, 0,
- 198, 150, 206, 3, 129, 194, 16, 244, 15, 65,
- 4, 253, 132, 120, 97, 3, 23, 92, 220, 133,
- 236, 27, 114, 144, 131, 27, 82, 65, 64, 2,
- 186, 193, 13, 114, 120, 3, 178, 238, 192, 5,
- 27, 16, 130, 8, 22, 160, 128, 4, 22, 96,
- 128, 116, 232, 235, 130, 134, 144, 0, 14, 108,
- 80, 131, 61, 208, 160, 11, 48, 40, 1, 168,
- 142, 135, 190, 18, 166, 239, 84, 159, 42, 148,
- 24, 140, 192, 194, 13, 108, 96, 2, 48, 156,
- 0, 7, 102, 168, 129, 8, 28, 161, 8, 100,
- 208, 193, 22, 192, 176, 135, 30, 110, 33, 4,
- 93, 200, 130, 11, 255, 90, 224, 169, 65, 145,
- 208, 132, 72, 28, 136, 169, 40, 98, 145, 4,
- 72, 97, 0, 2, 16, 192, 0, 164, 64, 140,
- 37, 244, 66, 22, 166, 200, 68, 26, 206, 0,
- 137, 73, 204, 232, 102, 243, 50, 133, 216, 74,
- 17, 163, 76, 172, 65, 129, 92, 240, 194, 13,
- 144, 160, 4, 37, 56, 160, 1, 53, 240, 129,
- 8, 133, 146, 196, 133, 36, 175, 7, 27, 96,
- 21, 173, 48, 208, 135, 83, 72, 34, 13, 39,
- 67, 146, 36, 132, 33, 141, 66, 26, 82, 26,
- 141, 144, 23, 246, 76, 98, 166, 82, 120, 226,
- 13, 54, 160, 192, 2, 40, 168, 0, 33, 4,
- 165, 132, 42, 32, 129, 82, 38, 112, 1, 14,
- 188, 130, 117, 139, 60, 78, 48, 134, 6, 152,
- 119, 4, 3, 108, 161, 212, 139, 41, 236, 133,
- 2, 2, 212, 131, 29, 18, 120, 1, 29, 27,
- 50, 130, 22, 116, 129, 12, 71, 56, 194, 43,
- 2, 153, 146, 52, 8, 227, 25, 203, 8, 166,
- 48, 135, 25, 76, 100, 52, 33, 17, 198, 248,
- 133, 45, 206, 64, 9, 147, 84, 98, 16, 86,
- 16, 30, 96, 204, 113, 5, 101, 12, 115, 111,
- 137, 56, 132, 47, 86, 241, 136, 35, 101, 2,
- 20, 196, 96, 6, 49, 199, 185, 12, 99, 34,
- 243, 23, 29, 106, 38, 76, 56, 33, 135, 63,
- 100, 35, 27, 116, 32, 129, 10, 14, 130, 162,
- 61, 156, 96, 15, 113, 192, 132, 111, 30, 49,
- 255, 12, 174, 129, 172, 63, 249, 200, 81, 39,
- 30, 244, 207, 254, 224, 195, 23, 102, 32, 134,
- 141, 10, 26, 153, 117, 20, 192, 15, 146, 136,
- 9, 41, 222, 0, 13, 0, 120, 64, 6, 243,
- 164, 134, 10, 96, 16, 138, 89, 176, 65, 159,
- 31, 98, 27, 60, 176, 83, 12, 51, 180, 36,
- 13, 102, 192, 196, 34, 184, 195, 152, 115, 248,
- 99, 161, 92, 9, 7, 4, 224, 240, 199, 52,
- 216, 212, 12, 20, 138, 204, 55, 140, 113, 8,
- 82, 114, 5, 30, 192, 48, 41, 75, 80, 10,
- 139, 40, 220, 35, 50, 241, 248, 26, 89, 68,
- 113, 11, 218, 188, 71, 6, 186, 25, 221, 135,
- 42, 1, 8, 42, 240, 131, 49, 226, 48, 6,
- 36, 94, 2, 10, 76, 52, 65, 28, 145, 169,
- 27, 99, 172, 97, 5, 95, 68, 212, 36, 151,
- 88, 133, 50, 254, 2, 152, 117, 52, 194, 23,
- 35, 101, 140, 57, 142, 241, 136, 151, 164, 245,
- 25, 84, 99, 12, 80, 151, 22, 19, 81, 208,
- 129, 54, 93, 48, 65, 44, 118, 211, 27, 223,
- 92, 2, 14, 82, 176, 71, 132, 158, 193, 138,
- 154, 74, 194, 12, 144, 216, 69, 50, 228, 17,
- 153, 110, 20, 224, 99, 140, 105, 135, 48, 234,
- 106, 146, 174, 50, 34, 29, 59, 163, 130, 47,
- 10, 112, 186, 173, 4, 128, 17, 151, 168, 132,
- 77, 35, 97, 6, 170, 74, 3, 29, 171, 145,
- 130, 46, 118, 68, 150, 77, 255, 136, 72, 27,
- 38, 120, 1, 24, 160, 37, 85, 31, 97, 226,
- 179, 12, 141, 76, 0, 164, 225, 139, 92, 36,
- 224, 104, 92, 57, 71, 34, 182, 122, 146, 137,
- 209, 35, 50, 248, 0, 6, 49, 156, 19, 92,
- 192, 140, 131, 184, 168, 212, 139, 40, 68, 132,
- 13, 47, 192, 128, 26, 240, 57, 1, 46, 112,
- 49, 139, 83, 128, 20, 38, 19, 171, 24, 99,
- 222, 145, 140, 99, 36, 226, 189, 239, 61, 198,
- 33, 132, 193, 139, 85, 68, 130, 185, 167, 168,
- 68, 25, 224, 11, 223, 70, 0, 195, 37, 157,
- 53, 133, 48, 248, 11, 95, 93, 20, 131, 178,
- 128, 225, 7, 21, 22, 225, 94, 254, 202, 87,
- 24, 187, 96, 69, 72, 122, 228, 9, 81, 100,
- 142, 31, 56, 152, 65, 11, 252, 53, 2, 18,
- 204, 224, 4, 44, 194, 5, 27, 196, 120, 146,
- 71, 8, 163, 66, 140, 137, 199, 33, 178, 155,
- 74, 189, 152, 248, 185, 140, 153, 199, 138, 67,
- 89, 138, 237, 94, 21, 26, 55, 48, 129, 11,
- 50, 74, 151, 18, 116, 225, 7, 34, 8, 241,
- 44, 222, 128, 137, 112, 18, 243, 25, 194, 0,
- 100, 139, 125, 115, 21, 99, 136, 115, 152, 81,
- 0, 6, 109, 145, 84, 99, 75, 100, 14, 0,
- 250, 48, 196, 9, 174, 197, 99, 136, 36, 239,
- 5, 51, 248, 129, 13, 80, 192, 162, 60, 68,
- 175, 76, 158, 64, 211, 146, 215, 140, 18, 76,
- 112, 175, 255, 20, 108, 40, 68, 62, 186, 161,
- 13, 125, 240, 0, 8, 39, 8, 1, 12, 90,
- 208, 101, 19, 78, 132, 4, 48, 152, 193, 22,
- 182, 212, 165, 29, 124, 97, 7, 134, 158, 214,
- 29, 222, 144, 138, 83, 212, 164, 38, 212, 59,
- 239, 245, 168, 247, 9, 154, 116, 162, 19, 189,
- 113, 195, 29, 242, 144, 175, 3, 212, 67, 29,
- 160, 126, 66, 33, 110, 80, 3, 48, 152, 0,
- 6, 46, 0, 85, 29, 187, 133, 42, 68, 129,
- 96, 6, 52, 120, 95, 13, 210, 248, 5, 20,
- 0, 225, 214, 22, 200, 181, 174, 21, 192, 235,
- 94, 243, 228, 215, 18, 148, 128, 176, 135, 45,
- 108, 28, 0, 65, 4, 28, 188, 167, 14, 102,
- 16, 131, 77, 181, 96, 132, 171, 142, 182, 180,
- 167, 77, 237, 36, 166, 192, 84, 131, 74, 33,
- 11, 182, 189, 237, 22, 120, 155, 136, 220, 246,
- 212, 167, 6, 165, 173, 35, 86, 251, 220, 216,
- 46, 84, 6, 54, 176, 4, 113, 177, 138, 1,
- 240, 174, 149, 173, 110, 117, 129, 11, 200, 144,
- 3, 53, 188, 225, 24, 120, 120, 130, 59, 204,
- 97, 22, 205, 96, 86, 51, 102, 49, 135, 59,
- 236, 33, 183, 69, 212, 214, 185, 185, 181, 196,
- 21, 168, 170, 85, 79, 44, 64, 1, 164, 176,
- 17, 6, 96, 96, 3, 98, 200, 130, 29, 94,
- 97, 138, 130, 177, 100, 18, 147, 104, 73, 235,
- 34, 125, 94, 80, 172, 65, 18, 150, 255, 96,
- 67, 40, 58, 138, 135, 60, 104, 97, 7, 55,
- 24, 66, 5, 74, 61, 131, 84, 207, 114, 225,
- 69, 81, 1, 11, 50, 128, 1, 136, 15, 96,
- 0, 16, 16, 134, 47, 92, 96, 7, 77, 132,
- 68, 19, 51, 98, 115, 155, 103, 226, 72, 80,
- 200, 161, 14, 53, 168, 128, 3, 122, 237, 128,
- 36, 8, 225, 217, 162, 58, 119, 242, 196, 144,
- 199, 4, 56, 193, 9, 12, 88, 66, 31, 76,
- 1, 9, 73, 160, 139, 71, 55, 179, 69, 45,
- 214, 206, 246, 82, 240, 82, 77, 141, 196, 132,
- 28, 184, 48, 132, 96, 75, 160, 2, 150, 188,
- 57, 18, 173, 212, 3, 139, 176, 170, 35, 178,
- 152, 132, 146, 175, 167, 137, 86, 48, 35, 29,
- 217, 168, 211, 54, 194, 81, 15, 41, 192, 226,
- 236, 169, 108, 228, 220, 41, 80, 65, 3, 40,
- 160, 68, 89, 7, 84, 242, 194, 192, 129, 11,
- 44, 225, 2, 97, 48, 69, 200, 151, 220, 49,
- 42, 228, 128, 49, 244, 64, 4, 103, 149, 110,
- 146, 85, 154, 130, 11, 11, 32, 192, 61, 2,
- 80, 131, 243, 69, 196, 74, 47, 136, 0, 7,
- 100, 216, 5, 0, 179, 249, 17, 135, 128, 45,
- 96, 170, 65, 133, 65, 76, 153, 245, 39, 241,
- 4, 41, 234, 80, 136, 117, 172, 227, 0, 96,
- 48, 158, 67, 146, 23, 131, 35, 68, 64, 3,
- 118, 240, 61, 74, 84, 194, 138, 238, 123, 255,
- 251, 223, 47, 197, 255, 37, 204, 96, 118, 148,
- 92, 162, 22, 85, 144, 28, 87, 200, 145, 136,
- 81, 180, 194, 251, 173, 240, 68, 37, 200, 95,
- 179, 146, 104, 17, 252, 248, 247, 126, 41, 38,
- 65, 126, 200, 155, 196, 19, 155, 16, 10, 127,
- 176, 13, 246, 128, 3, 242, 164, 16, 70, 49,
- 3, 99, 64, 6, 62, 144, 69, 100, 113, 88,
- 82, 16, 0, 245, 80, 14, 20, 88, 129, 22,
- 88, 14, 228, 0, 14, 227, 32, 15, 240, 32,
- 5, 136, 144, 11, 156, 85, 29, 62, 181, 21,
- 219, 64, 14, 23, 8, 14, 1, 240, 13, 241,
- 128, 15, 204, 80, 12, 112, 96, 28, 235, 82,
- 0, 224, 48, 129, 23, 104, 129, 222, 48, 123,
- 227, 16, 15, 239, 240, 12, 137, 144, 11, 44,
- 134, 50, 167, 240, 7, 117, 22, 79, 153, 215,
- 57, 48, 176, 7, 96, 176, 5, 174, 32, 105,
- 49, 97, 98, 110, 19, 92, 235, 80, 5, 193,
- 208, 77, 57, 83, 93, 92, 17, 15, 76, 128,
- 9, 200, 145, 56, 213, 117, 15, 5, 0, 12,
- 171, 135, 18, 157, 160, 10, 60, 64, 27, 39,
- 32, 125, 2, 145, 2, 45, 64, 3, 119, 112,
- 2, 101, 194, 100, 165, 160, 12, 125, 3, 24,
- 253, 160, 15, 218, 112, 135, 117, 118, 13, 22,
- 242, 13, 77, 192, 11, 86, 53, 86, 252, 16,
- 136, 129, 168, 135, 253, 97, 14, 198, 112, 9,
- 78, 192, 86, 128, 129, 135, 119, 168, 15, 132,
- 255, 200, 31, 244, 160, 8, 131, 247, 18, 155,
- 224, 8, 167, 87, 8, 37, 48, 23, 41, 64,
- 2, 123, 64, 112, 111, 232, 27, 149, 16, 8,
- 70, 211, 82, 76, 160, 118, 108, 199, 7, 194,
- 176, 8, 240, 112, 122, 140, 225, 14, 254, 192,
- 133, 0, 64, 86, 191, 160, 11, 124, 80, 139,
- 187, 240, 11, 201, 0, 139, 0, 208, 25, 57,
- 197, 24, 242, 48, 12, 112, 192, 118, 181, 224,
- 7, 193, 176, 8, 79, 184, 21, 64, 21, 134,
- 40, 65, 10, 108, 80, 56, 127, 224, 2, 201,
- 19, 2, 1, 247, 6, 106, 230, 27, 19, 131,
- 96, 128, 17, 93, 202, 120, 10, 102, 80, 12,
- 199, 152, 14, 87, 160, 136, 166, 213, 4, 232,
- 209, 92, 194, 0, 25, 41, 22, 12, 199, 112,
- 14, 59, 83, 5, 129, 112, 86, 37, 54, 12,
- 236, 40, 87, 195, 176, 141, 40, 195, 6, 29,
- 0, 0, 6, 8, 3, 204, 18, 10, 61, 194,
- 23, 80, 128, 59, 128, 97, 15, 141, 192, 10,
- 245, 87, 18, 192, 1, 99, 72, 19, 87, 128,
- 1, 15, 196, 192, 98, 51, 210, 4, 48, 181,
- 21, 250, 64, 5, 122, 144, 0, 234, 103, 90,
- 202, 80, 142, 41, 49, 9, 137, 48, 145, 91,
- 65, 15, 51, 182, 84, 179, 225, 1, 175, 22,
- 85, 133, 101, 141, 193, 128, 142, 128, 49, 15,
- 15, 105, 87, 181, 0, 5, 225, 192, 24, 216,
- 80, 5, 96, 181, 136, 80, 255, 96, 36, 39,
- 145, 6, 186, 64, 5, 216, 192, 24, 232, 144,
- 8, 194, 160, 94, 128, 225, 14, 155, 245, 18,
- 146, 224, 7, 211, 32, 144, 92, 161, 15, 85,
- 224, 51, 105, 49, 10, 142, 0, 0, 29, 32,
- 44, 40, 249, 33, 93, 245, 85, 140, 209, 13,
- 82, 64, 2, 199, 247, 8, 186, 16, 5, 121,
- 165, 56, 2, 176, 31, 91, 113, 14, 135, 160,
- 140, 215, 8, 93, 194, 208, 8, 99, 185, 21,
- 50, 245, 120, 64, 3, 8, 83, 224, 46, 122,
- 85, 12, 246, 136, 18, 82, 217, 15, 238, 49,
- 3, 177, 48, 51, 213, 152, 22, 60, 249, 135,
- 128, 33, 14, 139, 176, 11, 136, 201, 11, 191,
- 64, 12, 136, 0, 5, 194, 215, 138, 254, 64,
- 148, 91, 161, 96, 102, 213, 32, 81, 64, 93,
- 168, 227, 4, 191, 96, 5, 170, 1, 24, 244,
- 176, 8, 186, 128, 152, 128, 240, 11, 135, 192,
- 8, 85, 0, 90, 145, 241, 14, 105, 233, 27,
- 106, 208, 84, 208, 48, 3, 32, 80, 3, 127,
- 41, 7, 129, 249, 20, 143, 96, 12, 216, 200,
- 21, 253, 176, 155, 188, 201, 48, 247, 32, 0,
- 190, 224, 4, 118, 201, 21, 224, 192, 12, 173,
- 80, 127, 213, 193, 146, 92, 65, 15, 193, 32,
- 12, 44, 69, 135, 254, 209, 155, 22, 34, 14,
- 81, 64, 2, 124, 245, 20, 165, 32, 7, 21,
- 117, 11, 50, 64, 2, 38, 128, 5, 208, 162,
- 10, 181, 255, 105, 87, 125, 129, 153, 193, 213,
- 13, 243, 192, 12, 190, 96, 9, 192, 128, 98,
- 45, 121, 74, 40, 49, 9, 198, 48, 135, 92,
- 129, 35, 190, 128, 145, 86, 8, 0, 217, 208,
- 14, 201, 32, 8, 63, 248, 20, 210, 1, 62,
- 30, 160, 3, 208, 232, 2, 58, 32, 2, 208,
- 242, 6, 246, 17, 19, 201, 185, 28, 223, 48,
- 14, 16, 26, 161, 231, 32, 15, 243, 96, 5,
- 206, 128, 8, 131, 240, 8, 225, 81, 9, 136,
- 0, 15, 233, 16, 161, 226, 128, 14, 209, 32,
- 151, 38, 177, 46, 82, 240, 13, 226, 16, 161,
- 233, 48, 15, 199, 48, 74, 145, 81, 15, 15,
- 26, 161, 16, 122, 14, 241, 224, 14, 84, 192,
- 12, 136, 224, 7, 143, 96, 57, 122, 209, 9,
- 150, 80, 81, 180, 0, 6, 178, 68, 13, 35,
- 144, 34, 54, 48, 94, 115, 96, 10, 76, 104,
- 127, 151, 48, 159, 52, 73, 5, 124, 176, 163,
- 32, 7, 114, 103, 96, 6, 143, 32, 18, 47,
- 81, 9, 149, 48, 165, 83, 10, 143, 41, 33,
- 9, 92, 10, 114, 146, 144, 9, 141, 64, 14,
- 140, 177, 13, 210, 144, 11, 145, 16, 166, 85,
- 170, 161, 7, 169, 23, 152, 176, 9, 127, 5,
- 0, 183, 176, 5, 67, 154, 134, 44, 32, 3,
- 63, 240, 5, 162, 179, 160, 206, 180, 11, 62,
- 89, 30, 198, 0, 74, 200, 247, 18, 148, 192,
- 11, 202, 121, 150, 136, 80, 9, 111, 255, 151,
- 38, 166, 176, 93, 249, 232, 1, 92, 48, 3,
- 36, 80, 132, 40, 162, 34, 33, 54, 7, 160,
- 176, 160, 6, 114, 140, 239, 0, 12, 215, 89,
- 168, 37, 17, 9, 198, 240, 152, 92, 113, 80,
- 94, 154, 46, 164, 80, 10, 183, 32, 60, 56,
- 22, 37, 125, 118, 34, 46, 240, 97, 124, 106,
- 102, 121, 145, 9, 172, 224, 12, 223, 192, 14,
- 21, 200, 14, 227, 16, 5, 36, 42, 170, 38,
- 49, 9, 181, 32, 13, 233, 64, 131, 229, 192,
- 14, 231, 176, 145, 111, 202, 35, 164, 208, 9,
- 168, 240, 1, 0, 144, 3, 65, 192, 5, 185,
- 181, 2, 230, 102, 16, 29, 22, 3, 96, 192,
- 5, 207, 131, 11, 209, 163, 10, 112, 0, 126,
- 173, 160, 125, 194, 154, 61, 151, 128, 127, 229,
- 170, 38, 220, 163, 10, 183, 32, 173, 0, 64,
- 11, 64, 240, 3, 50, 80, 2, 177, 26, 40,
- 40, 18, 48, 92, 176, 3, 101, 134, 5, 119,
- 160, 10, 53, 113, 174, 172, 87, 47, 155, 96,
- 9, 168, 64, 11, 216, 80, 135, 65, 112, 3,
- 123, 112, 45, 216, 74, 42, 222, 2, 3, 33,
- 112, 2, 94, 64, 102, 46, 39, 38, 117, 48,
- 61, 1, 43, 176, 105, 226, 102, 156, 80, 10,
- 111, 128, 3, 127, 144, 15, 225, 144, 13, 225,
- 16, 4, 56, 64, 62, 49, 144, 106, 217, 58,
- 42, 19, 225, 2, 32, 96, 2, 63, 192, 5,
- 181, 102, 104, 96, 255, 146, 7, 99, 242, 6,
- 170, 240, 9, 142, 180, 164, 133, 74, 61, 98,
- 243, 177, 111, 48, 7, 40, 80, 8, 79, 176,
- 14, 249, 144, 180, 65, 80, 8, 54, 240, 3,
- 52, 208, 108, 151, 132, 110, 42, 208, 2, 47,
- 16, 3, 38, 0, 6, 53, 224, 5, 93, 130,
- 2, 48, 135, 104, 55, 160, 63, 253, 83, 7,
- 140, 86, 18, 102, 242, 104, 143, 246, 9, 36,
- 151, 182, 143, 86, 10, 151, 182, 22, 213, 163,
- 10, 56, 113, 3, 22, 32, 1, 6, 16, 0,
- 4, 112, 0, 7, 240, 4, 7, 96, 8, 133,
- 0, 4, 92, 224, 180, 124, 66, 2, 43, 80,
- 132, 56, 151, 134, 132, 194, 62, 175, 166, 3,
- 246, 196, 5, 34, 96, 107, 183, 70, 4, 68,
- 128, 4, 146, 219, 70, 148, 91, 185, 14, 224,
- 0, 72, 112, 185, 83, 199, 107, 191, 54, 108,
- 147, 52, 73, 6, 16, 186, 161, 91, 8, 18,
- 0, 4, 28, 244, 3, 91, 96, 2, 205, 86,
- 2, 65, 209, 178, 133, 171, 16, 40, 196, 2,
- 37, 144, 40, 141, 98, 2, 58, 0, 6, 63,
- 112, 2, 179, 214, 64, 94, 224, 5, 34, 240,
- 187, 192, 27, 188, 193, 219, 187, 54, 176, 63,
- 53, 80, 3, 63, 176, 7, 58, 96, 2, 51,
- 128, 41, 155, 146, 112, 174, 251, 186, 16, 43,
- 40, 132, 242, 41, 225, 246, 109, 216, 155, 189,
- 222, 22, 110, 41, 68, 110, 209, 187, 106, 1,
- 1, 1, 0, 59 };
-
-unsigned char php_egg_logo[] = {
- 71, 73, 70, 56, 57, 97, 120, 0, 67, 0,
- 247, 255, 0, 0, 0, 0, 177, 156, 157, 205,
- 169, 172, 148, 134, 135, 134, 109, 112, 169, 155,
- 157, 182, 169, 171, 165, 153, 155, 119, 79, 87,
- 167, 152, 155, 167, 157, 159, 195, 159, 167, 170,
- 156, 161, 160, 150, 154, 153, 129, 143, 118, 109,
- 115, 3, 1, 3, 74, 60, 74, 6, 5, 6,
- 183, 173, 184, 101, 93, 102, 148, 142, 150, 5,
- 3, 6, 9, 7, 10, 83, 74, 88, 168, 159,
- 174, 156, 150, 166, 222, 219, 229, 172, 166, 187,
- 215, 212, 225, 206, 203, 220, 123, 120, 139, 134,
- 132, 155, 195, 193, 216, 182, 181, 209, 187, 186,
- 214, 174, 173, 208, 1, 1, 3, 3, 3, 5,
- 11, 11, 16, 14, 14, 20, 7, 7, 10, 34,
- 34, 48, 22, 22, 31, 28, 28, 39, 85, 85,
- 115, 153, 153, 205, 153, 153, 203, 9, 9, 12,
- 156, 156, 205, 160, 160, 206, 170, 170, 206, 177,
- 177, 208, 142, 144, 195, 149, 150, 202, 150, 151,
- 199, 157, 158, 202, 161, 162, 201, 165, 166, 204,
- 80, 82, 122, 75, 77, 112, 112, 115, 165, 97,
- 99, 143, 91, 93, 134, 69, 71, 102, 105, 107,
- 154, 41, 42, 60, 127, 130, 185, 86, 88, 125,
- 51, 52, 74, 136, 139, 192, 133, 135, 184, 146,
- 148, 197, 153, 155, 199, 155, 157, 200, 119, 123,
- 178, 61, 63, 90, 16, 17, 24, 192, 192, 192,
- 132, 89, 62, 139, 94, 66, 143, 105, 82, 222,
- 180, 157, 132, 77, 50, 113, 74, 54, 115, 87,
- 73, 125, 66, 39, 126, 83, 64, 122, 82, 63,
- 102, 71, 57, 113, 85, 72, 197, 160, 142, 204,
- 168, 152, 89, 54, 39, 93, 57, 42, 82, 50,
- 37, 121, 75, 56, 95, 60, 45, 105, 68, 53,
- 89, 58, 45, 97, 67, 55, 113, 79, 65, 104,
- 73, 60, 99, 70, 58, 111, 81, 69, 118, 88,
- 75, 115, 85, 73, 115, 87, 75, 116, 90, 79,
- 181, 143, 127, 207, 174, 160, 94, 51, 35, 78,
- 45, 33, 105, 62, 47, 98, 62, 48, 100, 65,
- 52, 107, 71, 58, 108, 74, 62, 216, 182, 170,
- 210, 177, 165, 227, 193, 180, 219, 188, 177, 118,
- 60, 40, 106, 56, 39, 111, 62, 45, 68, 39,
- 29, 55, 34, 27, 83, 53, 43, 71, 45, 37,
- 94, 64, 54, 10, 7, 6, 93, 67, 59, 116,
- 85, 75, 149, 110, 97, 12, 9, 8, 111, 84,
- 75, 102, 66, 56, 101, 69, 60, 103, 71, 62,
- 93, 65, 57, 95, 67, 59, 99, 70, 62, 91,
- 65, 58, 117, 88, 80, 118, 93, 86, 183, 150,
- 140, 188, 158, 149, 236, 203, 194, 198, 171, 163,
- 190, 164, 157, 41, 26, 22, 91, 61, 53, 98,
- 66, 58, 95, 65, 57, 84, 59, 53, 114, 82,
- 74, 109, 81, 74, 102, 79, 73, 158, 127, 119,
- 123, 100, 94, 163, 133, 126, 194, 167, 160, 204,
- 179, 173, 171, 159, 156, 95, 65, 59, 71, 49,
- 44, 97, 67, 61, 93, 65, 59, 76, 54, 49,
- 126, 91, 83, 19, 14, 13, 112, 86, 80, 87,
- 69, 65, 133, 107, 101, 144, 119, 114, 137, 114,
- 109, 177, 150, 144, 164, 139, 134, 181, 155, 149,
- 209, 183, 177, 200, 176, 171, 223, 197, 191, 211,
- 187, 182, 167, 157, 155, 165, 155, 153, 32, 20,
- 18, 82, 55, 50, 90, 63, 58, 119, 83, 77,
- 94, 66, 61, 60, 43, 40, 95, 74, 70, 171,
- 145, 140, 247, 212, 206, 235, 209, 204, 167, 155,
- 153, 255, 244, 242, 86, 61, 57, 247, 220, 216,
- 155, 142, 140, 170, 157, 155, 149, 124, 121, 187,
- 160, 157, 172, 149, 146, 216, 192, 189, 147, 131,
- 129, 147, 138, 137, 91, 65, 63, 46, 33, 32,
- 155, 132, 130, 157, 137, 135, 181, 159, 157, 224,
- 202, 200, 132, 121, 120, 248, 228, 226, 165, 152,
- 151, 140, 130, 129, 156, 145, 144, 162, 151, 150,
- 151, 141, 140, 186, 176, 175, 103, 85, 84, 174,
- 156, 155, 163, 147, 146, 176, 151, 150, 166, 143,
- 142, 188, 165, 164, 194, 171, 170, 198, 177, 176,
- 210, 189, 188, 229, 207, 206, 236, 215, 214, 22,
- 17, 17, 176, 153, 153, 203, 181, 181, 174, 159,
- 159, 168, 153, 153, 169, 155, 155, 171, 157, 157,
- 191, 177, 177, 176, 163, 163, 169, 157, 157, 167,
- 155, 155, 165, 153, 153, 171, 159, 159, 158, 148,
- 148, 169, 159, 159, 165, 155, 155, 163, 153, 153,
- 161, 153, 153, 3, 3, 3, 1, 1, 1, 255,
- 255, 255, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 33, 249, 4, 1, 0, 0, 78, 0, 44,
- 0, 0, 0, 0, 120, 0, 67, 0, 64, 8,
- 255, 0, 157, 8, 28, 72, 176, 160, 193, 131,
- 8, 19, 42, 92, 200, 176, 161, 195, 135, 16,
- 9, 186, 112, 177, 164, 133, 144, 20, 48, 78,
- 160, 64, 209, 100, 197, 10, 22, 44, 84, 64,
- 243, 229, 171, 20, 170, 82, 38, 53, 53, 130,
- 180, 173, 94, 182, 1, 216, 176, 57, 203, 182,
- 141, 102, 180, 100, 174, 114, 186, 218, 118, 108,
- 219, 54, 103, 206, 154, 37, 147, 38, 205, 83,
- 178, 106, 213, 30, 40, 85, 234, 35, 72, 143,
- 37, 80, 163, 70, 29, 98, 4, 201, 68, 23,
- 17, 19, 78, 252, 193, 2, 128, 87, 0, 130,
- 114, 149, 68, 117, 9, 211, 25, 50, 166, 26,
- 169, 29, 116, 234, 212, 32, 76, 138, 234, 208,
- 17, 51, 71, 140, 24, 58, 117, 204, 32, 42,
- 3, 233, 27, 55, 122, 217, 142, 101, 203, 118,
- 11, 215, 60, 109, 223, 200, 217, 42, 103, 142,
- 153, 55, 109, 218, 188, 81, 35, 102, 141, 90,
- 57, 101, 201, 142, 221, 26, 134, 172, 29, 50,
- 119, 237, 66, 15, 19, 141, 203, 240, 129, 210,
- 134, 33, 107, 171, 183, 13, 91, 181, 15, 75,
- 140, 200, 150, 109, 21, 235, 65, 23, 71, 84,
- 124, 69, 87, 82, 211, 174, 94, 167, 122, 177,
- 117, 107, 74, 145, 153, 185, 115, 146, 7, 202,
- 132, 41, 19, 25, 51, 104, 228, 120, 153, 62,
- 134, 250, 152, 49, 156, 164, 113, 91, 39, 205,
- 85, 44, 74, 121, 236, 216, 255, 185, 227, 166,
- 252, 150, 72, 231, 183, 216, 169, 197, 158, 82,
- 44, 88, 162, 68, 77, 187, 229, 142, 158, 253,
- 251, 244, 220, 233, 119, 135, 172, 127, 231, 97,
- 240, 192, 3, 26, 59, 184, 92, 115, 13, 62,
- 249, 36, 168, 32, 100, 245, 56, 3, 194, 13,
- 72, 68, 248, 2, 86, 46, 148, 240, 149, 47,
- 168, 236, 210, 72, 34, 136, 32, 50, 7, 25,
- 129, 44, 34, 98, 38, 153, 244, 178, 200, 37,
- 151, 236, 130, 162, 138, 127, 124, 1, 7, 32,
- 128, 244, 97, 73, 46, 52, 230, 98, 137, 31,
- 125, 0, 114, 73, 35, 191, 60, 82, 8, 40,
- 177, 172, 195, 205, 59, 234, 148, 67, 141, 57,
- 212, 28, 73, 13, 37, 161, 76, 70, 12, 51,
- 145, 180, 17, 73, 37, 148, 208, 66, 78, 37,
- 110, 228, 33, 201, 43, 159, 180, 66, 64, 53,
- 205, 28, 115, 205, 48, 244, 172, 99, 102, 126,
- 241, 32, 168, 224, 154, 108, 174, 169, 77, 54,
- 57, 228, 128, 3, 14, 87, 229, 246, 85, 46,
- 168, 20, 179, 203, 41, 142, 56, 178, 139, 138,
- 41, 234, 185, 75, 159, 142, 160, 168, 137, 46,
- 46, 194, 161, 168, 162, 95, 52, 242, 9, 27,
- 99, 244, 225, 7, 32, 186, 112, 146, 204, 50,
- 202, 136, 35, 78, 56, 201, 180, 210, 202, 43,
- 159, 70, 3, 76, 44, 192, 68, 19, 77, 56,
- 227, 216, 66, 11, 45, 204, 48, 99, 11, 53,
- 181, 168, 255, 51, 142, 56, 202, 216, 145, 199,
- 29, 177, 180, 162, 198, 38, 155, 160, 225, 171,
- 175, 106, 4, 171, 134, 22, 196, 22, 107, 108,
- 21, 105, 176, 193, 6, 36, 173, 184, 146, 1,
- 13, 52, 144, 48, 67, 12, 19, 21, 116, 149,
- 11, 92, 73, 144, 130, 70, 43, 248, 162, 73,
- 32, 152, 32, 114, 87, 28, 111, 132, 241, 72,
- 42, 96, 232, 161, 238, 186, 234, 242, 225, 110,
- 24, 127, 232, 162, 231, 42, 175, 184, 18, 77,
- 58, 182, 24, 99, 141, 40, 146, 84, 178, 76,
- 52, 177, 132, 179, 204, 52, 227, 88, 41, 142,
- 58, 204, 144, 163, 169, 56, 149, 204, 210, 42,
- 123, 179, 132, 71, 137, 39, 88, 80, 97, 49,
- 21, 117, 148, 161, 49, 26, 85, 84, 97, 172,
- 177, 205, 76, 224, 193, 200, 30, 132, 48, 195,
- 181, 89, 9, 116, 109, 157, 62, 0, 81, 196,
- 203, 76, 196, 204, 4, 16, 52, 99, 16, 193,
- 51, 113, 88, 49, 133, 206, 86, 232, 241, 134,
- 28, 127, 168, 98, 73, 41, 159, 128, 2, 75,
- 191, 253, 82, 162, 76, 40, 149, 244, 27, 138,
- 40, 118, 48, 89, 229, 44, 179, 208, 66, 235,
- 52, 203, 120, 18, 5, 20, 133, 120, 2, 140,
- 1, 35, 144, 236, 65, 7, 100, 111, 176, 129,
- 7, 35, 232, 176, 114, 181, 41, 183, 205, 208,
- 218, 112, 199, 45, 247, 220, 107, 187, 109, 247,
- 221, 78, 92, 107, 68, 16, 68, 184, 255, 172,
- 194, 223, 66, 4, 254, 242, 224, 50, 199, 76,
- 51, 205, 60, 36, 206, 195, 14, 59, 16, 225,
- 248, 15, 144, 255, 224, 195, 228, 148, 55, 229,
- 212, 18, 84, 217, 128, 50, 222, 17, 77, 116,
- 4, 16, 77, 120, 181, 143, 62, 22, 92, 128,
- 142, 37, 36, 153, 164, 139, 38, 197, 44, 114,
- 70, 94, 89, 40, 66, 71, 25, 117, 100, 113,
- 198, 28, 89, 96, 17, 133, 43, 246, 208, 211,
- 83, 54, 165, 93, 131, 152, 58, 230, 156, 51,
- 139, 44, 223, 8, 47, 252, 52, 204, 192, 90,
- 139, 40, 210, 124, 51, 204, 60, 243, 224, 194,
- 206, 245, 6, 30, 184, 26, 77, 206, 184, 246,
- 90, 15, 67, 132, 47, 254, 17, 53, 104, 110,
- 91, 67, 91, 161, 240, 149, 33, 168, 163, 194,
- 250, 158, 167, 48, 146, 8, 236, 89, 32, 98,
- 134, 34, 152, 144, 66, 74, 38, 243, 203, 17,
- 134, 28, 0, 12, 131, 23, 252, 39, 135, 58,
- 188, 130, 27, 127, 105, 70, 43, 32, 209, 137,
- 95, 116, 131, 0, 201, 136, 6, 40, 218, 192,
- 5, 41, 72, 193, 13, 118, 192, 131, 6, 241,
- 240, 42, 106, 144, 3, 28, 236, 216, 207, 125,
- 244, 227, 159, 208, 20, 102, 24, 195, 144, 71,
- 1, 218, 177, 153, 234, 29, 96, 30, 248, 192,
- 135, 54, 26, 224, 146, 1, 124, 128, 124, 53,
- 200, 161, 249, 6, 226, 2, 30, 124, 69, 21,
- 24, 218, 5, 41, 255, 24, 209, 139, 33, 50,
- 130, 20, 110, 89, 4, 255, 200, 240, 63, 57,
- 4, 226, 137, 39, 186, 206, 24, 200, 224, 5,
- 69, 245, 161, 15, 46, 186, 226, 23, 90, 241,
- 141, 111, 28, 163, 27, 225, 96, 134, 40, 142,
- 100, 11, 74, 72, 34, 18, 89, 194, 195, 36,
- 172, 193, 70, 125, 25, 35, 26, 24, 8, 71,
- 45, 66, 65, 9, 46, 68, 2, 24, 253, 241,
- 76, 104, 218, 193, 142, 121, 92, 99, 30, 163,
- 185, 94, 59, 214, 65, 143, 118, 76, 47, 134,
- 106, 106, 83, 130, 86, 179, 13, 13, 36, 33,
- 9, 55, 152, 80, 15, 119, 83, 138, 214, 93,
- 226, 137, 80, 60, 17, 138, 46, 33, 34, 66,
- 237, 66, 19, 39, 241, 3, 52, 44, 1, 141,
- 43, 94, 145, 81, 95, 248, 2, 235, 52, 129,
- 134, 84, 184, 226, 27, 177, 0, 85, 50, 194,
- 17, 142, 128, 197, 34, 26, 210, 8, 71, 0,
- 188, 1, 143, 105, 80, 98, 18, 198, 8, 198,
- 36, 134, 57, 76, 246, 144, 131, 18, 179, 168,
- 132, 39, 30, 181, 138, 67, 112, 130, 19, 135,
- 88, 5, 36, 32, 161, 172, 106, 118, 233, 83,
- 174, 104, 134, 52, 234, 145, 15, 68, 186, 169,
- 30, 25, 208, 129, 56, 233, 164, 178, 244, 121,
- 165, 4, 64, 244, 205, 160, 254, 4, 63, 253,
- 97, 2, 19, 115, 8, 195, 30, 248, 176, 135,
- 55, 4, 34, 13, 105, 160, 103, 28, 246, 25,
- 255, 7, 39, 106, 226, 18, 157, 72, 198, 56,
- 200, 65, 14, 90, 0, 195, 40, 177, 144, 5,
- 40, 94, 129, 75, 105, 12, 12, 107, 211, 80,
- 135, 58, 86, 85, 14, 87, 169, 67, 28, 1,
- 80, 198, 29, 194, 195, 5, 46, 84, 194, 21,
- 179, 43, 131, 175, 54, 65, 172, 52, 120, 236,
- 99, 40, 45, 86, 43, 50, 16, 130, 17, 140,
- 64, 4, 106, 187, 138, 66, 86, 118, 132, 22,
- 168, 224, 35, 33, 81, 129, 16, 124, 241, 135,
- 61, 176, 235, 167, 244, 244, 169, 207, 190, 80,
- 10, 64, 148, 68, 23, 207, 40, 198, 47, 46,
- 129, 138, 222, 116, 130, 89, 205, 114, 5, 1,
- 90, 1, 48, 89, 60, 205, 22, 182, 112, 85,
- 86, 153, 81, 11, 102, 172, 138, 18, 176, 40,
- 196, 21, 192, 0, 134, 43, 60, 225, 172, 80,
- 184, 2, 22, 202, 80, 5, 72, 36, 195, 0,
- 30, 48, 155, 92, 59, 48, 2, 25, 172, 140,
- 115, 183, 153, 91, 13, 134, 208, 131, 32, 248,
- 32, 114, 147, 11, 130, 96, 123, 64, 216, 169,
- 136, 111, 54, 57, 172, 1, 18, 110, 112, 131,
- 36, 40, 1, 7, 113, 18, 231, 12, 102, 64,
- 2, 18, 208, 64, 4, 34, 120, 105, 180, 116,
- 64, 173, 185, 225, 245, 179, 90, 89, 153, 17,
- 150, 208, 215, 191, 18, 161, 5, 60, 56, 156,
- 106, 19, 215, 56, 34, 72, 206, 41, 79, 57,
- 66, 85, 234, 6, 218, 218, 255, 90, 107, 34,
- 70, 104, 153, 16, 154, 208, 17, 156, 254, 77,
- 167, 129, 19, 2, 225, 48, 64, 92, 226, 118,
- 131, 2, 200, 77, 110, 55, 126, 225, 192, 228,
- 38, 183, 5, 174, 13, 172, 96, 167, 75, 216,
- 234, 86, 23, 115, 70, 48, 223, 249, 108, 155,
- 215, 32, 20, 225, 2, 16, 48, 129, 182, 50,
- 130, 130, 21, 144, 114, 44, 154, 208, 196, 24,
- 22, 65, 134, 58, 212, 46, 17, 115, 16, 23,
- 21, 90, 113, 0, 120, 208, 100, 27, 218, 40,
- 208, 60, 190, 33, 11, 101, 208, 18, 24, 217,
- 80, 13, 100, 194, 1, 139, 101, 0, 163, 18,
- 178, 144, 134, 106, 190, 225, 18, 154, 192, 196,
- 53, 74, 249, 192, 83, 196, 71, 225, 217, 110,
- 215, 110, 184, 97, 130, 4, 190, 2, 0, 11,
- 160, 99, 36, 170, 43, 134, 35, 22, 193, 167,
- 224, 20, 199, 12, 102, 200, 66, 22, 240, 50,
- 23, 15, 209, 1, 10, 187, 235, 29, 77, 128,
- 231, 199, 121, 28, 163, 18, 141, 153, 133, 56,
- 178, 87, 15, 120, 152, 195, 26, 231, 48, 71,
- 45, 100, 17, 141, 107, 176, 3, 133, 9, 64,
- 161, 146, 135, 129, 26, 234, 169, 198, 37, 221,
- 123, 205, 7, 168, 34, 27, 217, 150, 143, 109,
- 111, 115, 65, 11, 82, 240, 21, 9, 136, 37,
- 37, 187, 144, 159, 123, 109, 151, 8, 69, 40,
- 194, 20, 192, 33, 69, 34, 204, 32, 23, 49,
- 200, 161, 255, 159, 97, 136, 51, 34, 32, 225,
- 10, 120, 24, 0, 30, 245, 104, 70, 53, 64,
- 245, 9, 2, 96, 35, 26, 234, 96, 15, 51,
- 40, 1, 142, 79, 124, 98, 25, 204, 56, 135,
- 49, 144, 36, 142, 8, 126, 102, 63, 252, 233,
- 207, 10, 219, 113, 0, 20, 150, 38, 201, 46,
- 44, 205, 97, 182, 231, 140, 215, 144, 111, 54,
- 181, 185, 13, 18, 138, 240, 21, 65, 180, 207,
- 55, 109, 73, 53, 35, 226, 146, 226, 44, 176,
- 217, 12, 137, 216, 223, 115, 162, 211, 196, 56,
- 199, 121, 12, 114, 64, 195, 91, 233, 113, 141,
- 106, 124, 162, 27, 171, 104, 69, 44, 36, 113,
- 30, 244, 108, 129, 11, 110, 232, 40, 23, 204,
- 8, 11, 101, 136, 2, 171, 228, 128, 71, 59,
- 234, 115, 166, 252, 236, 167, 132, 74, 38, 36,
- 50, 10, 32, 15, 234, 193, 16, 31, 13, 104,
- 64, 62, 86, 211, 32, 16, 40, 22, 9, 138,
- 101, 155, 11, 110, 160, 27, 175, 136, 37, 79,
- 142, 56, 133, 254, 136, 216, 22, 37, 134, 11,
- 17, 115, 113, 226, 19, 81, 36, 135, 249, 133,
- 33, 149, 169, 244, 66, 42, 199, 16, 6, 78,
- 28, 3, 30, 195, 24, 128, 43, 68, 49, 9,
- 97, 8, 163, 22, 228, 73, 246, 29, 236, 144,
- 165, 96, 0, 185, 22, 230, 48, 71, 124, 200,
- 1, 139, 54, 180, 33, 22, 200, 40, 147, 153,
- 206, 100, 38, 253, 216, 199, 29, 220, 255, 14,
- 144, 126, 228, 97, 24, 111, 182, 137, 145, 21,
- 96, 44, 99, 175, 210, 21, 175, 64, 163, 20,
- 154, 144, 31, 38, 200, 240, 78, 83, 152, 130,
- 45, 74, 236, 69, 32, 80, 20, 8, 21, 45,
- 34, 16, 99, 72, 37, 28, 146, 110, 69, 63,
- 56, 221, 18, 80, 167, 17, 52, 88, 241, 12,
- 175, 85, 98, 162, 161, 144, 69, 179, 199, 40,
- 12, 99, 212, 98, 22, 212, 176, 6, 63, 4,
- 64, 0, 165, 72, 34, 235, 176, 176, 195, 36,
- 66, 177, 140, 145, 187, 157, 29, 94, 140, 9,
- 54, 182, 49, 140, 2, 204, 67, 145, 120, 31,
- 119, 61, 42, 128, 3, 37, 40, 33, 9, 19,
- 169, 57, 0, 160, 145, 161, 76, 4, 34, 57,
- 115, 200, 228, 37, 73, 172, 34, 118, 166, 87,
- 19, 95, 144, 20, 41, 161, 126, 35, 28, 153,
- 242, 15, 43, 49, 244, 43, 248, 248, 13, 3,
- 188, 99, 26, 233, 16, 199, 52, 100, 65, 139,
- 139, 18, 204, 26, 196, 8, 134, 48, 55, 136,
- 135, 86, 205, 34, 20, 119, 184, 3, 40, 216,
- 128, 6, 78, 160, 65, 11, 107, 88, 22, 36,
- 62, 241, 10, 109, 74, 35, 26, 3, 104, 73,
- 55, 19, 153, 247, 25, 234, 32, 78, 116, 90,
- 119, 187, 1, 128, 167, 98, 112, 178, 147, 187,
- 208, 228, 37, 244, 228, 201, 98, 232, 226, 36,
- 49, 2, 196, 23, 152, 190, 168, 62, 252, 161,
- 19, 214, 239, 69, 255, 29, 90, 33, 141, 100,
- 36, 131, 0, 246, 74, 198, 43, 112, 98, 175,
- 88, 132, 94, 83, 179, 146, 69, 37, 242, 144,
- 7, 53, 178, 39, 73, 234, 144, 133, 40, 106,
- 33, 9, 79, 164, 226, 16, 107, 112, 8, 209,
- 36, 128, 2, 152, 82, 90, 48, 44, 90, 80,
- 5, 202, 178, 126, 216, 16, 38, 217, 0, 78,
- 210, 50, 3, 49, 149, 55, 46, 48, 106, 165,
- 6, 13, 190, 65, 40, 126, 34, 40, 131, 66,
- 98, 164, 48, 116, 213, 225, 5, 111, 80, 79,
- 93, 64, 6, 108, 176, 10, 97, 240, 6, 113,
- 32, 6, 152, 144, 34, 189, 64, 0, 239, 87,
- 48, 178, 224, 9, 174, 224, 9, 92, 146, 12,
- 224, 144, 14, 211, 224, 13, 58, 8, 127, 171,
- 242, 108, 18, 37, 81, 227, 176, 52, 226, 225,
- 6, 146, 208, 10, 104, 16, 44, 248, 164, 6,
- 29, 131, 79, 6, 248, 132, 4, 192, 1, 152,
- 37, 2, 39, 35, 83, 229, 52, 17, 91, 86,
- 2, 226, 165, 10, 24, 168, 39, 245, 198, 8,
- 247, 22, 7, 244, 84, 46, 132, 128, 46, 236,
- 226, 46, 251, 4, 47, 48, 242, 11, 4, 128,
- 42, 3, 197, 12, 93, 39, 12, 202, 16, 11,
- 160, 0, 48, 164, 50, 13, 4, 101, 37, 138,
- 193, 12, 229, 80, 14, 234, 160, 48, 226, 32,
- 10, 26, 20, 30, 110, 64, 9, 192, 160, 49,
- 136, 184, 49, 183, 247, 132, 32, 35, 2, 33,
- 255, 240, 136, 35, 80, 133, 88, 150, 87, 158,
- 3, 58, 28, 225, 17, 44, 192, 83, 95, 224,
- 5, 106, 96, 134, 63, 197, 46, 123, 48, 79,
- 124, 240, 6, 128, 80, 10, 108, 129, 18, 157,
- 208, 37, 16, 20, 13, 203, 240, 14, 192, 144,
- 19, 67, 17, 65, 225, 0, 14, 224, 48, 122,
- 176, 208, 48, 88, 213, 42, 92, 85, 11, 182,
- 64, 127, 238, 81, 8, 103, 165, 86, 88, 48,
- 140, 136, 136, 44, 198, 210, 10, 242, 48, 54,
- 100, 211, 1, 30, 32, 2, 118, 101, 133, 157,
- 179, 50, 61, 0, 4, 128, 35, 56, 47, 19,
- 1, 197, 32, 79, 235, 18, 138, 62, 101, 5,
- 86, 192, 7, 47, 226, 7, 55, 226, 11, 78,
- 119, 9, 175, 96, 20, 157, 178, 64, 244, 2,
- 48, 192, 0, 11, 148, 32, 53, 161, 64, 11,
- 207, 214, 42, 170, 34, 14, 76, 2, 12, 133,
- 0, 5, 83, 176, 143, 251, 8, 6, 84, 16,
- 5, 209, 96, 0, 29, 32, 87, 4, 25, 2,
- 36, 64, 91, 181, 21, 55, 53, 208, 3, 62,
- 192, 3, 51, 3, 4, 172, 213, 56, 144, 67,
- 57, 126, 229, 3, 15, 64, 1, 76, 80, 4,
- 66, 128, 1, 4, 112, 42, 177, 64, 42, 145,
- 32, 11, 253, 162, 12, 153, 34, 14, 6, 96,
- 0, 25, 144, 1, 28, 176, 146, 58, 96, 89,
- 151, 149, 89, 35, 240, 136, 143, 72, 50, 45,
- 69, 2, 207, 136, 144, 220, 255, 229, 16, 116,
- 179, 50, 232, 86, 101, 20, 22, 62, 178, 133,
- 88, 138, 197, 88, 143, 244, 88, 115, 130, 3,
- 49, 208, 89, 59, 57, 137, 57, 217, 148, 78,
- 249, 148, 80, 217, 54, 75, 57, 149, 208, 24,
- 149, 86, 73, 129, 19, 241, 2, 71, 208, 3,
- 63, 208, 2, 46, 99, 141, 48, 83, 56, 171,
- 165, 56, 140, 211, 90, 174, 21, 57, 63, 48,
- 88, 67, 64, 62, 119, 117, 149, 110, 115, 21,
- 72, 208, 3, 45, 192, 4, 55, 5, 18, 191,
- 21, 92, 194, 69, 56, 98, 121, 56, 100, 201,
- 56, 142, 115, 150, 19, 89, 57, 211, 53, 152,
- 176, 181, 4, 228, 163, 93, 110, 25, 90, 72,
- 16, 4, 212, 168, 17, 188, 133, 137, 57, 5,
- 92, 36, 49, 22, 172, 240, 0, 72, 177, 20,
- 72, 129, 20, 174, 65, 0, 211, 180, 10, 159,
- 144, 153, 151, 169, 20, 4, 64, 0, 199, 117,
- 145, 129, 101, 93, 215, 37, 21, 228, 35, 73,
- 110, 57, 17, 65, 192, 4, 43, 160, 45, 23,
- 112, 2, 142, 233, 17, 208, 48, 18, 48, 130,
- 10, 186, 112, 9, 100, 112, 73, 188, 153, 5,
- 104, 224, 10, 247, 0, 24, 206, 208, 18, 135,
- 129, 15, 199, 64, 42, 18, 20, 11, 10, 214,
- 69, 245, 80, 15, 176, 244, 145, 71, 35, 13,
- 62, 177, 13, 3, 0, 19, 161, 249, 0, 151,
- 35, 21, 83, 97, 97, 23, 134, 87, 19, 209,
- 3, 76, 255, 112, 1, 0, 16, 94, 22, 128,
- 17, 232, 144, 11, 35, 129, 94, 129, 112, 6,
- 103, 113, 6, 89, 64, 59, 41, 70, 6, 89,
- 64, 5, 79, 224, 10, 246, 49, 99, 213, 99,
- 32, 223, 64, 11, 126, 168, 12, 0, 38, 67,
- 252, 57, 13, 171, 50, 14, 148, 176, 12, 217,
- 224, 71, 217, 35, 60, 136, 225, 18, 63, 1,
- 97, 15, 32, 97, 63, 25, 62, 22, 198, 57,
- 91, 177, 124, 0, 80, 2, 166, 179, 158, 165,
- 176, 58, 130, 18, 63, 172, 166, 98, 179, 83,
- 7, 116, 33, 46, 79, 16, 5, 175, 160, 0,
- 240, 240, 59, 193, 131, 24, 228, 80, 60, 162,
- 128, 60, 6, 162, 13, 215, 160, 14, 194, 144,
- 113, 194, 64, 9, 209, 160, 13, 236, 96, 100,
- 76, 134, 26, 168, 97, 32, 50, 212, 96, 81,
- 246, 1, 83, 118, 4, 72, 74, 161, 53, 192,
- 148, 58, 233, 2, 65, 32, 4, 28, 182, 15,
- 66, 211, 27, 68, 135, 9, 62, 7, 28, 38,
- 22, 23, 42, 150, 5, 25, 67, 59, 30, 130,
- 6, 108, 16, 13, 132, 244, 156, 131, 81, 24,
- 6, 146, 13, 227, 208, 85, 230, 160, 14, 217,
- 243, 13, 234, 192, 70, 141, 1, 61, 210, 192,
- 14, 134, 20, 26, 157, 97, 72, 40, 36, 15,
- 167, 241, 66, 48, 244, 100, 52, 225, 26, 31,
- 0, 2, 179, 1, 106, 76, 138, 16, 88, 168,
- 62, 162, 243, 97, 71, 21, 102, 102, 255, 134,
- 8, 103, 80, 102, 141, 192, 8, 108, 33, 63,
- 178, 99, 23, 136, 39, 7, 115, 96, 6, 101,
- 176, 9, 159, 192, 14, 127, 193, 26, 63, 241,
- 19, 197, 121, 12, 228, 128, 48, 204, 160, 99,
- 205, 208, 12, 211, 16, 118, 196, 112, 14, 229,
- 32, 11, 174, 32, 13, 121, 164, 31, 5, 144,
- 71, 158, 65, 32, 184, 112, 11, 7, 192, 167,
- 243, 192, 167, 218, 195, 26, 216, 16, 168, 131,
- 90, 161, 161, 181, 101, 165, 134, 58, 29, 234,
- 133, 98, 246, 94, 177, 163, 8, 140, 112, 68,
- 204, 145, 5, 117, 33, 6, 112, 246, 63, 113,
- 102, 41, 239, 112, 103, 199, 144, 20, 144, 192,
- 9, 157, 208, 10, 213, 16, 13, 88, 130, 108,
- 110, 176, 5, 82, 34, 9, 121, 224, 112, 73,
- 50, 14, 209, 112, 12, 252, 1, 105, 145, 38,
- 105, 120, 154, 167, 120, 154, 0, 168, 17, 67,
- 228, 214, 26, 55, 148, 88, 233, 246, 157, 121,
- 211, 3, 130, 103, 8, 35, 225, 62, 131, 162,
- 106, 141, 128, 98, 42, 102, 63, 137, 144, 63,
- 96, 24, 159, 4, 100, 107, 182, 54, 7, 193,
- 121, 146, 237, 224, 107, 221, 192, 10, 191, 64,
- 103, 19, 20, 37, 91, 96, 65, 228, 42, 5,
- 244, 231, 48, 150, 49, 14, 157, 81, 31, 1,
- 178, 14, 240, 106, 66, 184, 192, 100, 183, 144,
- 31, 161, 113, 26, 212, 163, 61, 13, 192, 105,
- 251, 154, 88, 59, 255, 84, 78, 68, 240, 21,
- 16, 240, 110, 168, 54, 8, 195, 49, 8, 98,
- 102, 6, 201, 129, 8, 89, 144, 8, 11, 235,
- 28, 208, 33, 29, 183, 54, 29, 94, 64, 112,
- 157, 208, 12, 127, 113, 12, 10, 244, 10, 183,
- 24, 123, 201, 198, 5, 91, 144, 181, 89, 203,
- 5, 118, 48, 11, 134, 8, 10, 149, 176, 113,
- 210, 134, 31, 249, 97, 109, 36, 100, 171, 0,
- 178, 14, 119, 106, 24, 7, 2, 110, 226, 166,
- 119, 229, 22, 33, 232, 182, 67, 88, 120, 129,
- 201, 26, 111, 189, 32, 28, 109, 65, 10, 166,
- 192, 102, 114, 129, 120, 251, 22, 8, 100, 160,
- 8, 209, 225, 5, 93, 112, 184, 134, 251, 7,
- 4, 103, 112, 6, 224, 14, 199, 224, 10, 202,
- 48, 76, 120, 64, 136, 87, 219, 81, 89, 50,
- 9, 65, 38, 12, 212, 224, 85, 161, 32, 14,
- 109, 0, 12, 131, 52, 114, 35, 68, 66, 212,
- 134, 178, 237, 160, 114, 160, 113, 72, 196, 183,
- 32, 46, 81, 1, 139, 21, 33, 55, 112, 21,
- 65, 208, 101, 55, 167, 9, 142, 144, 183, 241,
- 195, 8, 169, 38, 34, 240, 21, 6, 128, 187,
- 28, 129, 240, 63, 207, 33, 112, 139, 2, 112,
- 93, 224, 5, 144, 192, 14, 240, 96, 15, 15,
- 144, 12, 173, 66, 13, 231, 0, 113, 87, 107,
- 43, 233, 138, 122, 15, 103, 12, 202, 144, 10,
- 148, 192, 127, 230, 234, 9, 223, 112, 11, 237,
- 255, 48, 15, 117, 186, 14, 240, 64, 72, 244,
- 176, 109, 5, 160, 31, 229, 11, 26, 187, 234,
- 114, 138, 180, 26, 174, 11, 73, 145, 52, 17,
- 164, 230, 110, 56, 151, 187, 207, 122, 165, 245,
- 134, 22, 193, 171, 111, 33, 178, 8, 99, 240,
- 7, 2, 124, 9, 93, 208, 125, 112, 32, 142,
- 52, 226, 11, 197, 128, 177, 189, 0, 14, 76,
- 226, 42, 180, 112, 70, 145, 112, 7, 195, 164,
- 104, 194, 112, 14, 98, 119, 14, 14, 240, 3,
- 20, 240, 142, 178, 64, 9, 120, 96, 7, 178,
- 48, 10, 110, 103, 109, 143, 54, 10, 222, 112,
- 61, 246, 209, 14, 215, 144, 119, 47, 183, 119,
- 127, 247, 72, 19, 113, 2, 95, 65, 120, 97,
- 150, 8, 100, 144, 195, 152, 176, 8, 67, 52,
- 8, 74, 100, 10, 39, 130, 73, 68, 215, 34,
- 138, 66, 196, 226, 8, 117, 78, 55, 41, 165,
- 88, 10, 204, 226, 9, 177, 16, 0, 228, 48,
- 43, 3, 85, 14, 139, 65, 13, 194, 224, 181,
- 181, 64, 12, 252, 176, 0, 169, 128, 0, 174,
- 64, 71, 162, 87, 9, 33, 12, 11, 201, 227,
- 69, 122, 6, 154, 153, 137, 13, 199, 160, 13,
- 171, 235, 194, 9, 178, 119, 114, 210, 119, 51,
- 124, 33, 25, 130, 9, 70, 155, 28, 32, 34,
- 34, 79, 148, 9, 167, 32, 125, 42, 146, 94,
- 45, 34, 41, 71, 76, 121, 78, 167, 69, 142,
- 144, 177, 169, 64, 126, 215, 255, 224, 121, 125,
- 88, 170, 125, 216, 60, 204, 160, 12, 148, 128,
- 122, 193, 244, 112, 183, 210, 181, 170, 18, 10,
- 118, 192, 5, 133, 112, 8, 93, 18, 65, 210,
- 16, 48, 223, 192, 14, 200, 176, 14, 163, 48,
- 10, 225, 27, 67, 110, 252, 77, 113, 18, 39,
- 244, 251, 21, 150, 80, 120, 152, 148, 120, 33,
- 50, 116, 151, 212, 199, 41, 242, 39, 135, 210,
- 84, 148, 55, 74, 78, 7, 8, 112, 224, 34,
- 49, 162, 11, 187, 192, 9, 188, 208, 10, 205,
- 240, 13, 55, 161, 75, 233, 64, 75, 181, 212,
- 95, 59, 56, 13, 12, 167, 122, 171, 167, 70,
- 147, 192, 139, 227, 224, 6, 119, 16, 9, 173,
- 64, 128, 0, 184, 10, 202, 210, 76, 186, 215,
- 37, 189, 151, 13, 223, 192, 198, 238, 203, 38,
- 245, 160, 1, 226, 36, 39, 174, 217, 101, 222,
- 178, 11, 153, 20, 125, 210, 71, 125, 125, 114,
- 10, 214, 23, 74, 133, 28, 35, 166, 100, 74,
- 95, 240, 11, 154, 96, 10, 169, 208, 123, 191,
- 199, 37, 0, 99, 126, 166, 130, 75, 225, 0,
- 15, 11, 227, 108, 181, 160, 65, 196, 52, 9,
- 248, 39, 14, 182, 48, 11, 192, 208, 10, 185,
- 167, 44, 222, 236, 205, 196, 226, 43, 196, 178,
- 44, 93, 146, 77, 45, 129, 206, 50, 212, 0,
- 28, 48, 89, 156, 117, 21, 45, 176, 62, 241,
- 76, 98, 139, 64, 40, 155, 196, 78, 236, 84,
- 12, 187, 255, 188, 40, 193, 28, 204, 169, 212,
- 5, 207, 164, 11, 57, 210, 161, 173, 80, 75,
- 191, 39, 20, 173, 240, 9, 58, 225, 80, 203,
- 0, 14, 71, 29, 122, 6, 106, 11, 181, 64,
- 127, 176, 194, 135, 228, 48, 13, 110, 128, 7,
- 148, 0, 10, 221, 124, 8, 104, 176, 9, 206,
- 100, 123, 9, 216, 49, 8, 248, 49, 195, 178,
- 6, 187, 23, 210, 209, 80, 15, 28, 80, 89,
- 51, 112, 147, 19, 145, 179, 94, 1, 1, 208,
- 32, 47, 158, 212, 39, 187, 192, 129, 169, 102,
- 203, 4, 220, 5, 111, 144, 215, 112, 240, 125,
- 144, 80, 7, 111, 240, 5, 127, 224, 27, 189,
- 112, 104, 211, 32, 14, 228, 32, 10, 224, 16,
- 13, 245, 226, 10, 205, 178, 12, 71, 93, 75,
- 224, 32, 14, 5, 19, 10, 161, 224, 122, 125,
- 40, 43, 211, 80, 9, 226, 177, 205, 173, 64,
- 8, 75, 168, 5, 139, 232, 132, 140, 88, 44,
- 29, 179, 44, 3, 128, 89, 208, 114, 147, 88,
- 9, 176, 63, 20, 207, 114, 45, 211, 125, 44,
- 111, 134, 231, 63, 94, 16, 138, 111, 208, 5,
- 104, 208, 215, 111, 224, 5, 98, 24, 7, 153,
- 64, 211, 191, 144, 12, 146, 173, 48, 164, 226,
- 9, 70, 241, 10, 175, 16, 11, 203, 16, 14,
- 58, 152, 14, 224, 160, 12, 227, 80, 14, 94,
- 235, 159, 229, 64, 80, 179, 2, 123, 20, 183,
- 5, 71, 88, 7, 192, 114, 128, 7, 255, 104,
- 82, 163, 253, 49, 43, 229, 82, 34, 96, 147,
- 208, 120, 45, 198, 170, 133, 233, 228, 133, 241,
- 182, 183, 153, 224, 33, 98, 56, 138, 111, 80,
- 7, 169, 128, 5, 235, 194, 7, 189, 29, 6,
- 171, 115, 10, 166, 208, 10, 80, 172, 14, 241,
- 161, 52, 89, 229, 9, 173, 32, 139, 225, 16,
- 81, 82, 44, 217, 70, 194, 12, 127, 56, 13,
- 1, 48, 127, 147, 171, 108, 160, 128, 136, 104,
- 32, 82, 30, 125, 82, 225, 253, 10, 28, 0,
- 137, 105, 179, 57, 18, 161, 210, 40, 32, 94,
- 179, 121, 115, 122, 178, 8, 239, 212, 33, 98,
- 32, 223, 244, 125, 5, 159, 168, 7, 104, 232,
- 5, 49, 162, 9, 135, 224, 86, 233, 16, 122,
- 112, 24, 12, 2, 112, 96, 176, 192, 156, 31,
- 25, 122, 214, 109, 36, 213, 253, 135, 12, 195,
- 42, 15, 77, 127, 81, 3, 10, 254, 104, 49,
- 238, 149, 49, 30, 205, 136, 159, 208, 0, 35,
- 35, 147, 146, 232, 175, 60, 36, 187, 69, 64,
- 94, 29, 113, 115, 114, 96, 23, 134, 75, 7,
- 144, 192, 226, 45, 174, 7, 161, 248, 46, 127,
- 64, 41, 157, 192, 9, 191, 176, 10, 177, 26,
- 0, 197, 195, 12, 227, 0, 11, 160, 96, 224,
- 71, 13, 221, 146, 173, 12, 178, 0, 14, 31,
- 204, 212, 236, 209, 85, 189, 120, 7, 253, 55,
- 140, 254, 152, 136, 34, 133, 44, 24, 78, 44,
- 175, 0, 15, 100, 255, 67, 50, 29, 238, 225,
- 51, 117, 45, 62, 80, 4, 143, 105, 151, 190,
- 240, 11, 101, 16, 230, 103, 40, 84, 127, 221,
- 161, 165, 128, 33, 191, 112, 230, 13, 228, 64,
- 29, 9, 139, 191, 23, 65, 31, 9, 14, 149,
- 32, 143, 21, 149, 139, 187, 72, 53, 179, 160,
- 12, 254, 247, 4, 80, 0, 235, 87, 48, 235,
- 107, 197, 86, 105, 96, 232, 5, 16, 87, 27,
- 176, 140, 6, 217, 150, 16, 177, 54, 211, 168,
- 2, 57, 21, 92, 69, 128, 10, 181, 253, 137,
- 99, 174, 46, 123, 208, 5, 146, 66, 18, 128,
- 112, 18, 190, 0, 80, 233, 197, 10, 172, 208,
- 13, 157, 160, 9, 159, 48, 77, 201, 45, 146,
- 241, 40, 10, 179, 128, 85, 91, 165, 42, 239,
- 216, 127, 81, 208, 143, 83, 64, 86, 96, 0,
- 232, 173, 80, 163, 4, 105, 54, 29, 96, 50,
- 56, 153, 50, 112, 35, 151, 26, 153, 151, 69,
- 32, 51, 17, 16, 1, 151, 80, 79, 35, 168,
- 7, 222, 184, 51, 111, 32, 35, 183, 105, 35,
- 154, 224, 10, 237, 40, 11, 178, 0, 12, 7,
- 207, 36, 90, 23, 182, 110, 64, 217, 242, 40,
- 10, 167, 74, 11, 67, 104, 231, 90, 3, 5,
- 177, 62, 5, 92, 19, 14, 34, 179, 140, 4,
- 249, 238, 7, 25, 239, 22, 186, 54, 55, 192,
- 149, 64, 176, 151, 17, 121, 90, 20, 208, 13,
- 155, 0, 6, 59, 51, 5, 124, 128, 192, 190,
- 139, 208, 10, 70, 35, 11, 145, 16, 9, 146,
- 144, 243, 103, 247, 142, 180, 64, 30, 76, 19,
- 143, 180, 160, 12, 142, 157, 0, 9, 208, 0,
- 12, 48, 1, 49, 41, 147, 98, 147, 232, 6,
- 169, 148, 140, 238, 148, 114, 131, 4, 67, 16,
- 4, 63, 176, 3, 139, 35, 145, 129, 73, 93,
- 133, 5, 21, 21, 38, 27, 57, 36, 183, 141,
- 245, 88, 145, 165, 3, 147, 229, 146, 152, 229,
- 82, 73, 223, 82, 52, 48, 45, 114, 147, 152,
- 6, 177, 148, 53, 112, 4, 164, 213, 87, 131,
- 181, 245, 152, 115, 88, 66, 9, 187, 142, 165,
- 4, 173, 44, 89, 147, 37, 129, 50, 224, 244,
- 109, 239, 246, 191, 78, 149, 134, 127, 248, 34,
- 79, 248, 35, 143, 248, 134, 239, 246, 1, 1,
- 0, 59 };
diff --git a/main/main.c b/main/main.c
deleted file mode 100644
index 79304ffa1f..0000000000
--- a/main/main.c
+++ /dev/null
@@ -1,1819 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* {{{ includes
- */
-
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#include "php.h"
-#include <stdio.h>
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#include "win32/signal.h"
-#include <process.h>
-#elif defined(NETWARE)
-#ifdef NEW_LIBC
-#include <sys/timeval.h>
-#else
-#include "netware/time_nw.h"
-#endif
-/*#include "netware/signal_nw.h"*/
-/*#include "netware/env.h"*/ /* Temporary */
-/*#include <process.h>*/
-#ifdef USE_WINSOCK
-#include <novsock2.h>
-#endif
-#endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#if HAVE_SETLOCALE
-#include <locale.h>
-#endif
-#include "zend.h"
-#include "zend_extensions.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "php_main.h"
-#include "fopen_wrappers.h"
-#include "ext/standard/php_standard.h"
-#include "php_variables.h"
-#include "ext/standard/credits.h"
-#ifdef PHP_WIN32
-#include <io.h>
-#include <fcntl.h>
-#include "win32/php_registry.h"
-#endif
-#include "php_syslog.h"
-#include "Zend/zend_default_classes.h"
-
-#if PHP_SIGCHILD
-#include <sys/types.h>
-#include <sys/wait.h>
-#endif
-
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-#include "zend_extensions.h"
-#include "zend_ini.h"
-
-#include "php_content_types.h"
-#include "php_ticks.h"
-#include "php_logos.h"
-#include "php_streams.h"
-
-#if defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING)
-#include "ext/mbstring/mbstring.h"
-#endif /* defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) */
-
-#include "SAPI.h"
-#include "rfc1867.h"
-/* }}} */
-
-#ifndef ZTS
-php_core_globals core_globals;
-#else
-PHPAPI int core_globals_id;
-#endif
-
-#define SAFE_FILENAME(f) ((f)?(f):"-")
-
-/* {{{ PHP_INI_MH
- */
-static PHP_INI_MH(OnSetPrecision)
-{
- EG(precision) = atoi(new_value);
- return SUCCESS;
-}
-/* }}} */
-
-#if MEMORY_LIMIT
-/* {{{ PHP_INI_MH
- */
-static PHP_INI_MH(OnChangeMemoryLimit)
-{
- int new_limit;
-
- if (new_value) {
- new_limit = zend_atoi(new_value, new_value_length);
- } else {
- new_limit = 1<<30; /* effectively, no limit */
- }
- return zend_set_memory_limit(new_limit);
-}
-/* }}} */
-#endif
-
-
-/* {{{ php_disable_functions
- */
-static void php_disable_functions(TSRMLS_D)
-{
- char *s = NULL;
- char *e = INI_STR("disable_functions");
- char p;
-
- if (!*e) {
- return;
- }
-
- while (*e) {
- switch (*e) {
- case ' ':
- case ',':
- if (s) {
- p = *e;
- *e = '\0';
- zend_disable_function(s, e-s TSRMLS_CC);
- *e = p;
- s = NULL;
- }
- break;
- default:
- if (!s) {
- s = e;
- }
- break;
- }
- e++;
- }
- if (s) {
- zend_disable_function(s, e-s TSRMLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ php_disable_classes
- */
-static void php_disable_classes(TSRMLS_D)
-{
- char *s = NULL;
- char *e = INI_STR("disable_classes");
- char p;
-
- if (!*e) {
- return;
- }
-
- while (*e) {
- switch (*e) {
- case ' ':
- case ',':
- if (s) {
- p = *e;
- *e = '\0';
- zend_disable_class(s, e-s TSRMLS_CC);
- *e = p;
- s = NULL;
- }
- break;
- default:
- if (!s) {
- s = e;
- }
- break;
- }
- e++;
- }
- if (s) {
- zend_disable_class(s, e-s TSRMLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ PHP_INI_MH
- */
-static PHP_INI_MH(OnUpdateTimeout)
-{
- EG(timeout_seconds) = atoi(new_value);
- if (stage==PHP_INI_STAGE_STARTUP) {
- /* Don't set a timeout on startup, only per-request */
- return SUCCESS;
- }
- zend_unset_timeout(TSRMLS_C);
- zend_set_timeout(EG(timeout_seconds));
- return SUCCESS;
-}
-/* }}} */
-
-/* Need to convert to strings and make use of:
- * PHP_SAFE_MODE
- *
- * Need to be read from the environment (?):
- * PHP_AUTO_PREPEND_FILE
- * PHP_AUTO_APPEND_FILE
- * PHP_DOCUMENT_ROOT
- * PHP_USER_DIR
- * PHP_INCLUDE_PATH
- */
-
-#ifndef PHP_SAFE_MODE_EXEC_DIR
-# define PHP_SAFE_MODE_EXEC_DIR ""
-#endif
-
-#ifdef PHP_PROG_SENDMAIL
-# define DEFAULT_SENDMAIL_PATH PHP_PROG_SENDMAIL " -t -i "
-#else
-# define DEFAULT_SENDMAIL_PATH NULL
-#endif
-/* {{{ PHP_INI
- */
-PHP_INI_BEGIN()
- PHP_INI_ENTRY_EX("define_syslog_variables", "0", PHP_INI_ALL, NULL, php_ini_boolean_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.bg", HL_BG_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.comment", HL_COMMENT_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.default", HL_DEFAULT_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.html", HL_HTML_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.keyword", HL_KEYWORD_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
-
- STD_PHP_INI_BOOLEAN("allow_call_time_pass_reference", "1", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, allow_call_time_pass_reference, zend_compiler_globals, compiler_globals)
- STD_PHP_INI_BOOLEAN("asp_tags", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, asp_tags, zend_compiler_globals, compiler_globals)
- STD_PHP_INI_BOOLEAN("display_errors", "1", PHP_INI_ALL, OnUpdateBool, display_errors, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("display_startup_errors", "0", PHP_INI_ALL, OnUpdateBool, display_startup_errors, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateBool, enable_dl, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("expose_php", "1", PHP_INI_SYSTEM, OnUpdateBool, expose_php, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("docref_root", "", PHP_INI_ALL, OnUpdateString, docref_root, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("docref_ext", "", PHP_INI_ALL, OnUpdateString, docref_ext, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("html_errors", "1", PHP_INI_ALL, OnUpdateBool, html_errors, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("xmlrpc_errors", "0", PHP_INI_SYSTEM, OnUpdateBool, xmlrpc_errors, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("xmlrpc_error_number", "0", PHP_INI_ALL, OnUpdateLong, xmlrpc_error_number, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("max_input_time", "-1", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateLong, max_input_time, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("ignore_user_abort", "0", PHP_INI_ALL, OnUpdateBool, ignore_user_abort, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("implicit_flush", "0", PHP_INI_ALL, OnUpdateBool, implicit_flush, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("log_errors", "0", PHP_INI_ALL, OnUpdateBool, log_errors, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("log_errors_max_len", "1024", PHP_INI_ALL, OnUpdateLong, log_errors_max_len, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("ignore_repeated_errors", "0", PHP_INI_ALL, OnUpdateBool, ignore_repeated_errors, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("ignore_repeated_source", "0", PHP_INI_ALL, OnUpdateBool, ignore_repeated_source, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("report_memleaks", "1", PHP_INI_ALL, OnUpdateBool, report_memleaks, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("report_zend_debug", "1", PHP_INI_ALL, OnUpdateBool, report_zend_debug, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("magic_quotes_gpc", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, magic_quotes_gpc, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("magic_quotes_runtime", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_runtime, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("magic_quotes_sybase", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_sybase, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("output_buffering", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateLong, output_buffering, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("output_handler", NULL, PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateString, output_handler, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_argc_argv, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("register_globals", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_globals, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("register_long_arrays", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_long_arrays, php_core_globals, core_globals)
-#if PHP_SAFE_MODE
- STD_PHP_INI_BOOLEAN("safe_mode", "1", PHP_INI_SYSTEM, OnUpdateBool, safe_mode, php_core_globals, core_globals)
-#else
- STD_PHP_INI_BOOLEAN("safe_mode", "0", PHP_INI_SYSTEM, OnUpdateBool, safe_mode, php_core_globals, core_globals)
-#endif
- STD_PHP_INI_ENTRY("safe_mode_include_dir", NULL, PHP_INI_SYSTEM, OnUpdateString, safe_mode_include_dir, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("safe_mode_gid", "0", PHP_INI_SYSTEM, OnUpdateBool, safe_mode_gid, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("short_open_tag", DEFAULT_SHORT_OPEN_TAG, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, short_tags, zend_compiler_globals, compiler_globals)
- STD_PHP_INI_BOOLEAN("sql.safe_mode", "0", PHP_INI_SYSTEM, OnUpdateBool, sql_safe_mode, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("track_errors", "0", PHP_INI_ALL, OnUpdateBool, track_errors, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("y2k_compliance", "1", PHP_INI_ALL, OnUpdateBool, y2k_compliance, php_core_globals, core_globals)
-
- STD_PHP_INI_ENTRY("unserialize_callback_func", NULL, PHP_INI_ALL, OnUpdateString, unserialize_callback_func, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("serialize_precision", "100", PHP_INI_ALL, OnUpdateLong, serialize_precision, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("arg_separator.output", "&", PHP_INI_ALL, OnUpdateStringUnempty, arg_separator.output, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("arg_separator.input", "&", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateStringUnempty, arg_separator.input, php_core_globals, core_globals)
-
- STD_PHP_INI_ENTRY("auto_append_file", NULL, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, auto_append_file, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("auto_prepend_file", NULL, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, auto_prepend_file, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, doc_root, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("default_charset", SAPI_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateString, default_charset, sapi_globals_struct,sapi_globals)
- STD_PHP_INI_ENTRY("default_mimetype", SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateString, default_mimetype, sapi_globals_struct,sapi_globals)
- STD_PHP_INI_ENTRY("error_log", NULL, PHP_INI_ALL, OnUpdateString, error_log, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("extension_dir", PHP_EXTENSION_DIR, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("gpc_order", "GPC", PHP_INI_ALL, OnUpdateStringUnempty, gpc_order, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("include_path", PHP_INCLUDE_PATH, PHP_INI_ALL, OnUpdateStringUnempty, include_path, php_core_globals, core_globals)
- PHP_INI_ENTRY("max_execution_time", "30", PHP_INI_ALL, OnUpdateTimeout)
- STD_PHP_INI_ENTRY("open_basedir", NULL, PHP_INI_SYSTEM, OnUpdateString, open_basedir, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("safe_mode_exec_dir", PHP_SAFE_MODE_EXEC_DIR, PHP_INI_SYSTEM, OnUpdateString, safe_mode_exec_dir, php_core_globals, core_globals)
-
- STD_PHP_INI_BOOLEAN("file_uploads", "1", PHP_INI_SYSTEM, OnUpdateBool, file_uploads, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("upload_max_filesize", "2M", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateLong, upload_max_filesize, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("post_max_size", "8M", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateLong, post_max_size, sapi_globals_struct,sapi_globals)
- STD_PHP_INI_ENTRY("upload_tmp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, upload_tmp_dir, php_core_globals, core_globals)
-
- STD_PHP_INI_ENTRY("user_dir", NULL, PHP_INI_SYSTEM, OnUpdateString, user_dir, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("variables_order", NULL, PHP_INI_ALL, OnUpdateStringUnempty, variables_order, php_core_globals, core_globals)
-
- STD_PHP_INI_ENTRY("error_append_string", NULL, PHP_INI_ALL, OnUpdateString, error_append_string, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("error_prepend_string", NULL, PHP_INI_ALL, OnUpdateString, error_prepend_string, php_core_globals, core_globals)
-
- PHP_INI_ENTRY("SMTP", "localhost",PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("smtp_port", "25", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("browscap", NULL, PHP_INI_SYSTEM, NULL)
-#if MEMORY_LIMIT
- PHP_INI_ENTRY("memory_limit", "8M", PHP_INI_ALL, OnChangeMemoryLimit)
-#endif
- PHP_INI_ENTRY("precision", "14", PHP_INI_ALL, OnSetPrecision)
- PHP_INI_ENTRY("sendmail_from", NULL, PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("sendmail_path", DEFAULT_SENDMAIL_PATH, PHP_INI_SYSTEM, NULL)
- PHP_INI_ENTRY("mail_force_extra_parameters",NULL, PHP_INI_SYSTEM, NULL)
- PHP_INI_ENTRY("disable_functions", "", PHP_INI_SYSTEM, NULL)
- PHP_INI_ENTRY("disable_classes", "", PHP_INI_SYSTEM, NULL)
-
- STD_PHP_INI_BOOLEAN("allow_url_fopen", "1", PHP_INI_ALL, OnUpdateBool, allow_url_fopen, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("always_populate_raw_post_data", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, always_populate_raw_post_data, php_core_globals, core_globals)
-
-PHP_INI_END()
-/* }}} */
-
-/* True global (no need for thread safety */
-static int module_initialized = 0;
-
-/* {{{ php_log_err
- */
-PHPAPI void php_log_err(char *log_message TSRMLS_DC)
-{
- FILE *log_file;
- char error_time_str[128];
- struct tm tmbuf;
- time_t error_time;
-
- /* Try to use the specified logging location. */
- if (PG(error_log) != NULL) {
-#ifdef HAVE_SYSLOG_H
- if (!strcmp(PG(error_log), "syslog")) {
- php_syslog(LOG_NOTICE, "%.500s", log_message);
- return;
- }
-#endif
- log_file = VCWD_FOPEN(PG(error_log), "a");
- if (log_file != NULL) {
- time(&error_time);
- strftime(error_time_str, sizeof(error_time_str), "%d-%b-%Y %H:%M:%S", php_localtime_r(&error_time, &tmbuf));
- fprintf(log_file, "[%s] ", error_time_str);
- fprintf(log_file, "%s", log_message);
- fprintf(log_file, "\n");
- fclose(log_file);
- return;
- }
- }
-
- /* Otherwise fall back to the default logging location, if we have one */
-
- if (sapi_module.log_message) {
- sapi_module.log_message(log_message);
- }
-}
-/* }}} */
-
-/* {{{ php_write
- wrapper for modules to use PHPWRITE */
-PHPAPI int php_write(void *buf, uint size TSRMLS_DC)
-{
- return PHPWRITE(buf, size);
-}
-/* }}} */
-
-/* {{{ php_printf
- */
-PHPAPI int php_printf(const char *format, ...)
-{
- va_list args;
- int ret;
- char *buffer;
- int size;
- TSRMLS_FETCH();
-
- va_start(args, format);
- size = vspprintf(&buffer, 0, format, args);
- if (buffer) {
- ret = PHPWRITE(buffer, size);
- efree(buffer);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Out of memory");
- ret = 0;
- }
- va_end(args);
-
- return ret;
-}
-/* }}} */
-
-/* {{{ php_verror */
-/* php_verror is called from php_error_docref<n> functions.
- * Its purpose is to unify error messages and automatically generate clickable
- * html error messages if correcponding ini setting (html_errors) is activated.
- * See: CODING_STANDARDS for details.
- */
-PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args TSRMLS_DC)
-{
- char *buffer = NULL, *docref_buf = NULL, *ref = NULL, *target = NULL;
- char *docref_target = "", *docref_root = "";
- char *function, *p;
- int buffer_len = 0;
-
- buffer_len = vspprintf(&buffer, 0, format, args);
- if (buffer) {
- if (PG(html_errors)) {
- int len;
- char *replace = php_escape_html_entities(buffer, buffer_len, &len, 0, ENT_COMPAT, NULL TSRMLS_CC);
- efree(buffer);
- buffer = replace;
- buffer_len = len;
- }
-
- if (docref && docref[0] == '#') {
- docref_target = strchr(docref, '#');
- docref = NULL;
- }
- if (!docref) {
- function = get_active_function_name(TSRMLS_C);
- if (function) {
- spprintf(&docref_buf, 0, "function.%s", function);
- if (docref_buf) {
- while((p=strchr(docref_buf, '_'))!=NULL) *p = '-';
- docref = docref_buf;
- }
- }
- }
- if (docref) {
- if (strncmp(docref, "http://", 7)) {
- docref_root = PG(docref_root);
- /* now check copy of extension */
- ref = estrdup(docref);
- if (ref) {
- if (docref_buf) {
- efree(docref_buf);
- }
- docref_buf = ref;
- docref = docref_buf;
- p = strrchr(ref, '#');
- if (p) {
- target = estrdup(p);
- if (target) {
- docref_target = target;
- *p = '\0';
- }
- }
- if ((!p || target) && PG(docref_ext) && strlen(PG(docref_ext))) {
- spprintf(&docref_buf, 0, "%s%s", ref, PG(docref_ext));
- if (docref_buf) {
- efree(ref);
- docref = docref_buf;
- }
- }
- }
- }
- if (!PG(html_errors) || !strlen(PG(docref_root))) {
- /* no docref and no html errors -> do not point to any documentation (e.g. production boxes) */
- php_error(type, "%s(%s): %s", get_active_function_name(TSRMLS_C), params, buffer);
- } else if (PG(html_errors)) {
- php_error(type, "%s(%s) [<a href='%s%s%s'>%s</a>]: %s", get_active_function_name(TSRMLS_C), params, docref_root, docref, docref_target, docref, buffer);
- } else {
- php_error(type, "%s(%s) [%s%s%s]: %s", get_active_function_name(TSRMLS_C), params, docref_root, docref, docref_target, buffer);
- }
- if (target) {
- efree(target);
- }
- } else {
- docref = get_active_function_name(TSRMLS_C);
- if (!docref)
- docref = "Unknown";
- php_error(type, "%s(%s): %s", docref, params, buffer);
- }
-
- if (PG(track_errors) && EG(active_symbol_table)) {
- zval *tmp;
- ALLOC_ZVAL(tmp);
- INIT_PZVAL(tmp);
- Z_STRVAL_P(tmp) = (char *) estrndup(buffer, buffer_len);
- Z_STRLEN_P(tmp) = buffer_len;
- Z_TYPE_P(tmp) = IS_STRING;
- zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(pval *), NULL);
- }
- efree(buffer);
- if (docref_buf) {
- efree(docref_buf);
- }
- } else {
- php_error(E_ERROR, "%s(%s): Out of memory", get_active_function_name(TSRMLS_C), params);
- }
-}
-/* }}} */
-
-/* {{{ php_error_docref */
-/* See: CODING_STANDARDS for details. */
-PHPAPI void php_error_docref(const char *docref TSRMLS_DC, int type, const char *format, ...)
-{
- va_list args;
-
- va_start(args, format);
- php_verror(docref, "", type, format, args TSRMLS_CC);
- va_end(args);
-}
-/* }}} */
-
-/* {{{ php_error_docref1 */
-/* See: CODING_STANDARDS for details. */
-PHPAPI void php_error_docref1(const char *docref TSRMLS_DC, const char *param1, int type, const char *format, ...)
-{
- va_list args;
-
- va_start(args, format);
- php_verror(docref, param1, type, format, args TSRMLS_CC);
- va_end(args);
-}
-/* }}} */
-
-/* {{{ php_error_docref2 */
-/* See: CODING_STANDARDS for details. */
-PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, const char *param2, int type, const char *format, ...)
-{
- char *params;
- va_list args;
-
- spprintf(&params, 0, "%s,%s", param1, param2);
- va_start(args, format);
- php_verror(docref, params ? params : "...", type, format, args TSRMLS_CC);
- va_end(args);
- if (params)
- efree(params);
-}
-/* }}} */
-
-/* {{{ php_html_puts */
-PHPAPI void php_html_puts(const char *str, uint size TSRMLS_DC)
-{
- zend_html_puts(str, size TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ php_suppress_errors */
-PHPAPI void php_set_error_handling(error_handling_t error_handling, zend_class_entry *exception_class TSRMLS_DC) {
- PG(error_handling) = error_handling;
- PG(exception_class) = exception_class;
- if (PG(last_error_message)) {
- free(PG(last_error_message));
- PG(last_error_message) = NULL;
- }
- if (PG(last_error_file)) {
- free(PG(last_error_file));
- PG(last_error_file) = NULL;
- }
- PG(last_error_lineno) = 0;
-}
-/* }}} */
-
-/* {{{ php_error_cb
- extended error handling function */
-static void php_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args)
-{
- char *buffer;
- int buffer_len, display;
- TSRMLS_FETCH();
-
- buffer_len = vspprintf(&buffer, PG(log_errors_max_len), format, args);
-
- /* check for repeated errors to be ignored */
- if (PG(ignore_repeated_errors) && PG(last_error_message)) {
- /* no check for PG(last_error_file) is needed since it cannot
- * be NULL if PG(last_error_message) is not NULL */
- if (strcmp(PG(last_error_message), buffer)
- || (!PG(ignore_repeated_source)
- && ((PG(last_error_lineno) != error_lineno)
- || strcmp(PG(last_error_file), error_filename)))) {
- display = 1;
- } else {
- display = 0;
- }
- } else {
- display = 1;
- }
-
- /* store the error if it has changed */
- if (display) {
- if (PG(last_error_message)) {
- free(PG(last_error_message));
- }
- if (PG(last_error_file)) {
- free(PG(last_error_file));
- }
- PG(last_error_message) = strdup(buffer);
- PG(last_error_file) = strdup(error_filename);
- PG(last_error_lineno) = error_lineno;
- }
-
- /* according to error handling mode, suppress error, throw exception or show it */
- if (PG(error_handling)) {
- switch (type) {
- case E_ERROR:
- case E_CORE_ERROR:
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- case E_PARSE:
- /* fatal errors are real errors and cannot be made exceptions */
- break;
- default:
- /* throw an exception if we are in EH_THROW mode
- * but DO NOT overwrite a pending excepption
- */
- if (PG(error_handling) == EH_THROW && !EG(exception)) {
- zval *tmp;
- ALLOC_ZVAL(EG(exception));
- Z_TYPE_P(EG(exception)) = IS_OBJECT;
- object_init_ex(EG(exception), PG(exception_class) ? PG(exception_class) : zend_exception_get_default());
- EG(exception)->refcount = 1;
- EG(exception)->is_ref = 1;
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, buffer, 0);
- zend_hash_update(Z_OBJPROP_P(EG(exception)), "message", sizeof("message"), (void **) &tmp, sizeof(zval *), NULL);
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, (char*)error_filename, 1);
- zend_hash_update(Z_OBJPROP_P(EG(exception)), "file", sizeof("file"), (void **) &tmp, sizeof(zval *), NULL);
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, error_lineno);
- zend_hash_update(Z_OBJPROP_P(EG(exception)), "line", sizeof("line"), (void **) &tmp, sizeof(zval *), NULL);
- }
- return;
- }
- }
-
- /* display/log the error if necessary */
- if (display && (EG(error_reporting) & type || (type & E_CORE))
- && (PG(log_errors) || PG(display_errors) || (!module_initialized))) {
- char *error_type_str;
-
- switch (type) {
- case E_ERROR:
- case E_CORE_ERROR:
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- error_type_str = "Fatal error";
- break;
- case E_WARNING:
- case E_CORE_WARNING:
- case E_COMPILE_WARNING:
- case E_USER_WARNING:
- error_type_str = "Warning";
- break;
- case E_PARSE:
- error_type_str = "Parse error";
- break;
- case E_NOTICE:
- case E_USER_NOTICE:
- error_type_str = "Notice";
- break;
- default:
- error_type_str = "Unknown error";
- break;
- }
-
- if (!module_initialized || PG(log_errors)) {
- char *log_buffer;
-
-#ifdef PHP_WIN32
- if (type==E_CORE_ERROR || type==E_CORE_WARNING) {
- MessageBox(NULL, buffer, error_type_str, MB_OK|ZEND_SERVICE_MB_STYLE);
- }
-#endif
- spprintf(&log_buffer, 0, "PHP %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno);
- php_log_err(log_buffer TSRMLS_CC);
- efree(log_buffer);
- }
- if (module_initialized && PG(display_errors)
- && (!PG(during_request_startup) || PG(display_startup_errors))) {
-
- if (PG(xmlrpc_errors)) {
- php_printf("<?xml version=\"1.0\"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>%ld</int></value></member><member><name>faultString</name><value><string>%s:%s in %s on line %d</string></value></member></struct></value></fault></methodResponse>", PG(xmlrpc_error_number), error_type_str, buffer, error_filename, error_lineno);
- } else {
- char *prepend_string = INI_STR("error_prepend_string");
- char *append_string = INI_STR("error_append_string");
- char *error_format = PG(html_errors) ?
- "%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br />\n%s"
- : "%s\n%s: %s in %s on line %d\n%s";
- php_printf(error_format, STR_PRINT(prepend_string), error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string));
- }
- }
-#if ZEND_DEBUG
- if (PG(report_zend_debug)) {
- zend_bool trigger_break;
-
- switch (type) {
- case E_ERROR:
- case E_CORE_ERROR:
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- trigger_break=1;
- break;
- default:
- trigger_break=0;
- break;
- }
- zend_output_debug_string(trigger_break, "%s(%d) : %s - %s", error_filename, error_lineno, error_type_str, buffer);
- }
-#endif
- }
-
- /* Bail out if we can't recover */
- switch (type) {
- case E_CORE_ERROR:
- if(!module_initialized) {
- /* bad error in module startup - no way we can live with this */
- exit(-2);
- }
- /* no break - intentionally */
- case E_ERROR:
- /*case E_PARSE: the parser would return 1 (failure), we can bail out nicely */
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- EG(exit_status) = 255;
- if (module_initialized) {
- zend_bailout();
- efree(buffer);
- return;
- }
- break;
- }
-
- /* Log if necessary */
- if (!display) {
- efree(buffer);
- return;
- }
- if (PG(track_errors) && EG(active_symbol_table)) {
- pval *tmp;
-
- ALLOC_ZVAL(tmp);
- INIT_PZVAL(tmp);
- Z_STRVAL_P(tmp) = (char *) estrndup(buffer, buffer_len);
- Z_STRLEN_P(tmp) = buffer_len;
- Z_TYPE_P(tmp) = IS_STRING;
- zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(pval *), NULL);
- }
- efree(buffer);
-}
-/* }}} */
-
-/* {{{ proto bool set_time_limit(int seconds)
- Sets the maximum time a script can run */
-PHP_FUNCTION(set_time_limit)
-{
- zval **new_timeout;
-
- if (PG(safe_mode)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot set time limit in safe mode");
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &new_timeout) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(new_timeout);
- if (zend_alter_ini_entry("max_execution_time", sizeof("max_execution_time"), Z_STRVAL_PP(new_timeout), Z_STRLEN_PP(new_timeout), PHP_INI_USER, PHP_INI_STAGE_RUNTIME) == SUCCESS) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_fopen_wrapper_for_zend
- */
-static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path)
-{
- TSRMLS_FETCH();
-
- return php_stream_open_wrapper_as_file((char *)filename, "rb", ENFORCE_SAFE_MODE|USE_PATH|IGNORE_URL_WIN|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE, opened_path);
-}
-/* }}} */
-
-static void stream_closer_for_zend(void *handle TSRMLS_DC)
-{
- php_stream_close((php_stream*)handle);
-}
-
-static int php_stream_open_for_zend(const char *filename, zend_file_handle *handle TSRMLS_DC)
-{
- php_stream *stream;
-
- stream = php_stream_open_wrapper((char *)filename, "rb", ENFORCE_SAFE_MODE|USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE, &handle->opened_path);
-
- if (stream) {
- handle->type = ZEND_HANDLE_STREAM;
- handle->filename = (char*)filename;
- handle->free_filename = 0;
- handle->handle.stream.handle = stream;
- handle->handle.stream.reader = (zend_stream_reader_t)_php_stream_read;
- handle->handle.stream.closer = stream_closer_for_zend;
- handle->handle.stream.interactive = 0;
-
- return SUCCESS;
- }
- return FAILURE;
-}
-
-
-/* {{{ php_get_configuration_directive_for_zend
- */
-static int php_get_configuration_directive_for_zend(char *name, uint name_length, zval *contents)
-{
- zval *retval = cfg_get_entry(name, name_length);
-
- if (retval) {
- *contents = *retval;
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-/* }}} */
-
-/* {{{ php_message_handler_for_zend
- */
-static void php_message_handler_for_zend(long message, void *data)
-{
- switch (message) {
- case ZMSG_FAILED_INCLUDE_FOPEN: {
- TSRMLS_FETCH();
-
- php_error_docref("function.include" TSRMLS_CC, E_WARNING, "Failed opening '%s' for inclusion (include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path)));
- }
- break;
- case ZMSG_FAILED_REQUIRE_FOPEN: {
- TSRMLS_FETCH();
-
- php_error_docref("function.require" TSRMLS_CC, E_COMPILE_ERROR, "Failed opening required '%s' (include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path)));
- }
- break;
- case ZMSG_FAILED_HIGHLIGHT_FOPEN: {
- TSRMLS_FETCH();
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed opening '%s' for highlighting", php_strip_url_passwd((char *) data));
- }
- break;
- case ZMSG_MEMORY_LEAK_DETECTED:
- case ZMSG_MEMORY_LEAK_REPEATED: {
- TSRMLS_FETCH();
-
- if ((EG(error_reporting)&E_WARNING) && PG(report_memleaks)) {
-#if ZEND_DEBUG
- char memory_leak_buf[512];
-
- if (message==ZMSG_MEMORY_LEAK_DETECTED) {
- zend_mem_header *t = (zend_mem_header *) data;
- void *ptr = (void *)((char *)t+sizeof(zend_mem_header)+MEM_HEADER_PADDING);
-
- snprintf(memory_leak_buf, 512, "%s(%d) : Freeing 0x%.8lX (%d bytes), script=%s\n", t->filename, t->lineno, (unsigned long)ptr, t->size, SAFE_FILENAME(SG(request_info).path_translated));
- if (t->orig_filename) {
- char relay_buf[512];
-
- snprintf(relay_buf, 512, "%s(%d) : Actual location (location was relayed)\n", t->orig_filename, t->orig_lineno);
- strcat(memory_leak_buf, relay_buf);
- }
- } else {
- unsigned long leak_count = (unsigned long) data;
-
- snprintf(memory_leak_buf, 512, "Last leak repeated %ld time%s\n", leak_count, (leak_count>1?"s":""));
- }
-# if defined(PHP_WIN32)
- OutputDebugString(memory_leak_buf);
-# else
- fprintf(stderr, "%s", memory_leak_buf);
-# endif
-#endif
- }
- }
- break;
- case ZMSG_LOG_SCRIPT_NAME: {
- struct tm *ta, tmbuf;
- time_t curtime;
- char *datetime_str, asctimebuf[52];
- TSRMLS_FETCH();
-
- time(&curtime);
- ta = php_localtime_r(&curtime, &tmbuf);
- datetime_str = php_asctime_r(ta, asctimebuf);
- datetime_str[strlen(datetime_str)-1]=0; /* get rid of the trailing newline */
- fprintf(stderr, "[%s] Script: '%s'\n", datetime_str, SAFE_FILENAME(SG(request_info).path_translated));
- }
- break;
- }
-}
-/* }}} */
-
-
-void php_on_timeout(int seconds TSRMLS_DC)
-{
- PG(connection_status) |= PHP_CONNECTION_TIMEOUT;
-}
-
-#if PHP_SIGCHILD
-/* {{{ sigchld_handler
- */
-static void sigchld_handler(int apar)
-{
- while (waitpid(-1, NULL, WNOHANG) > 0);
- signal(SIGCHLD, sigchld_handler);
-}
-/* }}} */
-#endif
-
-/* {{{ php_start_sapi()
- */
-static int php_start_sapi(TSRMLS_D)
-{
- int retval = SUCCESS;
-
- if(!SG(sapi_started)) {
- zend_try {
- PG(during_request_startup) = 1;
-
- /* initialize global variables */
- PG(modules_activated) = 0;
- PG(header_is_being_sent) = 0;
- PG(connection_status) = PHP_CONNECTION_NORMAL;
-
- zend_activate(TSRMLS_C);
- zend_set_timeout(EG(timeout_seconds));
- zend_activate_modules(TSRMLS_C);
- PG(modules_activated)=1;
- } zend_catch {
- retval = FAILURE;
- } zend_end_try();
-
- SG(sapi_started) = 1;
- }
- return retval;
-}
-
-/* }}} */
-
-/* {{{ php_request_startup
- */
- #ifndef APACHE_HOOKS
-int php_request_startup(TSRMLS_D)
-{
- int retval = SUCCESS;
-
-#ifdef PHP_WIN32
- CoInitialize(NULL);
-#endif
-
-#if PHP_SIGCHILD
- signal(SIGCHLD, sigchld_handler);
-#endif
-
- zend_try {
- PG(during_request_startup) = 1;
-
- php_output_activate(TSRMLS_C);
-
- /* initialize global variables */
- PG(modules_activated) = 0;
- PG(header_is_being_sent) = 0;
- PG(connection_status) = PHP_CONNECTION_NORMAL;
-
- zend_activate(TSRMLS_C);
- sapi_activate(TSRMLS_C);
-
- if (PG(max_input_time) == -1) {
- zend_set_timeout(EG(timeout_seconds));
- } else {
- zend_set_timeout(PG(max_input_time));
- }
-
- if (PG(expose_php)) {
- sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1);
- }
-
- if (PG(output_handler) && PG(output_handler)[0]) {
- php_start_ob_buffer_named(PG(output_handler), 0, 1 TSRMLS_CC);
- } else if (PG(output_buffering)) {
- if (PG(output_buffering)>1) {
- php_start_ob_buffer(NULL, PG(output_buffering), 1 TSRMLS_CC);
- } else {
- php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC);
- }
- } else if (PG(implicit_flush)) {
- php_start_implicit_flush(TSRMLS_C);
- }
-
- /* We turn this off in php_execute_script() */
- /* PG(during_request_startup) = 0; */
-
- php_hash_environment(TSRMLS_C);
- zend_activate_modules(TSRMLS_C);
- PG(modules_activated)=1;
- } zend_catch {
- retval = FAILURE;
- } zend_end_try();
-
- return retval;
-}
-# else
-int php_request_startup(TSRMLS_D)
-{
- int retval = SUCCESS;
-
-#if PHP_SIGCHILD
- signal(SIGCHLD, sigchld_handler);
-#endif
-
- if (php_start_sapi() == FAILURE) {
- return FAILURE;
- }
-
- php_output_activate(TSRMLS_C);
- sapi_activate(TSRMLS_C);
- php_hash_environment(TSRMLS_C);
-
- zend_try {
- PG(during_request_startup) = 1;
- php_output_activate(TSRMLS_C);
- if (PG(expose_php)) {
- sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1);
- }
- } zend_catch {
- retval = FAILURE;
- } zend_end_try();
-
- return retval;
-}
-# endif
-/* }}} */
-
-/* {{{ php_request_startup_for_hook
- */
-int php_request_startup_for_hook(TSRMLS_D)
-{
- int retval = SUCCESS;
-
-#if PHP_SIGCHLD
- signal(SIGCHLD, sigchld_handler);
-#endif
-
- if (php_start_sapi(TSRMLS_C) == FAILURE) {
- return FAILURE;
- }
-
- php_output_activate(TSRMLS_C);
- sapi_activate_headers_only(TSRMLS_C);
- php_hash_environment(TSRMLS_C);
-
- return retval;
-}
-/* }}} */
-
-/* {{{ php_request_shutdown_for_exec
- */
-void php_request_shutdown_for_exec(void *dummy)
-{
- TSRMLS_FETCH();
-
- /* used to close fd's in the 3..255 range here, but it's problematic
- */
- shutdown_memory_manager(1, 1 TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ php_request_shutdown_for_hook
- */
-void php_request_shutdown_for_hook(void *dummy)
-{
- TSRMLS_FETCH();
- if (PG(modules_activated)) zend_try {
- php_call_shutdown_functions();
- } zend_end_try();
-
- if (PG(modules_activated)) {
- zend_deactivate_modules(TSRMLS_C);
- }
-
- zend_try {
- int i;
-
- for (i = 0; i < NUM_TRACK_VARS; i++) {
- if (PG(http_globals)[i]) {
- zval_ptr_dtor(&PG(http_globals)[i]);
- }
- }
- } zend_end_try();
-
- zend_deactivate(TSRMLS_C);
-
- zend_try {
- sapi_deactivate(TSRMLS_C);
- } zend_end_try();
-
- zend_try {
- shutdown_memory_manager(CG(unclean_shutdown), 0 TSRMLS_CC);
- } zend_end_try();
-
- zend_try {
- zend_unset_timeout(TSRMLS_C);
- } zend_end_try();
-}
-
-/* }}} */
-
-/* {{{ php_request_shutdown
- */
-void php_request_shutdown(void *dummy)
-{
- TSRMLS_FETCH();
-
- /* EG(opline_ptr) points into nirvana and therefore cannot be safely accessed
- inside zend_executor callback functions. */
- EG(opline_ptr) = NULL;
-
- zend_try {
- php_end_ob_buffers((zend_bool)(SG(request_info).headers_only?0:1) TSRMLS_CC);
- } zend_end_try();
-
- zend_try {
- sapi_send_headers(TSRMLS_C);
- } zend_end_try();
-
- if (PG(modules_activated)) zend_try {
- php_call_shutdown_functions();
- } zend_end_try();
-
- if (PG(modules_activated)) {
- zend_deactivate_modules(TSRMLS_C);
- }
-
- zend_try {
- int i;
-
- for (i=0; i<NUM_TRACK_VARS; i++) {
- if (PG(http_globals)[i]) {
- zval_ptr_dtor(&PG(http_globals)[i]);
- }
- }
- } zend_end_try();
-
-
- zend_deactivate(TSRMLS_C);
-
- zend_try {
- sapi_deactivate(TSRMLS_C);
- } zend_end_try();
-
- zend_try {
- shutdown_memory_manager(CG(unclean_shutdown), 0 TSRMLS_CC);
- } zend_end_try();
-
- zend_try {
- zend_unset_timeout(TSRMLS_C);
- } zend_end_try();
-
-#ifdef PHP_WIN32
- CoUninitialize();
-#endif
-}
-/* }}} */
-
-
-/* {{{ php_body_write_wrapper
- */
-static int php_body_write_wrapper(const char *str, uint str_length)
-{
- TSRMLS_FETCH();
- return php_body_write(str, str_length TSRMLS_CC);
-}
-/* }}} */
-
-#ifdef ZTS
-/* {{{ core_globals_ctor
- */
-static void core_globals_ctor(php_core_globals *core_globals TSRMLS_DC)
-{
- memset(core_globals, 0, sizeof(*core_globals));
-}
-/* }}} */
-#endif
-
-/* {{{ php_startup_extensions
- */
-int php_startup_extensions(zend_module_entry **ptr, int count)
-{
- zend_module_entry **end = ptr+count;
-
- while (ptr < end) {
- if (*ptr) {
- if (zend_startup_module(*ptr)==FAILURE) {
- return FAILURE;
- }
- }
- ptr++;
- }
- return SUCCESS;
-}
-/* }}} */
-
-
-/* {{{ php_module_startup
- */
-int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_modules, uint num_additional_modules)
-{
- zend_utility_functions zuf;
- zend_utility_values zuv;
- int module_number=0; /* for REGISTER_INI_ENTRIES() */
- char *php_os;
-#ifdef ZTS
- zend_executor_globals *executor_globals;
- void ***tsrm_ls;
-
- php_core_globals *core_globals;
-#endif
-#if defined(PHP_WIN32) || (defined(NETWARE) && defined(USE_WINSOCK))
- WORD wVersionRequested = MAKEWORD(2, 0);
- WSADATA wsaData;
-#endif
-#ifdef PHP_WIN32
- {
- DWORD dwVersion = GetVersion();
-
- /* Get build numbers for Windows NT or Win95 */
- if (dwVersion < 0x80000000){
- php_os="WINNT";
- } else {
- php_os="WIN32";
- }
- }
-#else
- php_os=PHP_OS;
-#endif
-
-#ifdef ZTS
- tsrm_ls = ts_resource(0);
-#endif
-
- sapi_initialize_empty_request(TSRMLS_C);
- sapi_activate(TSRMLS_C);
-
- if (module_initialized) {
- return SUCCESS;
- }
-
- sapi_module = *sf;
-
- php_output_startup();
- php_output_activate(TSRMLS_C);
-
- zuf.error_function = php_error_cb;
- zuf.printf_function = php_printf;
- zuf.write_function = php_body_write_wrapper;
- zuf.fopen_function = php_fopen_wrapper_for_zend;
- zuf.message_handler = php_message_handler_for_zend;
- zuf.block_interruptions = sapi_module.block_interruptions;
- zuf.unblock_interruptions = sapi_module.unblock_interruptions;
- zuf.get_configuration_directive = php_get_configuration_directive_for_zend;
- zuf.ticks_function = php_run_ticks;
- zuf.on_timeout = php_on_timeout;
- zuf.stream_open_function = php_stream_open_for_zend;
- zend_startup(&zuf, NULL, 1);
-
-#ifdef ZTS
- executor_globals = ts_resource(executor_globals_id);
- ts_allocate_id(&core_globals_id, sizeof(php_core_globals), (ts_allocate_ctor) core_globals_ctor, NULL);
- core_globals = ts_resource(core_globals_id);
-#endif
- EG(bailout_set) = 0;
- EG(error_reporting) = E_ALL & ~E_NOTICE;
-
- PG(header_is_being_sent) = 0;
- SG(request_info).headers_only = 0;
- SG(request_info).argv0 = NULL;
- SG(request_info).argc=0;
- SG(request_info).argv=(char **)NULL;
- PG(connection_status) = PHP_CONNECTION_NORMAL;
- PG(during_request_startup) = 0;
- PG(last_error_message) = NULL;
- PG(last_error_file) = NULL;
- PG(last_error_lineno) = 0;
- PG(error_handling) = EH_NORMAL;
-
-#if HAVE_SETLOCALE
- setlocale(LC_CTYPE, "");
-#endif
-
-#if defined(PHP_WIN32) || (defined(NETWARE) && defined(USE_WINSOCK))
- /* start up winsock services */
- if (WSAStartup(wVersionRequested, &wsaData) != 0) {
- php_printf("\nwinsock.dll unusable. %d\n", WSAGetLastError());
- return FAILURE;
- }
-#endif
-
- le_index_ptr = zend_register_list_destructors_ex(NULL, NULL, "index pointer", 0);
-
-
- /* this will read in php.ini, set up the configuration parameters,
- load zend extensions and register php function extensions
- to be loaded later */
- if (php_init_config() == FAILURE) {
- return FAILURE;
- }
-
- REGISTER_INI_ENTRIES();
- zend_register_standard_ini_entries(TSRMLS_C);
-
- /* initialize stream wrappers registry
- * (this uses configuration parameters from php.ini)
- */
- if (php_init_stream_wrappers(module_number TSRMLS_CC) == FAILURE) {
- php_printf("PHP: Unable to initialize stream url wrappers.\n");
- return FAILURE;
- }
-
- /* initialize registry for images to be used in phpinfo()
- (this uses configuration parameters from php.ini)
- */
- if (php_init_info_logos() == FAILURE) {
- php_printf("PHP: Unable to initialize info phpinfo logos.\n");
- return FAILURE;
- }
-
- zuv.html_errors = 1;
- zuv.import_use_extension = ".php";
- php_startup_auto_globals(TSRMLS_C);
- zend_set_utility_values(&zuv);
- php_startup_sapi_content_types();
-
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_VERSION", PHP_VERSION, sizeof(PHP_VERSION)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_OS", php_os, strlen(php_os), CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_SAPI", sapi_module.name, strlen(sapi_module.name), CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("DEFAULT_INCLUDE_PATH", PHP_INCLUDE_PATH, sizeof(PHP_INCLUDE_PATH)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PEAR_INSTALL_DIR", PEAR_INSTALLDIR, sizeof(PEAR_INSTALLDIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PEAR_EXTENSION_DIR", PHP_EXTENSION_DIR, sizeof(PHP_EXTENSION_DIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_EXTENSION_DIR", PHP_EXTENSION_DIR, sizeof(PHP_EXTENSION_DIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_PREFIX", PHP_PREFIX, sizeof(PHP_PREFIX)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_BINDIR", PHP_BINDIR, sizeof(PHP_BINDIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_LIBDIR", PHP_LIBDIR, sizeof(PHP_LIBDIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_DATADIR", PHP_DATADIR, sizeof(PHP_DATADIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_SYSCONFDIR", PHP_SYSCONFDIR, sizeof(PHP_SYSCONFDIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_LOCALSTATEDIR", PHP_LOCALSTATEDIR, sizeof(PHP_LOCALSTATEDIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_PATH", PHP_CONFIG_FILE_PATH, sizeof(PHP_CONFIG_FILE_PATH)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_SCAN_DIR", PHP_CONFIG_FILE_SCAN_DIR, sizeof(PHP_CONFIG_FILE_SCAN_DIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_SHLIB_SUFFIX", PHP_SHLIB_SUFFIX, sizeof(PHP_SHLIB_SUFFIX)-1, CONST_PERSISTENT | CONST_CS);
- php_output_register_constants(TSRMLS_C);
- php_rfc1867_register_constants(TSRMLS_C);
-
- if (php_startup_ticks(TSRMLS_C) == FAILURE) {
- php_printf("Unable to start PHP ticks\n");
- return FAILURE;
- }
-
- /* startup extensions staticly compiled in */
- if (php_startup_internal_extensions() == FAILURE) {
- php_printf("Unable to start builtin modules\n");
- return FAILURE;
- }
- /* start additional PHP extensions */
- php_startup_extensions(&additional_modules, num_additional_modules);
-
-
- /* load and startup extensions compiled as shared objects (aka DLLs)
- as requested by php.ini entries
- theese are loaded after initialization of internal extensions
- as extensions *might* rely on things from ext/standard
- which is always an internal extension and to be initialized
- ahead of all other internals
- */
- php_ini_delayed_modules_startup(TSRMLS_C);
-
- /* disable certain classes and functions as requested by php.ini */
- php_disable_functions(TSRMLS_C);
- php_disable_classes(TSRMLS_C);
-
- /* start Zend extensions */
- zend_startup_extensions();
-
-#ifdef ZTS
- zend_post_startup(TSRMLS_C);
-#endif
-
- /* */
- module_initialized = 1;
- sapi_deactivate(TSRMLS_C);
-
- /* we're done */
- return SUCCESS;
-}
-/* }}} */
-
-void php_module_shutdown_for_exec()
-{
- /* used to close fd's in the range 3.255 here, but it's problematic */
-}
-
-/* {{{ php_module_shutdown_wrapper
- */
-int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals)
-{
- TSRMLS_FETCH();
- php_module_shutdown(TSRMLS_C);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_module_shutdown
- */
-void php_module_shutdown(TSRMLS_D)
-{
- int module_number=0; /* for UNREGISTER_INI_ENTRIES() */
-
- if (!module_initialized) {
- return;
- }
-
-#if defined(PHP_WIN32) || (defined(NETWARE) && defined(USE_WINSOCK))
- /*close winsock */
- WSACleanup();
-#endif
-
- php_shutdown_ticks(TSRMLS_C);
- sapi_flush(TSRMLS_C);
-
- zend_shutdown(TSRMLS_C);
-
- php_shutdown_stream_wrappers(module_number TSRMLS_CC);
-
- php_shutdown_info_logos();
- UNREGISTER_INI_ENTRIES();
-
- /* close down the ini config */
- php_shutdown_config();
-
-#ifndef ZTS
- zend_ini_shutdown(TSRMLS_C);
- shutdown_memory_manager(CG(unclean_shutdown), 1 TSRMLS_CC);
-#endif
-
- module_initialized = 0;
- if (PG(last_error_message)) {
- free(PG(last_error_message));
- }
- if (PG(last_error_file)) {
- free(PG(last_error_file));
- }
-}
-/* }}} */
-
-
-/* Only _ENV and _SERVER are JIT'd for now */
-#if 0
-static zend_bool php_auto_globals_create_get(TSRMLS_D)
-{
- if (PG(activated_auto_globals)[TRACK_VARS_GET]) {
- return 0;
- }
-
- return 0;
-}
-
-
-static zend_bool php_auto_globals_create_post(TSRMLS_D)
-{
- if (PG(activated_auto_globals)[TRACK_VARS_POST]) {
- return 0;
- }
- if (!SG(headers_sent) && SG(request_info).request_method && !strcasecmp(SG(request_info).request_method, "POST")) {
- sapi_module.treat_data(PARSE_POST, NULL, NULL TSRMLS_CC); /* POST Data */
- _gpc_flags[0]=1;
- }
-
- PG(activated_auto_globals)[TRACK_VARS_POST] = 1;
-
- return 0;
-}
-
-/* {{{ php_autoglobal_merge
- */
-static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC)
-{
- zval **src_entry, **dest_entry;
- char *string_key;
- uint string_key_len;
- ulong num_key;
- HashPosition pos;
- int key_type;
-
- zend_hash_internal_pointer_reset_ex(src, &pos);
- while (zend_hash_get_current_data_ex(src, (void **)&src_entry, &pos) == SUCCESS) {
- key_type = zend_hash_get_current_key_ex(src, &string_key, &string_key_len, &num_key, 0, &pos);
- if (Z_TYPE_PP(src_entry) != IS_ARRAY || (zend_hash_find(dest, string_key, string_key_len, (void **)&dest_entry) != SUCCESS) || Z_TYPE_PP(dest_entry) != IS_ARRAY) {
- (*src_entry)->refcount++;
- if (key_type == HASH_KEY_IS_STRING) {
- zend_hash_update(dest, string_key, strlen(string_key)+1, src_entry, sizeof(zval *), NULL);
- } else {
- zend_hash_next_index_insert(dest, src_entry, sizeof(zval *), NULL);
- }
- } else {
- SEPARATE_ZVAL(dest_entry);
- php_autoglobal_merge(Z_ARRVAL_PP(dest_entry), Z_ARRVAL_PP(src_entry) TSRMLS_CC);
- }
- zend_hash_move_forward_ex(src, &pos);
- }
-}
-/* }}} */
-
-static zend_bool php_auto_globals_create_cookie(TSRMLS_D)
-{
- if (PG(activated_auto_globals)[TRACK_VARS_COOKIE]) {
- return 0;
- }
-
- return 0;
-}
-
-
-static zend_bool php_auto_globals_create_request(TSRMLS_D)
-{
- zval *form_variables;
-
- if (PG(activated_auto_globals)[TRACK_VARS_REQUEST]) {
- return 0;
- }
-
- php_auto_globals_create_get(TSRMLS_C);
- php_auto_globals_create_post(TSRMLS_C);
- php_auto_globals_create_cookie(TSRMLS_C);
-
- ALLOC_ZVAL(form_variables);
- array_init(form_variables);
- INIT_PZVAL(form_variables);
-
- for (p=variables_order; p && *p; p++) {
- switch (*p) {
- case 'g':
- case 'G':
- php_autoglobal_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_GET]) TSRMLS_CC);
- break;
- case 'p':
- case 'P':
- php_autoglobal_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_POST]) TSRMLS_CC);
- break;
- case 'c':
- case 'C':
- php_autoglobal_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]) TSRMLS_CC);
- break;
- }
- }
-
- zend_hash_update(&EG(symbol_table), "_REQUEST", sizeof("_REQUEST"), &form_variables, sizeof(zval *), NULL);
-}
-#endif
-
-
-
-
-/* {{{ php_execute_script
- */
-PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)
-{
- zend_file_handle *prepend_file_p, *append_file_p;
- zend_file_handle prepend_file, append_file;
-#if HAVE_BROKEN_GETCWD
- int old_cwd_fd = -1;
-#else
- char *old_cwd;
-#endif
- char *old_primary_file_path = NULL;
- int retval = 0;
-
- EG(exit_status) = 0;
- if (php_handle_special_queries(TSRMLS_C)) {
- return 0;
- }
-#ifndef HAVE_BROKEN_GETCWD
-# define OLD_CWD_SIZE 4096
- old_cwd = do_alloca(OLD_CWD_SIZE);
- old_cwd[0] = '\0';
-#endif
-
- zend_try {
-#ifdef PHP_WIN32
- UpdateIniFromRegistry(primary_file->filename TSRMLS_CC);
-#endif
-
- PG(during_request_startup) = 0;
-
- if (primary_file->type == ZEND_HANDLE_FILENAME
- && primary_file->filename) {
-#if HAVE_BROKEN_GETCWD
- /* this looks nasty to me */
- old_cwd_fd = open(".", 0);
- if (old_cwd_fd == -1) {
- zend_bailout();
- }
-#else
- VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1);
-#endif
- VCWD_CHDIR_FILE(primary_file->filename);
- }
-
- if (primary_file->filename) {
- char realfile[MAXPATHLEN];
- int realfile_len;
- int dummy = 1;
- if (VCWD_REALPATH(primary_file->filename, realfile)) {
- realfile_len = strlen(realfile);
- zend_hash_add(&EG(included_files), realfile, realfile_len+1, (void *)&dummy, sizeof(int), NULL);
- if (strncmp(realfile, primary_file->filename, realfile_len)) {
- old_primary_file_path = primary_file->filename;
- primary_file->filename = realfile;
- }
- }
- }
-
- if (PG(auto_prepend_file) && PG(auto_prepend_file)[0]) {
- prepend_file.filename = PG(auto_prepend_file);
- prepend_file.opened_path = NULL;
- prepend_file.free_filename = 0;
- prepend_file.type = ZEND_HANDLE_FILENAME;
- prepend_file_p = &prepend_file;
- } else {
- prepend_file_p = NULL;
- }
-
- if (PG(auto_append_file) && PG(auto_append_file)[0]) {
- append_file.filename = PG(auto_append_file);
- append_file.opened_path = NULL;
- append_file.free_filename = 0;
- append_file.type = ZEND_HANDLE_FILENAME;
- append_file_p = &append_file;
- } else {
- append_file_p = NULL;
- }
-#if defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING)
- php_mb_set_zend_encoding(TSRMLS_C);
-#endif /* ZEND_MULTIBYTE && HAVE_MBSTRING */
-#ifdef PHP_WIN32
- zend_unset_timeout(TSRMLS_C);
-#endif
- zend_set_timeout(INI_INT("max_execution_time"));
- retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 3, prepend_file_p, primary_file, append_file_p) == SUCCESS);
-
- if (old_primary_file_path) {
- primary_file->filename = old_primary_file_path;
- }
-
- } zend_end_try();
-
-#if HAVE_BROKEN_GETCWD
- if (old_cwd_fd != -1) {
- fchdir(old_cwd_fd);
- close(old_cwd_fd);
- }
-#else
- if (old_cwd[0] != '\0') {
- VCWD_CHDIR(old_cwd);
- }
- free_alloca(old_cwd);
-#endif
- return retval;
-}
-/* }}} */
-
-/* {{{ php_execute_simple_script
- */
-PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval **ret TSRMLS_DC)
-{
- char *old_cwd;
-
- EG(exit_status) = 0;
-#define OLD_CWD_SIZE 4096
- old_cwd = do_alloca(OLD_CWD_SIZE);
- old_cwd[0] = '\0';
-
- zend_try {
-#ifdef PHP_WIN32
- UpdateIniFromRegistry(primary_file->filename TSRMLS_CC);
-#endif
-
- PG(during_request_startup) = 0;
-
- if (primary_file->type == ZEND_HANDLE_FILENAME && primary_file->filename) {
- VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1);
- VCWD_CHDIR_FILE(primary_file->filename);
- }
- zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, ret, 1, primary_file);
- } zend_end_try();
-
- if (old_cwd[0] != '\0') {
- VCWD_CHDIR(old_cwd);
- }
-
- free_alloca(old_cwd);
- return EG(exit_status);
-}
-/* }}} */
-
-/* {{{ php_handle_aborted_connection
- */
-PHPAPI void php_handle_aborted_connection(void)
-{
- TSRMLS_FETCH();
-
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- php_output_set_status(0 TSRMLS_CC);
-
- if (!PG(ignore_user_abort)) {
- zend_bailout();
- }
-}
-/* }}} */
-
-/* {{{ php_handle_auth_data
- */
-PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC)
-{
- int ret = -1;
-
- if (auth && auth[0] != '\0' && strncmp(auth, "Basic ", 6) == 0) {
- char *pass;
- char *user;
-
- user = php_base64_decode(auth + 6, strlen(auth) - 6, NULL);
- if (user) {
- pass = strchr(user, ':');
- if (pass) {
- *pass++ = '\0';
- SG(request_info).auth_user = user;
- SG(request_info).auth_password = estrdup(pass);
- ret = 0;
- } else {
- efree(user);
- }
- }
- }
-
- if (ret == -1) {
- SG(request_info).auth_user = SG(request_info).auth_password = NULL;
- }
-
- return ret;
-}
-/* }}} */
-
-/* {{{ php_lint_script
- */
-PHPAPI int php_lint_script(zend_file_handle *file TSRMLS_DC)
-{
- zend_op_array *op_array;
-
- zend_try {
- op_array = zend_compile_file(file, ZEND_INCLUDE TSRMLS_CC);
- zend_destroy_file_handle(file TSRMLS_CC);
-
- if (op_array) {
- destroy_op_array(op_array TSRMLS_CC);
- efree(op_array);
- return SUCCESS;
- } else {
- return FAILURE;
- }
- } zend_end_try();
-
- return FAILURE;
-}
-/* }}} */
-
-#ifdef PHP_WIN32
-/* {{{ dummy_indent
- just so that this symbol gets exported... */
-PHPAPI void dummy_indent()
-{
- zend_indent();
-}
-/* }}} */
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/mergesort.c b/main/mergesort.c
deleted file mode 100644
index 117f859e94..0000000000
--- a/main/mergesort.c
+++ /dev/null
@@ -1,363 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Peter McIlroy.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* $Id$ */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94";
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * Hybrid exponential search/linear search merge sort with hybrid
- * natural/pairwise first pass. Requires about .3% more comparisons
- * for random data than LSMS with pairwise first pass alone.
- * It works for objects as small as two bytes.
- */
-
-#define NATURAL
-#define THRESHOLD 16 /* Best choice for natural merge cut-off. */
-
-/* #define NATURAL to get hybrid natural merge.
- * (The default is pairwise merging.)
- */
-
-#include <sys/types.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "php.h"
-
-#ifdef PHP_WIN32
-#include <winsock2.h> /* Includes definition for u_char */
-#endif
-
-#if defined(NETWARE) && !defined(NEW_LIBC)
-/*#include <ws2nlm.h>*/
-#include <sys/socket.h>
-#endif
-
-static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC);
-static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC);
-
-#define ISIZE sizeof(int)
-#define PSIZE sizeof(u_char *)
-#define ICOPY_LIST(src, dst, last) \
- do \
- *(int*)dst = *(int*)src, src += ISIZE, dst += ISIZE; \
- while(src < last)
-#define ICOPY_ELT(src, dst, i) \
- do \
- *(int*) dst = *(int*) src, src += ISIZE, dst += ISIZE; \
- while (i -= ISIZE)
-
-#define CCOPY_LIST(src, dst, last) \
- do \
- *dst++ = *src++; \
- while (src < last)
-#define CCOPY_ELT(src, dst, i) \
- do \
- *dst++ = *src++; \
- while (i -= 1)
-
-/*
- * Find the next possible pointer head. (Trickery for forcing an array
- * to do double duty as a linked list when objects do not align with word
- * boundaries.
- */
-/* Assumption: PSIZE is a power of 2. */
-#define EVAL(p) (u_char **) \
- ((u_char *)0 + \
- (((u_char *)p + PSIZE - 1 - (u_char *) 0) & ~(PSIZE - 1)))
-
-/* {{{ php_mergesort
- * Arguments are as for qsort.
- */
-int php_mergesort(void *base, size_t nmemb, size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC)
-{
- register unsigned int i;
- register int sense;
- int big, iflag;
- register u_char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2;
- u_char *list2, *list1, *p2, *p, *last, **p1;
-
- if (size < PSIZE / 2) { /* Pointers must fit into 2 * size. */
- errno = EINVAL;
- return (-1);
- }
-
- if (nmemb == 0)
- return (0);
-
- /*
- * XXX
- * Stupid subtraction for the Cray.
- */
- iflag = 0;
- if (!(size % ISIZE) && !(((char *)base - (char *)0) % ISIZE))
- iflag = 1;
-
- if ((list2 = malloc(nmemb * size + PSIZE)) == NULL)
- return (-1);
-
- list1 = base;
- setup(list1, list2, nmemb, size, cmp TSRMLS_CC);
- last = list2 + nmemb * size;
- i = big = 0;
- while (*EVAL(list2) != last) {
- l2 = list1;
- p1 = EVAL(list1);
- for (tp2 = p2 = list2; p2 != last; p1 = EVAL(l2)) {
- p2 = *EVAL(p2);
- f1 = l2;
- f2 = l1 = list1 + (p2 - list2);
- if (p2 != last)
- p2 = *EVAL(p2);
- l2 = list1 + (p2 - list2);
- while (f1 < l1 && f2 < l2) {
- if ((*cmp)(f1, f2 TSRMLS_CC) <= 0) {
- q = f2;
- b = f1, t = l1;
- sense = -1;
- } else {
- q = f1;
- b = f2, t = l2;
- sense = 0;
- }
- if (!big) { /* here i = 0 */
- while ((b += size) < t && cmp(q, b TSRMLS_CC) >sense)
- if (++i == 6) {
- big = 1;
- goto EXPONENTIAL;
- }
- } else {
-EXPONENTIAL: for (i = size; ; i <<= 1)
- if ((p = (b + i)) >= t) {
- if ((p = t - size) > b &&
- (*cmp)(q, p TSRMLS_CC) <= sense)
- t = p;
- else
- b = p;
- break;
- } else if ((*cmp)(q, p TSRMLS_CC) <= sense) {
- t = p;
- if (i == size)
- big = 0;
- goto FASTCASE;
- } else
- b = p;
- while (t > b+size) {
- i = (((t - b) / size) >> 1) * size;
- if ((*cmp)(q, p = b + i TSRMLS_CC) <= sense)
- t = p;
- else
- b = p;
- }
- goto COPY;
-FASTCASE: while (i > size)
- if ((*cmp)(q,
- p = b + (i >>= 1) TSRMLS_CC) <= sense)
- t = p;
- else
- b = p;
-COPY: b = t;
- }
- i = size;
- if (q == f1) {
- if (iflag) {
- ICOPY_LIST(f2, tp2, b);
- ICOPY_ELT(f1, tp2, i);
- } else {
- CCOPY_LIST(f2, tp2, b);
- CCOPY_ELT(f1, tp2, i);
- }
- } else {
- if (iflag) {
- ICOPY_LIST(f1, tp2, b);
- ICOPY_ELT(f2, tp2, i);
- } else {
- CCOPY_LIST(f1, tp2, b);
- CCOPY_ELT(f2, tp2, i);
- }
- }
- }
- if (f2 < l2) {
- if (iflag)
- ICOPY_LIST(f2, tp2, l2);
- else
- CCOPY_LIST(f2, tp2, l2);
- } else if (f1 < l1) {
- if (iflag)
- ICOPY_LIST(f1, tp2, l1);
- else
- CCOPY_LIST(f1, tp2, l1);
- }
- *p1 = l2;
- }
- tp2 = list1; /* swap list1, list2 */
- list1 = list2;
- list2 = tp2;
- last = list2 + nmemb*size;
- }
- if (base == list2) {
- memmove(list2, list1, nmemb*size);
- list2 = list1;
- }
- free(list2);
- return (0);
-}
-/* }}} */
-
-#define swap(a, b) { \
- s = b; \
- i = size; \
- do { \
- tmp = *a; *a++ = *s; *s++ = tmp; \
- } while (--i); \
- a -= size; \
- }
-#define reverse(bot, top) { \
- s = top; \
- do { \
- i = size; \
- do { \
- tmp = *bot; *bot++ = *s; *s++ = tmp; \
- } while (--i); \
- s -= size2; \
- } while(bot < s); \
-}
-
-/* {{{ setup
- * Optional hybrid natural/pairwise first pass. Eats up list1 in runs of
- * increasing order, list2 in a corresponding linked list. Checks for runs
- * when THRESHOLD/2 pairs compare with same sense. (Only used when NATURAL
- * is defined. Otherwise simple pairwise merging is used.)
- */
-static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC)
-{
- int i, length, size2, tmp, sense;
- u_char *f1, *f2, *s, *l2, *last, *p2;
-
- size2 = size*2;
- if (n <= 5) {
- insertionsort(list1, n, size, cmp TSRMLS_CC);
- *EVAL(list2) = (u_char*) list2 + n*size;
- return;
- }
- /*
- * Avoid running pointers out of bounds; limit n to evens
- * for simplicity.
- */
- i = 4 + (n & 1);
- insertionsort(list1 + (n - i) * size, i, size, cmp TSRMLS_CC);
- last = list1 + size * (n - i);
- *EVAL(list2 + (last - list1)) = list2 + n * size;
-
-#ifdef NATURAL
- p2 = list2;
- f1 = list1;
- sense = (cmp(f1, f1 + size TSRMLS_CC) > 0);
- for (; f1 < last; sense = !sense) {
- length = 2;
- /* Find pairs with same sense. */
- for (f2 = f1 + size2; f2 < last; f2 += size2) {
- if ((cmp(f2, f2+ size TSRMLS_CC) > 0) != sense)
- break;
- length += 2;
- }
- if (length < THRESHOLD) { /* Pairwise merge */
- do {
- p2 = *EVAL(p2) = f1 + size2 - list1 + list2;
- if (sense > 0)
- swap (f1, f1 + size);
- } while ((f1 += size2) < f2);
- } else { /* Natural merge */
- l2 = f2;
- for (f2 = f1 + size2; f2 < l2; f2 += size2) {
- if ((cmp(f2-size, f2 TSRMLS_CC) > 0) != sense) {
- p2 = *EVAL(p2) = f2 - list1 + list2;
- if (sense > 0)
- reverse(f1, f2-size);
- f1 = f2;
- }
- }
- if (sense > 0)
- reverse (f1, f2-size);
- f1 = f2;
- if (f2 < last || cmp(f2 - size, f2 TSRMLS_CC) > 0)
- p2 = *EVAL(p2) = f2 - list1 + list2;
- else
- p2 = *EVAL(p2) = list2 + n*size;
- }
- }
-#else /* pairwise merge only. */
- for (f1 = list1, p2 = list2; f1 < last; f1 += size2) {
- p2 = *EVAL(p2) = p2 + size2;
- if (cmp (f1, f1 + size TSRMLS_CC) > 0)
- swap(f1, f1 + size);
- }
-#endif /* NATURAL */
-}
-/* }}} */
-
-/* {{{ insertionsort
- * This is to avoid out-of-bounds addresses in sorting the
- * last 4 elements.
- */
-static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC)
-{
- u_char *ai, *s, *t, *u, tmp;
- int i;
-
- for (ai = a+size; --n >= 1; ai += size)
- for (t = ai; t > a; t -= size) {
- u = t - size;
- if (cmp(u, t TSRMLS_CC) <= 0)
- break;
- swap(u, t);
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/main/network.c b/main/network.c
deleted file mode 100644
index f0ad5e0ad7..0000000000
--- a/main/network.c
+++ /dev/null
@@ -1,949 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Venaas <venaas@uninett.no> |
- | Streams work by Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*#define DEBUG_MAIN_NETWORK 1*/
-
-#include "php.h"
-
-#include <stddef.h>
-
-#ifdef PHP_WIN32
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#elif defined(NETWARE)
-#ifdef NEW_LIBC
-#include <sys/timeval.h>
-#include <sys/param.h>
-#else
-#include "netware/time_nw.h"
-#endif
-#else
-#include <sys/param.h>
-#endif
-
-#include <sys/types.h>
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifndef _FCNTL_H
-#include <fcntl.h>
-#endif
-
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#if HAVE_SYS_POLL_H
-#include <sys/poll.h>
-#endif
-
-#if defined(NETWARE)
-#ifdef USE_WINSOCK
-/*#include <ws2nlm.h>*/
-#include <novsock2.h>
-#else
-/* New headers for socket stuff */
-#ifdef NEW_LIBC
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/select.h>
-#endif
-#include <sys/socket.h>
-#endif
-#elif !defined(PHP_WIN32)
-#include <netinet/in.h>
-#include <netdb.h>
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif
-
-#ifndef HAVE_INET_ATON
-int inet_aton(const char *, struct in_addr *);
-#endif
-
-#include "php_network.h"
-
-#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
-#undef AF_UNIX
-#endif
-
-#if defined(AF_UNIX)
-#include <sys/un.h>
-#endif
-
-#include "ext/standard/file.h"
-
-#ifdef PHP_WIN32
-# include "win32/time.h"
-# define SOCK_ERR INVALID_SOCKET
-# define SOCK_CONN_ERR SOCKET_ERROR
-# define PHP_TIMEOUT_ERROR_VALUE WSAETIMEDOUT
-#else
-# define SOCK_ERR -1
-# define SOCK_CONN_ERR -1
-# define PHP_TIMEOUT_ERROR_VALUE ETIMEDOUT
-#endif
-
-#ifdef HAVE_GETADDRINFO
-#ifdef HAVE_GAI_STRERROR
-# define PHP_GAI_STRERROR(x) (gai_strerror(x))
-#else
-# define PHP_GAI_STRERROR(x) (php_gai_strerror(x))
-/* {{{ php_gai_strerror
- */
-static char *php_gai_strerror(int code)
-{
- static struct {
- int code;
- const char *msg;
- } values[] = {
-# ifdef EAI_ADDRFAMILY
- {EAI_ADDRFAMILY, "Address family for hostname not supported"},
-# endif
- {EAI_AGAIN, "Temporary failure in name resolution"},
- {EAI_BADFLAGS, "Bad value for ai_flags"},
- {EAI_FAIL, "Non-recoverable failure in name resolution"},
- {EAI_FAMILY, "ai_family not supported"},
- {EAI_MEMORY, "Memory allocation failure"},
-# ifdef EAI_NODATA
- {EAI_NODATA, "No address associated with hostname"},
-# endif
- {EAI_NONAME, "Name or service not known"},
- {EAI_SERVICE, "Servname not supported for ai_socktype"},
- {EAI_SOCKTYPE, "ai_socktype not supported"},
- {EAI_SYSTEM, "System error"},
- {0, NULL}
- };
- int i;
-
- for (i = 0; values[i].msg != NULL; i++) {
- if (values[i].code == code) {
- return (char *)values[i].msg;
- }
- }
-
- return "Unknown error";
-}
-/* }}} */
-#endif
-#endif
-
-/* {{{ php_network_freeaddresses
- */
-static void php_network_freeaddresses(struct sockaddr **sal)
-{
- struct sockaddr **sap;
-
- if (sal == NULL)
- return;
- for (sap = sal; *sap != NULL; sap++)
- efree(*sap);
- efree(sal);
-}
-/* }}} */
-
-/* {{{ php_network_getaddresses
- * Returns number of addresses, 0 for none/error
- */
-static int php_network_getaddresses(const char *host, struct sockaddr ***sal, char **error_string TSRMLS_DC)
-{
- struct sockaddr **sap;
- int n;
-#ifdef HAVE_GETADDRINFO
- struct addrinfo hints, *res, *sai;
-#else
- struct hostent *host_info;
- struct in_addr in;
-#endif
-
- if (host == NULL) {
- return 0;
- }
-
-#ifdef HAVE_GETADDRINFO
- memset(&hints, '\0', sizeof(hints));
-
-# ifdef HAVE_IPV6
- hints.ai_family = AF_UNSPEC;
-# else
- hints.ai_family = AF_INET;
-# endif
-
- if ((n = getaddrinfo(host, NULL, &hints, &res)) || res == NULL) {
- if (error_string) {
- spprintf(error_string, 0, "getaddrinfo: %s", (res == NULL ? "null result pointer" : PHP_GAI_STRERROR(n)));
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "php_network_getaddresses: getaddrinfo failed: %s", (res == NULL ? "null result pointer" : PHP_GAI_STRERROR(n)));
- }
- return 0;
- }
-
- sai = res;
-
- for (n = 1; (sai = sai->ai_next) != NULL; n++) {
- ;
- }
-
- *sal = safe_emalloc((n + 1), sizeof(*sal), 0);
- sai = res;
- sap = *sal;
- do {
- switch (sai->ai_family) {
-# if HAVE_IPV6
- case AF_INET6:
- *sap = emalloc(sizeof(struct sockaddr_in6));
- *(struct sockaddr_in6 *)*sap =
- *((struct sockaddr_in6 *)sai->ai_addr);
- sap++;
- break;
-# endif
- case AF_INET:
- *sap = emalloc(sizeof(struct sockaddr_in));
- *(struct sockaddr_in *)*sap =
- *((struct sockaddr_in *)sai->ai_addr);
- sap++;
- break;
- }
- } while ((sai = sai->ai_next) != NULL);
- freeaddrinfo(res);
-#else
-
- if (!inet_aton(host, &in)) {
- /* XXX NOT THREAD SAFE
- * (but it *is* thread safe under win32)
- */
- host_info = gethostbyname(host);
- if (host_info == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "php_network_getaddresses: gethostbyname failed");
- return 0;
- }
- in = *((struct in_addr *) host_info->h_addr);
- }
-
- *sal = emalloc(2 * sizeof(*sal));
- sap = *sal;
- *sap = emalloc(sizeof(struct sockaddr_in));
- (*sap)->sa_family = AF_INET;
- ((struct sockaddr_in *)*sap)->sin_addr = in;
- sap++;
- n = 1;
-#endif
-
- *sap = NULL;
- return n;
-}
-/* }}} */
-
-#ifndef O_NONBLOCK
-#define O_NONBLOCK O_NDELAY
-#endif
-
-#if !defined(__BEOS__)
-# define HAVE_NON_BLOCKING_CONNECT 1
-# ifdef PHP_WIN32
-typedef u_long php_non_blocking_flags_t;
-# define SET_SOCKET_BLOCKING_MODE(sock, save) \
- save = TRUE; ioctlsocket(sock, FIONBIO, &save)
-# define RESTORE_SOCKET_BLOCKING_MODE(sock, save) \
- ioctlsocket(sock, FIONBIO, &save)
-# else
-typedef int php_non_blocking_flags_t;
-# define SET_SOCKET_BLOCKING_MODE(sock, save) \
- save = fcntl(sock, F_GETFL, 0); \
- fcntl(sock, F_SETFL, save | O_NONBLOCK)
-# define RESTORE_SOCKET_BLOCKING_MODE(sock, save) \
- fcntl(sock, F_SETFL, save)
-# endif
-#endif
-
-/* Connect to a socket using an interruptible connect with optional timeout.
- * Optionally, the connect can be made asynchronously, which will implicitly
- * enable non-blocking mode on the socket.
- * */
-/* {{{ php_network_connect_socket */
-PHPAPI int php_network_connect_socket(php_socket_t sockfd,
- const struct sockaddr *addr,
- socklen_t addrlen,
- int asynchronous,
- struct timeval *timeout,
- char **error_string,
- int *error_code)
-{
-#if HAVE_NON_BLOCKING_CONNECT
- php_non_blocking_flags_t orig_flags;
- int n;
- int error = 0;
- socklen_t len;
- int ret = 0;
- fd_set rset;
- fd_set wset;
- fd_set eset;
-
- SET_SOCKET_BLOCKING_MODE(sockfd, orig_flags);
-
- if ((n = connect(sockfd, addr, addrlen)) < 0) {
- error = php_socket_errno();
-
- if (error_code) {
- *error_code = error;
- }
-
- if (error != EINPROGRESS) {
- if (error_string) {
- *error_string = php_socket_strerror(error, NULL, 0);
- }
-
- return -1;
- }
- if (asynchronous && error == EINPROGRESS) {
- /* this is fine by us */
- return 0;
- }
- }
-
- if (n == 0) {
- goto ok;
- }
-
- FD_ZERO(&rset);
- FD_ZERO(&eset);
- FD_SET(sockfd, &rset);
- FD_SET(sockfd, &eset);
-
- wset = rset;
-
- if ((n = select(sockfd + 1, &rset, &wset, &eset, timeout)) == 0) {
- error = PHP_TIMEOUT_ERROR_VALUE;
- }
-
- if(FD_ISSET(sockfd, &rset) || FD_ISSET(sockfd, &wset)) {
- len = sizeof(error);
- /*
- BSD-derived systems set errno correctly
- Solaris returns -1 from getsockopt in case of error
- */
- if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (char*)&error, &len) < 0) {
- ret = -1;
- }
- } else {
- /* whoops: sockfd has disappeared */
- ret = -1;
- }
-
-ok:
- if (!asynchronous) {
- /* back to blocking mode */
- RESTORE_SOCKET_BLOCKING_MODE(sockfd, orig_flags);
- }
-
- if (error_code) {
- *error_code = error;
- }
-
- if (error && error_string) {
- *error_string = php_socket_strerror(error, NULL, 0);
- ret = -1;
- }
- return ret;
-#else
- if (asynchronous) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Asynchronous connect() not supported on this platform");
- }
- return connect(sockfd, addr, addrlen);
-#endif
-}
-/* }}} */
-
-/* {{{ sub_times */
-static inline void sub_times(struct timeval a, struct timeval b, struct timeval *result)
-{
- result->tv_usec = a.tv_usec - b.tv_usec;
- if (result->tv_usec < 0L) {
- a.tv_sec--;
- result->tv_usec += 1000000L;
- }
- result->tv_sec = a.tv_sec - b.tv_sec;
- if (result->tv_sec < 0L) {
- result->tv_sec++;
- result->tv_usec -= 1000000L;
- }
-}
-/* }}} */
-
-/* Bind to a local IP address.
- * Returns the bound socket, or -1 on failure.
- * */
-/* {{{ php_network_bind_socket_to_local_addr */
-php_socket_t php_network_bind_socket_to_local_addr(const char *host, unsigned port,
- int socktype, char **error_string, int *error_code
- TSRMLS_DC)
-{
- int num_addrs, n, err = 0;
- php_socket_t sock;
- struct sockaddr **sal, **psal, *sa;
- socklen_t socklen;
-
- num_addrs = php_network_getaddresses(host, &psal, error_string TSRMLS_CC);
-
- if (num_addrs == 0) {
- /* could not resolve address(es) */
- return -1;
- }
-
- for (sal = psal; *sal != NULL; sal++) {
- sa = *sal;
-
- /* create a socket for this address */
- sock = socket(sa->sa_family, socktype, 0);
-
- if (sock == SOCK_ERR) {
- continue;
- }
-
- switch (sa->sa_family) {
-#if HAVE_GETADDRINFO && HAVE_IPV6
- case AF_INET6:
- ((struct sockaddr_in6 *)sa)->sin6_family = sa->sa_family;
- ((struct sockaddr_in6 *)sa)->sin6_port = htons(port);
- socklen = sizeof(struct sockaddr_in6);
- break;
-#endif
- case AF_INET:
- ((struct sockaddr_in *)sa)->sin_family = sa->sa_family;
- ((struct sockaddr_in *)sa)->sin_port = htons(port);
- socklen = sizeof(struct sockaddr_in);
- break;
- default:
- /* Unknown family */
- socklen = 0;
- sa = NULL;
- }
-
- if (sa) {
- /* attempt to bind */
-
-#ifdef SO_REUSEADDR
- {
- int val = 1;
- setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&val, sizeof(val));
- }
-#endif
-
- n = bind(sock, sa, socklen);
-
- if (n != SOCK_CONN_ERR) {
- goto bound;
- }
-
- err = php_socket_errno();
- }
-
- close(sock);
- }
- sock = -1;
-
- if (error_code) {
- *error_code = err;
- }
- if (error_string) {
- *error_string = php_socket_strerror(err, NULL, 0);
- }
-
-bound:
-
- php_network_freeaddresses(psal);
-
- return sock;
-
-}
-/* }}} */
-
-static void populate_name(
- /* input address */
- struct sockaddr *sa, socklen_t sl,
- /* output readable address */
- char **textaddr, long *textaddrlen,
- /* output address */
- struct sockaddr **addr,
- socklen_t *addrlen
- TSRMLS_DC)
-{
- if (addr) {
- *addr = emalloc(sl);
- memcpy(*addr, sa, sl);
- *addrlen = sl;
- }
-
- if (textaddr) {
-#if HAVE_IPV6 && HAVE_INET_NTOP
- char abuf[256];
-#endif
- char *buf = NULL;
-
- switch (sa->sa_family) {
- case AF_INET:
- /* generally not thread safe, but it *is* thread safe under win32 */
- buf = inet_ntoa(((struct sockaddr_in*)sa)->sin_addr);
- if (buf) {
- *textaddrlen = strlen(buf);
- *textaddr = estrndup(buf, *textaddrlen);
- }
-
- break;
-
-#if HAVE_IPV6 && HAVE_INET_NTOP
- case AF_INET6:
- buf = (char*)inet_ntop(sa->sa_family, &((struct sockaddr_in6*)sa)->sin6_addr, (char *)&abuf, sizeof(abuf));
- if (buf) {
- *textaddrlen = strlen(buf);
- *textaddr = estrndup(buf, *textaddrlen);
- }
-
- break;
-#endif
-#ifdef AF_UNIX
- case AF_UNIX:
- {
- struct sockaddr_un *ua = (struct sockaddr_un*)sa;
-
- if (ua->sun_path[0] == '\0') {
- /* abstract name */
- int len = strlen(ua->sun_path + 1) + 1;
- *textaddrlen = len;
- *textaddr = emalloc(len + 1);
- memcpy(*textaddr, ua->sun_path, len);
- (*textaddr)[len] = '\0';
- } else {
- *textaddrlen = strlen(ua->sun_path);
- *textaddr = estrndup(ua->sun_path, *textaddrlen);
- }
- }
- break;
-#endif
-
- }
-
- }
-}
-
-PHPAPI int php_network_get_peer_name(php_socket_t sock,
- char **textaddr, long *textaddrlen,
- struct sockaddr **addr,
- socklen_t *addrlen
- TSRMLS_DC)
-{
- php_sockaddr_storage sa;
- socklen_t sl = sizeof(sa);
-
- if (getpeername(sock, (struct sockaddr*)&sa, &sl) == 0) {
- populate_name((struct sockaddr*)&sa, sl,
- textaddr, textaddrlen,
- addr, addrlen
- TSRMLS_CC);
- return 0;
- }
- return -1;
-}
-
-PHPAPI int php_network_get_sock_name(php_socket_t sock,
- char **textaddr, long *textaddrlen,
- struct sockaddr **addr,
- socklen_t *addrlen
- TSRMLS_DC)
-{
- php_sockaddr_storage sa;
- socklen_t sl = sizeof(sa);
-
- if (getsockname(sock, (struct sockaddr*)&sa, &sl) == 0) {
- populate_name((struct sockaddr*)&sa, sl,
- textaddr, textaddrlen,
- addr, addrlen
- TSRMLS_CC);
- return 0;
- }
- return -1;
-
-}
-
-
-/* Accept a client connection from a server socket,
- * using an optional timeout.
- * Returns the peer address in addr/addrlen (it will emalloc
- * these, so be sure to efree the result).
- * If you specify textaddr/textaddrlen, a text-printable
- * version of the address will be emalloc'd and returned.
- * */
-
-/* {{{ php_network_accept_incoming */
-PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock,
- char **textaddr, long *textaddrlen,
- struct sockaddr **addr,
- socklen_t *addrlen,
- struct timeval *timeout,
- char **error_string,
- int *error_code
- TSRMLS_DC)
-{
- php_socket_t clisock = -1;
- fd_set rset;
- int error, n;
- php_sockaddr_storage sa;
- socklen_t sl;
-
- FD_ZERO(&rset);
- FD_SET(srvsock, &rset);
-
- n = select(srvsock + 1, &rset, NULL, NULL, timeout);
-
- if (n == 0) {
- error = PHP_TIMEOUT_ERROR_VALUE;
- } else if (n == -1) {
- error = php_socket_errno();
- } else if (FD_ISSET(srvsock, &rset)) {
- sl = sizeof(sa);
-
- clisock = accept(srvsock, (struct sockaddr*)&sa, &sl);
-
- if (clisock >= 0) {
- populate_name((struct sockaddr*)&sa, sl,
- textaddr, textaddrlen,
- addr, addrlen
- TSRMLS_CC);
- } else {
- error = php_socket_errno();
- }
- }
-
- if (error_code) {
- *error_code = error;
- }
- if (error_string) {
- *error_string = php_socket_strerror(error, NULL, 0);
- }
-
- return clisock;
-}
-/* }}} */
-
-
-
-/* Connect to a remote host using an interruptible connect with optional timeout.
- * Optionally, the connect can be made asynchronously, which will implicitly
- * enable non-blocking mode on the socket.
- * Returns the connected (or connecting) socket, or -1 on failure.
- * */
-
-/* {{{ php_network_connect_socket_to_host */
-php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short port,
- int socktype, int asynchronous, struct timeval *timeout, char **error_string,
- int *error_code
- TSRMLS_DC)
-{
- int num_addrs, n, fatal = 0;
- php_socket_t sock;
- struct sockaddr **sal, **psal, *sa;
- struct timeval working_timeout;
- socklen_t socklen;
-#if HAVE_GETTIMEOFDAY
- struct timeval limit_time, time_now;
-#endif
-
- num_addrs = php_network_getaddresses(host, &psal, error_string TSRMLS_CC);
-
- if (num_addrs == 0) {
- /* could not resolve address(es) */
- return -1;
- }
-
- if (timeout) {
- memcpy(&working_timeout, timeout, sizeof(working_timeout));
-#if HAVE_GETTIMEOFDAY
- gettimeofday(&limit_time, NULL);
- limit_time.tv_sec += working_timeout.tv_sec;
- limit_time.tv_usec += working_timeout.tv_usec;
- if (limit_time.tv_usec >= 1000000) {
- limit_time.tv_usec -= 1000000;
- limit_time.tv_sec++;
- }
-#endif
- }
-
- for (sal = psal; !fatal && *sal != NULL; sal++) {
- sa = *sal;
-
- /* create a socket for this address */
- sock = socket(sa->sa_family, socktype, 0);
-
- if (sock == SOCK_ERR) {
- continue;
- }
-
- switch (sa->sa_family) {
-#if HAVE_GETADDRINFO && HAVE_IPV6
- case AF_INET6:
- ((struct sockaddr_in6 *)sa)->sin6_family = sa->sa_family;
- ((struct sockaddr_in6 *)sa)->sin6_port = htons(port);
- socklen = sizeof(struct sockaddr_in6);
- break;
-#endif
- case AF_INET:
- ((struct sockaddr_in *)sa)->sin_family = sa->sa_family;
- ((struct sockaddr_in *)sa)->sin_port = htons(port);
- socklen = sizeof(struct sockaddr_in);
- break;
- default:
- /* Unknown family */
- socklen = 0;
- sa = NULL;
- }
-
- if (sa) {
- /* make a connection attempt */
-
- n = php_network_connect_socket(sock, sa, socklen, asynchronous,
- timeout ? &working_timeout : NULL,
- error_string, error_code);
-
- if (n != SOCK_CONN_ERR) {
- goto connected;
- }
-
- /* adjust timeout for next attempt */
-#if HAVE_GETTIMEOFDAY
- if (timeout) {
- gettimeofday(&time_now, NULL);
-
- if (timercmp(&time_now, &limit_time, >=)) {
- /* time limit expired; don't attempt any further connections */
- fatal = 1;
- } else {
- /* work out remaining time */
- sub_times(limit_time, time_now, &working_timeout);
- }
- }
-#else
- if (err == PHP_TIMEOUT_ERROR_VALUE) {
- /* Don't even bother trying to connect to the next alternative;
- * we have no way to determine how long we have already taken
- * and it is quite likely that the next attempt will fail too. */
- fatal = 1;
- } else {
- /* re-use the same initial timeout.
- * Not the best thing, but in practice it should be good-enough */
- if (timeout) {
- memcpy(&working_timeout, timeout, sizeof(working_timeout));
- }
- }
-#endif
- }
-
- close(sock);
- }
- sock = -1;
-
-connected:
-
- php_network_freeaddresses(psal);
-
- return sock;
-}
-/* }}} */
-
-/* {{{ php_any_addr
- * Fills the any (wildcard) address into php_sockaddr_storage
- */
-void php_any_addr(int family, php_sockaddr_storage *addr, unsigned short port)
-{
- memset(addr, 0, sizeof(php_sockaddr_storage));
- switch (family) {
-#ifdef HAVE_IPV6
- case AF_INET6: {
- struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) addr;
- sin6->sin6_family = AF_INET6;
- sin6->sin6_port = htons(port);
- sin6->sin6_addr = in6addr_any;
- break;
- }
-#endif
- case AF_INET: {
- struct sockaddr_in *sin = (struct sockaddr_in *) addr;
- sin->sin_family = AF_INET;
- sin->sin_port = htons(port);
- sin->sin_addr.s_addr = htonl(INADDR_ANY);
- break;
- }
- }
-}
-/* }}} */
-
-/* {{{ php_sockaddr_size
- * Returns the size of struct sockaddr_xx for the family
- */
-int php_sockaddr_size(php_sockaddr_storage *addr)
-{
- switch (((struct sockaddr *)addr)->sa_family) {
- case AF_INET:
- return sizeof(struct sockaddr_in);
-#ifdef HAVE_IPV6
- case AF_INET6:
- return sizeof(struct sockaddr_in6);
-#endif
-#ifdef AF_UNIX
- case AF_UNIX:
- return sizeof(struct sockaddr_un);
-#endif
- default:
- return 0;
- }
-}
-/* }}} */
-
-/* Given a socket error code, if buf == NULL:
- * emallocs storage for the error message and returns
- * else
- * sprintf message into provided buffer and returns buf
- */
-/* {{{ php_socket_strerror */
-PHPAPI char *php_socket_strerror(long err, char *buf, size_t bufsize)
-{
-#ifndef PHP_WIN32
- char *errstr;
-
- errstr = strerror(err);
- if (buf == NULL) {
- buf = estrdup(errstr);
- } else {
- strncpy(buf, errstr, bufsize);
- }
- return buf;
-#else
- char *sysbuf;
- int free_it = 1;
-
- if (!FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- err,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR)&sysbuf,
- 0,
- NULL)) {
- free_it = 0;
- sysbuf = "Unknown Error";
- }
-
- if (buf == NULL) {
- buf = estrdup(sysbuf);
- } else {
- strncpy(buf, sysbuf, bufsize);
- }
-
- if (free_it) {
- LocalFree(sysbuf);
- }
-
- return buf;
-#endif
-}
-/* }}} */
-
-/* deprecated */
-PHPAPI php_stream *_php_stream_sock_open_from_socket(php_socket_t socket, const char *persistent_id STREAMS_DC TSRMLS_DC)
-{
- php_stream *stream;
- php_netstream_data_t *sock;
-
- sock = pemalloc(sizeof(php_netstream_data_t), persistent_id ? 1 : 0);
- memset(sock, 0, sizeof(php_netstream_data_t));
-
- sock->is_blocked = 1;
- sock->timeout.tv_sec = FG(default_socket_timeout);
- sock->timeout.tv_usec = 0;
- sock->socket = socket;
-
- stream = php_stream_alloc_rel(&php_stream_generic_socket_ops, sock, persistent_id, "r+");
- stream->flags |= PHP_STREAM_FLAG_AVOID_BLOCKING;
-
- if (stream == NULL)
- pefree(sock, persistent_id ? 1 : 0);
-
- return stream;
-}
-
-PHPAPI php_stream *_php_stream_sock_open_host(const char *host, unsigned short port,
- int socktype, struct timeval *timeout, const char *persistent_id STREAMS_DC TSRMLS_DC)
-{
- char *res;
- long reslen;
- php_stream *stream;
-
- reslen = spprintf(&res, 0, "tcp://%s:%d", host, port);
-
- stream = php_stream_xport_create(res, reslen, ENFORCE_SAFE_MODE | REPORT_ERRORS,
- STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, persistent_id, timeout, NULL, NULL, NULL);
-
- efree(res);
-
- return stream;
-}
-
-PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC)
-{
- int ret = SUCCESS;
- int flags;
- int myflag = 0;
-
-#ifdef PHP_WIN32
- /* with ioctlsocket, a non-zero sets nonblocking, a zero sets blocking */
- flags = !block;
- if (ioctlsocket(socketd, FIONBIO, &flags)==SOCKET_ERROR){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", WSAGetLastError());
- ret = FALSE;
- }
-#else
- flags = fcntl(socketd, F_GETFL);
-#ifdef O_NONBLOCK
- myflag = O_NONBLOCK; /* POSIX version */
-#elif defined(O_NDELAY)
- myflag = O_NDELAY; /* old non-POSIX version */
-#endif
- if (!block) {
- flags |= myflag;
- } else {
- flags &= ~myflag;
- }
- fcntl(socketd, F_SETFL, flags);
-#endif
- return ret;
-}
-
-
-/*
- * Local variables:
- * tab-width: 8
- * c-basic-offset: 8
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/output.c b/main/output.c
deleted file mode 100644
index e2ffa77354..0000000000
--- a/main/output.c
+++ /dev/null
@@ -1,1059 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- | Thies C. Arntzen <thies@thieso.net> |
- | Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "ext/standard/head.h"
-#include "ext/standard/basic_functions.h"
-#include "ext/standard/url_scanner_ex.h"
-#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
-#include "ext/zlib/php_zlib.h"
-#endif
-#include "SAPI.h"
-
-#define OB_DEFAULT_HANDLER_NAME "default output handler"
-
-/* output functions */
-static int php_ub_body_write(const char *str, uint str_length TSRMLS_DC);
-static int php_ub_body_write_no_header(const char *str, uint str_length TSRMLS_DC);
-static int php_b_body_write(const char *str, uint str_length TSRMLS_DC);
-
-static int php_ob_init(uint initial_size, uint block_size, zval *output_handler, uint chunk_size, zend_bool erase TSRMLS_DC);
-static void php_ob_append(const char *text, uint text_length TSRMLS_DC);
-#if 0
-static void php_ob_prepend(const char *text, uint text_length);
-#endif
-
-#ifdef ZTS
-int output_globals_id;
-#else
-php_output_globals output_globals;
-#endif
-
-/* {{{ php_default_output_func */
-static inline int php_default_output_func(const char *str, uint str_len TSRMLS_DC)
-{
- fwrite(str, 1, str_len, stderr);
- return str_len;
-}
-/* }}} */
-
-/* {{{ php_output_init_globals */
-static void php_output_init_globals(php_output_globals *output_globals_p TSRMLS_DC)
-{
- OG(php_body_write) = php_default_output_func;
- OG(php_header_write) = php_default_output_func;
- OG(implicit_flush) = 0;
- OG(output_start_filename) = NULL;
- OG(output_start_lineno) = 0;
-}
-/* }}} */
-
-
-/* {{{ php_output_startup
- Start output layer */
-PHPAPI void php_output_startup(void)
-{
-#ifdef ZTS
- ts_allocate_id(&output_globals_id, sizeof(php_output_globals), (ts_allocate_ctor) php_output_init_globals, NULL);
-#else
- php_output_init_globals(&output_globals TSRMLS_CC);
-#endif
-}
-/* }}} */
-
-
-/* {{{ php_output_activate
- Initilize output global for activation */
-PHPAPI void php_output_activate(TSRMLS_D)
-{
- OG(php_body_write) = php_ub_body_write;
- OG(php_header_write) = sapi_module.ub_write;
- OG(ob_nesting_level) = 0;
- OG(ob_lock) = 0;
- OG(disable_output) = 0;
- OG(output_start_filename) = NULL;
- OG(output_start_lineno) = 0;
-}
-/* }}} */
-
-
-/* {{{ php_output_set_status
- Toggle output status. Do NOT use in application code, only in SAPIs where appropriate. */
-PHPAPI void php_output_set_status(zend_bool status TSRMLS_DC)
-{
- OG(disable_output) = !status;
-}
-/* }}} */
-
-/* {{{ php_output_register_constants */
-void php_output_register_constants(TSRMLS_D)
-{
- REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_START", PHP_OUTPUT_HANDLER_START, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_CONT", PHP_OUTPUT_HANDLER_CONT, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_END", PHP_OUTPUT_HANDLER_END, CONST_CS | CONST_PERSISTENT);
-}
-/* }}} */
-
-
-/* {{{ php_body_wirte
- * Write body part */
-PHPAPI int php_body_write(const char *str, uint str_length TSRMLS_DC)
-{
- return OG(php_body_write)(str, str_length TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ php_header_wirte
- * Write HTTP header */
-PHPAPI int php_header_write(const char *str, uint str_length TSRMLS_DC)
-{
- if (OG(disable_output)) {
- return 0;
- } else {
- return OG(php_header_write)(str, str_length TSRMLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ php_start_ob_buffer
- * Start output buffering */
-PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size, zend_bool erase TSRMLS_DC)
-{
- uint initial_size, block_size;
-
- if (OG(ob_lock)) {
- if (SG(headers_sent) && !SG(request_info).headers_only) {
- OG(php_body_write) = php_ub_body_write_no_header;
- } else {
- OG(php_body_write) = php_ub_body_write;
- }
- OG(ob_nesting_level) = 0;
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_ERROR, "Cannot use output buffering in output buffering display handlers");
- return FAILURE;
- }
- if (chunk_size > 0) {
- if (chunk_size==1) {
- chunk_size = 4096;
- }
- initial_size = (chunk_size*3/2);
- block_size = chunk_size/2;
- } else {
- initial_size = 40*1024;
- block_size = 10*1024;
- }
- return php_ob_init(initial_size, block_size, output_handler, chunk_size, erase TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ php_start_ob_buffer_named
- * Start output buffering */
-PHPAPI int php_start_ob_buffer_named(const char *output_handler_name, uint chunk_size, zend_bool erase TSRMLS_DC)
-{
- zval *output_handler;
- int result;
-
- ALLOC_INIT_ZVAL(output_handler);
- Z_STRLEN_P(output_handler) = strlen(output_handler_name); /* this can be optimized */
- Z_STRVAL_P(output_handler) = estrndup(output_handler_name, Z_STRLEN_P(output_handler));
- Z_TYPE_P(output_handler) = IS_STRING;
- result = php_start_ob_buffer(output_handler, chunk_size, erase TSRMLS_CC);
- zval_dtor(output_handler);
- FREE_ZVAL(output_handler);
- return result;
-}
-/* }}} */
-
-/* {{{ php_end_ob_buffer
- * End output buffering (one level) */
-PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS_DC)
-{
- char *final_buffer=NULL;
- unsigned int final_buffer_length=0;
- zval *alternate_buffer=NULL;
- char *to_be_destroyed_buffer, *to_be_destroyed_handler_name;
- char *to_be_destroyed_handled_output[2] = { 0, 0 };
- int status;
- php_ob_buffer *prev_ob_buffer_p=NULL;
- php_ob_buffer orig_ob_buffer;
-
- if (OG(ob_nesting_level)==0) {
- return;
- }
- status = 0;
- if (!OG(active_ob_buffer).status & PHP_OUTPUT_HANDLER_START) {
- /* our first call */
- status |= PHP_OUTPUT_HANDLER_START;
- }
- if (just_flush) {
- status |= PHP_OUTPUT_HANDLER_CONT;
- } else {
- status |= PHP_OUTPUT_HANDLER_END;
- }
-
-#if 0
- {
- FILE *fp;
- fp = fopen("/tmp/ob_log", "a");
- fprintf(fp, "NestLevel: %d ObStatus: %d HandlerName: %s\n", OG(ob_nesting_level), status, OG(active_ob_buffer).handler_name);
- fclose(fp);
- }
-#endif
-
- if (OG(active_ob_buffer).internal_output_handler) {
- final_buffer = OG(active_ob_buffer).internal_output_handler_buffer;
- final_buffer_length = OG(active_ob_buffer).internal_output_handler_buffer_size;
- OG(active_ob_buffer).internal_output_handler(OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, &final_buffer, &final_buffer_length, status TSRMLS_CC);
- } else if (OG(active_ob_buffer).output_handler) {
- zval **params[2];
- zval *orig_buffer;
- zval *z_status;
-
- ALLOC_INIT_ZVAL(orig_buffer);
- ZVAL_STRINGL(orig_buffer, OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, 1);
- orig_buffer->refcount=2; /* don't let call_user_function() destroy our buffer */
- orig_buffer->is_ref=1;
-
- ALLOC_INIT_ZVAL(z_status);
- ZVAL_LONG(z_status, status);
-
- params[0] = &orig_buffer;
- params[1] = &z_status;
- OG(ob_lock) = 1;
- if (call_user_function_ex(CG(function_table), NULL, OG(active_ob_buffer).output_handler, &alternate_buffer, 2, params, 1, NULL TSRMLS_CC)==SUCCESS) {
- if (!(Z_TYPE_P(alternate_buffer)==IS_BOOL && Z_BVAL_P(alternate_buffer)==0)) {
- convert_to_string_ex(&alternate_buffer);
- final_buffer = Z_STRVAL_P(alternate_buffer);
- final_buffer_length = Z_STRLEN_P(alternate_buffer);
- }
- }
- OG(ob_lock) = 0;
- zval_ptr_dtor(&OG(active_ob_buffer).output_handler);
- orig_buffer->refcount -=2;
- if (orig_buffer->refcount <= 0) { /* free the zval */
- zval_dtor(orig_buffer);
- FREE_ZVAL(orig_buffer);
- }
- zval_ptr_dtor(&z_status);
- }
-
- if (!final_buffer) {
- final_buffer = OG(active_ob_buffer).buffer;
- final_buffer_length = OG(active_ob_buffer).text_length;
- }
-
- if (OG(ob_nesting_level)==1) { /* end buffering */
- if (SG(headers_sent) && !SG(request_info).headers_only) {
- OG(php_body_write) = php_ub_body_write_no_header;
- } else {
- OG(php_body_write) = php_ub_body_write;
- }
- }
-
- to_be_destroyed_buffer = OG(active_ob_buffer).buffer;
- to_be_destroyed_handler_name = OG(active_ob_buffer).handler_name;
- if (OG(active_ob_buffer).internal_output_handler
- && (final_buffer != OG(active_ob_buffer).internal_output_handler_buffer)
- && (final_buffer != OG(active_ob_buffer).buffer)) {
- to_be_destroyed_handled_output[0] = final_buffer;
- }
-
- if (!just_flush) {
- if (OG(active_ob_buffer).internal_output_handler) {
- to_be_destroyed_handled_output[1] = OG(active_ob_buffer).internal_output_handler_buffer;
- }
- }
- if (OG(ob_nesting_level)>1) { /* restore previous buffer */
- zend_stack_top(&OG(ob_buffers), (void **) &prev_ob_buffer_p);
- orig_ob_buffer = OG(active_ob_buffer);
- OG(active_ob_buffer) = *prev_ob_buffer_p;
- zend_stack_del_top(&OG(ob_buffers));
- if (!just_flush && OG(ob_nesting_level)==2) { /* destroy the stack */
- zend_stack_destroy(&OG(ob_buffers));
- }
- }
- OG(ob_nesting_level)--;
-
- if (send_buffer) {
- OG(php_body_write)(final_buffer, final_buffer_length TSRMLS_CC);
- }
-
- if (just_flush) { /* we restored the previous ob, return to the current */
- if (prev_ob_buffer_p) {
- zend_stack_push(&OG(ob_buffers), &OG(active_ob_buffer), sizeof(php_ob_buffer));
- OG(active_ob_buffer) = orig_ob_buffer;
- }
- OG(ob_nesting_level)++;
- }
-
- if (alternate_buffer) {
- zval_ptr_dtor(&alternate_buffer);
- }
-
- if (status & PHP_OUTPUT_HANDLER_END) {
- efree(to_be_destroyed_handler_name);
- }
- if (!just_flush) {
- efree(to_be_destroyed_buffer);
- } else {
- OG(active_ob_buffer).text_length = 0;
- OG(active_ob_buffer).status |= PHP_OUTPUT_HANDLER_START;
- OG(php_body_write) = php_b_body_write;
- }
- if (to_be_destroyed_handled_output[0]) {
- efree(to_be_destroyed_handled_output[0]);
- }
- if (to_be_destroyed_handled_output[1]) {
- efree(to_be_destroyed_handled_output[1]);
- }
-}
-/* }}} */
-
-/* {{{ php_end_ob_buffers
- * End output buffering (all buffers) */
-PHPAPI void php_end_ob_buffers(zend_bool send_buffer TSRMLS_DC)
-{
- while (OG(ob_nesting_level)!=0) {
- php_end_ob_buffer(send_buffer, 0 TSRMLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ php_start_implicit_flush
- */
-PHPAPI void php_start_implicit_flush(TSRMLS_D)
-{
- OG(implicit_flush)=1;
-}
-/* }}} */
-
-/* {{{ php_end_implicit_flush
- */
-PHPAPI void php_end_implicit_flush(TSRMLS_D)
-{
- OG(implicit_flush)=0;
-}
-/* }}} */
-
-/* {{{ php_ob_set_internal_handler
- */
-PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size, char *handler_name, zend_bool erase TSRMLS_DC)
-{
- if (OG(ob_nesting_level)==0 || OG(active_ob_buffer).internal_output_handler || strcmp(OG(active_ob_buffer).handler_name, OB_DEFAULT_HANDLER_NAME)) {
- php_start_ob_buffer(NULL, buffer_size, erase TSRMLS_CC);
- }
-
- OG(active_ob_buffer).internal_output_handler = internal_output_handler;
- OG(active_ob_buffer).internal_output_handler_buffer = (char *) emalloc(buffer_size);
- OG(active_ob_buffer).internal_output_handler_buffer_size = buffer_size;
- if (OG(active_ob_buffer).handler_name) {
- efree(OG(active_ob_buffer).handler_name);
- }
- OG(active_ob_buffer).handler_name = estrdup(handler_name);
- OG(active_ob_buffer).erase = erase;
-}
-/* }}} */
-
-/*
- * Output buffering - implementation
- */
-
-/* {{{ php_ob_allocate
- */
-static inline void php_ob_allocate(TSRMLS_D)
-{
- if (OG(active_ob_buffer).size<OG(active_ob_buffer).text_length) {
- while (OG(active_ob_buffer).size <= OG(active_ob_buffer).text_length) {
- OG(active_ob_buffer).size+=OG(active_ob_buffer).block_size;
- }
-
- OG(active_ob_buffer).buffer = (char *) erealloc(OG(active_ob_buffer).buffer, OG(active_ob_buffer).size+1);
- }
-}
-/* }}} */
-
-/* {{{ php_ob_init_conflict
- * Returns 1 if handler_set is already used and generates error message
- */
-PHPAPI int php_ob_init_conflict(char *handler_new, char *handler_set TSRMLS_DC)
-{
- if (php_ob_handler_used(handler_set TSRMLS_CC)) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler '%s' conflicts with '%s'", handler_new, handler_set);
- return 1;
- }
- return 0;
-}
-/* }}} */
-
-/* {{{ php_ob_init_named
- */
-static int php_ob_init_named(uint initial_size, uint block_size, char *handler_name, zval *output_handler, uint chunk_size, zend_bool erase TSRMLS_DC)
-{
- if (OG(ob_nesting_level)>0) {
-#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
- if (!strncmp(handler_name, "ob_gzhandler", sizeof("ob_gzhandler")) && php_ob_gzhandler_check(TSRMLS_C)) {
- return FAILURE;
- }
-#endif
- if (OG(ob_nesting_level)==1) { /* initialize stack */
- zend_stack_init(&OG(ob_buffers));
- }
- zend_stack_push(&OG(ob_buffers), &OG(active_ob_buffer), sizeof(php_ob_buffer));
- }
- OG(ob_nesting_level)++;
- OG(active_ob_buffer).block_size = block_size;
- OG(active_ob_buffer).size = initial_size;
- OG(active_ob_buffer).buffer = (char *) emalloc(initial_size+1);
- OG(active_ob_buffer).text_length = 0;
- OG(active_ob_buffer).output_handler = output_handler;
- OG(active_ob_buffer).chunk_size = chunk_size;
- OG(active_ob_buffer).status = 0;
- OG(active_ob_buffer).internal_output_handler = NULL;
- OG(active_ob_buffer).handler_name = estrdup(handler_name&&handler_name[0]?handler_name:OB_DEFAULT_HANDLER_NAME);
- OG(active_ob_buffer).erase = erase;
- OG(php_body_write) = php_b_body_write;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_ob_handler_from_string
- * Create zval output handler from string
- */
-static zval* php_ob_handler_from_string(const char *handler_name TSRMLS_DC)
-{
- zval *output_handler;
-
- ALLOC_INIT_ZVAL(output_handler);
- Z_STRLEN_P(output_handler) = strlen(handler_name); /* this can be optimized */
- Z_STRVAL_P(output_handler) = estrndup(handler_name, Z_STRLEN_P(output_handler));
- Z_TYPE_P(output_handler) = IS_STRING;
- return output_handler;
-}
-/* }}} */
-
-/* {{{ php_ob_init
- */
-static int php_ob_init(uint initial_size, uint block_size, zval *output_handler, uint chunk_size, zend_bool erase TSRMLS_DC)
-{
- int result = FAILURE, len;
- char *handler_name, *next_handler_name;
- HashPosition pos;
- zval **tmp;
- zval *handler_zval;
-
- if (output_handler && output_handler->type == IS_STRING) {
- handler_name = Z_STRVAL_P(output_handler);
- while ((next_handler_name=strchr(handler_name, ',')) != NULL) {
- len = next_handler_name-handler_name;
- next_handler_name = estrndup(handler_name, len);
- handler_zval = php_ob_handler_from_string(next_handler_name TSRMLS_CC);
- result = php_ob_init_named(initial_size, block_size, next_handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
- if (result != SUCCESS) {
- zval_dtor(handler_zval);
- FREE_ZVAL(handler_zval);
- }
- handler_name += len+1;
- efree(next_handler_name);
- }
- handler_zval = php_ob_handler_from_string(handler_name TSRMLS_CC);
- result = php_ob_init_named(initial_size, block_size, handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
- if (result != SUCCESS) {
- zval_dtor(handler_zval);
- FREE_ZVAL(handler_zval);
- }
- } else if (output_handler && output_handler->type == IS_ARRAY) {
- /* do we have array(object,method) */
- if (zend_is_callable(output_handler, 1, &handler_name)) {
- SEPARATE_ZVAL(&output_handler);
- output_handler->refcount++;
- result = php_ob_init_named(initial_size, block_size, handler_name, output_handler, chunk_size, erase TSRMLS_CC);
- efree(handler_name);
- } else {
- efree(handler_name);
- /* init all array elements recursively */
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(output_handler), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_P(output_handler), (void **)&tmp, &pos) == SUCCESS) {
- result = php_ob_init(initial_size, block_size, *tmp, chunk_size, erase TSRMLS_CC);
- zend_hash_move_forward_ex(Z_ARRVAL_P(output_handler), &pos);
- }
- }
- } else if (output_handler && output_handler->type == IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "No method name given: use ob_start(array($object,'method')) to specify instance $object and the name of a method of class %s to use as output handler", Z_OBJCE_P(output_handler)->name);
- result = FAILURE;
- } else {
- result = php_ob_init_named(initial_size, block_size, OB_DEFAULT_HANDLER_NAME, NULL, chunk_size, erase TSRMLS_CC);
- }
- return result;
-}
-/* }}} */
-
-/* {{{ php_ob_list_each
- */
-static int php_ob_list_each(php_ob_buffer *ob_buffer, zval *ob_handler_array)
-{
- add_next_index_string(ob_handler_array, ob_buffer->handler_name, 1);
- return 0;
-}
-/* }}} */
-
-/* {{{ proto false|array ob_list_handlers()
- * List all output_buffers in an array
- */
-PHP_FUNCTION(ob_list_handlers)
-{
- if (ZEND_NUM_ARGS()!=0) {
- ZEND_WRONG_PARAM_COUNT();
- RETURN_FALSE;
- }
-
- array_init(return_value);
- if (OG(ob_nesting_level)) {
- if (OG(ob_nesting_level)>1) {
- zend_stack_apply_with_argument(&OG(ob_buffers), ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_ob_list_each, return_value);
- }
- php_ob_list_each(&OG(active_ob_buffer), return_value);
- }
-}
-/* }}} */
-
-/* {{{ php_ob_used_each
- * Sets handler_name to NULL is found
- */
-static int php_ob_handler_used_each(php_ob_buffer *ob_buffer, char **handler_name)
-{
- if (!strcmp(ob_buffer->handler_name, *handler_name)) {
- *handler_name = NULL;
- return 1;
- }
- return 0;
-}
-/* }}} */
-
-/* {{{ php_ob_used
- * returns 1 if given handler_name is used as output_handler
- */
-PHPAPI int php_ob_handler_used(char *handler_name TSRMLS_DC)
-{
- char *tmp = handler_name;
-
- if (OG(ob_nesting_level)) {
- if (!strcmp(OG(active_ob_buffer).handler_name, handler_name)) {
- return 1;
- }
- if (OG(ob_nesting_level)>1) {
- zend_stack_apply_with_argument(&OG(ob_buffers), ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_ob_handler_used_each, &tmp);
- }
- }
- return tmp ? 0 : 1;
-}
-/* }}} */
-
-/* {{{ php_ob_append
- */
-static inline void php_ob_append(const char *text, uint text_length TSRMLS_DC)
-{
- char *target;
- int original_ob_text_length;
-
- original_ob_text_length=OG(active_ob_buffer).text_length;
- OG(active_ob_buffer).text_length = OG(active_ob_buffer).text_length + text_length;
-
- php_ob_allocate(TSRMLS_C);
- target = OG(active_ob_buffer).buffer+original_ob_text_length;
- memcpy(target, text, text_length);
- target[text_length]=0;
-
- /* If implicit_flush is On or chunked buffering, send contents to next buffer and return. */
- if (OG(active_ob_buffer).chunk_size
- && OG(active_ob_buffer).text_length >= OG(active_ob_buffer).chunk_size) {
- zval *output_handler = OG(active_ob_buffer).output_handler;
-
- if (output_handler) {
- output_handler->refcount++;
- }
- php_end_ob_buffer(1, 1 TSRMLS_CC);
- return;
- }
-}
-/* }}} */
-
-#if 0
-static inline void php_ob_prepend(const char *text, uint text_length)
-{
- char *p, *start;
- TSRMLS_FETCH();
-
- OG(active_ob_buffer).text_length += text_length;
- php_ob_allocate(TSRMLS_C);
-
- /* php_ob_allocate() may change OG(ob_buffer), so we can't initialize p&start earlier */
- p = OG(ob_buffer)+OG(ob_text_length);
- start = OG(ob_buffer);
-
- while (--p>=start) {
- p[text_length] = *p;
- }
- memcpy(OG(ob_buffer), text, text_length);
- OG(ob_buffer)[OG(active_ob_buffer).text_length]=0;
-}
-#endif
-
-
-/* {{{ php_ob_get_buffer
- * Return the current output buffer */
-PHPAPI int php_ob_get_buffer(zval *p TSRMLS_DC)
-{
- if (OG(ob_nesting_level)==0) {
- return FAILURE;
- }
- ZVAL_STRINGL(p, OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, 1);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_ob_get_length
- * Return the size of the current output buffer */
-PHPAPI int php_ob_get_length(zval *p TSRMLS_DC)
-{
- if (OG(ob_nesting_level) == 0) {
- return FAILURE;
- }
- ZVAL_LONG(p, OG(active_ob_buffer).text_length);
- return SUCCESS;
-}
-/* }}} */
-
-/*
- * Wrapper functions - implementation
- */
-
-
-/* buffered output function */
-static int php_b_body_write(const char *str, uint str_length TSRMLS_DC)
-{
- php_ob_append(str, str_length TSRMLS_CC);
- return str_length;
-}
-
-/* {{{ php_ub_body_write_no_header
- */
-static int php_ub_body_write_no_header(const char *str, uint str_length TSRMLS_DC)
-{
- int result;
-
- if (OG(disable_output)) {
- return 0;
- }
-
- result = OG(php_header_write)(str, str_length TSRMLS_CC);
-
- if (OG(implicit_flush)) {
- sapi_flush(TSRMLS_C);
- }
-
- return result;
-}
-/* }}} */
-
-/* {{{ php_ub_body_write
- */
-static int php_ub_body_write(const char *str, uint str_length TSRMLS_DC)
-{
- int result = 0;
-
- if (SG(request_info).headers_only) {
- php_header(TSRMLS_C);
- zend_bailout();
- }
- if (php_header(TSRMLS_C)) {
- if (zend_is_compiling(TSRMLS_C)) {
- OG(output_start_filename) = zend_get_compiled_filename(TSRMLS_C);
- OG(output_start_lineno) = zend_get_compiled_lineno(TSRMLS_C);
- } else if (zend_is_executing(TSRMLS_C)) {
- OG(output_start_filename) = zend_get_executed_filename(TSRMLS_C);
- OG(output_start_lineno) = zend_get_executed_lineno(TSRMLS_C);
- }
-
- OG(php_body_write) = php_ub_body_write_no_header;
- result = php_ub_body_write_no_header(str, str_length TSRMLS_CC);
- }
-
- return result;
-}
-/* }}} */
-
-/*
- * HEAD support
- */
-
-/* {{{ proto bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]])
- Turn on Output Buffering (specifying an optional output handler). */
-PHP_FUNCTION(ob_start)
-{
- zval *output_handler=NULL;
- long chunk_size=0;
- zend_bool erase=1;
- int argc = ZEND_NUM_ARGS();
-
- if (zend_parse_parameters(argc TSRMLS_CC, "|zlb", &output_handler, &chunk_size, &erase) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (chunk_size < 0)
- chunk_size = 0;
-
- if (php_start_ob_buffer(output_handler, chunk_size, erase TSRMLS_CC)==FAILURE) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ob_flush(void)
- Flush (send) contents of the output buffer. The last buffer content is sent to next buffer */
-PHP_FUNCTION(ob_flush)
-{
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (!OG(ob_nesting_level)) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to flush buffer. No buffer to flush.");
- RETURN_FALSE;
- }
-
- php_end_ob_buffer(1, 1 TSRMLS_CC);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto bool ob_clean(void)
- Clean (delete) the current output buffer */
-PHP_FUNCTION(ob_clean)
-{
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (!OG(ob_nesting_level)) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer. No buffer to delete.");
- RETURN_FALSE;
- }
-
- if (!OG(active_ob_buffer).status && !OG(active_ob_buffer).erase) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer %s.", OG(active_ob_buffer).handler_name);
- RETURN_FALSE;
- }
-
- php_end_ob_buffer(0, 1 TSRMLS_CC);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ob_end_flush(void)
- Flush (send) the output buffer, and delete current output buffer */
-PHP_FUNCTION(ob_end_flush)
-{
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (!OG(ob_nesting_level)) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete and flush buffer. No buffer to delete or flush.");
- RETURN_FALSE;
- }
- if (OG(ob_nesting_level) && !OG(active_ob_buffer).status && !OG(active_ob_buffer).erase) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer %s.", OG(active_ob_buffer).handler_name);
- RETURN_FALSE;
- }
-
- php_end_ob_buffer(1, 0 TSRMLS_CC);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ob_end_clean(void)
- Clean the output buffer, and delete current output buffer */
-PHP_FUNCTION(ob_end_clean)
-{
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (!OG(ob_nesting_level)) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer. No buffer to delete.");
- RETURN_FALSE;
- }
- if (OG(ob_nesting_level) && !OG(active_ob_buffer).status && !OG(active_ob_buffer).erase) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer %s.", OG(active_ob_buffer).handler_name);
- RETURN_FALSE;
- }
-
- php_end_ob_buffer(0, 0 TSRMLS_CC);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ob_get_flush(void)
- Get current buffer contents, flush (send) the output buffer, and delete current output buffer */
-PHP_FUNCTION(ob_get_flush)
-{
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- /* get contents */
- if (php_ob_get_buffer(return_value TSRMLS_CC)==FAILURE) {
- RETURN_FALSE;
- }
- /* error checks */
- if (!OG(ob_nesting_level)) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete and flush buffer. No buffer to delete or flush.");
- RETURN_FALSE;
- }
- if (OG(ob_nesting_level) && !OG(active_ob_buffer).status && !OG(active_ob_buffer).erase) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer %s.", OG(active_ob_buffer).handler_name);
- RETURN_FALSE;
- }
- /* flush */
- php_end_ob_buffer(1, 0 TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto bool ob_get_clean(void)
- Get current buffer contents and delete current output buffer */
-PHP_FUNCTION(ob_get_clean)
-{
- if (ZEND_NUM_ARGS() != 0)
- ZEND_WRONG_PARAM_COUNT();
-
- /* get contents */
- if (php_ob_get_buffer(return_value TSRMLS_CC)==FAILURE) {
- RETURN_FALSE;
- }
- /* error checks */
- if (!OG(ob_nesting_level)) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer. No buffer to delete.");
- RETURN_FALSE;
- }
- if (OG(ob_nesting_level) && !OG(active_ob_buffer).status && !OG(active_ob_buffer).erase) {
- php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer %s.", OG(active_ob_buffer).handler_name);
- RETURN_FALSE;
- }
- /* delete buffer */
- php_end_ob_buffer(0, 0 TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto string ob_get_contents(void)
- Return the contents of the output buffer */
-PHP_FUNCTION(ob_get_contents)
-{
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (php_ob_get_buffer(return_value TSRMLS_CC)==FAILURE) {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int ob_get_level(void)
- Return the nesting level of the output buffer */
-PHP_FUNCTION(ob_get_level)
-{
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- RETURN_LONG (OG(ob_nesting_level));
-}
-/* }}} */
-
-/* {{{ proto int ob_get_length(void)
- Return the length of the output buffer */
-PHP_FUNCTION(ob_get_length)
-{
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (php_ob_get_length(return_value TSRMLS_CC)==FAILURE) {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ int php_ob_buffer_status(php_ob_buffer *ob_buffer, zval *result) */
-static int php_ob_buffer_status(php_ob_buffer *ob_buffer, zval *result)
-{
- zval *elem;
-
- MAKE_STD_ZVAL(elem);
- array_init(elem);
-
- add_assoc_long(elem, "chunk_size", ob_buffer->chunk_size);
- if (!ob_buffer->chunk_size) {
- add_assoc_long(elem, "size", ob_buffer->size);
- add_assoc_long(elem, "block_size", ob_buffer->block_size);
- }
- if (ob_buffer->internal_output_handler) {
- add_assoc_long(elem, "type", PHP_OUTPUT_HANDLER_INTERNAL);
- add_assoc_long(elem, "buffer_size", ob_buffer->internal_output_handler_buffer_size);
- }
- else {
- add_assoc_long(elem, "type", PHP_OUTPUT_HANDLER_USER);
- }
- add_assoc_long(elem, "status", ob_buffer->status);
- add_assoc_string(elem, "name", ob_buffer->handler_name, 1);
- add_assoc_bool(elem, "del", ob_buffer->erase);
- add_next_index_zval(result, elem);
-
- return SUCCESS;
-}
-/* }}} */
-
-
-/* {{{ proto false|array ob_get_status([bool full_status])
- Return the status of the active or all output buffers */
-PHP_FUNCTION(ob_get_status)
-{
- int argc = ZEND_NUM_ARGS();
- zend_bool full_status = 0;
-
- if (zend_parse_parameters(argc TSRMLS_CC, "|b", &full_status) == FAILURE )
- RETURN_FALSE;
-
- array_init(return_value);
-
- if (full_status) {
- if (OG(ob_nesting_level)>1) {
- zend_stack_apply_with_argument(&OG(ob_buffers), ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *elem, void *))php_ob_buffer_status, return_value);
- }
- if (OG(ob_nesting_level)>0 && php_ob_buffer_status(&OG(active_ob_buffer), return_value)==FAILURE) {
- RETURN_FALSE;
- }
- } else if (OG(ob_nesting_level)>0) {
- add_assoc_long(return_value, "level", OG(ob_nesting_level));
- if (OG(active_ob_buffer).internal_output_handler) {
- add_assoc_long(return_value, "type", PHP_OUTPUT_HANDLER_INTERNAL);
- } else {
- add_assoc_long(return_value, "type", PHP_OUTPUT_HANDLER_USER);
- }
- add_assoc_long(return_value, "status", OG(active_ob_buffer).status);
- add_assoc_string(return_value, "name", OG(active_ob_buffer).handler_name, 1);
- add_assoc_bool(return_value, "del", OG(active_ob_buffer).erase);
- }
-}
-/* }}} */
-
-
-/* {{{ proto void ob_implicit_flush([int flag])
- Turn implicit flush on/off and is equivalent to calling flush() after every output call */
-PHP_FUNCTION(ob_implicit_flush)
-{
- zval **zv_flag;
- int flag;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- flag = 1;
- break;
- case 1:
- if (zend_get_parameters_ex(1, &zv_flag)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(zv_flag);
- flag = Z_LVAL_PP(zv_flag);
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- break;
- }
- if (flag) {
- php_start_implicit_flush(TSRMLS_C);
- } else {
- php_end_implicit_flush(TSRMLS_C);
- }
-}
-/* }}} */
-
-
-/* {{{ char *php_get_output_start_filename(TSRMLS_D)
- Return filename start output something */
-PHPAPI char *php_get_output_start_filename(TSRMLS_D)
-{
- return OG(output_start_filename);
-}
-/* }}} */
-
-
-/* {{{ char *php_get_output_start_lineno(TSRMLS_D)
- Return line number start output something */
-PHPAPI int php_get_output_start_lineno(TSRMLS_D)
-{
- return OG(output_start_lineno);
-}
-/* }}} */
-
-
-/* {{{ proto bool output_reset_rewrite_vars(void)
- Reset(clear) URL rewriter values */
-PHP_FUNCTION(output_reset_rewrite_vars)
-{
- if (php_url_scanner_reset_vars(TSRMLS_C) == SUCCESS) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool output_add_rewrite_var(string name, string value)
- Add URL rewriter values */
-PHP_FUNCTION(output_add_rewrite_var)
-{
- char *name, *value;
- int name_len, value_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &value, &value_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (php_url_scanner_add_var(name, name_len, value, value_len, 1 TSRMLS_CC) == SUCCESS) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/php.h b/main/php.h
deleted file mode 100644
index d68ef47e4f..0000000000
--- a/main/php.h
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_H
-#define PHP_H
-
-#ifdef HAVE_DMALLOC
-#include <dmalloc.h>
-#endif
-
-#define PHP_API_VERSION 20020918
-#define PHP_HAVE_STREAMS
-#define YYDEBUG 0
-
-#include "php_version.h"
-#include "zend.h"
-#include "zend_qsort.h"
-#include "php_compat.h"
-
-#include "zend_API.h"
-
-#if PHP_BROKEN_SPRINTF
-#undef sprintf
-#define sprintf php_sprintf
-#endif
-
-/* PHP's DEBUG value must match Zend's ZEND_DEBUG value */
-#undef PHP_DEBUG
-#define PHP_DEBUG ZEND_DEBUG
-
-#ifdef PHP_WIN32
-#include "tsrm_win32.h"
-#include "win95nt.h"
-# ifdef PHP_EXPORTS
-# define PHPAPI __declspec(dllexport)
-# else
-# define PHPAPI __declspec(dllimport)
-# endif
-#define PHP_DIR_SEPARATOR '\\'
-#else
-#define PHPAPI
-#define THREAD_LS
-#define PHP_DIR_SEPARATOR '/'
-#endif
-
-#ifdef NETWARE
-/* For php_get_uname() function */
-#define PHP_UNAME "NetWare"
-/*
- * This is obtained using uname(2) on Unix and assigned in the case of Windows;
- * we'll do it this way at least for now.
- */
-#define PHP_OS PHP_UNAME
-#endif
-
-#include "php_regex.h"
-
-#if HAVE_ASSERT_H
-#if PHP_DEBUG
-#undef NDEBUG
-#else
-#ifndef NDEBUG
-#define NDEBUG
-#endif
-#endif
-#include <assert.h>
-#else /* HAVE_ASSERT_H */
-#define assert(expr) ((void) (0))
-#endif /* HAVE_ASSERT_H */
-
-#define APACHE 0
-
-#if HAVE_UNIX_H
-#include <unix.h>
-#endif
-
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#if HAVE_BUILD_DEFS_H
-#include "build-defs.h"
-#endif
-
-/*
- * This is a fast version of strlcpy which should be used, if you
- * know the size of the destination buffer and if you know
- * the length of the source string.
- *
- * size is the allocated number of bytes of dst
- * src_size is the number of bytes excluding the NUL of src
- */
-
-#define PHP_STRLCPY(dst, src, size, src_size) \
- { \
- size_t php_str_len; \
- \
- if (src_size >= size) \
- php_str_len = size - 1; \
- else \
- php_str_len = src_size; \
- memcpy(dst, src, php_str_len); \
- dst[php_str_len] = '\0'; \
- }
-
-#ifndef HAVE_STRLCPY
-PHPAPI size_t php_strlcpy(char *dst, const char *src, size_t siz);
-#define strlcpy php_strlcpy
-#endif
-
-#ifndef HAVE_STRLCAT
-PHPAPI size_t php_strlcat(char *dst, const char *src, size_t siz);
-#define strlcat php_strlcat
-#endif
-
-#ifndef HAVE_STRTOK_R
-char *strtok_r(char *s, const char *delim, char **last);
-#endif
-
-#ifndef HAVE_SOCKLEN_T
-typedef unsigned int socklen_t;
-#endif
-
-#define CREATE_MUTEX(a, b)
-#define SET_MUTEX(a)
-#define FREE_MUTEX(a)
-
-/*
- * Then the ODBC support can use both iodbc and Solid,
- * uncomment this.
- * #define HAVE_ODBC (HAVE_IODBC|HAVE_SOLID)
- */
-
-#include <stdlib.h>
-#include <ctype.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_STDARG_H
-#include <stdarg.h>
-#else
-# if HAVE_SYS_VARARGS_H
-# include <sys/varargs.h>
-# endif
-#endif
-
-
-#include "zend_hash.h"
-#include "php3_compat.h"
-#include "zend_alloc.h"
-#include "zend_stack.h"
-
-#if STDC_HEADERS
-# include <string.h>
-#else
-# ifndef HAVE_MEMCPY
-# define memcpy(d, s, n) bcopy((s), (d), (n))
-# endif
-# ifndef HAVE_MEMMOVE
-# define memmove(d, s, n) bcopy ((s), (d), (n))
-# endif
-#endif
-
-#include "safe_mode.h"
-
-#ifndef HAVE_STRERROR
-char *strerror(int);
-#endif
-
-#if (REGEX == 1 || REGEX == 0) && !defined(NO_REGEX_EXTRA_H)
-#include "regex/regex_extra.h"
-#endif
-
-#if HAVE_PWD_H
-# ifdef PHP_WIN32
-#include "win32/pwd.h"
-#include "win32/param.h"
-#elif defined(NETWARE)
-#ifdef NEW_LIBC
-#include <sys/param.h>
-#else
-#include "NetWare/param.h"
-#endif
-#include "NetWare/pwd.h"
-# else
-#include <pwd.h>
-#include <sys/param.h>
-# endif
-#endif
-
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#ifndef LONG_MAX
-#define LONG_MAX 2147483647L
-#endif
-
-#ifndef LONG_MIN
-#define LONG_MIN (- LONG_MAX - 1)
-#endif
-
-#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) || PHP_BROKEN_SPRINTF || PHP_BROKEN_SNPRINTF || PHP_BROKEN_VSNPRINTF
-#include "snprintf.h"
-#endif
-#include "spprintf.h"
-
-#define EXEC_INPUT_BUF 4096
-
-#define PHP_MIME_TYPE "application/x-httpd-php"
-
-/* macros */
-#define STR_PRINT(str) ((str)?(str):"")
-
-#ifndef MAXPATHLEN
-# ifdef PATH_MAX
-# define MAXPATHLEN PATH_MAX
-# else
-# define MAXPATHLEN 256 /* Should be safe for any weird systems that do not define it */
-# endif
-#endif
-
-
-/* global variables */
-extern pval *data;
-#if !defined(PHP_WIN32)
-#ifdef NETWARE
-#ifdef NEW_LIBC
-#define php_sleep sleep
-#else /* NEW_LIBC */
-#define php_sleep delay /* sleep() and usleep() are not available */
-#define usleep delay
-#endif /* NEW_LIBC */
-extern char **environ;
-#else /* NETWARE */
-extern char **environ;
-#define php_sleep sleep
-#endif /* NETWARE */
-#endif /* !defined(PHP_WIN32) */
-
-#ifdef PHP_PWRITE_64
-ssize_t pwrite(int, void *, size_t, off64_t);
-#endif
-
-#ifdef PHP_PREAD_64
-ssize_t pread(int, void *, size_t, off64_t);
-#endif
-
-void phperror(char *error);
-PHPAPI int php_write(void *buf, uint size TSRMLS_DC);
-PHPAPI int php_printf(const char *format, ...);
-PHPAPI void php_log_err(char *log_message TSRMLS_DC);
-int Debug(char *format, ...);
-int cfgparse(void);
-
-#define php_error zend_error
-
-typedef enum {
- EH_NORMAL = 0,
- EH_SUPPRESS,
- EH_THROW
-} error_handling_t;
-
-PHPAPI void php_set_error_handling(error_handling_t error_handling, zend_class_entry *exception_class TSRMLS_DC);
-
-PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args TSRMLS_DC) ;
-
-/* PHPAPI void php_error(int type, const char *format, ...); */
-PHPAPI void php_error_docref0(const char *docref TSRMLS_DC, int type, const char *format, ...);
-PHPAPI void php_error_docref1(const char *docref TSRMLS_DC, const char *param1, int type, const char *format, ...);
-PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, const char *param2, int type, const char *format, ...);
-
-#define php_error_docref php_error_docref0
-
-#define zenderror phperror
-#define zendlex phplex
-
-#define phpparse zendparse
-#define phprestart zendrestart
-#define phpin zendin
-
-#define php_memnstr zend_memnstr
-
-/* functions */
-int php_startup_internal_extensions(void);
-
-int php_mergesort(void *base, size_t nmemb, register size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC);
-
-PHPAPI void php_register_pre_request_shutdown(void (*func)(void *), void *userdata);
-
-PHPAPI int cfg_get_long(char *varname, long *result);
-PHPAPI int cfg_get_double(char *varname, double *result);
-PHPAPI int cfg_get_string(char *varname, char **result);
-
-
-/* PHP-named Zend macro wrappers */
-#define PHP_FN ZEND_FN
-#define PHP_NAMED_FUNCTION ZEND_NAMED_FUNCTION
-#define PHP_FUNCTION ZEND_FUNCTION
-#define PHP_METHOD ZEND_METHOD
-
-#define PHP_NAMED_FE ZEND_NAMED_FE
-#define PHP_FE ZEND_FE
-#define PHP_FALIAS ZEND_FALIAS
-#define PHP_STATIC_FE ZEND_STATIC_FE
-#define PHP_ME ZEND_ME
-
-#define PHP_MODULE_STARTUP_N ZEND_MODULE_STARTUP_N
-#define PHP_MODULE_SHUTDOWN_N ZEND_MODULE_SHUTDOWN_N
-#define PHP_MODULE_ACTIVATE_N ZEND_MODULE_ACTIVATE_N
-#define PHP_MODULE_DEACTIVATE_N ZEND_MODULE_DEACTIVATE_N
-#define PHP_MODULE_INFO_N ZEND_MODULE_INFO_N
-
-#define PHP_MODULE_STARTUP_D ZEND_MODULE_STARTUP_D
-#define PHP_MODULE_SHUTDOWN_D ZEND_MODULE_SHUTDOWN_D
-#define PHP_MODULE_ACTIVATE_D ZEND_MODULE_ACTIVATE_D
-#define PHP_MODULE_DEACTIVATE_D ZEND_MODULE_DEACTIVATE_D
-#define PHP_MODULE_INFO_D ZEND_MODULE_INFO_D
-
-/* Compatibility macros */
-#define PHP_MINIT ZEND_MODULE_STARTUP_N
-#define PHP_MSHUTDOWN ZEND_MODULE_SHUTDOWN_N
-#define PHP_RINIT ZEND_MODULE_ACTIVATE_N
-#define PHP_RSHUTDOWN ZEND_MODULE_DEACTIVATE_N
-#define PHP_MINFO ZEND_MODULE_INFO_N
-
-#define PHP_MINIT_FUNCTION ZEND_MODULE_STARTUP_D
-#define PHP_MSHUTDOWN_FUNCTION ZEND_MODULE_SHUTDOWN_D
-#define PHP_RINIT_FUNCTION ZEND_MODULE_ACTIVATE_D
-#define PHP_RSHUTDOWN_FUNCTION ZEND_MODULE_DEACTIVATE_D
-#define PHP_MINFO_FUNCTION ZEND_MODULE_INFO_D
-
-
-/* Output support */
-#include "main/php_output.h"
-#define PHPWRITE(str, str_len) php_body_write((str), (str_len) TSRMLS_CC)
-#define PUTS(str) do { \
- const char *__str = (str); \
- php_body_write(__str, strlen(__str) TSRMLS_CC); \
-} while (0)
-
-#define PUTC(c) (php_body_write(&(c), 1 TSRMLS_CC), (c))
-#define PHPWRITE_H(str, str_len) php_header_write((str), (str_len) TSRMLS_CC)
-#define PUTS_H(str) do { \
- const char *__str = (str); \
- php_header_write(__str, strlen(__str) TSRMLS_CC); \
-} while (0)
-
-#define PUTC_H(c) (php_header_write(&(c), 1 TSRMLS_CC), (c))
-
-#ifdef ZTS
-#define VIRTUAL_DIR
-#endif
-
-#include "php_streams.h"
-#include "php_memory_streams.h"
-#include "fopen_wrappers.h"
-
-
-/* Virtual current working directory support */
-#include "tsrm_virtual_cwd.h"
-
-#include "zend_constants.h"
-
-/* connection status states */
-#define PHP_CONNECTION_NORMAL 0
-#define PHP_CONNECTION_ABORTED 1
-#define PHP_CONNECTION_TIMEOUT 2
-
-#include "php_reentrancy.h"
-
-/* Finding offsets of elements within structures.
- * Taken from the Apache code, which in turn, was taken from X code...
- */
-
-#ifndef XtOffset
-#if defined(CRAY) || (defined(__arm) && !defined(LINUX))
-#ifdef __STDC__
-#define XtOffset(p_type, field) _Offsetof(p_type, field)
-#else
-#ifdef CRAY2
-#define XtOffset(p_type, field) \
- (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
-
-#else /* !CRAY2 */
-
-#define XtOffset(p_type, field) ((unsigned int)&(((p_type)NULL)->field))
-
-#endif /* !CRAY2 */
-#endif /* __STDC__ */
-#else /* ! (CRAY || __arm) */
-
-#define XtOffset(p_type, field) \
- ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
-
-#endif /* !CRAY */
-#endif /* ! XtOffset */
-
-#ifndef XtOffsetOf
-#ifdef offsetof
-#define XtOffsetOf(s_type, field) offsetof(s_type, field)
-#else
-#define XtOffsetOf(s_type, field) XtOffset(s_type*, field)
-#endif
-#endif /* !XtOffsetOf */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/php3_compat.h b/main/php3_compat.h
deleted file mode 100644
index be0758e34d..0000000000
--- a/main/php3_compat.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP3_COMPAT_H
-#define PHP3_COMPAT_H
-
-typedef zval pval;
-
-#define pval_copy_constructor zval_copy_ctor
-#define pval_destructor zval_dtor
-
-#define _php3_hash_init zend_hash_init
-#define _php3_hash_destroy zend_hash_destroy
-
-#define _php3_hash_clean zend_hash_clean
-
-#define _php3_hash_add_or_update zend_hash_add_or_update
-#define _php3_hash_add zend_hash_add
-#define _php3_hash_update zend_hash_update
-
-#define _php3_hash_quick_add_or_update zend_hash_quick_add_or_update
-#define _php3_hash_quick_add zend_hash_quick_add
-#define _php3_hash_quick_update zend_hash_quick_update
-
-#define _php3_hash_index_update_or_next_insert zend_hash_index_update_or_next_insert
-#define _php3_hash_index_update zend_hash_index_update
-#define _php3_hash_next_index_insert zend_hash_next_index_insert
-
-#define _php3_hash_pointer_update zend_hash_pointer_update
-
-#define _php3_hash_pointer_index_update_or_next_insert zend_hash_pointer_index_update_or_next_insert
-#define _php3_hash_pointer_index_update zend_hash_pointer_index_update
-#define _php3_hash_next_index_pointer_update zend_hash_next_index_pointer_update
-#define _php3_hash_next_index_pointer_insert zend_hash_next_index_pointer_insert
-
-#define _php3_hash_del_key_or_index zend_hash_del_key_or_index
-#define _php3_hash_del zend_hash_del
-#define _php3_hash_index_del zend_hash_index_del
-
-#define _php3_hash_find zend_hash_find
-#define _php3_hash_quick_find zend_hash_quick_find
-#define _php3_hash_index_find zend_hash_index_find
-
-#define _php3_hash_exists zend_hash_exists
-#define _php3_hash_index_exists zend_hash_index_exists
-#define _php3_hash_is_pointer zend_hash_is_pointer
-#define _php3_hash_index_is_pointer zend_hash_index_is_pointer
-#define _php3_hash_next_free_element zend_hash_next_free_element
-
-#define _php3_hash_move_forward zend_hash_move_forward
-#define _php3_hash_move_backwards zend_hash_move_backwards
-#define _php3_hash_get_current_key zend_hash_get_current_key
-#define _php3_hash_get_current_data zend_hash_get_current_data
-#define _php3_hash_internal_pointer_reset zend_hash_internal_pointer_reset
-#define _php3_hash_internal_pointer_end zend_hash_internal_pointer_end
-
-#define _php3_hash_copy zend_hash_copy
-#define _php3_hash_merge zend_hash_merge
-#define _php3_hash_sort zend_hash_sort
-#define _php3_hash_minmax zend_hash_minmax
-
-#define _php3_hash_num_elements zend_hash_num_elements
-
-#define _php3_hash_apply zend_hash_apply
-#define _php3_hash_apply_with_argument zend_hash_apply_with_argument
-
-
-#define php3_error php_error
-
-#define php3_printf php_printf
-#define _php3_sprintf php_sprintf
-
-
-
-#define php3_module_entry zend_module_entry
-
-#define php3_strndup zend_strndup
-#define php3_str_tolower zend_str_tolower
-#define php3_binary_strcmp zend_binary_strcmp
-
-
-#define php3_list_insert zend_list_insert
-#define php3_list_find zend_list_find
-#define php3_list_delete zend_list_delete
-
-#define php3_plist_insert zend_plist_insert
-#define php3_plist_find zend_plist_find
-#define php3_plist_delete zend_plist_delete
-
-#define zend_print_pval zend_print_zval
-#define zend_print_pval_r zend_print_zval_r
-
-
-#define function_entry zend_function_entry
-
-#define _php3_addslashes php_addslashes
-#define _php3_stripslashes php_stripslashes
-#define php3_dl php_dl
-
-#define getParameters zend_get_parameters
-#define getParametersArray zend_get_parameters_array
-
-#define list_entry zend_rsrc_list_entry
-
-#endif /* PHP3_COMPAT_H */
diff --git a/main/php_compat.h b/main/php_compat.h
deleted file mode 100644
index a9ab40550f..0000000000
--- a/main/php_compat.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_COMPAT_H
-#define PHP_COMPAT_H
-
-#ifdef PHP_WIN32
-#include "config.w32.h"
-#elif defined(NETWARE)
-#include "config.nw.h"
-#else
-#include "php_config.h"
-#endif
-
-#if defined(HAVE_BUNDLED_PCRE) || !defined(PHP_VERSION)
-#define pcre_compile php_pcre_compile
-#define pcre_copy_substring php_pcre_copy_substring
-#define pcre_exec php_pcre_exec
-#define pcre_get_substring php_pcre_substring
-#define pcre_get_substring_list php_pcre_get_substring_list
-#define pcre_info php_pcre_info
-#define pcre_maketables php_pcre_maketables
-#define pcre_study php_pcre_study
-#define pcre_version php_pcre_version
-#endif
-
-#define lookup php_lookup
-#define hashTableInit php_hashTableInit
-#define hashTableDestroy php_hashTableDestroy
-#define hashTableIterInit php_hashTableIterInit
-#define hashTableIterNext php_hashTableIterNext
-
-#ifdef HAVE_LIBEXPAT_BUNDLED
-#define XML_DefaultCurrent php_XML_DefaultCurrent
-#define XML_ErrorString php_XML_ErrorString
-#define XML_ExpatVersion php_XML_ExpatVersion
-#define XML_ExpatVersionInfo php_XML_ExpatVersionInfo
-#define XML_ExternalEntityParserCreate php_XML_ExternalEntityParserCreate
-#define XML_GetBase php_XML_GetBase
-#define XML_GetBuffer php_XML_GetBuffer
-#define XML_GetCurrentByteCount php_XML_GetCurrentByteCount
-#define XML_GetCurrentByteIndex php_XML_GetCurrentByteIndex
-#define XML_GetCurrentColumnNumber php_XML_GetCurrentColumnNumber
-#define XML_GetCurrentLineNumber php_XML_GetCurrentLineNumber
-#define XML_GetErrorCode php_XML_GetErrorCode
-#define XML_GetIdAttributeIndex php_XML_GetIdAttributeIndex
-#define XML_GetInputContext php_XML_GetInputContext
-#define XML_GetSpecifiedAttributeCount php_XML_GetSpecifiedAttributeCount
-#define XmlGetUtf16InternalEncodingNS php_XmlGetUtf16InternalEncodingNS
-#define XmlGetUtf16InternalEncoding php_XmlGetUtf16InternalEncoding
-#define XmlGetUtf8InternalEncodingNS php_XmlGetUtf8InternalEncodingNS
-#define XmlGetUtf8InternalEncoding php_XmlGetUtf8InternalEncoding
-#define XmlInitEncoding php_XmlInitEncoding
-#define XmlInitUnknownEncoding php_XmlInitUnknownEncoding
-#define XML_ParseBuffer php_XML_ParseBuffer
-#define XML_Parse php_XML_Parse
-#define XML_ParserCreate_MM php_XML_ParserCreate_MM
-#define XML_ParserCreateNS php_XML_ParserCreateNS
-#define XML_ParserCreate php_XML_ParserCreate
-#define XML_ParserFree php_XML_ParserFree
-#define XmlParseXmlDecl php_XmlParseXmlDecl
-#define XmlPrologStateInitExternalEntity php_XmlPrologStateInitExternalEntity
-#define XmlPrologStateInit php_XmlPrologStateInit
-#define XML_SetAttlistDeclHandler php_XML_SetAttlistDeclHandler
-#define XML_SetBase php_XML_SetBase
-#define XML_SetCdataSectionHandler php_XML_SetCdataSectionHandler
-#define XML_SetCharacterDataHandler php_XML_SetCharacterDataHandler
-#define XML_SetCommentHandler php_XML_SetCommentHandler
-#define XML_SetDefaultHandlerExpand php_XML_SetDefaultHandlerExpand
-#define XML_SetDefaultHandler php_XML_SetDefaultHandler
-#define XML_SetDoctypeDeclHandler php_XML_SetDoctypeDeclHandler
-#define XML_SetElementDeclHandler php_XML_SetElementDeclHandler
-#define XML_SetElementHandler php_XML_SetElementHandler
-#define XML_SetEncoding php_XML_SetEncoding
-#define XML_SetEndCdataSectionHandler php_XML_SetEndCdataSectionHandler
-#define XML_SetEndDoctypeDeclHandler php_XML_SetEndDoctypeDeclHandler
-#define XML_SetEndElementHandler php_XML_SetEndElementHandler
-#define XML_SetEndNamespaceDeclHandler php_XML_SetEndNamespaceDeclHandler
-#define XML_SetEntityDeclHandler php_XML_SetEntityDeclHandler
-#define XML_SetExternalEntityRefHandlerArg php_XML_SetExternalEntityRefHandlerArg
-#define XML_SetExternalEntityRefHandler php_XML_SetExternalEntityRefHandler
-#define XML_SetNamespaceDeclHandler php_XML_SetNamespaceDeclHandler
-#define XML_SetNotationDeclHandler php_XML_SetNotationDeclHandler
-#define XML_SetNotStandaloneHandler php_XML_SetNotStandaloneHandler
-#define XML_SetParamEntityParsing php_XML_SetParamEntityParsing
-#define XML_SetProcessingInstructionHandler php_XML_SetProcessingInstructionHandler
-#define XML_SetReturnNSTriplet php_XML_SetReturnNSTriplet
-#define XML_SetStartCdataSectionHandler php_XML_SetStartCdataSectionHandler
-#define XML_SetStartDoctypeDeclHandler php_XML_SetStartDoctypeDeclHandler
-#define XML_SetStartElementHandler php_XML_SetStartElementHandler
-#define XML_SetStartNamespaceDeclHandler php_XML_SetStartNamespaceDeclHandler
-#define XML_SetUnknownEncodingHandler php_XML_SetUnknownEncodingHandler
-#define XML_SetUnparsedEntityDeclHandler php_XML_SetUnparsedEntityDeclHandler
-#define XML_SetUserData php_XML_SetUserData
-#define XML_SetXmlDeclHandler php_XML_SetXmlDeclHandler
-#define XmlSizeOfUnknownEncoding php_XmlSizeOfUnknownEncoding
-#define XML_UseParserAsHandlerArg php_XML_UseParserAsHandlerArg
-#define XmlUtf16Encode php_XmlUtf16Encode
-#define XmlUtf8Encode php_XmlUtf8Encode
-
-/* Define to specify how much context to retain around the current parse
- point. */
-#define XML_CONTEXT_BYTES 1024
-
-/* Define to make parameter entity parsing functionality available. */
-#define XML_DTD 1
-
-/* Define to make XML Namespaces functionality available. */
-#define XML_NS 1
-#endif
-
-#endif
diff --git a/main/php_content_types.c b/main/php_content_types.c
deleted file mode 100644
index 53c241cbe3..0000000000
--- a/main/php_content_types.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "SAPI.h"
-#include "rfc1867.h"
-
-#include "php_content_types.h"
-
-/* {{{ php_post_entries[]
- */
-static sapi_post_entry php_post_entries[] = {
- { DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_std_post_handler },
- { MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, NULL, rfc1867_post_handler },
- { NULL, 0, NULL, NULL }
-};
-/* }}} */
-
-/* {{{ SAPI_POST_READER_FUNC
- */
-SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader)
-{
- char *data = NULL;
- int length = 0;
-
- /* $HTTP_RAW_POST_DATA registration */
- if(!strcmp(SG(request_info).request_method, "POST")) {
- if(NULL == SG(request_info).post_entry) {
- /* no post handler registered, so we just swallow the data */
- sapi_read_standard_form_data(TSRMLS_C);
- length = SG(request_info).post_data_length;
- data = estrndup(SG(request_info).post_data, length);
- } else if(PG(always_populate_raw_post_data) && SG(request_info).post_data) {
- length = SG(request_info).post_data_length;
- data = estrndup(SG(request_info).post_data, length);
- }
- if(data) {
- SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, length);
- }
- }
-
- /* for php://input stream:
- some post handlers modify the content of request_info.post_data
- so for now we need a copy for the php://input stream
- in the long run post handlers should be changed to not touch
- request_info.post_data for memory preservation reasons
- */
- if(SG(request_info).post_data) {
- SG(request_info).raw_post_data = estrndup(SG(request_info).post_data, SG(request_info).post_data_length);
- SG(request_info).raw_post_data_length = SG(request_info).post_data_length;
- }
-
-}
-/* }}} */
-
-/* {{{ php_startup_sapi_content_types
- */
-int php_startup_sapi_content_types(void)
-{
- sapi_register_post_entries(php_post_entries);
- sapi_register_default_post_reader(php_default_post_reader);
- sapi_register_treat_data(php_default_treat_data);
- sapi_register_input_filter(php_default_input_filter);
- return SUCCESS;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/php_content_types.h b/main/php_content_types.h
deleted file mode 100644
index 27f8c3fe62..0000000000
--- a/main/php_content_types.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_CONTENT_TYPES_H
-#define PHP_CONTENT_TYPES_H
-
-#define DEFAULT_POST_CONTENT_TYPE "application/x-www-form-urlencoded"
-
-SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader);
-SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler);
-int php_startup_sapi_content_types(void);
-
-#endif /* PHP_CONTENT_TYPES_H */
diff --git a/main/php_globals.h b/main/php_globals.h
deleted file mode 100644
index 6665d93280..0000000000
--- a/main/php_globals.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_GLOBALS_H
-#define PHP_GLOBALS_H
-
-#include "zend_globals.h"
-
-typedef struct _php_core_globals php_core_globals;
-
-#ifdef ZTS
-# define PG(v) TSRMG(core_globals_id, php_core_globals *, v)
-extern PHPAPI int core_globals_id;
-#else
-# define PG(v) (core_globals.v)
-extern ZEND_API struct _php_core_globals core_globals;
-#endif
-
-
-#define TRACK_VARS_POST 0
-#define TRACK_VARS_GET 1
-#define TRACK_VARS_COOKIE 2
-#define TRACK_VARS_SERVER 3
-#define TRACK_VARS_ENV 4
-#define TRACK_VARS_FILES 5
-#define TRACK_VARS_REQUEST 6
-
-struct _php_tick_function_entry;
-
-typedef struct _arg_separators {
- char *output;
- char *input;
-} arg_separators;
-
-struct _php_core_globals {
- zend_bool magic_quotes_gpc;
- zend_bool magic_quotes_runtime;
- zend_bool magic_quotes_sybase;
-
- zend_bool safe_mode;
-
- zend_bool allow_call_time_pass_reference;
- zend_bool implicit_flush;
-
- long output_buffering;
-
- char *safe_mode_include_dir;
- zend_bool safe_mode_gid;
- zend_bool sql_safe_mode;
- zend_bool enable_dl;
-
- char *output_handler;
-
- char *unserialize_callback_func;
- long serialize_precision;
-
- char *safe_mode_exec_dir;
-
- long memory_limit;
- long max_input_time;
-
- zend_bool track_errors;
- zend_bool display_errors;
- zend_bool display_startup_errors;
- zend_bool log_errors;
- long log_errors_max_len;
- zend_bool ignore_repeated_errors;
- zend_bool ignore_repeated_source;
- zend_bool report_memleaks;
- char *error_log;
-
- char *doc_root;
- char *user_dir;
- char *include_path;
- char *open_basedir;
- char *extension_dir;
-
- char *upload_tmp_dir;
- long upload_max_filesize;
-
- char *error_append_string;
- char *error_prepend_string;
-
- char *auto_prepend_file;
- char *auto_append_file;
-
- arg_separators arg_separator;
-
- char *gpc_order;
- char *variables_order;
-
- HashTable rfc1867_protected_variables;
-
- short connection_status;
- short ignore_user_abort;
-
- unsigned char header_is_being_sent;
-
- zend_llist tick_functions;
-
- zval *http_globals[6];
-
- zend_bool expose_php;
-
- zend_bool register_globals;
- zend_bool register_long_arrays;
- zend_bool register_argc_argv;
-
- zend_bool y2k_compliance;
-
- char *docref_root;
- char *docref_ext;
-
- zend_bool html_errors;
- zend_bool xmlrpc_errors;
-
- long xmlrpc_error_number;
-
- zend_bool activated_auto_globals[8];
-
- zend_bool modules_activated;
- zend_bool file_uploads;
- zend_bool during_request_startup;
- zend_bool allow_url_fopen;
- zend_bool always_populate_raw_post_data;
- zend_bool report_zend_debug;
-
- char *last_error_message;
- char *last_error_file;
- int last_error_lineno;
- error_handling_t error_handling;
- zend_class_entry *exception_class;
-};
-
-
-#endif /* PHP_GLOBALS_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_ini.c b/main/php_ini.c
deleted file mode 100644
index 9b3fe10c63..0000000000
--- a/main/php_ini.c
+++ /dev/null
@@ -1,585 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* Check CWD for php.ini */
-#define INI_CHECK_CWD
-
-#include "php.h"
-#include "ext/standard/info.h"
-#include "zend_ini.h"
-#include "php_ini.h"
-#include "ext/standard/dl.h"
-#include "zend_extensions.h"
-#include "zend_highlight.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "php_scandir.h"
-
-#if HAVE_SCANDIR && HAVE_ALPHASORT && HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#ifndef S_ISREG
-#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
-#endif
-
-typedef struct _php_extension_lists {
- zend_llist engine;
- zend_llist functions;
-} php_extension_lists;
-
-
-/* True globals */
-static HashTable configuration_hash;
-PHPAPI char *php_ini_opened_path=NULL;
-static php_extension_lists extension_lists;
-PHPAPI char *php_ini_scanned_files=NULL;
-
-/* {{{ php_ini_displayer_cb
- */
-static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type)
-{
- if (ini_entry->displayer) {
- ini_entry->displayer(ini_entry, type);
- } else {
- char *display_string;
- uint display_string_length, esc_html=0;
- TSRMLS_FETCH();
-
- if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
- if (ini_entry->orig_value && ini_entry->orig_value[0]) {
- display_string = ini_entry->orig_value;
- display_string_length = ini_entry->orig_value_length;
- esc_html = !sapi_module.phpinfo_as_text;
- } else {
- if (!sapi_module.phpinfo_as_text) {
- display_string = "<i>no value</i>";
- display_string_length = sizeof("<i>no value</i>") - 1;
- } else {
- display_string = "no value";
- display_string_length = sizeof("no value") - 1;
- }
- }
- } else if (ini_entry->value && ini_entry->value[0]) {
- display_string = ini_entry->value;
- display_string_length = ini_entry->value_length;
- esc_html = !sapi_module.phpinfo_as_text;
- } else {
- if (!sapi_module.phpinfo_as_text) {
- display_string = "<i>no value</i>";
- display_string_length = sizeof("<i>no value</i>") - 1;
- } else {
- display_string = "no value";
- display_string_length = sizeof("no value") - 1;
- }
- }
-
- if (esc_html) {
- php_html_puts(display_string, display_string_length TSRMLS_CC);
- } else {
- PHPWRITE(display_string, display_string_length);
- }
- }
-}
-/* }}} */
-
-/* {{{ php_ini_displayer
- */
-static int php_ini_displayer(zend_ini_entry *ini_entry, int module_number TSRMLS_DC)
-{
- if (ini_entry->module_number != module_number) {
- return 0;
- }
- if (!sapi_module.phpinfo_as_text) {
- PUTS("<tr>");
- PUTS("<td class=\"e\">");
- PHPWRITE(ini_entry->name, ini_entry->name_length - 1);
- PUTS("</td><td class=\"v\">");
- php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE);
- PUTS("</td><td class=\"v\">");
- php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG);
- PUTS("</td></tr>\n");
- } else {
- PHPWRITE(ini_entry->name, ini_entry->name_length - 1);
- PUTS(" => ");
- php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE);
- PUTS(" => ");
- php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG);
- PUTS("\n");
- }
- return 0;
-}
-/* }}} */
-
-/* {{{ display_ini_entries
- */
-PHPAPI void display_ini_entries(zend_module_entry *module)
-{
- int module_number;
- TSRMLS_FETCH();
-
- if (module) {
- module_number = module->module_number;
- } else {
- module_number = 0;
- }
- php_info_print_table_start();
- php_info_print_table_header(3, "Directive", "Local Value", "Master Value");
- zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) php_ini_displayer, (void *) (long) module_number TSRMLS_CC);
- php_info_print_table_end();
-}
-/* }}} */
-
-/* php.ini support */
-
-#ifdef ZTS
-# if (ZEND_DEBUG)
-# define ZEND_EXTENSION_TOKEN "zend_extension_debug_ts"
-# else
-# define ZEND_EXTENSION_TOKEN "zend_extension_ts"
-# endif
-#else
-# if (ZEND_DEBUG)
-# define ZEND_EXTENSION_TOKEN "zend_extension_debug"
-# else
-# define ZEND_EXTENSION_TOKEN "zend_extension"
-# endif
-#endif
-
-/* {{{ pvalue_config_destructor
- */
-static void pvalue_config_destructor(zval *pvalue)
-{
- if (Z_TYPE_P(pvalue) == IS_STRING && Z_STRVAL_P(pvalue) != empty_string) {
- free(Z_STRVAL_P(pvalue));
- }
-}
-/* }}} */
-
-/* {{{ php_config_ini_parser_cb
- */
-static void php_config_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, void *arg)
-{
- switch (callback_type) {
- case ZEND_INI_PARSER_ENTRY: {
- zval *entry;
-
- if (!arg2) {
- break;
- }
- if (!strcasecmp(Z_STRVAL_P(arg1), "extension")) { /* load function module */
- zval copy;
-
- copy = *arg2;
- zval_copy_ctor(&copy);
- copy.refcount = 0;
- zend_llist_add_element(&extension_lists.functions, &copy);
- } else if (!strcasecmp(Z_STRVAL_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */
- char *extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2));
-
- zend_llist_add_element(&extension_lists.engine, &extension_name);
- } else {
- zend_hash_update(&configuration_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, arg2, sizeof(zval), (void **) &entry);
- Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry));
- }
- }
- break;
-
- case ZEND_INI_PARSER_POP_ENTRY: {
- zval *hash;
- zval **find_hash;
- zval *element;
-
- if (!arg2) {
- /* bare string - nothing to do */
- break;
- }
-
- if (zend_hash_find(&configuration_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, (void **) &find_hash) == FAILURE) {
- ALLOC_ZVAL(hash);
- array_init(hash);
-
- zend_hash_update(&configuration_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, &hash, sizeof(zval *), NULL);
- } else {
- hash = *find_hash;
- }
-
- ALLOC_ZVAL(element);
- *element = *arg2;
- zval_copy_ctor(element);
- INIT_PZVAL(element);
- add_next_index_zval(hash, element);
- }
- break;
-
- case ZEND_INI_PARSER_SECTION:
- break;
- }
-}
-/* }}} */
-
-/* {{{ php_load_function_extension_cb
- */
-static void php_load_function_extension_cb(void *arg TSRMLS_DC)
-{
- zval *extension = (zval *) arg;
- zval zval;
-
- php_dl(extension, MODULE_PERSISTENT, &zval TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ php_load_zend_extension_cb
- */
-static void php_load_zend_extension_cb(void *arg TSRMLS_DC)
-{
- zend_load_extension(*((char **) arg));
-}
-/* }}} */
-
-/* {{{ php_init_config
- */
-int php_init_config()
-{
- char *env_location, *php_ini_search_path;
- char *binary_location;
- int safe_mode_state;
- char *open_basedir;
- int free_ini_search_path=0;
- zend_file_handle fh;
- struct stat sb;
- char ini_file[MAXPATHLEN];
- char *p;
- zend_llist scanned_ini_list;
- int l, total_l=0;
- zend_llist_element *element;
- TSRMLS_FETCH();
-
- if (zend_hash_init(&configuration_hash, 0, NULL, (dtor_func_t) pvalue_config_destructor, 1) == FAILURE) {
- return FAILURE;
- }
-
- if (sapi_module.ini_defaults) {
- sapi_module.ini_defaults(&configuration_hash);
- }
-
- zend_llist_init(&extension_lists.engine, sizeof(char *), (llist_dtor_func_t) free_estring, 1);
- zend_llist_init(&extension_lists.functions, sizeof(zval), (llist_dtor_func_t) ZVAL_DESTRUCTOR, 1);
- zend_llist_init(&scanned_ini_list, sizeof(char *), (llist_dtor_func_t) free_estring, 1);
-
- safe_mode_state = PG(safe_mode);
- open_basedir = PG(open_basedir);
-
- env_location = getenv("PHPRC");
- if (!env_location) {
- env_location = "";
- }
- if (sapi_module.php_ini_path_override) {
- php_ini_search_path = sapi_module.php_ini_path_override;
- free_ini_search_path = 0;
- } else {
- char *default_location;
- static const char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 };
-
- php_ini_search_path = (char *) emalloc(MAXPATHLEN * 3 + strlen(env_location) + 3 + 1);
- free_ini_search_path = 1;
- php_ini_search_path[0] = 0;
-
- /*
- * Prepare search path
- */
-
- /* Add environment location */
- if (env_location[0]) {
- if (*php_ini_search_path) {
- strcat(php_ini_search_path, paths_separator);
- }
- strcat(php_ini_search_path, env_location);
- }
-
- /* Add cwd */
-#ifdef INI_CHECK_CWD
- if (strcmp(sapi_module.name, "cli") != 0) {
- if (*php_ini_search_path) {
- strcat(php_ini_search_path, paths_separator);
- }
- strcat(php_ini_search_path, ".");
- }
-#endif
-
- /* Add binary directory */
-#ifdef PHP_WIN32
- binary_location = (char *) emalloc(MAXPATHLEN);
- if (GetModuleFileName(0, binary_location, MAXPATHLEN) == 0) {
- efree(binary_location);
- binary_location = NULL;
- }
-#else
- if (sapi_module.executable_location) {
- binary_location = estrdup(sapi_module.executable_location);
- } else {
- binary_location = NULL;
- }
-#endif
- if (binary_location) {
- char *separator_location = strrchr(binary_location, DEFAULT_SLASH);
-
- if (separator_location) {
- *(separator_location+1) = 0;
- }
- if (*php_ini_search_path) {
- strcat(php_ini_search_path, paths_separator);
- }
- strcat(php_ini_search_path, binary_location);
- efree(binary_location);
- }
-
- /* Add default location */
-#ifdef PHP_WIN32
- default_location = (char *) emalloc(MAXPATHLEN + 1);
-
- if (0 < GetWindowsDirectory(default_location, MAXPATHLEN)) {
- if (*php_ini_search_path) {
- strcat(php_ini_search_path, paths_separator);
- }
- strcat(php_ini_search_path, default_location);
- }
- efree(default_location);
-#else
- default_location = PHP_CONFIG_FILE_PATH;
- if (*php_ini_search_path) {
- strcat(php_ini_search_path, paths_separator);
- }
- strcat(php_ini_search_path, default_location);
-#endif
- }
-
- PG(safe_mode) = 0;
- PG(open_basedir) = NULL;
-
- memset(&fh, 0, sizeof(fh));
- /* Check if php_ini_path_override is a file */
- if (!sapi_module.php_ini_ignore) {
- if (sapi_module.php_ini_path_override && sapi_module.php_ini_path_override[0]) {
- struct stat statbuf;
-
- if (!VCWD_STAT(sapi_module.php_ini_path_override, &statbuf)) {
- if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) {
- fh.handle.fp = VCWD_FOPEN(sapi_module.php_ini_path_override, "r");
- fh.filename = sapi_module.php_ini_path_override;
- }
- }
- }
- /* Search php-%sapi-module-name%.ini file in search path */
- if (!fh.handle.fp) {
- const char *fmt = "php-%s.ini";
- char *ini_fname = emalloc(strlen(fmt) + strlen(sapi_module.name));
- sprintf(ini_fname, fmt, sapi_module.name);
- fh.handle.fp = php_fopen_with_path(ini_fname, "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
- efree(ini_fname);
- if (fh.handle.fp) {
- fh.filename = php_ini_opened_path;
- }
- }
- /* Search php.ini file in search path */
- if (!fh.handle.fp) {
- fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
- if (fh.handle.fp) {
- fh.filename = php_ini_opened_path;
- }
- }
- }
-
- if (free_ini_search_path) {
- efree(php_ini_search_path);
- }
-
- PG(safe_mode) = safe_mode_state;
- PG(open_basedir) = open_basedir;
-
- if (fh.handle.fp) {
- fh.type = ZEND_HANDLE_FP;
-
- zend_parse_ini_file(&fh, 1, php_config_ini_parser_cb, &extension_lists);
-
- {
- zval tmp;
-
- Z_STRLEN(tmp) = strlen(fh.filename);
- Z_STRVAL(tmp) = zend_strndup(fh.filename, Z_STRLEN(tmp));
- Z_TYPE(tmp) = IS_STRING;
- zend_hash_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path"), (void *) &tmp, sizeof(zval), NULL);
- if (php_ini_opened_path) {
- efree(php_ini_opened_path);
- }
- php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
- }
- }
-
- /* If the config_file_scan_dir is set at compile-time, go and scan this directory and
- * parse any .ini files found in this directory. */
- if (!sapi_module.php_ini_ignore && strlen(PHP_CONFIG_FILE_SCAN_DIR)) {
- struct dirent **namelist;
- int ndir, i;
-
- if ((ndir = php_scandir(PHP_CONFIG_FILE_SCAN_DIR, &namelist, 0, php_alphasort)) > 0) {
- for (i = 0; i < ndir; i++) {
- /* check for a .ini extension */
- if (!(p = strrchr(namelist[i]->d_name, '.')) || (p && strcmp(p, ".ini"))) {
- free(namelist[i]);
- continue;
- }
- snprintf(ini_file, MAXPATHLEN, "%s%c%s", PHP_CONFIG_FILE_SCAN_DIR, DEFAULT_SLASH, namelist[i]->d_name);
- if (VCWD_STAT(ini_file, &sb) == 0) {
- if (S_ISREG(sb.st_mode)) {
- if ((fh.handle.fp = VCWD_FOPEN(ini_file, "r"))) {
- fh.filename = ini_file;
- fh.type = ZEND_HANDLE_FP;
- zend_parse_ini_file(&fh, 1, php_config_ini_parser_cb, &extension_lists);
- /* Here, add it to the list of ini files read */
- l = strlen(ini_file);
- total_l += l + 2;
- p = estrndup(ini_file, l);
- zend_llist_add_element(&scanned_ini_list, &p);
- }
- }
- }
- free(namelist[i]);
- }
- free(namelist);
-
- /*
- * Don't need an extra byte for the \0 in this malloc as the last
- * element will not get a trailing , which gives us the byte for the \0
- */
- php_ini_scanned_files = (char *) malloc(total_l);
- *php_ini_scanned_files = '\0';
- for (element = scanned_ini_list.head; element; element = element->next) {
- strcat(php_ini_scanned_files, *(char **)element->data);
- strcat(php_ini_scanned_files, element->next ? ",\n" : "\n");
- }
- zend_llist_destroy(&scanned_ini_list);
- }
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_shutdown_config
- */
-int php_shutdown_config(void)
-{
- zend_hash_destroy(&configuration_hash);
- if (php_ini_opened_path) {
- free(php_ini_opened_path);
- }
- if (php_ini_scanned_files) {
- free(php_ini_scanned_files);
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_ini_delayed_modules_startup
- */
-void php_ini_delayed_modules_startup(TSRMLS_D)
-{
- zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb TSRMLS_CC);
- zend_llist_apply(&extension_lists.functions, php_load_function_extension_cb TSRMLS_CC);
-
- zend_llist_destroy(&extension_lists.engine);
- zend_llist_destroy(&extension_lists.functions);
-}
-/* }}} */
-
-/* {{{ cfg_get_entry
- */
-zval *cfg_get_entry(char *name, uint name_length)
-{
- zval *tmp;
-
- if (zend_hash_find(&configuration_hash, name, name_length, (void **) &tmp) == SUCCESS) {
- return tmp;
- } else {
- return NULL;
- }
-}
-/* }}} */
-
-/* {{{ cfg_get_long
- */
-PHPAPI int cfg_get_long(char *varname, long *result)
-{
- zval *tmp, var;
-
- if (zend_hash_find(&configuration_hash, varname, strlen(varname) + 1, (void **) &tmp) == FAILURE) {
- *result = (long) NULL;
- return FAILURE;
- }
- var = *tmp;
- zval_copy_ctor(&var);
- convert_to_long(&var);
- *result = Z_LVAL(var);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ cfg_get_double
- */
-PHPAPI int cfg_get_double(char *varname, double *result)
-{
- zval *tmp, var;
-
- if (zend_hash_find(&configuration_hash, varname, strlen(varname) + 1, (void **) &tmp) == FAILURE) {
- *result = (double) 0;
- return FAILURE;
- }
- var = *tmp;
- zval_copy_ctor(&var);
- convert_to_double(&var);
- *result = Z_DVAL(var);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ cfg_get_string
- */
-PHPAPI int cfg_get_string(char *varname, char **result)
-{
- zval *tmp;
-
- if (zend_hash_find(&configuration_hash, varname, strlen(varname)+1, (void **) &tmp) == FAILURE) {
- *result = NULL;
- return FAILURE;
- }
- *result = Z_STRVAL_P(tmp);
- return SUCCESS;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/php_ini.h b/main/php_ini.h
deleted file mode 100644
index 352b37ef7f..0000000000
--- a/main/php_ini.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_INI_H
-#define PHP_INI_H
-
-#include "zend_ini.h"
-
-int php_init_config();
-int php_shutdown_config(void);
-void php_ini_delayed_modules_startup(TSRMLS_D);
-zval *cfg_get_entry(char *name, uint name_length);
-
-#define PHP_INI_USER ZEND_INI_USER
-#define PHP_INI_PERDIR ZEND_INI_PERDIR
-#define PHP_INI_SYSTEM ZEND_INI_SYSTEM
-
-#define PHP_INI_ALL ZEND_INI_ALL
-
-#define php_ini_entry zend_ini_entry
-
-#define PHP_INI_MH ZEND_INI_MH
-#define PHP_INI_DISP ZEND_INI_DISP
-
-#define PHP_INI_BEGIN ZEND_INI_BEGIN
-#define PHP_INI_END ZEND_INI_END
-
-#define PHP_INI_ENTRY3_EX ZEND_INI_ENTRY3_EX
-#define PHP_INI_ENTRY3 ZEND_INI_ENTRY3
-#define PHP_INI_ENTRY2_EX ZEND_INI_ENTRY2_EX
-#define PHP_INI_ENTRY2 ZEND_INI_ENTRY2
-#define PHP_INI_ENTRY1_EX ZEND_INI_ENTRY1_EX
-#define PHP_INI_ENTRY1 ZEND_INI_ENTRY1
-#define PHP_INI_ENTRY_EX ZEND_INI_ENTRY_EX
-#define PHP_INI_ENTRY ZEND_INI_ENTRY
-
-#define STD_PHP_INI_ENTRY STD_ZEND_INI_ENTRY
-#define STD_PHP_INI_ENTRY_EX STD_ZEND_INI_ENTRY_EX
-#define STD_PHP_INI_BOOLEAN STD_ZEND_INI_BOOLEAN
-
-#define PHP_INI_DISPLAY_ORIG ZEND_INI_DISPLAY_ORIG
-#define PHP_INI_DISPLAY_ACTIVE ZEND_INI_DISPLAY_ACTIVE
-
-#define PHP_INI_STAGE_STARTUP ZEND_INI_STAGE_STARTUP
-#define PHP_INI_STAGE_SHUTDOWN ZEND_INI_STAGE_SHUTDOWN
-#define PHP_INI_STAGE_ACTIVATE ZEND_INI_STAGE_ACTIVATE
-#define PHP_INI_STAGE_DEACTIVATE ZEND_INI_STAGE_DEACTIVATE
-#define PHP_INI_STAGE_RUNTIME ZEND_INI_STAGE_RUNTIME
-
-#define php_ini_boolean_displayer_cb zend_ini_boolean_displayer_cb
-#define php_ini_color_displayer_cb zend_ini_color_displayer_cb
-
-#define php_alter_ini_entry zend_alter_ini_entry
-
-#define php_ini_long zend_ini_long
-#define php_ini_double zend_ini_double
-#define php_ini_string zend_ini_string
-
-#endif /* PHP_INI_H */
diff --git a/main/php_logos.c b/main/php_logos.c
deleted file mode 100644
index 56c32ede00..0000000000
--- a/main/php_logos.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "logos.h"
-#include "php_logos.h"
-#include "ext/standard/info.h"
-#include "SAPI.h"
-
-typedef struct _php_info_logo {
- char *mimetype;
- int mimelen;
- unsigned char *data;
- int size;
-} php_info_logo;
-
-HashTable phpinfo_logo_hash;
-
-PHPAPI int php_register_info_logo(char *logo_string, char *mimetype, unsigned char *data, int size)
-{
- php_info_logo info_logo;
-
- info_logo.mimetype = mimetype;
- info_logo.mimelen = strlen(mimetype);
- info_logo.data = data;
- info_logo.size = size;
-
- return zend_hash_add(&phpinfo_logo_hash, logo_string, strlen(logo_string), &info_logo, sizeof(php_info_logo), NULL);
-}
-
-PHPAPI int php_unregister_info_logo(char *logo_string)
-{
- return zend_hash_del(&phpinfo_logo_hash, logo_string, strlen(logo_string));
-}
-
-int php_init_info_logos(void)
-{
- if(zend_hash_init(&phpinfo_logo_hash, 0, NULL, NULL, 1)==FAILURE)
- return FAILURE;
-
- php_register_info_logo(PHP_LOGO_GUID , "image/gif", php_logo , sizeof(php_logo));
- php_register_info_logo(PHP_EGG_LOGO_GUID, "image/gif", php_egg_logo, sizeof(php_egg_logo));
- php_register_info_logo(ZEND_LOGO_GUID , "image/gif", zend_logo , sizeof(zend_logo));
-
- return SUCCESS;
-}
-
-int php_shutdown_info_logos(void)
-{
- zend_hash_destroy(&phpinfo_logo_hash);
- return SUCCESS;
-}
-
-#define CONTENT_TYPE_HEADER "Content-Type: "
-int php_info_logos(const char *logo_string TSRMLS_DC)
-{
- php_info_logo *logo_image;
- char *content_header;
- int len;
-
- if(FAILURE==zend_hash_find(&phpinfo_logo_hash, (char *) logo_string, strlen(logo_string), (void **)&logo_image))
- return 0;
-
- len=strlen(CONTENT_TYPE_HEADER)+logo_image->mimelen;
- content_header=malloc(len+1);
- if(!content_header) return 0;
- strcpy(content_header, CONTENT_TYPE_HEADER);
- strcat(content_header, logo_image->mimetype);
- sapi_add_header(content_header, len, 1);
- free(content_header);
-
- PHPWRITE(logo_image->data, logo_image->size);
- return 1;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/php_logos.h b/main/php_logos.h
deleted file mode 100644
index 31e3b234c8..0000000000
--- a/main/php_logos.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-
-#ifndef _PHP_LOGOS_H
-#define _PHP_LOGOS_H
-
-PHPAPI int php_register_info_logo(char *logo_string, char *mimetype, unsigned char *data, int size);
-PHPAPI int php_unregister_info_logo(char *logo_string);
-int php_init_info_logos(void);
-int php_shutdown_info_logos(void);
-int php_info_logos(const char *logo_string TSRMLS_DC);
-
-#endif /* _PHP_LOGOS_H */
diff --git a/main/php_main.h b/main/php_main.h
deleted file mode 100644
index 9c5e6c0d03..0000000000
--- a/main/php_main.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_MAIN_H
-#define PHP_MAIN_H
-
-#include "zend_globals.h"
-#include "php_globals.h"
-#include "SAPI.h"
-
-PHPAPI int php_request_startup(TSRMLS_D);
-PHPAPI void php_request_shutdown(void *dummy);
-PHPAPI void php_request_shutdown_for_exec(void *dummy);
-PHPAPI int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_modules, uint num_additional_modules);
-PHPAPI void php_module_shutdown(TSRMLS_D);
-PHPAPI void php_module_shutdown_for_exec(void);
-PHPAPI int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals);
-PHPAPI int php_request_startup_for_hook(TSRMLS_D);
-
-PHPAPI int php_startup_extensions(zend_module_entry **ptr, int count);
-
-PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC);
-PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval **ret TSRMLS_DC);
-PHPAPI int php_handle_special_queries(TSRMLS_D);
-PHPAPI int php_lint_script(zend_file_handle *file TSRMLS_DC);
-
-PHPAPI void php_handle_aborted_connection(void);
-PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC);
-
-PHPAPI void php_html_puts(const char *str, uint siz TSRMLS_DC);
-
-extern void php_call_shutdown_functions(void);
-
-/* environment module */
-extern int php_init_environ(void);
-extern int php_shutdown_environ(void);
-
-#endif
diff --git a/main/php_memory_streams.h b/main/php_memory_streams.h
deleted file mode 100644
index 5d8c452ad0..0000000000
--- a/main/php_memory_streams.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_MEMORY_STREAM_H
-#define PHP_MEMORY_STREAM_H
-
-#include "php_streams.h"
-
-#define PHP_STREAM_MAX_MEM 2 * 1024 * 1024
-
-#define TEMP_STREAM_DEFAULT 0
-#define TEMP_STREAM_READONLY 1
-
-#define php_stream_memory_create(mode) _php_stream_memory_create((mode) STREAMS_CC TSRMLS_CC)
-#define php_stream_memory_create_rel(mode) _php_stream_memory_create((mode) STREAMS_REL_CC TSRMLS_CC)
-#define php_stream_memory_open(mode, buf, length) _php_stream_memory_open((mode), (buf), (length) STREAMS_CC TSRMLS_CC)
-#define php_stream_memory_get_buffer(stream, length) _php_stream_memory_get_buffer((stream), (length) STREAMS_CC TSRMLS_CC)
-
-#define php_stream_temp_new() php_stream_temp_create(TEMP_STREAM_DEFAULT, PHP_STREAM_MAX_MEM)
-#define php_stream_temp_create(mode, max_memory_usage) _php_stream_temp_create((mode), (max_memory_usage) STREAMS_CC TSRMLS_CC)
-#define php_stream_temp_create_rel(mode, max_memory_usage) _php_stream_temp_create((mode), (max_memory_usage) STREAMS_REL_CC TSRMLS_CC)
-#define php_stream_temp_open(mode, max_memory_usage, buf, length) _php_stream_temp_open((mode), (max_memory_usage), (buf), (length) STREAMS_CC TSRMLS_CC)
-
-
-PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC TSRMLS_DC);
-PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length STREAMS_DC TSRMLS_DC);
-PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length STREAMS_DC TSRMLS_DC);
-
-PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC TSRMLS_DC);
-PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t length STREAMS_DC TSRMLS_DC);
-
-extern php_stream_ops php_stream_memory_ops;
-extern php_stream_ops php_stream_temp_ops;
-
-#define PHP_STREAM_IS_MEMORY &php_stream_memory_ops
-#define PHP_STREAM_IS_TEMP &php_stream_temp_ops
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/php_network.h b/main/php_network.h
deleted file mode 100644
index d0bb26e7f6..0000000000
--- a/main/php_network.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Venaas <venaas@uninett.no> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _PHP_NETWORK_H
-#define _PHP_NETWORK_H
-
-#ifdef PHP_WIN32
-# ifndef WINNT
-# define WINNT 1
-# endif
-# undef FD_SETSIZE
-# include "arpa/inet.h"
-# define socklen_t unsigned int
-#else
-# undef closesocket
-# define closesocket close
-#endif
-
-#ifndef HAVE_SHUTDOWN
-#undef shutdown
-#define shutdown(s,n) /* nothing */
-#endif
-
-#ifdef PHP_WIN32
-#define EWOULDBLOCK WSAEWOULDBLOCK
-#define EINPROGRESS WSAEWOULDBLOCK
-# define fsync _commit
-# define ftruncate(a, b) chsize(a, b)
-#endif /* defined(PHP_WIN32) */
-
-#ifdef PHP_WIN32
-#define php_socket_errno() WSAGetLastError()
-#else
-#define php_socket_errno() errno
-#endif
-
-/* like strerror, but caller must efree the returned string,
- * unless buf is not NULL.
- * Also works sensibly for win32 */
-PHPAPI char *php_socket_strerror(long err, char *buf, size_t bufsize);
-
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-/* These are here, rather than with the win32 counterparts above,
- * since <sys/socket.h> defines them. */
-#ifndef SHUT_RD
-# define SHUT_RD 0
-# define SHUT_WR 1
-# define SHUT_RDWR 2
-#endif
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#ifdef HAVE_STDDEF_H
-#include <stddef.h>
-#endif
-
-#ifdef PHP_WIN32
-typedef SOCKET php_socket_t;
-#else
-typedef int php_socket_t;
-#endif
-
-#ifdef PHP_WIN32
-# define SOCK_ERR INVALID_SOCKET
-# define SOCK_CONN_ERR SOCKET_ERROR
-# define SOCK_RECV_ERR SOCKET_ERROR
-#else
-# define SOCK_ERR -1
-# define SOCK_CONN_ERR -1
-# define SOCK_RECV_ERR -1
-#endif
-
-#define PHP_SOCK_CHUNK_SIZE 8192
-
-#ifdef HAVE_SOCKADDR_STORAGE
-typedef struct sockaddr_storage php_sockaddr_storage;
-#else
-typedef struct {
-#ifdef HAVE_SOCKADDR_LEN
- unsigned char ss_len;
- unsigned char ss_family;
-#else
- unsigned short ss_family;
-#endif
- char info[126];
-} php_sockaddr_storage;
-#endif
-
-PHPAPI php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short port,
- int socktype, int asynchronous, struct timeval *timeout, char **error_string,
- int *error_code
- TSRMLS_DC);
-
-PHPAPI int php_network_connect_socket(php_socket_t sockfd,
- const struct sockaddr *addr,
- socklen_t addrlen,
- int asynchronous,
- struct timeval *timeout,
- char **error_string,
- int *error_code);
-
-#define php_connect_nonb(sock, addr, addrlen, timeout) \
- php_network_connect_socket((sock), (addr), (addrlen), 0, (timeout), NULL, NULL)
-
-PHPAPI php_socket_t php_network_bind_socket_to_local_addr(const char *host, unsigned port,
- int socktype, char **error_string, int *error_code
- TSRMLS_DC);
-
-PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock,
- char **textaddr, long *textaddrlen,
- struct sockaddr **addr,
- socklen_t *addrlen,
- struct timeval *timeout,
- char **error_string,
- int *error_code
- TSRMLS_DC);
-
-PHPAPI int php_network_get_sock_name(php_socket_t sock,
- char **textaddr, long *textaddrlen,
- struct sockaddr **addr,
- socklen_t *addrlen
- TSRMLS_DC);
-
-PHPAPI int php_network_get_peer_name(php_socket_t sock,
- char **textaddr, long *textaddrlen,
- struct sockaddr **addr,
- socklen_t *addrlen
- TSRMLS_DC);
-
-void php_any_addr(int family, php_sockaddr_storage *addr, unsigned short port);
-int php_sockaddr_size(php_sockaddr_storage *addr);
-
-
-struct _php_netstream_data_t {
- php_socket_t socket;
- char is_blocked;
- struct timeval timeout;
- char timeout_event;
- size_t ownsize;
-};
-typedef struct _php_netstream_data_t php_netstream_data_t;
-extern php_stream_ops php_stream_socket_ops;
-extern php_stream_ops php_stream_generic_socket_ops;
-#define PHP_STREAM_IS_SOCKET (&php_stream_socket_ops)
-
-PHPAPI php_stream *_php_stream_sock_open_from_socket(php_socket_t socket, const char *persistent_id STREAMS_DC TSRMLS_DC );
-/* open a connection to a host using php_hostconnect and return a stream */
-PHPAPI php_stream *_php_stream_sock_open_host(const char *host, unsigned short port,
- int socktype, struct timeval *timeout, const char *persistent_id STREAMS_DC TSRMLS_DC);
-
-#define php_stream_sock_open_from_socket(socket, persistent) _php_stream_sock_open_from_socket((socket), (persistent) STREAMS_CC TSRMLS_CC)
-#define php_stream_sock_open_host(host, port, socktype, timeout, persistent) _php_stream_sock_open_host((host), (port), (socktype), (timeout), (persistent) STREAMS_CC TSRMLS_CC)
-
-/* {{{ memory debug */
-#define php_stream_sock_open_from_socket_rel(socket, persistent) _php_stream_sock_open_from_socket((socket), (persistent) STREAMS_REL_CC TSRMLS_CC)
-#define php_stream_sock_open_host_rel(host, port, socktype, timeout, persistent) _php_stream_sock_open_host((host), (port), (socktype), (timeout), (persistent) STREAMS_REL_CC TSRMLS_CC)
-#define php_stream_sock_open_unix_rel(path, pathlen, persistent, timeval) _php_stream_sock_open_unix((path), (pathlen), (persistent), (timeval) STREAMS_REL_CC TSRMLS_CC)
-
-/* }}} */
-
-#endif /* _PHP_NETWORK_H */
-
-/*
- * Local variables:
- * tab-width: 8
- * c-basic-offset: 8
- * End:
- */
diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c
deleted file mode 100644
index 41f2560c14..0000000000
--- a/main/php_open_temporary_file.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#ifdef PHP_WIN32
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#include "win32/winutil.h"
-#elif defined(NETWARE)
-#ifdef USE_WINSOCK
-/*#include <ws2nlm.h>*/
-#include <novsock2.h>
-#else
-#include <sys/socket.h>
-#endif
-#ifdef NEW_LIBC
-#include <sys/param.h>
-#else
-#include "netware/param.h"
-#endif
-#include "netware/mktemp.h"
-#else
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-
-#if !defined(P_tmpdir)
-#define P_tmpdir ""
-#endif
-
-/* {{{ php_do_open_temporary_file */
-
-/* Loosely based on a tempnam() implementation by UCLA */
-
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-static int php_do_open_temporary_file(const char *path, const char *pfx, char **opened_path_p TSRMLS_DC)
-{
- char *trailing_slash;
- char *opened_path;
- int fd = -1;
-#ifndef HAVE_MKSTEMP
- int open_flags = O_CREAT | O_TRUNC | O_RDWR
-#ifdef PHP_WIN32
- | _O_BINARY
-#endif
- ;
-#endif
-#ifdef NETWARE
- char *file_path = NULL;
-#endif
-
- if (!path) {
- return -1;
- }
-
- if (!(opened_path = emalloc(MAXPATHLEN))) {
- return -1;
- }
-
- if (IS_SLASH(path[strlen(path)-1])) {
- trailing_slash = "";
- } else {
- trailing_slash = "/";
- }
-
- (void)snprintf(opened_path, MAXPATHLEN, "%s%s%sXXXXXX", path, trailing_slash, pfx);
-
-#ifdef PHP_WIN32
- if (GetTempFileName(path, pfx, 0, opened_path)) {
- /* Some versions of windows set the temp file to be read-only,
- * which means that opening it will fail... */
- VCWD_CHMOD(opened_path, 0600);
- fd = VCWD_OPEN_MODE(opened_path, open_flags, 0600);
- }
-#elif defined(NETWARE)
- /* Using standard mktemp() implementation for NetWare */
- file_path = mktemp(opened_path);
- if (file_path) {
- fd = VCWD_OPEN(file_path, open_flags);
- }
-#elif defined(HAVE_MKSTEMP)
- fd = mkstemp(opened_path);
-#else
- if (mktemp(opened_path)) {
- fd = VCWD_OPEN(opened_path, open_flags);
- }
-#endif
- if (fd == -1 || !opened_path_p) {
- efree(opened_path);
- } else {
- *opened_path_p = opened_path;
- }
- return fd;
-}
-/* }}} */
-
-/*
- * Determine where to place temporary files.
- */
-const char* get_temporary_directory()
-{
- /* Cache the chosen temporary directory. */
- static char* temporary_directory;
-
- /* Did we determine the temporary directory already? */
- if (temporary_directory) {
- return temporary_directory;
- }
-
-#ifdef PHP_WIN32
- /* We can't count on the environment variables TEMP or TMP,
- * and so must make the Win32 API call to get the default
- * directory for temporary files. Note this call checks
- * the environment values TMP and TEMP (in order) first.
- */
- {
- char sTemp[MAX_PATH];
- DWORD n = GetTempPath(sizeof(sTemp),sTemp);
- assert(0 < n); /* should *never* fail! */
- temporary_directory = strdup(sTemp);
- return temporary_directory;
- }
-#else
- /* On Unix use the (usual) TMPDIR environment variable. */
- {
- char* s = getenv("TMPDIR");
- if (s) {
- temporary_directory = strdup(s);
- return temporary_directory;
- }
- }
-#ifdef P_tmpdir
- /* Use the standard default temporary directory. */
- if (P_tmpdir) {
- temporary_directory = P_tmpdir;
- return temporary_directory;
- }
-#endif
- /* Shouldn't ever(!) end up here ... last ditch default. */
- temporary_directory = "/tmp";
- return temporary_directory;
-#endif
-}
-
-/* {{{ php_open_temporary_file
- *
- * Unlike tempnam(), the supplied dir argument takes precedence
- * over the TMPDIR environment variable
- * This function should do its best to return a file pointer to a newly created
- * unique file, on every platform.
- */
-PHPAPI int php_open_temporary_fd(const char *dir, const char *pfx, char **opened_path_p TSRMLS_DC)
-{
- int fd;
-
- if (!pfx) {
- pfx = "tmp.";
- }
- if (opened_path_p) {
- *opened_path_p = NULL;
- }
-
- /* Try the directory given as parameter. */
- fd = php_do_open_temporary_file(dir, pfx, opened_path_p TSRMLS_CC);
- if (fd == -1) {
- /* Use default temporary directory. */
- fd = php_do_open_temporary_file(get_temporary_directory(), pfx, opened_path_p TSRMLS_CC);
- }
- return fd;
-}
-
-PHPAPI FILE *php_open_temporary_file(const char *dir, const char *pfx, char **opened_path_p TSRMLS_DC)
-{
- FILE *fp;
- int fd = php_open_temporary_fd(dir, pfx, opened_path_p TSRMLS_CC);
-
- if (fd == -1) {
- return NULL;
- }
-
- fp = fdopen(fd, "r+b");
- if (fp == NULL) {
- close(fd);
- }
-
- return fp;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/php_open_temporary_file.h b/main/php_open_temporary_file.h
deleted file mode 100644
index ef9fb9d676..0000000000
--- a/main/php_open_temporary_file.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_OPEN_TEMPORARY_FILE_H
-#define PHP_OPEN_TEMPORARY_FILE_H
-
-PHPAPI FILE *php_open_temporary_file(const char *dir, const char *pfx, char **opened_path_p TSRMLS_DC);
-PHPAPI int php_open_temporary_fd(const char *dir, const char *pfx, char **opened_path_p TSRMLS_DC);
-
-#endif /* PHP_OPEN_TEMPORARY_FILE_H */
diff --git a/main/php_output.h b/main/php_output.h
deleted file mode 100644
index b5e1b7ad8b..0000000000
--- a/main/php_output.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_OUTPUT_H
-#define PHP_OUTPUT_H
-
-typedef void (*php_output_handler_func_t)(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC);
-
-PHPAPI void php_output_startup(void);
-PHPAPI void php_output_activate(TSRMLS_D);
-PHPAPI void php_output_set_status(zend_bool status TSRMLS_DC);
-PHPAPI void php_output_register_constants(TSRMLS_D);
-PHPAPI int php_body_write(const char *str, uint str_length TSRMLS_DC);
-PHPAPI int php_header_write(const char *str, uint str_length TSRMLS_DC);
-PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size, zend_bool erase TSRMLS_DC);
-PHPAPI int php_start_ob_buffer_named(const char *output_handler_name, uint chunk_size, zend_bool erase TSRMLS_DC);
-PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS_DC);
-PHPAPI void php_end_ob_buffers(zend_bool send_buffer TSRMLS_DC);
-PHPAPI int php_ob_get_buffer(zval *p TSRMLS_DC);
-PHPAPI int php_ob_get_length(zval *p TSRMLS_DC);
-PHPAPI void php_start_implicit_flush(TSRMLS_D);
-PHPAPI void php_end_implicit_flush(TSRMLS_D);
-PHPAPI char *php_get_output_start_filename(TSRMLS_D);
-PHPAPI int php_get_output_start_lineno(TSRMLS_D);
-PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size, char *handler_name, zend_bool erase TSRMLS_DC);
-PHPAPI int php_ob_handler_used(char *handler_name TSRMLS_DC);
-PHPAPI int php_ob_init_conflict(char *handler_new, char *handler_set TSRMLS_DC);
-PHPAPI int php_ob_get_buffer(zval *p TSRMLS_DC);
-PHPAPI int php_ob_get_length(zval *p TSRMLS_DC);
-
-PHP_FUNCTION(ob_start);
-PHP_FUNCTION(ob_flush);
-PHP_FUNCTION(ob_clean);
-PHP_FUNCTION(ob_end_flush);
-PHP_FUNCTION(ob_end_clean);
-PHP_FUNCTION(ob_get_flush);
-PHP_FUNCTION(ob_get_clean);
-PHP_FUNCTION(ob_get_contents);
-PHP_FUNCTION(ob_get_length);
-PHP_FUNCTION(ob_get_level);
-PHP_FUNCTION(ob_get_status);
-PHP_FUNCTION(ob_implicit_flush);
-PHP_FUNCTION(ob_list_handlers);
-
-typedef struct _php_ob_buffer {
- char *buffer;
- uint size;
- uint text_length;
- int block_size;
- uint chunk_size;
- int status;
- zval *output_handler;
- php_output_handler_func_t internal_output_handler;
- char *internal_output_handler_buffer;
- uint internal_output_handler_buffer_size;
- char *handler_name;
- zend_bool erase;
-} php_ob_buffer;
-
-typedef struct _php_output_globals {
- int (*php_body_write)(const char *str, uint str_length TSRMLS_DC); /* string output */
- int (*php_header_write)(const char *str, uint str_length TSRMLS_DC); /* unbuffer string output */
- php_ob_buffer active_ob_buffer;
- unsigned char implicit_flush;
- char *output_start_filename;
- int output_start_lineno;
- zend_stack ob_buffers;
- int ob_nesting_level;
- zend_bool ob_lock;
- zend_bool disable_output;
-} php_output_globals;
-
-#ifdef ZTS
-#define OG(v) TSRMG(output_globals_id, php_output_globals *, v)
-ZEND_API extern int output_globals_id;
-#else
-#define OG(v) (output_globals.v)
-ZEND_API extern php_output_globals output_globals;
-#endif
-
-#define PHP_OUTPUT_HANDLER_START (1<<0)
-#define PHP_OUTPUT_HANDLER_CONT (1<<1)
-#define PHP_OUTPUT_HANDLER_END (1<<2)
-
-#define PHP_OUTPUT_HANDLER_INTERNAL 0
-#define PHP_OUTPUT_HANDLER_USER 1
-
-PHP_FUNCTION(output_add_rewrite_var);
-PHP_FUNCTION(output_reset_rewrite_vars);
-
-
-#endif /* PHP_OUTPUT_H */
diff --git a/main/php_realpath.c b/main/php_realpath.c
deleted file mode 100644
index 8c7cef5f86..0000000000
--- a/main/php_realpath.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sander Steffann (sander@steffann.nl) |
- +----------------------------------------------------------------------+
- */
-
-#include "php.h"
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-
-#ifndef MAXSYMLINKS
-#define MAXSYMLINKS 32
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
-#endif
-
-char *php_realpath(char *path, char resolved_path[]);
-
-#ifdef PHP_WIN32
-#define IS_SLASH(p) ((p) == '/' || (p) == '\\')
-#else
-#define IS_SLASH(p) ((p) == '/')
-#endif
-
-char *php_realpath(char *path, char resolved_path []) {
- char path_construction[MAXPATHLEN]; /* We build the result in here */
- char *writepos; /* Position to write next char */
-
- char path_copy[MAXPATHLEN]; /* A work-copy of the path */
- char *workpos; /* working position in *path */
-
-#if !defined(PHP_WIN32)
- char buf[MAXPATHLEN]; /* Buffer for readlink */
- int linklength; /* The result from readlink */
-#endif
- int linkcount = 0; /* Count symlinks to avoid loops */
-
- struct stat filestat; /* result from stat */
-
-#ifdef PHP_WIN32
- char *temppos; /* position while counting '.' */
- int dotcount; /* number of '.' */
- int t; /* counter */
-#endif
-
- /* Set the work-position to the beginning of the given path */
- strcpy(path_copy, path);
- workpos = path_copy;
-
-#ifdef PHP_WIN32
- /* Find out where we start - Windows version */
- if (IS_SLASH(*workpos)) {
- /* We start at the root of the current drive */
- /* Get the current directory */
- if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- /* We only need the first three chars (for example "C:\") */
- path_construction[3] = 0;
- workpos++;
- } else if (workpos[1] == ':') {
- /* A drive-letter is specified, copy it */
- strncpy(path_construction, path, 2);
- strcat(path_construction, "\\");
- workpos++;
- workpos++;
- } else {
- /* Use the current directory */
- if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- strcat(path_construction, "\\");
- }
-#else
- /* Find out where we start - Unix version */
- if (*workpos == '/') {
- /* We start at the root */
- strcpy(path_construction, "/");
- workpos++;
- } else {
- /* Use the current directory */
- if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- strcat(path_construction, "/");
- }
-#endif
-
- /* Set the next-char-position */
- writepos = &path_construction[strlen(path_construction)];
-
- /* Go to the end, then stop */
- while(*workpos != 0) {
- /* Strip (back)slashes */
- while(IS_SLASH(*workpos)) workpos++;
-
-#ifdef PHP_WIN32
- /* reset dotcount */
- dotcount = 0;
-
- /* Look for .. */
- if ((workpos[0] == '.') && (workpos[1] != 0)) {
- /* Windows accepts \...\ as \..\..\, \....\ as \..\..\..\, etc */
- /* At least Win98 does */
-
- temppos = workpos;
- while(*temppos++ == '.') {
- dotcount++;
- if (!IS_SLASH(*temppos) && (*temppos != 0) && (*temppos != '.')) {
- /* This is not a /../ component, but a filename that starts with '.' */
- dotcount = 0;
- }
- }
-
- /* Go back dotcount-1 times */
- for (t=0 ; t<(dotcount-1) ; t++) {
- workpos++; /* move to next '.' */
-
- /* Can we still go back? */
- if ((writepos-3) <= path_construction) return NULL;
-
- /* Go back */
- writepos--; /* move to '\' */
- writepos--;
- while(!IS_SLASH(*writepos)) writepos--; /* skip until previous '\\' */
- }
- workpos++;
- }
-
- /* No special case */
- if (dotcount == 0) {
- /* Append */
- while(!IS_SLASH(*workpos) && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
-
- /* Just one '.', go to next element */
- if (dotcount == 1) {
- while(!IS_SLASH(*workpos) && (*workpos != 0)) {
- *workpos++;
- }
-
- /* Avoid double \ in the result */
- writepos--;
- }
-
- /* If it was a directory, append a slash */
- if (IS_SLASH(*workpos)) {
- *writepos++ = *workpos++;
- }
- *writepos = 0;
-#else /* defined(PHP_WIN32) */
- /* Look for .. */
- if ((workpos[0] == '.') && (workpos[1] != 0)) {
- if ((workpos[1] == '.') && ((workpos[2] == '/') || (workpos[2] == 0))) {
- /* One directory back */
- /* Set pointers to right position */
- workpos++; /* move to second '.' */
- workpos++; /* move to '/' */
-
- /* Only apply .. if not in root */
- if ((writepos-1) > path_construction) {
- writepos--; /* move to '/' */
- while(*--writepos != '/') ; /* skip until previous '/' */
- }
- } else {
- if (workpos[1] == '/') {
- /* Found a /./ skip it */
- workpos++; /* move to '/' */
-
- /* Avoid double / in the result */
- writepos--;
- } else {
- /* No special case, the name just started with a . */
- /* Append */
- while((*workpos != '/') && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
- }
- } else {
- /* No special case */
- /* Append */
- while((*workpos != '/') && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
-
-#if HAVE_SYMLINK
- /* We are going to use path_construction, so close it */
- *writepos = 0;
-
- /* Check the current location to see if it is a symlink */
- if((linklength = readlink(path_construction, buf, MAXPATHLEN)) != -1) {
- /* Check linkcount */
- if (linkcount > MAXSYMLINKS) return NULL;
-
- /* Count this symlink */
- linkcount++;
-
- /* Set end of buf */
- buf[linklength] = 0;
-
- /* Check for overflow */
- if ((strlen(workpos) + strlen(buf) + 1) >= MAXPATHLEN) return NULL;
-
- /* Remove the symlink-component wrom path_construction */
- writepos--; /* move to '/' */
- while(*--writepos != '/') ; /* skip until previous '/' */
- *++writepos = 0; /* end of string after '/' */
-
- /* If the symlink starts with a '/', empty path_construction */
- if (*buf == '/') {
- *path_construction = 0;
- writepos = path_construction;
- }
-
- /* Insert symlink into path_copy */
- strcat(buf, workpos);
- strcpy(path_copy, buf);
- workpos = path_copy;
- }
-#endif /* HAVE_SYMLINK */
-
- /* If it was a directory, append a slash */
- if (*workpos == '/') {
- *writepos++ = *workpos++;
- }
- *writepos = 0;
-#endif /* defined(PHP_WIN32) */
- }
-
- /* Check if the resolved path is a directory */
- if (V_STAT(path_construction, &filestat) != 0) {
- if (errno != ENOENT) return NULL;
- } else {
- if (S_ISDIR(filestat.st_mode)) {
- /* It's a directory, append a / if needed */
- if (*(writepos-1) != '/') {
- /* Check for overflow */
- if ((strlen(workpos) + 2) >= MAXPATHLEN) {
- return NULL;
- }
- *writepos++ = '/';
- *writepos = 0;
- }
- }
- }
-
- strcpy(resolved_path, path_construction);
- return resolved_path;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_reentrancy.h b/main/php_reentrancy.h
deleted file mode 100644
index d888c59622..0000000000
--- a/main/php_reentrancy.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_REENTRANCY_H
-#define PHP_REENTRANCY_H
-
-#include "php.h"
-
-#include <sys/types.h>
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-#include <time.h>
-
-/* currently, PHP does not check for these functions, but assumes
- that they are available on all systems. */
-
-#define HAVE_LOCALTIME 1
-#define HAVE_GMTIME 1
-#define HAVE_ASCTIME 1
-#define HAVE_CTIME 1
-
-#if defined(PHP_IRIX_TIME_R)
-#undef HAVE_ASCTIME_R
-#undef HAVE_CTIME_R
-#endif
-
-#if defined(PHP_HPUX_TIME_R)
-#undef HAVE_LOCALTIME_R
-#undef HAVE_ASCTIME_R
-#undef HAVE_CTIME_R
-#undef HAVE_GMTIME_R
-#endif
-
-#if defined(HAVE_POSIX_READDIR_R)
-#define php_readdir_r readdir_r
-#else
-PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry,
- struct dirent **result);
-#endif
-
-#if !defined(HAVE_LOCALTIME_R) && defined(HAVE_LOCALTIME)
-#define PHP_NEED_REENTRANCY 1
-PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm);
-#else
-#define php_localtime_r localtime_r
-#ifdef MISSING_LOCALTIME_R_DECL
-struct tm *localtime_r(const time_t *const timep, struct tm *p_tm);
-#endif
-#endif
-
-
-#if !defined(HAVE_CTIME_R) && defined(HAVE_CTIME)
-#define PHP_NEED_REENTRANCY 1
-PHPAPI char *php_ctime_r(const time_t *clock, char *buf);
-#else
-#define php_ctime_r ctime_r
-#ifdef MISSING_CTIME_R_DECL
-char *ctime_r(const time_t *clock, char *buf);
-#endif
-#endif
-
-
-#if !defined(HAVE_ASCTIME_R) && defined(HAVE_ASCTIME)
-#define PHP_NEED_REENTRANCY 1
-PHPAPI char *php_asctime_r(const struct tm *tm, char *buf);
-#else
-#define php_asctime_r asctime_r
-#ifdef MISSING_ASCTIME_R_DECL
-char *asctime_r(const struct tm *tm, char *buf);
-#endif
-#endif
-
-
-#if !defined(HAVE_GMTIME_R) && defined(HAVE_GMTIME) || defined(__BEOS__)
-#define PHP_NEED_REENTRANCY 1
-PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm);
-#else
-#define php_gmtime_r gmtime_r
-#ifdef MISSING_GMTIME_R_DECL
-struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm);
-#endif
-#endif
-
-#if !defined(HAVE_STRTOK_R)
-PHPAPI char *php_strtok_r(char *s, const char *delim, char **last);
-#else
-#define php_strtok_r strtok_r
-#ifdef MISSING_STRTOK_R_DECL
-char *strtok_r(char *s, const char *delim, char **last);
-#endif
-#endif
-
-#if !defined(HAVE_RAND_R)
-PHPAPI int php_rand_r(unsigned int *seed);
-#else
-#define php_rand_r rand_r
-#endif
-
-#if !defined(ZTS)
-#undef PHP_NEED_REENTRANCY
-#endif
-
-#if defined(PHP_NEED_REENTRANCY)
-void reentrancy_startup(void);
-void reentrancy_shutdown(void);
-#else
-#define reentrancy_startup()
-#define reentrancy_shutdown()
-#endif
-
-#endif
diff --git a/main/php_regex.h b/main/php_regex.h
deleted file mode 100644
index b573745797..0000000000
--- a/main/php_regex.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_REGEX_H
-#define PHP_REGEX_H
-
-/*
- * REGEX means:
- * 0.. system regex
- * 1.. bundled regex
- */
-
-#if REGEX
-/* get aliases */
-#include "regex/regex_extra.h"
-#include "regex/regex.h"
-
-/* get rid of aliases */
-#define PHP_NO_ALIASES
-#include "regex/regex_extra.h"
-#undef PHP_NO_ALIASES
-
-#undef _PCREPOSIX_H
-#define _PCREPOSIX_H 1
-
-#ifndef _REGEX_H
-#define _REGEX_H 1 /* this should stop Apache from loading the system version of regex.h */
-#endif
-#ifndef _REGEX_H_
-#define _REGEX_H_ 1
-#endif
-#ifndef _RX_H
-#define _RX_H 1 /* Try defining these for Linux to */
-#endif
-#ifndef __REGEXP_LIBRARY_H__
-#define __REGEXP_LIBRARY_H__ 1 /* avoid Apache including regex.h */
-#endif
-#ifndef _H_REGEX
-#define _H_REGEX 1 /* This one is for AIX */
-#endif
-#elif REGEX == 0
-#include <regex.h>
-#ifndef _REGEX_H_
-#define _REGEX_H_ 1
-#endif
-#endif
-
-#endif /* PHP_REGEX_H */
diff --git a/main/php_scandir.c b/main/php_scandir.c
deleted file mode 100644
index 139e1c27cb..0000000000
--- a/main/php_scandir.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Shane Caraveo <shane@caraveo.com> |
- | Ilia Alshanetsky <ilia@prohost.org> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef PHP_WIN32
-#include "config.w32.h"
-#else
-#include "php_config.h"
-#endif
-
-#include "php_scandir.h"
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#ifndef HAVE_SCANDIR
-
-#ifdef PHP_WIN32
-#include "win32/readdir.h"
-#endif
-
-#include <stdlib.h>
-#include <search.h>
-
-#endif /* HAVE_SCANDIR */
-
-#ifndef HAVE_ALPHASORT
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-int php_alphasort(const struct dirent **a, const struct dirent **b)
-{
- return strcoll((*a)->d_name,(*b)->d_name);
-}
-#endif /* HAVE_ALPHASORT */
-
-#ifndef HAVE_SCANDIR
-int php_scandir(const char *dirname, struct dirent **namelist[], int (*selector) (const struct dirent *entry), int (*compare) (const struct dirent **a, const struct dirent **b))
-{
- DIR *dirp = NULL;
- struct dirent **vector = NULL;
- struct dirent *dp = NULL;
- int vector_size = 0;
- int nfiles = 0;
-
- if (namelist == NULL) {
- return -1;
- }
-
- if (!(dirp = opendir(dirname))) {
- return -1;
- }
-
- while ((dp = readdir(dirp)) != NULL) {
- int dsize = 0;
- struct dirent *newdp = NULL;
-
- if (selector && (*selector)(dp) == 0) {
- continue;
- }
-
- if (nfiles == vector_size) {
- struct dirent **newv;
- if (vector_size == 0) {
- vector_size = 10;
- } else {
- vector_size *= 2;
- }
-
- newv = (struct dirent **) realloc (vector, vector_size * sizeof (struct dirent *));
- if (!newv) {
- return -1;
- }
- vector = newv;
- }
-
- dsize = sizeof (struct dirent) + ((strlen(dp->d_name) + 1) * sizeof(char));
- newdp = (struct dirent *) malloc(dsize);
-
- if (newdp == NULL) {
- goto fail;
- }
-
- vector[nfiles++] = (struct dirent *) memcpy(newdp, dp, dsize);
- }
-
- closedir(dirp);
-
- *namelist = vector;
-
- if (compare) {
- qsort (*namelist, nfiles, sizeof(struct dirent *), compare);
- }
-
- return nfiles;
-
-fail:
- while (nfiles-- > 0) {
- free(vector[nfiles]);
- }
- free(vector);
- return -1;
-}
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/php_scandir.h b/main/php_scandir.h
deleted file mode 100644
index 961188e7ad..0000000000
--- a/main/php_scandir.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Shane Caraveo <shane@caraveo.com> |
- | Ilia Alshanetsky <ilia@prohost.org> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SCANDIR_H
-#define PHP_SCANDIR_H
-
-#include <sys/types.h>
-
-#ifdef PHP_WIN32
-#include "config.w32.h"
-#include "win32/readdir.h"
-#else
-#include "php_config.h"
-#endif
-
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#ifdef HAVE_SCANDIR
-#define php_scandir scandir
-#else
-int php_scandir(const char *dirname, struct dirent **namelist[], int (*selector) (const struct dirent *entry), int (*compare) (const struct dirent **a, const struct dirent **b));
-#endif
-
-#ifdef HAVE_ALPHASORT
-#define php_alphasort alphasort
-#else
-int php_alphasort(const struct dirent **a, const struct dirent **b);
-#endif
-
-#endif /* PHP_SCANDIR_H */
diff --git a/main/php_sprintf.c b/main/php_sprintf.c
deleted file mode 100644
index e3fdb00531..0000000000
--- a/main/php_sprintf.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jaakko Hyvätti <jaakko.hyvatti@iki.fi> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdio.h>
-#include <stdarg.h>
-#ifdef NETWARE
-#include "config.nw.h"
-#else
-#include "php_config.h"
-#endif
-
-#if PHP_BROKEN_SPRINTF
-
-int
-php_sprintf (char*s, const char* format, ...)
-{
- va_list args;
- char *ret;
-
- va_start (args, format);
- s[0] = '\0';
- ret = vsprintf (s, format, args);
- va_end (args);
- if (!ret)
- return -1;
- return strlen (s);
-}
-
-#endif /* PHP_BROKEN_SPRINTF */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/php_streams.h b/main/php_streams.h
deleted file mode 100755
index 72638379b6..0000000000
--- a/main/php_streams.h
+++ /dev/null
@@ -1,495 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong (wez@thebrainroom.com) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_STREAMS_H
-#define PHP_STREAMS_H
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include <sys/types.h>
-#include <sys/stat.h>
-
-PHPAPI int php_file_le_stream(void);
-PHPAPI int php_file_le_pstream(void);
-
-/* {{{ Streams memory debugging stuff */
-
-#if ZEND_DEBUG
-/* these have more of a dependency on the definitions of the zend macros than
- * I would prefer, but doing it this way saves loads of idefs :-/ */
-# define STREAMS_D int __php_stream_call_depth ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC
-# define STREAMS_C 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC
-# define STREAMS_REL_C __php_stream_call_depth + 1 ZEND_FILE_LINE_CC, \
- __php_stream_call_depth ? __zend_orig_filename : __zend_filename, \
- __php_stream_call_depth ? __zend_orig_lineno : __zend_lineno
-
-# define STREAMS_DC , STREAMS_D
-# define STREAMS_CC , STREAMS_C
-# define STREAMS_REL_CC , STREAMS_REL_C
-
-#else
-# define STREAMS_D
-# define STREAMS_C
-# define STREAMS_REL_C
-# define STREAMS_DC
-# define STREAMS_CC
-# define STREAMS_REL_CC
-#endif
-
-/* these functions relay the file/line number information. They are depth aware, so they will pass
- * the ultimate ancestor, which is useful, because there can be several layers of calls */
-#define php_stream_alloc_rel(ops, thisptr, persistent, mode) _php_stream_alloc((ops), (thisptr), (persistent), (mode) STREAMS_REL_CC TSRMLS_CC)
-
-#define php_stream_copy_to_mem_rel(src, buf, maxlen, persistent) _php_stream_copy_to_mem((src), (buf), (maxlen), (persistent) STREAMS_REL_CC TSRMLS_CC)
-
-#define php_stream_fopen_rel(filename, mode, opened, options) _php_stream_fopen((filename), (mode), (opened), (options) STREAMS_REL_CC TSRMLS_CC)
-
-#define php_stream_fopen_with_path_rel(filename, mode, path, opened, options) _php_stream_fopen_with_path((filename), (mode), (path), (opened), (options) STREAMS_REL_CC TSRMLS_CC)
-
-#define php_stream_fopen_from_fd_rel(fd, mode, persistent_id) _php_stream_fopen_from_fd((fd), (mode), (persistent_id) STREAMS_REL_CC TSRMLS_CC)
-#define php_stream_fopen_from_file_rel(file, mode) _php_stream_fopen_from_file((file), (mode) STREAMS_REL_CC TSRMLS_CC)
-
-#define php_stream_fopen_from_pipe_rel(file, mode) _php_stream_fopen_from_pipe((file), (mode) STREAMS_REL_CC TSRMLS_CC)
-
-#define php_stream_fopen_tmpfile_rel() _php_stream_fopen_tmpfile(0 STREAMS_REL_CC TSRMLS_CC)
-
-#define php_stream_fopen_temporary_file_rel(dir, pfx, opened_path) _php_stream_fopen_temporary_file((dir), (pfx), (opened_path) STREAMS_REL_CC TSRMLS_CC)
-
-#define php_stream_open_wrapper_rel(path, mode, options, opened) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL STREAMS_REL_CC TSRMLS_CC)
-#define php_stream_open_wrapper_ex_rel(path, mode, options, opened, context) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), (context) STREAMS_REL_CC TSRMLS_CC)
-
-#define php_stream_make_seekable_rel(origstream, newstream, flags) _php_stream_make_seekable((origstream), (newstream), (flags) STREAMS_REL_CC TSRMLS_CC)
-
-/* }}} */
-
-/* The contents of the php_stream_ops and php_stream should only be accessed
- * using the functions/macros in this header.
- * If you need to get at something that doesn't have an API,
- * drop me a line <wez@thebrainroom.com> and we can sort out a way to do
- * it properly.
- *
- * The only exceptions to this rule are that stream implementations can use
- * the php_stream->abstract pointer to hold their context, and streams
- * opened via stream_open_wrappers can use the zval ptr in
- * php_stream->wrapperdata to hold meta data for php scripts to
- * retrieve using file_get_wrapper_data(). */
-
-typedef struct _php_stream php_stream;
-typedef struct _php_stream_wrapper php_stream_wrapper;
-typedef struct _php_stream_context php_stream_context;
-typedef struct _php_stream_filter php_stream_filter;
-
-#include "streams/php_stream_context.h"
-#include "streams/php_stream_filter_api.h"
-
-typedef struct _php_stream_statbuf {
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- struct stat_libc sb; /* regular info */
-#else
- struct stat sb; /* regular info */
-#endif
- /* extended info to go here some day: content-type etc. etc. */
-} php_stream_statbuf;
-
-typedef struct _php_stream_dirent {
- char d_name[MAXPATHLEN];
-} php_stream_dirent;
-
-/* operations on streams that are file-handles */
-typedef struct _php_stream_ops {
- /* stdio like functions - these are mandatory! */
- size_t (*write)(php_stream *stream, const char *buf, size_t count TSRMLS_DC);
- size_t (*read)(php_stream *stream, char *buf, size_t count TSRMLS_DC);
- int (*close)(php_stream *stream, int close_handle TSRMLS_DC);
- int (*flush)(php_stream *stream TSRMLS_DC);
-
- const char *label; /* label for this ops structure */
-
- /* these are optional */
- int (*seek)(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC);
- int (*cast)(php_stream *stream, int castas, void **ret TSRMLS_DC);
- int (*stat)(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC);
- int (*set_option)(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC);
-} php_stream_ops;
-
-typedef struct _php_stream_wrapper_ops {
- /* open/create a wrapped stream */
- php_stream *(*stream_opener)(php_stream_wrapper *wrapper, char *filename, char *mode,
- int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
- /* close/destroy a wrapped stream */
- int (*stream_closer)(php_stream_wrapper *wrapper, php_stream *stream TSRMLS_DC);
- /* stat a wrapped stream */
- int (*stream_stat)(php_stream_wrapper *wrapper, php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC);
- /* stat a URL */
- int (*url_stat)(php_stream_wrapper *wrapper, char *url, php_stream_statbuf *ssb TSRMLS_DC);
- /* open a "directory" stream */
- php_stream *(*dir_opener)(php_stream_wrapper *wrapper, char *filename, char *mode,
- int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
-
- const char *label;
-
- /* delete a file */
- int (*unlink)(php_stream_wrapper *wrapper, char *url, php_stream_context *context TSRMLS_DC);
-} php_stream_wrapper_ops;
-
-struct _php_stream_wrapper {
- php_stream_wrapper_ops *wops; /* operations the wrapper can perform */
- void *abstract; /* context for the wrapper */
- int is_url; /* so that PG(allow_url_fopen) can be respected */
-
- /* support for wrappers to return (multiple) error messages to the stream opener */
- int err_count;
- char **err_stack;
-};
-
-#define PHP_STREAM_FLAG_NO_SEEK 1
-#define PHP_STREAM_FLAG_NO_BUFFER 2
-
-#define PHP_STREAM_FLAG_EOL_UNIX 0 /* also includes DOS */
-#define PHP_STREAM_FLAG_DETECT_EOL 4
-#define PHP_STREAM_FLAG_EOL_MAC 8
-
-/* set this when the stream might represent "interactive" data.
- * When set, the read buffer will avoid certain operations that
- * might otherwise cause the read to block for much longer than
- * is strictly required. */
-#define PHP_STREAM_FLAG_AVOID_BLOCKING 16
-
-struct _php_stream {
- php_stream_ops *ops;
- void *abstract; /* convenience pointer for abstraction */
-
- php_stream_filter_chain readfilters, writefilters;
-
- php_stream_wrapper *wrapper; /* which wrapper was used to open the stream */
- void *wrapperthis; /* convenience pointer for a instance of a wrapper */
- zval *wrapperdata; /* fgetwrapperdata retrieves this */
-
- int fgetss_state; /* for fgetss to handle multiline tags */
- int is_persistent;
- char mode[16]; /* "rwb" etc. ala stdio */
- int rsrc_id; /* used for auto-cleanup */
- int in_free; /* to prevent recursion during free */
- /* so we know how to clean it up correctly. This should be set to
- * PHP_STREAM_FCLOSE_XXX as appropriate */
- int fclose_stdiocast;
- FILE *stdiocast; /* cache this, otherwise we might leak! */
-#if ZEND_DEBUG
- int __exposed; /* non-zero if exposed as a zval somewhere */
- char *__orig_path; /* it really helps when debugging "unclosed" streams */
-#endif
-
- php_stream_context *context;
- int flags; /* PHP_STREAM_FLAG_XXX */
-
- /* buffer */
- off_t position; /* of underlying stream */
- unsigned char *readbuf;
- size_t readbuflen;
- off_t readpos;
- off_t writepos;
-
- /* how much data to read when filling buffer */
- size_t chunk_size;
-
- int eof;
-
-}; /* php_stream */
-/* state definitions when closing down; these are private to streams.c */
-#define PHP_STREAM_FCLOSE_NONE 0
-#define PHP_STREAM_FCLOSE_FDOPEN 1
-#define PHP_STREAM_FCLOSE_FOPENCOOKIE 2
-
-/* allocate a new stream for a particular ops */
-PHPAPI php_stream *_php_stream_alloc(php_stream_ops *ops, void *abstract,
- const char *persistent_id, const char *mode STREAMS_DC TSRMLS_DC);
-#define php_stream_alloc(ops, thisptr, persistent_id, mode) _php_stream_alloc((ops), (thisptr), (persistent_id), (mode) STREAMS_CC TSRMLS_CC)
-
-
-#define php_stream_get_resource_id(stream) (stream)->rsrc_id
-#if ZEND_DEBUG
-/* use this to tell the stream that it is OK if we don't explicitly close it */
-# define php_stream_auto_cleanup(stream) { (stream)->__exposed++; }
-/* use this to assign the stream to a zval and tell the stream that is
- * has been exported to the engine; it will expect to be closed automatically
- * when the resources are auto-destructed */
-# define php_stream_to_zval(stream, zval) { ZVAL_RESOURCE(zval, (stream)->rsrc_id); (stream)->__exposed++; }
-#else
-# define php_stream_auto_cleanup(stream) /* nothing */
-# define php_stream_to_zval(stream, zval) { ZVAL_RESOURCE(zval, (stream)->rsrc_id); }
-#endif
-
-#define php_stream_from_zval(xstr, ppzval) ZEND_FETCH_RESOURCE2((xstr), php_stream *, (ppzval), -1, "stream", php_file_le_stream(), php_file_le_pstream())
-#define php_stream_from_zval_no_verify(xstr, ppzval) (xstr) = (php_stream*)zend_fetch_resource((ppzval) TSRMLS_CC, -1, "stream", NULL, 2, php_file_le_stream(), php_file_le_pstream())
-
-PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream **stream TSRMLS_DC);
-#define PHP_STREAM_PERSISTENT_SUCCESS 0 /* id exists */
-#define PHP_STREAM_PERSISTENT_FAILURE 1 /* id exists but is not a stream! */
-#define PHP_STREAM_PERSISTENT_NOT_EXIST 2 /* id does not exist */
-
-#define PHP_STREAM_FREE_CALL_DTOR 1 /* call ops->close */
-#define PHP_STREAM_FREE_RELEASE_STREAM 2 /* pefree(stream) */
-#define PHP_STREAM_FREE_PRESERVE_HANDLE 4 /* tell ops->close to not close it's underlying handle */
-#define PHP_STREAM_FREE_RSRC_DTOR 8 /* called from the resource list dtor */
-#define PHP_STREAM_FREE_CLOSE (PHP_STREAM_FREE_CALL_DTOR | PHP_STREAM_FREE_RELEASE_STREAM)
-#define PHP_STREAM_FREE_CLOSE_CASTED (PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_PRESERVE_HANDLE)
-PHPAPI int _php_stream_free(php_stream *stream, int close_options TSRMLS_DC);
-#define php_stream_free(stream, close_options) _php_stream_free((stream), (close_options) TSRMLS_CC)
-#define php_stream_close(stream) _php_stream_free((stream), PHP_STREAM_FREE_CLOSE TSRMLS_CC)
-
-PHPAPI int _php_stream_seek(php_stream *stream, off_t offset, int whence TSRMLS_DC);
-#define php_stream_rewind(stream) _php_stream_seek((stream), 0L, SEEK_SET TSRMLS_CC)
-#define php_stream_seek(stream, offset, whence) _php_stream_seek((stream), (offset), (whence) TSRMLS_CC)
-
-PHPAPI off_t _php_stream_tell(php_stream *stream TSRMLS_DC);
-#define php_stream_tell(stream) _php_stream_tell((stream) TSRMLS_CC)
-
-PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC);
-#define php_stream_read(stream, buf, count) _php_stream_read((stream), (buf), (count) TSRMLS_CC)
-
-PHPAPI size_t _php_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC);
-#define php_stream_write_string(stream, str) _php_stream_write(stream, str, strlen(str) TSRMLS_CC)
-#define php_stream_write(stream, buf, count) _php_stream_write(stream, (buf), (count) TSRMLS_CC)
-
-PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char *fmt, ...);
-/* php_stream_printf macro & function require TSRMLS_CC */
-#define php_stream_printf _php_stream_printf
-
-PHPAPI int _php_stream_eof(php_stream *stream TSRMLS_DC);
-#define php_stream_eof(stream) _php_stream_eof((stream) TSRMLS_CC)
-
-PHPAPI int _php_stream_getc(php_stream *stream TSRMLS_DC);
-#define php_stream_getc(stream) _php_stream_getc((stream) TSRMLS_CC)
-
-PHPAPI int _php_stream_putc(php_stream *stream, int c TSRMLS_DC);
-#define php_stream_putc(stream, c) _php_stream_putc((stream), (c) TSRMLS_CC)
-
-PHPAPI int _php_stream_flush(php_stream *stream, int closing TSRMLS_DC);
-#define php_stream_flush(stream) _php_stream_flush((stream), 0 TSRMLS_CC)
-
-PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, size_t *returned_len TSRMLS_DC);
-#define php_stream_gets(stream, buf, maxlen) _php_stream_get_line((stream), (buf), (maxlen), NULL TSRMLS_CC)
-
-#define php_stream_get_line(stream, buf, maxlen, retlen) _php_stream_get_line((stream), (buf), (maxlen), (retlen) TSRMLS_CC)
-PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *returned_len, char *delim, size_t delim_len TSRMLS_DC);
-
-/* CAREFUL! this is equivalent to puts NOT fputs! */
-PHPAPI int _php_stream_puts(php_stream *stream, char *buf TSRMLS_DC);
-#define php_stream_puts(stream, buf) _php_stream_puts((stream), (buf) TSRMLS_CC)
-
-PHPAPI int _php_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC);
-#define php_stream_stat(stream, ssb) _php_stream_stat((stream), (ssb) TSRMLS_CC)
-
-PHPAPI int _php_stream_stat_path(char *path, php_stream_statbuf *ssb TSRMLS_DC);
-#define php_stream_stat_path(path, ssb) _php_stream_stat_path((path), (ssb) TSRMLS_CC)
-
-PHPAPI php_stream *_php_stream_opendir(char *path, int options, php_stream_context *context STREAMS_DC TSRMLS_DC);
-#define php_stream_opendir(path, options, context) _php_stream_opendir((path), (options), (context) STREAMS_CC TSRMLS_CC)
-PHPAPI php_stream_dirent *_php_stream_readdir(php_stream *dirstream, php_stream_dirent *ent TSRMLS_DC);
-#define php_stream_readdir(dirstream, dirent) _php_stream_readdir((dirstream), (dirent) TSRMLS_CC)
-#define php_stream_closedir(dirstream) php_stream_close((dirstream))
-#define php_stream_rewinddir(dirstream) php_stream_rewind((dirstream))
-
-PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC);
-#define php_stream_set_option(stream, option, value, ptrvalue) _php_stream_set_option((stream), (option), (value), (ptrvalue) TSRMLS_CC)
-
-#define php_stream_set_chunk_size(stream, size) _php_stream_set_option((stream), PHP_STREAM_OPTION_SET_CHUNK_SIZE, (size), NULL TSRMLS_CC)
-
-/* change the blocking mode of stream: value == 1 => blocking, value == 0 => non-blocking. */
-#define PHP_STREAM_OPTION_BLOCKING 1
-
-/* change the buffering mode of stream. value is a PHP_STREAM_BUFFER_XXXX value, ptrparam is a ptr to a size_t holding
- * the required buffer size */
-#define PHP_STREAM_OPTION_READ_BUFFER 2
-#define PHP_STREAM_OPTION_WRITE_BUFFER 3
-
-#define PHP_STREAM_BUFFER_NONE 0 /* unbuffered */
-#define PHP_STREAM_BUFFER_LINE 1 /* line buffered */
-#define PHP_STREAM_BUFFER_FULL 2 /* fully buffered */
-
-/* set the timeout duration for reads on the stream. ptrparam is a pointer to a struct timeval * */
-#define PHP_STREAM_OPTION_READ_TIMEOUT 4
-#define PHP_STREAM_OPTION_SET_CHUNK_SIZE 5
-
-/* set or release lock on a stream */
-#define PHP_STREAM_OPTION_LOCKING 6
-
-/* whether or not locking is supported */
-#define PHP_STREAM_LOCK_SUPPORTED 1
-
-#define php_stream_supports_lock(stream) _php_stream_set_option((stream), PHP_STREAM_OPTION_LOCKING, 0, (void *) PHP_STREAM_LOCK_SUPPORTED TSRMLS_CC) == 0 ? 1 : 0
-#define php_stream_lock(stream, mode) _php_stream_set_option((stream), PHP_STREAM_OPTION_LOCKING, (mode), (void *) NULL TSRMLS_CC)
-
-/* option code used by the php_stream_xport_XXX api */
-#define PHP_STREAM_OPTION_XPORT_API 7 /* see php_stream_transport.h */
-#define PHP_STREAM_OPTION_CRYPTO_API 8 /* see php_stream_transport.h */
-#define PHP_STREAM_OPTION_MMAP_API 9 /* see php_stream_mmap.h */
-#define PHP_STREAM_OPTION_TRUNCATE_API 10
-
-#define PHP_STREAM_TRUNCATE_SUPPORTED 0
-#define PHP_STREAM_TRUNCATE_SET_SIZE 1 /* ptrparam is a pointer to a size_t */
-
-#define php_stream_truncate_supported(stream) (_php_stream_set_option((stream), PHP_STREAM_OPTION_TRUNCATE_API, PHP_STREAM_TRUNCATE_SUPPORTED, NULL TSRMLS_CC) == PHP_STREAM_OPTION_RETURN_OK ? 1 : 0)
-
-PHPAPI int _php_stream_truncate_set_size(php_stream *stream, size_t newsize TSRMLS_DC);
-#define php_stream_truncate_set_size(stream, size) _php_stream_truncate_set_size((stream), (size) TSRMLS_CC)
-
-#define PHP_STREAM_OPTION_META_DATA_API 11 /* ptrparam is a zval* to which to add meta data information */
-#define php_stream_populate_meta_data(stream, zv) (_php_stream_set_option((stream), PHP_STREAM_OPTION_META_DATA_API, 0, zv TSRMLS_CC) == PHP_STREAM_OPTION_RETURN_OK ? 1 : 0)
-
-#define PHP_STREAM_OPTION_RETURN_OK 0 /* option set OK */
-#define PHP_STREAM_OPTION_RETURN_ERR -1 /* problem setting option */
-#define PHP_STREAM_OPTION_RETURN_NOTIMPL -2 /* underlying stream does not implement; streams can handle it instead */
-
-/* copy up to maxlen bytes from src to dest. If maxlen is PHP_STREAM_COPY_ALL, copy until eof(src).
- * Uses mmap if the src is a plain file and at offset 0 */
-#define PHP_STREAM_COPY_ALL -1
-PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen STREAMS_DC TSRMLS_DC);
-#define php_stream_copy_to_stream(src, dest, maxlen) _php_stream_copy_to_stream((src), (dest), (maxlen) STREAMS_CC TSRMLS_CC)
-
-
-/* read all data from stream and put into a buffer. Caller must free buffer when done.
- * The copy will use mmap if available. */
-PHPAPI size_t _php_stream_copy_to_mem(php_stream *src, char **buf, size_t maxlen,
- int persistent STREAMS_DC TSRMLS_DC);
-#define php_stream_copy_to_mem(src, buf, maxlen, persistent) _php_stream_copy_to_mem((src), (buf), (maxlen), (persistent) STREAMS_CC TSRMLS_CC)
-
-/* output all data from a stream */
-PHPAPI size_t _php_stream_passthru(php_stream * src STREAMS_DC TSRMLS_DC);
-#define php_stream_passthru(stream) _php_stream_passthru((stream) STREAMS_CC TSRMLS_CC)
-
-#include "streams/php_stream_transport.h"
-#include "streams/php_stream_plain_wrapper.h"
-#include "streams/php_stream_userspace.h"
-#include "streams/php_stream_mmap.h"
-
-/* coerce the stream into some other form */
-/* cast as a stdio FILE * */
-#define PHP_STREAM_AS_STDIO 0
-/* cast as a POSIX fd or socketd */
-#define PHP_STREAM_AS_FD 1
-/* cast as a socketd */
-#define PHP_STREAM_AS_SOCKETD 2
-
-/* try really, really hard to make sure the cast happens (avoid using this flag if possible) */
-#define PHP_STREAM_CAST_TRY_HARD 0x80000000
-#define PHP_STREAM_CAST_RELEASE 0x40000000 /* stream becomes invalid on success */
-#define PHP_STREAM_CAST_INTERNAL 0x20000000 /* stream cast for internal use */
-#define PHP_STREAM_CAST_MASK (PHP_STREAM_CAST_TRY_HARD | PHP_STREAM_CAST_RELEASE | PHP_STREAM_CAST_INTERNAL)
-PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show_err TSRMLS_DC);
-/* use this to check if a stream can be cast into another form */
-#define php_stream_can_cast(stream, as) _php_stream_cast((stream), (as), NULL, 0 TSRMLS_CC)
-#define php_stream_cast(stream, as, ret, show_err) _php_stream_cast((stream), (as), (ret), (show_err) TSRMLS_CC)
-
-/* use this to check if a stream is of a particular type:
- * PHPAPI int php_stream_is(php_stream *stream, php_stream_ops *ops); */
-#define php_stream_is(stream, anops) ((stream)->ops == anops)
-#define PHP_STREAM_IS_STDIO &php_stream_stdio_ops
-
-#define php_stream_is_persistent(stream) (stream)->is_persistent
-
-/* Wrappers support */
-
-#define IGNORE_PATH 0
-#define USE_PATH 1
-#define IGNORE_URL 2
-#define ENFORCE_SAFE_MODE 4
-#define REPORT_ERRORS 8
-/* If you don't need to write to the stream, but really need to
- * be able to seek, use this flag in your options. */
-#define STREAM_MUST_SEEK 16
-/* If you are going to end up casting the stream into a FILE* or
- * a socket, pass this flag and the streams/wrappers will not use
- * buffering mechanisms while reading the headers, so that HTTP
- * wrapped streams will work consistently.
- * If you omit this flag, streams will use buffering and should end
- * up working more optimally.
- * */
-#define STREAM_WILL_CAST 32
-
-/* this flag applies to php_stream_locate_url_wrapper */
-#define STREAM_LOCATE_WRAPPERS_ONLY 64
-
-/* this flag is only used by include/require functions */
-#define STREAM_OPEN_FOR_INCLUDE 128
-
-/* this flag tells streams to ONLY open urls */
-#define STREAM_USE_URL 256
-
-/* this flag is used when only the headers from HTTP request are to be fetched */
-#define STREAM_ONLY_GET_HEADERS 512
-
-/* don't apply open_basedir checks */
-#define STREAM_DISABLE_OPEN_BASEDIR 1024
-
-/* get (or create) a persistent version of the stream */
-#define STREAM_OPEN_PERSISTENT 2048
-
-/* Antique - no longer has meaning */
-#define IGNORE_URL_WIN 0
-
-int php_init_stream_wrappers(int module_number TSRMLS_DC);
-int php_shutdown_stream_wrappers(int module_number TSRMLS_DC);
-PHP_RSHUTDOWN_FUNCTION(streams);
-
-PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC);
-PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC);
-PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
-PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char **path_for_open, int options TSRMLS_DC);
-PHPAPI char *php_stream_locate_eol(php_stream *stream, char *buf, size_t buf_len TSRMLS_DC);
-
-#define php_stream_open_wrapper(path, mode, options, opened) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL STREAMS_CC TSRMLS_CC)
-#define php_stream_open_wrapper_ex(path, mode, options, opened, context) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), (context) STREAMS_CC TSRMLS_CC)
-
-#define php_stream_get_from_zval(stream, zstream, mode, options, opened, context) \
- if (Z_TYPE_PP((zstream)) == IS_RESOURCE) { \
- php_stream_from_zval((stream), (zstream)); \
- } else (stream) = Z_TYPE_PP((zstream)) == IS_STRING ? \
- php_stream_open_wrapper_ex(Z_STRVAL_PP((zstream)), (mode), (options), (opened), (context)) : NULL
-
-/* pushes an error message onto the stack for a wrapper instance */
-PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int options TSRMLS_DC, const char *fmt, ...);
-
-
-#define PHP_STREAM_UNCHANGED 0 /* orig stream was seekable anyway */
-#define PHP_STREAM_RELEASED 1 /* newstream should be used; origstream is no longer valid */
-#define PHP_STREAM_FAILED 2 /* an error occurred while attempting conversion */
-#define PHP_STREAM_CRITICAL 3 /* an error occurred; origstream is in an unknown state; you should close origstream */
-#define PHP_STREAM_NO_PREFERENCE 0
-#define PHP_STREAM_PREFER_STDIO 1
-#define PHP_STREAM_FORCE_CONVERSION 2
-/* DO NOT call this on streams that are referenced by resources! */
-PHPAPI int _php_stream_make_seekable(php_stream *origstream, php_stream **newstream, int flags STREAMS_DC TSRMLS_DC);
-#define php_stream_make_seekable(origstream, newstream, flags) _php_stream_make_seekable((origstream), (newstream), (flags) STREAMS_CC TSRMLS_CC)
-
-/* Give other modules access to the url_stream_wrappers_hash and stream_filters_hash */
-PHPAPI HashTable *php_stream_get_url_stream_wrappers_hash();
-PHPAPI HashTable *php_get_stream_filters_hash();
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/php_syslog.h b/main/php_syslog.h
deleted file mode 100644
index e3adf00f31..0000000000
--- a/main/php_syslog.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SYSLOG_H
-#define PHP_SYSLOG_H
-
-#ifdef PHP_WIN32
-#include "win32/syslog.h"
-#elif defined(NETWARE)
-# include "config.nw.h"
-#ifdef HAVE_SYSLOG_H
-#include <syslog.h>
-#endif
-#else
-#include "php_config.h"
-#ifdef HAVE_SYSLOG_H
-#include <syslog.h>
-#endif
-#endif
-
-/*
- * The SCO OpenServer 5 Development System (not the UDK)
- * defines syslog to std_syslog.
- */
-
-#ifdef syslog
-
-#ifdef HAVE_STD_SYSLOG
-#define php_syslog std_syslog
-#endif
-
-#undef syslog
-
-#endif
-
-#ifndef php_syslog
-#define php_syslog syslog
-#endif
-
-#endif
diff --git a/main/php_ticks.c b/main/php_ticks.c
deleted file mode 100644
index c39e166507..0000000000
--- a/main/php_ticks.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_ticks.h"
-
-int php_startup_ticks(TSRMLS_D)
-{
- zend_llist_init(&PG(tick_functions), sizeof(void(*)(int)), NULL, 1);
- return SUCCESS;
-}
-
-void php_shutdown_ticks(TSRMLS_D)
-{
- zend_llist_destroy(&PG(tick_functions));
-}
-
-static int php_compare_tick_functions(void *elem1, void *elem2)
-{
- void(*func1)(int);
- void(*func2)(int);
- memcpy(&func1, elem1, sizeof(void(*)(int)));
- memcpy(&func2, elem2, sizeof(void(*)(int)));
- return (func1 == func2);
-}
-
-PHPAPI void php_add_tick_function(void (*func)(int))
-{
- TSRMLS_FETCH();
-
- zend_llist_add_element(&PG(tick_functions), (void *)&func);
-}
-
-PHPAPI void php_remove_tick_function(void (*func)(int))
-{
- TSRMLS_FETCH();
-
- zend_llist_del_element(&PG(tick_functions), (void *)func,
- (int(*)(void*, void*))php_compare_tick_functions);
-}
-
-static void php_tick_iterator(void *data, void *arg TSRMLS_DC)
-{
- void (*func)(int);
-
- memcpy(&func, data, sizeof(void(*)(int)));
- func(*((int *)arg));
-}
-
-void php_run_ticks(int count)
-{
- TSRMLS_FETCH();
-
- zend_llist_apply_with_argument(&PG(tick_functions), (llist_apply_with_arg_func_t) php_tick_iterator, &count TSRMLS_CC);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/php_ticks.h b/main/php_ticks.h
deleted file mode 100644
index 3cf699723c..0000000000
--- a/main/php_ticks.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_TICKS_H
-#define PHP_TICKS_H
-
-int php_startup_ticks(TSRMLS_D);
-void php_shutdown_ticks(TSRMLS_D);
-void php_run_ticks(int count);
-PHPAPI void php_add_tick_function(void (*func)(int));
-PHPAPI void php_remove_tick_function(void (*func)(int));
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_variables.c b/main/php_variables.c
deleted file mode 100644
index fd586c6f89..0000000000
--- a/main/php_variables.c
+++ /dev/null
@@ -1,737 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdio.h>
-#include "php.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/credits.h"
-#include "php_variables.h"
-#include "php_globals.h"
-#include "php_content_types.h"
-#include "SAPI.h"
-#include "php_logos.h"
-
-#include "zend_globals.h"
-
-
-/* for systems that need to override reading of environment variables */
-void _php_import_environment_variables(zval *array_ptr TSRMLS_DC);
-PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC) = _php_import_environment_variables;
-
-PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_array TSRMLS_DC)
-{
- php_register_variable_safe(var, strval, strlen(strval), track_vars_array TSRMLS_CC);
-}
-
-
-/* binary-safe version */
-PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zval *track_vars_array TSRMLS_DC)
-{
- zval new_entry;
- assert(strval != NULL);
-
- /* Prepare value */
- Z_STRLEN(new_entry) = str_len;
- if (PG(magic_quotes_gpc)) {
- Z_STRVAL(new_entry) = php_addslashes(strval, Z_STRLEN(new_entry), &Z_STRLEN(new_entry), 0 TSRMLS_CC);
- } else {
- Z_STRVAL(new_entry) = estrndup(strval, Z_STRLEN(new_entry));
- }
- Z_TYPE(new_entry) = IS_STRING;
-
- php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC);
-}
-
-
-PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_array TSRMLS_DC)
-{
- char *p = NULL;
- char *ip; /* index pointer */
- char *index;
- int var_len, index_len;
- zval *gpc_element, **gpc_element_p, **top_gpc_p=NULL;
- zend_bool is_array;
- HashTable *symtable1=NULL;
- HashTable *symtable2=NULL;
-
- assert(var != NULL);
-
- if (track_vars_array) {
- symtable1 = Z_ARRVAL_P(track_vars_array);
- }
- if (PG(register_globals)) {
- if (symtable1) {
- symtable2 = EG(active_symbol_table);
- } else {
- symtable1 = EG(active_symbol_table);
- }
- }
- if (!symtable1) {
- /* Nothing to do */
- zval_dtor(val);
- return;
- }
-
- /*
- * Prepare variable name
- */
- ip = strchr(var, '[');
- if (ip) {
- is_array = 1;
- *ip = 0;
- } else {
- is_array = 0;
- }
- /* ignore leading spaces in the variable name */
- while (*var && *var==' ') {
- var++;
- }
- var_len = strlen(var);
- if (var_len==0) { /* empty variable name, or variable name with a space in it */
- zval_dtor(val);
- return;
- }
- /* ensure that we don't have spaces or dots in the variable name (not binary safe) */
- for (p=var; *p; p++) {
- switch(*p) {
- case ' ':
- case '.':
- *p='_';
- break;
- }
- }
-
- index = var;
- index_len = var_len;
-
- while (1) {
- if (is_array) {
- char *escaped_index = NULL, *index_s;
- int new_idx_len = 0;
-
- ip++;
- index_s = ip;
- if (isspace(*ip)) {
- ip++;
- }
- if (*ip==']') {
- index_s = NULL;
- } else {
- ip = strchr(ip, ']');
- if (!ip) {
- /* PHP variables cannot contain '[' in their names, so we replace the character with a '_' */
- *(index_s - 1) = '_';
- index_len = var_len = strlen(var);
- goto plain_var;
- return;
- }
- *ip = 0;
- new_idx_len = strlen(index_s);
- }
-
- if (!index) {
- MAKE_STD_ZVAL(gpc_element);
- array_init(gpc_element);
- zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
- } else {
- if (PG(magic_quotes_gpc) && (index!=var)) {
- /* no need to addslashes() the index if it's the main variable name */
- escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
- } else {
- escaped_index = index;
- }
- if (zend_hash_find(symtable1, escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE
- || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) {
- MAKE_STD_ZVAL(gpc_element);
- array_init(gpc_element);
- zend_hash_update(symtable1, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
- }
- if (index!=escaped_index) {
- efree(escaped_index);
- }
- }
- if (!top_gpc_p) {
- top_gpc_p = gpc_element_p;
- }
- symtable1 = Z_ARRVAL_PP(gpc_element_p);
- /* ip pointed to the '[' character, now obtain the key */
- index = index_s;
- index_len = new_idx_len;
-
- ip++;
- if (*ip=='[') {
- is_array = 1;
- *ip = 0;
- } else {
- is_array = 0;
- }
- } else {
-plain_var:
- MAKE_STD_ZVAL(gpc_element);
- gpc_element->value = val->value;
- Z_TYPE_P(gpc_element) = Z_TYPE_P(val);
- if (!index) {
- zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
- } else {
- zend_hash_update(symtable1, index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
- }
- if (!top_gpc_p) {
- top_gpc_p = gpc_element_p;
- }
- break;
- }
- }
-
- if (top_gpc_p) {
- if (symtable2) {
- zend_hash_update(symtable2, var, var_len+1, top_gpc_p, sizeof(zval *), NULL);
- (*top_gpc_p)->refcount++;
- }
- }
-}
-
-
-SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler)
-{
- char *var, *val;
- char *strtok_buf = NULL;
- zval *array_ptr = (zval *) arg;
-
- if (SG(request_info).post_data==NULL) {
- return;
- }
-
- var = php_strtok_r(SG(request_info).post_data, "&", &strtok_buf);
-
- while (var) {
- val = strchr(var, '=');
- if (val) { /* have a value */
- int val_len;
-
- *val++ = '\0';
- php_url_decode(var, strlen(var));
- val_len = php_url_decode(val, strlen(val));
- val_len = sapi_module.input_filter(PARSE_POST, var, &val, val_len TSRMLS_CC);
- php_register_variable_safe(var, val, val_len, array_ptr TSRMLS_CC);
- }
- var = php_strtok_r(NULL, "&", &strtok_buf);
- }
-}
-
-SAPI_API SAPI_INPUT_FILTER_FUNC(php_default_input_filter)
-{
- /* TODO: check .ini setting here and apply user-defined input filter */
- return val_len;
-}
-
-SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
-{
- char *res = NULL, *var, *val, *separator=NULL;
- const char *c_var;
- pval *array_ptr;
- int free_buffer=0;
- char *strtok_buf = NULL;
-
- switch (arg) {
- case PARSE_POST:
- case PARSE_GET:
- case PARSE_COOKIE:
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- switch (arg) {
- case PARSE_POST:
- PG(http_globals)[TRACK_VARS_POST] = array_ptr;
- break;
- case PARSE_GET:
- PG(http_globals)[TRACK_VARS_GET] = array_ptr;
- break;
- case PARSE_COOKIE:
- PG(http_globals)[TRACK_VARS_COOKIE] = array_ptr;
- break;
- }
- break;
- default:
- array_ptr=destArray;
- break;
- }
-
- if (arg==PARSE_POST) {
- sapi_handle_post(array_ptr TSRMLS_CC);
- return;
- }
-
- if (arg == PARSE_GET) { /* GET data */
- c_var = SG(request_info).query_string;
- if (c_var && *c_var) {
- res = (char *) estrdup(c_var);
- free_buffer = 1;
- } else {
- free_buffer = 0;
- }
- } else if (arg == PARSE_COOKIE) { /* Cookie data */
- c_var = SG(request_info).cookie_data;
- if (c_var && *c_var) {
- res = (char *) estrdup(c_var);
- free_buffer = 1;
- } else {
- free_buffer = 0;
- }
- } else if (arg == PARSE_STRING) { /* String data */
- res = str;
- free_buffer = 1;
- }
-
- if (!res) {
- return;
- }
-
- switch (arg) {
- case PARSE_GET:
- case PARSE_STRING:
- separator = (char *) estrdup(PG(arg_separator).input);
- break;
- case PARSE_COOKIE:
- separator = ";\0";
- break;
- }
-
- var = php_strtok_r(res, separator, &strtok_buf);
-
- while (var) {
- val = strchr(var, '=');
- if (val) { /* have a value */
- int val_len;
-
- *val++ = '\0';
- php_url_decode(var, strlen(var));
- val_len = php_url_decode(val, strlen(val));
- val_len = sapi_module.input_filter(arg, var, &val, val_len TSRMLS_CC);
- php_register_variable_safe(var, val, val_len, array_ptr TSRMLS_CC);
- } else {
- php_url_decode(var, strlen(var));
- php_register_variable_safe(var, "", 0, array_ptr TSRMLS_CC);
- }
- var = php_strtok_r(NULL, separator, &strtok_buf);
- }
-
- if(arg != PARSE_COOKIE) {
- efree(separator);
- }
-
- if (free_buffer) {
- efree(res);
- }
-}
-
-void _php_import_environment_variables(zval *array_ptr TSRMLS_DC)
-{
- char buf[128];
- char **env, *p, *t = buf;
- size_t alloc_size = sizeof(buf);
- unsigned long nlen; /* ptrdiff_t is not portable */
-
- /* turn off magic_quotes while importing environment variables */
- int magic_quotes_gpc = PG(magic_quotes_gpc);
- PG(magic_quotes_gpc) = 0;
-
- for (env = environ; env != NULL && *env != NULL; env++) {
- p = strchr(*env, '=');
- if (!p) { /* malformed entry? */
- continue;
- }
- nlen = p - *env;
- if (nlen >= alloc_size) {
- alloc_size = nlen + 64;
- t = (t == buf ? emalloc(alloc_size): erealloc(t, alloc_size));
- }
- memcpy(t, *env, nlen);
- t[nlen] = '\0';
- php_register_variable(t, p+1, array_ptr TSRMLS_CC);
- }
- if (t != buf && t != NULL) {
- efree(t);
- }
- PG(magic_quotes_gpc) = magic_quotes_gpc;
-}
-
-
-zend_bool php_std_auto_global_callback(char *name, uint name_len TSRMLS_DC)
-{
- zend_printf("%s\n", name);
- return 0; /* don't rearm */
-}
-
-/* {{{ php_build_argv
- */
-static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
-{
- pval *arr, *argc, *tmp;
- int count = 0;
- char *ss, *space;
-
- ALLOC_ZVAL(arr);
- array_init(arr);
- INIT_PZVAL(arr);
-
- /* Prepare argv */
- if (SG(request_info).argc) { /* are we in cli sapi? */
- int i;
- for (i=0; i<SG(request_info).argc; i++) {
- ALLOC_ZVAL(tmp);
- Z_TYPE_P(tmp) = IS_STRING;
- Z_STRLEN_P(tmp) = strlen(SG(request_info).argv[i]);
- Z_STRVAL_P(tmp) = estrndup(SG(request_info).argv[i], Z_STRLEN_P(tmp));
- INIT_PZVAL(tmp);
- if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(pval *), NULL)==FAILURE) {
- if (Z_TYPE_P(tmp) == IS_STRING) {
- efree(Z_STRVAL_P(tmp));
- }
- }
- }
- } else if (s && *s) {
- ss = s;
- while (ss) {
- space = strchr(ss, '+');
- if (space) {
- *space = '\0';
- }
- /* auto-type */
- ALLOC_ZVAL(tmp);
- Z_TYPE_P(tmp) = IS_STRING;
- Z_STRLEN_P(tmp) = strlen(ss);
- Z_STRVAL_P(tmp) = estrndup(ss, Z_STRLEN_P(tmp));
- INIT_PZVAL(tmp);
- count++;
- if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(pval *), NULL)==FAILURE) {
- if (Z_TYPE_P(tmp) == IS_STRING) {
- efree(Z_STRVAL_P(tmp));
- }
- }
- if (space) {
- *space = '+';
- ss = space + 1;
- } else {
- ss = space;
- }
- }
- }
-
- /* prepare argc */
- ALLOC_ZVAL(argc);
- if (SG(request_info).argc) {
- Z_LVAL_P(argc) = SG(request_info).argc;
- } else {
- Z_LVAL_P(argc) = count;
- }
- Z_TYPE_P(argc) = IS_LONG;
- INIT_PZVAL(argc);
-
- if (PG(register_globals) || SG(request_info).argc) {
- arr->refcount++;
- argc->refcount++;
- zend_hash_update(&EG(symbol_table), "argv", sizeof("argv"), &arr, sizeof(zval *), NULL);
- zend_hash_add(&EG(symbol_table), "argc", sizeof("argc"), &argc, sizeof(zval *), NULL);
- }
-
- zend_hash_update(Z_ARRVAL_P(track_vars_array), "argv", sizeof("argv"), &arr, sizeof(pval *), NULL);
- zend_hash_update(Z_ARRVAL_P(track_vars_array), "argc", sizeof("argc"), &argc, sizeof(pval *), NULL);
-}
-/* }}} */
-
-/* {{{ php_handle_special_queries
- */
-PHPAPI int php_handle_special_queries(TSRMLS_D)
-{
- if (SG(request_info).query_string && SG(request_info).query_string[0]=='='
- && PG(expose_php)) {
- if (php_info_logos(SG(request_info).query_string+1 TSRMLS_CC)) {
- return 1;
- } else if (!strcmp(SG(request_info).query_string+1, PHP_CREDITS_GUID)) {
- php_print_credits(PHP_CREDITS_ALL TSRMLS_CC);
- return 1;
- }
- }
- return 0;
-}
-/* }}} */
-
-
-
-/* {{{ php_register_server_variables
- */
-static inline void php_register_server_variables(TSRMLS_D)
-{
- zval *array_ptr=NULL;
- /* turn off magic_quotes while importing server variables */
- int magic_quotes_gpc = PG(magic_quotes_gpc);
-
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- PG(http_globals)[TRACK_VARS_SERVER] = array_ptr;
- PG(magic_quotes_gpc) = 0;
-
- /* Server variables */
- if (sapi_module.register_server_variables) {
- sapi_module.register_server_variables(array_ptr TSRMLS_CC);
- }
-
- /* argv/argc support */
- if (PG(register_argc_argv)) {
- php_build_argv(SG(request_info).query_string, array_ptr TSRMLS_CC);
- }
-
- /* PHP Authentication support */
- if (SG(request_info).auth_user) {
- php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, array_ptr TSRMLS_CC);
- }
- if (SG(request_info).auth_password) {
- php_register_variable("PHP_AUTH_PW", SG(request_info).auth_password, array_ptr TSRMLS_CC);
- }
- PG(magic_quotes_gpc) = magic_quotes_gpc;
-}
-/* }}} */
-
-
-static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS_DC);
-static zend_bool php_auto_globals_create_env(char *name, uint name_len TSRMLS_DC);
-static zend_bool php_auto_globals_create_request(char *name, uint name_len TSRMLS_DC);
-
-/* {{{ php_hash_environment
- */
-int php_hash_environment(TSRMLS_D)
-{
- char *p;
- unsigned char _gpc_flags[3] = {0, 0, 0};
- zend_bool have_variables_order;
- zval *dummy_track_vars_array = NULL;
- zend_bool initialized_dummy_track_vars_array=0;
- zend_bool jit_initialization = (!PG(register_globals) && !PG(register_long_arrays));
- char *variables_order;
- struct auto_global_record {
- char *name;
- uint name_len;
- char *long_name;
- uint long_name_len;
- zend_bool jit_initialization;
- } auto_global_records[] = {
- { "_POST", sizeof("_POST"), "HTTP_POST_VARS", sizeof("HTTP_POST_VARS"), 0 },
- { "_GET", sizeof("_GET"), "HTTP_GET_VARS", sizeof("HTTP_GET_VARS"), 0 },
- { "_COOKIE", sizeof("_COOKIE"), "HTTP_COOKIE_VARS", sizeof("HTTP_COOKIE_VARS"), 0 },
- { "_SERVER", sizeof("_SERVER"), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), 1 },
- { "_ENV", sizeof("_ENV"), "HTTP_ENV_VARS", sizeof("HTTP_ENV_VARS"), 1 },
- { "_FILES", sizeof("_FILES"), "HTTP_POST_FILES", sizeof("HTTP_POST_FILES"), 0 },
- };
- size_t num_track_vars = sizeof(auto_global_records)/sizeof(struct auto_global_record);
- size_t i;
-
- /* jit_initialization = 0; */
- for (i=0; i<num_track_vars; i++) {
- PG(http_globals)[i] = NULL;
- }
-
- if (PG(variables_order)) {
- variables_order = PG(variables_order);
- have_variables_order=1;
- } else {
- variables_order = PG(gpc_order);
- have_variables_order=0;
- ALLOC_ZVAL(PG(http_globals)[TRACK_VARS_ENV]);
- array_init(PG(http_globals)[TRACK_VARS_ENV]);
- INIT_PZVAL(PG(http_globals)[TRACK_VARS_ENV]);
- php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC);
- }
-
- for (p=variables_order; p && *p; p++) {
- switch(*p) {
- case 'p':
- case 'P':
- if (!_gpc_flags[0] && !SG(headers_sent) && SG(request_info).request_method && !strcasecmp(SG(request_info).request_method, "POST")) {
- sapi_module.treat_data(PARSE_POST, NULL, NULL TSRMLS_CC); /* POST Data */
- _gpc_flags[0]=1;
- }
- break;
- case 'c':
- case 'C':
- if (!_gpc_flags[1]) {
- sapi_module.treat_data(PARSE_COOKIE, NULL, NULL TSRMLS_CC); /* Cookie Data */
- _gpc_flags[1]=1;
- }
- break;
- case 'g':
- case 'G':
- if (!_gpc_flags[2]) {
- sapi_module.treat_data(PARSE_GET, NULL, NULL TSRMLS_CC); /* GET Data */
- _gpc_flags[2]=1;
- }
- break;
- case 'e':
- case 'E':
- if (!jit_initialization) {
- if (have_variables_order) {
- php_auto_globals_create_env("_ENV", sizeof("_ENV")-1 TSRMLS_CC);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported 'e' element (environment) used in gpc_order - use variables_order instead");
- }
- }
- break;
- case 's':
- case 'S':
- if (!jit_initialization) {
- php_register_server_variables(TSRMLS_C);
- }
- break;
- }
- }
-
- if (!jit_initialization && !have_variables_order) {
- php_register_server_variables(TSRMLS_C);
- }
-
- for (i=0; i<num_track_vars; i++) {
- if (jit_initialization && auto_global_records[i].jit_initialization) {
- continue;
- }
- if (!PG(http_globals)[i]) {
- if (!initialized_dummy_track_vars_array) {
- ALLOC_ZVAL(dummy_track_vars_array);
- array_init(dummy_track_vars_array);
- INIT_PZVAL(dummy_track_vars_array);
- initialized_dummy_track_vars_array = 1;
- } else {
- dummy_track_vars_array->refcount++;
- }
- PG(http_globals)[i] = dummy_track_vars_array;
- }
-
- zend_hash_update(&EG(symbol_table), auto_global_records[i].name, auto_global_records[i].name_len, &PG(http_globals)[i], sizeof(zval *), NULL);
- PG(http_globals)[i]->refcount++;
- if (PG(register_long_arrays)) {
- zend_hash_update(&EG(symbol_table), auto_global_records[i].long_name, auto_global_records[i].long_name_len, &PG(http_globals)[i], sizeof(zval *), NULL);
- PG(http_globals)[i]->refcount++;
- }
- }
-
- /* Create _REQUEST */
- if (!jit_initialization) {
- php_auto_globals_create_request("_REQUEST", sizeof("_REQUEST")-1 TSRMLS_CC);
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-
-static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS_DC)
-{
- php_register_server_variables(TSRMLS_C);
-
- zend_hash_update(&EG(symbol_table), name, name_len+1, &PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL);
- PG(http_globals)[TRACK_VARS_SERVER]->refcount++;
-
- if (PG(register_long_arrays)) {
- zend_hash_update(&EG(symbol_table), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), &PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL);
- PG(http_globals)[TRACK_VARS_SERVER]->refcount++;
- }
-
- return 0; /* don't rearm */
-}
-
-
-static zend_bool php_auto_globals_create_env(char *name, uint name_len TSRMLS_DC)
-{
- ALLOC_ZVAL(PG(http_globals)[TRACK_VARS_ENV]);
- array_init(PG(http_globals)[TRACK_VARS_ENV]);
- INIT_PZVAL(PG(http_globals)[TRACK_VARS_ENV]);
- php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC);
-
- zend_hash_update(&EG(symbol_table), name, name_len+1, &PG(http_globals)[TRACK_VARS_ENV], sizeof(zval *), NULL);
- PG(http_globals)[TRACK_VARS_ENV]->refcount++;
-
- if (PG(register_long_arrays)) {
- zend_hash_update(&EG(symbol_table), "HTTP_ENV_VARS", sizeof("HTTP_ENV_VARS"), &PG(http_globals)[TRACK_VARS_ENV], sizeof(zval *), NULL);
- PG(http_globals)[TRACK_VARS_ENV]->refcount++;
- }
-
- return 0; /* don't rearm */
-}
-
-
-static zend_bool php_auto_globals_create_request(char *name, uint name_len TSRMLS_DC)
-{
- zval *form_variables;
- char *variables_order;
- char *p;
-
- if (PG(variables_order)) {
- variables_order = PG(variables_order);
- } else {
- variables_order = PG(gpc_order);
- }
-
- ALLOC_ZVAL(form_variables);
- array_init(form_variables);
- INIT_PZVAL(form_variables);
-
- for (p=variables_order; p && *p; p++) {
- switch (*p) {
- case 'g':
- case 'G':
- zend_hash_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_GET]), (void (*)(void *pData)) zval_add_ref, NULL, sizeof(zval *), 1);
- break;
- case 'p':
- case 'P':
- zend_hash_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_POST]), (void (*)(void *pData)) zval_add_ref, NULL, sizeof(zval *), 1);
- break;
- case 'c':
- case 'C':
- zend_hash_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]), (void (*)(void *pData)) zval_add_ref, NULL, sizeof(zval *), 1);
- break;
- }
- }
-
- zend_hash_update(&EG(symbol_table), "_REQUEST", sizeof("_REQUEST"), &form_variables, sizeof(zval *), NULL);
- return 0;
-}
-
-
-void php_startup_auto_globals(TSRMLS_D)
-{
- zend_bool cb = (!PG(register_globals) && !PG(register_long_arrays));
-
- /*cb = 0;*/
- zend_register_auto_global("_GET", sizeof("_GET")-1, NULL TSRMLS_CC);
- zend_register_auto_global("_POST", sizeof("_POST")-1, NULL TSRMLS_CC);
- zend_register_auto_global("_COOKIE", sizeof("_COOKIE")-1, NULL TSRMLS_CC);
- zend_register_auto_global("_SERVER", sizeof("_SERVER")-1, cb?php_auto_globals_create_server:NULL TSRMLS_CC);
- zend_register_auto_global("_ENV", sizeof("_ENV")-1, cb?php_auto_globals_create_env:NULL TSRMLS_CC);
- zend_register_auto_global("_REQUEST", sizeof("_REQUEST")-1, cb?php_auto_globals_create_request:NULL TSRMLS_CC);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/php_variables.h b/main/php_variables.h
deleted file mode 100644
index 11304945f9..0000000000
--- a/main/php_variables.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_VARIABLES_H
-#define PHP_VARIABLES_H
-
-#include "php.h"
-#include "SAPI.h"
-
-#define PARSE_POST 0
-#define PARSE_GET 1
-#define PARSE_COOKIE 2
-#define PARSE_STRING 3
-
-void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC);
-void php_startup_auto_globals(TSRMLS_D);
-extern PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC);
-PHPAPI void php_register_variable(char *var, char *val, pval *track_vars_array TSRMLS_DC);
-/* binary-safe version */
-PHPAPI void php_register_variable_safe(char *var, char *val, int val_len, pval *track_vars_array TSRMLS_DC);
-PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_array TSRMLS_DC);
-
-int php_hash_environment(TSRMLS_D);
-
-
-#define NUM_TRACK_VARS 6
-
-#endif /* PHP_VARIABLES_H */
diff --git a/main/php_version.h b/main/php_version.h
deleted file mode 100644
index 3d13b2abe6..0000000000
--- a/main/php_version.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* automatically generated by configure */
-/* edit configure.in to change version number */
-#define PHP_MAJOR_VERSION 5
-#define PHP_MINOR_VERSION 0
-#define PHP_RELEASE_VERSION 0
-#define PHP_EXTRA_VERSION "-dev"
-#define PHP_VERSION "5.0.0-dev"
diff --git a/main/reentrancy.c b/main/reentrancy.c
deleted file mode 100644
index c20b3a2bdf..0000000000
--- a/main/reentrancy.c
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <sys/types.h>
-#include <string.h>
-#include <errno.h>
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#ifdef PHP_WIN32
-#include "win32/readdir.h"
-#endif
-
-#if defined(NETWARE) && !(NEW_LIBC)
-/*#include <ws2nlm.h>*/
-#include <sys/socket.h>
-#endif
-
-#include "php_reentrancy.h"
-#include "ext/standard/php_rand.h" /* for RAND_MAX */
-
-enum {
- LOCALTIME_R,
- CTIME_R,
- ASCTIME_R,
- GMTIME_R,
- READDIR_R,
- NUMBER_OF_LOCKS
-};
-
-#if defined(PHP_NEED_REENTRANCY)
-
-#include <TSRM.h>
-
-static MUTEX_T reentrant_locks[NUMBER_OF_LOCKS];
-
-#define local_lock(x) tsrm_mutex_lock(reentrant_locks[x])
-#define local_unlock(x) tsrm_mutex_unlock(reentrant_locks[x])
-
-#else
-
-#define local_lock(x)
-#define local_unlock(x)
-
-#endif
-
-#if defined(PHP_IRIX_TIME_R)
-
-#define HAVE_CTIME_R 1
-#define HAVE_ASCTIME_R 1
-
-PHPAPI char *php_ctime_r(const time_t *clock, char *buf)
-{
- if (ctime_r(clock, buf, 26) == buf)
- return (buf);
- return (NULL);
-}
-
-PHPAPI char *php_asctime_r(const struct tm *tm, char *buf)
-{
- if (asctime_r(tm, buf, 26) == buf)
- return (buf);
- return (NULL);
-}
-
-#endif
-
-#if defined(PHP_HPUX_TIME_R)
-
-#define HAVE_LOCALTIME_R 1
-#define HAVE_CTIME_R 1
-#define HAVE_ASCTIME_R 1
-#define HAVE_GMTIME_R 1
-
-PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm)
-{
- if (localtime_r(timep, p_tm) == 0)
- return (p_tm);
- return (NULL);
-}
-
-PHPAPI char *php_ctime_r(const time_t *clock, char *buf)
-{
- if (ctime_r(clock, buf, 26) != -1)
- return (buf);
- return (NULL);
-}
-
-PHPAPI char *php_asctime_r(const struct tm *tm, char *buf)
-{
- if (asctime_r(tm, buf, 26) != -1)
- return (buf);
- return (NULL);
-}
-
-PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm)
-{
- if (gmtime_r(timep, p_tm) == 0)
- return (p_tm);
- return (NULL);
-}
-
-#endif
-
-#if defined(NETWARE)
-/*
- Re-entrant versions of functions seem to be better for loading NLMs in different address space.
- Since we have them now in LibC, we might as well make use of them.
-*/
-
-#define HAVE_LOCALTIME_R 1
-#define HAVE_CTIME_R 1
-#define HAVE_ASCTIME_R 1
-#define HAVE_GMTIME_R 1
-
-PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm)
-{
- /* Modified according to LibC definition */
- if (localtime_r(timep, p_tm) != NULL)
- return (p_tm);
- return (NULL);
-}
-
-PHPAPI char *php_ctime_r(const time_t *clock, char *buf)
-{
- /* Modified according to LibC definition */
- if (ctime_r(clock, buf) != NULL)
- return (buf);
- return (NULL);
-}
-
-PHPAPI char *php_asctime_r(const struct tm *tm, char *buf)
-{
- /* Modified according to LibC definition */
- if (asctime_r(tm, buf) != NULL)
- return (buf);
- return (NULL);
-}
-
-PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm)
-{
- /* Modified according to LibC definition */
- if (gmtime_r(timep, p_tm) != NULL)
- return (p_tm);
- return (NULL);
-}
-
-#endif /* NETWARE */
-
-#if defined(__BEOS__)
-
-PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm)
-{
- /* Modified according to LibC definition */
- if (((struct tm*)gmtime_r(timep, p_tm)) == p_tm)
- return (p_tm);
- return (NULL);
-}
-
-#endif /* BEOS */
-
-#if !defined(HAVE_POSIX_READDIR_R)
-
-PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry,
- struct dirent **result)
-{
-#if defined(HAVE_OLD_READDIR_R)
- int ret = 0;
-
- /* We cannot rely on the return value of readdir_r
- as it differs between various platforms
- (HPUX returns 0 on success whereas Solaris returns non-zero)
- */
- entry->d_name[0] = '\0';
- readdir_r(dirp, entry);
-
- if (entry->d_name[0] == '\0') {
- *result = NULL;
- ret = errno;
- } else {
- *result = entry;
- }
- return ret;
-#else
- struct dirent *ptr;
- int ret = 0;
-
- local_lock(READDIR_R);
-
- errno = 0;
-
- ptr = readdir(dirp);
-
- if (!ptr && errno != 0)
- ret = errno;
-
- if (ptr)
- memcpy(entry, ptr, sizeof(*ptr));
-
- *result = ptr;
-
- local_unlock(READDIR_R);
-
- return ret;
-#endif
-}
-
-#endif
-
-#if !defined(HAVE_LOCALTIME_R) && defined(HAVE_LOCALTIME)
-
-PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm)
-{
- struct tm *tmp;
-
- local_lock(LOCALTIME_R);
-
- tmp = localtime(timep);
- if (tmp) {
- memcpy(p_tm, tmp, sizeof(struct tm));
- tmp = p_tm;
- }
-
- local_unlock(LOCALTIME_R);
-
- return tmp;
-}
-
-#endif
-
-#if !defined(HAVE_CTIME_R) && defined(HAVE_CTIME)
-
-PHPAPI char *php_ctime_r(const time_t *clock, char *buf)
-{
- char *tmp;
-
- local_lock(CTIME_R);
-
- tmp = ctime(clock);
- strcpy(buf, tmp);
-
- local_unlock(CTIME_R);
-
- return buf;
-}
-
-#endif
-
-#if !defined(HAVE_ASCTIME_R) && defined(HAVE_ASCTIME)
-
-PHPAPI char *php_asctime_r(const struct tm *tm, char *buf)
-{
- char *tmp;
-
- local_lock(ASCTIME_R);
-
- tmp = asctime(tm);
- strcpy(buf, tmp);
-
- local_unlock(ASCTIME_R);
-
- return buf;
-}
-
-#endif
-
-#if !defined(HAVE_GMTIME_R) && defined(HAVE_GMTIME)
-
-PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm)
-{
- struct tm *tmp;
-
- local_lock(GMTIME_R);
-
- tmp = gmtime(timep);
- if (tmp) {
- memcpy(p_tm, tmp, sizeof(struct tm));
- tmp = p_tm;
- }
-
- local_unlock(GMTIME_R);
-
- return tmp;
-}
-
-#endif
-
-#if defined(PHP_NEED_REENTRANCY)
-
-void reentrancy_startup(void)
-{
- int i;
-
- for (i = 0; i < NUMBER_OF_LOCKS; i++) {
- reentrant_locks[i] = tsrm_mutex_alloc();
- }
-}
-
-void reentrancy_shutdown(void)
-{
- int i;
-
- for (i = 0; i < NUMBER_OF_LOCKS; i++) {
- tsrm_mutex_free(reentrant_locks[i]);
- }
-}
-
-#endif
-
-#ifndef HAVE_RAND_R
-
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Posix rand_r function added May 1999 by Wes Peters <wes@softweyr.com>.
- */
-
-#include <sys/types.h>
-#include <stdlib.h>
-
-static int
-do_rand(unsigned long *ctx)
-{
- return ((*ctx = *ctx * 1103515245 + 12345) % ((u_long)RAND_MAX + 1));
-}
-
-
-PHPAPI int
-php_rand_r(unsigned int *ctx)
-{
- u_long val = (u_long) *ctx;
- *ctx = do_rand(&val);
- return (int) *ctx;
-}
-
-#endif
-
-
-#ifndef HAVE_STRTOK_R
-
-/*
- * Copyright (c) 1998 Softweyr LLC. All rights reserved.
- *
- * strtok_r, from Berkeley strtok
- * Oct 13, 1998 by Wes Peters <wes@softweyr.com>
- *
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notices, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notices, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- *
- * This product includes software developed by Softweyr LLC, the
- * University of California, Berkeley, and its contributors.
- *
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWEYR LLC, THE
- * REGENTS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stddef.h>
-
-PHPAPI char *
-php_strtok_r(char *s, const char *delim, char **last)
-{
- char *spanp;
- int c, sc;
- char *tok;
-
- if (s == NULL && (s = *last) == NULL)
- {
- return NULL;
- }
-
- /*
- * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
- */
-cont:
- c = *s++;
- for (spanp = (char *)delim; (sc = *spanp++) != 0; )
- {
- if (c == sc)
- {
- goto cont;
- }
- }
-
- if (c == 0) /* no non-delimiter characters */
- {
- *last = NULL;
- return NULL;
- }
- tok = s - 1;
-
- /*
- * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
- * Note that delim must have one NUL; we stop if we see that, too.
- */
- for (;;)
- {
- c = *s++;
- spanp = (char *)delim;
- do
- {
- if ((sc = *spanp++) == c)
- {
- if (c == 0)
- {
- s = NULL;
- }
- else
- {
- char *w = s - 1;
- *w = '\0';
- }
- *last = s;
- return tok;
- }
- }
- while (sc != 0);
- }
- /* NOTREACHED */
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/rfc1867.c b/main/rfc1867.c
deleted file mode 100644
index 457a0184e2..0000000000
--- a/main/rfc1867.c
+++ /dev/null
@@ -1,1073 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Jani Taskinen <sniper@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*
- * This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/).
- *
- */
-
-#include <stdio.h>
-#include "php.h"
-#include "php_open_temporary_file.h"
-#include "zend_globals.h"
-#include "php_globals.h"
-#include "php_variables.h"
-#include "rfc1867.h"
-
-#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
-#include "ext/mbstring/mbstring.h"
-#endif
-
-#undef DEBUG_FILE_UPLOAD
-
-#define SAFE_RETURN { \
- if (lbuf) efree(lbuf); \
- if (abuf) efree(abuf); \
- if (array_index) efree(array_index); \
- zend_hash_destroy(&PG(rfc1867_protected_variables)); \
- zend_llist_destroy(&header); \
- if (mbuff->boundary_next) efree(mbuff->boundary_next); \
- if (mbuff->boundary) efree(mbuff->boundary); \
- if (mbuff->buffer) efree(mbuff->buffer); \
- if (mbuff) efree(mbuff); \
- return; }
-
-
-/* The longest property name we use in an uploaded file array */
-#define MAX_SIZE_OF_INDEX sizeof("[tmp_name]")
-
-/* The longest anonymous name */
-#define MAX_SIZE_ANONNAME 33
-
-/* Errors */
-#define UPLOAD_ERROR_OK 0 /* File upload succesful */
-#define UPLOAD_ERROR_A 1 /* Uploaded file exceeded upload_max_filesize */
-#define UPLOAD_ERROR_B 2 /* Uploaded file exceeded MAX_FILE_SIZE */
-#define UPLOAD_ERROR_C 3 /* Partially uploaded */
-#define UPLOAD_ERROR_D 4 /* No file uploaded */
-
-void php_rfc1867_register_constants(TSRMLS_D)
-{
- REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_OK", UPLOAD_ERROR_OK, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_INI_SIZE", UPLOAD_ERROR_A, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_FORM_SIZE", UPLOAD_ERROR_B, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_PARTIAL", UPLOAD_ERROR_C, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_NO_FILE", UPLOAD_ERROR_D, CONST_CS | CONST_PERSISTENT);
-}
-
-static void normalize_protected_variable(char *varname TSRMLS_DC)
-{
- char *s=varname, *index=NULL, *indexend=NULL, *p;
-
- /* overjump leading space */
- while (*s == ' ') {
- s++;
- }
-
- /* and remove it */
- if (s != varname) {
- memcpy(varname, s, strlen(s)+1);
- }
-
- for (p=varname; *p && *p != '['; p++) {
- switch(*p) {
- case ' ':
- case '.':
- *p='_';
- break;
- }
- }
-
- /* find index */
- index = strchr(varname, '[');
- if (index) {
- index++;
- s=index;
- } else {
- return;
- }
-
- /* done? */
- while (index) {
-
- while (*index == ' ' || *index == '\r' || *index == '\n' || *index=='\t') {
- index++;
- }
- indexend = strchr(index, ']');
- indexend = indexend ? indexend + 1 : index + strlen(index);
-
- if (s != index) {
- memcpy(s, index, strlen(s)+1);
- s += indexend-index;
- } else {
- s = indexend;
- }
-
- if (*s == '[') {
- s++;
- index = s;
- } else {
- index = NULL;
- }
- }
- *s++='\0';
-}
-
-
-static void add_protected_variable(char *varname TSRMLS_DC)
-{
- int dummy=1;
-
- normalize_protected_variable(varname TSRMLS_CC);
- zend_hash_add(&PG(rfc1867_protected_variables), varname, strlen(varname)+1, &dummy, sizeof(int), NULL);
-}
-
-
-static zend_bool is_protected_variable(char *varname TSRMLS_DC)
-{
- normalize_protected_variable(varname TSRMLS_CC);
- return zend_hash_exists(&PG(rfc1867_protected_variables), varname, strlen(varname)+1);
-}
-
-
-static void safe_php_register_variable(char *var, char *strval, zval *track_vars_array, zend_bool override_protection TSRMLS_DC)
-{
- if (override_protection || !is_protected_variable(var TSRMLS_CC)) {
- php_register_variable(var, strval, track_vars_array TSRMLS_CC);
- }
-}
-
-
-static void safe_php_register_variable_ex(char *var, zval *val, zval *track_vars_array, zend_bool override_protection TSRMLS_DC)
-{
- if (override_protection || !is_protected_variable(var TSRMLS_CC)) {
- php_register_variable_ex(var, val, track_vars_array TSRMLS_CC);
- }
-}
-
-
-static void register_http_post_files_variable(char *strvar, char *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC)
-{
- int register_globals = PG(register_globals);
-
- PG(register_globals) = 0;
- safe_php_register_variable(strvar, val, http_post_files, override_protection TSRMLS_CC);
- PG(register_globals) = register_globals;
-}
-
-
-static void register_http_post_files_variable_ex(char *var, zval *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC)
-{
- int register_globals = PG(register_globals);
-
- PG(register_globals) = 0;
- safe_php_register_variable_ex(var, val, http_post_files, override_protection TSRMLS_CC);
- PG(register_globals) = register_globals;
-}
-
-
-static int unlink_filename(char **filename TSRMLS_DC)
-{
- VCWD_UNLINK(*filename);
- return 0;
-}
-
-
-void destroy_uploaded_files_hash(TSRMLS_D)
-{
- zend_hash_apply(SG(rfc1867_uploaded_files), (apply_func_t) unlink_filename TSRMLS_CC);
- zend_hash_destroy(SG(rfc1867_uploaded_files));
- FREE_HASHTABLE(SG(rfc1867_uploaded_files));
-}
-
-
-/*
- * Following code is based on apache_multipart_buffer.c from libapreq-0.33 package.
- *
- */
-
-#define FILLUNIT (1024 * 5)
-
-typedef struct {
-
- /* read buffer */
- char *buffer;
- char *buf_begin;
- int bufsize;
- int bytes_in_buffer;
-
- /* boundary info */
- char *boundary;
- char *boundary_next;
- int boundary_next_len;
-
-} multipart_buffer;
-
-
-typedef struct {
- char *key;
- char *value;
-} mime_header_entry;
-
-
-/*
- fill up the buffer with client data.
- returns number of bytes added to buffer.
-*/
-static int fill_buffer(multipart_buffer *self TSRMLS_DC)
-{
- int bytes_to_read, total_read = 0, actual_read = 0;
-
- /* shift the existing data if necessary */
- if (self->bytes_in_buffer > 0 && self->buf_begin != self->buffer) {
- memmove(self->buffer, self->buf_begin, self->bytes_in_buffer);
- }
-
- self->buf_begin = self->buffer;
-
- /* calculate the free space in the buffer */
- bytes_to_read = self->bufsize - self->bytes_in_buffer;
-
- /* read the required number of bytes */
- while (bytes_to_read > 0) {
-
- char *buf = self->buffer + self->bytes_in_buffer;
-
- actual_read = sapi_module.read_post(buf, bytes_to_read TSRMLS_CC);
-
- /* update the buffer length */
- if (actual_read > 0) {
- self->bytes_in_buffer += actual_read;
- SG(read_post_bytes) += actual_read;
- total_read += actual_read;
- bytes_to_read -= actual_read;
- } else {
- break;
- }
- }
-
- return total_read;
-}
-
-
-/* eof if we are out of bytes, or if we hit the final boundary */
-static int multipart_buffer_eof(multipart_buffer *self TSRMLS_DC)
-{
- if ( (self->bytes_in_buffer == 0 && fill_buffer(self TSRMLS_CC) < 1) ) {
- return 1;
- } else {
- return 0;
- }
-}
-
-
-/* create new multipart_buffer structure */
-static multipart_buffer *multipart_buffer_new(char *boundary, int boundary_len)
-{
- multipart_buffer *self = (multipart_buffer *) ecalloc(1, sizeof(multipart_buffer));
-
- int minsize = boundary_len + 6;
- if (minsize < FILLUNIT) minsize = FILLUNIT;
-
- self->buffer = (char *) ecalloc(1, minsize + 1);
- self->bufsize = minsize;
-
- self->boundary = (char *) ecalloc(1, boundary_len + 3);
- sprintf(self->boundary, "--%s", boundary);
-
- self->boundary_next = (char *) ecalloc(1, boundary_len + 4);
- sprintf(self->boundary_next, "\n--%s", boundary);
- self->boundary_next_len = boundary_len + 3;
-
- self->buf_begin = self->buffer;
- self->bytes_in_buffer = 0;
-
- return self;
-}
-
-
-/*
- gets the next CRLF terminated line from the input buffer.
- if it doesn't find a CRLF, and the buffer isn't completely full, returns
- NULL; otherwise, returns the beginning of the null-terminated line,
- minus the CRLF.
-
- note that we really just look for LF terminated lines. this works
- around a bug in internet explorer for the macintosh which sends mime
- boundaries that are only LF terminated when you use an image submit
- button in a multipart/form-data form.
- */
-static char *next_line(multipart_buffer *self)
-{
- /* look for LF in the data */
- char* line = self->buf_begin;
- char* ptr = memchr(self->buf_begin, '\n', self->bytes_in_buffer);
-
- if (ptr) { /* LF found */
-
- /* terminate the string, remove CRLF */
- if ((ptr - line) > 0 && *(ptr-1) == '\r') {
- *(ptr-1) = 0;
- } else {
- *ptr = 0;
- }
-
- /* bump the pointer */
- self->buf_begin = ptr + 1;
- self->bytes_in_buffer -= (self->buf_begin - line);
-
- } else { /* no LF found */
-
- /* buffer isn't completely full, fail */
- if (self->bytes_in_buffer < self->bufsize) {
- return NULL;
- }
- /* return entire buffer as a partial line */
- line[self->bufsize] = 0;
- self->buf_begin = ptr;
- self->bytes_in_buffer = 0;
- }
-
- return line;
-}
-
-
-/* returns the next CRLF terminated line from the client */
-static char *get_line(multipart_buffer *self TSRMLS_DC)
-{
- char* ptr = next_line(self);
-
- if (!ptr) {
- fill_buffer(self TSRMLS_CC);
- ptr = next_line(self);
- }
-
- return ptr;
-}
-
-
-/* Free header entry */
-static void php_free_hdr_entry(mime_header_entry *h)
-{
- if (h->key) {
- efree(h->key);
- }
- if (h->value) {
- efree(h->value);
- }
-}
-
-
-/* finds a boundary */
-static int find_boundary(multipart_buffer *self, char *boundary TSRMLS_DC)
-{
- char *line;
-
- /* loop thru lines */
- while( (line = get_line(self TSRMLS_CC)) )
- {
- /* finished if we found the boundary */
- if (!strcmp(line, boundary)) {
- return 1;
- }
- }
-
- /* didn't find the boundary */
- return 0;
-}
-
-
-/* parse headers */
-static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header TSRMLS_DC)
-{
- char *line;
- mime_header_entry prev_entry, entry;
- int prev_len, cur_len;
-
- /* didn't find boundary, abort */
- if (!find_boundary(self, self->boundary TSRMLS_CC)) {
- return 0;
- }
-
- /* get lines of text, or CRLF_CRLF */
-
- while( (line = get_line(self TSRMLS_CC)) && strlen(line) > 0 )
- {
- /* add header to table */
-
- char *key = line;
- char *value = NULL;
-
- /* space in the beginning means same header */
- if (!isspace(line[0])) {
- value = strchr(line, ':');
- }
-
- if (value) {
- *value = 0;
- do { value++; } while(isspace(*value));
-
- entry.value = estrdup(value);
- entry.key = estrdup(key);
-
- } else if (zend_llist_count(header)) { /* If no ':' on the line, add to previous line */
-
- prev_len = strlen(prev_entry.value);
- cur_len = strlen(line);
-
- entry.value = emalloc(prev_len + cur_len + 1);
- memcpy(entry.value, prev_entry.value, prev_len);
- memcpy(entry.value + prev_len, line, cur_len);
- entry.value[cur_len + prev_len] = '\0';
-
- entry.key = estrdup(prev_entry.key);
-
- zend_llist_remove_tail(header);
- } else {
- continue;
- }
-
- zend_llist_add_element(header, &entry);
- prev_entry = entry;
- }
-
- return 1;
-}
-
-
-static char *php_mime_get_hdr_value(zend_llist header, char *key)
-{
- mime_header_entry *entry;
-
- if (key == NULL) {
- return NULL;
- }
-
- entry = zend_llist_get_first(&header);
- while (entry) {
- if (!strcasecmp(entry->key, key)) {
- return entry->value;
- }
- entry = zend_llist_get_next(&header);
- }
-
- return NULL;
-}
-
-
-static char *php_ap_getword(char **line, char stop)
-{
- char *pos = *line, quote;
- char *res;
-
- while (*pos && *pos != stop) {
-
- if ((quote = *pos) == '"' || quote == '\'') {
- ++pos;
- while (*pos && *pos != quote) {
- if (*pos == '\\' && pos[1] && pos[1] == quote) {
- pos += 2;
- } else {
- ++pos;
- }
- }
- if (*pos) {
- ++pos;
- }
- } else ++pos;
-
- }
- if (*pos == '\0') {
- res = estrdup(*line);
- *line += strlen(*line);
- return res;
- }
-
- res = estrndup(*line, pos - *line);
-
- while (*pos == stop) {
- ++pos;
- }
-
- *line = pos;
- return res;
-}
-
-
-static char *substring_conf(char *start, int len, char quote TSRMLS_DC)
-{
- char *result = emalloc(len + 2);
- char *resp = result;
- int i;
-
- for (i = 0; i < len; ++i) {
- if (start[i] == '\\' && (start[i + 1] == '\\' || (quote && start[i + 1] == quote))) {
- *resp++ = start[++i];
- } else {
-#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
- if (php_mb_encoding_translation(TSRMLS_C)) {
- size_t j = php_mb_mbchar_bytes(start+i TSRMLS_CC);
- while (j-- > 0 && i < len) {
- *resp++ = start[i++];
- }
- --i;
- } else {
- *resp++ = start[i];
- }
-#else
- *resp++ = start[i];
-#endif
- }
- }
-
- *resp++ = '\0';
- return result;
-}
-
-
-static char *php_ap_getword_conf(char **line TSRMLS_DC)
-{
- char *str = *line, *strend, *res, quote;
-
- while (*str && isspace(*str)) {
- ++str;
- }
-
- if (!*str) {
- *line = str;
- return estrdup("");
- }
-
- if ((quote = *str) == '"' || quote == '\'') {
- strend = str + 1;
- while (*strend && *strend != quote) {
- if (*strend == '\\' && strend[1] && strend[1] == quote) {
- strend += 2;
- } else {
- ++strend;
- }
- }
- res = substring_conf(str + 1, strend - str - 1, quote TSRMLS_CC);
-
- if (*strend == quote) {
- ++strend;
- }
-
- } else {
-
- strend = str;
- while (*strend && !isspace(*strend)) {
- ++strend;
- }
- res = substring_conf(str, strend - str, 0 TSRMLS_CC);
- }
-
- while (*strend && isspace(*strend)) {
- ++strend;
- }
-
- *line = strend;
- return res;
-}
-
-
-/*
- search for a string in a fixed-length byte string.
- if partial is true, partial matches are allowed at the end of the buffer.
- returns NULL if not found, or a pointer to the start of the first match.
-*/
-static void *php_ap_memstr(char *haystack, int haystacklen, char *needle, int needlen, int partial)
-{
- int len = haystacklen;
- char *ptr = haystack;
-
- /* iterate through first character matches */
- while( (ptr = memchr(ptr, needle[0], len)) ) {
-
- /* calculate length after match */
- len = haystacklen - (ptr - (char *)haystack);
-
- /* done if matches up to capacity of buffer */
- if (memcmp(needle, ptr, needlen < len ? needlen : len) == 0 && (partial || len >= needlen)) {
- break;
- }
-
- /* next character */
- ptr++; len--;
- }
-
- return ptr;
-}
-
-
-/* read until a boundary condition */
-static int multipart_buffer_read(multipart_buffer *self, char *buf, int bytes TSRMLS_DC)
-{
- int len, max;
- char *bound;
-
- /* fill buffer if needed */
- if (bytes > self->bytes_in_buffer) {
- fill_buffer(self TSRMLS_CC);
- }
-
- /* look for a potential boundary match, only read data up to that point */
- if ((bound = php_ap_memstr(self->buf_begin, self->bytes_in_buffer, self->boundary_next, self->boundary_next_len, 1))) {
- max = bound - self->buf_begin;
- } else {
- max = self->bytes_in_buffer;
- }
-
- /* maximum number of bytes we are reading */
- len = max < bytes-1 ? max : bytes-1;
-
- /* if we read any data... */
- if (len > 0) {
-
- /* copy the data */
- memcpy(buf, self->buf_begin, len);
- buf[len] = 0;
-
- if (bound && len > 0 && buf[len-1] == '\r') {
- buf[--len] = 0;
- }
-
- /* update the buffer */
- self->bytes_in_buffer -= len;
- self->buf_begin += len;
- }
-
- return len;
-}
-
-
-/*
- XXX: this is horrible memory-usage-wise, but we only expect
- to do this on small pieces of form data.
-*/
-static char *multipart_buffer_read_body(multipart_buffer *self TSRMLS_DC)
-{
- char buf[FILLUNIT], *out=NULL;
- int total_bytes=0, read_bytes=0;
-
- while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf) TSRMLS_CC))) {
- out = erealloc(out, total_bytes + read_bytes + 1);
- memcpy(out + total_bytes, buf, read_bytes);
- total_bytes += read_bytes;
- }
-
- if (out) out[total_bytes] = '\0';
-
- return out;
-}
-
-
-/*
- * The combined READER/HANDLER
- *
- */
-
-SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
-{
- char *boundary, *s=NULL, *boundary_end = NULL, *start_arr=NULL, *array_index=NULL;
- char *temp_filename=NULL, *lbuf=NULL, *abuf=NULL;
- int boundary_len=0, total_bytes=0, cancel_upload=0, is_arr_upload=0, array_len=0, max_file_size=0, skip_upload=0, anonindex=0, is_anonymous;
- zval *http_post_files=NULL;
- zend_bool magic_quotes_gpc;
- multipart_buffer *mbuff;
- zval *array_ptr = (zval *) arg;
- FILE *fp;
- zend_llist header;
-
- if (SG(request_info).content_length > SG(post_max_size)) {
- sapi_module.sapi_error(E_WARNING, "POST Content-Length of %d bytes exceeds the limit of %d bytes", SG(request_info).content_length, SG(post_max_size));
- return;
- }
-
- /* Get the boundary */
- boundary = strstr(content_type_dup, "boundary");
- if (!boundary || !(boundary=strchr(boundary, '='))) {
- sapi_module.sapi_error(E_WARNING, "Missing boundary in multipart/form-data POST data");
- return;
- }
-
- boundary++;
- boundary_len = strlen(boundary);
-
- if (boundary[0] == '"') {
- boundary++;
- boundary_end = strchr(boundary, '"');
- if (!boundary_end) {
- sapi_module.sapi_error(E_WARNING, "Invalid boundary in multipart/form-data POST data");
- return;
- }
- } else {
- /* search for the end of the boundary */
- boundary_end = strchr(boundary, ',');
- }
- if (boundary_end) {
- boundary_end[0] = '\0';
- boundary_len = boundary_end-boundary;
- }
-
- /* Initialize the buffer */
- if (!(mbuff = multipart_buffer_new(boundary, boundary_len))) {
- sapi_module.sapi_error(E_WARNING, "Unable to initialize the input buffer");
- return;
- }
-
- /* Initialize $_FILES[] */
- zend_hash_init(&PG(rfc1867_protected_variables), 5, NULL, NULL, 0);
-
- ALLOC_HASHTABLE(SG(rfc1867_uploaded_files));
- zend_hash_init(SG(rfc1867_uploaded_files), 5, NULL, (dtor_func_t) free_estring, 0);
-
- ALLOC_ZVAL(http_post_files);
- array_init(http_post_files);
- INIT_PZVAL(http_post_files);
- PG(http_globals)[TRACK_VARS_FILES] = http_post_files;
-
- zend_llist_init(&header, sizeof(mime_header_entry), (llist_dtor_func_t) php_free_hdr_entry, 0);
-
- while (!multipart_buffer_eof(mbuff TSRMLS_CC))
- {
- char buff[FILLUNIT];
- char *cd=NULL,*param=NULL,*filename=NULL;
- int blen=0, wlen=0;
-
- zend_llist_clean(&header);
-
- if (!multipart_buffer_headers(mbuff, &header TSRMLS_CC)) {
- SAFE_RETURN;
- }
-
- if ((cd = php_mime_get_hdr_value(header, "Content-Disposition"))) {
- char *pair=NULL;
-
- while (isspace(*cd)) {
- ++cd;
- }
-
- while (*cd && (pair = php_ap_getword(&cd, ';')))
- {
- char *key=NULL, *word = pair;
-
- while (isspace(*cd)) {
- ++cd;
- }
-
- if (strchr(pair, '=')) {
- key = php_ap_getword(&pair, '=');
-
- if (!strcmp(key, "name")) {
- if (param) {
- efree(param);
- }
- param = php_ap_getword_conf(&pair TSRMLS_CC);
- } else if (!strcmp(key, "filename")) {
- if (filename) {
- efree(filename);
- }
- filename = php_ap_getword_conf(&pair TSRMLS_CC);
- }
- }
- if (key) {
- efree(key);
- }
- efree(word);
- }
-
- /* Normal form variable, safe to read all data into memory */
- if (!filename && param) {
-
- char *value = multipart_buffer_read_body(mbuff TSRMLS_CC);
-
- if (!value) {
- value = estrdup("");
- }
-
- sapi_module.input_filter(PARSE_POST, param, &value, strlen(value) TSRMLS_CC);
- safe_php_register_variable(param, value, array_ptr, 0 TSRMLS_CC);
- if (!strcmp(param, "MAX_FILE_SIZE")) {
- max_file_size = atol(value);
- }
-
- efree(param);
- efree(value);
- continue;
- }
-
- /* If file_uploads=off, skip the file part */
- if (!PG(file_uploads)) {
- skip_upload = 1;
- }
-
- /* Return with an error if the posted data is garbled */
- if (!param && !filename) {
- sapi_module.sapi_error(E_WARNING, "File Upload Mime headers garbled");
- SAFE_RETURN;
- }
-
- if (!param) {
- is_anonymous = 1;
- param = emalloc(MAX_SIZE_ANONNAME);
- snprintf(param, MAX_SIZE_ANONNAME, "%u", anonindex++);
- } else {
- is_anonymous = 0;
- }
-
- if (!skip_upload) {
- /* Handle file */
- fp = php_open_temporary_file(PG(upload_tmp_dir), "php", &temp_filename TSRMLS_CC);
- if (!fp) {
- sapi_module.sapi_error(E_WARNING, "File upload error - unable to create a temporary file");
- skip_upload = 1;
- }
- }
- if (skip_upload) {
- efree(param);
- efree(filename);
- continue;
- }
-
- total_bytes = 0;
- cancel_upload = 0;
-
- if(strlen(filename) == 0) {
-#ifdef DEBUG_FILE_UPLOAD
- sapi_module.sapi_error(E_NOTICE, "No file uploaded");
-#endif
- cancel_upload = UPLOAD_ERROR_D;
- }
-
- while (!cancel_upload && (blen = multipart_buffer_read(mbuff, buff, sizeof(buff) TSRMLS_CC)))
- {
- if (PG(upload_max_filesize) > 0 && total_bytes > PG(upload_max_filesize)) {
- sapi_module.sapi_error(E_WARNING, "upload_max_filesize of %ld bytes exceeded - file [%s=%s] not saved", PG(upload_max_filesize), param, filename);
- cancel_upload = UPLOAD_ERROR_A;
- } else if (max_file_size && (total_bytes > max_file_size)) {
- sapi_module.sapi_error(E_WARNING, "MAX_FILE_SIZE of %ld bytes exceeded - file [%s=%s] not saved", max_file_size, param, filename);
- cancel_upload = UPLOAD_ERROR_B;
- } else if (blen > 0) {
- wlen = fwrite(buff, 1, blen, fp);
-
- if (wlen < blen) {
- sapi_module.sapi_error(E_WARNING, "Only %d bytes were written, expected to write %ld", wlen, blen);
- cancel_upload = UPLOAD_ERROR_C;
- } else {
- total_bytes += wlen;
- }
- }
- }
- fclose(fp);
-
-#ifdef DEBUG_FILE_UPLOAD
- if(strlen(filename) > 0 && total_bytes == 0) {
- sapi_module.sapi_error(E_WARNING, "Uploaded file size 0 - file [%s=%s] not saved", param, filename);
- cancel_upload = 5;
- }
-#endif
-
- if (cancel_upload) {
- if (temp_filename) {
- unlink(temp_filename);
- efree(temp_filename);
- }
- temp_filename="";
- } else {
- zend_hash_add(SG(rfc1867_uploaded_files), temp_filename, strlen(temp_filename) + 1, &temp_filename, sizeof(char *), NULL);
- }
-
- /* is_arr_upload is true when name of file upload field
- * ends in [.*]
- * start_arr is set to point to 1st [
- */
- is_arr_upload = (start_arr = strchr(param,'[')) && (param[strlen(param)-1] == ']');
- /* handle unterminated [ */
- if (!is_arr_upload && start_arr) {
- *start_arr = '_';
- }
-
- if (is_arr_upload) {
- array_len = strlen(start_arr);
- if (array_index) {
- efree(array_index);
- }
- array_index = estrndup(start_arr+1, array_len-2);
- }
-
- /* Add $foo_name */
- if (lbuf) {
- efree(lbuf);
- }
- lbuf = (char *) emalloc(strlen(param) + MAX_SIZE_OF_INDEX + 1);
-
- if (is_arr_upload) {
- if (abuf) efree(abuf);
- abuf = estrndup(param, strlen(param)-array_len);
- sprintf(lbuf, "%s_name[%s]", abuf, array_index);
- } else {
- sprintf(lbuf, "%s_name", param);
- }
-
-#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
- if (php_mb_encoding_translation(TSRMLS_C)) {
- s = php_mb_strrchr(filename, '\\' TSRMLS_CC);
- } else {
- s = strrchr(filename, '\\');
- }
-#else
- s = strrchr(filename, '\\');
-#endif
- if (!is_anonymous) {
- if (s && s > filename) {
- safe_php_register_variable(lbuf, s+1, NULL, 0 TSRMLS_CC);
- } else {
- safe_php_register_variable(lbuf, filename, NULL, 0 TSRMLS_CC);
- }
- }
-
- /* Add $foo[name] */
- if (is_arr_upload) {
- sprintf(lbuf, "%s[name][%s]", abuf, array_index);
- } else {
- sprintf(lbuf, "%s[name]", param);
- }
- if (s && s > filename) {
- register_http_post_files_variable(lbuf, s+1, http_post_files, 0 TSRMLS_CC);
- } else {
- register_http_post_files_variable(lbuf, filename, http_post_files, 0 TSRMLS_CC);
- }
- efree(filename);
- s = NULL;
-
- /* Possible Content-Type: */
- if (cancel_upload || !(cd = php_mime_get_hdr_value(header, "Content-Type"))) {
- cd = "";
- } else {
- /* fix for Opera 6.01 */
- s = strchr(cd, ';');
- if (s != NULL) {
- *s = '\0';
- }
- }
-
- /* Add $foo_type */
- if (is_arr_upload) {
- sprintf(lbuf, "%s_type[%s]", abuf, array_index);
- } else {
- sprintf(lbuf, "%s_type", param);
- }
- if (!is_anonymous) {
- safe_php_register_variable(lbuf, cd, NULL, 0 TSRMLS_CC);
- }
-
- /* Add $foo[type] */
- if (is_arr_upload) {
- sprintf(lbuf, "%s[type][%s]", abuf, array_index);
- } else {
- sprintf(lbuf, "%s[type]", param);
- }
- register_http_post_files_variable(lbuf, cd, http_post_files, 0 TSRMLS_CC);
-
- /* Restore Content-Type Header */
- if (s != NULL) {
- *s = ';';
- }
- s = "";
-
- /* Initialize variables */
- add_protected_variable(param TSRMLS_CC);
-
- magic_quotes_gpc = PG(magic_quotes_gpc);
- PG(magic_quotes_gpc) = 0;
- /* if param is of form xxx[.*] this will cut it to xxx */
- if (!is_anonymous) {
- safe_php_register_variable(param, temp_filename, NULL, 1 TSRMLS_CC);
- }
-
- /* Add $foo[tmp_name] */
- if (is_arr_upload) {
- sprintf(lbuf, "%s[tmp_name][%s]", abuf, array_index);
- } else {
- sprintf(lbuf, "%s[tmp_name]", param);
- }
- add_protected_variable(lbuf TSRMLS_CC);
- register_http_post_files_variable(lbuf, temp_filename, http_post_files, 1 TSRMLS_CC);
-
- PG(magic_quotes_gpc) = magic_quotes_gpc;
-
- {
- zval file_size, error_type;
-
- error_type.value.lval = cancel_upload;
- error_type.type = IS_LONG;
-
- /* Add $foo[error] */
- if (cancel_upload) {
- file_size.value.lval = 0;
- file_size.type = IS_LONG;
- } else {
- file_size.value.lval = total_bytes;
- file_size.type = IS_LONG;
- }
-
- if (is_arr_upload) {
- sprintf(lbuf, "%s[error][%s]", abuf, array_index);
- } else {
- sprintf(lbuf, "%s[error]", param);
- }
- register_http_post_files_variable_ex(lbuf, &error_type, http_post_files, 0 TSRMLS_CC);
-
- /* Add $foo_size */
- if (is_arr_upload) {
- sprintf(lbuf, "%s_size[%s]", abuf, array_index);
- } else {
- sprintf(lbuf, "%s_size", param);
- }
- if (!is_anonymous) {
- safe_php_register_variable_ex(lbuf, &file_size, NULL, 0 TSRMLS_CC);
- }
-
- /* Add $foo[size] */
- if (is_arr_upload) {
- sprintf(lbuf, "%s[size][%s]", abuf, array_index);
- } else {
- sprintf(lbuf, "%s[size]", param);
- }
- register_http_post_files_variable_ex(lbuf, &file_size, http_post_files, 0 TSRMLS_CC);
- }
- efree(param);
- }
- }
-
- SAFE_RETURN;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/rfc1867.h b/main/rfc1867.h
deleted file mode 100644
index d1c8c7749f..0000000000
--- a/main/rfc1867.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef RFC1867_H
-#define RFC1867_H
-
-#include "SAPI.h"
-
-#define MULTIPART_CONTENT_TYPE "multipart/form-data"
-
-SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler);
-
-void destroy_uploaded_files_hash(TSRMLS_D);
-void php_rfc1867_register_constants(TSRMLS_D);
-
-#endif /* RFC1867_H */
diff --git a/main/safe_mode.c b/main/safe_mode.c
deleted file mode 100644
index c7e3fd7abe..0000000000
--- a/main/safe_mode.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-#include "ext/standard/pageinfo.h"
-#include "safe_mode.h"
-#include "SAPI.h"
-#include "php_globals.h"
-
-/*
- * php_checkuid
- *
- * This function has six modes:
- *
- * 0 - return invalid (0) if file does not exist
- * 1 - return valid (1) if file does not exist
- * 2 - if file does not exist, check directory
- * 3 - only check directory (needed for mkdir)
- * 4 - check mode and param
- * 5 - only check file
- */
-
-PHPAPI int php_checkuid_ex(const char *filename, char *fopen_mode, int mode, int flags)
-{
- struct stat sb;
- int ret, nofile=0;
- long uid=0L, gid=0L, duid=0L, dgid=0L;
- char path[MAXPATHLEN];
- char *s, filenamecopy[MAXPATHLEN];
- php_stream_wrapper *wrapper = NULL;
- TSRMLS_FETCH();
-
- strlcpy(filenamecopy, filename, MAXPATHLEN);
- filename=(char *)&filenamecopy;
-
- if (!filename) {
- return 0; /* path must be provided */
- }
-
- if (fopen_mode) {
- if (fopen_mode[0] == 'r') {
- mode = CHECKUID_DISALLOW_FILE_NOT_EXISTS;
- } else {
- mode = CHECKUID_CHECK_FILE_AND_DIR;
- }
- }
-
- /*
- * If given filepath is a URL, allow - safe mode stuff
- * related to URL's is checked in individual functions
- */
- wrapper = php_stream_locate_url_wrapper(filename, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC);
- if (wrapper != NULL)
- return 1;
-
- /* First we see if the file is owned by the same user...
- * If that fails, passthrough and check directory...
- */
- if (mode != CHECKUID_ALLOW_ONLY_DIR) {
- VCWD_REALPATH(filename, path);
- ret = VCWD_STAT(path, &sb);
- if (ret < 0) {
- if (mode == CHECKUID_DISALLOW_FILE_NOT_EXISTS) {
- if ((flags & CHECKUID_NO_ERRORS) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to access %s", filename);
- }
- return 0;
- } else if (mode == CHECKUID_ALLOW_FILE_NOT_EXISTS) {
- if ((flags & CHECKUID_NO_ERRORS) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to access %s", filename);
- }
- return 1;
- }
- nofile = 1;
- } else {
- uid = sb.st_uid;
- gid = sb.st_gid;
- if (uid == php_getuid()) {
- return 1;
- } else if (PG(safe_mode_gid) && gid == php_getgid()) {
- return 1;
- }
- }
-
- /* Trim off filename */
- if ((s = strrchr(path, DEFAULT_SLASH))) {
- if (s == path)
- path[1] = '\0';
- else
- *s = '\0';
- }
- } else { /* CHECKUID_ALLOW_ONLY_DIR */
- s = strrchr(filename, DEFAULT_SLASH);
-
- if (s == filename) {
- /* root dir */
- path[0] = DEFAULT_SLASH;
- path[1] = '\0';
- } else if (s) {
- *s = '\0';
- VCWD_REALPATH(filename, path);
- *s = DEFAULT_SLASH;
- } else {
- /* Under Solaris, getcwd() can fail if there are no
- * read permissions on a component of the path, even
- * though it has the required x permissions */
- path[0] = '.';
- path[1] = '\0';
- VCWD_GETCWD(path, sizeof(path));
- }
- } /* end CHECKUID_ALLOW_ONLY_DIR */
-
- if (mode != CHECKUID_ALLOW_ONLY_FILE) {
- /* check directory */
- ret = VCWD_STAT(path, &sb);
- if (ret < 0) {
- if ((flags & CHECKUID_NO_ERRORS) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to access %s", filename);
- }
- return 0;
- }
- duid = sb.st_uid;
- dgid = sb.st_gid;
- if (duid == php_getuid()) {
- return 1;
- } else if (PG(safe_mode_gid) && dgid == php_getgid()) {
- return 1;
- } else {
- TSRMLS_FETCH();
-
- if (SG(rfc1867_uploaded_files)) {
- if (zend_hash_exists(SG(rfc1867_uploaded_files), (char *) filename, strlen(filename)+1)) {
- return 1;
- }
- }
- }
- }
-
- if (mode == CHECKUID_ALLOW_ONLY_DIR) {
- uid = duid;
- gid = dgid;
- if (s) {
- *s = 0;
- }
- }
-
- if (nofile) {
- uid = duid;
- gid = dgid;
- filename = path;
- }
-
- if ((flags & CHECKUID_NO_ERRORS) == 0) {
- if (PG(safe_mode_gid)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SAFE MODE Restriction in effect. The script whose uid/gid is %ld/%ld is not allowed to access %s owned by uid/gid %ld/%ld", php_getuid(), php_getgid(), filename, uid, gid);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SAFE MODE Restriction in effect. The script whose uid is %ld is not allowed to access %s owned by uid %ld", php_getuid(), filename, uid);
- }
- }
-
- return 0;
-}
-
-PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode) {
- return php_checkuid_ex(filename, fopen_mode, mode, 0);
-}
-
-PHPAPI char *php_get_current_user()
-{
- struct passwd *pwd;
- struct stat *pstat;
- TSRMLS_FETCH();
-
- if (SG(request_info).current_user) {
- return SG(request_info).current_user;
- }
-
- /* FIXME: I need to have this somehow handled if
- USE_SAPI is defined, because cgi will also be
- interfaced in USE_SAPI */
-
- pstat = sapi_get_stat(TSRMLS_C);
-
- if (!pstat) {
- return empty_string;
- }
-
- if ((pwd=getpwuid(pstat->st_uid))==NULL) {
- return empty_string;
- }
- SG(request_info).current_user_length = strlen(pwd->pw_name);
- SG(request_info).current_user = estrndup(pwd->pw_name, SG(request_info).current_user_length);
-
- return SG(request_info).current_user;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/safe_mode.h b/main/safe_mode.h
deleted file mode 100644
index 4e4d01848b..0000000000
--- a/main/safe_mode.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef SAFE_MODE_H
-#define SAFE_MODE_H
-
-/* mode's for php_checkuid() */
-#define CHECKUID_DISALLOW_FILE_NOT_EXISTS 0
-#define CHECKUID_ALLOW_FILE_NOT_EXISTS 1
-#define CHECKUID_CHECK_FILE_AND_DIR 2
-#define CHECKUID_ALLOW_ONLY_DIR 3
-#define CHECKUID_CHECK_MODE_PARAM 4
-#define CHECKUID_ALLOW_ONLY_FILE 5
-
-/* flags for php_checkuid_ex() */
-#define CHECKUID_NO_ERRORS 0x01
-
-extern PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode);
-extern PHPAPI int php_checkuid_ex(const char *filename, char *fopen_mode, int mode, int flags);
-extern PHPAPI char *php_get_current_user(void);
-
-#endif
diff --git a/main/snprintf.c b/main/snprintf.c
deleted file mode 100644
index a43f362ab6..0000000000
--- a/main/snprintf.c
+++ /dev/null
@@ -1,965 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* ====================================================================
- * Copyright (c) 1995-1998 The Apache Group. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission.
- *
- * 5. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Group and was originally based
- * on public domain software written at the National Center for
- * Supercomputing Applications, University of Illinois, Urbana-Champaign.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- * This code is based on, and used with the permission of, the
- * SIO stdio-replacement strx_* functions by Panos Tsirigotis
- * <panos@alumni.cs.colorado.edu> for xinetd.
- */
-
-#include "php.h"
-
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
-#include <math.h>
-
-#define FALSE 0
-#define TRUE 1
-#define NUL '\0'
-#define INT_NULL ((int *)0)
-
-#define S_NULL "(null)"
-#define S_NULL_LEN 6
-
-#define FLOAT_DIGITS 6
-#define EXPONENT_LENGTH 10
-
-
-/*
- * Convert num to its decimal format.
- * Return value:
- * - a pointer to a string containing the number (no sign)
- * - len contains the length of the string
- * - is_negative is set to TRUE or FALSE depending on the sign
- * of the number (always set to FALSE if is_unsigned is TRUE)
- *
- * The caller provides a buffer for the string: that is the buf_end argument
- * which is a pointer to the END of the buffer + 1 (i.e. if the buffer
- * is declared as buf[ 100 ], buf_end should be &buf[ 100 ])
- */
-char *
-ap_php_conv_10(register wide_int num, register bool_int is_unsigned,
- register bool_int * is_negative, char *buf_end, register int *len)
-{
- register char *p = buf_end;
- register u_wide_int magnitude;
-
- if (is_unsigned) {
- magnitude = (u_wide_int) num;
- *is_negative = FALSE;
- } else {
- *is_negative = (num < 0);
-
- /*
- * On a 2's complement machine, negating the most negative integer
- * results in a number that cannot be represented as a signed integer.
- * Here is what we do to obtain the number's magnitude:
- * a. add 1 to the number
- * b. negate it (becomes positive)
- * c. convert it to unsigned
- * d. add 1
- */
- if (*is_negative) {
- wide_int t = num + 1;
-
- magnitude = ((u_wide_int) - t) + 1;
- } else
- magnitude = (u_wide_int) num;
- }
-
- /*
- * We use a do-while loop so that we write at least 1 digit
- */
- do {
- register u_wide_int new_magnitude = magnitude / 10;
-
- *--p = (char)(magnitude - new_magnitude * 10 + '0');
- magnitude = new_magnitude;
- }
- while (magnitude);
-
- *len = buf_end - p;
- return (p);
-}
-
-#define NDIG 80
-
-
-/*
- * Convert a floating point number to a string formats 'f', 'e' or 'E'.
- * The result is placed in buf, and len denotes the length of the string
- * The sign is returned in the is_negative argument (and is not placed
- * in buf).
- */
-char *
- ap_php_conv_fp(register char format, register double num,
- boolean_e add_dp, int precision, bool_int * is_negative, char *buf, int *len)
-{
- register char *s = buf;
- register char *p;
- int decimal_point;
- char buf1[NDIG];
-
- if (format == 'f')
- p = ap_php_fcvt(num, precision, &decimal_point, is_negative, buf1);
- else /* either e or E format */
- p = ap_php_ecvt(num, precision + 1, &decimal_point, is_negative, buf1);
-
- /*
- * Check for Infinity and NaN
- */
- if (isalpha((int)*p)) {
- *len = strlen(p);
- memcpy(buf, p, *len + 1);
- *is_negative = FALSE;
- return (buf);
- }
- if (format == 'f') {
- if (decimal_point <= 0) {
- *s++ = '0';
- if (precision > 0) {
- *s++ = '.';
- while (decimal_point++ < 0)
- *s++ = '0';
- } else if (add_dp) {
- *s++ = '.';
- }
- } else {
- while (decimal_point-- > 0) {
- *s++ = *p++;
- }
- if (precision > 0 || add_dp) {
- *s++ = '.';
- }
- }
- } else {
- *s++ = *p++;
- if (precision > 0 || add_dp)
- *s++ = '.';
- }
-
- /*
- * copy the rest of p, the NUL is NOT copied
- */
- while (*p)
- *s++ = *p++;
-
- if (format != 'f') {
- char temp[EXPONENT_LENGTH]; /* for exponent conversion */
- int t_len;
- bool_int exponent_is_negative;
-
- *s++ = format; /* either e or E */
- decimal_point--;
- if (decimal_point != 0) {
- p = ap_php_conv_10((wide_int) decimal_point, FALSE, &exponent_is_negative,
- &temp[EXPONENT_LENGTH], &t_len);
- *s++ = exponent_is_negative ? '-' : '+';
-
- /*
- * Make sure the exponent has at least 2 digits
- */
- if (t_len == 1)
- *s++ = '0';
- while (t_len--)
- *s++ = *p++;
- } else {
- *s++ = '+';
- *s++ = '0';
- *s++ = '0';
- }
- }
- *len = s - buf;
- return (buf);
-}
-
-
-/*
- * Convert num to a base X number where X is a power of 2. nbits determines X.
- * For example, if nbits is 3, we do base 8 conversion
- * Return value:
- * a pointer to a string containing the number
- *
- * The caller provides a buffer for the string: that is the buf_end argument
- * which is a pointer to the END of the buffer + 1 (i.e. if the buffer
- * is declared as buf[ 100 ], buf_end should be &buf[ 100 ])
- */
-char *
- ap_php_conv_p2(register u_wide_int num, register int nbits,
- char format, char *buf_end, register int *len)
-{
- register int mask = (1 << nbits) - 1;
- register char *p = buf_end;
- static char low_digits[] = "0123456789abcdef";
- static char upper_digits[] = "0123456789ABCDEF";
- register char *digits = (format == 'X') ? upper_digits : low_digits;
-
- do {
- *--p = digits[num & mask];
- num >>= nbits;
- }
- while (num);
-
- *len = buf_end - p;
- return (p);
-}
-
-/*
- * cvt.c - IEEE floating point formatting routines for FreeBSD
- * from GNU libc-4.6.27
- */
-
-/*
- * ap_php_ecvt converts to decimal
- * the number of digits is specified by ndigit
- * decpt is set to the position of the decimal point
- * sign is set to 0 for positive, 1 for negative
- */
-
-
-char *
-ap_php_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag, char *buf)
-{
- register int r2;
- double fi, fj;
- register char *p, *p1;
-
- if (ndigits >= NDIG - 1)
- ndigits = NDIG - 2;
- r2 = 0;
- *sign = 0;
- p = &buf[0];
- if (arg < 0) {
- *sign = 1;
- arg = -arg;
- }
- arg = modf(arg, &fi);
- p1 = &buf[NDIG];
- /*
- * Do integer part
- */
- if (fi != 0) {
- p1 = &buf[NDIG];
- while (p1 > &buf[0] && fi != 0) {
- fj = modf(fi / 10, &fi);
- *--p1 = (int) ((fj + .03) * 10) + '0';
- r2++;
- }
- while (p1 < &buf[NDIG])
- *p++ = *p1++;
- } else if (arg > 0) {
- while ((fj = arg * 10) < 1) {
- if (!eflag && (r2 * -1) < ndigits) {
- break;
- }
- arg = fj;
- r2--;
- }
- }
- p1 = &buf[ndigits];
- if (eflag == 0)
- p1 += r2;
- *decpt = r2;
- if (p1 < &buf[0]) {
- buf[0] = '\0';
- return (buf);
- }
- while (p <= p1 && p < &buf[NDIG]) {
- arg = modf(arg * 10, &fj);
- *p++ = (int) fj + '0';
- }
- if (p1 >= &buf[NDIG]) {
- buf[NDIG - 1] = '\0';
- return (buf);
- }
- p = p1;
- *p1 += 5;
- while (*p1 > '9') {
- *p1 = '0';
- if (p1 > buf)
- ++ * --p1;
- else {
- *p1 = '1';
- (*decpt)++;
- if (eflag == 0) {
- if (p > buf)
- *p = '0';
- p++;
- }
- }
- }
- *p = '\0';
- return (buf);
-}
-
-char *
-ap_php_ecvt(double arg, int ndigits, int *decpt, int *sign, char *buf)
-{
- return (ap_php_cvt(arg, ndigits, decpt, sign, 1, buf));
-}
-
-char *
-ap_php_fcvt(double arg, int ndigits, int *decpt, int *sign, char *buf)
-{
- return (ap_php_cvt(arg, ndigits, decpt, sign, 0, buf));
-}
-
-/*
- * ap_php_gcvt - Floating output conversion to
- * minimal length string
- */
-
-char *
-ap_php_gcvt(double number, int ndigit, char *buf, boolean_e altform)
-{
- int sign, decpt;
- register char *p1, *p2;
- register int i;
- char buf1[NDIG];
-
- if (ndigit >= NDIG - 1) {
- ndigit = NDIG - 2;
- }
-
- p1 = ap_php_ecvt(number, ndigit, &decpt, &sign, buf1);
- p2 = buf;
- if (sign)
- *p2++ = '-';
- for (i = ndigit - 1; i > 0 && p1[i] == '0'; i--)
- ndigit--;
- if ((decpt >= 0 && decpt - ndigit > 4)
- || (decpt < 0 && decpt < -3)) { /* use E-style */
- decpt--;
- *p2++ = *p1++;
- *p2++ = '.';
- for (i = 1; i < ndigit; i++)
- *p2++ = *p1++;
- *p2++ = 'e';
- if (decpt < 0) {
- decpt = -decpt;
- *p2++ = '-';
- } else
- *p2++ = '+';
- if (decpt / 100 > 0)
- *p2++ = decpt / 100 + '0';
- if (decpt / 10 > 0)
- *p2++ = (decpt % 100) / 10 + '0';
- *p2++ = decpt % 10 + '0';
- } else {
- if (decpt <= 0) {
- if (*p1 != '0') {
- *p2++ = '0';
- *p2++ = '.';
- }
- while (decpt < 0) {
- decpt++;
- *p2++ = '0';
- }
- }
- for (i = 1; i <= ndigit; i++) {
- *p2++ = *p1++;
- if (i == decpt)
- *p2++ = '.';
- }
- if (ndigit < decpt) {
- while (ndigit++ < decpt)
- *p2++ = '0';
- *p2++ = '.';
- }
- }
- if (p2[-1] == '.' && !altform)
- p2--;
- *p2 = '\0';
- return (buf);
-}
-
-#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) || PHP_BROKEN_SNPRINTF || PHP_BROKEN_VSNPRINTF
-
-/*
- * NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions
- *
- * XXX: this is a magic number; do not decrease it
- */
-#define NUM_BUF_SIZE 512
-
-
-/*
- * Descriptor for buffer area
- */
-struct buf_area {
- char *buf_end;
- char *nextb; /* pointer to next byte to read/write */
-};
-
-typedef struct buf_area buffy;
-
-/*
- * The INS_CHAR macro inserts a character in the buffer and writes
- * the buffer back to disk if necessary
- * It uses the char pointers sp and bep:
- * sp points to the next available character in the buffer
- * bep points to the end-of-buffer+1
- * While using this macro, note that the nextb pointer is NOT updated.
- *
- * NOTE: Evaluation of the c argument should not have any side-effects
- */
-#define INS_CHAR(c, sp, bep, cc) \
- { \
- if (sp < bep) \
- { \
- *sp++ = c; \
- } \
- cc++; \
- }
-
-#define NUM( c ) ( c - '0' )
-
-#define STR_TO_DEC( str, num ) \
- num = NUM( *str++ ) ; \
- while ( isdigit((int)*str ) ) \
- { \
- num *= 10 ; \
- num += NUM( *str++ ) ; \
- }
-
-/*
- * This macro does zero padding so that the precision
- * requirement is satisfied. The padding is done by
- * adding '0's to the left of the string that is going
- * to be printed.
- */
-#define FIX_PRECISION( adjust, precision, s, s_len ) \
- if ( adjust ) \
- while ( s_len < precision ) \
- { \
- *--s = '0' ; \
- s_len++ ; \
- }
-
-/*
- * Macro that does padding. The padding is done by printing
- * the character ch.
- */
-#define PAD( width, len, ch ) do \
- { \
- INS_CHAR( ch, sp, bep, cc ) ; \
- width-- ; \
- } \
- while ( width > len )
-
-/*
- * Prefix the character ch to the string str
- * Increase length
- * Set the has_prefix flag
- */
-#define PREFIX( str, length, ch ) *--str = ch ; length++ ; has_prefix = YES
-
-
-/*
- * Do format conversion placing the output in buffer
- */
-static int format_converter(register buffy * odp, const char *fmt,
- va_list ap)
-{
- register char *sp;
- register char *bep;
- register int cc = 0;
- register int i;
-
- register char *s = NULL;
- char *q;
- int s_len;
-
- register int min_width = 0;
- int precision = 0;
- enum {
- LEFT, RIGHT
- } adjust;
- char pad_char;
- char prefix_char;
-
- double fp_num;
- wide_int i_num = (wide_int) 0;
- u_wide_int ui_num;
-
- char num_buf[NUM_BUF_SIZE];
- char char_buf[2]; /* for printing %% and %<unknown> */
-
- /*
- * Flag variables
- */
- boolean_e is_long;
- boolean_e alternate_form;
- boolean_e print_sign;
- boolean_e print_blank;
- boolean_e adjust_precision;
- boolean_e adjust_width;
- bool_int is_negative;
-
- sp = odp->nextb;
- bep = odp->buf_end;
-
- while (*fmt) {
- if (*fmt != '%') {
- INS_CHAR(*fmt, sp, bep, cc);
- } else {
- /*
- * Default variable settings
- */
- adjust = RIGHT;
- alternate_form = print_sign = print_blank = NO;
- pad_char = ' ';
- prefix_char = NUL;
-
- fmt++;
-
- /*
- * Try to avoid checking for flags, width or precision
- */
- if (isascii((int)*fmt) && !islower((int)*fmt)) {
- /*
- * Recognize flags: -, #, BLANK, +
- */
- for (;; fmt++) {
- if (*fmt == '-')
- adjust = LEFT;
- else if (*fmt == '+')
- print_sign = YES;
- else if (*fmt == '#')
- alternate_form = YES;
- else if (*fmt == ' ')
- print_blank = YES;
- else if (*fmt == '0')
- pad_char = '0';
- else
- break;
- }
-
- /*
- * Check if a width was specified
- */
- if (isdigit((int)*fmt)) {
- STR_TO_DEC(fmt, min_width);
- adjust_width = YES;
- } else if (*fmt == '*') {
- min_width = va_arg(ap, int);
- fmt++;
- adjust_width = YES;
- if (min_width < 0) {
- adjust = LEFT;
- min_width = -min_width;
- }
- } else
- adjust_width = NO;
-
- /*
- * Check if a precision was specified
- *
- * XXX: an unreasonable amount of precision may be specified
- * resulting in overflow of num_buf. Currently we
- * ignore this possibility.
- */
- if (*fmt == '.') {
- adjust_precision = YES;
- fmt++;
- if (isdigit((int)*fmt)) {
- STR_TO_DEC(fmt, precision);
- } else if (*fmt == '*') {
- precision = va_arg(ap, int);
- fmt++;
- if (precision < 0)
- precision = 0;
- } else
- precision = 0;
- } else
- adjust_precision = NO;
- } else
- adjust_precision = adjust_width = NO;
-
- /*
- * Modifier check
- */
- if (*fmt == 'l') {
- is_long = YES;
- fmt++;
- } else
- is_long = NO;
-
- /*
- * Argument extraction and printing.
- * First we determine the argument type.
- * Then, we convert the argument to a string.
- * On exit from the switch, s points to the string that
- * must be printed, s_len has the length of the string
- * The precision requirements, if any, are reflected in s_len.
- *
- * NOTE: pad_char may be set to '0' because of the 0 flag.
- * It is reset to ' ' by non-numeric formats
- */
- switch (*fmt) {
- case 'u':
- if (is_long)
- i_num = va_arg(ap, u_wide_int);
- else
- i_num = (wide_int) va_arg(ap, unsigned int);
- /*
- * The rest also applies to other integer formats, so fall
- * into that case.
- */
- case 'd':
- case 'i':
- /*
- * Get the arg if we haven't already.
- */
- if ((*fmt) != 'u') {
- if (is_long)
- i_num = va_arg(ap, wide_int);
- else
- i_num = (wide_int) va_arg(ap, int);
- };
- s = ap_php_conv_10(i_num, (*fmt) == 'u', &is_negative,
- &num_buf[NUM_BUF_SIZE], &s_len);
- FIX_PRECISION(adjust_precision, precision, s, s_len);
-
- if (*fmt != 'u') {
- if (is_negative)
- prefix_char = '-';
- else if (print_sign)
- prefix_char = '+';
- else if (print_blank)
- prefix_char = ' ';
- }
- break;
-
-
- case 'o':
- if (is_long)
- ui_num = va_arg(ap, u_wide_int);
- else
- ui_num = (u_wide_int) va_arg(ap, unsigned int);
- s = ap_php_conv_p2(ui_num, 3, *fmt,
- &num_buf[NUM_BUF_SIZE], &s_len);
- FIX_PRECISION(adjust_precision, precision, s, s_len);
- if (alternate_form && *s != '0') {
- *--s = '0';
- s_len++;
- }
- break;
-
-
- case 'x':
- case 'X':
- if (is_long)
- ui_num = (u_wide_int) va_arg(ap, u_wide_int);
- else
- ui_num = (u_wide_int) va_arg(ap, unsigned int);
- s = ap_php_conv_p2(ui_num, 4, *fmt,
- &num_buf[NUM_BUF_SIZE], &s_len);
- FIX_PRECISION(adjust_precision, precision, s, s_len);
- if (alternate_form && i_num != 0) {
- *--s = *fmt; /* 'x' or 'X' */
- *--s = '0';
- s_len += 2;
- }
- break;
-
-
- case 's':
- s = va_arg(ap, char *);
- if (s != NULL) {
- s_len = strlen(s);
- if (adjust_precision && precision < s_len)
- s_len = precision;
- } else {
- s = S_NULL;
- s_len = S_NULL_LEN;
- }
- pad_char = ' ';
- break;
-
-
- case 'f':
- case 'e':
- case 'E':
- fp_num = va_arg(ap, double);
-
- if (zend_isnan(fp_num)) {
- s = "nan";
- s_len = 3;
- } else if (zend_isinf(fp_num)) {
- s = "inf";
- s_len = 3;
- } else {
- s = ap_php_conv_fp(*fmt, fp_num, alternate_form,
- (adjust_precision == NO) ? FLOAT_DIGITS : precision,
- &is_negative, &num_buf[1], &s_len);
- if (is_negative)
- prefix_char = '-';
- else if (print_sign)
- prefix_char = '+';
- else if (print_blank)
- prefix_char = ' ';
- }
- break;
-
-
- case 'g':
- case 'G':
- if (adjust_precision == NO)
- precision = FLOAT_DIGITS;
- else if (precision == 0)
- precision = 1;
- /*
- * * We use &num_buf[ 1 ], so that we have room for the sign
- */
- s = ap_php_gcvt(va_arg(ap, double), precision, &num_buf[1],
- alternate_form);
- if (*s == '-')
- prefix_char = *s++;
- else if (print_sign)
- prefix_char = '+';
- else if (print_blank)
- prefix_char = ' ';
-
- s_len = strlen(s);
-
- if (alternate_form && (q = strchr(s, '.')) == NULL)
- s[s_len++] = '.';
- if (*fmt == 'G' && (q = strchr(s, 'e')) != NULL)
- *q = 'E';
- break;
-
-
- case 'c':
- char_buf[0] = (char) (va_arg(ap, int));
- s = &char_buf[0];
- s_len = 1;
- pad_char = ' ';
- break;
-
-
- case '%':
- char_buf[0] = '%';
- s = &char_buf[0];
- s_len = 1;
- pad_char = ' ';
- break;
-
-
- case 'n':
- *(va_arg(ap, int *)) = cc;
- break;
-
- /*
- * Always extract the argument as a "char *" pointer. We
- * should be using "void *" but there are still machines
- * that don't understand it.
- * If the pointer size is equal to the size of an unsigned
- * integer we convert the pointer to a hex number, otherwise
- * we print "%p" to indicate that we don't handle "%p".
- */
- case 'p':
- ui_num = (u_wide_int) va_arg(ap, char *);
-
- if (sizeof(char *) <= sizeof(u_wide_int))
- s = ap_php_conv_p2(ui_num, 4, 'x',
- &num_buf[NUM_BUF_SIZE], &s_len);
- else {
- s = "%p";
- s_len = 2;
- }
- pad_char = ' ';
- break;
-
-
- case NUL:
- /*
- * The last character of the format string was %.
- * We ignore it.
- */
- continue;
-
-
- /*
- * The default case is for unrecognized %'s.
- * We print %<char> to help the user identify what
- * option is not understood.
- * This is also useful in case the user wants to pass
- * the output of format_converter to another function
- * that understands some other %<char> (like syslog).
- * Note that we can't point s inside fmt because the
- * unknown <char> could be preceded by width etc.
- */
- default:
- char_buf[0] = '%';
- char_buf[1] = *fmt;
- s = char_buf;
- s_len = 2;
- pad_char = ' ';
- break;
- }
-
- if (prefix_char != NUL) {
- *--s = prefix_char;
- s_len++;
- }
- if (adjust_width && adjust == RIGHT && min_width > s_len) {
- if (pad_char == '0' && prefix_char != NUL) {
- INS_CHAR(*s, sp, bep, cc)
- s++;
- s_len--;
- min_width--;
- }
- PAD(min_width, s_len, pad_char);
- }
- /*
- * Print the string s.
- */
- for (i = s_len; i != 0; i--) {
- INS_CHAR(*s, sp, bep, cc);
- s++;
- }
-
- if (adjust_width && adjust == LEFT && min_width > s_len)
- PAD(min_width, s_len, pad_char);
- }
- fmt++;
- }
- odp->nextb = sp;
- return (cc);
-}
-
-
-/*
- * This is the general purpose conversion function.
- */
-static void strx_printv(int *ccp, char *buf, size_t len, const char *format,
- va_list ap)
-{
- buffy od;
- int cc;
-
- /*
- * First initialize the descriptor
- * Notice that if no length is given, we initialize buf_end to the
- * highest possible address.
- */
- if (len == 0) {
- od.buf_end = (char *) ~0;
- od.nextb = (char *) ~0;
- } else {
- od.buf_end = &buf[len-1];
- od.nextb = buf;
- }
-
- /*
- * Do the conversion
- */
- cc = format_converter(&od, format, ap);
- if (len != 0 && od.nextb <= od.buf_end)
- *(od.nextb) = '\0';
- if (ccp)
- *ccp = cc;
-}
-
-
-int ap_php_snprintf(char *buf, size_t len, const char *format,...)
-{
- int cc;
- va_list ap;
-
- va_start(ap, format);
- strx_printv(&cc, buf, len, format, ap);
- va_end(ap);
- return (cc);
-}
-
-
-int ap_php_vsnprintf(char *buf, size_t len, const char *format, va_list ap)
-{
- int cc;
-
- strx_printv(&cc, buf, len, format, ap);
- return (cc);
-}
-
-#endif /* HAVE_SNPRINTF */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/snprintf.h b/main/snprintf.h
deleted file mode 100644
index 5468f4230c..0000000000
--- a/main/snprintf.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
-
-Comparing: sprintf, snprintf, spprintf
-
-sprintf offers the ability to make a lot of failures since it does not know
- the size of the buffer it uses. Therefore usage of sprintf often
- results in possible entries for buffer overrun attacks. So please
- use this version only if you are sure the call is safe. sprintf
- allways terminstes the buffer it writes to.
-
-snprintf knows the buffers size and will not write behind it. But you will
- have to use either a static buffer or allocate a dynamic buffer
- before beeing able to call the function. In other words you must
- be sure that you really know the maximum size of the buffer required.
- A bad thing is having a big maximum while in most cases you would
- only need a small buffer. If the size of the resulting string is
- longer or equal to the buffer size than the buffer is not terminated.
-
-spprintf is the dynamical version of snprintf. It allocates the buffer in size
- as needed and allows a maximum setting as snprintf (turn this feature
- off by setting max_len to 0). spprintf is a little bit slower than
- snprintf and offers possible memory leakes if you miss freeing the
- buffer allocated by the function. Therfore this function should be
- used where either no maximum is known or the maximum is much bigger
- than normal size required. spprintf allways terminates the buffer.
-
-Example:
-
- #define MAX 1024 | #define MAX 1024 | #define MAX 1024
- char buffer[MAX] | char buffer[MAX] | char *buffer;
- | |
- | | // No need to initialize buffer:
- | | // spprintf ignores value of buffer
- sprintf(buffer, "test"); | snprintf(buffer, MAX, "test"); | spprintf(&buffer, MAX, "text");
- | | if (!buffer)
- | | return OUT_OF_MEMORY
- // sprintf allways terminates | // manual termination of | // spprintf allays terminates buffer
- // buffer | // buffer *IS* required |
- | buffer[MAX-1] = 0; |
- action_with_buffer(buffer); | action_with_buffer(buffer); | action_with_buffer(buffer);
- | | efree(buffer);
-*/
-
-#ifndef SNPRINTF_H
-#define SNPRINTF_H
-
-#if !defined(HAVE_SNPRINTF) || PHP_BROKEN_SNPRINTF
-extern int ap_php_snprintf(char *, size_t, const char *, ...);
-#define snprintf ap_php_snprintf
-#endif
-
-#if !defined(HAVE_VSNPRINTF) || PHP_BROKEN_VSNPRINTF
-extern int ap_php_vsnprintf(char *, size_t, const char *, va_list ap);
-#define vsnprintf ap_php_vsnprintf
-#endif
-
-#if PHP_BROKEN_SPRINTF
-int php_sprintf (char* s, const char* format, ...);
-#define sprintf php_sprintf
-#endif
-
-typedef enum {
- NO = 0, YES = 1
-} boolean_e;
-
-extern char * ap_php_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag, char *buf);
-extern char * ap_php_ecvt(double arg, int ndigits, int *decpt, int *sign, char *buf);
-extern char * ap_php_fcvt(double arg, int ndigits, int *decpt, int *sign, char *buf);
-extern char * ap_php_gcvt(double number, int ndigit, char *buf, boolean_e altform);
-
-#define WIDE_INT long
-typedef WIDE_INT wide_int;
-typedef unsigned WIDE_INT u_wide_int;
-
-typedef int bool_int;
-
-extern char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned,
- register bool_int * is_negative, char *buf_end, register int *len);
-
-extern char * ap_php_conv_fp(register char format, register double num,
- boolean_e add_dp, int precision, bool_int * is_negative, char *buf, int *len);
-
-extern char * ap_php_conv_p2(register u_wide_int num, register int nbits,
- char format, char *buf_end, register int *len);
-
-
-#endif /* SNPRINTF_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/spprintf.c b/main/spprintf.c
deleted file mode 100644
index 124865909f..0000000000
--- a/main/spprintf.c
+++ /dev/null
@@ -1,561 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* This is the spprintf implementation.
- * It has emerged from apache snprintf. See original header:
- */
-
-/* ====================================================================
- * Copyright (c) 1995-1998 The Apache Group. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission.
- *
- * 5. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Group and was originally based
- * on public domain software written at the National Center for
- * Supercomputing Applications, University of Illinois, Urbana-Champaign.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- * This code is based on, and used with the permission of, the
- * SIO stdio-replacement strx_* functions by Panos Tsirigotis
- * <panos@alumni.cs.colorado.edu> for xinetd.
- */
-
-#include "php.h"
-#include "snprintf.h"
-
-#define FALSE 0
-#define TRUE 1
-#define NUL '\0'
-#define INT_NULL ((int *)0)
-
-#define S_NULL "(null)"
-#define S_NULL_LEN 6
-
-#define FLOAT_DIGITS 6
-#define EXPONENT_LENGTH 10
-
-#include "ext/standard/php_smart_str.h"
-
-/*
- * NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions
- *
- * XXX: this is a magic number; do not decrease it
- */
-#define NUM_BUF_SIZE 512
-
-/*
- * The INS_CHAR macro inserts a character in the buffer.
- *
- * NOTE: Evaluation of the ch argument should not have any side-effects
- */
-#define INS_CHAR_NR(xbuf, ch) do { \
- smart_str_appendc(xbuf, ch); \
-} while (0)
-
-#define INS_STRING(xbuf, s, slen) do { \
- smart_str_appendl(xbuf, s, slen); \
-} while (0)
-
-#define INS_CHAR(xbuf, ch) \
- INS_CHAR_NR(xbuf, ch)
-
-/*
- * Macro that does padding. The padding is done by printing
- * the character ch.
- */
-#define PAD(xbuf, count, ch) do { \
- if ((count) > 0) { \
- size_t newlen; \
- smart_str_alloc(xbuf, (count), 0); \
- memset(xbuf->c + xbuf->len, ch, (count)); \
- xbuf->len += (count); \
- } \
-} while (0)
-
-#define NUM(c) (c - '0')
-
-#define STR_TO_DEC(str, num) do { \
- num = NUM(*str++); \
- while (isdigit((int)*str)) { \
- num *= 10; \
- num += NUM(*str++); \
- if (num >= LONG_MAX / 10) { \
- while (isdigit((int)*str++)); \
- break; \
- } \
- } \
-} while (0)
-
-/*
- * This macro does zero padding so that the precision
- * requirement is satisfied. The padding is done by
- * adding '0's to the left of the string that is going
- * to be printed.
- */
-#define FIX_PRECISION(adjust, precision, s, s_len) do { \
- if (adjust) \
- while (s_len < precision) { \
- *--s = '0'; \
- s_len++; \
- } \
-} while (0)
-
-
-
-/*
- * Do format conversion placing the output in buffer
- */
-static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap)
-{
- register char *s = NULL;
- char *q;
- int s_len;
-
- register int min_width = 0;
- int precision = 0;
- enum {
- LEFT, RIGHT
- } adjust;
- char pad_char;
- char prefix_char;
-
- double fp_num;
- wide_int i_num = (wide_int) 0;
- u_wide_int ui_num;
-
- char num_buf[NUM_BUF_SIZE];
- char char_buf[2]; /* for printing %% and %<unknown> */
-
- /*
- * Flag variables
- */
- boolean_e is_long;
- boolean_e alternate_form;
- boolean_e print_sign;
- boolean_e print_blank;
- boolean_e adjust_precision;
- boolean_e adjust_width;
- bool_int is_negative;
-
- while (*fmt) {
- if (*fmt != '%') {
- INS_CHAR(xbuf, *fmt);
- } else {
- /*
- * Default variable settings
- */
- adjust = RIGHT;
- alternate_form = print_sign = print_blank = NO;
- pad_char = ' ';
- prefix_char = NUL;
-
- fmt++;
-
- /*
- * Try to avoid checking for flags, width or precision
- */
- if (isascii((int)*fmt) && !islower((int)*fmt)) {
- /*
- * Recognize flags: -, #, BLANK, +
- */
- for (;; fmt++) {
- if (*fmt == '-')
- adjust = LEFT;
- else if (*fmt == '+')
- print_sign = YES;
- else if (*fmt == '#')
- alternate_form = YES;
- else if (*fmt == ' ')
- print_blank = YES;
- else if (*fmt == '0')
- pad_char = '0';
- else
- break;
- }
-
- /*
- * Check if a width was specified
- */
- if (isdigit((int)*fmt)) {
- STR_TO_DEC(fmt, min_width);
- adjust_width = YES;
- } else if (*fmt == '*') {
- min_width = va_arg(ap, int);
- fmt++;
- adjust_width = YES;
- if (min_width < 0) {
- adjust = LEFT;
- min_width = -min_width;
- }
- } else
- adjust_width = NO;
-
- /*
- * Check if a precision was specified
- *
- * XXX: an unreasonable amount of precision may be specified
- * resulting in overflow of num_buf. Currently we
- * ignore this possibility.
- */
- if (*fmt == '.') {
- adjust_precision = YES;
- fmt++;
- if (isdigit((int)*fmt)) {
- STR_TO_DEC(fmt, precision);
- } else if (*fmt == '*') {
- precision = va_arg(ap, int);
- fmt++;
- if (precision < 0)
- precision = 0;
- } else
- precision = 0;
- } else
- adjust_precision = NO;
- } else
- adjust_precision = adjust_width = NO;
-
- /*
- * Modifier check
- */
- if (*fmt == 'l') {
- is_long = YES;
- fmt++;
- } else
- is_long = NO;
-
- /*
- * Argument extraction and printing.
- * First we determine the argument type.
- * Then, we convert the argument to a string.
- * On exit from the switch, s points to the string that
- * must be printed, s_len has the length of the string
- * The precision requirements, if any, are reflected in s_len.
- *
- * NOTE: pad_char may be set to '0' because of the 0 flag.
- * It is reset to ' ' by non-numeric formats
- */
- switch (*fmt) {
- case 'u':
- if (is_long)
- i_num = va_arg(ap, u_wide_int);
- else
- i_num = (wide_int) va_arg(ap, unsigned int);
- /*
- * The rest also applies to other integer formats, so fall
- * into that case.
- */
- case 'd':
- case 'i':
- /*
- * Get the arg if we haven't already.
- */
- if ((*fmt) != 'u') {
- if (is_long)
- i_num = va_arg(ap, wide_int);
- else
- i_num = (wide_int) va_arg(ap, int);
- };
- s = ap_php_conv_10(i_num, (*fmt) == 'u', &is_negative,
- &num_buf[NUM_BUF_SIZE], &s_len);
- FIX_PRECISION(adjust_precision, precision, s, s_len);
-
- if (*fmt != 'u') {
- if (is_negative)
- prefix_char = '-';
- else if (print_sign)
- prefix_char = '+';
- else if (print_blank)
- prefix_char = ' ';
- }
- break;
-
-
- case 'o':
- if (is_long)
- ui_num = va_arg(ap, u_wide_int);
- else
- ui_num = (u_wide_int) va_arg(ap, unsigned int);
- s = ap_php_conv_p2(ui_num, 3, *fmt,
- &num_buf[NUM_BUF_SIZE], &s_len);
- FIX_PRECISION(adjust_precision, precision, s, s_len);
- if (alternate_form && *s != '0') {
- *--s = '0';
- s_len++;
- }
- break;
-
-
- case 'x':
- case 'X':
- if (is_long)
- ui_num = (u_wide_int) va_arg(ap, u_wide_int);
- else
- ui_num = (u_wide_int) va_arg(ap, unsigned int);
- s = ap_php_conv_p2(ui_num, 4, *fmt,
- &num_buf[NUM_BUF_SIZE], &s_len);
- FIX_PRECISION(adjust_precision, precision, s, s_len);
- if (alternate_form && i_num != 0) {
- *--s = *fmt; /* 'x' or 'X' */
- *--s = '0';
- s_len += 2;
- }
- break;
-
-
- case 's':
- s = va_arg(ap, char *);
- if (s != NULL) {
- s_len = strlen(s);
- if (adjust_precision && precision < s_len)
- s_len = precision;
- } else {
- s = S_NULL;
- s_len = S_NULL_LEN;
- }
- pad_char = ' ';
- break;
-
-
- case 'f':
- case 'e':
- case 'E':
- fp_num = va_arg(ap, double);
-
- if (zend_isnan(fp_num)) {
- s = "nan";
- s_len = 3;
- } else if (zend_isinf(fp_num)) {
- s = "inf";
- s_len = 3;
- } else {
- s = ap_php_conv_fp(*fmt, fp_num, alternate_form,
- (adjust_precision == NO) ? FLOAT_DIGITS : precision,
- &is_negative, &num_buf[1], &s_len);
- if (is_negative)
- prefix_char = '-';
- else if (print_sign)
- prefix_char = '+';
- else if (print_blank)
- prefix_char = ' ';
- }
- break;
-
-
- case 'g':
- case 'G':
- if (adjust_precision == NO)
- precision = FLOAT_DIGITS;
- else if (precision == 0)
- precision = 1;
- /*
- * * We use &num_buf[ 1 ], so that we have room for the sign
- */
- s = ap_php_gcvt(va_arg(ap, double), precision, &num_buf[1],
- alternate_form);
- if (*s == '-')
- prefix_char = *s++;
- else if (print_sign)
- prefix_char = '+';
- else if (print_blank)
- prefix_char = ' ';
-
- s_len = strlen(s);
-
- if (alternate_form && (q = strchr(s, '.')) == NULL)
- s[s_len++] = '.';
- if (*fmt == 'G' && (q = strchr(s, 'e')) != NULL)
- *q = 'E';
- break;
-
-
- case 'c':
- char_buf[0] = (char) (va_arg(ap, int));
- s = &char_buf[0];
- s_len = 1;
- pad_char = ' ';
- break;
-
-
- case '%':
- char_buf[0] = '%';
- s = &char_buf[0];
- s_len = 1;
- pad_char = ' ';
- break;
-
-
- case 'n':
- *(va_arg(ap, int *)) = xbuf->len;
- break;
-
- /*
- * Always extract the argument as a "char *" pointer. We
- * should be using "void *" but there are still machines
- * that don't understand it.
- * If the pointer size is equal to the size of an unsigned
- * integer we convert the pointer to a hex number, otherwise
- * we print "%p" to indicate that we don't handle "%p".
- */
- case 'p':
- ui_num = (u_wide_int) va_arg(ap, char *);
-
- if (sizeof(char *) <= sizeof(u_wide_int))
- s = ap_php_conv_p2(ui_num, 4, 'x', &num_buf[NUM_BUF_SIZE], &s_len);
- else {
- s = "%p";
- s_len = 2;
- }
- pad_char = ' ';
- break;
-
-
- case NUL:
- /*
- * The last character of the format string was %.
- * We ignore it.
- */
- continue;
-
-
- /*
- * The default case is for unrecognized %'s.
- * We print %<char> to help the user identify what
- * option is not understood.
- * This is also useful in case the user wants to pass
- * the output of format_converter to another function
- * that understands some other %<char> (like syslog).
- * Note that we can't point s inside fmt because the
- * unknown <char> could be preceded by width etc.
- */
- default:
- char_buf[0] = '%';
- char_buf[1] = *fmt;
- s = char_buf;
- s_len = 2;
- pad_char = ' ';
- break;
- }
-
- if (prefix_char != NUL) {
- *--s = prefix_char;
- s_len++;
- }
- if (adjust_width && adjust == RIGHT && min_width > s_len) {
- if (pad_char == '0' && prefix_char != NUL) {
- INS_CHAR(xbuf, *s);
- s++;
- s_len--;
- min_width--;
- }
- PAD(xbuf, min_width - s_len, pad_char);
- }
- /*
- * Print the string s.
- */
- INS_STRING(xbuf, s, s_len);
-
- if (adjust_width && adjust == LEFT && min_width > s_len)
- PAD(xbuf, min_width - s_len, pad_char);
- }
- fmt++;
- }
- return;
-}
-
-
-/*
- * This is the general purpose conversion function.
- */
-PHPAPI int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap)
-{
- smart_str xbuf = {0};
-
- xbuf_format_converter(&xbuf, format, ap);
-
- if (max_len && xbuf.len > max_len) {
- xbuf.len = max_len;
- }
- smart_str_0(&xbuf);
-
- *pbuf = xbuf.c;
-
- return xbuf.len;
-}
-
-
-PHPAPI int spprintf(char **pbuf, size_t max_len, const char *format, ...)
-{
- int cc;
- va_list ap;
-
- va_start(ap, format);
- cc = vspprintf(pbuf, max_len, format, ap);
- va_end(ap);
- return (cc);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/spprintf.h b/main/spprintf.h
deleted file mode 100644
index 5db2c8c9ec..0000000000
--- a/main/spprintf.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*
-
-The pbuf parameter of all spprintf version receives a pointer to the allocated
-buffer. This buffer must be freed manually after usage using efree() function.
-The buffer will allways be terminated by a zero character. When pbuf is NULL
-the function can be used to calculate the required size of the buffer but for
-that purpose snprintf is faster. When both pbuf and the return value are 0
-than you are out of memory.
-
-There is also snprintf: See difference explained in snprintf.h
-
-*/
-
-#ifndef SPPRINTF_H
-#define SPPRINTF_H
-
-#include "snprintf.h"
-
-BEGIN_EXTERN_C()
-PHPAPI extern int spprintf( char **pbuf, size_t max_len, const char *format, ...);
-
-PHPAPI extern int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap);
-END_EXTERN_C()
-
-#endif /* SNPRINTF_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/streams/cast.c b/main/streams/cast.c
deleted file mode 100644
index feae2653f4..0000000000
--- a/main/streams/cast.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#define _GNU_SOURCE
-#include "php.h"
-#include "php_globals.h"
-#include "php_network.h"
-#include "php_open_temporary_file.h"
-#include "ext/standard/file.h"
-#include <stddef.h>
-#include <fcntl.h>
-
-#include "php_streams_int.h"
-
-/* Under BSD, emulate fopencookie using funopen */
-#if HAVE_FUNOPEN
-typedef struct {
- int (*reader)(void *, char *, int);
- int (*writer)(void *, const char *, int);
- fpos_t (*seeker)(void *, fpos_t, int);
- int (*closer)(void *);
-} COOKIE_IO_FUNCTIONS_T;
-
-FILE *fopencookie(void *cookie, const char *mode, COOKIE_IO_FUNCTIONS_T *funcs)
-{
- return funopen(cookie, funcs->reader, funcs->writer, funcs->seeker, funcs->closer);
-}
-# define HAVE_FOPENCOOKIE 1
-# define PHP_STREAM_COOKIE_FUNCTIONS &stream_cookie_functions
-#elif HAVE_FOPENCOOKIE
-# define PHP_STREAM_COOKIE_FUNCTIONS stream_cookie_functions
-#endif
-
-/* {{{ STDIO with fopencookie */
-#if HAVE_FUNOPEN
-/* use our fopencookie emulation */
-static int stream_cookie_reader(void *cookie, char *buffer, int size)
-{
- int ret;
- TSRMLS_FETCH();
- ret = php_stream_read((php_stream*)cookie, buffer, size);
- return ret;
-}
-
-static int stream_cookie_writer(void *cookie, const char *buffer, int size)
-{
- TSRMLS_FETCH();
- return php_stream_write((php_stream *)cookie, (char *)buffer, size);
-}
-
-static fpos_t stream_cookie_seeker(void *cookie, off_t position, int whence)
-{
- TSRMLS_FETCH();
- return (fpos_t)php_stream_seek((php_stream *)cookie, position, whence);
-}
-
-static int stream_cookie_closer(void *cookie)
-{
- php_stream *stream = (php_stream*)cookie;
- TSRMLS_FETCH();
-
- /* prevent recursion */
- stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE;
- return php_stream_close(stream);
-}
-
-#elif HAVE_FOPENCOOKIE
-static ssize_t stream_cookie_reader(void *cookie, char *buffer, size_t size)
-{
- ssize_t ret;
- TSRMLS_FETCH();
- ret = php_stream_read(((php_stream *)cookie), buffer, size);
- return ret;
-}
-
-static ssize_t stream_cookie_writer(void *cookie, const char *buffer, size_t size)
-{
- TSRMLS_FETCH();
- return php_stream_write(((php_stream *)cookie), (char *)buffer, size);
-}
-
-#ifdef COOKIE_SEEKER_USES_OFF64_T
-static int stream_cookie_seeker(void *cookie, __off64_t *position, int whence)
-{
- TSRMLS_FETCH();
-
- *position = php_stream_seek((php_stream *)cookie, (off_t)*position, whence);
-
- if (*position == -1)
- return -1;
- return 0;
-}
-#else
-static int stream_cookie_seeker(void *cookie, off_t position, int whence)
-{
- TSRMLS_FETCH();
- return php_stream_seek((php_stream *)cookie, position, whence);
-}
-#endif
-
-static int stream_cookie_closer(void *cookie)
-{
- php_stream *stream = (php_stream*)cookie;
- TSRMLS_FETCH();
-
- /* prevent recursion */
- stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE;
- return php_stream_close(stream);
-}
-#endif /* elif HAVE_FOPENCOOKIE */
-
-#if HAVE_FOPENCOOKIE
-static COOKIE_IO_FUNCTIONS_T stream_cookie_functions =
-{
- stream_cookie_reader, stream_cookie_writer,
- stream_cookie_seeker, stream_cookie_closer
-};
-#else
-/* TODO: use socketpair() to emulate fopencookie, as suggested by Hartmut ? */
-#endif
-/* }}} */
-
-
-
-
-
-/* {{{ php_stream_cast */
-PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show_err TSRMLS_DC)
-{
- int flags = castas & PHP_STREAM_CAST_MASK;
- castas &= ~PHP_STREAM_CAST_MASK;
-
- /* synchronize our buffer (if possible) */
- if (ret) {
- php_stream_flush(stream);
- if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) {
- off_t dummy;
-
- stream->ops->seek(stream, stream->position, SEEK_SET, &dummy TSRMLS_CC);
- stream->readpos = stream->writepos = 0;
- }
- }
-
- /* filtered streams can only be cast as stdio, and only when fopencookie is present */
-
- if (castas == PHP_STREAM_AS_STDIO) {
- if (stream->stdiocast) {
- if (ret) {
- *(FILE**)ret = stream->stdiocast;
- }
- goto exit_success;
- }
-
- /* if the stream is a stdio stream let's give it a chance to respond
- * first, to avoid doubling up the layers of stdio with an fopencookie */
- if (php_stream_is(stream, PHP_STREAM_IS_STDIO) &&
- stream->ops->cast &&
- !php_stream_is_filtered(stream) &&
- stream->ops->cast(stream, castas, ret TSRMLS_CC) == SUCCESS)
- {
- goto exit_success;
- }
-
-#if HAVE_FOPENCOOKIE
- /* if just checking, say yes we can be a FILE*, but don't actually create it yet */
- if (ret == NULL)
- goto exit_success;
-
- *(FILE**)ret = fopencookie(stream, stream->mode, PHP_STREAM_COOKIE_FUNCTIONS);
-
- if (*ret != NULL) {
- off_t pos;
-
- stream->fclose_stdiocast = PHP_STREAM_FCLOSE_FOPENCOOKIE;
-
- /* If the stream position is not at the start, we need to force
- * the stdio layer to believe it's real location. */
- pos = php_stream_tell(stream);
- if (pos > 0)
- fseek(*ret, pos, SEEK_SET);
-
- goto exit_success;
- }
-
- /* must be either:
- a) programmer error
- b) no memory
- -> lets bail
- */
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "fopencookie failed");
- return FAILURE;
-#endif
-
- if (!php_stream_is_filtered(stream) && stream->ops->cast && stream->ops->cast(stream, castas, NULL TSRMLS_CC) == SUCCESS) {
- if (FAILURE == stream->ops->cast(stream, castas, ret TSRMLS_CC)) {
- return FAILURE;
- }
- goto exit_success;
- } else if (flags & PHP_STREAM_CAST_TRY_HARD) {
- php_stream *newstream;
-
- newstream = php_stream_fopen_tmpfile();
- if (newstream) {
- size_t copied = php_stream_copy_to_stream(stream, newstream, PHP_STREAM_COPY_ALL);
-
- if (copied == 0) {
- php_stream_close(newstream);
- } else {
- int retcode = php_stream_cast(newstream, castas | flags, ret, show_err);
-
- if (retcode == SUCCESS)
- rewind(*(FILE**)ret);
-
- /* do some specialized cleanup */
- if ((flags & PHP_STREAM_CAST_RELEASE)) {
- php_stream_free(stream, PHP_STREAM_FREE_CLOSE_CASTED);
- }
-
- return retcode;
- }
- }
- }
- }
-
- if (php_stream_is_filtered(stream)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot cast a filtered stream on this system");
- return FAILURE;
- } else if (stream->ops->cast && stream->ops->cast(stream, castas, ret TSRMLS_CC) == SUCCESS) {
- goto exit_success;
- }
-
- if (show_err) {
- /* these names depend on the values of the PHP_STREAM_AS_XXX defines in php_streams.h */
- static const char *cast_names[3] = {
- "STDIO FILE*", "File Descriptor", "Socket Descriptor"
- };
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot represent a stream of type %s as a %s",
- stream->ops->label,
- cast_names[castas]
- );
- }
-
- return FAILURE;
-
-exit_success:
-
- if ((stream->writepos - stream->readpos) > 0 &&
- stream->fclose_stdiocast != PHP_STREAM_FCLOSE_FOPENCOOKIE &&
- (flags & PHP_STREAM_CAST_INTERNAL) == 0) {
- /* the data we have buffered will be lost to the third party library that
- * will be accessing the stream. Emit a warning so that the end-user will
- * know that they should try something else */
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "%d bytes of buffered data lost during stream conversion!",
- stream->writepos - stream->readpos);
- }
-
- if (castas == PHP_STREAM_AS_STDIO && ret)
- stream->stdiocast = *(FILE**)ret;
-
- if (flags & PHP_STREAM_CAST_RELEASE) {
- php_stream_free(stream, PHP_STREAM_FREE_CLOSE_CASTED);
- }
-
- return SUCCESS;
-
-}
-/* }}} */
-
-/* {{{ php_stream_open_wrapper_as_file */
-PHPAPI FILE * _php_stream_open_wrapper_as_file(char *path, char *mode, int options, char **opened_path STREAMS_DC TSRMLS_DC)
-{
- FILE *fp = NULL;
- php_stream *stream = NULL;
-
- stream = php_stream_open_wrapper_rel(path, mode, options|STREAM_WILL_CAST, opened_path);
-
- if (stream == NULL)
- return NULL;
-
- if (php_stream_cast(stream, PHP_STREAM_AS_STDIO|PHP_STREAM_CAST_TRY_HARD|PHP_STREAM_CAST_RELEASE,
- (void**)&fp, REPORT_ERRORS) == FAILURE)
- {
- php_stream_close(stream);
- if (opened_path && *opened_path)
- efree(*opened_path);
- return NULL;
- }
- return fp;
-}
-/* }}} */
-
-/* {{{ php_stream_make_seekable */
-PHPAPI int _php_stream_make_seekable(php_stream *origstream, php_stream **newstream, int flags STREAMS_DC TSRMLS_DC)
-{
- assert(newstream != NULL);
-
- *newstream = NULL;
-
- if (((flags & PHP_STREAM_FORCE_CONVERSION) == 0) && origstream->ops->seek != NULL) {
- *newstream = origstream;
- return PHP_STREAM_UNCHANGED;
- }
-
- /* Use a tmpfile and copy the old streams contents into it */
-
- if (flags & PHP_STREAM_PREFER_STDIO)
- *newstream = php_stream_fopen_tmpfile();
- else
- *newstream = php_stream_temp_new();
-
- if (*newstream == NULL)
- return PHP_STREAM_FAILED;
-
- if (php_stream_copy_to_stream(origstream, *newstream, PHP_STREAM_COPY_ALL) == 0) {
- php_stream_close(*newstream);
- *newstream = NULL;
- return PHP_STREAM_CRITICAL;
- }
-
- php_stream_close(origstream);
- php_stream_seek(*newstream, 0, SEEK_SET);
-
- return PHP_STREAM_RELEASED;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/main/streams/filter.c b/main/streams/filter.c
deleted file mode 100644
index 782b8aa6a0..0000000000
--- a/main/streams/filter.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_network.h"
-#include "php_open_temporary_file.h"
-#include "ext/standard/file.h"
-#include <stddef.h>
-#include <fcntl.h>
-
-#include "php_streams_int.h"
-
-static HashTable stream_filters_hash;
-
-PHPAPI HashTable *php_get_stream_filters_hash()
-{
- return &stream_filters_hash;
-}
-
-PHPAPI int php_stream_filter_register_factory(const char *filterpattern, php_stream_filter_factory *factory TSRMLS_DC)
-{
- return zend_hash_add(&stream_filters_hash, (char*)filterpattern, strlen(filterpattern), factory, sizeof(*factory), NULL);
-}
-
-PHPAPI int php_stream_filter_unregister_factory(const char *filterpattern TSRMLS_DC)
-{
- return zend_hash_del(&stream_filters_hash, (char*)filterpattern, strlen(filterpattern));
-}
-
-/* Buckets */
-
-PHPAPI php_stream_bucket *php_stream_bucket_new(php_stream *stream, char *buf, size_t buflen, int own_buf, int buf_persistent TSRMLS_DC)
-{
- int is_persistent = php_stream_is_persistent(stream);
- php_stream_bucket *bucket;
-
- bucket = (php_stream_bucket*)pemalloc(sizeof(php_stream_bucket), is_persistent);
-
- if (bucket == NULL) {
- return NULL;
- }
-
- bucket->next = bucket->prev = NULL;
-
- if (is_persistent && !buf_persistent) {
- /* all data in a persistent bucket must also be persistent */
- bucket->buf = pemalloc(buflen, 1);
-
- if (bucket->buf == NULL) {
- pefree(bucket, 1);
- return NULL;
- }
-
- memcpy(bucket->buf, buf, buflen);
- bucket->buflen = buflen;
- bucket->own_buf = 1;
- } else {
- bucket->buf = buf;
- bucket->buflen = buflen;
- bucket->own_buf = own_buf;
- }
- bucket->is_persistent = is_persistent;
- bucket->refcount = 1;
-
- return bucket;
-}
-
-/* Given a bucket, returns a version of that bucket with a writeable buffer.
- * If the original bucket has a refcount of 1 and owns its buffer, then it
- * is returned unchanged.
- * Otherwise, a copy of the buffer is made.
- * In both cases, the original bucket is unlinked from its brigade.
- * If a copy is made, the original bucket is delref'd.
- * */
-PHPAPI php_stream_bucket *php_stream_bucket_make_writeable(php_stream_bucket *bucket TSRMLS_DC)
-{
- php_stream_bucket *retval;
-
- php_stream_bucket_unlink(bucket TSRMLS_CC);
-
- if (bucket->refcount == 1 && bucket->own_buf) {
- return bucket;
- }
-
- retval = (php_stream_bucket*)pemalloc(sizeof(php_stream_bucket), bucket->is_persistent);
- memcpy(retval, bucket, sizeof(*retval));
-
- retval->buf = pemalloc(retval->buflen, retval->is_persistent);
- memcpy(retval->buf, bucket->buf, retval->buflen);
-
- retval->refcount = 1;
- retval->own_buf = 1;
-
- php_stream_bucket_delref(bucket TSRMLS_CC);
-
- return retval;
-}
-
-PHPAPI int php_stream_bucket_split(php_stream_bucket *in, php_stream_bucket **left, php_stream_bucket **right, size_t length TSRMLS_DC)
-{
- *left = (php_stream_bucket*)pecalloc(1, sizeof(php_stream_bucket), in->is_persistent);
- *right = (php_stream_bucket*)pecalloc(1, sizeof(php_stream_bucket), in->is_persistent);
-
- if (*left == NULL || *right == NULL) {
- goto exit_fail;
- }
-
- (*left)->buf = pemalloc(length, in->is_persistent);
- (*left)->buflen = length;
- memcpy((*left)->buf, in->buf, length);
- (*left)->refcount = 1;
- (*left)->own_buf = 1;
- (*left)->is_persistent = in->is_persistent;
-
- (*right)->buflen = in->buflen - length;
- (*right)->buf = pemalloc((*right)->buflen, in->is_persistent);
- memcpy((*right)->buf, in->buf + length, (*right)->buflen);
- (*right)->refcount = 1;
- (*right)->own_buf = 1;
- (*right)->is_persistent = in->is_persistent;
-
- return SUCCESS;
-
-exit_fail:
- if (*right) {
- if ((*right)->buf) {
- pefree((*right)->buf, in->is_persistent);
- }
- pefree(*right, in->is_persistent);
- }
- if (*left) {
- if ((*left)->buf) {
- pefree((*left)->buf, in->is_persistent);
- }
- pefree(*left, in->is_persistent);
- }
- return FAILURE;
-}
-
-PHPAPI void php_stream_bucket_delref(php_stream_bucket *bucket TSRMLS_DC)
-{
- if (--bucket->refcount == 0) {
- if (bucket->own_buf) {
- pefree(bucket->buf, bucket->is_persistent);
- }
- pefree(bucket, bucket->is_persistent);
- }
-}
-
-PHPAPI void php_stream_bucket_prepend(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket TSRMLS_DC)
-{
- bucket->next = brigade->head;
- bucket->prev = NULL;
-
- if (brigade->head) {
- brigade->head->prev = bucket;
- } else {
- brigade->tail = bucket;
- }
- brigade->head = bucket;
- bucket->brigade = brigade;
-}
-
-PHPAPI void php_stream_bucket_append(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket TSRMLS_DC)
-{
- bucket->prev = brigade->tail;
- bucket->next = NULL;
-
- if (brigade->tail) {
- brigade->tail->next = bucket;
- } else {
- brigade->head = bucket;
- }
- brigade->tail = bucket;
- bucket->brigade = brigade;
-}
-
-PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket TSRMLS_DC)
-{
- if (bucket->prev) {
- bucket->prev->next = bucket->next;
- } else {
- bucket->brigade->head = bucket->next;
- }
- if (bucket->next) {
- bucket->next->prev = bucket->prev;
- } else {
- bucket->brigade->tail = bucket->prev;
- }
- bucket->brigade = NULL;
- bucket->next = bucket->prev = NULL;
-}
-
-
-
-
-
-
-
-
-/* We allow very simple pattern matching for filter factories:
- * if "charset.utf-8/sjis" is requested, we search first for an exact
- * match. If that fails, we try "charset.*".
- * This means that we don't need to clog up the hashtable with a zillion
- * charsets (for example) but still be able to provide them all as filters */
-PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC)
-{
- php_stream_filter_factory *factory;
- php_stream_filter *filter = NULL;
- int n;
- char *period;
-
- n = strlen(filtername);
-
- if (SUCCESS == zend_hash_find(&stream_filters_hash, (char*)filtername, n, (void**)&factory)) {
- filter = factory->create_filter(filtername, filterparams, persistent TSRMLS_CC);
- } else if ((period = strchr(filtername, '.'))) {
- /* try a wildcard */
- char wildname[128];
-
- PHP_STRLCPY(wildname, filtername, sizeof(wildname) - 1, period-filtername + 1);
- strcat(wildname, "*");
-
- if (SUCCESS == zend_hash_find(&stream_filters_hash, wildname, strlen(wildname), (void**)&factory)) {
- filter = factory->create_filter(filtername, filterparams, persistent TSRMLS_CC);
- }
- }
-
- if (filter == NULL) {
- /* TODO: these need correct docrefs */
- if (factory == NULL)
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to locate filter \"%s\"", filtername);
- else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to create or locate filter \"%s\"", filtername);
- }
-
- return filter;
-}
-
-PHPAPI php_stream_filter *_php_stream_filter_alloc(php_stream_filter_ops *fops, void *abstract, int persistent STREAMS_DC TSRMLS_DC)
-{
- php_stream_filter *filter;
-
- filter = (php_stream_filter*) pemalloc_rel_orig(sizeof(php_stream_filter), persistent);
- memset(filter, 0, sizeof(php_stream_filter));
-
- filter->fops = fops;
- filter->abstract = abstract;
- filter->is_persistent = persistent;
-
- return filter;
-}
-
-PHPAPI void php_stream_filter_free(php_stream_filter *filter TSRMLS_DC)
-{
- if (filter->fops->dtor)
- filter->fops->dtor(filter TSRMLS_CC);
- pefree(filter, filter->is_persistent);
-}
-
-PHPAPI void php_stream_filter_prepend(php_stream_filter_chain *chain, php_stream_filter *filter)
-{
- filter->next = chain->head;
- filter->prev = NULL;
-
- if (chain->head) {
- chain->head->prev = filter;
- } else {
- chain->tail = filter;
- }
- chain->head = filter;
- filter->chain = chain;
-}
-
-PHPAPI void php_stream_filter_append(php_stream_filter_chain *chain, php_stream_filter *filter)
-{
- filter->prev = chain->tail;
- filter->next = NULL;
- if (chain->tail) {
- chain->tail->next = filter;
- } else {
- chain->head = filter;
- }
- chain->tail = filter;
- filter->chain = chain;
-}
-
-PHPAPI php_stream_filter *php_stream_filter_remove(php_stream_filter *filter, int call_dtor TSRMLS_DC)
-{
- if (filter->prev) {
- filter->prev->next = filter->next;
- } else {
- filter->chain->head = filter->next;
- }
- if (filter->next) {
- filter->next->prev = filter->prev;
- } else {
- filter->chain->tail = filter->prev;
- }
- if (call_dtor) {
- php_stream_filter_free(filter TSRMLS_CC);
- return NULL;
- }
- return filter;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/main/streams/memory.c b/main/streams/memory.c
deleted file mode 100644
index 45a6ef1acf..0000000000
--- a/main/streams/memory.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#define _GNU_SOURCE
-#include "php.h"
-
-/* Memory streams use a dynamic memory buffer to emulate a stream.
- * You can use php_stream_memory_open to create a readonly stream
- * from an existing memory buffer.
- */
-
-/* Temp streams are streams that uses memory streams as long their
- * size is less than a given memory amount. When a write operation
- * exceeds that limit the content is written to a temporary file.
- */
-
-/* {{{ ------- MEMORY stream implementation -------*/
-
-typedef struct {
- char *data;
- size_t fpos;
- size_t fsize;
- size_t smax;
- int mode;
-} php_stream_memory_data;
-
-
-/* {{{ */
-static size_t php_stream_memory_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
-{
- php_stream_memory_data *ms;
-
- assert(stream != NULL);
- ms = stream->abstract;
- assert(ms != NULL);
-
- if (ms->mode & TEMP_STREAM_READONLY) {
- return 0;
- }
- if (ms->fpos + count > ms->fsize) {
- char *tmp;
-
- if (!ms->data) {
- tmp = emalloc(ms->fpos + count);
- } else {
- tmp = erealloc(ms->data, ms->fpos + count);
- }
- if (!tmp) {
- count = ms->fsize - ms->fpos + 1;
- } else {
- ms->data = tmp;
- ms->fsize = ms->fpos + count;
- }
- }
- if (!ms->data)
- count = 0;
- if (count) {
- assert(buf!= NULL);
- memcpy(ms->data+ms->fpos, (char*)buf, count);
- ms->fpos += count;
- }
- return count;
-}
-/* }}} */
-
-
-/* {{{ */
-static size_t php_stream_memory_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-{
- php_stream_memory_data *ms;
-
- assert(stream != NULL);
- ms = stream->abstract;
- assert(ms != NULL);
-
- if (ms->fpos + count > ms->fsize) {
- count = ms->fsize - ms->fpos;
- }
- if (count) {
- assert(ms->data!= NULL);
- assert(buf!= NULL);
- memcpy(buf, ms->data+ms->fpos, count);
- ms->fpos += count;
- } else {
- stream->eof = 1;
- }
- return count;
-}
-/* }}} */
-
-
-/* {{{ */
-static int php_stream_memory_close(php_stream *stream, int close_handle TSRMLS_DC)
-{
- php_stream_memory_data *ms;
-
- assert(stream != NULL);
- ms = stream->abstract;
- assert(ms != NULL);
-
- if (ms->data && close_handle && ms->mode != TEMP_STREAM_READONLY) {
- efree(ms->data);
- }
- efree(ms);
- return 0;
-}
-/* }}} */
-
-
-/* {{{ */
-static int php_stream_memory_flush(php_stream *stream TSRMLS_DC)
-{
- /* nothing to do here */
- return 0;
-}
-/* }}} */
-
-
-/* {{{ */
-static int php_stream_memory_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC)
-{
- php_stream_memory_data *ms;
-
- assert(stream != NULL);
- ms = stream->abstract;
- assert(ms != NULL);
-
- switch(whence) {
- case SEEK_CUR:
- if (offset < 0) {
- if (ms->fpos < (size_t)(-offset)) {
- ms->fpos = 0;
- /*return EINVAL;*/
- } else {
- ms->fpos = ms->fpos + offset;
- }
- } else {
- if (ms->fpos < (size_t)(offset)) {
- ms->fpos = ms->fsize;
- /*return EINVAL;*/
- } else {
- ms->fpos = ms->fpos + offset;
- }
- }
- *newoffs = ms->fpos;
- return 0;
- case SEEK_SET:
- if (ms->fsize < (size_t)(offset)) {
- ms->fpos = ms->fsize;
- /*return EINVAL;*/
- } else {
- ms->fpos = offset;
- }
- *newoffs = ms->fpos;
- return 0;
- case SEEK_END:
- if (offset > 0) {
- ms->fpos = ms->fsize;
- /*return EINVAL;*/
- } else if (ms->fpos < (size_t)(-offset)) {
- ms->fpos = 0;
- /*return EINVAL;*/
- } else {
- ms->fpos = ms->fsize + offset;
- }
- *newoffs = ms->fpos;
- return 0;
- default:
- return 0;
- /*return EINVAL;*/
- }
-}
-/* }}} */
-
-/* {{{ */
-static int php_stream_memory_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
-{
- return FAILURE;
-}
-/* }}} */
-
-
-php_stream_ops php_stream_memory_ops = {
- php_stream_memory_write, php_stream_memory_read,
- php_stream_memory_close, php_stream_memory_flush,
- "MEMORY",
- php_stream_memory_seek,
- php_stream_memory_cast,
- NULL, /* stat */
- NULL /* set_option */
-};
-
-
-/* {{{ */
-PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC TSRMLS_DC)
-{
- php_stream_memory_data *self;
- php_stream *stream;
-
- self = emalloc(sizeof(*self));
- self->data = NULL;
- self->fpos = 0;
- self->fsize = 0;
- self->smax = -1;
- self->mode = mode;
-
- stream = php_stream_alloc(&php_stream_memory_ops, self, 0, "r+b");
- stream->flags |= PHP_STREAM_FLAG_NO_BUFFER;
- return stream;
-}
-/* }}} */
-
-
-/* {{{ */
-PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length STREAMS_DC TSRMLS_DC)
-{
- php_stream *stream;
- php_stream_memory_data *ms;
-
- if ((stream = php_stream_memory_create_rel(mode)) != NULL) {
- ms = stream->abstract;
-
- if (mode == TEMP_STREAM_READONLY) {
- /* use the buffer directly */
- ms->data = buf;
- ms->fsize = length;
- } else {
- if (length) {
- assert(buf != NULL);
- php_stream_write(stream, buf, length);
- }
- }
- }
- return stream;
-}
-/* }}} */
-
-
-/* {{{ */
-PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length STREAMS_DC TSRMLS_DC)
-{
- php_stream_memory_data *ms;
-
- assert(stream != NULL);
- ms = stream->abstract;
- assert(ms != NULL);
- assert(length != 0);
-
- *length = ms->fsize;
- return ms->data;
-}
-/* }}} */
-
-/* }}} */
-
-/* {{{ ------- TEMP stream implementation -------*/
-
-typedef struct {
- php_stream *innerstream;
- size_t smax;
- int mode;
-} php_stream_temp_data;
-
-
-/* {{{ */
-static size_t php_stream_temp_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
-{
- php_stream_temp_data *ts;
-
- assert(stream != NULL);
- ts = stream->abstract;
- assert(ts != NULL);
-
- if (php_stream_is(ts->innerstream, PHP_STREAM_IS_MEMORY)) {
- size_t memsize;
- char *membuf = php_stream_memory_get_buffer(ts->innerstream, &memsize);
-
- if (memsize + count >= ts->smax) {
- php_stream *file = php_stream_fopen_tmpfile();
- php_stream_write(file, membuf, memsize);
- php_stream_close(ts->innerstream);
- ts->innerstream = file;
- }
- }
- return php_stream_write(ts->innerstream, buf, count);
-}
-/* }}} */
-
-
-/* {{{ */
-static size_t php_stream_temp_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-{
- php_stream_temp_data *ts;
-
- assert(stream != NULL);
- ts = stream->abstract;
- assert(ts != NULL);
-
- return php_stream_read(ts->innerstream, buf, count);
-}
-/* }}} */
-
-
-/* {{{ */
-static int php_stream_temp_close(php_stream *stream, int close_handle TSRMLS_DC)
-{
- php_stream_temp_data *ts;
- int ret;
-
- assert(stream != NULL);
- ts = stream->abstract;
- assert(ts != NULL);
-
- ret = php_stream_free(ts->innerstream, PHP_STREAM_FREE_CLOSE | (close_handle ? 0 : PHP_STREAM_FREE_PRESERVE_HANDLE));
-
- efree(ts);
-
- return ret;
-}
-/* }}} */
-
-
-/* {{{ */
-static int php_stream_temp_flush(php_stream *stream TSRMLS_DC)
-{
- php_stream_temp_data *ts;
-
- assert(stream != NULL);
- ts = stream->abstract;
- assert(ts != NULL);
-
- return php_stream_flush(ts->innerstream);
-}
-/* }}} */
-
-
-/* {{{ */
-static int php_stream_temp_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC)
-{
- php_stream_temp_data *ts;
- int ret;
-
- assert(stream != NULL);
- ts = stream->abstract;
- assert(ts != NULL);
-
- ret = php_stream_seek(ts->innerstream, offset, whence);
- *newoffs = php_stream_tell(ts->innerstream);
-
- return ret;
-}
-/* }}} */
-
-/* {{{ */
-static int php_stream_temp_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
-{
- php_stream_temp_data *ts;
- php_stream *file;
- size_t memsize;
- char *membuf;
- off_t pos;
-
- assert(stream != NULL);
- ts = stream->abstract;
- assert(ts != NULL);
-
- if (php_stream_is(ts->innerstream, PHP_STREAM_IS_STDIO)) {
- return php_stream_cast(ts->innerstream, castas, ret, 0);
- }
-
- /* we are still using a memory based backing. If they are if we can be
- * a FILE*, say yes because we can perform the conversion.
- * If they actually want to perform the conversion, we need to switch
- * the memory stream to a tmpfile stream */
-
- if (ret == NULL && castas == PHP_STREAM_AS_STDIO) {
- return SUCCESS;
- }
-
- /* say "no" to other stream forms */
- if (ret == NULL) {
- return FAILURE;
- }
-
- /* perform the conversion and then pass the request on to the innerstream */
- membuf = php_stream_memory_get_buffer(ts->innerstream, &memsize);
- file = php_stream_fopen_tmpfile();
- php_stream_write(file, membuf, memsize);
- pos = php_stream_tell(ts->innerstream);
-
- php_stream_close(ts->innerstream);
- ts->innerstream = file;
- php_stream_seek(ts->innerstream, pos, SEEK_SET);
-
- return php_stream_cast(ts->innerstream, castas, ret, 1);
-}
-/* }}} */
-
-php_stream_ops php_stream_temp_ops = {
- php_stream_temp_write, php_stream_temp_read,
- php_stream_temp_close, php_stream_temp_flush,
- "TEMP",
- php_stream_temp_seek,
- php_stream_temp_cast,
- NULL, /* stat */
- NULL /* set_option */
-};
-
-/* }}} */
-
-/* {{{ _php_stream_temp_create */
-PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC TSRMLS_DC)
-{
- php_stream_temp_data *self;
- php_stream *stream;
-
- self = ecalloc(1, sizeof(*self));
- self->smax = max_memory_usage;
- self->mode = mode;
- stream = php_stream_alloc(&php_stream_temp_ops, self, 0, "r+b");
- stream->flags |= PHP_STREAM_FLAG_NO_BUFFER;
- self->innerstream = php_stream_memory_create(mode);
-
- return stream;
-}
-/* }}} */
-
-
-/* {{{ _php_stream_temp_open */
-PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t length STREAMS_DC TSRMLS_DC)
-{
- php_stream *stream;
- php_stream_temp_data *ms;
-
- if ((stream = php_stream_temp_create_rel(mode & ~TEMP_STREAM_READONLY, max_memory_usage)) != NULL) {
- if (length) {
- assert(buf != NULL);
- php_stream_temp_write(stream, buf, length TSRMLS_CC);
- }
- ms = stream->abstract;
- assert(ms != NULL);
- ms->mode = mode;
- }
- return stream;
-}
-/* }}} */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/main/streams/mmap.c b/main/streams/mmap.c
deleted file mode 100644
index 791b96436f..0000000000
--- a/main/streams/mmap.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* Memory Mapping interface for streams */
-#include "php.h"
-#include "php_streams_int.h"
-
-PHPAPI char *_php_stream_mmap_range(php_stream *stream, size_t offset, size_t length, php_stream_mmap_operation_t mode, size_t *mapped_len TSRMLS_DC)
-{
- php_stream_mmap_range range = { offset, length, mode, NULL };
-
- /* TODO: Enforce system policy and limits for mmap sizes ? */
-
- if (PHP_STREAM_OPTION_RETURN_OK == php_stream_set_option(stream, PHP_STREAM_OPTION_MMAP_API, PHP_STREAM_MMAP_MAP_RANGE, &range)) {
- if (mapped_len) {
- *mapped_len = range.length;
- }
- return range.mapped;
- }
- return NULL;
-}
-
-PHPAPI int _php_stream_mmap_unmap(php_stream *stream TSRMLS_DC)
-{
- return php_stream_set_option(stream, PHP_STREAM_OPTION_MMAP_API, PHP_STREAM_MMAP_UNMAP, NULL) == PHP_STREAM_OPTION_RETURN_OK ? 1 : 0;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/main/streams/php_stream_context.h b/main/streams/php_stream_context.h
deleted file mode 100644
index 2094b4c8a3..0000000000
--- a/main/streams/php_stream_context.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* Stream context and status notification related definitions */
-
-/* callback for status notifications */
-typedef void (*php_stream_notification_func)(php_stream_context *context,
- int notifycode, int severity,
- char *xmsg, int xcode,
- size_t bytes_sofar, size_t bytes_max,
- void * ptr TSRMLS_DC);
-
-#define PHP_STREAM_NOTIFIER_PROGRESS 1
-
-typedef struct _php_stream_notifier {
- php_stream_notification_func func;
- void *ptr;
- int mask;
- size_t progress, progress_max; /* position for progress notification */
-} php_stream_notifier;
-
-struct _php_stream_context {
- php_stream_notifier *notifier;
- zval *options; /* hash keyed by wrapper family or specific wrapper */
-};
-
-PHPAPI void php_stream_context_free(php_stream_context *context);
-PHPAPI php_stream_context *php_stream_context_alloc(void);
-PHPAPI int php_stream_context_get_option(php_stream_context *context,
- const char *wrappername, const char *optionname, zval ***optionvalue);
-PHPAPI int php_stream_context_set_option(php_stream_context *context,
- const char *wrappername, const char *optionname, zval *optionvalue);
-
-PHPAPI php_stream_notifier *php_stream_notification_alloc(void);
-PHPAPI void php_stream_notification_free(php_stream_notifier *notifier);
-
-/* not all notification codes are implemented */
-#define PHP_STREAM_NOTIFY_RESOLVE 1
-#define PHP_STREAM_NOTIFY_CONNECT 2
-#define PHP_STREAM_NOTIFY_AUTH_REQUIRED 3
-#define PHP_STREAM_NOTIFY_MIME_TYPE_IS 4
-#define PHP_STREAM_NOTIFY_FILE_SIZE_IS 5
-#define PHP_STREAM_NOTIFY_REDIRECTED 6
-#define PHP_STREAM_NOTIFY_PROGRESS 7
-#define PHP_STREAM_NOTIFY_COMPLETED 8
-#define PHP_STREAM_NOTIFY_FAILURE 9
-#define PHP_STREAM_NOTIFY_AUTH_RESULT 10
-
-#define PHP_STREAM_NOTIFY_SEVERITY_INFO 0
-#define PHP_STREAM_NOTIFY_SEVERITY_WARN 1
-#define PHP_STREAM_NOTIFY_SEVERITY_ERR 2
-
-PHPAPI void php_stream_notification_notify(php_stream_context *context, int notifycode, int severity,
- char *xmsg, int xcode, size_t bytes_sofar, size_t bytes_max, void * ptr TSRMLS_DC);
-PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream_context *context);
-
-#define php_stream_notify_info(context, code, xmsg, xcode) do { if ((context) && (context)->notifier) { \
- php_stream_notification_notify((context), (code), PHP_STREAM_NOTIFY_SEVERITY_INFO, \
- (xmsg), (xcode), 0, 0, NULL TSRMLS_CC); } } while (0)
-
-#define php_stream_notify_progress(context, bsofar, bmax) do { if ((context) && (context)->notifier) { \
- php_stream_notification_notify((context), PHP_STREAM_NOTIFY_PROGRESS, PHP_STREAM_NOTIFY_SEVERITY_INFO, \
- NULL, 0, (bsofar), (bmax), NULL TSRMLS_CC); } } while(0)
-
-#define php_stream_notify_progress_init(context, sofar, bmax) do { if ((context) && (context)->notifier) { \
- (context)->notifier->progress = (sofar); \
- (context)->notifier->progress_max = (bmax); \
- (context)->notifier->mask |= PHP_STREAM_NOTIFIER_PROGRESS; \
- php_stream_notify_progress((context), (sofar), (bmax)); } } while (0)
-
-#define php_stream_notify_progress_increment(context, dsofar, dmax) do { if ((context) && (context)->notifier && (context)->notifier->mask & PHP_STREAM_NOTIFIER_PROGRESS) { \
- (context)->notifier->progress += (dsofar); \
- (context)->notifier->progress_max += (dmax); \
- php_stream_notify_progress((context), (context)->notifier->progress, (context)->notifier->progress_max); } } while (0)
-
-#define php_stream_notify_file_size(context, file_size, xmsg, xcode) do { if ((context) && (context)->notifier) { \
- php_stream_notification_notify((context), PHP_STREAM_NOTIFY_FILE_SIZE_IS, PHP_STREAM_NOTIFY_SEVERITY_INFO, \
- (xmsg), (xcode), 0, (file_size), NULL TSRMLS_CC); } } while(0)
-
-#define php_stream_notify_error(context, code, xmsg, xcode) do { if ((context) && (context)->notifier) {\
- php_stream_notification_notify((context), (code), PHP_STREAM_NOTIFY_SEVERITY_ERR, \
- (xmsg), (xcode), 0, 0, NULL TSRMLS_CC); } } while(0)
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/streams/php_stream_filter_api.h b/main/streams/php_stream_filter_api.h
deleted file mode 100644
index 70a3e1dc6b..0000000000
--- a/main/streams/php_stream_filter_api.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- | With suggestions from: |
- | Moriyoshi Koizumi <moriyoshi@at.wakwak.com> |
- | Sara Golemon <pollita@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* The filter API works on the principle of "Bucket-Brigades". This is
- * partially inspired by the Apache 2 method of doing things, although
- * it is intentially a light-weight implementation.
- *
- * Each stream can have a chain of filters for reading and another for writing.
- *
- * When data is written to the stream, is is placed into a bucket and placed at
- * the start of the input brigade.
- *
- * The first filter in the chain is invoked on the brigade and (depending on
- * it's return value), the next filter is invoked and so on.
- * */
-
-#define PHP_STREAM_FILTER_READ 0x0001
-#define PHP_STREAM_FILTER_WRITE 0x0002
-#define PHP_STREAM_FILTER_ALL (PHP_STREAM_FILTER_READ | PHP_STREAM_FILTER_WRITE)
-
-typedef struct _php_stream_bucket php_stream_bucket;
-typedef struct _php_stream_bucket_brigade php_stream_bucket_brigade;
-
-struct _php_stream_bucket {
- php_stream_bucket *next, *prev;
- php_stream_bucket_brigade *brigade;
-
- char *buf;
- size_t buflen;
- /* if non-zero, buf should be pefreed when the bucket is destroyed */
- int own_buf;
- int is_persistent;
-
- /* destroy this struct when refcount falls to zero */
- int refcount;
-};
-
-struct _php_stream_bucket_brigade {
- php_stream_bucket *head, *tail;
-};
-
-typedef enum {
- PSFS_ERR_FATAL, /* error in data stream */
- PSFS_FEED_ME, /* filter needs more data; stop processing chain until more is available */
- PSFS_PASS_ON, /* filter generated output buckets; pass them on to next in chain */
-} php_stream_filter_status_t;
-
-/* Buckets API. */
-PHPAPI php_stream_bucket *php_stream_bucket_new(php_stream *stream, char *buf, size_t buflen, int own_buf, int buf_persistent TSRMLS_DC);
-PHPAPI int php_stream_bucket_split(php_stream_bucket *in, php_stream_bucket **left, php_stream_bucket **right, size_t length TSRMLS_DC);
-PHPAPI void php_stream_bucket_delref(php_stream_bucket *bucket TSRMLS_DC);
-#define php_stream_bucket_addref(bucket) (bucket)->refcount++
-PHPAPI void php_stream_bucket_prepend(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket TSRMLS_DC);
-PHPAPI void php_stream_bucket_append(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket TSRMLS_DC);
-PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket TSRMLS_DC);
-PHPAPI php_stream_bucket *php_stream_bucket_make_writeable(php_stream_bucket *bucket TSRMLS_DC);
-
-#define PSFS_FLAG_NORMAL 0 /* regular read/write */
-#define PSFS_FLAG_FLUSH_INC 1 /* an incremental flush */
-#define PSFS_FLAG_FLUSH_CLOSE 2 /* final flush prior to closing */
-
-typedef struct _php_stream_filter_ops {
-
- php_stream_filter_status_t (*filter)(
- php_stream *stream,
- php_stream_filter *thisfilter,
- php_stream_bucket_brigade *buckets_in,
- php_stream_bucket_brigade *buckets_out,
- size_t *bytes_consumed,
- int flags
- TSRMLS_DC);
-
- void (*dtor)(php_stream_filter *thisfilter TSRMLS_DC);
-
- const char *label;
-
-} php_stream_filter_ops;
-
-typedef struct _php_stream_filter_chain {
- php_stream_filter *head, *tail;
-} php_stream_filter_chain;
-
-struct _php_stream_filter {
- php_stream_filter_ops *fops;
- void *abstract; /* for use by filter implementation */
- php_stream_filter *next;
- php_stream_filter *prev;
- int is_persistent;
-
- /* link into stream and chain */
- php_stream_filter_chain *chain;
-
- /* buffered buckets */
- php_stream_bucket_brigade buffer;
-};
-
-/* stack filter onto a stream */
-PHPAPI void php_stream_filter_prepend(php_stream_filter_chain *chain, php_stream_filter *filter);
-PHPAPI void php_stream_filter_append(php_stream_filter_chain *chain, php_stream_filter *filter);
-PHPAPI php_stream_filter *php_stream_filter_remove(php_stream_filter *filter, int call_dtor TSRMLS_DC);
-PHPAPI void php_stream_filter_free(php_stream_filter *filter TSRMLS_DC);
-PHPAPI php_stream_filter *_php_stream_filter_alloc(php_stream_filter_ops *fops, void *abstract, int persistent STREAMS_DC TSRMLS_DC);
-#define php_stream_filter_alloc(fops, thisptr, persistent) _php_stream_filter_alloc((fops), (thisptr), (persistent) STREAMS_CC TSRMLS_CC)
-#define php_stream_filter_alloc_rel(fops, thisptr, persistent) _php_stream_filter_alloc((fops), (thisptr), (persistent) STREAMS_REL_CC TSRMLS_CC)
-
-#define php_stream_is_filtered(stream) ((stream)->readfilters.head || (stream)->writefilters.head)
-
-typedef struct _php_stream_filter_factory {
- php_stream_filter *(*create_filter)(const char *filtername, zval *filterparams, int persistent TSRMLS_DC);
-} php_stream_filter_factory;
-
-PHPAPI int php_stream_filter_register_factory(const char *filterpattern, php_stream_filter_factory *factory TSRMLS_DC);
-PHPAPI int php_stream_filter_unregister_factory(const char *filterpattern TSRMLS_DC);
-PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC);
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/streams/php_stream_mmap.h b/main/streams/php_stream_mmap.h
deleted file mode 100644
index ccfc767246..0000000000
--- a/main/streams/php_stream_mmap.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* Memory Mapping interface for streams.
- * The intention is to provide a uniform interface over the most common
- * operations that are used within PHP itself, rather than a complete
- * API for all memory mapping needs.
- *
- * ATM, we support only mmap(), but win32 memory mapping support will
- * follow soon.
- * */
-
-typedef enum {
- /* Does the stream support mmap ? */
- PHP_STREAM_MMAP_SUPPORTED,
- /* Request a range and offset to be mapped;
- * while mapped, you MUST NOT use any read/write functions
- * on the stream (win9x compatibility) */
- PHP_STREAM_MMAP_MAP_RANGE,
- /* Unmap the last range that was mapped for the stream */
- PHP_STREAM_MMAP_UNMAP
-} php_stream_mmap_operation_t;
-
-typedef enum {
- PHP_STREAM_MAP_MODE_READONLY,
- PHP_STREAM_MAP_MODE_READWRITE,
- PHP_STREAM_MAP_MODE_SHARED_READONLY,
- PHP_STREAM_MAP_MODE_SHARED_READWRITE
-} php_stream_mmap_access_t;
-
-typedef struct {
- /* requested offset and length.
- * If length is 0, the whole file is mapped */
- size_t offset;
- size_t length;
-
- php_stream_mmap_access_t mode;
-
- /* returned mapped address */
- char *mapped;
-
-} php_stream_mmap_range;
-
-#define php_stream_mmap_supported(stream) (_php_stream_set_option((stream), PHP_STREAM_OPTION_MMAP_API, PHP_STREAM_MMAP_SUPPORTED, NULL TSRMLS_CC) == 0 ? 1 : 0)
-
-/* Returns 1 if the stream in its current state can be memory mapped,
- * 0 otherwise */
-#define php_stream_mmap_possible(stream) (!php_stream_is_filtered((stream)) && php_stream_mmap_supported((stream)))
-
-PHPAPI char *_php_stream_mmap_range(php_stream *stream, size_t offset, size_t length, php_stream_mmap_operation_t mode, size_t *mapped_len TSRMLS_DC);
-#define php_stream_mmap_range(stream, offset, length, mode, mapped_len) _php_stream_mmap_range((stream), (offset), (length), (mode), (mapped_len) TSRMLS_CC)
-
-/* un-maps the last mapped range */
-PHPAPI int _php_stream_mmap_unmap(php_stream *stream TSRMLS_DC);
-#define php_stream_mmap_unmap(stream) _php_stream_mmap_unmap((stream) TSRMLS_CC)
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/main/streams/php_stream_plain_wrapper.h b/main/streams/php_stream_plain_wrapper.h
deleted file mode 100644
index 57439b4717..0000000000
--- a/main/streams/php_stream_plain_wrapper.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* definitions for the plain files wrapper */
-
-/* operations for a plain file; use the php_stream_fopen_XXX funcs below */
-PHPAPI extern php_stream_ops php_stream_stdio_ops;
-
-/* like fopen, but returns a stream */
-PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, char **opened_path, int options STREAMS_DC TSRMLS_DC);
-#define php_stream_fopen(filename, mode, opened) _php_stream_fopen((filename), (mode), (opened), 0 STREAMS_CC TSRMLS_CC)
-
-PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char *path, char **opened_path, int options STREAMS_DC TSRMLS_DC);
-#define php_stream_fopen_with_path(filename, mode, path, opened) _php_stream_fopen_with_path((filename), (mode), (path), (opened) STREAMS_CC TSRMLS_CC)
-
-PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STREAMS_DC TSRMLS_DC);
-#define php_stream_fopen_from_file(file, mode) _php_stream_fopen_from_file((file), (mode) STREAMS_CC TSRMLS_CC)
-
-PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const char *persistent_id STREAMS_DC TSRMLS_DC);
-#define php_stream_fopen_from_fd(fd, mode, persistent_id) _php_stream_fopen_from_fd((fd), (mode), (persistent_id) STREAMS_CC TSRMLS_CC)
-
-PHPAPI php_stream *_php_stream_fopen_from_pipe(FILE *file, const char *mode STREAMS_DC TSRMLS_DC);
-#define php_stream_fopen_from_pipe(file, mode) _php_stream_fopen_from_pipe((file), (mode) STREAMS_CC TSRMLS_CC)
-
-PHPAPI php_stream *_php_stream_fopen_tmpfile(int dummy STREAMS_DC TSRMLS_DC);
-#define php_stream_fopen_tmpfile() _php_stream_fopen_tmpfile(0 STREAMS_CC TSRMLS_CC)
-
-PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char *pfx, char **opened_path STREAMS_DC TSRMLS_DC);
-#define php_stream_fopen_temporary_file(dir, pfx, opened_path) _php_stream_fopen_temporary_file((dir), (pfx), (opened_path) STREAMS_CC TSRMLS_CC)
-
-/* This is a utility API for extensions that are opening a stream, converting it
- * to a FILE* and then closing it again. Be warned that fileno() on the result
- * will most likely fail on systems with fopencookie. */
-PHPAPI FILE * _php_stream_open_wrapper_as_file(char * path, char * mode, int options, char **opened_path STREAMS_DC TSRMLS_DC);
-#define php_stream_open_wrapper_as_file(path, mode, options, opened_path) _php_stream_open_wrapper_as_file((path), (mode), (options), (opened_path) STREAMS_CC TSRMLS_CC)
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h
deleted file mode 100644
index c1cd622f2b..0000000000
--- a/main/streams/php_stream_transport.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-typedef php_stream *(php_stream_transport_factory_func)(const char *proto, long protolen,
- char *resourcename, long resourcenamelen,
- const char *persistent_id, int options, int flags,
- struct timeval *timeout,
- php_stream_context *context STREAMS_DC TSRMLS_DC);
-typedef php_stream_transport_factory_func *php_stream_transport_factory;
-
-PHPAPI int php_stream_xport_register(char *protocol, php_stream_transport_factory factory TSRMLS_DC);
-PHPAPI int php_stream_xport_unregister(char *protocol TSRMLS_DC);
-
-#define STREAM_XPORT_CLIENT 0
-#define STREAM_XPORT_SERVER 1
-
-#define STREAM_XPORT_CONNECT 2
-#define STREAM_XPORT_BIND 4
-#define STREAM_XPORT_LISTEN 8
-#define STREAM_XPORT_CONNECT_ASYNC 16
-
-/* Open a client or server socket connection */
-PHPAPI php_stream *_php_stream_xport_create(const char *name, long namelen, int options,
- int flags, const char *persistent_id,
- struct timeval *timeout,
- php_stream_context *context,
- char **error_string,
- int *error_code
- STREAMS_DC TSRMLS_DC);
-
-#define php_stream_xport_create(name, namelen, options, flags, persistent_id, timeout, context, estr, ecode) \
- _php_stream_xport_create(name, namelen, options, flags, persistent_id, timeout, context, estr, ecode STREAMS_CC TSRMLS_CC)
-
-/* Bind the stream to a local address */
-PHPAPI int php_stream_xport_bind(php_stream *stream,
- const char *name, long namelen,
- char **error_text
- TSRMLS_DC);
-
-/* Connect to a remote address */
-PHPAPI int php_stream_xport_connect(php_stream *stream,
- const char *name, long namelen,
- int asynchronous,
- struct timeval *timeout,
- char **error_text,
- int *error_code
- TSRMLS_DC);
-
-/* Prepare to listen */
-PHPAPI int php_stream_xport_listen(php_stream *stream,
- int backlog,
- char **error_text
- TSRMLS_DC);
-
-/* Get the next client and their address as a string, or the underlying address
- * structure. You must efree either of these if you request them */
-PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client,
- char **textaddr, int *textaddrlen,
- void **addr, size_t *addrlen,
- struct timeval *timeout,
- char **error_text
- TSRMLS_DC);
-
-/* Get the name of either the socket or it's peer */
-PHPAPI int php_stream_xport_get_name(php_stream *stream, int want_peer,
- char **textaddr, int *textaddrlen,
- void **addr, size_t *addrlen
- TSRMLS_DC);
-
-/* Structure definition for the set_option interface that the above functions wrap */
-
-typedef struct _php_stream_xport_param {
- enum {
- STREAM_XPORT_OP_BIND, STREAM_XPORT_OP_CONNECT,
- STREAM_XPORT_OP_LISTEN, STREAM_XPORT_OP_ACCEPT,
- STREAM_XPORT_OP_CONNECT_ASYNC,
- STREAM_XPORT_OP_GET_NAME,
- STREAM_XPORT_OP_GET_PEER_NAME
- } op;
- int want_addr:1;
- int want_textaddr:1;
- int want_errortext:1;
-
- struct {
- char *name;
- long namelen;
- int backlog;
- struct timeval *timeout;
- } inputs;
- struct {
- php_stream *client;
- int returncode;
- struct sockaddr *addr;
- size_t addrlen;
- char *textaddr;
- long textaddrlen;
-
- char *error_text;
- int error_code;
- } outputs;
-} php_stream_xport_param;
-
-
-/* These functions provide crypto support on the underlying transport */
-typedef enum {
- STREAM_CRYPTO_METHOD_SSLv2_CLIENT,
- STREAM_CRYPTO_METHOD_SSLv3_CLIENT,
- STREAM_CRYPTO_METHOD_SSLv23_CLIENT,
- STREAM_CRYPTO_METHOD_TLS_CLIENT,
- STREAM_CRYPTO_METHOD_SSLv2_SERVER,
- STREAM_CRYPTO_METHOD_SSLv3_SERVER,
- STREAM_CRYPTO_METHOD_SSLv23_SERVER,
- STREAM_CRYPTO_METHOD_TLS_SERVER
-} php_stream_xport_crypt_method_t;
-
-PHPAPI int php_stream_xport_crypto_setup(php_stream *stream, php_stream_xport_crypt_method_t crypto_method, php_stream *session_stream TSRMLS_DC);
-PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate TSRMLS_DC);
-
-typedef struct _php_stream_xport_crypto_param {
- enum {
- STREAM_XPORT_CRYPTO_OP_SETUP,
- STREAM_XPORT_CRYPTO_OP_ENABLE
- } op;
- struct {
- int activate;
- php_stream_xport_crypt_method_t method;
- php_stream *session;
- } inputs;
- struct {
- int returncode;
- } outputs;
-} php_stream_xport_crypto_param;
-
-PHPAPI HashTable *php_stream_xport_get_hash(void);
-PHPAPI php_stream_transport_factory_func php_stream_generic_socket_factory;
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/main/streams/php_stream_userspace.h b/main/streams/php_stream_userspace.h
deleted file mode 100644
index 349cdd7fa5..0000000000
--- a/main/streams/php_stream_userspace.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-
-/* for user-space streams */
-PHPAPI extern php_stream_ops php_stream_userspace_ops;
-PHPAPI extern php_stream_ops php_stream_userspace_dir_ops;
-#define PHP_STREAM_IS_USERSPACE &php_stream_userspace_ops
-#define PHP_STREAM_IS_USERSPACE_DIR &php_stream_userspace_dir_ops
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/streams/php_streams_int.h b/main/streams/php_streams_int.h
deleted file mode 100644
index ddf569399d..0000000000
--- a/main/streams/php_streams_int.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#if ZEND_DEBUG
-#define emalloc_rel_orig(size) \
- ( __php_stream_call_depth == 0 \
- ? _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_RELAY_CC) \
- : _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC) )
-
-#define erealloc_rel_orig(ptr, size) \
- ( __php_stream_call_depth == 0 \
- ? _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_RELAY_CC) \
- : _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC) )
-
-
-#define pemalloc_rel_orig(size, persistent) ((persistent) ? malloc((size)) : emalloc_rel_orig((size)))
-#define perealloc_rel_orig(ptr, size, persistent) ((persistent) ? realloc((ptr), (size)) : erealloc_rel_orig((ptr), (size)))
-#else
-# define pemalloc_rel_orig(size, persistent) pemalloc((size), (persistent))
-# define perealloc_rel_orig(ptr, size, persistent) perealloc((ptr), (size), (persistent))
-# define emalloc_rel_orig(size) emalloc((size))
-#endif
-
-#define STREAM_DEBUG 0
-#define STREAM_WRAPPER_PLAIN_FILES ((php_stream_wrapper*)-1)
-extern php_stream_wrapper php_plain_files_wrapper;
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *) -1)
-#endif
-
-#define CHUNK_SIZE 8192
-
-#ifdef PHP_WIN32
-#define EWOULDBLOCK WSAEWOULDBLOCK
-#endif
-
-#ifndef S_ISREG
-#define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG)
-#endif
-
-void php_stream_tidy_wrapper_error_log(php_stream_wrapper *wrapper TSRMLS_DC);
-void php_stream_display_wrapper_errors(php_stream_wrapper *wrapper, const char *path, const char *caption TSRMLS_DC);
-
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
deleted file mode 100644
index d3c36b335f..0000000000
--- a/main/streams/plain_wrapper.c
+++ /dev/null
@@ -1,1126 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_network.h"
-#include "php_open_temporary_file.h"
-#include "ext/standard/file.h"
-#include "ext/standard/flock_compat.h"
-#include <stddef.h>
-#include <fcntl.h>
-#if HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-#if HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-
-#include "php_streams_int.h"
-
-/* parse standard "fopen" modes into open() flags */
-PHPAPI int php_stream_parse_fopen_modes(const char *mode, int *open_flags)
-{
- int flags;
-
- switch (mode[0]) {
- case 'r':
- flags = 0;
- break;
- case 'w':
- flags = O_TRUNC|O_CREAT;
- break;
- case 'a':
- flags = O_CREAT|O_APPEND;
- break;
- case 'x':
- flags = O_CREAT|O_EXCL;
- break;
- default:
- /* unknown mode */
- return FAILURE;
- }
-
- if (strchr(mode, '+')) {
- flags |= O_RDWR;
- } else if (flags) {
- flags |= O_WRONLY;
- } else {
- flags |= O_RDONLY;
- }
-
-#ifdef O_BINARY
- if (strchr(mode, 'b')) {
- flags |= O_BINARY;
- }
-#endif
-
- *open_flags = flags;
- return SUCCESS;
-}
-
-
-/* {{{ php_stream_fopen */
-PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, char **opened_path, int options STREAMS_DC TSRMLS_DC)
-{
- char *realpath = NULL;
- struct stat st;
- int open_flags;
- int fd;
- php_stream *ret;
- int persistent = options & STREAM_OPEN_PERSISTENT;
- char *persistent_id = NULL;
-
- if (FAILURE == php_stream_parse_fopen_modes(mode, &open_flags)) {
- if (options & REPORT_ERRORS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "`%s' is not a valid mode for fopen", mode);
- }
- return NULL;
- }
-
- realpath = expand_filepath(filename, NULL TSRMLS_CC);
-
- if (persistent) {
- spprintf(&persistent_id, 0, "streams_stdio_%d_%s", open_flags, realpath);
- switch (php_stream_from_persistent_id(persistent_id, &ret TSRMLS_CC)) {
- case PHP_STREAM_PERSISTENT_SUCCESS:
- if (opened_path) {
- *opened_path = realpath;
- realpath = NULL;
- }
- if (realpath) {
- efree(realpath);
- }
- /* fall through */
-
- case PHP_STREAM_PERSISTENT_FAILURE:
- efree(persistent_id);;
- return ret;
- }
- }
-
- fd = open(realpath, open_flags, 0666);
-
- if (fd != -1) {
- /* sanity checks for include/require */
- if (options & STREAM_OPEN_FOR_INCLUDE && (fstat(fd, &st) == -1 || !S_ISREG(st.st_mode))) {
-#ifdef PHP_WIN32
- /* skip the sanity check; fstat doesn't appear to work on
- * UNC paths */
- if (!IS_UNC_PATH(filename, strlen(filename)))
-#endif
- goto err;
- }
-
- ret = php_stream_fopen_from_fd_rel(fd, mode, persistent_id);
-
- if (ret) {
- if (opened_path) {
- *opened_path = realpath;
- realpath = NULL;
- }
- if (realpath) {
- efree(realpath);
- }
- if (persistent_id) {
- efree(persistent_id);
- }
- return ret;
- }
-err:
- close(fd);
- }
- efree(realpath);
- if (persistent_id) {
- efree(persistent_id);
- }
- return NULL;
-}
-/* }}} */
-
-/* {{{ ------- STDIO stream implementation -------*/
-
-typedef struct {
- FILE *file;
- int fd; /* underlying file descriptor */
- int is_process_pipe; /* use pclose instead of fclose */
- int is_pipe; /* don't try and seek */
- int lock_flag; /* stores the lock state */
- char *temp_file_name; /* if non-null, this is the path to a temporary file that
- * is to be deleted when the stream is closed */
-#if HAVE_FLUSHIO
- char last_op;
-#endif
-
-#if HAVE_MMAP
- char *last_mapped_addr;
- size_t last_mapped_len;
-#endif
-#ifdef PHP_WIN32
- char *last_mapped_addr;
- HANDLE file_mapping;
-#endif
-} php_stdio_stream_data;
-
-PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char *pfx, char **opened_path STREAMS_DC TSRMLS_DC)
-{
- int fd = php_open_temporary_fd(dir, pfx, opened_path TSRMLS_CC);
-
- if (fd != -1) {
- php_stream *stream = php_stream_fopen_from_fd_rel(fd, "r+b", NULL);
- if (stream) {
- return stream;
- }
- close(fd);
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to allocate stream");
-
- return NULL;
- }
- return NULL;
-}
-
-PHPAPI php_stream *_php_stream_fopen_tmpfile(int dummy STREAMS_DC TSRMLS_DC)
-{
- char *opened_path = NULL;
- int fd = php_open_temporary_fd(NULL, "php", &opened_path TSRMLS_CC);
-
- if (fd != -1) {
- php_stream *stream = php_stream_fopen_from_fd_rel(fd, "r+b", NULL);
- if (stream) {
- php_stdio_stream_data *self = (php_stdio_stream_data*)stream->abstract;
-
- self->temp_file_name = opened_path;
- self->lock_flag = LOCK_UN;
-
- return stream;
- }
- close(fd);
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to allocate stream");
-
- return NULL;
- }
- return NULL;
-}
-
-PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const char *persistent_id STREAMS_DC TSRMLS_DC)
-{
- php_stdio_stream_data *self;
- php_stream *stream;
-
- self = pemalloc_rel_orig(sizeof(*self), persistent_id);
- memset(self, 0, sizeof(*self));
- self->file = NULL;
- self->is_pipe = 0;
- self->lock_flag = LOCK_UN;
- self->is_process_pipe = 0;
- self->temp_file_name = NULL;
- self->fd = fd;
-
-#ifdef S_ISFIFO
- /* detect if this is a pipe */
- if (self->fd >= 0) {
- struct stat sb;
- self->is_pipe = (fstat(self->fd, &sb) == 0 && S_ISFIFO(sb.st_mode)) ? 1 : 0;
- }
-#elif defined(PHP_WIN32)
- {
- long handle = _get_osfhandle(self->fd);
- DWORD in_buf_size, out_buf_size;
-
- if (handle != 0xFFFFFFFF) {
- self->is_pipe = GetNamedPipeInfo((HANDLE)handle, NULL, &out_buf_size, &in_buf_size, NULL);
- }
- }
-#endif
-
- stream = php_stream_alloc_rel(&php_stream_stdio_ops, self, persistent_id, mode);
-
- if (stream) {
- if (self->is_pipe) {
- stream->flags |= PHP_STREAM_FLAG_NO_SEEK;
- } else {
- stream->position = lseek(self->fd, 0, SEEK_CUR);
- }
- }
-
- return stream;
-}
-
-PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STREAMS_DC TSRMLS_DC)
-{
- php_stdio_stream_data *self;
- php_stream *stream;
-
- self = emalloc_rel_orig(sizeof(*self));
- memset(self, 0, sizeof(*self));
- self->file = file;
- self->is_pipe = 0;
- self->lock_flag = LOCK_UN;
- self->is_process_pipe = 0;
- self->temp_file_name = NULL;
- self->fd = fileno(file);
-
-#ifdef S_ISFIFO
- /* detect if this is a pipe */
- if (self->fd >= 0) {
- struct stat sb;
- self->is_pipe = (fstat(self->fd, &sb) == 0 && S_ISFIFO(sb.st_mode)) ? 1 : 0;
- }
-#elif defined(PHP_WIN32)
- {
- long handle = _get_osfhandle(self->fd);
- DWORD in_buf_size, out_buf_size;
-
- if (handle != 0xFFFFFFFF) {
- self->is_pipe = GetNamedPipeInfo((HANDLE)handle, NULL, &out_buf_size, &in_buf_size, NULL);
- }
- }
-#endif
-
- stream = php_stream_alloc_rel(&php_stream_stdio_ops, self, 0, mode);
-
- if (stream) {
- if (self->is_pipe) {
- stream->flags |= PHP_STREAM_FLAG_NO_SEEK;
- } else {
- stream->position = ftell(file);
- }
- }
-
- return stream;
-}
-
-PHPAPI php_stream *_php_stream_fopen_from_pipe(FILE *file, const char *mode STREAMS_DC TSRMLS_DC)
-{
- php_stdio_stream_data *self;
- php_stream *stream;
-
- self = emalloc_rel_orig(sizeof(*self));
- memset(self, 0, sizeof(*self));
- self->file = file;
- self->is_pipe = 1;
- self->lock_flag = LOCK_UN;
- self->is_process_pipe = 1;
- self->fd = fileno(file);
- self->temp_file_name = NULL;
-
- stream = php_stream_alloc_rel(&php_stream_stdio_ops, self, 0, mode);
- stream->flags |= PHP_STREAM_FLAG_NO_SEEK;
- return stream;
-}
-
-#define PHP_STDIOP_GET_FD(anfd, data) anfd = (data)->file ? fileno((data)->file) : (data)->fd
-
-static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
-{
- php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
-
- assert(data != NULL);
-
- if (data->fd >= 0) {
- int bytes_written = write(data->fd, buf, count);
- if (bytes_written < 0) return 0;
- return (size_t) bytes_written;
- } else {
-
-#if HAVE_FLUSHIO
- if (!data->is_pipe && data->last_op == 'r') {
- fseek(data->file, 0, SEEK_CUR);
- }
- data->last_op = 'w';
-#endif
-
- return fwrite(buf, 1, count, data->file);
- }
-}
-
-static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-{
- php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
- size_t ret;
-
- assert(data != NULL);
-
- if (data->fd >= 0) {
- ret = read(data->fd, buf, count);
-
- if (ret == 0 || (ret == -1 && errno != EWOULDBLOCK))
- stream->eof = 1;
-
- } else {
-#if HAVE_FLUSHIO
- if (!data->is_pipe && data->last_op == 'w')
- fseek(data->file, 0, SEEK_CUR);
- data->last_op = 'r';
-#endif
-
- ret = fread(buf, 1, count, data->file);
-
- if (feof(data->file))
- stream->eof = 1;
- }
- return ret;
-}
-
-static int php_stdiop_close(php_stream *stream, int close_handle TSRMLS_DC)
-{
- int ret;
- php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
-
- assert(data != NULL);
-
-#if HAVE_MMAP
- if (data->last_mapped_addr) {
- munmap(data->last_mapped_addr, data->last_mapped_len);
- data->last_mapped_addr = NULL;
- }
-#elif defined(PHP_WIN32)
- if (data->last_mapped_addr) {
- UnmapViewOfFile(data->last_mapped_addr);
- data->last_mapped_addr = NULL;
- }
- if (data->file_mapping) {
- CloseHandle(data->file_mapping);
- data->file_mapping = NULL;
- }
-#endif
-
- if (close_handle) {
- if (data->lock_flag != LOCK_UN) {
- php_stream_lock(stream, LOCK_UN);
- }
- if (data->file) {
- if (data->is_process_pipe) {
- errno = 0;
- ret = pclose(data->file);
-
-#if HAVE_SYS_WAIT_H
- if (WIFEXITED(ret)) {
- ret = WEXITSTATUS(ret);
- }
-#endif
- } else {
- ret = fclose(data->file);
- data->file = NULL;
- }
- } else if (data->fd != -1) {
- ret = close(data->fd);
- data->fd = -1;
- } else {
- return 0; /* everything should be closed already -> success */
- }
- if (data->temp_file_name) {
- unlink(data->temp_file_name);
- /* temporary streams are never persistent */
- efree(data->temp_file_name);
- data->temp_file_name = NULL;
- }
- } else {
- ret = 0;
- data->file = NULL;
- data->fd = -1;
- }
-
- pefree(data, stream->is_persistent);
-
- return ret;
-}
-
-static int php_stdiop_flush(php_stream *stream TSRMLS_DC)
-{
- php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
-
- assert(data != NULL);
-
- /*
- * stdio buffers data in user land. By calling fflush(3), this
- * data is send to the kernel using write(2). fsync'ing is
- * something completely different.
- */
- if (data->file) {
- return fflush(data->file);
- }
- return 0;
-}
-
-static int php_stdiop_seek(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC)
-{
- php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
- int ret;
-
- assert(data != NULL);
-
- if (data->is_pipe) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot seek on a pipe");
- return -1;
- }
-
- if (data->fd >= 0) {
- off_t result;
-
- result = lseek(data->fd, offset, whence);
- if (result == (off_t)-1)
- return -1;
-
- *newoffset = result;
- return 0;
-
- } else {
- ret = fseek(data->file, offset, whence);
- *newoffset = ftell(data->file);
- return ret;
- }
-}
-
-static int php_stdiop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
-{
- int fd;
- php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract;
-
- assert(data != NULL);
-
- /* as soon as someone touches the stdio layer, buffering may ensue,
- * so we need to stop using the fd directly in that case */
-
- switch (castas) {
- case PHP_STREAM_AS_STDIO:
- if (ret) {
-
- if (data->file == NULL) {
- /* we were opened as a plain file descriptor, so we
- * need fdopen now */
- data->file = fdopen(data->fd, stream->mode);
- }
-
- *(FILE**)ret = data->file;
- data->fd = -1;
- }
- return SUCCESS;
-
- case PHP_STREAM_AS_FD:
- PHP_STDIOP_GET_FD(fd, data);
-
- if (fd < 0) {
- return FAILURE;
- }
- if (data->file) {
- fflush(data->file);
- }
- if (ret) {
- *(int*)ret = fd;
- }
- return SUCCESS;
- default:
- return FAILURE;
- }
-}
-
-static int php_stdiop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC)
-{
- int fd;
- php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract;
-
- assert(data != NULL);
-
- PHP_STDIOP_GET_FD(fd, data);
-
- return fstat(fd, &ssb->sb);
-}
-
-static int php_stdiop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC)
-{
- php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract;
- size_t size;
- int fd;
-#ifdef O_NONBLOCK
- /* FIXME: make this work for win32 */
- int flags;
- int oldval;
-#endif
-
- PHP_STDIOP_GET_FD(fd, data);
-
- switch(option) {
- case PHP_STREAM_OPTION_BLOCKING:
- if (fd == -1)
- return -1;
-#ifdef O_NONBLOCK
- flags = fcntl(fd, F_GETFL, 0);
- oldval = (flags & O_NONBLOCK) ? 0 : 1;
- if (value)
- flags ^= O_NONBLOCK;
- else
- flags |= O_NONBLOCK;
-
- if (-1 == fcntl(fd, F_SETFL, flags))
- return -1;
- return oldval;
-#else
- return -1; /* not yet implemented */
-#endif
-
- case PHP_STREAM_OPTION_WRITE_BUFFER:
-
- if (data->file == NULL) {
- return -1;
- }
-
- if (ptrparam)
- size = *(size_t *)ptrparam;
- else
- size = BUFSIZ;
-
- switch(value) {
- case PHP_STREAM_BUFFER_NONE:
- stream->flags |= PHP_STREAM_FLAG_NO_BUFFER;
- return setvbuf(data->file, NULL, _IONBF, 0);
-
- case PHP_STREAM_BUFFER_LINE:
- stream->flags ^= PHP_STREAM_FLAG_NO_BUFFER;
- return setvbuf(data->file, NULL, _IOLBF, size);
-
- case PHP_STREAM_BUFFER_FULL:
- stream->flags ^= PHP_STREAM_FLAG_NO_BUFFER;
- return setvbuf(data->file, NULL, _IOFBF, size);
-
- default:
- return -1;
- }
- break;
-
- case PHP_STREAM_OPTION_LOCKING:
- if (fd == -1) {
- return -1;
- }
-
- if ((int) ptrparam == PHP_STREAM_LOCK_SUPPORTED) {
- return 0;
- }
-
- if (!flock(fd, value) || (errno == EWOULDBLOCK && value & LOCK_NB)) {
- data->lock_flag = value;
- return 0;
- } else {
- return -1;
- }
- break;
-
- case PHP_STREAM_OPTION_MMAP_API:
-#if HAVE_MMAP
- {
- php_stream_mmap_range *range = (php_stream_mmap_range*)ptrparam;
- struct stat sbuf;
- int prot, flags;
-
- switch (value) {
- case PHP_STREAM_MMAP_SUPPORTED:
- return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK;
-
- case PHP_STREAM_MMAP_MAP_RANGE:
- fstat(fd, &sbuf);
- if (range->length == 0 || range->length > sbuf.st_size) {
- range->length = sbuf.st_size;
- }
- switch (range->mode) {
- case PHP_STREAM_MAP_MODE_READONLY:
- prot = PROT_READ;
- flags = MAP_PRIVATE;
- break;
- case PHP_STREAM_MAP_MODE_READWRITE:
- prot = PROT_READ | PROT_WRITE;
- flags = MAP_PRIVATE;
- break;
- case PHP_STREAM_MAP_MODE_SHARED_READONLY:
- prot = PROT_READ;
- flags = MAP_SHARED;
- break;
- case PHP_STREAM_MAP_MODE_SHARED_READWRITE:
- prot = PROT_READ | PROT_WRITE;
- flags = MAP_SHARED;
- break;
- default:
- return PHP_STREAM_OPTION_RETURN_ERR;
- }
- range->mapped = (char*)mmap(NULL, range->length, prot, flags, fd, range->offset);
- if (range->mapped == (char*)MAP_FAILED) {
- range->mapped = NULL;
- return PHP_STREAM_OPTION_RETURN_ERR;
- }
- /* remember the mapping */
- data->last_mapped_addr = range->mapped;
- data->last_mapped_len = range->length;
- return PHP_STREAM_OPTION_RETURN_OK;
-
- case PHP_STREAM_MMAP_UNMAP:
- if (data->last_mapped_addr) {
- munmap(data->last_mapped_addr, data->last_mapped_len);
- data->last_mapped_addr = NULL;
-
- return PHP_STREAM_OPTION_RETURN_OK;
- }
- return PHP_STREAM_OPTION_RETURN_ERR;
- }
- }
-#elif defined(PHP_WIN32)
- {
- php_stream_mmap_range *range = (php_stream_mmap_range*)ptrparam;
- HANDLE hfile = (HANDLE)_get_osfhandle(fd);
- DWORD prot, acc, loffs = 0, delta = 0;
-
- switch (value) {
- case PHP_STREAM_MMAP_SUPPORTED:
- return hfile == INVALID_HANDLE_VALUE ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK;
-
- case PHP_STREAM_MMAP_MAP_RANGE:
- switch (range->mode) {
- case PHP_STREAM_MAP_MODE_READONLY:
- prot = PAGE_READONLY;
- acc = FILE_MAP_READ;
- break;
- case PHP_STREAM_MAP_MODE_READWRITE:
- prot = PAGE_READWRITE;
- acc = FILE_MAP_READ | FILE_MAP_WRITE;
- break;
- case PHP_STREAM_MAP_MODE_SHARED_READONLY:
- prot = PAGE_READONLY;
- acc = FILE_MAP_READ;
- /* TODO: we should assign a name for the mapping */
- break;
- case PHP_STREAM_MAP_MODE_SHARED_READWRITE:
- prot = PAGE_READWRITE;
- acc = FILE_MAP_READ | FILE_MAP_WRITE;
- /* TODO: we should assign a name for the mapping */
- break;
- }
-
- /* create a mapping capable of viewing the whole file (this costs no real resources) */
- data->file_mapping = CreateFileMapping(hfile, NULL, prot, 0, 0, NULL);
-
- if (data->file_mapping == NULL) {
- return PHP_STREAM_OPTION_RETURN_ERR;
- }
-
- if (range->length == 0) {
- range->length = GetFileSize(hfile, NULL) - range->offset;
- }
-
- /* figure out how big a chunk to map to be able to view the part that we need */
- if (range->offset != 0) {
- SYSTEM_INFO info;
- DWORD gran;
-
- GetSystemInfo(&info);
- gran = info.dwAllocationGranularity;
- loffs = (range->offset / gran) * gran;
- delta = range->offset - loffs;
- }
-
- data->last_mapped_addr = MapViewOfFile(data->file_mapping, acc, 0, loffs, range->length);
-
- if (data->last_mapped_addr) {
- /* give them back the address of the start offset they requested */
- range->mapped = data->last_mapped_addr + delta;
- return PHP_STREAM_OPTION_RETURN_OK;
- }
-
- CloseHandle(data->file_mapping);
- data->file_mapping = NULL;
-
- return PHP_STREAM_OPTION_RETURN_ERR;
-
- case PHP_STREAM_MMAP_UNMAP:
- if (data->last_mapped_addr) {
- UnmapViewOfFile(data->last_mapped_addr);
- data->last_mapped_addr = NULL;
- CloseHandle(data->file_mapping);
- data->file_mapping = NULL;
- return PHP_STREAM_OPTION_RETURN_OK;
- }
- return PHP_STREAM_OPTION_RETURN_ERR;
-
- default:
- return PHP_STREAM_OPTION_RETURN_ERR;
- }
- }
-
-#endif
- return PHP_STREAM_OPTION_RETURN_NOTIMPL;
-
- case PHP_STREAM_OPTION_TRUNCATE_API:
- switch (value) {
- case PHP_STREAM_TRUNCATE_SUPPORTED:
- return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK;
-
- case PHP_STREAM_TRUNCATE_SET_SIZE:
- return ftruncate(fd, *(size_t*)ptrparam) == 0 ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR;
- }
-
- default:
- return PHP_STREAM_OPTION_RETURN_NOTIMPL;
- }
-}
-
-PHPAPI php_stream_ops php_stream_stdio_ops = {
- php_stdiop_write, php_stdiop_read,
- php_stdiop_close, php_stdiop_flush,
- "STDIO",
- php_stdiop_seek,
- php_stdiop_cast,
- php_stdiop_stat,
- php_stdiop_set_option
-};
-/* }}} */
-
-/* {{{ plain files opendir/readdir implementation */
-static size_t php_plain_files_dirstream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-{
- DIR *dir = (DIR*)stream->abstract;
- /* avoid libc5 readdir problems */
- char entry[sizeof(struct dirent)+MAXPATHLEN];
- struct dirent *result = (struct dirent *)&entry;
- php_stream_dirent *ent = (php_stream_dirent*)buf;
-
- /* avoid problems if someone mis-uses the stream */
- if (count != sizeof(php_stream_dirent))
- return 0;
-
- if (php_readdir_r(dir, (struct dirent *)entry, &result) == 0 && result) {
- PHP_STRLCPY(ent->d_name, result->d_name, sizeof(ent->d_name), strlen(result->d_name));
- return sizeof(php_stream_dirent);
- }
- return 0;
-}
-
-static int php_plain_files_dirstream_close(php_stream *stream, int close_handle TSRMLS_DC)
-{
- return closedir((DIR *)stream->abstract);
-}
-
-static int php_plain_files_dirstream_rewind(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC)
-{
- rewinddir((DIR *)stream->abstract);
- return 0;
-}
-
-static php_stream_ops php_plain_files_dirstream_ops = {
- NULL, php_plain_files_dirstream_read,
- php_plain_files_dirstream_close, NULL,
- "dir",
- php_plain_files_dirstream_rewind,
- NULL, /* cast */
- NULL, /* stat */
- NULL /* set_option */
-};
-
-static php_stream *php_plain_files_dir_opener(php_stream_wrapper *wrapper, char *path, char *mode,
- int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
-{
- DIR *dir = NULL;
- php_stream *stream = NULL;
-
- if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path TSRMLS_CC)) {
- return NULL;
- }
-
- if (PG(safe_mode) &&(!php_checkuid(path, NULL, CHECKUID_ALLOW_ONLY_FILE))) {
- return NULL;
- }
-
- dir = VCWD_OPENDIR(path);
-
-#ifdef PHP_WIN32
- if (dir && dir->finished) {
- closedir(dir);
- dir = NULL;
- }
-#endif
- if (dir) {
- stream = php_stream_alloc(&php_plain_files_dirstream_ops, dir, 0, mode);
- if (stream == NULL)
- closedir(dir);
- }
-
- return stream;
-}
-/* }}} */
-
-
-static php_stream *php_plain_files_stream_opener(php_stream_wrapper *wrapper, char *path, char *mode,
- int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
-{
- if ((options & USE_PATH) && PG(include_path) != NULL) {
- return php_stream_fopen_with_path_rel(path, mode, PG(include_path), opened_path, options);
- }
-
- if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path TSRMLS_CC)) {
- return NULL;
- }
-
- if ((options & ENFORCE_SAFE_MODE) && PG(safe_mode) && (!php_checkuid(path, mode, CHECKUID_CHECK_MODE_PARAM)))
- return NULL;
-
- return php_stream_fopen_rel(path, mode, opened_path, options);
-}
-
-static int php_plain_files_url_stater(php_stream_wrapper *wrapper, char *url, php_stream_statbuf *ssb TSRMLS_DC)
-{
- return VCWD_STAT(url, &ssb->sb);
-}
-
-static int php_plain_files_unlink(php_stream_wrapper *wrapper, char *url, php_stream_context *context TSRMLS_DC)
-{
- char *p;
- int ret;
- zval funcname;
- zval *retval = NULL;
-
- if (p = strstr(url, "://")) {
- url = p + 3;
- }
-
- if (PG(safe_mode) && !php_checkuid(url, NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
- return 0;
- }
-
- if (php_check_open_basedir(url TSRMLS_CC)) {
- return 0;
- }
-
- ret = VCWD_UNLINK(url);
- if (ret == -1) {
- php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "%s", strerror(errno));
- return 0;
- }
- /* Clear stat cache */
- ZVAL_STRINGL(&funcname, "clearstatcache", sizeof("clearstatcache")-1, 0);
- call_user_function_ex(CG(function_table), NULL, &funcname, &retval, 0, NULL, 0, NULL TSRMLS_CC);
- if (retval) {
- zval_dtor(retval);
- }
- return 1;
-}
-
-static php_stream_wrapper_ops php_plain_files_wrapper_ops = {
- php_plain_files_stream_opener,
- NULL,
- NULL,
- php_plain_files_url_stater,
- php_plain_files_dir_opener,
- "plainfile",
- php_plain_files_unlink
-};
-
-php_stream_wrapper php_plain_files_wrapper = {
- &php_plain_files_wrapper_ops,
- NULL,
- 0
-};
-
-/* {{{ php_stream_fopen_with_path */
-PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char *path, char **opened_path, int options STREAMS_DC TSRMLS_DC)
-{
- /* code ripped off from fopen_wrappers.c */
- char *pathbuf, *ptr, *end;
- char *exec_fname;
- char trypath[MAXPATHLEN];
- struct stat sb;
- php_stream *stream;
- int path_length;
- int filename_length;
- int exec_fname_length;
-
- if (opened_path) {
- *opened_path = NULL;
- }
-
- if(!filename) {
- return NULL;
- }
-
- filename_length = strlen(filename);
-
- /* Relative path open */
- if (*filename == '.' && (IS_SLASH(filename[1]) || filename[1] == '.')) {
- /* further checks, we could have ....... filenames */
- ptr = filename + 1;
- if (*ptr == '.') {
- while (*(++ptr) == '.');
- if (!IS_SLASH(*ptr)) { /* not a relative path after all */
- goto not_relative_path;
- }
- }
-
-
- if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(filename TSRMLS_CC)) {
- return NULL;
- }
-
- if (PG(safe_mode) && (!php_checkuid(filename, mode, CHECKUID_CHECK_MODE_PARAM))) {
- return NULL;
- }
- return php_stream_fopen_rel(filename, mode, opened_path, options);
- }
-
- /*
- * files in safe_mode_include_dir (or subdir) are excluded from
- * safe mode GID/UID checks
- */
-
-not_relative_path:
-
- /* Absolute path open */
- if (IS_ABSOLUTE_PATH(filename, filename_length)) {
-
- if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(filename TSRMLS_CC)) {
- return NULL;
- }
-
- if ((php_check_safe_mode_include_dir(filename TSRMLS_CC)) == 0)
- /* filename is in safe_mode_include_dir (or subdir) */
- return php_stream_fopen_rel(filename, mode, opened_path, options);
-
- if (PG(safe_mode) && (!php_checkuid(filename, mode, CHECKUID_CHECK_MODE_PARAM)))
- return NULL;
-
- return php_stream_fopen_rel(filename, mode, opened_path, options);
- }
-
-#ifdef PHP_WIN32
- if (IS_SLASH(filename[0])) {
- int cwd_len;
- char *cwd;
- cwd = virtual_getcwd_ex(&cwd_len TSRMLS_CC);
- /* getcwd() will return always return [DRIVE_LETTER]:/) on windows. */
- *(cwd+3) = '\0';
-
- snprintf(trypath, MAXPATHLEN, "%s%s", cwd, filename);
-
- free(cwd);
-
- if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(trypath TSRMLS_CC)) {
- return NULL;
- }
- if ((php_check_safe_mode_include_dir(trypath TSRMLS_CC)) == 0) {
- return php_stream_fopen_rel(trypath, mode, opened_path, options);
- }
- if (PG(safe_mode) && (!php_checkuid(trypath, mode, CHECKUID_CHECK_MODE_PARAM))) {
- return NULL;
- }
-
- return php_stream_fopen_rel(trypath, mode, opened_path, options);
- }
-#endif
-
- if (!path || (path && !*path)) {
-
- if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path TSRMLS_CC)) {
- return NULL;
- }
-
- if (PG(safe_mode) && (!php_checkuid(filename, mode, CHECKUID_CHECK_MODE_PARAM))) {
- return NULL;
- }
- return php_stream_fopen_rel(filename, mode, opened_path, options);
- }
-
- /* check in provided path */
- /* append the calling scripts' current working directory
- * as a fall back case
- */
- if (zend_is_executing(TSRMLS_C)) {
- exec_fname = zend_get_executed_filename(TSRMLS_C);
- exec_fname_length = strlen(exec_fname);
- path_length = strlen(path);
-
- while ((--exec_fname_length >= 0) && !IS_SLASH(exec_fname[exec_fname_length]));
- if ((exec_fname && exec_fname[0] == '[')
- || exec_fname_length<=0) {
- /* [no active file] or no path */
- pathbuf = estrdup(path);
- } else {
- pathbuf = (char *) emalloc(exec_fname_length + path_length +1 +1);
- memcpy(pathbuf, path, path_length);
- pathbuf[path_length] = DEFAULT_DIR_SEPARATOR;
- memcpy(pathbuf+path_length+1, exec_fname, exec_fname_length);
- pathbuf[path_length + exec_fname_length +1] = '\0';
- }
- } else {
- pathbuf = estrdup(path);
- }
-
- ptr = pathbuf;
-
- while (ptr && *ptr) {
- end = strchr(ptr, DEFAULT_DIR_SEPARATOR);
- if (end != NULL) {
- *end = '\0';
- end++;
- }
- snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename);
-
- if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(trypath TSRMLS_CC)) {
- stream = NULL;
- goto stream_done;
- }
-
- if (PG(safe_mode)) {
- if (VCWD_STAT(trypath, &sb) == 0) {
- /* file exists ... check permission */
- if ((php_check_safe_mode_include_dir(trypath TSRMLS_CC) == 0) ||
- php_checkuid(trypath, mode, CHECKUID_CHECK_MODE_PARAM)) {
- /* UID ok, or trypath is in safe_mode_include_dir */
- stream = php_stream_fopen_rel(trypath, mode, opened_path, options);
- } else {
- stream = NULL;
- }
- goto stream_done;
- }
- }
- stream = php_stream_fopen_rel(trypath, mode, opened_path, options);
- if (stream) {
-stream_done:
- efree(pathbuf);
- return stream;
- }
- ptr = end;
- } /* end provided path */
-
- efree(pathbuf);
- return NULL;
-
-}
-/* }}} */
-
-
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/main/streams/streams.c b/main/streams/streams.c
deleted file mode 100755
index 286f8a6452..0000000000
--- a/main/streams/streams.c
+++ /dev/null
@@ -1,1671 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <wez@thebrainroom.com> |
- | Borrowed code from: |
- | Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#define _GNU_SOURCE
-#include "php.h"
-#include "php_globals.h"
-#include "php_network.h"
-#include "php_open_temporary_file.h"
-#include "ext/standard/file.h"
-#include "ext/standard/basic_functions.h" /* for BG(mmap_file) (not strictly required) */
-#include "ext/standard/php_string.h" /* for php_memnstr, used by php_stream_get_record() */
-#include <stddef.h>
-#include <fcntl.h>
-#include "php_streams_int.h"
-
-/* {{{ resource and registration code */
-static HashTable url_stream_wrappers_hash;
-static int le_stream = FAILURE; /* true global */
-static int le_pstream = FAILURE; /* true global */
-
-PHPAPI int php_file_le_stream(void)
-{
- return le_stream;
-}
-
-PHPAPI int php_file_le_pstream(void)
-{
- return le_pstream;
-}
-
-PHPAPI HashTable *php_stream_get_url_stream_wrappers_hash()
-{
- return &url_stream_wrappers_hash;
-}
-
-static int forget_persistent_resource_id_numbers(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- php_stream *stream;
-
- if (Z_TYPE_P(rsrc) != le_pstream) {
- return 0;
- }
-
- stream = (php_stream*)rsrc->ptr;
-
-#if STREAM_DEBUG
-fprintf(stderr, "forget_persistent: %s:%p\n", stream->ops->label, stream);
-#endif
-
- stream->rsrc_id = FAILURE;
-
- return 0;
-}
-
-PHP_RSHUTDOWN_FUNCTION(streams)
-{
- zend_hash_apply(&EG(persistent_list), (apply_func_t)forget_persistent_resource_id_numbers TSRMLS_CC);
- return SUCCESS;
-}
-
-PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream **stream TSRMLS_DC)
-{
- list_entry *le;
-
- if (zend_hash_find(&EG(persistent_list), (char*)persistent_id, strlen(persistent_id)+1, (void*) &le) == SUCCESS) {
- if (Z_TYPE_P(le) == le_pstream) {
- if (stream) {
- *stream = (php_stream*)le->ptr;
- if ((*stream)->rsrc_id == FAILURE) {
- /* first access this request; give it a valid id */
- (*stream)->rsrc_id = ZEND_REGISTER_RESOURCE(NULL, *stream, le_pstream);
- }
- }
- return PHP_STREAM_PERSISTENT_SUCCESS;
- }
- return PHP_STREAM_PERSISTENT_FAILURE;
- }
- return PHP_STREAM_PERSISTENT_NOT_EXIST;
-}
-
-/* }}} */
-
-/* {{{ wrapper error reporting */
-void php_stream_display_wrapper_errors(php_stream_wrapper *wrapper, const char *path, const char *caption TSRMLS_DC)
-{
- char *tmp = estrdup(path);
- char *msg;
- int free_msg = 0;
-
- if (wrapper) {
- if (wrapper->err_count > 0) {
- int i;
- size_t l;
- int brlen;
- char *br;
-
- if (PG(html_errors)) {
- brlen = 7;
- br = "<br />\n";
- } else {
- brlen = 1;
- br = "\n";
- }
-
- for (i = 0, l = 0; i < wrapper->err_count; i++) {
- l += strlen(wrapper->err_stack[i]);
- if (i < wrapper->err_count - 1) {
- l += brlen;
- }
- }
- msg = emalloc(l + 1);
- msg[0] = '\0';
- for (i = 0; i < wrapper->err_count; i++) {
- strcat(msg, wrapper->err_stack[i]);
- if (i < wrapper->err_count - 1) {
- strcat(msg, br);
- }
- }
-
- free_msg = 1;
- } else {
- msg = strerror(errno);
- }
- } else {
- msg = "no suitable wrapper could be found";
- }
-
- php_strip_url_passwd(tmp);
- php_error_docref1(NULL TSRMLS_CC, tmp, E_WARNING, "%s: %s", caption, msg);
- efree(tmp);
- if (free_msg) {
- efree(msg);
- }
-}
-
-void php_stream_tidy_wrapper_error_log(php_stream_wrapper *wrapper TSRMLS_DC)
-{
- if (wrapper) {
- /* tidy up the error stack */
- int i;
-
- for (i = 0; i < wrapper->err_count; i++) {
- efree(wrapper->err_stack[i]);
- }
- if (wrapper->err_stack) {
- efree(wrapper->err_stack);
- }
- wrapper->err_stack = NULL;
- wrapper->err_count = 0;
- }
-}
-
-PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int options TSRMLS_DC, const char *fmt, ...)
-{
- va_list args;
- char *buffer = NULL;
-
- va_start(args, fmt);
- vspprintf(&buffer, 0, fmt, args);
- va_end(args);
-
- if (options & REPORT_ERRORS || wrapper == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", buffer);
- efree(buffer);
- } else {
- /* append to stack */
- wrapper->err_stack = erealloc(wrapper->err_stack, (wrapper->err_count + 1) * sizeof(char *));
- if (wrapper->err_stack) {
- wrapper->err_stack[wrapper->err_count++] = buffer;
- }
- }
-}
-
-
-/* }}} */
-
-/* allocate a new stream for a particular ops */
-PHPAPI php_stream *_php_stream_alloc(php_stream_ops *ops, void *abstract, const char *persistent_id, const char *mode STREAMS_DC TSRMLS_DC) /* {{{ */
-{
- php_stream *ret;
-
- ret = (php_stream*) pemalloc_rel_orig(sizeof(php_stream), persistent_id ? 1 : 0);
-
- memset(ret, 0, sizeof(php_stream));
-
-#if STREAM_DEBUG
-fprintf(stderr, "stream_alloc: %s:%p persistent=%s\n", ops->label, ret, persistent_id);
-#endif
-
- ret->ops = ops;
- ret->abstract = abstract;
- ret->is_persistent = persistent_id ? 1 : 0;
- ret->chunk_size = FG(def_chunk_size);
-
- if (FG(auto_detect_line_endings)) {
- ret->flags |= PHP_STREAM_FLAG_DETECT_EOL;
- }
-
- if (persistent_id) {
- list_entry le;
-
- Z_TYPE(le) = le_pstream;
- le.ptr = ret;
-
- if (FAILURE == zend_hash_update(&EG(persistent_list), (char *)persistent_id,
- strlen(persistent_id) + 1,
- (void *)&le, sizeof(list_entry), NULL)) {
-
- pefree(ret, 1);
- return NULL;
- }
- }
-
- ret->rsrc_id = ZEND_REGISTER_RESOURCE(NULL, ret, persistent_id ? le_pstream : le_stream);
- strlcpy(ret->mode, mode, sizeof(ret->mode));
-
- return ret;
-}
-/* }}} */
-
-static int _php_stream_free_persistent(list_entry *le, void *pStream TSRMLS_DC)
-{
- return le->ptr == pStream;
-}
-
-PHPAPI int _php_stream_free(php_stream *stream, int close_options TSRMLS_DC) /* {{{ */
-{
- int ret = 1;
- int remove_rsrc = 1;
- int preserve_handle = close_options & PHP_STREAM_FREE_PRESERVE_HANDLE ? 1 : 0;
- int release_cast = 1;
-
-#if STREAM_DEBUG
-fprintf(stderr, "stream_free: %s:%p[%s] in_free=%d opts=%08x\n", stream->ops->label, stream, stream->__orig_path, stream->in_free, close_options);
-#endif
-
- /* recursion protection */
- if (stream->in_free) {
- return 1;
- }
-
- stream->in_free++;
-
- /* if we are releasing the stream only (and preserving the underlying handle),
- * we need to do things a little differently.
- * We are only ever called like this when the stream is cast to a FILE*
- * for include (or other similar) purposes.
- * */
- if (preserve_handle) {
- if (stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FOPENCOOKIE) {
- /* If the stream was fopencookied, we must NOT touch anything
- * here, as the cookied stream relies on it all.
- * Instead, mark the stream as OK to auto-clean */
- php_stream_auto_cleanup(stream);
- stream->in_free--;
- return 0;
- }
- /* otherwise, make sure that we don't close the FILE* from a cast */
- release_cast = 0;
- }
-
-#if STREAM_DEBUG
-fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remove_rsrc=%d\n",
- stream->ops->label, stream, stream->__orig_path, preserve_handle, release_cast, remove_rsrc);
-#endif
-
- /* make sure everything is saved */
- _php_stream_flush(stream, 1 TSRMLS_CC);
-
- /* If not called from the resource dtor, remove the stream from the resource list. */
- if ((close_options & PHP_STREAM_FREE_RSRC_DTOR) == 0 && remove_rsrc) {
- zend_list_delete(stream->rsrc_id);
- }
-
- if (close_options & PHP_STREAM_FREE_CALL_DTOR) {
- if (release_cast && stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FOPENCOOKIE) {
- /* calling fclose on an fopencookied stream will ultimately
- call this very same function. If we were called via fclose,
- the cookie_closer unsets the fclose_stdiocast flags, so
- we can be sure that we only reach here when PHP code calls
- php_stream_free.
- Lets let the cookie code clean it all up.
- */
- stream->in_free = 0;
- return fclose(stream->stdiocast);
- }
-
- ret = stream->ops->close(stream, preserve_handle ? 0 : 1 TSRMLS_CC);
- stream->abstract = NULL;
-
- /* tidy up any FILE* that might have been fdopened */
- if (release_cast && stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FDOPEN && stream->stdiocast) {
- fclose(stream->stdiocast);
- stream->stdiocast = NULL;
- stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE;
- }
- }
-
- if (close_options & PHP_STREAM_FREE_RELEASE_STREAM) {
- int was_persistent = stream->is_persistent;
-
- while (stream->readfilters.head) {
- php_stream_filter_remove(stream->readfilters.head, 1 TSRMLS_CC);
- }
- while (stream->writefilters.head) {
- php_stream_filter_remove(stream->writefilters.head, 1 TSRMLS_CC);
- }
-
- if (stream->wrapper && stream->wrapper->wops && stream->wrapper->wops->stream_closer) {
- stream->wrapper->wops->stream_closer(stream->wrapper, stream TSRMLS_CC);
- stream->wrapper = NULL;
- }
-
- if (stream->wrapperdata) {
- zval_ptr_dtor(&stream->wrapperdata);
- stream->wrapperdata = NULL;
- }
-
- if (stream->readbuf) {
- pefree(stream->readbuf, stream->is_persistent);
- stream->readbuf = NULL;
- }
-
-#if ZEND_DEBUG
- if ((close_options & PHP_STREAM_FREE_RSRC_DTOR) && (stream->__exposed == 0) && (EG(error_reporting) & E_WARNING)) {
- /* it leaked: Lets deliberately NOT pefree it so that the memory manager shows it
- * as leaked; it will log a warning, but lets help it out and display what kind
- * of stream it was. */
- char leakbuf[512];
- snprintf(leakbuf, sizeof(leakbuf), __FILE__ "(%d) : Stream of type '%s' 0x%08X (path:%s) was not closed\n", __LINE__, stream->ops->label, (unsigned int)stream, stream->__orig_path);
-
- if (stream->__orig_path) {
- pefree(stream->__orig_path, stream->is_persistent);
- stream->__orig_path = NULL;
- }
-
-# if defined(PHP_WIN32)
- OutputDebugString(leakbuf);
-# else
- fprintf(stderr, "%s", leakbuf);
-# endif
- } else {
- if (stream->__orig_path) {
- pefree(stream->__orig_path, stream->is_persistent);
- stream->__orig_path = NULL;
- }
-
- pefree(stream, stream->is_persistent);
- }
-#else
- pefree(stream, stream->is_persistent);
-#endif
- if (was_persistent) {
- /* we don't work with *stream but need its value for comparison */
- zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) _php_stream_free_persistent, stream TSRMLS_CC);
- }
- }
-
- return ret;
-}
-/* }}} */
-
-/* {{{ generic stream operations */
-
-static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_DC)
-{
- /* allocate/fill the buffer */
-
- if (stream->readfilters.head) {
- char *chunk_buf;
- int err_flag = 0;
- php_stream_bucket_brigade brig_in = { NULL, NULL }, brig_out = { NULL, NULL };
- php_stream_bucket_brigade *brig_inp = &brig_in, *brig_outp = &brig_out, *brig_swap;
-
- /* allocate a buffer for reading chunks */
- chunk_buf = emalloc(stream->chunk_size);
-
- while (!err_flag && (stream->writepos - stream->readpos < (off_t)size)) {
- size_t justread = 0;
- int flags;
- php_stream_bucket *bucket;
- php_stream_filter_status_t status;
- php_stream_filter *filter;
-
- /* read a chunk into a bucket */
- justread = stream->ops->read(stream, chunk_buf, stream->chunk_size TSRMLS_CC);
- if (justread > 0) {
- bucket = php_stream_bucket_new(stream, chunk_buf, justread, 0, 0 TSRMLS_CC);
-
- /* after this call, bucket is owned by the brigade */
- php_stream_bucket_append(brig_inp, bucket TSRMLS_CC);
-
- flags = PSFS_FLAG_NORMAL;
- } else {
- flags = stream->eof ? PSFS_FLAG_FLUSH_CLOSE : PSFS_FLAG_FLUSH_INC;
- }
-
- /* wind the handle... */
- for (filter = stream->readfilters.head; filter; filter = filter->next) {
- status = filter->fops->filter(stream, filter, brig_inp, brig_outp, NULL, flags TSRMLS_CC);
-
- if (status != PSFS_PASS_ON) {
- break;
- }
-
- /* brig_out becomes brig_in.
- * brig_in will always be empty here, as the filter MUST attach any un-consumed buckets
- * to its own brigade */
- brig_swap = brig_inp;
- brig_inp = brig_outp;
- brig_outp = brig_swap;
- memset(brig_outp, 0, sizeof(*brig_outp));
- }
-
- switch (status) {
- case PSFS_PASS_ON:
- /* we get here when the last filter in the chain has data to pass on.
- * in this situation, we are passing the brig_in brigade into the
- * stream read buffer */
- while (brig_inp->head) {
- bucket = brig_inp->head;
- /* grow buffer to hold this bucket
- * TODO: this can fail for persistent streams */
- if (stream->readbuflen - stream->writepos < bucket->buflen) {
- stream->readbuflen += bucket->buflen;
- stream->readbuf = perealloc(stream->readbuf, stream->readbuflen,
- stream->is_persistent);
- }
- memcpy(stream->readbuf + stream->writepos, bucket->buf, bucket->buflen);
- stream->writepos += bucket->buflen;
-
- php_stream_bucket_unlink(bucket TSRMLS_CC);
- php_stream_bucket_delref(bucket TSRMLS_CC);
- }
-
- break;
-
- case PSFS_FEED_ME:
- /* when a filter needs feeding, there is no brig_out to deal with.
- * we simply continue the loop; if the caller needs more data,
- * we will read again, otherwise out job is done here */
- if (justread == 0) {
- /* there is no data */
- err_flag = 1;
- break;
- }
- continue;
-
- case PSFS_ERR_FATAL:
- /* some fatal error. Theoretically, the stream is borked, so all
- * further reads should fail. */
- err_flag = 1;
- break;
- }
-
- if (justread == 0) {
- break;
- }
- }
-
- efree(chunk_buf);
-
- } else {
- /* is there enough data in the buffer ? */
- if (stream->writepos - stream->readpos < (off_t)size) {
- size_t justread = 0;
-
- /* reduce buffer memory consumption if possible, to avoid a realloc */
- if (stream->readbuf && stream->readbuflen - stream->writepos < stream->chunk_size) {
- memmove(stream->readbuf, stream->readbuf + stream->readpos, stream->readbuflen - stream->readpos);
- stream->writepos -= stream->readpos;
- stream->readpos = 0;
- }
-
- /* grow the buffer if required
- * TODO: this can fail for persistent streams */
- if (stream->readbuflen - stream->writepos < stream->chunk_size) {
- stream->readbuflen += stream->chunk_size;
- stream->readbuf = perealloc(stream->readbuf, stream->readbuflen,
- stream->is_persistent);
- }
-
- justread = stream->ops->read(stream, stream->readbuf + stream->writepos,
- stream->readbuflen - stream->writepos
- TSRMLS_CC);
-
- if (justread != (size_t)-1) {
- stream->writepos += justread;
- }
- }
- }
-}
-
-PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t size TSRMLS_DC)
-{
- size_t toread = 0, didread = 0;
-
- while (size > 0) {
-
- /* take from the read buffer first.
- * It is possible that a buffered stream was switched to non-buffered, so we
- * drain the remainder of the buffer before using the "raw" read mode for
- * the excess */
- if (stream->writepos > stream->readpos) {
-
- toread = stream->writepos - stream->readpos;
- if (toread > size) {
- toread = size;
- }
-
- memcpy(buf, stream->readbuf + stream->readpos, toread);
- stream->readpos += toread;
- size -= toread;
- buf += toread;
- didread += toread;
- }
-
- /* ignore eof here; the underlying state might have changed */
- if (size == 0) {
- break;
- }
-
- if (!stream->readfilters.head && (stream->flags & PHP_STREAM_FLAG_NO_BUFFER || stream->chunk_size == 1)) {
- toread = stream->ops->read(stream, buf, size TSRMLS_CC);
- } else {
- php_stream_fill_read_buffer(stream, size TSRMLS_CC);
-
- toread = stream->writepos - stream->readpos;
- if (toread > size) {
- toread = size;
- }
-
- if (toread > 0) {
- memcpy(buf, stream->readbuf + stream->readpos, toread);
- stream->readpos += toread;
- }
- }
- if (toread > 0) {
- didread += toread;
- buf += toread;
- size -= toread;
- } else {
- /* EOF, or temporary end of data (for non-blocking mode). */
- break;
- }
- }
-
- if (didread > 0) {
- stream->position += didread;
- }
-
- return didread;
-}
-
-PHPAPI int _php_stream_eof(php_stream *stream TSRMLS_DC)
-{
- /* if there is data in the buffer, it's not EOF */
- if (stream->writepos - stream->readpos > 0) {
- return 0;
- }
-
- return stream->eof;
-}
-
-PHPAPI int _php_stream_putc(php_stream *stream, int c TSRMLS_DC)
-{
- unsigned char buf = c;
-
- if (php_stream_write(stream, &buf, 1) > 0) {
- return 1;
- }
- return EOF;
-}
-
-PHPAPI int _php_stream_getc(php_stream *stream TSRMLS_DC)
-{
- char buf;
-
- if (php_stream_read(stream, &buf, 1) > 0) {
- return buf & 0xff;
- }
- return EOF;
-}
-
-PHPAPI int _php_stream_puts(php_stream *stream, char *buf TSRMLS_DC)
-{
- int len;
- char newline[2] = "\n"; /* is this OK for Win? */
- len = strlen(buf);
-
- if (len > 0 && php_stream_write(stream, buf, len) && php_stream_write(stream, newline, 1)) {
- return 1;
- }
- return 0;
-}
-
-PHPAPI int _php_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC)
-{
- memset(ssb, 0, sizeof(*ssb));
-
- /* if the stream was wrapped, allow the wrapper to stat it */
- if (stream->wrapper && stream->wrapper->wops->stream_stat != NULL) {
- return stream->wrapper->wops->stream_stat(stream->wrapper, stream, ssb TSRMLS_CC);
- }
-
- /* if the stream doesn't directly support stat-ing, return with failure.
- * We could try and emulate this by casting to a FD and fstat-ing it,
- * but since the fd might not represent the actual underlying content
- * this would give bogus results. */
- if (stream->ops->stat == NULL) {
- return -1;
- }
-
- return (stream->ops->stat)(stream, ssb TSRMLS_CC);
-}
-
-PHPAPI char *php_stream_locate_eol(php_stream *stream, char *buf, size_t buf_len TSRMLS_DC)
-{
- size_t avail;
- char *cr, *lf, *eol = NULL;
- char *readptr;
-
- if (!buf) {
- readptr = stream->readbuf + stream->readpos;
- avail = stream->writepos - stream->readpos;
- } else {
- readptr = buf;
- avail = buf_len;
- }
-
- /* Look for EOL */
- if (stream->flags & PHP_STREAM_FLAG_DETECT_EOL) {
- cr = memchr(readptr, '\r', avail);
- lf = memchr(readptr, '\n', avail);
-
- if (cr && lf != cr + 1 && !(lf && lf < cr)) {
- /* mac */
- stream->flags ^= PHP_STREAM_FLAG_DETECT_EOL;
- stream->flags |= PHP_STREAM_FLAG_EOL_MAC;
- eol = cr;
- } else if ((cr && lf && cr == lf - 1) || (lf)) {
- /* dos or unix endings */
- stream->flags ^= PHP_STREAM_FLAG_DETECT_EOL;
- eol = lf;
- }
- } else if (stream->flags & PHP_STREAM_FLAG_EOL_MAC) {
- eol = memchr(readptr, '\r', avail);
- } else {
- /* unix (and dos) line endings */
- eol = memchr(readptr, '\n', avail);
- }
-
- return eol;
-}
-
-/* If buf == NULL, the buffer will be allocated automatically and will be of an
- * appropriate length to hold the line, regardless of the line length, memory
- * permitting */
-PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen,
- size_t *returned_len TSRMLS_DC)
-{
- size_t avail = 0;
- size_t current_buf_size = 0;
- size_t total_copied = 0;
- int grow_mode = 0;
- char *bufstart = buf;
-
- if (buf == NULL) {
- grow_mode = 1;
- } else if (maxlen == 0) {
- return NULL;
- }
-
- /*
- * If the underlying stream operations block when no new data is readable,
- * we need to take extra precautions.
- *
- * If there is buffered data available, we check for a EOL. If it exists,
- * we pass the data immediately back to the caller. This saves a call
- * to the read implementation and will not block where blocking
- * is not necessary at all.
- *
- * If the stream buffer contains more data than the caller requested,
- * we can also avoid that costly step and simply return that data.
- */
-
- for (;;) {
- avail = stream->writepos - stream->readpos;
-
- if (avail > 0) {
- size_t cpysz = 0;
- char *readptr;
- char *eol;
- int done = 0;
-
- readptr = stream->readbuf + stream->readpos;
- eol = php_stream_locate_eol(stream, NULL, 0 TSRMLS_CC);
-
- if (eol) {
- cpysz = eol - readptr + 1;
- done = 1;
- } else {
- cpysz = avail;
- }
-
- if (grow_mode) {
- /* allow room for a NUL. If this realloc is really a realloc
- * (ie: second time around), we get an extra byte. In most
- * cases, with the default chunk size of 8K, we will only
- * incur that overhead once. When people have lines longer
- * than 8K, we waste 1 byte per additional 8K or so.
- * That seems acceptable to me, to avoid making this code
- * hard to follow */
- bufstart = erealloc(bufstart, current_buf_size + cpysz + 1);
- current_buf_size += cpysz + 1;
- buf = bufstart + total_copied;
- } else {
- if (cpysz >= maxlen - 1) {
- cpysz = maxlen - 1;
- done = 1;
- }
- }
-
- memcpy(buf, readptr, cpysz);
-
- stream->position += cpysz;
- stream->readpos += cpysz;
- buf += cpysz;
- maxlen -= cpysz;
- total_copied += cpysz;
-
- if (done) {
- break;
- }
- } else if (stream->eof) {
- break;
- } else {
- /* XXX: Should be fine to always read chunk_size */
- size_t toread;
-
- if (grow_mode) {
- toread = stream->chunk_size;
- } else {
- toread = maxlen - 1;
- if (toread > stream->chunk_size) {
- toread = stream->chunk_size;
- }
- }
-
- php_stream_fill_read_buffer(stream, toread TSRMLS_CC);
-
- if (stream->writepos - stream->readpos == 0) {
- break;
- }
- }
- }
-
- if (total_copied == 0) {
- if (grow_mode) {
- assert(bufstart == NULL);
- }
- return NULL;
- }
-
- buf[0] = '\0';
- if (returned_len) {
- *returned_len = total_copied;
- }
-
- return bufstart;
-}
-
-PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *returned_len, char *delim, size_t delim_len TSRMLS_DC)
-{
- char *e, *buf;
- size_t toread;
-
- php_stream_fill_read_buffer(stream, maxlen TSRMLS_CC);
-
- if (delim_len == 0) {
- toread = maxlen;
- } else {
- if (delim_len == 1) {
- e = memchr(stream->readbuf, *delim, stream->readbuflen);
- } else {
- e = php_memnstr(stream->readbuf, delim, delim_len, (stream->readbuf + stream->readbuflen));
- }
-
- if (!e) {
- toread = maxlen;
- } else {
- toread = e - (char *) stream->readbuf;
- }
- }
-
- if (toread > maxlen && maxlen > 0) {
- toread = maxlen;
- }
-
- buf = emalloc(toread + 1);
- *returned_len = php_stream_read(stream, buf, toread);
-
- if (*returned_len >= 0) {
- return buf;
- } else {
- efree(buf);
- return NULL;
- }
-}
-
-/* Writes a buffer directly to a stream, using multiple of the chunk size */
-static size_t _php_stream_write_buffer(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
-{
- size_t didwrite = 0, towrite, justwrote;
-
- /* if we have a seekable stream we need to ensure that data is written at the
- * current stream->position. This means invalidating the read buffer and then
- * performing a low-level seek */
- if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) {
- stream->readpos = stream->writepos = 0;
-
- stream->ops->seek(stream, stream->position, SEEK_SET, &stream->position TSRMLS_CC);
- }
-
-
- while (count > 0) {
- towrite = count;
- if (towrite > stream->chunk_size)
- towrite = stream->chunk_size;
-
- justwrote = stream->ops->write(stream, buf, towrite TSRMLS_CC);
-
- if (justwrote > 0) {
- buf += justwrote;
- count -= justwrote;
- didwrite += justwrote;
-
- /* Only screw with the buffer if we can seek, otherwise we lose data
- * buffered from fifos and sockets */
- if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) {
- stream->position += justwrote;
- }
- } else {
- break;
- }
- }
- return didwrite;
-
-}
-
-/* push some data through the write filter chain.
- * buf may be NULL, if flags are set to indicate a flush.
- * This may trigger a real write to the stream.
- * Returns the number of bytes consumed from buf by the first filter in the chain.
- * */
-static size_t _php_stream_write_filtered(php_stream *stream, const char *buf, size_t count, int flags TSRMLS_DC)
-{
- size_t consumed = 0;
- php_stream_bucket *bucket;
- php_stream_bucket_brigade brig_in = { NULL, NULL }, brig_out = { NULL, NULL };
- php_stream_bucket_brigade *brig_inp = &brig_in, *brig_outp = &brig_out, *brig_swap;
- php_stream_filter_status_t status;
- php_stream_filter *filter;
-
- if (buf) {
- bucket = php_stream_bucket_new(stream, (char *)buf, count, 0, 0 TSRMLS_CC);
- php_stream_bucket_append(&brig_in, bucket TSRMLS_CC);
- }
-
- for (filter = stream->writefilters.head; filter; filter = filter->next) {
- /* for our return value, we are interested in the number of bytes consumed from
- * the first filter in the chain */
- status = filter->fops->filter(stream, filter, brig_inp, brig_outp,
- filter == stream->writefilters.head ? &consumed : NULL, flags TSRMLS_CC);
-
- if (status != PSFS_PASS_ON) {
- break;
- }
- /* brig_out becomes brig_in.
- * brig_in will always be empty here, as the filter MUST attach any un-consumed buckets
- * to its own brigade */
- brig_swap = brig_inp;
- brig_inp = brig_outp;
- brig_outp = brig_swap;
- memset(brig_outp, 0, sizeof(*brig_outp));
- }
-
- switch (status) {
- case PSFS_PASS_ON:
- /* filter chain generated some output; push it through to the
- * underlying stream */
- while (brig_inp->head) {
- bucket = brig_inp->head;
- _php_stream_write_buffer(stream, bucket->buf, bucket->buflen TSRMLS_CC);
- /* Potential error situation - eg: no space on device. Perhaps we should keep this brigade
- * hanging around and try to write it later.
- * At the moment, we just drop it on the floor
- * */
-
- php_stream_bucket_unlink(bucket TSRMLS_CC);
- php_stream_bucket_delref(bucket TSRMLS_CC);
- }
- break;
- case PSFS_FEED_ME:
- /* need more data before we can push data through to the stream */
- break;
-
- case PSFS_ERR_FATAL:
- /* some fatal error. Theoretically, the stream is borked, so all
- * further writes should fail. */
- break;
- }
-
- return consumed;
-}
-
-PHPAPI int _php_stream_flush(php_stream *stream, int closing TSRMLS_DC)
-{
- int ret = 0;
-
- if (stream->writefilters.head) {
- _php_stream_write_filtered(stream, NULL, 0, closing ? PSFS_FLAG_FLUSH_CLOSE : PSFS_FLAG_FLUSH_INC TSRMLS_CC);
- }
-
- if (stream->ops->flush) {
- ret = stream->ops->flush(stream TSRMLS_CC);
- }
-
- return ret;
-}
-
-PHPAPI size_t _php_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
-{
- if (buf == NULL || count == 0 || stream->ops->write == NULL) {
- return 0;
- }
-
- if (stream->writefilters.head) {
- return _php_stream_write_filtered(stream, buf, count, PSFS_FLAG_NORMAL TSRMLS_CC);
- } else {
- return _php_stream_write_buffer(stream, buf, count TSRMLS_CC);
- }
-}
-
-PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char *fmt, ...)
-{
- size_t count;
- char *buf;
- va_list ap;
-
- va_start(ap, fmt);
- count = vspprintf(&buf, 0, fmt, ap);
- va_end(ap);
-
- if (!buf) {
- return 0; /* error condition */
- }
-
- count = php_stream_write(stream, buf, count);
- efree(buf);
-
- return count;
-}
-
-PHPAPI off_t _php_stream_tell(php_stream *stream TSRMLS_DC)
-{
- return stream->position;
-}
-
-PHPAPI int _php_stream_seek(php_stream *stream, off_t offset, int whence TSRMLS_DC)
-{
- /* handle the case where we are in the buffer */
- if ((stream->flags & PHP_STREAM_FLAG_NO_BUFFER) == 0) {
- switch(whence) {
- case SEEK_CUR:
- if (offset > 0 && offset < stream->writepos - stream->readpos) {
- stream->readpos += offset;
- stream->position += offset;
- stream->eof = 0;
- return 0;
- }
- break;
- case SEEK_SET:
- if (offset > stream->position &&
- offset < stream->position + stream->writepos - stream->readpos) {
- stream->readpos += offset - stream->position;
- stream->position = offset;
- stream->eof = 0;
- return 0;
- }
- break;
- }
- }
-
-
- if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) {
- int ret;
-
- if (stream->writefilters.head) {
- _php_stream_flush(stream, 0 TSRMLS_CC);
- }
-
- switch(whence) {
- case SEEK_CUR:
- offset = stream->position + offset;
- whence = SEEK_SET;
- break;
- }
- ret = stream->ops->seek(stream, offset, whence, &stream->position TSRMLS_CC);
-
- if (((stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) || ret == 0) {
- if (ret == 0) {
- stream->eof = 0;
- }
-
- /* invalidate the buffer contents */
- stream->readpos = stream->writepos = 0;
-
- return ret;
- }
- /* else the stream has decided that it can't support seeking after all;
- * fall through to attempt emulation */
- }
-
- /* emulate forward moving seeks with reads */
- if (whence == SEEK_CUR && offset > 0) {
- char tmp[1024];
- while(offset >= sizeof(tmp)) {
- if (php_stream_read(stream, tmp, sizeof(tmp)) == 0) {
- return -1;
- }
- offset -= sizeof(tmp);
- }
- if (offset && (php_stream_read(stream, tmp, offset) == 0)) {
- return -1;
- }
- stream->eof = 0;
- return 0;
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream does not support seeking");
-
- return -1;
-}
-
-PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC)
-{
- int ret = PHP_STREAM_OPTION_RETURN_NOTIMPL;
-
- if (stream->ops->set_option) {
- ret = stream->ops->set_option(stream, option, value, ptrparam TSRMLS_CC);
- }
-
- if (ret == PHP_STREAM_OPTION_RETURN_NOTIMPL) {
- switch(option) {
- case PHP_STREAM_OPTION_SET_CHUNK_SIZE:
- ret = stream->chunk_size;
- stream->chunk_size = value;
- return ret;
-
- case PHP_STREAM_OPTION_READ_BUFFER:
- /* try to match the buffer mode as best we can */
- if (value == PHP_STREAM_BUFFER_NONE) {
- stream->flags |= PHP_STREAM_FLAG_NO_BUFFER;
- } else {
- stream->flags ^= PHP_STREAM_FLAG_NO_BUFFER;
- }
- ret = PHP_STREAM_OPTION_RETURN_OK;
- break;
-
- default:
- ret = PHP_STREAM_OPTION_RETURN_ERR;
- }
- }
-
- return ret;
-}
-
-PHPAPI int _php_stream_truncate_set_size(php_stream *stream, size_t newsize TSRMLS_DC)
-{
- return php_stream_set_option(stream, PHP_STREAM_OPTION_TRUNCATE_API, PHP_STREAM_TRUNCATE_SET_SIZE, &newsize);
-}
-
-PHPAPI size_t _php_stream_passthru(php_stream * stream STREAMS_DC TSRMLS_DC)
-{
- size_t bcount = 0;
- char buf[8192];
- int b;
-
- if (php_stream_mmap_possible(stream)) {
- char *p;
- size_t mapped;
-
- p = php_stream_mmap_range(stream, php_stream_tell(stream), 0, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped);
-
- if (p) {
- PHPWRITE(p, mapped);
-
- php_stream_mmap_unmap(stream);
-
- return mapped;
- }
- }
-
- while ((b = php_stream_read(stream, buf, sizeof(buf))) > 0) {
- PHPWRITE(buf, b);
- bcount += b;
- }
-
- return bcount;
-}
-
-
-PHPAPI size_t _php_stream_copy_to_mem(php_stream *src, char **buf, size_t maxlen, int persistent STREAMS_DC TSRMLS_DC)
-{
- size_t ret = 0;
- char *ptr;
- size_t len = 0, max_len;
- int step = CHUNK_SIZE;
- int min_room = CHUNK_SIZE / 4;
- php_stream_statbuf ssbuf;
-
- if (buf) {
- *buf = NULL;
- }
-
- if (maxlen == 0) {
- return 0;
- }
-
- if (maxlen == PHP_STREAM_COPY_ALL) {
- maxlen = 0;
- }
-
- if (php_stream_mmap_possible(src)) {
- char *p;
- size_t mapped;
-
- p = php_stream_mmap_range(src, php_stream_tell(src), maxlen, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped);
-
- if (p) {
- *buf = pemalloc_rel_orig(mapped + 1, persistent);
-
- if (*buf) {
- memcpy(*buf, p, mapped);
- (*buf)[mapped] = '\0';
- }
-
- php_stream_mmap_unmap(src);
-
- return mapped;
- }
- }
-
- /* avoid many reallocs by allocating a good sized chunk to begin with, if
- * we can. Note that the stream may be filtered, in which case the stat
- * result may be inaccurate, as the filter may inflate or deflate the
- * number of bytes that we can read. In order to avoid an upsize followed
- * by a downsize of the buffer, overestimate by the step size (which is
- * 2K). */
- if (php_stream_stat(src, &ssbuf) == 0 && ssbuf.sb.st_size > 0) {
- max_len = ssbuf.sb.st_size + step;
- } else {
- max_len = step;
- }
-
- ptr = *buf = pemalloc_rel_orig(max_len, persistent);
-
- while((ret = php_stream_read(src, ptr, max_len - len))) {
- len += ret;
- if (len + min_room >= max_len) {
- *buf = perealloc_rel_orig(*buf, max_len + step, persistent);
- max_len += step;
- ptr = *buf + len;
- }
- }
- if (len) {
- *buf = perealloc_rel_orig(*buf, len + 1, persistent);
- (*buf)[len] = '\0';
- } else {
- pefree(*buf, persistent);
- *buf = NULL;
- }
- return len;
-}
-
-PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen STREAMS_DC TSRMLS_DC)
-{
- char buf[CHUNK_SIZE];
- size_t readchunk;
- size_t haveread = 0;
- size_t didread;
- php_stream_statbuf ssbuf;
-
- if (maxlen == 0) {
- return 0;
- }
-
- if (maxlen == PHP_STREAM_COPY_ALL) {
- maxlen = 0;
- }
-
- if (php_stream_stat(src, &ssbuf) == 0) {
- /* in the event that the source file is 0 bytes, return 1 to indicate success
- * because opening the file to write had already created a copy */
- if (ssbuf.sb.st_size == 0
-#ifdef S_ISFIFO
- && !S_ISFIFO(ssbuf.sb.st_mode)
-#endif
- ) {
- return 1;
- }
- }
-
- if (php_stream_mmap_possible(src)) {
- char *p;
- size_t mapped;
-
- p = php_stream_mmap_range(src, php_stream_tell(src), maxlen, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped);
-
- if (p) {
- haveread = php_stream_write(dest, p, mapped);
-
- php_stream_mmap_unmap(src);
-
- return mapped;
- }
- }
-
- while(1) {
- readchunk = sizeof(buf);
-
- if (maxlen && (maxlen - haveread) < readchunk)
- readchunk = maxlen - haveread;
-
- didread = php_stream_read(src, buf, readchunk);
-
- if (didread) {
- /* extra paranoid */
- size_t didwrite, towrite;
- char *writeptr;
-
- towrite = didread;
- writeptr = buf;
- haveread += didread;
-
- while(towrite) {
- didwrite = php_stream_write(dest, writeptr, towrite);
- if (didwrite == 0) {
- return 0; /* error */
- }
-
- towrite -= didwrite;
- writeptr += didwrite;
- }
- } else {
- if (maxlen == 0) {
- return haveread;
- } else {
- return 0; /* error */
- }
- }
-
- if (maxlen - haveread == 0) {
- break;
- }
- }
- return haveread;
-
-}
-/* }}} */
-
-/* {{{ wrapper init and registration */
-
-static void stream_resource_regular_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- php_stream *stream = (php_stream*)rsrc->ptr;
- /* set the return value for pclose */
- FG(pclose_ret) = php_stream_free(stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR);
-}
-
-static void stream_resource_persistent_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- php_stream *stream = (php_stream*)rsrc->ptr;
- FG(pclose_ret) = php_stream_free(stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR);
-}
-
-int php_init_stream_wrappers(int module_number TSRMLS_DC)
-{
- le_stream = zend_register_list_destructors_ex(stream_resource_regular_dtor, NULL, "stream", module_number);
- le_pstream = zend_register_list_destructors_ex(NULL, stream_resource_persistent_dtor, "persistent stream", module_number);
-
- return (
- zend_hash_init(&url_stream_wrappers_hash, 0, NULL, NULL, 1) == SUCCESS
- &&
- zend_hash_init(php_get_stream_filters_hash(), 0, NULL, NULL, 1) == SUCCESS
- &&
- zend_hash_init(php_stream_xport_get_hash(), 0, NULL, NULL, 1) == SUCCESS
- &&
- php_stream_xport_register("tcp", php_stream_generic_socket_factory TSRMLS_CC) == SUCCESS
- &&
- php_stream_xport_register("udp", php_stream_generic_socket_factory TSRMLS_CC) == SUCCESS
-#ifdef AF_UNIX
- &&
- php_stream_xport_register("unix", php_stream_generic_socket_factory TSRMLS_CC) == SUCCESS
- &&
- php_stream_xport_register("udg", php_stream_generic_socket_factory TSRMLS_CC) == SUCCESS
-#endif
- ) ? SUCCESS : FAILURE;
-}
-
-int php_shutdown_stream_wrappers(int module_number TSRMLS_DC)
-{
- zend_hash_destroy(&url_stream_wrappers_hash);
- zend_hash_destroy(php_get_stream_filters_hash());
- zend_hash_destroy(php_stream_xport_get_hash());
- return SUCCESS;
-}
-
-PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC)
-{
- return zend_hash_add(&url_stream_wrappers_hash, protocol, strlen(protocol), wrapper, sizeof(*wrapper), NULL);
-}
-
-PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC)
-{
- return zend_hash_del(&url_stream_wrappers_hash, protocol, strlen(protocol));
-}
-/* }}} */
-
-/* {{{ php_stream_locate_url_wrapper */
-PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char **path_for_open, int options TSRMLS_DC)
-{
- php_stream_wrapper *wrapper = NULL;
- const char *p, *protocol = NULL;
- int n = 0;
-
- if (path_for_open) {
- *path_for_open = (char*)path;
- }
-
- if (options & IGNORE_URL) {
- return (options & STREAM_LOCATE_WRAPPERS_ONLY) ? NULL : &php_plain_files_wrapper;
- }
-
- for (p = path; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++) {
- n++;
- }
-
- if ((*p == ':') && (n > 1) && !strncmp("://", p, 3)) {
- protocol = path;
- } else if (strncasecmp(path, "zlib:", 5) == 0) {
- /* BC with older php scripts and zlib wrapper */
- protocol = "compress.zlib";
- n = 13;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Use of \"zlib:\" wrapper is deprecated; please use \"compress.zlib://\" instead.");
- }
-
- if (protocol) {
- if (FAILURE == zend_hash_find(&url_stream_wrappers_hash, (char*)protocol, n, (void**)&wrapper)) {
- char wrapper_name[32];
-
- if (n >= sizeof(wrapper_name))
- n = sizeof(wrapper_name) - 1;
- PHP_STRLCPY(wrapper_name, protocol, sizeof(wrapper_name), n);
-
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unable to find the wrapper \"%s\" - did you forget to enable it when you configured PHP?",
- wrapper_name);
-
- wrapper = NULL;
- protocol = NULL;
- }
- }
- /* TODO: curl based streams probably support file:// properly */
- if (!protocol || !strncasecmp(protocol, "file", n)) {
- if (protocol && path[n+1] == '/' && path[n+2] == '/') {
- if (options & REPORT_ERRORS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "remote host file access not supported, %s", path);
- }
- return NULL;
- }
- if (protocol && path_for_open) {
- *path_for_open = (char*)path + n + 1;
- }
-
- /* fall back on regular file access */
- return (options & STREAM_LOCATE_WRAPPERS_ONLY) ? NULL : &php_plain_files_wrapper;
- }
-
- if (wrapper && wrapper->is_url && !PG(allow_url_fopen)) {
- if (options & REPORT_ERRORS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "URL file-access is disabled in the server configuration");
- }
- return NULL;
- }
-
- return wrapper;
-}
-/* }}} */
-
-/* {{{ _php_stream_stat_path */
-PHPAPI int _php_stream_stat_path(char *path, php_stream_statbuf *ssb TSRMLS_DC)
-{
- php_stream_wrapper *wrapper = NULL;
- char *path_to_open = path;
-
- wrapper = php_stream_locate_url_wrapper(path, &path_to_open, ENFORCE_SAFE_MODE TSRMLS_CC);
- if (wrapper && wrapper->wops->url_stat) {
- return wrapper->wops->url_stat(wrapper, path_to_open, ssb TSRMLS_CC);
- }
- return -1;
-}
-/* }}} */
-
-/* {{{ php_stream_opendir */
-PHPAPI php_stream *_php_stream_opendir(char *path, int options,
- php_stream_context *context STREAMS_DC TSRMLS_DC)
-{
- php_stream *stream = NULL;
- php_stream_wrapper *wrapper = NULL;
- char *path_to_open;
-
- if (!path || !*path) {
- return NULL;
- }
-
- path_to_open = path;
-
- wrapper = php_stream_locate_url_wrapper(path, &path_to_open, options TSRMLS_CC);
-
- if (wrapper && wrapper->wops->dir_opener) {
- stream = wrapper->wops->dir_opener(wrapper,
- path_to_open, "r", options ^ REPORT_ERRORS, NULL,
- context STREAMS_REL_CC TSRMLS_CC);
-
- if (stream) {
- stream->wrapper = wrapper;
- stream->flags |= PHP_STREAM_FLAG_NO_BUFFER;
- }
- } else if (wrapper) {
- php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS TSRMLS_CC, "not implemented");
- }
- if (stream == NULL && (options & REPORT_ERRORS)) {
- php_stream_display_wrapper_errors(wrapper, path, "failed to open dir" TSRMLS_CC);
- }
- php_stream_tidy_wrapper_error_log(wrapper TSRMLS_CC);
-
- return stream;
-}
-/* }}} */
-
-/* {{{ _php_stream_readdir */
-PHPAPI php_stream_dirent *_php_stream_readdir(php_stream *dirstream, php_stream_dirent *ent TSRMLS_DC)
-{
-
- if (sizeof(php_stream_dirent) == php_stream_read(dirstream, (char*)ent, sizeof(php_stream_dirent))) {
- return ent;
- }
-
- return NULL;
-}
-/* }}} */
-
-/* {{{ php_stream_open_wrapper_ex */
-PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int options,
- char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
-{
- php_stream *stream = NULL;
- php_stream_wrapper *wrapper = NULL;
- char *path_to_open;
- int persistent = options & STREAM_OPEN_PERSISTENT;
-#if ZEND_DEBUG
- char *copy_of_path = NULL;
-#endif
-
-
- if (opened_path) {
- *opened_path = NULL;
- }
-
- if (!path || !*path) {
- return NULL;
- }
-
- path_to_open = path;
-
- wrapper = php_stream_locate_url_wrapper(path, &path_to_open, options TSRMLS_CC);
- if (options & STREAM_USE_URL && (!wrapper || !wrapper->is_url)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This function may only be used against URLs.");
- return NULL;
- }
-
- if (wrapper) {
-
- stream = wrapper->wops->stream_opener(wrapper,
- path_to_open, mode, options ^ REPORT_ERRORS,
- opened_path, context STREAMS_REL_CC TSRMLS_CC);
-
- /* if the caller asked for a persistent stream but the wrapper did not
- * return one, force an error here */
- if (stream && (options & STREAM_OPEN_PERSISTENT) && !stream->is_persistent) {
- php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS TSRMLS_CC,
- "wrapper does not support persistent streams");
- php_stream_close(stream);
- stream = NULL;
- }
-
- if (stream) {
- stream->wrapper = wrapper;
- }
- }
-
-#if ZEND_DEBUG
- if (stream) {
- copy_of_path = pestrdup(path, persistent);
- stream->__orig_path = copy_of_path;
- }
-#endif
-
- if (stream != NULL && (options & STREAM_MUST_SEEK)) {
- php_stream *newstream;
-
- switch(php_stream_make_seekable_rel(stream, &newstream,
- (options & STREAM_WILL_CAST)
- ? PHP_STREAM_PREFER_STDIO : PHP_STREAM_NO_PREFERENCE)) {
- case PHP_STREAM_UNCHANGED:
- return stream;
- case PHP_STREAM_RELEASED:
-#if ZEND_DEBUG
- newstream->__orig_path = pestrdup(path, persistent);
-#endif
- return newstream;
- default:
- php_stream_close(stream);
- stream = NULL;
- if (options & REPORT_ERRORS) {
- char *tmp = estrdup(path);
- php_strip_url_passwd(tmp);
- php_error_docref1(NULL TSRMLS_CC, tmp, E_WARNING, "could not make seekable - %s",
- tmp, strerror(errno));
- efree(tmp);
-
- options ^= REPORT_ERRORS;
- }
- }
- }
-
- if (stream && stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0 && strchr(mode, 'a') && stream->position == 0) {
- off_t newpos = 0;
-
- /* if opened for append, we need to revise our idea of the initial file position */
- if (0 == stream->ops->seek(stream, 0, SEEK_CUR, &newpos TSRMLS_CC)) {
- stream->position = newpos;
- }
- }
-
- if (stream == NULL && (options & REPORT_ERRORS)) {
- php_stream_display_wrapper_errors(wrapper, path, "failed to open stream" TSRMLS_CC);
- }
- php_stream_tidy_wrapper_error_log(wrapper TSRMLS_CC);
-#if ZEND_DEBUG
- if (stream == NULL && copy_of_path != NULL) {
- pefree(copy_of_path, persistent);
- }
-#endif
- return stream;
-}
-/* }}} */
-
-/* {{{ context API */
-PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream_context *context)
-{
- php_stream_context *oldcontext = stream->context;
- stream->context = context;
- return oldcontext;
-}
-
-PHPAPI void php_stream_notification_notify(php_stream_context *context, int notifycode, int severity,
- char *xmsg, int xcode, size_t bytes_sofar, size_t bytes_max, void * ptr TSRMLS_DC)
-{
- if (context && context->notifier)
- context->notifier->func(context, notifycode, severity, xmsg, xcode, bytes_sofar, bytes_max, ptr TSRMLS_CC);
-}
-
-PHPAPI void php_stream_context_free(php_stream_context *context)
-{
- zval_ptr_dtor(&context->options);
- efree(context);
-}
-
-PHPAPI php_stream_context *php_stream_context_alloc(void)
-{
- php_stream_context *context;
-
- context = ecalloc(1, sizeof(php_stream_context));
- MAKE_STD_ZVAL(context->options);
- array_init(context->options);
-
- return context;
-}
-
-PHPAPI php_stream_notifier *php_stream_notification_alloc(void)
-{
- return ecalloc(1, sizeof(php_stream_notifier));
-}
-
-PHPAPI void php_stream_notification_free(php_stream_notifier *notifier)
-{
- efree(notifier);
-}
-
-PHPAPI int php_stream_context_get_option(php_stream_context *context,
- const char *wrappername, const char *optionname, zval ***optionvalue)
-{
- zval **wrapperhash;
-
- if (FAILURE == zend_hash_find(Z_ARRVAL_P(context->options), (char*)wrappername, strlen(wrappername)+1, (void**)&wrapperhash)) {
- return FAILURE;
- }
- return zend_hash_find(Z_ARRVAL_PP(wrapperhash), (char*)optionname, strlen(optionname)+1, (void**)optionvalue);
-}
-
-PHPAPI int php_stream_context_set_option(php_stream_context *context,
- const char *wrappername, const char *optionname, zval *optionvalue)
-{
- zval **wrapperhash;
- zval *category;
-
- if (FAILURE == zend_hash_find(Z_ARRVAL_P(context->options), (char*)wrappername, strlen(wrappername)+1, (void**)&wrapperhash)) {
-
- MAKE_STD_ZVAL(category);
- array_init(category);
- if (FAILURE == zend_hash_update(Z_ARRVAL_P(context->options), (char*)wrappername, strlen(wrappername)+1, (void**)&category, sizeof(zval *), NULL)) {
- return FAILURE;
- }
-
- ZVAL_ADDREF(optionvalue);
- wrapperhash = &category;
- }
- return zend_hash_update(Z_ARRVAL_PP(wrapperhash), (char*)optionname, strlen(optionname)+1, (void**)&optionvalue, sizeof(zval *), NULL);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/main/streams/transports.c b/main/streams/transports.c
deleted file mode 100644
index 0bfddd39c0..0000000000
--- a/main/streams/transports.c
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_streams_int.h"
-#include "ext/standard/file.h"
-
-static HashTable xport_hash;
-
-PHPAPI HashTable *php_stream_xport_get_hash(void)
-{
- return &xport_hash;
-}
-
-PHPAPI int php_stream_xport_register(char *protocol, php_stream_transport_factory factory TSRMLS_DC)
-{
- return zend_hash_update(&xport_hash, protocol, strlen(protocol), &factory, sizeof(factory), NULL);
-}
-
-PHPAPI int php_stream_xport_unregister(char *protocol TSRMLS_DC)
-{
- return zend_hash_del(&xport_hash, protocol, strlen(protocol));
-}
-
-#define ERR_REPORT(out_err, fmt, arg) \
- if (out_err) { spprintf(out_err, 0, fmt, arg); } \
- else { php_error_docref(NULL TSRMLS_CC, E_WARNING, fmt, arg); }
-
-#define ERR_RETURN(out_err, local_err, fmt) \
- if (out_err) { *out_err = local_err; } \
- else { php_error_docref(NULL TSRMLS_CC, E_WARNING, fmt, local_err ? local_err : "Unspecified error"); \
- if (local_err) { efree(local_err); local_err = NULL; } \
- }
-
-PHPAPI php_stream *_php_stream_xport_create(const char *name, long namelen, int options,
- int flags, const char *persistent_id,
- struct timeval *timeout,
- php_stream_context *context,
- char **error_string,
- int *error_code
- STREAMS_DC TSRMLS_DC)
-{
- php_stream *stream = NULL;
- php_stream_transport_factory *factory = NULL;
- const char *p, *protocol = NULL;
- int n = 0, failed = 0;
- char *error_text = NULL;
- struct timeval default_timeout = { FG(default_socket_timeout), 0 };
-
- if (timeout == NULL) {
- timeout = &default_timeout;
- }
-
- /* check for a cached persistent socket */
- if (persistent_id) {
- switch(php_stream_from_persistent_id(persistent_id, &stream TSRMLS_CC)) {
- case PHP_STREAM_PERSISTENT_SUCCESS:
- /* TODO: check if the socket is still live */
- return stream;
-
- case PHP_STREAM_PERSISTENT_FAILURE:
- default:
- /* failed; get a new one */
- ;
- }
- }
-
- for (p = name; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++) {
- n++;
- }
-
- if ((*p == ':') && (n > 1) && !strncmp("://", p, 3)) {
- protocol = name;
- name = p + 3;
- namelen -= n + 3;
- } else {
- protocol = "tcp";
- n = 3;
- }
-
- if (protocol) {
- if (FAILURE == zend_hash_find(&xport_hash, (char*)protocol, n, (void**)&factory)) {
- char wrapper_name[32];
-
- if (n >= sizeof(wrapper_name))
- n = sizeof(wrapper_name) - 1;
- PHP_STRLCPY(wrapper_name, protocol, sizeof(wrapper_name), n);
-
- ERR_REPORT(error_string, "Unable to find the socket transport \"%s\" - did you forget to enable it when you configured PHP?",
- wrapper_name);
-
- return NULL;
- }
- }
-
- if (factory == NULL) {
- /* should never happen */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not find a factory !?");
- return NULL;
- }
-
- stream = (*factory)(protocol, n,
- (char*)name, namelen, persistent_id, options, flags, timeout,
- context STREAMS_REL_CC TSRMLS_CC);
-
- if (stream) {
- stream->context = context;
-
- if ((flags & STREAM_XPORT_SERVER) == 0) {
- /* client */
-
- if (flags & STREAM_XPORT_CONNECT) {
- if (0 != php_stream_xport_connect(stream, name, namelen,
- flags & STREAM_XPORT_OP_CONNECT_ASYNC ? 1 : 0,
- timeout, &error_text, error_code TSRMLS_CC)) {
-
- ERR_RETURN(error_string, error_text, "connect() failed: %s");
-
- failed = 1;
- }
- }
-
- } else {
- /* server */
- if (flags & STREAM_XPORT_BIND) {
- if (0 != php_stream_xport_bind(stream, name, namelen, &error_text TSRMLS_CC)) {
- ERR_RETURN(error_string, error_text, "bind() failed: %s");
- failed = 1;
- } else if (flags & STREAM_XPORT_LISTEN) {
- if (0 != php_stream_xport_listen(stream, 5, &error_text TSRMLS_CC)) {
- ERR_RETURN(error_string, error_text, "listen() failed: %s");
- failed = 1;
- }
- }
- }
- }
- }
-
- if (failed) {
- /* failure means that they don't get a stream to play with */
- php_stream_close(stream);
- stream = NULL;
- }
-
- return stream;
-}
-
-/* Bind the stream to a local address */
-PHPAPI int php_stream_xport_bind(php_stream *stream,
- const char *name, long namelen,
- char **error_text
- TSRMLS_DC)
-{
- php_stream_xport_param param;
- int ret;
-
- memset(&param, 0, sizeof(param));
- param.op = STREAM_XPORT_OP_BIND;
- param.inputs.name = (char*)name;
- param.inputs.namelen = namelen;
- param.want_errortext = error_text ? 1 : 0;
-
- ret = php_stream_set_option(stream, PHP_STREAM_OPTION_XPORT_API, 0, &param);
-
- if (ret == PHP_STREAM_OPTION_RETURN_OK) {
- if (error_text) {
- *error_text = param.outputs.error_text;
- }
-
- return param.outputs.returncode;
- }
-
- return ret;
-}
-
-/* Connect to a remote address */
-PHPAPI int php_stream_xport_connect(php_stream *stream,
- const char *name, long namelen,
- int asynchronous,
- struct timeval *timeout,
- char **error_text,
- int *error_code
- TSRMLS_DC)
-{
- php_stream_xport_param param;
- int ret;
-
- memset(&param, 0, sizeof(param));
- param.op = asynchronous ? STREAM_XPORT_OP_CONNECT_ASYNC: STREAM_XPORT_OP_CONNECT;
- param.inputs.name = (char*)name;
- param.inputs.namelen = namelen;
- param.inputs.timeout = timeout;
-
- param.want_errortext = error_text ? 1 : 0;
-
- ret = php_stream_set_option(stream, PHP_STREAM_OPTION_XPORT_API, 0, &param);
-
- if (ret == PHP_STREAM_OPTION_RETURN_OK) {
- if (error_text) {
- *error_text = param.outputs.error_text;
- }
- if (error_code) {
- *error_code = param.outputs.error_code;
- }
- return param.outputs.returncode;
- }
-
- return ret;
-
-}
-
-/* Prepare to listen */
-PHPAPI int php_stream_xport_listen(php_stream *stream, int backlog, char **error_text TSRMLS_DC)
-{
- php_stream_xport_param param;
- int ret;
-
- memset(&param, 0, sizeof(param));
- param.op = STREAM_XPORT_OP_LISTEN;
- param.inputs.backlog = backlog;
- param.want_errortext = error_text ? 1 : 0;
-
- ret = php_stream_set_option(stream, PHP_STREAM_OPTION_XPORT_API, 0, &param);
-
- if (ret == PHP_STREAM_OPTION_RETURN_OK) {
- if (error_text) {
- *error_text = param.outputs.error_text;
- }
-
- return param.outputs.returncode;
- }
-
- return ret;
-}
-
-/* Get the next client and their address (as a string) */
-PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client,
- char **textaddr, int *textaddrlen,
- void **addr, size_t *addrlen,
- struct timeval *timeout,
- char **error_text
- TSRMLS_DC)
-{
- php_stream_xport_param param;
- int ret;
-
- memset(&param, 0, sizeof(param));
-
- param.op = STREAM_XPORT_OP_ACCEPT;
- param.inputs.timeout = timeout;
- param.want_addr = addr ? 1 : 0;
- param.want_textaddr = textaddr ? 1 : 0;
- param.want_errortext = error_text ? 1 : 0;
-
- ret = php_stream_set_option(stream, PHP_STREAM_OPTION_XPORT_API, 0, &param);
-
- if (ret == PHP_STREAM_OPTION_RETURN_OK) {
- *client = param.outputs.client;
- if (addr) {
- *addr = param.outputs.addr;
- *addrlen = param.outputs.addrlen;
- }
- if (textaddr) {
- *textaddr = param.outputs.textaddr;
- *textaddrlen = param.outputs.textaddrlen;
- }
- if (error_text) {
- *error_text = param.outputs.error_text;
- }
-
- return param.outputs.returncode;
- }
- return ret;
-}
-
-PHPAPI int php_stream_xport_get_name(php_stream *stream, int want_peer,
- char **textaddr, int *textaddrlen,
- void **addr, size_t *addrlen
- TSRMLS_DC)
-{
- php_stream_xport_param param;
- int ret;
-
- memset(&param, 0, sizeof(param));
-
- param.op = want_peer ? STREAM_XPORT_OP_GET_PEER_NAME : STREAM_XPORT_OP_GET_NAME;
- param.want_addr = addr ? 1 : 0;
- param.want_textaddr = textaddr ? 1 : 0;
-
- ret = php_stream_set_option(stream, PHP_STREAM_OPTION_XPORT_API, 0, &param);
-
- if (ret == PHP_STREAM_OPTION_RETURN_OK) {
- if (addr) {
- *addr = param.outputs.addr;
- *addrlen = param.outputs.addrlen;
- }
- if (textaddr) {
- *textaddr = param.outputs.textaddr;
- *textaddrlen = param.outputs.textaddrlen;
- }
-
- return param.outputs.returncode;
- }
- return ret;
-}
-
-PHPAPI int php_stream_xport_crypto_setup(php_stream *stream, php_stream_xport_crypt_method_t crypto_method, php_stream *session_stream TSRMLS_DC)
-{
- php_stream_xport_crypto_param param;
- int ret;
-
- memset(&param, 0, sizeof(param));
- param.op = STREAM_XPORT_CRYPTO_OP_SETUP;
- param.inputs.method = crypto_method;
- param.inputs.session = session_stream;
-
- ret = php_stream_set_option(stream, PHP_STREAM_OPTION_CRYPTO_API, 0, &param);
-
- if (ret == PHP_STREAM_OPTION_RETURN_OK) {
- return param.outputs.returncode;
- }
-
- php_error_docref("streams.crypto" TSRMLS_CC, E_WARNING, "this stream does not support SSL/crypto");
-
- return ret;
-}
-
-PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate TSRMLS_DC)
-{
- php_stream_xport_crypto_param param;
- int ret;
-
- memset(&param, 0, sizeof(param));
- param.op = STREAM_XPORT_CRYPTO_OP_ENABLE;
- param.inputs.activate = activate;
-
- ret = php_stream_set_option(stream, PHP_STREAM_OPTION_CRYPTO_API, 0, &param);
-
- if (ret == PHP_STREAM_OPTION_RETURN_OK) {
- return param.outputs.returncode;
- }
-
- php_error_docref("streams.crypto" TSRMLS_CC, E_WARNING, "this stream does not support SSL/crypto");
-
- return ret;
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/main/streams/userspace.c b/main/streams/userspace.c
deleted file mode 100644
index 60e6e03503..0000000000
--- a/main/streams/userspace.c
+++ /dev/null
@@ -1,863 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/file.h"
-
-static int le_protocols;
-
-struct php_user_stream_wrapper {
- char * protoname;
- char * classname;
- zend_class_entry *ce;
- php_stream_wrapper wrapper;
-};
-
-static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
-static int user_wrapper_stat_url(php_stream_wrapper *wrapper, char *url, php_stream_statbuf *ssb TSRMLS_DC);
-static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, char *filename, char *mode,
- int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
-
-static php_stream_wrapper_ops user_stream_wops = {
- user_wrapper_opener,
- NULL, /* close - the streams themselves know how */
- NULL, /* stat - the streams themselves know how */
- user_wrapper_stat_url,
- user_wrapper_opendir,
- "user-space",
- NULL /* unlink */
-};
-
-
-static void stream_wrapper_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- struct php_user_stream_wrapper * uwrap = (struct php_user_stream_wrapper*)rsrc->ptr;
-
- php_unregister_url_stream_wrapper(uwrap->protoname TSRMLS_CC);
- efree(uwrap->protoname);
- efree(uwrap->classname);
- efree(uwrap);
-}
-
-
-PHP_MINIT_FUNCTION(user_streams)
-{
- le_protocols = zend_register_list_destructors_ex(stream_wrapper_dtor, NULL, "stream factory", 0);
- if (le_protocols == FAILURE)
- return FAILURE;
-
- REGISTER_LONG_CONSTANT("STREAM_USE_PATH", USE_PATH, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_IGNORE_URL", IGNORE_URL, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_ENFORCE_SAFE_MODE", ENFORCE_SAFE_MODE, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_REPORT_ERRORS", REPORT_ERRORS, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STREAM_MUST_SEEK", STREAM_MUST_SEEK, CONST_CS|CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-struct _php_userstream_data {
- struct php_user_stream_wrapper * wrapper;
- zval * object;
-};
-typedef struct _php_userstream_data php_userstream_data_t;
-
-/* names of methods */
-#define USERSTREAM_OPEN "stream_open"
-#define USERSTREAM_CLOSE "stream_close"
-#define USERSTREAM_READ "stream_read"
-#define USERSTREAM_WRITE "stream_write"
-#define USERSTREAM_FLUSH "stream_flush"
-#define USERSTREAM_SEEK "stream_seek"
-#define USERSTREAM_TELL "stream_tell"
-#define USERSTREAM_EOF "stream_eof"
-#define USERSTREAM_STAT "stream_stat"
-#define USERSTREAM_STATURL "url_stat"
-#define USERSTREAM_DIR_OPEN "dir_opendir"
-#define USERSTREAM_DIR_READ "dir_readdir"
-#define USERSTREAM_DIR_REWIND "dir_rewinddir"
-#define USERSTREAM_DIR_CLOSE "dir_closedir"
-
-/* {{{ class should have methods like these:
-
- function stream_open($path, $mode, $options, &$opened_path)
- {
- return true/false;
- }
-
- function stream_read($count)
- {
- return false on error;
- else return string;
- }
-
- function stream_write($data)
- {
- return false on error;
- else return count written;
- }
-
- function stream_close()
- {
- }
-
- function stream_flush()
- {
- return true/false;
- }
-
- function stream_seek($offset, $whence)
- {
- return true/false;
- }
-
- function stream_tell()
- {
- return (int)$position;
- }
-
- function stream_eof()
- {
- return true/false;
- }
-
- function stream_stat()
- {
- return array( just like that returned by fstat() );
- }
-
- function url_stat(string $url)
- {
- return array( just like that returned by stat() );
- }
-
- function dir_opendir(string $url, int $options)
- {
- return true / false;
- }
-
- function dir_readdir()
- {
- return string next filename in dir ;
- }
-
- function dir_closedir()
- {
- release dir related resources;
- }
-
- function dir_rewinddir()
- {
- reset to start of dir list;
- }
-
- }}} **/
-
-static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
-{
- struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract;
- php_userstream_data_t *us;
- zval *zfilename, *zmode, *zopened, *zoptions, *zretval = NULL, *zfuncname;
- zval **args[4];
- int call_result;
- php_stream *stream = NULL;
-
- /* Try to catch bad usage without preventing flexibility */
- if (FG(user_stream_current_filename) != NULL && strcmp(filename, FG(user_stream_current_filename)) == 0) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "infinite recursion prevented");
- return NULL;
- }
- FG(user_stream_current_filename) = filename;
-
- us = emalloc(sizeof(*us));
- us->wrapper = uwrap;
-
- /* create an instance of our class */
- ALLOC_ZVAL(us->object);
- object_init_ex(us->object, uwrap->ce);
- ZVAL_REFCOUNT(us->object) = 1;
- PZVAL_IS_REF(us->object) = 1;
-
- /* call it's stream_open method - set up params first */
- MAKE_STD_ZVAL(zfilename);
- ZVAL_STRING(zfilename, filename, 1);
- args[0] = &zfilename;
-
- MAKE_STD_ZVAL(zmode);
- ZVAL_STRING(zmode, mode, 1);
- args[1] = &zmode;
-
- MAKE_STD_ZVAL(zoptions);
- ZVAL_LONG(zoptions, options);
- args[2] = &zoptions;
-
- MAKE_STD_ZVAL(zopened);
- ZVAL_REFCOUNT(zopened) = 1;
- PZVAL_IS_REF(zopened) = 1;
- ZVAL_NULL(zopened);
- args[3] = &zopened;
-
- MAKE_STD_ZVAL(zfuncname);
- ZVAL_STRING(zfuncname, USERSTREAM_OPEN, 1);
-
- call_result = call_user_function_ex(NULL,
- &us->object,
- zfuncname,
- &zretval,
- 4, args,
- 0, NULL TSRMLS_CC);
-
- if (call_result == SUCCESS && zretval != NULL && zval_is_true(zretval)) {
- /* the stream is now open! */
- stream = php_stream_alloc_rel(&php_stream_userspace_ops, us, 0, mode);
-
- /* if the opened path is set, copy it out */
- if (Z_TYPE_P(zopened) == IS_STRING && opened_path) {
- *opened_path = estrndup(Z_STRVAL_P(zopened), Z_STRLEN_P(zopened));
- }
-
- /* set wrapper data to be a reference to our object */
- stream->wrapperdata = us->object;
- zval_add_ref(&stream->wrapperdata);
- } else {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "\"%s::" USERSTREAM_OPEN "\" call failed",
- us->wrapper->classname);
- }
-
- /* destroy everything else */
- if (stream == NULL) {
- zval_ptr_dtor(&us->object);
- efree(us);
- }
- if (zretval)
- zval_ptr_dtor(&zretval);
-
- zval_ptr_dtor(&zfuncname);
- zval_ptr_dtor(&zopened);
- zval_ptr_dtor(&zoptions);
- zval_ptr_dtor(&zmode);
- zval_ptr_dtor(&zfilename);
-
- FG(user_stream_current_filename) = NULL;
-
- return stream;
-}
-
-static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, char *filename, char *mode,
- int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
-{
- struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract;
- php_userstream_data_t *us;
- zval *zfilename, *zoptions, *zretval = NULL, *zfuncname;
- zval **args[2];
- int call_result;
- php_stream *stream = NULL;
-
- /* Try to catch bad usage without preventing flexibility */
- if (FG(user_stream_current_filename) != NULL && strcmp(filename, FG(user_stream_current_filename)) == 0) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "infinite recursion prevented");
- return NULL;
- }
- FG(user_stream_current_filename) = filename;
-
- us = emalloc(sizeof(*us));
- us->wrapper = uwrap;
-
- /* create an instance of our class */
- ALLOC_ZVAL(us->object);
- object_init_ex(us->object, uwrap->ce);
- ZVAL_REFCOUNT(us->object) = 1;
- PZVAL_IS_REF(us->object) = 1;
-
- /* call it's dir_open method - set up params first */
- MAKE_STD_ZVAL(zfilename);
- ZVAL_STRING(zfilename, filename, 1);
- args[0] = &zfilename;
-
- MAKE_STD_ZVAL(zoptions);
- ZVAL_LONG(zoptions, options);
- args[1] = &zoptions;
-
- MAKE_STD_ZVAL(zfuncname);
- ZVAL_STRING(zfuncname, USERSTREAM_DIR_OPEN, 1);
-
- call_result = call_user_function_ex(NULL,
- &us->object,
- zfuncname,
- &zretval,
- 2, args,
- 0, NULL TSRMLS_CC);
-
- if (call_result == SUCCESS && zretval != NULL && zval_is_true(zretval)) {
- /* the stream is now open! */
- stream = php_stream_alloc_rel(&php_stream_userspace_dir_ops, us, 0, mode);
-
- /* set wrapper data to be a reference to our object */
- stream->wrapperdata = us->object;
- zval_add_ref(&stream->wrapperdata);
- } else {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "\"%s::" USERSTREAM_DIR_OPEN "\" call failed",
- us->wrapper->classname);
- }
-
- /* destroy everything else */
- if (stream == NULL) {
- zval_ptr_dtor(&us->object);
- efree(us);
- }
- if (zretval)
- zval_ptr_dtor(&zretval);
-
- zval_ptr_dtor(&zfuncname);
- zval_ptr_dtor(&zoptions);
- zval_ptr_dtor(&zfilename);
-
- FG(user_stream_current_filename) = NULL;
-
- return stream;
-}
-
-
-/* {{{ proto bool stream_register_wrapper(string protocol, string classname)
- Registers a custom URL protocol handler class */
-PHP_FUNCTION(stream_register_wrapper)
-{
- char *protocol, *classname;
- int protocol_len, classname_len;
- struct php_user_stream_wrapper * uwrap;
- int rsrc_id;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &protocol, &protocol_len, &classname, &classname_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- uwrap = (struct php_user_stream_wrapper *)ecalloc(1, sizeof(*uwrap));
- uwrap->protoname = estrndup(protocol, protocol_len);
- uwrap->classname = estrndup(classname, classname_len);
- uwrap->wrapper.wops = &user_stream_wops;
- uwrap->wrapper.abstract = uwrap;
-
- zend_str_tolower(uwrap->classname, classname_len);
- rsrc_id = ZEND_REGISTER_RESOURCE(NULL, uwrap, le_protocols);
-
- if (zend_hash_find(EG(class_table), uwrap->classname, classname_len + 1, (void**)&uwrap->ce) == SUCCESS) {
-#ifdef ZEND_ENGINE_2
- uwrap->ce = *(zend_class_entry**)uwrap->ce;
-#endif
- if (php_register_url_stream_wrapper(protocol, &uwrap->wrapper TSRMLS_CC) == SUCCESS) {
- RETURN_TRUE;
- }
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "class '%s' is undefined",
- classname);
- }
-
- zend_list_delete(rsrc_id);
- RETURN_FALSE;
-}
-/* }}} */
-
-
-static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
-{
- zval func_name;
- zval *retval = NULL;
- int call_result;
- php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
- zval **args[1];
- zval zbuff, *zbufptr;
- size_t didwrite = 0;
-
- assert(us != NULL);
-
- ZVAL_STRINGL(&func_name, USERSTREAM_WRITE, sizeof(USERSTREAM_WRITE)-1, 0);
-
- ZVAL_STRINGL(&zbuff, (char*)buf, count, 0);
- zbufptr = &zbuff;
- args[0] = &zbufptr;
-
- call_result = call_user_function_ex(NULL,
- &us->object,
- &func_name,
- &retval,
- 1, args,
- 0, NULL TSRMLS_CC);
-
- didwrite = 0;
- if (call_result == SUCCESS && retval != NULL) {
- convert_to_long(retval);
- didwrite = Z_LVAL_P(retval);
- } else if (call_result == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " is not implemented!",
- us->wrapper->classname);
- }
-
- /* don't allow strange buffer overruns due to bogus return */
- if (didwrite > count) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " wrote %d bytes more data than requested (%d written, %d max)",
- us->wrapper->classname,
- didwrite - count, didwrite, count);
- didwrite = count;
- }
-
- if (retval)
- zval_ptr_dtor(&retval);
-
- return didwrite;
-}
-
-static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-{
- zval func_name;
- zval *retval = NULL;
- zval **args[1];
- int call_result;
- size_t didread = 0;
- php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
- zval *zcount;
-
- assert(us != NULL);
-
- ZVAL_STRINGL(&func_name, USERSTREAM_READ, sizeof(USERSTREAM_READ)-1, 0);
-
- MAKE_STD_ZVAL(zcount);
- ZVAL_LONG(zcount, count);
- args[0] = &zcount;
-
- call_result = call_user_function_ex(NULL,
- &us->object,
- &func_name,
- &retval,
- 1, args,
- 0, NULL TSRMLS_CC);
-
- if (call_result == SUCCESS && retval != NULL) {
- convert_to_string(retval);
- didread = Z_STRLEN_P(retval);
- if (didread > count) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " - read %d bytes more data than requested (%d read, %d max) - excess data will be lost",
- us->wrapper->classname, didread - count, didread, count);
- didread = count;
- }
- if (didread > 0)
- memcpy(buf, Z_STRVAL_P(retval), didread);
- } else if (call_result == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " is not implemented!",
- us->wrapper->classname);
- }
- zval_ptr_dtor(&zcount);
-
- if (retval) {
- zval_ptr_dtor(&retval);
- retval = NULL;
- }
-
- /* since the user stream has no way of setting the eof flag directly, we need to ask it if we hit eof */
-
- ZVAL_STRINGL(&func_name, USERSTREAM_EOF, sizeof(USERSTREAM_EOF)-1, 0);
-
- call_result = call_user_function_ex(NULL,
- &us->object,
- &func_name,
- &retval,
- 0, NULL, 0, NULL TSRMLS_CC);
-
- if (call_result == SUCCESS && retval != NULL && zval_is_true(retval)) {
- stream->eof = 1;
- } else if (call_result == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "%s::" USERSTREAM_EOF " is not implemented! Assuming EOF",
- us->wrapper->classname);
-
- stream->eof = 1;
- }
-
- if (retval) {
- zval_ptr_dtor(&retval);
- retval = NULL;
- }
-
- return didread;
-}
-
-static int php_userstreamop_close(php_stream *stream, int close_handle TSRMLS_DC)
-{
- zval func_name;
- zval *retval = NULL;
- php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
-
- assert(us != NULL);
-
- ZVAL_STRINGL(&func_name, USERSTREAM_CLOSE, sizeof(USERSTREAM_CLOSE)-1, 0);
-
- call_user_function_ex(NULL,
- &us->object,
- &func_name,
- &retval,
- 0, NULL, 0, NULL TSRMLS_CC);
-
- if (retval)
- zval_ptr_dtor(&retval);
-
- zval_ptr_dtor(&us->object);
-
- efree(us);
-
- return 0;
-}
-
-static int php_userstreamop_flush(php_stream *stream TSRMLS_DC)
-{
- zval func_name;
- zval *retval = NULL;
- int call_result;
- php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
-
- assert(us != NULL);
-
- ZVAL_STRINGL(&func_name, USERSTREAM_FLUSH, sizeof(USERSTREAM_FLUSH)-1, 0);
-
- call_result = call_user_function_ex(NULL,
- &us->object,
- &func_name,
- &retval,
- 0, NULL, 0, NULL TSRMLS_CC);
-
- if (call_result == SUCCESS && retval != NULL && zval_is_true(retval))
- call_result = 0;
- else
- call_result = -1;
-
- if (retval)
- zval_ptr_dtor(&retval);
-
- return call_result;
-}
-
-static int php_userstreamop_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC)
-{
- zval func_name;
- zval *retval = NULL;
- int call_result, ret;
- php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
- zval **args[2];
- zval *zoffs, *zwhence;
-
- assert(us != NULL);
-
- ZVAL_STRINGL(&func_name, USERSTREAM_SEEK, sizeof(USERSTREAM_SEEK)-1, 0);
-
- MAKE_STD_ZVAL(zoffs);
- ZVAL_LONG(zoffs, offset);
- args[0] = &zoffs;
-
- MAKE_STD_ZVAL(zwhence);
- ZVAL_LONG(zwhence, whence);
- args[1] = &zwhence;
-
- call_result = call_user_function_ex(NULL,
- &us->object,
- &func_name,
- &retval,
- 2, args,
- 0, NULL TSRMLS_CC);
-
- zval_ptr_dtor(&zoffs);
- zval_ptr_dtor(&zwhence);
-
- if (call_result == FAILURE) {
- /* stream_seek is not implemented, so disable seeks for this stream */
- stream->flags |= PHP_STREAM_FLAG_NO_SEEK;
- /* there should be no retval to clean up */
-
- if (retval)
- zval_ptr_dtor(&retval);
-
- return -1;
- } else if (call_result == SUCCESS && retval != NULL && zval_is_true(retval)) {
- ret = 0;
- } else {
- ret = -1;
- }
-
- if (retval) {
- zval_ptr_dtor(&retval);
- retval = NULL;
- }
-
- /* now determine where we are */
- ZVAL_STRINGL(&func_name, USERSTREAM_TELL, sizeof(USERSTREAM_TELL)-1, 0);
-
- call_result = call_user_function_ex(NULL,
- &us->object,
- &func_name,
- &retval,
- 0, NULL, 0, NULL TSRMLS_CC);
-
- if (call_result == SUCCESS && retval != NULL && Z_TYPE_P(retval) == IS_LONG)
- *newoffs = Z_LVAL_P(retval);
- else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_TELL " is not implemented!",
- us->wrapper->classname);
-
- if (retval)
- zval_ptr_dtor(&retval);
-
- return 0;
-}
-
-
-/* parse the return value from one of the stat functions and store the
- * relevant fields into the statbuf provided */
-static int statbuf_from_array(zval *array, php_stream_statbuf *ssb TSRMLS_DC)
-{
- zval *elem;
-
-#define STAT_PROP_ENTRY(name) \
- if (SUCCESS == zend_hash_find(Z_ARRVAL_P(array), #name, sizeof(#name), (void**)&elem)) { \
- convert_to_long(elem); \
- ssb->sb.st_##name = Z_LVAL_P(elem); \
- }
-
- STAT_PROP_ENTRY(dev);
- STAT_PROP_ENTRY(ino);
- STAT_PROP_ENTRY(mode);
- STAT_PROP_ENTRY(nlink);
- STAT_PROP_ENTRY(uid);
- STAT_PROP_ENTRY(gid);
-#if HAVE_ST_RDEV
- STAT_PROP_ENTRY(rdev);
-#endif
- STAT_PROP_ENTRY(size);
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- STAT_PROP_ENTRY(atime.tv_sec);
- STAT_PROP_ENTRY(mtime.tv_sec);
- STAT_PROP_ENTRY(ctime.tv_sec);
-#else
- STAT_PROP_ENTRY(atime);
- STAT_PROP_ENTRY(mtime);
- STAT_PROP_ENTRY(ctime);
-#endif
-#ifdef HAVE_ST_BLKSIZE
- STAT_PROP_ENTRY(blksize);
-#endif
-#ifdef HAVE_ST_BLOCKS
- STAT_PROP_ENTRY(blocks);
-#endif
-
-#undef STAT_PROP_ENTRY
- return SUCCESS;
-}
-
-static int php_userstreamop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC)
-{
- zval func_name;
- zval *retval = NULL;
- int call_result;
- php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
- int ret = -1;
-
- ZVAL_STRINGL(&func_name, USERSTREAM_STAT, sizeof(USERSTREAM_STAT)-1, 0);
-
- call_result = call_user_function_ex(NULL,
- &us->object,
- &func_name,
- &retval,
- 0, NULL, 0, NULL TSRMLS_CC);
-
- if (call_result == SUCCESS && retval != NULL && Z_TYPE_P(retval) == IS_ARRAY) {
- if (SUCCESS == statbuf_from_array(retval, ssb TSRMLS_CC))
- ret = 0;
- } else {
- if (call_result == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_STAT " is not implemented!",
- us->wrapper->classname);
- }
- }
-
- if (retval)
- zval_ptr_dtor(&retval);
-
- return ret;
-}
-
-static int user_wrapper_stat_url(php_stream_wrapper *wrapper, char *url, php_stream_statbuf *ssb TSRMLS_DC)
-{
- struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract;
- zval *zfilename, *zfuncname, *zretval;
- zval **args[1];
- int call_result;
- zval *object;
- int ret = -1;
-
- /* create an instance of our class */
- ALLOC_ZVAL(object);
- object_init_ex(object, uwrap->ce);
- ZVAL_REFCOUNT(object) = 1;
- PZVAL_IS_REF(object) = 1;
-
- /* call the stat_url method */
-
- /* call it's stream_open method - set up params first */
- MAKE_STD_ZVAL(zfilename);
- ZVAL_STRING(zfilename, url, 1);
- args[0] = &zfilename;
-
- MAKE_STD_ZVAL(zfuncname);
- ZVAL_STRING(zfuncname, USERSTREAM_STATURL, 1);
-
- call_result = call_user_function_ex(NULL,
- &object,
- zfuncname,
- &zretval,
- 1, args,
- 0, NULL TSRMLS_CC);
-
- if (call_result == SUCCESS && zretval != NULL && Z_TYPE_P(zretval) == IS_ARRAY) {
- /* We got the info we needed */
- if (SUCCESS == statbuf_from_array(zretval, ssb TSRMLS_CC))
- ret = 0;
- } else {
- if (call_result == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_STATURL " is not implemented!",
- uwrap->classname);
- }
- }
-
- /* clean up */
- zval_ptr_dtor(&object);
- if (zretval)
- zval_ptr_dtor(&zretval);
-
- zval_ptr_dtor(&zfuncname);
- zval_ptr_dtor(&zfilename);
-
- return ret;
-
-}
-
-static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-{
- zval func_name;
- zval *retval = NULL;
- int call_result;
- size_t didread = 0;
- php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
- php_stream_dirent *ent = (php_stream_dirent*)buf;
-
- /* avoid problems if someone mis-uses the stream */
- if (count != sizeof(php_stream_dirent))
- return 0;
-
- ZVAL_STRINGL(&func_name, USERSTREAM_DIR_READ, sizeof(USERSTREAM_DIR_READ)-1, 0);
-
- call_result = call_user_function_ex(NULL,
- &us->object,
- &func_name,
- &retval,
- 0, NULL,
- 0, NULL TSRMLS_CC);
-
- if (call_result == SUCCESS && retval != NULL && Z_TYPE_P(retval) != IS_BOOL) {
- convert_to_string(retval);
- PHP_STRLCPY(ent->d_name, Z_STRVAL_P(retval), sizeof(ent->d_name), Z_STRLEN_P(retval));
-
- didread = sizeof(php_stream_dirent);
- } else if (call_result == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_DIR_READ " is not implemented!",
- us->wrapper->classname);
- }
-
- if (retval)
- zval_ptr_dtor(&retval);
-
- return didread;
-}
-
-static int php_userstreamop_closedir(php_stream *stream, int close_handle TSRMLS_DC)
-{
- zval func_name;
- zval *retval = NULL;
- php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
-
- assert(us != NULL);
-
- ZVAL_STRINGL(&func_name, USERSTREAM_DIR_CLOSE, sizeof(USERSTREAM_DIR_CLOSE)-1, 0);
-
- call_user_function_ex(NULL,
- &us->object,
- &func_name,
- &retval,
- 0, NULL, 0, NULL TSRMLS_CC);
-
- if (retval)
- zval_ptr_dtor(&retval);
-
- zval_ptr_dtor(&us->object);
-
- efree(us);
-
- return 0;
-}
-
-static int php_userstreamop_rewinddir(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC)
-{
- zval func_name;
- zval *retval = NULL;
- php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
-
- ZVAL_STRINGL(&func_name, USERSTREAM_DIR_REWIND, sizeof(USERSTREAM_DIR_REWIND)-1, 0);
-
- call_user_function_ex(NULL,
- &us->object,
- &func_name,
- &retval,
- 0, NULL, 0, NULL TSRMLS_CC);
-
- if (retval)
- zval_ptr_dtor(&retval);
-
- return 0;
-
-}
-
-php_stream_ops php_stream_userspace_ops = {
- php_userstreamop_write, php_userstreamop_read,
- php_userstreamop_close, php_userstreamop_flush,
- "user-space",
- php_userstreamop_seek,
- NULL, /* cast */
- php_userstreamop_stat, /* stat */
- NULL /* set_option */
-};
-
-php_stream_ops php_stream_userspace_dir_ops = {
- NULL, /* write */
- php_userstreamop_readdir,
- php_userstreamop_closedir,
- NULL, /* flush */
- "user-space-dir",
- php_userstreamop_rewinddir,
- NULL, /* cast */
- NULL, /* stat */
- NULL /* set_option */
-};
-
-
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c
deleted file mode 100644
index 2b6015ac60..0000000000
--- a/main/streams/xp_socket.c
+++ /dev/null
@@ -1,667 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "ext/standard/file.h"
-#include "streams/php_streams_int.h"
-#include "php_network.h"
-
-#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
-# undef AF_UNIX
-#endif
-
-#if defined(AF_UNIX)
-#include <sys/un.h>
-#endif
-
-php_stream_ops php_stream_generic_socket_ops;
-php_stream_ops php_stream_socket_ops;
-php_stream_ops php_stream_udp_socket_ops;
-#ifdef AF_UNIX
-php_stream_ops php_stream_unix_socket_ops;
-php_stream_ops php_stream_unixdg_socket_ops;
-#endif
-
-
-static int php_tcp_sockop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC);
-
-/* {{{ Generic socket stream operations */
-static size_t php_sockop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
-{
- php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;
- int didwrite;
-
- if (sock->socket == -1) {
- return 0;
- }
-
- didwrite = send(sock->socket, buf, count, 0);
-
- if (didwrite <= 0) {
- char *estr = php_socket_strerror(php_socket_errno(), NULL, 0);
-
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "send of %d bytes failed with errno=%d %s",
- count, php_socket_errno(), estr);
- efree(estr);
- }
-
- if (didwrite > 0) {
- php_stream_notify_progress_increment(stream->context, didwrite, 0);
- }
-
- if (didwrite < 0) {
- didwrite = 0;
- }
-
- return didwrite;
-}
-
-static void php_sock_stream_wait_for_data(php_stream *stream, php_netstream_data_t *sock TSRMLS_DC)
-{
- fd_set fdr, tfdr;
- int retval;
- struct timeval timeout, *ptimeout;
-
- if (sock->socket == -1) {
- return;
- }
-
- FD_ZERO(&fdr);
- FD_SET(sock->socket, &fdr);
- sock->timeout_event = 0;
-
- if (sock->timeout.tv_sec == -1)
- ptimeout = NULL;
- else
- ptimeout = &timeout;
-
-
- while(1) {
- tfdr = fdr;
- timeout = sock->timeout;
-
- retval = select(sock->socket + 1, &tfdr, NULL, NULL, ptimeout);
-
- if (retval == 0)
- sock->timeout_event = 1;
-
- if (retval >= 0)
- break;
- }
-}
-
-static size_t php_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-{
- php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;
- int nr_bytes = 0;
-
- if (sock->socket == -1) {
- return 0;
- }
-
- if (sock->is_blocked) {
- php_sock_stream_wait_for_data(stream, sock TSRMLS_CC);
- if (sock->timeout_event)
- return 0;
- }
-
- nr_bytes = recv(sock->socket, buf, count, 0);
-
- if (nr_bytes == 0 || (nr_bytes == -1 && php_socket_errno() != EWOULDBLOCK)) {
- stream->eof = 1;
- }
-
- if (nr_bytes > 0) {
- php_stream_notify_progress_increment(stream->context, nr_bytes, 0);
- }
-
- if (nr_bytes < 0) {
- nr_bytes = 0;
- }
-
- return nr_bytes;
-}
-
-
-static int php_sockop_close(php_stream *stream, int close_handle TSRMLS_DC)
-{
- php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;
- fd_set wrfds, efds;
- int n;
- struct timeval timeout;
-
- if (close_handle) {
-
- if (sock->socket != -1) {
- /* prevent more data from coming in */
-
-#ifdef AF_UNIX
- if (stream->ops != &php_stream_unix_socket_ops && stream->ops != &php_stream_unixdg_socket_ops) {
-#endif
- shutdown(sock->socket, SHUT_RD);
-#ifdef AF_UNIX
- }
-#endif
-
- /* try to make sure that the OS sends all data before we close the connection.
- * Essentially, we are waiting for the socket to become writeable, which means
- * that all pending data has been sent.
- * We use a small timeout which should encourage the OS to send the data,
- * but at the same time avoid hanging indefintely.
- * */
- do {
- FD_ZERO(&wrfds);
- FD_SET(sock->socket, &wrfds);
- efds = wrfds;
-
- timeout.tv_sec = 0;
- timeout.tv_usec = 5000; /* arbitrary */
-
- n = select(sock->socket + 1, NULL, &wrfds, &efds, &timeout);
- } while (n == -1 && php_socket_errno() == EINTR);
-
- closesocket(sock->socket);
- sock->socket = -1;
- }
-
- }
-
- pefree(sock, php_stream_is_persistent(stream));
-
- return 0;
-}
-
-static int php_sockop_flush(php_stream *stream TSRMLS_DC)
-{
- php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;
- return fsync(sock->socket);
-}
-
-static int php_sockop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC)
-{
- php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;
- return fstat(sock->socket, &ssb->sb);
-}
-
-static int php_sockop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC)
-{
- int oldmode;
- php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;
- php_stream_xport_param *xparam;
-
- switch(option) {
- case PHP_STREAM_OPTION_BLOCKING:
-
- oldmode = sock->is_blocked;
-
- /* no need to change anything */
- if (value == oldmode)
- return oldmode;
-
- if (SUCCESS == php_set_sock_blocking(sock->socket, value TSRMLS_CC)) {
- sock->is_blocked = value;
- return oldmode;
- }
-
- return PHP_STREAM_OPTION_RETURN_ERR;
-
- case PHP_STREAM_OPTION_READ_TIMEOUT:
- sock->timeout = *(struct timeval*)ptrparam;
- sock->timeout_event = 0;
- return PHP_STREAM_OPTION_RETURN_OK;
-
- case PHP_STREAM_OPTION_META_DATA_API:
- add_assoc_bool((zval *)ptrparam, "timed_out", sock->timeout_event);
- add_assoc_bool((zval *)ptrparam, "blocked", sock->is_blocked);
- add_assoc_bool((zval *)ptrparam, "eof", stream->eof);
- return PHP_STREAM_OPTION_RETURN_OK;
-
- case PHP_STREAM_OPTION_XPORT_API:
- xparam = (php_stream_xport_param *)ptrparam;
-
- switch (xparam->op) {
- case STREAM_XPORT_OP_LISTEN:
- xparam->outputs.returncode = listen(sock->socket, 5);
- return PHP_STREAM_OPTION_RETURN_OK;
-
- case STREAM_XPORT_OP_GET_NAME:
- xparam->outputs.returncode = php_network_get_sock_name(sock->socket,
- xparam->want_textaddr ? &xparam->outputs.textaddr : NULL,
- xparam->want_textaddr ? &xparam->outputs.textaddrlen : NULL,
- xparam->want_addr ? &xparam->outputs.addr : NULL,
- xparam->want_addr ? &xparam->outputs.addrlen : NULL
- TSRMLS_CC);
- return PHP_STREAM_OPTION_RETURN_OK;
-
- case STREAM_XPORT_OP_GET_PEER_NAME:
- xparam->outputs.returncode = php_network_get_peer_name(sock->socket,
- xparam->want_textaddr ? &xparam->outputs.textaddr : NULL,
- xparam->want_textaddr ? &xparam->outputs.textaddrlen : NULL,
- xparam->want_addr ? &xparam->outputs.addr : NULL,
- xparam->want_addr ? &xparam->outputs.addrlen : NULL
- TSRMLS_CC);
- return PHP_STREAM_OPTION_RETURN_OK;
-
-
- default:
- return PHP_STREAM_OPTION_RETURN_NOTIMPL;
- }
-
- default:
- return PHP_STREAM_OPTION_RETURN_NOTIMPL;
- }
-}
-
-static int php_sockop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
-{
- php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;
-
- switch(castas) {
- case PHP_STREAM_AS_STDIO:
- if (ret) {
- *(FILE**)ret = fdopen(sock->socket, stream->mode);
- if (*ret)
- return SUCCESS;
- return FAILURE;
- }
- return SUCCESS;
- case PHP_STREAM_AS_FD:
- case PHP_STREAM_AS_SOCKETD:
- if (ret)
- *(int*)ret = sock->socket;
- return SUCCESS;
- default:
- return FAILURE;
- }
-}
-/* }}} */
-
-/* These may look identical, but we need them this way so that
- * we can determine which type of socket we are dealing with
- * by inspecting stream->ops.
- * A "useful" side-effect is that the user's scripts can then
- * make similar decisions using stream_get_meta_data.
- * */
-php_stream_ops php_stream_generic_socket_ops = {
- php_sockop_write, php_sockop_read,
- php_sockop_close, php_sockop_flush,
- "generic_socket",
- NULL, /* seek */
- php_sockop_cast,
- php_sockop_stat,
- php_sockop_set_option,
-};
-
-
-php_stream_ops php_stream_socket_ops = {
- php_sockop_write, php_sockop_read,
- php_sockop_close, php_sockop_flush,
- "tcp_socket",
- NULL, /* seek */
- php_sockop_cast,
- php_sockop_stat,
- php_tcp_sockop_set_option,
-};
-
-php_stream_ops php_stream_udp_socket_ops = {
- php_sockop_write, php_sockop_read,
- php_sockop_close, php_sockop_flush,
- "udp_socket",
- NULL, /* seek */
- php_sockop_cast,
- php_sockop_stat,
- php_tcp_sockop_set_option,
-};
-
-#ifdef AF_UNIX
-php_stream_ops php_stream_unix_socket_ops = {
- php_sockop_write, php_sockop_read,
- php_sockop_close, php_sockop_flush,
- "unix_socket",
- NULL, /* seek */
- php_sockop_cast,
- php_sockop_stat,
- php_tcp_sockop_set_option,
-};
-php_stream_ops php_stream_unixdg_socket_ops = {
- php_sockop_write, php_sockop_read,
- php_sockop_close, php_sockop_flush,
- "udg_socket",
- NULL, /* seek */
- php_sockop_cast,
- php_sockop_stat,
- php_tcp_sockop_set_option,
-};
-#endif
-
-
-/* network socket operations */
-
-#ifdef AF_UNIX
-static inline int parse_unix_address(php_stream_xport_param *xparam, struct sockaddr_un *unix_addr TSRMLS_DC)
-{
- memset(unix_addr, 0, sizeof(*unix_addr));
- unix_addr->sun_family = AF_UNIX;
-
- /* we need to be binary safe on systems that support an abstract
- * namespace */
- if (xparam->inputs.namelen >= sizeof(unix_addr->sun_path)) {
- /* On linux, when the path begins with a NUL byte we are
- * referring to an abstract namespace. In theory we should
- * allow an extra byte below, since we don't need the NULL.
- * BUT, to get into this branch of code, the name is too long,
- * so we don't care. */
- xparam->inputs.namelen = sizeof(unix_addr->sun_path) - 1;
- }
-
- memcpy(unix_addr->sun_path, xparam->inputs.name, xparam->inputs.namelen);
-
- return 1;
-}
-#endif
-
-static inline char *parse_ip_address(php_stream_xport_param *xparam, int *portno TSRMLS_DC)
-{
- char *colon;
- char *p, *host = NULL;
-
-#ifdef HAVE_IPV6
- if (*(xparam->inputs.name) == '[') {
- /* IPV6 notation to specify raw address with port (i.e. [fe80::1]:80) */
- p = memchr(xparam->inputs.name + 1, ']', xparam->inputs.namelen - 2);
- if (!p || *(p + 1) != ':') {
- if (xparam->want_errortext) {
- spprintf(&xparam->outputs.error_text, 0, "Failed to parse IPv6 address \"%s\"", xparam->inputs.name);
- }
- return NULL;
- }
- *portno = atoi(p + 2);
- return estrndup(xparam->inputs.name + 1, p - xparam->inputs.name - 1);
- }
-#endif
-
- colon = memchr(xparam->inputs.name, ':', xparam->inputs.namelen - 1);
- if (colon) {
- *portno = atoi(colon + 1);
- host = estrndup(xparam->inputs.name, colon - xparam->inputs.name);
- } else {
- if (xparam->want_errortext) {
- spprintf(&xparam->outputs.error_text, 0, "Failed to parse address \"%s\"", xparam->inputs.name);
- }
- return NULL;
- }
-
- return host;
-}
-
-static inline int php_tcp_sockop_bind(php_stream *stream, php_netstream_data_t *sock,
- php_stream_xport_param *xparam TSRMLS_DC)
-{
- char *host = NULL;
- int portno, err;
-
-#ifdef AF_UNIX
- if (stream->ops == &php_stream_unix_socket_ops || stream->ops == &php_stream_unixdg_socket_ops) {
- struct sockaddr_un unix_addr;
-
- sock->socket = socket(PF_UNIX, stream->ops == &php_stream_unix_socket_ops ? SOCK_STREAM : SOCK_DGRAM, 0);
-
- if (sock->socket == SOCK_ERR) {
- if (xparam->want_errortext) {
- spprintf(&xparam->outputs.error_text, 0, "Failed to create unix%s socket %s",
- stream->ops == &php_stream_unix_socket_ops ? "" : "datagram",
- strerror(errno));
- }
- return -1;
- }
-
- parse_unix_address(xparam, &unix_addr TSRMLS_CC);
-
- return bind(sock->socket, (struct sockaddr *)&unix_addr, sizeof(unix_addr));
- }
-#endif
-
- host = parse_ip_address(xparam, &portno TSRMLS_CC);
-
- if (host == NULL) {
- return -1;
- }
-
- sock->socket = php_network_bind_socket_to_local_addr(host, portno,
- stream->ops == &php_stream_udp_socket_ops ? SOCK_DGRAM : SOCK_STREAM,
- xparam->want_errortext ? &xparam->outputs.error_text : NULL,
- &err
- TSRMLS_CC);
-
- if (host) {
- efree(host);
- }
-
- return sock->socket == -1 ? -1 : 0;
-}
-
-static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_t *sock,
- php_stream_xport_param *xparam TSRMLS_DC)
-{
- char *host = NULL;
- int portno;
- int err;
- int ret;
-
-#ifdef AF_UNIX
- if (stream->ops == &php_stream_unix_socket_ops || stream->ops == &php_stream_unixdg_socket_ops) {
- struct sockaddr_un unix_addr;
-
- sock->socket = socket(PF_UNIX, stream->ops == &php_stream_unix_socket_ops ? SOCK_STREAM : SOCK_DGRAM, 0);
-
- if (sock->socket == SOCK_ERR) {
- if (xparam->want_errortext) {
- spprintf(&xparam->outputs.error_text, 0, "Failed to create unix socket");
- }
- return -1;
- }
-
- parse_unix_address(xparam, &unix_addr TSRMLS_CC);
-
- ret = php_network_connect_socket(sock->socket,
- (const struct sockaddr *)&unix_addr, (socklen_t)sizeof(unix_addr),
- xparam->op == STREAM_XPORT_OP_CONNECT_ASYNC, xparam->inputs.timeout,
- xparam->want_errortext ? &xparam->outputs.error_text : NULL,
- &err);
-
- xparam->outputs.error_code = err;
-
- goto out;
- }
-#endif
-
- host = parse_ip_address(xparam, &portno TSRMLS_CC);
-
- if (host == NULL) {
- return -1;
- }
-
- /* Note: the test here for php_stream_udp_socket_ops is important, because we
- * want the default to be TCP sockets so that the openssl extension can
- * re-use this code. */
-
- sock->socket = php_network_connect_socket_to_host(host, portno,
- stream->ops == &php_stream_udp_socket_ops ? SOCK_DGRAM : SOCK_STREAM,
- xparam->op == STREAM_XPORT_OP_CONNECT_ASYNC,
- xparam->inputs.timeout,
- xparam->want_errortext ? &xparam->outputs.error_text : NULL,
- &err
- TSRMLS_CC);
-
- ret = sock->socket == -1 ? -1 : 0;
- xparam->outputs.error_code = err;
-
- if (host) {
- efree(host);
- }
-
-#ifdef AF_UNIX
-out:
-#endif
-
- if (ret >= 0 && xparam->op == STREAM_XPORT_OP_CONNECT_ASYNC && err == EINPROGRESS) {
- /* indicates pending connection */
- return 1;
- }
-
- return ret;
-}
-
-static inline int php_tcp_sockop_accept(php_stream *stream, php_netstream_data_t *sock,
- php_stream_xport_param *xparam STREAMS_DC TSRMLS_DC)
-{
- int clisock;
-
- xparam->outputs.client = NULL;
-
- clisock = php_network_accept_incoming(sock->socket,
- xparam->want_textaddr ? &xparam->outputs.textaddr : NULL,
- xparam->want_textaddr ? &xparam->outputs.textaddrlen : NULL,
- xparam->want_addr ? &xparam->outputs.addr : NULL,
- xparam->want_addr ? &xparam->outputs.addrlen : NULL,
- xparam->inputs.timeout,
- xparam->want_errortext ? &xparam->outputs.error_text : NULL,
- &xparam->outputs.error_code
- TSRMLS_CC);
-
- if (clisock >= 0) {
- php_netstream_data_t *clisockdata;
-
- clisockdata = pemalloc(sizeof(*clisockdata), stream->is_persistent);
-
- if (clisockdata == NULL) {
- close(clisock);
- /* technically a fatal error */
- } else {
- memcpy(clisockdata, sock, sizeof(*clisockdata));
- clisockdata->socket = clisock;
-
- xparam->outputs.client = php_stream_alloc_rel(stream->ops, clisockdata, NULL, "r+");
- if (xparam->outputs.client) {
- xparam->outputs.client->context = stream->context;
- }
- }
- }
-
- return xparam->outputs.client == NULL ? -1 : 0;
-}
-
-static int php_tcp_sockop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC)
-{
- php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;
- php_stream_xport_param *xparam;
-
- switch(option) {
- case PHP_STREAM_OPTION_XPORT_API:
- xparam = (php_stream_xport_param *)ptrparam;
-
- switch(xparam->op) {
- case STREAM_XPORT_OP_CONNECT:
- case STREAM_XPORT_OP_CONNECT_ASYNC:
- xparam->outputs.returncode = php_tcp_sockop_connect(stream, sock, xparam TSRMLS_CC);
- return PHP_STREAM_OPTION_RETURN_OK;
-
- case STREAM_XPORT_OP_BIND:
- xparam->outputs.returncode = php_tcp_sockop_bind(stream, sock, xparam TSRMLS_CC);
- return PHP_STREAM_OPTION_RETURN_OK;
-
-
- case STREAM_XPORT_OP_ACCEPT:
- xparam->outputs.returncode = php_tcp_sockop_accept(stream, sock, xparam STREAMS_CC TSRMLS_CC);
- return PHP_STREAM_OPTION_RETURN_OK;
- default:
- /* fall through */
- ;
- }
-
- /* fall through */
- default:
- return php_sockop_set_option(stream, option, value, ptrparam TSRMLS_CC);
- }
-}
-
-
-PHPAPI php_stream *php_stream_generic_socket_factory(const char *proto, long protolen,
- char *resourcename, long resourcenamelen,
- const char *persistent_id, int options, int flags,
- struct timeval *timeout,
- php_stream_context *context STREAMS_DC TSRMLS_DC)
-{
- php_stream *stream = NULL;
- php_netstream_data_t *sock;
- php_stream_ops *ops;
-
- /* which type of socket ? */
- if (strncmp(proto, "tcp", protolen) == 0) {
- ops = &php_stream_socket_ops;
- } else if (strncmp(proto, "udp", protolen) == 0) {
- ops = &php_stream_udp_socket_ops;
- }
-#ifdef AF_UNIX
- else if (strncmp(proto, "unix", protolen) == 0) {
- ops = &php_stream_unix_socket_ops;
- } else if (strncmp(proto, "udg", protolen) == 0) {
- ops = &php_stream_unixdg_socket_ops;
- }
-#endif
- else {
- /* should never happen */
- return NULL;
- }
-
- sock = pemalloc(sizeof(php_netstream_data_t), persistent_id ? 1 : 0);
- memset(sock, 0, sizeof(php_netstream_data_t));
-
- sock->is_blocked = 1;
- sock->timeout.tv_sec = FG(default_socket_timeout);
- sock->timeout.tv_usec = 0;
-
- /* we don't know the socket until we have determined if we are binding or
- * connecting */
- sock->socket = -1;
-
- stream = php_stream_alloc_rel(ops, sock, persistent_id, "r+");
-
- if (stream == NULL) {
- pefree(sock, persistent_id ? 1 : 0);
- return NULL;
- }
-
- if (flags == 0) {
- return stream;
- }
-
- return stream;
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/main/strlcat.c b/main/strlcat.c
deleted file mode 100644
index f3e8f70e3e..0000000000
--- a/main/strlcat.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-
-#ifndef HAVE_STRLCAT
-
-/* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */
-
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Appends src to string dst of size siz (unlike strncat, siz is the
- * full size of dst, not space left). At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz == 0).
- * Returns strlen(src); if retval >= siz, truncation occurred.
- */
-PHPAPI size_t php_strlcat(dst, src, siz)
- char *dst;
- const char *src;
- size_t siz;
-{
- register char *d = dst;
- register const char *s = src;
- register size_t n = siz;
- size_t dlen;
-
- /* Find the end of dst and adjust bytes left but don't go past end */
- while (*d != '\0' && n-- != 0)
- d++;
- dlen = d - dst;
- n = siz - dlen;
-
- if (n == 0)
- return(dlen + strlen(s));
- while (*s != '\0') {
- if (n != 1) {
- *d++ = *s;
- n--;
- }
- s++;
- }
- *d = '\0';
-
- return(dlen + (s - src)); /* count does not include NUL */
-}
-
-#endif /* !HAVE_STRLCAT */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/strlcpy.c b/main/strlcpy.c
deleted file mode 100644
index 89ff7ba505..0000000000
--- a/main/strlcpy.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-
-#ifndef HAVE_STRLCPY
-
-/* $OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $ */
-
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Copy src to string dst of size siz. At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz == 0).
- * Returns strlen(src); if retval >= siz, truncation occurred.
- */
-PHPAPI size_t php_strlcpy(dst, src, siz)
- char *dst;
- const char *src;
- size_t siz;
-{
- register char *d = dst;
- register const char *s = src;
- register size_t n = siz;
-
- /* Copy as many bytes as will fit */
- if (n != 0 && --n != 0) {
- do {
- if ((*d++ = *s++) == 0)
- break;
- } while (--n != 0);
- }
-
- /* Not enough room in dst, add NUL and traverse rest of src */
- if (n == 0) {
- if (siz != 0)
- *d = '\0'; /* NUL-terminate dst */
- while (*s++)
- ;
- }
-
- return(s - src - 1); /* count does not include NUL */
-}
-
-#endif /* !HAVE_STRLCPY */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/main/win95nt.h b/main/win95nt.h
deleted file mode 100644
index b6a0f9bd9f..0000000000
--- a/main/win95nt.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* Defines and types for Windows 95/NT */
-#define HAVE_DECLARED_TIMEZONE
-#define WIN32_LEAN_AND_MEAN
-#include <io.h>
-#include <malloc.h>
-#include <direct.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <sys/types.h>
-typedef int uid_t;
-typedef int gid_t;
-typedef char * caddr_t;
-#define lstat(x, y) stat(x, y)
-#define _IFIFO 0010000 /* fifo */
-#define _IFBLK 0060000 /* block special */
-#define _IFLNK 0120000 /* symbolic link */
-#define S_IFIFO _IFIFO
-#define S_IFBLK _IFBLK
-#define S_IFLNK _IFLNK
-#ifndef S_ISREG
-#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#endif
-#define chdir(path) SetCurrentDirectory(path)
-#define mkdir(a, b) _mkdir(a)
-#define rmdir(a) _rmdir(a)
-#define getpid _getpid
-#define php_sleep(t) Sleep(t*1000)
-#define getcwd(a, b) _getcwd(a, b)
-#define off_t _off_t
-typedef unsigned int uint;
-typedef unsigned long ulong;
-#if !NSAPI
-typedef long pid_t;
-#endif
-
-/* missing in vc5 math.h */
-#define M_PI 3.14159265358979323846
-#define M_TWOPI (M_PI * 2.0)
-#define M_PI_2 1.57079632679489661923
-#ifndef M_PI_4
-#define M_PI_4 0.78539816339744830962
-#endif
-
-#if !defined(PHP_DEBUG)
-#ifdef inline
-#undef inline
-#endif
-#define inline __inline
-#endif
-
-/* General Windows stuff */
-#define WINDOWS 1
-
-/* Prevent use of VC5 OpenFile function */
-#define NOOPENFILE
-
-/* sendmail is built-in */
-#ifdef PHP_PROG_SENDMAIL
-#undef PHP_PROG_SENDMAIL
-#define PHP_PROG_SENDMAIL "Built in mailer"
-#endif
diff --git a/makedist b/makedist
deleted file mode 100755
index d1d3a29710..0000000000
--- a/makedist
+++ /dev/null
@@ -1,142 +0,0 @@
-#!/bin/sh
-#
-# Distribution generator for CVS based packages.
-# To work, this script needs a consistent tagging of all releases.
-# Each release of a package should have a tag of the form
-#
-# <package>_<version>
-#
-# where <package> is the package name and the CVS module
-# and <version> s the version number with underscores instead of dots.
-#
-# For example: cvs tag php_5_0_1
-#
-# The distribution ends up in a .tar.gz file that contains the distribution
-# in a directory called <package>-<version>. The distribution contains all
-# directories from the CVS module except the one called "nodist", but only
-# the files INSTALL, README and config* are included.
-#
-# Since you can no longer set the CVS password via an env variable, you
-# need to have previously done a cvs login for the server and user id
-# this script uses so it will have an entry in your ~/.cvspasswd file.
-#
-# Usage: makedist <package> <version>
-#
-# Written by Stig Bakken <ssb@guardian.no> 1997-05-28.
-#
-# $Id$
-#
-
-if test "$#" != "2"; then
- echo "Usage: makedist <package> <version>" >&2
- exit 1
-fi
-
-PKG=$1 ; shift
-VER=$1 ; shift
-
-old_IFS="$IFS"
-IFS=.
-eval set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /'`
-if test "${1}" = "1" -a "${2}" -lt "28"; then
- echo "You will need bison 1.28 if you want to regenerate the Zend parser (found ${1}.${2}).)"
- exit 10
-fi
-IFS="$old_IFS"
-
-PHPROOT=:pserver:cvsread@cvs.php.net:/repository
-PHPMOD=php5
-LT_TARGETS='ltconfig ltmain.sh config.guess config.sub'
-
-if echo '\c' | grep -s c >/dev/null 2>&1
-then
- ECHO_N="echo -n"
- ECHO_C=""
-else
- ECHO_N="echo"
- ECHO_C='\c'
-fi
-
-MY_OLDPWD=`pwd`
-
-# the destination .tar.gz file
-ARCHIVE=$MY_OLDPWD/$PKG-$VER.tar
-
-# temporary directory used to check out files from CVS
-DIR=$PKG-$VER
-DIRPATH=$MY_OLDPWD/$DIR
-
-if test -d "$DIRPATH"; then
- echo "The directory $DIR"
- echo "already exists, rename or remove it and run makedist again."
- exit 1
-fi
-
-# version part of the CVS release tag
-CVSVER=`echo $VER | sed -e 's/[\.\-]/_/g'`
-
-# CVS release tag
-if test "$VER" != "HEAD"; then
- CVSTAG=${PKG}_$CVSVER
-else
- CVSTAG=HEAD
-fi
-
-if test ! -d $DIRPATH; then
- mkdir -p $DIRPATH || exit 2
-fi
-
-# Export PHP
-$ECHO_N "makedist: exporting tag '$CVSTAG' from '$PHPMOD'...$ECHO_C"
-cvs -z 9 -d $PHPROOT export -d $DIR -r $CVSTAG $PHPMOD || exit 4
-echo ""
-
-# remove CVS stuff...
-cd $DIR || exit 5
-find . \( \( -name CVS -type d \) -o -name .cvsignore \) -exec rm -rf {} \;
-
-# The full ChangeLog is available separately from lxr.php.net
-rm -f ChangeLog*
-
-# hide away our own versions of libtool-generated files
-for i in $LT_TARGETS; do
- if test -f "$i"; then
- mv $i $i.bak
- cp $i.bak $i
- fi
-done
-
-# generate some files so people don't need bison, flex and autoconf
-# to install
-set -x
-./buildconf --copy
-
-# remove buildmk.stamp. Otherwise, buildcheck.sh might not be run,
-# when a user runs buildconf in the distribution.
-rm -f buildmk.stamp
-
-./genfiles
-
-# now restore our versions of libtool-generated files
-for i in $LT_TARGETS; do
- test -f "$i" && mv $i.bak $i
-done
-
-cd $MY_OLDPWD
-$ECHO_N "makedist: making gzipped tar archive...$ECHO_C"
-rm -f $ARCHIVE.gz
-tar cf $ARCHIVE $PKG-$VER || exit 8
-gzip -9 $ARCHIVE || exit 9
-echo ""
-
-$ECHO_N "makedist: making bz2zipped tar archive...$ECHO_C"
-rm -f $ARCHIVE.bz2
-tar cf $ARCHIVE $PKG-$VER || exit 10
-bzip2 -9 $ARCHIVE || exit 11
-echo ""
-
-$ECHO_N "makedist: cleaning up...$ECHO_C"
-rm -rf $DIRPATH || exit 12
-echo ""
-
-exit 0
diff --git a/makerpm b/makerpm
deleted file mode 100644
index 5c893c488d..0000000000
--- a/makerpm
+++ /dev/null
@@ -1,156 +0,0 @@
-#! /bin/sh
-
-# Based slightly on an original by John H Terpstra but not much left of his.
-# S Liddicott 1999 sam@campbellsci.co.uk
-
-PREFIX="php"
-TARDIR="`basename \`pwd\``"
-RELEASE=${1:-1}
-VERSION=${2:-`echo $TARDIR | sed "s/$PREFIX-//g"`}
-
-if [ "$VERSION" = "" ]
-then cat <<"EOH"
-$PREFIX source needs to be installed in a folder that contains the version
-number, e.g. ${PREFIX}4 or ${PREFIX}4b2
-EOH
-fi
-
-echo "Usage:"
-echo "$0 <release>"
-echo
-echo "e.g.:"
-echo "$0 2"
-echo -n "Building RPM version $VERSION, release: $RELEASE "
-sleep 1 ; echo -n . ; sleep 1 ; echo -n . ; sleep 1 ; echo -n .
-echo
-
-TAR=php-$VERSION.tar.gz
-SPEC=php-$VERSION.spec
-
-# write out the .spec file
-sed -e "s/PVERSION/$VERSION/g" \
- -e "s/PRELEASE/$RELEASE/g" \
- -e "s/TARDIR/$TARDIR/g" \
- > $SPEC <<'EOF'
-Summary: PHP 4 - A powerful scripting language
-Name: mod_php4
-Version: PVERSION
-Release: PRELEASE
-Group: Networking/Daemons
-Source0: http://www.php.net/distributions/php-%{PACKAGE_VERSION}.tar.gz
-Copyright: GPL
-BuildRoot: /tmp/php4-root
-Requires: webserver
-
-%description
-PHP4 is a powerful apache module that adds scripting and database connection
-capabilities to the apache server. This version includes the "php" binary
-for suExec and stand alone php scripts too.
-
-%prep
-%setup -q -n TARDIR
-#mkdir manual; cd manual && tar xzf $RPM_SOURCE_DIR/php3-manual.tar.gz
-chown -R root.root .
-./buildconf
-
-%build
-# first the standalone (why can't you build both at once?)
-# need to run this under sh or it breaks
-
-sh ./configure --prefix=/usr \
- --with-config-file-path=/usr/lib \
- --enable-force-cgi-redirect \
- --enable-safe-mode \
- --with-exec-dir=/usr/bin \
- --with-mysql=/usr \
- --with-pdflib=/usr \
- --with-zlib=/usr \
- --enable-xml \
- --enable-wddx
-
-make
-mv php php.keepme
-
-# then the apache module
-rm config.cache
-sh ./configure --prefix=/usr \
- --with-apxs=/usr/sbin/apxs \
- --enable-versioning \
- --with-config-file-path=/usr/lib \
- --enable-safe-mode \
- --with-exec-dir=/usr/bin \
- --with-mysql=/usr \
- --with-pdflib=/usr \
- --with-zlib=/usr \
- --enable-xml \
- --enable-wddx
-
-make clean
-make
-# restore cgi version
-mv php.keepme php
-
-%install
-rm -rf $RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT/usr/lib/apache
-install -m 755 .libs/libphp4.so $RPM_BUILD_ROOT/usr/lib/apache
-mkdir -p $RPM_BUILD_ROOT/usr/bin
-install -m 755 php $RPM_BUILD_ROOT/usr/bin
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%changelog
-* Mon Mar 04 2002 Arjen Lentz <agl@bitbike.com>
-- Fix path and remove --with-imap due to conflicts with kerberos.
-
-* Fri Jun 29 2001 Jani Taskinen <sniper@iki.fi>
-- Removed some useless configure options. Made the tar names correct.
-
-* Sun Apr 30 2000 Joey Smith <joey@samaritan.com>
-- Small fix: Description still referred to package as PHP3.
-
-* Wed Jul 21 1999 Sam Liddicott <sam@campbellsci.co.uk>
-- added php4b1 and modified cgi building rules so it doesn't break module
-
-* Wed Mar 17 1999 Sam Liddicott <sam@campbellsci.co.uk>
-- Stuffed in 3.0.7 source tar and added "php" as a build destination
-
-* Mon Oct 12 1998 Cristian Gafton <gafton@redhat.com>
-- rebuild for apache 1.3.3
-
-* Thu Oct 08 1998 Preston Brown <pbrown@redhat.com>
-- updated to 3.0.5, fixes nasty bugs in 3.0.4.
-
-* Sun Sep 27 1998 Cristian Gafton <gafton@redhat.com>
-- updated to 3.0.4 and recompiled for apache 1.3.2
-
-* Thu Sep 03 1998 Preston Brown <pbrown@redhat.com>
-- improvements; builds with apache-devel package installed.
-
-* Tue Sep 01 1998 Preston Brown <pbrown@redhat.com>
-- Made initial cut for PHP3.
-
-%files
-/usr/lib/apache/libphp4.so
-/usr/bin/php
-%doc TODO CODING_STANDARDS CREDITS ChangeLog LICENSE BUGS examples
-%doc manual/*
-EOF
-
-RPMDIR=/usr/src/redhat/RPMS
-SPECDIR=/usr/src/redhat/SPECS
-SRCDIR=/usr/src/redhat/SOURCES
-
-(
-make clean
-find . -name config.cache -exec rm -f '{}'
-cd ..
-tar czvf ${SRCDIR}/${TAR} $TARDIR )
-
-cp -a $SPEC $SPECDIR/${SPEC}
-#cp -a *.patch $SRCDIR
-cd $SRCDIR
-chown -R root.root ${TAR}
-cd $SPECDIR
-rpm -ba -v ${SPEC}
diff --git a/netware/ApacheCore.imp b/netware/ApacheCore.imp
deleted file mode 100644
index 3f77837970..0000000000
--- a/netware/ApacheCore.imp
+++ /dev/null
@@ -1,365 +0,0 @@
- ap_MD5Final,
- ap_MD5Init,
- ap_MD5Update,
- ap_acquire_mutex,
- ap_add_cgi_vars,
- ap_add_common_vars,
- ap_add_loaded_module,
- ap_add_module,
- ap_add_named_module,
- ap_add_per_dir_conf,
- ap_add_per_url_conf,
- ap_add_version_component,
- ap_allow_options,
- ap_allow_overrides,
- ap_append_arrays,
- ap_array_cat,
- ap_auth_name,
- ap_auth_type,
- ap_basic_http_header,
- ap_bclose,
- ap_bcreate,
- ap_bfilbuf,
- ap_bfileno,
- ap_bflsbuf,
- ap_bflush,
- ap_bgetopt,
- ap_bgets,
- ap_bhalfduplex,
- ap_block_alarms,
- ap_blookc,
- ap_bnonblock,
- ap_bonerror,
- ap_bpushfd,
- ap_bputs,
- ap_bread,
- ap_bsetflag,
- ap_bsetopt,
- ap_bskiplf,
- ap_bspawn_child,
- ap_bwrite,
- ap_bytes_in_free_blocks,
- ap_bytes_in_pool,
- ap_call_exec,
- ap_can_exec,
- ap_cfg_closefile,
- ap_cfg_getc,
- ap_cfg_getline,
- ap_chdir_file,
- ap_check_alarm,
- ap_check_cmd_context,
- ap_checkmask,
- ap_cleanup_for_exec,
- ap_clear_module_list,
- ap_clear_pool,
- ap_clear_table,
- ap_close_piped_log,
- ap_construct_server,
- ap_construct_url,
- ap_content_type_tolower,
- ap_copy_array,
- ap_copy_array_hdr,
- ap_copy_table,
- ap_count_dirs,
- ap_cpystrn,
- ap_create_environment,
- ap_create_mutex,
- ap_create_per_dir_config,
- ap_custom_response,
- ap_default_port_for_request,
- ap_default_port_for_scheme,
- ap_default_type,
- ap_destroy_mutex,
- ap_destroy_pool,
- ap_destroy_sub_req,
- ap_die,
- ap_discard_request_body,
- ap_document_root,
- ap_each_byterange,
- ap_error_log2stderr,
- ap_escape_html,
- ap_escape_path_segment,
- ap_escape_quotes,
- ap_escape_shell_cmd,
- ap_exists_scoreboard_image,
- ap_finalize_request_protocol,
- ap_find_command,
- ap_find_command_in_modules,
- ap_find_last_token,
- ap_find_linked_module,
- ap_find_module_name,
- ap_find_path_info,
- ap_find_token,
- ap_get_basic_auth_pw,
- ap_get_client_block,
- ap_get_gmtoff,
- ap_get_limit_req_body,
- ap_get_remote_host,
- ap_get_remote_logname,
- ap_get_server_built,
- ap_get_server_name,
- ap_get_server_port,
- ap_get_server_version,
- ap_get_time,
- ap_get_token,
- ap_getparents,
- ap_getword,
- ap_getword_conf,
- ap_getword_conf_nc,
- ap_getword_nc,
- ap_getword_nulls,
- ap_getword_nulls_nc,
- ap_getword_white,
- ap_getword_white_nc,
- ap_gm_timestr_822,
- ap_gname2id,
- ap_handle_command,
- ap_hard_timeout,
- ap_ht_time,
- ap_ind,
- ap_index_of_response,
- ap_init_virtual_host,
- ap_internal_redirect,
- ap_internal_redirect_handler,
- ap_is_directory,
- ap_is_fnmatch,
- ap_is_initial_req,
- ap_is_matchexp,
- ap_is_url,
- ap_kill_cleanup,
- ap_kill_cleanups_for_fd,
- ap_kill_cleanups_for_socket,
- ap_kill_timeout,
- ap_log_assert,
- ap_log_error_old,
- ap_log_reason,
- ap_log_unixerr,
- ap_make_array,
- ap_make_dirstr,
- ap_make_dirstr_parent,
- ap_make_dirstr_prefix,
- ap_make_full_path,
- ap_make_sub_pool,
- ap_make_table,
- ap_matches_request_vhost,
- ap_md5,
- ap_md5_binary,
- ap_md5contextTo64,
- ap_md5digest,
- ap_meets_conditions,
- ap_no2slash,
- ap_note_auth_failure,
- ap_note_basic_auth_failure,
- ap_note_cleanups_for_fd,
- ap_note_cleanups_for_file,
- ap_note_cleanups_for_socket,
- ap_note_digest_auth_failure,
- ap_note_subprocess,
- ap_open_mutex,
- ap_open_piped_log,
- ap_os_escape_path,
- ap_overlap_tables,
- ap_overlay_tables,
- ap_palloc,
- ap_parseHTTPdate,
- ap_parse_hostinfo_components,
- ap_parse_uri,
- ap_parse_uri_components,
- ap_pcalloc,
- ap_pcfg_open_custom,
- ap_pcfg_openfile,
- ap_pclosedir,
- ap_pclosef,
- ap_pclosesocket,
- ap_pduphostent,
- ap_pfclose,
- ap_pfdopen,
- ap_pfopen,
- ap_pgethostbyname,
- ap_popendir,
- ap_popenf,
- ap_pregcomp,
- ap_pregfree,
- ap_pregsub,
- ap_psignature,
- ap_psocket,
- ap_pstrdup,
- ap_pstrndup,
- ap_push_array,
- ap_pvsprintf,
- ap_rationalize_mtime,
- ap_register_cleanup,
- ap_release_mutex,
- ap_remove_loaded_module,
- ap_remove_module,
- ap_requires,
- ap_reset_timeout,
- ap_rflush,
- ap_rind,
- ap_rputc,
- ap_rputs,
- ap_run_cleanup,
- ap_run_sub_req,
- ap_rwrite,
- ap_satisfies,
- ap_scan_script_header_err,
- ap_scan_script_header_err_buff,
- ap_scan_script_header_err_core,
- ap_send_fb,
- ap_send_fb_length,
- ap_send_fd,
- ap_send_fd_length,
- ap_send_http_header,
- ap_send_http_trace,
- ap_send_mmap,
- ap_send_size,
- ap_server_root_relative,
- ap_set_byterange,
- ap_set_content_length,
- ap_set_etag,
- ap_set_keepalive,
- ap_set_last_modified,
- ap_setup_client_block,
- ap_should_client_block,
- ap_soft_timeout,
- ap_some_auth_required,
- ap_spawn_child,
- ap_srm_command_loop,
- ap_str_tolower,
- ap_strcasecmp_match,
- ap_strcmp_match,
- ap_sub_req_lookup_file,
- ap_sub_req_lookup_uri,
- ap_sync_scoreboard_image,
- ap_table_add,
- ap_table_addn,
- ap_table_get,
- ap_table_merge,
- ap_table_mergen,
- ap_table_set,
- ap_table_setn,
- ap_table_unset,
- ap_tm2sec,
- ap_uname2id,
- ap_unblock_alarms,
- ap_unescape_url,
- ap_unparse_uri_components,
- ap_update_mtime,
- ap_uudecode,
- ap_uuencode,
- ap_vbprintf,
- ap_vformatter,
- ap_vsnprintf,
- regcomp,
- regexec,
- regfree,
- access_module,
- alias_module,
- ap_bprintf,
- ap_bvputs,
- ap_day_snames,
- ap_extended_status,
- ap_limit_section,
- ap_loaded_modules,
- ap_log_error,
- ap_log_printf,
- ap_log_rerror,
- ap_month_snames,
- ap_null_cleanup,
- ap_psprintf,
- ap_pstrcat,
- ap_restart_time,
- ap_rprintf,
- ap_rvputs,
- ap_scoreboard_image,
- ap_send_header_field,
- ap_server_argv0,
- ap_server_root,
- ap_set_file_slot,
- ap_set_flag_slot,
- ap_set_string_slot,
- ap_set_string_slot_lower,
- ap_snprintf,
- ap_suexec_enabled,
- ap_table_do,
- apache_main,
- asis_module,
- auth_module,
- autoindex_module,
- config_log_module,
- core_module,
- dir_module,
- env_module,
- imap_module,
- includes_module,
- mime_module,
- negotiation_module,
- setenvif_module,
- so_module,
- top_module,
- ap_fnmatch,
- ap_method_number_of,
- ap_exists_config_define,
- ap_single_module_configure,
- ap_make_etag,
- ap_array_pstrcat,
- ap_find_list_item,
- ap_MD5Encode,
- ap_validate_password,
- ap_size_list_item,
- ap_get_list_item,
- ap_scoreboard_fname,
- ap_pid_fname,
- ap_excess_requests_per_child,
- ap_threads_per_child,
- ap_max_requests_per_child,
- ap_daemons_to_start,
- ap_daemons_min_free,
- ap_daemons_max_free,
- ap_daemons_limit,
- ap_user_name,
- ap_user_id,
- ap_group_id,
- ap_standalone,
- ap_server_confname,
- ap_sub_req_method_uri,
- ap_regerror,
- ap_regexec,
- ap_field_noparam,
- ap_pbase64decode,
- ap_pbase64encode,
- ap_base64encode,
- ap_base64encode_binary,
- ap_base64encode_len,
- ap_base64decode,
- ap_base64decode_binary,
- ap_base64decode_len,
- ap_SHA1Init,
- ap_SHA1Update_binary,
- ap_SHA1Update,
- ap_SHA1Final,
- ap_sha1_base64,
- ap_my_generation,
- ap_get_virthost_addr,
- ap_listeners,
- ap_listenbacklog,
- clean_parent_exit,
- init_tsd,
- ap_set_config_vectors,
- ap_strcasestr,
- ap_to64,
- ap_vrprintf,
- regerror,
- ap_add_file_conf,
- ap_configtestonly,
- ap_is_rdirectory,
- ap_remove_spaces,
- ap_scan_script_header_err_strs,
- ap_start_shutdown,
- ap_start_restart,
- ap_stripprefix,
- ap_send_error_response,
- ap_os_canonical_filename,
- ap_os_http_method,
- os_readdir,
- os_opendir
diff --git a/netware/BisonExtStandard.bat b/netware/BisonExtStandard.bat
deleted file mode 100755
index 1a2e06950a..0000000000
--- a/netware/BisonExtStandard.bat
+++ /dev/null
@@ -1,3 +0,0 @@
-@echo off
-
-bison --output=ext\standard\parsedate.c -v -d -p phplib ext\standard\parsedate.y
diff --git a/netware/BisonFlexZend.bat b/netware/BisonFlexZend.bat
deleted file mode 100755
index 5ed6aa3a18..0000000000
--- a/netware/BisonFlexZend.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-@echo off
-
-bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-REM flex -i -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
-REM flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
diff --git a/netware/ZendEngine2.mak b/netware/ZendEngine2.mak
deleted file mode 100644
index effd309835..0000000000
--- a/netware/ZendEngine2.mak
+++ /dev/null
@@ -1,160 +0,0 @@
-# Temporarily here -- later may go into some batch file
-# which will set this as an environment variable
-PROJECT_ROOT = ..
-
-# Module details
-MODULE_NAME = ZEND
-
-#include the common settings
-include $(PROJECT_ROOT)/netware/common.mif
-
-# Extensions of all input and output files
-.SUFFIXES:
-.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d
-
-C_SRC = zend.c \
- zend_alloc.c \
- zend_API.c \
- zend_builtin_functions.c \
- zend_compile.c \
- zend_constants.c \
- zend_dynamic_array.c \
- zend_execute.c \
- zend_execute_API.c \
- zend_extensions.c \
- zend_hash.c \
- zend_highlight.c \
- zend_indent.c \
- zend_ini.c \
- zend_ini_parser.c \
- zend_ini_scanner.c \
- zend_language_parser.c \
- zend_language_scanner.c \
- zend_list.c \
- zend_llist.c \
- zend_multibyte.c \
- zend_object_handlers.c \
- zend_objects.c \
- zend_opcode.c \
- zend_operators.c \
- zend_ptr_stack.c \
- zend_qsort.c \
- zend_sprintf.c \
- zend_stack.c \
- zend_static_allocator.c \
- zend_ts_hash.c \
- zend_variables.c
-
-
-# Destination directories and files
-OBJ_DIR = $(BUILD)
-FINAL_DIR = $(BUILD)
-OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.obj) $(C_SRC:.c=.obj))
-DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.d) $(C_SRC:.c=.d))
-
-# Binary file
-ifndef BINARY
- BINARY=$(FINAL_DIR)\$(MODULE_NAME).lib
-endif
-
-
-# Compile flags
-C_FLAGS = -c -maxerrors 25 -msgstyle std
-C_FLAGS += -wchar_t on -bool on
-C_FLAGS += -processor Pentium
-C_FLAGS += -nostdinc
-C_FLAGS += -relax_pointers # To remove type-casting errors
-C_FLAGS += -D__C9X_CMATH_INLINES_DEFINED
-C_FLAGS += -DNETWARE -DZTS
-C_FLAGS += -DNEW_LIBC
-C_FLAGS += -DCLIB_STAT_PATCH
-C_FLAGS += -DTHREAD_SWITCH
-
-# These are required to use dlclose so that the PHP extensions are automatically unloaded
-# when apache is unloaded
-C_FLAGS += -DHAVE_DLFCN_H -DHAVE_LIBDL
-
-C_FLAGS += -I. -I- -I../netware -I$(SDK_DIR)/include # ../netware added for special SYS/STAT.H
-C_FLAGS += -I$(MWCIncludes)
-
-
-# Link flags
-LD_FLAGS = -type library
-LD_FLAGS += -o $(BINARY)
-
-
-# Extra stuff based on debug / release builds
-ifeq '$(BUILD)' 'debug'
- C_FLAGS += -DZEND_DEBUG=1
- C_FLAGS += -inline smart -sym on -sym codeview4 -sym internal -opt off -opt intrinsics
- LD_FLAGS += -sym codeview4 -sym internal
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib
-else
- C_FLAGS += -opt speed -inline on -inline auto -sym off
- C_FLAGS += -DZEND_DEBUG=0
- LD_FLAGS += -sym off
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
-endif
-
-
-# Virtual paths
-vpath %.cpp .
-vpath %.c .
-vpath %.obj $(OBJ_DIR)
-
-
-all: prebuild project
-
-.PHONY: all
-
-prebuild:
- @if not exist $(OBJ_DIR) md $(OBJ_DIR)
-
-project: $(BINARY) $(MESSAGE)
- @echo Build complete.
-
-
-$(OBJ_DIR)/%.d: %.c
- @echo Building Dependencies for $(<F)
- @$(CC) -M $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.obj: %.c
- @echo Compiling $?...
- @$(CC) $< $(C_FLAGS) -o $@
-
-
-$(BINARY): $(OBJECTS)
- @echo Linking $@...
- @$(LINK) $(LD_FLAGS) $(OBJECTS)
-
-
-.PHONY: clean
-clean: cleansrc cleanobj cleanbin
-
-.PHONY: cleansrc
-cleansrc:
- @echo Deleting all generated source files...
- -@del "zend_ini_parser.c"
- -@del "zend_ini_parser.h"
- -@del "zend_ini_scanner.c"
- -@del "zend_language_parser.c"
- -@del "zend_language_parser.h"
- -@del "zend_language_scanner.c"
- -@del "zend_ini_parser.output"
- -@del "zend_language_parser.output"
-
-
-.PHONY: cleand
-cleand:
- @echo Deleting all dependency files...
- -@del "$(OBJ_DIR)\*.d"
-
-.PHONY: cleanobj
-cleanobj:
- @echo Deleting all object files...
- -@del "$(OBJ_DIR)\*.obj"
-
-.PHONY: cleanbin
-cleanbin:
- @echo Deleting binary files...
- -@del "$(FINAL_DIR)\$(MODULE_NAME).lib"
diff --git a/netware/build.bat b/netware/build.bat
deleted file mode 100755
index 5c8e310a53..0000000000
--- a/netware/build.bat
+++ /dev/null
@@ -1,21 +0,0 @@
-@echo off
-
-cd ..\%1
-
-if "%2" == "clean" make -f ..\netware\%1.mak clean
-if "%2" == "/?" goto USAGE
-
-if "%1" == "zend" call ..\netware\BisonFlexZend
-if "%1" == "ZendEngine2" call ..\netware\BisonFlexZend
-
-REM Build command
-make -f ..\netware\%1.mak
-goto EXIT
-
-:USAGE
- @echo on
- @echo Usage: build moduleName [clean]
- @echo clean - delete all object files and binaries before building
-
-:EXIT
-cd ..\netware \ No newline at end of file
diff --git a/netware/buildext.bat b/netware/buildext.bat
deleted file mode 100755
index 6cea5530cc..0000000000
--- a/netware/buildext.bat
+++ /dev/null
@@ -1,18 +0,0 @@
-@echo off
-
-cd ..\ext\%1
-
-if "%2" == "clean" make -f %1.mak clean
-if "%2" == "/?" goto USAGE
-
-REM Build command
-make -f %1.mak
-goto EXIT
-
-:USAGE
- @echo on
- @echo Usage: buildext extension_name [clean]
- @echo clean - delete all object files and binaries before building
-
-:EXIT
-cd ..\..\netware
diff --git a/netware/buildlib.bat b/netware/buildlib.bat
deleted file mode 100755
index 5abd71229d..0000000000
--- a/netware/buildlib.bat
+++ /dev/null
@@ -1,20 +0,0 @@
-@echo off
-
-cd ..
-
-if "%1" == "clean" make -f netware\phplib.mak clean
-if "%1" == "/?" goto USAGE
-
-call netware\BisonExtStandard
-
-REM Build command
-make -f netware\phplib.mak
-goto EXIT
-
-:USAGE
- @echo on
- @echo Usage: buildlib [clean]
- @echo clean - delete all object files and binaries before building
-
-:EXIT
-cd netware \ No newline at end of file
diff --git a/netware/buildsapi.bat b/netware/buildsapi.bat
deleted file mode 100755
index 57498cbf89..0000000000
--- a/netware/buildsapi.bat
+++ /dev/null
@@ -1,18 +0,0 @@
-@echo off
-
-cd ..\sapi\%1
-
-if "%2" == "clean" make -f ..\..\netware\php4%1.mak clean
-if "%2" == "/?" goto USAGE
-
-REM Build command
-make -f ..\..\netware\php4%1.mak
-goto EXIT
-
-:USAGE
- @echo on
- @echo Usage: buildsapi SAPI_Module_Name [clean]
- @echo clean - delete all object files and binaries before building
-
-:EXIT
-cd ..\..\netware
diff --git a/netware/common.mif b/netware/common.mif
deleted file mode 100644
index a2250e3b8c..0000000000
--- a/netware/common.mif
+++ /dev/null
@@ -1,90 +0,0 @@
-#
-# Common include file for PHP build.
-# Include this in every make file.
-#
-
-
-# Set following directories based on your setting
-
-# Path to CodeWarrior installation
-CW_PATH = P:/APPS/SCRIPT/SW/CW71-4
-
-# LibC directory
-ifndef SDK_DIR
-SDK_DIR = P:/APPS/script/sw/libc
-endif
-
-# MPK related directory
-ifndef MPK_DIR
-MPK_DIR = p:/apps/script/mpk
-XDCTOOL = mpkxdc
-MPKTOOL = $(MPK_DIR)/$(XDCTOOL)
-XDCFLAGS = -n
-endif
-
-# Winsock stuff
-WINSOCK_DIR = P:/APPS/script/sw/Winsock2
-
-# LDAP stuff
-LDAP_DIR = P:/APPS/script/sw/cldapsdk
-
-# XML-EXPAT stuff
-EXPAT_DIR = P:/APPS/script/sw/expat
-
-
-# Web Server defaults to Apache 1.3.x
-ifndef APACHE_VER
-APACHE_VER = 1.3
-endif
-
-# Apache directory
-ifeq '$(APACHE_VER)' '1.3'
-APACHE_DIR = P:/APPS/script/sw/Apache1.3.xSource
-else
-APACHE_DIR = P:/APPS/script/sw/Apache2Source
-endif
-
-
-# CW includes, libraries and tools
-export MWCIncludes=$(CW_PATH)/include
-export MWLibraries=$(CW_PATH)/lib
-
-# Compiler and linker tools
-CC = mwccnlm
-LINK = mwldnlm
-
-# Build type defaults to 'release'
-ifndef BUILD
-BUILD = release
-endif
-
-OBJ_DIR = $(BUILD)
-FINAL_DIR = $(BUILD)
-MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map
-
-ifndef STACK_SIZE
-STACK_SIZE=65536
-endif
-
-ifndef COPYRIGHT
-COPYRIGHT = "Copyright (C) 2002-2003 Novell\, Inc. All Rights Reserved."
-endif
-
-
-# Compile flags
-ifeq '$(APACHE_VER)' '1.3'
-C_FLAGS = -align 1
-C_FLAGS += -DCLIB_STAT_PATCH
-else
-C_FLAGS = -align 4
-endif
-
-# Link flags
-LD_FLAGS = -stacksize $(STACK_SIZE) -type generic -zerobss
-LD_FLAGS += -o $(BINARY) -map $(MAP_FILE) -nlmversion $(VMAJ),$(VMIN),$(VREV)
-
-# Module details
-LD_FLAGS += -desc $(MODULE_DESC)
-LD_FLAGS += -copy $(COPYRIGHT)
-LD_FLAGS += -screenname Default
-LD_FLAGS += -threadname $(MODULE_NAME)__p
diff --git a/netware/geterrnoptr.c b/netware/geterrnoptr.c
deleted file mode 100644
index 065d33e84d..0000000000
--- a/netware/geterrnoptr.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Moved into a separate source file -- can be eliminated later */
-
-#include <errno.h>
-
-int *__get_errno_ptr(void)
-{
- return ___errno();
-}
-
diff --git a/netware/grp.h b/netware/grp.h
deleted file mode 100644
index e7a99327e2..0000000000
--- a/netware/grp.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* pwd.h - Try to approximate UN*X's getuser...() functions under MS-DOS.
- Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Header$
- */
-
-/* This 'implementation' is conjectured from the use of this functions in
- the RCS and BASH distributions. Of course these functions don't do too
- much useful things under MS-DOS, but using them avoids many "#ifdef
- MSDOS" in ported UN*X code ... */
-
-struct group {
- char *gr_name; /* group name */
- char *gr_passwd; /* group password */
- int gr_gid; /* group id */
- char **gr_mem; /* group members */
-};
diff --git a/netware/libpq-fe.h b/netware/libpq-fe.h
deleted file mode 100644
index 879a447091..0000000000
--- a/netware/libpq-fe.h
+++ /dev/null
@@ -1,378 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * libpq-fe.h
- * This file contains definitions for structures and
- * externs for functions used by frontend postgres applications.
- *
- * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * $Id$
- *
- *-------------------------------------------------------------------------
- */
-
-#ifndef LIBPQ_FE_H
-#define LIBPQ_FE_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include <stdio.h>
-
-/*
- * postgres_ext.h defines the backend's externally visible types,
- * such as Oid.
- */
-#include "postgres_ext.h"
-
-/* SSL type is needed here only to declare PQgetssl() */
-#ifdef USE_SSL
-#include <openssl/ssl.h>
-#endif
-
-/* Application-visible enum types */
-
-typedef enum
-{
- /*
- * Although you may decide to change this list in some way, values
- * which become unused should never be removed, nor should constants
- * be redefined - that would break compatibility with existing code.
- */
- CONNECTION_OK,
- CONNECTION_BAD,
- /* Non-blocking mode only below here */
-
- /*
- * The existence of these should never be relied upon - they should
- * only be used for user feedback or similar purposes.
- */
- CONNECTION_STARTED, /* Waiting for connection to be made. */
- CONNECTION_MADE, /* Connection OK; waiting to send. */
- CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the
- * postmaster. */
- CONNECTION_AUTH_OK, /* Received authentication; waiting for
- * backend startup. */
- CONNECTION_SETENV /* Negotiating environment. */
-} ConnStatusType;
-
-typedef enum
-{
- PGRES_POLLING_FAILED = 0,
- PGRES_POLLING_READING, /* These two indicate that one may */
- PGRES_POLLING_WRITING, /* use select before polling again. */
- PGRES_POLLING_OK,
- PGRES_POLLING_ACTIVE /* Can call poll function immediately. */
-} PostgresPollingStatusType;
-
-typedef enum
-{
- PGRES_EMPTY_QUERY = 0,
- PGRES_COMMAND_OK, /* a query command that doesn't return
- * anything was executed properly by the
- * backend */
- PGRES_TUPLES_OK, /* a query command that returns tuples was
- * executed properly by the backend,
- * PGresult contains the result tuples */
- PGRES_COPY_OUT, /* Copy Out data transfer in progress */
- PGRES_COPY_IN, /* Copy In data transfer in progress */
- PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from
- * the backend */
- PGRES_NONFATAL_ERROR,
- PGRES_FATAL_ERROR
-} ExecStatusType;
-
-/* PGconn encapsulates a connection to the backend.
- * The contents of this struct are not supposed to be known to applications.
- */
-typedef struct pg_conn PGconn;
-
-/* PGresult encapsulates the result of a query (or more precisely, of a single
- * SQL command --- a query string given to PQsendQuery can contain multiple
- * commands and thus return multiple PGresult objects).
- * The contents of this struct are not supposed to be known to applications.
- */
-typedef struct pg_result PGresult;
-
-/* PGnotify represents the occurrence of a NOTIFY message.
- * Ideally this would be an opaque typedef, but it's so simple that it's
- * unlikely to change.
- * NOTE: in Postgres 6.4 and later, the be_pid is the notifying backend's,
- * whereas in earlier versions it was always your own backend's PID.
- */
-typedef struct pgNotify
-{
- char relname[NAMEDATALEN]; /* name of relation containing
- * data */
- int be_pid; /* process id of backend */
-} PGnotify;
-
-/* PQnoticeProcessor is the function type for the notice-message callback.
- */
-typedef void (*PQnoticeProcessor) (void *arg, const char *message);
-
-/* Print options for PQprint() */
-typedef char pqbool;
-
-typedef struct _PQprintOpt
-{
- pqbool header; /* print output field headings and row
- * count */
- pqbool align; /* fill align the fields */
- pqbool standard; /* old brain dead format */
- pqbool html3; /* output html tables */
- pqbool expanded; /* expand tables */
- pqbool pager; /* use pager for output if needed */
- char *fieldSep; /* field separator */
- char *tableOpt; /* insert to HTML <table ...> */
- char *caption; /* HTML <caption> */
- char **fieldName; /* null terminated array of repalcement
- * field names */
-} PQprintOpt;
-
-/* ----------------
- * Structure for the conninfo parameter definitions returned by PQconndefaults
- *
- * All fields except "val" point at static strings which must not be altered.
- * "val" is either NULL or a malloc'd current-value string. PQconninfoFree()
- * will release both the val strings and the PQconninfoOption array itself.
- * ----------------
- */
-typedef struct _PQconninfoOption
-{
- char *keyword; /* The keyword of the option */
- char *envvar; /* Fallback environment variable name */
- char *compiled; /* Fallback compiled in default value */
- char *val; /* Option's current value, or NULL */
- char *label; /* Label for field in connect dialog */
- char *dispchar; /* Character to display for this field in
- * a connect dialog. Values are: ""
- * Display entered value as is "*"
- * Password field - hide value "D" Debug
- * option - don't show by default */
- int dispsize; /* Field size in characters for dialog */
-} PQconninfoOption;
-
-/* ----------------
- * PQArgBlock -- structure for PQfn() arguments
- * ----------------
- */
-typedef struct
-{
- int len;
- int isint;
- union
- {
- int *ptr; /* can't use void (dec compiler barfs) */
- int integer;
- } u;
-} PQArgBlock;
-
-/* ----------------
- * Exported functions of libpq
- * ----------------
- */
-
-/* === in fe-connect.c === */
-
-/* make a new client connection to the backend */
-/* Asynchronous (non-blocking) */
-extern PGconn *PQconnectStart(const char *conninfo);
-extern PostgresPollingStatusType PQconnectPoll(PGconn *conn);
-
-/* Synchronous (blocking) */
-extern PGconn *PQconnectdb(const char *conninfo);
-extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport,
- const char *pgoptions, const char *pgtty,
- const char *dbName,
- const char *login, const char *pwd);
-
-#define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) \
- PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL)
-
-/* close the current connection and free the PGconn data structure */
-extern void PQfinish(PGconn *conn);
-
-/* get info about connection options known to PQconnectdb */
-extern PQconninfoOption *PQconndefaults(void);
-
-/* free the data structure returned by PQconndefaults() */
-extern void PQconninfoFree(PQconninfoOption *connOptions);
-
-/*
- * close the current connection and restablish a new one with the same
- * parameters
- */
-/* Asynchronous (non-blocking) */
-extern int PQresetStart(PGconn *conn);
-extern PostgresPollingStatusType PQresetPoll(PGconn *conn);
-
-/* Synchronous (blocking) */
-extern void PQreset(PGconn *conn);
-
-/* issue a cancel request */
-extern int PQrequestCancel(PGconn *conn);
-
-/* Accessor functions for PGconn objects */
-extern char *PQdb(const PGconn *conn);
-extern char *PQuser(const PGconn *conn);
-extern char *PQpass(const PGconn *conn);
-extern char *PQhost(const PGconn *conn);
-extern char *PQport(const PGconn *conn);
-extern char *PQtty(const PGconn *conn);
-extern char *PQoptions(const PGconn *conn);
-extern ConnStatusType PQstatus(const PGconn *conn);
-extern char *PQerrorMessage(const PGconn *conn);
-extern int PQsocket(const PGconn *conn);
-extern int PQbackendPID(const PGconn *conn);
-extern int PQclientEncoding(const PGconn *conn);
-extern int PQsetClientEncoding(PGconn *conn, const char *encoding);
-
-#ifdef USE_SSL
-/* Get the SSL structure associated with a connection */
-extern SSL *PQgetssl(PGconn *conn);
-#endif
-
-
-/* Enable/disable tracing */
-extern void PQtrace(PGconn *conn, FILE *debug_port);
-extern void PQuntrace(PGconn *conn);
-
-/* Override default notice processor */
-extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn,
- PQnoticeProcessor proc,
- void *arg);
-
-/* === in fe-exec.c === */
-
-/* Quoting strings before inclusion in queries. */
-extern size_t PQescapeString(char *to, const char *from, size_t length);
-extern unsigned char *PQescapeBytea(unsigned char *bintext, size_t binlen,
- size_t *bytealen);
-
-/* Simple synchronous query */
-extern PGresult *PQexec(PGconn *conn, const char *query);
-extern PGnotify *PQnotifies(PGconn *conn);
-extern void PQfreeNotify(PGnotify *notify);
-
-/* Interface for multiple-result or asynchronous queries */
-extern int PQsendQuery(PGconn *conn, const char *query);
-extern PGresult *PQgetResult(PGconn *conn);
-
-/* Routines for managing an asychronous query */
-extern int PQisBusy(PGconn *conn);
-extern int PQconsumeInput(PGconn *conn);
-
-/* Routines for copy in/out */
-extern int PQgetline(PGconn *conn, char *string, int length);
-extern int PQputline(PGconn *conn, const char *string);
-extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize);
-extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes);
-extern int PQendcopy(PGconn *conn);
-
-/* Set blocking/nonblocking connection to the backend */
-extern int PQsetnonblocking(PGconn *conn, int arg);
-extern int PQisnonblocking(const PGconn *conn);
-
-/* Force the write buffer to be written (or at least try) */
-extern int PQflush(PGconn *conn);
-
-/*
- * "Fast path" interface --- not really recommended for application
- * use
- */
-extern PGresult *PQfn(PGconn *conn,
- int fnid,
- int *result_buf,
- int *result_len,
- int result_is_int,
- const PQArgBlock *args,
- int nargs);
-
-/* Accessor functions for PGresult objects */
-extern ExecStatusType PQresultStatus(const PGresult *res);
-extern char *PQresStatus(ExecStatusType status);
-extern char *PQresultErrorMessage(const PGresult *res);
-extern int PQntuples(const PGresult *res);
-extern int PQnfields(const PGresult *res);
-extern int PQbinaryTuples(const PGresult *res);
-extern char *PQfname(const PGresult *res, int field_num);
-extern int PQfnumber(const PGresult *res, const char *field_name);
-extern Oid PQftype(const PGresult *res, int field_num);
-extern int PQfsize(const PGresult *res, int field_num);
-extern int PQfmod(const PGresult *res, int field_num);
-extern char *PQcmdStatus(PGresult *res);
-extern char *PQoidStatus(const PGresult *res); /* old and ugly */
-extern Oid PQoidValue(const PGresult *res); /* new and improved */
-extern char *PQcmdTuples(PGresult *res);
-extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num);
-extern int PQgetlength(const PGresult *res, int tup_num, int field_num);
-extern int PQgetisnull(const PGresult *res, int tup_num, int field_num);
-
-/* Delete a PGresult */
-extern void PQclear(PGresult *res);
-
-/*
- * Make an empty PGresult with given status (some apps find this
- * useful). If conn is not NULL and status indicates an error, the
- * conn's errorMessage is copied.
- */
-extern PGresult *PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status);
-
-/* === in fe-print.c === */
-
-extern void
-PQprint(FILE *fout, /* output stream */
- const PGresult *res,
- const PQprintOpt *ps); /* option structure */
-
-/*
- * really old printing routines
- */
-extern void
-PQdisplayTuples(const PGresult *res,
- FILE *fp, /* where to send the output */
- int fillAlign, /* pad the fields with spaces */
- const char *fieldSep, /* field separator */
- int printHeader, /* display headers? */
- int quiet);
-
-extern void
-PQprintTuples(const PGresult *res,
- FILE *fout, /* output stream */
- int printAttName, /* print attribute names */
- int terseOutput, /* delimiter bars */
- int width); /* width of column, if 0, use variable
- * width */
-
-
-/* === in fe-lobj.c === */
-
-/* Large-object access routines */
-extern int lo_open(PGconn *conn, Oid lobjId, int mode);
-extern int lo_close(PGconn *conn, int fd);
-extern int lo_read(PGconn *conn, int fd, char *buf, size_t len);
-extern int lo_write(PGconn *conn, int fd, char *buf, size_t len);
-extern int lo_lseek(PGconn *conn, int fd, int offset, int whence);
-extern Oid lo_creat(PGconn *conn, int mode);
-extern int lo_tell(PGconn *conn, int fd);
-extern int lo_unlink(PGconn *conn, Oid lobjId);
-extern Oid lo_import(PGconn *conn, const char *filename);
-extern int lo_export(PGconn *conn, Oid lobjId, const char *filename);
-
-/* === in fe-misc.c === */
-
-/* Determine length of multibyte encoded char at *s */
-extern int PQmblen(const unsigned char *s, int encoding);
-
-/* Get encoding id from environment variable PGCLIENTENCODING */
-extern int PQenv2encoding(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBPQ_FE_H */
diff --git a/netware/libpq.imp b/netware/libpq.imp
deleted file mode 100644
index 922679f07e..0000000000
--- a/netware/libpq.imp
+++ /dev/null
@@ -1,93 +0,0 @@
- lo_open,
- lo_close,
- lo_read,
- lo_write,
- lo_lseek,
- lo_creat,
- lo_tell,
- lo_unlink,
- lo_import,
- lo_export,
- PQconnectdb,
- PQconnectStart,
- PQconndefaults,
- PQsetdbLogin,
- PQconnectPoll,
- PQfinish,
- PQreset,
- PQresetStart,
- PQresetPoll,
- PQrequestCancel,
- PQconninfoFree,
- PQdb,
- PQuser,
- PQpass,
- PQhost,
- PQport,
- PQtty,
- PQoptions,
- PQstatus,
- PQerrorMessage,
- PQsocket,
- PQbackendPID,
- PQclientEncoding,
- PQsetClientEncoding,
- PQtrace,
- PQuntrace,
- PQsetNoticeProcessor,
- PQmakeEmptyPGresult,
- PQclear,
- PQsendQuery,
- PQconsumeInput,
- PQisBusy,
- PQgetResult,
- PQexec,
- PQnotifies,
- PQgetline,
- PQgetlineAsync,
- PQputline,
- PQputnbytes,
- PQendcopy,
- PQfn,
- PQresultStatus,
- PQresStatus,
- PQresultErrorMessage,
- PQntuples,
- PQnfields,
- PQbinaryTuples,
- PQfname,
- PQfnumber,
- PQftype,
- PQfsize,
- PQfmod,
- PQcmdStatus,
- PQoidStatus,
- PQoidValue,
- PQcmdTuples,
- PQgetvalue,
- PQgetlength,
- PQgetisnull,
- PQsetnonblocking,
- PQisnonblocking,
- PQflush,
- PQmblen,
- PQenv2encoding,
- PQprint,
- PQdisplayTuples,
- PQprintTuples,
- pg_valid_client_encoding,
- pg_valid_server_encoding,
- pg_char_to_encname_struct,
- pg_char_to_encoding,
- pg_encoding_to_char,
- createPQExpBuffer,
- initPQExpBuffer,
- destroyPQExpBuffer,
- termPQExpBuffer,
- resetPQExpBuffer,
- enlargePQExpBuffer,
- printfPQExpBuffer,
- appendPQExpBuffer,
- appendPQExpBufferStr,
- appendPQExpBufferChar,
- appendBinaryPQExpBuffer
diff --git a/netware/libpq/libpq-fs.h b/netware/libpq/libpq-fs.h
deleted file mode 100644
index d743618895..0000000000
--- a/netware/libpq/libpq-fs.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * libpq-fs.h
- * definitions for using Inversion file system routines (ie, large objects)
- *
- *
- * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * $Id$
- *
- *-------------------------------------------------------------------------
- */
-#ifndef LIBPQ_FS_H
-#define LIBPQ_FS_H
-
-/*
- * Read/write mode flags for inversion (large object) calls
- */
-
-#define INV_WRITE 0x00020000
-#define INV_READ 0x00040000
-
-#endif /* LIBPQ_FS_H */
diff --git a/netware/mktemp.c b/netware/mktemp.c
deleted file mode 100644
index b6d8e92593..0000000000
--- a/netware/mktemp.c
+++ /dev/null
@@ -1,87 +0,0 @@
-
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-
-/* Based on standard ANSI C mktemp() for NetWare */
-char* mktemp(char* templateStr)
-{
- char* pXs = NULL;
- char numBuf[50] = {'\0'};
- int count = 0;
- char* pPid = NULL;
-
- char termChar = '\0';
- char letter = 'a';
- char letter1 = 'a';
-
- if (templateStr && (pXs = strstr(templateStr, "XXXXXX")))
- {
- /* Generate temp name */
- termChar = pXs[6];
- ltoa(NXThreadGetId(), numBuf, 16);
- numBuf[strlen(numBuf)-1] = '\0';
-
- /*
- Beware! thread IDs are 8 hex digits on NW 4.11 and only the
- lower digits seem to change, whereas on NW 5 they are in the
- range of < 1000 hex or 3 hex digits in length. So the following
- logic ensures we use the least significant portion of the number.\
- */
- if (strlen(numBuf) > 5)
- pPid = &numBuf[strlen(numBuf)-5];
- else
- pPid = numBuf;
-
- /*
- Temporary files, as the name suggests, are temporarily used and then
- cleaned up after usage. In the case of complex scripts, new temp files
- may be created before the old ones are deleted. So, we need to have
- a provision to create many temp files. It is found that provision for
- 26 files may not be enough in such cases. Hence the logic below.
-
- The logic below allows 26 files (like, pla00015.tmp through plz00015.tmp)
- plus 6x26=676 (like, plaa0015.tmp through plzz0015.tmp)
- */
- letter = 'a';
- do
- {
- sprintf(pXs, (char *)"%c%05.5s", letter, pPid);
- pXs[6] = termChar;
-
- if (access(templateStr, 0) != 0)
- return templateStr; /* File does not exist */
-
- letter++;
- } while (letter <= 'z');
-
- letter1 = 'a';
- do
- {
- letter = 'a';
-
- do
- {
- sprintf(pXs, (char *)"%c%c%04.5s", letter1, letter, pPid);
- pXs[6] = termChar;
-
- if (access(templateStr, 0) != 0)
- return templateStr; /* File does not exist */
-
- letter++;
- } while (letter <= 'z');
-
- letter1++;
- } while (letter1 <= 'z');
-
- errno = ENOENT;
- return NULL;
- }
- else
- {
- errno = EINVAL;
- return NULL;
- }
-}
-
diff --git a/netware/mktemp.h b/netware/mktemp.h
deleted file mode 100644
index b370438246..0000000000
--- a/netware/mktemp.h
+++ /dev/null
@@ -1 +0,0 @@
-char* mktemp(char* templateStr);
diff --git a/netware/param.h b/netware/param.h
deleted file mode 100644
index aa879d035f..0000000000
--- a/netware/param.h
+++ /dev/null
@@ -1,20 +0,0 @@
-
-/*****************************************************************************
- * *
- * sys/param.c *
- * *
- * Freely redistributable and modifiable. Use at your own risk. *
- * *
- * Copyright 1994 The Downhill Project *
- * *
- *****************************************************************************/
-#ifndef MAXPATHLEN
-/*#define MAXPATHLEN _MAX_PATH*/
-#define MAXPATHLEN 260 /* _MAX_PATH defined in STDLIB.H for Windows; picked up the value from there */
-#define _MAX_PATH 260 /* Defined since it is used in os.c while compiling apache */
-#endif
-#define MAXHOSTNAMELEN 64
-#define howmany(x,y) (((x)+((y)-1))/(y))
-#define roundup(x,y) ((((x)+((y)-1))/(y))*(y))
-
-#define _MAX_VOLUME 31 /* Defined since it is used in os.c while compiling apache. The value picked up from LibC */
diff --git a/netware/php-nw.bat b/netware/php-nw.bat
deleted file mode 100755
index 3d2b59d8a8..0000000000
--- a/netware/php-nw.bat
+++ /dev/null
@@ -1,10 +0,0 @@
-@echo off
-
-REM CodeWarrior stuff
-set path=%path%;P:\APPS\SCRIPT\SW\CW71-4\BIN
-
-REM Tools for building Zend
-set path=%path%;P:\APPS\SCRIPT\SW\GNUWIN32\BIN
-
-REM Build options
-setbuild r 1
diff --git a/netware/php4apache.mak b/netware/php4apache.mak
deleted file mode 100644
index 5573941b43..0000000000
--- a/netware/php4apache.mak
+++ /dev/null
@@ -1,165 +0,0 @@
-# Temporarily here -- later may go into some batch file
-# which will set this as an environment variable
-PROJECT_ROOT = ../..
-
-# Module details
-MODULE_NAME = mod_php
-MODULE_DESC = "PHP 4.3 - Apache 1.3 Module"
-VMAJ = 3
-VMIN = 0
-VREV = 0
-
-#include the common settings
-include $(PROJECT_ROOT)/netware/common.mif
-
-# Extensions of all input and output files
-.SUFFIXES:
-.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d
-
-# Source files
-C_SRC = mod_php4.c \
- php_apache.c \
- sapi_apache.c \
- libpre.c
-
-# Destination directories and files
-OBJ_DIR = $(BUILD)
-FINAL_DIR = $(BUILD)
-MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map
-OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.obj) $(C_SRC:.c=.obj))
-DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.d) $(C_SRC:.c=.d))
-
-# Binary file
-ifndef BINARY
-BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm
-endif
-
-
-# Compile flags
-C_FLAGS = -c -maxerrors 25 -msgstyle gcc
-C_FLAGS += -wchar_t on -bool on
-C_FLAGS += -processor Pentium
-C_FLAGS += -w nounusedarg -msext on
-C_FLAGS += -nostdinc
-C_FLAGS += -relax_pointers # To remove type-casting errors
-C_FLAGS += -DNETWARE
-C_FLAGS += -DZTS
-C_FLAGS += -DNLM_PLATFORM
-C_FLAGS += -DN_PLAT_NLM -DNLM=1 -D__NO_MATH_OPS
-C_FLAGS += -D__C9X_CMATH_INLINES_DEFINED -DAPACHE_OS_H -DNO_USE_SIGACTION -DMULTITHREAD
-C_FLAGS += -DCLIB_STAT_PATCH
-C_FLAGS += -DNEW_LIBC
-C_FLAGS += -I. -I- -I. -I../../netware -I$(SDK_DIR)/include # ../../netware added for special SYS/STAT.H
-C_FLAGS += -I$(MWCIncludes)
-C_FLAGS += -I$(APACHE_DIR)/include -I$(APACHE_DIR)/os/netware
-C_FLAGS += -I- -I../../main -I../../Zend -I../../TSRM -I../../ext/standard
-C_FLAGS += -I../../ -I../../netware -I$(PROJECT_ROOT)/regex
-C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include
-
-
-# Extra stuff based on debug / release builds
-ifeq '$(BUILD)' 'debug'
- SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym
- C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -sym internal -DDEBUGGING -DDKFBPON
- C_FLAGS += -r -DZEND_DEBUG=1
- C_FLAGS += -exc cw
- LD_FLAGS += -sym on -sym codeview4 -sym internal -osym $(SYM_FILE)
- LD_FLAGS += -msgstyle std
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib
-else
- C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off -DZEND_DEBUG=0
- C_FLAGS += -opt intrinsics
- C_FLAGS += -opt level=4
- LD_FLAGS += -sym off
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
-endif
-
-# Dependencies
-MODULE = LibC \
- phplib
-IMPORT = @$(SDK_DIR)/imports/libc.imp \
- @$(PROJECT_ROOT)/netware/apachecore.imp \
- @$(PROJECT_ROOT)/netware/phplib.imp
-EXPORT = php4_module
-
-
-# Virtual paths
-vpath %.cpp .
-vpath %.c .
-vpath %.obj $(OBJ_DIR)
-
-
-all: prebuild project
-
-.PHONY: all
-
-prebuild:
- @if not exist $(OBJ_DIR) md $(OBJ_DIR)
-
-project: $(BINARY) $(MESSAGE)
- @echo Build complete.
-
-
-$(OBJ_DIR)/%.d: %.c
- @echo Building Dependencies for $(<F)
- @$(CC) -M $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.obj: %.c
- @echo Compiling $?...
- @$(CC) $< $(C_FLAGS) -o $@
-
-
-$(BINARY): $(OBJECTS)
- @echo Import $(IMPORT) > $(basename $@).def
-ifdef API
- @echo Import $(API) >> $(basename $@).def
-endif
- @echo Module $(MODULE) >> $(basename $@).def
-ifdef EXPORT
- @echo Export $(EXPORT) >> $(basename $@).def
-endif
- @echo AutoUnload >> $(basename $@).def
-ifeq '$(BUILD)' 'debug'
- @echo Debug >> $(basename $@).def
-endif
- @echo Flag_On 0x00000008 >> $(basename $@).def
- @echo Start _lib_start >> $(basename $@).def
- @echo Exit _lib_stop >> $(basename $@).def
-
- $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc
- @echo xdcdata $(basename $@).xdc >> $(basename $@).def
-
- @echo Linking $@...
- @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link
-ifdef LIBRARY
- @echo $(LIBRARY) >> $(basename $@).link
-endif
- @echo $(OBJECTS) >> $(basename $@).link
-
- @$(LINK) @$(basename $@).link
-
-
-.PHONY: clean
-clean: cleanobj cleanbin
-
-.PHONY: cleand
-cleand:
- @echo Deleting all dependency files...
- -@del "$(OBJ_DIR)\*.d"
-
-.PHONY: cleanobj
-cleanobj:
- @echo Deleting all object files...
- -@del "$(OBJ_DIR)\*.obj"
-
-.PHONY: cleanbin
-cleanbin:
- @echo Deleting binary files...
- -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm"
- @echo Deleting MAP, DEF files, etc....
- -@del "$(FINAL_DIR)\$(MODULE_NAME).map"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).def"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).link"
-ifeq '$(BUILD)' 'debug'
- -@del $(FINAL_DIR)\$(MODULE_NAME).sym
-endif
diff --git a/netware/php4apache2filter.mak b/netware/php4apache2filter.mak
deleted file mode 100644
index 99e8e24534..0000000000
--- a/netware/php4apache2filter.mak
+++ /dev/null
@@ -1,166 +0,0 @@
-# Temporarily here -- later may go into some batch file
-# which will set this as an environment variable
-PROJECT_ROOT = ../..
-
-# Module details
-MODULE_NAME = mod_php
-MODULE_DESC = "PHP 4.3 - Apache 2.0 Module"
-VMAJ = 3
-VMIN = 0
-VREV = 0
-
-#include the common settings
-include $(PROJECT_ROOT)/netware/common.mif
-
-# Extensions of all input and output files
-.SUFFIXES:
-.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d
-
-# Source files
-C_SRC = apache_config.c \
- php_functions.c \
- sapi_apache2.c
-
-# Destination directories and files
-OBJ_DIR = $(BUILD)
-FINAL_DIR = $(BUILD)
-MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map
-OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.obj) $(C_SRC:.c=.obj))
-DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.d) $(C_SRC:.c=.d))
-
-# Binary file
-ifndef BINARY
-BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm
-endif
-
-
-# Compile flags
-C_FLAGS += -c -maxerrors 25 -msgstyle gcc
-C_FLAGS += -wchar_t on -bool on
-C_FLAGS += -processor Pentium
-C_FLAGS += -w nounusedarg -msext on
-C_FLAGS += -nostdinc
-C_FLAGS += -relax_pointers # To remove type-casting errors
-C_FLAGS += -DNETWARE
-C_FLAGS += -DZTS
-C_FLAGS += -DNLM_PLATFORM
-C_FLAGS += -DN_PLAT_NLM -DNLM=1 -D__NO_MATH_OPS
-C_FLAGS += -D__C9X_CMATH_INLINES_DEFINED -DAPACHE_OS_H -DNO_USE_SIGACTION -DMULTITHREAD
-C_FLAGS += -DCLIB_STAT_PATCH
-C_FLAGS += -DNEW_LIBC
-C_FLAGS += -I. -I- -I. -I../../netware -I$(SDK_DIR)/include # ../../netware added for special SYS/STAT.H
-C_FLAGS += -I$(SDK_DIR)/include/winsock # For Apache 2.0 headers
-C_FLAGS += -I$(MWCIncludes)
-C_FLAGS += -I$(APACHE_DIR)/include
-C_FLAGS += -I- -I../../main -I../../Zend -I../../TSRM -I../../ext/standard
-C_FLAGS += -I../../ -I../../netware -I$(PROJECT_ROOT)/regex
-C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include
-
-
-# Extra stuff based on debug / release builds
-ifeq '$(BUILD)' 'debug'
- SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym
- C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -sym internal -DDEBUGGING -DDKFBPON
- C_FLAGS += -r -DZEND_DEBUG=1
- C_FLAGS += -exc cw
- LD_FLAGS += -sym on -sym codeview4 -sym internal -osym $(SYM_FILE)
- LD_FLAGS += -msgstyle std
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib
-else
- C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off -DZEND_DEBUG=0
- C_FLAGS += -opt intrinsics
- C_FLAGS += -opt level=4
- LD_FLAGS += -sym off
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
-endif
-
-# Dependencies
-MODULE = LibC \
- phplib
-IMPORT = @$(SDK_DIR)/imports/libc.imp \
- @$(APACHE_DIR)/lib/httpd.imp \
- @$(APACHE_DIR)/lib/aprlib.imp \
- @$(PROJECT_ROOT)/netware/phplib.imp
-EXPORT = php4_module
-
-
-# Virtual paths
-vpath %.cpp .
-vpath %.c .
-vpath %.obj $(OBJ_DIR)
-
-
-all: prebuild project
-
-.PHONY: all
-
-prebuild:
- @if not exist $(OBJ_DIR) md $(OBJ_DIR)
-
-project: $(BINARY) $(MESSAGE)
- @echo Build complete.
-
-
-$(OBJ_DIR)/%.d: %.c
- @echo Building Dependencies for $(<F)
- @$(CC) -M $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.obj: %.c
- @echo Compiling $?...
- @$(CC) $< $(C_FLAGS) -o $@
-
-
-$(BINARY): $(OBJECTS)
- @echo Import $(IMPORT) > $(basename $@).def
-ifdef API
- @echo Import $(API) >> $(basename $@).def
-endif
- @echo Module $(MODULE) >> $(basename $@).def
-ifdef EXPORT
- @echo Export $(EXPORT) >> $(basename $@).def
-endif
- @echo AutoUnload >> $(basename $@).def
-ifeq '$(BUILD)' 'debug'
- @echo Debug >> $(basename $@).def
-endif
- @echo Flag_On 0x00000008 >> $(basename $@).def
- @echo Start _lib_start >> $(basename $@).def
- @echo Exit _lib_stop >> $(basename $@).def
-
- $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc
- @echo xdcdata $(basename $@).xdc >> $(basename $@).def
-
- @echo Linking $@...
- @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link
-ifdef LIBRARY
- @echo $(LIBRARY) >> $(basename $@).link
-endif
- @echo $(OBJECTS) $(APACHE_DIR)/lib/libpre.obj >> $(basename $@).link
-
- @$(LINK) @$(basename $@).link
-
-
-.PHONY: clean
-clean: cleanobj cleanbin
-
-.PHONY: cleand
-cleand:
- @echo Deleting all dependency files...
- -@del "$(OBJ_DIR)\*.d"
-
-.PHONY: cleanobj
-cleanobj:
- @echo Deleting all object files...
- -@del "$(OBJ_DIR)\*.obj"
-
-.PHONY: cleanbin
-cleanbin:
- @echo Deleting binary files...
- -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm"
- @echo Deleting MAP, DEF files, etc....
- -@del "$(FINAL_DIR)\$(MODULE_NAME).map"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).def"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).link"
-ifeq '$(BUILD)' 'debug'
- -@del $(FINAL_DIR)\$(MODULE_NAME).sym
-endif
diff --git a/netware/php4cli.mak b/netware/php4cli.mak
deleted file mode 100644
index 941ed586a8..0000000000
--- a/netware/php4cli.mak
+++ /dev/null
@@ -1,163 +0,0 @@
-# Temporarily here -- later may go into some batch file
-# which will set this as an environment variable
-PROJECT_ROOT = ../..
-
-# Module details
-MODULE_NAME = php
-MODULE_DESC = "PHP 4.2.3 - Command Line Interface"
-VMAJ = 2
-VMIN = 0
-VREV = 0
-
-#include the common settings
-include $(PROJECT_ROOT)/netware/common.mif
-
-# Extensions of all input and output files
-.SUFFIXES:
-.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d
-
-# Source files
-C_SRC = getopt.c \
- php_cli.c
-
-# Library files
-LIBRARY =
-
-# Destination directories and files
-OBJ_DIR = $(BUILD)
-FINAL_DIR = $(BUILD)
-MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map
-OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.obj) $(C_SRC:.c=.obj))
-DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.d) $(C_SRC:.c=.d))
-
-# Binary file
-ifndef BINARY
- BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm
-endif
-
-
-# Compile flags
-C_FLAGS += -c -maxerrors 25 -msgstyle gcc
-C_FLAGS += -wchar_t on -bool on
-C_FLAGS += -processor Pentium
-C_FLAGS += -w nounusedarg -msext on
-C_FLAGS += -nostdinc
-C_FLAGS += -relax_pointers # To remove type-casting errors
-C_FLAGS += -DNETWARE -DTHREAD_SWITCH
-C_FLAGS += -DZTS
-C_FLAGS += -DNLM_PLATFORM
-C_FLAGS += -DN_PLAT_NLM -DNLM=1 -D__NO_MATH_OPS
-C_FLAGS += -D__C9X_CMATH_INLINES_DEFINED -DAPACHE_OS_H -DNO_USE_SIGACTION -DMULTITHREAD
-C_FLAGS += -DNEW_LIBC
-C_FLAGS += -I. -I- -I. -I../../netware -I$(SDK_DIR)/include # ../../netware added for special SYS/STAT.H
-C_FLAGS += -I$(MWCIncludes)
-C_FLAGS += -I- -I../../main -I../../Zend -I../../TSRM -I../../ext/standard
-C_FLAGS += -I../../ -I../../netware -I$(PROJECT_ROOT)/regex
-C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include
-
-# Extra stuff based on debug / release builds
-ifeq '$(BUILD)' 'debug'
- SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym
- C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -sym internal -DDEBUGGING -DDKFBPON
- C_FLAGS += -r -DZEND_DEBUG=1
- C_FLAGS += -exc cw
- LD_FLAGS += -sym on -sym codeview4 -sym internal -osym $(SYM_FILE)
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib
-else
- C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off -DZEND_DEBUG=0
- C_FLAGS += -opt intrinsics
- C_FLAGS += -opt level=4
- LD_FLAGS += -sym off
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
-endif
-
-
-# Dependencies
-MODULE = LibC \
- phplib
-IMPORT = @$(SDK_DIR)/imports/libc.imp \
- @$(PROJECT_ROOT)/netware/phplib.imp
-EXPORT =
-API =
-
-
-# Virtual paths
-vpath %.cpp .
-vpath %.c .
-vpath %.obj $(OBJ_DIR)
-
-
-all: prebuild project
-
-.PHONY: all
-
-prebuild:
- @if not exist $(OBJ_DIR) md $(OBJ_DIR)
-
-project: $(BINARY) $(MESSAGE)
- @echo Build complete.
-
-
-$(OBJ_DIR)/%.d: %.c
- @echo Building Dependencies for $(<F)
- @$(CC) -M $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.obj: %.c
- @echo Compiling $?...
- @$(CC) $< $(C_FLAGS) -o $@
-
-
-$(BINARY): $(OBJECTS)
- @echo Import $(IMPORT) > $(basename $@).def
-ifdef API
- @echo Import $(API) >> $(basename $@).def
-endif
- @echo Module $(MODULE) >> $(basename $@).def
-ifdef EXPORT
- @echo Export $(EXPORT) >> $(basename $@).def
-endif
- @echo AutoUnload >> $(basename $@).def
-ifeq '$(BUILD)' 'debug'
- @echo Debug >> $(basename $@).def
-endif
- @echo Flag_On 0x00000008 >> $(basename $@).def
- @echo Start _LibCPrelude >> $(basename $@).def
- @echo Exit _LibCPostlude >> $(basename $@).def
-
- $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc
- @echo xdcdata $(basename $@).xdc >> $(basename $@).def
-
- @echo Linking $@...
- @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link
-ifdef LIBRARY
- @echo $(LIBRARY) >> $(basename $@).link
-endif
- @echo $(OBJECTS) >> $(basename $@).link
-
- @$(LINK) @$(basename $@).link
-
-
-.PHONY: clean
-clean: cleanobj cleanbin
-
-.PHONY: cleand
-cleand:
- @echo Deleting all dependency files...
- -@del "$(OBJ_DIR)\*.d"
-
-.PHONY: cleanobj
-cleanobj:
- @echo Deleting all object files...
- -@del "$(OBJ_DIR)\*.obj"
-
-.PHONY: cleanbin
-cleanbin:
- @echo Deleting binary files...
- -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm"
- @echo Deleting MAP, DEF files, etc....
- -@del "$(FINAL_DIR)\$(MODULE_NAME).map"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).def"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).link"
-ifeq '$(BUILD)' 'debug'
- -@del $(FINAL_DIR)\$(MODULE_NAME).sym
-endif
diff --git a/netware/phplib.imp b/netware/phplib.imp
deleted file mode 100644
index d1ecedc982..0000000000
--- a/netware/phplib.imp
+++ /dev/null
@@ -1,177 +0,0 @@
-_array_init,
-_convert_to_string,
-_ecalloc,
-_efree,
-_emalloc,
-_erealloc,
-_estrdup,
-_estrndup,
-_object_and_properties_init,
-_object_init,
-_object_init_ex,
-_php_stream_cast,
-_php_stream_free,
-_php_stream_open_wrapper_ex,
-_zend_get_parameters_array,
-_zend_get_parameters_array_ex,
-_zend_list_addref,
-_zend_list_delete,
-_zend_list_find,
-_zval_copy_ctor,
-_zval_dtor,
-_zval_ptr_dtor,
-add_assoc_bool_ex,
-add_assoc_long_ex,
-add_assoc_zval_ex,
-add_index_null,
-add_index_long,
-add_index_zval,
-add_assoc_string_ex,
-add_assoc_stringl_ex,
-add_assoc_null_ex,
-add_index_string,
-add_index_stringl,
-add_next_index_bool,
-add_next_index_long,
-add_next_index_string,
-add_next_index_stringl,
-add_next_index_zval,
-add_property_long_ex,
-add_property_string_ex,
-call_user_function,
-compiler_globals_id,
-convert_to_boolean,
-convert_to_array,
-convert_to_double,
-convert_to_long,
-core_globals_id,
-display_ini_entries,
-display_link_numbers,
-empty_string,
-executor_globals_id,
-expand_filepath,
-get_zend_version,
-get_active_function_name,
-highlight_file,
-le_index_ptr,
-module_registry,
-multi_convert_to_long_ex,
-open_file_for_scanning,
-php_addslashes,
-php_check_open_basedir,
-php_checkuid,
-php_execute_script,
-php_fopen_primary_script,
-php_handle_aborted_connection,
-php_handle_special_queries,
-php_body_write,
-php_end_ob_buffers,
-php_error_docref0,
-php_get_current_user,
-php_get_highlight_struct,
-php_handle_auth_data,
-php_header,
-php_header_write,
-php_import_environment_variables,
-php_info_print_table_end,
-php_info_print_table_colspan_header,
-php_info_print_table_header,
-php_info_print_table_row,
-php_info_print_table_start,
-php_lint_script,
-php_log_err,
-php_module_shutdown,
-php_module_shutdown_for_exec,
-php_module_shutdown_wrapper,
-php_module_startup,
-php_ob_set_internal_handler,
-php_output_activate,
-php_output_set_status,
-php_output_startup,
-php_print_info,
-php_printf,
-php_regcomp,
-php_regexec,
-php_regfree,
-php_register_variable,
-php_request_shutdown,
-php_request_shutdown_for_exec,
-php_request_startup,
-php_sig_gif,
-php_sig_jpg,
-php_sig_png,
-php_start_ob_buffer,
-php_strip_tags,
-php_strip_url_passwd,
-php_stripslashes,
-php_strlcpy,
-php_strtolower,
-php_strtoupper,
-php_write,
-sapi_add_header_ex,
-sapi_free_header,
-sapi_get_default_content_type,
-sapi_globals_id,
-sapi_shutdown,
-sapi_startup,
-second_arg_force_ref,
-ts_allocate_id,
-ts_resource_ex,
-tsrm_shutdown,
-tsrm_startup,
-virtual_filepath,
-virtual_fopen,
-zend_alter_ini_entry,
-zend_error,
-zend_eval_string,
-zend_execute_scripts,
-zend_extensions,
-zend_fetch_resource,
-zend_get_parameters_ex,
-zend_hash_add_or_update,
-zend_hash_apply,
-zend_hash_apply_with_argument,
-zend_hash_clean,
-zend_hash_del_key_or_index,
-zend_hash_destroy,
-zend_hash_exists,
-zend_hash_find,
-zend_hash_get_current_key_ex,
-zend_hash_get_current_data_ex,
-zend_hash_index_find,
-zend_hash_index_update_or_next_insert,
-zend_hash_init,
-zend_hash_init_ex,
-zend_hash_internal_pointer_reset_ex
-zend_hash_merge_ex,
-zend_hash_move_forward_ex,
-zend_hash_num_elements,
-zend_highlight,
-zend_ini_deactivate,
-zend_ini_boolean_displayer_cb,
-zend_ini_string,
-zend_list_insert,
-zend_llist_add_element,
-zend_llist_apply,
-zend_llist_apply_with_argument,
-zend_llist_destroy,
-zend_llist_init,
-zend_load_extension,
-zend_parse_parameters,
-zend_parse_parameters_ex,
-zend_printf,
-zend_register_ini_entries,
-zend_register_internal_class,
-zend_register_list_destructors_ex,
-zend_register_long_constant,
-zend_register_resource,
-zend_startup_module,
-zend_standard_class_def,
-zend_strip,
-zend_unregister_ini_entries,
-zend_wrong_param_count,
-zval_add_ref,
-OnUpdateBool,
-OnUpdateLong,
-OnUpdateString,
-OnUpdateStringUnempty
diff --git a/netware/phplib.mak b/netware/phplib.mak
deleted file mode 100644
index 95026f2b15..0000000000
--- a/netware/phplib.mak
+++ /dev/null
@@ -1,404 +0,0 @@
-# Temporarily here -- later may go into some batch file
-# which will set this as an environment variable
-PROJECT_ROOT = .
-
-# Module details
-MODULE_NAME = phplib
-MODULE_DESC = "PHP 4.3 - Script Interpreter and Library"
-VMAJ = 3
-VMIN = 0
-VREV = 0
-
-#include the common settings
-include $(PROJECT_ROOT)/netware/common.mif
-
-
-# Extensions of all input and output files
-.SUFFIXES:
-.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d
-
-# Source files
-C_SRC = ext/bcmath/bcmath.c \
- ext/bcmath/libbcmath/src/add.c \
- ext/bcmath/libbcmath/src/compare.c \
- ext/bcmath/libbcmath/src/debug.c \
- ext/bcmath/libbcmath/src/div.c \
- ext/bcmath/libbcmath/src/divmod.c \
- ext/bcmath/libbcmath/src/doaddsub.c \
- ext/bcmath/libbcmath/src/init.c \
- ext/bcmath/libbcmath/src/int2num.c \
- ext/bcmath/libbcmath/src/nearzero.c \
- ext/bcmath/libbcmath/src/neg.c \
- ext/bcmath/libbcmath/src/num2long.c \
- ext/bcmath/libbcmath/src/num2str.c \
- ext/bcmath/libbcmath/src/outofmem.c \
- ext/bcmath/libbcmath/src/output.c \
- ext/bcmath/libbcmath/src/raise.c \
- ext/bcmath/libbcmath/src/raisemod.c \
- ext/bcmath/libbcmath/src/recmul.c \
- ext/bcmath/libbcmath/src/rmzero.c \
- ext/bcmath/libbcmath/src/rt.c \
- ext/bcmath/libbcmath/src/sqrt.c \
- ext/bcmath/libbcmath/src/str2num.c \
- ext/bcmath/libbcmath/src/sub.c \
- ext/bcmath/libbcmath/src/zero.c \
- ext/calendar/cal_unix.c \
- ext/calendar/calendar.c \
- ext/calendar/dow.c \
- ext/calendar/easter.c \
- ext/calendar/french.c \
- ext/calendar/gregor.c \
- ext/calendar/jewish.c \
- ext/calendar/julian.c \
- ext/ftp/ftp.c \
- ext/ftp/php_ftp.c \
- ext/mcal/php_mcal.c \
- ext/pcre/php_pcre.c \
- ext/pcre/pcrelib/chartables.c \
- ext/pcre/pcrelib/get.c \
- ext/pcre/pcrelib/maketables.c \
- ext/pcre/pcrelib/pcre.c \
- ext/pcre/pcrelib/pcreposix.c \
- ext/pcre/pcrelib/study.c \
- ext/session/mod_files.c \
- ext/session/mod_mm.c \
- ext/session/mod_user.c \
- ext/session/session.c \
- ext/snmp/snmp.c \
- ext/standard/aggregation.c \
- ext/standard/array.c \
- ext/standard/assert.c \
- ext/standard/base64.c \
- ext/standard/basic_functions.c \
- ext/standard/browscap.c \
- ext/standard/crc32.c \
- ext/standard/credits.c \
- ext/standard/css.c \
- ext/standard/cyr_convert.c \
- ext/standard/datetime.c \
- ext/standard/dir.c \
- ext/standard/dl.c \
- ext/standard/dns.c \
- ext/standard/exec.c \
- ext/standard/file.c \
- ext/standard/filestat.c \
- ext/standard/filters.c \
- ext/standard/flock_compat.c \
- ext/standard/formatted_print.c \
- ext/standard/fsock.c \
- ext/standard/ftok.c \
- ext/standard/ftp_fopen_wrapper.c \
- ext/standard/head.c \
- ext/standard/html.c \
- ext/standard/http_fopen_wrapper.c \
- ext/standard/image.c \
- ext/standard/incomplete_class.c \
- ext/standard/info.c \
- ext/standard/iptc.c \
- ext/standard/lcg.c \
- ext/standard/levenshtein.c \
- ext/standard/link.c \
- ext/standard/mail.c \
- ext/standard/math.c \
- ext/standard/md5.c \
- ext/standard/metaphone.c \
- ext/standard/microtime.c \
- ext/standard/pack.c \
- ext/standard/pageinfo.c \
- ext/standard/parsedate.c \
- ext/standard/php_fopen_wrapper.c \
- ext/standard/quot_print.c \
- ext/standard/rand.c \
- ext/standard/reg.c \
- ext/standard/scanf.c \
- ext/standard/sha1.c \
- ext/standard/soundex.c \
- ext/standard/string.c \
- ext/standard/strnatcmp.c \
- ext/standard/type.c \
- ext/standard/uniqid.c \
- ext/standard/url.c \
- ext/standard/url_scanner.c \
- ext/standard/url_scanner_ex.c \
- ext/standard/user_filters.c \
- ext/standard/var.c \
- ext/standard/var_unserializer.c \
- ext/standard/versioning.c \
- main/fopen_wrappers.c \
- main/internal_functions_nw.c \
- main/main.c \
- main/memory_streams.c \
- main/mergesort.c \
- main/network.c \
- main/output.c \
- main/php_content_types.c \
- main/php_ini.c \
- main/php_logos.c \
- main/php_open_temporary_file.c \
- main/php_sprintf.c \
- main/php_ticks.c \
- main/php_variables.c \
- main/reentrancy.c \
- main/rfc1867.c \
- main/safe_mode.c \
- main/SAPI.c \
- main/snprintf.c \
- main/spprintf.c \
- main/streams.c \
- main/strlcat.c \
- main/strlcpy.c \
- main/user_streams.c \
- netware/geterrnoptr.c \
- netware/mktemp.c \
- netware/pipe.c \
- netware/pwd.c \
- netware/start.c \
- netware/time_nw.c \
- netware/wfile.c \
- regex/regcomp.c \
- regex/regerror.c \
- regex/regexec.c \
- regex/regfree.c \
-# ext/standard/crypt.c \
-# ext/com/COM.c \
-# ext/com/conversion.c \
-# ext/odbc/php_odbc.c \
-# ext/snmp/winsnmp.c \
-# netware/winutil.c \
-# netware/registry.c \
-# main/alloca.c \
-# ext/wddx/wddx.c \
-# netware/readdir.c \
-
-WIN32_C_SRC = sendmail.c \
-
-
-CPP_SRC_NODIR = $(notdir $(CPP_SRC))
-C_SRC_NODIR = $(notdir $(C_SRC))
-SRC_DIR = $(dir $(CPP_SRC) $(C_SRC))
-
-# Library files
-LIBRARY = $(PROJECT_ROOT)/Zend/$(BUILD)/Zend.lib $(PROJECT_ROOT)/TSRM/$(BUILD)/TSRM.lib
-
-# Destination directories and files
-OBJ_DIR = $(BUILD)
-FINAL_DIR = $(BUILD)
-MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map
-OBJECTS = $(join $(SRC_DIR), $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.obj) $(C_SRC_NODIR:.c=.obj)))
-WIN32_OBJECTS = $(addprefix $(OBJ_DIR)/,$(WIN32_C_SRC:.c=.obj))
-DEPDS = $(join $(SRC_DIR), $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.d) $(C_SRC_NODIR:.c=.d)))
-
-# Binary file
-ifndef BINARY
- BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm
-endif
-
-# Compile flags
-C_FLAGS += -c -maxerrors 25 -msgstyle gcc
-C_FLAGS += -wchar_t on -bool on
-C_FLAGS += -relax_pointers # To remove type-casting errors
-C_FLAGS += -processor Pentium
-C_FLAGS += -nostdinc -nosyspath
-C_FLAGS += -DNETWARE -D__BIT_TYPES_DEFINED__ -DZTS
-C_FLAGS += -DPHP4DLLTS_EXPORTS -DPHP_EXPORTS -DLIBZEND_EXPORTS -DTSRM_EXPORTS -DSAPI_EXPORTS
-C_FLAGS += -DHAVE_SYS_TIME_H -DHAVE_STRUCT_FLOCK -DVIRTUAL_DIR -DHAVE_TZNAME
-C_FLAGS += -DHAVE_DLFCN_H -DHAVE_LIBDL
-C_FLAGS += -DCLIB_STAT_PATCH # stat patch
-C_FLAGS += -DNEW_LIBC -DHAVE_ARPA_INET_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_INET_ATON=1
-
-C_FLAGS += -DLINK_SIZE=2 # Added for the new definition in ext\pcre\pcrelib\internal.h
-# Below added for the file ext\pcre\pcrelib\pcreposix.c and
-# the default value is what is defined in the changelog file
-C_FLAGS += -DPOSIX_MALLOC_THRESHOLD=5
-
-C_FLAGS += -I. -Imain -Inetware -Iregex -IZend -ITSRM
-C_FLAGS += -Iext/standard -Iext/mcal -Iext/pcre -Iext/pcre/pcrelib
-C_FLAGS += -Iext/bcmath -Iext/bcmath/libbcmath/src
-C_FLAGS += -Iext/odbc -Iext/session -Iext/ftp -Iext/wddx -Iext/calendar -Iext/snmp
-C_FLAGS += -I- -Inetware -I$(SDK_DIR)/include -I$(MWCIncludes) # netware added for special SYS/STAT.H : Venkat(6/2/02)
-C_FLAGS += -Iwin32
-C_FLAGS += -I$(SDK_DIR)/include/winsock # Added for socket calls
-
-
-# Extra stuff based on debug / release builds
-ifeq '$(BUILD)' 'debug'
- SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym
- C_FLAGS += -inline smart -sym on -sym codeview4 -sym internal -opt off -opt intrinsics
- C_FLAGS += -D_DEBUG -DZEND_DEBUG=1
- LD_FLAGS += -sym codeview4 -sym internal -osym $(SYM_FILE)
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
-else
- C_FLAGS += -opt speed -inline on -inline auto -sym off -DZEND_DEBUG=0
- LD_FLAGS += -sym off
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
-endif
-
-# Dependencies
-MODULE = LibC
-IMPORT = @$(SDK_DIR)/imports/libc.imp \
- @$(SDK_DIR)/imports/ws2nlm.imp \
- @$(MPK_DIR)/import/mpkOrg.imp
-EXPORT = @$(PROJECT_ROOT)/netware/phplib.imp
-API = NXGetEnvCount \
- NXCopyEnv \
- OutputToScreen \
- bsd_fd_set
-
-
-# Virtual paths
-vpath %.cpp .
-vpath %.c . win32
-vpath %.obj $(OBJ_DIR)
-
-
-all: prebuild project
-
-.PHONY: all
-
-prebuild:
- @if not exist main\$(OBJ_DIR) md main\$(OBJ_DIR)
- @if not exist regex\$(OBJ_DIR) md regex\$(OBJ_DIR)
- @if not exist netware\$(OBJ_DIR) md netware\$(OBJ_DIR)
- @if not exist ext\standard\$(OBJ_DIR) md ext\standard\$(OBJ_DIR)
- @if not exist ext\bcmath\$(OBJ_DIR) md ext\bcmath\$(OBJ_DIR)
- @if not exist ext\bcmath\libbcmath\src\$(OBJ_DIR) md ext\bcmath\libbcmath\src\$(OBJ_DIR)
- @if not exist ext\mcal\$(OBJ_DIR) md ext\mcal\$(OBJ_DIR)
- @if not exist ext\pcre\$(OBJ_DIR) md ext\pcre\$(OBJ_DIR)
- @if not exist ext\pcre\pcrelib\$(OBJ_DIR) md ext\pcre\pcrelib\$(OBJ_DIR)
- @if not exist ext\odbc\$(OBJ_DIR) md ext\odbc\$(OBJ_DIR)
- @if not exist ext\session\$(OBJ_DIR) md ext\session\$(OBJ_DIR)
- @if not exist ext\ftp\$(OBJ_DIR) md ext\ftp\$(OBJ_DIR)
- @if not exist ext\wddx\$(OBJ_DIR) md ext\wddx\$(OBJ_DIR)
- @if not exist ext\calendar\$(OBJ_DIR) md ext\calendar\$(OBJ_DIR)
- @if not exist ext\snmp\$(OBJ_DIR) md ext\snmp\$(OBJ_DIR)
- @if not exist $(FINAL_DIR) md $(FINAL_DIR)
-
-project: $(BINARY) $(MESSAGE)
- @echo Build complete.
-
-%.d: ../%.c
- @echo Building Dependencies for $(<F)
- @$(CC) -M $< $(C_FLAGS) -o $@
-
-%.obj: ../%.c
- @echo Compiling $?...
-# writing the flags to a file. Otherwise fails on win95 due too many characters in command line.
- @echo $(wordlist 1, 20, $(C_FLAGS)) > $(basename $(OBJ_DIR)\$(notdir $@)).cfg
- @echo $(wordlist 21, 40, $(C_FLAGS)) >> $(basename $(OBJ_DIR)\$(notdir $@)).cfg
- @echo $(wordlist 41, 60, $(C_FLAGS)) >> $(basename $(OBJ_DIR)\$(notdir $@)).cfg
- @echo $(wordlist 61, 80, $(C_FLAGS)) >> $(basename $(OBJ_DIR)\$(notdir $@)).cfg
- @$(CC) $< @$(basename $(OBJ_DIR)\$(notdir $@)).cfg -o $@
- @del $(basename $(OBJ_DIR)\$(notdir $@)).cfg
-
-
-$(BINARY): $(OBJECTS) $(WIN32_OBJECTS) $(LIBRARY)
- @echo Import $(IMPORT) > $(basename $@).def
-ifdef API
- @echo Import $(API) >> $(basename $@).def
-endif
- @echo Module $(MODULE) >> $(basename $@).def
-ifdef EXPORT
- @echo Export $(EXPORT) >> $(basename $@).def
-endif
- @echo AutoUnload >> $(basename $@).def
-ifeq '$(BUILD)' 'debug'
- @echo Debug >> $(basename $@).def
-endif
- @echo Flag_On 0x00000008 >> $(basename $@).def
- @echo Start _LibCPrelude >> $(basename $@).def
- @echo Exit _LibCPostlude >> $(basename $@).def
-
- $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc
- @echo xdcdata $(basename $@).xdc >> $(basename $@).def
-
- @echo Linking $@...
- @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link
-ifdef LIBRARY
- @echo $(LIBRARY) >> $(basename $@).link
-endif
- @echo $(wordlist 1, 10, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 11, 20, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 21, 30, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 31, 40, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 41, 50, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 51, 60, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 61, 70, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 71, 80, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 81, 85, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 86, 90, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 91, 95, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 96, 100, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 101, 105, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 106, 110, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 111, 115, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 116, 120, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 121, 125, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 126, 130, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 131, 135, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 136, 140, $(OBJECTS)) >> $(basename $@).link
- @echo $(wordlist 141, 141, $(OBJECTS)) >> $(basename $@).link
-
- @echo $(wordlist 1, 2, $(WIN32_OBJECTS)) >> $(basename $@).link
-
- @$(LINK) @$(basename $@).link
-
-
-.PHONY: clean
-clean: cleansrc cleanobj cleanbin
-
-.PHONY: cleand
-cleand:
- @echo Deleting all dependency files...
- -@del "main\$(OBJ_DIR)\*.d"
- -@del "regex\$(OBJ_DIR)\*.d"
- -@del "netware\$(OBJ_DIR)\*.d"
- -@del "ext\standard\$(OBJ_DIR)\*.d"
- -@del "ext\bcmath\$(OBJ_DIR)\*.d"
- -@del "ext\bcmath\libbcmath\src\$(OBJ_DIR)\*.d"
- -@del "ext\mcal\$(OBJ_DIR)\*.d"
- -@del "ext\pcre\$(OBJ_DIR)\*.d"
- -@del "ext\pcre\pcrelib\$(OBJ_DIR)\*.d"
- -@del "ext\odbc\$(OBJ_DIR)\*.d"
- -@del "ext\session\$(OBJ_DIR)\*.d"
- -@del "ext\ftp\$(OBJ_DIR)\*.d"
- -@del "ext\wddx\$(OBJ_DIR)\*.d"
- -@del "ext\calendar\$(OBJ_DIR)\*.d"
- -@del "ext\snmp\$(OBJ_DIR)\*.d"
-
-.PHONY: cleansrc
-cleansrc:
- @echo Deleting all generated source files...
- -@del "ext\standard\parsedate.c"
- -@del "ext\standard\parsedate.h"
- -@del "ext\standard\parsedate.output"
-
-.PHONY: cleanobj
-cleanobj:
- @echo Deleting all object files...
- -@del "main\$(OBJ_DIR)\*.obj"
- -@del "regex\$(OBJ_DIR)\*.obj"
- -@del "netware\$(OBJ_DIR)\*.obj"
- -@del "ext\standard\$(OBJ_DIR)\*.obj"
- -@del "ext\bcmath\$(OBJ_DIR)\*.obj"
- -@del "ext\bcmath\libbcmath\src\$(OBJ_DIR)\*.obj"
- -@del "ext\mcal\$(OBJ_DIR)\*.obj"
- -@del "ext\pcre\$(OBJ_DIR)\*.obj"
- -@del "ext\pcre\pcrelib\$(OBJ_DIR)\*.obj"
- -@del "ext\odbc\$(OBJ_DIR)\*.obj"
- -@del "ext\session\$(OBJ_DIR)\*.obj"
- -@del "ext\ftp\$(OBJ_DIR)\*.obj"
- -@del "ext\wddx\$(OBJ_DIR)\*.obj"
- -@del "ext\calendar\$(OBJ_DIR)\*.obj"
- -@del "ext\snmp\$(OBJ_DIR)\*.obj"
-
-.PHONY: cleanbin
-cleanbin:
- @echo Deleting binary files...
- -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm"
- @echo Deleting MAP, DEF files, etc....
- -@del "$(FINAL_DIR)\$(MODULE_NAME).map"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).def"
- -@del "$(FINAL_DIR)\$(MODULE_NAME).link"
-ifeq '$(BUILD)' 'debug'
- -@del $(FINAL_DIR)\$(MODULE_NAME).sym
-endif
diff --git a/netware/phptest.ncf b/netware/phptest.ncf
deleted file mode 100644
index 9cb599e194..0000000000
--- a/netware/phptest.ncf
+++ /dev/null
@@ -1 +0,0 @@
-php -q run-tests.php > results.txt \ No newline at end of file
diff --git a/netware/pipe.c b/netware/pipe.c
deleted file mode 100644
index c302fdf3e0..0000000000
--- a/netware/pipe.c
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * FILENAME : pipe.c
- * DESCRIPTION : Functions to implement pipes on NetWare.
- * Author : Anantha Kesari H Y, Venkat Raghavan S, Srivathsa M
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "netware/pipe.h"
-#include "netware/mktemp.h"
-
-
-/* Following definitions unavailable in LibC, hence borrowed from CLib */
-#define P_WAIT 0
-#define P_NOWAIT 1
-
-#define WHITESPACE " \t"
-#define MAX_ARGS 10
-
-
-FILE* popen(const char* commandline, const char* mode)
-{
- int err, count;
- char pszPipestr[32] = {'\0'};
- char *command = NULL, *argv[MAX_ARGS] = {'\0'};
- int fd = -1;
- fd_set myfds;
- wiring_t wiring;
- pid_t pid=0;
- FILE *fp=NULL;
- char *ptr = NULL;
- int ptrLen = 0, argc = 0, i = 0;
-
-
- /* Get a temporary name */
- (void) tmpnam(strecpy(pszPipestr, "PHP/php$pipe/"));
-
- wiring.infd=FD_UNUSED;
- wiring.outfd=FD_UNUSED;
- wiring.errfd=FD_UNUSED;
-
- /* Open a pipe */
- if ( *mode=='r') {
- fd = pipe_open (pszPipestr, O_RDONLY);
- if (fd == -1)
- return NULL;
-
- wiring.outfd=fd;
- } else if (*mode=='w') {
- fd = pipe_open (pszPipestr, O_WRONLY);
- if (fd == -1)
- return NULL;
-
- wiring.infd=fd;
- } else {
- consoleprintf ("Unsupported pipe open mode \n");
- return NULL;
- }
-
- /* Get the file pointer */
- fp = fdopen(fd, mode);
- if (fp == NULL) {
- consoleprintf ("Failure in fdopen \n");
- close (fd);
- return NULL;
- }
-
- /* Separate commandline string into words */
- ptr = strtok((char*)commandline, WHITESPACE);
- ptrLen = strlen(ptr);
-
- /* Get the command */
- command = (char*)malloc(ptrLen + 1);
- if(command == NULL) {
- consoleprintf ("Failure in memory allocation \n");
- close (fd);
- fclose (fp);
- return NULL;
- }
- strcpy (command, ptr);
-
- /* Command as the first argument into prcessve */
- argv[argc] = (char*)malloc(ptrLen + 1);
- if(argv[argc] == NULL) {
- consoleprintf ("Failure in memory allocation \n");
- close (fd);
- fclose (fp);
- if(command) {
- free(command);
- command = NULL;
- }
- return NULL;
- }
- strcpy (argv[argc], ptr);
- argc++;
-
- /* Get more arguments if any to be passed to prcessve */
- ptr = strtok(NULL, WHITESPACE);
- while (ptr && (argc < MAX_ARGS))
- {
- ptrLen = strlen(ptr);
-
- argv[argc] = (char*)malloc(ptrLen + 1);
- if(argv[argc] == NULL) {
- consoleprintf ("Failure in memory allocation \n");
- close (fd);
- fclose (fp);
- if(command) {
- free(command);
- command = NULL;
- }
- return NULL;
- }
- strcpy (argv[argc], ptr);
- argc++;
-
- ptr = strtok(NULL, WHITESPACE);
- }
- argv[argc] = NULL;
-
- FD_ZERO(&myfds);
- FD_SET(fd, &myfds);
-
- pid = processve(command, PROC_CURRENT_SPACE, NULL, &wiring,
- &myfds, NULL, (const char **)argv );
- if (pid == -1) {
- consoleprintf ("Failure in processve call \n");
- close (fd);
- fclose(fp);
- if(command) {
- free(command);
- command = NULL;
- }
- for(i=0; i<argc; i++) {
- if(argv[i]) {
- free(argv[i]);
- argv[i] = NULL;
- }
- }
- return NULL;
- }
-
- close (fd);
- if(command) {
- free(command);
- command = NULL;
- }
- for(i=0; i<argc; i++) {
- if(argv[i]) {
- free(argv[i]);
- argv[i] = NULL;
- }
- }
-
- return fp;
-}
-
-
-int pclose(FILE* stream)
-{
- fclose(stream);
- return 0;
-}
-
-
-
-#if 0
-
-FILE* popen2(const char* commandline, const char* mode)
-{
- int err, count, var, replaced;
- char **env, pszPipestr[32];
- NXVmId_t newVM;
- NXExecEnvSpec_t envSpec;
- char *command = NULL, *argv[MAX_ARGS] = {"\0"};
- NXHandle_t fd;
-
- fd = (NXHandle_t) -1;
-
- count = NXGetEnvCount() + 1; // (add one for NULL)
- env = (char **) NXMemAlloc(sizeof(char *) * count, 0);
-
- if (!env)
- return 0;
-
- err = NXCopyEnv(env, count); // ensure NULL added at end
- if ( *mode='r'){
- (void) tmpnam(strecpy(pszPipestr, "PHPPIPE/stdin/"));
- err = NXFifoOpen(0, pszPipestr, NX_O_RDONLY, 0, &fd);
- if (err)
- return 0;
-
- envSpec.esStdin.ssType = NX_OBJ_CONSOLE;
- envSpec.esStdout.ssType = NX_OBJ_FIFO;
- envSpec.esStdout.ssPath = pszPipestr;
- }
- else if (*mode='w') then{
- (void) tmpnam(strecpy(pszPipestr, "PHPPIPE/stdout/"));
- err = NXFifoOpen(0, instr, NX_O_WRONLY, 0, &fd);
- if (err)
- return 0;
- envSpec.esStdin.ssType = NX_OBJ_FIFO;
- envSpec.esStdout.ssType = NX_OBJ_CONSOLE;
- envSpec.esStdin.ssPath = pszPipestr;
- }
- else
- consoleprintf ("Unsupported pipe open mode \n");
-
-
- /* Separate commandline string into words */
-
- ptr = strtok((char*)commandline, WHITESPACE);
- ptrLen = strlen(ptr);
-
- command = (char*)malloc(ptrLen + 1);
- strcpy (command, ptr);
-
- ptr = strtok(NULL, WHITESPACE);
- while (ptr && (argc < MAX_ARGS))
- {
- ptrLen = strlen(ptr);
-
- argv[argc] = (char*)malloc(ptrLen + 1);
- strcpy (argv[argc], ptr);
-
- argc++;
-
- ptr = strtok(NULL, WHITESPACE);
- }
-/* consoleprintf ("PHP | popen: command = %s\n", command); */
-
- //
-
- envSpec.esArgc = argc;
- envSpec.esArgv = argv;
- envSpec.esEnv = env;
-
- envSpec.esStderr.ssType = NX_OBJ_CONSOLE;
-
- envSpec.esStdin.ssHandle =
- envSpec.esStdout.ssHandle =
- envSpec.esStderr.ssHandle = -1;
-
- envSpec.esStdin.ssPathCtx =
- envSpec.esStdout.ssPathCtx =
- envSpec.esStderr.ssPathCtx = NULL;
-
- envSpec.esStderr.ssPath = NULL;
-
- err = NXVmSpawn(NULL, command, &envSpec, NX_VM_CREATE_DETACHED, &newVM);
- return fd;
-
-}
-
-int pclose2(FILE* stream)
-{
- NXClose(*(NXHandle_t *)stream);
- return 0;
-}
-
-FILE* popen1(const char* commandline, const char* mode)
-{
- char *command = NULL, *argv[MAX_ARGS] = {"\0"};
- char *tempName = "phpXXXXXX.tmp";
- char *filePath = NULL;
- FILE *fp = NULL;
- char *ptr = NULL;
- int ptrLen = 0, argc = 0, i = 0;
-
- /* Check for validity of input parameters */
- if (!commandline || !mode)
- return NULL;
-
- /* Get temporary file name */
- filePath = mktemp(tempName);
- if (!filePath)
- return NULL;
-
- /* Separate commandline string into words */
-
- ptr = strtok((char*)commandline, WHITESPACE);
- ptrLen = strlen(ptr);
-
- command = (char*)malloc(ptrLen + 1);
- strcpy (command, ptr);
-
- ptr = strtok(NULL, WHITESPACE);
- while (ptr && (argc < MAX_ARGS))
- {
- ptrLen = strlen(ptr);
-
- argv[argc] = (char*)malloc(ptrLen + 1);
- strcpy (argv[argc], ptr);
-
- argc++;
-
- ptr = strtok(NULL, WHITESPACE);
- }
-/*consoleprintf ("PHP | popen: command = %s\n", command);*/
- if(strchr(mode,'r') != 0)
- {
- /*spawnvp(P_WAIT, command, argv);*/
-
- fp = fopen(filePath, "r"); /* Get the file handle of the pipe */
- }
- else if(strchr(mode,'w') != 0)
- fp = fopen(filePath, "w"); /* Get the file handle of the pipe */
-
- /* Free resources */
- free (command);
- for (i = 0; i < argc; i++)
- {
-/*consoleprintf ("%s\t", argv[i]);*/
- free (argv[i]);
- }
-/*consoleprintf ("\n");*/
-
- return fp; /* Return the file handle.*/
-}
-
-int pclose1(FILE* stream)
-{
- return (fclose(stream));
-}
-
-# endif
diff --git a/netware/pipe.h b/netware/pipe.h
deleted file mode 100644
index a54c8bf915..0000000000
--- a/netware/pipe.h
+++ /dev/null
@@ -1,11 +0,0 @@
-
-/* pipe related function declarations */
-
-/*#include <unistd.h>*/
-#include <proc.h>
-#include <fcntl.h>
-#include <sys/select.h>
-
-
-FILE* popen(const char* command, const char* mode);
-int pclose(FILE* stream);
diff --git a/netware/postgres_ext.h b/netware/postgres_ext.h
deleted file mode 100644
index 9b79a23f15..0000000000
--- a/netware/postgres_ext.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * postgres_ext.h
- *
- * This file contains declarations of things that are visible everywhere
- * in PostgreSQL *and* are visible to clients of frontend interface libraries.
- * For example, the Oid type is part of the API of libpq and other libraries.
- *
- * Declarations which are specific to a particular interface should
- * go in the header file for that interface (such as libpq-fe.h). This
- * file is only for fundamental Postgres declarations.
- *
- * User-written C functions don't count as "external to Postgres."
- * Those function much as local modifications to the backend itself, and
- * use header files that are otherwise internal to Postgres to interface
- * with the backend.
- *
- * $Id$
- *
- *-------------------------------------------------------------------------
- */
-
-#ifndef POSTGRES_EXT_H
-#define POSTGRES_EXT_H
-
-/*
- * Object ID is a fundamental type in Postgres.
- */
-typedef unsigned int Oid;
-
-#define InvalidOid ((Oid) 0)
-
-#define OID_MAX UINT_MAX
-/* you will need to include <limits.h> to use the above #define */
-
-
-/*
- * NAMEDATALEN is the max length for system identifiers (e.g. table names,
- * attribute names, function names, etc.)
- *
- * NOTE that databases with different NAMEDATALEN's cannot interoperate!
- */
-#define NAMEDATALEN 32
-
-#endif
diff --git a/netware/pwd.c b/netware/pwd.c
deleted file mode 100644
index 41861a054f..0000000000
--- a/netware/pwd.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* pwd.c - Try to approximate UN*X's getuser...() functions under MS-DOS.
- Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Header$
- */
-
-/* This 'implementation' is conjectured from the use of this functions in
- the RCS and BASH distributions. Of course these functions don't do too
- much useful things under MS-DOS, but using them avoids many "#ifdef
- MSDOS" in ported UN*X code ... */
-
-#include "php.h" /*php specific */
-/* Need to take care of all the commented stuff later for NetWare */
-/*
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <lmaccess.h>
-*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-/*#include <lmapibuf.h>*/
-#include "pwd.h"
-#include "grp.h"
-
-#ifndef THREAD_SAFE
-static struct passwd pw; /* should we return a malloc()'d structure */
-#endif
-static char *home_dir = "."; /* we feel (no|every)where at home */
-static char *login_shell = "not command.com!";
-
-struct passwd *getpwnam(char *name)
-{
- return (struct passwd *) 0;
-}
-
-
-char *getlogin()
-{
-/*
- static char name[256];
- DWORD dw = 256;
- GetUserName(name, &dw);
- return name;
-*/
- return NULL; /* For now */
-}
-
-struct passwd *
- getpwuid(int uid)
-{
- pw.pw_name = getlogin();
- pw.pw_dir = home_dir;
- pw.pw_shell = login_shell;
- pw.pw_uid = 0;
-
- return &pw;
-}
-
-/* Implementation for now */
-int getpid()
-{
- return -1;
-}
-
-/*
- * Local Variables:
- * mode:C
- * ChangeLog:ChangeLog
- * compile-command:make
- * End:
- */
diff --git a/netware/pwd.h b/netware/pwd.h
deleted file mode 100644
index 646d5f33ac..0000000000
--- a/netware/pwd.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* pwd.h - Try to approximate UN*X's getuser...() functions under MS-DOS.
- Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- */
-
-/* This 'implementation' is conjectured from the use of this functions in
- the RCS and BASH distributions. Of course these functions don't do too
- much useful things under MS-DOS, but using them avoids many "#ifdef
- MSDOS" in ported UN*X code ...
- */
-
-
-#ifndef PWD_H
-#define PWD_H
-
-/* Not available in LibC / SDK header or CodeWarrior header files.
- * So taking from Winsock definitions, which should be OK
- */
-typedef unsigned int DWORD;
-
-struct passwd {
- char *pw_name; /* user name */
- char *pw_passwd; /* encrypted password */
- int pw_uid; /* user uid */
- int pw_gid; /* user gid */
- char *pw_comment; /* comment */
- char *pw_gecos; /* Honeywell login info */
- char *pw_dir; /* home directory */
- char *pw_shell; /* default shell */
-};
-
-extern struct passwd *getpwuid(int);
-extern struct passwd *getpwnam(char *name);
-extern char *getlogin(void);
-
-#ifndef NEW_LIBC
-int getpid();
-#endif
-
-#endif
diff --git a/netware/sendmail_nw.h b/netware/sendmail_nw.h
deleted file mode 100644
index 9d0b7fb73c..0000000000
--- a/netware/sendmail_nw.h
+++ /dev/null
@@ -1,17 +0,0 @@
-
-#ifdef USE_WINSOCK
-/*#include <ws2nlm.h>*/
-#include <novsock2.h>
-#else
-#include <sys/socket.h> /* For struct sockaddr, 'PF_INET' and 'AF_INET' */
-#include <netinet\in.h> /* For struct sockaddr_in */
-#include <netdb.h> /* For struct hostent */
-/*#include <ws2name.h>*/
-#endif /* USE_WINSOCK */
-
-typedef int SOCKET; /* Borrowed from winsock\novsock2.h */
-typedef struct sockaddr_in SOCKADDR_IN;
-typedef struct sockaddr * LPSOCKADDR;
-typedef struct hostent * LPHOSTENT;
-
-#define INVALID_SOCKET (SOCKET)(~0) /* Borrowed from winsock\novsock2.h */
diff --git a/netware/setbuild.bat b/netware/setbuild.bat
deleted file mode 100755
index a1685624ed..0000000000
--- a/netware/setbuild.bat
+++ /dev/null
@@ -1,19 +0,0 @@
-@echo off
-
-if "%1" == "/?" goto USAGE
-
-if "%1" == "d" set BUILD=debug
-if "%1" == "r" set BUILD=release
-
-if "%2" == "1" set APACHE_VER=1.3
-if "%2" == "2" set APACHE_VER=2
-
-goto EXIT
-
-:USAGE
- @echo on
- @echo Usage: setbuild d|r 1|2
- @echo set build type as 'debug' or 'release'
- @echo set Web Server as Apache 1.3.x or Apache 2.0.x
-
-:EXIT \ No newline at end of file
diff --git a/netware/start.c b/netware/start.c
deleted file mode 100644
index 903aef6ed2..0000000000
--- a/netware/start.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Novell, Inc. |
- +----------------------------------------------------------------------+
- */
-
-
-#include <library.h>
-#include <netware.h>
-#include <nks/synch.h>
-
-void *gLibHandle = (void *) NULL;
-rtag_t gAllocTag = (rtag_t) NULL;
-NXMutex_t *gLibLock = (NXMutex_t *) NULL;
-int gLibId = 0;
-
-
-int DisposeLibraryData( void *data)
-{
- return 0;
-}
-
-
-int _NonAppStart
-(
- void *NLMHandle,
- void *errorScreen,
- const char *cmdLine,
- const char *loadDirPath,
- size_t uninitializedDataLength,
- void *NLMFileHandle,
- int (*readRoutineP)( int conn, void *fileHandle, size_t offset,
- size_t nbytes, size_t *bytesRead, void *buffer ),
- size_t customDataOffset,
- size_t customDataSize,
- int messageCount,
- const char **messages
-)
-{
- NX_LOCK_INFO_ALLOC(liblock, "Per-Application Data Lock", 0);
-
-#pragma unused(cmdLine)
-#pragma unused(loadDirPath)
-#pragma unused(uninitializedDataLength)
-#pragma unused(NLMFileHandle)
-#pragma unused(readRoutineP)
-#pragma unused(customDataOffset)
-#pragma unused(customDataSize)
-#pragma unused(messageCount)
-#pragma unused(messages)
-
-/* Here we process our command line, post errors (to the error screen),
- * perform initializations and anything else we need to do before being able
- * to accept calls into us. If we succeed, we return non-zero and the NetWare
- * Loader will leave us up, otherwise we fail to load and get dumped.
- */
-/**
- gAllocTag = AllocateResourceTag(NLMHandle,
- "<library-name> memory allocations", AllocSignature);
- if (!gAllocTag) {
- OutputToScreen(errorScreen, "Unable to allocate resource tag for "
- "library memory allocations.\n");
- return -1;
- }
-**/
- gLibId = register_library(DisposeLibraryData);
- if (gLibId == -1) {
- OutputToScreen(errorScreen, "Unable to register library with kernel.\n");
- return -1;
- }
-
- gLibHandle = NLMHandle;
-
- gLibLock = NXMutexAlloc(0, 0, &liblock);
- if (!gLibLock) {
- OutputToScreen(errorScreen, "Unable to allocate library data lock.\n");
- return -1;
- }
-
- return 0;
-}
-
-
-void _NonAppStop( void )
-{
-/* Here we clean up any resources we allocated. Resource tags is a big part
- * of what we created, but NetWare doesn't ask us to free those.
- */
- (void) unregister_library(gLibId);
- NXMutexFree(gLibLock);
-}
-
-
-int _NonAppCheckUnload( void )
-{
-/* This function cannot be the first in the file for if the file is linked
- * first, then the check-unload function's offset will be nlmname.nlm+0
- * which is how to tell that there isn't one. When the check function is
- * first in the linked objects, it is ambiguous. For this reason, we will
- * put it inside this file after the stop function.
- *
- * Here we check to see if it's alright to ourselves to be unloaded. If not,
- * we return a non-zero value. Right now, there isn't any reason not to allow
- * it.
- */
- return 0;
-}
diff --git a/netware/sys/stat.h b/netware/sys/stat.h
deleted file mode 100644
index e13b5c6754..0000000000
--- a/netware/sys/stat.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Novell, Inc. |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef __sys_stat_h__
-#define __sys_stat_h__
-
-
-#include <time.h>
-#include <stddef.h>
-#include <sys/mode.h>
-#include <sys/time.h>
-
-#include <pshpack1.h>
-
-
-#ifdef CLIB_STAT_PATCH
-
-/***************** stat structure taken from CLib and modified ***************/
-struct stat
-{
- long st_dev; /* volume number */ /* dev_t replaced by long */
- MACHINE_WORD st_ino; /* directory entry number of the st_name */ /* ino_t replaced by MACHINE_WORD */
- unsigned short st_mode; /* emulated file mode */
- unsigned short st_pad1; /* reserved for alignment */
- unsigned long st_nlink; /* count of hard links (always 1) */
- unsigned long st_uid; /* object id of owner */
- unsigned long st_gid; /* group-id (always 0) */
- long st_rdev; /* device type (always 0) */ /* dev_t replaced by long */
- off_t st_size; /* total file size--files only */
- time_t st_atime; /* last access date--files only */
- time_t st_mtime; /* last modify date and time */
- time_t st_ctime; /* POSIX: last status change time... */
- /* ...NetWare: creation date/time */
- time_t st_btime; /* last archived date and time */
- unsigned long st_attr; /* file attributes */
- unsigned long st_archivedID; /* user/object ID of last archive */
- unsigned long st_updatedID; /* user/object ID of last update */
- unsigned short st_inheritedRightsMask; /* inherited rights mask */
- unsigned short st_pad2; /* reserved for alignment */
- unsigned int st_originatingNameSpace; /* namespace of creation */
- size_t st_blksize; /* block size for allocation--files only */
- size_t st_blocks; /* count of blocks allocated to file */
- unsigned int st_flags; /* user-defined flags */
- unsigned long st_spare[4]; /* for future use */
- unsigned char st_name[255+1];/* TARGET_NAMESPACE name */
-};
-/***************** stat structure taken from CLib and modified ***************/
-
-struct stat_libc
-{
- uint32_t st_userspec; /* untouched by stat() */
- uint32_t st_flags; /* flags for this entry */
- mode_t st_mode; /* emulated file mode */
- uint32_t st_spare1;
- uint64_t st_gen; /* generation number of inode */
- ino_t st_ino; /* directory entry number */
- dev_t st_dev; /* volume number */
- dev_t st_rdev; /* device type (always 0) */
- off64_t st_size; /* total file size */
- uint64_t st_spare2;
- blkcnt_t st_blocks; /* count of blocks allocated to file */
- blksize_t st_blksize; /* block size for allocation--files only */
- nlink_t st_nlink; /* count of hard links (always 1) */
- uint32_t st_spare3[3];
- uid_t st_uid; /* owner (object) identity */
- gid_t st_gid; /* group-id (always 0) */
- uid_t st_bid; /* identity of last archiver */
- uid_t st_mid; /* identity of last updator */
- timespec_t st_atime; /* last access date--files only */
- timespec_t st_mtime; /* last modify date and time */
- timespec_t st_ctime; /* last file attributes modification */
- timespec_t st_btime; /* last archived date and time */
- uint64_t st_spare4[44];
-}; /* sizeof(struct dirent) == 0x200 (512.) */
-
-#else /* CLIB_STAT_PATCH */
-
-struct stat
-{
- uint32_t st_userspec; /* untouched by stat() */
- uint32_t st_flags; /* flags for this entry */
- mode_t st_mode; /* emulated file mode */
- uint32_t st_spare1;
- uint64_t st_gen; /* generation number of inode */
- ino_t st_ino; /* directory entry number */
- dev_t st_dev; /* volume number */
- dev_t st_rdev; /* device type (always 0) */
- off64_t st_size; /* total file size */
- uint64_t st_spare2;
- blkcnt_t st_blocks; /* count of blocks allocated to file */
- blksize_t st_blksize; /* block size for allocation--files only */
- nlink_t st_nlink; /* count of hard links (always 1) */
- uint32_t st_spare3[3];
- uid_t st_uid; /* owner (object) identity */
- gid_t st_gid; /* group-id (always 0) */
- uid_t st_bid; /* identity of last archiver */
- uid_t st_mid; /* identity of last updator */
- timespec_t st_atime; /* last access date--files only */
- timespec_t st_mtime; /* last modify date and time */
- timespec_t st_ctime; /* last file attributes modification */
- timespec_t st_btime; /* last archived date and time */
- uint64_t st_spare4[44];
-}; /* sizeof(struct dirent) == 0x200 (512.) */
-
-#endif /* CLIB_STAT_PATCH */
-
-
-#include <poppack.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-int chmod ( const char *path, mode_t mode );
-int fchmod( int fildes, mode_t mode );
-int fstat ( int fildes, struct stat *buf );
-int mkdir ( const char *pathname, mode_t mode );
-int mkfifo( const char *pathname, mode_t mode );
-int stat ( const char *path, struct stat *buf );
-mode_t umask ( mode_t cmask );
-
-#ifdef __cplusplus
-}
-#endif
-
-#define stat64 stat /* same structure and function do both */
-#define fstat64 fstat /* same function does both */
-
-
-#endif /* __sys_stat_h__ */
diff --git a/netware/sysexits.h b/netware/sysexits.h
deleted file mode 100644
index 37246b6e75..0000000000
--- a/netware/sysexits.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)sysexits.h 8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _SYSEXITS_H
-#define _SYSEXITS_H 1
-
-/*
- * SYSEXITS.H -- Exit status codes for system programs.
- *
- * This include file attempts to categorize possible error
- * exit statuses for system programs, notably delivermail
- * and the Berkeley network.
- *
- * Error numbers begin at EX__BASE to reduce the possibility of
- * clashing with other exit statuses that random programs may
- * already return. The meaning of the codes is approximately
- * as follows:
- *
- * EX_USAGE -- The command was used incorrectly, e.g., with
- * the wrong number of arguments, a bad flag, a bad
- * syntax in a parameter, or whatever.
- * EX_DATAERR -- The input data was incorrect in some way.
- * This should only be used for user's data & not
- * system files.
- * EX_NOINPUT -- An input file (not a system file) did not
- * exist or was not readable. This could also include
- * errors like "No message" to a mailer (if it cared
- * to catch it).
- * EX_NOUSER -- The user specified did not exist. This might
- * be used for mail addresses or remote logins.
- * EX_NOHOST -- The host specified did not exist. This is used
- * in mail addresses or network requests.
- * EX_UNAVAILABLE -- A service is unavailable. This can occur
- * if a support program or file does not exist. This
- * can also be used as a catchall message when something
- * you wanted to do doesn't work, but you don't know
- * why.
- * EX_SOFTWARE -- An internal software error has been detected.
- * This should be limited to non-operating system related
- * errors as possible.
- * EX_OSERR -- An operating system error has been detected.
- * This is intended to be used for such things as "cannot
- * fork", "cannot create pipe", or the like. It includes
- * things like getuid returning a user that does not
- * exist in the passwd file.
- * EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,
- * etc.) does not exist, cannot be opened, or has some
- * sort of error (e.g., syntax error).
- * EX_CANTCREAT -- A (user specified) output file cannot be
- * created.
- * EX_IOERR -- An error occurred while doing I/O on some file.
- * EX_TEMPFAIL -- temporary failure, indicating something that
- * is not really an error. In sendmail, this means
- * that a mailer (e.g.) could not create a connection,
- * and the request should be reattempted later.
- * EX_PROTOCOL -- the remote system returned something that
- * was "not possible" during a protocol exchange.
- * EX_NOPERM -- You did not have sufficient permission to
- * perform the operation. This is not intended for
- * file system problems, which should use NOINPUT or
- * CANTCREAT, but rather for higher level permissions.
- */
-
-#define EX_OK 0 /* successful termination */
-
-#define EX__BASE 64 /* base value for error messages */
-
-#define EX_USAGE 64 /* command line usage error */
-#define EX_DATAERR 65 /* data format error */
-#define EX_NOINPUT 66 /* cannot open input */
-#define EX_NOUSER 67 /* addressee unknown */
-#define EX_NOHOST 68 /* host name unknown */
-#define EX_UNAVAILABLE 69 /* service unavailable */
-#define EX_SOFTWARE 70 /* internal software error */
-#define EX_OSERR 71 /* system error (e.g., can't fork) */
-#define EX_OSFILE 72 /* critical OS file missing */
-#define EX_CANTCREAT 73 /* can't create (user) output file */
-#define EX_IOERR 74 /* input/output error */
-#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
-#define EX_PROTOCOL 76 /* remote error in protocol */
-#define EX_NOPERM 77 /* permission denied */
-#define EX_CONFIG 78 /* configuration error */
-
-#define EX__MAX 78 /* maximum listed value */
-
-#endif /* sysexits.h */
diff --git a/netware/time_nw.c b/netware/time_nw.c
deleted file mode 100644
index 195f18cdd9..0000000000
--- a/netware/time_nw.c
+++ /dev/null
@@ -1,246 +0,0 @@
-
-/*****************************************************************************
- * *
- * DH_TIME.C *
- * *
- * Freely redistributable and modifiable. Use at your own risk. *
- * *
- * Copyright 1994 The Downhill Project *
- *
- * Modified by Shane Caraveo for use with PHP
- *
- *****************************************************************************/
-
-/* $Id$ */
-
- /**
- *
- * 04-Feb-2001
- * - Added patch by "Vanhanen, Reijo" <Reijo.Vanhanen@helsoft.fi>
- * Improves accuracy of msec
- */
-
-/* Include stuff ************************************************************ */
-
-#include "time_nw.h"
-#include "unistd.h"
-#include "signal.h"
-/*#include <winbase.h>
-#include <mmsystem.h>*/
-#include <errno.h>
-/*
-int getfilesystemtime(struct timeval *time_Info)
-{
-FILETIME ft;
-__int64 ff;
-
- GetSystemTimeAsFileTime(&ft); *//* 100 ns blocks since 01-Jan-1641 *//*
- *//* resolution seems to be 0.01 sec *//*
- ff = *(__int64*)(&ft);
- time_Info->tv_sec = (int)(ff/(__int64)10000000-(__int64)11644473600);
- time_Info->tv_usec = (int)(ff % 10000000)/10;
- return 0;
-}
-*/
-
-
-int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info)
-{
-#ifdef NETWARE
- return 0;
-#else
- static struct timeval starttime = {0, 0};
- static __int64 lasttime = 0;
- static __int64 freq = 0;
- __int64 timer;
- LARGE_INTEGER li;
- BOOL b;
- double dt;
-
- /* Get the time, if they want it */
- if (time_Info != NULL) {
- if (starttime.tv_sec == 0) {
- b = QueryPerformanceFrequency(&li);
- if (!b) {
- starttime.tv_sec = -1;
- }
- else {
- freq = li.QuadPart;
- b = QueryPerformanceCounter(&li);
- if (!b) {
- starttime.tv_sec = -1;
- }
- else {
- getfilesystemtime(&starttime);
- timer = li.QuadPart;
- dt = (double)timer/freq;
- starttime.tv_usec -= (int)((dt-(int)dt)*1000000);
- if (starttime.tv_usec < 0) {
- starttime.tv_usec += 1000000;
- --starttime.tv_sec;
- }
- starttime.tv_sec -= (int)dt;
- }
- }
- }
- if (starttime.tv_sec > 0) {
- b = QueryPerformanceCounter(&li);
- if (!b) {
- starttime.tv_sec = -1;
- }
- else {
- timer = li.QuadPart;
- if (timer < lasttime) {
- getfilesystemtime(time_Info);
- dt = (double)timer/freq;
- starttime = *time_Info;
- starttime.tv_usec -= (int)((dt-(int)dt)*1000000);
- if (starttime.tv_usec < 0) {
- starttime.tv_usec += 1000000;
- --starttime.tv_sec;
- }
- starttime.tv_sec -= (int)dt;
- }
- else {
- lasttime = timer;
- dt = (double)timer/freq;
- time_Info->tv_sec = starttime.tv_sec + (int)dt;
- time_Info->tv_usec = starttime.tv_usec + (int)((dt-(int)dt)*1000000);
- if (time_Info->tv_usec > 1000000) {
- time_Info->tv_usec -= 1000000;
- ++time_Info->tv_sec;
- }
- }
- }
- }
- if (starttime.tv_sec < 0) {
- getfilesystemtime(time_Info);
- }
-
- }
- /* Get the timezone, if they want it */
- if (timezone_Info != NULL) {
- _tzset();
- timezone_Info->tz_minuteswest = _timezone;
- timezone_Info->tz_dsttime = _daylight;
- }
- /* And return */
- return 0;
-#endif
-}
-
-
-/* this usleep isnt exactly accurate but should do ok */
-/*
-void usleep(unsigned int useconds)
-{
-struct timeval tnow, tthen, t0;
-
- gettimeofday(&tthen, NULL);
- t0 = tthen;
- tthen.tv_usec += useconds;
- while (tthen.tv_usec > 1000000) {
- tthen.tv_usec -= 1000000;
- tthen.tv_sec++;
- }
-
- if (useconds > 10000) {
- useconds -= 10000;
- Sleep(useconds/1000);
- }
-
- while (1) {
- gettimeofday(&tnow, NULL);
- if (tnow.tv_sec > tthen.tv_sec) {
- break;
- }
- if (tnow.tv_sec == tthen.tv_sec) {
- if (tnow.tv_usec > tthen.tv_usec) {
- break;
- }
- }
- }
-}
-*/
-
-#ifdef HAVE_SETITIMER
-
-/*
-#ifndef THREAD_SAFE
-unsigned int proftimer, virttimer, realtimer;
-extern LPMSG phpmsg;
-#endif
-
-struct timer_msg {
- int signal;
- unsigned int threadid;
-};
-
-
-LPTIMECALLBACK setitimer_timeout(UINT uTimerID, UINT info, DWORD dwUser, DWORD dw1, DWORD dw2)
-{
- struct timer_msg *msg = (struct timer_msg *) info;
-
- if (msg) {
- raise((int) msg->signal);
- PostThreadMessage(msg->threadid,
- WM_NOTIFY, msg->signal, 0);
- free(msg);
- }
- return 0;
-}
-
-int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
-{
- int timeout = value->it_value.tv_sec * 1000 + value->it_value.tv_usec;
- int repeat = TIME_ONESHOT;
-*/
- /*make sure the message queue is initialized *//*
- PeekMessage(phpmsg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
- if (timeout > 0) {
- struct timer_msg *msg = malloc(sizeof(struct timer_msg));
- msg->threadid = GetCurrentThreadId();
- if (!ovalue) {
- repeat = TIME_PERIODIC;
- }
- switch (which) {
- case ITIMER_REAL:
- msg->signal = SIGALRM;
- realtimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
- break;
- case ITIMER_VIRT:
- msg->signal = SIGVTALRM;
- virttimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
- break;
- case ITIMER_PROF:
- msg->signal = SIGPROF;
- proftimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
- break;
- default:
- errno = EINVAL;
- return -1;
- break;
- }
- } else {
- switch (which) {
- case ITIMER_REAL:
- timeKillEvent(realtimer);
- break;
- case ITIMER_VIRT:
- timeKillEvent(virttimer);
- break;
- case ITIMER_PROF:
- timeKillEvent(proftimer);
- break;
- default:
- errno = EINVAL;
- return -1;
- break;
- }
- }
-
-
- return 0;
-}
-*/
-#endif
diff --git a/netware/time_nw.h b/netware/time_nw.h
deleted file mode 100644
index c67065fdf2..0000000000
--- a/netware/time_nw.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*****************************************************************************
- * *
- * sys/time.h *
- * *
- * Freely redistributable and modifiable. Use at your own risk. *
- * *
- * Copyright 1994 The Downhill Project *
- *
- * Modified by Shane Caraveo for PHP
- *
- *****************************************************************************/
-#ifndef TIME_H
-#define TIME_H
-
-/* Include stuff ************************************************************ */
-#ifdef USE_WINSOCK
-/*#include <ws2nlm.h>*/
-#include <novsock2.h>
-#else
-#include <sys/socket.h>
-#endif
-#include <time.h>
-
-/*
-Commented out most of the stuff for now, since we dunno the utility right now
-*/
-
-/* Struct stuff ************************************************************* */
-/*
-struct {
- int tz_minuteswest;
- int tz_dsttime;
-} timezone;
-*/
-/*
-struct {
- struct timeval it_interval; *//* next value *//*
- struct timeval it_value; *//* current value *//*
-} itimerval;
-*/
-#define ITIMER_REAL 0 /*generates sigalrm */
-#define ITIMER_VIRTUAL 1 /*generates sigvtalrm */
-#define ITIMER_VIRT 1 /*generates sigvtalrm */
-#define ITIMER_PROF 2 /*generates sigprof */
-
-/* Prototype stuff ********************************************************** */
-/*
-extern int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info);
-*/
-
-/* setitimer operates at 100 millisecond resolution */
-/*
-extern int setitimer(int which, const struct itimerval *value,
- struct itimerval *ovalue);
-*/
-
-#endif
diff --git a/netware/tsrm.mak b/netware/tsrm.mak
deleted file mode 100644
index d0088ecb4a..0000000000
--- a/netware/tsrm.mak
+++ /dev/null
@@ -1,109 +0,0 @@
-# Temporarily here -- later may go into some batch file
-# which will set this as an environment variable
-PROJECT_ROOT = ..
-
-# Module details
-MODULE_NAME = TSRM
-
-#include the common settings
-include $(PROJECT_ROOT)/netware/common.mif
-
-# Extensions of all input and output files
-.SUFFIXES:
-.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d
-
-# Source files
-CPP_SRC =
-C_SRC = TSRM.c \
- tsrm_nw.c \
- tsrm_strtok_r.c \
- tsrm_virtual_cwd.c
-
-# Destination directories and files
-OBJ_DIR = $(BUILD)
-FINAL_DIR = $(BUILD)
-OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.obj) $(C_SRC:.c=.obj))
-DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.d) $(C_SRC:.c=.d))
-
-# Binary file
-ifndef BINARY
- BINARY=$(FINAL_DIR)\$(MODULE_NAME).lib
-endif
-
-# Compile flags
-C_FLAGS = -c -maxerrors 25 -msgstyle gcc
-C_FLAGS += -wchar_t on -bool on
-C_FLAGS += -processor Pentium
-C_FLAGS += -nostdinc
-C_FLAGS += -relax_pointers # To remove type-casting errors
-C_FLAGS += -DZTS -DNETWARE -DHAVE_DIRENT_H=1
-C_FLAGS += -DNEW_LIBC
-C_FLAGS += -DUSE_MKFIFO
-C_FLAGS += -DCLIB_STAT_PATCH
-#C_FLAGS += -DUSE_MPK # To use the LibC recursive mutex locking
-C_FLAGS += -I. -I- -I../netware -I$(SDK_DIR)/include # ../netware added for special SYS/STAT.H
-C_FLAGS += -I$(MPK_DIR)/include1
-C_FLAGS += -I$(MWCIncludes)
-
-
-# Link flags
-LD_FLAGS = -type library
-LD_FLAGS += -o $(BINARY)
-
-# Extra stuff based on debug / release builds
-ifeq '$(BUILD)' 'debug'
- C_FLAGS += -inline smart -sym on -sym codeview4 -sym internal -opt off -opt intrinsics -DTSRM_DEBUG=1
- LD_FLAGS += -sym codeview4 -sym internal
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib
-else
- C_FLAGS += -opt speed -inline smart -inline auto -sym off -DTSRM_DEBUG=0
- LD_FLAGS += -sym off
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
-endif
-
-# Virtual paths
-vpath %.cpp .
-vpath %.c .
-vpath %.obj $(OBJ_DIR)
-
-
-all: prebuild project
-
-.PHONY: all
-
-prebuild:
- @if not exist $(OBJ_DIR) md $(OBJ_DIR)
-
-project: $(BINARY) $(MESSAGE)
- @echo Build complete.
-
-$(OBJ_DIR)/%.d: %.c
- @echo Building Dependencies for $(<F)
- @$(CC) -M $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.obj: %.c
- @echo Compiling $?...
- @$(CC) $< $(C_FLAGS) -o $@
-
-$(BINARY): $(OBJECTS)
- @echo Linking $@...
- @$(LINK) $(LD_FLAGS) $(OBJECTS)
-
-
-.PHONY: clean
-clean: cleanobj cleanbin
-
-.PHONY: cleand
-cleand:
- @echo Deleting all dependency files...
- -@del "$(OBJ_DIR)\*.d"
-
-.PHONY: cleanobj
-cleanobj:
- @echo Deleting all object files...
- -@del "$(OBJ_DIR)\*.obj"
-
-.PHONY: cleanbin
-cleanbin:
- @echo Deleting binary files...
- -@del "$(FINAL_DIR)\$(MODULE_NAME).lib"
diff --git a/netware/wfile.c b/netware/wfile.c
deleted file mode 100644
index a887ee93df..0000000000
--- a/netware/wfile.c
+++ /dev/null
@@ -1,17 +0,0 @@
-
-/* Function borrowed from the Downhill Project */
-#include "wfile.h"
-/*#include "direct.h"*/ /* Can't find this file */
-
-int readlink(char *file_Name, char *buf_Mem, int buf_Size)
-{
- /* See if the file exists */
- if (access(file_Name, X_OK) == -1) {
- errno = ENOENT;
- } else {
- errno = EINVAL;
- }
-
- /* Either way, it's not a link */
- return -1;
-}
diff --git a/netware/wfile.h b/netware/wfile.h
deleted file mode 100644
index 7a9614c2cf..0000000000
--- a/netware/wfile.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*#include <io.h> */
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#define access _access
-#define X_OK 0
-#ifndef ENOENT
-#define ENOENT 136
-#endif
-#ifndef EINVAL
-#define EINVAL 131
-#endif
-
-int readlink(char *, char *, int);
-int checkroot(char *path);
diff --git a/netware/zend.mak b/netware/zend.mak
deleted file mode 100644
index 77b1074808..0000000000
--- a/netware/zend.mak
+++ /dev/null
@@ -1,158 +0,0 @@
-# Temporarily here -- later may go into some batch file
-# which will set this as an environment variable
-PROJECT_ROOT = ..
-
-# Module details
-MODULE_NAME = ZEND
-
-#include the common settings
-include $(PROJECT_ROOT)/netware/common.mif
-
-# Extensions of all input and output files
-.SUFFIXES:
-.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d
-
-C_SRC = zend.c \
- zend_alloc.c \
- zend_API.c \
- zend_builtin_functions.c \
- zend_compile.c \
- zend_constants.c \
- zend_dynamic_array.c \
- zend_execute.c \
- zend_execute_API.c \
- zend_extensions.c \
- zend_hash.c \
- zend_highlight.c \
- zend_indent.c \
- zend_ini.c \
- zend_ini_parser.c \
- zend_ini_scanner.c \
- zend_language_parser.c \
- zend_language_scanner.c \
- zend_list.c \
- zend_llist.c \
- zend_multibyte.c \
- zend_opcode.c \
- zend_operators.c \
- zend_ptr_stack.c \
- zend_qsort.c \
- zend_sprintf.c \
- zend_stack.c \
- zend_static_allocator.c \
- zend_variables.c
-
-
-# Destination directories and files
-OBJ_DIR = $(BUILD)
-FINAL_DIR = $(BUILD)
-OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.obj) $(C_SRC:.c=.obj))
-DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC:.cpp=.d) $(C_SRC:.c=.d))
-
-# Binary file
-ifndef BINARY
- BINARY=$(FINAL_DIR)\$(MODULE_NAME).lib
-endif
-
-
-# Compile flags
-C_FLAGS = -c -maxerrors 25 -msgstyle std
-C_FLAGS += -wchar_t on -bool on
-C_FLAGS += -processor Pentium
-C_FLAGS += -nostdinc
-C_FLAGS += -relax_pointers # To remove type-casting errors
-C_FLAGS += -D__C9X_CMATH_INLINES_DEFINED
-C_FLAGS += -DNETWARE -DZTS
-C_FLAGS += -DNEW_LIBC
-C_FLAGS += -DCLIB_STAT_PATCH
-C_FLAGS += -DTHREAD_SWITCH
-
-# These are required to use dlclose so that the PHP extensions are automatically unloaded
-# when apache is unloaded
-C_FLAGS += -DHAVE_DLFCN_H -DHAVE_LIBDL
-
-C_FLAGS += -I. -I- -I../netware -I$(SDK_DIR)/include # ../netware added for special SYS/STAT.H
-C_FLAGS += -I$(MWCIncludes)
-
-
-# Link flags
-LD_FLAGS = -type library
-LD_FLAGS += -o $(BINARY)
-
-
-# Extra stuff based on debug / release builds
-ifeq '$(BUILD)' 'debug'
- C_FLAGS += -DZEND_DEBUG=1
- C_FLAGS += -inline smart -sym on -sym codeview4 -sym internal -opt off -opt intrinsics
- LD_FLAGS += -sym codeview4 -sym internal
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib
-else
- C_FLAGS += -opt speed -inline on -inline auto -sym off
- C_FLAGS += -DZEND_DEBUG=0
- LD_FLAGS += -sym off
- export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
-endif
-
-
-# Virtual paths
-vpath %.cpp .
-vpath %.c .
-vpath %.obj $(OBJ_DIR)
-
-
-all: prebuild project
-
-.PHONY: all
-
-prebuild:
- @if not exist $(OBJ_DIR) md $(OBJ_DIR)
-
-project: $(BINARY) $(MESSAGE)
- @echo Build complete.
-
-
-$(OBJ_DIR)/%.d: %.c
- @echo Building Dependencies for $(<F)
- @$(CC) -M $< $(C_FLAGS) -o $@
-
-$(OBJ_DIR)/%.obj: %.c
- @echo Compiling $?...
- @$(CC) $< $(C_FLAGS) -o $@
-
-
-$(BINARY): $(OBJECTS)
- @echo Linking $@...
- @$(LINK) $(LD_FLAGS) $(OBJECTS)
-
-
-.PHONY: clean
-clean: cleansrc cleanobj cleanbin
-
-.PHONY: cleansrc
-cleansrc:
- @echo Deleting all generated source files...
- -@del "zend_ini_parser.c"
- -@del "zend_ini_parser.h"
- -@del "zend_ini_scanner.c"
- -@del "zend_language_parser.c"
- -@del "zend_language_parser.h"
- -@del "zend_language_scanner.c"
- -@del "zend_ini_parser.output"
- -@del "zend_language_parser.output"
-
-
-.PHONY: cleand
-cleand:
- @echo Deleting all dependency files...
- -@del "$(OBJ_DIR)\*.d"
-
-.PHONY: cleanobj
-cleanobj:
- @echo Deleting all object files...
- -@del "$(OBJ_DIR)\*.obj"
-
-.PHONY: cleanbin
-cleanbin:
- @echo Deleting binary files...
- -@del "$(FINAL_DIR)\$(MODULE_NAME).lib"
-
diff --git a/pear/Archive/Tar.php b/pear/Archive/Tar.php
deleted file mode 100644
index ff20b7eb56..0000000000
--- a/pear/Archive/Tar.php
+++ /dev/null
@@ -1,1301 +0,0 @@
-<?php
-/* vim: set ts=4 sw=4: */
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Vincent Blavet <vincent@blavet.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR.php';
-
-/**
-* Creates a (compressed) Tar archive
-*
-* @author Vincent Blavet <vincent@blavet.net>
-* @version $Revision$
-* @package Archive
-*/
-class Archive_Tar extends PEAR
-{
- /**
- * @var string Name of the Tar
- */
- var $_tarname='';
-
- /**
- * @var boolean if true, the Tar file will be gzipped
- */
- var $_compress=false;
-
- /**
- * @var file descriptor
- */
- var $_file=0;
-
- /**
- * @var string Local Tar name of a remote Tar (http:// or ftp://)
- */
- var $_temp_tarname='';
-
- // {{{ constructor
- /**
- * Archive_Tar Class constructor. This flavour of the constructor only
- * declare a new Archive_Tar object, identifying it by the name of the
- * tar file.
- * If the compress argument is set the tar will be read or created as a
- * gzip compressed TAR file.
- *
- * @param string $p_tarname The name of the tar archive to create
- * @param boolean $p_compress if true, the archive will be gezip(ped)
- * @access public
- */
- function Archive_Tar($p_tarname, $p_compress = null)
- {
- $this->PEAR();
- if ($p_compress === null) {
- if (@file_exists($p_tarname)) {
- if ($fp = @fopen($p_tarname, "r")) {
- // look for gzip magic cookie
- $data = fread($fp, 2);
- if ($data == "\37\213") {
- $p_compress = true;
- }
- }
- } else {
- // probably a remote file or some file accessible
- // through a stream interface
- if (substr($p_tarname, -2) == 'gz') {
- $p_compress = true;
- }
- }
- }
- $this->_tarname = $p_tarname;
- if ($p_compress) { // assert zlib extension support
- $extname = 'zlib';
- if (!extension_loaded($extname)) {
- if (OS_WINDOWS) {
- @dl("php_$extname.dll");
- } else {
- @dl("$extname.so");
- }
- }
- if (!extension_loaded($extname)) {
- die("The extension '$extname' couldn't be found.\n".
- "Please make sure your version of PHP was built".
- "with '$extname' support.\n");
- return false;
- }
- }
- $this->_compress = (bool)$p_compress;
- }
- // }}}
-
- // {{{ destructor
- function _Archive_Tar()
- {
- $this->_close();
- // ----- Look for a local copy to delete
- if ($this->_temp_tarname != '')
- @unlink($this->_temp_tarname);
- $this->_PEAR();
- }
- // }}}
-
- // {{{ create()
- /**
- * This method creates the archive file and add the files / directories
- * that are listed in $p_filelist.
- * If a file with the same name exist and is writable, it is replaced
- * by the new tar.
- * The method return false and a PEAR error text.
- * The $p_filelist parameter can be an array of string, each string
- * representing a filename or a directory name with their path if
- * needed. It can also be a single string with names separated by a
- * single blank.
- * For each directory added in the archive, the files and
- * sub-directories are also added.
- * See also createModify() method for more details.
- *
- * @param array $p_filelist An array of filenames and directory names, or a single
- * string with names separated by a single blank space.
- * @return true on success, false on error.
- * @see createModify()
- * @access public
- */
- function create($p_filelist)
- {
- return $this->createModify($p_filelist, '', '');
- }
- // }}}
-
- // {{{ add()
- /**
- * This method add the files / directories that are listed in $p_filelist in
- * the archive. If the archive does not exist it is created.
- * The method return false and a PEAR error text.
- * The files and directories listed are only added at the end of the archive,
- * even if a file with the same name is already archived.
- * See also createModify() method for more details.
- *
- * @param array $p_filelist An array of filenames and directory names, or a single
- * string with names separated by a single blank space.
- * @return true on success, false on error.
- * @see createModify()
- * @access public
- */
- function add($p_filelist)
- {
- return $this->addModify($p_filelist, '', '');
- }
- // }}}
-
- // {{{ extract()
- function extract($p_path='')
- {
- return $this->extractModify($p_path, '');
- }
- // }}}
-
- // {{{ listContent()
- function listContent()
- {
- $v_list_detail = array();
-
- if ($this->_openRead()) {
- if (!$this->_extractList('', $v_list_detail, "list", '', '')) {
- unset($v_list_detail);
- $v_list_detail = 0;
- }
- $this->_close();
- }
-
- return $v_list_detail;
- }
- // }}}
-
- // {{{ createModify()
- /**
- * This method creates the archive file and add the files / directories
- * that are listed in $p_filelist.
- * If the file already exists and is writable, it is replaced by the
- * new tar. It is a create and not an add. If the file exists and is
- * read-only or is a directory it is not replaced. The method return
- * false and a PEAR error text.
- * The $p_filelist parameter can be an array of string, each string
- * representing a filename or a directory name with their path if
- * needed. It can also be a single string with names separated by a
- * single blank.
- * The path indicated in $p_remove_dir will be removed from the
- * memorized path of each file / directory listed when this path
- * exists. By default nothing is removed (empty path '')
- * The path indicated in $p_add_dir will be added at the beginning of
- * the memorized path of each file / directory listed. However it can
- * be set to empty ''. The adding of a path is done after the removing
- * of path.
- * The path add/remove ability enables the user to prepare an archive
- * for extraction in a different path than the origin files are.
- * See also addModify() method for file adding properties.
- *
- * @param array $p_filelist An array of filenames and directory names, or a single
- * string with names separated by a single blank space.
- * @param string $p_add_dir A string which contains a path to be added to the
- * memorized path of each element in the list.
- * @param string $p_remove_dir A string which contains a path to be removed from
- * the memorized path of each element in the list, when
- * relevant.
- * @return boolean true on success, false on error.
- * @access public
- * @see addModify()
- */
- function createModify($p_filelist, $p_add_dir, $p_remove_dir='')
- {
- $v_result = true;
-
- if (!$this->_openWrite())
- return false;
-
- if ($p_filelist != '') {
- if (is_array($p_filelist))
- $v_list = $p_filelist;
- elseif (is_string($p_filelist))
- $v_list = explode(" ", $p_filelist);
- else {
- $this->_cleanFile();
- $this->_error('Invalid file list');
- return false;
- }
-
- $v_result = $this->_addList($v_list, $p_add_dir, $p_remove_dir);
- }
-
- if ($v_result) {
- $this->_writeFooter();
- $this->_close();
- } else
- $this->_cleanFile();
-
- return $v_result;
- }
- // }}}
-
- // {{{ addModify()
- /**
- * This method add the files / directories listed in $p_filelist at the
- * end of the existing archive. If the archive does not yet exists it
- * is created.
- * The $p_filelist parameter can be an array of string, each string
- * representing a filename or a directory name with their path if
- * needed. It can also be a single string with names separated by a
- * single blank.
- * The path indicated in $p_remove_dir will be removed from the
- * memorized path of each file / directory listed when this path
- * exists. By default nothing is removed (empty path '')
- * The path indicated in $p_add_dir will be added at the beginning of
- * the memorized path of each file / directory listed. However it can
- * be set to empty ''. The adding of a path is done after the removing
- * of path.
- * The path add/remove ability enables the user to prepare an archive
- * for extraction in a different path than the origin files are.
- * If a file/dir is already in the archive it will only be added at the
- * end of the archive. There is no update of the existing archived
- * file/dir. However while extracting the archive, the last file will
- * replace the first one. This results in a none optimization of the
- * archive size.
- * If a file/dir does not exist the file/dir is ignored. However an
- * error text is send to PEAR error.
- * If a file/dir is not readable the file/dir is ignored. However an
- * error text is send to PEAR error.
- *
- * @param array $p_filelist An array of filenames and directory names, or a single
- * string with names separated by a single blank space.
- * @param string $p_add_dir A string which contains a path to be added to the
- * memorized path of each element in the list.
- * @param string $p_remove_dir A string which contains a path to be removed from
- * the memorized path of each element in the list, when
- * relevant.
- * @return true on success, false on error.
- * @access public
- */
- function addModify($p_filelist, $p_add_dir, $p_remove_dir='')
- {
- $v_result = true;
-
- if (!@is_file($this->_tarname))
- $v_result = $this->createModify($p_filelist, $p_add_dir, $p_remove_dir);
- else {
- if (is_array($p_filelist))
- $v_list = $p_filelist;
- elseif (is_string($p_filelist))
- $v_list = explode(" ", $p_filelist);
- else {
- $this->_error('Invalid file list');
- return false;
- }
-
- $v_result = $this->_append($v_list, $p_add_dir, $p_remove_dir);
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ extractModify()
- /**
- * This method extract all the content of the archive in the directory
- * indicated by $p_path. When relevant the memorized path of the
- * files/dir can be modified by removing the $p_remove_path path at the
- * beginning of the file/dir path.
- * While extracting a file, if the directory path does not exists it is
- * created.
- * While extracting a file, if the file already exists it is replaced
- * without looking for last modification date.
- * While extracting a file, if the file already exists and is write
- * protected, the extraction is aborted.
- * While extracting a file, if a directory with the same name already
- * exists, the extraction is aborted.
- * While extracting a directory, if a file with the same name already
- * exists, the extraction is aborted.
- * While extracting a file/directory if the destination directory exist
- * and is write protected, or does not exist but can not be created,
- * the extraction is aborted.
- * If after extraction an extracted file does not show the correct
- * stored file size, the extraction is aborted.
- * When the extraction is aborted, a PEAR error text is set and false
- * is returned. However the result can be a partial extraction that may
- * need to be manually cleaned.
- *
- * @param string $p_path The path of the directory where the files/dir need to by
- * extracted.
- * @param string $p_remove_path Part of the memorized path that can be removed if
- * present at the beginning of the file/dir path.
- * @return boolean true on success, false on error.
- * @access public
- * @see extractList()
- */
- function extractModify($p_path, $p_remove_path)
- {
- $v_result = true;
- $v_list_detail = array();
-
- if ($v_result = $this->_openRead()) {
- $v_result = $this->_extractList($p_path, $v_list_detail, "complete", 0, $p_remove_path);
- $this->_close();
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ extractList()
- /**
- * This method extract from the archive only the files indicated in the
- * $p_filelist. These files are extracted in the current directory or
- * in the directory indicated by the optional $p_path parameter.
- * If indicated the $p_remove_path can be used in the same way as it is
- * used in extractModify() method.
- * @param array $p_filelist An array of filenames and directory names, or a single
- * string with names separated by a single blank space.
- * @param string $p_path The path of the directory where the files/dir need to by
- * extracted.
- * @param string $p_remove_path Part of the memorized path that can be removed if
- * present at the beginning of the file/dir path.
- * @return true on success, false on error.
- * @access public
- * @see extractModify()
- */
- function extractList($p_filelist, $p_path='', $p_remove_path='')
- {
- $v_result = true;
- $v_list_detail = array();
-
- if (is_array($p_filelist))
- $v_list = $p_filelist;
- elseif (is_string($p_filelist))
- $v_list = explode(" ", $p_filelist);
- else {
- $this->_error('Invalid string list');
- return false;
- }
-
- if ($v_result = $this->_openRead()) {
- $v_result = $this->_extractList($p_path, $v_list_detail, "partial", $v_list, $p_remove_path);
- $this->_close();
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ _error()
- function _error($p_message)
- {
- // ----- To be completed
- $this->raiseError($p_message);
- }
- // }}}
-
- // {{{ _warning()
- function _warning($p_message)
- {
- // ----- To be completed
- $this->raiseError($p_message);
- }
- // }}}
-
- // {{{ _openWrite()
- function _openWrite()
- {
- if ($this->_compress)
- $this->_file = @gzopen($this->_tarname, "w");
- else
- $this->_file = @fopen($this->_tarname, "w");
-
- if ($this->_file == 0) {
- $this->_error('Unable to open in write mode \''.$this->_tarname.'\'');
- return false;
- }
-
- return true;
- }
- // }}}
-
- // {{{ _openRead()
- function _openRead()
- {
- if (strtolower(substr($this->_tarname, 0, 7)) == 'http://') {
-
- // ----- Look if a local copy need to be done
- if ($this->_temp_tarname == '') {
- $this->_temp_tarname = uniqid('tar').'.tmp';
- if (!$v_file_from = @fopen($this->_tarname, 'rb')) {
- $this->_error('Unable to open in read mode \''.$this->_tarname.'\'');
- $this->_temp_tarname = '';
- return false;
- }
- if (!$v_file_to = @fopen($this->_temp_tarname, 'wb')) {
- $this->_error('Unable to open in write mode \''.$this->_temp_tarname.'\'');
- $this->_temp_tarname = '';
- return false;
- }
- while ($v_data = @fread($v_file_from, 1024))
- @fwrite($v_file_to, $v_data);
- @fclose($v_file_from);
- @fclose($v_file_to);
- }
-
- // ----- File to open if the local copy
- $v_filename = $this->_temp_tarname;
-
- } else
- // ----- File to open if the normal Tar file
- $v_filename = $this->_tarname;
-
- if ($this->_compress)
- $this->_file = @gzopen($v_filename, "rb");
- else
- $this->_file = @fopen($v_filename, "rb");
-
- if ($this->_file == 0) {
- $this->_error('Unable to open in read mode \''.$v_filename.'\'');
- return false;
- }
-
- return true;
- }
- // }}}
-
- // {{{ _openReadWrite()
- function _openReadWrite()
- {
- if ($this->_compress)
- $this->_file = @gzopen($this->_tarname, "r+b");
- else
- $this->_file = @fopen($this->_tarname, "r+b");
-
- if ($this->_file == 0) {
- $this->_error('Unable to open in read/write mode \''.$this->_tarname.'\'');
- return false;
- }
-
- return true;
- }
- // }}}
-
- // {{{ _close()
- function _close()
- {
- if (isset($this->_file)) {
- if ($this->_compress)
- @gzclose($this->_file);
- else
- @fclose($this->_file);
-
- $this->_file = 0;
- }
-
- // ----- Look if a local copy need to be erase
- // Note that it might be interesting to keep the url for a time : ToDo
- if ($this->_temp_tarname != '') {
- @unlink($this->_temp_tarname);
- $this->_temp_tarname = '';
- }
-
- return true;
- }
- // }}}
-
- // {{{ _cleanFile()
- function _cleanFile()
- {
- $this->_close();
-
- // ----- Look for a local copy
- if ($this->_temp_tarname != '') {
- // ----- Remove the local copy but not the remote tarname
- @unlink($this->_temp_tarname);
- $this->_temp_tarname = '';
- } else {
- // ----- Remove the local tarname file
- @unlink($this->_tarname);
- }
- $this->_tarname = '';
-
- return true;
- }
- // }}}
-
- // {{{ _writeFooter()
- function _writeFooter()
- {
- if ($this->_file) {
- // ----- Write the last 0 filled block for end of archive
- $v_binary_data = pack("a512", '');
- if ($this->_compress)
- @gzputs($this->_file, $v_binary_data);
- else
- @fputs($this->_file, $v_binary_data);
- }
- return true;
- }
- // }}}
-
- // {{{ _addList()
- function _addList($p_list, $p_add_dir, $p_remove_dir)
- {
- $v_result=true;
- $v_header = array();
-
- // ----- Remove potential windows directory separator
- $p_add_dir = $this->_translateWinPath($p_add_dir);
- $p_remove_dir = $this->_translateWinPath($p_remove_dir, false);
-
- if (!$this->_file) {
- $this->_error('Invalid file descriptor');
- return false;
- }
-
- if (sizeof($p_list) == 0)
- return true;
-
- for ($j=0; ($j<count($p_list)) && ($v_result); $j++) {
- $v_filename = $p_list[$j];
-
- // ----- Skip the current tar name
- if ($v_filename == $this->_tarname)
- continue;
-
- if ($v_filename == '')
- continue;
-
- if (!file_exists($v_filename)) {
- $this->_warning("File '$v_filename' does not exist");
- continue;
- }
-
- // ----- Add the file or directory header
- if (!$this->_addFile($v_filename, $v_header, $p_add_dir, $p_remove_dir))
- return false;
-
- if (@is_dir($v_filename)) {
- if (!($p_hdir = opendir($v_filename))) {
- $this->_warning("Directory '$v_filename' can not be read");
- continue;
- }
- $p_hitem = readdir($p_hdir); // '.' directory
- $p_hitem = readdir($p_hdir); // '..' directory
- while (false !== ($p_hitem = readdir($p_hdir))) {
- if ($v_filename != ".")
- $p_temp_list[0] = $v_filename.'/'.$p_hitem;
- else
- $p_temp_list[0] = $p_hitem;
-
- $v_result = $this->_addList($p_temp_list, $p_add_dir, $p_remove_dir);
- }
-
- unset($p_temp_list);
- unset($p_hdir);
- unset($p_hitem);
- }
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ _addFile()
- function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir)
- {
- if (!$this->_file) {
- $this->_error('Invalid file descriptor');
- return false;
- }
-
- if ($p_filename == '') {
- $this->_error('Invalid file name');
- return false;
- }
-
- // ----- Calculate the stored filename
- $p_filename = $this->_translateWinPath($p_filename, false);;
- $v_stored_filename = $p_filename;
- if (strcmp($p_filename, $p_remove_dir) == 0) {
- return true;
- }
- if ($p_remove_dir != '') {
- if (substr($p_remove_dir, -1) != '/')
- $p_remove_dir .= '/';
-
- if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir)
- $v_stored_filename = substr($p_filename, strlen($p_remove_dir));
- }
- $v_stored_filename = $this->_translateWinPath($v_stored_filename);
- if ($p_add_dir != '') {
- if (substr($p_add_dir, -1) == '/')
- $v_stored_filename = $p_add_dir.$v_stored_filename;
- else
- $v_stored_filename = $p_add_dir.'/'.$v_stored_filename;
- }
-
- $v_stored_filename = $this->_pathReduction($v_stored_filename);
-
- if (is_file($p_filename)) {
- if (($v_file = @fopen($p_filename, "rb")) == 0) {
- $this->_warning("Unable to open file '$p_filename' in binary read mode");
- return true;
- }
-
- if (!$this->_writeHeader($p_filename, $v_stored_filename))
- return false;
-
- while (($v_buffer = fread($v_file, 512)) != '') {
- $v_binary_data = pack("a512", "$v_buffer");
- if ($this->_compress)
- @gzputs($this->_file, $v_binary_data);
- else
- @fputs($this->_file, $v_binary_data);
- }
-
- fclose($v_file);
-
- } else {
- // ----- Only header for dir
- if (!$this->_writeHeader($p_filename, $v_stored_filename))
- return false;
- }
-
- return true;
- }
- // }}}
-
- // {{{ _writeHeader()
- function _writeHeader($p_filename, $p_stored_filename)
- {
- if ($p_stored_filename == '')
- $p_stored_filename = $p_filename;
- $v_reduce_filename = $this->_pathReduction($p_stored_filename);
-
- if (strlen($v_reduce_filename) > 99) {
- if (!$this->_writeLongHeader($p_stored_filename))
- return false;
- }
-
- $v_info = stat($p_filename);
- $v_uid = sprintf("%6s ", DecOct($v_info[4]));
- $v_gid = sprintf("%6s ", DecOct($v_info[5]));
- $v_perms = sprintf("%6s ", DecOct(fileperms($p_filename)));
-
- $v_mtime = sprintf("%11s", DecOct(filemtime($p_filename)));
-
- if (@is_dir($p_filename)) {
- $v_typeflag = "5";
- $v_size = sprintf("%11s ", DecOct(0));
- } else {
- $v_typeflag = '';
- clearstatcache();
- $v_size = sprintf("%11s ", DecOct(filesize($p_filename)));
- }
-
- $v_linkname = '';
-
- $v_magic = '';
-
- $v_version = '';
-
- $v_uname = '';
-
- $v_gname = '';
-
- $v_devmajor = '';
-
- $v_devminor = '';
-
- $v_prefix = '';
-
- $v_binary_data_first = pack("a100a8a8a8a12A12", $v_reduce_filename, $v_perms, $v_uid, $v_gid, $v_size, $v_mtime);
- $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12", $v_typeflag, $v_linkname, $v_magic, $v_version, $v_uname, $v_gname, $v_devmajor, $v_devminor, $v_prefix, '');
-
- // ----- Calculate the checksum
- $v_checksum = 0;
- // ..... First part of the header
- for ($i=0; $i<148; $i++)
- $v_checksum += ord(substr($v_binary_data_first,$i,1));
- // ..... Ignore the checksum value and replace it by ' ' (space)
- for ($i=148; $i<156; $i++)
- $v_checksum += ord(' ');
- // ..... Last part of the header
- for ($i=156, $j=0; $i<512; $i++, $j++)
- $v_checksum += ord(substr($v_binary_data_last,$j,1));
-
- // ----- Write the first 148 bytes of the header in the archive
- if ($this->_compress)
- @gzputs($this->_file, $v_binary_data_first, 148);
- else
- @fputs($this->_file, $v_binary_data_first, 148);
-
- // ----- Write the calculated checksum
- $v_checksum = sprintf("%6s ", DecOct($v_checksum));
- $v_binary_data = pack("a8", $v_checksum);
- if ($this->_compress)
- @gzputs($this->_file, $v_binary_data, 8);
- else
- @fputs($this->_file, $v_binary_data, 8);
-
- // ----- Write the last 356 bytes of the header in the archive
- if ($this->_compress)
- @gzputs($this->_file, $v_binary_data_last, 356);
- else
- @fputs($this->_file, $v_binary_data_last, 356);
-
- return true;
- }
- // }}}
-
- // {{{ _writeLongHeader()
- function _writeLongHeader($p_filename)
- {
- $v_size = sprintf("%11s ", DecOct(strlen($p_filename)));
-
- $v_typeflag = 'L';
-
- $v_linkname = '';
-
- $v_magic = '';
-
- $v_version = '';
-
- $v_uname = '';
-
- $v_gname = '';
-
- $v_devmajor = '';
-
- $v_devminor = '';
-
- $v_prefix = '';
-
- $v_binary_data_first = pack("a100a8a8a8a12A12", '././@LongLink', 0, 0, 0, $v_size, 0);
- $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12", $v_typeflag, $v_linkname, $v_magic, $v_version, $v_uname, $v_gname, $v_devmajor, $v_devminor, $v_prefix, '');
-
- // ----- Calculate the checksum
- $v_checksum = 0;
- // ..... First part of the header
- for ($i=0; $i<148; $i++)
- $v_checksum += ord(substr($v_binary_data_first,$i,1));
- // ..... Ignore the checksum value and replace it by ' ' (space)
- for ($i=148; $i<156; $i++)
- $v_checksum += ord(' ');
- // ..... Last part of the header
- for ($i=156, $j=0; $i<512; $i++, $j++)
- $v_checksum += ord(substr($v_binary_data_last,$j,1));
-
- // ----- Write the first 148 bytes of the header in the archive
- if ($this->_compress)
- @gzputs($this->_file, $v_binary_data_first, 148);
- else
- @fputs($this->_file, $v_binary_data_first, 148);
-
- // ----- Write the calculated checksum
- $v_checksum = sprintf("%6s ", DecOct($v_checksum));
- $v_binary_data = pack("a8", $v_checksum);
- if ($this->_compress)
- @gzputs($this->_file, $v_binary_data, 8);
- else
- @fputs($this->_file, $v_binary_data, 8);
-
- // ----- Write the last 356 bytes of the header in the archive
- if ($this->_compress)
- @gzputs($this->_file, $v_binary_data_last, 356);
- else
- @fputs($this->_file, $v_binary_data_last, 356);
-
- // ----- Write the filename as content of the block
- $i=0;
- while (($v_buffer = substr($p_filename, (($i++)*512), 512)) != '') {
- $v_binary_data = pack("a512", "$v_buffer");
- if ($this->_compress)
- @gzputs($this->_file, $v_binary_data);
- else
- @fputs($this->_file, $v_binary_data);
- }
-
- return true;
- }
- // }}}
-
- // {{{ _readHeader()
- function _readHeader($v_binary_data, &$v_header)
- {
- if (strlen($v_binary_data)==0) {
- $v_header['filename'] = '';
- return true;
- }
-
- if (strlen($v_binary_data) != 512) {
- $v_header['filename'] = '';
- $this->_error('Invalid block size : '.strlen($v_binary_data));
- return false;
- }
-
- // ----- Calculate the checksum
- $v_checksum = 0;
- // ..... First part of the header
- for ($i=0; $i<148; $i++)
- $v_checksum+=ord(substr($v_binary_data,$i,1));
- // ..... Ignore the checksum value and replace it by ' ' (space)
- for ($i=148; $i<156; $i++)
- $v_checksum += ord(' ');
- // ..... Last part of the header
- for ($i=156; $i<512; $i++)
- $v_checksum+=ord(substr($v_binary_data,$i,1));
-
- $v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor", $v_binary_data);
-
- // ----- Extract the checksum
- $v_header['checksum'] = OctDec(trim($v_data['checksum']));
- if ($v_header['checksum'] != $v_checksum) {
- $v_header['filename'] = '';
-
- // ----- Look for last block (empty block)
- if (($v_checksum == 256) && ($v_header['checksum'] == 0))
- return true;
-
- $this->_error('Invalid checksum : '.$v_checksum.' calculated, '.$v_header['checksum'].' expected');
- return false;
- }
-
- // ----- Extract the properties
- $v_header['filename'] = trim($v_data['filename']);
- $v_header['mode'] = OctDec(trim($v_data['mode']));
- $v_header['uid'] = OctDec(trim($v_data['uid']));
- $v_header['gid'] = OctDec(trim($v_data['gid']));
- $v_header['size'] = OctDec(trim($v_data['size']));
- $v_header['mtime'] = OctDec(trim($v_data['mtime']));
- if (($v_header['typeflag'] = $v_data['typeflag']) == "5") {
- $v_header['size'] = 0;
- }
- /* ----- All these fields are removed form the header because they do not carry interesting info
- $v_header[link] = trim($v_data[link]);
- $v_header[magic] = trim($v_data[magic]);
- $v_header[version] = trim($v_data[version]);
- $v_header[uname] = trim($v_data[uname]);
- $v_header[gname] = trim($v_data[gname]);
- $v_header[devmajor] = trim($v_data[devmajor]);
- $v_header[devminor] = trim($v_data[devminor]);
- */
-
- return true;
- }
- // }}}
-
- // {{{ _readLongHeader()
- function _readLongHeader(&$v_header)
- {
- $v_filename = '';
- $n = floor($v_header['size']/512);
- for ($i=0; $i<$n; $i++) {
- if ($this->_compress)
- $v_content = @gzread($this->_file, 512);
- else
- $v_content = @fread($this->_file, 512);
- $v_filename .= $v_content;
- }
- if (($v_header['size'] % 512) != 0) {
- if ($this->_compress)
- $v_content = @gzread($this->_file, 512);
- else
- $v_content = @fread($this->_file, 512);
- $v_filename .= $v_content;
- }
-
- // ----- Read the next header
- if ($this->_compress)
- $v_binary_data = @gzread($this->_file, 512);
- else
- $v_binary_data = @fread($this->_file, 512);
-
- if (!$this->_readHeader($v_binary_data, $v_header))
- return false;
-
- $v_header['filename'] = $v_filename;
-
- return true;
- }
- // }}}
-
- // {{{ _extractList()
- function _extractList($p_path, &$p_list_detail, $p_mode, $p_file_list, $p_remove_path)
- {
- $v_result=true;
- $v_nb = 0;
- $v_extract_all = true;
- $v_listing = false;
-
- $p_path = $this->_translateWinPath($p_path, false);
- if ($p_path == '' || (substr($p_path, 0, 1) != '/' && substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) {
- $p_path = "./".$p_path;
- }
- $p_remove_path = $this->_translateWinPath($p_remove_path);
-
- // ----- Look for path to remove format (should end by /)
- if (($p_remove_path != '') && (substr($p_remove_path, -1) != '/'))
- $p_remove_path .= '/';
- $p_remove_path_size = strlen($p_remove_path);
-
- switch ($p_mode) {
- case "complete" :
- $v_extract_all = TRUE;
- $v_listing = FALSE;
- break;
- case "partial" :
- $v_extract_all = FALSE;
- $v_listing = FALSE;
- break;
- case "list" :
- $v_extract_all = FALSE;
- $v_listing = TRUE;
- break;
- default :
- $this->_error('Invalid extract mode ('.$p_mode.')');
- return false;
- }
-
- clearstatcache();
-
- While (!($v_end_of_file = ($this->_compress?@gzeof($this->_file):@feof($this->_file))))
- {
- $v_extract_file = FALSE;
- $v_extraction_stopped = 0;
-
- if ($this->_compress)
- $v_binary_data = @gzread($this->_file, 512);
- else
- $v_binary_data = @fread($this->_file, 512);
-
- if (!$this->_readHeader($v_binary_data, $v_header))
- return false;
-
- if ($v_header['filename'] == '')
- continue;
-
- // ----- Look for long filename
- if ($v_header['typeflag'] == 'L') {
- if (!$this->_readLongHeader($v_header))
- return false;
- }
-
- if ((!$v_extract_all) && (is_array($p_file_list))) {
- // ----- By default no unzip if the file is not found
- $v_extract_file = false;
-
- for ($i=0; $i<sizeof($p_file_list); $i++) {
- // ----- Look if it is a directory
- if (substr($p_file_list[$i], -1) == '/') {
- // ----- Look if the directory is in the filename path
- if ((strlen($v_header['filename']) > strlen($p_file_list[$i])) && (substr($v_header['filename'], 0, strlen($p_file_list[$i])) == $p_file_list[$i])) {
- $v_extract_file = TRUE;
- break;
- }
- }
-
- // ----- It is a file, so compare the file names
- elseif ($p_file_list[$i] == $v_header['filename']) {
- $v_extract_file = TRUE;
- break;
- }
- }
- } else {
- $v_extract_file = TRUE;
- }
-
- // ----- Look if this file need to be extracted
- if (($v_extract_file) && (!$v_listing))
- {
- if (($p_remove_path != '')
- && (substr($v_header['filename'], 0, $p_remove_path_size) == $p_remove_path))
- $v_header['filename'] = substr($v_header['filename'], $p_remove_path_size);
- if (($p_path != './') && ($p_path != '/')) {
- while (substr($p_path, -1) == '/')
- $p_path = substr($p_path, 0, strlen($p_path)-1);
-
- if (substr($v_header['filename'], 0, 1) == '/')
- $v_header['filename'] = $p_path.$v_header['filename'];
- else
- $v_header['filename'] = $p_path.'/'.$v_header['filename'];
- }
- if (file_exists($v_header['filename'])) {
- if ((@is_dir($v_header['filename'])) && ($v_header['typeflag'] == '')) {
- $this->_error('File '.$v_header['filename'].' already exists as a directory');
- return false;
- }
- if ((is_file($v_header['filename'])) && ($v_header['typeflag'] == "5")) {
- $this->_error('Directory '.$v_header['filename'].' already exists as a file');
- return false;
- }
- if (!is_writeable($v_header['filename'])) {
- $this->_error('File '.$v_header['filename'].' already exists and is write protected');
- return false;
- }
- if (filemtime($v_header['filename']) > $v_header['mtime']) {
- // To be completed : An error or silent no replace ?
- }
- }
-
- // ----- Check the directory availability and create it if necessary
- elseif (($v_result = $this->_dirCheck(($v_header['typeflag'] == "5"?$v_header['filename']:dirname($v_header['filename'])))) != 1) {
- $this->_error('Unable to create path for '.$v_header['filename']);
- return false;
- }
-
- if ($v_extract_file) {
- if ($v_header['typeflag'] == "5") {
- if (!@file_exists($v_header['filename'])) {
- if (!@mkdir($v_header['filename'], 0777)) {
- $this->_error('Unable to create directory {'.$v_header['filename'].'}');
- return false;
- }
- }
- } else {
- if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0) {
- $this->_error('Error while opening {'.$v_header['filename'].'} in write binary mode');
- return false;
- } else {
- $n = floor($v_header['size']/512);
- for ($i=0; $i<$n; $i++) {
- if ($this->_compress)
- $v_content = @gzread($this->_file, 512);
- else
- $v_content = @fread($this->_file, 512);
- fwrite($v_dest_file, $v_content, 512);
- }
- if (($v_header['size'] % 512) != 0) {
- if ($this->_compress)
- $v_content = @gzread($this->_file, 512);
- else
- $v_content = @fread($this->_file, 512);
- fwrite($v_dest_file, $v_content, ($v_header['size'] % 512));
- }
-
- @fclose($v_dest_file);
-
- // ----- Change the file mode, mtime
- @touch($v_header['filename'], $v_header['mtime']);
- // To be completed
- //chmod($v_header[filename], DecOct($v_header[mode]));
- }
-
- // ----- Check the file size
- clearstatcache();
- if (filesize($v_header['filename']) != $v_header['size']) {
- $this->_error('Extracted file '.$v_header['filename'].' does not have the correct file size \''.filesize($v_filename).'\' ('.$v_header['size'].' expected). Archive may be corrupted.');
- return false;
- }
- }
- } else {
- // ----- Jump to next file
- if ($this->_compress)
- @gzseek($this->_file, @gztell($this->_file)+(ceil(($v_header['size']/512))*512));
- else
- @fseek($this->_file, @ftell($this->_file)+(ceil(($v_header['size']/512))*512));
- }
- } else {
- // ----- Jump to next file
- if ($this->_compress)
- @gzseek($this->_file, @gztell($this->_file)+(ceil(($v_header['size']/512))*512));
- else
- @fseek($this->_file, @ftell($this->_file)+(ceil(($v_header['size']/512))*512));
- }
-
- if ($this->_compress)
- $v_end_of_file = @gzeof($this->_file);
- else
- $v_end_of_file = @feof($this->_file);
-
- if ($v_listing || $v_extract_file || $v_extraction_stopped) {
- // ----- Log extracted files
- if (($v_file_dir = dirname($v_header['filename'])) == $v_header['filename'])
- $v_file_dir = '';
- if ((substr($v_header['filename'], 0, 1) == '/') && ($v_file_dir == ''))
- $v_file_dir = '/';
-
- $p_list_detail[$v_nb++] = $v_header;
- }
- }
-
- return true;
- }
- // }}}
-
- // {{{ _append()
- function _append($p_filelist, $p_add_dir='', $p_remove_dir='')
- {
- if ($this->_compress) {
- $this->_close();
-
- if (!@rename($this->_tarname, $this->_tarname.".tmp")) {
- $this->_error('Error while renaming \''.$this->_tarname.'\' to temporary file \''.$this->_tarname.'.tmp\'');
- return false;
- }
-
- if (($v_temp_tar = @gzopen($this->_tarname.".tmp", "rb")) == 0) {
- $this->_error('Unable to open file \''.$this->_tarname.'.tmp\' in binary read mode');
- @rename($this->_tarname.".tmp", $this->_tarname);
- return false;
- }
-
- if (!$this->_openWrite()) {
- @rename($this->_tarname.".tmp", $this->_tarname);
- return false;
- }
-
- $v_buffer = @gzread($v_temp_tar, 512);
-
- // ----- Read the following blocks but not the last one
- if (!@gzeof($v_temp_tar)) {
- do{
- $v_binary_data = pack("a512", "$v_buffer");
- @gzputs($this->_file, $v_binary_data);
- $v_buffer = @gzread($v_temp_tar, 512);
-
- } while (!@gzeof($v_temp_tar));
- }
-
- if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir))
- $this->_writeFooter();
-
- $this->_close();
- @gzclose($v_temp_tar);
-
- if (!@unlink($this->_tarname.".tmp")) {
- $this->_error('Error while deleting temporary file \''.$this->_tarname.'.tmp\'');
- }
-
- return true;
- }
-
- // ----- For not compressed tar, just add files before the last 512 bytes block
- if (!$this->_openReadWrite())
- return false;
-
- clearstatcache();
- $v_size = filesize($this->_tarname);
- fseek($this->_file, $v_size-512);
-
- if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir))
- $this->_writeFooter();
-
- $this->_close();
-
- return true;
- }
- // }}}
-
- // {{{ _dirCheck()
-
- /**
- * Check if a directory exists and create it (including parent
- * dirs) if not.
- *
- * @param string $p_dir directory to check
- *
- * @return bool TRUE if the directory exists or was created
- */
- function _dirCheck($p_dir)
- {
- if ((@is_dir($p_dir)) || ($p_dir == ''))
- return true;
-
- $p_parent_dir = dirname($p_dir);
-
- if (($p_parent_dir != $p_dir) &&
- ($p_parent_dir != '') &&
- (!$this->_dirCheck($p_parent_dir)))
- return false;
-
- if (!@mkdir($p_dir, 0777)) {
- $this->_error("Unable to create directory '$p_dir'");
- return false;
- }
-
- return true;
- }
-
- // }}}
-
- // {{{ _pathReduction()
-
- /**
- * Compress path by changing for example "/dir/foo/../bar" to "/dir/bar", and
- * remove double slashes.
- *
- * @param string $p_dir path to reduce
- *
- * @return string reduced path
- *
- * @access private
- *
- */
- function _pathReduction($p_dir)
- {
- $v_result = '';
-
- // ----- Look for not empty path
- if ($p_dir != '') {
- // ----- Explode path by directory names
- $v_list = explode('/', $p_dir);
-
- // ----- Study directories from last to first
- for ($i=sizeof($v_list)-1; $i>=0; $i--) {
- // ----- Look for current path
- if ($v_list[$i] == ".") {
- // ----- Ignore this directory
- // Should be the first $i=0, but no check is done
- }
- else if ($v_list[$i] == "..") {
- // ----- Ignore it and ignore the $i-1
- $i--;
- }
- else if (($v_list[$i] == '') && ($i!=(sizeof($v_list)-1)) && ($i!=0)) {
- // ----- Ignore only the double '//' in path,
- // but not the first and last /
- } else {
- $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?'/'.$v_result:'');
- }
- }
- }
- $v_result = strtr($v_result, '\\', '/');
- return $v_result;
- }
-
- // }}}
-
- // {{{ _translateWinPath()
- function _translateWinPath($p_path, $p_remove_disk_letter=true)
- {
- if (OS_WINDOWS) {
- // ----- Look for potential disk letter
- if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {
- $p_path = substr($p_path, $v_position+1);
- }
- // ----- Change potential windows directory separator
- if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
- $p_path = strtr($p_path, '\\', '/');
- }
- }
- return $p_path;
- }
- // }}}
-
-}
-?> \ No newline at end of file
diff --git a/pear/Archive/docs/Tar.txt b/pear/Archive/docs/Tar.txt
deleted file mode 100644
index 73bee0d786..0000000000
--- a/pear/Archive/docs/Tar.txt
+++ /dev/null
@@ -1,424 +0,0 @@
-Documentation for class Archive_Tar
-===================================
-Last update : 2001-08-15
-
-
-
-Overview :
-----------
-
- The Archive_Tar class helps in creating and managing GNU TAR format
- files compressed by GNU ZIP or not.
- The class offers basic functions like creating an archive, adding
- files in the archive, extracting files from the archive and listing
- the archive content.
- It also provide advanced functions that allow the adding and
- extraction of files with path manipulation.
-
-
-Sample :
---------
-
- // ----- Creating the object (uncompressed archive)
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT);
-
- // ----- Creating the archive
- $v_list[0]="file.txt";
- $v_list[1]="data/";
- $v_list[2]="file.log";
- $tar_object->create($v_list);
-
- // ----- Adding files
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/";
- $v_list[2]="log/file.log";
- $tar_object->add($v_list);
-
- // ----- Adding more files
- $tar_object->add("release/newfile.log release/readme.txt");
-
- // ----- Listing the content
- if (($v_list = $tar_object->listContent()) != 0)
- for ($i=0; $i<sizeof($v_list); $i++)
- {
- echo "Filename :'".$v_list[$i][filename]."'<br>";
- echo " .size :'".$v_list[$i][size]."'<br>";
- echo " .mtime :'".$v_list[$i][mtime]."' (".date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")<br>";
- echo " .mode :'".$v_list[$i][mode]."'<br>";
- echo " .uid :'".$v_list[$i][uid]."'<br>";
- echo " .gid :'".$v_list[$i][gid]."'<br>";
- echo " .typeflag :'".$v_list[$i][typeflag]."'<br>";
- }
-
- // ----- Extracting the archive in directory "install"
- $tar_object->extract("install");
-
-
-Public arguments :
-------------------
-
-None
-
-
-Public Methods :
-----------------
-
-Method : Archive_Tar($p_tarname, $compress = false)
-Description :
- Archive_Tar Class constructor. This flavour of the constructor only
- declare a new Archive_Tar object, identifying it by the name of the
- tar file.
- If the compress argument is set the tar will be read or created as a
- gzip compressed TAR file.
-Arguments :
- $p_tarname : A valid filename for the tar archive file.
- $p_compress : true/false. Indicate if the archive need to be
- compressed or not.
-Return value :
- The Archive_Tar object.
-Sample :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object_compressed = new Archive_Tar("tarname.tgz", true);
-How it works :
- Initialize the object.
-
-Method : create($p_filelist)
-Description :
- This method creates the archive file and add the files / directories
- that are listed in $p_filelist.
- If the file already exists and is writable, it is replaced by the
- new tar. It is a create and not an add. If the file exists and is
- read-only or is a directory it is not replaced. The method return
- false and a PEAR error text.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- See also createModify() method for more details.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $v_list[0]="file.txt";
- $v_list[1]="data/"; (Optional '/' at the end)
- $v_list[2]="file.log";
- $tar_object->create($v_list);
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $tar_object->create("file.txt data/ file.log");
-How it works :
- Just calling the createModify() method with the right parameters.
-
-Method : createModify($p_filelist, $p_add_dir, $p_remove_dir = "")
-Description :
- This method creates the archive file and add the files / directories
- that are listed in $p_filelist.
- If the file already exists and is writable, it is replaced by the
- new tar. It is a create and not an add. If the file exists and is
- read-only or is a directory it is not replaced. The method return
- false and a PEAR error text.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- The path indicated in $p_remove_dir will be removed from the
- memorized path of each file / directory listed when this path
- exists. By default nothing is removed (empty path "")
- The path indicated in $p_add_dir will be added at the beginning of
- the memorized path of each file / directory listed. However it can
- be set to empty "". The adding of a path is done after the removing
- of path.
- The path add/remove ability enables the user to prepare an archive
- for extraction in a different path than the origin files are.
- See also addModify() method for file adding properties.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
- $p_add_dir : A string which contains a path to be added to the
- memorized path of each element in the list.
- $p_remove_dir : A string which contains a path to be removed from
- the memorized path of each element in the list, when
- relevant.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $v_list[0]="file.txt";
- $v_list[1]="data/"; (Optional '/' at the end)
- $v_list[2]="file.log";
- $tar_object->createModify($v_list, "install");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/file.log
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->createModify($v_list, "install", "dev");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/log/file.log
-How it works :
- Open the file in write mode (erasing the existing one if one),
- call the _addList() method for adding the files in an empty archive,
- add the tar footer (512 bytes block), close the tar file.
-
-
-Method : addModify($p_filelist, $p_add_dir, $p_remove_dir="")
-Description :
- This method add the files / directories listed in $p_filelist at the
- end of the existing archive. If the archive does not yet exists it
- is created.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- The path indicated in $p_remove_dir will be removed from the
- memorized path of each file / directory listed when this path
- exists. By default nothing is removed (empty path "")
- The path indicated in $p_add_dir will be added at the beginning of
- the memorized path of each file / directory listed. However it can
- be set to empty "". The adding of a path is done after the removing
- of path.
- The path add/remove ability enables the user to prepare an archive
- for extraction in a different path than the origin files are.
- If a file/dir is already in the archive it will only be added at the
- end of the archive. There is no update of the existing archived
- file/dir. However while extracting the archive, the last file will
- replace the first one. This results in a none optimization of the
- archive size.
- If a file/dir does not exist the file/dir is ignored. However an
- error text is send to PEAR error.
- If a file/dir is not readable the file/dir is ignored. However an
- error text is send to PEAR error.
- If the resulting filename/dirname (after the add/remove option or
- not) string is greater than 99 char, the file/dir is
- ignored. However an error text is send to PEAR error.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
- $p_add_dir : A string which contains a path to be added to the
- memorized path of each element in the list.
- $p_remove_dir : A string which contains a path to be removed from
- the memorized path of each element in the list, when
- relevant.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->addModify($v_list, "install");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/file.log
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tar");
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->addModify($v_list, "install", "dev");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/log/file.log
-How it works :
- If the archive does not exists it create it and add the files.
- If the archive does exists and is not compressed, it open it, jump
- before the last empty 512 bytes block (tar footer) and add the files
- at this point.
- If the archive does exists and is compressed, a temporary copy file
- is created. This temporary file is then 'gzip' read block by block
- until the last empty block. The new files are then added in the
- compressed file.
- The adding of files is done by going through the file/dir list,
- adding files per files, in a recursive way through the
- directory. Each time a path need to be added/removed it is done
- before writing the file header in the archive.
-
-Method : add($p_filelist)
-Description :
- This method add the files / directories listed in $p_filelist at the
- end of the existing archive. If the archive does not yet exists it
- is created.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- See addModify() method for details and limitations.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->add($v_list);
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tgz", true);
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->add($v_list);
-How it works :
- Simply call the addModify() method with the right parameters.
-
-Method : extract($p_path = "")
-Description :
- This method extract all the content of the archive in the directory
- indicated by $p_path.If $p_path is optional, if not set the archive
- is extracted in the current directory.
- While extracting a file, if the directory path does not exists it is
- created.
- See extractModify() for details and limitations.
-Arguments :
- $p_path : Optional path where the files/dir need to by extracted.
-Return value :
- true on success, false on error.
-Sample :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->extract();
-How it works :
- Simply call the extractModify() method with appropriate parameters.
-
-Method : extractModify($p_path, $p_remove_path)
-Description :
- This method extract all the content of the archive in the directory
- indicated by $p_path. When relevant the memorized path of the
- files/dir can be modified by removing the $p_remove_path path at the
- beginning of the file/dir path.
- While extracting a file, if the directory path does not exists it is
- created.
- While extracting a file, if the file already exists it is replaced
- without looking for last modification date.
- While extracting a file, if the file already exists and is write
- protected, the extraction is aborted.
- While extracting a file, if a directory with the same name already
- exists, the extraction is aborted.
- While extracting a directory, if a file with the same name already
- exists, the extraction is aborted.
- While extracting a file/directory if the destination directory exist
- and is write protected, or does not exist but can not be created,
- the extraction is aborted.
- If after extraction an extracted file does not show the correct
- stored file size, the extraction is aborted.
- When the extraction is aborted, a PEAR error text is set and false
- is returned. However the result can be a partial extraction that may
- need to be manually cleaned.
-Arguments :
- $p_path : The path of the directory where the files/dir need to by
- extracted.
- $p_remove_path : Part of the memorized path that can be removed if
- present at the beginning of the file/dir path.
-Return value :
- true on success, false on error.
-Sample :
- // Imagine tarname.tar with files :
- // dev/data/file.txt
- // dev/data/log.txt
- // readme.txt
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->extractModify("install", "dev");
- // Files will be extracted there :
- // install/data/file.txt
- // install/data/log.txt
- // install/readme.txt
-How it works :
- Open the archive and call a more generic function that can extract
- only a part of the archive or all the archive.
- See extractList() method for more details.
-
-Method : listContent()
-Description :
- This method returns an array of arrays that describe each
- file/directory present in the archive.
- The array is not sorted, so it show the position of the file in the
- archive.
- The file informations are :
- $file[filename] : Name and path of the file/dir.
- $file[mode] : File permissions (result of fileperms())
- $file[uid] : user id
- $file[gid] : group id
- $file[size] : filesize
- $file[mtime] : Last modification time (result of filemtime())
- $file[typeflag] : "" for file, "5" for directory
-Arguments :
-Return value :
- An array of arrays or 0 on error.
-Sample :
- $tar_object = new Archive_Tar("tarname.tar");
- if (($v_list = $tar_object->listContent()) != 0)
- for ($i=0; $i<sizeof($v_list); $i++)
- {
- echo "Filename :'".$v_list[$i][filename]."'<br>";
- echo " .size :'".$v_list[$i][size]."'<br>";
- echo " .mtime :'".$v_list[$i][mtime]."' (".
- date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")<br>";
- echo " .mode :'".$v_list[$i][mode]."'<br>";
- echo " .uid :'".$v_list[$i][uid]."'<br>";
- echo " .gid :'".$v_list[$i][gid]."'<br>";
- echo " .typeflag :'".$v_list[$i][typeflag]."'<br>";
- }
-How it works :
- Call the same function as an extract however with a flag to only go
- through the archive without extracting the files.
-
-Method : extractList($p_filelist, $p_path = "", $p_remove_path = "")
-Description :
- This method extract from the archive only the files indicated in the
- $p_filelist. These files are extracted in the current directory or
- in the directory indicated by the optional $p_path parameter.
- If indicated the $p_remove_path can be used in the same way as it is
- used in extractModify() method.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
- $p_path : The path of the directory where the files/dir need to by
- extracted.
- $p_remove_path : Part of the memorized path that can be removed if
- present at the beginning of the file/dir path.
-Return value :
- true on success, false on error.
-Sample :
- // Imagine tarname.tar with files :
- // dev/data/file.txt
- // dev/data/log.txt
- // readme.txt
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->extractList("dev/data/file.txt readme.txt", "install",
- "dev");
- // Files will be extracted there :
- // install/data/file.txt
- // install/readme.txt
-How it works :
- Go through the archive and extract only the files present in the
- list.
-
diff --git a/pear/CMD.php b/pear/CMD.php
deleted file mode 100755
index f69f0f35f1..0000000000
--- a/pear/CMD.php
+++ /dev/null
@@ -1,285 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Anders Johannsen <anders@johannsen.com> |
-// +----------------------------------------------------------------------+
-//
-define('CMD_RCSID', '$Id$');
-
-/**
- * The Cmd:: class implements an abstraction for various ways
- * of executing commands (directly using the backtick operator,
- * as a background task after the script has terminated using
- * register_shutdown_function() or as a detached process using nohup).
- *
- * @author Anders Johannsen <anders@johannsen.com>
- * @version $Revision$
- **/
-
-require_once 'PEAR.php';
-
-
-class Cmd extends PEAR
-{
- var $arrSetting = array();
- var $arrConstant = array();
- var $arrCommand = array();
-
- /**
- * Class constructor
- *
- * Defines all necessary constants and sets defaults
- *
- * @author Anders Johannsen <anders@johannsen.com>
- *
- * @access public
- *
- **/
-
- function Cmd ()
- {
- // Defining constants
- $this->arrConstant = array ("CMD_SEQUENCE",
- "CMD_SHUTDOWN",
- "CMD_SHELL",
- "CMD_OUTPUT",
- "CMD_NOHUP",
- "CMD_VERBOSE"
- );
-
- foreach ($this->arrConstant as $key => $value) {
- if (!defined($value)) {
- define($value, $key);
- }
- }
-
- // Setting default values
- $this->arrSetting[CMD_SEQUENCE] = true;
- $this->arrSetting[CMD_SHUTDOWN] = false;
- $this->arrSetting[CMD_OUTPUT] = false;
- $this->arrSetting[CMD_NOHUP] = false;
- $this->arrSetting[CMD_VERBOSE] = false;
-
- $arrShell = array ("sh", "bash", "zsh", "tcsh", "csh", "ash", "sash", "esh", "ksh");
-
- foreach ($arrShell as $shell) {
- if ($this->arrSetting[CMD_SHELL] = $this->which($shell)) {
- break;
- }
- }
-
- if (empty($this->arrSetting[CMD_SHELL])) {
- $this->raiseError("No shell found");
- }
- }
-
- /**
- * Sets any option
- *
- * The options are currently:
- * CMD_SHUTDOWN : Execute commands via a shutdown function
- * CMD_SHELL : Path to shell
- * CMD_OUTPUT : Output stdout from process
- * CMD_NOHUP : Use nohup to detach process
- * CMD_VERBOSE : Print errors to stdout
- *
- * @param $option is a constant, which corresponds to the
- * option that should be changed
- *
- * @param $setting is the value of the option currently
- * being toggled.
- *
- * @return bool true if succes, else false
- *
- * @access public
- *
- * @author Anders Johannsen <anders@johannsen.com>
- *
- **/
-
- function setOption ($option, $setting)
- {
- if (empty($this->arrConstant[$option])) {
- $this->raiseError("No such option: $option");
- return false;
- }
-
-
- switch ($option) {
- case CMD_OUTPUT:
- case CMD_SHUTDOWN:
- case CMD_VERBOSE:
- case CMD_SEQUENCE:
- $this->arrSetting[$option] = $setting;
- return true;
- break;
-
- case CMD_SHELL:
- if (is_executable($setting)) {
- $this->arrSetting[$option] = $setting;
- return true;
- } else {
- $this->raiseError("No such shell: $setting");
- return false;
- }
- break;
-
-
- case CMD_NOHUP:
- if (empty($setting)) {
- $this->arrSetting[$option] = false;
-
- } else if ($location = $this->which("nohup")) {
- $this->arrSetting[$option] = true;
-
- } else {
- $this->raiseError("Nohup was not found on your system");
- return false;
- }
- break;
-
- }
- }
-
- /**
- * Add command for execution
- *
- * @param $command accepts both arrays and regular strings
- *
- * @return bool true if succes, else false
- *
- * @access public
- *
- * @author Anders Johannsen <anders@johannsen.com>
- *
- **/
-
- function command($command)
- {
- if (is_array($command)) {
- foreach ($command as $key => $value) {
- $this->arrCommand[] = $value;
- }
- return true;
-
- } else if (is_string($command)) {
- $this->arrCommand[] = $command;
- return true;
- }
-
- $this->raiseError("Argument not valid");
- return false;
- }
-
- /**
- * Executes the code according to given options
- *
- * @return bool true if succes, else false
- *
- * @access public
- *
- * @author Anders Johannsen <anders@johannsen.com>
- *
- **/
-
- function exec()
- {
- // Warning about impossible mix of options
- if (!empty($this->arrSetting[CMD_OUTPUT])) {
- if (!empty($this->arrSetting[CMD_SHUTDOWN]) || !empty($this->arrSetting[CMD_NOHUP])) {
- $this->raiseError("Error: Commands executed via shutdown functions or nohup cannot return output");
- return false;
- }
- }
-
- // Building command
- $strCommand = implode(";", $this->arrCommand);
-
- $strExec = "echo '$strCommand' | ".$this->arrSetting[CMD_SHELL];
-
- if (empty($this->arrSetting[CMD_OUTPUT])) {
- $strExec = $strExec . ' > /dev/null';
- }
-
- if (!empty($this->arrSetting[CMD_NOHUP])) {
- $strExec = 'nohup ' . $strExec;
- }
-
- // Executing
- if (!empty($this->arrSetting[CMD_SHUTDOWN])) {
- $line = "system(\"$strExec\");";
- $function = create_function('', $line);
- register_shutdown_function($function);
- return true;
- } else {
- return `$strExec`;
- }
- }
-
- /**
- * Errorhandler. If option CMD_VERBOSE is true,
- * the error is printed to stdout, otherwise it
- * is avaliable in lastError
- *
- * @return bool always returns true
- *
- * @access private
- *
- * @author Anders Johannsen <anders@johannsen.com>
- **/
-
- function raiseError($strError)
- {
- if (!empty($this->arrSetting[CMD_VERBOSE])) {
- echo $strError;
- } else {
- $this->lastError = $strError;
- }
-
- return true;
- }
-
- /**
- * Functionality similiar to unix 'which'. Searches the path
- * for the specified program.
- *
- * @param $cmd name of the executable to search for
- *
- * @return string returns the full path if found,
- * false if not
- *
- * @access private
- *
- * @author Anders Johannsen <anders@johannsen.com>
- **/
-
- function which($cmd)
- {
- global $HTTP_ENV_VARS;
-
- $arrPath = explode(":", $HTTP_ENV_VARS['PATH']);
-
- foreach ($arrPath as $path) {
- $location = $path . "/" . $cmd;
-
- if (is_executable($location)) {
- return $location;
- }
- }
- return false;
- }
-}
-
-?>
diff --git a/pear/CODING_STANDARDS b/pear/CODING_STANDARDS
deleted file mode 100644
index b42a70fbb8..0000000000
--- a/pear/CODING_STANDARDS
+++ /dev/null
@@ -1,8 +0,0 @@
-===========================================================================
-|| PEAR Coding Standards ||
-===========================================================================
-
-$Id$
-
-This document is no longer maintained, see
-http://pear.php.net/manual/ instead.
diff --git a/pear/Console/Getopt.php b/pear/Console/Getopt.php
deleted file mode 100644
index 8adad5e277..0000000000
--- a/pear/Console/Getopt.php
+++ /dev/null
@@ -1,225 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Andrei Zmievski <andrei@php.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR.php';
-
-/**
- * Command-line options parsing class.
- *
- * @author Andrei Zmievski <andrei@php.net>
- *
- */
-class Console_Getopt {
- /**
- * Parses the command-line options.
- *
- * The first parameter to this function should be the list of command-line
- * arguments without the leading reference to the running program.
- *
- * The second parameter is a string of allowed short options. Each of the
- * option letters can be followed by a colon ':' to specify that the option
- * requires an argument, or a double colon '::' to specify that the option
- * takes an optional argument.
- *
- * The third argument is an optional array of allowed long options. The
- * leading '--' should not be included in the option name. Options that
- * require an argument should be followed by '=', and options that take an
- * option argument should be followed by '=='.
- *
- * The return value is an array of two elements: the list of parsed
- * options and the list of non-option command-line arguments. Each entry in
- * the list of parsed options is a pair of elements - the first one
- * specifies the option, and the second one specifies the option argument,
- * if there was one.
- *
- * Long and short options can be mixed.
- *
- * Most of the semantics of this function are based on GNU getopt_long().
- *
- * @param array $args an array of command-line arguments
- * @param string $short_options specifies the list of allowed short options
- * @param array $long_options specifies the list of allowed long options
- *
- * @return array two-element array containing the list of parsed options and
- * the non-option arguments
- *
- * @access public
- *
- */
- function getopt($args, $short_options, $long_options = null)
- {
- // in case you pass directly readPHPArgv() as the first arg
- if (PEAR::isError($args)) {
- return $args;
- }
- if (empty($args)) {
- return array(array(), array());
- }
- $opts = array();
- $non_opts = array();
-
- settype($args, 'array');
-
- if ($long_options) {
- sort($long_options);
- }
- if (isset($args[0]{0}) && $args[0]{0} != '-') {
- array_shift($args);
- }
- reset($args);
- while (list($i, $arg) = each($args)) {
-
- /* The special element '--' means explicit end of
- options. Treat the rest of the arguments as non-options
- and end the loop. */
- if ($arg == '--') {
- $non_opts = array_merge($non_opts, array_slice($args, $i + 1));
- break;
- }
-
- if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) {
- $non_opts = array_merge($non_opts, array_slice($args, $i));
- break;
- } elseif (strlen($arg) > 1 && $arg{1} == '-') {
- $error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args);
- if (PEAR::isError($error))
- return $error;
- } else {
- $error = Console_Getopt::_parseShortOption(substr($arg, 1), $short_options, $opts, $args);
- if (PEAR::isError($error))
- return $error;
- }
- }
-
- return array($opts, $non_opts);
- }
-
- /**
- * @access private
- *
- */
- function _parseShortOption($arg, $short_options, &$opts, &$args)
- {
- for ($i = 0; $i < strlen($arg); $i++) {
- $opt = $arg{$i};
- $opt_arg = null;
-
- /* Try to find the short option in the specifier string. */
- if (($spec = strstr($short_options, $opt)) === false || $arg{$i} == ':')
- {
- return PEAR::raiseError("Console_Getopt: unrecognized option -- $opt");
- }
-
- if (strlen($spec) > 1 && $spec{1} == ':') {
- if (strlen($spec) > 2 && $spec{2} == ':') {
- if ($i + 1 < strlen($arg)) {
- /* Option takes an optional argument. Use the remainder of
- the arg string if there is anything left. */
- $opts[] = array($opt, substr($arg, $i + 1));
- break;
- }
- } else {
- /* Option requires an argument. Use the remainder of the arg
- string if there is anything left. */
- if ($i + 1 < strlen($arg)) {
- $opts[] = array($opt, substr($arg, $i + 1));
- break;
- } else if (list(, $opt_arg) = each($args))
- /* Else use the next argument. */;
- else
- return PEAR::raiseError("Console_Getopt: option requires an argument -- $opt");
- }
- }
-
- $opts[] = array($opt, $opt_arg);
- }
- }
-
- /**
- * @access private
- *
- */
- function _parseLongOption($arg, $long_options, &$opts, &$args)
- {
- @list($opt, $opt_arg) = explode('=', $arg);
- $opt_len = strlen($opt);
-
- for ($i = 0; $i < count($long_options); $i++) {
- $long_opt = $long_options[$i];
- $opt_start = substr($long_opt, 0, $opt_len);
-
- /* Option doesn't match. Go on to the next one. */
- if ($opt_start != $opt)
- continue;
-
- $opt_rest = substr($long_opt, $opt_len);
-
- /* Check that the options uniquely matches one of the allowed
- options. */
- if ($opt_rest != '' && $opt{0} != '=' &&
- $i + 1 < count($long_options) &&
- $opt == substr($long_options[$i+1], 0, $opt_len)) {
- return PEAR::raiseError("Console_Getopt: option --$opt is ambiguous");
- }
-
- if (substr($long_opt, -1) == '=') {
- if (substr($long_opt, -2) != '==') {
- /* Long option requires an argument.
- Take the next argument if one wasn't specified. */;
- if (!$opt_arg && !(list(, $opt_arg) = each($args))) {
- return PEAR::raiseError("Console_Getopt: option --$opt requires an argument");
- }
- }
- } else if ($opt_arg) {
- return PEAR::raiseError("Console_Getopt: option --$opt doesn't allow an argument");
- }
-
- $opts[] = array('--' . $opt, $opt_arg);
- return;
- }
-
- return PEAR::raiseError("Console_Getopt: unrecognized option --$opt");
- }
-
- /**
- * Safely read the $argv PHP array across different PHP configurations.
- * Will take care on register_globals and register_argc_argv ini directives
- *
- * @access public
- * @return mixed the $argv PHP array or PEAR error if not registered
- */
- function readPHPArgv()
- {
- global $argv;
- if (!is_array($argv)) {
- if (!@is_array($_SERVER['argv'])) {
- if (!@is_array($GLOBALS['HTTP_SERVER_VARS']['argv'])) {
- return PEAR::raiseError("Console_Getopt: Could not read cmd args (register_argc_argv=Off?)");
- }
- return $GLOBALS['HTTP_SERVER_VARS']['argv'];
- }
- return $_SERVER['argv'];
- }
- return $argv;
- }
-
-}
-
-?>
diff --git a/pear/Console/tests/001-getopt.phpt b/pear/Console/tests/001-getopt.phpt
deleted file mode 100644
index 3985dc9beb..0000000000
--- a/pear/Console/tests/001-getopt.phpt
+++ /dev/null
@@ -1,68 +0,0 @@
---TEST--
-Console_Getopt
---SKIPIF--
-skip
---FILE--
-<?php
-
-error_reporting(E_ALL);
-chdir(dirname(__FILE__));
-include "../Getopt.php";
-PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s\n\n");
-
-function test($argstr, $optstr) {
- $argv = split('[[:space:]]+', $argstr);
- if (PEAR::isError($options = Console_Getopt::getopt($argv, $optstr))) {
- return;
- }
- $opts = $options[0];
- $non_opts = $options[1];
- $i = 0;
- print "options: ";
- foreach ($opts as $o => $d) {
- if ($i++ > 0) {
- print ", ";
- }
- print $d[0] . '=' . $d[1];
- }
- print "\n";
- print "params: " . implode(", ", $non_opts) . "\n";
- print "\n";
-}
-
-test("-abc", "abc");
-test("-abc foo", "abc");
-test("-abc foo", "abc:");
-test("-abc foo bar gazonk", "abc");
-test("-abc foo bar gazonk", "abc:");
-test("-a -b -c", "abc");
-test("-a -b -c", "abc:");
-test("-abc", "ab:c");
-test("-abc foo -bar gazonk", "abc");
-?>
---EXPECT--
-options: a=, b=, c=
-params:
-
-options: a=, b=, c=
-params: foo
-
-options: a=, b=, c=foo
-params:
-
-options: a=, b=, c=
-params: foo, bar, gazonk
-
-options: a=, b=, c=foo
-params: bar, gazonk
-
-options: a=, b=, c=
-params:
-
-Console_Getopt: option requires an argument -- c
-
-options: a=, b=c
-params:
-
-options: a=, b=, c=
-params: foo, -bar, gazonk
diff --git a/pear/Makefile.frag b/pear/Makefile.frag
deleted file mode 100644
index 022e80d747..0000000000
--- a/pear/Makefile.frag
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- makefile -*-
-
-peardir=$(PEAR_INSTALLDIR)
-
-# Skip all php.ini files altogether
-PEAR_INSTALL_FLAGS = -n -dsafe_mode=0
-
-install-pear-installer: $(top_builddir)/sapi/cli/php
- @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) $(srcdir)/install-pear.php $(srcdir)/package-*.xml
-
-install-pear-packages: $(top_builddir)/sapi/cli/php
- @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) $(srcdir)/install-pear.php $(srcdir)/packages/*.tar
-
-install-pear:
- @echo "Installing PEAR environment: $(INSTALL_ROOT)$(peardir)/"
- @if $(mkinstalldirs) $(INSTALL_ROOT)$(peardir); then \
- $(MAKE) -s install-pear-installer install-pear-packages; \
- else \
- cat $(srcdir)/install-pear.txt; \
- exit 5; \
- fi
-
diff --git a/pear/OS/Guess.php b/pear/OS/Guess.php
deleted file mode 100644
index 959476d69a..0000000000
--- a/pear/OS/Guess.php
+++ /dev/null
@@ -1,265 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@php.net> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-// {{{ uname examples
-
-// php_uname() without args returns the same as 'uname -a', or a PHP-custom
-// string for Windows.
-// PHP versions prior to 4.3 return the uname of the host where PHP was built,
-// as of 4.3 it returns the uname of the host running the PHP code.
-//
-// PC RedHat Linux 7.1:
-// Linux host.example.com 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
-//
-// PC Debian Potato:
-// Linux host 2.4.17 #2 SMP Tue Feb 12 15:10:04 CET 2002 i686 unknown
-//
-// PC FreeBSD 3.3:
-// FreeBSD host.example.com 3.3-STABLE FreeBSD 3.3-STABLE #0: Mon Feb 21 00:42:31 CET 2000 root@example.com:/usr/src/sys/compile/CONFIG i386
-//
-// PC FreeBSD 4.3:
-// FreeBSD host.example.com 4.3-RELEASE FreeBSD 4.3-RELEASE #1: Mon Jun 25 11:19:43 EDT 2001 root@example.com:/usr/src/sys/compile/CONFIG i386
-//
-// PC FreeBSD 4.5:
-// FreeBSD host.example.com 4.5-STABLE FreeBSD 4.5-STABLE #0: Wed Feb 6 23:59:23 CET 2002 root@example.com:/usr/src/sys/compile/CONFIG i386
-//
-// PC FreeBSD 4.5 w/uname from GNU shellutils:
-// FreeBSD host.example.com 4.5-STABLE FreeBSD 4.5-STABLE #0: Wed Feb i386 unknown
-//
-// HP 9000/712 HP-UX 10:
-// HP-UX iq B.10.10 A 9000/712 2008429113 two-user license
-//
-// HP 9000/712 HP-UX 10 w/uname from GNU shellutils:
-// HP-UX host B.10.10 A 9000/712 unknown
-//
-// IBM RS6000/550 AIX 4.3:
-// AIX host 3 4 000003531C00
-//
-// AIX 4.3 w/uname from GNU shellutils:
-// AIX host 3 4 000003531C00 unknown
-//
-// SGI Onyx IRIX 6.5 w/uname from GNU shellutils:
-// IRIX64 host 6.5 01091820 IP19 mips
-//
-// SGI Onyx IRIX 6.5:
-// IRIX64 host 6.5 01091820 IP19
-//
-// SparcStation 20 Solaris 8 w/uname from GNU shellutils:
-// SunOS host.example.com 5.8 Generic_108528-12 sun4m sparc
-//
-// SparcStation 20 Solaris 8:
-// SunOS host.example.com 5.8 Generic_108528-12 sun4m sparc SUNW,SPARCstation-20
-//
-
-// }}}
-
-/* TODO:
- * - define endianness, to allow matchSignature("bigend") etc.
- */
-
-class OS_Guess
-{
- var $sysname;
- var $nodename;
- var $cpu;
- var $release;
- var $extra;
-
- function OS_Guess($uname = null)
- {
- list($this->sysname,
- $this->release,
- $this->cpu,
- $this->extra,
- $this->nodename) = $this->parseSignature($uname);
- }
-
- function parseSignature($uname = null)
- {
- static $sysmap = array(
- 'HP-UX' => 'hpux',
- 'IRIX64' => 'irix',
- // Darwin?
- );
- static $cpumap = array(
- 'i586' => 'i386',
- 'i686' => 'i386',
- );
- if ($uname === null) {
- $uname = php_uname();
- }
- $parts = split('[[:space:]]+', trim($uname));
- $n = count($parts);
-
- $release = $machine = $cpu = '';
- $sysname = $parts[0];
- $nodename = $parts[1];
- $cpu = $parts[$n-1];
- $extra = '';
- if ($cpu == 'unknown') {
- $cpu = $parts[$n-2];
- }
-
- switch ($sysname) {
- case 'AIX':
- $release = "$parts[3].$parts[2]";
- break;
- case 'Windows':
- switch ($parts[1]) {
- case '95/98':
- $release = '9x';
- break;
- default:
- $release = $parts[1];
- break;
- }
- $cpu = 'i386';
- break;
- case 'Linux':
- $extra = $this->_detectGlibcVersion();
- // use only the first two digits from the kernel version
- $release = ereg_replace('^([[:digit:]]+\.[[:digit:]]+).*', '\1', $parts[2]);
- break;
- default:
- $release = ereg_replace('-.*', '', $parts[2]);
- break;
- }
-
-
- if (isset($sysmap[$sysname])) {
- $sysname = $sysmap[$sysname];
- } else {
- $sysname = strtolower($sysname);
- }
- if (isset($cpumap[$cpu])) {
- $cpu = $cpumap[$cpu];
- }
- return array($sysname, $release, $cpu, $extra, $nodename);
- }
-
- function _detectGlibcVersion()
- {
- // Use glibc's <features.h> header file to
- // get major and minor version number:
- include_once "System.php";
- $tmpfile = System::mktemp("glibctest");
- $fp = fopen($tmpfile, "w");
- fwrite($fp, "#include <features.h>\n__GLIBC__ __GLIBC_MINOR__\n");
- fclose($fp);
- $cpp = popen("/usr/bin/cpp $tmpfile", "r");
- $major = $minor = 0;
- while ($line = fgets($cpp, 1024)) {
- if ($line{0} == '#') {
- continue;
- }
- if (list($major, $minor) = explode(' ', trim($line))) {
- break;
- }
- }
- pclose($cpp);
- unlink($tmpfile);
- if (!($major && $minor) && file_exists('/lib/libc.so.6')) {
- // Let's try reading the libc.so.6 symlink
- if (ereg('^libc-([.*])\.so$', basename(readlink('/lib/libc.so.6')), $matches)) {
- list($major, $minor) = explode('.', $matches);
- }
- }
- if (!($major && $minor)) {
- return '';
- }
- return "glibc{$major}.{$minor}";
- }
-
- function getSignature()
- {
- if (empty($this->extra)) {
- return "{$this->sysname}-{$this->release}-{$this->cpu}";
- }
- return "{$this->sysname}-{$this->release}-{$this->cpu}-{$this->extra}";
- }
-
- function getSysname()
- {
- return $this->sysname;
- }
-
- function getNodename()
- {
- return $this->nodename;
- }
-
- function getCpu()
- {
- return $this->cpu;
- }
-
- function getRelease()
- {
- return $this->release;
- }
-
- function getExtra()
- {
- return $this->extra;
- }
-
- function matchSignature($match)
- {
- if (is_array($match)) {
- $fragments = $match;
- } else {
- $fragments = explode('-', $match);
- }
- $n = count($fragments);
- $matches = 0;
- if ($n > 0) {
- $matches += $this->_matchFragment($fragments[0], $this->sysname);
- }
- if ($n > 1) {
- $matches += $this->_matchFragment($fragments[1], $this->release);
- }
- if ($n > 2) {
- $matches += $this->_matchFragment($fragments[2], $this->cpu);
- }
- if ($n > 3) {
- $matches += $this->_matchFragment($fragments[3], $this->extra);
- }
- return ($matches == $n);
- }
-
- function _matchFragment($fragment, $value)
- {
- if (strcspn($fragment, '*?') < strlen($fragment)) {
- $reg = '^' . str_replace(array('*', '?', '/'), array('.*', '.', '\\/'), $fragment) . '$';
- return eregi($reg, $value);
- }
- return ($fragment == '*' || !strcasecmp($fragment, $value));
- }
-
-}
-
-/*
- * Local Variables:
- * indent-tabs-mode: nil
- * c-basic-offset: 4
- * End:
- */
-?>
diff --git a/pear/PEAR.php b/pear/PEAR.php
deleted file mode 100644
index 00977e6ab9..0000000000
--- a/pear/PEAR.php
+++ /dev/null
@@ -1,962 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PEAR, the PHP Extension and Application Repository |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.0 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Sterling Hughes <sterling@php.net> |
-// | Stig Bakken <ssb@php.net> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-define('PEAR_ERROR_RETURN', 1);
-define('PEAR_ERROR_PRINT', 2);
-define('PEAR_ERROR_TRIGGER', 4);
-define('PEAR_ERROR_DIE', 8);
-define('PEAR_ERROR_CALLBACK', 16);
-define('PEAR_ERROR_EXCEPTION', 32);
-define('PEAR_ZE2', (function_exists('version_compare') &&
- version_compare(zend_version(), "2-dev", "ge")));
-
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- define('OS_WINDOWS', true);
- define('OS_UNIX', false);
- define('PEAR_OS', 'Windows');
-} else {
- define('OS_WINDOWS', false);
- define('OS_UNIX', true);
- define('PEAR_OS', 'Unix'); // blatant assumption
-}
-
-$GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN;
-$GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE;
-$GLOBALS['_PEAR_destructor_object_list'] = array();
-$GLOBALS['_PEAR_shutdown_funcs'] = array();
-$GLOBALS['_PEAR_error_handler_stack'] = array();
-
-ini_set('track_errors', true);
-
-/**
- * Base class for other PEAR classes. Provides rudimentary
- * emulation of destructors.
- *
- * If you want a destructor in your class, inherit PEAR and make a
- * destructor method called _yourclassname (same name as the
- * constructor, but with a "_" prefix). Also, in your constructor you
- * have to call the PEAR constructor: $this->PEAR();.
- * The destructor method will be called without parameters. Note that
- * at in some SAPI implementations (such as Apache), any output during
- * the request shutdown (in which destructors are called) seems to be
- * discarded. If you need to get any debug information from your
- * destructor, use error_log(), syslog() or something similar.
- *
- * IMPORTANT! To use the emulated destructors you need to create the
- * objects by reference: $obj =& new PEAR_child;
- *
- * @since PHP 4.0.2
- * @author Stig Bakken <ssb@php.net>
- * @see http://pear.php.net/manual/
- */
-class PEAR
-{
- // {{{ properties
-
- /**
- * Whether to enable internal debug messages.
- *
- * @var bool
- * @access private
- */
- var $_debug = false;
-
- /**
- * Default error mode for this object.
- *
- * @var int
- * @access private
- */
- var $_default_error_mode = null;
-
- /**
- * Default error options used for this object when error mode
- * is PEAR_ERROR_TRIGGER.
- *
- * @var int
- * @access private
- */
- var $_default_error_options = null;
-
- /**
- * Default error handler (callback) for this object, if error mode is
- * PEAR_ERROR_CALLBACK.
- *
- * @var string
- * @access private
- */
- var $_default_error_handler = '';
-
- /**
- * Which class to use for error objects.
- *
- * @var string
- * @access private
- */
- var $_error_class = 'PEAR_Error';
-
- /**
- * An array of expected errors.
- *
- * @var array
- * @access private
- */
- var $_expected_errors = array();
-
- // }}}
-
- // {{{ constructor
-
- /**
- * Constructor. Registers this object in
- * $_PEAR_destructor_object_list for destructor emulation if a
- * destructor object exists.
- *
- * @param string $error_class (optional) which class to use for
- * error objects, defaults to PEAR_Error.
- * @access public
- * @return void
- */
- function PEAR($error_class = null)
- {
- $classname = get_class($this);
- if ($this->_debug) {
- print "PEAR constructor called, class=$classname\n";
- }
- if ($error_class !== null) {
- $this->_error_class = $error_class;
- }
- while ($classname) {
- $destructor = "_$classname";
- if (method_exists($this, $destructor)) {
- global $_PEAR_destructor_object_list;
- $_PEAR_destructor_object_list[] = &$this;
- break;
- } else {
- $classname = get_parent_class($classname);
- }
- }
- }
-
- // }}}
- // {{{ destructor
-
- /**
- * Destructor (the emulated type of...). Does nothing right now,
- * but is included for forward compatibility, so subclass
- * destructors should always call it.
- *
- * See the note in the class desciption about output from
- * destructors.
- *
- * @access public
- * @return void
- */
- function _PEAR() {
- if ($this->_debug) {
- printf("PEAR destructor called, class=%s\n", get_class($this));
- }
- }
-
- // }}}
- // {{{ getStaticProperty()
-
- /**
- * If you have a class that's mostly/entirely static, and you need static
- * properties, you can use this method to simulate them. Eg. in your method(s)
- * do this: $myVar = &PEAR::getStaticProperty('myVar');
- * You MUST use a reference, or they will not persist!
- *
- * @access public
- * @param string $class The calling classname, to prevent clashes
- * @param string $var The variable to retrieve.
- * @return mixed A reference to the variable. If not set it will be
- * auto initialised to NULL.
- */
- function &getStaticProperty($class, $var)
- {
- static $properties;
- return $properties[$class][$var];
- }
-
- // }}}
- // {{{ registerShutdownFunc()
-
- /**
- * Use this function to register a shutdown method for static
- * classes.
- *
- * @access public
- * @param mixed $func The function name (or array of class/method) to call
- * @param mixed $args The arguments to pass to the function
- * @return void
- */
- function registerShutdownFunc($func, $args = array())
- {
- $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args);
- }
-
- // }}}
- // {{{ isError()
-
- /**
- * Tell whether a value is a PEAR error.
- *
- * @param mixed $data the value to test
- * @param int $code if $data is an error object, return true
- * only if $obj->getCode() == $code
- * @access public
- * @return bool true if parameter is an error
- */
- function isError($data, $code = null)
- {
- if (is_object($data) && (get_class($data) == 'pear_error' ||
- is_subclass_of($data, 'pear_error'))) {
- if (is_null($code)) {
- return true;
- } elseif (is_string($code)) {
- return $data->getMessage() == $code;
- } else {
- return $data->getCode() == $code;
- }
- }
- return false;
- }
-
- // }}}
- // {{{ setErrorHandling()
-
- /**
- * Sets how errors generated by this object should be handled.
- * Can be invoked both in objects and statically. If called
- * statically, setErrorHandling sets the default behaviour for all
- * PEAR objects. If called in an object, setErrorHandling sets
- * the default behaviour for that object.
- *
- * @param int $mode
- * One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
- * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
- * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION.
- *
- * @param mixed $options
- * When $mode is PEAR_ERROR_TRIGGER, this is the error level (one
- * of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
- *
- * When $mode is PEAR_ERROR_CALLBACK, this parameter is expected
- * to be the callback function or method. A callback
- * function is a string with the name of the function, a
- * callback method is an array of two elements: the element
- * at index 0 is the object, and the element at index 1 is
- * the name of the method to call in the object.
- *
- * When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is
- * a printf format string used when printing the error
- * message.
- *
- * @access public
- * @return void
- * @see PEAR_ERROR_RETURN
- * @see PEAR_ERROR_PRINT
- * @see PEAR_ERROR_TRIGGER
- * @see PEAR_ERROR_DIE
- * @see PEAR_ERROR_CALLBACK
- * @see PEAR_ERROR_EXCEPTION
- *
- * @since PHP 4.0.5
- */
-
- function setErrorHandling($mode = null, $options = null)
- {
- if (isset($this)) {
- $setmode = &$this->_default_error_mode;
- $setoptions = &$this->_default_error_options;
- } else {
- $setmode = &$GLOBALS['_PEAR_default_error_mode'];
- $setoptions = &$GLOBALS['_PEAR_default_error_options'];
- }
-
- switch ($mode) {
- case PEAR_ERROR_RETURN:
- case PEAR_ERROR_PRINT:
- case PEAR_ERROR_TRIGGER:
- case PEAR_ERROR_DIE:
- case PEAR_ERROR_EXCEPTION:
- case null:
- $setmode = $mode;
- $setoptions = $options;
- break;
-
- case PEAR_ERROR_CALLBACK:
- $setmode = $mode;
- if ((is_string($options) && function_exists($options)) ||
- (is_array($options) && method_exists(@$options[0], @$options[1])))
- {
- $setoptions = $options;
- } else {
- trigger_error("invalid error callback", E_USER_WARNING);
- }
- break;
-
- default:
- trigger_error("invalid error mode", E_USER_WARNING);
- break;
- }
- }
-
- // }}}
- // {{{ expectError()
-
- /**
- * This method is used to tell which errors you expect to get.
- * Expected errors are always returned with error mode
- * PEAR_ERROR_RETURN. Expected error codes are stored in a stack,
- * and this method pushes a new element onto it. The list of
- * expected errors are in effect until they are popped off the
- * stack with the popExpect() method.
- *
- * Note that this method can not be called statically
- *
- * @param mixed $code a single error code or an array of error codes to expect
- *
- * @return int the new depth of the "expected errors" stack
- * @access public
- */
- function expectError($code = '*')
- {
- if (is_array($code)) {
- array_push($this->_expected_errors, $code);
- } else {
- array_push($this->_expected_errors, array($code));
- }
- return sizeof($this->_expected_errors);
- }
-
- // }}}
- // {{{ popExpect()
-
- /**
- * This method pops one element off the expected error codes
- * stack.
- *
- * @return array the list of error codes that were popped
- */
- function popExpect()
- {
- return array_pop($this->_expected_errors);
- }
-
- // }}}
- // {{{ _checkDelExpect()
-
- /**
- * This method checks unsets an error code if available
- *
- * @param mixed error code
- * @return bool true if the error code was unset, false otherwise
- * @access private
- * @since PHP 4.3.0
- */
- function _checkDelExpect($error_code)
- {
- $deleted = false;
-
- foreach ($this->_expected_errors AS $key => $error_array) {
- if (in_array($error_code, $error_array)) {
- unset($this->_expected_errors[$key][array_search($error_code, $error_array)]);
- $deleted = true;
- }
-
- // clean up empty arrays
- if (0 == count($this->_expected_errors[$key])) {
- unset($this->_expected_errors[$key]);
- }
- }
- return $deleted;
- }
-
- // }}}
- // {{{ delExpect()
-
- /**
- * This method deletes all occurences of the specified element from
- * the expected error codes stack.
- *
- * @param mixed $error_code error code that should be deleted
- * @return mixed list of error codes that were deleted or error
- * @access public
- * @since PHP 4.3.0
- */
- function delExpect($error_code)
- {
- $deleted = false;
-
- if ((is_array($error_code) && (0 != count($error_code)))) {
- // $error_code is a non-empty array here;
- // we walk through it trying to unset all
- // values
- foreach($error_code AS $key => $error) {
- if ($this->_checkDelExpect($error)) {
- $deleted = true;
- } else {
- $deleted = false;
- }
- }
- return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
- } elseif (!empty($error_code)) {
- // $error_code comes alone, trying to unset it
- if ($this->_checkDelExpect($error_code)) {
- return true;
- } else {
- return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
- }
- } else {
- // $error_code is empty
- return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME
- }
- }
-
- // }}}
- // {{{ raiseError()
-
- /**
- * This method is a wrapper that returns an instance of the
- * configured error class with this object's default error
- * handling applied. If the $mode and $options parameters are not
- * specified, the object's defaults are used.
- *
- * @param mixed $message a text error message or a PEAR error object
- *
- * @param int $code a numeric error code (it is up to your class
- * to define these if you want to use codes)
- *
- * @param int $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
- * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
- * PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION.
- *
- * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter
- * specifies the PHP-internal error level (one of
- * E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
- * If $mode is PEAR_ERROR_CALLBACK, this
- * parameter specifies the callback function or
- * method. In other error modes this parameter
- * is ignored.
- *
- * @param string $userinfo If you need to pass along for example debug
- * information, this parameter is meant for that.
- *
- * @param string $error_class The returned error object will be
- * instantiated from this class, if specified.
- *
- * @param bool $skipmsg If true, raiseError will only pass error codes,
- * the error message parameter will be dropped.
- *
- * @access public
- * @return object a PEAR error object
- * @see PEAR::setErrorHandling
- * @since PHP 4.0.5
- */
- function &raiseError($message = null,
- $code = null,
- $mode = null,
- $options = null,
- $userinfo = null,
- $error_class = null,
- $skipmsg = false)
- {
- // The error is yet a PEAR error object
- if (is_object($message)) {
- $code = $message->getCode();
- $userinfo = $message->getUserInfo();
- $error_class = $message->getType();
- $message = $message->getMessage();
- }
-
- if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) {
- if ($exp[0] == "*" ||
- (is_int(reset($exp)) && in_array($code, $exp)) ||
- (is_string(reset($exp)) && in_array($message, $exp))) {
- $mode = PEAR_ERROR_RETURN;
- }
- }
- // No mode given, try global ones
- if ($mode === null) {
- // Class error handler
- if (isset($this) && isset($this->_default_error_mode)) {
- $mode = $this->_default_error_mode;
- $options = $this->_default_error_options;
- // Global error handler
- } elseif (isset($GLOBALS['_PEAR_default_error_mode'])) {
- $mode = $GLOBALS['_PEAR_default_error_mode'];
- $options = $GLOBALS['_PEAR_default_error_options'];
- }
- }
-
- if ($error_class !== null) {
- $ec = $error_class;
- } elseif (isset($this) && isset($this->_error_class)) {
- $ec = $this->_error_class;
- } else {
- $ec = 'PEAR_Error';
- }
- if ($skipmsg) {
- return new $ec($code, $mode, $options, $userinfo);
- } else {
- return new $ec($message, $code, $mode, $options, $userinfo);
- }
- }
-
- // }}}
- // {{{ throwError()
-
- /**
- * Simpler form of raiseError with fewer options. In most cases
- * message, code and userinfo are enough.
- *
- * @param string $message
- *
- */
- function &throwError($message = null,
- $code = null,
- $userinfo = null)
- {
- if (isset($this) && is_subclass_of($this, 'PEAR_Error')) {
- return $this->raiseError($message, $code, null, null, $userinfo);
- } else {
- return PEAR::raiseError($message, $code, null, null, $userinfo);
- }
- }
-
- // }}}
- // {{{ pushErrorHandling()
-
- /**
- * Push a new error handler on top of the error handler options stack. With this
- * you can easily override the actual error handler for some code and restore
- * it later with popErrorHandling.
- *
- * @param mixed $mode (same as setErrorHandling)
- * @param mixed $options (same as setErrorHandling)
- *
- * @return bool Always true
- *
- * @see PEAR::setErrorHandling
- */
- function pushErrorHandling($mode, $options = null)
- {
- $stack = &$GLOBALS['_PEAR_error_handler_stack'];
- if (isset($this)) {
- $def_mode = &$this->_default_error_mode;
- $def_options = &$this->_default_error_options;
- } else {
- $def_mode = &$GLOBALS['_PEAR_default_error_mode'];
- $def_options = &$GLOBALS['_PEAR_default_error_options'];
- }
- $stack[] = array($def_mode, $def_options);
-
- if (isset($this)) {
- $this->setErrorHandling($mode, $options);
- } else {
- PEAR::setErrorHandling($mode, $options);
- }
- $stack[] = array($mode, $options);
- return true;
- }
-
- // }}}
- // {{{ popErrorHandling()
-
- /**
- * Pop the last error handler used
- *
- * @return bool Always true
- *
- * @see PEAR::pushErrorHandling
- */
- function popErrorHandling()
- {
- $stack = &$GLOBALS['_PEAR_error_handler_stack'];
- array_pop($stack);
- list($mode, $options) = $stack[sizeof($stack) - 1];
- array_pop($stack);
- if (isset($this)) {
- $this->setErrorHandling($mode, $options);
- } else {
- PEAR::setErrorHandling($mode, $options);
- }
- return true;
- }
-
- // }}}
- // {{{ loadExtension()
-
- /**
- * OS independant PHP extension load. Remember to take care
- * on the correct extension name for case sensitive OSes.
- *
- * @param string $ext The extension name
- * @return bool Success or not on the dl() call
- */
- function loadExtension($ext)
- {
- if (!extension_loaded($ext)) {
- if (OS_WINDOWS) {
- $suffix = '.dll';
- } elseif (PHP_OS == 'HP-UX') {
- $suffix = '.sl';
- } elseif (PHP_OS == 'AIX') {
- $suffix = '.a';
- } elseif (PHP_OS == 'OSX') {
- $suffix = '.bundle';
- } else {
- $suffix = '.so';
- }
- return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
- }
- return true;
- }
-
- // }}}
-}
-
-// {{{ _PEAR_call_destructors()
-
-function _PEAR_call_destructors()
-{
- global $_PEAR_destructor_object_list;
- if (is_array($_PEAR_destructor_object_list) &&
- sizeof($_PEAR_destructor_object_list))
- {
- reset($_PEAR_destructor_object_list);
- while (list($k, $objref) = each($_PEAR_destructor_object_list)) {
- $classname = get_class($objref);
- while ($classname) {
- $destructor = "_$classname";
- if (method_exists($objref, $destructor)) {
- $objref->$destructor();
- break;
- } else {
- $classname = get_parent_class($classname);
- }
- }
- }
- // Empty the object list to ensure that destructors are
- // not called more than once.
- $_PEAR_destructor_object_list = array();
- }
-
- // Now call the shutdown functions
- if (is_array($GLOBALS['_PEAR_shutdown_funcs']) AND !empty($GLOBALS['_PEAR_shutdown_funcs'])) {
- foreach ($GLOBALS['_PEAR_shutdown_funcs'] as $value) {
- call_user_func_array($value[0], $value[1]);
- }
- }
-}
-
-// }}}
-
-class PEAR_Error
-{
- // {{{ properties
-
- var $error_message_prefix = '';
- var $mode = PEAR_ERROR_RETURN;
- var $level = E_USER_NOTICE;
- var $code = -1;
- var $message = '';
- var $userinfo = '';
- var $backtrace = null;
-
- // }}}
- // {{{ constructor
-
- /**
- * PEAR_Error constructor
- *
- * @param string $message message
- *
- * @param int $code (optional) error code
- *
- * @param int $mode (optional) error mode, one of: PEAR_ERROR_RETURN,
- * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER,
- * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION
- *
- * @param mixed $options (optional) error level, _OR_ in the case of
- * PEAR_ERROR_CALLBACK, the callback function or object/method
- * tuple.
- *
- * @param string $userinfo (optional) additional user/debug info
- *
- * @access public
- *
- */
- function PEAR_Error($message = 'unknown error', $code = null,
- $mode = null, $options = null, $userinfo = null)
- {
- if ($mode === null) {
- $mode = PEAR_ERROR_RETURN;
- }
- $this->message = $message;
- $this->code = $code;
- $this->mode = $mode;
- $this->userinfo = $userinfo;
- if (function_exists("debug_backtrace")) {
- $this->backtrace = debug_backtrace();
- }
- if ($mode & PEAR_ERROR_CALLBACK) {
- $this->level = E_USER_NOTICE;
- $this->callback = $options;
- } else {
- if ($options === null) {
- $options = E_USER_NOTICE;
- }
- $this->level = $options;
- $this->callback = null;
- }
- if ($this->mode & PEAR_ERROR_PRINT) {
- if (is_null($options) || is_int($options)) {
- $format = "%s";
- } else {
- $format = $options;
- }
- printf($format, $this->getMessage());
- }
- if ($this->mode & PEAR_ERROR_TRIGGER) {
- trigger_error($this->getMessage(), $this->level);
- }
- if ($this->mode & PEAR_ERROR_DIE) {
- $msg = $this->getMessage();
- if (is_null($options) || is_int($options)) {
- $format = "%s";
- if (substr($msg, -1) != "\n") {
- $msg .= "\n";
- }
- } else {
- $format = $options;
- }
- die(sprintf($format, $msg));
- }
- if ($this->mode & PEAR_ERROR_CALLBACK) {
- if (is_string($this->callback) && strlen($this->callback)) {
- call_user_func($this->callback, $this);
- } elseif (is_array($this->callback) &&
- sizeof($this->callback) == 2 &&
- is_object($this->callback[0]) &&
- is_string($this->callback[1]) &&
- strlen($this->callback[1])) {
- @call_user_func($this->callback, $this);
- }
- }
- if (PEAR_ZE2 && $this->mode & PEAR_ERROR_EXCEPTION) {
- eval('throw $this;');
- }
- }
-
- // }}}
- // {{{ getMode()
-
- /**
- * Get the error mode from an error object.
- *
- * @return int error mode
- * @access public
- */
- function getMode() {
- return $this->mode;
- }
-
- // }}}
- // {{{ getCallback()
-
- /**
- * Get the callback function/method from an error object.
- *
- * @return mixed callback function or object/method array
- * @access public
- */
- function getCallback() {
- return $this->callback;
- }
-
- // }}}
- // {{{ getMessage()
-
-
- /**
- * Get the error message from an error object.
- *
- * @return string full error message
- * @access public
- */
- function getMessage()
- {
- return ($this->error_message_prefix . $this->message);
- }
-
-
- // }}}
- // {{{ getCode()
-
- /**
- * Get error code from an error object
- *
- * @return int error code
- * @access public
- */
- function getCode()
- {
- return $this->code;
- }
-
- // }}}
- // {{{ getType()
-
- /**
- * Get the name of this error/exception.
- *
- * @return string error/exception name (type)
- * @access public
- */
- function getType()
- {
- return get_class($this);
- }
-
- // }}}
- // {{{ getUserInfo()
-
- /**
- * Get additional user-supplied information.
- *
- * @return string user-supplied information
- * @access public
- */
- function getUserInfo()
- {
- return $this->userinfo;
- }
-
- // }}}
- // {{{ getDebugInfo()
-
- /**
- * Get additional debug information supplied by the application.
- *
- * @return string debug information
- * @access public
- */
- function getDebugInfo()
- {
- return $this->getUserInfo();
- }
-
- // }}}
- // {{{ getBacktrace()
-
- /**
- * Get the call backtrace from where the error was generated.
- * Supported with PHP 4.3.0 or newer.
- *
- * @param int $frame (optional) what frame to fetch
- * @return array Backtrace, or NULL if not available.
- * @access public
- */
- function getBacktrace($frame = null)
- {
- if ($frame === null) {
- return $this->backtrace;
- }
- return $this->backtrace[$frame];
- }
-
- // }}}
- // {{{ addUserInfo()
-
- function addUserInfo($info)
- {
- if (empty($this->userinfo)) {
- $this->userinfo = $info;
- } else {
- $this->userinfo .= " ** $info";
- }
- }
-
- // }}}
- // {{{ toString()
-
- /**
- * Make a string representation of this object.
- *
- * @return string a string with an object summary
- * @access public
- */
- function toString() {
- $modes = array();
- $levels = array(E_USER_NOTICE => 'notice',
- E_USER_WARNING => 'warning',
- E_USER_ERROR => 'error');
- if ($this->mode & PEAR_ERROR_CALLBACK) {
- if (is_array($this->callback)) {
- $callback = get_class($this->callback[0]) . '::' .
- $this->callback[1];
- } else {
- $callback = $this->callback;
- }
- return sprintf('[%s: message="%s" code=%d mode=callback '.
- 'callback=%s prefix="%s" info="%s"]',
- get_class($this), $this->message, $this->code,
- $callback, $this->error_message_prefix,
- $this->userinfo);
- }
- if ($this->mode & PEAR_ERROR_PRINT) {
- $modes[] = 'print';
- }
- if ($this->mode & PEAR_ERROR_TRIGGER) {
- $modes[] = 'trigger';
- }
- if ($this->mode & PEAR_ERROR_DIE) {
- $modes[] = 'die';
- }
- if ($this->mode & PEAR_ERROR_RETURN) {
- $modes[] = 'return';
- }
- return sprintf('[%s: message="%s" code=%d mode=%s level=%s '.
- 'prefix="%s" info="%s"]',
- get_class($this), $this->message, $this->code,
- implode("|", $modes), $levels[$this->level],
- $this->error_message_prefix,
- $this->userinfo);
- }
-
- // }}}
-}
-
-register_shutdown_function("_PEAR_call_destructors");
-
-/*
- * Local Variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-?>
diff --git a/pear/PEAR/Autoloader.php b/pear/PEAR/Autoloader.php
deleted file mode 100644
index 3fec4c19cf..0000000000
--- a/pear/PEAR/Autoloader.php
+++ /dev/null
@@ -1,186 +0,0 @@
-<?php
-// /* vim: set expandtab tabstop=4 shiftwidth=4: */
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Stig Bakken <ssb@php.net> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-if (!extension_loaded("overload")) {
- // die hard without ext/overload
- die("Rebuild PHP with the `overload' extension to use PEAR_Autoloader");
-}
-
-require_once "PEAR.php";
-
-/**
- * This class is for objects where you want to separate the code for
- * some methods into separate classes. This is useful if you have a
- * class with not-frequently-used methods that contain lots of code
- * that you would like to avoid always parsing.
- *
- * The PEAR_Autoloader class provides autoloading and aggregation.
- * The autoloading lets you set up in which classes the separated
- * methods are found. Aggregation is the technique used to import new
- * methods, an instance of each class providing separated methods is
- * stored and called every time the aggregated method is called.
- *
- * @author Stig Sæther Bakken <ssb@php.net>
- */
-class PEAR_Autoloader extends PEAR
-{
- /**
- * Map of methods and classes where they are defined
- *
- * @var array
- *
- * @access private
- */
- var $_autoload_map = array();
-
- /**
- * Map of methods and aggregate objects
- *
- * @var array
- *
- * @access private
- */
- var $_method_map = array();
-
- /**
- * Add one or more autoload entries.
- *
- * @param string $method which method to autoload
- *
- * @param string $classname (optional) which class to find the method in.
- * If the $method parameter is an array, this
- * parameter may be omitted (and will be ignored
- * if not), and the $method parameter will be
- * treated as an associative array with method
- * names as keys and class names as values.
- *
- * @return void
- *
- * @access public
- */
- function addAutoload($method, $classname = null)
- {
- if (is_array($method)) {
- $this->_autoload_map = array_merge($this->_autoload_map, $method);
- } else {
- $this->_autoload_map[$method] = $classname;
- }
- }
-
- /**
- * Remove an autoload entry.
- *
- * @param string $method which method to remove the autoload entry for
- *
- * @return bool TRUE if an entry was removed, FALSE if not
- *
- * @access public
- */
- function removeAutoload($method)
- {
- $ok = isset($this->_autoload_map[$method]);
- unset($this->_autoload_map[$method]);
- return $ok;
- }
-
- /**
- * Add an aggregate object to this object. If the specified class
- * is not defined, loading it will be attempted following PEAR's
- * file naming scheme. All the methods in the class will be
- * aggregated, except private ones (name starting with an
- * underscore) and constructors.
- *
- * @param string $classname what class to instantiate for the object.
- *
- * @return void
- *
- * @access public
- */
- function addAggregateObject($classname)
- {
- $classname = strtolower($classname);
- if (!class_exists($classname)) {
- $include_file = preg_replace('/[^a-z0-9]/i', '_', $classname);
- include_once $include_file;
- }
- $obj =& new $classname;
- $methods = get_class_methods($classname);
- foreach ($methods as $method) {
- // don't import priviate methods and constructors
- if ($method{0} != '_' && $method != $classname) {
- $this->_method_map[$method] = $obj;
- }
- }
- }
-
- /**
- * Remove an aggregate object.
- *
- * @param string $classname the class of the object to remove
- *
- * @return bool TRUE if an object was removed, FALSE if not
- *
- * @access public
- */
- function removeAggregateObject($classname)
- {
- $ok = false;
- $classname = strtolower($classname);
- reset($this->_method_map);
- while (list($method, $obj) = each($this->_method_map)) {
- if (get_class($obj) == $classname) {
- unset($this->_method_map[$method]);
- $ok = true;
- }
- }
- return $ok;
- }
-
- /**
- * Overloaded object call handler, called each time an
- * undefined/aggregated method is invoked. This method repeats
- * the call in the right aggregate object and passes on the return
- * value.
- *
- * @param string $method which method that was called
- *
- * @param string $args An array of the parameters passed in the
- * original call
- *
- * @return mixed The return value from the aggregated method, or a PEAR
- * error if the called method was unknown.
- */
- function __call($method, $args, &$retval)
- {
- if (empty($this->_method_map[$method]) && isset($this->_autoload_map[$method])) {
- $this->addAggregateObject($this->_autoload_map[$method]);
- }
- if (isset($this->_method_map[$method])) {
- $retval = call_user_func_array(array($this->_method_map[$method], $method), $args);
- return true;
- }
- return false;
- }
-}
-
-overload("PEAR_Autoloader");
-
-?>
diff --git a/pear/PEAR/Builder.php b/pear/PEAR/Builder.php
deleted file mode 100644
index c778623869..0000000000
--- a/pear/PEAR/Builder.php
+++ /dev/null
@@ -1,383 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Sæther Bakken <ssb@php.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR/Common.php';
-
-/**
- * Class to handle building (compiling) extensions.
- *
- * @author Stig Sæther Bakken <ssb@php.net>
- */
-class PEAR_Builder extends PEAR_Common
-{
- // {{{ properties
-
- var $php_api_version = 0;
- var $zend_module_api_no = 0;
- var $zend_extension_api_no = 0;
-
- var $extensions_built = array();
-
- var $current_callback = null;
-
- // used for msdev builds
- var $_lastline = null;
- var $_firstline = null;
- // }}}
- // {{{ constructor
-
- /**
- * PEAR_Builder constructor.
- *
- * @param object $ui user interface object (instance of PEAR_Frontend_*)
- *
- * @access public
- */
- function PEAR_Builder(&$ui)
- {
- parent::PEAR_Common();
- $this->setFrontendObject($ui);
- }
-
- // }}}
-
- // {{{ _build_win32()
-
- /**
- * Build an extension from source on windows.
- * requires msdev
- */
- function _build_win32($descfile, $callback = null)
- {
- if (PEAR::isError($info = $this->infoFromDescriptionFile($descfile))) {
- return $info;
- }
- $dir = dirname($descfile);
- $old_cwd = getcwd();
-
- if (!@chdir($dir)) {
- return $this->raiseError("could not chdir to $dir");
- }
- $this->log(2, "building in $dir");
-
- $dsp = $info['package'].'.dsp';
- if (!@is_file("$dir/$dsp")) {
- return $this->raiseError("The DSP $dsp does not exist.");
- }
- // XXX TODO: make release build type configurable
- $command = 'msdev '.$dsp.' /MAKE "'.$info['package']. ' - Release"';
-
- $this->current_callback = $callback;
- $err = $this->_runCommand($command, array(&$this, 'msdevCallback'));
- if (PEAR::isError($err)) {
- return $err;
- }
-
- // figure out the build platform and type
- $platform = 'Win32';
- $buildtype = 'Release';
- if (preg_match('/.*?'.$info['package'].'\s-\s(\w+)\s(.*?)-+/i',$this->_firstline,$matches)) {
- $platform = $matches[1];
- $buildtype = $matches[2];
- }
-
- if (preg_match('/(.*)?\s-\s(\d+).*?(\d+)/',$this->_lastline,$matches)) {
- if ($matches[2]) {
- // there were errors in the build
- return $this->raiseError("There were errors during compilation.");
- }
- $out = $matches[1];
- } else {
- return $this->raiseError("Did not understand the completion status returned from msdev.exe.");
- }
-
- // msdev doesn't tell us the output directory :/
- // open the dsp, find /out and use that directory
- $dsptext = join(file($dsp),'');
-
- // this regex depends on the build platform and type having been
- // correctly identified above.
- $regex ='/.*?!IF\s+"\$\(CFG\)"\s+==\s+("'.
- $info['package'].'\s-\s'.
- $platform.'\s'.
- $buildtype.'").*?'.
- '\/out:"(.*?)"/is';
-
- if ($dsptext && preg_match($regex,$dsptext,$matches)) {
- // what we get back is a relative path to the output file itself.
- $outfile = realpath($matches[2]);
- } else {
- return $this->raiseError("Could not retrieve output information from $dsp.");
- }
- if (@copy($outfile, "$dir/$out")) {
- $outfile = "$dir/$out";
- }
-
- $built_files[] = array(
- 'file' => "$outfile",
- 'php_api' => $this->php_api_version,
- 'zend_mod_api' => $this->zend_module_api_no,
- 'zend_ext_api' => $this->zend_extension_api_no,
- );
-
- return $built_files;
- }
- // }}}
-
- // {{{ msdevCallback()
- function msdevCallback($what, $data)
- {
- if (!$this->_firstline)
- $this->_firstline = $data;
- $this->_lastline = $data;
- }
- // }}}
-
- // {{{ build()
-
- /**
- * Build an extension from source. Runs "phpize" in the source
- * directory, but compiles in a temporary directory
- * (/var/tmp/pear-build-USER/PACKAGE-VERSION).
- *
- * @param string $descfile path to XML package description file
- *
- * @param mixed $callback callback function used to report output,
- * see PEAR_Builder::_runCommand for details
- *
- * @return array an array of associative arrays with built files,
- * format:
- * array( array( 'file' => '/path/to/ext.so',
- * 'php_api' => YYYYMMDD,
- * 'zend_mod_api' => YYYYMMDD,
- * 'zend_ext_api' => YYYYMMDD ),
- * ... )
- *
- * @access public
- *
- * @see PEAR_Builder::_runCommand
- * @see PEAR_Common::infoFromDescriptionFile
- */
- function build($descfile, $callback = null)
- {
- if (PEAR_OS == "Windows") {
- return $this->_build_win32($descfile,$callback);
- }
- if (PEAR_OS != 'Unix') {
- return $this->raiseError("building extensions not supported on this platform");
- }
- if (PEAR::isError($info = $this->infoFromDescriptionFile($descfile))) {
- return $info;
- }
- $dir = dirname($descfile);
- $old_cwd = getcwd();
- if (!@chdir($dir)) {
- return $this->raiseError("could not chdir to $dir");
- }
- $vdir = "$info[package]-$info[version]";
- if (is_dir($vdir)) {
- chdir($vdir);
- }
- $dir = getcwd();
- $this->log(2, "building in $dir");
- $this->current_callback = $callback;
- $err = $this->_runCommand("phpize", array(&$this, 'phpizeCallback'));
- if (PEAR::isError($err)) {
- return $err;
- }
- if (!$err) {
- return $this->raiseError("`phpize' failed");
- }
-
- // start of interactive part
- $configure_command = "$dir/configure";
- if (isset($info['configure_options'])) {
- foreach ($info['configure_options'] as $o) {
- list($r) = $this->ui->userDialog('build',
- array($o['prompt']),
- array('text'),
- array(@$o['default']));
- if (substr($o['name'], 0, 5) == 'with-' &&
- ($r == 'yes' || $r == 'autodetect')) {
- $configure_command .= " --$o[name]";
- } else {
- $configure_command .= " --$o[name]=$r";
- }
- }
- }
- // end of interactive part
-
- // make configurable
- if(!$user=getenv('USER')){
- $user='defaultuser';
- }
- $build_basedir = "/var/tmp/pear-build-$user";
- $build_dir = "$build_basedir/$info[package]-$info[version]";
- $this->log(1, "building in $build_dir");
- if (is_dir($build_dir)) {
- System::rm("-rf $build_dir");
- }
- if (!System::mkDir("-p $build_dir")) {
- return $this->raiseError("could not create build dir: $build_dir");
- }
- $this->addTempFile($build_dir);
- if (getenv('MAKE')) {
- $make_command = getenv('MAKE');
- } else {
- $make_command = 'make';
- }
- $to_run = array(
- $configure_command,
- $make_command,
- );
- if (!@chdir($build_dir)) {
- return $this->raiseError("could not chdir to $build_dir");
- }
- foreach ($to_run as $cmd) {
- $err = $this->_runCommand($cmd, $callback);
- if (PEAR::isError($err)) {
- chdir($old_cwd);
- return $err;
- }
- if (!$err) {
- chdir($old_cwd);
- return $this->raiseError("`$cmd' failed");
- }
- }
- if (!($dp = opendir("modules"))) {
- chdir($old_cwd);
- return $this->raiseError("no `modules' directory found");
- }
- $built_files = array();
- while ($ent = readdir($dp)) {
- if ($ent{0} == '.' || substr($ent, -3) == '.la') {
- continue;
- }
- // harvest!
- if (@copy("modules/$ent", "$dir/$ent")) {
- $built_files[] = array(
- 'file' => "$dir/$ent",
- 'php_api' => $this->php_api_version,
- 'zend_mod_api' => $this->zend_module_api_no,
- 'zend_ext_api' => $this->zend_extension_api_no,
- );
-
- $this->log(1, "$ent copied to $dir/$ent");
- } else {
- chdir($old_cwd);
- return $this->raiseError("failed copying $ent to $dir");
- }
- }
- closedir($dp);
- chdir($old_cwd);
- return $built_files;
- }
-
- // }}}
- // {{{ phpizeCallback()
-
- /**
- * Message callback function used when running the "phpize"
- * program. Extracts the API numbers used. Ignores other message
- * types than "cmdoutput".
- *
- * @param string $what the type of message
- * @param mixed $data the message
- *
- * @return void
- *
- * @access public
- */
- function phpizeCallback($what, $data)
- {
- if ($what != 'cmdoutput') {
- return;
- }
- $this->log(3, rtrim($data));
- if (preg_match('/You should update your .aclocal.m4/', $data)) {
- return;
- }
- $matches = array();
- if (preg_match('/^\s+(\S[^:]+):\s+(\d{8})/', $data, $matches)) {
- $member = preg_replace('/[^a-z]/', '_', strtolower($matches[1]));
- $apino = (int)$matches[2];
- if (isset($this->$member)) {
- $this->$member = $apino;
- $msg = sprintf("%-22s : %d", $matches[1], $apino);
- $this->log(1, $msg);
- }
- }
- }
-
- // }}}
- // {{{ _runCommand()
-
- /**
- * Run an external command, using a message callback to report
- * output. The command will be run through popen and output is
- * reported for every line with a "cmdoutput" message with the
- * line string, including newlines, as payload.
- *
- * @param string $command the command to run
- *
- * @param mixed $callback (optional) function to use as message
- * callback
- *
- * @return bool whether the command was successful (exit code 0
- * means success, any other means failure)
- *
- * @access private
- */
- function _runCommand($command, $callback = null)
- {
- $this->log(1, "running: $command");
- $pp = @popen("$command 2>&1", "r");
- if (!$pp) {
- return $this->raiseError("failed to run `$command'");
- }
- while ($line = fgets($pp, 1024)) {
- if ($callback) {
- call_user_func($callback, 'cmdoutput', $line);
- } else {
- $this->log(2, rtrim($line));
- }
- }
- $exitcode = @pclose($pp);
- return ($exitcode == 0);
- }
-
- // }}}
- // {{{ log()
-
- function log($level, $msg)
- {
- if ($this->current_callback) {
- if ($this->debug >= $level) {
- call_user_func($this->current_callback, 'output', $msg);
- }
- return;
- }
- return PEAR_Common::log($level, $msg);
- }
-
- // }}}
-}
-
-?>
diff --git a/pear/PEAR/Command.php b/pear/PEAR/Command.php
deleted file mode 100644
index 7e23acab32..0000000000
--- a/pear/PEAR/Command.php
+++ /dev/null
@@ -1,322 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Stig Bakken <ssb@php.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-
-require_once "PEAR.php";
-
-/**
- * List of commands and what classes they are implemented in.
- * @var array command => implementing class
- */
-$GLOBALS['_PEAR_Command_commandlist'] = array();
-
-/**
- * List of shortcuts to common commands.
- * @var array shortcut => command
- */
-$GLOBALS['_PEAR_Command_shortcuts'] = array();
-
-/**
- * Array of command objects
- * @var array class => object
- */
-$GLOBALS['_PEAR_Command_objects'] = array();
-
-/**
- * Which user interface class is being used.
- * @var string class name
- */
-$GLOBALS['_PEAR_Command_uiclass'] = 'PEAR_Frontend_CLI';
-
-/**
- * Instance of $_PEAR_Command_uiclass.
- * @var object
- */
-$GLOBALS['_PEAR_Command_uiobject'] = null;
-
-/**
- * PEAR command class, a simple factory class for administrative
- * commands.
- *
- * How to implement command classes:
- *
- * - The class must be called PEAR_Command_Nnn, installed in the
- * "PEAR/Common" subdir, with a method called getCommands() that
- * returns an array of the commands implemented by the class (see
- * PEAR/Command/Install.php for an example).
- *
- * - The class must implement a run() function that is called with three
- * params:
- *
- * (string) command name
- * (array) assoc array with options, freely defined by each
- * command, for example:
- * array('force' => true)
- * (array) list of the other parameters
- *
- * The run() function returns a PEAR_CommandResponse object. Use
- * these methods to get information:
- *
- * int getStatus() Returns PEAR_COMMAND_(SUCCESS|FAILURE|PARTIAL)
- * *_PARTIAL means that you need to issue at least
- * one more command to complete the operation
- * (used for example for validation steps).
- *
- * string getMessage() Returns a message for the user. Remember,
- * no HTML or other interface-specific markup.
- *
- * If something unexpected happens, run() returns a PEAR error.
- *
- * - DON'T OUTPUT ANYTHING! Return text for output instead.
- *
- * - DON'T USE HTML! The text you return will be used from both Gtk,
- * web and command-line interfaces, so for now, keep everything to
- * plain text.
- *
- * - DON'T USE EXIT OR DIE! Always use pear errors. From static
- * classes do PEAR::raiseError(), from other classes do
- * $this->raiseError().
- */
-class PEAR_Command
-{
- /**
- * Get the right object for executing a command.
- *
- * @param string $command The name of the command
- * @param object $config Instance of PEAR_Config object
- *
- * @return object the command object or a PEAR error
- *
- * @access public
- */
- function factory($command, &$config)
- {
- if (empty($GLOBALS['_PEAR_Command_commandlist'])) {
- PEAR_Command::registerCommands();
- }
- if (isset($GLOBALS['_PEAR_Command_shortcuts'][$command])) {
- $command = $GLOBALS['_PEAR_Command_shortcuts'][$command];
- }
- $class = @$GLOBALS['_PEAR_Command_commandlist'][$command];
- if (empty($class)) {
- return PEAR::raiseError("unknown command `$command'");
- }
- $ui = PEAR_Command::getFrontendObject();
- $obj = &new $class($ui, $config);
- return $obj;
- }
-
- /**
- * Get instance of frontend object.
- *
- * @return object
- */
- function &getFrontendObject()
- {
- if (empty($GLOBALS['_PEAR_Command_uiobject'])) {
- $GLOBALS['_PEAR_Command_uiobject'] = &new $GLOBALS['_PEAR_Command_uiclass'];
- }
- return $GLOBALS['_PEAR_Command_uiobject'];
- }
-
- /**
- * Load current frontend class.
- *
- * @param string $uiclass Name of class implementing the frontend
- *
- * @return object the frontend object, or a PEAR error
- */
- function &setFrontendClass($uiclass)
- {
- if (is_object($GLOBALS['_PEAR_Command_uiobject']) &&
- strtolower($uiclass) == get_class($GLOBALS['_PEAR_Command_uiobject'])) {
- return;
- }
- $file = str_replace('_', '/', $uiclass) . '.php';
- @include_once $file;
- if (class_exists(strtolower($uiclass))) {
- $obj = &new $uiclass;
- // quick test to see if this class implements a few of the most
- // important frontend methods
- if (method_exists($obj, 'userConfirm')) {
- $GLOBALS['_PEAR_Command_uiobject'] = &$obj;
- $GLOBALS['_PEAR_Command_uiclass'] = $uiclass;
- return $obj;
- } else {
- return PEAR::raiseError("not a frontend class: $uiclass");
- }
- }
- return PEAR::raiseError("no such class: $uiclass");
- }
-
- /**
- * Set current frontend.
- *
- * @param string $uitype Name of the frontend type (for example "CLI")
- *
- * @return object the frontend object, or a PEAR error
- */
- function setFrontendType($uitype)
- {
- $uiclass = 'PEAR_Frontend_' . $uitype;
- return PEAR_Command::setFrontendClass($uiclass);
- }
-
- /**
- * Scan through the Command directory looking for classes
- * and see what commands they implement.
- *
- * @param bool (optional) if FALSE (default), the new list of
- * commands should replace the current one. If TRUE,
- * new entries will be merged with old.
- *
- * @param string (optional) where (what directory) to look for
- * classes, defaults to the Command subdirectory of
- * the directory from where this file (__FILE__) is
- * included.
- *
- * @return bool TRUE on success, a PEAR error on failure
- *
- * @access public
- */
- function registerCommands($merge = false, $dir = null)
- {
- if ($dir === null) {
- $dir = dirname(__FILE__) . '/Command';
- }
- $dp = @opendir($dir);
- if (empty($dp)) {
- return PEAR::raiseError("registerCommands: opendir($dir) failed");
- }
- if (!$merge) {
- $GLOBALS['_PEAR_Command_commandlist'] = array();
- }
- while ($entry = readdir($dp)) {
- if ($entry{0} == '.' || substr($entry, -4) != '.php' || $entry == 'Common.php') {
- continue;
- }
- $class = "PEAR_Command_".substr($entry, 0, -4);
- $file = "$dir/$entry";
- include_once $file;
- // List of commands
- if (empty($GLOBALS['_PEAR_Command_objects'][$class])) {
- $GLOBALS['_PEAR_Command_objects'][$class] = &new $class($ui, $config);
- }
- $implements = $GLOBALS['_PEAR_Command_objects'][$class]->getCommands();
- foreach ($implements as $command => $desc) {
- $GLOBALS['_PEAR_Command_commandlist'][$command] = $class;
- $GLOBALS['_PEAR_Command_commanddesc'][$command] = $desc;
- }
- $shortcuts = $GLOBALS['_PEAR_Command_objects'][$class]->getShortcuts();
- foreach ($shortcuts as $shortcut => $command) {
- $GLOBALS['_PEAR_Command_shortcuts'][$shortcut] = $command;
- }
- }
- return true;
- }
-
- /**
- * Get the list of currently supported commands, and what
- * classes implement them.
- *
- * @return array command => implementing class
- *
- * @access public
- */
- function getCommands()
- {
- if (empty($GLOBALS['_PEAR_Command_commandlist'])) {
- PEAR_Command::registerCommands();
- }
- return $GLOBALS['_PEAR_Command_commandlist'];
- }
-
- /**
- * Get the list of command shortcuts.
- *
- * @return array shortcut => command
- *
- * @access public
- */
- function getShortcuts()
- {
- if (empty($GLOBALS['_PEAR_Command_shortcuts'])) {
- PEAR_Command::registerCommands();
- }
- return $GLOBALS['_PEAR_Command_shortcuts'];
- }
-
- /**
- * Compiles arguments for getopt.
- *
- * @param string $command command to get optstring for
- * @param string $short_args (reference) short getopt format
- * @param array $long_args (reference) long getopt format
- *
- * @return void
- *
- * @access public
- */
- function getGetoptArgs($command, &$short_args, &$long_args)
- {
- if (empty($GLOBALS['_PEAR_Command_commandlist'])) {
- PEAR_Command::registerCommands();
- }
- $class = @$GLOBALS['_PEAR_Command_commandlist'][$command];
- if (empty($class)) {
- return null;
- }
- $obj = &$GLOBALS['_PEAR_Command_objects'][$class];
- return $obj->getGetoptArgs($command, $short_args, $long_args);
- }
-
- /**
- * Get description for a command.
- *
- * @param string $command Name of the command
- *
- * @return string command description
- *
- * @access public
- */
- function getDescription($command)
- {
- return @$GLOBALS['_PEAR_Command_commanddesc'][$command];
- }
-
- /**
- * Get help for command.
- *
- * @param string $command Name of the command to return help for
- *
- * @access public
- */
- function getHelp($command)
- {
- $cmds = PEAR_Command::getCommands();
- if (isset($cmds[$command])) {
- $class = $cmds[$command];
- return $GLOBALS['_PEAR_Command_objects'][$class]->getHelp($command);
- }
- return false;
- }
-}
-
-?>
diff --git a/pear/PEAR/Command/Auth.php b/pear/PEAR/Command/Auth.php
deleted file mode 100644
index 3978ac6ec9..0000000000
--- a/pear/PEAR/Command/Auth.php
+++ /dev/null
@@ -1,155 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Stig Bakken <ssb@php.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once "PEAR/Command/Common.php";
-require_once "PEAR/Remote.php";
-require_once "PEAR/Config.php";
-
-/**
- * PEAR commands for managing configuration data.
- *
- */
-class PEAR_Command_Auth extends PEAR_Command_Common
-{
- // {{{ properties
-
- var $commands = array(
- 'login' => array(
- 'summary' => 'Connects and authenticates to remote server',
- 'shortcut' => 'li',
- 'function' => 'doLogin',
- 'options' => array(),
- 'doc' => '
-Log in to the remote server. To use remote functions in the installer
-that require any kind of privileges, you need to log in first. The
-username and password you enter here will be stored in your per-user
-PEAR configuration (~/.pearrc on Unix-like systems). After logging
-in, your username and password will be sent along in subsequent
-operations on the remote server.',
- ),
- 'logout' => array(
- 'summary' => 'Logs out from the remote server',
- 'shortcut' => 'lo',
- 'function' => 'doLogout',
- 'options' => array(),
- 'doc' => '
-Logs out from the remote server. This command does not actually
-connect to the remote server, it only deletes the stored username and
-password from your user configuration.',
- )
-
- );
-
- // }}}
-
- // {{{ constructor
-
- /**
- * PEAR_Command_Auth constructor.
- *
- * @access public
- */
- function PEAR_Command_Auth(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- // }}}
-
- // {{{ doLogin()
-
- /**
- * Execute the 'login' command.
- *
- * @param string $command command name
- *
- * @param array $options option_name => value
- *
- * @param array $params list of additional parameters
- *
- * @return bool TRUE on success, FALSE for unknown commands, or
- * a PEAR error on failure
- *
- * @access public
- */
- function doLogin($command, $options, $params)
- {
- $server = $this->config->get('master_server');
- $remote = new PEAR_Remote($this->config);
- $username = $this->config->get('username');
- if (empty($username)) {
- $username = @$_ENV['USER'];
- }
- $this->ui->outputData("Logging in to $server.", $command);
-
- list($username, $password) = $this->ui->userDialog(
- $command,
- array('Username', 'Password'),
- array('text', 'password'),
- array($username, '')
- );
- $username = trim($username);
- $password = trim($password);
-
- $this->config->set('username', $username);
- $this->config->set('password', $password);
-
- $remote->expectError(401);
- $ok = $remote->call('logintest');
- $remote->popExpect();
- if ($ok === true) {
- $this->ui->outputData("Logged in.", $command);
- $this->config->store();
- } else {
- return $this->raiseError("Login failed!");
- }
-
- }
-
- // }}}
- // {{{ doLogout()
-
- /**
- * Execute the 'logout' command.
- *
- * @param string $command command name
- *
- * @param array $options option_name => value
- *
- * @param array $params list of additional parameters
- *
- * @return bool TRUE on success, FALSE for unknown commands, or
- * a PEAR error on failure
- *
- * @access public
- */
- function doLogout($command, $options, $params)
- {
- $server = $this->config->get('master_server');
- $this->ui->outputData("Logging out from $server.", $command);
- $this->config->remove('username');
- $this->config->remove('password');
- $this->config->store();
- }
-
- // }}}
-}
-
-?> \ No newline at end of file
diff --git a/pear/PEAR/Command/Build.php b/pear/PEAR/Command/Build.php
deleted file mode 100644
index ed97903454..0000000000
--- a/pear/PEAR/Command/Build.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Stig Bakken <ssb@php.net> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once "PEAR/Command/Common.php";
-require_once "PEAR/Builder.php";
-
-/**
- * PEAR commands for building extensions.
- *
- */
-class PEAR_Command_Build extends PEAR_Command_Common
-{
- // {{{ properties
-
- var $commands = array(
- 'build' => array(
- 'summary' => 'Build an Extension From C Source',
- 'function' => 'doBuild',
- 'shortcut' => 'b',
- 'options' => array(),
- 'doc' => '[package.xml]
-Builds one or more extensions contained in a package.'
- ),
- );
-
- // }}}
-
- // {{{ constructor
-
- /**
- * PEAR_Command_Build constructor.
- *
- * @access public
- */
- function PEAR_Command_Build(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- // }}}
-
- // {{{ doBuild()
-
- function doBuild($command, $options, $params)
- {
- if (sizeof($params) < 1) {
- $params[0] = 'package.xml';
- }
- $builder = &new PEAR_Builder($this->ui);
- $this->verbose = $this->config->get('verbose');
- $err = $builder->build($params[0], array(&$this, 'buildCallback'));
- if (PEAR::isError($err)) {
- return $err;
- }
- return true;
- }
-
- // }}}
- // {{{ buildCallback()
-
- function buildCallback($what, $data)
- {
- if (($what == 'cmdoutput' && $this->verbose > 1) ||
- ($what == 'output' && $this->verbose > 0)) {
- $this->ui->outputData(rtrim($data), 'build');
- }
- }
-
- // }}}
-}
diff --git a/pear/PEAR/Command/Common.php b/pear/PEAR/Command/Common.php
deleted file mode 100644
index 3544e2f9cb..0000000000
--- a/pear/PEAR/Command/Common.php
+++ /dev/null
@@ -1,249 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Stig Sæther Bakken <ssb@php.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once "PEAR.php";
-
-class PEAR_Command_Common extends PEAR
-{
- // {{{ properties
-
- /**
- * PEAR_Config object used to pass user system and configuration
- * on when executing commands
- *
- * @var object
- */
- var $config;
-
- /**
- * User Interface object, for all interaction with the user.
- * @var object
- */
- var $ui;
-
- var $_deps_rel_trans = array(
- 'lt' => '<',
- 'le' => '<=',
- 'eq' => '=',
- 'ne' => '!=',
- 'gt' => '>',
- 'ge' => '>=',
- 'has' => '=='
- );
-
- var $_deps_type_trans = array(
- 'pkg' => 'package',
- 'extension' => 'extension',
- 'php' => 'PHP',
- 'prog' => 'external program',
- 'ldlib' => 'external library for linking',
- 'rtlib' => 'external runtime library',
- 'os' => 'operating system',
- 'websrv' => 'web server',
- 'sapi' => 'SAPI backend'
- );
-
- // }}}
- // {{{ constructor
-
- /**
- * PEAR_Command_Common constructor.
- *
- * @access public
- */
- function PEAR_Command_Common(&$ui, &$config)
- {
- parent::PEAR();
- $this->config = &$config;
- $this->ui = &$ui;
- }
-
- // }}}
-
- // {{{ getCommands()
-
- /**
- * Return a list of all the commands defined by this class.
- * @return array list of commands
- * @access public
- */
- function getCommands()
- {
- $ret = array();
- foreach (array_keys($this->commands) as $command) {
- $ret[$command] = $this->commands[$command]['summary'];
- }
- return $ret;
- }
-
- // }}}
- // {{{ getShortcuts()
-
- /**
- * Return a list of all the command shortcuts defined by this class.
- * @return array shortcut => command
- * @access public
- */
- function getShortcuts()
- {
- $ret = array();
- foreach (array_keys($this->commands) as $command) {
- if (isset($this->commands[$command]['shortcut'])) {
- $ret[$this->commands[$command]['shortcut']] = $command;
- }
- }
- return $ret;
- }
-
- // }}}
- // {{{ getOptions()
-
- function getOptions($command)
- {
- return @$this->commands[$command]['options'];
- }
-
- // }}}
- // {{{ getGetoptArgs()
-
- function getGetoptArgs($command, &$short_args, &$long_args)
- {
- $short_args = "";
- $long_args = array();
- if (empty($this->commands[$command])) {
- return;
- }
- reset($this->commands[$command]);
- while (list($option, $info) = each($this->commands[$command]['options'])) {
- $larg = $sarg = '';
- if (isset($info['arg'])) {
- if ($info['arg']{0} == '(') {
- $larg = '==';
- $sarg = '::';
- $arg = substr($info['arg'], 1, -1);
- } else {
- $larg = '=';
- $sarg = ':';
- $arg = $info['arg'];
- }
- }
- if (isset($info['shortopt'])) {
- $short_args .= $info['shortopt'] . $sarg;
- }
- $long_args[] = $option . $larg;
- }
- }
-
- // }}}
- // {{{ getHelp()
- /**
- * Returns the help message for the given command
- *
- * @param string $command The command
- * @return mixed A fail string if the command does not have help or
- * a two elements array containing [0]=>help string,
- * [1]=> help string for the accepted cmd args
- */
- function getHelp($command)
- {
- $config = &PEAR_Config::singleton();
- $help = @$this->commands[$command]['doc'];
- if (empty($help)) {
- // XXX (cox) Fallback to summary if there is no doc (show both?)
- if (!$help = @$this->commands[$command]['summary']) {
- return "No help for command \"$command\"";
- }
- }
- if (preg_match_all('/{config\s+([^\}]+)}/e', $help, $matches)) {
- foreach($matches[0] as $k => $v) {
- $help = preg_replace("/$v/", $config->get($matches[1][$k]), $help);
- }
- }
- return array($help, $this->getHelpArgs($command));
- }
-
- // }}}
- // {{{ getHelpArgs()
- /**
- * Returns the help for the accepted arguments of a command
- *
- * @param string $command
- * @return string The help string
- */
- function getHelpArgs($command)
- {
- if (isset($this->commands[$command]['options']) &&
- count($this->commands[$command]['options']))
- {
- $help = "Options:\n";
- foreach ($this->commands[$command]['options'] as $k => $v) {
- if (isset($v['arg'])) {
- if ($v['arg']{0} == '(') {
- $arg = substr($v['arg'], 1, -1);
- $sapp = " [$arg]";
- $lapp = "[=$arg]";
- } else {
- $sapp = " $v[arg]";
- $lapp = "=$v[arg]";
- }
- } else {
- $sapp = $lapp = "";
- }
- if (isset($v['shortopt'])) {
- $s = $v['shortopt'];
- @$help .= " -$s$sapp, --$k$lapp\n";
- } else {
- @$help .= " --$k$lapp\n";
- }
- $p = " ";
- $doc = rtrim(str_replace("\n", "\n$p", $v['doc']));
- $help .= " $doc\n";
- }
- return $help;
- }
- return null;
- }
-
- // }}}
- // {{{ run()
-
- function run($command, $options, $params)
- {
- $func = @$this->commands[$command]['function'];
- if (empty($func)) {
- // look for shortcuts
- foreach (array_keys($this->commands) as $cmd) {
- if (@$this->commands[$cmd]['shortcut'] == $command) {
- $command = $cmd;
- $func = @$this->commands[$command]['function'];
- if (empty($func)) {
- return $this->raiseError("unknown command `$command'");
- }
- break;
- }
- }
- }
- return $this->$func($command, $options, $params);
- }
-
- // }}}
-}
-
-?> \ No newline at end of file
diff --git a/pear/PEAR/Command/Config.php b/pear/PEAR/Command/Config.php
deleted file mode 100644
index f18491903d..0000000000
--- a/pear/PEAR/Command/Config.php
+++ /dev/null
@@ -1,225 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Stig Bakken <ssb@php.net> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once "PEAR/Command/Common.php";
-require_once "PEAR/Config.php";
-
-/**
- * PEAR commands for managing configuration data.
- *
- */
-class PEAR_Command_Config extends PEAR_Command_Common
-{
- // {{{ properties
-
- var $commands = array(
- 'config-show' => array(
- 'summary' => 'Show All Settings',
- 'function' => 'doConfigShow',
- 'shortcut' => 'csh',
- 'options' => array(),
- 'doc' => '
-Displays all configuration values. An optional argument
-may be used to tell which configuration layer to display. Valid
-configuration layers are "user", "system" and "default".
-',
- ),
- 'config-get' => array(
- 'summary' => 'Show One Setting',
- 'function' => 'doConfigGet',
- 'shortcut' => 'cg',
- 'options' => array(),
- 'doc' => '<parameter> [layer]
-Displays the value of one configuration parameter. The
-first argument is the name of the parameter, an optional second argument
-may be used to tell which configuration layer to look in. Valid configuration
-layers are "user", "system" and "default". If no layer is specified, a value
-will be picked from the first layer that defines the parameter, in the order
-just specified.
-',
- ),
- 'config-set' => array(
- 'summary' => 'Change Setting',
- 'function' => 'doConfigSet',
- 'shortcut' => 'cs',
- 'options' => array(),
- 'doc' => '<parameter> <value> [layer]
-Sets the value of one configuration parameter. The first argument is
-the name of the parameter, the second argument is the new value. Some
-parameters are subject to validation, and the command will fail with
-an error message if the new value does not make sense. An optional
-third argument may be used to specify in which layer to set the
-configuration parameter. The default layer is "user".
-',
- ),
- 'config-help' => array(
- 'summary' => 'Show Information About Setting',
- 'function' => 'doConfigHelp',
- 'shortcut' => 'ch',
- 'options' => array(),
- 'doc' => '[parameter]
-Displays help for a configuration parameter. Without arguments it
-displays help for all configuration parameters.
-',
- ),
- );
-
- // }}}
- // {{{ constructor
-
- /**
- * PEAR_Command_Config constructor.
- *
- * @access public
- */
- function PEAR_Command_Config(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- // }}}
-
- // {{{ doConfigShow()
-
- function doConfigShow($command, $options, $params)
- {
- // $params[0] -> the layer
- if ($error = $this->_checkLayer(@$params[0])) {
- return $this->raiseError($error);
- }
- $keys = $this->config->getKeys();
- sort($keys);
- $data = array('caption' => 'Configuration:');
- foreach ($keys as $key) {
- $type = $this->config->getType($key);
- $value = $this->config->get($key, @$params[0]);
- if ($type == 'password' && $value) {
- $value = '********';
- }
- if ($value === false) {
- $value = 'false';
- } elseif ($value === true) {
- $value = 'true';
- }
- $data['data'][$this->config->getGroup($key)][] = array($this->config->getPrompt($key) , $key, $value);
- }
- $this->ui->outputData($data, $command);
- return true;
- }
-
- // }}}
- // {{{ doConfigGet()
-
- function doConfigGet($command, $options, $params)
- {
- // $params[0] -> the parameter
- // $params[1] -> the layer
- if ($error = $this->_checkLayer(@$params[1])) {
- return $this->raiseError($error);
- }
- if (sizeof($params) < 1 || sizeof($params) > 2) {
- return $this->raiseError("config-get expects 1 or 2 parameters");
- } elseif (sizeof($params) == 1) {
- $this->ui->outputData("$params[0]=" . $this->config->get($params[0]), $command);
- } else {
- $data = "$params[1].$params[0]=" .$this->config->get($params[0], $params[1]);
- $this->ui->outputData($data, $command);
- }
- return true;
- }
-
- // }}}
- // {{{ doConfigSet()
-
- function doConfigSet($command, $options, $params)
- {
- // $param[0] -> a parameter to set
- // $param[1] -> the value for the parameter
- // $param[2] -> the layer
- $failmsg = '';
- if (sizeof($params) < 2 || sizeof($params) > 3) {
- $failmsg .= "config-set expects 2 or 3 parameters";
- return PEAR::raiseError($failmsg);
- }
- if ($error = $this->_checkLayer(@$params[2])) {
- $failmsg .= $error;
- return PEAR::raiseError($failmsg);
- }
- if (!call_user_func_array(array(&$this->config, 'set'), $params))
- {
- $failmsg = "config-set (" . implode(", ", $params) . ") failed";
- } else {
- $this->config->store();
- }
- if ($failmsg) {
- return $this->raiseError($failmsg);
- }
- return true;
- }
-
- // }}}
- // {{{ doConfigHelp()
-
- function doConfigHelp($command, $options, $params)
- {
- if (empty($params)) {
- $params = $this->config->getKeys();
- }
- $data['caption'] = "Config help" . ((count($params) == 1) ? " for $params[0]" : '');
- $data['headline'] = array('Name', 'Type', 'Description');
- $data['border'] = true;
- foreach ($params as $name) {
- $type = $this->config->getType($name);
- $docs = $this->config->getDocs($name);
- if ($type == 'set') {
- $docs = rtrim($docs) . "\nValid set: " .
- implode(' ', $this->config->getSetValues($name));
- }
- $data['data'][] = array($name, $type, $docs);
- }
- $this->ui->outputData($data, $command);
- }
-
- // }}}
- // {{{ _checkLayer()
-
- /**
- * Checks if a layer is defined or not
- *
- * @param string $layer The layer to search for
- * @return mixed False on no error or the error message
- */
- function _checkLayer($layer = null)
- {
- if (!empty($layer) && $layer != 'default') {
- $layers = $this->config->getLayers();
- if (!in_array($layer, $layers)) {
- return " only the layers: \"" . implode('" or "', $layers) . "\" are supported";
- }
- }
- return false;
- }
-
- // }}}
-}
-
-?> \ No newline at end of file
diff --git a/pear/PEAR/Command/Install.php b/pear/PEAR/Command/Install.php
deleted file mode 100644
index 4ecfb33390..0000000000
--- a/pear/PEAR/Command/Install.php
+++ /dev/null
@@ -1,302 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Stig Sæther Bakken <ssb@php.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once "PEAR/Command/Common.php";
-require_once "PEAR/Installer.php";
-require_once "Console/Getopt.php";
-
-/**
- * PEAR commands for installation or deinstallation/upgrading of
- * packages.
- *
- */
-class PEAR_Command_Install extends PEAR_Command_Common
-{
- // {{{ properties
-
- var $commands = array(
- 'install' => array(
- 'summary' => 'Install Package',
- 'function' => 'doInstall',
- 'shortcut' => 'i',
- 'options' => array(
- 'force' => array(
- 'shortopt' => 'f',
- 'doc' => 'will overwrite newer installed packages',
- ),
- 'nodeps' => array(
- 'shortopt' => 'n',
- 'doc' => 'ignore dependencies, install anyway',
- ),
- 'register-only' => array(
- 'shortopt' => 'r',
- 'doc' => 'do not install files, only register the package as installed',
- ),
- 'soft' => array(
- 'shortopt' => 's',
- 'doc' => 'soft install, fail silently, or upgrade if already installed',
- ),
- 'nobuild' => array(
- 'shortopt' => 'B',
- 'doc' => 'don\'t build C extensions',
- ),
- 'nocompress' => array(
- 'shortopt' => 'Z',
- 'doc' => 'request uncompressed files when downloading',
- ),
- 'installroot' => array(
- 'shortopt' => 'R',
- 'arg' => 'DIR',
- 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT)',
- ),
- 'ignore-errors' => array(
- 'doc' => 'force install even if there were errors',
- ),
- ),
- 'doc' => '<package> ...
-Installs one or more PEAR packages. You can specify a package to
-install in four ways:
-
-"Package-1.0.tgz" : installs from a local file
-
-"http://example.com/Package-1.0.tgz" : installs from
-anywhere on the net.
-
-"package.xml" : installs the package described in
-package.xml. Useful for testing, or for wrapping a PEAR package in
-another package manager such as RPM.
-
-"Package" : queries your configured server
-({config master_server}) and downloads the newest package with
-the preferred quality/state ({config preferred_state}).
-
-More than one package may be specified at once. It is ok to mix these
-four ways of specifying packages.
-'),
- 'upgrade' => array(
- 'summary' => 'Upgrade Package',
- 'function' => 'doInstall',
- 'shortcut' => 'up',
- 'options' => array(
- 'force' => array(
- 'shortopt' => 'f',
- 'doc' => 'overwrite newer installed packages',
- ),
- 'nodeps' => array(
- 'shortopt' => 'n',
- 'doc' => 'ignore dependencies, upgrade anyway',
- ),
- 'register-only' => array(
- 'shortopt' => 'r',
- 'doc' => 'do not install files, only register the package as upgraded',
- ),
- 'nobuild' => array(
- 'shortopt' => 'B',
- 'doc' => 'don\'t build C extensions',
- ),
- 'nocompress' => array(
- 'shortopt' => 'Z',
- 'doc' => 'request uncompressed files when downloading',
- ),
- 'installroot' => array(
- 'shortopt' => 'R',
- 'arg' => 'DIR',
- 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT)',
- ),
- 'ignore-errors' => array(
- 'doc' => 'force install even if there were errors',
- ),
- ),
- 'doc' => '<package> ...
-Upgrades one or more PEAR packages. See documentation for the
-"install" command for ways to specify a package.
-
-When upgrading, your package will be updated if the provided new
-package has a higher version number (use the -f option if you need to
-upgrade anyway).
-
-More than one package may be specified at once.
-'),
- 'upgrade-all' => array(
- 'summary' => 'Upgrade All Packages',
- 'function' => 'doInstall',
- 'shortcut' => 'ua',
- 'options' => array(
- 'nodeps' => array(
- 'shortopt' => 'n',
- 'doc' => 'ignore dependencies, upgrade anyway',
- ),
- 'register-only' => array(
- 'shortopt' => 'r',
- 'doc' => 'do not install files, only register the package as upgraded',
- ),
- 'nobuild' => array(
- 'shortopt' => 'B',
- 'doc' => 'don\'t build C extensions',
- ),
- 'nocompress' => array(
- 'shortopt' => 'Z',
- 'doc' => 'request uncompressed files when downloading',
- ),
- 'installroot' => array(
- 'shortopt' => 'R',
- 'arg' => 'DIR',
- 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT)',
- ),
- 'ignore-errors' => array(
- 'doc' => 'force install even if there were errors',
- ),
- ),
- 'doc' => '
-Upgrades all packages that have a newer release available. Upgrades are
-done only if there is a release available of the state specified in
-"preferred_state" (currently {config preferred_state}), or a state considered
-more stable.
-'),
- 'uninstall' => array(
- 'summary' => 'Un-install Package',
- 'function' => 'doUninstall',
- 'shortcut' => 'un',
- 'options' => array(
- 'nodeps' => array(
- 'shortopt' => 'n',
- 'doc' => 'ignore dependencies, uninstall anyway',
- ),
- 'register-only' => array(
- 'shortopt' => 'r',
- 'doc' => 'do not remove files, only register the packages as not installed',
- ),
- 'installroot' => array(
- 'shortopt' => 'R',
- 'arg' => 'DIR',
- 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT)',
- ),
- 'ignore-errors' => array(
- 'doc' => 'force install even if there were errors',
- ),
- ),
- 'doc' => '<package> ...
-Uninstalls one or more PEAR packages. More than one package may be
-specified at once.
-'),
-
- );
-
- // }}}
- // {{{ constructor
-
- /**
- * PEAR_Command_Install constructor.
- *
- * @access public
- */
- function PEAR_Command_Install(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- // }}}
-
- // {{{ doInstall()
-
- function doInstall($command, $options, $params)
- {
- if (empty($this->installer)) {
- $this->installer = &new PEAR_Installer($this->ui);
- }
- if ($command == 'upgrade') {
- $options[$command] = true;
- }
- if ($command == 'upgrade-all') {
- include_once "PEAR/Remote.php";
- $options['upgrade'] = true;
- $remote = new PEAR_Remote($this->config);
- $state = $this->config->get('preferred_state');
- if (empty($state) || $state == 'any') {
- $latest = $remote->call("package.listLatestReleases");
- } else {
- $latest = $remote->call("package.listLatestReleases", $state);
- }
- if (PEAR::isError($latest)) {
- return $latest;
- }
- $reg = new PEAR_Registry($this->config->get('php_dir'));
- $installed = array_flip($reg->listPackages());
- $params = array();
- foreach ($latest as $package => $info) {
- if (!isset($installed[$package])) {
- // skip packages we don't have installed
- continue;
- }
- $inst_version = $reg->packageInfo($package, 'version');
- if (version_compare("$info[version]", "$inst_version", "le")) {
- // installed version is up-to-date
- continue;
- }
- $params[] = $package;
- $this->ui->outputData("will upgrade $package", $command);
- }
- }
- foreach ($params as $pkg) {
- $bn = basename($pkg);
- $info = $this->installer->install($pkg, $options, $this->config);
- if (is_array($info)) {
- if ($this->config->get('verbose') > 0) {
- $label = "$info[package] $info[version]";
- $out = array('data' => "$command ok: $label");
- if (isset($info['release_warnings'])) {
- $out['release_warnings'] = $info['release_warnings'];
- }
- $this->ui->outputData($out, $command);
- }
- } else {
- return $this->raiseError("$command failed");
- }
- }
- return true;
- }
-
- // }}}
- // {{{ doUninstall()
-
- function doUninstall($command, $options, $params)
- {
- if (empty($this->installer)) {
- $this->installer = &new PEAR_Installer($this->ui);
- }
- if (sizeof($params) < 1) {
- return $this->raiseError("Please supply the package(s) you want to uninstall");
- }
- foreach ($params as $pkg) {
- if ($this->installer->uninstall($pkg, $options)) {
- if ($this->config->get('verbose') > 0) {
- $this->ui->outputData("uninstall ok: $pkg", $command);
- }
- } else {
- return $this->raiseError("uninstall failed: $pkg");
- }
- }
- return true;
- }
-
- // }}}
-}
-
-?>
diff --git a/pear/PEAR/Command/Mirror.php b/pear/PEAR/Command/Mirror.php
deleted file mode 100644
index ed61f57e17..0000000000
--- a/pear/PEAR/Command/Mirror.php
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Alexander Merz <alexmerz@php.net> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once "PEAR/Command/Common.php";
-require_once "PEAR/Command.php";
-require_once "PEAR/Remote.php";
-require_once "PEAR.php";
-
-/**
- * PEAR commands for providing file mirrors
- *
- */
-class PEAR_Command_Mirror extends PEAR_Command_Common
-{
- // {{{ properties
-
- var $commands = array(
- 'download-all' => array(
- 'summary' => 'Downloads each avaible Package from master_server',
- 'function' => 'doDownloadAll',
- 'shortcut' => 'da',
- 'options' => array(),
- 'doc' => '
- Request a list of avaible Packages from the Package-Server
- (master_server) and downloads them to current working dir'
- ),
- );
-
- // }}}
-
- // {{{ constructor
-
- /**
- * PEAR_Command_Mirror constructor.
- *
- * @access public
- * @param object PEAR_Frontend a reference to an frontend
- * @param object PEAR_Config a reference to the configuration data
- */
- function PEAR_Command_Mirror(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- // }}}
-
- // {{{ doDownloadAll()
- /**
- * retrieves a list of avaible Packages from master server
- * and downloads them
- *
- * @access public
- * @param string $command the command
- * @param array $options the command options before the command
- * @param array $params the stuff after the command name
- * @return bool true if succesful
- * @throw PEAR_Error
- */
- function doDownloadAll($command, $options, $params)
- {
- $this->config->set("php_dir", ".");
- $remote = &new PEAR_Remote($this->config);
- $remoteInfo = $remote->call("package.listAll");
- if(PEAR::isError($remoteInfo)) {
- return $remoteInfo;
- }
- $cmd = &PEAR_Command::factory("download", $this->config);
- if(PEAR::isError($cmd)) {
- return $cmd;
- }
- foreach($remoteInfo as $pkgn=>$pkg) {
- // error handling not neccesary, because
- // already done by the download command
- $cmd->run("download", array(), array($pkgn));
- }
-
- return true;
- }
-
- // }}}
-}
diff --git a/pear/PEAR/Command/Package.php b/pear/PEAR/Command/Package.php
deleted file mode 100644
index ed0fb671c6..0000000000
--- a/pear/PEAR/Command/Package.php
+++ /dev/null
@@ -1,660 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@php.net> |
-// | Martin Jansen <mj@php.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR/Common.php';
-require_once 'PEAR/Command/Common.php';
-
-class PEAR_Command_Package extends PEAR_Command_Common
-{
- // {{{ properties
-
- var $commands = array(
- 'package' => array(
- 'summary' => 'Build Package',
- 'function' => 'doPackage',
- 'shortcut' => 'p',
- 'options' => array(
- 'nocompress' => array(
- 'shortopt' => 'Z',
- 'doc' => 'Do not gzip the package file'
- ),
- 'showname' => array(
- 'shortopt' => 'n',
- 'doc' => 'Print the name of the packaged file.',
- ),
- ),
- 'doc' => '[descfile]
-Creates a PEAR package from its description file (usually called
-package.xml).
-'
- ),
- 'package-validate' => array(
- 'summary' => 'Validate Package Consistency',
- 'function' => 'doPackageValidate',
- 'shortcut' => 'pv',
- 'options' => array(),
- 'doc' => '
-',
- ),
- 'cvsdiff' => array(
- 'summary' => 'Run a "cvs diff" for all files in a package',
- 'function' => 'doCvsDiff',
- 'shortcut' => 'cd',
- 'options' => array(
- 'quiet' => array(
- 'shortopt' => 'q',
- 'doc' => 'Be quiet',
- ),
- 'reallyquiet' => array(
- 'shortopt' => 'Q',
- 'doc' => 'Be really quiet',
- ),
- 'date' => array(
- 'shortopt' => 'D',
- 'doc' => 'Diff against revision of DATE',
- 'arg' => 'DATE',
- ),
- 'release' => array(
- 'shortopt' => 'R',
- 'doc' => 'Diff against tag for package release REL',
- 'arg' => 'REL',
- ),
- 'revision' => array(
- 'shortopt' => 'r',
- 'doc' => 'Diff against revision REV',
- 'arg' => 'REV',
- ),
- 'context' => array(
- 'shortopt' => 'c',
- 'doc' => 'Generate context diff',
- ),
- 'unified' => array(
- 'shortopt' => 'u',
- 'doc' => 'Generate unified diff',
- ),
- 'ignore-case' => array(
- 'shortopt' => 'i',
- 'doc' => 'Ignore case, consider upper- and lower-case letters equivalent',
- ),
- 'ignore-whitespace' => array(
- 'shortopt' => 'b',
- 'doc' => 'Ignore changes in amount of white space',
- ),
- 'ignore-blank-lines' => array(
- 'shortopt' => 'B',
- 'doc' => 'Ignore changes that insert or delete blank lines',
- ),
- 'brief' => array(
- 'doc' => 'Report only whether the files differ, no details',
- ),
- 'dry-run' => array(
- 'shortopt' => 'n',
- 'doc' => 'Don\'t do anything, just pretend',
- ),
- ),
- 'doc' => '<package.xml>
-Compares all the files in a package. Without any options, this
-command will compare the current code with the last checked-in code.
-Using the -r or -R option you may compare the current code with that
-of a specific release.
-',
- ),
- 'cvstag' => array(
- 'summary' => 'Set CVS Release Tag',
- 'function' => 'doCvsTag',
- 'shortcut' => 'ct',
- 'options' => array(
- 'quiet' => array(
- 'shortopt' => 'q',
- 'doc' => 'Be quiet',
- ),
- 'reallyquiet' => array(
- 'shortopt' => 'Q',
- 'doc' => 'Be really quiet',
- ),
- 'slide' => array(
- 'shortopt' => 'F',
- 'doc' => 'Move (slide) tag if it exists',
- ),
- 'delete' => array(
- 'shortopt' => 'd',
- 'doc' => 'Remove tag',
- ),
- 'dry-run' => array(
- 'shortopt' => 'n',
- 'doc' => 'Don\'t do anything, just pretend',
- ),
- ),
- 'doc' => '<package.xml>
-Sets a CVS tag on all files in a package. Use this command after you have
-packaged a distribution tarball with the "package" command to tag what
-revisions of what files were in that release. If need to fix something
-after running cvstag once, but before the tarball is released to the public,
-use the "slide" option to move the release tag.
-',
- ),
- 'run-tests' => array(
- 'summary' => 'Run Regression Tests',
- 'function' => 'doRunTests',
- 'shortcut' => 'rt',
- 'options' => array(),
- 'doc' => '[testfile|dir ...]
-Run regression tests with PHP\'s regression testing script (run-tests.php).',
- ),
- 'package-dependencies' => array(
- 'summary' => 'Show package dependencies',
- 'function' => 'doPackageDependencies',
- 'shortcut' => 'pd',
- 'options' => array(),
- 'doc' => '
-List all depencies the package has.'
- ),
- 'sign' => array(
- 'summary' => 'Sign a package distribution file',
- 'function' => 'doSign',
- 'shortcut' => 'si',
- 'options' => array(),
- 'doc' => '<package-file>
-Signs a package distribution (.tar or .tgz) file with GnuPG.',
- ),
- 'makerpm' => array(
- 'summary' => 'Builds an RPM spec file from a PEAR package',
- 'function' => 'doMakeRPM',
- 'shortcut' => 'rpm',
- 'options' => array(
- 'spec-template' => array(
- 'shortopt' => 't',
- 'arg' => 'FILE',
- 'doc' => 'Use FILE as RPM spec file template'
- ),
- 'rpm-pkgname' => array(
- 'shortopt' => 'p',
- 'arg' => 'FORMAT',
- 'doc' => 'Use FORMAT as format string for RPM package name, %s is replaced
-by the PEAR package name, defaults to "PEAR::%s".',
- ),
- ),
- 'doc' => '<package-file>
-
-Creates an RPM .spec file for wrapping a PEAR package inside an RPM
-package. Intended to be used from the SPECS directory, with the PEAR
-package tarball in the SOURCES directory:
-
-$ pear makerpm ../SOURCES/Net_Socket-1.0.tgz
-Wrote RPM spec file PEAR::Net_Geo-1.0.spec
-$ rpm -bb PEAR::Net_Socket-1.0.spec
-...
-Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
-',
- ),
- );
-
- var $output;
-
- // }}}
- // {{{ constructor
-
- /**
- * PEAR_Command_Package constructor.
- *
- * @access public
- */
- function PEAR_Command_Package(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- // }}}
-
- // {{{ _displayValidationResults()
-
- function _displayValidationResults($err, $warn, $strict = false)
- {
- foreach ($err as $e) {
- $this->output .= "Error: $e\n";
- }
- foreach ($warn as $w) {
- $this->output .= "Warning: $w\n";
- }
- $this->output .= sprintf('Validation: %d error(s), %d warning(s)'."\n",
- sizeof($err), sizeof($warn));
- if ($strict && sizeof($err) > 0) {
- $this->output .= "Fix these errors and try again.";
- return false;
- }
- return true;
- }
-
- // }}}
- // {{{ doPackage()
-
- function doPackage($command, $options, $params)
- {
- $this->output = '';
- include_once 'PEAR/Packager.php';
- $pkginfofile = isset($params[0]) ? $params[0] : 'package.xml';
- $packager =& new PEAR_Packager($this->config->get('php_dir'),
- $this->config->get('ext_dir'),
- $this->config->get('doc_dir'));
- $packager->debug = $this->config->get('verbose');
- $err = $warn = array();
- $dir = dirname($pkginfofile);
- $compress = empty($options['nocompress']) ? true : false;
- $result = $packager->package($pkginfofile, $compress);
- if (PEAR::isError($result)) {
- $this->ui->outputData($this->output, $command);
- return $this->raiseError($result);
- }
- // Don't want output, only the package file name just created
- if (isset($options['showname'])) {
- $this->output = $result;
- }
- /* (cox) What is supposed to do that code?
- $lines = explode("\n", $this->output);
- foreach ($lines as $line) {
- $this->output .= $line."n";
- }
- */
- if (PEAR::isError($result)) {
- $this->output .= "Package failed: ".$result->getMessage();
- }
- $this->ui->outputData($this->output, $command);
- return true;
- }
-
- // }}}
- // {{{ doPackageValidate()
-
- function doPackageValidate($command, $options, $params)
- {
- $this->output = '';
- if (sizeof($params) < 1) {
- $params[0] = "package.xml";
- }
- $obj = new PEAR_Common;
- $info = null;
- if ($fp = @fopen($params[0], "r")) {
- $test = fread($fp, 5);
- fclose($fp);
- if ($test == "<?xml") {
- $info = $obj->infoFromDescriptionFile($params[0]);
- }
- }
- if (empty($info)) {
- $info = $obj->infoFromTgzFile($params[0]);
- }
- if (PEAR::isError($info)) {
- return $this->raiseError($info);
- }
- $obj->validatePackageInfo($info, $err, $warn);
- $this->_displayValidationResults($err, $warn);
- $this->ui->outputData($this->output, $command);
- return true;
- }
-
- // }}}
- // {{{ doCvsTag()
-
- function doCvsTag($command, $options, $params)
- {
- $this->output = '';
- $_cmd = $command;
- if (sizeof($params) < 1) {
- $help = $this->getHelp($command);
- return $this->raiseError("$command: missing parameter: $help[0]");
- }
- $obj = new PEAR_Common;
- $info = $obj->infoFromDescriptionFile($params[0]);
- if (PEAR::isError($info)) {
- return $this->raiseError($info);
- }
- $err = $warn = array();
- $obj->validatePackageInfo($info, $err, $warn);
- if (!$this->_displayValidationResults($err, $warn, true)) {
- $this->ui->outputData($this->output, $command);
- break;
- }
- $version = $info['version'];
- $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $version);
- $cvstag = "RELEASE_$cvsversion";
- $files = array_keys($info['filelist']);
- $command = "cvs";
- if (isset($options['quiet'])) {
- $command .= ' -q';
- }
- if (isset($options['reallyquiet'])) {
- $command .= ' -Q';
- }
- $command .= ' tag';
- if (isset($options['slide'])) {
- $command .= ' -F';
- }
- if (isset($options['delete'])) {
- $command .= ' -d';
- }
- $command .= ' ' . $cvstag . ' ' . escapeshellarg($params[0]);
- foreach ($files as $file) {
- $command .= ' ' . escapeshellarg($file);
- }
- if ($this->config->get('verbose') > 1) {
- $this->output .= "+ $command\n";
- }
- $this->output .= "+ $command\n";
- if (empty($options['dry-run'])) {
- $fp = popen($command, "r");
- while ($line = fgets($fp, 1024)) {
- $this->output .= rtrim($line)."\n";
- }
- pclose($fp);
- }
- $this->ui->outputData($this->output, $_cmd);
- return true;
- }
-
- // }}}
- // {{{ doCvsDiff()
-
- function doCvsDiff($command, $options, $params)
- {
- $this->output = '';
- if (sizeof($params) < 1) {
- $help = $this->getHelp($command);
- return $this->raiseError("$command: missing parameter: $help[0]");
- }
- $obj = new PEAR_Common;
- $info = $obj->infoFromDescriptionFile($params[0]);
- if (PEAR::isError($info)) {
- return $this->raiseError($info);
- }
- $files = array_keys($info['filelist']);
- $cmd = "cvs";
- if (isset($options['quiet'])) {
- $cmd .= ' -q';
- unset($options['quiet']);
- }
- if (isset($options['reallyquiet'])) {
- $cmd .= ' -Q';
- unset($options['reallyquiet']);
- }
- if (isset($options['release'])) {
- $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $options['release']);
- $cvstag = "RELEASE_$cvsversion";
- $options['revision'] = $cvstag;
- unset($options['release']);
- }
- $execute = true;
- if (isset($options['dry-run'])) {
- $execute = false;
- unset($options['dry-run']);
- }
- $cmd .= ' diff';
- // the rest of the options are passed right on to "cvs diff"
- foreach ($options as $option => $optarg) {
- $arg = @$this->commands[$command]['options'][$option]['arg'];
- $short = @$this->commands[$command]['options'][$option]['shortopt'];
- $cmd .= $short ? " -$short" : " --$option";
- if ($arg && $optarg) {
- $cmd .= ($short ? '' : '=') . escapeshellarg($optarg);
- }
- }
- foreach ($files as $file) {
- $cmd .= ' ' . escapeshellarg($file);
- }
- if ($this->config->get('verbose') > 1) {
- $this->output .= "+ $cmd\n";
- }
- if ($execute) {
- $fp = popen($cmd, "r");
- while ($line = fgets($fp, 1024)) {
- $this->output .= rtrim($line)."\n";
- }
- pclose($fp);
- }
- $this->ui->outputData($this->output, $command);
- return true;
- }
-
- // }}}
- // {{{ doRunTests()
-
- function doRunTests($command, $options, $params)
- {
- $cwd = getcwd();
- $php = PHP_BINDIR . '/php' . (OS_WINDOWS ? '.exe' : '');
- putenv("TEST_PHP_EXECUTABLE=$php");
- $ip = ini_get("include_path");
- $ps = OS_WINDOWS ? ';' : ':';
- $run_tests = $this->config->get('php_dir') . DIRECTORY_SEPARATOR . 'run-tests.php';
- if (!file_exists($run_tests)) {
- $run_tests = PEAR_INSTALL_DIR . DIRECTORY_SEPARATOR . 'run-tests.php';
- if (!file_exists($run_tests)) {
- return $this->raiseError("No `run-tests.php' file found");
- }
- }
- $plist = implode(" ", $params);
- $cmd = "$php -C -d include_path=$cwd$ps$ip -f $run_tests -- $plist";
- system($cmd);
- return true;
- }
-
- // }}}
- // {{{ doPackageDependencies()
-
- function doPackageDependencies($command, $options, $params)
- {
- // $params[0] -> the PEAR package to list its information
- if (sizeof($params) != 1) {
- return $this->raiseError("bad parameter(s), try \"help $command\"");
- }
-
- $obj = new PEAR_Common();
- if (PEAR::isError($info = $obj->infoFromAny($params[0]))) {
- return $this->raiseError($info);
- }
-
- if (is_array($info['release_deps'])) {
- $data = array(
- 'caption' => 'Dependencies for ' . $info['package'],
- 'border' => true,
- 'headline' => array("Type", "Name", "Relation", "Version"),
- );
-
- foreach ($info['release_deps'] as $d) {
-
- if (isset($this->_deps_rel_trans[$d['rel']])) {
- $rel = $this->_deps_rel_trans[$d['rel']];
- } else {
- $rel = $d['rel'];
- }
-
- if (isset($this->_deps_type_trans[$d['type']])) {
- $type = ucfirst($this->_deps_type_trans[$d['type']]);
- } else {
- $type = $d['type'];
- }
-
- if (isset($d['name'])) {
- $name = $d['name'];
- } else {
- $name = '';
- }
-
- if (isset($d['version'])) {
- $version = $d['version'];
- } else {
- $version = '';
- }
-
- $data['data'][] = array($type, $name, $rel, $version);
- }
-
- $this->ui->outputData($data, $command);
- return true;
- }
-
- // Fallback
- $this->ui->outputData("This package does not have any dependencies.", $command);
- }
-
- // }}}
- // {{{ doSign()
-
- function doSign($command, $options, $params)
- {
- // should move most of this code into PEAR_Packager
- // so it'll be easy to implement "pear package --sign"
- if (sizeof($params) != 1) {
- return $this->raiseError("bad parameter(s), try \"help $command\"");
- }
- if (!file_exists($params[0])) {
- return $this->raiseError("file does not exist: $params[0]");
- }
- $obj = new PEAR_Common;
- $info = $obj->infoFromTgzFile($params[0]);
- if (PEAR::isError($info)) {
- return $this->raiseError($info);
- }
- include_once "Archive/Tar.php";
- include_once "System.php";
- $tar = new Archive_Tar($params[0]);
- $tmpdir = System::mktemp('-d pearsign');
- if (!$tar->extractList('package.xml package.sig', $tmpdir)) {
- return $this->raiseError("failed to extract tar file");
- }
- if (file_exists("$tmpdir/package.sig")) {
- return $this->raiseError("package already signed");
- }
- @unlink("$tmpdir/package.sig");
- $input = $this->ui->userDialog($command,
- array('GnuPG Passphrase'),
- array('password'));
- $gpg = popen("gpg --batch --passphrase-fd 0 --armor --detach-sign --output $tmpdir/package.sig $tmpdir/package.xml 2>/dev/null", "w");
- if (!$gpg) {
- return $this->raiseError("gpg command failed");
- }
- fwrite($gpg, "$input[0]\r");
- if (pclose($gpg) || !file_exists("$tmpdir/package.sig")) {
- return $this->raiseError("gpg sign failed");
- }
- $tar->addModify("$tmpdir/package.sig", '', $tmpdir);
- return true;
- }
-
- // }}}
- // {{{ doMakeRPM()
-
- function doMakeRPM($command, $options, $params)
- {
- if (sizeof($params) != 1) {
- return $this->raiseError("bad parameter(s), try \"help $command\"");
- }
- if (!file_exists($params[0])) {
- return $this->raiseError("file does not exist: $params[0]");
- }
- include_once "Archive/Tar.php";
- include_once "PEAR/Installer.php";
- include_once "System.php";
- $tar = new Archive_Tar($params[0]);
- $tmpdir = System::mktemp('-d pear2rpm');
- $instroot = System::mktemp('-d pear2rpm');
- $tmp = $this->config->get('verbose');
- $this->config->set('verbose', 0);
- $installer = new PEAR_Installer($this->ui);
- $info = $installer->install($params[0],
- array('installroot' => $instroot,
- 'nodeps' => true));
- $pkgdir = "$info[package]-$info[version]";
-// print "instroot=$instroot\n";
-// print_r($info);
-// return true;
-
- $info['rpm_xml_dir'] = '/var/lib/pear';
- $this->config->set('verbose', $tmp);
- if (!$tar->extractList("$pkgdir/package.xml", $tmpdir, $pkgdir)) {
- return $this->raiseError("failed to extract $params[0]");
- }
- if (!file_exists("$tmpdir/package.xml")) {
- return $this->raiseError("no package.xml found in $params[0]");
- }
-// System::mkdir("-p $instroot$info[rpm_xml_dir]");
-// if (!@copy("$tmpdir/package.xml", "$instroot$info[rpm_xml_dir]/$info[package].xml")) {
-// return $this->raiseError("could not copy package.xml file: $php_errormsg");
-// }
- if (isset($options['spec-template'])) {
- $spec_template = $options['spec-template'];
- } else {
- $spec_template = $this->config->get('data_dir') .
- '/PEAR/template.spec';
- }
- if (isset($options['rpm-pkgname'])) {
- $rpm_pkgname_format = $options['rpm-pkgname'];
- } else {
- $rpm_pkgname_format = "PEAR::%s";
- }
-
- $info['extra_headers'] = '';
- $info['doc_files'] = '';
- $info['files'] = '';
- $info['rpm_package'] = sprintf($rpm_pkgname_format, $info['package']);
- $srcfiles = 0;
- foreach ($info['filelist'] as $name => $attr) {
- if ($attr['role'] == 'doc') {
- $info['doc_files'] .= " $name";
- } elseif ($attr['role'] == 'src') {
- $srcfiles++;
- }
- $info['files'] .= "$attr[installed_as]\n";
- }
- if ($srcfiles > 0) {
- include_once "OS/Guess.php";
- $os = new OS_Guess;
- $arch = $os->getCpu();
- } else {
- $arch = 'noarch';
- }
- $cfk = array('master_server', 'php_dir', 'ext_dir', 'doc_dir',
- 'bin_dir', 'data_dir', 'test_dir');
- foreach ($cfg as $k) {
- $info[$k] = $this->config->get($k);
- }
- $info['arch'] = $arch;
- $fp = @fopen($spec_template, "r");
- if (!$fp) {
- return $this->raiseError("could not open RPM spec file template $spec_template: $php_errormsg");
- }
- $spec_contents = preg_replace('/@([a-z0-9_-]+)@/e', '$info["\1"]', fread($fp, filesize($spec_template)));
- fclose($fp);
- $spec_file = "$info[rpm_package]-$info[version].spec";
- $wp = fopen($spec_file, "w");
- if (!$wp) {
- return $this->raiseError("could not write RPM spec file $spec_file: $php_errormsg");
- }
- fwrite($wp, $spec_contents);
- fclose($wp);
- $this->ui->outputData("Wrote RPM spec file $spec_file", $command);
-
- return true;
- }
-
- // }}}
-}
-
-?>
diff --git a/pear/PEAR/Command/Registry.php b/pear/PEAR/Command/Registry.php
deleted file mode 100644
index 20860cf4a2..0000000000
--- a/pear/PEAR/Command/Registry.php
+++ /dev/null
@@ -1,319 +0,0 @@
-<?php
-// /* vim: set expandtab tabstop=4 shiftwidth=4: */
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Stig Bakken <ssb@php.net> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR/Command/Common.php';
-require_once 'PEAR/Registry.php';
-require_once 'PEAR/Config.php';
-
-class PEAR_Command_Registry extends PEAR_Command_Common
-{
- // {{{ properties
-
- var $commands = array(
- 'list' => array(
- 'summary' => 'List Installed Packages',
- 'function' => 'doList',
- 'shortcut' => 'l',
- 'options' => array(),
- 'doc' => '[package]
-If invoked without parameters, this command lists the PEAR packages
-installed in your php_dir ({config php_dir)). With a parameter, it
-lists the files in that package.
-',
- ),
- 'shell-test' => array(
- 'summary' => 'Shell Script Test',
- 'function' => 'doShellTest',
- 'shortcut' => 'st',
- 'options' => array(),
- 'doc' => '<package> [[relation] version]
-Tests if a package is installed in the system. Will exit(1) if it is not.
- <relation> The version comparison operator. One of:
- <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne
- <version> The version to compare with
-'),
- 'info' => array(
- 'summary' => 'Display information about a package',
- 'function' => 'doInfo',
- 'shortcut' => 'in',
- 'options' => array(),
- 'doc' => '<package>
-Displays information about a package. The package argument may be a
-local package file, an URL to a package file, or the name of an
-installed package.'
- )
- );
-
- // }}}
- // {{{ constructor
-
- /**
- * PEAR_Command_Registry constructor.
- *
- * @access public
- */
- function PEAR_Command_Registry(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- // }}}
-
- // {{{ doList()
-
- function _sortinfo($a, $b)
- {
- return strcmp($a['package'], $b['package']);
- }
-
- function doList($command, $options, $params)
- {
- $reg = new PEAR_Registry($this->config->get('php_dir'));
- if (sizeof($params) == 0) {
- $installed = $reg->packageInfo();
- usort($installed, array(&$this, '_sortinfo'));
- $i = $j = 0;
- $data = array(
- 'caption' => 'Installed packages:',
- 'border' => true,
- 'headline' => array('Package', 'Version', 'State')
- );
- foreach ($installed as $package) {
- $data['data'][] = array($package['package'],
- $package['version'],
- @$package['release_state']);
- }
- if (count($installed)==0) {
- $data = '(no packages installed)';
- }
- $this->ui->outputData($data, $command);
- } else {
- if (file_exists($params[0]) && !is_dir($params[0])) {
- include_once "PEAR/Common.php";
- $obj = &new PEAR_Common;
- $info = $obj->infoFromAny($params[0]);
- $headings = array('Package File', 'Install Path');
- $installed = false;
- } else {
- $info = $reg->packageInfo($params[0]);
- $headings = array('Type', 'Install Path');
- $installed = true;
- }
- if (PEAR::isError($info)) {
- return $this->raiseError($info);
- }
- if ($info === null) {
- return $this->raiseError("`$params[0]' not installed");
- }
- $list = $info['filelist'];
- if ($installed) {
- $caption = 'Installed Files For ' . $params[0];
- } else {
- $caption = 'Contents of ' . basename($params[0]);
- }
- $data = array(
- 'caption' => $caption,
- 'border' => true,
- 'headline' => $headings);
- foreach ($list as $file => $att) {
- if ($installed) {
- if (empty($att['installed_as'])) {
- continue;
- }
- $data['data'][] = array($att['role'], $att['installed_as']);
- } else {
- if (isset($att['baseinstalldir'])) {
- $dest = $att['baseinstalldir'] . DIRECTORY_SEPARATOR .
- $file;
- } else {
- $dest = $file;
- }
- switch ($att['role']) {
- case 'test':
- case 'data':
- if ($installed) {
- break 2;
- }
- $dest = '-- will not be installed --';
- break;
- case 'doc':
- $dest = $this->config->get('doc_dir') . DIRECTORY_SEPARATOR .
- $dest;
- break;
- case 'php':
- default:
- $dest = $this->config->get('php_dir') . DIRECTORY_SEPARATOR .
- $dest;
- }
- $dest = preg_replace('!/+!', '/', $dest);
- $file = preg_replace('!/+!', '/', $file);
- $data['data'][] = array($file, $dest);
- }
- }
- $this->ui->outputData($data, $command);
-
-
- }
- return true;
- }
-
- // }}}
- // {{{ doShellTest()
-
- function doShellTest($command, $options, $params)
- {
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $reg = &new PEAR_Registry($this->config->get('php_dir'));
- // "pear shell-test Foo"
- if (sizeof($params) == 1) {
- if (!$reg->packageExists($params[0])) {
- exit(1);
- }
- // "pear shell-test Foo 1.0"
- } elseif (sizeof($params) == 2) {
- $v = $reg->packageInfo($params[0], 'version');
- if (!$v || !version_compare("$v", "{$params[1]}", "ge")) {
- exit(1);
- }
- // "pear shell-test Foo ge 1.0"
- } elseif (sizeof($params) == 3) {
- $v = $reg->packageInfo($params[0], 'version');
- if (!$v || !version_compare("$v", "{$params[2]}", $params[1])) {
- exit(1);
- }
- } else {
- $this->popErrorHandling();
- $this->raiseError("$command: expects 1 to 3 parameters");
- exit(1);
- }
- }
-
- // }}}
- // {{{ doInfo
-
- function doInfo($command, $options, $params)
- {
- // $params[0] The package for showing info
- if (sizeof($params) != 1) {
- return $this->raiseError("This command only accepts one param: ".
- "the package you want information");
- }
- if (@is_file($params[0])) {
- $obj = &new PEAR_Common();
- $info = $obj->infoFromAny($params[0]);
- } else {
- $reg = &new PEAR_Registry($this->config->get('php_dir'));
- $info = $reg->packageInfo($params[0]);
- }
- if (PEAR::isError($info)) {
- return $info;
- }
- if (empty($info)) {
- $this->ui->displayError("Nothing found for `$params[0]'");
- return;
- }
- unset($info['filelist']);
- unset($info['changelog']);
- $keys = array_keys($info);
- $longtext = array('description', 'summary');
- foreach ($keys as $key) {
- if (is_array($info[$key])) {
- switch ($key) {
- case 'maintainers': {
- $i = 0;
- $mstr = '';
- foreach ($info[$key] as $m) {
- if ($i++ > 0) {
- $mstr .= "\n";
- }
- $mstr .= $m['name'] . " <";
- if (isset($m['email'])) {
- $mstr .= $m['email'];
- } else {
- $mstr .= $m['handle'] . '@php.net';
- }
- $mstr .= "> ($m[role])";
- }
- $info[$key] = $mstr;
- break;
- }
- case 'release_deps': {
- $i = 0;
- $dstr = '';
- foreach ($info[$key] as $d) {
- if (isset($this->_deps_rel_trans[$d['rel']])) {
- $rel = $this->_deps_rel_trans[$d['rel']];
- } else {
- $rel = $d['rel'];
- }
- if (isset($this->_deps_type_trans[$d['type']])) {
- $type = ucfirst($this->_deps_type_trans[$d['type']]);
- } else {
- $type = $d['type'];
- }
- if (isset($d['name'])) {
- $name = $d['name'] . ' ';
- } else {
- $name = '';
- }
- if (isset($d['version'])) {
- $version = $d['version'] . ' ';
- } else {
- $version = '';
- }
- $dstr .= "$type $name$rel $version\n";
- }
- $info[$key] = $dstr;
- break;
- }
- default: {
- $info[$key] = implode(", ", $info[$key]);
- break;
- }
- }
- }
- if ($key == '_lastmodified') {
- $hdate = date('Y-m-d', $info[$key]);
- unset($info[$key]);
- $info['Last Modified'] = $hdate;
- } else {
- $info[$key] = trim($info[$key]);
- if (in_array($key, $longtext)) {
- $info[$key] = preg_replace('/ +/', ' ', $info[$key]);
- }
- }
- }
- $caption = 'About ' . $info['package'] . '-' . $info['version'];
- $data = array(
- 'caption' => $caption,
- 'border' => true);
- foreach ($info as $key => $value) {
- $key = ucwords(trim(str_replace('_', ' ', $key)));
- $data['data'][] = array($key, $value);
- }
-
- $this->ui->outputData($data, 'package-info');
- }
-
- // }}}
-}
-
-?>
diff --git a/pear/PEAR/Command/Remote.php b/pear/PEAR/Command/Remote.php
deleted file mode 100644
index 85695fd104..0000000000
--- a/pear/PEAR/Command/Remote.php
+++ /dev/null
@@ -1,407 +0,0 @@
-<?php
-// /* vim: set expandtab tabstop=4 shiftwidth=4: */
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Stig Bakken <ssb@php.net> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR/Command/Common.php';
-require_once 'PEAR/Common.php';
-require_once 'PEAR/Remote.php';
-require_once 'PEAR/Registry.php';
-
-class PEAR_Command_Remote extends PEAR_Command_Common
-{
- // {{{ command definitions
-
- var $commands = array(
- 'remote-info' => array(
- 'summary' => 'Information About Remote Packages',
- 'function' => 'doRemoteInfo',
- 'shortcut' => 'ri',
- 'options' => array(),
- 'doc' => '<package>
-Get details on a package from the server.',
- ),
- 'list-upgrades' => array(
- 'summary' => 'List Available Upgrades',
- 'function' => 'doListUpgrades',
- 'shortcut' => 'lu',
- 'options' => array(),
- 'doc' => '
-List releases on the server of packages you have installed where
-a newer version is available with the same release state (stable etc.).'
- ),
- 'remote-list' => array(
- 'summary' => 'List Remote Packages',
- 'function' => 'doRemoteList',
- 'shortcut' => 'rl',
- 'options' => array(),
- 'doc' => '
-Lists the packages available on the configured server along with the
-latest stable release of each package.',
- ),
- 'search' => array(
- 'summary' => 'Search remote package database',
- 'function' => 'doSearch',
- 'shortcut' => 'sp',
- 'options' => array(),
- 'doc' => '
-Lists all packages which match the search parameters (first param
-is package name, second package info)',
- ),
- 'list-all' => array(
- 'summary' => 'List All Packages',
- 'function' => 'doListAll',
- 'shortcut' => 'la',
- 'options' => array(),
- 'doc' => '
-Lists the packages available on the configured server along with the
-latest stable release of each package.',
- ),
- 'download' => array(
- 'summary' => 'Download Package',
- 'function' => 'doDownload',
- 'shortcut' => 'd',
- 'options' => array(
- 'nocompress' => array(
- 'shortopt' => 'Z',
- 'doc' => 'download an uncompressed (.tar) file',
- ),
- ),
- 'doc' => '{package|package-version}
-Download a package tarball. The file will be named as suggested by the
-server, for example if you download the DB package and the latest stable
-version of DB is 1.2, the downloaded file will be DB-1.2.tgz.',
- ),
- 'clear-cache' => array(
- 'summary' => 'Clear XML-RPC Cache',
- 'function' => 'doClearCache',
- 'shortcut' => 'cc',
- 'options' => array(),
- 'doc' => '
-Clear the XML-RPC cache. See also the cache_ttl configuration
-parameter.
-',
- ),
- );
-
- // }}}
- // {{{ constructor
-
- /**
- * PEAR_Command_Remote constructor.
- *
- * @access public
- */
- function PEAR_Command_Remote(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- // }}}
-
- // {{{ doRemoteInfo()
-
- function doRemoteInfo($command, $options, $params)
- {
- if (sizeof($params) != 1) {
- return $this->raiseError("$command expects one param: the remote package name");
- }
- $r = new PEAR_Remote($this->config);
- $info = $r->call('package.info', $params[0]);
- if (PEAR::isError($info)) {
- return $this->raiseError($info);
- }
-
- $reg = new PEAR_Registry($this->config->get('php_dir'));
- $installed = $reg->packageInfo($info['name']);
- $info['installed'] = $installed['version'] ? $installed['version'] : '- no -';
-
- $this->ui->outputData($info, $command);
-
- return true;
- }
-
- // }}}
- // {{{ doRemoteList()
-
- function doRemoteList($command, $options, $params)
- {
- $r = new PEAR_Remote($this->config);
- $list_options = false;
- if ($this->config->get('preferred_state') == 'stable')
- $list_options = true;
- $available = $r->call('package.listAll', $list_options);
- if (PEAR::isError($available)) {
- return $this->raiseError($available);
- }
- $i = $j = 0;
- $data = array(
- 'caption' => 'Available packages:',
- 'border' => true,
- 'headline' => array('Package', 'Version'),
- );
- foreach ($available as $name => $info) {
- $data['data'][] = array($name, isset($info['stable']) ? $info['stable'] : '-n/a-');
- }
- if (count($available)==0) {
- $data = '(no packages installed yet)';
- }
- $this->ui->outputData($data, $command);
- return true;
- }
-
- // }}}
- // {{{ doListAll()
-
- function doListAll($command, $options, $params)
- {
- $r = new PEAR_Remote($this->config);
- $reg = new PEAR_Registry($this->config->get('php_dir'));
- $list_options = false;
- if ($this->config->get('preferred_state') == 'stable')
- $list_options = true;
- $available = $r->call('package.listAll', $list_options);
- if (PEAR::isError($available)) {
- return $this->raiseError($available);
- }
- if (!is_array($available)) {
- return $this->raiseError('The package list could not be fetched from the remote server. Please try again. (Debug info: "'.$available.'")');
- }
- $data = array(
- 'caption' => 'All packages:',
- 'border' => true,
- 'headline' => array('Package', 'Latest', 'Local'),
- );
-
- foreach ($available as $name => $info) {
- $installed = $reg->packageInfo($name);
- $desc = $info['summary'];
- if (isset($params[$name]))
- $desc .= "\n\n".$info['description'];
-
- if (isset($options['mode']))
- {
- if ($options['mode'] == 'installed' && !isset($installed['version']))
- continue;
- if ($options['mode'] == 'notinstalled' && isset($installed['version']))
- continue;
- if ($options['mode'] == 'upgrades'
- && (!isset($installed['version']) || $installed['version'] == $info['stable']))
- {
- continue;
- };
- };
-
- $data['data'][$info['category']][] = array(
- $name,
- @$info['stable'],
- @$installed['version'],
- @$desc,
- @$info['deps'],
- );
- }
- $this->ui->outputData($data, $command);
- return true;
- }
-
- // }}}
- // {{{ doSearch()
-
- function doSearch($command, $options, $params)
- {
- if ((!isset($params[0]) || empty($params[0]))
- && (!isset($params[1]) || empty($params[1])))
- {
- return $this->raiseError('no valid search string supplied');
- };
-
- $r = new PEAR_Remote($this->config);
- $reg = new PEAR_Registry($this->config->get('php_dir'));
- $available = $r->call('package.listAll', true);
- if (PEAR::isError($available)) {
- return $this->raiseError($available);
- }
- $data = array(
- 'caption' => 'Matched packages:',
- 'border' => true,
- 'headline' => array('Package', 'Latest', 'Local'),
- );
-
- foreach ($available as $name => $info) {
- $found = (!empty($params[0]) && stristr($name, $params[0]) !== false);
- if (!$found && !(isset($params[1]) && !empty($params[1])
- && (stristr($info['summary'], $params[1]) !== false
- || stristr($info['description'], $params[1]) !== false)))
- {
- continue;
- };
-
- $installed = $reg->packageInfo($name);
- $desc = $info['summary'];
- if (isset($params[$name]))
- $desc .= "\n\n".$info['description'];
-
- $data['data'][$info['category']][] = array(
- $name,
- $info['stable'],
- $installed['version'],
- $desc,
- );
- }
- if (!isset($data['data'])) {
- return $this->raiseError('no packages found');
- };
- $this->ui->outputData($data, $command);
- return true;
- }
-
- // }}}
- // {{{ doDownload()
-
- function doDownload($command, $options, $params)
- {
- //$params[0] -> The package to download
- if (count($params) != 1) {
- return PEAR::raiseError("download expects one argument: the package to download");
- }
- $server = $this->config->get('master_server');
- if (!ereg('^http://', $params[0])) {
- $pkgfile = "http://$server/get/$params[0]";
- } else {
- $pkgfile = $params[0];
- }
- $this->bytes_downloaded = 0;
- $saved = PEAR_Common::downloadHttp($pkgfile, $this->ui, '.',
- array(&$this, 'downloadCallback'));
- if (PEAR::isError($saved)) {
- return $this->raiseError($saved);
- }
- $fname = basename($saved);
- $this->ui->outputData("File $fname downloaded ($this->bytes_downloaded bytes)", $command);
- return true;
- }
-
- function downloadCallback($msg, $params = null)
- {
- if ($msg == 'done') {
- $this->bytes_downloaded = $params;
- }
- }
-
- // }}}
- // {{{ doListUpgrades()
-
- function doListUpgrades($command, $options, $params)
- {
- include_once "PEAR/Registry.php";
- $remote = new PEAR_Remote($this->config);
- if (empty($params[0])) {
- $state = $this->config->get('preferred_state');
- } else {
- $state = $params[0];
- }
- $caption = 'Available Upgrades';
- if (empty($state) || $state == 'any') {
- $latest = $remote->call("package.listLatestReleases");
- } else {
- $latest = $remote->call("package.listLatestReleases", $state);
- $caption .= ' (' . $state . ')';
- }
- $caption .= ':';
- if (PEAR::isError($latest)) {
- return $latest;
- }
- $reg = new PEAR_Registry($this->config->get('php_dir'));
- $inst = array_flip($reg->listPackages());
- $data = array(
- 'caption' => $caption,
- 'border' => 1,
- 'headline' => array('Package', 'Version', 'Size'),
- );
- foreach ($latest as $package => $info) {
- if (!isset($inst[$package])) {
- // skip packages we don't have installed
- continue;
- }
- extract($info);
- $inst_version = $reg->packageInfo($package, 'version');
- if (version_compare("$version", "$inst_version", "le")) {
- // installed version is up-to-date
- continue;
- }
- if ($filesize >= 20480) {
- $filesize += 1024 - ($filesize % 1024);
- $fs = sprintf("%dkB", $filesize / 1024);
- } elseif ($filesize > 0) {
- $filesize += 103 - ($filesize % 103);
- $fs = sprintf("%.1fkB", $filesize / 1024.0);
- } else {
- $fs = " -"; // XXX center instead
- }
- $data['data'][] = array($package, $version, $fs);
- }
- if (empty($data['data'])) {
- $this->ui->outputData('No upgrades available');
- } else {
- $this->ui->outputData($data, $command);
- }
- return true;
- }
-
- // }}}
- // {{{ doClearCache()
-
- function doClearCache($command, $options, $params)
- {
- $cache_dir = $this->config->get('cache_dir');
- $verbose = $this->config->get('verbose');
- $output = '';
- if (!($dp = @opendir($cache_dir))) {
- return $this->raiseError("opendir($cache_dir) failed: $php_errormsg");
- }
- if ($verbose >= 1) {
- $output .= "reading directory $cache_dir\n";
- }
- $num = 0;
- while ($ent = readdir($dp)) {
- if (preg_match('/^xmlrpc_cache_[a-z0-9]{32}$/', $ent)) {
- $path = $cache_dir . DIRECTORY_SEPARATOR . $ent;
- $ok = @unlink($path);
- if ($ok) {
- if ($verbose >= 2) {
- $output .= "deleted $path\n";
- }
- $num++;
- } elseif ($verbose >= 1) {
- $output .= "failed to delete $path\n";
- }
- }
- }
- closedir($dp);
- if ($verbose >= 1) {
- $output .= "$num cache entries cleared\n";
- }
- $this->ui->outputData(rtrim($output), $command);
- return $num;
- }
-
- // }}}
-}
-
-?>
diff --git a/pear/PEAR/Common.php b/pear/PEAR/Common.php
deleted file mode 100644
index 94ad6d6b59..0000000000
--- a/pear/PEAR/Common.php
+++ /dev/null
@@ -1,1674 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@php.net> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR.php';
-require_once 'Archive/Tar.php';
-require_once 'System.php';
-require_once 'PEAR/Config.php';
-
-// {{{ constants and globals
-
-define('PEAR_COMMON_PACKAGE_NAME_PREG', '/^([A-Z][a-zA-Z0-9_]+|[a-z][a-z0-9_]+)$/');
-
-/**
- * List of temporary files and directories registered by
- * PEAR_Common::addTempFile().
- * @var array
- */
-$GLOBALS['_PEAR_Common_tempfiles'] = array();
-
-/**
- * Valid maintainer roles
- * @var array
- */
-$GLOBALS['_PEAR_Common_maintainer_roles'] = array('lead','developer','contributor','helper');
-
-/**
- * Valid release states
- * @var array
- */
-$GLOBALS['_PEAR_Common_release_states'] = array('alpha','beta','stable','snapshot','devel');
-
-/**
- * Valid dependency types
- * @var array
- */
-$GLOBALS['_PEAR_Common_dependency_types'] = array('pkg','ext','php','prog','ldlib','rtlib','os','websrv','sapi');
-
-/**
- * Valid dependency relations
- * @var array
- */
-$GLOBALS['_PEAR_Common_dependency_relations'] = array('has','eq','lt','le','gt','ge');
-
-/**
- * Valid file roles
- * @var array
- */
-$GLOBALS['_PEAR_Common_file_roles'] = array('php','ext','test','doc','data','src','script');
-
-/**
- * Valid replacement types
- * @var array
- */
-$GLOBALS['_PEAR_Common_replacement_types'] = array('php-const', 'pear-config', 'package-info');
-
-/**
- * Valid "provide" types
- * @var array
- */
-$GLOBALS['_PEAR_Common_provide_types'] = array('ext', 'prog', 'class', 'function', 'feature', 'api');
-
-/**
- * Valid "provide" types
- * @var array
- */
-$GLOBALS['_PEAR_Common_script_phases'] = array('pre-install', 'post-install', 'pre-uninstall', 'post-uninstall', 'pre-build', 'post-build', 'pre-configure', 'post-configure', 'pre-setup', 'post-setup');
-
-// }}}
-
-/**
- * Class providing common functionality for PEAR adminsitration classes.
- */
-class PEAR_Common extends PEAR
-{
- // {{{ properties
-
- /** stack of elements, gives some sort of XML context */
- var $element_stack = array();
-
- /** name of currently parsed XML element */
- var $current_element;
-
- /** array of attributes of the currently parsed XML element */
- var $current_attributes = array();
-
- /** assoc with information about a package */
- var $pkginfo = array();
-
- /**
- * User Interface object (PEAR_Frontend_* class). If null,
- * the log() method uses print.
- * @var object
- */
- var $ui = null;
-
- /**
- * Configuration object (PEAR_Config).
- * @var object
- */
- var $config = null;
-
- var $current_path = null;
-
- /**
- * PEAR_SourceAnalyzer instance
- * @var object
- */
- var $source_analyzer = null;
-
- // }}}
-
- // {{{ constructor
-
- /**
- * PEAR_Common constructor
- *
- * @access public
- */
- function PEAR_Common()
- {
- parent::PEAR();
- $this->config = &PEAR_Config::singleton();
- $this->debug = $this->config->get('verbose');
- }
-
- // }}}
- // {{{ destructor
-
- /**
- * PEAR_Common destructor
- *
- * @access private
- */
- function _PEAR_Common()
- {
- // doesn't work due to bug #14744
- //$tempfiles = $this->_tempfiles;
- $tempfiles =& $GLOBALS['_PEAR_Common_tempfiles'];
- while ($file = array_shift($tempfiles)) {
- if (@is_dir($file)) {
- System::rm("-rf $file");
- } elseif (file_exists($file)) {
- unlink($file);
- }
- }
- }
-
- // }}}
- // {{{ addTempFile()
-
- /**
- * Register a temporary file or directory. When the destructor is
- * executed, all registered temporary files and directories are
- * removed.
- *
- * @param string $file name of file or directory
- *
- * @return void
- *
- * @access public
- */
- function addTempFile($file)
- {
- $GLOBALS['_PEAR_Common_tempfiles'][] = $file;
- }
-
- // }}}
- // {{{ mkDirHier()
-
- /**
- * Wrapper to System::mkDir(), creates a directory as well as
- * any necessary parent directories.
- *
- * @param string $dir directory name
- *
- * @return bool TRUE on success, or a PEAR error
- *
- * @access public
- */
- function mkDirHier($dir)
- {
- $this->log(2, "+ create dir $dir");
- return System::mkDir("-p $dir");
- }
-
- // }}}
- // {{{ log()
-
- /**
- * Logging method.
- *
- * @param int $level log level (0 is quiet, higher is noisier)
- * @param string $msg message to write to the log
- *
- * @return void
- *
- * @access public
- */
- function log($level, $msg)
- {
- if ($this->debug >= $level) {
- if (is_object($this->ui)) {
- $this->ui->log($msg);
- } else {
- print "$msg\n";
- }
- }
- }
-
- // }}}
- // {{{ mkTempDir()
-
- /**
- * Create and register a temporary directory.
- *
- * @param string $tmpdir (optional) Directory to use as tmpdir.
- * Will use system defaults (for example
- * /tmp or c:\windows\temp) if not specified
- *
- * @return string name of created directory
- *
- * @access public
- */
- function mkTempDir($tmpdir = '')
- {
- if ($tmpdir) {
- $topt = "-t $tmpdir ";
- } else {
- $topt = '';
- }
- if (!$tmpdir = System::mktemp($topt . '-d pear')) {
- return false;
- }
- $this->addTempFile($tmpdir);
- return $tmpdir;
- }
-
- // }}}
- // {{{ setFrontendObject()
-
- /**
- * Set object that represents the frontend to be used.
- *
- * @param object Reference of the frontend object
- * @return void
- * @access public
- */
- function setFrontendObject(&$ui)
- {
- $this->ui = &$ui;
- }
-
- // }}}
-
- // {{{ _unIndent()
-
- /**
- * Unindent given string (?)
- *
- * @param string $str The string that has to be unindented.
- * @return string
- * @access private
- */
- function _unIndent($str)
- {
- // remove leading newlines
- $str = preg_replace('/^[\r\n]+/', '', $str);
- // find whitespace at the beginning of the first line
- $indent_len = strspn($str, " \t");
- $indent = substr($str, 0, $indent_len);
- $data = '';
- // remove the same amount of whitespace from following lines
- foreach (explode("\n", $str) as $line) {
- if (substr($line, 0, $indent_len) == $indent) {
- $data .= substr($line, $indent_len) . "\n";
- }
- }
- return $data;
- }
-
- // }}}
- // {{{ _element_start()
-
- /**
- * XML parser callback for starting elements. Used while package
- * format version is not yet known.
- *
- * @param resource $xp XML parser resource
- * @param string $name name of starting element
- * @param array $attribs element attributes, name => value
- *
- * @return void
- *
- * @access private
- */
- function _element_start($xp, $name, $attribs)
- {
- array_push($this->element_stack, $name);
- $this->current_element = $name;
- $spos = sizeof($this->element_stack) - 2;
- $this->prev_element = ($spos >= 0) ? $this->element_stack[$spos] : '';
- $this->current_attributes = $attribs;
- switch ($name) {
- case 'package': {
- if (isset($attribs['version'])) {
- $vs = preg_replace('/[^0-9a-z]/', '_', $attribs['version']);
- } else {
- $vs = '1_0';
- }
- $elem_start = '_element_start_'. $vs;
- $elem_end = '_element_end_'. $vs;
- $cdata = '_pkginfo_cdata_'. $vs;
- xml_set_element_handler($xp, $elem_start, $elem_end);
- xml_set_character_data_handler($xp, $cdata);
- break;
- }
- }
- }
-
- // }}}
- // {{{ _element_end()
-
- /**
- * XML parser callback for ending elements. Used while package
- * format version is not yet known.
- *
- * @param resource $xp XML parser resource
- * @param string $name name of ending element
- *
- * @return void
- *
- * @access private
- */
- function _element_end($xp, $name)
- {
- }
-
- // }}}
-
- // Support for package DTD v1.0:
- // {{{ _element_start_1_0()
-
- /**
- * XML parser callback for ending elements. Used for version 1.0
- * packages.
- *
- * @param resource $xp XML parser resource
- * @param string $name name of ending element
- *
- * @return void
- *
- * @access private
- */
- function _element_start_1_0($xp, $name, $attribs)
- {
- array_push($this->element_stack, $name);
- $this->current_element = $name;
- $spos = sizeof($this->element_stack) - 2;
- $this->prev_element = ($spos >= 0) ? $this->element_stack[$spos] : '';
- $this->current_attributes = $attribs;
- $this->cdata = '';
- switch ($name) {
- case 'dir':
- if ($this->in_changelog) {
- break;
- }
- if ($attribs['name'] != '/') {
- $this->dir_names[] = $attribs['name'];
- }
- if (isset($attribs['baseinstalldir'])) {
- $this->dir_install = $attribs['baseinstalldir'];
- }
- if (isset($attribs['role'])) {
- $this->dir_role = $attribs['role'];
- }
- break;
- case 'file':
- if ($this->in_changelog) {
- break;
- }
- if (isset($attribs['name'])) {
- $path = '';
- if (count($this->dir_names)) {
- foreach ($this->dir_names as $dir) {
- $path .= $dir . DIRECTORY_SEPARATOR;
- }
- }
- $path .= $attribs['name'];
- unset($attribs['name']);
- $this->current_path = $path;
- $this->filelist[$path] = $attribs;
- // Set the baseinstalldir only if the file don't have this attrib
- if (!isset($this->filelist[$path]['baseinstalldir']) &&
- isset($this->dir_install))
- {
- $this->filelist[$path]['baseinstalldir'] = $this->dir_install;
- }
- // Set the Role
- if (!isset($this->filelist[$path]['role']) && isset($this->dir_role)) {
- $this->filelist[$path]['role'] = $this->dir_role;
- }
- }
- break;
- case 'replace':
- if (!$this->in_changelog) {
- $this->filelist[$this->current_path]['replacements'][] = $attribs;
- }
- break;
- case 'maintainers':
- $this->pkginfo['maintainers'] = array();
- $this->m_i = 0; // maintainers array index
- break;
- case 'maintainer':
- // compatibility check
- if (!isset($this->pkginfo['maintainers'])) {
- $this->pkginfo['maintainers'] = array();
- $this->m_i = 0;
- }
- $this->pkginfo['maintainers'][$this->m_i] = array();
- $this->current_maintainer =& $this->pkginfo['maintainers'][$this->m_i];
- break;
- case 'changelog':
- $this->pkginfo['changelog'] = array();
- $this->c_i = 0; // changelog array index
- $this->in_changelog = true;
- break;
- case 'release':
- if ($this->in_changelog) {
- $this->pkginfo['changelog'][$this->c_i] = array();
- $this->current_release = &$this->pkginfo['changelog'][$this->c_i];
- } else {
- $this->current_release = &$this->pkginfo;
- }
- break;
- case 'deps':
- if (!$this->in_changelog) {
- $this->pkginfo['release_deps'] = array();
- }
- break;
- case 'dep':
- // dependencies array index
- if (!$this->in_changelog) {
- $this->d_i++;
- $this->pkginfo['release_deps'][$this->d_i] = $attribs;
- }
- break;
- case 'configureoptions':
- if (!$this->in_changelog) {
- $this->pkginfo['configure_options'] = array();
- }
- break;
- case 'configureoption':
- if (!$this->in_changelog) {
- $this->pkginfo['configure_options'][] = $attribs;
- }
- break;
- case 'provides':
- if (empty($attribs['type']) || empty($attribs['name'])) {
- break;
- }
- $attribs['explicit'] = true;
- $this->pkginfo['provides']["$attribs[type];$attribs[name]"] = $attribs;
- break;
- }
- }
-
- // }}}
- // {{{ _element_end_1_0()
-
- /**
- * XML parser callback for ending elements. Used for version 1.0
- * packages.
- *
- * @param resource $xp XML parser resource
- * @param string $name name of ending element
- *
- * @return void
- *
- * @access private
- */
- function _element_end_1_0($xp, $name)
- {
- $data = trim($this->cdata);
- switch ($name) {
- case 'name':
- switch ($this->prev_element) {
- case 'package':
- // XXX should we check the package name here?
- $this->pkginfo['package'] = ereg_replace('[^a-zA-Z0-9._]', '_', $data);
- break;
- case 'maintainer':
- $this->current_maintainer['name'] = $data;
- break;
- }
- break;
- case 'summary':
- $this->pkginfo['summary'] = $data;
- break;
- case 'description':
- $data = $this->_unIndent($this->cdata);
- $this->pkginfo['description'] = $data;
- break;
- case 'user':
- $this->current_maintainer['handle'] = $data;
- break;
- case 'email':
- $this->current_maintainer['email'] = $data;
- break;
- case 'role':
- $this->current_maintainer['role'] = $data;
- break;
- case 'version':
- $data = ereg_replace ('[^a-zA-Z0-9._\-]', '_', $data);
- if ($this->in_changelog) {
- $this->current_release['version'] = $data;
- } else {
- $this->pkginfo['version'] = $data;
- }
- break;
- case 'date':
- if ($this->in_changelog) {
- $this->current_release['release_date'] = $data;
- } else {
- $this->pkginfo['release_date'] = $data;
- }
- break;
- case 'notes':
- // try to "de-indent" release notes in case someone
- // has been over-indenting their xml ;-)
- $data = $this->_unIndent($this->cdata);
- if ($this->in_changelog) {
- $this->current_release['release_notes'] = $data;
- } else {
- $this->pkginfo['release_notes'] = $data;
- }
- break;
- case 'warnings':
- if ($this->in_changelog) {
- $this->current_release['release_warnings'] = $data;
- } else {
- $this->pkginfo['release_warnings'] = $data;
- }
- break;
- case 'state':
- if ($this->in_changelog) {
- $this->current_release['release_state'] = $data;
- } else {
- $this->pkginfo['release_state'] = $data;
- }
- break;
- case 'license':
- $this->pkginfo['release_license'] = $data;
- break;
- case 'dep':
- if ($data && !$this->in_changelog) {
- $this->pkginfo['release_deps'][$this->d_i]['name'] = $data;
- }
- break;
- case 'dir':
- if ($this->in_changelog) {
- break;
- }
- array_pop($this->dir_names);
- break;
- case 'file':
- if ($this->in_changelog) {
- break;
- }
- if ($data) {
- $path = '';
- if (count($this->dir_names)) {
- foreach ($this->dir_names as $dir) {
- $path .= $dir . DIRECTORY_SEPARATOR;
- }
- }
- $path .= $data;
- $this->filelist[$path] = $this->current_attributes;
- // Set the baseinstalldir only if the file don't have this attrib
- if (!isset($this->filelist[$path]['baseinstalldir']) &&
- isset($this->dir_install))
- {
- $this->filelist[$path]['baseinstalldir'] = $this->dir_install;
- }
- // Set the Role
- if (!isset($this->filelist[$path]['role']) && isset($this->dir_role)) {
- $this->filelist[$path]['role'] = $this->dir_role;
- }
- }
- break;
- case 'maintainer':
- if (empty($this->pkginfo['maintainers'][$this->m_i]['role'])) {
- $this->pkginfo['maintainers'][$this->m_i]['role'] = 'lead';
- }
- $this->m_i++;
- break;
- case 'release':
- if ($this->in_changelog) {
- $this->c_i++;
- }
- break;
- case 'changelog':
- $this->in_changelog = false;
- break;
- case 'summary':
- $this->pkginfo['summary'] = $data;
- break;
- }
- array_pop($this->element_stack);
- $spos = sizeof($this->element_stack) - 1;
- $this->current_element = ($spos > 0) ? $this->element_stack[$spos] : '';
- $this->cdata = '';
- }
-
- // }}}
- // {{{ _pkginfo_cdata_1_0()
-
- /**
- * XML parser callback for character data. Used for version 1.0
- * packages.
- *
- * @param resource $xp XML parser resource
- * @param string $name character data
- *
- * @return void
- *
- * @access private
- */
- function _pkginfo_cdata_1_0($xp, $data)
- {
- if (isset($this->cdata)) {
- $this->cdata .= $data;
- }
- }
-
- // }}}
-
- // {{{ infoFromTgzFile()
-
- /**
- * Returns information about a package file. Expects the name of
- * a gzipped tar file as input.
- *
- * @param string $file name of .tgz file
- *
- * @return array array with package information
- *
- * @access public
- *
- */
- function infoFromTgzFile($file)
- {
- if (!@is_file($file)) {
- return $this->raiseError("could not open file \"$file\"");
- }
- $tar = new Archive_Tar($file);
- $content = $tar->listContent();
- if (!is_array($content)) {
- return $this->raiseError("could not get contents of package \"$file\"");
- }
- $xml = null;
- foreach ($content as $file) {
- $name = $file['filename'];
- if ($name == 'package.xml') {
- $xml = $name;
- break;
- } elseif (ereg('package.xml$', $name, $match)) {
- $xml = $match[0];
- break;
- }
- }
- $tmpdir = System::mkTemp('-d pear');
- $this->addTempFile($tmpdir);
- if (!$xml || !$tar->extractList($xml, $tmpdir)) {
- return $this->raiseError('could not extract the package.xml file');
- }
- return $this->infoFromDescriptionFile("$tmpdir/$xml");
- }
-
- // }}}
- // {{{ infoFromDescriptionFile()
-
- /**
- * Returns information about a package file. Expects the name of
- * a package xml file as input.
- *
- * @param string $descfile name of package xml file
- *
- * @return array array with package information
- *
- * @access public
- *
- */
- function infoFromDescriptionFile($descfile)
- {
- if (!@is_file($descfile) || !is_readable($descfile) ||
- (!$fp = @fopen($descfile, 'r'))) {
- return $this->raiseError("Unable to open $descfile");
- }
-
- // read the whole thing so we only get one cdata callback
- // for each block of cdata
- $data = fread($fp, filesize($descfile));
- return $this->infoFromString($data);
- }
-
- // }}}
- // {{{ infoFromString()
-
- /**
- * Returns information about a package file. Expects the contents
- * of a package xml file as input.
- *
- * @param string $data name of package xml file
- *
- * @return array array with package information
- *
- * @access public
- *
- */
- function infoFromString($data)
- {
- require_once('PEAR/Dependency.php');
- if (PEAR_Dependency::checkExtension($error, 'xml')) {
- return $this->raiseError($error);
- }
- $xp = @xml_parser_create();
- if (!$xp) {
- return $this->raiseError('Unable to create XML parser');
- }
- xml_set_object($xp, $this);
- xml_set_element_handler($xp, '_element_start', '_element_end');
- xml_set_character_data_handler($xp, '_pkginfo_cdata');
- xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
-
- $this->element_stack = array();
- $this->pkginfo = array('provides' => array());
- $this->current_element = false;
- unset($this->dir_install);
- $this->pkginfo['filelist'] = array();
- $this->filelist =& $this->pkginfo['filelist'];
- $this->dir_names = array();
- $this->in_changelog = false;
- $this->d_i = 0;
- $this->cdata = '';
-
- if (!xml_parse($xp, $data, 1)) {
- $code = xml_get_error_code($xp);
- $msg = sprintf("XML error: %s at line %d",
- xml_error_string($code),
- xml_get_current_line_number($xp));
- xml_parser_free($xp);
- return $this->raiseError($msg, $code);
- }
-
- xml_parser_free($xp);
-
- foreach ($this->pkginfo as $k => $v) {
- if (!is_array($v)) {
- $this->pkginfo[$k] = trim($v);
- }
- }
- return $this->pkginfo;
- }
- // }}}
- // {{{ infoFromAny()
-
- /**
- * Returns package information from different sources
- *
- * This method is able to extract information about a package
- * from a .tgz archive or from a XML package definition file.
- *
- * @access public
- * @param string Filename of the source ('package.xml', '<package>.tgz')
- * @return string
- */
- function infoFromAny($info)
- {
- if (is_string($info) && file_exists($info)) {
- $tmp = substr($info, -4);
- if ($tmp == '.xml') {
- $info = $this->infoFromDescriptionFile($info);
- } elseif ($tmp == '.tar' || $tmp == '.tgz') {
- $info = $this->infoFromTgzFile($info);
- } else {
- $fp = fopen($info, "r");
- $test = fread($fp, 5);
- fclose($fp);
- if ($test == "<?xml") {
- $info = $this->infoFromDescriptionFile($info);
- } else {
- $info = $this->infoFromTgzFile($info);
- }
- }
- if (PEAR::isError($info)) {
- return $this->raiseError($info);
- }
- }
- return $info;
- }
-
- // }}}
- // {{{ xmlFromInfo()
-
- /**
- * Return an XML document based on the package info (as returned
- * by the PEAR_Common::infoFrom* methods).
- *
- * @param array $pkginfo package info
- *
- * @return string XML data
- *
- * @access public
- */
- function xmlFromInfo($pkginfo)
- {
- static $maint_map = array(
- "handle" => "user",
- "name" => "name",
- "email" => "email",
- "role" => "role",
- );
- $ret = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
- //$ret .= "<!DOCTYPE package SYSTEM \"http://pear.php.net/package10.dtd\">\n";
- $ret .= "<package version=\"1.0\">
- <name>$pkginfo[package]</name>
- <summary>".htmlspecialchars($pkginfo['summary'])."</summary>
- <description>".htmlspecialchars($pkginfo['description'])."</description>
- <maintainers>
-";
- foreach ($pkginfo['maintainers'] as $maint) {
- $ret .= " <maintainer>\n";
- foreach ($maint_map as $idx => $elm) {
- $ret .= " <$elm>";
- $ret .= htmlspecialchars($maint[$idx]);
- $ret .= "</$elm>\n";
- }
- $ret .= " </maintainer>\n";
- }
- $ret .= " </maintainers>\n";
- $ret .= $this->_makeReleaseXml($pkginfo);
- if (@sizeof($pkginfo['changelog']) > 0) {
- $ret .= " <changelog>\n";
- foreach ($pkginfo['changelog'] as $oldrelease) {
- $ret .= $this->_makeReleaseXml($oldrelease, true);
- }
- $ret .= " </changelog>\n";
- }
- $ret .= "</package>\n";
- return $ret;
- }
-
- // }}}
- // {{{ _makeReleaseXml()
-
- /**
- * Generate part of an XML description with release information.
- *
- * @param array $pkginfo array with release information
- * @param bool $changelog whether the result will be in a changelog element
- *
- * @return string XML data
- *
- * @access private
- */
- function _makeReleaseXml($pkginfo, $changelog = false)
- {
- // XXX QUOTE ENTITIES IN PCDATA, OR EMBED IN CDATA BLOCKS!!
- $indent = $changelog ? " " : "";
- $ret = "$indent <release>\n";
- if (!empty($pkginfo['version'])) {
- $ret .= "$indent <version>$pkginfo[version]</version>\n";
- }
- if (!empty($pkginfo['release_date'])) {
- $ret .= "$indent <date>$pkginfo[release_date]</date>\n";
- }
- if (!empty($pkginfo['release_license'])) {
- $ret .= "$indent <license>$pkginfo[release_license]</license>\n";
- }
- if (!empty($pkginfo['release_state'])) {
- $ret .= "$indent <state>$pkginfo[release_state]</state>\n";
- }
- if (!empty($pkginfo['release_notes'])) {
- $ret .= "$indent <notes>".htmlspecialchars($pkginfo['release_notes'])."</notes>\n";
- }
- if (!empty($pkginfo['release_warnings'])) {
- $ret .= "$indent <warnings>".htmlspecialchars($pkginfo['release_warnings'])."</warnings>\n";
- }
- if (isset($pkginfo['release_deps']) && sizeof($pkginfo['release_deps']) > 0) {
- $ret .= "$indent <deps>\n";
- foreach ($pkginfo['release_deps'] as $dep) {
- $ret .= "$indent <dep type=\"$dep[type]\" rel=\"$dep[rel]\"";
- if (isset($dep['version'])) {
- $ret .= " version=\"$dep[version]\"";
- }
- if (isset($dep['name'])) {
- $ret .= ">$dep[name]</dep>\n";
- } else {
- $ret .= "/>\n";
- }
- }
- $ret .= "$indent </deps>\n";
- }
- if (isset($pkginfo['configure_options'])) {
- $ret .= "$indent <configureoptions>\n";
- foreach ($pkginfo['configure_options'] as $c) {
- $ret .= "$indent <configureoption name=\"".
- htmlspecialchars($c['name']) . "\"";
- if (isset($c['default'])) {
- $ret .= " default=\"" . htmlspecialchars($c['default']) . "\"";
- }
- $ret .= " prompt=\"" . htmlspecialchars($c['prompt']) . "\"";
- $ret .= "/>\n";
- }
- $ret .= "$indent </configureoptions>\n";
- }
- if (isset($pkginfo['provides'])) {
- foreach ($pkginfo['provides'] as $key => $what) {
- $ret .= "$indent <provides type=\"$what[type]\" ";
- $ret .= "name=\"$what[name]\" ";
- if (isset($what['extends'])) {
- $ret .= "extends=\"$what[extends]\" ";
- }
- $ret .= "/>\n";
- }
- }
- if (isset($pkginfo['filelist'])) {
- $ret .= "$indent <filelist>\n";
- foreach ($pkginfo['filelist'] as $file => $fa) {
- @$ret .= "$indent <file role=\"$fa[role]\"";
- if (isset($fa['baseinstalldir'])) {
- $ret .= ' baseinstalldir="' .
- htmlspecialchars($fa['baseinstalldir']) . '"';
- }
- if (isset($fa['md5sum'])) {
- $ret .= " md5sum=\"$fa[md5sum]\"";
- }
- if (isset($fa['platform'])) {
- $ret .= " platform=\"$fa[platform]\"";
- }
- if (!empty($fa['install-as'])) {
- $ret .= ' install-as="' .
- htmlspecialchars($fa['install-as']) . '"';
- }
- $ret .= ' name="' . htmlspecialchars($file) . '"';
- if (empty($fa['replacements'])) {
- $ret .= "/>\n";
- } else {
- $ret .= ">\n";
- foreach ($fa['replacements'] as $r) {
- $ret .= "$indent <replace";
- foreach ($r as $k => $v) {
- $ret .= " $k=\"" . htmlspecialchars($v) .'"';
- }
- $ret .= "/>\n";
- }
- @$ret .= "$indent </file>\n";
- }
- }
- $ret .= "$indent </filelist>\n";
- }
- $ret .= "$indent </release>\n";
- return $ret;
- }
-
- // }}}
- // {{{ validatePackageInfo()
-
- /**
- * Validate XML package definition file.
- *
- * @param string $info Filename of the package archive or of the
- * package definition file
- * @param array $errors Array that will contain the errors
- * @param array $warnings Array that will contain the warnings
- * @param string $dir_prefix (optional) directory where source files
- * may be found, or empty if they are not available
- * @access public
- * @return boolean
- */
- function validatePackageInfo($info, &$errors, &$warnings, $dir_prefix = '')
- {
- global $_PEAR_Common_maintainer_roles,
- $_PEAR_Common_release_states,
- $_PEAR_Common_dependency_types,
- $_PEAR_Common_dependency_relations,
- $_PEAR_Common_file_roles,
- $_PEAR_Common_replacement_types;
- if (PEAR::isError($info = $this->infoFromAny($info))) {
- return $this->raiseError($info);
- }
- if (!is_array($info)) {
- return false;
- }
- $errors = array();
- $warnings = array();
- if (empty($info['package'])) {
- $errors[] = 'missing package name';
- }
- if (empty($info['summary'])) {
- $errors[] = 'missing summary';
- } elseif (strpos(trim($info['summary']), "\n") !== false) {
- $warnings[] = 'summary should be on a single line';
- }
- if (empty($info['description'])) {
- $errors[] = 'missing description';
- }
- if (empty($info['release_license'])) {
- $errors[] = 'missing license';
- }
- if (empty($info['version'])) {
- $errors[] = 'missing version';
- }
- if (empty($info['release_state'])) {
- $errors[] = 'missing release state';
- } elseif (!in_array($info['release_state'], $_PEAR_Common_release_states)) {
- $errors[] = "invalid release state `$info[release_state]', should be one of: ".implode(' ', $_PEAR_Common_release_states);
- }
- if (empty($info['release_date'])) {
- $errors[] = 'missing release date';
- } elseif (!preg_match('/^\d{4}-\d\d-\d\d$/', $info['release_date'])) {
- $errors[] = "invalid release date `$info[release_date]', format is YYYY-MM-DD";
- }
- if (empty($info['release_notes'])) {
- $errors[] = "missing release notes";
- }
- if (empty($info['maintainers'])) {
- $errors[] = 'no maintainer(s)';
- } else {
- $i = 1;
- foreach ($info['maintainers'] as $m) {
- if (empty($m['handle'])) {
- $errors[] = "maintainer $i: missing handle";
- }
- if (empty($m['role'])) {
- $errors[] = "maintainer $i: missing role";
- } elseif (!in_array($m['role'], $_PEAR_Common_maintainer_roles)) {
- $errors[] = "maintainer $i: invalid role `$m[role]', should be one of: ".implode(' ', $_PEAR_Common_maintainer_roles);
- }
- if (empty($m['name'])) {
- $errors[] = "maintainer $i: missing name";
- }
- if (empty($m['email'])) {
- $errors[] = "maintainer $i: missing email";
- }
- $i++;
- }
- }
- if (!empty($info['deps'])) {
- $i = 1;
- foreach ($info['deps'] as $d) {
- if (empty($d['type'])) {
- $errors[] = "depenency $i: missing type";
- } elseif (!in_array($d['type'], $_PEAR_Common_dependency_types)) {
- $errors[] = "dependency $i: invalid type, should be one of: ".implode(' ', $_PEAR_Common_depenency_types);
- }
- if (empty($d['rel'])) {
- $errors[] = "dependency $i: missing relation";
- } elseif (!in_array($d['rel'], $_PEAR_Common_dependency_relations)) {
- $errors[] = "dependency $i: invalid relation, should be one of: ".implode(' ', $_PEAR_Common_dependency_relations);
- }
- if ($d['rel'] != 'has' && empty($d['version'])) {
- $warnings[] = "dependency $i: missing version";
- } elseif ($d['rel'] == 'has' && !empty($d['version'])) {
- $warnings[] = "dependency $i: version ignored for `has' dependencies";
- }
- if ($d['type'] == 'php' && !empty($d['name'])) {
- $warnings[] = "dependency $i: name ignored for php type dependencies";
- } elseif ($d['type'] != 'php' && empty($d['name'])) {
- $errors[] = "dependency $i: missing name";
- }
- $i++;
- }
- }
- if (!empty($info['configure_options'])) {
- $i = 1;
- foreach ($info['configure_options'] as $c) {
- if (empty($c['name'])) {
- $errors[] = "configure option $i: missing name";
- }
- if (empty($c['prompt'])) {
- $errors[] = "configure option $i: missing prompt";
- }
- }
- }
- if (empty($info['filelist'])) {
- $errors[] = 'no files';
- } else {
- foreach ($info['filelist'] as $file => $fa) {
- if (empty($fa['role'])) {
- $errors[] = "file $file: missing role";
- continue;
- } elseif (!in_array($fa['role'], $_PEAR_Common_file_roles)) {
- $errors[] = "file $file: invalid role, should be one of: ".implode(' ', $_PEAR_Common_file_roles);
- }
- if ($fa['role'] == 'php' && $dir_prefix) {
- $this->log(1, "Analyzing $file");
- $srcinfo = $this->analyzeSourceCode($dir_prefix . DIRECTORY_SEPARATOR . $file);
- if ($srcinfo) {
- $this->buildProvidesArray($srcinfo);
- }
- }
- // (ssb) Any checks we can do for baseinstalldir?
- // (cox) Perhaps checks that either the target dir and
- // baseInstall doesn't cointain "../../"
- }
- }
- $pn = $info['package'];
- $pnl = strlen($pn);
- foreach ((array)$this->pkginfo['provides'] as $key => $what) {
- if (isset($what['explicit'])) {
- // skip conformance checks if the provides entry is
- // specified in the package.xml file
- continue;
- }
- extract($what);
- if ($type == 'class') {
- if (!strncasecmp($name, $pn, $pnl)) {
- continue;
- }
- $warnings[] = "in $file: class \"$name\" not prefixed with package name \"$pn\"";
- } elseif ($type == 'function') {
- if (strstr($name, '::') || !strncasecmp($name, $pn, $pnl)) {
- continue;
- }
- $warnings[] = "in $file: function \"$name\" not prefixed with package name \"$pn\"";
- }
- //print "$file: provides $what[type] $what[name]\n";
- }
- return true;
- }
-
- // }}}
- // {{{ buildProvidesArray()
-
- /**
- * Build a "provides" array from data returned by
- * analyzeSourceCode(). The format of the built array is like
- * this:
- *
- * array(
- * 'class;MyClass' => 'array('type' => 'class', 'name' => 'MyClass'),
- * ...
- * )
- *
- *
- * @param array $srcinfo array with information about a source file
- * as returned by the analyzeSourceCode() method.
- *
- * @return void
- *
- * @access public
- *
- */
- function buildProvidesArray($srcinfo)
- {
- foreach ($srcinfo['declared_classes'] as $class) {
- $key = "class;$class";
- if (isset($this->pkginfo['provides'][$key])) {
- continue;
- }
- $this->pkginfo['provides'][$key] =
- array('type' => 'class', 'name' => $class);
- if (isset($srcinfo['inheritance'][$class])) {
- $this->pkginfo['provides'][$key]['extends'] =
- $srcinfo['inheritance'][$class];
- }
- }
- foreach ($srcinfo['declared_methods'] as $class => $methods) {
- foreach ($methods as $method) {
- $function = "$class::$method";
- $key = "function;$function";
- if ($method{0} == '_' || !strcasecmp($method, $class) ||
- isset($this->pkginfo['provides'][$key])) {
- continue;
- }
- $this->pkginfo['provides'][$key] =
- array('type' => 'function', 'name' => $function);
- }
- }
- foreach ($srcinfo['declared_functions'] as $function) {
- $key = "function;$function";
- if ($function{0} == '_' || isset($this->pkginfo['provides'][$key])) {
- continue;
- }
- $this->pkginfo['provides'][$key] =
- array('type' => 'function', 'name' => $function);
- }
- }
-
- // }}}
- // {{{ analyzeSourceCode()
-
- /**
- * Analyze the source code of the given PHP file
- *
- * @param string Filename of the PHP file
- * @return mixed
- * @access public
- */
- function analyzeSourceCode($file)
- {
- if (!function_exists("token_get_all")) {
- return false;
- }
- if (!$fp = @fopen($file, "r")) {
- return false;
- }
- $contents = fread($fp, filesize($file));
- $tokens = token_get_all($contents);
-/*
- for ($i = 0; $i < sizeof($tokens); $i++) {
- @list($token, $data) = $tokens[$i];
- if (is_string($token)) {
- var_dump($token);
- } else {
- print token_name($token) . ' ';
- var_dump(rtrim($data));
- }
- }
-*/
- $look_for = 0;
- $paren_level = 0;
- $bracket_level = 0;
- $brace_level = 0;
- $lastphpdoc = '';
- $current_class = '';
- $current_class_level = -1;
- $current_function = '';
- $current_function_level = -1;
- $declared_classes = array();
- $declared_functions = array();
- $declared_methods = array();
- $used_classes = array();
- $used_functions = array();
- $extends = array();
- $nodeps = array();
- for ($i = 0; $i < sizeof($tokens); $i++) {
- if (is_array($tokens[$i])) {
- list($token, $data) = $tokens[$i];
- } else {
- $token = $tokens[$i];
- $data = '';
- }
- switch ($token) {
- case T_CURLY_OPEN:
- case T_DOLLAR_OPEN_CURLY_BRACES:
- case '{': $brace_level++; continue 2;
- case '}':
- $brace_level--;
- if ($current_class_level == $brace_level) {
- $current_class = '';
- $current_class_level = -1;
- }
- if ($current_function_level == $brace_level) {
- $current_function = '';
- $current_function_level = -1;
- }
- continue 2;
- case '[': $bracket_level++; continue 2;
- case ']': $bracket_level--; continue 2;
- case '(': $paren_level++; continue 2;
- case ')': $paren_level--; continue 2;
- case T_CLASS:
- case T_FUNCTION:
- case T_NEW:
- case T_EXTENDS:
- $look_for = $token;
- continue 2;
- case T_STRING:
- if ($look_for == T_CLASS) {
- $current_class = $data;
- $current_class_level = $brace_level;
- $declared_classes[] = $current_class;
- } elseif ($look_for == T_EXTENDS) {
- $extends[$current_class] = $data;
- } elseif ($look_for == T_FUNCTION) {
- if ($current_class) {
- $current_function = "$current_class::$data";
- $declared_methods[$current_class][] = $data;
- } else {
- $current_function = $data;
- $declared_functions[] = $current_function;
- }
- $current_function_level = $brace_level;
- $m = array();
- } elseif ($look_for == T_NEW) {
- $used_classes[$data] = true;
- }
- $look_for = 0;
- continue 2;
- case T_VARIABLE:
- $look_for = 0;
- continue 2;
- case T_COMMENT:
- if (preg_match('!^/\*\*\s!', $data)) {
- $lastphpdoc = $data;
- if (preg_match_all('/@nodep\s+(\S+)/', $lastphpdoc, $m)) {
- $nodeps = array_merge($nodeps, $m[1]);
- }
- }
- continue 2;
- case T_DOUBLE_COLON:
- $class = $tokens[$i - 1][1];
- if (strtolower($class) != 'parent') {
- $used_classes[$class] = true;
- }
- continue 2;
- }
- }
- return array(
- "declared_classes" => $declared_classes,
- "declared_methods" => $declared_methods,
- "declared_functions" => $declared_functions,
- "used_classes" => array_diff(array_keys($used_classes), $nodeps),
- "inheritance" => $extends,
- );
- }
-
- // }}}
- // {{{ detectDependencies()
-
- function detectDependencies($any, $status_callback = null)
- {
- if (!function_exists("token_get_all")) {
- return false;
- }
- if (PEAR::isError($info = $this->infoFromAny($any))) {
- return $this->raiseError($info);
- }
- if (!is_array($info)) {
- return false;
- }
- $deps = array();
- $used_c = $decl_c = $decl_f = $decl_m = array();
- foreach ($info['filelist'] as $file => $fa) {
- $tmp = $this->analyzeSourceCode($file);
- $used_c = @array_merge($used_c, $tmp['used_classes']);
- $decl_c = @array_merge($decl_c, $tmp['declared_classes']);
- $decl_f = @array_merge($decl_f, $tmp['declared_functions']);
- $decl_m = @array_merge($decl_m, $tmp['declared_methods']);
- $inheri = @array_merge($inheri, $tmp['inheritance']);
- }
- $used_c = array_unique($used_c);
- $decl_c = array_unique($decl_c);
- $undecl_c = array_diff($used_c, $decl_c);
- return array('used_classes' => $used_c,
- 'declared_classes' => $decl_c,
- 'declared_methods' => $decl_m,
- 'declared_functions' => $decl_f,
- 'undeclared_classes' => $undecl_c,
- 'inheritance' => $inheri,
- );
- }
-
- // }}}
- // {{{ getUserRoles()
-
- /**
- * Get the valid roles for a PEAR package maintainer
- *
- * @return array
- * @static
- */
- function getUserRoles()
- {
- return $GLOBALS['_PEAR_Common_maintainer_roles'];
- }
-
- // }}}
- // {{{ getReleaseStates()
-
- /**
- * Get the valid package release states of packages
- *
- * @return array
- * @static
- */
- function getReleaseStates()
- {
- return $GLOBALS['_PEAR_Common_release_states'];
- }
-
- // }}}
- // {{{ getDependencyTypes()
-
- /**
- * Get the implemented dependency types (php, ext, pkg etc.)
- *
- * @return array
- * @static
- */
- function getDependencyTypes()
- {
- return $GLOBALS['_PEAR_Common_dependency_types'];
- }
-
- // }}}
- // {{{ getDependencyRelations()
-
- /**
- * Get the implemented dependency relations (has, lt, ge etc.)
- *
- * @return array
- * @static
- */
- function getDependencyRelations()
- {
- return $GLOBALS['_PEAR_Common_dependency_relations'];
- }
-
- // }}}
- // {{{ getFileRoles()
-
- /**
- * Get the implemented file roles
- *
- * @return array
- * @static
- */
- function getFileRoles()
- {
- return $GLOBALS['_PEAR_Common_file_roles'];
- }
-
- // }}}
- // {{{ getReplacementTypes()
-
- /**
- * Get the implemented file replacement types in
- *
- * @return array
- * @static
- */
- function getReplacementTypes()
- {
- return $GLOBALS['_PEAR_Common_replacement_types'];
- }
-
- // }}}
- // {{{ getProvideTypes()
-
- /**
- * Get the implemented file replacement types in
- *
- * @return array
- * @static
- */
- function getProvideTypes()
- {
- return $GLOBALS['_PEAR_Common_provide_types'];
- }
-
- // }}}
- // {{{ getScriptPhases()
-
- /**
- * Get the implemented file replacement types in
- *
- * @return array
- * @static
- */
- function getScriptPhases()
- {
- return $GLOBALS['_PEAR_Common_script_phases'];
- }
-
- // }}}
- // {{{ validPackageName()
-
- /**
- * Test whether a string contains a valid package name.
- *
- * @param string $name the package name to test
- *
- * @return bool
- *
- * @access public
- */
- function validPackageName($name)
- {
- return (bool)preg_match(PEAR_COMMON_PACKAGE_NAME_PREG, $name);
- }
-
-
- // }}}
-
- // {{{ downloadHttp()
-
- /**
- * Download a file through HTTP. Considers suggested file name in
- * Content-disposition: header and can run a callback function for
- * different events. The callback will be called with two
- * parameters: the callback type, and parameters. The implemented
- * callback types are:
- *
- * 'setup' called at the very beginning, parameter is a UI object
- * that should be used for all output
- * 'message' the parameter is a string with an informational message
- * 'saveas' may be used to save with a different file name, the
- * parameter is the filename that is about to be used.
- * If a 'saveas' callback returns a non-empty string,
- * that file name will be used as the filename instead.
- * Note that $save_dir will not be affected by this, only
- * the basename of the file.
- * 'start' download is starting, parameter is number of bytes
- * that are expected, or -1 if unknown
- * 'bytesread' parameter is the number of bytes read so far
- * 'done' download is complete, parameter is the total number
- * of bytes read
- * 'connfailed' if the TCP connection fails, this callback is called
- * with array(host,port,errno,errmsg)
- * 'writefailed' if writing to disk fails, this callback is called
- * with array(destfile,errmsg)
- *
- * If an HTTP proxy has been configured (http_proxy PEAR_Config
- * setting), the proxy will be used.
- *
- * @param string $url the URL to download
- * @param object $ui PEAR_Frontend_* instance
- * @param object $config PEAR_Config instance
- * @param string $save_dir (optional) directory to save file in
- * @param mixed $callback (optional) function/method to call for status
- * updates
- *
- * @return string Returns the full path of the downloaded file or a PEAR
- * error on failure. If the error is caused by
- * socket-related errors, the error object will
- * have the fsockopen error code available through
- * getCode().
- *
- * @access public
- */
- function downloadHttp($url, &$ui, $save_dir = '.', $callback = null)
- {
- if ($callback) {
- call_user_func($callback, 'setup', array(&$ui));
- }
- if (preg_match('!^http://([^/:?#]*)(:(\d+))?(/.*)!', $url, $matches)) {
- list(,$host,,$port,$path) = $matches;
- }
- if (isset($this)) {
- $config = &$this->config;
- } else {
- $config = &PEAR_Config::singleton();
- }
- $proxy_host = $proxy_port = $proxy_user = $proxy_pass = '';
- if ($proxy = parse_url($config->get('http_proxy'))) {
- $proxy_host = @$proxy['host'];
- $proxy_port = @$proxy['port'];
- $proxy_user = @$proxy['user'];
- $proxy_pass = @$proxy['pass'];
-
- if ($proxy_port == '') {
- $proxy_port = 8080;
- }
- if ($callback) {
- call_user_func($callback, 'message', "Using HTTP proxy $host:$port");
- }
- }
- if (empty($port)) {
- $port = 80;
- }
- if ($proxy_host != '') {
- $fp = @fsockopen($proxy_host, $proxy_port, $errno, $errstr);
- if (!$fp) {
- if ($callback) {
- call_user_func($callback, 'connfailed', array($proxy_host, $proxy_port,
- $errno, $errstr));
- }
- return PEAR::raiseError("Connection to `$proxy_host:$proxy_port' failed: $errstr", $errno);
- }
- $request = "GET $url HTTP/1.0\r\n";
- } else {
- $fp = @fsockopen($host, $port, $errno, $errstr);
- if (!$fp) {
- if ($callback) {
- call_user_func($callback, 'connfailed', array($host, $port,
- $errno, $errstr));
- }
- return PEAR::raiseError("Connection to `$host:$port' failed: $errstr", $errno);
- }
- $request = "GET $path HTTP/1.0\r\n";
- }
- $request .= "Host: $host:$port\r\n".
- "User-Agent: PHP/".PHP_VERSION."\r\n";
- if ($proxy_host != '' && $proxy_user != '') {
- $request .= 'Proxy-Authorization: Basic ' .
- base64_encode($proxy_user . ':' . $proxy_pass) . "\r\n";
- }
- $request .= "\r\n";
- fwrite($fp, $request);
- $headers = array();
- while (trim($line = fgets($fp, 1024))) {
- if (preg_match('/^([^:]+):\s+(.*)\s*$/', $line, $matches)) {
- $headers[strtolower($matches[1])] = trim($matches[2]);
- } elseif (preg_match('|^HTTP/1.[01] ([0-9]{3}) |', $line, $matches)) {
- if ($matches[1] != 200) {
- return PEAR::raiseError("File http://$host:$port$path not valid (received: $line)");
- }
- }
- }
- if (isset($headers['content-disposition']) &&
- preg_match('/\sfilename=\"([^;]*\S)\"\s*(;|$)/', $headers['content-disposition'], $matches)) {
- $save_as = basename($matches[1]);
- } else {
- $save_as = basename($url);
- }
- if ($callback) {
- $tmp = call_user_func($callback, 'saveas', $save_as);
- if ($tmp) {
- $save_as = $tmp;
- }
- }
- $dest_file = $save_dir . DIRECTORY_SEPARATOR . $save_as;
- if (!$wp = @fopen($dest_file, 'wb')) {
- fclose($fp);
- if ($callback) {
- call_user_func($callback, 'writefailed', array($dest_file, $php_errormsg));
- }
- return PEAR::raiseError("could not open $dest_file for writing");
- }
- if (isset($headers['content-length'])) {
- $length = $headers['content-length'];
- } else {
- $length = -1;
- }
- $bytes = 0;
- if ($callback) {
- call_user_func($callback, 'start', $length);
- }
- while ($data = @fread($fp, 1024)) {
- $bytes += strlen($data);
- if ($callback) {
- call_user_func($callback, 'bytesread', $bytes);
- }
- if (!@fwrite($wp, $data)) {
- fclose($fp);
- if ($callback) {
- call_user_func($callback, 'writefailed', array($dest_file, $php_errormsg));
- }
- return PEAR::raiseError("$dest_file: write failed ($php_errormsg)");
- }
- }
- fclose($fp);
- fclose($wp);
- if ($callback) {
- call_user_func($callback, 'done', $bytes);
- }
- return $dest_file;
- }
-
- // }}}
-}
-
-?>
diff --git a/pear/PEAR/Config.php b/pear/PEAR/Config.php
deleted file mode 100644
index 5059284b97..0000000000
--- a/pear/PEAR/Config.php
+++ /dev/null
@@ -1,1139 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Stig Bakken <ssb@php.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR.php';
-require_once 'System.php';
-
-/**
- * Last created PEAR_Config instance.
- * @var object
- */
-$GLOBALS['_PEAR_Config_instance'] = null;
-
-// Below we define constants with default values for all configuration
-// parameters except username/password. All of them can have their
-// defaults set through environment variables. The reason we use the
-// PHP_ prefix is for some security, PHP protects environment
-// variables starting with PHP_*.
-
-if (getenv('PHP_PEAR_SYSCONF_DIR')) {
- define('PEAR_CONFIG_SYSCONFDIR', getenv('PHP_PEAR_SYSCONF_DIR'));
-} elseif (getenv('SystemRoot')) {
- define('PEAR_CONFIG_SYSCONFDIR', getenv('SystemRoot'));
-} else {
- define('PEAR_CONFIG_SYSCONFDIR', PHP_SYSCONFDIR);
-}
-
-// Default for master_server
-if (getenv('PHP_PEAR_MASTER_SERVER')) {
- define('PEAR_CONFIG_DEFAULT_MASTER_SERVER', getenv('PHP_PEAR_MASTER_SERVER'));
-} else {
- define('PEAR_CONFIG_DEFAULT_MASTER_SERVER', 'pear.php.net');
-}
-
-// Default for http_proxy
-if (getenv('PHP_PEAR_HTTP_PROXY')) {
- define('PEAR_CONFIG_DEFAULT_HTTP_PROXY', getenv('PHP_PEAR_HTTP_PROXY'));
-} elseif (getenv('http_proxy')) {
- define('PEAR_CONFIG_DEFAULT_HTTP_PROXY', getenv('http_proxy'));
-} else {
- define('PEAR_CONFIG_DEFAULT_HTTP_PROXY', '');
-}
-
-// Default for php_dir
-if (getenv('PHP_PEAR_INSTALL_DIR')) {
- define('PEAR_CONFIG_DEFAULT_PHP_DIR', getenv('PHP_PEAR_INSTALL_DIR'));
-} else {
- if (@is_dir(PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib')) {
- define('PEAR_CONFIG_DEFAULT_PHP_DIR',
- PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib');
- } else {
- define('PEAR_CONFIG_DEFAULT_PHP_DIR', PEAR_INSTALL_DIR);
- }
-}
-
-// Default for ext_dir
-if (getenv('PHP_PEAR_EXTENSION_DIR')) {
- define('PEAR_CONFIG_DEFAULT_EXT_DIR', getenv('PHP_PEAR_EXTENSION_DIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_EXT_DIR', ini_get('extension_dir'));
-}
-
-// Default for doc_dir
-if (getenv('PHP_PEAR_DOC_DIR')) {
- define('PEAR_CONFIG_DEFAULT_DOC_DIR', getenv('PHP_PEAR_DOC_DIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_DOC_DIR',
- PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'docs');
-}
-
-// Default for bin_dir
-if (getenv('PHP_PEAR_BIN_DIR')) {
- define('PEAR_CONFIG_DEFAULT_BIN_DIR', getenv('PHP_PEAR_BIN_DIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_BIN_DIR', PHP_BINDIR);
-}
-
-// Default for data_dir
-if (getenv('PHP_PEAR_DATA_DIR')) {
- define('PEAR_CONFIG_DEFAULT_DATA_DIR', getenv('PHP_PEAR_DATA_DIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_DATA_DIR',
- PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'data');
-}
-
-// Default for test_dir
-if (getenv('PHP_PEAR_TEST_DIR')) {
- define('PEAR_CONFIG_DEFAULT_TEST_DIR', getenv('PHP_PEAR_TEST_DIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_TEST_DIR',
- PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'tests');
-}
-
-// Default for cache_dir
-if (getenv('PHP_PEAR_CACHE_DIR')) {
- define('PEAR_CONFIG_DEFAULT_CACHE_DIR', getenv('PHP_PEAR_CACHE_DIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_CACHE_DIR',
- System::tmpdir() . DIRECTORY_SEPARATOR . 'pear' .
- DIRECTORY_SEPARATOR . 'cache');
-}
-
-// Default for php_bin
-if (getenv('PHP_PEAR_PHP_BIN')) {
- define('PEAR_CONFIG_DEFAULT_PHP_BIN', getenv('PHP_PEAR_PHP_BIN'));
-} else {
- define('PEAR_CONFIG_DEFAULT_PHP_BIN', PEAR_CONFIG_DEFAULT_BIN_DIR.
- DIRECTORY_SEPARATOR.'php'.(OS_WINDOWS ? '.exe' : ''));
-}
-
-// Default for verbose
-if (getenv('PHP_PEAR_VERBOSE')) {
- define('PEAR_CONFIG_DEFAULT_VERBOSE', getenv('PHP_PEAR_VERBOSE'));
-} else {
- define('PEAR_CONFIG_DEFAULT_VERBOSE', 1);
-}
-
-// Default for preferred_state
-if (getenv('PHP_PEAR_PREFERRED_STATE')) {
- define('PEAR_CONFIG_DEFAULT_PREFERRED_STATE', getenv('PHP_PEAR_PREFERRED_STATE'));
-} else {
- define('PEAR_CONFIG_DEFAULT_PREFERRED_STATE', 'stable');
-}
-
-// Default for umask
-if (getenv('PHP_PEAR_UMASK')) {
- define('PEAR_CONFIG_DEFAULT_UMASK', getenv('PHP_PEAR_UMASK'));
-} else {
- define('PEAR_CONFIG_DEFAULT_UMASK', decoct(umask()));
-}
-
-// Default for cache_ttl
-if (getenv('PHP_PEAR_CACHE_TTL')) {
- define('PEAR_CONFIG_DEFAULT_CACHE_TTL', getenv('PHP_PEAR_CACHE_TTL'));
-} else {
- define('PEAR_CONFIG_DEFAULT_CACHE_TTL', 3600);
-}
-
-// Default for sig_type
-if (getenv('PHP_PEAR_SIG_TYPE')) {
- define('PEAR_CONFIG_DEFAULT_SIG_TYPE', getenv('PHP_PEAR_SIG_TYPE'));
-} else {
- define('PEAR_CONFIG_DEFAULT_SIG_TYPE', 'gpg');
-}
-
-// Default for sig_bin
-if (getenv('PHP_PEAR_SIG_BIN')) {
- define('PEAR_CONFIG_DEFAULT_SIG_BIN', getenv('PHP_PEAR_SIG_BIN'));
-} else {
- define('PEAR_CONFIG_DEFAULT_SIG_BIN',
- System::which(
- 'gpg', OS_WINDOWS ? 'c:\gnupg\gpg.exe' : '/usr/local/bin/gpg'));
-}
-
-// Default for sig_keydir
-if (getenv('PHP_PEAR_SIG_KEYDIR')) {
- define('PEAR_CONFIG_DEFAULT_SIG_KEYDIR', getenv('PHP_PEAR_SIG_KEYDIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_SIG_KEYDIR',
- PEAR_CONFIG_SYSCONFDIR . DIRECTORY_SEPARATOR . 'pearkeys');
-}
-
-/**
- * This is a class for storing configuration data, keeping track of
- * which are system-defined, user-defined or defaulted.
- */
-class PEAR_Config extends PEAR
-{
- // {{{ properties
-
- /**
- * Array of config files used.
- *
- * @var array layer => config file
- */
- var $files = array(
- 'system' => '',
- 'user' => '',
- );
-
- var $layers = array();
-
- /**
- * Configuration data, two-dimensional array where the first
- * dimension is the config layer ('user', 'system' and 'default'),
- * and the second dimension is keyname => value.
- *
- * The order in the first dimension is important! Earlier
- * layers will shadow later ones when a config value is
- * requested (if a 'user' value exists, it will be returned first,
- * then 'system' and finally 'default').
- *
- * @var array layer => array(keyname => value, ...)
- */
- var $configuration = array(
- 'user' => array(),
- 'system' => array(),
- 'default' => array(),
- );
-
- /**
- * Information about the configuration data. Stores the type,
- * default value and a documentation string for each configuration
- * value.
- *
- * @var array layer => array(infotype => value, ...)
- */
- var $configuration_info = array(
- // Internet Access
- 'master_server' => array(
- 'type' => 'string',
- 'default' => 'pear.php.net',
- 'doc' => 'name of the main PEAR server',
- 'prompt' => 'PEAR server',
- 'group' => 'Internet Access',
- ),
- 'http_proxy' => array(
- 'type' => 'string',
- 'default' => PEAR_CONFIG_DEFAULT_HTTP_PROXY,
- 'doc' => 'HTTP proxy (host:port) to use when downloading packages',
- 'prompt' => 'HTTP Proxy Server Address',
- 'group' => 'Internet Access',
- ),
- // File Locations
- 'php_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_PHP_DIR,
- 'doc' => 'directory where .php files are installed',
- 'prompt' => 'PEAR directory',
- 'group' => 'File Locations',
- ),
- 'ext_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_EXT_DIR,
- 'doc' => 'directory where loadable extensions are installed',
- 'prompt' => 'PHP extension directory',
- 'group' => 'File Locations',
- ),
- 'doc_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_DOC_DIR,
- 'doc' => 'directory where documentation is installed',
- 'prompt' => 'PEAR documentation directory',
- 'group' => 'File Locations',
- ),
- 'bin_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_BIN_DIR,
- 'doc' => 'directory where executables are installed',
- 'prompt' => 'PEAR executables directory',
- 'group' => 'File Locations',
- ),
- 'data_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_DATA_DIR,
- 'doc' => 'directory where data files are installed',
- 'prompt' => 'PEAR data directory',
- 'group' => 'File Locations (Advanced)',
- ),
- 'test_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_TEST_DIR,
- 'doc' => 'directory where regression tests are installed',
- 'prompt' => 'PEAR test directory',
- 'group' => 'File Locations (Advanced)',
- ),
- 'cache_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_CACHE_DIR,
- 'doc' => 'directory which is used for XMLRPC cache',
- 'prompt' => 'PEAR Installer cache directory',
- 'group' => 'File Locations (Advanced)',
- ),
- 'php_bin' => array(
- 'type' => 'file',
- 'default' => PEAR_CONFIG_DEFAULT_PHP_BIN,
- 'doc' => 'PHP CLI/CGI binary for executing scripts',
- 'prompt' => 'PHP CLI/CGI binary',
- 'group' => 'File Locations (Advanced)',
- ),
- // Maintainers
- 'username' => array(
- 'type' => 'string',
- 'default' => '',
- 'doc' => '(maintainers) your PEAR account name',
- 'prompt' => 'PEAR username (for maintainers)',
- 'group' => 'Maintainers',
- ),
- 'password' => array(
- 'type' => 'password',
- 'default' => '',
- 'doc' => '(maintainers) your PEAR account password',
- 'prompt' => 'PEAR password (for maintainers)',
- 'group' => 'Maintainers',
- ),
- // Advanced
- 'verbose' => array(
- 'type' => 'integer',
- 'default' => PEAR_CONFIG_DEFAULT_VERBOSE,
- 'doc' => 'verbosity level
-0: really quiet
-1: somewhat quiet
-2: verbose
-3: debug',
- 'prompt' => 'Debug Log Level',
- 'group' => 'Advanced',
- ),
- 'preferred_state' => array(
- 'type' => 'set',
- 'default' => PEAR_CONFIG_DEFAULT_PREFERRED_STATE,
- 'doc' => 'the installer will prefer releases with this state when installing packages without a version or state specified',
- 'valid_set' => array(
- 'stable', 'beta', 'alpha', 'devel', 'snapshot'),
- 'prompt' => 'Preferred Package State',
- 'group' => 'Advanced',
- ),
- 'umask' => array(
- 'type' => 'mask',
- 'default' => PEAR_CONFIG_DEFAULT_UMASK,
- 'doc' => 'umask used when creating files (Unix-like systems only)',
- 'prompt' => 'Unix file mask',
- 'group' => 'Advanced',
- ),
- 'cache_ttl' => array(
- 'type' => 'integer',
- 'default' => PEAR_CONFIG_DEFAULT_CACHE_TTL,
- 'doc' => 'amount of secs where the local cache is used and not updated',
- 'prompt' => 'Cache TimeToLive',
- 'group' => 'Advanced',
- ),
- 'sig_type' => array(
- 'type' => 'set',
- 'default' => PEAR_CONFIG_DEFAULT_SIG_TYPE,
- 'doc' => 'which package signature mechanism to use',
- 'valid_set' => array('gpg'),
- 'prompt' => 'Package Signature Type',
- 'group' => 'Maintainers',
- ),
- 'sig_bin' => array(
- 'type' => 'string',
- 'default' => PEAR_CONFIG_DEFAULT_SIG_BIN,
- 'doc' => 'which package signature mechanism to use',
- 'prompt' => 'Signature Handling Program',
- 'group' => 'Maintainers',
- ),
- 'sig_keyid' => array(
- 'type' => 'string',
- 'default' => '',
- 'doc' => 'which key to use for signing with',
- 'prompt' => 'Signature Key Id',
- 'group' => 'Maintainers',
- ),
- 'sig_keydir' => array(
- 'type' => 'string',
- 'default' => PEAR_CONFIG_DEFAULT_SIG_KEYDIR,
- 'doc' => 'which package signature mechanism to use',
- 'prompt' => 'Signature Key Directory',
- 'group' => 'Maintainers',
- ),
- );
-
- // }}}
-
- // {{{ PEAR_Config([file], [defaults_file])
-
- /**
- * Constructor.
- *
- * @param string (optional) file to read user-defined options from
- * @param string (optional) file to read system-wide defaults from
- *
- * @access public
- *
- * @see PEAR_Config::singleton
- */
- function PEAR_Config($user_file = '', $system_file = '')
- {
- $this->PEAR();
- $sl = DIRECTORY_SEPARATOR;
- if (empty($user_file)) {
- if (OS_WINDOWS) {
- $user_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini';
- } else {
- $user_file = getenv('HOME') . $sl . '.pearrc';
- }
- }
- if (empty($system_file)) {
- if (OS_WINDOWS) {
- $system_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pearsys.ini';
- } else {
- $system_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.conf';
- }
- }
- $this->layers = array_keys($this->configuration);
- $this->files['user'] = $user_file;
- $this->files['system'] = $system_file;
- if ($user_file && file_exists($user_file)) {
- $this->readConfigFile($user_file);
- }
- if ($system_file && file_exists($system_file)) {
- $this->mergeConfigFile($system_file, false, 'system');
- }
- foreach ($this->configuration_info as $key => $info) {
- $this->configuration['default'][$key] = $info['default'];
- }
- //$GLOBALS['_PEAR_Config_instance'] = &$this;
- }
-
- // }}}
- // {{{ singleton([file], [defaults_file])
-
- /**
- * Static singleton method. If you want to keep only one instance
- * of this class in use, this method will give you a reference to
- * the last created PEAR_Config object if one exists, or create a
- * new object.
- *
- * @param string (optional) file to read user-defined options from
- * @param string (optional) file to read system-wide defaults from
- *
- * @return object an existing or new PEAR_Config instance
- *
- * @access public
- *
- * @see PEAR_Config::PEAR_Config
- */
- function &singleton($user_file = '', $system_file = '')
- {
- if (is_object($GLOBALS['_PEAR_Config_instance'])) {
- return $GLOBALS['_PEAR_Config_instance'];
- }
- $GLOBALS['_PEAR_Config_instance'] =
- &new PEAR_Config($user_file, $system_file);
- return $GLOBALS['_PEAR_Config_instance'];
- }
-
- // }}}
- // {{{ readConfigFile([file], [layer])
-
- /**
- * Reads configuration data from a file. All existing values in
- * the config layer are discarded and replaced with data from the
- * file.
- *
- * @param string (optional) file to read from, if NULL or not
- * specified, the last-used file for the same layer (second param)
- * is used
- *
- * @param string (optional) config layer to insert data into
- * ('user' or 'system')
- *
- * @return bool TRUE on success or a PEAR error on failure
- *
- * @access public
- */
- function readConfigFile($file = null, $layer = 'user')
- {
- if (empty($this->files[$layer])) {
- return $this->raiseError("unknown config file type `$layer'");
- }
- if ($file === null) {
- $file = $this->files[$layer];
- }
- $data = $this->_readConfigDataFrom($file);
- if (PEAR::isError($data)) {
- return $data;
- }
- $this->_decodeInput($data);
- $this->configuration[$layer] = $data;
- return true;
- }
-
- // }}}
- // {{{ mergeConfigFile(file, [override], [layer])
-
- /**
- * Merges data into a config layer from a file. Does the same
- * thing as readConfigFile, except it does not replace all
- * existing values in the config layer.
- *
- * @param string file to read from
- *
- * @param bool (optional) whether to overwrite existing data
- * (default TRUE)
- *
- * @param string config layer to insert data into ('user' or
- * 'system')
- *
- * @return bool TRUE on success or a PEAR error on failure
- *
- * @access public.
- */
- function mergeConfigFile($file, $override = true, $layer = 'user')
- {
- if (empty($this->files[$layer])) {
- return $this->raiseError("unknown config file type `$layer'");
- }
- if ($file === null) {
- $file = $this->files[$layer];
- }
- $data = $this->_readConfigDataFrom($file);
- if (PEAR::isError($data)) {
- return $data;
- }
- $this->_decodeInput($data);
- if ($override) {
- $this->configuration[$layer] = array_merge($this->configuration[$layer], $data);
- } else {
- $this->configuration[$layer] = array_merge($data, $this->configuration[$layer]);
- }
- return true;
- }
-
- // }}}
- // {{{ writeConfigFile([file], [layer])
-
- /**
- * Writes data into a config layer from a file.
- *
- * @param string file to read from
- *
- * @param bool (optional) whether to overwrite existing data
- * (default TRUE)
- *
- * @param string config layer to insert data into ('user' or
- * 'system')
- *
- * @return bool TRUE on success or a PEAR error on failure
- *
- * @access public.
- */
- function writeConfigFile($file = null, $layer = 'user')
- {
- if ($layer == 'both' || $layer == 'all') {
- foreach ($this->files as $type => $file) {
- $err = $this->writeConfigFile($file, $type);
- if (PEAR::isError($err)) {
- return $err;
- }
- }
- return true;
- }
- if (empty($this->files[$layer])) {
- return $this->raiseError("unknown config file type `$layer'");
- }
- if ($file === null) {
- $file = $this->files[$layer];
- }
- $data = $this->configuration[$layer];
- $this->_encodeOutput($data);
- if (!@System::mkDir("-p " . dirname($file))) {
- return $this->raiseError("could not create directory: " . dirname($file));
- }
- if (@is_file($file) && !@is_writeable($file)) {
- return $this->raiseError("no write access to $file!");
- }
- $fp = @fopen($file, "w");
- if (!$fp) {
- return $this->raiseError("PEAR_Config::writeConfigFile fopen('$file','w') failed");
- }
- $contents = "#PEAR_Config 0.9\n" . serialize($data);
- if (!@fwrite($fp, $contents)) {
- return $this->raiseError("PEAR_Config::writeConfigFile: fwrite failed");
- }
- return true;
- }
-
- // }}}
- // {{{ _readConfigDataFrom(file)
-
- /**
- * Reads configuration data from a file and returns the parsed data
- * in an array.
- *
- * @param string file to read from
- *
- * @return array configuration data or a PEAR error on failure
- *
- * @access private
- */
- function _readConfigDataFrom($file)
- {
- $fp = @fopen($file, "r");
- if (!$fp) {
- return $this->raiseError("PEAR_Config::readConfigFile fopen('$file','r') failed");
- }
- $size = filesize($file);
- $contents = fread($fp, $size);
- fclose($fp);
- $version = '0.1';
- if (preg_match('/^#PEAR_Config\s+(\S+)\s+/si', $contents, $matches)) {
- $version = $matches[1];
- $contents = substr($contents, strlen($matches[0]));
- }
- if (version_compare("$version", '1', '<')) {
- $data = unserialize($contents);
- if (!is_array($data)) {
- if (strlen(trim($contents)) > 0) {
- $error = "PEAR_Config: bad data in $file";
-// if (isset($this)) {
- return $this->raiseError($error);
-// } else {
-// return PEAR::raiseError($error);
- } else {
- $data = array();
- }
- }
- // add parsing of newer formats here...
- } else {
- return $this->raiseError("$file: unknown version `$version'");
- }
- return $data;
- }
-
- // }}}
- // {{{ _encodeOutput(&data)
-
- /**
- * Encodes/scrambles configuration data before writing to files.
- * Currently, 'password' values will be base64-encoded as to avoid
- * that people spot cleartext passwords by accident.
- *
- * @param array (reference) array to encode values in
- *
- * @return bool TRUE on success
- *
- * @access private
- */
- function _encodeOutput(&$data)
- {
- foreach ($data as $key => $value) {
- if (!isset($this->configuration_info[$key])) {
- continue;
- }
- $type = $this->configuration_info[$key]['type'];
- switch ($type) {
- // we base64-encode passwords so they are at least
- // not shown in plain by accident
- case 'password': {
- $data[$key] = base64_encode($data[$key]);
- break;
- }
- case 'mask': {
- $data[$key] = octdec($data[$key]);
- break;
- }
- }
- }
- return true;
- }
-
- // }}}
- // {{{ _decodeInput(&data)
-
- /**
- * Decodes/unscrambles configuration data after reading from files.
- *
- * @param array (reference) array to encode values in
- *
- * @return bool TRUE on success
- *
- * @access private
- *
- * @see PEAR_Config::_encodeOutput
- */
- function _decodeInput(&$data)
- {
- if (!is_array($data)) {
- return true;
- }
- foreach ($data as $key => $value) {
- if (!isset($this->configuration_info[$key])) {
- continue;
- }
- $type = $this->configuration_info[$key]['type'];
- switch ($type) {
- case 'password': {
- $data[$key] = base64_decode($data[$key]);
- break;
- }
- case 'mask': {
- $data[$key] = decoct($data[$key]);
- break;
- }
- }
- }
- return true;
- }
-
- // }}}
- // {{{ get(key, [layer])
-
- /**
- * Returns a configuration value, prioritizing layers as per the
- * layers property.
- *
- * @param string config key
- *
- * @return mixed the config value, or NULL if not found
- *
- * @access public
- */
- function get($key, $layer = null)
- {
- if ($layer === null) {
- foreach ($this->layers as $layer) {
- if (isset($this->configuration[$layer][$key])) {
- return $this->configuration[$layer][$key];
- }
- }
- } elseif (isset($this->configuration[$layer][$key])) {
- return $this->configuration[$layer][$key];
- }
- return null;
- }
-
- // }}}
- // {{{ set(key, value, [layer])
-
- /**
- * Set a config value in a specific layer (defaults to 'user').
- * Enforces the types defined in the configuration_info array. An
- * integer config variable will be cast to int, and a set config
- * variable will be validated against its legal values.
- *
- * @param string config key
- *
- * @param string config value
- *
- * @param string (optional) config layer
- *
- * @return bool TRUE on success, FALSE on failure
- *
- * @access public
- */
- function set($key, $value, $layer = 'user')
- {
- if (empty($this->configuration_info[$key])) {
- return false;
- }
- extract($this->configuration_info[$key]);
- switch ($type) {
- case 'integer':
- $value = (int)$value;
- break;
- case 'set': {
- // If a valid_set is specified, require the value to
- // be in the set. If there is no valid_set, accept
- // any value.
- if ($valid_set) {
- reset($valid_set);
- if ((key($valid_set) === 0 && !in_array($value, $valid_set)) ||
- (key($valid_set) !== 0 && empty($valid_set[$value])))
- {
- return false;
- }
- }
- break;
- }
- }
- $this->configuration[$layer][$key] = $value;
- return true;
- }
-
- // }}}
- // {{{ getType(key)
-
- /**
- * Get the type of a config value.
- *
- * @param string config key
- *
- * @return string type, one of "string", "integer", "file",
- * "directory", "set" or "password".
- *
- * @access public
- *
- */
- function getType($key)
- {
- if (isset($this->configuration_info[$key])) {
- return $this->configuration_info[$key]['type'];
- }
- return false;
- }
-
- // }}}
- // {{{ getDocs(key)
-
- /**
- * Get the documentation for a config value.
- *
- * @param string config key
- *
- * @return string documentation string
- *
- * @access public
- *
- */
- function getDocs($key)
- {
- if (isset($this->configuration_info[$key])) {
- return $this->configuration_info[$key]['doc'];
- }
- return false;
- }
- // }}}
- // {{{ getPrompt(key)
-
- /**
- * Get the short documentation for a config value.
- *
- * @param string config key
- *
- * @return string short documentation string
- *
- * @access public
- *
- */
- function getPrompt($key)
- {
- if (isset($this->configuration_info[$key])) {
- return $this->configuration_info[$key]['prompt'];
- }
- return false;
- }
- // }}}
- // {{{ getGroup(key)
-
- /**
- * Get the parameter group for a config key.
- *
- * @param string config key
- *
- * @return string parameter group
- *
- * @access public
- *
- */
- function getGroup($key)
- {
- if (isset($this->configuration_info[$key])) {
- return $this->configuration_info[$key]['group'];
- }
- return false;
- }
-
- // }}}
- // {{{ getGroups()
-
- /**
- * Get the list of parameter groups.
- *
- * @return array list of parameter groups
- *
- * @access public
- *
- */
- function getGroups()
- {
- $tmp = array();
- foreach ($this->configuration_info as $key => $info) {
- $tmp[$info['group']] = 1;
- }
- return array_keys($tmp);
- }
-
- // }}}
- // {{{ getGroupKeys()
-
- /**
- * Get the list of the parameters in a group.
- *
- * @param string $group parameter group
- *
- * @return array list of parameters in $group
- *
- * @access public
- *
- */
- function getGroupKeys($group)
- {
- $keys = array();
- foreach ($this->configuration_info as $key => $info) {
- if ($info['group'] == $group) {
- $keys[] = $key;
- }
- }
- return $keys;
- }
-
- // }}}
- // {{{ getSetValues(key)
-
- /**
- * Get the list of allowed set values for a config value. Returns
- * NULL for config values that are not sets.
- *
- * @param string config key
- *
- * @return array enumerated array of set values, or NULL if the
- * config key is unknown or not a set
- *
- * @access public
- *
- */
- function getSetValues($key)
- {
- if (isset($this->configuration_info[$key]) &&
- isset($this->configuration_info[$key]['type']) &&
- $this->configuration_info[$key]['type'] == 'set')
- {
- $valid_set = $this->configuration_info[$key]['valid_set'];
- reset($valid_set);
- if (key($valid_set) === 0) {
- return $valid_set;
- }
- return array_keys($valid_set);
- }
- return false;
- }
-
- // }}}
- // {{{ getKeys()
-
- /**
- * Get all the current config keys.
- *
- * @return array simple array of config keys
- *
- * @access public
- */
- function getKeys()
- {
- $keys = array();
- foreach ($this->layers as $layer) {
- $keys = array_merge($keys, $this->configuration[$layer]);
- }
- return array_keys($keys);
- }
-
- // }}}
- // {{{ remove(key, [layer])
-
- /**
- * Remove the a config key from a specific config layer.
- *
- * @param string config key
- *
- * @param string (optional) config layer
- *
- * @return bool TRUE on success, FALSE on failure
- *
- * @access public
- */
- function remove($key, $layer = 'user')
- {
- if (isset($this->configuration[$layer][$key])) {
- unset($this->configuration[$layer][$key]);
- return true;
- }
- return false;
- }
-
- // }}}
- // {{{ removeLayer(layer)
-
- /**
- * Temporarily remove an entire config layer. USE WITH CARE!
- *
- * @param string config key
- *
- * @param string (optional) config layer
- *
- * @return bool TRUE on success, FALSE on failure
- *
- * @access public
- */
- function removeLayer($layer)
- {
- if (isset($this->configuration[$layer])) {
- unset($this->configuration[$layer]);
- return true;
- }
- return false;
- }
-
- // }}}
- // {{{ store([layer])
-
- /**
- * Stores configuration data in a layer.
- *
- * @param string config layer to store
- *
- * @return bool TRUE on success, or PEAR error on failure
- *
- * @access public
- */
- function store($layer = 'user')
- {
- return $this->writeConfigFile(null, $layer);
- }
-
- // }}}
- // {{{ toDefault(key)
-
- /**
- * Unset the user-defined value of a config key, reverting the
- * value to the system-defined one.
- *
- * @param string config key
- *
- * @return bool TRUE on success, FALSE on failure
- *
- * @access public
- */
- function toDefault($key)
- {
- trigger_error("PEAR_Config::toDefault() deprecated, use PEAR_Config::remove() instead", E_USER_NOTICE);
- return $this->remove($key, 'user');
- }
-
- // }}}
- // {{{ definedBy(key)
-
- /**
- * Tells what config layer that gets to define a key.
- *
- * @param string config key
- *
- * @return string the config layer, or an empty string if not found
- *
- * @access public
- */
- function definedBy($key)
- {
- foreach ($this->layers as $layer) {
- if (isset($this->configuration[$layer][$key])) {
- return $layer;
- }
- }
- return '';
- }
-
- // }}}
- // {{{ isDefaulted(key)
-
- /**
- * Tells whether a config value has a system-defined value.
- *
- * @param string config key
- *
- * @return bool
- *
- * @access public
- *
- * @deprecated
- */
- function isDefaulted($key)
- {
- trigger_error("PEAR_Config::isDefaulted() deprecated, use PEAR_Config::definedBy() instead", E_USER_NOTICE);
- return $this->definedBy($key) == 'system';
- }
-
- // }}}
- // {{{ isDefined(key)
-
- /**
- * Tells whether a given key exists as a config value.
- *
- * @param string config key
- *
- * @return bool whether <config key> exists in this object
- *
- * @access public
- */
- function isDefined($key)
- {
- foreach ($this->layers as $layer) {
- if (isset($this->configuration[$layer][$key])) {
- return true;
- }
- }
- return false;
- }
-
- // }}}
- // {{{ isDefinedLayer(key)
-
- /**
- * Tells whether a given config layer exists.
- *
- * @param string config layer
- *
- * @return bool whether <config layer> exists in this object
- *
- * @access public
- */
- function isDefinedLayer($layer)
- {
- return isset($this->configuration[$layer]);
- }
-
- // }}}
- // {{{ getLayers()
-
- /**
- * Returns the layers defined (except the 'default' one)
- *
- * @return array of the defined layers
- */
- function getLayers()
- {
- $cf = $this->configuration;
- unset($cf['default']);
- return array_keys($cf);
- }
-
- // }}}
-}
-
-?>
diff --git a/pear/PEAR/Dependency.php b/pear/PEAR/Dependency.php
deleted file mode 100644
index 22173ce625..0000000000
--- a/pear/PEAR/Dependency.php
+++ /dev/null
@@ -1,329 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Tomas V.V.Cox <cox@idecnet.com> |
-// | Stig Bakken <ssb@php.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-/**
-* Methods for dependencies check. Based on Stig's dependencies RFC
-* at http://cvs.php.net/cvs.php/pearweb/rfc
-* (requires php >= 4.1)
-*/
-
-require_once "PEAR.php";
-
-define('PEAR_DEPENDENCY_MISSING', -1);
-define('PEAR_DEPENDENCY_CONFLICT', -2);
-define('PEAR_DEPENDENCY_UPGRADE_MINOR', -3);
-define('PEAR_DEPENDENCY_UPGRADE_MAJOR', -4);
-define('PEAR_DEPENDENCY_BAD_DEPENDENCY', -5);
-
-class PEAR_Dependency
-{
- function PEAR_Dependency(&$registry)
- {
- $this->registry = &$registry;
- }
- /**
- * This method maps the xml dependency definition to the
- * PEAR_dependecy one
- *
- * $opts => Array
- * (
- * [type] => pkg
- * [rel] => ge
- * [version] => 3.4
- * [name] => HTML_Common
- * )
- */
- function callCheckMethod(&$errmsg, $opts)
- {
- $rel = isset($opts['rel']) ? $opts['rel'] : 'has';
- $req = isset($opts['version']) ? $opts['version'] : null;
- $name = isset($opts['name']) ? $opts['name'] : null;
- $errmsg = '';
- switch ($opts['type']) {
- case 'pkg':
- return $this->checkPackage($errmsg, $name, $req, $rel);
- break;
- case 'ext':
- return $this->checkExtension($errmsg, $name, $req, $rel);
- break;
- case 'php':
- return $this->checkPHP($errmsg, $req, $rel);
- break;
- case 'prog':
- return $this->checkProgram($errmsg, $name);
- break;
- case 'os':
- return $this->checkOS($errmsg, $name);
- break;
- case 'sapi':
- return $this->checkSAPI($errmsg, $name);
- break;
- case 'zend':
- return $this->checkZend($errmsg, $name);
- break;
- default:
- return "'{$opts['type']}' dependency type not supported";
- }
- }
-
- /**
- * Package dependencies check method
- *
- * @param string $name Name of the package to test
- * @param string $version The package version required
- * @param string $relation How to compare versions with eachother
- *
- * @return mixed bool false if no error or the error string
- */
- function checkPackage(&$errmsg, $name, $req = null, $relation = 'has')
- {
- if (substr($relation, 0, 2) == 'v.') {
- $relation = substr($relation, 2);
- }
- switch ($relation) {
- case 'has':
- if (!$this->registry->packageExists($name)) {
- $errmsg = "requires package `$name'";
- return PEAR_DEPENDENCY_MISSING;
- }
- return false;
- case 'not':
- if (!$this->registry->packageExists($name)) {
- $errmsg = "conflicts with package `$name'";
- return PEAR_DEPENDENCY_CONFLICT;
- }
- return false;
- case 'lt':
- case 'le':
- case 'eq':
- case 'ne':
- case 'ge':
- case 'gt':
- $version = $this->registry->packageInfo($name, 'version');
- if (!$this->registry->packageExists($name)
- || !version_compare("$version", "$req", $relation))
- {
- $errmsg = "requires package `$name' " .
- $this->signOperator($relation) . " $req";
- $code = $this->codeFromRelation($relation, $version, $req);
- }
- return false;
- }
- $errmsg = "relation '$relation' with requirement '$req' is not supported (name=$name)";
- return PEAR_DEPENDENCY_BAD_DEPENDENCY;
- }
-
- /**
- * Extension dependencies check method
- *
- * @param string $name Name of the extension to test
- * @param string $req_ext_ver Required extension version to compare with
- * @param string $relation How to compare versions with eachother
- *
- * @return mixed bool false if no error or the error string
- */
- function checkExtension(&$errmsg, $name, $req = null, $relation = 'has')
- {
- // XXX (ssb): could we avoid loading the extension here?
- if (!PEAR::loadExtension($name)) {
- $errmsg = "'$name' PHP extension is not installed";
- return PEAR_DEPENDENCY_MISSING;
- }
- if ($relation == 'has') {
- return false;
- }
- $code = false;
- if (substr($relation, 0, 2) == 'v.') {
- $ext_ver = phpversion($name);
- $operator = substr($relation, 2);
- // Force params to be strings, otherwise the comparation will fail (ex. 0.9==0.90)
- settype($req, "string");
- if (!version_compare("$ext_ver", "$req", $operator)) {
- $retval = "'$name' PHP extension version " .
- $this->signOperator($operator) . " $req is required";
- $code = $this->codeFromRelation($relation, $ext_ver, $req);
- }
- }
- return $code;
- }
-
- /**
- * Operating system dependencies check method
- *
- * @param string $os Name of the operating system
- *
- * @return mixed bool false if no error or the error string
- */
- function checkOS(&$errmsg, $os)
- {
- // XXX Fixme: Implement a more flexible way, like
- // comma separated values or something similar to PEAR_OS
- static $myos;
- if (empty($myos)) {
- include_once "OS/Guess.php";
- $myos = new OS_Guess();
- }
- // only 'has' relation is currently supported
- if ($myos->matchSignature($os)) {
- return false;
- }
- $errmsg = "'$os' operating system not supported";
- return PEAR_DEPENDENCY_CONFLICT;
- }
-
- /**
- * PHP version check method
- *
- * @param string $req which version to compare
- * @param string $relation how to compare the version
- *
- * @return mixed bool false if no error or the error string
- */
- function checkPHP(&$errmsg, $req, $relation = 'ge')
- {
- if (substr($req, 0, 2) == 'v.') {
- $req = substr($req,2, strlen($req) - 2);
- }
- $php_ver = phpversion();
- $operator = substr($relation,0,2);
- if (!version_compare("$php_ver", "$req", $operator)) {
- $errmsg = "PHP version " . $this->signOperator($operator) .
- " $req is required";
- return PEAR_DEPENDENCY_CONFLICT;
- }
- return false;
- }
-
- /**
- * External program check method. Looks for executable files in
- * directories listed in the PATH environment variable.
- *
- * @param string $program which program to look for
- *
- * @return mixed bool false if no error or the error string
- */
- function checkProgram(&$errmsg, $program)
- {
- // XXX FIXME honor safe mode
- $path_delim = OS_WINDOWS ? ';' : ':';
- $exe_suffix = OS_WINDOWS ? '.exe' : '';
- $path_elements = explode($path_delim, getenv('PATH'));
- foreach ($path_elements as $dir) {
- $file = $dir . DIRECTORY_SEPARATOR . $program . $exe_suffix;
- if (@file_exists($file) && @is_executable($file)) {
- return false;
- }
- }
- $errmsg = "'$program' program is not present in the PATH";
- return PEAR_DEPENDENCY_MISSING;
- }
-
- /**
- * SAPI backend check method. Version comparison is not yet
- * available here.
- *
- * @param string $name name of SAPI backend
- * @param string $req which version to compare
- * @param string $relation how to compare versions (currently
- * hardcoded to 'has')
- * @return mixed bool false if no error or the error string
- */
- function checkSAPI(&$errmsg, $name, $req = null, $relation = 'has')
- {
- // XXX Fixme: There is no way to know if the user has or
- // not other SAPI backends installed than the installer one
-
- $sapi_backend = php_sapi_name();
- // Version comparisons not supported, sapi backends don't have
- // version information yet.
- if ($sapi_backend == $name) {
- return false;
- }
- $errmsg = "'$sapi_backend' SAPI backend not supported";
- return PEAR_DEPENDENCY_CONFLICT;
- }
-
-
- /**
- * Zend version check method
- *
- * @param string $req which version to compare
- * @param string $relation how to compare the version
- *
- * @return mixed bool false if no error or the error string
- */
- function checkZend(&$errmsg, $req, $relation = 'ge')
- {
- if (substr($req, 0, 2) == 'v.') {
- $req = substr($req,2, strlen($req) - 2);
- }
- $zend_ver = zend_version();
- $operator = substr($relation,0,2);
- if (!version_compare("$zend_ver", "$req", $operator)) {
- $errmsg = "Zend version " . $this->signOperator($operator) .
- " $req is required";
- return PEAR_DEPENDENCY_CONFLICT;
- }
- return false;
- }
-
- /**
- * Converts text comparing operators to them sign equivalents
- * ex: 'ge' to '>='
- */
- function signOperator($operator)
- {
- switch($operator) {
- case 'lt': return '<';
- case 'le': return '<=';
- case 'gt': return '>';
- case 'ge': return '>=';
- case 'eq': return '==';
- case 'ne': return '!=';
- default:
- return $operator;
- }
- }
-
-
- function codeFromRelation($relation, $version, $req)
- {
- $code = PEAR_DEPENDENCY_BAD_DEPENDENCY;
- switch ($relation) {
- case 'gt': case 'ge': case 'eq':
- // upgrade
- $have_major = preg_replace('/\D.*/', '', $version);
- $need_major = preg_replace('/\D.*/', '', $req);
- if ($need_major > $have_major) {
- $code = PEAR_DEPENDENCY_UPGRADE_MAJOR;
- } else {
- $code = PEAR_DEPENDENCY_UPGRADE_MINOR;
- }
- break;
- case 'lt': case 'le': case 'ne':
- $code = PEAR_DEPENDENCY_CONFLICT;
- break;
- }
- return $code;
- }
-}
-
-?>
diff --git a/pear/PEAR/Frontend/CLI.php b/pear/PEAR/Frontend/CLI.php
deleted file mode 100644
index ba30702813..0000000000
--- a/pear/PEAR/Frontend/CLI.php
+++ /dev/null
@@ -1,487 +0,0 @@
-<?php
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
-
- $Id$
-*/
-
-require_once "PEAR.php";
-
-class PEAR_Frontend_CLI extends PEAR
-{
- // {{{ properties
-
- /**
- * What type of user interface this frontend is for.
- * @var string
- * @access public
- */
- var $type = 'CLI';
- var $lp = ''; // line prefix
-
- var $params = array();
- var $term = array(
- 'bold' => '',
- 'normal' => '',
- );
-
- // }}}
-
- // {{{ constructor
-
- function PEAR_Frontend_CLI()
- {
- parent::PEAR();
- $term = getenv('TERM'); //(cox) $_ENV is empty for me in 4.1.1
- if ($term) {
- // XXX can use ncurses extension here, if available
- if (preg_match('/^(xterm|vt220|linux)/', $term)) {
- $this->term['bold'] = sprintf("%c%c%c%c", 27, 91, 49, 109);
- $this->term['normal']=sprintf("%c%c%c", 27, 91, 109);
- } elseif (preg_match('/^vt100/', $term)) {
- $this->term['bold'] = sprintf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0);
- $this->term['normal']=sprintf("%c%c%c%c%c", 27, 91, 109, 0, 0);
- }
- } elseif (OS_WINDOWS) {
- // XXX add ANSI codes here
- }
- }
-
- // }}}
-
- // {{{ displayLine(text)
-
- function displayLine($text)
- {
- trigger_error("PEAR_Frontend_CLI::displayLine deprecated", E_USER_ERROR);
- }
-
- function _displayLine($text)
- {
- print "$this->lp$text\n";
- }
-
- // }}}
- // {{{ display(text)
-
- function display($text)
- {
- trigger_error("PEAR_Frontend_CLI::display deprecated", E_USER_ERROR);
- }
-
- function _display($text)
- {
- print $text;
- }
-
- // }}}
- // {{{ displayError(eobj)
-
- function displayError($eobj)
- {
- return $this->_displayLine($eobj->getMessage());
- }
-
- // }}}
- // {{{ displayFatalError(eobj)
-
- function displayFatalError($eobj)
- {
- $this->displayError($eobj);
- exit(1);
- }
-
- // }}}
- // {{{ displayHeading(title)
-
- function displayHeading($title)
- {
- trigger_error("PEAR_Frontend_CLI::displayHeading deprecated", E_USER_ERROR);
- }
-
- function _displayHeading($title)
- {
- print $this->lp.$this->bold($title)."\n";
- print $this->lp.str_repeat("=", strlen($title))."\n";
- }
-
- // }}}
- // {{{ userDialog(prompt, [type], [default])
-
- function userDialog($command, $prompts, $types = array(), $defaults = array())
- {
- $result = array();
- if (is_array($prompts)) {
- $fp = fopen("php://stdin", "r");
- foreach ($prompts as $key => $prompt) {
- $type = $types[$key];
- $default = @$defaults[$key];
- if ($type == 'password') {
- system('stty -echo');
- }
- print "$this->lp$prompt ";
- if ($default) {
- print "[$default] ";
- }
- print ": ";
- $line = fgets($fp, 2048);
- if ($type == 'password') {
- system('stty echo');
- print "\n";
- }
- if ($default && trim($line) == "") {
- $result[$key] = $default;
- } else {
- $result[$key] = $line;
- }
- }
- fclose($fp);
- }
- return $result;
- }
-
- // }}}
- // {{{ userConfirm(prompt, [default])
-
- function userConfirm($prompt, $default = 'yes')
- {
- trigger_error("PEAR_Frontend_CLI::userConfirm not yet converted", E_USER_ERROR);
- static $positives = array('y', 'yes', 'on', '1');
- static $negatives = array('n', 'no', 'off', '0');
- print "$this->lp$prompt [$default] : ";
- $fp = fopen("php://stdin", "r");
- $line = fgets($fp, 2048);
- fclose($fp);
- $answer = strtolower(trim($line));
- if (empty($answer)) {
- $answer = $default;
- }
- if (in_array($answer, $positives)) {
- return true;
- }
- if (in_array($answer, $negatives)) {
- return false;
- }
- if (in_array($default, $positives)) {
- return true;
- }
- return false;
- }
-
- // }}}
- // {{{ startTable([params])
-
- function startTable($params = array())
- {
- trigger_error("PEAR_Frontend_CLI::startTable deprecated", E_USER_ERROR);
- }
-
- function _startTable($params = array())
- {
- $params['table_data'] = array();
- $params['widest'] = array(); // indexed by column
- $params['highest'] = array(); // indexed by row
- $params['ncols'] = 0;
- $this->params = $params;
- }
-
- // }}}
- // {{{ tableRow(columns, [rowparams], [colparams])
-
- function tableRow($columns, $rowparams = array(), $colparams = array())
- {
- trigger_error("PEAR_Frontend_CLI::tableRow deprecated", E_USER_ERROR);
- }
-
- function _tableRow($columns, $rowparams = array(), $colparams = array())
- {
- $highest = 1;
- for ($i = 0; $i < sizeof($columns); $i++) {
- $col = &$columns[$i];
- if (isset($colparams[$i]) && !empty($colparams[$i]['wrap'])) {
- $col = wordwrap($col, $colparams[$i]['wrap'], "\n", 1);
- }
- if (strpos($col, "\n") !== false) {
- $multiline = explode("\n", $col);
- $w = 0;
- foreach ($multiline as $n => $line) {
- if (strlen($line) > $w) {
- $w = strlen($line);
- }
- }
- $lines = sizeof($multiline);
- } else {
- $w = strlen($col);
- }
- if ($w > @$this->params['widest'][$i]) {
- $this->params['widest'][$i] = $w;
- }
- $tmp = count_chars($columns[$i], 1);
- // handle unix, mac and windows formats
- $lines = (isset($tmp[10]) ? $tmp[10] : @$tmp[13]) + 1;
- if ($lines > $highest) {
- $highest = $lines;
- }
- }
- if (sizeof($columns) > $this->params['ncols']) {
- $this->params['ncols'] = sizeof($columns);
- }
- $new_row = array(
- 'data' => $columns,
- 'height' => $highest,
- 'rowparams' => $rowparams,
- 'colparams' => $colparams,
- );
- $this->params['table_data'][] = $new_row;
- }
-
- // }}}
- // {{{ endTable()
-
- function endTable()
- {
- trigger_error("PEAR_Frontend_CLI::endTable deprecated", E_USER_ERROR);
- }
-
- function _endTable()
- {
- extract($this->params);
- if (!empty($caption)) {
- $this->_displayHeading($caption);
- }
- if (count($table_data) == 0) {
- return;
- }
- if (!isset($width)) {
- $width = $widest;
- } else {
- for ($i = 0; $i < $ncols; $i++) {
- if (!isset($width[$i])) {
- $width[$i] = $widest[$i];
- }
- }
- }
- $border = false;
- if (empty($border)) {
- $cellstart = '';
- $cellend = ' ';
- $rowend = '';
- $padrowend = false;
- $borderline = '';
- } else {
- $cellstart = '| ';
- $cellend = ' ';
- $rowend = '|';
- $padrowend = true;
- $borderline = '+';
- foreach ($width as $w) {
- $borderline .= str_repeat('-', $w + strlen($cellstart) + strlen($cellend) - 1);
- $borderline .= '+';
- }
- }
- if ($borderline) {
- $this->_displayLine($borderline);
- }
- for ($i = 0; $i < sizeof($table_data); $i++) {
- extract($table_data[$i]);
- $rowlines = array();
- if ($height > 1) {
- for ($c = 0; $c < sizeof($data); $c++) {
- $rowlines[$c] = preg_split('/(\r?\n|\r)/', $data[$c]);
- if (sizeof($rowlines[$c]) < $height) {
- $rowlines[$c] = array_pad($rowlines[$c], $height, '');
- }
- }
- } else {
- for ($c = 0; $c < sizeof($data); $c++) {
- $rowlines[$c] = array($data[$c]);
- }
- }
- for ($r = 0; $r < $height; $r++) {
- $rowtext = '';
- for ($c = 0; $c < sizeof($data); $c++) {
- if (isset($colparams[$c])) {
- $attribs = array_merge($rowparams, $colparams);
- } else {
- $attribs = $rowparams;
- }
- $w = isset($width[$c]) ? $width[$c] : 0;
- //$cell = $data[$c];
- $cell = $rowlines[$c][$r];
- $l = strlen($cell);
- if ($l > $w) {
- $cell = substr($cell, 0, $w);
- }
- if (isset($attribs['bold'])) {
- $cell = $this->bold($cell);
- }
- if ($l < $w) {
- // not using str_pad here because we may
- // add bold escape characters to $cell
- $cell .= str_repeat(' ', $w - $l);
- }
-
- $rowtext .= $cellstart . $cell . $cellend;
- }
- $rowtext .= $rowend;
- $this->_displayLine($rowtext);
- }
- }
- if ($borderline) {
- $this->_displayLine($borderline);
- }
- }
-
- // }}}
- // {{{ outputData()
-
- function outputData($data, $command = '_default')
- {
- switch ($command)
- {
- case 'install':
- case 'upgrade':
- case 'upgrade-all':
- if (isset($data['release_warnings'])) {
- $this->_displayLine('');
- $this->_startTable(array(
- 'border' => false,
- 'caption' => 'Release Warnings'
- ));
- $this->_tableRow(array($data['release_warnings']), null, array(1 => array('wrap' => 55)));
- $this->_endTable();
- $this->_displayLine('');
- };
- $this->_displayLine($data['data']);
- break;
- case 'search':
- $this->_startTable($data);
- if (isset($data['headline']) && is_array($data['headline']))
- $this->_tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55)));
-
- foreach($data['data'] as $category) {
- foreach($category as $pkg) {
- $this->_tableRow($pkg, null, array(1 => array('wrap' => 55)));
- }
- };
- $this->_endTable();
- break;
- case 'list-all':
- $this->_startTable($data);
- if (isset($data['headline']) && is_array($data['headline']))
- $this->_tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55)));
-
- foreach($data['data'] as $category) {
- foreach($category as $pkg) {
- unset($pkg[3]);
- unset($pkg[4]);
- $this->_tableRow($pkg, null, array(1 => array('wrap' => 55)));
- }
- };
- $this->_endTable();
- break;
- case 'config-show':
- $data['border'] = false;
- $opts = array(0 => array('wrap' => 30),
- 1 => array('wrap' => 20),
- 2 => array('wrap' => 35));
- $this->_startTable($data);
- if (isset($data['headline']) && is_array($data['headline'])) {
- $this->_tableRow($data['headline'],
- array('bold' => true),
- $opts);
- }
- foreach($data['data'] as $group) {
- foreach($group as $value) {
- if ($value[2] == '') {
- $value[2] = "<not set>";
- }
- $this->_tableRow($value, null, $opts);
- }
- }
- $this->_endTable();
- break;
- case 'remote-info':
- $data = array(
- 'caption' => 'Package details:',
- 'border' => false,
- 'data' => array(
- array("Latest", $data['stable']),
- array("Installed", $data['installed']),
- array("Package", $data['name']),
- array("License", $data['license']),
- array("Category", $data['category']),
- array("Summary", $data['summary']),
- array("Description", $data['description']),
- ),
- );
- default: {
- if (is_array($data))
- {
- $this->_startTable($data);
- $count = count($data['data'][0]);
- if ($count == 2) {
- $opts = array(0 => array('wrap' => 25),
- 1 => array('wrap' => 48)
- );
- } elseif ($count == 3) {
- $opts = array(0 => array('wrap' => 20),
- 1 => array('wrap' => 20),
- 2 => array('wrap' => 35)
- );
- }
- if (isset($data['headline']) && is_array($data['headline'])) {
- $this->_tableRow($data['headline'],
- array('bold' => true),
- $opts);
- }
- foreach($data['data'] as $row) {
- $this->_tableRow($row, null, $opts);
- }
- $this->_endTable();
- } else {
- $this->_displayLine($data);
- }
- }
- }
- }
-
- // }}}
- // {{{ log(text)
-
-
- function log($text)
- {
- return $this->_displayLine($text);
- }
-
-
- // }}}
- // {{{ bold($text)
-
- function bold($text)
- {
- if (empty($this->term['bold'])) {
- return strtoupper($text);
- }
- return $this->term['bold'] . $text . $this->term['normal'];
- }
-
- // }}}
-}
-
-?>
diff --git a/pear/PEAR/Installer.php b/pear/PEAR/Installer.php
deleted file mode 100644
index 6f77dbd8dc..0000000000
--- a/pear/PEAR/Installer.php
+++ /dev/null
@@ -1,874 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@php.net> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR/Common.php';
-require_once 'PEAR/Registry.php';
-require_once 'PEAR/Dependency.php';
-require_once 'System.php';
-
-define('PEAR_INSTALLER_OK', 1);
-define('PEAR_INSTALLER_FAILED', 0);
-define('PEAR_INSTALLER_SKIPPED', -1);
-
-/**
- * Administration class used to install PEAR packages and maintain the
- * installed package database.
- *
- * TODO:
- * - Check dependencies break on package uninstall (when no force given)
- * - add a guessInstallDest() method with the code from _installFile() and
- * use that method in Registry::_rebuildFileMap() & Command_Registry::doList(),
- * others..
- *
- * @since PHP 4.0.2
- * @author Stig Bakken <ssb@php.net>
- */
-class PEAR_Installer extends PEAR_Common
-{
- // {{{ properties
-
- /** name of the package directory, for example Foo-1.0
- * @var string
- */
- var $pkgdir;
-
- /** directory where PHP code files go
- * @var string
- */
- var $phpdir;
-
- /** directory where PHP extension files go
- * @var string
- */
- var $extdir;
-
- /** directory where documentation goes
- * @var string
- */
- var $docdir;
-
- /** installation root directory (ala PHP's INSTALL_ROOT or
- * automake's DESTDIR
- * @var string
- */
- var $installroot = '';
-
- /** debug level
- * @var int
- */
- var $debug = 1;
-
- /** temporary directory
- * @var string
- */
- var $tmpdir;
-
- /** PEAR_Registry object used by the installer
- * @var object
- */
- var $registry;
-
- /** List of file transactions queued for an install/upgrade/uninstall.
- *
- * Format:
- * array(
- * 0 => array("rename => array("from-file", "to-file")),
- * 1 => array("delete" => array("file-to-delete")),
- * ...
- * )
- *
- * @var array
- */
- var $file_operations = array();
-
- // }}}
-
- // {{{ constructor
-
- /**
- * PEAR_Installer constructor.
- *
- * @param object $ui user interface object (instance of PEAR_Frontend_*)
- *
- * @access public
- */
- function PEAR_Installer(&$ui)
- {
- parent::PEAR_Common();
- $this->setFrontendObject($ui);
- $this->debug = $this->config->get('verbose');
- $this->registry = &new PEAR_Registry($this->config->get('php_dir'));
- }
-
- // }}}
-
- // {{{ _deletePackageFiles()
-
- /**
- * Delete a package's installed files, remove empty directories.
- *
- * @param string $package package name
- *
- * @return bool TRUE on success, or a PEAR error on failure
- *
- * @access private
- */
- function _deletePackageFiles($package)
- {
- if (!strlen($package)) {
- return $this->raiseError("No package to uninstall given");
- }
- $filelist = $this->registry->packageInfo($package, 'filelist');
- if ($filelist == null) {
- return $this->raiseError("$package not installed");
- }
- foreach ($filelist as $file => $props) {
- if (empty($props['installed_as'])) {
- continue;
- }
- $path = $this->_prependPath($props['installed_as'], $this->installroot);
- $this->addFileOperation('delete', array($path));
- }
- return true;
- }
-
- // }}}
- // {{{ _installFile()
-
- function _installFile($file, $atts, $tmp_path)
- {
- static $os;
- if (isset($atts['platform'])) {
- if (empty($os)) {
- include_once "OS/Guess.php";
- $os = new OS_Guess();
- }
- // return if this file is meant for another platform
- if (!$os->matchSignature($atts['platform'])) {
- $this->log(3, "skipped $file (meant for $atts[platform], we are ".$os->getSignature().")");
- return PEAR_INSTALLER_SKIPPED;
- }
- }
-
- switch ($atts['role']) {
- case 'doc':
- case 'data':
- case 'test':
- $dest_dir = $this->config->get($atts['role'] . '_dir') .
- DIRECTORY_SEPARATOR . $this->pkginfo['package'];
- unset($atts['baseinstalldir']);
- break;
- case 'ext':
- case 'php':
- $dest_dir = $this->config->get($atts['role'] . '_dir');
- break;
- case 'script':
- $dest_dir = $this->config->get('bin_dir');
- break;
- case 'src':
- case 'extsrc':
- $this->source_files++;
- return;
- default:
- return $this->raiseError("Invalid role `$atts[role]' for file $file");
- }
- if (!empty($atts['baseinstalldir'])) {
- $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
- }
- if (dirname($file) != '.' && empty($atts['install-as'])) {
- $dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
- }
- if (empty($atts['install-as'])) {
- $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
- } else {
- $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as'];
- }
- $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file;
-
- // Clean up the DIRECTORY_SEPARATOR mess
- $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
- list($dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!$ds2+!"),
- DIRECTORY_SEPARATOR,
- array($dest_file, $orig_file));
- $installed_as = $dest_file;
- $final_dest_file = $this->_prependPath($dest_file, $this->installroot);
- $dest_dir = dirname($final_dest_file);
- $dest_file = $dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file);
- if (!@is_dir($dest_dir)) {
- if (!$this->mkDirHier($dest_dir)) {
- return $this->raiseError("failed to mkdir $dest_dir",
- PEAR_INSTALLER_FAILED);
- }
- $this->log(3, "+ mkdir $dest_dir");
- }
- if (empty($atts['replacements'])) {
- if (!@copy($orig_file, $dest_file)) {
- return $this->raiseError("failed to write $dest_file",
- PEAR_INSTALLER_FAILED);
- }
- $this->log(3, "+ cp $orig_file $dest_file");
- if (isset($atts['md5sum'])) {
- $md5sum = md5_file($dest_file);
- }
- } else {
- $fp = fopen($orig_file, "r");
- $contents = fread($fp, filesize($orig_file));
- fclose($fp);
- if (isset($atts['md5sum'])) {
- $md5sum = md5($contents);
- }
- $subst_from = $subst_to = array();
- foreach ($atts['replacements'] as $a) {
- $to = '';
- if ($a['type'] == 'php-const') {
- if (preg_match('/^[a-z0-9_]+$/i', $a['to'])) {
- eval("\$to = $a[to];");
- } else {
- $this->log(0, "invalid php-const replacement: $a[to]");
- continue;
- }
- } elseif ($a['type'] == 'pear-config') {
- $to = $this->config->get($a['to']);
- } elseif ($a['type'] == 'package-info') {
- $to = $this->pkginfo[$a['to']];
- }
- if ($to) {
- $subst_from[] = $a['from'];
- $subst_to[] = $to;
- }
- }
- $this->log(3, "doing ".sizeof($subst_from)." substitution(s) for $final_dest_file");
- if (sizeof($subst_from)) {
- $contents = str_replace($subst_from, $subst_to, $contents);
- }
- $wp = @fopen($dest_file, "w");
- if (!is_resource($wp)) {
- return $this->raiseError("failed to create $dest_file: $php_errormsg",
- PEAR_INSTALLER_FAILED);
- }
- if (!fwrite($wp, $contents)) {
- return $this->raiseError("failed writing to $dest_file: $php_errormsg",
- PEAR_INSTALLER_FAILED);
- }
- fclose($wp);
- }
- if (isset($md5sum)) {
- if ($md5sum == $atts['md5sum']) {
- $this->log(3, "md5sum ok: $final_dest_file");
- } else {
- $this->log(0, "warning : bad md5sum for file $final_dest_file");
- }
- }
- if (!OS_WINDOWS) {
- if ($atts['role'] == 'script') {
- $mode = 0777 & ~(int)octdec($this->config->get('umask'));
- $this->log(3, "+ chmod +x $dest_file");
- } else {
- $mode = 0666 & ~(int)octdec($this->config->get('umask'));
- }
- $this->addFileOperation("chmod", array($mode, $dest_file));
- if (!@chmod($dest_file, $mode)) {
- $this->log(0, "failed to change mode of $dest_file");
- }
- }
- $this->addFileOperation("rename", array($dest_file, $final_dest_file));
-
- // XXX SHOULD BE DONE ONLY AFTER COMMIT
- // Store the full path where the file was installed for easy unistall
- $this->pkginfo['filelist'][$file]['installed_as'] = $installed_as;
-
- //$this->log(2, "installed: $dest_file");
- return PEAR_INSTALLER_OK;
- }
-
- // }}}
- // {{{ addFileOperation()
-
- function addFileOperation($type, $data)
- {
- if ($type == 'chmod') {
- $octmode = decoct($data[0]);
- $this->log(3, "adding to transaction: $type $octmode $data[1]");
- } else {
- $this->log(3, "adding to transaction: $type " . implode(" ", $data));
- }
- $this->file_operations[] = array($type, $data);
- }
-
- // }}}
- // {{{ startFileTransaction()
-
- function startFileTransaction($rollback_in_case = false)
- {
- if (count($this->file_operations) && $rollback_in_case) {
- $this->rollbackFileTransaction();
- }
- $this->file_operations = array();
- }
-
- // }}}
- // {{{ commitFileTransaction()
-
- function commitFileTransaction()
- {
- $n = count($this->file_operations);
- $this->log(2, "about to commit $n file operations");
- // first, check permissions and such manually
- $errors = array();
- foreach ($this->file_operations as $tr) {
- list($type, $data) = $tr;
- switch ($type) {
- case 'rename':
- // check that dest dir. is writable
- if (!is_writable(dirname($data[1]))) {
- $errors[] = "permission denied ($type): $data[1]";
- }
- break;
- case 'chmod':
- // check that file is writable
- if (!is_writable($data[1])) {
- $errors[] = "permission denied ($type): $data[1]";
- }
- break;
- case 'delete':
- // check that directory is writable
- if (file_exists($data[0]) && !is_writable(dirname($data[0]))) {
- $errors[] = "permission denied ($type): $data[0]";
- }
- break;
- }
-
- }
- $m = sizeof($errors);
- if ($m > 0) {
- foreach ($errors as $error) {
- $this->log(1, $error);
- }
- return false;
- }
- // really commit the transaction
- foreach ($this->file_operations as $tr) {
- list($type, $data) = $tr;
- switch ($type) {
- case 'rename':
- @rename($data[0], $data[1]);
- $this->log(3, "+ mv $data[0] $data[1]");
- break;
- case 'chmod':
- @chmod($data[0], $data[1]);
- $octmode = decoct($data[0]);
- $this->log(3, "+ chmod $octmode $data[1]");
- break;
- case 'delete':
- @unlink($data[0]);
- $this->log(3, "+ rm $data[0]");
- break;
- case 'rmdir':
- @rmdir($data[0]);
- $this->log(3, "+ rmdir $data[0]");
- break;
- }
- }
- $this->log(2, "successfully commited $n file operations");
- $this->file_operations = array();
- return true;
- }
-
- // }}}
- // {{{ rollbackFileTransaction()
-
- function rollbackFileTransaction()
- {
- $n = count($this->file_operations);
- $this->log(2, "rolling back $n file operations");
- foreach ($this->file_operations as $tr) {
- list($type, $data) = $tr;
- switch ($type) {
- case 'rename':
- @unlink($data[0]);
- $this->log(3, "+ rm $data[0]");
- break;
- case 'mkdir':
- @rmdir($data[0]);
- $this->log(3, "+ rmdir $data[0]");
- break;
- case 'chmod':
- break;
- case 'delete':
- break;
- }
- }
- $this->file_operations = array();
- }
-
- // }}}
- // {{{ getPackageDownloadUrl()
-
- function getPackageDownloadUrl($package)
- {
- if ($this === null || $this->config === null) {
- $package = "http://pear.php.net/get/$package";
- } else {
- $package = "http://" . $this->config->get('master_server') .
- "/get/$package";
- }
- if (!extension_loaded("zlib")) {
- $package .= '?uncompress=yes';
- }
- return $package;
- }
-
- // }}}
- // {{{ mkDirHier($dir)
-
- function mkDirHier($dir)
- {
- $this->addFileOperation('mkdir', array($dir));
- return parent::mkDirHier($dir);
- }
-
- // }}}
-
- // {{{ _prependPath($path, $prepend)
-
- function _prependPath($path, $prepend)
- {
- if (strlen($prepend) > 0) {
- if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) {
- $path = $prepend . substr($path, 2);
- } else {
- $path = $prepend . $path;
- }
- }
- return $path;
- }
-
- // }}}
-
- // {{{ install()
-
- /**
- * Installs the files within the package file specified.
- *
- * @param $pkgfile path to the package file
- *
- * @return array package info if successful, null if not
- */
-
- function install($pkgfile, $options = array())
- {
- // recognized options:
- // - force : force installation
- // - register-only : update registry but don't install files
- // - upgrade : upgrade existing install
- // - soft : fail silently
- //
- $php_dir = $this->config->get('php_dir');
- if (isset($options['installroot'])) {
- if (substr($options['installroot'], -1) == DIRECTORY_SEPARATOR) {
- $options['installroot'] = substr($options['installroot'], 0, -1);
- }
- $php_dir = $this->_prependPath($php_dir, $options['installroot']);
- $this->registry = &new PEAR_Registry($php_dir);
- $this->installroot = $options['installroot'];
- } else {
- $registry = &$this->registry;
- $this->installroot = '';
- }
- $need_download = false;
- // ==> XXX should be removed later on
- $flag_old_format = false;
- if (preg_match('#^(http|ftp)://#', $pkgfile)) {
- $need_download = true;
- } elseif (!@is_file($pkgfile)) {
- if ($this->validPackageName($pkgfile)) {
- if ($this->registry->packageExists($pkgfile) &&
- empty($options['upgrade']) && empty($options['force']))
- {
- return $this->raiseError("$pkgfile already installed");
- }
- $pkgfile = $this->getPackageDownloadUrl($pkgfile);
- $need_download = true;
- } else {
- if (strlen($pkgfile)) {
- return $this->raiseError("Could not open the package file: $pkgfile");
- } else {
- return $this->raiseError("No package file given");
- }
- }
- }
-
- // Download package -----------------------------------------------
- if ($need_download) {
- $downloaddir = $this->config->get('download_dir');
- if (empty($downloaddir)) {
- if (PEAR::isError($downloaddir = System::mktemp('-d'))) {
- return $downloaddir;
- }
- $this->log(2, '+ tmp dir created at ' . $downloaddir);
- }
- $callback = $this->ui ? array(&$this, '_downloadCallback') : null;
- $file = $this->downloadHttp($pkgfile, $this->ui, $downloaddir, $callback);
- if (PEAR::isError($file)) {
- return $this->raiseError($file);
- }
- $pkgfile = $file;
- }
-
- if (substr($pkgfile, -4) == '.xml') {
- $descfile = $pkgfile;
- } else {
- // Decompress pack in tmp dir -------------------------------------
-
- // To allow relative package file names
- $oldcwd = getcwd();
- if (@chdir(dirname($pkgfile))) {
- $pkgfile = getcwd() . DIRECTORY_SEPARATOR . basename($pkgfile);
- chdir($oldcwd);
- }
-
- if (PEAR::isError($tmpdir = System::mktemp('-d'))) {
- return $tmpdir;
- }
- $this->log(2, '+ tmp dir created at ' . $tmpdir);
-
- $tar = new Archive_Tar($pkgfile);
- if (!@$tar->extract($tmpdir)) {
- return $this->raiseError("unable to unpack $pkgfile");
- }
-
- // ----- Look for existing package file
- $descfile = $tmpdir . DIRECTORY_SEPARATOR . 'package.xml';
-
- if (!is_file($descfile)) {
- // ----- Look for old package archive format
- // In this format the package.xml file was inside the
- // Package-n.n directory
- $dp = opendir($tmpdir);
- do {
- $pkgdir = readdir($dp);
- } while ($pkgdir{0} == '.');
-
- $descfile = $tmpdir . DIRECTORY_SEPARATOR . $pkgdir . DIRECTORY_SEPARATOR . 'package.xml';
- $flag_old_format = true;
- $this->log(0, "warning : you are using an archive with an old format");
- }
- // <== XXX This part should be removed later on
- }
-
- if (!is_file($descfile)) {
- return $this->raiseError("no package.xml file after extracting the archive");
- }
-
- // Parse xml file -----------------------------------------------
- $pkginfo = $this->infoFromDescriptionFile($descfile);
- if (PEAR::isError($pkginfo)) {
- return $pkginfo;
- }
- $this->validatePackageInfo($pkginfo, $errors, $warnings);
- // XXX We allow warnings, do we have to do it?
- if (count($errors)) {
- if (empty($options['force'])) {
- return $this->raiseError("The following errors where found (use force option to install anyway):\n".
- implode("\n", $errors));
- } else {
- $this->log(0, "warning : the following errors were found:\n".
- implode("\n", $errors));
- }
- }
-
- $pkgname = $pkginfo['package'];
-
- // Check dependencies -------------------------------------------
- if (isset($pkginfo['release_deps']) && empty($options['nodeps'])) {
- $error = $this->checkDeps($pkginfo);
- if ($error) {
- if (empty($options['soft'])) {
- $this->log(0, $error);
- }
- return $this->raiseError("$pkgname: dependencies failed");
- }
- }
-
- if (empty($options['force'])) {
- // checks to do when not in "force" mode
- $test = $this->registry->checkFileMap($pkginfo);
- if (sizeof($test)) {
- $tmp = $test;
- foreach ($tmp as $file => $pkg) {
- if ($pkg == $pkgname) {
- unset($test[$file]);
- }
- }
- if (sizeof($test)) {
- $msg = "$pkgname: conflicting files found:\n";
- $longest = max(array_map("strlen", array_keys($test)));
- $fmt = "%${longest}s (%s)\n";
- foreach ($test as $file => $pkg) {
- $msg .= sprintf($fmt, $file, $pkg);
- }
- return $this->raiseError($msg);
- }
- }
- }
-
- if (empty($options['upgrade'])) {
- // checks to do only when installing new packages
- if (empty($options['force']) && $this->registry->packageExists($pkgname)) {
- return $this->raiseError("$pkgname already installed");
- }
- } else {
- // checks to do only when upgrading packages
- if (!$this->registry->packageExists($pkgname)) {
- return $this->raiseError("$pkgname not installed");
- }
- $v1 = $this->registry->packageInfo($pkgname, 'version');
- $v2 = $pkginfo['version'];
- $cmp = version_compare("$v1", "$v2", 'gt');
- if (empty($options['force']) && !version_compare("$v2", "$v1", 'gt')) {
- return $this->raiseError("upgrade to a newer version ($v2 is not newer than $v1)");
- }
- if (empty($options['register-only'])) {
- // when upgrading, remove old release's files first:
- if (PEAR::isError($err = $this->_deletePackageFiles($pkgname))) {
- return $this->raiseError($err);
- }
- }
- }
-
- // Copy files to dest dir ---------------------------------------
-
- // info from the package it self we want to access from _installFile
- $this->pkginfo = &$pkginfo;
- // used to determine whether we should build any C code
- $this->source_files = 0;
-
- if (empty($options['register-only'])) {
- if (!is_dir($php_dir)) {
- return $this->raiseError("no script destination directory\n",
- null, PEAR_ERROR_DIE);
- }
-
- // don't want strange characters
- $pkgname = ereg_replace ('[^a-zA-Z0-9._]', '_', $pkginfo['package']);
- $pkgversion = ereg_replace ('[^a-zA-Z0-9._\-]', '_', $pkginfo['version']);
- $tmp_path = dirname($descfile);
- if (substr($pkgfile, -4) != '.xml') {
- $tmp_path .= DIRECTORY_SEPARATOR . $pkgname . '-' . $pkgversion;
- }
-
- // ==> XXX This part should be removed later on
- if ($flag_old_format) {
- $tmp_path = dirname($descfile);
- }
- // <== XXX This part should be removed later on
-
- foreach ($pkginfo['filelist'] as $file => $atts) {
- $this->expectError(PEAR_INSTALLER_FAILED);
- $res = $this->_installFile($file, $atts, $tmp_path);
- $this->popExpect();
- if (PEAR::isError($res)) {
- if (empty($options['ignore-errors'])) {
- $this->rollbackFileTransaction();
- return $this->raiseError($res);
- } else {
- $this->log(0, "Warning: " . $res->getMessage());
- }
- }
- if ($res != PEAR_INSTALLER_OK) {
- // Do not register files that were not installed
- unset($pkginfo['filelist'][$file]);
- }
- }
-
- if ($this->source_files > 0 && empty($options['nobuild'])) {
- $this->log(1, "$this->source_files source files, building");
- $bob = &new PEAR_Builder($this->ui);
- $bob->debug = $this->debug;
- $built = $bob->build($descfile, array(&$this, '_buildCallback'));
- if (PEAR::isError($built)) {
- $this->rollbackFileTransaction();
- return $built;
- }
- foreach ($built as $ext) {
- $bn = basename($ext['file']);
- $this->log(2, "installing $bn");
- $dest = $this->config->get('ext_dir') . DIRECTORY_SEPARATOR . $bn;
- $this->log(3, "+ cp $ext[file] ext_dir");
- $copyto = $this->_prependPath($dest, $this->installroot);
- if (!@copy($ext['file'], $copyto)) {
- $this->rollbackFileTransaction();
- return $this->raiseError("failed to copy $bn to $copyto");
- }
- $pkginfo['filelist'][$bn] = array(
- 'role' => 'ext',
- 'installed_as' => $dest,
- 'php_api' => $ext['php_api'],
- 'zend_mod_api' => $ext['zend_mod_api'],
- 'zend_ext_api' => $ext['zend_ext_api'],
- );
- }
- }
- }
-
- if (!$this->commitFileTransaction()) {
- $this->rollbackFileTransaction();
- return $this->raiseError("commit failed", PEAR_INSTALLER_FAILED);
- }
-
- // Register that the package is installed -----------------------
- if (empty($options['upgrade'])) {
- // if 'force' is used, replace the info in registry
- if (!empty($options['force']) && $this->registry->packageExists($pkgname)) {
- $this->registry->deletePackage($pkgname);
- }
- $ret = $this->registry->addPackage($pkgname, $pkginfo);
- } else {
- $ret = $this->registry->updatePackage($pkgname, $pkginfo, false);
- }
- if (!$ret) {
- return null;
- }
- return $pkginfo;
- }
-
- // }}}
- // {{{ uninstall()
-
- function uninstall($package, $options = array())
- {
- $php_dir = $this->config->get('php_dir');
- if (isset($options['installroot'])) {
- if (substr($options['installroot'], -1) == DIRECTORY_SEPARATOR) {
- $options['installroot'] = substr($options['installroot'], 0, -1);
- }
- $this->installroot = $options['installroot'];
- $php_dir = $this->_prependPath($php_dir, $this->installroot);
- } else {
- $this->installroot = '';
- }
- $this->registry = &new PEAR_Registry($php_dir);
-
- // Delete the files
- if (PEAR::isError($err = $this->_deletePackageFiles($package))) {
- $this->rollbackFileTransaction();
- return $this->raiseError($err);
- }
- if (!$this->commitFileTransaction()) {
- $this->rollbackFileTransaction();
- return $this->raiseError("uninstall failed");
- }
-
- // Register that the package is no longer installed
- return $this->registry->deletePackage($package);
- }
-
- // }}}
- // {{{ checkDeps()
-
- function checkDeps(&$pkginfo)
- {
- $depchecker = &new PEAR_Dependency($this->registry);
- $error = $errors = '';
- $failed_deps = array();
- if (is_array($pkginfo['release_deps'])) {
- foreach($pkginfo['release_deps'] as $dep) {
- $code = $depchecker->callCheckMethod($error, $dep);
- if ($code) {
- $failed_deps[] = array($dep, $code, $error);
- }
- }
- $n = count($failed_deps);
- if ($n > 0) {
- $depinstaller =& new PEAR_Installer($this->ui);
- $to_install = array();
- for ($i = 0; $i < $n; $i++) {
- if (isset($failed_deps[$i]['type'])) {
- $type = $failed_deps[$i]['type'];
- } else {
- $type = 'pkg';
- }
- switch ($failed_deps[$i][1]) {
- case PEAR_DEPENDENCY_MISSING:
- if ($type == 'pkg') {
- // install
- }
- $errors .= "\n" . $failed_deps[$i][2];
- break;
- case PEAR_DEPENDENCY_UPGRADE_MINOR:
- if ($type == 'pkg') {
- // upgrade
- }
- $errors .= "\n" . $failed_deps[$i][2];
- break;
- default:
- $errors .= "\n" . $failed_deps[$i][2];
- break;
- }
- }
- return substr($errors, 1);
- }
- }
- return false;
- }
-
- // }}}
- // {{{ _downloadCallback()
-
- function _downloadCallback($msg, $params = null)
- {
- switch ($msg) {
- case 'saveas':
- $this->log(1, "downloading $params ...");
- break;
- case 'done':
- $this->log(1, '...done: ' . number_format($params, 0, '', ',') . ' bytes');
- break;
- }
- if (method_exists($this->ui, '_downloadCallback'))
- $this->ui->_downloadCallback($msg, $params);
- }
-
- // }}}
- // {{{ _buildCallback()
-
- function _buildCallback($what, $data)
- {
- if (($what == 'cmdoutput' && $this->debug > 1) ||
- ($what == 'output' && $this->debug > 0)) {
- $this->ui->outputData(rtrim($data), 'build');
- }
- }
-
- // }}}
-}
-
-if (!function_exists("md5_file")) {
- function md5_file($filename) {
- $fp = fopen($filename, "r");
- if (!$fp) return null;
- $contents = fread($fp, filesize($filename));
- fclose($fp);
- return md5($contents);
- }
-}
-
-?>
diff --git a/pear/PEAR/Packager.php b/pear/PEAR/Packager.php
deleted file mode 100644
index 69279c4465..0000000000
--- a/pear/PEAR/Packager.php
+++ /dev/null
@@ -1,176 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@php.net> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR/Common.php';
-require_once 'System.php';
-
-/**
- * Administration class used to make a PEAR release tarball.
- *
- * TODO:
- * - add an extra param the dir where to place the created package
- *
- * @since PHP 4.0.2
- * @author Stig Bakken <ssb@php.net>
- */
-class PEAR_Packager extends PEAR_Common
-{
- // {{{ constructor
-
- function PEAR_Packager()
- {
- parent::PEAR_Common();
- }
-
- // }}}
- // {{{ destructor
-
- function _PEAR_Packager()
- {
- parent::_PEAR_Common();
- }
-
- // }}}
-
- // {{{ package()
-
- function package($pkgfile = null, $compress = true)
- {
- if (empty($pkgfile)) {
- $pkgfile = 'package.xml';
- }
- $pkginfo = $this->infoFromDescriptionFile($pkgfile);
- if (PEAR::isError($pkginfo)) {
- return $this->raiseError($pkginfo);
- }
- if (empty($this->pkginfo['version'])) {
- return $this->raiseError("No version info found in $pkgfile");
- }
- // TMP DIR -------------------------------------------------
- // We allow calls like "pear package /home/user/mypack/package.xml"
- $oldcwd = getcwd();
- $dir = dirname($pkgfile);
- if (!@chdir($dir)) {
- return $this->raiseError('Could not chdir to '.$dir);
- }
- $pkgfile = basename($pkgfile);
- if (@$this->pkginfo['release_state'] == 'snapshot' && empty($this->pkginfo['version'])) {
- $this->pkginfo['version'] = date('Ymd');
- }
- // don't want strange characters
- $pkgname = preg_replace('/[^a-z0-9._]/i', '_', $this->pkginfo['package']);
- $pkgversion = preg_replace('/[^a-z0-9._-]/i', '_', $this->pkginfo['version']);
- $pkgver = $pkgname . '-' . $pkgversion;
-
- $errors = $warnings = array();
- $this->validatePackageInfo($this->pkginfo, $errors, $warnings, $dir);
- foreach ($warnings as $w) {
- $this->log(1, "Warning: $w");
- }
- foreach ($errors as $e) {
- $this->log(0, "Error: $e");
- }
- if (sizeof($errors) > 0) {
- chdir($oldcwd);
- return $this->raiseError('Errors in package');
- }
-
- // ----- Create the package file list
- $filelist = array();
- $i = 0;
-
- // Copy files -----------------------------------------------
- foreach ($this->pkginfo['filelist'] as $fname => $atts) {
- if (!file_exists($fname)) {
- chdir($oldcwd);
- return $this->raiseError("File does not exist: $fname");
- } else {
- $filelist[$i++] = $fname;
- if (empty($this->pkginfo['filelist'][$fname]['md5sum'])) {
- $md5sum = md5_file($fname);
- $this->pkginfo['filelist'][$fname]['md5sum'] = $md5sum;
- }
- $this->log(2, "Adding file $fname");
- }
- }
- $new_xml = $this->xmlFromInfo($this->pkginfo);
- if (PEAR::isError($new_xml)) {
- chdir($oldcwd);
- return $this->raiseError($new_xml);
- }
- if (!($tmpdir = System::mktemp('-t '.getcwd().' -d'))) {
- chdir($oldcwd);
- return $this->raiseError("PEAR_Packager: mktemp failed");
- }
- $newpkgfile = $tmpdir . DIRECTORY_SEPARATOR . 'package.xml';
- $np = @fopen($newpkgfile, "w");
- if (!$np) {
- chdir($oldcwd);
- return $this->raiseError("PEAR_Packager: unable to rewrite $pkgfile as $newpkgfile");
- }
- fwrite($np, $new_xml);
- fclose($np);
-
- // TAR the Package -------------------------------------------
- $ext = $compress ? '.tgz' : '.tar';
- $dest_package = $oldcwd . DIRECTORY_SEPARATOR . $pkgver . $ext;
- $tar =& new Archive_Tar($dest_package, $compress);
- $tar->setErrorHandling(PEAR_ERROR_RETURN); // XXX Don't print errors
- // ----- Creates with the package.xml file
- $ok = $tar->createModify($newpkgfile, '', $tmpdir);
- if (PEAR::isError($ok)) {
- chdir($oldcwd);
- return $this->raiseError($ok);
- } elseif (!$ok) {
- chdir($oldcwd);
- return $this->raiseError('PEAR_Packager: tarball creation failed');
- }
- // ----- Add the content of the package
- if (!$tar->addModify($filelist, $pkgver)) {
- chdir($oldcwd);
- return $this->raiseError('PEAR_Packager: tarball creation failed');
- }
- $this->log(1, "Package $dest_package done");
- if (file_exists("CVS/Root")) {
- $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pkgversion);
- $cvstag = "RELEASE_$cvsversion";
- $this->log(1, "Tag the released code with `pear cvstag $pkgfile'");
- $this->log(1, "(or set the CVS tag $cvstag by hand)");
- }
- chdir($oldcwd);
- return $dest_package;
- }
-
- // }}}
-}
-
-if (!function_exists('md5_file')) {
- function md5_file($file) {
- if (!$fd = @fopen($file, 'r')) {
- return false;
- }
- $md5 = md5(fread($fd, filesize($file)));
- fclose($fd);
- return $md5;
- }
-}
-
-?> \ No newline at end of file
diff --git a/pear/PEAR/Registry.php b/pear/PEAR/Registry.php
deleted file mode 100644
index 68a33b36e7..0000000000
--- a/pear/PEAR/Registry.php
+++ /dev/null
@@ -1,690 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Stig Bakken <ssb@php.net> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-/*
-TODO:
- - Transform into singleton()
- - Add application level lock (avoid change the registry from the cmdline
- while using the GTK interface, for ex.)
-*/
-require_once "System.php";
-require_once "PEAR.php";
-
-define('PEAR_REGISTRY_ERROR_LOCK', -2);
-define('PEAR_REGISTRY_ERROR_FORMAT', -3);
-define('PEAR_REGISTRY_ERROR_FILE', -4);
-
-/**
- * Administration class used to maintain the installed package database.
- */
-class PEAR_Registry extends PEAR
-{
- // {{{ properties
-
- /** Directory where registry files are stored.
- * @var string
- */
- var $statedir = '';
-
- /** File where the file map is stored
- * @var string
- */
- var $filemap = '';
-
- /** Name of file used for locking the registry
- * @var string
- */
- var $lockfile = '';
-
- /** File descriptor used during locking
- * @var resource
- */
- var $lock_fp = null;
-
- /** Mode used during locking
- * @var int
- */
- var $lock_mode = 0; // XXX UNUSED
-
- /** Cache of package information. Structure:
- * array(
- * 'package' => array('id' => ... ),
- * ... )
- * @var array
- */
- var $pkginfo_cache = array();
-
- /** Cache of file map. Structure:
- * array( '/path/to/file' => 'package', ... )
- * @var array
- */
- var $filemap_cache = array();
-
- // }}}
-
- // {{{ constructor
-
- /**
- * PEAR_Registry constructor.
- *
- * @param string (optional) PEAR install directory (for .php files)
- *
- * @access public
- */
- function PEAR_Registry($pear_install_dir = PEAR_INSTALL_DIR)
- {
- parent::PEAR();
- $ds = DIRECTORY_SEPARATOR;
- $this->install_dir = $pear_install_dir;
- $this->statedir = $pear_install_dir.$ds.'.registry';
- $this->filemap = $pear_install_dir.$ds.'.filemap';
- $this->lockfile = $pear_install_dir.$ds.'.lock';
- if (!file_exists($this->filemap)) {
- $this->rebuildFileMap();
- }
- }
-
- // }}}
- // {{{ destructor
-
- /**
- * PEAR_Registry destructor. Makes sure no locks are forgotten.
- *
- * @access private
- */
- function _PEAR_Registry()
- {
- parent::_PEAR();
- if (is_resource($this->lock_fp)) {
- $this->_unlock();
- }
- }
-
- // }}}
-
- // {{{ _assertStateDir()
-
- /**
- * Make sure the directory where we keep registry files exists.
- *
- * @return bool TRUE if directory exists, FALSE if it could not be
- * created
- *
- * @access private
- */
- function _assertStateDir()
- {
- if (!@is_dir($this->statedir)) {
- if (!System::mkdir("-p {$this->statedir}")) {
- return $this->raiseError("could not create directory '{$this->statedir}'");
- }
- }
- return true;
- }
-
- // }}}
- // {{{ _packageFileName()
-
- /**
- * Get the name of the file where data for a given package is stored.
- *
- * @param string package name
- *
- * @return string registry file name
- *
- * @access public
- */
- function _packageFileName($package)
- {
- return "{$this->statedir}/{$package}.reg";
- }
-
- // }}}
- // {{{ _openPackageFile()
-
- function _openPackageFile($package, $mode)
- {
- $this->_assertStateDir();
- $file = $this->_packageFileName($package);
- $fp = @fopen($file, $mode);
- if (!$fp) {
- return null;
- }
- return $fp;
- }
-
- // }}}
- // {{{ _closePackageFile()
-
- function _closePackageFile($fp)
- {
- fclose($fp);
- }
-
- // }}}
- // {{{ rebuildFileMap()
-
- function rebuildFileMap()
- {
- $packages = $this->listPackages();
- $files = array();
- foreach ($packages as $package) {
- $version = $this->packageInfo($package, 'version');
- $filelist = $this->packageInfo($package, 'filelist');
- if (!is_array($filelist)) {
- continue;
- }
- foreach ($filelist as $name => $attrs) {
- if (isset($attrs['role']) && $attrs['role'] != 'php') {
- continue;
- }
- if (isset($attrs['baseinstalldir'])) {
- $file = $attrs['baseinstalldir'].DIRECTORY_SEPARATOR.$name;
- } else {
- $file = $name;
- }
- $file = preg_replace(',^/+,', '', $file);
- $files[$file] = $package;
- }
- }
- $this->_assertStateDir();
- $fp = @fopen($this->filemap, 'w');
- if (!$fp) {
- return false;
- }
- $this->filemap_cache = $files;
- fwrite($fp, serialize($files));
- fclose($fp);
- return true;
- }
-
- // }}}
- // {{{ readFileMap()
-
- function readFileMap()
- {
- $fp = @fopen($this->filemap, 'r');
- if (!$fp) {
- return $this->raiseError('PEAR_Registry: could not open filemap', PEAR_REGISTRY_ERROR_FILE, null, null, $php_errormsg);
- }
- $fsize = filesize($this->filemap);
- $data = fread($fp, $fsize);
- fclose($fp);
- $tmp = unserialize($data);
- if (!$tmp && $fsize > 7) {
- return $this->raiseError('PEAR_Registry: invalid filemap data', PEAR_REGISTRY_ERROR_FORMAT, null, null, $data);
- }
- $this->filemap_cache = $tmp;
- return true;
- }
-
- // }}}
- // {{{ _lock()
-
- /**
- * Lock the registry.
- *
- * @param integer lock mode, one of LOCK_EX, LOCK_SH or LOCK_UN.
- * See flock manual for more information.
- *
- * @return bool TRUE on success, FALSE if locking failed, or a
- * PEAR error if some other error occurs (such as the
- * lock file not being writable).
- *
- * @access private
- */
- function _lock($mode = LOCK_EX)
- {
- if (!eregi('Windows 9', php_uname())) {
- if ($mode != LOCK_UN && is_resource($this->lock_fp)) {
- // XXX does not check type of lock (LOCK_SH/LOCK_EX)
- return true;
- }
- if (PEAR::isError($err = $this->_assertStateDir())) {
- return $err;
- }
- $open_mode = 'w';
- // XXX People reported problems with LOCK_SH and 'w'
- if ($mode === LOCK_SH) {
- if (@!is_file($this->lockfile)) {
- touch($this->lockfile);
- }
- $open_mode = 'r';
- }
-
- $this->lock_fp = @fopen($this->lockfile, $open_mode);
-
- if (!is_resource($this->lock_fp)) {
- return $this->raiseError("could not create lock file" .
- (isset($php_errormsg) ? ": " . $php_errormsg : ""));
- }
- if (!(int)flock($this->lock_fp, $mode)) {
- switch ($mode) {
- case LOCK_SH: $str = 'shared'; break;
- case LOCK_EX: $str = 'exclusive'; break;
- case LOCK_UN: $str = 'unlock'; break;
- default: $str = 'unknown'; break;
- }
- return $this->raiseError("could not acquire $str lock ($this->lockfile)",
- PEAR_REGISTRY_ERROR_LOCK);
- }
- }
- return true;
- }
-
- // }}}
- // {{{ _unlock()
-
- function _unlock()
- {
- $ret = $this->_lock(LOCK_UN);
- $this->lock_fp = null;
- return $ret;
- }
-
- // }}}
- // {{{ _packageExists()
-
- function _packageExists($package)
- {
- return file_exists($this->_packageFileName($package));
- }
-
- // }}}
- // {{{ _packageInfo()
-
- function _packageInfo($package = null, $key = null)
- {
- if ($package === null) {
- return array_map(array($this, '_packageInfo'),
- $this->_listPackages());
- }
- $fp = $this->_openPackageFile($package, 'r');
- if ($fp === null) {
- return null;
- }
- $data = fread($fp, filesize($this->_packageFileName($package)));
- $this->_closePackageFile($fp);
- $data = unserialize($data);
- if ($key === null) {
- return $data;
- }
- if (isset($data[$key])) {
- return $data[$key];
- }
- return null;
- }
-
- // }}}
- // {{{ _listPackages()
-
- function _listPackages()
- {
- $pkglist = array();
- $dp = @opendir($this->statedir);
- if (!$dp) {
- return $pkglist;
- }
- while ($ent = readdir($dp)) {
- if ($ent{0} == '.' || substr($ent, -4) != '.reg') {
- continue;
- }
- $pkglist[] = substr($ent, 0, -4);
- }
- return $pkglist;
- }
-
- // }}}
-
- // {{{ packageExists()
-
- function packageExists($package)
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $ret = $this->_packageExists($package);
- $this->_unlock();
- return $ret;
- }
-
- // }}}
- // {{{ packageInfo()
-
- function packageInfo($package = null, $key = null)
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $ret = $this->_packageInfo($package, $key);
- $this->_unlock();
- return $ret;
- }
-
- // }}}
- // {{{ listPackages()
-
- function listPackages()
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $ret = $this->_listPackages();
- $this->_unlock();
- return $ret;
- }
-
- // }}}
- // {{{ addPackage()
-
- function addPackage($package, $info)
- {
- if ($this->packageExists($package)) {
- return false;
- }
- if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
- return $e;
- }
- $fp = $this->_openPackageFile($package, 'w');
- if ($fp === null) {
- $this->_unlock();
- return false;
- }
- $info['_lastmodified'] = time();
- fwrite($fp, serialize($info));
- $this->_closePackageFile($fp);
- $this->_unlock();
- return true;
- }
-
- // }}}
- // {{{ deletePackage()
-
- function deletePackage($package)
- {
- if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
- return $e;
- }
- $file = $this->_packageFileName($package);
- $ret = @unlink($file);
- $this->rebuildFileMap();
- $this->_unlock();
- return $ret;
- }
-
- // }}}
- // {{{ updatePackage()
-
- function updatePackage($package, $info, $merge = true)
- {
- $oldinfo = $this->packageInfo($package);
- if (empty($oldinfo)) {
- return false;
- }
- if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
- return $e;
- }
- $fp = $this->_openPackageFile($package, 'w');
- if ($fp === null) {
- $this->_unlock();
- return false;
- }
- $info['_lastmodified'] = time();
- if ($merge) {
- fwrite($fp, serialize(array_merge($oldinfo, $info)));
- } else {
- fwrite($fp, serialize($info));
- }
- $this->_closePackageFile($fp);
- if (isset($info['filelist'])) {
- $this->rebuildFileMap();
- }
- $this->_unlock();
- return true;
- }
-
- // }}}
- // {{{ checkFileMap()
-
- /**
- * Test whether a file belongs to a package.
- *
- * @param string $path file path, absolute or relative to the pear
- * install dir
- *
- * @return string which package the file belongs to, or an empty
- * string if the file does not belong to an installed package
- *
- * @access public
- */
- function checkFileMap($path)
- {
- if (is_array($path)) {
- static $notempty;
- if (empty($notempty)) {
- $notempty = create_function('$a','return !empty($a);');
- }
- $pkgs = array();
- foreach ($path as $name => $attrs) {
- if (is_array($attrs) && isset($attrs['baseinstalldir'])) {
- $name = $attrs['baseinstalldir'].DIRECTORY_SEPARATOR.$name;
- }
- $pkgs[$name] = $this->checkFileMap($name);
- }
- return array_filter($pkgs, $notempty);
- }
- if (empty($this->filemap_cache) && PEAR::isError($this->readFileMap())) {
- return $err;
- }
- if (isset($this->filemap_cache[$path])) {
- return $this->filemap_cache[$path];
- }
- $l = strlen($this->install_dir);
- if (substr($path, 0, $l) == $this->install_dir) {
- $path = preg_replace('!^'.DIRECTORY_SEPARATOR.'+!', '', substr($path, $l));
- }
- if (isset($this->filemap_cache[$path])) {
- return $this->filemap_cache[$path];
- }
- return '';
- }
-
- // }}}
-
- // {{{ rebuildDepsFile()
-
- /**
- Experimental dependencies database handling functions (not yet in production)
-
- TODO:
- - test it
- - Think on the "not" dep relation. It's supposed that a package can't
- be installed if conflicts with another. The problem comes when the
- user forces the installation and later upgrades it
- **/
-
- // XXX Terrible slow, a lot of read, lock, write, unlock
- function rebuildDepsFile()
- {
- // Init the file with empty data
- $error = $this->_depWriteDepDB(array());
- if (PEAR::isError($error)) {
- return $error;
- }
- $packages = $this->listPackages();
- foreach ($packages as $package) {
- $deps = $this->packageInfo($package, 'release_deps');
- $error = $this->setPackageDep($package, $deps);
- if (PEAR::isError($error)) {
- return $error;
- }
- }
- return true;
- }
-
- function &_depGetDepDB()
- {
- if (!$fp = fopen($this->depfile, 'r')) {
- return $this->raiseError("Could not open dependencies file `".$this->depfile."'");
- }
- $data = fread($fp, filesize($this->depfile));
- fclose($fp);
- return unserialize($data);
- }
-
- function _depWriteDepDB(&$deps)
- {
- if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
- return $e;
- }
- if (!$fp = fopen($this->depfile, 'w')) {
- $this->_unlock();
- return $this->raiseError("Could not open dependencies file `".$this->depfile."' for writting");
- }
- fwrite($fp, serialize($deps));
- fclose($fp);
- $this->_unlock();
- return true;
- }
-
- /*
- The data structure is as follows:
- $dep_db = array(
- // Other packages depends in some manner on this packages
- 'deps' => array(
- 'Package Name' => array(
- 0 => array(
- // This package depends on 'Package Name'
- 'depend' => 'Package',
- // Which version 'Package' needs of 'Package Name'
- 'version' => '1.0',
- // The requirement (version_compare() operator)
- 'rel' => 'ge'
- ),
- ),
- )
- // This packages are dependant on other packages
- 'pkgs' => array(
- 'Package Dependant' => array(
- // This is a index list with paths over the 'deps' array for quick
- // searching things like "what dependecies has this package?"
- // $dep_db['deps']['Package Name'][3]
- 'Package Name' => 3 // key in array ['deps']['Package Name']
- ),
- )
- )
-
- Note: It only supports package dependencies no other type
- */
-
- function removePackageDep($package)
- {
- $data = &$this->_depGetDepDB();
- if (PEAR::isError($data)) {
- return $data;
- }
- // Other packages depends on this package, can't be removed
- if (isset($data['deps'][$package])) {
- return $data['deps'][$package];
- }
- // The package depends on others, remove those dependencies
- if (isset($data['pkgs'][$package])) {
- foreach ($data['pkgs'][$package] as $pkg => $key) {
- // remove the dependency
- unset($data['deps'][$pkg][$key]);
- // if no more dependencies, remove the subject too
- if (!count($data['deps'][$pkg])) {
- unset($data['deps'][$pkg]);
- }
- }
- // remove the package from the index list
- unset($data['pkgs'][$package]);
- }
- return $this->_depWriteDepDB();
- }
-
- /**
- * Update or insert a the dependencies of a package, prechecking
- * that the package won't break any dependency in the process
- */
- function setPackageDep($package, $new_version, $rel_deps = array())
- {
- $data = &$this->_depGetDepDB();
- if (PEAR::isError($deps)) {
- return $deps;
- }
- // Other packages depend on this package, check deps. Mostly for
- // handling uncommon cases like:
- // <dep type='pkg' rel='lt' version='1.0'>Foo</dep> and we are trying to
- // update Foo to version 2.0
- if (isset($data['deps'][$package])) {
- foreach ($data['deps'][$package] as $dep) {
- $require = $dep['version'];
- $relation = $dep['rel'];
- // XXX (cox) Possible problem with changes in the way
- // PEAR_Dependency::checkPackage() works
- if ($relation != 'has') {
- if (!version_compare("$new_version", "$require", $relation)) {
- $fails[] = $dep;
- }
- }
- }
- if (isset($fails)) {
- return $fails;
- }
- }
-
- // This package has no dependencies
- if (!is_array($rel_deps) || !count($rel_deps)) {
- return true;
- }
-
- // The package depends on others, register that
- foreach ($rel_deps as $dep) {
- // We only support deps of type 'pkg's
- if ($dep && $dep['type'] == 'pkg' && isset($dep['name'])) {
- $write = array('depend' => $package,
- 'version' => $dep['version'],
- 'rel' => $dep['rel']);
- settype($data['deps'][$dep['name']], 'array');
-
- // The dependency already exists, update it
- if (isset($data['pkgs'][$package][$dep['name']])) {
- $key = $data['pkgs'][$package][$dep['name']];
- $data['deps'][$dep['name']][$key] = $write;
-
- // New dependency, insert it
- } else {
- $data['deps'][$dep['name']][] = $write;
- $key = key($data['deps'][$dep['name']]);
- settype($data['pkgs'][$package], 'array');
- $data['pkgs'][$package][$dep['name']] = $key;
- }
- }
- }
- return $this->_depWriteDepDB($data);
- }
-
- // }}}
-}
-
-?>
diff --git a/pear/PEAR/Remote.php b/pear/PEAR/Remote.php
deleted file mode 100644
index 6b90b0c7da..0000000000
--- a/pear/PEAR/Remote.php
+++ /dev/null
@@ -1,367 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Stig Bakken <ssb@php.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR.php';
-require_once 'PEAR/Config.php';
-
-/**
- * This is a class for doing remote operations against the central
- * PEAR database.
- *
- * @nodep XML_RPC_Value
- * @nodep XML_RPC_Message
- * @nodep XML_RPC_Client
- */
-class PEAR_Remote extends PEAR
-{
- // {{{ properties
-
- var $config = null;
- var $cache = null;
-
- // }}}
-
- // {{{ PEAR_Remote(config_object)
-
- function PEAR_Remote(&$config)
- {
- $this->PEAR();
- $this->config = &$config;
- }
-
- // }}}
-
- // {{{ getCache()
-
-
- function getCache($args)
- {
- $id = md5(serialize($args));
- $cachedir = $this->config->get('cache_dir');
- if (!file_exists($cachedir)) {
- System::mkdir('-p '.$cachedir);
- }
- $filename = $cachedir . DIRECTORY_SEPARATOR . 'xmlrpc_cache_' . $id;
- if (!file_exists($filename)) {
- return null;
- };
-
- $fp = fopen($filename, "rb");
- if ($fp === null) {
- return null;
- }
- $content = fread($fp, filesize($filename));
- fclose($fp);
- $result = array(
- 'age' => time() - filemtime($filename),
- 'lastChange' => filemtime($filename),
- 'content' => unserialize($content),
- );
- return $result;
- }
-
- // }}}
-
- // {{{ saveCache()
-
- function saveCache($args, $data)
- {
- $id = md5(serialize($args));
- $cachedir = $this->config->get('cache_dir');
- if (!file_exists($cachedir)) {
- System::mkdir('-p '.$cachedir);
- }
- $filename = $cachedir.'/xmlrpc_cache_'.$id;
-
- $fp = @fopen($filename, "wb");
- if ($fp !== null) {
- fwrite($fp, serialize($data));
- fclose($fp);
- };
- }
-
- // }}}
-
- // {{{ call(method, [args...])
-
- function call($method)
- {
- $_args = $args = func_get_args();
-
- $this->cache = $this->getCache($args);
- $cachettl = $this->config->get('cache_ttl');
- // If cache is newer than $cachettl seconds, we use the cache!
- if ($this->cache !== null && $this->cache['age'] < $cachettl) {
- return $this->cache['content'];
- };
-
- if (extension_loaded("xmlrpc")) {
- $result = call_user_func_array(array(&$this, 'call_epi'), $args);
- if (!PEAR::isError($result)) {
- $this->saveCache($_args, $result);
- };
- return $result;
- }
- if (!@include_once("XML/RPC.php")) {
- return $this->raiseError("For this remote PEAR operation you need to install the XML_RPC package");
- }
- array_shift($args);
- $server_host = $this->config->get('master_server');
- $username = $this->config->get('username');
- $password = $this->config->get('password');
- $eargs = array();
- foreach($args as $arg) $eargs[] = $this->_encode($arg);
- $f = new XML_RPC_Message($method, $eargs);
- if ($this->cache !== null) {
- $maxAge = '?maxAge='.$this->cache['lastChange'];
- } else {
- $maxAge = '';
- };
- $proxy_host = $proxy_port = $proxy_user = $proxy_pass = '';
- if ($proxy = parse_url($this->config->get('http_proxy'))) {
- $proxy_host = @$proxy['host'];
- $proxy_port = @$proxy['port'];
- $proxy_user = @$proxy['user'];
- $proxy_pass = @$proxy['pass'];
- }
- $c = new XML_RPC_Client('/xmlrpc.php'.$maxAge, $server_host, 80, $proxy_host, $proxy_port, $proxy_user, $proxy_pass);
- if ($username && $password) {
- $c->setCredentials($username, $password);
- }
- if ($this->config->get('verbose') >= 3) {
- $c->setDebug(1);
- }
- $r = $c->send($f);
- if (!$r) {
- return $this->raiseError("XML_RPC send failed");
- }
- $v = $r->value();
- if ($e = $r->faultCode()) {
- if ($e == $GLOBALS['XML_RPC_err']['http_error'] && strstr($r->faultString(), '304 Not Modified') !== false) {
- return $this->cache['content'];
- }
- return $this->raiseError($r->faultString(), $e);
- }
-
- $result = XML_RPC_decode($v);
- $this->saveCache($_args, $result);
- return $result;
- }
-
- // }}}
-
- // {{{ call_epi(method, [args...])
-
- function call_epi($method)
- {
- do {
- if (extension_loaded("xmlrpc")) {
- break;
- }
- if (OS_WINDOWS) {
- $ext = 'dll';
- } elseif (PHP_OS == 'HP-UX') {
- $ext = 'sl';
- } elseif (PHP_OS == 'AIX') {
- $ext = 'a';
- } else {
- $ext = 'so';
- }
- $ext = OS_WINDOWS ? 'dll' : 'so';
- @dl("xmlrpc-epi.$ext");
- if (extension_loaded("xmlrpc")) {
- break;
- }
- @dl("xmlrpc.$ext");
- if (extension_loaded("xmlrpc")) {
- break;
- }
- return $this->raiseError("unable to load xmlrpc extension");
- } while (false);
- $params = func_get_args();
- array_shift($params);
- $method = str_replace("_", ".", $method);
- $request = xmlrpc_encode_request($method, $params);
- $server_host = $this->config->get("master_server");
- if (empty($server_host)) {
- return $this->raiseError("PEAR_Remote::call: no master_server configured");
- }
- $server_port = 80;
- $fp = @fsockopen($server_host, $server_port);
- if (!$fp) {
- return $this->raiseError("PEAR_Remote::call: fsockopen(`$server_host', $server_port) failed");
- }
- $len = strlen($request);
- $req_headers = "Host: $server_host:$server_port\r\n" .
- "Content-type: text/xml\r\n" .
- "Content-length: $len\r\n";
- $username = $this->config->get('username');
- $password = $this->config->get('password');
- if ($username && $password) {
- $req_headers .= "Cookie: PEAR_USER=$username; PEAR_PW=$password\r\n";
- $tmp = base64_encode("$username:$password");
- $req_headers .= "Authorization: Basic $tmp\r\n";
- }
- if ($this->cache !== null) {
- $maxAge = '?maxAge='.$this->cache['lastChange'];
- } else {
- $maxAge = '';
- };
-
- if ($this->config->get('verbose') > 3) {
- print "XMLRPC REQUEST HEADERS:\n";
- var_dump($req_headers);
- print "XMLRPC REQUEST BODY:\n";
- var_dump($request);
- }
-
- fwrite($fp, ("POST /xmlrpc.php$maxAge HTTP/1.0\r\n$req_headers\r\n$request"));
- $response = '';
- $line1 = fgets($fp, 2048);
- if (!preg_match('!^HTTP/[0-9\.]+ (\d+) (.*)!', $line1, $matches)) {
- return $this->raiseError("PEAR_Remote: invalid HTTP response from XML-RPC server");
- }
- switch ($matches[1]) {
- case "200": // OK
- break;
- case "304": // Not Modified
- return $this->cache['content'];
- case "401": // Unauthorized
- if ($username && $password) {
- return $this->raiseError("PEAR_Remote: authorization failed", 401);
- } else {
- return $this->raiseError("PEAR_Remote: authorization required, please log in first", 401);
- }
- default:
- return $this->raiseError("PEAR_Remote: unexpected HTTP response", (int)$matches[1], null, null, "$matches[1] $matches[2]");
- }
- while (trim(fgets($fp, 2048)) != ''); // skip rest of headers
- while ($chunk = fread($fp, 10240)) {
- $response .= $chunk;
- }
- fclose($fp);
- if ($this->config->get('verbose') > 3) {
- print "XMLRPC RESPONSE:\n";
- var_dump($response);
- }
- $ret = xmlrpc_decode($response);
- if (is_array($ret) && isset($ret['__PEAR_TYPE__'])) {
- if ($ret['__PEAR_TYPE__'] == 'error') {
- if (isset($ret['__PEAR_CLASS__'])) {
- $class = $ret['__PEAR_CLASS__'];
- } else {
- $class = "PEAR_Error";
- }
- if ($ret['code'] === '') $ret['code'] = null;
- if ($ret['message'] === '') $ret['message'] = null;
- if ($ret['userinfo'] === '') $ret['userinfo'] = null;
- if (strtolower($class) == 'db_error') {
- $ret = $this->raiseError(PEAR::errorMessage($ret['code']),
- $ret['code'], null, null,
- $ret['userinfo']);
- } else {
- $ret = $this->raiseError($ret['message'], $ret['code'],
- null, null, $ret['userinfo']);
- }
- }
- } elseif (is_array($ret) && sizeof($ret) == 1 && is_array($ret[0]) &&
- !empty($ret[0]['faultString']) &&
- !empty($ret[0]['faultCode'])) {
- extract($ret[0]);
- $faultString = "XML-RPC Server Fault: " .
- str_replace("\n", " ", $faultString);
- return $this->raiseError($faultString, $faultCode);
- }
- return $ret;
- }
-
- // }}}
-
- // {{{ _encode
-
- // a slightly extended version of XML_RPC_encode
- function _encode($php_val)
- {
- global $XML_RPC_Boolean, $XML_RPC_Int, $XML_RPC_Double;
- global $XML_RPC_String, $XML_RPC_Array, $XML_RPC_Struct;
-
- $type = gettype($php_val);
- $xmlrpcval = new XML_RPC_Value;
-
- switch($type) {
- case "array":
- reset($php_val);
- $firstkey = key($php_val);
- end($php_val);
- $lastkey = key($php_val);
- if ($firstkey === 0 && is_int($lastkey) &&
- ($lastkey + 1) == count($php_val)) {
- $is_continuous = true;
- reset($php_val);
- $size = count($php_val);
- for ($expect = 0; $expect < $size; $expect++, next($php_val)) {
- if (key($php_val) !== $expect) {
- $is_continuous = false;
- break;
- }
- }
- if ($is_continuous) {
- reset($php_val);
- $arr = array();
- while (list($k, $v) = each($php_val)) {
- $arr[$k] = $this->_encode($v);
- }
- $xmlrpcval->addArray($arr);
- break;
- }
- }
- // fall though if not numerical and continuous
- case "object":
- $arr = array();
- while (list($k, $v) = each($php_val)) {
- $arr[$k] = $this->_encode($v);
- }
- $xmlrpcval->addStruct($arr);
- break;
- case "integer":
- $xmlrpcval->addScalar($php_val, $XML_RPC_Int);
- break;
- case "double":
- $xmlrpcval->addScalar($php_val, $XML_RPC_Double);
- break;
- case "string":
- case "NULL":
- $xmlrpcval->addScalar($php_val, $XML_RPC_String);
- break;
- case "boolean":
- $xmlrpcval->addScalar($php_val, $XML_RPC_Boolean);
- break;
- case "unknown type":
- default:
- return null;
- }
- return $xmlrpcval;
- }
-
- // }}}
-
-}
-
-?>
diff --git a/pear/README b/pear/README
deleted file mode 100644
index c953c26b13..0000000000
--- a/pear/README
+++ /dev/null
@@ -1,18 +0,0 @@
- PEAR - PHP Extension and Application Repository
- ===============================================
- Dedicated to Malin Bakken, born 1999-11-21
-
-WHAT IS PEAR?
-
-PEAR is a code repository for PHP extensions and PHP library code
-similar to TeX's CTAN and Perl's CPAN.
-
-The intention behind PEAR is to provide a means for library code
-authors to organize their code in a defined way shared by other
-developers, and to give the PHP community a single source for such
-code.
-
-
-DOCUMENTATION
-
-Documentation for PEAR can be found at http://pear.php.net/manual/.
diff --git a/pear/System.php b/pear/System.php
deleted file mode 100644
index 1265da629c..0000000000
--- a/pear/System.php
+++ /dev/null
@@ -1,449 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.0 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Tomas V.V.Cox <cox@idecnet.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'PEAR.php';
-require_once 'Console/Getopt.php';
-
-$GLOBALS['_System_temp_files'] = array();
-
-/**
-* System offers cross plattform compatible system functions
-*
-* Static functions for different operations. Should work under
-* Unix and Windows. The names and usage has been taken from its respectively
-* GNU commands. The functions will return (bool) false on error and will
-* trigger the error with the PHP trigger_error() function (you can silence
-* the error by prefixing a '@' sign after the function call).
-*
-* Documentation on this class you can find in:
-* http://pear.php.net/manual/
-*
-* Example usage:
-* if (!@System::rm('-r file1 dir1')) {
-* print "could not delete file1 or dir1";
-* }
-*
-* @package System
-* @author Tomas V.V.Cox <cox@idecnet.com>
-* @version $Revision$
-* @access public
-* @see http://pear.php.net/manual/
-*/
-class System
-{
- /**
- * returns the commandline arguments of a function
- *
- * @param string $argv the commandline
- * @param string $short_options the allowed option short-tags
- * @param string $long_options the allowed option long-tags
- * @return array the given options and there values
- * @access private
- */
- function _parseArgs($argv, $short_options, $long_options = null)
- {
- if (!is_array($argv) && $argv !== null) {
- $argv = preg_split('/\s+/', ': '.$argv);
- }
- return Console_Getopt::getopt($argv, $short_options);
- }
-
- /**
- * Output errors with PHP trigger_error(). You can silence the errors
- * with prefixing a "@" sign to the function call: @System::mkdir(..);
- *
- * @param mixed $error a PEAR error or a string with the error message
- * @return bool false
- * @access private
- */
- function raiseError($error)
- {
- if (PEAR::isError($error)) {
- $error = $error->getMessage();
- }
- trigger_error($error, E_USER_WARNING);
- return false;
- }
-
- /**
- * Creates a nested array representing the structure of a directory
- *
- * System::_dirToStruct('dir1', 0) =>
- * Array
- * (
- * [dirs] => Array
- * (
- * [0] => dir1
- * )
- *
- * [files] => Array
- * (
- * [0] => dir1/file2
- * [1] => dir1/file3
- * )
- * )
- * @param string $sPath Name of the directory
- * @param integer $maxinst max. deep of the lookup
- * @param integer $aktinst starting deep of the lookup
- * @return array the structure of the dir
- * @access private
- */
-
- function _dirToStruct($sPath, $maxinst, $aktinst = 0)
- {
- $struct = array('dirs' => array(), 'files' => array());
- if (($dir = @opendir($sPath)) === false) {
- System::raiseError("Could not open dir $sPath");
- return $struct; // XXX could not open error
- }
- $struct['dirs'][] = $sPath; // XXX don't add if '.' or '..' ?
- $list = array();
- while ($file = readdir($dir)) {
- if ($file != '.' && $file != '..') {
- $list[] = $file;
- }
- }
- closedir($dir);
- sort($list);
- foreach($list as $val) {
- $path = $sPath . DIRECTORY_SEPARATOR . $val;
- if (is_dir($path)) {
- if ($aktinst < $maxinst || $maxinst == 0) {
- $tmp = System::_dirToStruct($path, $maxinst, $aktinst+1);
- $struct = array_merge_recursive($tmp, $struct);
- }
- } else {
- $struct['files'][] = $path;
- }
- }
- return $struct;
- }
-
- /**
- * Creates a nested array representing the structure of a directory and files
- *
- * @param array $files Array listing files and dirs
- * @return array
- * @see System::_dirToStruct()
- */
- function _multipleToStruct($files)
- {
- $struct = array('dirs' => array(), 'files' => array());
- settype($files, 'array');
- foreach ($files as $file) {
- if (is_dir($file)) {
- $tmp = System::_dirToStruct($file, 0);
- $struct = array_merge_recursive($tmp, $struct);
- } else {
- $struct['files'][] = $file;
- }
- }
- return $struct;
- }
-
- /**
- * The rm command for removing files.
- * Supports multiple files and dirs and also recursive deletes
- *
- * @param string $args the arguments for rm
- * @return mixed PEAR_Error or true for success
- * @access public
- */
- function rm($args)
- {
- $opts = System::_parseArgs($args, 'rf'); // "f" do nothing but like it :-)
- if (PEAR::isError($opts)) {
- return System::raiseError($opts);
- }
- foreach($opts[0] as $opt) {
- if ($opt[0] == 'r') {
- $do_recursive = true;
- }
- }
- $ret = true;
- if (isset($do_recursive)) {
- $struct = System::_multipleToStruct($opts[1]);
- foreach($struct['files'] as $file) {
- if (!@unlink($file)) {
- $ret = false;
- }
- }
- foreach($struct['dirs'] as $dir) {
- if (!@rmdir($dir)) {
- $ret = false;
- }
- }
- } else {
- foreach ($opts[1] as $file) {
- $delete = (is_dir($file)) ? 'rmdir' : 'unlink';
- if (!@$delete($file)) {
- $ret = false;
- }
- }
- }
- return $ret;
- }
-
- /**
- * Make directories. Note that we use call_user_func('mkdir') to avoid
- * a problem with ZE2 calling System::mkDir instead of the native PHP func.
- *
- * @param string $args the name of the director(y|ies) to create
- * @return bool True for success
- * @access public
- */
- function mkDir($args)
- {
- $opts = System::_parseArgs($args, 'pm:');
- if (PEAR::isError($opts)) {
- return System::raiseError($opts);
- }
- $mode = 0777; // default mode
- foreach($opts[0] as $opt) {
- if ($opt[0] == 'p') {
- $create_parents = true;
- } elseif($opt[0] == 'm') {
- $mode = $opt[1];
- }
- }
- $ret = true;
- if (isset($create_parents)) {
- foreach($opts[1] as $dir) {
- $dirstack = array();
- while (!@is_dir($dir) && $dir != DIRECTORY_SEPARATOR) {
- array_unshift($dirstack, $dir);
- $dir = dirname($dir);
- }
- while ($newdir = array_shift($dirstack)) {
- if (!call_user_func('mkdir', $newdir, $mode)) {
- $ret = false;
- }
- }
- }
- } else {
- foreach($opts[1] as $dir) {
- if (!@is_dir($dir) && !call_user_func('mkdir', $dir, $mode)) {
- $ret = false;
- }
- }
- }
- return $ret;
- }
-
- /**
- * Concatenate files
- *
- * Usage:
- * 1) $var = System::cat('sample.txt test.txt');
- * 2) System::cat('sample.txt test.txt > final.txt');
- * 3) System::cat('sample.txt test.txt >> final.txt');
- *
- * Note: as the class use fopen, urls should work also (test that)
- *
- * @param string $args the arguments
- * @return boolean true on success
- * @access public
- */
- function &cat($args)
- {
- $ret = null;
- $files = array();
- if (!is_array($args)) {
- $args = preg_split('/\s+/', $args);
- }
- for($i=0; $i < count($args); $i++) {
- if ($args[$i] == '>') {
- $mode = 'wb';
- $outputfile = $args[$i+1];
- break;
- } elseif ($args[$i] == '>>') {
- $mode = 'ab+';
- $outputfile = $args[$i+1];
- break;
- } else {
- $files[] = $args[$i];
- }
- }
- if (isset($mode)) {
- if (!$outputfd = fopen($outputfile, $mode)) {
- return System::raiseError("Could not open $outputfile");
- }
- $ret = true;
- }
- foreach ($files as $file) {
- if (!$fd = fopen($file, 'r')) {
- System::raiseError("Could not open $file");
- continue;
- }
- while ($cont = fread($fd, 2048)) {
- if (isset($outputfd)) {
- fwrite($outputfd, $cont);
- } else {
- $ret .= $cont;
- }
- }
- fclose($fd);
- }
- if (@is_resource($outputfd)) {
- fclose($outputfd);
- }
- return $ret;
- }
-
- /**
- * Creates temporary files or directories. This function will remove
- * the created files when the scripts finish its execution.
- *
- * Usage:
- * 1) $tempfile = System::mktemp("prefix");
- * 2) $tempdir = System::mktemp("-d prefix");
- * 3) $tempfile = System::mktemp();
- * 4) $tempfile = System::mktemp("-t /var/tmp prefix");
- *
- * prefix -> The string that will be prepended to the temp name
- * (defaults to "tmp").
- * -d -> A temporary dir will be created instead of a file.
- * -t -> The target dir where the temporary (file|dir) will be created. If
- * this param is missing by default the env vars TMP on Windows or
- * TMPDIR in Unix will be used. If these vars are also missing
- * c:\windows\temp or /tmp will be used.
- *
- * @param string $args The arguments
- * @return mixed the full path of the created (file|dir) or false
- * @see System::tmpdir()
- * @access public
- */
- function mktemp($args = null)
- {
- static $first_time = true;
- $opts = System::_parseArgs($args, 't:d');
- if (PEAR::isError($opts)) {
- return System::raiseError($opts);
- }
- foreach($opts[0] as $opt) {
- if($opt[0] == 'd') {
- $tmp_is_dir = true;
- } elseif($opt[0] == 't') {
- $tmpdir = $opt[1];
- }
- }
- $prefix = (isset($opts[1][0])) ? $opts[1][0] : 'tmp';
- if (!isset($tmpdir)) {
- $tmpdir = System::tmpdir();
- }
- if (!System::mkDir("-p $tmpdir")) {
- return false;
- }
- $tmp = tempnam($tmpdir, $prefix);
- if (isset($tmp_is_dir)) {
- unlink($tmp); // be careful possible race condition here
- if (!call_user_func('mkdir', $tmp, 0700)) {
- return System::raiseError("Unable to create temporary directory $tmpdir");
- }
- }
- $GLOBALS['_System_temp_files'][] = $tmp;
- if ($first_time) {
- PEAR::registerShutdownFunc(array('System', '_removeTmpFiles'));
- $first_time = false;
- }
- return $tmp;
- }
-
- /**
- * Remove temporary files created my mkTemp. This function is executed
- * at script shutdown time
- *
- * @access private
- */
- function _removeTmpFiles()
- {
- if (count($GLOBALS['_System_temp_files'])) {
- $delete = $GLOBALS['_System_temp_files'];
- array_unshift($delete, '-r');
- System::rm($delete);
- }
- }
-
- /**
- * Get the path of the temporal directory set in the system
- * by looking in its environments variables.
- * Note: php.ini-recommended removes the "E" from the variables_order setting,
- * making unavaible the $_ENV array, that s why we do tests with _ENV
- *
- * @return string The temporal directory on the system
- */
- function tmpdir()
- {
- if (OS_WINDOWS) {
- if ($var = isset($_ENV['TEMP']) ? $_ENV['TEMP'] : getenv('TEMP')) {
- return $var;
- }
- if ($var = isset($_ENV['TMP']) ? $_ENV['TMP'] : getenv('TMP')) {
- return $var;
- }
- if ($var = isset($_ENV['windir']) ? $_ENV['windir'] : getenv('windir')) {
- return $var;
- }
- return getenv('SystemRoot') . '\temp';
- }
- if ($var = isset($_ENV['TMPDIR']) ? $_ENV['TMPDIR'] : getenv('TMPDIR')) {
- return $var;
- }
- return '/tmp';
- }
-
- /**
- * The "which" command (show the full path of a command)
- *
- * @param string $program The command to search for
- * @return mixed A string with the full path or false if not found
- * @author Stig Bakken <ssb@php.net>
- */
- function which($program, $fallback = false)
- {
- // is_executable() is not available on windows
- if (OS_WINDOWS) {
- $pear_is_executable = 'is_file';
- } else {
- $pear_is_executable = 'is_executable';
- }
-
- // full path given
- if (basename($program) != $program) {
- return (@$pear_is_executable($program)) ? $program : $fallback;
- }
-
- // XXX FIXME honor safe mode
- $path_delim = OS_WINDOWS ? ';' : ':';
- $exe_suffixes = OS_WINDOWS ? array('.exe','.bat','.cmd','.com') : array('');
- $path_elements = explode($path_delim, getenv('PATH'));
- foreach ($exe_suffixes as $suff) {
- foreach ($path_elements as $dir) {
- $file = $dir . DIRECTORY_SEPARATOR . $program . $suff;
- if (@is_file($file) && @$pear_is_executable($file)) {
- return $file;
- }
- }
- }
- return $fallback;
- }
-}
-?>
diff --git a/pear/catalog b/pear/catalog
deleted file mode 100644
index 6e0c69d40b..0000000000
--- a/pear/catalog
+++ /dev/null
@@ -1 +0,0 @@
-PUBLIC "-//PHP Group//DTD PEAR Package 1.0//EN//XML" "package.dtd"
diff --git a/pear/docs/Archive_Tar.txt b/pear/docs/Archive_Tar.txt
deleted file mode 100644
index 73bee0d786..0000000000
--- a/pear/docs/Archive_Tar.txt
+++ /dev/null
@@ -1,424 +0,0 @@
-Documentation for class Archive_Tar
-===================================
-Last update : 2001-08-15
-
-
-
-Overview :
-----------
-
- The Archive_Tar class helps in creating and managing GNU TAR format
- files compressed by GNU ZIP or not.
- The class offers basic functions like creating an archive, adding
- files in the archive, extracting files from the archive and listing
- the archive content.
- It also provide advanced functions that allow the adding and
- extraction of files with path manipulation.
-
-
-Sample :
---------
-
- // ----- Creating the object (uncompressed archive)
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT);
-
- // ----- Creating the archive
- $v_list[0]="file.txt";
- $v_list[1]="data/";
- $v_list[2]="file.log";
- $tar_object->create($v_list);
-
- // ----- Adding files
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/";
- $v_list[2]="log/file.log";
- $tar_object->add($v_list);
-
- // ----- Adding more files
- $tar_object->add("release/newfile.log release/readme.txt");
-
- // ----- Listing the content
- if (($v_list = $tar_object->listContent()) != 0)
- for ($i=0; $i<sizeof($v_list); $i++)
- {
- echo "Filename :'".$v_list[$i][filename]."'<br>";
- echo " .size :'".$v_list[$i][size]."'<br>";
- echo " .mtime :'".$v_list[$i][mtime]."' (".date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")<br>";
- echo " .mode :'".$v_list[$i][mode]."'<br>";
- echo " .uid :'".$v_list[$i][uid]."'<br>";
- echo " .gid :'".$v_list[$i][gid]."'<br>";
- echo " .typeflag :'".$v_list[$i][typeflag]."'<br>";
- }
-
- // ----- Extracting the archive in directory "install"
- $tar_object->extract("install");
-
-
-Public arguments :
-------------------
-
-None
-
-
-Public Methods :
-----------------
-
-Method : Archive_Tar($p_tarname, $compress = false)
-Description :
- Archive_Tar Class constructor. This flavour of the constructor only
- declare a new Archive_Tar object, identifying it by the name of the
- tar file.
- If the compress argument is set the tar will be read or created as a
- gzip compressed TAR file.
-Arguments :
- $p_tarname : A valid filename for the tar archive file.
- $p_compress : true/false. Indicate if the archive need to be
- compressed or not.
-Return value :
- The Archive_Tar object.
-Sample :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object_compressed = new Archive_Tar("tarname.tgz", true);
-How it works :
- Initialize the object.
-
-Method : create($p_filelist)
-Description :
- This method creates the archive file and add the files / directories
- that are listed in $p_filelist.
- If the file already exists and is writable, it is replaced by the
- new tar. It is a create and not an add. If the file exists and is
- read-only or is a directory it is not replaced. The method return
- false and a PEAR error text.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- See also createModify() method for more details.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $v_list[0]="file.txt";
- $v_list[1]="data/"; (Optional '/' at the end)
- $v_list[2]="file.log";
- $tar_object->create($v_list);
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $tar_object->create("file.txt data/ file.log");
-How it works :
- Just calling the createModify() method with the right parameters.
-
-Method : createModify($p_filelist, $p_add_dir, $p_remove_dir = "")
-Description :
- This method creates the archive file and add the files / directories
- that are listed in $p_filelist.
- If the file already exists and is writable, it is replaced by the
- new tar. It is a create and not an add. If the file exists and is
- read-only or is a directory it is not replaced. The method return
- false and a PEAR error text.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- The path indicated in $p_remove_dir will be removed from the
- memorized path of each file / directory listed when this path
- exists. By default nothing is removed (empty path "")
- The path indicated in $p_add_dir will be added at the beginning of
- the memorized path of each file / directory listed. However it can
- be set to empty "". The adding of a path is done after the removing
- of path.
- The path add/remove ability enables the user to prepare an archive
- for extraction in a different path than the origin files are.
- See also addModify() method for file adding properties.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
- $p_add_dir : A string which contains a path to be added to the
- memorized path of each element in the list.
- $p_remove_dir : A string which contains a path to be removed from
- the memorized path of each element in the list, when
- relevant.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $v_list[0]="file.txt";
- $v_list[1]="data/"; (Optional '/' at the end)
- $v_list[2]="file.log";
- $tar_object->createModify($v_list, "install");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/file.log
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->createModify($v_list, "install", "dev");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/log/file.log
-How it works :
- Open the file in write mode (erasing the existing one if one),
- call the _addList() method for adding the files in an empty archive,
- add the tar footer (512 bytes block), close the tar file.
-
-
-Method : addModify($p_filelist, $p_add_dir, $p_remove_dir="")
-Description :
- This method add the files / directories listed in $p_filelist at the
- end of the existing archive. If the archive does not yet exists it
- is created.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- The path indicated in $p_remove_dir will be removed from the
- memorized path of each file / directory listed when this path
- exists. By default nothing is removed (empty path "")
- The path indicated in $p_add_dir will be added at the beginning of
- the memorized path of each file / directory listed. However it can
- be set to empty "". The adding of a path is done after the removing
- of path.
- The path add/remove ability enables the user to prepare an archive
- for extraction in a different path than the origin files are.
- If a file/dir is already in the archive it will only be added at the
- end of the archive. There is no update of the existing archived
- file/dir. However while extracting the archive, the last file will
- replace the first one. This results in a none optimization of the
- archive size.
- If a file/dir does not exist the file/dir is ignored. However an
- error text is send to PEAR error.
- If a file/dir is not readable the file/dir is ignored. However an
- error text is send to PEAR error.
- If the resulting filename/dirname (after the add/remove option or
- not) string is greater than 99 char, the file/dir is
- ignored. However an error text is send to PEAR error.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
- $p_add_dir : A string which contains a path to be added to the
- memorized path of each element in the list.
- $p_remove_dir : A string which contains a path to be removed from
- the memorized path of each element in the list, when
- relevant.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->addModify($v_list, "install");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/file.log
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tar");
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->addModify($v_list, "install", "dev");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/log/file.log
-How it works :
- If the archive does not exists it create it and add the files.
- If the archive does exists and is not compressed, it open it, jump
- before the last empty 512 bytes block (tar footer) and add the files
- at this point.
- If the archive does exists and is compressed, a temporary copy file
- is created. This temporary file is then 'gzip' read block by block
- until the last empty block. The new files are then added in the
- compressed file.
- The adding of files is done by going through the file/dir list,
- adding files per files, in a recursive way through the
- directory. Each time a path need to be added/removed it is done
- before writing the file header in the archive.
-
-Method : add($p_filelist)
-Description :
- This method add the files / directories listed in $p_filelist at the
- end of the existing archive. If the archive does not yet exists it
- is created.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- See addModify() method for details and limitations.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->add($v_list);
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tgz", true);
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->add($v_list);
-How it works :
- Simply call the addModify() method with the right parameters.
-
-Method : extract($p_path = "")
-Description :
- This method extract all the content of the archive in the directory
- indicated by $p_path.If $p_path is optional, if not set the archive
- is extracted in the current directory.
- While extracting a file, if the directory path does not exists it is
- created.
- See extractModify() for details and limitations.
-Arguments :
- $p_path : Optional path where the files/dir need to by extracted.
-Return value :
- true on success, false on error.
-Sample :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->extract();
-How it works :
- Simply call the extractModify() method with appropriate parameters.
-
-Method : extractModify($p_path, $p_remove_path)
-Description :
- This method extract all the content of the archive in the directory
- indicated by $p_path. When relevant the memorized path of the
- files/dir can be modified by removing the $p_remove_path path at the
- beginning of the file/dir path.
- While extracting a file, if the directory path does not exists it is
- created.
- While extracting a file, if the file already exists it is replaced
- without looking for last modification date.
- While extracting a file, if the file already exists and is write
- protected, the extraction is aborted.
- While extracting a file, if a directory with the same name already
- exists, the extraction is aborted.
- While extracting a directory, if a file with the same name already
- exists, the extraction is aborted.
- While extracting a file/directory if the destination directory exist
- and is write protected, or does not exist but can not be created,
- the extraction is aborted.
- If after extraction an extracted file does not show the correct
- stored file size, the extraction is aborted.
- When the extraction is aborted, a PEAR error text is set and false
- is returned. However the result can be a partial extraction that may
- need to be manually cleaned.
-Arguments :
- $p_path : The path of the directory where the files/dir need to by
- extracted.
- $p_remove_path : Part of the memorized path that can be removed if
- present at the beginning of the file/dir path.
-Return value :
- true on success, false on error.
-Sample :
- // Imagine tarname.tar with files :
- // dev/data/file.txt
- // dev/data/log.txt
- // readme.txt
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->extractModify("install", "dev");
- // Files will be extracted there :
- // install/data/file.txt
- // install/data/log.txt
- // install/readme.txt
-How it works :
- Open the archive and call a more generic function that can extract
- only a part of the archive or all the archive.
- See extractList() method for more details.
-
-Method : listContent()
-Description :
- This method returns an array of arrays that describe each
- file/directory present in the archive.
- The array is not sorted, so it show the position of the file in the
- archive.
- The file informations are :
- $file[filename] : Name and path of the file/dir.
- $file[mode] : File permissions (result of fileperms())
- $file[uid] : user id
- $file[gid] : group id
- $file[size] : filesize
- $file[mtime] : Last modification time (result of filemtime())
- $file[typeflag] : "" for file, "5" for directory
-Arguments :
-Return value :
- An array of arrays or 0 on error.
-Sample :
- $tar_object = new Archive_Tar("tarname.tar");
- if (($v_list = $tar_object->listContent()) != 0)
- for ($i=0; $i<sizeof($v_list); $i++)
- {
- echo "Filename :'".$v_list[$i][filename]."'<br>";
- echo " .size :'".$v_list[$i][size]."'<br>";
- echo " .mtime :'".$v_list[$i][mtime]."' (".
- date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")<br>";
- echo " .mode :'".$v_list[$i][mode]."'<br>";
- echo " .uid :'".$v_list[$i][uid]."'<br>";
- echo " .gid :'".$v_list[$i][gid]."'<br>";
- echo " .typeflag :'".$v_list[$i][typeflag]."'<br>";
- }
-How it works :
- Call the same function as an extract however with a flag to only go
- through the archive without extracting the files.
-
-Method : extractList($p_filelist, $p_path = "", $p_remove_path = "")
-Description :
- This method extract from the archive only the files indicated in the
- $p_filelist. These files are extracted in the current directory or
- in the directory indicated by the optional $p_path parameter.
- If indicated the $p_remove_path can be used in the same way as it is
- used in extractModify() method.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
- $p_path : The path of the directory where the files/dir need to by
- extracted.
- $p_remove_path : Part of the memorized path that can be removed if
- present at the beginning of the file/dir path.
-Return value :
- true on success, false on error.
-Sample :
- // Imagine tarname.tar with files :
- // dev/data/file.txt
- // dev/data/log.txt
- // readme.txt
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->extractList("dev/data/file.txt readme.txt", "install",
- "dev");
- // Files will be extracted there :
- // install/data/file.txt
- // install/readme.txt
-How it works :
- Go through the archive and extract only the files present in the
- list.
-
diff --git a/pear/install-pear.php b/pear/install-pear.php
deleted file mode 100644
index c1a2d1341d..0000000000
--- a/pear/install-pear.php
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-
-/* $Id$ */
-
-$pear_dir = dirname(__FILE__);
-ini_set('include_path', $pear_dir);
-##//include_once 'PEAR/Config.php';
-include_once 'PEAR.php';
-include_once 'PEAR/Installer.php';
-include_once 'PEAR/Registry.php';
-include_once 'PEAR/Frontend/CLI.php';
-
-##//$config = &PEAR_Config::singleton();
-
-array_shift($argv);
-if ($argv[0] == '--force') {
- array_shift($argv);
- $force = true;
-} else {
- $force = false;
-}
-// package => install_file
-$install_files = array();
-
-/*
-$dp = opendir($pear_dir);
-while ($ent = readdir($dp)) {
- if (ereg('^package-(.*)\.xml$', $ent, $matches)) {
- $install_files[$matches[1]] = $ent;
- }
-}
-closedir($dp);
-*/
-foreach ($argv as $arg) {
- $bn = basename($arg);
- if (ereg('^package-(.*)\.xml$', $bn, $matches) ||
- ereg('^([A-Za-z0-9_:]+)-.*\.(tar|tgz)$', $bn, $matches)) {
- $install_files[$matches[1]] = $arg;
- }
-}
-
-$config = &PEAR_Config::singleton();
-
-// make sure we use only default values
-$config_layers = $config->getLayers();
-foreach ($config_layers as $layer) {
- if ($layer == 'default') continue;
- $config->removeLayer($layer);
-}
-$config->set('verbose', 0, 'default');
-
-$options = array();
-$install_root = getenv("INSTALL_ROOT");
-$php_dir = $config->get('php_dir');
-if (!empty($install_root)) {
- $options['installroot'] = $install_root;
- $reg_dir = $install_root . $php_dir;
-} else {
- $reg_dir = $php_dir;
-}
-
-$reg = &new PEAR_Registry($reg_dir);
-$ui = &new PEAR_Frontend_CLI();
-$installer = &new PEAR_Installer($ui);
-$installer->registry = &$reg;
-
-foreach ($install_files as $package => $instfile) {
- if ($reg->packageExists($package)) {
- $info = $installer->infoFromAny($instfile);
- if (PEAR::isError($info)) {
- $ui->outputData(sprintf("[PEAR] %s: %s", $package, $info->getMessage()));
- continue;
- }
- $new_ver = $info['version'];
- $old_ver = $reg->packageInfo($package, 'version');
- if (version_compare($new_ver, $old_ver, 'gt')) {
- $options['upgrade'] = true;
- $err = $installer->install($instfile, $options);
- if (PEAR::isError($err)) {
- $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
- continue;
- }
- $ui->outputData(sprintf("[PEAR] %-15s- upgraded: %s", $package, $new_ver));
- } else {
- if (@$argv[1] == '--force') {
- $options['force'] = true;
- $err = $installer->install($instfile, $options);
- if (PEAR::isError($err)) {
- $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
- continue;
- }
- $ui->outputData(sprintf("[PEAR] %-15s- installed: %s", $package, $new_ver));
- } else {
- $ui->outputData(sprintf("[PEAR] %-15s- already installed: %s", $package, $old_ver));
- }
- }
- } else {
- $options['nodeps'] = true;
- $err = $installer->install($instfile, $options);
- if (PEAR::isError($err)) {
- $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
- continue;
- }
- $new_ver = $reg->packageInfo($package, 'version');
- $ui->outputData(sprintf("[PEAR] %-15s- installed: %s", $package, $new_ver));
- }
-}
-
-?> \ No newline at end of file
diff --git a/pear/install-pear.txt b/pear/install-pear.txt
deleted file mode 100644
index ec632e8ade..0000000000
--- a/pear/install-pear.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-+----------------------------------------------------------------------+
-| The installation process is incomplete. The following resources were |
-| not installed: |
-| |
-| Self-contained Extension Support |
-| PEAR: PHP Extension and Application Repository |
-| |
-| To install these components, become the superuser and execute: |
-| |
-| # make install-su |
-+----------------------------------------------------------------------+
diff --git a/pear/package-Archive_Tar.xml b/pear/package-Archive_Tar.xml
deleted file mode 100644
index 64ee07b5c8..0000000000
--- a/pear/package-Archive_Tar.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE package SYSTEM "package.dtd">
-<package version="1.0">
- <name>Archive_Tar</name>
- <summary>Tar file management class</summary>
- <description>This class provides handling of tar files in PHP.
-It supports creating, listing, extracting and adding to tar files.
-Gzip support is available if PHP has the zlib extension built-in or
-loaded.
-</description>
- <license>PHP License</license>
- <maintainers>
- <maintainer>
- <user>vblavet</user>
- <role>lead</role>
- <name>Vincent Blavet</name>
- <email>vincent@blavet.net</email>
- </maintainer>
- <maintainer>
- <user>ssb</user>
- <role>helper</role>
- <name>Stig Sæther Bakken</name>
- <email>stig@php.net</email>
- </maintainer>
- </maintainers>
- <release>
- <version>0.9</version>
- <date>2002-05-27</date>
- <notes>
- * Auto-detect gzip'ed files
- </notes>
- <state>stable</state>
- <filelist>
- <dir name="Archive">
- <file role="php" name="Tar.php"/>
- </dir>
- <file role="doc" name="docs/Archive_Tar.txt" baseinstalldir="/"/>
- </filelist>
- </release>
- <changelog>
- <release>
- <version>0.4</version>
- <date>2002-05-20</date>
- <notes>Windows bugfix: use forward slashes inside archives</notes>
- <state>stable</state>
- </release>
- <release>
- <version>0.2</version>
- <date>2002-02-18</date>
- <notes>From initial commit to stable</notes>
- <state>stable</state>
- </release>
- <release>
- <version>0.3</version>
- <date>2002-04-13</date>
- <notes>Windows bugfix: used wrong directory separators</notes>
- <state>stable</state>
- </release>
- </changelog>
-</package>
diff --git a/pear/package-Console_Getopt.xml b/pear/package-Console_Getopt.xml
deleted file mode 100644
index 1bc3eb02da..0000000000
--- a/pear/package-Console_Getopt.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE package SYSTEM "package.dtd">
-<!-- do not use the "Type" attribute here, that one is only for
- generated package.xml files -->
-<package version="1.0">
- <name>Console_Getopt</name>
- <summary>Command-line option parser</summary>
- <description>This is a PHP implementation of "getopt" supporting both
-short and long options.</description>
- <license>PHP License</license>
- <maintainers>
- <maintainer>
- <user>andrei</user>
- <role>lead</role>
- <name>Andrei Zmievski</name>
- <email>andrei@php.net</email>
- </maintainer>
- <maintainer>
- <user>ssb</user>
- <role>developer</role>
- <name>Stig Bakken</name>
- <email>stig@php.net</email>
- </maintainer>
- </maintainers>
- <release>
- <version>1.0</version>
- <date>2002-09-13</date>
- <notes>Stable release</notes>
- <state>stable</state>
- <filelist>
- <dir name="Console">
- <file role="php" name="Getopt.php"/>
- </dir>
- </filelist>
- </release>
- <changelog>
- <release>
- <version>0.11</version>
- <date>2002-05-26</date>
- <notes>POSIX getopt compatibility fix: treat first element of args
- array as command name
- </notes>
- <state>beta</state>
- <filelist>
- <dir name="Console">
- <file role="php" name="Getopt.php"/>
- </dir>
- </filelist>
- </release>
- <release>
- <version>0.10</version>
- <date>2002-05-12</date>
- <notes>Packaging fix</notes>
- <state>beta</state>
- </release>
- <release>
- <version>0.9</version>
- <date>2002-05-12</date>
- <notes>Initial release</notes>
- <state>beta</state>
- </release>
- </changelog>
-</package>
diff --git a/pear/package-PEAR.xml b/pear/package-PEAR.xml
deleted file mode 100644
index ad739feae8..0000000000
--- a/pear/package-PEAR.xml
+++ /dev/null
@@ -1,342 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE package SYSTEM "package.dtd">
-<package version="1.0">
- <name>PEAR</name>
- <summary>PEAR Base System</summary>
- <description>The PEAR package contains:
- * the PEAR base class
- * the PEAR_Error error handling mechanism
- * the PEAR installer, for creating, distributing
- and installing packages
-</description>
- <license>PHP License</license>
- <maintainers>
- <maintainer>
- <user>ssb</user>
- <role>lead</role>
- <name>Stig Sæther Bakken</name>
- <email>stig@php.net</email>
- </maintainer>
- <maintainer>
- <user>cox</user>
- <role>developer</role>
- <name>Tomas V.V.Cox</name>
- <email>cox@idecnet.com</email>
- </maintainer>
- <maintainer>
- <user>mj</user>
- <role>helper</role>
- <name>Martin Jansen</name>
- <email>mj@php.net</email>
- </maintainer>
- <maintainer>
- <user>pajoye</user>
- <role>developer</role>
- <name>Pierre-Alain Joye</name>
- <email>pajoye@pearfr.org</email>
- </maintainer>
- </maintainers>
- <release>
- <version>1.1</version>
- <state>stable</state>
- <date>2003-01-10</date>
- <notes>
-PEAR BASE CLASS:
-
-* PEAR_Error now supports exceptions when using Zend Engine 2. Set the
- error mode to PEAR_ERROR_EXCEPTION to make PEAR_Error throw itself
- as an exception (invoke PEAR errors with raiseError() or throwError()
- just like before).
-
-PEAR INSTALLER:
-
-* Packaging and validation now parses PHP source code (unless
- ext/tokenizer is disabled) and does some coding standard conformance
- checks. Specifically, the names of classes and functions are
- checked to ensure that they are prefixed with the package name. If
- your package has symbols that should be without this prefix, you can
- override this warning by explicitly adding a "provides" entry in
- your package.xml file. See the package.xml file for this release
- for an example (OS_Guess, System and md5_file).
-
- All classes and non-private (not underscore-prefixed) methods and
- functions are now registered during "pear package".
-
-</notes>
- <provides type="class" name="OS_Guess" />
- <provides type="class" name="System" />
- <provides type="function" name="md5_file" />
- <filelist>
- <file role="data" name="package.dtd"/>
- <file role="data" name="template.spec"/>
- <file role="php" name="PEAR.php"/>
- <file role="php" name="System.php"/>
- <dir name="PEAR">
- <file role="php" name="Autoloader.php"/>
- <file role="php" name="Command.php"/>
- <dir name="Command">
- <file role="php" name="Auth.php"/>
- <file role="php" name="Build.php"/>
- <file role="php" name="Common.php"/>
- <file role="php" name="Config.php"/>
- <file role="php" name="Install.php"/>
- <file role="php" name="Package.php"/>
- <file role="php" name="Registry.php"/>
- <file role="php" name="Remote.php"/>
- </dir>
- <file role="php" name="Common.php"/>
- <file role="php" name="Config.php"/>
- <file role="php" name="Dependency.php"/>
- <dir name="Frontend">
- <file role="php" name="CLI.php"/>
- </dir>
- <file role="php" name="Builder.php"/>
- <file role="php" name="Installer.php"/>
- <file role="php" name="Packager.php"/>
- <file role="php" name="Registry.php"/>
- <file role="php" name="Remote.php"/>
- </dir>
- <dir name="OS">
- <file role="php" name="Guess.php"/>
- </dir>
- <dir name="scripts" baseinstalldir="/">
- <file role="script" install-as="pear" name="pear.sh">
- <replace from="@php_bin@" to="php_bin" type="pear-config"/>
- <replace from="@php_dir@" to="php_dir" type="pear-config"/>
- <replace from="@pear_version@" to="version" type="package-info"/>
- <replace from="@include_path@" to="php_dir" type="pear-config"/>
- </file>
- <file role="script" platform="windows" install-as="pear.bat" name="pear.bat">
- <replace from="@bin_dir@" to="bin_dir" type="pear-config"/>
- <replace from="@php_bin@" to="php_bin" type="pear-config"/>
- <replace from="@include_path@" to="php_dir" type="pear-config"/>
- </file>
- <file role="php" install-as="pearcmd.php" name="pearcmd.php">
- <replace from="@php_bin@" to="php_bin" type="pear-config"/>
- <replace from="@php_dir@" to="php_dir" type="pear-config"/>
- <replace from="@pear_version@" to="version" type="package-info"/>
- <replace from="@include_path@" to="php_dir" type="pear-config"/>
- </file>
- </dir>
- </filelist>
- <deps>
- <dep type="php" rel="ge" version="4.1"/>
- <dep type="pkg" rel="ge" version="0.4">Archive_Tar</dep>
- <dep type="pkg" rel="ge" version="0.11">Console_Getopt</dep>
- </deps>
- </release>
- <changelog>
- <release>
- <version>1.0.1</version>
- <state>stable</state>
- <date>2003-01-10</date>
- <notes>
- * PEAR_Error class has call backtrace available by
- calling getBacktrace(). Available if used with
- PHP 4.3 or newer.
-
- * PEAR_Config class uses getenv() rather than $_ENV
- to read environment variables.
-
- * System::which() Windows fix, now looks for
- exe/bat/cmd/com suffixes rather than just exe
-
- * Added "pear cvsdiff" command
-
- * Windows output buffering bugfix for "pear" command
-
- * Multiple drives installation now works on windows
-
- * pear.bat uses ENV variables, allowing the installation
- of many PEAR (windows)
- </notes>
- <deps>
- <dep type="php" rel="ge" version="4.1"/>
- <dep type="pkg" rel="ge" version="0.4">Archive_Tar</dep>
- <dep type="pkg" rel="ge" version="0.11">Console_Getopt</dep>
- </deps>
- </release>
- <release>
- <version>1.0</version>
- <state>stable</state>
- <date>2002-12-27</date>
- <notes>
- * set default cache_ttl to 1 hour
- * added "clear-cache" command
- </notes>
- <deps>
- <dep type="php" rel="ge" version="4.1"/>
- <dep type="pkg" rel="ge" version="0.4">Archive_Tar</dep>
- <dep type="pkg" rel="ge" version="0.11">Console_Getopt</dep>
- </deps>
- </release>
- <release>
- <version>1.0b3</version>
- <state>stable</state>
- <date>2002-12-13</date>
- <notes>
- * fixed "info" shortcut (conflicted with "install")
- * added "php_bin" config parameter
- * all "non-personal" config parameters now use
- environment variables for defaults (very useful
- to override the default php_dir on Windows!)
- </notes>
- <deps>
- <dep type="php" rel="ge" version="4.1"/>
- <dep type="pkg" rel="ge" version="0.4">Archive_Tar</dep>
- <dep type="pkg" rel="ge" version="0.11">Console_Getopt</dep>
- </deps>
- </release>
- <release>
- <version>1.0b2</version>
- <state>stable</state>
- <date>2002-11-26</date>
- <notes>
-Changes, Installer:
-* --force option no longer ignores errors, use
- --ignore-errors instead
-* installer transactions: failed installs abort
- cleanly, without leaving half-installed packages
- around
-</notes>
- </release>
- <release>
- <version>1.0b1</version>
- <state>stable</state>
- <date>2002-10-12</date>
- <notes>
-New Features, Installer:
-* new command: "pear makerpm"
-* new command: "pear search"
-* new command: "pear upgrade-all"
-* new command: "pear config-help"
-* new command: "pear sign"
-* Windows support for "pear build" (requires
- msdev)
-* new dependency type: "zend"
-* XML-RPC results may now be cached (see
- cache_dir and cache_ttl config)
-* HTTP proxy authorization support
-* install/upgrade install-root support
-
-Bugfixes, Installer:
-* fix for XML-RPC bug that made some remote
- commands fail
-* fix problems under Windows with
- DIRECTORY_SEPARATOR
-* lots of other minor fixes
-* --force option did not work for "pear install
- Package"
-* http downloader used "4.2.1" rather than
- "PHP/4.2.1" as user agent
-* bending over a little more to figure out how
- PHP is installed
-* "platform" file attribute was not included
- during "pear package"
-
-New Features, PEAR Library:
-* added PEAR::loadExtension($ext)
-* added PEAR::delExpect()
-* System::mkTemp() now cleans up at shutdown
-* defined PEAR_ZE2 constant (boolean)
-* added PEAR::throwError() with a simpler API
- than raiseError()
-
-Bugfixes, PEAR Library:
-* ZE2 compatibility fixes
-* use getenv() as fallback for $_ENV
-</notes>
- <deps>
- <dep type="php" rel="ge" version="4.1"/>
- <dep type="pkg" rel="ge" version="0.4">Archive_Tar</dep>
- <dep type="pkg" rel="ge" version="0.11">Console_Getopt</dep>
- </deps>
- </release>
- <release>
- <version>0.90</version>
- <state>beta</state>
- <date>2002-05-28</date>
- <notes>
-* fix: "help" command was broken
-* new command: "info"
-* new command: "config-help"
-* un-indent multi-line data from xml description files
-* new command: "build"
-* fix: config-set did not work with "set" parameters
-* disable magic_quotes_runtime
-* "install" now builds and installs C extensions
-* added PEAR::delExpect()
-* System class no longer inherits PEAR
-* grouped PEAR_Config parameters
-* add --nobuild option to install/upgrade commands
-* new and more generic Frontend API
-</notes>
- <deps>
- <dep type="php" rel="ge" version="4.1"/>
- <dep type="pkg" rel="has" version="0.4">Archive_Tar</dep>
- <dep type="pkg" rel="ge" version="0.11">Console_Getopt</dep>
- </deps>
- </release>
- <release>
- <version>0.10</version>
- <state>beta</state>
- <date>2002-05-26</date>
- <notes>
-Lots of stuff this time. 0.9 was not actually self-hosting, even
-though it claimed to be. This version finally is self-hosting
-(really!), meaning you can upgrade the installer with the command
-"pear upgrade PEAR".
-
-* new config paramers: http_proxy and umask
-* HTTP proxy support when downloading packages
-* generalized command handling code
-* and fixed the bug that would not let commands have the
- same options as "pear" itself
-* added long options to every command
-* added command shortcuts ("pear help shortcuts")
-* added stub for Gtk installer
-* some phpdoc fixes
-* added class dependency detector (using ext/tokenizer)
-* dependency handling fixes
-* added OS_Guess class for detecting OS
-* install files with the "platform" attribute set
- only on matching operating systems
-* PEAR_Remote now falls back to the XML_RPC package
- if xmlrpc-epi is not available
-* renamed command: package-list -> list
-* new command: package-dependencies
-* lots of minor fixes
-</notes>
- <deps>
- <dep type="php" rel="ge" version="4.1"/>
- <dep type="pkg" rel="has" version="0.5">Archive_Tar</dep>
- <dep type="pkg" rel="ge" version="0.11">Console_Getopt</dep>
- </deps>
- </release>
- <release>
- <version>0.9</version>
- <state>beta</state>
- <date>2002-04-07</date>
- <notes>
-First package release. Commands implemented:
- remote-package-info
- list-upgrades
- list-remote-packages
- download
- config-show
- config-get
- config-set
- list-installed
- shell-test
- install
- uninstall
- upgrade
- package
- package-list
- package-info
- login
- logout
-</notes>
- </release>
- </changelog>
-</package>
diff --git a/pear/package.dtd b/pear/package.dtd
deleted file mode 100644
index e1eff7098f..0000000000
--- a/pear/package.dtd
+++ /dev/null
@@ -1,109 +0,0 @@
-<!--
- $Id: package.dtd,v 1.31 2003-05-09 12:03:09 derick Exp $
-
- This is the PEAR package description, version 1.0.
- It should be used with the informal public identifier:
-
- "-//PHP Group//DTD PEAR Package 1.0//EN//XML"
-
- Copyright (c) 1997-2002 The PHP Group
-
- This source file is subject to version 2.02 of the PHP license,
- that is bundled with this package in the file LICENSE, and is
- available at through the world-wide-web at
- http://www.php.net/license/2_02.txt.
- If you did not receive a copy of the PHP license and are unable to
- obtain it through the world-wide-web, please send a note to
- license@php.net so we can mail you a copy immediately.
-
- Authors:
- Stig S. Bakken <ssb@php.net>
-
- -->
-
-<!ELEMENT package (name|summary|description|license|maintainers|release|changelog)+>
-<!ATTLIST package type (source|binary|empty) "empty"
- version CDATA #REQUIRED>
-
-<!ELEMENT name (#PCDATA)>
-
-<!ELEMENT summary (#PCDATA)>
-
-<!ELEMENT description (#PCDATA)>
-
-<!ELEMENT license (#PCDATA)>
-
-<!ELEMENT maintainers (maintainer)+>
-
-<!ELEMENT maintainer (user|role|name|email)+>
-
-<!ELEMENT user (#PCDATA)>
-
-<!ELEMENT role (#PCDATA)>
-
-<!ELEMENT email (#PCDATA)>
-
-<!ELEMENT changelog (release)+>
-
-<!ELEMENT release (version|license|state|date|notes|filelist|deps|provides|script|configureoptions)+>
-
-<!ELEMENT version (#PCDATA)>
-
-<!ELEMENT state (#PCDATA)>
-
-<!ELEMENT date (#PCDATA)>
-
-<!ELEMENT notes (#PCDATA)>
-
-<!ELEMENT filelist (dir|file)+>
-
-<!ELEMENT dir (dir|file)+>
-<!ATTLIST dir name CDATA #REQUIRED
- baseinstalldir CDATA #IMPLIED>
-
-<!ELEMENT file (replace*)>
-<!ATTLIST file role (php|ext|src|test|doc|data|script) 'php'
- debug (na|on|off) 'na'
- zts (na|on|off) 'na'
- phpapi NUMBER #IMPLIED
- zendapi NUMBER #IMPLIED
- format CDATA #IMPLIED
- baseinstalldir CDATA #IMPLIED
- platform CDATA #IMPLIED
- md5sum CDATA #IMPLIED
- name CDATA #REQUIRED
- install-as CDATA #IMPLIED>
-
-<!ELEMENT replace EMPTY>
-<!ATTLIST replace from CDATA #REQUIRED
- to CDATA #REQUIRED
- type CDATA #REQUIRED>
-
-<!ELEMENT deps (dep)+>
-
-<!ELEMENT dep (#PCDATA)>
-<!ATTLIST dep
- type (pkg|ext|php|prog|ldlib|rtlib|os|websrv|sapi|zend) #REQUIRED
- rel (has|eq|lt|le|gt|ge) 'has'
- version CDATA #IMPLIED>
-
-<!ELEMENT provides (#PCDATA)>
-<!ATTLIST provides
- type (ext|prog|class|function|feature|api) #REQUIRED
- name CDATA #REQUIRED
- extends CDATA #IMPLIED>
-
-<!ELEMENT script (#PCDATA)>
-<!ATTLIST script
- phase (pre-install |post-install |
- pre-uninstall|post-uninstall|
- pre-build |post-build |
- pre-setup |post-setup ) #REQUIRED>
-
-<!ELEMENT configureoptions (configureoption*)>
-
-<!ELEMENT configureoption EMPTY>
-<!ATTLIST configureoption
- name CDATA #REQUIRED
- default CDATA #IMPLIED
- prompt CDATA #REQUIRED>
diff --git a/pear/packages/DB-1.3.tar b/pear/packages/DB-1.3.tar
deleted file mode 100644
index 7e34293a06..0000000000
--- a/pear/packages/DB-1.3.tar
+++ /dev/null
Binary files differ
diff --git a/pear/packages/HTTP-1.2.tar b/pear/packages/HTTP-1.2.tar
deleted file mode 100644
index 8801425e3f..0000000000
--- a/pear/packages/HTTP-1.2.tar
+++ /dev/null
Binary files differ
diff --git a/pear/packages/Mail-1.0.1.tar b/pear/packages/Mail-1.0.1.tar
deleted file mode 100644
index 7716adb920..0000000000
--- a/pear/packages/Mail-1.0.1.tar
+++ /dev/null
Binary files differ
diff --git a/pear/packages/Net_SMTP-1.0.tar b/pear/packages/Net_SMTP-1.0.tar
deleted file mode 100644
index cfe57cbdd2..0000000000
--- a/pear/packages/Net_SMTP-1.0.tar
+++ /dev/null
Binary files differ
diff --git a/pear/packages/Net_Socket-1.0.1.tar b/pear/packages/Net_Socket-1.0.1.tar
deleted file mode 100644
index 7ff4698b69..0000000000
--- a/pear/packages/Net_Socket-1.0.1.tar
+++ /dev/null
Binary files differ
diff --git a/pear/packages/XML_Parser-1.0.1.tar b/pear/packages/XML_Parser-1.0.1.tar
deleted file mode 100644
index 0ed54b3f42..0000000000
--- a/pear/packages/XML_Parser-1.0.1.tar
+++ /dev/null
Binary files differ
diff --git a/pear/packages/XML_RPC-1.0.4.tar b/pear/packages/XML_RPC-1.0.4.tar
deleted file mode 100644
index b1eb50e742..0000000000
--- a/pear/packages/XML_RPC-1.0.4.tar
+++ /dev/null
Binary files differ
diff --git a/pear/scripts/pear.bat b/pear/scripts/pear.bat
deleted file mode 100755
index 08aca95548..0000000000
--- a/pear/scripts/pear.bat
+++ /dev/null
@@ -1,69 +0,0 @@
-@ECHO OFF
-
-REM ----------------------------------------------------------------------
-REM PHP version 4.0
-REM ----------------------------------------------------------------------
-REM Copyright (c) 1997-2002 The PHP Group
-REM ----------------------------------------------------------------------
-REM This source file is subject to version 2.02 of the PHP license,
-REM that is bundled with this package in the file LICENSE, and is
-REM available at through the world-wide-web at
-REM http://www.php.net/license/2_02.txt.
-REM If you did not receive a copy of the PHP license and are unable to
-REM obtain it through the world-wide-web, please send a note to
-REM license@php.net so we can mail you a copy immediately.
-REM ----------------------------------------------------------------------
-REM Authors: Alexander Merz (alexmerz@php.net)
-REM ----------------------------------------------------------------------
-REM
-REM $Id: pear.bat,v 1.13 2003/03/25 14:34:02 mj Exp $
-
-REM change this lines to match the paths of your system
-REM -------------------
-
-@ECHO OFF
-:: Check PEAR global ENV, set them if they do not exist
-IF "%PHP_PEAR_INSTALL_DIR%"=="" SET PHP_PEAR_INSTALL_DIR=@include_path@
-IF "%PHP_PEAR_BIN_DIR%"=="" SET PHP_PEAR_BIN_DIR=@bin_dir@
-IF "%PHP_PEAR_PHP_BIN%"=="" SET PHP_PEAR_PHP_BIN=@php_bin@
-
-:: Check Folders and files
-IF NOT EXIST %PHP_PEAR_INSTALL_DIR% GOTO PEAR_INSTALL_ERROR
-IF NOT EXIST %PHP_PEAR_INSTALL_DIR%\pearcmd.php GOTO PEAR_INSTALL_ERROR2
-IF NOT EXIST %PHP_PEAR_BIN_DIR% GOTO PEAR_BIN_ERROR
-IF NOT EXIST %PHP_PEAR_PHP_BIN% GOTO PEAR_PHPBIN_ERROR
-:: launch pearcmd
-GOTO RUN
-:PEAR_INSTALL_ERROR
-ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_INSTALL_DIR%
-GOTO END
-:PEAR_INSTALL_ERROR2
-ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
-ECHO pearcmd.php could not be found there.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_INSTALL_DIR%
-GOTO END
-:PEAR_BIN_ERROR
-ECHO PHP_PEAR_BIN_DIR is not set correctly.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_BIN_DIR%
-GOTO END
-:PEAR_PHPBIN_ERROR
-ECHO PHP_PEAR_PHP_BIN is not set correctly.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_PHP_BIN%
-GOTO END
-:RUN
-%PHP_PEAR_PHP_BIN% -C -d output_buffering=1 -d include_path=%PHP_PEAR_INSTALL_DIR% -f %PHP_PEAR_INSTALL_DIR%\pearcmd.php -- %1 %2 %3 %4 %5 %6 %7 %8 %9
-:END
-@ECHO ON
diff --git a/pear/scripts/pear.sh b/pear/scripts/pear.sh
deleted file mode 100644
index dad0838338..0000000000
--- a/pear/scripts/pear.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-# first find which PHP binary to use
-if test "x$PHP_PEAR_PHP_BIN" != "x"; then
- PHP="$PHP_PEAR_PHP_BIN"
-else
- if test "@php_bin@" = '@'php_bin'@'; then
- PHP=php
- else
- PHP="@php_bin@"
- fi
-fi
-
-# then look for the right pear include dir
-if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then
- INCDIR=$PHP_PEAR_INSTALL_DIR
- INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR"
-else
- if test "@php_dir@" = '@'php_dir'@'; then
- INCDIR=`dirname $0`
- INCARG=""
- else
- INCDIR="@php_dir@"
- INCARG="-d include_path=@php_dir@"
- fi
-fi
-
-exec $PHP -C -q $INCARG -d output_buffering=1 $INCDIR/pearcmd.php $@
diff --git a/pear/scripts/pearcmd.php b/pear/scripts/pearcmd.php
deleted file mode 100644
index b3ce371106..0000000000
--- a/pear/scripts/pearcmd.php
+++ /dev/null
@@ -1,295 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@php.net> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-ob_end_clean();
-/**
- * @nodep Gtk
- */
-if ('@include_path@' != '@'.'include_path'.'@') {
- ini_set('include_path', '@include_path@');
-}
-ini_set('allow_url_fopen', true);
-set_time_limit(0);
-ob_implicit_flush(true);
-ini_set('track_errors', true);
-ini_set('html_errors', false);
-ini_set('magic_quotes_runtime', false);
-error_reporting(E_ALL & ~E_NOTICE);
-set_error_handler('error_handler');
-
-$pear_package_version = "@pear_version@";
-
-require_once 'PEAR.php';
-require_once 'PEAR/Config.php';
-require_once 'PEAR/Command.php';
-require_once 'Console/Getopt.php';
-
-PEAR_Command::setFrontendType('CLI');
-$all_commands = PEAR_Command::getCommands();
-
-$argv = Console_Getopt::readPHPArgv();
-$progname = basename($argv[0]);
-$options = Console_Getopt::getopt($argv, "c:C:d:D:Gh?sSqu:vV");
-if (PEAR::isError($options)) {
- usage($options);
-}
-
-$opts = $options[0];
-
-$fetype = 'CLI';
-if ($progname == 'gpear' || $progname == 'pear-gtk') {
- $fetype = 'Gtk';
-} else {
- foreach ($opts as $opt) {
- if ($opt[0] == 'G') {
- $fetype = 'Gtk';
- }
- }
-}
-PEAR_Command::setFrontendType($fetype);
-$ui = &PEAR_Command::getFrontendObject();
-PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError"));
-
-$pear_user_config = '';
-$pear_system_config = '';
-$store_user_config = false;
-$store_system_config = false;
-$verbose = 1;
-
-foreach ($opts as $opt) {
- switch ($opt[0]) {
- case 'c':
- $pear_user_config = $opt[1];
- break;
- case 'C':
- $pear_system_config = $opt[1];
- break;
- }
-}
-
-$config = &PEAR_Config::singleton($pear_user_config, $pear_system_config);
-$verbose = $config->get("verbose");
-$cmdopts = array();
-
-foreach ($opts as $opt) {
- $param = !empty($opt[1]) ? $opt[1] : true;
- switch ($opt[0]) {
- case 'd':
- list($key, $value) = explode('=', $param);
- $config->set($key, $value, 'user');
- break;
- case 'D':
- list($key, $value) = explode('=', $param);
- $config->set($key, $value, 'system');
- break;
- case 's':
- $store_user_config = true;
- break;
- case 'S':
- $store_system_config = true;
- break;
- case 'u':
- $config->remove($param, 'user');
- break;
- case 'v':
- $config->set('verbose', $config->get('verbose') + 1);
- break;
- case 'q':
- $config->set('verbose', $config->get('verbose') - 1);
- break;
- case 'V':
- usage(null, 'version');
- default:
- // all non pear params goes to the command
- $cmdopts[$opt[0]] = $param;
- break;
- }
-}
-
-if ($store_system_config) {
- $config->store('system');
-}
-
-if ($store_user_config) {
- $config->store('user');
-}
-
-$command = (isset($options[1][0])) ? $options[1][0] : null;
-
-if (empty($command) && ($store_user_config || $store_system_config)) {
- exit;
-}
-
-if ($fetype == 'Gtk') {
- Gtk::main();
-} else do {
- if ($command == 'help') {
- usage(null, @$options[1][1]);
- }
-
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $cmd = PEAR_Command::factory($command, $config);
- PEAR::popErrorHandling();
- if (PEAR::isError($cmd)) {
- usage(null, @$options[1][1]);
- }
-
- $short_args = $long_args = null;
- PEAR_Command::getGetoptArgs($command, $short_args, $long_args);
- if (PEAR::isError($tmp = Console_Getopt::getopt($options[1], $short_args, $long_args))) {
- break;
- }
- list($tmpopt, $params) = $tmp;
- $opts = array();
- foreach ($tmpopt as $foo => $tmp2) {
- list($opt, $value) = $tmp2;
- if ($value === null) {
- $value = true; // options without args
- }
- if (strlen($opt) == 1) {
- $cmdoptions = $cmd->getOptions($command);
- foreach ($cmdoptions as $o => $d) {
- if (@$d['shortopt'] == $opt) {
- $opts[$o] = $value;
- }
- }
- } else {
- if (substr($opt, 0, 2) == '--') {
- $opts[substr($opt, 2)] = $value;
- }
- }
- }
- $ok = $cmd->run($command, $opts, $params);
- if ($ok === false) {
- PEAR::raiseError("unknown command `$command'");
- }
-} while (false);
-
-// {{{ usage()
-
-function usage($error = null, $helpsubject = null)
-{
- global $progname, $all_commands;
- $stderr = fopen('php://stderr', 'w');
- if (PEAR::isError($error)) {
- fputs($stderr, $error->getMessage() . "\n");
- } elseif ($error !== null) {
- fputs($stderr, "$error\n");
- }
- if ($helpsubject != null) {
- $put = cmdHelp($helpsubject);
- } else {
- $put =
- "Usage: $progname [options] command [command-options] <parameters>\n".
- "Type \"$progname help options\" to list all options.\n".
- "Type \"$progname help <command>\" to get the help for the specified command.\n".
- "Commands:\n";
- $maxlen = max(array_map("strlen", $all_commands));
- $formatstr = "%-{$maxlen}s %s\n";
- ksort($all_commands);
- foreach ($all_commands as $cmd => $class) {
- $put .= sprintf($formatstr, $cmd, PEAR_Command::getDescription($cmd));
- }
- }
- fputs($stderr, "$put\n");
- fclose($stderr);
- exit;
-}
-
-function cmdHelp($command)
-{
- global $progname, $all_commands, $config;
- if ($command == "options") {
- return
- "Options:\n".
- " -v increase verbosity level (default 1)\n".
- " -q be quiet, decrease verbosity level\n".
- " -c file find user configuration in `file'\n".
- " -C file find system configuration in `file'\n".
- " -d foo=bar set user config variable `foo' to `bar'\n".
- " -D foo=bar set system config variable `foo' to `bar'\n".
- " -G start in graphical (Gtk) mode\n".
- " -s store user configuration\n".
- " -S store system configuration\n".
- " -u foo unset `foo' in the user configuration\n".
- " -h, -? display help/usage (this message)\n".
- " -V version information\n";
- } elseif ($command == "shortcuts") {
- $sc = PEAR_Command::getShortcuts();
- $ret = "Shortcuts:\n";
- foreach ($sc as $s => $c) {
- $ret .= sprintf(" %-8s %s\n", $s, $c);
- }
- return $ret;
-
- } elseif ($command == "version") {
- return "PEAR Version: ".$GLOBALS['pear_package_version']."\nPHP Version: ".phpversion()."\nZend Engine Version: ".zend_version();
-
- } elseif ($help = PEAR_Command::getHelp($command)) {
- if (is_string($help)) {
- return "$progname $command [options] $help\n";
- }
- if ($help[1] === null) {
- return "$progname $command $help[0]";
- } else {
- return "$progname $command [options] $help[0]\n$help[1]";
- }
- }
- return "No such command";
-}
-
-// }}}
-
-function error_handler($errno, $errmsg, $file, $line, $vars) {
- if (error_reporting() == 0) {
- return; // @silenced error
- }
- $errortype = array (
- 1 => "Error",
- 2 => "Warning",
- 4 => "Parsing Error",
- 8 => "Notice",
- 16 => "Core Error",
- 32 => "Core Warning",
- 64 => "Compile Error",
- 128 => "Compile Warning",
- 256 => "User Error",
- 512 => "User Warning",
- 1024=> "User Notice"
- );
- $prefix = $errortype[$errno];
- $file = basename($file);
- print "\n$prefix: $errmsg in $file on line $line\n";
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * mode: php
- * End:
- */
-// vim600:syn=php
-
-?>
diff --git a/pear/scripts/pearwin.php b/pear/scripts/pearwin.php
deleted file mode 100644
index 43c46998f1..0000000000
--- a/pear/scripts/pearwin.php
+++ /dev/null
@@ -1,233 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@php.net> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR.php';
-require_once 'PEAR/Common.php';
-require_once 'PEAR/Config.php';
-require_once 'PEAR/Remote.php';
-require_once 'PEAR/Registry.php';
-require_once 'Console/Getopt.php';
-
-error_reporting(E_ALL ^ E_NOTICE);
-
-$progname = basename($argv[0]);
-
-PEAR::setErrorHandling(PEAR_ERROR_PRINT, "$progname: %s\n");
-
-$argv = Console_Getopt::readPHPArgv();
-if (PEAR::isError($argv)) {
- die($argv->getMessage());
-}
-$options = Console_Getopt::getopt($argv, "c:C:d:D:h?sSqu:v");
-if (PEAR::isError($options)) {
- usage($options);
-}
-
-
-$php_sysconfdir = getenv('PHP_SYSCONFDIR');
-if (!empty($php_sysconfdir)) {
- $pear_default_config = $php_sysconfdir.DIRECTORY_SEPARATOR.'pearsys.ini';
- $pear_user_config = $php_sysconfdir.DIRECTORY_SEPARATOR.'pear.ini';
-} else {
- $pear_default_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pearsys.ini';
- $pear_user_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pear.ini';
-}
-
-$opts = $options[0];
-
-//echo "ini_get : ".ini_get("pear_install_dir")."\n";
-//echo "get_cfg_var : ".get_cfg_var("pear_install_dir")."\n";
-
-foreach ($opts as $opt) {
- switch ($opt[0]) {
- case 'c':
- $pear_user_config = $opt[1];
- break;
- case 'C':
- $pear_default_config = $opt[1];
- break;
- }
-}
-
-$config = new PEAR_Config($pear_user_config, $pear_default_config);
-$store_user_config = false;
-$store_default_config = false;
-$verbose = 1;
-
-foreach ($opts as $opt) {
- $param = $opt[1];
- switch ($opt[0]) {
- case 'd':
- list($key, $value) = explode('=', $param);
- $config->set($key, $value);
- break;
- case 'D':
- list($key, $value) = explode('=', $param);
- $config->set($key, $value, true);
- break;
- case 's':
- $store_user_config = true;
- break;
- case 'S':
- $store_default_config = true;
- break;
- case 'u':
- $config->toDefault($param);
- break;
- case 'v':
- $verbose++;
- break;
- case 'q':
- $verbose--;
- break;
- }
-}
-
-if ($store_default_config) {
- if (@is_writeable($pear_default_config)) {
- $config->writeConfigFile($pear_default_config, 'default');
- } else {
- die("You don't have write access to $pear_default_config, exiting!\n");
- }
-}
-
-if ($store_user_config) {
- $config->writeConfigFile($pear_user_config, 'userdefined');
-}
-
-$fallback_config = array(
- 'master_server' => 'pear.php.net',
- 'php_dir' => getenv('PEAR_INSTALL_DIR'),
- 'ext_dir' => getenv('PEAR_EXTENSION_DIR'),
- 'doc_dir' => getenv('PHP_DATADIR') . DIRECTORY_SEPARATOR . 'pear' .
- DIRECTORY_SEPARATOR . 'doc',
- 'verbose' => true,
-);
-$fallback_done = array();
-
-foreach ($fallback_config as $key => $value) {
- if (!$config->isDefined($key)) {
- $config->set($key, $value);
- $fallback_done[$key] = true;
- }
-}
-
-//$verbose = $config->get("verbose");
-$script_dir = $config->get("php_dir");
-$ext_dir = $config->get("ext_dir");
-$doc_dir = $config->get("doc_dir");
-
-PEAR::setErrorHandling(PEAR_ERROR_PRINT);
-
-$command = (isset($options[1][1])) ? $options[1][1] : null;
-$rest = array_slice($options[1], 2);
-
-if (isset($command_options[$command])) {
- $tmp = Console_Getopt::getopt($rest, $command_options[$command]);
- if (PEAR::isError($tmp)) {
- usage($tmp);
- }
- $cmdopts = $tmp[0];
- $cmdargs = $tmp[1];
-} else {
- $cmdopts = array();
- $cmdargs = $rest;
-}
-
-
-/* Extracted from pearcmd-common.php */
-function heading($text)
-{
- $l = strlen(trim($text));
- print rtrim($text) . "\n" . str_repeat("=", $l) . "\n";
-}
-
-switch ($command) {
- case 'install':
- include 'pearcmd-install.php';
- break;
- case 'uninstall':
- include 'pearcmd-uninstall.php';
- break;
- case 'list':
- include 'pearcmd-list.php';
- break;
- case 'package':
- include 'pearcmd-package.php';
- break;
- case 'remote-list':
- include 'pearcmd-remote-list.php';
- break;
- case 'show-config':
- $keys = $config->getKeys();
- foreach ($keys as $key) {
- $value = $config->get($key);
- $xi = "";
- if ($config->isDefaulted($key)) {
- $xi .= " (default)";
- }
- if (isset($fallback_done[$key])) {
- $xi .= " (built-in)";
- }
- printf("%s = %s%s\n", $key, $value, $xi);
- }
- break;
- default: {
- if (!$store_default_config && !$store_user_config) {
- usage();
- }
- break;
- }
-}
-
-function usage($obj = null)
-{
- $stderr = fopen('php://stderr', 'w');
- if ($obj !== null) {
- fputs($stderr, $obj->getMessage());
- }
- fputs($stderr,
- "Usage: pear [options] command [command-options] <parameters>\n".
- "Options:\n".
- " -v increase verbosity level (default 1)\n".
- " -q be quiet, decrease verbosity level\n".
- " -c file find user configuration in `file'\n".
- " -C file find system configuration in `file'\n".
- " -d \"foo=bar\" set user config variable `foo' to `bar'\n".
- " -D \"foo=bar\" set system config variable `foo' to `bar'\n".
- " -s store user configuration\n".
- " -S store system configuration\n".
- " -u foo unset `foo' in the user configuration\n".
- " -h, -? display help/usage (this message)\n".
- "Commands:\n".
- " help [command]\n".
- " install [-r] <package file>\n".
- " uninstall [-r] <package name>\n".
- " package [package info file]\n".
- " list\n".
- " remote-list\n".
- " show-config\n".
- "\n");
- fclose($stderr);
- exit;
-}
-
-?> \ No newline at end of file
diff --git a/pear/template.spec b/pear/template.spec
deleted file mode 100644
index dc6c66550e..0000000000
--- a/pear/template.spec
+++ /dev/null
@@ -1,44 +0,0 @@
-Summary: PEAR: @summary@
-Name: @rpm_package@
-Version: @version@
-Release: 1
-License: @release_license@
-Group: Development/Libraries
-Source: http://@master_server@/get/@package@-%{version}.tgz
-BuildRoot: %{_tmppath}/%{name}-root
-URL: http://@master_server@/
-Prefix: %{_prefix}
-Docdir: @doc_dir@/@package@
-BuildArchitectures: @arch@
-@extra_headers@
-
-%description
-@description@
-
-%prep
-#rm -rf Console_Getopt-%{version} package.xml
-#mkdir -p Console_Getopt-%{version}
-#ln -s Console_Getopt-%{version}/package.xml package.xml
-%setup -q -D -n @package@-%{version}
-mv ../package.xml .
-
-%build
-echo BuildRoot=%{buildroot}
-
-%post
-pear uninstall --nodeps -r @package@
-
-%postun
-pear install --nodeps -r @rpm_xml_dir@/@package@.xml
-
-%install
-rm -rf %{buildroot}/*
-pear -q install -R %{buildroot} -n package.xml
-mkdir -p %{buildroot}@rpm_xml_dir@
-cp -p package.xml %{buildroot}@rpm_xml_dir@/@package@.xml
-
-%files
-%defattr(-,root,root)
-%doc @doc_files@
-@files@
-@rpm_xml_dir@/@package@.xml
diff --git a/pear/tests/merge.input b/pear/tests/merge.input
deleted file mode 100644
index 440106ea45..0000000000
--- a/pear/tests/merge.input
+++ /dev/null
@@ -1 +0,0 @@
-a:1:{s:7:"verbose";i:100;} \ No newline at end of file
diff --git a/pear/tests/pear1.phpt b/pear/tests/pear1.phpt
deleted file mode 100644
index 2961ff7284..0000000000
--- a/pear/tests/pear1.phpt
+++ /dev/null
@@ -1,88 +0,0 @@
---TEST--
-PEAR constructor/destructor test
---SKIPIF--
-skip
---FILE--
-<?php
-
-require_once "PEAR.php";
-
-class TestPEAR extends PEAR {
- function TestPEAR($name) {
- $this->_debug = true;
- $this->name = $name;
- $this->PEAR();
- }
- function _TestPEAR() {
- print "This is the TestPEAR($this->name) destructor\n";
- $this->_PEAR();
- }
-}
-
-class Test2 extends PEAR {
- function _Test2() {
- print "This is the Test2 destructor\n";
- $this->_PEAR();
- }
-}
-
-class Test3 extends Test2 {
-}
-
-// test for bug http://bugs.php.net/bug.php?id=14744
-class Other extends Pear {
-
- var $a = 'default value';
-
- function Other() {
- $this->PEAR();
- }
-
- function _Other() {
- // $a was modified but here misteriously returns to be
- // the original value. That makes the destructor useless
- // The correct value for $a in the destructor shoud be "new value"
- echo "#bug 14744# Other class destructor: other->a == '" . $this->a ."'\n";
- }
-}
-
-print "testing plain destructors\n";
-$o = new TestPEAR("test1");
-$p = new TestPEAR("test2");
-print "..\n";
-print "testing inherited destructors\n";
-$q = new Test3;
-
-echo "...\ntesting bug #14744\n";
-$other =& new Other;
-echo "#bug 14744# Other class constructor: other->a == '" . $other->a ."'\n";
-// Modify $a
-$other->a = 'new value';
-echo "#bug 14744# Other class modified: other->a == '" . $other->a ."'\n";
-
-print "..\n";
-print "script exiting...\n";
-print "..\n";
-
-?>
---GET--
---POST--
---EXPECT--
-testing plain destructors
-PEAR constructor called, class=testpear
-PEAR constructor called, class=testpear
-..
-testing inherited destructors
-...
-testing bug #14744
-#bug 14744# Other class constructor: other->a == 'default value'
-#bug 14744# Other class modified: other->a == 'new value'
-..
-script exiting...
-..
-This is the TestPEAR(test1) destructor
-PEAR destructor called, class=testpear
-This is the TestPEAR(test2) destructor
-PEAR destructor called, class=testpear
-This is the Test2 destructor
-#bug 14744# Other class destructor: other->a == 'new value'
diff --git a/pear/tests/pear_autoloader.phpt b/pear/tests/pear_autoloader.phpt
deleted file mode 100644
index f25f4a4116..0000000000
--- a/pear/tests/pear_autoloader.phpt
+++ /dev/null
@@ -1,81 +0,0 @@
---TEST--
-PEAR_Autoloader
---SKIPIF--
-skip
-<?php /*if (!extension_loaded("overload")) die("skip\n"); */ ?>
---FILE--
-<?php
-
-include dirname(__FILE__)."/../PEAR/Autoloader.php";
-
-class test1 extends PEAR_Autoloader {
- function test1() {
- $this->addAutoload(array(
- 'testfunc1' => 'testclass1',
- 'testfunca' => 'testclass1',
- 'testfunc2' => 'testclass2',
- 'testfuncb' => 'testclass2',
- ));
- }
-}
-
-class testclass1 {
- function testfunc1($a) {
- print "testfunc1 arg=";var_dump($a);
- return 1;
- }
- function testfunca($a) {
- print "testfunca arg=";var_dump($a);
- return 2;
- }
-}
-
-class testclass2 {
- function testfunc2($b) {
- print "testfunc2 arg=";var_dump($b);
- return 3;
- }
- function testfuncb($b) {
- print "testfuncb arg=";var_dump($b);
- return 4;
- }
-}
-
-function dump($obj) {
- print "mapped methods:";
- foreach ($obj->_method_map as $method => $object) {
- print " $method";
- }
- print "\n";
-}
-
-function call($msg, $retval) {
- print "calling $msg returned $retval\n";
-}
-
-$obj = new test1;
-dump($obj);
-call("testfunc1", $obj->testfunc1(2));
-dump($obj);
-call("testfunca", $obj->testfunca(2));
-dump($obj);
-call("testfunc2", $obj->testfunc2(2));
-dump($obj);
-call("testfuncb", $obj->testfuncb(2));
-dump($obj);
-
-?>
---EXPECT--
-mapped methods:
-testfunc1 arg=int(2)
-calling testfunc1 returned 1
-mapped methods: testfunc1 testfunca
-testfunca arg=int(2)
-calling testfunca returned 2
-mapped methods: testfunc1 testfunca
-testfunc2 arg=int(2)
-calling testfunc2 returned 3
-mapped methods: testfunc1 testfunca testfunc2 testfuncb
-testfuncb arg=int(2)
-calling testfuncb returned 4
-mapped methods: testfunc1 testfunca testfunc2 testfuncb
diff --git a/pear/tests/pear_config.phpt b/pear/tests/pear_config.phpt
deleted file mode 100644
index 7e125ac855..0000000000
--- a/pear/tests/pear_config.phpt
+++ /dev/null
@@ -1,289 +0,0 @@
---TEST--
-PEAR_Config
---SKIPIF--
-skip
---FILE--
-<?php
-
-error_reporting(E_ALL);
-chdir(dirname(__FILE__));
-include "../PEAR/Config.php";
-copy("system.input", "system.conf");
-copy("user.input", "user.conf");
-copy("user2.input", "user2.conf");
-copy("merge.input", "merge.conf");
-PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s\n");
-
-print "\n#0 starting up\n";
-dump_files();
-
-print "\n#1 testing: constructor\n";
-$config = new PEAR_Config("user.conf", "system.conf");
-dump_array("files", $config->files);
-
-print "\n#2 testing: singleton\n";
-$o1 = &PEAR_Config::singleton();
-$o1->blah = 'blah';
-$o2 = &PEAR_Config::singleton();
-var_dump($o1->blah);
-@var_dump($o2->blah);
-
-print "\n#3 testing: readConfigFile\n";
-$config->readConfigFile("user2.conf", "user");
-dump_config($config);
-$config->readConfigFile("user.conf");
-dump_config($config);
-
-print "\n#4 testing: mergeConfigFile\n";
-$config->readConfigFile("user2.conf");
-dump_config($config, "user");
-$config->mergeConfigFile("merge.conf", true);
-dump_config($config, "user");
-$config->readConfigFile("user2.conf");
-$config->mergeConfigFile("merge.conf", false);
-dump_config($config, "user");
-$config->readConfigFile("user.conf");
-dump_config($config, "user");
-$config->mergeConfigFile("merge.conf", true, "xyzzy");
-
-print "\n#5 testing: config file version detection\n";
-$config->readConfigFile("user.conf", "user");
-$config->readConfigFile("toonew.conf", "user");
-
-print "\n#6 testing: get/set/remove\n";
-var_dump($config->get("verbose"));
-$config->set("verbose", 100, "system");
-var_dump($config->get("verbose"));
-$config->set("verbose", 2, "user");
-var_dump($config->get("verbose"));
-$config->set("verbose", 2, "system");
-$config->set("verbose", 50, "user");
-var_dump($config->get("verbose"));
-$config->remove("verbose", "user");
-var_dump($config->get("verbose"));
-$config->remove("verbose", "system");
-var_dump($config->get("verbose"));
-
-print "\n#7 testing: getType\n";
-var_dump($config->getType("__unknown__"));
-var_dump($config->getType("verbose"));
-var_dump($config->getType("master_server"));
-var_dump($config->getType("ext_dir"));
-
-print "\n#8 testing: getDocs\n";
-print "master_server: " . $config->getDocs("master_server") . "\n";
-
-print "\n#9 testing: getKeys\n";
-$keys = $config->getKeys();
-sort($keys);
-print implode(" ", $keys) . "\n";
-
-print "\n#10 testing: definedBy\n";
-var_dump($config->definedBy("verbose"));
-$config->set("verbose", 6, "system");
-$config->set("verbose", 3, "user");
-var_dump($config->definedBy("verbose"));
-$config->remove("verbose", "system");
-var_dump($config->definedBy("verbose"));
-$config->set("verbose", 6, "system");
-$config->remove("verbose", "user");
-var_dump($config->definedBy("verbose"));
-$config->remove("verbose", "system");
-var_dump($config->definedBy("verbose"));
-
-print "\n#11 testing: isDefined\n";
-var_dump($config->isDefined("php_dir"));
-var_dump($config->isDefined("verbose"));
-var_dump($config->isDefined("HTTP_GET_VARS"));
-var_dump($config->isDefined("query"));
-
-print "\n#12 testing: getGroup\n";
-foreach ($keys as $key) {
- print "$key: ".$config->getGroup($key)."\n";
-}
-
-print "\n#13 testing: getGroups\n";
-$groups = $config->getGroups();
-sort($groups);
-print implode(", ", $groups) . "\n";
-
-print "\n#14 testing: getGroupKeys\n";
-foreach ($groups as $group) {
- $gk = $config->getGroupKeys($group);
- sort($gk);
- print "$group: " . implode(", ", $gk) . "\n";
-}
-
-print "\n#15 testing: getPrompt\n";
-foreach ($keys as $key) {
- print "$key: ".$config->getPrompt($key)."\n";
-}
-
-
-//
-
-print "done\n";
-
-unlink("user.conf");
-unlink("user2.conf");
-unlink("system.conf");
-unlink("merge.conf");
-
-// ------------------------------------------------------------------------- //
-
-function dump_file($file)
-{
- print "..$file:";
- $data = PEAR_Config::_readConfigDataFrom($file);
- if (empty($data)) {
- print " <empty>\n";
- return;
- }
- foreach ($data as $k => $v) {
- print " $k=\"$v\"";
- }
- print "\n";
-}
-
-function dump_files() {
- dump_file("system.conf");
- dump_file("user.conf");
-}
-
-function dump_array($name, $arr) {
- print "$name:";
- if (empty($arr)) {
- print " <empty>";
- } else {
- foreach ($arr as $k => $v) {
- print " $k=\"$v\"";
- }
- }
- print "\n";
-}
-
-function dump_config(&$obj, $layer = null) {
- if ($layer !== null) {
- dump_array($layer, $obj->configuration[$layer]);
- return;
- }
- foreach ($obj->configuration as $layer => $data) {
- if ($layer == "default") {
- continue;
- }
- dump_array($layer, $data);
- }
-}
-
-?>
---EXPECT--
-#0 starting up
-..system.conf: master_server="pear.php.net"
-..user.conf: <empty>
-
-#1 testing: constructor
-files: system="system.conf" user="user.conf"
-
-#2 testing: singleton
-string(4) "blah"
-string(4) "blah"
-
-#3 testing: readConfigFile
-user: verbose="2"
-system: master_server="pear.php.net"
-user: <empty>
-system: master_server="pear.php.net"
-
-#4 testing: mergeConfigFile
-user: verbose="2"
-user: verbose="100"
-user: verbose="2"
-user: <empty>
-unknown config file type `xyzzy'
-
-#5 testing: config file version detection
-toonew.conf: unknown version `2.0'
-
-#6 testing: get/set/remove
-int(1)
-int(100)
-int(2)
-int(50)
-int(2)
-int(1)
-
-#7 testing: getType
-bool(false)
-string(7) "integer"
-string(6) "string"
-string(9) "directory"
-
-#8 testing: getDocs
-master_server: name of the main PEAR server
-
-#9 testing: getKeys
-bin_dir cache_dir cache_ttl data_dir doc_dir ext_dir http_proxy master_server password php_dir preferred_state sig_bin sig_keydir sig_type test_dir umask username verbose
-
-#10 testing: definedBy
-string(7) "default"
-string(4) "user"
-string(4) "user"
-string(6) "system"
-string(7) "default"
-
-#11 testing: isDefined
-bool(true)
-bool(true)
-bool(false)
-bool(false)
-
-#12 testing: getGroup
-bin_dir: File Locations
-cache_dir: File Locations (Advanced)
-cache_ttl: Advanced
-data_dir: File Locations (Advanced)
-doc_dir: File Locations
-ext_dir: File Locations
-http_proxy: Internet Access
-master_server: Internet Access
-password: Maintainers
-php_dir: File Locations
-preferred_state: Advanced
-sig_bin: Maintainers
-sig_keydir: Maintainers
-sig_type: Maintainers
-test_dir: File Locations (Advanced)
-umask: Advanced
-username: Maintainers
-verbose: Advanced
-
-#13 testing: getGroups
-Advanced, File Locations, File Locations (Advanced), Internet Access, Maintainers
-
-#14 testing: getGroupKeys
-Advanced: cache_ttl, preferred_state, umask, verbose
-File Locations: bin_dir, doc_dir, ext_dir, php_dir
-File Locations (Advanced): cache_dir, data_dir, test_dir
-Internet Access: http_proxy, master_server
-Maintainers: password, sig_bin, sig_keydir, sig_type, username
-
-#15 testing: getPrompt
-bin_dir: PEAR executables directory
-cache_dir: PEAR Installer cache directory
-cache_ttl: Cache TimeToLive
-data_dir: PEAR data directory
-doc_dir: PEAR documentation directory
-ext_dir: PHP extension directory
-http_proxy: HTTP Proxy Server Address
-master_server: PEAR server
-password: PEAR password (for maintainers)
-php_dir: PEAR directory
-preferred_state: Preferred Package State
-sig_bin: Signature Handling Program
-sig_keydir: Signature Key Directory
-sig_type: Package Signature Type
-test_dir: PEAR test directory
-umask: Unix file mask
-username: PEAR username (for maintainers)
-verbose: Debug Log Level
-done
diff --git a/pear/tests/pear_error.phpt b/pear/tests/pear_error.phpt
deleted file mode 100644
index 51493633ea..0000000000
--- a/pear/tests/pear_error.phpt
+++ /dev/null
@@ -1,154 +0,0 @@
---TEST--
-PEAR_Error: basic test
---SKIPIF--
-skip
---FILE--
-<?php // -*- PHP -*-
-
-// Test for: PEAR.php
-// Parts tested: - PEAR_Error class
-// - PEAR::isError static method
-
-include dirname(__FILE__)."/../PEAR.php";
-
-function test_error_handler($errno, $errmsg, $file, $line, $vars) {
- $errortype = array (
- 1 => "Error",
- 2 => "Warning",
- 4 => "Parsing Error",
- 8 => "Notice",
- 16 => "Core Error",
- 32 => "Core Warning",
- 64 => "Compile Error",
- 128 => "Compile Warning",
- 256 => "User Error",
- 512 => "User Warning",
- 1024=> "User Notice"
- );
- if (preg_match('/^The call_user_method.. function is deprecated/',
- $errmsg)) {
- return;
- }
- $prefix = $errortype[$errno];
- $file = basename($file);
- print "\n$prefix: $errmsg in $file on line XXX\n";
-}
-
-error_reporting(E_ALL);
-set_error_handler("test_error_handler");
-
-class Foo_Error extends PEAR_Error
-{
- function Foo_Error($message = "unknown error", $code = null,
- $mode = null, $options = null, $userinfo = null)
- {
- $this->PEAR_Error($message, $code, $mode, $options, $userinfo);
- $this->error_message_prefix = 'Foo_Error prefix';
- }
-}
-
-class Test1 extends PEAR {
- function Test1() {
- $this->PEAR("Foo_Error");
- }
- function runtest() {
- return $this->raiseError("test error");
- }
-}
-
-function errorhandler(&$obj) {
- print "errorhandler function called, obj=".$obj->toString()."\n";
-}
-
-class errorclass {
- function errorhandler(&$obj) {
- print "errorhandler method called, obj=".$obj->toString()."\n";
- }
-}
-
-print "specify error class: ";
-$obj = new Test1;
-$err = $obj->runtest();
-print $err->toString() . "\n";
-
-$eo = new errorclass;
-
-print "default PEAR_Error: ";
-$err = new PEAR_Error;
-print $err->toString() . "\n";
-print "Testing it: ";
-var_dump(PEAR::isError($err));
-print "This is not an error: ";
-$str = "not an error";
-var_dump(PEAR::isError($str));
-
-print "Now trying a bunch of variations...\n";
-
-print "different message: ";
-$err = new PEAR_Error("test error");
-print $err->toString() . "\n";
-
-print "different message,code: ";
-$err = new PEAR_Error("test error", -42);
-print $err->toString() . "\n";
-
-print "mode=print: ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_PRINT);
-print $err->toString() . "\n";
-
-print "mode=callback(function): ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_CALLBACK, "errorhandler");
-
-print "mode=callback(method): ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_CALLBACK,
- array(&$eo, "errorhandler"));
-
-print "mode=print&trigger: ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_PRINT|PEAR_ERROR_TRIGGER);
-print $err->toString() . "\n";
-
-print "mode=trigger:";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER);
-print $err->toString() . "\n";
-
-print "mode=trigger,level=notice:";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
-print $err->toString() . "\n";
-
-print "mode=trigger,level=warning:";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER, E_USER_WARNING);
-print $err->toString() . "\n";
-
-print "mode=trigger,level=error:";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER, E_USER_ERROR);
-print $err->toString() . "\n";
-
-?>
---GET--
---POST--
---EXPECT--
-specify error class: [foo_error: message="test error" code=0 mode=return level=notice prefix="Foo_Error prefix" info=""]
-default PEAR_Error: [pear_error: message="unknown error" code=0 mode=return level=notice prefix="" info=""]
-Testing it: bool(true)
-This is not an error: bool(false)
-Now trying a bunch of variations...
-different message: [pear_error: message="test error" code=0 mode=return level=notice prefix="" info=""]
-different message,code: [pear_error: message="test error" code=-42 mode=return level=notice prefix="" info=""]
-mode=print: test error[pear_error: message="test error" code=-42 mode=print level=notice prefix="" info=""]
-mode=callback(function): errorhandler function called, obj=[pear_error: message="test error" code=-42 mode=callback callback=errorhandler prefix="" info=""]
-mode=callback(method): errorhandler method called, obj=[pear_error: message="test error" code=-42 mode=callback callback=errorclass::errorhandler prefix="" info=""]
-mode=print&trigger: test error
-User Notice: test error in PEAR.php on line XXX
-[pear_error: message="test error" code=-42 mode=print|trigger level=notice prefix="" info=""]
-mode=trigger:
-User Notice: test error in PEAR.php on line XXX
-[pear_error: message="test error" code=-42 mode=trigger level=notice prefix="" info=""]
-mode=trigger,level=notice:
-User Notice: test error in PEAR.php on line XXX
-[pear_error: message="test error" code=-42 mode=trigger level=notice prefix="" info=""]
-mode=trigger,level=warning:
-User Warning: test error in PEAR.php on line XXX
-[pear_error: message="test error" code=-42 mode=trigger level=warning prefix="" info=""]
-mode=trigger,level=error:
-User Error: test error in PEAR.php on line XXX
-[pear_error: message="test error" code=-42 mode=trigger level=error prefix="" info=""]
diff --git a/pear/tests/pear_error2.phpt b/pear/tests/pear_error2.phpt
deleted file mode 100644
index 4ae1c4b701..0000000000
--- a/pear/tests/pear_error2.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-PEAR_Error: die mode
---SKIPIF--
-skip
---FILE--
-<?php // -*- C++ -*-
-
-// Test for: PEAR.php
-// Parts tested: - PEAR_Error class
-// - PEAR::isError static method
-// testing PEAR_Error
-
-include dirname(__FILE__)."/../PEAR.php";
-
-error_reporting(E_ALL);
-
-print "mode=die: ";
-$err = new PEAR_Error("test error!!\n", -42, PEAR_ERROR_DIE);
-print $err->toString() . "\n";
-
-?>
---GET--
---POST--
---EXPECT--
-mode=die: test error!!
diff --git a/pear/tests/pear_error3.phpt b/pear/tests/pear_error3.phpt
deleted file mode 100644
index 4c89ae5a69..0000000000
--- a/pear/tests/pear_error3.phpt
+++ /dev/null
@@ -1,54 +0,0 @@
---TEST--
-PEAR_Error: default error handling
---SKIPIF--
-skip
---FILE--
-<?php // -*- PHP -*-
-
-// Test for: PEAR.php
-// Parts tested: - PEAR_Error class
-// - PEAR::setErrorHandling
-// - PEAR::raiseError method
-
-include dirname(__FILE__)."/../PEAR.php";
-
-error_reporting(E_ALL);
-
-function errorhandler($eobj)
-{
- if (PEAR::isError($eobj)) {
- print "errorhandler called with an error object.\n";
- print "error message: ".$eobj->getMessage()."\n";
- } else {
- print "errorhandler called, but without an error object.\n";
- }
-}
-
-// Test 1
-PEAR::setErrorHandling(PEAR_ERROR_PRINT, "OOPS: %s\n");
-$tmp = new PEAR;
-$tmp->raiseError("error happens");
-
-// Return PEAR to its original state
-$GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN;
-$GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE;
-$GLOBALS['_PEAR_default_error_callback'] = '';
-
-// Test 2
-$obj = new PEAR;
-$obj->setErrorHandling(PEAR_ERROR_PRINT);
-$obj->raiseError("error 1\n");
-$obj->setErrorHandling(null);
-$obj->raiseError("error 2\n");
-PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, "errorhandler");
-$obj->raiseError("error 3");
-$obj->setErrorHandling(PEAR_ERROR_PRINT);
-$obj->raiseError("error 4\n");
-
-?>
---EXPECT--
-OOPS: error happens
-error 1
-errorhandler called with an error object.
-error message: error 3
-error 4 \ No newline at end of file
diff --git a/pear/tests/pear_error4.phpt b/pear/tests/pear_error4.phpt
deleted file mode 100644
index 57f69359b8..0000000000
--- a/pear/tests/pear_error4.phpt
+++ /dev/null
@@ -1,104 +0,0 @@
---TEST--
-PEAR_Error: expected errors
---SKIPIF--
-skip
---FILE--
-<?php // -*- PHP -*-
-
-// Test for: PEAR.php
-// Parts tested: - PEAR_Error class
-// - PEAR::expectError
-// - PEAR::popExpect
-
-include dirname(__FILE__)."/../PEAR.php";
-
-error_reporting(E_ALL);
-
-function errorhandler($eobj)
-{
- if (PEAR::isError($eobj)) {
- print "error: ".$eobj->getMessage()."\n";
- } else {
- print "errorhandler called without error object\n";
- }
-}
-
-$obj = new PEAR;
-$obj->setErrorHandling(PEAR_ERROR_CALLBACK, "errorhandler");
-
-print "subtest 1\n";
-$obj->expectError(1);
-$obj->raiseError("1", 1);
-$obj->popExpect();
-$obj->raiseError("2", 2);
-
-print "subtest 2\n";
-$obj->expectError(3);
-$obj->expectError(2);
-$obj->raiseError("3", 3);
-
-print "subtest 3\n";
-$obj->popExpect();
-$obj->raiseError("3", 3);
-$obj->popExpect();
-
-print "subtest 4\n";
-$obj->expectError(array(1,2,3,4,5));
-$obj->raiseError("0", 0);
-$obj->raiseError("1", 1);
-$obj->raiseError("2", 2);
-$obj->raiseError("3", 3);
-$obj->raiseError("4", 4);
-$obj->raiseError("5", 5);
-$obj->raiseError("6", 6);
-$obj->raiseError("error");
-$obj->popExpect();
-
-print "subtest 5\n";
-$obj->expectError("*");
-$obj->raiseError("42", 42);
-$obj->raiseError("75", 75);
-$obj->raiseError("13", 13);
-$obj->popExpect();
-
-print "subtest 6\n";
-$obj->expectError();
-$obj->raiseError("123", 123);
-$obj->raiseError("456", 456);
-$obj->raiseError("789", 789);
-$obj->popExpect();
-
-print "subtest 7\n";
-$obj->expectError("syntax error");
-$obj->raiseError("type mismatch");
-$obj->raiseError("syntax error");
-$obj->popExpect();
-
-print "subtest 8\n";
-$obj->expectError(array(1, 2, 3));
-$obj->expectError(array(3, 4, 5));
-$obj->raiseError(4);
-$obj->delExpect(2);
-$obj->raiseError(3);
-$obj->delExpect(1, 3, 4, 5);
-$err = $obj->delExpect(2);
-
-?>
---EXPECT--
-subtest 1
-error: 2
-subtest 2
-error: 3
-subtest 3
-subtest 4
-error: 0
-error: 6
-error: error
-subtest 5
-subtest 6
-subtest 7
-error: type mismatch
-subtest 8
-error: 4
-error: 3
-error: The expected error you submitted does not exist
diff --git a/pear/tests/pear_registry.phpt b/pear/tests/pear_registry.phpt
deleted file mode 100644
index 0295ed922e..0000000000
--- a/pear/tests/pear_registry.phpt
+++ /dev/null
@@ -1,168 +0,0 @@
---TEST--
-PEAR_Registry
---SKIPIF--
-skip
---FILE--
-<?php
-
-error_reporting(E_ALL);
-include dirname(__FILE__)."/../PEAR/Registry.php";
-PEAR::setErrorHandling(PEAR_ERROR_DIE, "%s\n");
-cleanall();
-
-$files1 = array(
- "pkg1-1.php" => array(
- "role" => "php",
- ),
- "pkg1-2.php" => array(
- "role" => "php",
- "baseinstalldir" => "pkg1",
- ),
- );
-$files2 = array(
- "pkg2-1.php" => array(
- "role" => "php",
- ),
- "pkg2-2.php" => array(
- "role" => "php",
- "baseinstalldir" => "pkg2",
- ),
- );
-$files3 = array(
- "pkg3-1.php" => array(
- "role" => "php",
- ),
- "pkg3-2.php" => array(
- "role" => "php",
- "baseinstalldir" => "pkg3",
- ),
- );
-$files3_new = array(
- "pkg3-3.php" => array(
- "role" => "php",
- "baseinstalldir" => "pkg3",
- ),
- "pkg3-4.php" => array(
- "role" => "php",
- ),
- );
-
-print "creating registry object\n";
-$reg = new PEAR_Registry;
-$reg->statedir = getcwd();
-dumpall($reg);
-
-$reg->addPackage("pkg1", array("name" => "pkg1", "version" => "1.0", "filelist" => $files1));
-dumpall($reg);
-
-$reg->addPackage("pkg2", array("name" => "pkg2", "version" => "2.0", "filelist" => $files2));
-$reg->addPackage("pkg3", array("name" => "pkg3", "version" => "3.0", "filelist" => $files3));
-dumpall($reg);
-
-$reg->updatePackage("pkg2", array("version" => "2.1"));
-dumpall($reg);
-
-var_dump($reg->deletePackage("pkg2"));
-dumpall($reg);
-
-var_dump($reg->deletePackage("pkg2"));
-dumpall($reg);
-
-$reg->updatePackage("pkg3", array("version" => "3.1b1", "status" => "beta"));
-dumpall($reg);
-
-print_r($reg->checkFilemap(array_merge($files3, $files2)));
-
-$reg->updatePackage("pkg3", array("filelist" => $files3_new));
-dumpall($reg);
-
-print "tests done\n";
-
-cleanall();
-
-// ------------------------------------------------------------------------- //
-
-function cleanall()
-{
- $dp = opendir(".");
- while ($ent = readdir($dp)) {
- if (substr($ent, -4) == ".reg") {
- unlink($ent);
- }
- }
-}
-
-function dumpall(&$reg)
-{
- print "dumping registry...\n";
- $info = $reg->packageInfo();
- foreach ($info as $pkg) {
- print $pkg["name"] . ":";
- unset($pkg["name"]);
- foreach ($pkg as $k => $v) {
- if ($k == '_lastmodified') continue;
- if (is_array($v) && $k == 'filelist') {
- print " $k=array(";
- $i = 0;
- foreach ($v as $k2 => $v2) {
- if ($i++ > 0) print ",";
- print "{$k2}[";
- $j = 0;
- foreach ($v2 as $k3 => $v3) {
- if ($j++ > 0) print ",";
- print "$k3=$v3";
- }
- print "]";
- }
- print ")";
- } else {
- print " $k=\"$v\"";
- }
- }
- print "\n";
- }
- print "dump done\n";
-}
-
-?>
---EXPECT--
-creating registry object
-dumping registry...
-dump done
-dumping registry...
-pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1])
-dump done
-dumping registry...
-pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1])
-pkg2: version="2.0" filelist=array(pkg2-1.php[role=php],pkg2-2.php[role=php,baseinstalldir=pkg2])
-pkg3: version="3.0" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3])
-dump done
-dumping registry...
-pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1])
-pkg2: version="2.1" filelist=array(pkg2-1.php[role=php],pkg2-2.php[role=php,baseinstalldir=pkg2])
-pkg3: version="3.0" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3])
-dump done
-bool(true)
-dumping registry...
-pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1])
-pkg3: version="3.0" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3])
-dump done
-bool(false)
-dumping registry...
-pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1])
-pkg3: version="3.0" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3])
-dump done
-dumping registry...
-pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1])
-pkg3: version="3.1b1" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3]) status="beta"
-dump done
-Array
-(
- [pkg3-1.php] => pkg3
- [pkg3/pkg3-2.php] => pkg3
-)
-dumping registry...
-pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1])
-pkg3: version="3.1b1" filelist=array(pkg3-3.php[role=php,baseinstalldir=pkg3],pkg3-4.php[role=php]) status="beta"
-dump done
-tests done
diff --git a/pear/tests/pear_system.phpt b/pear/tests/pear_system.phpt
deleted file mode 100644
index 64f3d1143e..0000000000
--- a/pear/tests/pear_system.phpt
+++ /dev/null
@@ -1,101 +0,0 @@
---TEST--
-System commands tests
---SKIPIF--
-skip
---FILE--
-<?php
-error_reporting(E_ALL);
-require_once 'System.php';
-
-$sep = DIRECTORY_SEPARATOR;
-
-/*******************
- mkDir
-********************/
-// Single directory creation
-System::mkDir('singledir');
-if( !is_dir('singledir') ){
- print "System::mkDir('singledir'); failed\n";
-}
-
-// Multiple directory creation
-System::mkDir('dir1 dir2 dir3');
-if (!@is_dir('dir1') || !@is_dir('dir2') || !@is_dir('dir3')) {
- print "System::mkDir('dir1 dir2 dir3'); failed\n";
-}
-
-// Parent creation without "-p" fail
-if (@System::mkDir("dir4{$sep}dir3")) {
- print "System::mkDir(\"dir4{$sep}dir3\") did not failed\n";
-}
-
-// Create a directory which is a file already fail
-touch('file4');
-$res = @System::mkDir('file4 dir5');
-if ($res) {
- print "System::mkDir('file4 dir5') did not failed\n";
-}
-if (!@is_dir('dir5')) {
- print "System::mkDir('file4 dir5') failed\n";
-}
-
-// Parent directory creation
-System::mkDir("-p dir2{$sep}dir21 dir6{$sep}dir61{$sep}dir611");
-if (!@is_dir("dir2{$sep}dir21") || !@is_dir("dir6{$sep}dir61{$sep}dir611")) {
- print "System::mkDir(\"-p dir2{$sep}dir21 dir6{$sep}dir61{$sep}dir611\")); failed\n";
-}
-
-/*******************
- mkTemp
-********************/
-
-// Create a temporal file with "tst" as filename prefix
-$tmpfile = System::mkTemp('tst');
-$tmpenv = System::tmpDir();
-if (!@is_file($tmpfile) || !ereg("^$tmpenv{$sep}tst", $tmpfile)) {
- print "System::mkTemp('tst') failed\n";
-}
-
-// Create a temporal dir in "dir1" with default prefix "tmp"
-$tmpdir = System::mkTemp('-d -t dir1');
-if (!@is_dir($tmpdir) || !ereg("^dir1{$sep}tmp", $tmpdir)) {
- print "System::mkTemp('-d -t dir1') failed\n";
-}
-
-/*******************
- rm
-********************/
-
-// Try to delete a dir without "-r" option
-if (@System::rm('dir1')) {
- print "System::rm('dir1') did not fail\n";
-}
-
-// Multiple and recursive delete
-$del = "dir1 dir2 dir3 file4 dir5 dir6";
-if (!@System::rm("-r $del")) {
- print "System::rm(\"-r $del\") failed\n";
-}
-
-/*******************
- which
-********************/
-
-if (OS_UNIX) {
- if (System::which('ls') != '/bin/ls') {
- print "System::which('ls') failed\n";
- }
- if (System::which('i_am_not_a_command')) {
- print "System::which('i_am_not_a_command') did not failed\n";
- }
-} // XXX Windows test
-
-/*******************
- cat
-********************/
-// Missing tests yet
-
-print "end\n";
-?>
---EXPECT--
-end
diff --git a/pear/tests/php.ini b/pear/tests/php.ini
deleted file mode 100644
index c75c9b4f11..0000000000
--- a/pear/tests/php.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-; php.ini for PEAR tests
-include_path=..
diff --git a/pear/tests/system.input b/pear/tests/system.input
deleted file mode 100644
index 9c6bece157..0000000000
--- a/pear/tests/system.input
+++ /dev/null
@@ -1 +0,0 @@
-a:1:{s:13:"master_server";s:12:"pear.php.net";} \ No newline at end of file
diff --git a/pear/tests/toonew.conf b/pear/tests/toonew.conf
deleted file mode 100644
index 6f0c72fe4b..0000000000
--- a/pear/tests/toonew.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-#PEAR_Config 2.0
-master_server = pear.php.net
diff --git a/pear/tests/user.input b/pear/tests/user.input
deleted file mode 100644
index e69de29bb2..0000000000
--- a/pear/tests/user.input
+++ /dev/null
diff --git a/pear/tests/user2.input b/pear/tests/user2.input
deleted file mode 100644
index ac9a8afc0d..0000000000
--- a/pear/tests/user2.input
+++ /dev/null
@@ -1 +0,0 @@
-a:1:{s:7:"verbose";i:2;} \ No newline at end of file
diff --git a/php.gif b/php.gif
deleted file mode 100644
index 7beda43fd4..0000000000
--- a/php.gif
+++ /dev/null
Binary files differ
diff --git a/php.ini-dist b/php.ini-dist
deleted file mode 100644
index 994dc0e956..0000000000
--- a/php.ini-dist
+++ /dev/null
@@ -1,1126 +0,0 @@
-[PHP]
-
-;;;;;;;;;;;
-; WARNING ;
-;;;;;;;;;;;
-; This is the default settings file for new PHP installations.
-; By default, PHP installs itself with a configuration suitable for
-; development purposes, and *NOT* for production purposes.
-; For several security-oriented considerations that should be taken
-; before going online with your site, please consult php.ini-recommended
-; and http://php.net/manual/en/security.php.
-
-
-;;;;;;;;;;;;;;;;;;;
-; About this file ;
-;;;;;;;;;;;;;;;;;;;
-; This file controls many aspects of PHP's behavior. In order for PHP to
-; read it, it must be named 'php.ini'. PHP looks for it in the current
-; working directory, in the path designated by the environment variable
-; PHPRC, and in the path that was defined in compile time (in that order).
-; Under Windows, the compile-time path is the Windows directory. The
-; path in which the php.ini file is looked for can be overridden using
-; the -c argument in command line mode.
-;
-; The syntax of the file is extremely simple. Whitespace and Lines
-; beginning with a semicolon are silently ignored (as you probably guessed).
-; Section headers (e.g. [Foo]) are also silently ignored, even though
-; they might mean something in the future.
-;
-; Directives are specified using the following syntax:
-; directive = value
-; Directive names are *case sensitive* - foo=bar is different from FOO=bar.
-;
-; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one
-; of the INI constants (On, Off, True, False, Yes, No and None) or an expression
-; (e.g. E_ALL & ~E_NOTICE), or a quoted string ("foo").
-;
-; Expressions in the INI file are limited to bitwise operators and parentheses:
-; | bitwise OR
-; & bitwise AND
-; ~ bitwise NOT
-; ! boolean NOT
-;
-; Boolean flags can be turned on using the values 1, On, True or Yes.
-; They can be turned off using the values 0, Off, False or No.
-;
-; An empty string can be denoted by simply not writing anything after the equal
-; sign, or by using the None keyword:
-;
-; foo = ; sets foo to an empty string
-; foo = none ; sets foo to an empty string
-; foo = "none" ; sets foo to the string 'none'
-;
-; If you use constants in your value, and these constants belong to a
-; dynamically loaded extension (either a PHP extension or a Zend extension),
-; you may only use these constants *after* the line that loads the extension.
-;
-; All the values in the php.ini-dist file correspond to the builtin
-; defaults (that is, if no php.ini is used, or if you delete these lines,
-; the builtin defaults will be identical).
-
-
-;;;;;;;;;;;;;;;;;;;;
-; Language Options ;
-;;;;;;;;;;;;;;;;;;;;
-
-; Enable the PHP scripting language engine under Apache.
-engine = On
-
-; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
-; NOTE: Using short tags should be avoided when developing applications or
-; libraries that are meant for redistribution, or deployment on PHP
-; servers which are not under your control, because short tags may not
-; be supported on the target server. For portable, redistributable code,
-; be sure not to use short tags.
-short_open_tag = On
-
-; Allow ASP-style <% %> tags.
-asp_tags = Off
-
-; The number of significant digits displayed in floating point numbers.
-precision = 12
-
-; Enforce year 2000 compliance (will cause problems with non-compliant browsers)
-y2k_compliance = On
-
-; Output buffering allows you to send header lines (including cookies) even
-; after you send body content, at the price of slowing PHP's output layer a
-; bit. You can enable output buffering during runtime by calling the output
-; buffering functions. You can also enable output buffering for all files by
-; setting this directive to On. If you wish to limit the size of the buffer
-; to a certain size - you can use a maximum number of bytes instead of 'On', as
-; a value for this directive (e.g., output_buffering=4096).
-output_buffering = Off
-
-; You can redirect all of the output of your scripts to a function. For
-; example, if you set output_handler to "mb_output_handler", character
-; encoding will be transparently converted to the specified encoding.
-; Setting any output handler automatically turns on output buffering.
-; Note: People who wrote portable scripts should not depend on this ini
-; directive. Instead, explicitly set the output handler using ob_start().
-; Using this ini directive may cause problems unless you know what script
-; is doing.
-; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler"
-; and you cannot use both "ob_gzhandler" and "zlib.output_compression".
-;output_handler =
-
-; Transparent output compression using the zlib library
-; Valid values for this option are 'off', 'on', or a specific buffer size
-; to be used for compression (default is 4KB)
-; Note: Resulting chunk size may vary due to nature of compression. PHP
-; outputs chunks that are few hundreds bytes each as a result of
-; compression. If you prefer a larger chunk size for better
-; performance, enable output_buffering in addition.
-; Note: You need to use zlib.output_handler instead of the standard
-; output_handler, or otherwise the output will be corrupted.
-zlib.output_compression = Off
-
-; You cannot specify additional output handlers if zlib.output_compression
-; is activated here. This setting does the same as output_handler but in
-; a different order.
-;zlib.output_handler =
-
-; Implicit flush tells PHP to tell the output layer to flush itself
-; automatically after every output block. This is equivalent to calling the
-; PHP function flush() after each and every call to print() or echo() and each
-; and every HTML block. Turning this option on has serious performance
-; implications and is generally recommended for debugging purposes only.
-implicit_flush = Off
-
-; The unserialize callback function will called (with the undefind class'
-; name as parameter), if the unserializer finds an undefined class
-; which should be instanciated.
-; A warning appears if the specified function is not defined, or if the
-; function doesn't include/implement the missing class.
-; So only set this entry, if you really want to implement such a
-; callback-function.
-unserialize_callback_func=
-
-; When floats & doubles are serialized store serialize_precision significant
-; digits after the floating point. The default value ensures that when floats
-; are decoded with unserialize, the data will remain the same.
-serialize_precision = 100
-
-; Whether to enable the ability to force arguments to be passed by reference
-; at function call time. This method is deprecated and is likely to be
-; unsupported in future versions of PHP/Zend. The encouraged method of
-; specifying which arguments should be passed by reference is in the function
-; declaration. You're encouraged to try and turn this option Off and make
-; sure your scripts work properly with it in order to ensure they will work
-; with future versions of the language (you will receive a warning each time
-; you use this feature, and the argument will be passed by value instead of by
-; reference).
-allow_call_time_pass_reference = On
-
-; Safe Mode
-;
-safe_mode = Off
-
-; By default, Safe Mode does a UID compare check when
-; opening files. If you want to relax this to a GID compare,
-; then turn on safe_mode_gid.
-safe_mode_gid = Off
-
-; When safe_mode is on, UID/GID checks are bypassed when
-; including files from this directory and its subdirectories.
-; (directory must also be in include_path or full path must
-; be used when including)
-safe_mode_include_dir =
-
-; When safe_mode is on, only executables located in the safe_mode_exec_dir
-; will be allowed to be executed via the exec family of functions.
-safe_mode_exec_dir =
-
-; Setting certain environment variables may be a potential security breach.
-; This directive contains a comma-delimited list of prefixes. In Safe Mode,
-; the user may only alter environment variables whose names begin with the
-; prefixes supplied here. By default, users will only be able to set
-; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR).
-;
-; Note: If this directive is empty, PHP will let the user modify ANY
-; environment variable!
-safe_mode_allowed_env_vars = PHP_
-
-; This directive contains a comma-delimited list of environment variables that
-; the end user won't be able to change using putenv(). These variables will be
-; protected even if safe_mode_allowed_env_vars is set to allow to change them.
-safe_mode_protected_env_vars = LD_LIBRARY_PATH
-
-; open_basedir, if set, limits all file operations to the defined directory
-; and below. This directive makes most sense if used in a per-directory
-; or per-virtualhost web server configuration file. This directive is
-; *NOT* affected by whether Safe Mode is turned On or Off.
-;open_basedir =
-
-; This directive allows you to disable certain functions for security reasons.
-; It receives a comma-delimited list of function names. This directive is
-; *NOT* affected by whether Safe Mode is turned On or Off.
-disable_functions =
-
-; This directive allows you to disable certain classes for security reasons.
-; It receives a comma-delimited list of class names. This directive is
-; *NOT* affected by whether Safe Mode is turned On or Off.
-disable_classes =
-
-; Colors for Syntax Highlighting mode. Anything that's acceptable in
-; <font color="??????"> would work.
-;highlight.string = #DD0000
-;highlight.comment = #FF9900
-;highlight.keyword = #007700
-;highlight.bg = #FFFFFF
-;highlight.default = #0000BB
-;highlight.html = #000000
-
-
-;
-; Misc
-;
-; Decides whether PHP may expose the fact that it is installed on the server
-; (e.g. by adding its signature to the Web server header). It is no security
-; threat in any way, but it makes it possible to determine whether you use PHP
-; on your server or not.
-expose_php = On
-
-
-;;;;;;;;;;;;;;;;;;;
-; Resource Limits ;
-;;;;;;;;;;;;;;;;;;;
-
-max_execution_time = 30 ; Maximum execution time of each script, in seconds
-max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
-memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; Error handling and logging ;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-; error_reporting is a bit-field. Or each number up to get desired error
-; reporting level
-; E_ALL - All errors and warnings
-; E_ERROR - fatal run-time errors
-; E_WARNING - run-time warnings (non-fatal errors)
-; E_PARSE - compile-time parse errors
-; E_NOTICE - run-time notices (these are warnings which often result
-; from a bug in your code, but it's possible that it was
-; intentional (e.g., using an uninitialized variable and
-; relying on the fact it's automatically initialized to an
-; empty string)
-; E_CORE_ERROR - fatal errors that occur during PHP's initial startup
-; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's
-; initial startup
-; E_COMPILE_ERROR - fatal compile-time errors
-; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
-; E_USER_ERROR - user-generated error message
-; E_USER_WARNING - user-generated warning message
-; E_USER_NOTICE - user-generated notice message
-;
-; Examples:
-;
-; - Show all errors, except for notices
-;
-;error_reporting = E_ALL & ~E_NOTICE
-;
-; - Show only errors
-;
-;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
-;
-; - Show all errors except for notices
-;
-error_reporting = E_ALL & ~E_NOTICE
-
-; Print out errors (as a part of the output). For production web sites,
-; you're strongly encouraged to turn this feature off, and use error logging
-; instead (see below). Keeping display_errors enabled on a production web site
-; may reveal security information to end users, such as file paths on your Web
-; server, your database schema or other information.
-display_errors = On
-
-; Even when display_errors is on, errors that occur during PHP's startup
-; sequence are not displayed. It's strongly recommended to keep
-; display_startup_errors off, except for when debugging.
-display_startup_errors = Off
-
-; Log errors into a log file (server-specific log, stderr, or error_log (below))
-; As stated above, you're strongly advised to use error logging in place of
-; error displaying on production web sites.
-log_errors = Off
-
-; Set maximum length of log_errors. In error_log information about the source is
-; added. The default is 1024 and 0 allows to not apply any maximum length at all.
-log_errors_max_len = 1024
-
-; Do not log repeated messages. Repeated errors must occur in same file on same
-; line until ignore_repeated_source is set true.
-ignore_repeated_errors = Off
-
-; Ignore source of message when ignoring repeated messages. When this setting
-; is On you will not log errors with repeated messages from different files or
-; sourcelines.
-ignore_repeated_source = Off
-
-; If this parameter is set to Off, then memory leaks will not be shown (on
-; stdout or in the log). This has only effect in a debug compile, and if
-; error reporting includes E_WARNING in the allowed list
-report_memleaks = On
-
-; Store the last error/warning message in $php_errormsg (boolean).
-track_errors = Off
-
-; Disable the inclusion of HTML tags in error messages.
-; Note: Never use this feature for production boxes.
-;html_errors = Off
-
-; If html_errors is set On PHP produces clickable error messages that direct
-; to a page describing the error or function causing the error in detail.
-; You can download a copy of the PHP manual from http://www.php.net/docs.php
-; and change docref_root to the base URL of your local copy including the
-; leading '/'. You must also specify the file extension being used including
-; the dot.
-; Note: Never use this feature for production boxes.
-;docref_root = "/phpmanual/"
-;docref_ext = .html
-
-; String to output before an error message.
-;error_prepend_string = "<font color=ff0000>"
-
-; String to output after an error message.
-;error_append_string = "</font>"
-
-; Log errors to specified file.
-;error_log = filename
-
-; Log errors to syslog (Event Log on NT, not valid in Windows 95).
-;error_log = syslog
-
-
-;;;;;;;;;;;;;;;;;
-; Data Handling ;
-;;;;;;;;;;;;;;;;;
-;
-; Note - track_vars is ALWAYS enabled as of PHP 4.0.3
-
-; The separator used in PHP generated URLs to separate arguments.
-; Default is "&".
-;arg_separator.output = "&amp;"
-
-; List of separator(s) used by PHP to parse input URLs into variables.
-; Default is "&".
-; NOTE: Every character in this directive is considered as separator!
-;arg_separator.input = ";&"
-
-; This directive describes the order in which PHP registers GET, POST, Cookie,
-; Environment and Built-in variables (G, P, C, E & S respectively, often
-; referred to as EGPCS or GPC). Registration is done from left to right, newer
-; values override older values.
-variables_order = "EGPCS"
-
-; Whether or not to register the EGPCS variables as global variables. You may
-; want to turn this off if you don't want to clutter your scripts' global scope
-; with user data. This makes most sense when coupled with track_vars - in which
-; case you can access all of the GPC variables through the $HTTP_*_VARS[],
-; variables.
-;
-; You should do your best to write your scripts so that they do not require
-; register_globals to be on; Using form variables as globals can easily lead
-; to possible security problems, if the code is not very well thought of.
-register_globals = Off
-
-; Whether or not to register the old-style input arrays, HTTP_GET_VARS
-; and friends. If you're not using them, it's recommended to turn them off,
-; for performance reasons.
-register_long_arrays = On
-
-; This directive tells PHP whether to declare the argv&argc variables (that
-; would contain the GET information). If you don't use these variables, you
-; should turn it off for increased performance.
-register_argc_argv = On
-
-; Maximum size of POST data that PHP will accept.
-post_max_size = 8M
-
-; This directive is deprecated. Use variables_order instead.
-gpc_order = "GPC"
-
-; Magic quotes
-;
-
-; Magic quotes for incoming GET/POST/Cookie data.
-magic_quotes_gpc = On
-
-; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
-magic_quotes_runtime = Off
-
-; Use Sybase-style magic quotes (escape ' with '' instead of \').
-magic_quotes_sybase = Off
-
-; Automatically add files before or after any PHP document.
-auto_prepend_file =
-auto_append_file =
-
-; As of 4.0b4, PHP always outputs a character encoding by default in
-; the Content-type: header. To disable sending of the charset, simply
-; set it to be empty.
-;
-; PHP's built-in default is text/html
-default_mimetype = "text/html"
-;default_charset = "iso-8859-1"
-
-; Always populate the $HTTP_RAW_POST_DATA variable.
-;always_populate_raw_post_data = On
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;
-; Paths and Directories ;
-;;;;;;;;;;;;;;;;;;;;;;;;;
-
-; UNIX: "/path1:/path2"
-;include_path = ".:/php/includes"
-;
-; Windows: "\path1;\path2"
-;include_path = ".;c:\php\includes"
-
-; The root of the PHP pages, used only if nonempty.
-; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
-; if you are running php as a CGI under any web server (other than IIS)
-; see documentation for security issues. The alternate is to use the
-; cgi.force_redirect configuration below
-doc_root =
-
-; The directory under which PHP opens the script using /~username used only
-; if nonempty.
-user_dir =
-
-; Directory in which the loadable extensions (modules) reside.
-extension_dir = "./"
-
-; Whether or not to enable the dl() function. The dl() function does NOT work
-; properly in multithreaded servers, such as IIS or Zeus, and is automatically
-; disabled on them.
-enable_dl = On
-
-; cgi.force_redirect is necessary to provide security running PHP as a CGI under
-; most web servers. Left undefined, PHP turns this on by default. You can
-; turn it off here AT YOUR OWN RISK
-; **You CAN safely turn this off for IIS, in fact, you MUST.**
-; cgi.force_redirect = 1
-
-; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape
-; (iPlanet) web servers, you MAY need to set an environment variable name that PHP
-; will look for to know it is OK to continue execution. Setting this variable MAY
-; cause security issues, KNOW WHAT YOU ARE DOING FIRST.
-; cgi.redirect_status_env = ;
-
-; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate
-; security tokens of the calling client. This allows IIS to define the
-; security context that the request runs under. mod_fastcgi under Apache
-; does not currently support this feature (03/17/2002)
-; Set to 1 if running under IIS. Default is zero.
-; fastcgi.impersonate = 1;
-
-; cgi.rfc2616_headers configuration option tells PHP what type of headers to
-; use when sending HTTP response code. If it's set 0 PHP sends Status: header that
-; is supported by Apache. When this option is set to 1 PHP will send
-; RFC2616 compliant header.
-; Set to 1 if running under IIS. Default is zero.
-;cgi.rfc2616_headers = 0
-
-
-;;;;;;;;;;;;;;;;
-; File Uploads ;
-;;;;;;;;;;;;;;;;
-
-; Whether to allow HTTP file uploads.
-file_uploads = On
-
-; Temporary directory for HTTP uploaded files (will use system default if not
-; specified).
-;upload_tmp_dir =
-
-; Maximum allowed size for uploaded files.
-upload_max_filesize = 2M
-
-
-;;;;;;;;;;;;;;;;;;
-; Fopen wrappers ;
-;;;;;;;;;;;;;;;;;;
-
-; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
-allow_url_fopen = On
-
-; Define the anonymous ftp password (your email address)
-;from="john@doe.com"
-
-; Define the User-Agent string
-; user_agent="PHP"
-
-; Default timeout for socket based streams (seconds)
-default_socket_timeout = 60
-
-; If your scripts have to deal with files from Macintosh systems,
-; or you are running on a Mac and need to deal with files from
-; unix or win32 systems, setting this flag will cause PHP to
-; automatically detect the EOL character in those files so that
-; fgets() and file() will work regardless of the source of the file.
-; auto_detect_line_endings = Off
-
-
-;;;;;;;;;;;;;;;;;;;;;;
-; Dynamic Extensions ;
-;;;;;;;;;;;;;;;;;;;;;;
-;
-; If you wish to have an extension loaded automatically, use the following
-; syntax:
-;
-; extension=modulename.extension
-;
-; For example, on Windows:
-;
-; extension=msql.dll
-;
-; ... or under UNIX:
-;
-; extension=msql.so
-;
-; Note that it should be the name of the module only; no directory information
-; needs to go here. Specify the location of the extension with the
-; extension_dir directive above.
-
-
-;Windows Extensions
-;Note that MySQL and ODBC support is now built in, so no dll is needed for it.
-;
-;extension=php_bz2.dll
-;extension=php_cpdf.dll
-;extension=php_crack.dll
-;extension=php_curl.dll
-;extension=php_db.dll
-;extension=php_dba.dll
-;extension=php_dbase.dll
-;extension=php_dbx.dll
-;extension=php_domxml.dll
-;extension=php_exif.dll
-;extension=php_fdf.dll
-;extension=php_filepro.dll
-;extension=php_gd2.dll
-;extension=php_gettext.dll
-;extension=php_hyperwave.dll
-;extension=php_iconv.dll
-;extension=php_ifx.dll
-;extension=php_iisfunc.dll
-;extension=php_imap.dll
-;extension=php_interbase.dll
-;extension=php_java.dll
-;extension=php_ldap.dll
-;extension=php_mbstring.dll
-;extension=php_mcrypt.dll
-;extension=php_mhash.dll
-;extension=php_mime_magic.dll
-;extension=php_ming.dll
-;extension=php_mssql.dll
-;extension=php_msql.dll
-;extension=php_oci8.dll
-;extension=php_openssl.dll
-;extension=php_oracle.dll
-;extension=php_pdf.dll
-;extension=php_pgsql.dll
-;extension=php_printer.dll
-;extension=php_shmop.dll
-;extension=php_snmp.dll
-;extension=php_sockets.dll
-;extension=php_sybase_ct.dll
-;extension=php_w32api.dll
-;extension=php_xmlrpc.dll
-;extension=php_xslt.dll
-;extension=php_yaz.dll
-;extension=php_zip.dll
-
-
-;;;;;;;;;;;;;;;;;;;
-; Module Settings ;
-;;;;;;;;;;;;;;;;;;;
-
-[Syslog]
-; Whether or not to define the various syslog variables (e.g. $LOG_PID,
-; $LOG_CRON, etc.). Turning it off is a good idea performance-wise. In
-; runtime, you can define these variables by calling define_syslog_variables().
-define_syslog_variables = Off
-
-[mail function]
-; For Win32 only.
-SMTP = localhost
-
-; For Win32 only.
-sendmail_from = me@localhost.com
-
-; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
-;sendmail_path =
-
-[Java]
-;java.class.path = .\php_java.jar
-;java.home = c:\jdk
-;java.library = c:\jdk\jre\bin\hotspot\jvm.dll
-;java.library.path = .\
-
-[SQL]
-sql.safe_mode = Off
-
-[ODBC]
-;odbc.default_db = Not yet implemented
-;odbc.default_user = Not yet implemented
-;odbc.default_pw = Not yet implemented
-
-; Allow or prevent persistent links.
-odbc.allow_persistent = On
-
-; Check that a connection is still valid before reuse.
-odbc.check_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-odbc.max_persistent = -1
-
-; Maximum number of links (persistent + non-persistent). -1 means no limit.
-odbc.max_links = -1
-
-; Handling of LONG fields. Returns number of bytes to variables. 0 means
-; passthru.
-odbc.defaultlrl = 4096
-
-; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char.
-; See the documentation on odbc_binmode and odbc_longreadlen for an explanation
-; of uodbc.defaultlrl and uodbc.defaultbinmode
-odbc.defaultbinmode = 1
-
-[MySQL]
-; Allow or prevent persistent links.
-mysql.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-mysql.max_persistent = -1
-
-; Maximum number of links (persistent + non-persistent). -1 means no limit.
-mysql.max_links = -1
-
-; Default port number for mysql_connect(). If unset, mysql_connect() will use
-; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
-; compile-time value defined MYSQL_PORT (in that order). Win32 will only look
-; at MYSQL_PORT.
-mysql.default_port =
-
-; Default socket name for local MySQL connects. If empty, uses the built-in
-; MySQL defaults.
-mysql.default_socket =
-
-; Default host for mysql_connect() (doesn't apply in safe mode).
-mysql.default_host =
-
-; Default user for mysql_connect() (doesn't apply in safe mode).
-mysql.default_user =
-
-; Default password for mysql_connect() (doesn't apply in safe mode).
-; Note that this is generally a *bad* idea to store passwords in this file.
-; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
-; and reveal this password! And of course, any users with read access to this
-; file will be able to reveal the password as well.
-mysql.default_password =
-
-; Maximum time (in secondes) for connect timeout. -1 means no limimt
-mysql.connect_timeout = -1
-
-; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
-; SQL-Erros will be displayed.
-mysql.trace_mode = Off
-
-[mSQL]
-; Allow or prevent persistent links.
-msql.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-msql.max_persistent = -1
-
-; Maximum number of links (persistent+non persistent). -1 means no limit.
-msql.max_links = -1
-
-[PostgresSQL]
-; Allow or prevent persistent links.
-pgsql.allow_persistent = On
-
-; Detect broken persistent links always with pg_pconnect(). Need a little overhead.
-pgsql.auto_reset_persistent = Off
-
-; Maximum number of persistent links. -1 means no limit.
-pgsql.max_persistent = -1
-
-; Maximum number of links (persistent+non persistent). -1 means no limit.
-pgsql.max_links = -1
-
-; Ignore PostgreSQL backends Notice message or not.
-pgsql.ignore_notice = 0
-
-; Log PostgreSQL backends Noitce message or not.
-; Unless pgsql.ignore_notice=0, module cannot log notice message.
-pgsql.log_notice = 0
-
-[Sybase]
-; Allow or prevent persistent links.
-sybase.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-sybase.max_persistent = -1
-
-; Maximum number of links (persistent + non-persistent). -1 means no limit.
-sybase.max_links = -1
-
-;sybase.interface_file = "/usr/sybase/interfaces"
-
-; Minimum error severity to display.
-sybase.min_error_severity = 10
-
-; Minimum message severity to display.
-sybase.min_message_severity = 10
-
-; Compatability mode with old versions of PHP 3.0.
-; If on, this will cause PHP to automatically assign types to results according
-; to their Sybase type, instead of treating them all as strings. This
-; compatability mode will probably not stay around forever, so try applying
-; whatever necessary changes to your code, and turn it off.
-sybase.compatability_mode = Off
-
-[Sybase-CT]
-; Allow or prevent persistent links.
-sybct.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-sybct.max_persistent = -1
-
-; Maximum number of links (persistent + non-persistent). -1 means no limit.
-sybct.max_links = -1
-
-; Minimum server message severity to display.
-sybct.min_server_severity = 10
-
-; Minimum client message severity to display.
-sybct.min_client_severity = 10
-
-[dbx]
-; returned column names can be converted for compatibility reasons
-; possible values for dbx.colnames_case are
-; "unchanged" (default, if not set)
-; "lowercase"
-; "uppercase"
-; the recommended default is either upper- or lowercase, but
-; unchanged is currently set for backwards compatibility
-dbx.colnames_case = "unchanged"
-
-[bcmath]
-; Number of decimal digits for all bcmath functions.
-bcmath.scale = 0
-
-[browscap]
-;browscap = extra/browscap.ini
-
-[Informix]
-; Default host for ifx_connect() (doesn't apply in safe mode).
-ifx.default_host =
-
-; Default user for ifx_connect() (doesn't apply in safe mode).
-ifx.default_user =
-
-; Default password for ifx_connect() (doesn't apply in safe mode).
-ifx.default_password =
-
-; Allow or prevent persistent links.
-ifx.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-ifx.max_persistent = -1
-
-; Maximum number of links (persistent + non-persistent). -1 means no limit.
-ifx.max_links = -1
-
-; If on, select statements return the contents of a text blob instead of its id.
-ifx.textasvarchar = 0
-
-; If on, select statements return the contents of a byte blob instead of its id.
-ifx.byteasvarchar = 0
-
-; Trailing blanks are stripped from fixed-length char columns. May help the
-; life of Informix SE users.
-ifx.charasvarchar = 0
-
-; If on, the contents of text and byte blobs are dumped to a file instead of
-; keeping them in memory.
-ifx.blobinfile = 0
-
-; NULL's are returned as empty strings, unless this is set to 1. In that case,
-; NULL's are returned as string 'NULL'.
-ifx.nullformat = 0
-
-[Session]
-; Handler used to store/retrieve data.
-session.save_handler = files
-
-; Argument passed to save_handler. In the case of files, this is the path
-; where data files are stored. Note: Windows users have to change this
-; variable in order to use PHP's session functions.
-;
-; As of PHP 4.0.1, you can define the path as:
-;
-; session.save_path = "N;/path"
-;
-; where N is an integer. Instead of storing all the session files in
-; /path, what this will do is use subdirectories N-levels deep, and
-; store the session data in those directories. This is useful if you
-; or your OS have problems with lots of files in one directory, and is
-; a more efficient layout for servers that handle lots of sessions.
-;
-; NOTE 1: PHP will not create this directory structure automatically.
-; You can use the script in the ext/session dir for that purpose.
-; NOTE 2: See the section on garbage collection below if you choose to
-; use subdirectories for session storage
-;
-; The file storage module creates files using mode 600 by default.
-; You can change that by using
-;
-; session.save_path = "N;MODE;/path"
-;
-; where MODE is the octal representation of the mode. Note that this
-; does not overwrite the process's umask.
-session.save_path = "/tmp"
-
-; Whether to use cookies.
-session.use_cookies = 1
-
-; This option enables administrators to make their users invulnerable to
-; attacks which involve passing session ids in URLs; defaults to 0.
-; session.use_only_cookies = 1
-
-; Name of the session (used as cookie name).
-session.name = PHPSESSID
-
-; Initialize session on request startup.
-session.auto_start = 0
-
-; Lifetime in seconds of cookie or, if 0, until browser is restarted.
-session.cookie_lifetime = 0
-
-; The path for which the cookie is valid.
-session.cookie_path = /
-
-; The domain for which the cookie is valid.
-session.cookie_domain =
-
-; Handler used to serialize data. php is the standard serializer of PHP.
-session.serialize_handler = php
-
-; Define the probability that the 'garbage collection' process is started
-; on every session initialization.
-; The probability is calculated by using gc_probability/gc_divisor,
-; e.g. 1/100 means there is a 1% chance that the GC process starts
-; on each request.
-
-session.gc_probability = 1
-session.gc_divisor = 100
-
-; After this number of seconds, stored data will be seen as 'garbage' and
-; cleaned up by the garbage collection process.
-session.gc_maxlifetime = 1440
-
-; NOTE: If you are using the subdirectory option for storing session files
-; (see session.save_path above), then garbage collection does *not*
-; happen automatically. You will need to do your own garbage
-; collection through a shell script, cron entry, or some other method.
-; For example, the following script would is the equivalent of
-; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
-; cd /path/to/sessions; find -cmin +24 | xargs rm
-
-; PHP 4.2 and less have an undocumented feature/bug that allows you to
-; to initialize a session variable in the global scope, albeit register_globals
-; is disabled. PHP 4.3 and later will warn you, if this feature is used.
-; You can disable the feature and the warning seperately. At this time,
-; the warning is only displayed, if bug_compat_42 is enabled.
-
-session.bug_compat_42 = 1
-session.bug_compat_warn = 1
-
-; Check HTTP Referer to invalidate externally stored URLs containing ids.
-; HTTP_REFERER has to contain this substring for the session to be
-; considered as valid.
-session.referer_check =
-
-; How many bytes to read from the file.
-session.entropy_length = 0
-
-; Specified here to create the session id.
-session.entropy_file =
-
-;session.entropy_length = 16
-
-;session.entropy_file = /dev/urandom
-
-; Set to {nocache,private,public,} to determine HTTP caching aspects
-; or leave this empty to avoid sending anti-caching headers.
-session.cache_limiter = nocache
-
-; Document expires after n minutes.
-session.cache_expire = 180
-
-; trans sid support is disabled by default.
-; Use of trans sid may risk your users security.
-; Use this option with caution.
-; - User may send URL contains active session ID
-; to other person via. email/irc/etc.
-; - URL that contains active session ID may be stored
-; in publically accessible computer.
-; - User may access your site with the same session ID
-; always using URL stored in browser's history or bookmarks.
-session.use_trans_sid = 0
-
-; Select a hash function
-; 0: MD5 (128 bits)
-; 1: SHA-1 (160 bits)
-session.hash_function = 0
-
-; Define how many bits are stored in each character when converting
-; the binary hash data to something readable.
-;
-; 4 bits: 0-9, a-f
-; 5 bits: 0-9, a-v
-; 6 bits: 0-9, a-z, A-Z, "-", ","
-session.hash_bits_per_character = 4
-
-; The URL rewriter will look for URLs in a defined set of HTML tags.
-; form/fieldset are special; if you include them here, the rewriter will
-; add a hidden <input> field with the info which is otherwise appended
-; to URLs. If you want XHTML conformity, remove the form entry.
-; Note that all valid entries require a "=", even if no value follows.
-url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="
-
-[MSSQL]
-; Allow or prevent persistent links.
-mssql.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-mssql.max_persistent = -1
-
-; Maximum number of links (persistent+non persistent). -1 means no limit.
-mssql.max_links = -1
-
-; Minimum error severity to display.
-mssql.min_error_severity = 10
-
-; Minimum message severity to display.
-mssql.min_message_severity = 10
-
-; Compatability mode with old versions of PHP 3.0.
-mssql.compatability_mode = Off
-
-; Valid range 0 - 2147483647. Default = 4096.
-;mssql.textlimit = 4096
-
-; Valid range 0 - 2147483647. Default = 4096.
-;mssql.textsize = 4096
-
-; Limits the number of records in each batch. 0 = all records in one batch.
-;mssql.batchsize = 0
-
-; Use NT authentication when connecting to the server
-mssql.secure_connection = Off
-
-; Specify max number of processes. Default = 25
-;mssql.max_procs = 25
-
-[Assertion]
-; Assert(expr); active by default.
-;assert.active = On
-
-; Issue a PHP warning for each failed assertion.
-;assert.warning = On
-
-; Don't bail out by default.
-;assert.bail = Off
-
-; User-function to be called if an assertion fails.
-;assert.callback = 0
-
-; Eval the expression with current error_reporting(). Set to true if you want
-; error_reporting(0) around the eval().
-;assert.quiet_eval = 0
-
-[Ingres II]
-; Allow or prevent persistent links.
-ingres.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-ingres.max_persistent = -1
-
-; Maximum number of links, including persistents. -1 means no limit.
-ingres.max_links = -1
-
-; Default database (format: [node_id::]dbname[/srv_class]).
-ingres.default_database =
-
-; Default user.
-ingres.default_user =
-
-; Default password.
-ingres.default_password =
-
-[Verisign Payflow Pro]
-; Default Payflow Pro server.
-pfpro.defaulthost = "test-payflow.verisign.com"
-
-; Default port to connect to.
-pfpro.defaultport = 443
-
-; Default timeout in seconds.
-pfpro.defaulttimeout = 30
-
-; Default proxy IP address (if required).
-;pfpro.proxyaddress =
-
-; Default proxy port.
-;pfpro.proxyport =
-
-; Default proxy logon.
-;pfpro.proxylogon =
-
-; Default proxy password.
-;pfpro.proxypassword =
-
-[Sockets]
-; Use the system read() function instead of the php_read() wrapper.
-sockets.use_system_read = On
-
-[com]
-; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
-;com.typelib_file =
-; allow Distributed-COM calls
-;com.allow_dcom = true
-; autoregister constants of a components typlib on com_load()
-;com.autoregister_typelib = true
-; register constants casesensitive
-;com.autoregister_casesensitive = false
-; show warnings on duplicate constat registrations
-;com.autoregister_verbose = true
-
-[Printer]
-;printer.default_printer = ""
-
-[mbstring]
-; language for internal character representation.
-;mbstring.language = Japanese
-
-; internal/script encoding.
-; Some encoding cannot work as internal encoding.
-; (e.g. SJIS, BIG5, ISO-2022-*)
-;mbstring.internal_encoding = EUC-JP
-
-; http input encoding.
-;mbstring.http_input = auto
-
-; http output encoding. mb_output_handler must be
-; registered as output buffer to function
-;mbstring.http_output = SJIS
-
-; enable automatic encoding translation accoding to
-; mbstring.internal_encoding setting. Input chars are
-; converted to internal encoding by setting this to On.
-; Note: Do _not_ use automatic encoding translation for
-; portable libs/applications.
-;mbstring.encoding_translation = Off
-
-; automatic encoding detection order.
-; auto means
-;mbstring.detect_order = auto
-
-; substitute_character used when character cannot be converted
-; one from another
-;mbstring.substitute_character = none;
-
-; overload(replace) single byte functions by mbstring functions.
-; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
-; etc. Possible values are 0,1,2,4 or combination of them.
-; For example, 7 for overload everything.
-; 0: No overload
-; 1: Overload mail() function
-; 2: Overload str*() functions
-; 4: Overload ereg*() functions
-;mbstring.func_overload = 0
-
-[FrontBase]
-;fbsql.allow_persistent = On
-;fbsql.autocommit = On
-;fbsql.default_database =
-;fbsql.default_database_password =
-;fbsql.default_host =
-;fbsql.default_password =
-;fbsql.default_user = "_SYSTEM"
-;fbsql.generate_warnings = Off
-;fbsql.max_connections = 128
-;fbsql.max_links = 128
-;fbsql.max_persistent = -1
-;fbsql.max_results = 128
-;fbsql.batchSize = 1000
-
-[Crack]
-; Modify the setting below to match the directory location of the cracklib
-; dictionary files. Include the base filename, but not the file extension.
-; crack.default_dictionary = "c:\php\lib\cracklib_dict"
-
-[exif]
-; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS.
-; With mbstring support this will automatically be converted into the encoding
-; given by corresponding encode setting. When empty mbstring.internal_encoding
-; is used. For the decode settings you can distinguish between motorola and
-; intel byte order. A decode setting cannot be empty.
-;exif.encode_unicode = ISO-8859-15
-;exif.decode_unicode_motorola = UCS-2BE
-;exif.decode_unicode_intel = UCS-2LE
-;exif.encode_jis =
-;exif.decode_jis_motorola = JIS
-;exif.decode_jis_intel = JIS
-
-; Local Variables:
-; tab-width: 4
-; End:
diff --git a/php.ini-recommended b/php.ini-recommended
deleted file mode 100644
index 5ebd39494b..0000000000
--- a/php.ini-recommended
+++ /dev/null
@@ -1,1135 +0,0 @@
-[PHP]
-
-;;;;;;;;;;;;;;;;;;;
-; About this file ;
-;;;;;;;;;;;;;;;;;;;
-;
-; This is the recommended, PHP 4-style version of the php.ini-dist file. It
-; sets some non standard settings, that make PHP more efficient, more secure,
-; and encourage cleaner coding.
-; The price is that with these settings, PHP may be incompatible with some
-; applications, and sometimes, more difficult to develop with. Using this
-; file is warmly recommended for production sites. As all of the changes from
-; the standard settings are thoroughly documented, you can go over each one,
-; and decide whether you want to use it or not.
-;
-; For general information about the php.ini file, please consult the php.ini-dist
-; file, included in your PHP distribution.
-;
-; This file is different from the php.ini-dist file in the fact that it features
-; different values for several directives, in order to improve performance, while
-; possibly breaking compatibility with the standard out-of-the-box behavior of
-; PHP 3. Please make sure you read what's different, and modify your scripts
-; accordingly, if you decide to use this file instead.
-;
-; - register_globals = Off [Security, Performance]
-; Global variables are no longer registered for input data (POST, GET, cookies,
-; environment and other server variables). Instead of using $foo, you must use
-; you can use $_REQUEST["foo"] (includes any variable that arrives through the
-; request, namely, POST, GET and cookie variables), or use one of the specific
-; $_GET["foo"], $_POST["foo"], $_COOKIE["foo"] or $_FILES["foo"], depending
-; on where the input originates. Also, you can look at the
-; import_request_variables() function.
-; Note that register_globals is going to be depracated (i.e., turned off by
-; default) in the next version of PHP, because it often leads to security bugs.
-; Read http://php.net/manual/en/security.registerglobals.php for further
-; information.
-; - display_errors = Off [Security]
-; With this directive set to off, errors that occur during the execution of
-; scripts will no longer be displayed as a part of the script output, and thus,
-; will no longer be exposed to remote users. With some errors, the error message
-; content may expose information about your script, web server, or database
-; server that may be exploitable for hacking. Production sites should have this
-; directive set to off.
-; - log_errors = On [Security]
-; This directive complements the above one. Any errors that occur during the
-; execution of your script will be logged (typically, to your server's error log,
-; but can be configured in several ways). Along with setting display_errors to off,
-; this setup gives you the ability to fully understand what may have gone wrong,
-; without exposing any sensitive information to remote users.
-; - output_buffering = 4096 [Performance]
-; Set a 4KB output buffer. Enabling output buffering typically results in less
-; writes, and sometimes less packets sent on the wire, which can often lead to
-; better performance. The gain this directive actually yields greatly depends
-; on which Web server you're working with, and what kind of scripts you're using.
-; - register_argc_argv = Off [Performance]
-; Disables registration of the somewhat redundant $argv and $argc global
-; variables.
-; - magic_quotes_gpc = Off [Performance]
-; Input data is no longer escaped with slashes so that it can be sent into
-; SQL databases without further manipulation. Instead, you should use the
-; function addslashes() on each input element you wish to send to a database.
-; - variables_order = "GPCS" [Performance]
-; The environment variables are not hashed into the $HTTP_ENV_VARS[]. To access
-; environment variables, you can use getenv() instead.
-; - error_reporting = E_ALL [Code Cleanliness, Security(?)]
-; By default, PHP surpresses errors of type E_NOTICE. These error messages
-; are emitted for non-critical errors, but that could be a symptom of a bigger
-; problem. Most notably, this will cause error messages about the use
-; of uninitialized variables to be displayed.
-; - allow_call_time_pass_reference = Off [Code cleanliness]
-; It's not possible to decide to force a variable to be passed by reference
-; when calling a function. The PHP 4 style to do this is by making the
-; function require the relevant argument by reference.
-
-
-;;;;;;;;;;;;;;;;;;;;
-; Language Options ;
-;;;;;;;;;;;;;;;;;;;;
-
-; Enable the PHP scripting language engine under Apache.
-engine = On
-
-; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
-; NOTE: Using short tags should be avoided when developing applications or
-; libraries that are meant for redistribution, or deployment on PHP
-; servers which are not under your control, because short tags may not
-; be supported on the target server. For portable, redistributable code,
-; be sure not to use short tags.
-short_open_tag = On
-
-; Allow ASP-style <% %> tags.
-asp_tags = Off
-
-; The number of significant digits displayed in floating point numbers.
-precision = 14
-
-; Enforce year 2000 compliance (will cause problems with non-compliant browsers)
-y2k_compliance = On
-
-; Output buffering allows you to send header lines (including cookies) even
-; after you send body content, at the price of slowing PHP's output layer a
-; bit. You can enable output buffering during runtime by calling the output
-; buffering functions. You can also enable output buffering for all files by
-; setting this directive to On. If you wish to limit the size of the buffer
-; to a certain size - you can use a maximum number of bytes instead of 'On', as
-; a value for this directive (e.g., output_buffering=4096).
-output_buffering = 4096
-
-; You can redirect all of the output of your scripts to a function. For
-; example, if you set output_handler to "mb_output_handler", character
-; encoding will be transparently converted to the specified encoding.
-; Setting any output handler automatically turns on output buffering.
-; Note: People who wrote portable scripts should not depend on this ini
-; directive. Instead, explicitly set the output handler using ob_start().
-; Using this ini directive may cause problems unless you know what script
-; is doing.
-; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler"
-; and you cannot use both "ob_gzhandler" and "zlib.output_compression".
-;output_handler =
-
-; Transparent output compression using the zlib library
-; Valid values for this option are 'off', 'on', or a specific buffer size
-; to be used for compression (default is 4KB)
-; Note: Resulting chunk size may vary due to nature of compression. PHP
-; outputs chunks that are few handreds bytes each as a result of compression.
-; If you want larger chunk size for better performence, enable output_buffering
-; also.
-; Note: output_handler must be empty if this is set 'On' !!!!
-; Instead you must use zlib.output_handler.
-zlib.output_compression = Off
-
-; You cannot specify additional output handlers if zlib.output_compression
-; is activated here. This setting does the same as output_handler but in
-; a different order.
-;zlib.output_handler =
-
-; Implicit flush tells PHP to tell the output layer to flush itself
-; automatically after every output block. This is equivalent to calling the
-; PHP function flush() after each and every call to print() or echo() and each
-; and every HTML block. Turning this option on has serious performance
-; implications and is generally recommended for debugging purposes only.
-implicit_flush = Off
-
-; The unserialize callback function will called (with the undefind class'
-; name as parameter), if the unserializer finds an undefined class
-; which should be instanciated.
-; A warning appears if the specified function is not defined, or if the
-; function doesn't include/implement the missing class.
-; So only set this entry, if you really want to implement such a
-; callback-function.
-unserialize_callback_func=
-
-; When floats & doubles are serialized store serialize_precision significant
-; digits after the floating point. The default value ensures that when floats
-; are decoded with unserialize, the data will remain the same.
-serialize_precision = 100
-
-; Whether to enable the ability to force arguments to be passed by reference
-; at function call time. This method is deprecated and is likely to be
-; unsupported in future versions of PHP/Zend. The encouraged method of
-; specifying which arguments should be passed by reference is in the function
-; declaration. You're encouraged to try and turn this option Off and make
-; sure your scripts work properly with it in order to ensure they will work
-; with future versions of the language (you will receive a warning each time
-; you use this feature, and the argument will be passed by value instead of by
-; reference).
-allow_call_time_pass_reference = Off
-
-;
-; Safe Mode
-;
-safe_mode = Off
-
-; By default, Safe Mode does a UID compare check when
-; opening files. If you want to relax this to a GID compare,
-; then turn on safe_mode_gid.
-safe_mode_gid = Off
-
-; When safe_mode is on, UID/GID checks are bypassed when
-; including files from this directory and its subdirectories.
-; (directory must also be in include_path or full path must
-; be used when including)
-safe_mode_include_dir =
-
-; When safe_mode is on, only executables located in the safe_mode_exec_dir
-; will be allowed to be executed via the exec family of functions.
-safe_mode_exec_dir =
-
-; Setting certain environment variables may be a potential security breach.
-; This directive contains a comma-delimited list of prefixes. In Safe Mode,
-; the user may only alter environment variables whose names begin with the
-; prefixes supplied here. By default, users will only be able to set
-; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR).
-;
-; Note: If this directive is empty, PHP will let the user modify ANY
-; environment variable!
-safe_mode_allowed_env_vars = PHP_
-
-; This directive contains a comma-delimited list of environment variables that
-; the end user won't be able to change using putenv(). These variables will be
-; protected even if safe_mode_allowed_env_vars is set to allow to change them.
-safe_mode_protected_env_vars = LD_LIBRARY_PATH
-
-; open_basedir, if set, limits all file operations to the defined directory
-; and below. This directive makes most sense if used in a per-directory
-; or per-virtualhost web server configuration file. This directive is
-; *NOT* affected by whether Safe Mode is turned On or Off.
-;open_basedir =
-
-; This directive allows you to disable certain functions for security reasons.
-; It receives a comma-delimited list of function names. This directive is
-; *NOT* affected by whether Safe Mode is turned On or Off.
-disable_functions =
-
-; This directive allows you to disable certain classes for security reasons.
-; It receives a comma-delimited list of class names. This directive is
-; *NOT* affected by whether Safe Mode is turned On or Off.
-disable_classes =
-
-; Colors for Syntax Highlighting mode. Anything that's acceptable in
-; <font color="??????"> would work.
-;highlight.string = #DD0000
-;highlight.comment = #FF9900
-;highlight.keyword = #007700
-;highlight.bg = #FFFFFF
-;highlight.default = #0000BB
-;highlight.html = #000000
-
-
-;
-; Misc
-;
-; Decides whether PHP may expose the fact that it is installed on the server
-; (e.g. by adding its signature to the Web server header). It is no security
-; threat in any way, but it makes it possible to determine whether you use PHP
-; on your server or not.
-expose_php = On
-
-
-;;;;;;;;;;;;;;;;;;;
-; Resource Limits ;
-;;;;;;;;;;;;;;;;;;;
-
-max_execution_time = 30 ; Maximum execution time of each script, in seconds
-max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
-memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; Error handling and logging ;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-; error_reporting is a bit-field. Or each number up to get desired error
-; reporting level
-; E_ALL - All errors and warnings
-; E_ERROR - fatal run-time errors
-; E_WARNING - run-time warnings (non-fatal errors)
-; E_PARSE - compile-time parse errors
-; E_NOTICE - run-time notices (these are warnings which often result
-; from a bug in your code, but it's possible that it was
-; intentional (e.g., using an uninitialized variable and
-; relying on the fact it's automatically initialized to an
-; empty string)
-; E_CORE_ERROR - fatal errors that occur during PHP's initial startup
-; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's
-; initial startup
-; E_COMPILE_ERROR - fatal compile-time errors
-; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
-; E_USER_ERROR - user-generated error message
-; E_USER_WARNING - user-generated warning message
-; E_USER_NOTICE - user-generated notice message
-;
-; Examples:
-;
-; - Show all errors, except for notices
-;
-;error_reporting = E_ALL & ~E_NOTICE
-;
-; - Show only errors
-;
-;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
-;
-; - Show all errors
-;
-error_reporting = E_ALL
-
-; Print out errors (as a part of the output). For production web sites,
-; you're strongly encouraged to turn this feature off, and use error logging
-; instead (see below). Keeping display_errors enabled on a production web site
-; may reveal security information to end users, such as file paths on your Web
-; server, your database schema or other information.
-display_errors = Off
-
-; Even when display_errors is on, errors that occur during PHP's startup
-; sequence are not displayed. It's strongly recommended to keep
-; display_startup_errors off, except for when debugging.
-display_startup_errors = Off
-
-; Log errors into a log file (server-specific log, stderr, or error_log (below))
-; As stated above, you're strongly advised to use error logging in place of
-; error displaying on production web sites.
-log_errors = On
-
-; Set maximum length of log_errors. In error_log information about the source is
-; added. The default is 1024 and 0 allows to not apply any maximum length at all.
-log_errors_max_len = 1024
-
-; Do not log repeated messages. Repeated errors must occur in same file on same
-; line until ignore_repeated_source is set true.
-ignore_repeated_errors = Off
-
-; Ignore source of message when ignoring repeated messages. When this setting
-; is On you will not log errors with repeated messages from different files or
-; sourcelines.
-ignore_repeated_source = Off
-
-; If this parameter is set to Off, then memory leaks will not be shown (on
-; stdout or in the log). This has only effect in a debug compile, and if
-; error reporting includes E_WARNING in the allowed list
-report_memleaks = On
-
-; Store the last error/warning message in $php_errormsg (boolean).
-track_errors = Off
-
-; Disable the inclusion of HTML tags in error messages.
-; Note: Never use this feature for production boxes.
-;html_errors = Off
-
-; If html_errors is set On PHP produces clickable error messages that direct
-; to a page describing the error or function causing the error in detail.
-; You can download a copy of the PHP manual from http://www.php.net/docs.php
-; and change docref_root to the base URL of your local copy including the
-; leading '/'. You must also specify the file extension being used including
-; the dot.
-; Note: Never use this feature for production boxes.
-;docref_root = "/phpmanual/"
-;docref_ext = .html
-
-; String to output before an error message.
-;error_prepend_string = "<font color=ff0000>"
-
-; String to output after an error message.
-;error_append_string = "</font>"
-
-; Log errors to specified file.
-;error_log = filename
-
-; Log errors to syslog (Event Log on NT, not valid in Windows 95).
-;error_log = syslog
-
-
-;;;;;;;;;;;;;;;;;
-; Data Handling ;
-;;;;;;;;;;;;;;;;;
-;
-; Note - track_vars is ALWAYS enabled as of PHP 4.0.3
-
-; The separator used in PHP generated URLs to separate arguments.
-; Default is "&".
-;arg_separator.output = "&amp;"
-
-; List of separator(s) used by PHP to parse input URLs into variables.
-; Default is "&".
-; NOTE: Every character in this directive is considered as separator!
-;arg_separator.input = ";&"
-
-; This directive describes the order in which PHP registers GET, POST, Cookie,
-; Environment and Built-in variables (G, P, C, E & S respectively, often
-; referred to as EGPCS or GPC). Registration is done from left to right, newer
-; values override older values.
-variables_order = "GPCS"
-
-; Whether or not to register the EGPCS variables as global variables. You may
-; want to turn this off if you don't want to clutter your scripts' global scope
-; with user data. This makes most sense when coupled with track_vars - in which
-; case you can access all of the GPC variables through the $HTTP_*_VARS[],
-; variables.
-;
-; You should do your best to write your scripts so that they do not require
-; register_globals to be on; Using form variables as globals can easily lead
-; to possible security problems, if the code is not very well thought of.
-register_globals = Off
-
-; Whether or not to register the old-style input arrays, HTTP_GET_VARS
-; and friends. If you're not using them, it's recommended to turn them off,
-; for performance reasons.
-register_long_arrays = Off
-
-; This directive tells PHP whether to declare the argv&argc variables (that
-; would contain the GET information). If you don't use these variables, you
-; should turn it off for increased performance.
-register_argc_argv = Off
-
-; Maximum size of POST data that PHP will accept.
-post_max_size = 8M
-
-; This directive is deprecated. Use variables_order instead.
-gpc_order = "GPC"
-
-; Magic quotes
-;
-
-; Magic quotes for incoming GET/POST/Cookie data.
-magic_quotes_gpc = Off
-
-; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
-magic_quotes_runtime = Off
-
-; Use Sybase-style magic quotes (escape ' with '' instead of \').
-magic_quotes_sybase = Off
-
-; Automatically add files before or after any PHP document.
-auto_prepend_file =
-auto_append_file =
-
-; As of 4.0b4, PHP always outputs a character encoding by default in
-; the Content-type: header. To disable sending of the charset, simply
-; set it to be empty.
-;
-; PHP's built-in default is text/html
-default_mimetype = "text/html"
-;default_charset = "iso-8859-1"
-
-; Always populate the $HTTP_RAW_POST_DATA variable.
-;always_populate_raw_post_data = On
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;
-; Paths and Directories ;
-;;;;;;;;;;;;;;;;;;;;;;;;;
-
-; UNIX: "/path1:/path2"
-;include_path = ".:/php/includes"
-;
-; Windows: "\path1;\path2"
-;include_path = ".;c:\php\includes"
-
-; The root of the PHP pages, used only if nonempty.
-; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
-; if you are running php as a CGI under any web server (other than IIS)
-; see documentation for security issues. The alternate is to use the
-; cgi.force_redirect configuration below
-doc_root =
-
-; The directory under which PHP opens the script using /~usernamem used only
-; if nonempty.
-user_dir =
-
-; Directory in which the loadable extensions (modules) reside.
-extension_dir = "./"
-
-; Whether or not to enable the dl() function. The dl() function does NOT work
-; properly in multithreaded servers, such as IIS or Zeus, and is automatically
-; disabled on them.
-enable_dl = On
-
-; cgi.force_redirect is necessary to provide security running PHP as a CGI under
-; most web servers. Left undefined, PHP turns this on by default. You can
-; turn it off here AT YOUR OWN RISK
-; **You CAN safely turn this off for IIS, in fact, you MUST.**
-; cgi.force_redirect = 1
-
-; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape
-; (iPlanet) web servers, you MAY need to set an environment variable name that PHP
-; will look for to know it is OK to continue execution. Setting this variable MAY
-; cause security issues, KNOW WHAT YOU ARE DOING FIRST.
-; cgi.redirect_status_env = ;
-
-; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate
-; security tokens of the calling client. This allows IIS to define the
-; security context that the request runs under. mod_fastcgi under Apache
-; does not currently support this feature (03/17/2002)
-; Set to 1 if running under IIS. Default is zero.
-; fastcgi.impersonate = 1;
-
-; cgi.rfc2616_headers configuration option tells PHP what type of headers to
-; use when sending HTTP response code. If it's set 0 PHP sends Status: header that
-; is supported by Apache. When this option is set to 1 PHP will send
-; RFC2616 compliant header.
-; Set to 1 if running under IIS. Default is zero.
-;cgi.rfc2616_headers = 0
-
-
-;;;;;;;;;;;;;;;;
-; File Uploads ;
-;;;;;;;;;;;;;;;;
-
-; Whether to allow HTTP file uploads.
-file_uploads = On
-
-; Temporary directory for HTTP uploaded files (will use system default if not
-; specified).
-;upload_tmp_dir =
-
-; Maximum allowed size for uploaded files.
-upload_max_filesize = 2M
-
-
-;;;;;;;;;;;;;;;;;;
-; Fopen wrappers ;
-;;;;;;;;;;;;;;;;;;
-
-; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
-allow_url_fopen = On
-
-; Define the anonymous ftp password (your email address)
-;from="john@doe.com"
-
-; Define the user agent for php to send
-;user_agent="PHP"
-
-; Default timeout for socket based streams (seconds)
-default_socket_timeout = 60
-
-; If your scripts have to deal with files from Macintosh systems,
-; or you are running on a Mac and need to deal with files from
-; unix or win32 systems, setting this flag will cause PHP to
-; automatically detect the EOL character in those files so that
-; fgets() and file() will work regardless of the source of the file.
-; auto_detect_line_endings = Off
-
-
-;;;;;;;;;;;;;;;;;;;;;;
-; Dynamic Extensions ;
-;;;;;;;;;;;;;;;;;;;;;;
-;
-; If you wish to have an extension loaded automatically, use the following
-; syntax:
-;
-; extension=modulename.extension
-;
-; For example, on Windows:
-;
-; extension=msql.dll
-;
-; ... or under UNIX:
-;
-; extension=msql.so
-;
-; Note that it should be the name of the module only; no directory information
-; needs to go here. Specify the location of the extension with the
-; extension_dir directive above.
-
-
-;Windows Extensions
-;Note that MySQL and ODBC support is now built in, so no dll is needed for it.
-;
-;extension=php_bz2.dll
-;extension=php_cpdf.dll
-;extension=php_crack.dll
-;extension=php_curl.dll
-;extension=php_db.dll
-;extension=php_dba.dll
-;extension=php_dbase.dll
-;extension=php_dbx.dll
-;extension=php_domxml.dll
-;extension=php_exif.dll
-;extension=php_fdf.dll
-;extension=php_filepro.dll
-;extension=php_gd2.dll
-;extension=php_gettext.dll
-;extension=php_hyperwave.dll
-;extension=php_iconv.dll
-;extension=php_ifx.dll
-;extension=php_iisfunc.dll
-;extension=php_imap.dll
-;extension=php_interbase.dll
-;extension=php_java.dll
-;extension=php_ldap.dll
-;extension=php_mbstring.dll
-;extension=php_mcrypt.dll
-;extension=php_mhash.dll
-;extension=php_mime_magic.dll
-;extension=php_ming.dll
-;extension=php_mssql.dll
-;extension=php_msql.dll
-;extension=php_oci8.dll
-;extension=php_openssl.dll
-;extension=php_oracle.dll
-;extension=php_pdf.dll
-;extension=php_pgsql.dll
-;extension=php_printer.dll
-;extension=php_shmop.dll
-;extension=php_snmp.dll
-;extension=php_sockets.dll
-;extension=php_sybase_ct.dll
-;extension=php_w32api.dll
-;extension=php_xmlrpc.dll
-;extension=php_xslt.dll
-;extension=php_yaz.dll
-;extension=php_zip.dll
-
-
-;;;;;;;;;;;;;;;;;;;
-; Module Settings ;
-;;;;;;;;;;;;;;;;;;;
-
-[Syslog]
-; Whether or not to define the various syslog variables (e.g. $LOG_PID,
-; $LOG_CRON, etc.). Turning it off is a good idea performance-wise. In
-; runtime, you can define these variables by calling define_syslog_variables().
-define_syslog_variables = Off
-
-[mail function]
-; For Win32 only.
-SMTP = localhost
-
-; For Win32 only.
-sendmail_from = me@localhost.com
-
-; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
-;sendmail_path =
-
-[Java]
-;java.class.path = .\php_java.jar
-;java.home = c:\jdk
-;java.library = c:\jdk\jre\bin\hotspot\jvm.dll
-;java.library.path = .\
-
-[SQL]
-sql.safe_mode = Off
-
-[ODBC]
-;odbc.default_db = Not yet implemented
-;odbc.default_user = Not yet implemented
-;odbc.default_pw = Not yet implemented
-
-; Allow or prevent persistent links.
-odbc.allow_persistent = On
-
-; Check that a connection is still valid before reuse.
-odbc.check_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-odbc.max_persistent = -1
-
-; Maximum number of links (persistent + non-persistent). -1 means no limit.
-odbc.max_links = -1
-
-; Handling of LONG fields. Returns number of bytes to variables. 0 means
-; passthru.
-odbc.defaultlrl = 4096
-
-; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char.
-; See the documentation on odbc_binmode and odbc_longreadlen for an explanation
-; of uodbc.defaultlrl and uodbc.defaultbinmode
-odbc.defaultbinmode = 1
-
-[MySQL]
-; Allow or prevent persistent links.
-mysql.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-mysql.max_persistent = -1
-
-; Maximum number of links (persistent + non-persistent). -1 means no limit.
-mysql.max_links = -1
-
-; Default port number for mysql_connect(). If unset, mysql_connect() will use
-; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
-; compile-time value defined MYSQL_PORT (in that order). Win32 will only look
-; at MYSQL_PORT.
-mysql.default_port =
-
-; Default socket name for local MySQL connects. If empty, uses the built-in
-; MySQL defaults.
-mysql.default_socket =
-
-; Default host for mysql_connect() (doesn't apply in safe mode).
-mysql.default_host =
-
-; Default user for mysql_connect() (doesn't apply in safe mode).
-mysql.default_user =
-
-; Default password for mysql_connect() (doesn't apply in safe mode).
-; Note that this is generally a *bad* idea to store passwords in this file.
-; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
-; and reveal this password! And of course, any users with read access to this
-; file will be able to reveal the password as well.
-mysql.default_password =
-
-; Maximum time (in secondes) for connect timeout. -1 means no limimt
-mysql.connect_timeout = -1
-
-; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
-; SQL-Erros will be displayed.
-mysql.trace_mode = Off
-
-[mSQL]
-; Allow or prevent persistent links.
-msql.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-msql.max_persistent = -1
-
-; Maximum number of links (persistent+non persistent). -1 means no limit.
-msql.max_links = -1
-
-[PostgresSQL]
-; Allow or prevent persistent links.
-pgsql.allow_persistent = On
-
-; Detect broken persistent links always with pg_pconnect().
-; Auto reset feature requires a little overheads.
-pgsql.auto_reset_persistent = Off
-
-; Maximum number of persistent links. -1 means no limit.
-pgsql.max_persistent = -1
-
-; Maximum number of links (persistent+non persistent). -1 means no limit.
-pgsql.max_links = -1
-
-; Ignore PostgreSQL backends Notice message or not.
-; Notice message logging require a little overheads.
-pgsql.ignore_notice = 0
-
-; Log PostgreSQL backends Noitce message or not.
-; Unless pgsql.ignore_notice=0, module cannot log notice message.
-pgsql.log_notice = 0
-
-[Sybase]
-; Allow or prevent persistent links.
-sybase.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-sybase.max_persistent = -1
-
-; Maximum number of links (persistent + non-persistent). -1 means no limit.
-sybase.max_links = -1
-
-;sybase.interface_file = "/usr/sybase/interfaces"
-
-; Minimum error severity to display.
-sybase.min_error_severity = 10
-
-; Minimum message severity to display.
-sybase.min_message_severity = 10
-
-; Compatability mode with old versions of PHP 3.0.
-; If on, this will cause PHP to automatically assign types to results according
-; to their Sybase type, instead of treating them all as strings. This
-; compatability mode will probably not stay around forever, so try applying
-; whatever necessary changes to your code, and turn it off.
-sybase.compatability_mode = Off
-
-[Sybase-CT]
-; Allow or prevent persistent links.
-sybct.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-sybct.max_persistent = -1
-
-; Maximum number of links (persistent + non-persistent). -1 means no limit.
-sybct.max_links = -1
-
-; Minimum server message severity to display.
-sybct.min_server_severity = 10
-
-; Minimum client message severity to display.
-sybct.min_client_severity = 10
-
-[dbx]
-; returned column names can be converted for compatibility reasons
-; possible values for dbx.colnames_case are
-; "unchanged" (default, if not set)
-; "lowercase"
-; "uppercase"
-; the recommended default is either upper- or lowercase, but
-; unchanged is currently set for backwards compatibility
-dbx.colnames_case = "lowercase"
-
-[bcmath]
-; Number of decimal digits for all bcmath functions.
-bcmath.scale = 0
-
-[browscap]
-;browscap = extra/browscap.ini
-
-[Informix]
-; Default host for ifx_connect() (doesn't apply in safe mode).
-ifx.default_host =
-
-; Default user for ifx_connect() (doesn't apply in safe mode).
-ifx.default_user =
-
-; Default password for ifx_connect() (doesn't apply in safe mode).
-ifx.default_password =
-
-; Allow or prevent persistent links.
-ifx.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-ifx.max_persistent = -1
-
-; Maximum number of links (persistent + non-persistent). -1 means no limit.
-ifx.max_links = -1
-
-; If on, select statements return the contents of a text blob instead of its id.
-ifx.textasvarchar = 0
-
-; If on, select statements return the contents of a byte blob instead of its id.
-ifx.byteasvarchar = 0
-
-; Trailing blanks are stripped from fixed-length char columns. May help the
-; life of Informix SE users.
-ifx.charasvarchar = 0
-
-; If on, the contents of text and byte blobs are dumped to a file instead of
-; keeping them in memory.
-ifx.blobinfile = 0
-
-; NULL's are returned as empty strings, unless this is set to 1. In that case,
-; NULL's are returned as string 'NULL'.
-ifx.nullformat = 0
-
-[Session]
-; Handler used to store/retrieve data.
-session.save_handler = files
-
-; Argument passed to save_handler. In the case of files, this is the path
-; where data files are stored. Note: Windows users have to change this
-; variable in order to use PHP's session functions.
-;
-; As of PHP 4.0.1, you can define the path as:
-;
-; session.save_path = "N;/path"
-;
-; where N is an integer. Instead of storing all the session files in
-; /path, what this will do is use subdirectories N-levels deep, and
-; store the session data in those directories. This is useful if you
-; or your OS have problems with lots of files in one directory, and is
-; a more efficient layout for servers that handle lots of sessions.
-;
-; NOTE 1: PHP will not create this directory structure automatically.
-; You can use the script in the ext/session dir for that purpose.
-; NOTE 2: See the section on garbage collection below if you choose to
-; use subdirectories for session storage
-;
-; The file storage module creates files using mode 600 by default.
-; You can change that by using
-;
-; session.save_path = "N;MODE;/path"
-;
-; where MODE is the octal representation of the mode. Note that this
-; does not overwrite the process's umask.
-session.save_path = "/tmp"
-
-; Whether to use cookies.
-session.use_cookies = 1
-
-; This option enables administrators to make their users invulnerable to
-; attacks which involve passing session ids in URLs; defaults to 0.
-; session.use_only_cookies = 1
-
-; Name of the session (used as cookie name).
-session.name = PHPSESSID
-
-; Initialize session on request startup.
-session.auto_start = 0
-
-; Lifetime in seconds of cookie or, if 0, until browser is restarted.
-session.cookie_lifetime = 0
-
-; The path for which the cookie is valid.
-session.cookie_path = /
-
-; The domain for which the cookie is valid.
-session.cookie_domain =
-
-; Handler used to serialize data. php is the standard serializer of PHP.
-session.serialize_handler = php
-
-; Define the probability that the 'garbage collection' process is started
-; on every session initialization.
-; The probability is calculated by using gc_probability/gc_divisor,
-; e.g. 1/100 means there is a 1% chance that the GC process starts
-; on each request.
-
-session.gc_probability = 1
-session.gc_divisor = 1000
-
-; After this number of seconds, stored data will be seen as 'garbage' and
-; cleaned up by the garbage collection process.
-session.gc_maxlifetime = 1440
-
-; PHP 4.2 and less have an undocumented feature/bug that allows you to
-; to initialize a session variable in the global scope, albeit register_globals
-; is disabled. PHP 4.3 and later will warn you, if this feature is used.
-; You can disable the feature and the warning seperately. At this time,
-; the warning is only displayed, if bug_compat_42 is enabled.
-
-session.bug_compat_42 = 0
-session.bug_compat_warn = 1
-
-; Check HTTP Referer to invalidate externally stored URLs containing ids.
-; HTTP_REFERER has to contain this substring for the session to be
-; considered as valid.
-session.referer_check =
-
-; How many bytes to read from the file.
-session.entropy_length = 0
-
-; Specified here to create the session id.
-session.entropy_file =
-
-;session.entropy_length = 16
-
-;session.entropy_file = /dev/urandom
-
-; Set to {nocache,private,public,} to determine HTTP caching aspects.
-; or leave this empty to avoid sending anti-caching headers.
-session.cache_limiter = nocache
-
-; Document expires after n minutes.
-session.cache_expire = 180
-
-; trans sid support is disabled by default.
-; Use of trans sid may risk your users security.
-; Use this option with caution.
-; - User may send URL contains active session ID
-; to other person via. email/irc/etc.
-; - URL that contains active session ID may be stored
-; in publically accessible computer.
-; - User may access your site with the same session ID
-; always using URL stored in browser's history or bookmarks.
-session.use_trans_sid = 0
-
-; Select a hash function
-; 0: MD5 (128 bits)
-; 1: SHA-1 (160 bits)
-session.hash_function = 0
-
-; Define how many bits are stored in each character when converting
-; the binary hash data to something readable.
-;
-; 4 bits: 0-9, a-f
-; 5 bits: 0-9, a-v
-; 6 bits: 0-9, a-z, A-Z, "-", ","
-session.hash_bits_per_character = 5
-
-; The URL rewriter will look for URLs in a defined set of HTML tags.
-; form/fieldset are special; if you include them here, the rewriter will
-; add a hidden <input> field with the info which is otherwise appended
-; to URLs. If you want XHTML conformity, remove the form entry.
-; Note that all valid entries require a "=", even if no value follows.
-url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
-
-[MSSQL]
-; Allow or prevent persistent links.
-mssql.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-mssql.max_persistent = -1
-
-; Maximum number of links (persistent+non persistent). -1 means no limit.
-mssql.max_links = -1
-
-; Minimum error severity to display.
-mssql.min_error_severity = 10
-
-; Minimum message severity to display.
-mssql.min_message_severity = 10
-
-; Compatability mode with old versions of PHP 3.0.
-mssql.compatability_mode = Off
-
-; Valid range 0 - 2147483647. Default = 4096.
-;mssql.textlimit = 4096
-
-; Valid range 0 - 2147483647. Default = 4096.
-;mssql.textsize = 4096
-
-; Limits the number of records in each batch. 0 = all records in one batch.
-;mssql.batchsize = 0
-
-; Use NT authentication when connecting to the server
-mssql.secure_connection = Off
-
-; Specify max number of processes. Default = 25
-;mssql.max_procs = 25
-
-[Assertion]
-; Assert(expr); active by default.
-;assert.active = On
-
-; Issue a PHP warning for each failed assertion.
-;assert.warning = On
-
-; Don't bail out by default.
-;assert.bail = Off
-
-; User-function to be called if an assertion fails.
-;assert.callback = 0
-
-; Eval the expression with current error_reporting(). Set to true if you want
-; error_reporting(0) around the eval().
-;assert.quiet_eval = 0
-
-[Ingres II]
-; Allow or prevent persistent links.
-ingres.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-ingres.max_persistent = -1
-
-; Maximum number of links, including persistents. -1 means no limit.
-ingres.max_links = -1
-
-; Default database (format: [node_id::]dbname[/srv_class]).
-ingres.default_database =
-
-; Default user.
-ingres.default_user =
-
-; Default password.
-ingres.default_password =
-
-[Verisign Payflow Pro]
-; Default Payflow Pro server.
-pfpro.defaulthost = "test-payflow.verisign.com"
-
-; Default port to connect to.
-pfpro.defaultport = 443
-
-; Default timeout in seconds.
-pfpro.defaulttimeout = 30
-
-; Default proxy IP address (if required).
-;pfpro.proxyaddress =
-
-; Default proxy port.
-;pfpro.proxyport =
-
-; Default proxy logon.
-;pfpro.proxylogon =
-
-; Default proxy password.
-;pfpro.proxypassword =
-
-[Sockets]
-; Use the system read() function instead of the php_read() wrapper.
-sockets.use_system_read = On
-
-[com]
-; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
-;com.typelib_file =
-; allow Distributed-COM calls
-;com.allow_dcom = true
-; autoregister constants of a components typlib on com_load()
-;com.autoregister_typelib = true
-; register constants casesensitive
-;com.autoregister_casesensitive = false
-; show warnings on duplicate constat registrations
-;com.autoregister_verbose = true
-
-[Printer]
-;printer.default_printer = ""
-
-[mbstring]
-; language for internal character representation.
-;mbstring.language = Japanese
-
-; internal/script encoding.
-; Some encoding cannot work as internal encoding.
-; (e.g. SJIS, BIG5, ISO-2022-*)
-;mbstring.internal_encoding = EUC-JP
-
-; http input encoding.
-;mbstring.http_input = auto
-
-; http output encoding. mb_output_handler must be
-; registered as output buffer to function
-;mbstring.http_output = SJIS
-
-; enable automatic encoding translation accoding to
-; mbstring.internal_encoding setting. Input chars are
-; converted to internal encoding by setting this to On.
-; Note: Do _not_ use automatic encoding translation for
-; portable libs/applications.
-;mbstring.encoding_translation = Off
-
-; automatic encoding detection order.
-; auto means
-;mbstring.detect_order = auto
-
-; substitute_character used when character cannot be converted
-; one from another
-;mbstring.substitute_character = none;
-
-; overload(replace) single byte functions by mbstring functions.
-; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
-; etc. Possible values are 0,1,2,4 or combination of them.
-; For example, 7 for overload everything.
-; 0: No overload
-; 1: Overload mail() function
-; 2: Overload str*() functions
-; 4: Overload ereg*() functions
-;mbstring.func_overload = 0
-
-[FrontBase]
-;fbsql.allow_persistent = On
-;fbsql.autocommit = On
-;fbsql.default_database =
-;fbsql.default_database_password =
-;fbsql.default_host =
-;fbsql.default_password =
-;fbsql.default_user = "_SYSTEM"
-;fbsql.generate_warnings = Off
-;fbsql.max_connections = 128
-;fbsql.max_links = 128
-;fbsql.max_persistent = -1
-;fbsql.max_results = 128
-;fbsql.batchSize = 1000
-
-[Crack]
-; Modify the setting below to match the directory location of the cracklib
-; dictionary files. Include the base filename, but not the file extension.
-; crack.default_dictionary = "c:\php\lib\cracklib_dict"
-
-[exif]
-; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS.
-; With mbstring support this will automatically be converted into the encoding
-; given by corresponding encode setting. When empty mbstring.internal_encoding
-; is used. For the decode settings you can distinguish between motorola and
-; intel byte order. A decode setting cannot be empty.
-;exif.encode_unicode = ISO-8859-15
-;exif.decode_unicode_motorola = UCS-2BE
-;exif.decode_unicode_intel = UCS-2LE
-;exif.encode_jis =
-;exif.decode_jis_motorola = JIS
-;exif.decode_jis_intel = JIS
-
-; Local Variables:
-; tab-width: 4
-; End:
diff --git a/php4.spec.in b/php4.spec.in
deleted file mode 100644
index 67e4b7cf13..0000000000
--- a/php4.spec.in
+++ /dev/null
@@ -1,48 +0,0 @@
-%define version @VERSION@
-%define so_version 4
-%define release 1
-
-Name: php
-Summary: PHP: Hypertext Preprocessor
-Group: Development/Languages
-Version: %{version}
-Release: %{release}
-Copyright: The PHP license (see "LICENSE" file included in distribution)
-Source: http://www.php.net/version4/downloads/php-%{version}.tar.gz
-Icon: php.gif
-URL: http://www.php.net/
-Packager: PHP Group <group@php.net>
-
-BuildRoot: /var/tmp/php-%{version}
-
-%description
-PHP is an HTML-embedded scripting language. Much of its syntax is
-borrowed from C, Java and Perl with a couple of unique PHP-specific
-features thrown in. The goal of the language is to allow web
-developers to write dynamically generated pages quickly.
-
-%prep
-
-%setup
-
-%build
-set -x
-./buildconf
-./configure --prefix=/usr --with-apxs \
- --enable-track-vars --disable-debug \
- --with-xml=shared \
-
-# figure out configure options options based on what packages are installed
-# to override, use the OVERRIDE_OPTIONS environment variable. To add
-# extra options, use the OPTIONS environment variable.
-
-#test rpm -q MySQL-devel >&/dev/null && OPTIONS="$OPTIONS --with-mysql=shared"
-#test rpm -q solid-devel >&/dev/null && OPTIONS="$OPTIONS --with-solid=shared,/home/solid"
-#test rpm -q postgresql-devel >&/dev/null && OPTIONS="$OPTIONS --with-pgsql=shared"
-test rpm -q expat >&/dev/null && OPTIONS="$OPTIONS --with-xml=shared"
-
-if test "x$OVERRIDE_OPTIONS" = "x"; then
- ./configure --prefix=/usr --with-apxs=$APXS $OPTIONS
-else
- ./configure $OVERRIDE_OPTIONS
-fi
diff --git a/regex/COPYRIGHT b/regex/COPYRIGHT
deleted file mode 100644
index d43362fbfc..0000000000
--- a/regex/COPYRIGHT
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
-This software is not subject to any license of the American Telephone
-and Telegraph Company or of the Regents of the University of California.
-
-Permission is granted to anyone to use this software for any purpose on
-any computer system, and to alter it and redistribute it, subject
-to the following restrictions:
-
-1. The author is not responsible for the consequences of use of this
- software, no matter how awful, even if they arise from flaws in it.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. Since few users ever read sources,
- credits must appear in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software. Since few users
- ever read sources, credits must appear in the documentation.
-
-4. This notice may not be removed or altered.
diff --git a/regex/README b/regex/README
deleted file mode 100644
index cea9b67b66..0000000000
--- a/regex/README
+++ /dev/null
@@ -1,32 +0,0 @@
-alpha3.4 release.
-Thu Mar 17 23:17:18 EST 1994
-henry@zoo.toronto.edu
-
-See WHATSNEW for change listing.
-
-installation notes:
---------
-Read the comments at the beginning of Makefile before running.
-
-Utils.h contains some things that just might have to be modified on
-some systems, as well as a nested include (ugh) of <assert.h>.
-
-The "fake" directory contains quick-and-dirty fakes for some header
-files and routines that old systems may not have. Note also that
--DUSEBCOPY will make utils.h substitute bcopy() for memmove().
-
-After that, "make r" will build regcomp.o, regexec.o, regfree.o,
-and regerror.o (the actual routines), bundle them together into a test
-program, and run regression tests on them. No output is good output.
-
-"make lib" builds just the .o files for the actual routines (when
-you're happy with testing and have adjusted CFLAGS for production),
-and puts them together into libregex.a. You can pick up either the
-library or *.o ("make lib" makes sure there are no other .o files left
-around to confuse things).
-
-Main.c, debug.c, split.c are used for regression testing but are not part
-of the RE routines themselves.
-
-Regex.h goes in /usr/include. All other .h files are internal only.
---------
diff --git a/regex/WHATSNEW b/regex/WHATSNEW
deleted file mode 100644
index 6e82e1dae0..0000000000
--- a/regex/WHATSNEW
+++ /dev/null
@@ -1,92 +0,0 @@
-New in alpha3.4: The complex bug alluded to below has been fixed (in a
-slightly kludgey temporary way that may hurt efficiency a bit; this is
-another "get it out the door for 4.4" release). The tests at the end of
-the tests file have accordingly been uncommented. The primary sign of
-the bug was that something like a?b matching ab matched b rather than ab.
-(The bug was essentially specific to this exact situation, else it would
-have shown up earlier.)
-
-New in alpha3.3: The definition of word boundaries has been altered
-slightly, to more closely match the usual programming notion that "_"
-is an alphabetic. Stuff used for pre-ANSI systems is now in a subdir,
-and the makefile no longer alludes to it in mysterious ways. The
-makefile has generally been cleaned up some. Fixes have been made
-(again!) so that the regression test will run without -DREDEBUG, at
-the cost of weaker checking. A workaround for a bug in some folks'
-<assert.h> has been added. And some more things have been added to
-tests, including a couple right at the end which are commented out
-because the code currently flunks them (complex bug; fix coming).
-Plus the usual minor cleanup.
-
-New in alpha3.2: Assorted bits of cleanup and portability improvement
-(the development base is now a BSDI system using GCC instead of an ancient
-Sun system, and the newer compiler exposed some glitches). Fix for a
-serious bug that affected REs using many [] (including REG_ICASE REs
-because of the way they are implemented), *sometimes*, depending on
-memory-allocation patterns. The header-file prototypes no longer name
-the parameters, avoiding possible name conflicts. The possibility that
-some clot has defined CHAR_MIN as (say) `-128' instead of `(-128)' is
-now handled gracefully. "uchar" is no longer used as an internal type
-name (too many people have the same idea). Still the same old lousy
-performance, alas.
-
-New in alpha3.1: Basically nothing, this release is just a bookkeeping
-convenience. Stay tuned.
-
-New in alpha3.0: Performance is no better, alas, but some fixes have been
-made and some functionality has been added. (This is basically the "get
-it out the door in time for 4.4" release.) One bug fix: regfree() didn't
-free the main internal structure (how embarrassing). It is now possible
-to put NULs in either the RE or the target string, using (resp.) a new
-REG_PEND flag and the old REG_STARTEND flag. The REG_NOSPEC flag to
-regcomp() makes all characters ordinary, so you can match a literal
-string easily (this will become more useful when performance improves!).
-There are now primitives to match beginnings and ends of words, although
-the syntax is disgusting and so is the implementation. The REG_ATOI
-debugging interface has changed a bit. And there has been considerable
-internal cleanup of various kinds.
-
-New in alpha2.3: Split change list out of README, and moved flags notes
-into Makefile. Macro-ized the name of regex(7) in regex(3), since it has
-to change for 4.4BSD. Cleanup work in engine.c, and some new regression
-tests to catch tricky cases thereof.
-
-New in alpha2.2: Out-of-date manpages updated. Regerror() acquires two
-small extensions -- REG_ITOA and REG_ATOI -- which avoid debugging kludges
-in my own test program and might be useful to others for similar purposes.
-The regression test will now compile (and run) without REDEBUG. The
-BRE \$ bug is fixed. Most uses of "uchar" are gone; it's all chars now.
-Char/uchar parameters are now written int/unsigned, to avoid possible
-portability problems with unpromoted parameters. Some unsigned casts have
-been introduced to minimize portability problems with shifting into sign
-bits.
-
-New in alpha2.1: Lots of little stuff, cleanup and fixes. The one big
-thing is that regex.h is now generated, using mkh, rather than being
-supplied in the distribution; due to circularities in dependencies,
-you have to build regex.h explicitly by "make h". The two known bugs
-have been fixed (and the regression test now checks for them), as has a
-problem with assertions not being suppressed in the absence of REDEBUG.
-No performance work yet.
-
-New in alpha2: Backslash-anything is an ordinary character, not an
-error (except, of course, for the handful of backslashed metacharacters
-in BREs), which should reduce script breakage. The regression test
-checks *where* null strings are supposed to match, and has generally
-been tightened up somewhat. Small bug fixes in parameter passing (not
-harmful, but technically errors) and some other areas. Debugging
-invoked by defining REDEBUG rather than not defining NDEBUG.
-
-New in alpha+3: full prototyping for internal routines, using a little
-helper program, mkh, which extracts prototypes given in stylized comments.
-More minor cleanup. Buglet fix: it's CHAR_BIT, not CHAR_BITS. Simple
-pre-screening of input when a literal string is known to be part of the
-RE; this does wonders for performance.
-
-New in alpha+2: minor bits of cleanup. Notably, the number "32" for the
-word width isn't hardwired into regexec.c any more, the public header
-file prototypes the functions if __STDC__ is defined, and some small typos
-in the manpages have been fixed.
-
-New in alpha+1: improvements to the manual pages, and an important
-extension, the REG_STARTEND option to regexec().
diff --git a/regex/cclass.h b/regex/cclass.h
deleted file mode 100644
index 6227f810b7..0000000000
--- a/regex/cclass.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* character-class table */
-static struct cclass {
- char *name;
- char *chars;
- char *multis;
-} cclasses[] = {
- {"alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", ""},
- {"alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
- ""},
- {"blank", " \t", ""},
- {"cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
-\25\26\27\30\31\32\33\34\35\36\37\177", ""},
- {"digit", "0123456789", ""},
- {"graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
- ""},
- {"lower", "abcdefghijklmnopqrstuvwxyz",
- ""},
- {"print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ",
- ""},
- {"punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
- ""},
- {"space", "\t\n\v\f\r ", ""},
- {"upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
- ""},
- {"xdigit", "0123456789ABCDEFabcdef",
- ""},
- {NULL, 0, ""}
-};
diff --git a/regex/cname.h b/regex/cname.h
deleted file mode 100644
index 670b273882..0000000000
--- a/regex/cname.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* character-name table */
-static struct cname {
- char *name;
- char code;
-} cnames[] = {
- {"NUL", '\0'},
- {"SOH", '\001'},
- {"STX", '\002'},
- {"ETX", '\003'},
- {"EOT", '\004'},
- {"ENQ", '\005'},
- {"ACK", '\006'},
- {"BEL", '\007'},
- {"alert", '\007'},
- {"BS", '\010'},
- {"backspace", '\b'},
- {"HT", '\011'},
- {"tab", '\t'},
- {"LF", '\012'},
- {"newline", '\n'},
- {"VT", '\013'},
- {"vertical-tab", '\v'},
- {"FF", '\014'},
- {"form-feed", '\f'},
- {"CR", '\015'},
- {"carriage-return", '\r'},
- {"SO", '\016'},
- {"SI", '\017'},
- {"DLE", '\020'},
- {"DC1", '\021'},
- {"DC2", '\022'},
- {"DC3", '\023'},
- {"DC4", '\024'},
- {"NAK", '\025'},
- {"SYN", '\026'},
- {"ETB", '\027'},
- {"CAN", '\030'},
- {"EM", '\031'},
- {"SUB", '\032'},
- {"ESC", '\033'},
- {"IS4", '\034'},
- {"FS", '\034'},
- {"IS3", '\035'},
- {"GS", '\035'},
- {"IS2", '\036'},
- {"RS", '\036'},
- {"IS1", '\037'},
- {"US", '\037'},
- {"space", ' '},
- {"exclamation-mark", '!'},
- {"quotation-mark", '"'},
- {"number-sign", '#'},
- {"dollar-sign", '$'},
- {"percent-sign", '%'},
- {"ampersand", '&'},
- {"apostrophe", '\''},
- {"left-parenthesis", '('},
- {"right-parenthesis", ')'},
- {"asterisk", '*'},
- {"plus-sign", '+'},
- {"comma", ','},
- {"hyphen", '-'},
- {"hyphen-minus", '-'},
- {"period", '.'},
- {"full-stop", '.'},
- {"slash", '/'},
- {"solidus", '/'},
- {"zero", '0'},
- {"one", '1'},
- {"two", '2'},
- {"three", '3'},
- {"four", '4'},
- {"five", '5'},
- {"six", '6'},
- {"seven", '7'},
- {"eight", '8'},
- {"nine", '9'},
- {"colon", ':'},
- {"semicolon", ';'},
- {"less-than-sign", '<'},
- {"equals-sign", '='},
- {"greater-than-sign", '>'},
- {"question-mark", '?'},
- {"commercial-at", '@'},
- {"left-square-bracket", '['},
- {"backslash", '\\'},
- {"reverse-solidus", '\\'},
- {"right-square-bracket", ']'},
- {"circumflex", '^'},
- {"circumflex-accent", '^'},
- {"underscore", '_'},
- {"low-line", '_'},
- {"grave-accent", '`'},
- {"left-brace", '{'},
- {"left-curly-bracket", '{'},
- {"vertical-line", '|'},
- {"right-brace", '}'},
- {"right-curly-bracket", '}'},
- {"tilde", '~'},
- {"DEL", '\177'},
- {NULL, 0},
-};
diff --git a/regex/debug.c b/regex/debug.c
deleted file mode 100644
index c0feaeb169..0000000000
--- a/regex/debug.c
+++ /dev/null
@@ -1,242 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-#include "debug.ih"
-
-/*
- - regprint - print a regexp for debugging
- == void regprint(regex_t *r, FILE *d);
- */
-void
-regprint(r, d)
-regex_t *r;
-FILE *d;
-{
- register struct re_guts *g = r->re_g;
- register int i;
- register int c;
- register int last;
- int nincat[NC];
-
- fprintf(d, "%ld states, %d categories", (long)g->nstates,
- g->ncategories);
- fprintf(d, ", first %ld last %ld", (long)g->firststate,
- (long)g->laststate);
- if (g->iflags&USEBOL)
- fprintf(d, ", USEBOL");
- if (g->iflags&USEEOL)
- fprintf(d, ", USEEOL");
- if (g->iflags&BAD)
- fprintf(d, ", BAD");
- if (g->nsub > 0)
- fprintf(d, ", nsub=%ld", (long)g->nsub);
- if (g->must != NULL)
- fprintf(d, ", must(%ld) `%*s'", (long)g->mlen, (int)g->mlen,
- g->must);
- if (g->backrefs)
- fprintf(d, ", backrefs");
- if (g->nplus > 0)
- fprintf(d, ", nplus %ld", (long)g->nplus);
- fprintf(d, "\n");
- s_print(g, d);
- for (i = 0; i < g->ncategories; i++) {
- nincat[i] = 0;
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (g->categories[c] == i)
- nincat[i]++;
- }
- fprintf(d, "cc0#%d", nincat[0]);
- for (i = 1; i < g->ncategories; i++)
- if (nincat[i] == 1) {
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (g->categories[c] == i)
- break;
- fprintf(d, ", %d=%s", i, regchar(c));
- }
- fprintf(d, "\n");
- for (i = 1; i < g->ncategories; i++)
- if (nincat[i] != 1) {
- fprintf(d, "cc%d\t", i);
- last = -1;
- for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */
- if (c <= CHAR_MAX && g->categories[c] == i) {
- if (last < 0) {
- fprintf(d, "%s", regchar(c));
- last = c;
- }
- } else {
- if (last >= 0) {
- if (last != c-1)
- fprintf(d, "-%s",
- regchar(c-1));
- last = -1;
- }
- }
- fprintf(d, "\n");
- }
-}
-
-/*
- - s_print - print the strip for debugging
- == static void s_print(register struct re_guts *g, FILE *d);
- */
-static void
-s_print(g, d)
-register struct re_guts *g;
-FILE *d;
-{
- register sop *s;
- register cset *cs;
- register int i;
- register int done = 0;
- register sop opnd;
- register int col = 0;
- register int last;
- register sopno offset = 2;
-# define GAP() { if (offset % 5 == 0) { \
- if (col > 40) { \
- fprintf(d, "\n\t"); \
- col = 0; \
- } else { \
- fprintf(d, " "); \
- col++; \
- } \
- } else \
- col++; \
- offset++; \
- }
-
- if (OP(g->strip[0]) != OEND)
- fprintf(d, "missing initial OEND!\n");
- for (s = &g->strip[1]; !done; s++) {
- opnd = OPND(*s);
- switch (OP(*s)) {
- case OEND:
- fprintf(d, "\n");
- done = 1;
- break;
- case OCHAR:
- if (strchr("\\|()^$.[+*?{}!<> ", (char)opnd) != NULL)
- fprintf(d, "\\%c", (char)opnd);
- else
- fprintf(d, "%s", regchar((char)opnd));
- break;
- case OBOL:
- fprintf(d, "^");
- break;
- case OEOL:
- fprintf(d, "$");
- break;
- case OBOW:
- fprintf(d, "\\{");
- break;
- case OEOW:
- fprintf(d, "\\}");
- break;
- case OANY:
- fprintf(d, ".");
- break;
- case OANYOF:
- fprintf(d, "[(%ld)", (long)opnd);
- cs = &g->sets[opnd];
- last = -1;
- for (i = 0; i < g->csetsize+1; i++) /* +1 flushes */
- if (CHIN(cs, i) && i < g->csetsize) {
- if (last < 0) {
- fprintf(d, "%s", regchar(i));
- last = i;
- }
- } else {
- if (last >= 0) {
- if (last != i-1)
- fprintf(d, "-%s",
- regchar(i-1));
- last = -1;
- }
- }
- fprintf(d, "]");
- break;
- case OBACK_:
- fprintf(d, "(\\<%ld>", (long)opnd);
- break;
- case O_BACK:
- fprintf(d, "<%ld>\\)", (long)opnd);
- break;
- case OPLUS_:
- fprintf(d, "(+");
- if (OP(*(s+opnd)) != O_PLUS)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_PLUS:
- if (OP(*(s-opnd)) != OPLUS_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "+)");
- break;
- case OQUEST_:
- fprintf(d, "(?");
- if (OP(*(s+opnd)) != O_QUEST)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_QUEST:
- if (OP(*(s-opnd)) != OQUEST_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "?)");
- break;
- case OLPAREN:
- fprintf(d, "((<%ld>", (long)opnd);
- break;
- case ORPAREN:
- fprintf(d, "<%ld>))", (long)opnd);
- break;
- case OCH_:
- fprintf(d, "<");
- if (OP(*(s+opnd)) != OOR2)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case OOR1:
- if (OP(*(s-opnd)) != OOR1 && OP(*(s-opnd)) != OCH_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "|");
- break;
- case OOR2:
- fprintf(d, "|");
- if (OP(*(s+opnd)) != OOR2 && OP(*(s+opnd)) != O_CH)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_CH:
- if (OP(*(s-opnd)) != OOR1)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, ">");
- break;
- default:
- fprintf(d, "!%ld(%ld)!", OP(*s), opnd);
- break;
- }
- if (!done)
- GAP();
- }
-}
-
-/*
- - regchar - make a character printable
- == static char *regchar(int ch);
- */
-static char * /* -> representation */
-regchar(ch)
-int ch;
-{
- static char buf[10];
-
- if (isprint(ch) || ch == ' ')
- sprintf(buf, "%c", ch);
- else
- sprintf(buf, "\\%o", ch);
- return(buf);
-}
diff --git a/regex/debug.ih b/regex/debug.ih
deleted file mode 100644
index 5f40ff7917..0000000000
--- a/regex/debug.ih
+++ /dev/null
@@ -1,14 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === debug.c === */
-void regprint(regex_t *r, FILE *d);
-static void s_print(register struct re_guts *g, FILE *d);
-static char *regchar(int ch);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/regex/engine.c b/regex/engine.c
deleted file mode 100644
index 0b88dcf1ed..0000000000
--- a/regex/engine.c
+++ /dev/null
@@ -1,1019 +0,0 @@
-/*
- * The matching engine and friends. This file is #included by regexec.c
- * after suitable #defines of a variety of macros used herein, so that
- * different state representations can be used without duplicating masses
- * of code.
- */
-
-#ifdef SNAMES
-#define matcher smatcher
-#define fast sfast
-#define slow sslow
-#define dissect sdissect
-#define backref sbackref
-#define step sstep
-#define print sprint
-#define at sat
-#define match smat
-#endif
-#ifdef LNAMES
-#define matcher lmatcher
-#define fast lfast
-#define slow lslow
-#define dissect ldissect
-#define backref lbackref
-#define step lstep
-#define print lprint
-#define at lat
-#define match lmat
-#endif
-
-/* another structure passed up and down to avoid zillions of parameters */
-struct match {
- struct re_guts *g;
- int eflags;
- regmatch_t *pmatch; /* [nsub+1] (0 element unused) */
- char *offp; /* offsets work from here */
- char *beginp; /* start of string -- virtual NUL precedes */
- char *endp; /* end of string -- virtual NUL here */
- char *coldp; /* can be no match starting before here */
- char **lastpos; /* [nplus+1] */
- STATEVARS;
- states st; /* current states */
- states fresh; /* states for a fresh start */
- states tmp; /* temporary */
- states empty; /* empty set of states */
-};
-
-#include "engine.ih"
-
-#ifdef REDEBUG
-#define SP(t, s, c) print(m, t, s, c, stdout)
-#define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2)
-#define NOTE(str) { if (m->eflags&REG_TRACE) printf("=%s\n", (str)); }
-#else
-#define SP(t, s, c) /* nothing */
-#define AT(t, p1, p2, s1, s2) /* nothing */
-#define NOTE(s) /* nothing */
-#endif
-
-/*
- - matcher - the actual matching engine
- == static int matcher(register struct re_guts *g, char *string, \
- == size_t nmatch, regmatch_t pmatch[], int eflags);
- */
-static int /* 0 success, REG_NOMATCH failure */
-matcher(g, string, nmatch, pmatch, eflags)
-register struct re_guts *g;
-char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
-{
- register char *endp;
- register size_t i;
- struct match mv;
- register struct match *m = &mv;
- register char *dp;
- const register sopno gf = g->firststate+1; /* +1 for OEND */
- const register sopno gl = g->laststate;
- char *start;
- char *stop;
-
- /* simplify the situation where possible */
- if (g->cflags&REG_NOSUB)
- nmatch = 0;
- if (eflags&REG_STARTEND) {
- start = string + pmatch[0].rm_so;
- stop = string + pmatch[0].rm_eo;
- } else {
- start = string;
- stop = start + strlen(start);
- }
- if (stop < start)
- return(REG_INVARG);
-
- /* prescreening; this does wonders for this rather slow code */
- if (g->must != NULL) {
- for (dp = start; dp < stop; dp++)
- if (*dp == g->must[0] && stop - dp >= g->mlen &&
- memcmp(dp, g->must, (size_t)g->mlen) == 0)
- break;
- if (dp == stop) /* we didn't find g->must */
- return(REG_NOMATCH);
- }
-
- /* match struct setup */
- m->g = g;
- m->eflags = eflags;
- m->pmatch = NULL;
- m->lastpos = NULL;
- m->offp = string;
- m->beginp = start;
- m->endp = stop;
- STATESETUP(m, 4);
- SETUP(m->st);
- SETUP(m->fresh);
- SETUP(m->tmp);
- SETUP(m->empty);
- CLEAR(m->empty);
-
- /* this loop does only one repetition except for backrefs */
- for (;;) {
- endp = fast(m, start, stop, gf, gl);
- if (endp == NULL) { /* a miss */
- STATETEARDOWN(m);
- return(REG_NOMATCH);
- }
- if (nmatch == 0 && !g->backrefs)
- break; /* no further info needed */
-
- /* where? */
- assert(m->coldp != NULL);
- for (;;) {
- NOTE("finding start");
- endp = slow(m, m->coldp, stop, gf, gl);
- if (endp != NULL)
- break;
- assert(m->coldp < m->endp);
- m->coldp++;
- }
- if (nmatch == 1 && !g->backrefs)
- break; /* no further info needed */
-
- /* oh my, he wants the subexpressions... */
- if (m->pmatch == NULL)
- m->pmatch = (regmatch_t *)malloc((m->g->nsub + 1) *
- sizeof(regmatch_t));
- if (m->pmatch == NULL) {
- STATETEARDOWN(m);
- return(REG_ESPACE);
- }
- for (i = 1; i <= m->g->nsub; i++)
- m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1;
- if (!g->backrefs && !(m->eflags&REG_BACKR)) {
- NOTE("dissecting");
- dp = dissect(m, m->coldp, endp, gf, gl);
- } else {
- if (g->nplus > 0 && m->lastpos == NULL)
- m->lastpos = (char **)malloc((g->nplus+1) *
- sizeof(char *));
- if (g->nplus > 0 && m->lastpos == NULL) {
- free(m->pmatch);
- STATETEARDOWN(m);
- return(REG_ESPACE);
- }
- NOTE("backref dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
- }
- if (dp != NULL)
- break;
-
- /* uh-oh... we couldn't find a subexpression-level match */
- assert(g->backrefs); /* must be back references doing it */
- assert(g->nplus == 0 || m->lastpos != NULL);
- for (;;) {
- if (dp != NULL || endp <= m->coldp)
- break; /* defeat */
- NOTE("backoff");
- endp = slow(m, m->coldp, endp-1, gf, gl);
- if (endp == NULL)
- break; /* defeat */
- /* try it on a shorter possibility */
-#ifndef NDEBUG
- for (i = 1; i <= m->g->nsub; i++) {
- assert(m->pmatch[i].rm_so == -1);
- assert(m->pmatch[i].rm_eo == -1);
- }
-#endif
- NOTE("backoff dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
- }
- assert(dp == NULL || dp == endp);
- if (dp != NULL) /* found a shorter one */
- break;
-
- /* despite initial appearances, there is no match here */
- NOTE("false alarm");
- start = m->coldp + 1; /* recycle starting later */
- assert(start <= stop);
- }
-
- /* fill in the details if requested */
- if (nmatch > 0) {
- pmatch[0].rm_so = m->coldp - m->offp;
- pmatch[0].rm_eo = endp - m->offp;
- }
- if (nmatch > 1) {
- assert(m->pmatch != NULL);
- for (i = 1; i < nmatch; i++)
- if (i <= m->g->nsub)
- pmatch[i] = m->pmatch[i];
- else {
- pmatch[i].rm_so = -1;
- pmatch[i].rm_eo = -1;
- }
- }
-
- if (m->pmatch != NULL)
- free((char *)m->pmatch);
- if (m->lastpos != NULL)
- free((char *)m->lastpos);
- STATETEARDOWN(m);
- return(0);
-}
-
-/*
- - dissect - figure out what matched what, no back references
- == static char *dissect(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* == stop (success) always */
-dissect(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register sopno es; /* end sop of current subRE */
- register char *sp; /* start of string matched by it */
- register char *stp; /* string matched by it cannot pass here */
- register char *rest; /* start of rest of string */
- register char *tail; /* string unmatched by rest of RE */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *sep; /* end of string matched by subsubRE */
- register char *oldssp; /* previous ssp */
- register char *dp;
-
- AT("diss", start, stop, startst, stopst);
- sp = start;
- for (ss = startst; ss < stopst; ss = es) {
- /* identify end of subRE */
- es = ss;
- switch (OP(m->g->strip[es])) {
- case OPLUS_:
- case OQUEST_:
- es += OPND(m->g->strip[es]);
- break;
- case OCH_:
- while (OP(m->g->strip[es]) != O_CH)
- es += OPND(m->g->strip[es]);
- break;
- }
- es++;
-
- /* figure out what it matched */
- switch (OP(m->g->strip[ss])) {
- case OEND:
- assert(nope);
- break;
- case OCHAR:
- sp++;
- break;
- case OBOL:
- case OEOL:
- case OBOW:
- case OEOW:
- break;
- case OANY:
- case OANYOF:
- sp++;
- break;
- case OBACK_:
- case O_BACK:
- assert(nope);
- break;
- /* cases where length of match is hard to find */
- case OQUEST_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- /* did innards match? */
- if (slow(m, sp, rest, ssub, esub) != NULL) {
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- } else /* no */
- assert(sp == rest);
- sp = rest;
- break;
- case OPLUS_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- ssp = sp;
- oldssp = ssp;
- for (;;) { /* find last match of innards */
- sep = slow(m, ssp, rest, ssub, esub);
- if (sep == NULL || sep == ssp)
- break; /* failed or matched null */
- oldssp = ssp; /* on to next try */
- ssp = sep;
- }
- if (sep == NULL) {
- /* last successful match */
- sep = ssp;
- ssp = oldssp;
- }
- assert(sep == rest); /* must exhaust substring */
- assert(slow(m, ssp, sep, ssub, esub) == rest);
- dp = dissect(m, ssp, sep, ssub, esub);
- assert(dp == sep);
- sp = rest;
- break;
- case OCH_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = ss + OPND(m->g->strip[ss]) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;) { /* find first matching branch */
- if (slow(m, sp, rest, ssub, esub) == rest)
- break; /* it matched all of it */
- /* that one missed, try next one */
- assert(OP(m->g->strip[esub]) == OOR1);
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- sp = rest;
- break;
- case O_PLUS:
- case O_QUEST:
- case OOR1:
- case OOR2:
- case O_CH:
- assert(nope);
- break;
- case OLPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_so = sp - m->offp;
- break;
- case ORPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_eo = sp - m->offp;
- break;
- default: /* uh oh */
- assert(nope);
- break;
- }
- }
-
- assert(sp == stop);
- return(sp);
-}
-
-/*
- - backref - figure out what matched what, figuring in back references
- == static char *backref(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst, sopno lev);
- */
-static char * /* == stop (success) or NULL (failure) */
-backref(m, start, stop, startst, stopst, lev)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-sopno lev; /* PLUS nesting level */
-{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register char *sp; /* start of string matched by it */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *dp;
- register size_t len;
- register int hard;
- register sop s;
- register regoff_t offsave;
- register cset *cs;
-
- AT("back", start, stop, startst, stopst);
- sp = start;
-
- /* get as far as we can with easy stuff */
- hard = 0;
- for (ss = startst; !hard && ss < stopst; ss++)
- switch (OP(s = m->g->strip[ss])) {
- case OCHAR:
- if (sp == stop || *sp++ != (char)OPND(s))
- return(NULL);
- break;
- case OANY:
- if (sp == stop)
- return(NULL);
- sp++;
- break;
- case OANYOF:
- cs = &m->g->sets[OPND(s)];
- if (sp == stop || !CHIN(cs, *sp++))
- return(NULL);
- break;
- case OBOL:
- if ( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OEOL:
- if ( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags&REG_NEWLINE)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OBOW:
- if (( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) ||
- (sp > m->beginp &&
- !ISWORD(*(sp-1))) ) &&
- (sp < m->endp && ISWORD(*sp)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OEOW:
- if (( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags&REG_NEWLINE)) ||
- (sp < m->endp && !ISWORD(*sp)) ) &&
- (sp > m->beginp && ISWORD(*(sp-1))) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case O_QUEST:
- break;
- case OOR1: /* matches null but needs to skip */
- ss++;
- s = m->g->strip[ss];
- do {
- assert(OP(s) == OOR2);
- ss += OPND(s);
- } while (OP(s = m->g->strip[ss]) != O_CH);
- /* note that the ss++ gets us past the O_CH */
- break;
- default: /* have to make a choice */
- hard = 1;
- break;
- }
- if (!hard) { /* that was it! */
- if (sp != stop)
- return(NULL);
- return(sp);
- }
- ss--; /* adjust for the for's final increment */
-
- /* the hard stuff */
- AT("hard", sp, stop, ss, stopst);
- s = m->g->strip[ss];
- switch (OP(s)) {
- case OBACK_: /* the vilest depths */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- if (m->pmatch[i].rm_eo == -1)
- return(NULL);
- assert(m->pmatch[i].rm_so != -1);
- len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so;
- assert(stop - m->beginp >= len);
- if (sp > stop - len)
- return(NULL); /* not enough left to match */
- ssp = m->offp + m->pmatch[i].rm_so;
- if (memcmp(sp, ssp, len) != 0)
- return(NULL);
- while (m->g->strip[ss] != SOP(O_BACK, i))
- ss++;
- return(backref(m, sp+len, stop, ss+1, stopst, lev));
- break;
- case OQUEST_: /* to null or not */
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp); /* not */
- return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev));
- break;
- case OPLUS_:
- assert(m->lastpos != NULL);
- assert(lev+1 <= m->g->nplus);
- m->lastpos[lev+1] = sp;
- return(backref(m, sp, stop, ss+1, stopst, lev+1));
- break;
- case O_PLUS:
- if (sp == m->lastpos[lev]) /* last pass matched null */
- return(backref(m, sp, stop, ss+1, stopst, lev-1));
- /* try another pass */
- m->lastpos[lev] = sp;
- dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev);
- if (dp == NULL)
- return(backref(m, sp, stop, ss+1, stopst, lev-1));
- else
- return(dp);
- break;
- case OCH_: /* find the right one, if any */
- ssub = ss + 1;
- esub = ss + OPND(s) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;) { /* find first matching branch */
- dp = backref(m, sp, stop, ssub, esub, lev);
- if (dp != NULL)
- return(dp);
- /* that one missed, try next one */
- if (OP(m->g->strip[esub]) == O_CH)
- return(NULL); /* there is none */
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- break;
- case OLPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_so;
- m->pmatch[i].rm_so = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp);
- m->pmatch[i].rm_so = offsave;
- return(NULL);
- break;
- case ORPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_eo;
- m->pmatch[i].rm_eo = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp);
- m->pmatch[i].rm_eo = offsave;
- return(NULL);
- break;
- default: /* uh oh */
- assert(nope);
- break;
- }
-
- /* "can't happen" */
- assert(nope);
- /* NOTREACHED */
- return((char *)NULL); /* dummy */
-}
-
-/*
- - fast - step through the string at top speed
- == static char *fast(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* where tentative match ended, or NULL */
-fast(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register states st = m->st;
- register states fresh = m->fresh;
- register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start-1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *coldp; /* last p after which no match was underway */
-
- CLEAR(st);
- SET1(st, startst);
- st = step(m->g, startst, stopst, st, NOTHING, st);
- ASSIGN(fresh, st);
- SP("start", st, *p);
- coldp = NULL;
- for (;;) {
- /* next character */
- lastc = c;
- c = (p == m->endp) ? OUT : *p;
- if (EQ(st, fresh))
- coldp = p;
-
- /* is there an EOL and/or BOL between lastc and c? */
- flagch = '\0';
- i = 0;
- if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
- (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
- flagch = BOL;
- i = m->g->nbol;
- }
- if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
- (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
- flagch = (flagch == BOL) ? BOLEOL : EOL;
- i += m->g->neol;
- }
- if (i != 0) {
- for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boleol", st, c);
- }
-
- /* how about a word boundary? */
- if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
- (c != OUT && ISWORD(c)) ) {
- flagch = BOW;
- }
- if ( (lastc != OUT && ISWORD(lastc)) &&
- (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
- flagch = EOW;
- }
- if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boweow", st, c);
- }
-
- /* are we done? */
- if (ISSET(st, stopst) || p == stop)
- break; /* NOTE BREAK OUT */
-
- /* no, we must deal with this character */
- ASSIGN(tmp, st);
- ASSIGN(st, fresh);
- assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
- SP("aft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
- }
-
- assert(coldp != NULL);
- m->coldp = coldp;
- if (ISSET(st, stopst))
- return(p+1);
- else
- return(NULL);
-}
-
-/*
- - slow - step through the string more deliberately
- == static char *slow(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* where it ended */
-slow(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register states st = m->st;
- register states empty = m->empty;
- register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start-1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *matchp; /* last p at which a match ended */
-
- AT("slow", start, stop, startst, stopst);
- CLEAR(st);
- SET1(st, startst);
- SP("sstart", st, *p);
- st = step(m->g, startst, stopst, st, NOTHING, st);
- matchp = NULL;
- for (;;) {
- /* next character */
- lastc = c;
- c = (p == m->endp) ? OUT : *p;
-
- /* is there an EOL and/or BOL between lastc and c? */
- flagch = '\0';
- i = 0;
- if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
- (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
- flagch = BOL;
- i = m->g->nbol;
- }
- if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
- (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
- flagch = (flagch == BOL) ? BOLEOL : EOL;
- i += m->g->neol;
- }
- if (i != 0) {
- for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("sboleol", st, c);
- }
-
- /* how about a word boundary? */
- if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
- (c != OUT && ISWORD(c)) ) {
- flagch = BOW;
- }
- if ( (lastc != OUT && ISWORD(lastc)) &&
- (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
- flagch = EOW;
- }
- if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("sboweow", st, c);
- }
-
- /* are we done? */
- if (ISSET(st, stopst))
- matchp = p;
- if (EQ(st, empty) || p == stop)
- break; /* NOTE BREAK OUT */
-
- /* no, we must deal with this character */
- ASSIGN(tmp, st);
- ASSIGN(st, empty);
- assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
- SP("saft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
- }
-
- return(matchp);
-}
-
-
-/*
- - step - map set of states reachable before char to set reachable after
- == static states step(register struct re_guts *g, sopno start, sopno stop, \
- == register states bef, int ch, register states aft);
- == #define BOL (OUT+1)
- == #define EOL (BOL+1)
- == #define BOLEOL (BOL+2)
- == #define NOTHING (BOL+3)
- == #define BOW (BOL+4)
- == #define EOW (BOL+5)
- == #define CODEMAX (BOL+5) // highest code used
- == #define NONCHAR(c) ((c) > CHAR_MAX)
- == #define NNONCHAR (CODEMAX-CHAR_MAX)
- */
-static states
-step(g, start, stop, bef, ch, aft)
-register struct re_guts *g;
-sopno start; /* start state within strip */
-sopno stop; /* state after stop state within strip */
-register states bef; /* states reachable before */
-int ch; /* character or NONCHAR code */
-register states aft; /* states already known reachable after */
-{
- register cset *cs;
- register sop s;
- register sopno pc;
- register onestate here; /* note, macros know this name */
- register sopno look;
- register long i;
-
- for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) {
- s = g->strip[pc];
- switch (OP(s)) {
- case OEND:
- assert(pc == stop-1);
- break;
- case OCHAR:
- /* only characters can match */
- assert(!NONCHAR(ch) || ch != (char)OPND(s));
- if (ch == (char)OPND(s))
- FWD(aft, bef, 1);
- break;
- case OBOL:
- if (ch == BOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OEOL:
- if (ch == EOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OBOW:
- if (ch == BOW)
- FWD(aft, bef, 1);
- break;
- case OEOW:
- if (ch == EOW)
- FWD(aft, bef, 1);
- break;
- case OANY:
- if (!NONCHAR(ch))
- FWD(aft, bef, 1);
- break;
- case OANYOF:
- cs = &g->sets[OPND(s)];
- if (!NONCHAR(ch) && CHIN(cs, ch))
- FWD(aft, bef, 1);
- break;
- case OBACK_: /* ignored here */
- case O_BACK:
- FWD(aft, aft, 1);
- break;
- case OPLUS_: /* forward, this is just an empty */
- FWD(aft, aft, 1);
- break;
- case O_PLUS: /* both forward and back */
- FWD(aft, aft, 1);
- i = ISSETBACK(aft, OPND(s));
- BACK(aft, aft, OPND(s));
- if (!i && ISSETBACK(aft, OPND(s))) {
- /* oho, must reconsider loop body */
- pc -= OPND(s) + 1;
- INIT(here, pc);
- }
- break;
- case OQUEST_: /* two branches, both forward */
- FWD(aft, aft, 1);
- FWD(aft, aft, OPND(s));
- break;
- case O_QUEST: /* just an empty */
- FWD(aft, aft, 1);
- break;
- case OLPAREN: /* not significant here */
- case ORPAREN:
- FWD(aft, aft, 1);
- break;
- case OCH_: /* mark the first two branches */
- FWD(aft, aft, 1);
- assert(OP(g->strip[pc+OPND(s)]) == OOR2);
- FWD(aft, aft, OPND(s));
- break;
- case OOR1: /* done a branch, find the O_CH */
- if (ISSTATEIN(aft, here)) {
- for (look = 1;
- OP(s = g->strip[pc+look]) != O_CH;
- look += OPND(s))
- assert(OP(s) == OOR2);
- FWD(aft, aft, look);
- }
- break;
- case OOR2: /* propagate OCH_'s marking */
- FWD(aft, aft, 1);
- if (OP(g->strip[pc+OPND(s)]) != O_CH) {
- assert(OP(g->strip[pc+OPND(s)]) == OOR2);
- FWD(aft, aft, OPND(s));
- }
- break;
- case O_CH: /* just empty */
- FWD(aft, aft, 1);
- break;
- default: /* ooooops... */
- assert(nope);
- break;
- }
- }
-
- return(aft);
-}
-
-#ifdef REDEBUG
-/*
- - print - print a set of states
- == #ifdef REDEBUG
- == static void print(struct match *m, char *caption, states st, \
- == int ch, FILE *d);
- == #endif
- */
-static void
-print(m, caption, st, ch, d)
-struct match *m;
-char *caption;
-states st;
-int ch;
-FILE *d;
-{
- register struct re_guts *g = m->g;
- register int i;
- register int first = 1;
-
- if (!(m->eflags&REG_TRACE))
- return;
-
- fprintf(d, "%s", caption);
- if (ch != '\0')
- fprintf(d, " %s", pchar(ch));
- for (i = 0; i < g->nstates; i++)
- if (ISSET(st, i)) {
- fprintf(d, "%s%d", (first) ? "\t" : ", ", i);
- first = 0;
- }
- fprintf(d, "\n");
-}
-
-/*
- - at - print current situation
- == #ifdef REDEBUG
- == static void at(struct match *m, char *title, char *start, char *stop, \
- == sopno startst, sopno stopst);
- == #endif
- */
-static void
-at(m, title, start, stop, startst, stopst)
-struct match *m;
-char *title;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- if (!(m->eflags&REG_TRACE))
- return;
-
- printf("%s %s-", title, pchar(*start));
- printf("%s ", pchar(*stop));
- printf("%ld-%ld\n", (long)startst, (long)stopst);
-}
-
-#ifndef PCHARDONE
-#define PCHARDONE /* never again */
-/*
- - pchar - make a character printable
- == #ifdef REDEBUG
- == static char *pchar(int ch);
- == #endif
- *
- * Is this identical to regchar() over in debug.c? Well, yes. But a
- * duplicate here avoids having a debugging-capable regexec.o tied to
- * a matching debug.o, and this is convenient. It all disappears in
- * the non-debug compilation anyway, so it doesn't matter much.
- */
-static char * /* -> representation */
-pchar(ch)
-int ch;
-{
- static char pbuf[10];
-
- if (isprint(ch) || ch == ' ')
- sprintf(pbuf, "%c", ch);
- else
- sprintf(pbuf, "\\%o", ch);
- return(pbuf);
-}
-#endif
-#endif
-
-#undef matcher
-#undef fast
-#undef slow
-#undef dissect
-#undef backref
-#undef step
-#undef print
-#undef at
-#undef match
diff --git a/regex/engine.ih b/regex/engine.ih
deleted file mode 100644
index cc98334e75..0000000000
--- a/regex/engine.ih
+++ /dev/null
@@ -1,35 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === engine.c === */
-static int matcher(register struct re_guts *g, char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
-static char *dissect(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *backref(register struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev);
-static char *fast(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *slow(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static states step(register struct re_guts *g, sopno start, sopno stop, register states bef, int ch, register states aft);
-#define BOL (OUT+1)
-#define EOL (BOL+1)
-#define BOLEOL (BOL+2)
-#define NOTHING (BOL+3)
-#define BOW (BOL+4)
-#define EOW (BOL+5)
-#define CODEMAX (BOL+5) /* highest code used */
-#define NONCHAR(c) ((c) > CHAR_MAX)
-#define NNONCHAR (CODEMAX-CHAR_MAX)
-#ifdef REDEBUG
-static void print(struct match *m, char *caption, states st, int ch, FILE *d);
-#endif
-#ifdef REDEBUG
-static void at(struct match *m, char *title, char *start, char *stop, sopno startst, sopno stopst);
-#endif
-#ifdef REDEBUG
-static char *pchar(int ch);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/regex/main.c b/regex/main.c
deleted file mode 100644
index 657338a2c1..0000000000
--- a/regex/main.c
+++ /dev/null
@@ -1,510 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <regex.h>
-#include <assert.h>
-#include <stdlib.h>
-
-#include "main.ih"
-
-char *progname;
-int debug = 0;
-int line = 0;
-int status = 0;
-
-int copts = REG_EXTENDED;
-int eopts = 0;
-regoff_t startoff = 0;
-regoff_t endoff = 0;
-
-
-extern int split();
-extern void regprint();
-
-/*
- - main - do the simple case, hand off to regress() for regression
- */
-int main(argc, argv)
-int argc;
-char *argv[];
-{
- regex_t re;
-# define NS 10
- regmatch_t subs[NS];
- char erbuf[100];
- int err;
- size_t len;
- int c;
- int errflg = 0;
- register int i;
- extern int optind;
- extern char *optarg;
-
- progname = argv[0];
-
- while ((c = getopt(argc, argv, "c:e:S:E:x")) != EOF)
- switch (c) {
- case 'c': /* compile options */
- copts = options('c', optarg);
- break;
- case 'e': /* execute options */
- eopts = options('e', optarg);
- break;
- case 'S': /* start offset */
- startoff = (regoff_t)atoi(optarg);
- break;
- case 'E': /* end offset */
- endoff = (regoff_t)atoi(optarg);
- break;
- case 'x': /* Debugging. */
- debug++;
- break;
- case '?':
- default:
- errflg++;
- break;
- }
- if (errflg) {
- fprintf(stderr, "usage: %s ", progname);
- fprintf(stderr, "[-c copt][-C][-d] [re]\n");
- exit(2);
- }
-
- if (optind >= argc) {
- regress(stdin);
- exit(status);
- }
-
- err = regcomp(&re, argv[optind++], copts);
- if (err) {
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "error %s, %d/%d `%s'\n",
- eprint(err), len, sizeof(erbuf), erbuf);
- exit(status);
- }
- regprint(&re, stdout);
-
- if (optind >= argc) {
- regfree(&re);
- exit(status);
- }
-
- if (eopts&REG_STARTEND) {
- subs[0].rm_so = startoff;
- subs[0].rm_eo = strlen(argv[optind]) - endoff;
- }
- err = regexec(&re, argv[optind], (size_t)NS, subs, eopts);
- if (err) {
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "error %s, %d/%d `%s'\n",
- eprint(err), len, sizeof(erbuf), erbuf);
- exit(status);
- }
- if (!(copts&REG_NOSUB)) {
- len = (int)(subs[0].rm_eo - subs[0].rm_so);
- if (subs[0].rm_so != -1) {
- if (len != 0)
- printf("match `%.*s'\n", (int)len,
- argv[optind] + subs[0].rm_so);
- else
- printf("match `'@%.1s\n",
- argv[optind] + subs[0].rm_so);
- }
- for (i = 1; i < NS; i++)
- if (subs[i].rm_so != -1)
- printf("(%d) `%.*s'\n", i,
- (int)(subs[i].rm_eo - subs[i].rm_so),
- argv[optind] + subs[i].rm_so);
- }
- exit(status);
-}
-
-/*
- - regress - main loop of regression test
- == void regress(FILE *in);
- */
-void
-regress(in)
-FILE *in;
-{
- char inbuf[1000];
-# define MAXF 10
- char *f[MAXF];
- int nf;
- int i;
- char erbuf[100];
- size_t ne;
- char *badpat = "invalid regular expression";
-# define SHORT 10
- char *bpname = "REG_BADPAT";
- regex_t re;
-
- while (fgets(inbuf, sizeof(inbuf), in) != NULL) {
- line++;
- if (inbuf[0] == '#' || inbuf[0] == '\n')
- continue; /* NOTE CONTINUE */
- inbuf[strlen(inbuf)-1] = '\0'; /* get rid of stupid \n */
- if (debug)
- fprintf(stdout, "%d:\n", line);
- nf = split(inbuf, f, MAXF, "\t\t");
- if (nf < 3) {
- fprintf(stderr, "bad input, line %d\n", line);
- exit(1);
- }
- for (i = 0; i < nf; i++)
- if (strcmp(f[i], "\"\"") == 0)
- f[i] = "";
- if (nf <= 3)
- f[3] = NULL;
- if (nf <= 4)
- f[4] = NULL;
- try(f[0], f[1], f[2], f[3], f[4], options('c', f[1]));
- if (opt('&', f[1])) /* try with either type of RE */
- try(f[0], f[1], f[2], f[3], f[4],
- options('c', f[1]) &~ REG_EXTENDED);
- }
-
- ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
- if (strcmp(erbuf, badpat) != 0 || ne != strlen(badpat)+1) {
- fprintf(stderr, "end: regerror() test gave `%s' not `%s'\n",
- erbuf, badpat);
- status = 1;
- }
- ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, (size_t)SHORT);
- if (strncmp(erbuf, badpat, SHORT-1) != 0 || erbuf[SHORT-1] != '\0' ||
- ne != strlen(badpat)+1) {
- fprintf(stderr, "end: regerror() short test gave `%s' not `%.*s'\n",
- erbuf, SHORT-1, badpat);
- status = 1;
- }
- ne = regerror(REG_ITOA|REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
- if (strcmp(erbuf, bpname) != 0 || ne != strlen(bpname)+1) {
- fprintf(stderr, "end: regerror() ITOA test gave `%s' not `%s'\n",
- erbuf, bpname);
- status = 1;
- }
- re.re_endp = bpname;
- ne = regerror(REG_ATOI, &re, erbuf, sizeof(erbuf));
- if (atoi(erbuf) != (int)REG_BADPAT) {
- fprintf(stderr, "end: regerror() ATOI test gave `%s' not `%ld'\n",
- erbuf, (long)REG_BADPAT);
- status = 1;
- } else if (ne != strlen(erbuf)+1) {
- fprintf(stderr, "end: regerror() ATOI test len(`%s') = %ld\n",
- erbuf, (long)REG_BADPAT);
- status = 1;
- }
-}
-
-/*
- - try - try it, and report on problems
- == void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
- */
-void
-try(f0, f1, f2, f3, f4, opts)
-char *f0;
-char *f1;
-char *f2;
-char *f3;
-char *f4;
-int opts; /* may not match f1 */
-{
- regex_t re;
-# define NSUBS 10
- regmatch_t subs[NSUBS];
-# define NSHOULD 15
- char *should[NSHOULD];
- int nshould;
- char erbuf[100];
- int err;
- int len;
- char *type = (opts & REG_EXTENDED) ? "ERE" : "BRE";
- register int i;
- char *grump;
- char f0copy[1000];
- char f2copy[1000];
-
- strcpy(f0copy, f0);
- re.re_endp = (opts&REG_PEND) ? f0copy + strlen(f0copy) : NULL;
- fixstr(f0copy);
- err = regcomp(&re, f0copy, opts);
- if (err != 0 && (!opt('C', f1) || err != efind(f2))) {
- /* unexpected error or wrong error */
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "%d: %s error %s, %d/%d `%s'\n",
- line, type, eprint(err), len,
- sizeof(erbuf), erbuf);
- status = 1;
- } else if (err == 0 && opt('C', f1)) {
- /* unexpected success */
- fprintf(stderr, "%d: %s should have given REG_%s\n",
- line, type, f2);
- status = 1;
- err = 1; /* so we won't try regexec */
- }
-
- if (err != 0) {
- regfree(&re);
- return;
- }
-
- strcpy(f2copy, f2);
- fixstr(f2copy);
-
- if (options('e', f1)&REG_STARTEND) {
- if (strchr(f2, '(') == NULL || strchr(f2, ')') == NULL)
- fprintf(stderr, "%d: bad STARTEND syntax\n", line);
- subs[0].rm_so = strchr(f2, '(') - f2 + 1;
- subs[0].rm_eo = strchr(f2, ')') - f2;
- }
- err = regexec(&re, f2copy, NSUBS, subs, options('e', f1));
-
- if (err != 0 && (f3 != NULL || err != REG_NOMATCH)) {
- /* unexpected error or wrong error */
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "%d: %s exec error %s, %d/%d `%s'\n",
- line, type, eprint(err), len,
- sizeof(erbuf), erbuf);
- status = 1;
- } else if (err != 0) {
- /* nothing more to check */
- } else if (f3 == NULL) {
- /* unexpected success */
- fprintf(stderr, "%d: %s exec should have failed\n",
- line, type);
- status = 1;
- err = 1; /* just on principle */
- } else if (opts&REG_NOSUB) {
- /* nothing more to check */
- } else if ((grump = check(f2, subs[0], f3)) != NULL) {
- fprintf(stderr, "%d: %s %s\n", line, type, grump);
- status = 1;
- err = 1;
- }
-
- if (err != 0 || f4 == NULL) {
- regfree(&re);
- return;
- }
-
- for (i = 1; i < NSHOULD; i++)
- should[i] = NULL;
- nshould = split(f4, should+1, NSHOULD-1, ",");
- if (nshould == 0) {
- nshould = 1;
- should[1] = "";
- }
- for (i = 1; i < NSUBS; i++) {
- grump = check(f2, subs[i], should[i]);
- if (grump != NULL) {
- fprintf(stderr, "%d: %s $%d %s\n", line,
- type, i, grump);
- status = 1;
- err = 1;
- }
- }
-
- regfree(&re);
-}
-
-/*
- - options - pick options out of a regression-test string
- == int options(int type, char *s);
- */
-int
-options(type, s)
-int type; /* 'c' compile, 'e' exec */
-char *s;
-{
- register char *p;
- register int o = (type == 'c') ? copts : eopts;
- register char *legal = (type == 'c') ? "bisnmp" : "^$#tl";
-
- for (p = s; *p != '\0'; p++)
- if (strchr(legal, *p) != NULL)
- switch (*p) {
- case 'b':
- o &= ~REG_EXTENDED;
- break;
- case 'i':
- o |= REG_ICASE;
- break;
- case 's':
- o |= REG_NOSUB;
- break;
- case 'n':
- o |= REG_NEWLINE;
- break;
- case 'm':
- o &= ~REG_EXTENDED;
- o |= REG_NOSPEC;
- break;
- case 'p':
- o |= REG_PEND;
- break;
- case '^':
- o |= REG_NOTBOL;
- break;
- case '$':
- o |= REG_NOTEOL;
- break;
- case '#':
- o |= REG_STARTEND;
- break;
- case 't': /* trace */
- o |= REG_TRACE;
- break;
- case 'l': /* force long representation */
- o |= REG_LARGE;
- break;
- case 'r': /* force backref use */
- o |= REG_BACKR;
- break;
- }
- return(o);
-}
-
-/*
- - opt - is a particular option in a regression string?
- == int opt(int c, char *s);
- */
-int /* predicate */
-opt(c, s)
-int c;
-char *s;
-{
- return(strchr(s, c) != NULL);
-}
-
-/*
- - fixstr - transform magic characters in strings
- == void fixstr(register char *p);
- */
-void
-fixstr(p)
-register char *p;
-{
- if (p == NULL)
- return;
-
- for (; *p != '\0'; p++)
- if (*p == 'N')
- *p = '\n';
- else if (*p == 'T')
- *p = '\t';
- else if (*p == 'S')
- *p = ' ';
- else if (*p == 'Z')
- *p = '\0';
-}
-
-/*
- - check - check a substring match
- == char *check(char *str, regmatch_t sub, char *should);
- */
-char * /* NULL or complaint */
-check(str, sub, should)
-char *str;
-regmatch_t sub;
-char *should;
-{
- register int len;
- register int shlen;
- register char *p;
- static char grump[500];
- register char *at = NULL;
-
- if (should != NULL && strcmp(should, "-") == 0)
- should = NULL;
- if (should != NULL && should[0] == '@') {
- at = should + 1;
- should = "";
- }
-
- /* check rm_so and rm_eo for consistency */
- if (sub.rm_so > sub.rm_eo || (sub.rm_so == -1 && sub.rm_eo != -1) ||
- (sub.rm_so != -1 && sub.rm_eo == -1) ||
- (sub.rm_so != -1 && sub.rm_so < 0) ||
- (sub.rm_eo != -1 && sub.rm_eo < 0) ) {
- sprintf(grump, "start %ld end %ld", (long)sub.rm_so,
- (long)sub.rm_eo);
- return(grump);
- }
-
- /* check for no match */
- if (sub.rm_so == -1 && should == NULL)
- return(NULL);
- if (sub.rm_so == -1)
- return("did not match");
-
- /* check for in range */
- if (sub.rm_eo > strlen(str)) {
- sprintf(grump, "start %ld end %ld, past end of string",
- (long)sub.rm_so, (long)sub.rm_eo);
- return(grump);
- }
-
- len = (int)(sub.rm_eo - sub.rm_so);
- shlen = (int)strlen(should);
- p = str + sub.rm_so;
-
- /* check for not supposed to match */
- if (should == NULL) {
- sprintf(grump, "matched `%.*s'", len, p);
- return(grump);
- }
-
- /* check for wrong match */
- if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) {
- sprintf(grump, "matched `%.*s' instead", len, p);
- return(grump);
- }
- if (shlen > 0)
- return(NULL);
-
- /* check null match in right place */
- if (at == NULL)
- return(NULL);
- shlen = strlen(at);
- if (shlen == 0)
- shlen = 1; /* force check for end-of-string */
- if (strncmp(p, at, shlen) != 0) {
- sprintf(grump, "matched null at `%.20s'", p);
- return(grump);
- }
- return(NULL);
-}
-
-/*
- - eprint - convert error number to name
- == static char *eprint(int err);
- */
-static char *
-eprint(err)
-int err;
-{
- static char epbuf[100];
- size_t len;
-
- len = regerror(REG_ITOA|err, (regex_t *)NULL, epbuf, sizeof(epbuf));
- assert(len <= sizeof(epbuf));
- return(epbuf);
-}
-
-/*
- - efind - convert error name to number
- == static int efind(char *name);
- */
-static int
-efind(name)
-char *name;
-{
- static char efbuf[100];
- regex_t re;
-
- sprintf(efbuf, "REG_%s", name);
- assert(strlen(efbuf) < sizeof(efbuf));
- re.re_endp = efbuf;
- (void) regerror(REG_ATOI, &re, efbuf, sizeof(efbuf));
- return(atoi(efbuf));
-}
diff --git a/regex/main.ih b/regex/main.ih
deleted file mode 100644
index 5a0118ac44..0000000000
--- a/regex/main.ih
+++ /dev/null
@@ -1,19 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === main.c === */
-void regress(FILE *in);
-void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
-int options(int type, char *s);
-int opt(int c, char *s);
-void fixstr(register char *p);
-char *check(char *str, regmatch_t sub, char *should);
-static char *eprint(int err);
-static int efind(char *name);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/regex/mkh b/regex/mkh
deleted file mode 100644
index 252b246c7b..0000000000
--- a/regex/mkh
+++ /dev/null
@@ -1,76 +0,0 @@
-#! /bin/sh
-# mkh - pull headers out of C source
-PATH=/bin:/usr/bin ; export PATH
-
-# egrep pattern to pick out marked lines
-egrep='^ =([ ]|$)'
-
-# Sed program to process marked lines into lines for the header file.
-# The markers have already been removed. Two things are done here: removal
-# of backslashed newlines, and some fudging of comments. The first is done
-# because -o needs to have prototypes on one line to strip them down.
-# Getting comments into the output is tricky; we turn C++-style // comments
-# into /* */ comments, after altering any existing */'s to avoid trouble.
-peel=' /\\$/N
- /\\\n[ ]*/s///g
- /\/\//s;\*/;* /;g
- /\/\//s;//\(.*\);/*\1 */;'
-
-for a
-do
- case "$a" in
- -o) # old (pre-function-prototype) compiler
- # add code to comment out argument lists
- peel="$peel
- "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1(/*\2*/);'
- shift
- ;;
- -b) # funny Berkeley __P macro
- peel="$peel
- "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1 __P((\2));'
- shift
- ;;
- -s) # compiler doesn't like `static foo();'
- # add code to get rid of the `static'
- peel="$peel
- "'/^static[ ][^\/]*[a-zA-Z0-9_)](.*)/s;static.;;'
- shift
- ;;
- -p) # private declarations
- egrep='^ ==([ ]|$)'
- shift
- ;;
- -i) # wrap in #ifndef, argument is name
- ifndef="$2"
- shift ; shift
- ;;
- *) break
- ;;
- esac
-done
-
-if test " $ifndef" != " "
-then
- echo "#ifndef $ifndef"
- echo "#define $ifndef /* never again */"
-fi
-echo "/* ========= begin header generated by $0 ========= */"
-echo '#ifdef __cplusplus'
-echo 'extern "C" {'
-echo '#endif'
-for f
-do
- echo
- echo "/* === $f === */"
- egrep "$egrep" $f | sed 's/^ ==*[ ]//;s/^ ==*$//' | sed "$peel"
- echo
-done
-echo '#ifdef __cplusplus'
-echo '}'
-echo '#endif'
-echo "/* ========= end header generated by $0 ========= */"
-if test " $ifndef" != " "
-then
- echo "#endif"
-fi
-exit 0
diff --git a/regex/regcomp.c b/regex/regcomp.c
deleted file mode 100644
index 0b939461bd..0000000000
--- a/regex/regcomp.c
+++ /dev/null
@@ -1,1608 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-
-#define POSIX_MISTAKE
-
-#include "utils.h"
-#include "regex.h"
-#include "regex2.h"
-
-#include "cclass.h"
-#include "cname.h"
-
-/*
- * parse structure, passed up and down to avoid global variables and
- * other clumsinesses
- */
-struct parse {
- char *next; /* next character in RE */
- char *end; /* end of string (-> NUL normally) */
- int error; /* has an error been seen? */
- sop *strip; /* malloced strip */
- sopno ssize; /* malloced strip size (allocated) */
- sopno slen; /* malloced strip length (used) */
- int ncsalloc; /* number of csets allocated */
- struct re_guts *g;
-# define NPAREN 10 /* we need to remember () 1-9 for back refs */
- sopno pbegin[NPAREN]; /* -> ( ([0] unused) */
- sopno pend[NPAREN]; /* -> ) ([0] unused) */
-};
-
-#include "regcomp.ih"
-
-static char nuls[10]; /* place to point scanner in event of error */
-
-/*
- * macros for use with parse structure
- * BEWARE: these know that the parse structure is named `p' !!!
- */
-#define PEEK() (*p->next)
-#define PEEK2() (*(p->next+1))
-#define MORE() (p->next < p->end)
-#define MORE2() (p->next+1 < p->end)
-#define SEE(c) (MORE() && PEEK() == (c))
-#define SEETWO(a, b) (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b))
-#define EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0)
-#define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0)
-#define NEXT() (p->next++)
-#define NEXT2() (p->next += 2)
-#define NEXTn(n) (p->next += (n))
-#define GETNEXT() (*p->next++)
-#define SETERROR(e) seterr(p, (e))
-#define REQUIRE(co, e) (void) ((co) || SETERROR(e))
-#define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e))
-#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e))
-#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e))
-#define EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd))
-#define INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos)
-#define AHEAD(pos) dofwd(p, pos, HERE()-(pos))
-#define ASTERN(sop, pos) EMIT(sop, HERE()-pos)
-#define HERE() (p->slen)
-#define THERE() (p->slen - 1)
-#define THERETHERE() (p->slen - 2)
-#define DROP(n) (p->slen -= (n))
-
-#ifndef NDEBUG
-static int never = 0; /* for use in asserts; shuts lint up */
-#else
-#define never 0 /* some <assert.h>s have bugs too */
-#endif
-
-/*
- - regcomp - interface for parser and compilation
- = API_EXPORT(int) regcomp(regex_t *, const char *, int);
- = #define REG_BASIC 0000
- = #define REG_EXTENDED 0001
- = #define REG_ICASE 0002
- = #define REG_NOSUB 0004
- = #define REG_NEWLINE 0010
- = #define REG_NOSPEC 0020
- = #define REG_PEND 0040
- = #define REG_DUMP 0200
- */
-API_EXPORT(int) /* 0 success, otherwise REG_something */
-regcomp(preg, pattern, cflags)
-regex_t *preg;
-const char *pattern;
-int cflags;
-{
- struct parse pa;
- register struct re_guts *g;
- register struct parse *p = &pa;
- register int i;
- register size_t len;
-#ifdef REDEBUG
-# define GOODFLAGS(f) (f)
-#else
-# define GOODFLAGS(f) ((f)&~REG_DUMP)
-#endif
-
- cflags = GOODFLAGS(cflags);
- if ((cflags&REG_EXTENDED) && (cflags&REG_NOSPEC))
- return(REG_INVARG);
-
- if (cflags&REG_PEND) {
- if (preg->re_endp < pattern)
- return(REG_INVARG);
- len = preg->re_endp - pattern;
- } else
- len = strlen((char *)pattern);
-
- /* do the mallocs early so failure handling is easy */
- g = (struct re_guts *)malloc(sizeof(struct re_guts) +
- (NC-1)*sizeof(cat_t));
- if (g == NULL)
- return(REG_ESPACE);
- p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
- p->strip = (sop *)malloc(p->ssize * sizeof(sop));
- p->slen = 0;
- if (p->strip == NULL) {
- free((char *)g);
- return(REG_ESPACE);
- }
-
- /* set things up */
- p->g = g;
- p->next = (char *)pattern; /* convenience; we do not modify it */
- p->end = p->next + len;
- p->error = 0;
- p->ncsalloc = 0;
- for (i = 0; i < NPAREN; i++) {
- p->pbegin[i] = 0;
- p->pend[i] = 0;
- }
- g->csetsize = NC;
- g->sets = NULL;
- g->setbits = NULL;
- g->ncsets = 0;
- g->cflags = cflags;
- g->iflags = 0;
- g->nbol = 0;
- g->neol = 0;
- g->must = NULL;
- g->mlen = 0;
- g->nsub = 0;
- g->ncategories = 1; /* category 0 is "everything else" */
- g->categories = &g->catspace[-(CHAR_MIN)];
- (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t));
- g->backrefs = 0;
-
- /* do it */
- EMIT(OEND, 0);
- g->firststate = THERE();
- if (cflags&REG_EXTENDED)
- p_ere(p, OUT);
- else if (cflags&REG_NOSPEC)
- p_str(p);
- else
- p_bre(p, OUT, OUT);
- EMIT(OEND, 0);
- g->laststate = THERE();
-
- /* tidy up loose ends and fill things in */
- categorize(p, g);
- stripsnug(p, g);
- findmust(p, g);
- g->nplus = pluscount(p, g);
- g->magic = MAGIC2;
- preg->re_nsub = g->nsub;
- preg->re_g = g;
- preg->re_magic = MAGIC1;
-#ifndef REDEBUG
- /* not debugging, so can't rely on the assert() in regexec() */
- if (g->iflags&BAD)
- SETERROR(REG_ASSERT);
-#endif
-
- /* win or lose, we're done */
- if (p->error != 0) /* lose */
- regfree(preg);
- return(p->error);
-}
-
-/*
- - p_ere - ERE parser top level, concatenation and alternation
- == static void p_ere(register struct parse *p, int stop);
- */
-static void
-p_ere(p, stop)
-register struct parse *p;
-int stop; /* character this ERE should end at */
-{
- register char c;
- register sopno prevback = 0;
- register sopno prevfwd = 0;
- register sopno conc;
- register int first = 1; /* is this the first alternative? */
-
- for (;;) {
- /* do a bunch of concatenated expressions */
- conc = HERE();
- while (MORE() && (c = PEEK()) != '|' && c != stop)
- p_ere_exp(p);
- (void) REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */
-
- if (!EAT('|'))
- break; /* NOTE BREAK OUT */
-
- if (first) {
- INSERT(OCH_, conc); /* offset is wrong */
- prevfwd = conc;
- prevback = conc;
- first = 0;
- }
- ASTERN(OOR1, prevback);
- prevback = THERE();
- AHEAD(prevfwd); /* fix previous offset */
- prevfwd = HERE();
- EMIT(OOR2, 0); /* offset is very wrong */
- }
-
- if (!first) { /* tail-end fixups */
- AHEAD(prevfwd);
- ASTERN(O_CH, prevback);
- }
-
- assert(!MORE() || SEE(stop));
-}
-
-/*
- - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op
- == static void p_ere_exp(register struct parse *p);
- */
-static void
-p_ere_exp(p)
-register struct parse *p;
-{
- register char c;
- register sopno pos;
- register int count;
- register int count2;
- register sopno subno;
- int wascaret = 0;
-
- assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
-
- pos = HERE();
- switch (c) {
- case '(':
- REQUIRE(MORE(), REG_EPAREN);
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- if (!SEE(')'))
- p_ere(p, ')');
- if (subno < NPAREN) {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- MUSTEAT(')', REG_EPAREN);
- break;
-#ifndef POSIX_MISTAKE
- case ')': /* happens only if no current unmatched ( */
- /*
- * You may ask, why the ifndef? Because I didn't notice
- * this until slightly too late for 1003.2, and none of the
- * other 1003.2 regular-expression reviewers noticed it at
- * all. So an unmatched ) is legal POSIX, at least until
- * we can get it fixed.
- */
- SETERROR(REG_EPAREN);
- break;
-#endif
- case '^':
- EMIT(OBOL, 0);
- p->g->iflags |= USEBOL;
- p->g->nbol++;
- wascaret = 1;
- break;
- case '$':
- EMIT(OEOL, 0);
- p->g->iflags |= USEEOL;
- p->g->neol++;
- break;
- case '|':
- SETERROR(REG_EMPTY);
- break;
- case '*':
- case '+':
- case '?':
- SETERROR(REG_BADRPT);
- break;
- case '.':
- if (p->g->cflags&REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case '\\':
- REQUIRE(MORE(), REG_EESCAPE);
- c = GETNEXT();
- ordinary(p, c);
- break;
- case '{': /* okay as ordinary except if digit follows */
- REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, c);
- break;
- }
-
- if (!MORE())
- return;
- c = PEEK();
- /* we call { a repetition if followed by a digit */
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit(PEEK2())) ))
- return; /* no repetition, we're done */
- NEXT();
-
- REQUIRE(!wascaret, REG_BADRPT);
- switch (c) {
- case '*': /* implemented as +? */
- /* this case does not require the (y|) trick, noKLUDGE */
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- INSERT(OQUEST_, pos);
- ASTERN(O_QUEST, pos);
- break;
- case '+':
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- break;
- case '?':
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, pos); /* offset slightly wrong */
- ASTERN(OOR1, pos); /* this one's right */
- AHEAD(pos); /* fix the OCH_ */
- EMIT(OOR2, 0); /* offset very wrong... */
- AHEAD(THERE()); /* ...so fix it */
- ASTERN(O_CH, THERETHERE());
- break;
- case '{':
- count = p_count(p);
- if (EAT(',')) {
- if (isdigit(PEEK())) {
- count2 = p_count(p);
- REQUIRE(count <= count2, REG_BADBR);
- } else /* single number with comma */
- count2 = INFINITY;
- } else /* just a single number */
- count2 = count;
- repeat(p, pos, count, count2);
- if (!EAT('}')) { /* error heuristics */
- while (MORE() && PEEK() != '}')
- NEXT();
- REQUIRE(MORE(), REG_EBRACE);
- SETERROR(REG_BADBR);
- }
- break;
- }
-
- if (!MORE())
- return;
- c = PEEK();
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit(PEEK2())) ) )
- return;
- SETERROR(REG_BADRPT);
-}
-
-/*
- - p_str - string (no metacharacters) "parser"
- == static void p_str(register struct parse *p);
- */
-static void
-p_str(p)
-register struct parse *p;
-{
- REQUIRE(MORE(), REG_EMPTY);
- while (MORE())
- ordinary(p, GETNEXT());
-}
-
-/*
- - p_bre - BRE parser top level, anchoring and concatenation
- == static void p_bre(register struct parse *p, register int end1, \
- == register int end2);
- * Giving end1 as OUT essentially eliminates the end1/end2 check.
- *
- * This implementation is a bit of a kludge, in that a trailing $ is first
- * taken as an ordinary character and then revised to be an anchor. The
- * only undesirable side effect is that '$' gets included as a character
- * category in such cases. This is fairly harmless; not worth fixing.
- * The amount of lookahead needed to avoid this kludge is excessive.
- */
-static void
-p_bre(p, end1, end2)
-register struct parse *p;
-register int end1; /* first terminating character */
-register int end2; /* second terminating character */
-{
- register sopno start = HERE();
- register int first = 1; /* first subexpression? */
- register int wasdollar = 0;
-
- if (EAT('^')) {
- EMIT(OBOL, 0);
- p->g->iflags |= USEBOL;
- p->g->nbol++;
- }
- while (MORE() && !SEETWO(end1, end2)) {
- wasdollar = p_simp_re(p, first);
- first = 0;
- }
- if (wasdollar) { /* oops, that was a trailing anchor */
- DROP(1);
- EMIT(OEOL, 0);
- p->g->iflags |= USEEOL;
- p->g->neol++;
- }
-
- REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */
-}
-
-/*
- - p_simp_re - parse a simple RE, an atom possibly followed by a repetition
- == static int p_simp_re(register struct parse *p, int starordinary);
- */
-static int /* was the simple RE an unbackslashed $? */
-p_simp_re(p, starordinary)
-register struct parse *p;
-int starordinary; /* is a leading * an ordinary character? */
-{
- register int c;
- register int count;
- register int count2;
- register sopno pos;
- register int i;
- register sopno subno;
-# define BACKSL (1<<CHAR_BIT)
-
- pos = HERE(); /* repetion op, if any, covers from here */
-
- assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
- if (c == '\\') {
- REQUIRE(MORE(), REG_EESCAPE);
- c = BACKSL | (unsigned char)GETNEXT();
- }
- switch (c) {
- case '.':
- if (p->g->cflags&REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case BACKSL|'{':
- SETERROR(REG_BADRPT);
- break;
- case BACKSL|'(':
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- /* the MORE here is an error heuristic */
- if (MORE() && !SEETWO('\\', ')'))
- p_bre(p, '\\', ')');
- if (subno < NPAREN) {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
- break;
- case BACKSL|')': /* should not get here -- must be user */
- case BACKSL|'}':
- SETERROR(REG_EPAREN);
- break;
- case BACKSL|'1':
- case BACKSL|'2':
- case BACKSL|'3':
- case BACKSL|'4':
- case BACKSL|'5':
- case BACKSL|'6':
- case BACKSL|'7':
- case BACKSL|'8':
- case BACKSL|'9':
- i = (c&~BACKSL) - '0';
- assert(i < NPAREN);
- if (p->pend[i] != 0) {
- assert(i <= p->g->nsub);
- EMIT(OBACK_, i);
- assert(p->pbegin[i] != 0);
- assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
- assert(OP(p->strip[p->pend[i]]) == ORPAREN);
- (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
- EMIT(O_BACK, i);
- } else
- SETERROR(REG_ESUBREG);
- p->g->backrefs = 1;
- break;
- case '*':
- REQUIRE(starordinary, REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, (char)c); /* takes off BACKSL, if any */
- break;
- }
-
- if (EAT('*')) { /* implemented as +? */
- /* this case does not require the (y|) trick, noKLUDGE */
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- INSERT(OQUEST_, pos);
- ASTERN(O_QUEST, pos);
- } else if (EATTWO('\\', '{')) {
- count = p_count(p);
- if (EAT(',')) {
- if (MORE() && isdigit(PEEK())) {
- count2 = p_count(p);
- REQUIRE(count <= count2, REG_BADBR);
- } else /* single number with comma */
- count2 = INFINITY;
- } else /* just a single number */
- count2 = count;
- repeat(p, pos, count, count2);
- if (!EATTWO('\\', '}')) { /* error heuristics */
- while (MORE() && !SEETWO('\\', '}'))
- NEXT();
- REQUIRE(MORE(), REG_EBRACE);
- SETERROR(REG_BADBR);
- }
- } else if (c == (unsigned char)'$') /* $ (but not \$) ends it */
- return(1);
-
- return(0);
-}
-
-/*
- - p_count - parse a repetition count
- == static int p_count(register struct parse *p);
- */
-static int /* the value */
-p_count(p)
-register struct parse *p;
-{
- register int count = 0;
- register int ndigits = 0;
-
- while (MORE() && isdigit(PEEK()) && count <= DUPMAX) {
- count = count*10 + (GETNEXT() - '0');
- ndigits++;
- }
-
- REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
- return(count);
-}
-
-/*
- - p_bracket - parse a bracketed character list
- == static void p_bracket(register struct parse *p);
- *
- * Note a significant property of this code: if the allocset() did SETERROR,
- * no set operations are done.
- */
-static void
-p_bracket(p)
-register struct parse *p;
-{
- register cset *cs = allocset(p);
- register int invert = 0;
-
- /* Dept of Truly Sickening Special-Case Kludges */
- if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) {
- EMIT(OBOW, 0);
- NEXTn(6);
- return;
- }
- if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) {
- EMIT(OEOW, 0);
- NEXTn(6);
- return;
- }
-
- if (EAT('^'))
- invert++; /* make note to invert set at end */
- if (EAT(']'))
- CHadd(cs, ']');
- else if (EAT('-'))
- CHadd(cs, '-');
- while (MORE() && PEEK() != ']' && !SEETWO('-', ']'))
- p_b_term(p, cs);
- if (EAT('-'))
- CHadd(cs, '-');
- MUSTEAT(']', REG_EBRACK);
-
- if (p->error != 0) /* don't mess things up further */
- return;
-
- if (p->g->cflags&REG_ICASE) {
- register int i;
- register int ci;
-
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i) && isalpha(i)) {
- ci = othercase(i);
- if (ci != i)
- CHadd(cs, ci);
- }
- if (cs->multis != NULL)
- mccase(p, cs);
- }
- if (invert) {
- register int i;
-
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i))
- CHsub(cs, i);
- else
- CHadd(cs, i);
- if (p->g->cflags&REG_NEWLINE)
- CHsub(cs, '\n');
- if (cs->multis != NULL)
- mcinvert(p, cs);
- }
-
- assert(cs->multis == NULL); /* xxx */
-
- if (nch(p, cs) == 1) { /* optimize singleton sets */
- ordinary(p, firstch(p, cs));
- freeset(p, cs);
- } else
- EMIT(OANYOF, freezeset(p, cs));
-}
-
-/*
- - p_b_term - parse one term of a bracketed character list
- == static void p_b_term(register struct parse *p, register cset *cs);
- */
-static void
-p_b_term(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char c;
- register char start, finish;
- register int i;
-
- /* classify what we've got */
- switch ((MORE()) ? PEEK() : '\0') {
- case '[':
- c = (MORE2()) ? PEEK2() : '\0';
- break;
- case '-':
- SETERROR(REG_ERANGE);
- return; /* NOTE RETURN */
- break;
- default:
- c = '\0';
- break;
- }
-
- switch (c) {
- case ':': /* character class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECTYPE);
- p_b_cclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
- break;
- case '=': /* equivalence class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
- p_b_eclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
- break;
- default: /* symbol, ordinary character, or range */
-/* xxx revision needed for multichar stuff */
- start = p_b_symbol(p);
- if (SEE('-') && MORE2() && PEEK2() != ']') {
- /* range */
- NEXT();
- if (EAT('-'))
- finish = '-';
- else
- finish = p_b_symbol(p);
- } else
- finish = start;
-/* xxx what about signed chars here... */
- REQUIRE(start <= finish, REG_ERANGE);
- for (i = start; i <= finish; i++)
- CHadd(cs, i);
- break;
- }
-}
-
-/*
- - p_b_cclass - parse a character-class name and deal with it
- == static void p_b_cclass(register struct parse *p, register cset *cs);
- */
-static void
-p_b_cclass(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char *sp = p->next;
- register struct cclass *cp;
- register size_t len;
- register char *u;
- register char c;
-
- while (MORE() && isalpha(PEEK()))
- NEXT();
- len = p->next - sp;
- for (cp = cclasses; cp->name != NULL; cp++)
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
- break;
- if (cp->name == NULL) {
- /* oops, didn't find it */
- SETERROR(REG_ECTYPE);
- return;
- }
-
- u = cp->chars;
- while ((c = *u++) != '\0')
- CHadd(cs, c);
- for (u = cp->multis; *u != '\0'; u += strlen(u) + 1)
- MCadd(p, cs, u);
-}
-
-/*
- - p_b_eclass - parse an equivalence-class name and deal with it
- == static void p_b_eclass(register struct parse *p, register cset *cs);
- *
- * This implementation is incomplete. xxx
- */
-static void
-p_b_eclass(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char c;
-
- c = p_b_coll_elem(p, '=');
- CHadd(cs, c);
-}
-
-/*
- - p_b_symbol - parse a character or [..]ed multicharacter collating symbol
- == static char p_b_symbol(register struct parse *p);
- */
-static char /* value of symbol */
-p_b_symbol(p)
-register struct parse *p;
-{
- register char value;
-
- REQUIRE(MORE(), REG_EBRACK);
- if (!EATTWO('[', '.'))
- return(GETNEXT());
-
- /* collating symbol */
- value = p_b_coll_elem(p, '.');
- REQUIRE(EATTWO('.', ']'), REG_ECOLLATE);
- return(value);
-}
-
-/*
- - p_b_coll_elem - parse a collating-element name and look it up
- == static char p_b_coll_elem(register struct parse *p, int endc);
- */
-static char /* value of collating element */
-p_b_coll_elem(p, endc)
-register struct parse *p;
-int endc; /* name ended by endc,']' */
-{
- register char *sp = p->next;
- register struct cname *cp;
- register int len;
-
- while (MORE() && !SEETWO(endc, ']'))
- NEXT();
- if (!MORE()) {
- SETERROR(REG_EBRACK);
- return(0);
- }
- len = p->next - sp;
- for (cp = cnames; cp->name != NULL; cp++)
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
- return(cp->code); /* known name */
- if (len == 1)
- return(*sp); /* single character */
- SETERROR(REG_ECOLLATE); /* neither */
- return(0);
-}
-
-/*
- - othercase - return the case counterpart of an alphabetic
- == static char othercase(int ch);
- */
-static char /* if no counterpart, return ch */
-othercase(ch)
-int ch;
-{
- assert(isalpha(ch));
- if (isupper(ch))
- return(tolower(ch));
- else if (islower(ch))
- return(toupper(ch));
- else /* peculiar, but could happen */
- return(ch);
-}
-
-/*
- - bothcases - emit a dualcase version of a two-case character
- == static void bothcases(register struct parse *p, int ch);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-bothcases(p, ch)
-register struct parse *p;
-int ch;
-{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[3];
-
- assert(othercase(ch) != ch); /* p_bracket() would recurse */
- p->next = bracket;
- p->end = bracket+2;
- bracket[0] = ch;
- bracket[1] = ']';
- bracket[2] = '\0';
- p_bracket(p);
- assert(p->next == bracket+2);
- p->next = oldnext;
- p->end = oldend;
-}
-
-/*
- - ordinary - emit an ordinary character
- == static void ordinary(register struct parse *p, register int ch);
- */
-static void
-ordinary(p, ch)
-register struct parse *p;
-register int ch;
-{
- register cat_t *cap = p->g->categories;
-
- if ((p->g->cflags&REG_ICASE) && isalpha(ch) && othercase(ch) != ch)
- bothcases(p, ch);
- else {
- EMIT(OCHAR, (unsigned char)ch);
- if (cap[ch] == 0)
- cap[ch] = p->g->ncategories++;
- }
-}
-
-/*
- - nonnewline - emit REG_NEWLINE version of OANY
- == static void nonnewline(register struct parse *p);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-nonnewline(p)
-register struct parse *p;
-{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[4];
-
- p->next = bracket;
- p->end = bracket+3;
- bracket[0] = '^';
- bracket[1] = '\n';
- bracket[2] = ']';
- bracket[3] = '\0';
- p_bracket(p);
- assert(p->next == bracket+3);
- p->next = oldnext;
- p->end = oldend;
-}
-
-/*
- - repeat - generate code for a bounded repetition, recursively if needed
- == static void repeat(register struct parse *p, sopno start, int from, int to);
- */
-static void
-repeat(p, start, from, to)
-register struct parse *p;
-sopno start; /* operand from here to end of strip */
-int from; /* repeated from this number */
-int to; /* to this number of times (maybe INFINITY) */
-{
- register sopno finish = HERE();
-# define N 2
-# define INF 3
-# define REP(f, t) ((f)*8 + (t))
-# define MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N)
- register sopno copy;
-
- if (p->error != 0) /* head off possible runaway recursion */
- return;
-
- assert(from <= to);
-
- switch (REP(MAP(from), MAP(to))) {
- case REP(0, 0): /* must be user doing this */
- DROP(finish-start); /* drop the operand */
- break;
- case REP(0, 1): /* as x{1,1}? */
- case REP(0, N): /* as x{1,n}? */
- case REP(0, INF): /* as x{1,}? */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start); /* offset is wrong... */
- repeat(p, start+1, 1, to);
- ASTERN(OOR1, start);
- AHEAD(start); /* ... fix it */
- EMIT(OOR2, 0);
- AHEAD(THERE());
- ASTERN(O_CH, THERETHERE());
- break;
- case REP(1, 1): /* trivial case */
- /* done */
- break;
- case REP(1, N): /* as x?x{1,n-1} */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start);
- ASTERN(OOR1, start);
- AHEAD(start);
- EMIT(OOR2, 0); /* offset very wrong... */
- AHEAD(THERE()); /* ...so fix it */
- ASTERN(O_CH, THERETHERE());
- copy = dupl(p, start+1, finish+1);
- assert(copy == finish+4);
- repeat(p, copy, 1, to-1);
- break;
- case REP(1, INF): /* as x+ */
- INSERT(OPLUS_, start);
- ASTERN(O_PLUS, start);
- break;
- case REP(N, N): /* as xx{m-1,n-1} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to-1);
- break;
- case REP(N, INF): /* as xx{n-1,INF} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to);
- break;
- default: /* "can't happen" */
- SETERROR(REG_ASSERT); /* just in case */
- break;
- }
-}
-
-/*
- - seterr - set an error condition
- == static int seterr(register struct parse *p, int e);
- */
-static int /* useless but makes type checking happy */
-seterr(p, e)
-register struct parse *p;
-int e;
-{
- if (p->error == 0) /* keep earliest error condition */
- p->error = e;
- p->next = nuls; /* try to bring things to a halt */
- p->end = nuls;
- return(0); /* make the return value well-defined */
-}
-
-/*
- - allocset - allocate a set of characters for []
- == static cset *allocset(register struct parse *p);
- */
-static cset *
-allocset(p)
-register struct parse *p;
-{
- register int no = p->g->ncsets++;
- register size_t nc;
- register size_t nbytes;
- register cset *cs;
- register size_t css = (size_t)p->g->csetsize;
- register int i;
-
- if (no >= p->ncsalloc) { /* need another column of space */
- p->ncsalloc += CHAR_BIT;
- nc = p->ncsalloc;
- assert(nc % CHAR_BIT == 0);
- nbytes = nc / CHAR_BIT * css;
- if (p->g->sets == NULL)
- p->g->sets = (cset *)malloc(nc * sizeof(cset));
- else
- p->g->sets = (cset *)realloc((char *)p->g->sets,
- nc * sizeof(cset));
- if (p->g->setbits == NULL)
- p->g->setbits = (uch *)malloc(nbytes);
- else {
- p->g->setbits = (uch *)realloc((char *)p->g->setbits,
- nbytes);
- /* xxx this isn't right if setbits is now NULL */
- for (i = 0; i < no; i++)
- p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT);
- }
- if (p->g->sets != NULL && p->g->setbits != NULL)
- (void) memset((char *)p->g->setbits + (nbytes - css),
- 0, css);
- else {
- no = 0;
- SETERROR(REG_ESPACE);
- /* caller's responsibility not to do set ops */
- }
- }
-
- assert(p->g->sets != NULL); /* xxx */
- cs = &p->g->sets[no];
- cs->ptr = p->g->setbits + css*((no)/CHAR_BIT);
- cs->mask = 1 << ((no) % CHAR_BIT);
- cs->hash = 0;
- cs->smultis = 0;
- cs->multis = NULL;
-
- return(cs);
-}
-
-/*
- - freeset - free a now-unused set
- == static void freeset(register struct parse *p, register cset *cs);
- */
-static void
-freeset(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register size_t i;
- register cset *top = &p->g->sets[p->g->ncsets];
- register size_t css = (size_t)p->g->csetsize;
-
- for (i = 0; i < css; i++)
- CHsub(cs, i);
- if (cs == top-1) /* recover only the easy case */
- p->g->ncsets--;
-}
-
-/*
- - freezeset - final processing on a set of characters
- == static int freezeset(register struct parse *p, register cset *cs);
- *
- * The main task here is merging identical sets. This is usually a waste
- * of time (although the hash code minimizes the overhead), but can win
- * big if REG_ICASE is being used. REG_ICASE, by the way, is why the hash
- * is done using addition rather than xor -- all ASCII [aA] sets xor to
- * the same value!
- */
-static int /* set number */
-freezeset(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register uch h = cs->hash;
- register size_t i;
- register cset *top = &p->g->sets[p->g->ncsets];
- register cset *cs2;
- register size_t css = (size_t)p->g->csetsize;
-
- /* look for an earlier one which is the same */
- for (cs2 = &p->g->sets[0]; cs2 < top; cs2++)
- if (cs2->hash == h && cs2 != cs) {
- /* maybe */
- for (i = 0; i < css; i++)
- if (!!CHIN(cs2, i) != !!CHIN(cs, i))
- break; /* no */
- if (i == css)
- break; /* yes */
- }
-
- if (cs2 < top) { /* found one */
- freeset(p, cs);
- cs = cs2;
- }
-
- return((int)(cs - p->g->sets));
-}
-
-/*
- - firstch - return first character in a set (which must have at least one)
- == static int firstch(register struct parse *p, register cset *cs);
- */
-static int /* character; there is no "none" value */
-firstch(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register size_t i;
- register size_t css = (size_t)p->g->csetsize;
-
- for (i = 0; i < css; i++)
- if (CHIN(cs, i))
- return((char)i);
- assert(never);
- return(0); /* arbitrary */
-}
-
-/*
- - nch - number of characters in a set
- == static int nch(register struct parse *p, register cset *cs);
- */
-static int
-nch(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register size_t i;
- register size_t css = (size_t)p->g->csetsize;
- register int n = 0;
-
- for (i = 0; i < css; i++)
- if (CHIN(cs, i))
- n++;
- return(n);
-}
-
-/*
- - mcadd - add a collating element to a cset
- == static void mcadd(register struct parse *p, register cset *cs, \
- == register char *cp);
- */
-static void
-mcadd(p, cs, cp)
-register struct parse *p;
-register cset *cs;
-register char *cp;
-{
- register size_t oldend = cs->smultis;
-
- cs->smultis += strlen(cp) + 1;
- if (cs->multis == NULL)
- cs->multis = malloc(cs->smultis);
- else
- cs->multis = realloc(cs->multis, cs->smultis);
- if (cs->multis == NULL) {
- SETERROR(REG_ESPACE);
- return;
- }
-
- (void) strcpy(cs->multis + oldend - 1, cp);
- cs->multis[cs->smultis - 1] = '\0';
-}
-
-#if 0
-/*
- - mcsub - subtract a collating element from a cset
- == static void mcsub(register cset *cs, register char *cp);
- */
-static void
-mcsub(cs, cp)
-register cset *cs;
-register char *cp;
-{
- register char *fp = mcfind(cs, cp);
- register size_t len = strlen(fp);
-
- assert(fp != NULL);
- (void) memmove(fp, fp + len + 1,
- cs->smultis - (fp + len + 1 - cs->multis));
- cs->smultis -= len;
-
- if (cs->smultis == 0) {
- free(cs->multis);
- cs->multis = NULL;
- return;
- }
-
- cs->multis = realloc(cs->multis, cs->smultis);
- assert(cs->multis != NULL);
-}
-
-/*
- - mcin - is a collating element in a cset?
- == static int mcin(register cset *cs, register char *cp);
- */
-static int
-mcin(cs, cp)
-register cset *cs;
-register char *cp;
-{
- return(mcfind(cs, cp) != NULL);
-}
-
-
-/*
- - mcfind - find a collating element in a cset
- == static char *mcfind(register cset *cs, register char *cp);
- */
-static char *
-mcfind(cs, cp)
-register cset *cs;
-register char *cp;
-{
- register char *p;
-
- if (cs->multis == NULL)
- return(NULL);
- for (p = cs->multis; *p != '\0'; p += strlen(p) + 1)
- if (strcmp(cp, p) == 0)
- return(p);
- return(NULL);
-}
-#endif
-
-/*
- - mcinvert - invert the list of collating elements in a cset
- == static void mcinvert(register struct parse *p, register cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-static void
-mcinvert(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - mccase - add case counterparts of the list of collating elements in a cset
- == static void mccase(register struct parse *p, register cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-static void
-mccase(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - isinsets - is this character in any sets?
- == static int isinsets(register struct re_guts *g, int c);
- */
-static int /* predicate */
-isinsets(g, c)
-register struct re_guts *g;
-int c;
-{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
- register unsigned uc = (unsigned char)c;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc] != 0)
- return(1);
- return(0);
-}
-
-/*
- - samesets - are these two characters in exactly the same sets?
- == static int samesets(register struct re_guts *g, int c1, int c2);
- */
-static int /* predicate */
-samesets(g, c1, c2)
-register struct re_guts *g;
-int c1;
-int c2;
-{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
- register unsigned uc1 = (unsigned char)c1;
- register unsigned uc2 = (unsigned char)c2;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc1] != col[uc2])
- return(0);
- return(1);
-}
-
-/*
- - categorize - sort out character categories
- == static void categorize(struct parse *p, register struct re_guts *g);
- */
-static void
-categorize(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register cat_t *cats = g->categories;
- register int c;
- register int c2;
- register cat_t cat;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (cats[c] == 0 && isinsets(g, c)) {
- cat = g->ncategories++;
- cats[c] = cat;
- for (c2 = c+1; c2 <= CHAR_MAX; c2++)
- if (cats[c2] == 0 && samesets(g, c, c2))
- cats[c2] = cat;
- }
-}
-
-/*
- - dupl - emit a duplicate of a bunch of sops
- == static sopno dupl(register struct parse *p, sopno start, sopno finish);
- */
-static sopno /* start of duplicate */
-dupl(p, start, finish)
-register struct parse *p;
-sopno start; /* from here */
-sopno finish; /* to this less one */
-{
- register sopno ret = HERE();
- register sopno len = finish - start;
-
- assert(finish >= start);
- if (len == 0)
- return(ret);
- enlarge(p, p->ssize + len); /* this many unexpected additions */
- assert(p->ssize >= p->slen + len);
- (void) memcpy((char *)(p->strip + p->slen),
- (char *)(p->strip + start), (size_t)len*sizeof(sop));
- p->slen += len;
- return(ret);
-}
-
-/*
- - doemit - emit a strip operator
- == static void doemit(register struct parse *p, sop op, size_t opnd);
- *
- * It might seem better to implement this as a macro with a function as
- * hard-case backup, but it's just too big and messy unless there are
- * some changes to the data structures. Maybe later.
- */
-static void
-doemit(p, op, opnd)
-register struct parse *p;
-sop op;
-size_t opnd;
-{
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- /* deal with oversize operands ("can't happen", more or less) */
- assert(opnd < 1<<OPSHIFT);
-
- /* deal with undersized strip */
- if (p->slen >= p->ssize)
- enlarge(p, (p->ssize+1) / 2 * 3); /* +50% */
- assert(p->slen < p->ssize);
-
- /* finally, it's all reduced to the easy case */
- p->strip[p->slen++] = SOP(op, opnd);
-}
-
-/*
- - doinsert - insert a sop into the strip
- == static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos);
- */
-static void
-doinsert(p, op, opnd, pos)
-register struct parse *p;
-sop op;
-size_t opnd;
-sopno pos;
-{
- register sopno sn;
- register sop s;
- register int i;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- sn = HERE();
- EMIT(op, opnd); /* do checks, ensure space */
- assert(HERE() == sn+1);
- s = p->strip[sn];
-
- /* adjust paren pointers */
- assert(pos > 0);
- for (i = 1; i < NPAREN; i++) {
- if (p->pbegin[i] >= pos) {
- p->pbegin[i]++;
- }
- if (p->pend[i] >= pos) {
- p->pend[i]++;
- }
- }
-
- memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos],
- (HERE()-pos-1)*sizeof(sop));
- p->strip[pos] = s;
-}
-
-/*
- - dofwd - complete a forward reference
- == static void dofwd(register struct parse *p, sopno pos, sop value);
- */
-static void
-dofwd(p, pos, value)
-register struct parse *p;
-register sopno pos;
-sop value;
-{
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- assert(value < 1<<OPSHIFT);
- p->strip[pos] = OP(p->strip[pos]) | value;
-}
-
-/*
- - enlarge - enlarge the strip
- == static void enlarge(register struct parse *p, sopno size);
- */
-static void
-enlarge(p, size)
-register struct parse *p;
-register sopno size;
-{
- register sop *sp;
-
- if (p->ssize >= size)
- return;
-
- sp = (sop *)realloc(p->strip, size*sizeof(sop));
- if (sp == NULL) {
- SETERROR(REG_ESPACE);
- return;
- }
- p->strip = sp;
- p->ssize = size;
-}
-
-/*
- - stripsnug - compact the strip
- == static void stripsnug(register struct parse *p, register struct re_guts *g);
- */
-static void
-stripsnug(p, g)
-register struct parse *p;
-register struct re_guts *g;
-{
- g->nstates = p->slen;
- g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop));
- if (g->strip == NULL) {
- SETERROR(REG_ESPACE);
- g->strip = p->strip;
- }
-}
-
-/*
- - findmust - fill in must and mlen with longest mandatory literal string
- == static void findmust(register struct parse *p, register struct re_guts *g);
- *
- * This algorithm could do fancy things like analyzing the operands of |
- * for common subsequences. Someday. This code is simple and finds most
- * of the interesting cases.
- *
- * Note that must and mlen got initialized during setup.
- */
-static void
-findmust(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register sop *scan;
- sop *start = NULL;
- register sop *newstart = NULL;
- register sopno newlen;
- register sop s;
- register char *cp;
- register sopno i;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- /* find the longest OCHAR sequence in strip */
- newlen = 0;
- scan = g->strip + 1;
- do {
- s = *scan++;
- switch (OP(s)) {
- case OCHAR: /* sequence member */
- if (newlen == 0) /* new sequence */
- newstart = scan - 1;
- newlen++;
- break;
- case OPLUS_: /* things that don't break one */
- case OLPAREN:
- case ORPAREN:
- break;
- case OQUEST_: /* things that must be skipped */
- case OCH_:
- scan--;
- do {
- scan += OPND(s);
- s = *scan;
- /* assert() interferes w debug printouts */
- if (OP(s) != O_QUEST && OP(s) != O_CH &&
- OP(s) != OOR2) {
- g->iflags |= BAD;
- return;
- }
- } while (OP(s) != O_QUEST && OP(s) != O_CH);
- /* fallthrough */
- default: /* things that break a sequence */
- if (newlen > g->mlen) { /* ends one */
- start = newstart;
- g->mlen = newlen;
- }
- newlen = 0;
- break;
- }
- } while (OP(s) != OEND);
-
- if (g->mlen == 0) /* there isn't one */
- return;
-
- /* turn it into a character string */
- g->must = malloc((size_t)g->mlen + 1);
- if (g->must == NULL) { /* argh; just forget it */
- g->mlen = 0;
- return;
- }
- cp = g->must;
- scan = start;
- for (i = g->mlen; i > 0; i--) {
- while (OP(s = *scan++) != OCHAR)
- continue;
- assert(cp < g->must + g->mlen);
- *cp++ = (char)OPND(s);
- }
- assert(cp == g->must + g->mlen);
- *cp++ = '\0'; /* just on general principles */
-}
-
-/*
- - pluscount - count + nesting
- == static sopno pluscount(register struct parse *p, register struct re_guts *g);
- */
-static sopno /* nesting depth */
-pluscount(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register sop *scan;
- register sop s;
- register sopno plusnest = 0;
- register sopno maxnest = 0;
-
- if (p->error != 0)
- return(0); /* there may not be an OEND */
-
- scan = g->strip + 1;
- do {
- s = *scan++;
- switch (OP(s)) {
- case OPLUS_:
- plusnest++;
- break;
- case O_PLUS:
- if (plusnest > maxnest)
- maxnest = plusnest;
- plusnest--;
- break;
- }
- } while (OP(s) != OEND);
- if (plusnest != 0)
- g->iflags |= BAD;
- return(maxnest);
-}
diff --git a/regex/regcomp.ih b/regex/regcomp.ih
deleted file mode 100644
index 6efafebf60..0000000000
--- a/regex/regcomp.ih
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regcomp.c === */
-static void p_ere(register struct parse *p, int stop);
-static void p_ere_exp(register struct parse *p);
-static void p_str(register struct parse *p);
-static void p_bre(register struct parse *p, register int end1, register int end2);
-static int p_simp_re(register struct parse *p, int starordinary);
-static int p_count(register struct parse *p);
-static void p_bracket(register struct parse *p);
-static void p_b_term(register struct parse *p, register cset *cs);
-static void p_b_cclass(register struct parse *p, register cset *cs);
-static void p_b_eclass(register struct parse *p, register cset *cs);
-static char p_b_symbol(register struct parse *p);
-static char p_b_coll_elem(register struct parse *p, int endc);
-static char othercase(int ch);
-static void bothcases(register struct parse *p, int ch);
-static void ordinary(register struct parse *p, register int ch);
-static void nonnewline(register struct parse *p);
-static void repeat(register struct parse *p, sopno start, int from, int to);
-static int seterr(register struct parse *p, int e);
-static cset *allocset(register struct parse *p);
-static void freeset(register struct parse *p, register cset *cs);
-static int freezeset(register struct parse *p, register cset *cs);
-static int firstch(register struct parse *p, register cset *cs);
-static int nch(register struct parse *p, register cset *cs);
-static void mcadd(register struct parse *p, register cset *cs, register char *cp);
-#if 0
-static void mcsub(register cset *cs, register char *cp);
-static int mcin(register cset *cs, register char *cp);
-static char *mcfind(register cset *cs, register char *cp);
-#endif
-static void mcinvert(register struct parse *p, register cset *cs);
-static void mccase(register struct parse *p, register cset *cs);
-static int isinsets(register struct re_guts *g, int c);
-static int samesets(register struct re_guts *g, int c1, int c2);
-static void categorize(struct parse *p, register struct re_guts *g);
-static sopno dupl(register struct parse *p, sopno start, sopno finish);
-static void doemit(register struct parse *p, sop op, size_t opnd);
-static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos);
-static void dofwd(register struct parse *p, sopno pos, sop value);
-static void enlarge(register struct parse *p, sopno size);
-static void stripsnug(register struct parse *p, register struct re_guts *g);
-static void findmust(register struct parse *p, register struct re_guts *g);
-static sopno pluscount(register struct parse *p, register struct re_guts *g);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/regex/regerror.c b/regex/regerror.c
deleted file mode 100644
index bf71e3a814..0000000000
--- a/regex/regerror.c
+++ /dev/null
@@ -1,126 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regerror.ih"
-
-/*
- = #define REG_OKAY 0
- = #define REG_NOMATCH 1
- = #define REG_BADPAT 2
- = #define REG_ECOLLATE 3
- = #define REG_ECTYPE 4
- = #define REG_EESCAPE 5
- = #define REG_ESUBREG 6
- = #define REG_EBRACK 7
- = #define REG_EPAREN 8
- = #define REG_EBRACE 9
- = #define REG_BADBR 10
- = #define REG_ERANGE 11
- = #define REG_ESPACE 12
- = #define REG_BADRPT 13
- = #define REG_EMPTY 14
- = #define REG_ASSERT 15
- = #define REG_INVARG 16
- = #define REG_ATOI 255 // convert name to number (!)
- = #define REG_ITOA 0400 // convert number to name (!)
- */
-static struct rerr {
- int code;
- char *name;
- char *explain;
-} rerrs[] = {
- {REG_OKAY, "REG_OKAY", "no errors detected"},
- {REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match"},
- {REG_BADPAT, "REG_BADPAT", "invalid regular expression"},
- {REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element"},
- {REG_ECTYPE, "REG_ECTYPE", "invalid character class"},
- {REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)"},
- {REG_ESUBREG, "REG_ESUBREG", "invalid backreference number"},
- {REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced"},
- {REG_EPAREN, "REG_EPAREN", "parentheses not balanced"},
- {REG_EBRACE, "REG_EBRACE", "braces not balanced"},
- {REG_BADBR, "REG_BADBR", "invalid repetition count(s)"},
- {REG_ERANGE, "REG_ERANGE", "invalid character range"},
- {REG_ESPACE, "REG_ESPACE", "out of memory"},
- {REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid"},
- {REG_EMPTY, "REG_EMPTY", "empty (sub)expression"},
- {REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug"},
- {REG_INVARG, "REG_INVARG", "invalid argument to regex routine"},
- {-1, "", "*** unknown regexp error code ***"},
-};
-
-/*
- - regerror - the interface to error numbers
- = API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
- */
-/* ARGSUSED */
-API_EXPORT(size_t)
-regerror(errcode, preg, errbuf, errbuf_size)
-int errcode;
-const regex_t *preg;
-char *errbuf;
-size_t errbuf_size;
-{
- register struct rerr *r;
- register size_t len;
- register int target = errcode &~ REG_ITOA;
- register char *s;
- char convbuf[50];
-
- if (errcode == REG_ATOI)
- s = regatoi(preg, convbuf);
- else {
- for (r = rerrs; r->code >= 0; r++)
- if (r->code == target)
- break;
-
- if (errcode&REG_ITOA) {
- if (r->code >= 0)
- (void) strcpy(convbuf, r->name);
- else
- sprintf(convbuf, "REG_0x%x", target);
- assert(strlen(convbuf) < sizeof(convbuf));
- s = convbuf;
- } else
- s = r->explain;
- }
-
- len = strlen(s) + 1;
- if (errbuf_size > 0) {
- if (errbuf_size > len)
- (void) strcpy(errbuf, s);
- else {
- (void) strncpy(errbuf, s, errbuf_size-1);
- errbuf[errbuf_size-1] = '\0';
- }
- }
-
- return(len);
-}
-
-/*
- - regatoi - internal routine to implement REG_ATOI
- == static char *regatoi(const regex_t *preg, char *localbuf);
- */
-static char *
-regatoi(preg, localbuf)
-const regex_t *preg;
-char *localbuf;
-{
- register struct rerr *r;
-
- for (r = rerrs; r->code >= 0; r++)
- if (strcmp(r->name, preg->re_endp) == 0)
- break;
- if (r->code < 0)
- return("0");
-
- sprintf(localbuf, "%d", r->code);
- return(localbuf);
-}
diff --git a/regex/regerror.ih b/regex/regerror.ih
deleted file mode 100644
index 2cb668c24f..0000000000
--- a/regex/regerror.ih
+++ /dev/null
@@ -1,12 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regerror.c === */
-static char *regatoi(const regex_t *preg, char *localbuf);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/regex/regex.3 b/regex/regex.3
deleted file mode 100644
index 100c8a7f71..0000000000
--- a/regex/regex.3
+++ /dev/null
@@ -1,502 +0,0 @@
-.TH REGEX 3 "17 May 1993"
-.BY "Henry Spencer"
-.de ZR
-.\" one other place knows this name: the SEE ALSO section
-.IR regex (7) \\$1
-..
-.SH NAME
-regcomp, regexec, regerror, regfree \- regular-expression library
-.SH SYNOPSIS
-.ft B
-.\".na
-#include <sys/types.h>
-.br
-#include <regex.h>
-.HP 10
-int regcomp(regex_t\ *preg, const\ char\ *pattern, int\ cflags);
-.HP
-int\ regexec(const\ regex_t\ *preg, const\ char\ *string,
-size_t\ nmatch, regmatch_t\ pmatch[], int\ eflags);
-.HP
-size_t\ regerror(int\ errcode, const\ regex_t\ *preg,
-char\ *errbuf, size_t\ errbuf_size);
-.HP
-void\ regfree(regex_t\ *preg);
-.\".ad
-.ft
-.SH DESCRIPTION
-These routines implement POSIX 1003.2 regular expressions (``RE''s);
-see
-.ZR .
-.I Regcomp
-compiles an RE written as a string into an internal form,
-.I regexec
-matches that internal form against a string and reports results,
-.I regerror
-transforms error codes from either into human-readable messages,
-and
-.I regfree
-frees any dynamically-allocated storage used by the internal form
-of an RE.
-.PP
-The header
-.I <regex.h>
-declares two structure types,
-.I regex_t
-and
-.IR regmatch_t ,
-the former for compiled internal forms and the latter for match reporting.
-It also declares the four functions,
-a type
-.IR regoff_t ,
-and a number of constants with names starting with ``REG_''.
-.PP
-.I Regcomp
-compiles the regular expression contained in the
-.I pattern
-string,
-subject to the flags in
-.IR cflags ,
-and places the results in the
-.I regex_t
-structure pointed to by
-.IR preg .
-.I Cflags
-is the bitwise OR of zero or more of the following flags:
-.IP REG_EXTENDED \w'REG_EXTENDED'u+2n
-Compile modern (``extended'') REs,
-rather than the obsolete (``basic'') REs that
-are the default.
-.IP REG_BASIC
-This is a synonym for 0,
-provided as a counterpart to REG_EXTENDED to improve readability.
-.IP REG_NOSPEC
-Compile with recognition of all special characters turned off.
-All characters are thus considered ordinary,
-so the ``RE'' is a literal string.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-REG_EXTENDED and REG_NOSPEC may not be used
-in the same call to
-.IR regcomp .
-.IP REG_ICASE
-Compile for matching that ignores upper/lower case distinctions.
-See
-.ZR .
-.IP REG_NOSUB
-Compile for matching that need only report success or failure,
-not what was matched.
-.IP REG_NEWLINE
-Compile for newline-sensitive matching.
-By default, newline is a completely ordinary character with no special
-meaning in either REs or strings.
-With this flag,
-`[^' bracket expressions and `.' never match newline,
-a `^' anchor matches the null string after any newline in the string
-in addition to its normal function,
-and the `$' anchor matches the null string before any newline in the
-string in addition to its normal function.
-.IP REG_PEND
-The regular expression ends,
-not at the first NUL,
-but just before the character pointed to by the
-.I re_endp
-member of the structure pointed to by
-.IR preg .
-The
-.I re_endp
-member is of type
-.IR const\ char\ * .
-This flag permits inclusion of NULs in the RE;
-they are considered ordinary characters.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
-When successful,
-.I regcomp
-returns 0 and fills in the structure pointed to by
-.IR preg .
-One member of that structure
-(other than
-.IR re_endp )
-is publicized:
-.IR re_nsub ,
-of type
-.IR size_t ,
-contains the number of parenthesized subexpressions within the RE
-(except that the value of this member is undefined if the
-REG_NOSUB flag was used).
-If
-.I regcomp
-fails, it returns a non-zero error code;
-see DIAGNOSTICS.
-.PP
-.I Regexec
-matches the compiled RE pointed to by
-.I preg
-against the
-.IR string ,
-subject to the flags in
-.IR eflags ,
-and reports results using
-.IR nmatch ,
-.IR pmatch ,
-and the returned value.
-The RE must have been compiled by a previous invocation of
-.IR regcomp .
-The compiled form is not altered during execution of
-.IR regexec ,
-so a single compiled RE can be used simultaneously by multiple threads.
-.PP
-By default,
-the NUL-terminated string pointed to by
-.I string
-is considered to be the text of an entire line, minus any terminating
-newline.
-The
-.I eflags
-argument is the bitwise OR of zero or more of the following flags:
-.IP REG_NOTBOL \w'REG_STARTEND'u+2n
-The first character of
-the string
-is not the beginning of a line, so the `^' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_NOTEOL
-The NUL terminating
-the string
-does not end a line, so the `$' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_STARTEND
-The string is considered to start at
-\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_so\fR
-and to have a terminating NUL located at
-\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_eo\fR
-(there need not actually be a NUL at that location),
-regardless of the value of
-.IR nmatch .
-See below for the definition of
-.IR pmatch
-and
-.IR nmatch .
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-Note that a non-zero \fIrm_so\fR does not imply REG_NOTBOL;
-REG_STARTEND affects only the location of the string,
-not how it is matched.
-.PP
-See
-.ZR
-for a discussion of what is matched in situations where an RE or a
-portion thereof could match any of several substrings of
-.IR string .
-.PP
-Normally,
-.I regexec
-returns 0 for success and the non-zero code REG_NOMATCH for failure.
-Other non-zero error codes may be returned in exceptional situations;
-see DIAGNOSTICS.
-.PP
-If REG_NOSUB was specified in the compilation of the RE,
-or if
-.I nmatch
-is 0,
-.I regexec
-ignores the
-.I pmatch
-argument (but see below for the case where REG_STARTEND is specified).
-Otherwise,
-.I pmatch
-points to an array of
-.I nmatch
-structures of type
-.IR regmatch_t .
-Such a structure has at least the members
-.I rm_so
-and
-.IR rm_eo ,
-both of type
-.I regoff_t
-(a signed arithmetic type at least as large as an
-.I off_t
-and a
-.IR ssize_t ),
-containing respectively the offset of the first character of a substring
-and the offset of the first character after the end of the substring.
-Offsets are measured from the beginning of the
-.I string
-argument given to
-.IR regexec .
-An empty substring is denoted by equal offsets,
-both indicating the character following the empty substring.
-.PP
-The 0th member of the
-.I pmatch
-array is filled in to indicate what substring of
-.I string
-was matched by the entire RE.
-Remaining members report what substring was matched by parenthesized
-subexpressions within the RE;
-member
-.I i
-reports subexpression
-.IR i ,
-with subexpressions counted (starting at 1) by the order of their opening
-parentheses in the RE, left to right.
-Unused entries in the array\(emcorresponding either to subexpressions that
-did not participate in the match at all, or to subexpressions that do not
-exist in the RE (that is, \fIi\fR\ > \fIpreg\fR\->\fIre_nsub\fR)\(emhave both
-.I rm_so
-and
-.I rm_eo
-set to \-1.
-If a subexpression participated in the match several times,
-the reported substring is the last one it matched.
-(Note, as an example in particular, that when the RE `(b*)+' matches `bbb',
-the parenthesized subexpression matches each of the three `b's and then
-an infinite number of empty strings following the last `b',
-so the reported substring is one of the empties.)
-.PP
-If REG_STARTEND is specified,
-.I pmatch
-must point to at least one
-.I regmatch_t
-(even if
-.I nmatch
-is 0 or REG_NOSUB was specified),
-to hold the input offsets for REG_STARTEND.
-Use for output is still entirely controlled by
-.IR nmatch ;
-if
-.I nmatch
-is 0 or REG_NOSUB was specified,
-the value of
-.IR pmatch [0]
-will not be changed by a successful
-.IR regexec .
-.PP
-.I Regerror
-maps a non-zero
-.I errcode
-from either
-.I regcomp
-or
-.I regexec
-to a human-readable, printable message.
-If
-.I preg
-is non-NULL,
-the error code should have arisen from use of
-the
-.I regex_t
-pointed to by
-.IR preg ,
-and if the error code came from
-.IR regcomp ,
-it should have been the result from the most recent
-.I regcomp
-using that
-.IR regex_t .
-.RI ( Regerror
-may be able to supply a more detailed message using information
-from the
-.IR regex_t .)
-.I Regerror
-places the NUL-terminated message into the buffer pointed to by
-.IR errbuf ,
-limiting the length (including the NUL) to at most
-.I errbuf_size
-bytes.
-If the whole message won't fit,
-as much of it as will fit before the terminating NUL is supplied.
-In any case,
-the returned value is the size of buffer needed to hold the whole
-message (including terminating NUL).
-If
-.I errbuf_size
-is 0,
-.I errbuf
-is ignored but the return value is still correct.
-.PP
-If the
-.I errcode
-given to
-.I regerror
-is first ORed with REG_ITOA,
-the ``message'' that results is the printable name of the error code,
-e.g. ``REG_NOMATCH'',
-rather than an explanation thereof.
-If
-.I errcode
-is REG_ATOI,
-then
-.I preg
-shall be non-NULL and the
-.I re_endp
-member of the structure it points to
-must point to the printable name of an error code;
-in this case, the result in
-.I errbuf
-is the decimal digits of
-the numeric value of the error code
-(0 if the name is not recognized).
-REG_ITOA and REG_ATOI are intended primarily as debugging facilities;
-they are extensions,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-Be warned also that they are considered experimental and changes are possible.
-.PP
-.I Regfree
-frees any dynamically-allocated storage associated with the compiled RE
-pointed to by
-.IR preg .
-The remaining
-.I regex_t
-is no longer a valid compiled RE
-and the effect of supplying it to
-.I regexec
-or
-.I regerror
-is undefined.
-.PP
-None of these functions references global variables except for tables
-of constants;
-all are safe for use from multiple threads if the arguments are safe.
-.SH IMPLEMENTATION CHOICES
-There are a number of decisions that 1003.2 leaves up to the implementor,
-either by explicitly saying ``undefined'' or by virtue of them being
-forbidden by the RE grammar.
-This implementation treats them as follows.
-.PP
-See
-.ZR
-for a discussion of the definition of case-independent matching.
-.PP
-There is no particular limit on the length of REs,
-except insofar as memory is limited.
-Memory usage is approximately linear in RE size, and largely insensitive
-to RE complexity, except for bounded repetitions.
-See BUGS for one short RE using them
-that will run almost any system out of memory.
-.PP
-A backslashed character other than one specifically given a magic meaning
-by 1003.2 (such magic meanings occur only in obsolete [``basic''] REs)
-is taken as an ordinary character.
-.PP
-Any unmatched [ is a REG_EBRACK error.
-.PP
-Equivalence classes cannot begin or end bracket-expression ranges.
-The endpoint of one range cannot begin another.
-.PP
-RE_DUP_MAX, the limit on repetition counts in bounded repetitions, is 255.
-.PP
-A repetition operator (?, *, +, or bounds) cannot follow another
-repetition operator.
-A repetition operator cannot begin an expression or subexpression
-or follow `^' or `|'.
-.PP
-`|' cannot appear first or last in a (sub)expression or after another `|',
-i.e. an operand of `|' cannot be an empty subexpression.
-An empty parenthesized subexpression, `()', is legal and matches an
-empty (sub)string.
-An empty string is not a legal RE.
-.PP
-A `{' followed by a digit is considered the beginning of bounds for a
-bounded repetition, which must then follow the syntax for bounds.
-A `{' \fInot\fR followed by a digit is considered an ordinary character.
-.PP
-`^' and `$' beginning and ending subexpressions in obsolete (``basic'')
-REs are anchors, not ordinary characters.
-.SH SEE ALSO
-grep(1), regex(7)
-.PP
-POSIX 1003.2, sections 2.8 (Regular Expression Notation)
-and
-B.5 (C Binding for Regular Expression Matching).
-.SH DIAGNOSTICS
-Non-zero error codes from
-.I regcomp
-and
-.I regexec
-include the following:
-.PP
-.nf
-.ta \w'REG_ECOLLATE'u+3n
-REG_NOMATCH regexec() failed to match
-REG_BADPAT invalid regular expression
-REG_ECOLLATE invalid collating element
-REG_ECTYPE invalid character class
-REG_EESCAPE \e applied to unescapable character
-REG_ESUBREG invalid backreference number
-REG_EBRACK brackets [ ] not balanced
-REG_EPAREN parentheses ( ) not balanced
-REG_EBRACE braces { } not balanced
-REG_BADBR invalid repetition count(s) in { }
-REG_ERANGE invalid character range in [ ]
-REG_ESPACE ran out of memory
-REG_BADRPT ?, *, or + operand invalid
-REG_EMPTY empty (sub)expression
-REG_ASSERT ``can't happen''\(emyou found a bug
-REG_INVARG invalid argument, e.g. negative-length string
-.fi
-.SH HISTORY
-Written by Henry Spencer at University of Toronto,
-henry@zoo.toronto.edu.
-.SH BUGS
-This is an alpha release with known defects.
-Please report problems.
-.PP
-There is one known functionality bug.
-The implementation of internationalization is incomplete:
-the locale is always assumed to be the default one of 1003.2,
-and only the collating elements etc. of that locale are available.
-.PP
-The back-reference code is subtle and doubts linger about its correctness
-in complex cases.
-.PP
-.I Regexec
-performance is poor.
-This will improve with later releases.
-.I Nmatch
-exceeding 0 is expensive;
-.I nmatch
-exceeding 1 is worse.
-.I Regexec
-is largely insensitive to RE complexity \fIexcept\fR that back
-references are massively expensive.
-RE length does matter; in particular, there is a strong speed bonus
-for keeping RE length under about 30 characters,
-with most special characters counting roughly double.
-.PP
-.I Regcomp
-implements bounded repetitions by macro expansion,
-which is costly in time and space if counts are large
-or bounded repetitions are nested.
-An RE like, say,
-`((((a{1,100}){1,100}){1,100}){1,100}){1,100}'
-will (eventually) run almost any existing machine out of swap space.
-.PP
-There are suspected problems with response to obscure error conditions.
-Notably,
-certain kinds of internal overflow,
-produced only by truly enormous REs or by multiply nested bounded repetitions,
-are probably not handled well.
-.PP
-Due to a mistake in 1003.2, things like `a)b' are legal REs because `)' is
-a special character only in the presence of a previous unmatched `('.
-This can't be fixed until the spec is fixed.
-.PP
-The standard's definition of back references is vague.
-For example, does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?
-Until the standard is clarified,
-behavior in such cases should not be relied on.
-.PP
-The implementation of word-boundary matching is a bit of a kludge,
-and bugs may lurk in combinations of word-boundary matching and anchoring.
diff --git a/regex/regex.7 b/regex/regex.7
deleted file mode 100644
index d89012bda1..0000000000
--- a/regex/regex.7
+++ /dev/null
@@ -1,233 +0,0 @@
-.TH REGEX 7 "7 Feb 1994"
-.BY "Henry Spencer"
-.SH NAME
-regex \- POSIX 1003.2 regular expressions
-.SH DESCRIPTION
-Regular expressions (``RE''s),
-as defined in POSIX 1003.2, come in two forms:
-modern REs (roughly those of
-.IR egrep ;
-1003.2 calls these ``extended'' REs)
-and obsolete REs (roughly those of
-.IR ed ;
-1003.2 ``basic'' REs).
-Obsolete REs mostly exist for backward compatibility in some old programs;
-they will be discussed at the end.
-1003.2 leaves some aspects of RE syntax and semantics open;
-`\(dg' marks decisions on these aspects that
-may not be fully portable to other 1003.2 implementations.
-.PP
-A (modern) RE is one\(dg or more non-empty\(dg \fIbranches\fR,
-separated by `|'.
-It matches anything that matches one of the branches.
-.PP
-A branch is one\(dg or more \fIpieces\fR, concatenated.
-It matches a match for the first, followed by a match for the second, etc.
-.PP
-A piece is an \fIatom\fR possibly followed
-by a single\(dg `*', `+', `?', or \fIbound\fR.
-An atom followed by `*' matches a sequence of 0 or more matches of the atom.
-An atom followed by `+' matches a sequence of 1 or more matches of the atom.
-An atom followed by `?' matches a sequence of 0 or 1 matches of the atom.
-.PP
-A \fIbound\fR is `{' followed by an unsigned decimal integer,
-possibly followed by `,'
-possibly followed by another unsigned decimal integer,
-always followed by `}'.
-The integers must lie between 0 and RE_DUP_MAX (255\(dg) inclusive,
-and if there are two of them, the first may not exceed the second.
-An atom followed by a bound containing one integer \fIi\fR
-and no comma matches
-a sequence of exactly \fIi\fR matches of the atom.
-An atom followed by a bound
-containing one integer \fIi\fR and a comma matches
-a sequence of \fIi\fR or more matches of the atom.
-An atom followed by a bound
-containing two integers \fIi\fR and \fIj\fR matches
-a sequence of \fIi\fR through \fIj\fR (inclusive) matches of the atom.
-.PP
-An atom is a regular expression enclosed in `()' (matching a match for the
-regular expression),
-an empty set of `()' (matching the null string)\(dg,
-a \fIbracket expression\fR (see below), `.'
-(matching any single character), `^' (matching the null string at the
-beginning of a line), `$' (matching the null string at the
-end of a line), a `\e' followed by one of the characters
-`^.[$()|*+?{\e'
-(matching that character taken as an ordinary character),
-a `\e' followed by any other character\(dg
-(matching that character taken as an ordinary character,
-as if the `\e' had not been present\(dg),
-or a single character with no other significance (matching that character).
-A `{' followed by a character other than a digit is an ordinary
-character, not the beginning of a bound\(dg.
-It is illegal to end an RE with `\e'.
-.PP
-A \fIbracket expression\fR is a list of characters enclosed in `[]'.
-It normally matches any single character from the list (but see below).
-If the list begins with `^',
-it matches any single character
-(but see below) \fInot\fR from the rest of the list.
-If two characters in the list are separated by `\-', this is shorthand
-for the full \fIrange\fR of characters between those two (inclusive) in the
-collating sequence,
-e.g. `[0-9]' in ASCII matches any decimal digit.
-It is illegal\(dg for two ranges to share an
-endpoint, e.g. `a-c-e'.
-Ranges are very collating-sequence-dependent,
-and portable programs should avoid relying on them.
-.PP
-To include a literal `]' in the list, make it the first character
-(following a possible `^').
-To include a literal `\-', make it the first or last character,
-or the second endpoint of a range.
-To use a literal `\-' as the first endpoint of a range,
-enclose it in `[.' and `.]' to make it a collating element (see below).
-With the exception of these and some combinations using `[' (see next
-paragraphs), all other special characters, including `\e', lose their
-special significance within a bracket expression.
-.PP
-Within a bracket expression, a collating element (a character,
-a multi-character sequence that collates as if it were a single character,
-or a collating-sequence name for either)
-enclosed in `[.' and `.]' stands for the
-sequence of characters of that collating element.
-The sequence is a single element of the bracket expression's list.
-A bracket expression containing a multi-character collating element
-can thus match more than one character,
-e.g. if the collating sequence includes a `ch' collating element,
-then the RE `[[.ch.]]*c' matches the first five characters
-of `chchcc'.
-.PP
-Within a bracket expression, a collating element enclosed in `[=' and
-`=]' is an equivalence class, standing for the sequences of characters
-of all collating elements equivalent to that one, including itself.
-(If there are no other equivalent collating elements,
-the treatment is as if the enclosing delimiters were `[.' and `.]'.)
-For example, if o and \o'o^' are the members of an equivalence class,
-then `[[=o=]]', `[[=\o'o^'=]]', and `[o\o'o^']' are all synonymous.
-An equivalence class may not\(dg be an endpoint
-of a range.
-.PP
-Within a bracket expression, the name of a \fIcharacter class\fR enclosed
-in `[:' and `:]' stands for the list of all characters belonging to that
-class.
-Standard character class names are:
-.PP
-.RS
-.nf
-.ta 3c 6c 9c
-alnum digit punct
-alpha graph space
-blank lower upper
-cntrl print xdigit
-.fi
-.RE
-.PP
-These stand for the character classes defined in
-.IR ctype (3).
-A locale may provide others.
-A character class may not be used as an endpoint of a range.
-.PP
-There are two special cases\(dg of bracket expressions:
-the bracket expressions `[[:<:]]' and `[[:>:]]' match the null string at
-the beginning and end of a word respectively.
-A word is defined as a sequence of
-word characters
-which is neither preceded nor followed by
-word characters.
-A word character is an
-.I alnum
-character (as defined by
-.IR ctype (3))
-or an underscore.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
-In the event that an RE could match more than one substring of a given
-string,
-the RE matches the one starting earliest in the string.
-If the RE could match more than one substring starting at that point,
-it matches the longest.
-Subexpressions also match the longest possible substrings, subject to
-the constraint that the whole match be as long as possible,
-with subexpressions starting earlier in the RE taking priority over
-ones starting later.
-Note that higher-level subexpressions thus take priority over
-their lower-level component subexpressions.
-.PP
-Match lengths are measured in characters, not collating elements.
-A null string is considered longer than no match at all.
-For example,
-`bb*' matches the three middle characters of `abbbc',
-`(wee|week)(knights|nights)' matches all ten characters of `weeknights',
-when `(.*).*' is matched against `abc' the parenthesized subexpression
-matches all three characters, and
-when `(a*)*' is matched against `bc' both the whole RE and the parenthesized
-subexpression match the null string.
-.PP
-If case-independent matching is specified,
-the effect is much as if all case distinctions had vanished from the
-alphabet.
-When an alphabetic that exists in multiple cases appears as an
-ordinary character outside a bracket expression, it is effectively
-transformed into a bracket expression containing both cases,
-e.g. `x' becomes `[xX]'.
-When it appears inside a bracket expression, all case counterparts
-of it are added to the bracket expression, so that (e.g.) `[x]'
-becomes `[xX]' and `[^x]' becomes `[^xX]'.
-.PP
-No particular limit is imposed on the length of REs\(dg.
-Programs intended to be portable should not employ REs longer
-than 256 bytes,
-as an implementation can refuse to accept such REs and remain
-POSIX-compliant.
-.PP
-Obsolete (``basic'') regular expressions differ in several respects.
-`|', `+', and `?' are ordinary characters and there is no equivalent
-for their functionality.
-The delimiters for bounds are `\e{' and `\e}',
-with `{' and `}' by themselves ordinary characters.
-The parentheses for nested subexpressions are `\e(' and `\e)',
-with `(' and `)' by themselves ordinary characters.
-`^' is an ordinary character except at the beginning of the
-RE or\(dg the beginning of a parenthesized subexpression,
-`$' is an ordinary character except at the end of the
-RE or\(dg the end of a parenthesized subexpression,
-and `*' is an ordinary character if it appears at the beginning of the
-RE or the beginning of a parenthesized subexpression
-(after a possible leading `^').
-Finally, there is one new type of atom, a \fIback reference\fR:
-`\e' followed by a non-zero decimal digit \fId\fR
-matches the same sequence of characters
-matched by the \fId\fRth parenthesized subexpression
-(numbering subexpressions by the positions of their opening parentheses,
-left to right),
-so that (e.g.) `\e([bc]\e)\e1' matches `bb' or `cc' but not `bc'.
-.SH SEE ALSO
-regex(3)
-.PP
-POSIX 1003.2, section 2.8 (Regular Expression Notation).
-.SH BUGS
-Having two kinds of REs is a botch.
-.PP
-The current 1003.2 spec says that `)' is an ordinary character in
-the absence of an unmatched `(';
-this was an unintentional result of a wording error,
-and change is likely.
-Avoid relying on it.
-.PP
-Back references are a dreadful botch,
-posing major problems for efficient implementations.
-They are also somewhat vaguely defined
-(does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?).
-Avoid using them.
-.PP
-1003.2's specification of case-independent matching is vague.
-The ``one case implies all cases'' definition given above
-is current consensus among implementors as to the right interpretation.
-.PP
-The syntax for word boundaries is incredibly ugly.
diff --git a/regex/regex.dsp b/regex/regex.dsp
deleted file mode 100644
index e8f1ad4299..0000000000
--- a/regex/regex.dsp
+++ /dev/null
@@ -1,106 +0,0 @@
-# Microsoft Developer Studio Project File - Name="regex" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=regex - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "regex - Win32 Release"
-# Name "regex - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\regcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regexec.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regfree.c
-# End Source File
-# End Target
-# End Project
diff --git a/regex/regex.dsw b/regex/regex.dsw
deleted file mode 100644
index 7b7df8126c..0000000000
--- a/regex/regex.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 5.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "regex"=.\regex.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/regex/regex.h b/regex/regex.h
deleted file mode 100644
index b39c5e178c..0000000000
--- a/regex/regex.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef _HSREGEX_H_
-#define _HSREGEX_H_
-#ifndef _HSREGEX_H
-#define _HSREGEX_H /* never again */
-/* ========= begin header generated by ././mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regex2.h === */
-#ifdef WIN32
-#define API_EXPORT(type) __declspec(dllexport) type __stdcall
-#else
-#define API_EXPORT(type) type
-#endif
-
-typedef off_t regoff_t;
-typedef struct {
- int re_magic;
- size_t re_nsub; /* number of parenthesized subexpressions */
- const char *re_endp; /* end pointer for REG_PEND */
- struct re_guts *re_g; /* none of your business :-) */
-} regex_t;
-typedef struct {
- regoff_t rm_so; /* start of match */
- regoff_t rm_eo; /* end of match */
-} regmatch_t;
-
-
-/* === regcomp.c === */
-API_EXPORT(int) regcomp(regex_t *, const char *, int);
-#define REG_BASIC 0000
-#define REG_EXTENDED 0001
-#define REG_ICASE 0002
-#define REG_NOSUB 0004
-#define REG_NEWLINE 0010
-#define REG_NOSPEC 0020
-#define REG_PEND 0040
-#define REG_DUMP 0200
-
-
-/* === regerror.c === */
-#define REG_OKAY 0
-#define REG_NOMATCH 1
-#define REG_BADPAT 2
-#define REG_ECOLLATE 3
-#define REG_ECTYPE 4
-#define REG_EESCAPE 5
-#define REG_ESUBREG 6
-#define REG_EBRACK 7
-#define REG_EPAREN 8
-#define REG_EBRACE 9
-#define REG_BADBR 10
-#define REG_ERANGE 11
-#define REG_ESPACE 12
-#define REG_BADRPT 13
-#define REG_EMPTY 14
-#define REG_ASSERT 15
-#define REG_INVARG 16
-#define REG_ATOI 255 /* convert name to number (!) */
-#define REG_ITOA 0400 /* convert number to name (!) */
-API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
-
-
-/* === regexec.c === */
-API_EXPORT(int) regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
-#define REG_NOTBOL 00001
-#define REG_NOTEOL 00002
-#define REG_STARTEND 00004
-#define REG_TRACE 00400 /* tracing of execution */
-#define REG_LARGE 01000 /* force large representation */
-#define REG_BACKR 02000 /* force use of backref code */
-
-
-/* === regfree.c === */
-API_EXPORT(void) regfree(regex_t *);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ././mkh ========= */
-#endif
-#endif
diff --git a/regex/regex.mak b/regex/regex.mak
deleted file mode 100644
index b87ded340b..0000000000
--- a/regex/regex.mak
+++ /dev/null
@@ -1,304 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on regex.dsp
-!IF "$(CFG)" == ""
-CFG=regex - Win32 Release
-!MESSAGE No configuration specified. Defaulting to regex - Win32 Release.
-!ENDIF
-
-!IF "$(CFG)" != "regex - Win32 Release" && "$(CFG)" != "regex - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Release"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-CPP=cl.exe
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-# Begin Custom Macros
-OutDir=.\.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\regex.lib"
-
-!ELSE
-
-ALL : "$(OUTDIR)\regex.lib"
-
-!ENDIF
-
-CLEAN :
- -@erase "$(INTDIR)\regcomp.obj"
- -@erase "$(INTDIR)\regerror.obj"
- -@erase "$(INTDIR)\regexec.obj"
- -@erase "$(INTDIR)\regfree.obj"
- -@erase "$(INTDIR)\vc50.idb"
- -@erase "$(OUTDIR)\regex.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
- /Fp"$(INTDIR)\regex.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-CPP_OBJS=.\Release/
-CPP_SBRS=.
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\regex.bsc"
-BSC32_SBRS= \
-
-LIB32=link.exe -lib
-LIB32_FLAGS=/nologo /out:"$(OUTDIR)\regex.lib"
-LIB32_OBJS= \
- "$(INTDIR)\regcomp.obj" \
- "$(INTDIR)\regerror.obj" \
- "$(INTDIR)\regexec.obj" \
- "$(INTDIR)\regfree.obj"
-
-"$(OUTDIR)\regex.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
- $(LIB32) @<<
- $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-# Begin Custom Macros
-OutDir=.\.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\regex.lib" "$(OUTDIR)\regex.bsc"
-
-!ELSE
-
-ALL : "$(OUTDIR)\regex.lib" "$(OUTDIR)\regex.bsc"
-
-!ENDIF
-
-CLEAN :
- -@erase "$(INTDIR)\regcomp.obj"
- -@erase "$(INTDIR)\regcomp.sbr"
- -@erase "$(INTDIR)\regerror.obj"
- -@erase "$(INTDIR)\regerror.sbr"
- -@erase "$(INTDIR)\regexec.obj"
- -@erase "$(INTDIR)\regexec.sbr"
- -@erase "$(INTDIR)\regfree.obj"
- -@erase "$(INTDIR)\regfree.sbr"
- -@erase "$(INTDIR)\vc50.idb"
- -@erase "$(OUTDIR)\regex.bsc"
- -@erase "$(OUTDIR)\regex.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /MDd /W3 /GX /Z7 /Od /I "." /D "WIN32" /D "_DEBUG" /D\
- "_WINDOWS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\regex.pch" /YX /Fo"$(INTDIR)\\"\
- /Fd"$(INTDIR)\\" /FD /c
-CPP_OBJS=.\Debug/
-CPP_SBRS=.\Debug/
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\regex.bsc"
-BSC32_SBRS= \
- "$(INTDIR)\regcomp.sbr" \
- "$(INTDIR)\regerror.sbr" \
- "$(INTDIR)\regexec.sbr" \
- "$(INTDIR)\regfree.sbr"
-
-"$(OUTDIR)\regex.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
- $(BSC32) @<<
- $(BSC32_FLAGS) $(BSC32_SBRS)
-<<
-
-LIB32=link.exe -lib
-LIB32_FLAGS=/nologo /out:"$(OUTDIR)\regex.lib"
-LIB32_OBJS= \
- "$(INTDIR)\regcomp.obj" \
- "$(INTDIR)\regerror.obj" \
- "$(INTDIR)\regexec.obj" \
- "$(INTDIR)\regfree.obj"
-
-"$(OUTDIR)\regex.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
- $(LIB32) @<<
- $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
-<<
-
-!ENDIF
-
-.c{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-
-!IF "$(CFG)" == "regex - Win32 Release" || "$(CFG)" == "regex - Win32 Debug"
-SOURCE=.\regcomp.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGCO=\
- ".\cclass.h"\
- ".\cname.h"\
- ".\regcomp.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regcomp.obj" : $(SOURCE) $(DEP_CPP_REGCO) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGCO=\
- ".\cclass.h"\
- ".\cname.h"\
- ".\regcomp.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regcomp.obj" "$(INTDIR)\regcomp.sbr" : $(SOURCE) $(DEP_CPP_REGCO)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\regerror.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGER=\
- ".\regerror.ih"\
- ".\regex.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regerror.obj" : $(SOURCE) $(DEP_CPP_REGER) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGER=\
- ".\regerror.ih"\
- ".\regex.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regerror.obj" "$(INTDIR)\regerror.sbr" : $(SOURCE) $(DEP_CPP_REGER)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\regexec.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGEX=\
- ".\engine.c"\
- ".\engine.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regexec.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGEX=\
- ".\engine.c"\
- ".\engine.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regexec.obj" "$(INTDIR)\regexec.sbr" : $(SOURCE) $(DEP_CPP_REGEX)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\regfree.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGFR=\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regfree.obj" : $(SOURCE) $(DEP_CPP_REGFR) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGFR=\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regfree.obj" "$(INTDIR)\regfree.sbr" : $(SOURCE) $(DEP_CPP_REGFR)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\engine.c
-
-!ENDIF
-
diff --git a/regex/regex2.h b/regex/regex2.h
deleted file mode 100644
index 7cd39a59ae..0000000000
--- a/regex/regex2.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * First, the stuff that ends up in the outside-world include file
- = #ifdef WIN32
- = #define API_EXPORT(type) __declspec(dllexport) type __stdcall
- = #else
- = #define API_EXPORT(type) type
- = #endif
- =
- = typedef off_t regoff_t;
- = typedef struct {
- = int re_magic;
- = size_t re_nsub; // number of parenthesized subexpressions
- = const char *re_endp; // end pointer for REG_PEND
- = struct re_guts *re_g; // none of your business :-)
- = } regex_t;
- = typedef struct {
- = regoff_t rm_so; // start of match
- = regoff_t rm_eo; // end of match
- = } regmatch_t;
- */
-/*
- * internals of regex_t
- */
-#define MAGIC1 ((('r'^0200)<<8) | 'e')
-
-/*
- * The internal representation is a *strip*, a sequence of
- * operators ending with an endmarker. (Some terminology etc. is a
- * historical relic of earlier versions which used multiple strips.)
- * Certain oddities in the representation are there to permit running
- * the machinery backwards; in particular, any deviation from sequential
- * flow must be marked at both its source and its destination. Some
- * fine points:
- *
- * - OPLUS_ and O_PLUS are *inside* the loop they create.
- * - OQUEST_ and O_QUEST are *outside* the bypass they create.
- * - OCH_ and O_CH are *outside* the multi-way branch they create, while
- * OOR1 and OOR2 are respectively the end and the beginning of one of
- * the branches. Note that there is an implicit OOR2 following OCH_
- * and an implicit OOR1 preceding O_CH.
- *
- * In state representations, an operator's bit is on to signify a state
- * immediately *preceding* "execution" of that operator.
- */
-typedef long sop; /* strip operator */
-typedef long sopno;
-#define OPRMASK 0x7c000000
-#define OPDMASK 0x03ffffff
-#define OPSHIFT (26)
-#define OP(n) ((n)&OPRMASK)
-#define OPND(n) ((n)&OPDMASK)
-#define SOP(op, opnd) ((op)|(opnd))
-/* operators meaning operand */
-/* (back, fwd are offsets) */
-#define OEND (1<<OPSHIFT) /* endmarker - */
-#define OCHAR (2<<OPSHIFT) /* character unsigned char */
-#define OBOL (3<<OPSHIFT) /* left anchor - */
-#define OEOL (4<<OPSHIFT) /* right anchor - */
-#define OANY (5<<OPSHIFT) /* . - */
-#define OANYOF (6<<OPSHIFT) /* [...] set number */
-#define OBACK_ (7<<OPSHIFT) /* begin \d paren number */
-#define O_BACK (8<<OPSHIFT) /* end \d paren number */
-#define OPLUS_ (9<<OPSHIFT) /* + prefix fwd to suffix */
-#define O_PLUS (10<<OPSHIFT) /* + suffix back to prefix */
-#define OQUEST_ (11<<OPSHIFT) /* ? prefix fwd to suffix */
-#define O_QUEST (12<<OPSHIFT) /* ? suffix back to prefix */
-#define OLPAREN (13<<OPSHIFT) /* ( fwd to ) */
-#define ORPAREN (14<<OPSHIFT) /* ) back to ( */
-#define OCH_ (15<<OPSHIFT) /* begin choice fwd to OOR2 */
-#define OOR1 (16<<OPSHIFT) /* | pt. 1 back to OOR1 or OCH_ */
-#define OOR2 (17<<OPSHIFT) /* | pt. 2 fwd to OOR2 or O_CH */
-#define O_CH (18<<OPSHIFT) /* end choice back to OOR1 */
-#define OBOW (19<<OPSHIFT) /* begin word - */
-#define OEOW (20<<OPSHIFT) /* end word - */
-
-/*
- * Structure for [] character-set representation. Character sets are
- * done as bit vectors, grouped 8 to a byte vector for compactness.
- * The individual set therefore has both a pointer to the byte vector
- * and a mask to pick out the relevant bit of each byte. A hash code
- * simplifies testing whether two sets could be identical.
- *
- * This will get trickier for multicharacter collating elements. As
- * preliminary hooks for dealing with such things, we also carry along
- * a string of multi-character elements, and decide the size of the
- * vectors at run time.
- */
-typedef struct {
- uch *ptr; /* -> uch [csetsize] */
- uch mask; /* bit within array */
- uch hash; /* hash code */
- size_t smultis;
- char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */
-} cset;
-/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
-#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c))
-#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c))
-#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask)
-#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */
-#define MCsub(p, cs, cp) mcsub(p, cs, cp)
-#define MCin(p, cs, cp) mcin(p, cs, cp)
-
-/* stuff for character categories */
-typedef unsigned char cat_t;
-
-/*
- * main compiled-expression structure
- */
-struct re_guts {
- int magic;
-# define MAGIC2 ((('R'^0200)<<8)|'E')
- sop *strip; /* malloced area for strip */
- int csetsize; /* number of bits in a cset vector */
- int ncsets; /* number of csets in use */
- cset *sets; /* -> cset [ncsets] */
- uch *setbits; /* -> uch[csetsize][ncsets/CHAR_BIT] */
- int cflags; /* copy of regcomp() cflags argument */
- sopno nstates; /* = number of sops */
- sopno firststate; /* the initial OEND (normally 0) */
- sopno laststate; /* the final OEND */
- int iflags; /* internal flags */
-# define USEBOL 01 /* used ^ */
-# define USEEOL 02 /* used $ */
-# define BAD 04 /* something wrong */
- int nbol; /* number of ^ used */
- int neol; /* number of $ used */
- int ncategories; /* how many character categories */
- cat_t *categories; /* ->catspace[-CHAR_MIN] */
- char *must; /* match must contain this string */
- int mlen; /* length of must */
- size_t nsub; /* copy of re_nsub */
- int backrefs; /* does it use back references? */
- sopno nplus; /* how deep does it nest +s? */
- /* catspace must be last */
- cat_t catspace[1]; /* actually [NC] */
-};
-
-/* misc utilities */
-#define OUT (CHAR_MAX+1) /* a non-character value */
-#define ISWORD(c) (isalnum(c) || (c) == '_')
diff --git a/regex/regex_extra.h b/regex/regex_extra.h
deleted file mode 100644
index d668f7613f..0000000000
--- a/regex/regex_extra.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* do not frame this - we must be able to include this file multiple times */
-
-#undef regexec
-#undef regerror
-#undef regfree
-#undef regcomp
-
-#if (defined(REGEX) && REGEX == 1) || (!defined(REGEX))
-
-#ifndef PHP_WIN32
-
-#ifndef PHP_NO_ALIASES
-
-#define regexec php_regexec
-#define regerror php_regerror
-#define regfree php_regfree
-#define regcomp php_regcomp
-
-#endif
-
-#endif
-
-#endif
diff --git a/regex/regexec.c b/regex/regexec.c
deleted file mode 100644
index 7888d02368..0000000000
--- a/regex/regexec.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * the outer shell of regexec()
- *
- * This file includes engine.c *twice*, after muchos fiddling with the
- * macros that code uses. This lets the same code operate on two different
- * representations for state sets.
- */
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <ctype.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-static int nope = 0; /* for use in asserts; shuts lint up */
-
-/* macros for manipulating states, small version */
-#define states unsigned
-#define states1 unsigned /* for later use in regexec() decision */
-#define CLEAR(v) ((v) = 0)
-#define SET0(v, n) ((v) &= ~((unsigned)1 << (n)))
-#define SET1(v, n) ((v) |= (unsigned)1 << (n))
-#define ISSET(v, n) ((v) & ((unsigned)1 << (n)))
-#define ASSIGN(d, s) ((d) = (s))
-#define EQ(a, b) ((a) == (b))
-#define STATEVARS int dummy /* dummy version */
-#define STATESETUP(m, n) /* nothing */
-#define STATETEARDOWN(m) /* nothing */
-#define SETUP(v) ((v) = 0)
-#define onestate unsigned
-#define INIT(o, n) ((o) = (unsigned)1 << (n))
-#define INC(o) ((o) <<= 1)
-#define ISSTATEIN(v, o) ((v) & (o))
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define FWD(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) << (n))
-#define BACK(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) >> (n))
-#define ISSETBACK(v, n) ((v) & ((unsigned)here >> (n)))
-/* function names */
-#define SNAMES /* engine.c looks after details */
-
-#include "engine.c"
-
-/* now undo things */
-#undef states
-#undef CLEAR
-#undef SET0
-#undef SET1
-#undef ISSET
-#undef ASSIGN
-#undef EQ
-#undef STATEVARS
-#undef STATESETUP
-#undef STATETEARDOWN
-#undef SETUP
-#undef onestate
-#undef INIT
-#undef INC
-#undef ISSTATEIN
-#undef FWD
-#undef BACK
-#undef ISSETBACK
-#undef SNAMES
-
-/* macros for manipulating states, large version */
-#define states char *
-#define CLEAR(v) memset(v, 0, m->g->nstates)
-#define SET0(v, n) ((v)[n] = 0)
-#define SET1(v, n) ((v)[n] = 1)
-#define ISSET(v, n) ((v)[n])
-#define ASSIGN(d, s) memcpy(d, s, m->g->nstates)
-#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
-#define STATEVARS int vn; char *space
-#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \
- if ((m)->space == NULL) return(REG_ESPACE); \
- (m)->vn = 0; }
-#define STATETEARDOWN(m) { free((m)->space); }
-#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
-#define onestate int
-#define INIT(o, n) ((o) = (n))
-#define INC(o) ((o)++)
-#define ISSTATEIN(v, o) ((v)[o])
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here])
-#define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here])
-#define ISSETBACK(v, n) ((v)[here - (n)])
-/* function names */
-#define LNAMES /* flag */
-
-#include "engine.c"
-
-/*
- - regexec - interface for matching
- = API_EXPORT(int) regexec(const regex_t *, const char *, size_t, \
- = regmatch_t [], int);
- = #define REG_NOTBOL 00001
- = #define REG_NOTEOL 00002
- = #define REG_STARTEND 00004
- = #define REG_TRACE 00400 // tracing of execution
- = #define REG_LARGE 01000 // force large representation
- = #define REG_BACKR 02000 // force use of backref code
- *
- * We put this here so we can exploit knowledge of the state representation
- * when choosing which matcher to call. Also, by this point the matchers
- * have been prototyped.
- */
-API_EXPORT(int) /* 0 success, REG_NOMATCH failure */
-regexec(preg, string, nmatch, pmatch, eflags)
-const regex_t *preg;
-const char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
-{
- register struct re_guts *g = preg->re_g;
-#ifdef REDEBUG
-# define GOODFLAGS(f) (f)
-#else
-# define GOODFLAGS(f) ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
-#endif
-
- if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
- return(REG_BADPAT);
- assert(!(g->iflags&BAD));
- if (g->iflags&BAD) /* backstop for no-debug case */
- return(REG_BADPAT);
- eflags = GOODFLAGS(eflags);
-
- if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))
- return(smatcher(g, (char *)string, nmatch, pmatch, eflags));
- else
- return(lmatcher(g, (char *)string, nmatch, pmatch, eflags));
-}
diff --git a/regex/regfree.c b/regex/regfree.c
deleted file mode 100644
index 9fd618a13b..0000000000
--- a/regex/regfree.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-/*
- - regfree - free everything
- = API_EXPORT(void) regfree(regex_t *);
- */
-API_EXPORT(void)
-regfree(preg)
-regex_t *preg;
-{
- register struct re_guts *g;
-
- if (preg->re_magic != MAGIC1) /* oops */
- return; /* nice to complain, but hard */
-
- g = preg->re_g;
- if (g == NULL || g->magic != MAGIC2) /* oops again */
- return;
- preg->re_magic = 0; /* mark it invalid */
- g->magic = 0; /* mark it invalid */
-
- if (g->strip != NULL)
- free((char *)g->strip);
- if (g->sets != NULL)
- free((char *)g->sets);
- if (g->setbits != NULL)
- free((char *)g->setbits);
- if (g->must != NULL)
- free(g->must);
- free((char *)g);
-}
diff --git a/regex/split.c b/regex/split.c
deleted file mode 100644
index 188bdb775b..0000000000
--- a/regex/split.c
+++ /dev/null
@@ -1,316 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-/*
- - split - divide a string into fields, like awk split()
- = int split(char *string, char *fields[], int nfields, char *sep);
- */
-int /* number of fields, including overflow */
-split(string, fields, nfields, sep)
-char *string;
-char *fields[]; /* list is not NULL-terminated */
-int nfields; /* number of entries available in fields[] */
-char *sep; /* "" white, "c" single char, "ab" [ab]+ */
-{
- register char *p = string;
- register char c; /* latest character */
- register char sepc = sep[0];
- register char sepc2;
- register int fn;
- register char **fp = fields;
- register char *sepp;
- register int trimtrail;
-
- /* white space */
- if (sepc == '\0') {
- while ((c = *p++) == ' ' || c == '\t')
- continue;
- p--;
- trimtrail = 1;
- sep = " \t"; /* note, code below knows this is 2 long */
- sepc = ' ';
- } else
- trimtrail = 0;
- sepc2 = sep[1]; /* now we can safely pick this up */
-
- /* catch empties */
- if (*p == '\0')
- return(0);
-
- /* single separator */
- if (sepc2 == '\0') {
- fn = nfields;
- for (;;) {
- *fp++ = p;
- fn--;
- if (fn == 0)
- break;
- while ((c = *p++) != sepc)
- if (c == '\0')
- return(nfields - fn);
- *(p-1) = '\0';
- }
- /* we have overflowed the fields vector -- just count them */
- fn = nfields;
- for (;;) {
- while ((c = *p++) != sepc)
- if (c == '\0')
- return(fn);
- fn++;
- }
- /* not reached */
- }
-
- /* two separators */
- if (sep[2] == '\0') {
- fn = nfields;
- for (;;) {
- *fp++ = p;
- fn--;
- while ((c = *p++) != sepc && c != sepc2)
- if (c == '\0') {
- if (trimtrail && **(fp-1) == '\0')
- fn++;
- return(nfields - fn);
- }
- if (fn == 0)
- break;
- *(p-1) = '\0';
- while ((c = *p++) == sepc || c == sepc2)
- continue;
- p--;
- }
- /* we have overflowed the fields vector -- just count them */
- fn = nfields;
- while (c != '\0') {
- while ((c = *p++) == sepc || c == sepc2)
- continue;
- p--;
- fn++;
- while ((c = *p++) != '\0' && c != sepc && c != sepc2)
- continue;
- }
- /* might have to trim trailing white space */
- if (trimtrail) {
- p--;
- while ((c = *--p) == sepc || c == sepc2)
- continue;
- p++;
- if (*p != '\0') {
- if (fn == nfields+1)
- *p = '\0';
- fn--;
- }
- }
- return(fn);
- }
-
- /* n separators */
- fn = 0;
- for (;;) {
- if (fn < nfields)
- *fp++ = p;
- fn++;
- for (;;) {
- c = *p++;
- if (c == '\0')
- return(fn);
- sepp = sep;
- while ((sepc = *sepp++) != '\0' && sepc != c)
- continue;
- if (sepc != '\0') /* it was a separator */
- break;
- }
- if (fn < nfields)
- *(p-1) = '\0';
- for (;;) {
- c = *p++;
- sepp = sep;
- while ((sepc = *sepp++) != '\0' && sepc != c)
- continue;
- if (sepc == '\0') /* it wasn't a separator */
- break;
- }
- p--;
- }
-
- /* not reached */
-}
-
-#ifdef TEST_SPLIT
-
-
-/*
- * test program
- * pgm runs regression
- * pgm sep splits stdin lines by sep
- * pgm str sep splits str by sep
- * pgm str sep n splits str by sep n times
- */
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- char buf[512];
- register int n;
-# define MNF 10
- char *fields[MNF];
-
- if (argc > 4)
- for (n = atoi(argv[3]); n > 0; n--) {
- (void) strcpy(buf, argv[1]);
- }
- else if (argc > 3)
- for (n = atoi(argv[3]); n > 0; n--) {
- (void) strcpy(buf, argv[1]);
- (void) split(buf, fields, MNF, argv[2]);
- }
- else if (argc > 2)
- dosplit(argv[1], argv[2]);
- else if (argc > 1)
- while (fgets(buf, sizeof(buf), stdin) != NULL) {
- buf[strlen(buf)-1] = '\0'; /* stomp newline */
- dosplit(buf, argv[1]);
- }
- else
- regress();
-
- exit(0);
-}
-
-dosplit(string, seps)
-char *string;
-char *seps;
-{
-# define NF 5
- char *fields[NF];
- register int nf;
-
- nf = split(string, fields, NF, seps);
- print(nf, NF, fields);
-}
-
-print(nf, nfp, fields)
-int nf;
-int nfp;
-char *fields[];
-{
- register int fn;
- register int bound;
-
- bound = (nf > nfp) ? nfp : nf;
- printf("%d:\t", nf);
- for (fn = 0; fn < bound; fn++)
- printf("\"%s\"%s", fields[fn], (fn+1 < nf) ? ", " : "\n");
-}
-
-#define RNF 5 /* some table entries know this */
-struct {
- char *str;
- char *seps;
- int nf;
- char *fi[RNF];
-} tests[] = {
- "", " ", 0, { "" },
- " ", " ", 2, { "", "" },
- "x", " ", 1, { "x" },
- "xy", " ", 1, { "xy" },
- "x y", " ", 2, { "x", "y" },
- "abc def g ", " ", 5, { "abc", "def", "", "g", "" },
- " a bcd", " ", 4, { "", "", "a", "bcd" },
- "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " ", 6, { "", "a", "b", "c", "d " },
-
- "", " _", 0, { "" },
- " ", " _", 2, { "", "" },
- "x", " _", 1, { "x" },
- "x y", " _", 2, { "x", "y" },
- "ab _ cd", " _", 2, { "ab", "cd" },
- " a_b c ", " _", 5, { "", "a", "b", "c", "" },
- "a b c_d e f", " _", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " _", 6, { "", "a", "b", "c", "d " },
-
- "", " _~", 0, { "" },
- " ", " _~", 2, { "", "" },
- "x", " _~", 1, { "x" },
- "x y", " _~", 2, { "x", "y" },
- "ab _~ cd", " _~", 2, { "ab", "cd" },
- " a_b c~", " _~", 5, { "", "a", "b", "c", "" },
- "a b_c d~e f", " _~", 6, { "a", "b", "c", "d", "e f" },
- "~a b c d ", " _~", 6, { "", "a", "b", "c", "d " },
-
- "", " _~-", 0, { "" },
- " ", " _~-", 2, { "", "" },
- "x", " _~-", 1, { "x" },
- "x y", " _~-", 2, { "x", "y" },
- "ab _~- cd", " _~-", 2, { "ab", "cd" },
- " a_b c~", " _~-", 5, { "", "a", "b", "c", "" },
- "a b_c-d~e f", " _~-", 6, { "a", "b", "c", "d", "e f" },
- "~a-b c d ", " _~-", 6, { "", "a", "b", "c", "d " },
-
- "", " ", 0, { "" },
- " ", " ", 2, { "", "" },
- "x", " ", 1, { "x" },
- "xy", " ", 1, { "xy" },
- "x y", " ", 2, { "x", "y" },
- "abc def g ", " ", 4, { "abc", "def", "g", "" },
- " a bcd", " ", 3, { "", "a", "bcd" },
- "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " ", 6, { "", "a", "b", "c", "d " },
-
- "", "", 0, { "" },
- " ", "", 0, { "" },
- "x", "", 1, { "x" },
- "xy", "", 1, { "xy" },
- "x y", "", 2, { "x", "y" },
- "abc def g ", "", 3, { "abc", "def", "g" },
- "\t a bcd", "", 2, { "a", "bcd" },
- " a \tb\t c ", "", 3, { "a", "b", "c" },
- "a b c d e ", "", 5, { "a", "b", "c", "d", "e" },
- "a b\tc d e f", "", 6, { "a", "b", "c", "d", "e f" },
- " a b c d e f ", "", 6, { "a", "b", "c", "d", "e f " },
-
- NULL, NULL, 0, { NULL },
-};
-
-regress()
-{
- char buf[512];
- register int n;
- char *fields[RNF+1];
- register int nf;
- register int i;
- register int printit;
- register char *f;
-
- for (n = 0; tests[n].str != NULL; n++) {
- (void) strcpy(buf, tests[n].str);
- fields[RNF] = NULL;
- nf = split(buf, fields, RNF, tests[n].seps);
- printit = 0;
- if (nf != tests[n].nf) {
- printf("split `%s' by `%s' gave %d fields, not %d\n",
- tests[n].str, tests[n].seps, nf, tests[n].nf);
- printit = 1;
- } else if (fields[RNF] != NULL) {
- printf("split() went beyond array end\n");
- printit = 1;
- } else {
- for (i = 0; i < nf && i < RNF; i++) {
- f = fields[i];
- if (f == NULL)
- f = "(NULL)";
- if (strcmp(f, tests[n].fi[i]) != 0) {
- printf("split `%s' by `%s', field %d is `%s', not `%s'\n",
- tests[n].str, tests[n].seps,
- i, fields[i], tests[n].fi[i]);
- printit = 1;
- }
- }
- }
- if (printit)
- print(nf, RNF, fields);
- }
-}
-#endif
diff --git a/regex/tests b/regex/tests
deleted file mode 100644
index c05846177f..0000000000
--- a/regex/tests
+++ /dev/null
@@ -1,475 +0,0 @@
-# regular expression test set
-# Lines are at least three fields, separated by one or more tabs. "" stands
-# for an empty field. First field is an RE. Second field is flags. If
-# C flag given, regcomp() is expected to fail, and the third field is the
-# error name (minus the leading REG_).
-#
-# Otherwise it is expected to succeed, and the third field is the string to
-# try matching it against. If there is no fourth field, the match is
-# expected to fail. If there is a fourth field, it is the substring that
-# the RE is expected to match. If there is a fifth field, it is a comma-
-# separated list of what the subexpressions should match, with - indicating
-# no match for that one. In both the fourth and fifth fields, a (sub)field
-# starting with @ indicates that the (sub)expression is expected to match
-# a null string followed by the stuff after the @; this provides a way to
-# test where null strings match. The character `N' in REs and strings
-# is newline, `S' is space, `T' is tab, `Z' is NUL.
-#
-# The full list of flags:
-# - placeholder, does nothing
-# b RE is a BRE, not an ERE
-# & try it as both an ERE and a BRE
-# C regcomp() error expected, third field is error name
-# i REG_ICASE
-# m ("mundane") REG_NOSPEC
-# s REG_NOSUB (not really testable)
-# n REG_NEWLINE
-# ^ REG_NOTBOL
-# $ REG_NOTEOL
-# # REG_STARTEND (see below)
-# p REG_PEND
-#
-# For REG_STARTEND, the start/end offsets are those of the substring
-# enclosed in ().
-
-# basics
-a & a a
-abc & abc abc
-abc|de - abc abc
-a|b|c - abc a
-
-# parentheses and perversions thereof
-a(b)c - abc abc
-a\(b\)c b abc abc
-a( C EPAREN
-a( b a( a(
-a\( - a( a(
-a\( bC EPAREN
-a\(b bC EPAREN
-a(b C EPAREN
-a(b b a(b a(b
-# gag me with a right parenthesis -- 1003.2 goofed here (my fault, partly)
-a) - a) a)
-) - ) )
-# end gagging (in a just world, those *should* give EPAREN)
-a) b a) a)
-a\) bC EPAREN
-\) bC EPAREN
-a()b - ab ab
-a\(\)b b ab ab
-
-# anchoring and REG_NEWLINE
-^abc$ & abc abc
-a^b - a^b
-a^b b a^b a^b
-a$b - a$b
-a$b b a$b a$b
-^ & abc @abc
-$ & abc @
-^$ & "" @
-$^ - "" @
-\($\)\(^\) b "" @
-# stop retching, those are legitimate (although disgusting)
-^^ - "" @
-$$ - "" @
-b$ & abNc
-b$ &n abNc b
-^b$ & aNbNc
-^b$ &n aNbNc b
-^$ &n aNNb @Nb
-^$ n abc
-^$ n abcN @
-$^ n aNNb @Nb
-\($\)\(^\) bn aNNb @Nb
-^^ n^ aNNb @Nb
-$$ n aNNb @NN
-^a ^ a
-a$ $ a
-^a ^n aNb
-^b ^n aNb b
-a$ $n bNa
-b$ $n bNa b
-a*(^b$)c* - b b
-a*\(^b$\)c* b b b
-
-# certain syntax errors and non-errors
-| C EMPTY
-| b | |
-* C BADRPT
-* b * *
-+ C BADRPT
-? C BADRPT
-"" &C EMPTY
-() - abc @abc
-\(\) b abc @abc
-a||b C EMPTY
-|ab C EMPTY
-ab| C EMPTY
-(|a)b C EMPTY
-(a|)b C EMPTY
-(*a) C BADRPT
-(+a) C BADRPT
-(?a) C BADRPT
-({1}a) C BADRPT
-\(\{1\}a\) bC BADRPT
-(a|*b) C BADRPT
-(a|+b) C BADRPT
-(a|?b) C BADRPT
-(a|{1}b) C BADRPT
-^* C BADRPT
-^* b * *
-^+ C BADRPT
-^? C BADRPT
-^{1} C BADRPT
-^\{1\} bC BADRPT
-
-# metacharacters, backslashes
-a.c & abc abc
-a[bc]d & abd abd
-a\*c & a*c a*c
-a\\b & a\b a\b
-a\\\*b & a\*b a\*b
-a\bc & abc abc
-a\ &C EESCAPE
-a\\bc & a\bc a\bc
-\{ bC BADRPT
-a\[b & a[b a[b
-a[b &C EBRACK
-# trailing $ is a peculiar special case for the BRE code
-a$ & a a
-a$ & a$
-a\$ & a
-a\$ & a$ a$
-a\\$ & a
-a\\$ & a$
-a\\$ & a\$
-a\\$ & a\ a\
-
-# back references, ugh
-a\(b\)\2c bC ESUBREG
-a\(b\1\)c bC ESUBREG
-a\(b*\)c\1d b abbcbbd abbcbbd bb
-a\(b*\)c\1d b abbcbd
-a\(b*\)c\1d b abbcbbbd
-^\(.\)\1 b abc
-a\([bc]\)\1d b abcdabbd abbd b
-a\(\([bc]\)\2\)*d b abbccd abbccd
-a\(\([bc]\)\2\)*d b abbcbd
-# actually, this next one probably ought to fail, but the spec is unclear
-a\(\(b\)*\2\)*d b abbbd abbbd
-# here is a case that no NFA implementation does right
-\(ab*\)[ab]*\1 b ababaaa ababaaa a
-# check out normal matching in the presence of back refs
-\(a\)\1bcd b aabcd aabcd
-\(a\)\1bc*d b aabcd aabcd
-\(a\)\1bc*d b aabd aabd
-\(a\)\1bc*d b aabcccd aabcccd
-\(a\)\1bc*[ce]d b aabcccd aabcccd
-^\(a\)\1b\(c\)*cd$ b aabcccd aabcccd
-
-# ordinary repetitions
-ab*c & abc abc
-ab+c - abc abc
-ab?c - abc abc
-a\(*\)b b a*b a*b
-a\(**\)b b ab ab
-a\(***\)b bC BADRPT
-*a b *a *a
-**a b a a
-***a bC BADRPT
-
-# the dreaded bounded repetitions
-{ & { {
-{abc & {abc {abc
-{1 C BADRPT
-{1} C BADRPT
-a{b & a{b a{b
-a{1}b - ab ab
-a\{1\}b b ab ab
-a{1,}b - ab ab
-a\{1,\}b b ab ab
-a{1,2}b - aab aab
-a\{1,2\}b b aab aab
-a{1 C EBRACE
-a\{1 bC EBRACE
-a{1a C EBRACE
-a\{1a bC EBRACE
-a{1a} C BADBR
-a\{1a\} bC BADBR
-a{,2} - a{,2} a{,2}
-a\{,2\} bC BADBR
-a{,} - a{,} a{,}
-a\{,\} bC BADBR
-a{1,x} C BADBR
-a\{1,x\} bC BADBR
-a{1,x C EBRACE
-a\{1,x bC EBRACE
-a{300} C BADBR
-a\{300\} bC BADBR
-a{1,0} C BADBR
-a\{1,0\} bC BADBR
-ab{0,0}c - abcac ac
-ab\{0,0\}c b abcac ac
-ab{0,1}c - abcac abc
-ab\{0,1\}c b abcac abc
-ab{0,3}c - abbcac abbc
-ab\{0,3\}c b abbcac abbc
-ab{1,1}c - acabc abc
-ab\{1,1\}c b acabc abc
-ab{1,3}c - acabc abc
-ab\{1,3\}c b acabc abc
-ab{2,2}c - abcabbc abbc
-ab\{2,2\}c b abcabbc abbc
-ab{2,4}c - abcabbc abbc
-ab\{2,4\}c b abcabbc abbc
-((a{1,10}){1,10}){1,10} - a a a,a
-
-# multiple repetitions
-a** &C BADRPT
-a++ C BADRPT
-a?? C BADRPT
-a*+ C BADRPT
-a*? C BADRPT
-a+* C BADRPT
-a+? C BADRPT
-a?* C BADRPT
-a?+ C BADRPT
-a{1}{1} C BADRPT
-a*{1} C BADRPT
-a+{1} C BADRPT
-a?{1} C BADRPT
-a{1}* C BADRPT
-a{1}+ C BADRPT
-a{1}? C BADRPT
-a*{b} - a{b} a{b}
-a\{1\}\{1\} bC BADRPT
-a*\{1\} bC BADRPT
-a\{1\}* bC BADRPT
-
-# brackets, and numerous perversions thereof
-a[b]c & abc abc
-a[ab]c & abc abc
-a[^ab]c & adc adc
-a[]b]c & a]c a]c
-a[[b]c & a[c a[c
-a[-b]c & a-c a-c
-a[^]b]c & adc adc
-a[^-b]c & adc adc
-a[b-]c & a-c a-c
-a[b &C EBRACK
-a[] &C EBRACK
-a[1-3]c & a2c a2c
-a[3-1]c &C ERANGE
-a[1-3-5]c &C ERANGE
-a[[.-.]--]c & a-c a-c
-a[1- &C ERANGE
-a[[. &C EBRACK
-a[[.x &C EBRACK
-a[[.x. &C EBRACK
-a[[.x.] &C EBRACK
-a[[.x.]] & ax ax
-a[[.x,.]] &C ECOLLATE
-a[[.one.]]b & a1b a1b
-a[[.notdef.]]b &C ECOLLATE
-a[[.].]]b & a]b a]b
-a[[:alpha:]]c & abc abc
-a[[:notdef:]]c &C ECTYPE
-a[[: &C EBRACK
-a[[:alpha &C EBRACK
-a[[:alpha:] &C EBRACK
-a[[:alpha,:] &C ECTYPE
-a[[:]:]]b &C ECTYPE
-a[[:-:]]b &C ECTYPE
-a[[:alph:]] &C ECTYPE
-a[[:alphabet:]] &C ECTYPE
-[[:alnum:]]+ - -%@a0X- a0X
-[[:alpha:]]+ - -%@aX0- aX
-[[:blank:]]+ - aSSTb SST
-[[:cntrl:]]+ - aNTb NT
-[[:digit:]]+ - a019b 019
-[[:graph:]]+ - Sa%bS a%b
-[[:lower:]]+ - AabC ab
-[[:print:]]+ - NaSbN aSb
-[[:punct:]]+ - S%-&T %-&
-[[:space:]]+ - aSNTb SNT
-[[:upper:]]+ - aBCd BC
-[[:xdigit:]]+ - p0f3Cq 0f3C
-a[[=b=]]c & abc abc
-a[[= &C EBRACK
-a[[=b &C EBRACK
-a[[=b= &C EBRACK
-a[[=b=] &C EBRACK
-a[[=b,=]] &C ECOLLATE
-a[[=one=]]b & a1b a1b
-
-# complexities
-a(((b)))c - abc abc
-a(b|(c))d - abd abd
-a(b*|c)d - abbd abbd
-# just gotta have one DFA-buster, of course
-a[ab]{20} - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
-# and an inline expansion in case somebody gets tricky
-a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab] - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
-# and in case somebody just slips in an NFA...
-a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night) - aaaaabaaaabaaaabaaaabweeknights aaaaabaaaabaaaabaaaabweeknights
-# fish for anomalies as the number of states passes 32
-12345678901234567890123456789 - a12345678901234567890123456789b 12345678901234567890123456789
-123456789012345678901234567890 - a123456789012345678901234567890b 123456789012345678901234567890
-1234567890123456789012345678901 - a1234567890123456789012345678901b 1234567890123456789012345678901
-12345678901234567890123456789012 - a12345678901234567890123456789012b 12345678901234567890123456789012
-123456789012345678901234567890123 - a123456789012345678901234567890123b 123456789012345678901234567890123
-# and one really big one, beyond any plausible word width
-1234567890123456789012345678901234567890123456789012345678901234567890 - a1234567890123456789012345678901234567890123456789012345678901234567890b 1234567890123456789012345678901234567890123456789012345678901234567890
-# fish for problems as brackets go past 8
-[ab][cd][ef][gh][ij][kl][mn] - xacegikmoq acegikm
-[ab][cd][ef][gh][ij][kl][mn][op] - xacegikmoq acegikmo
-[ab][cd][ef][gh][ij][kl][mn][op][qr] - xacegikmoqy acegikmoq
-[ab][cd][ef][gh][ij][kl][mn][op][q] - xacegikmoqy acegikmoq
-
-# subtleties of matching
-abc & xabcy abc
-a\(b\)?c\1d b acd
-aBc i Abc Abc
-a[Bc]*d i abBCcd abBCcd
-0[[:upper:]]1 &i 0a1 0a1
-0[[:lower:]]1 &i 0A1 0A1
-a[^b]c &i abc
-a[^b]c &i aBc
-a[^b]c &i adc adc
-[a]b[c] - abc abc
-[a]b[a] - aba aba
-[abc]b[abc] - abc abc
-[abc]b[abd] - abd abd
-a(b?c)+d - accd accd
-(wee|week)(knights|night) - weeknights weeknights
-(we|wee|week|frob)(knights|night|day) - weeknights weeknights
-a[bc]d - xyzaaabcaababdacd abd
-a[ab]c - aaabc abc
-abc s abc abc
-a* & b @b
-
-# Let's have some fun -- try to match a C comment.
-# first the obvious, which looks okay at first glance...
-/\*.*\*/ - /*x*/ /*x*/
-# but...
-/\*.*\*/ - /*x*/y/*z*/ /*x*/y/*z*/
-# okay, we must not match */ inside; try to do that...
-/\*([^*]|\*[^/])*\*/ - /*x*/ /*x*/
-/\*([^*]|\*[^/])*\*/ - /*x*/y/*z*/ /*x*/
-# but...
-/\*([^*]|\*[^/])*\*/ - /*x**/y/*z*/ /*x**/y/*z*/
-# and a still fancier version, which does it right (I think)...
-/\*([^*]|\*+[^*/])*\*+/ - /*x*/ /*x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x*/y/*z*/ /*x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x**/y/*z*/ /*x**/
-/\*([^*]|\*+[^*/])*\*+/ - /*x****/y/*z*/ /*x****/
-/\*([^*]|\*+[^*/])*\*+/ - /*x**x*/y/*z*/ /*x**x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x***x/y/*z*/ /*x***x/y/*z*/
-
-# subexpressions
-a(b)(c)d - abcd abcd b,c
-a(((b)))c - abc abc b,b,b
-a(b|(c))d - abd abd b,-
-a(b*|c|e)d - abbd abbd bb
-a(b*|c|e)d - acd acd c
-a(b*|c|e)d - ad ad @d
-a(b?)c - abc abc b
-a(b?)c - ac ac @c
-a(b+)c - abc abc b
-a(b+)c - abbbc abbbc bbb
-a(b*)c - ac ac @c
-(a|ab)(bc([de]+)f|cde) - abcdef abcdef a,bcdef,de
-# the regression tester only asks for 9 subexpressions
-a(b)(c)(d)(e)(f)(g)(h)(i)(j)k - abcdefghijk abcdefghijk b,c,d,e,f,g,h,i,j
-a(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)l - abcdefghijkl abcdefghijkl b,c,d,e,f,g,h,i,j,k
-a([bc]?)c - abc abc b
-a([bc]?)c - ac ac @c
-a([bc]+)c - abc abc b
-a([bc]+)c - abcc abcc bc
-a([bc]+)bc - abcbc abcbc bc
-a(bb+|b)b - abb abb b
-a(bbb+|bb+|b)b - abb abb b
-a(bbb+|bb+|b)b - abbb abbb bb
-a(bbb+|bb+|b)bb - abbb abbb b
-(.*).* - abcdef abcdef abcdef
-(a*)* - bc @b @b
-
-# do we get the right subexpression when it is used more than once?
-a(b|c)*d - ad ad -
-a(b|c)*d - abcd abcd c
-a(b|c)+d - abd abd b
-a(b|c)+d - abcd abcd c
-a(b|c?)+d - ad ad @d
-a(b|c?)+d - abcd abcd @d
-a(b|c){0,0}d - ad ad -
-a(b|c){0,1}d - ad ad -
-a(b|c){0,1}d - abd abd b
-a(b|c){0,2}d - ad ad -
-a(b|c){0,2}d - abcd abcd c
-a(b|c){0,}d - ad ad -
-a(b|c){0,}d - abcd abcd c
-a(b|c){1,1}d - abd abd b
-a(b|c){1,1}d - acd acd c
-a(b|c){1,2}d - abd abd b
-a(b|c){1,2}d - abcd abcd c
-a(b|c){1,}d - abd abd b
-a(b|c){1,}d - abcd abcd c
-a(b|c){2,2}d - acbd acbd b
-a(b|c){2,2}d - abcd abcd c
-a(b|c){2,4}d - abcd abcd c
-a(b|c){2,4}d - abcbd abcbd b
-a(b|c){2,4}d - abcbcd abcbcd c
-a(b|c){2,}d - abcd abcd c
-a(b|c){2,}d - abcbd abcbd b
-a(b+|((c)*))+d - abd abd @d,@d,-
-a(b+|((c)*))+d - abcd abcd @d,@d,-
-
-# check out the STARTEND option
-[abc] &# a(b)c b
-[abc] &# a(d)c
-[abc] &# a(bc)d b
-[abc] &# a(dc)d c
-. &# a()c
-b.*c &# b(bc)c bc
-b.* &# b(bc)c bc
-.*c &# b(bc)c bc
-
-# plain strings, with the NOSPEC flag
-abc m abc abc
-abc m xabcy abc
-abc m xyz
-a*b m aba*b a*b
-a*b m ab
-"" mC EMPTY
-
-# cases involving NULs
-aZb & a a
-aZb &p a
-aZb &p# (aZb) aZb
-aZ*b &p# (ab) ab
-a.b &# (aZb) aZb
-a.* &# (aZb)c aZb
-
-# word boundaries (ick)
-[[:<:]]a & a a
-[[:<:]]a & ba
-[[:<:]]a & -a a
-a[[:>:]] & a a
-a[[:>:]] & ab
-a[[:>:]] & a- a
-[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc abc
-[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc-q abc
-[[:<:]]a.c[[:>:]] & axc-dayc-dazce-abc axc
-[[:<:]]b.c[[:>:]] & a_bxc-byc_d-bzc-q bzc
-[[:<:]].x..[[:>:]] & y_xa_-_xb_y-_xc_-axdc _xc_
-[[:<:]]a_b[[:>:]] & x_a_b
-
-# past problems, and suspected problems
-(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A]) - A1 A1
-abcdefghijklmnop i abcdefghijklmnop abcdefghijklmnop
-abcdefghijklmnopqrstuv i abcdefghijklmnopqrstuv abcdefghijklmnopqrstuv
-(ALAK)|(ALT[AB])|(CC[123]1)|(CM[123]1)|(GAMC)|(LC[23][EO ])|(SEM[1234])|(SL[ES][12])|(SLWW)|(SLF )|(SLDT)|(VWH[12])|(WH[34][EW])|(WP1[ESN]) - CC11 CC11
-CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a - CC11 CC11
-Char \([a-z0-9_]*\)\[.* b Char xyz[k Char xyz[k xyz
-a?b - ab ab
--\{0,1\}[0-9]*$ b -5 -5
diff --git a/regex/utils.h b/regex/utils.h
deleted file mode 100644
index cd4a96025f..0000000000
--- a/regex/utils.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* utility definitions */
-
-#include "regex_extra.h"
-
-#ifdef _POSIX2_RE_DUP_MAX
-#define DUPMAX _POSIX2_RE_DUP_MAX
-#else
-#define DUPMAX 255
-#endif
-#define INFINITY (DUPMAX + 1)
-#define NC (CHAR_MAX - CHAR_MIN + 1)
-typedef unsigned char uch;
-
-/* switch off assertions (if not already off) if no REDEBUG */
-#ifndef REDEBUG
-#ifndef NDEBUG
-#define NDEBUG /* no assertions please */
-#endif
-#endif
-#include <assert.h>
-
-/* for old systems with bcopy() but no memmove() */
-#ifdef USEBCOPY
-#define memmove(d, s, c) bcopy(s, d, c)
-#endif
diff --git a/run-tests-config.php b/run-tests-config.php
deleted file mode 100644
index 4ac21d7d4c..0000000000
--- a/run-tests-config.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/* this file may be duplicated to provide testing for
- multiple php binaries or configurations. It is used
- with the -c option on run_tests2.php. All these
- settings will also go into the environment for tests
- that are directly executed, so you can also set things
- like PHPRC here to force an executable to use a
- specific php.ini file. */
-
-$conf = array(
-/* path to the php source tree */
-'TEST_PHP_SRCDIR' => NULL,
-
-/* executable that will be tested. Not used for
- web based tests */
-'TEST_PHP_EXECUTABLE' => NULL,
-
-/* php.ini to use when executing php */
-'PHPRC' => NULL,
-
-/* log format */
-'TEST_PHP_LOG_FORMAT' => 'LEODC',
-
-/* debugging detail in output. */
-'TEST_PHP_DETAILED' => 0,
-
-/* error style for editors or IDE's */
-'TEST_PHP_ERROR_STYLE' => 'EMACS',
-
-'REPORT_EXIT_STATUS' => 0,
-'NO_PHPTEST_SUMMARY' => 0,
-
-/* don't ask, and don't send results to QA if true */
-'NO_INTERACTION' => true,
-
-/* base url prefixed to any requests */
-'TEST_WEB_BASE_URL' => NULL,
-
-/* if set, copy phpt files into this directory,
- which should be accessable via an http server. The
- TEST_WEB_BASE_URL setting should be the base url
- to access this path. If this is not used,
- TEST_WEB_BASE_URL should be the base url pointing
- to TEST_PHP_SRCDIR, which should then be accessable via
- an http server.
-
- An example would be:
- TEST_WEB_BASE_URL=http://localhost/test
- TEST_BASE_PATH=/path/to/htdocs/test
-*/
-'TEST_BASE_PATH' => NULL,
-
-/* file extension of pages requested via http
- this allows for php to be configured to parse
- extensions other than php, usefull for multiple
- configurations under a single webserver */
-'TEST_WEB_EXT' => 'php',
-
-/* if true doesn't run tests, just outputs executable info */
-'TEST_CONTEXT_INFO' => false,
-
-/* : or ; seperated list of paths */
-'TEST_PATHS' => NULL
-/* additional configuration items that may be set
- to provide proxy support for testes:
- timeout
- proxy_host
- proxy_port
- proxy_user
- proxy_pass
-*/
-);
-
-?> \ No newline at end of file
diff --git a/run-tests.php b/run-tests.php
deleted file mode 100755
index e70ca408d5..0000000000
--- a/run-tests.php
+++ /dev/null
@@ -1,925 +0,0 @@
-<?php
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2002 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Ilia Alshanetsky <iliaa@php.net> |
- | Preston L. Bannister <pbannister@php.net> |
- | Marcus Boerger <helly@php.net> |
- | Derick Rethans <derick@php.net> |
- | Sander Roobol <sander@php.net> |
- | (based on version by: Stig Bakken <ssb@php.net>) |
- | (based on the PHP 3 test framework by Rasmus Lerdorf) |
- +----------------------------------------------------------------------+
- */
-
-/*
- Require exact specification of PHP executable to test (no guessing!).
- Die if any internal errors encountered in test script.
- Regularized output for simpler post-processing of output.
- Optionally output error lines indicating the failing test source and log
- for direct jump with MSVC or Emacs.
-*/
-
-/*
- * TODO:
- * - do not test PEAR components if base class and/or component class cannot be instanciated
- */
-
-
-/* Sanity check to ensure that pcre extension needed by this script is avaliable.
- * In the event it is not, print a nice error message indicating that this script will
- * not run without it.
- */
-
-if (!extension_loaded("pcre")) {
- echo <<<NO_PCRE_ERROR
-
-+-----------------------------------------------------------+
-| ! ERROR ! |
-| The test-suite requires that you have pcre extension |
-| enabled. To enable this extension either compile your PHP |
-| with --with-pcre-regex or if you've compiled pcre as a |
-| shared module load it via php.ini. |
-+-----------------------------------------------------------+
-
-NO_PCRE_ERROR;
-exit;
-}
-
-if (!function_exists("proc_open")) {
- echo <<<NO_PROC_OPEN_ERROR
-
-+-----------------------------------------------------------+
-| ! ERROR ! |
-| The test-suite requires that proc_open() is available. |
-| Please check if you disabled it in php.ini. |
-+-----------------------------------------------------------+
-
-NO_PROC_OPEN_ERROR;
-exit;
-}
-
-// change into the PHP source directory.
-
-if (getenv('TEST_PHP_SRCDIR')) {
- @chdir(getenv('TEST_PHP_SRCDIR'));
-}
-
-// Delete some security related environment variables
-putenv('SSH_CLIENT=deleted');
-putenv('SSH_AUTH_SOCK=deleted');
-putenv('SSH_TTY=deleted');
-
-$cwd = getcwd();
-set_time_limit(0);
-
-// delete as much output buffers as possible
-while(@ob_end_clean());
-if (ob_get_level()) echo "Not all buffers were deleted.\n";
-
-error_reporting(E_ALL);
-ini_set('magic_quotes_runtime',0); // this would break tests by modifying EXPECT sections
-
-if (ini_get('safe_mode')) {
- echo <<< SAFE_MODE_WARNING
-
-+-----------------------------------------------------------+
-| ! WARNING ! |
-| You are running the test-suite with "safe_mode" ENABLED ! |
-| |
-| Chances are high that no test will work at all, |
-| depending on how you configured "safe_mode" ! |
-+-----------------------------------------------------------+
-
-
-SAFE_MODE_WARNING;
-}
-
-// Don't ever guess at the PHP executable location.
-// Require the explicit specification.
-// Otherwise we could end up testing the wrong file!
-
-if (getenv('TEST_PHP_EXECUTABLE')) {
- $php = getenv('TEST_PHP_EXECUTABLE');
- if ($php=='auto') {
- $php = $cwd.'/sapi/cli/php';
- putenv("TEST_PHP_EXECUTABLE=$php");
- }
-}
-if (!file_exists($php)) {
- error("environment variable TEST_PHP_EXECUTABLE must be set to specify PHP executable!");
-}
-
-if (getenv('TEST_PHP_LOG_FORMAT')) {
- $log_format = strtoupper(getenv('TEST_PHP_LOG_FORMAT'));
-} else {
- $log_format = 'LEOD';
-}
-
-if (function_exists('is_executable') && !@is_executable($php)) {
- error("invalid PHP executable specified by TEST_PHP_EXECUTABLE = " . $php);
-}
-
-// Check whether a detailed log is wanted.
-if (getenv('TEST_PHP_DETAILED')) {
- define('DETAILED', getenv('TEST_PHP_DETAILED'));
-} else {
- define('DETAILED', 0);
-}
-
-// Check whether user test dirs are requested.
-if (getenv('TEST_PHP_USER')) {
- $user_tests = explode (',', getenv('TEST_PHP_USER'));
-} else {
- $user_tests = array();
-}
-
-// Get info from php
-$info_file = realpath(dirname(__FILE__)) . '/run-test-info.php';
-@unlink($info_file);
-$php_info = '<?php echo "
-PHP_SAPI : " . PHP_SAPI . "
-PHP_VERSION : " . phpversion() . "
-ZEND_VERSION: " . zend_version() . "
-PHP_OS : " . PHP_OS . "
-INI actual : " . realpath(get_cfg_var("cfg_file_path")) . "
-More .INIs : " . (function_exists(\'php_ini_scanned_files\') ? str_replace("\n","", php_ini_scanned_files()) : "** not determined **"); ?>';
-save_text($info_file, $php_info);
-$ini_overwrites = array(
- 'output_handler=',
- 'zlib.output_compression=Off',
- 'open_basedir=',
- 'safe_mode=0',
- 'disable_functions=',
- 'output_buffering=Off',
- 'error_reporting=2047',
- 'display_errors=1',
- 'log_errors=0',
- 'html_errors=0',
- 'track_errors=1',
- 'report_memleaks=1',
- 'report_zend_debug=0',
- 'docref_root=/phpmanual/',
- 'docref_ext=.html',
- 'error_prepend_string=',
- 'error_append_string=',
- 'auto_prepend_file=',
- 'auto_append_file=',
- 'magic_quotes_runtime=0',
- );
-$info_params = array();
-settings2array($ini_overwrites,$info_params);
-settings2params($info_params);
-$php_info = `$php $info_params $info_file`;
-@unlink($info_file);
-define('TESTED_PHP_VERSION', `$php -r 'echo PHP_VERSION;'`);
-
-// Write test context information.
-
-echo "
-=====================================================================
-CWD : $cwd
-PHP : $php $php_info
-Extra dirs : ";
-foreach ($user_tests as $test_dir) {
- echo "{$test_dir}\n ";
-}
-echo "
-=====================================================================
-";
-
-// Determine the tests to be run.
-
-$test_files = array();
-$test_results = array();
-$PHP_FAILED_TESTS = array();
-
-if (!ini_get('register_globals')) {
- $argc = $_SERVER['argc'];
- $argv = $_SERVER['argv'];
-}
-
-// If parameters given assume they represent selected tests to run.
-if (isset($argc) && $argc > 1) {
- for ($i=1; $i<$argc; $i++) {
- $testfile = realpath($argv[$i]);
- if (is_dir($testfile)) {
- find_files($testfile);
- } else if (preg_match("/\.phpt$/", $testfile)) {
- $test_files[] = $testfile;
- }
- }
-
- // Run selected tests.
- if (count($test_files)) {
- usort($test_files, "test_sort");
- echo "Running selected tests.\n";
- $start_time = time();
- foreach($test_files AS $name) {
- $test_results[$name] = run_test($php,$name);
- }
- $end_time = time();
- if (count($test_files) > 1) {
- echo "
-=====================================================================";
- compute_summary();
- echo get_summary(false);
- }
- if (getenv('REPORT_EXIT_STATUS') == 1 and ereg('FAILED( |$)', implode(' ', $test_results))) {
- exit(1);
- }
- exit(0);
- }
-}
-
-// Compile a list of all test files (*.phpt).
-$test_files = array();
-$exts_to_test = get_loaded_extensions();
-$exts_tested = count($exts_to_test);
-$exts_skipped = 0;
-$ignored_by_ext = 0;
-sort($exts_to_test);
-$test_dirs = array('tests', 'pear', 'ext');
-
-foreach ($test_dirs as $dir) {
- find_files("{$cwd}/{$dir}", ($dir == 'ext'));
-}
-
-foreach ($user_tests as $dir) {
- find_files($dir, ($dir == 'ext'));
-}
-
-function find_files($dir,$is_ext_dir=FALSE,$ignore=FALSE)
-{
- global $test_files, $exts_to_test, $ignored_by_ext, $exts_skipped, $exts_tested;
-
- $o = opendir($dir) or error("cannot open directory: $dir");
- while (($name = readdir($o)) !== FALSE) {
- if (is_dir("{$dir}/{$name}") && !in_array($name, array('.', '..', 'CVS'))) {
- $skip_ext = ($is_ext_dir && !in_array($name, $exts_to_test));
- if ($skip_ext) {
- $exts_skipped++;
- }
- find_files("{$dir}/{$name}", FALSE, $ignore || $skip_ext);
- }
-
- // Cleanup any left-over tmp files from last run.
- if (substr($name, -4) == '.tmp') {
- @unlink("$dir/$name");
- continue;
- }
-
- // Otherwise we're only interested in *.phpt files.
- if (substr($name, -5) == '.phpt') {
- if ($ignore) {
- $ignored_by_ext++;
- } else {
- $testfile = realpath("{$dir}/{$name}");
- $test_files[] = $testfile;
- }
- }
- }
- closedir($o);
-}
-
-function test_sort($a, $b) {
- global $cwd;
-
- $ta = strpos($a, "{$cwd}/tests")===0 ? 1 + (strpos($a, "{$cwd}/tests/run-test")===0 ? 1 : 0) : 0;
- $tb = strpos($b, "{$cwd}/tests")===0 ? 1 + (strpos($b, "{$cwd}/tests/run-test")===0 ? 1 : 0) : 0;
- if ($ta == $tb) {
- return strcmp($a, $b);
- } else {
- return $tb - $ta;
- }
-}
-
-usort($test_files, "test_sort");
-
-$start_time = time();
-
-echo "TIME START " . date('Y-m-d H:i:s', $start_time) . "
-=====================================================================
-";
-
-foreach ($test_files as $name) {
- $test_results[$name] = run_test($php,$name);
-}
-
-$end_time = time();
-
-// Summarize results
-
-if (0 == count($test_results)) {
- echo "No tests were run.\n";
- return;
-}
-
-compute_summary();
-
-echo "
-=====================================================================
-TIME END " . date('Y-m-d H:i:s', $end_time);
-
-$summary = get_summary(true);
-echo $summary;
-
-define('PHP_QA_EMAIL', 'qa-reports@lists.php.net');
-define('QA_SUBMISSION_PAGE', 'http://qa.php.net/buildtest-process.php');
-
-/* We got failed Tests, offer the user to send and e-mail to QA team, unless NO_INTERACTION is set */
-if (!getenv('NO_INTERACTION')) {
- $fp = fopen("php://stdin", "r+");
- echo "\nPlease allow this report to be send to the PHP QA\nteam. This will give us a better understanding in how\n";
- echo "PHP's test cases are doing.\n";
- echo "(choose \"s\" to just save the results to a file)? [Yns]: ";
- flush();
- $user_input = fgets($fp, 10);
- $just_save_results = (strtolower($user_input[0]) == 's');
-
- if ($just_save_results || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') {
- /*
- * Collect information about the host system for our report
- * Fetch phpinfo() output so that we can see the PHP enviroment
- * Make an archive of all the failed tests
- * Send an email
- */
-
- /* Ask the user to provide an email address, so that QA team can contact the user */
- if (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) {
- echo "\nPlease enter your email address.\n(Your address will be mangled so that it will not go out on any\nmailinglist in plain text): ";
- flush();
- $fp = fopen("php://stdin", "r+");
- $user_email = trim(fgets($fp, 1024));
- $user_email = str_replace("@", " at ", str_replace(".", " dot ", $user_email));
- }
-
- $failed_tests_data = '';
- $sep = "\n" . str_repeat('=', 80) . "\n";
-
- $failed_tests_data .= $failed_test_summary . "\n";
- $failed_tests_data .= $summary . "\n";
-
- if ($sum_results['FAILED']) {
- foreach ($PHP_FAILED_TESTS as $test_info) {
- $failed_tests_data .= $sep . $test_info['name'];
- $failed_tests_data .= $sep . file_get_contents(realpath($test_info['output']));
- $failed_tests_data .= $sep . file_get_contents(realpath($test_info['diff']));
- $failed_tests_data .= $sep . "\n\n";
- }
- $status = "failed";
- } else {
- $status = "success";
- }
-
- $failed_tests_data .= "\n" . $sep . 'BUILD ENVIRONMENT' . $sep;
- $failed_tests_data .= "OS:\n". PHP_OS. "\n\n";
- $ldd = $automake = $autoconf = $libtool = $compiler = 'N/A';
-
- if (substr(PHP_OS, 0, 3) != "WIN") {
- $automake = shell_exec('automake --version');
- $autoconf = shell_exec('autoconf --version');
- /* Always use the generated libtool - Mac OSX uses 'glibtool' */
- $libtool = shell_exec('./libtool --version');
- /* Try the most common flags for 'version' */
- $flags = array('-v', '-V', '--version');
- $cc_status=0;
- foreach($flags AS $flag) {
- system(getenv('CC')." $flag >/dev/null 2>&1", $cc_status);
- if ($cc_status == 0) {
- $compiler = shell_exec(getenv('CC')." $flag 2>&1");
- break;
- }
- }
- $ldd = shell_exec("ldd $php");
- }
- $failed_tests_data .= "Automake:\n$automake\n";
- $failed_tests_data .= "Autoconf:\n$autoconf\n";
- $failed_tests_data .= "Libtool:\n$libtool\n";
- $failed_tests_data .= "Compiler:\n$compiler\n";
- $failed_tests_data .= "Bison:\n". @shell_exec('bison --version'). "\n";
- $failed_tests_data .= "Libraries:\n$ldd\n";
- $failed_tests_data .= "\n";
-
- if (isset($user_email)) {
- $failed_tests_data .= "User's E-mail: ".$user_email."\n\n";
- }
-
- $failed_tests_data .= $sep . "PHPINFO" . $sep;
- $failed_tests_data .= shell_exec($php.' -dhtml_errors=0 -i');
-
- $compression = 0;
-
- if ($just_save_results || !mail_qa_team($failed_tests_data, $compression, $status)) {
- $output_file = 'php_test_results_' . date('Ymd_Hi') . ( $compression ? '.txt.gz' : '.txt' );
- $fp = fopen($output_file, "w");
- fwrite($fp, $failed_tests_data);
- fclose($fp);
-
- if (!$just_save_results) {
- echo "\nThe test script was unable to automatically send the report to PHP's QA Team\n";
- }
-
- echo "Please send ".$output_file." to ".PHP_QA_EMAIL." manually, thank you.\n";
- } else {
- fwrite($fp, "\nThank you for helping to make PHP better.\n");
- fclose($fp);
- }
- }
-}
-
-if (getenv('REPORT_EXIT_STATUS') == 1 and $sum_results['FAILED']) {
- exit(1);
-}
-
-//
-// Send Email to QA Team
-//
-
-function mail_qa_team($data, $compression, $status = FALSE)
-{
- $url_bits = parse_url(QA_SUBMISSION_PAGE);
- if (empty($url_bits['port'])) $url_bits['port'] = 80;
-
- $data = "php_test_data=" . urlencode(base64_encode(preg_replace("/[\\x00]/", "[0x0]", $data)));
- $data_length = strlen($data);
-
- $fs = fsockopen($url_bits['host'], $url_bits['port'], $errno, $errstr, 10);
- if (!$fs) {
- return FALSE;
- }
-
- $php_version = urlencode(TESTED_PHP_VERSION);
-
- echo "\nPosting to {$url_bits['host']} {$url_bits['path']}\n";
- fwrite($fs, "POST ".$url_bits['path']."?status=$status&version=$php_version HTTP/1.1\r\n");
- fwrite($fs, "Host: ".$url_bits['host']."\r\n");
- fwrite($fs, "User-Agent: QA Browser 0.1\r\n");
- fwrite($fs, "Content-Type: application/x-www-form-urlencoded\r\n");
- fwrite($fs, "Content-Length: ".$data_length."\r\n\r\n");
- fwrite($fs, $data);
- fwrite($fs, "\r\n\r\n");
- fclose($fs);
-
- return 1;
-}
-
-
-//
-// Write the given text to a temporary file, and return the filename.
-//
-
-function save_text($filename,$text)
-{
- $fp = @fopen($filename,'w') or error("Cannot open file '" . $filename . "' (save_text)");
- fwrite($fp,$text);
- fclose($fp);
- if (1 < DETAILED) echo "
-FILE $filename {{{
-$text
-}}}
-";
-}
-
-//
-// Write an error in a format recognizable to Emacs or MSVC.
-//
-
-function error_report($testname,$logname,$tested)
-{
- $testname = realpath($testname);
- $logname = realpath($logname);
- switch (strtoupper(getenv('TEST_PHP_ERROR_STYLE'))) {
- case 'MSVC':
- echo $testname . "(1) : $tested\n";
- echo $logname . "(1) : $tested\n";
- break;
- case 'EMACS':
- echo $testname . ":1: $tested\n";
- echo $logname . ":1: $tested\n";
- break;
- }
-}
-
-function system_with_timeout($commandline)
-{
- $data = "";
-
- $proc = proc_open($commandline, array(
- 0 => array('pipe', 'r'),
- 1 => array('pipe', 'w'),
- 2 => array('pipe', 'w')
- ), $pipes);
-
- if (!$proc)
- return false;
-
- fclose($pipes[0]);
-
- while (true) {
- /* hide errors from interrupted syscalls */
- $r = $pipes;
- $w = null;
- $e = null;
- $n = @stream_select($r, $w, $e, 60);
-
- if ($n == 0) {
- /* timed out */
- $data .= "\n ** ERROR: process timed out **\n";
- proc_terminate($proc);
- return $data;
- } else if ($n > 0) {
- $line = fread($pipes[1], 8192);
- if (strlen($line) == 0) {
- /* EOF */
- break;
- }
- $data .= $line;
- }
- }
- $code = proc_close($proc);
- return $data;
-}
-
-//
-// Run an individual test case.
-//
-
-function run_test($php,$file)
-{
- global $log_format, $info_params, $ini_overwrites, $cwd, $PHP_FAILED_TESTS;
-
- if (DETAILED) echo "
-=================
-TEST $file
-";
-
- // Load the sections of the test file.
- $section_text = array(
- 'TEST' => '(unnamed test)',
- 'SKIPIF' => '',
- 'GET' => '',
- 'ARGS' => '',
- );
-
- $fp = @fopen($file, "r") or error("Cannot open test file: $file");
-
- $section = '';
- while (!feof($fp)) {
- $line = fgets($fp);
-
- // Match the beginning of a section.
- if (ereg('^--([A-Z]+)--',$line,$r)) {
- $section = $r[1];
- $section_text[$section] = '';
- continue;
- }
-
- // Add to the section text.
- $section_text[$section] .= $line;
- }
- fclose($fp);
-
- $shortname = str_replace($cwd.'/', '', $file);
- $tested = trim($section_text['TEST'])." [$shortname]";
-
- $tmp = realpath(dirname($file));
- $tmp_skipif = $tmp . uniqid('/phpt.');
- $tmp_file = ereg_replace('\.phpt$','.php',$file);
- $tmp_post = $tmp . uniqid('/phpt.');
-
- @unlink($tmp_skipif);
- @unlink($tmp_file);
- @unlink($tmp_post);
-
- // unlink old test results
- @unlink(ereg_replace('\.phpt$','.diff',$file));
- @unlink(ereg_replace('\.phpt$','.log',$file));
- @unlink(ereg_replace('\.phpt$','.exp',$file));
- @unlink(ereg_replace('\.phpt$','.out',$file));
-
- // Reset environment from any previous test.
- putenv("REDIRECT_STATUS=");
- putenv("QUERY_STRING=");
- putenv("PATH_TRANSLATED=");
- putenv("SCRIPT_FILENAME=");
- putenv("REQUEST_METHOD=");
- putenv("CONTENT_TYPE=");
- putenv("CONTENT_LENGTH=");
-
- // Check if test should be skipped.
- if (array_key_exists('SKIPIF', $section_text)) {
- if (trim($section_text['SKIPIF'])) {
- save_text($tmp_skipif, $section_text['SKIPIF']);
- $output = `$php $info_params $tmp_skipif`;
- @unlink($tmp_skipif);
- if (eregi("^skip", trim($output))) {
- echo "SKIP $tested";
- $reason = (ereg("^skip[[:space:]]*(.+)\$", trim($output))) ? ereg_replace("^skip[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
- if ($reason) {
- echo " (reason: $reason)\n";
- } else {
- echo "\n";
- }
- return 'SKIPPED';
- }
- if (eregi("^info", trim($output))) {
- $reason = (ereg("^info[[:space:]]*(.+)\$", trim($output))) ? ereg_replace("^info[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
- if ($reason) {
- $tested .= " (info: $reason)";
- }
- }
- }
- }
-
- // Default ini settings
- $ini_settings = array();
- // additional ini overwrites
- //$ini_overwrites[] = 'setting=value';
- settings2array($ini_overwrites, $ini_settings);
-
- // Any special ini settings
- // these may overwrite the test defaults...
- if (array_key_exists('INI', $section_text)) {
- settings2array(preg_split( "/[\n\r]+/", $section_text['INI']), $ini_settings);
- }
- settings2params($ini_settings);
-
- // We've satisfied the preconditions - run the test!
- save_text($tmp_file,$section_text['FILE']);
- if (array_key_exists('GET', $section_text)) {
- $query_string = trim($section_text['GET']);
- } else {
- $query_string = '';
- }
-
- putenv("REDIRECT_STATUS=1");
- putenv("QUERY_STRING=$query_string");
- putenv("PATH_TRANSLATED=$tmp_file");
- putenv("SCRIPT_FILENAME=$tmp_file");
-
- $args = $section_text['ARGS'] ? ' -- '.$section_text['ARGS'] : '';
-
- if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) {
-
- $post = trim($section_text['POST']);
- save_text($tmp_post,$post);
- $content_length = strlen($post);
-
- putenv("REQUEST_METHOD=POST");
- putenv("CONTENT_TYPE=application/x-www-form-urlencoded");
- putenv("CONTENT_LENGTH=$content_length");
-
- $cmd = "$php$ini_settings -f $tmp_file 2>&1 < $tmp_post";
-
- } else {
-
- putenv("REQUEST_METHOD=GET");
- putenv("CONTENT_TYPE=");
- putenv("CONTENT_LENGTH=");
-
- $cmd = "$php$ini_settings -f $tmp_file$args 2>&1";
- }
-
- if (DETAILED) echo "
-CONTENT_LENGTH = " . getenv("CONTENT_LENGTH") . "
-CONTENT_TYPE = " . getenv("CONTENT_TYPE") . "
-PATH_TRANSLATED = " . getenv("PATH_TRANSLATED") . "
-QUERY_STRING = " . getenv("QUERY_STRING") . "
-REDIRECT_STATUS = " . getenv("REDIRECT_STATUS") . "
-REQUEST_METHOD = " . getenv("REQUEST_METHOD") . "
-SCRIPT_FILENAME = " . getenv("SCRIPT_FILENAME") . "
-COMMAND $cmd
-";
-
-// $out = `$cmd`;
- $out = system_with_timeout($cmd);
-
- @unlink($tmp_post);
-
- // Does the output match what is expected?
- $output = trim($out);
- $output = preg_replace('/\r\n/',"\n",$output);
-
- if (isset($section_text['EXPECTF']) || isset($section_text['EXPECTREGEX'])) {
- if (isset($section_text['EXPECTF'])) {
- $wanted = trim($section_text['EXPECTF']);
- } else {
- $wanted = trim($section_text['EXPECTREGEX']);
- }
- $wanted_re = preg_replace('/\r\n/',"\n",$wanted);
- if (isset($section_text['EXPECTF'])) {
- $wanted_re = preg_quote($wanted_re, '/');
- // Stick to basics
- $wanted_re = str_replace("%s", ".+?", $wanted_re); //not greedy
- $wanted_re = str_replace("%i", "[+\-]?[0-9]+", $wanted_re);
- $wanted_re = str_replace("%d", "[0-9]+", $wanted_re);
- $wanted_re = str_replace("%x", "[0-9a-fA-F]+", $wanted_re);
- $wanted_re = str_replace("%f", "[+\-]?\.?[0-9]+\.?[0-9]*(E-?[0-9]+)?", $wanted_re);
- $wanted_re = str_replace("%c", ".", $wanted_re);
- // %f allows two points "-.0.0" but that is the best *simple* expression
- }
-/* DEBUG YOUR REGEX HERE
- var_dump($wanted_re);
- print(str_repeat('=', 80) . "\n");
- var_dump($output);
-*/
- if (preg_match("/^$wanted_re\$/s", $output)) {
- @unlink($tmp_file);
- echo "PASS $tested\n";
- return 'PASSED';
- }
-
- } else {
- $wanted = trim($section_text['EXPECT']);
- $wanted = preg_replace('/\r\n/',"\n",$wanted);
- // compare and leave on success
- $ok = (0 == strcmp($output,$wanted));
- if ($ok) {
- @unlink($tmp_file);
- echo "PASS $tested\n";
- return 'PASSED';
- }
- }
-
- // Test failed so we need to report details.
- echo "FAIL $tested\n";
-
- $PHP_FAILED_TESTS[] = array(
- 'name' => $file,
- 'test_name' => $tested,
- 'output' => ereg_replace('\.phpt$','.log', $file),
- 'diff' => ereg_replace('\.phpt$','.diff', $file)
- );
-
- // write .exp
- if (strpos($log_format,'E') !== FALSE) {
- $logname = ereg_replace('\.phpt$','.exp',$file);
- $log = fopen($logname,'w') or error("Cannot create test log - $logname");
- fwrite($log,$wanted);
- fclose($log);
- }
-
- // write .out
- if (strpos($log_format,'O') !== FALSE) {
- $logname = ereg_replace('\.phpt$','.out',$file);
- $log = fopen($logname,'w') or error("Cannot create test log - $logname");
- fwrite($log,$output);
- fclose($log);
- }
-
- // write .diff
- if (strpos($log_format,'D') !== FALSE) {
- $logname = ereg_replace('\.phpt$','.diff',$file);
- $log = fopen($logname,'w') or error("Cannot create test log - $logname");
- fwrite($log,generate_diff($wanted,$output));
- fclose($log);
- }
-
- // write .log
- if (strpos($log_format,'L') !== FALSE) {
- $logname = ereg_replace('\.phpt$','.log',$file);
- $log = fopen($logname,'w') or error("Cannot create test log - $logname");
- fwrite($log,"
----- EXPECTED OUTPUT
-$wanted
----- ACTUAL OUTPUT
-$output
----- FAILED
-");
- fclose($log);
- error_report($file,$logname,$tested);
- }
-
- return 'FAILED';
-}
-
-function generate_diff($wanted,$output)
-{
- $w = explode("\n", $wanted);
- $o = explode("\n", $output);
- $w1 = array_diff_assoc($w,$o);
- $o1 = array_diff_assoc($o,$w);
- $w2 = array();
- $o2 = array();
- foreach($w1 as $idx => $val) $w2[sprintf("%03d<",$idx)] = sprintf("%03d- ", $idx+1).$val;
- foreach($o1 as $idx => $val) $o2[sprintf("%03d>",$idx)] = sprintf("%03d+ ", $idx+1).$val;
- $diff = array_merge($w2, $o2);
- ksort($diff);
- return implode("\r\n", $diff);
-}
-
-function error($message)
-{
- echo "ERROR: {$message}\n";
- exit(1);
-}
-
-function settings2array($settings, &$ini_settings)
-{
- foreach($settings as $setting) {
- if (strpos($setting, '=')!==false) {
- $setting = explode("=", $setting, 2);
- $name = trim(strtolower($setting[0]));
- $value = trim($setting[1]);
- $ini_settings[$name] = $value;
- }
- }
-}
-
-function settings2params(&$ini_settings)
-{
- if (count($ini_settings)) {
- $settings = '';
- foreach($ini_settings as $name => $value) {
- $value = addslashes($value);
- $settings .= " -d \"$name=$value\"";
- }
- $ini_settings = $settings;
- } else {
- $ini_settings = '';
- }
-}
-
-function compute_summary()
-{
- global $n_total, $test_results, $ignored_by_ext, $sum_results, $percent_results;
-
- $n_total = count($test_results);
- $n_total += $ignored_by_ext;
-
- $sum_results = array('PASSED'=>0, 'SKIPPED'=>0, 'FAILED'=>0);
- foreach ($test_results as $v) {
- $sum_results[$v]++;
- }
- $sum_results['SKIPPED'] += $ignored_by_ext;
- $percent_results = array();
- while (list($v,$n) = each($sum_results)) {
- $percent_results[$v] = (100.0 * $n) / $n_total;
- }
-}
-
-function get_summary($show_ext_summary)
-{
- global $exts_skipped, $exts_tested, $n_total, $sum_results, $percent_results, $end_time, $start_time, $failed_test_summary, $PHP_FAILED_TESTS;
-
- $summary = "";
- if ($show_ext_summary) {
- $summary .= "
-=====================================================================
-TEST RESULT SUMMARY
----------------------------------------------------------------------
-Exts skipped : " . sprintf("%4d",$exts_skipped) . "
-Exts tested : " . sprintf("%4d",$exts_tested) . "
----------------------------------------------------------------------
-";
- }
- $summary .= "
-Number of tests : " . sprintf("%4d",$n_total) . "
-Tests skipped : " . sprintf("%4d (%2.1f%%)",$sum_results['SKIPPED'],$percent_results['SKIPPED']) . "
-Tests failed : " . sprintf("%4d (%2.1f%%)",$sum_results['FAILED'],$percent_results['FAILED']) . "
-Tests passed : " . sprintf("%4d (%2.1f%%)",$sum_results['PASSED'],$percent_results['PASSED']) . "
----------------------------------------------------------------------
-Time taken : " . sprintf("%4d seconds", $end_time - $start_time) . "
-=====================================================================
-";
- $failed_test_summary = '';
- if (count($PHP_FAILED_TESTS)) {
- $failed_test_summary .= "
-=====================================================================
-FAILED TEST SUMMARY
----------------------------------------------------------------------
-";
- foreach ($PHP_FAILED_TESTS as $failed_test_data) {
- $failed_test_summary .= $failed_test_data['test_name'] . "\n";
- }
- $failed_test_summary .= "=====================================================================\n";
- }
-
- if ($failed_test_summary && !getenv('NO_PHPTEST_SUMMARY')) {
- $summary .= $failed_test_summary;
- }
-
- return $summary;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
-?>
diff --git a/run-tests2.php b/run-tests2.php
deleted file mode 100644
index 40b3a5e3e8..0000000000
--- a/run-tests2.php
+++ /dev/null
@@ -1,1573 +0,0 @@
-<?php
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2002 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Ilia Alshanetsky <ilia@php.net> |
- | Preston L. Bannister <pbannister@php.net> |
- | Marcus Boerger <helly@php.net> |
- | Shane Caraveo <shane@php.net> |
- | Derick Rethans <derick@php.net> |
- | Sander Roobol <sander@php.net> |
- | (based on version by: Stig Bakken <ssb@php.net>) |
- | (based on the PHP 3 test framework by Rasmus Lerdorf) |
- +----------------------------------------------------------------------+
- */
-
-set_time_limit(0);
-while(@ob_end_clean());
-if (ob_get_level()) echo "Not all buffers were deleted.\n";
-error_reporting(E_ALL);
-
-/**********************************************************************
- * QA configuration
- */
-
-define('PHP_QA_EMAIL', 'qa-reports@lists.php.net');
-define('QA_SUBMISSION_PAGE', 'http://qa.php.net/buildtest-process.php');
-
-/**********************************************************************
- * error messages
- */
-
-define('PCRE_MISSING_ERROR',
-'+-----------------------------------------------------------+
-| ! ERROR ! |
-| The test-suite requires that you have pcre extension |
-| enabled. To enable this extension either compile your PHP |
-| with --with-pcre-regex or if you have compiled pcre as a |
-| shared module load it via php.ini. |
-+-----------------------------------------------------------+');
-define('SAFE_MODE_WARNING',
-'+-----------------------------------------------------------+
-| ! WARNING ! |
-| You are running the test-suite with "safe_mode" ENABLED ! |
-| |
-| Chances are high that no test will work at all, |
-| depending on how you configured "safe_mode" ! |
-+-----------------------------------------------------------+');
-define('TMP_MISSING',
-'+-----------------------------------------------------------+
-| ! ERROR ! |
-| You must create /tmp for session tests to work! |
-| |
-+-----------------------------------------------------------+');
-define('PROC_OPEN_MISSING',
-'+-----------------------------------------------------------+
-| ! ERROR ! |
-| The test-suite requires that proc_open() is available. |
-| Please check if you disabled it in php.ini. |
-+-----------------------------------------------------------+');
-define('REQ_PHP_VERSION',
-'+-----------------------------------------------------------+
-| ! ERROR ! |
-| The test-suite must be run with PHP 5 or later. |
-| You can still test older extecutables by setting |
-| TEST_PHP_EXECUTABLE and running this script with PHP 5. |
-+-----------------------------------------------------------+');
-/**********************************************************************
- * information scripts
- */
-define('PHP_INFO_SCRIPT','<?php echo "
-PHP_SAPI=" . PHP_SAPI . "
-PHP_VERSION=" . phpversion() . "
-ZEND_VERSION=" . zend_version() . "
-PHP_OS=" . PHP_OS . "
-INCLUDE_PATH=" . get_cfg_var("include_path") . "
-INI=" . realpath(get_cfg_var("cfg_file_path")) . "
-SCANNED_INI=" . (function_exists(\'php_ini_scanned_files\') ?
- str_replace("\n","", php_ini_scanned_files()) :
- "** not determined **") . "
-SERVER_SOFTWARE=" . $_ENV[\'SERVER_SOFTWARE\'];
-?>');
-
-define('PHP_EXTENSIONS_SCRIPT','<?php print join(get_loaded_extensions(),":"); ?>');
-define('PHP_INI_SETTINGS_SCRIPT','<?php echo serialize(ini_get_all()); ?>');
-
-/**********************************************************************
- * various utility functions
- */
-
-function save_to_file($filename,$text)
-{
- $fp = @fopen($filename,'w')
- or die("Cannot open file '" . $filename . "' (save_to_file)");
- fwrite($fp,$text);
- fclose($fp);
-}
-
-function settings2array($settings, &$ini_settings)
-{
- foreach($settings as $setting) {
- if (strpos($setting, '=')!==false) {
- $setting = explode("=", $setting, 2);
- $name = trim($setting[0]);
- $value = trim($setting[1]);
- $ini_settings[$name] = $value;
- }
- }
-}
-
-function settings2params(&$ini_settings)
-{
- $settings = '';
- if (count($ini_settings)) {
- foreach($ini_settings as $name => $value) {
- $value = addslashes($value);
- $settings .= " -d \"".strtolower($name)."=$value\"";
- }
- }
- return $settings;
-}
-
-function generate_diff($wanted,$output)
-{
- $w = explode("\n", $wanted);
- $o = explode("\n", $output);
- $w1 = array_diff_assoc($w,$o);
- $o1 = array_diff_assoc($o,$w);
- $w2 = array();
- $o2 = array();
- foreach($w1 as $idx => $val) $w2[sprintf("%03d<",$idx)] = sprintf("%03d- ", $idx+1).$val;
- foreach($o1 as $idx => $val) $o2[sprintf("%03d>",$idx)] = sprintf("%03d+ ", $idx+1).$val;
- $diff = array_merge($w2, $o2);
- ksort($diff);
- return implode("\r\n", $diff);
-}
-
-function mkpath($path,$mode = 0700) {
- $dirs = split('[\\|/]',realpath($path));
- $path = $dirs[0];
- for($i = 1;$i < count($dirs);$i++) {
- $path .= '/'.$dirs[$i];
- @mkdir($path,$mode);
- }
-}
-
-function copyfiles($src,$new) {
- $d = dir($src);
- while (($entry = $d->read())) {
- if (is_file("$src/$entry"))
- copy("$src/$entry","$new/$entry");
- }
- $d->close();
-}
-
-function post_result_data($query,$data)
-{
- $url = QA_SUBMISSION_PAGE.'?'.$query;
- $post = "php_test_data=" . urlencode(base64_encode(preg_replace("/[\\x00]/", "[0x0]", $data)));
- $r = new HTTPRequest($url,NULL,NULL,$post);
- return $this->response_headers['Status']=='200';
-}
-
-
-function execute($command, $args=NULL, $input=NULL, $cwd=NULL, $env=NULL)
-{
- $data = "";
-
- if (gettype($args)=='array') {
- $args = join($args,' ');
- }
- $commandline = "$command $args";
- $proc = proc_open($commandline, array(
- 0 => array('pipe', 'r'),
- 1 => array('pipe', 'w')),
- $pipes, $cwd, $env);
-
- if (!$proc)
- return false;
-
- if ($input) {
- $out = fwrite($pipes[0],$input);
- if ($out != strlen($input)) {
- return NULL;
- }
- }
-
- fclose($pipes[0]);
-
- while (true) {
- /* hide errors from interrupted syscalls */
- $r = $pipes;
- $w = null;
- $e = null;
- $n = @stream_select($r, $w, $e, 60);
-
- if ($n == 0) {
- /* timed out */
- $data .= "\n ** ERROR: process timed out **\n";
- proc_terminate($proc);
- return $data;
- } else if ($n) {
- $line = fread($pipes[1], 8192);
- if (strlen($line) == 0) {
- /* EOF */
- break;
- }
- $data .= $line;
- }
- }
- $code = proc_close($proc);
- return $data;
-}
-
-function executeCode($php, $ini_overwrites, $code, $remove_headers=true, $cwd=NULL, $env=NULL)
-{
- $params = NULL;
- if ($ini_overwrites) {
- $info_params = array();
- settings2array($ini_overwrites,$info_params);
- $params = settings2params($info_params);
- }
- $out = execute($php, $params, $code, $cwd, $env);
- // kill the headers
- if ($remove_headers && preg_match("/^(.*?)\r?\n\r?\n(.*)/s", $out, $match)) {
- $out = $match[2];
- }
- return $out;
-}
-
-
-/**********************************************************************
- * a simple request class that lets us handle http based tests
- */
-
-class HTTPRequest
-{
- var $headers = array();
- var $timeout = 4;
- var $urlparts = NULL;
- var $url = '';
- var $userAgent = 'PHP-Test-Harness';
- var $options = array();
- var $postdata = NULL;
- var $errmsg = '';
- var $errno = 0;
- var $response;
- var $response_headers;
- var $outgoing_payload;
- var $incoming_payload = '';
-
- /*
- URL is the full url
- headers is assoc array of outgoing http headers
-
- options may include
- timeout
- proxy_host
- proxy_port
- proxy_user
- proxy_pass
- method (GET|POST)
-
- post data is, well, post data. It is not processed so
- multipart stuff must be prepared before calling this
- (or add it to class)
- */
- function HTTPRequest($URL, $headers=array(), $options=array(), $postdata=NULL)
- {
- $this->urlparts = @parse_url($URL);
- $this->url = $URL;
- $this->options = $options;
- $this->headers = $headers;
- $this->postdata = &$postdata;
- $this->doRequest();
- }
-
- function doRequest()
- {
- if (!$this->_validateUrl()) return;
-
- if (isset($this->options['timeout']))
- $this->timeout = (int)$this->options['timeout'];
-
- $this->_sendHTTP();
- }
-
- function _validateUrl()
- {
- if ( ! is_array($this->urlparts) ) {
- return FALSE;
- }
- if (!isset($this->urlparts['host'])) {
- $this->urlparts['host']='127.0.0.1';
- }
- if (!isset($this->urlparts['port'])) {
- $this->urlparts['port'] = 80;
- }
- if (!isset($this->urlparts['path']) || !$this->urlparts['path'])
- $this->urlparts['path'] = '/';
- return TRUE;
- }
-
- function _parseResponse()
- {
- if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s", $this->incoming_payload, $match)) {
- $this->response = $match[2];
- if (preg_match("/^HTTP\/1\.. (\d+).*/s",$match[1],$status) && !$status[1]) {
- $this->errmsg = "HTTP Response $status[1] Not Found";
- return FALSE;
- }
- $rh = preg_split("/[\n\r]+/",$match[1]);
- $this->response_headers = array();
- foreach ($rh as $line) {
- if (strpos($line, ':')!==false) {
- $line = explode(":", $line, 2);
- $this->response_headers[trim($line[0])] = trim($line[1]);
- }
- }
- $this->response_headers['Status']=$status[1];
- // if no content, return false
- if(strlen($this->response) > 0) return TRUE;
- }
- $this->errmsg = 'Invalid HTTP Response';
- return FALSE;
- }
-
- function &_getRequest()
- {
- $fullpath = $this->urlparts['path'].
- (isset($this->urlparts['query'])?'?'.$this->urlparts['query']:'').
- (isset($this->urlparts['fragment'])?'#'.$this->urlparts['fragment']:'');
- if (isset($this->options['proxy_host'])) {
- $fullpath = 'http://'.$this->urlparts['host'].':'.$this->urlparts['port'].$fullpath;
- }
- if (isset($this->options['proxy_user'])) {
- $headers['Proxy-Authorization'] = 'Basic ' . base64_encode($this->options['proxy_user'].":".$this->options['proxy_pass']);
- }
- $headers['User-Agent'] = $this->userAgent;
- $headers['Host'] = $this->urlparts['host'];
- $headers['Content-Length'] = strlen($this->postdata);
- $headers['Content-Type'] = 'application/x-www-form-urlencoded';
- if (isset($this->headers)) {
- $headers = array_merge($headers, $this->headers);
- }
- $headertext = '';
- foreach ($headers as $k => $v) {
- $headertext .= "$k: $v\r\n";
- }
- $method = trim($this->options['method'])?strtoupper(trim($this->options['method'])):'GET';
- $this->outgoing_payload =
- "$method $fullpath HTTP/1.0\r\n".
- $headertext."\r\n".
- $this->postdata;
- return $this->outgoing_payload;
- }
-
- function &_sendHTTP()
- {
- $this->_getRequest();
- $host = $this->urlparts['host'];
- $port = $this->urlparts['port'];
- if (isset($this->options['proxy_host'])) {
- $host = $this->options['proxy_host'];
- $port = isset($this->options['proxy_port'])?$this->options['proxy_port']:8080;
- }
- // send
- if ($this->timeout > 0) {
- $fp = fsockopen($host, $port, $this->errno, $this->errmsg, $this->timeout);
- } else {
- $fp = fsockopen($host, $port, $this->errno, $this->errmsg);
- }
- if (!$fp) {
- $this->errmsg = "Connect Error to $host:$port";
- return NULL;
- }
- if ($this->timeout > 0) {
- // some builds of php do not support this, silence
- // the warning
- @socket_set_timeout($fp, $this->timeout);
- }
- if (!fputs($fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
- $this->errmsg = "Error Sending Request Data to $host";
- return NULL;
- }
-
- while ($data = fread($fp, 32768)) {
- $this->incoming_payload .= $data;
- }
-
- fclose($fp);
-
- $this->_parseResponse();
- }
-
-# a simple test case
-#$r = new HTTPRequest('http://localhost:81/info.php/path/info');
-#print_r($r->response_headers);
-#print $r->response;
-
-} // end HTTPRequest
-
-
-/**********************************************************************
- * main test harness
- */
-
-class testHarness {
- var $cwd;
- var $xargs = array(
- #arg env var value default description
- 'c' => array('' ,'file' ,NULL ,'configuration file, see run-tests-config.php for example'),
- 'd' => array('TEST_PATHS' ,'paths' ,NULL ,'colon seperate path list'),
- 'e' => array('TEST_PHP_ERROR_STYLE','EMACS|MSVC' ,'EMACS' ,'editor error style'),
- 'h' => array('' ,'' ,NULL ,'this help'),
- 'i' => array('PHPRC' ,'path|file' ,NULL ,'ini file to use for tests (sets PHPRC)'),
- 'l' => array('TEST_PHP_LOG_FORMAT' ,'string' ,'LEODC' ,'any combination of CDELO'),
- 'm' => array('TEST_BASE_PATH' ,'path' ,NULL ,'copy tests to this path before testing'),
- 'n' => array('NO_PHPTEST_SUMMARY' ,'' ,0 ,'do not print test summary'),
- 'p' => array('TEST_PHP_EXECUTABLE' ,'path' ,NULL ,'php executable to be tested'),
- 'q' => array('NO_INTERACTION' ,'' ,0 ,'no console interaction (ie dont contact QA)'),
- 'r' => array('REPORT_EXIT_STATUS' ,'' ,0 ,'exit with status at end of execution'),
- 's' => array('TEST_PHP_SRCDIR' ,'path' ,NULL ,'path to php source code'),
- 't' => array('TEST_PHP_DETAILED' ,'number' ,0 ,'level of detail output to dump'),
- 'u' => array('TEST_WEB_BASE_URL' ,'url' ,'' ,'base url for http testing'),
- 'v' => array('TEST_CONTEXT_INFO' ,'' ,0 ,'view text executable context info'),
- 'w' => array('TEST_WEB' ,'' ,0 ,'run tests via http'),
- 'x' => array('TEST_WEB_EXT' ,'file ext' ,'php' ,'http file extension to use')
- );
-
- var $conf = array();
- var $test_to_run = array();
- var $test_files = array();
- var $test_results = array();
- var $failed_tests = array();
- var $exts_to_test;
- var $exts_tested = 0;
- var $exts_skipped = 0;
- var $ignored_by_ext = 0;
- var $test_dirs = array('tests', 'pear', 'ext', 'sapi');
- var $start_time;
- var $end_time;
- var $exec_info;
- var $test_executable_iscgi = false;
- var $inisettings; // the test executables settings, used for web tests
- var $iswin32 = false;
-
- var $ddash = "=====================================================================";
- var $sdash = "---------------------------------------------------------------------";
-
- // Default ini settings
- var $ini_overwrites = array(
- 'output_handler'=>'',
- 'zlib.output_compression'=>'Off',
- 'open_basedir'=>'',
- 'safe_mode'=>'0',
- 'disable_functions'=>'',
- 'output_buffering'=>'Off',
- 'error_reporting'=>'2047',
- 'display_errors'=>'1',
- 'log_errors'=>'0',
- 'html_errors'=>'0',
- 'track_errors'=>'1',
- 'report_memleaks'=>'1',
- 'report_zend_debug'=>'0',
- 'docref_root'=>'/phpmanual/',
- 'docref_ext'=>'.html',
- 'error_prepend_string'=>'',
- 'error_append_string'=>'',
- 'auto_prepend_file'=>'',
- 'auto_append_file'=>'',
- 'magic_quotes_runtime'=>'0',
- );
- var $env = array();
- var $info_params = array();
-
- function testHarness() {
- $this->iswin32 = substr(PHP_OS, 0, 3) == "WIN";
- $this->checkRequirements();
- $this->env = $_ENV;
- $this->removeSensitiveEnvVars();
-
- $this->initializeConfiguration();
- $this->parseArgs();
- $this->setTestPaths();
- # change to working directory
- if ($this->conf['TEST_PHP_SRCDIR']) {
- @chdir($this->conf['TEST_PHP_SRCDIR']);
- }
- $this->cwd = getcwd();
-
- if (!$this->conf['TEST_PHP_SRCDIR'])
- $this->conf['TEST_PHP_SRCDIR'] = $this->cwd;
- if (!$this->conf['TEST_BASE_PATH'] && $this->conf['TEST_PHP_SRCDIR'])
- $this->conf['TEST_BASE_PATH'] = $this->conf['TEST_PHP_SRCDIR'];
- if ($this->iswin32) {
- $this->conf['TEST_PHP_SRCDIR'] = str_replace('/','\\',$this->conf['TEST_PHP_SRCDIR']);
- $this->conf['TEST_BASE_PATH'] = str_replace('/','\\',$this->conf['TEST_BASE_PATH']);
- }
-
- if (!$this->conf['TEST_WEB'] && !is_executable($this->conf['TEST_PHP_EXECUTABLE'])) {
- $this->error("invalid PHP executable specified by TEST_PHP_EXECUTABLE = " .
- $this->conf['TEST_PHP_EXECUTABLE']);
- return false;
- }
-
- $this->getInstalledExtensions();
- $this->getExecutableInfo();
- $this->getExecutableIniSettings();
- $this->test_executable_iscgi = strncmp($this->exec_info['PHP_SAPI'],'cgi',3)==0;
- $this->calculateDocumentRoot();
-
- // add TEST_PHP_SRCDIR to the include path, this facilitates
- // tests including files from src/tests
- //$this->ini_overwrites['include_path'] = $this->cwd.($this->iswin32?';.;':':.:').$this->exec_info['INCLUDE_PATH'];
-
- $params = array();
- settings2array($this->ini_overwrites,$params);
- $this->info_params = settings2params($params);
-
- $this->contextHeader();
- if ($this->conf['TEST_CONTEXT_INFO']) return;
- $this->loadFileList();
- $this->moveTestFiles();
- $this->run();
- $this->summarizeResults();
- }
-
- function getExecutableIniSettings()
- {
- $out = $this->runscript(PHP_INI_SETTINGS_SCRIPT,true);
- $this->inisettings = unserialize($out);
- }
-
- function getExecutableInfo()
- {
- $out = $this->runscript(PHP_INFO_SCRIPT,true);
- $out = preg_split("/[\n\r]+/",$out);
- $info = array();
- foreach ($out as $line) {
- if (strpos($line, '=')!==false) {
- $line = explode("=", $line, 2);
- $name = trim($line[0]);
- $value = trim($line[1]);
- $info[$name] = $value;
- }
- }
- $this->exec_info = $info;
- }
-
- function getInstalledExtensions()
- {
- // get the list of installed extensions
- $out = $this->runscript(PHP_EXTENSIONS_SCRIPT,true);
- $this->exts_to_test = split(":",$out);
- sort($this->exts_to_test);
- $this->exts_tested = count($this->exts_to_test);
- }
-
- // if running local, calls executeCode,
- // otherwise does an http request
- function runscript($script,$removeheaders=false,$cwd=NULL)
- {
- if ($this->conf['TEST_WEB']) {
- $pi = "/testscript.{$this->conf['TEST_WEB_EXT']}";
- if (!$cwd) $cwd = $this->conf['TEST_BASE_PATH'];
- $tmp_file = "$cwd$pi";
- $pi = substr($cwd,strlen($this->conf['TEST_BASE_PATH'])).$pi;
- $url = "{$this->conf['TEST_WEB_BASE_URL']}$pi";
- save_to_file($tmp_file,$script);
- $fd = fopen($url, "rb");
- $out = '';
- if ($fd) {
- while (!feof($fd))
- $out .= fread($fd, 8192);
- fclose($fd);
- }
- unlink($tmp_file);
- if ($removeheaders &&
- preg_match("/^(.*?)\r?\n\r?\n(.*)/s", $this->incoming_payload, $match)) {
- return $match[2];
- }
- return $out;
- } else {
- return executeCode($this->conf['TEST_PHP_EXECUTABLE'],$this->ini_overwrites, $script,$removeheaders,$cwd,$this->env);
- }
- }
-
-
- // Use this function to do any displaying of text, so that
- // things can be over-written as necessary.
-
- function writemsg($msg) {
-
- echo $msg;
-
- }
-
- // Another wrapper function, this one should be used any time
- // a particular test passes or fails
-
- function showstatus($item, $status, $reason = '') {
-
- switch($status) {
- case 'PASSED':
- $this->writemsg("PASSED: $item ($reason)\n");
- break;
- case 'FAILED':
- $this->writemsg("FAILED: $item ($reason)\n");
- break;
- case 'SKIPPED':
- $this->writemsg("SKIPPED: $item ($reason)\n");
- break;
- }
- }
-
-
- function help()
- {
- $usage = "usage: php run-tests.php [options]\n";
- foreach ($this->xargs as $arg=>$arg_info) {
- $usage .= sprintf(" -%s %-12s %s\n",$arg,$arg_info[1],$arg_info[3]);
- }
- return $usage;
- }
-
- function parseArgs() {
- global $argc;
- global $argv;
- global $_SERVER;
-
- if (!isset($argv)) {
- $argv = $_SERVER['argv'];
- $argc = $_SERVER['argc'];
- }
-
- $conf = NULL;
- for ($i=1; $i<$argc;) {
- if ($argv[$i][0] != '-') continue;
- $opt = $argv[$i++][1];
- if (isset($value)) unset($value);
- if (@$argv[$i][0] != '-') {
- @$value = $argv[$i++];
- }
- switch($opt) {
- case 'c':
- /* TODO: Implement configuraiton file */
- include($value);
- if (!isset($conf)) {
- $this->writemsg("Invalid configuration file\n");
- exit(1);
- }
- $this->conf = array_merge($this->conf,$conf);
- break;
- case 'e':
- $this->conf['TEST_PHP_ERROR_STYLE'] = strtoupper($value);
- break;
- case 'h':
- print $this->help();
- exit(0);
- default:
- if ($this->xargs[$opt][1] && isset($value))
- $this->conf[$this->xargs[$opt][0]] = $value;
- else if (!$this->xargs[$opt][1])
- $this->conf[$this->xargs[$opt][0]] = isset($value)?$value:1;
- else
- $this->error("Invalid argument setting for argument $opt, should be [{$this->xargs[$opt][1]}]\n");
- break;
- }
- }
-
- // set config into environment, this allows
- // executed tests to find out about the test
- // configurations. config file or args overwrite
- // env var config settings
- $this->env = array_merge($this->env,$this->conf);
- if (!$this->conf['TEST_WEB'] && !$this->conf['TEST_PHP_EXECUTABLE']) {
- $this->writemsg($this->help());
- exit(0);
- }
- }
-
- function removeSensitiveEnvVars()
- {
- # delete sensitive env vars
- $this->env['SSH_CLIENT']='deleted';
- $this->env['SSH_AUTH_SOCK']='deleted';
- $this->env['SSH_TTY']='deleted';
- }
-
- function setEnvConfigVar($name)
- {
- if (isset($this->env[$name])) {
- $this->conf[$name] = $this->env[$name];
- }
- }
-
- function initializeConfiguration()
- {
- foreach ($this->xargs as $arg=>$arg_info) {
- if ($arg_info[0]) {
- # initialize the default setting
- $this->conf[$arg_info[0]]=$arg_info[2];
- # get config from environment
- $this->setEnvConfigVar($arg_info[0]);
- }
- }
- }
-
- function setTestPaths()
- {
- // configure test paths from config file or command line
- if (@$this->conf['TEST_PATHS']) {
- $this->test_dirs = array();
- if ($this->iswin32) {
- $paths = split(';',$this->conf['TEST_PATHS']);
- } else {
- $paths = split(':|;',$this->conf['TEST_PATHS']);
- }
- foreach($paths as $path) {
- $this->test_dirs[] = realpath($path);
- }
- }
- }
-
- function test_sort($a, $b) {
- $ta = strpos($a, "{$this->cwd}/tests")===0 ? 1 + (strpos($a, "{$this->cwd}/tests/run-test")===0 ? 1 : 0) : 0;
- $tb = strpos($b, "{$this->cwd}/tests")===0 ? 1 + (strpos($b, "{$this->cwd}/tests/run-test")===0 ? 1 : 0) : 0;
- if ($ta == $tb) {
- return strcmp($a, $b);
- } else {
- return $tb - $ta;
- }
- }
-
- function checkRequirements() {
- if (version_compare(phpversion(), "5.0") < 0) {
- $this->writemsg(REQ_PHP_VERSION);
- exit;
- }
- if (!file_exists("/tmp")) {
- $this->writemsg(TMP_MISSING);
- exit;
- }
- if (!function_exists("proc_open")) {
- $this->writemsg(PROC_OPEN_MISSING);
- exit;
- }
- if (!extension_loaded("pcre")) {
- $this->writemsg(PCRE_MISSING_ERROR);
- exit;
- }
- if (ini_get('safe_mode')) {
- $this->writemsg(SAFE_MODE_WARNING);
- }
- }
-
- //
- // Write test context information.
- //
- function contextHeader()
- {
- $info = '';
- foreach ($this->exec_info as $k=>$v) {
- $info .= sprintf("%-20.s: %s\n",$k,$v);
- }
- $exts = '';
- foreach ($this->exts_to_test as $ext) {
- $exts .="$ext\n ";
- }
- $dirs = '';
- foreach ($this->test_dirs as $test_dir) {
- $dirs .= "$test_dir\n ";
- }
- $conf = '';
- foreach ($this->conf as $k=>$v) {
- $conf .= sprintf("%-20.s: %s\n",$k,$v);
- }
-
- $exeinfo = '';
- if (!$this->conf['TEST_WEB'])
- $exeinfo = "CWD : {$this->cwd}\n".
- "PHP : {$this->conf['TEST_PHP_EXECUTABLE']}\n";
-
- $this->writemsg("\n$this->ddash\n".
- "$exeinfo$info\n".
- "Test Harness Configuration:\n$conf\n".
- "Extensions : $exts\n".
- "Test Dirs : $dirs\n".
- "$this->ddash\n");
- }
-
- function loadFileList()
- {
- foreach ($this->test_dirs as $dir) {
- if (is_dir($dir)) {
- $this->findFilesInDir($dir, ($dir == 'ext'));
- } else {
- $this->test_files[] = $dir;
- }
- }
- usort($this->test_files,array($this,"test_sort"));
- $this->writemsg("found ".count($this->test_files)." files\n");
- }
-
- function moveTestFiles()
- {
- if (!$this->conf['TEST_BASE_PATH'] ||
- $this->conf['TEST_BASE_PATH'] == $this->conf['TEST_PHP_SRCDIR']) return;
- $this->writemsg("moving files from {$this->conf['TEST_PHP_SRCDIR']} to {$this->conf['TEST_BASE_PATH']}\n");
- $l = strlen($this->conf['TEST_PHP_SRCDIR']);
- $files = array();
- $dirs = array();
- foreach ($this->test_files as $file) {
- if (strpos($file,$this->conf['TEST_PHP_SRCDIR'])==0) {
- $newlocation = $this->conf['TEST_BASE_PATH'].substr($file,$l);
- $files[] = $newlocation;
- $dirs[dirname($file)] = dirname($newlocation);
- } else {
- // XXX what to do with test files outside the
- // php source directory? Need to map them into
- // the new directory somehow.
- }
- }
- foreach ($dirs as $src=>$new) {
- mkpath($new);
- copyfiles($src,$new);
- }
- $this->test_files = $files;
- }
-
- function findFilesInDir($dir,$is_ext_dir=FALSE,$ignore=FALSE)
- {
- $skip = array('.', '..', 'CVS');
- $o = opendir($dir) or $this->error("cannot open directory: $dir");
- while (($name = readdir($o)) !== FALSE) {
- if (in_array($name, $skip)) continue;
- if (is_dir("$dir/$name")) {
- $skip_ext = ($is_ext_dir && !in_array($name, $this->exts_to_test));
- if ($skip_ext) {
- $this->exts_skipped++;
- }
- $this->findFilesInDir("$dir/$name", FALSE, $ignore || $skip_ext);
- }
-
- // Cleanup any left-over tmp files from last run.
- if (substr($name, -4) == '.tmp') {
- @unlink("$dir/$name");
- continue;
- }
-
- // Otherwise we're only interested in *.phpt files.
- if (substr($name, -5) == '.phpt') {
- if ($ignore) {
- $this->ignored_by_ext++;
- } else {
- $testfile = realpath("$dir/$name");
- $this->test_files[] = $testfile;
- }
- }
- }
- closedir($o);
- }
-
- function runHeader()
- {
- $this->writemsg("TIME START " . date('Y-m-d H:i:s', $this->start_time) . "\n".$this->ddash."\n");
- if (count($this->test_to_run)) {
- $this->writemsg("Running selected tests.\n");
- } else {
- $this->writemsg("Running all test files.\n");
- }
- }
-
- function run()
- {
- $this->start_time = time();
- $this->runHeader();
- // Run selected tests.
- if (count($this->test_to_run)) {
-
- foreach($this->test_to_run as $name=>$runnable) {
- if(!preg_match("/\.phpt$/", $name))
- continue;
- if ($runnable) {
- $this->test_results[$name] = $this->run_test($name);
- }
- }
- } else {
- foreach ($this->test_files as $name) {
- $this->test_results[$name] = $this->run_test($name);
- }
- }
- $this->end_time = time();
- }
-
- function summarizeResults()
- {
- if (count($this->test_results) == 0) {
- $this->writemsg("No tests were run.\n");
- return;
- }
-
- $n_total = count($this->test_results);
- $n_total += $this->ignored_by_ext;
-
- $sum_results = array('PASSED'=>0, 'SKIPPED'=>0, 'FAILED'=>0);
- foreach ($this->test_results as $v) {
- $sum_results[$v]++;
- }
- $sum_results['SKIPPED'] += $this->ignored_by_ext;
- $percent_results = array();
- while (list($v,$n) = each($sum_results)) {
- $percent_results[$v] = (100.0 * $n) / $n_total;
- }
-
- $this->writemsg("\n".$this->ddash."\n".
- "TIME END " . date('Y-m-d H:i:s', $this->end_time) . "\n".
- $this->ddash."\n".
- "TEST RESULT SUMMARY\n".
- $this->sdash."\n".
- "Exts skipped : " . sprintf("%4d",$this->exts_skipped) . "\n".
- "Exts tested : " . sprintf("%4d",$this->exts_tested) . "\n".
- $this->sdash."\n".
- "Number of tests : " . sprintf("%4d",$n_total) . "\n".
- "Tests skipped : " . sprintf("%4d (%2.1f%%)",$sum_results['SKIPPED'],$percent_results['SKIPPED']) . "\n".
- "Tests failed : " . sprintf("%4d (%2.1f%%)",$sum_results['FAILED'],$percent_results['FAILED']) . "\n".
- "Tests passed : " . sprintf("%4d (%2.1f%%)",$sum_results['PASSED'],$percent_results['PASSED']) . "\n".
- $this->sdash."\n".
- "Time taken : " . sprintf("%4d seconds", $this->end_time - $this->start_time) . "\n".
- $this->ddash."\n");
-
- $failed_test_summary = '';
- if ($this->failed_tests) {
- $failed_test_summary .= "\n".$this->ddash."\n".
- "FAILED TEST SUMMARY\n".$this->sdash."\n";
- foreach ($this->failed_tests as $failed_test_data) {
- $failed_test_summary .= $failed_test_data['test_name'] . "\n";
- }
- $failed_test_summary .= $this->ddash."\n";
- }
-
- if ($failed_test_summary && !$this->conf['NO_PHPTEST_SUMMARY']) {
- $this->writemsg($failed_test_summary);
- }
-
- /* We got failed Tests, offer the user to send and e-mail to QA team, unless NO_INTERACTION is set */
- if ($sum_results['FAILED'] && !$this->conf['NO_INTERACTION']) {
- $fp = fopen("php://stdin", "r+");
- $this->writemsg("\nPlease allow this report to be send to the PHP QA\nteam. This will give us a better understanding in how\n");
- $this->writemsg("PHP's test cases are doing.\n");
- $this->writemsg("(choose \"s\" to just save the results to a file)? [Yns]: ");
- flush();
- $user_input = fgets($fp, 10);
- $just_save_results = (strtolower($user_input[0]) == 's');
-
- if ($just_save_results || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') {
- /*
- * Collect information about the host system for our report
- * Fetch phpinfo() output so that we can see the PHP enviroment
- * Make an archive of all the failed tests
- * Send an email
- */
-
- /* Ask the user to provide an email address, so that QA team can contact the user */
- if (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) {
- echo "\nPlease enter your email address.\n(Your address will be mangled so that it will not go out on any\nmailinglist in plain text): ";
- flush();
- $fp = fopen("php://stdin", "r+");
- $user_email = trim(fgets($fp, 1024));
- $user_email = str_replace("@", " at ", str_replace(".", " dot ", $user_email));
- }
-
- $failed_tests_data = '';
- $sep = "\n" . str_repeat('=', 80) . "\n";
-
- $failed_tests_data .= $failed_test_summary . "\n";
-
- if (array_sum($this->failed_tests)) {
- foreach ($this->failed_tests as $test_info) {
- $failed_tests_data .= $sep . $test_info['name'];
- $failed_tests_data .= $sep . file_get_contents(realpath($test_info['output']));
- $failed_tests_data .= $sep . file_get_contents(realpath($test_info['diff']));
- $failed_tests_data .= $sep . "\n\n";
- }
- $status = "failed";
- } else {
- $status = "success";
- }
-
- $failed_tests_data .= "\n" . $sep . 'BUILD ENVIRONMENT' . $sep;
- $failed_tests_data .= "OS:\n". PHP_OS. "\n\n";
- $automake = $autoconf = $libtool = $compiler = 'N/A';
-
- if (!$this->iswin32) {
- $automake = shell_exec('automake --version');
- $autoconf = shell_exec('autoconf --version');
- /* Always use the generated libtool - Mac OSX uses 'glibtool' */
- $libtool = shell_exec('./libtool --version');
- /* Try the most common flags for 'version' */
- $flags = array('-v', '-V', '--version');
- $cc_status=0;
- foreach($flags AS $flag) {
- system($this->env['CC']." $flag >/dev/null 2>&1", $cc_status);
- if($cc_status == 0) {
- $compiler = shell_exec($this->env['CC']." $flag 2>&1");
- break;
- }
- }
- }
-
- $failed_tests_data .= "Automake:\n$automake\n";
- $failed_tests_data .= "Autoconf:\n$autoconf\n";
- $failed_tests_data .= "Libtool:\n$libtool\n";
- $failed_tests_data .= "Compiler:\n$compiler\n";
- $failed_tests_data .= "Bison:\n". @shell_exec('bison --version'). "\n";
- $failed_tests_data .= "\n\n";
-
- if (isset($user_email)) {
- $failed_tests_data .= "User's E-mail: ".$user_email."\n\n";
- }
-
- $failed_tests_data .= $sep . "PHPINFO" . $sep;
- $failed_tests_data .= shell_exec($this->conf['TEST_PHP_EXECUTABLE'].' -dhtml_errors=0 -i');
-
- $compression = 0;
-
- if ($just_save_results ||
- !post_result_data("status=$status&version=".urlencode(TESTED_PHP_VERSION),$failed_tests_data)) {
- $output_file = 'php_test_results_' . date('Ymd_Hi') . ( $compression ? '.txt.gz' : '.txt' );
- $fp = fopen($output_file, "w");
- fwrite($fp, $failed_tests_data);
- fclose($fp);
-
- if (!$just_save_results)
- echo "\nThe test script was unable to automatically send the report to PHP's QA Team\n";
- echo "Please send ".$output_file." to ".PHP_QA_EMAIL." manually, thank you.\n";
- } else {
- fwrite($fp, "\nThank you for helping to make PHP better.\n");
- fclose($fp);
- }
- }
- }
-
- if($this->conf['REPORT_EXIT_STATUS'] and $sum_results['FAILED']) {
- exit(1);
- }
- }
-
- function getINISettings(&$section_text)
- {
- $ini_settings = $this->ini_overwrites;
- // Any special ini settings
- // these may overwrite the test defaults...
- if (array_key_exists('INI', $section_text)) {
- settings2array(preg_split( "/[\n\r]+/", $section_text['INI']), $ini_settings);
- }
- return $ini_settings;
- }
-
- function getINIParams(&$section_text)
- {
- if (!$section_text) return '';
- // XXX php5 current has a problem doing this in one line
- // it fails with Only variables can be passed by reference
- // on test ext\calendar\tests\jdtojewish.phpt
- // return settings2params($this->getINISettings($section_text));
- $ini = $this->getINISettings($section_text);
- return settings2params($ini);
- }
-
- function calculateDocumentRoot()
- {
- if ($this->conf['TEST_WEB'] || $this->test_executable_iscgi) {
- // configure DOCUMENT_ROOT for web tests
- // this assumes that directories from the base url
- // matches directory depth from the base path
- $parts = parse_url($this->conf['TEST_WEB_BASE_URL']);
- $depth = substr_count($parts['path'],'/');
- $docroot = $this->conf['TEST_BASE_PATH'];
- for ($i=0 ; $i < $depth; $i++) $docroot = dirname($docroot);
- $this->conf['TEST_DOCUMENT_ROOT']=$docroot;
- $this->conf['TEST_BASE_SCRIPT_NAME']=$parts['path'];
- $this->conf['TEST_SERVER_URL']=substr($this->conf['TEST_WEB_BASE_URL'],0,strlen($this->conf['TEST_WEB_BASE_URL'])-strlen($parts['path']));
- } else {
- $this->conf['TEST_DOCUMENT_ROOT']='';
- $this->conf['TEST_BASE_SCRIPT_NAME']='';
- $this->conf['TEST_SERVER_URL']='';
- }
- }
-
- function evalSettings($filename,$data) {
- // we eval the section so we can allow dynamic env vars
- // for cgi testing
- $filename = str_replace('\\','/',$filename);
- $cwd = str_replace('\\','/',$this->cwd);
- $filepath = dirname($filename);
- $scriptname = substr($filename,strlen($this->conf['TEST_DOCUMENT_ROOT']));
- // eval fails if no newline
- return eval("$data\n");
- }
-
- function getENVSettings(&$section_text,$testfile)
- {
- $env = $this->env;
- // Any special environment settings
- // these may overwrite the test defaults...
- if (array_key_exists('ENV', $section_text)) {
- $sect = $this->evalSettings($testfile,$section_text['ENV']);
- //print "data evaled:\n$sect\n";
- settings2array(preg_split( "/[\n\r]+/", $sect), $env);
- }
- return $env;
- }
-
- function getEvalTestSettings($section_text,$testfile)
- {
- $rq = array();
- // Any special environment settings
- // these may overwrite the test defaults...
- if ($section_text) {
- $sect = $this->evalSettings($testfile,$section_text);
- //print "data evaled:\n$sect\n";
- settings2array(preg_split( "/[\n\r]+/", $sect), $rq);
- }
- return $rq;
- }
-
- //
- // Load the sections of the test file.
- //
- function getSectionText($file)
- {
- // Load the sections of the test file.
- $section_text = array(
- 'TEST' => '(unnamed test)',
- 'SKIPIF' => '',
- 'GET' => '',
- 'ARGS' => '',
- '_FILE' => $file,
- '_DIR' => realpath(dirname($file)),
- );
-
- $fp = @fopen($file, "r")
- or $this->error("Cannot open test file: $file");
-
- $section = '';
- while (!feof($fp)) {
- $line = fgets($fp);
- // Match the beginning of a section.
- if (ereg('^--([A-Z]+)--',$line,$r)) {
- $section = $r[1];
- $section_text[$section] = '';
- continue;
- }
-
- // Add to the section text.
- $section_text[$section] .= $line;
- }
- fclose($fp);
- foreach ($section_text as $k=>$v) {
- // for POST data ,we only want to trim the last new line!
- if ($k == 'POST' && preg_match('/^(.*?)\r?\n$/Ds',$v,$matches)) {
- $section_text[$k]=$matches[1];
- } else {
- $section_text[$k]=trim($v);
- }
- }
- return $section_text;
- }
-
- //
- // Check if test should be skipped.
- //
- function getSkipReason($file,&$section_text,$docgi=false)
- {
- // if the test uses POST or GET, and it's not the cgi
- // executable, skip
- if ($docgi && !$this->conf['TEST_WEB'] && !$this->test_executable_iscgi) {
- $this->showstatus($section_text['TEST'], 'SKIPPED', 'CGI Test needs CGI Binary');
- return "SKIPPED";
- }
- // if we're doing web testing, then we wont be able to set
- // ini setting on the command line. be sure the executables
- // ini settings are compatible with the test, or skip
- if (($docgi || $this->conf['TEST_WEB']) &&
- isset($section_text['INI']) && $section_text['INI']) {
- $settings = $this->getINISettings($section_text);
- foreach ($settings as $k=>$v) {
- if (strcasecmp($v,'off')==0 || !$v) $v='';
- $haveval = isset($this->inisettings[$k]['local_value']);
- if ($k == 'include_path') {
- // we only want to know that src directory
- // is in the include path
- if (strpos($this->inisettings[$k]['local_value'],$this->cwd))
- continue;
- }
- if (($haveval && $this->inisettings[$k]['local_value'] != $v) || (!$haveval && $v)) {
- $this->showstatus($section_text['TEST'], 'SKIPPED', "Test requires ini setting $k=[$v], not [".($haveval?$this->inisettings[$k]['local_value']:'')."]");
- return "SKIPPED";
- }
- }
- }
- // now handle a SKIPIF section
- if ($section_text['SKIPIF']) {
- $output = trim($this->runscript($section_text['SKIPIF'],$this->test_executable_iscgi,realpath(dirname($file))),true);
- if (!$output) return NULL;
- if ($this->conf['TEST_PHP_DETAILED'] > 2)
- print "SKIPIF: [$output]\n";
- if (eregi("^skip", $output)){
-
- $reason = (ereg("^skip[[:space:]]*(.+)\$", $output)) ? ereg_replace("^skip[[:space:]]*(.+)\$", "\\1", $output) : FALSE;
- $this->showstatus($section_text['TEST'], 'SKIPPED', $reason);
- return 'SKIPPED';
- }
- if (eregi("^info", $output)) {
- $reason = (ereg("^info[[:space:]]*(.+)\$", $output)) ? ereg_replace("^info[[:space:]]*(.+)\$", "\\1", $output) : FALSE;
- if ($reason) {
- $tested .= " (info: $reason)";
- }
- }
- }
- return NULL;
- }
-
- //
- // Run an individual test case.
- //
- function run_test($file)
- {
- if ($this->conf['TEST_PHP_DETAILED'])
- $this->writemsg("\n=================\nTEST $file\n");
-
- $section_text = $this->getSectionText($file);
-
- if ($this->iswin32)
- $shortname = str_replace($this->conf['TEST_BASE_PATH'].'\\', '', $file);
- else
- $shortname = str_replace($this->conf['TEST_BASE_PATH'].'/', '', $file);
- $tested = $section_text['TEST']." [$shortname]";
-
- if ($this->conf['TEST_WEB']) {
- $tmp_file = ereg_replace('\.phpt$','.'.$this->conf['TEST_WEB_EXT'],$file);
- $uri = $this->conf['TEST_BASE_SCRIPT_NAME'].str_replace($this->conf['TEST_BASE_PATH'], '', $tmp_file);
- $uri = str_replace('\\', '/', $uri);
- } else {
- $tmp_file = ereg_replace('\.phpt$','.php',$file);
- }
- @unlink($tmp_file);
-
- // unlink old test results
- @unlink(ereg_replace('\.phpt$','.diff',$file));
- @unlink(ereg_replace('\.phpt$','.log',$file));
- @unlink(ereg_replace('\.phpt$','.exp',$file));
- @unlink(ereg_replace('\.phpt$','.out',$file));
-
- if (!$this->conf['TEST_WEB']) {
- // Reset environment from any previous test.
- $env = $this->getENVSettings($section_text,$tmp_file);
- $ini_overwrites = $this->getINIParams($section_text);
- }
-
- // if this is a cgi test, prepare for it
- $query_string = '';
- $havepost = array_key_exists('POST', $section_text) && !empty($section_text['POST']);
- // allow empty query_string requests
- $haveget = array_key_exists('GET', $section_text) && !empty($section_text['GET']);
- $do_cgi = array_key_exists('CGI', $section_text) || $haveget || $havepost;
-
- $skipreason = $this->getSkipReason($file,$section_text,$do_cgi);
- if ($skipreason == 'SKIPPED') {
- return $skipreason;
- }
-
- // We've satisfied the preconditions - run the test!
- save_to_file($tmp_file,$section_text['FILE']);
-
- $post = NULL;
- $args = "";
-
- $headers = array();
- if ($this->conf['TEST_WEB']) {
- $request = $this->getEvalTestSettings(@$section_text['REQUEST'],$tmp_file);
- $headers = $this->getEvalTestSettings(@$section_text['HEADERS'],$tmp_file);
-
- $method = isset($request['method'])?$request['method']:$havepost?'POST':'GET';
- $query_string = $haveget?$section_text['GET']:'';
-
- $options = array();
- $options['method']=$method;
- if (isset($this->conf['timeout'])) $options['timeout'] = $this->conf['timeout'];
- if (isset($this->conf['proxy_host'])) $options['proxy_host'] = $this->conf['proxy_host'];
- if (isset($this->conf['proxy_port'])) $options['proxy_port'] = $this->conf['proxy_port'];
- if (isset($this->conf['proxy_user'])) $options['proxy_user'] = $this->conf['proxy_user'];
- if (isset($this->conf['proxy_pass'])) $options['proxy_pass'] = $this->conf['proxy_pass'];
-
- $post = $havepost?$section_text['POST']:NULL;
- $url = $this->conf['TEST_SERVER_URL'];
- if (isset($request['SCRIPT_NAME']))
- $url .= $request['SCRIPT_NAME'];
- else
- $url .= $uri;
- if (isset($request['PATH_INFO']))
- $url .= $request['PATH_INFO'];
- if (isset($request['FRAGMENT']))
- $url .= '#'.$request['FRAGMENT'];
- if (isset($request['QUERY_STRING']))
- $query_string = $request['QUERY_STRING'];
- if ($query_string)
- $url .= '?'.$query_string;
- if ($this->conf['TEST_PHP_DETAILED'])
- $this->writemsg("\nURL = $url\n");
- } else if ($do_cgi) {
- $query_string = $haveget?$section_text['GET']:'';
-
- if (!array_key_exists('GATEWAY_INTERFACE', $env))
- $env['GATEWAY_INTERFACE']='CGI/1.1';
- if (!array_key_exists('SERVER_SOFTWARE', $env))
- $env['SERVER_SOFTWARE']='PHP Test Harness';
- if (!array_key_exists('SERVER_SOFTWARE', $env))
- $env['SERVER_NAME']='127.0.0.1';
- if (!array_key_exists('REDIRECT_STATUS', $env))
- $env['REDIRECT_STATUS']='200';
- if (!array_key_exists('SERVER_NAME', $env))
- $env['QUERY_STRING']=$query_string;
- if (!array_key_exists('PATH_TRANSLATED', $env) &&
- !array_key_exists('SCRIPT_FILENAME', $env)) {
- $env['PATH_TRANSLATED']=$tmp_file;
- $env['SCRIPT_FILENAME']=$tmp_file;
- }
- if (!array_key_exists('PATH_TRANSLATED', $env))
- $env['PATH_TRANSLATED']='';
- if (!array_key_exists('PATH_INFO', $env))
- $env['PATH_INFO']='';
- if (!array_key_exists('SCRIPT_NAME', $env))
- $env['SCRIPT_NAME']='';
- if (!array_key_exists('SCRIPT_FILENAME', $env))
- $env['SCRIPT_FILENAME']='';
-
- if (array_key_exists('POST', $section_text) && (!$haveget || !empty($section_text['POST']))) {
- $post = $section_text['POST'];
- $content_length = strlen($post);
- if (!array_key_exists('REQUEST_METHOD', $env))
- $env['REQUEST_METHOD']='POST';
- if (!array_key_exists('CONTENT_TYPE', $env))
- $env['CONTENT_TYPE']='application/x-www-form-urlencoded';
- if (!array_key_exists('CONTENT_LENGTH', $env))
- $env['CONTENT_LENGTH']=$content_length;
- } else {
- if (!array_key_exists('REQUEST_METHOD', $env))
- $env['REQUEST_METHOD']='GET';
- if (!array_key_exists('CONTENT_TYPE', $env))
- $env['CONTENT_TYPE']='';
- if (!array_key_exists('CONTENT_LENGTH', $env))
- $env['CONTENT_LENGTH']='';
- }
- if ($this->conf['TEST_PHP_DETAILED'] > 1)
- $this->writemsg("\nCONTENT_LENGTH = " . $env['CONTENT_LENGTH'] .
- "\nCONTENT_TYPE = " . $env['CONTENT_TYPE'] .
- "\nPATH_TRANSLATED = " . $env['PATH_TRANSLATED'] .
- "\nPATH_INFO = " . $env['PATH_INFO'] .
- "\nQUERY_STRING = " . $env['QUERY_STRING'] .
- "\nREDIRECT_STATUS = " . $env['REDIRECT_STATUS'] .
- "\nREQUEST_METHOD = " . $env['REQUEST_METHOD'] .
- "\nSCRIPT_NAME = " . $env['SCRIPT_NAME'] .
- "\nSCRIPT_FILENAME = " . $env['SCRIPT_FILENAME'] . "\n");
- /* not cgi spec to put query string on command line,
- but used by a couple tests to catch a security hole
- in older php versions. At least IIS can be configured
- to do this. */
- $args = $env['QUERY_STRING'];
- } else {
- $args = $section_text['ARGS'] ? $section_text['ARGS'] : '';
- $args = "$ini_overwrites $tmp_file $args 2>&1";
- }
-
- if ($this->conf['TEST_WEB']) {
- // we want headers also, so fopen
- $r = new HTTPRequest($url,$headers,$options,$post);
- //$out = preg_replace("/\r\n/","\n",$r->response);
- $out = $r->response;
- $headers = $r->response_headers;
- //print $r->outgoing_payload."\n";
- //print $r->incoming_payload."\n";
- } else {
- $out = execute($this->conf['TEST_PHP_EXECUTABLE'],$args,$post,$this->cwd,$env);
- // if this is a cgi, remove the headers first
- if ($this->test_executable_iscgi
- && preg_match("/^(.*?)\r?\n\r?\n(.*)/s", $out, $match)) {
- $out = $match[2];
- $rh = preg_split("/[\n\r]+/",$match[1]);
- $headers = array();
- foreach ($rh as $line) {
- if (strpos($line, ':')!==false) {
- $line = explode(":", $line, 2);
- $headers[trim($line[0])] = trim($line[1]);
- }
- }
- }
- }
-
- if ($this->conf['TEST_PHP_DETAILED'] > 2) {
- echo "HEADERS: ";
- print_r($headers);
- echo "OUTPUT: \n$out\n";
-
- }
-
- // Does the output match what is expected?
- $output = trim($out);
- $output = preg_replace('/\r\n/',"\n",$output);
-
- $failed = FALSE;
-
- if (isset($section_text['EXPECTF']) || isset($section_text['EXPECTREGEX'])) {
- if (isset($section_text['EXPECTF'])) {
- $wanted = $section_text['EXPECTF'];
- } else {
- $wanted = $section_text['EXPECTREGEX'];
- }
- $wanted_re = preg_replace('/\r\n/',"\n",$wanted);
- if (isset($section_text['EXPECTF'])) {
- $wanted_re = preg_quote($wanted_re, '/');
- // Stick to basics
- $wanted_re = str_replace("%s", ".+?", $wanted_re); //not greedy
- $wanted_re = str_replace("%i", "[+\-]?[0-9]+", $wanted_re);
- $wanted_re = str_replace("%d", "[0-9]+", $wanted_re);
- $wanted_re = str_replace("%x", "[0-9a-fA-F]+", $wanted_re);
- $wanted_re = str_replace("%f", "[+\-]?\.?[0-9]+\.?[0-9]*(E-?[0-9]+)?", $wanted_re);
- $wanted_re = str_replace("%c", ".", $wanted_re);
- // %f allows two points "-.0.0" but that is the best *simple* expression
- }
- /* DEBUG YOUR REGEX HERE
- var_dump($wanted_re);
- print(str_repeat('=', 80) . "\n");
- var_dump($output);
- */
- $failed = !preg_match("/^$wanted_re\$/s", $output);
- }
-
- $skipexpect = false;
- if (!$failed && $this->conf['TEST_WEB'] && isset($section_text['EXPECTHEADERS'])) {
- $want = array();
- $lines = preg_split("/[\n\r]+/",$section_text['EXPECTHEADERS']);
- $wanted='';
- foreach ($lines as $line) {
- if (strpos($line, ':')!==false) {
- $line = explode(":", $line, 2);
- $want[trim($line[0])] = trim($line[1]);
- $wanted .= trim($line[0]).': '.trim($line[1])."\n";
- }
- }
- $output='';
- foreach ($want as $k=>$v) {
- $output .= "$k: {$headers[$k]}\n";
- if (!isset($headers[$k]) || $headers[$k] != $v) {
- $failed = TRUE;
- }
- }
-
- // different servers may do different things on non-200 results
- // for instance, IIS will deliver it's own error pages, so we
- // cannot expect to match up the EXPECT section. We may however,
- // want to match EXPECT on more than 200 results, so this may
- // need to change later.
- $skipexpect = isset($headers['Status']) && $headers['Status'] != 200;
- }
-
- if (!$failed && !$skipexpect && isset($section_text['EXPECT'])) {
- $wanted = $section_text['EXPECT'];
- $wanted = preg_replace('/\r\n/',"\n",$wanted);
- $failed = (0 != strcmp($output,$wanted));
- }
-
- if (!$failed) {
- @unlink($tmp_file);
- $this->showstatus($tested, 'PASSED');
- return 'PASSED';
- }
-
- // Test failed so we need to report details.
- $this->showstatus($tested, 'FAILED');
-
- $this->failed_tests[] = array(
- 'name' => $file,
- 'test_name' => $tested,
- 'output' => ereg_replace('\.phpt$','.log', $file),
- 'diff' => ereg_replace('\.phpt$','.diff', $file)
- );
-
- if ($this->conf['TEST_PHP_DETAILED'])
- $this->writemsg(generate_diff($wanted,$output)."\n");
-
- // write .exp
- if (strpos($this->conf['TEST_PHP_LOG_FORMAT'],'E') !== FALSE) {
- $logname = ereg_replace('\.phpt$','.exp',$file);
- save_to_file($logname,$wanted);
- }
-
- // write .out
- if (strpos($this->conf['TEST_PHP_LOG_FORMAT'],'O') !== FALSE) {
- $logname = ereg_replace('\.phpt$','.out',$file);
- save_to_file($logname,$output);
- }
-
- // write .diff
- if (strpos($this->conf['TEST_PHP_LOG_FORMAT'],'D') !== FALSE) {
- $logname = ereg_replace('\.phpt$','.diff',$file);
- save_to_file($logname,generate_diff($wanted,$output));
- }
-
- // write .log
- if (strpos($this->conf['TEST_PHP_LOG_FORMAT'],'L') !== FALSE) {
- $logname = ereg_replace('\.phpt$','.log',$file);
- save_to_file($logname,
- "\n---- EXPECTED OUTPUT\n$wanted\n".
- "---- ACTUAL OUTPUT\n$output\n".
- "---- FAILED\n");
- // display emacs/msvc error output
- if (strpos($this->conf['TEST_PHP_LOG_FORMAT'],'C') !== FALSE) {
- $this->error_report($file,$logname,$tested);
- }
- }
- return 'FAILED';
- }
-
- //
- // Write an error in a format recognizable to Emacs or MSVC.
- //
- function error_report($testname,$logname,$tested)
- {
- $testname = realpath($testname);
- $logname = realpath($logname);
- switch ($this->conf['TEST_PHP_ERROR_STYLE']) {
- default:
- case 'MSVC':
- $this->writemsg($testname . "(1) : $tested\n");
- $this->writemsg($logname . "(1) : $tested\n");
- break;
- case 'EMACS':
- $this->writemsg($testname . ":1: $tested\n");
- $this->writemsg($logname . ":1: $tested\n");
- break;
- }
- }
-
- function error($message)
- {
- $this->writemsg("ERROR: {$message}\n");
- exit(1);
- }
-}
-
-$test = new testHarness();
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
-?>
diff --git a/sapi/activescript/CREDITS b/sapi/activescript/CREDITS
deleted file mode 100644
index ef347bac0d..0000000000
--- a/sapi/activescript/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-ActiveScript
-Wez Furlong
diff --git a/sapi/activescript/EXPERIMENTAL b/sapi/activescript/EXPERIMENTAL
deleted file mode 100644
index 293159a693..0000000000
--- a/sapi/activescript/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this module is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/sapi/activescript/README b/sapi/activescript/README
deleted file mode 100644
index b033110332..0000000000
--- a/sapi/activescript/README
+++ /dev/null
@@ -1,56 +0,0 @@
-This is the ActiveScript SAPI for PHP.
-======================================
-
-Once registered on your system (using regsvr32), you will be able to use
-PHP script in any ActiveScript compliant host. The list includes:
-
-o. Client-side script in Internet Explorer
-o. Windows Script Host
-o. ASP and ASP.NET
-o. Windows Script Components / Behaviours
-o. MS Scriptlet control
-
-Probably the most useful of these will be using it with the scriptlet
-control, or in your own activescript host, so that you can very easily
-embed PHP into your win32 application.
-
-Installation.
-=============
-
-Build and install it somewhere; then register the engine like this:
-
- regsvr32 php4activescript.dll
-
-Usage.
-======
-
-o. Client-side script in Internet Explorer
-
- <script language="ActivePHP">
- $window->alert("Hello");
- </script>
-
-o. Windows Script Host
-
- Create a .wsf file like this:
-
- <job id="test">
- <script language="ActivePHP">
- $WScript->Echo("Hello");
- </script>
- </script>
-
-o. ASP and ASP.NET
-
- <%@language=ActivePHP %>
- <% $Response->Write("Hello"); %>
-
-o. Windows Script Components / Behaviours
-
- Use language="ActivePHP" on your <script> tags
-
-o. MS Scriptlet control
-
- Set the language property to "ActivePHP"
-
-
diff --git a/sapi/activescript/classfactory.cpp b/sapi/activescript/classfactory.cpp
deleted file mode 100644
index 50b6fde2db..0000000000
--- a/sapi/activescript/classfactory.cpp
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2002 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-/* IClassFactory Implementation, and DllXXX function implementation */
-
-#define INITGUID
-#define DEBUG_CLASS_FACTORY 0
-#define WIN32_LEAN_AND_MEAN
-#include <winsock2.h>
-#include <windows.h>
-#include <initguid.h>
-
-extern "C" {
-HINSTANCE module_handle;
-}
-
-#include <comcat.h>
-#include "TSRM.h"
-#include "php4as_classfactory.h"
-#include "php4as_scriptengine.h"
-
-volatile LONG TPHPClassFactory::factory_count = 0;
-volatile LONG TPHPClassFactory::object_count = 0;
-
-/* {{{ Class Factory Implementation */
-TPHPClassFactory::TPHPClassFactory()
-{
- m_refcount = 1;
- InterlockedIncrement(const_cast<long*> (&factory_count));
-}
-
-TPHPClassFactory::~TPHPClassFactory()
-{
- InterlockedDecrement(const_cast<long*> (&factory_count));
-}
-
-void TPHPClassFactory::AddToObjectCount(void)
-{
- InterlockedIncrement(const_cast<long*> (&object_count));
-}
-
-void TPHPClassFactory::RemoveFromObjectCount(void)
-{
- InterlockedDecrement(const_cast<long*> (&object_count));
-}
-
-STDMETHODIMP_(DWORD) TPHPClassFactory::AddRef(void)
-{
- return InterlockedIncrement(const_cast<long*> (&m_refcount));
-}
-
-STDMETHODIMP_(DWORD) TPHPClassFactory::Release(void)
-{
- DWORD ret = InterlockedDecrement(const_cast<long*> (&m_refcount));
- if (ret == 0)
- delete this;
- return ret;
-}
-
-STDMETHODIMP TPHPClassFactory::QueryInterface(REFIID iid, void **ppvObject)
-{
- *ppvObject = NULL;
-
- if (IsEqualGUID(IID_IClassFactory, iid)) {
- *ppvObject = (IClassFactory*)this;
- } else if (IsEqualGUID(IID_IUnknown, iid)) {
- *ppvObject = this;
- }
- if (*ppvObject) {
- AddRef();
- return S_OK;
- }
-
- return E_NOINTERFACE;
-}
-
-STDMETHODIMP TPHPClassFactory::LockServer(BOOL fLock)
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP TPHPClassFactory::CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppvObject)
-{
- TPHPScriptingEngine *engine = new TPHPScriptingEngine;
-
- HRESULT ret = engine->QueryInterface(iid, ppvObject);
-
- engine->Release();
-
- return ret;
-}
-
-int TPHPClassFactory::CanUnload(void)
-{
- return (object_count + factory_count) == 0 ? 1 : 0;
-}
-
-/* }}} */
-
-/* {{{ Registration structures */
-struct reg_entry {
- HKEY root_key;
- char *sub_key;
- char *value_name;
- char *data;
-};
-
-struct reg_class {
- /* REFIID here causes compilation errors */
- const GUID *class_id;
- char *class_name;
- char *threading;
- const struct reg_entry *reg;
- const GUID **cats;
-};
-
-#define MAX_REG_SUBST 8
-struct reg_subst {
- int count;
- char *names[MAX_REG_SUBST];
- char *values[MAX_REG_SUBST];
-};
-/* }}} */
-
-/* {{{ Registration information */
-/* This registers the sapi as a scripting engine that can be instantiated using it's progid */
-static const struct reg_entry engine_entries[] = {
- { HKEY_CLASSES_ROOT, "CLSID\\[CLSID]", NULL, "[CLASSNAME]" },
- { HKEY_CLASSES_ROOT, "CLSID\\[CLSID]\\InprocServer32", NULL, "[MODULENAME]" },
- { HKEY_CLASSES_ROOT, "CLSID\\[CLSID]\\InprocServer32", "ThreadingModel", "[THREADING]" },
- { HKEY_CLASSES_ROOT, "CLSID\\[CLSID]\\OLEScript", NULL, NULL },
- { HKEY_CLASSES_ROOT, "CLSID\\[CLSID]\\ProgID", NULL, "ActivePHP" },
- { HKEY_CLASSES_ROOT, "ActivePHP", NULL, "ActivePHP" },
- { HKEY_CLASSES_ROOT, "ActivePHP\\CLSID", NULL, "[CLSID]"},
- { HKEY_CLASSES_ROOT, "ActivePHP\\OLEScript", NULL, NULL},
-
- { 0, NULL, NULL, NULL }
-};
-
-static const GUID *script_engine_categories[] = {
- &CATID_ActiveScript,
- &CATID_ActiveScriptParse,
- NULL
-};
-
-static const struct reg_class classes_to_register[] = {
- { &CLSID_PHPActiveScriptEngine, "PHP Active Script Engine", "Both", engine_entries, script_engine_categories },
- { NULL, NULL, NULL, 0, NULL }
-};
-/* }}} */
-
-/* {{{ Registration code */
-static void substitute(struct reg_subst *subst, char *srcstring, char *deststring)
-{
- int i;
- char *srcpos = srcstring;
- char *destpos = deststring;
-
- while(1) {
- char *repstart = strchr(srcpos, '[');
-
- if (repstart == NULL) {
- strcpy(destpos, srcpos);
- break;
- }
-
- /* copy everything up until that character to the dest */
- strncpy(destpos, srcpos, repstart - srcpos);
- destpos += repstart - srcpos;
- *destpos = 0;
-
- /* search for replacement strings in the table */
- for (i = 0; i < subst->count; i++) {
- int len = strlen(subst->names[i]);
- if (strncmp(subst->names[i], repstart + 1, len) == 0) {
- /* append the replacement value to the buffer */
- strcpy(destpos, subst->values[i]);
- destpos += strlen(subst->values[i]);
- srcpos = repstart + len + 2;
-
- break;
- }
- }
- }
-#if DEBUG_CLASS_FACTORY
- MessageBox(0, deststring, srcstring, MB_ICONHAND);
-#endif
-}
-
-static int reg_string(BOOL do_reg, struct reg_subst *subst, const struct reg_entry *entry)
-{
- char subbuf[MAX_PATH], valuebuf[MAX_PATH], databuf[MAX_PATH];
- char *sub = NULL, *value = NULL, *data = NULL;
- LRESULT res;
- HKEY hkey;
- DWORD disp;
-
- if (entry->sub_key) {
- substitute(subst, entry->sub_key, subbuf);
- sub = subbuf;
- }
-
- if (entry->value_name) {
- substitute(subst, entry->value_name, valuebuf);
- value = valuebuf;
- }
-
- if (entry->data) {
- substitute(subst, entry->data, databuf);
- data = databuf;
- }
-
- if (do_reg) {
- res = RegCreateKeyEx(entry->root_key, sub, 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_WRITE, NULL, &hkey, &disp);
- if (res == NOERROR) {
- if (data)
- res = RegSetValueEx(hkey, value, 0, REG_SZ, (LPBYTE)data, strlen(data) + 1);
- RegCloseKey(hkey);
- }
- } else {
- res = RegDeleteKey(entry->root_key, sub);
- }
- return res == NOERROR ? 1 : 0;
-}
-
-static int perform_registration(BOOL do_reg)
-{
- char module_name[MAX_PATH];
- char classid[40];
- int ret = 1;
- int i, j;
- struct reg_subst subst = {0};
- LPOLESTR classidw;
- ICatRegister *catreg = NULL;
- CATID cats[8];
- int ncats;
-
- CoInitialize(NULL);
- CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (LPVOID*)&catreg);
-
- GetModuleFileName(module_handle, module_name, sizeof(module_name));
-
- subst.names[0] = "CLSID";
- subst.values[0] = classid;
-
- subst.names[1] = "MODULENAME";
- subst.values[1] = module_name;
-
- subst.names[2] = "CLASSNAME";
- subst.names[3] = "THREADING";
-
- subst.count = 4;
-
- for (i = 0; classes_to_register[i].class_id; i++) {
- StringFromCLSID(*classes_to_register[i].class_id, &classidw);
- WideCharToMultiByte(CP_ACP, 0, classidw, -1, classid, sizeof(classid), NULL, NULL);
- classid[39] = 0;
- CoTaskMemFree(classidw);
-
- subst.values[2] = classes_to_register[i].class_name;
- subst.values[3] = classes_to_register[i].threading;
-
- if (catreg && classes_to_register[i].cats) {
- ncats = 0;
- while(classes_to_register[i].cats[ncats]) {
- CopyMemory(&cats[ncats], classes_to_register[i].cats[ncats], sizeof(CATID));
- ncats++;
- }
- }
-
- if (do_reg) {
- for (j = 0; classes_to_register[i].reg[j].root_key; j++) {
- if (!reg_string(do_reg, &subst, &classes_to_register[i].reg[j])) {
- ret = 0;
- break;
- }
- }
-
- if (catreg && ncats) {
- catreg->RegisterClassImplCategories(*classes_to_register[i].class_id, ncats, cats);
- }
-
- } else {
-
- if (catreg && ncats) {
- catreg->UnRegisterClassImplCategories(*classes_to_register[i].class_id, ncats, cats);
- }
-
- /* do it in reverse order, so count the number of entries first */
- for (j = 0; classes_to_register[i].reg[j].root_key; j++)
- ;
- while(j-- > 0) {
- if (!reg_string(do_reg, &subst, &classes_to_register[i].reg[j])) {
- ret = 0;
- break;
- }
- }
- }
- }
-
- if (catreg)
- catreg->Release();
- CoUninitialize();
-
- return ret;
-}
-/* }}} */
-
-/* {{{ Standard COM server DllXXX entry points */
-
-STDAPI DllCanUnloadNow(void)
-{
- if (TPHPClassFactory::CanUnload())
- return S_OK;
- return S_FALSE;
-}
-
-STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
-{
- HRESULT ret = E_FAIL;
-
- if (IsEqualCLSID(CLSID_PHPActiveScriptEngine, rclsid)) {
- TPHPClassFactory *factory = new TPHPClassFactory();
-
- if (factory) {
- ret = factory->QueryInterface(riid, ppv);
- factory->Release();
- }
- }
- return ret;
-}
-
-
-
-STDAPI DllRegisterServer(void)
-{
- return perform_registration(TRUE) ? S_OK : S_FALSE;
-}
-
-STDAPI DllUnregisterServer(void)
-{
- return perform_registration(FALSE) ? S_OK : S_FALSE;
-}
-
-/* }}} */
diff --git a/sapi/activescript/php4activescript.c b/sapi/activescript/php4activescript.c
deleted file mode 100644
index d9e5b67376..0000000000
--- a/sapi/activescript/php4activescript.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-#include "php_main.h"
-#include "SAPI.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-#include "php_variables.h"
-#include "php_ini.h"
-#include "php4activescript.h"
-
-/* SAPI definitions and DllMain */
-
-static int php_activescript_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, &php_activescript_module, 1) == FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-static int sapi_activescript_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- /* In theory, this is a blackhole. In practice, I want to see the output
- * in the debugger! */
-
- char buf[1024];
- uint l, a = str_length;
-
- while(a) {
- l = a;
- if (l > sizeof(buf) - 1)
- l = sizeof(buf) - 1;
- memcpy(buf, str, l);
- buf[l] = 0;
- OutputDebugString(buf);
- a -= l;
- }
-
- return str_length;
-}
-
-static void sapi_activescript_register_server_variables(zval *track_vars_array TSRMLS_DC)
-{
-}
-
-static char *sapi_activescript_read_cookies(TSRMLS_D)
-{
- return NULL;
-}
-
-static int sapi_activescript_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- return SAPI_HEADER_ADD;
-}
-
-static int sapi_activescript_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-zend_module_entry php_activescript_module = {
- STANDARD_MODULE_HEADER,
- "ActiveScript",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- STANDARD_MODULE_PROPERTIES
-};
-
-
-sapi_module_struct activescript_sapi_module = {
- "activescript", /* name */
- "Active Script", /* pretty name */
-
- php_activescript_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- sapi_activescript_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- zend_error, /* error handler */
-
- sapi_activescript_header_handler, /* header handler */
- sapi_activescript_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- NULL, /* read POST data */
- sapi_activescript_read_cookies, /* read Cookies */
-
- sapi_activescript_register_server_variables, /* register server variables */
- NULL, /* Log message */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
- switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
- module_handle = hinstDLL;
-
- tsrm_startup(128, 1, TSRM_ERROR_LEVEL_CORE, "C:\\TSRM.log");
-
- sapi_startup(&activescript_sapi_module);
- if (activescript_sapi_module.startup) {
- activescript_sapi_module.startup(&sapi_module);
- }
- break;
- case DLL_THREAD_ATTACH:
- break;
- case DLL_THREAD_DETACH:
- ts_free_thread();
- break;
- case DLL_PROCESS_DETACH:
- if (activescript_sapi_module.shutdown) {
- activescript_sapi_module.shutdown(&sapi_module);
- }
- tsrm_shutdown();
- break;
- }
- return TRUE;
-}
-
-
diff --git a/sapi/activescript/php4activescript.def b/sapi/activescript/php4activescript.def
deleted file mode 100644
index 1f8e945838..0000000000
--- a/sapi/activescript/php4activescript.def
+++ /dev/null
@@ -1,5 +0,0 @@
-EXPORTS
-DllCanUnloadNow @1 PRIVATE
-DllGetClassObject @2 PRIVATE
-DllRegisterServer @3 PRIVATE
-DllUnregisterServer @4 PRIVATE
diff --git a/sapi/activescript/php4activescript.dsp b/sapi/activescript/php4activescript.dsp
deleted file mode 100644
index cbfafa1272..0000000000
--- a/sapi/activescript/php4activescript.dsp
+++ /dev/null
@@ -1,185 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4activescript" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4activescript - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4activescript.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4activescript.mak" CFG="php4activescript - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4activescript - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4activescript - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4activescript - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4activescript - Win32 Release_TSDbg" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4activescript - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /Ze /W3 /Gm /GX /ZI /Od /Ob0 /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D "COMPILE_LIBZEND" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php4activescript - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4activescript - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4activescript___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php4activescript___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /libpath:"..\..\Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4activescript - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4activescript___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "php4activescript___Win32_Release_TSDbg"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /version:4.0 /dll /debug /machine:I386 /libpath:"..\..\Release_TSDbg"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4activescript - Win32 Debug_TS"
-# Name "php4activescript - Win32 Release_TS"
-# Name "php4activescript - Win32 Release_TS_inline"
-# Name "php4activescript - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\classfactory.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\php4activescript.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php4activescript.def
-# End Source File
-# Begin Source File
-
-SOURCE=.\scriptengine.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php4activescript.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php4as_classfactory.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php4as_scriptengine.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/sapi/activescript/php4activescript.h b/sapi/activescript/php4activescript.h
deleted file mode 100644
index b007289616..0000000000
--- a/sapi/activescript/php4activescript.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-extern zend_module_entry php_activescript_module;
-extern sapi_module_struct activescript_sapi_module;
-extern HINSTANCE module_handle;
-extern void activescript_error_func(int type, const char *error_msg, ...);
-extern void activescript_error_handler(int type, const char *error_filename,
- const uint error_lineno, const char *format, va_list args);
diff --git a/sapi/activescript/php4as_classfactory.h b/sapi/activescript/php4as_classfactory.h
deleted file mode 100644
index 883a1a3ce3..0000000000
--- a/sapi/activescript/php4as_classfactory.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-/* IClassFactory Implementation */
-
-#include <unknwn.h>
-
-// {A0AD8E7A-95EC-4819-986F-78D93895F2AE}
-DEFINE_GUID(CLSID_PHPActiveScriptEngine,
-0xa0ad8e7a, 0x95ec, 0x4819, 0x98, 0x6f, 0x78, 0xd9, 0x38, 0x95, 0xf2, 0xae);
-
-class TPHPClassFactory:
- public IClassFactory
-{
-protected:
- volatile LONG m_refcount;
-
- static volatile LONG factory_count;
- static volatile LONG object_count;
-
-public: /* IUnknown */
- STDMETHODIMP QueryInterface(REFIID iid, void **ppvObject);
- STDMETHODIMP_(DWORD) AddRef(void);
- STDMETHODIMP_(DWORD) Release(void);
-public: /* IClassFactory */
- STDMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppvObject);
- STDMETHODIMP LockServer(BOOL fLock);
-
- TPHPClassFactory();
- ~TPHPClassFactory();
-
- static void AddToObjectCount(void);
- static void RemoveFromObjectCount(void);
- static int CanUnload(void);
-};
-
diff --git a/sapi/activescript/php4as_scriptengine.h b/sapi/activescript/php4as_scriptengine.h
deleted file mode 100644
index c34d0e850f..0000000000
--- a/sapi/activescript/php4as_scriptengine.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <activscp.h>
-#include "zend.h"
-#include <setjmp.h>
-
-/* Definitions for thread messages */
-enum {
- PHPSE_STATE_CHANGE = WM_USER + 20,
- PHPSE_INIT_NEW,
- PHPSE_PARSE_SCRIPT,
- PHPSE_ADD_SCRIPTLET,
- PHPSE_CLOSE,
- PHPSE_CLONE,
- PHPSE_ENTER,
- PHPSE_LEAVE,
- PHPSE_TERMINATE,
- PHPSE_PARSE_PROC,
- PHPSE_EXEC_PROC,
- PHPSE_ADD_NAMED_ITEM,
- PHPSE_SET_SITE,
- PHPSE_ADD_TYPELIB,
- PHPSE_TRIGGER_ERROR,
- PHPSE_GET_DISPATCH,
- PHPSE_DUMMY_TICK,
-};
-
-struct php_active_script_get_dispatch_info {
- LPCOLESTR pstrItemName;
- DWORD dispatch;
-};
-
-struct php_active_script_add_named_item_info {
- LPCOLESTR pstrName;
- DWORD dwFlags;
- IUnknown *punk;
- ITypeInfo *ptyp;
- IDispatch *pdisp;
- DWORD marshal;
-};
-
-struct php_active_script_add_scriptlet_info {
- /* [in] */ LPCOLESTR pstrDefaultName;
- /* [in] */ LPCOLESTR pstrCode;
- /* [in] */ LPCOLESTR pstrItemName;
- /* [in] */ LPCOLESTR pstrSubItemName;
- /* [in] */ LPCOLESTR pstrEventName;
- /* [in] */ LPCOLESTR pstrDelimiter;
- /* [in] */ DWORD dwSourceContextCookie;
- /* [in] */ ULONG ulStartingLineNumber;
- /* [in] */ DWORD dwFlags;
- /* [out] */ BSTR *pbstrName;
- /* [out] */ EXCEPINFO *pexcepinfo;
-};
-
-struct php_active_script_parse_info {
- /* [in] */ LPCOLESTR pstrCode;
- /* [in] */ LPCOLESTR pstrItemName;
- /* [in] */ IUnknown *punkContext;
- /* [in] */ LPCOLESTR pstrDelimiter;
- /* [in] */ DWORD dwSourceContextCookie;
- /* [in] */ ULONG ulStartingLineNumber;
- /* [in] */ DWORD dwFlags;
- /* [out] */ VARIANT *pvarResult;
- /* [out] */ EXCEPINFO *pexcepinfo;
-};
-
-struct php_active_script_parse_proc_info {
- /* [in] */ LPCOLESTR pstrCode;
- /* [in] */ LPCOLESTR pstrFormalParams;
- /* [in] */ LPCOLESTR pstrProcedureName;
- /* [in] */ LPCOLESTR pstrItemName;
- /* [in] */ IUnknown *punkContext;
- /* [in] */ LPCOLESTR pstrDelimiter;
- /* [in] */ DWORD dwSourceContextCookie;
- /* [in] */ ULONG ulStartingLineNumber;
- /* [in] */ DWORD dwFlags;
- DWORD dispcookie;
-};
-
-struct php_active_script_add_tlb_info {
- /* [in] */ const GUID * rguidTypeLib;
- /* [in] */ DWORD dwMajor;
- /* [in] */ DWORD dwMinor;
- /* [in] */ DWORD dwFlags;
-};
-
-class TPHPScriptingEngine:
- public IActiveScript,
- public IActiveScriptParse,
- public IActiveScriptParseProcedure
-{
-public:
- volatile LONG m_refcount;
- IActiveScriptSite *m_pass;
- SCRIPTSTATE m_scriptstate;
- MUTEX_T m_mutex;
- HashTable m_script_dispatchers;
- HANDLE m_engine_thread_handle;
-
- HANDLE m_sync_thread_msg;
- HRESULT m_sync_thread_ret;
-
- /* This is hacky, but only used when the host queries us for a script dispatch */
- void *** m_tsrm_hack;
-
- void add_to_global_namespace(IDispatch *disp, DWORD flags, char *name TSRMLS_DC);
-
- THREAD_T m_enginethread, m_basethread;
- HashTable m_frags;
- ULONG m_lambda_count;
- IActiveScriptSite *m_pass_eng;
-
- jmp_buf *m_err_trap;
- int m_in_main, m_stop_main;
-
- HRESULT SendThreadMessage(LONG msg, WPARAM wparam, LPARAM lparam);
-
- void engine_thread_func(void);
- HRESULT engine_thread_handler(LONG msg, WPARAM wParam, LPARAM lParam, int *handled TSRMLS_DC);
-
-public: /* IUnknown */
- STDMETHODIMP QueryInterface(REFIID iid, void **ppvObject);
- STDMETHODIMP_(DWORD) AddRef(void);
- STDMETHODIMP_(DWORD) Release(void);
-public: /* IActiveScript */
- STDMETHODIMP SetScriptSite(
- /* [in] */ IActiveScriptSite *pass);
-
- STDMETHODIMP GetScriptSite(
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- STDMETHODIMP SetScriptState(
- /* [in] */ SCRIPTSTATE ss);
-
- STDMETHODIMP GetScriptState(
- /* [out] */ SCRIPTSTATE *pssState);
-
- STDMETHODIMP Close( void);
-
- STDMETHODIMP AddNamedItem(
- /* [in] */ LPCOLESTR pstrName,
- /* [in] */ DWORD dwFlags);
-
- STDMETHODIMP AddTypeLib(
- /* [in] */ REFGUID rguidTypeLib,
- /* [in] */ DWORD dwMajor,
- /* [in] */ DWORD dwMinor,
- /* [in] */ DWORD dwFlags);
-
- STDMETHODIMP GetScriptDispatch(
- /* [in] */ LPCOLESTR pstrItemName,
- /* [out] */ IDispatch **ppdisp);
-
- STDMETHODIMP GetCurrentScriptThreadID(
- /* [out] */ SCRIPTTHREADID *pstidThread);
-
- STDMETHODIMP GetScriptThreadID(
- /* [in] */ DWORD dwWin32ThreadId,
- /* [out] */ SCRIPTTHREADID *pstidThread);
-
- STDMETHODIMP GetScriptThreadState(
- /* [in] */ SCRIPTTHREADID stidThread,
- /* [out] */ SCRIPTTHREADSTATE *pstsState);
-
- STDMETHODIMP InterruptScriptThread(
- /* [in] */ SCRIPTTHREADID stidThread,
- /* [in] */ const EXCEPINFO *pexcepinfo,
- /* [in] */ DWORD dwFlags);
-
- STDMETHODIMP Clone(
- /* [out] */ IActiveScript **ppscript);
-
-public: /* IActiveScriptParse */
- STDMETHODIMP InitNew( void);
-
- STDMETHODIMP AddScriptlet(
- /* [in] */ LPCOLESTR pstrDefaultName,
- /* [in] */ LPCOLESTR pstrCode,
- /* [in] */ LPCOLESTR pstrItemName,
- /* [in] */ LPCOLESTR pstrSubItemName,
- /* [in] */ LPCOLESTR pstrEventName,
- /* [in] */ LPCOLESTR pstrDelimiter,
- /* [in] */ DWORD dwSourceContextCookie,
- /* [in] */ ULONG ulStartingLineNumber,
- /* [in] */ DWORD dwFlags,
- /* [out] */ BSTR *pbstrName,
- /* [out] */ EXCEPINFO *pexcepinfo);
-
- STDMETHODIMP ParseScriptText(
- /* [in] */ LPCOLESTR pstrCode,
- /* [in] */ LPCOLESTR pstrItemName,
- /* [in] */ IUnknown *punkContext,
- /* [in] */ LPCOLESTR pstrDelimiter,
- /* [in] */ DWORD dwSourceContextCookie,
- /* [in] */ ULONG ulStartingLineNumber,
- /* [in] */ DWORD dwFlags,
- /* [out] */ VARIANT *pvarResult,
- /* [out] */ EXCEPINFO *pexcepinfo);
-public: /* IActiveScriptParseProcedure */
- STDMETHODIMP ParseProcedureText(
- /* [in] */ LPCOLESTR pstrCode,
- /* [in] */ LPCOLESTR pstrFormalParams,
- /* [in] */ LPCOLESTR pstrProcedureName,
- /* [in] */ LPCOLESTR pstrItemName,
- /* [in] */ IUnknown *punkContext,
- /* [in] */ LPCOLESTR pstrDelimiter,
- /* [in] */ DWORD dwSourceContextCookie,
- /* [in] */ ULONG ulStartingLineNumber,
- /* [in] */ DWORD dwFlags,
- /* [out] */ IDispatch **ppdisp);
-public:
- TPHPScriptingEngine();
- ~TPHPScriptingEngine();
-
-};
-
diff --git a/sapi/activescript/scriptengine.cpp b/sapi/activescript/scriptengine.cpp
deleted file mode 100644
index 84611ba1a6..0000000000
--- a/sapi/activescript/scriptengine.cpp
+++ /dev/null
@@ -1,1877 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2002 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-/* Implementation Notes:
- *
- * PHP stores scripting engine state in thread-local storage. That means
- * that we need to create a dedicated thread per-engine so that a host can
- * use more than one engine object per thread.
- *
- * There are some interesting synchronization issues: Anything to do with
- * running script in the PHP/Zend engine must take place on the engine
- * thread. Likewise, calling back to the host must take place on the base
- * thread - the thread that set the script site.
- * */
-
-#define _WIN32_DCOM
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#include "php.h"
-extern "C" {
-#include "php_main.h"
-#include "SAPI.h"
-#include "zend.h"
-#include "zend_execute.h"
-#include "zend_compile.h"
-#include "php_globals.h"
-#include "php_variables.h"
-#include "php_ini.h"
-#include "php4activescript.h"
-#define PHP_COM_DONT_DECLARE_RPC_HANDLER 1
-#include "ext/rpc/php_rpc.h"
-#include "ext/rpc/rpc_proxy.h"
-#include "ext/rpc/com/com.h"
-#include "ext/rpc/com/com_wrapper.h"
-#include "ext/rpc/com/php_COM.h"
-#include "ext/rpc/com/conversion.h"
-}
-#include "php_ticks.h"
-#include "php4as_scriptengine.h"
-#include "php4as_classfactory.h"
-#include <objbase.h>
-
-/* {{{ trace */
-static inline void trace(char *fmt, ...)
-{
- va_list ap;
- char buf[4096];
-
- sprintf(buf, "T=%08x ", tsrm_thread_id());
- OutputDebugString(buf);
-
- va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf), fmt, ap);
-
- OutputDebugString(buf);
-
- va_end(ap);
-}
-/* }}} */
-/* {{{ scriptstate_to_string */
-static const char *scriptstate_to_string(SCRIPTSTATE ss)
-{
- switch(ss) {
- case SCRIPTSTATE_UNINITIALIZED: return "SCRIPTSTATE_UNINITIALIZED";
- case SCRIPTSTATE_INITIALIZED: return "SCRIPTSTATE_INITIALIZED";
- case SCRIPTSTATE_STARTED: return "SCRIPTSTATE_STARTED";
- case SCRIPTSTATE_CONNECTED: return "SCRIPTSTATE_CONNECTED";
- case SCRIPTSTATE_DISCONNECTED: return "SCRIPTSTATE_DISCONNECTED";
- case SCRIPTSTATE_CLOSED: return "SCRIPTSTATE_CLOSED";
- default:
- return "unknown";
- }
-}
-/* }}} */
-/* {{{ TWideString */
-/* This class helps manipulate strings from OLE.
- * It does not use emalloc, so it is better suited for passing pointers
- * between threads. */
-class TWideString {
- public:
- LPOLESTR m_ole;
- char *m_ansi;
- int m_ansi_strlen;
-
- TWideString(LPOLESTR olestr) {
- m_ole = olestr;
- m_ansi = NULL;
- }
- TWideString(LPCOLESTR olestr) {
- m_ole = (LPOLESTR)olestr;
- m_ansi = NULL;
- }
-
- ~TWideString() {
- if (m_ansi) {
- CoTaskMemFree(m_ansi);
- }
- m_ansi = NULL;
- }
-
- char *safe_ansi_string() {
- char *ret = ansi_string();
- if (ret == NULL)
- return "<NULL>";
- return ret;
- }
-
- int ansi_len(void) {
- /* force conversion if it has not already occurred */
- if (m_ansi == NULL)
- ansi_string();
- return m_ansi_strlen;
- }
-
- static BSTR bstr_from_ansi(char *ansi) {
- OLECHAR *ole = NULL;
- BSTR bstr = NULL;
-
- int req = MultiByteToWideChar(CP_ACP, 0, ansi, -1, NULL, 0);
- if (req) {
- ole = (OLECHAR*)CoTaskMemAlloc((req + 1) * sizeof(OLECHAR));
- if (ole) {
- req = MultiByteToWideChar(CP_ACP, 0, ansi, -1, ole, req);
- req--;
- ole[req] = 0;
-
- bstr = SysAllocString(ole);
- CoTaskMemFree(ole);
- }
- }
- return bstr;
- }
-
- char *ansi_string(void)
- {
- if (m_ansi)
- return m_ansi;
-
- if (m_ole == NULL)
- return NULL;
-
- int bufrequired = WideCharToMultiByte(CP_ACP, 0, m_ole, -1, NULL, 0, NULL, NULL);
- if (bufrequired) {
-
- m_ansi = (char*)CoTaskMemAlloc(bufrequired + 1);
- if (m_ansi) {
- m_ansi_strlen = WideCharToMultiByte(CP_ACP, 0, m_ole, -1, m_ansi, bufrequired + 1, NULL, NULL);
-
- if (m_ansi_strlen) {
- m_ansi_strlen--;
- m_ansi[m_ansi_strlen] = 0;
-
- } else {
- trace("conversion failed with return code %08x\n", GetLastError());
- }
- }
- }
- return m_ansi;
- }
-};
-/* }}} */
-
-/* {{{ code fragment structures */
-enum fragtype {
- FRAG_MAIN,
- FRAG_SCRIPTLET,
- FRAG_PROCEDURE
-};
-
-typedef struct {
- enum fragtype fragtype;
- zend_op_array *opcodes;
- char *code;
- int persistent; /* should be retained for Clone */
- int executed; /* for "main" */
- char *functionname;
- unsigned int codelen;
- unsigned int starting_line;
- TPHPScriptingEngine *engine;
- void *ptr;
-} code_frag;
-
-#define FRAG_CREATE_FUNC (char*)-1
-static code_frag *compile_code_fragment(
- enum fragtype fragtype,
- char *functionname,
- LPCOLESTR code,
- ULONG starting_line,
- EXCEPINFO *excepinfo,
- TPHPScriptingEngine *engine
- TSRMLS_DC);
-
-static int execute_code_fragment(code_frag *frag,
- VARIANT *varResult,
- EXCEPINFO *excepinfo
- TSRMLS_DC);
-static void free_code_fragment(code_frag *frag);
-static code_frag *clone_code_fragment(code_frag *frag, TPHPScriptingEngine *engine TSRMLS_DC);
-
-/* }}} */
-
-/* Magic for handling threading correctly */
-static inline HRESULT SEND_THREAD_MESSAGE(TPHPScriptingEngine *engine, LONG msg, WPARAM wparam, LPARAM lparam TSRMLS_DC)
-{
- if (engine->m_enginethread == 0)
- return E_UNEXPECTED;
- if (tsrm_thread_id() == (engine)->m_enginethread)
- return (engine)->engine_thread_handler((msg), (wparam), (lparam), NULL TSRMLS_CC);
- return (engine)->SendThreadMessage((msg), (wparam), (lparam));
-}
-
-/* These functions do some magic so that interfaces can be
- * used across threads without worrying about marshalling
- * or not marshalling, as appropriate.
- * Win95 without DCOM 1.1, and NT SP 2 or lower do not have
- * the GIT; so we emulate the GIT using other means.
- * If you trace problems back to this code, installing the relevant
- * SP should solve them.
- * */
-static inline HRESULT GIT_get(DWORD cookie, REFIID riid, void **obj)
-{
- IGlobalInterfaceTable *git;
- HRESULT ret;
-
- if (SUCCEEDED(CoCreateInstance(CLSID_StdGlobalInterfaceTable, NULL,
- CLSCTX_INPROC_SERVER, IID_IGlobalInterfaceTable,
- (void**)&git))) {
-
- ret = git->GetInterfaceFromGlobal(cookie, riid, obj);
- git->Release();
- return ret;
- }
- return CoGetInterfaceAndReleaseStream((LPSTREAM)cookie, riid, obj);
-}
-
-static inline HRESULT GIT_put(IUnknown *unk, REFIID riid, DWORD *cookie)
-{
- IGlobalInterfaceTable *git;
- HRESULT ret;
-
- if (SUCCEEDED(CoCreateInstance(CLSID_StdGlobalInterfaceTable, NULL,
- CLSCTX_INPROC_SERVER, IID_IGlobalInterfaceTable,
- (void**)&git))) {
-
- ret = git->RegisterInterfaceInGlobal(unk, riid, cookie);
- git->Release();
- return ret;
- }
- return CoMarshalInterThreadInterfaceInStream(riid, unk, (LPSTREAM*)cookie);
-}
-
-static inline HRESULT GIT_revoke(DWORD cookie, IUnknown *unk)
-{
- IGlobalInterfaceTable *git;
- HRESULT ret;
-
- if (SUCCEEDED(CoCreateInstance(CLSID_StdGlobalInterfaceTable, NULL,
- CLSCTX_INPROC_SERVER, IID_IGlobalInterfaceTable,
- (void**)&git))) {
-
- ret = git->RevokeInterfaceFromGlobal(cookie);
- git->Release();
- }
- /* Kill remote clients */
- return CoDisconnectObject(unk, 0);
-}
-
-
-
-/* {{{ A generic stupid IDispatch implementation */
-class IDispatchImpl:
- public IDispatch
-{
-protected:
- volatile LONG m_refcount;
-public:
- /* IUnknown */
- STDMETHODIMP QueryInterface(REFIID iid, void **ppvObject) {
- *ppvObject = NULL;
-
- if (IsEqualGUID(IID_IDispatch, iid)) {
- *ppvObject = (IDispatch*)this;
- } else if (IsEqualGUID(IID_IUnknown, iid)) {
- *ppvObject = this;
- }
- if (*ppvObject) {
- AddRef();
- return S_OK;
- }
- return E_NOINTERFACE;
- }
-
- STDMETHODIMP_(DWORD) AddRef(void) {
- return InterlockedIncrement(const_cast<long*> (&m_refcount));
- }
-
- STDMETHODIMP_(DWORD) Release(void) {
- DWORD ret = InterlockedDecrement(const_cast<long*> (&m_refcount));
- trace("%08x: IDispatchImpl: release ref count is now %d\n", this, ret);
- if (ret == 0)
- delete this;
- return ret;
- }
- /* IDispatch */
- STDMETHODIMP GetTypeInfoCount(unsigned int * pctinfo) {
- *pctinfo = 0;
- trace("%08x: IDispatchImpl: GetTypeInfoCount\n", this);
- return S_OK;
- }
- STDMETHODIMP GetTypeInfo( unsigned int iTInfo, LCID lcid, ITypeInfo **ppTInfo) {
- trace("%08x: IDispatchImpl: GetTypeInfo\n", this);
- return DISP_E_BADINDEX;
- }
- STDMETHODIMP GetIDsOfNames( REFIID riid, OLECHAR **rgszNames, unsigned int cNames, LCID lcid, DISPID *rgDispId)
- {
- unsigned int i;
- trace("%08x: IDispatchImpl: GetIDsOfNames: \n", this);
- for (i = 0; i < cNames; i++) {
- TWideString name(rgszNames[i]);
- trace(" %s\n", name.ansi_string());
- }
- trace("----\n");
- return DISP_E_UNKNOWNNAME;
- }
- STDMETHODIMP Invoke( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
- DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult, EXCEPINFO FAR* pExcepInfo,
- unsigned int FAR* puArgErr)
- {
- trace("%08x: IDispatchImpl: Invoke dispid %08x\n", this, dispIdMember);
- return S_OK;
- }
-
-
- IDispatchImpl() {
- m_refcount = 1;
- }
-
- virtual ~IDispatchImpl() {
- }
-};
-/* }}} */
-
-/* {{{ This object represents the PHP engine to the scripting host.
- * Although the docs say it's implementation is optional, I found that
- * the Windows Script host would crash if we did not provide it. */
-class ScriptDispatch:
- public IDispatchImpl
-{
-public:
- ScriptDispatch() {
- m_refcount = 1;
- }
-};
-/* }}} */
-
-/* {{{ This object is used in conjunction with IActiveScriptParseProcedure to
- * allow scriptlets to be bound to events. IE uses this for declaring
- * event handlers such as onclick="...".
- * The compiled code is stored in this object; IE will call
- * IDispatch::Invoke when the element is clicked.
- * */
-class ScriptProcedureDispatch:
- public IDispatchImpl
-{
-public:
- code_frag *m_frag;
- DWORD m_procflags;
- TPHPScriptingEngine *m_engine;
- DWORD m_gitcookie;
-
- STDMETHODIMP Invoke( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
- DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult, EXCEPINFO FAR* pExcepInfo,
- unsigned int FAR* puArgErr)
- {
- TSRMLS_FETCH();
-
- if (m_frag) {
- trace("%08x: Procedure Dispatch: Invoke dispid %08x\n", this, dispIdMember);
- SEND_THREAD_MESSAGE(m_engine, PHPSE_EXEC_PROC, 0, (LPARAM)this TSRMLS_CC);
- }
- return S_OK;
- }
- ScriptProcedureDispatch() {
- m_refcount = 1;
- GIT_put((IDispatch*)this, IID_IDispatch, &m_gitcookie);
- }
-};
-/* }}} */
-
-/* {{{ code fragment management */
-static code_frag *compile_code_fragment(
- enum fragtype fragtype,
- char *functionname,
- LPCOLESTR code,
- ULONG starting_line,
- EXCEPINFO *excepinfo,
- TPHPScriptingEngine *engine
- TSRMLS_DC)
-{
- zval pv;
- int code_offs = 0;
- char namebuf[256];
-
- code_frag *frag = (code_frag*)CoTaskMemAlloc(sizeof(code_frag));
- memset(frag, 0, sizeof(code_frag));
-
- frag->engine = engine;
-
- /* handle the function name */
- if (functionname) {
- int namelen;
- if (functionname == FRAG_CREATE_FUNC) {
- ULONG n = ++engine->m_lambda_count;
-
- sprintf(namebuf, "__frag_%08x_%u", engine, n);
- functionname = namebuf;
- }
-
- namelen = strlen(functionname);
- code_offs = namelen + sizeof("function (){");
-
- frag->functionname = (char*)CoTaskMemAlloc((namelen + 1) * sizeof(char));
- memcpy(frag->functionname, functionname, namelen+1);
- }
-
- frag->functionname = functionname;
-
-trace("%08x: COMPILED FRAG\n", frag);
-
- frag->codelen = WideCharToMultiByte(CP_ACP, 0, code, -1, NULL, 0, NULL, NULL);
- frag->code = (char*)CoTaskMemAlloc(sizeof(char) * (frag->codelen + code_offs + 1));
-
- if (functionname) {
- sprintf(frag->code, "function %s(){ ", functionname);
- }
-
- frag->codelen = WideCharToMultiByte(CP_ACP, 0, code, -1, frag->code + code_offs, frag->codelen, NULL, NULL) - 1;
-
- if (functionname) {
- frag->codelen += code_offs + 1;
- frag->code[frag->codelen-1] = '}';
- frag->code[frag->codelen] = 0;
- }
-
-trace("code to compile is:\ncode_offs=%d func=%s\n%s\n", code_offs, functionname, frag->code);
-
- frag->fragtype = fragtype;
- frag->starting_line = starting_line;
-
- pv.type = IS_STRING;
- pv.value.str.val = frag->code;
- pv.value.str.len = frag->codelen;
-
- frag->opcodes = compile_string(&pv, "fragment" TSRMLS_CC);
-
- if (frag->opcodes == NULL) {
- free_code_fragment(frag);
-
- if (excepinfo) {
- memset(excepinfo, 0, sizeof(EXCEPINFO));
- excepinfo->wCode = 1000;
- excepinfo->bstrSource = TWideString::bstr_from_ansi("fragment");
- excepinfo->bstrDescription = TWideString::bstr_from_ansi("Problem while parsing/compiling");
- }
-
- return NULL;
- }
-
- return frag;
-}
-
-static void free_code_fragment(code_frag *frag)
-{
- switch(frag->fragtype) {
- case FRAG_PROCEDURE:
- if (frag->ptr) {
- ScriptProcedureDispatch *disp = (ScriptProcedureDispatch*)frag->ptr;
- disp->Release();
- GIT_revoke(disp->m_gitcookie, (IDispatch*)disp);
- frag->ptr = NULL;
- }
- break;
- }
-
- if (frag->opcodes)
- destroy_op_array(frag->opcodes);
- if (frag->functionname)
- CoTaskMemFree(frag->functionname);
- CoTaskMemFree(frag->code);
- CoTaskMemFree(frag);
-}
-
-static code_frag *clone_code_fragment(code_frag *frag, TPHPScriptingEngine *engine TSRMLS_DC)
-{
- zval pv;
- code_frag *newfrag = (code_frag*)CoTaskMemAlloc(sizeof(code_frag));
- memset(newfrag, 0, sizeof(code_frag));
-
- newfrag->engine = engine;
-trace("%08x: CLONED FRAG\n", newfrag);
-
- newfrag->persistent = frag->persistent;
- newfrag->codelen = frag->codelen;
- newfrag->code = (char*)CoTaskMemAlloc(sizeof(char) * frag->codelen + 1);
- memcpy(newfrag->code, frag->code, frag->codelen + 1);
-
- if (frag->functionname) {
- int namelen = strlen(frag->functionname);
- newfrag->functionname = (char*)CoTaskMemAlloc(sizeof(char) * (namelen + 1));
- memcpy(newfrag->functionname, frag->functionname, namelen+1);
- } else {
- newfrag->functionname = NULL;
- }
-
- newfrag->fragtype = frag->fragtype;
- newfrag->starting_line = frag->starting_line;
-
- pv.type = IS_STRING;
- pv.value.str.val = newfrag->code;
- pv.value.str.len = newfrag->codelen;
-
- newfrag->opcodes = compile_string(&pv, "fragment" TSRMLS_CC);
-
- if (newfrag->opcodes == NULL) {
- free_code_fragment(newfrag);
-/*
- if (excepinfo) {
- memset(excepinfo, 0, sizeof(EXCEPINFO));
- excepinfo->wCode = 1000;
- excepinfo->bstrSource = TWideString::bstr_from_ansi("fragment");
- excepinfo->bstrDescription = TWideString::bstr_from_ansi("Problem while parsing/compiling");
- }
-*/
- return NULL;
- }
-
- return newfrag;
-
-}
-
-static int execute_code_fragment(code_frag *frag,
- VARIANT *varResult,
- EXCEPINFO *excepinfo
- TSRMLS_DC)
-{
- zval *retval_ptr = NULL;
- jmp_buf *orig_jmpbuf;
- jmp_buf err_trap;
-
- if (frag->fragtype == FRAG_MAIN && frag->executed)
- return 1;
-
- orig_jmpbuf = frag->engine->m_err_trap;
- frag->engine->m_err_trap = &err_trap;
-
- if (setjmp(err_trap) == 0) {
- trace("*** Executing code in thread %08x\n", tsrm_thread_id());
-
- if (frag->functionname) {
-
- zval fname;
-
- fname.type = IS_STRING;
- fname.value.str.val = frag->functionname;
- fname.value.str.len = strlen(frag->functionname);
-
- call_user_function_ex(CG(function_table), NULL, &fname, &retval_ptr, 0, NULL, 1, NULL TSRMLS_CC);
-
- } else {
- zend_op_array *active_op_array = EG(active_op_array);
- zend_function_state *function_state_ptr = EG(function_state_ptr);
- zval **return_value_ptr_ptr = EG(return_value_ptr_ptr);
- zend_op **opline_ptr = EG(opline_ptr);
-
- EG(return_value_ptr_ptr) = &retval_ptr;
- EG(active_op_array) = frag->opcodes;
- EG(no_extensions) = 1;
-
- zend_execute(frag->opcodes TSRMLS_CC);
-
- EG(no_extensions) = 0;
- EG(opline_ptr) = opline_ptr;
- EG(active_op_array) = active_op_array;
- EG(function_state_ptr) = function_state_ptr;
- EG(return_value_ptr_ptr) = return_value_ptr_ptr;
- }
- } else {
- trace("*** --> caught error while executing\n");
- if (frag->engine->m_in_main)
- frag->engine->m_stop_main = 1;
- }
-
- frag->engine->m_err_trap = orig_jmpbuf;
-
- if (frag->fragtype == FRAG_MAIN)
- frag->executed = 1;
-
- if (varResult)
- VariantInit(varResult);
-
- if (retval_ptr) {
- if (varResult)
- php_zval_to_variant(retval_ptr, varResult, CP_ACP);
- zval_ptr_dtor(&retval_ptr);
- }
-
- return 1;
-}
-
-static void frag_dtor(void *pDest)
-{
- code_frag *frag = *(code_frag**)pDest;
- free_code_fragment(frag);
-}
-/* }}} */
-
-/* glue for getting back into the OO land */
-static DWORD WINAPI begin_engine_thread(LPVOID param)
-{
- TPHPScriptingEngine *engine = (TPHPScriptingEngine*)param;
- engine->engine_thread_func();
- trace("engine thread has really gone away!\n");
- return 0;
-}
-
-TPHPScriptingEngine::TPHPScriptingEngine()
-{
- m_scriptstate = SCRIPTSTATE_UNINITIALIZED;
- m_pass = NULL;
- m_in_main = 0;
- m_stop_main = 0;
- m_err_trap = NULL;
- m_lambda_count = 0;
- m_pass_eng = NULL;
- m_refcount = 1;
- m_basethread = tsrm_thread_id();
- m_mutex = tsrm_mutex_alloc();
- m_sync_thread_msg = CreateEvent(NULL, TRUE, FALSE, NULL);
- TPHPClassFactory::AddToObjectCount();
-
- m_engine_thread_handle = CreateThread(NULL, 0, begin_engine_thread, this, 0, &m_enginethread);
- CloseHandle(m_engine_thread_handle);
-}
-
-void activescript_run_ticks(int count)
-{
- MSG msg;
- TSRMLS_FETCH();
- TPHPScriptingEngine *engine;
-
- trace("ticking %d\n", count);
-
- engine = (TPHPScriptingEngine*)SG(server_context);
-
-/* PostThreadMessage(engine->m_enginethread, PHPSE_DUMMY_TICK, 0, 0); */
-
- while(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
- if (msg.hwnd) {
- PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- } else {
- break;
- }
- }
-}
-
-/* Synchronize with the engine thread */
-HRESULT TPHPScriptingEngine::SendThreadMessage(LONG msg, WPARAM wparam, LPARAM lparam)
-{
- HRESULT ret;
-
- if (m_enginethread == 0)
- return E_UNEXPECTED;
-
- trace("I'm waiting for a mutex in SendThreadMessage\n this=%08x ethread=%08x msg=%08x\n",
- this, m_enginethread, msg);
-
- tsrm_mutex_lock(m_mutex);
- ResetEvent(m_sync_thread_msg);
-
- /* If we call PostThreadMessage before the thread has created the queue, the message
- * posting fails. MSDN docs recommend the following course of action */
- while (!PostThreadMessage(m_enginethread, msg, wparam, lparam)) {
- Sleep(50);
- if (m_enginethread == 0) {
- tsrm_mutex_unlock(m_mutex);
- trace("breaking out of dodgy busy wait\n");
- return E_UNEXPECTED;
- }
- }
-
- /* Wait for the event object to be signalled.
- * This is a nice "blocking without blocking" wait; window messages are dispatched
- * and everything works out quite nicely */
- while(1) {
- DWORD result = MsgWaitForMultipleObjects(1, &m_sync_thread_msg, FALSE, 4000, QS_ALLINPUT);
-
- if (result == WAIT_OBJECT_0 + 1) {
- /* Dispatch some messages */
- MSG msg;
- while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
- //trace("dispatching message while waiting\n");
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- } else if (result == WAIT_TIMEOUT) {
- trace("timeout while waiting for thread reply\n");
-
- } else {
- /* the event was signalled */
- break;
- }
- }
- ret = m_sync_thread_ret;
- ResetEvent(m_sync_thread_msg);
- tsrm_mutex_unlock(m_mutex);
- return ret;
-}
-
-TPHPScriptingEngine::~TPHPScriptingEngine()
-{
- trace("\n\n *** Engine Destructor Called\n\n");
- if (m_scriptstate != SCRIPTSTATE_UNINITIALIZED && m_scriptstate != SCRIPTSTATE_CLOSED && m_enginethread)
- Close();
-
- PostThreadMessage(m_enginethread, WM_QUIT, 0, 0);
-
- TPHPClassFactory::RemoveFromObjectCount();
- tsrm_mutex_free(m_mutex);
-}
-
-/* Set some executor globals and execute a zend_op_array.
- * The declaration looks wierd because this can be invoked from
- * zend_hash_apply_with_argument */
-static int execute_main(void *pDest, void *arg TSRMLS_DC)
-{
- code_frag *frag = *(code_frag**)pDest;
-
- if (frag->fragtype == FRAG_MAIN && !(frag->engine->m_in_main && frag->engine->m_stop_main))
- execute_code_fragment(frag, NULL, NULL TSRMLS_CC);
-
- return ZEND_HASH_APPLY_KEEP;
-}
-
-static int clone_frags(void *pDest, void *arg TSRMLS_DC)
-{
- code_frag *frag, *src = *(code_frag**)pDest;
- TPHPScriptingEngine *engine = (TPHPScriptingEngine*)arg;
-
- if (src->persistent) {
- frag = clone_code_fragment(src, engine TSRMLS_CC);
- if (frag)
- zend_hash_next_index_insert(&engine->m_frags, &frag, sizeof(code_frag*), NULL);
- else
- trace("WARNING: clone failed!\n");
- }
-
- return ZEND_HASH_APPLY_KEEP;
-}
-
-HRESULT TPHPScriptingEngine::engine_thread_handler(LONG msg, WPARAM wparam, LPARAM lParam, int *handled TSRMLS_DC)
-{
- HRESULT ret = S_OK;
-
- trace("engine_thread_handler: running in thread %08x, should be %08x msg=%08x this=%08x\n",
- tsrm_thread_id(), m_enginethread, msg, this);
-
- if (handled)
- *handled = 1;
-
- if (m_enginethread == 0)
- return E_UNEXPECTED;
-
- switch(msg) {
- case PHPSE_ADD_TYPELIB:
- {
- struct php_active_script_add_tlb_info *info = (struct php_active_script_add_tlb_info*)lParam;
- ITypeLib *TypeLib;
-
- if (SUCCEEDED(LoadRegTypeLib(*info->rguidTypeLib, (USHORT)info->dwMajor,
- (USHORT)info->dwMinor, LANG_NEUTRAL, &TypeLib))) {
- php_COM_load_typelib(TypeLib, CONST_CS);
- TypeLib->Release();
- }
- }
- break;
- case PHPSE_STATE_CHANGE:
- {
- /* handle the state change here */
- SCRIPTSTATE ss = (SCRIPTSTATE)lParam;
- int start_running = 0;
- trace("%08x: DoSetScriptState(current=%s, new=%s)\n",
- this,
- scriptstate_to_string(m_scriptstate),
- scriptstate_to_string(ss));
-
- if (m_scriptstate == SCRIPTSTATE_INITIALIZED && (ss == SCRIPTSTATE_STARTED || ss == SCRIPTSTATE_CONNECTED))
- start_running = 1;
-
- m_scriptstate = ss;
-
- /* inform host/site of the change */
- if (m_pass_eng)
- m_pass_eng->OnStateChange(m_scriptstate);
-
- if (start_running) {
- /* run "main()", as described in the docs */
- if (m_pass_eng)
- m_pass_eng->OnEnterScript();
- trace("%08x: apply execute main to m_frags\n", this);
- m_in_main = 1;
- m_stop_main = 0;
- zend_hash_apply_with_argument(&m_frags, execute_main, this TSRMLS_CC);
- m_in_main = 0;
- trace("%08x: --- done execute main\n", this);
- if (m_pass_eng)
- m_pass_eng->OnLeaveScript();
-
- /* docs are a bit ambiguous here, but it appears that we should
- * inform the host that the main script execution has completed,
- * and also what the return value is */
- VARIANT varRes;
-
- VariantInit(&varRes);
- if (m_pass_eng)
- m_pass_eng->OnScriptTerminate(&varRes, NULL);
-
- /*
- m_scriptstate = SCRIPTSTATE_INITIALIZED;
- if (m_pass_eng)
- m_pass_eng->OnStateChange(m_scriptstate);
- */
- }
- }
- break;
- case PHPSE_INIT_NEW:
- {
- /* Prepare PHP/ZE for use */
-
- trace("%08x: m_frags : INIT NEW\n", this);
- zend_hash_init(&m_frags, 0, NULL, frag_dtor, TRUE);
-
- SG(options) |= SAPI_OPTION_NO_CHDIR;
- SG(server_context) = this;
- /* override the default PHP error callback */
- zend_error_cb = activescript_error_handler;
-
- zend_alter_ini_entry("register_argc_argv", 19, "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
- zend_alter_ini_entry("html_errors", 12, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
- zend_alter_ini_entry("implicit_flush", 15, "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
- zend_alter_ini_entry("max_execution_time", 19, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
-
- php_request_startup(TSRMLS_C);
- PG(during_request_startup) = 0;
- trace("\n\n *** ticks func at %08x %08x ***\n\n\n", activescript_run_ticks, &activescript_run_ticks);
-// php_add_tick_function(activescript_run_ticks);
-
- }
- break;
- case PHPSE_CLOSE:
- {
- /* Close things down */
- trace("%08x: m_frags : CLOSE/DESTROY\n", this);
- m_scriptstate = SCRIPTSTATE_CLOSED;
- if (m_pass_eng) {
- m_pass_eng->OnStateChange(m_scriptstate);
- trace("%08x: release site from this side\n", this);
- m_pass_eng->Release();
- m_pass_eng = NULL;
- }
- zend_hash_destroy(&m_frags);
- php_request_shutdown(NULL);
-
- break;
- }
- break;
- case PHPSE_CLONE:
- {
- /* Clone the engine state. This is semantically equal to serializing all
- * the parsed code from the source and unserializing it in the dest (this).
- * IE doesn't appear to use it, but Windows Script Host does. I'd expect
- * ASP/ASP.NET to do so also.
- *
- * FIXME: Probably won't work with IActiveScriptParseProcedure scriplets
- * */
-
- TPHPScriptingEngine *src = (TPHPScriptingEngine*)lParam;
-
- trace("%08x: m_frags : CLONE\n", this);
- zend_hash_apply_with_argument(&src->m_frags, clone_frags, this TSRMLS_CC);
-
- }
- break;
- case PHPSE_ADD_SCRIPTLET:
- {
- /* Parse/compile a chunk of script that will act as an event handler.
- * If the host supports IActiveScriptParseProcedure, this code will
- * not be called.
- * The docs are (typically) vague: AFAICT, once the code has been
- * compiled, we are supposed to arrange for an IConnectionPoint
- * advisory connection to the item/subitem, once the script
- * moves into SCRIPTSTATE_CONNECTED.
- * That's a lot of work!
- *
- * FIXME: this is currently almost useless
- * */
-
- struct php_active_script_add_scriptlet_info *info = (struct php_active_script_add_scriptlet_info*)lParam;
-
- TWideString
- default_name(info->pstrDefaultName),
- code(info->pstrCode),
- item_name(info->pstrItemName),
- sub_item_name(info->pstrSubItemName),
- event_name(info->pstrEventName),
- delimiter(info->pstrDelimiter);
-
- /* lets invent a function name for the scriptlet */
- char sname[256];
-
- /* should check if the name is already used! */
- if (info->pstrDefaultName)
- strcpy(sname, default_name.ansi_string());
- else {
- sname[0] = 0;
- strcat(sname, "__");
- if (info->pstrItemName) {
- strcat(sname, item_name.ansi_string());
- strcat(sname, "_");
- }
- if (info->pstrSubItemName) {
- strcat(sname, sub_item_name.ansi_string());
- strcat(sname, "_");
- }
- if (info->pstrEventName)
- strcat(sname, event_name.ansi_string());
- }
-
-
- trace("%08x: AddScriptlet:\n state=%s\n name=%s\n code=%s\n item=%s\n subitem=%s\n event=%s\n delim=%s\n line=%d\n",
- this, scriptstate_to_string(m_scriptstate),
- default_name.safe_ansi_string(), code.safe_ansi_string(), item_name.safe_ansi_string(),
- sub_item_name.safe_ansi_string(), event_name.safe_ansi_string(), delimiter.safe_ansi_string(),
- info->ulStartingLineNumber);
-
-
- code_frag *frag = compile_code_fragment(
- FRAG_SCRIPTLET,
- sname,
- info->pstrCode,
- info->ulStartingLineNumber,
- info->pexcepinfo,
- this
- TSRMLS_CC);
-
- if (frag) {
-
- frag->persistent = (info->dwFlags & SCRIPTTEXT_ISPERSISTENT);
-
- zend_hash_next_index_insert(&m_frags, &frag, sizeof(code_frag*), NULL);
-
- /*
- ScriptProcedureDispatch *disp = new ScriptProcedureDispatch;
-
- disp->AddRef();
- disp->m_frag = frag;
- disp->m_procflags = info->dwFlags;
- disp->m_engine = this;
- frag->ptr = disp;
-
- *info->ppdisp = disp;
- */
- ret = S_OK;
- } else {
- ret = DISP_E_EXCEPTION;
- }
-
- *info->pbstrName = TWideString::bstr_from_ansi(sname);
-
- trace("%08x: done with scriptlet %s\n", this, sname);
-
- }
- break;
- case PHPSE_GET_DISPATCH:
- {
- struct php_active_script_get_dispatch_info *info = (struct php_active_script_get_dispatch_info *)lParam;
- IDispatch *disp = NULL;
-
- if (info->pstrItemName != NULL) {
- zval **tmp;
- /* use this rather than php_OLECHAR_to_char because we want to avoid emalloc here */
- TWideString itemname(info->pstrItemName);
-
- /* Get that item from the global namespace.
- * If it is an object, export it as a dispatchable object.
- * */
-
- if (zend_hash_find(&EG(symbol_table), itemname.ansi_string(),
- itemname.ansi_len() + 1, (void**)&tmp) == SUCCESS) {
- if (Z_TYPE_PP(tmp) == IS_OBJECT) {
- /* FIXME: if this causes an allocation (emalloc) and we are
- * not in the engine thread, things could get ugly!!! */
- disp = php_COM_export_object(*tmp);
- }
- }
-
- } else {
- /* This object represents PHP global namespace */
- disp = (IDispatch*) new ScriptDispatch;
- }
-
- if (disp) {
- ret = GIT_put(disp, IID_IDispatch, &info->dispatch);
- disp->Release();
- } else {
- ret = S_FALSE;
- }
- }
- break;
- case PHPSE_ADD_NAMED_ITEM:
- {
- /* The Host uses this to add objects to the global namespace.
- * Some objects are intended to have their child properties
- * globally visible, so we add those to the global namespace too.
- * */
- struct php_active_script_add_named_item_info *info = (struct php_active_script_add_named_item_info *)lParam;
-
- TWideString name(info->pstrName);
- IDispatch *disp;
-
- if (SUCCEEDED(GIT_get(info->marshal, IID_IDispatch, (void**)&disp)))
- add_to_global_namespace(disp, info->dwFlags, name.ansi_string() TSRMLS_CC);
-
- }
- break;
- case PHPSE_SET_SITE:
- {
- if (m_pass_eng) {
- m_pass_eng->Release();
- m_pass_eng = NULL;
- }
-
- if (lParam)
- GIT_get(lParam, IID_IActiveScriptSite, (void**)&m_pass_eng);
-
- trace("%08x: site (engine-side) is now %08x (base=%08x)\n", this, m_pass_eng, m_pass);
-
- }
- break;
- case PHPSE_EXEC_PROC:
- {
- ScriptProcedureDispatch *disp = (ScriptProcedureDispatch *)lParam;
- execute_code_fragment(disp->m_frag, NULL, NULL TSRMLS_CC);
- }
- break;
- case PHPSE_PARSE_PROC:
- {
- /* This is the IActiveScriptParseProcedure implementation.
- * IE uses this to request for an IDispatch that it will invoke in
- * response to some event, and tells us the code that it wants to
- * run.
- * We compile the code and pass it back a dispatch object.
- * The object will then serialize access to the engine thread and
- * execute the opcodes */
- struct php_active_script_parse_proc_info *info = (struct php_active_script_parse_proc_info*)lParam;
- TWideString
- formal_params(info->pstrFormalParams),
- procedure_name(info->pstrProcedureName),
- item_name(info->pstrItemName),
- delimiter(info->pstrDelimiter);
-
- trace("%08x: ParseProc:\n state=%s\nparams=%s\nproc=%s\nitem=%s\n delim=%s\n line=%d\n",
- this, scriptstate_to_string(m_scriptstate),
- formal_params.ansi_string(), procedure_name.ansi_string(),
- item_name.safe_ansi_string(), delimiter.safe_ansi_string(),
- info->ulStartingLineNumber);
-
-
- code_frag *frag = compile_code_fragment(
- FRAG_PROCEDURE,
- NULL,
- info->pstrCode,
- info->ulStartingLineNumber,
- NULL,
- this
- TSRMLS_CC);
-
- if (frag) {
-
- frag->persistent = (info->dwFlags & SCRIPTTEXT_ISPERSISTENT);
- zend_hash_next_index_insert(&m_frags, &frag, sizeof(code_frag*), NULL);
-
- ScriptProcedureDispatch *disp = new ScriptProcedureDispatch;
-
- disp->m_frag = frag;
- disp->m_procflags = info->dwFlags;
- disp->m_engine = this;
- frag->ptr = disp;
- info->dispcookie = disp->m_gitcookie;
-
- } else {
- ret = DISP_E_EXCEPTION;
- }
-
- }
- break;
-
- case PHPSE_PARSE_SCRIPT:
- {
- struct php_active_script_parse_info *info = (struct php_active_script_parse_info*)lParam;
- int doexec;
-
- TWideString
- code(info->pstrCode),
- item_name(info->pstrItemName),
- delimiter(info->pstrDelimiter);
-
- trace("%08x: ParseScriptText:\n state=%s\ncode=%s\n item=%s\n delim=%s\n line=%d\n",
- this, scriptstate_to_string(m_scriptstate),
- code.safe_ansi_string(), item_name.safe_ansi_string(), delimiter.safe_ansi_string(),
- info->ulStartingLineNumber);
-
- code_frag *frag = compile_code_fragment(
- FRAG_MAIN,
- info->dwFlags & SCRIPTTEXT_ISEXPRESSION ? FRAG_CREATE_FUNC : NULL,
- info->pstrCode,
- info->ulStartingLineNumber,
- info->pexcepinfo,
- this
- TSRMLS_CC);
-
- doexec = (info->dwFlags & SCRIPTTEXT_ISEXPRESSION) ||
- m_scriptstate == SCRIPTSTATE_STARTED ||
- m_scriptstate == SCRIPTSTATE_CONNECTED ||
- m_scriptstate == SCRIPTSTATE_DISCONNECTED;
-
- if (frag) {
- frag->persistent = (info->dwFlags & SCRIPTTEXT_ISPERSISTENT);
- ret = S_OK;
-
- if (info->dwFlags & SCRIPTTEXT_ISEXPRESSION) {
- if (m_scriptstate == SCRIPTSTATE_INITIALIZED) {
- /* not allowed to execute code in this state */
- ret = E_UNEXPECTED;
- doexec = 0;
- }
- }
-
- if (doexec) {
- /* execute the code as an expression */
- if (!execute_code_fragment(frag, info->pvarResult, info->pexcepinfo TSRMLS_CC))
- ret = DISP_E_EXCEPTION;
- }
-
- zend_hash_next_index_insert(&m_frags, &frag, sizeof(code_frag*), NULL);
- } else {
- ret = DISP_E_EXCEPTION;
- }
-
- if (info->pvarResult) {
- VariantInit(info->pvarResult);
- }
-
-
- }
- break;
- default:
- trace("unhandled message type %08x\n", msg);
- if (handled)
- *handled = 0;
- }
- return ret;
-}
-
-/* The PHP/Zend state actually lives in this thread */
-void TPHPScriptingEngine::engine_thread_func(void)
-{
- TSRMLS_FETCH();
- int handled;
- int terminated = 0;
- MSG msg;
-
- trace("%08x: engine thread started up!\n", this);
-
- CoInitializeEx(0, COINIT_MULTITHREADED);
-
- m_tsrm_hack = tsrm_ls;
-
- while(!terminated) {
- DWORD result = MsgWaitForMultipleObjects(0, NULL, FALSE, 4000, QS_ALLINPUT);
-
- switch(result) {
- case WAIT_OBJECT_0:
- while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
-
- if (msg.message == WM_QUIT) {
- terminated = 1;
- } else if (msg.hwnd) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
-
- } else {
- handled = 1;
- m_sync_thread_ret = engine_thread_handler(msg.message, msg.wParam, msg.lParam, &handled TSRMLS_CC);
- if (handled)
- SetEvent(m_sync_thread_msg);
- }
-
- }
- break;
- case WAIT_TIMEOUT:
- trace("thread wait timed out\n");
- break;
- default:
- trace("some strange value\n");
- }
- }
-
-#if 0
- while(GetMessage(&msg, NULL, 0, 0)) {
-
- if (msg.message == WM_QUIT)
- break;
-
- handled = 1;
- m_sync_thread_ret = engine_thread_handler(msg.message, msg.wParam, msg.lParam, &handled TSRMLS_CC);
- if (handled)
- SetEvent(m_sync_thread_msg);
- }
- trace("%08x: engine thread exiting!!!!!\n", this);
-#endif
- m_enginethread = 0;
-
- CoUninitialize();
-}
-
-/* Only call this in the context of the engine thread, or you'll be sorry.
- *
- * When SCRIPTITEM_GLOBALMEMBERS is set, we're only adding COM objects to the namespace.
- * We could add *all* properties, but I don't like this idea; what if the value changes
- * while the page is running? We'd be left with stale data.
- * */
-void TPHPScriptingEngine::add_to_global_namespace(IDispatch *disp, DWORD flags, char *name TSRMLS_DC)
-{
- zval *val;
- ITypeInfo *typ;
- int i;
- unsigned int namelen;
- FUNCDESC *func;
- BSTR funcname;
- TYPEATTR *attr;
- DISPPARAMS dispparams;
- VARIANT vres;
- ITypeInfo *rettyp;
- TYPEATTR *retattr;
-
-trace("Add %s to global namespace\n", name);
-
- val = php_COM_object_from_dispatch(disp);
-
- if (val == NULL) {
- disp->Release();
- return;
- }
-
- ZEND_SET_SYMBOL(&EG(symbol_table), name, val);
-
- if (flags & SCRIPTITEM_GLOBALMEMBERS == 0) {
- disp->Release();
- return;
- }
-
- /* Enumerate properties and add those too */
- if (FAILED(disp->GetTypeInfo(0, 0, &typ))) {
- disp->Release();
- return;
- }
-
- if (SUCCEEDED(typ->GetTypeAttr(&attr))) {
- for (i = 0; i < attr->cFuncs; i++) {
- if (FAILED(typ->GetFuncDesc(i, &func)))
- continue;
-
- /* Look at its type */
- if (func->invkind == INVOKE_PROPERTYGET
- && VT_PTR == func->elemdescFunc.tdesc.vt
- && VT_USERDEFINED == func->elemdescFunc.tdesc.lptdesc->vt
- && SUCCEEDED(typ->GetRefTypeInfo(func->elemdescFunc.tdesc.lptdesc->hreftype, &rettyp)))
- {
- if (SUCCEEDED(rettyp->GetTypeAttr(&retattr))) {
- if (retattr->typekind == TKIND_DISPATCH) {
- /* It's dispatchable */
-
- /* get the value */
- dispparams.cArgs = 0;
- dispparams.cNamedArgs = 0;
- VariantInit(&vres);
-
- if (SUCCEEDED(disp->Invoke(func->memid, IID_NULL, 0, func->invkind,
- &dispparams, &vres, NULL, NULL))) {
-
- /* Get its dispatch */
- IDispatch *sub = NULL;
-
- if (V_VT(&vres) == VT_UNKNOWN)
- V_UNKNOWN(&vres)->QueryInterface(IID_IDispatch, (void**)&sub);
- else if (V_VT(&vres) == VT_DISPATCH)
- sub = V_DISPATCH(&vres);
-
- if (sub) {
- /* find out its name */
- typ->GetDocumentation(func->memid, &funcname, NULL, NULL, NULL);
- name = php_OLECHAR_to_char(funcname, &namelen, CP_ACP, 0);
-
- /* add to namespace */
- zval *subval = php_COM_object_from_dispatch(sub);
- if (subval) {
- ZEND_SET_SYMBOL(&EG(symbol_table), name, subval);
- }
-
- efree(name);
- SysFreeString(funcname);
- }
- VariantClear(&vres);
- }
- }
- rettyp->ReleaseTypeAttr(retattr);
- }
- rettyp->Release();
- }
- typ->ReleaseFuncDesc(func);
- }
- typ->ReleaseTypeAttr(attr);
- }
- disp->Release();
-}
-
-STDMETHODIMP_(DWORD) TPHPScriptingEngine::AddRef(void)
-{
- return InterlockedIncrement(const_cast<long*> (&m_refcount));
-}
-
-STDMETHODIMP_(DWORD) TPHPScriptingEngine::Release(void)
-{
- DWORD ret = InterlockedDecrement(const_cast<long*> (&m_refcount));
- if (ret == 0) {
- trace("%08x: Release: zero refcount, destroy the engine!\n", this);
- delete this;
- }
- return ret;
-}
-
-STDMETHODIMP TPHPScriptingEngine::QueryInterface(REFIID iid, void **ppvObject)
-{
- *ppvObject = NULL;
-
- if (IsEqualGUID(IID_IActiveScript, iid)) {
- *ppvObject = (IActiveScript*)this;
- } else if (IsEqualGUID(IID_IActiveScriptParse, iid)) {
- *ppvObject = (IActiveScriptParse*)this;
- } else if (IsEqualGUID(IID_IActiveScriptParseProcedure, iid)) {
- *ppvObject = (IActiveScriptParseProcedure*)this;
- } else if (IsEqualGUID(IID_IUnknown, iid)) {
- *ppvObject = this;
- } else {
- LPOLESTR guidw;
- StringFromCLSID(iid, &guidw);
- {
- TWideString guid(guidw);
- trace("%08x: QueryInterface for unsupported %s\n", this, guid.ansi_string());
- }
- CoTaskMemFree(guidw);
- }
- if (*ppvObject) {
- AddRef();
- return S_OK;
- }
-
- return E_NOINTERFACE;
-}
-
-/* This is called by the host to set the scrite site.
- * It also defines the base thread. */
-STDMETHODIMP TPHPScriptingEngine::SetScriptSite(IActiveScriptSite *pass)
-{
- TSRMLS_FETCH();
-
- tsrm_mutex_lock(m_mutex);
-
- trace("%08x: -----> Base thread is %08x\n", this, tsrm_thread_id());
-
- if (m_pass) {
- m_pass->Release();
- m_pass = NULL;
- SEND_THREAD_MESSAGE(this, PHPSE_SET_SITE, 0, 0 TSRMLS_CC);
- }
-
- if (pass == NULL) {
- trace("Closing down site; we should have no references to objects from the host\n"
- " m_pass=%08x\n m_pass_eng=%08x\n What about named items??\n",
- m_pass, m_pass_eng);
- }
-
- m_pass = pass;
- if (m_pass) {
- m_pass->AddRef();
-
- DWORD cookie;
- if (SUCCEEDED(GIT_put(m_pass, IID_IActiveScriptSite, &cookie)))
- SEND_THREAD_MESSAGE(this, PHPSE_SET_SITE, 0, cookie TSRMLS_CC);
-
- if (m_scriptstate == SCRIPTSTATE_UNINITIALIZED)
- SEND_THREAD_MESSAGE(this, PHPSE_STATE_CHANGE, 0, SCRIPTSTATE_INITIALIZED TSRMLS_CC);
- }
-
- tsrm_mutex_unlock(m_mutex);
- return S_OK;
-}
-
-STDMETHODIMP TPHPScriptingEngine::GetScriptSite(REFIID riid, void **ppvObject)
-{
- HRESULT ret = S_FALSE;
-
- trace("%08x: GetScriptSite()\n", this);
- tsrm_mutex_lock(m_mutex);
-
-
- if (m_pass)
- ret = m_pass->QueryInterface(riid, ppvObject);
-
- tsrm_mutex_unlock(m_mutex);
- return ret;
-}
-
-STDMETHODIMP TPHPScriptingEngine::SetScriptState(SCRIPTSTATE ss)
-{
- TSRMLS_FETCH();
- trace("%08x: SetScriptState(%s)\n", this, scriptstate_to_string(ss));
- return SEND_THREAD_MESSAGE(this, PHPSE_STATE_CHANGE, 0, ss TSRMLS_CC);
-}
-
-STDMETHODIMP TPHPScriptingEngine::GetScriptState(SCRIPTSTATE *pssState)
-{
- trace("%08x: GetScriptState(current=%s)\n", this, scriptstate_to_string(m_scriptstate));
- tsrm_mutex_lock(m_mutex);
- *pssState = m_scriptstate;
- tsrm_mutex_unlock(m_mutex);
- return S_OK;
-}
-
-STDMETHODIMP TPHPScriptingEngine::Close(void)
-{
- TSRMLS_FETCH();
-
- if (m_pass) {
- m_pass->Release();
- m_pass = NULL;
- }
- SEND_THREAD_MESSAGE(this, PHPSE_CLOSE, 0, 0 TSRMLS_CC);
- return S_OK;
-}
-
-/* Add an item to global namespace.
- * This is called in the context of the base thread (or perhaps some other thread).
- * We want to be able to work with the object in the engine thread, so we marshal
- * it into a stream and let the engine thread deal with it.
- * This works quite nicely when PHP scripts call into the object; threading is
- * handled correctly. */
-STDMETHODIMP TPHPScriptingEngine::AddNamedItem(LPCOLESTR pstrName, DWORD dwFlags)
-{
- struct php_active_script_add_named_item_info info;
- TSRMLS_FETCH();
-
- info.pstrName = pstrName;
- info.dwFlags = dwFlags;
-
- m_pass->GetItemInfo(pstrName, SCRIPTINFO_IUNKNOWN, &info.punk, NULL);
- if (SUCCEEDED(GIT_put(info.punk, IID_IDispatch, &info.marshal))) {
- SEND_THREAD_MESSAGE(this, PHPSE_ADD_NAMED_ITEM, 0, (LPARAM)&info TSRMLS_CC);
- }
- info.punk->Release();
-
- return S_OK;
-}
-
-/* Bind to a type library */
-STDMETHODIMP TPHPScriptingEngine::AddTypeLib(
- /* [in] */ REFGUID rguidTypeLib,
- /* [in] */ DWORD dwMajor,
- /* [in] */ DWORD dwMinor,
- /* [in] */ DWORD dwFlags)
-{
- struct php_active_script_add_tlb_info info;
- TSRMLS_FETCH();
-
- info.rguidTypeLib = &rguidTypeLib;
- info.dwMajor = dwMajor;
- info.dwMinor = dwMinor;
- info.dwFlags = dwFlags;
-
- SEND_THREAD_MESSAGE(this, PHPSE_ADD_TYPELIB, 0, (LPARAM)&info TSRMLS_CC);
-
- return S_OK;
-}
-
-/* Returns an object representing the PHP Scripting Engine.
- * Optionally, a client can request a particular item directly.
- * For the moment, we only do the bare minimum amount of work
- * for the engine to work correctly; we can flesh out this part
- * a little later. */
-STDMETHODIMP TPHPScriptingEngine::GetScriptDispatch(
- /* [in] */ LPCOLESTR pstrItemName,
- /* [out] */ IDispatch **ppdisp)
-{
- TSRMLS_FETCH();
- *ppdisp = NULL;
- struct php_active_script_get_dispatch_info info;
-
- info.pstrItemName = pstrItemName;
- info.dispatch = NULL;
-
- /* This hack is required because the host is likely to query us
- * for a dispatch if we use any of it's objects from PHP script.
- * Since the engine thread will be waiting for the return from
- * a COM call, we need to deliberately poke a hole in thread
- * safety so that it is possible to read the symbol table from
- * outside the engine thread and give it a valid return value.
- * This is "safe" only in this instance, since we are not modifying
- * the engine state by looking up the dispatch (I hope).
- * The scripting engine rules pretty much guarantee that this
- * method is only called in the base thread. */
-
- if (tsrm_thread_id() != m_enginethread) {
- tsrm_ls = m_tsrm_hack;
- trace("HEY: hacking thread safety!\n");
- }
-
- if (S_OK == engine_thread_handler(PHPSE_GET_DISPATCH, 0, (LPARAM)&info, NULL TSRMLS_CC)) {
- GIT_get(info.dispatch, IID_IDispatch, (void**)ppdisp);
- }
-
- if (*ppdisp) {
- return S_OK;
- }
- return S_FALSE;
-}
-
-STDMETHODIMP TPHPScriptingEngine::GetCurrentScriptThreadID(
- /* [out] */ SCRIPTTHREADID *pstidThread)
-{
-// tsrm_mutex_lock(m_mutex);
- trace("%08x: GetCurrentScriptThreadID()\n", this);
- *pstidThread = m_enginethread;
-// tsrm_mutex_unlock(m_mutex);
- return S_OK;
-}
-
-STDMETHODIMP TPHPScriptingEngine::GetScriptThreadID(
- /* [in] */ DWORD dwWin32ThreadId,
- /* [out] */ SCRIPTTHREADID *pstidThread)
-{
-// tsrm_mutex_lock(m_mutex);
- trace("%08x: GetScriptThreadID()\n", this);
- *pstidThread = dwWin32ThreadId;
-// tsrm_mutex_unlock(m_mutex);
- return S_OK;
-}
-
-STDMETHODIMP TPHPScriptingEngine::GetScriptThreadState(
- /* [in] */ SCRIPTTHREADID stidThread,
- /* [out] */ SCRIPTTHREADSTATE *pstsState)
-{
-// tsrm_mutex_lock(m_mutex);
-
- trace("%08x: GetScriptThreadState()\n", this);
- *pstsState = SCRIPTTHREADSTATE_NOTINSCRIPT;
-
- switch(stidThread) {
- case SCRIPTTHREADID_BASE:
- stidThread = m_basethread;
- break;
- case SCRIPTTHREADID_CURRENT:
- stidThread = m_enginethread;
- break;
- };
- if (stidThread == m_basethread) {
- *pstsState = SCRIPTTHREADSTATE_NOTINSCRIPT;
- } else if (stidThread == m_enginethread) {
- *pstsState = SCRIPTTHREADSTATE_NOTINSCRIPT;
- }
-// tsrm_mutex_unlock(m_mutex);
- return S_OK;
-}
-
-STDMETHODIMP TPHPScriptingEngine::InterruptScriptThread(
- /* [in] */ SCRIPTTHREADID stidThread,
- /* [in] */ const EXCEPINFO *pexcepinfo,
- /* [in] */ DWORD dwFlags)
-{
- /* do not serialize this method, or call into the script site */
- trace("%08x: InterruptScriptThread()\n", this);
- return S_OK;
-}
-
-/* Clone is essential when running under Windows Script Host.
- * It creates an engine to parse the code. Once it is parsed,
- * the host clones other engines from the original and runs those.
- * It is intended to be a fast method of running the same script
- * multiple times in multiple threads. */
-STDMETHODIMP TPHPScriptingEngine::Clone(
- /* [out] */ IActiveScript **ppscript)
-{
- TPHPScriptingEngine *cloned = new TPHPScriptingEngine;
- TSRMLS_FETCH();
-
- trace("%08x: Clone()\n", this);
-
- if (ppscript)
- *ppscript = NULL;
-
- if (cloned) {
- cloned->InitNew();
- SEND_THREAD_MESSAGE(cloned, PHPSE_CLONE, 0, (LPARAM)this TSRMLS_CC);
- trace("%08x: Cloned OK, returning cloned object ptr %08x\n", this, cloned);
- *ppscript = (IActiveScript*)cloned;
- return S_OK;
-
- }
-
- return E_FAIL;
-}
-
-
-STDMETHODIMP TPHPScriptingEngine::InitNew( void)
-{
- TSRMLS_FETCH();
- SEND_THREAD_MESSAGE(this, PHPSE_INIT_NEW, 0, 0 TSRMLS_CC);
- return S_OK;
-}
-
-STDMETHODIMP TPHPScriptingEngine::AddScriptlet(
- /* [in] */ LPCOLESTR pstrDefaultName,
- /* [in] */ LPCOLESTR pstrCode,
- /* [in] */ LPCOLESTR pstrItemName,
- /* [in] */ LPCOLESTR pstrSubItemName,
- /* [in] */ LPCOLESTR pstrEventName,
- /* [in] */ LPCOLESTR pstrDelimiter,
- /* [in] */ DWORD dwSourceContextCookie,
- /* [in] */ ULONG ulStartingLineNumber,
- /* [in] */ DWORD dwFlags,
- /* [out] */ BSTR *pbstrName,
- /* [out] */ EXCEPINFO *pexcepinfo)
-{
- struct php_active_script_add_scriptlet_info info;
- TSRMLS_FETCH();
-
- info.pstrDefaultName = pstrDefaultName;
- info.pstrCode = pstrCode;
- info.pstrItemName = pstrItemName;
- info.pstrSubItemName = pstrSubItemName;
- info.pstrEventName = pstrEventName;
- info.pstrDelimiter = pstrDelimiter;
- info.dwSourceContextCookie = dwSourceContextCookie;
- info.ulStartingLineNumber = ulStartingLineNumber;
- info.dwFlags = dwFlags;
- info.pbstrName = pbstrName;
- info.pexcepinfo = pexcepinfo;
-
- return SEND_THREAD_MESSAGE(this, PHPSE_ADD_SCRIPTLET, 0, (LPARAM)&info TSRMLS_CC);
-}
-
-STDMETHODIMP TPHPScriptingEngine::ParseScriptText(
- /* [in] */ LPCOLESTR pstrCode,
- /* [in] */ LPCOLESTR pstrItemName,
- /* [in] */ IUnknown *punkContext,
- /* [in] */ LPCOLESTR pstrDelimiter,
- /* [in] */ DWORD dwSourceContextCookie,
- /* [in] */ ULONG ulStartingLineNumber,
- /* [in] */ DWORD dwFlags,
- /* [out] */ VARIANT *pvarResult,
- /* [out] */ EXCEPINFO *pexcepinfo)
-{
- struct php_active_script_parse_info info;
- TSRMLS_FETCH();
-
- info.pstrCode = pstrCode;
- info.pstrItemName = pstrItemName;
- info.punkContext = punkContext;
- info.pstrDelimiter = pstrDelimiter;
- info.dwSourceContextCookie = dwSourceContextCookie;
- info.ulStartingLineNumber = ulStartingLineNumber;
- info.dwFlags = dwFlags;
- info.pvarResult = pvarResult;
- info.pexcepinfo = pexcepinfo;
-
- return SEND_THREAD_MESSAGE(this, PHPSE_PARSE_SCRIPT, 0, (LPARAM)&info TSRMLS_CC);
-}
-
-STDMETHODIMP TPHPScriptingEngine::ParseProcedureText(
- /* [in] */ LPCOLESTR pstrCode,
- /* [in] */ LPCOLESTR pstrFormalParams,
- /* [in] */ LPCOLESTR pstrProcedureName,
- /* [in] */ LPCOLESTR pstrItemName,
- /* [in] */ IUnknown *punkContext,
- /* [in] */ LPCOLESTR pstrDelimiter,
- /* [in] */ DWORD dwSourceContextCookie,
- /* [in] */ ULONG ulStartingLineNumber,
- /* [in] */ DWORD dwFlags,
- /* [out] */ IDispatch **ppdisp)
-{
- struct php_active_script_parse_proc_info info;
- HRESULT ret;
- TSRMLS_FETCH();
-
- info.pstrCode = pstrCode;
- info.pstrFormalParams = pstrFormalParams;
- info.pstrProcedureName = pstrProcedureName;
- info.pstrItemName = pstrItemName;
- info.punkContext = punkContext;
- info.pstrDelimiter = pstrDelimiter;
- info.dwSourceContextCookie = dwSourceContextCookie;
- info.ulStartingLineNumber = ulStartingLineNumber;
- info.dwFlags = dwFlags;
-
- ret = SEND_THREAD_MESSAGE(this, PHPSE_PARSE_PROC, 0, (LPARAM)&info TSRMLS_CC);
-
- if (ret == S_OK)
- ret = GIT_get(info.dispcookie, IID_IDispatch, (void**)ppdisp);
-
- trace("ParseProc: ret=%08x disp=%08x\n", ret, *ppdisp);
- return ret;
-}
-
-extern "C"
-void activescript_error_func(int type, const char *error_msg, ...)
-{
- TSRMLS_FETCH();
-
- TPHPScriptingEngine *engine = (TPHPScriptingEngine*)SG(server_context);
-
-
-}
-
-class TActiveScriptError:
- public IActiveScriptError
-{
-protected:
- volatile LONG m_refcount;
-public:
- /* IUnknown */
- STDMETHODIMP QueryInterface(REFIID iid, void **ppvObject) {
- *ppvObject = NULL;
-
- if (IsEqualGUID(IID_IActiveScriptError, iid)) {
- *ppvObject = (IActiveScriptError*)this;
- } else if (IsEqualGUID(IID_IUnknown, iid)) {
- *ppvObject = this;
- }
- if (*ppvObject) {
- AddRef();
- return S_OK;
- }
- return E_NOINTERFACE;
- }
-
- STDMETHODIMP_(DWORD) AddRef(void) {
- return InterlockedIncrement(const_cast<long*> (&m_refcount));
- }
-
- STDMETHODIMP_(DWORD) Release(void) {
- DWORD ret = InterlockedDecrement(const_cast<long*> (&m_refcount));
- trace("Release: errobj refcount=%d\n", ret);
- if (ret == 0)
- delete this;
- return ret;
- }
-
- HRESULT STDMETHODCALLTYPE GetExceptionInfo(
- /* [out] */ EXCEPINFO *pexcepinfo)
- {
- memset(pexcepinfo, 0, sizeof(EXCEPINFO));
- pexcepinfo->bstrDescription = SysAllocString(m_message);
- pexcepinfo->bstrSource = SysAllocString(m_filename);
- pexcepinfo->wCode = 1000;
- return S_OK;
- }
-
- HRESULT STDMETHODCALLTYPE GetSourcePosition(
- /* [out] */ DWORD *pdwSourceContext,
- /* [out] */ ULONG *pulLineNumber,
- /* [out] */ LONG *plCharacterPosition)
- {
- *pdwSourceContext = 0;
- *pulLineNumber = m_lineno;
- *plCharacterPosition = 0;
- return S_OK;
- }
-
- HRESULT STDMETHODCALLTYPE GetSourceLineText(
- /* [out] */ BSTR *pbstrSourceLine)
- {
- *pbstrSourceLine = NULL;
- return E_FAIL;
- }
-
- BSTR m_filename, m_message;
- UINT m_lineno;
-
- TActiveScriptError(const char *filename, const uint lineno, const char *message)
- {
- m_refcount = 0; /* start with zero refcount because this object is passed
- * directly to the script site; it will call addref */
- m_filename = TWideString::bstr_from_ansi((char*)filename);
- m_message = TWideString::bstr_from_ansi((char*)message);
- m_lineno = lineno;
- }
-
- ~TActiveScriptError()
- {
- trace("%08x: cleaning up error object\n", this);
- SysFreeString(m_filename);
- SysFreeString(m_message);
- }
-};
-
-extern "C"
-void activescript_error_handler(int type, const char *error_filename,
- const uint error_lineno, const char *format, va_list args)
-{
- TSRMLS_FETCH();
- char *buf;
- int buflen;
- TPHPScriptingEngine *engine = (TPHPScriptingEngine*)SG(server_context);
-
- buflen = vspprintf(&buf, PG(log_errors_max_len), format, args);
- trace("%08x: Error: %s\n", engine, buf);
-
- /* if it's a fatal error, report it using IActiveScriptError. */
-
- switch(type) {
- case E_ERROR:
- case E_CORE_ERROR:
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- case E_PARSE:
- /* trigger an error in the host */
- TActiveScriptError *eobj = new TActiveScriptError(error_filename, error_lineno, buf);
- trace("raising error object!\n");
- if (engine->m_pass_eng)
- engine->m_pass_eng->OnScriptError(eobj);
-
- /* now throw the exception to abort execution */
- if (engine->m_err_trap)
- longjmp(*engine->m_err_trap, 1);
-
- break;
- }
- efree(buf);
-}
-
diff --git a/sapi/aolserver/CREDITS b/sapi/aolserver/CREDITS
deleted file mode 100644
index 8f9a4af950..0000000000
--- a/sapi/aolserver/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-AOLserver
-Sascha Schumann
diff --git a/sapi/aolserver/README b/sapi/aolserver/README
deleted file mode 100644
index 0a725a10bc..0000000000
--- a/sapi/aolserver/README
+++ /dev/null
@@ -1,69 +0,0 @@
-AOLserver README ($Id$)
-
-To compile PHP 4.0 as a module for AOLserver, you need:
-
-- installed AOLserver 3.1 or later
- (see the note below for AOLserver 3.0)
-
-NOTE: You should not use this module in production. PHP is not 100% stable
- yet in threaded mode. To increase reliability enable the Global Lock
- by removing #define NO_GLOBAL_LOCK in main/main.c. Also don't use
- php_value as it will lead to races in a sub-system (use an ini file
- instead).
-
-
-1.) Configuring AOLserver
-
-Read doc/install.txt in the source distribution
-
-It usually boils down to changing the INST/PREFIX variable in
-include/Makefile.global and running make all install.
-
-2.) Configuring PHP
-
-$ ./configure \
- --with-aolserver=/path/to/installed/aolserver \
- <other options>
-
-NOTE: If you are still using AOLserver 3.0, you need to retain the
- AOLserver source code and pass another option to PHP:
-
- --with-aolserver-src=/path/to/source/distribution
-
-3.) Compiling and Installing PHP
-
-$ make install
-
-4.) Changing nsd.tcl
-
-a) New section
-
-Add a new section to pass options to PHP (required):
-
-ns_section "ns/server/${servername}/module/php"
-
-You can use the following commands in this section:
-
-The 'map' command will cause AOLserver to pass all requests to *.php to
-the PHP module (can be specified multiple times). Example:
-
-ns_param map *.php
-
-The 'php_value "name val"' command assigns the configuration option name
-the value val (can be used multiple times). Example:
-
-ns_param php_value "session.auto_start 1"
-
-b) Enabling PHP
-
-Then enable the PHP module:
-
-ns_section "ns/server/${servername}/modules"
-...
-ns_param php ${bindir}/libphp4.so
-
-
-=============================================================================
-This has been tested with AOLserver release 3.0.
-
-AOLserver support has been written by Sascha Schumann <sascha@schumann.cx>.
diff --git a/sapi/aolserver/aolserver.c b/sapi/aolserver/aolserver.c
deleted file mode 100644
index 3f414b5ec7..0000000000
--- a/sapi/aolserver/aolserver.c
+++ /dev/null
@@ -1,616 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * TODO:
- * - write documentation
- * - CGI/1.1 conformance
- */
-
-/* $Id$ */
-
-/* conflict between PHP and AOLserver headers */
-#define Debug php_Debug
-#include "php.h"
-#undef Debug
-
-#ifdef HAVE_AOLSERVER
-
-#ifndef ZTS
-#error AOLserver module is only useable in thread-safe mode
-#endif
-
-#include "ext/standard/info.h"
-#define SECTION(name) PUTS("<h2>" name "</h2>\n")
-
-#define NS_BUF_SIZE 511
-
-#include "php_ini.h"
-#include "php_globals.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "php_variables.h"
-
-#include "ns.h"
-
-#include "php_version.h"
-
-/* This symbol is used by AOLserver to tell the API version we expect */
-
-int Ns_ModuleVersion = 1;
-
-#define NSG(v) TSRMG(ns_globals_id, ns_globals_struct *, v)
-
-/* php_ns_context is per-server (thus only once at all) */
-
-typedef struct {
- sapi_module_struct *sapi_module;
- char *ns_server;
- char *ns_module;
-} php_ns_context;
-
-/* ns_globals_struct is per-thread */
-
-typedef struct {
- Ns_Conn *conn;
- size_t data_avail;
-} ns_globals_struct;
-
-/* TSRM id */
-
-static int ns_globals_id;
-
-/* global context */
-
-static php_ns_context *global_context;
-
-static void php_ns_config(php_ns_context *ctx, char global);
-
-/*
- * php_ns_sapi_ub_write() writes data to the client connection.
- */
-
-static int
-php_ns_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- int n;
- uint sent = 0;
-
- while (str_length > 0) {
- n = Ns_ConnWrite(NSG(conn), (void *) str, str_length);
-
- if (n == -1)
- php_handle_aborted_connection();
-
- str += n;
- sent += n;
- str_length -= n;
- }
-
- return sent;
-}
-
-/*
- * php_ns_sapi_header_handler() sets a HTTP reply header to be
- * sent to the client.
- */
-
-static int
-php_ns_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- char *header_name, *header_content;
- char *p;
-
- header_name = sapi_header->header;
- header_content = p = strchr(header_name, ':');
-
- if (p) {
- *p = '\0';
- do {
- header_content++;
- } while (*header_content == ' ');
-
- if (!strcasecmp(header_name, "Content-type")) {
- Ns_ConnSetTypeHeader(NSG(conn), header_content);
- } else {
- Ns_ConnSetHeaders(NSG(conn), header_name, header_content);
- }
-
- *p = ':';
- }
-
- sapi_free_header(sapi_header);
-
- return 0;
-}
-
-/*
- * php_ns_sapi_send_headers() flushes the headers to the client.
- * Called before real content is sent by PHP.
- */
-
-static int
-php_ns_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- if(SG(sapi_headers).send_default_content_type) {
- Ns_ConnSetRequiredHeaders(NSG(conn), "text/html", 0);
- }
-
- Ns_ConnFlushHeaders(NSG(conn), SG(sapi_headers).http_response_code);
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-/*
- * php_ns_sapi_read_post() reads a specified number of bytes from
- * the client. Used for POST/PUT requests.
- */
-
-static int
-php_ns_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC)
-{
- uint max_read;
- uint total_read = 0;
-
- max_read = MIN(NSG(data_avail), count_bytes);
-
- total_read = Ns_ConnRead(NSG(conn), buf, max_read);
-
- if(total_read == NS_ERROR) {
- total_read = -1;
- } else {
- NSG(data_avail) -= total_read;
- }
-
- return total_read;
-}
-
-/*
- * php_ns_sapi_read_cookies() returns the Cookie header from
- * the HTTP request header
- */
-
-static char *php_ns_sapi_read_cookies(TSRMLS_D)
-{
- int i;
- char *http_cookie = NULL;
-
- i = Ns_SetIFind(NSG(conn->headers), "cookie");
- if(i != -1) {
- http_cookie = Ns_SetValue(NSG(conn->headers), i);
- }
-
- return http_cookie;
-}
-
-static void php_info_aolserver(ZEND_MODULE_INFO_FUNC_ARGS)
-{
- char buf[512];
- int uptime = Ns_InfoUptime();
- int i;
-
- php_info_print_table_start();
- php_info_print_table_row(2, "SAPI module version", "$Id$");
- php_info_print_table_row(2, "Build date", Ns_InfoBuildDate());
- php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile());
- php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog());
- php_info_print_table_row(2, "Installation path", Ns_InfoHomePath());
- php_info_print_table_row(2, "Hostname of server", Ns_InfoHostname());
- php_info_print_table_row(2, "Source code label", Ns_InfoLabel());
- php_info_print_table_row(2, "Server platform", Ns_InfoPlatform());
- snprintf(buf, 511, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion());
- php_info_print_table_row(2, "Server version", buf);
- snprintf(buf, 511, "%d day(s), %02d:%02d:%02d",
- uptime / 86400,
- (uptime / 3600) % 24,
- (uptime / 60) % 60,
- uptime % 60);
- php_info_print_table_row(2, "Server uptime", buf);
- php_info_print_table_end();
-
- SECTION("HTTP Headers Information");
- php_info_print_table_start();
- php_info_print_table_colspan_header(2, "HTTP Request Headers");
- php_info_print_table_row(2, "HTTP Request", NSG(conn)->request->line);
- for (i = 0; i < Ns_SetSize(NSG(conn)->headers); i++) {
- php_info_print_table_row(2, Ns_SetKey(NSG(conn)->headers, i), Ns_SetValue(NSG(conn)->headers, i));
- }
-
- php_info_print_table_colspan_header(2, "HTTP Response Headers");
- for (i = 0; i < Ns_SetSize(NSG(conn)->outputheaders); i++) {
- php_info_print_table_row(2, Ns_SetKey(NSG(conn)->outputheaders, i), Ns_SetValue(NSG(conn)->outputheaders, i));
- }
- php_info_print_table_end();
-}
-
-PHP_FUNCTION(getallheaders);
-
-static function_entry aolserver_functions[] = {
- PHP_FE(getallheaders, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_module_entry php_aolserver_module = {
- STANDARD_MODULE_HEADER,
- "AOLserver",
- aolserver_functions,
- NULL,
- NULL,
- NULL,
- NULL,
- php_info_aolserver,
- NULL,
- STANDARD_MODULE_PROPERTIES
-};
-
-PHP_FUNCTION(getallheaders)
-{
- int i;
-
- array_init(return_value);
-
- for (i = 0; i < Ns_SetSize(NSG(conn->headers)); i++) {
- char *key = Ns_SetKey(NSG(conn->headers), i);
- char *value = Ns_SetValue(NSG(conn->headers), i);
-
- add_assoc_string(return_value, key, value, 1);
- }
-}
-
-static int
-php_ns_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, &php_aolserver_module, 1) == FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-
-/*
- * php_ns_sapi_register_variables() populates the php script environment
- * with a number of variables. HTTP_* variables are created for
- * the HTTP header data, so that a script can access these.
- */
-
-#define ADD_STRINGX(name, buf) \
- php_register_variable(name, buf, track_vars_array TSRMLS_CC)
-
-#define ADD_STRING(name) \
- ADD_STRINGX(name, buf)
-
-static void
-php_ns_sapi_register_variables(zval *track_vars_array TSRMLS_DC)
-{
- int i;
- char buf[NS_BUF_SIZE + 1];
- char *tmp;
-
- for(i = 0; i < Ns_SetSize(NSG(conn->headers)); i++) {
- char *key = Ns_SetKey(NSG(conn->headers), i);
- char *value = Ns_SetValue(NSG(conn->headers), i);
- char *p;
- char c;
-
- snprintf(buf, NS_BUF_SIZE, "HTTP_%s", key);
-
- for(p = buf + 5; (c = *p); p++) {
- c = toupper(c);
- if(c < 'A' || c > 'Z') {
- c = '_';
- }
- *p = c;
- }
-
- ADD_STRINGX(buf, value);
- }
-
- snprintf(buf, NS_BUF_SIZE, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion());
- ADD_STRING("SERVER_SOFTWARE");
- snprintf(buf, NS_BUF_SIZE, "HTTP/%1.1f", NSG(conn)->request->version);
- ADD_STRING("SERVER_PROTOCOL");
-
- ADD_STRINGX("REQUEST_METHOD", NSG(conn)->request->method);
-
- if(NSG(conn)->request->query)
- ADD_STRINGX("QUERY_STRING", NSG(conn)->request->query);
-
- ADD_STRINGX("SERVER_BUILDDATE", Ns_InfoBuildDate());
-
- ADD_STRINGX("REMOTE_ADDR", Ns_ConnPeer(NSG(conn)));
-
- snprintf(buf, NS_BUF_SIZE, "%d", Ns_ConnPeerPort(NSG(conn)));
- ADD_STRING("REMOTE_PORT");
-
- snprintf(buf, NS_BUF_SIZE, "%d", Ns_ConnPort(NSG(conn)));
- ADD_STRING("SERVER_PORT");
-
- tmp = Ns_ConnHost(NSG(conn));
- if (tmp)
- ADD_STRINGX("SERVER_NAME", tmp);
-
- ADD_STRINGX("PATH_TRANSLATED", SG(request_info).path_translated);
- ADD_STRINGX("REQUEST_URI", SG(request_info).request_uri);
- ADD_STRINGX("PHP_SELF", SG(request_info).request_uri);
-
- ADD_STRINGX("GATEWAY_INTERFACE", "CGI/1.1");
-
- snprintf(buf, NS_BUF_SIZE, "%d", Ns_InfoBootTime());
- ADD_STRING("SERVER_BOOTTIME");
-}
-
-
-
-/* this structure is static (as in "it does not change") */
-
-static sapi_module_struct aolserver_sapi_module = {
- "aolserver",
- "AOLserver",
-
- php_ns_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- php_ns_sapi_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- php_ns_sapi_header_handler, /* header handler */
- php_ns_sapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- php_ns_sapi_read_post, /* read POST data */
- php_ns_sapi_read_cookies, /* read Cookies */
-
- php_ns_sapi_register_variables,
- NULL, /* Log message */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-/*
- * php_ns_module_main() is called by the per-request handler and
- * "executes" the script
- */
-
-static int
-php_ns_module_main(TSRMLS_D)
-{
- zend_file_handle file_handle;
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
- php_ns_config(global_context, 0);
- if (php_request_startup(TSRMLS_C) == FAILURE) {
- return NS_ERROR;
- }
-
- php_execute_script(&file_handle TSRMLS_CC);
- php_request_shutdown(NULL);
-
- return NS_OK;
-}
-
-/*
- * php_ns_request_ctor() initializes the per-request data structure
- * and fills it with data provided by the web server
- */
-
-static void
-php_ns_request_ctor(TSRMLS_D)
-{
- char *server;
- Ns_DString ds;
- char *root;
- int index;
- char *tmp;
-
- server = Ns_ConnServer(NSG(conn));
-
-#define safe_strdup(x) ((x)?strdup((x)):NULL)
- SG(request_info).query_string = safe_strdup(NSG(conn->request->query));
-
- Ns_DStringInit(&ds);
- Ns_UrlToFile(&ds, server, NSG(conn->request->url));
-
- /* path_translated is the absolute path to the file */
- SG(request_info).path_translated = safe_strdup(Ns_DStringValue(&ds));
- Ns_DStringFree(&ds);
- root = Ns_PageRoot(server);
- SG(request_info).request_uri = strdup(SG(request_info).path_translated + strlen(root));
- SG(request_info).request_method = NSG(conn)->request->method;
- SG(request_info).content_length = Ns_ConnContentLength(NSG(conn));
- index = Ns_SetIFind(NSG(conn)->headers, "content-type");
- SG(request_info).content_type = index == -1 ? NULL :
- Ns_SetValue(NSG(conn)->headers, index);
- SG(sapi_headers).http_response_code = 200;
-
- tmp = Ns_ConnAuthUser(NSG(conn));
- if (tmp)
- tmp = estrdup(tmp);
- SG(request_info).auth_user = tmp;
-
- tmp = Ns_ConnAuthPasswd(NSG(conn));
- if (tmp)
- tmp = estrdup(tmp);
- SG(request_info).auth_password = tmp;
-
- NSG(data_avail) = SG(request_info).content_length;
-}
-
-/*
- * php_ns_request_dtor() destroys all data associated with
- * the per-request structure
- */
-
-static void
-php_ns_request_dtor(TSRMLS_D)
-{
- free(SG(request_info).path_translated);
- if (SG(request_info).query_string)
- free(SG(request_info).query_string);
- free(SG(request_info).request_uri);
-}
-
-/*
- * The php_ns_request_handler() is called per request and handles
- * everything for one request.
- */
-
-static int
-php_ns_request_handler(void *context, Ns_Conn *conn)
-{
- int status = NS_OK;
- TSRMLS_FETCH();
-
- NSG(conn) = conn;
-
- SG(server_context) = global_context;
-
- php_ns_request_ctor(TSRMLS_C);
-
- status = php_ns_module_main(TSRMLS_C);
-
- php_ns_request_dtor(TSRMLS_C);
-
- return status;
-}
-
-/*
- * php_ns_config() fetches the configuration data.
- *
- * It understands the "map" and "php_value" command.
- */
-
-static void
-php_ns_config(php_ns_context *ctx, char global)
-{
- int i;
- char *path;
- Ns_Set *set;
-
- path = Ns_ConfigGetPath(ctx->ns_server, ctx->ns_module, NULL);
- set = Ns_ConfigGetSection(path);
-
- for (i = 0; set && i < Ns_SetSize(set); i++) {
- char *key = Ns_SetKey(set, i);
- char *value = Ns_SetValue(set, i);
-
- if (global && !strcasecmp(key, "map")) {
- Ns_Log(Notice, "Registering PHP for \"%s\"", value);
- Ns_RegisterRequest(ctx->ns_server, "GET", value, php_ns_request_handler, NULL, ctx, 0);
- Ns_RegisterRequest(ctx->ns_server, "POST", value, php_ns_request_handler, NULL, ctx, 0);
- Ns_RegisterRequest(ctx->ns_server, "HEAD", value, php_ns_request_handler, NULL, ctx, 0);
-
- /*
- * Deactivated for now. The ini system will cause random crashes when
- * accessed from here (since there are no locks to protect the global
- * known_directives)
- */
-
- } else if (!global && !strcasecmp(key, "php_value")) {
- Ns_Log(Notice, "php_value has been deactivated temporarily. Please use a php.ini file to pass directives to PHP. Thanks.");
-#if 0
- char *val;
-
- val = strchr(value, ' ');
- if (val) {
- char *new_key;
-
- new_key = estrndup(value, val - value);
-
- do {
- val++;
- } while(*val == ' ');
-
- Ns_Log(Debug, "PHP configuration option '%s=%s'", new_key, val);
- zend_alter_ini_entry(new_key, strlen(new_key) + 1, val,
- strlen(val) + 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME);
-
- efree(new_key);
- }
-#endif
- }
-
- }
-}
-
-/*
- * php_ns_server_shutdown() performs the last steps before the
- * server exits. Shutdowns basic services and frees memory
- */
-
-static void
-php_ns_server_shutdown(void *context)
-{
- php_ns_context *ctx = (php_ns_context *) context;
-
- ctx->sapi_module->shutdown(ctx->sapi_module);
- sapi_shutdown();
- tsrm_shutdown();
-
- free(ctx->ns_module);
- free(ctx->ns_server);
- free(ctx);
-}
-
-/*
- * Ns_ModuleInit() is called by AOLserver once at startup
- *
- * This functions allocates basic structures and initializes
- * basic services.
- */
-
-int Ns_ModuleInit(char *server, char *module)
-{
- php_ns_context *ctx;
-
- tsrm_startup(1, 1, 0, NULL);
- sapi_startup(&aolserver_sapi_module);
- sapi_module.startup(&aolserver_sapi_module);
-
- /* TSRM is used to allocate a per-thread structure */
- ts_allocate_id(&ns_globals_id, sizeof(ns_globals_struct), NULL, NULL);
-
- /* the context contains data valid for all threads */
- ctx = malloc(sizeof *ctx);
- ctx->sapi_module = &aolserver_sapi_module;
- ctx->ns_server = strdup(server);
- ctx->ns_module = strdup(module);
-
- /* read the configuration */
- php_ns_config(ctx, 1);
-
- global_context = ctx;
-
- /* register shutdown handler */
- Ns_RegisterServerShutdown(server, php_ns_server_shutdown, ctx);
-
- return NS_OK;
-}
-
-#endif
diff --git a/sapi/aolserver/config.m4 b/sapi/aolserver/config.m4
deleted file mode 100644
index 2c905af2cc..0000000000
--- a/sapi/aolserver/config.m4
+++ /dev/null
@@ -1,33 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_MSG_CHECKING(for AOLserver support)
-AC_ARG_WITH(aolserver,
-[ --with-aolserver=DIR Specify path to the installed AOLserver],[
- PHP_AOLSERVER=$withval
-],[
- PHP_AOLSERVER=no
-])
-AC_MSG_RESULT($PHP_AOLSERVER)
-
-if test "$PHP_AOLSERVER" != "no"; then
- if test -d "$PHP_AOLSERVER/include"; then
- PHP_AOLSERVER_SRC=$PHP_AOLSERVER
- fi
- if test -z "$PHP_AOLSERVER_SRC" || test ! -d $PHP_AOLSERVER_SRC/include; then
- AC_MSG_ERROR(Please specify the path to the source distribution of AOLserver using --with-aolserver-src=DIR)
- fi
- if test ! -d $PHP_AOLSERVER/bin ; then
- AC_MSG_ERROR(Please specify the path to the root of AOLserver using --with-aolserver=DIR)
- fi
- PHP_BUILD_THREAD_SAFE
- PHP_ADD_INCLUDE($PHP_AOLSERVER_SRC/include)
- AC_DEFINE(HAVE_AOLSERVER,1,[Whether you have AOLserver])
- PHP_SELECT_SAPI(aolserver, shared, aolserver.c)
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PHP_AOLSERVER/bin/"
-fi
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/aolserver/php.sym b/sapi/aolserver/php.sym
deleted file mode 100644
index b401ffd2b3..0000000000
--- a/sapi/aolserver/php.sym
+++ /dev/null
@@ -1,2 +0,0 @@
-Ns_ModuleVersion
-Ns_ModuleInit
diff --git a/sapi/aolserver/php4aolserver.dsp b/sapi/aolserver/php4aolserver.dsp
deleted file mode 100644
index 1d5a79598c..0000000000
--- a/sapi/aolserver/php4aolserver.dsp
+++ /dev/null
@@ -1,135 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4aolserver" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4aolserver - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4aolserver.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4aolserver.mak" CFG="php4aolserver - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4aolserver - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4aolserver - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4aolserver - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4aolserver - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4AOLSERVER_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D ZEND_DEBUG=0 /D "NDEBUG" /D "PHP4AOLSERVER_EXPORTS" /D "PHP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /D "HAVE_AOLSERVER" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 nsd.lib php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /machine:I386 /out:"../../Release_TS/php4aolserver.so" /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4aolserver - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS_inline"
-# PROP BASE Intermediate_Dir "Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4AOLSERVER_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "PHPAOLSERVER_EXPORTS" /D "PHP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /D "HAVE_AOLSERVER" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 nsd.lib php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /machine:I386 /out:"../../Release_TS_inline/php4aolserver.so" /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4aolserver - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4AOLSERVER_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP4AOLSERVER_EXPORTS" /D "PHP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /D "HAVE_AOLSERVER" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 nsd.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /debug /machine:I386 /out:"..\..\Debug_TS/php4aolserver.so" /pdbtype:sept /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4aolserver - Win32 Release_TS"
-# Name "php4aolserver - Win32 Release_TS_inline"
-# Name "php4aolserver - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\aolserver.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/sapi/apache/CREDITS b/sapi/apache/CREDITS
deleted file mode 100644
index 991deb5633..0000000000
--- a/sapi/apache/CREDITS
+++ /dev/null
@@ -1,3 +0,0 @@
-Apache 1.3
-Rasmus Lerdorf, Zeev Suraski, Stig Bakken, David Sklar
-
diff --git a/sapi/apache/apMakefile.libdir b/sapi/apache/apMakefile.libdir
deleted file mode 100644
index 7b5254013a..0000000000
--- a/sapi/apache/apMakefile.libdir
+++ /dev/null
@@ -1,4 +0,0 @@
-This is a place-holder which indicates to Configure that it shouldn't
-provide the default targets when building the Makefile in this directory.
-Instead it'll just prepend all the important variable definitions, and
-copy the Makefile.tmpl onto the end.
diff --git a/sapi/apache/apMakefile.tmpl b/sapi/apache/apMakefile.tmpl
deleted file mode 100644
index 5f77d9c9c9..0000000000
--- a/sapi/apache/apMakefile.tmpl
+++ /dev/null
@@ -1,77 +0,0 @@
-##
-## Apache 1.3 Makefile template for PHP 5.0 Module
-## [src/modules/php5/Makefile.tmpl]
-##
-
-# the parametrized target
-LIB=libphp5.$(LIBEXT)
-
-# objects for building the static library
-OBJS=mod_php5.o
-OBJS_LIB=libmodphp5.a
-
-# objects for building the shared object library
-SHLIB_OBJS=mod_php5.so-o
-SHLIB_OBJS_LIB=libmodphp5.a
-
-# the general targets
-all: lib
-lib: $(LIB)
-
-# build the static library by merging the object files
-libphp5.a: $(OBJS) $(OBJS_LIB)
- cp $(OBJS_LIB) $@
- ar r $@ $(OBJS)
- $(RANLIB) $@
-
-# ugly hack to support older Apache-1.3 betas that don't set $LIBEXT
-libphp5.: $(OBJS) $(OBJS_LIB)
- cp $(OBJS_LIB) $@
- ar r $@ $(OBJS)
- $(RANLIB) $@
- cp libphp5. libphp5.a
-
-# build the shared object library by linking the object files
-libphp5.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
- rm -f $@
- $(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS) $(PHP_LIBS)
-
-# 1. extension .o for shared objects cannot be used here because
-# first these files aren't still shared objects and second we
-# have to use a different name to trigger the different
-# implicit Make rule
-# 2. extension -so.o (as used elsewhere) cannot be used because
-# the suffix feature of Make really wants just .x, so we use
-# extension .so-o
-.SUFFIXES: .o .so-o
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(PHP_CFLAGS) $(CPPFLAGS) $(SPACER) $<
-.c.so-o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $(PHP_CFLAGS) $(CPPFLAGS) $(SPACER) $< && mv $*.o $*.so-o
-
-# cleanup
-clean:
- -rm -f $(OBJS) $(SHLIB_OBJS) $(LIB)
-
-# We really don't expect end users to use this rule. It works only with
-# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after
-# using it.
-depend:
- cp Makefile.tmpl Makefile.tmpl.bak \
- && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
- && gcc -MM $(INCLUDES) $(CFLAGS) $(PHP_CFLAGS) $(CPPFLAGS) *.c >> Makefile.new \
- && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' Makefile.new \
- > Makefile.tmpl \
- && rm Makefile.new
-
-#Dependencies
-
-$(OBJS): Makefile
-
-# DO NOT REMOVE
-mod_php5.o: mod_php5.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
- $(INCDIR)/buff.h \
- $(INCDIR)/http_config.h \
- $(INCDIR)/http_core.h $(INCDIR)/http_main.h \
- $(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \
- $(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php5.h
diff --git a/sapi/apache/config.m4 b/sapi/apache/config.m4
deleted file mode 100644
index 2d95309f61..0000000000
--- a/sapi/apache/config.m4
+++ /dev/null
@@ -1,272 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_MSG_CHECKING(for Apache 1.x module support via DSO through APXS)
-AC_ARG_WITH(apxs,
-[ --with-apxs[=FILE] Build shared Apache 1.x module. FILE is the optional
- pathname to the Apache apxs tool; defaults to "apxs".],[
- if test "$withval" = "yes"; then
- APXS=apxs
- $APXS -q CFLAGS >/dev/null 2>&1
- if test "$?" != "0" && test -x /usr/sbin/apxs; then #SUSE 6.x
- APXS=/usr/sbin/apxs
- fi
- else
- PHP_EXPAND_PATH($withval, APXS)
- fi
-
- $APXS -q CFLAGS >/dev/null 2>&1
- if test "$?" != "0"; then
- AC_MSG_RESULT()
- AC_MSG_RESULT()
- AC_MSG_RESULT([Sorry, I was not able to successfully run APXS. Possible reasons:])
- AC_MSG_RESULT()
- AC_MSG_RESULT([1. Perl is not installed;])
- AC_MSG_RESULT([2. Apache was not compiled with DSO support (--enable-module=so);])
- AC_MSG_RESULT([3. 'apxs' is not in your path. Try to use --with-apxs=/path/to/apxs])
- AC_MSG_RESULT([The output of $APXS follows])
- $APXS
- AC_MSG_ERROR([Aborting])
- fi
-
- APXS_LDFLAGS="@SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@"
- APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR`
- APXS_CFLAGS=`$APXS -q CFLAGS`
- APXS_HTTPD=`$APXS -q SBINDIR`/`$APXS -q TARGET`
- APACHE_INCLUDE=-I$APXS_INCLUDEDIR
-
- # Test that we're trying to configure with apache 1.x
- PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
- if test "$APACHE_VERSION" -ge 2000000; then
- AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropiate switch --with-apxs2])
- fi
-
- for flag in $APXS_CFLAGS; do
- case $flag in
- -D*) APACHE_CPPFLAGS="$APACHE_CPPFLAGS $flag";;
- esac
- done
-
- case $host_alias in
- *aix*)
- APXS_LIBEXECDIR=`$APXS -q LIBEXECDIR`
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-brtl -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp"
- PHP_AIX_LDFLAGS="-Wl,-brtl"
- build_type=shared
- ;;
- *darwin*)
- MH_BUNDLE_FLAGS="-dynamic -twolevel_namespace -bundle -bundle_loader $APXS_HTTPD"
- PHP_SUBST(MH_BUNDLE_FLAGS)
- SAPI_SHARED=libs/libphp5.so
- build_type=bundle
- ;;
- *)
- build_type=shared
- ;;
- esac
-
- PHP_SELECT_SAPI(apache, $build_type, sapi_apache.c mod_php5.c php_apache.c, $APACHE_CPPFLAGS -I$APXS_INCLUDEDIR)
-
- # Test whether apxs support -S option
- $APXS -q -S CFLAGS="$APXS_CFLAGS" CFLAGS >/dev/null 2>&1
-
- if test "$?" != "0"; then
- APACHE_INSTALL="$APXS -i -a -n php5 $SAPI_SHARED" # Old apxs does not have -S option
- else
- APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
- if test -z `$APXS -q SYSCONFDIR`; then
- APACHE_INSTALL="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
- $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
- -i -n php5 $SAPI_SHARED"
- else
- APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
- APACHE_INSTALL="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
- \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
- $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
- -S SYSCONFDIR='$APXS_SYSCONFDIR' \
- -i -a -n php5 $SAPI_SHARED"
- fi
- fi
-
- if test -z "`$APXS -q LD_SHLIB`" || test "`$APXS -q LIBEXECDIR`" = "modules"; then
- PHP_APXS_BROKEN=yes
- fi
- STRONGHOLD=
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- AC_DEFINE(HAVE_APACHE,1,[ ])
- AC_MSG_RESULT(yes)
-],[
- AC_MSG_RESULT(no)
-])
-
-if test "$PHP_SAPI" != "apache"; then
-AC_MSG_CHECKING(for Apache 1.x module support)
-AC_ARG_WITH(apache,
-[ --with-apache[=DIR] Build Apache 1.x module. DIR is the top-level Apache
- build directory, defaults to /usr/local/apache.],[
-
- APACHE_INSTALL_FILES="\$(srcdir)/sapi/apache/mod_php5.* sapi/apache/libphp5.module"
-
- if test "$withval" = "yes"; then
- # Apache's default directory
- withval=/usr/local/apache
- fi
- if test "$withval" != "no"; then
- AC_DEFINE(HAVE_APACHE,1,[ ])
- APACHE_MODULE=yes
- PHP_EXPAND_PATH($withval, withval)
- # For Apache 1.2.x
- if test -f $withval/src/httpd.h; then
- APACHE_INCLUDE=-I$withval/src
- APACHE_TARGET=$withval/src
- PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_INSTALL_FILES $APACHE_TARGET"
- PHP_LIBS="-L. -lphp3"
- AC_MSG_RESULT(yes - Apache 1.2.x)
- STRONGHOLD=
- if test -f $withval/src/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- # For Apache 2.0.x
- elif test -f $withval/include/httpd.h &&
- test -f $withval/srclib/apr/include/apr_general.h ; then
- AC_MSG_ERROR([Use --with-apache2 with Apache 2.x!])
- # For Apache 1.3.x
- elif test -f $withval/src/main/httpd.h; then
- APACHE_HAS_REGEX=1
- APACHE_INCLUDE="-I$withval/src/main -I$withval/src/os/unix -I$withval/src/ap"
- APACHE_TARGET=$withval/src/modules/php5
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
- AC_MSG_RESULT(yes - Apache 1.3.x)
- STRONGHOLD=
- if test -f $withval/src/include/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
- fi
- # Also for Apache 1.3.x
- elif test -f $withval/src/include/httpd.h; then
- APACHE_HAS_REGEX=1
- APACHE_INCLUDE="-I$withval/src/include -I$withval/src/os/unix"
- APACHE_TARGET=$withval/src/modules/php5
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- AC_MSG_RESULT(yes - Apache 1.3.x)
- STRONGHOLD=
- if test -f $withval/src/include/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
- fi
- # For StrongHold 2.2
- elif test -f $withval/apache/httpd.h; then
- APACHE_INCLUDE=-"I$withval/apache -I$withval/ssl/include"
- APACHE_TARGET=$withval/apache
- PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET"
- STRONGHOLD=-DSTRONGHOLD=1
- AC_MSG_RESULT(yes - StrongHold)
- if test -f $withval/apache/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- if test -f $withval/src/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
- fi
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Invalid Apache directory - unable to find httpd.h under $withval)
- fi
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-
-fi
-
-if test "x$APXS" != "x" -a "`uname -sv`" = "AIX 4" -a "$GCC" != "yes"; then
- APXS_EXP=-bE:sapi/apache/mod_php5.exp
-fi
-
-PHP_SUBST(APXS_EXP)
-PHP_SUBST(APACHE_INCLUDE)
-PHP_SUBST(APACHE_TARGET)
-PHP_SUBST(APXS)
-PHP_SUBST(APXS_LDFLAGS)
-PHP_SUBST(APACHE_INSTALL)
-PHP_SUBST(STRONGHOLD)
-
-AC_CACHE_CHECK([for member fd in BUFF *],ac_cv_php_fd_in_buff,[
- save=$CPPFLAGS
- if test -n "$APXS_INCLUDEDIR"; then
- CPPFLAGS="$CPPFLAGS -I$APXS_INCLUDEDIR"
- else
- CPPFLAGS="$CPPFLAGS $APACHE_INCLUDE"
- fi
- AC_TRY_COMPILE([#include <httpd.h>],[conn_rec *c; int fd = c->client->fd;],[
- ac_cv_php_fd_in_buff=yes],[ac_cv_php_fd_in_buff=no],[ac_cv_php_fd_in_buff=no])
- CPPFLAGS=$save
-])
-if test "$ac_cv_php_fd_in_buff" = "yes"; then
- AC_DEFINE(PHP_APACHE_HAVE_CLIENT_FD,1,[ ])
-fi
-
-AC_MSG_CHECKING(for mod_charset compatibility option)
-AC_ARG_WITH(mod_charset,
-[ --with-mod_charset Enable transfer tables for mod_charset (Rus Apache).],
-[
- AC_MSG_RESULT(yes)
- AC_DEFINE(USE_TRANSFER_TABLES,1,[ ])
-],[
- AC_MSG_RESULT(no)
-])
-
-if test -n "$APACHE_MODULE"; then
- PHP_TARGET_RDYNAMIC
- $php_shtool mkdir -p sapi/apache
- PHP_OUTPUT(sapi/apache/libphp5.module)
-fi
-
-if test -n "$APACHE_INSTALL"; then
- INSTALL_IT=$APACHE_INSTALL
-fi
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/apache/libphp5.module.in b/sapi/apache/libphp5.module.in
deleted file mode 100644
index 00d9c49f40..0000000000
--- a/sapi/apache/libphp5.module.in
+++ /dev/null
@@ -1,11 +0,0 @@
-Name: php5_module
-ConfigStart
- RULE_WANTHSREGEX=no
- RULE_HIDE=yes
- PHP_LIBS="@NATIVE_RPATHS@ @PHP_LDFLAGS@ @PHP_LIBS@ @EXTRA_LDFLAGS@ @EXTRA_LIBS@ $LIBS"
- PHP_CFLAGS="$CFLAGS @OPENSSL_INCDIR_OPT@ -I@php_abs_top_builddir@/main -I@php_abs_top_builddir@/Zend -I@php_abs_top_builddir@/TSRM -I@php_abs_top_srcdir@ -I@php_abs_top_srcdir@/sapi/apache -I@php_abs_top_srcdir@/main -I@php_abs_top_srcdir@/Zend -I@php_abs_top_srcdir@/TSRM"
- my_outfile="Makefile.config"
- echo "PHP_CFLAGS=$PHP_CFLAGS" >>$my_outfile
- echo "PHP_LIBS=$PHP_LIBS" >>$my_outfile
- LIBS=$PHP_LIBS
-ConfigEnd
diff --git a/sapi/apache/libpre.c b/sapi/apache/libpre.c
deleted file mode 100644
index 0692cb5410..0000000000
--- a/sapi/apache/libpre.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef NETWARE
-
-/* ------------------------------------------------------------------
- * These functions are to be called when the shared NLM starts and
- * stops. By using these functions instead of defining a main()
- * and calling ExitThread(TSR_THREAD, 0), the load time of the
- * shared NLM is faster and memory size reduced.
- *
- * You may also want to override these in your own Apache module
- * to do any cleanup other than the mechanism Apache modules provide.
- * ------------------------------------------------------------------
- */
-
-
-#ifdef __GNUC__
-#include <string.h> /* memset */
-extern char _edata, _end ; /* end of DATA (start of BSS), end of BSS */
-#endif
-
-int _lib_start()
-{
-/* printf("Inside _lib_start\n");*/
-#ifdef __GNUC__
- memset (&_edata, 0, &_end - &_edata);
-#endif
- return 0;
-}
-
-int _lib_stop()
-{
-/* printf("Inside _lib_stop\n");*/
- return 0;
-}
-
-#endif /* NETWARE */
diff --git a/sapi/apache/mod_php5.c b/sapi/apache/mod_php5.c
deleted file mode 100644
index 6a32db9e07..0000000000
--- a/sapi/apache/mod_php5.c
+++ /dev/null
@@ -1,966 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
- | PHP 4.0 patches by Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php_apache_http.h"
-#include "http_conf_globals.h"
-
-#ifdef NETWARE
-#define SIGPIPE SIGINT
-#endif
-
-#if defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING)
-#include "ext/mbstring/mbstring.h"
-#endif /* defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) */
-
-#undef shutdown
-
-/* {{{ Prototypes
- */
-int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC);
-static void php_save_umask(void);
-static void php_restore_umask(void);
-static int sapi_apache_read_post(char *buffer, uint count_bytes TSRMLS_DC);
-static char *sapi_apache_read_cookies(TSRMLS_D);
-static int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC);
-static int sapi_apache_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC);
-static int send_php(request_rec *r, int display_source_mode, char *filename);
-static int send_parsed_php(request_rec * r);
-static int send_parsed_php_source(request_rec * r);
-static int php_xbithack_handler(request_rec * r);
-static void php_init_handler(server_rec *s, pool *p);
-/* }}} */
-
-#if MODULE_MAGIC_NUMBER >= 19970728
-static void php_child_exit_handler(server_rec *s, pool *p);
-#endif
-
-#if MODULE_MAGIC_NUMBER > 19961007
-#define CONST_PREFIX const
-#else
-#define CONST_PREFIX
-#endif
-static CONST_PREFIX char *php_apache_value_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode);
-static CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2);
-static CONST_PREFIX char *php_apache_admin_value_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2);
-static CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2);
-static CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode);
-static CONST_PREFIX char *php_apache_admin_flag_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2);
-
-/* ### these should be defined in mod_php5.h or somewhere else */
-#define USE_PATH 1
-#define IGNORE_URL 2
-
-module MODULE_VAR_EXPORT php5_module;
-
-int saved_umask;
-static unsigned char apache_php_initialized;
-
-typedef struct _php_per_dir_entry {
- char *key;
- char *value;
- uint key_length;
- uint value_length;
- int type;
-} php_per_dir_entry;
-
-/* some systems are missing these from their header files */
-
-/* {{{ php_save_umask
- */
-static void php_save_umask(void)
-{
- saved_umask = umask(077);
- umask(saved_umask);
-}
-/* }}} */
-
-/* {{{ sapi_apache_ub_write
- */
-static int sapi_apache_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- int ret=0;
-
- if (SG(server_context)) {
- ret = rwrite(str, str_length, (request_rec *) SG(server_context));
- }
- if (ret != str_length) {
- php_handle_aborted_connection();
- }
- return ret;
-}
-/* }}} */
-
-/* {{{ sapi_apache_flush
- */
-static void sapi_apache_flush(void *server_context)
-{
- if (server_context) {
-#if MODULE_MAGIC_NUMBER > 19970110
- rflush((request_rec *) server_context);
-#else
- bflush((request_rec *) server_context->connection->client);
-#endif
- }
-}
-/* }}} */
-
-/* {{{ sapi_apache_read_post
- */
-static int sapi_apache_read_post(char *buffer, uint count_bytes TSRMLS_DC)
-{
- uint total_read_bytes=0, read_bytes;
- request_rec *r = (request_rec *) SG(server_context);
- void (*handler)(int);
-
- /*
- * This handles the situation where the browser sends a Expect: 100-continue header
- * and needs to recieve confirmation from the server on whether or not it can send
- * the rest of the request. RFC 2616
- *
- */
- if (!SG(read_post_bytes) && !ap_should_client_block(r)) {
- return total_read_bytes;
- }
-
- handler = signal(SIGPIPE, SIG_IGN);
- while (total_read_bytes<count_bytes) {
- hard_timeout("Read POST information", r); /* start timeout timer */
- read_bytes = get_client_block(r, buffer+total_read_bytes, count_bytes-total_read_bytes);
- reset_timeout(r);
- if (read_bytes<=0) {
- break;
- }
- total_read_bytes += read_bytes;
- }
- signal(SIGPIPE, handler);
- return total_read_bytes;
-}
-/* }}} */
-
-/* {{{ sapi_apache_read_cookies
- */
-static char *sapi_apache_read_cookies(TSRMLS_D)
-{
- return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, "HTTP_COOKIE");
-}
-/* }}} */
-
-/* {{{ sapi_apache_header_handler
- */
-static int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- char *header_name, *header_content, *p;
- request_rec *r = (request_rec *) SG(server_context);
- if(!r) {
- efree(sapi_header->header);
- return 0;
- }
-
- header_name = sapi_header->header;
-
- header_content = p = strchr(header_name, ':');
- if (!p) {
- efree(sapi_header->header);
- return 0;
- }
-
- *p = 0;
- do {
- header_content++;
- } while (*header_content==' ');
-
- if (!strcasecmp(header_name, "Content-Type")) {
- r->content_type = pstrdup(r->pool, header_content);
- } else if (!strcasecmp(header_name, "Set-Cookie")) {
- table_add(r->headers_out, header_name, header_content);
- } else if (sapi_header->replace) {
- table_set(r->headers_out, header_name, header_content);
- } else {
- table_add(r->headers_out, header_name, header_content);
- }
-
- *p = ':'; /* a well behaved header handler shouldn't change its original arguments */
-
- efree(sapi_header->header);
-
- return 0; /* don't use the default SAPI mechanism, Apache duplicates this functionality */
-}
-/* }}} */
-
-/* {{{ sapi_apache_send_headers
- */
-static int sapi_apache_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- if(SG(server_context) == NULL) { /* server_context is not here anymore */
- return SAPI_HEADER_SEND_FAILED;
- }
-
- ((request_rec *) SG(server_context))->status = SG(sapi_headers).http_response_code;
- send_http_header((request_rec *) SG(server_context));
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-/* }}} */
-
-/* {{{ sapi_apache_register_server_variables
- */
-static void sapi_apache_register_server_variables(zval *track_vars_array TSRMLS_DC)
-{
- register int i;
- array_header *arr = table_elts(((request_rec *) SG(server_context))->subprocess_env);
- table_entry *elts = (table_entry *) arr->elts;
- zval **path_translated;
- HashTable *symbol_table;
-
- for (i = 0; i < arr->nelts; i++) {
- char *val;
-
- if (elts[i].val) {
- val = elts[i].val;
- } else {
- val = empty_string;
- }
- php_register_variable(elts[i].key, val, track_vars_array TSRMLS_CC);
- }
-
- /* If PATH_TRANSLATED doesn't exist, copy it from SCRIPT_FILENAME */
- if (track_vars_array) {
- symbol_table = track_vars_array->value.ht;
- } else if (PG(register_globals)) {
- /* should never happen nowadays */
- symbol_table = EG(active_symbol_table);
- } else {
- symbol_table = NULL;
- }
- if (symbol_table
- && !zend_hash_exists(symbol_table, "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"))
- && zend_hash_find(symbol_table, "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &path_translated)==SUCCESS) {
- php_register_variable("PATH_TRANSLATED", Z_STRVAL_PP(path_translated), track_vars_array TSRMLS_CC);
- }
-
- php_register_variable("PHP_SELF", ((request_rec *) SG(server_context))->uri, track_vars_array TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ php_apache_startup
- */
-static int php_apache_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, &apache_module_entry, 1) == FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-/* }}} */
-
-/* {{{ php_apache_log_message
- */
-static void php_apache_log_message(char *message)
-{
- TSRMLS_FETCH();
-
- if (SG(server_context)) {
-#if MODULE_MAGIC_NUMBER >= 19970831
- aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, ((request_rec *) SG(server_context))->server, "%s", message);
-#else
- log_error(message, ((request_rec *) SG(server_context))->server);
-#endif
- } else {
- fprintf(stderr, "%s", message);
- fprintf(stderr, "\n");
- }
-}
-/* }}} */
-
-/* {{{ php_apache_request_shutdown
- */
-static void php_apache_request_shutdown(void *dummy)
-{
- TSRMLS_FETCH();
-
- php_output_set_status(0 TSRMLS_CC);
- if (AP(in_request)) {
- AP(in_request) = 0;
- php_request_shutdown(dummy);
- }
- SG(server_context) = NULL;
- /*
- * The server context (request) is NOT invalid by the time
- * run_cleanups() is called
- */
-}
-/* }}} */
-
-/* {{{ php_apache_sapi_activate
- */
-static int php_apache_sapi_activate(TSRMLS_D)
-{
- request_rec *r = (request_rec *) SG(server_context);
-
- /*
- * For the Apache module version, this bit of code registers a cleanup
- * function that gets triggered when our request pool is destroyed.
- * We need this because at any point in our code we can be interrupted
- * and that may happen before we have had time to free our memory.
- * The php_request_shutdown function needs to free all outstanding allocated
- * memory.
- */
- block_alarms();
- register_cleanup(r->pool, NULL, php_apache_request_shutdown, php_request_shutdown_for_exec);
- AP(in_request)=1;
- unblock_alarms();
-
- /* Override the default headers_only value - sometimes "GET" requests should actually only
- * send headers.
- */
- SG(request_info).headers_only = r->header_only;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_apache_get_stat
- */
-static struct stat *php_apache_get_stat(TSRMLS_D)
-{
- return &((request_rec *) SG(server_context))->finfo;
-}
-/* }}} */
-
-/* {{{ php_apache_getenv
- */
-static char *php_apache_getenv(char *name, size_t name_len TSRMLS_DC)
-{
- return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, name);
-}
-/* }}} */
-
-/* {{{ sapi_apache_get_fd
- */
-static int sapi_apache_get_fd(int *nfd TSRMLS_DC)
-{
-#if PHP_APACHE_HAVE_CLIENT_FD
- request_rec *r = SG(server_context);
- int fd;
-
- fd = r->connection->client->fd;
-
- if (fd >= 0) {
- if (nfd) *nfd = fd;
- return SUCCESS;
- }
-#endif
- return FAILURE;
-}
-/* }}} */
-
-/* {{{ sapi_apache_force_http_10
- */
-static int sapi_apache_force_http_10(TSRMLS_D)
-{
- request_rec *r = SG(server_context);
-
- r->proto_num = HTTP_VERSION(1,0);
-
- return SUCCESS;
-}
-
-/* {{{ sapi_apache_get_target_uid
- */
-static int sapi_apache_get_target_uid(uid_t *obj TSRMLS_DC)
-{
- *obj = ap_user_id;
- return SUCCESS;
-}
-
-/* {{{ sapi_apache_get_target_gid
- */
-static int sapi_apache_get_target_gid(gid_t *obj TSRMLS_DC)
-{
- *obj = ap_group_id;
- return SUCCESS;
-}
-
-/* {{{ sapi_module_struct apache_sapi_module
- */
-static sapi_module_struct apache_sapi_module = {
- "apache", /* name */
- "Apache", /* pretty name */
-
- php_apache_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- php_apache_sapi_activate, /* activate */
- NULL, /* deactivate */
-
- sapi_apache_ub_write, /* unbuffered write */
- sapi_apache_flush, /* flush */
- php_apache_get_stat, /* get uid */
- php_apache_getenv, /* getenv */
-
- php_error, /* error handler */
-
- sapi_apache_header_handler, /* header handler */
- sapi_apache_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- sapi_apache_read_post, /* read POST data */
- sapi_apache_read_cookies, /* read Cookies */
-
- sapi_apache_register_server_variables, /* register server variables */
- php_apache_log_message, /* Log message */
-
- NULL, /* php.ini path override */
-
-#ifdef PHP_WIN32
- NULL,
- NULL,
-#else
- block_alarms, /* Block interruptions */
- unblock_alarms, /* Unblock interruptions */
-#endif
-
- NULL, /* default post reader */
- NULL, /* treat data */
- NULL, /* exe location */
- 0, /* ini ignore */
- sapi_apache_get_fd,
- sapi_apache_force_http_10,
- sapi_apache_get_target_uid,
- sapi_apache_get_target_gid
-};
-/* }}} */
-
-/* {{{ php_restore_umask
- */
-static void php_restore_umask(void)
-{
- umask(saved_umask);
-}
-/* }}} */
-
-/* {{{ init_request_info
- */
-static void init_request_info(TSRMLS_D)
-{
- request_rec *r = ((request_rec *) SG(server_context));
- char *content_length = (char *) table_get(r->subprocess_env, "CONTENT_LENGTH");
- const char *authorization=NULL;
- char *tmp;
-
- SG(request_info).query_string = r->args;
- SG(request_info).path_translated = r->filename;
- SG(request_info).request_uri = r->uri;
- SG(request_info).request_method = (char *)r->method;
- SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
- SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
- SG(sapi_headers).http_response_code = r->status;
-
- if (r->headers_in) {
- authorization = table_get(r->headers_in, "Authorization");
- }
- if (authorization
- && (!PG(safe_mode) || (PG(safe_mode) && !auth_type(r)))
- && !strcasecmp(getword(r->pool, &authorization, ' '), "Basic")) {
- tmp = uudecode(r->pool, authorization);
- SG(request_info).auth_user = getword_nulls_nc(r->pool, &tmp, ':');
- if (SG(request_info).auth_user) {
- r->connection->user = pstrdup(r->connection->pool, SG(request_info).auth_user);
- r->connection->ap_auth_type = "Basic";
- SG(request_info).auth_user = estrdup(SG(request_info).auth_user);
- }
- SG(request_info).auth_password = tmp;
- if (SG(request_info).auth_password) {
- SG(request_info).auth_password = estrdup(SG(request_info).auth_password);
- }
- } else {
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
- }
-}
-/* }}} */
-
-/* {{{ php_apache_alter_ini_entries
- */
-static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry TSRMLS_DC)
-{
- zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE);
- return 0;
-}
-/* }}} */
-
-/* {{{ php_apache_get_default_mimetype
- */
-static char *php_apache_get_default_mimetype(request_rec *r TSRMLS_DC)
-{
-
- char *mimetype;
- if (SG(default_mimetype) || SG(default_charset)) {
- /* Assume output will be of the default MIME type. Individual
- scripts may change this later. */
- char *tmpmimetype;
- tmpmimetype = sapi_get_default_content_type(TSRMLS_C);
- mimetype = pstrdup(r->pool, tmpmimetype);
- efree(tmpmimetype);
- } else {
- mimetype = SAPI_DEFAULT_MIMETYPE "; charset=" SAPI_DEFAULT_CHARSET;
- }
- return mimetype;
-}
-/* }}} */
-
-/* {{{ send_php
- */
-static int send_php(request_rec *r, int display_source_mode, char *filename)
-{
- int retval;
- HashTable *per_dir_conf;
- TSRMLS_FETCH();
-
- if (AP(in_request)) {
- zend_file_handle fh;
-
- fh.filename = r->filename;
- fh.opened_path = NULL;
- fh.free_filename = 0;
- fh.type = ZEND_HANDLE_FILENAME;
-
-#if defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING)
- php_mb_set_zend_encoding(TSRMLS_C);
-#endif /* defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) */
-
- zend_execute_scripts(ZEND_INCLUDE TSRMLS_CC, NULL, 1, &fh);
- return OK;
- }
-
- zend_first_try {
-
- /* Make sure file exists */
- if (filename == NULL && r->finfo.st_mode == 0) {
- return DECLINED;
- }
-
- per_dir_conf = (HashTable *) get_module_config(r->per_dir_config, &php5_module);
- if (per_dir_conf) {
- zend_hash_apply((HashTable *) per_dir_conf, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC);
- }
-
- /* If PHP parser engine has been turned off with an "engine off"
- * directive, then decline to handle this request
- */
- if (!AP(engine)) {
- r->content_type = php_apache_get_default_mimetype(r TSRMLS_CC);
- r->allowed |= (1 << METHODS) - 1;
- zend_try {
- zend_ini_deactivate(TSRMLS_C);
- } zend_end_try();
- return DECLINED;
- }
- if (filename == NULL) {
- filename = r->filename;
- }
-
- /* Apache 1.2 has a more complex mechanism for reading POST data */
-#if MODULE_MAGIC_NUMBER > 19961007
- if ((retval = setup_client_block(r, REQUEST_CHUNKED_ERROR))) {
- zend_try {
- zend_ini_deactivate(TSRMLS_C);
- } zend_end_try();
- return retval;
- }
-#endif
-
- if (AP(last_modified)) {
-#if MODULE_MAGIC_NUMBER < 19970912
- if ((retval = set_last_modified(r, r->finfo.st_mtime))) {
- zend_try {
- zend_ini_deactivate(TSRMLS_C);
- } zend_end_try();
- return retval;
- }
-#else
- update_mtime (r, r->finfo.st_mtime);
- set_last_modified(r);
- set_etag(r);
-#endif
- }
- /* Assume output will be of the default MIME type. Individual
- scripts may change this later in the request. */
- r->content_type = php_apache_get_default_mimetype(r TSRMLS_CC);
-
- /* Init timeout */
- hard_timeout("send", r);
-
- SG(server_context) = r;
-
- php_save_umask();
- add_common_vars(r);
- add_cgi_vars(r);
-
- init_request_info(TSRMLS_C);
- apache_php_module_main(r, display_source_mode TSRMLS_CC);
-
- /* Done, restore umask, turn off timeout, close file and return */
- php_restore_umask();
- kill_timeout(r);
- } zend_end_try();
-
- return OK;
-}
-/* }}} */
-
-/* {{{ send_parsed_php
- */
-static int send_parsed_php(request_rec * r)
-{
- int result = send_php(r, 0, NULL);
-
-#if MEMORY_LIMIT
- {
- char *mem_usage;
- TSRMLS_FETCH();
-
- mem_usage = ap_psprintf(r->pool, "%u", AG(allocated_memory_peak));
- AG(allocated_memory_peak) = 0;
- ap_table_setn(r->notes, "mod_php_memory_usage", mem_usage);
- }
-#endif
-
- return result;
-}
-/* }}} */
-
-/* {{{ send_parsed_php_source
- */
-static int send_parsed_php_source(request_rec * r)
-{
- return send_php(r, 1, NULL);
-}
-/* }}} */
-
-/* {{{ destroy_per_dir_entry
- */
-static void destroy_per_dir_entry(php_per_dir_entry *per_dir_entry)
-{
- free(per_dir_entry->key);
- free(per_dir_entry->value);
-}
-/* }}} */
-
-/* {{{ copy_per_dir_entry
- */
-static void copy_per_dir_entry(php_per_dir_entry *per_dir_entry)
-{
- php_per_dir_entry tmp = *per_dir_entry;
-
- per_dir_entry->key = (char *) malloc(tmp.key_length+1);
- memcpy(per_dir_entry->key, tmp.key, tmp.key_length);
- per_dir_entry->key[per_dir_entry->key_length] = 0;
-
- per_dir_entry->value = (char *) malloc(tmp.value_length+1);
- memcpy(per_dir_entry->value, tmp.value, tmp.value_length);
- per_dir_entry->value[per_dir_entry->value_length] = 0;
-}
-/* }}} */
-
-/* {{{ should_overwrite_per_dir_entry
- */
-static zend_bool should_overwrite_per_dir_entry(HashTable *target_ht, php_per_dir_entry *orig_per_dir_entry, zend_hash_key *hash_key, void *pData)
-{
- php_per_dir_entry *new_per_dir_entry;
-
- if (zend_hash_find(target_ht, hash_key->arKey, hash_key->nKeyLength, (void **) &new_per_dir_entry)==FAILURE) {
- return 1; /* does not exist in dest, copy from source */
- }
-
- if (new_per_dir_entry->type==PHP_INI_SYSTEM
- && orig_per_dir_entry->type!=PHP_INI_SYSTEM) {
- return 1;
- } else {
- return 0;
- }
-}
-/* }}} */
-
-/* {{{ php_destroy_per_dir_info
- */
-static void php_destroy_per_dir_info(HashTable *per_dir_info)
-{
- zend_hash_destroy(per_dir_info);
- free(per_dir_info);
-}
-/* }}} */
-
-/* {{{ php_create_dir
- */
-static void *php_create_dir(pool *p, char *dummy)
-{
- HashTable *per_dir_info;
-
- per_dir_info = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init_ex(per_dir_info, 5, NULL, (void (*)(void *)) destroy_per_dir_entry, 1, 0);
- register_cleanup(p, (void *) per_dir_info, (void (*)(void *)) php_destroy_per_dir_info, (void (*)(void *)) zend_hash_destroy);
-
- return per_dir_info;
-}
-/* }}} */
-
-/* {{{ php_merge_dir
- */
-static void *php_merge_dir(pool *p, void *basev, void *addv)
-{
- /* This function *must* return addv, and not modify basev */
- zend_hash_merge_ex((HashTable *) addv, (HashTable *) basev, (copy_ctor_func_t) copy_per_dir_entry, sizeof(php_per_dir_entry), (merge_checker_func_t) should_overwrite_per_dir_entry, NULL);
- return addv;
-}
-/* }}} */
-
-/* {{{ php_apache_value_handler_ex
- */
-static CONST_PREFIX char *php_apache_value_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode)
-{
- php_per_dir_entry per_dir_entry;
-
- if (!apache_php_initialized) {
- apache_php_initialized = 1;
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
-#endif
- sapi_startup(&apache_sapi_module);
- php_apache_startup(&apache_sapi_module);
- }
- per_dir_entry.type = mode;
-
- if (strcasecmp(arg2, "none") == 0) {
- arg2 = "";
- }
-
- per_dir_entry.key_length = strlen(arg1);
- per_dir_entry.value_length = strlen(arg2);
-
- per_dir_entry.key = (char *) malloc(per_dir_entry.key_length+1);
- memcpy(per_dir_entry.key, arg1, per_dir_entry.key_length);
- per_dir_entry.key[per_dir_entry.key_length] = 0;
-
- per_dir_entry.value = (char *) malloc(per_dir_entry.value_length+1);
- memcpy(per_dir_entry.value, arg2, per_dir_entry.value_length);
- per_dir_entry.value[per_dir_entry.value_length] = 0;
-
- zend_hash_update(conf, per_dir_entry.key, per_dir_entry.key_length, &per_dir_entry, sizeof(php_per_dir_entry), NULL);
- return NULL;
-}
-/* }}} */
-
-/* {{{ php_apache_value_handler
- */
-static CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2)
-{
- return php_apache_value_handler_ex(cmd, conf, arg1, arg2, PHP_INI_PERDIR);
-}
-/* }}} */
-
-/* {{{ php_apache_admin_value_handler
- */
-static CONST_PREFIX char *php_apache_admin_value_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2)
-{
- return php_apache_value_handler_ex(cmd, conf, arg1, arg2, PHP_INI_SYSTEM);
-}
-/* }}} */
-
-/* {{{ php_apache_flag_handler_ex
- */
-static CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode)
-{
- char bool_val[2];
-
- if (!strcasecmp(arg2, "On") || (arg2[0] == '1' && arg2[1] == '\0')) {
- bool_val[0] = '1';
- } else {
- bool_val[0] = '0';
- }
- bool_val[1] = 0;
-
- return php_apache_value_handler_ex(cmd, conf, arg1, bool_val, mode);
-}
-/* }}} */
-
-/* {{{ php_apache_flag_handler
- */
-static CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2)
-{
- return php_apache_flag_handler_ex(cmd, conf, arg1, arg2, PHP_INI_PERDIR);
-}
-/* }}} */
-
-/* {{{ php_apache_admin_flag_handler
- */
-static CONST_PREFIX char *php_apache_admin_flag_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2)
-{
- return php_apache_flag_handler_ex(cmd, conf, arg1, arg2, PHP_INI_SYSTEM);
-}
-/* }}} */
-
-/* {{{ int php_xbithack_handler(request_rec * r)
- */
-static int php_xbithack_handler(request_rec * r)
-{
- HashTable *per_dir_conf;
- TSRMLS_FETCH();
-
- if (!(r->finfo.st_mode & S_IXUSR)) {
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
- per_dir_conf = (HashTable *) get_module_config(r->per_dir_config, &php5_module);
- if (per_dir_conf) {
- zend_hash_apply((HashTable *) per_dir_conf, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC);
- }
- if(!AP(xbithack)) {
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
- return send_parsed_php(r);
-}
-/* }}} */
-
-/* {{{ apache_php_module_shutdown_wrapper
- */
-static void apache_php_module_shutdown_wrapper(void)
-{
- apache_php_initialized = 0;
- apache_sapi_module.shutdown(&apache_sapi_module);
-
-#if MODULE_MAGIC_NUMBER >= 19970728
- /* This function is only called on server exit if the apache API
- * child_exit handler exists, so shutdown globally
- */
- sapi_shutdown();
-#endif
-
-#ifdef ZTS
- tsrm_shutdown();
-#endif
-}
-/* }}} */
-
-#if MODULE_MAGIC_NUMBER >= 19970728
-/* {{{ php_child_exit_handler
- */
-static void php_child_exit_handler(server_rec *s, pool *p)
-{
-/* apache_php_initialized = 0; */
- apache_sapi_module.shutdown(&apache_sapi_module);
-
-#ifdef ZTS
- tsrm_shutdown();
-#endif
-}
-/* }}} */
-#endif
-
-/* {{{ void php_init_handler(server_rec *s, pool *p)
- */
-static void php_init_handler(server_rec *s, pool *p)
-{
- register_cleanup(p, NULL, (void (*)(void *))apache_php_module_shutdown_wrapper, (void (*)(void *))php_module_shutdown_for_exec);
- if (!apache_php_initialized) {
- apache_php_initialized = 1;
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
-#endif
- sapi_startup(&apache_sapi_module);
- php_apache_startup(&apache_sapi_module);
- }
-#if MODULE_MAGIC_NUMBER >= 19980527
- {
- TSRMLS_FETCH();
- if (PG(expose_php)) {
- ap_add_version_component("PHP/" PHP_VERSION);
- }
- }
-#endif
-}
-/* }}} */
-
-/* {{{ handler_rec php_handlers[]
- */
-handler_rec php_handlers[] =
-{
- {"application/x-httpd-php", send_parsed_php},
- {"application/x-httpd-php-source", send_parsed_php_source},
- {"text/html", php_xbithack_handler},
- {NULL}
-};
-/* }}} */
-
-/* {{{ command_rec php_commands[]
- */
-command_rec php_commands[] =
-{
- {"php_value", php_apache_value_handler, NULL, OR_OPTIONS, TAKE2, "PHP Value Modifier"},
- {"php_flag", php_apache_flag_handler, NULL, OR_OPTIONS, TAKE2, "PHP Flag Modifier"},
- {"php_admin_value", php_apache_admin_value_handler, NULL, ACCESS_CONF|RSRC_CONF, TAKE2, "PHP Value Modifier (Admin)"},
- {"php_admin_flag", php_apache_admin_flag_handler, NULL, ACCESS_CONF|RSRC_CONF, TAKE2, "PHP Flag Modifier (Admin)"},
- {NULL}
-};
-/* }}} */
-
-/* {{{ odule MODULE_VAR_EXPORT php5_module
- */
-module MODULE_VAR_EXPORT php5_module =
-{
- STANDARD_MODULE_STUFF,
- php_init_handler, /* initializer */
- php_create_dir, /* per-directory config creator */
- php_merge_dir, /* dir merger */
- NULL, /* per-server config creator */
- NULL, /* merge server config */
- php_commands, /* command table */
- php_handlers, /* handlers */
- NULL, /* filename translation */
- NULL, /* check_user_id */
- NULL, /* check auth */
- NULL, /* check access */
- NULL, /* type_checker */
- NULL, /* fixups */
- NULL /* logger */
-#if MODULE_MAGIC_NUMBER >= 19970103
- , NULL /* header parser */
-#endif
-#if MODULE_MAGIC_NUMBER >= 19970719
- , NULL /* child_init */
-#endif
-#if MODULE_MAGIC_NUMBER >= 19970728
- , php_child_exit_handler /* child_exit */
-#endif
-#if MODULE_MAGIC_NUMBER >= 19970902
- , NULL /* post read-request */
-#endif
-};
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/apache/mod_php5.exp b/sapi/apache/mod_php5.exp
deleted file mode 100644
index 9ad0f0a0ad..0000000000
--- a/sapi/apache/mod_php5.exp
+++ /dev/null
@@ -1 +0,0 @@
-php5_module
diff --git a/sapi/apache/mod_php5.h b/sapi/apache/mod_php5.h
deleted file mode 100644
index b495c403e1..0000000000
--- a/sapi/apache/mod_php5.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef MOD_PHP5_H
-#define MOD_PHP5_H
-
-#if !defined(WIN32) && !defined(WINNT)
-#ifndef MODULE_VAR_EXPORT
-#define MODULE_VAR_EXPORT
-#endif
-#endif
-
-typedef struct {
- long engine;
- long last_modified;
- long xbithack;
- long terminate_child;
- zend_bool in_request;
-} php_apache_info_struct;
-
-extern zend_module_entry apache_module_entry;
-
-#ifdef ZTS
-extern int php_apache_info_id;
-#define AP(v) TSRMG(php_apache_info_id, php_apache_info_struct *, v)
-#else
-extern php_apache_info_struct php_apache_info;
-#define AP(v) (php_apache_info.v)
-#endif
-
-#endif /* MOD_PHP5_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/sapi/apache/php.sym b/sapi/apache/php.sym
deleted file mode 100644
index 9ad0f0a0ad..0000000000
--- a/sapi/apache/php.sym
+++ /dev/null
@@ -1 +0,0 @@
-php5_module
diff --git a/sapi/apache/php4apache.dsp b/sapi/apache/php4apache.dsp
deleted file mode 100644
index 6197d3da9b..0000000000
--- a/sapi/apache/php4apache.dsp
+++ /dev/null
@@ -1,151 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4apache" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4apache - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4apache.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4apache.mak" CFG="php4apache - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4apache - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4apache - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4apache - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4apache - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\includes" /I "..\..\main" /I "..\..\TSRM" /I "..\..\regex" /I "C:\Program Files\Apache Group\Apache\include" /D ZEND_DEBUG=0 /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x60000000" /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\release" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS" /libpath:"C:\Program Files\Apache Group\Apache\libexec"
-
-!ELSEIF "$(CFG)" == "php4apache - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\includes" /I "..\..\main" /I "..\..\TSRM" /I "..\..\regex" /I "C:\Program Files\Apache Group\Apache\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x60000000" /version:4.0 /dll /incremental:yes /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\php_build\release" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS" /libpath:"C:\Program Files\Apache Group\Apache\libexec"
-
-!ELSEIF "$(CFG)" == "php4apache - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS_inline"
-# PROP BASE Intermediate_Dir "Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\includes" /I "..\..\main" /I "..\..\TSRM" /I "..\..\regex" /I "C:\Program Files\Apache Group\Apache\include" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\release" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline" /libpath:"C:\Program Files\Apache Group\Apache\libexec"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4apache - Win32 Release_TS"
-# Name "php4apache - Win32 Debug_TS"
-# Name "php4apache - Win32 Release_TS_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mod_php4.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_apache.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\sapi_apache.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\mod_php4.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_apache_http.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c
deleted file mode 100644
index 733cfba0e5..0000000000
--- a/sapi/apache/php_apache.c
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Stig Sæther Bakken <ssb@php.net> |
- | David Sklar <sklar@student.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php_apache_http.h"
-
-#if defined(PHP_WIN32) || defined(NETWARE)
-#include "zend.h"
-#include "ap_compat.h"
-#endif
-
-#ifdef ZTS
-int php_apache_info_id;
-#else
-php_apache_info_struct php_apache_info;
-#endif
-
-#define SECTION(name) PUTS("<h2>" name "</h2>\n")
-
-extern module *top_module;
-extern module **ap_loaded_modules;
-
-PHP_FUNCTION(virtual);
-PHP_FUNCTION(apache_request_headers);
-PHP_FUNCTION(apache_response_headers);
-PHP_FUNCTION(apachelog);
-PHP_FUNCTION(apache_note);
-PHP_FUNCTION(apache_lookup_uri);
-PHP_FUNCTION(apache_child_terminate);
-PHP_FUNCTION(apache_setenv);
-PHP_FUNCTION(apache_get_version);
-PHP_FUNCTION(apache_get_modules);
-
-PHP_MINFO_FUNCTION(apache);
-
-function_entry apache_functions[] = {
- PHP_FE(virtual, NULL)
- PHP_FE(apache_request_headers, NULL)
- PHP_FE(apache_note, NULL)
- PHP_FE(apache_lookup_uri, NULL)
- PHP_FE(apache_child_terminate, NULL)
- PHP_FE(apache_setenv, NULL)
- PHP_FE(apache_response_headers, NULL)
- PHP_FE(apache_get_version, NULL)
- PHP_FE(apache_get_modules, NULL)
- PHP_FALIAS(getallheaders, apache_request_headers, NULL)
- {NULL, NULL, NULL}
-};
-
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("xbithack", "0", PHP_INI_ALL, OnUpdateLong, xbithack, php_apache_info_struct, php_apache_info)
- STD_PHP_INI_ENTRY("engine", "1", PHP_INI_ALL, OnUpdateLong, engine, php_apache_info_struct, php_apache_info)
- STD_PHP_INI_ENTRY("last_modified", "0", PHP_INI_ALL, OnUpdateLong, last_modified, php_apache_info_struct, php_apache_info)
- STD_PHP_INI_ENTRY("child_terminate", "0", PHP_INI_ALL, OnUpdateLong, terminate_child, php_apache_info_struct, php_apache_info)
-PHP_INI_END()
-
-
-
-static void php_apache_globals_ctor(php_apache_info_struct *apache_globals TSRMLS_DC)
-{
- apache_globals->in_request = 0;
-}
-
-
-static PHP_MINIT_FUNCTION(apache)
-{
-#ifdef ZTS
- ts_allocate_id(&php_apache_info_id, sizeof(php_apache_info_struct), (ts_allocate_ctor) php_apache_globals_ctor, NULL);
-#else
- php_apache_globals_ctor(&php_apache_info TSRMLS_CC);
-#endif
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-
-static PHP_MSHUTDOWN_FUNCTION(apache)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-zend_module_entry apache_module_entry = {
- STANDARD_MODULE_HEADER,
- "apache",
- apache_functions,
- PHP_MINIT(apache),
- PHP_MSHUTDOWN(apache),
- NULL,
- NULL,
- PHP_MINFO(apache),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-/* {{{ proto bool apache_child_terminate(void)
- Terminate apache process after this request */
-PHP_FUNCTION(apache_child_terminate)
-{
-#ifndef MULTITHREAD
- if (AP(terminate_child)) {
- ap_child_terminate( ((request_rec *)SG(server_context)) );
- RETURN_TRUE;
- } else { /* tell them to get lost! */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This function is disabled");
- RETURN_FALSE;
- }
-#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This function is not supported in this build");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto string apache_note(string note_name [, string note_value])
- Get and set Apache request notes */
-PHP_FUNCTION(apache_note)
-{
- pval **arg_name, **arg_val;
- char *note_val;
- int arg_count = ZEND_NUM_ARGS();
-
- if (arg_count<1 || arg_count>2 ||
- zend_get_parameters_ex(arg_count, &arg_name, &arg_val) ==FAILURE ) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg_name);
- note_val = (char *) table_get(((request_rec *)SG(server_context))->notes, (*arg_name)->value.str.val);
-
- if (arg_count == 2) {
- convert_to_string_ex(arg_val);
- table_set(((request_rec *)SG(server_context))->notes, (*arg_name)->value.str.val, (*arg_val)->value.str.val);
- }
-
- if (note_val) {
- RETURN_STRING(note_val, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(apache)
-{
- module *modp = NULL;
- char output_buf[128];
-#if !defined(WIN32) && !defined(WINNT)
- char name[64];
- char modulenames[1024];
- char *p;
-#endif
- server_rec *serv;
- extern char server_root[MAX_STRING_LEN];
- extern uid_t user_id;
- extern char *user_name;
- extern gid_t group_id;
- extern int max_requests_per_child;
-
- serv = ((request_rec *) SG(server_context))->server;
-
-
- php_info_print_table_start();
-
-#ifdef PHP_WIN32
- php_info_print_table_row(1, "Apache for Windows 95/NT");
- php_info_print_table_end();
- php_info_print_table_start();
-#elif defined(NETWARE)
- php_info_print_table_row(1, "Apache for NetWare");
- php_info_print_table_end();
- php_info_print_table_start();
-#else
- php_info_print_table_row(2, "APACHE_INCLUDE", PHP_APACHE_INCLUDE);
- php_info_print_table_row(2, "APACHE_TARGET", PHP_APACHE_TARGET);
-#endif
-
- php_info_print_table_row(2, "Apache Version", SERVER_VERSION);
-
-#ifdef APACHE_RELEASE
- sprintf(output_buf, "%d", APACHE_RELEASE);
- php_info_print_table_row(2, "Apache Release", output_buf);
-#endif
- sprintf(output_buf, "%d", MODULE_MAGIC_NUMBER);
- php_info_print_table_row(2, "Apache API Version", output_buf);
- sprintf(output_buf, "%s:%u", serv->server_hostname, serv->port);
- php_info_print_table_row(2, "Hostname:Port", output_buf);
-#if !defined(WIN32) && !defined(WINNT)
- sprintf(output_buf, "%s(%d)/%d", user_name, (int)user_id, (int)group_id);
- php_info_print_table_row(2, "User/Group", output_buf);
- sprintf(output_buf, "Per Child: %d - Keep Alive: %s - Max Per Connection: %d", max_requests_per_child, serv->keep_alive ? "on":"off", serv->keep_alive_max);
- php_info_print_table_row(2, "Max Requests", output_buf);
-#endif
- sprintf(output_buf, "Connection: %d - Keep-Alive: %d", serv->timeout, serv->keep_alive_timeout);
- php_info_print_table_row(2, "Timeouts", output_buf);
-#if !defined(WIN32) && !defined(WINNT)
-/*
- This block seems to be working on NetWare; But it seems to be showing
- all modules instead of just the loaded ones
-*/
- php_info_print_table_row(2, "Server Root", server_root);
-
- strcpy(modulenames, "");
- for(modp = top_module; modp; modp = modp->next) {
- strlcpy(name, modp->name, sizeof(name));
- if ((p = strrchr(name, '.'))) {
- *p='\0'; /* Cut off ugly .c extensions on module names */
- }
- strcat(modulenames, name);
- if (modp->next) {
- strcat(modulenames, ", ");
- }
- }
- php_info_print_table_row(2, "Loaded Modules", modulenames);
-#endif
-
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-
- {
- register int i;
- array_header *arr;
- table_entry *elts;
- request_rec *r;
-
- r = ((request_rec *) SG(server_context));
- arr = table_elts(r->subprocess_env);
- elts = (table_entry *)arr->elts;
-
- SECTION("Apache Environment");
- php_info_print_table_start();
- php_info_print_table_header(2, "Variable", "Value");
- for (i=0; i < arr->nelts; i++) {
- php_info_print_table_row(2, elts[i].key, elts[i].val);
- }
- php_info_print_table_end();
- }
-
- {
- array_header *env_arr;
- table_entry *env;
- int i;
- request_rec *r;
-
- r = ((request_rec *) SG(server_context));
- SECTION("HTTP Headers Information");
- php_info_print_table_start();
- php_info_print_table_colspan_header(2, "HTTP Request Headers");
- php_info_print_table_row(2, "HTTP Request", r->the_request);
- env_arr = table_elts(r->headers_in);
- env = (table_entry *)env_arr->elts;
- for (i = 0; i < env_arr->nelts; ++i) {
- if (env[i].key && (!PG(safe_mode) || (PG(safe_mode) && strncasecmp(env[i].key, "authorization", 13)))) {
- php_info_print_table_row(2, env[i].key, env[i].val);
- }
- }
- php_info_print_table_colspan_header(2, "HTTP Response Headers");
- env_arr = table_elts(r->headers_out);
- env = (table_entry *)env_arr->elts;
- for(i = 0; i < env_arr->nelts; ++i) {
- if (env[i].key) {
- php_info_print_table_row(2, env[i].key, env[i].val);
- }
- }
- php_info_print_table_end();
- }
-}
-/* }}} */
-
-/* {{{ proto bool virtual(string filename)
- Perform an Apache sub-request */
-/* This function is equivalent to <!--#include virtual...-->
- * in mod_include. It does an Apache sub-request. It is useful
- * for including CGI scripts or .shtml files, or anything else
- * that you'd parse through Apache (for .phtml files, you'd probably
- * want to use <?Include>. This only works when PHP is compiled
- * as an Apache module, since it uses the Apache API for doing
- * sub requests.
- */
-PHP_FUNCTION(virtual)
-{
- pval **filename;
- request_rec *rr = NULL;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- if (!(rr = sub_req_lookup_uri ((*filename)->value.str.val, ((request_rec *) SG(server_context))))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - URI lookup failed", (*filename)->value.str.val);
- if (rr) destroy_sub_req (rr);
- RETURN_FALSE;
- }
-
- if (rr->status != 200) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - error finding URI", (*filename)->value.str.val);
- if (rr) destroy_sub_req (rr);
- RETURN_FALSE;
- }
-
- php_end_ob_buffers(1 TSRMLS_CC);
- php_header(TSRMLS_C);
-
- if (run_sub_req(rr)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - request execution failed", (*filename)->value.str.val);
- if (rr) destroy_sub_req (rr);
- RETURN_FALSE;
- } else {
- if (rr) destroy_sub_req (rr);
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto array getallheaders(void)
- Alias for apache_request_headers() */
-/* }}} */
-/* {{{ proto array apache_request_headers(void)
- Fetch all HTTP request headers */
-PHP_FUNCTION(apache_request_headers)
-{
- array_header *env_arr;
- table_entry *tenv;
- int i;
-
- array_init(return_value);
- env_arr = table_elts(((request_rec *) SG(server_context))->headers_in);
- tenv = (table_entry *)env_arr->elts;
- for (i = 0; i < env_arr->nelts; ++i) {
- if (!tenv[i].key ||
- (PG(safe_mode) &&
- !strncasecmp(tenv[i].key, "authorization", 13))) {
- continue;
- }
- if (add_assoc_string(return_value, tenv[i].key, (tenv[i].val==NULL) ? "" : tenv[i].val, 1)==FAILURE) {
- RETURN_FALSE;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto array apache_response_headers(void)
- Fetch all HTTP response headers */
-PHP_FUNCTION(apache_response_headers)
-{
- array_header *env_arr;
- table_entry *tenv;
- int i;
-
- array_init(return_value);
- env_arr = table_elts(((request_rec *) SG(server_context))->headers_out);
- tenv = (table_entry *)env_arr->elts;
- for (i = 0; i < env_arr->nelts; ++i) {
- if (!tenv[i].key) continue;
- if (add_assoc_string(return_value, tenv[i].key, (tenv[i].val==NULL) ? "" : tenv[i].val, 1)==FAILURE) {
- RETURN_FALSE;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto bool apache_setenv(string variable, string value [, bool walk_to_top])
- Set an Apache subprocess_env variable */
-PHP_FUNCTION(apache_setenv)
-{
- int var_len, val_len, top=0;
- char *var = NULL, *val = NULL;
- request_rec *r = (request_rec *) SG(server_context);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|b", &var, &var_len, &val, &val_len, &top) == FAILURE) {
- RETURN_FALSE;
- }
-
- while(top) {
- if(r->prev) r = r->prev;
- else break;
- }
-
- ap_table_setn(r->subprocess_env, ap_pstrndup(r->pool, var, var_len), ap_pstrndup(r->pool, val, val_len));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto object apache_lookup_uri(string URI)
- Perform a partial request of the given URI to obtain information about it */
-PHP_FUNCTION(apache_lookup_uri)
-{
- pval **filename;
- request_rec *rr=NULL;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- if(!(rr = sub_req_lookup_uri((*filename)->value.str.val, ((request_rec *) SG(server_context))))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "URI lookup failed", (*filename)->value.str.val);
- RETURN_FALSE;
- }
- object_init(return_value);
- add_property_long(return_value,"status", rr->status);
- if (rr->the_request) {
- add_property_string(return_value,"the_request", rr->the_request, 1);
- }
- if (rr->status_line) {
- add_property_string(return_value,"status_line", (char *)rr->status_line, 1);
- }
- if (rr->method) {
- add_property_string(return_value,"method", (char *)rr->method, 1);
- }
- if (rr->content_type) {
- add_property_string(return_value,"content_type", (char *)rr->content_type, 1);
- }
- if (rr->handler) {
- add_property_string(return_value,"handler", (char *)rr->handler, 1);
- }
- if (rr->uri) {
- add_property_string(return_value,"uri", rr->uri, 1);
- }
- if (rr->filename) {
- add_property_string(return_value,"filename", rr->filename, 1);
- }
- if (rr->path_info) {
- add_property_string(return_value,"path_info", rr->path_info, 1);
- }
- if (rr->args) {
- add_property_string(return_value,"args", rr->args, 1);
- }
- if (rr->boundary) {
- add_property_string(return_value,"boundary", rr->boundary, 1);
- }
- add_property_long(return_value,"no_cache", rr->no_cache);
- add_property_long(return_value,"no_local_copy", rr->no_local_copy);
- add_property_long(return_value,"allowed", rr->allowed);
- add_property_long(return_value,"sent_bodyct", rr->sent_bodyct);
- add_property_long(return_value,"bytes_sent", rr->bytes_sent);
- add_property_long(return_value,"byterange", rr->byterange);
- add_property_long(return_value,"clength", rr->clength);
-
-#if MODULE_MAGIC_NUMBER >= 19980324
- if (rr->unparsed_uri) {
- add_property_string(return_value,"unparsed_uri", rr->unparsed_uri, 1);
- }
- if(rr->mtime) {
- add_property_long(return_value,"mtime", rr->mtime);
- }
-#endif
- if(rr->request_time) {
- add_property_long(return_value,"request_time", rr->request_time);
- }
-
- destroy_sub_req(rr);
-}
-/* }}} */
-
-
-#if 0
-This function is most likely a bad idea. Just playing with it for now.
-
-PHP_FUNCTION(apache_exec_uri)
-{
- pval **filename;
- request_rec *rr=NULL;
- TSRMLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- if(!(rr = ap_sub_req_lookup_uri((*filename)->value.str.val, ((request_rec *) SG(server_context))))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "URI lookup failed", (*filename)->value.str.val);
- RETURN_FALSE;
- }
- RETVAL_LONG(ap_run_sub_req(rr));
- ap_destroy_sub_req(rr);
-}
-#endif
-
-/* {{{ proto string apache_get_version(void)
- Fetch Apache version */
-PHP_FUNCTION(apache_get_version)
-{
- char *apv = (char *) ap_get_server_version();
-
- if (apv && *apv) {
- RETURN_STRING(apv, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array apache_get_modules(void)
- Get a list of loaded Apache modules */
-PHP_FUNCTION(apache_get_modules)
-{
- int n;
- char *p;
-
- array_init(return_value);
-
- for (n = 0; ap_loaded_modules[n]; ++n) {
- char *s = (char *) ap_loaded_modules[n]->name;
- if ((p = strchr(s, '.'))) {
- add_next_index_stringl(return_value, s, (p - s), 1);
- } else {
- add_next_index_string(return_value, s, 1);
- }
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/apache/php_apache_http.h b/sapi/apache/php_apache_http.h
deleted file mode 100644
index 80ec3c2c3d..0000000000
--- a/sapi/apache/php_apache_http.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Stig Sæther Bakken <ssb@php.net> |
- | David Sklar <sklar@student.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#define NO_REGEX_EXTRA_H
-
-#ifdef WIN32
-#include <stddef.h>
-#endif
-
-#ifdef NETWARE
-#include <netinet/in.h>
-#endif
-
-#include "zend.h"
-#include "php_regex.h"
-#include "php_compat.h"
-
-#if HAVE_OPENSSL_EXT
-/* zlib typedefs free_func which causes problems if the SSL includes happen
- * after zlib.h is included */
-# include <openssl/ssl.h>
-#endif
-
-#include "httpd.h"
-#include "http_config.h"
-
-#if MODULE_MAGIC_NUMBER > 19980712
-# include "ap_compat.h"
-#else
-# if MODULE_MAGIC_NUMBER > 19980324
-# include "compat.h"
-# endif
-#endif
-
-#include "http_core.h"
-#include "http_main.h"
-#include "http_protocol.h"
-#include "http_request.h"
-#include "http_log.h"
-#include "util_script.h"
-
-#include "php_variables.h"
-#include "php_main.h"
-#include "php_ini.h"
-#include "ext/standard/php_standard.h"
-
-#include "mod_php5.h"
diff --git a/sapi/apache/sapi_apache.c b/sapi/apache/sapi_apache.c
deleted file mode 100644
index 45fa8a90d5..0000000000
--- a/sapi/apache/sapi_apache.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
- | PHP 4.0 patches by: |
- | Zeev Suraski <zeev@zend.com> |
- | Stig Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php_apache_http.h"
-
-/* {{{ apache_php_module_main
- */
-int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC)
-{
- zend_file_handle file_handle;
-
- if (php_request_startup(TSRMLS_C) == FAILURE) {
- return FAILURE;
- }
- /* sending a file handle to another dll is not working
- // so let zend open it.
- */
-
- if (display_source_mode) {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- php_get_highlight_struct(&syntax_highlighter_ini);
- if (highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC)){
- return OK;
- } else {
- return NOT_FOUND;
- }
- } else {
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.handle.fd = 0;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.opened_path = NULL;
- file_handle.free_filename = 0;
-
- (void) php_execute_script(&file_handle TSRMLS_CC);
- }
-
- AP(in_request) = 0;
-
- zend_try {
- php_request_shutdown(NULL);
- } zend_end_try();
-
- return (OK);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/apache2filter/CREDITS b/sapi/apache2filter/CREDITS
deleted file mode 100644
index c298a9bf6a..0000000000
--- a/sapi/apache2filter/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Apache 2.0 Filter
-Sascha Schumann, Aaron Bannert
diff --git a/sapi/apache2filter/EXPERIMENTAL b/sapi/apache2filter/EXPERIMENTAL
deleted file mode 100644
index 293159a693..0000000000
--- a/sapi/apache2filter/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this module is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/sapi/apache2filter/README b/sapi/apache2filter/README
deleted file mode 100644
index 3054e208d3..0000000000
--- a/sapi/apache2filter/README
+++ /dev/null
@@ -1,71 +0,0 @@
-WHAT IS THIS?
-
- This module exploits the layered I/O support in Apache 2.0.
-
-HOW DOES IT WORK?
-
- In Apache 2.0, you have handlers which generate content (like
- reading a script from disk). The content goes then through
- a chain of filters. PHP can be such a filter, so that it processes
- your script and hands the output to the next filter (which will
- usually cause a write to the network).
-
-DOES IT WORK?
-
- It is experimental as interfaces in Apache 2.0 might change in the
- future.
-
-HOW TO INSTALL
-
- This SAPI module is known to work with Apache 2.0.40.
-
- $ cd apache-2.x
- $ cd src
- $ ./configure --enable-so
- $ make install
-
- For testing purposes, you might want to use --with-mpm=prefork.
- (Albeit PHP also works with threaded MPMs.)
-
- Configure PHP 4:
-
- $ cd php-4.x
- $ ./configure --with-apxs2=/path/to/apache-2.0/bin/apxs
- $ make install
-
- At the end of conf/httpd.conf, add:
-
- AddType application/x-httpd-php .php
-
- If you would like to enable source code highlighting functionality add:
-
- AddType application/x-httpd-php-source .phps
-
- That's it. Now start bin/httpd.
-
-HOW TO CONFIGURE
-
- The Apache 2.0 PHP module supports a new configuration directive that
- allows an admin to override the php.ini search path. For example,
- place your php.ini file in Apache's ServerRoot/conf directory and
- add this to your httpd.conf file:
-
- PHPINIDir "conf"
-
-DEBUGGING APACHE AND PHP
-
- To debug Apache, we recommened:
-
- 1. Use the Prefork MPM (Apache 1.3-like process model) by
- configuring Apache with '--with-mpm=prefork'.
- 2. Start httpd using -DONE_PROCESS (e.g. (gdb) r -DONE_PROCESS).
-
- If you want to debug a part of the PHP startup procedure, set a
- breakpoint on 'load_module'. Step through it until apr_dso_load() is
- done. Then you can set a breakpoint on any PHP-related symbol.
-
-TODO
-
- PHP functions like apache_sub_req (see php_functions.c)
- Protocol handlers
- Passing script data to engine without temporary file
diff --git a/sapi/apache2filter/apache_config.c b/sapi/apache2filter/apache_config.c
deleted file mode 100644
index 0631a5e30a..0000000000
--- a/sapi/apache2filter/apache_config.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_apache.h"
-
-#include "apr_strings.h"
-#include "ap_config.h"
-#include "util_filter.h"
-#include "httpd.h"
-#include "http_config.h"
-#include "http_request.h"
-#include "http_core.h"
-#include "http_protocol.h"
-#include "http_log.h"
-#include "http_main.h"
-#include "util_script.h"
-#include "http_core.h"
-
-#ifdef PHP_AP_DEBUG
-#define phpapdebug(a) fprintf a
-#else
-#define phpapdebug(a)
-#endif
-
-typedef struct {
- HashTable config;
-} php_conf_rec;
-
-typedef struct {
- char *value;
- size_t value_len;
- char status;
-} php_dir_entry;
-
-static const char *real_value_hnd(cmd_parms *cmd, void *dummy,
- const char *name, const char *value, int status)
-{
- php_conf_rec *d = dummy;
- php_dir_entry e;
-
- phpapdebug((stderr, "Getting %s=%s for %p (%d)\n", name, value, dummy,
- zend_hash_num_elements(&d->config)));
-
- if (!strncasecmp(value, "none", sizeof("none"))) {
- value = "";
- }
-
- e.value = apr_pstrdup(cmd->pool, value);
- e.value_len = strlen(value);
- e.status = status;
-
- zend_hash_update(&d->config, (char *) name, strlen(name) + 1, &e,
- sizeof(e), NULL);
- return NULL;
-}
-
-static const char *php_apache_value_handler(cmd_parms *cmd, void *dummy,
- const char *name, const char *value)
-{
- return real_value_hnd(cmd, dummy, name, value, PHP_INI_PERDIR);
-}
-
-static const char *php_apache_admin_value_handler(cmd_parms *cmd, void *dummy,
- const char *name, const char *value)
-{
- return real_value_hnd(cmd, dummy, name, value, PHP_INI_SYSTEM);
-}
-
-static const char *real_flag_hnd(cmd_parms *cmd, void *dummy, const char *arg1,
- const char *arg2, int status)
-{
- char bool_val[2];
-
- if (!strcasecmp(arg2, "On") || (arg2[0] == '1' && arg2[1] == '\0')) {
- bool_val[0] = '1';
- } else {
- bool_val[0] = '0';
- }
- bool_val[1] = 0;
-
- return real_value_hnd(cmd, dummy, arg1, bool_val, status);
-}
-
-static const char *php_apache_flag_handler(cmd_parms *cmd, void *dummy,
- const char *name, const char *value)
-{
- return real_flag_hnd(cmd, dummy, name, value, PHP_INI_PERDIR);
-}
-
-static const char *php_apache_admin_flag_handler(cmd_parms *cmd, void *dummy,
- const char *name, const char *value)
-{
- return real_flag_hnd(cmd, dummy, name, value, PHP_INI_SYSTEM);
-}
-
-static const char *php_apache_phpini_set(cmd_parms *cmd, void *mconfig,
- const char *arg)
-{
- if (apache2_php_ini_path_override) {
- return "Only first PHPINIDir directive honored per configuration tree "
- "- subsequent ones ignored";
- }
- apache2_php_ini_path_override = ap_server_root_relative(cmd->pool, arg);
- return NULL;
-}
-
-
-void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
-{
- php_conf_rec *d = base_conf, *e = new_conf;
- php_dir_entry *pe;
- php_dir_entry *data;
- char *str;
- uint str_len;
- ulong num_index;
-
- phpapdebug((stderr, "Merge dir (%p) (%p)\n", base_conf, new_conf));
- for (zend_hash_internal_pointer_reset(&d->config);
- zend_hash_get_current_key_ex(&d->config, &str, &str_len,
- &num_index, 0, NULL) == HASH_KEY_IS_STRING;
- zend_hash_move_forward(&d->config)) {
- pe = NULL;
- zend_hash_get_current_data(&d->config, (void **) &data);
- if (zend_hash_find(&e->config, str, str_len, (void **) &pe) == SUCCESS) {
- if (pe->status >= data->status) continue;
- }
- zend_hash_update(&e->config, str, str_len, data, sizeof(*data), NULL);
- phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", str,
- data->status, pe?pe->status:-1));
- }
- return new_conf;
-}
-
-char *get_php_config(void *conf, char *name, size_t name_len)
-{
- php_conf_rec *d = conf;
- php_dir_entry *pe;
-
- if (zend_hash_find(&d->config, name, name_len, (void **) &pe) == SUCCESS) {
- return pe->value;
- }
-
- return "";
-}
-
-void apply_config(void *dummy)
-{
- php_conf_rec *d = dummy;
- char *str;
- uint str_len;
- php_dir_entry *data;
-
- for (zend_hash_internal_pointer_reset(&d->config);
- zend_hash_get_current_key_ex(&d->config, &str, &str_len, NULL, 0,
- NULL) == HASH_KEY_IS_STRING;
- zend_hash_move_forward(&d->config)) {
- zend_hash_get_current_data(&d->config, (void **) &data);
- phpapdebug((stderr, "APPLYING (%s)(%s)\n", str, data->value));
- if (zend_alter_ini_entry(str, str_len, data->value, data->value_len,
- data->status, PHP_INI_STAGE_RUNTIME) == FAILURE) {
- phpapdebug((stderr, "..FAILED\n"));
- }
- }
-}
-
-const command_rec php_dir_cmds[] =
-{
- AP_INIT_TAKE2("php_value", php_apache_value_handler, NULL, OR_OPTIONS,
- "PHP Value Modifier"),
- AP_INIT_TAKE2("php_flag", php_apache_flag_handler, NULL, OR_OPTIONS,
- "PHP Flag Modifier"),
- AP_INIT_TAKE2("php_admin_value", php_apache_admin_value_handler, NULL,
- ACCESS_CONF|RSRC_CONF, "PHP Value Modifier (Admin)"),
- AP_INIT_TAKE2("php_admin_flag", php_apache_admin_flag_handler, NULL,
- ACCESS_CONF|RSRC_CONF, "PHP Flag Modifier (Admin)"),
- AP_INIT_TAKE1("PHPINIDir", php_apache_phpini_set, NULL, RSRC_CONF,
- "Directory containing the php.ini file"),
- {NULL}
-};
-
-static apr_status_t destroy_php_config(void *data)
-{
- php_conf_rec *d = data;
-
- phpapdebug((stderr, "Destroying config %p\n", data));
- zend_hash_destroy(&d->config);
-
- return APR_SUCCESS;
-}
-
-void *create_php_config(apr_pool_t *p, char *dummy)
-{
- php_conf_rec *newx =
- (php_conf_rec *) apr_pcalloc(p, sizeof(*newx));
-
- phpapdebug((stderr, "Creating new config (%p) for %s\n", newx, dummy));
- zend_hash_init(&newx->config, 0, NULL, NULL, 1);
- apr_pool_cleanup_register(p, newx, destroy_php_config, apr_pool_cleanup_null);
- return (void *) newx;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/apache2filter/config.m4 b/sapi/apache2filter/config.m4
deleted file mode 100644
index 030a9633cf..0000000000
--- a/sapi/apache2filter/config.m4
+++ /dev/null
@@ -1,118 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_MSG_CHECKING(for Apache 2.0 module support via DSO through APXS)
-AC_ARG_WITH(apxs2filter,
-[ --with-apxs2filter[=FILE] EXPERIMENTAL: Build shared Apache 2.0 module. FILE is the optional
- pathname to the Apache apxs tool; defaults to "apxs".],[
- if test "$withval" = "yes"; then
- APXS=apxs
- $APXS -q CFLAGS >/dev/null 2>&1
- if test "$?" != "0" && test -x /usr/sbin/apxs; then
- APXS=/usr/sbin/apxs
- fi
- else
- PHP_EXPAND_PATH($withval, APXS)
- fi
-
- $APXS -q CFLAGS >/dev/null 2>&1
- if test "$?" != "0"; then
- AC_MSG_RESULT()
- AC_MSG_RESULT()
- AC_MSG_RESULT([Sorry, I cannot run apxs. Possible reasons follow:])
- AC_MSG_RESULT()
- AC_MSG_RESULT([1. Perl is not installed])
- AC_MSG_RESULT([2. apxs was not found. Try to pass the path using --with-apxs2filter=/path/to/apxs])
- AC_MSG_RESULT([3. Apache was not built using --enable-so (the apxs usage page is displayed)])
- AC_MSG_RESULT()
- AC_MSG_RESULT([The output of $APXS follows:])
- $APXS
- AC_MSG_ERROR([Aborting])
- fi
-
- APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR`
- APXS_HTTPD=`$APXS -q SBINDIR`/`$APXS -q TARGET`
- APXS_CFLAGS=`$APXS -q CFLAGS`
- APXS_MPM=`$APXS -q MPM_NAME`
-
- for flag in $APXS_CFLAGS; do
- case $flag in
- -D*) CPPFLAGS="$CPPFLAGS $flag";;
- esac
- done
-
- # Test that we're trying to configure with apache 2.x
- PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
- if test "$APACHE_VERSION" -le 2000000; then
- AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropiate switch --with-apxs (without the 2)])
- elif test "$APACHE_VERSION" -lt 2000040; then
- AC_MSG_ERROR([Please note that Apache version >= 2.0.40 is required.])
- fi
-
- APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
- if test -z `$APXS -q SYSCONFDIR`; then
- INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
- $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
- -i -n php5"
- else
- APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
- INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
- \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
- $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
- -S SYSCONFDIR='$APXS_SYSCONFDIR' \
- -i -a -n php5"
- fi
-
- case $host_alias in
- *aix*)
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-brtl -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp"
- PHP_SELECT_SAPI(apache2filter, shared, sapi_apache2.c apache_config.c php_functions.c)
- INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
- ;;
- *darwin*)
- dnl When using bundles on Darwin, we must resolve all symbols. However,
- dnl the linker does not recursively look at the bundle loader and
- dnl pull in its dependencies. Therefore, we must pull in the APR
- dnl and APR-util libraries.
- APXS_BINDIR=`$APXS -q BINDIR`
- if test -f $APXS_BINDIR/apr-config; then
- MH_BUNDLE_FLAGS="`$APXS_BINDIR/apr-config --ldflags --link-ld --libs`"
- fi
- if test -f $APXS_BINDIR/apu-config; then
- MH_BUNDLE_FLAGS="`$APXS_BINDIR/apu-config --ldflags --link-ld --libs` $MH_BUNDLE_FLAGS"
- fi
- MH_BUNDLE_FLAGS="-bundle -bundle_loader $APXS_HTTPD $MH_BUNDLE_FLAGS"
- PHP_SUBST(MH_BUNDLE_FLAGS)
- PHP_SELECT_SAPI(apache2filter, bundle, sapi_apache2.c apache_config.c php_functions.c)
- SAPI_SHARED=libs/libphp5.so
- INSTALL_IT="$INSTALL_IT $SAPI_SHARED"
- ;;
- *beos*)
- APXS_BINDIR=`$APXS -q BINDIR`
- if test -f _APP_; then `rm _APP_`; fi
- `ln -s $APXS_BINDIR/httpd _APP_`
- EXTRA_LIBS="$EXTRA_LIBS _APP_"
- PHP_SELECT_SAPI(apache2filter, shared, sapi_apache2.c apache_config.c php_functions.c)
- INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
- ;;
- *)
- PHP_SELECT_SAPI(apache2filter, shared, sapi_apache2.c apache_config.c php_functions.c)
- INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
- ;;
- esac
-
- PHP_ADD_INCLUDE($APXS_INCLUDEDIR)
- if test "$APXS_MPM" != "prefork"; then
- PHP_BUILD_THREAD_SAFE
- fi
- AC_MSG_RESULT(yes)
-],[
- AC_MSG_RESULT(no)
-])
-
-PHP_SUBST(APXS)
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/apache2filter/php.sym b/sapi/apache2filter/php.sym
deleted file mode 100644
index 9ad0f0a0ad..0000000000
--- a/sapi/apache2filter/php.sym
+++ /dev/null
@@ -1 +0,0 @@
-php5_module
diff --git a/sapi/apache2filter/php_apache.h b/sapi/apache2filter/php_apache.h
deleted file mode 100644
index fd0821e3dc..0000000000
--- a/sapi/apache2filter/php_apache.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_APACHE_H
-#define PHP_APACHE_H
-
-#include "httpd.h"
-#include "http_config.h"
-#include "http_core.h"
-
-/* Declare this so we can get to it from outside the sapi_apache2.c file */
-extern module AP_MODULE_DECLARE_DATA php5_module;
-
-/* A way to specify the location of the php.ini dir in an apache directive */
-extern char *apache2_php_ini_path_override;
-
-/* The server_context used by PHP */
-typedef struct php_struct {
- int state;
- request_rec *r;
- ap_filter_t *f; /* downstream output filters after the PHP filter. */
- /* Length of post_data buffer */
- int post_len;
- /* Index for reading from buffer */
- int post_idx;
- /* stat structure of the current file */
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- struct stat_libc finfo;
-#else
- struct stat finfo;
-#endif
- /* Buffer for request body filter */
- char *post_data;
- /* Whether or not we've processed PHP in the output filters yet. */
- int request_processed;
-} php_struct;
-
-void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf);
-void *create_php_config(apr_pool_t *p, char *dummy);
-char *get_php_config(void *conf, char *name, size_t name_len);
-void apply_config(void *);
-extern const command_rec php_dir_cmds[];
-
-#define APR_ARRAY_FOREACH_OPEN(arr, key, val) \
-{ \
- apr_table_entry_t *elts; \
- int i; \
- elts = (apr_table_entry_t *) arr->elts; \
- for (i = 0; i < arr->nelts; i++) { \
- key = elts[i].key; \
- val = elts[i].val;
-
-#define APR_ARRAY_FOREACH_CLOSE() }}
-
-#endif /* PHP_APACHE_H */
diff --git a/sapi/apache2filter/php_functions.c b/sapi/apache2filter/php_functions.c
deleted file mode 100644
index 3b530fe46d..0000000000
--- a/sapi/apache2filter/php_functions.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#include "php.h"
-#include "ext/standard/php_smart_str.h"
-#include "ext/standard/info.h"
-#include "SAPI.h"
-
-#define CORE_PRIVATE
-#include "apr_strings.h"
-#include "apr_time.h"
-#include "ap_config.h"
-#include "util_filter.h"
-#include "httpd.h"
-#include "http_config.h"
-#include "http_request.h"
-#include "http_core.h"
-#include "http_protocol.h"
-#include "http_log.h"
-#include "http_main.h"
-#include "util_script.h"
-#include "http_core.h"
-
-#include "php_apache.h"
-
-static request_rec *php_apache_lookup_uri(char *filename TSRMLS_DC)
-{
- php_struct *ctx;
-
- if (!filename) {
- return NULL;
- }
-
- ctx = SG(server_context);
- return ap_sub_req_lookup_uri(filename, ctx->f->r, ctx->f->next);
-}
-
-/* {{{ proto bool virtual(string uri)
- Perform an apache sub-request */
-PHP_FUNCTION(virtual)
-{
- zval **filename;
- request_rec *rr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(filename);
-
- if (!(rr = php_apache_lookup_uri(Z_STRVAL_PP(filename) TSRMLS_CC))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - URI lookup failed", Z_STRVAL_PP(filename));
- RETURN_FALSE;
- }
-
- if (rr->status == HTTP_OK) {
- if (ap_run_sub_req(rr)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - request execution failed", Z_STRVAL_PP(filename));
- ap_destroy_sub_req(rr);
- RETURN_FALSE;
- }
- ap_destroy_sub_req(rr);
- RETURN_TRUE;
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - error finding URI", Z_STRVAL_PP(filename));
- ap_destroy_sub_req(rr);
- RETURN_FALSE;
-}
-/* }}} */
-
-#define ADD_LONG(name) \
- add_property_long(return_value, #name, rr->name)
-#define ADD_TIME(name) \
- add_property_long(return_value, #name, rr->name / APR_USEC_PER_SEC);
-#define ADD_STRING(name) \
- if (rr->name) add_property_string(return_value, #name, (char *) rr->name, 1)
-
-PHP_FUNCTION(apache_lookup_uri)
-{
- request_rec *rr;
- zval **filename;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(filename);
-
- if (!(rr = php_apache_lookup_uri(Z_STRVAL_PP(filename) TSRMLS_CC))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - URI lookup failed", Z_STRVAL_PP(filename));
- RETURN_FALSE;
- }
-
- if (rr->status == HTTP_OK) {
- object_init(return_value);
-
- ADD_LONG(status);
- ADD_STRING(the_request);
- ADD_STRING(status_line);
- ADD_STRING(method);
- ADD_TIME(mtime);
- ADD_LONG(clength);
-#if MODULE_MAGIC_NUMBER < 20020506
- ADD_STRING(boundary);
-#endif
- ADD_STRING(range);
- ADD_LONG(chunked);
- ADD_STRING(content_type);
- ADD_STRING(handler);
- ADD_LONG(no_cache);
- ADD_LONG(no_local_copy);
- ADD_STRING(unparsed_uri);
- ADD_STRING(uri);
- ADD_STRING(filename);
- ADD_STRING(path_info);
- ADD_STRING(args);
- ADD_LONG(allowed);
- ADD_LONG(sent_bodyct);
- ADD_LONG(bytes_sent);
- ADD_LONG(request_time);
- ADD_LONG(mtime);
- ADD_TIME(request_time);
-
- ap_destroy_sub_req(rr);
- return;
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - error finding URI", Z_STRVAL_PP(filename));
- ap_destroy_sub_req(rr);
- RETURN_FALSE;
-}
-
-/* {{{ proto array getallheaders(void)
- Fetch all HTTP request headers */
-PHP_FUNCTION(apache_request_headers)
-{
- php_struct *ctx;
- const apr_array_header_t *arr;
- char *key, *val;
-
- array_init(return_value);
-
- ctx = SG(server_context);
- arr = apr_table_elts(ctx->f->r->headers_in);
-
- APR_ARRAY_FOREACH_OPEN(arr, key, val)
- if (!val) val = empty_string;
- add_assoc_string(return_value, key, val, 1);
- APR_ARRAY_FOREACH_CLOSE()
-}
-/* }}} */
-
-/* {{{ proto array apache_response_headers(void)
- Fetch all HTTP response headers */
-PHP_FUNCTION(apache_response_headers)
-{
- php_struct *ctx;
- const apr_array_header_t *arr;
- char *key, *val;
-
- array_init(return_value);
-
- ctx = SG(server_context);
- arr = apr_table_elts(ctx->f->r->headers_out);
-
- APR_ARRAY_FOREACH_OPEN(arr, key, val)
- if (!val) val = empty_string;
- add_assoc_string(return_value, key, val, 1);
- APR_ARRAY_FOREACH_CLOSE()
-}
-/* }}} */
-
-/* {{{ proto string apache_note(string note_name [, string note_value])
- Get and set Apache request notes */
-PHP_FUNCTION(apache_note)
-{
- php_struct *ctx;
- zval **note_name, **note_val;
- char *old_note_val=NULL;
- int arg_count = ZEND_NUM_ARGS();
-
- if (arg_count<1 || arg_count>2 ||
- zend_get_parameters_ex(arg_count, &note_name, &note_val) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ctx = SG(server_context);
-
- convert_to_string_ex(note_name);
-
- old_note_val = (char *) apr_table_get(ctx->r->notes, Z_STRVAL_PP(note_name));
-
- if (arg_count == 2) {
- convert_to_string_ex(note_val);
- apr_table_set(ctx->r->notes, Z_STRVAL_PP(note_name), Z_STRVAL_PP(note_val));
- }
-
- if (old_note_val) {
- RETURN_STRING(old_note_val, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool apache_setenv(string variable, string value [, bool walk_to_top])
- Set an Apache subprocess_env variable */
-PHP_FUNCTION(apache_setenv)
-{
- php_struct *ctx;
- zval **variable=NULL, **string_val=NULL, **walk_to_top=NULL;
- int arg_count = ZEND_NUM_ARGS();
-
- if (arg_count<1 || arg_count>3 ||
- zend_get_parameters_ex(arg_count, &variable, &string_val, &walk_to_top) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ctx = SG(server_context);
-
- if (arg_count == 3 && Z_STRVAL_PP(walk_to_top)) {
- while(ctx->f->r->prev) {
- ctx->f->r = ctx->f->r->prev;
- }
- }
-
- convert_to_string_ex(variable);
- convert_to_string_ex(string_val);
-
- apr_table_set(ctx->r->subprocess_env, Z_STRVAL_PP(variable), Z_STRVAL_PP(string_val));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool apache_getenv(string variable [, bool walk_to_top])
- Get an Apache subprocess_env variable */
-PHP_FUNCTION(apache_getenv)
-{
- php_struct *ctx;
- zval **variable=NULL, **walk_to_top=NULL;
- int arg_count = ZEND_NUM_ARGS();
- char *env_val=NULL;
-
- if (arg_count<1 || arg_count>2 ||
- zend_get_parameters_ex(arg_count, &variable, &walk_to_top) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ctx = SG(server_context);
-
- if (arg_count == 2 && Z_STRVAL_PP(walk_to_top)) {
- while(ctx->f->r->prev) {
- ctx->f->r = ctx->f->r->prev;
- }
- }
-
- convert_to_string_ex(variable);
-
- env_val = (char*) apr_table_get(ctx->r->subprocess_env, Z_STRVAL_PP(variable));
- if (env_val != NULL) {
- RETURN_STRING(env_val, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-static char *php_apache_get_version()
-{
- return (char *) ap_get_server_version();
-}
-
-/* {{{ proto string apache_get_version(void)
- Fetch Apache version */
-PHP_FUNCTION(apache_get_version)
-{
- char *apv = php_apache_get_version();
-
- if (apv && *apv) {
- RETURN_STRING(apv, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array apache_get_modules(void)
- Get a list of loaded Apache modules */
-PHP_FUNCTION(apache_get_modules)
-{
- int n;
- char *p;
-
- array_init(return_value);
-
- for (n = 0; ap_loaded_modules[n]; ++n) {
- char *s = (char *) ap_loaded_modules[n]->name;
- if ((p = strchr(s, '.'))) {
- add_next_index_stringl(return_value, s, (p - s), 1);
- } else {
- add_next_index_string(return_value, s, 1);
- }
- }
-}
-/* }}} */
-
-PHP_MINFO_FUNCTION(apache)
-{
- char *apv = php_apache_get_version();
- smart_str tmp1 = {0};
- int n;
- char *p;
-
- for (n = 0; ap_loaded_modules[n]; ++n) {
- char *s = (char *) ap_loaded_modules[n]->name;
- if ((p = strchr(s, '.'))) {
- smart_str_appendl(&tmp1, s, (p - s));
- } else {
- smart_str_appends(&tmp1, s);
- }
- smart_str_appendc(&tmp1, ' ');
- }
- if ((tmp1.len - 1) >= 0) {
- tmp1.c[tmp1.len - 1] = '\0';
- }
-
- php_info_print_table_start();
- if (apv && *apv) {
- php_info_print_table_row(2, "Apache Version", apv);
- }
- php_info_print_table_row(2, "Loaded Modules", tmp1.c);
- smart_str_free(&tmp1);
- php_info_print_table_end();
-}
-
-static function_entry apache_functions[] = {
- PHP_FE(apache_lookup_uri, NULL)
- PHP_FE(virtual, NULL)
- PHP_FE(apache_request_headers, NULL)
- PHP_FE(apache_response_headers, NULL)
- PHP_FE(apache_setenv, NULL)
- PHP_FE(apache_getenv, NULL)
- PHP_FE(apache_note, NULL)
- PHP_FE(apache_get_version, NULL)
- PHP_FE(apache_get_modules, NULL)
- PHP_FALIAS(getallheaders, apache_request_headers, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry php_apache_module = {
- STANDARD_MODULE_HEADER,
- "apache2filter",
- apache_functions,
- NULL,
- NULL,
- NULL,
- NULL,
- PHP_MINFO(apache),
- NULL,
- STANDARD_MODULE_PROPERTIES
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c
deleted file mode 100644
index c530bab8a3..0000000000
--- a/sapi/apache2filter/sapi_apache2.c
+++ /dev/null
@@ -1,698 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- | Parts based on Apache 1.3 SAPI module by |
- | Rasmus Lerdorf and Zeev Suraski |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <fcntl.h>
-
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#include "php.h"
-#include "php_main.h"
-#include "php_ini.h"
-#include "php_variables.h"
-#include "SAPI.h"
-
-#include "ext/standard/php_smart_str.h"
-#ifndef NETWARE
-#include "ext/standard/php_standard.h"
-#else
-#include "ext/standard/basic_functions.h"
-#endif
-
-#include "apr_strings.h"
-#include "ap_config.h"
-#include "util_filter.h"
-#include "httpd.h"
-#include "http_config.h"
-#include "http_request.h"
-#include "http_core.h"
-#include "http_protocol.h"
-#include "http_log.h"
-#include "http_main.h"
-#include "util_script.h"
-#include "http_core.h"
-#include "ap_mpm.h"
-
-#include "php_apache.h"
-
-/* UnixWare and Netware define shutdown to _shutdown, which causes problems later
- * on when using a structure member named shutdown. Since this source
- * file does not use the system call shutdown, it is safe to #undef it.
- */
-#undef shutdown
-
-/* A way to specify the location of the php.ini dir in an apache directive */
-char *apache2_php_ini_path_override = NULL;
-
-static int
-php_apache_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- apr_bucket *b;
- apr_bucket_brigade *bb;
- apr_bucket_alloc_t *ba;
- ap_filter_t *f; /* remaining output filters */
- php_struct *ctx;
-
- ctx = SG(server_context);
- f = ctx->f;
-
- if (str_length == 0) return 0;
-
- ba = f->c->bucket_alloc;
- bb = apr_brigade_create(ctx->r->pool, ba);
-
- b = apr_bucket_transient_create(str, str_length, ba);
- APR_BRIGADE_INSERT_TAIL(bb, b);
-
-#if 0
- /* Add a Flush bucket to the end of this brigade, so that
- * the transient buckets above are more likely to make it out
- * the end of the filter instead of having to be copied into
- * someone's setaside. */
- b = apr_bucket_flush_create(ba);
- APR_BRIGADE_INSERT_TAIL(bb, b);
-#endif
-
- if (ap_pass_brigade(f->next, bb) != APR_SUCCESS) {
- php_handle_aborted_connection();
- }
-
- return str_length; /* we always consume all the data passed to us. */
-}
-
-static int
-php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- php_struct *ctx;
- ap_filter_t *f;
- char *val;
-
- ctx = SG(server_context);
- f = ctx->r->output_filters;
-
- val = strchr(sapi_header->header, ':');
-
- if (!val) {
- sapi_free_header(sapi_header);
- return 0;
- }
-
- *val = '\0';
-
- do {
- val++;
- } while (*val == ' ');
-
- if (!strcasecmp(sapi_header->header, "content-type"))
- ctx->r->content_type = apr_pstrdup(ctx->r->pool, val);
- else if (sapi_header->replace)
- apr_table_set(ctx->r->headers_out, sapi_header->header, val);
- else
- apr_table_add(ctx->r->headers_out, sapi_header->header, val);
-
- sapi_free_header(sapi_header);
-
- return 0;
-}
-
-static int
-php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- php_struct *ctx = SG(server_context);
-
- ctx->r->status = SG(sapi_headers).http_response_code;
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-static int
-php_apache_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC)
-{
- int n;
- int to_read;
- php_struct *ctx = SG(server_context);
-
- to_read = ctx->post_len - ctx->post_idx;
- n = MIN(to_read, count_bytes);
-
- if (n > 0) {
- memcpy(buf, ctx->post_data + ctx->post_idx, n);
- ctx->post_idx += n;
- } else {
- if (ctx->post_data) free(ctx->post_data);
- ctx->post_data = NULL;
- }
-
- return n;
-}
-
-static struct stat*
-php_apache_sapi_get_stat(TSRMLS_D)
-{
- php_struct *ctx = SG(server_context);
-
- ctx->finfo.st_uid = ctx->r->finfo.user;
- ctx->finfo.st_gid = ctx->r->finfo.group;
- ctx->finfo.st_ino = ctx->r->finfo.inode;
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- ctx->finfo.st_atime.tv_sec = ctx->r->finfo.atime/1000000;
- ctx->finfo.st_mtime.tv_sec = ctx->r->finfo.mtime/1000000;
- ctx->finfo.st_ctime.tv_sec = ctx->r->finfo.ctime/1000000;
-#else
- ctx->finfo.st_atime = ctx->r->finfo.atime/1000000;
- ctx->finfo.st_mtime = ctx->r->finfo.mtime/1000000;
- ctx->finfo.st_ctime = ctx->r->finfo.ctime/1000000;
-#endif
-
- ctx->finfo.st_size = ctx->r->finfo.size;
- ctx->finfo.st_nlink = ctx->r->finfo.nlink;
-
- return &ctx->finfo;
-}
-
-static char *
-php_apache_sapi_read_cookies(TSRMLS_D)
-{
- php_struct *ctx = SG(server_context);
- const char *http_cookie;
-
- http_cookie = apr_table_get(ctx->r->headers_in, "cookie");
-
- /* The SAPI interface should use 'const char *' */
- return (char *) http_cookie;
-}
-
-static char *
-php_apache_sapi_getenv(char *name, size_t name_len TSRMLS_DC)
-{
- php_struct *ctx = SG(server_context);
- const char *env_var;
-
- env_var = apr_table_get(ctx->r->subprocess_env, name);
-
- return (char *) env_var;
-}
-
-static void
-php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC)
-{
- php_struct *ctx = SG(server_context);
- const apr_array_header_t *arr = apr_table_elts(ctx->r->subprocess_env);
- char *key, *val;
-
- APR_ARRAY_FOREACH_OPEN(arr, key, val)
- if (!val) val = empty_string;
- php_register_variable(key, val, track_vars_array TSRMLS_CC);
- APR_ARRAY_FOREACH_CLOSE()
-
- php_register_variable("PHP_SELF", ctx->r->uri, track_vars_array TSRMLS_CC);
-
- /* If PATH_TRANSLATED doesn't exist, copy it from SCRIPT_FILENAME */
- if (!zend_hash_exists(Z_ARRVAL_P(track_vars_array), "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"))
- && zend_hash_find(Z_ARRVAL_P(track_vars_array), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &path_translated_zv) == SUCCESS) {
- php_register_variable("PATH_TRANSLATED", Z_STRVAL_PP(path_translated_zv), track_vars_array TSRMLS_CC);
- }
-}
-
-static void
-php_apache_sapi_flush(void *server_context)
-{
- php_struct *ctx;
- apr_bucket_brigade *bb;
- apr_bucket_alloc_t *ba;
- apr_bucket *b;
- ap_filter_t *f; /* output filters */
-
- ctx = server_context;
-
- /* If we haven't registered a server_context yet,
- * then don't bother flushing. */
- if (!server_context)
- return;
-
- f = ctx->f;
-
- /* Send a flush bucket down the filter chain. The current default
- * handler seems to act on the first flush bucket, but ignores
- * all further flush buckets.
- */
-
- ba = ctx->r->connection->bucket_alloc;
- bb = apr_brigade_create(ctx->r->pool, ba);
- b = apr_bucket_flush_create(ba);
- APR_BRIGADE_INSERT_TAIL(bb, b);
- if (ap_pass_brigade(f->next, bb) != APR_SUCCESS) {
- php_handle_aborted_connection();
- }
-}
-
-static void php_apache_sapi_log_message(char *msg)
-{
- php_struct *ctx;
- TSRMLS_FETCH();
-
- ctx = SG(server_context);
-
- /* We use APLOG_STARTUP because it keeps us from printing the
- * data and time information at the beginning of the error log
- * line. Not sure if this is correct, but it mirrors what happens
- * with Apache 1.3 -- rbb
- */
- if (ctx == NULL) { /* we haven't initialized our ctx yet, oh well */
- ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO | APLOG_STARTUP,
- 0, NULL, "%s", msg);
- }
- else {
- ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO | APLOG_STARTUP,
- 0, ctx->r->server, "%s", msg);
- }
-}
-
-static int
-php_apache_disable_caching(ap_filter_t *f)
-{
- /* Identify PHP scripts as non-cacheable, thus preventing
- * Apache from sending a 304 status when the browser sends
- * If-Modified-Since header.
- */
- f->r->no_local_copy = 1;
-
- return OK;
-}
-
-extern zend_module_entry php_apache_module;
-
-static int php_apache2_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, &php_apache_module, 1)==FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-static sapi_module_struct apache2_sapi_module = {
- "apache2filter",
- "Apache 2.0 Filter",
-
- php_apache2_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- php_apache_sapi_ub_write, /* unbuffered write */
- php_apache_sapi_flush, /* flush */
- php_apache_sapi_get_stat, /* get uid */
- php_apache_sapi_getenv, /* getenv */
-
- php_error, /* error handler */
-
- php_apache_sapi_header_handler, /* header handler */
- php_apache_sapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- php_apache_sapi_read_post, /* read POST data */
- php_apache_sapi_read_cookies, /* read Cookies */
-
- php_apache_sapi_register_variables,
- php_apache_sapi_log_message, /* Log message */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-static int php_input_filter(ap_filter_t *f, apr_bucket_brigade *bb,
- ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes)
-{
- php_struct *ctx;
- long old_index;
- apr_bucket *b;
- const char *str;
- apr_size_t n;
- apr_status_t rv;
- TSRMLS_FETCH();
-
- if (f->r->proxyreq) {
- return ap_get_brigade(f->next, bb, mode, block, readbytes);
- }
-
- ctx = SG(server_context);
- if (ctx == NULL) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, f->r,
- "php failed to get server context");
- return HTTP_INTERNAL_SERVER_ERROR;
- }
-
- if ((rv = ap_get_brigade(f->next, bb, mode, block, readbytes)) != APR_SUCCESS) {
- return rv;
- }
-
- for (b = APR_BRIGADE_FIRST(bb); b != APR_BRIGADE_SENTINEL(bb); b = APR_BUCKET_NEXT(b)) {
- apr_bucket_read(b, &str, &n, 1);
- if (n > 0) {
- old_index = ctx->post_len;
- ctx->post_len += n;
- ctx->post_data = realloc(ctx->post_data, ctx->post_len + 1);
- memcpy(ctx->post_data + old_index, str, n);
- }
- }
- return APR_SUCCESS;
-}
-
-static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx TSRMLS_DC)
-{
- char *content_type;
- const char *auth;
-
- PG(during_request_startup) = 0;
- SG(sapi_headers).http_response_code = 200;
- SG(request_info).content_type = apr_table_get(f->r->headers_in, "Content-Type");
-#undef safe_strdup
-#define safe_strdup(x) ((x)?strdup((x)):NULL)
- SG(request_info).query_string = safe_strdup(f->r->args);
- SG(request_info).request_method = f->r->method;
- SG(request_info).request_uri = safe_strdup(f->r->uri);
- SG(request_info).path_translated = safe_strdup(f->r->filename);
- f->r->no_local_copy = 1;
- content_type = sapi_get_default_content_type(TSRMLS_C);
- f->r->content_type = apr_pstrdup(f->r->pool, content_type);
- SG(request_info).post_data = ctx->post_data;
- SG(request_info).post_data_length = ctx->post_len;
-
- efree(content_type);
- apr_table_unset(f->r->headers_out, "Content-Length");
- apr_table_unset(f->r->headers_out, "Last-Modified");
- apr_table_unset(f->r->headers_out, "Expires");
- apr_table_unset(f->r->headers_out, "ETag");
- apr_table_unset(f->r->headers_in, "Connection");
-
- if (!PG(safe_mode) || (PG(safe_mode) && !ap_auth_type(f->r))) {
- auth = apr_table_get(f->r->headers_in, "Authorization");
- php_handle_auth_data(auth TSRMLS_CC);
- } else {
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
- }
- php_request_startup(TSRMLS_C);
-}
-
-static void php_apache_request_dtor(ap_filter_t *f TSRMLS_DC)
-{
- php_request_shutdown(NULL);
-
- if (SG(request_info).query_string) {
- free(SG(request_info).query_string);
- }
- if (SG(request_info).request_uri) {
- free(SG(request_info).request_uri);
- }
-}
-
-static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
-{
- php_struct *ctx;
- apr_bucket *b;
- void *conf = ap_get_module_config(f->r->per_dir_config, &php5_module);
- char *p = get_php_config(conf, "engine", sizeof("engine"));
- TSRMLS_FETCH();
-
- if (f->r->proxyreq) {
- return ap_pass_brigade(f->next, bb);
- }
-
- /* handle situations where user turns the engine off */
- if (*p == '0') {
- return ap_pass_brigade(f->next, bb);
- }
-
- /* setup standard CGI variables */
- ap_add_common_vars(f->r);
- ap_add_cgi_vars(f->r);
-
- ctx = SG(server_context);
- if (ctx == NULL) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, f->r,
- "php failed to get server context");
- return HTTP_INTERNAL_SERVER_ERROR;
- }
- ctx->f = f; /* save whatever filters are after us in the chain. */
-
- if (ctx->request_processed) {
- return ap_pass_brigade(f->next, bb);
- }
-
- for (b = APR_BRIGADE_FIRST(bb); b != APR_BRIGADE_SENTINEL(bb); b = APR_BUCKET_NEXT(b)) {
- zend_file_handle zfd;
-
- if (!ctx->request_processed && APR_BUCKET_IS_FILE(b)) {
- const char *path;
- apr_bucket_brigade *prebb = bb;
-
- /* Split the brigade into two brigades before and after
- * the file bucket. Leave the "after the FILE" brigade
- * in the original bb, so it gets passed outside of this
- * loop. */
- bb = apr_brigade_split(prebb, b);
-
- /* Pass the "before the FILE" brigade here
- * (if it's non-empty). */
- if (!APR_BRIGADE_EMPTY(prebb)) {
- apr_status_t rv;
- rv = ap_pass_brigade(f->next, prebb);
- /* XXX: destroy the prebb, since we know we're
- * done with it? */
- if (rv != APR_SUCCESS) {
- php_handle_aborted_connection();
- }
- }
-
- apply_config(conf);
- php_apache_request_ctor(f, ctx TSRMLS_CC);
-
- apr_file_name_get(&path, ((apr_bucket_file *) b->data)->fd);
-
- /* Determine if we need to parse the file or show the source */
- if (strncmp(ctx->r->handler, "application/x-httpd-php-source", sizeof("application/x-httpd-php-source"))) {
- zfd.type = ZEND_HANDLE_FILENAME;
- zfd.filename = (char *) path;
- zfd.free_filename = 0;
- zfd.opened_path = NULL;
-
- php_execute_script(&zfd TSRMLS_CC);
-#if MEMORY_LIMIT
- {
- char *mem_usage;
-
- mem_usage = apr_psprintf(ctx->r->pool, "%u", AG(allocated_memory_peak));
- AG(allocated_memory_peak) = 0;
- apr_table_set(ctx->r->notes, "mod_php_memory_usage", mem_usage);
- }
-#endif
- } else {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- php_get_highlight_struct(&syntax_highlighter_ini);
-
- highlight_file((char *)path, &syntax_highlighter_ini TSRMLS_CC);
- }
-
- php_apache_request_dtor(f TSRMLS_CC);
-
- if (!f->r->main) {
- ctx->request_processed = 1;
- }
-
- /* Delete the FILE bucket from the brigade. */
- apr_bucket_delete(b);
-
- /* We won't handle any more buckets in this brigade, so
- * it's ok to break out now. */
- break;
- }
- }
-
- /* Pass whatever is left on the brigade. */
- return ap_pass_brigade(f->next, bb);
-}
-
-static apr_status_t
-php_apache_server_shutdown(void *tmp)
-{
- apache2_sapi_module.shutdown(&apache2_sapi_module);
- sapi_shutdown();
-#ifdef ZTS
- tsrm_shutdown();
-#endif
- return APR_SUCCESS;
-}
-
-static void php_apache_add_version(apr_pool_t *p)
-{
- TSRMLS_FETCH();
- if (PG(expose_php)) {
- ap_add_version_component(p, "PHP/" PHP_VERSION);
- }
-}
-
-static int php_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
-{
-#ifndef ZTS
- int threaded_mpm;
-
- ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded_mpm);
- if(threaded_mpm) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, 0, 0, "Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.");
- return DONE;
- }
-#endif
- /* When this is NULL, apache won't override the hard-coded default
- * php.ini path setting. */
- apache2_php_ini_path_override = NULL;
- return OK;
-}
-
-static int
-php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog,
- apr_pool_t *ptemp, server_rec *s)
-{
- void *data = NULL;
- const char *userdata_key = "apache2filter_post_config";
-
- /* Apache will load, unload and then reload a DSO module. This
- * prevents us from starting PHP until the second load. */
- apr_pool_userdata_get(&data, userdata_key, s->process->pool);
- if (data == NULL) {
- /* We must use set() here and *not* setn(), otherwise the
- * static string pointed to by userdata_key will be mapped
- * to a different location when the DSO is reloaded and the
- * pointers won't match, causing get() to return NULL when
- * we expected it to return non-NULL. */
- apr_pool_userdata_set((const void *)1, userdata_key,
- apr_pool_cleanup_null, s->process->pool);
- return OK;
- }
-
- /* Set up our overridden path. */
- if (apache2_php_ini_path_override) {
- apache2_sapi_module.php_ini_path_override = apache2_php_ini_path_override;
- }
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
-#endif
- sapi_startup(&apache2_sapi_module);
- apache2_sapi_module.startup(&apache2_sapi_module);
- apr_pool_cleanup_register(pconf, NULL, php_apache_server_shutdown, apr_pool_cleanup_null);
- php_apache_add_version(pconf);
-
- return OK;
-}
-
-static void php_add_filter(request_rec *r, ap_filter_t *f)
-{
- int output = (f == r->output_filters);
-
- /* for those who still have Set*Filter PHP configured */
- while (f) {
- if (strcmp(f->frec->name, "PHP") == 0) {
- ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO,
- 0, r->server,
- "\"Set%sFilter PHP\" already configured for %s",
- output ? "Output" : "Input", r->uri);
- return;
- }
- f = f->next;
- }
-
- if (output) {
- ap_add_output_filter("PHP", NULL, r, r->connection);
- } else {
- ap_add_input_filter("PHP", NULL, r, r->connection);
- }
-}
-
-static void php_insert_filter(request_rec *r)
-{
- int content_type_len = strlen("application/x-httpd-php");
-
- if (r->content_type && !strncmp(r->content_type, "application/x-httpd-php", content_type_len-1)) {
- if (r->content_type[content_type_len] == '\0' || !strncmp(r->content_type+content_type_len, "-source", sizeof("-source"))) {
- php_add_filter(r, r->output_filters);
- php_add_filter(r, r->input_filters);
- }
- }
-}
-
-static apr_status_t php_server_context_cleanup(void *data_)
-{
- void **data = data_;
- *data = NULL;
- return APR_SUCCESS;
-}
-
-static int php_post_read_request(request_rec *r)
-{
- php_struct *ctx;
- TSRMLS_FETCH();
-
- /* Initialize filter context */
- SG(server_context) = ctx = apr_pcalloc(r->pool, sizeof(*ctx));
-
- /* register a cleanup so we clear out the SG(server_context)
- * after each request. Note: We pass in the pointer to the
- * server_context in case this is handled by a different thread. */
- apr_pool_cleanup_register(r->pool, (void *)&SG(server_context),
- php_server_context_cleanup,
- apr_pool_cleanup_null);
-
- /* Save the entire request, so we can get the input or output
- * filters if we need them. */
- ctx->r = r;
-
- return OK;
-}
-
-static void php_register_hook(apr_pool_t *p)
-{
- ap_hook_pre_config(php_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
- ap_hook_post_config(php_apache_server_startup, NULL, NULL, APR_HOOK_MIDDLE);
- ap_hook_insert_filter(php_insert_filter, NULL, NULL, APR_HOOK_MIDDLE);
- ap_hook_post_read_request(php_post_read_request, NULL, NULL, APR_HOOK_MIDDLE);
- ap_register_output_filter("PHP", php_output_filter, php_apache_disable_caching, AP_FTYPE_RESOURCE);
- ap_register_input_filter("PHP", php_input_filter, php_apache_disable_caching, AP_FTYPE_RESOURCE);
-}
-
-AP_MODULE_DECLARE_DATA module php5_module = {
- STANDARD20_MODULE_STUFF,
- create_php_config, /* create per-directory config structure */
- merge_php_config, /* merge per-directory config structures */
- NULL, /* create per-server config structure */
- NULL, /* merge per-server config structures */
- php_dir_cmds, /* command apr_table_t */
- php_register_hook /* register hooks */
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/apache2handler/CREDITS b/sapi/apache2handler/CREDITS
deleted file mode 100644
index 4a7848053c..0000000000
--- a/sapi/apache2handler/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Apache 2.0 Handler
-Ian Holsman, Justin Erenkrantz (based on Apache 2.0 Filter code)
diff --git a/sapi/apache2handler/EXPERIMENTAL b/sapi/apache2handler/EXPERIMENTAL
deleted file mode 100644
index 293159a693..0000000000
--- a/sapi/apache2handler/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this module is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/sapi/apache2handler/README b/sapi/apache2handler/README
deleted file mode 100644
index 5cbd1b95dd..0000000000
--- a/sapi/apache2handler/README
+++ /dev/null
@@ -1,76 +0,0 @@
-WHAT IS THIS?
-
- This module exploits the layered I/O support in Apache 2.0.
-
-HOW DOES IT WORK?
-
- In Apache 2.0, you have handlers which generate content (like
- reading a script from disk). The content goes then through
- a chain of filters. PHP can be such a filter, so that it processes
- your script and hands the output to the next filter (which will
- usually cause a write to the network).
-
-DOES IT WORK?
-
- Currently the issues with the module are:
- * Thread safety of external PHP modules
- * The lack of re-entrancy of PHP. due to this I have disabled the 'virtual'
- function, and tried to stop any method where a php script can run another php
- script while it is being run.
-
-
-HOW TO INSTALL
-
- This SAPI module is known to work with Apache 2.0.44.
-
- $ cd apache-2.x
- $ cd src
- $ ./configure --enable-so
- $ make install
-
- For testing purposes, you might want to use --with-mpm=prefork.
- (Albeit PHP also works with threaded MPMs. See Thread Safety note above)
-
- Configure PHP 4:
-
- $ cd php-4.x
- $ ./configure --with-apxs2=/path/to/apache-2.0/bin/apxs
- $ make install
-
- At the end of conf/httpd.conf, add:
-
- AddType application/x-httpd-php .php
-
- If you would like to enable source code highlighting functionality add:
-
- AddType application/x-httpd-php-source .phps
-
- That's it. Now start bin/httpd.
-
-HOW TO CONFIGURE
-
- The Apache 2.0 PHP module supports a new configuration directive that
- allows an admin to override the php.ini search path. For example,
- place your php.ini file in Apache's ServerRoot/conf directory and
- add this to your httpd.conf file:
-
- PHPINIDir "conf"
-
-DEBUGGING APACHE AND PHP
-
- To debug Apache, we recommened:
-
- 1. Use the Prefork MPM (Apache 1.3-like process model) by
- configuring Apache with '--with-mpm=prefork'.
- 2. Start httpd using -DONE_PROCESS (e.g. (gdb) r -DONE_PROCESS).
-
- If you want to debug a part of the PHP startup procedure, set a
- breakpoint on 'load_module'. Step through it until apr_dso_load() is
- done. Then you can set a breakpoint on any PHP-related symbol.
-
-TODO
-
- PHP functions like apache_sub_req (see php_functions.c)
- Source Code Highlighting
- Protocol handlers
-
diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c
deleted file mode 100644
index 01c8fb58bc..0000000000
--- a/sapi/apache2handler/apache_config.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_apache.h"
-
-#include "apr_strings.h"
-#include "ap_config.h"
-#include "util_filter.h"
-#include "httpd.h"
-#include "http_config.h"
-#include "http_request.h"
-#include "http_core.h"
-#include "http_protocol.h"
-#include "http_log.h"
-#include "http_main.h"
-#include "util_script.h"
-#include "http_core.h"
-
-#ifdef PHP_AP_DEBUG
-#define phpapdebug(a) fprintf a
-#else
-#define phpapdebug(a)
-#endif
-
-typedef struct {
- HashTable config;
-} php_conf_rec;
-
-typedef struct {
- char *value;
- size_t value_len;
- char status;
-} php_dir_entry;
-
-static const char *real_value_hnd(cmd_parms *cmd, void *dummy, const char *name, const char *value, int status)
-{
- php_conf_rec *d = dummy;
- php_dir_entry e;
-
- phpapdebug((stderr, "Getting %s=%s for %p (%d)\n", name, value, dummy, zend_hash_num_elements(&d->config)));
-
- if (!strncasecmp(value, "none", sizeof("none"))) {
- value = "";
- }
-
- e.value = apr_pstrdup(cmd->pool, value);
- e.value_len = strlen(value);
- e.status = status;
-
- zend_hash_update(&d->config, (char *) name, strlen(name) + 1, &e, sizeof(e), NULL);
- return NULL;
-}
-
-static const char *php_apache_value_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value)
-{
- return real_value_hnd(cmd, dummy, name, value, PHP_INI_PERDIR);
-}
-
-static const char *php_apache_admin_value_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value)
-{
- return real_value_hnd(cmd, dummy, name, value, PHP_INI_SYSTEM);
-}
-
-static const char *real_flag_hnd(cmd_parms *cmd, void *dummy, const char *arg1, const char *arg2, int status)
-{
- char bool_val[2];
-
- if (!strcasecmp(arg2, "On") || (arg2[0] == '1' && arg2[1] == '\0')) {
- bool_val[0] = '1';
- } else {
- bool_val[0] = '0';
- }
- bool_val[1] = 0;
-
- return real_value_hnd(cmd, dummy, arg1, bool_val, status);
-}
-
-static const char *php_apache_flag_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value)
-{
- return real_flag_hnd(cmd, dummy, name, value, PHP_INI_PERDIR);
-}
-
-static const char *php_apache_admin_flag_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value)
-{
- return real_flag_hnd(cmd, dummy, name, value, PHP_INI_SYSTEM);
-}
-
-static const char *php_apache_phpini_set(cmd_parms *cmd, void *mconfig, const char *arg)
-{
- if (apache2_php_ini_path_override) {
- return "Only first PHPINIDir directive honored per configuration tree - subsequent ones ignored";
- }
- apache2_php_ini_path_override = ap_server_root_relative(cmd->pool, arg);
- return NULL;
-}
-
-
-void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
-{
- php_conf_rec *d = base_conf, *e = new_conf;
- php_dir_entry *pe;
- php_dir_entry *data;
- char *str;
- uint str_len;
- ulong num_index;
-
- phpapdebug((stderr, "Merge dir (%p) (%p)\n", base_conf, new_conf));
- for (zend_hash_internal_pointer_reset(&d->config);
- zend_hash_get_current_key_ex(&d->config, &str, &str_len,
- &num_index, 0, NULL) == HASH_KEY_IS_STRING;
- zend_hash_move_forward(&d->config)) {
- pe = NULL;
- zend_hash_get_current_data(&d->config, (void **) &data);
- if (zend_hash_find(&e->config, str, str_len, (void **) &pe) == SUCCESS) {
- if (pe->status >= data->status) continue;
- }
- zend_hash_update(&e->config, str, str_len, data, sizeof(*data), NULL);
- phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", str, data->status, pe?pe->status:-1));
- }
- return new_conf;
-}
-
-char *get_php_config(void *conf, char *name, size_t name_len)
-{
- php_conf_rec *d = conf;
- php_dir_entry *pe;
-
- if (zend_hash_find(&d->config, name, name_len, (void **) &pe) == SUCCESS) {
- return pe->value;
- }
-
- return "";
-}
-
-void apply_config(void *dummy)
-{
- php_conf_rec *d = dummy;
- char *str;
- uint str_len;
- php_dir_entry *data;
-
- for (zend_hash_internal_pointer_reset(&d->config);
- zend_hash_get_current_key_ex(&d->config, &str, &str_len, NULL, 0,
- NULL) == HASH_KEY_IS_STRING;
- zend_hash_move_forward(&d->config)) {
- zend_hash_get_current_data(&d->config, (void **) &data);
- phpapdebug((stderr, "APPLYING (%s)(%s)\n", str, data->value));
- if (zend_alter_ini_entry(str, str_len, data->value, data->value_len, data->status, PHP_INI_STAGE_RUNTIME) == FAILURE) {
- phpapdebug((stderr, "..FAILED\n"));
- }
- }
-}
-
-const command_rec php_dir_cmds[] =
-{
- AP_INIT_TAKE2("php_value", php_apache_value_handler, NULL, OR_OPTIONS, "PHP Value Modifier"),
- AP_INIT_TAKE2("php_flag", php_apache_flag_handler, NULL, OR_OPTIONS, "PHP Flag Modifier"),
- AP_INIT_TAKE2("php_admin_value", php_apache_admin_value_handler, NULL, ACCESS_CONF|RSRC_CONF, "PHP Value Modifier (Admin)"),
- AP_INIT_TAKE2("php_admin_flag", php_apache_admin_flag_handler, NULL, ACCESS_CONF|RSRC_CONF, "PHP Flag Modifier (Admin)"),
- AP_INIT_TAKE1("PHPINIDir", php_apache_phpini_set, NULL, RSRC_CONF, "Directory containing the php.ini file"),
- {NULL}
-};
-
-static apr_status_t destroy_php_config(void *data)
-{
- php_conf_rec *d = data;
-
- phpapdebug((stderr, "Destroying config %p\n", data));
- zend_hash_destroy(&d->config);
-
- return APR_SUCCESS;
-}
-
-void *create_php_config(apr_pool_t *p, char *dummy)
-{
- php_conf_rec *newx = (php_conf_rec *) apr_pcalloc(p, sizeof(*newx));
-
- phpapdebug((stderr, "Creating new config (%p) for %s\n", newx, dummy));
- zend_hash_init(&newx->config, 0, NULL, NULL, 1);
- apr_pool_cleanup_register(p, newx, destroy_php_config, apr_pool_cleanup_null);
- return (void *) newx;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4
deleted file mode 100644
index 269bb59484..0000000000
--- a/sapi/apache2handler/config.m4
+++ /dev/null
@@ -1,118 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_MSG_CHECKING(for Apache 2.0 handler-module support via DSO through APXS)
-AC_ARG_WITH(apxs2,
-[ --with-apxs2[=FILE] EXPERIMENTAL: Build shared Apache 2.0 module. FILE is the optional
- pathname to the Apache apxs tool; defaults to "apxs".],[
- if test "$withval" = "yes"; then
- APXS=apxs
- $APXS -q CFLAGS >/dev/null 2>&1
- if test "$?" != "0" && test -x /usr/sbin/apxs; then
- APXS=/usr/sbin/apxs
- fi
- else
- PHP_EXPAND_PATH($withval, APXS)
- fi
-
- $APXS -q CFLAGS >/dev/null 2>&1
- if test "$?" != "0"; then
- AC_MSG_RESULT()
- AC_MSG_RESULT()
- AC_MSG_RESULT([Sorry, I cannot run apxs. Possible reasons follow:])
- AC_MSG_RESULT()
- AC_MSG_RESULT([1. Perl is not installed])
- AC_MSG_RESULT([2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs])
- AC_MSG_RESULT([3. Apache was not built using --enable-so (the apxs usage page is displayed)])
- AC_MSG_RESULT()
- AC_MSG_RESULT([The output of $APXS follows:])
- $APXS
- AC_MSG_ERROR([Aborting])
- fi
-
- APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR`
- APXS_HTTPD=`$APXS -q SBINDIR`/`$APXS -q TARGET`
- APXS_CFLAGS=`$APXS -q CFLAGS`
- APXS_MPM=`$APXS -q MPM_NAME`
-
- for flag in $APXS_CFLAGS; do
- case $flag in
- -D*) CPPFLAGS="$CPPFLAGS $flag";;
- esac
- done
-
- # Test that we're trying to configure with apache 2.x
- PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
- if test "$APACHE_VERSION" -le 2000000; then
- AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropiate switch --with-apxs (without the 2)])
- elif test "$APACHE_VERSION" -lt 2000044; then
- AC_MSG_ERROR([Please note that Apache version >= 2.0.44 is required.])
- fi
-
- APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
- if test -z `$APXS -q SYSCONFDIR`; then
- INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
- $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
- -i -n php5"
- else
- APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
- INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
- \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
- $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
- -S SYSCONFDIR='$APXS_SYSCONFDIR' \
- -i -a -n php5"
- fi
-
- case $host_alias in
- *aix*)
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-brtl -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp"
- PHP_SELECT_SAPI(apache2handler, shared, sapi_apache2.c apache_config.c php_functions.c)
- INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
- ;;
- *darwin*)
- dnl When using bundles on Darwin, we must resolve all symbols. However,
- dnl the linker does not recursively look at the bundle loader and
- dnl pull in its dependencies. Therefore, we must pull in the APR
- dnl and APR-util libraries.
- APXS_BINDIR=`$APXS -q BINDIR`
- if test -f $APXS_BINDIR/apr-config; then
- MH_BUNDLE_FLAGS="`$APXS_BINDIR/apr-config --ldflags --link-ld --libs`"
- fi
- if test -f $APXS_BINDIR/apu-config; then
- MH_BUNDLE_FLAGS="`$APXS_BINDIR/apu-config --ldflags --link-ld --libs` $MH_BUNDLE_FLAGS"
- fi
- MH_BUNDLE_FLAGS="-bundle -bundle_loader $APXS_HTTPD $MH_BUNDLE_FLAGS"
- PHP_SUBST(MH_BUNDLE_FLAGS)
- PHP_SELECT_SAPI(apache2handler, bundle, sapi_apache2.c apache_config.c php_functions.c)
- SAPI_SHARED=libs/libphp5.so
- INSTALL_IT="$INSTALL_IT $SAPI_SHARED"
- ;;
- *beos*)
- APXS_BINDIR=`$APXS -q BINDIR`
- if test -f _APP_; then `rm _APP_`; fi
- `ln -s $APXS_BINDIR/httpd _APP_`
- EXTRA_LIBS="$EXTRA_LIBS _APP_"
- PHP_SELECT_SAPI(apache2handler, shared, sapi_apache2.c apache_config.c php_functions.c)
- INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
- ;;
- *)
- PHP_SELECT_SAPI(apache2handler, shared, sapi_apache2.c apache_config.c php_functions.c)
- INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
- ;;
- esac
-
- PHP_ADD_INCLUDE($APXS_INCLUDEDIR)
- if test "$APXS_MPM" != "prefork"; then
- PHP_BUILD_THREAD_SAFE
- fi
- AC_MSG_RESULT(yes)
-],[
- AC_MSG_RESULT(no)
-])
-
-PHP_SUBST(APXS)
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/apache2handler/php.sym b/sapi/apache2handler/php.sym
deleted file mode 100644
index 9ad0f0a0ad..0000000000
--- a/sapi/apache2handler/php.sym
+++ /dev/null
@@ -1 +0,0 @@
-php5_module
diff --git a/sapi/apache2handler/php4apache2.dsp b/sapi/apache2handler/php4apache2.dsp
deleted file mode 100644
index 6bb191e862..0000000000
--- a/sapi/apache2handler/php4apache2.dsp
+++ /dev/null
@@ -1,142 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4apache2" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4apache2 - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4apache2.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4apache2.mak" CFG="php4apache2 - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4apache2 - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4apache2 - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4apache2 - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4apache2 - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_APACHE2_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /D "_WINSOCK2API_" /D "_MSWSOCK_" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib libhttpd.lib libapr.lib libaprutil.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4apache2 - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS_inline"
-# PROP BASE Intermediate_Dir "Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_APACHE2_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /D "_WINSOCK2API_" /D "_MSWSOCK_" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib libhttpd.lib libapr.lib libaprutil.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS_inline/php4apache2.dll" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4apache2 - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_APACHE2_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /D "_WINSOCK2API_" /D "_MSWSOCK_" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib libhttpd.lib libapr.lib libaprutil.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4apache2 - Win32 Release_TS"
-# Name "php4apache2 - Win32 Release_TS_inline"
-# Name "php4apache2 - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\apache_config.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\sapi_apache2.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_apache.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h
deleted file mode 100644
index 106efacf3d..0000000000
--- a/sapi/apache2handler/php_apache.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_APACHE_H
-#define PHP_APACHE_H
-
-#include "httpd.h"
-#include "http_config.h"
-#include "http_core.h"
-
-/* Declare this so we can get to it from outside the sapi_apache2.c file */
-extern module AP_MODULE_DECLARE_DATA php5_module;
-
-/* A way to specify the location of the php.ini dir in an apache directive */
-extern char *apache2_php_ini_path_override;
-
-/* The server_context used by PHP */
-typedef struct php_struct {
- int state;
- request_rec *r;
- apr_bucket_brigade *brigade;
- /* stat structure of the current file */
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- struct stat_libc finfo;
-#else
- struct stat finfo;
-#endif
- /* Whether or not we've processed PHP in the output filters yet. */
- int request_processed;
-} php_struct;
-
-void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf);
-void *create_php_config(apr_pool_t *p, char *dummy);
-char *get_php_config(void *conf, char *name, size_t name_len);
-void apply_config(void *);
-extern const command_rec php_dir_cmds[];
-
-#define APR_ARRAY_FOREACH_OPEN(arr, key, val) \
-{ \
- apr_table_entry_t *elts; \
- int i; \
- elts = (apr_table_entry_t *) arr->elts; \
- for (i = 0; i < arr->nelts; i++) { \
- key = elts[i].key; \
- val = elts[i].val;
-
-#define APR_ARRAY_FOREACH_CLOSE() }}
-
-typedef struct {
- long engine;
- long xbithack;
- long last_modified;
-} php_apache2_info_struct;
-
-extern zend_module_entry apache2_module_entry;
-
-#ifdef ZTS
-extern int php_apache2_info_id;
-#define AP2(v) TSRMG(php_apache2_info_id, php_apache2_info_struct *, v)
-#else
-extern php_apache2_info_struct php_apache2_info;
-#define AP2(v) (php_apache2_info.v)
-#endif
-
-
-#endif /* PHP_APACHE_H */
diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c
deleted file mode 100644
index 095845cd62..0000000000
--- a/sapi/apache2handler/php_functions.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#include "php.h"
-#include "ext/standard/php_smart_str.h"
-#include "ext/standard/info.h"
-#include "ext/standard/head.h"
-#include "php_ini.h"
-#include "SAPI.h"
-
-#define CORE_PRIVATE
-#include "apr_strings.h"
-#include "apr_time.h"
-#include "ap_config.h"
-#include "util_filter.h"
-#include "httpd.h"
-#include "http_config.h"
-#include "http_request.h"
-#include "http_core.h"
-#include "http_protocol.h"
-#include "http_log.h"
-#include "http_main.h"
-#include "util_script.h"
-#include "http_core.h"
-#if !defined(WIN32) && !defined(WINNT)
-#include "unixd.h"
-#endif
-
-#include "php_apache.h"
-
-#ifdef ZTS
-int php_apache2_info_id;
-#else
-php_apache2_info_struct php_apache2_info;
-#endif
-
-#define SECTION(name) PUTS("<h2>" name "</h2>\n")
-
-static request_rec *php_apache_lookup_uri(char *filename TSRMLS_DC)
-{
- php_struct *ctx;
-
- if (!filename) {
- return NULL;
- }
-
- ctx = SG(server_context);
- return ap_sub_req_lookup_uri(filename, ctx->r, ctx->r->output_filters);
-}
-
-/* {{{ proto bool virtual(string uri)
- Perform an apache sub-request */
-PHP_FUNCTION(virtual)
-{
- zval **filename;
- request_rec *rr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(filename);
-
-
- if (!(rr = php_apache_lookup_uri(Z_STRVAL_PP(filename) TSRMLS_CC))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - URI lookup failed", Z_STRVAL_PP(filename));
- RETURN_FALSE;
- }
-
- if (rr->status != HTTP_OK) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - error finding URI", Z_STRVAL_PP(filename));
- ap_destroy_sub_req(rr);
- RETURN_FALSE;
- }
-
- /* Flush everything. */
- php_end_ob_buffers(1 TSRMLS_CC);
- php_header(TSRMLS_C);
-
- if (ap_run_sub_req(rr)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - request execution failed", Z_STRVAL_PP(filename));
- ap_destroy_sub_req(rr);
- RETURN_FALSE;
- }
- ap_destroy_sub_req(rr);
- RETURN_TRUE;
-}
-/* }}} */
-
-#define ADD_LONG(name) \
- add_property_long(return_value, #name, rr->name)
-#define ADD_TIME(name) \
- add_property_long(return_value, #name, rr->name / APR_USEC_PER_SEC);
-#define ADD_STRING(name) \
- if (rr->name) add_property_string(return_value, #name, (char *) rr->name, 1)
-
-PHP_FUNCTION(apache_lookup_uri)
-{
- request_rec *rr;
- zval **filename;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(filename);
-
- if (!(rr = php_apache_lookup_uri(Z_STRVAL_PP(filename) TSRMLS_CC))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - URI lookup failed", Z_STRVAL_PP(filename));
- RETURN_FALSE;
- }
-
- if (rr->status == HTTP_OK) {
- object_init(return_value);
-
- ADD_LONG(status);
- ADD_STRING(the_request);
- ADD_STRING(status_line);
- ADD_STRING(method);
- ADD_TIME(mtime);
- ADD_LONG(clength);
-#if MODULE_MAGIC_NUMBER < 20020506
- ADD_STRING(boundary);
-#endif
- ADD_STRING(range);
- ADD_LONG(chunked);
- ADD_STRING(content_type);
- ADD_STRING(handler);
- ADD_LONG(no_cache);
- ADD_LONG(no_local_copy);
- ADD_STRING(unparsed_uri);
- ADD_STRING(uri);
- ADD_STRING(filename);
- ADD_STRING(path_info);
- ADD_STRING(args);
- ADD_LONG(allowed);
- ADD_LONG(sent_bodyct);
- ADD_LONG(bytes_sent);
- ADD_LONG(request_time);
- ADD_LONG(mtime);
- ADD_TIME(request_time);
-
- ap_destroy_sub_req(rr);
- return;
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - error finding URI", Z_STRVAL_PP(filename));
- ap_destroy_sub_req(rr);
- RETURN_FALSE;
-}
-
-/* {{{ proto array getallheaders(void)
- Fetch all HTTP request headers */
-PHP_FUNCTION(apache_request_headers)
-{
- php_struct *ctx;
- const apr_array_header_t *arr;
- char *key, *val;
-
- array_init(return_value);
-
- ctx = SG(server_context);
- arr = apr_table_elts(ctx->r->headers_in);
-
- APR_ARRAY_FOREACH_OPEN(arr, key, val)
- if (!val) val = empty_string;
- add_assoc_string(return_value, key, val, 1);
- APR_ARRAY_FOREACH_CLOSE()
-}
-/* }}} */
-
-/* {{{ proto array apache_response_headers(void)
- Fetch all HTTP response headers */
-PHP_FUNCTION(apache_response_headers)
-{
- php_struct *ctx;
- const apr_array_header_t *arr;
- char *key, *val;
-
- array_init(return_value);
-
- ctx = SG(server_context);
- arr = apr_table_elts(ctx->r->headers_out);
-
- APR_ARRAY_FOREACH_OPEN(arr, key, val)
- if (!val) val = empty_string;
- add_assoc_string(return_value, key, val, 1);
- APR_ARRAY_FOREACH_CLOSE()
-}
-/* }}} */
-
-/* {{{ proto string apache_note(string note_name [, string note_value])
- Get and set Apache request notes */
-PHP_FUNCTION(apache_note)
-{
- php_struct *ctx;
- zval **note_name, **note_val;
- char *old_note_val=NULL;
- int arg_count = ZEND_NUM_ARGS();
-
- if (arg_count<1 || arg_count>2 ||
- zend_get_parameters_ex(arg_count, &note_name, &note_val) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ctx = SG(server_context);
-
- convert_to_string_ex(note_name);
-
- old_note_val = (char *) apr_table_get(ctx->r->notes, Z_STRVAL_PP(note_name));
-
- if (arg_count == 2) {
- convert_to_string_ex(note_val);
- apr_table_set(ctx->r->notes, Z_STRVAL_PP(note_name), Z_STRVAL_PP(note_val));
- }
-
- if (old_note_val) {
- RETURN_STRING(old_note_val, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool apache_setenv(string variable, string value [, bool walk_to_top])
- Set an Apache subprocess_env variable */
-/*
- * XXX this doesn't look right. shouldn't it be the parent ?*/
-PHP_FUNCTION(apache_setenv)
-{
- php_struct *ctx;
- zval **variable=NULL, **string_val=NULL, **walk_to_top=NULL;
- int arg_count = ZEND_NUM_ARGS();
- request_rec *r;
-
- if (arg_count<1 || arg_count>3 ||
- zend_get_parameters_ex(arg_count, &variable, &string_val, &walk_to_top) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ctx = SG(server_context);
-
- if (arg_count == 3 && Z_STRVAL_PP(walk_to_top)) {
- r = ctx->r;
- while(r->prev) {
- r = r->prev;
- }
- }
-
- convert_to_string_ex(variable);
- convert_to_string_ex(string_val);
-
- apr_table_set(r->subprocess_env, Z_STRVAL_PP(variable), Z_STRVAL_PP(string_val));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool apache_getenv(string variable [, bool walk_to_top])
- Get an Apache subprocess_env variable */
-/*
- * XXX: shouldn't this be the parent not the 'prev'
- */
-PHP_FUNCTION(apache_getenv)
-{
- php_struct *ctx;
- zval **variable=NULL, **walk_to_top=NULL;
- int arg_count = ZEND_NUM_ARGS();
- char *env_val=NULL;
- request_rec *r;
-
- if (arg_count<1 || arg_count>2 ||
- zend_get_parameters_ex(arg_count, &variable, &walk_to_top) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ctx = SG(server_context);
-
- r = ctx->r;
- if (arg_count == 2 && Z_STRVAL_PP(walk_to_top)) {
- while(r->prev) {
- r = r->prev;
- }
- }
-
- convert_to_string_ex(variable);
-
- env_val = (char*) apr_table_get(r->subprocess_env, Z_STRVAL_PP(variable));
- if (env_val != NULL) {
- RETURN_STRING(env_val, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-static char *php_apache_get_version()
-{
- return (char *) ap_get_server_version();
-}
-
-/* {{{ proto string apache_get_version(void)
- Fetch Apache version */
-PHP_FUNCTION(apache_get_version)
-{
- char *apv = php_apache_get_version();
-
- if (apv && *apv) {
- RETURN_STRING(apv, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array apache_get_modules(void)
- Get a list of loaded Apache modules */
-PHP_FUNCTION(apache_get_modules)
-{
- int n;
- char *p;
-
- array_init(return_value);
-
- for (n = 0; ap_loaded_modules[n]; ++n) {
- char *s = (char *) ap_loaded_modules[n]->name;
- if ((p = strchr(s, '.'))) {
- add_next_index_stringl(return_value, s, (p - s), 1);
- } else {
- add_next_index_string(return_value, s, 1);
- }
- }
-}
-/* }}} */
-
-PHP_MINFO_FUNCTION(apache)
-{
- char *apv = php_apache_get_version();
- smart_str tmp1 = {0};
- char tmp[1024];
- int n;
- char *p;
- server_rec *serv = ((php_struct *) SG(server_context))->r->server;
-#if !defined(WIN32) && !defined(WINNT)
- AP_DECLARE_DATA extern unixd_config_rec unixd_config;
- extern int ap_max_requests_per_child;
-#endif
- AP_DECLARE_DATA extern const char *ap_server_root;
-
- for (n = 0; ap_loaded_modules[n]; ++n) {
- char *s = (char *) ap_loaded_modules[n]->name;
- if ((p = strchr(s, '.'))) {
- smart_str_appendl(&tmp1, s, (p - s));
- } else {
- smart_str_appends(&tmp1, s);
- }
- smart_str_appendc(&tmp1, ' ');
- }
- if ((tmp1.len - 1) >= 0) {
- tmp1.c[tmp1.len - 1] = '\0';
- }
-
- php_info_print_table_start();
- if (apv && *apv) {
- php_info_print_table_row(2, "Apache Version", apv);
- }
- sprintf(tmp, "%d", MODULE_MAGIC_NUMBER);
- php_info_print_table_row(2, "Apache API Version", tmp);
-
- if (serv->server_admin && *(serv->server_admin)) {
- php_info_print_table_row(2, "Servert Administrator", serv->server_admin);
- }
-
- sprintf(tmp, "%s:%u", serv->server_hostname, serv->port);
- php_info_print_table_row(2, "Hostname:Port", tmp);
-
-#if !defined(WIN32) && !defined(WINNT)
- sprintf(tmp, "%s(%d)/%d", unixd_config.user_name, unixd_config.user_id, unixd_config.group_id);
- php_info_print_table_row(2, "User/Group", tmp);
- sprintf(tmp, "Per Child: %d - Keep Alive: %s - Max Per Connection: %d", ap_max_requests_per_child, (serv->keep_alive ? "on":"off"), serv->keep_alive_max);
-#else
- sprintf(tmp, "Keep Alive: %s - Max Per Connection: %d", (serv->keep_alive ? "on":"off"), serv->keep_alive_max);
-#endif
-
- php_info_print_table_row(2, "Max Requests", tmp);
-
- sprintf(tmp, "Connection: %lld - Keep-Alive: %lld", (serv->timeout / 1000000), (serv->keep_alive_timeout / 1000000));
- php_info_print_table_row(2, "Timeouts", tmp);
-
- php_info_print_table_row(2, "Virtual Server", (serv->is_virtual ? "Yes" : "No"));
- php_info_print_table_row(2, "Server Root", ap_server_root);
- php_info_print_table_row(2, "Loaded Modules", tmp1.c);
-
- smart_str_free(&tmp1);
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-
- {
- const apr_array_header_t *arr = apr_table_elts(((php_struct *) SG(server_context))->r->subprocess_env);
- char *key, *val;
-
- SECTION("Apache Environment");
- php_info_print_table_start();
- php_info_print_table_header(2, "Variable", "Value");
- APR_ARRAY_FOREACH_OPEN(arr, key, val)
- if (!val) {
- val = empty_string;
- }
- php_info_print_table_row(2, key, val);
- APR_ARRAY_FOREACH_CLOSE()
-
- php_info_print_table_end();
-
- SECTION("HTTP Headers Information");
- php_info_print_table_start();
- php_info_print_table_colspan_header(2, "HTTP Request Headers");
- php_info_print_table_row(2, "HTTP Request", ((php_struct *) SG(server_context))->r->the_request);
-
- arr = apr_table_elts(((php_struct *) SG(server_context))->r->headers_in);
- APR_ARRAY_FOREACH_OPEN(arr, key, val)
- if (!val) {
- val = empty_string;
- }
- php_info_print_table_row(2, key, val);
- APR_ARRAY_FOREACH_CLOSE()
-
- php_info_print_table_colspan_header(2, "HTTP Response Headers");
- arr = apr_table_elts(((php_struct *) SG(server_context))->r->headers_out);
- APR_ARRAY_FOREACH_OPEN(arr, key, val)
- if (!val) {
- val = empty_string;
- }
- php_info_print_table_row(2, key, val);
- APR_ARRAY_FOREACH_CLOSE()
-
- php_info_print_table_end();
- }
-}
-
-static function_entry apache_functions[] = {
- PHP_FE(apache_lookup_uri, NULL)
- PHP_FE(virtual, NULL)
- PHP_FE(apache_request_headers, NULL)
- PHP_FE(apache_response_headers, NULL)
- PHP_FE(apache_setenv, NULL)
- PHP_FE(apache_getenv, NULL)
- PHP_FE(apache_note, NULL)
- PHP_FE(apache_get_version, NULL)
- PHP_FE(apache_get_modules, NULL)
- PHP_FALIAS(getallheaders, apache_request_headers, NULL)
- {NULL, NULL, NULL}
-};
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("xbithack", "0", PHP_INI_ALL, OnUpdateLong, xbithack, php_apache2_info_struct, php_apache2_info)
- STD_PHP_INI_ENTRY("engine", "1", PHP_INI_ALL, OnUpdateLong, engine, php_apache2_info_struct, php_apache2_info)
- STD_PHP_INI_ENTRY("last_modified", "0", PHP_INI_ALL, OnUpdateLong, last_modified, php_apache2_info_struct, php_apache2_info)
-PHP_INI_END()
-
-static PHP_MINIT_FUNCTION(apache)
-{
-#ifdef ZTS
- ts_allocate_id(&php_apache2_info_id, sizeof(php_apache2_info_struct), (ts_allocate_ctor) NULL, NULL);
-#endif
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-static PHP_MSHUTDOWN_FUNCTION(apache)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-zend_module_entry php_apache_module = {
- STANDARD_MODULE_HEADER,
- "apache2handler",
- apache_functions,
- PHP_MINIT(apache),
- PHP_MSHUTDOWN(apache),
- NULL,
- NULL,
- PHP_MINFO(apache),
- NULL,
- STANDARD_MODULE_PROPERTIES
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c
deleted file mode 100644
index ae403d505e..0000000000
--- a/sapi/apache2handler/sapi_apache2.c
+++ /dev/null
@@ -1,585 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- | Parts based on Apache 1.3 SAPI module by |
- | Rasmus Lerdorf and Zeev Suraski |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <fcntl.h>
-
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#include "php.h"
-#include "php_main.h"
-#include "php_ini.h"
-#include "php_variables.h"
-#include "SAPI.h"
-
-#include "ext/standard/php_smart_str.h"
-#ifndef NETWARE
-#include "ext/standard/php_standard.h"
-#else
-#include "ext/standard/basic_functions.h"
-#endif
-
-#include "apr_strings.h"
-#include "ap_config.h"
-#include "util_filter.h"
-#include "httpd.h"
-#include "http_config.h"
-#include "http_request.h"
-#include "http_core.h"
-#include "http_protocol.h"
-#include "http_log.h"
-#include "http_main.h"
-#include "util_script.h"
-#include "http_core.h"
-#include "ap_mpm.h"
-
-#include "php_apache.h"
-
-/* UnixWare and Netware define shutdown to _shutdown, which causes problems later
- * on when using a structure member named shutdown. Since this source
- * file does not use the system call shutdown, it is safe to #undef it.
- */
-#undef shutdown
-
-#define PHP_MAGIC_TYPE "application/x-httpd-php"
-#define PHP_SOURCE_MAGIC_TYPE "application/x-httpd-php-source"
-#define PHP_SCRIPT "php-script"
-
-/* A way to specify the location of the php.ini dir in an apache directive */
-char *apache2_php_ini_path_override = NULL;
-
-static int
-php_apache_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- apr_bucket *bucket;
- apr_bucket_brigade *brigade;
- request_rec *r;
- php_struct *ctx;
- char *copy_str;
-
- if (str_length == 0) {
- return 0;
- }
-
- ctx = SG(server_context);
- r = ctx->r;
- brigade = ctx->brigade;
-
- copy_str = apr_pmemdup(r->pool, str, str_length + 1);
- bucket = apr_bucket_pool_create(copy_str, str_length, r->pool, r->connection->bucket_alloc);
-
- APR_BRIGADE_INSERT_TAIL(brigade, bucket);
-
- if (ap_pass_brigade(r->output_filters, brigade) != APR_SUCCESS) {
- php_handle_aborted_connection();
- }
- /* Ensure this brigade is empty for the next usage. */
- apr_brigade_cleanup(brigade);
-
- return str_length; /* we always consume all the data passed to us. */
-}
-
-static int
-php_apache_sapi_header_handler(sapi_header_struct *sapi_header,sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- php_struct *ctx;
- char *val;
-
- ctx = SG(server_context);
-
- val = strchr(sapi_header->header, ':');
-
- if (!val) {
- sapi_free_header(sapi_header);
- return 0;
- }
-
- *val = '\0';
-
- do {
- val++;
- } while (*val == ' ');
-
- if (!strcasecmp(sapi_header->header, "content-type")) {
- val = apr_pstrdup(ctx->r->pool, val);
- ap_set_content_type(ctx->r, val);
- } else if (sapi_header->replace) {
- apr_table_set(ctx->r->headers_out, sapi_header->header, val);
- } else {
- apr_table_add(ctx->r->headers_out, sapi_header->header, val);
- }
-
- sapi_free_header(sapi_header);
-
- return 0;
-}
-
-static int
-php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- php_struct *ctx = SG(server_context);
-
- ctx->r->status = SG(sapi_headers).http_response_code;
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-static int
-php_apache_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC)
-{
- apr_size_t len, tlen=0;
- php_struct *ctx = SG(server_context);
- request_rec *r;
- apr_bucket_brigade *brigade;
-
- r = ctx->r;
- brigade = ctx->brigade;
- len = count_bytes;
-
- /*
- * This loop is needed because ap_get_brigade() can return us partial data
- * which would cause premature termination of request read. Therefor we
- * need to make sure that if data is avaliable we fill the buffer completely.
- */
-
- while (ap_get_brigade(r->input_filters, brigade, AP_MODE_READBYTES, APR_BLOCK_READ, len) == APR_SUCCESS) {
- apr_brigade_flatten(brigade, buf, &len);
- apr_brigade_cleanup(brigade);
- tlen += len;
- if (tlen == count_bytes || !len) {
- break;
- }
- buf += len;
- len = count_bytes - tlen;
- }
-
- return tlen;
-}
-
-static struct stat*
-php_apache_sapi_get_stat(TSRMLS_D)
-{
- php_struct *ctx = SG(server_context);
-
- ctx->finfo.st_uid = ctx->r->finfo.user;
- ctx->finfo.st_gid = ctx->r->finfo.group;
- ctx->finfo.st_ino = ctx->r->finfo.inode;
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- ctx->finfo.st_atime.tv_sec = ctx->r->finfo.atime/1000000;
- ctx->finfo.st_mtime.tv_sec = ctx->r->finfo.mtime/1000000;
- ctx->finfo.st_ctime.tv_sec = ctx->r->finfo.ctime/1000000;
-#else
- ctx->finfo.st_atime = ctx->r->finfo.atime/1000000;
- ctx->finfo.st_mtime = ctx->r->finfo.mtime/1000000;
- ctx->finfo.st_ctime = ctx->r->finfo.ctime/1000000;
-#endif
-
- ctx->finfo.st_size = ctx->r->finfo.size;
- ctx->finfo.st_nlink = ctx->r->finfo.nlink;
-
- return &ctx->finfo;
-}
-
-static char *
-php_apache_sapi_read_cookies(TSRMLS_D)
-{
- php_struct *ctx = SG(server_context);
- const char *http_cookie;
-
- http_cookie = apr_table_get(ctx->r->headers_in, "cookie");
-
- /* The SAPI interface should use 'const char *' */
- return (char *) http_cookie;
-}
-
-static char *
-php_apache_sapi_getenv(char *name, size_t name_len TSRMLS_DC)
-{
- php_struct *ctx = SG(server_context);
- const char *env_var;
-
- env_var = apr_table_get(ctx->r->subprocess_env, name);
-
- return (char *) env_var;
-}
-
-static void
-php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC)
-{
- php_struct *ctx = SG(server_context);
- const apr_array_header_t *arr = apr_table_elts(ctx->r->subprocess_env);
- char *key, *val;
- zval **path_translated_zv;
-
- APR_ARRAY_FOREACH_OPEN(arr, key, val)
- if (!val) val = empty_string;
- php_register_variable(key, val, track_vars_array TSRMLS_CC);
- APR_ARRAY_FOREACH_CLOSE()
-
- php_register_variable("PHP_SELF", ctx->r->uri, track_vars_array TSRMLS_CC);
-
- /* If PATH_TRANSLATED doesn't exist, copy it from SCRIPT_FILENAME */
- if (!zend_hash_exists(Z_ARRVAL_P(track_vars_array), "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"))
- && zend_hash_find(Z_ARRVAL_P(track_vars_array), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &path_translated_zv) == SUCCESS) {
- php_register_variable("PATH_TRANSLATED", Z_STRVAL_PP(path_translated_zv), track_vars_array TSRMLS_CC);
- }
-}
-
-static void
-php_apache_sapi_flush(void *server_context)
-{
- php_struct *ctx;
- apr_bucket_brigade *brigade;
- apr_bucket *bucket;
- request_rec *r;
-
- ctx = server_context;
-
- /* If we haven't registered a server_context yet,
- * then don't bother flushing. */
- if (!server_context) {
- return;
- }
-
- r = ctx->r;
- brigade = ctx->brigade;
-
- /* Send a flush bucket down the filter chain. */
- bucket = apr_bucket_flush_create(r->connection->bucket_alloc);
- APR_BRIGADE_INSERT_TAIL(brigade, bucket);
- if (ap_pass_brigade(r->output_filters, brigade) != APR_SUCCESS) {
- php_handle_aborted_connection();
- }
- apr_brigade_cleanup(brigade);
-}
-
-static void php_apache_sapi_log_message(char *msg)
-{
- php_struct *ctx;
- TSRMLS_FETCH();
-
- ctx = SG(server_context);
-
- /* We use APLOG_STARTUP because it keeps us from printing the
- * data and time information at the beginning of the error log
- * line. Not sure if this is correct, but it mirrors what happens
- * with Apache 1.3 -- rbb
- */
- if (ctx == NULL) { /* we haven't initialized our ctx yet, oh well */
- ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO | APLOG_STARTUP,
- 0, NULL, "%s", msg);
- } else {
- ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO | APLOG_STARTUP,
- 0, ctx->r, "%s", msg);
- }
-}
-
-extern zend_module_entry php_apache_module;
-
-static int php_apache2_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, &php_apache_module, 1)==FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-static sapi_module_struct apache2_sapi_module = {
- "apache2handler",
- "Apache 2.0 Handler",
-
- php_apache2_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- php_apache_sapi_ub_write, /* unbuffered write */
- php_apache_sapi_flush, /* flush */
- php_apache_sapi_get_stat, /* get uid */
- php_apache_sapi_getenv, /* getenv */
-
- php_error, /* error handler */
-
- php_apache_sapi_header_handler, /* header handler */
- php_apache_sapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- php_apache_sapi_read_post, /* read POST data */
- php_apache_sapi_read_cookies, /* read Cookies */
-
- php_apache_sapi_register_variables,
- php_apache_sapi_log_message, /* Log message */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-static apr_status_t
-php_apache_server_shutdown(void *tmp)
-{
- apache2_sapi_module.shutdown(&apache2_sapi_module);
- sapi_shutdown();
-#ifdef ZTS
- tsrm_shutdown();
-#endif
- return APR_SUCCESS;
-}
-
-static void php_apache_add_version(apr_pool_t *p)
-{
- TSRMLS_FETCH();
- if (PG(expose_php)) {
- ap_add_version_component(p, "PHP/" PHP_VERSION);
- }
-}
-
-static int php_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
-{
-#ifndef ZTS
- int threaded_mpm;
-
- ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded_mpm);
- if(threaded_mpm) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, 0, 0, "Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.");
- return DONE;
- }
-#endif
- /* When this is NULL, apache won't override the hard-coded default
- * php.ini path setting. */
- apache2_php_ini_path_override = NULL;
- return OK;
-}
-
-static int
-php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
-{
- void *data = NULL;
- const char *userdata_key = "apache2hook_post_config";
-
- /* Apache will load, unload and then reload a DSO module. This
- * prevents us from starting PHP until the second load. */
- apr_pool_userdata_get(&data, userdata_key, s->process->pool);
- if (data == NULL) {
- /* We must use set() here and *not* setn(), otherwise the
- * static string pointed to by userdata_key will be mapped
- * to a different location when the DSO is reloaded and the
- * pointers won't match, causing get() to return NULL when
- * we expected it to return non-NULL. */
- apr_pool_userdata_set((const void *)1, userdata_key, apr_pool_cleanup_null, s->process->pool);
- return OK;
- }
-
- /* Set up our overridden path. */
- if (apache2_php_ini_path_override) {
- apache2_sapi_module.php_ini_path_override = apache2_php_ini_path_override;
- }
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
-#endif
- sapi_startup(&apache2_sapi_module);
- apache2_sapi_module.startup(&apache2_sapi_module);
- apr_pool_cleanup_register(pconf, NULL, php_apache_server_shutdown, apr_pool_cleanup_null);
- php_apache_add_version(pconf);
-
- return OK;
-}
-
-static apr_status_t php_server_context_cleanup(void *data_)
-{
- void **data = data_;
- *data = NULL;
- return APR_SUCCESS;
-}
-
-static void php_apache_request_ctor(request_rec *r, php_struct *ctx TSRMLS_DC)
-{
- char *content_type;
- const char *auth;
-
- SG(sapi_headers).http_response_code = 200;
- SG(request_info).content_type = apr_table_get(r->headers_in, "Content-Type");
- SG(request_info).query_string = apr_pstrdup(r->pool, r->args);
- SG(request_info).request_method = r->method;
- SG(request_info).request_uri = apr_pstrdup(r->pool, r->uri);
- SG(request_info).path_translated = apr_pstrdup(r->pool, r->filename);
- r->no_local_copy = 1;
-
- content_type = sapi_get_default_content_type(TSRMLS_C);
- ap_set_content_type(r, apr_pstrdup(r->pool, content_type));
- efree(content_type);
-
- apr_table_unset(r->headers_out, "Content-Length");
- apr_table_unset(r->headers_out, "Last-Modified");
- apr_table_unset(r->headers_out, "Expires");
- apr_table_unset(r->headers_out, "ETag");
- apr_table_unset(r->headers_in, "Connection");
-
- if (!PG(safe_mode) || (PG(safe_mode) && !ap_auth_type(r))) {
- auth = apr_table_get(r->headers_in, "Authorization");
- php_handle_auth_data(auth TSRMLS_CC);
- ctx->r->user = apr_pstrdup(ctx->r->pool, SG(request_info).auth_user);
- } else {
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
- }
- php_request_startup(TSRMLS_C);
-}
-
-static void php_apache_request_dtor(request_rec *r TSRMLS_DC)
-{
- php_request_shutdown(NULL);
-}
-
-static int php_handler(request_rec *r)
-{
- php_struct *ctx;
- void *conf;
- apr_bucket_brigade *brigade;
- apr_bucket *bucket;
- apr_status_t rv;
- request_rec *parent_req = NULL;
- TSRMLS_FETCH();
-
- conf = ap_get_module_config(r->per_dir_config, &php5_module);
- apply_config(conf);
-
- if (strcmp(r->handler, PHP_MAGIC_TYPE) && strcmp(r->handler, PHP_SOURCE_MAGIC_TYPE) && strcmp(r->handler, PHP_SCRIPT)) {
- /* Check for xbithack in this case. */
- if (!AP2(xbithack) || strcmp(r->handler, "text/html") || !(r->finfo.protection & APR_UEXECUTE)) {
- return DECLINED;
- }
- }
-
- /* handle situations where user turns the engine off */
- if (!AP2(engine)) {
- return DECLINED;
- }
-
- /* setup standard CGI variables */
- ap_add_common_vars(r);
- ap_add_cgi_vars(r);
-
- ctx = SG(server_context);
- if (ctx == NULL) {
- ctx = SG(server_context) = apr_pcalloc(r->pool, sizeof(*ctx));
- /* register a cleanup so we clear out the SG(server_context)
- * after each request. Note: We pass in the pointer to the
- * server_context in case this is handled by a different thread.
- */
- apr_pool_cleanup_register(r->pool, (void *)&SG(server_context), php_server_context_cleanup, apr_pool_cleanup_null);
-
- ctx->r = r;
- brigade = apr_brigade_create(r->pool, r->connection->bucket_alloc);
- ctx->brigade = brigade;
-
- php_apache_request_ctor(r, ctx TSRMLS_CC);
- } else {
- parent_req = ctx->r;
- ctx->r = r;
- brigade = ctx->brigade;
- }
-
- if (r->finfo.filetype == 0) {
- php_apache_sapi_log_message("script not found or unable to stat");
- return HTTP_NOT_FOUND;
- }
- if (r->finfo.filetype == APR_DIR) {
- php_apache_sapi_log_message("attempt to invoke directory as script");
- return HTTP_FORBIDDEN;
- }
-
- if (AP2(last_modified)) {
- ap_update_mtime(r, r->finfo.mtime);
- ap_set_last_modified(r);
- }
-
- /* Determine if we need to parse the file or show the source */
- if (strncmp(r->handler, PHP_SOURCE_MAGIC_TYPE, sizeof(PHP_SOURCE_MAGIC_TYPE) - 1) == 0) {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
- php_get_highlight_struct(&syntax_highlighter_ini);
- highlight_file((char *)r->filename, &syntax_highlighter_ini TSRMLS_CC);
- } else {
- zend_file_handle zfd;
-
- zfd.type = ZEND_HANDLE_FILENAME;
- zfd.filename = (char *) r->filename;
- zfd.free_filename = 0;
- zfd.opened_path = NULL;
-
- if (!parent_req) {
- php_execute_script(&zfd TSRMLS_CC);
- } else {
- zend_execute_scripts(ZEND_INCLUDE TSRMLS_CC, NULL, 1, &zfd);
- }
-#if MEMORY_LIMIT
- {
- char *mem_usage;
-
- mem_usage = apr_psprintf(ctx->r->pool, "%u", AG(allocated_memory_peak));
- AG(allocated_memory_peak) = 0;
- apr_table_set(r->notes, "mod_php_memory_usage", mem_usage);
- }
-#endif
- }
-
- if (!parent_req) {
- php_apache_request_dtor(r TSRMLS_CC);
- ctx->request_processed = 1;
- bucket = apr_bucket_eos_create(r->connection->bucket_alloc);
- APR_BRIGADE_INSERT_TAIL(brigade, bucket);
-
- rv = ap_pass_brigade(r->output_filters, brigade);
- if (rv != APR_SUCCESS) {
- php_handle_aborted_connection();
- }
- apr_brigade_cleanup(brigade);
- } else {
- ctx->r = parent_req;
- }
-
- return OK;
-}
-
-static void php_register_hook(apr_pool_t *p)
-{
- ap_hook_pre_config(php_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
- ap_hook_post_config(php_apache_server_startup, NULL, NULL, APR_HOOK_MIDDLE);
- ap_hook_handler(php_handler, NULL, NULL, APR_HOOK_MIDDLE);
-}
-
-AP_MODULE_DECLARE_DATA module php5_module = {
- STANDARD20_MODULE_STUFF,
- create_php_config, /* create per-directory config structure */
- merge_php_config, /* merge per-directory config structures */
- NULL, /* create per-server config structure */
- NULL, /* merge per-server config structures */
- php_dir_cmds, /* command apr_table_t */
- php_register_hook /* register hooks */
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/apache_hooks/CREDITS b/sapi/apache_hooks/CREDITS
deleted file mode 100644
index 86ac27d0b7..0000000000
--- a/sapi/apache_hooks/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Apache 1.3 (apache_hooks)
-Rasmus Lerdorf, Zeev Suraski, Stig Bakken, David Sklar, George Schlossnagle, Lukas Schroeder
diff --git a/sapi/apache_hooks/README b/sapi/apache_hooks/README
deleted file mode 100644
index 9a5a3e2b64..0000000000
--- a/sapi/apache_hooks/README
+++ /dev/null
@@ -1,206 +0,0 @@
-This is very beta documentation. Clearly better stuff can and will follow.
-
-INTRO:
-
-apache_hooks is a full super-set enhancement of the apache 1.3 sapi that allows for
-php code to be run on the apache request object at every stage of the apache
-request. It supports all of the apache 1.3 sapi commands and configurations, and
-additionally supports the following httpd.conf directives:
-
-
-HTTPD.CONF DIRECTIEVS:
-
-phpRequire /path/to/file = requires a file at the beginning of an
-initial apache request
-
-phpUriHandler /path/to/file = registers a hook that will run the
-specified file at the uri translation stage of the apache request
-phpUriHandler Class::Method = registers a hook to run Class::Method at
-the uri translation stage of the apache request
-
-phpPostReadHandler /path/to/file = hook for post-read phase
-phpPostReadHandlerMethod Class::Method
-
-phpHeaderHandler = hook for header parsing phase
-phpHeaderHandlerMethod
-
-phpAuthHandler = hook for authentication phase
-phpAuthHandlerMethod
-
-phpAccessHandler = hook for access control phase
-phpAccessHandlerMethod
-
-phpTypeHandler = hook for Type Checking phase
-phpTypeHandlerMethod
-
-phpFixupHandler = hook for 'fixup' phase
-phpFixupHandlerMethod
-
-phpLoggerHandler = hook for logging phase
-phpLoggerHandlerMethod
-
-AddHandler php-script = set's up a special type handler
-phpResponseHandler /path/to/file = sets file to be called to handle
-response phase
-phpResponseHandlerMethod Class::Method
-
-
-All handlers may be stacked, i.e. you can list multiple handler directives
-in a single scope and they will be run in order.
-
-
-EXAMPLES:
-
-So, to set up a 'hello world' location handler (so that any request to
-/hello/* returns hello world) you can:
-
-phpRequire /tmp/setup.php
-<Location /hello>
-AddHandler php-script
-phpResponseHandlerMethod Hello::World
-</Location>
-
-with
-#/tmp/setup.php
-<?
-class Hello {
- function World() {
- global $request;
- $request->send_http_header();
- echo "Hello World";
- }
-}
-?>
-
-$request is the apache request. It is instantiated at all stages
-automatically. The methods of that class are:
-
-getallheaders
-args
-boundary
-content_encoding
-content_type
-filename
-handler
-hostname
-method
-path_info
-protocol
-status_line
-the_request
-unparsed_uri
-uri
-allowed
-bytes_sent
-chunked
-content_length
-header_only
-method_number
-mtime
-no_cache
-no_local_copy
-proto_num
-proxyreq
-read_body
-remaining
-request_time
-status
-headers_in
-headers_out
-err_headers_out
-auth_name
-auth_type
-basic_auth_pw
-discard_request_body
-is_initial_req
-meets_conditions
-remote_host
-satisfies
-server_port
-set_etag
-set_last_modified
-some_auth_required
-update_mtime
-send_http_header
-basic_http_header
-send_header_field
-send_http_trace
-send_http_options
-send_error_response
-set_content_length
-set_keepalive
-rputs
-log_error
-lookup_uri
-lookup_file
-method_uri
-run
-internal_redirect
-
-
-These all wrap the ap_* apache EXPORT_API functions using the same
-semantics (and are also the same as the Apache::Request methods in
-mod_perl if you are familiar with that)
-
-So, a uri handler to redirect all non-local traffic to /404.php (an
-error page) would be
-
-phpUriHandler /tmp/uri.php
-
-#/tmp/uri.php
-<?
- if($REMOTE_ADDR != '127.0.0.1') {
- $request->uri('/404.php');
- }
- return OK;
-?>
-
-It's important to note that since this is called from the uri
-translations phase, this validation is performed for every request to
-the server, not just for php pages.
-
-Also, scope is shared between all the hooks. So in the above, we could
-merge the two and do something like:
-
-#/tmp/uri.php
-<?
- if($REMOTE_ADDR != '127.0.0.1') {
- $whoami = 'Stranger';
- }
- else {
- $whoami = 'Friend';
- }
- return DECLINED; # because we're not redirecting, just messing around
-?>
-
-and then:
-
-#/tmp/setup.php
-<?
-class Hello {
- function World() {
- global $request;
- global $whoami;
- $request->send_http_header();
- echo "Hello $whoami";
- }
-}
-?>
-
-These variables are also in the same scope as a script if your script is
-being handled by the standard application/x-httpd-php handler.
-
-This allows you to make decisions and pass data between your handlers
-and scripts at all stages.
-
-The above are clearly trite examples, but hopefully give you a starting
-point.
-
-One note: all handlers can be validly re-entered 'in sub-requests'.
-For this reason you should not define functions/classes here without
-anti-redefinition guards (I would just recommend putting them in an
-include and using include_one). This is not true for phpRequire, which
-is only entered once, at the main request, and so it is safe to make
-function/class declarations there (in fact that's what it's for).
-
-Hope that helps!
diff --git a/sapi/apache_hooks/apMakefile.libdir b/sapi/apache_hooks/apMakefile.libdir
deleted file mode 100644
index 7b5254013a..0000000000
--- a/sapi/apache_hooks/apMakefile.libdir
+++ /dev/null
@@ -1,4 +0,0 @@
-This is a place-holder which indicates to Configure that it shouldn't
-provide the default targets when building the Makefile in this directory.
-Instead it'll just prepend all the important variable definitions, and
-copy the Makefile.tmpl onto the end.
diff --git a/sapi/apache_hooks/apMakefile.tmpl b/sapi/apache_hooks/apMakefile.tmpl
deleted file mode 100644
index 80fe346561..0000000000
--- a/sapi/apache_hooks/apMakefile.tmpl
+++ /dev/null
@@ -1,77 +0,0 @@
-##
-## Apache 1.3 Makefile template for PHP 4.0 Module
-## [src/modules/php4/Makefile.tmpl]
-##
-
-# the parametrized target
-LIB=libphp4.$(LIBEXT)
-
-# objects for building the static library
-OBJS=mod_php4.o
-OBJS_LIB=libmodphp4.a
-
-# objects for building the shared object library
-SHLIB_OBJS=mod_php4.so-o
-SHLIB_OBJS_LIB=libmodphp4.a
-
-# the general targets
-all: lib
-lib: $(LIB)
-
-# build the static library by merging the object files
-libphp4.a: $(OBJS) $(OBJS_LIB)
- cp $(OBJS_LIB) $@
- ar r $@ $(OBJS)
- $(RANLIB) $@
-
-# ugly hack to support older Apache-1.3 betas that don't set $LIBEXT
-libphp4.: $(OBJS) $(OBJS_LIB)
- cp $(OBJS_LIB) $@
- ar r $@ $(OBJS)
- $(RANLIB) $@
- cp libphp4. libphp4.a
-
-# build the shared object library by linking the object files
-libphp4.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
- rm -f $@
- $(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS) $(PHP_LIBS)
-
-# 1. extension .o for shared objects cannot be used here because
-# first these files aren't still shared objects and second we
-# have to use a different name to trigger the different
-# implicit Make rule
-# 2. extension -so.o (as used elsewhere) cannot be used because
-# the suffix feature of Make really wants just .x, so we use
-# extension .so-o
-.SUFFIXES: .o .so-o
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(PHP_CFLAGS) $(CPPFLAGS) $(SPACER) $<
-.c.so-o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $(PHP_CFLAGS) $(CPPFLAGS) $(SPACER) $< && mv $*.o $*.so-o
-
-# cleanup
-clean:
- -rm -f $(OBJS) $(SHLIB_OBJS) $(LIB)
-
-# We really don't expect end users to use this rule. It works only with
-# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after
-# using it.
-depend:
- cp Makefile.tmpl Makefile.tmpl.bak \
- && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
- && gcc -MM $(INCLUDES) $(CFLAGS) $(PHP_CFLAGS) $(CPPFLAGS) *.c >> Makefile.new \
- && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' Makefile.new \
- > Makefile.tmpl \
- && rm Makefile.new
-
-#Dependencies
-
-$(OBJS): Makefile
-
-# DO NOT REMOVE
-mod_php4.o: mod_php4.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
- $(INCDIR)/buff.h \
- $(INCDIR)/http_config.h \
- $(INCDIR)/http_core.h $(INCDIR)/http_main.h \
- $(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \
- $(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php4.h
diff --git a/sapi/apache_hooks/config.m4 b/sapi/apache_hooks/config.m4
deleted file mode 100644
index 558250b6a8..0000000000
--- a/sapi/apache_hooks/config.m4
+++ /dev/null
@@ -1,242 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_MSG_CHECKING(for Apache 1.x (hooks) module support via DSO through APXS)
-AC_ARG_WITH(apache-hooks,
-[ --with-apache-hooks[=FILE]
- EXPERIMENTAL: Build shared Apache 1.x module. FILE is the optional
- pathname to the Apache apxs tool; defaults to "apxs".],[
- if test "$withval" = "yes"; then
- APXS=apxs
- AC_DEFINE(APACHE_HOOKS,1,[ ])
- $APXS -q CFLAGS >/dev/null 2>&1
- if test "$?" != "0" && test -x /usr/sbin/apxs; then #SUSE 6.x
- APXS=/usr/sbin/apxs
- fi
- else
- AC_DEFINE(APACHE_HOOKS,1,[ ])
- PHP_EXPAND_PATH($withval, APXS)
- fi
-
- $APXS -q CFLAGS >/dev/null 2>&1
- if test "$?" != "0"; then
- AC_MSG_RESULT()
- AC_MSG_RESULT()
- AC_MSG_RESULT([Sorry, I was not able to successfully run APXS. Possible reasons:])
- AC_MSG_RESULT()
- AC_MSG_RESULT([1. Perl is not installed;])
- AC_MSG_RESULT([2. Apache was not compiled with DSO support (--enable-module=so);])
- AC_MSG_RESULT([3. 'apxs' is not in your path. Try to use --with-apxs=/path/to/apxs])
- AC_MSG_RESULT([The output of $APXS follows])
- $APXS
- AC_MSG_ERROR([Aborting])
- fi
-
- APXS_LDFLAGS="@SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@"
- APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR`
- APXS_CFLAGS=`$APXS -q CFLAGS`
- APXS_HTTPD=`$APXS -q SBINDIR`/`$APXS -q TARGET`
-
- # Test that we're trying to configure with apache 1.x
- PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
- if test "$APACHE_VERSION" -ge 2000000; then
- AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropiate switch --with-apxs2])
- fi
-
- for flag in $APXS_CFLAGS; do
- case $flag in
- -D*) CPPFLAGS="$CPPFLAGS $flag";;
- esac
- done
- case $host_alias in
- *aix*)
- APXS_LIBEXECDIR=`$APXS -q LIBEXECDIR`
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp"
- PHP_SELECT_SAPI(apache_hooks, shared, sapi_apache.c mod_php4.c php_apache.c, -I$APXS_INCLUDEDIR)
- ;;
- *darwin*)
- MH_BUNDLE_FLAGS="-dynamic -twolevel_namespace -bundle -bundle_loader $APXS_HTTPD"
- PHP_SUBST(MH_BUNDLE_FLAGS)
- SAPI_SHARED=libs/libphp4.so
- PHP_SELECT_SAPI(apache_hooks, bundle, sapi_apache.c mod_php4.c php_apache.c, -I$APXS_INCLUDEDIR)
- ;;
- *)
- PHP_SELECT_SAPI(apache_hooks, shared, sapi_apache.c mod_php4.c php_apache.c, -I$APXS_INCLUDEDIR)
- ;;
- esac
-
- # Test whether apxs support -S option
- $APXS -q -S CFLAGS="$APXS_CFLAGS" CFLAGS >/dev/null 2>&1
-
- if test "$?" != "0"; then
- APACHE_INSTALL="$APXS -i -a -n php4 $SAPI_SHARED" # Old apxs does not have -S option
- else
- APACHE_INSTALL="\$(mkinstalldirs) \"\$(INSTALL_ROOT)`$APXS -q LIBEXECDIR`\" && $APXS -S LIBEXECDIR=\"\$(INSTALL_ROOT)`$APXS -q LIBEXECDIR`\" -i -a -n php4 $SAPI_SHARED"
- fi
-
- if test -z "`$APXS -q LD_SHLIB`" || test "`$APXS -q LIBEXECDIR`" = "modules"; then
- PHP_APXS_BROKEN=yes
- fi
- STRONGHOLD=
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- AC_MSG_RESULT(yes)
-],[
- AC_MSG_RESULT(no)
-])
-
-APACHE_INSTALL_FILES="\$(srcdir)/sapi/apache_hooks/mod_php4.* sapi/apache_hooks/libphp4.module"
-
-if test "$PHP_SAPI" != "apache_hooks"; then
-AC_MSG_CHECKING(for Apache 1.x (hooks) module support)
-AC_ARG_WITH(apache-hooks-static,
-[ --with-apache-hooks-static[=DIR]
- EXPERIMENTAL: Build Apache 1.x module. DIR is the top-level Apache
- build directory, defaults to /usr/local/apache.],[
- AC_DEFINE(APACHE_HOOKS,1,[ ])
- if test "$withval" = "yes"; then
- # Apache's default directory
- withval=/usr/local/apache
- fi
- if test "$withval" != "no"; then
- APACHE_MODULE=yes
- PHP_EXPAND_PATH($withval, withval)
- # For Apache 1.2.x
- if test -f $withval/src/httpd.h; then
- APACHE_INCLUDE=-I$withval/src
- APACHE_TARGET=$withval/src
- PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php4.c php_apache.c, $APACHE_INCLUDE)
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_INSTALL_FILES $APACHE_TARGET"
- PHP_LIBS="-L. -lphp3"
- AC_MSG_RESULT(yes - Apache 1.2.x)
- STRONGHOLD=
- if test -f $withval/src/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- # For Apache 2.0.x
- elif test -f $withval/include/httpd.h &&
- test -f $withval/srclib/apr/include/apr_general.h ; then
- AC_MSG_ERROR([Use --with-apache2 with Apache 2.x!])
- # For Apache 1.3.x
- elif test -f $withval/src/main/httpd.h; then
- APACHE_HAS_REGEX=1
- APACHE_INCLUDE="-I$withval/src/main -I$withval/src/os/unix -I$withval/src/ap"
- APACHE_TARGET=$withval/src/modules/php4
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php4.c php_apache.c, $APACHE_INCLUDE)
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp4.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
- AC_MSG_RESULT(yes - Apache 1.3.x)
- STRONGHOLD=
- if test -f $withval/src/include/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
- fi
- # Also for Apache 1.3.x
- elif test -f $withval/src/include/httpd.h; then
- APACHE_HAS_REGEX=1
- APACHE_INCLUDE="-I$withval/src/include -I$withval/src/os/unix"
- APACHE_TARGET=$withval/src/modules/php4
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php4.c php_apache.c, $APACHE_INCLUDE)
- PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp4.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- AC_MSG_RESULT(yes - Apache 1.3.x)
- STRONGHOLD=
- if test -f $withval/src/include/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
- fi
- # For StrongHold 2.2
- elif test -f $withval/apache/httpd.h; then
- APACHE_INCLUDE=-"I$withval/apache -I$withval/ssl/include"
- APACHE_TARGET=$withval/apache
- PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php4.c php_apache.c, $APACHE_INCLUDE)
- PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp4.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET"
- STRONGHOLD=-DSTRONGHOLD=1
- AC_MSG_RESULT(yes - StrongHold)
- if test -f $withval/apache/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- if test -f $withval/src/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
- fi
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Invalid Apache directory - unable to find httpd.h under $withval)
- fi
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-
-fi
-
-if test "x$APXS" != "x" -a "`uname -sv`" = "AIX 4" -a "$GCC" != "yes"; then
- APXS_EXP=-bE:sapi/apache_hooks/mod_php4.exp
-fi
-
-PHP_SUBST(APXS_EXP)
-PHP_SUBST(APACHE_INCLUDE)
-PHP_SUBST(APACHE_TARGET)
-PHP_SUBST(APXS)
-PHP_SUBST(APXS_LDFLAGS)
-PHP_SUBST(APACHE_INSTALL)
-PHP_SUBST(STRONGHOLD)
-
-AC_MSG_CHECKING(for mod_charset compatibility option)
-AC_ARG_WITH(mod_charset,
-[ --with-mod_charset Enable transfer tables for mod_charset (Rus Apache).],
-[
- AC_MSG_RESULT(yes)
- AC_DEFINE(USE_TRANSFER_TABLES,1,[ ])
-],[
- AC_MSG_RESULT(no)
-])
-
-if test -n "$APACHE_MODULE"; then
- PHP_TARGET_RDYNAMIC
- $php_shtool mkdir -p sapi/apache_hooks
- PHP_OUTPUT(sapi/apache_hooks/libphp4.module)
-fi
-
-if test -n "$APACHE_INSTALL"; then
- INSTALL_IT=$APACHE_INSTALL
-fi
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/apache_hooks/libphp4.module.in b/sapi/apache_hooks/libphp4.module.in
deleted file mode 100644
index ccb97493a7..0000000000
--- a/sapi/apache_hooks/libphp4.module.in
+++ /dev/null
@@ -1,11 +0,0 @@
-Name: php4_module
-ConfigStart
- RULE_WANTHSREGEX=no
- RULE_HIDE=yes
- PHP_LIBS="@NATIVE_RPATHS@ @PHP_LDFLAGS@ @PHP_LIBS@ @EXTRA_LIBS@ $LIBS"
- PHP_CFLAGS="$CFLAGS @OPENSSL_INCDIR_OPT@ -I@php_abs_top_builddir@/main -I@php_abs_top_builddir@/Zend -I@php_abs_top_builddir@/TSRM -I@php_abs_top_srcdir@ -I@php_abs_top_srcdir@/sapi/apache -I@php_abs_top_srcdir@/main -I@php_abs_top_srcdir@/Zend -I@php_abs_top_srcdir@/TSRM"
- my_outfile="Makefile.config"
- echo "PHP_CFLAGS=$PHP_CFLAGS" >>$my_outfile
- echo "PHP_LIBS=$PHP_LIBS" >>$my_outfile
- LIBS=$PHP_LIBS
-ConfigEnd
diff --git a/sapi/apache_hooks/mod_php4.c b/sapi/apache_hooks/mod_php4.c
deleted file mode 100644
index 6175514310..0000000000
--- a/sapi/apache_hooks/mod_php4.c
+++ /dev/null
@@ -1,1474 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
- | PHP 4.0 patches by Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php_apache_http.h"
-
-#ifdef NETWARE
-#define SIGPIPE SIGINT
-#endif
-
-#if defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING)
-#include "ext/mbstring/mbstring.h"
-#endif /* defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) */
-
-#undef shutdown
-
-/* {{{ Prototypes
- */
-int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC);
-static void php_save_umask(void);
-static void php_restore_umask(void);
-static int sapi_apache_read_post(char *buffer, uint count_bytes TSRMLS_DC);
-static char *sapi_apache_read_cookies(TSRMLS_D);
-static int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC);
-static int sapi_apache_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC);
-static int send_php(request_rec *r, int display_source_mode, char *filename);
-static int send_parsed_php(request_rec * r);
-static int send_parsed_php_source(request_rec * r);
-static int php_xbithack_handler(request_rec * r);
-static void php_init_handler(server_rec *s, pool *p);
-/* }}} */
-
-#if MODULE_MAGIC_NUMBER >= 19970728
-static void php_child_exit_handler(server_rec *s, pool *p);
-#endif
-
-#if MODULE_MAGIC_NUMBER > 19961007
-#define CONST_PREFIX const
-#else
-#define CONST_PREFIX
-#endif
-
-
-typedef struct _sapi_stack {
- int top, max, persistent;
- void **elements;
-} sapi_stack;
-
-typedef struct _php_per_dir_config {
- HashTable *ini_settings;
- sapi_stack headers_handlers;
- sapi_stack auth_handlers;
- sapi_stack access_handlers;
- sapi_stack type_handlers;
- sapi_stack fixup_handlers;
- sapi_stack logger_handlers;
- sapi_stack post_read_handlers;
- sapi_stack response_handlers;
-} php_per_dir_config;
-
-typedef struct _php_per_server_config {
- sapi_stack uri_handlers;
- sapi_stack requires;
-} php_per_server_config;
-
-
-static CONST_PREFIX char *php_apache_value_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode);
-static CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2);
-static CONST_PREFIX char *php_apache_admin_value_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2);
-static CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2);
-static CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode);
-static CONST_PREFIX char *php_apache_admin_flag_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2);
-
-/* ### these should be defined in mod_php4.h or somewhere else */
-#define USE_PATH 1
-#define IGNORE_URL 2
-
-module MODULE_VAR_EXPORT php4_module;
-
-int saved_umask;
-//static int setup_env = 0;
-static unsigned char apache_php_initialized;
-
-typedef struct _php_per_dir_entry {
- char *key;
- char *value;
- uint key_length;
- uint value_length;
- int type;
-} php_per_dir_entry;
-
-/* some systems are missing these from their header files */
-
-/* {{{ zend stack utility functions
- */
-
-/* This code is ripped part and parcel from zend_stack.[ch]. Assuming that the
- patch supporting zend_stack_init_ex is applied, all but the bottom two
- module-specific iterators will be removed
- */
-
-int sapi_stack_init_ex(sapi_stack *stack, int persistent)
-{
- stack->top = 0;
- stack->persistent = persistent;
- stack->elements = (void **) pemalloc(sizeof(void **) * STACK_BLOCK_SIZE, persistent);
- if (!stack->elements) {
- return FAILURE;
- } else {
- stack->max = STACK_BLOCK_SIZE;
- return SUCCESS;
- }
-}
-int sapi_stack_push(sapi_stack *stack, void *element)
-{
- if (stack->top >= stack->max) { /* we need to allocate more memory */
- stack->elements = (void **) perealloc(stack->elements,
- (sizeof(void **) * (stack->max += STACK_BLOCK_SIZE)), stack->persistent);
- if (!stack->elements) {
- return FAILURE;
- }
- }
- stack->elements[stack->top] = (void *) element;
- return stack->top++;
-}
-void* sapi_stack_pop(sapi_stack *stack) {
- if(stack->top == 0) {
- return NULL;
- }
- else {
- return stack->elements[--stack->top];
- }
-}
-
-int sapi_stack_destroy(sapi_stack *stack)
-{
- return SUCCESS;
-}
-
-int sapi_stack_apply_with_argument_all(sapi_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg)
-{
- int i, retval;
-
- switch (type) {
- case ZEND_STACK_APPLY_TOPDOWN:
- for (i=stack->top-1; i>=0; i--) {
- retval = apply_function(stack->elements[i], arg);
- }
- break;
- case ZEND_STACK_APPLY_BOTTOMUP:
- for (i=0; i<stack->top; i++) {
- retval = apply_function(stack->elements[i], arg);
- }
- break;
- }
- return retval;
-}
-
-
-int sapi_stack_apply_with_argument_stop_if_equals(sapi_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg, int stopval)
-{
- int i;
- int ret = DECLINED;
- switch (type) {
- case ZEND_STACK_APPLY_TOPDOWN:
- for (i=stack->top-1; i>=0; i--) {
- if ((ret = apply_function(stack->elements[i], arg)) == stopval) {
- break;
- }
- }
- break;
- case ZEND_STACK_APPLY_BOTTOMUP:
- for (i=0; i<stack->top; i++) {
- if ((ret = apply_function(stack->elements[i], arg)) == stopval) {
- break;
- }
- }
- break;
- }
- return ret;
-}
-
-int sapi_stack_apply_with_argument_stop_if_http_error(sapi_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg)
-{
- int i;
- int ret = DECLINED;
- switch (type) {
- case ZEND_STACK_APPLY_TOPDOWN:
- for (i=stack->top-1; i>=0; i--) {
- if ((ret = apply_function(stack->elements[i], arg)) > 0) {
- break;
- }
- }
- break;
- case ZEND_STACK_APPLY_BOTTOMUP:
- for (i=0; i<stack->top; i++) {
- if ((ret = apply_function(stack->elements[i], arg)) > 0) {
- break;
- }
- }
- break;
- }
- return ret;
-}
-
-void php_handler_stack_destroy(sapi_stack *stack)
-{
- php_handler *ph;
- while((ph = (php_handler *)sapi_stack_pop(stack)) != NULL) {
- free(ph->name);
- free(ph);
- }
-}
-/* }}} */
-
-/* {{{ php_save_umask
- */
-static void php_save_umask(void)
-{
- saved_umask = umask(077);
- umask(saved_umask);
-}
-/* }}} */
-
-/* {{{ sapi_apache_ub_write
- */
-static int sapi_apache_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- int ret=0;
-
- if (SG(server_context)) {
- ret = rwrite(str, str_length, (request_rec *) SG(server_context));
- }
- if (ret != str_length) {
- php_handle_aborted_connection();
- }
- return ret;
-}
-/* }}} */
-
-/* {{{ sapi_apache_flush
- */
-static void sapi_apache_flush(void *server_context)
-{
- if (server_context) {
-#if MODULE_MAGIC_NUMBER > 19970110
- rflush((request_rec *) server_context);
-#else
- bflush((request_rec *) server_context->connection->client);
-#endif
- }
-}
-/* }}} */
-
-/* {{{ sapi_apache_read_post
- */
-static int sapi_apache_read_post(char *buffer, uint count_bytes TSRMLS_DC)
-{
- uint total_read_bytes=0, read_bytes;
- request_rec *r = (request_rec *) SG(server_context);
- void (*handler)(int);
-
- /*
- * This handles the situation where the browser sends a Expect: 100-continue header
- * and needs to recieve confirmation from the server on whether or not it can send
- * the rest of the request. RFC 2616
- *
- */
- if (!SG(read_post_bytes) && !ap_should_client_block(r)) {
- return total_read_bytes;
- }
-
- handler = signal(SIGPIPE, SIG_IGN);
- while (total_read_bytes<count_bytes) {
- hard_timeout("Read POST information", r); /* start timeout timer */
- read_bytes = get_client_block(r, buffer+total_read_bytes, count_bytes-total_read_bytes);
- reset_timeout(r);
- if (read_bytes<=0) {
- break;
- }
- total_read_bytes += read_bytes;
- }
- signal(SIGPIPE, handler);
- return total_read_bytes;
-}
-/* }}} */
-
-/* {{{ sapi_apache_read_cookies
- */
-static char *sapi_apache_read_cookies(TSRMLS_D)
-{
- return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, "HTTP_COOKIE");
-}
-/* }}} */
-
-/* {{{ sapi_apache_header_handler
- */
-static int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- char *header_name, *header_content, *p;
- request_rec *r = (request_rec *) SG(server_context);
-
- header_name = sapi_header->header;
-
- header_content = p = strchr(header_name, ':');
- if (!p) {
- efree(sapi_header->header);
- return 0;
- }
-
- *p = 0;
- do {
- header_content++;
- } while (*header_content==' ');
-
- if (!strcasecmp(header_name, "Content-Type")) {
- r->content_type = pstrdup(r->pool, header_content);
- } else if (!strcasecmp(header_name, "Set-Cookie")) {
- table_add(r->headers_out, header_name, header_content);
- } else {
- table_set(r->headers_out, header_name, header_content);
- }
-
- *p = ':'; /* a well behaved header handler shouldn't change its original arguments */
-
- efree(sapi_header->header);
-
- return 0; /* don't use the default SAPI mechanism, Apache duplicates this functionality */
-}
-/* }}} */
-
-/* {{{ sapi_apache_send_headers
- */
-static int sapi_apache_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- if(SG(server_context) == NULL) { /* server_context is not here anymore */
- return SAPI_HEADER_SEND_FAILED;
- }
-
- ((request_rec *) SG(server_context))->status = SG(sapi_headers).http_response_code;
- /* check that we haven't sent headers already, we use our own
- * headers_sent since we may send headers at anytime
- */
- if(!AP(headers_sent)) {
- send_http_header((request_rec *) SG(server_context));
- AP(headers_sent) = 1;
- }
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-/* }}} */
-
-/* {{{ sapi_apache_register_server_variables
- */
-static void sapi_apache_register_server_variables(zval *track_vars_array TSRMLS_DC)
-{
- register int i;
- array_header *arr = table_elts(((request_rec *) SG(server_context))->subprocess_env);
- table_entry *elts = (table_entry *) arr->elts;
- zval **path_translated;
- HashTable *symbol_table;
-
- for (i = 0; i < arr->nelts; i++) {
- char *val;
-
- if (elts[i].val) {
- val = elts[i].val;
- } else {
- val = empty_string;
- }
- php_register_variable(elts[i].key, val, track_vars_array TSRMLS_CC);
- }
-
- /* If PATH_TRANSLATED doesn't exist, copy it from SCRIPT_FILENAME */
- if (track_vars_array) {
- symbol_table = track_vars_array->value.ht;
- } else if (PG(register_globals)) {
- /* should never happen nowadays */
- symbol_table = EG(active_symbol_table);
- } else {
- symbol_table = NULL;
- }
- if (symbol_table
- && !zend_hash_exists(symbol_table, "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"))
- && zend_hash_find(symbol_table, "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &path_translated)==SUCCESS) {
- php_register_variable("PATH_TRANSLATED", Z_STRVAL_PP(path_translated), track_vars_array TSRMLS_CC);
- }
-
- php_register_variable("PHP_SELF", ((request_rec *) SG(server_context))->uri, track_vars_array TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ php_apache_startup
- */
-static int php_apache_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, &apache_module_entry, 1) == FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-/* }}} */
-
-/* {{{ php_apache_log_message
- */
-static void php_apache_log_message(char *message)
-{
- TSRMLS_FETCH();
-
- if (SG(server_context)) {
-#if MODULE_MAGIC_NUMBER >= 19970831
- aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, ((request_rec *) SG(server_context))->server, "%s", message);
-#else
- log_error(message, ((request_rec *) SG(server_context))->server);
-#endif
- } else {
- fprintf(stderr, "%s", message);
- fprintf(stderr, "\n");
- }
-}
-/* }}} */
-
-/* {{{ php_apache_request_shutdown
- */
-static void php_apache_request_shutdown(void *dummy)
-{
- TSRMLS_FETCH();
- AP(current_hook) = AP_CLEANUP;
- php_output_set_status(0 TSRMLS_CC);
- SG(server_context) = NULL; /* The server context (request) is invalid by the time run_cleanups() is called */
- if(SG(sapi_started)) {
- php_request_shutdown(dummy);
- SG(sapi_started) = 0;
- }
- AP(in_request) = 0;
- if(AP(setup_env)) {
- AP(setup_env) = 0;
- }
- AP(current_hook) = AP_WAITING_FOR_REQUEST;
- AP(headers_sent) = 0;
-}
-/* }}} */
-
-/* {{{ php_apache_sapi_activate
- */
-static int php_apache_sapi_activate(TSRMLS_D)
-{
- request_rec *r = (request_rec *) SG(server_context);
-
- /*
- * For the Apache module version, this bit of code registers a cleanup
- * function that gets triggered when our request pool is destroyed.
- * We need this because at any point in our code we can be interrupted
- * and that may happen before we have had time to free our memory.
- * The php_request_shutdown function needs to free all outstanding allocated
- * memory.
- */
- block_alarms();
- register_cleanup(r->pool, NULL, php_apache_request_shutdown, php_request_shutdown_for_exec);
- AP(in_request)=1;
- unblock_alarms();
-
- /* Override the default headers_only value - sometimes "GET" requests should actually only
- * send headers.
- */
- SG(request_info).headers_only = r->header_only;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_apache_get_stat
- */
-static struct stat *php_apache_get_stat(TSRMLS_D)
-{
- return &((request_rec *) SG(server_context))->finfo;
-}
-/* }}} */
-
-/* {{{ php_apache_getenv
- */
-static char *php_apache_getenv(char *name, size_t name_len TSRMLS_DC)
-{
- return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, name);
-}
-/* }}} */
-
-/* {{{ sapi_module_struct apache_sapi_module
- */
-static sapi_module_struct apache_sapi_module = {
- "apache", /* name */
- "Apache", /* pretty name */
-
- php_apache_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- php_apache_sapi_activate, /* activate */
- NULL, /* deactivate */
-
- sapi_apache_ub_write, /* unbuffered write */
- sapi_apache_flush, /* flush */
- php_apache_get_stat, /* get uid */
- php_apache_getenv, /* getenv */
-
- php_error, /* error handler */
-
- sapi_apache_header_handler, /* header handler */
- sapi_apache_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- sapi_apache_read_post, /* read POST data */
- sapi_apache_read_cookies, /* read Cookies */
-
- sapi_apache_register_server_variables, /* register server variables */
- php_apache_log_message, /* Log message */
-
- NULL, /* php.ini path override */
-
-#ifdef PHP_WIN32
- NULL,
- NULL,
-#else
- block_alarms, /* Block interruptions */
- unblock_alarms, /* Unblock interruptions */
-#endif
-
- NULL, /* default post reader */
- NULL, /* treat data */
- NULL, /* exe location */
- 0, /* ini ignore */
- NULL
-
-};
-/* }}} */
-
-/* {{{ php_restore_umask
- */
-static void php_restore_umask(void)
-{
- umask(saved_umask);
-}
-/* }}} */
-
-/* {{{ init_request_info
- */
-static void init_request_info(TSRMLS_D)
-{
- request_rec *r = ((request_rec *) SG(server_context));
- char *content_length = (char *) table_get(r->subprocess_env, "CONTENT_LENGTH");
- const char *authorization=NULL;
- char *tmp;
-
- SG(request_info).query_string = r->args;
- SG(request_info).path_translated = r->filename;
- SG(request_info).request_uri = r->uri;
- SG(request_info).request_method = (char *)r->method;
- SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
- SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
- SG(sapi_headers).http_response_code = r->status;
-
- if (r->headers_in) {
- authorization = table_get(r->headers_in, "Authorization");
- }
- if (authorization
- && !auth_type(r)
- && !strcasecmp(getword(r->pool, &authorization, ' '), "Basic")) {
- tmp = uudecode(r->pool, authorization);
- SG(request_info).auth_user = getword_nulls_nc(r->pool, &tmp, ':');
- if (SG(request_info).auth_user) {
- r->connection->user = pstrdup(r->connection->pool, SG(request_info).auth_user);
- r->connection->ap_auth_type = "Basic";
- SG(request_info).auth_user = estrdup(SG(request_info).auth_user);
- }
- SG(request_info).auth_password = tmp;
- if (SG(request_info).auth_password) {
- SG(request_info).auth_password = estrdup(SG(request_info).auth_password);
- }
- } else {
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
- }
-}
-/* }}} */
-
-/* {{{ php_apache_alter_ini_entries
- */
-static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry TSRMLS_DC)
-{
- zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE);
- return 0;
-}
-/* }}} */
-
-/* {{{ php_apache_get_default_mimetype
- */
-static char *php_apache_get_default_mimetype(request_rec *r TSRMLS_DC)
-{
-
- char *mimetype;
- if (SG(default_mimetype) || SG(default_charset)) {
- /* Assume output will be of the default MIME type. Individual
- scripts may change this later. */
- char *tmpmimetype;
- tmpmimetype = sapi_get_default_content_type(TSRMLS_C);
- mimetype = pstrdup(r->pool, tmpmimetype);
- efree(tmpmimetype);
- } else {
- mimetype = SAPI_DEFAULT_MIMETYPE "; charset=" SAPI_DEFAULT_CHARSET;
- }
- return mimetype;
-}
-/* }}} */
-
-/* {{{ send_php
- */
-static int send_php(request_rec *r, int display_source_mode, char *filename)
-{
- int retval;
- php_per_dir_config *per_dir_conf;
- TSRMLS_FETCH();
- if (AP(in_request)) {
- zend_file_handle fh;
-
- fh.filename = r->filename;
- fh.opened_path = NULL;
- fh.free_filename = 0;
- fh.type = ZEND_HANDLE_FILENAME;
-
-#if defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING)
- php_mbstring_set_zend_encoding(TSRMLS_C);
-#endif /* defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) */
-
- zend_execute_scripts(ZEND_INCLUDE TSRMLS_CC, NULL, 1, &fh);
- return OK;
- }
-
- zend_first_try {
-
- /* Make sure file exists */
- if (filename == NULL && r->finfo.st_mode == 0) {
- return DECLINED;
- }
-
- per_dir_conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module);
- if (per_dir_conf) {
- zend_hash_apply((HashTable *) per_dir_conf->ini_settings, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC);
- }
-
- /* If PHP parser engine has been turned off with an "engine off"
- * directive, then decline to handle this request
- */
- if (!AP(engine)) {
- r->content_type = php_apache_get_default_mimetype(r TSRMLS_CC);
- r->allowed |= (1 << METHODS) - 1;
- zend_try {
- zend_ini_deactivate(TSRMLS_C);
- } zend_end_try();
- return DECLINED;
- }
- if (filename == NULL) {
- filename = r->filename;
- }
-
- /* Apache 1.2 has a more complex mechanism for reading POST data */
-#if MODULE_MAGIC_NUMBER > 19961007
- if ((retval = setup_client_block(r, REQUEST_CHUNKED_ERROR))) {
- zend_try {
- zend_ini_deactivate(TSRMLS_C);
- } zend_end_try();
- return retval;
- }
-#endif
-
- if (AP(last_modified)) {
-#if MODULE_MAGIC_NUMBER < 19970912
- if ((retval = set_last_modified(r, r->finfo.st_mtime))) {
- zend_try {
- zend_ini_deactivate(TSRMLS_C);
- } zend_end_try();
- return retval;
- }
-#else
- update_mtime (r, r->finfo.st_mtime);
- set_last_modified(r);
- set_etag(r);
-#endif
- }
- /* Assume output will be of the default MIME type. Individual
- scripts may change this later in the request. */
- r->content_type = php_apache_get_default_mimetype(r TSRMLS_CC);
-
- /* Init timeout */
- hard_timeout("send", r);
-
- SG(server_context) = r;
-
- php_save_umask();
- if(!AP(setup_env)) {
- AP(setup_env) = 1;
- add_common_vars(r);
- add_cgi_vars(r);
- }
- init_request_info(TSRMLS_C);
- apache_php_module_main(r, display_source_mode TSRMLS_CC);
-
- /* Done, restore umask, turn off timeout, close file and return */
- php_restore_umask();
- kill_timeout(r);
- } zend_end_try();
-
- return OK;
-}
-/* }}} */
-
-/* {{{ send_parsed_php
- */
-static int send_parsed_php(request_rec * r)
-{
- int result = send_php(r, 0, NULL);
-
-#if MEMORY_LIMIT
- {
- char *mem_usage;
- TSRMLS_FETCH();
-
- mem_usage = ap_psprintf(r->pool, "%u", AG(allocated_memory_peak));
- AG(allocated_memory_peak) = 0;
- ap_table_setn(r->notes, "mod_php_memory_usage", mem_usage);
- }
-#endif
-
- return result;
-}
-/* }}} */
-
-/* {{{ send_parsed_php_source
- */
-static int send_parsed_php_source(request_rec * r)
-{
- return send_php(r, 1, NULL);
-}
-/* }}} */
-
-
-/* {{{ destroy_per_dir_entry
- */
-static void destroy_per_dir_entry(php_per_dir_entry *per_dir_entry)
-{
- free(per_dir_entry->key);
- free(per_dir_entry->value);
-}
-/* }}} */
-
-/* {{{ copy_per_dir_entry
- */
-static void copy_per_dir_entry(php_per_dir_entry *per_dir_entry)
-{
- php_per_dir_entry tmp = *per_dir_entry;
-
- per_dir_entry->key = (char *) malloc(tmp.key_length+1);
- memcpy(per_dir_entry->key, tmp.key, tmp.key_length);
- per_dir_entry->key[per_dir_entry->key_length] = 0;
-
- per_dir_entry->value = (char *) malloc(tmp.value_length+1);
- memcpy(per_dir_entry->value, tmp.value, tmp.value_length);
- per_dir_entry->value[per_dir_entry->value_length] = 0;
-}
-/* }}} */
-
-/* {{{ should_overwrite_per_dir_entry;
-
- */
-static zend_bool should_overwrite_per_dir_entry(HashTable *target_ht, php_per_dir_entry *orig_per_dir_entry, zend_hash_key *hash_key, void *pData)
-{
- php_per_dir_entry *new_per_dir_entry;
-
- if (zend_hash_find(target_ht, hash_key->arKey, hash_key->nKeyLength, (void **) &new_per_dir_entry)==FAILURE) {
- return 1; /* does not exist in dest, copy from source */
- }
-
- if (new_per_dir_entry->type==PHP_INI_SYSTEM
- && orig_per_dir_entry->type!=PHP_INI_SYSTEM) {
- return 1;
- } else {
- return 0;
- }
-}
-/* }}} */
-/* {{{ php_destroy_per_server_info
- */
-static void php_destroy_per_server_info(php_per_server_config *conf)
-{
- php_handler_stack_destroy(&conf->requires);
- php_handler_stack_destroy(&conf->uri_handlers);
-}
-/* }}} */
-
-/* {{{ php_destroy_per_dir_info
- */
-static void php_destroy_per_dir_info(php_per_dir_config *conf)
-{
- zend_hash_destroy(conf->ini_settings);
- php_handler_stack_destroy(&conf->response_handlers);
- php_handler_stack_destroy(&conf->auth_handlers);
- php_handler_stack_destroy(&conf->access_handlers);
- php_handler_stack_destroy(&conf->type_handlers);
- php_handler_stack_destroy(&conf->fixup_handlers);
- php_handler_stack_destroy(&conf->logger_handlers);
- php_handler_stack_destroy(&conf->post_read_handlers);
- php_handler_stack_destroy(&conf->headers_handlers);
- free(conf->ini_settings);
-}
-/* }}} */
-
-/* {{{ php_create_server
- */
-static void *php_create_server(pool *p, char *dummy)
-{
- php_per_server_config *conf;
- conf = (php_per_server_config *) malloc(sizeof(php_per_server_config));
- register_cleanup(p, (void *) conf, (void (*)(void *)) php_destroy_per_server_info, (void (*)(void *)) php_destroy_per_server_info);
-
- sapi_stack_init_ex(&conf->requires, 1);
- sapi_stack_init_ex(&conf->uri_handlers, 1);
- return conf;
-}
-
-/* }}} */
-
-
-/* {{{ php_create_dir
- */
-static void *php_create_dir(pool *p, char *dummy)
-{
- php_per_dir_config *conf;
- conf = (php_per_dir_config *) malloc(sizeof(php_per_dir_config));
- conf->ini_settings = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init_ex(conf->ini_settings, 5, NULL, (void (*)(void *)) destroy_per_dir_entry, 1, 0);
- sapi_stack_init_ex(&conf->response_handlers, 1);
- sapi_stack_init_ex(&conf->headers_handlers, 1);
- sapi_stack_init_ex(&conf->auth_handlers, 1);
- sapi_stack_init_ex(&conf->access_handlers, 1);
- sapi_stack_init_ex(&conf->type_handlers, 1);
- sapi_stack_init_ex(&conf->fixup_handlers, 1);
- sapi_stack_init_ex(&conf->logger_handlers, 1);
- sapi_stack_init_ex(&conf->post_read_handlers, 1);
- register_cleanup(p, (void *) conf, (void (*)(void *)) php_destroy_per_dir_info, (void (*)(void *)) php_destroy_per_dir_info);
-
- return conf;
-}
-
-/* }}} */
-
-/* {{{ php_merge_dir
- */
-static void *php_merge_dir(pool *p, void *basev, void *addv)
-{
- php_per_dir_config *a = (php_per_dir_config *) addv;
- php_per_dir_config *b = (php_per_dir_config *) basev;
- /* This function *must* return addv, and not modify basev */
- zend_hash_merge_ex((HashTable *) a->ini_settings, (HashTable *) b->ini_settings, (copy_ctor_func_t) copy_per_dir_entry, sizeof(php_per_dir_entry), (merge_checker_func_t) should_overwrite_per_dir_entry, NULL);
- a->headers_handlers = (a->headers_handlers.top)?a->headers_handlers:b->headers_handlers;
- a->auth_handlers = (a->auth_handlers.top)?a->auth_handlers:b->auth_handlers;
- a->access_handlers = (a->access_handlers.top)?a->access_handlers:b->access_handlers;
- a->type_handlers = (a->type_handlers.top)?a->type_handlers:b->type_handlers;
- a->fixup_handlers = (a->fixup_handlers.top)?a->fixup_handlers:b->fixup_handlers;
- a->logger_handlers = (a->logger_handlers.top)?a->logger_handlers:b->logger_handlers;
- a->post_read_handlers = (a->post_read_handlers.top)?a->post_read_handlers:b->post_read_handlers;
- a->response_handlers = (a->response_handlers.top)?a->response_handlers:b->response_handlers;
- return a;
-}
-/* }}} */
-
-/* {{{ php_apache_value_handler_ex
- */
-static CONST_PREFIX char *php_apache_value_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode)
-{
- php_per_dir_entry per_dir_entry;
-
- if (!apache_php_initialized) {
- apache_php_initialized = 1;
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
-#endif
- sapi_startup(&apache_sapi_module);
- php_apache_startup(&apache_sapi_module);
- }
- per_dir_entry.type = mode;
-
- if (strcasecmp(arg2, "none") == 0) {
- arg2 = "";
- }
-
- per_dir_entry.key_length = strlen(arg1);
- per_dir_entry.value_length = strlen(arg2);
-
- per_dir_entry.key = (char *) malloc(per_dir_entry.key_length+1);
- memcpy(per_dir_entry.key, arg1, per_dir_entry.key_length);
- per_dir_entry.key[per_dir_entry.key_length] = 0;
-
- per_dir_entry.value = (char *) malloc(per_dir_entry.value_length+1);
- memcpy(per_dir_entry.value, arg2, per_dir_entry.value_length);
- per_dir_entry.value[per_dir_entry.value_length] = 0;
-
- zend_hash_update(conf, per_dir_entry.key, per_dir_entry.key_length, &per_dir_entry, sizeof(php_per_dir_entry), NULL);
- return NULL;
-}
-/* }}} */
-
-static CONST_PREFIX char *php_set_server_handler(server_rec *s, char *arg1, long handler_stage, long handler_type)
-{
- php_per_server_config *conf;
- php_handler *handler;
- handler = (php_handler *) malloc(sizeof(php_handler));
- handler->type = handler_type;
- handler->stage = handler_stage;
- handler->name = strdup(arg1);
- conf = get_module_config(s->module_config, &php4_module);
- switch(handler_stage) {
- case AP_URI_TRANS:
- sapi_stack_push(&conf->uri_handlers, handler);
- break;
- default:
- sapi_stack_push(&conf->requires, handler);
- break;
- }
- return NULL;
-}
-
-static CONST_PREFIX char *php_set_dir_handler(php_per_dir_config *conf, char *arg1, long handler_stage, long handler_type)
-{
- php_handler *handler;
- handler = (php_handler *) malloc(sizeof(php_handler));
- handler->type = handler_type;
- handler->stage = handler_stage;
- handler->name = strdup(arg1);
- switch(handler_stage) {
- case AP_POST_READ:
- sapi_stack_push(&conf->post_read_handlers, handler);
- break;
- case AP_HEADER_PARSE:
- sapi_stack_push(&conf->headers_handlers, handler);
- break;
- case AP_ACCESS_CONTROL:
- sapi_stack_push(&conf->access_handlers, handler);
- break;
- case AP_AUTHENTICATION:
- sapi_stack_push(&conf->auth_handlers, handler);
- break;
- case AP_AUTHORIZATION:
- break;
- case AP_TYPE_CHECKING:
- sapi_stack_push(&conf->type_handlers, handler);
- break;
- case AP_FIXUP:
- sapi_stack_push(&conf->fixup_handlers, handler);
- break;
- case AP_RESPONSE:
- sapi_stack_push(&conf->response_handlers, handler);
- break;
- case AP_LOGGING:
- sapi_stack_push(&conf->logger_handlers, handler);
- break;
- default:
- break;
- }
- return NULL;
-}
-
-/* {{{ php_set_uri_handler
- */
-static CONST_PREFIX char *php_set_uri_handler(cmd_parms *cmd, void *dummy, char *arg1)
-{
- return php_set_server_handler(cmd->server, arg1, AP_URI_TRANS, AP_HANDLER_TYPE_FILE);
-}
-/* }}} */
-
-/* {{{ php_set_uri_handler_code */
-static CONST_PREFIX char *php_set_uri_handler_code(cmd_parms *cmd, void *dummy, char *arg1)
-{
- return php_set_server_handler(cmd->server, arg1, AP_URI_TRANS, AP_HANDLER_TYPE_METHOD);
-}
-/* }}} */
-
-/* {{{ php_set_header_handler
- */
-static CONST_PREFIX char *php_set_header_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_HEADER_PARSE, AP_HANDLER_TYPE_FILE);
-}
-static CONST_PREFIX char *php_set_header_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_HEADER_PARSE, AP_HANDLER_TYPE_METHOD);
-}
-/* }}} */
-
-/* {{{ php_set_auth_handler
- */
-static CONST_PREFIX char *php_set_auth_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_AUTHENTICATION, AP_HANDLER_TYPE_FILE);
-}
-static CONST_PREFIX char *php_set_auth_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_AUTHENTICATION, AP_HANDLER_TYPE_METHOD);
-}
-
-/* }}} */
-
-/* {{{ php_set_access_handler
- */
-static CONST_PREFIX char *php_set_access_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_ACCESS_CONTROL, AP_HANDLER_TYPE_FILE);
-}
-static CONST_PREFIX char *php_set_access_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_ACCESS_CONTROL, AP_HANDLER_TYPE_METHOD);
-}
-
-/* }}} */
-
-/* {{{ php_set_type_handler
- */
-static CONST_PREFIX char *php_set_type_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_TYPE_CHECKING, AP_HANDLER_TYPE_FILE);
-}
-static CONST_PREFIX char *php_set_type_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_TYPE_CHECKING, AP_HANDLER_TYPE_METHOD);
-}
-
-/* }}} */
-
-/* {{{ php_set_fixup_handler
- */
-static CONST_PREFIX char *php_set_fixup_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_FIXUP, AP_HANDLER_TYPE_FILE);
-}
-static CONST_PREFIX char *php_set_fixup_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_FIXUP, AP_HANDLER_TYPE_METHOD);
-}
-/* }}} */
-
-/* {{{ php_set_logger_handler
- */
-static CONST_PREFIX char *php_set_logger_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_LOGGING, AP_HANDLER_TYPE_FILE);
-}
-static CONST_PREFIX char *php_set_logger_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_LOGGING, AP_HANDLER_TYPE_METHOD);
-}
-
-/* }}} */
-
-/* {{{ php_set_post_read_handler
- */
-static CONST_PREFIX char *php_set_post_read_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_POST_READ, AP_HANDLER_TYPE_FILE);
-}
-static CONST_PREFIX char *php_set_post_read_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_POST_READ, AP_HANDLER_TYPE_METHOD);
-}
-
-
-/* }}} */
-
-/* {{{ php_set_require
- */
-
-static CONST_PREFIX char *php_set_require(cmd_parms *cmd, void *dummy, char *arg1)
-{
- return php_set_server_handler(cmd->server, arg1, 0, AP_HANDLER_TYPE_FILE);
-}
-/* }}} */
-
-/* {{{ php_set_response_handler
- */
-static CONST_PREFIX char *php_set_response_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_RESPONSE, AP_HANDLER_TYPE_FILE);
-}
-static CONST_PREFIX char *php_set_response_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
-{
- return php_set_dir_handler(conf, arg1, AP_RESPONSE, AP_HANDLER_TYPE_METHOD);
-}
-/* }}} */
-
-/* {{{ php_apache_value_handler
- */
-static CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2)
-{
- return php_apache_value_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_PERDIR);
-}
-/* }}} */
-
-/* {{{ php_apache_admin_value_handler
- */
-static CONST_PREFIX char *php_apache_admin_value_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2)
-{
- return php_apache_value_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_SYSTEM);
-}
-/* }}} */
-
-/* {{{ php_apache_flag_handler_ex
- */
-static CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode)
-{
- char bool_val[2];
-
- if (!strcasecmp(arg2, "On")) {
- bool_val[0] = '1';
- } else {
- bool_val[0] = '0';
- }
- bool_val[1] = 0;
-
- return php_apache_value_handler_ex(cmd, conf, arg1, bool_val, mode);
-}
-/* }}} */
-
-/* {{{ php_apache_flag_handler
- */
-static CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2)
-{
- return php_apache_flag_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_PERDIR);
-}
-/* }}} */
-
-/* {{{ php_apache_admin_flag_handler
- */
-static CONST_PREFIX char *php_apache_admin_flag_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2)
-{
- return php_apache_flag_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_SYSTEM);
-}
-/* }}} */
-
-/* {{{ int php_xbithack_handler(request_rec * r)
- */
-static int php_xbithack_handler(request_rec * r)
-{
- php_per_dir_config *conf;
- TSRMLS_FETCH();
-
- if (!(r->finfo.st_mode & S_IXUSR)) {
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module);
- if (conf) {
- zend_hash_apply((HashTable *) conf->ini_settings, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC);
- }
- if(!AP(xbithack)) {
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
- return send_parsed_php(r);
-}
-/* }}} */
-
-/* {{{ apache_php_module_shutdown_wrapper
- */
-static void apache_php_module_shutdown_wrapper(void)
-{
- apache_php_initialized = 0;
- apache_sapi_module.shutdown(&apache_sapi_module);
-
-#if MODULE_MAGIC_NUMBER >= 19970728
- /* This function is only called on server exit if the apache API
- * child_exit handler exists, so shutdown globally
- */
- sapi_shutdown();
-#endif
-
-#ifdef ZTS
- tsrm_shutdown();
-#endif
-}
-/* }}} */
-
-#if MODULE_MAGIC_NUMBER >= 19970728
-/* {{{ php_child_exit_handler
- */
-static void php_child_exit_handler(server_rec *s, pool *p)
-{
-/* apache_php_initialized = 0; */
- apache_sapi_module.shutdown(&apache_sapi_module);
-
-#ifdef ZTS
- tsrm_shutdown();
-#endif
-}
-/* }}} */
-#endif
-
-/* {{{ void php_init_handler(server_rec *s, pool *p)
- */
-static void php_init_handler(server_rec *s, pool *p)
-{
- register_cleanup(p, NULL, (void (*)(void *))apache_php_module_shutdown_wrapper, (void (*)(void *))php_module_shutdown_for_exec);
- if (!apache_php_initialized) {
- apache_php_initialized = 1;
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
-#endif
- sapi_startup(&apache_sapi_module);
- php_apache_startup(&apache_sapi_module);
- }
-#if MODULE_MAGIC_NUMBER >= 19980527
- {
- TSRMLS_FETCH();
- if (PG(expose_php)) {
- ap_add_version_component("PHP/" PHP_VERSION);
- }
- }
-#endif
-}
-/* }}} */
-
-static int php_run_hook(php_handler *handler, request_rec *r)
-{
- zval *ret = NULL;
- php_per_dir_config *conf;
-
- TSRMLS_FETCH();
-
- if(!AP(apache_config_loaded)) {
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module);
- if (conf)
- zend_hash_apply((HashTable *)conf->ini_settings, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC);
- AP(apache_config_loaded) = 1;
- }
- if (!handler->name) {
- return DECLINED;
- }
- php_save_umask();
- if (!AP(setup_env)) {
- AP(setup_env) = 1;
- add_common_vars(r);
- add_cgi_vars(r);
- }
- SG(server_context) = r;
- init_request_info(TSRMLS_C);
- apache_php_module_hook(r, handler, &ret TSRMLS_CC);
- php_restore_umask();
- kill_timeout(r);
- if (ret) {
- convert_to_long(ret);
- return Z_LVAL_P(ret);
- }
- return HTTP_INTERNAL_SERVER_ERROR;
-}
-
-
-static int php_uri_translation(request_rec *r)
-{
- php_per_server_config *conf;
- TSRMLS_FETCH();
- AP(current_hook) = AP_URI_TRANS;
- conf = (php_per_server_config *) get_module_config(r->server->module_config, &php4_module);
- return sapi_stack_apply_with_argument_stop_if_equals(&conf->uri_handlers,
- ZEND_STACK_APPLY_BOTTOMUP,
- (int (*)(void *element, void *)) php_run_hook, r, OK);
-}
-
-static int php_header_hook(request_rec *r)
-{
- php_per_dir_config *conf;
- TSRMLS_FETCH();
- AP(current_hook) = AP_HEADER_PARSE;
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module);
- return sapi_stack_apply_with_argument_stop_if_http_error(&conf->headers_handlers,
- ZEND_STACK_APPLY_BOTTOMUP,
- (int (*)(void *element, void *)) php_run_hook, r);
-}
-
-static int php_auth_hook(request_rec *r)
-{
- php_per_dir_config *conf;
- TSRMLS_FETCH();
- AP(current_hook) = AP_AUTHENTICATION;
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module);
- return sapi_stack_apply_with_argument_stop_if_equals(&conf->auth_handlers,
- ZEND_STACK_APPLY_BOTTOMUP,
- (int (*)(void *element, void *)) php_run_hook, r, OK);
-}
-
-static int php_access_hook(request_rec *r)
-{
- php_per_dir_config *conf;
- int status = DECLINED;
- TSRMLS_FETCH();
- AP(current_hook) = AP_ACCESS_CONTROL;
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module);
- status = sapi_stack_apply_with_argument_stop_if_http_error(&conf->access_handlers,
- ZEND_STACK_APPLY_BOTTOMUP,
- (int (*)(void *element, void *)) php_run_hook, r);
- return status;
-
-}
-
-static int php_type_hook(request_rec *r)
-{
- php_per_dir_config *conf;
- TSRMLS_FETCH();
- AP(current_hook) = AP_TYPE_CHECKING;
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module);
- return sapi_stack_apply_with_argument_stop_if_equals(&conf->type_handlers,
- ZEND_STACK_APPLY_BOTTOMUP,
- (int (*)(void *element, void *)) php_run_hook,
- r, OK);
-}
-
-static int php_fixup_hook(request_rec *r)
-{
- php_per_dir_config *conf;
- TSRMLS_FETCH();
- AP(current_hook) = AP_FIXUP;
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module);
- return sapi_stack_apply_with_argument_stop_if_http_error(&conf->fixup_handlers,
- ZEND_STACK_APPLY_BOTTOMUP,
- (int (*)(void *element, void *)) php_run_hook,
- r);
-}
-
-static int php_logger_hook(request_rec *r)
-{
- php_per_dir_config *conf;
- TSRMLS_FETCH();
- AP(current_hook) = AP_LOGGING;
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module);
- return sapi_stack_apply_with_argument_stop_if_http_error(&conf->logger_handlers,
- ZEND_STACK_APPLY_BOTTOMUP,
- (int (*)(void *element, void *)) php_run_hook,
- r);
-}
-
-static int php_post_read_hook(request_rec *r)
-{
- php_per_dir_config *conf;
- php_per_server_config *svr;
- TSRMLS_FETCH();
- AP(current_hook) = AP_POST_READ;
- svr = get_module_config(r->server->module_config, &php4_module);
- if(ap_is_initial_req(r)) {
- sapi_stack_apply_with_argument_all(&svr->requires, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_hook, r);
- }
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module);
- return sapi_stack_apply_with_argument_stop_if_http_error(&conf->post_read_handlers,
- ZEND_STACK_APPLY_BOTTOMUP,
- (int (*)(void *element, void *)) php_run_hook, r);
-}
-
-static int php_response_handler(request_rec *r)
-{
- php_per_dir_config *conf;
- TSRMLS_FETCH();
- AP(current_hook) = AP_RESPONSE;
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module);
- return sapi_stack_apply_with_argument_all(&conf->response_handlers, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_hook, r);
-}
-
-/* {{{ handler_rec php_handlers[]
- */
-handler_rec php_handlers[] =
-{
- {"application/x-httpd-php", send_parsed_php},
- {"application/x-httpd-php-source", send_parsed_php_source},
- {"text/html", php_xbithack_handler},
- {"php-script", php_response_handler},
- {NULL}
-};
-/* }}} */
-
-/* {{{ command_rec php_commands[]
- */
-command_rec php_commands[] =
-{
- {"php_value", php_apache_value_handler, NULL, OR_OPTIONS, TAKE2, "PHP Value Modifier"},
- {"phpUriHandler", php_set_uri_handler, NULL, RSRC_CONF, TAKE1, "PHP Value Modifier"},
- {"phpUriHandlerMethod", php_set_uri_handler_code, NULL, RSRC_CONF, TAKE1, "PHP Value Modifier"},
-#if MODULE_MAGIC_NUMBER >= 19970103
- {"phpHeaderHandler", php_set_header_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
- {"phpHeaderHandlerMethod", php_set_header_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
-#endif
- {"phpAuthHandler", php_set_auth_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
- {"phpAuthHandlerMethod", php_set_auth_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
- {"phpAccessHandler", php_set_access_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
- {"phpAccessHandlerMethod", php_set_access_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
- {"phpTypeHandler", php_set_type_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
- {"phpTypeHandlerMethod", php_set_type_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
- {"phpFixupHandler", php_set_fixup_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
- {"phpFixupHandlerMethod", php_set_fixup_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
- {"phpLoggerHandler", php_set_logger_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
- {"phpLoggerHandlerMethod", php_set_logger_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
-#if MODULE_MAGIC_NUMBER >= 19970902
- {"phpPostReadHandler", php_set_post_read_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
- {"phpPostReadHandlerMethod", php_set_post_read_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
- {"phpRequire", php_set_require, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
- {"phpResponseHandler", php_set_response_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
- {"phpResponseHandlerMethod", php_set_response_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"},
-#endif
- {"php_flag", php_apache_flag_handler, NULL, OR_OPTIONS, TAKE2, "PHP Flag Modifier"},
- {"php_admin_value", php_apache_admin_value_handler, NULL, ACCESS_CONF|RSRC_CONF, TAKE2, "PHP Value Modifier (Admin)"},
- {"php_admin_flag", php_apache_admin_flag_handler, NULL, ACCESS_CONF|RSRC_CONF, TAKE2, "PHP Flag Modifier (Admin)"},
- {NULL}
-};
-/* }}} */
-
-/* {{{ module MODULE_VAR_EXPORT php4_module
- */
-module MODULE_VAR_EXPORT php4_module =
-{
- STANDARD_MODULE_STUFF,
- php_init_handler, /* initializer */
- php_create_dir, /* per-directory config creator */
- php_merge_dir, /* dir merger */
- php_create_server, /* per-server config creator */
- NULL, /* merge server config */
- php_commands, /* command table */
- php_handlers, /* handlers */
- php_uri_translation, /* filename translation */
- NULL, /* check_user_id */
- php_auth_hook, /* check auth */
- php_access_hook, /* check access */
- php_type_hook, /* type_checker */
- php_fixup_hook, /* fixups */
- php_logger_hook /* logger */
-#if MODULE_MAGIC_NUMBER >= 19970103
- , php_header_hook /* header parser */
-#endif
-#if MODULE_MAGIC_NUMBER >= 19970719
- , NULL /* child_init */
-#endif
-#if MODULE_MAGIC_NUMBER >= 19970728
- , php_child_exit_handler /* child_exit */
-#endif
-#if MODULE_MAGIC_NUMBER >= 19970902
- , php_post_read_hook /* post read-request */
-#endif
-};
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/apache_hooks/mod_php4.exp b/sapi/apache_hooks/mod_php4.exp
deleted file mode 100644
index 2dca1256c2..0000000000
--- a/sapi/apache_hooks/mod_php4.exp
+++ /dev/null
@@ -1 +0,0 @@
-php4_module
diff --git a/sapi/apache_hooks/mod_php4.h b/sapi/apache_hooks/mod_php4.h
deleted file mode 100644
index 1adeecc687..0000000000
--- a/sapi/apache_hooks/mod_php4.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef MOD_PHP4_H
-#define MOD_PHP4_H
-
-#if !defined(WIN32) && !defined(WINNT)
-#ifndef MODULE_VAR_EXPORT
-#define MODULE_VAR_EXPORT
-#endif
-#endif
-
-typedef struct {
- long engine;
- long last_modified;
- long xbithack;
- long terminate_child;
- long setup_env;
- long current_hook;
- zend_bool in_request;
- zend_bool apache_config_loaded;
- zend_bool headers_sent;
-} php_apache_info_struct;
-
-typedef struct _php_handler {
- long type;
- long stage;
- char *name;
-} php_handler;
-
-#define AP_HANDLER_TYPE_FILE 0
-#define AP_HANDLER_TYPE_METHOD 1
-
-extern zend_module_entry apache_module_entry;
-
-#ifdef ZTS
-extern int php_apache_info_id;
-#define AP(v) TSRMG(php_apache_info_id, php_apache_info_struct *, v)
-#else
-extern php_apache_info_struct php_apache_info;
-#define AP(v) (php_apache_info.v)
-#endif
-
-/* defines for the various stages of the apache request */
-#define AP_WAITING_FOR_REQUEST 0
-#define AP_POST_READ 1
-#define AP_URI_TRANS 2
-#define AP_HEADER_PARSE 3
-#define AP_ACCESS_CONTROL 4
-#define AP_AUTHENTICATION 5
-#define AP_AUTHORIZATION 6
-#define AP_TYPE_CHECKING 7
-#define AP_FIXUP 8
-#define AP_RESPONSE 9
-#define AP_LOGGING 10
-#define AP_CLEANUP 11
-
-#endif /* MOD_PHP4_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/sapi/apache_hooks/php.sym b/sapi/apache_hooks/php.sym
deleted file mode 100644
index 2dca1256c2..0000000000
--- a/sapi/apache_hooks/php.sym
+++ /dev/null
@@ -1 +0,0 @@
-php4_module
diff --git a/sapi/apache_hooks/php4apache_hooks.dsp b/sapi/apache_hooks/php4apache_hooks.dsp
deleted file mode 100755
index 3a2f347d8a..0000000000
--- a/sapi/apache_hooks/php4apache_hooks.dsp
+++ /dev/null
@@ -1,151 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4apache_hooks" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4apache_hooks - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4apache_hooks.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4apache_hooks.mak" CFG="php4apache_hooks - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4apache_hooks - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4apache_hooks - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4apache_hooks - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4apache_hooks - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\..\regex" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\apache\src\include" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x60000000" /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\apache\src\corer" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4apache_hooks - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\..\regex" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\apache\src\include" /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x60000000" /version:4.0 /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php4apache_hooks.dll" /pdbtype:sept /libpath:"..\..\..\php_build\apache\src\cored" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php4apache_hooks - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS_inline"
-# PROP BASE Intermediate_Dir "Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\..\regex" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\apache\src\include" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"\apache\src\corer" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4apache_hooks - Win32 Release_TS"
-# Name "php4apache_hooks - Win32 Debug_TS"
-# Name "php4apache_hooks - Win32 Release_TS_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mod_php4.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_apache.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\sapi_apache.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\mod_php4.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_apache_http.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/sapi/apache_hooks/php_apache.c b/sapi/apache_hooks/php_apache.c
deleted file mode 100644
index a7869c3e43..0000000000
--- a/sapi/apache_hooks/php_apache.c
+++ /dev/null
@@ -1,1954 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Stig Sæther Bakken <ssb@php.net> |
- | David Sklar <sklar@student.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php_apache_http.h"
-
-#if defined(PHP_WIN32) || defined(NETWARE)
-#include "zend.h"
-#include "ap_compat.h"
-#else
-#include "build-defs.h"
-#endif
-
-#ifdef ZTS
-int php_apache_info_id;
-#else
-php_apache_info_struct php_apache_info;
-#endif
-
-#define SECTION(name) PUTS("<H2 align=\"center\">" name "</H2>\n")
-
-#undef offsetof
-#define offsetof(s_type,field) ((size_t)&(((s_type*)0)->field))
-
-extern module *top_module;
-extern module **ap_loaded_modules;
-static int le_apachereq;
-static zend_class_entry *apacherequest_class_entry;
-
-static void apache_table_to_zval(table *, int safe_mode, zval *return_value);
-
-PHP_FUNCTION(virtual);
-PHP_FUNCTION(apache_request_headers);
-PHP_FUNCTION(apache_response_headers);
-PHP_FUNCTION(apachelog);
-PHP_FUNCTION(apache_note);
-PHP_FUNCTION(apache_lookup_uri);
-PHP_FUNCTION(apache_child_terminate);
-PHP_FUNCTION(apache_setenv);
-PHP_FUNCTION(apache_get_version);
-PHP_FUNCTION(apache_get_modules);
-
-PHP_MINFO_FUNCTION(apache);
-
-
-function_entry apache_functions[] = {
- PHP_FE(virtual, NULL)
- PHP_FE(apache_request_headers, NULL)
- PHP_FE(apache_note, NULL)
- PHP_FE(apache_lookup_uri, NULL)
- PHP_FE(apache_child_terminate, NULL)
- PHP_FE(apache_setenv, NULL)
- PHP_FE(apache_response_headers, NULL)
- PHP_FE(apache_get_version, NULL)
- PHP_FE(apache_get_modules, NULL)
- PHP_FALIAS(getallheaders, apache_request_headers, NULL)
- {NULL, NULL, NULL}
-};
-
-/* {{{ php_apache ini entries
- */
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("xbithack", "0", PHP_INI_ALL, OnUpdateLong, xbithack, php_apache_info_struct, php_apache_info)
- STD_PHP_INI_ENTRY("engine", "1", PHP_INI_ALL, OnUpdateLong, engine, php_apache_info_struct, php_apache_info)
- STD_PHP_INI_ENTRY("last_modified", "0", PHP_INI_ALL, OnUpdateLong, last_modified, php_apache_info_struct, php_apache_info)
- STD_PHP_INI_ENTRY("child_terminate", "0", PHP_INI_ALL, OnUpdateLong, terminate_child, php_apache_info_struct, php_apache_info)
-PHP_INI_END()
-/* }}} */
-
-static void php_apache_globals_ctor(php_apache_info_struct *apache_globals TSRMLS_DC)
-{
- apache_globals->in_request = 0;
-}
-
-
-#define APREQ_GET_THIS(ZVAL) if (NULL == (ZVAL = getThis())) { \
- php_error(E_WARNING, "%s(): underlying ApacheRequest object missing", \
- get_active_function_name(TSRMLS_C)); \
- RETURN_FALSE; \
- }
-#define APREQ_GET_REQUEST(ZVAL, R) APREQ_GET_THIS(ZVAL); \
- R = get_apache_request(ZVAL TSRMLS_CC)
-
-static void php_apache_request_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- zval *z = (zval *)rsrc->ptr;
-/* fprintf(stderr, "%s() %p\n", __FUNCTION__, z); */
- zval_ptr_dtor(&z);
-}
-
-static request_rec *get_apache_request(pval *z TSRMLS_DC)
-{
- request_rec *r;
- zval **addr;
-
- if (NULL == z) {
- php_error(E_WARNING, "get_apache_request() invalid wrapper passed");
- return NULL;
- }
-
- if (Z_TYPE_P(z) != IS_OBJECT) {
- php_error(E_WARNING, "%s(): wrapper is not an object", get_active_function_name(TSRMLS_C));
- return NULL;
- }
-
- if (zend_hash_index_find(Z_OBJPROP_P(z), 0, (void **)&addr) == FAILURE) {
- php_error(E_WARNING, "%s(): underlying object missing", get_active_function_name(TSRMLS_C));
- return NULL;
- }
-
- r = (request_rec *)Z_LVAL_PP(addr);
- if (!r) {
- php_error(E_WARNING, "%s(): request_rec invalid", get_active_function_name(TSRMLS_C));
- return NULL;
- }
-
- return r;
-}
-
-/* {{{ php_apache_request_new(request_rec *r)
- * create a new zval-instance for ApacheRequest that wraps request_rec
- */
-zval *php_apache_request_new(request_rec *r)
-{
- zval *req;
- zval *addr;
-
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(addr);
- Z_TYPE_P(addr) = IS_LONG;
- Z_LVAL_P(addr) = (int) r;
-
- MAKE_STD_ZVAL(req);
- object_init_ex(req, apacherequest_class_entry);
- zend_hash_index_update(Z_OBJPROP_P(req), 0, &addr, sizeof(zval *), NULL);
-
- return req;
-}
-/* }}} */
-
-/* {{{ apache_request_read_string_slot()
- */
-static void apache_request_read_string_slot(int offset, INTERNAL_FUNCTION_PARAMETERS)
-{
- zval *id;
- request_rec *r;
- char *s;
-
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- APREQ_GET_REQUEST(id, r);
-
- s = *(char **)((char*)r + offset);
-
- if (s)
- RETURN_STRING(s, 1);
-
- RETURN_EMPTY_STRING();
-}
-/* }}} */
-
-
-/* {{{ apache_request_string_slot()
- */
-static void apache_request_string_slot(int offset, INTERNAL_FUNCTION_PARAMETERS)
-{
- zval *id, **new_value;
- request_rec *r;
- char *old_value;
- char **target;
-
- APREQ_GET_REQUEST(id, r);
-
- target = (char **)((char*)r + offset);
- old_value = *target;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- break;
- case 1:
- if (zend_get_parameters_ex(1, &new_value) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(new_value);
- *target = ap_pstrdup(r->pool, Z_STRVAL_PP(new_value));
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (old_value)
- RETURN_STRING(old_value, 1);
-
- RETURN_EMPTY_STRING();
-}
-/* }}} */
-
-/* {{{ apache_request_read_int_slot()
- */
-static void apache_request_read_int_slot(int offset, INTERNAL_FUNCTION_PARAMETERS)
-{
- zval *id;
- request_rec *r;
- long l;
-
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- APREQ_GET_REQUEST(id, r);
-
- l = *(long *)((char*)r + offset);
-
- RETURN_LONG(l);
-}
-/* }}} */
-
-/* {{{ apache_request_int_slot()
- */
-static void apache_request_int_slot(int offset, INTERNAL_FUNCTION_PARAMETERS)
-{
- zval *id, **new_value;
- request_rec *r;
- long old_value;
- long *target;
-
- APREQ_GET_REQUEST(id, r);
-
- target = (long *)((char*)r + offset);
- old_value = *target;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- break;
- case 1:
- if (zend_get_parameters_ex(1, &new_value) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(new_value);
- *target = Z_LVAL_PP(new_value);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- RETURN_LONG(old_value);
-}
-/* }}} */
-
-
-/* {{{ access string slots of request rec
- */
-
-/* {{{ proto string $request->filename([string new_filename])
- */
-PHP_FUNCTION(apache_request_filename)
-{
- apache_request_string_slot(offsetof(request_rec, filename), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto string $request->uri([string new_uri])
- */
-PHP_FUNCTION(apache_request_uri)
-{
- apache_request_string_slot(offsetof(request_rec, uri), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto string $request->unparsed_uri([string new_unparsed_uri])
- */
-PHP_FUNCTION(apache_request_unparsed_uri)
-{
- apache_request_string_slot(offsetof(request_rec, unparsed_uri), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto string $request->path_info([string new_path_info])
- */
-PHP_FUNCTION(apache_request_path_info)
-{
- apache_request_string_slot(offsetof(request_rec, path_info), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto string $request->args([string new_args])
- */
-PHP_FUNCTION(apache_request_args)
-{
- apache_request_string_slot(offsetof(request_rec, args), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto string $request->boundary()
- */
-PHP_FUNCTION(apache_request_boundary)
-{
- apache_request_read_string_slot(offsetof(request_rec, boundary), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-
-/* {{{ proto string $request->content_type([string new_type])
- */
-PHP_FUNCTION(apache_request_content_type)
-{
- apache_request_string_slot(offsetof(request_rec, content_type), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto string $request->content_encoding([string new_encoding])
- */
-PHP_FUNCTION(apache_request_content_encoding)
-{
- apache_request_string_slot(offsetof(request_rec, content_encoding), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto string $request->handler([string new_handler])
- */
-PHP_FUNCTION(apache_request_handler)
-{
- apache_request_string_slot(offsetof(request_rec, handler), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto string $request->the_request()
- */
-PHP_FUNCTION(apache_request_the_request)
-{
- apache_request_read_string_slot(offsetof(request_rec, the_request), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto string $request->protocol()
- */
-PHP_FUNCTION(apache_request_protocol)
-{
- apache_request_read_string_slot(offsetof(request_rec, protocol), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto string $request->hostname()
- */
-PHP_FUNCTION(apache_request_hostname)
-{
- apache_request_read_string_slot(offsetof(request_rec, hostname), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto string $request->status_line([string new_status_line])
- */
-PHP_FUNCTION(apache_request_status_line)
-{
- apache_request_string_slot(offsetof(request_rec, status_line), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto string $request->method()
- */
-PHP_FUNCTION(apache_request_method)
-{
- apache_request_read_string_slot(offsetof(request_rec, method), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* }}} access string slots of request rec */
-
-/* {{{ access int slots of request_rec
- */
-
-/* {{{ proto int $request->proto_num()
- */
-PHP_FUNCTION(apache_request_proto_num)
-{
- apache_request_read_int_slot(offsetof(request_rec, proto_num), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto int $request->assbackwards()
- */
-PHP_FUNCTION(apache_request_assbackwards)
-{
- apache_request_read_int_slot(offsetof(request_rec, assbackwards), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-
-/* {{{ proto int $request->proxyreq([int new_proxyreq])
- */
-PHP_FUNCTION(apache_request_proxyreq)
-{
- apache_request_int_slot(offsetof(request_rec, proxyreq), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto int $request->chunked()
- */
-PHP_FUNCTION(apache_request_chunked)
-{
- apache_request_read_int_slot(offsetof(request_rec, chunked), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-
-/* {{{ proto int $request->header_only()
- */
-PHP_FUNCTION(apache_request_header_only)
-{
- apache_request_read_int_slot(offsetof(request_rec, header_only), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto int $request->request_time()
- */
-PHP_FUNCTION(apache_request_request_time)
-{
- apache_request_read_int_slot(offsetof(request_rec, request_time), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto int $request->status([int new_status])
- */
-PHP_FUNCTION(apache_request_status)
-{
- apache_request_int_slot(offsetof(request_rec, status), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto int $request->method_number([int method_number])
- */
-PHP_FUNCTION(apache_request_method_number)
-{
- apache_request_read_int_slot(offsetof(request_rec, method_number), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto int $request->allowed([int allowed])
- */
-PHP_FUNCTION(apache_request_allowed)
-{
- apache_request_int_slot(offsetof(request_rec, allowed), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto int $request->bytes_sent()
- */
-PHP_FUNCTION(apache_request_bytes_sent)
-{
- apache_request_read_int_slot(offsetof(request_rec, bytes_sent), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto int $request->mtime()
- */
-PHP_FUNCTION(apache_request_mtime)
-{
- apache_request_read_int_slot(offsetof(request_rec, mtime), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto int $request->content_length([int new_content_length])
- */
-PHP_FUNCTION(apache_request_content_length)
-{
- zval *id, **zlen;
- request_rec *r;
-
- if (ZEND_NUM_ARGS() == 0) {
- apache_request_read_int_slot(offsetof(request_rec, clength), INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- else if (ZEND_NUM_ARGS() > 1) {
- WRONG_PARAM_COUNT;
- }
- else {
- if (zend_get_parameters_ex(1, &zlen) == FAILURE) {
- RETURN_FALSE;
- }
-
- APREQ_GET_REQUEST(id, r);
-
- convert_to_long_ex(zlen);
- (void)ap_set_content_length(r, Z_LVAL_PP(zlen));
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto int $request->remaining()
- */
-PHP_FUNCTION(apache_request_remaining)
-{
- apache_request_read_int_slot(offsetof(request_rec, remaining), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto int $request->no_cache()
- */
-PHP_FUNCTION(apache_request_no_cache)
-{
- apache_request_int_slot(offsetof(request_rec, no_cache), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto int $request->no_local_copy()
- */
-PHP_FUNCTION(apache_request_no_local_copy)
-{
- apache_request_int_slot(offsetof(request_rec, no_local_copy), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto int $request->read_body()
- */
-PHP_FUNCTION(apache_request_read_body)
-{
- apache_request_int_slot(offsetof(request_rec, read_body), INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-
-/* }}} access int slots of request_rec */
-
-
-/* {{{ proto array apache_request_headers_in()
- * fetch all incoming request headers
- */
-PHP_FUNCTION(apache_request_headers_in)
-{
- zval *id;
- request_rec *r;
-
- APREQ_GET_REQUEST(id, r);
-
- apache_table_to_zval(r->headers_in, 0, return_value);
-}
-/* }}} */
-
-
-/* {{{ add_header_to_table
-*/
-static void add_header_to_table(table *t, INTERNAL_FUNCTION_PARAMETERS)
-{
- zval *first = NULL;
- zval *second = NULL;
- zval **entry, **value;
- char *string_key;
- uint string_key_len;
- ulong num_key;
-
- zend_bool replace = 0;
- HashPosition pos;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|zb", &first, &second, &replace) == FAILURE)
- RETURN_FALSE;
-
- if (Z_TYPE_P(first) == IS_ARRAY) {
- switch(ZEND_NUM_ARGS()) {
- case 1:
- case 3:
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(first), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_P(first), (void **)&entry, &pos) == SUCCESS) {
- switch(zend_hash_get_current_key_ex(Z_ARRVAL_P(first), &string_key, &string_key_len, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- if (zend_hash_find(Z_ARRVAL_P(first), string_key, string_key_len, (void **)&value) == FAILURE) {
- zend_hash_move_forward_ex(Z_ARRVAL_P(first), &pos);
- continue;
- }
- if (!value) {
- zend_hash_move_forward_ex(Z_ARRVAL_P(first), &pos);
- continue;
- }
-
- convert_to_string_ex(value);
- if (replace)
- ap_table_set(t, string_key, Z_STRVAL_PP(value));
- else
- ap_table_merge(t, string_key, Z_STRVAL_PP(value));
-
- break;
- case HASH_KEY_IS_LONG:
- default:
- php_error(E_WARNING, "%s(): Can only add STRING keys to headers!", get_active_function_name(TSRMLS_C));
- break;
- }
-
- zend_hash_move_forward_ex(Z_ARRVAL_P(first), &pos);
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- }
- else if (Z_TYPE_P(first) == IS_STRING) {
- switch(ZEND_NUM_ARGS()) {
- case 2:
- case 3:
- convert_to_string_ex(&second);
- if (replace)
- ap_table_set(t, Z_STRVAL_P(first), Z_STRVAL_P(second));
- else
- ap_table_merge(t, Z_STRVAL_P(first), Z_STRVAL_P(second));
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- }
- else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-
-/* {{{ proto array apache_request_headers_out([{string name|array list} [, string value [, bool replace = false]]])
- * fetch all outgoing request headers
- */
-PHP_FUNCTION(apache_request_headers_out)
-{
- zval *id;
- request_rec *r;
-
- APREQ_GET_REQUEST(id, r);
-
- if (ZEND_NUM_ARGS() > 0)
- add_header_to_table(r->headers_out, INTERNAL_FUNCTION_PARAM_PASSTHRU);
-
- apache_table_to_zval(r->headers_out, 0, return_value);
-}
-/* }}} */
-
-
-/* {{{ proto array apache_request_err_headers_out([{string name|array list} [, string value [, bool replace = false]]])
- * fetch all headers that go out in case of an error or a subrequest
- */
-PHP_FUNCTION(apache_request_err_headers_out)
-{
- zval *id;
- request_rec *r;
-
- APREQ_GET_REQUEST(id, r);
-
- if (ZEND_NUM_ARGS() > 0)
- add_header_to_table(r->err_headers_out, INTERNAL_FUNCTION_PARAM_PASSTHRU);
-
- apache_table_to_zval(r->err_headers_out, 0, return_value);
-}
-/* }}} */
-
-
-/* {{{ proxy functions for the ap_* functions family
- */
-
-/* {{{ proto int apache_request_server_port()
- */
-PHP_FUNCTION(apache_request_server_port)
-{
- zval *id;
- request_rec *r;
-
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- APREQ_GET_REQUEST(id, r);
-
- RETURN_LONG(ap_get_server_port(r));
-}
-/* }}} */
-
-/* {{{ proto int apache_request_remote_host([int type])
- */
-PHP_FUNCTION(apache_request_remote_host)
-{
- zval *id, **ztype;
- request_rec *r;
- char *res;
- int type = REMOTE_NAME;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- break;
- case 1:
- if (zend_get_parameters_ex(1, &ztype) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(ztype);
- type = Z_LVAL_PP(ztype);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
-
- APREQ_GET_REQUEST(id, r);
-
- res = (char *)ap_get_remote_host(r->connection, r->per_dir_config, type);
- if (res)
- RETURN_STRING(res, 1);
-
- RETURN_EMPTY_STRING();
-}
-/* }}} */
-
-/* {{{ proto long apache_request_update_mtime([int dependency_mtime])
- */
-PHP_FUNCTION(apache_request_update_mtime)
-{
- zval *id, **zmtime;
- request_rec *r;
- int mtime = 0;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- break;
- case 1:
- if (zend_get_parameters_ex(1, &zmtime) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(zmtime);
- mtime = Z_LVAL_PP(zmtime);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
-
- APREQ_GET_REQUEST(id, r);
-
- RETURN_LONG(ap_update_mtime(r, mtime));
-}
-/* }}} */
-
-
-/* {{{ proto void apache_request_set_etag()
- */
-PHP_FUNCTION(apache_request_set_etag)
-{
- zval *id;
- request_rec *r;
-
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- APREQ_GET_REQUEST(id, r);
-
- ap_set_etag(r);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void apache_request_set_last_modified()
- */
-PHP_FUNCTION(apache_request_set_last_modified)
-{
- zval *id;
- request_rec *r;
-
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- APREQ_GET_REQUEST(id, r);
-
- ap_set_last_modified(r);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto long apache_request_meets_conditions()
- */
-PHP_FUNCTION(apache_request_meets_conditions)
-{
- zval *id;
- request_rec *r;
-
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- APREQ_GET_REQUEST(id, r);
-
- RETURN_LONG(ap_meets_conditions(r));
-}
-/* }}} */
-
-/* {{{ proto long apache_request_discard_request_body()
- */
-PHP_FUNCTION(apache_request_discard_request_body)
-{
- zval *id;
- request_rec *r;
-
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- APREQ_GET_REQUEST(id, r);
-
- RETURN_LONG(ap_discard_request_body(r));
-}
-/* }}} */
-
-/* {{{ proto long apache_request_satisfies()
- */
-PHP_FUNCTION(apache_request_satisfies)
-{
- zval *id;
- request_rec *r;
-
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- APREQ_GET_REQUEST(id, r);
-
- RETURN_LONG(ap_satisfies(r));
-}
-/* }}} */
-
-
-/* {{{ proto bool apache_request_is_initial_req()
- */
-PHP_FUNCTION(apache_request_is_initial_req)
-{
- zval *id;
- request_rec *r;
-
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- APREQ_GET_REQUEST(id, r);
-
- RETURN_BOOL(ap_is_initial_req(r));
-}
-/* }}} */
-
-/* {{{ proto bool apache_request_some_auth_required()
- */
-PHP_FUNCTION(apache_request_some_auth_required)
-{
- zval *id;
- request_rec *r;
-
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- APREQ_GET_REQUEST(id, r);
-
- RETURN_BOOL(ap_some_auth_required(r));
-}
-/* }}} */
-
-/* {{{ proto string apache_request_auth_type()
- */
-PHP_FUNCTION(apache_request_auth_type)
-{
- zval *id;
- request_rec *r;
- char *t;
-
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- APREQ_GET_REQUEST(id, r);
-
- t = (char *)ap_auth_type(r);
- if (!t)
- RETURN_NULL();
-
- RETURN_STRING(t, 1);
-}
-/* }}} */
-
-/* {{{ proto string apache_request_auth_name()
- */
-PHP_FUNCTION(apache_request_auth_name)
-{
- zval *id;
- request_rec *r;
- char *t;
-
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- APREQ_GET_REQUEST(id, r);
-
- t = (char *)ap_auth_name(r);
- if (!t)
- RETURN_NULL();
-
- RETURN_STRING(t, 1);
-}
-/* }}} */
-
-/* {{{ proto apache_request_basic_auth_pw()
- */
-PHP_FUNCTION(apache_request_basic_auth_pw)
-{
- zval *id, *zpw;
- request_rec *r;
- const char *pw;
- long status;
-
- if (ZEND_NUM_ARGS() != 1) {
- WRONG_PARAM_COUNT;
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zpw) == FAILURE) {
- RETURN_NULL();
- }
-
- if (!PZVAL_IS_REF(zpw)) {
- zend_error(E_WARNING, "Parameter wasn't passed by reference");
- RETURN_NULL();
- }
-
-
- APREQ_GET_REQUEST(id, r);
-
- pw = NULL;
- status = ap_get_basic_auth_pw(r, &pw);
- if (status == OK && pw) {
- ZVAL_STRING(zpw, (char *)pw, 1);
- }
- else
- ZVAL_NULL(zpw);
- RETURN_LONG(status);
-}
-/* }}} */
-
-
-/* http_protocol.h */
-
-PHP_FUNCTION(apache_request_send_http_header)
-{
- zval *id;
- request_rec *r;
- char *type = NULL;
- int typelen;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &type, &typelen) == FAILURE)
- return;
- APREQ_GET_REQUEST(id, r);
- if(type) {
- r->content_type = pstrdup(r->pool, type);
- }
- ap_send_http_header(r);
- SG(headers_sent) = 1;
- AP(headers_sent) = 1;
- RETURN_TRUE;
-}
-
-PHP_FUNCTION(apache_request_basic_http_header)
-{
- zval *id;
- request_rec *r;
-
- APREQ_GET_REQUEST(id, r);
-
- ap_basic_http_header((request_rec *)SG(server_context));
- SG(headers_sent) = 1;
- AP(headers_sent) = 1;
- RETURN_TRUE;
-}
-
-PHP_FUNCTION(apache_request_send_http_trace)
-{
- zval *id;
- request_rec *r;
-
- APREQ_GET_REQUEST(id, r);
-
- ap_send_http_trace((request_rec *)SG(server_context));
- SG(headers_sent) = 1;
- AP(headers_sent) = 1;
- RETURN_TRUE;
-}
-
-PHP_FUNCTION(apache_request_send_http_options)
-{
- zval *id;
- request_rec *r;
-
- APREQ_GET_REQUEST(id, r);
-
- ap_send_http_options((request_rec *)SG(server_context));
- SG(headers_sent) = 1;
- AP(headers_sent) = 1;
- RETURN_TRUE;
-}
-
-PHP_FUNCTION(apache_request_send_error_response)
-{
- zval **recursive;
- zval *id;
- request_rec *r;
- int rec;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- rec = 0;
- break;
- case 1:
- if(zend_get_parameters_ex(1, &recursive) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(recursive);
- rec = Z_LVAL_PP(recursive);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- APREQ_GET_REQUEST(id, r);
- ap_send_error_response(r, rec);
- RETURN_TRUE;
-}
-
-PHP_FUNCTION(apache_request_set_content_length)
-{
- zval **length;
- zval *id;
- request_rec *r;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &length) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- APREQ_GET_REQUEST(id, r);
-
- convert_to_long_ex(length);
- ap_set_content_length(r, Z_LVAL_PP(length));
- RETURN_TRUE;
-}
-
-PHP_FUNCTION(apache_request_set_keepalive)
-{
- zval *id;
- request_rec *r;
- APREQ_GET_REQUEST(id, r);
- ap_set_keepalive(r);
- RETURN_TRUE;
-}
-
-/* This stuff should use streams or however this is implemented now
-
-PHP_FUNCTION(apache_request_send_fd)
-{
-}
-
-PHP_FUNCTION(apache_request_send_fd_length)
-{
-}
-*/
-
-/* These are for overriding default output behaviour */
-PHP_FUNCTION(apache_request_rputs)
-{
- zval **buffer;
- zval *id;
- request_rec *r;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &buffer) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- APREQ_GET_REQUEST(id, r);
- convert_to_string_ex(buffer);
- ap_rwrite(Z_STRVAL_PP(buffer), Z_STRLEN_PP(buffer), (request_rec*)SG(server_context));
-}
-
-/* This stuff would be useful for custom POST handlers,
- which should be supported. Probably by not using
- sapi_activate at all inside a phpResponseHandler
- and instead using a builtin composed of the below
- calls as a apache_read_request_body() and allow
- people to custom craft their own.
-
-PHP_FUNCTION(apache_request_setup_client_block)
-{
-}
-
-PHP_FUNCTION(apache_request_should_client_block)
-{
-}
-
-PHP_FUNCTION(apache_request_get_client_block)
-{
-}
-
-PHP_FUNCTION(apache_request_discard_request_body)
-{
-}
-*/
-
-/* http_log.h */
-
-/* {{{ proto boolean apache_request_log_error(string message, [long facility])
- */
-PHP_FUNCTION(apache_request_log_error)
-{
- zval *id;
- zval **z_errstr, **z_facility;
- request_rec *r;
- int facility = APLOG_ERR;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if(zend_get_parameters_ex(1, &z_errstr) == FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if(zend_get_parameters_ex(1, &z_errstr, &z_facility) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(z_facility);
- facility = Z_LVAL_PP(z_facility);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- APREQ_GET_REQUEST(id, r);
- convert_to_string_ex(z_errstr);
- ap_log_error(APLOG_MARK, facility, r->server, "%s", Z_STRVAL_PP(z_errstr));
- RETURN_TRUE;
-}
-/* }}} */
-/* http_main.h */
-
-/* {{{ proto object apache_request_sub_req_lookup_uri(string uri)
- Returns sub-request for the specified uri. You would
- need to run it yourself with run()
-*/
-PHP_FUNCTION(apache_request_sub_req_lookup_uri)
-{
- zval *id;
- zval **file;
- request_rec *r, *sub_r;
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- APREQ_GET_REQUEST(id, r);
- convert_to_string_ex(file);
- sub_r = ap_sub_req_lookup_uri(Z_STRVAL_PP(file), r);
- if(!sub_r) {
- RETURN_FALSE;
- }
- return_value = php_apache_request_new(sub_r);
-}
-/* }}} */
-
-/* {{{ proto object apache_request_sub_req_lookup_file(string file)
- Returns sub-request for the specified file. You would
- need to run it yourself with run().
-*/
-PHP_FUNCTION(apache_request_sub_req_lookup_file)
-{
- zval *id;
- zval **file;
- request_rec *r, *sub_r;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- APREQ_GET_REQUEST(id, r);
- convert_to_string_ex(file);
- sub_r = ap_sub_req_lookup_file(Z_STRVAL_PP(file), r);
- if(!sub_r) {
- RETURN_FALSE;
- }
- return_value = php_apache_request_new(sub_r);
-}
-/* }}} */
-
-/* {{{ proto object apache_request_sub_req_method_uri(string method, string uri)
- Returns sub-request for the specified file. You would
- need to run it yourself with run().
-*/
-PHP_FUNCTION(apache_request_sub_req_method_uri)
-{
- zval *id;
- zval **file, **method;
- request_rec *r, *sub_r;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &method, &file) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- APREQ_GET_REQUEST(id, r);
- convert_to_string_ex(method);
- convert_to_string_ex(file);
- sub_r = ap_sub_req_method_uri(Z_STRVAL_PP(method),Z_STRVAL_PP(file), r);
- if(!sub_r) {
- RETURN_FALSE;
- }
- return_value = php_apache_request_new(sub_r);
-}
-/* }}} */
-
-/* {{{ proto long apache_request_run
- This is a wrapper for ap_sub_run_req and ap_destory_sub_req. It takes
- sub_request, runs it, destroys it, and returns it's status.
-*/
-PHP_FUNCTION(apache_request_run)
-{
- zval *id;
- request_rec *r;
- int status;
-
- APREQ_GET_REQUEST(id, r);
- if(!r || ap_is_initial_req(r))
- RETURN_FALSE;
- status = ap_run_sub_req(r);
- ap_destroy_sub_req(r);
- RETURN_LONG(status);
-}
-/* }}} */
-
-PHP_FUNCTION(apache_request_internal_redirect)
-{
- zval *id;
- zval **new_uri;
- request_rec *r;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &new_uri) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- APREQ_GET_REQUEST(id, r);
- convert_to_string_ex(new_uri);
- ap_internal_redirect(Z_STRVAL_PP(new_uri), r);
-}
-
-PHP_FUNCTION(apache_request_send_header_field)
-{
- zval **fieldname;
- zval **fieldval;
- zval *id;
- request_rec *r;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fieldname, &fieldval) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(fieldname);
- convert_to_string_ex(fieldval);
- APREQ_GET_REQUEST(id, r);
-
- ap_send_header_field(r, Z_STRVAL_PP(fieldname), Z_STRVAL_PP(fieldval));
- SG(headers_sent) = 1;
- AP(headers_sent) = 1;
-}
-
-
-
-/* }}} */
-
-/* {{{ php_apache_request_class_functions
- */
-static function_entry php_apache_request_class_functions[] = {
- /* string slots */
- PHP_FALIAS(args, apache_request_args, NULL)
- PHP_FALIAS(boundary, apache_request_boundary, NULL)
- PHP_FALIAS(content_encoding, apache_request_content_encoding, NULL)
- PHP_FALIAS(content_type, apache_request_content_type, NULL)
- PHP_FALIAS(filename, apache_request_filename, NULL)
- PHP_FALIAS(handler, apache_request_handler, NULL)
- PHP_FALIAS(hostname, apache_request_hostname, NULL)
- PHP_FALIAS(method, apache_request_method, NULL)
- PHP_FALIAS(path_info, apache_request_path_info, NULL)
- PHP_FALIAS(protocol, apache_request_protocol, NULL)
- PHP_FALIAS(status_line, apache_request_status_line, NULL)
- PHP_FALIAS(the_request, apache_request_the_request, NULL)
- PHP_FALIAS(unparsed_uri, apache_request_unparsed_uri, NULL)
- PHP_FALIAS(uri, apache_request_uri, NULL)
-
- /* int slots */
- PHP_FALIAS(allowed, apache_request_allowed, NULL)
- PHP_FALIAS(bytes_sent, apache_request_bytes_sent, NULL)
- PHP_FALIAS(chunked, apache_request_chunked, NULL)
- PHP_FALIAS(content_length, apache_request_content_length, NULL)
- PHP_FALIAS(header_only, apache_request_header_only, NULL)
- PHP_FALIAS(method_number, apache_request_method_number, NULL)
- PHP_FALIAS(mtime, apache_request_mtime, NULL)
- PHP_FALIAS(no_cache, apache_request_no_cache, NULL)
- PHP_FALIAS(no_local_copy, apache_request_no_local_copy, NULL)
- PHP_FALIAS(proto_num, apache_request_proto_num, NULL)
- PHP_FALIAS(proxyreq, apache_request_proxyreq, NULL)
- PHP_FALIAS(read_body, apache_request_read_body, NULL)
- PHP_FALIAS(remaining, apache_request_remaining, NULL)
- PHP_FALIAS(request_time, apache_request_request_time, NULL)
- PHP_FALIAS(status, apache_request_status, NULL)
-
- /* tables & arrays */
- PHP_FALIAS(headers_in, apache_request_headers_in, NULL)
- PHP_FALIAS(headers_out, apache_request_headers_out, NULL)
- PHP_FALIAS(err_headers_out, apache_request_err_headers_out, NULL)
-
-
- /* proxy functions for the ap_* functions family */
-#undef auth_name
-#undef auth_type
-#undef discard_request_body
-#undef is_initial_req
-#undef meets_conditions
-#undef satisfies
-#undef set_etag
-#undef set_last_modified
-#undef some_auth_required
-#undef update_mtime
-#undef send_http_header
-#undef send_header_field
-#undef basic_http_header
-#undef send_http_trace
-#undef send_http_options
-#undef send_error_response
-#undef set_content_length
-#undef set_keepalive
-#undef rputs
-#undef log_error
-#undef lookup_uri
-#undef lookup_file
-#undef method_uri
-#undef run
-#undef internal_redirect
- PHP_FALIAS(auth_name, apache_request_auth_name, NULL)
- PHP_FALIAS(auth_type, apache_request_auth_type, NULL)
- PHP_FALIAS(basic_auth_pw, apache_request_basic_auth_pw, NULL)
- PHP_FALIAS(discard_request_body, apache_request_discard_request_body, NULL)
- PHP_FALIAS(is_initial_req, apache_request_is_initial_req, NULL)
- PHP_FALIAS(meets_conditions, apache_request_meets_conditions, NULL)
- PHP_FALIAS(remote_host, apache_request_remote_host, NULL)
- PHP_FALIAS(satisfies, apache_request_satisfies, NULL)
- PHP_FALIAS(server_port, apache_request_server_port, NULL)
- PHP_FALIAS(set_etag, apache_request_set_etag, NULL)
- PHP_FALIAS(set_last_modified, apache_request_set_last_modified, NULL)
- PHP_FALIAS(some_auth_required, apache_request_some_auth_required, NULL)
- PHP_FALIAS(update_mtime, apache_request_update_mtime, NULL)
- PHP_FALIAS(send_http_header, apache_request_send_http_header, NULL)
- PHP_FALIAS(basic_http_header, apache_request_basic_http_header, NULL)
- PHP_FALIAS(send_header_field, apache_request_send_header_field, NULL)
- PHP_FALIAS(send_http_trace, apache_request_send_http_trace, NULL)
- PHP_FALIAS(send_http_options, apache_request_send_http_trace, NULL)
- PHP_FALIAS(send_error_response, apache_request_send_error_response, NULL)
- PHP_FALIAS(set_content_length, apache_request_set_content_length, NULL)
- PHP_FALIAS(set_keepalive, apache_request_set_keepalive, NULL)
- PHP_FALIAS(rputs, apache_request_rputs, NULL)
- PHP_FALIAS(log_error, apache_request_log_error, NULL)
- PHP_FALIAS(lookup_uri, apache_request_sub_req_lookup_uri, NULL)
- PHP_FALIAS(lookup_file, apache_request_sub_req_lookup_file, NULL)
- PHP_FALIAS(method_uri, apache_request_sub_req_method_uri, NULL)
- PHP_FALIAS(run, apache_request_run, NULL)
- PHP_FALIAS(internal_redirect, apache_request_internal_redirect, NULL)
- { NULL, NULL, NULL }
-};
-/* }}} */
-
-
-static PHP_MINIT_FUNCTION(apache)
-{
- zend_class_entry ce;
-
-#ifdef ZTS
- ts_allocate_id(&php_apache_info_id, sizeof(php_apache_info_struct), (ts_allocate_ctor) php_apache_globals_ctor, NULL);
-#else
- php_apache_globals_ctor(&php_apache_info TSRMLS_CC);
-#endif
- REGISTER_INI_ENTRIES();
-
-
- le_apachereq = zend_register_list_destructors_ex(php_apache_request_free, NULL, "ApacheRequest", module_number);
- INIT_OVERLOADED_CLASS_ENTRY(ce, "ApacheRequest", php_apache_request_class_functions, NULL, NULL, NULL);
- apacherequest_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL TSRMLS_CC);
-
- REGISTER_LONG_CONSTANT("OK", OK, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DECLINED", DECLINED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FORBIDDEN", FORBIDDEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("AUTH_REQUIRED", AUTH_REQUIRED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DONE", DONE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SERVER_ERROR", SERVER_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("REDIRECT", REDIRECT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("BAD_REQUEST", BAD_REQUEST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("NOT_FOUND", NOT_FOUND, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_CONTINUE", HTTP_CONTINUE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_SWITCHING_PROTOCOLS", HTTP_SWITCHING_PROTOCOLS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_PROCESSING", HTTP_PROCESSING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_OK", HTTP_OK, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_CREATED", HTTP_CREATED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_ACCEPTED", HTTP_ACCEPTED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_NON_AUTHORITATIVE", HTTP_NON_AUTHORITATIVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_NO_CONTENT", HTTP_NO_CONTENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_RESET_CONTENT", HTTP_RESET_CONTENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_PARTIAL_CONTENT", HTTP_PARTIAL_CONTENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_MULTI_STATUS", HTTP_MULTI_STATUS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_MULTIPLE_CHOICES", HTTP_MULTIPLE_CHOICES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_MOVED_PERMANENTLY", HTTP_MOVED_PERMANENTLY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_MOVED_TEMPORARILY", HTTP_MOVED_TEMPORARILY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_SEE_OTHER", HTTP_SEE_OTHER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_NOT_MODIFIED", HTTP_NOT_MODIFIED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_USE_PROXY", HTTP_USE_PROXY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_TEMPORARY_REDIRECT", HTTP_TEMPORARY_REDIRECT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_BAD_REQUEST", HTTP_BAD_REQUEST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_UNAUTHORIZED", HTTP_UNAUTHORIZED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_PAYMENT_REQUIRED", HTTP_PAYMENT_REQUIRED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_FORBIDDEN", HTTP_FORBIDDEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_NOT_FOUND", HTTP_NOT_FOUND, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_METHOD_NOT_ALLOWED", HTTP_METHOD_NOT_ALLOWED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_NOT_ACCEPTABLE", HTTP_NOT_ACCEPTABLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_PROXY_AUTHENTICATION_REQUIRED", HTTP_PROXY_AUTHENTICATION_REQUIRED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_REQUEST_TIME_OUT", HTTP_REQUEST_TIME_OUT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_CONFLICT", HTTP_CONFLICT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_GONE", HTTP_GONE, CONST_CS | CONST_PERSISTENT);REGISTER_LONG_CONSTANT("HTTP_LENGTH_REQUIRED", HTTP_LENGTH_REQUIRED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_PRECONDITION_FAILED", HTTP_PRECONDITION_FAILED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_REQUEST_ENTITY_TOO_LARGE", HTTP_REQUEST_ENTITY_TOO_LARGE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_REQUEST_URI_TOO_LARGE", HTTP_REQUEST_URI_TOO_LARGE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_UNSUPPORTED_MEDIA_TYPE", HTTP_UNSUPPORTED_MEDIA_TYPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_RANGE_NOT_SATISFIABLE", HTTP_RANGE_NOT_SATISFIABLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_EXPECTATION_FAILED", HTTP_EXPECTATION_FAILED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_UNPROCESSABLE_ENTITY", HTTP_UNPROCESSABLE_ENTITY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_LOCKED", HTTP_LOCKED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_FAILED_DEPENDENCY", HTTP_FAILED_DEPENDENCY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_INTERNAL_SERVER_ERROR", HTTP_INTERNAL_SERVER_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_NOT_IMPLEMENTED", HTTP_NOT_IMPLEMENTED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_BAD_GATEWAY", HTTP_BAD_GATEWAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_SERVICE_UNAVAILABLE", HTTP_SERVICE_UNAVAILABLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_GATEWAY_TIME_OUT", HTTP_GATEWAY_TIME_OUT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_VERSION_NOT_SUPPORTED", HTTP_VERSION_NOT_SUPPORTED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_VARIANT_ALSO_VARIES", HTTP_VARIANT_ALSO_VARIES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_INSUFFICIENT_STORAGE", HTTP_INSUFFICIENT_STORAGE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HTTP_NOT_EXTENDED", HTTP_NOT_EXTENDED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("APLOG_EMERG", APLOG_EMERG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("APLOG_ALERT", APLOG_ALERT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("APLOG_CRIT", APLOG_CRIT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("APLOG_ERR", APLOG_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("APLOG_WARNING", APLOG_WARNING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("APLOG_NOTICE", APLOG_NOTICE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("APLOG_INFO", APLOG_INFO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("APLOG_DEBUG", APLOG_DEBUG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_GET", M_GET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_PUT", M_PUT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_POST", M_POST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_DELETE", M_DELETE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_CONNECT", M_CONNECT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_OPTIONS", M_OPTIONS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_TRACE", M_TRACE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_PATCH", M_PATCH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_PROPFIND", M_PROPFIND, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_PROPPATCH", M_PROPPATCH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_MKCOL", M_MKCOL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_COPY", M_COPY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_MOVE", M_MOVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_LOCK", M_LOCK, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_UNLOCK", M_UNLOCK, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("M_INVALID", M_INVALID, CONST_CS | CONST_PERSISTENT);
-
- /* Possible values for request_rec.read_body (set by handling module):
- * REQUEST_NO_BODY Send 413 error if message has any body
- * REQUEST_CHUNKED_ERROR Send 411 error if body without Content-Length
- * REQUEST_CHUNKED_DECHUNK If chunked, remove the chunks for me.
- * REQUEST_CHUNKED_PASS Pass the chunks to me without removal.
- */
- REGISTER_LONG_CONSTANT("REQUEST_NO_BODY", REQUEST_NO_BODY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("REQUEST_CHUNKED_ERROR", REQUEST_CHUNKED_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("REQUEST_CHUNKED_DECHUNK", REQUEST_CHUNKED_DECHUNK, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("REQUEST_CHUNKED_PASS", REQUEST_CHUNKED_PASS, CONST_CS | CONST_PERSISTENT);
-
- /* resolve types for remote_host() */
- REGISTER_LONG_CONSTANT("REMOTE_HOST", REMOTE_HOST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("REMOTE_NAME", REMOTE_NAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("REMOTE_NOLOOKUP", REMOTE_NOLOOKUP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("REMOTE_DOUBLE_REV", REMOTE_DOUBLE_REV, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-
-static PHP_MSHUTDOWN_FUNCTION(apache)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-zend_module_entry apache_module_entry = {
- STANDARD_MODULE_HEADER,
- "apache",
- apache_functions,
- PHP_MINIT(apache),
- PHP_MSHUTDOWN(apache),
- NULL,
- NULL,
- PHP_MINFO(apache),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-/* {{{ proto bool apache_child_terminate(void)
- Terminate apache process after this request */
-PHP_FUNCTION(apache_child_terminate)
-{
-#ifndef MULTITHREAD
- if (AP(terminate_child)) {
- ap_child_terminate( ((request_rec *)SG(server_context)) );
- RETURN_TRUE;
- } else { /* tell them to get lost! */
- php_error(E_WARNING, "apache.child_terminate is disabled");
- RETURN_FALSE;
- }
-#else
- php_error(E_WARNING, "apache_child_terminate() is not supported in this build");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto string apache_note(string note_name [, string note_value])
- Get and set Apache request notes */
-PHP_FUNCTION(apache_note)
-{
- zval **arg_name, **arg_val;
- char *note_val;
- int arg_count = ZEND_NUM_ARGS();
-
- if (arg_count<1 || arg_count>2 ||
- zend_get_parameters_ex(arg_count, &arg_name, &arg_val) ==FAILURE ) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg_name);
- note_val = (char *) table_get(((request_rec *)SG(server_context))->notes, (*arg_name)->value.str.val);
-
- if (arg_count == 2) {
- convert_to_string_ex(arg_val);
- table_set(((request_rec *)SG(server_context))->notes, (*arg_name)->value.str.val, (*arg_val)->value.str.val);
- }
-
- if (note_val) {
- RETURN_STRING(note_val, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(apache)
-{
- module *modp = NULL;
- char output_buf[128];
-#if !defined(WIN32) && !defined(WINNT)
- char name[64];
- char modulenames[1024];
- char *p;
-#endif
- server_rec *serv;
- extern char server_root[MAX_STRING_LEN];
- extern uid_t user_id;
- extern char *user_name;
- extern gid_t group_id;
- extern int max_requests_per_child;
-
- serv = ((request_rec *) SG(server_context))->server;
-
-
- php_info_print_table_start();
-
-#ifdef PHP_WIN32
- php_info_print_table_row(1, "Apache for Windows 95/NT");
- php_info_print_table_end();
- php_info_print_table_start();
-#elif defined(NETWARE)
- php_info_print_table_row(1, "Apache for NetWare");
- php_info_print_table_end();
- php_info_print_table_start();
-#else
- php_info_print_table_row(2, "APACHE_INCLUDE", PHP_APACHE_INCLUDE);
- php_info_print_table_row(2, "APACHE_TARGET", PHP_APACHE_TARGET);
-#endif
-
- php_info_print_table_row(2, "Apache Version", SERVER_VERSION);
-
-#ifdef APACHE_RELEASE
- sprintf(output_buf, "%d", APACHE_RELEASE);
- php_info_print_table_row(2, "Apache Release", output_buf);
-#endif
- sprintf(output_buf, "%d", MODULE_MAGIC_NUMBER);
- php_info_print_table_row(2, "Apache API Version", output_buf);
- sprintf(output_buf, "%s:%u", serv->server_hostname, serv->port);
- php_info_print_table_row(2, "Hostname:Port", output_buf);
-#if !defined(WIN32) && !defined(WINNT)
- sprintf(output_buf, "%s(%d)/%d", user_name, (int)user_id, (int)group_id);
- php_info_print_table_row(2, "User/Group", output_buf);
- sprintf(output_buf, "Per Child: %d - Keep Alive: %s - Max Per Connection: %d", max_requests_per_child, serv->keep_alive ? "on":"off", serv->keep_alive_max);
- php_info_print_table_row(2, "Max Requests", output_buf);
-#endif
- sprintf(output_buf, "Connection: %d - Keep-Alive: %d", serv->timeout, serv->keep_alive_timeout);
- php_info_print_table_row(2, "Timeouts", output_buf);
-#if !defined(WIN32) && !defined(WINNT)
-/*
- This block seems to be working on NetWare; But it seems to be showing
- all modules instead of just the loaded ones
-*/
- php_info_print_table_row(2, "Server Root", server_root);
-
- strcpy(modulenames, "");
- for(modp = top_module; modp; modp = modp->next) {
- strlcpy(name, modp->name, sizeof(name));
- if ((p = strrchr(name, '.'))) {
- *p='\0'; /* Cut off ugly .c extensions on module names */
- }
- strcat(modulenames, name);
- if (modp->next) {
- strcat(modulenames, ", ");
- }
- }
- php_info_print_table_row(2, "Loaded Modules", modulenames);
-#endif
-
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-
- {
- register int i;
- array_header *arr;
- table_entry *elts;
- request_rec *r;
-
- r = ((request_rec *) SG(server_context));
- arr = table_elts(r->subprocess_env);
- elts = (table_entry *)arr->elts;
-
- SECTION("Apache Environment");
- php_info_print_table_start();
- php_info_print_table_header(2, "Variable", "Value");
- for (i=0; i < arr->nelts; i++) {
- php_info_print_table_row(2, elts[i].key, elts[i].val);
- }
- php_info_print_table_end();
- }
-
- {
- array_header *env_arr;
- table_entry *env;
- int i;
- request_rec *r;
-
- r = ((request_rec *) SG(server_context));
- SECTION("HTTP Headers Information");
- php_info_print_table_start();
- php_info_print_table_colspan_header(2, "HTTP Request Headers");
- php_info_print_table_row(2, "HTTP Request", r->the_request);
- env_arr = table_elts(r->headers_in);
- env = (table_entry *)env_arr->elts;
- for (i = 0; i < env_arr->nelts; ++i) {
- if (env[i].key && (!PG(safe_mode) || (PG(safe_mode) && strncasecmp(env[i].key, "authorization", 13)))) {
- php_info_print_table_row(2, env[i].key, env[i].val);
- }
- }
- php_info_print_table_colspan_header(2, "HTTP Response Headers");
- env_arr = table_elts(r->headers_out);
- env = (table_entry *)env_arr->elts;
- for(i = 0; i < env_arr->nelts; ++i) {
- if (env[i].key) {
- php_info_print_table_row(2, env[i].key, env[i].val);
- }
- }
- php_info_print_table_end();
- }
-}
-/* }}} */
-
-/* {{{ proto bool virtual(string filename)
- Perform an Apache sub-request */
-/* This function is equivalent to <!--#include virtual...-->
- * in mod_include. It does an Apache sub-request. It is useful
- * for including CGI scripts or .shtml files, or anything else
- * that you'd parse through Apache (for .phtml files, you'd probably
- * want to use <?Include>. This only works when PHP is compiled
- * as an Apache module, since it uses the Apache API for doing
- * sub requests.
- */
-PHP_FUNCTION(virtual)
-{
- pval **filename;
- request_rec *rr = NULL;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- if (!(rr = sub_req_lookup_uri ((*filename)->value.str.val, ((request_rec *) SG(server_context))))) {
- php_error(E_WARNING, "Unable to include '%s' - URI lookup failed", (*filename)->value.str.val);
- if (rr) destroy_sub_req (rr);
- RETURN_FALSE;
- }
-
- if (rr->status != 200) {
- php_error(E_WARNING, "Unable to include '%s' - error finding URI", (*filename)->value.str.val);
- if (rr) destroy_sub_req (rr);
- RETURN_FALSE;
- }
-
- php_end_ob_buffers(1 TSRMLS_CC);
- php_header(TSRMLS_C);
-
- if (run_sub_req(rr)) {
- php_error(E_WARNING, "Unable to include '%s' - request execution failed", (*filename)->value.str.val);
- if (rr) destroy_sub_req (rr);
- RETURN_FALSE;
- } else {
- if (rr) destroy_sub_req (rr);
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-
-/* {{{ apache_table_to_zval(table *, int safe_mode, zval *return_value)
- Fetch all HTTP request headers */
-static void apache_table_to_zval(table *t, int safe_mode, zval *return_value)
-{
- array_header *env_arr;
- table_entry *tenv;
- int i;
-
- array_init(return_value);
- env_arr = table_elts(t);
- tenv = (table_entry *)env_arr->elts;
- for (i = 0; i < env_arr->nelts; ++i) {
- if (!tenv[i].key ||
- (safe_mode && !strncasecmp(tenv[i].key, "authorization", 13))) {
- continue;
- }
- if (add_assoc_string(return_value, tenv[i].key, (tenv[i].val==NULL) ? "" : tenv[i].val, 1)==FAILURE) {
- RETURN_FALSE;
- }
- }
-
-}
-/* }}} */
-
-
-/* {{{ proto array getallheaders(void)
-*/
-/* Alias for apache_request_headers() */
-/* }}} */
-
-/* {{{ proto array apache_request_headers(void)
- Fetch all HTTP request headers */
-PHP_FUNCTION(apache_request_headers)
-{
- apache_table_to_zval(((request_rec *)SG(server_context))->headers_in, PG(safe_mode), return_value);
-}
-/* }}} */
-
-/* {{{ proto array apache_response_headers(void)
- Fetch all HTTP response headers */
-PHP_FUNCTION(apache_response_headers)
-{
- apache_table_to_zval(((request_rec *) SG(server_context))->headers_out, 0, return_value);
-}
-/* }}} */
-
-/* {{{ proto bool apache_setenv(string variable, string value [, bool walk_to_top])
- Set an Apache subprocess_env variable */
-PHP_FUNCTION(apache_setenv)
-{
- int var_len, val_len, top=0;
- char *var = NULL, *val = NULL;
- request_rec *r = (request_rec *) SG(server_context);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|b", &var, &var_len, &val, &val_len, &top) == FAILURE) {
- RETURN_FALSE;
- }
-
- while(top) {
- if(r->prev) r = r->prev;
- else break;
- }
-
- ap_table_setn(r->subprocess_env, ap_pstrndup(r->pool, var, var_len), ap_pstrndup(r->pool, val, val_len));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto object apache_lookup_uri(string URI)
- Perform a partial request of the given URI to obtain information about it */
-PHP_FUNCTION(apache_lookup_uri)
-{
- pval **filename;
- request_rec *rr=NULL;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- if(!(rr = sub_req_lookup_uri((*filename)->value.str.val, ((request_rec *) SG(server_context))))) {
- php_error(E_WARNING, "URI lookup failed", (*filename)->value.str.val);
- RETURN_FALSE;
- }
- object_init(return_value);
- add_property_long(return_value,"status", rr->status);
- if (rr->the_request) {
- add_property_string(return_value,"the_request", rr->the_request, 1);
- }
- if (rr->status_line) {
- add_property_string(return_value,"status_line", (char *)rr->status_line, 1);
- }
- if (rr->method) {
- add_property_string(return_value,"method", (char *)rr->method, 1);
- }
- if (rr->content_type) {
- add_property_string(return_value,"content_type", (char *)rr->content_type, 1);
- }
- if (rr->handler) {
- add_property_string(return_value,"handler", (char *)rr->handler, 1);
- }
- if (rr->uri) {
- add_property_string(return_value,"uri", rr->uri, 1);
- }
- if (rr->filename) {
- add_property_string(return_value,"filename", rr->filename, 1);
- }
- if (rr->path_info) {
- add_property_string(return_value,"path_info", rr->path_info, 1);
- }
- if (rr->args) {
- add_property_string(return_value,"args", rr->args, 1);
- }
- if (rr->boundary) {
- add_property_string(return_value,"boundary", rr->boundary, 1);
- }
- add_property_long(return_value,"no_cache", rr->no_cache);
- add_property_long(return_value,"no_local_copy", rr->no_local_copy);
- add_property_long(return_value,"allowed", rr->allowed);
- add_property_long(return_value,"sent_bodyct", rr->sent_bodyct);
- add_property_long(return_value,"bytes_sent", rr->bytes_sent);
- add_property_long(return_value,"byterange", rr->byterange);
- add_property_long(return_value,"clength", rr->clength);
-
-#if MODULE_MAGIC_NUMBER >= 19980324
- if (rr->unparsed_uri) {
- add_property_string(return_value,"unparsed_uri", rr->unparsed_uri, 1);
- }
- if(rr->mtime) {
- add_property_long(return_value,"mtime", rr->mtime);
- }
-#endif
- if(rr->request_time) {
- add_property_long(return_value,"request_time", rr->request_time);
- }
-
- destroy_sub_req(rr);
-}
-/* }}} */
-
-
-#if 0
-This function is most likely a bad idea. Just playing with it for now.
-
-PHP_FUNCTION(apache_exec_uri)
-{
- pval **filename;
- request_rec *rr=NULL;
- TSRMLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- if(!(rr = ap_sub_req_lookup_uri((*filename)->value.str.val, ((request_rec *) SG(server_context))))) {
- php_error(E_WARNING, "URI lookup failed", (*filename)->value.str.val);
- RETURN_FALSE;
- }
- RETVAL_LONG(ap_run_sub_req(rr));
- ap_destroy_sub_req(rr);
-}
-#endif
-
-/* {{{ proto string apache_get_version(void)
- Fetch Apache version */
-PHP_FUNCTION(apache_get_version)
-{
- char *apv = (char *) ap_get_server_version();
-
- if (apv && *apv) {
- RETURN_STRING(apv, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array apache_get_modules(void)
- Get a list of loaded Apache modules */
-PHP_FUNCTION(apache_get_modules)
-{
- int n;
- char *p;
-
- array_init(return_value);
-
- for (n = 0; ap_loaded_modules[n]; ++n) {
- char *s = (char *) ap_loaded_modules[n]->name;
- if ((p = strchr(s, '.'))) {
- add_next_index_stringl(return_value, s, (p - s), 1);
- } else {
- add_next_index_string(return_value, s, 1);
- }
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/apache_hooks/php_apache_http.h b/sapi/apache_hooks/php_apache_http.h
deleted file mode 100644
index b9b3c63715..0000000000
--- a/sapi/apache_hooks/php_apache_http.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#define NO_REGEX_EXTRA_H
-
-#ifdef WIN32
-#include <winsock2.h>
-#include <stddef.h>
-#endif
-
-#ifdef NETWARE
-#include <netinet/in.h>
-#endif
-
-#include "zend.h"
-#include "zend_stack.h"
-#include "php_regex.h"
-
-#include "httpd.h"
-#include "http_config.h"
-
-#if MODULE_MAGIC_NUMBER > 19980712
-# include "ap_compat.h"
-#else
-# if MODULE_MAGIC_NUMBER > 19980324
-# include "compat.h"
-# endif
-#endif
-
-#include "http_core.h"
-#include "http_main.h"
-#include "http_protocol.h"
-#include "http_request.h"
-#include "http_log.h"
-#include "util_script.h"
-
-#include "php_variables.h"
-#include "php_main.h"
-#include "php_ini.h"
-#include "ext/standard/php_standard.h"
-
-#include "mod_php4.h"
-
-
-zval *php_apache_request_new(request_rec *r);
-
-int apache_php_module_hook(request_rec *r, php_handler *handler, zval **ret TSRMLS_DC);
diff --git a/sapi/apache_hooks/sapi_apache.c b/sapi/apache_hooks/sapi_apache.c
deleted file mode 100644
index 72a65d0046..0000000000
--- a/sapi/apache_hooks/sapi_apache.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
- | PHP 4.0 patches by: |
- | Zeev Suraski <zeev@zend.com> |
- | Stig Bakken <ssb@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php_apache_http.h"
-
-/* {{{ apache_php_module_main
- */
-int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC)
-{
- zend_file_handle file_handle;
-
- if (php_request_startup(TSRMLS_C) == FAILURE) {
- return FAILURE;
- }
- /* sending a file handle to another dll is not working
- // so let zend open it.
- */
-
- if (display_source_mode) {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- php_get_highlight_struct(&syntax_highlighter_ini);
- if (highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC)){
- return OK;
- } else {
- return NOT_FOUND;
- }
- } else {
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.handle.fd = 0;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.opened_path = NULL;
- file_handle.free_filename = 0;
- (void) php_execute_script(&file_handle TSRMLS_CC);
- }
- AP(in_request) = 0;
-
- return (OK);
-}
-/* }}} */
-
-/* {{{ apache_php_module_hook
- */
-int apache_php_module_hook(request_rec *r, php_handler *handler, zval **ret TSRMLS_DC)
-{
- zend_file_handle file_handle;
- zval *req;
- char *tmp;
-
-#if PHP_SIGCHILD
- signal(SIGCHLD, sigchld_handler);
-#endif
- if(AP(current_hook) == AP_RESPONSE) {
- if (php_request_startup_for_hook(TSRMLS_C) == FAILURE)
- return FAILURE;
- }
- else {
- if (php_request_startup_for_hook(TSRMLS_C) == FAILURE)
- return FAILURE;
- }
-
- req = php_apache_request_new(r);
- if(PG(register_globals)) {
- php_register_variable_ex("request", req, NULL TSRMLS_CC);
- }
- else {
- php_register_variable_ex("request", req, PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
- }
- switch(handler->type) {
- case AP_HANDLER_TYPE_FILE:
- php_register_variable("PHP_SELF_HOOK", handler->name, PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
- memset(&file_handle, 0, sizeof(file_handle));
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = handler->name;
- (void) php_execute_simple_script(&file_handle, ret TSRMLS_CC);
- break;
- case AP_HANDLER_TYPE_METHOD:
- if( (tmp = strstr(handler->name, "::")) != NULL && *(tmp+2) != '\0' ) {
- zval *class;
- zval *method;
- *tmp = '\0';
- ALLOC_ZVAL(class);
- ZVAL_STRING(class, handler->name, 1);
- ALLOC_ZVAL(method);
- ZVAL_STRING(method, tmp +2, 1);
- *tmp = ':';
- call_user_function_ex(EG(function_table), &class, method, ret, 0, NULL, 0, NULL TSRMLS_CC);
- zval_dtor(class);
- zval_dtor(method);
- }
- else {
- php_error(E_ERROR, "Unable to call %s - not a Class::Method\n", handler->name);
- /* not a class::method */
- }
- break;
- default:
- /* not a valid type */
- assert(0);
- break;
- }
- zval_dtor(req);
- AP(in_request) = 0;
-
- return OK;
-}
-
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/caudium/CREDITS b/sapi/caudium/CREDITS
deleted file mode 100644
index 45789dbdfe..0000000000
--- a/sapi/caudium/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Caudium / Roxen
-David Hedbor
diff --git a/sapi/caudium/README b/sapi/caudium/README
deleted file mode 100644
index 86ef65655d..0000000000
--- a/sapi/caudium/README
+++ /dev/null
@@ -1,16 +0,0 @@
-Embedded Caudium PHP support. It seems to work but isn't tested
-much. Due to a design choice it requires _Pike_ threads and a
-thread-safe PHP. It doesn't however require _Caudium_ to run in
-threaded mode. Due to the design, utilization of multiple processors
-should be pretty good.
-
-It requires a new Pike 7.0 and Caudium. It will not work with
-Roxen. Also, with the help of the VIRTUAL_DIR code in PHP, PHP
-execution should be very similar to that of mod_php or the cgi
-script.
-
-If you have any questions, please contact me, David Hedbor
-(neotron@php.net or neotron@caudium.net). For more information on
-Caudium, see http://caudium.net/ and http://caudium.org/.
-
-
diff --git a/sapi/caudium/TODO b/sapi/caudium/TODO
deleted file mode 100644
index b8217c5934..0000000000
--- a/sapi/caudium/TODO
+++ /dev/null
@@ -1,30 +0,0 @@
-TODO:
-
-- per-virtual-server configuration
-- configurable limit of number of concurrent PHP executions
-- fix setting of auth info.
-
-FIXED:
-+ => fixed
-- => not fixed and no fix planned
-? => Maybe fixed, maybe not.
-
-+ Allow multiple headers
- This is now fixed.
-+ fix backtraces
- Uses th_farm, thus problem is fixed
-+ exit in PHP exits Caudium
- Name conflict with do_exit in Pike and PHP. Reported to both teams.
-+ POST newline added?
- Was a Caudium bug.
-+ use th_farm
- Yeppers. Works great.
-- change cwd in single threaded mode
- There will be no single threaded mode support. The Caudium module
- will requite PHP ZTS and Pike threads to run. Single threaded PHP
- is rather uninteresting anyway.
-? Recursive mutex lock problem:
- Dunno if this is fixed. Major rewrite so it would have to be
- retested.
-
-
diff --git a/sapi/caudium/caudium.c b/sapi/caudium/caudium.c
deleted file mode 100644
index 3124f87a12..0000000000
--- a/sapi/caudium/caudium.c
+++ /dev/null
@@ -1,791 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Hedbor <neotron@php.net> |
- | Based on aolserver SAPI by Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#ifdef HAVE_CAUDIUM
-
-#include "php_ini.h"
-#include "php_globals.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "ext/standard/info.h"
-
-#include "php_version.h"
-
-/* Pike Include Files
- *
- * conflicts with pike avoided by only using long names. Requires a new
- * Pike 0.7 since it was implemented for this interface only.
- *
- */
-#define NO_PIKE_SHORTHAND
-
-/* Ok, we are now using Pike level threads to handle PHP4 since
- * the nice th_farm threads aren't working on Linux with glibc 2.2
- * (why this is I don't know).
- */
-#define USE_PIKE_LEVEL_THREADS
-
-#include <fdlib.h>
-#include <program.h>
-#include <pike_types.h>
-#include <interpret.h>
-#include <module_support.h>
-#include <array.h>
-#include <backend.h>
-#include <stralloc.h>
-#include <mapping.h>
-#include <object.h>
-#include <threads.h>
-#include <builtin_functions.h>
-#include <operators.h>
-#include <version.h>
-
-#if (PIKE_MAJOR_VERSION == 7 && PIKE_MINOR_VERSION == 1 && PIKE_BUILD_VERSION >= 12) || PIKE_MAJOR_VERSION > 7 || (PIKE_MAJOR_VERSION == 7 && PIKE_MINOR_VERSION > 1)
-# include "pike_error.h"
-#else
-# include "error.h"
-# ifndef Pike_error
-# define Pike_error error
-# endif
-#endif
-
-/* Pike 7.x and newer */
-#define MY_MAPPING_LOOP(md, COUNT, KEY) \
- for(COUNT=0;COUNT < md->data->hashsize; COUNT++ ) \
- for(KEY=md->data->hash[COUNT];KEY;KEY=KEY->next)
-
-#ifndef ZTS
-/* Need thread safety */
-#error You need to compile PHP with threads.
-#endif
-
-#ifndef PIKE_THREADS
-#error The PHP4 module requires that your Pike has thread support.
-#endif
-
-#undef HIDE_GLOBAL_VARIABLES
-#undef REVEAL_GLOBAL_VARIABLES
-#define HIDE_GLOBAL_VARIABLES()
-#define REVEAL_GLOBAL_VARIABLES()
-
-/* php_caudium_request is per-request object storage */
-
-typedef struct
-{
- struct mapping *request_data;
- struct object *my_fd_obj;
- struct svalue done_cb;
- struct pike_string *filename;
- int my_fd;
- int written;
- TSRMLS_D;
-} php_caudium_request;
-
-
-void pike_module_init(void);
-void pike_module_exit(void);
-static void free_struct(TSRMLS_D);
-void f_php_caudium_request_handler(INT32 args);
-
-/* Defines to get to the data supplied when the script is started. */
-
-/* Per thread storage area id... */
-static int caudium_globals_id;
-
-#define GET_THIS() php_caudium_request *_request = ts_resource(caudium_globals_id)
-#define THIS _request
-#define PTHIS ((php_caudium_request *)(Pike_fp->current_storage))
-/* File descriptor integer. Used to write directly to the FD without
- * passing Pike
- */
-#define MY_FD (THIS->my_fd)
-
-/* FD object. Really a PHPScript object from Pike which implements a couple
- * of functions to handle headers, writing and buffering.
- */
-#define MY_FD_OBJ ((struct object *)(THIS->my_fd_obj))
-
-/* Mapping with data supplied from the calling Caudium module. Contains
- * a mapping with headers, an FD object etc.
- */
-#define REQUEST_DATA ((struct mapping *)(THIS->request_data))
-
-extern int fd_from_object(struct object *o);
-static unsigned char caudium_php_initialized;
-
-#ifndef mt_lock_interpreter
-#define mt_lock_interpreter() mt_lock(&interpreter_lock);
-#define mt_unlock_interpreter() mt_unlock(&interpreter_lock);
-#endif
-
-
-/* This allows calling of pike functions from the PHP callbacks,
- * which requires the Pike interpreter to be locked.
- */
-#define THREAD_SAFE_RUN(COMMAND, what) do {\
- struct thread_state *state;\
- if((state = thread_state_for_id(th_self()))!=NULL) {\
- if(!state->swapped) {\
- COMMAND;\
- } else {\
- mt_lock_interpreter();\
- SWAP_IN_THREAD(state);\
- COMMAND;\
- SWAP_OUT_THREAD(state);\
- mt_unlock_interpreter();\
- }\
- }\
-} while(0)
-
-
-
-/* Low level header lookup. Basically looks for the named header in the mapping
- * headers in the supplied options mapping.
- */
-
-INLINE static struct svalue *lookup_header(char *headername)
-{
- struct svalue *headers, *value;
- struct pike_string *sind;
- GET_THIS();
- sind = make_shared_string("env");
- headers = low_mapping_string_lookup(REQUEST_DATA, sind);
- free_string(sind);
- if(!headers || headers->type != PIKE_T_MAPPING) return NULL;
- sind = make_shared_string(headername);
- value = low_mapping_string_lookup(headers->u.mapping, sind);
- free_string(sind);
- if(!value) return NULL;
- return value;
-}
-
-/* Lookup a header in the mapping and return the value as a string, or
- * return the default if it's missing
- */
-INLINE static char *lookup_string_header(char *headername, char *default_value)
-{
- struct svalue *head = NULL;
- THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup");
- if(!head || head->type != PIKE_T_STRING)
- return default_value;
- return head->u.string->str;
-}
-
-/* Lookup a header in the mapping and return the value as if it's an integer
- * and otherwise return the default.
- */
-INLINE static int lookup_integer_header(char *headername, int default_value)
-{
- struct svalue *head = NULL;
- THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup");
- if(!head || head->type != PIKE_T_INT)
- return default_value;
- return head->u.integer;
-}
-
-/*
- * php_caudium_low_ub_write() writes data to the client connection. Might be
- * rewritten to do more direct IO to save CPU and the need to lock the
- * interpreter for better threading.
- */
-
-INLINE static int
-php_caudium_low_ub_write(const char *str, uint str_length TSRMLS_DC) {
- int sent_bytes = 0;
- struct pike_string *to_write = NULL;
- GET_THIS();
- if(!MY_FD_OBJ->prog) {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return -1;
- }
- to_write = make_shared_binary_string(str, str_length);
- push_string(to_write);
- safe_apply(MY_FD_OBJ, "write", 1);
- if(Pike_sp[-1].type == PIKE_T_INT)
- sent_bytes = Pike_sp[-1].u.integer;
- pop_stack();
- if(sent_bytes != str_length) {
- /* This means the connection is closed. Dead. Gone. *sniff* */
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- }
- return sent_bytes;
-}
-
-/*
- * php_caudium_sapi_ub_write() calls php_caudium_low_ub_write in a Pike thread
- * safe manner or writes directly to the output FD if RXML post-parsing is
- * disabled.
- */
-
-static int
-php_caudium_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- GET_THIS();
- int sent_bytes = 0, fd = MY_FD;
- if(fd)
- {
- for(sent_bytes=0;sent_bytes < str_length;)
- {
- int written;
- written = fd_write(fd, str + sent_bytes, str_length - sent_bytes);
- if(written < 0)
- {
- switch(errno)
- {
- default:
- /* This means the connection is closed. Dead. Gone. *sniff* */
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- THIS->written += sent_bytes;
- return sent_bytes;
- case EINTR:
- case EWOULDBLOCK:
- continue;
- }
- } else {
- sent_bytes += written;
- }
- }
- THIS->written += sent_bytes;
- } else {
- THREAD_SAFE_RUN(sent_bytes = php_caudium_low_ub_write(str, str_length TSRMLS_CC),
- "write");
- }
- return sent_bytes;
-}
-
-/* php_caudium_set_header() sets a header in the header mapping. Called in a
- * thread safe manner from php_caudium_sapi_header_handler.
- */
-INLINE static void
-php_caudium_set_header(char *header_name, char *value, char *p)
-{
- struct svalue hsval;
- struct pike_string *hval, *ind, *hind;
- struct mapping *headermap;
- struct svalue *s_headermap, *soldval;
- int vallen;
- GET_THIS();
- // hval = make_shared_string(value);
- ind = make_shared_string(" _headers");
- hind = make_shared_binary_string(header_name,
- (int)(p - header_name));
-
- s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind);
- if(!s_headermap || s_headermap->type != PIKE_T_MAPPING)
- {
- struct svalue mappie;
- mappie.type = PIKE_T_MAPPING;
- headermap = allocate_mapping(1);
- mappie.u.mapping = headermap;
- mapping_string_insert(REQUEST_DATA, ind, &mappie);
- free_mapping(headermap);
- hval = make_shared_string(value);
- } else {
- headermap = s_headermap->u.mapping;
- soldval = low_mapping_string_lookup(headermap, hind);
- vallen = strlen(value);
- if(soldval != NULL &&
- soldval->type == PIKE_T_STRING &&
- soldval->u.string->size_shift == 0) {
- /* Existing, valid header. Prepend.*/
- hval = begin_shared_string(soldval->u.string->len + 1 + vallen);
- MEMCPY(hval->str, soldval->u.string->str, soldval->u.string->len);
- STR0(hval)[soldval->u.string->len] = '\0';
- MEMCPY(hval->str+soldval->u.string->len+1, value, vallen);
- hval = end_shared_string(hval);
- } else {
- hval = make_shared_string(value);
- }
- }
- hsval.type = PIKE_T_STRING;
- hsval.u.string = hval;
-
- mapping_string_insert(headermap, hind, &hsval);
-
- free_string(hval);
- free_string(ind);
- free_string(hind);
-}
-
-/*
- * php_caudium_sapi_header_handler() sets a HTTP reply header to be
- * sent to the client.
- */
-static int
-php_caudium_sapi_header_handler(sapi_header_struct *sapi_header,
- sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- char *header_name, *header_content, *p;
- header_name = sapi_header->header;
- header_content = p = strchr(header_name, ':');
-
- if(p) {
- do {
- header_content++;
- } while(*header_content == ' ');
- THREAD_SAFE_RUN(php_caudium_set_header(header_name, header_content, p), "header handler");
- }
- sapi_free_header(sapi_header);
- return 0;
-}
-
-/*
- * php_caudium_sapi_send_headers() flushes the headers to the client.
- * Called before real content is sent by PHP.
- */
-
-INLINE static int
-php_caudium_low_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- struct pike_string *ind;
- struct svalue *s_headermap;
- GET_THIS();
- if(!MY_FD_OBJ->prog) {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return SAPI_HEADER_SEND_FAILED;
- }
- ind = make_shared_string(" _headers");
- s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind);
- free_string(ind);
-
- push_int(SG(sapi_headers).http_response_code);
- if(s_headermap && s_headermap->type == PIKE_T_MAPPING)
- ref_push_mapping(s_headermap->u.mapping);
- else
- push_int(0);
- safe_apply(MY_FD_OBJ, "send_headers", 2);
- pop_stack();
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-static int
-php_caudium_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- int res = 0;
- THREAD_SAFE_RUN(res = php_caudium_low_send_headers(sapi_headers TSRMLS_CC), "send headers");
- return res;
-}
-
-/*
- * php_caudium_sapi_read_post() reads a specified number of bytes from
- * the client. Used for POST/PUT requests.
- */
-
-INLINE static int php_caudium_low_read_post(char *buf, uint count_bytes)
-{
- uint total_read = 0;
- GET_THIS();
- TSRMLS_FETCH();
-
- if(!MY_FD_OBJ->prog)
- {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return -1;
- }
- push_int(count_bytes);
- safe_apply(MY_FD_OBJ, "read_post", 1);
- if(Pike_sp[-1].type == PIKE_T_STRING) {
- MEMCPY(buf, Pike_sp[-1].u.string->str,
- (total_read = Pike_sp[-1].u.string->len));
- buf[total_read] = '\0';
- } else
- total_read = 0;
- pop_stack();
- return total_read;
-}
-
-static int
-php_caudium_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC)
-{
- uint total_read = 0;
- THREAD_SAFE_RUN(total_read = php_caudium_low_read_post(buf, count_bytes), "read post");
- return total_read;
-}
-
-/*
- * php_caudium_sapi_read_cookies() returns the Cookie header from
- * the HTTP request header
- */
-
-static char *
-php_caudium_sapi_read_cookies(TSRMLS_D)
-{
- char *cookies;
- cookies = lookup_string_header("HTTP_COOKIE", NULL);
- return cookies;
-}
-
-static void php_info_caudium(ZEND_MODULE_INFO_FUNC_ARGS)
-{
- /* char buf[512]; */
- php_info_print_table_start();
- php_info_print_table_row(2, "SAPI module version", "$Id$");
- /* php_info_print_table_row(2, "Build date", Ns_InfoBuildDate());
- php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile());
- php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog());
- php_info_print_table_row(2, "Installation path", Ns_InfoHomePath());
- php_info_print_table_row(2, "Hostname of server", Ns_InfoHostname());
- php_info_print_table_row(2, "Source code label", Ns_InfoLabel());
- php_info_print_table_row(2, "Server platform", Ns_InfoPlatform());
- snprintf(buf, 511, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion());
- php_info_print_table_row(2, "Server version", buf);
- snprintf(buf, 511, "%d day(s), %02d:%02d:%02d",
- uptime / 86400,
- (uptime / 3600) % 24,
- (uptime / 60) % 60,
- uptime % 60);
- php_info_print_table_row(2, "Server uptime", buf);
- */
- php_info_print_table_end();
-}
-
-static zend_module_entry php_caudium_module = {
- STANDARD_MODULE_HEADER,
- "Caudium",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- php_info_caudium,
- NULL,
- STANDARD_MODULE_PROPERTIES
-};
-
-
-INLINE static void low_sapi_caudium_register_variables(zval *track_vars_array TSRMLS_DC)
-{
- int i;
- struct keypair *k;
- struct svalue *headers;
- struct pike_string *sind;
- struct svalue *ind;
- struct svalue *val;
- GET_THIS();
- php_register_variable("PHP_SELF", SG(request_info).request_uri,
- track_vars_array TSRMLS_CC);
- php_register_variable("GATEWAY_INTERFACE", "CGI/1.1",
- track_vars_array TSRMLS_CC);
- php_register_variable("REQUEST_METHOD",
- (char *) SG(request_info).request_method,
- track_vars_array TSRMLS_CC);
- php_register_variable("REQUEST_URI", SG(request_info).request_uri,
- track_vars_array TSRMLS_CC);
- php_register_variable("PATH_TRANSLATED", SG(request_info).path_translated,
- track_vars_array TSRMLS_CC);
-
- sind = make_shared_string("env");
- headers = low_mapping_string_lookup(REQUEST_DATA, sind);
- free_string(sind);
- if(headers && headers->type == PIKE_T_MAPPING) {
- MY_MAPPING_LOOP(headers->u.mapping, i, k) {
- ind = &k->ind;
- val = &k->val;
- if(ind && ind->type == PIKE_T_STRING &&
- val && val->type == PIKE_T_STRING) {
- php_register_variable(ind->u.string->str, val->u.string->str,
- track_vars_array TSRMLS_CC );
- }
- }
- }
-}
-
-static void sapi_caudium_register_variables(zval *track_vars_array TSRMLS_DC)
-{
- THREAD_SAFE_RUN(low_sapi_caudium_register_variables(track_vars_array TSRMLS_CC), "register_variables");
-}
-
-
-static int php_caudium_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, &php_caudium_module, 1)==FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-/* this structure is static (as in "it does not change") */
-static sapi_module_struct caudium_sapi_module = {
- "caudium",
- "Caudium",
- php_caudium_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
- NULL, /* activate */
- NULL, /* deactivate */
- php_caudium_sapi_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
- php_error, /* error handler */
- php_caudium_sapi_header_handler, /* header handler */
- php_caudium_sapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
- php_caudium_sapi_read_post, /* read POST data */
- php_caudium_sapi_read_cookies, /* read cookies */
- sapi_caudium_register_variables, /* register server variables */
- NULL, /* Log message */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-/*
- * php_caudium_module_main() is called by the per-request handler and
- * "executes" the script
- */
-
-static void php_caudium_module_main(php_caudium_request *ureq)
-{
- int res;
- zend_file_handle file_handle;
-#ifndef USE_PIKE_LEVEL_THREADS
- struct thread_state *state;
- extern struct program *thread_id_prog;
-#endif
- TSRMLS_FETCH();
- GET_THIS();
- THIS->filename = ureq->filename;
- THIS->done_cb = ureq->done_cb;
- THIS->my_fd_obj = ureq->my_fd_obj;
- THIS->my_fd = ureq->my_fd;
- THIS->request_data = ureq->request_data;
- free(ureq);
-
-#ifndef USE_PIKE_LEVEL_THREADS
- mt_lock_interpreter();
- init_interpreter();
-#if PIKE_MAJOR_VERSION == 7 && PIKE_MINOR_VERSION < 1
- thread_id = low_clone(thread_id_prog);
- state = OBJ2THREAD(thread_id);
- Pike_stack_top=((char *)&state)+ (thread_stack_size-16384) * STACK_DIRECTION;
- recoveries = NULL;
- call_c_initializers(thread_id);
- OBJ2THREAD(thread_id)->id=th_self();
- num_threads++;
- thread_table_insert(thread_id);
- state->status=THREAD_RUNNING;
-#else
- Pike_interpreter.thread_id = low_clone(thread_id_prog);
- state = OBJ2THREAD(Pike_interpreter.thread_id);
- Pike_interpreter.stack_top=((char *)&state)+ (thread_stack_size-16384) * STACK_DIRECTION;
- Pike_interpreter.recoveries = NULL;
- call_c_initializers(Pike_interpreter.thread_id);
- state->id=th_self();
- // SWAP_OUT_THREAD(OBJ2THREAD(Pike_interpreter.thread_id));
- num_threads++;
- thread_table_insert(Pike_interpreter.thread_id);
- state->status=THREAD_RUNNING;
-#endif
- state->swapped = 0;
-#endif
- SG(request_info).query_string = lookup_string_header("QUERY_STRING", 0);
- SG(server_context) = (void *)1; /* avoid server_context == NULL */
-
- /* path_translated is apparently the absolute path to the file, not
- the translated PATH_INFO
- */
- SG(request_info).path_translated =
- lookup_string_header("SCRIPT_FILENAME", NULL);
- SG(request_info).request_uri = lookup_string_header("DOCUMENT_URI", NULL);
- if(!SG(request_info).request_uri)
- SG(request_info).request_uri = lookup_string_header("SCRIPT_NAME", NULL);
- SG(request_info).request_method = lookup_string_header("REQUEST_METHOD", "GET");
- SG(request_info).content_length = lookup_integer_header("HTTP_CONTENT_LENGTH", 0);
- SG(request_info).content_type = lookup_string_header("HTTP_CONTENT_TYPE", NULL);
- SG(sapi_headers).http_response_code = 200;
- if (!strcmp(SG(request_info).request_method, "HEAD")) {
- SG(request_info).headers_only = 1;
- } else {
- SG(request_info).headers_only = 0;
- }
-
- /* Let PHP4 handle the deconding of the AUTH */
- php_handle_auth_data(lookup_string_header("HTTP_AUTHORIZATION", NULL), TSRMLS_C);
- /* Swap out this thread and release the interpreter lock to allow
- * Pike threads to run. We wait since the above would otherwise require
- * a lot of unlock/lock.
- */
-#ifndef USE_PIKE_LEVEL_THREADS
- SWAP_OUT_THREAD(state);
- mt_unlock_interpreter();
-#else
- THREADS_ALLOW();
-#endif
-
-#ifdef VIRTUAL_DIR
- /* Change virtual directory, if the feature is enabled, which is
- * (almost) a requirement for PHP in Caudium. Might want to fail if it
- * isn't. Not a problem though, since it's on by default when using ZTS
- * which we require.
- */
- VCWD_CHDIR_FILE(THIS->filename->str);
-#endif
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = THIS->filename->str;
- file_handle.opened_path = NULL;
- file_handle.free_filename = 0;
-
- THIS->written = 0;
- res = php_request_startup(TSRMLS_C);
-
- if(res == FAILURE) {
- THREAD_SAFE_RUN({
- apply_svalue(&THIS->done_cb, 0);
- pop_stack();
- free_struct(TSRMLS_C);
- }, "Negative run response");
- } else {
- php_execute_script(&file_handle TSRMLS_CC);
- php_request_shutdown(NULL);
- THREAD_SAFE_RUN({
- push_int(THIS->written);
- apply_svalue(&THIS->done_cb, 1);
- pop_stack();
- free_struct(TSRMLS_C);
- }, "positive run response");
- }
-
-#ifndef USE_PIKE_LEVEL_THREADS
- mt_lock_interpreter();
- SWAP_IN_THREAD(state);
-#if PIKE_MAJOR_VERSION == 7 && PIKE_MINOR_VERSION < 1
- state->status=THREAD_EXITED;
- co_signal(& state->status_change);
- thread_table_delete(thread_id);
- free_object(thread_id);
- thread_id=NULL;
-#else
- state->status=THREAD_EXITED;
- co_signal(& state->status_change);
- thread_table_delete(Pike_interpreter.thread_id);
- free_object(Pike_interpreter.thread_id);
- Pike_interpreter.thread_id=NULL;
-#endif
- cleanup_interpret();
- num_threads--;
- mt_unlock_interpreter();
-#else
- THREADS_DISALLOW();
-#endif
-}
-
-/*
- * The php_caudium_request_handler() is called per request and handles
- * everything for one request.
- */
-
-void f_php_caudium_request_handler(INT32 args)
-{
- struct object *my_fd_obj;
- struct mapping *request_data;
- struct svalue *done_callback;
- struct pike_string *script;
- struct svalue *raw_fd;
- struct pike_string *ind;
- php_caudium_request *_request;
- THIS = malloc(sizeof(php_caudium_request));
- if(THIS == NULL)
- Pike_error("Out of memory.");
-
- get_all_args("PHP4.Interpreter->run", args, "%S%m%O%*", &script,
- &request_data, &my_fd_obj, &done_callback);
- if(done_callback->type != PIKE_T_FUNCTION)
- Pike_error("PHP4.Interpreter->run: Bad argument 4, expected function.\n");
- add_ref(request_data);
- add_ref(my_fd_obj);
- add_ref(script);
-
- THIS->request_data = request_data;
- THIS->my_fd_obj = my_fd_obj;
- THIS->filename = script;
- assign_svalue_no_free(&THIS->done_cb, done_callback);
-
- ind = make_shared_binary_string("my_fd", 5);
- raw_fd = low_mapping_string_lookup(THIS->request_data, ind);
- if(raw_fd && raw_fd->type == PIKE_T_OBJECT)
- {
- int fd = fd_from_object(raw_fd->u.object);
- if(fd == -1)
- THIS->my_fd = 0; /* Don't send directly to this FD... */
- else
- THIS->my_fd = fd;
- } else
- THIS->my_fd = 0;
-#ifdef USE_PIKE_LEVEL_THREADS
- php_caudium_module_main(THIS);
-#else
- th_farm((void (*)(void *))php_caudium_module_main, THIS);
-#endif
- pop_n_elems(args);
-}
-
-static void free_struct(TSRMLS_D)
-{
- GET_THIS();
- if(THIS->request_data) free_mapping(THIS->request_data);
- if(THIS->my_fd_obj) free_object(THIS->my_fd_obj);
- free_svalue(&THIS->done_cb);
- if(THIS->filename) free_string(THIS->filename);
- MEMSET(THIS, 0, sizeof(php_caudium_request));
-}
-
-
-/*
- * pike_module_init() is called by Pike once at startup
- *
- * This functions allocates basic structures
- */
-
-void pike_module_init( void )
-{
- if (!caudium_php_initialized) {
- caudium_php_initialized = 1;
- tsrm_startup(1, 1, 0, NULL);
- ts_allocate_id(&caudium_globals_id, sizeof(php_caudium_request), NULL, NULL);
- sapi_startup(&caudium_sapi_module);
- sapi_module.startup(&caudium_sapi_module);
- }
- start_new_program(); /* Text */
- pike_add_function("run", f_php_caudium_request_handler,
- "function(string, mapping, object, function:void)", 0);
- end_class("Interpreter", 0);
-}
-
-/*
- * pike_module_exit() performs the last steps before the
- * server exists. Shutdowns basic services and frees memory
- */
-
-void pike_module_exit(void)
-{
- caudium_php_initialized = 0;
- sapi_module.shutdown(&caudium_sapi_module);
- tsrm_shutdown();
-}
-#endif
diff --git a/sapi/caudium/config.m4 b/sapi/caudium/config.m4
deleted file mode 100644
index a4f76db1b6..0000000000
--- a/sapi/caudium/config.m4
+++ /dev/null
@@ -1,99 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-RESULT=no
-AC_MSG_CHECKING(for Caudium support)
-AC_ARG_WITH(caudium,
-[ --with-caudium=DIR Build PHP as a Pike module for use with Caudium
- DIR is the Caudium server dir, with the default value
- /usr/local/caudium/server.],
-[
- if test "$prefix" = "NONE"; then CPREF=/usr/local/; fi
- if test ! -d $withval ; then
- if test "$prefix" = "NONE"; then
- withval=/usr/local/caudium/server/
- else
- withval=$prefix/caudium/server/
- fi
- fi
- if test -f $withval/bin/caudium; then
- PIKE=$withval/bin/caudium
- elif test -f $withval/bin/pike; then
- PIKE=$withval/bin/pike
- else
- AC_MSG_ERROR(Couldn't find a pike in $withval/bin/)
- fi
- if $PIKE -e 'float v; int rel;sscanf(version(), "Pike v%f release %d", v, rel);v += rel/10000.0; if(v < 7.0268) exit(1); exit(0);'; then
- PIKE_MODULE_DIR=`$PIKE --show-paths 2>&1| grep '^Module' | sed -e 's/.*: //'`
- PIKE_INCLUDE_DIR=`echo $PIKE_MODULE_DIR | sed -e 's,lib/pike/modules,include/pike,' -e 's,lib/modules,include/pike,' `
- if test -z "$PIKE_INCLUDE_DIR" -o -z "$PIKE_MODULE_DIR"; then
- AC_MSG_ERROR(Failed to figure out Pike module and include directories)
- fi
- AC_MSG_RESULT(yes)
- PIKE=`echo $PIKE | pike -e 'int tries=100;
- string orig,pike=Stdio.File("stdin")->read()-"\n";
- orig=pike;
- if(search(orig, "/"))
- orig = combine_path(getcwd(), orig);
- while(!catch(pike=readlink(pike)) && tries--)
- ;
- write(combine_path(dirname(orig), pike)); '`
- PHP_ADD_INCLUDE($PIKE_INCLUDE_DIR)
- if test "$prefix" != "NONE"; then
- PIKE_C_INCLUDE=$prefix/include/`basename $PIKE`
- else
- PIKE_C_INCLUDE=/usr/local/include/`basename $PIKE`
- fi
- AC_MSG_CHECKING(for C includes in $PIKE_C_INCLUDE)
- if test -f $PIKE_C_INCLUDE/version.h; then
- PIKE_TEST_VER=`$PIKE -e 'string v; int rel;sscanf(version(), "Pike v%s release %d", v, rel); write(v+"."+rel);'`
- ###### VERSION MATCH CHECK #######
- PMAJOR="^#define PIKE_MAJOR_VERSION"
- PMINOR="^#define PIKE_MINOR_VERSION"
- PBUILD="^#define PIKE_BUILD_VERSION"
-
- PIKE_CMAJOR_VERSION=0
- PIKE_CMINOR_VERSION=0
- PIKE_CBUILD_VERSION=0
-
- PIKE_CMAJOR_VERSION=`grep "$PMAJOR" $PIKE_C_INCLUDE/version.h | sed -e 's/\(#define.*N \)\(.*\)/\2/'`
- if test -z "$PIKE_CMAJOR_VERSION"; then
- if test -n "`grep f_version $PIKE_C_INCLUDE/version.h`"; then
- PIKE_CMAJOR_VERSION=6
- fi
- else
- PIKE_CMINOR_VERSION=`grep "$PMINOR" $PIKE_C_INCLUDE/version.h | sed -e 's/\(#define.*N \)\(.*\)/\2/'`
- PIKE_CBUILD_VERSION=`grep "$PBUILD" $PIKE_C_INCLUDE/version.h | sed -e 's/\(#define.*N \)\(.*\)/\2/'`
- fi
-
- if test "$PIKE_TEST_VER" = "${PIKE_CMAJOR_VERSION}.${PIKE_CMINOR_VERSION}.${PIKE_CBUILD_VERSION}"; then
- PHP_ADD_INCLUDE($PIKE_C_INCLUDE)
- PIKE_INCLUDE_DIR="$PIKE_INCLUDE_DIR, $PIKE_C_INCLUDE"
- AC_MSG_RESULT(found)
- else
- AC_MSG_RESULT(version mismatch)
- fi
- else
- AC_MSG_RESULT(not found)
- fi
- else
- AC_MSG_ERROR(Caudium PHP4 requires Pike 7.0 or newer)
- fi
- PIKE_VERSION=`$PIKE -e 'string v; int rel;sscanf(version(), "Pike v%s release %d", v, rel); write(v+"."+rel);'`
- AC_DEFINE(HAVE_CAUDIUM,1,[Whether to compile with Caudium support])
- PHP_SELECT_SAPI(caudium, shared, caudium.c)
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $withval/lib/$PIKE_VERSION/PHP4.so"
- RESULT=" *** Pike binary used: $PIKE
- *** Pike include dir(s) used: $PIKE_INCLUDE_DIR
- *** Pike version: $PIKE_VERSION"
- dnl Always use threads since thread-free support really blows.
- PHP_BUILD_THREAD_SAFE
-
-])
-AC_MSG_RESULT($RESULT)
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
-
diff --git a/sapi/cgi/CREDITS b/sapi/cgi/CREDITS
deleted file mode 100644
index a1c6a0be59..0000000000
--- a/sapi/cgi/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-CGI / FastCGI
-Rasmus Lerdorf, Stig Bakken, Shane Caraveo
diff --git a/sapi/cgi/Makefile.frag b/sapi/cgi/Makefile.frag
deleted file mode 100644
index 57a3b2937c..0000000000
--- a/sapi/cgi/Makefile.frag
+++ /dev/null
@@ -1,2 +0,0 @@
-$(SAPI_CGI_PATH): $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
- $(BUILD_CGI)
diff --git a/sapi/cgi/README.FastCGI b/sapi/cgi/README.FastCGI
deleted file mode 100644
index 9e5d4ae97b..0000000000
--- a/sapi/cgi/README.FastCGI
+++ /dev/null
@@ -1,137 +0,0 @@
-Credits:
-Ben Mansell, Stephen Landamore, Daniel Silverstone, Shane Caraveo
-
-Building PHP
-------------
-
-You must add '--enable-fastcgi' to the configure command on Linux or
-OSX based systems to get fastcgi support in the php-cgi binary. You
-also must not use '--enable-discard-path'.
-
-Running the FastCGI PHP module
-------------------------------
-
-There are two ways to run the resulting 'php' binary after the fastcgi
-version has been built:
-
-1) Configure your web server to run the PHP binary itself.
-
-This is the simplest method, obviously you will have to configure your
-web server appropriately. Some web servers may also not support this method,
-or may not be as efficient.
-
-2) Run PHP separately from the web server.
-
-In this setup, PHP is started as a separate process entirely from the web
-server. It will listen on a socket for new FastCGI requests, and deliver
-PHP pages as appropriate. This is the recommended way of running PHP-FastCGI.
-To run this way, you must start the PHP binary running by giving it a port
-number to listen to on the command line, e.g.:
-
-./php -b 8002
-
-(you can also specify a bind address, e.g. ./php -b localhost:8002. However, this
- relies on the FastCGI devkit and does not seem to work properly)
-
-You must also configure your web server to connect to the appropriate port
-in order to talk to the PHP FastCGI process.
-
-The advantage of running PHP in this way is that it entirely separates the
-web server and PHP process, so that one cannot disrupt the other. It also
-allows PHP to be on an entirely separate machine from the web server if need
-be, you could even have several web servers utilising the same running PHP
-process if required!
-
-
-Using FastCGI PHP with Apache
-=============================
-
-First of all, you may well ask 'Why?'. After all, Apache already has mod_php.
-However, there are advantages to running PHP with FastCGI. Separating the
-PHP code from the web server removes 'bloat' from the main server, and should
-improve the performance of non-PHP requests. Secondly, having one permanent
-PHP process as opposed to one per apache process means that shared resources
-like persistent database connections are used more efficiently.
-
-First of all, make sure that the FastCGI module is enabled. You should have
-a line in your config like:
-
- LoadModule fastcgi_module /usr/lib/apache/2.0/mod_fastcgi.so
-
-Don't load mod_php, by the way. Make sure it is commented out!
-
- #LoadModule php4_module /usr/lib/apache/2.0/libphp4.so
-
-Now, we'll create a fcgi-bin directory, just like you would do with normal
-CGI scripts. You'll need to create a directory somewhere to store your
-FastCGI binaries. We'll use /space/fcgi-bin/ for this example. Remember to
-copy the FastCGI-PHP binary in there. (named 'php-cgi') This sets up
-php to run under mod_fastcgi as a dynamic server.
-
- ScriptAlias /fcgi-bin/ /space/fcgi-bin/
- <Location /fcgi-bin/>
- Options ExecCGI
- SetHandler fastcgi-script
- </Location>
-
-To setup a specific static configuration for php, you have to use
-the FastCgiServer configuration for mod_fastcgi. For this, do not
-use the above configuration, but rather the following.
-(see mod_fastcgi docs for more configuration information):
-
- Alias /fcgi-bin/ /space/fcgi-bin/
- FastCgiServer /path/to/php-cgi -processes 5
-
-For either of the above configurations, we need to tell Apache to
-use the FastCGI binary /fcgi-bin/php to deliver PHP pages.
-All that is needed is:
-
- AddType application/x-httpd-fastphp .php
- Action application/x-httpd-fastphp /fcgi-bin/php-cgi
-
-Now, if you restart Apache, php pages should now be delivered!
-
-Using FastCGI PHP with IIS or iPlanet
-=====================================
-
-FastCGI server plugins are available at www.caraveo.com/fastcgi/
-Documentation on these are sparse. iPlanet is not very tested,
-and no makefile exists yet for unix based iPlanet servers.
-
-
-Security
---------
-
-Be sure to run the php binary as an appropriate userid. Also, firewall out
-the port that PHP is listening on. In addition, you can set the environment
-variable FCGI_WEB_SERVER_ADDRS to control who can connect to the FastCGI.
-Set it to a comma separated list of IP addresses, e.g.:
-
-export FCGI_WEB_SERVER_ADDRS=199.170.183.28,199.170.183.71
-
-
-Tuning
-------
-
-There are a few tuning parameters that can be tweaked to control the
-performance of FastCGI PHP. The following are environment variables that can
-be set before running the PHP binary:
-
-PHP_FCGI_CHILDREN (default value: 8)
-
-This controls how many child processes the PHP process spawns. When the
-fastcgi starts, it creates a number of child processes which handle one
-page request at a time. So by default, you will be able to handle 8
-concurrent PHP page requests. Further requests will be queued.
-Increasing this number will allow for better concurrency, especially if you
-have pages that take a significant time to create, or supply a lot of data
-(e.g. downloading huge files via PHP). On the other hand, having more
-processes running will use more RAM, and letting too many PHP pages be
-generated concurrently will mean that each request will be slow.
-
-PHP_FCGI_MAX_REQUESTS (default value: 500)
-
-This controls how many requests each child process will handle before
-exitting. When one process exits, another will be created. This tuning is
-necessary because several PHP functions are known to have memory leaks. If the
-PHP processes were left around forever, they would be become very inefficient.
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
deleted file mode 100644
index 25f664dde3..0000000000
--- a/sapi/cgi/cgi_main.c
+++ /dev/null
@@ -1,1635 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Stig Bakken <ssb@php.net> |
- | Zeev Suraski <zeev@zend.com> |
- | FastCGI: Ben Mansell <php@slimyhorror.com> |
- | Shane Caraveo <shane@caraveo.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_variables.h"
-#include "zend_modules.h"
-
-#include "SAPI.h"
-
-#include <stdio.h>
-#include "php.h"
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#include "win32/signal.h"
-#include <process.h>
-#endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#if HAVE_SETLOCALE
-#include <locale.h>
-#endif
-#include "zend.h"
-#include "zend_extensions.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "php_main.h"
-#include "fopen_wrappers.h"
-#include "ext/standard/php_standard.h"
-#ifdef PHP_WIN32
-#include <io.h>
-#include <fcntl.h>
-#include "win32/php_registry.h"
-#endif
-
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-
-#ifdef __riscos__
-#include <unixlib/local.h>
-#endif
-
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-
-
-#include "php_getopt.h"
-
-#if PHP_FASTCGI
-#include "fcgi_config.h"
-#include "fcgiapp.h"
-/* don't want to include fcgios.h, causes conflicts */
-#ifdef PHP_WIN32
-extern int OS_SetImpersonate(void);
-#else
-/* XXX this will need to change later when threaded fastcgi is
- implemented. shane */
-struct sigaction act, old_term, old_quit, old_int;
-#endif
-
-static void (*php_php_import_environment_variables)(zval *array_ptr TSRMLS_DC);
-
-#ifndef PHP_WIN32
-/* these globals used for forking children on unix systems */
-/**
- * Number of child processes that will get created to service requests
- */
-static int children = 0;
-
-/**
- * Set to non-zero if we are the parent process
- */
-static int parent = 1;
-
-/**
- * Process group
- */
-static pid_t pgroup;
-#endif
-
-#endif
-
-#define PHP_MODE_STANDARD 1
-#define PHP_MODE_HIGHLIGHT 2
-#define PHP_MODE_INDENT 3
-#define PHP_MODE_LINT 4
-#define PHP_MODE_STRIP 5
-
-static char *optarg = NULL;
-static int optind = 1;
-
-static const opt_struct OPTIONS[] = {
- {'a', 0, "interactive"},
- {'C', 0, "no-chdir"},
- {'c', 1, "php-ini"},
- {'d', 1, "define"},
- {'e', 0, "profile-info"},
- {'f', 1, "file"},
- {'g', 1, "global"},
- {'h', 0, "help"},
- {'i', 0, "info"},
- {'l', 0, "syntax-check"},
- {'m', 0, "modules"},
- {'n', 0, "no-php-ini"},
- {'q', 0, "no-header"},
- {'s', 0, "syntax-highlight"},
- {'s', 0, "syntax-highlighting"},
- {'w', 0, "strip"},
- {'?', 0, "usage"},/* help alias (both '?' and 'usage') */
- {'v', 0, "version"},
- {'z', 1, "zend-extension"},
- {'-', 0, NULL} /* end of args */
-};
-
-#if ENABLE_PATHINFO_CHECK
-/* true global. this is retreived once only, even for fastcgi */
-long fix_pathinfo=1;
-#endif
-
-#ifdef PHP_WIN32
-#define TRANSLATE_SLASHES(path) \
- { \
- char *tmp = path; \
- while (*tmp) { \
- if (*tmp == '\\') *tmp = '/'; \
- tmp++; \
- } \
- }
-#else
-#define TRANSLATE_SLASHES(path)
-#endif
-
-static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
-{
- php_printf("%s\n", module->name);
- return 0;
-}
-
-static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
-{
- Bucket *f = *((Bucket **) a);
- Bucket *s = *((Bucket **) b);
-
- return strcmp(((zend_module_entry *)f->pData)->name,
- ((zend_module_entry *)s->pData)->name);
-}
-
-static void print_modules(TSRMLS_D)
-{
- HashTable sorted_registry;
- zend_module_entry tmp;
-
- zend_hash_init(&sorted_registry, 50, NULL, NULL, 1);
- zend_hash_copy(&sorted_registry, &module_registry, NULL, &tmp, sizeof(zend_module_entry));
- zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC);
- zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) print_module_info, NULL TSRMLS_CC);
- zend_hash_destroy(&sorted_registry);
-}
-
-static int print_extension_info(zend_extension *ext, void *arg TSRMLS_DC)
-{
- php_printf("%s\n", ext->name);
- return 0;
-}
-
-static int extension_name_cmp(const zend_llist_element **f,
- const zend_llist_element **s TSRMLS_DC)
-{
- return strcmp(((zend_extension *)(*f)->data)->name,
- ((zend_extension *)(*s)->data)->name);
-}
-
-static void print_extensions(TSRMLS_D)
-{
- zend_llist sorted_exts;
-
- zend_llist_copy(&sorted_exts, &zend_extensions);
- zend_llist_sort(&sorted_exts, extension_name_cmp TSRMLS_CC);
- zend_llist_apply_with_argument(&sorted_exts, (llist_apply_with_arg_func_t) print_extension_info, NULL TSRMLS_CC);
- zend_llist_destroy(&sorted_exts);
-}
-
-#ifndef STDOUT_FILENO
-#define STDOUT_FILENO 1
-#endif
-
-static inline size_t sapi_cgibin_single_write(const char *str, uint str_length TSRMLS_DC)
-{
-#ifdef PHP_WRITE_STDOUT
- long ret;
-#else
- size_t ret;
-#endif
-
-#if PHP_FASTCGI
- if (!FCGX_IsCGI()) {
- FCGX_Request *request = (FCGX_Request *)SG(server_context);
- long ret = FCGX_PutStr( str, str_length, request->out );
- if (ret <= 0) {
- return 0;
- }
- return ret;
- }
-#endif
-#ifdef PHP_WRITE_STDOUT
- ret = write(STDOUT_FILENO, str, str_length);
- if (ret <= 0) return 0;
- return ret;
-#else
- ret = fwrite(str, 1, MIN(str_length, 16384), stdout);
- return ret;
-#endif
-}
-
-static int sapi_cgibin_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- const char *ptr = str;
- uint remaining = str_length;
- size_t ret;
-
- while (remaining > 0) {
- ret = sapi_cgibin_single_write(ptr, remaining TSRMLS_CC);
- if (!ret) {
- php_handle_aborted_connection();
- return str_length - remaining;
- }
- ptr += ret;
- remaining -= ret;
- }
-
- return str_length;
-}
-
-
-static void sapi_cgibin_flush(void *server_context)
-{
-#if PHP_FASTCGI
- if (!FCGX_IsCGI()) {
- FCGX_Request *request = (FCGX_Request *)server_context;
- if(!request || FCGX_FFlush( request->out ) == -1 ) {
- php_handle_aborted_connection();
- }
- return;
- }
-#endif
- if (fflush(stdout)==EOF) {
- php_handle_aborted_connection();
- }
-}
-
-#define SAPI_CGI_MAX_HEADER_LENGTH 1024
-
-static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- char buf[SAPI_CGI_MAX_HEADER_LENGTH];
- sapi_header_struct *h;
- zend_llist_position pos;
- long rfc2616_headers = 0;
-
- if(SG(request_info).no_headers == 1) {
- return SAPI_HEADER_SENT_SUCCESSFULLY;
- }
- /* Check wheater to send RFC2616 style headers compatible with
- * PHP versions 4.2.3 and earlier compatible with web servers
- * such as IIS. Default is informal CGI RFC header compatible
- * with Apache.
- */
- if (cfg_get_long("cgi.rfc2616_headers", &rfc2616_headers) == FAILURE) {
- rfc2616_headers = 0;
- }
-
- if (SG(sapi_headers).http_response_code != 200) {
- int len;
-
- if (rfc2616_headers) {
- len = snprintf(buf, SAPI_CGI_MAX_HEADER_LENGTH,
- "%s\r\n", SG(sapi_headers).http_status_line);
-
- if (len > SAPI_CGI_MAX_HEADER_LENGTH) {
- len = SAPI_CGI_MAX_HEADER_LENGTH;
- }
-
- } else {
- len = sprintf(buf, "Status: %d\r\n", SG(sapi_headers).http_response_code);
- }
-
- PHPWRITE_H(buf, len);
- }
-
- if (SG(sapi_headers).send_default_content_type) {
- char *hd;
-
- hd = sapi_get_default_content_type(TSRMLS_C);
- PHPWRITE_H("Content-type: ", sizeof("Content-type: ")-1);
- PHPWRITE_H(hd, strlen(hd));
- PHPWRITE_H("\r\n", 2);
- efree(hd);
- }
-
- h = zend_llist_get_first_ex(&sapi_headers->headers, &pos);
- while (h) {
- PHPWRITE_H(h->header, h->header_len);
- PHPWRITE_H("\r\n", 2);
- h = zend_llist_get_next_ex(&sapi_headers->headers, &pos);
- }
- PHPWRITE_H("\r\n", 2);
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-
-static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
-{
- uint read_bytes=0, tmp_read_bytes;
-#if PHP_FASTCGI
- char *pos = buffer;
-#endif
-
- count_bytes = MIN(count_bytes, (uint)SG(request_info).content_length-SG(read_post_bytes));
- while (read_bytes < count_bytes) {
-#if PHP_FASTCGI
- if (!FCGX_IsCGI()) {
- FCGX_Request *request = (FCGX_Request *)SG(server_context);
- tmp_read_bytes = FCGX_GetStr( pos, count_bytes-read_bytes, request->in );
- pos += tmp_read_bytes;
- } else {
- tmp_read_bytes = read(0, buffer+read_bytes, count_bytes-read_bytes);
- }
-#else
- tmp_read_bytes = read(0, buffer+read_bytes, count_bytes-read_bytes);
-#endif
-
- if (tmp_read_bytes<=0) {
- break;
- }
- read_bytes += tmp_read_bytes;
- }
- return read_bytes;
-}
-
-static char *sapi_cgibin_getenv(char *name, size_t name_len TSRMLS_DC)
-{
-#if PHP_FASTCGI
- /* when php is started by mod_fastcgi, no regular environment
- is provided to PHP. It is always sent to PHP at the start
- of a request. So we have to do our own lookup to get env
- vars. This could probably be faster somehow. */
- if (!FCGX_IsCGI()) {
- FCGX_Request *request = (FCGX_Request *)SG(server_context);
- return FCGX_GetParam(name,request->envp);
- }
-#endif
- /* if cgi, or fastcgi and not found in fcgi env
- check the regular environment */
- return getenv(name);
-}
-
-static char *_sapi_cgibin_putenv(char *name, char *value TSRMLS_DC)
-{
- int len=0;
- char *buf = NULL;
- if (!name) {
- return NULL;
- }
- len = strlen(name) + (value?strlen(value):0) + sizeof("=") + 2;
- buf = (char *)malloc(len);
- if (buf == NULL) {
- return getenv(name);
- }
- if (value) {
- snprintf(buf,len-1,"%s=%s", name, value);
- } else {
- snprintf(buf,len-1,"%s=", name);
- }
-#if PHP_FASTCGI
- /* when php is started by mod_fastcgi, no regular environment
- is provided to PHP. It is always sent to PHP at the start
- of a request. So we have to do our own lookup to get env
- vars. This could probably be faster somehow. */
- if (!FCGX_IsCGI()) {
- FCGX_Request *request = (FCGX_Request *)SG(server_context);
- FCGX_PutEnv(request,buf);
- free(buf);
- return sapi_cgibin_getenv(name,0 TSRMLS_CC);
- }
-#endif
- /* if cgi, or fastcgi and not found in fcgi env
- check the regular environment
- this leaks, but it's only cgi anyway, we'll fix
- it for 5.0
- */
- putenv(buf);
- return getenv(name);
-}
-
-static char *sapi_cgi_read_cookies(TSRMLS_D)
-{
- return sapi_cgibin_getenv((char *)"HTTP_COOKIE",0 TSRMLS_CC);
-}
-
-#if PHP_FASTCGI
-void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
-{
- if (!FCGX_IsCGI()) {
- FCGX_Request *request = (FCGX_Request *)SG(server_context);
- char **env, *p, *t;
- /* turn off magic_quotes while importing environment variables */
- int magic_quotes_gpc = PG(magic_quotes_gpc);
- PG(magic_quotes_gpc) = 0;
-
- for (env = request->envp; env != NULL && *env != NULL; env++) {
- p = strchr(*env, '=');
- if (!p) { /* malformed entry? */
- continue;
- }
- t = estrndup(*env, p - *env);
- php_register_variable(t, p+1, array_ptr TSRMLS_CC);
- efree(t);
- }
- PG(magic_quotes_gpc) = magic_quotes_gpc;
- }
- /* call php's original import as a catch-all */
- php_php_import_environment_variables(array_ptr TSRMLS_CC);
-}
-#endif
-
-static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC)
-{
- /* In CGI mode, we consider the environment to be a part of the server
- * variables
- */
- php_import_environment_variables(track_vars_array TSRMLS_CC);
- /* Build the special-case PHP_SELF variable for the CGI version */
- php_register_variable("PHP_SELF", (SG(request_info).request_uri ? SG(request_info).request_uri:""), track_vars_array TSRMLS_CC);
-}
-
-
-static void sapi_cgi_log_message(char *message)
-{
- TSRMLS_FETCH();
-
- if (php_header(TSRMLS_C)) {
- fprintf(stderr, "%s", message);
- fprintf(stderr, "\n");
- }
-}
-
-static int sapi_cgi_deactivate(TSRMLS_D)
-{
- sapi_cgibin_flush(SG(server_context));
- return SUCCESS;
-}
-
-
-static int php_cgi_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, NULL, 0) == FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-/* {{{ sapi_module_struct cgi_sapi_module
- */
-static sapi_module_struct cgi_sapi_module = {
-#if PHP_FASTCGI
- "cgi-fcgi", /* name */
- "CGI/FastCGI", /* pretty name */
-#else
- "cgi", /* name */
- "CGI", /* pretty name */
-#endif
-
- php_cgi_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- sapi_cgi_deactivate, /* deactivate */
-
- sapi_cgibin_ub_write, /* unbuffered write */
- sapi_cgibin_flush, /* flush */
- NULL, /* get uid */
- sapi_cgibin_getenv, /* getenv */
-
- php_error, /* error handler */
-
- NULL, /* header handler */
- sapi_cgi_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- sapi_cgi_read_post, /* read POST data */
- sapi_cgi_read_cookies, /* read Cookies */
-
- sapi_cgi_register_variables, /* register server variables */
- sapi_cgi_log_message, /* Log message */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-/* }}} */
-
-/* {{{ php_cgi_usage
- */
-static void php_cgi_usage(char *argv0)
-{
- char *prog;
-
- prog = strrchr(argv0, '/');
- if (prog) {
- prog++;
- } else {
- prog = "php";
- }
-
- php_printf("Usage: %s [-q] [-h] [-s] [-v] [-i] [-f <file>]\n"
- " %s <file> [args...]\n"
- " -a Run interactively\n"
-#if PHP_FASTCGI
- " -b <address:port>|<port> Bind Path for external FASTCGI Server mode\n"
-#endif
- " -C Do not chdir to the script's directory\n"
- " -c <path>|<file> Look for php.ini file in this directory\n"
- " -n No php.ini file will be used\n"
- " -d foo[=bar] Define INI entry foo with value 'bar'\n"
- " -e Generate extended information for debugger/profiler\n"
- " -f <file> Parse <file>. Implies `-q'\n"
- " -h This help\n"
- " -i PHP information\n"
- " -l Syntax check only (lint)\n"
- " -m Show compiled in modules\n"
- " -q Quiet-mode. Suppress HTTP Header output.\n"
- " -s Display colour syntax highlighted source.\n"
- " -v Version number\n"
- " -w Display source with stripped comments and whitespace.\n"
- " -z <file> Load Zend extension <file>.\n",
- prog, prog);
-}
-/* }}} */
-
-/* {{{ init_request_info
-
- initializes request_info structure
-
- specificly in this section we handle proper translations
- for:
-
- PATH_INFO
- derived from the portion of the URI path following
- the script name but preceding any query data
- may be empty
-
- PATH_TRANSLATED
- derived by taking any path-info component of the
- request URI and performing any virtual-to-physical
- translation appropriate to map it onto the server's
- document repository structure
-
- empty if PATH_INFO is empty
-
- The env var PATH_TRANSLATED **IS DIFFERENT** than the
- request_info.path_translated variable, the latter should
- match SCRIPT_FILENAME instead.
-
- SCRIPT_NAME
- set to a URL path that could identify the CGI script
- rather than the interpreter. PHP_SELF is set to this.
-
- REQUEST_URI
- uri section following the domain:port part of a URI
-
- SCRIPT_FILENAME
- The virtual-to-physical translation of SCRIPT_NAME (as per
- PATH_TRANSLATED)
-
- These settings are documented at
- http://cgi-spec.golux.com/
-
-
- Based on the following URL request:
-
- http://localhost/info.php/test?a=b
-
- should produce, which btw is the same as if
- we were running under mod_cgi on apache (ie. not
- using ScriptAlias directives):
-
- PATH_INFO=/test
- PATH_TRANSLATED=/docroot/test
- SCRIPT_NAME=/info.php
- REQUEST_URI=/info.php/test?a=b
- SCRIPT_FILENAME=/docroot/info.php
- QUERY_STRING=a=b
-
- but what we get is (cgi/mod_fastcgi under apache):
-
- PATH_INFO=/info.php/test
- PATH_TRANSLATED=/docroot/info.php/test
- SCRIPT_NAME=/php/php-cgi (from the Action setting I suppose)
- REQUEST_URI=/info.php/test?a=b
- SCRIPT_FILENAME=/path/to/php/bin/php-cgi (Action setting translated)
- QUERY_STRING=a=b
-
- Comments in the code below refer to using the above URL in a request
-
- */
-static void init_request_info(TSRMLS_D)
-{
- char *env_script_filename = sapi_cgibin_getenv("SCRIPT_FILENAME",0 TSRMLS_CC);
- char *env_path_translated = sapi_cgibin_getenv("PATH_TRANSLATED",0 TSRMLS_CC);
- char *script_path_translated = env_script_filename;
-
-#if !DISCARD_PATH
- /* some broken servers do not have script_filename or argv0
- an example, IIS configured in some ways. then they do more
- broken stuff and set path_translated to the cgi script location */
- if (!script_path_translated && env_path_translated) {
- script_path_translated = env_path_translated;
- }
-#endif
-
- /* initialize the defaults */
- SG(request_info).path_translated = NULL;
- SG(request_info).request_method = NULL;
- SG(request_info).query_string = NULL;
- SG(request_info).request_uri = NULL;
- SG(request_info).content_type = NULL;
- SG(request_info).content_length = 0;
- SG(sapi_headers).http_response_code = 200;
-
- /* script_path_translated being set is a good indication that
- we are running in a cgi environment, since it is always
- null otherwise. otherwise, the filename
- of the script will be retreived later via argc/argv */
- if (script_path_translated) {
- const char *auth;
- char *content_length = sapi_cgibin_getenv("CONTENT_LENGTH",0 TSRMLS_CC);
- char *content_type = sapi_cgibin_getenv("CONTENT_TYPE",0 TSRMLS_CC);
- char *env_path_info = sapi_cgibin_getenv("PATH_INFO",0 TSRMLS_CC);
- char *env_script_name = sapi_cgibin_getenv("SCRIPT_NAME",0 TSRMLS_CC);
-#if ENABLE_PATHINFO_CHECK
- struct stat st;
- char *env_redirect_url = sapi_cgibin_getenv("REDIRECT_URL",0 TSRMLS_CC);
- char *env_document_root = sapi_cgibin_getenv("DOCUMENT_ROOT",0 TSRMLS_CC);
-
- if (fix_pathinfo) {
-
- /* save the originals first for anything we change later */
- if (env_path_translated) {
- _sapi_cgibin_putenv("ORIG_PATH_TRANSLATED",env_path_translated TSRMLS_CC);
- }
- if (env_path_info) {
- _sapi_cgibin_putenv("ORIG_PATH_INFO",env_path_info TSRMLS_CC);
- }
- if (env_script_name) {
- _sapi_cgibin_putenv("ORIG_SCRIPT_NAME",env_script_name TSRMLS_CC);
- }
- if (env_script_filename) {
- _sapi_cgibin_putenv("ORIG_SCRIPT_FILENAME",env_script_filename TSRMLS_CC);
- }
- if (!env_document_root) {
- /* IIS version of DOCUMENT_ROOT, not avail in cgi, but is in fastcgi */
- env_document_root = sapi_cgibin_getenv("APPL_PHYSICAL_PATH",0 TSRMLS_CC);
- /* ini version of document root */
- if (!env_document_root) {
- env_document_root = PG(doc_root);
- }
- /* set the document root, this makes a more
- consistent env for php scripts */
- if (env_document_root) {
- env_document_root = _sapi_cgibin_putenv("DOCUMENT_ROOT",env_document_root TSRMLS_CC);
- /* fix docroot */
- TRANSLATE_SLASHES(env_document_root);
- }
- }
-
- if (env_redirect_url) {
- /*
- pretty much apache specific. If we have a redirect_url
- then our script_filename and script_name point to the
- php executable
- */
- script_path_translated = env_path_translated;
- /* we correct SCRIPT_NAME now in case we don't have PATH_INFO */
- env_script_name = _sapi_cgibin_putenv("SCRIPT_NAME",env_redirect_url TSRMLS_CC);
- }
-
-#ifdef __riscos__
- /* Convert path to unix format*/
- __riscosify_control|=__RISCOSIFY_DONT_CHECK_DIR;
- script_path_translated=__unixify(script_path_translated,0,NULL,1,0);
-#endif
-
- /*
- * if the file doesn't exist, try to extract PATH_INFO out
- * of it by stat'ing back through the '/'
- * this fixes url's like /info.php/test
- */
- if (script_path_translated && stat( script_path_translated, &st ) == -1 ) {
- char *pt = estrdup(script_path_translated);
- int len = strlen(pt);
- char *ptr;
-
- while( (ptr = strrchr(pt,'/')) || (ptr = strrchr(pt,'\\')) ) {
- *ptr = 0;
- if ( stat(pt, &st) == 0 && S_ISREG(st.st_mode) ) {
- /*
- * okay, we found the base script!
- * work out how many chars we had to strip off;
- * then we can modify PATH_INFO
- * accordingly
- *
- * we now have the makings of
- * PATH_INFO=/test
- * SCRIPT_FILENAME=/docroot/info.php
- *
- * we now need to figure out what docroot is.
- * if DOCUMENT_ROOT is set, this is easy, otherwise,
- * we have to play the game of hide and seek to figure
- * out what SCRIPT_NAME should be
- */
- int slen = len - strlen(pt);
- int pilen = strlen( env_path_info );
- char *path_info = env_path_info + pilen - slen;
-
- env_path_info = _sapi_cgibin_putenv("PATH_INFO",path_info TSRMLS_CC);
- script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME",pt TSRMLS_CC);
- TRANSLATE_SLASHES(pt);
-
- /* figure out docroot
- SCRIPT_FILENAME minus SCRIPT_NAME
- */
-
- if (env_document_root) {
- int l = strlen(env_document_root);
- int path_translated_len = 0;
- char *path_translated = NULL;
- if (env_document_root[l-1]=='/') {
- --l;
- }
-
- /* we have docroot, so we should have:
- * DOCUMENT_ROOT=/docroot
- * SCRIPT_FILENAME=/docroot/info.php
- *
- * SCRIPT_NAME is the portion of the path beyond docroot
- */
- env_script_name = _sapi_cgibin_putenv("SCRIPT_NAME",pt+l TSRMLS_CC);
-
- /*
- * PATH_TRANSATED = DOCUMENT_ROOT + PATH_INFO
- */
- path_translated_len = l + strlen(env_path_info) + 2;
- path_translated = (char *)emalloc(path_translated_len);
- *path_translated = 0;
- strncat(path_translated,env_document_root,l);
- strcat(path_translated,env_path_info);
- env_path_translated = _sapi_cgibin_putenv("PATH_TRANSLATED",path_translated TSRMLS_CC);
- efree(path_translated);
- } else if (env_script_name &&
- strstr(pt,env_script_name)) {
- /*
- * PATH_TRANSATED = PATH_TRANSATED - SCRIPT_NAME + PATH_INFO
- */
- int ptlen = strlen(pt)-strlen(env_script_name);
- int path_translated_len = ptlen + strlen(env_path_info) + 2;
- char *path_translated = NULL;
- path_translated = (char *)emalloc(path_translated_len);
- *path_translated = 0;
- strncat(path_translated,pt,ptlen);
- strcat(path_translated,env_path_info);
- env_path_translated = _sapi_cgibin_putenv("PATH_TRANSLATED",path_translated TSRMLS_CC);
- efree(path_translated);
- }
- break;
- }
- }
- if (!ptr) {
- /*
- * if we stripped out all the '/' and still didn't find
- * a valid path... we will fail, badly. of course we would
- * have failed anyway... we output 'no input file' now.
- */
- script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME",NULL TSRMLS_CC);
- SG(sapi_headers).http_response_code = 404;
- }
- if (pt) {
- efree(pt);
- }
- } else {
- /* make sure path_info/translated are empty */
- script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME",script_path_translated TSRMLS_CC);
- _sapi_cgibin_putenv("PATH_INFO", NULL TSRMLS_CC);
- _sapi_cgibin_putenv("PATH_TRANSLATED", NULL TSRMLS_CC);
- }
- SG(request_info).request_uri = sapi_cgibin_getenv("SCRIPT_NAME",0 TSRMLS_CC);
- } else {
-#endif
- /* pre 4.3 behaviour, shouldn't be used but provides BC */
- if (env_path_info) {
- SG(request_info).request_uri = env_path_info;
- } else {
- SG(request_info).request_uri = env_script_name;
- }
-#if !DISCARD_PATH
- script_path_translated = env_path_translated;
-#endif
-#if ENABLE_PATHINFO_CHECK
- }
-#endif
- SG(request_info).request_method = sapi_cgibin_getenv("REQUEST_METHOD",0 TSRMLS_CC);
- SG(request_info).query_string = sapi_cgibin_getenv("QUERY_STRING",0 TSRMLS_CC);
- /* some server configurations allow '..' to slip through in the
- translated path. We'll just refuse to handle such a path. */
- if (script_path_translated && !strstr(script_path_translated, "..")) {
- SG(request_info).path_translated = estrdup(script_path_translated);
- }
- SG(request_info).content_type = (content_type ? content_type : "" );
- SG(request_info).content_length = (content_length?atoi(content_length):0);
-
- /* The CGI RFC allows servers to pass on unvalidated Authorization data */
- auth = sapi_cgibin_getenv("HTTP_AUTHORIZATION",0 TSRMLS_CC);
- php_handle_auth_data(auth TSRMLS_CC);
- }
-}
-/* }}} */
-
-static void define_command_line_ini_entry(char *arg)
-{
- char *name, *value;
-
- name = arg;
- value = strchr(arg, '=');
- if (value) {
- *value = 0;
- value++;
- } else {
- value = "1";
- }
- zend_alter_ini_entry(name, strlen(name)+1, value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
-}
-
-
-static void php_register_command_line_global_vars(char **arg TSRMLS_DC)
-{
- char *var, *val;
-
- var = *arg;
- val = strchr(var, '=');
- if (!val) {
- printf("No value specified for variable '%s'\n", var);
- } else {
- *val++ = '\0';
- php_register_variable(var, val, NULL TSRMLS_CC);
- }
- efree(*arg);
-}
-
-#if PHP_FASTCGI
-/**
- * Clean up child processes upon exit
- */
-void fastcgi_cleanup(int signal)
-{
-
-#ifdef DEBUG_FASTCGI
- fprintf( stderr, "FastCGI shutdown, pid %d\n", getpid() );
-#endif
-
-#ifndef PHP_WIN32
- sigaction( SIGTERM, &old_term, 0 );
-
- /* Kill all the processes in our process group */
- kill( -pgroup, SIGTERM );
-#endif
-
- /* We should exit at this point, but MacOSX doesn't seem to */
- exit( 0 );
-}
-#endif
-
-/* {{{ main
- */
-int main(int argc, char *argv[])
-{
- int exit_status = SUCCESS;
- int cgi = 0, c, i, len;
- zend_file_handle file_handle;
- int retval = FAILURE;
- char *s;
-/* temporary locals */
- int behavior=PHP_MODE_STANDARD;
- int no_headers=0;
- int orig_optind=optind;
- char *orig_optarg=optarg;
- char *script_file=NULL;
- zend_llist global_vars;
- int interactive=0;
-#if FORCE_CGI_REDIRECT
- int force_redirect = 1;
- char *redirect_status_env = NULL;
-#endif
-
-/* end of temporary locals */
-#ifdef ZTS
- zend_compiler_globals *compiler_globals;
- zend_executor_globals *executor_globals;
- php_core_globals *core_globals;
- sapi_globals_struct *sapi_globals;
- void ***tsrm_ls;
-#endif
-
-#if PHP_FASTCGI
- int max_requests = 500;
- int requests = 0;
- int fastcgi = !FCGX_IsCGI();
- char *bindpath = NULL;
- int fcgi_fd = 0;
- FCGX_Request request;
-#ifdef PHP_WIN32
- int impersonate = 0;
-#else
- int status = 0;
-#endif
-#endif /* PHP_FASTCGI */
-
-#if 0 && defined(PHP_DEBUG)
- /* IIS is always making things more difficult. This allows
- us to stop PHP and attach a debugger before much gets started */
- {
- char szMessage [256];
- wsprintf (szMessage, "Please attach a debugger to the process 0x%X [%d] (%s) and click OK",
- GetCurrentProcessId(),GetCurrentProcessId(), argv[0]);
- MessageBox(NULL, szMessage, "CGI Debug Time!",
- MB_OK|MB_SERVICE_NOTIFICATION);
- }
-#endif
-
-#ifdef HAVE_SIGNAL_H
-#if defined(SIGPIPE) && defined(SIG_IGN)
- signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE in standalone mode so
- that sockets created via fsockopen()
- don't kill PHP if the remote site
- closes it. in apache|apxs mode apache
- does that for us! thies@thieso.net
- 20000419 */
-#endif
-#endif
-
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
-#endif
-
- sapi_startup(&cgi_sapi_module);
-
-#ifdef PHP_WIN32
- _fmode = _O_BINARY; /*sets default for file streams to binary */
- setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */
- setmode(_fileno(stdout), O_BINARY); /* make the stdio mode be binary */
- setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
-#endif
-
-#if PHP_FASTCGI
- if (!fastcgi) {
-#endif
- /* Make sure we detect we are a cgi - a bit redundancy here,
- but the default case is that we have to check only the first one. */
- if (getenv("SERVER_SOFTWARE")
- || getenv("SERVER_NAME")
- || getenv("GATEWAY_INTERFACE")
- || getenv("REQUEST_METHOD")) {
- cgi = 1;
- }
-#if PHP_FASTCGI
- }
-#endif
-
- if (!cgi
-#if PHP_FASTCGI
- /* allow ini override for fastcgi */
-#endif
- ) {
- while ((c=php_getopt(argc, argv, OPTIONS, &optarg, &optind, 0))!=-1) {
- switch (c) {
- case 'c':
- cgi_sapi_module.php_ini_path_override = strdup(optarg);
- break;
- case 'n':
- cgi_sapi_module.php_ini_ignore = 1;
- break;
-#if PHP_FASTCGI
- /* if we're started on command line, check to see if
- we are being started as an 'external' fastcgi
- server by accepting a bindpath parameter. */
- case 'b':
- if (!fastcgi) {
- bindpath = strdup(optarg);
- }
- break;
-#endif
- }
-
- }
- optind = orig_optind;
- optarg = orig_optarg;
- }
-
-#ifdef ZTS
- compiler_globals = ts_resource(compiler_globals_id);
- executor_globals = ts_resource(executor_globals_id);
- core_globals = ts_resource(core_globals_id);
- sapi_globals = ts_resource(sapi_globals_id);
- tsrm_ls = ts_resource(0);
- SG(request_info).path_translated = NULL;
-#endif
-
- cgi_sapi_module.executable_location = argv[0];
-
- /* startup after we get the above ini override se we get things right */
- if (php_module_startup(&cgi_sapi_module, NULL, 0) == FAILURE) {
-#ifdef ZTS
- tsrm_shutdown();
-#endif
- return FAILURE;
- }
-
-#if FORCE_CGI_REDIRECT
- /* check force_cgi after startup, so we have proper output */
- if (cfg_get_long("cgi.force_redirect", &force_redirect) == FAILURE) {
- force_redirect = 1;
- }
- if (cgi && force_redirect) {
- if (cfg_get_string("cgi.redirect_status_env", &redirect_status_env) == FAILURE) {
- redirect_status_env = NULL;
- }
- /* Apache will generate REDIRECT_STATUS,
- * Netscape and redirect.so will generate HTTP_REDIRECT_STATUS.
- * redirect.so and installation instructions available from
- * http://www.koehntopp.de/php.
- * -- kk@netuse.de
- */
- if (!getenv("REDIRECT_STATUS")
- && !getenv ("HTTP_REDIRECT_STATUS")
- /* this is to allow a different env var to be configured
- in case some server does something different than above */
- && (!redirect_status_env || !getenv(redirect_status_env))
- ) {
- PUTS("<b>Security Alert!</b> The PHP CGI cannot be accessed directly.\n\n\
-<p>This PHP CGI binary was compiled with force-cgi-redirect enabled. This\n\
-means that a page will only be served up if the REDIRECT_STATUS CGI variable is\n\
-set, e.g. via an Apache Action directive.</p>\n\
-<p>For more information as to <i>why</i> this behaviour exists, see the <a href=\"http://php.net/security.cgi-bin\">\
-manual page for CGI security</a>.</p>\n\
-<p>For more information about changing this behaviour or re-enabling this webserver,\n\
-consult the installation file that came with this distribution, or visit \n\
-<a href=\"http://php.net/install.windows\">the manual page</a>.</p>\n");
-
-#if defined(ZTS) && !defined(PHP_DEBUG)
- /* XXX we're crashing here in msvc6 debug builds at
- php_message_handler_for_zend:839 because
- SG(request_info).path_translated is an invalid pointer.
- It still happens even though I set it to null, so something
- weird is going on.
- */
- tsrm_shutdown();
-#endif
-
- return FAILURE;
- }
- }
-#endif /* FORCE_CGI_REDIRECT */
-
-#if ENABLE_PATHINFO_CHECK
- if (cfg_get_long("cgi.fix_pathinfo", &fix_pathinfo) == FAILURE) {
- fix_pathinfo = 1;
- }
-#endif
-
-#if PHP_FASTCGI
- if (bindpath) {
- /* Pass on the arg to the FastCGI library, with one exception.
- * If just a port is specified, then we prepend a ':' onto the
- * path (it's what the fastcgi library expects)
- */
- int port = atoi(bindpath);
- if (port) {
- char bindport[32];
- snprintf(bindport, 32, ":%s", bindpath);
- fcgi_fd = FCGX_OpenSocket(bindport, 128);
- } else {
- fcgi_fd = FCGX_OpenSocket(bindpath, 128);
- }
- if( fcgi_fd < 0 ) {
- fprintf(stderr, "Couldn't create FastCGI listen socket on port %s\n", bindpath);
-#ifdef ZTS
- tsrm_shutdown();
-#endif
- return FAILURE;
- }
- fastcgi = !FCGX_IsCGI();
- }
- if (fastcgi) {
- /* How many times to run PHP scripts before dying */
- if( getenv( "PHP_FCGI_MAX_REQUESTS" )) {
- max_requests = atoi( getenv( "PHP_FCGI_MAX_REQUESTS" ));
- if( !max_requests ) {
- fprintf( stderr,
- "PHP_FCGI_MAX_REQUESTS is not valid\n" );
- return FAILURE;
- }
- }
-
- /* make php call us to get _ENV vars */
- php_php_import_environment_variables = php_import_environment_variables;
- php_import_environment_variables = cgi_php_import_environment_variables;
-
- /* library is already initialized, now init our request */
- FCGX_Init();
- FCGX_InitRequest( &request, fcgi_fd, 0 );
-
-#ifndef PHP_WIN32
- /* Pre-fork, if required */
- if( getenv( "PHP_FCGI_CHILDREN" )) {
- children = atoi( getenv( "PHP_FCGI_CHILDREN" ));
- if( !children ) {
- fprintf( stderr,
- "PHP_FCGI_CHILDREN is not valid\n" );
- return FAILURE;
- }
- }
-
- if( children ) {
- int running = 0;
- int i;
- pid_t pid;
-
- /* Create a process group for ourself & children */
- setsid();
- pgroup = getpgrp();
-#ifdef DEBUG_FASTCGI
- fprintf( stderr, "Process group %d\n", pgroup );
-#endif
-
- /* Set up handler to kill children upon exit */
- act.sa_flags = 0;
- act.sa_handler = fastcgi_cleanup;
- if( sigaction( SIGTERM, &act, &old_term ) ||
- sigaction( SIGINT, &act, &old_int ) ||
- sigaction( SIGQUIT, &act, &old_quit )) {
- perror( "Can't set signals" );
- exit( 1 );
- }
-
- while( parent ) {
- do {
-#ifdef DEBUG_FASTCGI
- fprintf( stderr, "Forking, %d running\n",
- running );
-#endif
- pid = fork();
- switch( pid ) {
- case 0:
- /* One of the children.
- * Make sure we don't go round the
- * fork loop any more
- */
- parent = 0;
-
- /* don't catch our signals */
- sigaction( SIGTERM, &old_term, 0 );
- sigaction( SIGQUIT, &old_quit, 0 );
- sigaction( SIGINT, &old_int, 0 );
- break;
- case -1:
- perror( "php (pre-forking)" );
- exit( 1 );
- break;
- default:
- /* Fine */
- running++;
- break;
- }
- } while( parent && ( running < children ));
-
- if( parent ) {
-#ifdef DEBUG_FASTCGI
- fprintf( stderr, "Wait for kids, pid %d\n",
- getpid() );
-#endif
- wait( &status );
- running--;
- }
- }
- }
-
-#endif /* WIN32 */
- }
-#endif /* FASTCGI */
-
- zend_first_try {
- if (!cgi
-#if PHP_FASTCGI
- && !fastcgi
-#endif
- ) {
- while ((c=php_getopt(argc, argv, OPTIONS, &optarg, &optind, 1))!=-1) {
- switch (c) {
- case 'h':
- case '?':
- no_headers = 1;
- php_output_startup();
- php_output_activate(TSRMLS_C);
- SG(headers_sent) = 1;
- php_cgi_usage(argv[0]);
- php_end_ob_buffers(1 TSRMLS_CC);
- exit(1);
- break;
- }
- }
- optind = orig_optind;
- optarg = orig_optarg;
- }
-
-#if PHP_FASTCGI
- /* start of FAST CGI loop */
- /* Initialise FastCGI request structure */
-
-#ifdef PHP_WIN32
- /* attempt to set security impersonation for fastcgi
- will only happen on NT based OS, others will ignore it. */
- if (fastcgi) {
- if (cfg_get_long("fastcgi.impersonate", &impersonate) == FAILURE) {
- impersonate = 0;
- }
- if (impersonate) OS_SetImpersonate();
- }
-#endif
-
- while (!fastcgi
- || FCGX_Accept_r( &request ) >= 0) {
-#endif
-
-#if PHP_FASTCGI
- SG(server_context) = (void *) &request;
-#else
- SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */
-#endif
-
- init_request_info(TSRMLS_C);
-
- zend_llist_init(&global_vars, sizeof(char *), NULL, 0);
-
- CG(interactive) = 0;
-
- if (!cgi
-#if PHP_FASTCGI
- && !fastcgi
-#endif
- ) {
-
- if (cgi_sapi_module.php_ini_path_override && cgi_sapi_module.php_ini_ignore) {
- no_headers = 1;
- php_output_startup();
- php_output_activate(TSRMLS_C);
- SG(headers_sent) = 1;
- php_printf("You cannot use both -n and -c switch. Use -h for help.\n");
- php_end_ob_buffers(1 TSRMLS_CC);
- exit(1);
- }
-
- while ((c = php_getopt(argc, argv, OPTIONS, &optarg, &optind, 0)) != -1) {
- switch (c) {
-
- case 'a': /* interactive mode */
- printf("Interactive mode enabled\n\n");
- interactive=1;
- break;
-
- case 'C': /* don't chdir to the script directory */
- SG(options) |= SAPI_OPTION_NO_CHDIR;
- break;
- case 'd': /* define ini entries on command line */
- define_command_line_ini_entry(optarg);
- break;
-
- case 'e': /* enable extended info output */
- CG(extended_info) = 1;
- break;
-
- case 'f': /* parse file */
- script_file = estrdup(optarg);
- no_headers = 1;
- break;
-
- case 'g': /* define global variables on command line */
- {
- char *arg = estrdup(optarg);
-
- zend_llist_add_element(&global_vars, &arg);
- }
- break;
-
- case 'i': /* php info & quit */
- if (php_request_startup(TSRMLS_C) == FAILURE) {
- php_module_shutdown(TSRMLS_C);
- return FAILURE;
- }
- if (no_headers) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
- }
- php_print_info(0xFFFFFFFF TSRMLS_CC);
- php_end_ob_buffers(1 TSRMLS_CC);
- exit(1);
- break;
-
- case 'l': /* syntax check mode */
- no_headers = 1;
- behavior=PHP_MODE_LINT;
- break;
-
- case 'm': /* list compiled in modules */
- php_output_startup();
- php_output_activate(TSRMLS_C);
- SG(headers_sent) = 1;
- php_printf("[PHP Modules]\n");
- print_modules(TSRMLS_C);
- php_printf("\n[Zend Modules]\n");
- print_extensions(TSRMLS_C);
- php_printf("\n");
- php_end_ob_buffers(1 TSRMLS_CC);
- exit(1);
- break;
-
-#if 0 /* not yet operational, see also below ... */
- case '': /* generate indented source mode*/
- behavior=PHP_MODE_INDENT;
- break;
-#endif
-
- case 'q': /* do not generate HTTP headers */
- no_headers = 1;
- break;
-
- case 's': /* generate highlighted HTML from source */
- behavior=PHP_MODE_HIGHLIGHT;
- break;
-
- case 'v': /* show php version & quit */
- no_headers = 1;
- if (php_request_startup(TSRMLS_C) == FAILURE) {
- php_module_shutdown(TSRMLS_C);
- return FAILURE;
- }
- if (no_headers) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
- }
- php_printf("PHP %s (%s), Copyright (c) 1997-2003 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
- php_end_ob_buffers(1 TSRMLS_CC);
- exit(1);
- break;
-
- case 'w':
- behavior=PHP_MODE_STRIP;
- break;
-
- case 'z': /* load extension file */
- zend_load_extension(optarg);
- break;
-
- default:
- break;
- }
- }
-
- if (!SG(request_info).query_string) {
- len = 0;
- if (script_file) {
- len += strlen(script_file) + 1;
- }
- for (i = optind; i < argc; i++) {
- len += strlen(argv[i]) + 1;
- }
-
- s = malloc(len + 1); /* leak - but only for command line version, so ok */
- *s = '\0'; /* we are pretending it came from the environment */
- if (script_file) {
- strcpy(s, script_file);
- if (optind<argc) {
- strcat(s, "+");
- }
- }
- for (i = optind, len = 0; i < argc; i++) {
- strcat(s, argv[i]);
- if (i < (argc - 1)) {
- strcat(s, "+");
- }
- }
- SG(request_info).query_string = s;
- }
-
- if (script_file) {
- /* override path_translated if -f on command line */
- SG(request_info).path_translated = script_file;
- }
-
- if (no_headers) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
- }
-
- if (!SG(request_info).path_translated && argc > optind) {
- /* file is on command line, but not in -f opt */
- SG(request_info).path_translated = estrdup(argv[optind]);
- }
- } /* end !cgi && !fastcgi */
-
- /*
- we never take stdin if we're (f)cgi, always
- rely on the web server giving us the info
- we need in the environment.
- */
- if (cgi
-#if PHP_FASTCGI
- || fastcgi
-#endif
- )
- {
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.handle.fp = NULL;
- } else {
- file_handle.filename = "-";
- file_handle.type = ZEND_HANDLE_FP;
- file_handle.handle.fp = stdin;
- }
-
- file_handle.opened_path = NULL;
- file_handle.free_filename = 0;
-
- /* request startup only after we've done all we can to
- get path_translated */
- if (php_request_startup(TSRMLS_C)==FAILURE) {
- php_module_shutdown(TSRMLS_C);
- return FAILURE;
- }
- if (no_headers) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
- }
-
- /* This actually destructs the elements of the list - ugly hack */
- zend_llist_apply(&global_vars, (llist_apply_func_t) php_register_command_line_global_vars TSRMLS_CC);
- zend_llist_destroy(&global_vars);
-
- /*
- at this point path_translated will be set if:
- 1. we are running from shell and got filename was there
- 2. we are running as cgi or fastcgi
- */
- if (cgi || SG(request_info).path_translated) {
- retval = php_fopen_primary_script(&file_handle TSRMLS_CC);
- }
- /*
- if we are unable to open path_translated and we are not
- running from shell (so fp == NULL), then fail.
- */
- if (retval == FAILURE && file_handle.handle.fp == NULL) {
- SG(sapi_headers).http_response_code = 404;
- PUTS("No input file specified.\n");
- php_request_shutdown((void *) 0);
- php_module_shutdown(TSRMLS_C);
- return FAILURE;
- }
-
- if (file_handle.handle.fp && (file_handle.handle.fp != stdin)) {
- /* #!php support */
- c = fgetc(file_handle.handle.fp);
- if (c == '#') {
- while (c != 10 && c != 13) {
- c = fgetc(file_handle.handle.fp); /* skip to end of line */
- }
- /* handle situations where line is terminated by \r\n */
- if (c == 13) {
- if (fgetc(file_handle.handle.fp) != 10) {
- long pos = ftell(file_handle.handle.fp);
- fseek(file_handle.handle.fp, pos - 1, SEEK_SET);
- }
- }
- CG(start_lineno) = 2;
- } else {
- rewind(file_handle.handle.fp);
- }
- }
-
- switch (behavior) {
- case PHP_MODE_STANDARD:
- php_execute_script(&file_handle TSRMLS_CC);
- exit_status = EG(exit_status);
- break;
- case PHP_MODE_LINT:
- PG(during_request_startup) = 0;
- exit_status = php_lint_script(&file_handle TSRMLS_CC);
- if (exit_status == SUCCESS) {
- zend_printf("No syntax errors detected in %s\n", file_handle.filename);
- } else {
- zend_printf("Errors parsing %s\n", file_handle.filename);
- }
- break;
- case PHP_MODE_STRIP:
- if (open_file_for_scanning(&file_handle TSRMLS_CC) == SUCCESS) {
- zend_strip(TSRMLS_C);
- fclose(file_handle.handle.fp);
- }
- return SUCCESS;
- break;
- case PHP_MODE_HIGHLIGHT:
- {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- if (open_file_for_scanning(&file_handle TSRMLS_CC) == SUCCESS) {
- php_get_highlight_struct(&syntax_highlighter_ini);
- zend_highlight(&syntax_highlighter_ini TSRMLS_CC);
- fclose(file_handle.handle.fp);
- }
- return SUCCESS;
- }
- break;
-#if 0
- /* Zeev might want to do something with this one day */
- case PHP_MODE_INDENT:
- open_file_for_scanning(&file_handle TSRMLS_CC);
- zend_indent();
- fclose(file_handle.handle.fp);
- return SUCCESS;
- break;
-#endif
- }
-
- {
- char *path_translated;
-
- /* Go through this trouble so that the memory manager doesn't warn
- * about SG(request_info).path_translated leaking
- */
- if (SG(request_info).path_translated) {
- path_translated = strdup(SG(request_info).path_translated);
- STR_FREE(SG(request_info).path_translated);
- SG(request_info).path_translated = path_translated;
- }
-
- php_request_shutdown((void *) 0);
-
- if (SG(request_info).path_translated) {
- free(SG(request_info).path_translated);
- SG(request_info).path_translated = NULL;
- }
- }
-
-#if PHP_FASTCGI
- if (!fastcgi) break;
- /* only fastcgi will get here */
- requests++;
- if(max_requests && (requests == max_requests)) {
- FCGX_Finish_r(&request);
- if (bindpath) {
- free(bindpath);
- }
- break;
- }
- /* end of fastcgi loop */
- }
-#endif
-
- if (cgi_sapi_module.php_ini_path_override) {
- free(cgi_sapi_module.php_ini_path_override);
- }
- } zend_catch {
- exit_status = 255;
- } zend_end_try();
-
- php_module_shutdown(TSRMLS_C);
- sapi_shutdown();
-
-#ifdef ZTS
- /*tsrm_shutdown();*/
-#endif
-
-#if PHP_WIN32 && ZEND_DEBUG && 0
- _CrtDumpMemoryLeaks( );
-#endif
-
- return exit_status;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/cgi/config9.m4 b/sapi/cgi/config9.m4
deleted file mode 100644
index c6c5e665dd..0000000000
--- a/sapi/cgi/config9.m4
+++ /dev/null
@@ -1,171 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_ARG_ENABLE(cgi,
-[ --disable-cgi Disable building CGI version of PHP],
-[
- PHP_SAPI_CGI=$enableval
-],[
- PHP_SAPI_CGI=yes
-])
-
-AC_ARG_ENABLE(force-cgi-redirect,
-[ --enable-force-cgi-redirect
- Enable the security check for internal server
- redirects. You should use this if you are
- running the CGI version with Apache.],
-[
- PHP_FORCE_CGI_REDIRECT=$enableval
-],[
- PHP_FORCE_CGI_REDIRECT=no
-])
-
-AC_ARG_ENABLE(discard-path,
-[ --enable-discard-path If this is enabled, the PHP CGI binary
- can safely be placed outside of the
- web tree and people will not be able
- to circumvent .htaccess security.],
-[
- PHP_DISCARD_PATH=$enableval
-],[
- PHP_DISCARD_PATH=no
-])
-
-AC_ARG_ENABLE(fastcgi,
-[ --enable-fastcgi If this is enabled, the cgi module will
- be built with support for fastcgi also.],
-[
- PHP_ENABLE_FASTCGI=$enableval
-],[
- PHP_ENABLE_FASTCGI=no
-])
-
-AC_ARG_ENABLE(path-info-check,
-[ --disable-path-info-check If this is disabled, paths such as
- /info.php/test?a=b will fail to work.],
-[
- PHP_ENABLE_PATHINFO_CHECK=$enableval
-],[
- PHP_ENABLE_PATHINFO_CHECK=yes
-])
-
-AC_DEFUN(PHP_TEST_WRITE_STDOUT,[
- AC_CACHE_CHECK(whether writing to stdout works,ac_cv_write_stdout,[
- AC_TRY_RUN([
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#define TEXT "This is the test message -- "
-
-main()
-{
- int n;
-
- n = write(1, TEXT, sizeof(TEXT)-1);
- return (!(n == sizeof(TEXT)-1));
-}
- ],[
- ac_cv_write_stdout=yes
- ],[
- ac_cv_write_stdout=no
- ],[
- ac_cv_write_stdout=no
- ])
- ])
- if test "$ac_cv_write_stdout" = "yes"; then
- AC_DEFINE(PHP_WRITE_STDOUT, 1, [whether write(2) works])
- fi
-])
-
-
-if test "$PHP_SAPI" = "default"; then
- AC_MSG_CHECKING(for CGI build)
- if test "$PHP_SAPI_CGI" != "no"; then
- AC_MSG_RESULT(yes)
-
- PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cgi/Makefile.frag)
- case $host_alias in
- *cygwin* )
- SAPI_CGI_PATH=sapi/cgi/php.exe
- ;;
- * )
- SAPI_CGI_PATH=sapi/cgi/php
- ;;
- esac
- PHP_SUBST(SAPI_CGI_PATH)
-
- PHP_TEST_WRITE_STDOUT
-
- AC_MSG_CHECKING(whether to force Apache CGI redirect)
- if test "$PHP_FORCE_CGI_REDIRECT" = "yes"; then
- REDIRECT=1
- else
- REDIRECT=0
- fi
- AC_DEFINE_UNQUOTED(FORCE_CGI_REDIRECT,$REDIRECT,[ ])
- AC_MSG_RESULT($PHP_FORCE_CGI_REDIRECT)
-
-
- AC_MSG_CHECKING(whether to discard path_info + path_translated)
- if test "$PHP_DISCARD_PATH" = "yes"; then
- DISCARD_PATH=1
- else
- DISCARD_PATH=0
- fi
- AC_DEFINE_UNQUOTED(DISCARD_PATH, $DISCARD_PATH, [ ])
- AC_MSG_RESULT($PHP_DISCARD_PATH)
-
- AC_MSG_CHECKING(whether to enable path info checking)
- if test "$PHP_ENABLE_PATHINFO_CHECK" = "yes"; then
- ENABLE_PATHINFO_CHECK=1
- else
- ENABLE_PATHINFO_CHECK=0
- fi
- AC_DEFINE_UNQUOTED(ENABLE_PATHINFO_CHECK, $ENABLE_PATHINFO_CHECK, [ ])
- AC_MSG_RESULT($PHP_ENABLE_PATHINFO_CHECK)
-
- AC_MSG_CHECKING(whether to enable fastcgi support)
- PHP_LIBFCGI_DIR="$abs_srcdir/sapi/cgi/libfcgi"
- if test -z $PHP_LIBFCGI_DIR; then
- echo "$PHP_LIBFCGI_DIR does not exist"
- exit 1
- fi
- if test "$PHP_ENABLE_FASTCGI" = "yes"; then
- PHP_FASTCGI=1
- PHP_FCGI_FILES="libfcgi/fcgi_stdio.c libfcgi/fcgiapp.c libfcgi/os_unix.c"
- PHP_FCGI_INCLUDE="-I$PHP_LIBFCGI_DIR/include"
- PHP_FCGI_STATIC=1
- else
- PHP_FASTCGI=0
- PHP_FCGI_FILES=""
- PHP_FCGI_INCLUDE=""
- PHP_FCGI_STATIC=0
- fi
- AC_DEFINE_UNQUOTED(PHP_FASTCGI, $PHP_FASTCGI, [ ])
- AC_DEFINE_UNQUOTED(PHP_FCGI_STATIC, $PHP_FCGI_STATIC, [ ])
- AC_MSG_RESULT($PHP_ENABLE_FASTCGI)
-
- INSTALL_IT="\$(INSTALL) -m 0755 \$(SAPI_CGI_PATH) \$(INSTALL_ROOT)\$(bindir)/php"
- PHP_SELECT_SAPI(cgi, program, $PHP_FCGI_FILES cgi_main.c getopt.c, $PHP_FCGI_INCLUDE, '$(SAPI_CGI_PATH)')
-
- case $host_alias in
- *darwin*)
- BUILD_CGI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_SAPI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
- ;;
- *)
- BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
- ;;
- esac
-
- PHP_SUBST(BUILD_CGI)
-
- elif test "$PHP_SAPI_CLI" != "no"; then
- AC_MSG_RESULT(no)
- OVERALL_TARGET=
- PHP_SAPI=cli
- else
- AC_MSG_ERROR([No SAPIs selected.])
- fi
-fi
diff --git a/sapi/cgi/getopt.c b/sapi/cgi/getopt.c
deleted file mode 100644
index e048e95058..0000000000
--- a/sapi/cgi/getopt.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <stdlib.h>
-#include "php_getopt.h"
-#define OPTERRCOLON (1)
-#define OPTERRNF (2)
-#define OPTERRARG (3)
-
-
-static int php_opt_error(int argc, char * const *argv, int oint, int optchr, int err, int show_err)
-{
- if (show_err)
- {
- fprintf(stderr, "Error in argument %d, char %d: ", oint, optchr+1);
- switch(err)
- {
- case OPTERRCOLON:
- fprintf(stderr, ": in flags\n");
- break;
- case OPTERRNF:
- fprintf(stderr, "option not found %c\n", argv[oint][optchr]);
- break;
- case OPTERRARG:
- fprintf(stderr, "no argument for option %c\n", argv[oint][optchr]);
- break;
- default:
- fprintf(stderr, "unknown\n");
- break;
- }
- }
- return('?');
-}
-
-int php_getopt(int argc, char* const *argv, const opt_struct opts[], char **optarg, int *optind, int show_err)
-{
- static int optchr = 0;
- static int dash = 0; /* have already seen the - */
- int arg_start = 2;
-
- int opts_idx = -1;
-
- if (*optind >= argc) {
- return(EOF);
- }
- if (!dash) {
- if ((argv[*optind][0] != '-')) {
- return(EOF);
- } else {
- if (!argv[*optind][1])
- {
- /*
- * use to specify stdin. Need to let pgm process this and
- * the following args
- */
- return(EOF);
- }
- }
- }
- if ((argv[*optind][0] == '-') && (argv[*optind][1] == '-')) {
- /* '--' indicates end of args if not followed by a known long option name */
- while (1) {
- opts_idx++;
- if (opts[opts_idx].opt_char == '-') {
- (*optind)++;
- return(EOF);
- } else if (opts[opts_idx].opt_name && !strcmp(&argv[*optind][2], opts[opts_idx].opt_name)) {
- break;
- }
- }
- optchr = 0;
- dash = 1;
- arg_start = 2 + strlen(opts[opts_idx].opt_name);
- }
- if (!dash) {
- dash = 1;
- optchr = 1;
- }
-
- /* Check if the guy tries to do a -: kind of flag */
- if (argv[*optind][optchr] == ':') {
- dash = 0;
- (*optind)++;
- return (php_opt_error(argc, argv, *optind-1, optchr, OPTERRCOLON, show_err));
- }
- if (opts_idx < 0) {
- while (1) {
- opts_idx++;
- if (opts[opts_idx].opt_char == '-') {
- int errind = *optind;
- int errchr = optchr;
-
- if (!argv[*optind][optchr+1]) {
- dash = 0;
- (*optind)++;
- } else {
- optchr++;
- }
- return(php_opt_error(argc, argv, errind, errchr, OPTERRNF, show_err));
- } else if (argv[*optind][optchr] == opts[opts_idx].opt_char) {
- break;
- }
- }
- }
- if (opts[opts_idx].need_param) {
- /* Check for cases where the value of the argument
- is in the form -<arg> <val> or in the form -<arg><val> */
- dash = 0;
- if(!argv[*optind][arg_start]) {
- (*optind)++;
- if (*optind == argc) {
- return(php_opt_error(argc, argv, *optind-1, optchr, OPTERRARG, show_err));
- }
- *optarg = argv[(*optind)++];
- } else {
- *optarg = &argv[*optind][arg_start];
- (*optind)++;
- }
- return opts[opts_idx].opt_char;
- } else {
- if (arg_start == 2) {
- if (!argv[*optind][optchr+1])
- {
- dash = 0;
- (*optind)++;
- } else {
- optchr++;
- }
- } else {
- (*optind)++;
- }
- return opts[opts_idx].opt_char;
- }
- assert(0);
- return(0); /* never reached */
-}
diff --git a/sapi/cgi/libfcgi/LICENSE.TERMS b/sapi/cgi/libfcgi/LICENSE.TERMS
deleted file mode 100644
index 7e6bdfded7..0000000000
--- a/sapi/cgi/libfcgi/LICENSE.TERMS
+++ /dev/null
@@ -1,28 +0,0 @@
-This FastCGI application library source and object code (the
-"Software") and its documentation (the "Documentation") are
-copyrighted by Open Market, Inc ("Open Market"). The following terms
-apply to all files associated with the Software and Documentation
-unless explicitly disclaimed in individual files.
-
-Open Market permits you to use, copy, modify, distribute, and license
-this Software and the Documentation for any purpose, provided that
-existing copyright notices are retained in all copies and that this
-notice is included verbatim in any distributions. No written
-agreement, license, or royalty fee is required for any of the
-authorized uses. Modifications to this Software and Documentation may
-be copyrighted by their authors and need not follow the licensing
-terms described here. If modifications to this Software and
-Documentation have new licensing terms, the new terms must be clearly
-indicated on the first page of each file where they apply.
-
-OPEN MARKET MAKES NO EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE
-SOFTWARE OR THE DOCUMENTATION, INCLUDING WITHOUT LIMITATION ANY
-WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN
-NO EVENT SHALL OPEN MARKET BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY
-DAMAGES ARISING FROM OR RELATING TO THIS SOFTWARE OR THE
-DOCUMENTATION, INCLUDING, WITHOUT LIMITATION, ANY INDIRECT, SPECIAL OR
-CONSEQUENTIAL DAMAGES OR SIMILAR DAMAGES, INCLUDING LOST PROFITS OR
-LOST DATA, EVEN IF OPEN MARKET HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES. THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS".
-OPEN MARKET HAS NO LIABILITY IN CONTRACT, TORT, NEGLIGENCE OR
-OTHERWISE ARISING OUT OF THIS SOFTWARE OR THE DOCUMENTATION.
diff --git a/sapi/cgi/libfcgi/acinclude.m4 b/sapi/cgi/libfcgi/acinclude.m4
deleted file mode 100644
index 20f02d8339..0000000000
--- a/sapi/cgi/libfcgi/acinclude.m4
+++ /dev/null
@@ -1,389 +0,0 @@
-dnl $Id$
-
-AC_DEFUN(FCGI_COMMON_CHECKS, [
- AC_MSG_CHECKING([for sun_len in sys/un.h])
- AC_EGREP_HEADER([sun_len], [sys/un.h],
- [AC_MSG_RESULT([yes])
- AC_DEFINE([HAVE_SOCKADDR_UN_SUN_LEN], [1],
- [Define if sockaddr_un in sys/un.h contains a sun_len component])],
- AC_MSG_RESULT([no]))
-
- AC_MSG_CHECKING([for fpos_t in stdio.h])
- AC_EGREP_HEADER([fpos_t], [stdio.h],
- [AC_MSG_RESULT([yes])
- AC_DEFINE([HAVE_FPOS], [1],
- [Define if the fpos_t typedef is in stdio.h])],
- AC_MSG_RESULT([no]))
-
- AC_CHECK_HEADERS([sys/socket.h netdb.h netinet/in.h arpa/inet.h])
- AC_CHECK_HEADERS([sys/time.h limits.h sys/param.h unistd.h])
-
- AC_MSG_CHECKING([for a fileno() prototype in stdio.h])
- AC_EGREP_HEADER([fileno], [stdio.h],
- [AC_MSG_RESULT([yes])
- AC_DEFINE([HAVE_FILENO_PROTO], [1],
- [Define if there's a fileno() prototype in stdio.h])],
- AC_MSG_RESULT([no]))
-
- if test "$HAVE_SYS_SOCKET_H"; then
- AC_MSG_CHECKING([for socklen_t in sys/socket.h])
- AC_EGREP_HEADER([socklen_t], [sys/socket.h],
- [AC_MSG_RESULT([yes])
- AC_DEFINE([HAVE_SOCKLEN], [1],
- [Define if the socklen_t typedef is in sys/socket.h])],
- AC_MSG_RESULT([no]))
- fi
-
- #--------------------------------------------------------------------
- # Do we need cross-process locking on this platform?
- #--------------------------------------------------------------------
- AC_MSG_CHECKING([whether cross-process locking is required by accept()])
- case "`uname -sr`" in
- IRIX\ 5.* | SunOS\ 5.* | UNIX_System_V\ 4.0)
- AC_MSG_RESULT([yes])
- AC_DEFINE([USE_LOCKING], [1],
- [Define if cross-process locking is required by accept()])
- ;;
- *)
- AC_MSG_RESULT([no])
- ;;
- esac
-
- #--------------------------------------------------------------------
- # Does va_arg(arg, long double) crash the compiler?
- # hpux 9.04 compiler does and so does Stratus FTX (uses HP's compiler)
- #--------------------------------------------------------------------
- AC_MSG_CHECKING([whether va_arg(arg, long double) crashes the compiler])
- AC_TRY_COMPILE([#include <stdarg.h>],
- [long double lDblArg; va_list arg; lDblArg = va_arg(arg, long double);],
- AC_MSG_RESULT([no]),
- [AC_MSG_RESULT([yes])
- AC_DEFINE([HAVE_VA_ARG_LONG_DOUBLE_BUG], [1],
- [Define if va_arg(arg, long double) crashes the compiler])])
-
- AC_C_CONST
-])
-
-
-dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
-dnl
-dnl This macro figures out how to build C programs using POSIX
-dnl threads. It sets the PTHREAD_LIBS output variable to the threads
-dnl library and linker flags, and the PTHREAD_CFLAGS output variable
-dnl to any special C compiler flags that are needed. (The user can also
-dnl force certain compiler flags/libs to be tested by setting these
-dnl environment variables.)
-dnl
-dnl Also sets PTHREAD_CC to any special C compiler that is needed for
-dnl multi-threaded programs (defaults to the value of CC otherwise).
-dnl (This is necessary on AIX to use the special cc_r compiler alias.)
-dnl
-dnl If you are only building threads programs, you may wish to
-dnl use these variables in your default LIBS, CFLAGS, and CC:
-dnl
-dnl LIBS="$PTHREAD_LIBS $LIBS"
-dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-dnl CC="$PTHREAD_CC"
-dnl
-dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
-dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE
-dnl to that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
-dnl
-dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
-dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands
-dnl to run it if it is not found. If ACTION-IF-FOUND is not specified,
-dnl the default action will define HAVE_PTHREAD.
-dnl
-dnl Please let the authors know if this macro fails on any platform,
-dnl or if you have any other suggestions or comments. This macro was
-dnl based on work by SGJ on autoconf scripts for FFTW (www.fftw.org)
-dnl (with help from M. Frigo), as well as ac_pthread and hb_pthread
-dnl macros posted by AFC to the autoconf macro repository. We are also
-dnl grateful for the helpful feedback of numerous users.
-dnl
-dnl @version $Id$
-dnl @author Steven G. Johnson <stevenj@alum.mit.edu> and Alejandro Forero Cuervo <bachue@bachue.com>
-
-AC_DEFUN([ACX_PTHREAD], [
-AC_REQUIRE([AC_CANONICAL_HOST])
-acx_pthread_ok=no
-
-# First, check if the POSIX threads header, pthread.h, is available.
-# If it isn't, don't bother looking for the threads libraries.
-AC_CHECK_HEADER(pthread.h, , acx_pthread_ok=noheader)
-
-# We must check for the threads library under a number of different
-# names; the ordering is very important because some systems
-# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
-# libraries is broken (non-POSIX).
-
-# First of all, check if the user has set any of the PTHREAD_LIBS,
-# etcetera environment variables, and if threads linking works using
-# them:
-if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
- AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
- AC_MSG_RESULT($acx_pthread_ok)
- if test x"$acx_pthread_ok" = xno; then
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
- fi
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-fi
-
-# Create a list of thread flags to try. Items starting with a "-" are
-# C compiler flags, and other items are library names, except for "none"
-# which indicates that we try without any flags at all.
-
-acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
-
-# The ordering *is* (sometimes) important. Some notes on the
-# individual items follow:
-
-# pthreads: AIX (must check this before -lpthread)
-# none: in case threads are in libc; should be tried before -Kthread and
-# other compiler flags to prevent continual compiler warnings
-# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
-# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
-# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
-# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
-# -pthreads: Solaris/gcc
-# -mthreads: Mingw32/gcc, Lynx/gcc
-# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
-# doesn't hurt to check since this sometimes defines pthreads too;
-# also defines -D_REENTRANT)
-# pthread: Linux, etcetera
-# --thread-safe: KAI C++
-
-case "${host_cpu}-${host_os}" in
- *solaris*)
-
- # On Solaris (at least, for some versions), libc contains stubbed
- # (non-functional) versions of the pthreads routines, so link-based
- # tests will erroneously succeed. (We need to link with -pthread or
- # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
- # a function called by this macro, so we could check for that, but
- # who knows whether they'll stub that too in a future libc.) So,
- # we'll just look for -pthreads and -lpthread first:
-
- acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
- ;;
-esac
-
-if test x"$acx_pthread_ok" = xno; then
-for flag in $acx_pthread_flags; do
-
- case $flag in
- none)
- AC_MSG_CHECKING([whether pthreads work without any flags])
- ;;
-
- -*)
- AC_MSG_CHECKING([whether pthreads work with $flag])
- PTHREAD_CFLAGS="$flag"
- ;;
-
- *)
- AC_MSG_CHECKING([for the pthreads library -l$flag])
- PTHREAD_LIBS="-l$flag"
- ;;
- esac
-
- save_LIBS="$LIBS"
- save_CFLAGS="$CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
- # Check for various functions. We must include pthread.h,
- # since some functions may be macros. (On the Sequent, we
- # need a special flag -Kthread to make this header compile.)
- # We check for pthread_join because it is in -lpthread on IRIX
- # while pthread_create is in libc. We check for pthread_attr_init
- # due to DEC craziness with -lpthreads. We check for
- # pthread_cleanup_push because it is one of the few pthread
- # functions on Solaris that doesn't have a non-functional libc stub.
- # We try pthread_create on general principles.
- AC_TRY_LINK([#include <pthread.h>],
- [pthread_t th; pthread_join(th, 0);
- pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
- [acx_pthread_ok=yes])
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-
- AC_MSG_RESULT($acx_pthread_ok)
- if test "x$acx_pthread_ok" = xyes; then
- break;
- fi
-
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
-done
-fi
-
-# Various other checks:
-if test "x$acx_pthread_ok" = xyes; then
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
- # Detect AIX lossage: threads are created detached by default
- # and the JOINABLE attribute has a nonstandard name (UNDETACHED).
- AC_MSG_CHECKING([for joinable pthread attribute])
- AC_TRY_LINK([#include <pthread.h>],
- [int attr=PTHREAD_CREATE_JOINABLE;],
- ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
- if test x"$ok" = xunknown; then
- AC_TRY_LINK([#include <pthread.h>],
- [int attr=PTHREAD_CREATE_UNDETACHED;],
- ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
- fi
- if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
- AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
- [Define to the necessary symbol if this constant
- uses a non-standard name on your system.])
- fi
- AC_MSG_RESULT(${ok})
- if test x"$ok" = xunknown; then
- AC_MSG_WARN([we do not know how to create joinable pthreads])
- fi
-
- AC_MSG_CHECKING([if more special flags are required for pthreads])
- flag=no
- case "${host_cpu}-${host_os}" in
- *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
- *solaris* | alpha*-osf*) flag="-D_REENTRANT";;
- esac
- AC_MSG_RESULT(${flag})
- if test "x$flag" != xno; then
- PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
- fi
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-
- # More AIX lossage: must compile with cc_r
- AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
-else
- PTHREAD_CC="$CC"
-fi
-
-AC_SUBST(PTHREAD_LIBS)
-AC_SUBST(PTHREAD_CFLAGS)
-AC_SUBST(PTHREAD_CC)
-
-# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
-if test x"$acx_pthread_ok" = xyes; then
- ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
- :
-else
- acx_pthread_ok=no
- $2
-fi
-
-])dnl ACX_PTHREAD
-
-
-
-dnl @synopsis AC_PROG_CC_WARNINGS([ANSI])
-dnl
-dnl Enables a reasonable set of warnings for the C compiler. Optionally,
-dnl if the first argument is nonempty, turns on flags which enforce and/or
-dnl enable proper ANSI C if such flags are known to the compiler used.
-dnl
-dnl Currently this macro knows about GCC, Solaris C compiler,
-dnl Digital Unix C compiler, C for AIX Compiler, HP-UX C compiler,
-dnl and IRIX C compiler.
-dnl
-dnl @version $Id$
-dnl @author Ville Laurikari <vl@iki.fi>
-dnl
-AC_DEFUN([AC_PROG_CC_WARNINGS], [
- ansi=$1
- if test -z "$ansi"; then
- msg="for C compiler warning flags"
- else
- msg="for C compiler warning and ANSI conformance flags"
- fi
- AC_CACHE_CHECK($msg, ac_cv_prog_cc_warnings, [
- if test -n "$CC"; then
- cat > conftest.c <<EOF
-int main(int argc, char **argv) { return 0; }
-EOF
-
- dnl GCC
- if test "$GCC" = "yes"; then
- if test -z "$ansi"; then
- ac_cv_prog_cc_warnings="-Wall"
- else
- ac_cv_prog_cc_warnings="-Wall -ansi -pedantic"
- fi
-
- dnl Solaris C compiler
- elif $CC -flags 2>&1 | grep "Xc.*strict ANSI C" > /dev/null 2>&1 &&
- $CC -c -v -Xc conftest.c > /dev/null 2>&1 &&
- test -f conftest.o; then
- if test -z "$ansi"; then
- ac_cv_prog_cc_warnings="-v"
- else
- ac_cv_prog_cc_warnings="-v -Xc"
- fi
-
- dnl HP-UX C compiler
- elif $CC > /dev/null 2>&1 &&
- $CC -c -Aa +w1 conftest.c > /dev/null 2>&1 &&
- test -f conftest.o; then
- if test -z "$ansi"; then
- ac_cv_prog_cc_warnings="+w1"
- else
- ac_cv_prog_cc_warnings="+w1 -Aa"
- fi
-
- dnl Digital Unix C compiler
- elif ! $CC > /dev/null 2>&1 &&
- $CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 &&
- test -f conftest.o; then
- if test -z "$ansi"; then
- ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos"
- else
- ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos -std1"
- fi
-
- dnl C for AIX Compiler
- elif $CC > /dev/null 2>&1 | grep AIX > /dev/null 2>&1 &&
- $CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 &&
- test -f conftest.o; then
- if test -z "$ansi"; then
- ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd"
- else
- ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi"
- fi
-
- dnl IRIX C compiler
- elif $CC -fullwarn -ansi -ansiE > /dev/null 2>&1 &&
- test -f conftest.o; then
- if test -z "$ansi"; then
- ac_cv_prog_cc_warnings="-fullwarn"
- else
- ac_cv_prog_cc_warnings="-fullwarn -ansi -ansiE"
- fi
-
- fi
- rm -f conftest.*
- fi
- if test -n "$ac_cv_prog_cc_warnings"; then
- CFLAGS="$CFLAGS $ac_cv_prog_cc_warnings"
- else
- ac_cv_prog_cc_warnings="unknown"
- fi
- ])
-])
-
-
diff --git a/sapi/cgi/libfcgi/fcgi_stdio.c b/sapi/cgi/libfcgi/fcgi_stdio.c
deleted file mode 100644
index 39a56315fd..0000000000
--- a/sapi/cgi/libfcgi/fcgi_stdio.c
+++ /dev/null
@@ -1,801 +0,0 @@
-/*
- * fcgi_stdio.c --
- *
- * FastCGI-stdio compatibility package
- *
- *
- * Copyright (c) 1996 Open Market, Inc.
- *
- * See the file "LICENSE.TERMS" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- */
-
-#ifndef lint
-static const char rcsid[] = "$Id$";
-#endif /* not lint */
-
-#include <errno.h> /* for errno */
-#include <stdarg.h> /* for va_arg */
-#include <stdlib.h> /* for malloc */
-#include <string.h> /* for strerror */
-
-#include "fcgi_config.h"
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef _WIN32
-#define DLLAPI __declspec(dllexport)
-#endif
-
-#include "fcgiapp.h"
-#include "fcgios.h"
-#include "fcgimisc.h"
-
-#define NO_FCGI_DEFINES
-#include "fcgi_stdio.h"
-#undef NO_FCGI_DEFINES
-
-#ifndef _WIN32
-
-extern char **environ;
-
-#ifdef HAVE_FILENO_PROTO
-#include <stdio.h>
-#else
-extern int fileno(FILE *stream);
-#endif
-
-extern FILE *fdopen(int fildes, const char *type);
-extern FILE *popen(const char *command, const char *type);
-extern int pclose(FILE *stream);
-
-#else /* _WIN32 */
-
-#define popen _popen
-#define pclose _pclose
-
-#endif /* _WIN32 */
-
-FCGI_FILE _fcgi_sF[3];
-
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_Accept --
- *
- * Accepts a new request from the HTTP server and creates
- * a conventional execution environment for the request.
- *
- * If the application was invoked as a FastCGI server,
- * the first call to FCGI_Accept indicates that the application
- * has completed its initialization and is ready to accept
- * a request. Subsequent calls to FCGI_Accept indicate that
- * the application has completed its processing of the
- * current request and is ready to accept a new request.
- *
- * If the application was invoked as a CGI program, the first
- * call to FCGI_Accept is essentially a no-op and the second
- * call returns EOF (-1).
- *
- * Results:
- * 0 for successful call, -1 for error (application should exit).
- *
- * Side effects:
- * If the application was invoked as a FastCGI server,
- * and this is not the first call to this procedure,
- * FCGI_Accept first performs the equivalent of FCGI_Finish.
- *
- * On every call, FCGI_Accept accepts the new request and
- * reads the FCGI_PARAMS stream into an environment array,
- * i.e. a NULL-terminated array of strings of the form
- * ``name=value''. It assigns a pointer to this array
- * to the global variable environ, used by the standard
- * library function getenv. It creates new FCGI_FILE *s
- * representing input from the HTTP server, output to the HTTP
- * server, and error output to the HTTP server, and assigns these
- * new files to stdin, stdout, and stderr respectively.
- *
- * DO NOT mutate or retain pointers to environ or any values
- * contained in it (e.g. to the result of calling getenv(3)),
- * since these are freed by the next call to FCGI_Finish or
- * FCGI_Accept. In particular do not use setenv(3) or putenv(3)
- * in conjunction with FCGI_Accept.
- *
- *----------------------------------------------------------------------
- */
-static int acceptCalled = FALSE;
-static int isCGI = FALSE;
-
-int FCGI_Accept(void)
-{
- if(!acceptCalled) {
- /*
- * First call to FCGI_Accept. Is application running
- * as FastCGI or as CGI?
- */
- isCGI = FCGX_IsCGI();
- acceptCalled = TRUE;
- atexit(&FCGI_Finish);
- } else if(isCGI) {
- /*
- * Not first call to FCGI_Accept and running as CGI means
- * application is done.
- */
- return(EOF);
- }
- if(isCGI) {
- FCGI_stdin->stdio_stream = stdin;
- FCGI_stdin->fcgx_stream = NULL;
- FCGI_stdout->stdio_stream = stdout;
- FCGI_stdout->fcgx_stream = NULL;
- FCGI_stderr->stdio_stream = stderr;
- FCGI_stderr->fcgx_stream = NULL;
- } else {
- FCGX_Stream *in, *out, *error;
- FCGX_ParamArray envp;
- int acceptResult = FCGX_Accept(&in, &out, &error, &envp);
- if(acceptResult < 0) {
- return acceptResult;
- }
- FCGI_stdin->stdio_stream = NULL;
- FCGI_stdin->fcgx_stream = in;
- FCGI_stdout->stdio_stream = NULL;
- FCGI_stdout->fcgx_stream = out;
- FCGI_stderr->stdio_stream = NULL;
- FCGI_stderr->fcgx_stream = error;
- environ = envp;
- }
- return 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_Finish --
- *
- * Finishes the current request from the HTTP server.
- *
- * Side effects:
- *
- * Flushes any buffered output to the HTTP server. Then frees
- * all storage allocated by the previous call, including all
- * storage reachable from the value of environ set by the previous
- * call to FCGI_Accept.
- *
- * DO NOT use stdin, stdout, stderr, or environ between calling
- * FCGI_Finish and calling FCGI_Accept.
- *
- * DO NOT mutate or retain pointers to environ or any values
- * contained in it (e.g. to the result of calling getenv(3)),
- * since these are freed by the next call to FCGI_Finish or
- * FCGI_Accept. In particular do not use setenv(3) or putenv(3)
- * in conjunction with FCGI_Accept.
- *
- *----------------------------------------------------------------------
- */
-void FCGI_Finish(void)
-{
- if(!acceptCalled || isCGI) {
- return;
- }
- FCGX_Finish();
- FCGI_stdin->fcgx_stream = NULL;
- FCGI_stdout->fcgx_stream = NULL;
- FCGI_stderr->fcgx_stream = NULL;
- environ = NULL;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_StartFilterData --
- *
- *
- * The current request is for the filter role, and stdin is
- * positioned at EOF of FCGI_STDIN. The call repositions
- * stdin to the start of FCGI_DATA.
- * If the preconditions are not met (e.g. FCGI_STDIN has not
- * been read to EOF), the call sets the stream error code to
- * FCGX_CALL_SEQ_ERROR.
- *
- * Results:
- * 0 for a normal return, < 0 for error
- *
- *----------------------------------------------------------------------
- */
-int FCGI_StartFilterData(void)
-{
- if(FCGI_stdin->stdio_stream) {
- return -1;
- } else {
- return FCGX_StartFilterData(FCGI_stdin->fcgx_stream);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_SetExitStatus --
- *
- * Sets the exit status for the current request. The exit status
- * is the status code the request would have exited with, had
- * the request been run as a CGI program. You can call
- * FCGI_SetExitStatus several times during a request; the last call
- * before the request ends (by calling FCGI_Accept) determines the
- * value.
- *
- *----------------------------------------------------------------------
- */
-void FCGI_SetExitStatus(int status)
-{
- if(FCGI_stdin->fcgx_stream) {
- FCGX_SetExitStatus(status, FCGI_stdin->fcgx_stream);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_perror --
- *
- * Wrapper for function defined in H&S Section 11.2
- *
- *----------------------------------------------------------------------
- */
-void FCGI_perror(const char *str)
-{
- FCGI_fputs(str, FCGI_stderr);
- FCGI_fputs(": ", FCGI_stderr);
- FCGI_fputs(strerror(OS_Errno), FCGI_stderr);
- return;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_OpenFromFILE --
- *
- * Constructs a new FCGI_FILE * from the FILE *stream.
- *
- * Results:
- * NULL if stream == NULL or storage could not be allocated,
- * otherwise the new FCGI_FILE *.
- *
- *----------------------------------------------------------------------
- */
-static FCGI_FILE *FCGI_OpenFromFILE(FILE *stream)
-{
- FCGI_FILE *fp;
-
- if (stream == NULL)
- return NULL;
-
- fp = (FCGI_FILE *) malloc(sizeof(FCGI_FILE));
- if (fp != NULL)
- {
- fp->stdio_stream = stream;
- fp->fcgx_stream = NULL;
- }
-
- return fp;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_fopen, FCGI_fclose, FCGI_fflush, FCGI_freopen --
- *
- * Wrappers for functions defined in H&S Section 15.2
- *
- *----------------------------------------------------------------------
- */
-FCGI_FILE *FCGI_fopen(const char *path, const char *mode)
-{
- FILE * file = fopen(path, mode);
- FCGI_FILE * fcgi_file = FCGI_OpenFromFILE(file);
-
- if (file && !fcgi_file)
- fclose(file);
-
- return fcgi_file;
-}
-
-int FCGI_fclose(FCGI_FILE *fp)
-{
- int n = EOF;
- if(fp->stdio_stream) {
- n = fclose(fp->stdio_stream);
- fp->stdio_stream = NULL;
- } else if(fp->fcgx_stream) {
- n = FCGX_FClose(fp->fcgx_stream);
- fp->fcgx_stream = NULL;
- }
- if((fp != FCGI_stdin) && (fp != FCGI_stdout) && (fp != FCGI_stderr)) {
- free(fp);
- }
- return n;
-}
-
-int FCGI_fflush(FCGI_FILE *fp)
-{
- if(fp == NULL)
- return fflush(NULL);
- if(fp->stdio_stream)
- return fflush(fp->stdio_stream);
- else if(fp->fcgx_stream)
- return FCGX_FFlush(fp->fcgx_stream);
- return EOF;
-}
-
-FCGI_FILE *FCGI_freopen(const char *path, const char *mode,
- FCGI_FILE *fp)
-{
- if(fp->stdio_stream) {
- if(freopen(path, mode, fp->stdio_stream) == NULL)
- return NULL;
- else
- return fp;
- } else if(fp->fcgx_stream) {
- (void) FCGX_FClose(fp->fcgx_stream);
- fp->stdio_stream = fopen(path, mode);
- if(fp->stdio_stream == NULL)
- return NULL;
- else {
- fp->fcgx_stream = NULL;
- return fp;
- }
- }
- return NULL;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_setvbuf, FCGI_setbuf --
- *
- * Wrappers for functions defined in H&S Section 15.3
- *
- *----------------------------------------------------------------------
- */
-int FCGI_setvbuf(FCGI_FILE *fp, char *buf, int bufmode, size_t size)
-{
- if(fp->stdio_stream)
- return setvbuf(fp->stdio_stream, buf, bufmode, size);
- else {
- return -1;
- }
-}
-
-void FCGI_setbuf(FCGI_FILE *fp, char *buf)
-{
- if(fp->stdio_stream)
- setbuf(fp->stdio_stream, buf);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_fseek, FCGI_ftell, FCGI_rewind, FCGI_fgetpos, FCGI_fsetpos --
- *
- * Wrappers for functions defined in H&S Section 15.5
- *
- *----------------------------------------------------------------------
- */
-int FCGI_fseek(FCGI_FILE *fp, long offset, int whence)
-{
- if(fp->stdio_stream)
- return fseek(fp->stdio_stream, offset, whence);
- else {
- OS_SetErrno(ESPIPE);
- return -1;
- }
-}
-
-int FCGI_ftell(FCGI_FILE *fp)
-{
- if(fp->stdio_stream)
- return ftell(fp->stdio_stream);
- else {
- OS_SetErrno(ESPIPE);
- return -1;
- }
-}
-
-void FCGI_rewind(FCGI_FILE *fp)
-{
- if(fp->stdio_stream)
- rewind(fp->stdio_stream);
- else
- OS_SetErrno(ESPIPE);
-}
-
-#ifdef HAVE_FPOS
-int FCGI_fgetpos(FCGI_FILE *fp, fpos_t *pos)
-{
- if(fp->stdio_stream)
- return fgetpos(fp->stdio_stream, pos);
- else {
- OS_SetErrno(ESPIPE);
- return -1;
- }
-}
-
-int FCGI_fsetpos(FCGI_FILE *fp, const fpos_t *pos)
-{
- if(fp->stdio_stream)
- return fsetpos(fp->stdio_stream, pos);
- else {
- OS_SetErrno(ESPIPE);
- return -1;
- }
-}
-#endif
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_fgetc, FCGI_getchar, FCGI_ungetc --
- *
- * Wrappers for functions defined in H&S Section 15.6
- *
- * XXX: getc and getchar are generally defined as macros
- * for performance reasons
- *
- *----------------------------------------------------------------------
- */
-int FCGI_fgetc(FCGI_FILE *fp)
-{
- if(fp->stdio_stream)
- return fgetc(fp->stdio_stream);
- else if(fp->fcgx_stream)
- return FCGX_GetChar(fp->fcgx_stream);
- return EOF;
-}
-
-int FCGI_getchar(void)
-{
- return FCGI_fgetc(FCGI_stdin);
-}
-
-int FCGI_ungetc(int c, FCGI_FILE *fp)
-{
- if(fp->stdio_stream)
- return ungetc(c, fp->stdio_stream);
- else if(fp->fcgx_stream)
- return FCGX_UnGetChar(c, fp->fcgx_stream);
- return EOF;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_fgets, FCGI_gets --
- *
- * Wrappers for functions defined in H&S Section 15.7
- *
- *----------------------------------------------------------------------
- */
-char *FCGI_fgets(char *str, int size, FCGI_FILE *fp)
-{
- if(fp->stdio_stream)
- return fgets(str, size, fp->stdio_stream);
- else if(fp->fcgx_stream)
- return FCGX_GetLine(str, size, fp->fcgx_stream);
- return NULL;
-}
-
-/*
- * The gets() function reads characters from the standard input stream
- * into the array pointed to by str until a newline character is read
- * or an end-of-file condition is encountered. The newline character
- * is discarded and the string is terminated with a null character.
- */
-char *FCGI_gets(char *str)
-{
- char *s;
- int c;
-
- for (s = str; ((c = FCGI_getchar()) != '\n');) {
- if(c == EOF) {
- if(s == str)
- return NULL;
- else
- break;
- } else
- *s++ = (char) c;
- }
- *s = 0;
- return str;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Wrappers for functions defined in H&S Section 15.8
- *
- * XXX: missing: fscanf, scanf
- *
- *----------------------------------------------------------------------
- */
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_fputc, FCGI_putchar --
- *
- * Wrappers for functions defined in H&S Section 15.9
- *
- * XXX: putc and putchar are generally defined as macros
- * for performance reasons
- *
- *----------------------------------------------------------------------
- */
-int FCGI_fputc(int c, FCGI_FILE *fp)
-{
- if(fp->stdio_stream)
- return fputc(c, fp->stdio_stream);
- else if(fp->fcgx_stream)
- return FCGX_PutChar(c, fp->fcgx_stream);
- else return EOF;
-}
-
-int FCGI_putchar(int c)
-{
- return FCGI_fputc(c, FCGI_stdout);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_fputs, FCGI_puts
- *
- * Wrappers for functions defined in H&S Section 15.10
- *
- *----------------------------------------------------------------------
- */
-int FCGI_fputs(const char *str, FCGI_FILE *fp)
-{
- if(fp->stdio_stream)
- return fputs(str, fp->stdio_stream);
- else if(fp->fcgx_stream)
- return FCGX_PutS(str, fp->fcgx_stream);
- return EOF;
-}
-
-int FCGI_puts(const char *str)
-{
- int n;
- if(FCGI_stdout->stdio_stream) {
- n = fputs(str, FCGI_stdout->stdio_stream);
- if(n < 0)
- return n;
- else
- return fputc('\n', FCGI_stdout->stdio_stream);
- } else if(FCGI_stdout->fcgx_stream) {
- n = FCGX_PutS(str, FCGI_stdout->fcgx_stream);
- if(n < 0)
- return n;
- else
- return FCGX_PutChar('\n', FCGI_stdout->fcgx_stream);
- }
- return EOF;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_fprintf, FCGI_printf --
- *
- * Wrappers for functions defined in H&S Section 15.11
- *
- *----------------------------------------------------------------------
- */
-int FCGI_fprintf(FCGI_FILE *fp, const char *format, ...)
-{
- va_list ap;
- int n = 0;
- va_start(ap, format);
- if(fp->stdio_stream)
- n = vfprintf(fp->stdio_stream, format, ap);
- else if(fp->fcgx_stream)
- n = FCGX_VFPrintF(fp->fcgx_stream, format, ap);
- va_end(ap);
- return n;
-}
-
-int FCGI_printf(const char *format, ...)
-{
- va_list ap;
- int n;
- va_start(ap, format);
- n = FCGI_vfprintf(FCGI_stdout, format, ap);
- va_end(ap);
- return n;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_vfprintf, FCGI_vprintf --
- *
- * Wrappers for functions defined in H&S Section 15.12
- *
- *----------------------------------------------------------------------
- */
-int FCGI_vfprintf(FCGI_FILE *fp, const char *format, va_list ap)
-{
- if(fp->stdio_stream)
- return vfprintf(fp->stdio_stream, format, ap);
- else if(fp->fcgx_stream)
- return FCGX_VFPrintF(fp->fcgx_stream, format, ap);
- return EOF;
-}
-
-int FCGI_vprintf(const char *format, va_list ap)
-{
- if(FCGI_stdout->stdio_stream)
- return vfprintf(FCGI_stdout->stdio_stream, format, ap);
- else if(FCGI_stdout->fcgx_stream)
- return FCGX_VFPrintF(FCGI_stdout->fcgx_stream, format, ap);
- return EOF;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_fread, FCGI_fwrite --
- *
- * Wrappers for functions defined in H&S Section 15.13
- *
- *----------------------------------------------------------------------
- */
-size_t FCGI_fread(void *ptr, size_t size, size_t nmemb, FCGI_FILE *fp)
-{
- int n;
- if(fp->stdio_stream)
- return fread(ptr, size, nmemb, fp->stdio_stream);
- else if(fp->fcgx_stream) {
- if((size * nmemb) == 0) {
- return 0;
- }
- n = FCGX_GetStr((char *) ptr, size * nmemb, fp->fcgx_stream);
- return (n/size);
- }
- return (size_t)EOF;
-}
-
-size_t FCGI_fwrite(void *ptr, size_t size, size_t nmemb, FCGI_FILE *fp)
-{
- int n;
- if(fp->stdio_stream)
- return fwrite(ptr, size, nmemb, fp->stdio_stream);
- else if(fp->fcgx_stream) {
- if((size * nmemb) == 0) {
- return 0;
- }
- n = FCGX_PutStr((char *) ptr, size * nmemb, fp->fcgx_stream);
- return (n/size);
- }
- return (size_t)EOF;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_feof, FCGI_ferror, FCGI_clearerr --
- *
- * Wrappers for functions defined in H&S Section 15.14
- *
- *----------------------------------------------------------------------
- */
-int FCGI_feof(FCGI_FILE *fp)
-{
- if(fp->stdio_stream) {
- return feof(fp->stdio_stream);
- } else if (fp->fcgx_stream){
- return FCGX_HasSeenEOF(fp->fcgx_stream);
- }
- return -1;
-
-}
-
-int FCGI_ferror(FCGI_FILE *fp)
-{
- if(fp->stdio_stream) {
- return ferror(fp->stdio_stream);
- } else if(fp->fcgx_stream) {
- return FCGX_GetError(fp->fcgx_stream);
- }
- return -1;
-}
-
-void FCGI_clearerr(FCGI_FILE *fp)
-{
- if(fp->stdio_stream) {
- clearerr(fp->stdio_stream);
- } else if(fp->fcgx_stream) {
- FCGX_ClearError(fp->fcgx_stream);
- }
- return;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_tmpfile --
- *
- * Wrappers for function defined in H&S Section 15.16
- *
- *----------------------------------------------------------------------
- */
-FCGI_FILE *FCGI_tmpfile(void)
-{
- FILE * file = tmpfile();
- FCGI_FILE * fcgi_file = FCGI_OpenFromFILE(file);
-
- if (file && !fcgi_file)
- fclose(file);
-
- return fcgi_file;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGI_fileno, FCGI_fdopen, FCGI_popen, FCGI_pclose --
- *
- * Wrappers for POSIX, X/OPEN functions not in ISO C
- *
- *----------------------------------------------------------------------
- */
-int FCGI_fileno(FCGI_FILE *fp)
-{
- if(fp->stdio_stream)
- return fileno(fp->stdio_stream);
- else
- return -1;
-}
-
-FCGI_FILE *FCGI_fdopen(int fd, const char *mode)
-{
- FILE * file = fdopen(fd, mode);
- FCGI_FILE * fcgi_file = FCGI_OpenFromFILE(file);
-
- if (file && !fcgi_file)
- fclose(file);
-
- return fcgi_file;
-}
-
-FCGI_FILE *FCGI_popen(const char *cmd, const char *type)
-{
- FILE * file = popen(cmd, type);
- FCGI_FILE * fcgi_file = FCGI_OpenFromFILE(file);
-
- if (file && !fcgi_file)
- pclose(file);
-
- return fcgi_file;
-}
-
-int FCGI_pclose(FCGI_FILE *fp)
-{
- int n = EOF;
- if (fp->stdio_stream) {
- n = pclose(fp->stdio_stream);
- fp->stdio_stream = NULL;
- } else if(fp->fcgx_stream) {
- /*
- * The caller is deeply confused; don't free the storage.
- */
- return EOF;
- }
- if((fp != FCGI_stdin) && (fp != FCGI_stdout) && (fp != FCGI_stderr)) {
- free(fp);
- }
- return n;
-}
diff --git a/sapi/cgi/libfcgi/fcgiapp.c b/sapi/cgi/libfcgi/fcgiapp.c
deleted file mode 100644
index cc57c93c7e..0000000000
--- a/sapi/cgi/libfcgi/fcgiapp.c
+++ /dev/null
@@ -1,2323 +0,0 @@
-/*
- * fcgiapp.c --
- *
- * FastCGI application library: request-at-a-time
- *
- *
- * Copyright (c) 1996 Open Market, Inc.
- *
- * See the file "LICENSE.TERMS" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- */
-#ifndef lint
-static const char rcsid[] = "$Id$";
-#endif /* not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h> /* for fcntl */
-#include <math.h>
-#include <memory.h> /* for memchr() */
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include "fcgi_config.h"
-
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h> /* for getpeername */
-#endif
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#ifdef _WIN32
-#define DLLAPI __declspec(dllexport)
-#endif
-
-#include "fcgimisc.h"
-#include "fastcgi.h"
-#include "fcgios.h"
-#include "fcgiapp.h"
-
-/*
- * This is a workaround for one version of the HP C compiler
- * (c89 on HP-UX 9.04, also Stratus FTX), which will dump core
- * if given 'long double' for varargs.
- */
-#ifdef HAVE_VA_ARG_LONG_DOUBLE_BUG
-#define LONG_DOUBLE double
-#else
-#define LONG_DOUBLE long double
-#endif
-
-/*
- * Globals
- */
-static int libInitialized = 0;
-static int isFastCGI = -1;
-static char *webServerAddressList = NULL;
-static FCGX_Request the_request;
-void _FCGX_FreeStream(FCGX_Stream **streamPtr, int freeData);
-
-void FCGX_ShutdownPending(void)
-{
- OS_ShutdownPending();
-}
-
-static void *Malloc(size_t size)
-{
- void *result = malloc(size);
- ASSERT(size == 0 || result != NULL);
- return result;
-}
-
-static char *StringCopy(char *str)
-{
- int strLen = strlen(str);
- char *newString = (char *)Malloc(strLen + 1);
- memcpy(newString, str, strLen);
- newString[strLen] = '\000';
- return newString;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_GetChar --
- *
- * Reads a byte from the input stream and returns it.
- *
- * Results:
- * The byte, or EOF (-1) if the end of input has been reached.
- *
- *----------------------------------------------------------------------
- */
-int FCGX_GetChar(FCGX_Stream *stream)
-{
- if(stream->rdNext != stream->stop)
- return *stream->rdNext++;
- if(stream->isClosed || !stream->isReader)
- return EOF;
- stream->fillBuffProc(stream);
- stream->stopUnget = stream->rdNext;
- if(stream->rdNext != stream->stop)
- return *stream->rdNext++;
- ASSERT(stream->isClosed); /* bug in fillBufProc if not */
- return EOF;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_GetStr --
- *
- * Reads up to n consecutive bytes from the input stream
- * into the character array str. Performs no interpretation
- * of the input bytes.
- *
- * Results:
- * Number of bytes read. If result is smaller than n,
- * the end of input has been reached.
- *
- *----------------------------------------------------------------------
- */
-int FCGX_GetStr(char *str, int n, FCGX_Stream *stream)
-{
- int m, bytesMoved;
-
- if(n <= 0) {
- return 0;
- }
- /*
- * Fast path: n bytes are already available
- */
- if(n <= (stream->stop - stream->rdNext)) {
- memcpy(str, stream->rdNext, n);
- stream->rdNext += n;
- return n;
- }
- /*
- * General case: stream is closed or buffer fill procedure
- * needs to be called
- */
- bytesMoved = 0;
- for (;;) {
- if(stream->rdNext != stream->stop) {
- m = min(n - bytesMoved, stream->stop - stream->rdNext);
- memcpy(str, stream->rdNext, m);
- bytesMoved += m;
- stream->rdNext += m;
- if(bytesMoved == n)
- return bytesMoved;
- str += m;
- }
- if(stream->isClosed || !stream->isReader)
- return bytesMoved;
- stream->fillBuffProc(stream);
- stream->stopUnget = stream->rdNext;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_GetLine --
- *
- * Reads up to n-1 consecutive bytes from the input stream
- * into the character array str. Stops before n-1 bytes
- * have been read if '\n' or EOF is read. The terminating '\n'
- * is copied to str. After copying the last byte into str,
- * stores a '\0' terminator.
- *
- * Results:
- * NULL if EOF is the first thing read from the input stream,
- * str otherwise.
- *
- *----------------------------------------------------------------------
- */
-char *FCGX_GetLine(char *str, int n, FCGX_Stream *stream)
-{
- int c;
- char *p = str;
-
- n--;
- while (n > 0) {
- c = FCGX_GetChar(stream);
- if(c == EOF) {
- if(p == str)
- return NULL;
- else
- break;
- }
- *p++ = (char) c;
- n--;
- if(c == '\n')
- break;
- }
- *p = '\0';
- return str;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_UnGetChar --
- *
- * Pushes back the character c onto the input stream. One
- * character of pushback is guaranteed once a character
- * has been read. No pushback is possible for EOF.
- *
- * Results:
- * Returns c if the pushback succeeded, EOF if not.
- *
- *----------------------------------------------------------------------
- */
-int FCGX_UnGetChar(int c, FCGX_Stream *stream) {
- if(c == EOF
- || stream->isClosed
- || !stream->isReader
- || stream->rdNext == stream->stopUnget)
- return EOF;
- --(stream->rdNext);
- *stream->rdNext = (unsigned char) c;
- return c;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_HasSeenEOF --
- *
- * Returns EOF if end-of-file has been detected while reading
- * from stream; otherwise returns 0.
- *
- * Note that FCGX_HasSeenEOF(s) may return 0, yet an immediately
- * following FCGX_GetChar(s) may return EOF. This function, like
- * the standard C stdio function feof, does not provide the
- * ability to peek ahead.
- *
- * Results:
- * EOF if end-of-file has been detected, 0 if not.
- *
- *----------------------------------------------------------------------
- */
-int FCGX_HasSeenEOF(FCGX_Stream *stream) {
- return (stream->isClosed) ? EOF : 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_PutChar --
- *
- * Writes a byte to the output stream.
- *
- * Results:
- * The byte, or EOF (-1) if an error occurred.
- *
- *----------------------------------------------------------------------
- */
-int FCGX_PutChar(int c, FCGX_Stream *stream)
-{
- if(stream->wrNext != stream->stop)
- return (*stream->wrNext++ = (unsigned char) c);
- if(stream->isClosed || stream->isReader)
- return EOF;
- stream->emptyBuffProc(stream, FALSE);
- if(stream->wrNext != stream->stop)
- return (*stream->wrNext++ = (unsigned char) c);
- ASSERT(stream->isClosed); /* bug in emptyBuffProc if not */
- return EOF;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_PutStr --
- *
- * Writes n consecutive bytes from the character array str
- * into the output stream. Performs no interpretation
- * of the output bytes.
- *
- * Results:
- * Number of bytes written (n) for normal return,
- * EOF (-1) if an error occurred.
- *
- *----------------------------------------------------------------------
- */
-int FCGX_PutStr(const char *str, int n, FCGX_Stream *stream)
-{
- int m, bytesMoved;
-
- /*
- * Fast path: room for n bytes in the buffer
- */
- if(n <= (stream->stop - stream->wrNext)) {
- memcpy(stream->wrNext, str, n);
- stream->wrNext += n;
- return n;
- }
- /*
- * General case: stream is closed or buffer empty procedure
- * needs to be called
- */
- bytesMoved = 0;
- for (;;) {
- if(stream->wrNext != stream->stop) {
- m = min(n - bytesMoved, stream->stop - stream->wrNext);
- memcpy(stream->wrNext, str, m);
- bytesMoved += m;
- stream->wrNext += m;
- if(bytesMoved == n)
- return bytesMoved;
- str += m;
- }
- if(stream->isClosed || stream->isReader)
- return -1;
- stream->emptyBuffProc(stream, FALSE);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_PutS --
- *
- * Writes a character string to the output stream.
- *
- * Results:
- * number of bytes written for normal return,
- * EOF (-1) if an error occurred.
- *
- *----------------------------------------------------------------------
- */
-int FCGX_PutS(const char *str, FCGX_Stream *stream)
-{
- return FCGX_PutStr(str, strlen(str), stream);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_FPrintF --
- *
- * Performs output formatting and writes the results
- * to the output stream.
- *
- * Results:
- * number of bytes written for normal return,
- * EOF (-1) if an error occurred.
- *
- *----------------------------------------------------------------------
- */
-int FCGX_FPrintF(FCGX_Stream *stream, const char *format, ...)
-{
- int result;
- va_list ap;
- va_start(ap, format);
- result = FCGX_VFPrintF(stream, format, ap);
- va_end(ap);
- return result;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_VFPrintF --
- *
- * Performs output formatting and writes the results
- * to the output stream.
- *
- * Results:
- * number of bytes written for normal return,
- * EOF (-1) if an error occurred.
- *
- *----------------------------------------------------------------------
- */
-
-#define PRINTF_BUFFLEN 100
- /*
- * More than sufficient space for all unmodified conversions
- * except %s and %f.
- */
-#define FMT_BUFFLEN 25
- /*
- * Max size of a format specifier is 1 + 5 + 7 + 7 + 2 + 1 + slop
- */
-static void CopyAndAdvance(char **destPtr, char **srcPtr, int n);
-
-int FCGX_VFPrintF(FCGX_Stream *stream, const char *format, va_list arg)
-{
- char *f, *fStop, *percentPtr, *p, *fmtBuffPtr, *buffPtr;
- int op, performedOp, sizeModifier, buffCount = 0, buffLen, specifierLength;
- int fastPath, n, auxBuffLen = 0, buffReqd, minWidth, precision, exp;
- char *auxBuffPtr = NULL;
- int streamCount = 0;
- char fmtBuff[FMT_BUFFLEN];
- char buff[PRINTF_BUFFLEN];
-
- int intArg;
- short shortArg;
- long longArg;
- unsigned unsignedArg;
- unsigned long uLongArg;
- unsigned short uShortArg;
- char *charPtrArg = NULL;
- void *voidPtrArg;
- int *intPtrArg;
- long *longPtrArg;
- short *shortPtrArg;
- double doubleArg = 0.0;
- LONG_DOUBLE lDoubleArg = 0.0L;
-
- fmtBuff[0] = '%';
- f = (char *) format;
- fStop = f + strlen(f);
- while (f != fStop) {
- percentPtr = (char *)memchr(f, '%', fStop - f);
- if(percentPtr == NULL) percentPtr = fStop;
- if(percentPtr != f) {
- if(FCGX_PutStr(f, percentPtr - f, stream) < 0)
- goto ErrorReturn;
- streamCount += percentPtr - f;
- f = percentPtr;
- if(f == fStop) break;
- }
- fastPath = TRUE;
- /*
- * The following loop always executes either once or twice.
- */
- for (;;) {
- if(fastPath) {
- /*
- * Fast path: Scan optimistically, hoping that no flags,
- * minimum field width, or precision are specified.
- * Use the preallocated buffer, which is large enough
- * for all fast path cases. If the conversion specifier
- * is really more complex, run the loop a second time
- * using the slow path.
- * Note that fast path execution of %s bypasses the buffer
- * and %f is not attempted on the fast path due to
- * its large buffering requirements.
- */
- op = *(percentPtr + 1);
- switch(op) {
- case 'l':
- case 'L':
- case 'h':
- sizeModifier = op;
- op = *(percentPtr + 2);
- fmtBuff[1] = (char) sizeModifier;
- fmtBuff[2] = (char) op;
- fmtBuff[3] = '\0';
- specifierLength = 3;
- break;
- default:
- sizeModifier = ' ';
- fmtBuff[1] = (char) op;
- fmtBuff[2] = '\0';
- specifierLength = 2;
- break;
- }
- buffPtr = buff;
- buffLen = PRINTF_BUFFLEN;
- } else {
- /*
- * Slow path: Scan the conversion specifier and construct
- * a new format string, compute an upper bound on the
- * amount of buffering that sprintf will require,
- * and allocate a larger buffer if necessary.
- */
- p = percentPtr + 1;
- fmtBuffPtr = &fmtBuff[1];
- /*
- * Scan flags
- */
- n = strspn(p, "-0+ #");
- if(n > 5)
- goto ErrorReturn;
- CopyAndAdvance(&fmtBuffPtr, &p, n);
- /*
- * Scan minimum field width
- */
- n = strspn(p, "0123456789");
- if(n == 0) {
- if(*p == '*') {
- minWidth = va_arg(arg, int);
- if(abs(minWidth) > 999999)
- goto ErrorReturn;
- /*
- * The following use of strlen rather than the
- * value returned from sprintf is because SUNOS4
- * returns a char * instead of an int count.
- */
- sprintf(fmtBuffPtr, "%d", minWidth);
- fmtBuffPtr += strlen(fmtBuffPtr);
- p++;
- } else {
- minWidth = 0;
- }
- } else if(n <= 6) {
- minWidth = strtol(p, NULL, 10);
- CopyAndAdvance(&fmtBuffPtr, &p, n);
- } else {
- goto ErrorReturn;
- }
- /*
- * Scan precision
- */
- if(*p == '.') {
- CopyAndAdvance(&fmtBuffPtr, &p, 1);
- n = strspn(p, "0123456789");
- if(n == 0) {
- if(*p == '*') {
- precision = va_arg(arg, int);
- if(precision < 0) precision = 0;
- if(precision > 999999)
- goto ErrorReturn;
- /*
- * The following use of strlen rather than the
- * value returned from sprintf is because SUNOS4
- * returns a char * instead of an int count.
- */
- sprintf(fmtBuffPtr, "%d", precision);
- fmtBuffPtr += strlen(fmtBuffPtr);
- p++;
- } else {
- precision = 0;
- }
- } else if(n <= 6) {
- precision = strtol(p, NULL, 10);
- CopyAndAdvance(&fmtBuffPtr, &p, n);
- } else {
- goto ErrorReturn;
- }
- } else {
- precision = -1;
- }
- /*
- * Scan size modifier and conversion operation
- */
- switch(*p) {
- case 'l':
- case 'L':
- case 'h':
- sizeModifier = *p;
- CopyAndAdvance(&fmtBuffPtr, &p, 1);
- break;
- default:
- sizeModifier = ' ';
- break;
- }
- op = *p;
- CopyAndAdvance(&fmtBuffPtr, &p, 1);
- ASSERT(fmtBuffPtr - fmtBuff < FMT_BUFFLEN);
- *fmtBuffPtr = '\0';
- specifierLength = p - percentPtr;
- /*
- * Bound the required buffer size. For s and f
- * conversions this requires examining the argument.
- */
- switch(op) {
- case 'd':
- case 'i':
- case 'u':
- case 'o':
- case 'x':
- case 'X':
- case 'c':
- case 'p':
- buffReqd = max(precision, 46);
- break;
- case 's':
- charPtrArg = va_arg(arg, char *);
- if (!charPtrArg) charPtrArg = "(null)";
- if(precision == -1) {
- buffReqd = strlen(charPtrArg);
- } else {
- p = (char *)memchr(charPtrArg, '\0', precision);
- buffReqd =
- (p == NULL) ? precision : p - charPtrArg;
- }
- break;
- case 'f':
- switch(sizeModifier) {
- case ' ':
- doubleArg = va_arg(arg, double);
- frexp(doubleArg, &exp);
- break;
- case 'L':
- lDoubleArg = va_arg(arg, LONG_DOUBLE);
- /* XXX Need to check for the presence of
- * frexpl() and use it if available */
- frexp((double) lDoubleArg, &exp);
- break;
- default:
- goto ErrorReturn;
- }
- if(precision == -1) precision = 6;
- buffReqd = precision + 3 + ((exp > 0) ? exp/3 : 0);
- break;
- case 'e':
- case 'E':
- case 'g':
- case 'G':
- if(precision == -1) precision = 6;
- buffReqd = precision + 8;
- break;
- case 'n':
- case '%':
- default:
- goto ErrorReturn;
- break;
- }
- buffReqd = max(buffReqd + 10, minWidth);
- /*
- * Allocate the buffer
- */
- if(buffReqd <= PRINTF_BUFFLEN) {
- buffPtr = buff;
- buffLen = PRINTF_BUFFLEN;
- } else {
- if(auxBuffPtr == NULL || buffReqd > auxBuffLen) {
- if(auxBuffPtr != NULL) free(auxBuffPtr);
- auxBuffPtr = (char *)Malloc(buffReqd);
- auxBuffLen = buffReqd;
- if(auxBuffPtr == NULL)
- goto ErrorReturn;
- }
- buffPtr = auxBuffPtr;
- buffLen = auxBuffLen;
- }
- }
- /*
- * This giant switch statement requires the following variables
- * to be set up: op, sizeModifier, arg, buffPtr, fmtBuff.
- * When fastPath == FALSE and op == 's' or 'f', the argument
- * has been read into charPtrArg, doubleArg, or lDoubleArg.
- * The statement produces the boolean performedOp, TRUE iff
- * the op/sizeModifier were executed and argument consumed;
- * if performedOp, the characters written into buffPtr[]
- * and the character count buffCount (== EOF meaning error).
- *
- * The switch cases are arranged in the same order as in the
- * description of fprintf in section 15.11 of Harbison and Steele.
- */
- performedOp = TRUE;
- switch(op) {
- case 'd':
- case 'i':
- switch(sizeModifier) {
- case ' ':
- intArg = va_arg(arg, int);
- sprintf(buffPtr, fmtBuff, intArg);
- buffCount = strlen(buffPtr);
- break;
- case 'l':
- longArg = va_arg(arg, long);
- sprintf(buffPtr, fmtBuff, longArg);
- buffCount = strlen(buffPtr);
- break;
- case 'h':
- shortArg = (short) va_arg(arg, int);
- sprintf(buffPtr, fmtBuff, shortArg);
- buffCount = strlen(buffPtr);
- break;
- default:
- goto ErrorReturn;
- }
- break;
- case 'u':
- case 'o':
- case 'x':
- case 'X':
- switch(sizeModifier) {
- case ' ':
- unsignedArg = va_arg(arg, unsigned);
- sprintf(buffPtr, fmtBuff, unsignedArg);
- buffCount = strlen(buffPtr);
- break;
- case 'l':
- uLongArg = va_arg(arg, unsigned long);
- sprintf(buffPtr, fmtBuff, uLongArg);
- buffCount = strlen(buffPtr);
- break;
- case 'h':
- uShortArg = (unsigned short) va_arg(arg, int);
- sprintf(buffPtr, fmtBuff, uShortArg);
- buffCount = strlen(buffPtr);
- break;
- default:
- goto ErrorReturn;
- }
- break;
- case 'c':
- switch(sizeModifier) {
- case ' ':
- intArg = va_arg(arg, int);
- sprintf(buffPtr, fmtBuff, intArg);
- buffCount = strlen(buffPtr);
- break;
- case 'l':
- /*
- * XXX: Allowed by ISO C Amendment 1, but
- * many platforms don't yet support wint_t
- */
- goto ErrorReturn;
- default:
- goto ErrorReturn;
- }
- break;
- case 's':
- switch(sizeModifier) {
- case ' ':
- if(fastPath) {
- buffPtr = va_arg(arg, char *);
- buffCount = strlen(buffPtr);
- buffLen = buffCount + 1;
- } else {
- sprintf(buffPtr, fmtBuff, charPtrArg);
- buffCount = strlen(buffPtr);
- }
- break;
- case 'l':
- /*
- * XXX: Don't know how to convert a sequence
- * of wide characters into a byte stream, or
- * even how to predict the buffering required.
- */
- goto ErrorReturn;
- default:
- goto ErrorReturn;
- }
- break;
- case 'p':
- if(sizeModifier != ' ')
- goto ErrorReturn;
- voidPtrArg = va_arg(arg, void *);
- sprintf(buffPtr, fmtBuff, voidPtrArg);
- buffCount = strlen(buffPtr);
- break;
- case 'n':
- switch(sizeModifier) {
- case ' ':
- intPtrArg = va_arg(arg, int *);
- *intPtrArg = streamCount;
- break;
- case 'l':
- longPtrArg = va_arg(arg, long *);
- *longPtrArg = streamCount;
- break;
- case 'h':
- shortPtrArg = (short *) va_arg(arg, short *);
- *shortPtrArg = (short) streamCount;
- break;
- default:
- goto ErrorReturn;
- }
- buffCount = 0;
- break;
- case 'f':
- if(fastPath) {
- performedOp = FALSE;
- break;
- }
- switch(sizeModifier) {
- case ' ':
- sprintf(buffPtr, fmtBuff, doubleArg);
- buffCount = strlen(buffPtr);
- break;
- case 'L':
- sprintf(buffPtr, fmtBuff, lDoubleArg);
- buffCount = strlen(buffPtr);
- break;
- default:
- goto ErrorReturn;
- }
- break;
- case 'e':
- case 'E':
- case 'g':
- case 'G':
- switch(sizeModifier) {
- case ' ':
- doubleArg = va_arg(arg, double);
- sprintf(buffPtr, fmtBuff, doubleArg);
- buffCount = strlen(buffPtr);
- break;
- case 'L':
- lDoubleArg = va_arg(arg, LONG_DOUBLE);
- sprintf(buffPtr, fmtBuff, lDoubleArg);
- buffCount = strlen(buffPtr);
- break;
- default:
- goto ErrorReturn;
- }
- break;
- case '%':
- if(sizeModifier != ' ')
- goto ErrorReturn;
- buff[0] = '%';
- buffCount = 1;
- break;
- case '\0':
- goto ErrorReturn;
- default:
- performedOp = FALSE;
- break;
- } /* switch(op) */
- if(performedOp) break;
- if(!fastPath)
- goto ErrorReturn;
- fastPath = FALSE;
- } /* for (;;) */
- ASSERT(buffCount < buffLen);
- if(buffCount > 0) {
- if(FCGX_PutStr(buffPtr, buffCount, stream) < 0)
- goto ErrorReturn;
- streamCount += buffCount;
- } else if(buffCount < 0) {
- goto ErrorReturn;
- }
- f += specifierLength;
- } /* while(f != fStop) */
- goto NormalReturn;
- ErrorReturn:
- streamCount = -1;
- NormalReturn:
- if(auxBuffPtr != NULL) free(auxBuffPtr);
- return streamCount;
-}
-
-/*
- * Copy n characters from *srcPtr to *destPtr, then increment
- * both *srcPtr and *destPtr by n.
- */
-static void CopyAndAdvance(char **destPtr, char **srcPtr, int n)
-{
- char *dest = *destPtr;
- char *src = *srcPtr;
- int i;
- for (i = 0; i < n; i++)
- *dest++ = *src++;
- *destPtr = dest;
- *srcPtr = src;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_FFlush --
- *
- * Flushes any buffered output.
- *
- * Server-push is a legitimate application of FCGX_FFlush.
- * Otherwise, FCGX_FFlush is not very useful, since FCGX_Accept
- * does it implicitly. FCGX_FFlush may reduce performance
- * by increasing the total number of operating system calls
- * the application makes.
- *
- * Results:
- * EOF (-1) if an error occurred.
- *
- *----------------------------------------------------------------------
- */
-int FCGX_FFlush(FCGX_Stream *stream)
-{
- if(!stream || stream->isClosed || stream->isReader)
- return 0;
- stream->emptyBuffProc(stream, FALSE);
- return (stream->isClosed) ? -1 : 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_FClose --
- *
- * Performs FCGX_FFlush and closes the stream.
- *
- * This is not a very useful operation, since FCGX_Accept
- * does it implicitly. Closing the out stream before the
- * err stream results in an extra write if there's nothing
- * in the err stream, and therefore reduces performance.
- *
- * Results:
- * EOF (-1) if an error occurred.
- *
- *----------------------------------------------------------------------
- */
-int FCGX_FClose(FCGX_Stream *stream)
-{
- if (stream == NULL) return 0;
-
- if(!stream->wasFCloseCalled) {
- if(!stream->isReader) {
- stream->emptyBuffProc(stream, TRUE);
- }
- stream->wasFCloseCalled = TRUE;
- stream->isClosed = TRUE;
- if(stream->isReader) {
- stream->wrNext = stream->stop = stream->rdNext;
- } else {
- stream->rdNext = stream->stop = stream->wrNext;
- }
- }
- return (stream->FCGI_errno == 0) ? 0 : EOF;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * SetError --
- *
- * An error has occurred; save the error code in the stream
- * for diagnostic purposes and set the stream state so that
- * reads return EOF and writes have no effect.
- *
- *----------------------------------------------------------------------
- */
-static void SetError(FCGX_Stream *stream, int FCGI_errno)
-{
- /*
- * Preserve only the first error.
- */
- if(stream->FCGI_errno == 0) {
- stream->FCGI_errno = FCGI_errno;
- stream->isClosed = TRUE;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_GetError --
- *
- * Return the stream error code. 0 means no error, > 0
- * is an errno(2) error, < 0 is an FCGX_errno error.
- *
- *----------------------------------------------------------------------
- */
-int FCGX_GetError(FCGX_Stream *stream) {
- return stream->FCGI_errno;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_ClearError --
- *
- * Clear the stream error code and end-of-file indication.
- *
- *----------------------------------------------------------------------
- */
-void FCGX_ClearError(FCGX_Stream *stream) {
- stream->FCGI_errno = 0;
- /*
- * stream->isClosed = FALSE;
- * XXX: should clear isClosed but work is needed to make it safe
- * to do so. For example, if an application calls FClose, gets
- * an I/O error on the write, calls ClearError and retries
- * the FClose, FClose (really EmptyBuffProc) will write a second
- * EOF record. If an application calls PutChar instead of FClose
- * after the ClearError, the application will write more data.
- * The stream's state must discriminate between various states
- * of the stream that are now all lumped under isClosed.
- */
-}
-
-
-
-/*
- *----------------------------------------------------------------------
- *
- * NewParams --
- *
- * Creates a new Params structure.
- *
- * Results:
- * Pointer to the new structure.
- *
- *----------------------------------------------------------------------
- */
-static ParamsPtr NewParams(int length)
-{
- ParamsPtr result;
- result = (Params *)Malloc(sizeof(Params));
- result->vec = (char **)Malloc(length * sizeof(char *));
- result->length = length;
- result->cur = result->vec;
- *result->cur = NULL;
- return result;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FreeParams --
- *
- * Frees a Params structure and all the parameters it contains.
- *
- * Side effects:
- * env becomes invalid.
- *
- *----------------------------------------------------------------------
- */
-static void FreeParams(ParamsPtr *paramsPtrPtr)
-{
- ParamsPtr paramsPtr = *paramsPtrPtr;
- char **p;
- if(paramsPtr == NULL) {
- return;
- }
- for (p = paramsPtr->vec; p < paramsPtr->cur; p++) {
- free(*p);
- }
- free(paramsPtr->vec);
- free(paramsPtr);
- *paramsPtrPtr = NULL;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * PutParam --
- *
- * Add a name/value pair to a Params structure.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Parameters structure updated.
- *
- *----------------------------------------------------------------------
- */
-static void PutParam(ParamsPtr paramsPtr, char *nameValue)
-{
- int size;
-
- *paramsPtr->cur++ = nameValue;
- size = paramsPtr->cur - paramsPtr->vec;
- if(size >= paramsPtr->length) {
- paramsPtr->length *= 2;
- paramsPtr->vec = (FCGX_ParamArray)realloc(paramsPtr->vec, paramsPtr->length * sizeof(char *));
- paramsPtr->cur = paramsPtr->vec + size;
- }
- *paramsPtr->cur = NULL;
-}
-
-
-void FCGX_PutEnv(FCGX_Request *request, char *var)
-{
- char *nameValue;
- char *e, **p;
- int len;
-
- if (!strchr(var,'=')) {
- return;
- }
- nameValue = StringCopy(var);
- e = strchr(nameValue,'=');
- *e = 0;
-
- /* find the name and replace it */
- len = strlen(nameValue);
-
- for (p = request->envp; p && *p; ++p) {
- if((strncmp(nameValue, *p, len) == 0) && ((*p)[len] == '=')) {
- free(*p);
- *e = '=';
- *p = nameValue;
- return;
- }
- }
- *e = '=';
- /* this is a new var, add it to the environment */
- PutParam(request->paramsPtr,nameValue);
- request->envp = request->paramsPtr->vec;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_GetParam -- obtain value of FCGI parameter in environment
- *
- *
- * Results:
- * Value bound to name, NULL if name not present in the
- * environment envp. Caller must not mutate the result
- * or retain it past the end of this request.
- *
- *----------------------------------------------------------------------
- */
-char *FCGX_GetParam(const char *name, FCGX_ParamArray envp)
-{
- int len;
- char **p;
-
- if (name == NULL || envp == NULL) return NULL;
-
- len = strlen(name);
-
- for (p = envp; p && *p; ++p) {
- if((strncmp(name, *p, len) == 0) && ((*p)[len] == '=')) {
- return *p+len+1;
- }
- }
- return NULL;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Start of FastCGI-specific code
- *
- *----------------------------------------------------------------------
- */
-
-/*
- *----------------------------------------------------------------------
- *
- * ReadParams --
- *
- * Reads FastCGI name-value pairs from stream until EOF. Converts
- * each pair to name=value format and adds it to Params structure.
- *
- *----------------------------------------------------------------------
- */
-static int ReadParams(Params *paramsPtr, FCGX_Stream *stream)
-{
- int nameLen, valueLen;
- unsigned char lenBuff[3];
- char *nameValue;
-
- while((nameLen = FCGX_GetChar(stream)) != EOF) {
- /*
- * Read name length (one or four bytes) and value length
- * (one or four bytes) from stream.
- */
- if((nameLen & 0x80) != 0) {
- if(FCGX_GetStr((char *) &lenBuff[0], 3, stream) != 3) {
- SetError(stream, FCGX_PARAMS_ERROR);
- return -1;
- }
- nameLen = ((nameLen & 0x7f) << 24) + (lenBuff[0] << 16)
- + (lenBuff[1] << 8) + lenBuff[2];
- }
- if((valueLen = FCGX_GetChar(stream)) == EOF) {
- SetError(stream, FCGX_PARAMS_ERROR);
- return -1;
- }
- if((valueLen & 0x80) != 0) {
- if(FCGX_GetStr((char *) &lenBuff[0], 3, stream) != 3) {
- SetError(stream, FCGX_PARAMS_ERROR);
- return -1;
- }
- valueLen = ((valueLen & 0x7f) << 24) + (lenBuff[0] << 16)
- + (lenBuff[1] << 8) + lenBuff[2];
- }
- /*
- * nameLen and valueLen are now valid; read the name and value
- * from stream and construct a standard environment entry.
- */
- nameValue = (char *)Malloc(nameLen + valueLen + 2);
- if(FCGX_GetStr(nameValue, nameLen, stream) != nameLen) {
- SetError(stream, FCGX_PARAMS_ERROR);
- free(nameValue);
- return -1;
- }
- *(nameValue + nameLen) = '=';
- if(FCGX_GetStr(nameValue + nameLen + 1, valueLen, stream)
- != valueLen) {
- SetError(stream, FCGX_PARAMS_ERROR);
- free(nameValue);
- return -1;
- }
- *(nameValue + nameLen + valueLen + 1) = '\0';
- PutParam(paramsPtr, nameValue);
- }
- return 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * MakeHeader --
- *
- * Constructs an FCGI_Header struct.
- *
- *----------------------------------------------------------------------
- */
-static FCGI_Header MakeHeader(
- int type,
- int requestId,
- int contentLength,
- int paddingLength)
-{
- FCGI_Header header;
- ASSERT(contentLength >= 0 && contentLength <= FCGI_MAX_LENGTH);
- ASSERT(paddingLength >= 0 && paddingLength <= 0xff);
- header.version = FCGI_VERSION_1;
- header.type = (unsigned char) type;
- header.requestIdB1 = (unsigned char) ((requestId >> 8) & 0xff);
- header.requestIdB0 = (unsigned char) ((requestId ) & 0xff);
- header.contentLengthB1 = (unsigned char) ((contentLength >> 8) & 0xff);
- header.contentLengthB0 = (unsigned char) ((contentLength ) & 0xff);
- header.paddingLength = (unsigned char) paddingLength;
- header.reserved = 0;
- return header;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * MakeEndRequestBody --
- *
- * Constructs an FCGI_EndRequestBody struct.
- *
- *----------------------------------------------------------------------
- */
-static FCGI_EndRequestBody MakeEndRequestBody(
- int appStatus,
- int protocolStatus)
-{
- FCGI_EndRequestBody body;
- body.appStatusB3 = (unsigned char) ((appStatus >> 24) & 0xff);
- body.appStatusB2 = (unsigned char) ((appStatus >> 16) & 0xff);
- body.appStatusB1 = (unsigned char) ((appStatus >> 8) & 0xff);
- body.appStatusB0 = (unsigned char) ((appStatus ) & 0xff);
- body.protocolStatus = (unsigned char) protocolStatus;
- memset(body.reserved, 0, sizeof(body.reserved));
- return body;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * MakeUnknownTypeBody --
- *
- * Constructs an FCGI_MakeUnknownTypeBody struct.
- *
- *----------------------------------------------------------------------
- */
-static FCGI_UnknownTypeBody MakeUnknownTypeBody(
- int type)
-{
- FCGI_UnknownTypeBody body;
- body.type = (unsigned char) type;
- memset(body.reserved, 0, sizeof(body.reserved));
- return body;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * AlignInt8 --
- *
- * Returns the smallest integer greater than or equal to n
- * that's a multiple of 8.
- *
- *----------------------------------------------------------------------
- */
-static int AlignInt8(unsigned n) {
- return (n + 7) & (UINT_MAX - 7);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * AlignPtr8 --
- *
- * Returns the smallest pointer greater than or equal to p
- * that's a multiple of 8.
- *
- *----------------------------------------------------------------------
- */
-static unsigned char *AlignPtr8(unsigned char *p) {
- unsigned long u = (unsigned long) p;
- u = ((u + 7) & (ULONG_MAX - 7)) - u;
- return p + u;
-}
-
-
-/*
- * State associated with a stream
- */
-typedef struct FCGX_Stream_Data {
- unsigned char *buff; /* buffer after alignment */
- int bufflen; /* number of bytes buff can store */
- unsigned char *mBuff; /* buffer as returned by Malloc */
- unsigned char *buffStop; /* reader: last valid byte + 1 of entire buffer.
- * stop generally differs from buffStop for
- * readers because of record structure.
- * writer: buff + bufflen */
- int type; /* reader: FCGI_PARAMS or FCGI_STDIN
- * writer: FCGI_STDOUT or FCGI_STDERR */
- int eorStop; /* reader: stop stream at end-of-record */
- int skip; /* reader: don't deliver content bytes */
- int contentLen; /* reader: bytes of unread content */
- int paddingLen; /* reader: bytes of unread padding */
- int isAnythingWritten; /* writer: data has been written to ipcFd */
- int rawWrite; /* writer: write data without stream headers */
- FCGX_Request *reqDataPtr; /* request data not specific to one stream */
-} FCGX_Stream_Data;
-
-/*
- *----------------------------------------------------------------------
- *
- * WriteCloseRecords --
- *
- * Writes an EOF record for the stream content if necessary.
- * If this is the last writer to close, writes an FCGI_END_REQUEST
- * record.
- *
- *----------------------------------------------------------------------
- */
-static void WriteCloseRecords(struct FCGX_Stream *stream)
-{
- FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data;
- /*
- * Enter rawWrite mode so final records won't be encapsulated as
- * stream data.
- */
- data->rawWrite = TRUE;
- /*
- * Generate EOF for stream content if needed.
- */
- if(!(data->type == FCGI_STDERR
- && stream->wrNext == data->buff
- && !data->isAnythingWritten)) {
- FCGI_Header header;
- header = MakeHeader(data->type, data->reqDataPtr->requestId, 0, 0);
- FCGX_PutStr((char *) &header, sizeof(header), stream);
- };
- /*
- * Generate FCGI_END_REQUEST record if needed.
- */
- if(data->reqDataPtr->nWriters == 1) {
- FCGI_EndRequestRecord endRequestRecord;
- endRequestRecord.header = MakeHeader(FCGI_END_REQUEST,
- data->reqDataPtr->requestId,
- sizeof(endRequestRecord.body), 0);
- endRequestRecord.body = MakeEndRequestBody(
- data->reqDataPtr->appStatus, FCGI_REQUEST_COMPLETE);
- FCGX_PutStr((char *) &endRequestRecord,
- sizeof(endRequestRecord), stream);
- }
- data->reqDataPtr->nWriters--;
-}
-
-
-
-static int write_it_all(int fd, char *buf, int len)
-{
- int wrote;
-
- while (len) {
- wrote = OS_Write(fd, buf, len);
- if (wrote < 0)
- return wrote;
- len -= wrote;
- buf += wrote;
- }
- return len;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * EmptyBuffProc --
- *
- * Encapsulates any buffered stream content in a FastCGI
- * record. Writes the data, making the buffer empty.
- *
- *----------------------------------------------------------------------
- */
-static void EmptyBuffProc(struct FCGX_Stream *stream, int doClose)
-{
- FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data;
- int cLen, eLen;
- /*
- * If the buffer contains stream data, fill in the header.
- * Pad the record to a multiple of 8 bytes in length. Padding
- * can't overflow the buffer because the buffer is a multiple
- * of 8 bytes in length. If the buffer contains no stream
- * data, reclaim the space reserved for the header.
- */
- if(!data->rawWrite) {
- cLen = stream->wrNext - data->buff - sizeof(FCGI_Header);
- if(cLen > 0) {
- eLen = AlignInt8(cLen);
- /*
- * Giving the padding a well-defined value keeps Purify happy.
- */
- memset(stream->wrNext, 0, eLen - cLen);
- stream->wrNext += eLen - cLen;
- *((FCGI_Header *) data->buff)
- = MakeHeader(data->type,
- data->reqDataPtr->requestId, cLen, eLen - cLen);
- } else {
- stream->wrNext = data->buff;
- }
- }
- if(doClose) {
- WriteCloseRecords(stream);
- };
- if (stream->wrNext != data->buff) {
- data->isAnythingWritten = TRUE;
- if (write_it_all(data->reqDataPtr->ipcFd, (char *)data->buff, stream->wrNext - data->buff) < 0) {
- SetError(stream, OS_Errno);
- return;
- }
- stream->wrNext = data->buff;
- }
- /*
- * The buffer is empty.
- */
- if(!data->rawWrite) {
- stream->wrNext += sizeof(FCGI_Header);
- }
-}
-
-/*
- * Return codes for Process* functions
- */
-#define STREAM_RECORD 0
-#define SKIP 1
-#define BEGIN_RECORD 2
-#define MGMT_RECORD 3
-
-/*
- *----------------------------------------------------------------------
- *
- * ProcessManagementRecord --
- *
- * Reads and responds to a management record. The only type of
- * management record this library understands is FCGI_GET_VALUES.
- * The only variables that this library's FCGI_GET_VALUES
- * understands are FCGI_MAX_CONNS, FCGI_MAX_REQS, and FCGI_MPXS_CONNS.
- * Ignore other FCGI_GET_VALUES variables; respond to other
- * management records with a FCGI_UNKNOWN_TYPE record.
- *
- *----------------------------------------------------------------------
- */
-static int ProcessManagementRecord(int type, FCGX_Stream *stream)
-{
- FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data;
- ParamsPtr paramsPtr = NewParams(3);
- char **pPtr;
- char response[64]; /* 64 = 8 + 3*(1+1+14+1)* + padding */
- char *responseP = &response[FCGI_HEADER_LEN];
- char *name, value = '\0';
- int len, paddedLen;
- if(type == FCGI_GET_VALUES) {
- ReadParams(paramsPtr, stream);
- if((FCGX_GetError(stream) != 0) || (data->contentLen != 0)) {
- FreeParams(&paramsPtr);
- return FCGX_PROTOCOL_ERROR;
- }
- for (pPtr = paramsPtr->vec; pPtr < paramsPtr->cur; pPtr++) {
- name = *pPtr;
- *(strchr(name, '=')) = '\0';
- if(strcmp(name, FCGI_MAX_CONNS) == 0) {
- value = '1';
- } else if(strcmp(name, FCGI_MAX_REQS) == 0) {
- value = '1';
- } else if(strcmp(name, FCGI_MPXS_CONNS) == 0) {
- value = '0';
- } else {
- name = NULL;
- }
- if(name != NULL) {
- len = strlen(name);
- sprintf(responseP, "%c%c%s%c", len, 1, name, value);
- responseP += len + 3;
- }
- }
- len = responseP - &response[FCGI_HEADER_LEN];
- paddedLen = AlignInt8(len);
- *((FCGI_Header *) response)
- = MakeHeader(FCGI_GET_VALUES_RESULT, FCGI_NULL_REQUEST_ID,
- len, paddedLen - len);
- FreeParams(&paramsPtr);
- } else {
- paddedLen = len = sizeof(FCGI_UnknownTypeBody);
- ((FCGI_UnknownTypeRecord *) response)->header
- = MakeHeader(FCGI_UNKNOWN_TYPE, FCGI_NULL_REQUEST_ID,
- len, 0);
- ((FCGI_UnknownTypeRecord *) response)->body
- = MakeUnknownTypeBody(type);
- }
- if (write_it_all(data->reqDataPtr->ipcFd, response, FCGI_HEADER_LEN + paddedLen) < 0) {
- SetError(stream, OS_Errno);
- return -1;
- }
-
- return MGMT_RECORD;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * ProcessBeginRecord --
- *
- * Reads an FCGI_BEGIN_REQUEST record.
- *
- * Results:
- * BEGIN_RECORD for normal return. FCGX_PROTOCOL_ERROR for
- * protocol error. SKIP for attempt to multiplex
- * connection. -1 for error from write (errno in stream).
- *
- * Side effects:
- * In case of BEGIN_RECORD return, stores requestId, role,
- * keepConnection values, and sets isBeginProcessed = TRUE.
- *
- *----------------------------------------------------------------------
- */
-static int ProcessBeginRecord(int requestId, FCGX_Stream *stream)
-{
- FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data;
- FCGI_BeginRequestBody body;
- if(requestId == 0 || data->contentLen != sizeof(body)) {
- return FCGX_PROTOCOL_ERROR;
- }
- if(data->reqDataPtr->isBeginProcessed) {
- /*
- * The Web server is multiplexing the connection. This library
- * doesn't know how to handle multiplexing, so respond with
- * FCGI_END_REQUEST{protocolStatus = FCGI_CANT_MPX_CONN}
- */
- FCGI_EndRequestRecord endRequestRecord;
- endRequestRecord.header = MakeHeader(FCGI_END_REQUEST,
- requestId, sizeof(endRequestRecord.body), 0);
- endRequestRecord.body
- = MakeEndRequestBody(0, FCGI_CANT_MPX_CONN);
- if (write_it_all(data->reqDataPtr->ipcFd, (char *)&endRequestRecord, sizeof(endRequestRecord)) < 0) {
- SetError(stream, OS_Errno);
- return -1;
- }
-
- return SKIP;
- }
- /*
- * Accept this new request. Read the record body.
- */
- data->reqDataPtr->requestId = requestId;
- if(FCGX_GetStr((char *) &body, sizeof(body), stream)
- != sizeof(body)) {
- return FCGX_PROTOCOL_ERROR;
- }
- data->reqDataPtr->keepConnection = (body.flags & FCGI_KEEP_CONN);
- data->reqDataPtr->role = (body.roleB1 << 8) + body.roleB0;
- data->reqDataPtr->isBeginProcessed = TRUE;
- return BEGIN_RECORD;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * ProcessHeader --
- *
- * Interprets FCGI_Header. Processes FCGI_BEGIN_REQUEST and
- * management records here; extracts information from stream
- * records (FCGI_PARAMS, FCGI_STDIN) into stream.
- *
- * Results:
- * >= 0 for a normal return, < 0 for error
- *
- * Side effects:
- * XXX: Many (more than there used to be).
- * If !stream->isRequestIdSet, ProcessHeader initializes
- * stream->requestId from header and sets stream->isRequestIdSet
- * to TRUE. ProcessHeader also sets stream->contentLen to header's
- * contentLength, and sets stream->paddingLen to the header's
- * paddingLength.
- *
- *----------------------------------------------------------------------
- */
-static int ProcessHeader(FCGI_Header header, FCGX_Stream *stream)
-{
- FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data;
- int requestId;
- if(header.version != FCGI_VERSION_1) {
- return FCGX_UNSUPPORTED_VERSION;
- }
- requestId = (header.requestIdB1 << 8)
- + header.requestIdB0;
- data->contentLen = (header.contentLengthB1 << 8)
- + header.contentLengthB0;
- data->paddingLen = header.paddingLength;
- if(header.type == FCGI_BEGIN_REQUEST) {
- return ProcessBeginRecord(requestId, stream);
- }
- if(requestId == FCGI_NULL_REQUEST_ID) {
- return ProcessManagementRecord(header.type, stream);
- }
- if(requestId != data->reqDataPtr->requestId) {
- return SKIP;
- }
- if(header.type != data->type) {
- return FCGX_PROTOCOL_ERROR;
- }
- return STREAM_RECORD;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FillBuffProc --
- *
- * Reads bytes from the ipcFd, supplies bytes to a stream client.
- *
- *----------------------------------------------------------------------
- */
-static void FillBuffProc(FCGX_Stream *stream)
-{
- FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data;
- FCGI_Header header;
- int headerLen = 0;
- int status, count;
-
- for (;;) {
- /*
- * If data->buff is empty, do a read.
- */
- if(stream->rdNext == data->buffStop) {
- count = OS_Read(data->reqDataPtr->ipcFd, (char *)data->buff,
- data->bufflen);
- if(count <= 0) {
- SetError(stream, (count == 0 ? FCGX_PROTOCOL_ERROR : OS_Errno));
- return;
- }
- stream->rdNext = data->buff;
- data->buffStop = data->buff + count;
- }
- /*
- * Now data->buff is not empty. If the current record contains
- * more content bytes, deliver all that are present in data->buff.
- */
- if(data->contentLen > 0) {
- count = min(data->contentLen, data->buffStop - stream->rdNext);
- data->contentLen -= count;
- if(!data->skip) {
- stream->wrNext = stream->stop = stream->rdNext + count;
- return;
- } else {
- stream->rdNext += count;
- if(data->contentLen > 0) {
- continue;
- } else {
- data->skip = FALSE;
- }
- }
- }
- /*
- * If the current record (whose content has been fully consumed by
- * the client) was padded, skip over the padding bytes.
- */
- if(data->paddingLen > 0) {
- count = min(data->paddingLen, data->buffStop - stream->rdNext);
- data->paddingLen -= count;
- stream->rdNext += count;
- if(data->paddingLen > 0) {
- continue;
- }
- }
- /*
- * All done with the current record, including the padding.
- * If we're in a recursive call from ProcessHeader, deliver EOF.
- */
- if(data->eorStop) {
- stream->stop = stream->rdNext;
- stream->isClosed = TRUE;
- return;
- }
- /*
- * Fill header with bytes from the input buffer.
- */
- count = min((int)sizeof(header) - headerLen,
- data->buffStop - stream->rdNext);
- memcpy(((char *)(&header)) + headerLen, stream->rdNext, count);
- headerLen += count;
- stream->rdNext += count;
- if(headerLen < sizeof(header)) {
- continue;
- };
- headerLen = 0;
- /*
- * Interpret header. eorStop prevents ProcessHeader from reading
- * past the end-of-record when using stream to read content.
- */
- data->eorStop = TRUE;
- stream->stop = stream->rdNext;
- status = ProcessHeader(header, stream);
- data->eorStop = FALSE;
- stream->isClosed = FALSE;
- switch(status) {
- case STREAM_RECORD:
- /*
- * If this stream record header marked the end of stream
- * data deliver EOF to the stream client, otherwise loop
- * and deliver data.
- *
- * XXX: If this is final stream and
- * stream->rdNext != data->buffStop, buffered
- * data is next request (server pipelining)?
- */
- if(data->contentLen == 0) {
- stream->wrNext = stream->stop = stream->rdNext;
- stream->isClosed = TRUE;
- return;
- }
- break;
- case SKIP:
- data->skip = TRUE;
- break;
- case BEGIN_RECORD:
- /*
- * If this header marked the beginning of a new
- * request, return role information to caller.
- */
- return;
- break;
- case MGMT_RECORD:
- break;
- default:
- ASSERT(status < 0);
- SetError(stream, status);
- return;
- break;
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * NewStream --
- *
- * Creates a stream to read or write from an open ipcFd.
- * The stream performs reads/writes of up to bufflen bytes.
- *
- *----------------------------------------------------------------------
- */
-static FCGX_Stream *NewStream(
- FCGX_Request *reqDataPtr, int bufflen, int isReader, int streamType)
-{
- /*
- * XXX: It would be a lot cleaner to have a NewStream that only
- * knows about the type FCGX_Stream, with all other
- * necessary data passed in. It appears that not just
- * data and the two procs are needed for initializing stream,
- * but also data->buff and data->buffStop. This has implications
- * for procs that want to swap buffers, too.
- */
- FCGX_Stream *stream = (FCGX_Stream *)Malloc(sizeof(FCGX_Stream));
- FCGX_Stream_Data *data = (FCGX_Stream_Data *)Malloc(sizeof(FCGX_Stream_Data));
- data->reqDataPtr = reqDataPtr;
- bufflen = AlignInt8(min(max(bufflen, 32), FCGI_MAX_LENGTH + 1));
- data->bufflen = bufflen;
- data->mBuff = (unsigned char *)Malloc(bufflen);
- data->buff = AlignPtr8(data->mBuff);
- if(data->buff != data->mBuff) {
- data->bufflen -= 8;
- }
- if(isReader) {
- data->buffStop = data->buff;
- } else {
- data->buffStop = data->buff + data->bufflen;
- }
- data->type = streamType;
- data->eorStop = FALSE;
- data->skip = FALSE;
- data->contentLen = 0;
- data->paddingLen = 0;
- data->isAnythingWritten = FALSE;
- data->rawWrite = FALSE;
-
- stream->data = data;
- stream->isReader = isReader;
- stream->isClosed = FALSE;
- stream->wasFCloseCalled = FALSE;
- stream->FCGI_errno = 0;
- if(isReader) {
- stream->fillBuffProc = FillBuffProc;
- stream->emptyBuffProc = NULL;
- stream->rdNext = data->buff;
- stream->stop = stream->rdNext;
- stream->stopUnget = data->buff;
- stream->wrNext = stream->stop;
- } else {
- stream->fillBuffProc = NULL;
- stream->emptyBuffProc = EmptyBuffProc;
- stream->wrNext = data->buff + sizeof(FCGI_Header);
- stream->stop = data->buffStop;
- stream->stopUnget = NULL;
- stream->rdNext = stream->stop;
- }
- return stream;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_FreeStream --
- *
- * Frees all storage allocated when *streamPtr was created,
- * and nulls out *streamPtr.
- *
- *----------------------------------------------------------------------
- */
-void FCGX_FreeStream(FCGX_Stream **streamPtr)
-{
- _FCGX_FreeStream(streamPtr, TRUE);
-}
-
-void _FCGX_FreeStream(FCGX_Stream **streamPtr, int freeData)
-{
- FCGX_Stream *stream = *streamPtr;
- FCGX_Stream_Data *data;
- if(stream == NULL) {
- return;
- }
- data = (FCGX_Stream_Data *)stream->data;
- if (freeData && data->reqDataPtr) free(data->reqDataPtr);
- data->reqDataPtr = NULL;
- free(data->mBuff);
- free(data);
- free(stream);
- *streamPtr = NULL;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * SetReaderType --
- *
- * Re-initializes the stream to read data of the specified type.
- *
- *----------------------------------------------------------------------
- */
-static FCGX_Stream *SetReaderType(FCGX_Stream *stream, int streamType)
-{
- FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data;
- ASSERT(stream->isReader);
- data->type = streamType;
- data->eorStop = FALSE;
- data->skip = FALSE;
- data->contentLen = 0;
- data->paddingLen = 0;
- stream->wrNext = stream->stop = stream->rdNext;
- stream->isClosed = FALSE;
- return stream;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * NewReader --
- *
- * Creates a stream to read streamType records for the given
- * request. The stream performs OS reads of up to bufflen bytes.
- *
- *----------------------------------------------------------------------
- */
-static FCGX_Stream *NewReader(FCGX_Request *reqDataPtr, int bufflen, int streamType)
-{
- return NewStream(reqDataPtr, bufflen, TRUE, streamType);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * NewWriter --
- *
- * Creates a stream to write streamType FastCGI records, using
- * the ipcFd and RequestId contained in *reqDataPtr.
- * The stream performs OS writes of up to bufflen bytes.
- *
- *----------------------------------------------------------------------
- */
-static FCGX_Stream *NewWriter(FCGX_Request *reqDataPtr, int bufflen, int streamType)
-{
- return NewStream(reqDataPtr, bufflen, FALSE, streamType);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_CreateWriter --
- *
- * Creates a stream to write streamType FastCGI records, using
- * the given ipcFd and request Id. This function is provided
- * for use by cgi-fcgi. In order to be defensive against misuse,
- * this function leaks a little storage; cgi-fcgi doesn't care.
- *
- *----------------------------------------------------------------------
- */
-FCGX_Stream *FCGX_CreateWriter(
- int ipcFd,
- int requestId,
- int bufflen,
- int streamType)
-{
- FCGX_Request *reqDataPtr = (FCGX_Request *)Malloc(sizeof(FCGX_Request));
- reqDataPtr->ipcFd = ipcFd;
- reqDataPtr->requestId = requestId;
- /*
- * Suppress writing an FCGI_END_REQUEST record.
- */
- reqDataPtr->nWriters = 2;
- return NewWriter(reqDataPtr, bufflen, streamType);
-}
-
-/*
- *======================================================================
- * Control
- *======================================================================
- */
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_IsCGI --
- *
- * This routine determines if the process is running as a CGI or
- * FastCGI process. The distinction is made by determining whether
- * FCGI_LISTENSOCK_FILENO is a listener ipcFd or the end of a
- * pipe (ie. standard in).
- *
- * Results:
- * TRUE if the process is a CGI process, FALSE if FastCGI.
- *
- *----------------------------------------------------------------------
- */
-int FCGX_IsCGI(void)
-{
- if (isFastCGI != -1) {
- return !isFastCGI;
- }
-
- if (!libInitialized) {
- int rc = FCGX_Init();
- if (rc) {
- /* exit() isn't great, but hey */
- /* exit((rc < 0) ? rc : -rc); */
- return 0;
- }
- }
-
- isFastCGI = OS_IsFcgi(FCGI_LISTENSOCK_FILENO);
-
- return !isFastCGI;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_Finish --
- *
- * Finishes the current request from the HTTP server.
- *
- * Side effects:
- *
- * Finishes the request accepted by (and frees any
- * storage allocated by) the previous call to FCGX_Accept.
- *
- * DO NOT retain pointers to the envp array or any strings
- * contained in it (e.g. to the result of calling FCGX_GetParam),
- * since these will be freed by the next call to FCGX_Finish
- * or FCGX_Accept.
- *
- *----------------------------------------------------------------------
- */
-
-void FCGX_Finish(void)
-{
- FCGX_Finish_r(&the_request);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_Finish_r --
- *
- * Finishes the current request from the HTTP server.
- *
- * Side effects:
- *
- * Finishes the request accepted by (and frees any
- * storage allocated by) the previous call to FCGX_Accept.
- *
- * DO NOT retain pointers to the envp array or any strings
- * contained in it (e.g. to the result of calling FCGX_GetParam),
- * since these will be freed by the next call to FCGX_Finish
- * or FCGX_Accept.
- *
- *----------------------------------------------------------------------
- */
-void FCGX_Finish_r(FCGX_Request *reqDataPtr)
-{
- int close;
-
- if (reqDataPtr == NULL) {
- return;
- }
-
- close = !reqDataPtr->keepConnection;
-
- /* This should probably use a 'status' member instead of 'in' */
- if (reqDataPtr->in) {
- close |= FCGX_FClose(reqDataPtr->err);
- close |= FCGX_FClose(reqDataPtr->out);
-
- close |= FCGX_GetError(reqDataPtr->in);
- }
-
- FCGX_Free(reqDataPtr, close);
-}
-
-void FCGX_Free(FCGX_Request * request, int close)
-{
- if (request == NULL)
- return;
-
- _FCGX_FreeStream(&request->in, FALSE);
- _FCGX_FreeStream(&request->out, FALSE);
- _FCGX_FreeStream(&request->err, FALSE);
- FreeParams(&request->paramsPtr);
- request->envp = NULL;
-
- if (close) {
- OS_IpcClose(request->ipcFd);
- request->ipcFd = -1;
- }
-}
-
-int FCGX_OpenSocket(const char *path, int backlog)
-{
- int rc = OS_CreateLocalIpcFd(path, backlog, 1);
- if (rc == FCGI_LISTENSOCK_FILENO && isFastCGI == 0) {
- /* XXX probably need to call OS_LibInit() again for Win */
- isFastCGI = 1;
- }
- return rc;
-}
-
-int FCGX_InitRequest(FCGX_Request *request, int sock, int flags)
-{
- memset(request, 0, sizeof(FCGX_Request));
-
- /* @@@ Should check that sock is open and listening */
- request->listen_sock = sock;
-
- /* @@@ Should validate against "known" flags */
- request->flags = flags;
-
- request->ipcFd = -1;
-
- return 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_Init --
- *
- * Initilize the FCGX library. This is called by FCGX_Accept()
- * but must be called by the user when using FCGX_Accept_r().
- *
- * Results:
- * 0 for successful call.
- *
- *----------------------------------------------------------------------
- */
-int FCGX_Init(void)
-{
- char *p;
-
- if (libInitialized) {
- return 0;
- }
-
- FCGX_InitRequest(&the_request, FCGI_LISTENSOCK_FILENO, 0);
-
- if (OS_LibInit(NULL) == -1) {
- return OS_Errno ? OS_Errno : -9997;
- }
-
- p = getenv("FCGI_WEB_SERVER_ADDRS");
- webServerAddressList = p ? StringCopy(p) : NULL;
-
- libInitialized = 1;
- return 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_Accept --
- *
- * Accepts a new request from the HTTP server.
- *
- * Results:
- * 0 for successful call, -1 for error.
- *
- * Side effects:
- *
- * Finishes the request accepted by (and frees any
- * storage allocated by) the previous call to FCGX_Accept.
- * Creates input, output, and error streams and
- * assigns them to *in, *out, and *err respectively.
- * Creates a parameters data structure to be accessed
- * via getenv(3) (if assigned to environ) or by FCGX_GetParam
- * and assigns it to *envp.
- *
- * DO NOT retain pointers to the envp array or any strings
- * contained in it (e.g. to the result of calling FCGX_GetParam),
- * since these will be freed by the next call to FCGX_Finish
- * or FCGX_Accept.
- *
- *----------------------------------------------------------------------
- */
-
-int FCGX_Accept(
- FCGX_Stream **in,
- FCGX_Stream **out,
- FCGX_Stream **err,
- FCGX_ParamArray *envp)
-{
- int rc;
-
- if (! libInitialized) {
- rc = FCGX_Init();
- if (rc) {
- return rc;
- }
- }
-
- rc = FCGX_Accept_r(&the_request);
-
- *in = the_request.in;
- *out = the_request.out;
- *err = the_request.err;
- *envp = the_request.envp;
-
- return rc;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_Accept_r --
- *
- * Accepts a new request from the HTTP server.
- *
- * Results:
- * 0 for successful call, -1 for error.
- *
- * Side effects:
- *
- * Finishes the request accepted by (and frees any
- * storage allocated by) the previous call to FCGX_Accept.
- * Creates input, output, and error streams and
- * assigns them to *in, *out, and *err respectively.
- * Creates a parameters data structure to be accessed
- * via getenv(3) (if assigned to environ) or by FCGX_GetParam
- * and assigns it to *envp.
- *
- * DO NOT retain pointers to the envp array or any strings
- * contained in it (e.g. to the result of calling FCGX_GetParam),
- * since these will be freed by the next call to FCGX_Finish
- * or FCGX_Accept.
- *
- *----------------------------------------------------------------------
- */
-int FCGX_Accept_r(FCGX_Request *reqDataPtr)
-{
- if (!libInitialized) {
- return -9998;
- }
-
- /* Finish the current request, if any. */
- FCGX_Finish_r(reqDataPtr);
-
- for (;;) {
- /*
- * If a connection isn't open, accept a new connection (blocking).
- * If an OS error occurs in accepting the connection,
- * return -1 to the caller, who should exit.
- */
- if (reqDataPtr->ipcFd < 0) {
- int fail_on_intr = reqDataPtr->flags & FCGI_FAIL_ACCEPT_ON_INTR;
-
- reqDataPtr->ipcFd = OS_Accept(reqDataPtr->listen_sock, fail_on_intr, webServerAddressList);
- if (reqDataPtr->ipcFd < 0) {
- return (errno > 0) ? (0 - errno) : -9999;
- }
- }
- /*
- * A connection is open. Read from the connection in order to
- * get the request's role and environment. If protocol or other
- * errors occur, close the connection and try again.
- */
- reqDataPtr->isBeginProcessed = FALSE;
- reqDataPtr->in = NewReader(reqDataPtr, 8192, 0);
- FillBuffProc(reqDataPtr->in);
- if(!reqDataPtr->isBeginProcessed) {
- goto TryAgain;
- }
- {
- char *roleStr;
- switch(reqDataPtr->role) {
- case FCGI_RESPONDER:
- roleStr = "FCGI_ROLE=RESPONDER";
- break;
- case FCGI_AUTHORIZER:
- roleStr = "FCGI_ROLE=AUTHORIZER";
- break;
- case FCGI_FILTER:
- roleStr = "FCGI_ROLE=FILTER";
- break;
- default:
- goto TryAgain;
- }
- reqDataPtr->paramsPtr = NewParams(30);
- PutParam(reqDataPtr->paramsPtr, StringCopy(roleStr));
- }
- SetReaderType(reqDataPtr->in, FCGI_PARAMS);
- if(ReadParams(reqDataPtr->paramsPtr, reqDataPtr->in) >= 0) {
- /*
- * Finished reading the environment. No errors occurred, so
- * leave the connection-retry loop.
- */
- break;
- }
-
- /*
- * Close the connection and try again.
- */
-TryAgain:
- FCGX_Free(reqDataPtr, 1);
-
- } /* for (;;) */
- /*
- * Build the remaining data structures representing the new
- * request and return successfully to the caller.
- */
- SetReaderType(reqDataPtr->in, FCGI_STDIN);
- reqDataPtr->out = NewWriter(reqDataPtr, 8192, FCGI_STDOUT);
- reqDataPtr->err = NewWriter(reqDataPtr, 512, FCGI_STDERR);
- reqDataPtr->nWriters = 2;
- reqDataPtr->envp = reqDataPtr->paramsPtr->vec;
- return 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_StartFilterData --
- *
- * stream is an input stream for a FCGI_FILTER request.
- * stream is positioned at EOF on FCGI_STDIN.
- * Repositions stream to the start of FCGI_DATA.
- * If the preconditions are not met (e.g. FCGI_STDIN has not
- * been read to EOF) sets the stream error code to
- * FCGX_CALL_SEQ_ERROR.
- *
- * Results:
- * 0 for a normal return, < 0 for error
- *
- *----------------------------------------------------------------------
- */
-
-int FCGX_StartFilterData(FCGX_Stream *stream)
-{
- FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data;
- if(data->reqDataPtr->role != FCGI_FILTER
- || !stream->isReader
- || !stream->isClosed
- || data->type != FCGI_STDIN) {
- SetError(stream, FCGX_CALL_SEQ_ERROR);
- return -1;
- }
- SetReaderType(stream, FCGI_DATA);
- return 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_SetExitStatus --
- *
- * Sets the exit status for stream's request. The exit status
- * is the status code the request would have exited with, had
- * the request been run as a CGI program. You can call
- * SetExitStatus several times during a request; the last call
- * before the request ends determines the value.
- *
- *----------------------------------------------------------------------
- */
-
-void FCGX_SetExitStatus(int status, FCGX_Stream *stream)
-{
- FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data;
- data->reqDataPtr->appStatus = status;
-}
-
diff --git a/sapi/cgi/libfcgi/include/fastcgi.h b/sapi/cgi/libfcgi/include/fastcgi.h
deleted file mode 100644
index 36b4725ba1..0000000000
--- a/sapi/cgi/libfcgi/include/fastcgi.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * fastcgi.h --
- *
- * Defines for the FastCGI protocol.
- *
- *
- * Copyright (c) 1995-1996 Open Market, Inc.
- *
- * See the file "LICENSE.TERMS" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * $Id$
- */
-
-#ifndef _FASTCGI_H
-#define _FASTCGI_H
-
-/*
- * Listening socket file number
- */
-#define FCGI_LISTENSOCK_FILENO 0
-
-typedef struct {
- unsigned char version;
- unsigned char type;
- unsigned char requestIdB1;
- unsigned char requestIdB0;
- unsigned char contentLengthB1;
- unsigned char contentLengthB0;
- unsigned char paddingLength;
- unsigned char reserved;
-} FCGI_Header;
-
-#define FCGI_MAX_LENGTH 0xffff
-
-/*
- * Number of bytes in a FCGI_Header. Future versions of the protocol
- * will not reduce this number.
- */
-#define FCGI_HEADER_LEN 8
-
-/*
- * Value for version component of FCGI_Header
- */
-#define FCGI_VERSION_1 1
-
-/*
- * Values for type component of FCGI_Header
- */
-#define FCGI_BEGIN_REQUEST 1
-#define FCGI_ABORT_REQUEST 2
-#define FCGI_END_REQUEST 3
-#define FCGI_PARAMS 4
-#define FCGI_STDIN 5
-#define FCGI_STDOUT 6
-#define FCGI_STDERR 7
-#define FCGI_DATA 8
-#define FCGI_GET_VALUES 9
-#define FCGI_GET_VALUES_RESULT 10
-#define FCGI_UNKNOWN_TYPE 11
-#define FCGI_MAXTYPE (FCGI_UNKNOWN_TYPE)
-
-/*
- * Value for requestId component of FCGI_Header
- */
-#define FCGI_NULL_REQUEST_ID 0
-
-
-typedef struct {
- unsigned char roleB1;
- unsigned char roleB0;
- unsigned char flags;
- unsigned char reserved[5];
-} FCGI_BeginRequestBody;
-
-typedef struct {
- FCGI_Header header;
- FCGI_BeginRequestBody body;
-} FCGI_BeginRequestRecord;
-
-/*
- * Mask for flags component of FCGI_BeginRequestBody
- */
-#define FCGI_KEEP_CONN 1
-
-/*
- * Values for role component of FCGI_BeginRequestBody
- */
-#define FCGI_RESPONDER 1
-#define FCGI_AUTHORIZER 2
-#define FCGI_FILTER 3
-
-
-typedef struct {
- unsigned char appStatusB3;
- unsigned char appStatusB2;
- unsigned char appStatusB1;
- unsigned char appStatusB0;
- unsigned char protocolStatus;
- unsigned char reserved[3];
-} FCGI_EndRequestBody;
-
-typedef struct {
- FCGI_Header header;
- FCGI_EndRequestBody body;
-} FCGI_EndRequestRecord;
-
-/*
- * Values for protocolStatus component of FCGI_EndRequestBody
- */
-#define FCGI_REQUEST_COMPLETE 0
-#define FCGI_CANT_MPX_CONN 1
-#define FCGI_OVERLOADED 2
-#define FCGI_UNKNOWN_ROLE 3
-
-
-/*
- * Variable names for FCGI_GET_VALUES / FCGI_GET_VALUES_RESULT records
- */
-#define FCGI_MAX_CONNS "FCGI_MAX_CONNS"
-#define FCGI_MAX_REQS "FCGI_MAX_REQS"
-#define FCGI_MPXS_CONNS "FCGI_MPXS_CONNS"
-
-
-typedef struct {
- unsigned char type;
- unsigned char reserved[7];
-} FCGI_UnknownTypeBody;
-
-typedef struct {
- FCGI_Header header;
- FCGI_UnknownTypeBody body;
-} FCGI_UnknownTypeRecord;
-
-#endif /* _FASTCGI_H */
-
diff --git a/sapi/cgi/libfcgi/include/fcgi_config.h b/sapi/cgi/libfcgi/include/fcgi_config.h
deleted file mode 100644
index 22256df328..0000000000
--- a/sapi/cgi/libfcgi/include/fcgi_config.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* hack workaround for libfcgi configure */
-#ifdef _WIN32
-#include "fcgi_config_win32.h"
-#else
-#include "main/php_config.h"
-#endif
-
diff --git a/sapi/cgi/libfcgi/include/fcgi_config_win32.h b/sapi/cgi/libfcgi/include/fcgi_config_win32.h
deleted file mode 100644
index 81ff264d9f..0000000000
--- a/sapi/cgi/libfcgi/include/fcgi_config_win32.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* fcgi_config.h. Generated automatically by configure. */
-/* fcgi_config.h.in. Generated automatically from configure.in by autoheader. */
-
-/* Define if you have the <arpa/inet.h> header file. */
-#define HAVE_ARPA_INET_H 1
-
-/* Define if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define if there's a fileno() prototype in stdio.h */
-#define HAVE_FILENO_PROTO 1
-
-/* Define if the fpos_t typedef is in stdio.h */
-#define HAVE_FPOS 1
-
-/* Define if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define if you have the `dnet_stub' library (-ldnet_stub). */
-/* #undef HAVE_LIBDNET_STUB */
-
-/* Define if you have the `ieee' library (-lieee). */
-/* #undef HAVE_LIBIEEE */
-
-/* Define if you have the `nsl' library (-lnsl). */
-#define HAVE_LIBNSL 1
-
-/* Define if you have the pthread library */
-#define HAVE_LIBPTHREAD 1
-
-/* Define if you have the `resolv' library (-lresolv). */
-#define HAVE_LIBRESOLV 1
-
-/* Define if you have the `socket' library (-lsocket). */
-#define HAVE_LIBSOCKET 1
-
-/* Define if you have the <limits.h> header file. */
-#define HAVE_LIMITS_H 1
-
-/* Define if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define if you have the <netdb.h> header file. */
-/* #define HAVE_NETDB_H 1 */
-
-/* Define if you have the <netinet/in.h> header file. */
-#define HAVE_NETINET_IN_H 1
-
-/* Define if sockaddr_un in sys/un.h contains a sun_len component */
-/* #undef HAVE_SOCKADDR_UN_SUN_LEN */
-
-/* Define if the socklen_t typedef is in sys/socket.h */
-/* #undef HAVE_SOCKLEN */
-
-/* Define if you have the <stdint.h> header file. */
-/* #undef HAVE_STDINT_H */
-
-/* Define if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define if you have the `strerror' function. */
-#define HAVE_STRERROR 1
-
-/* Define if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define if you have the <sys/param.h> header file. */
-/* #define HAVE_SYS_PARAM_H 1 */
-
-/* Define if you have the <sys/socket.h> header file. */
-/*#define HAVE_SYS_SOCKET_H 1*/
-
-/* Define if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define if you have the <sys/time.h> header file. */
-/*#define HAVE_SYS_TIME_H 1*/
-
-/* Define if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define if you have the <unistd.h> header file. */
-/*#define HAVE_UNISTD_H 1*/
-
-/* Define if va_arg(arg, long double) crashes the compiler */
-/* #undef HAVE_VA_ARG_LONG_DOUBLE_BUG */
-
-/* Name of package */
-#define PACKAGE "fcgi"
-
-/* Define if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define if cross-process locking is required by accept() */
-#define USE_LOCKING 1
-
-/* Version number of package */
-#define VERSION "2.2.2"
-
-/* Define to empty if `const' does not conform to ANSI C. */
-/* #undef const */
-
-/* Define as `__inline' if that's what the C compiler calls it, or to nothing
- if it is not supported. */
-/* #undef inline */
-
-/* Define to `int' if <sys/types.h> does not define. */
-#define ssize_t int \ No newline at end of file
diff --git a/sapi/cgi/libfcgi/include/fcgi_config_x86.h b/sapi/cgi/libfcgi/include/fcgi_config_x86.h
deleted file mode 100644
index f56b3af75d..0000000000
--- a/sapi/cgi/libfcgi/include/fcgi_config_x86.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Default fcgi_config.h when building on WinNT (configure is not run).
- */
-
-/* Define if you have the <arpa/inet.h> header file. */
-#undef HAVE_ARPA_INET_H
-
-/* Define if there's a fileno() prototype in stdio.h */
-#undef HAVE_FILENO_PROTO
-
-/* Define if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define if we have f{set,get}pos functions */
-#define HAVE_FPOS 1
-
-/* Define if you have the `dnet_stub' library (-ldnet_stub). */
-#undef HAVE_LIBDNET_STUB
-
-/* Define if you have the `ieee' library (-lieee). */
-#undef HAVE_LIBIEEE
-
-/* Define if you have the `nsl' library (-lnsl). */
-#undef HAVE_LIBNSL
-
-/* Define if you have the pthread library */
-#undef HAVE_LIBPTHREAD
-
-/* Define if you have the `resolv' library (-lresolv). */
-#undef HAVE_LIBRESOLV
-
-/* Define if you have the `socket' library (-lsocket). */
-#undef HAVE_LIBSOCKET
-
-/* Define if you have the <limits.h> header file. */
-#define HAVE_LIMITS_H 1
-
-/* Define if we need cross-process locking */
-#undef USE_LOCKING
-
-/* Define if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define if you have the <netdb.h> header file. */
-#undef HAVE_NETDB_H
-
-/* Define if you have the <netinet/in.h> header file. */
-#undef HAVE_NETINET_IN_H
-
-/* Define if sockaddr_un in sys/un.h contains a sun_len component */
-#undef HAVE_SOCKADDR_UN_SUN_LEN
-
-/* Define if the socklen_t typedef is in sys/socket.h */
-#undef HAVE_SOCKLEN
-
-/* Define if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define if you have the `strerror' function. */
-#define HAVE_STRERROR 1
-
-/* Define if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define if you have the <sys/param.h> header file. */
-#undef HAVE_SYS_PARAM_H
-
-/* Define if you have the <sys/socket.h> header file. */
-#undef HAVE_SYS_SOCKET_H
-
-/* Define if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define if you have the <sys/time.h> header file. */
-#undef HAVE_SYS_TIME_H
-
-/* Define if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define if va_arg(arg, long double) crashes the compiler */
-#undef HAVE_VA_ARG_LONG_DOUBLE_BUG
-
-/* Define if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define to empty if `const' does not conform to ANSI C. */
-#undef const
-
-/* Define as `__inline' if that's what the C compiler calls it, or to nothing
- if it is not supported. */
-#undef inline
-
-/* Define to `int' if <sys/types.h> does not define. */
-#undef ssize_t
diff --git a/sapi/cgi/libfcgi/include/fcgi_stdio.h b/sapi/cgi/libfcgi/include/fcgi_stdio.h
deleted file mode 100644
index 518462b591..0000000000
--- a/sapi/cgi/libfcgi/include/fcgi_stdio.h
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * fcgi_stdio.h --
- *
- * FastCGI-stdio compatibility package
- *
- *
- * Copyright (c) 1996 Open Market, Inc.
- *
- * See the file "LICENSE.TERMS" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * $Id$
- */
-
-#ifndef _FCGI_STDIO
-#define _FCGI_STDIO 1
-
-#include <stdio.h>
-#include <sys/types.h>
-#include "fcgiapp.h"
-
-#if defined (c_plusplus) || defined (__cplusplus)
-extern "C" {
-#endif
-
-#ifndef DLLAPI
-#ifdef _WIN32
-#if defined(_LIB) || defined(FCGI_STATIC)
-#define DLLAPI
-#else
-#define DLLAPI __declspec(dllimport)
-#endif
-#else
-#define DLLAPI
-#endif
-#endif
-
-/*
- * Wrapper type for FILE
- */
-
-typedef struct {
- FILE *stdio_stream;
- FCGX_Stream *fcgx_stream;
-} FCGI_FILE;
-
-/*
- * The four new functions and two new macros
- */
-
-DLLAPI int FCGI_Accept(void);
-DLLAPI void FCGI_Finish(void);
-DLLAPI int FCGI_StartFilterData(void);
-DLLAPI void FCGI_SetExitStatus(int status);
-
-#define FCGI_ToFILE(fcgi_file) (fcgi_file->stdio_stream)
-#define FCGI_ToFcgiStream(fcgi_file) (fcgi_file->fcgx_stream)
-
-/*
- * Wrapper stdin, stdout, and stderr variables, set up by FCGI_Accept()
- */
-
-DLLAPI extern FCGI_FILE _fcgi_sF[];
-#define FCGI_stdin (&_fcgi_sF[0])
-#define FCGI_stdout (&_fcgi_sF[1])
-#define FCGI_stderr (&_fcgi_sF[2])
-
-/*
- * Wrapper function prototypes, grouped according to sections
- * of Harbison & Steele, "C: A Reference Manual," fourth edition,
- * Prentice-Hall, 1995.
- */
-
-DLLAPI void FCGI_perror(const char *str);
-
-DLLAPI FCGI_FILE *FCGI_fopen(const char *path, const char *mode);
-DLLAPI int FCGI_fclose(FCGI_FILE *fp);
-DLLAPI int FCGI_fflush(FCGI_FILE *fp);
-DLLAPI FCGI_FILE *FCGI_freopen(const char *path, const char *mode, FCGI_FILE *fp);
-
-DLLAPI int FCGI_setvbuf(FCGI_FILE *fp, char *buf, int bufmode, size_t size);
-DLLAPI void FCGI_setbuf(FCGI_FILE *fp, char *buf);
-
-DLLAPI int FCGI_fseek(FCGI_FILE *fp, long offset, int whence);
-DLLAPI int FCGI_ftell(FCGI_FILE *fp);
-DLLAPI void FCGI_rewind(FCGI_FILE *fp);
-#ifdef HAVE_FPOS
-DLLAPI int FCGI_fgetpos(FCGI_FILE *fp, fpos_t *pos);
-DLLAPI int FCGI_fsetpos(FCGI_FILE *fp, const fpos_t *pos);
-#endif
-DLLAPI int FCGI_fgetc(FCGI_FILE *fp);
-DLLAPI int FCGI_getchar(void);
-DLLAPI int FCGI_ungetc(int c, FCGI_FILE *fp);
-
-DLLAPI char *FCGI_fgets(char *str, int size, FCGI_FILE *fp);
-DLLAPI char *FCGI_gets(char *str);
-
-/*
- * Not yet implemented
- *
- * int FCGI_fscanf(FCGI_FILE *fp, const char *format, ...);
- * int FCGI_scanf(const char *format, ...);
- *
- */
-
-DLLAPI int FCGI_fputc(int c, FCGI_FILE *fp);
-DLLAPI int FCGI_putchar(int c);
-
-DLLAPI int FCGI_fputs(const char *str, FCGI_FILE *fp);
-DLLAPI int FCGI_puts(const char *str);
-
-DLLAPI int FCGI_fprintf(FCGI_FILE *fp, const char *format, ...);
-DLLAPI int FCGI_printf(const char *format, ...);
-
-DLLAPI int FCGI_vfprintf(FCGI_FILE *fp, const char *format, va_list ap);
-DLLAPI int FCGI_vprintf(const char *format, va_list ap);
-
-DLLAPI size_t FCGI_fread(void *ptr, size_t size, size_t nmemb, FCGI_FILE *fp);
-DLLAPI size_t FCGI_fwrite(void *ptr, size_t size, size_t nmemb, FCGI_FILE *fp);
-
-DLLAPI int FCGI_feof(FCGI_FILE *fp);
-DLLAPI int FCGI_ferror(FCGI_FILE *fp);
-DLLAPI void FCGI_clearerr(FCGI_FILE *fp);
-
-DLLAPI FCGI_FILE *FCGI_tmpfile(void);
-
-DLLAPI int FCGI_fileno(FCGI_FILE *fp);
-DLLAPI FCGI_FILE *FCGI_fdopen(int fd, const char *mode);
-DLLAPI FCGI_FILE *FCGI_popen(const char *cmd, const char *type);
-DLLAPI int FCGI_pclose(FCGI_FILE *);
-
-/*
- * The remaining definitions are for application programs,
- * not for fcgi_stdio.c
- */
-
-#ifndef NO_FCGI_DEFINES
-
-/*
- * Replace standard types, variables, and functions with FastCGI wrappers.
- * Use undef in case a macro is already defined.
- */
-
-#undef FILE
-#define FILE FCGI_FILE
-
-#undef stdin
-#define stdin FCGI_stdin
-#undef stdout
-#define stdout FCGI_stdout
-#undef stderr
-#define stderr FCGI_stderr
-
-#undef perror
-#define perror FCGI_perror
-
-#undef fopen
-#define fopen FCGI_fopen
-#undef fclose
-#define fclose FCGI_fclose
-#undef fflush
-#define fflush FCGI_fflush
-#undef freopen
-#define freopen FCGI_freopen
-
-#undef setvbuf
-#define setvbuf FCGI_setvbuf
-#undef setbuf
-#define setbuf FCGI_setbuf
-
-#undef fseek
-#define fseek FCGI_fseek
-#undef ftell
-#define ftell FCGI_ftell
-#undef rewind
-#define rewind FCGI_rewind
-#undef fgetpos
-#define fgetpos FCGI_fgetpos
-#undef fsetpos
-#define fsetpos FCGI_fsetpos
-
-#undef fgetc
-#define fgetc FCGI_fgetc
-#undef getc
-#define getc FCGI_fgetc
-#undef getchar
-#define getchar FCGI_getchar
-#undef ungetc
-#define ungetc FCGI_ungetc
-
-#undef fgets
-#define fgets FCGI_fgets
-#undef gets
-#define gets FCGI_gets
-
-#undef fputc
-#define fputc FCGI_fputc
-#undef putc
-#define putc FCGI_fputc
-#undef putchar
-#define putchar FCGI_putchar
-
-#undef fputs
-#define fputs FCGI_fputs
-#undef puts
-#define puts FCGI_puts
-
-#undef fprintf
-#define fprintf FCGI_fprintf
-#undef printf
-#define printf FCGI_printf
-
-#undef vfprintf
-#define vfprintf FCGI_vfprintf
-#undef vprintf
-#define vprintf FCGI_vprintf
-
-#undef fread
-#define fread FCGI_fread
-#undef fwrite
-#define fwrite FCGI_fwrite
-
-#undef feof
-#define feof FCGI_feof
-#undef ferror
-#define ferror FCGI_ferror
-#undef clearerr
-#define clearerr FCGI_clearerr
-
-#undef tmpfile
-#define tmpfile FCGI_tmpfile
-
-#undef fileno
-#define fileno FCGI_fileno
-#undef fdopen
-#define fdopen FCGI_fdopen
-#undef popen
-#define popen FCGI_popen
-#undef pclose
-#define pclose FCGI_pclose
-
-#endif /* NO_FCGI_DEFINES */
-
-#if defined (__cplusplus) || defined (c_plusplus)
-} /* terminate extern "C" { */
-#endif
-
-#endif /* _FCGI_STDIO */
-
diff --git a/sapi/cgi/libfcgi/include/fcgiapp.h b/sapi/cgi/libfcgi/include/fcgiapp.h
deleted file mode 100644
index 8e35e0776c..0000000000
--- a/sapi/cgi/libfcgi/include/fcgiapp.h
+++ /dev/null
@@ -1,640 +0,0 @@
-/*
- * fcgiapp.h --
- *
- * Definitions for FastCGI application server programs
- *
- *
- * Copyright (c) 1996 Open Market, Inc.
- *
- * See the file "LICENSE.TERMS" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * $Id$
- */
-
-#ifndef _FCGIAPP_H
-#define _FCGIAPP_H
-
-/* Hack to see if we are building TCL - TCL needs varargs not stdarg */
-#ifndef TCL_LIBRARY
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#ifndef DLLAPI
-#ifdef _WIN32
-#if defined(_LIB) || defined(FCGI_STATIC)
-#define DLLAPI
-#else
-#define DLLAPI __declspec(dllimport)
-#endif
-#else
-#define DLLAPI
-#endif
-#endif
-
-#if defined (c_plusplus) || defined (__cplusplus)
-extern "C" {
-#endif
-
-/*
- * Error codes. Assigned to avoid conflict with EOF and errno(2).
- */
-#define FCGX_UNSUPPORTED_VERSION -2
-#define FCGX_PROTOCOL_ERROR -3
-#define FCGX_PARAMS_ERROR -4
-#define FCGX_CALL_SEQ_ERROR -5
-
-/*
- * This structure defines the state of a FastCGI stream.
- * Streams are modeled after the FILE type defined in stdio.h.
- * (We wouldn't need our own if platform vendors provided a
- * standard way to subclass theirs.)
- * The state of a stream is private and should only be accessed
- * by the procedures defined below.
- */
-typedef struct FCGX_Stream {
- unsigned char *rdNext; /* reader: first valid byte
- * writer: equals stop */
- unsigned char *wrNext; /* writer: first free byte
- * reader: equals stop */
- unsigned char *stop; /* reader: last valid byte + 1
- * writer: last free byte + 1 */
- unsigned char *stopUnget; /* reader: first byte of current buffer
- * fragment, for ungetc
- * writer: undefined */
- int isReader;
- int isClosed;
- int wasFCloseCalled;
- int FCGI_errno; /* error status */
- void (*fillBuffProc) (struct FCGX_Stream *stream);
- void (*emptyBuffProc) (struct FCGX_Stream *stream, int doClose);
- void *data;
-} FCGX_Stream;
-
-/*
- * An environment (as defined by environ(7)): A NULL-terminated array
- * of strings, each string having the form name=value.
- */
-typedef char **FCGX_ParamArray;
-
-/*
- * A vector of pointers representing the parameters received
- * by a FastCGI application server, with the vector's length
- * and last valid element so adding new parameters is efficient.
- */
-
-typedef struct Params {
- FCGX_ParamArray vec; /* vector of strings */
- int length; /* number of string vec can hold */
- char **cur; /* current item in vec; *cur == NULL */
-} Params;
-typedef Params *ParamsPtr;
-
-/*
- * FCGX_Request Flags
- *
- * Setting FCGI_FAIL_ACCEPT_ON_INTR prevents FCGX_Accept() from
- * restarting upon being interrupted.
- */
-#define FCGI_FAIL_ACCEPT_ON_INTR 1
-
-/*
- * FCGX_Request -- State associated with a request.
- *
- * Its exposed for API simplicity, I expect parts of it to change!
- */
-typedef struct FCGX_Request {
- int requestId; /* valid if isBeginProcessed */
- int role;
- FCGX_Stream *in;
- FCGX_Stream *out;
- FCGX_Stream *err;
- FCGX_ParamArray envp;
-
- /* Don't use anything below here */
-
- ParamsPtr paramsPtr;
- int ipcFd; /* < 0 means no connection */
- int isBeginProcessed; /* FCGI_BEGIN_REQUEST seen */
- int keepConnection; /* don't close ipcFd at end of request */
- int appStatus;
- int nWriters; /* number of open writers (0..2) */
- int flags;
- int listen_sock;
-} FCGX_Request;
-
-
-/*
- *======================================================================
- * Control
- *======================================================================
- */
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_IsCGI --
- *
- * Returns TRUE iff this process appears to be a CGI process
- * rather than a FastCGI process.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_IsCGI(void);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_Init --
- *
- * Initialize the FCGX library. Call in multi-threaded apps
- * before calling FCGX_Accept_r().
- *
- * Returns 0 upon success.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_Init(void);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_OpenSocket --
- *
- * Create a FastCGI listen socket.
- *
- * path is the Unix domain socket (named pipe for WinNT), or a colon
- * followed by a port number. e.g. "/tmp/fastcgi/mysocket", ":5000"
- *
- * backlog is the listen queue depth used in the listen() call.
- *
- * Returns the socket's file descriptor or -1 on error.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_OpenSocket(const char *path, int backlog);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_InitRequest --
- *
- * Initialize a FCGX_Request for use with FCGX_Accept_r().
- *
- * sock is a file descriptor returned by FCGX_OpenSocket() or 0 (default).
- * The only supported flag at this time is FCGI_FAIL_ON_INTR.
- *
- * Returns 0 upon success.
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_InitRequest(FCGX_Request *request, int sock, int flags);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_Accept_r --
- *
- * Accept a new request (multi-thread safe). Be sure to call
- * FCGX_Init() first.
- *
- * Results:
- * 0 for successful call, -1 for error.
- *
- * Side effects:
- *
- * Finishes the request accepted by (and frees any
- * storage allocated by) the previous call to FCGX_Accept.
- * Creates input, output, and error streams and
- * assigns them to *in, *out, and *err respectively.
- * Creates a parameters data structure to be accessed
- * via getenv(3) (if assigned to environ) or by FCGX_GetParam
- * and assigns it to *envp.
- *
- * DO NOT retain pointers to the envp array or any strings
- * contained in it (e.g. to the result of calling FCGX_GetParam),
- * since these will be freed by the next call to FCGX_Finish
- * or FCGX_Accept.
- *
- * DON'T use the FCGX_Request, its structure WILL change.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_Accept_r(FCGX_Request *request);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_Finish_r --
- *
- * Finish the request (multi-thread safe).
- *
- * Side effects:
- *
- * Finishes the request accepted by (and frees any
- * storage allocated by) the previous call to FCGX_Accept.
- *
- * DO NOT retain pointers to the envp array or any strings
- * contained in it (e.g. to the result of calling FCGX_GetParam),
- * since these will be freed by the next call to FCGX_Finish
- * or FCGX_Accept.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI void FCGX_Finish_r(FCGX_Request *request);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_Free --
- *
- * Free the memory and, if close is true,
- * IPC FD associated with the request (multi-thread safe).
- *
- *----------------------------------------------------------------------
- */
-DLLAPI void FCGX_Free(FCGX_Request * request, int close);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_Accept --
- *
- * Accept a new request (NOT multi-thread safe).
- *
- * Results:
- * 0 for successful call, -1 for error.
- *
- * Side effects:
- *
- * Finishes the request accepted by (and frees any
- * storage allocated by) the previous call to FCGX_Accept.
- * Creates input, output, and error streams and
- * assigns them to *in, *out, and *err respectively.
- * Creates a parameters data structure to be accessed
- * via getenv(3) (if assigned to environ) or by FCGX_GetParam
- * and assigns it to *envp.
- *
- * DO NOT retain pointers to the envp array or any strings
- * contained in it (e.g. to the result of calling FCGX_GetParam),
- * since these will be freed by the next call to FCGX_Finish
- * or FCGX_Accept.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_Accept(
- FCGX_Stream **in,
- FCGX_Stream **out,
- FCGX_Stream **err,
- FCGX_ParamArray *envp);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_Finish --
- *
- * Finish the current request (NOT multi-thread safe).
- *
- * Side effects:
- *
- * Finishes the request accepted by (and frees any
- * storage allocated by) the previous call to FCGX_Accept.
- *
- * DO NOT retain pointers to the envp array or any strings
- * contained in it (e.g. to the result of calling FCGX_GetParam),
- * since these will be freed by the next call to FCGX_Finish
- * or FCGX_Accept.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI void FCGX_Finish(void);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_StartFilterData --
- *
- * stream is an input stream for a FCGI_FILTER request.
- * stream is positioned at EOF on FCGI_STDIN.
- * Repositions stream to the start of FCGI_DATA.
- * If the preconditions are not met (e.g. FCGI_STDIN has not
- * been read to EOF) sets the stream error code to
- * FCGX_CALL_SEQ_ERROR.
- *
- * Results:
- * 0 for a normal return, < 0 for error
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_StartFilterData(FCGX_Stream *stream);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_SetExitStatus --
- *
- * Sets the exit status for stream's request. The exit status
- * is the status code the request would have exited with, had
- * the request been run as a CGI program. You can call
- * SetExitStatus several times during a request; the last call
- * before the request ends determines the value.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI void FCGX_SetExitStatus(int status, FCGX_Stream *stream);
-
-/*
- *======================================================================
- * Parameters
- *======================================================================
- */
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_GetParam -- obtain value of FCGI parameter in environment
- *
- *
- * Results:
- * Value bound to name, NULL if name not present in the
- * environment envp. Caller must not mutate the result
- * or retain it past the end of this request.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI char *FCGX_GetParam(const char *name, FCGX_ParamArray envp);
-DLLAPI void FCGX_PutEnv(FCGX_Request *request, char *nameValue);
-
-/*
- *======================================================================
- * Readers
- *======================================================================
- */
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_GetChar --
- *
- * Reads a byte from the input stream and returns it.
- *
- * Results:
- * The byte, or EOF (-1) if the end of input has been reached.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_GetChar(FCGX_Stream *stream);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_UnGetChar --
- *
- * Pushes back the character c onto the input stream. One
- * character of pushback is guaranteed once a character
- * has been read. No pushback is possible for EOF.
- *
- * Results:
- * Returns c if the pushback succeeded, EOF if not.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_UnGetChar(int c, FCGX_Stream *stream);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_GetStr --
- *
- * Reads up to n consecutive bytes from the input stream
- * into the character array str. Performs no interpretation
- * of the input bytes.
- *
- * Results:
- * Number of bytes read. If result is smaller than n,
- * the end of input has been reached.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_GetStr(char *str, int n, FCGX_Stream *stream);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_GetLine --
- *
- * Reads up to n-1 consecutive bytes from the input stream
- * into the character array str. Stops before n-1 bytes
- * have been read if '\n' or EOF is read. The terminating '\n'
- * is copied to str. After copying the last byte into str,
- * stores a '\0' terminator.
- *
- * Results:
- * NULL if EOF is the first thing read from the input stream,
- * str otherwise.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI char *FCGX_GetLine(char *str, int n, FCGX_Stream *stream);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_HasSeenEOF --
- *
- * Returns EOF if end-of-file has been detected while reading
- * from stream; otherwise returns 0.
- *
- * Note that FCGX_HasSeenEOF(s) may return 0, yet an immediately
- * following FCGX_GetChar(s) may return EOF. This function, like
- * the standard C stdio function feof, does not provide the
- * ability to peek ahead.
- *
- * Results:
- * EOF if end-of-file has been detected, 0 if not.
- *
- *----------------------------------------------------------------------
- */
-
-DLLAPI int FCGX_HasSeenEOF(FCGX_Stream *stream);
-
-/*
- *======================================================================
- * Writers
- *======================================================================
- */
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_PutChar --
- *
- * Writes a byte to the output stream.
- *
- * Results:
- * The byte, or EOF (-1) if an error occurred.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_PutChar(int c, FCGX_Stream *stream);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_PutStr --
- *
- * Writes n consecutive bytes from the character array str
- * into the output stream. Performs no interpretation
- * of the output bytes.
- *
- * Results:
- * Number of bytes written (n) for normal return,
- * EOF (-1) if an error occurred.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_PutStr(const char *str, int n, FCGX_Stream *stream);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_PutS --
- *
- * Writes a null-terminated character string to the output stream.
- *
- * Results:
- * number of bytes written for normal return,
- * EOF (-1) if an error occurred.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_PutS(const char *str, FCGX_Stream *stream);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_FPrintF, FCGX_VFPrintF --
- *
- * Performs printf-style output formatting and writes the results
- * to the output stream.
- *
- * Results:
- * number of bytes written for normal return,
- * EOF (-1) if an error occurred.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_FPrintF(FCGX_Stream *stream, const char *format, ...);
-
-DLLAPI int FCGX_VFPrintF(FCGX_Stream *stream, const char *format, va_list arg);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_FFlush --
- *
- * Flushes any buffered output.
- *
- * Server-push is a legitimate application of FCGX_FFlush.
- * Otherwise, FCGX_FFlush is not very useful, since FCGX_Accept
- * does it implicitly. Calling FCGX_FFlush in non-push applications
- * results in extra writes and therefore reduces performance.
- *
- * Results:
- * EOF (-1) if an error occurred.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_FFlush(FCGX_Stream *stream);
-
-/*
- *======================================================================
- * Both Readers and Writers
- *======================================================================
- */
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_FClose --
- *
- * Closes the stream. For writers, flushes any buffered
- * output.
- *
- * Close is not a very useful operation since FCGX_Accept
- * does it implicitly. Closing the out stream before the
- * err stream results in an extra write if there's nothing
- * in the err stream, and therefore reduces performance.
- *
- * Results:
- * EOF (-1) if an error occurred.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_FClose(FCGX_Stream *stream);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_GetError --
- *
- * Return the stream error code. 0 means no error, > 0
- * is an errno(2) error, < 0 is an FastCGI error.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI int FCGX_GetError(FCGX_Stream *stream);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_ClearError --
- *
- * Clear the stream error code and end-of-file indication.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI void FCGX_ClearError(FCGX_Stream *stream);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_CreateWriter --
- *
- * Create a FCGX_Stream (used by cgi-fcgi). This shouldn't
- * be needed by a FastCGI applictaion.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI FCGX_Stream *FCGX_CreateWriter(
- int socket,
- int requestId,
- int bufflen,
- int streamType);
-
-/*
- *----------------------------------------------------------------------
- *
- * FCGX_FreeStream --
- *
- * Free a FCGX_Stream (used by cgi-fcgi). This shouldn't
- * be needed by a FastCGI applictaion.
- *
- *----------------------------------------------------------------------
- */
-DLLAPI void FCGX_FreeStream(FCGX_Stream **stream);
-
-/* ----------------------------------------------------------------------
- *
- * Prevent the lib from accepting any new requests. Signal handler safe.
- *
- * ----------------------------------------------------------------------
- */
-DLLAPI void FCGX_ShutdownPending(void);
-
-#if defined (__cplusplus) || defined (c_plusplus)
-} /* terminate extern "C" { */
-#endif
-
-#endif /* _FCGIAPP_H */
diff --git a/sapi/cgi/libfcgi/include/fcgiappmisc.h b/sapi/cgi/libfcgi/include/fcgiappmisc.h
deleted file mode 100644
index db8651a44b..0000000000
--- a/sapi/cgi/libfcgi/include/fcgiappmisc.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * fcgiappmisc.h --
- *
- * Functions implemented by fcgiapp.h that aren't needed
- * by normal applications, but may be useful to special
- * applications.
- *
- *
- * Copyright (c) 1996 Open Market, Inc.
- *
- * See the file "LICENSE.TERMS" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * $Id$
- */
-
-#ifndef _FCGIAPPMISC_H
-#define _FCGIAPPMISC_H
-
-#include "fcgiapp.h" /* for FCGX_Stream */
-
-#if defined (c_plusplus) || defined (__cplusplus)
-extern "C" {
-#endif
-
-#ifdef _WIN32
-#ifndef DLLAPI
-#ifdef FCGI_STATIC
-#define DLLAPI
-#else
-#define DLLAPI __declspec(dllimport)
-#endif
-#endif
-#else
-#define DLLAPI
-#endif
-
-DLLAPI FCGX_Stream *CreateWriter(
- int socket,
- int requestId,
- int bufflen,
- int streamType);
-
-DLLAPI void FreeStream(FCGX_Stream **stream);
-
-#if defined (__cplusplus) || defined (c_plusplus)
-} /* terminate extern "C" { */
-#endif
-
-#endif /* _FCGIAPPMISC_H */
diff --git a/sapi/cgi/libfcgi/include/fcgimisc.h b/sapi/cgi/libfcgi/include/fcgimisc.h
deleted file mode 100644
index 20ee4a0cf0..0000000000
--- a/sapi/cgi/libfcgi/include/fcgimisc.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * fcgimisc.h --
- *
- * Miscellaneous definitions
- *
- *
- * Copyright (c) 1996 Open Market, Inc.
- *
- * See the file "LICENSE.TERMS" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * $Id$
- */
-
-#ifndef _FCGIMISC_H
-#define _FCGIMISC_H
-
-#ifndef FALSE
-#define FALSE (0)
-#endif
-
-#ifndef TRUE
-#define TRUE (1)
-#endif
-
-#ifndef min
-#define min(a,b) ((a) < (b) ? (a) : (b))
-#endif
-
-#ifndef max
-#define max(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
-#ifndef ASSERT
-#define ASSERT(assertion) assert(assertion)
-#endif
-
-#endif /* _FCGIMISC_H */
diff --git a/sapi/cgi/libfcgi/include/fcgio.h b/sapi/cgi/libfcgi/include/fcgio.h
deleted file mode 100644
index 865bff385b..0000000000
--- a/sapi/cgi/libfcgi/include/fcgio.h
+++ /dev/null
@@ -1,147 +0,0 @@
-//
-// Provides support for FastCGI via C++ iostreams.
-//
-// $Id$
-//
-// This work is based on routines written by George Feinberg. They
-// have been mostly re-written and extensively changed by
-// Michael Richards.
-//
-// Rewritten again with bug fixes and numerous enhancements by
-// Michael Shell.
-//
-// And rewritten again by Rob Saccoccio.
-//
-// Special Thanks to Dietmar Kuehl for his help and the numerous custom
-// streambuf examples on his web site.
-//
-// Copyright (c) 2000 Tux the Linux Penguin
-// Copyright (c) 2001 Rob Saccoccio and Chelsea Networks
-//
-// You are free to use this software without charge or royalty
-// as long as this notice is not removed or altered, and recognition
-// is given to the author(s)
-//
-// This code is offered as-is without any warranty either expressed or
-// implied; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE. If it breaks, you get to keep
-// both halves.
-
-#ifndef FCGIO_H
-#define FCGIO_H
-
-#include <iostream.h>
-
-#include "fcgiapp.h"
-
-#ifndef DLLAPI
-#ifdef _WIN32
-#define DLLAPI __declspec(dllimport)
-#else
-#define DLLAPI
-#endif
-#endif
-
-/*
- * fcgi_streambuf
- */
-class fcgi_streambuf : public streambuf
-{
-public:
-
- // Note that if no buf is assigned (the default), iostream methods
- // such as peek(), unget() and putback() will fail. If a buf is
- // assigned, I/O is a bit less effecient and output streams will
- // have to be flushed (or the streambuf destroyed) before the next
- // call to "accept".
- DLLAPI fcgi_streambuf(FCGX_Stream * fcgx, char * buf, int len);
-
- DLLAPI fcgi_streambuf(char * buf, int len);
-
- DLLAPI fcgi_streambuf(FCGX_Stream * fcgx = NULL);
-
- DLLAPI ~fcgi_streambuf(void);
-
- DLLAPI int attach(FCGX_Stream * fcgx);
-
-protected:
-
- // Consume the put area (if buffered) and c (if c is not EOF).
- DLLAPI virtual int overflow(int);
-
- // Flush the put area (if buffered) and the FCGX buffer to the client.
- DLLAPI virtual int sync();
-
- // Remove and return the current character.
- DLLAPI virtual int uflow();
-
- // Fill the get area (if buffered) and return the current character.
- DLLAPI virtual int underflow();
-
- // Use a buffer. The only reasons that a buffer would be useful is
- // to support the use of the unget()/putback() or seek() methods. Using
- // a buffer will result in less efficient I/O. Note: the underlying
- // FastCGI library (FCGX) maintains its own input and output buffers.
- DLLAPI virtual streambuf * setbuf(char * buf, int len);
-
- DLLAPI virtual int xsgetn(char * s, int n);
- DLLAPI virtual int xsputn(const char * s, int n);
-
-private:
-
- FCGX_Stream * fcgx;
-
- // buf is just handy to have around
- char * buf;
-
- // this isn't kept by the base class
- int bufsize;
-
- void init(FCGX_Stream * fcgx, char * buf, int bufsize);
-
- void reset(void);
-};
-
-/*
- * fcgi_istream - deprecated
- */
-class fcgi_istream : public istream
-{
-public:
-
- // deprecated
- DLLAPI fcgi_istream(FCGX_Stream * fcgx = NULL);
-
- // deprecated
- DLLAPI ~fcgi_istream(void) {}
-
- // deprecated
- DLLAPI virtual void attach(FCGX_Stream * fcgx);
-
-private:
-
- fcgi_streambuf fcgi_strmbuf;
-};
-
-/*
- * fcgi_ostream - deprecated
- */
-class fcgi_ostream : public ostream
-{
-public:
-
- // deprecated
- DLLAPI fcgi_ostream(FCGX_Stream * fcgx = NULL);
-
- // deprecated
- DLLAPI ~fcgi_ostream(void) {}
-
- // deprecated
- DLLAPI virtual void attach(FCGX_Stream *fcgx);
-
-private:
-
- fcgi_streambuf fcgi_strmbuf;
-};
-
-#endif /* FCGIO_H */
diff --git a/sapi/cgi/libfcgi/include/fcgios.h b/sapi/cgi/libfcgi/include/fcgios.h
deleted file mode 100644
index e0f8373fb7..0000000000
--- a/sapi/cgi/libfcgi/include/fcgios.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * fcgios.h --
- *
- * Description of file.
- *
- *
- * Copyright (c) 1996 Open Market, Inc.
- * All rights reserved.
- *
- * This file contains proprietary and confidential information and
- * remains the unpublished property of Open Market, Inc. Use,
- * disclosure, or reproduction is prohibited except as permitted by
- * express written license agreement with Open Market, Inc.
- *
- * Bill Snapper
- * snapper@openmarket.com
- */
-#ifndef _FCGIOS_H
-#define _FCGIOS_H
-
-#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <winsock2.h>
-#endif
-
-#include "fcgi_config.h"
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#if defined (c_plusplus) || defined (__cplusplus)
-extern "C" {
-#endif
-
-#ifdef _WIN32
-#define OS_Errno GetLastError()
-#define OS_SetErrno(err) SetLastError(err)
-#ifndef O_NONBLOCK
-#define O_NONBLOCK 0x0004 /* no delay */
-#endif
-#else /* !_WIN32 */
-#define OS_Errno errno
-#define OS_SetErrno(err) errno = (err)
-#endif /* !_WIN32 */
-
-#ifndef DLLAPI
-#ifdef _WIN32
-#if defined(_LIB) || defined(FCGI_STATIC)
-#define DLLAPI
-#else
-#define DLLAPI __declspec(dllimport)
-#endif
-#else
-#define DLLAPI
-#endif
-#endif
-
-
-/* This is the initializer for a "struct timeval" used in a select() call
- * right after a new request is accept()ed to determine readablity. Its
- * a drop-dead timer. Its only used for AF_UNIX sockets (not TCP sockets).
- * Its a workaround for a kernel bug in Linux 2.0.x and SCO Unixware.
- * Making this as small as possible, yet remain reliable would be best.
- * 2 seconds is very conservative. 0,0 is not reliable. The shorter the
- * timeout, the faster request processing will recover. The longer the
- * timeout, the more likely this application being "busy" will cause other
- * requests to abort and cause more dead sockets that need this timeout. */
-#define READABLE_UNIX_FD_DROP_DEAD_TIMEVAL 2,0
-
-#ifndef STDIN_FILENO
-#define STDIN_FILENO 0
-#endif
-
-#ifndef STDOUT_FILENO
-#define STDOUT_FILENO 1
-#endif
-
-#ifndef STDERR_FILENO
-#define STDERR_FILENO 2
-#endif
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 1024
-#endif
-
-#ifndef X_OK
-#define X_OK 0x01
-#endif
-
-#ifndef _CLIENTDATA
-# if defined(__STDC__) || defined(__cplusplus)
- typedef void *ClientData;
-# else
- typedef int *ClientData;
-# endif /* __STDC__ */
-#define _CLIENTDATA
-#endif
-#define MUTEX_VARNAME "_FCGI_MUTEX_"
-#define SHUTDOWN_EVENT_NAME "_FCGI_SHUTDOWN_EVENT_"
-
-typedef void (*OS_AsyncProc) (ClientData clientData, int len);
-
-DLLAPI int OS_LibInit(int stdioFds[3]);
-DLLAPI void OS_LibShutdown(void);
-DLLAPI int OS_CreateLocalIpcFd(const char *bindPath, int backlog, int bCreateMutex);
-DLLAPI int OS_FcgiConnect(char *bindPath);
-DLLAPI int OS_Read(int fd, char * buf, size_t len);
-DLLAPI int OS_Write(int fd, char * buf, size_t len);
-#ifdef _WIN32
-DLLAPI int OS_SpawnChild(char *execPath, int listenFd, PROCESS_INFORMATION *pInfo, char *env);
-#else
-DLLAPI int OS_SpawnChild(char *execPath, int listenfd);
-#endif
-DLLAPI int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr,
- ClientData clientData);
-DLLAPI int OS_AsyncRead(int fd, int offset, void *buf, int len,
- OS_AsyncProc procPtr, ClientData clientData);
-DLLAPI int OS_AsyncWrite(int fd, int offset, void *buf, int len,
- OS_AsyncProc procPtr, ClientData clientData);
-DLLAPI int OS_Close(int fd);
-DLLAPI int OS_CloseRead(int fd);
-DLLAPI int OS_DoIo(struct timeval *tmo);
-DLLAPI int OS_Accept(int listen_sock, int fail_on_intr, const char *webServerAddrs);
-DLLAPI int OS_IpcClose(int ipcFd);
-DLLAPI int OS_IsFcgi(int sock);
-DLLAPI void OS_SetFlags(int fd, int flags);
-
-DLLAPI void OS_ShutdownPending(void);
-
-#ifdef _WIN32
-DLLAPI int OS_SetImpersonate(void);
-#endif
-
-#if defined (__cplusplus) || defined (c_plusplus)
-} /* terminate extern "C" { */
-#endif
-
-#endif /* _FCGIOS_H */
diff --git a/sapi/cgi/libfcgi/libfcgi.m4 b/sapi/cgi/libfcgi/libfcgi.m4
deleted file mode 100644
index 28e73d46a0..0000000000
--- a/sapi/cgi/libfcgi/libfcgi.m4
+++ /dev/null
@@ -1,77 +0,0 @@
-dnl $Id$
-dnl
-dnl This file is an input file used by the GNU "autoconf" program to
-dnl generate the file "configure", which is run during the build
-dnl to configure the system for the local environment.
-
-#AC_INIT
-#AM_INIT_AUTOMAKE(fcgi, 2.2.3-SNAP-0203171857)
-
-#AM_CONFIG_HEADER(include/fcgi_config.h)
-
-#AC_PROG_CC
-#AC_PROG_CPP
-#AC_PROG_INSTALL
-#AC_PROG_LIBTOOL
-
-#AC_PROG_CXX
-
-#AC_LANG([C++])
-
-#dnl autoconf defaults CXX to 'g++', so its unclear whether it exists/works
-#AC_MSG_CHECKING([whether $CXX works])
-#AC_TRY_COMPILE([#include <iostream>],
-# [std::cout << "ok";],
-# [AC_MSG_RESULT(yes)
-# LIBFCGIXX=libfcgi++.la
-# ECHO_CPP=echo-cpp${EXEEXT}
-# AC_MSG_CHECKING([whether cin has a streambuf assignment operator])
-# AC_TRY_COMPILE([#include <iostream>],
-# [cin = static_cast<streambuf *>(0);],
-# [AC_MSG_RESULT(yes)
-# AC_DEFINE([HAVE_IOSTREAM_WITHASSIGN_STREAMBUF], [1],
-# [Define if cin/cout/cerr has a streambuf assignment operator])],
-# [AC_MSG_RESULT(no)])
-# AC_MSG_CHECKING([whether char_type is defined in the context of streambuf])
-# AC_TRY_COMPILE([#include <iostream>],
-# [class fcgi_streambuf : public std::streambuf { char_type ct; }],
-# [AC_MSG_RESULT(yes)
-# AC_DEFINE([HAVE_STREAMBUF_CHAR_TYPE], [1],
-# [Define if char_type is defined in the context of streambuf])],
-# [AC_MSG_RESULT(no)])],
-# [AC_MSG_RESULT(no)])
-#AC_SUBST(LIBFCGIXX)
-#AC_SUBST(ECHO_CPP)
-
-#AC_LANG([C])
-
-AC_CHECK_LIB([nsl], [gethostbyname])
-AC_CHECK_LIB([socket], [socket])
-
-ACX_PTHREAD([THREADED=threaded${EXEEXT}])
-AC_SUBST([THREADED])
-
-FCGI_COMMON_CHECKS
-
-AC_REPLACE_FUNCS([strerror])
-
-#AC_C_INLINE
-
-#--------------------------------------------------------------------
-# This is a little hokie in that it avoids including config.guess
-# and config.sub in the distribution, but its been working so far.
-# Windows builds don't run configure so we should be safe fixing
-# this to 'unix' (at least for now).
-#--------------------------------------------------------------------
-#SYSTEM=unix
-#AC_SUBST([SYSTEM])
-
-#AC_PROG_CC_WARNINGS
-
-#AC_CONFIG_FILES([Makefile
-# cgi-fcgi/Makefile
-# include/Makefile
-# libfcgi/Makefile
-# examples/Makefile])
-
-#AC_OUTPUT
diff --git a/sapi/cgi/libfcgi/os_unix.c b/sapi/cgi/libfcgi/os_unix.c
deleted file mode 100644
index 6d4e103272..0000000000
--- a/sapi/cgi/libfcgi/os_unix.c
+++ /dev/null
@@ -1,1268 +0,0 @@
-/*
- * os_unix.c --
- *
- * Description of file.
- *
- *
- * Copyright (c) 1995 Open Market, Inc.
- * All rights reserved.
- *
- * This file contains proprietary and confidential information and
- * remains the unpublished property of Open Market, Inc. Use,
- * disclosure, or reproduction is prohibited except as permitted by
- * express written license agreement with Open Market, Inc.
- *
- * Bill Snapper
- * snapper@openmarket.com
- */
-
-#ifndef lint
-static const char rcsid[] = "$Id$";
-#endif /* not lint */
-
-#include "fcgi_config.h"
-
-#include <sys/types.h>
-
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-#include <arpa/inet.h>
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h> /* for fcntl */
-#include <math.h>
-#include <memory.h> /* for memchr() */
-#include <netinet/tcp.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/un.h>
-#include <signal.h>
-
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h> /* for getpeername */
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include "fastcgi.h"
-#include "fcgimisc.h"
-#include "fcgios.h"
-
-#ifndef INADDR_NONE
-#define INADDR_NONE ((unsigned long) -1)
-#endif
-
-/*
- * This structure holds an entry for each oustanding async I/O operation.
- */
-typedef struct {
- OS_AsyncProc procPtr; /* callout completion procedure */
- ClientData clientData; /* caller private data */
- int fd;
- int len;
- int offset;
- void *buf;
- int inUse;
-} AioInfo;
-
-/*
- * Entries in the async I/O table are allocated 2 per file descriptor.
- *
- * Read Entry Index = fd * 2
- * Write Entry Index = (fd * 2) + 1
- */
-#define AIO_RD_IX(fd) (fd * 2)
-#define AIO_WR_IX(fd) ((fd * 2) + 1)
-
-static int asyncIoInUse = FALSE;
-static int asyncIoTableSize = 16;
-static AioInfo *asyncIoTable = NULL;
-
-static int libInitialized = FALSE;
-
-static fd_set readFdSet;
-static fd_set writeFdSet;
-
-static fd_set readFdSetPost;
-static int numRdPosted = 0;
-static fd_set writeFdSetPost;
-static int numWrPosted = 0;
-static int volatile maxFd = -1;
-
-static int shutdownPending = FALSE;
-static int shutdownNow = FALSE;
-
-void OS_ShutdownPending()
-{
- shutdownPending = TRUE;
-}
-
-static void OS_Sigusr1Handler(int signo)
-{
- OS_ShutdownPending();
-}
-
-static void OS_SigpipeHandler(int signo)
-{
- ;
-}
-
-static void installSignalHandler(int signo, const struct sigaction * act, int force)
-{
- struct sigaction sa;
-
- sigaction(signo, NULL, &sa);
-
- if (force || sa.sa_handler == SIG_DFL)
- {
- sigaction(signo, act, NULL);
- }
-}
-
-static void OS_InstallSignalHandlers(int force)
-{
- struct sigaction sa;
-
- sigemptyset(&sa.sa_mask);
- sa.sa_flags = 0;
-
- sa.sa_handler = OS_SigpipeHandler;
- installSignalHandler(SIGPIPE, &sa, force);
-
- sa.sa_handler = OS_Sigusr1Handler;
- installSignalHandler(SIGUSR1, &sa, force);
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_LibInit --
- *
- * Set up the OS library for use.
- *
- * NOTE: This function is really only needed for application
- * asynchronous I/O. It will most likely change in the
- * future to setup the multi-threaded environment.
- *
- * Results:
- * Returns 0 if success, -1 if not.
- *
- * Side effects:
- * Async I/O table allocated and initialized.
- *
- *--------------------------------------------------------------
- */
-int OS_LibInit(int stdioFds[3])
-{
- if(libInitialized)
- return 0;
-
- asyncIoTable = (AioInfo *)malloc(asyncIoTableSize * sizeof(AioInfo));
- if(asyncIoTable == NULL) {
- errno = ENOMEM;
- return -1;
- }
- memset((char *) asyncIoTable, 0,
- asyncIoTableSize * sizeof(AioInfo));
-
- FD_ZERO(&readFdSet);
- FD_ZERO(&writeFdSet);
- FD_ZERO(&readFdSetPost);
- FD_ZERO(&writeFdSetPost);
-
- OS_InstallSignalHandlers(FALSE);
-
- libInitialized = TRUE;
-
- return 0;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_LibShutdown --
- *
- * Shutdown the OS library.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Memory freed, fds closed.
- *
- *--------------------------------------------------------------
- */
-void OS_LibShutdown()
-{
- if(!libInitialized)
- return;
-
- free(asyncIoTable);
- asyncIoTable = NULL;
- libInitialized = FALSE;
- return;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * OS_BuildSockAddrUn --
- *
- * Using the pathname bindPath, fill in the sockaddr_un structure
- * *servAddrPtr and the length of this structure *servAddrLen.
- *
- * The format of the sockaddr_un structure changed incompatibly in
- * 4.3BSD Reno. Digital UNIX supports both formats, other systems
- * support one or the other.
- *
- * Results:
- * 0 for normal return, -1 for failure (bindPath too long).
- *
- *----------------------------------------------------------------------
- */
-
-static int OS_BuildSockAddrUn(const char *bindPath,
- struct sockaddr_un *servAddrPtr,
- int *servAddrLen)
-{
- int bindPathLen = strlen(bindPath);
-
-#ifdef HAVE_SOCKADDR_UN_SUN_LEN /* 4.3BSD Reno and later: BSDI, DEC */
- if(bindPathLen >= sizeof(servAddrPtr->sun_path)) {
- return -1;
- }
-#else /* 4.3 BSD Tahoe: Solaris, HPUX, DEC, ... */
- if(bindPathLen > sizeof(servAddrPtr->sun_path)) {
- return -1;
- }
-#endif
- memset((char *) servAddrPtr, 0, sizeof(*servAddrPtr));
- servAddrPtr->sun_family = AF_UNIX;
- memcpy(servAddrPtr->sun_path, bindPath, bindPathLen);
-#ifdef HAVE_SOCKADDR_UN_SUN_LEN /* 4.3BSD Reno and later: BSDI, DEC */
- *servAddrLen = sizeof(servAddrPtr->sun_len)
- + sizeof(servAddrPtr->sun_family)
- + bindPathLen + 1;
- servAddrPtr->sun_len = *servAddrLen;
-#else /* 4.3 BSD Tahoe: Solaris, HPUX, DEC, ... */
- *servAddrLen = sizeof(servAddrPtr->sun_family) + bindPathLen;
-#endif
- return 0;
-}
-union SockAddrUnion {
- struct sockaddr_un unixVariant;
- struct sockaddr_in inetVariant;
-};
-
-/*
- * OS_CreateLocalIpcFd --
- *
- * This procedure is responsible for creating the listener socket
- * on Unix for local process communication. It will create a
- * domain socket or a TCP/IP socket bound to "localhost" and return
- * a file descriptor to it to the caller.
- * bCreateMutex is ignored for unix
- *
- * Results:
- * Listener socket created. This call returns either a valid
- * file descriptor or -1 on error.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-int OS_CreateLocalIpcFd(const char *bindPath, int backlog, int bCreateMutex)
-{
- int listenSock, servLen;
- union SockAddrUnion sa;
- int tcp = FALSE;
- unsigned long tcp_ia = 0;
- char *tp;
- short port = 0;
- char host[MAXPATHLEN];
-
- strcpy(host, bindPath);
- if((tp = strchr(host, ':')) != 0) {
- *tp++ = 0;
- if((port = atoi(tp)) == 0) {
- *--tp = ':';
- } else {
- tcp = TRUE;
- }
- }
- if(tcp) {
- if (!*host || !strcmp(host,"*")) {
- tcp_ia = htonl(INADDR_ANY);
- } else {
- tcp_ia = inet_addr(host);
- if (tcp_ia == INADDR_NONE) {
- struct hostent * hep;
- hep = gethostbyname(host);
- if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) {
- fprintf(stderr, "Cannot resolve host name %s -- exiting!\n", host);
- return -1;
- }
- if (hep->h_addr_list[1]) {
- fprintf(stderr, "Host %s has multiple addresses ---\n", host);
- fprintf(stderr, "you must choose one explicitly!!!\n");
- return -1;
- }
- tcp_ia = ((struct in_addr *) (hep->h_addr))->s_addr;
- }
- }
- }
-
- if(tcp) {
- listenSock = socket(AF_INET, SOCK_STREAM, 0);
- if(listenSock >= 0) {
- int flag = 1;
- if(setsockopt(listenSock, SOL_SOCKET, SO_REUSEADDR,
- (char *) &flag, sizeof(flag)) < 0) {
- fprintf(stderr, "Can't set SO_REUSEADDR.\n");
- return -1;
- }
- }
- } else {
- listenSock = socket(AF_UNIX, SOCK_STREAM, 0);
- }
- if(listenSock < 0) {
- return -1;
- }
-
- /*
- * Bind the listening socket.
- */
- if(tcp) {
- memset((char *) &sa.inetVariant, 0, sizeof(sa.inetVariant));
- sa.inetVariant.sin_family = AF_INET;
- sa.inetVariant.sin_addr.s_addr = tcp_ia;
- sa.inetVariant.sin_port = htons(port);
- servLen = sizeof(sa.inetVariant);
- } else {
- unlink(bindPath);
- if(OS_BuildSockAddrUn(bindPath, &sa.unixVariant, &servLen)) {
- fprintf(stderr, "Listening socket's path name is too long.\n");
- return -1;
- }
- }
- if(bind(listenSock, (struct sockaddr *) &sa.unixVariant, servLen) < 0
- || listen(listenSock, backlog) < 0) {
- perror("bind/listen");
- return -1;
- }
-
- return listenSock;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * OS_FcgiConnect --
- *
- * Create the socket and connect to the remote application if
- * possible.
- *
- * This was lifted from the cgi-fcgi application and was abstracted
- * out because Windows NT does not have a domain socket and must
- * use a named pipe which has a different API altogether.
- *
- * Results:
- * -1 if fail or a valid file descriptor if connection succeeds.
- *
- * Side effects:
- * Remote connection established.
- *
- *----------------------------------------------------------------------
- */
-int OS_FcgiConnect(char *bindPath)
-{
- union SockAddrUnion sa;
- int servLen, resultSock;
- int connectStatus;
- char *tp;
- char host[MAXPATHLEN];
- short port = 0;
- int tcp = FALSE;
-
- strcpy(host, bindPath);
- if((tp = strchr(host, ':')) != 0) {
- *tp++ = 0;
- if((port = atoi(tp)) == 0) {
- *--tp = ':';
- } else {
- tcp = TRUE;
- }
- }
- if(tcp == TRUE) {
- struct hostent *hp;
- if((hp = gethostbyname((*host ? host : "localhost"))) == NULL) {
- fprintf(stderr, "Unknown host: %s\n", bindPath);
- return -1;
- }
- sa.inetVariant.sin_family = AF_INET;
- memcpy(&sa.inetVariant.sin_addr, hp->h_addr, hp->h_length);
- sa.inetVariant.sin_port = htons(port);
- servLen = sizeof(sa.inetVariant);
- resultSock = socket(AF_INET, SOCK_STREAM, 0);
- } else {
- if(OS_BuildSockAddrUn(bindPath, &sa.unixVariant, &servLen)) {
- fprintf(stderr, "Listening socket's path name is too long.\n");
- return -1;
- }
- resultSock = socket(AF_UNIX, SOCK_STREAM, 0);
- }
-
- ASSERT(resultSock >= 0);
- connectStatus = connect(resultSock, (struct sockaddr *) &sa.unixVariant,
- servLen);
- if(connectStatus >= 0) {
- return resultSock;
- } else {
- /*
- * Most likely (errno == ENOENT || errno == ECONNREFUSED)
- * and no FCGI application server is running.
- */
- close(resultSock);
- return -1;
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_Read --
- *
- * Pass through to the unix read function.
- *
- * Results:
- * Returns number of byes read, 0, or -1 failure: errno
- * contains actual error.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-int OS_Read(int fd, char * buf, size_t len)
-{
- if (shutdownNow) return -1;
- return(read(fd, buf, len));
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_Write --
- *
- * Pass through to unix write function.
- *
- * Results:
- * Returns number of byes read, 0, or -1 failure: errno
- * contains actual error.
- *
- * Side effects:
- * none.
- *
- *--------------------------------------------------------------
- */
-int OS_Write(int fd, char * buf, size_t len)
-{
- if (shutdownNow) return -1;
- return(write(fd, buf, len));
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * OS_SpawnChild --
- *
- * Spawns a new FastCGI listener process.
- *
- * Results:
- * 0 if success, -1 if error.
- *
- * Side effects:
- * Child process spawned.
- *
- *----------------------------------------------------------------------
- */
-int OS_SpawnChild(char *appPath, int listenFd)
-{
- int forkResult;
-
- forkResult = fork();
- if(forkResult < 0) {
- return -1;
- }
-
- if(forkResult == 0) {
- /*
- * Close STDIN unconditionally. It's used by the parent
- * process for CGI communication. The FastCGI applciation
- * will be replacing this with the FastCGI listenFd IF
- * STDIN_FILENO is the same as FCGI_LISTENSOCK_FILENO
- * (which it is on Unix). Regardless, STDIN, STDOUT, and
- * STDERR will be closed as the FastCGI process uses a
- * multiplexed socket in their place.
- */
- close(STDIN_FILENO);
-
- /*
- * If the listenFd is already the value of FCGI_LISTENSOCK_FILENO
- * we're set. If not, change it so the child knows where to
- * get the listen socket from.
- */
- if(listenFd != FCGI_LISTENSOCK_FILENO) {
- dup2(listenFd, FCGI_LISTENSOCK_FILENO);
- close(listenFd);
- }
-
- close(STDOUT_FILENO);
- close(STDERR_FILENO);
-
- /*
- * We're a child. Exec the application.
- *
- * XXX: entire environment passes through
- */
- execl(appPath, appPath, NULL);
- /*
- * XXX: Can't do this as we've already closed STDERR!!!
- *
- * perror("exec");
- */
- return -1;
- }
- return 0;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_AsyncReadStdin --
- *
- * This initiates an asynchronous read on the standard
- * input handle.
- *
- * The abstraction is necessary because Windows NT does not
- * have a clean way of "select"ing a file descriptor for
- * I/O.
- *
- * Results:
- * -1 if error, 0 otherwise.
- *
- * Side effects:
- * Asynchronous bit is set in the readfd variable and
- * request is enqueued.
- *
- *--------------------------------------------------------------
- */
-int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr,
- ClientData clientData)
-{
- int index = AIO_RD_IX(STDIN_FILENO);
-
- asyncIoInUse = TRUE;
- ASSERT(asyncIoTable[index].inUse == 0);
- asyncIoTable[index].procPtr = procPtr;
- asyncIoTable[index].clientData = clientData;
- asyncIoTable[index].fd = STDIN_FILENO;
- asyncIoTable[index].len = len;
- asyncIoTable[index].offset = 0;
- asyncIoTable[index].buf = buf;
- asyncIoTable[index].inUse = 1;
- FD_SET(STDIN_FILENO, &readFdSet);
- if(STDIN_FILENO > maxFd)
- maxFd = STDIN_FILENO;
- return 0;
-}
-
-static void GrowAsyncTable(void)
-{
- int oldTableSize = asyncIoTableSize;
-
- asyncIoTableSize = asyncIoTableSize * 2;
- asyncIoTable = (AioInfo *)realloc(asyncIoTable, asyncIoTableSize * sizeof(AioInfo));
- if(asyncIoTable == NULL) {
- errno = ENOMEM;
- exit(errno);
- }
- memset((char *) &asyncIoTable[oldTableSize], 0,
- oldTableSize * sizeof(AioInfo));
-
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_AsyncRead --
- *
- * This initiates an asynchronous read on the file
- * handle which may be a socket or named pipe.
- *
- * We also must save the ProcPtr and ClientData, so later
- * when the io completes, we know who to call.
- *
- * We don't look at any results here (the ReadFile may
- * return data if it is cached) but do all completion
- * processing in OS_Select when we get the io completion
- * port done notifications. Then we call the callback.
- *
- * Results:
- * -1 if error, 0 otherwise.
- *
- * Side effects:
- * Asynchronous I/O operation is queued for completion.
- *
- *--------------------------------------------------------------
- */
-int OS_AsyncRead(int fd, int offset, void *buf, int len,
- OS_AsyncProc procPtr, ClientData clientData)
-{
- int index = AIO_RD_IX(fd);
-
- ASSERT(asyncIoTable != NULL);
- asyncIoInUse = TRUE;
-
- if(fd > maxFd)
- maxFd = fd;
-
- if(index >= asyncIoTableSize) {
- GrowAsyncTable();
- }
-
- ASSERT(asyncIoTable[index].inUse == 0);
- asyncIoTable[index].procPtr = procPtr;
- asyncIoTable[index].clientData = clientData;
- asyncIoTable[index].fd = fd;
- asyncIoTable[index].len = len;
- asyncIoTable[index].offset = offset;
- asyncIoTable[index].buf = buf;
- asyncIoTable[index].inUse = 1;
- FD_SET(fd, &readFdSet);
- return 0;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_AsyncWrite --
- *
- * This initiates an asynchronous write on the "fake" file
- * descriptor (which may be a file, socket, or named pipe).
- * We also must save the ProcPtr and ClientData, so later
- * when the io completes, we know who to call.
- *
- * We don't look at any results here (the WriteFile generally
- * completes immediately) but do all completion processing
- * in OS_DoIo when we get the io completion port done
- * notifications. Then we call the callback.
- *
- * Results:
- * -1 if error, 0 otherwise.
- *
- * Side effects:
- * Asynchronous I/O operation is queued for completion.
- *
- *--------------------------------------------------------------
- */
-int OS_AsyncWrite(int fd, int offset, void *buf, int len,
- OS_AsyncProc procPtr, ClientData clientData)
-{
- int index = AIO_WR_IX(fd);
-
- asyncIoInUse = TRUE;
-
- if(fd > maxFd)
- maxFd = fd;
-
- if(index >= asyncIoTableSize) {
- GrowAsyncTable();
- }
-
- ASSERT(asyncIoTable[index].inUse == 0);
- asyncIoTable[index].procPtr = procPtr;
- asyncIoTable[index].clientData = clientData;
- asyncIoTable[index].fd = fd;
- asyncIoTable[index].len = len;
- asyncIoTable[index].offset = offset;
- asyncIoTable[index].buf = buf;
- asyncIoTable[index].inUse = 1;
- FD_SET(fd, &writeFdSet);
- return 0;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_Close --
- *
- * Closes the descriptor. This is a pass through to the
- * Unix close.
- *
- * Results:
- * 0 for success, -1 on failure
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-int OS_Close(int fd)
-{
- if (fd == -1)
- return 0;
-
- if (asyncIoInUse) {
- int index = AIO_RD_IX(fd);
-
- FD_CLR(fd, &readFdSet);
- FD_CLR(fd, &readFdSetPost);
- if (asyncIoTable[index].inUse != 0) {
- asyncIoTable[index].inUse = 0;
- }
-
- FD_CLR(fd, &writeFdSet);
- FD_CLR(fd, &writeFdSetPost);
- index = AIO_WR_IX(fd);
- if (asyncIoTable[index].inUse != 0) {
- asyncIoTable[index].inUse = 0;
- }
-
- if (maxFd == fd) {
- maxFd--;
- }
- }
- return close(fd);
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_CloseRead --
- *
- * Cancel outstanding asynchronous reads and prevent subsequent
- * reads from completing.
- *
- * Results:
- * Socket or file is shutdown. Return values mimic Unix shutdown:
- * 0 success, -1 failure
- *
- *--------------------------------------------------------------
- */
-int OS_CloseRead(int fd)
-{
- if(asyncIoTable[AIO_RD_IX(fd)].inUse != 0) {
- asyncIoTable[AIO_RD_IX(fd)].inUse = 0;
- FD_CLR(fd, &readFdSet);
- }
-
- return shutdown(fd, 0);
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_DoIo --
- *
- * This function was formerly OS_Select. It's purpose is
- * to pull I/O completion events off the queue and dispatch
- * them to the appropriate place.
- *
- * Results:
- * Returns 0.
- *
- * Side effects:
- * Handlers are called.
- *
- *--------------------------------------------------------------
- */
-int OS_DoIo(struct timeval *tmo)
-{
- int fd, len, selectStatus;
- OS_AsyncProc procPtr;
- ClientData clientData;
- AioInfo *aioPtr;
- fd_set readFdSetCpy;
- fd_set writeFdSetCpy;
-
- asyncIoInUse = TRUE;
- FD_ZERO(&readFdSetCpy);
- FD_ZERO(&writeFdSetCpy);
-
- for(fd = 0; fd <= maxFd; fd++) {
- if(FD_ISSET(fd, &readFdSet)) {
- FD_SET(fd, &readFdSetCpy);
- }
- if(FD_ISSET(fd, &writeFdSet)) {
- FD_SET(fd, &writeFdSetCpy);
- }
- }
-
- /*
- * If there were no completed events from a prior call, see if there's
- * any work to do.
- */
- if(numRdPosted == 0 && numWrPosted == 0) {
- selectStatus = select((maxFd+1), &readFdSetCpy, &writeFdSetCpy,
- NULL, tmo);
- if(selectStatus < 0) {
- /*exit(errno);*/
- /* not sure what's best to do here */
- return -1;
- }
-
- for(fd = 0; fd <= maxFd; fd++) {
- /*
- * Build up a list of completed events. We'll work off of
- * this list as opposed to looping through the read and write
- * fd sets since they can be affected by a callbacl routine.
- */
- if(FD_ISSET(fd, &readFdSetCpy)) {
- numRdPosted++;
- FD_SET(fd, &readFdSetPost);
- FD_CLR(fd, &readFdSet);
- }
-
- if(FD_ISSET(fd, &writeFdSetCpy)) {
- numWrPosted++;
- FD_SET(fd, &writeFdSetPost);
- FD_CLR(fd, &writeFdSet);
- }
- }
- }
-
- if(numRdPosted == 0 && numWrPosted == 0)
- return 0;
-
- for(fd = 0; fd <= maxFd; fd++) {
- /*
- * Do reads and dispatch callback.
- */
- if(FD_ISSET(fd, &readFdSetPost)
- && asyncIoTable[AIO_RD_IX(fd)].inUse) {
-
- numRdPosted--;
- FD_CLR(fd, &readFdSetPost);
- aioPtr = &asyncIoTable[AIO_RD_IX(fd)];
-
- len = read(aioPtr->fd, aioPtr->buf, aioPtr->len);
-
- procPtr = aioPtr->procPtr;
- aioPtr->procPtr = NULL;
- clientData = aioPtr->clientData;
- aioPtr->inUse = 0;
-
- (*procPtr)(clientData, len);
- }
-
- /*
- * Do writes and dispatch callback.
- */
- if(FD_ISSET(fd, &writeFdSetPost) &&
- asyncIoTable[AIO_WR_IX(fd)].inUse) {
-
- numWrPosted--;
- FD_CLR(fd, &writeFdSetPost);
- aioPtr = &asyncIoTable[AIO_WR_IX(fd)];
-
- len = write(aioPtr->fd, aioPtr->buf, aioPtr->len);
-
- procPtr = aioPtr->procPtr;
- aioPtr->procPtr = NULL;
- clientData = aioPtr->clientData;
- aioPtr->inUse = 0;
- (*procPtr)(clientData, len);
- }
- }
- return 0;
-}
-
-/*
- * Not all systems have strdup().
- * @@@ autoconf should determine whether or not this is needed, but for now..
- */
-static char * str_dup(const char * str)
-{
- char * sdup = (char *) malloc(strlen(str) + 1);
-
- if (sdup)
- strcpy(sdup, str);
-
- return sdup;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * ClientAddrOK --
- *
- * Checks if a client address is in a list of allowed addresses
- *
- * Results:
- * TRUE if address list is empty or client address is present
- * in the list, FALSE otherwise.
- *
- *----------------------------------------------------------------------
- */
-static int ClientAddrOK(struct sockaddr_in *saPtr, const char *clientList)
-{
- int result = FALSE;
- char *clientListCopy, *cur, *next;
-
- if (clientList == NULL || *clientList == '\0') {
- return TRUE;
- }
-
- clientListCopy = str_dup(clientList);
-
- for (cur = clientListCopy; cur != NULL; cur = next) {
- next = strchr(cur, ',');
- if (next != NULL) {
- *next++ = '\0';
- }
- if (inet_addr(cur) == saPtr->sin_addr.s_addr) {
- result = TRUE;
- break;
- }
- }
-
- free(clientListCopy);
- return result;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * AcquireLock --
- *
- * On platforms that implement concurrent calls to accept
- * on a shared listening ipcFd, returns 0. On other platforms,
- * acquires an exclusive lock across all processes sharing a
- * listening ipcFd, blocking until the lock has been acquired.
- *
- * Results:
- * 0 for successful call, -1 in case of system error (fatal).
- *
- * Side effects:
- * This process now has the exclusive lock.
- *
- *----------------------------------------------------------------------
- */
-static int AcquireLock(int sock, int fail_on_intr)
-{
-#ifdef USE_LOCKING
- do {
- struct flock lock;
- lock.l_type = F_WRLCK;
- lock.l_start = 0;
- lock.l_whence = SEEK_SET;
- lock.l_len = 0;
-
- if (fcntl(sock, F_SETLKW, &lock) != -1)
- return 0;
- } while (errno == EINTR
- && ! fail_on_intr
- && ! shutdownPending);
-
- return -1;
-
-#else
- return 0;
-#endif
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * ReleaseLock --
- *
- * On platforms that implement concurrent calls to accept
- * on a shared listening ipcFd, does nothing. On other platforms,
- * releases an exclusive lock acquired by AcquireLock.
- *
- * Results:
- * 0 for successful call, -1 in case of system error (fatal).
- *
- * Side effects:
- * This process no longer holds the lock.
- *
- *----------------------------------------------------------------------
- */
-static int ReleaseLock(int sock)
-{
-#ifdef USE_LOCKING
- do {
- struct flock lock;
- lock.l_type = F_UNLCK;
- lock.l_start = 0;
- lock.l_whence = SEEK_SET;
- lock.l_len = 0;
-
- if (fcntl(sock, F_SETLK, &lock) != -1)
- return 0;
- } while (errno == EINTR);
-
- return -1;
-
-#else
- return 0;
-#endif
-}
-
-/**********************************************************************
- * Determine if the errno resulting from a failed accept() warrants a
- * retry or exit(). Based on Apache's http_main.c accept() handling
- * and Stevens' Unix Network Programming Vol 1, 2nd Ed, para. 15.6.
- */
-static int is_reasonable_accept_errno (const int error)
-{
- switch (error) {
-#ifdef EPROTO
- /* EPROTO on certain older kernels really means ECONNABORTED, so
- * we need to ignore it for them. See discussion in new-httpd
- * archives nh.9701 search for EPROTO. Also see nh.9603, search
- * for EPROTO: There is potentially a bug in Solaris 2.x x<6, and
- * other boxes that implement tcp sockets in userland (i.e. on top of
- * STREAMS). On these systems, EPROTO can actually result in a fatal
- * loop. See PR#981 for example. It's hard to handle both uses of
- * EPROTO. */
- case EPROTO:
-#endif
-#ifdef ECONNABORTED
- case ECONNABORTED:
-#endif
- /* Linux generates the rest of these, other tcp stacks (i.e.
- * bsd) tend to hide them behind getsockopt() interfaces. They
- * occur when the net goes sour or the client disconnects after the
- * three-way handshake has been done in the kernel but before
- * userland has picked up the socket. */
-#ifdef ECONNRESET
- case ECONNRESET:
-#endif
-#ifdef ETIMEDOUT
- case ETIMEDOUT:
-#endif
-#ifdef EHOSTUNREACH
- case EHOSTUNREACH:
-#endif
-#ifdef ENETUNREACH
- case ENETUNREACH:
-#endif
- return 1;
-
- default:
- return 0;
- }
-}
-
-/**********************************************************************
- * This works around a problem on Linux 2.0.x and SCO Unixware (maybe
- * others?). When a connect() is made to a Unix Domain socket, but its
- * not accept()ed before the web server gets impatient and close()s, an
- * accept() results in a valid file descriptor, but no data to read.
- * This causes a block on the first read() - which never returns!
- *
- * Another approach to this is to write() to the socket to provoke a
- * SIGPIPE, but this is a pain because of the FastCGI protocol, the fact
- * that whatever is written has to be universally ignored by all FastCGI
- * web servers, and a SIGPIPE handler has to be installed which returns
- * (or SIGPIPE is ignored).
- *
- * READABLE_UNIX_FD_DROP_DEAD_TIMEVAL = 2,0 by default.
- *
- * Making it shorter is probably safe, but I'll leave that to you. Making
- * it 0,0 doesn't work reliably. The shorter you can reliably make it,
- * the faster your application will be able to recover (waiting 2 seconds
- * may _cause_ the problem when there is a very high demand). At any rate,
- * this is better than perma-blocking.
- */
-static int is_af_unix_keeper(const int fd)
-{
- struct timeval tval = { READABLE_UNIX_FD_DROP_DEAD_TIMEVAL };
- fd_set read_fds;
-
- FD_ZERO(&read_fds);
- FD_SET(fd, &read_fds);
-
- return select(fd + 1, &read_fds, NULL, NULL, &tval) >= 0 && FD_ISSET(fd, &read_fds);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * OS_Accept --
- *
- * Accepts a new FastCGI connection. This routine knows whether
- * we're dealing with TCP based sockets or NT Named Pipes for IPC.
- *
- * Results:
- * -1 if the operation fails, otherwise this is a valid IPC fd.
- *
- * Side effects:
- * New IPC connection is accepted.
- *
- *----------------------------------------------------------------------
- */
-int OS_Accept(int listen_sock, int fail_on_intr, const char *webServerAddrs)
-{
- int socket = -1;
- union {
- struct sockaddr_un un;
- struct sockaddr_in in;
- } sa;
-
- for (;;) {
- if (AcquireLock(listen_sock, fail_on_intr))
- return -1;
-
- for (;;) {
- do {
-#ifdef HAVE_SOCKLEN
- socklen_t len = sizeof(sa);
-#else
- int len = sizeof(sa);
-#endif
- if (shutdownPending) break;
- /* There's a window here */
-
- socket = accept(listen_sock, (struct sockaddr *)&sa, &len);
- } while (socket < 0
- && errno == EINTR
- && ! fail_on_intr
- && ! shutdownPending);
-
- if (socket < 0) {
- if (shutdownPending || ! is_reasonable_accept_errno(errno)) {
- int errnoSave = errno;
-
- ReleaseLock(listen_sock);
-
- if (! shutdownPending) {
- errno = errnoSave;
- }
-
- return (-1);
- }
- errno = 0;
- }
- else { /* socket >= 0 */
- int set = 1;
-
- if (sa.in.sin_family != AF_INET)
- break;
-
-#ifdef TCP_NODELAY
- /* No replies to outgoing data, so disable Nagle */
- setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, (char *)&set, sizeof(set));
-#endif
-
- /* Check that the client IP address is approved */
- if (ClientAddrOK(&sa.in, webServerAddrs))
- break;
-
- close(socket);
- } /* socket >= 0 */
- } /* for(;;) */
-
- if (ReleaseLock(listen_sock))
- return (-1);
-
- if (sa.in.sin_family != AF_UNIX || is_af_unix_keeper(socket))
- break;
-
- close(socket);
- } /* while(1) - lock */
-
- return (socket);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * OS_IpcClose
- *
- * OS IPC routine to close an IPC connection.
- *
- * Results:
- *
- *
- * Side effects:
- * IPC connection is closed.
- *
- *----------------------------------------------------------------------
- */
-int OS_IpcClose(int ipcFd)
-{
- return OS_Close(ipcFd);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * OS_IsFcgi --
- *
- * Determines whether this process is a FastCGI process or not.
- *
- * Results:
- * Returns 1 if FastCGI, 0 if not.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-int OS_IsFcgi(int sock)
-{
- union {
- struct sockaddr_in in;
- struct sockaddr_un un;
- } sa;
-#ifdef HAVE_SOCKLEN
- socklen_t len = sizeof(sa);
-#else
- int len = sizeof(sa);
-#endif
-
- errno = 0;
-
- if (getpeername(sock, (struct sockaddr *)&sa, &len) != 0 && errno == ENOTCONN) {
- return TRUE;
- }
- else {
- return FALSE;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * OS_SetFlags --
- *
- * Sets selected flag bits in an open file descriptor.
- *
- *----------------------------------------------------------------------
- */
-void OS_SetFlags(int fd, int flags)
-{
- int val;
- if((val = fcntl(fd, F_GETFL, 0)) < 0) {
- return;
- }
- val |= flags;
- if(fcntl(fd, F_SETFL, val) < 0) {
- return;
- }
-}
diff --git a/sapi/cgi/libfcgi/os_win32.c b/sapi/cgi/libfcgi/os_win32.c
deleted file mode 100644
index 723ef81060..0000000000
--- a/sapi/cgi/libfcgi/os_win32.c
+++ /dev/null
@@ -1,2067 +0,0 @@
-/*
- * os_win32.c --
- *
- *
- * Copyright (c) 1995 Open Market, Inc.
- * All rights reserved.
- *
- * This file contains proprietary and confidential information and
- * remains the unpublished property of Open Market, Inc. Use,
- * disclosure, or reproduction is prohibited except as permitted by
- * express written license agreement with Open Market, Inc.
- *
- * Bill Snapper
- * snapper@openmarket.com
- *
- * (Special thanks to Karen and Bill. They made my job much easier and
- * significantly more enjoyable.)
- */
-#ifndef lint
-static const char rcsid[] = "$Id$";
-#endif /* not lint */
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <winsock2.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <stdio.h>
-#include <sys/timeb.h>
-
-#define DLLAPI __declspec(dllexport)
-
-#include "fcgimisc.h"
-#include "fcgios.h"
-
-#define WIN32_OPEN_MAX 128 /* XXX: Small hack */
-
-/*
- * millisecs to wait for a client connection before checking the
- * shutdown flag (then go back to waiting for a connection, etc).
- */
-#define ACCEPT_TIMEOUT 1000
-
-#define LOCALHOST "localhost"
-
-static HANDLE hIoCompPort = INVALID_HANDLE_VALUE;
-static HANDLE hStdinCompPort = INVALID_HANDLE_VALUE;
-static HANDLE hStdinThread = INVALID_HANDLE_VALUE;
-
-static HANDLE stdioHandles[3] = {INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE,
- INVALID_HANDLE_VALUE};
-
-static HANDLE acceptMutex = INVALID_HANDLE_VALUE;
-
-static BOOLEAN shutdownPending = FALSE;
-static BOOLEAN shutdownNow = FALSE;
-
-static BOOLEAN bImpersonate = FALSE;
-/*
- * An enumeration of the file types
- * supported by the FD_TABLE structure.
- *
- * XXX: Not all currently supported. This allows for future
- * functionality.
- */
-typedef enum {
- FD_UNUSED,
- FD_FILE_SYNC,
- FD_FILE_ASYNC,
- FD_SOCKET_SYNC,
- FD_SOCKET_ASYNC,
- FD_PIPE_SYNC,
- FD_PIPE_ASYNC
-} FILE_TYPE;
-
-typedef union {
- HANDLE fileHandle;
- SOCKET sock;
- unsigned int value;
-} DESCRIPTOR;
-
-/*
- * Structure used to map file handle and socket handle
- * values into values that can be used to create unix-like
- * select bitmaps, read/write for both sockets/files.
- */
-struct FD_TABLE {
- DESCRIPTOR fid;
- FILE_TYPE type;
- char *path;
- DWORD Errno;
- unsigned long instance;
- int status;
- int offset; /* only valid for async file writes */
- LPDWORD offsetHighPtr; /* pointers to offset high and low words */
- LPDWORD offsetLowPtr; /* only valid for async file writes (logs) */
- HANDLE hMapMutex; /* mutex handle for multi-proc offset update */
- LPVOID ovList; /* List of associated OVERLAPPED_REQUESTs */
-};
-
-/*
- * XXX Note there is no dyanmic sizing of this table, so if the
- * number of open file descriptors exceeds WIN32_OPEN_MAX the
- * app will blow up.
- */
-static struct FD_TABLE fdTable[WIN32_OPEN_MAX];
-
-static CRITICAL_SECTION fdTableCritical;
-
-struct OVERLAPPED_REQUEST {
- OVERLAPPED overlapped;
- unsigned long instance; /* file instance (won't match after a close) */
- OS_AsyncProc procPtr; /* callback routine */
- ClientData clientData; /* callback argument */
- ClientData clientData1; /* additional clientData */
-};
-typedef struct OVERLAPPED_REQUEST *POVERLAPPED_REQUEST;
-
-static const char *bindPathPrefix = "\\\\.\\pipe\\FastCGI\\";
-
-static FILE_TYPE listenType = FD_UNUSED;
-
-// XXX This should be a DESCRIPTOR
-static HANDLE hListen = INVALID_HANDLE_VALUE;
-
-static OVERLAPPED listenOverlapped;
-static BOOLEAN libInitialized = FALSE;
-
-/*
- *--------------------------------------------------------------
- *
- * Win32NewDescriptor --
- *
- * Set up for I/O descriptor masquerading.
- *
- * Results:
- * Returns "fake id" which masquerades as a UNIX-style "small
- * non-negative integer" file/socket descriptor.
- * Win32_* routine below will "do the right thing" based on the
- * descriptor's actual type. -1 indicates failure.
- *
- * Side effects:
- * Entry in fdTable is reserved to represent the socket/file.
- *
- *--------------------------------------------------------------
- */
-static int Win32NewDescriptor(FILE_TYPE type, int fd, int desiredFd)
-{
- int index = -1;
-
- EnterCriticalSection(&fdTableCritical);
-
- /*
- * If desiredFd is set, try to get this entry (this is used for
- * mapping stdio handles). Otherwise try to get the fd entry.
- * If this is not available, find a the first empty slot. .
- */
- if (desiredFd >= 0 && desiredFd < WIN32_OPEN_MAX)
- {
- if (fdTable[desiredFd].type == FD_UNUSED)
- {
- index = desiredFd;
- }
- }
- else if (fd > 0)
- {
- if (fd < WIN32_OPEN_MAX && fdTable[fd].type == FD_UNUSED)
- {
- index = fd;
- }
- else
- {
- int i;
-
- for (i = 1; i < WIN32_OPEN_MAX; ++i)
- {
- if (fdTable[i].type == FD_UNUSED)
- {
- index = i;
- break;
- }
- }
- }
- }
-
- if (index != -1)
- {
- fdTable[index].fid.value = fd;
- fdTable[index].type = type;
- fdTable[index].path = NULL;
- fdTable[index].Errno = NO_ERROR;
- fdTable[index].status = 0;
- fdTable[index].offset = -1;
- fdTable[index].offsetHighPtr = fdTable[index].offsetLowPtr = NULL;
- fdTable[index].hMapMutex = NULL;
- fdTable[index].ovList = NULL;
- }
-
- LeaveCriticalSection(&fdTableCritical);
- return index;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * StdinThread--
- *
- * This thread performs I/O on stadard input. It is needed
- * because you can't guarantee that all applications will
- * create standard input with sufficient access to perform
- * asynchronous I/O. Since we don't want to block the app
- * reading from stdin we make it look like it's using I/O
- * completion ports to perform async I/O.
- *
- * Results:
- * Data is read from stdin and posted to the io completion
- * port.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-static void StdinThread(LPDWORD startup){
-
- int doIo = TRUE;
- unsigned long fd;
- unsigned long bytesRead;
- POVERLAPPED_REQUEST pOv;
-
- // Touch the arg to prevent warning
- startup = NULL;
-
- while(doIo) {
- /*
- * Block until a request to read from stdin comes in or a
- * request to terminate the thread arrives (fd = -1).
- */
- if (!GetQueuedCompletionStatus(hStdinCompPort, &bytesRead, &fd,
- (LPOVERLAPPED *)&pOv, (DWORD)-1) && !pOv) {
- doIo = 0;
- break;
- }
-
- ASSERT((fd == STDIN_FILENO) || (fd == -1));
- if(fd == -1) {
- doIo = 0;
- break;
- }
- ASSERT(pOv->clientData1 != NULL);
-
- if(ReadFile(stdioHandles[STDIN_FILENO], pOv->clientData1, bytesRead,
- &bytesRead, NULL)) {
- PostQueuedCompletionStatus(hIoCompPort, bytesRead,
- STDIN_FILENO, (LPOVERLAPPED)pOv);
- } else {
- doIo = 0;
- break;
- }
- }
-
- ExitThread(0);
-}
-
-void OS_ShutdownPending(void)
-{
- shutdownPending = TRUE;
-}
-
-/* XXX Need a shutdown now event */
-static DWORD WINAPI ShutdownRequestThread(LPVOID arg)
-{
- HANDLE shutdownEvent = (HANDLE) arg;
- WaitForSingleObject(shutdownEvent, INFINITE);
- shutdownPending = TRUE;
- // Before an accept() is entered the shutdownPending flag is checked.
- // If set, OS_Accept() will return -1. If not, it waits
- // on a connection request for one second, checks the flag, & repeats.
- // Only one process/thread is allowed to do this at time by
- // wrapping the accept() with mutex.
- return 0;
-}
-
-int OS_SetImpersonate(void)
-{
- char *os_name = NULL;
- os_name = getenv("OS");
- if (os_name && stricmp(os_name, "Windows_NT") == 0) {
- bImpersonate = TRUE;
- return 1;
- }
- return 0;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_LibInit --
- *
- * Set up the OS library for use.
- *
- * Results:
- * Returns 0 if success, -1 if not.
- *
- * Side effects:
- * Sockets initialized, pseudo file descriptors setup, etc.
- *
- *--------------------------------------------------------------
- */
-int OS_LibInit(int stdioFds[3])
-{
- WORD wVersion;
- WSADATA wsaData;
- int err;
- int fakeFd;
- DWORD threadId;
- char *cLenPtr = NULL;
- char *val = NULL;
-
- if(libInitialized)
- return 0;
-
- InitializeCriticalSection(&fdTableCritical);
-
- /*
- * Initialize windows sockets library.
- */
- wVersion = MAKEWORD(2,0);
- err = WSAStartup( wVersion, &wsaData );
- if (err) {
- fprintf(stderr, "Error starting Windows Sockets. Error: %d",
- WSAGetLastError());
- //exit(111);
- return -1;
- }
-
- /*
- * Create the I/O completion port to be used for our I/O queue.
- */
- if (hIoCompPort == INVALID_HANDLE_VALUE) {
- hIoCompPort = CreateIoCompletionPort (INVALID_HANDLE_VALUE, NULL,
- 0, 1);
- if(hIoCompPort == INVALID_HANDLE_VALUE) {
- printf("<H2>OS_LibInit Failed CreateIoCompletionPort! ERROR: %d</H2>\r\n\r\n",
- GetLastError());
- return -1;
- }
- }
-
- /*
- * If a shutdown event is in the env, save it (I don't see any to
- * remove it from the environment out from under the application).
- * Spawn a thread to wait on the shutdown request.
- */
- val = getenv(SHUTDOWN_EVENT_NAME);
- if (val != NULL)
- {
- HANDLE shutdownEvent = (HANDLE) atoi(val);
-
- if (! CreateThread(NULL, 0, ShutdownRequestThread,
- shutdownEvent, 0, NULL))
- {
- return -1;
- }
- }
-
- /*
- * If an accept mutex is in the env, save it and remove it.
- */
- val = getenv(MUTEX_VARNAME);
- if (val != NULL)
- {
- acceptMutex = (HANDLE) atoi(val);
- }
-
-
- /*
- * Determine if this library is being used to listen for FastCGI
- * connections. This is communicated by STDIN containing a
- * valid handle to a listener object. In this case, both the
- * "stdout" and "stderr" handles will be INVALID (ie. closed) by
- * the starting process.
- *
- * The trick is determining if this is a pipe or a socket...
- *
- * XXX: Add the async accept test to determine socket or handle to a
- * pipe!!!
- */
- if((GetStdHandle(STD_OUTPUT_HANDLE) == INVALID_HANDLE_VALUE) &&
- (GetStdHandle(STD_ERROR_HANDLE) == INVALID_HANDLE_VALUE) &&
- (GetStdHandle(STD_INPUT_HANDLE) != INVALID_HANDLE_VALUE) )
- {
- DWORD pipeMode = PIPE_READMODE_BYTE | PIPE_WAIT;
- HANDLE oldStdIn = GetStdHandle(STD_INPUT_HANDLE);
-
- // Move the handle to a "low" number
- if (! DuplicateHandle(GetCurrentProcess(), oldStdIn,
- GetCurrentProcess(), &hListen,
- 0, TRUE, DUPLICATE_SAME_ACCESS))
- {
- return -1;
- }
-
- if (! SetStdHandle(STD_INPUT_HANDLE, hListen))
- {
- return -1;
- }
-
- CloseHandle(oldStdIn);
-
- /*
- * Set the pipe handle state so that it operates in wait mode.
- *
- * NOTE: The listenFd is not mapped to a pseudo file descriptor
- * as all work done on it is contained to the OS library.
- *
- * XXX: Initial assumption is that SetNamedPipeHandleState will
- * fail if this is an IP socket...
- */
- if (SetNamedPipeHandleState(hListen, &pipeMode, NULL, NULL))
- {
- listenType = FD_PIPE_SYNC;
- listenOverlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- }
- else
- {
- listenType = FD_SOCKET_SYNC;
- }
- }
-
- /*
- * If there are no stdioFds passed in, we're done.
- */
- if(stdioFds == NULL) {
- libInitialized = 1;
- return 0;
- }
-
- /*
- * Setup standard input asynchronous I/O. There is actually a separate
- * thread spawned for this purpose. The reason for this is that some
- * web servers use anonymous pipes for the connection between itself
- * and a CGI application. Anonymous pipes can't perform asynchronous
- * I/O or use I/O completion ports. Therefore in order to present a
- * consistent I/O dispatch model to an application we emulate I/O
- * completion port behavior by having the standard input thread posting
- * messages to the hIoCompPort which look like a complete overlapped
- * I/O structure. This keeps the event dispatching simple from the
- * application perspective.
- */
- stdioHandles[STDIN_FILENO] = GetStdHandle(STD_INPUT_HANDLE);
-
- if(!SetHandleInformation(stdioHandles[STDIN_FILENO],
- HANDLE_FLAG_INHERIT, 0)) {
-/*
- * XXX: Causes error when run from command line. Check KB
- err = GetLastError();
- DebugBreak();
- exit(99);
- */
- return -1;
- }
-
- if ((fakeFd = Win32NewDescriptor(FD_PIPE_SYNC,
- (int)stdioHandles[STDIN_FILENO],
- STDIN_FILENO)) == -1) {
- return -1;
- } else {
- /*
- * Set stdin equal to our pseudo FD and create the I/O completion
- * port to be used for async I/O.
- */
- stdioFds[STDIN_FILENO] = fakeFd;
- }
-
- /*
- * Create the I/O completion port to be used for communicating with
- * the thread doing I/O on standard in. This port will carry read
- * and possibly thread termination requests to the StdinThread.
- */
- if (hStdinCompPort == INVALID_HANDLE_VALUE) {
- hStdinCompPort = CreateIoCompletionPort (INVALID_HANDLE_VALUE, NULL,
- 0, 1);
- if(hStdinCompPort == INVALID_HANDLE_VALUE) {
- printf("<H2>OS_LibInit Failed CreateIoCompletionPort: STDIN! ERROR: %d</H2>\r\n\r\n",
- GetLastError());
- return -1;
- }
- }
-
- /*
- * Create the thread that will read stdin if the CONTENT_LENGTH
- * is non-zero.
- */
- if((cLenPtr = getenv("CONTENT_LENGTH")) != NULL &&
- atoi(cLenPtr) > 0) {
- hStdinThread = CreateThread(NULL, 8192,
- (LPTHREAD_START_ROUTINE)&StdinThread,
- NULL, 0, &threadId);
- if (hStdinThread == NULL) {
- printf("<H2>OS_LibInit Failed to create STDIN thread! ERROR: %d</H2>\r\n\r\n",
- GetLastError());
- return -1;
- }
- }
-
- /*
- * STDOUT will be used synchronously.
- *
- * XXX: May want to convert this so that it could be used for OVERLAPPED
- * I/O later. If so, model it after the Stdin I/O as stdout is
- * also incapable of async I/O on some servers.
- */
- stdioHandles[STDOUT_FILENO] = GetStdHandle(STD_OUTPUT_HANDLE);
- if(!SetHandleInformation(stdioHandles[STDOUT_FILENO],
- HANDLE_FLAG_INHERIT, FALSE)) {
- //exit(99);
- return -1;
- }
-
- if ((fakeFd = Win32NewDescriptor(FD_PIPE_SYNC,
- (int)stdioHandles[STDOUT_FILENO],
- STDOUT_FILENO)) == -1) {
- return -1;
- } else {
- /*
- * Set stdout equal to our pseudo FD
- */
- stdioFds[STDOUT_FILENO] = fakeFd;
- }
-
- stdioHandles[STDERR_FILENO] = GetStdHandle(STD_ERROR_HANDLE);
- if(!SetHandleInformation(stdioHandles[STDERR_FILENO],
- HANDLE_FLAG_INHERIT, FALSE)) {
- //exit(99);
- return -1;
- }
- if ((fakeFd = Win32NewDescriptor(FD_PIPE_SYNC,
- (int)stdioHandles[STDERR_FILENO],
- STDERR_FILENO)) == -1) {
- return -1;
- } else {
- /*
- * Set stderr equal to our pseudo FD
- */
- stdioFds[STDERR_FILENO] = fakeFd;
- }
-
- return 0;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_LibShutdown --
- *
- * Shutdown the OS library.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Memory freed, handles closed.
- *
- *--------------------------------------------------------------
- */
-void OS_LibShutdown()
-{
-
- if (hIoCompPort != INVALID_HANDLE_VALUE)
- {
- CloseHandle(hIoCompPort);
- hIoCompPort = INVALID_HANDLE_VALUE;
- }
-
- if (hStdinCompPort != INVALID_HANDLE_VALUE)
- {
- CloseHandle(hStdinCompPort);
- hStdinCompPort = INVALID_HANDLE_VALUE;
- }
-
- if (acceptMutex != INVALID_HANDLE_VALUE)
- {
- ReleaseMutex(acceptMutex);
- CloseHandle(acceptMutex);
- }
-
- /* we only want to do this if we're not a web server */
- if (stdioHandles[0] != INVALID_HANDLE_VALUE) {
- DisconnectNamedPipe(hListen);
- CancelIo(hListen);
- if (bImpersonate) RevertToSelf();
- }
-
- DeleteCriticalSection(&fdTableCritical);
- WSACleanup();
-}
-
-/*
- *--------------------------------------------------------------
- *
- * Win32FreeDescriptor --
- *
- * Free I/O descriptor entry in fdTable.
- *
- * Results:
- * Frees I/O descriptor entry in fdTable.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-static void Win32FreeDescriptor(int fd)
-{
- /* Catch it if fd is a bogus value */
- ASSERT((fd >= 0) && (fd < WIN32_OPEN_MAX));
-
- EnterCriticalSection(&fdTableCritical);
-
- if (fdTable[fd].type != FD_UNUSED)
- {
- switch (fdTable[fd].type)
- {
- case FD_FILE_SYNC:
- case FD_FILE_ASYNC:
-
- /* Free file path string */
- ASSERT(fdTable[fd].path != NULL);
-
- free(fdTable[fd].path);
- fdTable[fd].path = NULL;
- break;
- case FD_PIPE_ASYNC:
- break;
- default:
- break;
- }
-
- ASSERT(fdTable[fd].path == NULL);
-
- fdTable[fd].type = FD_UNUSED;
- fdTable[fd].path = NULL;
- fdTable[fd].Errno = NO_ERROR;
- fdTable[fd].offsetHighPtr = fdTable[fd].offsetLowPtr = NULL;
-
- if (fdTable[fd].hMapMutex != NULL)
- {
- CloseHandle(fdTable[fd].hMapMutex);
- fdTable[fd].hMapMutex = NULL;
- }
- }
-
- LeaveCriticalSection(&fdTableCritical);
-
- return;
-}
-
-static short getPort(const char * bindPath)
-{
- short port = 0;
- char * p = strchr(bindPath, ':');
-
- if (p && *++p)
- {
- char buf[6];
-
- strncpy(buf, p, 6);
- buf[5] = '\0';
-
- port = (short) atoi(buf);
- }
-
- return port;
-}
-
-/**
-This function builds a Dacl which grants the creator of the objects
-FILE_ALL_ACCESS and Everyone FILE_GENERIC_READ and FILE_GENERIC_WRITE
-access to the object.
-
-This Dacl allows for higher security than a NULL Dacl, which is common for
-named-pipes, as this only grants the creator/owner write access to the
-security descriptor, and grants Everyone the ability to "use" the named-pipe.
-This scenario prevents a malevolent user from disrupting service by preventing
-arbitrary access manipulation.
-**/
-BOOL
-BuildNamedPipeAcl(
- PACL pAcl,
- PDWORD cbAclSize
- )
-{
- DWORD dwAclSize;
-
- SID_IDENTIFIER_AUTHORITY siaWorld = SECURITY_WORLD_SID_AUTHORITY;
- SID_IDENTIFIER_AUTHORITY siaCreator = SECURITY_CREATOR_SID_AUTHORITY;
-
- BYTE BufEveryoneSid[32];
- BYTE BufOwnerSid[32];
-
- PSID pEveryoneSid = (PSID)BufEveryoneSid;
- PSID pOwnerSid = (PSID)BufOwnerSid;
-
- //
- // compute size of acl
- //
- dwAclSize = sizeof(ACL) +
- 2 * ( sizeof(ACCESS_ALLOWED_ACE) - sizeof(DWORD) ) +
- GetSidLengthRequired( 1 ) + // well-known Everyone Sid
- GetSidLengthRequired( 1 ) ; // well-known Creator Owner Sid
-
- if(*cbAclSize < dwAclSize) {
- *cbAclSize = dwAclSize;
- return FALSE;
- }
-
- *cbAclSize = dwAclSize;
-
- //
- // intialize well known sids
- //
-
- if(!InitializeSid(pEveryoneSid, &siaWorld, 1)) return FALSE;
- *GetSidSubAuthority(pEveryoneSid, 0) = SECURITY_WORLD_RID;
-
- if(!InitializeSid(pOwnerSid, &siaCreator, 1)) return FALSE;
- *GetSidSubAuthority(pOwnerSid, 0) = SECURITY_CREATOR_OWNER_RID;
-
- if(!InitializeAcl(pAcl, dwAclSize, ACL_REVISION))
- return FALSE;
-
- //
- //
- if(!AddAccessAllowedAce(
- pAcl,
- ACL_REVISION,
- FILE_GENERIC_READ | FILE_GENERIC_WRITE,
- pEveryoneSid
- ))
- return FALSE;
-
- //
- //
- return AddAccessAllowedAce(
- pAcl,
- ACL_REVISION,
- FILE_ALL_ACCESS,
- pOwnerSid
- );
-}
-
-
-/*
- * OS_CreateLocalIpcFd --
- *
- * This procedure is responsible for creating the listener pipe
- * on Windows NT for local process communication. It will create a
- * named pipe and return a file descriptor to it to the caller.
- *
- * Results:
- * Listener pipe created. This call returns either a valid
- * pseudo file descriptor or -1 on error.
- *
- * Side effects:
- * Listener pipe and IPC address are stored in the FCGI info
- * structure.
- * 'errno' will set on errors (-1 is returned).
- *
- *----------------------------------------------------------------------
- */
-int OS_CreateLocalIpcFd(const char *bindPath, int backlog, int bCreateMutex)
-{
- int pseudoFd = -1;
- short port = getPort(bindPath);
- HANDLE mutex = INVALID_HANDLE_VALUE;
- char mutexEnvString[100];
-
- if (bCreateMutex) {
- mutex = CreateMutex(NULL, FALSE, NULL);
- if (! SetHandleInformation(mutex, HANDLE_FLAG_INHERIT, TRUE))
- {
- CloseHandle(mutex);
- return -3;
- }
- // This is a nail for listening to more than one port..
- // This should really be handled by the caller.
- _snprintf(mutexEnvString, sizeof(mutexEnvString)-1, MUTEX_VARNAME "=%d", (int) mutex);
- putenv(mutexEnvString);
- }
-
- // There's nothing to be gained (at the moment) by a shutdown Event
-
- if (port && *bindPath != ':' && strncmp(bindPath, LOCALHOST, strlen(LOCALHOST)))
- {
- fprintf(stderr, "To start a service on a TCP port can not "
- "specify a host name.\n"
- "You should either use \"localhost:<port>\" or "
- " just use \":<port>.\"\n");
- //exit(1);
- if (bCreateMutex) CloseHandle(mutexEnvString);
- return -1;
- }
-
- listenType = (port) ? FD_SOCKET_SYNC : FD_PIPE_ASYNC;
-
- if (port)
- {
- SOCKET listenSock;
- struct sockaddr_in sockAddr;
- int sockLen = sizeof(sockAddr);
-
- memset(&sockAddr, 0, sizeof(sockAddr));
- sockAddr.sin_family = AF_INET;
- sockAddr.sin_addr.s_addr = htonl(INADDR_ANY);
- sockAddr.sin_port = htons(port);
-
- listenSock = socket(AF_INET, SOCK_STREAM, 0);
- if (listenSock == INVALID_SOCKET)
- {
- if (bCreateMutex)CloseHandle(mutexEnvString);
- return -4;
- }
-
- if (bind(listenSock, (struct sockaddr *) &sockAddr, sockLen) )
- {
- if (bCreateMutex)CloseHandle(mutexEnvString);
- return -12;
- }
-
- if (listen(listenSock, backlog))
- {
- if (bCreateMutex)CloseHandle(mutexEnvString);
- return -5;
- }
-
- pseudoFd = Win32NewDescriptor(listenType, listenSock, -1);
-
- if (pseudoFd == -1)
- {
- if (bCreateMutex)CloseHandle(mutexEnvString);
- closesocket(listenSock);
- return -6;
- }
-
- hListen = (HANDLE) listenSock;
- }
- else
- {
- SECURITY_ATTRIBUTES sa;
- SECURITY_DESCRIPTOR sd;
- BYTE AclBuf[ 64 ];
- DWORD cbAclSize = 64;
- PACL pAcl = (PACL)AclBuf;
-
- HANDLE hListenPipe = INVALID_HANDLE_VALUE;
- char *pipePath = malloc(strlen(bindPathPrefix) + strlen(bindPath) + 1);
-
- if (! pipePath)
- {
- if (bCreateMutex)CloseHandle(mutexEnvString);
- return -7;
- }
-
- strcpy(pipePath, bindPathPrefix);
- strcat(pipePath, bindPath);
-
- if (bImpersonate) {
- // get the security attributes for Everybody to connect
- // we do this so that multithreaded servers that run
- // threads under secured users can access pipes created
- // by a system level thread (for instance, IIS)
- //
- // suppress errors regarding startup directory, etc
- //
- SetErrorMode(SEM_FAILCRITICALERRORS);
-
- if(!BuildNamedPipeAcl(pAcl, &cbAclSize)) {
- fprintf(stderr, "BuildNamedPipeAcl");
- return -100;
- }
-
- if(!InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION)) {
- fprintf(stderr, "InitializeSecurityDescriptor");
- return -100;
- }
-
- if(!SetSecurityDescriptorDacl(&sd, TRUE, pAcl, FALSE)) {
- fprintf(stderr, "SetSecurityDescriptorDacl");
- return -100;
- }
-
- sa.nLength = sizeof(SECURITY_ATTRIBUTES);
- sa.lpSecurityDescriptor = &sd; // default Dacl of caller
- sa.bInheritHandle = TRUE;
-
- }
-
- hListenPipe = CreateNamedPipe(pipePath,
- PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
- PIPE_TYPE_BYTE | PIPE_WAIT | PIPE_READMODE_BYTE,
- PIPE_UNLIMITED_INSTANCES,
- 4096, 4096, 0, bImpersonate?&sa:NULL);
-
- free(pipePath);
-
- if (hListenPipe == INVALID_HANDLE_VALUE)
- {
- if (bCreateMutex)CloseHandle(mutexEnvString);
- return -8;
- }
-
- if (! SetHandleInformation(hListenPipe, HANDLE_FLAG_INHERIT, TRUE))
- {
- if (bCreateMutex)CloseHandle(mutexEnvString);
- return -9;
- }
-
- pseudoFd = Win32NewDescriptor(listenType, (int) hListenPipe, -1);
-
- if (pseudoFd == -1)
- {
- if (bCreateMutex)CloseHandle(mutexEnvString);
- CloseHandle(hListenPipe);
- return -10;
- }
-
- hListen = (HANDLE) hListenPipe;
- }
-
- return pseudoFd;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * OS_FcgiConnect --
- *
- * Create the pipe pathname connect to the remote application if
- * possible.
- *
- * Results:
- * -1 if fail or a valid handle if connection succeeds.
- *
- * Side effects:
- * Remote connection established.
- *
- *----------------------------------------------------------------------
- */
-int OS_FcgiConnect(char *bindPath)
-{
- short port = getPort(bindPath);
- int pseudoFd = -1;
- unsigned int flags = FILE_FLAG_OVERLAPPED;
- if (port)
- {
- struct hostent *hp;
- char *host = NULL;
- struct sockaddr_in sockAddr;
- int sockLen = sizeof(sockAddr);
- SOCKET sock;
-
- if (*bindPath != ':')
- {
- char * p = strchr(bindPath, ':');
- if (p) {
- int len = p - bindPath + 1;
-
- host = (char *)malloc(len);
- if (!host) {
- fprintf(stderr, "Unable to allocate memory\n");
- return -1;
- }
- strncpy(host, bindPath, len);
- host[len-1] = '\0';
- }
- }
-
- hp = gethostbyname(host ? host : LOCALHOST);
-
- if (host)
- {
- free(host);
- }
-
- if (hp == NULL)
- {
- fprintf(stderr, "Unknown host: %s\n", bindPath);
- return -1;
- }
-
- memset(&sockAddr, 0, sizeof(sockAddr));
- sockAddr.sin_family = AF_INET;
- memcpy(&sockAddr.sin_addr, hp->h_addr, hp->h_length);
- sockAddr.sin_port = htons(port);
-
- sock = socket(AF_INET, SOCK_STREAM, 0);
- if (sock == INVALID_SOCKET)
- {
- return -1;
- }
-
- if (connect(sock, (struct sockaddr *) &sockAddr, sockLen) == SOCKET_ERROR)
- {
- closesocket(sock);
- return -1;
- }
-
- pseudoFd = Win32NewDescriptor(FD_SOCKET_SYNC, sock, -1);
- if (pseudoFd == -1)
- {
- closesocket(sock);
- return -1;
- }
- }
- else
- {
- char *pipePath = malloc(strlen(bindPathPrefix) + strlen(bindPath) + 1);
- HANDLE hPipe;
-
- if (! pipePath)
- {
- return -1;
- }
-
- strcpy(pipePath, bindPathPrefix);
- strcat(pipePath, bindPath);
-
- if (bImpersonate) {
- flags |= SECURITY_SQOS_PRESENT | SECURITY_IMPERSONATION;
- }
-
- hPipe = CreateFile(pipePath,
- GENERIC_WRITE | GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- flags,
- NULL);
-
- free(pipePath);
-
- if( hPipe == INVALID_HANDLE_VALUE || hPipe == 0)
- {
- return -1;
- }
-
- pseudoFd = Win32NewDescriptor(FD_PIPE_ASYNC, (int) hPipe, -1);
-
- if (pseudoFd == -1)
- {
- CloseHandle(hPipe);
- return -1;
- }
-
- /*
- * Set stdin equal to our pseudo FD and create the I/O completion
- * port to be used for async I/O.
- */
- if (! CreateIoCompletionPort(hPipe, hIoCompPort, pseudoFd, 1))
- {
- Win32FreeDescriptor(pseudoFd);
- CloseHandle(hPipe);
- return -1;
- }
- }
-
- return pseudoFd;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_Read --
- *
- * Pass through to the appropriate NT read function.
- *
- * Results:
- * Returns number of byes read. Mimics unix read:.
- * n bytes read, 0 or -1 failure: errno contains actual error
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-int OS_Read(int fd, char * buf, size_t len)
-{
- DWORD bytesRead;
- int ret = -1;
-
- ASSERT((fd >= 0) && (fd < WIN32_OPEN_MAX));
-
- if (shutdownNow) return -1;
-
- switch (fdTable[fd].type)
- {
- case FD_FILE_SYNC:
- case FD_FILE_ASYNC:
- case FD_PIPE_SYNC:
- case FD_PIPE_ASYNC:
-
- if (ReadFile(fdTable[fd].fid.fileHandle, buf, len, &bytesRead, NULL))
- {
- ret = bytesRead;
- }
- else
- {
- fdTable[fd].Errno = GetLastError();
- ret = -1;
- }
-
- break;
-
- case FD_SOCKET_SYNC:
- case FD_SOCKET_ASYNC:
-
- ret = recv(fdTable[fd].fid.sock, buf, len, 0);
- if (ret == SOCKET_ERROR)
- {
- fdTable[fd].Errno = WSAGetLastError();
- ret = -1;
- }
-
- break;
-
- default:
-
- ASSERT(0);
- }
-
- return ret;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_Write --
- *
- * Perform a synchronous OS write.
- *
- * Results:
- * Returns number of bytes written. Mimics unix write:
- * n bytes written, 0 or -1 failure (??? couldn't find man page).
- *
- * Side effects:
- * none.
- *
- *--------------------------------------------------------------
- */
-int OS_Write(int fd, char * buf, size_t len)
-{
- DWORD bytesWritten;
- int ret = -1;
-
- ASSERT(fd >= 0 && fd < WIN32_OPEN_MAX);
-
- if (shutdownNow) return -1;
-
- switch (fdTable[fd].type)
- {
- case FD_FILE_SYNC:
- case FD_FILE_ASYNC:
- case FD_PIPE_SYNC:
- case FD_PIPE_ASYNC:
-
- if (WriteFile(fdTable[fd].fid.fileHandle, buf, len, &bytesWritten, NULL))
- {
- ret = bytesWritten;
- }
- else
- {
- fdTable[fd].Errno = GetLastError();
- }
-
- break;
-
- case FD_SOCKET_SYNC:
- case FD_SOCKET_ASYNC:
-
- ret = send(fdTable[fd].fid.sock, buf, len, 0);
- if (ret == SOCKET_ERROR)
- {
- fdTable[fd].Errno = WSAGetLastError();
- ret = -1;
- }
-
- break;
-
- default:
-
- ASSERT(0);
- }
-
- return ret;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * OS_SpawnChild --
- *
- * Spawns a new server listener process, and stores the information
- * relating to the child in the supplied record. A wait handler is
- * registered on the child's completion. This involves creating
- * a process on NT and preparing a command line with the required
- * state (currently a -childproc flag and the server socket to use
- * for accepting connections).
- *
- * Results:
- * 0 if success, -1 if error.
- *
- * Side effects:
- * Child process spawned.
- *
- *----------------------------------------------------------------------
- */
-int OS_SpawnChild(char *execPath, int listenFd, PROCESS_INFORMATION *pInfo, char *env)
-{
- STARTUPINFO StartupInfo;
- BOOL success;
-
- memset((void *)&StartupInfo, 0, sizeof(STARTUPINFO));
- StartupInfo.cb = sizeof (STARTUPINFO);
- StartupInfo.lpReserved = NULL;
- StartupInfo.lpReserved2 = NULL;
- StartupInfo.cbReserved2 = 0;
- StartupInfo.lpDesktop = NULL;
- StartupInfo.wShowWindow = SW_HIDE;
- /*
- * FastCGI on NT will set the listener pipe HANDLE in the stdin of
- * the new process. The fact that there is a stdin and NULL handles
- * for stdout and stderr tells the FastCGI process that this is a
- * FastCGI process and not a CGI process.
- */
- StartupInfo.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
- /*
- * XXX: Do I have to dup the handle before spawning the process or is
- * it sufficient to use the handle as it's reference counted
- * by NT anyway?
- */
- StartupInfo.hStdInput = fdTable[listenFd].fid.fileHandle;
- StartupInfo.hStdOutput = INVALID_HANDLE_VALUE;
- StartupInfo.hStdError = INVALID_HANDLE_VALUE;
-
- /*
- * Make the listener socket inheritable.
- */
- success = SetHandleInformation(StartupInfo.hStdInput, HANDLE_FLAG_INHERIT,
- TRUE);
- if(!success) {
- //exit(99);
- return -1;
- }
-
- /*
- * XXX: Might want to apply some specific security attributes to the
- * processes.
- */
- success = CreateProcess(execPath, /* LPCSTR address of module name */
- NULL, /* LPCSTR address of command line */
- NULL, /* Process security attributes */
- NULL, /* Thread security attributes */
- TRUE, /* Inheritable Handes inherited. */
- 0, /* DWORD creation flags */
- env, /* Use parent environment block */
- NULL, /* Address of current directory name */
- &StartupInfo, /* Address of STARTUPINFO */
- pInfo); /* Address of PROCESS_INFORMATION */
- if(success) {
- return 0;
- } else {
- return -1;
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_AsyncReadStdin --
- *
- * This initiates an asynchronous read on the standard
- * input handle. This handle is not guaranteed to be
- * capable of performing asynchronous I/O so we send a
- * message to the StdinThread to do the synchronous read.
- *
- * Results:
- * -1 if error, 0 otherwise.
- *
- * Side effects:
- * Asynchronous message is queued to the StdinThread and an
- * overlapped structure is allocated/initialized.
- *
- *--------------------------------------------------------------
- */
-int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr,
- ClientData clientData)
-{
- POVERLAPPED_REQUEST pOv;
-
- ASSERT(fdTable[STDIN_FILENO].type != FD_UNUSED);
-
- pOv = (POVERLAPPED_REQUEST)malloc(sizeof(struct OVERLAPPED_REQUEST));
- ASSERT(pOv);
- memset((void *)pOv, 0, sizeof(struct OVERLAPPED_REQUEST));
- pOv->clientData1 = (ClientData)buf;
- pOv->instance = fdTable[STDIN_FILENO].instance;
- pOv->procPtr = procPtr;
- pOv->clientData = clientData;
-
- PostQueuedCompletionStatus(hStdinCompPort, len, STDIN_FILENO,
- (LPOVERLAPPED)pOv);
- return 0;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_AsyncRead --
- *
- * This initiates an asynchronous read on the file
- * handle which may be a socket or named pipe.
- *
- * We also must save the ProcPtr and ClientData, so later
- * when the io completes, we know who to call.
- *
- * We don't look at any results here (the ReadFile may
- * return data if it is cached) but do all completion
- * processing in OS_Select when we get the io completion
- * port done notifications. Then we call the callback.
- *
- * Results:
- * -1 if error, 0 otherwise.
- *
- * Side effects:
- * Asynchronous I/O operation is queued for completion.
- *
- *--------------------------------------------------------------
- */
-int OS_AsyncRead(int fd, int offset, void *buf, int len,
- OS_AsyncProc procPtr, ClientData clientData)
-{
- DWORD bytesRead;
- POVERLAPPED_REQUEST pOv;
-
- /*
- * Catch any bogus fd values
- */
- ASSERT((fd >= 0) && (fd < WIN32_OPEN_MAX));
- /*
- * Confirm that this is an async fd
- */
- ASSERT(fdTable[fd].type != FD_UNUSED);
- ASSERT(fdTable[fd].type != FD_FILE_SYNC);
- ASSERT(fdTable[fd].type != FD_PIPE_SYNC);
- ASSERT(fdTable[fd].type != FD_SOCKET_SYNC);
-
- pOv = (POVERLAPPED_REQUEST)malloc(sizeof(struct OVERLAPPED_REQUEST));
- ASSERT(pOv);
- memset((void *)pOv, 0, sizeof(struct OVERLAPPED_REQUEST));
- /*
- * Only file offsets should be non-zero, but make sure.
- */
- if (fdTable[fd].type == FD_FILE_ASYNC)
- if (fdTable[fd].offset >= 0)
- pOv->overlapped.Offset = fdTable[fd].offset;
- else
- pOv->overlapped.Offset = offset;
- pOv->instance = fdTable[fd].instance;
- pOv->procPtr = procPtr;
- pOv->clientData = clientData;
- bytesRead = fd;
- /*
- * ReadFile returns: TRUE success, FALSE failure
- */
- if (!ReadFile(fdTable[fd].fid.fileHandle, buf, len, &bytesRead,
- (LPOVERLAPPED)pOv)) {
- fdTable[fd].Errno = GetLastError();
- if(fdTable[fd].Errno == ERROR_NO_DATA ||
- fdTable[fd].Errno == ERROR_PIPE_NOT_CONNECTED) {
- PostQueuedCompletionStatus(hIoCompPort, 0, fd, (LPOVERLAPPED)pOv);
- return 0;
- }
- if(fdTable[fd].Errno != ERROR_IO_PENDING) {
- PostQueuedCompletionStatus(hIoCompPort, 0, fd, (LPOVERLAPPED)pOv);
- return -1;
- }
- fdTable[fd].Errno = 0;
- }
- return 0;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_AsyncWrite --
- *
- * This initiates an asynchronous write on the "fake" file
- * descriptor (which may be a file, socket, or named pipe).
- * We also must save the ProcPtr and ClientData, so later
- * when the io completes, we know who to call.
- *
- * We don't look at any results here (the WriteFile generally
- * completes immediately) but do all completion processing
- * in OS_DoIo when we get the io completion port done
- * notifications. Then we call the callback.
- *
- * Results:
- * -1 if error, 0 otherwise.
- *
- * Side effects:
- * Asynchronous I/O operation is queued for completion.
- *
- *--------------------------------------------------------------
- */
-int OS_AsyncWrite(int fd, int offset, void *buf, int len,
- OS_AsyncProc procPtr, ClientData clientData)
-{
- DWORD bytesWritten;
- POVERLAPPED_REQUEST pOv;
-
- /*
- * Catch any bogus fd values
- */
- ASSERT((fd >= 0) && (fd < WIN32_OPEN_MAX));
- /*
- * Confirm that this is an async fd
- */
- ASSERT(fdTable[fd].type != FD_UNUSED);
- ASSERT(fdTable[fd].type != FD_FILE_SYNC);
- ASSERT(fdTable[fd].type != FD_PIPE_SYNC);
- ASSERT(fdTable[fd].type != FD_SOCKET_SYNC);
-
- pOv = (POVERLAPPED_REQUEST)malloc(sizeof(struct OVERLAPPED_REQUEST));
- ASSERT(pOv);
- memset((void *)pOv, 0, sizeof(struct OVERLAPPED_REQUEST));
- /*
- * Only file offsets should be non-zero, but make sure.
- */
- if (fdTable[fd].type == FD_FILE_ASYNC)
- /*
- * Only file opened via OS_AsyncWrite with
- * O_APPEND will have an offset != -1.
- */
- if (fdTable[fd].offset >= 0)
- /*
- * If the descriptor has a memory mapped file
- * handle, take the offsets from there.
- */
- if (fdTable[fd].hMapMutex != NULL) {
- /*
- * Wait infinitely; this *should* not cause problems.
- */
- WaitForSingleObject(fdTable[fd].hMapMutex, INFINITE);
-
- /*
- * Retrieve the shared offset values.
- */
- pOv->overlapped.OffsetHigh = *(fdTable[fd].offsetHighPtr);
- pOv->overlapped.Offset = *(fdTable[fd].offsetLowPtr);
-
- /*
- * Update the shared offset values for the next write
- */
- *(fdTable[fd].offsetHighPtr) += 0; /* XXX How do I handle overflow */
- *(fdTable[fd].offsetLowPtr) += len;
-
- ReleaseMutex(fdTable[fd].hMapMutex);
- } else
- pOv->overlapped.Offset = fdTable[fd].offset;
- else
- pOv->overlapped.Offset = offset;
- pOv->instance = fdTable[fd].instance;
- pOv->procPtr = procPtr;
- pOv->clientData = clientData;
- bytesWritten = fd;
- /*
- * WriteFile returns: TRUE success, FALSE failure
- */
- if (!WriteFile(fdTable[fd].fid.fileHandle, buf, len, &bytesWritten,
- (LPOVERLAPPED)pOv)) {
- fdTable[fd].Errno = GetLastError();
- if(fdTable[fd].Errno != ERROR_IO_PENDING) {
- PostQueuedCompletionStatus(hIoCompPort, 0, fd, (LPOVERLAPPED)pOv);
- return -1;
- }
- fdTable[fd].Errno = 0;
- }
- if (fdTable[fd].offset >= 0)
- fdTable[fd].offset += len;
- return 0;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_Close --
- *
- * Closes the descriptor with routine appropriate for
- * descriptor's type.
- *
- * Results:
- * Socket or file is closed. Return values mimic Unix close:
- * 0 success, -1 failure
- *
- * Side effects:
- * Entry in fdTable is marked as free.
- *
- *--------------------------------------------------------------
- */
-int OS_Close(int fd)
-{
- int ret = 0;
-
- /*
- * Catch it if fd is a bogus value
- */
- ASSERT((fd >= 0) && (fd < WIN32_OPEN_MAX));
- ASSERT(fdTable[fd].type != FD_UNUSED);
-
- switch (fdTable[fd].type) {
- case FD_PIPE_SYNC:
- case FD_PIPE_ASYNC:
- case FD_FILE_SYNC:
- case FD_FILE_ASYNC:
- /*
- * CloseHandle returns: TRUE success, 0 failure
- */
- /*
- XXX don't close here, fcgi apps fail if we do so
- need to examine resource leaks if any might exist
- if (CloseHandle(fdTable[fd].fid.fileHandle) == FALSE)
- ret = -1;
- */
- break;
- case FD_SOCKET_SYNC:
- case FD_SOCKET_ASYNC:
- /*
- * Closing a socket that has an async read outstanding causes a
- * tcp reset and possible data loss. The shutdown call seems to
- * prevent this.
- */
-
- /* shutdown(fdTable[fd].fid.sock, SD_BOTH); */
-
- {
- char buf[16];
- int r;
-
- shutdown(fdTable[fd].fid.sock,SD_SEND);
-
- do
- {
- r = recv(fdTable[fd].fid.sock,buf,16,0);
- } while (r > 0);
- }
- /*
- * closesocket returns: 0 success, SOCKET_ERROR failure
- */
- if (closesocket(fdTable[fd].fid.sock) == SOCKET_ERROR)
- ret = -1;
- break;
- default:
- return -1; /* fake failure */
- }
-
- Win32FreeDescriptor(fd);
- return ret;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_CloseRead --
- *
- * Cancel outstanding asynchronous reads and prevent subsequent
- * reads from completing.
- *
- * Results:
- * Socket or file is shutdown. Return values mimic Unix shutdown:
- * 0 success, -1 failure
- *
- *--------------------------------------------------------------
- */
-int OS_CloseRead(int fd)
-{
- int ret = 0;
-
- /*
- * Catch it if fd is a bogus value
- */
- ASSERT((fd >= 0) && (fd < WIN32_OPEN_MAX));
- ASSERT(fdTable[fd].type == FD_SOCKET_ASYNC
- || fdTable[fd].type == FD_SOCKET_SYNC);
-
- if (shutdown(fdTable[fd].fid.sock,SD_RECEIVE) == SOCKET_ERROR)
- ret = -1;
- return ret;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OS_DoIo --
- *
- * This function was formerly OS_Select. It's purpose is
- * to pull I/O completion events off the queue and dispatch
- * them to the appropriate place.
- *
- * Results:
- * Returns 0.
- *
- * Side effects:
- * Handlers are called.
- *
- *--------------------------------------------------------------
- */
-int OS_DoIo(struct timeval *tmo)
-{
- unsigned long fd;
- unsigned long bytes;
- POVERLAPPED_REQUEST pOv;
- struct timeb tb;
- int ms;
- int ms_last;
- int err;
-
- /* XXX
- * We can loop in here, but not too long, as wait handlers
- * must run.
- * For cgi stdin, apparently select returns when io completion
- * ports don't, so don't wait the full timeout.
- */
- if(tmo)
- ms = (tmo->tv_sec*1000 + tmo->tv_usec/1000) / 2;
- else
- ms = 1000;
- ftime(&tb);
- ms_last = tb.time*1000 + tb.millitm;
- while (ms >= 0) {
- if(tmo && (ms = tmo->tv_sec*1000 + tmo->tv_usec/1000)> 100)
- ms = 100;
- if (!GetQueuedCompletionStatus(hIoCompPort, &bytes, &fd,
- (LPOVERLAPPED *)&pOv, ms) && !pOv) {
- err = WSAGetLastError();
- return 0; /* timeout */
- }
-
- ASSERT((fd >= 0) && (fd < WIN32_OPEN_MAX));
- /* call callback if descriptor still valid */
- ASSERT(pOv);
- if(pOv->instance == fdTable[fd].instance)
- (*pOv->procPtr)(pOv->clientData, bytes);
- free(pOv);
-
- ftime(&tb);
- ms -= (tb.time*1000 + tb.millitm - ms_last);
- ms_last = tb.time*1000 + tb.millitm;
- }
- return 0;
-}
-
-static int isAddrOK(struct sockaddr_in * inet_sockaddr, const char * okAddrs)
-{
- static const char *token = " ,;:\t";
- char *ipaddr;
- char *p;
-
- if (okAddrs == NULL) return TRUE;
-
- ipaddr = inet_ntoa(inet_sockaddr->sin_addr);
- p = strstr(okAddrs, ipaddr);
-
- if (p == NULL) return FALSE;
-
- if (p == okAddrs)
- {
- p += strlen(ipaddr);
- return (strchr(token, *p) != NULL);
- }
-
- if (strchr(token, *--p) != NULL)
- {
- p += strlen(ipaddr) + 1;
- return (strchr(token, *p) != NULL);
- }
-
- return FALSE;
-}
-
-#ifndef NO_WSAACEPT
-static int CALLBACK isAddrOKCallback(LPWSABUF lpCallerId,
- LPWSABUF dc0,
- LPQOS dc1,
- LPQOS dc2,
- LPWSABUF dc3,
- LPWSABUF dc4,
- GROUP *dc5,
- DWORD data)
-{
- struct sockaddr_in *sockaddr = (struct sockaddr_in *) lpCallerId->buf;
-
- // Touch the args to avoid warnings
- dc0 = NULL; dc1 = NULL; dc2 = NULL; dc3 = NULL; dc4 = NULL; dc5 = NULL;
-
- if ((void *) data == NULL) return CF_ACCEPT;
-
- if (sockaddr->sin_family != AF_INET) return CF_ACCEPT;
-
- return isAddrOK(sockaddr, (const char *) data) ? CF_ACCEPT : CF_REJECT;
-}
-#endif
-
-static printLastError(const char * text)
-{
- LPVOID buf;
-
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- 0,
- (LPTSTR) &buf,
- 0,
- NULL
- );
-
- fprintf(stderr, "%s: %s\n", text, (LPCTSTR) buf);
- LocalFree(buf);
-}
-
-static int acceptNamedPipe()
-{
- int ipcFd = -1;
-
- if (! ConnectNamedPipe(hListen, &listenOverlapped))
- {
- switch (GetLastError())
- {
- case ERROR_PIPE_CONNECTED:
-
- // A client connected after CreateNamedPipe but
- // before ConnectNamedPipe. Its a good connection.
-
- break;
-
- case ERROR_IO_PENDING:
-
- // Wait for a connection to complete.
-
- while (WaitForSingleObject(listenOverlapped.hEvent,
- ACCEPT_TIMEOUT) == WAIT_TIMEOUT)
- {
- if (shutdownPending)
- {
- OS_LibShutdown();
- return -1;
- }
- }
-
- break;
-
- case ERROR_PIPE_LISTENING:
-
- // The pipe handle is in nonblocking mode.
-
- case ERROR_NO_DATA:
-
- // The previous client closed its handle (and we failed
- // to call DisconnectNamedPipe)
-
- default:
-
- printLastError("unexpected ConnectNamedPipe() error");
- }
- }
-
- //
- // impersonate the client
- //
- if(bImpersonate && !ImpersonateNamedPipeClient(hListen)) {
- DisconnectNamedPipe(hListen);
- } else {
- ipcFd = Win32NewDescriptor(FD_PIPE_SYNC, (int) hListen, -1);
- if (ipcFd == -1)
- {
- DisconnectNamedPipe(hListen);
- if (bImpersonate) RevertToSelf();
- }
- }
-
- return ipcFd;
-}
-
-static int acceptSocket(const char *webServerAddrs)
-{
- SOCKET hSock;
- int ipcFd = -1;
-
- for (;;)
- {
- struct sockaddr sockaddr;
- int sockaddrLen = sizeof(sockaddr);
-
- for (;;)
- {
- const struct timeval timeout = {1, 0};
- fd_set readfds;
-
- FD_ZERO(&readfds);
- FD_SET((unsigned int) hListen, &readfds);
-
- if (select(0, &readfds, NULL, NULL, &timeout) == 0)
- {
- if (shutdownPending)
- {
- OS_LibShutdown();
- return -1;
- }
- }
- else
- {
- break;
- }
- }
-
-#if NO_WSAACEPT
- hSock = accept((SOCKET) hListen, &sockaddr, &sockaddrLen);
-
- if (hSock == INVALID_SOCKET)
- {
- break;
- }
-
- if (isAddrOK((struct sockaddr_in *) &sockaddr, webServerAddrs))
- {
- break;
- }
-
- closesocket(hSock);
-#else
- hSock = WSAAccept((unsigned int) hListen,
- &sockaddr,
- &sockaddrLen,
- isAddrOKCallback,
- (DWORD) webServerAddrs);
-
- if (hSock != INVALID_SOCKET)
- {
- break;
- }
-
- if (WSAGetLastError() != WSAECONNREFUSED)
- {
- break;
- }
-#endif
- }
-
- if (hSock == INVALID_SOCKET)
- {
- /* Use FormatMessage() */
- fprintf(stderr, "accept()/WSAAccept() failed: %d", WSAGetLastError());
- return -1;
- }
-
- ipcFd = Win32NewDescriptor(FD_SOCKET_SYNC, hSock, -1);
- if (ipcFd == -1)
- {
- closesocket(hSock);
- }
-
- return ipcFd;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * OS_Accept --
- *
- * Accepts a new FastCGI connection. This routine knows whether
- * we're dealing with TCP based sockets or NT Named Pipes for IPC.
- *
- * fail_on_intr is ignored in the Win lib.
- *
- * Results:
- * -1 if the operation fails, otherwise this is a valid IPC fd.
- *
- *----------------------------------------------------------------------
- */
-int OS_Accept(int listen_sock, int fail_on_intr, const char *webServerAddrs)
-{
- int ipcFd = -1;
-
- // Touch args to prevent warnings
- listen_sock = 0; fail_on_intr = 0;
-
- // @todo Muliple listen sockets and sockets other than 0 are not
- // supported due to the use of globals.
-
- if (shutdownPending)
- {
- OS_LibShutdown();
- return -1;
- }
-
- // The mutex is to keep other processes (and threads, when supported)
- // from going into the accept cycle. The accept cycle needs to
- // periodically break out to check the state of the shutdown flag
- // and there's no point to having more than one thread do that.
-
- if (acceptMutex != INVALID_HANDLE_VALUE)
- {
- DWORD ret;
- while ((ret = WaitForSingleObject(acceptMutex, ACCEPT_TIMEOUT)) == WAIT_TIMEOUT)
- {
- if (shutdownPending) break;
- }
- if (ret == WAIT_FAILED) {
- printLastError("WaitForSingleObject() failed");
- return -1;
- }
- }
-
- if (shutdownPending)
- {
- OS_LibShutdown();
- }
- else if (listenType == FD_PIPE_SYNC)
- {
- ipcFd = acceptNamedPipe();
- }
- else if (listenType == FD_SOCKET_SYNC)
- {
- ipcFd = acceptSocket(webServerAddrs);
- }
- else
- {
- fprintf(stderr, "unknown listenType (%d)\n", listenType);
- }
-
- if (acceptMutex != INVALID_HANDLE_VALUE)
- {
- ReleaseMutex(acceptMutex);
- }
-
- return ipcFd;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * OS_IpcClose
- *
- * OS IPC routine to close an IPC connection.
- *
- * Results:
- *
- *
- * Side effects:
- * IPC connection is closed.
- *
- *----------------------------------------------------------------------
- */
-int OS_IpcClose(int ipcFd)
-{
- if (ipcFd == -1)
- return 0;
-
- /*
- * Catch it if fd is a bogus value
- */
- ASSERT((ipcFd >= 0) && (ipcFd < WIN32_OPEN_MAX));
- ASSERT(fdTable[ipcFd].type != FD_UNUSED);
-
- switch(listenType) {
-
- case FD_PIPE_SYNC:
- /*
- * Make sure that the client (ie. a Web Server in this case) has
- * read all data from the pipe before we disconnect.
- */
- if(!FlushFileBuffers(fdTable[ipcFd].fid.fileHandle))
- return -1;
- if(DisconnectNamedPipe(fdTable[ipcFd].fid.fileHandle)) {
- OS_Close(ipcFd);
- if (bImpersonate) RevertToSelf();
- return 0;
- } else {
- return -1;
- }
- break;
-
- case FD_SOCKET_SYNC:
- OS_Close(ipcFd);
- return 0;
- break;
-
- case FD_UNUSED:
- default:
- //exit(106);
- return -1;
- break;
- }
- return -1;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * OS_IsFcgi --
- *
- * Determines whether this process is a FastCGI process or not.
- *
- * Results:
- * Returns 1 if FastCGI, 0 if not.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-int OS_IsFcgi(int sock)
-{
- // Touch args to prevent warnings
- sock = 0;
-
- /* XXX This is broken for sock */
-
- return (listenType != FD_UNUSED);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * OS_SetFlags --
- *
- * Sets selected flag bits in an open file descriptor. Currently
- * this is only to put a SOCKET into non-blocking mode.
- *
- *----------------------------------------------------------------------
- */
-void OS_SetFlags(int fd, int flags)
-{
- unsigned long pLong = 1L;
-
- if (fdTable[fd].type == FD_SOCKET_SYNC && flags == O_NONBLOCK) {
- if (ioctlsocket(fdTable[fd].fid.sock, FIONBIO, &pLong) ==
- SOCKET_ERROR) {
- //exit(WSAGetLastError());
- SetLastError(WSAGetLastError());
- return;
- }
- if (!CreateIoCompletionPort((HANDLE)fdTable[fd].fid.sock,
- hIoCompPort, fd, 1)) {
- //err = GetLastError();
- //exit(err);
- return;
- }
-
- fdTable[fd].type = FD_SOCKET_ASYNC;
- }
- return;
-}
-
diff --git a/sapi/cgi/libfcgi/strerror.c b/sapi/cgi/libfcgi/strerror.c
deleted file mode 100644
index fac7c8eda2..0000000000
--- a/sapi/cgi/libfcgi/strerror.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * The terms in the file "LICENSE.TERMS" do not apply to this file.
- * See terms below.
- *
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-/*static char *sccsid = "from: @(#)strerror.c 5.6 (Berkeley) 5/4/91";*/
-static char *rcsid = "$Id$";
-#endif /* LIBC_SCCS and not lint */
-
-#include "fcgi_config.h"
-
-#if ! defined (HAVE_STRERROR)
-#include <string.h>
-
-/*
- * Since perror() is not allowed to change the contents of strerror()'s
- * static buffer, both functions supply their own buffers to the
- * internal function __strerror().
- */
-
-char *
-__strerror(int num, char *buf)
-{
-#define UPREFIX "Unknown error: "
- extern char *sys_errlist[];
- extern int sys_nerr;
- register unsigned int errnum;
- register char *p, *t;
- char tmp[40];
-
- errnum = num; /* convert to unsigned */
- if (errnum < sys_nerr)
- return(sys_errlist[errnum]);
-
- /* Do this by hand, so we don't include stdio(3). */
- t = tmp;
- do {
- *t++ = "0123456789"[errnum % 10];
- } while (errnum /= 10);
-
- strcpy (buf, UPREFIX);
- for (p = buf + sizeof(UPREFIX) -1;;) {
- *p++ = *--t;
- if (t <= tmp)
- break;
- }
-
- return buf;
-}
-
-
-char *
-strerror(int num)
-{
- static char buf[40]; /* 64-bit number + slop */
- return __strerror(num, buf);
-}
-
-#endif
diff --git a/sapi/cgi/php.sym b/sapi/cgi/php.sym
deleted file mode 100644
index e69de29bb2..0000000000
--- a/sapi/cgi/php.sym
+++ /dev/null
diff --git a/sapi/cgi/php_getopt.h b/sapi/cgi/php_getopt.h
deleted file mode 100644
index 1e2355ff63..0000000000
--- a/sapi/cgi/php_getopt.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#include "php.h"
-
-/* Define structure for one recognized option (both single char and long name).
- * If short_open is '-' this is the last option.
- */
-typedef struct _opt_struct {
- const char opt_char;
- const int need_param;
- const char * opt_name;
-} opt_struct;
-
-int php_getopt(int argc, char* const *argv, const opt_struct opts[], char **optarg, int *optind, int show_err);
diff --git a/sapi/cli/CREDITS b/sapi/cli/CREDITS
deleted file mode 100644
index fac101d747..0000000000
--- a/sapi/cli/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-CLI
-Edin Kadribasic, Marcus Boerger
diff --git a/sapi/cli/Makefile.frag b/sapi/cli/Makefile.frag
deleted file mode 100644
index df6c86f2f2..0000000000
--- a/sapi/cli/Makefile.frag
+++ /dev/null
@@ -1,9 +0,0 @@
-$(SAPI_CLI_PATH): $(PHP_GLOBAL_OBJS) $(PHP_CLI_OBJS)
- $(BUILD_CLI)
-
-install-cli: $(SAPI_CLI_PATH)
- @echo "Installing PHP CLI binary: $(INSTALL_ROOT)$(bindir)/"
- @$(INSTALL_CLI)
- @echo "Installing PHP CLI man page: $(INSTALL_ROOT)$(mandir)/man1/"
- @$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1
- @$(INSTALL_DATA) $(builddir)/php.1 $(INSTALL_ROOT)$(mandir)/man1/php.1
diff --git a/sapi/cli/README b/sapi/cli/README
deleted file mode 100644
index e6bf5cc6c6..0000000000
--- a/sapi/cli/README
+++ /dev/null
@@ -1,19 +0,0 @@
-The CLI (command line interface) SAPI has been introduced
-with a goal of making PHP better at supporting the creation of
-stand alone applications.
-
-It is based on CGI SAPI with all CGI specific things removed.
-
-The main differences between the two:
-
-* CLI is started up in quiet mode by default.
- (-q switch kept for compatibility)
-* It does not change the working directory to that of the script.
- (-C switch kept for compatibility)
-* Plain text error message
-* $argc and $argv registered irrespective of register_globals
- and register_argc_argv php.ini settings.
-* implicit_flush always on
-* -r option which allows execution of PHP code directly from
- the command line (e.g. php -r 'echo md5("test");' )
-* max_execution_time is set to unlimited, overriding php.ini setting.
diff --git a/sapi/cli/TODO b/sapi/cli/TODO
deleted file mode 100644
index 22e6689001..0000000000
--- a/sapi/cli/TODO
+++ /dev/null
@@ -1,2 +0,0 @@
-TODO:
-
diff --git a/sapi/cli/config.m4 b/sapi/cli/config.m4
deleted file mode 100644
index 7651e702b3..0000000000
--- a/sapi/cli/config.m4
+++ /dev/null
@@ -1,40 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_MSG_CHECKING(for CLI build)
-
-AC_ARG_ENABLE(cli,
-[ --disable-cli Disable building CLI version of PHP
- (this forces --without-pear).],
-[
- PHP_SAPI_CLI=$enableval
-],[
- PHP_SAPI_CLI=yes
-])
-
-if test "$PHP_SAPI_CLI" != "no"; then
- PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cli/Makefile.frag,$abs_srcdir/sapi/cli,sapi/cli)
- SAPI_CLI_PATH=sapi/cli/php
- PHP_SUBST(SAPI_CLI_PATH)
-
- case $host_alias in
- *darwin*)
- BUILD_CLI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_CLI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)"
- ;;
- *cygwin*)
- SAPI_CLI_PATH=sapi/cli/php.exe
- BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_CLI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)"
- ;;
- *)
- BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_CLI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)"
- ;;
- esac
- INSTALL_CLI="\$(mkinstalldirs) \$(INSTALL_ROOT)\$(bindir); \$(INSTALL) -m 0755 \$(SAPI_CLI_PATH) \$(INSTALL_ROOT)\$(bindir)/php"
-
- PHP_SUBST(BUILD_CLI)
- PHP_SUBST(INSTALL_CLI)
- PHP_OUTPUT(sapi/cli/php.1)
-fi
-
-AC_MSG_RESULT($PHP_SAPI_CLI)
diff --git a/sapi/cli/getopt.c b/sapi/cli/getopt.c
deleted file mode 100644
index 01e532b7cb..0000000000
--- a/sapi/cli/getopt.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <stdlib.h>
-#include "php_getopt.h"
-#define OPTERRCOLON (1)
-#define OPTERRNF (2)
-#define OPTERRARG (3)
-
-
-static int php_opt_error(int argc, char * const *argv, int oint, int optchr, int err, int show_err)
-{
- if (show_err)
- {
- fprintf(stderr, "Error in argument %d, char %d: ", oint, optchr+1);
- switch(err)
- {
- case OPTERRCOLON:
- fprintf(stderr, ": in flags\n");
- break;
- case OPTERRNF:
- fprintf(stderr, "option not found %c\n", argv[oint][optchr]);
- break;
- case OPTERRARG:
- fprintf(stderr, "no argument for option %c\n", argv[oint][optchr]);
- break;
- default:
- fprintf(stderr, "unknown\n");
- break;
- }
- }
- return('?');
-}
-
-int php_getopt(int argc, char* const *argv, const opt_struct opts[], char **optarg, int *optind, int show_err)
-{
- static int optchr = 0;
- static int dash = 0; /* have already seen the - */
- int arg_start = 2;
-
- int opts_idx = -1;
-
- if (*optind >= argc) {
- return(EOF);
- }
- if (!dash) {
- if ((argv[*optind][0] != '-')) {
- return(EOF);
- } else {
- if (!argv[*optind][1])
- {
- /*
- * use to specify stdin. Need to let pgm process this and
- * the following args
- */
- return(EOF);
- }
- }
- }
- if ((argv[*optind][0] == '-') && (argv[*optind][1] == '-')) {
- /* '--' indicates end of args if not followed by a known long option name */
- while (1) {
- opts_idx++;
- if (opts[opts_idx].opt_char == '-') {
- (*optind)++;
- return(EOF);
- } else if (opts[opts_idx].opt_name && !strcmp(&argv[*optind][2], opts[opts_idx].opt_name)) {
- break;
- }
- }
- optchr = 0;
- dash = 1;
- arg_start = 2 + strlen(opts[opts_idx].opt_name);
- }
- if (!dash) {
- dash = 1;
- optchr = 1;
- }
-
- /* Check if the guy tries to do a -: kind of flag */
- if (argv[*optind][optchr] == ':') {
- dash = 0;
- (*optind)++;
- return (php_opt_error(argc, argv, *optind-1, optchr, OPTERRCOLON, show_err));
- }
- if (opts_idx < 0) {
- while (1) {
- opts_idx++;
- if (opts[opts_idx].opt_char == '-') {
- int errind = *optind;
- int errchr = optchr;
-
- if (!argv[*optind][optchr+1]) {
- dash = 0;
- (*optind)++;
- } else {
- optchr++;
- }
- return(php_opt_error(argc, argv, errind, errchr, OPTERRNF, show_err));
- } else if (argv[*optind][optchr] == opts[opts_idx].opt_char) {
- break;
- }
- }
- }
- if (opts[opts_idx].need_param) {
- /* Check for cases where the value of the argument
- is in the form -<arg> <val> or in the form -<arg><val> */
- dash = 0;
- if(!argv[*optind][arg_start]) {
- (*optind)++;
- if (*optind == argc) {
- return(php_opt_error(argc, argv, *optind-1, optchr, OPTERRARG, show_err));
- }
- *optarg = argv[(*optind)++];
- } else {
- *optarg = &argv[*optind][arg_start];
- (*optind)++;
- }
- return opts[opts_idx].opt_char;
- } else {
- if (arg_start == 2) {
- if (!argv[*optind][optchr+1])
- {
- dash = 0;
- (*optind)++;
- } else {
- optchr++;
- }
- } else {
- (*optind)++;
- }
- return opts[opts_idx].opt_char;
- }
- assert(0);
- return(0); /* never reached */
-}
diff --git a/sapi/cli/php.1.in b/sapi/cli/php.1.in
deleted file mode 100644
index 9e6b2c075d..0000000000
--- a/sapi/cli/php.1.in
+++ /dev/null
@@ -1,387 +0,0 @@
-./" +----------------------------------------------------------------------+
-./" | PHP Version 4 |
-./" +----------------------------------------------------------------------+
-./" | Copyright (c) 1997-2003 The PHP Group |
-./" +----------------------------------------------------------------------+
-./" | This source file is subject to version 2.02 of the PHP license, |
-./" | that is bundled with this package in the file LICENSE, and is |
-./" | available at through the world-wide-web at |
-./" | http://www.php.net/license/2_02.txt. |
-./" | If you did not receive a copy of the PHP license and are unable to |
-./" | obtain it through the world-wide-web, please send a note to |
-./" | license@php.net so we can mail you a copy immediately. |
-./" +----------------------------------------------------------------------+
-./" | Author: Marcus Boerger <helly@php.net> |
-./" +----------------------------------------------------------------------+
-./"
-./" $Id$
-./"
-.TH PHP 1 "Feb 2003" "The PHP Group" "Scripting Language"
-.SH NAME
-.TP 15
-.B php
-PHP Command Line Interface 'CLI'
-.SH SYNOPSIS
-.B php
-[options] [
-.B \-f ]
-.IR file
-[[\-\-]
-.IR args.\|.\|. ]
-.LP
-.B php
-[options]
-.B \-r
-.IR code
-[[\-\-]
-.IR args.\|.\|. ]
-.LP
-.B php
-[options] [\-B
-.IR code ]
-.B \-R
-.IR code
-[\-E
-.IR code ]
-[[\-\-]
-.IR args.\|.\|. ]
-.LP
-.B php
-[options] [\-B
-.IR code ]
-.B \-F
-.IR file
-[\-E
-.IR code ]
-[[\-\-]
-.IR args.\|.\|. ]
-.LP
-.B php
-[options] \-\- [
-.IR args.\|.\|. ]
-.LP
-.SH DESCRIPTION
-.B PHP
-is a widely\-used general\-purpose scripting language that is especially suited for
-Web development and can be embedded into HTML. This is the command line interface
-that enables you to the following:
-.P
-You can parse and execute files by using parameter \-f followed by the name of the
-.IR file
-to be executed.
-.LP
-Using parameter \-r you can directly execute PHP
-.IR code
-simply as you would do inside a
-.B \.php
-file when using the
-.B eval()
-function.
-.LP
-It is also possible to process the standard input line by line using either
-the parameter \-R or \-F. In this mode each separate input line causes the
-.IR code
-specified by \-R or the
-.IR file
-specified by \-F to be executed.
-You can access the input line by \fB$argn\fP. While processing the input lines
-.B $argi
-contains the number of the actual line being processed. Further more
-the paramters \-B and \-E can be used to execute
-.IR code
-(see \-r) before and
-after all input lines have been processed respectively.
-.LP
-If none of \-r \-f \-B \-R \-F or \-E is present but a single parameter is given
-then this parameter is taken as the filename to parse and execute (same as
-with \-f). If no parameter is present then the standard input is read and
-executed.
-.SH OPTIONS
-.TP 15
-.PD 0
-.B \-\-interactive
-.TP
-.PD 1
-.B \-a
-Run interactively
-.TP
-.PD 0
-.B \-\-php\-ini \fIpath\fP|\fIfile\fP
-.TP
-.PD 1
-.B \-c \fIpath\fP|\fIfile\fP
-Look for
-.B php.ini
-file in the directory
-.IR path
-or use the specified
-.IR file
-.TP
-.PD 0
-.B \-\-no\-php\-ini
-.TP
-.PD 1
-.B \-n
-No
-.B php.ini
-file will be used
-.TP
-.PD 0
-.B \-\-define \fIfoo\fP[=\fIbar\fP]
-.TP
-.PD 1
-.B \-d \fIfoo\fP[=\fIbar\fP]
-Define INI entry
-.IR foo
-with value
-.IR bar
-.TP
-.B \-e
-Generate extended information for debugger/profiler
-.TP
-.PD 0
-.B \-\-file \fIfile\fP
-.TP
-.PD 1
-.B \-f \fIfile\fP
-Parse and execute
-.IR file
-.TP
-.PD 0
-.B \-\-global \fIname\fP
-.TP
-.PD 1
-.B \-g \fIname\fP
-Make variable
-.IR name
-global in script.
-.TP
-.PD 0
-.B \-\-help
-.TP
-.PD 1
-.B \-h
-This help
-.TP
-.PD 0
-.B \-\-hide\-args
-.TP
-.PD 1
-.B \-H
-Hide script name (\fIfile\fP) and parameters (\fIargs\.\.\.\fP) from external
-tools. For example you may want to use this when a php script is started as
-a daemon and the command line contains sensitive data such as passwords.
-.TP
-.PD 0
-.B \-\-info
-.TP
-.PD 1
-.B \-i
-PHP information and configuration
-.TP
-.PD 0
-.B \-\-syntax\-check
-.TP
-.PD 1
-.B \-l
-Syntax check only (lint)
-.TP
-.PD 0
-.B \-\-modules
-.TP
-.PD 1
-.B \-m
-Show compiled in modules
-.TP
-.PD 0
-.B \-\-run \fIcode\fP
-.TP
-.PD 1
-.B \-r \fIcode\fP
-Run PHP
-.IR code
-without using script tags
-.B '<?..?>'
-.TP
-.PD 0
-.B \-\-process\-begin \fIcode\fP
-.TP
-.PD 1
-.B \-B \fIcode\fP
-Run PHP
-.IR code
-before processing input lines
-.TP
-.PD 0
-.B \-\-process\-code \fIcode\fP
-.TP
-.PD 1
-.B \-R \fIcode\fP
-Run PHP
-.IR code
-for every input line
-.TP
-.PD 0
-.B \-\-process\-file \fIfile\fP
-.TP
-.PD 1
-.B \-F \fIfile\fP
-Parse and execute
-.IR file
-for every input line
-.TP
-.PD 0
-.B \-\-process\-end \fIcode\fP
-.TP
-.PD 1
-.B \-E \fIcode\fP
-Run PHP
-.IR code
-after processing all input lines
-.TP
-.PD 0
-.B \-\-syntax\-highlight
-.TP
-.PD 1
-.B \-s
-Display colour syntax highlighted source
-.TP
-.PD 0
-.B \-\-version
-.TP
-.PD 1
-.B \-v
-Version number
-.TP
-.PD 0
-.B \-\-stripped
-.TP
-.PD 1
-.B \-w
-Display source with stripped comments and whitespace
-.TP
-.PD 0
-.B \-\-zend\-extension \fIfile\fP
-.TP
-.PD 1
-.B \-z \fIfile\fP
-Load Zend extension
-.IR file
-.TP
-.IR args.\|.\|.
-Arguments passed to script. Use
-.B '\-\-'
-.IR args
-when first argument starts with
-.B '\-'
-or script is read from stdin
-.SH FILES
-.TP 15
-.B php\-cli.ini
-The configuration file for the CLI version of PHP.
-.TP
-.B php.ini
-The standard configuration file will only be used when
-.B php\-cli.ini
-cannot not be found.
-.SH EXAMPLES
-.TP 5
-\fIphp -r 'echo "Hello World\\n";'\fP
-This command simply writes the text "Hello World" to stabdard out.
-.TP
-\fIphp \-r 'print_r(gd_info());'\fP
-This shows the configuration of your gd extension. You can use this
-to easily check which imag formats you can use. If you have any
-dynamic modules you may want to use the same ini file that php uses
-when executed from your webserver. There are more extensions which
-have such a function. For dba use:
-.RS
-\fIphp \-r 'print_r(dba_handlers(1));'\fP
-.RE
-.TP
-\fIphp \-R'echo strip_tags($argn)."\\n";\fP
-This PHP command strips off the HTML tags line by line and outputs the
-result. To see how it works you can first look at the following PHP command '
-\fIphp \-d html_errors=1 \-i\fP' which uses PHP to output HTML formatted
-configuration information. If you then combine those two
-\'\fIphp \.\.\.|php \.\.\.\fP\' you\'ll see what happens.
-.TP
-\fIphp \-E 'echo "Lines: $argi\\n";'\fP
-Using this PHP command you can count the lines being input.
-.TP
-\fIphp \-R '$l+=count(file($argn));' \-E'echo "Lines:$l\\n";'\fP
-In this example PHP expects each input line beeing a file. It counts all lines
-of the files specified by each input line and shows the summarized result.
-You may combine this with tools like find and change the php scriptlet.
-.TP
-\fIphp \-R 'echo "$argn\\n"; fgets(STDIN);'\fP
-Since you have access to STDIN from within \-B \-R \-F and \-E you can skip
-certain input lines with your code. But note that in such cases $argi only
-counts the lines being processed by php itself. Having read this you will
-guess what the above program does: skipping every second input line.
-.SH TIPS
-You can use a shebang line to automatically invoke php
-from scripts. Only the CLI version of PHP will ignore
-such a first line as shown below:
-.P
-.PD 0
-.RS
-#!/bin/php
-.P
-<?php
-.P
- // your script
-.P
-?>
-.RE
-.PD 1
-.P
-.SH SEE ALSO
-For a more or less complete description of PHP look here:
-.PD 0
-.P
-.B http://www.php.net/manual/
-.PD 1
-.P
-A nice introduction to PHP by Stig Sæther Bakken can be found here:
-.PD 0
-.P
-.B http://www.zend.com/zend/art/intro.php
-.PD 1
-.SH BUGS
-You can view the list of known bugs or add any new bug you
-found here:
-.PD 0
-.P
-.B http://bugs.php.net
-.PD 1
-.SH AUTHORS
-The PHP Group: Thies C. Arntzen, Stig Bakken, Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski.
-.P
-Additional work for the CLI sapi was done by Edin Kadribasic and Marcus Boerger.
-.P
-A List of active developers can be found here:
-.PD 0
-.P
-.B http://www.php.net/credits.php
-.PD 1
-.P
-And last but not least PHP was developed with the help of a huge amount of
-contributors all around the world.
-.SH VERSION INFORMATION
-This manpage describes \fBphp\fP, version @PHP_VERSION@.
-.SH COPYRIGHT
-Copyright \(co 1997\-2003 The PHP Group
-.LP
-This source file is subject to version 2.02 of the PHP license,
-that is bundled with this package in the file LICENSE, and is
-available at through the world-wide-web at
-.PD 0
-.P
-.B http://www.php.net/license/2_02.txt
-.PD 1
-.P
-If you did not receive a copy of the PHP license and are unable to
-obtain it through the world-wide-web, please send a note to
-.B license@php.net
-so we can mail you a copy immediately.
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
deleted file mode 100644
index c3ffcebeb5..0000000000
--- a/sapi/cli/php_cli.c
+++ /dev/null
@@ -1,1032 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Edin Kadribasic <edink@php.net> |
- | Marcus Boerger <helly@php.net> |
- | Parts based on CGI SAPI Module by |
- | Rasmus Lerdorf, Stig Bakken and Zeev Suraski |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_variables.h"
-#include "zend_hash.h"
-#include "zend_modules.h"
-
-#include "SAPI.h"
-
-#include <stdio.h>
-#include "php.h"
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#include "win32/signal.h"
-#include <process.h>
-#endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#if HAVE_SETLOCALE
-#include <locale.h>
-#endif
-#include "zend.h"
-#include "zend_extensions.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "php_main.h"
-#include "fopen_wrappers.h"
-#include "ext/standard/php_standard.h"
-#ifdef PHP_WIN32
-#include <io.h>
-#include <fcntl.h>
-#include "win32/php_registry.h"
-#endif
-
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-
-#ifdef __riscos__
-#include <unixlib/local.h>
-#endif
-
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-
-
-#include "php_getopt.h"
-
-#define PHP_MODE_STANDARD 1
-#define PHP_MODE_HIGHLIGHT 2
-#define PHP_MODE_INDENT 3
-#define PHP_MODE_LINT 4
-#define PHP_MODE_STRIP 5
-#define PHP_MODE_CLI_DIRECT 6
-#define PHP_MODE_PROCESS_STDIN 7
-
-static char *optarg = NULL;
-static int optind = 1;
-
-static const opt_struct OPTIONS[] = {
- {'a', 0, "interactive"},
- {'B', 1, "process-begin"},
- {'C', 0, "no-chdir"}, /* for compatibility with CGI (do not chdir to script directory) */
- {'c', 1, "php-ini"},
- {'d', 1, "define"},
- {'E', 1, "process-end"},
- {'e', 0, "profile-info"},
- {'F', 1, "process-file"},
- {'f', 1, "file"},
- {'g', 1, "global"},
- {'h', 0, "help"},
- {'i', 0, "info"},
- {'l', 0, "syntax-check"},
- {'m', 0, "modules"},
- {'n', 0, "no-php-ini"},
- {'q', 0, "no-header"}, /* for compatibility with CGI (do not generate HTTP headers) */
- {'R', 1, "process-code"},
- {'H', 0, "hide-args"},
- {'r', 1, "run"},
- {'s', 0, "syntax-highlight"},
- {'s', 0, "syntax-highlighting"},
- {'w', 0, "strip"},
- {'?', 0, "usage"},/* help alias (both '?' and 'usage') */
- {'v', 0, "version"},
- {'z', 1, "zend-extension"},
- {'-', 0, NULL} /* end of args */
-};
-
-static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
-{
- php_printf("%s\n", module->name);
- return 0;
-}
-
-static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
-{
- Bucket *f = *((Bucket **) a);
- Bucket *s = *((Bucket **) b);
-
- return strcmp(((zend_module_entry *)f->pData)->name,
- ((zend_module_entry *)s->pData)->name);
-}
-
-static void print_modules(TSRMLS_D)
-{
- HashTable sorted_registry;
- zend_module_entry tmp;
-
- zend_hash_init(&sorted_registry, 50, NULL, NULL, 1);
- zend_hash_copy(&sorted_registry, &module_registry, NULL, &tmp, sizeof(zend_module_entry));
- zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC);
- zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) print_module_info, NULL TSRMLS_CC);
- zend_hash_destroy(&sorted_registry);
-}
-
-static int print_extension_info(zend_extension *ext, void *arg TSRMLS_DC)
-{
- php_printf("%s\n", ext->name);
- return 0;
-}
-
-static int extension_name_cmp(const zend_llist_element **f,
- const zend_llist_element **s TSRMLS_DC)
-{
- return strcmp(((zend_extension *)(*f)->data)->name,
- ((zend_extension *)(*s)->data)->name);
-}
-
-static void print_extensions(TSRMLS_D)
-{
- zend_llist sorted_exts;
-
- zend_llist_copy(&sorted_exts, &zend_extensions);
- zend_llist_sort(&sorted_exts, extension_name_cmp TSRMLS_CC);
- zend_llist_apply_with_argument(&sorted_exts, (llist_apply_with_arg_func_t) print_extension_info, NULL TSRMLS_CC);
- zend_llist_destroy(&sorted_exts);
-}
-
-#ifndef STDOUT_FILENO
-#define STDOUT_FILENO 1
-#endif
-
-static inline size_t sapi_cli_single_write(const char *str, uint str_length)
-{
-#ifdef PHP_WRITE_STDOUT
- long ret;
-
- ret = write(STDOUT_FILENO, str, str_length);
- if (ret <= 0) {
- return 0;
- }
- return ret;
-#else
- size_t ret;
-
- ret = fwrite(str, 1, MIN(str_length, 16384), stdout);
- return ret;
-#endif
-}
-
-static int sapi_cli_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- const char *ptr = str;
- uint remaining = str_length;
- size_t ret;
-
- while (remaining > 0)
- {
- ret = sapi_cli_single_write(ptr, remaining);
- if (!ret) {
- php_handle_aborted_connection();
- }
- ptr += ret;
- remaining -= ret;
- }
-
- return str_length;
-}
-
-
-static void sapi_cli_flush(void *server_context)
-{
- if (fflush(stdout)==EOF) {
- php_handle_aborted_connection();
- }
-}
-
-static char *php_self = "";
-static char *script_filename = "";
-
-static void sapi_cli_register_variables(zval *track_vars_array TSRMLS_DC)
-{
- /* In CGI mode, we consider the environment to be a part of the server
- * variables
- */
- php_import_environment_variables(track_vars_array TSRMLS_CC);
-
- /* Build the special-case PHP_SELF variable for the CLI version */
- php_register_variable("PHP_SELF", php_self, track_vars_array TSRMLS_CC);
- php_register_variable("SCRIPT_NAME", php_self, track_vars_array TSRMLS_CC);
- /* filenames are empty for stdin */
- php_register_variable("SCRIPT_FILENAME", script_filename, track_vars_array TSRMLS_CC);
- php_register_variable("PATH_TRANSLATED", script_filename, track_vars_array TSRMLS_CC);
- /* just make it available */
- php_register_variable("DOCUMENT_ROOT", "", track_vars_array TSRMLS_CC);
-}
-
-
-static void sapi_cli_log_message(char *message)
-{
- TSRMLS_FETCH();
-
- if (php_header(TSRMLS_C)) {
- fprintf(stderr, "%s\n", message);
- }
-}
-
-static int sapi_cli_deactivate(TSRMLS_D)
-{
- fflush(stdout);
- if(SG(request_info).argv0) {
- free(SG(request_info).argv0);
- SG(request_info).argv0 = NULL;
- }
- return SUCCESS;
-}
-
-static char* sapi_cli_read_cookies(TSRMLS_D)
-{
- return NULL;
-}
-
-static void sapi_cli_send_header(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC)
-{
-}
-
-
-static int php_cli_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-/* {{{ sapi_cli_ini_defaults */
-
-/* overwriteable ini defaults must be set in sapi_cli_ini_defaults() */
-#define INI_DEFAULT(name,value)\
- ZVAL_STRING(tmp, value, 0);\
- zend_hash_update(configuration_hash, name, sizeof(name), tmp, sizeof(zval), (void**)&entry);\
- Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry))
-
-/* hard coded ini settings must be set in main() */
-#define INI_HARDCODED(name,value)\
- zend_alter_ini_entry(name, sizeof(name), value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
-
-static void sapi_cli_ini_defaults(HashTable *configuration_hash)
-{
- zval *tmp, *entry;
-
- MAKE_STD_ZVAL(tmp);
-
- INI_DEFAULT("report_zend_debug", "0");
- INI_DEFAULT("display_errors", "1");
-
- FREE_ZVAL(tmp);
-}
-/* }}} */
-
-/* {{{ sapi_module_struct cli_sapi_module
- */
-static sapi_module_struct cli_sapi_module = {
- "cli", /* name */
- "Command Line Interface", /* pretty name */
-
- php_cli_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- sapi_cli_deactivate, /* deactivate */
-
- sapi_cli_ub_write, /* unbuffered write */
- sapi_cli_flush, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- NULL, /* header handler */
- NULL, /* send headers handler */
- sapi_cli_send_header, /* send header handler */
-
- NULL, /* read POST data */
- sapi_cli_read_cookies, /* read Cookies */
-
- sapi_cli_register_variables, /* register server variables */
- sapi_cli_log_message, /* Log message */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-/* }}} */
-
-/* {{{ php_cli_usage
- */
-static void php_cli_usage(char *argv0)
-{
- char *prog;
-
- prog = strrchr(argv0, '/');
- if (prog) {
- prog++;
- } else {
- prog = "php";
- }
-
- php_printf( "Usage: %s [options] [-f] <file> [--] [args...]\n"
- " %s [options] -r <code> [--] [args...]\n"
- " %s [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]\n"
- " %s [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]\n"
- " %s [options] -- [args...]\n"
- "\n"
- " -a Run interactively\n"
- " -c <path>|<file> Look for php.ini file in this directory\n"
- " -n No php.ini file will be used\n"
- " -d foo[=bar] Define INI entry foo with value 'bar'\n"
- " -e Generate extended information for debugger/profiler\n"
- " -f <file> Parse <file>.\n"
- " -h This help\n"
- " -i PHP information\n"
- " -l Syntax check only (lint)\n"
- " -m Show compiled in modules\n"
- " -r <code> Run PHP <code> without using script tags <?..?>\n"
- " -B <begin_code> Run PHP <begin_code> before processing input lines\n"
- " -R <code> Run PHP <code> for every input line\n"
- " -F <file> Parse and execute <file> for every input line\n"
- " -E <end_code> Run PHP <end_code> after processing all input lines\n"
- " -H Hide any passed arguments from external tools.\n"
- " -s Display colour syntax highlighted source.\n"
- " -v Version number\n"
- " -w Display source with stripped comments and whitespace.\n"
- " -z <file> Load Zend extension <file>.\n"
- "\n"
- " args... Arguments passed to script. Use -- args when first argument\n"
- " starts with - or script is read from stdin\n"
- "\n"
- , prog, prog, prog, prog, prog);
-}
-/* }}} */
-
-static void define_command_line_ini_entry(char *arg)
-{
- char *name, *value;
-
- name = arg;
- value = strchr(arg, '=');
- if (value) {
- *value = 0;
- value++;
- } else {
- value = "1";
- }
- zend_alter_ini_entry(name, strlen(name)+1, value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
-}
-
-
-static void php_register_command_line_global_vars(char **arg TSRMLS_DC)
-{
- char *var, *val;
-
- var = *arg;
- val = strchr(var, '=');
- if (!val) {
- printf("No value specified for variable '%s'\n", var);
- } else {
- *val++ = '\0';
- php_register_variable(var, val, NULL TSRMLS_CC);
- }
- efree(*arg);
-}
-
-static php_stream_context *sc_in_process = NULL;
-static php_stream *s_in_process = NULL;
-
-static void cli_register_file_handles(TSRMLS_D)
-{
- zval *zin, *zout, *zerr;
- php_stream *s_in, *s_out, *s_err;
- php_stream_context *sc_in=NULL, *sc_out=NULL, *sc_err=NULL;
- zend_constant ic, oc, ec;
-
- MAKE_STD_ZVAL(zin);
- MAKE_STD_ZVAL(zout);
- MAKE_STD_ZVAL(zerr);
-
- s_in = php_stream_open_wrapper_ex("php://stdin", "rb", 0, NULL, sc_in);
- s_out = php_stream_open_wrapper_ex("php://stdout", "wb", 0, NULL, sc_out);
- s_err = php_stream_open_wrapper_ex("php://stderr", "wb", 0, NULL, sc_err);
-
- if (s_in==NULL || s_out==NULL || s_err==NULL) {
- return;
- }
-
- sc_in_process = sc_in;
- s_in_process = s_in;
-
- php_stream_to_zval(s_in, zin);
- php_stream_to_zval(s_out, zout);
- php_stream_to_zval(s_err, zerr);
-
- ic.value = *zin;
- ic.flags = CONST_CS;
- ic.name = zend_strndup("STDIN", 6);
- ic.name_len = 6;
- zend_register_constant(&ic TSRMLS_CC);
-
- oc.value = *zout;
- oc.flags = CONST_CS;
- oc.name = zend_strndup("STDOUT", 7);
- oc.name_len = 7;
- zend_register_constant(&oc TSRMLS_CC);
-
- ec.value = *zerr;
- ec.flags = CONST_CS;
- ec.name = zend_strndup("STDERR", 7);
- ec.name_len = 7;
- zend_register_constant(&ec TSRMLS_CC);
-
- FREE_ZVAL(zin);
- FREE_ZVAL(zout);
- FREE_ZVAL(zerr);
-}
-
-static const char *param_mode_conflict = "Either execute direct code, process stdin or use a file.\n";
-
-/* {{{ cli_seek_file_begin
- */
-static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file, int *lineno TSRMLS_DC)
-{
- int c;
-
- *lineno = 1;
-
- if (!(file_handle->handle.fp = VCWD_FOPEN(script_file, "rb"))) {
- php_printf("Could not open input file: %s.\n", script_file);
- return FAILURE;
- }
- file_handle->filename = script_file;
- /* #!php support */
- c = fgetc(file_handle->handle.fp);
- if (c == '#') {
- while (c != 10 && c != 13) {
- c = fgetc(file_handle->handle.fp); /* skip to end of line */
- }
- /* handle situations where line is terminated by \r\n */
- if (c == 13) {
- if (fgetc(file_handle->handle.fp) != 10) {
- long pos = ftell(file_handle->handle.fp);
- fseek(file_handle->handle.fp, pos - 1, SEEK_SET);
- }
- }
- *lineno = 2;
- } else {
- rewind(file_handle->handle.fp);
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ main
- */
-int main(int argc, char *argv[])
-{
- int exit_status = SUCCESS;
- int c;
- zend_file_handle file_handle;
-/* temporary locals */
- int behavior=PHP_MODE_STANDARD;
- int orig_optind=optind;
- char *orig_optarg=optarg;
- char *arg_free=NULL, **arg_excp=&arg_free;
- char *script_file=NULL;
- zend_llist global_vars;
- int interactive=0;
- int module_started = 0;
- int lineno = 0;
- char *exec_direct=NULL, *exec_run=NULL, *exec_begin=NULL, *exec_end=NULL;
- const char *param_error=NULL;
- int scan_input = 0;
- int hide_argv = 0;
-/* end of temporary locals */
-#ifdef ZTS
- zend_compiler_globals *compiler_globals;
- zend_executor_globals *executor_globals;
- php_core_globals *core_globals;
- sapi_globals_struct *sapi_globals;
- void ***tsrm_ls;
-#endif
-
-
-#ifdef HAVE_SIGNAL_H
-#if defined(SIGPIPE) && defined(SIG_IGN)
- signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE in standalone mode so
- that sockets created via fsockopen()
- don't kill PHP if the remote site
- closes it. in apache|apxs mode apache
- does that for us! thies@thieso.net
- 20000419 */
-#endif
-#endif
-
-
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
-#endif
-
- cli_sapi_module.ini_defaults = sapi_cli_ini_defaults;
- cli_sapi_module.phpinfo_as_text = 1;
- sapi_startup(&cli_sapi_module);
-
-#ifdef PHP_WIN32
- _fmode = _O_BINARY; /*sets default for file streams to binary */
- setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */
- setmode(_fileno(stdout), O_BINARY); /* make the stdio mode be binary */
- setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
-#endif
-
-
- while ((c = php_getopt(argc, argv, OPTIONS, &optarg, &optind, 0))!=-1) {
- switch (c) {
- case 'c':
- cli_sapi_module.php_ini_path_override = strdup(optarg);
- break;
- case 'n':
- cli_sapi_module.php_ini_ignore = 1;
- break;
- }
- }
- optind = orig_optind;
- optarg = orig_optarg;
-
- cli_sapi_module.executable_location = argv[0];
-
-#ifdef ZTS
- compiler_globals = ts_resource(compiler_globals_id);
- executor_globals = ts_resource(executor_globals_id);
- core_globals = ts_resource(core_globals_id);
- sapi_globals = ts_resource(sapi_globals_id);
- tsrm_ls = ts_resource(0);
-#endif
-
- /* startup after we get the above ini override se we get things right */
- if (php_module_startup(&cli_sapi_module, NULL, 0)==FAILURE) {
- /* there is no way to see if we must call zend_ini_deactivate()
- * since we cannot check if EG(ini_directives) has been initialised
- * because the executor's constructor does not set initialize it.
- * Apart from that there seems no need for zend_ini_deactivate() yet.
- * So we goto out_err.*/
- exit_status = 1;
- goto out_err;
- }
- module_started = 1;
-
- zend_first_try {
- zend_llist_init(&global_vars, sizeof(char *), NULL, 0);
-
- zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */
- CG(in_compilation) = 0; /* not initialized but needed for several options */
- EG(uninitialized_zval_ptr) = NULL;
-
- if (cli_sapi_module.php_ini_path_override && cli_sapi_module.php_ini_ignore) {
- PUTS("You cannot use both -n and -c switch. Use -h for help.\n");
- exit_status=1;
- goto out_err;
- }
-
- while ((c = php_getopt(argc, argv, OPTIONS, &optarg, &optind, 0)) != -1) {
- switch (c) {
-
- case 'h': /* help & quit */
- case '?':
- php_output_startup();
- php_output_activate(TSRMLS_C);
- php_cli_usage(argv[0]);
- php_end_ob_buffers(1 TSRMLS_CC);
- exit_status=1;
- goto out_err;
-
-
- case 'i': /* php info & quit */
- if (php_request_startup(TSRMLS_C)==FAILURE) {
- goto err;
- }
- php_print_info(0xFFFFFFFF TSRMLS_CC);
- php_end_ob_buffers(1 TSRMLS_CC);
- exit_status=1;
- goto out;
-
- case 'm': /* list compiled in modules */
- php_output_startup();
- php_output_activate(TSRMLS_C);
- php_printf("[PHP Modules]\n");
- print_modules(TSRMLS_C);
- php_printf("\n[Zend Modules]\n");
- print_extensions(TSRMLS_C);
- php_printf("\n");
- php_end_ob_buffers(1 TSRMLS_CC);
- exit_status=1;
- goto out_err;
-
- case 'v': /* show php version & quit */
- if (php_request_startup(TSRMLS_C)==FAILURE) {
- goto err;
- }
- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2003 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
- php_end_ob_buffers(1 TSRMLS_CC);
- exit_status=1;
- goto out;
-
- default:
- break;
- }
- }
-
- /* Set some CLI defaults */
- SG(options) |= SAPI_OPTION_NO_CHDIR;
- /* here is the place for hard coded defaults which cannot be overwritten in the ini file */
- INI_HARDCODED("register_argc_argv", "1");
- INI_HARDCODED("html_errors", "0");
- INI_HARDCODED("implicit_flush", "1");
- INI_HARDCODED("max_execution_time", "0");
-
- optind = orig_optind;
- optarg = orig_optarg;
- while ((c = php_getopt(argc, argv, OPTIONS, &optarg, &optind, 0)) != -1) {
- switch (c) {
-
- case 'a': /* interactive mode */
- printf("Interactive mode enabled\n\n");
- interactive=1;
- break;
-
- case 'C': /* don't chdir to the script directory */
- /* This is default so NOP */
- break;
- case 'd': /* define ini entries on command line */
- define_command_line_ini_entry(optarg);
- break;
-
- case 'e': /* enable extended info output */
- CG(extended_info) = 1;
- break;
-
- case 'F':
- if (behavior == PHP_MODE_PROCESS_STDIN) {
- if (exec_run || script_file) {
- param_error = "You can use -R or -F only once.\n";
- break;
- }
- } else if (behavior != PHP_MODE_STANDARD) {
- param_error = param_mode_conflict;
- break;
- }
- behavior=PHP_MODE_PROCESS_STDIN;
- script_file = optarg;
- break;
-
- case 'f': /* parse file */
- if (behavior == PHP_MODE_CLI_DIRECT || behavior == PHP_MODE_PROCESS_STDIN) {
- param_error = param_mode_conflict;
- break;
- } else if (script_file) {
- param_error = "You can use -f only once.\n";
- break;
- }
- script_file = optarg;
- break;
-
- case 'g': /* define global variables on command line */
- {
- char *arg = estrdup(optarg);
-
- zend_llist_add_element(&global_vars, &arg);
- }
- break;
-
- case 'l': /* syntax check mode */
- if (behavior != PHP_MODE_STANDARD) {
- break;
- }
- behavior=PHP_MODE_LINT;
- break;
-
-#if 0 /* not yet operational, see also below ... */
- case '': /* generate indented source mode*/
- if (behavior == PHP_MODE_CLI_DIRECT || behavior == PHP_MODE_PROCESS_STDIN) {
- param_error = "Source indenting only works for files.\n";
- break;
- }
- behavior=PHP_MODE_INDENT;
- break;
-#endif
-
- case 'q': /* do not generate HTTP headers */
- /* This is default so NOP */
- break;
-
- case 'r': /* run code from command line */
- if (behavior == PHP_MODE_CLI_DIRECT) {
- if (exec_direct || script_file) {
- param_error = "You can use -r only once.\n";
- break;
- }
- } else if (behavior != PHP_MODE_STANDARD) {
- param_error = param_mode_conflict;
- break;
- }
- behavior=PHP_MODE_CLI_DIRECT;
- exec_direct=optarg;
- break;
-
- case 'R':
- if (behavior == PHP_MODE_PROCESS_STDIN) {
- if (exec_run || script_file) {
- param_error = "You can use -R or -F only once.\n";
- break;
- }
- } else if (behavior != PHP_MODE_STANDARD) {
- param_error = param_mode_conflict;
- break;
- }
- behavior=PHP_MODE_PROCESS_STDIN;
- exec_run=optarg;
- break;
-
- case 'B':
- if (behavior == PHP_MODE_PROCESS_STDIN) {
- if (exec_begin) {
- param_error = "You can use -B only once.\n";
- break;
- }
- } else if (behavior != PHP_MODE_STANDARD) {
- param_error = param_mode_conflict;
- break;
- }
- behavior=PHP_MODE_PROCESS_STDIN;
- exec_begin=optarg;
- break;
-
- case 'E':
- if (behavior == PHP_MODE_PROCESS_STDIN) {
- if (exec_end) {
- param_error = "You can use -E only once.\n";
- break;
- }
- } else if (behavior != PHP_MODE_STANDARD) {
- param_error = param_mode_conflict;
- break;
- }
- scan_input = 1;
- behavior=PHP_MODE_PROCESS_STDIN;
- exec_end=optarg;
- break;
-
- case 's': /* generate highlighted HTML from source */
- if (behavior == PHP_MODE_CLI_DIRECT || behavior == PHP_MODE_PROCESS_STDIN) {
- param_error = "Source highlighting only works for files.\n";
- break;
- }
- behavior=PHP_MODE_HIGHLIGHT;
- break;
-
- case 'w':
- if (behavior == PHP_MODE_CLI_DIRECT || behavior == PHP_MODE_PROCESS_STDIN) {
- param_error = "Source stripping only works for files.\n";
- break;
- }
- behavior=PHP_MODE_STRIP;
- break;
-
- case 'z': /* load extension file */
- zend_load_extension(optarg);
- break;
- case 'H':
- hide_argv = 1;
- break;
-
- default:
- break;
- }
- }
-
- if (param_error) {
- PUTS(param_error);
- exit_status=1;
- goto out_err;
- }
-
- CG(interactive) = interactive;
-
- /* only set script_file if not set already and not in direct mode and not at end of parameter list */
- if (argc > optind
- && !script_file
- && behavior!=PHP_MODE_CLI_DIRECT
- && behavior!=PHP_MODE_PROCESS_STDIN
- && strcmp(argv[optind-1],"--"))
- {
- script_file=argv[optind];
- optind++;
- }
- if (script_file) {
- if (cli_seek_file_begin(&file_handle, script_file, &lineno TSRMLS_CC) != SUCCESS) {
- goto err;
- }
- script_filename = script_file;
- } else {
- /* We could handle PHP_MODE_PROCESS_STDIN in a different manner */
- /* here but this would make things only more complicated. And it */
- /* is consitent with the way -R works where the stdin file handle*/
- /* is also accessible. */
- file_handle.filename = "-";
- file_handle.handle.fp = stdin;
- }
- file_handle.type = ZEND_HANDLE_FP;
- file_handle.opened_path = NULL;
- file_handle.free_filename = 0;
- php_self = file_handle.filename;
-
- /* before registering argv to module exchange the *new* argv[0] */
- /* we can achieve this without allocating more memory */
- SG(request_info).argc=argc-optind+1;
- arg_excp = argv+optind-1;
- arg_free = argv[optind-1];
- SG(request_info).path_translated = file_handle.filename;
- argv[optind-1] = file_handle.filename;
- SG(request_info).argv=argv+optind-1;
-
- if (php_request_startup(TSRMLS_C)==FAILURE) {
- *arg_excp = arg_free;
- fclose(file_handle.handle.fp);
- php_request_shutdown((void *) 0);
- PUTS("Could not startup.\n");
- goto err;
- }
- CG(start_lineno) = lineno;
- *arg_excp = arg_free; /* reconstuct argv */
-
- if (hide_argv) {
- int i;
- for (i = 1; i < argc; i++) {
- memset(argv[i], 0, strlen(argv[i]));
- }
- }
-
- /* This actually destructs the elements of the list - ugly hack */
- zend_is_auto_global("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC);
- zend_llist_apply(&global_vars, (llist_apply_func_t) php_register_command_line_global_vars TSRMLS_CC);
- zend_llist_destroy(&global_vars);
-
- PG(during_request_startup) = 0;
- switch (behavior) {
- case PHP_MODE_STANDARD:
- if (strcmp(file_handle.filename, "-")) {
- cli_register_file_handles(TSRMLS_C);
- }
- php_execute_script(&file_handle TSRMLS_CC);
- exit_status = EG(exit_status);
- break;
- case PHP_MODE_LINT:
- exit_status = php_lint_script(&file_handle TSRMLS_CC);
- if (exit_status==SUCCESS) {
- zend_printf("No syntax errors detected in %s\n", file_handle.filename);
- } else {
- zend_printf("Errors parsing %s\n", file_handle.filename);
- }
- break;
- case PHP_MODE_STRIP:
- if (open_file_for_scanning(&file_handle TSRMLS_CC)==SUCCESS) {
- zend_strip(TSRMLS_C);
- fclose(file_handle.handle.fp);
- }
- goto out;
- break;
- case PHP_MODE_HIGHLIGHT:
- {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- if (open_file_for_scanning(&file_handle TSRMLS_CC)==SUCCESS) {
- php_get_highlight_struct(&syntax_highlighter_ini);
- zend_highlight(&syntax_highlighter_ini TSRMLS_CC);
- fclose(file_handle.handle.fp);
- }
- goto out;
- }
- break;
-#if 0
- /* Zeev might want to do something with this one day */
- case PHP_MODE_INDENT:
- open_file_for_scanning(&file_handle TSRMLS_CC);
- zend_indent();
- fclose(file_handle.handle.fp);
- goto out;
- break;
-#endif
- case PHP_MODE_CLI_DIRECT:
- cli_register_file_handles(TSRMLS_C);
- if (zend_eval_string(exec_direct, NULL, "Command line code" TSRMLS_CC) == FAILURE) {
- exit_status=254;
- }
- break;
-
- case PHP_MODE_PROCESS_STDIN:
- {
- char *input;
- size_t len, index = 0;
- pval *argn, *argi;
-
- cli_register_file_handles(TSRMLS_C);
-
- if (exec_begin && zend_eval_string(exec_begin, NULL, "Command line begin code" TSRMLS_CC) == FAILURE) {
- exit_status=254;
- }
- ALLOC_ZVAL(argi);
- Z_TYPE_P(argi) = IS_LONG;
- Z_LVAL_P(argi) = index;
- INIT_PZVAL(argi);
- zend_hash_update(&EG(symbol_table), "argi", sizeof("argi"), &argi, sizeof(pval *), NULL);
- while (exit_status == SUCCESS && (input=php_stream_gets(s_in_process, NULL, 0)) != NULL) {
- len = strlen(input);
- while (len-- && (input[len]=='\n' || input[len]=='\r')) {
- input[len] = '\0';
- }
- ALLOC_ZVAL(argn);
- Z_TYPE_P(argn) = IS_STRING;
- Z_STRLEN_P(argn) = ++len;
- Z_STRVAL_P(argn) = estrndup(input, len);
- INIT_PZVAL(argn);
- zend_hash_update(&EG(symbol_table), "argn", sizeof("argn"), &argn, sizeof(pval *), NULL);
- Z_LVAL_P(argi) = ++index;
- if (exec_run) {
- if (zend_eval_string(exec_run, NULL, "Command line run code" TSRMLS_CC) == FAILURE) {
- exit_status=254;
- }
- } else {
- if (script_file) {
- if (cli_seek_file_begin(&file_handle, script_file, &lineno TSRMLS_CC) != SUCCESS) {
- exit_status = 1;
- } else {
- CG(start_lineno) = lineno;
- php_execute_script(&file_handle TSRMLS_CC);
- exit_status = EG(exit_status);
- }
- }
- }
- efree(input);
- }
- if (exec_end && zend_eval_string(exec_end, NULL, "Command line end code" TSRMLS_CC) == FAILURE) {
- exit_status=254;
- }
-
- break;
- }
- }
-
- if (cli_sapi_module.php_ini_path_override) {
- free(cli_sapi_module.php_ini_path_override);
- }
-
- } zend_catch {
- exit_status = EG(exit_status);
- } zend_end_try();
-
-out:
- php_request_shutdown((void *) 0);
-out_err:
- if (module_started) {
- php_module_shutdown(TSRMLS_C);
- }
- sapi_shutdown();
-#ifdef ZTS
- tsrm_shutdown();
-#endif
-
- exit(exit_status);
-
-err:
- zend_ini_deactivate(TSRMLS_C);
- exit_status = 1;
- goto out_err;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/cli/php_getopt.h b/sapi/cli/php_getopt.h
deleted file mode 100644
index a01fc2ae85..0000000000
--- a/sapi/cli/php_getopt.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-
-/* Define structure for one recognized option (both single char and long name).
- * If short_open is '-' this is the last option.
- */
-typedef struct _opt_struct {
- const char opt_char;
- const int need_param;
- const char * opt_name;
-} opt_struct;
-
-int php_getopt(int argc, char* const *argv, const opt_struct opts[], char **optarg, int *optind, int show_err);
diff --git a/sapi/embed/CREDITS b/sapi/embed/CREDITS
deleted file mode 100644
index a5227b4ea9..0000000000
--- a/sapi/embed/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Embed
-Edin Kadribasic
diff --git a/sapi/embed/EXPERIMENTAL b/sapi/embed/EXPERIMENTAL
deleted file mode 100644
index 293159a693..0000000000
--- a/sapi/embed/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this module is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/sapi/embed/config.m4 b/sapi/embed/config.m4
deleted file mode 100644
index 80fed48d00..0000000000
--- a/sapi/embed/config.m4
+++ /dev/null
@@ -1,32 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_MSG_CHECKING(for embedded SAPI library support)
-
-AC_ARG_ENABLE(embed,
-[ --enable-embed[=TYPE] EXPERIMENTAL: Enable building of embedded SAPI library
- TYPE is either 'shared' or 'static'. [TYPE=shared]],
-[
- case $enableval in
- yes|shared)
- PHP_EMBED_TYPE=shared
- INSTALL_IT="\$(mkinstalldirs) \$(INSTALL_ROOT)\$(prefix)/lib; \$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)\$(prefix)/lib"
- ;;
- static)
- PHP_EMBED_TYPE=static
- INSTALL_IT="\$(mkinstalldirs) \$(INSTALL_ROOT)\$(prefix)/lib; \$(INSTALL) -m 0644 $SAPI_STATIC \$(INSTALL_ROOT)\$(prefix)/lib"
- ;;
- *)
- PHP_EMBED_TYPE=no
- ;;
- esac
-],[
- PHP_EMBED_TYPE=no
-])
-
-AC_MSG_RESULT($PHP_EMBED_TYPE)
-
-if test "$PHP_EMBED_TYPE" != "no"; then
- PHP_SELECT_SAPI(embed, $PHP_EMBED_TYPE, php_embed.c)
-fi
diff --git a/sapi/embed/php4embed.dsp b/sapi/embed/php4embed.dsp
deleted file mode 100644
index d251fca04d..0000000000
--- a/sapi/embed/php4embed.dsp
+++ /dev/null
@@ -1,100 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4embed" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=php4embed - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4embed.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4embed.mak" CFG="php4embed - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4embed - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "php4embed - Win32 Release_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4embed - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /YX /FD /GZ /c
-# ADD BASE RSC /l 0x406 /d "_DEBUG"
-# ADD RSC /l 0x406 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\Debug_TS\php4embed.lib"
-
-!ELSEIF "$(CFG)" == "php4embed - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /YX /FD /c
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\Release_TS\php4embed.lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4embed - Win32 Debug_TS"
-# Name "php4embed - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=php_embed.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=php_embed.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c
deleted file mode 100644
index fb76ff5aa0..0000000000
--- a/sapi/embed/php_embed.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Edin Kadribasic <edink@php.net> |
- +----------------------------------------------------------------------+
-*/
-/* $Id$ */
-
-#include "php_embed.h"
-
-#ifdef PHP_WIN32
-#include <io.h>
-#include <fcntl.h>
-#endif
-
-static char* php_embed_read_cookies(TSRMLS_D)
-{
- return NULL;
-}
-
-static int php_embed_deactivate(TSRMLS_D)
-{
- fflush(stdout);
- return SUCCESS;
-}
-
-static inline size_t php_embed_single_write(const char *str, uint str_length)
-{
-#ifdef PHP_WRITE_STDOUT
- long ret;
-
- ret = write(STDOUT_FILENO, str, str_length);
- if (ret <= 0) return 0;
- return ret;
-#else
- size_t ret;
-
- ret = fwrite(str, 1, MIN(str_length, 16384), stdout);
- return ret;
-#endif
-}
-
-
-static int php_embed_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- const char *ptr = str;
- uint remaining = str_length;
- size_t ret;
-
- while (remaining > 0) {
- ret = php_embed_single_write(ptr, remaining);
- if (!ret) {
- php_handle_aborted_connection();
- }
- ptr += ret;
- remaining -= ret;
- }
-
- return str_length;
-}
-
-static void php_embed_flush(void *server_context)
-{
- if (fflush(stdout)==EOF) {
- php_handle_aborted_connection();
- }
-}
-
-static void php_embed_send_header(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC)
-{
-}
-
-static void php_embed_log_message(char *message)
-{
- fprintf (stderr, "%s\n", message);
-}
-
-static void php_embed_register_variables(zval *track_vars_array TSRMLS_DC)
-{
- php_import_environment_variables(track_vars_array TSRMLS_CC);
-}
-
-static int php_embed_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-sapi_module_struct php_embed_module = {
- "embed", /* name */
- "PHP Embedded Library", /* pretty name */
-
- php_embed_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- php_embed_deactivate, /* deactivate */
-
- php_embed_ub_write, /* unbuffered write */
- php_embed_flush, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- NULL, /* header handler */
- NULL, /* send headers handler */
- php_embed_send_header, /* send header handler */
-
- NULL, /* read POST data */
- php_embed_read_cookies, /* read Cookies */
-
- php_embed_register_variables, /* register server variables */
- php_embed_log_message, /* Log message */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-/* }}} */
-
-int php_embed_init(int argc, char **argv PTSRMLS_DC)
-{
- zend_llist global_vars;
-#ifdef ZTS
- zend_compiler_globals *compiler_globals;
- zend_executor_globals *executor_globals;
- php_core_globals *core_globals;
- sapi_globals_struct *sapi_globals;
- void ***tsrm_ls;
-#endif
-
-#ifdef HAVE_SIGNAL_H
-#if defined(SIGPIPE) && defined(SIG_IGN)
- signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE in standalone mode so
- that sockets created via fsockopen()
- don't kill PHP if the remote site
- closes it. in apache|apxs mode apache
- does that for us! thies@thieso.net
- 20000419 */
-#endif
-#endif
-
-#ifdef PHP_WIN32
- _fmode = _O_BINARY; /*sets default for file streams to binary */
- setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */
- setmode(_fileno(stdout), O_BINARY); /* make the stdio mode be binary */
- setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
-#endif
-
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
-#endif
-
-#ifdef ZTS
- compiler_globals = ts_resource(compiler_globals_id);
- executor_globals = ts_resource(executor_globals_id);
- core_globals = ts_resource(core_globals_id);
- sapi_globals = ts_resource(sapi_globals_id);
- tsrm_ls = ts_resource(0);
- *ptsrm_ls = tsrm_ls;
-#endif
-
- sapi_startup(&php_embed_module);
-
- if (php_embed_module.startup(&php_embed_module)==FAILURE) {
- return FAILURE;
- }
-
- if (argv) {
- php_embed_module.executable_location = argv[0];
- }
-
- zend_llist_init(&global_vars, sizeof(char *), NULL, 0);
-
- /* Set some Embedded PHP defaults */
- SG(options) |= SAPI_OPTION_NO_CHDIR;
- zend_alter_ini_entry("register_argc_argv", 19, "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
- zend_alter_ini_entry("html_errors", 12, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
- zend_alter_ini_entry("implicit_flush", 15, "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
- zend_alter_ini_entry("max_execution_time", 19, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
-
- SG(request_info).argc=argc;
- SG(request_info).argv=argv;
-
- if (php_request_startup(TSRMLS_C)==FAILURE) {
- php_module_shutdown(TSRMLS_C);
- return FAILURE;
- }
-
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
- php_register_variable("PHP_SELF", "-", NULL TSRMLS_CC);
-
- return SUCCESS;
-}
-
-void php_embed_shutdown(TSRMLS_D)
-{
- php_request_shutdown((void *) 0);
- php_module_shutdown(TSRMLS_C);
-#ifdef ZTS
- tsrm_shutdown();
-#endif
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/embed/php_embed.h b/sapi/embed/php_embed.h
deleted file mode 100644
index 2a0d88e1e7..0000000000
--- a/sapi/embed/php_embed.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Edin Kadribasic <edink@php.net> |
- +----------------------------------------------------------------------+
-*/
-/* $Id$ */
-
-#ifndef _PHP_EMBED_H_
-#define _PHP_EMBED_H_
-
-#include <main/php.h>
-#include <main/SAPI.h>
-#include <main/php_main.h>
-#include <main/php_variables.h>
-#include <main/php_ini.h>
-#include <zend_ini.h>
-
-#ifdef ZTS
-#define PTSRMLS_D void ****ptsrm_ls
-#define PTSRMLS_DC , PTSRMLS_D
-#define PTSRMLS_C &tsrm_ls
-#define PTSRMLS_CC , PTSRMLS_C
-#else
-#define PTSRMLS_D
-#define PTSRMLS_DC
-#define PTSRMLS_C
-#define PTSRMLS_CC
-#endif
-
-#define PHP_EMBED_START_BLOCK(x,y) { \
- void ***tsrm_ls; \
- php_embed_init(x, y PTSRMLS_CC); \
- zend_first_try {
-
-#define PHP_EMBED_END_BLOCK() \
- } zend_catch { \
- /* int exit_status = EG(exit_status); */ \
- } zend_end_try(); \
- php_embed_shutdown(TSRMLS_C); \
-}
-
-BEGIN_EXTERN_C()
-int php_embed_init(int argc, char **argv PTSRMLS_DC);
-void php_embed_shutdown(TSRMLS_D);
-extern sapi_module_struct php_embed_module;
-END_EXTERN_C()
-
-
-#endif /* _PHP_EMBED_H_ */
diff --git a/sapi/isapi/CREDITS b/sapi/isapi/CREDITS
deleted file mode 100644
index 11c6fdc73c..0000000000
--- a/sapi/isapi/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-ISAPI
-Andi Gutmans, Zeev Suraski
diff --git a/sapi/isapi/config.m4 b/sapi/isapi/config.m4
deleted file mode 100644
index ece730cef9..0000000000
--- a/sapi/isapi/config.m4
+++ /dev/null
@@ -1,27 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-RESULT=no
-AC_MSG_CHECKING(for Zeus ISAPI support)
-AC_ARG_WITH(isapi,
-[ --with-isapi=DIR Build PHP as an ISAPI module for use with Zeus.],
-[
- if test "$withval" = "yes"; then
- ZEUSPATH=/usr/local/zeus # the default
- else
- ZEUSPATH=$withval
- fi
- test -f "$ZEUSPATH/web/include/httpext.h" || AC_MSG_ERROR(Unable to find httpext.h in $ZEUSPATH/web/include)
- PHP_BUILD_THREAD_SAFE
- AC_DEFINE(WITH_ZEUS,1,[ ])
- PHP_ADD_INCLUDE($ZEUSPATH/web/include)
- PHP_SELECT_SAPI(isapi, shared, php4isapi.c)
- INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$ZEUSPATH/web/bin/"
- RESULT=yes
-])
-AC_MSG_RESULT($RESULT)
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/isapi/php.sym b/sapi/isapi/php.sym
deleted file mode 100644
index 34b50b851c..0000000000
--- a/sapi/isapi/php.sym
+++ /dev/null
@@ -1,5 +0,0 @@
-GetFilterVersion
-HttpFilterProc
-GetExtensionVersion
-HttpExtensionProc
-ZSLMain
diff --git a/sapi/isapi/php4isapi.c b/sapi/isapi/php4isapi.c
deleted file mode 100644
index 1eafefe707..0000000000
--- a/sapi/isapi/php4isapi.c
+++ /dev/null
@@ -1,949 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- | Ben Mansell <ben@zeus.com> (Zeus Support) |
- +----------------------------------------------------------------------+
- */
-
-#include "php.h"
-#include <httpext.h>
-#include <httpfilt.h>
-#include <httpext.h>
-#include "php_main.h"
-#include "SAPI.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-#include "php_variables.h"
-#include "php_ini.h"
-
-#ifdef PHP_WIN32
-# include <process.h>
-#else
-# define __try
-# define __except(val)
-# define __declspec(foo)
-#endif
-
-
-#ifdef WITH_ZEUS
-# include "httpext.h"
-# include <errno.h>
-# define GetLastError() errno
-#endif
-
-#ifdef PHP_WIN32
-#define PHP_ENABLE_SEH
-#endif
-
-/*
-uncomment the following lines to turn off
-exception trapping when running under a debugger
-
-#ifdef _DEBUG
-#undef PHP_ENABLE_SEH
-#endif
-*/
-
-#define MAX_STATUS_LENGTH sizeof("xxxx LONGEST STATUS DESCRIPTION")
-#define ISAPI_SERVER_VAR_BUF_SIZE 1024
-#define ISAPI_POST_DATA_BUF 1024
-
-static zend_bool bFilterLoaded=0;
-static zend_bool bTerminateThreadsOnError=0;
-
-static char *isapi_special_server_variable_names[] = {
- "ALL_HTTP",
- "HTTPS",
-#ifndef WITH_ZEUS
- "SCRIPT_NAME",
-#endif
- NULL
-};
-
-#define NUM_SPECIAL_VARS (sizeof(isapi_special_server_variable_names)/sizeof(char *))
-#define SPECIAL_VAR_ALL_HTTP 0
-#define SPECIAL_VAR_HTTPS 1
-#define SPECIAL_VAR_PHP_SELF 2
-
-static char *isapi_server_variable_names[] = {
- "AUTH_PASSWORD",
- "AUTH_TYPE",
- "AUTH_USER",
- "CONTENT_LENGTH",
- "CONTENT_TYPE",
- "PATH_TRANSLATED",
- "QUERY_STRING",
- "REMOTE_ADDR",
- "REMOTE_HOST",
- "REMOTE_USER",
- "REQUEST_METHOD",
- "SERVER_NAME",
- "SERVER_PORT",
- "SERVER_PROTOCOL",
- "SERVER_SOFTWARE",
-#ifndef WITH_ZEUS
- "APPL_MD_PATH",
- "APPL_PHYSICAL_PATH",
- "INSTANCE_ID",
- "INSTANCE_META_PATH",
- "LOGON_USER",
- "REQUEST_URI",
- "URL",
-#else
- "DOCUMENT_ROOT",
-#endif
- NULL
-};
-
-
-static char *isapi_secure_server_variable_names[] = {
- "CERT_COOKIE",
- "CERT_FLAGS",
- "CERT_ISSUER",
- "CERT_KEYSIZE",
- "CERT_SECRETKEYSIZE",
- "CERT_SERIALNUMBER",
- "CERT_SERVER_ISSUER",
- "CERT_SERVER_SUBJECT",
- "CERT_SUBJECT",
- "HTTPS_KEYSIZE",
- "HTTPS_SECRETKEYSIZE",
- "HTTPS_SERVER_ISSUER",
- "HTTPS_SERVER_SUBJECT",
- "SERVER_PORT_SECURE",
-#ifdef WITH_ZEUS
- "SSL_CLIENT_CN",
- "SSL_CLIENT_EMAIL",
- "SSL_CLIENT_OU",
- "SSL_CLIENT_O",
- "SSL_CLIENT_L",
- "SSL_CLIENT_ST",
- "SSL_CLIENT_C",
- "SSL_CLIENT_I_CN",
- "SSL_CLIENT_I_EMAIL",
- "SSL_CLIENT_I_OU",
- "SSL_CLIENT_I_O",
- "SSL_CLIENT_I_L",
- "SSL_CLIENT_I_ST",
- "SSL_CLIENT_I_C",
-#endif
- NULL
-};
-
-
-static void php_info_isapi(ZEND_MODULE_INFO_FUNC_ARGS)
-{
- char **p;
- char variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- DWORD variable_len;
- char **all_variables[] = {
- isapi_server_variable_names,
- isapi_special_server_variable_names,
- isapi_secure_server_variable_names,
- NULL
- };
- char ***server_variable_names;
- LPEXTENSION_CONTROL_BLOCK lpECB;
-
- lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
-
- php_info_print_table_start();
- php_info_print_table_header(2, "Server Variable", "Value");
- server_variable_names = all_variables;
- while (*server_variable_names) {
- p = *server_variable_names;
- while (*p) {
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if (lpECB->GetServerVariable(lpECB->ConnID, *p, variable_buf, &variable_len)
- && variable_buf[0]) {
- php_info_print_table_row(2, *p, variable_buf);
- } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
- char *tmp_variable_buf;
-
- tmp_variable_buf = (char *) emalloc(variable_len);
- if (lpECB->GetServerVariable(lpECB->ConnID, *p, tmp_variable_buf, &variable_len)
- && variable_buf[0]) {
- php_info_print_table_row(2, *p, tmp_variable_buf);
- }
- efree(tmp_variable_buf);
- }
- p++;
- }
- server_variable_names++;
- }
- php_info_print_table_end();
-}
-
-
-static zend_module_entry php_isapi_module = {
- STANDARD_MODULE_HEADER,
- "ISAPI",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- php_info_isapi,
- NULL,
- STANDARD_MODULE_PROPERTIES
-};
-
-
-static int sapi_isapi_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- DWORD num_bytes = str_length;
- LPEXTENSION_CONTROL_BLOCK ecb;
-
- ecb = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
- if (ecb->WriteClient(ecb->ConnID, (char *) str, &num_bytes, HSE_IO_SYNC) == FALSE) {
- php_handle_aborted_connection();
- }
- return num_bytes;
-}
-
-
-static int sapi_isapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- return SAPI_HEADER_ADD;
-}
-
-
-
-static void accumulate_header_length(sapi_header_struct *sapi_header, uint *total_length TSRMLS_DC)
-{
- *total_length += sapi_header->header_len+2;
-}
-
-
-static void concat_header(sapi_header_struct *sapi_header, char **combined_headers_ptr TSRMLS_DC)
-{
- memcpy(*combined_headers_ptr, sapi_header->header, sapi_header->header_len);
- *combined_headers_ptr += sapi_header->header_len;
- **combined_headers_ptr = '\r';
- (*combined_headers_ptr)++;
- **combined_headers_ptr = '\n';
- (*combined_headers_ptr)++;
-}
-
-
-static int sapi_isapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- uint total_length = 2; /* account for the trailing \r\n */
- char *combined_headers, *combined_headers_ptr;
- LPEXTENSION_CONTROL_BLOCK lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
- HSE_SEND_HEADER_EX_INFO header_info;
- char status_buf[MAX_STATUS_LENGTH];
- sapi_header_struct default_content_type;
-
- /* Obtain headers length */
- if (SG(sapi_headers).send_default_content_type) {
- sapi_get_default_content_type_header(&default_content_type TSRMLS_CC);
- accumulate_header_length(&default_content_type, (void *) &total_length TSRMLS_CC);
- }
- zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t) accumulate_header_length, (void *) &total_length TSRMLS_CC);
-
- /* Generate headers */
- combined_headers = (char *) emalloc(total_length+1);
- combined_headers_ptr = combined_headers;
- if (SG(sapi_headers).send_default_content_type) {
- concat_header(&default_content_type, (void *) &combined_headers_ptr TSRMLS_CC);
- sapi_free_header(&default_content_type); /* we no longer need it */
- }
- zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t) concat_header, (void *) &combined_headers_ptr TSRMLS_CC);
- *combined_headers_ptr++ = '\r';
- *combined_headers_ptr++ = '\n';
- *combined_headers_ptr = 0;
-
- switch (SG(sapi_headers).http_response_code) {
- case 200:
- header_info.pszStatus = "200 OK";
- break;
- case 302:
- header_info.pszStatus = "302 Moved Temporarily";
- break;
- case 401:
- header_info.pszStatus = "401 Authorization Required";
- break;
- default:
- snprintf(status_buf, MAX_STATUS_LENGTH, "%d Undescribed", SG(sapi_headers).http_response_code);
- header_info.pszStatus = status_buf;
- break;
- }
- header_info.cchStatus = strlen(header_info.pszStatus);
- header_info.pszHeader = combined_headers;
- header_info.cchHeader = total_length;
- header_info.fKeepConn = FALSE;
- lpECB->dwHttpStatusCode = SG(sapi_headers).http_response_code;
-
- lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_info, NULL, NULL);
-
- efree(combined_headers);
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-
-static int php_isapi_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, &php_isapi_module, 1)==FAILURE) {
- return FAILURE;
- } else {
- bTerminateThreadsOnError = (zend_bool) INI_INT("isapi.terminate_threads_on_error");
- return SUCCESS;
- }
-}
-
-
-
-static int sapi_isapi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
-{
- LPEXTENSION_CONTROL_BLOCK lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
- DWORD read_from_buf=0;
- DWORD read_from_input=0;
- DWORD total_read=0;
-
- if ((DWORD) SG(read_post_bytes) < lpECB->cbAvailable) {
- read_from_buf = MIN(lpECB->cbAvailable-SG(read_post_bytes), count_bytes);
- memcpy(buffer, lpECB->lpbData+SG(read_post_bytes), read_from_buf);
- total_read += read_from_buf;
- }
- if (read_from_buf<count_bytes
- && (SG(read_post_bytes)+read_from_buf) < lpECB->cbTotalBytes) {
- DWORD cbRead=0, cbSize;
-
- read_from_input = MIN(count_bytes-read_from_buf, lpECB->cbTotalBytes-SG(read_post_bytes)-read_from_buf);
- while (cbRead < read_from_input) {
- cbSize = read_from_input - cbRead;
- if (!lpECB->ReadClient(lpECB->ConnID, buffer+read_from_buf+cbRead, &cbSize) || cbSize==0) {
- break;
- }
- cbRead += cbSize;
- }
- total_read += cbRead;
- }
- return total_read;
-}
-
-
-static char *sapi_isapi_read_cookies(TSRMLS_D)
-{
- LPEXTENSION_CONTROL_BLOCK lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
- char variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
-
- if (lpECB->GetServerVariable(lpECB->ConnID, "HTTP_COOKIE", variable_buf, &variable_len)) {
- return estrndup(variable_buf, variable_len);
- } else if (GetLastError()==ERROR_INSUFFICIENT_BUFFER) {
- char *tmp_variable_buf = (char *) emalloc(variable_len+1);
-
- if (lpECB->GetServerVariable(lpECB->ConnID, "HTTP_COOKIE", tmp_variable_buf, &variable_len)) {
- tmp_variable_buf[variable_len] = 0;
- return tmp_variable_buf;
- } else {
- efree(tmp_variable_buf);
- }
- }
- return NULL;
-}
-
-
-#ifdef WITH_ZEUS
-
-static void sapi_isapi_register_zeus_ssl_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array TSRMLS_DC)
-{
- char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- char static_cons_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- /*
- * We need to construct the /C=.../ST=...
- * DN's for SSL_CLIENT_DN and SSL_CLIENT_I_DN
- */
- strcpy( static_cons_buf, "/C=" );
- if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_C", static_variable_buf, &variable_len ) && static_variable_buf[0] ) {
- strcat( static_cons_buf, static_variable_buf );
- }
- strcat( static_cons_buf, "/ST=" );
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_ST", static_variable_buf, &variable_len ) && static_variable_buf[0] ) {
- strcat( static_cons_buf, static_variable_buf );
- }
- php_register_variable( "SSL_CLIENT_DN", static_cons_buf, track_vars_array TSRMLS_CC );
-
- strcpy( static_cons_buf, "/C=" );
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_I_C", static_variable_buf, &variable_len ) && static_variable_buf[0] ) {
- strcat( static_cons_buf, static_variable_buf );
- }
- strcat( static_cons_buf, "/ST=" );
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_I_ST", static_variable_buf, &variable_len ) && static_variable_buf[0] ) {
- strcat( static_cons_buf, static_variable_buf );
- }
- php_register_variable( "SSL_CLIENT_I_DN", static_cons_buf, track_vars_array TSRMLS_CC );
-}
-
-static void sapi_isapi_register_zeus_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array TSRMLS_DC)
-{
- char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- DWORD scriptname_len = ISAPI_SERVER_VAR_BUF_SIZE;
- DWORD pathinfo_len = 0;
- char *strtok_buf = NULL;
-
- /* Get SCRIPT_NAME, we use this to work out which bit of the URL
- * belongs in PHP's version of PATH_INFO
- */
- lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_NAME", static_variable_buf, &scriptname_len);
-
- /* Adjust Zeus' version of PATH_INFO, set PHP_SELF,
- * and generate REQUEST_URI
- */
- if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_INFO", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
-
- /* PHP_SELF is just PATH_INFO */
- php_register_variable( "PHP_SELF", static_variable_buf, track_vars_array TSRMLS_CC );
-
- /* Chop off filename to get just the 'real' PATH_INFO' */
- pathinfo_len = variable_len - scriptname_len;
- php_register_variable( "PATH_INFO", static_variable_buf + scriptname_len - 1, track_vars_array TSRMLS_CC );
- /* append query string to give url... extra byte for '?' */
- if ( strlen(lpECB->lpszQueryString) + variable_len + 1 < ISAPI_SERVER_VAR_BUF_SIZE ) {
- /* append query string only if it is present... */
- if ( strlen(lpECB->lpszQueryString) ) {
- static_variable_buf[ variable_len - 1 ] = '?';
- strcpy( static_variable_buf + variable_len, lpECB->lpszQueryString );
- }
- php_register_variable( "URL", static_variable_buf, track_vars_array TSRMLS_CC );
- php_register_variable( "REQUEST_URI", static_variable_buf, track_vars_array TSRMLS_CC );
- }
- }
-
- /* Get and adjust PATH_TRANSLATED to what PHP wants */
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_TRANSLATED", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
- static_variable_buf[ variable_len - pathinfo_len - 1 ] = '\0';
- php_register_variable( "PATH_TRANSLATED", static_variable_buf, track_vars_array TSRMLS_CC );
- }
-
- /* Bring in the AUTHENTICATION stuff as needed */
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_USER", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
- php_register_variable( "PHP_AUTH_USER", static_variable_buf, track_vars_array TSRMLS_CC );
- }
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_PASSWORD", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
- php_register_variable( "PHP_AUTH_PW", static_variable_buf, track_vars_array TSRMLS_CC );
- }
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_TYPE", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
- php_register_variable( "AUTH_TYPE", static_variable_buf, track_vars_array TSRMLS_CC );
- }
-
- /* And now, for the SSL variables (if applicable) */
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if ( lpECB->GetServerVariable(lpECB->ConnID, "CERT_COOKIE", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
- sapi_isapi_register_zeus_ssl_variables( lpECB, track_vars_array TSRMLS_CC );
- }
- /* Copy some of the variables we need to meet Apache specs */
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if ( lpECB->GetServerVariable(lpECB->ConnID, "SERVER_SOFTWARE", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
- php_register_variable( "SERVER_SIGNATURE", static_variable_buf, track_vars_array TSRMLS_CC );
- }
-}
-#else
-
-static void sapi_isapi_register_iis_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array TSRMLS_DC)
-{
- char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- char path_info_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- DWORD scriptname_len = ISAPI_SERVER_VAR_BUF_SIZE;
- DWORD pathinfo_len = 0;
- HSE_URL_MAPEX_INFO humi;
-
- /* Get SCRIPT_NAME, we use this to work out which bit of the URL
- * belongs in PHP's version of PATH_INFO. SCRIPT_NAME also becomes PHP_SELF.
- */
- lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_NAME", static_variable_buf, &scriptname_len);
- php_register_variable("SCRIPT_FILENAME", SG(request_info).path_translated, track_vars_array TSRMLS_CC);
-
- /* Adjust IIS' version of PATH_INFO, set PHP_SELF,
- * and generate REQUEST_URI
- * Get and adjust PATH_TRANSLATED to what PHP wants
- */
- if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_INFO", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
-
- /* Chop off filename to get just the 'real' PATH_INFO' */
- php_register_variable( "ORIG_PATH_INFO", static_variable_buf, track_vars_array TSRMLS_CC );
- pathinfo_len = variable_len - scriptname_len;
- strncpy(path_info_buf, static_variable_buf + scriptname_len - 1, sizeof(path_info_buf)-1);
- php_register_variable( "PATH_INFO", path_info_buf, track_vars_array TSRMLS_CC );
- /* append query string to give url... extra byte for '?' */
- if ( strlen(lpECB->lpszQueryString) + variable_len + 1 < ISAPI_SERVER_VAR_BUF_SIZE ) {
- /* append query string only if it is present... */
- if ( strlen(lpECB->lpszQueryString) ) {
- static_variable_buf[ variable_len - 1 ] = '?';
- strcpy( static_variable_buf + variable_len, lpECB->lpszQueryString );
- }
- php_register_variable( "URL", static_variable_buf, track_vars_array TSRMLS_CC );
- php_register_variable( "REQUEST_URI", static_variable_buf, track_vars_array TSRMLS_CC );
- }
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_TRANSLATED", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
- php_register_variable( "ORIG_PATH_TRANSLATED", static_variable_buf, track_vars_array TSRMLS_CC );
- }
- if (lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_MAP_URL_TO_PATH_EX, path_info_buf, &pathinfo_len, (LPDWORD) &humi)) {
- /* Remove trailing \ */
- if (humi.lpszPath[variable_len-2] == '\\') {
- humi.lpszPath[variable_len-2] = 0;
- }
- php_register_variable("PATH_TRANSLATED", humi.lpszPath, track_vars_array TSRMLS_CC);
- }
- }
-
- static_variable_buf[0] = '/';
- static_variable_buf[1] = 0;
- variable_len = 2;
- if (lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_MAP_URL_TO_PATH_EX, static_variable_buf, &variable_len, (LPDWORD) &humi)) {
- /* Remove trailing \ */
- if (humi.lpszPath[variable_len-2] == '\\') {
- humi.lpszPath[variable_len-2] = 0;
- }
- php_register_variable("DOCUMENT_ROOT", humi.lpszPath, track_vars_array TSRMLS_CC);
- }
-
- if (!SG(request_info).auth_user || !SG(request_info).auth_password ||
- !SG(request_info).auth_user[0] || !SG(request_info).auth_password[0]) {
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if (lpECB->GetServerVariable(lpECB->ConnID, "HTTP_AUTHORIZATION", static_variable_buf, &variable_len)
- && static_variable_buf[0]) {
- php_handle_auth_data(static_variable_buf TSRMLS_CC);
- }
- }
-
- if (SG(request_info).auth_user) {
- php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, track_vars_array TSRMLS_CC );
- }
- if (SG(request_info).auth_password) {
- php_register_variable("PHP_AUTH_PW", SG(request_info).auth_password, track_vars_array TSRMLS_CC );
- }
-}
-#endif
-
-static void sapi_isapi_register_server_variables2(char **server_variables, LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array, char **recorded_values TSRMLS_DC)
-{
- char **p=server_variables;
- DWORD variable_len;
- char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- char *variable_buf;
-
- while (*p) {
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if (lpECB->GetServerVariable(lpECB->ConnID, *p, static_variable_buf, &variable_len)
- && static_variable_buf[0]) {
- php_register_variable(*p, static_variable_buf, track_vars_array TSRMLS_CC);
- if (recorded_values) {
- recorded_values[p-server_variables] = estrndup(static_variable_buf, variable_len);
- }
- } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
- variable_buf = (char *) emalloc(variable_len+1);
- if (lpECB->GetServerVariable(lpECB->ConnID, *p, variable_buf, &variable_len)
- && variable_buf[0]) {
- php_register_variable(*p, variable_buf, track_vars_array TSRMLS_CC);
- }
- if (recorded_values) {
- recorded_values[p-server_variables] = variable_buf;
- } else {
- efree(variable_buf);
- }
- }
- p++;
- }
-}
-
-
-static void sapi_isapi_register_server_variables(zval *track_vars_array TSRMLS_DC)
-{
- DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- char *variable;
- char *strtok_buf = NULL;
- char *isapi_special_server_variables[NUM_SPECIAL_VARS];
- LPEXTENSION_CONTROL_BLOCK lpECB;
-
- lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
-
- /* Register the special ISAPI variables */
- memset(isapi_special_server_variables, 0, sizeof(isapi_special_server_variables));
- sapi_isapi_register_server_variables2(isapi_special_server_variable_names, lpECB, track_vars_array, isapi_special_server_variables TSRMLS_CC);
- if (SG(request_info).cookie_data) {
- php_register_variable("HTTP_COOKIE", SG(request_info).cookie_data, track_vars_array TSRMLS_CC);
- }
-
- /* Register the standard ISAPI variables */
- sapi_isapi_register_server_variables2(isapi_server_variable_names, lpECB, track_vars_array, NULL TSRMLS_CC);
-
- if (isapi_special_server_variables[SPECIAL_VAR_HTTPS]
- && (atoi(isapi_special_server_variables[SPECIAL_VAR_HTTPS])
- || !strcasecmp(isapi_special_server_variables[SPECIAL_VAR_HTTPS], "on"))
- ) {
- /* Register SSL ISAPI variables */
- sapi_isapi_register_server_variables2(isapi_secure_server_variable_names, lpECB, track_vars_array, NULL TSRMLS_CC);
- }
-
- if (isapi_special_server_variables[SPECIAL_VAR_HTTPS]) {
- efree(isapi_special_server_variables[SPECIAL_VAR_HTTPS]);
- }
-
-
-#ifdef WITH_ZEUS
- sapi_isapi_register_zeus_variables(lpECB, track_vars_array TSRMLS_CC);
-#else
- sapi_isapi_register_iis_variables(lpECB, track_vars_array TSRMLS_CC);
-#endif
-
- /* PHP_SELF support */
- if (isapi_special_server_variables[SPECIAL_VAR_PHP_SELF]) {
- php_register_variable("PHP_SELF", isapi_special_server_variables[SPECIAL_VAR_PHP_SELF], track_vars_array TSRMLS_CC);
- efree(isapi_special_server_variables[SPECIAL_VAR_PHP_SELF]);
- }
-
- if (isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP]) {
- /* Register the internal bits of ALL_HTTP */
- variable = php_strtok_r(isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP], "\r\n", &strtok_buf);
- while (variable) {
- char *colon = strchr(variable, ':');
-
- if (colon) {
- char *value = colon+1;
-
- while (*value==' ') {
- value++;
- }
- *colon = 0;
- php_register_variable(variable, value, track_vars_array TSRMLS_CC);
- *colon = ':';
- }
- variable = php_strtok_r(NULL, "\r\n", &strtok_buf);
- }
- efree(isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP]);
- }
-}
-
-
-static sapi_module_struct isapi_sapi_module = {
- "isapi", /* name */
- "ISAPI", /* pretty name */
-
- php_isapi_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- sapi_isapi_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- sapi_isapi_header_handler, /* header handler */
- sapi_isapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- sapi_isapi_read_post, /* read POST data */
- sapi_isapi_read_cookies, /* read Cookies */
-
- sapi_isapi_register_server_variables, /* register server variables */
- NULL, /* Log message */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-
-BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pFilterVersion)
-{
- bFilterLoaded = 1;
- pFilterVersion->dwFilterVersion = HTTP_FILTER_REVISION;
- strcpy(pFilterVersion->lpszFilterDesc, isapi_sapi_module.pretty_name);
- pFilterVersion->dwFlags= (SF_NOTIFY_AUTHENTICATION | SF_NOTIFY_PREPROC_HEADERS);
- return TRUE;
-}
-
-
-DWORD WINAPI HttpFilterProc(PHTTP_FILTER_CONTEXT pfc, DWORD notificationType, LPVOID pvNotification)
-{
- TSRMLS_FETCH();
-
- switch (notificationType) {
- case SF_NOTIFY_PREPROC_HEADERS:
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
- break;
- case SF_NOTIFY_AUTHENTICATION: {
- char *auth_user = ((HTTP_FILTER_AUTHENT *) pvNotification)->pszUser;
- char *auth_password = ((HTTP_FILTER_AUTHENT *) pvNotification)->pszPassword;
-
- if (auth_user && auth_user[0]) {
- SG(request_info).auth_user = estrdup(auth_user);
- }
- if (auth_password && auth_password[0]) {
- SG(request_info).auth_password = estrdup(auth_password);
- }
- return SF_STATUS_REQ_HANDLED_NOTIFICATION;
- }
- break;
- }
- return SF_STATUS_REQ_NEXT_NOTIFICATION;
-}
-
-
-static void init_request_info(LPEXTENSION_CONTROL_BLOCK lpECB TSRMLS_DC)
-{
- DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
-#ifndef WITH_ZEUS
- HSE_URL_MAPEX_INFO humi;
-#endif
-
- SG(request_info).request_method = lpECB->lpszMethod;
- SG(request_info).query_string = lpECB->lpszQueryString;
- SG(request_info).request_uri = lpECB->lpszPathInfo;
- SG(request_info).content_type = lpECB->lpszContentType;
- SG(request_info).content_length = lpECB->cbTotalBytes;
- SG(sapi_headers).http_response_code = 200; /* I think dwHttpStatusCode is invalid at this stage -RL */
- if (!bFilterLoaded) { /* we don't have valid ISAPI Filter information */
- SG(request_info).auth_user = SG(request_info).auth_password = NULL;
- }
-
-#ifdef WITH_ZEUS
- /* PATH_TRANSLATED can contain extra PATH_INFO stuff after the
- * file being loaded, so we must use SCRIPT_FILENAME instead
- */
- if(lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_FILENAME", static_variable_buf, &variable_len)) {
- SG(request_info).path_translated = estrdup(static_variable_buf);
- } else
-#else
- /* happily, IIS gives us SCRIPT_NAME which is correct (without PATH_INFO stuff)
- so we can just map that to the physical path and we have our filename */
-
- lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_NAME", static_variable_buf, &variable_len);
- if (lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_MAP_URL_TO_PATH_EX, static_variable_buf, &variable_len, (LPDWORD) &humi)) {
- SG(request_info).path_translated = estrdup(humi.lpszPath);
- } else
-#endif
- /* if mapping fails, default to what the server tells us */
- SG(request_info).path_translated = estrdup(lpECB->lpszPathTranslated);
-
- /* some server configurations allow '..' to slip through in the
- translated path. We'll just refuse to handle such a path. */
- if (strstr(SG(request_info).path_translated,"..")) {
- SG(sapi_headers).http_response_code = 404;
- efree(SG(request_info).path_translated);
- SG(request_info).path_translated = NULL;
- }
-}
-
-
-static void php_isapi_report_exception(char *message, int message_len TSRMLS_DC)
-{
- if (!SG(headers_sent)) {
- HSE_SEND_HEADER_EX_INFO header_info;
- LPEXTENSION_CONTROL_BLOCK lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
-
- header_info.pszStatus = "500 Internal Server Error";
- header_info.cchStatus = strlen(header_info.pszStatus);
- header_info.pszHeader = "Content-Type: text/html\r\n\r\n";
- header_info.cchHeader = strlen(header_info.pszHeader);
-
- lpECB->dwHttpStatusCode = 500;
- lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_info, NULL, NULL);
- SG(headers_sent)=1;
- }
- sapi_isapi_ub_write(message, message_len TSRMLS_CC);
-}
-
-
-BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer)
-{
- pVer->dwExtensionVersion = HSE_VERSION;
-#ifdef WITH_ZEUS
- strncpy( pVer->lpszExtensionDesc, isapi_sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN);
-#else
- lstrcpyn(pVer->lpszExtensionDesc, isapi_sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN);
-#endif
- return TRUE;
-}
-
-
-static void my_endthread()
-{
-#ifdef PHP_WIN32
- if (bTerminateThreadsOnError) {
- _endthread();
- }
-#endif
-}
-
-#ifdef PHP_WIN32
-/* ep is accessible only in the context of the __except expression,
- * so we have to call this function to obtain it.
- */
-BOOL exceptionhandler(LPEXCEPTION_POINTERS *e, LPEXCEPTION_POINTERS ep)
-{
- *e=ep;
- return TRUE;
-}
-#endif
-
-DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB)
-{
- zend_file_handle file_handle;
- zend_bool stack_overflown=0;
- int retval = FAILURE;
-#ifdef PHP_ENABLE_SEH
- LPEXCEPTION_POINTERS e;
-#endif
- TSRMLS_FETCH();
-
- zend_first_try {
-#ifdef PHP_ENABLE_SEH
- __try {
-#endif
- init_request_info(lpECB TSRMLS_CC);
- SG(server_context) = lpECB;
-
- php_request_startup(TSRMLS_C);
-
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.opened_path = NULL;
-
- /* open the script here so we can 404 if it fails */
- if (file_handle.filename)
- retval = php_fopen_primary_script(&file_handle TSRMLS_CC);
-
- if (!file_handle.filename || retval == FAILURE) {
- SG(sapi_headers).http_response_code = 404;
- PUTS("No input file specified.\n");
- } else {
- php_execute_script(&file_handle TSRMLS_CC);
- }
-
- if (SG(request_info).cookie_data) {
- efree(SG(request_info).cookie_data);
- }
- if (SG(request_info).path_translated)
- efree(SG(request_info).path_translated);
-#ifdef PHP_ENABLE_SEH
- } __except(exceptionhandler(&e, GetExceptionInformation())) {
- char buf[1024];
- if (_exception_code()==EXCEPTION_STACK_OVERFLOW) {
- LPBYTE lpPage;
- static SYSTEM_INFO si;
- static MEMORY_BASIC_INFORMATION mi;
- static DWORD dwOldProtect;
-
- GetSystemInfo(&si);
-
- /* Get page ESP is pointing to */
- _asm mov lpPage, esp;
-
- /* Get stack allocation base */
- VirtualQuery(lpPage, &mi, sizeof(mi));
-
- /* Go to the page below the current page */
- lpPage = (LPBYTE) (mi.BaseAddress) - si.dwPageSize;
-
- /* Free pages below current page */
- if (!VirtualFree(mi.AllocationBase, (LPBYTE)lpPage - (LPBYTE) mi.AllocationBase, MEM_DECOMMIT)) {
- _endthread();
- }
-
- /* Restore the guard page */
- if (!VirtualProtect(lpPage, si.dwPageSize, PAGE_GUARD | PAGE_READWRITE, &dwOldProtect)) {
- _endthread();
- }
-
- CG(unclean_shutdown)=1;
- _snprintf(buf, sizeof(buf)-1,"PHP has encountered a Stack overflow");
- php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC);
- } else if (_exception_code()==EXCEPTION_ACCESS_VIOLATION) {
- _snprintf(buf, sizeof(buf)-1,"PHP has encountered an Access Violation at %p", e->ExceptionRecord->ExceptionAddress);
- php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC);
- my_endthread();
- } else {
- _snprintf(buf, sizeof(buf)-1,"PHP has encountered an Unhandled Exception Code %d at %p", e->ExceptionRecord->ExceptionCode , e->ExceptionRecord->ExceptionAddress);
- php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC);
- my_endthread();
- }
- }
-#endif
-#ifdef PHP_ENABLE_SEH
- __try {
- php_request_shutdown(NULL);
- } __except(EXCEPTION_EXECUTE_HANDLER) {
- my_endthread();
- }
-#else
- php_request_shutdown(NULL);
-#endif
- } zend_catch {
- zend_try {
- php_request_shutdown(NULL);
- } zend_end_try();
- return HSE_STATUS_ERROR;
- } zend_end_try();
-
- return HSE_STATUS_SUCCESS;
-}
-
-
-
-__declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
- switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
-#ifdef WITH_ZEUS
- tsrm_startup(128, 1, TSRM_ERROR_LEVEL_CORE, "TSRM.log");
-#else
- tsrm_startup(128, 1, TSRM_ERROR_LEVEL_CORE, "C:\\TSRM.log");
-#endif
- sapi_startup(&isapi_sapi_module);
- if (isapi_sapi_module.startup) {
- isapi_sapi_module.startup(&sapi_module);
- }
- break;
- case DLL_THREAD_ATTACH:
- break;
- case DLL_THREAD_DETACH:
- ts_free_thread();
- break;
- case DLL_PROCESS_DETACH:
- if (isapi_sapi_module.shutdown) {
- isapi_sapi_module.shutdown(&sapi_module);
- }
- tsrm_shutdown();
- break;
- }
- return TRUE;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/sapi/isapi/php4isapi.def b/sapi/isapi/php4isapi.def
deleted file mode 100644
index 596023ef55..0000000000
--- a/sapi/isapi/php4isapi.def
+++ /dev/null
@@ -1,5 +0,0 @@
-EXPORTS
-HttpFilterProc
-GetFilterVersion
-HttpExtensionProc
-GetExtensionVersion
diff --git a/sapi/isapi/php4isapi.dsp b/sapi/isapi/php4isapi.dsp
deleted file mode 100644
index 7913ec6fad..0000000000
--- a/sapi/isapi/php4isapi.dsp
+++ /dev/null
@@ -1,165 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4isapi" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4isapi - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4isapi.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4isapi.mak" CFG="php4isapi - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4isapi - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4isapi - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4isapi - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4isapi - Win32 Release_TSDbg" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4isapi - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D "COMPILE_LIBZEND" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php4isapi - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4isapi - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4isapi___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php4isapi___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /libpath:"..\..\Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4isapi - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4isapi___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "php4isapi___Win32_Release_TSDbg"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /version:4.0 /dll /debug /machine:I386 /libpath:"..\..\Release_TSDbg"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4isapi - Win32 Debug_TS"
-# Name "php4isapi - Win32 Release_TS"
-# Name "php4isapi - Win32 Release_TS_inline"
-# Name "php4isapi - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php4isapi.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php4isapi.def
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# End Target
-# End Project
diff --git a/sapi/isapi/stresstest/getopt.c b/sapi/isapi/stresstest/getopt.c
deleted file mode 100644
index 57faa0f890..0000000000
--- a/sapi/isapi/stresstest/getopt.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/* Borrowed from Apache NT Port */
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <stdlib.h>
-#include "getopt.h"
-#define OPTERRCOLON (1)
-#define OPTERRNF (2)
-#define OPTERRARG (3)
-
-
-char *ap_optarg;
-int ap_optind = 1;
-static int ap_opterr = 1;
-static int ap_optopt;
-
-static int
-ap_optiserr(int argc, char * const *argv, int oint, const char *optstr,
- int optchr, int err)
-{
- if (ap_opterr)
- {
- fprintf(stderr, "Error in argument %d, char %d: ", oint, optchr+1);
- switch(err)
- {
- case OPTERRCOLON:
- fprintf(stderr, ": in flags\n");
- break;
- case OPTERRNF:
- fprintf(stderr, "option not found %c\n", argv[oint][optchr]);
- break;
- case OPTERRARG:
- fprintf(stderr, "no argument for option %c\n", argv[oint][optchr]);
- break;
- default:
- fprintf(stderr, "unknown\n");
- break;
- }
- }
- ap_optopt = argv[oint][optchr];
- return('?');
-}
-
-int ap_getopt(int argc, char* const *argv, const char *optstr)
-{
- static int optchr = 0;
- static int dash = 0; /* have already seen the - */
-
- char *cp;
-
- if (ap_optind >= argc)
- return(EOF);
- if (!dash && (argv[ap_optind][0] != '-'))
- return(EOF);
- if (!dash && (argv[ap_optind][0] == '-') && !argv[ap_optind][1])
- {
- /*
- * use to specify stdin. Need to let pgm process this and
- * the following args
- */
- return(EOF);
- }
- if ((argv[ap_optind][0] == '-') && (argv[ap_optind][1] == '-'))
- {
- /* -- indicates end of args */
- ap_optind++;
- return(EOF);
- }
- if (!dash)
- {
- assert((argv[ap_optind][0] == '-') && argv[ap_optind][1]);
- dash = 1;
- optchr = 1;
- }
-
- /* Check if the guy tries to do a -: kind of flag */
- assert(dash);
- if (argv[ap_optind][optchr] == ':')
- {
- dash = 0;
- ap_optind++;
- return(ap_optiserr(argc, argv, ap_optind-1, optstr, optchr, OPTERRCOLON));
- }
- if (!(cp = strchr(optstr, argv[ap_optind][optchr])))
- {
- int errind = ap_optind;
- int errchr = optchr;
-
- if (!argv[ap_optind][optchr+1])
- {
- dash = 0;
- ap_optind++;
- }
- else
- optchr++;
- return(ap_optiserr(argc, argv, errind, optstr, errchr, OPTERRNF));
- }
- if (cp[1] == ':')
- {
- /* Check for cases where the value of the argument
- is in the form -<arg> <val> or in the form -<arg><val> */
- dash = 0;
- if(!argv[ap_optind][2]) {
- ap_optind++;
- if (ap_optind == argc)
- return(ap_optiserr(argc, argv, ap_optind-1, optstr, optchr, OPTERRARG));
- ap_optarg = argv[ap_optind++];
- }
- else
- {
- ap_optarg = &argv[ap_optind][2];
- ap_optind++;
- }
- return(*cp);
- }
- else
- {
- if (!argv[ap_optind][optchr+1])
- {
- dash = 0;
- ap_optind++;
- }
- else
- optchr++;
- return(*cp);
- }
- assert(0);
- return(0);
-}
-
-#ifdef TESTGETOPT
-int
- main (int argc, char **argv)
- {
- int c;
- extern char *ap_optarg;
- extern int ap_optind;
- int aflg = 0;
- int bflg = 0;
- int errflg = 0;
- char *ofile = NULL;
-
- while ((c = ap_getopt(argc, argv, "abo:")) != EOF)
- switch (c) {
- case 'a':
- if (bflg)
- errflg++;
- else
- aflg++;
- break;
- case 'b':
- if (aflg)
- errflg++;
- else
- bflg++;
- break;
- case 'o':
- ofile = ap_optarg;
- (void)printf("ofile = %s\n", ofile);
- break;
- case '?':
- errflg++;
- }
- if (errflg) {
- (void)fprintf(stderr,
- "usage: cmd [-a|-b] [-o <filename>] files...\n");
- exit (2);
- }
- for ( ; ap_optind < argc; ap_optind++)
- (void)printf("%s\n", argv[ap_optind]);
- return 0;
- }
-
-#endif /* TESTGETOPT */
diff --git a/sapi/isapi/stresstest/getopt.h b/sapi/isapi/stresstest/getopt.h
deleted file mode 100644
index a3e278e3a6..0000000000
--- a/sapi/isapi/stresstest/getopt.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Borrowed from Apache NT Port */
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern char *ap_optarg;
-extern int ap_optind;
-
-int ap_getopt(int argc, char* const *argv, const char *optstr);
-
-#ifdef __cplusplus
-}
-#endif \ No newline at end of file
diff --git a/sapi/isapi/stresstest/notes.txt b/sapi/isapi/stresstest/notes.txt
deleted file mode 100644
index 2bab38dd07..0000000000
--- a/sapi/isapi/stresstest/notes.txt
+++ /dev/null
@@ -1,56 +0,0 @@
-This stress test program is for debugging threading issues with the ISAPI
-module.
-
-2 ways to use it:
-
-1: test any php script file on multiple threads
-2: run the php test scripts bundled with the source code
-
-
-
-GLOBAL SETTINGS
-===============
-
-If you need to set special environement variables, in addition to your
-regular environment, create a file that contains them, one setting per line:
-
-MY_ENV_VAR=XXXXXXXX
-
-This can be used to simulate ISAPI environment variables if need be.
-
-By default, stress test uses 10 threads. To change this, change the define
-NUM_THREADS in stresstest.cpp.
-
-
-
-1: Test any php script file on multiple threads
-===============================================
-
-Create a file that contains a list of php script files, one per line. If
-you need to provide input, place the GET data, or Query String, after the
-filename. File contents would look like:
-
-e:\inetpub\pages\index.php
-e:\inetpub\pages\info.php
-e:\inetpub\pages\test.php a=1&b=2
-
-Run: stresstest L files.txt
-
-
-
-2: Run the php test scripts bundled with the source code
-========================================================
-
-supply the path to the parent of the "tests" directory (expect a couple
-long pauses for a couple of the larger tests)
-
-Run: stresstest T c:\php4-source
-
-
-
-TODO:
-
-* Make more options configurable: number of threads, iterations, etc.
-* Improve stdout output to make it more useful
-* Implement support for SKIPIF
-* Improve speed of CompareFile function (too slow on big files).
diff --git a/sapi/isapi/stresstest/stresstest.cpp b/sapi/isapi/stresstest/stresstest.cpp
deleted file mode 100644
index bf268f4e23..0000000000
--- a/sapi/isapi/stresstest/stresstest.cpp
+++ /dev/null
@@ -1,936 +0,0 @@
-/*
- * ======================================================================= *
- * File: stress .c *
- * stress tester for isapi dll's *
- * based on cgiwrap *
- * ======================================================================= *
- *
-*/
-#define WIN32_LEAN_AND_MEAN
-#include <afx.h>
-#include <afxtempl.h>
-#include <winbase.h>
-#include <winerror.h>
-#include <httpext.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "getopt.h"
-
-// These are things that go out in the Response Header
-//
-#define HTTP_VER "HTTP/1.0"
-#define SERVER_VERSION "Http-Srv-Beta2/1.0"
-
-//
-// Simple wrappers for the heap APIS
-//
-#define xmalloc(s) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (s))
-#define xfree(s) HeapFree(GetProcessHeap(), 0, (s))
-
-//
-// The mandatory exports from the ISAPI DLL
-//
-DWORD numThreads = 1;
-DWORD iterations = 1;
-
-HANDLE StartNow;
-// quick and dirty environment
-typedef CMapStringToString TEnvironment;
-TEnvironment IsapiEnvironment;
-
-typedef struct _TResults {
- LONG ok;
- LONG bad;
-} TResults;
-
-CStringArray IsapiFileList; // list of filenames
-CStringArray TestNames; // --TEST--
-CStringArray IsapiGetData; // --GET--
-CStringArray IsapiPostData; // --POST--
-CStringArray IsapiMatchData; // --EXPECT--
-CArray<TResults, TResults> Results;
-
-typedef struct _TIsapiContext {
- HANDLE in;
- HANDLE out;
- DWORD tid;
- TEnvironment env;
- HANDLE waitEvent;
-} TIsapiContext;
-
-//
-// Prototypes of the functions this sample implements
-//
-extern "C" {
-HINSTANCE hDll;
-typedef BOOL (WINAPI *VersionProc)(HSE_VERSION_INFO *) ;
-typedef DWORD (WINAPI *HttpExtProc)(EXTENSION_CONTROL_BLOCK *);
-typedef BOOL (WINAPI *TerminateProc) (DWORD);
-BOOL WINAPI FillExtensionControlBlock(EXTENSION_CONTROL_BLOCK *, TIsapiContext *) ;
-BOOL WINAPI GetServerVariable(HCONN, LPSTR, LPVOID, LPDWORD );
-BOOL WINAPI ReadClient(HCONN, LPVOID, LPDWORD);
-BOOL WINAPI WriteClient(HCONN, LPVOID, LPDWORD, DWORD);
-BOOL WINAPI ServerSupportFunction(HCONN, DWORD, LPVOID, LPDWORD, LPDWORD);
-VersionProc IsapiGetExtensionVersion;
-HttpExtProc IsapiHttpExtensionProc;
-TerminateProc TerminateExtensionProc;
-HSE_VERSION_INFO version_info;
-}
-
-char * MakeDateStr(VOID);
-char * GetEnv(char *);
-
-
-
-
-DWORD CALLBACK IsapiThread(void *);
-int stress_main(const char *filename,
- const char *arg,
- const char *postfile,
- const char *matchdata);
-
-
-
-BOOL bUseTestFiles = FALSE;
-char temppath[MAX_PATH];
-
-void stripcrlf(char *line)
-{
- DWORD l = strlen(line)-1;
- if (line[l]==10 || line[l]==13) line[l]=0;
- l = strlen(line)-1;
- if (line[l]==10 || line[l]==13) line[l]=0;
-}
-
-#define COMPARE_BUF_SIZE 1024
-
-BOOL CompareFiles(const char*f1, const char*f2)
-{
- FILE *fp1, *fp2;
- bool retval;
- char buf1[COMPARE_BUF_SIZE], buf2[COMPARE_BUF_SIZE];
- int length1, length2;
-
- if ((fp1=fopen(f1, "r"))==NULL) {
- return FALSE;
- }
-
- if ((fp2=fopen(f2, "r"))==NULL) {
- fclose(fp1);
- return FALSE;
- }
-
- retval = TRUE; // success oriented
- while (true) {
- length1 = fread(buf1, 1, sizeof(buf1), fp1);
- length2 = fread(buf2, 1, sizeof(buf2), fp2);
-
- // check for end of file
- if (feof(fp1)) {
- if (!feof(fp2)) {
- retval = FALSE;
- }
- break;
- } else if (feof(fp2)) {
- if (!feof(fp1)) {
- retval = FALSE;
- }
- break;
- }
-
- // compare data
- if (length1!=length2
- || memcmp(buf1, buf2, length1)!=0) {
- retval = FALSE;
- break;
- }
- }
- fclose(fp1);
- fclose(fp2);
-
- return retval;
-}
-
-
-BOOL CompareStringWithFile(const char *filename, const char *str, unsigned int str_length)
-{
- FILE *fp;
- bool retval;
- char buf[COMPARE_BUF_SIZE];
- unsigned int offset=0, readbytes;
- fprintf(stderr, "test %s\n",filename);
- if ((fp=fopen(filename, "rb"))==NULL) {
- fprintf(stderr, "Error opening %s\n",filename);
- return FALSE;
- }
-
- retval = TRUE; // success oriented
- while (true) {
- readbytes = fread(buf, 1, sizeof(buf), fp);
-
- // check for end of file
-
- if (offset+readbytes > str_length
- || memcmp(buf, str+offset, readbytes)!=NULL) {
- fprintf(stderr, "File missmatch %s\n",filename);
- retval = FALSE;
- break;
- }
- if (feof(fp)) {
- if (!retval) fprintf(stderr, "File zero length %s\n",filename);
- break;
- }
- }
- fclose(fp);
-
- return retval;
-}
-
-
-BOOL ReadGlobalEnvironment(const char *environment)
-{
- if (environment) {
- FILE *fp = fopen(environment, "r");
- DWORD i=0;
- if (fp) {
- char line[2048];
- while (fgets(line, sizeof(line)-1, fp)) {
- // file.php arg1 arg2 etc.
- char *p = strchr(line, '=');
- if (p) {
- *p=0;
- IsapiEnvironment[line]=p+1;
- }
- }
- fclose(fp);
- return IsapiEnvironment.GetCount() > 0;
- }
- }
- return FALSE;
-}
-
-BOOL ReadFileList(const char *filelist)
-{
- FILE *fp = fopen(filelist, "r");
- if (!fp) {
- printf("Unable to open %s\r\n", filelist);
- }
- char line[2048];
- int i=0;
- while (fgets(line, sizeof(line)-1, fp)) {
- // file.php arg1 arg2 etc.
- stripcrlf(line);
- if (strlen(line)>3) {
- char *p = strchr(line, ' ');
- if (p) {
- *p = 0;
- // get file
-
- IsapiFileList.Add(line);
- IsapiGetData.Add(p+1);
- } else {
- // just a filename is all
- IsapiFileList.Add(line);
- IsapiGetData.Add("");
- }
- }
-
- // future use
- IsapiPostData.Add("");
- IsapiMatchData.Add("");
- TestNames.Add("");
-
- i++;
- }
- Results.SetSize(TestNames.GetSize());
-
- fclose(fp);
- return IsapiFileList.GetSize() > 0;
-}
-
-void DoThreads() {
-
- if (IsapiFileList.GetSize() == 0) {
- printf("No Files to test\n");
- return;
- }
-
- printf("Starting Threads...\n");
- // loop creating threads
- DWORD tid;
- HANDLE *threads = new HANDLE[numThreads];
- DWORD i;
- for (i=0; i< numThreads; i++) {
- threads[i]=CreateThread(NULL, 0, IsapiThread, NULL, CREATE_SUSPENDED, &tid);
- }
- for (i=0; i< numThreads; i++) {
- if (threads[i]) ResumeThread(threads[i]);
- }
- // wait for threads to finish
- WaitForMultipleObjects(numThreads, threads, TRUE, INFINITE);
- for (i=0; i< numThreads; i++) {
- CloseHandle(threads[i]);
- }
- delete threads;
-}
-
-void DoFileList(const char *filelist, const char *environment)
-{
- // read config files
-
- if (!ReadFileList(filelist)) {
- printf("No Files to test!\r\n");
- return;
- }
-
- ReadGlobalEnvironment(environment);
-
- DoThreads();
-}
-
-
-/**
- * ParseTestFile
- * parse a single phpt file and add it to the arrays
- */
-BOOL ParseTestFile(const char *path, const char *fn)
-{
- // parse the test file
- char filename[MAX_PATH];
- _snprintf(filename, sizeof(filename)-1, "%s\\%s", path, fn);
- char line[1024];
- memset(line, 0, sizeof(line));
- CString cTest, cSkipIf, cPost, cGet, cFile, cExpect;
- printf("Reading %s\r\n", filename);
-
- enum state {none, test, skipif, post, get, file, expect} parsestate = none;
-
- FILE *fp = fopen(filename, "rb");
- char *tn = _tempnam(temppath,"pht.");
- char *en = _tempnam(temppath,"exp.");
- FILE *ft = fopen(tn, "wb+");
- FILE *fe = fopen(en, "wb+");
- if (fp && ft && fe) {
- while (fgets(line, sizeof(line)-1, fp)) {
- if (line[0]=='-') {
- if (_strnicmp(line, "--TEST--", 8)==0) {
- parsestate = test;
- continue;
- } else if (_strnicmp(line, "--SKIPIF--", 10)==0) {
- parsestate = skipif;
- continue;
- } else if (_strnicmp(line, "--POST--", 8)==0) {
- parsestate = post;
- continue;
- } else if (_strnicmp(line, "--GET--", 7)==0) {
- parsestate = get;
- continue;
- } else if (_strnicmp(line, "--FILE--", 8)==0) {
- parsestate = file;
- continue;
- } else if (_strnicmp(line, "--EXPECT--", 10)==0) {
- parsestate = expect;
- continue;
- }
- }
- switch (parsestate) {
- case test:
- stripcrlf(line);
- cTest = line;
- break;
- case skipif:
- cSkipIf += line;
- break;
- case post:
- cPost += line;
- break;
- case get:
- cGet += line;
- break;
- case file:
- fputs(line, ft);
- break;
- case expect:
- fputs(line, fe);
- break;
- }
- }
-
- fclose(fp);
- fclose(ft);
- fclose(fe);
-
- if (!cTest.IsEmpty()) {
- IsapiFileList.Add(tn);
- TestNames.Add(cTest);
- IsapiGetData.Add(cGet);
- IsapiPostData.Add(cPost);
- IsapiMatchData.Add(en);
- free(tn);
- free(en);
- return TRUE;
- }
- }
- free(tn);
- free(en);
- return FALSE;
-}
-
-
-/**
- * GetTestFiles
- * Recurse through the path and subdirectories, parse each phpt file
- */
-BOOL GetTestFiles(const char *path)
-{
- // find all files .phpt under testpath\tests
- char FindPath[MAX_PATH];
- WIN32_FIND_DATA fd;
- memset(&fd, 0, sizeof(WIN32_FIND_DATA));
-
- _snprintf(FindPath, sizeof(FindPath)-1, "%s\\*.*", path);
- HANDLE fh = FindFirstFile(FindPath, &fd);
- if (fh != INVALID_HANDLE_VALUE) {
- do {
- if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
- !strchr(fd.cFileName, '.')) {
- // subdirectory, recurse into it
- char NewFindPath[MAX_PATH];
- _snprintf(NewFindPath, sizeof(NewFindPath)-1, "%s\\%s", path, fd.cFileName);
- GetTestFiles(NewFindPath);
- } else if (strstr(fd.cFileName, ".phpt")) {
- // got test file, parse it now
- if (ParseTestFile(path, fd.cFileName)) {
- printf("Test File Added: %s\\%s\r\n", path, fd.cFileName);
- }
- }
- memset(&fd, 0, sizeof(WIN32_FIND_DATA));
- } while (FindNextFile(fh, &fd) != 0);
- FindClose(fh);
- }
- return IsapiFileList.GetSize() > 0;
-}
-
-void DeleteTempFiles(const char *mask)
-{
- char FindPath[MAX_PATH];
- WIN32_FIND_DATA fd;
- memset(&fd, 0, sizeof(WIN32_FIND_DATA));
-
- _snprintf(FindPath, sizeof(FindPath)-1, "%s\\%s", temppath, mask);
- HANDLE fh = FindFirstFile(FindPath, &fd);
- if (fh != INVALID_HANDLE_VALUE) {
- do {
- char NewFindPath[MAX_PATH];
- _snprintf(NewFindPath, sizeof(NewFindPath)-1, "%s\\%s", temppath, fd.cFileName);
- DeleteFile(NewFindPath);
- memset(&fd, 0, sizeof(WIN32_FIND_DATA));
- } while (FindNextFile(fh, &fd) != 0);
- FindClose(fh);
- }
-}
-
-void DoTestFiles(const char *filelist, const char *environment)
-{
- if (!GetTestFiles(filelist)) {
- printf("No Files to test!\r\n");
- return;
- }
-
- Results.SetSize(IsapiFileList.GetSize());
-
- ReadGlobalEnvironment(environment);
-
- DoThreads();
-
- printf("\r\nRESULTS:\r\n");
- // show results:
- DWORD r = Results.GetSize();
- for (DWORD i=0; i< r; i++) {
- TResults result = Results.GetAt(i);
- printf("%s\r\nOK: %d FAILED: %d\r\n", TestNames.GetAt(i), result.ok, result.bad);
- }
-
- // delete temp files
- printf("Deleting Temp Files\r\n");
- DeleteTempFiles("exp.*");
- DeleteTempFiles("pht.*");
- printf("Done\r\n");
-}
-
-#define OPTSTRING "m:f:d:h:t:i:"
-static void _usage(char *argv0)
-{
- char *prog;
-
- prog = strrchr(argv0, '/');
- if (prog) {
- prog++;
- } else {
- prog = "stresstest";
- }
-
- printf("Usage: %s -m <isapi.dll> -d|-l <file> [-t <numthreads>] [-i <numiterations>]\n"
- " -m path to isapi dll\n"
- " -d <directory> php directory (to run php test files).\n"
- " -f <file> file containing list of files to run\n"
- " -t number of threads to use (default=1)\n"
- " -i number of iterations per thread (default=1)\n"
- " -h This help\n", prog);
-}
-int main(int argc, char* argv[])
-{
- LPVOID lpMsgBuf;
- char *filelist=NULL, *environment=NULL, *module=NULL;
- int c = NULL;
- while ((c=ap_getopt(argc, argv, OPTSTRING))!=-1) {
- switch (c) {
- case 'd':
- bUseTestFiles = TRUE;
- filelist = strdup(ap_optarg);
- break;
- case 'f':
- bUseTestFiles = FALSE;
- filelist = strdup(ap_optarg);
- break;
- case 'e':
- environment = strdup(ap_optarg);
- break;
- case 't':
- numThreads = atoi(ap_optarg);
- break;
- case 'i':
- iterations = atoi(ap_optarg);
- break;
- case 'm':
- module = strdup(ap_optarg);
- break;
- case 'h':
- _usage(argv[0]);
- exit(0);
- break;
- }
- }
- if (!module || !filelist) {
- _usage(argv[0]);
- exit(0);
- }
-
- GetTempPath(sizeof(temppath), temppath);
- hDll = LoadLibrary(module); // Load our DLL
-
- if (!hDll) {
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR) &lpMsgBuf,
- 0,
- NULL
- );
- fprintf(stderr,"Error: Dll 'php4isapi.dll' not found -%d\n%s\n", GetLastError(), lpMsgBuf);
- free (module);
- free(filelist);
- LocalFree( lpMsgBuf );
- return -1;
- }
-
- //
- // Find the exported functions
-
- IsapiGetExtensionVersion = (VersionProc)GetProcAddress(hDll,"GetExtensionVersion");
- if (!IsapiGetExtensionVersion) {
- fprintf(stderr,"Can't Get Extension Version %d\n", GetLastError());
- free (module);
- free(filelist);
- return -1;
- }
- IsapiHttpExtensionProc = (HttpExtProc)GetProcAddress(hDll,"HttpExtensionProc");
- if (!IsapiHttpExtensionProc) {
- fprintf(stderr,"Can't Get Extension proc %d\n", GetLastError());
- free (module);
- free(filelist);
- return -1;
- }
- TerminateExtensionProc = (TerminateProc) GetProcAddress(hDll,
- "TerminateExtension");
-
- // This should really check if the version information matches what we
- // expect.
- //
- if (!IsapiGetExtensionVersion(&version_info) ) {
- fprintf(stderr,"Fatal: GetExtensionVersion failed\n");
- free (module);
- free(filelist);
- return -1;
- }
-
- if (bUseTestFiles) {
- char TestPath[MAX_PATH];
- if (filelist != NULL)
- _snprintf(TestPath, sizeof(TestPath)-1, "%s\\tests", filelist);
- else strcpy(TestPath, "tests");
- DoTestFiles(TestPath, environment);
- } else {
- DoFileList(filelist, environment);
- }
-
- // cleanup
- if (TerminateExtensionProc) TerminateExtensionProc(0);
-
- // We should really free memory (e.g., from GetEnv), but we'll be dead
- // soon enough
-
- FreeLibrary(hDll);
- free (module);
- free(filelist);
- return 0;
-}
-
-
-DWORD CALLBACK IsapiThread(void *p)
-{
- DWORD filecount = IsapiFileList.GetSize();
-
- for (DWORD j=0; j<iterations; j++) {
- for (DWORD i=0; i<filecount; i++) {
- // execute each file
- CString testname = TestNames.GetAt(i);
- BOOL ok = FALSE;
- if (stress_main(IsapiFileList.GetAt(i),
- IsapiGetData.GetAt(i),
- IsapiPostData.GetAt(i),
- IsapiMatchData.GetAt(i))) {
- InterlockedIncrement(&Results[i].ok);
- ok = TRUE;
- } else {
- InterlockedIncrement(&Results[i].bad);
- ok = FALSE;
- }
-
- if (testname.IsEmpty()) {
- printf("Thread %d File %s\n", GetCurrentThreadId(), IsapiFileList.GetAt(i));
- } else {
- printf("tid %d: %s %s\n", GetCurrentThreadId(), testname, ok?"OK":"FAIL");
- }
- Sleep(10);
- }
- }
- printf("Thread ending...\n");
- return 0;
-}
-
-/*
- * ======================================================================= *
- * In the startup of this program, we look at our executable name and *
- * replace the ".EXE" with ".DLL" to find the ISAPI DLL we need to load. *
- * This means that the executable need only be given the same "name" as *
- * the DLL to load. There is no recompilation required. *
- * ======================================================================= *
-*/
-BOOL stress_main(const char *filename,
- const char *arg,
- const char *postdata,
- const char *matchdata)
-{
-
- EXTENSION_CONTROL_BLOCK ECB;
- DWORD rc;
- TIsapiContext context;
-
- // open output and input files
- context.tid = GetCurrentThreadId();
- CString fname;
- fname.Format("%08X.out", context.tid);
-
- context.out = CreateFile(fname, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_FLAG_WRITE_THROUGH, NULL);
- if (context.out==INVALID_HANDLE_VALUE) {
- printf("failed to open output file %s\n", fname);
- return 0;
- }
-
- // not using post files
- context.in = INVALID_HANDLE_VALUE;
-
- //
- // Fill the ECB with the necessary information
- //
- if (!FillExtensionControlBlock(&ECB, &context) ) {
- fprintf(stderr,"Fill Ext Block Failed\n");
- return -1;
- }
-
- // check for command line argument,
- // first arg = filename
- // this is added for testing php from command line
-
- context.env.RemoveAll();
- context.env["PATH_TRANSLATED"]= filename;
- context.env["SCRIPT_MAP"]= filename;
- context.env["CONTENT_TYPE"]= "";
- context.env["CONTENT_LENGTH"]= "";
- context.env["QUERY_STRING"]= arg;
- context.env["METHOD"]="GET";
- context.env["PATH_INFO"] = "";
- context.waitEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- char buf[MAX_PATH];
- if (postdata && *postdata !=0) {
- ECB.cbAvailable = strlen(postdata);
- ECB.cbTotalBytes = ECB.cbAvailable;
- ECB.lpbData = (unsigned char *)postdata;
- context.env["METHOD"]="POST";
-
- _snprintf(buf, sizeof(buf)-1, "%d", ECB.cbTotalBytes);
- context.env["CONTENT_LENGTH"]=buf;
-
- context.env["CONTENT_TYPE"]="application/x-www-form-urlencoded";
- }
- ECB.lpszMethod = strdup(context.env["METHOD"]);
- ECB.lpszPathTranslated = strdup(filename);
- ECB.lpszQueryString = strdup(arg);
- ECB.lpszPathInfo = strdup(context.env["PATH_INFO"]);
-
-
- // Call the DLL
- //
- rc = IsapiHttpExtensionProc(&ECB);
- if (rc == HSE_STATUS_PENDING) {
- // We will exit in ServerSupportFunction
- WaitForSingleObject(context.waitEvent, INFINITE);
- }
- CloseHandle(context.waitEvent);
- //Sleep(75);
- free(ECB.lpszPathTranslated);
- free(ECB.lpszQueryString);
- free(ECB.lpszMethod);
- free(ECB.lpszPathInfo);
-
- BOOL ok = TRUE;
-
- if (context.out != INVALID_HANDLE_VALUE) CloseHandle(context.out);
-
- // compare the output with the EXPECT section
- if (matchdata && *matchdata != 0) {
- ok = CompareFiles(fname, matchdata);
- }
-
- DeleteFile(fname);
-
- return ok;
-
-}
-//
-// GetServerVariable() is how the DLL calls the main program to figure out
-// the environment variables it needs. This is a required function.
-//
-BOOL WINAPI GetServerVariable(HCONN hConn, LPSTR lpszVariableName,
- LPVOID lpBuffer, LPDWORD lpdwSize){
-
- DWORD rc;
- CString value;
- TIsapiContext *c = (TIsapiContext *)hConn;
- if (!c) return FALSE;
-
- if (IsapiEnvironment.Lookup(lpszVariableName, value)) {
- rc = value.GetLength();
- strncpy((char *)lpBuffer, value, *lpdwSize-1);
- } else if (c->env.Lookup(lpszVariableName, value)) {
- rc = value.GetLength();
- strncpy((char *)lpBuffer, value, *lpdwSize-1);
- } else
- rc = GetEnvironmentVariable(lpszVariableName, (char *)lpBuffer, *lpdwSize) ;
-
- if (!rc) { // return of 0 indicates the variable was not found
- SetLastError(ERROR_NO_DATA);
- return FALSE;
- }
-
- if (rc > *lpdwSize) {
- SetLastError(ERROR_INSUFFICIENT_BUFFER);
- return FALSE;
- }
-
- *lpdwSize =rc + 1 ; // GetEnvironmentVariable does not count the NULL
-
- return TRUE;
-
-}
-//
-// Again, we don't have an HCONN, so we simply wrap ReadClient() to
-// ReadFile on stdin. The semantics of the two functions are the same
-//
-BOOL WINAPI ReadClient(HCONN hConn, LPVOID lpBuffer, LPDWORD lpdwSize) {
- TIsapiContext *c = (TIsapiContext *)hConn;
- if (!c) return FALSE;
-
- if (c->in != INVALID_HANDLE_VALUE)
- return ReadFile(c->in, lpBuffer, (*lpdwSize), lpdwSize, NULL);
-
- return FALSE;
-}
-//
-// ditto for WriteClient()
-//
-BOOL WINAPI WriteClient(HCONN hConn, LPVOID lpBuffer, LPDWORD lpdwSize,
- DWORD dwReserved) {
- TIsapiContext *c = (TIsapiContext *)hConn;
- if (!c) return FALSE;
-
- if (c->out != INVALID_HANDLE_VALUE)
- return WriteFile(c->out, lpBuffer, *lpdwSize, lpdwSize, NULL);
- return FALSE;
-}
-//
-// This is a special callback function used by the DLL for certain extra
-// functionality. Look at the API help for details.
-//
-BOOL WINAPI ServerSupportFunction(HCONN hConn, DWORD dwHSERequest,
- LPVOID lpvBuffer, LPDWORD lpdwSize, LPDWORD lpdwDataType){
-
- TIsapiContext *c = (TIsapiContext *)hConn;
- char *lpszRespBuf;
- char * temp = NULL;
- DWORD dwBytes;
- BOOL bRet = TRUE;
-
- switch(dwHSERequest) {
- case (HSE_REQ_SEND_RESPONSE_HEADER) :
- lpszRespBuf = (char *)xmalloc(*lpdwSize);//+ 80);//accomodate our header
- if (!lpszRespBuf)
- return FALSE;
- wsprintf(lpszRespBuf,"%s",
- //HTTP_VER,
-
- /* Default response is 200 Ok */
-
- //lpvBuffer?lpvBuffer:"200 Ok",
-
- /* Create a string for the time. */
- //temp=MakeDateStr(),
-
- //SERVER_VERSION,
-
- /* If this exists, it is a pointer to a data buffer to
- be sent. */
- lpdwDataType?(char *)lpdwDataType:NULL);
-
- if (temp) xfree(temp);
-
- dwBytes = strlen(lpszRespBuf);
- bRet = WriteClient(0, lpszRespBuf, &dwBytes, 0);
- xfree(lpszRespBuf);
-
- break;
- //
- // A real server would do cleanup here
- case (HSE_REQ_DONE_WITH_SESSION):
- SetEvent(c->waitEvent);
- //ExitThread(0);
- break;
-
- //
- // This sends a redirect (temporary) to the client.
- // The header construction is similar to RESPONSE_HEADER above.
- //
- case (HSE_REQ_SEND_URL_REDIRECT_RESP):
- lpszRespBuf = (char *)xmalloc(*lpdwSize +80) ;
- if (!lpszRespBuf)
- return FALSE;
- wsprintf(lpszRespBuf,"%s %s %s\r\n",
- HTTP_VER,
- "302 Moved Temporarily",
- (lpdwSize > 0)?lpvBuffer:0);
- xfree(temp);
- dwBytes = strlen(lpszRespBuf);
- bRet = WriteClient(0, lpszRespBuf, &dwBytes, 0);
- xfree(lpszRespBuf);
- break;
- default:
- return FALSE;
- break;
- }
- return bRet;
-
-}
-//
-// Makes a string of the date and time from GetSystemTime().
-// This is in UTC, as required by the HTTP spec.`
-//
-char * MakeDateStr(void){
- SYSTEMTIME systime;
- char *szDate= (char *)xmalloc(64);
-
- char * DaysofWeek[] = {"Sun","Mon","Tue","Wed","Thurs","Fri","Sat"};
- char * Months[] = {"NULL","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug",
- "Sep","Oct","Nov","Dec"};
-
- GetSystemTime(&systime);
-
- wsprintf(szDate,"%s, %d %s %d %d:%d.%d", DaysofWeek[systime.wDayOfWeek],
- systime.wDay,
- Months[systime.wMonth],
- systime.wYear,
- systime.wHour, systime.wMinute,
- systime.wSecond );
-
- return szDate;
-}
-//
-// Fill the ECB up
-//
-BOOL WINAPI FillExtensionControlBlock(EXTENSION_CONTROL_BLOCK *ECB, TIsapiContext *context) {
-
- char * temp;
- ECB->cbSize = sizeof(EXTENSION_CONTROL_BLOCK);
- ECB->dwVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);
- ECB->ConnID = (void *)context;
- //
- // Pointers to the functions the DLL will call.
- //
- ECB->GetServerVariable = GetServerVariable;
- ECB->ReadClient = ReadClient;
- ECB->WriteClient = WriteClient;
- ECB->ServerSupportFunction = ServerSupportFunction;
-
- //
- // Fill in the standard CGI environment variables
- //
- ECB->lpszMethod = GetEnv("REQUEST_METHOD");
- if (!ECB->lpszMethod) ECB->lpszMethod = "GET";
-
- ECB->lpszQueryString = GetEnv("QUERY_STRING");
- ECB->lpszPathInfo = GetEnv("PATH_INFO");
- ECB->lpszPathTranslated = GetEnv("PATH_TRANSLATED");
- ECB->cbTotalBytes=( (temp=GetEnv("CONTENT_LENGTH")) ? (atoi(temp)): 0);
- ECB->cbAvailable = 0;
- ECB->lpbData = (unsigned char *)"";
- ECB->lpszContentType = GetEnv("CONTENT_TYPE");
- return TRUE;
-
-}
-
-//
-// Works like _getenv(), but uses win32 functions instead.
-//
-char *GetEnv(LPSTR lpszEnvVar)
-{
-
- char *var, dummy;
- DWORD dwLen;
-
- if (!lpszEnvVar)
- return "";
-
- dwLen =GetEnvironmentVariable(lpszEnvVar, &dummy, 1);
-
- if (dwLen == 0)
- return "";
-
- var = (char *)xmalloc(dwLen);
- if (!var)
- return "";
- (void)GetEnvironmentVariable(lpszEnvVar, var, dwLen);
-
- return var;
-}
diff --git a/sapi/isapi/stresstest/stresstest.dsp b/sapi/isapi/stresstest/stresstest.dsp
deleted file mode 100644
index fb82303e3d..0000000000
--- a/sapi/isapi/stresstest/stresstest.dsp
+++ /dev/null
@@ -1,108 +0,0 @@
-# Microsoft Developer Studio Project File - Name="stresstest" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=stresstest - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "stresstest.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "stresstest.mak" CFG="stresstest - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "stresstest - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "stresstest - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "stresstest - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 2
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_AFXDLL" /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "stresstest - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 2
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "c:\php-fcgi"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_AFXDLL" /FD /GZ /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "stresstest - Win32 Release"
-# Name "stresstest - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\getopt.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\getopt.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\stresstest.cpp
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\notes.txt
-# End Source File
-# End Target
-# End Project
diff --git a/sapi/milter/CREDITS b/sapi/milter/CREDITS
deleted file mode 100644
index cd00d6774b..0000000000
--- a/sapi/milter/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Sendmail Milter
-Harald Radi
diff --git a/sapi/milter/EXPERIMENTAL b/sapi/milter/EXPERIMENTAL
deleted file mode 100644
index 293159a693..0000000000
--- a/sapi/milter/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this module is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/sapi/milter/Makefile.frag b/sapi/milter/Makefile.frag
deleted file mode 100644
index 8dbdf7a8fd..0000000000
--- a/sapi/milter/Makefile.frag
+++ /dev/null
@@ -1,2 +0,0 @@
-$(SAPI_MILTER_PATH): $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
- $(BUILD_MILTER)
diff --git a/sapi/milter/TODO b/sapi/milter/TODO
deleted file mode 100644
index 4a427ea131..0000000000
--- a/sapi/milter/TODO
+++ /dev/null
@@ -1,5 +0,0 @@
-threaded version still leaks mem, don't know why
-extensions aren't loaded
-stdout to syslog
-testing
-documentation \ No newline at end of file
diff --git a/sapi/milter/config.m4 b/sapi/milter/config.m4
deleted file mode 100644
index 4194d4f2cf..0000000000
--- a/sapi/milter/config.m4
+++ /dev/null
@@ -1,39 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_MSG_CHECKING(for Milter support)
-AC_ARG_WITH(milter,
-[ --with-milter=DIR Build PHP as Milter application],[
- if test "$withval" = "yes"; then
- if test -f /usr/lib/libmilter.a ; then
- MILTERPATH=/usr/lib
- else
- if test -f /usr/lib/libmilter/libmilter.a ; then
- MILTERPATH=/usr/lib/libmilter
- else
- AC_MSG_ERROR(Unable to find libmilter.a)
- fi
- fi
- else
- MILTERPATH=$withval
- fi
-
- SAPI_MILTER_PATH=sapi/milter/php-milter
- PHP_SUBST(SAPI_MILTER_PATH)
- PHP_BUILD_THREAD_SAFE
- PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/milter/Makefile.frag)
-
- PHP_SELECT_SAPI(milter, program, php_milter.c getopt.c,,'$(SAPI_MILTER_PATH)')
- PHP_ADD_LIBRARY_WITH_PATH(milter, $MILTERPATH,)
-
- BUILD_MILTER="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_MILTER_PATH)"
-
- INSTALL_IT="\$(INSTALL) -m 0755 \$(SAPI_MILTER_PATH) \$(bindir)/php-milter"
- RESULT=yes
-
- PHP_SUBST(BUILD_MILTER)
-],[
- RESULT=no
-])
-AC_MSG_RESULT($RESULT)
diff --git a/sapi/milter/getopt.c b/sapi/milter/getopt.c
deleted file mode 100644
index f5874d577e..0000000000
--- a/sapi/milter/getopt.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/* Borrowed from Apache NT Port */
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <stdlib.h>
-#include "php_getopt.h"
-#define OPTERRCOLON (1)
-#define OPTERRNF (2)
-#define OPTERRARG (3)
-
-
-char *ap_php_optarg;
-int ap_php_optind = 1;
-static int ap_php_opterr = 1;
-
-static int
-ap_php_optiserr(int argc, char * const *argv, int oint, const char *optstr,
- int optchr, int err)
-{
- if (ap_php_opterr)
- {
- fprintf(stderr, "Error in argument %d, char %d: ", oint, optchr+1);
- switch(err)
- {
- case OPTERRCOLON:
- fprintf(stderr, ": in flags\n");
- break;
- case OPTERRNF:
- fprintf(stderr, "option not found %c\n", argv[oint][optchr]);
- break;
- case OPTERRARG:
- fprintf(stderr, "no argument for option %c\n", argv[oint][optchr]);
- break;
- default:
- fprintf(stderr, "unknown\n");
- break;
- }
- }
- return('?');
-}
-
-int ap_php_getopt(int argc, char* const *argv, const char *optstr)
-{
- static int optchr = 0;
- static int dash = 0; /* have already seen the - */
-
- char *cp;
-
- if (ap_php_optind >= argc)
- return(EOF);
- if (!dash && (argv[ap_php_optind][0] != '-'))
- return(EOF);
- if (!dash && (argv[ap_php_optind][0] == '-') && !argv[ap_php_optind][1])
- {
- /*
- * use to specify stdin. Need to let pgm process this and
- * the following args
- */
- return(EOF);
- }
- if ((argv[ap_php_optind][0] == '-') && (argv[ap_php_optind][1] == '-'))
- {
- /* -- indicates end of args */
- ap_php_optind++;
- return(EOF);
- }
- if (!dash)
- {
- assert((argv[ap_php_optind][0] == '-') && argv[ap_php_optind][1]);
- dash = 1;
- optchr = 1;
- }
-
- /* Check if the guy tries to do a -: kind of flag */
- assert(dash);
- if (argv[ap_php_optind][optchr] == ':')
- {
- dash = 0;
- ap_php_optind++;
- return(ap_php_optiserr(argc, argv, ap_php_optind-1, optstr, optchr, OPTERRCOLON));
- }
- if (!(cp = strchr(optstr, argv[ap_php_optind][optchr])))
- {
- int errind = ap_php_optind;
- int errchr = optchr;
-
- if (!argv[ap_php_optind][optchr+1])
- {
- dash = 0;
- ap_php_optind++;
- }
- else
- optchr++;
- return(ap_php_optiserr(argc, argv, errind, optstr, errchr, OPTERRNF));
- }
- if (cp[1] == ':')
- {
- /* Check for cases where the value of the argument
- is in the form -<arg> <val> or in the form -<arg><val> */
- dash = 0;
- if(!argv[ap_php_optind][2]) {
- ap_php_optind++;
- if (ap_php_optind == argc)
- return(ap_php_optiserr(argc, argv, ap_php_optind-1, optstr, optchr, OPTERRARG));
- ap_php_optarg = argv[ap_php_optind++];
- }
- else
- {
- ap_php_optarg = &argv[ap_php_optind][2];
- ap_php_optind++;
- }
- return(*cp);
- }
- else
- {
- if (!argv[ap_php_optind][optchr+1])
- {
- dash = 0;
- ap_php_optind++;
- }
- else
- optchr++;
- return(*cp);
- }
- assert(0);
- return(0); /* never reached */
-}
-
-#ifdef TESTGETOPT
-int
- main (int argc, char **argv)
- {
- int c;
- extern char *ap_php_optarg;
- extern int ap_php_optind;
- int aflg = 0;
- int bflg = 0;
- int errflg = 0;
- char *ofile = NULL;
-
- while ((c = ap_php_getopt(argc, argv, "abo:")) != EOF)
- switch (c) {
- case 'a':
- if (bflg)
- errflg++;
- else
- aflg++;
- break;
- case 'b':
- if (aflg)
- errflg++;
- else
- bflg++;
- break;
- case 'o':
- ofile = ap_php_optarg;
- (void)printf("ofile = %s\n", ofile);
- break;
- case '?':
- errflg++;
- }
- if (errflg) {
- (void)fprintf(stderr,
- "usage: cmd [-a|-b] [-o <filename>] files...\n");
- exit (2);
- }
- for ( ; ap_php_optind < argc; ap_php_optind++)
- (void)printf("%s\n", argv[ap_php_optind]);
- return 0;
- }
-
-#endif /* TESTGETOPT */
diff --git a/sapi/milter/milter.php b/sapi/milter/milter.php
deleted file mode 100644
index 0878f2a4d9..0000000000
--- a/sapi/milter/milter.php
+++ /dev/null
@@ -1,132 +0,0 @@
-<?php
-/**
- * example milter script
- *
- * run: php-milter -D -p /path/to/sock milter.php
- *
- * for details on how to set up sendmail and configure the milter see
- * http://www.sendmail.com/partner/resources/development/milter_api/
- *
- * for api details see
- * http://www.sendmail.com/partner/resources/development/milter_api/api.html
- *
- * below is a list of all callbacks, that are available through the milter sapi,
- * if you leave one or more out they simply won't get called (e.g. if you secify an
- * empty php file, the milter would do nothing :)
- */
-
-/**
- * this function is called once on sapi startup,
- * here you can specify the actions the filter may take
- *
- * see http://www.sendmail.com/partner/resources/development/milter_api/smfi_register.html#flags
- */
-
-function milter_log($msg)
-{
- $GLOBALS['log'] = fopen("/tmp/milter.log", "a");
- fwrite($GLOBALS['log'], date("[H:i:s d.m.Y]") . "\t{$msg}\n");
- fclose($GLOBALS['log']);
-}
-
-function milter_init() {
- milter_log("-- startup --");
- milter_log("milter_init()");
- smfi_setflags(SMFIF_ADDHDRS);
-}
-
-/**
- * is called once, at the start of each SMTP connection
- */
-function milter_connect($connect)
-{
- milter_log("milter_connect('$connect')");
-}
-
-/**
- * is called whenever the client sends a HELO/EHLO command.
- * It may therefore be called between zero and three times.
- */
-function milter_helo($helo)
-{
- milter_log("milter_helo('$helo')");
-}
-
-/**
- * is called once at the beginning of each message,
- * before milter_envrcpt.
- */
-function milter_envfrom($args)
-{
- milter_log("milter_envfrom(args[])");
- foreach ($args as $ix => $arg) {
- milter_log("\targs[$ix] = $arg");
- }
-}
-
-/**
- * is called once per recipient, hence one or more times per message,
- * immediately after milter_envfrom
- */
-function milter_envrcpt($args)
-{
- milter_log("milter_envrcpt(args[])");
- foreach ($args as $ix => $arg) {
- milter_log("\targs[$ix] = $arg");
- }
-}
-
-/**
- * is called zero or more times between milter_envrcpt and milter_eoh,
- * once per message header
- */
-function milter_header($header, $value)
-{
- milter_log("milter_header('$header', '$value')");
-}
-
-/**
- * is called once after all headers have been sent and processed.
- */
-function milter_eoh()
-{
- milter_log("milter_eoh()");
-}
-
-/**
- * is called zero or more times between milter_eoh and milter_eom.
- */
-function milter_body($bodypart)
-{
- milter_log("milter_body('$bodypart')");
-}
-
-/**
- * is called once after all calls to milter_body for a given message.
- * most of the api functions, that alter the message can only be called
- * within this callback.
- */
-function milter_eom()
-{
- milter_log("milter_eom()");
- /* add PHP header to the message */
- smfi_addheader("X-PHP", phpversion());
-}
-
-/**
- * may be called at any time during message processing
- * (i.e. between some message-oriented routine and milter_eom).
- */
-function milter_abort()
-{
- milter_log("milter_abort()");
-}
-
-/**
- * is always called once at the end of each connection.
- */
-function milter_close()
-{
- milter_log("milter_close()");
-}
-?>
diff --git a/sapi/milter/php_getopt.h b/sapi/milter/php_getopt.h
deleted file mode 100644
index 40da432b59..0000000000
--- a/sapi/milter/php_getopt.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Borrowed from Apache NT Port */
-#include "php.h"
-
-extern char *ap_php_optarg;
-extern int ap_php_optind;
-
-int ap_php_getopt(int argc, char* const *argv, const char *optstr);
diff --git a/sapi/milter/php_milter.c b/sapi/milter/php_milter.c
deleted file mode 100644
index 112a645983..0000000000
--- a/sapi/milter/php_milter.c
+++ /dev/null
@@ -1,1139 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <phanto@php.net> |
- | Parts based on CGI SAPI Module by |
- | Rasmus Lerdorf, Stig Bakken and Zeev Suraski |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_variables.h"
-#include "zend_modules.h"
-
-#ifndef ZTS
-#error SRM sapi module is only useable in thread-safe mode
-#endif
-
-#include "SAPI.h"
-
-#include <stdio.h>
-#include "php.h"
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#if HAVE_SETLOCALE
-#include <locale.h>
-#endif
-#include "zend.h"
-#include "zend_extensions.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "php_main.h"
-#include "fopen_wrappers.h"
-#include "ext/standard/php_standard.h"
-
-#ifdef __riscos__
-#include <unixlib/local.h>
-#endif
-
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-
-#include "libmilter/mfapi.h"
-
-#define OPTSTRING "ac:d:Def:hnp:vVz:?"
-#define MG(v) TSRMG(milter_globals_id, zend_milter_globals *, v)
-
-#define IS_NONE "%s(): This function must not be called outside of a milter callback function's scope"
-#define NOT_EOM "%s(): This function can only be used inside the milter_eom callback's scope"
-#define NOT_INIT "%s(): This function can only be used inside the milter_init callback's scope"
-
-#define MLFI_NONE 0
-#define MLFI_CONNECT 1
-#define MLFI_HELO 2
-#define MLFI_ENVFROM 3
-#define MLFI_ENVRCPT 4
-#define MLFI_HEADER 5
-#define MLFI_EOH 6
-#define MLFI_BODY 7
-#define MLFI_EOM 8
-#define MLFI_ABORT 9
-#define MLFI_CLOSE 10
-#define MLFI_INIT 11
-
-/* {{{ globals
- */
-extern char *ap_php_optarg;
-extern int ap_php_optind;
-
-static int flag_debug=0;
-static char *filename;
-
-/* per thread */
-ZEND_BEGIN_MODULE_GLOBALS(milter)
- SMFICTX *ctx;
- int state;
- int initialized;
-ZEND_END_MODULE_GLOBALS(milter)
-
-ZEND_DECLARE_MODULE_GLOBALS(milter)
-/* }}} */
-
-/* this method is called only once when the milter starts */
-/* {{{ Init Milter
-*/
-static int mlfi_init()
-{
- int ret = 0;
- zend_file_handle file_handle;
- zval function_name, retval;
- TSRMLS_FETCH();
-
- /* request startup */
- if (php_request_startup(TSRMLS_C)==FAILURE) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
- php_request_shutdown((void *) 0);
-
- return -1;
- }
-
- /* disable headers */
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = filename;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
- php_execute_script(&file_handle TSRMLS_CC);
-
- /* call userland */
- INIT_ZVAL(function_name);
-
- ZVAL_STRING(&function_name, "milter_init", 0);
-
- /* set the milter context for possible use in API functions */
- MG(state) = MLFI_INIT;
-
- call_user_function(CG(function_table), NULL, &function_name, &retval, 0, NULL TSRMLS_CC);
-
- MG(state) = MLFI_NONE;
- MG(initialized) = 1;
-
- if (Z_TYPE(retval) == IS_LONG) {
- ret = Z_LVAL(retval);
- }
-
- php_request_shutdown((void *) 0);
-
- return ret;
-}
-/* }}} */
-
-/* {{{ Milter callback functions
- */
-
-/* connection info filter, is called whenever sendmail connects to the milter */
-/* {{{ mlfi_connect()
-*/
-static sfsistat mlfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
-{
- zend_file_handle file_handle;
- zval function_name, retval, *param[1];
- TSRMLS_FETCH();
-
- /* request startup */
- if (php_request_startup(TSRMLS_C)==FAILURE) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
- php_request_shutdown((void *) 0);
-
- return SMFIS_TEMPFAIL;
- }
-
- /* disable headers */
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = filename;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
- php_execute_script(&file_handle TSRMLS_CC);
-
- /* call userland */
- INIT_ZVAL(function_name);
-
- ALLOC_ZVAL(param[0]);
- INIT_PZVAL(param[0]);
-
- ZVAL_STRING(&function_name, "milter_connect", 0);
- ZVAL_STRING(param[0], hostname, 1);
-
- /* set the milter context for possible use in API functions */
- MG(ctx) = ctx;
- MG(state) = MLFI_CONNECT;
-
- call_user_function(CG(function_table), NULL, &function_name, &retval, 1, param TSRMLS_CC);
-
- MG(state) = MLFI_NONE;
-
- if (Z_TYPE(retval) == IS_LONG) {
- return Z_LVAL(retval);
- }
-
- return SMFIS_CONTINUE;
-}
-/* }}} */
-
-/* SMTP HELO command filter */
-/* {{{ mlfi_helo()
-*/
-static sfsistat mlfi_helo(SMFICTX *ctx, char *helohost)
-{
- zval function_name, retval, *param[1];
- TSRMLS_FETCH();
-
- /* call userland */
- INIT_ZVAL(function_name);
-
- ALLOC_ZVAL(param[0]);
- INIT_PZVAL(param[0]);
-
- ZVAL_STRING(&function_name, "milter_helo", 0);
- ZVAL_STRING(param[0], helohost, 1);
-
- /* set the milter context for possible use in API functions */
- MG(ctx) = ctx;
- MG(state) = MLFI_HELO;
-
- call_user_function(CG(function_table), NULL, &function_name, &retval, 1, param TSRMLS_CC);
-
- MG(state) = MLFI_NONE;
-
- FREE_ZVAL(param[0]);
-
- if (Z_TYPE(retval) == IS_LONG) {
- return Z_LVAL(retval);
- }
-
- return SMFIS_CONTINUE;
-}
-/* }}} */
-
-/* envelope sender filter */
-/* {{{ mlfi_envform()
-*/
-static sfsistat mlfi_envfrom(SMFICTX *ctx, char **argv)
-{
- zval function_name, retval, *param[1];
- TSRMLS_FETCH();
-
- /* call userland */
- INIT_ZVAL(function_name);
-
- ALLOC_ZVAL(param[0]);
- INIT_PZVAL(param[0]);
-
- ZVAL_STRING(&function_name, "milter_envfrom", 0);
- array_init(param[0]);
-
- while (*argv) {
- add_next_index_string(param[0], *argv, 1);
- argv++;
- }
-
- /* set the milter context for possible use in API functions */
- MG(ctx) = ctx;
- MG(state) = MLFI_ENVFROM;
-
- call_user_function(CG(function_table), NULL, &function_name, &retval, 1, param TSRMLS_CC);
-
- MG(state) = MLFI_NONE;
-
- FREE_ZVAL(param[0]);
-
- if (Z_TYPE(retval) == IS_LONG) {
- return Z_LVAL(retval);
- }
-
- return SMFIS_CONTINUE;
-}
-/* }}} */
-
-/* envelope recipient filter */
-/* {{{ mlfi_envrcpt()
-*/
-static sfsistat mlfi_envrcpt(SMFICTX *ctx, char **argv)
-{
- zval function_name, retval, *param[1];
- TSRMLS_FETCH();
-
- /* call userland */
- INIT_ZVAL(function_name);
-
- ALLOC_ZVAL(param[0]);
- INIT_PZVAL(param[0]);
-
- ZVAL_STRING(&function_name, "milter_envrcpt", 0);
- array_init(param[0]);
-
- while (*argv) {
- add_next_index_string(param[0], *argv, 1);
- argv++;
- }
-
- /* set the milter context for possible use in API functions */
- MG(ctx) = ctx;
- MG(state) = MLFI_ENVRCPT;
-
- call_user_function(CG(function_table), NULL, &function_name, &retval, 1, param TSRMLS_CC);
-
- MG(state) = MLFI_NONE;
-
- FREE_ZVAL(param[0]);
-
- if (Z_TYPE(retval) == IS_LONG) {
- return Z_LVAL(retval);
- }
-
- return SMFIS_CONTINUE;
-}
-/* }}} */
-
-/* header filter */
-/* {{{ mlfi_header()
-*/
-static sfsistat mlfi_header(SMFICTX *ctx, char *headerf, char *headerv)
-{
- zval function_name, retval, *param[2];
- TSRMLS_FETCH();
-
- /* call userland */
- INIT_ZVAL(function_name);
-
- ALLOC_ZVAL(param[0]);
- ALLOC_ZVAL(param[1]);
- INIT_PZVAL(param[0]);
- INIT_PZVAL(param[1]);
-
- ZVAL_STRING(&function_name, "milter_header", 0);
- ZVAL_STRING(param[0], headerf, 1);
- ZVAL_STRING(param[1], headerv, 1);
-
- /* set the milter context for possible use in API functions */
- MG(ctx) = ctx;
- MG(state) = MLFI_HEADER;
-
- call_user_function(CG(function_table), NULL, &function_name, &retval, 2, param TSRMLS_CC);
-
- MG(state) = MLFI_NONE;
-
- FREE_ZVAL(param[0]);
- FREE_ZVAL(param[1]);
-
- if (Z_TYPE(retval) == IS_LONG) {
- return Z_LVAL(retval);
- }
-
- return SMFIS_CONTINUE;
-}
-/* }}} */
-
-/* end of header */
-/* {{{ mlfi_eoh()
-*/
-static sfsistat mlfi_eoh(SMFICTX *ctx)
-{
- zval function_name, retval;
- TSRMLS_FETCH();
-
- /* call userland */
- INIT_ZVAL(function_name);
- ZVAL_STRING(&function_name, "milter_eoh", 0);
-
- /* set the milter context for possible use in API functions */
- MG(ctx) = ctx;
- MG(state) = MLFI_EOH;
-
- call_user_function(CG(function_table), NULL, &function_name, &retval, 0, NULL TSRMLS_CC);
-
- MG(state) = MLFI_NONE;
-
- if (Z_TYPE(retval) == IS_LONG) {
- return Z_LVAL(retval);
- }
-
- return SMFIS_CONTINUE;
-}
-/* }}} */
-
-/* body block */
-/* {{{ mlfi_body()
-*/
-static sfsistat mlfi_body(SMFICTX *ctx, u_char *bodyp, size_t len)
-{
- zval function_name, retval, *param[1];
- TSRMLS_FETCH();
-
- /* call userland */
- INIT_ZVAL(function_name);
-
- ALLOC_ZVAL(param[0]);
- INIT_PZVAL(param[0]);
-
- ZVAL_STRING(&function_name, "milter_body", 0);
- ZVAL_STRINGL(param[0], bodyp, len, 1);
-
- /* set the milter context for possible use in API functions */
- MG(ctx) = ctx;
- MG(state) = MLFI_BODY;
-
- call_user_function(CG(function_table), NULL, &function_name, &retval, 1, param TSRMLS_CC);
-
- MG(state) = MLFI_NONE;
-
- FREE_ZVAL(param[0]);
-
- if (Z_TYPE(retval) == IS_LONG) {
- return Z_LVAL(retval);
- }
-
- return SMFIS_CONTINUE;
-}
-/* }}} */
-
-/* end of message */
-/* {{{ mlfi_eom()
-*/
-static sfsistat mlfi_eom(SMFICTX *ctx)
-{
- zval function_name, retval;
- TSRMLS_FETCH();
-
- /* call userland */
- INIT_ZVAL(function_name);
- ZVAL_STRING(&function_name, "milter_eom", 0);
-
- /* set the milter context for possible use in API functions */
- MG(ctx) = ctx;
- MG(state) = MLFI_EOM;
-
- call_user_function(CG(function_table), NULL, &function_name, &retval, 0, NULL TSRMLS_CC);
-
- MG(state) = MLFI_NONE;
-
- if (Z_TYPE(retval) == IS_LONG) {
- return Z_LVAL(retval);
- }
-
- return SMFIS_CONTINUE;
-}
-/* }}} */
-
-/* message aborted */
-/* {{{ mlfi_abort()
-*/
-static sfsistat mlfi_abort(SMFICTX *ctx)
-{
- zval function_name, retval;
- TSRMLS_FETCH();
-
- /* call userland */
- INIT_ZVAL(function_name);
- ZVAL_STRING(&function_name, "milter_abort", 0);
-
- /* set the milter context for possible use in API functions */
- MG(ctx) = ctx;
- MG(state) = MLFI_ABORT;
-
- call_user_function(CG(function_table), NULL, &function_name, &retval, 0, NULL TSRMLS_CC);
-
- MG(state) = MLFI_NONE;
-
- if (Z_TYPE(retval) == IS_LONG) {
- return Z_LVAL(retval);
- }
-
- return SMFIS_CONTINUE;
-}
-/* }}} */
-
-/* connection cleanup */
-/* {{{ mlfi_close()
-*/
-static sfsistat mlfi_close(SMFICTX *ctx)
-{
- int ret = SMFIS_CONTINUE;
- zval function_name, retval;
- TSRMLS_FETCH();
-
- /* call userland */
- INIT_ZVAL(function_name);
- ZVAL_STRING(&function_name, "milter_close", 0);
-
- /* set the milter context for possible use in API functions */
- MG(ctx) = ctx;
- MG(state) = MLFI_CLOSE;
-
- call_user_function(CG(function_table), NULL, &function_name, &retval, 0, NULL TSRMLS_CC);
-
- MG(state) = MLFI_NONE;
-
- if (Z_TYPE(retval) == IS_LONG) {
- ret = Z_LVAL(retval);
- }
-
- php_request_shutdown((void *) 0);
-
- return ret;
-}
-/* }}} */
-/* }}} */
-
-/* {{{ Milter entry struct
- */
-struct smfiDesc smfilter = {
- "php-milter", /* filter name */
- SMFI_VERSION, /* version code -- leave untouched */
- 0, /* flags */
- mlfi_connect, /* info filter callback */
- mlfi_helo, /* HELO filter callback */
- mlfi_envfrom, /* envelope filter callback */
- mlfi_envrcpt, /* envelope recipient filter callback */
- mlfi_header, /* header filter callback */
- mlfi_eoh, /* end of header callback */
- mlfi_body, /* body filter callback */
- mlfi_eom, /* end of message callback */
- mlfi_abort, /* message aborted callback */
- mlfi_close, /* connection cleanup callback */
-};
-/* }}} */
-
-/* {{{ PHP Milter API
- */
-
-/* {{{ proto string smfi_setflags(long flags)
- Sets the flags describing the actions the filter may take. */
-PHP_FUNCTION(smfi_setflags)
-{
- long flags;
-
- /* valid only in the init callback */
- if (MG(state) != MLFI_INIT) {
- php_error(E_WARNING, NOT_INIT, get_active_function_name(TSRMLS_C));
- } else if (zend_parse_parameters(1 TSRMLS_CC, "l", &flags) == SUCCESS) {
- flags = flags & SMFIF_ADDHDRS|SMFIF_CHGHDRS|SMFIF_CHGBODY|SMFIF_ADDRCPT|SMFIF_DELRCPT;
- smfilter.xxfi_flags = flags;
- }
-}
-/* }}} */
-
-/* {{{ proto string smfi_settimeout(long timeout)
- Sets the number of seconds libmilter will wait for an MTA connection before timing out a socket. */
-PHP_FUNCTION(smfi_settimeout)
-{
- long timeout;
-
- /* valid only in the init callback */
- if (MG(state) != MLFI_INIT) {
- php_error(E_WARNING, NOT_INIT, get_active_function_name(TSRMLS_C));
- } else if (zend_parse_parameters(1 TSRMLS_CC, "l", &timeout) == SUCCESS) {
- smfi_settimeout(timeout);
- }
-}
-/* }}} */
-
-/* {{{ proto string smfi_getsymval(string macro)
- Returns the value of the given macro or NULL if the macro is not defined. */
-PHP_FUNCTION(smfi_getsymval)
-{
- char *symname, *ret;
- int len;
-
- /* valid in any callback */
- if (MG(state) == MLFI_NONE) {
- php_error(E_WARNING, IS_NONE, get_active_function_name(TSRMLS_C));
- } else if (zend_parse_parameters(1 TSRMLS_CC, "s", &symname, &len) == SUCCESS) {
- if ((ret = smfi_getsymval(MG(ctx), symname)) != NULL) {
- RETVAL_STRING(ret, 1);
- }
- }
-
- RETVAL_NULL();
-}
-/* }}} */
-
-/* {{{ proto string smfi_setreply(string rcode, string xcode, string message)
- Directly set the SMTP error reply code for this connection.
- This code will be used on subsequent error replies resulting from actions taken by this filter. */
-PHP_FUNCTION(smfi_setreply)
-{
- char *rcode, *xcode, *message;
- int len;
-
- /* valid in any callback */
- if (MG(state) == MLFI_NONE) {
- php_error(E_WARNING, IS_NONE, get_active_function_name(TSRMLS_C));
- } else if (zend_parse_parameters(3 TSRMLS_CC, "sss", &rcode, &len, &xcode, &len, &message, &len) == SUCCESS) {
- if (smfi_setreply(MG(ctx), rcode, xcode, message) == MI_SUCCESS) {
- RETVAL_TRUE;
- }
- }
-
- RETVAL_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string smfi_addheader(string headerf, string headerv)
- Adds a header to the current message. */
-PHP_FUNCTION(smfi_addheader)
-{
- char *f, *v;
- int len;
-
- /* valid only in milter_eom */
- if (MG(state) != MLFI_EOM) {
- php_error(E_WARNING, NOT_EOM, get_active_function_name(TSRMLS_C));
- } else if (zend_parse_parameters(2 TSRMLS_CC, "ss", &f, &len, &v, &len) == SUCCESS) {
- if (smfi_addheader(MG(ctx), f, v) == MI_SUCCESS) {
- RETVAL_TRUE;
- }
- }
-
- RETVAL_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string smfi_chgheader(string headerf, string headerv)
- Changes a header's value for the current message. */
-PHP_FUNCTION(smfi_chgheader)
-{
- char *f, *v;
- long idx;
- int len;
-
- /* valid only in milter_eom */
- if (MG(state) != MLFI_EOM) {
- php_error(E_WARNING, NOT_EOM, get_active_function_name(TSRMLS_C));
- } else if (zend_parse_parameters(3 TSRMLS_CC, "sls", &f, &len, &idx, &v, &len) == SUCCESS) {
- if (smfi_chgheader(MG(ctx), f, idx, v) == MI_SUCCESS) {
- RETVAL_TRUE;
- }
- }
-
- RETVAL_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string smfi_addrcpt(string rcpt)
- Add a recipient to the message envelope. */
-PHP_FUNCTION(smfi_addrcpt)
-{
- char *rcpt;
- int len;
-
- /* valid only in milter_eom */
- if (MG(state) != MLFI_EOM) {
- php_error(E_WARNING, NOT_EOM, get_active_function_name(TSRMLS_C));
- } else if (zend_parse_parameters(1 TSRMLS_CC, "s", &rcpt, &len) == SUCCESS) {
- if (smfi_addrcpt(MG(ctx), rcpt) == MI_SUCCESS) {
- RETVAL_TRUE;
- }
- }
-
- RETVAL_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string smfi_delrcpt(string rcpt)
- Removes the named recipient from the current message's envelope. */
-PHP_FUNCTION(smfi_delrcpt)
-{
- char *rcpt;
- int len;
-
- /* valid only in milter_eom */
- if (MG(state) != MLFI_EOM) {
- php_error(E_WARNING, NOT_EOM, get_active_function_name(TSRMLS_C));
- } else if (zend_parse_parameters(1 TSRMLS_CC, "s", &rcpt, &len) == SUCCESS) {
- if (smfi_delrcpt(MG(ctx), rcpt) == MI_SUCCESS) {
- RETVAL_TRUE;
- }
- }
-
- RETVAL_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string smfi_replacebody(string body)
- Replaces the body of the current message. If called more than once,
- subsequent calls result in data being appended to the new body. */
-PHP_FUNCTION(smfi_replacebody)
-{
- char *body;
- int len;
-
- /* valid only in milter_eom */
- if (MG(state) != MLFI_EOM) {
- php_error(E_WARNING, NOT_EOM, get_active_function_name(TSRMLS_C));
- } else if (zend_parse_parameters(1 TSRMLS_CC, "s", &body, &len) == SUCCESS) {
- if (smfi_replacebody(MG(ctx), body, len) == MI_SUCCESS) {
- RETVAL_TRUE;
- }
- }
-
- RETVAL_FALSE;
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(milter)
-{
- REGISTER_LONG_CONSTANT("SMFIS_CONTINUE", SMFIS_CONTINUE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SMFIS_REJECT", SMFIS_REJECT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SMFIS_DISCARD", SMFIS_DISCARD, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SMFIS_ACCEPT", SMFIS_ACCEPT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SMFIS_TEMPFAIL", SMFIS_TEMPFAIL, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("SMFIF_ADDHDRS", SMFIF_ADDHDRS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SMFIF_CHGHDRS", SMFIF_CHGHDRS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SMFIF_CHGBODY", SMFIF_CHGBODY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SMFIF_ADDRCPT", SMFIF_ADDRCPT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SMFIF_DELRCPT", SMFIF_DELRCPT, CONST_CS | CONST_PERSISTENT);
-
- ZEND_INIT_MODULE_GLOBALS(milter, NULL, NULL);
-
- MG(state) = MLFI_NONE;
- MG(initialized) = 0;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(milter)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "Milter support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-/* }}} */
-
-/* {{{ milter_functions[]
-*/
-static function_entry milter_functions[] = {
- PHP_FE(smfi_setflags, NULL)
- PHP_FE(smfi_settimeout, NULL)
- PHP_FE(smfi_getsymval, NULL)
- PHP_FE(smfi_setreply, NULL)
- PHP_FE(smfi_addheader, NULL)
- PHP_FE(smfi_chgheader, NULL)
- PHP_FE(smfi_addrcpt, NULL)
- PHP_FE(smfi_delrcpt, NULL)
- PHP_FE(smfi_replacebody, NULL)
- { NULL, NULL, NULL }
-};
-/* }}} */
-
-/* {{{ Zend module entry
-*/
-static zend_module_entry php_milter_module = {
- STANDARD_MODULE_HEADER,
- "Milter",
- milter_functions,
- PHP_MINIT(milter),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(milter),
- "0.1.0",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-/* {{{ Milter SAPI
-*/
-static int sapi_milter_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- return str_length;
-}
-
-static void sapi_milter_flush(void *server_context)
-{
-}
-
-static void sapi_milter_register_variables(zval *track_vars_array TSRMLS_DC)
-{
- php_register_variable ("SERVER_SOFTWARE", "Sendmail Milter", track_vars_array TSRMLS_CC);
-}
-
-static int sapi_milter_post_read(char *buf, uint count_bytes TSRMLS_DC)
-{
- return 0;
-}
-
-static char* sapi_milter_read_cookies(TSRMLS_D)
-{
- return NULL;
-}
-
-static int sapi_milter_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-static int php_milter_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, &php_milter_module, 1) == FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ sapi_module_struct milter_sapi_module
-*/
-static sapi_module_struct milter_sapi_module = {
- "milter", /* name */
- "Sendmail Milter SAPI", /* pretty name */
-
- php_milter_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- sapi_milter_ub_write, /* unbuffered write */
- sapi_milter_flush, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- NULL, /* header handler */
- sapi_milter_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- sapi_milter_post_read, /* read POST data */
- sapi_milter_read_cookies, /* read Cookies */
-
- sapi_milter_register_variables, /* register server variables */
- NULL, /* Log message */
-
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-/* }}} */
-
-/****
-* ripped from cli, has to be cleaned up !
-*/
-
-/* {{{ php_milter_usage
-*/
-static void php_milter_usage(char *argv0)
-{
- char *prog;
-
- prog = strrchr(argv0, '/');
- if (prog) {
- prog++;
- } else {
- prog = "php-milter";
- }
-
- printf( "Usage: %s [options] [-f] <file> [args...]\n"
- " %s [options] -r <code> [args...]\n"
- " %s [options] [-- args...]\n"
- " -a Run interactively\n"
- " -c <path>|<file> Look for php.ini file in this directory\n"
- " -n No php.ini file will be used\n"
- " -d foo[=bar] Define INI entry foo with value 'bar'\n"
- " -D run as daemon\n"
- " -e Generate extended information for debugger/profiler\n"
- " -f <file> Parse <file>.\n"
- " -h This help\n"
- " -p <socket> path to create socket\n"
- " -v Version number\n"
- " -V <n> set debug level to n (1 or 2).\n"
- " -z <file> Load Zend extension <file>.\n"
- " args... Arguments passed to script. Use -- args when first argument \n"
- " starts with - or script is read from stdin\n"
- , prog, prog, prog);
-}
-/* }}} */
-
-static void define_command_line_ini_entry(char *arg)
-{
- char *name, *value;
-
- name = arg;
- value = strchr(arg, '=');
- if (value) {
- *value = 0;
- value++;
- } else {
- value = "1";
- }
- zend_alter_ini_entry(name, strlen(name)+1, value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
-}
-
-/* {{{ main
-*/
-int main(int argc, char *argv[])
-{
- char *sock = NULL;
- int dofork = 0;
-
- int exit_status = SUCCESS;
- int c;
-/* temporary locals */
- int orig_optind=ap_php_optind;
- char *orig_optarg=ap_php_optarg;
- char *arg_free=NULL, **arg_excp=&arg_free;
- int interactive=0;
- char *exec_direct=NULL;
- char *param_error=NULL;
-/* end of temporary locals */
-
- void ***tsrm_ls;
-
-#ifdef HAVE_SIGNAL_H
-#if defined(SIGPIPE) && defined(SIG_IGN)
- signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE in standalone mode so
- that sockets created via fsockopen()
- don't kill PHP if the remote site
- closes it. in apache|apxs mode apache
- does that for us! thies@thieso.net
- 20000419 */
-#endif
-#endif
-
-
- tsrm_startup(1, 1, 0, NULL);
- sapi_startup(&milter_sapi_module);
-
- while ((c=ap_php_getopt(argc, argv, OPTSTRING))!=-1) {
- switch (c) {
- case 'c':
- milter_sapi_module.php_ini_path_override = strdup(ap_php_optarg);
- break;
- case 'n':
- milter_sapi_module.php_ini_ignore = 1;
- break;
- }
- }
- ap_php_optind = orig_optind;
- ap_php_optarg = orig_optarg;
-
- milter_sapi_module.executable_location = argv[0];
-
- tsrm_ls = ts_resource(0);
-
- sapi_module.startup(&milter_sapi_module);
-
- zend_first_try {
- while ((c=ap_php_getopt(argc, argv, OPTSTRING))!=-1) {
- switch (c) {
- case '?':
- php_output_startup();
- php_output_activate(TSRMLS_C);
- SG(headers_sent) = 1;
- php_milter_usage(argv[0]);
- php_end_ob_buffers(1 TSRMLS_CC);
- exit(1);
- break;
- }
- }
- ap_php_optind = orig_optind;
- ap_php_optarg = orig_optarg;
-
- /* Set some CLI defaults */
- SG(options) |= SAPI_OPTION_NO_CHDIR;
- zend_alter_ini_entry("html_errors", 12, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
- zend_alter_ini_entry("max_execution_time", 19, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
-
- zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */
-
- if (milter_sapi_module.php_ini_path_override && milter_sapi_module.php_ini_ignore) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
- PUTS("You cannot use both -n and -c switch. Use -h for help.\n");
- exit(1);
- }
-
- while ((c = ap_php_getopt(argc, argv, OPTSTRING)) != -1) {
- switch (c) {
-
- case 'a': /* interactive mode */
- printf("Interactive mode enabled\n\n");
- interactive=1;
- break;
-
- case 'C': /* don't chdir to the script directory */
- /* This is default so NOP */
- break;
- case 'd': /* define ini entries on command line */
- define_command_line_ini_entry(ap_php_optarg);
- break;
-
- case 'D': /* daemon */
- dofork = 1;
- break;
-
- case 'e': /* enable extended info output */
- CG(extended_info) = 1;
- break;
-
- case 'f': /* parse file */
- filename = ap_php_optarg;
- break;
-
- case 'h': /* help & quit */
- case '?':
- php_output_startup();
- php_output_activate(TSRMLS_C);
- SG(headers_sent) = 1;
- php_milter_usage(argv[0]);
- php_end_ob_buffers(1 TSRMLS_CC);
- exit(1);
- break;
-
- case 'p': /* socket */
- sock = strdup(ap_php_optarg);
- break;
-
- case 'v': /* show php version & quit */
- if (php_request_startup(TSRMLS_C)==FAILURE) {
- zend_ini_deactivate(TSRMLS_C);
- php_module_shutdown(TSRMLS_C);
- sapi_shutdown();
- tsrm_shutdown();
-
- exit(1);
- }
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2003 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
- php_end_ob_buffers(1 TSRMLS_CC);
- exit(1);
- break;
-
- case 'V': /* verbose */
- flag_debug = atoi(ap_php_optarg);
- break;
-
- case 'z': /* load extension file */
- zend_load_extension(ap_php_optarg);
- break;
-
- default:
- break;
- }
- }
-
- if (param_error) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
- PUTS(param_error);
- exit(1);
- }
-
- CG(interactive) = interactive;
-
- /* only set script_file if not set already and not in direct mode and not at end of parameter list */
- if (argc > ap_php_optind && !filename) {
- filename=argv[ap_php_optind];
- ap_php_optind++;
- }
-
- // check if file exists, exit else
-
- if (dofork) {
- switch(fork()) {
- case -1: /* Uh-oh, we have a problem forking. */
- fprintf(stderr, "Uh-oh, couldn't fork!\n");
- exit(errno);
- break;
- case 0: /* Child */
- break;
- default: /* Parent */
- exit(0);
- }
- }
-
- {
- struct stat junk;
- if (stat(sock,&junk) == 0) unlink(sock);
- }
-
- openlog("php-milter", LOG_PID, LOG_MAIL);
-
- if (exit_status = mlfi_init()) {
- syslog(1, "mlfi_init failed.");
- exit(exit_status);
- }
-
- smfi_setconn(sock);
- if (smfi_register(smfilter) == MI_FAILURE) {
- syslog(1, "smfi_register failed.");
- fprintf(stderr, "smfi_register failed\n");
- } else {
- exit_status = smfi_main();
- }
-
- closelog();
-
- if (milter_sapi_module.php_ini_path_override) {
- free(milter_sapi_module.php_ini_path_override);
- }
-
- } zend_catch {
- exit_status = EG(exit_status);
- } zend_end_try();
-
- php_module_shutdown(TSRMLS_C);
- sapi_shutdown();
- tsrm_shutdown();
-
- exit(exit_status);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/milter/php_milter.h b/sapi/milter/php_milter.h
deleted file mode 100644
index 72d7ac51ee..0000000000
--- a/sapi/milter/php_milter.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef PHP_MILTER_H
-#define PHP_MILTER_H
-
-#include "libmilter/mfapi.h"
-
-#define MLFI_NONE 0
-#define MLFI_CONNECT 1
-#define MLFI_HELO 2
-#define MLFI_ENVFROM 3
-#define MLFI_ENVRCPT 4
-#define MLFI_HEADER 5
-#define MLFI_EOH 6
-#define MLFI_BODY 7
-#define MLFI_EOM 8
-#define MLFI_ABORT 9
-#define MLFI_CLOSE 10
-#define MLFI_INIT 11
-
-#define MG(v) TSRMG(milter_globals_id, zend_milter_globals *, v)
-
-typedef struct {
- pthread_t thread;
- MUTEX_T receiver;
- MUTEX_T sender;
- SMFICTX *ctx;
- sfsistat retval;
- int message;
- void **args;
-} worker_thread;
-
-#endif
diff --git a/sapi/nsapi/CREDITS b/sapi/nsapi/CREDITS
deleted file mode 100644
index 2a05919862..0000000000
--- a/sapi/nsapi/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-NSAPI
-Jayakumar Muthukumarasamy, Uwe Schindler
diff --git a/sapi/nsapi/config.m4 b/sapi/nsapi/config.m4
deleted file mode 100644
index 6a556dbe6f..0000000000
--- a/sapi/nsapi/config.m4
+++ /dev/null
@@ -1,45 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_MSG_CHECKING(for NSAPI support)
-AC_ARG_WITH(nsapi,
-[ --with-nsapi=DIR Build PHP as NSAPI module for use with iPlanet.],[
- PHP_NSAPI=$withval
-],[
- PHP_NSAPI=no
-])
-AC_MSG_RESULT($PHP_NSAPI)
-
-if test "$PHP_NSAPI" != "no"; then
- if test ! -d $PHP_NSAPI/bin ; then
- AC_MSG_ERROR(Please specify the path to the root of your Netscape server using --with-nsapi=DIR)
- fi
- AC_MSG_CHECKING(for NSAPI include files)
- if test -d $PHP_NSAPI/include ; then
- NSAPI_INCLUDE=$PHP_NSAPI/include
- AC_MSG_RESULT(Netscape-Enterprise/3.x style)
- AC_CHECK_HEADERS([$NSAPI_INCLUDE/nsapi.h])
- fi
- if test -d $PHP_NSAPI/plugins/include ; then
- test -n "$NSAPI_INCLUDE" && NSAPI_INC_DIR="-I$NSAPI_INCLUDE"
- NSAPI_INCLUDE="$PHP_NSAPI/plugins/include"
- AC_MSG_RESULT(iPlanet/4.x style)
- AC_CHECK_HEADERS([$NSAPI_INCLUDE/nsapi.h])
- NSAPI_INCLUDE="$NSAPI_INC_DIR -I$NSAPI_INCLUDE"
- fi
- if test "$NSAPI_INCLUDE" = ""; then
- AC_MSG_ERROR(Please check you have nsapi.h in either $PHP_NSAPI/include or $PHP_NSAPI/plugins/include)
- fi
-
- PHP_EVAL_INCLINE($NSAPI_INCLUDE)
- PHP_BUILD_THREAD_SAFE
- AC_DEFINE(HAVE_NSAPI,1,[Whether you have a Netscape Server])
- PHP_SELECT_SAPI(nsapi, shared, nsapi.c)
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PHP_NSAPI/bin/"
-fi
-
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/nsapi/nsapi-readme.txt b/sapi/nsapi/nsapi-readme.txt
deleted file mode 100644
index df595e9129..0000000000
--- a/sapi/nsapi/nsapi-readme.txt
+++ /dev/null
@@ -1,79 +0,0 @@
-Configuration of your Netscape or iPlanet Web Server for PHP4
--------------------------------------------------------------
-
-These instructions are targetted at Netscape Enterprise Web Server and
-SUN/Netscape Alliance iPlanet Web Server. On other web servers your
-milage may vary.
-
-Firstly you may need to add some paths to the LD_LIBRARY_PATH
-environment for Netscape to find all the shared libs. This is best done
-in the start script for your Netscape server. Windows users can
-probably skip this step. The start script is located in:
-
- <path-to-netscape-server>/https-servername/start
-
-
-Netscape config files are located in:
-
- <path-to-netscape-server>/https-servername/config
-
-
-Add the following line to mime.types:
-
- type=magnus-internal/x-httpd-php exts=php
-
-
-Add the following to obj.conf (for iPlanet/SunONE Web Server 6.0 and above however, you need to make the specified changes to the Init function
-in the server-id/config/magnus.conf file, and not the server-id/config/obj.conf file):
-
-"shlib" will vary depending on your OS:
-
- Unix: "<path-to-netscape-server>/bin/libphp4.so".
- Windows: "c:\path\to\PHP4\nsapiPHP4.dll"
-
-
-Note! Place following two lines after mime.types init:
-
- Init fn="load-modules" funcs="php4_init,php4_close,php4_execute,php4_auth_trans" shlib="/php4/nsapiPHP4.dll"
- Init fn=php4_init errorString="Failed to initialize PHP!"
-
- <Object name="default">
- .
- .
- .
- # NOTE this next line should happen after all 'ObjectType' and before
- # all 'AddLog' lines
-
- Service fn="php4_execute" type="magnus-internal/x-httpd-php"
- .
- .
- </Object>
-
- <Object name="x-httpd-php">
- ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
- Service fn=php4_execute
- </Object>
-
-
-Authentication configuration
-----------------------------
-
-PHP authentication cannot be used with any other authentication. ALL
-AUTHENTICATION IS PASSED TO YOUR PHP SCRIPT. To configure PHP
-Authentication for the entire server, add the following line:
-
- <Object name="default">
- AuthTrans fn=php4_auth_trans
- .
- .
- .
- .
- </Object>
-
-
-To use PHP Authentication on a single directory, add the following:
-
- <Object ppath="d:\path\to\authenticated\dir\*">
- AuthTrans fn=php4_auth_trans
- </Object>
-
diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c
deleted file mode 100644
index a9ed176d6d..0000000000
--- a/sapi/nsapi/nsapi.c
+++ /dev/null
@@ -1,597 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jayakumar Muthukumarasamy <jk@kasenna.com> |
- | Uwe Schindler <uwe@thetaphi.de> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- * PHP includes
- */
-#define NSAPI 1
-
-#include "php.h"
-#include "php_variables.h"
-#include "ext/standard/info.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "php_version.h"
-#include "TSRM.h"
-#include "ext/standard/php_standard.h"
-
-/*
- * If neither XP_UNIX not XP_WIN32 is defined use PHP_WIN32
- */
-#if !defined(XP_UNIX) && !defined(XP_WIN32)
-#ifdef PHP_WIN32
-#define XP_WIN32
-#else
-#define XP_UNIX
-#endif
-#endif
-
-/*
- * NSAPI includes
- */
-#include "nsapi.h"
-#include "base/pblock.h"
-#include "base/session.h"
-#include "frame/req.h"
-#include "frame/protocol.h" /* protocol_start_response */
-#include "base/util.h" /* is_mozilla, getline */
-#include "frame/log.h" /* log_error */
-
-/*
- * Timeout for net_read(). This should probably go into php.ini
- */
-#define NSAPI_READ_TIMEOUT 60 /* 60 seconds */
-
-#define NSLS_D struct nsapi_request_context *request_context
-#define NSLS_DC , NSLS_D
-#define NSLS_C request_context
-#define NSLS_CC , NSLS_C
-#define NSG(v) (request_context->v)
-
-#define NS_BUF_SIZE 2048
-
-/*
- * ZTS needs to be defined for NSAPI to work
- */
-#if !defined(ZTS)
-#error "NSAPI module needs ZTS to be defined"
-#endif
-
-/*
- * Structure to encapsulate the NSAPI request in SAPI
- */
-typedef struct nsapi_request_context {
- pblock *pb;
- Session *sn;
- Request *rq;
- int read_post_bytes;
-} nsapi_request_context;
-
-/*
- * Mappings between NSAPI names and environment variables. This
- * mapping was obtained from the sample programs at the iplanet
- * website.
- */
-typedef struct nsapi_equiv {
- const char *env_var;
- const char *nsapi_eq;
-} nsapi_equiv;
-
-static nsapi_equiv nsapi_headers[] = {
- { "CONTENT_LENGTH", "content-length" },
- { "CONTENT_TYPE", "content-type" }
-};
-static size_t nsapi_headers_size = sizeof(nsapi_headers)/sizeof(nsapi_headers[0]);
-
-static nsapi_equiv nsapi_reqpb[] = {
- { "QUERY_STRING", "query" },
- { "REQUEST_LINE", "clf-request" },
- { "REQUEST_METHOD", "method" },
- { "PHP_SELF", "uri" },
- { "SERVER_PROTOCOL", "protocol" }
-};
-static size_t nsapi_reqpb_size = sizeof(nsapi_reqpb)/sizeof(nsapi_reqpb[0]);
-
-static nsapi_equiv nsapi_vars[] = {
- { "PATH_INFO", "path-info" },
- { "SCRIPT_FILENAME", "path" },
- { "AUTH_TYPE", "auth-type" },
- { "CLIENT_CERT", "auth-cert" },
- { "REMOTE_USER", "auth-user" }
-};
-static size_t nsapi_vars_size = sizeof(nsapi_vars)/sizeof(nsapi_vars[0]);
-
-static nsapi_equiv nsapi_client[] = {
- { "HTTPS_KEYSIZE", "keysize" },
- { "HTTPS_SECRETSIZE", "secret-keysize" },
- { "REMOTE_ADDR", "ip" },
- { "REMOTE_HOST", "ip" }
-};
-static size_t nsapi_client_size = sizeof(nsapi_client)/sizeof(nsapi_client[0]);
-
-static char *nsapi_strdup(char *str)
-{
- if (str != NULL) {
- return STRDUP(str);
- }
- return NULL;
-}
-
-static void nsapi_free(void *addr)
-{
- if (addr != NULL) {
- FREE(addr);
- }
-}
-
-static int sapi_nsapi_ub_write(const char *str, unsigned int str_length TSRMLS_DC)
-{
- int retval;
- nsapi_request_context *rc;
-
- rc = (nsapi_request_context *)SG(server_context);
- retval = net_write(rc->sn->csd, (char *)str, str_length);
- if (retval == IO_ERROR /* -1 */ || retval == IO_EOF /* 0 */) {
- php_handle_aborted_connection();
- }
- return retval;
-}
-
-static int sapi_nsapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- char *header_name, *header_content, *p;
- nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
-
- header_name = sapi_header->header;
- header_content = p = strchr(header_name, ':');
- if (p == NULL) {
- efree(sapi_header->header);
- return 0;
- }
-
- *p = 0;
- do {
- header_content++;
- } while (*header_content == ' ');
-
- if (!strcasecmp(header_name, "Content-Type")) {
- param_free(pblock_remove("content-type", rc->rq->srvhdrs));
- pblock_nvinsert("content-type", header_content, rc->rq->srvhdrs);
- } else if (!strcasecmp(header_name, "Set-Cookie")) {
- pblock_nvinsert("set-cookie", header_content, rc->rq->srvhdrs);
- } else {
- pblock_nvinsert(header_name, header_content, rc->rq->srvhdrs);
- }
-
- *p = ':'; /* restore '*p' */
-
- efree(sapi_header->header);
-
- return 0; /* don't use the default SAPI mechanism, NSAPI duplicates this functionality */
-}
-
-static int sapi_nsapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- int retval;
- nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
-
- /*
- * We could probably just do this in the header_handler. But, I
- * don't know what the implication of doing it there is.
- */
- if (SG(sapi_headers).send_default_content_type) {
- param_free(pblock_remove("content-type", rc->rq->srvhdrs));
- pblock_nvinsert("content-type", "text/html", rc->rq->srvhdrs);
- }
-
- protocol_status(rc->sn, rc->rq, SG(sapi_headers).http_response_code, NULL);
- retval = protocol_start_response(rc->sn, rc->rq);
-
- if (retval == REQ_PROCEED || retval == REQ_NOACTION) {
- return SAPI_HEADER_SENT_SUCCESSFULLY;
- } else {
- return SAPI_HEADER_SEND_FAILED;
- }
-}
-
-static int sapi_nsapi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
-{
- nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
- char *read_ptr = buffer, *content_length_str = NULL;
- uint bytes_read = 0;
- int length, content_length = 0;
- netbuf *nbuf = rc->sn->inbuf;
-
- /*
- * Yesss!
- */
- count_bytes = MIN(count_bytes, SG(request_info).content_length-rc->read_post_bytes);
- content_length = SG(request_info).content_length;
-
-#if 0
- /*
- * Determine the content-length. This will tell us the limit we can read.
- */
- content_length_str = pblock_findval("content-length", rc->rq->headers);
- if (content_length_str != NULL) {
- content_length = strtol(content_length_str, 0, 0);
- }
-#endif
-
- if (content_length <= 0) {
- return 0;
- }
-
- /*
- * Gobble any pending data in the netbuf.
- */
- length = nbuf->cursize - nbuf->pos;
- length = MIN(count_bytes, length);
- if (length > 0) {
- memcpy(read_ptr, nbuf->inbuf + nbuf->pos, length);
- bytes_read += length;
- read_ptr += length;
- content_length -= length;
- nbuf->pos += length;
- }
-
- /*
- * Read the remaining from the socket.
- */
- while (content_length > 0 && bytes_read < count_bytes) {
- int bytes_to_read = count_bytes - bytes_read;
-
- if (content_length < bytes_to_read) {
- bytes_to_read = content_length;
- }
-
- length = net_read(rc->sn->csd, read_ptr, bytes_to_read, NSAPI_READ_TIMEOUT);
-
- if (length == IO_ERROR || length == IO_EOF) {
- break;
- }
-
- bytes_read += length;
- read_ptr += length;
- content_length -= length;
- }
-
- if ( bytes_read > 0 ) {
- rc->read_post_bytes += bytes_read;
- }
- return bytes_read;
-}
-
-static char *sapi_nsapi_read_cookies(TSRMLS_D)
-{
- char *cookie_string;
- nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
-
- cookie_string = pblock_findval("cookie", rc->rq->headers);
- return cookie_string;
-}
-
-static void sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_DC)
-{
- nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
- register size_t i;
- char *value,*p;
- char buf[NS_BUF_SIZE + 1];
- struct pb_entry *entry;
-
- for (i = 0; i < nsapi_reqpb_size; i++) {
- value = pblock_findval(nsapi_reqpb[i].nsapi_eq, rc->rq->reqpb);
- if (value) {
- php_register_variable((char *)nsapi_reqpb[i].env_var, value, track_vars_array TSRMLS_CC);
- }
- }
-
- for (i = 0; i < nsapi_headers_size; i++) {
- value = pblock_findval(nsapi_headers[i].nsapi_eq, rc->rq->headers);
- if (value) {
- php_register_variable((char *)nsapi_headers[i].env_var, value, track_vars_array TSRMLS_CC);
- }
- }
-
- for (i=0; i < rc->rq->headers->hsize; i++) {
- entry=rc->rq->headers->ht[i];
- while (entry) {
- snprintf(buf, NS_BUF_SIZE, "HTTP_%s", entry->param->name);
- for(p = buf + 5; *p; p++) {
- *p = toupper(*p);
- if (*p < 'A' || *p > 'Z') {
- *p = '_';
- }
- }
- php_register_variable(buf, entry->param->value, track_vars_array TSRMLS_CC);
- entry=entry->next;
- }
- }
-
- for (i = 0; i < nsapi_vars_size; i++) {
- value = pblock_findval(nsapi_vars[i].nsapi_eq, rc->rq->vars);
- if (value) {
- php_register_variable((char *)nsapi_vars[i].env_var, value, track_vars_array TSRMLS_CC);
- }
- }
-
- for (i = 0; i < nsapi_client_size; i++) {
- value = pblock_findval(nsapi_client[i].nsapi_eq, rc->sn->client);
- if (value) {
- php_register_variable((char *)nsapi_client[i].env_var, value, track_vars_array TSRMLS_CC);
- }
- }
-
- if (value = session_dns(rc->sn)) {
- php_register_variable("REMOTE_HOST", value, track_vars_array TSRMLS_CC);
- nsapi_free(value);
- }
-
- sprintf(buf, "%d", conf_getglobals()->Vport);
- php_register_variable("SERVER_PORT", buf, track_vars_array TSRMLS_CC);
- php_register_variable("SERVER_NAME", conf_getglobals()->Vserver_hostname, track_vars_array TSRMLS_CC);
-
- value = http_uri2url_dynamic("", "", rc->sn, rc->rq);
- php_register_variable("SERVER_URL", value, track_vars_array TSRMLS_CC);
- nsapi_free(value);
-
- php_register_variable("SERVER_SOFTWARE", system_version(), track_vars_array TSRMLS_CC);
- php_register_variable("HTTPS", (security_active ? "ON" : "OFF"), track_vars_array TSRMLS_CC);
- php_register_variable("GATEWAY_INTERFACE", "CGI/1.1", track_vars_array TSRMLS_CC);
-
- /* DOCUMENT_ROOT */
- if (value = request_translate_uri("/", rc->sn)) {
- value[strlen(value) - 1] = 0;
- php_register_variable("DOCUMENT_ROOT", value, track_vars_array TSRMLS_CC);
- nsapi_free(value);
- }
-
- /* PATH_TRANSLATED */
- if (value = pblock_findval("path-info", rc->rq->vars)) {
- if (value = request_translate_uri(value, rc->sn)) {
- php_register_variable("PATH_TRANSLATED", value, track_vars_array TSRMLS_CC);
- nsapi_free(value);
- }
- }
-
- /* Create full Request-URI */
- if (value = pblock_findval("uri", rc->rq->reqpb)) {
- snprintf(buf,NS_BUF_SIZE, "%s", value);
- if (value = pblock_findval("query", rc->rq->reqpb)) {
- p = strchr(buf, 0);
- snprintf(p, NS_BUF_SIZE-(p-buf), "?%s", value);
- }
- php_register_variable("REQUEST_URI", buf, track_vars_array TSRMLS_CC);
- }
-
- /* Create Script-Name */
- if (value = pblock_findval("uri", rc->rq->reqpb)) {
- snprintf(buf,NS_BUF_SIZE, "%s", value);
- if (value = pblock_findval("path-info", rc->rq->vars)) {
- buf[strlen(buf) - strlen(value)] = 0;
- }
- php_register_variable("SCRIPT_NAME", buf, track_vars_array TSRMLS_CC);
- }
-}
-
-static void nsapi_log_message(char *message)
-{
- TSRMLS_FETCH();
- nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
-
- log_error(LOG_INFORM, "PHP module", rc->sn, rc->rq, "%s", message);
-}
-
-static int php_nsapi_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-static sapi_module_struct nsapi_sapi_module = {
- "nsapi", /* name */
- "NSAPI", /* pretty name */
-
- php_nsapi_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- sapi_nsapi_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- sapi_nsapi_header_handler, /* header handler */
- sapi_nsapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- sapi_nsapi_read_post, /* read POST data */
- sapi_nsapi_read_cookies, /* read Cookies */
-
- sapi_nsapi_register_server_variables, /* register server variables */
- nsapi_log_message, /* Log message */
-
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-
-static void nsapi_request_ctor(NSLS_D TSRMLS_DC)
-{
- char *query_string = pblock_findval("query", NSG(rq)->reqpb);
- char *uri = pblock_findval("uri", NSG(rq)->reqpb);
- char *path_info = pblock_findval("path-info", NSG(rq)->vars);
- char *request_method = pblock_findval("method", NSG(rq)->reqpb);
- char *content_type = pblock_findval("content-type", NSG(rq)->headers);
- char *content_length = pblock_findval("content-length", NSG(rq)->headers);
- char *path_translated = pblock_findval("path", NSG(rq)->vars);;
-
-#if defined(NSAPI_DEBUG)
- log_error(LOG_INFORM, "nsapi_request_ctor", NSG(sn), NSG(rq),
- "query_string = %s, "
- "uri = %s, "
- "path_info = %s, "
- "path_translated = %s, "
- "request_method = %s, "
- "content_type = %s, "
- "content_length = %s",
- query_string,
- uri,
- path_info,
- path_translated,
- request_method,
- content_type,
- content_length);
-#endif
-
- SG(request_info).query_string = nsapi_strdup(query_string);
- SG(request_info).request_uri = nsapi_strdup(uri);
- SG(request_info).request_method = nsapi_strdup(request_method);
- SG(request_info).path_translated = nsapi_strdup(path_translated);
- SG(request_info).content_type = nsapi_strdup(content_type);
- SG(request_info).content_length = (content_length == NULL) ? 0 : strtoul(content_length, 0, 0);
- SG(sapi_headers).http_response_code = 200;
-}
-
-static void nsapi_request_dtor(NSLS_D TSRMLS_DC)
-{
- nsapi_free(SG(request_info).query_string);
- nsapi_free(SG(request_info).request_uri);
- nsapi_free(SG(request_info).request_method);
- nsapi_free(SG(request_info).path_translated);
- nsapi_free(SG(request_info).content_type);
-}
-
-int nsapi_module_main(NSLS_D TSRMLS_DC)
-{
- zend_file_handle file_handle;
-
- if (php_request_startup(TSRMLS_C) == FAILURE) {
- return FAILURE;
- }
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
-#if defined(NSAPI_DEBUG)
- log_error(LOG_INFORM, "nsapi_module_main", NSG(sn), NSG(rq), "Parsing [%s]", SG(request_info).path_translated);
-#endif
-
- php_execute_script(&file_handle TSRMLS_CC);
- php_request_shutdown(NULL);
-
-#if defined(NSAPI_DEBUG)
- log_error(LOG_INFORM, "nsapi_module_main", NSG(sn), NSG(rq), "PHP request finished Ok");
-#endif
-
- return SUCCESS;
-}
-
-void NSAPI_PUBLIC php4_close(void *vparam)
-{
- if (nsapi_sapi_module.shutdown) {
- nsapi_sapi_module.shutdown(&nsapi_sapi_module);
- }
- tsrm_shutdown();
-}
-
-int NSAPI_PUBLIC php4_init(pblock *pb, Session *sn, Request *rq)
-{
- php_core_globals *core_globals;
-
- tsrm_startup(1, 1, 0, NULL);
- core_globals = ts_resource(core_globals_id);
-
- sapi_startup(&nsapi_sapi_module);
- nsapi_sapi_module.startup(&nsapi_sapi_module);
-
- log_error(LOG_INFORM, "php4_init", sn, rq, "Initialized PHP Module\n");
- return REQ_PROCEED;
-}
-
-int NSAPI_PUBLIC php4_execute(pblock *pb, Session *sn, Request *rq)
-{
- int retval;
- nsapi_request_context *request_context;
- TSRMLS_FETCH();
-
- request_context = (nsapi_request_context *)MALLOC(sizeof(nsapi_request_context));
- request_context->pb = pb;
- request_context->sn = sn;
- request_context->rq = rq;
- request_context->read_post_bytes = 0;
-
- SG(server_context) = request_context;
-
- nsapi_request_ctor(NSLS_C TSRMLS_CC);
- retval = nsapi_module_main(NSLS_C TSRMLS_CC);
- nsapi_request_dtor(NSLS_C TSRMLS_CC);
-
- FREE(request_context);
-
- return (retval == SUCCESS) ? REQ_PROCEED : REQ_EXIT;
-}
-
-/*********************************************************
-/ authentication
-/
-/ we have to make a 'fake' authenticator for netscape so it
-/ will pass authentication through to php, and allow us to
-/ check authentication with our scripts.
-/
-/ php4_auth_trans
-/ main function called from netscape server to authenticate
-/ a line in obj.conf:
-/ funcs=php4_auth_trans shlib="path/to/this/phpnsapi.dll"
-/ and:
-/ <Object ppath="path/to/be/authenticated/by/php/*">
-/ AuthTrans fn="php4_auth_trans"
-/*********************************************************/
-int NSAPI_PUBLIC php4_auth_trans(pblock * pb, Session * sn, Request * rq)
-{
- /* This is a DO NOTHING function that allows authentication
- * information
- * to be passed through to PHP scripts.
- */
- return REQ_PROCEED;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/nsapi/php4nsapi.dsp b/sapi/nsapi/php4nsapi.dsp
deleted file mode 100644
index 9b0b8c9a56..0000000000
--- a/sapi/nsapi/php4nsapi.dsp
+++ /dev/null
@@ -1,135 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4nsapi" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4nsapi - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4nsapi.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4nsapi.mak" CFG="php4nsapi - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4nsapi - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4nsapi - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4nsapi - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4nsapi - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4nsapi___Win32_Release_TS"
-# PROP BASE Intermediate_Dir "php4nsapi___Win32_Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php4nsapi_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D ZEND_DEBUG=0 /D "NDEBUG" /D "XP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "php4nsapi_EXPORTS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 ns-httpd30.lib php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4nsapi - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4nsapi___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php4nsapi___Win32_Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php4nsapi_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "XP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "php4nsapi_EXPORTS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 ns-httpd30.lib php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4nsapi - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "php4nsapi___Win32_Debug_TS"
-# PROP BASE Intermediate_Dir "php4nsapi___Win32_Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php4nsapi_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D "_Debug_TS" /D ZEND_DEBUG=1 /D "_DEBUG" /D "XP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "php4nsapi_EXPORTS" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ns-httpd30.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4nsapi - Win32 Release_TS"
-# Name "php4nsapi - Win32 Release_TS_inline"
-# Name "php4nsapi - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\nsapi.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/sapi/phttpd/CREDITS b/sapi/phttpd/CREDITS
deleted file mode 100644
index 134cc54825..0000000000
--- a/sapi/phttpd/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-phttpd
-Thies C. Arntzen
diff --git a/sapi/phttpd/README b/sapi/phttpd/README
deleted file mode 100644
index cdb6f7c381..0000000000
--- a/sapi/phttpd/README
+++ /dev/null
@@ -1,5 +0,0 @@
-phttpd sapi module.
-
-THIS IS BY NO MEANS COMPLETE NOR USABLE RIGHT NOW!
-
-thies@thieso.net 03.01.2000
diff --git a/sapi/phttpd/config.m4 b/sapi/phttpd/config.m4
deleted file mode 100644
index 75c6d66891..0000000000
--- a/sapi/phttpd/config.m4
+++ /dev/null
@@ -1,25 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-RESULT=no
-AC_MSG_CHECKING(for PHTTPD support)
-AC_ARG_WITH(phttpd,
-[ --with-phttpd=DIR Build PHP as phttpd module],
-[
- if test ! -d $withval ; then
- AC_MSG_ERROR(You did not specify a directory)
- fi
- PHP_BUILD_THREAD_SAFE
- PHTTPD_DIR=$withval
- PHP_ADD_INCLUDE($PHTTPD_DIR/include)
- AC_DEFINE(HAVE_PHTTPD,1,[Whether you have phttpd])
- PHP_SELECT_SAPI(phttpd, shared, phttpd.c)
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PHTTPD_DIR/modules/"
- RESULT=yes
-])
-AC_MSG_RESULT($RESULT)
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/phttpd/php.sym b/sapi/phttpd/php.sym
deleted file mode 100644
index f10b883a99..0000000000
--- a/sapi/phttpd/php.sym
+++ /dev/null
@@ -1,4 +0,0 @@
-pm_init
-pm_exit
-pm_request
-
diff --git a/sapi/phttpd/php_phttpd.h b/sapi/phttpd/php_phttpd.h
deleted file mode 100644
index c82c852c54..0000000000
--- a/sapi/phttpd/php_phttpd.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef PHP_PHTTPD_H
-#define PHP_PHTTPD_H
-
-#include <phttpd.h>
-
-#endif
diff --git a/sapi/phttpd/phttpd.c b/sapi/phttpd/phttpd.c
deleted file mode 100644
index 886fc09936..0000000000
--- a/sapi/phttpd/phttpd.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen <thies@thieso.net> |
- | Based on aolserver SAPI by Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-#include "php.h"
-#include "SAPI.h"
-#include "php_main.h"
-
-#ifdef HAVE_PHTTPD
-
-#include "ext/standard/info.h"
-
-#ifndef ZTS
-#error PHTTPD module is only useable in thread-safe mode
-#endif
-
-#include "php_phttpd.h"
-
-typedef struct {
- struct connectioninfo *cip;
- struct stat sb;
-} phttpd_globals_struct;
-
-static int ph_globals_id;
-
-#define PHG(v) TSRMG(ph_globals_id, phttpd_globals_struct *, v)
-
-static int
-php_phttpd_startup(sapi_module_struct *sapi_module)
-{
- fprintf(stderr,"***php_phttpd_startup\n");
-
- if (php_module_startup(sapi_module, NULL, 0)) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-static int
-php_phttpd_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- int sent_bytes;
-
- sent_bytes = fd_write(PHG(cip)->fd, str, str_length);
-
- if (sent_bytes == -1) {
- php_handle_aborted_connection();
- }
-
- return sent_bytes;
-}
-
-static int
-php_phttpd_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- char *header_name, *header_content;
- char *p;
- TSRMLS_FETCH();
-
- http_sendheaders(PHG(cip)->fd, PHG(cip), SG(sapi_headers).http_response_code, NULL);
-
- header_name = sapi_header->header;
- header_content = p = strchr(header_name, ':');
-
- if (p) {
- *p = '\0';
- do {
- header_content++;
- } while (*header_content == ' ');
-
- fd_printf(PHG(cip)->fd,"%s: %s\n", header_name, header_content);
-
- *p = ':';
- }
-
- sapi_free_header(sapi_header);
-
- return 0;
-}
-
-static int
-php_phttpd_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- TSRMLS_FETCH();
-
- if (SG(sapi_headers).send_default_content_type) {
- fd_printf(PHG(cip)->fd,"Content-Type: text/html\n");
- }
-
- fd_putc('\n', PHG(cip)->fd);
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-static char *
-php_phttpd_sapi_read_cookies(TSRMLS_D)
-{
-
-/*
- int i;
- char *http_cookie = NULL;
- NTSRMLS_FETCH();
-
- i = Ns_SetIFind(NSG(conn->headers), "cookie");
- if(i != -1) {
- http_cookie = Ns_SetValue(NSG(conn->headers), i);
- }
-
- return http_cookie;
-*/
- fprintf(stderr,"***php_phttpd_sapi_read_cookies\n");
-
- return 0;
-}
-
-static int
-php_phttpd_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC)
-{
-/*
- uint max_read;
- uint total_read = 0;
- NTSRMLS_FETCH();
-
- max_read = MIN(NSG(data_avail), count_bytes);
-
- total_read = Ns_ConnRead(NSG(conn), buf, max_read);
-
- if(total_read == NS_ERROR) {
- total_read = -1;
- } else {
- NSG(data_avail) -= total_read;
- }
-
- return total_read;
-*/
- fprintf(stderr,"***php_phttpd_sapi_read_post\n");
- return 0;
-}
-
-static sapi_module_struct phttpd_sapi_module = {
- "phttpd",
- "PHTTPD",
-
- php_phttpd_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- php_phttpd_sapi_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- php_phttpd_sapi_header_handler, /* header handler */
- php_phttpd_sapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- php_phttpd_sapi_read_post, /* read POST data */
- php_phttpd_sapi_read_cookies, /* read Cookies */
-
- NULL, /* register server variables */
- NULL, /* Log message */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-static void
-php_phttpd_request_ctor(TSRMLS_D TSRMLS_DC)
-{
- memset(&SG(request_info), 0, sizeof(sapi_globals_struct)); /* pfusch! */
-
- SG(request_info).query_string = PHG(cip)->hip->request;
- SG(request_info).request_method = PHG(cip)->hip->method;
- SG(request_info).path_translated = malloc(MAXPATHLEN);
- SG(sapi_headers).http_response_code = 200;
- if (url_expand(PHG(cip)->hip->url, SG(request_info).path_translated, MAXPATHLEN, &PHG(sb), NULL, NULL) == NULL) {
- /* handle error */
- }
-
-#if 0
- char *server;
- Ns_DString ds;
- char *root;
- int index;
- char *tmp;
-
- server = Ns_ConnServer(NSG(conn));
-
- Ns_DStringInit(&ds);
- Ns_UrlToFile(&ds, server, NSG(conn->request->url));
-
- /* path_translated is the absolute path to the file */
- SG(request_info).path_translated = strdup(Ns_DStringValue(&ds));
- Ns_DStringFree(&ds);
- root = Ns_PageRoot(server);
- SG(request_info).request_uri = SG(request_info).path_translated + strlen(root);
- SG(request_info).content_length = Ns_ConnContentLength(NSG(conn));
- index = Ns_SetIFind(NSG(conn)->headers, "content-type");
- SG(request_info).content_type = index == -1 ? NULL :
- Ns_SetValue(NSG(conn)->headers, index);
-
- tmp = Ns_ConnAuthUser(NSG(conn));
- if(tmp) {
- tmp = estrdup(tmp);
- }
- SG(request_info).auth_user = tmp;
-
- tmp = Ns_ConnAuthPasswd(NSG(conn));
- if(tmp) {
- tmp = estrdup(tmp);
- }
- SG(request_info).auth_password = tmp;
-
- NSG(data_avail) = SG(request_info).content_length;
-#endif
-}
-
-static void
-php_phttpd_request_dtor(TSRMLS_D TSRMLS_DC)
-{
- free(SG(request_info).path_translated);
-}
-
-
-int php_doit(TSRMLS_D TSRMLS_DC)
-{
- struct stat sb;
- zend_file_handle file_handle;
- struct httpinfo *hip = PHG(cip)->hip;
- TSRMLS_FETCH();
-
- if (php_request_startup(TSRMLS_C) == FAILURE) {
- return -1;
- }
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
-
-/*
- php_phttpd_hash_environment(TSRMLS_C);
-*/
- php_execute_script(&file_handle TSRMLS_CC);
- php_request_shutdown(NULL);
-
- return SG(sapi_headers).http_response_code;
-}
-
-int pm_init(const char **argv)
-{
- tsrm_startup(1, 1, 0, NULL);
- sapi_startup(&phttpd_sapi_module);
- phttpd_sapi_module.startup(&phttpd_sapi_module);
-
- ts_allocate_id(&ph_globals_id, sizeof(phttpd_globals_struct), NULL, NULL);
-
- return 0;
-}
-
-void pm_exit(void)
-{
- fprintf(stderr,"***pm_exit\n");
-}
-
-int pm_request(struct connectioninfo *cip)
-{
- struct httpinfo *hip = cip->hip;
- int status;
- TSRMLS_FETCH();
-
- if (strcasecmp(hip->method, "GET") == 0 ||
- strcasecmp(hip->method, "HEAD") == 0 ||
- strcasecmp(hip->method, "POST") == 0) {
- PHG(cip) = cip;
-
- php_phttpd_request_ctor(TSRMLS_C);
- status = php_doit(TSRMLS_C);
- php_phttpd_request_dtor(TSRMLS_C);
-
- return status;
- } else {
- return -2;
- }
-}
-
-#endif
diff --git a/sapi/pi3web/CREDITS b/sapi/pi3web/CREDITS
deleted file mode 100644
index c4541f89da..0000000000
--- a/sapi/pi3web/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-pi3web
-Holger Zimmermann
diff --git a/sapi/pi3web/README b/sapi/pi3web/README
deleted file mode 100644
index 8d7e9dc274..0000000000
--- a/sapi/pi3web/README
+++ /dev/null
@@ -1,50 +0,0 @@
-PHP4 Module
-==========
-This module requires PHP4 as thread safe shared library. Have a look
-into the INSTALL file which accompanies that distribution.
-
-If you distribute this software bundled with the PHP software in source
-or binary form, then you must adhere to the PHP copyright conditions -
-the terms are reasonable.
-
-You should have checked out and built the PHP4 source package from the
-PHP CVS tree into the Pi3Web source directory called 'PHP4' first. Then
-build PHP4 as Pi3Web module and after that build the Pi3Web PHP4 wrapper:
-
-1. Checkout PHP4
-================
-cvs -d :pserver:cvsread@cvs.php.net:/repository login
-The required password is phpfi
-
-cvs -z3 -d :pserver:cvsread@cvs.php.net:/repository co php4
-
-You must also checkout the TSRM and the ZEND module from the ZEND cvs tree
-into the PHP4 root directory
-
-cvs -d :pserver:cvsread@cvs.zend.com:/repository login
-The required password is zend
-
-cvs -z3 -d :pserver:cvsread@cvs.zend.com:/repository co Zend TSRM
-
-2. Build PHP4
-=============
-2.1 POSIX
----------
-cd ./php4
-./buildconf
-./configure --with-pi3web
-make
-
-2.2 Win32
----------
-other required downloads from the php website
- - bison 1.25
- - bindlib32
- - number4.tar.gz
-nmake php4dllts.mak
-
-3. Build Pi3Web PHP4 wrapper
-============================
-Run make in the Pi3Web /Source/PHP4 directory.
-
-For further information refer to http://www.php.net/version4/
diff --git a/sapi/pi3web/config.m4 b/sapi/pi3web/config.m4
deleted file mode 100644
index 5b1ec78140..0000000000
--- a/sapi/pi3web/config.m4
+++ /dev/null
@@ -1,35 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-RESULT=no
-AC_MSG_CHECKING(for Pi3Web support)
-
-AC_ARG_WITH(pi3web,
-[ --with-pi3web=DIR Build PHP as Pi3Web module],
-[
-if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- PI3PATH=../.. # the default
- else
- PI3PATH=$withval
- fi
- test -f "$PI3PATH/PiAPI/PiAPI.h" || AC_MSG_ERROR(Unable to find PiAPI.h in $PI3PATH/PiAPI)
- PHP_BUILD_THREAD_SAFE
- AC_DEFINE(WITH_PI3WEB,1,[whether you want Pi3Web support])
- PHP_ADD_INCLUDE($PI3PATH/PiAPI)
- PHP_ADD_INCLUDE($PI3PATH/Pi2API)
- PHP_ADD_INCLUDE($PI3PATH/Pi3API)
- PHP_ADD_INCLUDE($PI3PATH/PHP4)
- PHP_SELECT_SAPI(pi3web, shared, pi3web_sapi.c)
- INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PI3PATH/bin/"
- RESULT=yes
-else
- RESULT=no
-fi
-])
-AC_MSG_RESULT($RESULT)
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/pi3web/php.sym b/sapi/pi3web/php.sym
deleted file mode 100644
index e69de29bb2..0000000000
--- a/sapi/pi3web/php.sym
+++ /dev/null
diff --git a/sapi/pi3web/php4pi3web.dsp b/sapi/pi3web/php4pi3web.dsp
deleted file mode 100644
index 6519f54be4..0000000000
--- a/sapi/pi3web/php4pi3web.dsp
+++ /dev/null
@@ -1,136 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4pi3web" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4pi3web - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4pi3web.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4pi3web.mak" CFG="php4pi3web - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4pi3web - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4pi3web - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4pi3web - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4pi3web - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php4pi3web_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php4pi3web - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php4pi3web_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /libpath:"..\..\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4pi3web - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4pi3web___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php4pi3web___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\..\..\PiAPI" /I "..\..\..\Pi2API" /I "..\..\..\Pi3API" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "PHP4PI3WEB_EXPORTS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"..\Release_TS\php4ts.dll" /libpath:"..\TSRM\Release_TS" /libpath:"..\Zend\Release_TS" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TS" /libpath:"Release_TS" /libpath:"..\..\..\PiAPI" /libpath:"..\..\..\Pi2API" /libpath:"..\..\..\Pi3API"
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /libpath:"..\..\Release_TS_inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4pi3web - Win32 Debug_TS"
-# Name "php4pi3web - Win32 Release_TS"
-# Name "php4pi3web - Win32 Release_TS_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=.\pi3web_sapi.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=.\pi3web_sapi.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c
deleted file mode 100644
index 3c223752ea..0000000000
--- a/sapi/pi3web/pi3web_sapi.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Pi3Web version 2.0 |
- +----------------------------------------------------------------------+
- | This file is committed by the Pi3 development group. |
- | (pi3web.sourceforge.net) |
- | |
- | Author: Holger Zimmermann (zimpel@users.sourceforge.net) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#include "pi3web_sapi.h"
-#include "php.h"
-#include "php_main.h"
-#include "php_variables.h"
-#include "SAPI.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-#include "zend_alloc.h"
-#include "ext/standard/basic_functions.h"
-#include "TSRM/TSRM.h"
-#include "PiAPI.h"
-#include "Pi3API.h"
-
-#define PI3WEB_SERVER_VAR_BUF_SIZE 1024
-
-int IWasLoaded=0;
-
-static char *pi3web_server_variables[] = {
- "ALL_HTTP",
- "AUTH_TYPE",
- "CONTENT_LENGTH",
- "CONTENT_TYPE",
- "GATEWAY_INTERFACE",
- "PATH_INFO",
- "PATH_TRANSLATED",
- "QUERY_STRING",
- "REQUEST_METHOD",
- "REMOTE_ADDR",
- "REMOTE_HOST",
- "REMOTE_USER",
- "SCRIPT_NAME",
- "SERVER_NAME",
- "SERVER_PORT",
- "SERVER_PROTOCOL",
- "SERVER_SOFTWARE",
- NULL
-};
-
-
-static void php_info_pi3web(ZEND_MODULE_INFO_FUNC_ARGS)
-{
- char **p = pi3web_server_variables;
- char variable_buf[PI3WEB_SERVER_VAR_BUF_SIZE];
- DWORD variable_len;
- LPCONTROL_BLOCK lpCB;
-
- lpCB = (LPCONTROL_BLOCK) SG(server_context);
-
- PUTS("<table border=0 cellpadding=3 cellspacing=1 width=600 align=center>\n");
- PUTS("<tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">Pi3Web Server Information</th></tr>\n");
- php_info_print_table_header(2, "Information Field", "Value");
- php_info_print_table_row(2, "Pi3Web SAPI module version", "$Id$");
- php_info_print_table_row(2, "Server Name Stamp", HTTPCore_getServerStamp());
- snprintf(variable_buf, 511, "%d", HTTPCore_debugEnabled());
- php_info_print_table_row(2, "Debug Enabled", variable_buf);
- PIPlatform_getCurrentDirectory( variable_buf, PI3WEB_SERVER_VAR_BUF_SIZE);
- php_info_print_table_row(2, "Current Path", variable_buf);
- if (lpCB->GetServerVariable(lpCB->ConnID, "SERVER_NAME", variable_buf, &variable_len)
- && variable_buf[0]) {
- php_info_print_table_row(2, "Main Virtual Hostname", variable_buf);
- };
- snprintf(variable_buf, 511, "%d", PIPlatform_getProcessId());
- php_info_print_table_row(2, "Server PID", variable_buf);
- php_info_print_table_row(2, "Server Platform", PIPlatform_getDescription());
-
- PUTS("</table><br />");
-
- PUTS("<table border=0 cellpadding=3 cellspacing=1 width=600 align=center>\n");
- PUTS("<tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Request Information</th></tr>\n");
- php_info_print_table_row(2, "HTTP Request Line", lpCB->lpszReq);
- PUTS("<tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Headers</th></tr>\n");
- php_info_print_table_header(2, "Server Variable", "Value");
- while (*p) {
- variable_len = PI3WEB_SERVER_VAR_BUF_SIZE;
- if (lpCB->GetServerVariable(lpCB->ConnID, *p, variable_buf, &variable_len)
- && variable_buf[0]) {
- php_info_print_table_row(2, *p, variable_buf);
- } else if (PIPlatform_getLastError() == PIAPI_EINVAL) {
- char *tmp_variable_buf;
-
- tmp_variable_buf = (char *) emalloc(variable_len);
- if (lpCB->GetServerVariable(lpCB->ConnID, *p, tmp_variable_buf, &variable_len)
- && variable_buf[0]) {
- php_info_print_table_row(2, *p, tmp_variable_buf);
- }
- efree(tmp_variable_buf);
- }
- p++;
- }
-
- PUTS("</table>");
-}
-
-
-static zend_module_entry php_pi3web_module = {
- STANDARD_MODULE_HEADER,
- "PI3WEB",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- php_info_pi3web,
- NULL,
- STANDARD_MODULE_PROPERTIES
-};
-
-
-static int zend_pi3web_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- DWORD num_bytes = str_length;
- LPCONTROL_BLOCK cb;
-
- cb = (LPCONTROL_BLOCK) SG(server_context);
-
- if ( !IWasLoaded ) return 0;
- cb->WriteClient(cb->ConnID, (char *) str, &num_bytes, 0 );
-
- if (num_bytes != str_length)
- php_handle_aborted_connection();
- return num_bytes;
-}
-
-
-static int sapi_pi3web_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- return SAPI_HEADER_ADD;
-}
-
-
-static void accumulate_header_length(sapi_header_struct *sapi_header, uint *total_length TSRMLS_DC)
-{
- *total_length += sapi_header->header_len+2;
-}
-
-
-static void concat_header(sapi_header_struct *sapi_header, char **combined_headers_ptr TSRMLS_DC)
-{
- memcpy(*combined_headers_ptr, sapi_header->header, sapi_header->header_len);
- *combined_headers_ptr += sapi_header->header_len;
- **combined_headers_ptr = '\r';
- (*combined_headers_ptr)++;
- **combined_headers_ptr = '\n';
- (*combined_headers_ptr)++;
-}
-
-
-static int sapi_pi3web_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- uint total_length = 2; /* account for the trailing \r\n */
- char *combined_headers, *combined_headers_ptr;
- LPCONTROL_BLOCK lpCB = (LPCONTROL_BLOCK) SG(server_context);
- sapi_header_struct default_content_type;
-
- if ( !IWasLoaded ) return SAPI_HEADER_SENT_SUCCESSFULLY;
-
-
- if (SG(sapi_headers).send_default_content_type) {
- sapi_get_default_content_type_header(&default_content_type TSRMLS_CC);
- accumulate_header_length(&default_content_type, (void *) &total_length TSRMLS_CC);
- }
- zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t) accumulate_header_length, (void *) &total_length TSRMLS_CC);
-
- /* Generate headers */
- combined_headers = (char *) emalloc(total_length+1);
- combined_headers_ptr = combined_headers;
- if (SG(sapi_headers).send_default_content_type) {
- concat_header(&default_content_type, (void *) &combined_headers_ptr TSRMLS_CC);
- sapi_free_header(&default_content_type); /* we no longer need it */
- }
- zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t) concat_header, (void *) &combined_headers_ptr TSRMLS_CC);
- *combined_headers_ptr++ = '\r';
- *combined_headers_ptr++ = '\n';
- *combined_headers_ptr = 0;
-
- lpCB->dwHttpStatusCode = SG(sapi_headers).http_response_code;
- lpCB->SendHeaderFunction(lpCB->ConnID, &total_length, (LPDWORD) combined_headers);
-
- efree(combined_headers);
- if (SG(sapi_headers).http_status_line) {
- efree(SG(sapi_headers).http_status_line);
- SG(sapi_headers).http_status_line = 0;
- }
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-
-static int php_pi3web_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, &php_pi3web_module, 1)==FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-
-static int sapi_pi3web_read_post(char *buffer, uint count_bytes TSRMLS_DC)
-{
- LPCONTROL_BLOCK lpCB = (LPCONTROL_BLOCK) SG(server_context);
- DWORD read_from_buf=0;
- DWORD read_from_input=0;
- DWORD total_read=0;
-
- if ((DWORD)SG(read_post_bytes) < lpCB->cbAvailable) {
- read_from_buf = MIN(lpCB->cbAvailable-SG(read_post_bytes), count_bytes);
- memcpy(buffer, lpCB->lpbData+SG(read_post_bytes), read_from_buf);
- total_read += read_from_buf;
- }
- if (read_from_buf<count_bytes
- && (SG(read_post_bytes)+read_from_buf) < lpCB->cbTotalBytes) {
- DWORD cbRead=0, cbSize;
-
- read_from_input = MIN(count_bytes-read_from_buf, lpCB->cbTotalBytes-SG(read_post_bytes)-read_from_buf);
- while (cbRead < read_from_input) {
- cbSize = read_from_input - cbRead;
- if (!lpCB->ReadClient(lpCB->ConnID, buffer+read_from_buf+cbRead, &cbSize) || cbSize==0) {
- break;
- }
- cbRead += cbSize;
- }
- total_read += cbRead;
- }
- SG(read_post_bytes) += total_read;
- return total_read;
-}
-
-
-static char *sapi_pi3web_read_cookies(TSRMLS_D)
-{
- LPCONTROL_BLOCK lpCB = (LPCONTROL_BLOCK) SG(server_context);
- char variable_buf[PI3WEB_SERVER_VAR_BUF_SIZE];
- DWORD variable_len = PI3WEB_SERVER_VAR_BUF_SIZE;
-
- if (lpCB->GetServerVariable(lpCB->ConnID, "HTTP_COOKIE", variable_buf, &variable_len)) {
- return estrndup(variable_buf, variable_len);
- } else if (PIPlatform_getLastError()==PIAPI_EINVAL) {
- char *tmp_variable_buf = (char *) emalloc(variable_len+1);
-
- if (lpCB->GetServerVariable(lpCB->ConnID, "HTTP_COOKIE", tmp_variable_buf, &variable_len)) {
- tmp_variable_buf[variable_len] = 0;
- return tmp_variable_buf;
- } else {
- efree(tmp_variable_buf);
- }
- }
- return NULL;
-}
-
-static void init_request_info(LPCONTROL_BLOCK lpCB TSRMLS_DC)
-{
- SG(server_context) = lpCB;
- SG(request_info).request_method = lpCB->lpszMethod;
- SG(request_info).query_string = lpCB->lpszQueryString;
- SG(request_info).path_translated = lpCB->lpszPathTranslated;
- SG(request_info).request_uri = lpCB->lpszUri;
- SG(request_info).content_type = lpCB->lpszContentType;
- SG(request_info).content_length = lpCB->cbTotalBytes;
- SG(request_info).auth_user = (lpCB->lpszUser) ? (char *)estrdup((const char *)(lpCB->lpszUser)) : 0;
- SG(request_info).auth_password = (lpCB->lpszPassword) ? (char *)estrdup((const char *)(lpCB->lpszPassword)) : 0;
- SG(sapi_headers).http_response_code = 200;
-}
-
-static void sapi_pi3web_register_variables(zval *track_vars_array TSRMLS_DC)
-{
- char static_variable_buf[PI3WEB_SERVER_VAR_BUF_SIZE];
- char *variable_buf;
- DWORD variable_len = PI3WEB_SERVER_VAR_BUF_SIZE;
- char *variable;
- char *strtok_buf = NULL;
- LPCONTROL_BLOCK lpCB = (LPCONTROL_BLOCK) SG(server_context);
- char **p = pi3web_server_variables;
- p++; // Jump over ALL_HTTP;
-
- /* Register the standard server variables */
- while (*p) {
- variable_len = PI3WEB_SERVER_VAR_BUF_SIZE;
- if (lpCB->GetServerVariable(lpCB->ConnID, *p, static_variable_buf, &variable_len)
- && (variable_len > 1)) {
- php_register_variable(*p, static_variable_buf, track_vars_array TSRMLS_CC);
- } else if (PIPlatform_getLastError()==PIAPI_EINVAL) {
- variable_buf = (char *) emalloc(variable_len);
- if (lpCB->GetServerVariable(lpCB->ConnID, *p, variable_buf, &variable_len)) {
- php_register_variable(*p, variable_buf, track_vars_array TSRMLS_CC);
- }
- efree(variable_buf);
- }
- p++;
- }
-
- /* PHP_SELF support */
- variable_len = PI3WEB_SERVER_VAR_BUF_SIZE;
- if (lpCB->GetServerVariable(lpCB->ConnID, "SCRIPT_NAME", static_variable_buf, &variable_len)
- && (variable_len > 1)) {
- php_register_variable("PHP_SELF", static_variable_buf, track_vars_array TSRMLS_CC);
- }
-
- variable_len = PI3WEB_SERVER_VAR_BUF_SIZE;
- if (lpCB->GetServerVariable(lpCB->ConnID, "ALL_HTTP", static_variable_buf, &variable_len)
- && (variable_len > 1)) {
- variable_buf = static_variable_buf;
- } else {
- if (PIPlatform_getLastError()==PIAPI_EINVAL) {
- variable_buf = (char *) emalloc(variable_len);
- if (!lpCB->GetServerVariable(lpCB->ConnID, "ALL_HTTP", variable_buf, &variable_len)) {
- efree(variable_buf);
- return;
- }
- } else {
- return;
- }
- }
- variable = php_strtok_r(variable_buf, "\r\n", &strtok_buf);
- while (variable) {
- char *colon = strchr(variable, ':');
-
- if (colon) {
- char *value = colon+1;
- while (*value==' ') {
- value++;
- }
- *colon = 0;
- php_register_variable(variable, value, track_vars_array TSRMLS_CC);
- *colon = ':';
- }
- variable = php_strtok_r(NULL, "\r\n", &strtok_buf);
- }
- if (variable_buf!=static_variable_buf) {
- efree(variable_buf);
- }
-}
-
-static sapi_module_struct pi3web_sapi_module = {
- "pi3web", /* name */
- "PI3WEB", /* pretty name */
-
- php_pi3web_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
- NULL, /* activate */
- NULL, /* deactivate */
- zend_pi3web_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
- php_error, /* error handler */
- sapi_pi3web_header_handler, /* header handler */
- sapi_pi3web_send_headers, /* send headers handler */
- NULL, /* send header handler */
- sapi_pi3web_read_post, /* read POST data */
- sapi_pi3web_read_cookies, /* read Cookies */
- sapi_pi3web_register_variables, /* register server variables */
- NULL, /* Log message */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-MODULE_API DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB)
-{
- zend_file_handle file_handle;
- int iRet = PIAPI_COMPLETED;
- TSRMLS_FETCH();
-
- zend_first_try {
- file_handle.filename = lpCB->lpszFileName;
- file_handle.free_filename = 0;
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.opened_path = NULL;
-
- init_request_info(lpCB TSRMLS_CC);
- php_request_startup(TSRMLS_C);
-
- switch ( lpCB->dwBehavior ) {
- case PHP_MODE_STANDARD:
- iRet = ( php_execute_script( &file_handle TSRMLS_CC ) ) ?
- PIAPI_COMPLETED : PIAPI_ERROR;
- break;
- case PHP_MODE_HIGHLIGHT: {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
- if ( open_file_for_scanning( &file_handle TSRMLS_CC ) == SUCCESS )
- {
- php_get_highlight_struct( &syntax_highlighter_ini );
- zend_highlight( &syntax_highlighter_ini TSRMLS_CC );
- }
- else
- {
- iRet = PIAPI_ERROR;
- };
- };
- break;
- case PHP_MODE_INDENT: {
- sapi_header_line ctr = {0};
-
- ctr.line = "Content-Type: text/plain";
- ctr.line_len = strlen(ctr.line);
-
- sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
- }
- if ( open_file_for_scanning( &file_handle TSRMLS_CC ) == SUCCESS )
- {
- zend_indent();
- }
- else
- {
- iRet = PIAPI_ERROR;
- };
- break;
- case PHP_MODE_LINT:
- iRet = (php_lint_script(&file_handle TSRMLS_CC) == SUCCESS) ?
- PIAPI_COMPLETED : PIAPI_ERROR;
- break;
- default:
- iRet = PIAPI_ERROR;;
- }
-
- if (SG(request_info).cookie_data) {
- efree(SG(request_info).cookie_data);
- };
-
- php_request_shutdown(NULL);
- } zend_catch {
- iRet = PIAPI_ERROR;
- } zend_end_try();
- return iRet;
-}
-
-MODULE_API BOOL PHP4_startup() {
- tsrm_startup(1, 1, 0, NULL);
- sapi_startup(&pi3web_sapi_module);
- if (pi3web_sapi_module.startup) {
- pi3web_sapi_module.startup(&pi3web_sapi_module);
- };
- IWasLoaded = 1;
- return IWasLoaded;
-};
-
-MODULE_API BOOL PHP4_shutdown() {
- if (pi3web_sapi_module.shutdown) {
- pi3web_sapi_module.shutdown(&pi3web_sapi_module);
- };
- sapi_shutdown();
- tsrm_shutdown();
- IWasLoaded = 0;
- return !IWasLoaded;
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/sapi/pi3web/pi3web_sapi.h b/sapi/pi3web/pi3web_sapi.h
deleted file mode 100644
index d1c38d744e..0000000000
--- a/sapi/pi3web/pi3web_sapi.h
+++ /dev/null
@@ -1,95 +0,0 @@
-#ifndef _PI3WEB_SAPI_H_
-#define _PI3WEB_SAPI_H_
-
-#ifdef PHP_WIN32
-# include <windows.h>
-# include <httpext.h>
-# ifdef PHP4PI3WEB_EXPORTS
-# define MODULE_API __declspec(dllexport)
-# else
-# define MODULE_API __declspec(dllimport)
-# endif
-#else
-# define far
-# define MODULE_API
-
- typedef int BOOL;
- typedef void far *LPVOID;
- typedef LPVOID HCONN;
- typedef unsigned long DWORD;
- typedef DWORD far *LPDWORD;
- typedef char CHAR;
- typedef CHAR *LPSTR;
- typedef unsigned char BYTE;
- typedef BYTE far *LPBYTE;
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define PHP_MODE_STANDARD 1
-#define PHP_MODE_HIGHLIGHT 2
-#define PHP_MODE_INDENT 3
-#define PHP_MODE_LINT 4
-
-//
-// passed to the procedure on a new request
-//
-typedef struct _CONTROL_BLOCK {
- DWORD cbSize; // size of this struct.
- HCONN ConnID; // Context number not to be modified!
- DWORD dwHttpStatusCode; // HTTP Status code
- CHAR lpszLogData[80]; // null terminated log info
-
- LPSTR lpszMethod; // REQUEST_METHOD
- LPSTR lpszQueryString; // QUERY_STRING
- LPSTR lpszPathInfo; // PATH_INFO
- LPSTR lpszPathTranslated; // PATH_TRANSLATED
- LPSTR lpszFileName; // FileName to PHP3 physical file
- LPSTR lpszUri; // The request URI
- LPSTR lpszReq; // The whole HTTP request line
- LPSTR lpszUser; // The authenticated user
- LPSTR lpszPassword; // The authenticated password
-
- DWORD cbTotalBytes; // Total bytes indicated from client
- DWORD cbAvailable; // Available number of bytes
- LPBYTE lpbData; // pointer to cbAvailable bytes
-
- LPSTR lpszContentType; // Content type of client data
- DWORD dwBehavior; // PHP behavior (standard, highlight, intend
-
- BOOL (* GetServerVariable) ( HCONN hConn,
- LPSTR lpszVariableName,
- LPVOID lpvBuffer,
- LPDWORD lpdwSize );
-
- BOOL (* WriteClient) ( HCONN ConnID,
- LPVOID Buffer,
- LPDWORD lpdwBytes,
- DWORD dwReserved );
-
- BOOL (* ReadClient) ( HCONN ConnID,
- LPVOID lpvBuffer,
- LPDWORD lpdwSize );
-
- BOOL (* SendHeaderFunction)( HCONN hConn,
- LPDWORD lpdwSize,
- LPDWORD lpdwDataType );
-
-} CONTROL_BLOCK, *LPCONTROL_BLOCK;
-
-MODULE_API DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB);
-MODULE_API BOOL PHP4_startup();
-MODULE_API BOOL PHP4_shutdown();
-
-// the following type declaration is for the server side
-typedef DWORD ( * PFN_WRAPPERFUNC )( CONTROL_BLOCK *pCB );
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // end definition _PI3WEB_SAPI_H_
diff --git a/sapi/roxen/README b/sapi/roxen/README
deleted file mode 100644
index c6ec30d272..0000000000
--- a/sapi/roxen/README
+++ /dev/null
@@ -1,18 +0,0 @@
-Roxen PHP support. Early version. Don't expect to be able to get it to
-work. Requires Pike 0.7.79 and Roxen 1.4. Anything less won't work.
-
-The module is now thread safe, in a couple of different modes. First
-mode, the default, uses a process global PHP lock in the Roxen
-module. This means that all PHP-requests are serialized (ie only one
-script is executed at any one time). The second option is using ZTS
-(Zend Thread Safe mode). Unless --enable-roxen-zts is specified, this
-won't be used.
-
-This solution now works fine and is recommended. Multiple PHP4
-requests will be run in parallell. The maximum number of parallell
-PHP4-execution is limited to the number of handle threads Roxen is
-started with.
-
-Support for this module is lacking. Please contact Roxen Internet
-Software for support and help. See http://www.roxen.com/company/contact/
-for contact information.
diff --git a/sapi/roxen/TODO b/sapi/roxen/TODO
deleted file mode 100644
index 4ba171accc..0000000000
--- a/sapi/roxen/TODO
+++ /dev/null
@@ -1,33 +0,0 @@
-BUGS:
-
-- fix backtraces
-- exit in PHP exits Roxen
-- POST newline added?
-- Rewriting header handling so that more than one header with the same
- name can be set (most importantly, cookies).
-- Recursive mutex lock problem:
-
- And another error (when trying to include a class)
-
- Recursive mutex locks!
- /Usr/local/pike/7.0.54/lib/modules/PHP4.so.Interpreter:
- run("/home/www/www.tx.pl/news/test.php",mapping[3],modules/scripting/php4.pike.PHPScript(),modules/scripting/php4.pike.PHPScript.done)
- modules/scripting/php4.pike:169: run()
- base_server/roxen.pike:569: handler_thread(3).
-
- And after this every access to any php script (on other virtual sites
- also) ends (of course there is no proper output) with this error:
-
- Php4.Interpreter->run: Tried to run a PHP-script from a PHP
- callback!/usr/local/pike/7.0.54/lib/modules/PHP4.so.Interpreter:
- run("/home/www/biall.com.pl/index.php3",mapping[2],modules/scripting/php4.pike.PHPScript(),modules/scripting/php4.pike.PHPScript.done)
- modules/scripting/php4.pike:169: run()
- base_server/roxen.pike:569: handler_thread(3).
-
-
-ADDITIONS:
-
-- use th_farm
-- change cwd in single threaded mode
-- per-virtual-server configuration
-
diff --git a/sapi/roxen/config.m4 b/sapi/roxen/config.m4
deleted file mode 100644
index cf2726b51b..0000000000
--- a/sapi/roxen/config.m4
+++ /dev/null
@@ -1,60 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-RESULT=no
-AC_MSG_CHECKING(for Roxen/Pike support)
-AC_ARG_WITH(roxen,
-[ --with-roxen=DIR Build PHP as a Pike module. DIR is the base Roxen
- directory, normally /usr/local/roxen/server.],
-[
- if test ! -d $withval ; then
- AC_MSG_ERROR(You did not specify a directory)
- fi
- if test -f $withval/bin/roxen; then
- PIKE=$withval/bin/roxen
- elif test -f $withval/bin/pike; then
- PIKE=$withval/bin/pike
- else
- AC_MSG_ERROR(Couldn't find a pike in $withval/bin/)
- fi
- if $PIKE -e 'float v; catch(v = __VERSION__ + (__BUILD__/10000.0)); if(v < 0.7079) exit(1); exit(0);'; then
- PIKE_MODULE_DIR=`$PIKE --show-paths 2>&1| grep '^Module' | sed -e 's/.*: //'`
- PIKE_INCLUDE_DIR=`echo $PIKE_MODULE_DIR | sed -e 's,lib/pike/modules,include/pike,' -e 's,lib/modules,include/pike,'`
- if test -z "$PIKE_INCLUDE_DIR" -o -z "$PIKE_MODULE_DIR"; then
- AC_MSG_ERROR(Failed to figure out Pike module and include directories)
- fi
- else
- AC_MSG_ERROR(Roxen/PHP requires Pike 0.7.79 or newer)
- fi
-
- PHP_ADD_INCLUDE($PIKE_INCLUDE_DIR)
- AC_DEFINE(HAVE_ROXEN,1,[Whether you use Roxen])
- PHP_SELECT_SAPI(roxen, shared, roxen.c)
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $PIKE_MODULE_DIR/PHP4.so"
- RESULT="yes
- Pike binary used: $PIKE
- Pike include dir: $PIKE_INCLUDE_DIR
- Pike module directory: $PIKE_MODULE_DIR"
- PIKE_INCLUDE_DIR=" -I$PIKE_INCLUDE_DIR "
-])
-AC_MSG_RESULT($RESULT)
-
-if test "$RESULT" != "no" ; then
- RESULT=no
- AC_MSG_CHECKING(if Roxen should use ZTS)
- AC_ARG_ENABLE(roxen-zts,
- [ --enable-roxen-zts Build the Roxen module using Zend Thread Safety.],
- [
- PHP_BUILD_THREAD_SAFE
- AC_DEFINE(ROXEN_USE_ZTS,1,[Whether to use Roxen in ZTS mode])
- RESULT=yes
-
- ])
- AC_MSG_RESULT($RESULT)
-fi
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
-
diff --git a/sapi/roxen/roxen.c b/sapi/roxen/roxen.c
deleted file mode 100644
index 9002040959..0000000000
--- a/sapi/roxen/roxen.c
+++ /dev/null
@@ -1,725 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Hedbor <neotron@php.net> |
- | Based on aolserver SAPI by Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#ifdef HAVE_ROXEN
-
-#include "php_ini.h"
-#include "php_globals.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "ext/standard/info.h"
-
-#include "php_version.h"
-
-#ifndef ZTS
-/* Only valid if thread safety is enabled. */
-#undef ROXEN_USE_ZTS
-#endif
-
-
-/* Pike Include Files
- *
- * conflicts with pike avoided by only using long names. Requires a new
- * Pike 0.7 since it was implemented for this interface only.
- *
- */
-#define NO_PIKE_SHORTHAND
-
-#include <fdlib.h>
-#include <program.h>
-#include <pike_types.h>
-#include <interpret.h>
-#include <module_support.h>
-#include <error.h>
-#include <array.h>
-#include <backend.h>
-#include <stralloc.h>
-#include <mapping.h>
-#include <object.h>
-#include <threads.h>
-#include <builtin_functions.h>
-#include <operators.h>
-
-#undef HIDE_GLOBAL_VARIABLES
-#undef REVEAL_GLOBAL_VARIABLES
-#define HIDE_GLOBAL_VARIABLES()
-#define REVEAL_GLOBAL_VARIABLES()
-
-/* php_roxen_request is per-request object storage */
-
-typedef struct
-{
- struct mapping *request_data;
- struct object *my_fd_obj;
- int my_fd;
- char *filename;
-} php_roxen_request;
-
-
-/* Defines to get to the data supplied when the script is started. */
-
-#ifdef ROXEN_USE_ZTS
-
-/* ZTS does work now, but it seems like it's faster using the "serialization"
- * method I previously used. Thus it's not used unless ROXEN_USE_ZTS is defined.
- */
-
-/* Per thread storage area id... */
-static int roxen_globals_id;
-
-# define GET_THIS() php_roxen_request *_request = ts_resource(roxen_globals_id)
-# define THIS _request
-#else
-static php_roxen_request *current_request = NULL;
-
-# define GET_THIS() current_request = ((php_roxen_request *)Pike_fp->current_storage)
-# define THIS current_request
-#endif
-
-/* File descriptor integer. Used to write directly to the FD without
- * passing Pike
- */
-#define MY_FD (THIS->my_fd)
-
-/* FD object. Really a PHPScript object from Pike which implements a couple
- * of functions to handle headers, writing and buffering.
- */
-#define MY_FD_OBJ ((struct object *)(THIS->my_fd_obj))
-
-/* Mapping with data supplied from the calling Roxen module. Contains
- * a mapping with headers, an FD object etc.
- */
-#define REQUEST_DATA ((struct mapping *)(THIS->request_data))
-
-
-#if defined(_REENTRANT) && !defined(ROXEN_USE_ZTS)
-/* Lock used to serialize the PHP execution. If ROXEN_USE_ZTS is defined, we
- * are using the PHP thread safe mechanism instead.
- */
-static PIKE_MUTEX_T roxen_php_execution_lock;
-# define PHP_INIT_LOCK() mt_init(&roxen_php_execution_lock)
-# define PHP_LOCK(X) THREADS_ALLOW();mt_lock(&roxen_php_execution_lock);THREADS_DISALLOW()
-# define PHP_UNLOCK(X) mt_unlock(&roxen_php_execution_lock);
-# define PHP_DESTROY() mt_destroy(&roxen_php_execution_lock)
-#else /* !_REENTRANT */
-# define PHP_INIT_LOCK()
-# define PHP_LOCK(X)
-# define PHP_UNLOCK(X)
-# define PHP_DESTROY()
-#endif /* _REENTRANT */
-
-extern int fd_from_object(struct object *o);
-static unsigned char roxen_php_initialized;
-
-/* This allows calling of pike functions from the PHP callbacks,
- * which requires the Pike interpreter to be locked.
- */
-#define THREAD_SAFE_RUN(COMMAND, what) do {\
- struct thread_state *state;\
- if((state = thread_state_for_id(th_self()))!=NULL) {\
- if(!state->swapped) {\
- COMMAND;\
- } else {\
- mt_lock(&interpreter_lock);\
- SWAP_IN_THREAD(state);\
- COMMAND;\
- SWAP_OUT_THREAD(state);\
- mt_unlock(&interpreter_lock);\
- }\
- }\
-} while(0)
-
-struct program *php_program;
-
-
-/* To avoid executing a PHP script from a PHP callback, which would
- * create a deadlock, a global thread id is used. If the thread calling the
- * php-script is the same as the current thread, it fails.
- */
-static int current_thread = -1;
-
-
-/* Low level header lookup. Basically looks for the named header in the mapping
- * headers in the supplied options mapping.
- */
-
-static INLINE struct svalue *lookup_header(char *headername)
-{
- struct svalue *headers, *value;
- struct pike_string *sind;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- sind = make_shared_string("env");
- headers = low_mapping_string_lookup(REQUEST_DATA, sind);
- free_string(sind);
- if(!headers || headers->type != PIKE_T_MAPPING) return NULL;
- sind = make_shared_string(headername);
- value = low_mapping_string_lookup(headers->u.mapping, sind);
- free_string(sind);
- if(!value) return NULL;
- return value;
-}
-
-/* Lookup a header in the mapping and return the value as a string, or
- * return the default if it's missing
- */
-INLINE static char *lookup_string_header(char *headername, char *default_value)
-{
- struct svalue *head = NULL;
- THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup");
- if(!head || head->type != PIKE_T_STRING)
- return default_value;
- return head->u.string->str;
-}
-
-/* Lookup a header in the mapping and return the value as if it's an integer
- * and otherwise return the default.
- */
-INLINE static int lookup_integer_header(char *headername, int default_value)
-{
- struct svalue *head = NULL;
- THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup");
- if(!head || head->type != PIKE_T_INT)
- return default_value;
- return head->u.integer;
-}
-
-/*
- * php_roxen_low_ub_write() writes data to the client connection. Might be
- * rewritten to do more direct IO to save CPU and the need to lock the *
- * interpreter for better threading.
- */
-
-static int
-php_roxen_low_ub_write(const char *str, uint str_length TSRMLS_DC) {
- int sent_bytes = 0;
- struct pike_string *to_write = NULL;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
-
- if(!MY_FD_OBJ->prog) {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return -1;
- }
- to_write = make_shared_binary_string(str, str_length);
- push_string(to_write);
- safe_apply(MY_FD_OBJ, "write", 1);
- if(Pike_sp[-1].type == PIKE_T_INT)
- sent_bytes = Pike_sp[-1].u.integer;
- pop_stack();
- if(sent_bytes != str_length) {
- /* This means the connection is closed. Dead. Gone. *sniff* */
- php_handle_aborted_connection();
- }
- return sent_bytes;
-}
-
-/*
- * php_roxen_sapi_ub_write() calls php_roxen_low_ub_write in a Pike thread
- * safe manner.
- */
-
-static int
-php_roxen_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
-
- int sent_bytes = 0, fd = MY_FD;
- if(fd)
- {
- for(sent_bytes=0;sent_bytes < str_length;)
- {
- int written;
- written = fd_write(fd, str + sent_bytes, str_length - sent_bytes);
- if(written < 0)
- {
- switch(errno)
- {
- default:
- /* This means the connection is closed. Dead. Gone. *sniff* */
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return sent_bytes;
- case EINTR:
- case EWOULDBLOCK:
- continue;
- }
-
- } else {
- sent_bytes += written;
- }
- }
- } else {
- THREAD_SAFE_RUN(sent_bytes = php_roxen_low_ub_write(str, str_length TSRMLS_CC),
- "write");
- }
- return sent_bytes;
-}
-
-/* php_roxen_set_header() sets a header in the header mapping. Called in a
- * thread safe manner from php_roxen_sapi_header_handler.
- */
-static void php_roxen_set_header(char *header_name, char *value, char *p)
-{
- struct svalue hsval;
- struct pike_string *hval, *ind, *hind;
- struct mapping *headermap;
- struct svalue *s_headermap;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- hval = make_shared_string(value);
- ind = make_shared_string(" _headers");
- hind = make_shared_binary_string(header_name,
- (int)(p - header_name));
-
- s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind);
- if(!s_headermap)
- {
- struct svalue mappie;
- mappie.type = PIKE_T_MAPPING;
- headermap = allocate_mapping(1);
- mappie.u.mapping = headermap;
- mapping_string_insert(REQUEST_DATA, ind, &mappie);
- free_mapping(headermap);
- } else
- headermap = s_headermap->u.mapping;
-
- hsval.type = PIKE_T_STRING;
- hsval.u.string = hval;
- mapping_string_insert(headermap, hind, &hsval);
-
- free_string(hval);
- free_string(ind);
- free_string(hind);
-}
-
-/*
- * php_roxen_sapi_header_handler() sets a HTTP reply header to be
- * sent to the client.
- */
-static int
-php_roxen_sapi_header_handler(sapi_header_struct *sapi_header,
- sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- char *header_name, *header_content, *p;
- header_name = sapi_header->header;
- header_content = p = strchr(header_name, ':');
-
- if(p) {
- do {
- header_content++;
- } while(*header_content == ' ');
- THREAD_SAFE_RUN(php_roxen_set_header(header_name, header_content, p), "header handler");
- }
- sapi_free_header(sapi_header);
- return 0;
-}
-
-/*
- * php_roxen_sapi_send_headers() flushes the headers to the client.
- * Called before real content is sent by PHP.
- */
-
-static int
-php_roxen_low_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- struct pike_string *ind;
- struct svalue *s_headermap;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
-
- if(!MY_FD_OBJ->prog) {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return SAPI_HEADER_SEND_FAILED;
- }
- ind = make_shared_string(" _headers");
- s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind);
- free_string(ind);
-
- push_int(SG(sapi_headers).http_response_code);
- if(s_headermap && s_headermap->type == PIKE_T_MAPPING)
- ref_push_mapping(s_headermap->u.mapping);
- else
- push_int(0);
- safe_apply(MY_FD_OBJ, "send_headers", 2);
- pop_stack();
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-static int
-php_roxen_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- int res = 0;
- THREAD_SAFE_RUN(res = php_roxen_low_send_headers(sapi_headers TSRMLS_CC), "send headers");
- return res;
-}
-
-/*
- * php_roxen_sapi_read_post() reads a specified number of bytes from
- * the client. Used for POST/PUT requests.
- */
-
-INLINE static int php_roxen_low_read_post(char *buf, uint count_bytes)
-{
- uint total_read = 0;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- TSRMLS_FETCH();
-
- if(!MY_FD_OBJ->prog)
- {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return -1;
- }
- push_int(count_bytes);
- safe_apply(MY_FD_OBJ, "read_post", 1);
- if(Pike_sp[-1].type == PIKE_T_STRING) {
- MEMCPY(buf, Pike_sp[-1].u.string->str,
- (total_read = Pike_sp[-1].u.string->len));
- buf[total_read] = '\0';
- } else
- total_read = 0;
- pop_stack();
- return total_read;
-}
-
-static int
-php_roxen_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC)
-{
- uint total_read = 0;
- THREAD_SAFE_RUN(total_read = php_roxen_low_read_post(buf, count_bytes), "read post");
- return total_read;
-}
-
-/*
- * php_roxen_sapi_read_cookies() returns the Cookie header from
- * the HTTP request header
- */
-
-static char *
-php_roxen_sapi_read_cookies(TSRMLS_D)
-{
- char *cookies;
- cookies = lookup_string_header("HTTP_COOKIE", NULL);
- return cookies;
-}
-
-static void php_info_roxen(ZEND_MODULE_INFO_FUNC_ARGS)
-{
- /* char buf[512]; */
- php_info_print_table_start();
- php_info_print_table_row(2, "SAPI module version", "$Id$");
- /* php_info_print_table_row(2, "Build date", Ns_InfoBuildDate());
- php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile());
- php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog());
- php_info_print_table_row(2, "Installation path", Ns_InfoHomePath());
- php_info_print_table_row(2, "Hostname of server", Ns_InfoHostname());
- php_info_print_table_row(2, "Source code label", Ns_InfoLabel());
- php_info_print_table_row(2, "Server platform", Ns_InfoPlatform());
- snprintf(buf, 511, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion());
- php_info_print_table_row(2, "Server version", buf);
- snprintf(buf, 511, "%d day(s), %02d:%02d:%02d",
- uptime / 86400,
- (uptime / 3600) % 24,
- (uptime / 60) % 60,
- uptime % 60);
- php_info_print_table_row(2, "Server uptime", buf);
- */
- php_info_print_table_end();
-}
-
-static zend_module_entry php_roxen_module = {
- STANDARD_MODULE_HEADER,
- "Roxen",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- php_info_roxen,
- NULL,
- STANDARD_MODULE_PROPERTIES
-};
-
-static int php_roxen_startup(sapi_module_struct *sapi_module)
-{
- if(php_module_startup(sapi_module, &php_roxen_module, 1) == FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-/* this structure is static (as in "it does not change") */
-
-static sapi_module_struct roxen_sapi_module = {
- "roxen",
- "Roxen",
- php_roxen_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
- NULL, /* activate */
- NULL, /* deactivate */
- php_roxen_sapi_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
- php_error, /* error handler */
- php_roxen_sapi_header_handler, /* header handler */
- php_roxen_sapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
- php_roxen_sapi_read_post, /* read POST data */
- php_roxen_sapi_read_cookies, /* read Cookies */
- NULL, /* register server variables */
- NULL, /* Log message */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-/*
- * php_roxen_hash_environment() populates the php script environment
- * with a number of variables. HTTP_* variables are created for
- * the HTTP header data, so that a script can access these.
- */
-#define ADD_STRING(name) \
- MAKE_STD_ZVAL(pval); \
- pval->type = IS_STRING; \
- pval->value.str.len = strlen(buf); \
- pval->value.str.val = estrndup(buf, pval->value.str.len); \
- zend_hash_update(&EG(symbol_table), name, sizeof(name), \
- &pval, sizeof(zval *), NULL)
-
-static void
-php_roxen_hash_environment(TSRMLS_D)
-{
- int i;
- char buf[512];
- zval *pval;
- struct svalue *headers;
- struct pike_string *sind;
- struct array *indices;
- struct svalue *ind, *val;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- sind = make_shared_string("env");
- headers = low_mapping_string_lookup(REQUEST_DATA, sind);
- free_string(sind);
- if(headers && headers->type == PIKE_T_MAPPING) {
- indices = mapping_indices(headers->u.mapping);
- for(i = 0; i < indices->size; i++) {
- ind = &indices->item[i];
- val = low_mapping_lookup(headers->u.mapping, ind);
- if(ind && ind->type == PIKE_T_STRING &&
- val && val->type == PIKE_T_STRING) {
- int buf_len;
- buf_len = MIN(511, ind->u.string->len);
- strncpy(buf, ind->u.string->str, buf_len);
- buf[buf_len] = '\0'; /* Terminate correctly */
- MAKE_STD_ZVAL(pval);
- pval->type = IS_STRING;
- pval->value.str.len = val->u.string->len;
- pval->value.str.val = estrndup(val->u.string->str, pval->value.str.len);
-
- zend_hash_update(&EG(symbol_table), buf, buf_len + 1, &pval, sizeof(zval *), NULL);
- }
- }
- free_array(indices);
- }
-
- /*
- MAKE_STD_ZVAL(pval);
- pval->type = IS_LONG;
- pval->value.lval = Ns_InfoBootTime();
- zend_hash_update(&EG(symbol_table), "SERVER_BOOTTIME", sizeof("SERVER_BOOTTIME"), &pval, sizeof(zval *), NULL);
- */
-}
-
-/*
- * php_roxen_module_main() is called by the per-request handler and
- * "executes" the script
- */
-
-static int php_roxen_module_main(TSRMLS_D)
-{
- int res, len;
- char *dir;
- zend_file_handle file_handle;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = THIS->filename;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
- THREADS_ALLOW();
- res = php_request_startup(TSRMLS_C);
- THREADS_DISALLOW();
- if(res == FAILURE) {
- return 0;
- }
- php_roxen_hash_environment(TSRMLS_C);
- THREADS_ALLOW();
- php_execute_script(&file_handle TSRMLS_CC);
- php_request_shutdown(NULL);
- THREADS_DISALLOW();
- return 1;
-}
-
-/*
- * The php_roxen_request_handler() is called per request and handles
- * everything for one request.
- */
-
-void f_php_roxen_request_handler(INT32 args)
-{
- struct object *my_fd_obj;
- struct mapping *request_data;
- struct svalue *done_callback, *raw_fd;
- struct pike_string *script, *ind;
- int status = 1;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- TSRMLS_FETCH();
-
- if(current_thread == th_self())
- php_error(E_WARNING, "PHP4.Interpreter->run: Tried to run a PHP-script from a PHP "
- "callback!");
- get_all_args("PHP4.Interpreter->run", args, "%S%m%O%*", &script,
- &request_data, &my_fd_obj, &done_callback);
- if(done_callback->type != PIKE_T_FUNCTION)
- php_error(E_WARNING, "PHP4.Interpreter->run: Bad argument 4, expected function.\n");
- PHP_LOCK(THIS); /* Need to lock here or reusing the same object might cause
- * problems in changing stuff in that object */
-#ifndef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- THIS->request_data = request_data;
- THIS->my_fd_obj = my_fd_obj;
- THIS->filename = script->str;
- current_thread = th_self();
- SG(request_info).query_string = lookup_string_header("QUERY_STRING", 0);
- SG(server_context) = (void *)1; /* avoid server_context == NULL */
-
- /* path_translated is apparently the absolute path to the file, not
- the translated PATH_INFO
- */
- SG(request_info).path_translated =
- lookup_string_header("SCRIPT_FILENAME", NULL);
- SG(request_info).request_uri = lookup_string_header("DOCUMENT_URI", NULL);
- if(!SG(request_info).request_uri)
- SG(request_info).request_uri = lookup_string_header("SCRIPT_NAME", NULL);
- SG(request_info).request_method = lookup_string_header("REQUEST_METHOD", "GET");
- SG(request_info).content_length = lookup_integer_header("HTTP_CONTENT_LENGTH", 0);
- SG(request_info).content_type = lookup_string_header("HTTP_CONTENT_TYPE", NULL);
- SG(sapi_headers).http_response_code = 200;
-
- /* FIXME: Check for auth stuff needs to be fixed... */
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
-
- ind = make_shared_binary_string("my_fd", 5);
- raw_fd = low_mapping_string_lookup(THIS->request_data, ind);
- if(raw_fd && raw_fd->type == PIKE_T_OBJECT)
- {
- int fd = fd_from_object(raw_fd->u.object);
- if(fd == -1)
- php_error(E_WARNING, "PHP4.Interpreter->run: my_fd object not open or not an FD.\n");
- THIS->my_fd = fd;
- } else
- THIS->my_fd = 0;
-
- status = php_roxen_module_main(TSRMLS_C);
- current_thread = -1;
-
- apply_svalue(done_callback, 0);
- pop_stack();
- pop_n_elems(args);
- push_int(status);
- PHP_UNLOCK(THIS);
-}
-
-
-/* Clear the object global struct */
-static void clear_struct(struct object *o)
-{
- MEMSET(Pike_fp->current_storage, 0, sizeof(php_roxen_request));
-}
-
-
-/*
- * pike_module_init() is called by Pike once at startup
- *
- * This functions allocates basic structures
- */
-
-void pike_module_init( void )
-{
- if (!roxen_php_initialized) {
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
-#ifdef ROXEN_USE_ZTS
- ts_allocate_id(&roxen_globals_id, sizeof(php_roxen_request), NULL, NULL);
-#endif
-#endif
- sapi_startup(&roxen_sapi_module);
- /*php_roxen_startup(&roxen_sapi_module); removed - should be called from SAPI activation*/
- roxen_php_initialized = 1;
- PHP_INIT_LOCK();
- }
- start_new_program(); /* Text */
- ADD_STORAGE(php_roxen_request);
- set_init_callback(clear_struct);
- pike_add_function("run", f_php_roxen_request_handler,
- "function(string, mapping, object, function:int)", 0);
- add_program_constant("Interpreter", (php_program = end_program()), 0);
-}
-
-/*
- * pike_module_exit() performs the last steps before the
- * server exists. Shutdowns basic services and frees memory
- */
-
-void pike_module_exit(void)
-{
- roxen_php_initialized = 0;
- roxen_sapi_module.shutdown(&roxen_sapi_module);
- if(php_program) free_program(php_program);
-#ifdef ZTS
- tsrm_shutdown();
-#endif
- PHP_DESTROY();
-}
-#endif
diff --git a/sapi/servlet/CREDITS b/sapi/servlet/CREDITS
deleted file mode 100644
index ae4e83e1e2..0000000000
--- a/sapi/servlet/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Java Servlet
-Sam Ruby
diff --git a/sapi/servlet/EXPERIMENTAL b/sapi/servlet/EXPERIMENTAL
deleted file mode 100644
index 293159a693..0000000000
--- a/sapi/servlet/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this module is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/sapi/servlet/Makefile.frag b/sapi/servlet/Makefile.frag
deleted file mode 100644
index 3ad40f86ac..0000000000
--- a/sapi/servlet/Makefile.frag
+++ /dev/null
@@ -1,19 +0,0 @@
-
-sapi/servlet/java.c : sapi/servlet/../../ext/java/java.c sapi/servlet/phpsrvlt.jar
- @cp sapi/servlet/../../ext/java/java.c sapi/servlet
-
-sapi/servlet/phpsrvlt.jar : sapi/servlet/servlet.java sapi/servlet/../../ext/java/reflect.java
- $(mkinstalldirs) sapi/servlet/net/php
- @echo library=php4 > sapi/servlet/net/php/reflect.properties
- @echo library=php4 > sapi/servlet/net/php/servlet.properties
- @cp sapi/servlet/formatter.java sapi/servlet/net/php
- @cp sapi/servlet/servlet.java sapi/servlet/net/php
- @cp sapi/servlet/../../ext/java/reflect.java sapi/servlet/net/php
- cd sapi/servlet && javac net/php/reflect.java
- @test ! -f sapi/servlet/reflect.class || mv sapi/servlet/reflect.class sapi/servlet/net/php # bug in KJC javac
- cd sapi/servlet && javac -classpath .:$(SERVLET_CLASSPATH):$(CLASSPATH):. net/php/servlet.java
- @test ! -f sapi/servlet/servlet.class || mv sapi/servlet/servlet.class sapi/servlet/net/php # bug in KJC javac
- cd sapi/servlet && javac -classpath .:$(SERVLET_CLASSPATH):$(CLASSPATH):. net/php/formatter.java
- @test ! -f sapi/servlet/formatter.class || mv sapi/servlet/formatter.class sapi/servlet/net/php # bug in KJC javac
- cd sapi/servlet/ && $(JAVA_JAR) phpsrvlt.jar net/php/*.class net/php/*.properties
- @rm -rf sapi/servlet/net
diff --git a/sapi/servlet/README b/sapi/servlet/README
deleted file mode 100644
index be874d28c1..0000000000
--- a/sapi/servlet/README
+++ /dev/null
@@ -1,113 +0,0 @@
-Java Servlet SAPI Module for PHP 4
-
-
- Introduction
-
- The Java Servlet SAPI Module allows for the execution of PHP 4 as
- a Servlet from within a Java Servlet Engine, such as Apache's
- Jakarta Tomcat [1]. It builds upon the mechanism defined by PHP's
- Java Extension, which can be found in /php4/ext/java.
-
- The primary advantage of this from a PHP perspective is that web
- servers which support servlets typically take great care in
- pooling and reusing Java Virtual Machines (JVMs).
-
- PHP may also be bridged with the Apache Cocoon XML Publishing
- Framework. [2]
-
- A suitably configured system will invoke the PHP binaries through
- JNI and the output of the page will be processed through the
- configured XML parser and placed into the pipeline for processing
- by such filters as XSLT. This enables PHP developers to access the
- powers of Cocoon to separate their content, style, and logic
- without requiring them to write a single line of Java code.
-
- While this code is intended to be able to run on any servlet
- engine, it has only been tested on Apache's Jakarta Tomcat to
- date. Bug reports, success stories and/or patches required to get
- this code to run on other engines would be appreciated; please
- send them to the PHP Development Mailinglist [3].
-
- Note: PHP has a habit of changing the working directory. The Java
- Servlet SAPI Module will eventually change it back, but while PHP
- is running the servlet engine may not be able to load any classes
- from the CLASSPATH which are specified using a relative directory
- syntax, or find the work directory used for administration and JSP
- compilation tasks.
-
-
- Installing PHP as a Servlet into Apache's Jakarta Tomcat [*]
-
- 1.) Build the PHP 4 Java Servlet SAPI Module
-
- The javax.servlet package should be in your CLASSPATH. If you're
- using Tomcat, adding servlet.jar to your CLASSPATH is sufficient.
-
- UNIX
-
- o ./configure --with-servlet --with-java
-
- o Add directory containing libphp4.so to LD_LIBRARY_PATH.
-
- Windows
-
- o Build ext/java/java.dsp, copy php_java.dll to your
- extension_dir directory and enable the extension in the
- php.ini.
-
- o Build sapi/servlet/servlet.dsp.
-
- o Add the directory containing php4ts.dll and phpsrvlt.dll to
- the PATH environment variable.
-
- 2.) Copy phpsrvlt.jar into your $TOMCAT_HOME/shared/lib directory.
-
- 3.) Merge the configuration directives from web.xml file that
- comes with the Java Servlet SAPI Module into your
- $TOMCAT_HOME/conf/web.xml configuration file.
-
- Make sure that the element ordering of the web.xml is legal
- with Tomcat and put all the <servlet> declarations first,
- followed by all the <servlet-mapping> declarations.
-
- Add
-
- <welcome-file>index.php</welcome-file>
-
- to the
-
- <welcome-file-list>
- ...
- </welcome-file-list>
-
- block of your $TOMCAT_HOME/conf/web.xml configuration file.
-
- 4.) Test your installation by creating a test.php file in your
- $TOMCAT_HOME/webapps/ROOT directory with
-
- <?php phpinfo(); ?>
-
- in it.
-
- Access this file in your browser at
-
- http://localhost:8080/test.php
-
- and you should see the familiar output of phpinfo().
-
-
- Installing PHP as a Generator into Apache's Cocoon2 Framework
-
- 1.) Build the Java Servlet SAPI Module as described above.
-
- 2.) Get the Cocoon2 source tree, either by CVS or from a release
- archive; a binary distribution does not suffice. Copy the
- phpsrvlet.jar file into your xml-cocoon2/lib/optional directory
- and build Cocoon.
-
---
- [*] The instructions herein have been tested with Tomcat 4.1.12.
-
- [1] http://jakarta.apache.org/tomcat/
- [2] http://xml.apache.org/cocoon2/
- [3] http://www.php.net/support.php
diff --git a/sapi/servlet/config.m4 b/sapi/servlet/config.m4
deleted file mode 100644
index 05ebd70fad..0000000000
--- a/sapi/servlet/config.m4
+++ /dev/null
@@ -1,54 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_MSG_CHECKING(for Servlet support)
-AC_ARG_WITH(servlet,
-[ --with-servlet[=DIR] Include servlet support. DIR is the base install
- directory for the JSDK. This SAPI prereqs the
- java extension must be built as a shared dl.],
-[
- if test "$withval" != "no"; then
-
- if test "$withval" = "yes"; then
- SERVLET_CLASSPATH=.
- else
- if test -f $withval/lib/servlet.jar; then
- SERVLET_CLASSPATH=$withval/lib/servlet.jar
- fi
-
- if test -f $withval/lib/jsdk.jar; then
- SERVLET_CLASSPATH=$withval/lib/jsdk.jar
- fi
-
- if test -d $withval/javax; then
- SERVLET_CLASSPATH=$withval
- fi
-
- if test -z "$SERVLET_CLASSPATH"; then
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(unable to find servlet libraries)
- fi
- fi
-
- AC_DEFINE(SAPI_SERVLET, 1, [Whether you use Servlet])
-
- INSTALL_IT="\$(mkinstalldirs) \$(libdir)"
- INSTALL_IT="$INSTALL_IT; \$(INSTALL) -m 0755 \$(top_srcdir)/sapi/servlet/phpsrvlt.jar \$(libdir)"
- INSTALL_IT="$INSTALL_IT; \$(INSTALL) -m 0755 $SAPI_SHARED \$(libdir)"
- PHP_SAPI=servlet
- PHP_BUILD_THREAD_SAFE
- EXTRA_INCLUDES="$EXTRA_INCLUDES \$(JAVA_INCLUDE)"
- PHP_SELECT_SAPI(servlet, shared, servlet.c)
- PHP_ADD_SOURCES(/sapi/servlet, java.c,, sapi)
- PHP_ADD_MAKEFILE_FRAGMENT(sapi/servlet/Makefile.frag)
-
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-
-PHP_SUBST(SERVLET_CLASSPATH)
diff --git a/sapi/servlet/cookies.php b/sapi/servlet/cookies.php
deleted file mode 100644
index bcc4c40aae..0000000000
--- a/sapi/servlet/cookies.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<html>
-<body bgcolor="white">
-<head>
-<title>Cookies Example</title>
-</head>
-<body>
-<h3>Cookies Example</h3>
-
-<?
- $cookies = $request->cookies;
-
- // print out cookies
-
- if (!current($cookies)) {
- echo "Your browser isn't sending any cookies\n";
- } else {
- echo "Your browser is sending the following cookies:<br>\n";
-
- foreach ($cookies as $cookie) {
- echo "Cookie Name: $cookie->name<br>Cookie value: $cookie->value<br>\n";
- }
- }
-
- // set a cookie
-
- if ($cookieName) {
- $response->addCookie(new Java("javax.servlet.http.Cookie", $cookieName, $cookieValue));
- echo "<p>You just sent the following cookie to your browser:<br>\n";
- echo "Name: $cookieName<br>Value: $cookieValue<P>\n";
- }
-
-?>
-<P>
-Create a cookie to send to your browser<br>
-<form action="<?PHP echo $PHP_SELF ?>" method=POST>
-Name: <input type=text length=20 name=cookieName><br>
-Value: <input type=text length=20 name=cookieValue><br>
-<input type=submit></form>
-</body>
-</html>
-
diff --git a/sapi/servlet/date.php b/sapi/servlet/date.php
deleted file mode 100644
index 1146d31fab..0000000000
--- a/sapi/servlet/date.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<html>
-<!--
- Copyright (c) 1999 The Apache Software Foundation. All rights
- reserved.
--->
-
-<body bgcolor="white">
-<?php $clock=new Java("dates.JspCalendar"); ?>
-
-<font size=4>
-<ul>
-<li> Day of month: is <?php echo $clock->dayOfMonth ?>
-<li> Year: is <?php echo $clock->year ?>
-<li> Month: is <?php echo $clock->month ?>
-<li> Time: is <?php echo $clock->time ?>
-<li> Date: is <?php echo $clock->date ?>
-<li> Day: is <?php echo $clock->day ?>
-<li> Day Of Year: is <?php echo $clock->dayOfYear ?>
-<li> Week Of Year: is <?php echo $clock->weekOfYear ?>
-<li> era: is <?php echo $clock->era ?>
-<li> DST Offset: is <?php echo $clock->dSTOffset ?>
-<li> Zone Offset: is <?php echo $clock->zoneOffset ?>
-</ul>
-</font>
-
-</body>
-</html>
-
diff --git a/sapi/servlet/formatter.java b/sapi/servlet/formatter.java
deleted file mode 100644
index 46c8c3a6e1..0000000000
--- a/sapi/servlet/formatter.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2002 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-package net.php;
-
-import javax.servlet.*;
-import javax.servlet.http.*;
-
-public class formatter extends servlet {
- public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException {
- display_source_mode = true;
- super.service(request, response);
- }
-}
diff --git a/sapi/servlet/jinfo.php b/sapi/servlet/jinfo.php
deleted file mode 100644
index f20bbfb27d..0000000000
--- a/sapi/servlet/jinfo.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?
-
- phpinfo();
-
-?>
diff --git a/sapi/servlet/jver.php b/sapi/servlet/jver.php
deleted file mode 100644
index e5e029c6e4..0000000000
--- a/sapi/servlet/jver.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<html>
-<?
-
- $system = new Java("java.lang.System");
- print "Java version=".$system->getProperty("java.version")." <br>\n";
- print "Java vendor=".$system->getProperty("java.vendor")." <p>\n\n";
- print "OS=".$system->getProperty("os.name")." ".
- $system->getProperty("os.version")." on ".
- $system->getProperty("os.arch")." <br>\n";
-
- $formatter = new Java("java.text.SimpleDateFormat",
- "EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz");
-
- print $formatter->format(new Java("java.util.Date"))."\n";
-
-?>
-</html>
diff --git a/sapi/servlet/reqheaders.php b/sapi/servlet/reqheaders.php
deleted file mode 100644
index db04aed3dc..0000000000
--- a/sapi/servlet/reqheaders.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<html>
-<body bgcolor="white">
-<head>
-<title>Request Header Example</title>
-</head>
-<body>
-<h3>Request Header Example</h3>
-<table border=0>
-
-<?php
-
- $e = $request->headerNames;
- while ($e->hasMoreElements()) {
- $name = $e->nextElement();
- $value = $request->getHeader($name);
- print "<tr><td bgcolor=\"#CCCCCC\">$name\n";
- print "</td><td>$value</td></tr>\n";
- }
-
-?>
-
-</table>
-</body>
-</html>
diff --git a/sapi/servlet/reqinfo.php b/sapi/servlet/reqinfo.php
deleted file mode 100644
index 37d453baf9..0000000000
--- a/sapi/servlet/reqinfo.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<html>
-<body>
-<head>
-<title>Request Information Example</title>
-</head>
-<body bgcolor="white">
-<h3>Request Information Example</h3>
-<table border=0><tr><td>
-Method:
-</td><td>
-<?php print $request->method ?>
-</td></tr><tr><td>
-Request URI:
-</td><td>
-<?php print $request->requestURI ?>
-</td></tr><tr><td>
-Protocol:
-</td><td>
-<?php print $request->protocol ?>
-</td></tr><tr><td>
-Path Info:
-</td><td>
-<?php print $request->pathInfo ?>
-</td></tr><tr><td>
-Remote Address:
-</td><td>
-<?php print $request->remoteAddr ?>
-</table>
-
diff --git a/sapi/servlet/reqparams.php b/sapi/servlet/reqparams.php
deleted file mode 100644
index f968b2753d..0000000000
--- a/sapi/servlet/reqparams.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<html>
-<body>
-<head>
-<title>Request Parameters Example</title>
-</head>
-<body bgcolor="white">
-<h3>Request Parameters Example</h3>
-Parameters in this request:<br>
-<?php
- $e = $request->getParameterNames();
-
- if (!$e->hasMoreElements()) {
- echo "No Parameters, Please enter some";
- }
-
- while ($e->hasMoreElements()) {
- $name = $e->nextElement();
- $value = $request->getParameter($name);
- echo "$name = $value<br>\n";
- }
-
-?>
-<P>
-<form action="<?php echo $PHP_SELF ?>" method=POST>
-First Name:
-<input type=text size=20 name=firstname>
-<br>
-Last Name:
-<input type=text size=20 name=lastname>
-<br>
-<input type=submit>
-</form>
-</body>
-</html>
-
diff --git a/sapi/servlet/servlet.c b/sapi/servlet/servlet.c
deleted file mode 100644
index 5d859e53a3..0000000000
--- a/sapi/servlet/servlet.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
-*/
-
-#include <jni.h>
-
-#include "php.h"
-#include "php_globals.h"
-
-#include "SAPI.h"
-
-#include <stdio.h>
-#include "php.h"
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#include "win32/signal.h"
-#include <process.h>
-#endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#if HAVE_SETLOCALE
-#include <locale.h>
-#endif
-#include "zend.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "php_main.h"
-#include "fopen_wrappers.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/php_dir.h"
-#ifdef PHP_WIN32
-#include <io.h>
-#include <fcntl.h>
-#include "win32/php_registry.h"
-#endif
-
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setEnv
- (JNIEnv *newJenv, jclass self TSRMLS_DC);
-
-typedef struct {
- JNIEnv *jenv;
- jobject servlet;
- char *cookies;
-} servlet_request;
-
-extern zend_module_entry java_module_entry;
-
-/***************************************************************************/
-
-/*
- * JNI convenience utilities
- */
-
-#define SETSTRING(target, source) \
- { const char *UTFString; \
- if (source) { \
- UTFString = (*jenv)->GetStringUTFChars(jenv, source, 0); \
- target = estrdup(UTFString); \
- (*jenv)->ReleaseStringUTFChars(jenv, source, UTFString); \
- } else { \
- target = 0; \
- } }
-
-#define FREESTRING(target) \
- { if (target) { efree(target); target=0; } }
-
-void ThrowIOException (JNIEnv *jenv, char *msg) {
- jclass iox = (*jenv)->FindClass (jenv, "java/io/IOException");
- (*jenv)->ThrowNew (jenv, iox, (msg?msg:"null") );
-}
-
-void ThrowServletException (JNIEnv *jenv, char *msg) {
- jclass sx = (*jenv)->FindClass (jenv, "javax/servlet/ServletException");
- (*jenv)->ThrowNew (jenv, sx, msg);
-}
-
-/***************************************************************************/
-
-/*
- * sapi callbacks
- */
-
-static int sapi_servlet_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- if (!SG(server_context)) {
- fprintf(stderr, "%s", str);
- return 0;
- }
-
- {
- JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv;
- jobject servlet = ((servlet_request*)SG(server_context))->servlet;
-
- jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet);
- jmethodID write = (*jenv)->GetMethodID(jenv, servletClass, "write",
- "(Ljava/lang/String;)V");
- char *copy = malloc(str_length+1);
- jstring arg;
- memcpy(copy, str, str_length);
- copy[str_length] = 0;
- arg=(*jenv)->NewStringUTF(jenv, copy);
- free(copy);
- (*jenv)->CallVoidMethod(jenv, servlet, write, arg);
- (*jenv)->DeleteLocalRef(jenv, arg);
- return str_length;
- }
-}
-
-
-static void sapi_servlet_send_header(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC)
-{
- if (!sapi_header) return;
- if (!SG(server_context)) return;
-
- {
- JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv;
- jobject servlet = ((servlet_request*)SG(server_context))->servlet;
-
- jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet);
- jmethodID header = (*jenv)->GetMethodID(jenv, servletClass, "header",
- "(Ljava/lang/String;)V");
- jstring arg=(*jenv)->NewStringUTF(jenv, sapi_header->header);
- (*jenv)->CallVoidMethod(jenv, servlet, header, arg);
- (*jenv)->DeleteLocalRef(jenv, arg);
- }
-}
-
-
-static int sapi_servlet_read_post(char *buffer, uint count_bytes TSRMLS_DC)
-{
- if (count_bytes == 0) {
- return 0;
- } else {
- JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv;
- jobject servlet = ((servlet_request*)SG(server_context))->servlet;
-
- jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet);
- jmethodID readPost = (*jenv)->GetMethodID(jenv, servletClass,
- "readPost", "(I)Ljava/lang/String;");
- jstring post = (*jenv)->CallObjectMethod(jenv, servlet, readPost,
- count_bytes);
-
- const char *postAsUTF = (*jenv)->GetStringUTFChars(jenv, post, 0);
- uint read_bytes=(*jenv)->GetStringLength(jenv, post);
- if (read_bytes>count_bytes) read_bytes=count_bytes;
-
- memcpy(buffer, postAsUTF, read_bytes);
- if (read_bytes<count_bytes) buffer[read_bytes]=0;
-
- (*jenv)->ReleaseStringUTFChars(jenv, post, postAsUTF);
-
- return read_bytes;
- }
-}
-
-
-static char *sapi_servlet_read_cookies(TSRMLS_D)
-{
- JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv;
- jobject servlet = ((servlet_request*)SG(server_context))->servlet;
-
- jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet);
- jmethodID readCookies = (*jenv)->GetMethodID(jenv, servletClass,
- "readCookies", "()Ljava/lang/String;");
- jstring cookies = (*jenv)->CallObjectMethod(jenv, servlet, readCookies);
-
- SETSTRING( ((servlet_request*)SG(server_context))->cookies, cookies);
-
- return ((servlet_request*)SG(server_context))->cookies;
-}
-
-/***************************************************************************/
-
-
-/*
- * sapi maintenance
- */
-
-static int php_servlet_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-static sapi_module_struct servlet_sapi_module = {
- "java_servlet", /* name */
- "Java Servlet", /* pretty name */
-
- php_servlet_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- sapi_servlet_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- NULL, /* header handler */
- NULL, /* send headers handler */
- sapi_servlet_send_header, /* send header handler */
-
- sapi_servlet_read_post, /* read POST data */
- sapi_servlet_read_cookies, /* read Cookies */
-
- NULL, /* register server variables */
- NULL, /* Log message */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-
-JNIEXPORT void JNICALL Java_net_php_servlet_startup
- (JNIEnv *jenv, jobject self)
-{
-
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
-#endif
-
- sapi_startup(&servlet_sapi_module);
-
- if (php_module_startup(&servlet_sapi_module, &java_module_entry, 1)==FAILURE) {
- ThrowServletException(jenv,"module startup failure");
- return;
- }
-}
-
-
-JNIEXPORT void JNICALL Java_net_php_servlet_shutdown
- (JNIEnv *jenv, jobject self)
-{
- TSRMLS_FETCH();
-
- php_module_shutdown(TSRMLS_C);
-#ifdef ZTS
- tsrm_shutdown();
-#endif
- return;
-}
-
-/***************************************************************************/
-
-/*
- * define a Java object to PHP
- */
-
-JNIEXPORT jlong JNICALL Java_net_php_servlet_define
- (JNIEnv *jenv, jobject self, jstring name)
-{
- pval *pzval;
- jlong addr = 0;
- const char *nameAsUTF = (*jenv)->GetStringUTFChars(jenv, name, 0);
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(pzval);
- addr = (jlong)(long) pzval;
-
- zend_hash_add(&EG(symbol_table), (char*)nameAsUTF,
- strlen(nameAsUTF)+1, &pzval, sizeof(pval *), NULL);
- (*jenv)->ReleaseStringUTFChars(jenv, name, nameAsUTF);
-
- return addr;
-}
-
-/*
- * execute a script
- */
-
-JNIEXPORT void JNICALL Java_net_php_servlet_send
- (JNIEnv *jenv, jobject self,
- jstring requestMethod, jstring queryString,
- jstring requestURI, jstring pathTranslated,
- jstring contentType, jint contentLength,
- jstring authUser, jboolean display_source_mode)
-{
- zend_file_handle file_handle;
- int retval;
-#ifndef VIRTUAL_DIR
- char cwd[MAXPATHLEN];
-#endif
- TSRMLS_FETCH();
-
- zend_first_try {
- SG(server_context) = emalloc(sizeof(servlet_request));
- ((servlet_request*)SG(server_context))->jenv=jenv;
- ((servlet_request*)SG(server_context))->servlet=self;
- ((servlet_request*)SG(server_context))->cookies=0;
-
- /*
- * Initialize the request
- */
-
- SETSTRING( SG(request_info).auth_user, authUser );
- SETSTRING( SG(request_info).request_method, requestMethod );
- SETSTRING( SG(request_info).query_string, queryString );
- SETSTRING( SG(request_info).request_uri, requestURI );
- SETSTRING( SG(request_info).content_type, contentType );
- SG(sapi_headers).http_response_code = 200;
- SG(request_info).content_length = contentLength;
- SG(request_info).auth_password = NULL;
- if (php_request_startup(TSRMLS_C)==FAILURE) {
- ThrowServletException(jenv,"request startup failure");
- return;
- }
-
- /*
- * Parse the file
- */
- SETSTRING( SG(request_info).path_translated, pathTranslated );
-#ifdef VIRTUAL_DIR
- retval = php_fopen_primary_script(&file_handle TSRMLS_CC);
-#else
- /*
- * The java runtime doesn't like the working directory to be
- * changed, so save it and change it back as quickly as possible
- * in the hopes that Java doesn't notice.
- */
- getcwd(cwd, MAXPATHLEN);
- retval = php_fopen_primary_script(&file_handle TSRMLS_CC);
- chdir(cwd);
-#endif
-
- if (retval == FAILURE) {
- php_request_shutdown((void *) 0);
- php_module_shutdown(TSRMLS_C);
- ThrowIOException(jenv, file_handle.filename);
- return;
- }
-
- /*
- * Execute the request
- */
- Java_net_php_reflect_setEnv(jenv, 0 TSRMLS_CC);
-
- if (display_source_mode) {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- if (open_file_for_scanning(&file_handle TSRMLS_CC)==SUCCESS) {
- php_get_highlight_struct(&syntax_highlighter_ini);
- sapi_send_headers(TSRMLS_C);
- zend_highlight(&syntax_highlighter_ini TSRMLS_CC);
- }
- } else {
- php_execute_script(&file_handle TSRMLS_CC);
- php_header(TSRMLS_C); /* Make sure headers have been sent */
- }
-
- /*
- * Clean up
- */
-
- FREESTRING(SG(request_info).query_string);
- FREESTRING(SG(request_info).request_uri);
- FREESTRING(SG(request_info).path_translated);
- FREESTRING(((servlet_request*)SG(server_context))->cookies);
- efree(SG(server_context));
- SG(server_context)=0;
-
- if (!display_source_mode) php_request_shutdown((void *) 0);
- } zend_catch {
- ThrowServletException(jenv,"bailout");
- } zend_end_try();
-}
-
diff --git a/sapi/servlet/servlet.dsp b/sapi/servlet/servlet.dsp
deleted file mode 100644
index 4691b87e31..0000000000
--- a/sapi/servlet/servlet.dsp
+++ /dev/null
@@ -1,286 +0,0 @@
-# Microsoft Developer Studio Project File - Name="servlet" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=servlet - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "servlet.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "servlet.mak" CFG="servlet - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "servlet - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "servlet - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "servlet - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "servlet - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "servlet - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release"
-# PROP BASE Intermediate_Dir "..\..\Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /machine:I386 /out:"..\..\Release/phpsrvlt.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug"
-# PROP BASE Intermediate_Dir "..\..\Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /debug /machine:I386 /out:"..\..\Debug/phpsrvlt.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug_TS"
-# PROP BASE Intermediate_Dir "..\..\Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\TSRM" /I "..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /D "ZTS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /debug /machine:I386 /out:"..\..\Debug_TS/phpsrvlt.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release_TS"
-# PROP BASE Intermediate_Dir "..\..\Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\TSRM" /I "..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /D "ZTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /machine:I386 /out:"..\..\Release_TS/phpsrvlt.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "servlet - Win32 Release"
-# Name "servlet - Win32 Debug"
-# Name "servlet - Win32 Debug_TS"
-# Name "servlet - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\ext\rpc\java\java.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\servlet.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Java Files"
-
-# PROP Default_Filter "java"
-# Begin Source File
-
-SOURCE=.\servlet.java
-
-!IF "$(CFG)" == "servlet - Win32 Release"
-
-USERDEP__SERVL="..\..\ext\rpc\java\reflect.java"
-# Begin Custom Build
-OutDir=.\..\..\Release
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy *.java net\php > nul
- copy ..\..\ext\rpc\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- cd net\php
- $(JAVA_HOME)\bin\javac -O *.java
- cd ..\..
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\formatter.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug"
-
-USERDEP__SERVL="..\..\ext\rpc\java\reflect.java"
-# Begin Custom Build
-OutDir=.\..\..\Debug
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy *.java net\php > nul
- copy ..\..\ext\rpc\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- cd net\php
- $(JAVA_HOME)\bin\javac -g *.java
- cd ..\..
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\formatter.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug_TS"
-
-USERDEP__SERVL="..\..\ext\rpc\java\reflect.java"
-# Begin Custom Build
-OutDir=.\..\..\Debug_TS
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy *.java net\php > nul
- copy ..\..\ext\rpc\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- cd net\php
- $(JAVA_HOME)\bin\javac -g *.java
- cd ..\..
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\formatter.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Release_TS"
-
-USERDEP__SERVL="..\..\ext\rpc\java\reflect.java"
-# Begin Custom Build
-OutDir=.\..\..\Release_TS
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy *.java net\php > nul
- copy ..\..\ext\rpc\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- cd net\php
- $(JAVA_HOME)\bin\javac -O *.java
- cd ..\..
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\formatter.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\servlet.java
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\jtest.php
-# End Source File
-# End Target
-# End Project
diff --git a/sapi/servlet/servlet.java b/sapi/servlet/servlet.java
deleted file mode 100644
index 8cfbc29406..0000000000
--- a/sapi/servlet/servlet.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2002 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-package net.php;
-
-import java.io.IOException;
-import java.net.URLEncoder;
-import java.util.Enumeration;
-import javax.servlet.*;
-import javax.servlet.http.*;
-
-import java.lang.reflect.Method;
-
-public class servlet extends HttpServlet {
- char slash = System.getProperty("file.separator").charAt(0);
-
- HttpServletRequest request;
- HttpServletResponse response;
- ServletInputStream stream;
-
- static int startup_count = 0;
-
- protected boolean display_source_mode = false;
- private Method addHeader;
-
- // Native methods
-
- public native void startup();
- public native long define(String name);
- public native void send(String requestMethod,
- String queryString,
- String pathInfo,
- String pathTranslated,
- String contentType,
- int contentLength,
- String authUser,
- boolean display_source_mode
- );
- public native void shutdown();
-
- // SAPI Callbacks
-
- public String readPost(int bytes) {
- String result;
-
- if (!request.getMethod().equals("POST")) {
- result = request.getQueryString();
- } else {
- Enumeration enum = request.getParameterNames();
- String concat = "";
- result = "";
-
- while (enum.hasMoreElements()) {
- String name = (String)enum.nextElement();
- String value = request.getParameter(name);
-
- try {
- result += concat + name + "=" + URLEncoder.encode(value, "UTF-8");
- }
-
- catch (Exception e) {
- e.printStackTrace(System.err);
- }
-
- concat = "&";
- }
- }
-
- if (result == null) return "";
-
- return result;
- }
-
- public String readCookies() {
- reflect.setResult(define("request"), request);
- reflect.setResult(define("response"), response);
- reflect.setResult(define("PHP_SELF"), request.getRequestURI());
-
- return request.getHeader("cookie");
- }
-
- public void header(String data) {
- // try to send the header using the most specific servlet API
- // as possible (some servlet engines will add a content type
- // header unless the setContentType method is called).
- try {
- if (data.startsWith("Content-type: ")) {
- response.setContentType(data.substring(data.indexOf(" ") + 1));
- }
-
- else if (data.startsWith("Location: ")) {
- response.sendRedirect(data.substring(data.indexOf(" ") + 1));
- } else if (data.startsWith("HTTP/1")) {
- return; // this one is added from servlet container (Tomcat 4.1), we have to check for others
- }
-
- else {
- int colon = data.indexOf(": ");
-
- if (colon > 0) {
- try {
- addHeader.invoke(response, new Object[]
- { data.substring(0, colon), data.substring(colon + 2) } );
- }
-
- catch (Exception e) {
- e.printStackTrace(System.err);
- }
- }
-
- else {
- write(data);
- }
- }
- }
-
- catch (IOException e) {
- e.printStackTrace(System.err);
- }
- }
-
- public void write(String data) {
- try {
- response.getWriter().print(data);
- }
-
- catch (IOException e) {
- e.printStackTrace(System.err);
- }
- }
-
- // Servlet interface
-
- public void init(ServletConfig config)
- throws ServletException {
- super.init(config);
-
- // first time in, initialize native code
- if (0 == startup_count++) {
- reflect.loadLibrary("servlet");
- startup();
- }
-
- // try to find the addHeader method (added in the servlet API 2.2)
- // otherwise settle for the setHeader method
-
- try {
- Class c = Class.forName("javax.servlet.http.HttpServletResponse");
- Method method[] = c.getDeclaredMethods();
-
- for (int i = 0; i < method.length; i++) {
- if (method[i].getName().equals("addHeader")) {
- addHeader = method[i];
- break;
- }
-
- if (method[i].getName().equals("setHeader")) {
- addHeader = method[i];
- }
- }
- }
-
- catch (Exception e) {
- e.printStackTrace(System.err);
- }
- }
-
- public void service(HttpServletRequest request, HttpServletResponse response, String contextPath)
- throws ServletException {
- this.request = request;
- this.response = response;
-
- send(request.getMethod(),
- request.getQueryString(),
- request.getRequestURI(),
- contextPath,
- request.getContentType(),
- request.getContentLength(),
- request.getRemoteUser(),
- display_source_mode
- );
-
- try {
- if (stream != null) stream.close();
- }
-
- catch (IOException e) {
- throw new ServletException(e.toString());
- }
- }
-
- public void service(HttpServletRequest request, HttpServletResponse response)
- throws ServletException {
- String servletPath = request.getServletPath();
- String contextPath = getServletContext().getRealPath(servletPath);
-
- service(request, response, contextPath);
- }
-
- public void destroy() {
- if (0 == --startup_count) shutdown();
- super.destroy();
- }
-}
diff --git a/sapi/servlet/sessions.php b/sapi/servlet/sessions.php
deleted file mode 100644
index 463b1b5e92..0000000000
--- a/sapi/servlet/sessions.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<html>
-<body bgcolor="white">
-<head>
-<title>Sessions Example</title>
-</head>
-<body>
-<h3>Sessions Example</h3>
-<?php
-
- // print session info
-
- $session = $request->session;
- $created = new Java("java.util.Date", $session->creationTime);
- $accessed = new Java("java.util.Date", $session->lastAccessedTime);
-
- print "Session ID: $session->id<br>\n";
- print "Created: " . $created->toString() . "<br>\n";
- print "Last Accessed: " . $accessed->toString() . "<br>\n";
-
- // set session info if needed
-
- if ($dataName) $session->setAttribute($dataName, $dataValue);
-
- // print session contents
-
- print "<P>\n";
- print "The following data is in your session:<br>\n";
- $e = $session->attributeNames;
- while ($e->hasMoreElements()) {
- $name = $e->nextElement();
- $value = $session->getAttribute($name);
- print "$name = $value<br>\n";
- }
-
-?>
-<P>
-<form action="<?php echo $PHP_SELF ?>" method=POST>
-Name of Session Attribute:
-<input type=text size=20 name=dataName>
-<br>
-Value of Session Attribute:
-<input type=text size=20 name=dataValue>
-<br>
-<input type=submit>
-</form>
-<P>GET based form:<br>
-<form action="<?php echo $PHP_SELF ?>" method=GET>
-Name of Session Attribute:
-<input type=text size=20 name=dataName>
-<br>
-Value of Session Attribute:
-<input type=text size=20 name=dataValue>
-<br>
-<input type=submit>
-</form>
-<p><a href="<?php echo $PHP_SELF ?>?dataName=foo&dataValue=bar" >URL encoded </a>
-</body>
-</html>
-</body>
-</html>
diff --git a/sapi/servlet/web.xml b/sapi/servlet/web.xml
deleted file mode 100644
index b0703a3614..0000000000
--- a/sapi/servlet/web.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!DOCTYPE web-app
- PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
- "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
-
-<web-app>
- <servlet>
- <servlet-name>
- php
- </servlet-name>
- <servlet-class>
- net.php.servlet
- </servlet-class>
- </servlet>
- <servlet>
- <servlet-name>
- php-formatter
- </servlet-name>
- <servlet-class>
- net.php.formatter
- </servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>
- php
- </servlet-name>
- <url-pattern>
- *.php
- </url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>
- php-formatter
- </servlet-name>
- <url-pattern>
- *.phps
- </url-pattern>
- </servlet-mapping>
-</web-app>
diff --git a/sapi/tests/test001.phpt b/sapi/tests/test001.phpt
deleted file mode 100644
index 2c5d808e66..0000000000
--- a/sapi/tests/test001.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-IIS style CGI missing SCRIPT_FILENAME
---DESCRIPTION--
-This would be similar to what IIS produces for a simple query.
---ENV--
-return <<<END
-PATH_TRANSLATED=$filename
-PATH_INFO=$scriptname
-SCRIPT_NAME=$scriptname
-END;
---CGI--
---FILE--
-<?php
- echo "HELLO";
-?>
---EXPECT--
-HELLO \ No newline at end of file
diff --git a/sapi/tests/test002.phpt b/sapi/tests/test002.phpt
deleted file mode 100644
index e0c51b60e3..0000000000
--- a/sapi/tests/test002.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Apache style CGI
---DESCRIPTION--
-Apache likes to set SCRIPT_FILENAME to the php executable
-if you use ScriptAlias configurations, and the proper
-path is in PATH_TRANSLATED. SCRIPT_NAME in this is faked,
-but that is ok, Apache sets SCRIPT_NAME to the ScriptAlias
-of the executable.
---ENV--
-return <<<END
-REDIRECT_URL=$scriptname
-PATH_TRANSLATED=$filename
-PATH_INFO=$scriptname
-SCRIPT_NAME=/scriptalias/php
-SCRIPT_FILENAME=$this->conf['TEST_PHP_EXECUTABLE']
-END;
---CGI--
---FILE--
-<?php
- echo "HELLO";
-?>
---EXPECT--
-HELLO \ No newline at end of file
diff --git a/sapi/tests/test003.phpt b/sapi/tests/test003.phpt
deleted file mode 100644
index f0a31ab705..0000000000
--- a/sapi/tests/test003.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-IIS style CGI missing SCRIPT_FILENAME, has PATH_INFO
---DESCRIPTION--
-This would be similar to what IIS produces for a simple query
-that also has PATH_INFO.
---REQUEST--
-return <<<END
-PATH_INFO=/path/info
-END;
---ENV--
-return <<<END
-PATH_TRANSLATED=$filename/path/info
-PATH_INFO=$scriptname/path/info
-SCRIPT_NAME=$scriptname
-END;
---CGI--
---FILE--
-<?php
- echo $_SERVER['PATH_INFO'];
-?>
---EXPECT--
-/path/info \ No newline at end of file
diff --git a/sapi/tests/test004.phpt b/sapi/tests/test004.phpt
deleted file mode 100644
index 03e73d3219..0000000000
--- a/sapi/tests/test004.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Apache style CGI with PATH_INFO
---DESCRIPTION--
-Apache likes to set SCRIPT_FILENAME to the php executable
-if you use ScriptAlias configurations, and the proper
-path is in PATH_TRANSLATED. SCRIPT_NAME in this is faked,
-but that is ok, Apache sets SCRIPT_NAME to the ScriptAlias
-of the executable.
---REQUEST--
-return <<<END
-PATH_INFO=/path/info
-END;
---ENV--
-return <<<END
-REDIRECT_URL=$scriptname
-PATH_TRANSLATED=$filename/path/info
-PATH_INFO=$scriptname/path/info
-SCRIPT_NAME=/scriptalias/php
-SCRIPT_FILENAME=$this->conf['TEST_PHP_EXECUTABLE']
-END;
---CGI--
---FILE--
-<?php
- echo $_SERVER['PATH_INFO'];
-?>
---EXPECT--
-/path/info \ No newline at end of file
diff --git a/sapi/tests/test005.phpt b/sapi/tests/test005.phpt
deleted file mode 100644
index ab500eb422..0000000000
--- a/sapi/tests/test005.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-QUERY_STRING Security Bug
---DESCRIPTION--
-This bug was present in PHP 4.3.0 only.
-A failure should print HELLO.
---REQUEST--
-return <<<END
-SCRIPT_NAME=/nothing.php
-QUERY_STRING=$filename
-END;
---ENV--
-return <<<END
-REDIRECT_URL=$scriptname
-PATH_TRANSLATED=c:\apache\1.3.27\htdocs\nothing.php
-QUERY_STRING=$filename
-PATH_INFO=/nothing.php
-SCRIPT_NAME=/phpexe/php.exe/nothing.php
-SCRIPT_FILENAME=c:\apache\1.3.27\htdocs\nothing.php
-END;
---CGI--
---FILE--
-<?php
- echo "HELLO";
-?>
---EXPECTHEADERS--
-Status: 404
---EXPECT--
-No input file specified. \ No newline at end of file
diff --git a/sapi/tests/test006.phpt b/sapi/tests/test006.phpt
deleted file mode 100644
index b674a9f78f..0000000000
--- a/sapi/tests/test006.phpt
+++ /dev/null
@@ -1,75 +0,0 @@
---TEST--
-Multipart Form POST Data
---CGI--
---HEADERS--
-return <<<END
-Content-Type=multipart/form-data; boundary=---------------------------240723202011929
-Content-Length=862
-END;
---ENV--
-return <<<END
-CONTENT_TYPE=multipart/form-data; boundary=---------------------------240723202011929
-CONTENT_LENGTH=862
-END;
---POST--
------------------------------240723202011929
-Content-Disposition: form-data; name="entry"
-
-entry box
------------------------------240723202011929
-Content-Disposition: form-data; name="password"
-
-password box
------------------------------240723202011929
-Content-Disposition: form-data; name="radio1"
-
-test 1
------------------------------240723202011929
-Content-Disposition: form-data; name="checkbox1"
-
-test 1
------------------------------240723202011929
-Content-Disposition: form-data; name="choices"
-
-Choice 1
------------------------------240723202011929
-Content-Disposition: form-data; name="choices"
-
-Choice 2
------------------------------240723202011929
-Content-Disposition: form-data; name="file"; filename="info.php"
-Content-Type: application/octet-stream
-
-<?php
-phpinfo();
-?>
------------------------------240723202011929--
-
---GET--
---FILE--
-<?php
-error_reporting(0);
-print_r($_POST);
-print_r($_FILES);
-?>
---EXPECTF--
-Array
-(
- [entry] => entry box
- [password] => password box
- [radio1] => test 1
- [checkbox1] => test 1
- [choices] => Choice 2
-)
-Array
-(
- [file] => Array
- (
- [name] => info.php
- [type] => application/octet-stream
- [tmp_name] => %s
- [error] => 0
- [size] => 21
- )
-
-)
diff --git a/sapi/tests/test007.phpt b/sapi/tests/test007.phpt
deleted file mode 100644
index b79dfd9fe6..0000000000
--- a/sapi/tests/test007.phpt
+++ /dev/null
@@ -1,48 +0,0 @@
---TEST--
-Multipart Form POST Data, incorrect content length
---CGI--
---HEADERS--
-return <<<END
-Content-Type=multipart/form-data; boundary=---------------------------240723202011929
-Content-Length=100
-END;
---POST--
------------------------------240723202011929
-Content-Disposition: form-data; name="entry"
-
-entry box
------------------------------240723202011929
-Content-Disposition: form-data; name="password"
-
-password box
------------------------------240723202011929
-Content-Disposition: form-data; name="radio1"
-
-test 1
------------------------------240723202011929
-Content-Disposition: form-data; name="checkbox1"
-
-test 1
------------------------------240723202011929
-Content-Disposition: form-data; name="choices"
-
-Choice 1
------------------------------240723202011929
-Content-Disposition: form-data; name="choices"
-
-Choice 2
------------------------------240723202011929
-Content-Disposition: form-data; name="file"; filename="info.php"
-Content-Type: application/octet-stream
-
-<?php
-phpinfo();
-?>
------------------------------240723202011929--
-
---GET--
---FILE--
-<?php
-print @$_POST['choices'];
-?>
---EXPECT--
diff --git a/sapi/thttpd/CREDITS b/sapi/thttpd/CREDITS
deleted file mode 100644
index 8f02f36f4f..0000000000
--- a/sapi/thttpd/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-thttpd
-Sascha Schumann
diff --git a/sapi/thttpd/README b/sapi/thttpd/README
deleted file mode 100644
index 1e80a01956..0000000000
--- a/sapi/thttpd/README
+++ /dev/null
@@ -1,85 +0,0 @@
-README FOR THTTPD MODULE (by Sascha Schumann)
-($Date$)
-
- This is a SAPI module for PHP 4.x supporting thttpd, the tiny,
- turbo, throttling HTTP server by Jef Poskanzer.
-
- NOTE: All HTTP requests will be serialized. That means, one long running
- script will block all other requests. Choose another web server,
- if you want to execute arbitrarily long running scripts.
-
- The module contains a patch against version 2.21b of thttpd. The patch
- fixes a number of bugs and adds some functionality:
-
- - HTTP/1.1 Persistent Connection/Pipeline Support
- - PHP Scripting (**.php by default)
- - Highlighting PHP Scripts (**.phps by default)
- - Fast Accept Loop (unique to PHP)
- - Periodic Connection Expiring (unique to PHP)
- - Log to stdout (logfile=-)
- - Fixes the Host: header vulnerability (affects vhosts only)
- - Asynchronous request body handling (e.g. for POSTs)
- - Accept filter for Linux
- - Fix for non-blocking sending of thttpd-generated responses
-
- You can configure the filename extensions by creating a config file for
- thttpd and setting these entries:
-
- phppat=PATTERN
- phpspat=PATTERN
-
- The PATTERN has the same format as defined here:
-
- http://acme.com/software/thttpd/options.html#CGI_PATTERN
-
- "**.php" means: match any file ending in .php in any directory.
- Setting the pattern from the command line is not supported.
-
- NOTE: This version supports *only* thttpd 2.21b, no prior or later
- version.
-
- This is a functional and stable module (it runs a large application
- like IMP 2.2.0 without any problems). Its original intention was to
- demonstrate the ability of PHP to work in every web server environment.
-
-REQUIRED DOWNLOADS
-
- 1. thttpd 2.21b (2.20 or +2.22beta will _not_ work)
-
- Full Distribution:
- http://www.acme.com/software/thttpd/thttpd-2.21b.tar.gz
-
- 2. PHP 4.x
-
- Download:
- http://www.php.net/
-
- Snapshots from CVS:
- http://snaps.php.net/
-
-
-BUILD INSTRUCTIONS
-
- 1. Extract software packages
-
- $ gunzip -c thttpd-2.xx.tar.gz | tar xf -
- $ gunzip -c php-*.tar.gz | tar xf -
-
- 2. Prepare PHP
-
- $ cd php-*
- $ ./configure \
- --with-thttpd=../thttpd-2.xx \
- <further PHP options>
- $ make install
- $ cd ..
-
- You can see the list of valid PHP options by executing
-
- $ ./configure --help
-
- 3. Configure, compile, install thttpd
-
- Now follow the thttpd instructions. The Makefile template of
- thttpd was changed to automatically use the components
- required by PHP.
diff --git a/sapi/thttpd/config.m4 b/sapi/thttpd/config.m4
deleted file mode 100644
index c73adc333b..0000000000
--- a/sapi/thttpd/config.m4
+++ /dev/null
@@ -1,39 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_ARG_WITH(thttpd,
-[ --with-thttpd=SRCDIR Build PHP as thttpd module],[
- if test ! -d $withval; then
- AC_MSG_RESULT(thttpd directory does not exist ($withval))
- fi
-
- PHP_EXPAND_PATH($withval, THTTPD)
-
- if grep thttpd.2.21b $withval/version.h >/dev/null; then
- patch="test -f $THTTPD/php_patched || \
- (cd $THTTPD && patch -p 1 < $abs_srcdir/sapi/thttpd/thttpd_patch && touch php_patched)"
-
- elif grep Premium $withval/version.h >/dev/null; then
- patch=
- else
- AC_MSG_ERROR([This version only supports thttpd-2.21b and Premium thttpd])
- fi
- PHP_TARGET_RDYNAMIC
- INSTALL_IT="\
- echo 'PHP_LIBS = -L. -lphp4 \$(PHP_LIBS) \$(EXTRA_LIBS)' > $THTTPD/php_makefile; \
- echo 'PHP_LDFLAGS = \$(NATIVE_RPATHS) \$(PHP_LDFLAGS)' >> $THTTPD/php_makefile; \
- echo 'PHP_CFLAGS = \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(CPPFLAGS) \$(EXTRA_CFLAGS)' >> $THTTPD/php_makefile; \
- rm -f $THTTPD/php_thttpd.c $THTTPD/php_thttpd.h $THTTPD/libphp4.a; \
- \$(LN_S) $abs_srcdir/sapi/thttpd/thttpd.c $THTTPD/php_thttpd.c; \
- \$(LN_S) $abs_srcdir/sapi/thttpd/php_thttpd.h $abs_builddir/$SAPI_STATIC $THTTPD/;\
- $patch"
- PHP_THTTPD="yes, using $THTTPD"
- PHP_ADD_INCLUDE($THTTPD)
- PHP_SELECT_SAPI(thttpd, static)
-],[
- PHP_THTTPD=no
-])
-
-AC_MSG_CHECKING(for thttpd)
-AC_MSG_RESULT($PHP_THTTPD)
diff --git a/sapi/thttpd/php.sym b/sapi/thttpd/php.sym
deleted file mode 100644
index 2214d3964d..0000000000
--- a/sapi/thttpd/php.sym
+++ /dev/null
@@ -1,3 +0,0 @@
-thttpd_php_request
-thttpd_php_init
-thttpd_php_shutdown
diff --git a/sapi/thttpd/php_thttpd.h b/sapi/thttpd/php_thttpd.h
deleted file mode 100644
index 3563961f80..0000000000
--- a/sapi/thttpd/php_thttpd.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef PHP_THTTPD_H
-#define PHP_THTTPD_H
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <libhttpd.h>
-
-void thttpd_php_shutdown(void);
-void thttpd_php_init(void);
-off_t thttpd_php_request(httpd_conn *hc, int show_source);
-
-void thttpd_register_on_close(void (*)(int));
-void thttpd_closed_conn(int fd);
-int thttpd_get_fd(void);
-void thttpd_set_dont_close(void);
-
-#endif
diff --git a/sapi/thttpd/stub.c b/sapi/thttpd/stub.c
deleted file mode 100644
index e69de29bb2..0000000000
--- a/sapi/thttpd/stub.c
+++ /dev/null
diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c
deleted file mode 100644
index 1c13c356b1..0000000000
--- a/sapi/thttpd/thttpd.c
+++ /dev/null
@@ -1,745 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "php_thttpd.h"
-#include "php_variables.h"
-#include "version.h"
-#include "php_ini.h"
-#include "zend_highlight.h"
-
-#include "ext/standard/php_smart_str.h"
-
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#ifdef HAVE_GETNAMEINFO
-#include <sys/socket.h>
-#include <netdb.h>
-#endif
-
-typedef struct {
- httpd_conn *hc;
- void (*on_close)(int);
-
- smart_str sbuf;
- int seen_cl;
- int seen_cn;
-} php_thttpd_globals;
-
-#ifdef PREMIUM_THTTPD
-# define do_keep_alive persistent
-#endif
-
-#ifdef ZTS
-static int thttpd_globals_id;
-#define TG(v) TSRMG(thttpd_globals_id, php_thttpd_globals *, v)
-#else
-static php_thttpd_globals thttpd_globals;
-#define TG(v) (thttpd_globals.v)
-#endif
-
-static int sapi_thttpd_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- int n;
- uint sent = 0;
-
- if (TG(sbuf).c != 0) {
- smart_str_appendl_ex(&TG(sbuf), str, str_length, 1);
- return str_length;
- }
-
- while (str_length > 0) {
- n = send(TG(hc)->conn_fd, str, str_length, 0);
-
- if (n == -1) {
- if (errno == EAGAIN) {
- smart_str_appendl_ex(&TG(sbuf), str, str_length, 1);
-
- return sent + str_length;
- } else
- php_handle_aborted_connection();
- }
-
- TG(hc)->bytes_sent += n;
- str += n;
- sent += n;
- str_length -= n;
- }
-
- return sent;
-}
-
-#define ADD_VEC(str,l) vec[n].iov_base=str;len += (vec[n].iov_len=l); n++
-#define ADD_VEC_S(str) ADD_VEC((str), sizeof(str)-1)
-#define COMBINE_HEADERS 30
-
-static int do_writev(struct iovec *vec, int nvec, int len TSRMLS_DC)
-{
- int n;
-
- /*
- * XXX: partial writevs are not handled
- * This can only cause problems, if the user tries to send
- * huge headers, so I consider this a void issue right now.
- * The maximum size depends on SO_SNDBUF and is usually
- * at least 16KB from my experience.
- */
-
- if (TG(sbuf).c == 0) {
- n = writev(TG(hc)->conn_fd, vec, nvec);
-
- if (n == -1) {
- if (errno == EAGAIN) {
- n = 0;
- } else {
- php_handle_aborted_connection();
- }
- }
-
-
- TG(hc)->bytes_sent += n;
- } else
- n = 0;
-
- if (n < len) {
- int i;
-
- /* merge all unwritten data into sbuf */
- for (i = 0; i < nvec; vec++, i++) {
- /* has this vector been written completely? */
- if (n >= vec->iov_len) {
- /* yes, proceed */
- n -= vec->iov_len;
- continue;
- }
-
- if (n > 0) {
- /* adjust vector */
- vec->iov_base = (char *) vec->iov_base + n;
- vec->iov_len -= n;
- n = 0;
- }
-
- smart_str_appendl_ex(&TG(sbuf), vec->iov_base, vec->iov_len, 1);
- }
- }
-
- return 0;
-}
-
-#define CL_TOKEN "Content-length: "
-#define CN_TOKEN "Connection: "
-#define KA_DO "Connection: keep-alive\r\n"
-#define KA_NO "Connection: close\r\n"
-#define DEF_CT "Content-Type: text/html\r\n"
-
-static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-{
- char buf[1024], *p;
- struct iovec vec[COMBINE_HEADERS];
-
- int n = 0;
- zend_llist_position pos;
- sapi_header_struct *h;
- size_t len = 0;
-
- if (!SG(sapi_headers).http_status_line) {
- ADD_VEC_S("HTTP/1.1 ");
- p = smart_str_print_long(buf+sizeof(buf)-1,
- SG(sapi_headers).http_response_code);
- ADD_VEC(p, strlen(p));
- ADD_VEC_S(" HTTP\r\n");
- } else {
- ADD_VEC(SG(sapi_headers).http_status_line,
- strlen(SG(sapi_headers).http_status_line));
- ADD_VEC("\r\n", 2);
- }
- TG(hc)->status = SG(sapi_headers).http_response_code;
-
- if (SG(sapi_headers).send_default_content_type) {
- ADD_VEC(DEF_CT, strlen(DEF_CT));
- }
-
- h = zend_llist_get_first_ex(&sapi_headers->headers, &pos);
- while (h) {
-
- switch (h->header[0]) {
- case 'c': case 'C':
- if (!TG(seen_cl) && strncasecmp(h->header, CL_TOKEN, sizeof(CL_TOKEN)-1) == 0) {
- TG(seen_cl) = 1;
- } else if (!TG(seen_cn) && strncasecmp(h->header, CN_TOKEN, sizeof(CN_TOKEN)-1) == 0) {
- TG(seen_cn) = 1;
- }
- }
-
- ADD_VEC(h->header, h->header_len);
- if (n >= COMBINE_HEADERS - 1) {
- len = do_writev(vec, n, len TSRMLS_CC);
- n = 0;
- }
- ADD_VEC("\r\n", 2);
-
- h = zend_llist_get_next_ex(&sapi_headers->headers, &pos);
- }
-
- if (TG(seen_cl) && !TG(seen_cn) && TG(hc)->do_keep_alive) {
- ADD_VEC(KA_DO, sizeof(KA_DO)-1);
- } else {
- TG(hc)->do_keep_alive = 0;
- ADD_VEC(KA_NO, sizeof(KA_NO)-1);
- }
-
- ADD_VEC("\r\n", 2);
-
- do_writev(vec, n, len TSRMLS_CC);
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-/* to understand this, read cgi_interpose_input() in libhttpd.c */
-#define SIZEOF_UNCONSUMED_BYTES() (TG(hc)->read_idx - TG(hc)->checked_idx)
-#define CONSUME_BYTES(n) do { TG(hc)->checked_idx += (n); } while (0)
-
-
-static int sapi_thttpd_read_post(char *buffer, uint count_bytes TSRMLS_DC)
-{
- size_t read_bytes = 0;
- int c;
-
- c = SIZEOF_UNCONSUMED_BYTES();
- if (c > 0) {
- read_bytes = MIN(c, count_bytes);
- memcpy(buffer, TG(hc)->read_buf + TG(hc)->checked_idx, read_bytes);
- CONSUME_BYTES(read_bytes);
- count_bytes -= read_bytes;
- }
-
- return read_bytes;
-}
-
-static char *sapi_thttpd_read_cookies(TSRMLS_D)
-{
- return TG(hc)->cookie;
-}
-
-#define BUF_SIZE 512
-#define ADD_STRING_EX(name,buf) \
- php_register_variable(name, buf, track_vars_array TSRMLS_CC)
-#define ADD_STRING(name) ADD_STRING_EX((name), buf)
-
-static void sapi_thttpd_register_variables(zval *track_vars_array TSRMLS_DC)
-{
- char buf[BUF_SIZE + 1];
- char *p;
-
- php_register_variable("PHP_SELF", SG(request_info).request_uri, track_vars_array TSRMLS_CC);
- php_register_variable("SERVER_SOFTWARE", SERVER_SOFTWARE, track_vars_array TSRMLS_CC);
- php_register_variable("GATEWAY_INTERFACE", "CGI/1.1", track_vars_array TSRMLS_CC);
- php_register_variable("REQUEST_METHOD", (char *) SG(request_info).request_method, track_vars_array TSRMLS_CC);
- php_register_variable("REQUEST_URI", SG(request_info).request_uri, track_vars_array TSRMLS_CC);
- php_register_variable("PATH_TRANSLATED", SG(request_info).path_translated, track_vars_array TSRMLS_CC);
-
- if (TG(hc)->one_one) {
- php_register_variable("SERVER_PROTOCOL", "HTTP/1.1", track_vars_array TSRMLS_CC);
- } else {
- php_register_variable("SERVER_PROTOCOL", "HTTP/1.0", track_vars_array TSRMLS_CC);
- }
-
- p = httpd_ntoa(&TG(hc)->client_addr);
-
- ADD_STRING_EX("REMOTE_ADDR", p);
- ADD_STRING_EX("REMOTE_HOST", p);
-
- ADD_STRING_EX("SERVER_PORT",
- smart_str_print_long(buf + sizeof(buf) - 1,
- TG(hc)->hs->port));
-
- buf[0] = '/';
- memcpy(buf + 1, TG(hc)->pathinfo, strlen(TG(hc)->pathinfo) + 1);
- ADD_STRING("PATH_INFO");
-
- buf[0] = '/';
- memcpy(buf + 1, TG(hc)->origfilename, strlen(TG(hc)->origfilename) + 1);
- ADD_STRING("SCRIPT_NAME");
-
-#define CONDADD(name, field) \
- if (TG(hc)->field[0]) { \
- php_register_variable(#name, TG(hc)->field, track_vars_array TSRMLS_CC); \
- }
-
- CONDADD(QUERY_STRING, query);
- CONDADD(HTTP_HOST, hdrhost);
- CONDADD(HTTP_REFERER, referer);
- CONDADD(HTTP_USER_AGENT, useragent);
- CONDADD(HTTP_ACCEPT, accept);
- CONDADD(HTTP_ACCEPT_LANGUAGE, acceptl);
- CONDADD(HTTP_ACCEPT_ENCODING, accepte);
- CONDADD(HTTP_COOKIE, cookie);
- CONDADD(CONTENT_TYPE, contenttype);
- CONDADD(REMOTE_USER, remoteuser);
- CONDADD(SERVER_PROTOCOL, protocol);
-
- if (TG(hc)->contentlength != -1) {
- ADD_STRING_EX("CONTENT_LENGTH",
- smart_str_print_long(buf + sizeof(buf) - 1,
- TG(hc)->contentlength));
- }
-
- if (TG(hc)->authorization[0])
- php_register_variable("AUTH_TYPE", "Basic", track_vars_array TSRMLS_CC);
-}
-
-static PHP_MINIT_FUNCTION(thttpd)
-{
- return SUCCESS;
-}
-
-static zend_module_entry php_thttpd_module = {
- STANDARD_MODULE_HEADER,
- "thttpd",
- NULL,
- PHP_MINIT(thttpd),
- NULL,
- NULL,
- NULL,
- NULL, /* info */
- NULL,
- STANDARD_MODULE_PROPERTIES
-};
-
-static int php_thttpd_startup(sapi_module_struct *sapi_module)
-{
-#if PHP_API_VERSION >= 20020918
- if (php_module_startup(sapi_module, &php_thttpd_module, 1) == FAILURE) {
-#else
- if (php_module_startup(sapi_module) == FAILURE
- || zend_startup_module(&php_thttpd_module) == FAILURE) {
-#endif
- return FAILURE;
- }
- return SUCCESS;
-}
-
-static int sapi_thttpd_get_fd(int *nfd TSRMLS_DC)
-{
- if (nfd) *nfd = TG(hc)->conn_fd;
- return SUCCESS;
-}
-
-static sapi_module_struct thttpd_sapi_module = {
- "thttpd",
- "thttpd",
-
- php_thttpd_startup,
- php_module_shutdown_wrapper,
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- sapi_thttpd_ub_write,
- NULL,
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error,
-
- NULL,
- sapi_thttpd_send_headers,
- NULL,
- sapi_thttpd_read_post,
- sapi_thttpd_read_cookies,
-
- sapi_thttpd_register_variables,
- NULL, /* Log message */
-
- NULL, /* php.ini path override */
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- NULL,
- NULL,
- NULL,
- 0,
- sapi_thttpd_get_fd
-};
-
-static void thttpd_module_main(int show_source TSRMLS_DC)
-{
- zend_file_handle file_handle;
-
- if (php_request_startup(TSRMLS_C) == FAILURE) {
- return;
- }
-
- if (show_source) {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- php_get_highlight_struct(&syntax_highlighter_ini);
- highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC);
- } else {
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
- php_execute_script(&file_handle TSRMLS_CC);
- }
-
- php_request_shutdown(NULL);
-}
-
-static void thttpd_request_ctor(TSRMLS_D)
-{
- smart_str s = {0};
-
- TG(seen_cl) = 0;
- TG(seen_cn) = 0;
- TG(sbuf).c = 0;
- SG(request_info).query_string = TG(hc)->query?strdup(TG(hc)->query):NULL;
-
- smart_str_appends_ex(&s, TG(hc)->hs->cwd, 1);
- smart_str_appends_ex(&s, TG(hc)->expnfilename, 1);
- smart_str_0(&s);
- SG(request_info).path_translated = s.c;
-
- s.c = NULL;
- smart_str_appendc_ex(&s, '/', 1);
- smart_str_appends_ex(&s, TG(hc)->origfilename, 1);
- smart_str_0(&s);
- SG(request_info).request_uri = s.c;
- SG(request_info).request_method = httpd_method_str(TG(hc)->method);
- SG(sapi_headers).http_response_code = 200;
- if (TG(hc)->contenttype)
- SG(request_info).content_type = strdup(TG(hc)->contenttype);
- SG(request_info).content_length = TG(hc)->contentlength == -1 ? 0
- : TG(hc)->contentlength;
-
- php_handle_auth_data(TG(hc)->authorization TSRMLS_CC);
-}
-
-static void thttpd_request_dtor(TSRMLS_D)
-{
- smart_str_free_ex(&TG(sbuf), 1);
- if (SG(request_info).query_string)
- free(SG(request_info).query_string);
- free(SG(request_info).request_uri);
- free(SG(request_info).path_translated);
- if (SG(request_info).content_type)
- free(SG(request_info).content_type);
-}
-
-#ifdef ZTS
-
-#ifdef TSRM_ST
-#define thread_create_simple_detached(n) st_thread_create(n, NULL, 0, 0)
-#define thread_usleep(n) st_usleep(n)
-#define thread_exit() st_thread_exit(NULL)
-/* No preemption, simple operations are safe */
-#define thread_atomic_inc(n) (++n)
-#define thread_atomic_dec(n) (--n)
-#else
-#error No thread primitives available
-#endif
-
-/* We might want to replace this with a STAILQ */
-typedef struct qreq {
- httpd_conn *hc;
- struct qreq *next;
-} qreq_t;
-
-static MUTEX_T qr_lock;
-static qreq_t *queued_requests;
-static qreq_t *last_qr;
-static int nr_free_threads;
-static int nr_threads;
-static int max_threads = 50;
-
-#define HANDLE_STRINGS() { \
- HANDLE_STR(encodedurl); \
- HANDLE_STR(decodedurl); \
- HANDLE_STR(origfilename); \
- HANDLE_STR(expnfilename); \
- HANDLE_STR(pathinfo); \
- HANDLE_STR(query); \
- HANDLE_STR(referer); \
- HANDLE_STR(useragent); \
- HANDLE_STR(accept); \
- HANDLE_STR(accepte); \
- HANDLE_STR(acceptl); \
- HANDLE_STR(cookie); \
- HANDLE_STR(contenttype); \
- HANDLE_STR(authorization); \
- HANDLE_STR(remoteuser); \
- }
-
-static httpd_conn *duplicate_conn(httpd_conn *hc, httpd_conn *nhc)
-{
- memcpy(nhc, hc, sizeof(*nhc));
-
-#define HANDLE_STR(m) nhc->m = nhc->m ? strdup(nhc->m) : NULL
- HANDLE_STRINGS();
-#undef HANDLE_STR
-
- return nhc;
-}
-
-static void destroy_conn(httpd_conn *hc)
-{
-#define HANDLE_STR(m) if (hc->m) free(hc->m)
- HANDLE_STRINGS();
-#undef HANDLE_STR
-}
-
-static httpd_conn *dequeue_request(void)
-{
- httpd_conn *ret = NULL;
- qreq_t *m;
-
- tsrm_mutex_lock(qr_lock);
- if (queued_requests) {
- m = queued_requests;
- ret = m->hc;
- if (!(queued_requests = m->next))
- last_qr = NULL;
- free(m);
- }
- tsrm_mutex_unlock(qr_lock);
-
- return ret;
-}
-
-static void *worker_thread(void *);
-
-static void queue_request(httpd_conn *hc)
-{
- qreq_t *m;
- httpd_conn *nhc;
-
- /* Mark as long-running request */
- hc->file_address = (char *) 1;
-
- /*
- * We cannot synchronously revoke accesses to hc in the worker
- * thread, so we need to pass a copy of hc to the worker thread.
- */
- nhc = malloc(sizeof *nhc);
- duplicate_conn(hc, nhc);
-
- /* Allocate request queue container */
- m = malloc(sizeof *m);
- m->hc = nhc;
- m->next = NULL;
-
- tsrm_mutex_lock(qr_lock);
- /* Create new threads when reaching a certain threshhold */
- if (nr_threads < max_threads && nr_free_threads < 2) {
- nr_threads++; /* protected by qr_lock */
-
- thread_atomic_inc(nr_free_threads);
- thread_create_simple_detached(worker_thread);
- }
- /* Insert container into request queue */
- if (queued_requests)
- last_qr->next = m;
- else
- queued_requests = m;
- last_qr = m;
- tsrm_mutex_unlock(qr_lock);
-}
-
-static off_t thttpd_real_php_request(httpd_conn *hc, int TSRMLS_DC);
-
-static void *worker_thread(void *dummy)
-{
- int do_work = 50;
- httpd_conn *hc;
-
- while (do_work) {
- hc = dequeue_request();
-
- if (!hc) {
-/* do_work--; */
- thread_usleep(500000);
- continue;
- }
-/* do_work = 50; */
-
- thread_atomic_dec(nr_free_threads);
-
- thttpd_real_php_request(hc, 0 TSRMLS_CC);
- shutdown(hc->conn_fd, 0);
- destroy_conn(hc);
- free(hc);
-
- thread_atomic_inc(nr_free_threads);
- }
- thread_atomic_dec(nr_free_threads);
- thread_atomic_dec(nr_threads);
- thread_exit();
-}
-
-static void remove_dead_conn(int fd)
-{
- qreq_t *m, *prev = NULL;
-
- tsrm_mutex_lock(qr_lock);
- m = queued_requests;
- while (m) {
- if (m->hc->conn_fd == fd) {
- if (prev)
- if (!(prev->next = m->next))
- last_qr = prev;
- else
- if (!(queued_requests = m->next))
- last_qr = NULL;
- destroy_conn(m->hc);
- free(m->hc);
- free(m);
- break;
- }
- prev = m;
- m = m->next;
- }
- tsrm_mutex_unlock(qr_lock);
-}
-
-#endif
-
-static off_t thttpd_real_php_request(httpd_conn *hc, int show_source TSRMLS_DC)
-{
- TG(hc) = hc;
- hc->bytes_sent = 0;
-
- if (hc->method == METHOD_POST)
- hc->should_linger = 1;
-
- if (hc->contentlength != -1
- && SIZEOF_UNCONSUMED_BYTES() < hc->contentlength) {
- hc->read_body_into_mem = 1;
- return 0;
- }
-
- thttpd_request_ctor(TSRMLS_C);
-
- thttpd_module_main(show_source TSRMLS_CC);
-
- /* disable kl, if no content-length was seen or Connection: was set */
- if (TG(seen_cl) == 0 || TG(seen_cn) == 1) {
- TG(hc)->do_keep_alive = 0;
- }
-
- if (TG(sbuf).c != 0) {
- if (TG(hc)->response)
- free(TG(hc)->response);
-
- TG(hc)->response = TG(sbuf).c;
- TG(hc)->responselen = TG(sbuf).len;
- TG(hc)->maxresponse = TG(sbuf).a;
-
- TG(sbuf).c = 0;
- TG(sbuf).len = 0;
- TG(sbuf).a = 0;
- }
-
- thttpd_request_dtor(TSRMLS_C);
-
- return 0;
-}
-
-off_t thttpd_php_request(httpd_conn *hc, int show_source)
-{
-#ifdef ZTS
- queue_request(hc);
-#else
- TSRMLS_FETCH();
- return thttpd_real_php_request(hc, show_source TSRMLS_CC);
-#endif
-}
-
-void thttpd_register_on_close(void (*arg)(int))
-{
- TSRMLS_FETCH();
- TG(on_close) = arg;
-}
-
-void thttpd_closed_conn(int fd)
-{
- TSRMLS_FETCH();
- if (TG(on_close)) TG(on_close)(fd);
-}
-
-int thttpd_get_fd(void)
-{
- TSRMLS_FETCH();
- return TG(hc)->conn_fd;
-}
-
-void thttpd_set_dont_close(void)
-{
- TSRMLS_FETCH();
-#ifndef PREMIUM_THTTPD
- TG(hc)->file_address = (char *) 1;
-#endif
-}
-
-
-void thttpd_php_init(void)
-{
- char *ini;
-
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
- ts_allocate_id(&thttpd_globals_id, sizeof(php_thttpd_globals), NULL, NULL);
- qr_lock = tsrm_mutex_alloc();
- thttpd_register_on_close(remove_dead_conn);
-#endif
-
- if ((ini = getenv("PHP_INI_PATH"))) {
- thttpd_sapi_module.php_ini_path_override = ini;
- }
-
- sapi_startup(&thttpd_sapi_module);
- thttpd_sapi_module.startup(&thttpd_sapi_module);
-
- {
- TSRMLS_FETCH();
-
- SG(server_context) = (void *) 1;
- }
-}
-
-void thttpd_php_shutdown(void)
-{
- TSRMLS_FETCH();
-
- if (SG(server_context) != NULL) {
- thttpd_sapi_module.shutdown(&thttpd_sapi_module);
- sapi_shutdown();
-#ifdef ZTS
- tsrm_shutdown();
-#endif
- }
-}
diff --git a/sapi/thttpd/thttpd_patch b/sapi/thttpd/thttpd_patch
deleted file mode 100644
index 19c8ac92eb..0000000000
--- a/sapi/thttpd/thttpd_patch
+++ /dev/null
@@ -1,2332 +0,0 @@
-diff -ur thttpd-2.21b/Makefile.in thttpd-2.21b-cool/Makefile.in
---- thttpd-2.21b/Makefile.in Thu Mar 29 20:36:21 2001
-+++ thttpd-2.21b-cool/Makefile.in Tue May 6 21:13:57 2003
-@@ -46,13 +46,15 @@
-
- # You shouldn't need to edit anything below here.
-
-+include php_makefile
-+
- CC = @CC@
- CCOPT = @V_CCOPT@
- DEFS = @DEFS@
--INCLS = -I.
-+INCLS = -I. $(PHP_CFLAGS)
- CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
--LDFLAGS = @LDFLAGS@
--LIBS = @LIBS@
-+LDFLAGS = @LDFLAGS@ $(PHP_LDFLAGS)
-+LIBS = @LIBS@ $(PHP_LIBS)
- NETLIBS = @V_NETLIBS@
- INSTALL = @INSTALL@
-
-@@ -62,7 +64,7 @@
- @rm -f $@
- $(CC) $(CFLAGS) -c $*.c
-
--SRC = thttpd.c libhttpd.c fdwatch.c mmc.c timers.c match.c tdate_parse.c syslog.c
-+SRC = thttpd.c libhttpd.c fdwatch.c mmc.c timers.c match.c tdate_parse.c syslog.c php_thttpd.c
-
- OBJ = $(SRC:.c=.o) @LIBOBJS@
-
-@@ -77,7 +79,7 @@
- all: this subdirs
- this: $(ALL)
-
--thttpd: $(OBJ)
-+thttpd: $(OBJ) libphp4.a
- @rm -f $@
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) $(NETLIBS)
-
-diff -ur thttpd-2.21b/config.h thttpd-2.21b-cool/config.h
---- thttpd-2.21b/config.h Mon Apr 9 23:57:36 2001
-+++ thttpd-2.21b-cool/config.h Tue May 6 21:13:57 2003
-@@ -82,6 +82,11 @@
- */
- #define IDLE_READ_TIMELIMIT 60
-
-+/* CONFIGURE: How many seconds to allow for reading the subsequent requests
-+** on a keep-alive connection. Should be simiar to LINGER_TIME
-+*/
-+#define IDLE_KEEPALIVE_TIMELIMIT 2
-+
- /* CONFIGURE: How many seconds before an idle connection gets closed.
- */
- #define IDLE_SEND_TIMELIMIT 300
-@@ -316,7 +321,7 @@
- /* CONFIGURE: A list of index filenames to check. The files are searched
- ** for in this order.
- */
--#define INDEX_NAMES "index.html", "index.htm", "Default.htm", "index.cgi"
-+#define INDEX_NAMES "index.php", "index.html", "index.htm", "Default.htm", "index.cgi"
-
- /* CONFIGURE: If this is defined then thttpd will automatically generate
- ** index pages for directories that don't have an explicit index file.
-diff -ur thttpd-2.21b/configure thttpd-2.21b-cool/configure
---- thttpd-2.21b/configure Sat Apr 21 02:07:14 2001
-+++ thttpd-2.21b-cool/configure Tue May 6 21:13:57 2003
-@@ -1021,7 +1021,7 @@
- fi
- echo "$ac_t""$CPP" 1>&6
-
--for ac_hdr in fcntl.h grp.h memory.h paths.h poll.h sys/poll.h sys/event.h osreldate.h
-+for ac_hdr in fcntl.h grp.h memory.h paths.h poll.h sys/poll.h sys/event.h osreldate.h netinet/tcp.h
- do
- ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
- echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-diff -ur thttpd-2.21b/configure.in thttpd-2.21b-cool/configure.in
---- thttpd-2.21b/configure.in Sat Apr 21 02:06:23 2001
-+++ thttpd-2.21b-cool/configure.in Tue May 6 21:13:57 2003
-@@ -64,7 +64,7 @@
- AC_MSG_RESULT(no)
- fi
-
--AC_CHECK_HEADERS(fcntl.h grp.h memory.h paths.h poll.h sys/poll.h sys/event.h osreldate.h)
-+AC_CHECK_HEADERS(fcntl.h grp.h memory.h paths.h poll.h sys/poll.h sys/event.h osreldate.h netinet/tcp.h)
- AC_HEADER_TIME
- AC_HEADER_DIRENT
-
-diff -ur thttpd-2.21b/fdwatch.c thttpd-2.21b-cool/fdwatch.c
---- thttpd-2.21b/fdwatch.c Fri Apr 13 07:36:08 2001
-+++ thttpd-2.21b-cool/fdwatch.c Tue May 6 21:13:57 2003
-@@ -419,6 +419,7 @@
- if ( pollfds == (struct pollfd*) 0 || poll_fdidx == (int*) 0 ||
- poll_rfdidx == (int*) 0 )
- return -1;
-+ memset(pollfds, 0, sizeof(struct pollfd) * nfiles);
- return 0;
- }
-
-@@ -460,7 +461,7 @@
-
- ridx = 0;
- for ( i = 0; i < npollfds; ++i )
-- if ( pollfds[i].revents & ( POLLIN | POLLOUT ) )
-+ if ( pollfds[i].revents & ( POLLIN | POLLOUT | POLLERR | POLLHUP | POLLNVAL ) )
- poll_rfdidx[ridx++] = pollfds[i].fd;
-
- return r;
-@@ -472,8 +473,8 @@
- {
- switch ( fd_rw[fd] )
- {
-- case FDW_READ: return pollfds[poll_fdidx[fd]].revents & POLLIN;
-- case FDW_WRITE: return pollfds[poll_fdidx[fd]].revents & POLLOUT;
-+ case FDW_READ: return pollfds[poll_fdidx[fd]].revents & ( POLLIN | POLLERR | POLLHUP | POLLNVAL );
-+ case FDW_WRITE: return pollfds[poll_fdidx[fd]].revents & ( POLLOUT | POLLERR | POLLHUP | POLLNVAL );
- default: return 0;
- }
- }
-diff -ur thttpd-2.21b/libhttpd.c thttpd-2.21b-cool/libhttpd.c
---- thttpd-2.21b/libhttpd.c Tue Apr 24 00:42:40 2001
-+++ thttpd-2.21b-cool/libhttpd.c Tue May 6 21:14:56 2003
-@@ -56,6 +56,10 @@
- #include <unistd.h>
- #include <stdarg.h>
-
-+#ifdef HAVE_NETINET_TCP_H
-+#include <netinet/tcp.h>
-+#endif
-+
- #ifdef HAVE_OSRELDATE_H
- #include <osreldate.h>
- #endif /* HAVE_OSRELDATE_H */
-@@ -85,6 +89,12 @@
- #include "match.h"
- #include "tdate_parse.h"
-
-+#include "php_thttpd.h"
-+
-+#ifdef __CYGWIN__
-+# define timezone _timezone
-+#endif
-+
- #ifndef STDIN_FILENO
- #define STDIN_FILENO 0
- #endif
-@@ -111,7 +121,7 @@
- static int initialize_listen_socket( httpd_sockaddr* saP );
- static void unlisten( httpd_server* hs );
- static void add_response( httpd_conn* hc, char* str );
--static void send_mime( httpd_conn* hc, int status, char* title, char* encodings, char* extraheads, char* type, int length, time_t mod );
-+static void send_mime( httpd_conn* hc, int status, char* title, char* encodings, char* extraheads, char* type, int length, time_t mod, const char *, size_t );
- static void send_response( httpd_conn* hc, int status, char* title, char* extraheads, char* form, char* arg );
- static void send_response_tail( httpd_conn* hc );
- static void defang( char* str, char* dfstr, int dfsize );
-@@ -242,6 +252,10 @@
- free( (void*) hs->cwd );
- if ( hs->cgi_pattern != (char*) 0 )
- free( (void*) hs->cgi_pattern );
-+ if ( hs->php_pattern != (char*) 0 )
-+ free( (void*) hs->php_pattern );
-+ if ( hs->phps_pattern != (char*) 0 )
-+ free( (void*) hs->phps_pattern );
- if ( hs->charset != (char*) 0 )
- free( (void*) hs->charset );
- if ( hs->url_pattern != (char*) 0 )
-@@ -249,6 +263,7 @@
- if ( hs->local_pattern != (char*) 0 )
- free( (void*) hs->local_pattern );
- free( (void*) hs );
-+ thttpd_php_shutdown();
- }
-
-
-@@ -257,7 +272,8 @@
- char* hostname, httpd_sockaddr* sa4P, httpd_sockaddr* sa6P, int port,
- char* cgi_pattern, char* charset, char* cwd, int no_log, FILE* logfp,
- int no_symlink, int vhost, int global_passwd, char* url_pattern,
-- char* local_pattern, int no_empty_referers )
-+ char* local_pattern, int no_empty_referers, char* php_pattern,
-+ char* phps_pattern )
- {
- httpd_server* hs;
- static char ghnbuf[256];
-@@ -312,6 +328,8 @@
- }
-
- hs->port = port;
-+ hs->php_pattern = strdup(php_pattern);
-+ hs->phps_pattern = strdup(phps_pattern);
- if ( cgi_pattern == (char*) 0 )
- hs->cgi_pattern = (char*) 0;
- else
-@@ -329,7 +347,7 @@
- while ( ( cp = strstr( hs->cgi_pattern, "|/" ) ) != (char*) 0 )
- (void) strcpy( cp + 1, cp + 2 );
- }
-- hs->charset = strdup( charset );
-+ hs->charset = strdup( charset );
- hs->cwd = strdup( cwd );
- if ( hs->cwd == (char*) 0 )
- {
-@@ -385,6 +403,8 @@
- return (httpd_server*) 0;
- }
-
-+ thttpd_php_init();
-+
- /* Done initializing. */
- if ( hs->binding_hostname == (char*) 0 )
- syslog( LOG_INFO, "%.80s starting on port %d", SERVER_SOFTWARE, hs->port );
-@@ -418,6 +438,11 @@
- }
- (void) fcntl( listen_fd, F_SETFD, 1 );
-
-+#if defined(TCP_DEFER_ACCEPT) && defined(SOL_TCP)
-+ on = 30; /* give clients 30s to send first data packet */
-+ setsockopt(listen_fd, SOL_TCP, TCP_DEFER_ACCEPT, &on, sizeof(on));
-+#endif
-+
- /* Allow reuse of local addresses. */
- on = 1;
- if ( setsockopt(
-@@ -582,6 +607,9 @@
- /* And send it, if necessary. */
- if ( hc->responselen > 0 )
- {
-+/*
-+printf("**RESPONSE [%d]** len = %d\n%*.*s\n", hc->conn_fd, hc->responselen, hc->responselen, hc->responselen, hc->response);
-+*/
- (void) write( hc->conn_fd, hc->response, hc->responselen );
- hc->responselen = 0;
- }
-@@ -619,18 +647,22 @@
- }
- }
-
-+extern time_t httpd_time_now;
-+extern char httpd_now_buf[];
-+
-+#define SMART_STR_USE_REALLOC
-+
-+#include "ext/standard/php_smart_str.h"
-
- static void
--send_mime( httpd_conn* hc, int status, char* title, char* encodings, char* extraheads, char* type, int length, time_t mod )
-+send_mime( httpd_conn* hc, int status, char* title, char* encodings, char* extraheads, char* type, int length, time_t mod, const char *last_modified, size_t last_modified_len)
- {
-- time_t now;
- const char* rfc1123fmt = "%a, %d %b %Y %H:%M:%S GMT";
-- char nowbuf[100];
- char modbuf[100];
-- char fixed_type[500];
-- char buf[1000];
- int partial_content;
--
-+ smart_str s = {0};
-+ int type_len;
-+
- hc->status = status;
- hc->bytes_to_send = length;
- if ( hc->mime_flag )
-@@ -649,41 +681,89 @@
- else
- partial_content = 0;
-
-- now = time( (time_t*) 0 );
- if ( mod == (time_t) 0 )
-- mod = now;
-- (void) strftime( nowbuf, sizeof(nowbuf), rfc1123fmt, gmtime( &now ) );
-- (void) strftime( modbuf, sizeof(modbuf), rfc1123fmt, gmtime( &mod ) );
-- (void) my_snprintf(
-- fixed_type, sizeof(fixed_type), type, hc->hs->charset );
-- (void) my_snprintf( buf, sizeof(buf),
-- "%.20s %d %s\r\nServer: %s\r\nContent-Type: %s\r\nDate: %s\r\nLast-Modified: %s\r\nAccept-Ranges: bytes\r\nConnection: close\r\n",
-- hc->protocol, status, title, EXPOSED_SERVER_SOFTWARE, fixed_type,
-- nowbuf, modbuf );
-- add_response( hc, buf );
-+ mod = httpd_time_now;
-+
-+ if (last_modified == 0) {
-+ (void) strftime( modbuf, sizeof(modbuf), rfc1123fmt, gmtime( &mod ) );
-+ last_modified = modbuf;
-+ last_modified_len = strlen(modbuf);
-+ }
-+
-+ type_len = strlen(type);
-+
-+ if (hc->response) {
-+ s.c = hc->response;
-+ s.len = 0;
-+ s.a = hc->maxresponse;
-+ hc->response = 0;
-+ hc->maxresponse = 0;
-+ }
-+
-+ smart_str_appends(&s, "HTTP/1.1 ");
-+ smart_str_append_long(&s, status);
-+ smart_str_appends(&s, " HTTP\r\nServer: " EXPOSED_SERVER_SOFTWARE "\r\n"
-+ "Content-Type: ");
-+
-+ if (type[type_len-2] == '%' && type[type_len-1] == 's') {
-+ smart_str_appendl(&s, type, type_len - 2);
-+ smart_str_appends(&s, hc->hs->charset);
-+ } else {
-+ smart_str_appendl(&s, type, type_len);
-+ }
-+
-+
-+ smart_str_appends(&s, "\r\nDate: ");
-+ smart_str_appends(&s, httpd_now_buf);
-+ smart_str_appends(&s, "\r\nLast-Modified: ");
-+ smart_str_appendl(&s, last_modified, last_modified_len);
-+ smart_str_appends(&s, "\r\nAccept-Ranges: bytes\r\n");
-+
- if ( encodings[0] != '\0' )
- {
-- (void) my_snprintf( buf, sizeof(buf),
-- "Content-Encoding: %s\r\n", encodings );
-- add_response( hc, buf );
-+ smart_str_appends(&s, "Content-Encoding: ");
-+ smart_str_appends(&s, encodings);
-+ smart_str_appends(&s, "\r\n");
- }
- if ( partial_content )
- {
-- (void) my_snprintf( buf, sizeof(buf),
-- "Content-Range: bytes %ld-%ld/%d\r\nContent-Length: %ld\r\n",
-- (long) hc->init_byte_loc, (long) hc->end_byte_loc, length,
-- (long) ( hc->end_byte_loc - hc->init_byte_loc + 1 ) );
-- add_response( hc, buf );
-+
-+ smart_str_appends(&s, "Content-Range: bytes ");
-+ smart_str_append_long(&s, hc->init_byte_loc);
-+ smart_str_appendc(&s, '-');
-+ smart_str_append_long(&s, hc->end_byte_loc);
-+ smart_str_appendc(&s, '/');
-+ smart_str_append_long(&s, length);
-+ smart_str_appends(&s, "\r\nContent-Length: ");
-+ smart_str_append_long(&s, hc->end_byte_loc - hc->init_byte_loc + 1);
-+ smart_str_appends(&s, "\r\n");
-+
- }
- else if ( length >= 0 )
- {
-- (void) my_snprintf( buf, sizeof(buf),
-- "Content-Length: %d\r\n", length );
-- add_response( hc, buf );
-+ smart_str_appends(&s, "Content-Length: ");
-+ smart_str_append_long(&s, length);
-+ smart_str_appends(&s, "\r\n");
- }
-+ else {
-+ hc->do_keep_alive = 0;
-+ }
- if ( extraheads[0] != '\0' )
-- add_response( hc, extraheads );
-- add_response( hc, "\r\n" );
-+ smart_str_appends(&s, extraheads);
-+ if (hc->do_keep_alive) {
-+ smart_str_appends(&s, "Connection: keep-alive\r\n\r\n" );
-+ } else {
-+ smart_str_appends(&s, "Connection: close\r\n\r\n" );
-+ }
-+ smart_str_0(&s);
-+
-+ if (hc->response) {
-+ free(hc->response);
-+ }
-+ hc->response = s.c;
-+ hc->maxresponse = s.a;
-+ hc->responselen = s.len;
-+
- }
- }
-
-@@ -725,7 +805,7 @@
- {
- char defanged_arg[1000], buf[2000];
-
-- send_mime( hc, status, title, "", extraheads, "text/html", -1, 0 );
-+ send_mime( hc, status, title, "", extraheads, "text/html", -1, 0, 0, 0 );
- (void) my_snprintf( buf, sizeof(buf),
- "<HTML><HEAD><TITLE>%d %s</TITLE></HEAD>\n<BODY BGCOLOR=\"#cc9999\"><H2>%d %s</H2>\n",
- status, title, status, title );
-@@ -834,7 +914,7 @@
- fp = fopen( filename, "r" );
- if ( fp == (FILE*) 0 )
- return 0;
-- send_mime( hc, status, title, "", extraheads, "text/html", -1, 0 );
-+ send_mime( hc, status, title, "", extraheads, "text/html", -1, 0, 0, 0 );
- for (;;)
- {
- r = fread( buf, 1, sizeof(buf) - 1, fp );
-@@ -1336,6 +1416,9 @@
- if ( hc->tildemapped )
- return 1;
-
-+ if ( hc->hostname[0] == '.' || strchr( hc->hostname, '/' ) != (char*) 0 )
-+ return 0;
-+
- /* Figure out the host directory. */
- #ifdef VHOST_DIRLEVELS
- httpd_realloc_str(
-@@ -1436,7 +1519,7 @@
- restlen = strlen( path );
- httpd_realloc_str( &rest, &maxrest, restlen );
- (void) strcpy( rest, path );
-- if ( rest[restlen - 1] == '/' )
-+ if ( restlen > 0 && rest[restlen - 1] == '/' )
- rest[--restlen] = '\0'; /* trim trailing slash */
- if ( ! tildemapped )
- /* Remove any leading slashes. */
-@@ -1603,6 +1686,70 @@
-
-
- int
-+httpd_request_reset(httpd_conn* hc, int preserve_read_buf )
-+{
-+ if (!preserve_read_buf) {
-+ hc->read_idx = 0;
-+ hc->checked_idx = 0;
-+ }
-+
-+ if (hc->read_buf_is_mmap) {
-+ hc->read_buf_is_mmap = 0;
-+ munmap(hc->read_buf, hc->read_size);
-+ hc->read_buf = NULL;
-+ hc->read_size = 0;
-+ httpd_realloc_str( &hc->read_buf, &hc->read_size, 500 );
-+ }
-+ hc->checked_state = CHST_FIRSTWORD;
-+ hc->method = METHOD_UNKNOWN;
-+ hc->status = 0;
-+ hc->bytes_to_send = 0;
-+ hc->bytes_sent = 0;
-+ hc->encodedurl = "";
-+ hc->decodedurl[0] = '\0';
-+ hc->protocol = "UNKNOWN";
-+ hc->origfilename[0] = '\0';
-+ hc->expnfilename[0] = '\0';
-+ hc->encodings[0] = '\0';
-+ hc->pathinfo[0] = '\0';
-+ hc->query[0] = '\0';
-+ hc->referer = "";
-+ hc->useragent = "";
-+ hc->accept[0] = '\0';
-+ hc->accepte[0] = '\0';
-+ hc->acceptl = "";
-+ hc->cookie = "";
-+ hc->contenttype = "";
-+ hc->reqhost[0] = '\0';
-+ hc->hdrhost = "";
-+ hc->hostdir[0] = '\0';
-+ hc->authorization = "";
-+ hc->remoteuser[0] = '\0';
-+ hc->response[0] = '\0';
-+#ifdef TILDE_MAP_2
-+ hc->altdir[0] = '\0';
-+#endif /* TILDE_MAP_2 */
-+ hc->responselen = 0;
-+ hc->if_modified_since = (time_t) -1;
-+ hc->range_if = (time_t) -1;
-+ hc->contentlength = -1;
-+ hc->type = "";
-+ hc->hostname = (char*) 0;
-+ hc->mime_flag = 1;
-+ hc->one_one = 0;
-+ hc->got_range = 0;
-+ hc->tildemapped = 0;
-+ hc->init_byte_loc = 0;
-+ hc->end_byte_loc = -1;
-+ hc->keep_alive = 0;
-+ hc->do_keep_alive = 0;
-+ hc->should_linger = 0;
-+ hc->file_address = (char*) 0;
-+ hc->read_body_into_mem = 0;
-+ return GC_OK;
-+}
-+
-+int
- httpd_get_conn( httpd_server* hs, int listen_fd, httpd_conn* hc )
- {
- httpd_sockaddr sa;
-@@ -1612,6 +1759,7 @@
- {
- hc->read_size = 0;
- httpd_realloc_str( &hc->read_buf, &hc->read_size, 500 );
-+ hc->read_buf_is_mmap = 0;
- hc->maxdecodedurl =
- hc->maxorigfilename = hc->maxexpnfilename = hc->maxencodings =
- hc->maxpathinfo = hc->maxquery = hc->maxaccept =
-@@ -1631,12 +1779,19 @@
- httpd_realloc_str( &hc->reqhost, &hc->maxreqhost, 0 );
- httpd_realloc_str( &hc->hostdir, &hc->maxhostdir, 0 );
- httpd_realloc_str( &hc->remoteuser, &hc->maxremoteuser, 0 );
-- httpd_realloc_str( &hc->response, &hc->maxresponse, 0 );
-+ httpd_realloc_str( &hc->response, &hc->maxresponse, 350 );
- #ifdef TILDE_MAP_2
- httpd_realloc_str( &hc->altdir, &hc->maxaltdir, 0 );
- #endif /* TILDE_MAP_2 */
- hc->initialized = 1;
- }
-+ if (hc->read_buf_is_mmap) {
-+ hc->read_buf_is_mmap = 0;
-+ munmap(hc->read_buf, hc->read_size);
-+ hc->read_buf = NULL;
-+ hc->read_size = 0;
-+ httpd_realloc_str( &hc->read_buf, &hc->read_size, 500 );
-+ }
-
- /* Accept the new connection. */
- sz = sizeof(sa);
-@@ -1657,53 +1812,12 @@
- hc->hs = hs;
- memset( &hc->client_addr, 0, sizeof(hc->client_addr) );
- memcpy( &hc->client_addr, &sa, sockaddr_len( &sa ) );
-- hc->read_idx = 0;
-- hc->checked_idx = 0;
-- hc->checked_state = CHST_FIRSTWORD;
-- hc->method = METHOD_UNKNOWN;
-- hc->status = 0;
-- hc->bytes_to_send = 0;
-- hc->bytes_sent = 0;
-- hc->encodedurl = "";
-- hc->decodedurl[0] = '\0';
-- hc->protocol = "UNKNOWN";
-- hc->origfilename[0] = '\0';
-- hc->expnfilename[0] = '\0';
-- hc->encodings[0] = '\0';
-- hc->pathinfo[0] = '\0';
-- hc->query[0] = '\0';
-- hc->referer = "";
-- hc->useragent = "";
-- hc->accept[0] = '\0';
-- hc->accepte[0] = '\0';
-- hc->acceptl = "";
-- hc->cookie = "";
-- hc->contenttype = "";
-- hc->reqhost[0] = '\0';
-- hc->hdrhost = "";
-- hc->hostdir[0] = '\0';
-- hc->authorization = "";
-- hc->remoteuser[0] = '\0';
-- hc->response[0] = '\0';
--#ifdef TILDE_MAP_2
-- hc->altdir[0] = '\0';
--#endif /* TILDE_MAP_2 */
-- hc->responselen = 0;
-- hc->if_modified_since = (time_t) -1;
-- hc->range_if = (time_t) -1;
-- hc->contentlength = -1;
-- hc->type = "";
-- hc->hostname = (char*) 0;
-- hc->mime_flag = 1;
-- hc->one_one = 0;
-- hc->got_range = 0;
-- hc->tildemapped = 0;
-- hc->init_byte_loc = 0;
-- hc->end_byte_loc = -1;
-- hc->keep_alive = 0;
-- hc->should_linger = 0;
-- hc->file_address = (char*) 0;
-- return GC_OK;
-+
-+/*
-+printf("doing httpd_get_con(%d)\n", hc->conn_fd);
-+*/
-+
-+ return httpd_request_reset(hc, 0);
- }
-
-
-@@ -1720,6 +1834,9 @@
- {
- char c;
-
-+/*
-+printf("**REQUEST [%d]**\n%*.*s\n", hc->conn_fd, hc->read_idx, hc->read_idx, hc->read_buf);
-+*/
- for ( ; hc->checked_idx < hc->read_idx; ++hc->checked_idx )
- {
- c = hc->read_buf[hc->checked_idx];
-@@ -1912,8 +2029,11 @@
- eol = strpbrk( protocol, " \t\n\r" );
- if ( eol != (char*) 0 )
- *eol = '\0';
-- if ( strcasecmp( protocol, "HTTP/1.0" ) != 0 )
-+ if ( strcasecmp( protocol, "HTTP/1.0" ) != 0 ) {
- hc->one_one = 1;
-+ hc->keep_alive = 1;
-+ hc->do_keep_alive = 1;
-+ }
- }
- }
- /* Check for HTTP/1.1 absolute URL. */
-@@ -2129,6 +2249,7 @@
- cp = &buf[11];
- cp += strspn( cp, " \t" );
- if ( strcasecmp( cp, "keep-alive" ) == 0 )
-+ hc->do_keep_alive = 1;
- hc->keep_alive = 1;
- }
- #ifdef LOG_UNKNOWN_HEADERS
-@@ -2168,6 +2289,9 @@
- }
- }
-
-+/*
-+printf("one_one = %d keep_alive = %d\n", hc->one_one, hc->keep_alive);
-+*/
- if ( hc->one_one )
- {
- /* Check that HTTP/1.1 requests specify a host, as required. */
-@@ -2177,14 +2301,14 @@
- return -1;
- }
-
-- /* If the client wants to do keep-alives, it might also be doing
-- ** pipelining. There's no way for us to tell. Since we don't
-- ** implement keep-alives yet, if we close such a connection there
-- ** might be unread pipelined requests waiting. So, we have to
-- ** do a lingering close.
-+ /*
-+ ** Disable keep alive support for bad browsers,
-+ ** list taken from Apache 1.3.19
- */
-- if ( hc->keep_alive )
-- hc->should_linger = 1;
-+ if ( hc->do_keep_alive &&
-+ ( strstr(hc->useragent, "Mozilla/2") != NULL ||
-+ strstr(hc->useragent, "MSIE 4.0b2;") != NULL))
-+ hc->do_keep_alive = 0;
- }
-
- /* Ok, the request has been parsed. Now we resolve stuff that
-@@ -2349,15 +2473,24 @@
-
-
- void
--httpd_close_conn( httpd_conn* hc, struct timeval* nowP )
-- {
-- make_log_entry( hc, nowP );
-+httpd_complete_request( httpd_conn* hc, struct timeval* nowP, int logit )
-+{
-+ if (logit)
-+ make_log_entry( hc, nowP );
-
-- if ( hc->file_address != (char*) 0 )
-+ if ( hc->file_address == (char*) 1 )
-+ {
-+ thttpd_closed_conn(hc->conn_fd);
-+ } else if ( hc->file_address != (char*) 0 )
- {
- mmc_unmap( hc->file_address, &(hc->sb), nowP );
- hc->file_address = (char*) 0;
- }
-+ }
-+
-+void
-+httpd_close_conn( httpd_conn* hc, struct timeval* nowP )
-+{
- if ( hc->conn_fd >= 0 )
- {
- (void) close( hc->conn_fd );
-@@ -2370,7 +2503,12 @@
- {
- if ( hc->initialized )
- {
-- free( (void*) hc->read_buf );
-+
-+ if ( hc->read_buf_is_mmap ) {
-+ munmap( hc->read_buf, hc->read_size );
-+ } else {
-+ free( (void*) hc->read_buf );
-+ }
- free( (void*) hc->decodedurl );
- free( (void*) hc->origfilename );
- free( (void*) hc->expnfilename );
-@@ -2556,7 +2694,7 @@
- return -1;
- }
-
-- send_mime( hc, 200, ok200title, "", "", "text/html", -1, hc->sb.st_mtime );
-+ send_mime( hc, 200, ok200title, "", "", "text/html", -1, hc->sb.st_mtime, 0, 0 );
- if ( hc->method == METHOD_HEAD )
- closedir( dirp );
- else if ( hc->method == METHOD_GET )
-@@ -3026,11 +3164,9 @@
- post_post_garbage_hack( httpd_conn* hc )
- {
- char buf[2];
-- int r;
-
-- r = recv( hc->conn_fd, buf, sizeof(buf), MSG_PEEK );
-- if ( r > 0 )
-- (void) read( hc->conn_fd, buf, r );
-+ fcntl(hc->conn_fd, F_SETFL, O_NONBLOCK);
-+ (void) read( hc->conn_fd, buf, 2 );
- }
-
-
-@@ -3313,6 +3449,11 @@
- int r;
- ClientData client_data;
-
-+ /*
-+ ** We are not going to leave the socket open after a CGI... too hard
-+ */
-+ hc->do_keep_alive = 0;
-+
- if ( hc->method == METHOD_GET || hc->method == METHOD_POST )
- {
- httpd_clear_ndelay( hc->conn_fd );
-@@ -3369,6 +3510,7 @@
- int expnlen, indxlen;
- char* cp;
- char* pi;
-+ int nocache = 0;
-
- expnlen = strlen( hc->expnfilename );
-
-@@ -3561,6 +3703,16 @@
- match( hc->hs->cgi_pattern, hc->expnfilename ) )
- return cgi( hc );
-
-+ if ( hc->hs->php_pattern != (char*) 0 &&
-+ match( hc->hs->php_pattern, hc->expnfilename)) {
-+ return thttpd_php_request( hc, 0 );
-+ }
-+
-+ if ( hc->hs->phps_pattern != (char*) 0 &&
-+ match( hc->hs->phps_pattern, hc->expnfilename)) {
-+ return thttpd_php_request( hc, 1 );
-+ }
-+
- /* It's not CGI. If it's executable or there's pathinfo, someone's
- ** trying to either serve or run a non-CGI file as CGI. Either case
- ** is prohibited.
-@@ -3594,32 +3746,47 @@
- hc->end_byte_loc = hc->sb.st_size - 1;
-
- figure_mime( hc );
-+ if ( strncmp(hc->decodedurl, "/nocache/", sizeof("/nocache/") - 1 ) == 0 )
-+ nocache = 1;
-
- if ( hc->method == METHOD_HEAD )
- {
- send_mime(
- hc, 200, ok200title, hc->encodings, "", hc->type, hc->sb.st_size,
-- hc->sb.st_mtime );
-+ hc->sb.st_mtime, 0, 0 );
- }
-- else if ( hc->if_modified_since != (time_t) -1 &&
-+ else if ( !nocache && hc->if_modified_since != (time_t) -1 &&
- hc->if_modified_since >= hc->sb.st_mtime )
- {
- hc->method = METHOD_HEAD;
- send_mime(
- hc, 304, err304title, hc->encodings, "", hc->type, hc->sb.st_size,
-- hc->sb.st_mtime );
-+ hc->sb.st_mtime, 0, 0 );
- }
- else
- {
-- hc->file_address = mmc_map( hc->expnfilename, &(hc->sb), nowP );
-+ char *extraheads = "";
-+ char *lm;
-+ size_t lml;
-+
-+ if ( nocache )
-+ {
-+ extraheads = "Expires: Thu, 19 Nov 1981 08:52:00 GMT\r\n"
-+ "Cache-Control: no-store, no-cache, must-revalidate, "
-+ "post-check=0, pre-check=0\r\n"
-+ "Pragma: no-cache\r\n";
-+ }
-+
-+ hc->file_address = mmc_map( hc->expnfilename, &(hc->sb), nowP, nocache, &lm, &lml );
- if ( hc->file_address == (char*) 0 )
- {
- httpd_send_err( hc, 500, err500title, "", err500form, hc->encodedurl );
- return -1;
- }
-+
- send_mime(
-- hc, 200, ok200title, hc->encodings, "", hc->type, hc->sb.st_size,
-- hc->sb.st_mtime );
-+ hc, 200, ok200title, hc->encodings, extraheads, hc->type, hc->sb.st_size,
-+ hc->sb.st_mtime, lm, lml );
- }
-
- return 0;
-@@ -3638,6 +3805,9 @@
- return r;
- }
-
-+#define smart_str_append_const(a,b) smart_str_appendl(a,b,sizeof(b)-1)
-+
-+static smart_str bentries;
-
- static void
- make_log_entry( httpd_conn* hc, struct timeval* nowP )
-@@ -3648,88 +3818,62 @@
-
- if ( hc->hs->no_log )
- return;
--
-- /* This is straight CERN Combined Log Format - the only tweak
-- ** being that if we're using syslog() we leave out the date, because
-- ** syslogd puts it in. The included syslogtocern script turns the
-- ** results into true CERN format.
-- */
--
- /* Format remote user. */
- if ( hc->remoteuser[0] != '\0' )
-- ru = hc->remoteuser;
-+ ru = hc->remoteuser;
- else
-- ru = "-";
-+ ru = "-";
- /* If we're vhosting, prepend the hostname to the url. This is
- ** a little weird, perhaps writing separate log files for
- ** each vhost would make more sense.
- */
-- if ( hc->hs->vhost && ! hc->tildemapped )
-- (void) my_snprintf( url, sizeof(url),
-- "/%.100s%.200s",
-- hc->hostname == (char*) 0 ? hc->hs->server_hostname : hc->hostname,
-- hc->encodedurl );
-- else
-- (void) my_snprintf( url, sizeof(url),
-- "%.200s", hc->encodedurl );
-- /* Format the bytes. */
-- if ( (long) hc->bytes_sent >= 0 )
-- (void) my_snprintf( bytes, sizeof(bytes),
-- "%ld", (long) hc->bytes_sent );
-- else
-- (void) strcpy( bytes, "-" );
-
- /* Logfile or syslog? */
- if ( hc->hs->logfp != (FILE*) 0 )
-- {
-- time_t now;
-- struct tm* t;
-- const char* cernfmt_nozone = "%d/%b/%Y:%H:%M:%S";
-- char date_nozone[100];
-- int zone;
-- char sign;
-- char date[100];
--
-- /* Get the current time, if necessary. */
-- if ( nowP != (struct timeval*) 0 )
-- now = nowP->tv_sec;
-- else
-- now = time( (time_t*) 0 );
-- /* Format the time, forcing a numeric timezone (some log analyzers
-- ** are stoooopid about this).
-- */
-- t = localtime( &now );
-- (void) strftime( date_nozone, sizeof(date_nozone), cernfmt_nozone, t );
--#ifdef HAVE_TM_GMTOFF
-- zone = t->tm_gmtoff / 60L;
--#else
-- zone = -timezone / 60L;
-- /* Probably have to add something about daylight time here. */
--#endif
-- if ( zone >= 0 )
-- sign = '+';
-- else
-- {
-- sign = '-';
-- zone = -zone;
-- }
-- zone = ( zone / 60 ) * 100 + zone % 60;
-- (void) my_snprintf( date, sizeof(date),
-- "%s %c%04d", date_nozone, sign, zone );
-- /* And write the log entry. */
-- (void) fprintf( hc->hs->logfp,
-- "%.80s - %.80s [%s] \"%.80s %.300s %.80s\" %d %s \"%.200s\" \"%.80s\"\n",
-- httpd_ntoa( &hc->client_addr ), ru, date,
-- httpd_method_str( hc->method ), url, hc->protocol,
-- hc->status, bytes, hc->referer, hc->useragent );
-- (void) fflush( hc->hs->logfp ); /* don't need to flush every time */
-- }
-- else
-- syslog( LOG_INFO,
-- "%.80s - %.80s \"%.80s %.200s %.80s\" %d %s \"%.200s\" \"%.80s\"",
-- httpd_ntoa( &hc->client_addr ), ru,
-- httpd_method_str( hc->method ), url, hc->protocol,
-- hc->status, bytes, hc->referer, hc->useragent );
-+ {
-+ /* XXXXXXX */
-+
-+ smart_str_appends(&bentries, httpd_ntoa(&hc->client_addr));
-+ smart_str_append_const(&bentries, " - ");
-+ smart_str_appends(&bentries, ru);
-+ smart_str_append_const(&bentries, " [");
-+ smart_str_appendl(&bentries, hc->hs->log_date, hc->hs->log_date_len);
-+ smart_str_append_const(&bentries, "] \"");
-+ smart_str_appends(&bentries, httpd_method_str(hc->method));
-+ smart_str_appendc(&bentries, ' ');
-+
-+ if (hc->hs->vhost && ! hc->tildemapped) {
-+ smart_str_appendc(&bentries, '/');
-+ if (hc->hostname)
-+ smart_str_appends(&bentries, hc->hostname);
-+ else
-+ smart_str_appends(&bentries, hc->hs->server_hostname);
-+ }
-+ smart_str_appends(&bentries, hc->encodedurl);
-+
-+ smart_str_appendc(&bentries, ' ');
-+ smart_str_appends(&bentries, hc->protocol);
-+ smart_str_append_const(&bentries, "\" ");
-+ smart_str_append_long(&bentries, hc->status);
-+ if (hc->bytes_sent >= 0) {
-+ smart_str_appendc(&bentries, ' ');
-+ smart_str_append_long(&bentries, hc->bytes_sent);
-+ smart_str_append_const(&bentries, " \"");
-+ } else {
-+ smart_str_append_const(&bentries, " - \"");
-+ }
-+ smart_str_appends(&bentries, hc->referer);
-+ smart_str_append_const(&bentries, "\" \"");
-+ smart_str_appends(&bentries, hc->useragent);
-+ smart_str_append_const(&bentries, "\"\n");
-+
-+ if (bentries.len > 16384) {
-+ int fd = fileno(hc->hs->logfp);
-+ write(fd, bentries.c, bentries.len);
-+ bentries.len = 0;
-+ }
-+ }
-+
- }
-
-
-@@ -3840,7 +3984,24 @@
- {
- #ifdef HAVE_GETNAMEINFO
- static char str[200];
-+ static smart_str httpd_ntoa_buf;
-+
-+ if (saP->sa_in.sin_family == AF_INET) {
-+ unsigned long n = ntohl(saP->sa_in.sin_addr.s_addr);
-
-+ httpd_ntoa_buf.len = 0;
-+ smart_str_append_long(&httpd_ntoa_buf, (n >> 24));
-+ smart_str_appendc(&httpd_ntoa_buf, '.');
-+ smart_str_append_long(&httpd_ntoa_buf, (n >> 16) & 255);
-+ smart_str_appendc(&httpd_ntoa_buf, '.');
-+ smart_str_append_long(&httpd_ntoa_buf, (n >> 8) & 255);
-+ smart_str_appendc(&httpd_ntoa_buf, '.');
-+ smart_str_append_long(&httpd_ntoa_buf, (n >> 0) & 255);
-+ smart_str_0(&httpd_ntoa_buf);
-+
-+ return httpd_ntoa_buf.c;
-+ }
-+
- if ( getnameinfo( &saP->sa, sockaddr_len( saP ), str, sizeof(str), 0, 0, NI_NUMERICHOST ) != 0 )
- {
- str[0] = '?';
-Only in thttpd-2.21b-cool: libhttpd.c~
-diff -ur thttpd-2.21b/libhttpd.h thttpd-2.21b-cool/libhttpd.h
---- thttpd-2.21b/libhttpd.h Tue Apr 24 00:36:50 2001
-+++ thttpd-2.21b-cool/libhttpd.h Tue May 6 21:13:57 2003
-@@ -69,6 +69,8 @@
- char* server_hostname;
- int port;
- char* cgi_pattern;
-+ char* php_pattern;
-+ char* phps_pattern;
- char* charset;
- char* cwd;
- int listen4_fd, listen6_fd;
-@@ -80,6 +82,8 @@
- char* url_pattern;
- char* local_pattern;
- int no_empty_referers;
-+ size_t log_date_len;
-+ char log_date[100];
- } httpd_server;
-
- /* A connection. */
-@@ -88,6 +92,7 @@
- httpd_server* hs;
- httpd_sockaddr client_addr;
- char* read_buf;
-+ char read_buf_is_mmap;
- int read_size, read_idx, checked_idx;
- int checked_state;
- int method;
-@@ -132,11 +137,12 @@
- int got_range;
- int tildemapped; /* this connection got tilde-mapped */
- off_t init_byte_loc, end_byte_loc;
-- int keep_alive;
-+ int keep_alive, do_keep_alive;
- int should_linger;
- struct stat sb;
- int conn_fd;
- char* file_address;
-+ char read_body_into_mem;
- } httpd_conn;
-
- /* Methods. */
-@@ -168,7 +174,8 @@
- char* hostname, httpd_sockaddr* sa4P, httpd_sockaddr* sa6P, int port,
- char* cgi_pattern, char* charset, char* cwd, int no_log, FILE* logfp,
- int no_symlink, int vhost, int global_passwd, char* url_pattern,
-- char* local_pattern, int no_empty_referers );
-+ char* local_pattern, int no_empty_referers, char* php_pattern,
-+ char* phps_pattern );
-
- /* Change the log file. */
- extern void httpd_set_logfp( httpd_server* hs, FILE* logfp );
-@@ -229,6 +236,8 @@
- ** If you don't have a current timeval handy just pass in 0.
- */
- extern void httpd_close_conn( httpd_conn* hc, struct timeval* nowP );
-+void httpd_complete_request( httpd_conn* hc, struct timeval* nowP, int logit );
-+int httpd_request_reset(httpd_conn* hc,int );
-
- /* Call this to de-initialize a connection struct and *really* free the
- ** mallocced strings.
-diff -ur thttpd-2.21b/mime_encodings.txt thttpd-2.21b-cool/mime_encodings.txt
---- thttpd-2.21b/mime_encodings.txt Wed May 10 03:22:28 2000
-+++ thttpd-2.21b-cool/mime_encodings.txt Tue May 6 21:13:57 2003
-@@ -3,6 +3,6 @@
- # A list of file extensions followed by the corresponding MIME encoding.
- # Extensions not found in the table proceed to the mime_types table.
-
--Z x-compress
--gz x-gzip
-+Z compress
-+gz gzip
- uu x-uuencode
-diff -ur thttpd-2.21b/mime_types.txt thttpd-2.21b-cool/mime_types.txt
---- thttpd-2.21b/mime_types.txt Sat Apr 14 04:53:30 2001
-+++ thttpd-2.21b-cool/mime_types.txt Tue May 6 21:13:57 2003
-@@ -1,135 +1,138 @@
--# mime_types.txt
--#
--# A list of file extensions followed by the corresponding MIME type.
--# Extensions not found in the table are returned as text/plain.
--
--html text/html; charset=%s
--htm text/html; charset=%s
--txt text/plain; charset=%s
--rtx text/richtext
--etx text/x-setext
--tsv text/tab-separated-values
--css text/css
--xml text/xml
--dtd text/xml
--
--gif image/gif
--jpg image/jpeg
--jpeg image/jpeg
--jpe image/jpeg
--jfif image/jpeg
--tif image/tiff
--tiff image/tiff
--pbm image/x-portable-bitmap
--pgm image/x-portable-graymap
--ppm image/x-portable-pixmap
--pnm image/x-portable-anymap
--xbm image/x-xbitmap
--xpm image/x-xpixmap
--xwd image/x-xwindowdump
--ief image/ief
--png image/png
--
--au audio/basic
--snd audio/basic
--aif audio/x-aiff
--aiff audio/x-aiff
--aifc audio/x-aiff
--ra audio/x-pn-realaudio
--ram audio/x-pn-realaudio
--rm audio/x-pn-realaudio
--rpm audio/x-pn-realaudio-plugin
--wav audio/wav
--mid audio/midi
--midi audio/midi
--kar audio/midi
--mpga audio/mpeg
--mp2 audio/mpeg
--mp3 audio/mpeg
--
--mpeg video/mpeg
--mpg video/mpeg
--mpe video/mpeg
--qt video/quicktime
--mov video/quicktime
--avi video/x-msvideo
--movie video/x-sgi-movie
--mv video/x-sgi-movie
--vx video/x-rad-screenplay
--
--a application/octet-stream
-+ez application/andrew-inset
-+hqx application/mac-binhex40
-+cpt application/mac-compactpro
-+doc application/msword
- bin application/octet-stream
-+dms application/octet-stream
-+lha application/octet-stream
-+lzh application/octet-stream
- exe application/octet-stream
--dump application/octet-stream
--o application/octet-stream
--class application/java
--js application/x-javascript
-+class application/octet-stream
-+so application/octet-stream
-+dll application/octet-stream
-+oda application/oda
-+pdf application/pdf
- ai application/postscript
- eps application/postscript
- ps application/postscript
--dir application/x-director
-+smi application/smil
-+smil application/smil
-+mif application/vnd.mif
-+xls application/vnd.ms-excel
-+ppt application/vnd.ms-powerpoint
-+wbxml application/vnd.wap.wbxml
-+wmlc application/vnd.wap.wmlc
-+wmlsc application/vnd.wap.wmlscriptc
-+bcpio application/x-bcpio
-+vcd application/x-cdlink
-+pgn application/x-chess-pgn
-+cpio application/x-cpio
-+csh application/x-csh
- dcr application/x-director
-+dir application/x-director
- dxr application/x-director
--fgd application/x-director
--aam application/x-authorware-map
--aas application/x-authorware-seg
--aab application/x-authorware-bin
--fh4 image/x-freehand
--fh7 image/x-freehand
--fh5 image/x-freehand
--fhc image/x-freehand
--fh image/x-freehand
--spl application/futuresplash
--swf application/x-shockwave-flash
- dvi application/x-dvi
-+spl application/x-futuresplash
- gtar application/x-gtar
- hdf application/x-hdf
--hqx application/mac-binhex40
--iv application/x-inventor
-+js application/x-javascript
-+skp application/x-koan
-+skd application/x-koan
-+skt application/x-koan
-+skm application/x-koan
- latex application/x-latex
--man application/x-troff-man
--me application/x-troff-me
--mif application/x-mif
--ms application/x-troff-ms
--oda application/oda
--pdf application/pdf
--rtf application/rtf
--bcpio application/x-bcpio
--cpio application/x-cpio
--sv4cpio application/x-sv4cpio
--sv4crc application/x-sv4crc
--sh application/x-shar
-+nc application/x-netcdf
-+cdf application/x-netcdf
-+sh application/x-sh
- shar application/x-shar
-+swf application/x-shockwave-flash
- sit application/x-stuffit
-+sv4cpio application/x-sv4cpio
-+sv4crc application/x-sv4crc
- tar application/x-tar
-+tcl application/x-tcl
- tex application/x-tex
--texi application/x-texinfo
- texinfo application/x-texinfo
-+texi application/x-texinfo
-+t application/x-troff
- tr application/x-troff
- roff application/x-troff
- man application/x-troff-man
- me application/x-troff-me
- ms application/x-troff-ms
--zip application/x-zip-compressed
--tsp application/dsptype
--wsrc application/x-wais-source
- ustar application/x-ustar
--cdf application/x-netcdf
--nc application/x-netcdf
--doc application/msword
--ppt application/powerpoint
--
--crt application/x-x509-ca-cert
--crl application/x-pkcs7-crl
--
-+src application/x-wais-source
-+xhtml application/xhtml+xml
-+xht application/xhtml+xml
-+zip application/zip
-+au audio/basic
-+snd audio/basic
-+mid audio/midi
-+midi audio/midi
-+kar audio/midi
-+mpga audio/mpeg
-+mp2 audio/mpeg
-+mp3 audio/mpeg
-+aif audio/x-aiff
-+aiff audio/x-aiff
-+aifc audio/x-aiff
-+m3u audio/x-mpegurl
-+ram audio/x-pn-realaudio
-+rm audio/x-pn-realaudio
-+rpm audio/x-pn-realaudio-plugin
-+ra audio/x-realaudio
-+wav audio/x-wav
-+pdb chemical/x-pdb
-+xyz chemical/x-xyz
-+bmp image/bmp
-+gif image/gif
-+ief image/ief
-+jpeg image/jpeg
-+jpg image/jpeg
-+jpe image/jpeg
-+png image/png
-+tiff image/tiff
-+tif image/tiff
-+djvu image/vnd.djvu
-+djv image/vnd.djvu
-+wbmp image/vnd.wap.wbmp
-+ras image/x-cmu-raster
-+pnm image/x-portable-anymap
-+pbm image/x-portable-bitmap
-+pgm image/x-portable-graymap
-+ppm image/x-portable-pixmap
-+rgb image/x-rgb
-+xbm image/x-xbitmap
-+xpm image/x-xpixmap
-+xwd image/x-xwindowdump
-+igs model/iges
-+iges model/iges
-+msh model/mesh
-+mesh model/mesh
-+silo model/mesh
- wrl model/vrml
- vrml model/vrml
--mime message/rfc822
--
--pac application/x-ns-proxy-autoconfig
--
-+css text/css
-+html text/html; charset=%s
-+htm text/html; charset=%s
-+asc text/plain; charset=%s
-+txt text/plain; charset=%s
-+rtx text/richtext
-+rtf text/rtf
-+sgml text/sgml
-+sgm text/sgml
-+tsv text/tab-separated-values
- wml text/vnd.wap.wml
--wmlc application/vnd.wap.wmlc
- wmls text/vnd.wap.wmlscript
--wmlsc application/vnd.wap.wmlscriptc
--wbmp image/vnd.wap.wbmp
-+etx text/x-setext
-+xml text/xml
-+xsl text/xml
-+mpeg video/mpeg
-+mpg video/mpeg
-+mpe video/mpeg
-+qt video/quicktime
-+mov video/quicktime
-+mxu video/vnd.mpegurl
-+avi video/x-msvideo
-+movie video/x-sgi-movie
-+ice x-conference/x-cooltalk
-diff -ur thttpd-2.21b/mmc.c thttpd-2.21b-cool/mmc.c
---- thttpd-2.21b/mmc.c Fri Apr 13 23:02:15 2001
-+++ thttpd-2.21b-cool/mmc.c Tue May 6 21:13:57 2003
-@@ -70,6 +70,9 @@
- unsigned int hash;
- int hash_idx;
- struct MapStruct* next;
-+ char nocache;
-+ size_t last_modified_len;
-+ char last_modified[100];
- } Map;
-
-
-@@ -93,12 +96,13 @@
-
-
- void*
--mmc_map( char* filename, struct stat* sbP, struct timeval* nowP )
-+mmc_map( char* filename, struct stat* sbP, struct timeval* nowP, int nocache, char **last_modified, size_t *last_modified_len )
- {
- time_t now;
- struct stat sb;
- Map* m;
- int fd;
-+ const char* rfc1123fmt = "%a, %d %b %Y %H:%M:%S GMT";
-
- /* Stat the file, if necessary. */
- if ( sbP != (struct stat*) 0 )
-@@ -130,7 +134,7 @@
- /* Yep. Just return the existing map */
- ++m->refcount;
- m->reftime = now;
-- return m->addr;
-+ goto done;
- }
-
- /* Open the file. */
-@@ -167,12 +171,13 @@
- m->ctime = sb.st_ctime;
- m->refcount = 1;
- m->reftime = now;
-+ m->nocache = (char) nocache;
-
- /* Avoid doing anything for zero-length files; some systems don't like
- ** to mmap them, other systems dislike mallocing zero bytes.
- */
- if ( m->size == 0 )
-- m->addr = (void*) 1; /* arbitrary non-NULL address */
-+ m->addr = (void*) 5; /* arbitrary non-NULL address */
- else
- {
- #ifdef HAVE_MMAP
-@@ -223,6 +228,13 @@
- maps = m;
- ++map_count;
-
-+ strftime( m->last_modified, sizeof(m->last_modified), rfc1123fmt, gmtime( &sb.st_mtime ) );
-+ m->last_modified_len = strlen(m->last_modified);
-+
-+done:
-+ *last_modified = m->last_modified;
-+ *last_modified_len = m->last_modified_len;
-+
- /* And return the address. */
- return m->addr;
- }
-@@ -231,27 +243,32 @@
- void
- mmc_unmap( void* addr, struct stat* sbP, struct timeval* nowP )
- {
-- Map* m = (Map*) 0;
-+ Map* m = (Map*) 0, **mm = &maps;
-
- /* Find the Map entry for this address. First try a hash. */
- if ( sbP != (struct stat*) 0 )
- {
- m = find_hash( sbP->st_ino, sbP->st_dev, sbP->st_size, sbP->st_ctime );
-- if ( m != (Map*) 0 && m->addr != addr )
-+ if ( m != (Map*) 0 && ( m->addr != addr || m->nocache == 1 ) )
- m = (Map*) 0;
- }
- /* If that didn't work, try a full search. */
- if ( m == (Map*) 0 )
-- for ( m = maps; m != (Map*) 0; m = m->next )
-+ for ( m = maps; m != (Map*) 0; m = m->next ) {
- if ( m->addr == addr )
- break;
-+ mm = &m->next;
-+ }
- if ( m == (Map*) 0 )
- syslog( LOG_ERR, "mmc_unmap failed to find entry!" );
- else if ( m->refcount <= 0 )
- syslog( LOG_ERR, "mmc_unmap found zero or negative refcount!" );
- else
- {
-- --m->refcount;
-+ if ( --m->refcount == 0 && m->nocache == 1 ) {
-+ really_unmap( mm );
-+ return;
-+ }
- if ( nowP != (struct timeval*) 0 )
- m->reftime = nowP->tv_sec;
- else
-diff -ur thttpd-2.21b/mmc.h thttpd-2.21b-cool/mmc.h
---- thttpd-2.21b/mmc.h Fri Apr 13 07:36:54 2001
-+++ thttpd-2.21b-cool/mmc.h Tue May 6 21:13:57 2003
-@@ -31,8 +31,9 @@
- /* Returns an mmap()ed area for the given file, or (void*) 0 on errors.
- ** If you have a stat buffer on the file, pass it in, otherwise pass 0.
- ** Same for the current time.
-+** Set nocache to 1, if this entry is supposed to be removed quickly.
- */
--extern void* mmc_map( char* filename, struct stat* sbP, struct timeval* nowP );
-+extern void* mmc_map( char* filename, struct stat* sbP, struct timeval* nowP, int nocache, char **last_modified, size_t *last_modified_len );
-
- /* Done with an mmap()ed area that was returned by mmc_map().
- ** If you have a stat buffer on the file, pass it in, otherwise pass 0.
-diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c
---- thttpd-2.21b/thttpd.c Tue Apr 24 00:41:57 2001
-+++ thttpd-2.21b-cool/thttpd.c Tue May 6 21:13:57 2003
-@@ -53,6 +53,10 @@
- #endif
- #include <unistd.h>
-
-+#include <sys/mman.h>
-+
-+#include <limits.h>
-+
- #include "fdwatch.h"
- #include "libhttpd.h"
- #include "mmc.h"
-@@ -66,6 +70,8 @@
- static char* dir;
- static int do_chroot, no_log, no_symlink, do_vhost, do_global_passwd;
- static char* cgi_pattern;
-+static char* php_pattern;
-+static char* phps_pattern;
- static char* url_pattern;
- static int no_empty_referers;
- static char* local_pattern;
-@@ -95,10 +101,10 @@
- httpd_conn* hc;
- int tnums[MAXTHROTTLENUMS]; /* throttle indexes */
- int numtnums;
-+ int keep_alive;
- long limit;
- time_t started_at;
-- Timer* idle_read_timer;
-- Timer* idle_send_timer;
-+ time_t last_io;
- Timer* wakeup_timer;
- Timer* linger_timer;
- long wouldblock_delay;
-@@ -106,17 +112,22 @@
- off_t bytes_sent;
- off_t bytes_to_send;
- } connecttab;
--static connecttab* connects;
-+static connecttab* connects, **free_connects;
-+static int next_free_connect;
- static int numconnects, maxconnects;
- static int httpd_conn_count;
-
- /* The connection states. */
--#define CNST_FREE 0
--#define CNST_READING 1
--#define CNST_SENDING 2
--#define CNST_PAUSING 3
--#define CNST_LINGERING 4
--
-+enum {
-+ CNST_FREE = 0,
-+ CNST_READING,
-+ CNST_SENDING,
-+ CNST_PAUSING,
-+ CNST_LINGERING,
-+ CNST_SENDING_RESP,
-+ CNST_READING_BODY,
-+ CNST_TOTAL_NR
-+};
-
- static httpd_server* hs = (httpd_server*) 0;
- int terminate = 0;
-@@ -140,23 +151,32 @@
- static int handle_newconnect( struct timeval* tvP, int listen_fd );
- static void handle_read( connecttab* c, struct timeval* tvP );
- static void handle_send( connecttab* c, struct timeval* tvP );
-+static void handle_send_resp( connecttab* c, struct timeval* tvP );
-+static void handle_read_body( connecttab* c, struct timeval* tvP );
- static void handle_linger( connecttab* c, struct timeval* tvP );
- static int check_throttles( connecttab* c );
-+static void timeout_conns( ClientData client_data, struct timeval* nowP );
- static void clear_throttles( connecttab* c, struct timeval* tvP );
- static void update_throttles( ClientData client_data, struct timeval* nowP );
--static void clear_connection( connecttab* c, struct timeval* tvP );
-+static void clear_connection( connecttab* c, struct timeval* tvP, int );
- static void really_clear_connection( connecttab* c, struct timeval* tvP );
--static void idle_read_connection( ClientData client_data, struct timeval* nowP );
--static void idle_send_connection( ClientData client_data, struct timeval* nowP );
- static void wakeup_connection( ClientData client_data, struct timeval* nowP );
- static void linger_clear_connection( ClientData client_data, struct timeval* nowP );
- static void occasional( ClientData client_data, struct timeval* nowP );
-+static void periodic_jobs( ClientData client_data, struct timeval* nowP );
- #ifdef STATS_TIME
- static void show_stats( ClientData client_data, struct timeval* nowP );
- #endif /* STATS_TIME */
- static void logstats( struct timeval* nowP );
- static void thttpd_logstats( long secs );
-+static void boot_request(connecttab *c, struct timeval *tvP);
-+
-+typedef void (*handler_func)(connecttab*, struct timeval *);
-+
-+handler_func handler_array[CNST_TOTAL_NR] =
-+{NULL, handle_read, handle_send, NULL, handle_linger, handle_send_resp, handle_read_body};
-
-+#define RUN_HANDLER(type, c) if (handler_array[type]) handler_array[type](c, &tv)
-
- static void
- handle_term( int sig )
-@@ -177,7 +197,7 @@
- return;
-
- /* Re-open the log file. */
-- if ( logfile != (char*) 0 )
-+ if ( logfile != (char*) 0 && strcmp(logfile, "-") != 0)
- {
- logfp = fopen( logfile, "a" );
- if ( logfp == (FILE*) 0 )
-@@ -198,6 +218,8 @@
- }
-
-
-+time_t httpd_time_now;
-+
- static void
- handle_usr2( int sig )
- {
-@@ -217,7 +239,6 @@
- int num_ready;
- int cnum, ridx;
- connecttab* c;
-- httpd_conn* hc;
- httpd_sockaddr sa4;
- httpd_sockaddr sa6;
- int gotv4, gotv6;
-@@ -270,7 +291,9 @@
- no_log = 1;
- logfp = (FILE*) 0;
- }
-- else
-+ else if (strcmp(logfile, "-") == 0) {
-+ logfp = stdout;
-+ } else
- {
- logfp = fopen( logfile, "a" );
- if ( logfp == (FILE*) 0 )
-@@ -420,7 +443,8 @@
- hostname,
- gotv4 ? &sa4 : (httpd_sockaddr*) 0, gotv6 ? &sa6 : (httpd_sockaddr*) 0,
- port, cgi_pattern, charset, cwd, no_log, logfp, no_symlink, do_vhost,
-- do_global_passwd, url_pattern, local_pattern, no_empty_referers );
-+ do_global_passwd, url_pattern, local_pattern, no_empty_referers,
-+ php_pattern, phps_pattern);
- if ( hs == (httpd_server*) 0 )
- exit( 1 );
-
-@@ -430,6 +454,12 @@
- syslog( LOG_CRIT, "tmr_create(occasional) failed" );
- exit( 1 );
- }
-+
-+ if (tmr_create(0, timeout_conns, JunkClientData, 30 * 1000, 1) == 0) {
-+ syslog(LOG_CRIT, "tmr_create(timeout_conns) failed");
-+ exit(1);
-+ }
-+
- if ( numthrottles > 0 )
- {
- /* Set up the throttles timer. */
-@@ -439,6 +469,12 @@
- exit( 1 );
- }
- }
-+
-+ if (tmr_create(0, periodic_jobs, JunkClientData, 2000, 1) == 0) {
-+ syslog(LOG_CRIT, "tmr_create failed");
-+ exit(1);
-+ }
-+
- #ifdef STATS_TIME
- /* Set up the stats timer. */
- if ( tmr_create( (struct timeval*) 0, show_stats, JunkClientData, STATS_TIME * 1000L, 1 ) == (Timer*) 0 )
-@@ -454,12 +490,14 @@
- /* If we're root, try to become someone else. */
- if ( getuid() == 0 )
- {
-+#ifndef __CYGWIN__
- /* Set aux groups to null. */
- if ( setgroups( 0, (const gid_t*) 0 ) < 0 )
- {
- syslog( LOG_CRIT, "setgroups - %m" );
- exit( 1 );
- }
-+#endif
- /* Set primary group. */
- if ( setgid( gid ) < 0 )
- {
-@@ -495,13 +533,17 @@
- }
- maxconnects -= SPARE_FDS;
- connects = NEW( connecttab, maxconnects );
-+ free_connects = malloc(sizeof(connecttab *) * maxconnects);
-+ next_free_connect = maxconnects;
- if ( connects == (connecttab*) 0 )
- {
- syslog( LOG_CRIT, "out of memory allocating a connecttab" );
- exit( 1 );
- }
-+
- for ( cnum = 0; cnum < maxconnects; ++cnum )
- {
-+ free_connects[cnum] = &connects[maxconnects - cnum - 1];
- connects[cnum].conn_state = CNST_FREE;
- connects[cnum].hc = (httpd_conn*) 0;
- }
-@@ -518,6 +560,9 @@
-
- /* Main loop. */
- (void) gettimeofday( &tv, (struct timezone*) 0 );
-+ httpd_time_now = tv.tv_sec;
-+ periodic_jobs(JunkClientData, &tv);
-+
- while ( ( ! terminate ) || numconnects > 0 )
- {
- /* Do the fd watch. */
-@@ -530,6 +575,7 @@
- exit( 1 );
- }
- (void) gettimeofday( &tv, (struct timezone*) 0 );
-+ httpd_time_now = tv.tv_sec;
- if ( num_ready == 0 )
- {
- /* No fd's are ready - run the timers. */
-@@ -565,16 +611,10 @@
- c = (connecttab*) fdwatch_get_client_data( ridx );
- if ( c == (connecttab*) 0 )
- continue;
-- hc = c->hc;
-- if ( c->conn_state == CNST_READING &&
-- fdwatch_check_fd( hc->conn_fd ) )
-- handle_read( c, &tv );
-- else if ( c->conn_state == CNST_SENDING &&
-- fdwatch_check_fd( hc->conn_fd ) )
-- handle_send( c, &tv );
-- else if ( c->conn_state == CNST_LINGERING &&
-- fdwatch_check_fd( hc->conn_fd ) )
-- handle_linger( c, &tv );
-+#if DO_UNNECESSARY_CHECK_FD
-+ fdwatch_check_fd(c->hc->conn_fd);
-+#endif
-+ RUN_HANDLER(c->conn_state, c);
- }
- tmr_run( &tv );
-
-@@ -627,6 +667,8 @@
- #else /* CGI_PATTERN */
- cgi_pattern = (char*) 0;
- #endif /* CGI_PATTERN */
-+ php_pattern = "**.php";
-+ phps_pattern = "**.phps";
- url_pattern = (char*) 0;
- no_empty_referers = 0;
- local_pattern = (char*) 0;
-@@ -833,6 +875,16 @@
- value_required( name, value );
- cgi_pattern = e_strdup( value );
- }
-+ else if ( strcasecmp( name, "phppat" ) == 0 )
-+ {
-+ value_required( name, value );
-+ php_pattern = e_strdup( value );
-+ }
-+ else if ( strcasecmp( name, "phpspat" ) == 0 )
-+ {
-+ value_required( name, value );
-+ phps_pattern = e_strdup( value );
-+ }
- else if ( strcasecmp( name, "urlpat" ) == 0 )
- {
- value_required( name, value );
-@@ -1196,8 +1248,10 @@
- logstats( &tv );
- for ( cnum = 0; cnum < maxconnects; ++cnum )
- {
-- if ( connects[cnum].conn_state != CNST_FREE )
-+ if ( connects[cnum].conn_state != CNST_FREE ) {
-+ httpd_complete_request( connects[cnum].hc, &tv, 1 );
- httpd_close_conn( connects[cnum].hc, &tv );
-+ }
- if ( connects[cnum].hc != (httpd_conn*) 0 )
- {
- httpd_destroy_conn( connects[cnum].hc );
-@@ -1214,6 +1268,7 @@
- }
- mmc_destroy();
- tmr_destroy();
-+ free( (void*) free_connects );
- free( (void*) connects );
- if ( throttles != (throttletab*) 0 )
- free( (void*) throttles );
-@@ -1234,7 +1289,7 @@
- for (;;)
- {
- /* Is there room in the connection table? */
-- if ( numconnects >= maxconnects )
-+ if ( numconnects >= maxconnects || next_free_connect == 0 )
- {
- /* Out of connection slots. Run the timers, then the
- ** existing connections, and maybe we'll free up a slot
-@@ -1245,10 +1300,10 @@
- return 0;
- }
- /* Find a free connection entry. */
-- for ( cnum = 0; cnum < maxconnects; ++cnum )
-- if ( connects[cnum].conn_state == CNST_FREE )
-- break;
-- c = &connects[cnum];
-+
-+ c = free_connects[--next_free_connect];
-+ free_connects[next_free_connect] = NULL;
-+
- /* Make the httpd_conn if necessary. */
- if ( c->hc == (httpd_conn*) 0 )
- {
-@@ -1267,24 +1322,18 @@
- {
- case GC_FAIL:
- case GC_NO_MORE:
-+ free_connects[next_free_connect++] = c;
- return 1;
- }
- c->conn_state = CNST_READING;
- ++numconnects;
- client_data.p = c;
-- c->idle_read_timer = tmr_create(
-- tvP, idle_read_connection, client_data, IDLE_READ_TIMELIMIT * 1000L,
-- 0 );
-- if ( c->idle_read_timer == (Timer*) 0 )
-- {
-- syslog( LOG_CRIT, "tmr_create(idle_read_connection) failed" );
-- exit( 1 );
-- }
-- c->idle_send_timer = (Timer*) 0;
- c->wakeup_timer = (Timer*) 0;
- c->linger_timer = (Timer*) 0;
- c->bytes_sent = 0;
- c->numtnums = 0;
-+ c->keep_alive = 0;
-+ c->last_io = httpd_time_now;
-
- /* Set the connection file descriptor to no-delay mode. */
- httpd_set_ndelay( c->hc->conn_fd );
-@@ -1297,12 +1346,79 @@
- }
- }
-
-+static void
-+setup_read_body(connecttab *c, struct timeval *tvP)
-+{
-+ httpd_conn *hc = c->hc;
-+ int already, missing, unused, nalloc;
-+
-+ c->conn_state = CNST_READING_BODY;
-+
-+ hc->read_body_into_mem = 0;
-+
-+ already = hc->read_idx - hc->checked_idx;
-+ missing = hc->contentlength - already;
-+ unused = hc->read_size - hc->read_idx;
-+ nalloc = missing - unused;
-+
-+ if (missing > 16384) {
-+ char filename[] = "/tmp/thttpd.upload.XXXXXX";
-+ int tmp = mkstemp(filename);
-+
-+ if (tmp >= 0) {
-+ void *p;
-+ size_t sz = hc->contentlength + hc->checked_idx + 10;
-+
-+ unlink(filename);
-+
-+ ftruncate(tmp, sz);
-+ p = mmap(NULL, sz,
-+ PROT_READ|PROT_WRITE, MAP_PRIVATE, tmp, 0);
-+
-+ if (p != MAP_FAILED) {
-+ memcpy(p, hc->read_buf, hc->read_idx);
-+ free(hc->read_buf);
-+ hc->read_size = sz;
-+ hc->read_buf = p;
-+ hc->read_buf_is_mmap = 1;
-+ }
-+ close(tmp);
-+ }
-+
-+ if (!hc->read_buf_is_mmap) {
-+ clear_connection( c, tvP, 0 );
-+ return;
-+ }
-+ } else {
-+ httpd_realloc_str(&hc->read_buf, &hc->read_size, hc->checked_idx + hc->contentlength + 10);
-+ }
-+
-+ fdwatch_del_fd( hc->conn_fd );
-+ fdwatch_add_fd( hc->conn_fd, c, FDW_READ );
-+}
-+
-+static void
-+setup_sending(connecttab *c, int state, struct timeval *tvP)
-+{
-+ httpd_conn *hc = c->hc;
-+ ClientData client_data;
-+
-+ c->conn_state = state;
-+ c->started_at = tvP->tv_sec;
-+ c->wouldblock_delay = 0;
-+ client_data.p = c;
-+
-+ fdwatch_del_fd( hc->conn_fd );
-+ fdwatch_add_fd( hc->conn_fd, c, FDW_WRITE );
-+}
-+
-+static void handle_request( connecttab *c, struct timeval *tvP);
-+
-
- static void
- handle_read( connecttab* c, struct timeval* tvP )
- {
- int sz;
-- ClientData client_data;
- httpd_conn* hc = c->hc;
-
- /* Is there room in our buffer to read more bytes? */
-@@ -1311,7 +1427,7 @@
- if ( hc->read_size > 5000 )
- {
- httpd_send_err( hc, 400, httpd_err400title, "", httpd_err400form, "" );
-- clear_connection( c, tvP );
-+ clear_connection( c, tvP, 0 );
- return;
- }
- httpd_realloc_str(
-@@ -1327,14 +1443,53 @@
- ** EWOULDBLOCK; however, this apparently can happen if a packet gets
- ** garbled.
- */
-- if ( sz == 0 || ( sz < 0 && ( errno != EWOULDBLOCK ) ) )
-- {
-- httpd_send_err( hc, 400, httpd_err400title, "", httpd_err400form, "" );
-- clear_connection( c, tvP );
-+ if ( sz == 0 ) {
-+ if (! c->keep_alive) {
-+ httpd_send_err( hc, 400, httpd_err400title, "", httpd_err400form, "" );
-+ }
-+ clear_connection( c, tvP, 0 );
-+ return;
-+ } else if ( sz < 0 ) {
-+ if (errno != EWOULDBLOCK) {
-+ clear_connection( c, tvP, 0 );
-+ }
- return;
-+ }
-+
-+ /* If this is a persistent PHP connection, we must not receive
-+ ** any further requests on this connection. Some broken HTTP/1.1
-+ ** implementations (e.g. Mozilla 1.0.1) are known to do
-+ ** pipelining on a connection, although a prior response included
-+ ** Connection: close
-+ */
-+ if (c->hc->file_address == (char *) 1) {
-+ return;
- }
-- hc->read_idx += sz;
-+
-+ c->last_io = httpd_time_now;
-+ if (sz > 0) hc->read_idx += sz;
-+
-+ /*
-+ ** if we start getting new data on this socket, "promote" it
-+ ** to read timeout
-+ */
-+ if ( hc->keep_alive ) {
-+ ClientData client_data;
-
-+
-+ client_data.p = c;
-+
-+ hc->keep_alive = 0;
-+ }
-+ handle_request(c, tvP);
-+ }
-+
-+
-+static void
-+handle_request( connecttab *c, struct timeval *tvP)
-+{
-+ httpd_conn* hc = c->hc;
-+
- /* Do we have a complete request yet? */
- switch ( httpd_got_request( hc ) )
- {
-@@ -1342,14 +1497,14 @@
- return;
- case GR_BAD_REQUEST:
- httpd_send_err( hc, 400, httpd_err400title, "", httpd_err400form, "" );
-- clear_connection( c, tvP );
-+ clear_connection( c, tvP, 0 );
- return;
- }
-
- /* Yes. Try parsing and resolving it. */
- if ( httpd_parse_request( hc ) < 0 )
- {
-- clear_connection( c, tvP );
-+ clear_connection( c, tvP, 0 );
- return;
- }
-
-@@ -1358,18 +1513,28 @@
- {
- httpd_send_err(
- hc, 503, httpd_err503title, "", httpd_err503form, hc->encodedurl );
-- clear_connection( c, tvP );
-+ clear_connection( c, tvP, 0 );
- return;
- }
-+ boot_request(c, tvP);
-+}
-
-+static void boot_request(connecttab *c, struct timeval *tvP)
-+{
-+ httpd_conn *hc = c->hc;
- /* Start the connection going. */
- if ( httpd_start_request( hc, tvP ) < 0 )
- {
- /* Something went wrong. Close down the connection. */
-- clear_connection( c, tvP );
-+ clear_connection( c, tvP, 0 );
- return;
- }
-
-+ if ( hc->read_body_into_mem ) {
-+ setup_read_body( c, tvP );
-+ return;
-+ }
-+
- /* Fill in bytes_to_send. */
- if ( hc->got_range )
- {
-@@ -1384,37 +1549,25 @@
- {
- /* No file address means someone else is handling it. */
- c->bytes_sent = hc->bytes_sent;
-- clear_connection( c, tvP );
-+ clear_connection( c, tvP, 1 );
- return;
- }
-+ if (hc->file_address == (char *) 1) {
-+ c->last_io = (time_t) LONG_MAX;
-+ c->wouldblock_delay = 0;
-+ return;
-+ }
- if ( c->bytes_sent >= c->bytes_to_send )
- {
- /* There's nothing to send. */
-- clear_connection( c, tvP );
-+ clear_connection( c, tvP, 1 );
- return;
- }
-
- /* Cool, we have a valid connection and a file to send to it. */
-- c->conn_state = CNST_SENDING;
-- c->started_at = tvP->tv_sec;
-- c->wouldblock_delay = 0;
-- client_data.p = c;
-- tmr_cancel( c->idle_read_timer );
-- c->idle_read_timer = (Timer*) 0;
-- c->idle_send_timer = tmr_create(
-- tvP, idle_send_connection, client_data, IDLE_SEND_TIMELIMIT * 1000L,
-- 0 );
-- if ( c->idle_send_timer == (Timer*) 0 )
-- {
-- syslog( LOG_CRIT, "tmr_create(idle_send_connection) failed" );
-- exit( 1 );
-- }
--
-- fdwatch_del_fd( hc->conn_fd );
-- fdwatch_add_fd( hc->conn_fd, c, FDW_WRITE );
-+ setup_sending(c, CNST_SENDING, tvP);
- }
-
--
- static void
- handle_send( connecttab* c, struct timeval* tvP )
- {
-@@ -1443,6 +1596,9 @@
- iv[1].iov_base = &(hc->file_address[c->bytes_sent]);
- iv[1].iov_len = MIN( c->bytes_to_send - c->bytes_sent, c->limit );
- sz = writev( hc->conn_fd, iv, 2 );
-+/*
-+printf("**RESPONSE2 [%d]** len = %d\n%*.*s\n", hc->conn_fd, hc->responselen, hc->responselen, hc->responselen, hc->response);
-+*/
- }
-
- if ( sz == 0 ||
-@@ -1486,12 +1642,12 @@
- */
- if ( errno != EPIPE && errno != EINVAL && errno != ECONNRESET )
- syslog( LOG_ERR, "write - %m sending %.80s", hc->encodedurl );
-- clear_connection( c, tvP );
-+ clear_connection( c, tvP, 0 );
- return;
- }
-
- /* Ok, we wrote something. */
-- tmr_reset( tvP, c->idle_send_timer );
-+ c->last_io = httpd_time_now;
- /* Was this a headers + file writev()? */
- if ( hc->responselen > 0 )
- {
-@@ -1500,7 +1656,7 @@
- {
- /* Yes; move the unwritten part to the front of the buffer. */
- int newlen = hc->responselen - sz;
-- (void) memcpy( hc->response, &(hc->response[sz]), newlen );
-+ (void) memmove( hc->response, &(hc->response[sz]), newlen );
- hc->responselen = newlen;
- sz = 0;
- }
-@@ -1519,7 +1675,7 @@
- if ( c->bytes_sent >= c->bytes_to_send )
- {
- /* This conection is finished! */
-- clear_connection( c, tvP );
-+ clear_connection( c, tvP, 1 );
- return;
- }
-
-@@ -1560,6 +1716,9 @@
- char buf[1024];
- int r;
-
-+/*
-+printf("*LINGER read\n");
-+*/
- /* In lingering-close mode we just read and ignore bytes. An error
- ** or EOF ends things, otherwise we go until a timeout.
- */
-@@ -1569,6 +1728,61 @@
- }
-
-
-+static void
-+handle_read_body(connecttab *c, struct timeval *tvP)
-+{
-+ httpd_conn *hc = c->hc;
-+ int n;
-+
-+ n = read(hc->conn_fd, hc->read_buf + hc->read_idx,
-+ hc->contentlength - (hc->read_idx - hc->checked_idx));
-+
-+ if (n <= 0) {
-+ if (errno == EAGAIN)
-+ return;
-+ clear_connection(c, tvP, 0);
-+ return;
-+ }
-+
-+ hc->read_idx += n;
-+
-+ if (hc->contentlength == hc->read_idx - hc->checked_idx) {
-+ boot_request(c, tvP);
-+ return;
-+ }
-+}
-+
-+static void
-+handle_send_resp(connecttab *c, struct timeval *tvP)
-+{
-+ httpd_conn* hc = c->hc;
-+ int n = send(hc->conn_fd, hc->response, hc->responselen, 0);
-+ int dokeep = 1;
-+
-+ if (n < 0) {
-+ if (errno == EAGAIN)
-+ return;
-+
-+ dokeep = 0;
-+ goto clear;
-+ }
-+
-+ c->last_io = httpd_time_now;
-+
-+ if (n == hc->responselen) {
-+clear:
-+ hc->response = realloc(hc->response, hc->maxresponse + 1);
-+ hc->responselen = 0;
-+
-+ clear_connection(c, tvP, dokeep);
-+ return;
-+ }
-+
-+ hc->responselen -= n;
-+
-+ memmove(hc->response, hc->response + n, hc->responselen);
-+}
-+
- static int
- check_throttles( connecttab* c )
- {
-@@ -1635,23 +1849,18 @@
-
-
- static void
--clear_connection( connecttab* c, struct timeval* tvP )
-+clear_connection( connecttab* c, struct timeval* tvP, int doKeep )
- {
- ClientData client_data;
-+ int linger;
-
- /* If we haven't actually sent the buffered response yet, do so now. */
-- httpd_write_response( c->hc );
-+ if (c->hc->responselen && c->conn_state != CNST_SENDING_RESP) {
-+ setup_sending(c, CNST_SENDING_RESP, tvP);
-
-- if ( c->idle_read_timer != (Timer*) 0 )
-- {
-- tmr_cancel( c->idle_read_timer );
-- c->idle_read_timer = 0;
-- }
-- if ( c->idle_send_timer != (Timer*) 0 )
-- {
-- tmr_cancel( c->idle_send_timer );
-- c->idle_send_timer = 0;
-+ return;
- }
-+
- if ( c->wakeup_timer != (Timer*) 0 )
- {
- tmr_cancel( c->wakeup_timer );
-@@ -1669,13 +1878,36 @@
- ** circumstances that make a lingering close necessary. If the flag
- ** isn't set we do the real close now.
- */
-- if ( c->hc->should_linger )
-+
-+ if ( c->hc->do_keep_alive && doKeep)
- {
-- c->conn_state = CNST_LINGERING;
-+ httpd_conn *hc = c->hc;
-+ c->conn_state = CNST_READING;
-+
-+ client_data.p = c;
-+ c->bytes_sent = 0;
-+ c->numtnums = 0;
-+ c->keep_alive = 1;
-+
-+ httpd_complete_request( c->hc, tvP, 1 );
-+
- fdwatch_del_fd( c->hc->conn_fd );
- fdwatch_add_fd( c->hc->conn_fd, c, FDW_READ );
-+
-+ httpd_request_reset( c->hc, 1 );
-+
-+ hc->read_idx -= hc->checked_idx;
-+ memmove(hc->read_buf, hc->read_buf + hc->checked_idx, hc->read_idx);
-+ hc->checked_idx = 0;
-+
- /* Make sure we are still in no-delay mode. */
- httpd_set_ndelay( c->hc->conn_fd );
-+ handle_request(c, tvP);
-+ }
-+ else if ( c->hc->should_linger )
-+ {
-+ c->conn_state = CNST_LINGERING;
-+
- client_data.p = c;
- c->linger_timer = tmr_create(
- tvP, linger_clear_connection, client_data, LINGER_TIME * 1000L, 0 );
-@@ -1684,9 +1916,19 @@
- syslog( LOG_CRIT, "tmr_create(linger_clear_connection) failed" );
- exit( 1 );
- }
-+
-+ httpd_complete_request( c->hc, tvP, 1 );
-+
-+ fdwatch_del_fd( c->hc->conn_fd );
-+ fdwatch_add_fd( c->hc->conn_fd, c, FDW_READ );
-+ /* Make sure we are still in no-delay mode. */
-+ httpd_set_ndelay( c->hc->conn_fd );
- }
-- else
-+ else
-+ {
-+ httpd_complete_request( c->hc, tvP, !c->keep_alive );
- really_clear_connection( c, tvP );
-+ }
- }
-
-
-@@ -1702,45 +1944,12 @@
- tmr_cancel( c->linger_timer );
- c->linger_timer = 0;
- }
-+ free_connects[next_free_connect++] = c;
- c->conn_state = CNST_FREE;
- --numconnects;
- }
-
-
--static void
--idle_read_connection( ClientData client_data, struct timeval* nowP )
-- {
-- connecttab* c;
--
-- c = (connecttab*) client_data.p;
-- c->idle_read_timer = (Timer*) 0;
-- if ( c->conn_state != CNST_FREE )
-- {
-- syslog( LOG_INFO,
-- "%.80s connection timed out reading",
-- httpd_ntoa( &c->hc->client_addr ) );
-- httpd_send_err( c->hc, 408, httpd_err408title, "", httpd_err408form, "" );
-- clear_connection( c, nowP );
-- }
-- }
--
--
--static void
--idle_send_connection( ClientData client_data, struct timeval* nowP )
-- {
-- connecttab* c;
--
-- c = (connecttab*) client_data.p;
-- c->idle_send_timer = (Timer*) 0;
-- if ( c->conn_state != CNST_FREE )
-- {
-- syslog( LOG_INFO,
-- "%.80s connection timed out sending",
-- httpd_ntoa( &c->hc->client_addr ) );
-- clear_connection( c, nowP );
-- }
-- }
--
-
- static void
- wakeup_connection( ClientData client_data, struct timeval* nowP )
-@@ -1783,6 +1992,43 @@
- }
- #endif /* STATS_TIME */
-
-+char httpd_now_buf[100];
-+
-+
-+
-+static void
-+periodic_jobs( ClientData client_data, struct timeval* nowP )
-+{
-+ const char* rfc1123fmt = "%a, %d %b %Y %H:%M:%S GMT";
-+ struct tm *t;
-+ char date_nozone[100];
-+ const char* cernfmt_nozone = "%d/%b/%Y:%H:%M:%S";
-+ char data[100];
-+ int zone;
-+ char sign;
-+
-+ strftime( httpd_now_buf, sizeof(httpd_now_buf), rfc1123fmt, gmtime( &nowP->tv_sec ) );
-+
-+ t = localtime(&nowP->tv_sec);
-+ strftime( date_nozone, sizeof(date_nozone), cernfmt_nozone, t );
-+#ifdef HAVE_TM_GMTOFF
-+ zone = t->tm_gmtoff / 60L;
-+#else
-+ zone = -timezone / 60L;
-+ /* Probably have to add something about daylight time here. */
-+#endif
-+ if ( zone >= 0 )
-+ sign = '+';
-+ else
-+ {
-+ sign = '-';
-+ zone = -zone;
-+ }
-+ zone = ( zone / 60 ) * 100 + zone % 60;
-+ hs->log_date_len = sprintf( hs->log_date, "%s %c%04d", date_nozone, sign,
-+ zone );
-+}
-+
-
- /* Generate debugging statistics syslog messages for all packages. */
- static void
-@@ -1826,3 +2072,41 @@
- stats_connections = stats_bytes = 0L;
- stats_simultaneous = 0;
- }
-+
-+static void
-+timeout_conns(ClientData client_data, struct timeval *nowP)
-+{
-+ connecttab *c = connects, *ce = c + maxconnects;
-+ time_t now = nowP->tv_sec;
-+ int r = 0, w = 0;
-+ int checked = 0;
-+
-+ while (c < ce) {
-+ switch (c->conn_state) {
-+ case CNST_SENDING:
-+ case CNST_SENDING_RESP:
-+ checked++;
-+ if ((now - c->last_io) > IDLE_SEND_TIMELIMIT) {
-+ clear_connection( c, nowP, 0 );
-+ w++;
-+ }
-+ break;
-+ case CNST_READING:
-+ checked++;
-+ if ((now - c->last_io) > IDLE_READ_TIMELIMIT) {
-+ clear_connection( c, nowP, 0 );
-+ r++;
-+ }
-+ break;
-+ case CNST_FREE: break;
-+ default: checked++; break;
-+ }
-+ c++;
-+ if (checked >= numconnects) break;
-+ }
-+
-+ if (r > 0 || w > 0) {
-+ syslog(LOG_INFO, "Expired %d/%d connections in read/write state", r, w);
-+ }
-+}
-+
diff --git a/sapi/tux/CREDITS b/sapi/tux/CREDITS
deleted file mode 100644
index 3b7aa70c01..0000000000
--- a/sapi/tux/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-tux
-Sascha Schumann
diff --git a/sapi/tux/README b/sapi/tux/README
deleted file mode 100644
index 167e52f3ca..0000000000
--- a/sapi/tux/README
+++ /dev/null
@@ -1,86 +0,0 @@
-README FOR THE TUX MODULE (by Sascha Schumann)
-($Date$)
-
- This is a SAPI module for the TUX web-server by Ingo Molnar.
-
- The special thing about TUX is that it is integrated into the Linux
- kernel and thus provides high-speed serving of static files.
-
- The web-server provides a user-space API which allows arbitrary
- plug-ins to be made available.
-
- All requests to the PHP userspace module are currently serialized.
-
- This module is of alpha quality. Due to incomplete APIs, HTTP
- authentication and handling of POST requests has not been
- implemented yet.
-
- SECURITY NOTE: PHP will happily run everything under the
- web-root through the parser; so be careful what you put
- there.
-
- Note that requests are served in a chroot'ed environment.
- The initialization of PHP does not take place in the chroot'ed
- environment, so that e.g. /usr/local/lib/php.ini is treated
- as usual.
-
-REQUIRED DOWNLOADS
-
- 1. TUX
-
- http://people.redhat.com/~mingo/TUX-patches/QuickStart-TUX.txt
-
- 2. PHP 4.0.x
-
- Download:
- http://www.php.net/
-
- Snapshots from CVS:
- http://snaps.php.net/
-
-
-BUILD INSTRUCTIONS
-
- 1. Install TUX as outlined in the QuickStart text.
- Create /tux-modules where modules will reside.
-
- 2. Prepare PHP
-
- $ cd php-*
- $ ./configure \
- --with-tux=/tux-modules \
- <further PHP options>
- # make install
-
- You can see the list of valid PHP options by executing
-
- $ ./configure --help
-
- 3. Touch a file in your web-root 'php4.tux'. This will
- cause requests to '/php4.tux' to be redirected to the
- userspace module php4.tux.
-
- 4. Start TUX with something like
-
- # tux -d -t 8 -r /www -m /tux-modules php4.tux
-
- (daemon mode, eight threads, web-root /www, modules in
- /tux-modules, load php4.tux)
-
- BEFORE running this command, the kernel side of TUX has to
- be properly setup.
-
- 5. Try to access
-
- http://yourserver/php4.tux?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000
-
- It should display the PHP credits page.
-
- To access a script /foo/bar.php, use
-
- http://yourserver/php4.tux?/foo/bar.php
-
- Parameters can be appended:
-
- http://yourserver/php4.tux?/foo/bar.php&var=value
-
diff --git a/sapi/tux/config.m4 b/sapi/tux/config.m4
deleted file mode 100644
index ea12e67c4b..0000000000
--- a/sapi/tux/config.m4
+++ /dev/null
@@ -1,18 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_TUX=no
-
-AC_ARG_WITH(tux,
-[ --with-tux=MODULEDIR Build PHP as a TUX module (Linux only)],[
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $withval/php4.tux.so"
- AC_CHECK_HEADERS(tuxmodule.h,[:],[AC_MSG_ERROR([Cannot find tuxmodule.h])])
- PHP_SELECT_SAPI(tux, shared, php_tux.c)
- PHP_TUX=yes
-])
-
-AC_MSG_CHECKING(for TUX)
-AC_MSG_RESULT($PHP_TUX)
-
-unset PHP_TUX
diff --git a/sapi/tux/php.sym b/sapi/tux/php.sym
deleted file mode 100644
index b968c5f5a2..0000000000
--- a/sapi/tux/php.sym
+++ /dev/null
@@ -1,2 +0,0 @@
-TUXAPI_handle_events
-TUXAPI_init
diff --git a/sapi/tux/php_tux.c b/sapi/tux/php_tux.c
deleted file mode 100644
index c2045173a3..0000000000
--- a/sapi/tux/php_tux.c
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-#include "php.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "php_variables.h"
-
-#include "ext/standard/php_smart_str.h"
-
-#include "tuxmodule.h"
-
-#include <sys/uio.h>
-
-#if 0
-#include <pthread.h>
-#endif
-
-void tux_closed_conn(int fd);
-
-enum {
- PHP_TUX_BACKGROUND_CONN = 1
-};
-
-typedef struct {
- user_req_t *req;
- void (*on_close)(int);
- int tux_action;
- struct iovec *header_vec;
- int number_vec;
-} php_tux_globals;
-
-static php_tux_globals tux_globals;
-
-#define TG(v) (tux_globals.v)
-
-static int sapi_tux_ub_write(const char *str, uint str_length TSRMLS_DC)
-{
- int n;
- int m;
- const char *estr;
-
- /* combine headers and body */
- if (TG(number_vec)) {
- struct iovec *vec = TG(header_vec);
-
- n = TG(number_vec);
- vec[n].iov_base = (void *) str;
- vec[n++].iov_len = str_length;
-
- /* XXX: this might need more complete error handling */
- if ((m = writev(TG(req)->sock, vec, n)) == -1 && errno == EPIPE)
- php_handle_aborted_connection();
-
- if (m > 0)
- TG(req)->bytes_sent += str_length;
-
- TG(number_vec) = 0;
- return str_length;
- }
-
- estr = str + str_length;
-
- while (str < estr) {
- n = send(TG(req)->sock, str, estr - str, 0);
-
- if (n == -1 && errno == EPIPE)
- php_handle_aborted_connection();
- if (n == -1 && errno == EAGAIN)
- continue;
- if (n <= 0)
- return n;
-
- str += n;
- }
-
- n = str_length - (estr - str);
-
- TG(req)->bytes_sent += n;
-
- return n;
-}
-
-static int sapi_tux_send_headers(sapi_headers_struct *sapi_headers)
-{
- char buf[1024];
- struct iovec *vec;
- int n;
- int max_headers;
- zend_llist_position pos;
- sapi_header_struct *h;
- size_t len;
- char *status_line;
- int locate_cl;
- TSRMLS_FETCH();
-
- max_headers = 30;
- n = 1;
-
- vec = malloc(sizeof(struct iovec) * max_headers);
- status_line = malloc(30);
-
- /* safe sprintf use */
- len = sprintf(status_line, "HTTP/1.1 %d NA\r\n", SG(sapi_headers).http_response_code);
-
- vec[0].iov_base = status_line;
- vec[0].iov_len = len;
-
- TG(req)->http_status = SG(sapi_headers).http_response_code;
-
- if (TG(tux_action) == TUX_ACTION_FINISH_CLOSE_REQ && TG(req)->http_version == HTTP_1_1)
- locate_cl = 1;
- else
- locate_cl = 0;
-
- h = zend_llist_get_first_ex(&sapi_headers->headers, &pos);
- while (h) {
- if (locate_cl
- && strncasecmp(h->header, "Content-length:", sizeof("Content-length:")-1) == 0) {
- TG(tux_action) = TUX_ACTION_FINISH_REQ;
- locate_cl = 0;
- }
-
- vec[n].iov_base = h->header;
- vec[n++].iov_len = h->header_len;
- if (n >= max_headers - 3) {
- max_headers *= 2;
- vec = realloc(vec, sizeof(struct iovec) * max_headers);
- }
- vec[n].iov_base = "\r\n";
- vec[n++].iov_len = 2;
-
- h = zend_llist_get_next_ex(&sapi_headers->headers, &pos);
- }
-
- vec[n].iov_base = "\r\n";
- vec[n++].iov_len = 2;
-
- TG(number_vec) = n;
- TG(header_vec) = vec;
-
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-static int sapi_tux_read_post(char *buffer, uint count_bytes)
-{
-#if 0
- int amount = 0;
- TSRMLS_FETCH();
-
- TG(req)->objectlen = count_bytes;
- TG(req)->object_addr = buffer;
- if (tux(TUX_ACTION_READ_POST_DATA, TG(req)))
- return 0;
-
- TG(read_post_data) = 1;
-
- return TG(req)->objectlen;
-#else
- return 0;
-#endif
-}
-
-static char *sapi_tux_read_cookies(void)
-{
- TSRMLS_FETCH();
-
- return TG(req)->cookies;
-}
-
-#define BUF_SIZE 512
-#define ADD_STRING(name) \
- php_register_variable(name, buf, track_vars_array TSRMLS_CC)
-
-static void sapi_tux_register_variables(zval *track_vars_array TSRMLS_DC)
-{
- char buf[BUF_SIZE + 1];
- char *p;
- sapi_header_line ctr = {0};
-
- ctr.line = buf;
- ctr.line_len = sprintf(buf, "Server: %s", TUXAPI_version);
- sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
-
- php_register_variable("PHP_SELF", SG(request_info).request_uri, track_vars_array TSRMLS_CC);
- php_register_variable("SERVER_SOFTWARE", TUXAPI_version, track_vars_array TSRMLS_CC);
- php_register_variable("GATEWAY_INTERFACE", "CGI/1.1", track_vars_array TSRMLS_CC);
- php_register_variable("REQUEST_METHOD", (char *) SG(request_info).request_method, track_vars_array TSRMLS_CC);
- php_register_variable("DOCUMENT_ROOT", TUXAPI_docroot, track_vars_array TSRMLS_CC);
- php_register_variable("SERVER_NAME", TUXAPI_servername, track_vars_array TSRMLS_CC);
- php_register_variable("REQUEST_URI", SG(request_info).request_uri, track_vars_array TSRMLS_CC);
- php_register_variable("PATH_TRANSLATED", SG(request_info).path_translated, track_vars_array TSRMLS_CC);
-
- p = inet_ntoa(TG(req)->client_host);
- /* string representation of IPs are never larger than 512 bytes */
- if (p) {
- memcpy(buf, p, strlen(p) + 1);
- ADD_STRING("REMOTE_ADDR");
- ADD_STRING("REMOTE_HOST");
- }
-
- sprintf(buf, "%d", CGI_SERVER_PORT(TG(req)));
- ADD_STRING("SERVER_PORT");
-
-#if 0
- snprintf(buf, BUF_SIZE, "/%s", TG(hc)->pathinfo);
- ADD_STRING("PATH_INFO");
-
- snprintf(buf, BUF_SIZE, "/%s", TG(hc)->origfilename);
- ADD_STRING("SCRIPT_NAME");
-#endif
-
-#define CONDADD(name, field) \
- if (TG(req)->field[0]) { \
- php_register_variable(#name, TG(req)->field, track_vars_array TSRMLS_CC); \
- }
-
- CONDADD(HTTP_REFERER, referer);
- CONDADD(HTTP_USER_AGENT, user_agent);
- CONDADD(HTTP_ACCEPT, accept);
- CONDADD(HTTP_ACCEPT_ENCODING, accept_encoding);
- CONDADD(HTTP_ACCEPT_LANGUAGE, accept_language);
- CONDADD(HTTP_COOKIE, cookies);
- CONDADD(CONTENT_TYPE, content_type);
-
-#if 0
- if (TG(hc)->contentlength != -1) {
- sprintf(buf, "%ld", (long) TG(hc)->contentlength);
- ADD_STRING("CONTENT_LENGTH");
- }
-#endif
-
-#if 0
- if (TG(hc)->authorization[0])
- php_register_variable("AUTH_TYPE", "Basic", track_vars_array TSRMLS_CC);
-#endif
-}
-
-
-static int php_tux_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-static sapi_module_struct tux_sapi_module = {
- "tux",
- "tux",
-
- php_tux_startup,
- php_module_shutdown_wrapper,
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- sapi_tux_ub_write,
- NULL,
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error,
-
- NULL,
- sapi_tux_send_headers,
- NULL,
- sapi_tux_read_post,
- sapi_tux_read_cookies,
-
- sapi_tux_register_variables,
- NULL, /* Log message */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-static void tux_module_main(TSRMLS_D)
-{
- zend_file_handle file_handle;
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
- if (php_request_startup(TSRMLS_C) == FAILURE) {
- return;
- }
-
- php_execute_script(&file_handle TSRMLS_CC);
- php_request_shutdown(NULL);
-}
-
-static void tux_request_ctor(TSRMLS_D)
-{
- char buf[1024];
- int offset;
- size_t filename_len;
- size_t cwd_len;
- smart_str s = {0};
- char *p;
-
- TG(number_vec) = 0;
- TG(header_vec) = NULL;
- SG(request_info).query_string = strdup(TG(req)->query);
-
- smart_str_appends_ex(&s, "/", 1);
- smart_str_appends_ex(&s, TG(req)->query, 1);
- smart_str_0(&s);
- p = strchr(s.c, '&');
- if (p)
- *p = '\0';
- SG(request_info).path_translated = s.c;
-
- s.c = NULL;
- smart_str_appendc_ex(&s, '/', 1);
- smart_str_appends_ex(&s, TG(req)->objectname, 1);
- smart_str_0(&s);
- SG(request_info).request_uri = s.c;
- SG(request_info).request_method = CGI_REQUEST_METHOD(TG(req));
- SG(sapi_headers).http_response_code = 200;
- SG(request_info).content_type = TG(req)->content_type;
- SG(request_info).content_length = 0; /* TG(req)->contentlength; */
-
-#if 0
- php_handle_auth_data(TG(hc)->authorization TSRMLS_CC);
-#endif
-}
-
-static void tux_request_dtor(TSRMLS_D)
-{
- if (TG(header_vec)) {
- /* free status_line */
- free(TG(header_vec)[0].iov_base);
- free(TG(header_vec));
- }
- if (SG(request_info).query_string)
- free(SG(request_info).query_string);
- free(SG(request_info).request_uri);
- free(SG(request_info).path_translated);
-}
-
-#if 0
-static void *separate_thread(void *bla)
-{
- int fd;
- int i = 0;
-
- fd = (int) bla;
-
- while (i++ < 5) {
- send(fd, "test<br />\n", 9, 0);
- sleep(1);
- }
-
- tux(TUX_ACTION_CONTINUE_REQ, (user_req_t *) fd);
- /* We HAVE to trigger some event on the fd. Otherwise
- fast_thread won't wake up, so that the eventloop
- won't be entered -> TUX hangs */
- shutdown(fd, 2);
- pthread_exit(NULL);
-}
-#endif
-
-int TUXAPI_handle_events(user_req_t *req)
-{
- TSRMLS_FETCH();
-
- if (req->event == PHP_TUX_BACKGROUND_CONN) {
- tux_closed_conn(req->sock);
- return tux(TUX_ACTION_FINISH_CLOSE_REQ, req);
- }
-
- TG(req) = req;
- TG(tux_action) = TUX_ACTION_FINISH_CLOSE_REQ;
-
- tux_request_ctor(TSRMLS_C);
-
- tux_module_main(TSRMLS_C);
-
- tux_request_dtor(TSRMLS_C);
-
- return tux(TG(tux_action), req);
-}
-
-void tux_register_on_close(void (*arg)(int))
-{
- TG(on_close) = arg;
-}
-
-void tux_closed_conn(int fd)
-{
- TSRMLS_FETCH();
-
- if (TG(on_close)) TG(on_close)(fd);
-}
-
-int tux_get_fd(void)
-{
- TSRMLS_FETCH();
-
- return TG(req)->sock;
-}
-
-void tux_set_dont_close(void)
-{
- TSRMLS_FETCH();
-
- TG(req)->event = PHP_TUX_BACKGROUND_CONN;
- tux(TUX_ACTION_POSTPONE_REQ, TG(req));
- TG(tux_action) = TUX_ACTION_EVENTLOOP;
-}
-
-void TUXAPI_init(void)
-{
- sapi_startup(&tux_sapi_module);
- tux_sapi_module.startup(&tux_sapi_module);
- SG(server_context) = (void *) 1;
-}
-
-void doesnotmatter_fini(void)
-{
- if (SG(server_context) != NULL) {
- tux_sapi_module.shutdown(&tux_sapi_module);
- sapi_shutdown();
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/sapi/webjames/CREDITS b/sapi/webjames/CREDITS
deleted file mode 100644
index 73a7983e92..0000000000
--- a/sapi/webjames/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-WebJames
-Alex Waugh
diff --git a/sapi/webjames/README b/sapi/webjames/README
deleted file mode 100644
index 9a316efed7..0000000000
--- a/sapi/webjames/README
+++ /dev/null
@@ -1,28 +0,0 @@
-README for WebJames SAPI module
-by Alex Waugh <alex@alexwaugh.com>
-
-This is a SAPI module for the WebJames HTTP server, which runs on the
-RISC OS operating system.
-
-
-DOWNLOADS
-
-A recent (February 2002 or later) version of the GCCSDK cross compiler
-http://www.hard-mofo.dsvr.net/
-
-WebJames 0.35 or later
-http://www.webjames.alexwaugh.com/
-
-
-BUILDING
-
-$ cd php4
-$ ./configure \
- --host=arm-riscos-aof \
- --with-webjames=../webjames/src \
- --with-config-file-path=/Choices: \
- other PHP options
-$ make install
-$ cd ../webjames
-$ ./configure --enable-php
-$ make
diff --git a/sapi/webjames/config.m4 b/sapi/webjames/config.m4
deleted file mode 100644
index 10e0001680..0000000000
--- a/sapi/webjames/config.m4
+++ /dev/null
@@ -1,20 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_ARG_WITH(webjames,
-[ --with-webjames=SRCDIR Build PHP as a WebJames module (RISC OS only)],[
- PHP_EXPAND_PATH($withval, WEBJAMES)
- INSTALL_IT="\
- echo 'PHP_LIBS = -l$abs_srcdir/$SAPI_STATIC \$(PHP_LIBS) \$(EXTRA_LIBS)' > $WEBJAMES/build/php; \
- echo 'PHP_LDFLAGS = \$(NATIVE_RPATHS) \$(PHP_LDFLAGS)' >> $WEBJAMES/build/php; \
- echo 'PHP_CFLAGS = -DPHP \$(COMMON_FLAGS) \$(EXTRA_CFLAGS) -I$abs_srcdir/sapi/webjames' >> $WEBJAMES/build/php;"
- PHP_WEBJAMES="yes, using $WEBJAMES"
- PHP_ADD_INCLUDE($WEBJAMES)
- PHP_SELECT_SAPI(webjames, static, webjames.c)
-],[
- PHP_WEBJAMES="no"
-])
-
-AC_MSG_CHECKING(for webjames)
-AC_MSG_RESULT($PHP_WEBJAMES)
diff --git a/sapi/webjames/php_webjames.h b/sapi/webjames/php_webjames.h
deleted file mode 100644
index 62a74b0bd4..0000000000
--- a/sapi/webjames/php_webjames.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Alex Waugh <alex@alexwaugh.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef PHP_WEBJAMES_H
-#define PHP_WEBJAMES_H
-
-#include "webjames.h"
-
-void webjames_php_shutdown(void);
-int webjames_php_init(void);
-void webjames_php_request(struct connection *conn);
-
-#endif
diff --git a/sapi/webjames/webjames.c b/sapi/webjames/webjames.c
deleted file mode 100644
index beb8bca7a9..0000000000
--- a/sapi/webjames/webjames.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Alex Waugh <alex@alexwaugh.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "php.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "php_variables.h"
-
-#define WEBJAMES_PHP_ONLY
-#include "php_webjames.h"
-
-#include <unixlib/local.h>
-
-#define WEBJAMES_SAPI_VERSION "1.0.0"
-
-typedef struct {
- struct connection *conn; /*structure holding all the details of the current request*/
- int bodyread; /*amount of POST body read*/
- closefn oldclose; /*function to call to close the connection*/
-} php_webjames_globals;
-
-static php_webjames_globals webjames_globals;
-
-#define WG(v) (webjames_globals.v)
-
-static int sapi_webjames_ub_write(const char *str, uint str_length TSRMLS_DC)
-/*unbuffered write - send data straight out to socket*/
-{
- int bytes;
-
- bytes = webjames_writebuffer(WG(conn),str,str_length);
- if (bytes<0) {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- if (!PG(ignore_user_abort)) {
- zend_bailout();
- }
- }
- return bytes;
-}
-
-static void sapi_webjames_send_header(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC)
-/*send an HTTP header*/
-{
- if (WG(conn)->flags.outputheaders) {
- if (sapi_header)
- webjames_writebuffer(WG(conn), sapi_header->header, sapi_header->header_len);
- webjames_writestring(WG(conn), "\r\n");
- }
-}
-
-static int sapi_webjames_read_post(char *buffer, uint count_bytes TSRMLS_DC)
-/*read some of the post data*/
-{
- if (WG(conn)->body==NULL) return 0;
- if (count_bytes+WG(bodyread)>WG(conn)->bodysize) count_bytes=WG(conn)->bodysize-WG(bodyread);
- memcpy(buffer, WG(conn)->body+WG(bodyread), count_bytes);
- WG(bodyread)+=count_bytes;
- return count_bytes;
-}
-
-static char *sapi_webjames_read_cookies(TSRMLS_D)
-{
- return WG(conn)->cookie;
-}
-
-#define BUF_SIZE 512
-#define ADD_STRING(name,string)\
- php_register_variable(name, string, track_vars_array TSRMLS_CC)
-
-#define ADD_NUM(name,field) {\
- snprintf(buf, BUF_SIZE, "%d", WG(conn)->field);\
- php_register_variable(name, buf, track_vars_array TSRMLS_CC);\
-}
-
-#define ADD_FIELD(name, field) \
- if (WG(conn)->field) { \
- php_register_variable(name, WG(conn)->field, track_vars_array TSRMLS_CC); \
- }
-
-static void sapi_webjames_register_variables(zval *track_vars_array TSRMLS_DC)
-{
- char buf[BUF_SIZE + 1];
-
- buf[BUF_SIZE] = '\0';
-
- ADD_STRING("SERVER_SOFTWARE", configuration.server);
- ADD_STRING("SERVER_NAME", configuration.serverip);
- ADD_FIELD("SERVER_PROTOCOL", protocol);
- ADD_NUM("SERVER_PORT", port);
- ADD_STRING("SERVER_ADMIN",configuration.webmaster);
- ADD_STRING("GATEWAY_INTERFACE", "CGI/1.1");
- ADD_STRING("DOCUMENT_ROOT", configuration.site);
-
- ADD_FIELD("REQUEST_METHOD", methodstr);
- ADD_FIELD("REQUEST_URI", requesturi);
- ADD_STRING("PATH_TRANSLATED", SG(request_info).path_translated);
- ADD_FIELD("SCRIPT_NAME", uri);
- ADD_FIELD("PHP_SELF", uri);
- ADD_FIELD("QUERY_STRING", args);
-
-
- snprintf(buf, BUF_SIZE, "%d.%d.%d.%d", WG(conn)->ipaddr[0], WG(conn)->ipaddr[1], WG(conn)->ipaddr[2], WG(conn)->ipaddr[3]);
- ADD_STRING("REMOTE_ADDR", buf);
- if (WG(conn)->dnsstatus == DNS_OK) ADD_FIELD("REMOTE_HOST", host);
-
- if ((WG(conn)->method == METHOD_POST) || (WG(conn)->method == METHOD_PUT)) {
- ADD_NUM("CONTENT_LENGTH", bodysize);
- ADD_FIELD("CONTENT_TYPE", type);
- }
-
- if ((WG(conn)->method == METHOD_PUT) || (WG(conn)->method == METHOD_DELETE)) ADD_FIELD("ENTITY_PATH", requesturi);
-
- if (WG(conn)->pwd) {
- ADD_STRING("AUTH_TYPE", "basic");
- ADD_FIELD("REMOTE_USER", authorization);
- }
-
- ADD_FIELD("HTTP_COOKIE", cookie);
- ADD_FIELD("HTTP_USER_AGENT", useragent);
- ADD_FIELD("HTTP_REFERER", referer);
- ADD_FIELD("HTTP_ACCEPT", accept);
- ADD_FIELD("HTTP_ACCEPT_LANGUAGE", acceptlanguage);
- ADD_FIELD("HTTP_ACCEPT_CHARSET", acceptcharset);
- ADD_FIELD("HTTP_ACCEPT_ENCODING", acceptencoding);
-}
-
-static void webjames_module_main(TSRMLS_D)
-{
- zend_file_handle file_handle;
- FILE *fp=NULL;
- char *path;
-
- /* Convert filename to Unix format*/
- __riscosify_control|=__RISCOSIFY_DONT_CHECK_DIR;
- path = __unixify(WG(conn)->filename,0,NULL,1024,0);
- if (path) SG(request_info).path_translated = estrdup(path);
-
- SG(request_info).query_string = WG(conn)->args;
- SG(request_info).request_uri = WG(conn)->requesturi;
- SG(request_info).request_method = WG(conn)->methodstr;
- if (WG(conn)->method==METHOD_HEAD) {
- SG(request_info).headers_only = 1;
- } else {
- SG(request_info).headers_only = 0;
- }
- SG(sapi_headers).http_response_code = 200;
- SG(request_info).content_type = WG(conn)->type;
- SG(request_info).content_length = WG(conn)->bodysize;
-
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
- if (WG(conn)->authorization) {
- char *colon=strchr(WG(conn)->authorization,':');
- if (colon) {
- SG(request_info).auth_user = emalloc(colon-WG(conn)->authorization+1);
- if (SG(request_info).auth_user) {
- memcpy(SG(request_info).auth_user,WG(conn)->authorization,colon-WG(conn)->authorization);
- SG(request_info).auth_user[colon-WG(conn)->authorization]='\0';
- SG(request_info).auth_password = estrdup(colon+1);
- }
- }
- }
-
- /*ensure that syslog calls get logged separately from WebJames' main log */
- openlog("PHP",0,0);
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
- if (php_request_startup(TSRMLS_C) == FAILURE) {
- return;
- }
-
- php_execute_script(&file_handle TSRMLS_CC);
- php_request_shutdown(NULL);
-}
-
-static void webjames_php_close(struct connection *conn, int force)
-/*called by webjames if it wants to close the connection*/
-{
- TSRMLS_FETCH();
-
- php_request_shutdown(NULL);
- WG(oldclose)(conn,force);
-}
-
-void webjames_php_request(struct connection *conn)
-/*called by WebJames to start handler*/
-{
- TSRMLS_FETCH();
-
- WG(conn) = conn;
- WG(bodyread) = 0;
- WG(oldclose) = conn->close;
- conn->close=webjames_php_close;
-
- webjames_module_main(TSRMLS_C);
-
- WG(oldclose)(WG(conn), 0);
-}
-
-static void php_info_webjames(ZEND_MODULE_INFO_FUNC_ARGS)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "SAPI module version", WEBJAMES_SAPI_VERSION);
- php_info_print_table_row(2, "WebJames version", WEBJAMES_VERSION " (" WEBJAMES_DATE ")");
- php_info_print_table_end();
-}
-
-static zend_module_entry php_webjames_module = {
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
- "WebJames",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- php_info_webjames,
-#if ZEND_MODULE_API_NO >= 20010901
- WEBJAMES_SAPI_VERSION,
-#endif
- STANDARD_MODULE_PROPERTIES
-};
-
-
-static int php_webjames_startup(sapi_module_struct *sapi_module)
-{
- if(php_module_startup(sapi_module, &php_webjames_module, 1) == FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-static sapi_module_struct sapi_module = {
- "webjames", /* name */
- "WebJames", /* pretty name */
-
- php_webjames_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- sapi_webjames_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- NULL, /* header handler */
- NULL, /* send headers handler */
- sapi_webjames_send_header, /* send header handler */
- sapi_webjames_read_post, /* read POST data */
- sapi_webjames_read_cookies, /* read Cookies */
-
- sapi_webjames_register_variables, /* register server variables */
- NULL, /* Log message */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-int webjames_php_init(void)
-/*called when WebJames initialises*/
-{
- TSRMLS_FETCH();
- if (strcmp(configuration.webjames_h_revision,WEBJAMES_H_REVISION)!=0) {
- /*This file was compiled against a different revision of
- webjames.h than webjames was, which could be bad news*/
- webjames_writelog(0,"PHP module is compiled for WebJames (%s) and was linked with a different version (%s)",WEBJAMES_H_REVISION,configuration.webjames_h_revision);
- return 0; /*failed to initialise*/
- }
- sapi_startup(&sapi_module);
- sapi_module.startup(&sapi_module);
- SG(server_context) = (void *) 1;
- return 1; /*initialised correctly*/
-}
-
-void webjames_php_shutdown(void)
-/*called when WebJames is about to quit*/
-{
- sapi_module.shutdown(&sapi_module);
- sapi_shutdown();
-}
diff --git a/scan_makefile_in.awk b/scan_makefile_in.awk
deleted file mode 100644
index 0c6d20398f..0000000000
--- a/scan_makefile_in.awk
+++ /dev/null
@@ -1,32 +0,0 @@
-BEGIN {
- mode=0
- sources=""
-}
-
-mode == 0 && /^LTLIBRARY_SOURCES.*\\$/ {
- if (match($0, "[^=]*$")) {
- sources=substr($0, RSTART, RLENGTH-1)
- }
- mode=1
- next
-}
-
-mode == 0 && /^LTLIBRARY_SOURCES.*/ {
- if (match($0, "[^=]*$")) {
- sources=substr($0, RSTART, RLENGTH)
- }
-}
-
-mode == 1 && /.*\\$/ {
- sources=sources substr($0, 0, length - 1)
- next
-}
-
-mode == 1 {
- sources=sources $0
- mode=0
-}
-
-END {
- print sources
-}
diff --git a/scripts/Makefile.frag b/scripts/Makefile.frag
deleted file mode 100644
index fa552edfca..0000000000
--- a/scripts/Makefile.frag
+++ /dev/null
@@ -1,66 +0,0 @@
-
-#
-# Build environment install
-#
-
-phpincludedir = $(includedir)/php
-phpbuilddir = $(prefix)/lib/php/build
-
-BUILD_FILES = \
- scripts/phpize.m4 \
- build/mkdep.awk \
- build/shtool \
- Makefile.global \
- scan_makefile_in.awk \
- acinclude.m4
-
-bin_SCRIPTS = phpize php-config
-bin_src_SCRIPTS = phpextdist
-
-install-build:
- @echo "Installing build environment: $(INSTALL_ROOT)$(phpbuilddir)/"
- @$(mkinstalldirs) $(INSTALL_ROOT)$(phpbuilddir) $(INSTALL_ROOT)$(bindir) && \
- (cd $(top_srcdir) && cp $(BUILD_FILES) $(INSTALL_ROOT)$(phpbuilddir))
-
-HEADER_DIRS = \
- / \
- Zend \
- TSRM \
- ext/standard \
- ext/session \
- ext/xml \
- ext/xml/expat \
- main \
- main/streams \
- ext/mbstring \
- ext/pgsql \
- regex
-
-install-headers:
- -@for i in $(HEADER_DIRS); do \
- paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
- done; \
- $(mkinstalldirs) $$paths && \
- echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
- for i in $(HEADER_DIRS); do \
- (cd $(top_srcdir)/$$i && cp -p *.h $(INSTALL_ROOT)$(phpincludedir)/$$i; \
- cd $(top_builddir)/$$i && cp -p *.h $(INSTALL_ROOT)$(phpincludedir)/$$i) 2>/dev/null || true; \
- done; \
- cd $(top_srcdir)/sapi/embed && cp -p *.h $(INSTALL_ROOT)$(phpincludedir)/main
-
-install-programs:
- @echo "Installing helper programs: $(INSTALL_ROOT)$(bindir)/"
- @for prog in $(bin_SCRIPTS); do \
- echo " program: $$prog"; \
- $(INSTALL) -m 755 $(builddir)/$$prog $(INSTALL_ROOT)$(bindir)/$$prog; \
- done
- @for prog in $(bin_src_SCRIPTS); do \
- echo " program: $$prog"; \
- $(INSTALL) -m 755 $(top_srcdir)/scripts/$$prog $(INSTALL_ROOT)$(bindir)/$$prog; \
- done
-
-$(builddir)/phpize: $(srcdir)/phpize.in $(top_builddir)/config.status
- (CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status)
-
-$(builddir)/php-config: $(srcdir)/php-config.in $(top_builddir)/config.status
- (CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status)
diff --git a/scripts/apache/apconf-conv.sh b/scripts/apache/apconf-conv.sh
deleted file mode 100755
index 6126bdc27d..0000000000
--- a/scripts/apache/apconf-conv.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-if [ "$1" = "" ]; then
- echo "Usage: $0 /somewhere/httpd.conf"
- exit 1
-fi
-
-if [ ! -w $1 ]; then
- echo "You cannot write to $1"
- exit 1
-fi
-
-TMPFILE=tmpfile.$$
-
-awk -f conffix.awk <$1 >$TMPFILE
-
-if [ "$?" != 0 ]; then
- exit 1
-fi
-
-mv -f $1 $1.orig
-mv -f $TMPFILE $1
-exit 0
-
diff --git a/scripts/apache/aphtaccess-conv.sh b/scripts/apache/aphtaccess-conv.sh
deleted file mode 100755
index 1af59d2843..0000000000
--- a/scripts/apache/aphtaccess-conv.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-if [ "$1" = "" ]; then
- echo "Usage: $0 /somewhere/.htaccess"
- exit 1
-fi
-
-if [ ! -w $1 ]; then
- echo "You cannot write to $1"
- exit 1
-fi
-
-TMPFILE=tmpfile.$$
-
-awk -f htaccessfix.awk <$1 >$TMPFILE
-
-if [ "$?" != 0 ]; then
- exit 1
-fi
-
-mv -f $1 $1.orig
-mv -f $TMPFILE $1
-exit 0
-
diff --git a/scripts/apache/conffix.awk b/scripts/apache/conffix.awk
deleted file mode 100644
index 88be6fade7..0000000000
--- a/scripts/apache/conffix.awk
+++ /dev/null
@@ -1,23 +0,0 @@
-# $Id$
-
-/^[ \t]*php3_*/ {
- phpcommand=substr($1,6)
- phpvalue=tolower($2)
- print "<IfModule mod_php3.c>"
- print $0
- print "</IfModule>"
- print "<IfModule mod_php4.c>"
- if (phpvalue=="on") {
- print "php_admin_flag " phpcommand " on"
- } else if (phpvalue=="off") {
- print "php_admin_flag " phpcommand " off"
- } else {
- print "php_admin_value " phpcommand " " substr($0,index($0,$1)+length($1)+1)
- }
- print "</IfModule>"
-}
-
-! /^[ \t]*php3_*/ {
- print $0
-}
-
diff --git a/scripts/apache/htaccessfix.awk b/scripts/apache/htaccessfix.awk
deleted file mode 100644
index 3c784cd335..0000000000
--- a/scripts/apache/htaccessfix.awk
+++ /dev/null
@@ -1,23 +0,0 @@
-# $Id$
-
-/^[ \t]*php3_*/ {
- phpcommand=substr($1,6)
- phpvalue=tolower($2)
- print "<IfModule mod_php3.c>"
- print $0
- print "</IfModule>"
- print "<IfModule mod_php4.c>"
- if (phpvalue=="on") {
- print "php_flag " phpcommand " on"
- } else if (phpvalue=="off") {
- print "php_flag " phpcommand " off"
- } else {
- print "php_value " phpcommand " " substr($0,index($0,$1)+length($1)+1)
- }
- print "</IfModule>"
-}
-
-! /^[ \t]*php3_*/ {
- print $0
-}
-
diff --git a/scripts/dev/conv_proto b/scripts/dev/conv_proto
deleted file mode 100755
index fad9cfaa83..0000000000
--- a/scripts/dev/conv_proto
+++ /dev/null
@@ -1,30 +0,0 @@
-#! /bin/sh
-#
-# do some automatic conversion of prototypes
-#
-
-if test "$1" = "" ; then
- echo "usage: $0 list-of-files"
- exit 1
-fi
-
-tmpfile=`mktemp -q /tmp/asd.XXXXXX`
-
-if test "$?" != "0" ; then
- echo "$0: cannot create temporary file"
- exit 1
-fi
-
-for file in ${1+"$@"} ; do
- echo "working on $file"
- cat $file | \
- sed -e \
- 's/void php3_\(.*\)(INTERNAL_FUNCTION_PARAMETERS)/PHP_FUNCTION(\1)/' \
- -e 's/^extern void /void /' \
- -e 's/^extern PHP_FUNCTION/PHP_FUNCTION/' > $tmpfile
- cp $tmpfile $file
-done
-
-rm -f $tmpfile
-
-exit 0
diff --git a/scripts/dev/conv_z_macros b/scripts/dev/conv_z_macros
deleted file mode 100755
index 7d15c71202..0000000000
--- a/scripts/dev/conv_z_macros
+++ /dev/null
@@ -1,61 +0,0 @@
-#! /bin/sh
-#
-# +----------------------------------------------------------------------+
-# | PHP Version 4 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997-2002 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Author: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-
-for i in $@; do
- echo -n "Processing $i... "
- sed \
- -e 's/(\*\([^()]\+\))->type/Z_TYPE_PP(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)->type/Z_TYPE_P(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)\.type/Z_TYPE(\1)/g' \
- -e 's/(\*\([^()]\+\))->value\.dval/Z_DVAL_PP(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.dval/Z_DVAL_P(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.dval/Z_DVAL(\1)/g' \
- -e 's/(\*\([^()]\+\))->value\.lval/Z_LVAL_PP(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.lval/Z_LVAL_P(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.lval/Z_LVAL(\1)/g' \
- -e 's/(\*\([^()]\+\))->value\.ht/Z_ARRVAL_PP(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.ht/Z_ARRVAL_P(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.ht/Z_ARRVAL(\1)/g' \
- -e 's/(\*\([^()]\+\))->value\.str\.val/Z_STRVAL_PP(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.str\.val/Z_STRVAL_P(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.str\.val/Z_STRVAL(\1)/g' \
- -e 's/(\*\([^()]\+\))->value\.str\.len/Z_STRLEN_PP(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.str\.len/Z_STRLEN_P(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.str\.len/Z_STRLEN(\1)/g' \
- -e 's/(\*\([^()]\+\))->value\.obj\.properties/Z_OBJPROP_PP(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.obj\.properties/Z_OBJPROP_P(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.obj\.properties/Z_OBJPROP(\1)/g' \
- -e 's/(\*\([^()]\+\))->value\.obj\.ce/Z_OBJCE_PP(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.obj\.ce/Z_OBJCE_P(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.obj\.ce/Z_OBJCE(\1)/g' \
- -e 's/(\*\([^()]\+\))->value\.obj/Z_OBJ_PP(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.obj/Z_OBJ_P(\1)/g' \
- -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.obj/Z_OBJ(\1)/g' \
- -e 's/\([a-zA-Z_][a-zA-Z_0-9]*\)->Z_\([A-Z_]\+\)(/Z_\2(\1->/g' \
- -e 's/\([a-zA-Z_][a-zA-Z_0-9]*\)->Z_\([A-Z_]\+\)(/Z_\2(\1->/g' \
- -e 's/\([a-zA-Z_][a-zA-Z_0-9]*\)->Z_\([A-Z_]\+\)(/Z_\2(\1->/g' \
- -e 's/\([a-zA-Z_][a-zA-Z_0-9]*\)\.Z_\([A-Z_]\+\)(/Z_\2(\1./g' \
- -e 's/\([a-zA-Z_][a-zA-Z_0-9]*\)\.Z_\([A-Z_]\+\)(/Z_\2(\1./g' \
- -e 's/\([a-zA-Z_][a-zA-Z_0-9]*\)\.Z_\([A-Z_]\+\)(/Z_\2(\1./g' \
- < $i > tmp && cp tmp $i
- echo "DONE"
-done
-
-rm -f tmp
diff --git a/scripts/dev/credits b/scripts/dev/credits
deleted file mode 100755
index b76fb311df..0000000000
--- a/scripts/dev/credits
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-awkprog='
-BEGIN { FS = "\n"; RS = "" }
-{ print "CREDIT_LINE(\""$1"\", \""$2"\");" }'
-
-for what in ext sapi
-do
- file=ext/standard/credits_$what.h
- cat >$file <<END
-/*
- DO NOT EDIT THIS FILE!
-
- it has been automaticaly created by php4/scripts/credits from
- the information found in the various php4/ext/.../CREDITS and
- php4/sapi/.../CREDITS files
-
- if you want to change an entry you have to edit the appropriate
- CREDITS file instead
-
-*/
-
-END
- # Do not process skeleton #
- files=`find "$what" -name CREDITS | grep -v "$what"/skeleton/CREDITS`
- awk "$awkprog" $files | sort -f | uniq >> $file
-done
diff --git a/scripts/ext_skel_ng/README b/scripts/ext_skel_ng/README
deleted file mode 100644
index 10d5cfd355..0000000000
--- a/scripts/ext_skel_ng/README
+++ /dev/null
@@ -1,36 +0,0 @@
-sorry, no real documentation yet ...
-just a short look at what is going on
-
-ext_skel_ng.php gets an extension description
-from an "extension.xml" file and generates working
-code and documentation stubs from that
-
-call "php ext_skel_ng.php" to see it at work,
-it will create a dummy extension including
-
-- module globals and ini paramter setup
-- function registration and stubbs
-- documentation framework
-- config.m4 (only minimal for now)
-- ...
-
-almost every aspect of an extension may now be
-configured using one xml description file instead
-of the old mixture of command line parameters
-and a proto file
-
-it is even possible to embed function code into
-the xml description right away, so it should be
-possible to create complete working extensions
-from just the xml description without further
-editing in a not to distant future
-
-for now almost all the 'helpfull comments' have
-been removed from the generated code. some of
-them (like 'uncomment this if you have ini params)
-just don't make sense anymore, others will come
-back (configurable) at a later state
-
-... have fun!
-
-Hartmut Holzgraefe <hholzgra@php.net>
diff --git a/scripts/ext_skel_ng/TODO b/scripts/ext_skel_ng/TODO
deleted file mode 100644
index b05e2d8f3b..0000000000
--- a/scripts/ext_skel_ng/TODO
+++ /dev/null
@@ -1,19 +0,0 @@
-- *more* input checking
-- config.m4 support for
- - header checks
- - ...
-- class implementation support
-- more documentation stuff
- - classes
- - requirements (see also confing.m4)
-- protos
- - object type specification (as in resources)
- - pass by reference
-- more licenses
- - GPL (with exception to allow linking against PHP)
- - QPL
- - MPL?
- - Artistic
- - ...
- - dual/multiple licensing?
-- generate CREDITS and EXPERIMENTAL (for alpha, beta, gamma versions) \ No newline at end of file
diff --git a/scripts/ext_skel_ng/config_m4.php b/scripts/ext_skel_ng/config_m4.php
deleted file mode 100644
index af0a16d513..0000000000
--- a/scripts/ext_skel_ng/config_m4.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-class config_m4 {
- # name, with[], libs[], language, files[]
- var $name;
- var $language = "c";
- var $with = false;
- var $libs = array();
- var $files = array();
-
- function __construct($name) {
- $this->name = $name;
- }
-
- function write_file() {
- $upname = strtoupper($this->name);
-
- // CVS ID header
- echo
-'dnl
-dnl $ Id: $
-dnl
-';
-
- }
-}
-
-?> \ No newline at end of file
diff --git a/scripts/ext_skel_ng/dummy.gif b/scripts/ext_skel_ng/dummy.gif
deleted file mode 100644
index e44ab4306a..0000000000
--- a/scripts/ext_skel_ng/dummy.gif
+++ /dev/null
Binary files differ
diff --git a/scripts/ext_skel_ng/ext_skel_ng.php b/scripts/ext_skel_ng/ext_skel_ng.php
deleted file mode 100644
index aeae75fa74..0000000000
--- a/scripts/ext_skel_ng/ext_skel_ng.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
- $min_version = "5.0.0-dev";
- if (!function_exists("version_compare") || version_compare(phpversion(), $min_version) <0) {
- die("need at least PHP version $min_version, you are running ".phpversion());
- }
-
- require_once "extension_parser.php";
- require_once "System.php";
-
- // parse command line arguments
- if (isset($_SERVER['argv'][1])) {
- $filename = $_SERVER["argv"][1];
- echo "using '$filename' as specification file\n";
- } else {
- $filename = "extension.xml";
- echo "using default file '$filename' as specification file\n";
- }
-
- // open specification file
- $fp = fopen($filename, "r");
- if (!is_resource($fp)) {
- error_log("can't read specification file '$filename'");
- exit;
- }
-
- // parse specification file
- $ext = new extension_parser($fp);
- fclose($fp);
-
- // purge and create extension directory
- System::rm("-rf {$ext->name}");
- mkdir($ext->name);
-
- // write LICENSE file
- if(is_object($ext->license)) {
- $ext->license->write_license_file("{$ext->name}/LICENSE");
- }
-
- // generate code
- $ext->write_header_file();
- $ext->write_code_file();
- if (isset($ext->logo)) {
- $fp = fopen("{$ext->name}/{$ext->name}_logo.h", "w");
- fwrite($fp, $ext->logo->h_code());
- fclose($fp);
- }
-
- // generate project files for configure (unices and similar platforms like cygwin)
- if ($ext->platform === "all" || in_array("unix", $ext->platform)) {
- $ext->write_config_m4();
- }
-
- // generate project files for Windows platform (VisualStudio/C++ V6)
- if ($ext->platform === "all" || in_array("win32", $ext->platform)) {
- $ext->write_ms_devstudio_dsp();
- }
-
- // generate DocBook XML documantation for PHP manual
- $ext->generate_documentation();
-?> \ No newline at end of file
diff --git a/scripts/ext_skel_ng/extension.dtd b/scripts/ext_skel_ng/extension.dtd
deleted file mode 100644
index ae8b912007..0000000000
--- a/scripts/ext_skel_ng/extension.dtd
+++ /dev/null
@@ -1,105 +0,0 @@
-<!ELEMENT extension (name|summary|description|license|maintainers|logo|release|changelog|functions|constants|globals|deps|resources|code)*>
-
-<!ELEMENT name (#PCDATA)>
-
-<!ELEMENT summary (#PCDATA)>
-
-<!ELEMENT description (#PCDATA)>
-
-<!ELEMENT maintainers (maintainer)+>
-
-<!ELEMENT maintainer (user|role|name|email)*>
-
-<!ELEMENT logo (#PCDATA)>
-<!ATTLIST logo
- src CDATA #REQUIRED
->
-
-<!ELEMENT user (#PCDATA)>
-
-<!ELEMENT role (#PCDATA)>
-
-<!ELEMENT email (#PCDATA)>
-
-<!ELEMENT changelog (release)*>
-
-<!ELEMENT release (version|license|state|date|notes|filelist|deps)*>
-
-<!ELEMENT version (#PCDATA)>
-
-<!ELEMENT state (#PCDATA)>
-
-<!ELEMENT license (#PCDATA)>
-
-<!ELEMENT date (#PCDATA)>
-
-<!ELEMENT notes (#PCDATA)>
-
-<!ELEMENT functions (function)*>
-<!ELEMENT function (summary|proto|description|code)*>
-<!ATTLIST function
- role (internal|private|public) "public"
- name CDATA #REQUIRED
->
-<!ELEMENT proto (#PCDATA)>
-<!ELEMENT code (#PCDATA)>
-<!ATTLIST code
- role (header|code) "code"
->
-<!ELEMENT constants (constant)*>
-<!ELEMENT constant (#PCDATA)>
-<!ATTLIST constant
- name CDATA #REQUIRED
- value CDATA #REQUIRED
- type (string|int|float) "string"
->
-
-<!ELEMENT globals (phpini|global)*>
-<!ELEMENT phpini (#PCDATA)>
-<!ATTLIST phpini
- name CDATA #REQUIRED
- type CDATA #REQUIRED
- value CDATA #REQUIRED
- access (system|perdir|user|all) "all"
- onupdate CDATA #IMPLIED
->
-<!ELEMENT global (#PCDATA)>
-<!ATTLIST global
- name CDATA #REQUIRED
- type CDATA #REQUIRED
->
-
-<!ELEMENT deps (with|lib|header|file|program)*>
-<!ATTLIST deps
- language (c|cpp) "c"
- platform (unix|win32|all) "all"
->
-<!ELEMENT with (#PCDATA)>
-<!ATTLIST with
- defaults CDATA #REQUIRED
- testfile CDATA #REQUIRED
- name CDATA #IMPLIED
->
-<!ELEMENT lib (#PCDATA)>
-<!ATTLIST lib
- name CDATA #REQUIRED
- function CDATA #REQUIRED
- searchpath CDATA #IMPLIED
- platform (unix|win32|all) "all"
->
-<!ELEMENT header (#PCDATA)>
-<!ATTLIST header
- name CDATA #REQUIRED
- function CDATA #IMPLIED
- searchpath CDATA #IMPLIED
- prepend (yes|no) "no"
->
-
-<!ELEMENT resources (resource)*>
-<!ELEMENT resource (description?, destruct?)>
-<!ATTLIST resource
- name CDATA #REQUIRED
- payload CDATA #IMPLIED
- alloc (yes|no) "no"
->
-<!ELEMENT destruct (#PCDATA)> \ No newline at end of file
diff --git a/scripts/ext_skel_ng/extension.xml b/scripts/ext_skel_ng/extension.xml
deleted file mode 100644
index 7d5d1eee10..0000000000
--- a/scripts/ext_skel_ng/extension.xml
+++ /dev/null
@@ -1,174 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE extension SYSTEM "extension.dtd">
-<extension>
- <name>dummy</name>
- <summary>experimental dummy extension</summary>
- <description>
- this is used for testing of the extension generater only
- </description>
-
- <maintainers>
- <maintainer>
- <user>hholzgra</user>
- <name>Hartmut Holzgraefe</name>
- <email>hholzgra@php.net</email>
- <role>lead</role>
- </maintainer>
- <maintainer>
- <user>dummy</user>
- <name>Crashtest Dummy</name>
- <email>dummy@example.com</email>
- <role>dummy</role>
- </maintainer>
- </maintainers>
-
- <logo src='dummy.gif'></logo>
-
- <release>
- <version>0.1</version>
- <date>2002-02-16</date>
- <state>alpha</state>
- <license>php</license>
- <notes>
- - first experimental draft
- </notes>
- </release>
-
- <changelog>
- </changelog>
-
-
- <deps language="c">
- <!-- these are not yet used in any way :( -->
- <with defaults='/usr:/usr/local' testfile='include/dummy.h'></with>
- <lib name='dummy' function='dummy' searchpath='/usr/lib:/lib'></lib>
- </deps>
-
- <constants>
- <constant name="DUMMY_OK" type="int" value="1">dummy ok status</constant>
- <constant name="DUMMY_ERR" type="int" value="0">dummy fault status</constant>
- </constants>
-
- <globals>
- <global name="foobar" type="int"></global>
- <phpini name="foo_int" type="int" value="42" access="system">some int value</phpini>
- <phpini name="foo_bool" type="int" value="on" access="all" onupdate="OnUpdateBool"></phpini>
- <phpini name="foo_string" type="string" value="foobar" access="all" ></phpini>
- </globals>
-
- <resources>
- <resource name="dummy_resource" payload="char *">
- <description>
- a dummy string resource
- </description>
- <destruct>
-<![CDATA[
- free(resource);
-]]>
- </destruct>
- </resource>
- <resource name="dummy_resource2">
- </resource>
- </resources>
-
-
- <functions>
-
- <function role='internal' name='MINIT'>
- <code>
-<![CDATA[
- int dummy = 42;
-
- dummy = dummy;
-]]>
- </code>
- </function>
-
- <function role='internal' name='MSHUTDOWN'>
- <code>
-<![CDATA[
- int dummy = 42;
-
- dummy = dummy;
-]]>
- </code>
- </function>
-
- <function role='internal' name='RINIT'>
- <code>
-<![CDATA[
- int dummy = 42;
-
- dummy = dummy;
-]]>
- </code>
- </function>
-
- <function role='internal' name='RSHUTDOWN'>
- <code>
-<![CDATA[
- int dummy = 42;
-
- dummy = dummy;
-]]>
- </code>
- </function>
-
- <function role='internal' name='MINFO'>
- <code>
-<![CDATA[
- php_info_print_table_start();
- php_info_print_table_header(2, "test", "table");
- php_info_print_table_end();
-]]>
- </code>
- </function>
-
- <function role='private' name='myfunc'>
- <code>
-<![CDATA[
- static int myfunc(void) {
- return 23;
- }
-]]>
- </code>
- </function>
-
-
- <function role='public' name='dummy_int'>
- <summary>dummy integer conversion</summary>
- <proto>int dummy_int(int bar)</proto>
- <description>
-some funcy longer description
-
-foo
-bar
- </description>
- </function>
-
- <function role='public' name='dummy_resource'>
- <summary>dummy resource test</summary>
- <proto>resource dummy_resource(resource bar)</proto>
- </function>
-
- <function name='dummy_string'>
- <summary>dummy string conversion</summary>
- <proto>string dummy_string(string bar) foobar</proto>
- <code>
-<![CDATA[
- RETURN_STRINGL(bar, bar_len, 1);
-]]>
- </code>
- </function>
-
- <function name ="dummy_void">
- <proto>void dummy_void(void)</proto>
- </function>
-
- <function name ="dummy_void2">
- <proto>void dummy_void2()</proto>
- </function>
-
- </functions>
-
-</extension> \ No newline at end of file
diff --git a/scripts/ext_skel_ng/extension_parser.php b/scripts/ext_skel_ng/extension_parser.php
deleted file mode 100644
index 1d22cd3097..0000000000
--- a/scripts/ext_skel_ng/extension_parser.php
+++ /dev/null
@@ -1,1160 +0,0 @@
-<?php
- // {{{ includes
-
- require_once "php_element.php";
- require_once "php_constant.php";
- require_once "php_function.php";
- require_once "php_resource.php";
- require_once "php_ini.php";
- require_once "php_global.php";
- require_once "php_logo.php";
-
- require_once "license.php";
-
- require_once "xml_stream_parser.php";
- require_once "xml_stream_callback_parser.php";
-
- // }}}
-
- class extension_parser extends xml_stream_callback_parser {
-
- // {{{ constructor
-
- function __construct($stream) {
- $this->name = "extension";
-
- $this->release = array("version" => "unknown",
- "date" => date("Y-m-d"),
- "state" => "",
- "license" => "unknown",
- "notes" => "",
- );
-
- $this->constants = array();
- $this->resources = array();
- $this->functions = array();
- $this->internal_functions = array();
- $this->private_functions = array();
- $this->globals = array();
- $this->phpini = array();
- $this->users = array();
- $this->dependson = array();
- $this->code = array();
- $this->libs = array();
- $this->headers = array();
- $this->language = "c";
- $this->platform = "all";
-
- $this->files = array("c"=>array(), "h"=>array());
-
- parent::__construct($stream);
- }
-
- // }}}
-
- // {{{ helper methods
-
- function _check_c_name($name, $msg) {
- if (!ereg("^[[:alpha:]_][[:alnum:]_]*$", $name)) {
- $this->error("$name is not a valid $msg");
- }
- }
-
- function _trimdata() {
- $text = preg_replace('|^\s*\n|m','', $this->cdata);
- $text = preg_replace('|\n\s*$|m',"\n", $text);
- return $text;
- }
-
-
- // }}}
-
- // {{{ parsing
-
- // {{{ general infos
- function handle_extension_name($attr) {
- $this->name = trim($this->cdata);
- $this->_check_c_name($this->name, "extension name");
- }
-
- function handle_extension_summary($attr) {
- $this->summary = trim($this->cdata);
- }
-
- function handle_extension_description($attr) {
- $this->description = $this->_trimdata();
- }
-
- function handle_extension_logo($attr) {
- $this->logo = new php_logo($this->name, $attr);
- }
-
-
- function handle_release_version($attr) {
- $this->release['version'] = trim($this->cdata);
- }
-
- function handle_release_state($attr) {
- $this->release['state'] = trim($this->cdata);
- }
-
- function handle_release_license($attr) {
- $this->release['license'] = trim($this->cdata);
- $this->license = license::factory($this->release['license']);
- if (is_object($this->license)) {
- $this->license->write_license_file();
- }
- }
-
- function handle_maintainers_maintainer_user($attr) {
- $this->user["user"] = trim($this->cdata);
- }
-
- function handle_maintainers_maintainer_name($attr) {
- $this->user["name"] = trim($this->cdata);
- }
-
- function handle_maintainers_maintainer_email($attr) {
- $this->user["email"] = trim($this->cdata);
- }
-
- function handle_maintainers_maintainer_role($attr) {
- $this->user["role"] = trim($this->cdata);
- }
-
- function handle_maintainers_maintainer($attr) {
- $this->users[$this->user["name"]] = $this->user;
- unset($this->user);
- }
-
-
-
- // }}}
-
- // {{{ dependencies
-
- function handle_deps($attr) {
- if (isset($attr["language"])) $this->language = $attr["language"];
- if (isset($attr['platform'])) {
- if ($attr['platform'] != "all") {
- $this->platform = split("[[:space:]]*,[[:space:]]*", trim($attr['platform']));
- }
- } else {
- $this->platform = "all";
- }
- }
-
- function handle_deps_lib($attr) {
- $this->libs[$attr['name']] = $attr;
- if (isset($attr['platform'])) {
- if ($attr['platform'] != "all") {
- $this->libs[$attr['name']]['platform'] = split("[[:space:]]*,[[:space:]]*", trim($attr['platform']));
- }
- } else {
- $this->libs[$attr['name']]['platform'] = "all";
- }
- }
-
- function handle_deps_header($attr) {
- $this->headers[$attr['name']] = $attr;
- }
-
- function handle_deps_with($attr) {
- $this->with = $attr;
- }
-
- // }}}
-
- // {{{ constants
-
- function handle_constants_constant($attr) {
- $constant = new php_constant($attr, $this->_trimdata);
- if (isset($constant->error)) {
- $this->error($constant->error);
- }
- $this->constants[$attr['name']] = $constant;
- }
-
- // }}}
-
- // {{{ resources
-
- function handle_resources_resource_destruct($attr) {
- $this->resource_destruct = $this->_trimdata();
- }
-
- function handle_resources_resource_description($attr) {
- $this->resource_description = $this->_trimdata();
- }
-
- function handle_resources_resource($attr) {
- $resource = new php_resource($attr,
- @$this->resource_destruct,
- @$this->resource_description
- );
-
- if (isset($resource->error)) {
- $this->error($resource->error);
- }
-
- $this->resources[$attr['name']] = $resource;
- unset($this->resource_description);
- unset($this->resource_destruct);
- }
-
- // }}}
-
- // {{{ functions
-
- function handle_functions_function_summary($attr) {
- $this->func_summary = trim($this->cdata);
- }
-
- function handle_functions_function_proto($attr) {
- $this->func_proto = trim($this->cdata);
- }
-
- function handle_functions_function_description($attr) {
- $this->func_desc = $this->_trimdata();
- }
-
- function handle_functions_function_code($attr) {
- $this->func_code = $this->_trimdata();
- }
-
- function handle_code($attr) {
- $this->code[$attr["role"]][] = $this->_trimdata();
- }
-
- function handle_functions_function($attr) {
- $this->_check_c_name($attr['name'], "function name");
-
- $role = isset($attr['role']) ? $attr['role'] : "public";
- $function = new php_function($attr['name'],
- @$this->func_summary,
- @$this->func_proto,
- @$this->func_desc,
- @$this->func_code,
- $role);
-
- switch ($role) {
- case "internal":
- $this->internal_functions[$attr['name']] = $function;
- break;
- case "private":
- $this->private_functions[$attr['name']] = $function;
- break;
- case "public":
- if (is_string($function->status)) $this->error($function->status." in prototype");
- $this->functions[$attr['name']] = $function;
- break;
- default:
- $this->error("function role must be either public, private or internal");
- break;
- }
-
- unset($this->func_summary);
- unset($this->func_proto);
- unset($this->func_desc);
- unset($this->func_code);
- }
-
- // }}}
-
- // {{{ globals and php.ini
-
- function handle_globals_global($attr) {
- $this->globals[$attr["name"]] = new php_global($attr);
- if (isset($this->globals[$attr["name"]]->error)) {
- $this->error($this->globals[$attr["name"]]->error);
- }
- }
-
- function handle_globals_phpini($attr) {
- $attr["desc"] = $this->_trimdata();
-
- $ini = new php_ini($attr);
- if (isset($ini->error)) {
- $this->error($ini->error);
- }
- $this->phpini[$attr['name']] = $ini;
-
- // php.ini settings are stored in modul-global variables
- $attr['type'] = $ini->c_type;
- $global = new php_global($attr);
- $this->globals[$attr["name"]] = $global;
- if (isset($global->error)) {
- $this->error($global->error);
- }
- }
-
- // }}}
-
- // }}}
-
- // {{{ output generation
-
- // {{{ docbook documentation
-
- function generate_documentation() {
- $id_name = str_replace('_', '-', $this->name);
-
- mkdir("{$this->name}/manual");
-
- $docdir = "{$this->name}/manual/$id_name";
- mkdir($docdir);
-
- $fp = fopen("$docdir/reference.xml", "w");
- fputs($fp,
-"<?xml version='1.0' encoding='iso-8859-1'?>
-<!-- ".'$'."Revision: 1.1 $ -->
- <reference id='ref.$id_name'>
- <title>{$this->summary}</title>
- <titleabbrev>$id_name</titleabbrev>
-
- <partintro>
- <section id='$id_name.intro'>
- &reftitle.intro;
- <para>
-{$this->description}
- </para>
- </section>
-
- <section id='$id_name.requirements'>
- &reftitle.required;
- <para>
- </para>
- </section>
-
-<!-- TODO no configure option support yet
- &reference.$id_name.configure;
--->
-
- <section id='$id_name.configuration'>
- &reftitle.runtime;
-");
-
- if (empty($this->phpini)) {
- fputs($fp, " &no.config;\n");
- } else {
- fputs($fp, php_ini::docbook_xml_header($this->name));
- foreach ($this->phpini as $phpini) {
- fputs($fp, $phpini->docbook_xml());
- }
- fputs($fp, php_ini::docbook_xml_footer());
- }
-
- fputs($fp,
-" </section>
-
- <section id='$id_name.resources'>
- &reftitle.resources;
-");
-
- if (empty($this->resources)) {
- fputs($fp, " &no.resource;\n");
- } else {
- foreach ($this->resources as $resource) {
- fputs($fp, $resource->docbook_xml($this->name));
- }
- }
-
-
- fputs($fp,
-" </section>
-
- <section id='$id_name.constants'>
- &reftitle.constants;
-");
-
- if (empty($this->constants)) {
- fputs($fp, " &no.constants;\n");
- } else {
- fputs($fp, php_constant::docbook_xml_header($id_name));
-
- foreach ($this->constants as $constant) {
- fputs($fp, $constant->docbook_xml($this->name));
- }
-
- fputs($fp, php_constant::docbook_xml_footer());
- }
- fputs($fp,
-" </section>
-
- </partintro>
-
-&reference.$id_name.functions;
-
- </reference>
-");
- fputs($fp, php_element::docbook_editor_footer());
-
- fclose($fp);
-
- mkdir("$docdir/functions");
- foreach ($this->functions as $name => $function) {
- $filename = $docdir . "/functions/" . strtolower(str_replace("_", "-", $name)) . ".xml";
- $funcfile = fopen($filename, "w");
- fputs($funcfile, $function->docbook_xml());
- fclose($funcfile);
- }
- }
-
- // }}}
-
- // {{{ extension entry
-
- function generate_extension_entry() {
- $name = $this->name;
- $upname = strtoupper($this->name);
-
- $code = "
-/* {{{ {$name}_module_entry
- */
-zend_module_entry {$name}_module_entry = {
- STANDARD_MODULE_HEADER,
- \"$name\",
- {$name}_functions,
- PHP_MINIT($name), /* Replace with NULL if there is nothing to do at php startup */
- PHP_MSHUTDOWN($name), /* Replace with NULL if there is nothing to do at php shutdown */
- PHP_RINIT($name), /* Replace with NULL if there is nothing to do at request start */
- PHP_RSHUTDOWN($name), /* Replace with NULL if there is nothing to do at request end */
- PHP_MINFO($name),
- \"".$this->release['version']."\",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-";
-
- $code .= "#ifdef COMPILE_DL_$upname\n";
- if ($this->language == "cpp") $code .= "extern \"C\" {\n";
- $code .= "ZEND_GET_MODULE($name)\n";
- if ($this->language == "cpp") $code .= "}\n";
- $code .= "#endif\n\n";
-
- return $code;
- }
-
- // }}}
-
- // {{{ globals and ini
-
- function generate_globals_c() {
- if (empty($this->globals)) return "";
-
- $code = "ZEND_DECLARE_MODULE_GLOBALS({$this->name})\n\n";
-
- if (!empty($this->phpini)) {
- $code .= php_ini::c_code_header($this->name);
- foreach ($this->phpini as $phpini) {
- $code .= $phpini->c_code($this->name);
- }
- $code .= php_ini::c_code_footer();
- }
-
- if (!empty($this->globals)) {
- $code .= php_global::c_code_header($this->name);
- foreach ($this->globals as $global) {
- $code .= $global->c_code($this->name);
- }
- $code .= php_global::c_code_footer();
- }
-
- return $code;
- }
-
- function generate_globals_h() {
- if (empty($this->globals)) return "";
-
- $code = php_global::h_code_header($this->name);
- foreach ($this->globals as $global) {
- $code .= $global->h_code($this->name);
- }
- $code .= php_global::h_code_footer($this->name);
-
- return $code;
- }
-
- // }}}
-
- // {{{ license and authoers
-
- function get_license() {
-
- $code = "/*\n";
- $code.= " +----------------------------------------------------------------------+\n";
-
- if (is_object($this->license)) {
- $code.= $this->license->license_comment();
- } else {
- $code.= sprintf(" | unkown license: %-52s |\n", $this->release['license']);
- }
-
- $code.= " +----------------------------------------------------------------------+\n";
- $prefix = "Authors: ";
- foreach ($this->users as $name => $user) {
- $code .= sprintf(" | $prefix %-58s |\n", "$user[name] <$user[email]>");
- $prefix = str_repeat(" ",strlen($prefix));
- }
- $code.= " +----------------------------------------------------------------------+\n";
- $code.= "*/\n\n";
-
- $code.= "/* $ Id: $ */ \n\n";
-
- return $code;
- }
-
- // }}}
-
- // {{{ editor config footer
-
- function editor_config_c() {
- return '
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
-';
- }
-
- // }}}
-
- // {{{ header file
-
- function write_header_file() {
- $filename = "php_{$this->name}.h";
-
- $this->files["h"][] = $filename;
- $fp = fopen("{$this->name}/$filename", "w");
-
- $upname = strtoupper($this->name);
-
- fputs($fp, $this->get_license());
- fputs($fp, "#ifndef PHP_{$upname}_H\n");
- fputs($fp, "#define PHP_{$upname}_H\n\n");
-
- fputs($fp, "#ifndef PHP_HAVE_{$upname}\n\n");
-
- if (isset($this->headers)) {
- foreach ($this->headers as $header) {
- if (@$header["prepend"] === "yes") {
- fputs($fp, "#include <$header[name]>\n");
- }
- }
- }
-
- if ($this->language == "cpp") {
- fputs($fp, "extern \"C\" {\n");
- }
-
- fputs($fp, '
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <php.h>
-#include <php_ini.h>
-#include <SAPI.h>
-#include <ext/standard/info.h>
-
-');
-
- if ($this->language == "cpp") {
- fputs($fp, "}\n");
- }
-
- if (isset($this->headers)) {
- foreach ($this->headers as $header) {
- if (@$header["prepend"] !== "yes") {
- fputs($fp, "#include <$header[name]>\n");
- }
- }
- }
-
- if (isset($this->code["header"])) {
- foreach ($this->code["header"] as $code) {
- fputs($fp, $code);
- }
- }
-
- fputs($fp, "
-extern zend_module_entry {$this->name}_module_entry;
-#define phpext_{$this->name}_ptr &{$this->name}_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_{$upname}_API __declspec(dllexport)
-#else
-#define PHP_{$upname}_API
-#endif
-
-PHP_MINIT_FUNCTION({$this->name});
-PHP_MSHUTDOWN_FUNCTION({$this->name});
-PHP_RINIT_FUNCTION({$this->name});
-PHP_RSHUTDOWN_FUNCTION({$this->name});
-PHP_MINFO_FUNCTION({$this->name});
-
-#ifdef ZTS
-#include \"TSRM.h\"
-#endif
-
-");
-
- fputs($fp, $this->generate_globals_h());
-
- fputs($fp, "\n");
-
- foreach ($this->functions as $name => $function) {
- fputs($fp, "PHP_FUNCTION($name);\n");
- }
-
- fputs($fp, "\n");
-
- fputs($fp, "#endif /* PHP_HAVE_{$upname} */\n\n");
- fputs($fp, "#endif /* PHP_{$upname}_H */\n\n");
-
- fputs($fp, $this->editor_config_c());
-
- fclose($fp);
- }
-
- // }}}
-
- // {{{ internal functions
-
- function internal_functions_c() {
- $need_block = false;
-
- $code = "
-/* {{{ PHP_MINIT_FUNCTION */
-PHP_MINIT_FUNCTION({$this->name})
-{
-";
-
- if (count($this->globals)) {
- $code .= "\tZEND_INIT_MODULE_GLOBALS({$this->name}, php_{$this->name}_init_globals, NULL)\n";
- $need_block = true;
- }
-
- if (count($this->phpini)) {
- $code .= "\tREGISTER_INI_ENTRIES();\n";
- $need_block = true;
- }
-
- if (isset($this->logo)) {
- $code .= $this->logo->minit_code();
- $need_block = true;
- }
-
- if (count($this->constants)) {
- foreach ($this->constants as $constant) {
- $code .= $constant->c_code();
- }
- $need_block = true;
- }
-
- if (count($this->resources)) {
- foreach ($this->resources as $resource) {
- $code .= $resource->minit_code();
- }
- $need_block = true;
- }
-
- if (isset($this->internal_functions['MINIT'])) {
- if ($need_block) $code .= "\n\t{\n";
- $code .= $this->internal_functions['MINIT']->code;
- if ($need_block) $code .= "\n\t}\n";
- } else {
- $code .="\n\t/* add your stuff here */\n";
- }
- $code .= "
- return SUCCESS;
-}
-/* }}} */
-
-";
-
- $code .= "
-/* {{{ PHP_MSHUTDOWN_FUNCTION */
-PHP_MSHUTDOWN_FUNCTION({$this->name})
-{
-";
-
- if (count($this->phpini)) {
- $code .= "\tUNREGISTER_INI_ENTRIES();\n";
- }
-
- if (isset($this->internal_functions['MSHUTDOWN'])) {
- if (count($this->phpini)) $code .= "\n\t{\n";
- $code .= $this->internal_functions['MSHUTDOWN']->code;
- if (count($this->phpini)) $code .= "\n\t}\n";
- } else {
- $code .="\n\t/* add your stuff here */\n";
- }
-
- $code .= "
- return SUCCESS;
-}
-/* }}} */
-
-";
-
- $code .= "
-/* {{{ PHP_RINIT_FUNCTION */
-PHP_RINIT_FUNCTION({$this->name})
-{
-";
-
- if (isset($this->internal_functions['RINIT'])) {
- $code .= $this->internal_functions['RINIT']->code;
- } else {
- $code .= " /* add your stuff here */\n";
- }
-
- $code .= "
-\treturn SUCCESS;
-}
-/* }}} */
-
-";
-
- $code .= "
-/* {{{ PHP_RSHUTDOWN_FUNCTION */
-PHP_RSHUTDOWN_FUNCTION({$this->name})
-{
-";
-
- if (isset($this->internal_functions['RSHUTDOWN'])) {
- $code .= $this->internal_functions['RSHUTDOWN']->code;
- } else {
- $code .= " /* add your stuff here */\n";
- }
-
- $code .= "
-\treturn SUCCESS;
-}
-/* }}} */
-
-";
-
- $code .= "
-/* {{{ PHP_MINFO_FUNCTION */
-PHP_MINFO_FUNCTION({$this->name})
-{
- php_info_print_box_start(0);
-";
-
- if (isset($this->logo))
- {
- $code.= "
- php_printf(\"<img src='\");
- if (SG(request_info).request_uri) {
- php_printf(\"%s\", (SG(request_info).request_uri));
- }
- php_printf(\"?=%s\", ".($this->logo->id).");
- php_printf(\"' align={'right' alt='image' border='0'>\\n\");
-
-";
- }
-
- if (isset($this->summary)) {
- $code .= " php_printf(\"<p>{$this->summary}</p>\\n\");\n";
- }
- if (isset($this->release)) {
- $code .= " php_printf(\"<p>Version {$this->release['version']}{$this->release['state']} ({$this->release['date']})</p>\\n\");\n";
- }
-
- if (count($this->users)) {
- $code .= " php_printf(\"<p><b>Authors:</b></p>\\n\");\n";
- foreach ($this->users as $user) {
- $code .= " php_printf(\"<p>$user[name] &lt;$user[email]&gt; ($user[role])</p>\\n\");\n";
- }
- }
-
- $code.=
-" php_info_print_box_end();
-";
-
- if (isset($this->internal_functions['MINFO'])) {
- $code .= "\n\t{\n";
- $code .= $this->internal_functions['MINFO']->code;
- $code .= "\n\t}\n";
- } else {
- $code .= "\t/* add your stuff here */\n";
- }
-
-
-if (count($this->phpini)) {
- $code .= "\n\tDISPLAY_INI_ENTRIES();";
-}
-$code .= "
-}
-/* }}} */
-
-";
-
- return $code;
- }
-
- // }}}
-
-
- function private_functions_c() {
- $code = "";
-
- foreach ($this->private_functions as $name => $func) {
- $code .= "\n\t/* {{{ $name() */\n{$func->code}\n\t/* }}} */\n\n";
- }
-
- return $code;
- }
-
- // {{{ public functions
-
- function public_functions_c() {
- $code = "";
-
- foreach ($this->functions as $function) {
- $code .= $function->c_code(&$this);
- }
-
- return $code;
- }
-
- // }}}
-
-
- // {{{ code file
-
- function write_code_file() {
- $filename = "{$this->name}.{$this->language}"; // todo extension logic
-
- $this->files["c"][] = $filename;
- $fp = fopen("{$this->name}/$filename", "w");
-
- $upname = strtoupper($this->name);
-
- fputs($fp, $this->get_license());
-
- fputs($fp, "#include \"php_{$this->name}.h\"\n\n");
-
- if (isset($this->logo)) {
- fputs($fp, $this->logo->c_code());
- }
-
- if (!empty($this->globals)) {
- fputs($fp, "ZEND_DECLARE_MODULE_GLOBALS({$this->name})\n\n");
- }
-
- fputs($fp, $this->private_functions_c());
-
- if (!empty($this->resources)) {
- foreach ($this->resources as $resource) {
- fputs($fp, $resource->c_code());
- }
- }
-
- fputs($fp, "/* {{{ {$this->name}_functions[] */\n");
- fputs($fp, "function_entry {$this->name}_functions[] = {\n");
- foreach ($this->functions as $name => $function) {
- fputs($fp, sprintf("\tPHP_FE(%-20s, NULL)\n",$name));
- }
- fputs($fp, "\t{ NULL, NULL, NULL }\n");
- fputs($fp, "};\n/* }}} */\n\n");
-
- fputs($fp, $this->generate_extension_entry());
-
- fputs($fp, "\n/* {{{ globals and ini entries */\n");
- fputs($fp, $this->generate_globals_c());
- fputs($fp, "/* }}} */\n\n");
-
- fputs($fp, $this->internal_functions_c());
-
- fputs($fp, $this->public_functions_c());
-
- fputs($fp, $this->editor_config_c());
- }
-
- // }}}
-
-
- // {{{ config.m4 file
- function write_config_m4() {
-
- $upname = strtoupper($this->name);
-
- ob_start();
-
- echo
-'dnl
-dnl $ Id: $
-dnl
-';
-
- if (isset($this->with)) {
- echo "
-PHP_ARG_WITH({$this->name}, whether to enable {$this->name} functions,
-[ --with-{$this->name}[=DIR] With {$this->name} support], yes)
-";
-
- echo "
-if test \"\$PHP_$upname\" != \"no\"; then
- if test -r \"\$PHP_$upname/{$this->with['testfile']}\"; then
- PHP_{$upname}_DIR=\"\$PHP_$upname\"
- else
- AC_MSG_CHECKING(for {$this->name} in default path)
- for i in ".str_replace(":"," ",$this->with['defaults'])."; do
- if test -r \"\$i/{$this->with['testfile']}\"; then
- PHP_{$upname}_DIR=\$i
- AC_MSG_RESULT(found in \$i)
- fi
- done
- fi
-fi
-
-PHP_ADD_INCLUDE(\$PHP_{$upname}_DIR/include)
-";
-
- } else {
- echo "
-PHP_ARG_ENABLE({$this->name} , whether to enable {$this->name} functions,
-[ --disable-{$this->name} Disable {$this->name} support], yes)
-";
- }
-
- echo "\n";
-
-
- if (count($this->libs)) {
- $first = true;
-
- foreach ($this->libs as $lib) {
- if (is_array($lib['platform']) && !in_array("unix", $lib['platform'])) {
- continue;
- }
-
- if ($first) {
- echo "PHP_SUBST({$upname}_SHARED_LIBADD)\n\n";
- $first = false;
- }
-
- if (isset($this->with)) {
- echo "PHP_ADD_LIBRARY_WITH_PATH($lib[name], \$PHP_{$upname}_DIR/lib, {$upname}_SHARED_LIBADD)\n";
- } else {
- echo "PHP_ADD_LIBRARY($lib[name],, {$upname}_SHARED_LIBADD)\n";
- }
-
- if (isset($lib['function'])) {
- echo "AC_CHECK_LIB($lib[name], $lib[function], [AC_DEFINE(HAVE_".strtoupper($lib['name']).",1,[ ])], [AC_MSG_ERROR($lib[name] library not found or wrong version)],)\n";
- }
- }
- }
-
- echo "\n";
-
- if ($this->language === "cpp") {
- echo "PHP_REQUIRE_CXX\n";
- echo "PHP_ADD_LIBRARY(stdc++)\n";
- }
-
- echo "
-if test \"\$PHP_$upname\" != \"no\"; then
- AC_DEFINE(HAVE_$upname, 1, [ ])
- PHP_NEW_EXTENSION({$this->name}, ".join(" ", $this->files['c'])." , \$ext_shared)
-fi
-
-";
-
- $fp = fopen("{$this->name}/config.m4", "w");
- fputs($fp, ob_get_contents());
- fclose($fp);
- ob_end_clean();
- }
-
- // }}}
-
- // {{{ M$ dev studio project file
-
- function write_ms_devstudio_dsp() {
- ob_start();
-
- // these system libraries are always needed?
- // (list taken from sample *.dsp files in php ext tree...)
- $winlibs = "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib ";
- $winlibs.= "shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib";
-
- // add libraries from <deps> section
- if (count($this->libs)) {
- foreach ($this->libs as $lib) {
- if (is_array($lib['platform']) && !in_array("win32", $lib['platform'])) {
- continue;
- }
- $winlibs .= " $lib[name].lib";
- }
- }
-
- echo
-'# Microsoft Developer Studio Project File - Name="'.$this->name.'" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG='.$this->name.' - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "'.$this->name.'.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "'.$this->name.'.mak" CFG="'.$this->name.' - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "'.$this->name.' - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "'.$this->name.' - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "'.$this->name.' - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "'.strtoupper($this->name).'_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_'.strtoupper($this->name).'" /D ZTS=1 /D HAVE_'.strtoupper($this->name).'=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 '.$winlibs.' /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib '.$winlibs.' /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_'.$this->name.'.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "'.$this->name.' - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "'.strtoupper($this->name).'_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_'.strtoupper($this->name).'" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_'.strtoupper($this->name).'=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 '.$winlibs.' /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib '.$winlibs.' /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_'.$this->name.'.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "'.$this->name.' - Win32 Release_TS"
-# Name "'.$this->name.' - Win32 Debug_TS"
-';
-
-
- echo '
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-';
-
- foreach ($this->files['c'] as $filename) {
- if ($filename{0}!='/' && $filename{0}!='.') {
- $filename = "./$filename";
- }
- $filename = str_replace("/","\\",$filename);
-
- echo "
-# Begin Source File
-
-SOURCE=$filename
-# End Source File
-";
- }
-
-echo '
-# End Group
-';
-
-
-
-
-echo '
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-';
-
- foreach ($this->files['h'] as $filename) {
- if ($filename{0}!='/' && $filename{0}!='.') {
- $filename = "./$filename";
- }
- $filename = str_replace("/","\\",$filename);
-
- echo "
-# Begin Source File
-
-SOURCE=$filename
-# End Source File
-";
- }
-
-echo
-'# End Group
-# End Target
-# End Project
-';
-
-
-
- $fp = fopen("{$this->name}/{$this->name}.dsp","wb");
- fputs($fp, str_replace("\n","\r\n",ob_get_contents()));
- fclose($fp);
- ob_end_clean();
- }
-
-// }}}
-
- // }}}
-
- }
-
-?> \ No newline at end of file
diff --git a/scripts/ext_skel_ng/license.php b/scripts/ext_skel_ng/license.php
deleted file mode 100644
index a2ed879902..0000000000
--- a/scripts/ext_skel_ng/license.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-abstract class license
-{
- function __construct($options = array()) {
- $this->options = $options;
- }
-
- static function factory($name, $options=array()) {
- $classname = "license_".strtolower($name);
-
- if (!class_exists($classname)) {
- if (file_exists("./$classname.php")) {
- require_once "./$classname.php";
- }
- }
-
- return
- class_exists($classname)
- ? new $classname($options)
- : false;
- }
-
- abstract function license_comment();
-
- function write_license_file($path = "./LICENSE") {
- $fp = fopen($path, "w");
-
- if (is_resource($fp)) {
- fputs($fp, $this->license_file_text());
- fclose($fp);
- return true;
- }
-
- return false;
- }
-
- abstract function license_file_text();
-}
-
-
-?> \ No newline at end of file
diff --git a/scripts/ext_skel_ng/license_bsd.php b/scripts/ext_skel_ng/license_bsd.php
deleted file mode 100644
index 8e1ad4a069..0000000000
--- a/scripts/ext_skel_ng/license_bsd.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-class license_lgpl extends license
-{
- function license_comment() {
- return <<<EOD
- | All rights reserved |
- | |
- | Redistribution and use in source and binary forms, with or without |
- | modification, are permitted provided that the following conditions |
- | are met: |
- | |
- | 1. Redistributions of source code must retain the above copyright |
- | notice, this list of conditions and the following disclaimer. |
- | 2. Redistributions in binary form must reproduce the above copyright |
- | notice, this list of conditions and the following disclaimer in |
- | the documentation and/or other materials provided with the |
- | distribution. |
- | 3. The names of the authors may not be used to endorse or promote |
- | products derived from this software without specific prior |
- | written permission. |
- | |
- | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
- | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
- | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
- | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
- | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
- | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
- | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
- | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
- | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
- | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
- | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
- | POSSIBILITY OF SUCH DAMAGE. |
-
-EOD;
- }
-
- function license_file_text() {
- return <<<EOD
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3. The names of the authors may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-EOD;
- }
-}
-
-?> \ No newline at end of file
diff --git a/scripts/ext_skel_ng/license_lgpl.php b/scripts/ext_skel_ng/license_lgpl.php
deleted file mode 100644
index cfdcf793a3..0000000000
--- a/scripts/ext_skel_ng/license_lgpl.php
+++ /dev/null
@@ -1,540 +0,0 @@
-<?php
-
-class license_lgpl extends license
-{
- function license_comment() {
- return <<<EOD
- | This library is free software; you can redistribute it and/or |
- | modify it under the terms of the GNU Lesser General Public |
- | License as published by the Free Software Foundation; either |
- | version 2.1 of the License, or (at your option) any later version. |
- | |
- | This library is distributed in the hope that it will be useful, |
- | but WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
- | Lesser General Public License for more details. |
- | |
- | You should have received a copy of the GNU Lesser General Public |
- | License in the file LICENSE along with this library; |
- | if not, write to the |
- | |
- | Free Software Foundation, Inc., |
- | 59 Temple Place, Suite 330, |
- | Boston, MA 02111-1307 USA |
-
-EOD;
- }
-
- function license_file_text() {
- ob_start();
-?>
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-<?php
- $text = ob_get_contents();
- ob_end_clean();
- return $text;
- }
-}
-
-?> \ No newline at end of file
diff --git a/scripts/ext_skel_ng/license_php.php b/scripts/ext_skel_ng/license_php.php
deleted file mode 100644
index 17040dbac5..0000000000
--- a/scripts/ext_skel_ng/license_php.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-
-class license_php extends license
-{
- function license_comment() {
- return <<<EOD
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
-
-EOD;
- }
-
- function license_file_text() {
- return <<<EOD
---------------------------------------------------------------------
- The PHP License, Version 3.0
-Copyright (c) 1999 - 2003 The PHP Group. All rights reserved.
---------------------------------------------------------------------
-
-Redistribution and use in source and binary forms, with or without
-modification, is permitted provided that the following conditions
-are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- 3. The name "PHP" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact group@php.net.
-
- 4. Products derived from this software may not be called "PHP", nor
- may "PHP" appear in their name, without prior written permission
- from group@php.net. You may indicate that your software works in
- conjunction with PHP by saying "Foo for PHP" instead of calling
- it "PHP Foo" or "phpfoo"
-
- 5. The PHP Group may publish revised and/or new versions of the
- license from time to time. Each version will be given a
- distinguishing version number.
- Once covered code has been published under a particular version
- of the license, you may always continue to use it under the terms
- of that version. You may also choose to use such covered code
- under the terms of any subsequent version of the license
- published by the PHP Group. No one other than the PHP Group has
- the right to modify the terms applicable to covered code created
- under this License.
-
- 6. Redistributions of any form whatsoever must retain the following
- acknowledgment:
- "This product includes PHP, freely available from
- <http://www.php.net/>".
-
-THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
-ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
-DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------
-
-This software consists of voluntary contributions made by many
-individuals on behalf of the PHP Group.
-
-The PHP Group can be contacted via Email at group@php.net.
-
-For more information on the PHP Group and the PHP project,
-please see <http://www.php.net>.
-
-This product includes the Zend Engine, freely available at
-<http://www.zend.com>.
-
-EOD;
- }
-}
-
-?> \ No newline at end of file
diff --git a/scripts/ext_skel_ng/php_constant.php b/scripts/ext_skel_ng/php_constant.php
deleted file mode 100644
index 4f377a963d..0000000000
--- a/scripts/ext_skel_ng/php_constant.php
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-
- class php_constant extends php_element {
-
- function __construct($attr, $desc) {
-
- $this->name = $attr["name"];
- if (!$this->is_name($this->name)) {
- $this->error[] = "'$attr[name]'is not a valid constant name";
- }
-
- $this->type = isset($attr["type"]) ? $this->is_type($attr["type"]) : "string";
- if (!in_array($this->type, array('int', 'float', 'string'))) {
- $this->error[] = "'$attr[type]' is not a valid constant type, only int, float and string";
- }
-
- $this->value= $attr["value"];
- $this->desc = $desc;
- }
-
-
- static function c_code_header($name) {
- return "";
- }
-
- function c_code() {
- switch ($this->type) {
- case "int":
- return "REGISTER_LONG_CONSTANT(\"{$this->name}\", {$this->value}, 0);\n";
-
- case "float":
- return "REGISTER_DOUBLE_CONSTANT(\"{$this->name}\", {$this->value}, 0);\n";
-
- case "string":
- return "REGISTER_STRING_CONSTANT(\"{$this->name}\", \"$value\", ".strlen($this->value).", 0);\n";
- }
- }
-
- static function c_code_footer() {
- return "";
- }
-
-
-
- static function docbook_xml_header($name) {
- return
-" <table>
- <title>$name constants</title>
- <tgroup cols='3'>
- <thead>
- <row>
- <entry>name</entry>
- <entry>value</entry>
- <entry>descrpition</entry>
- </row>
- </thead>
- <tbody>
-";
- }
-
- function docbook_xml() {
- return trim("
-<row>
- <entry>
- <constant id='constant".strtolower(str_replace("_","-",$this->name))."'>{$this->name}</constant>
- (<link linkend='language.types.integer'>integer</link>)
- </entry>
- <entry>{$this->value}</entry>
- <entry>{$this->desc}</entry>
-</row>
-")."\n";
- }
-
- static function docbook_xml_footer() {
- return
-" </tbody>
- </tgroup>
- </table>
-";
- }
- }
-
-?>
diff --git a/scripts/ext_skel_ng/php_element.php b/scripts/ext_skel_ng/php_element.php
deleted file mode 100644
index 3f1bd1c6b5..0000000000
--- a/scripts/ext_skel_ng/php_element.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-
-class php_element {
-
- function is_type($name) {
- $types = array("void" => "void",
- "bool" => "bool",
- "boolean" => "bool",
- "int" => "int",
- "integer" => "int",
- "float" => "float",
- "double" => "float",
- "real" => "float",
- "string" => "string",
- "array" => "array",
- "object" => "object",
- "resource" => "resource",
- "mixed" => "mixed",
- "callback" => "callback",
- "stream" => "stream"
- );
-
- if (isset($types[$name])) {
- return $types[$name];
- } else {
- return false;
- }
- }
-
- function is_name($name) {
- if (ereg("^[[:alpha:]_][[:alnum:]_]*$",$name)) {
- // TODO reserved words
- return true;
- }
- return false;
- }
-
-
- function c_code() {
- return "";
- }
-
- function h_code() {
- return "";
- }
-
- function docbook_xml() {
- return "";
- }
-
- function docbook_editor_footer($level=3) {
- return '
-<!-- Keep this comment at the end of the file
-Local'.' variables:
-mode: sgml
-sgml-omittag:t
-sgml-shorttag:t
-sgml-minimize-attributes:nil
-sgml-always-quote-attributes:t
-sgml-indent-step:1
-sgml-indent-data:t
-indent-tabs-mode:nil
-sgml-parent-document:nil
-sgml-default-dtd-file:"'.str_repeat("../",$level).'manual.ced"
-sgml-exposed-tags:nil
-sgml-local-catalogs:nil
-sgml-local-ecat-files:nil
-End:
-vim600: syn=xml fen fdm=syntax fdl=2 si
-vim: et tw=78 syn=sgml
-vi: ts=1 sw=1
--->
-';
- }
-}
-
-?> \ No newline at end of file
diff --git a/scripts/ext_skel_ng/php_function.php b/scripts/ext_skel_ng/php_function.php
deleted file mode 100644
index 92c970522d..0000000000
--- a/scripts/ext_skel_ng/php_function.php
+++ /dev/null
@@ -1,346 +0,0 @@
-<?php
-
- class php_function extends php_element {
-
- function __construct($name, $summary, $proto, $desc="", $code="", $role="") {
- $this->name = $name;
- $this->summary = $summary;
- $this->desc = empty($desc) ? "&warn.undocumented.func;" : $desc;
- $this->code = $code;
- $this->role = empty($role) ? "public" : $role;
- if ($this->role === "public") {
- $this->status = $this->parse_proto($proto);
- }
- }
-
- function parse_proto($proto) {
- // 'tokenize' it
- $len=strlen($proto);
- $name="";
- $tokens=array();
- for ($n=0;$n<$len;$n++) {
- $char = $proto{$n};
- if (ereg("[a-zA-Z0-9_]",$char)) {
- $name.=$char;
- } else {
- if ($name) $tokens[]=$name;
- $name="";
- if (trim($char)) $tokens[]=$char;
- }
- }
- if ($name) $tokens[]=$name;
-
- $n=0;
- $opts=0;
- $params=array();
- $return_type = ($this->is_type($tokens[$n])) ? $tokens[$n++] : "void";
- $function_name = $tokens[$n++];
- if ($return_type === "resource" && $tokens[$n] !== "(") {
- $return_subtype = $function_name;
- $function_name = $tokens[$n++];
- }
- if (! $this->is_name($function_name)) {
- return("$function_name is not a valid function name");
- }
- if ($function_name != $this->name) {
- return "proto function name is '$function_name' instead of '{$this->name}'";
- }
-
- if ($tokens[$n]!='(') return("'(' expected instead of '$tokens[$n]'");
- if ($tokens[++$n]!=')') {
- for ($param=0;$tokens[$n];$n++,$param++) {
- if ($tokens[$n]=='[') {
- $params[$param]['optional']=true;
- $opts++;
- $n++;
- if ($param>0) {
- if ($tokens[$n]!=',') return("',' expected after '[' instead of '$token[$n]'");
- $n++;
- }
- }
- if (!$this->is_type($tokens[$n])) return("type name expected instead of '$tokens[$n]'");
- $params[$param]['type']=$tokens[$n];
- $n++;
- if ($this->is_name($tokens[$n])) {
- $params[$param]['name']=$tokens[$n];
- $n++;
- }
- if ($params[$param]['type'] === "resource" && $this->is_name($tokens[$n])) {
- $params[$param]['subtype'] = $params[$param]['name'];
- $params[$param]['name'] = $tokens[$n];
- $n++;
- }
- if ($tokens[$n]=='[') {
- $n--;
- continue;
- }
- if ($tokens[$n]==',') continue;
- if ($tokens[$n]==']') break;
- if ($tokens[$n]==')') break;
- }
- }
- $numopts=$opts;
- while ($tokens[$n]==']') {
- $n++;
- $opts--;
- }
- if ($opts!=0) return ("'[' / ']' count mismatch");
- if ($tokens[$n] != ')') return("')' expected instead of '$tokens[$n]'");
-
- $this->name = $function_name;
- $this->returns = $return_type;
- if (isset($return_subtype)) {
- $this->returns .= " $return_subtype";
- }
- $this->params = $params;
- $this->optional = $numopts;
-
- return true;
- }
-
- function c_code(&$extension) {
- $code = "";
-
- $returns = explode(" ", $this->returns);
-
- switch ($this->role) {
- case "public":
- $code .= "\n/* {{{ proto {$this->returns} {$this->name}(";
- if (isset($this->params)) {
- foreach ($this->params as $key => $param) {
- if (!empty($param['optional']))
- $code.=" [";
- if ($key)
- $code.=", ";
- $code .= $param['type']." ";
- if (isset($param['subtype'])) {
- $code .= $param['subtype']." ";
- }
- if ($param['type'] !== 'void') {
- $code .= $param['name'];
- }
- }
- }
- for ($n=$this->optional; $n>0; $n--) {
- $code .= "]";
- }
- $code .= ")\n ";
- if (!empty($this->summary)) {
- $code .= $this->summary;
- }
- $code .= " */\n";
- $code .= "PHP_FUNCTION({$this->name})\n";
- $code .= "{\n";
-
- if ($returns[0] === "resource" && isset($returns[1])) {
- $resource = $extension->resources[$returns[1]];
- if ($resource->alloc === "yes") {
- $payload = $resource->payload;
- $code .= " $payload * return_res = ($payload *)emalloc(sizeof($payload));\n";
- }
- }
-
- if (isset($this->params) && count($this->params)) {
- $arg_string="";
- $arg_pointers=array();
- $optional=false;
- $res_fetch="";
- foreach ($this->params as $key => $param) {
- if ($param["type"] === "void") continue;
- $name = $param['name'];
- $arg_pointers[]="&$name";
- if (isset($param['optional'])&&!$optional) {
- $optional=true;
- $arg_string.="|";
- }
- switch ($param['type']) {
- case "bool":
- $arg_string.="b";
- $code .= " zend_bool $name = 0;\n";
- break;
- case "int":
- $arg_string.="l";
- $code .= " long $name = 0;\n";
- break;
- case "float":
- $arg_string.="d";
- $code .= " double $name = 0.0;\n";
- break;
- case "string":
- $arg_string.="s";
- $code .= " char * $name = NULL;\n";
- $code .= " int {$name}_len = 0;\n";
- $arg_pointers[]="&{$name}_len";
- break;
- case "array":
- $arg_string.="a";
- $code .= " zval * $name = NULL;\n";
- break;
- case "object":
- $arg_string.="o";
- $code .= " zval * $name = NULL;\n";
- break;
- case "resource":
- $arg_string.="r";
- $code .= " zval * $name = NULL;\n";
- $code .= " int {$name}_id = -1;\n";
- // dummfug? $arg_pointers[]="&{$name}_id";
- if (isset($param['subtype'])) {
- $resource = $extension->resources[$param['subtype']];
- $varname = "res_{$name}";
- $code .= " {$resource->payload} * $varname;\n";
-
- $res_fetch.=" if ($name) {\n"
- ." ZEND_FETCH_RESOURCE($varname, {$resource->payload} *, &$name, {$name}_id, \"$param[subtype]\", le_$param[subtype]);\n"
- ." }\n";
- } else {
- $res_fetch.=" if ($name) {\n"
- ." ZEND_FETCH_RESOURCE(???, ???, $name, {$name}_id, \"???\", ???_rsrc_id);\n"
- ." }\n";
- }
- break;
- case "stream":
- $arg_string .= "r";
- $code .= " zval * _z$name = NULL; \n";
- $code .= " php_stream * $name = NULL:\n";
- $res_fetch.= " php_stream_from_zval($name, &_z$name);\n";
- break;
- case "mixed":
- case "callback":
- $arg_string.="z";
- $code .= " zval * $name = NULL;\n";
- break;
- }
- }
- }
-
- if (isset($arg_string) && strlen($arg_string)) {
- $code .= " int argc = ZEND_NUM_ARGS();\n\n";
- $code .= " if (zend_parse_parameters(argc TSRMLS_CC, \"$arg_string\", ".join(", ",$arg_pointers).") == FAILURE) return;\n";
- if ($res_fetch) $code.="\n$res_fetch\n";
- } else {
- $code .= " if (ZEND_NUM_ARGS()>0) { WRONG_PARAM_COUNT; }\n\n";
- }
-
- if ($this->code) {
- $code .= " {\n$this->code }\n"; // {...} for local variables ...
- } else {
- $code .= " php_error(E_WARNING, \"{$this->name}: not yet implemented\"); RETURN_FALSE;\n\n";
-
- switch ($returns[0]) {
- case "void":
- break;
-
- case "bool":
- $code .= " RETURN_FALSE;\n";
- break;
-
- case "int":
- $code .= " RETURN_LONG(0);\n";
- break;
-
- case "float":
- $code .= " RETURN_DOUBLE(0.0);\n";
- break;
-
- case "string":
- $code .= " RETURN_STRINGL(\"\", 0, 1);\n";
- break;
-
- case "array":
- $code .= " array_init(return_value);\n";
- break;
-
- case "object":
- $code .= " object_init(return_value)\n";
- break;
-
- case "resource":
- if (isset($returns[1])) {
- $code .= " ZEND_REGISTER_RESOURCE(return_value, return_res, le_$returns[1]);\n";
- } else {
- $code .= " /* RETURN_RESOURCE(...); /*\n";
- }
- break;
-
- case "stream":
- $code .= " /* php_stream_to_zval(stream, return_value); */\n";
- break;
-
- case "mixed":
- $code .= " /* RETURN_...(...); /*\n";
- break;
-
- default:
- $code .= " /* UNKNOWN RETURN TYPE '$this->returns' /*\n";
- break;
- }
- }
-
- $code .= "}\n/* }}} */\n\n";
- break;
-
- case "internal":
- if (!empty($this->code)) {
- $code .= " {\n";
- $code .= $this->code."\n";
- $code .= " }\n";
- }
- break;
-
- case "private":
- $code .= $this->code."\n";
- break;
- }
- return $code;
- }
-
- function docbook_xml() {
- $xml =
-'<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision$ -->
- <refentry id="function.'.strtolower(str_replace("_","-",$this->name)).'">
- <refnamediv>
- <refname>'.$this->name.'</refname>
- <refpurpose>'.$this->summary.'</refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <methodsynopsis>
-';
-
- $xml .= " <type>{$this->returns}</type><methodname>{$this->name}</methodname>\n";
- if (empty($this->params) || $this->params[0]["type"]==="void") {
- $xml .= " <void/>\n";
- } else {
- foreach ($this->params as $key => $param) {
- if (isset($param['optional'])) {
- $xml .= " <methodparam choice='opt'>";
- } else {
- $xml .= " <methodparam>";
- }
- $xml .= "<type>$param[type]</type><parameter>$param[name]</parameter>";
- $xml .= "</methodparam>\n";
- }
- }
-
-
- $desc = $this->desc;
-
- if (!strstr($this->desc,"<para>")) {
- $desc = " <para>\n$desc </para>\n";
- }
-
-$xml .=
-' </methodsynopsis>
-'.$desc.'
- </refsect1>
- </refentry>
-';
- $xml .= $this->docbook_editor_footer(4);
-
- return $xml;
- }
- }
-
-?> \ No newline at end of file
diff --git a/scripts/ext_skel_ng/php_global.php b/scripts/ext_skel_ng/php_global.php
deleted file mode 100644
index bec2082e09..0000000000
--- a/scripts/ext_skel_ng/php_global.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-
- class php_global extends php_element {
-
- function __construct($attr) {
-
- $this->name = $attr["name"];
-
- if (!$this->is_name($this->name)) {
- $this->error[] = "'$attr[name]' is not a valid C variable name";
- }
-
- $this->type = $attr['type'];
- if (!$this->is_type($this->type)) {
- $this->error[] = "'$attr[type]' is not a valid C data type";
- }
- }
-
- /* overriding type check as we deal with C types here
- check is rather naive as it doesn't know about context
- so we check for a sequence of valid names for now
- TODO: check for either simple type, struct/class or single word (typedef)
- */
- function is_type($type) {
- $array = explode(" ", str_replace('*',' ',$type));
- foreach ($array as $name) {
- if (empty($name)) continue;
- if (!$this->is_name($name)) return false;
- }
- return true;
- }
-
-
-
- static function c_code_header($name) {
- return "static void php_{name}_init_globals(zend_{name}_globals *{name}_globals)\n{\n";
- }
-
- function c_code($name) {
- $code = " {$name}_globals->{$this->name} = ";
- if (strstr($this->type, "*")) {
- $code .= "NULL;\n";
- } else {
- $code .= "0;\n";
- }
- return $code;
- }
-
- static function c_code_footer() {
- return "}\n\n";
- }
-
- static function h_code_header($name) {
- return "ZEND_BEGIN_MODULE_GLOBALS({$name})\n";
- }
-
- function h_code($name) {
- return " {$this->type} {$this->name};\n";
- }
-
- static function h_code_footer($name) {
- $upname = strtoupper($name);
-
- return "
-ZEND_END_MODULE_GLOBALS({$name})
-
-#ifdef ZTS
-#define {$upname}_G(v) TSRMG({$name}_globals_id, zend_{$name}_globals *, v)
-#else
-#define {$upname}_G(v) ({$name}_globals.v)
-#endif
-
-";
-
- }
-
-
- }
-
-?>
diff --git a/scripts/ext_skel_ng/php_ini.php b/scripts/ext_skel_ng/php_ini.php
deleted file mode 100644
index 88da50ae28..0000000000
--- a/scripts/ext_skel_ng/php_ini.php
+++ /dev/null
@@ -1,117 +0,0 @@
-<?php
-
- class php_ini extends php_element {
-
- function __construct($attr) {
-
- $this->name = $attr["name"];
-
- if (!$this->is_name($this->name)) {
- $this->error[] = "'$attr[name]' is not a valid php.ini directive name";
- }
-
- $this->type = $this->is_type($attr['type']);
- if (!$this->type) {
- $this->error[] = "'$attr[type]' is not a valid PHP data type";
- }
-
- $this->value = $attr["value"];
- $this->desc = $attr["desc"];
-
- switch ($attr["access"]) {
- case "system":
- $this->access = "PHP_INI_SYSTEM";
- break;
- case "perdir":
- $this->access = "PHP_INI_PERDIR";
- break;
- case "user":
- $this->access = "PHP_INI_USER";
- break;
- case "all":
- case "":
- $this->access = "PHP_INI_ALL";
- break;
- default:
- $this->error[] = "'$attr[access]' is not a valid access mode (system|perdir|user|all)";
- }
-
- switch ($this->type) {
- case "bool":
- $this->onupdate = "OnUpdateBool";
- $this->c_type = "zend_bool";
- break;
- case "int":
- $this->onupdate = "OnUpdateLong";
- $this->c_type = "long";
- break;
- case "float":
- $this->onupdate = "OnUpdateReal";
- $this->c_type = "double";
- break;
- case "string":
- $this->onupdate = "OnUpdateString";
- $this->c_type = "char *";
- break;
- default:
- $this->error[] = "'$this->type' not supported, only bool, int, float and string";
- break;
- }
-
- if (isset($attr["onupdate"])) {
- $this->onupdate = $attr["onupdate"];
- }
- }
-
-
-
- static function c_code_header($name) {
- return "PHP_INI_BEGIN()\n";
- }
-
- function c_code($name) {
- return " STD_PHP_INI_ENTRY(\"{$name}.$name\", \"{$this->value}\", {$this->access}, {$this->onupdate}, $name, zend_{$name}_globals, {$name}_globals)\n";
- }
-
- static function c_code_footer() {
- return "PHP_INI_END()\n\n";
- }
-
-
-
- static function docbook_xml_header($name) {
- return
-" <table>
- <title>$name runtime configuration</title>
- <tgroup cols='3'>
- <thead>
- <row>
- <entry>directive</entry>
- <entry>default value</entry>
- <entry>descrpition</entry>
- </row>
- </thead>
- <tbody>
-";
- }
-
- function docbook_xml() {
- return
-" <row>
- <entry>$this->name</entry>
- <entry>$this->value</entry>
- <entry>$this->desc</entry>
- </row>
-";
- }
-
- static function docbook_xml_footer() {
- return
-" </tbody>
- </tgroup>
- </table>
-";
- }
- }
-
-?>
diff --git a/scripts/ext_skel_ng/php_logo.php b/scripts/ext_skel_ng/php_logo.php
deleted file mode 100644
index e7fa4b56f0..0000000000
--- a/scripts/ext_skel_ng/php_logo.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
- class php_logo extends php_element {
-
- function __construct($name, $attr) {
- $this->name = $name;
- $this->attr = $attr;
- $this->id = '"'.strtoupper($name).'_LOGO_ID"';
-
- $this->data = file_get_contents($attr['src']);
- $this->size = strlen($this->data);
-
- $this->mime_type = "image/gif";
- }
-
- function docbook_xml($base) {
- return "";
- }
-
- function minit_code() {
- return " php_register_info_logo({$this->id}, \"{$this->mime_type}\", {$this->name}_logo, {$this->size});\n";
- }
-
- function c_code() {
- return "
-static unsigned char {$this->name}_logo[] = {
-#include \"{$this->name}_logo.h\"
-};
-";
- }
-
- function h_code() {
- $len = strlen($this->data);
- $code = " ";
- $i=0;
- for ($n = 0; $n < $len; $n++) {
- $code .= sprintf(" %3d",ord($this->data[$n]));
- if ($n == $len - 1) break;
- $code .= ",";
- if (++$i==8) {
- $code .= "\n ";
- $i=0;
- }
- }
-
- $code .= "\n";
-
- return $code;
- }
- }
-
-?> \ No newline at end of file
diff --git a/scripts/ext_skel_ng/php_resource.php b/scripts/ext_skel_ng/php_resource.php
deleted file mode 100644
index 2ea631a489..0000000000
--- a/scripts/ext_skel_ng/php_resource.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-
- class php_resource extends php_element {
-
- function __construct($attr, $destruct, $description) {
- $this->name = $attr['name'];
- if (!$this->is_name($this->name)) {
- $this->error[] = "'$attr[name] is not a valid resource name";
- }
-
-
- $this->payload = @$attr['payload'];
- $this->alloc = @$attr['alloc'];
- $this->destruct = $destruct;
- $this->description = $description;
-
- if (empty($this->payload)) {
- $this->payload = "void";
- }
- }
-
- function docbook_xml($base) {
- return "
- <section id='$base.resources.{$this->name}'>
- <title><literal>{$this->name}</literal></title>
- <para>
- {$this->description}
- </para>
- </section>
-";
- }
-
- function minit_code() {
- return "
-le_{$this->name} = zend_register_list_destructors_ex({$this->name}_dtor,
- NULL,
- \"{$this->name}\",
- module_number);
-
-";
- }
-
- function c_code() {
- $dtor = "
-int le_{$this->name};
-
-void {$this->name}_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- {$this->payload} * resource = ({$this->payload} *)(rsrc->ptr);
-
- {$this->destruct}
-";
-
- if ($this->alloc === "yes") {
- $dtor .= " efree(resource);\n";
- }
-
- $dtor .= "}\n";
-
- return $dtor;
- }
-
- function h_code() {
- $upname = strtoupper($this->name);
-
- return "
-#define {$upname}_FETCH(r, z) ZEND_FETCH_RESOURCE(r, {$this->payload} *, z, -1, ${$this->name}, le_{$this->name }); \
- if (!r) { RETURN_FALSE; }
-
-#define {$upname}_REGISTER(r) ZEND_REGISTER_RESOURCE(return_value, r, le_{$this->name });
-";
- }
- }
-
-?> \ No newline at end of file
diff --git a/scripts/ext_skel_ng/xml_stream_callback_parser.php b/scripts/ext_skel_ng/xml_stream_callback_parser.php
deleted file mode 100644
index 5ac0d62d31..0000000000
--- a/scripts/ext_skel_ng/xml_stream_callback_parser.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
- class xml_stream_callback_parser extends xml_stream_parser {
-
- function __construct($stream) {
- $this->cdata = "";
- $this->tags = array();
- $this->attrs = array();
-
- parent::__construct($stream);
- }
-
- function cdata($parser, $cdata) {
- $this->cdata .= $cdata;
- }
-
- function tag_open($parser, $tag, $attributes) {
- array_push($this->tags, $tag);
- array_push($this->attrs, $attributes);
- }
-
- function tag_close($parser, $tag) {
- $attributes = array_pop($this->attrs);
-
- for ($tags = $this->tags; count($tags); array_shift($tags)) {
- $method = "handle_".join("_", $tags);
- if (method_exists($this, $method)) {
- $this->$method($attributes);
- break;
- }
- }
-
- $this->cdata = "";
- array_pop($this->tags);
- }
- }
-?> \ No newline at end of file
diff --git a/scripts/ext_skel_ng/xml_stream_parser.php b/scripts/ext_skel_ng/xml_stream_parser.php
deleted file mode 100644
index fe0a4c9ad7..0000000000
--- a/scripts/ext_skel_ng/xml_stream_parser.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-class xml_stream_parser {
- var $parser;
-
- function __construct($stream)
- {
- if (!is_resource($stream)) die("not a stream");
- if (get_resource_type($stream) != "stream") die("not a stream");
-
- $this->parser = xml_parser_create();
-
- xml_set_object($this->parser, $this);
- xml_set_element_handler($this->parser, "tag_open", "tag_close");
- xml_set_character_data_handler($this->parser, "cdata");
- xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false);
-
- while (!feof($stream)) {
- xml_parse($this->parser, fgets($stream), feof($stream));
- }
- xml_parser_free($this->parser);
- }
-
- function tag_open($parser, $tag, $attributes)
- {
- var_dump($parser, $tag, $attributes);
- }
-
- function cdata($parser, $cdata)
- {
- var_dump($parser, $cdata);
- }
-
- function tag_close($parser, $tag)
- {
- var_dump($parser, $tag);
- }
-
- function error($msg)
- {
- if (is_array($msg)) {
- if (count($msg)==1) {
- $msg = current($msg);
- } else {
- foreach ($msg as $text) {
- echo "$text\n";
- }
- $msg = "...";
- }
- }
-
- die("$msg on line ".xml_get_current_line_number($this->parser));
- }
-} // end of class xml
-?> \ No newline at end of file
diff --git a/scripts/php-config.in b/scripts/php-config.in
deleted file mode 100644
index abdab2ce0e..0000000000
--- a/scripts/php-config.in
+++ /dev/null
@@ -1,32 +0,0 @@
-#! /bin/sh
-
-prefix="@prefix@"
-version="@PHP_VERSION@"
-includedir="@includedir@/php"
-includes="-I$includedir -I$includedir/main -I$includedir/Zend"
-ldflags="@PHP_LDFLAGS@"
-libs="@EXTRA_LIBS@"
-if test '@TSRM_DIR@' != ''; then
- includes="$includes -I$includedir/TSRM"
-fi
-extension_dir='@EXTENSION_DIR@'
-
-case "$1" in
---prefix)
- echo $prefix;;
---includes)
- echo $includes;;
---ldflags)
- echo $ldflags;;
---libs)
- echo $libs;;
---extension-dir)
- echo $extension_dir;;
---version)
- echo $version;;
-*)
- echo "Usage: $0 [--prefix|--includes|--ldflags|--libs|--extension-dir|--version]"
- exit 1;;
-esac
-
-exit 0
diff --git a/scripts/phpextdist b/scripts/phpextdist
deleted file mode 100755
index 97df70020d..0000000000
--- a/scripts/phpextdist
+++ /dev/null
@@ -1,27 +0,0 @@
-#! /bin/sh
-if test $# -lt 2; then
- echo "usage: phpextdist <extension> <version>";
- exit 1
-fi
-
-phpize=`php-config --prefix`/bin/phpize
-distname="$1-$2"
-
-if test ! -f Makefile.in || test ! -f config.m4; then
- echo "Did not find required files in current directory"
- exit 1
-fi
-
-rm -rf modules *.lo *.o *.la config.status config.cache \
-config.log libtool php_config.h config_vars.mk Makefile
-
-myname=`basename \`pwd\``
-cd ..
-cp -rp $myname $distname
-cd $distname
-$phpize
-cd ..
-tar cf $distname.tar $distname
-rm -rf $distname $distname.tar.*
-gzip --best $distname.tar
-mv $distname.tar.gz $myname
diff --git a/scripts/phpize.in b/scripts/phpize.in
deleted file mode 100644
index 66ba42068a..0000000000
--- a/scripts/phpize.in
+++ /dev/null
@@ -1,56 +0,0 @@
-#! /bin/sh
-
-prefix='@prefix@'
-phpdir="$prefix/lib/php/build"
-includedir="$prefix/include/php"
-builddir="`pwd`"
-
-FILES_BUILD="mkdep.awk shtool"
-FILES="acinclude.m4 Makefile.global scan_makefile_in.awk"
-CLEAN_FILES="$FILES *.lo *.la *.o .deps .libs/ build/ include/ modules/ install-sh \
- mkinstalldirs missing config.nice config.sub config.guess configure configure.in \
- aclocal.m4 config.h config.h.in conftest* ltmain.sh libtool config.cache \
- config.log config.status Makefile Makefile.fragments Makefile.objects"
-
-if test ! -r config.m4; then
- echo "Cannot find config.m4. "
- echo "Make sure that you run $0 in the top level source directory of the module"
- exit 1
-fi
-
-# Cleanup
-if test "$1" = "--clean"; then
- echo "Cleaning.."
- for i in $CLEAN_FILES; do
- test -e && rm -rf $i
- done
- exit 0
-fi
-
-test -d build || mkdir build
-
-(cd $phpdir && cp $FILES_BUILD "$builddir"/build)
-(cd $phpdir && cp $FILES "$builddir")
-
-sed \
--e "s#@prefix@#$prefix#" \
-< $phpdir/phpize.m4 > configure.in
-
-touch install-sh mkinstalldirs missing
-
-aclocal
-autoconf
-autoheader
-libtoolize -f -c
-
-# dumping API NOs:
-PHP_API_VERSION=`grep -E '#define PHP_API_VERSION' $includedir/main/php.h|sed 's/#define PHP_API_VERSION//'`
-ZEND_MODULE_API_NO=`grep -E '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|sed 's/#define ZEND_MODULE_API_NO//'`
-ZEND_EXTENSION_API_NO=`grep -E '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|sed 's/#define ZEND_EXTENSION_API_NO//'`
-
-echo "Configuring for:"
-echo " PHP Api Version: "$PHP_API_VERSION
-echo " Zend Module Api No: "$ZEND_MODULE_API_NO
-echo " Zend Extension Api No: "$ZEND_EXTENSION_API_NO
-
-exit 0
diff --git a/scripts/phpize.m4 b/scripts/phpize.m4
deleted file mode 100644
index 9f1371716e..0000000000
--- a/scripts/phpize.m4
+++ /dev/null
@@ -1,123 +0,0 @@
-dnl This file becomes configure.in for self-contained extensions.
-
-AC_INIT(config.m4)
-
-PHP_INIT_BUILD_SYSTEM
-
-AC_DEFUN(PHP_WITH_PHP_CONFIG,[
- AC_ARG_WITH(php-config,
-[ --with-php-config=PATH],[
- PHP_CONFIG=$withval
-],[
- PHP_CONFIG=php-config
-])
-
- prefix=`$PHP_CONFIG --prefix 2>/dev/null`
- INCLUDES=`$PHP_CONFIG --includes 2>/dev/null`
- EXTENSION_DIR=`$PHP_CONFIG --extension-dir`
-
- if test -z "$prefix"; then
- AC_MSG_ERROR(Cannot find php-config. Please use --with-php-config=PATH)
- fi
- AC_MSG_CHECKING(for PHP prefix)
- AC_MSG_RESULT($prefix)
- AC_MSG_CHECKING(for PHP includes)
- AC_MSG_RESULT($INCLUDES)
- AC_MSG_CHECKING(for PHP extension directory)
- AC_MSG_RESULT($EXTENSION_DIR)
-])
-dnl
-AC_DEFUN(PHP_EXT_BUILDDIR,[.])dnl
-AC_DEFUN(PHP_EXT_DIR,[""])dnl
-AC_DEFUN(PHP_EXT_SRCDIR,[$abs_srcdir])dnl
-AC_DEFUN(PHP_ALWAYS_SHARED,[
- ext_output="yes, shared"
- ext_shared=yes
- test "[$]$1" = "no" && $1=yes
-])dnl
-dnl
-abs_srcdir=`(cd $srcdir && pwd)`
-abs_builddir=`pwd`
-
-PHP_CONFIG_NICE(config.nice)
-
-AC_PROG_CC
-AC_PROG_CC_C_O
-
-PHP_RUNPATH_SWITCH
-PHP_SHLIB_SUFFIX_NAME
-PHP_WITH_PHP_CONFIG
-
-PHP_BUILD_SHARED
-
-AC_PREFIX_DEFAULT()
-
-AC_ARG_WITH(openssl,
-[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.5) ],
-[
- if test "$withval" != "no"; then
- PHP_WITH_SHARED
- PHP_OPENSSL=$withval
- ext_openssl_shared=yes
- ext_shared=yes
- PHP_SETUP_OPENSSL
- fi
-])
-
-sinclude(config.m4)
-
-enable_static=no
-enable_shared=yes
-
-AC_PROG_LIBTOOL
-AC_PROG_AWK
-
-all_targets='$(PHP_MODULES)'
-install_targets=install-modules
-phplibdir="`pwd`/modules"
-CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H"
-CFLAGS_CLEAN=$CFLAGS
-
-test "$prefix" = "NONE" && prefix="/usr/local"
-test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
-
-PHP_SUBST(PHP_MODULES)
-PHP_SUBST(all_targets)
-PHP_SUBST(install_targets)
-
-PHP_SUBST(prefix)
-PHP_SUBST(exec_prefix)
-PHP_SUBST(libdir)
-PHP_SUBST(prefix)
-PHP_SUBST(phplibdir)
-
-PHP_SUBST(PHP_COMPILE)
-PHP_SUBST(CC)
-PHP_SUBST(CFLAGS)
-PHP_SUBST(CFLAGS_CLEAN)
-PHP_SUBST(CPP)
-PHP_SUBST(CPPFLAGS)
-PHP_SUBST(CXX)
-PHP_SUBST(DEFS)
-PHP_SUBST(EXTENSION_DIR)
-PHP_SUBST(EXTRA_LDFLAGS)
-PHP_SUBST(EXTRA_LIBS)
-PHP_SUBST(INCLUDES)
-PHP_SUBST(LEX)
-PHP_SUBST(LEX_OUTPUT_ROOT)
-PHP_SUBST(LFLAGS)
-PHP_SUBST(LDFLAGS)
-PHP_SUBST(SHARED_LIBTOOL)
-PHP_SUBST(LIBTOOL)
-PHP_SUBST(SHELL)
-PHP_SUBST(AWK)
-
-PHP_GEN_BUILD_DIRS
-PHP_GEN_GLOBAL_MAKEFILE
-
-test -d modules || mkdir modules
-touch .deps
-
-AC_CONFIG_HEADER(config.h)
-
-AC_OUTPUT()
diff --git a/snapshot b/snapshot
deleted file mode 100755
index f8e13ef9d9..0000000000
--- a/snapshot
+++ /dev/null
@@ -1,7 +0,0 @@
-#! /bin/sh
-
-if test -n "$1"; then
- flags="DISTNAME=$1"
-fi
-
-${MAKE:-make} $flags -f build/build.mk snapshot
diff --git a/stamp-h.in b/stamp-h.in
deleted file mode 100644
index 9788f70238..0000000000
--- a/stamp-h.in
+++ /dev/null
@@ -1 +0,0 @@
-timestamp
diff --git a/strtok_r.c b/strtok_r.c
deleted file mode 100644
index fea43bdead..0000000000
--- a/strtok_r.c
+++ /dev/null
@@ -1,113 +0,0 @@
-#include "php.h"
-
-#ifndef HAVE_STRTOK_R
-
-/*
- * Copyright (c) 1998 Softweyr LLC. All rights reserved.
- *
- * strtok_r, from Berkeley strtok
- * Oct 13, 1998 by Wes Peters <wes@softweyr.com>
- *
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notices, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notices, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- *
- * This product includes software developed by Softweyr LLC, the
- * University of California, Berkeley, and its contributors.
- *
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWEYR LLC, THE
- * REGENTS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stddef.h>
-#include <string.h>
-
-char *
-strtok_r(char *s, const char *delim, char **last)
-{
- char *spanp;
- int c, sc;
- char *tok;
-
- if (s == NULL && (s = *last) == NULL)
- {
- return NULL;
- }
-
- /*
- * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
- */
-cont:
- c = *s++;
- for (spanp = (char *)delim; (sc = *spanp++) != 0; )
- {
- if (c == sc)
- {
- goto cont;
- }
- }
-
- if (c == 0) /* no non-delimiter characters */
- {
- *last = NULL;
- return NULL;
- }
- tok = s - 1;
-
- /*
- * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
- * Note that delim must have one NUL; we stop if we see that, too.
- */
- for (;;)
- {
- c = *s++;
- spanp = (char *)delim;
- do
- {
- if ((sc = *spanp++) == c)
- {
- if (c == 0)
- {
- s = NULL;
- }
- else
- {
- char *w = s - 1;
- *w = '\0';
- }
- *last = s;
- return tok;
- }
- }
- while (sc != 0);
- }
- /* NOTREACHED */
-}
-
-#endif
diff --git a/stub.c b/stub.c
deleted file mode 100644
index 8b13789179..0000000000
--- a/stub.c
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/tests/basic/001.phpt b/tests/basic/001.phpt
deleted file mode 100644
index 4cc79613c5..0000000000
--- a/tests/basic/001.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Trivial "Hello World" test
---POST--
---GET--
---FILE--
-<?php echo "Hello World"?>
---EXPECT--
-Hello World
diff --git a/tests/basic/002.phpt b/tests/basic/002.phpt
deleted file mode 100644
index 5a6187df7b..0000000000
--- a/tests/basic/002.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Simple POST Method test
---SKIPIF--
-<?php if (php_sapi_name()=='cli') echo 'skip'; ?>
---POST--
-a=Hello+World
---GET--
---FILE--
-<?php
-echo $_POST['a']; ?>
---EXPECT--
-Hello World
diff --git a/tests/basic/003.phpt b/tests/basic/003.phpt
deleted file mode 100644
index ae6603f448..0000000000
--- a/tests/basic/003.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-GET and POST Method combined
---SKIPIF--
-<?php if (php_sapi_name()=='cli') echo 'skip'; ?>
---POST--
-a=Hello+World
---GET--
-b=Hello+Again+World&c=Hi+Mom
---FILE--
-<?php
-error_reporting(0);
-echo "post-a=({$_POST['a']}) get-b=({$_GET['b']}) get-c=({$_GET['c']})"?>
---EXPECT--
-post-a=(Hello World) get-b=(Hello Again World) get-c=(Hi Mom)
diff --git a/tests/basic/004.phpt b/tests/basic/004.phpt
deleted file mode 100644
index 1689d73f59..0000000000
--- a/tests/basic/004.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Two variables in POST data
---SKIPIF--
-<?php if (php_sapi_name()=='cli') echo 'skip'; ?>
---POST--
-a=Hello+World&b=Hello+Again+World
---GET--
---FILE--
-<?php
-error_reporting(0);
-echo "{$_POST['a']} {$_POST['b']}" ?>
---EXPECT--
-Hello World Hello Again World
diff --git a/tests/basic/005.phpt b/tests/basic/005.phpt
deleted file mode 100644
index 28c1997762..0000000000
--- a/tests/basic/005.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Three variables in POST data
---SKIPIF--
-<?php if (php_sapi_name()=='cli') echo 'skip'; ?>
---POST--
-a=Hello+World&b=Hello+Again+World&c=1
---GET--
---FILE--
-<?php
-error_reporting(0);
-echo "{$_POST['a']} {$_POST['b']} {$_POST['c']}"?>
---EXPECT--
-Hello World Hello Again World 1
diff --git a/tests/basic/006.phpt b/tests/basic/006.phpt
deleted file mode 100644
index 3b88acc32f..0000000000
--- a/tests/basic/006.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Add 3 variables together and print result
---POST--
---GET--
---FILE--
-<?php $a=1; $b=2; $c=3; $d=$a+$b+$c; echo $d?>
---EXPECT--
-6
diff --git a/tests/basic/007.phpt b/tests/basic/007.phpt
deleted file mode 100644
index 90fdc7e545..0000000000
--- a/tests/basic/007.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Multiply 3 variables and print result
---POST--
---GET--
---FILE--
-<?php $a=2; $b=4; $c=8; $d=$a*$b*$c; echo $d?>
---EXPECT--
-64
diff --git a/tests/basic/008.phpt b/tests/basic/008.phpt
deleted file mode 100644
index 927bf0e509..0000000000
--- a/tests/basic/008.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Divide 3 variables and print result
---POST--
---GET--
---FILE--
-<?php $a=27; $b=3; $c=3; $d=$a/$b/$c; echo $d?>
---EXPECT--
-3
diff --git a/tests/basic/009.phpt b/tests/basic/009.phpt
deleted file mode 100644
index d78b195d0b..0000000000
--- a/tests/basic/009.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Subtract 3 variables and print result
---POST--
---GET--
---FILE--
-<?php $a=27; $b=7; $c=10; $d=$a-$b-$c; echo $d?>
---EXPECT--
-10
diff --git a/tests/basic/010.phpt b/tests/basic/010.phpt
deleted file mode 100644
index 4440d99bf8..0000000000
--- a/tests/basic/010.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Testing | and & operators
---POST--
---GET--
---FILE--
-<?php $a=8; $b=4; $c=8; echo $a|$b&$c?>
---EXPECT--
-8
diff --git a/tests/basic/011.phpt b/tests/basic/011.phpt
deleted file mode 100644
index 34eed7915a..0000000000
--- a/tests/basic/011.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Testing $argc and $argv handling (GET)
---SKIPIF--
-<?php if (php_sapi_name()=='cli') echo 'skip'; ?>
---INI--
-register_argc_argv=1
---GET--
-ab+cd+ef+123+test
---FILE--
-<?php
-
-if (!ini_get('register_globals')) {
- $argc = $_SERVER['argc'];
- $argv = $_SERVER['argv'];
-}
-
-for ($i=0; $i<$argc; $i++) {
- echo "$i: ".$argv[$i]."\n";
-}
-
-?>
---EXPECT--
-0: ab
-1: cd
-2: ef
-3: 123
-4: test
diff --git a/tests/basic/012.phpt b/tests/basic/012.phpt
deleted file mode 100644
index 7e70f9a018..0000000000
--- a/tests/basic/012.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Testing $argc and $argv handling (cli)
---SKIPIF--
-<?php if(php_sapi_name()!='cli') echo 'skip'; ?>
---INI--
-register_argc_argv=1
---ARGS--
-ab cd ef 123 test
---FILE--
-<?php
-
-if (!ini_get('register_globals')) {
- $argc = $_SERVER['argc'];
- $argv = $_SERVER['argv'];
-}
-
-for ($i=1; $i<$argc; $i++) {
- echo ($i-1).": ".$argv[$i]."\n";
-}
-
-?>
---EXPECT--
-0: ab
-1: cd
-2: ef
-3: 123
-4: test
diff --git a/tests/basic/bug20539.phpt b/tests/basic/bug20539.phpt
deleted file mode 100644
index 6352960991..0000000000
--- a/tests/basic/bug20539.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Bug #20539 (PHP CLI Segmentation Fault)
---INI--
-session.auto_start=1
---FILE--
-<?php
- print "good :)\n";
-?>
---EXPECT--
-good :)
diff --git a/tests/bin-info.inc b/tests/bin-info.inc
deleted file mode 100644
index ad42ea897a..0000000000
--- a/tests/bin-info.inc
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-// Used to print php binary info used to run
-// test scripts.
-// Called from run-tests.php
-
-function dowrite($str)
-{
- global $term_bold, $term_norm;
- $str = str_replace("%b", $term_bold, $str);
- $str = str_replace("%B", $term_norm, $str);
- print $str;
-}
-
-function dowriteln($str)
-{
- dowrite("$str\n");
-}
-
-dowriteln("PHP SAPI: ".PHP_SAPI);
-dowriteln("PHP Version: ".PHP_VERSION);
-?> \ No newline at end of file
diff --git a/tests/classes/__call_001.phpt b/tests/classes/__call_001.phpt
deleted file mode 100644
index 9a2306250c..0000000000
--- a/tests/classes/__call_001.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-ZE2 __call()
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class Caller {
- var $x = array(1, 2, 3);
-
- function __call($m, $a) {
- echo "Method $m called:\n";
- var_dump($a);
- return $this->x;
- }
-}
-
-$foo = new Caller();
-$a = $foo->test(1, '2', 3.4, true);
-var_dump($a);
-
-?>
---EXPECT--
-Method test called:
-array(4) {
- [0]=>
- int(1)
- [1]=>
- string(1) "2"
- [2]=>
- float(3.4)
- [3]=>
- bool(true)
-}
-array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
-}
diff --git a/tests/classes/__clone_001.phpt b/tests/classes/__clone_001.phpt
deleted file mode 100644
index fe320df468..0000000000
--- a/tests/classes/__clone_001.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-ZE2 __clone()
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class MyCloneable {
- static $id = 0;
-
- function MyCloneable() {
- $this->id = self::$id++;
- }
-
- function __clone() {
- $this->name = $that->name;
- $this->address = "New York";
- $this->id = self::$id++;
- }
-}
-
-$original = new MyCloneable();
-
-$original->name = "Hello";
-$original->address = "Tel-Aviv";
-
-echo $original->id . "\n";
-
-$clone = $original->__clone();
-
-echo $clone->id . "\n";
-echo $clone->name . "\n";
-echo $clone->address . "\n";
-
-?>
---EXPECT--
-0
-1
-Hello
-New York
diff --git a/tests/classes/__set__get_001.phpt b/tests/classes/__set__get_001.phpt
deleted file mode 100644
index 3398fc5f81..0000000000
--- a/tests/classes/__set__get_001.phpt
+++ /dev/null
@@ -1,72 +0,0 @@
---TEST--
-ZE2 __set() and __get()
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-class Setter {
- public $n;
- public $x = array('a' => 1, 'b' => 2, 'c' => 3);
-
- function __get($nm) {
- echo "Getting [$nm]\n";
-
- if (isset($this->x[$nm])) {
- $r = $this->x[$nm];
- echo "Returning: $r\n";
- return $r;
- }
- else {
- echo "Nothing!\n";
- }
- }
-
- function __set($nm, $val) {
- echo "Setting [$nm] to $val\n";
-
- if (isset($this->x[$nm])) {
- $this->x[$nm] = $val;
- echo "OK!\n";
- }
- else {
- echo "Not OK!\n";
- }
- }
-}
-
-$foo = new Setter();
-
-// this doesn't go through __set()... should it?
-$foo->n = 1;
-
-// the rest are fine...
-$foo->a = 100;
-$foo->a++;
-$foo->z++;
-var_dump($foo);
-
-?>
---EXPECTF--
-Setting [a] to 100
-OK!
-Getting [a]
-Returning: 100
-Setting [a] to 101
-OK!
-Getting [z]
-Nothing!
-Setting [z] to 1
-Not OK!
-object(setter)#%d (2) {
- ["n"]=>
- int(1)
- ["x"]=>
- array(3) {
- ["a"]=>
- int(101)
- ["b"]=>
- int(2)
- ["c"]=>
- int(3)
- }
-}
diff --git a/tests/classes/abstract.phpt b/tests/classes/abstract.phpt
deleted file mode 100644
index 208b9bce11..0000000000
--- a/tests/classes/abstract.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-An abstract method may not be called
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-abstract class fail {
- abstract function show();
-}
-
-class pass extends fail {
- function show() {
- echo "Call to function show()\n";
- }
- function error() {
- parent::show();
- }
-}
-
-$t = new pass();
-$t->show();
-$t->error();
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Call to function show()
-
-Fatal error: Cannot call abstract method fail::show() in %s on line %d
diff --git a/tests/classes/abstract_class.phpt b/tests/classes/abstract_class.phpt
deleted file mode 100644
index 97a2978430..0000000000
--- a/tests/classes/abstract_class.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-An abstract class cannot be instantiated
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-abstract class fail {
- abstract function show();
-}
-
-class pass extends fail {
- function show() {
- echo "Call to function show()\n";
- }
-}
-
-$t2 = new pass();
-$t2->show();
-
-$t = new fail();
-$t->show();
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Call to function show()
-
-Fatal error: Cannot instantiate abstract class fail in %s on line %d
diff --git a/tests/classes/abstract_final.phpt b/tests/classes/abstract_final.phpt
deleted file mode 100644
index 7aac02615d..0000000000
--- a/tests/classes/abstract_final.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-A final method cannot be abstract
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class fail {
- abstract final function show();
-}
-
-echo "Done\n"; // Shouldn't be displayed
-?>
---EXPECTF--
-
-Fatal error: Cannot use the final modifier on an abstract class member in %s on line %d
diff --git a/tests/classes/abstract_inherit.phpt b/tests/classes/abstract_inherit.phpt
deleted file mode 100644
index 3f87e3ecdd..0000000000
--- a/tests/classes/abstract_inherit.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-A class that inherits an abstract method is abstract
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-abstract class pass {
- abstract function show();
-}
-
-abstract class fail extends pass {
-}
-
-$t = new fail();
-$t = new pass();
-
-echo "Done\n"; // Shouldn't be displayed
-?>
---EXPECTF--
-
-Fatal error: Cannot instantiate abstract class fail in %s on line %d
diff --git a/tests/classes/abstract_not_declared.phpt b/tests/classes/abstract_not_declared.phpt
deleted file mode 100644
index 4a2a94b25e..0000000000
--- a/tests/classes/abstract_not_declared.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-An abstract class must be declared abstract
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class fail {
- abstract function show();
-}
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Fatal error: Class fail contains 1 abstract methods and must therefore be declared abstract (fail::show) in %s on line %d
diff --git a/tests/classes/abstract_redeclare.phpt b/tests/classes/abstract_redeclare.phpt
deleted file mode 100644
index 132ab94711..0000000000
--- a/tests/classes/abstract_redeclare.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-A method cannot be redeclared abstrcat
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class pass {
- function show() {
- echo "Call to function show()\n";
- }
-}
-
-class fail extends pass {
- abstract function show();
-}
-
-echo "Done\n"; // Shouldn't be displayed
-?>
---EXPECTF--
-
-Fatal error: Cannot make non abstract method pass::show() abstract in class fail in %s on line %d
diff --git a/tests/classes/abstract_static.phpt b/tests/classes/abstract_static.phpt
deleted file mode 100644
index fd1b9a6520..0000000000
--- a/tests/classes/abstract_static.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-A static abstrcat method may not be called
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-abstract class fail {
- abstract static function show();
-}
-
-class pass extends fail {
- static function show() {
- echo "Call to function show()\n";
- }
-}
-
-pass::show();
-fail::show();
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Call to function show()
-
-Fatal error: Cannot call abstract method fail::show() in %s on line %d
diff --git a/tests/classes/bug20120.phpt b/tests/classes/bug20120.phpt
deleted file mode 100644
index 3b64a4ded6..0000000000
--- a/tests/classes/bug20120.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-Methods via variable name, bug #20120
---SKIPIF--
---FILE--
-<?php
-class bugtest {
- function bug() {
- echo "test\n";
- }
- function refbug() {
- echo "test2\n";
- }
-}
-$method='bug';
-bugtest::$method();
-$foo=&$method;
-$method='refbug';
-bugtest::$foo();
-
-$t = new bugtest;
-$t->$method();
-?>
---EXPECT--
-test
-test2
-test2
diff --git a/tests/classes/class_example.phpt b/tests/classes/class_example.phpt
deleted file mode 100644
index 8f07c278fc..0000000000
--- a/tests/classes/class_example.phpt
+++ /dev/null
@@ -1,87 +0,0 @@
---TEST--
-Classes general test
---POST--
---GET--
---FILE--
-
-<?php
-
-/* pretty nifty object oriented code! */
-
-class user {
- var $first_name,$family_name,$address,$phone_num;
- function display()
- {
- echo "User information\n";
- echo "----------------\n\n";
- echo "First name:\t ".$this->first_name."\n";
- echo "Family name:\t ".$this->family_name."\n";
- echo "Address:\t ".$this->address."\n";
- echo "Phone:\t\t ".$this->phone_num."\n";
- echo "\n\n";
- }
- function initialize($first_name,$family_name,$address,$phone_num)
- {
- $this->first_name = $first_name;
- $this->family_name = $family_name;
- $this->address = $address;
- $this->phone_num = $phone_num;
- }
-};
-
-
-function test($u)
-{ /* one can pass classes as arguments */
- $u->display();
- $t = $u;
- $t->address = "New address...";
- return $t; /* and also return them as return values */
-}
-
-$user1 = new user;
-$user2 = new user;
-
-$user1->initialize("Zeev","Suraski","Ben Gourion 3, Kiryat Bialik, Israel","+972-4-8713139");
-$user2->initialize("Andi","Gutmans","Haifa, Israel","+972-4-8231621");
-$user1->display();
-$user2->display();
-
-$tmp = test($user2);
-$tmp->display();
-
-?>
---EXPECT--
-User information
-----------------
-
-First name: Zeev
-Family name: Suraski
-Address: Ben Gourion 3, Kiryat Bialik, Israel
-Phone: +972-4-8713139
-
-
-User information
-----------------
-
-First name: Andi
-Family name: Gutmans
-Address: Haifa, Israel
-Phone: +972-4-8231621
-
-
-User information
-----------------
-
-First name: Andi
-Family name: Gutmans
-Address: Haifa, Israel
-Phone: +972-4-8231621
-
-
-User information
-----------------
-
-First name: Andi
-Family name: Gutmans
-Address: New address...
-Phone: +972-4-8231621
diff --git a/tests/classes/constants_scope_001.phpt b/tests/classes/constants_scope_001.phpt
deleted file mode 100644
index 5dc874872e..0000000000
--- a/tests/classes/constants_scope_001.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-ZE2 class constants and scope
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class ErrorCodes {
- const FATAL = "Fatal error\n";
- const WARNING = "Warning\n";
- const INFO = "Informational message\n";
-
- static function print_fatal_error_codes() {
- echo "FATAL = " . FATAL;
- echo "self::FATAL = " . self::FATAL;
- }
-}
-
-/* Call the static function and move into the ErrorCodes scope */
-ErrorCodes::print_fatal_error_codes();
-
-?>
---EXPECT--
-FATAL = Fatal error
-self::FATAL = Fatal error
diff --git a/tests/classes/ctor_dtor.phpt b/tests/classes/ctor_dtor.phpt
deleted file mode 100644
index e265b0fcba..0000000000
--- a/tests/classes/ctor_dtor.phpt
+++ /dev/null
@@ -1,48 +0,0 @@
---TEST--
-The new constructor/destructor is called
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class early {
- function early() {
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- }
- function __construct() {
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- }
- function __destruct() {
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- }
-}
-
-class late {
- function __construct() {
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- }
- function late() {
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- }
- function __destruct() {
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- }
-}
-
-$t = new early();
-$t->early();
-unset($t);
-$t = new late();
-$t->late();
-//unset($t); delay to end of script
-
-echo "Done\n";
-?>
---EXPECTF--
-early::__construct
-early::early
-early::__destruct
-late::__construct
-late::late
-Done
-late::__destruct
diff --git a/tests/classes/ctor_dtor_inheritance.phpt b/tests/classes/ctor_dtor_inheritance.phpt
deleted file mode 100644
index 1937b85164..0000000000
--- a/tests/classes/ctor_dtor_inheritance.phpt
+++ /dev/null
@@ -1,99 +0,0 @@
---TEST--
-A derived class can use the inherited constructor/destructor
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-// This test checks for:
-// - inherited constructors/destructors are not called automatically
-// - base classes know about derived properties in constructor/destructor
-// - base class constructors/destructors know the instanciated class name
-
-class base {
- public $name;
-
- function __construct() {
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- $this->name = 'base';
- print_r($this);
- }
-
- function __destruct() {
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- print_r($this);
- }
-}
-
-class derived extends base {
- public $other;
-
- function __construct() {
- $this->name = 'init';
- $this->other = 'other';
- print_r($this);
- parent::__construct();
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- $this->name = 'derived';
- print_r($this);
- }
-
- function __destruct() {
- parent::__destruct();
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- print_r($this);
- }
-}
-
-echo "Testing class base\n";
-$t = new base();
-unset($t);
-echo "Testing class derived\n";
-$t = new derived();
-unset($t);
-
-echo "Done\n";
-?>
---EXPECTF--
-Testing class base
-base::__construct
-base Object
-(
- [name] => base
-)
-base::__destruct
-base Object
-(
- [name] => base
-)
-Testing class derived
-derived Object
-(
- [other] => other
- [name] => init
-)
-base::__construct
-derived Object
-(
- [other] => other
- [name] => base
-)
-derived::__construct
-derived Object
-(
- [other] => other
- [name] => derived
-)
-base::__destruct
-derived Object
-(
- [other] => other
- [name] => derived
-)
-derived::__destruct
-derived Object
-(
- [other] => other
- [name] => derived
-)
-Done
diff --git a/tests/classes/dereferencing_001.phpt b/tests/classes/dereferencing_001.phpt
deleted file mode 100644
index 202602f146..0000000000
--- a/tests/classes/dereferencing_001.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-ZE2 dereferencing of objects from methods
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class Name {
- function Name($_name) {
- $this->name = $_name;
- }
-
- function display() {
- echo $this->name . "\n";
- }
-}
-
-class Person {
- private $name;
-
- function Person($_name, $_address) {
- $this->name = new Name($_name);
- }
-
- function getName() {
- return $this->name;
- }
-}
-
-$person = new Person("John", "New York");
-$person->getName()->display();
-
-?>
---EXPECT--
-John
diff --git a/tests/classes/factory_001.phpt b/tests/classes/factory_001.phpt
deleted file mode 100644
index 97b69c1b47..0000000000
--- a/tests/classes/factory_001.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-ZE2 factory objects
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class Circle {
- function draw() {
- echo "Circle\n";
- }
-}
-
-class Square {
- function draw() {
- print "Square\n";
- }
-}
-
-function ShapeFactoryMethod($shape) {
- switch ($shape) {
- case "Circle":
- return new Circle();
- case "Square":
- return new Square();
- }
-}
-
-ShapeFactoryMethod("Circle")->draw();
-ShapeFactoryMethod("Square")->draw();
-
-?>
---EXPECT--
-Circle
-Square
diff --git a/tests/classes/final.phpt b/tests/classes/final.phpt
deleted file mode 100644
index 733adf2e84..0000000000
--- a/tests/classes/final.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-A method may be redeclared final
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class first {
- function show() {
- echo "Call to function first::show()\n";
- }
-}
-
-$t = new first();
-$t->show();
-
-class second extends first {
- final function show() {
- echo "Call to function second::show()\n";
- }
-}
-
-$t2 = new second();
-$t2->show();
-
-echo "Done\n";
-?>
---EXPECTF--
-Call to function first::show()
-Call to function second::show()
-Done \ No newline at end of file
diff --git a/tests/classes/final_abstract.phpt b/tests/classes/final_abstract.phpt
deleted file mode 100644
index 37aa0bee8f..0000000000
--- a/tests/classes/final_abstract.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-A final method cannot be abstract
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class fail {
- final abstract function show();
-}
-
-echo "Done\n"; // Shouldn't be displayed
-?>
---EXPECTF--
-
-Fatal error: Cannot use the final modifier on an abstract class member in %s
diff --git a/tests/classes/final_redeclare.phpt b/tests/classes/final_redeclare.phpt
deleted file mode 100644
index bdf34a149a..0000000000
--- a/tests/classes/final_redeclare.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-A final method may not be overwritten
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class pass {
- final function show() {
- echo "Call to function pass::show()\n";
- }
-}
-
-$t = new pass();
-$t->show();
-
-class fail extends pass {
- function show() {
- echo "Call to function fail::show()\n";
- }
-}
-
-echo "Done\n"; // Shouldn't be displayed
-?>
---EXPECTF--
-Call to function pass::show()
-
-Fatal error: Cannot override final method pass::show() in %s on line %d
diff --git a/tests/classes/inheritance.phpt b/tests/classes/inheritance.phpt
deleted file mode 100644
index 2a2f0f755b..0000000000
--- a/tests/classes/inheritance.phpt
+++ /dev/null
@@ -1,58 +0,0 @@
---TEST--
-Classes inheritance test
---POST--
---GET--
---FILE--
-<?php
-
-/* Inheritance test. Pretty nifty if I do say so myself! */
-
-class foo {
- var $a;
- var $b;
- function display() {
- echo "This is class foo\n";
- echo "a = ".$this->a."\n";
- echo "b = ".$this->b."\n";
- }
- function mul() {
- return $this->a*$this->b;
- }
-};
-
-class bar extends foo {
- var $c;
- function display() { /* alternative display function for class bar */
- echo "This is class bar\n";
- echo "a = ".$this->a."\n";
- echo "b = ".$this->b."\n";
- echo "c = ".$this->c."\n";
- }
-};
-
-
-$foo1 = new foo;
-$foo1->a = 2;
-$foo1->b = 5;
-$foo1->display();
-echo $foo1->mul()."\n";
-
-echo "-----\n";
-
-$bar1 = new bar;
-$bar1->a = 4;
-$bar1->b = 3;
-$bar1->c = 12;
-$bar1->display();
-echo $bar1->mul()."\n";
---EXPECT--
-This is class foo
-a = 2
-b = 5
-10
------
-This is class bar
-a = 4
-b = 3
-c = 12
-12
diff --git a/tests/classes/inheritance_002.phpt b/tests/classes/inheritance_002.phpt
deleted file mode 100755
index 41358928bf..0000000000
--- a/tests/classes/inheritance_002.phpt
+++ /dev/null
@@ -1,87 +0,0 @@
---TEST--
-Constructor precedence
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
- namespace php4 {
- class Base {
- function Base() {
- var_dump('Base constructor');
- }
- }
-
- class Child extends Base {
- function Child() {
- var_dump('Child constructor');
- parent::Base();
- }
- }
- }
-
- namespace php5 {
- class Base {
- function __construct() {
- var_dump('Base constructor');
- }
-
- function Base() {
- var_dump('I should not be called');
- }
- }
-
- class Child extends Base {
- function __construct() {
- var_dump('Child constructor');
- parent::__construct();
- }
-
- function Child() {
- var_dump('I should not be called');
- }
- }
- }
-
- namespace mixed1 {
- class Child extends php4::Base {
- function __construct() {
- var_dump('Child constructor');
- parent::Base();
- }
- }
- }
-
- namespace mixed2 {
- class Child extends php5::Base {
- function Child() {
- var_dump('Child constructor');
- parent::__construct();
- }
- }
- }
-
- echo "### PHP4 style\n";
- $c4= new php4::Child();
-
- echo "### PHP5 style\n";
- $c5= new php5::Child();
-
- echo "### Mixed style 1\n";
- $cm= new mixed1::Child();
-
- echo "### Mixed style 2\n";
- $cm= new mixed2::Child();
-?>
---EXPECT--
-### PHP4 style
-string(17) "Child constructor"
-string(16) "Base constructor"
-### PHP5 style
-string(17) "Child constructor"
-string(16) "Base constructor"
-### Mixed style 1
-string(17) "Child constructor"
-string(16) "Base constructor"
-### Mixed style 2
-string(17) "Child constructor"
-string(16) "Base constructor" \ No newline at end of file
diff --git a/tests/classes/interface_class.phpt b/tests/classes/interface_class.phpt
deleted file mode 100644
index bdfa76daad..0000000000
--- a/tests/classes/interface_class.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-A class can only implement interfaces
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-class base {
-}
-
-class derived implements base {
-}
-?>
---EXPECTF--
-Fatal error: derived cannot implement base - it is not an interface in %s on line %d
diff --git a/tests/classes/interface_doubled.phpt b/tests/classes/interface_doubled.phpt
deleted file mode 100644
index ecde84835b..0000000000
--- a/tests/classes/interface_doubled.phpt
+++ /dev/null
@@ -1,199 +0,0 @@
---TEST--
-An interface may both inherit and implement base interfaces
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-interface if_a {
- abstract function f_a();
-}
-
-interface if_b {
- abstract function f_b();
-}
-
-interface if_c implements if_a, if_b {
- abstract function f_c();
-}
-
-interface if_d extends if_a implements if_b {
- abstract function f_d();
-}
-
-interface if_e {
- abstract function f_d();
-}
-
-interface if_f extends if_e implements if_a, if_b, if_c, if_d, if_e {
-}
-
-class base {
- function test($class) {
- echo "is_a(" . get_class($this) . ", $class) ". (is_a($this, $class) ? "yes\n" : "no\n");
- }
-}
-
-echo "class_a\n";
-
-class class_a extends base implements if_a {
- function f_a() {}
- function f_b() {}
- function f_c() {}
- function f_d() {}
- function f_e() {}
-}
-
-$t = new class_a();
-echo $t->test('if_a');
-echo $t->test('if_b');
-echo $t->test('if_c');
-echo $t->test('if_d');
-echo $t->test('if_e');
-
-echo "class_b\n";
-
-class class_b extends base implements if_a, if_b {
- function f_a() {}
- function f_b() {}
- function f_c() {}
- function f_d() {}
- function f_e() {}
-}
-
-$t = new class_b();
-echo $t->test('if_a');
-echo $t->test('if_b');
-echo $t->test('if_c');
-echo $t->test('if_d');
-echo $t->test('if_e');
-
-echo "class_c\n";
-
-class class_c extends base implements if_c {
- function f_a() {}
- function f_b() {}
- function f_c() {}
- function f_d() {}
- function f_e() {}
-}
-
-$t = new class_c();
-echo $t->test('if_a');
-echo $t->test('if_b');
-echo $t->test('if_c');
-echo $t->test('if_d');
-echo $t->test('if_e');
-
-echo "class_d\n";
-
-class class_d extends base implements if_d{
- function f_a() {}
- function f_b() {}
- function f_c() {}
- function f_d() {}
- function f_e() {}
-}
-
-$t = new class_d();
-echo $t->test('if_a');
-echo $t->test('if_b');
-echo $t->test('if_c');
-echo $t->test('if_d');
-echo $t->test('if_e');
-
-echo "class_e\n";
-
-class class_e extends base implements if_a, if_b, if_c, if_d {
- function f_a() {}
- function f_b() {}
- function f_c() {}
- function f_d() {}
- function f_e() {}
-}
-
-$t = new class_e();
-echo $t->test('if_a');
-echo $t->test('if_b');
-echo $t->test('if_c');
-echo $t->test('if_d');
-echo $t->test('if_e');
-
-echo "class_f\n";
-
-class class_f extends base implements if_e {
- function f_a() {}
- function f_b() {}
- function f_c() {}
- function f_d() {}
- function f_e() {}
-}
-
-$t = new class_f();
-echo $t->test('if_a');
-echo $t->test('if_b');
-echo $t->test('if_c');
-echo $t->test('if_d');
-echo $t->test('if_e');
-
-echo "class_g\n";
-
-class class_g extends base implements if_f {
- function f_a() {}
- function f_b() {}
- function f_c() {}
- function f_d() {}
- function f_e() {}
-}
-
-$t = new class_g();
-echo $t->test('if_a');
-echo $t->test('if_b');
-echo $t->test('if_c');
-echo $t->test('if_d');
-echo $t->test('if_e');
-
-?>
---EXPECTF--
-class_a
-is_a(class_a, if_a) yes
-is_a(class_a, if_b) no
-is_a(class_a, if_c) no
-is_a(class_a, if_d) no
-is_a(class_a, if_e) no
-class_b
-is_a(class_b, if_a) yes
-is_a(class_b, if_b) yes
-is_a(class_b, if_c) no
-is_a(class_b, if_d) no
-is_a(class_b, if_e) no
-class_c
-is_a(class_c, if_a) yes
-is_a(class_c, if_b) yes
-is_a(class_c, if_c) yes
-is_a(class_c, if_d) no
-is_a(class_c, if_e) no
-class_d
-is_a(class_d, if_a) yes
-is_a(class_d, if_b) yes
-is_a(class_d, if_c) no
-is_a(class_d, if_d) yes
-is_a(class_d, if_e) no
-class_e
-is_a(class_e, if_a) yes
-is_a(class_e, if_b) yes
-is_a(class_e, if_c) yes
-is_a(class_e, if_d) yes
-is_a(class_e, if_e) no
-class_f
-is_a(class_f, if_a) no
-is_a(class_f, if_b) no
-is_a(class_f, if_c) no
-is_a(class_f, if_d) no
-is_a(class_f, if_e) yes
-class_g
-is_a(class_g, if_a) yes
-is_a(class_g, if_b) yes
-is_a(class_g, if_c) yes
-is_a(class_g, if_d) yes
-is_a(class_g, if_e) yes \ No newline at end of file
diff --git a/tests/classes/interface_implemented.phpt b/tests/classes/interface_implemented.phpt
deleted file mode 100644
index 9edef873ba..0000000000
--- a/tests/classes/interface_implemented.phpt
+++ /dev/null
@@ -1,103 +0,0 @@
---TEST--
-An interface is inherited
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-interface if_a {
- abstract function f_a();
-}
-
-interface if_b extends if_a {
- abstract function f_b();
-}
-
-class base {
- function _is_a($sub) {
- echo 'is_a('.get_class($this).', '.$sub.') = '.(is_a($this, $sub) ? 'yes' : 'no')."\n";
- }
- function test() {
- echo $this->_is_a('base');
- echo $this->_is_a('derived_a');
- echo $this->_is_a('derived_b');
- echo $this->_is_a('derived_c');
- echo $this->_is_a('derived_d');
- echo $this->_is_a('if_a');
- echo $this->_is_a('if_b');
- echo "\n";
- }
-}
-
-class derived_a extends base implements if_a {
- function f_a() {}
-}
-
-class derived_b extends base implements if_a, if_b {
- function f_a() {}
- function f_b() {}
-}
-
-class derived_c extends derived_a implements if_b {
- function f_b() {}
-}
-
-class derived_d extends derived_c {
-}
-
-$t = new base();
-$t->test();
-
-$t = new derived_a();
-$t->test();
-
-$t = new derived_b();
-$t->test();
-
-$t = new derived_c();
-$t->test();
-
-$t = new derived_d();
-$t->test();
-
-?>
---EXPECTF--
-is_a(base, base) = yes
-is_a(base, derived_a) = no
-is_a(base, derived_b) = no
-is_a(base, derived_c) = no
-is_a(base, derived_d) = no
-is_a(base, if_a) = no
-is_a(base, if_b) = no
-
-is_a(derived_a, base) = yes
-is_a(derived_a, derived_a) = yes
-is_a(derived_a, derived_b) = no
-is_a(derived_a, derived_c) = no
-is_a(derived_a, derived_d) = no
-is_a(derived_a, if_a) = yes
-is_a(derived_a, if_b) = no
-
-is_a(derived_b, base) = yes
-is_a(derived_b, derived_a) = no
-is_a(derived_b, derived_b) = yes
-is_a(derived_b, derived_c) = no
-is_a(derived_b, derived_d) = no
-is_a(derived_b, if_a) = yes
-is_a(derived_b, if_b) = yes
-
-is_a(derived_c, base) = yes
-is_a(derived_c, derived_a) = yes
-is_a(derived_c, derived_b) = no
-is_a(derived_c, derived_c) = yes
-is_a(derived_c, derived_d) = no
-is_a(derived_c, if_a) = yes
-is_a(derived_c, if_b) = yes
-
-is_a(derived_d, base) = yes
-is_a(derived_d, derived_a) = yes
-is_a(derived_d, derived_b) = no
-is_a(derived_d, derived_c) = yes
-is_a(derived_d, derived_d) = yes
-is_a(derived_d, if_a) = yes
-is_a(derived_d, if_b) = yes
diff --git a/tests/classes/interface_instantiate.phpt b/tests/classes/interface_instantiate.phpt
deleted file mode 100644
index c568bbe855..0000000000
--- a/tests/classes/interface_instantiate.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-An interface cannot be instantiated
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-interface if_a {
- abstract function f_a();
-}
-
-$t = new if_a();
-
-?>
---EXPECTF--
-Fatal error: Cannot instantiate interface if_a in %s on line %d
diff --git a/tests/classes/interface_member.phpt b/tests/classes/interface_member.phpt
deleted file mode 100644
index f47b758e4c..0000000000
--- a/tests/classes/interface_member.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-An interface cannot have properties
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-interface if_a {
- var $member;
-}
-?>
---EXPECTF--
-Fatal error: Interfaces may not include member variables in %s on line %d
diff --git a/tests/classes/interface_method.phpt b/tests/classes/interface_method.phpt
deleted file mode 100644
index 08d38229a3..0000000000
--- a/tests/classes/interface_method.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-An interface method must be abstract
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-interface if_a {
- function err() {};
-}
-
-?>
---EXPECTF--
-
-Fatal error: Interface function if_a::err() cannot contain body %s on line %d
diff --git a/tests/classes/interface_method_final.phpt b/tests/classes/interface_method_final.phpt
deleted file mode 100644
index 6d06dccc3d..0000000000
--- a/tests/classes/interface_method_final.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-An interface method cannot be final
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class if_a {
- abstract final function err();
-}
-
-?>
---EXPECTF--
-
-Fatal error: Cannot use the final modifier on an abstract class member in %s on line %d
diff --git a/tests/classes/interface_method_private.phpt b/tests/classes/interface_method_private.phpt
deleted file mode 100644
index 822e2b87dd..0000000000
--- a/tests/classes/interface_method_private.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-An interface method cannot be private
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-interface if_a {
- abstract private function err();
-}
-
-?>
---EXPECTF--
-
-Fatal error: Access type for interface method if_a::err() must be omitted or declared public in %s on line %d
diff --git a/tests/classes/interface_must_be_implemented.phpt b/tests/classes/interface_must_be_implemented.phpt
deleted file mode 100644
index 5277fadfa0..0000000000
--- a/tests/classes/interface_must_be_implemented.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-An interface must be implemented
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-interface if_a {
- abstract function f_a();
-}
-
-class derived_a implements if_a {
-}
-
-?>
---EXPECTF--
-Fatal error: Class derived_a contains 1 abstract methods and must therefore be declared abstract (if_a::f_a) in %s on line %d
diff --git a/tests/classes/interfaces_001.phpt b/tests/classes/interfaces_001.phpt
deleted file mode 100644
index 41e1f6776d..0000000000
--- a/tests/classes/interfaces_001.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-ZE2 interfaces
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-interface Throwable {
- public function getMessage();
-}
-
-class Exception_foo implements Throwable {
- public $foo = "foo";
-
- public function getMessage() {
- return $this->foo;
- }
-}
-
-$foo = new Exception_foo;
-echo $foo->getMessage() . "\n";
-
-?>
---EXPECT--
-foo
-
diff --git a/tests/classes/interfaces_002.phpt b/tests/classes/interfaces_002.phpt
deleted file mode 100644
index d5267bfcf2..0000000000
--- a/tests/classes/interfaces_002.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-ZE2 interface with an unimplemented method
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-interface Throwable {
- public function getMessage();
- public function getErrno();
-}
-
-class Exception_foo implements Throwable {
- public $foo = "foo";
-
- public function getMessage() {
- return $this->foo;
- }
-}
-
-// this should die -- Exception class must be abstract...
-$foo = new Exception_foo;
-echo $foo->getMessage() . "\n";
-
-?>
---EXPECTF--
-
-Fatal error: Class exception_foo contains 1 abstract methods and must therefore be declared abstract (throwable::geterrno) in %s on line %d
-
diff --git a/tests/classes/object_reference_001.phpt b/tests/classes/object_reference_001.phpt
deleted file mode 100644
index 360d19e10b..0000000000
--- a/tests/classes/object_reference_001.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-ZE2 object references
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class Foo {
- var $name;
-
- function Foo() {
- $this->name = "I'm Foo!\n";
- }
-}
-
-$foo = new Foo;
-echo $foo->name;
-$bar = $foo;
-$bar->name = "I'm Bar!\n";
-
-// In ZE1, we would expect "I'm Foo!"
-echo $foo->name;
-
-?>
---EXPECT--
-I'm Foo!
-I'm Bar!
diff --git a/tests/classes/private_001.phpt b/tests/classes/private_001.phpt
deleted file mode 100644
index 93c2eb20ed..0000000000
--- a/tests/classes/private_001.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-A private method can only be called inside the class
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class pass {
- private static function show() {
- echo "Call show()\n";
- }
-
- public static function do_show() {
- pass::show();
- }
-}
-
-pass::do_show();
-pass::show();
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Call show()
-
-Fatal error: Call to private method pass::show() from context '' in %s on line %d
diff --git a/tests/classes/private_002.phpt b/tests/classes/private_002.phpt
deleted file mode 100644
index 03e27864d5..0000000000
--- a/tests/classes/private_002.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-A private method cannot be called in another class
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class pass {
- private static function show() {
- echo "Call pass::show()\n";
- }
-
- public static function do_show() {
- pass::show();
- }
-}
-
-pass::do_show();
-
-class fail {
- public static function show() {
- echo "Call fail::show()\n";
- pass::show();
- }
-}
-
-fail::show();
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Call pass::show()
-Call fail::show()
-
-Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d
diff --git a/tests/classes/private_003.phpt b/tests/classes/private_003.phpt
deleted file mode 100644
index d65222de94..0000000000
--- a/tests/classes/private_003.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-A private method cannot be called in a derived class
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-ini_set("error_reporting",2039);
-class pass {
- private static function show() {
- echo "Call show()\n";
- }
-
- protected static function good() {
- pass::show();
- }
-}
-
-class fail extends pass {
- static function ok() {
- pass::good();
- }
-
- static function not_ok() {
- pass::show();
- }
-}
-
-fail::ok();
-fail::not_ok(); // calling a private function
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Call show()
-
-Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d
diff --git a/tests/classes/private_003b.phpt b/tests/classes/private_003b.phpt
deleted file mode 100644
index ff64a16de8..0000000000
--- a/tests/classes/private_003b.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-A private method cannot be called in a derived class
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class pass {
- private function show() {
- echo "Call show()\n";
- }
-
- protected function good() {
- $this->show();
- }
-}
-
-class fail extends pass {
- public function ok() {
- $this->good();
- }
-
- public function not_ok() {
- $this->show();
- }
-}
-
-$t = new fail();
-$t->ok();
-$t->not_ok(); // calling a private function
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Call show()
-
-Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d
diff --git a/tests/classes/private_004.phpt b/tests/classes/private_004.phpt
deleted file mode 100644
index 2d34c191cd..0000000000
--- a/tests/classes/private_004.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-A private method cannot be called in a derived class
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class pass {
- private static function show() {
- echo "Call show()\n";
- }
-
- public static function do_show() {
- pass::show();
- }
-}
-
-class fail extends pass {
- static function do_show() {
- fail::show();
- }
-}
-
-pass::do_show();
-fail::do_show();
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Call show()
-
-Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d
diff --git a/tests/classes/private_004b.phpt b/tests/classes/private_004b.phpt
deleted file mode 100644
index 979e1c700a..0000000000
--- a/tests/classes/private_004b.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-A private method cannot be called in a derived class
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class pass {
- private function show() {
- echo "Call show()\n";
- }
-
- public function do_show() {
- $this->show();
- }
-}
-
-class fail extends pass {
- function do_show() {
- $this->show();
- }
-}
-
-$t = new pass();
-$t->do_show();
-
-$t2 = new fail();
-$t2->do_show();
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Call show()
-
-Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d \ No newline at end of file
diff --git a/tests/classes/private_005.phpt b/tests/classes/private_005.phpt
deleted file mode 100644
index 482b20ef35..0000000000
--- a/tests/classes/private_005.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-A private method cannot be called in a derived class
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class pass {
- private static function show() {
- echo "Call show()\n";
- }
-
- public static function do_show() {
- pass::show();
- }
-}
-
-class fail extends pass {
- static function do_show() {
- pass::show();
- }
-}
-
-pass::do_show();
-fail::do_show();
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Call show()
-
-Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d
diff --git a/tests/classes/private_005b.phpt b/tests/classes/private_005b.phpt
deleted file mode 100644
index 979e1c700a..0000000000
--- a/tests/classes/private_005b.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-A private method cannot be called in a derived class
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class pass {
- private function show() {
- echo "Call show()\n";
- }
-
- public function do_show() {
- $this->show();
- }
-}
-
-class fail extends pass {
- function do_show() {
- $this->show();
- }
-}
-
-$t = new pass();
-$t->do_show();
-
-$t2 = new fail();
-$t2->do_show();
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Call show()
-
-Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d \ No newline at end of file
diff --git a/tests/classes/private_006.phpt b/tests/classes/private_006.phpt
deleted file mode 100644
index 7055efd255..0000000000
--- a/tests/classes/private_006.phpt
+++ /dev/null
@@ -1,41 +0,0 @@
---TEST--
-A private method can be overwritten in a second derived class
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-class first {
- private static function show() {
- echo "Call show()\n";
- }
-
- public static function do_show() {
- first::show();
- }
-}
-
-first::do_show();
-
-class second extends first {
-}
-
-second::do_show();
-
-class third extends second {
-}
-
-third::do_show();
-
-class fail extends third {
- static function show() { // cannot be redeclared
- echo "Call show()\n";
- }
-}
-
-echo "Done\n";
-?>
---EXPECTF--
-Call show()
-Call show()
-Call show()
-Done
diff --git a/tests/classes/private_006b.phpt b/tests/classes/private_006b.phpt
deleted file mode 100644
index 329ba33b37..0000000000
--- a/tests/classes/private_006b.phpt
+++ /dev/null
@@ -1,41 +0,0 @@
---TEST--
-A private method can be overwritten in a second derived class
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class first {
- private function show() {
- echo "Call show()\n";
- }
-
- public function do_show() {
- $this->show();
- }
-}
-
-$t1 = new first();
-$t1->do_show();
-
-class second extends first {
-}
-
-//$t2 = new second();
-//$t2->do_show();
-
-class third extends second {
- private function show() {
- echo "Call show()\n";
- }
-}
-
-$t3 = new third();
-$t3->do_show();
-
-echo "Done\n";
-?>
---EXPECTF--
-Call show()
-Call show()
-Done \ No newline at end of file
diff --git a/tests/classes/private_007.phpt b/tests/classes/private_007.phpt
deleted file mode 100644
index 09503f0b96..0000000000
--- a/tests/classes/private_007.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-A derived class does not know about privates of ancestors
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class Bar {
- public static function pub() {
- Bar::priv();
- }
- private static function priv() {
- echo "Bar::priv()\n";
- }
-}
-class Foo extends Bar {
- public static function priv() {
- echo "Foo::priv()\n";
- }
-}
-
-Foo::pub();
-Foo::priv();
-
-echo "Done\n";
-?>
---EXPECTF--
-Bar::priv()
-Foo::priv()
-Done
diff --git a/tests/classes/private_007b.phpt b/tests/classes/private_007b.phpt
deleted file mode 100644
index 453e250b61..0000000000
--- a/tests/classes/private_007b.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-A derived class does not know about privates of ancestors
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class Bar {
- public function pub() {
- $this->priv();
- }
- private function priv() {
- echo "Bar::priv()\n";
- }
-}
-class Foo extends Bar {
- public function priv() {
- echo "Foo::priv()\n";
- }
-}
-
-$obj = new Foo();
-$obj->pub();
-$obj->priv();
-
-echo "Done\n";
-?>
---EXPECTF--
-Bar::priv()
-Foo::priv()
-Done
diff --git a/tests/classes/protected_001.phpt b/tests/classes/protected_001.phpt
deleted file mode 100644
index 6814a7cdbe..0000000000
--- a/tests/classes/protected_001.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-A protected method can only be called inside the class
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class pass {
- protected static function fail() {
- echo "Call fail()\n";
- }
-
- public static function good() {
- pass::fail();
- }
-}
-
-pass::good();
-pass::fail();// must fail because we are calling from outside of class pass
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Call fail()
-
-Fatal error: Call to protected method pass::fail() from context '' in %s on line %d
diff --git a/tests/classes/protected_001b.phpt b/tests/classes/protected_001b.phpt
deleted file mode 100644
index 2670ff8ebc..0000000000
--- a/tests/classes/protected_001b.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-A protected method can only be called inside the class
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class pass {
- protected function fail() {
- echo "Call fail()\n";
- }
-
- public function good() {
- $this->fail();
- }
-}
-
-$t = new pass();
-$t->good();
-$t->fail();// must fail because we are calling from outside of class pass
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Call fail()
-
-Fatal error: Call to protected method pass::fail() from context '' in %s on line %d
diff --git a/tests/classes/protected_002.phpt b/tests/classes/protected_002.phpt
deleted file mode 100644
index 19d31645b9..0000000000
--- a/tests/classes/protected_002.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-A protected method cannot be called in another class
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class pass {
- protected static function show() {
- echo "Call pass::show()\n";
- }
-
- public static function do_show() {
- pass::show();
- }
-}
-
-pass::do_show();
-
-class fail {
- public static function show() {
- echo "Call fail::show()\n";
- pass::show();
- }
-}
-
-fail::show();
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Call pass::show()
-Call fail::show()
-
-Fatal error: Call to protected method pass::show() from context 'fail' in %s on line %d
diff --git a/tests/classes/singleton_001.phpt b/tests/classes/singleton_001.phpt
deleted file mode 100644
index ee729b980c..0000000000
--- a/tests/classes/singleton_001.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-ZE2 singleton
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class Counter {
- private $counter = 0;
-
- function increment_and_print() {
- echo ++$this->counter;
- echo "\n";
- }
-}
-
-
-class SingletonCounter {
- private static $m_instance = NULL;
-
- static function Instance() {
- if (self::$m_instance == NULL) {
- self::$m_instance = new Counter();
- }
- return self::$m_instance;
- }
-}
-
-SingletonCounter::Instance()->increment_and_print();
-SingletonCounter::Instance()->increment_and_print();
-SingletonCounter::Instance()->increment_and_print();
-
-?>
---EXPECT--
-1
-2
-3
diff --git a/tests/classes/static_mix_1.phpt b/tests/classes/static_mix_1.phpt
deleted file mode 100644
index 06e7882694..0000000000
--- a/tests/classes/static_mix_1.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-You cannot overload a static method with a non static method
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class pass {
- static function show() {
- echo "Call to function pass::show()\n";
- }
-}
-
-class fail extends pass {
- function show() {
- echo "Call to function fail::show()\n";
- }
-}
-
-pass::show();
-fail::show();
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Fatal error: Cannot make static method pass::show() non static in class fail in %s on line %d \ No newline at end of file
diff --git a/tests/classes/static_mix_2.phpt b/tests/classes/static_mix_2.phpt
deleted file mode 100644
index 3052271307..0000000000
--- a/tests/classes/static_mix_2.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-You cannot overload a non static method with a static method
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class pass {
- function show() {
- echo "Call to function pass::show()\n";
- }
-}
-
-class fail extends pass {
- static function show() {
- echo "Call to function fail::show()\n";
- }
-}
-
-$t = new pass();
-$t->show();
-fail::show();
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Fatal error: Cannot make non static method pass::show() static in class fail in %s on line %d \ No newline at end of file
diff --git a/tests/classes/type_hinting_001.phpt b/tests/classes/type_hinting_001.phpt
deleted file mode 100644
index e6b97a5873..0000000000
--- a/tests/classes/type_hinting_001.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-ZE2 class type hinting
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-interface Foo {
- function a(Foo $foo);
-}
-
-interface Bar {
- function b(Bar $bar);
-}
-
-class FooBar implements Foo, Bar {
- function a(Foo $foo) {
- // ...
- }
-
- function b(Bar $bar) {
- // ...
- }
-}
-
-class Blort {
-}
-
-$a = new FooBar;
-$b = new Blort;
-
-$a->a($b);
-$a->b($b);
-
-?>
---EXPECTF--
-
-Fatal error: Argument 1 must implement interface foo in %s on line %d
diff --git a/tests/classes/visibility_000a.phpt b/tests/classes/visibility_000a.phpt
deleted file mode 100644
index c7962b9ac5..0000000000
--- a/tests/classes/visibility_000a.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-A redeclared method must have the same or higher visibility
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class same extends father {
-
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class fail extends same {
- protected function f0() {}
-}
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Fatal error: Access level to fail::f0() must be public (as in class same) in %s on line %d
diff --git a/tests/classes/visibility_000b.phpt b/tests/classes/visibility_000b.phpt
deleted file mode 100644
index af80992dea..0000000000
--- a/tests/classes/visibility_000b.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-A redeclared method must have the same or higher visibility
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class same extends father {
-
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class fail extends same {
- private function f0() {}
-}
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Fatal error: Access level to fail::f0() must be public (as in class same) in %s on line %d
diff --git a/tests/classes/visibility_000c.phpt b/tests/classes/visibility_000c.phpt
deleted file mode 100644
index 014585229b..0000000000
--- a/tests/classes/visibility_000c.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-A redeclared method must have the same or higher visibility
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class same extends father {
-
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class fail extends same {
- function f0() {}
-}
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Done
diff --git a/tests/classes/visibility_001a.phpt b/tests/classes/visibility_001a.phpt
deleted file mode 100644
index 844a3ffe4f..0000000000
--- a/tests/classes/visibility_001a.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-A redeclared method must have the same or higher visibility
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class same extends father {
-
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class fail extends same {
- protected function f1() {}
-}
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Fatal error: Access level to fail::f1() must be public (as in class same) in %s on line %d
diff --git a/tests/classes/visibility_001b.phpt b/tests/classes/visibility_001b.phpt
deleted file mode 100644
index 54d0283a5f..0000000000
--- a/tests/classes/visibility_001b.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-A redeclared method must have the same or higher visibility
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class same extends father {
-
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class fail extends same {
- private function f1() {}
-}
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Fatal error: Access level to fail::f1() must be public (as in class same) in %s on line %d
diff --git a/tests/classes/visibility_001c.phpt b/tests/classes/visibility_001c.phpt
deleted file mode 100644
index 171421251b..0000000000
--- a/tests/classes/visibility_001c.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-A redeclared method must have the same or higher visibility
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class same extends father {
-
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class fail extends same {
- function f1() {}
-}
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Done
diff --git a/tests/classes/visibility_002a.phpt b/tests/classes/visibility_002a.phpt
deleted file mode 100644
index 9fed6225c8..0000000000
--- a/tests/classes/visibility_002a.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-A redeclared method must have the same or higher visibility
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class same extends father {
-
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class fail extends same {
- protected function f2() {}
-}
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Fatal error: Access level to fail::f2() must be public (as in class same) in %s on line %d
diff --git a/tests/classes/visibility_002b.phpt b/tests/classes/visibility_002b.phpt
deleted file mode 100644
index c4b7cadab4..0000000000
--- a/tests/classes/visibility_002b.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-A redeclared method must have the same or higher visibility
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class same extends father {
-
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class fail extends same {
- private function f2() {}
-}
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Fatal error: Access level to fail::f2() must be public (as in class same) in %s on line %d
diff --git a/tests/classes/visibility_002c.phpt b/tests/classes/visibility_002c.phpt
deleted file mode 100644
index c906a823e9..0000000000
--- a/tests/classes/visibility_002c.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-A redeclared method must have the same or higher visibility
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class same extends father {
-
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class fail extends same {
- function f2() {}
-}
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Done
diff --git a/tests/classes/visibility_003a.phpt b/tests/classes/visibility_003a.phpt
deleted file mode 100644
index 27572ececa..0000000000
--- a/tests/classes/visibility_003a.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-A redeclared method must have the same or higher visibility
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class same extends father {
-
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class fail extends same {
- public function f3() {}
-}
-
-echo "Done\n";
-?>
---EXPECTF--
-Done
diff --git a/tests/classes/visibility_003b.phpt b/tests/classes/visibility_003b.phpt
deleted file mode 100644
index f2de2d2ff6..0000000000
--- a/tests/classes/visibility_003b.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-A redeclared method must have the same or higher visibility
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class same extends father {
-
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class fail extends same {
- private function f3() {}
-}
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Fatal error: Access level to fail::f3() must be protected (as in class same) or weaker in %s on line %d
diff --git a/tests/classes/visibility_003c.phpt b/tests/classes/visibility_003c.phpt
deleted file mode 100644
index fcb9592ff7..0000000000
--- a/tests/classes/visibility_003c.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-A redeclared method must have the same or higher visibility
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class same extends father {
-
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class fail extends same {
- function f3() {}
-}
-
-echo "Done\n";
-?>
---EXPECTF--
-Done
diff --git a/tests/classes/visibility_004a.phpt b/tests/classes/visibility_004a.phpt
deleted file mode 100644
index 8aaaa0f3f5..0000000000
--- a/tests/classes/visibility_004a.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-A redeclared method must have the same or higher visibility
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class same extends father {
-
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class fail extends same {
- public function f4() {}
-}
-
-echo "Done\n";
-?>
---EXPECTF--
-Done
diff --git a/tests/classes/visibility_004b.phpt b/tests/classes/visibility_004b.phpt
deleted file mode 100644
index 90d0b72f62..0000000000
--- a/tests/classes/visibility_004b.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-A redeclared method must have the same or higher visibility
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class same extends father {
-
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class fail extends same {
- protected function f4() {}
-}
-
-echo "Done\n"; // shouldn't be displayed
-?>
---EXPECTF--
-Done
diff --git a/tests/classes/visibility_004c.phpt b/tests/classes/visibility_004c.phpt
deleted file mode 100644
index e488bfeae8..0000000000
--- a/tests/classes/visibility_004c.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-A redeclared method must have the same or higher visibility
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class same extends father {
-
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
-}
-
-class fail extends same {
- function f4() {}
-}
-
-echo "Done\n";
-?>
---EXPECTF--
-Done
diff --git a/tests/foo b/tests/foo
deleted file mode 100644
index 125c655b0f..0000000000
--- a/tests/foo
+++ /dev/null
@@ -1,5 +0,0 @@
-a
-b
-@c@
-d
-e
diff --git a/tests/foo2 b/tests/foo2
deleted file mode 100644
index 4cdd41e3dc..0000000000
--- a/tests/foo2
+++ /dev/null
@@ -1,3 +0,0 @@
-<?
-
-print $a->b(12,13)."\n";
diff --git a/tests/foo3 b/tests/foo3
deleted file mode 100644
index 08681b98c2..0000000000
--- a/tests/foo3
+++ /dev/null
@@ -1,43 +0,0 @@
-<?
-
-class foo {
- function foo() {
- print "foo()\n";
- }
- function bar(&$blah, $foobar=7) {
- $foobar += 19;
- }
-
- function hello_world() {
- return "Hello, World!";
- }
-
- function print_string($str) {
- print "$str\n";
- return 666;
- }
- var $foo;
- var $bar="this is a test...";
-};
-
-class bar {
- function foo($a,$b) {
- $a *= 3;
- return $a+$b;
- }
- function bar(&$blah, $foobar=7) {
- $foobar += 19;
- }
-
- var $foo;
- var $bar="this is a test...";
-};
-
-
-$b = new foo;
-$a = $b;
-print $a->print_string($a->hello_world())."\n";
-print $b->print_string($b->hello_world())."\n";
-$a->foo = 5;
-print $a->foo;
-print $a->foo();
diff --git a/tests/foo4 b/tests/foo4
deleted file mode 100644
index 29df84d0e2..0000000000
--- a/tests/foo4
+++ /dev/null
@@ -1,41 +0,0 @@
-<?
-
-class foo {
- function foo($a,$b) {
- $a *= 3;
- return $a+$b;
- }
- function bar(&$blah, $foobar=7) {
- $foobar += 19;
- }
-
- function hello_world() {
- return "Hello, World!";
- }
-
- function print_string($str) {
- print "$str\n";
- return 666;
- }
- var $foo;
- var $bar="this is a test....";
-};
-
-class bar {
- function foo($a,$b) {
- $a *= 3;
- return $a+$b;
- }
- function bar(&$blah, $foobar=7) {
- $foobar += 19;
- }
-
- var $foo;
- var $bar="this is a test...";
-};
-
-
-$b = new foo;
-$a = &$b;
-$b->asd = 5;
-print $b->asd;
diff --git a/tests/func/001.phpt b/tests/func/001.phpt
deleted file mode 100644
index d08040679b..0000000000
--- a/tests/func/001.phpt
+++ /dev/null
@@ -1,6 +0,0 @@
---TEST--
-Strlen() function test
---FILE--
-<?php echo strlen("abcdef")?>
---EXPECT--
-6
diff --git a/tests/func/002.phpt b/tests/func/002.phpt
deleted file mode 100644
index 84e00eeeb5..0000000000
--- a/tests/func/002.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Static variables in functions
---SKIPIF--
-<?php if(version_compare(zend_version(), "2.0.0-dev", '>=')) echo "skip removed in Zend Engine 2\n"; ?>
---FILE--
-<?php
-old_function blah (
- static $hey=0,$yo=0;
-
- echo "hey=".$hey++.", ",$yo--."\n";
-);
-
-blah();
-blah();
-blah();
-if (isset($hey) || isset($yo)) {
- echo "Local variables became global :(\n";
-}
---EXPECT--
-hey=0, 0
-hey=1, -1
-hey=2, -2
diff --git a/tests/func/003.phpt b/tests/func/003.phpt
deleted file mode 100644
index 8afaf8a326..0000000000
--- a/tests/func/003.phpt
+++ /dev/null
@@ -1,289 +0,0 @@
---TEST--
-General function test
---SKIPIF--
-<?php if(version_compare(zend_version(), "2.0.0-dev", '>=')) echo "skip removed in Zend Engine 2\n"; ?>
---FILE--
-<?php
-
-old_function a (
- echo "hey\n";
-);
-
-function b($i)
-{
- echo "$i\n";
-}
-
-
-function c($i,$j)
-{
- echo "Counting from $i to $j\n";
- for ($k=$i; $k<=$j; $k++) {
- echo "$k\n";
- }
-}
-
-
-
-a();
-b("blah");
-a();
-b("blah","blah");
-c(7,14);
-
-a();
-
-
-old_function factorial $n (
- if ($n==0 || $n==1) {
- return 1;
- } else {
- return factorial($n-1)*$n;
- }
-);
-
-
-function factorial2($start, $n)
-{
- if ($n<=$start) {
- return $start;
- } else {
- return factorial2($start,$n-1)*$n;
- }
-}
-
-
-for ($k=0; $k<10; $k++) {
- for ($i=0; $i<=10; $i++) {
- $n=factorial($i);
- echo "factorial($i) = $n\n";
- }
-}
-
-
-echo "and now, from a function...\n";
-
-old_function call_fact (
- echo "(it should break at 5...)\n";
- for ($i=0; $i<=10; $i++) {
- if ($i == 5) break;
- $n=factorial($i);
- echo "factorial($i) = $n\n";
- }
-);
-
-old_function return4 ( return 4; );
-old_function return7 ( return 7; );
-
-for ($k=0; $k<10; $k++) {
- call_fact();
-}
-
-echo "------\n";
-$result = factorial(factorial(3));
-echo "$result\n";
-
-$result=factorial2(return4(),return7());
-echo "$result\n";
-
-old_function andi $i, $j (
- for ($k=$i ; $k<=$j ; $k++) {
- if ($k >5) continue;
- echo "$k\n";
- }
-);
-
-andi (3,10);
---EXPECT--
-hey
-blah
-hey
-blah
-Counting from 7 to 14
-7
-8
-9
-10
-11
-12
-13
-14
-hey
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-and now, from a function...
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-------
-720
-840
-3
-4
-5
-
diff --git a/tests/func/004.phpt b/tests/func/004.phpt
deleted file mode 100644
index 7ef452be66..0000000000
--- a/tests/func/004.phpt
+++ /dev/null
@@ -1,65 +0,0 @@
---TEST--
-General function test
---SKIPIF--
-<?php if(version_compare(zend_version(), "2.0.0-dev", '>=')) echo "skip removed in Zend Engine 2\n"; ?>
---FILE--
-<?php
-
-echo "Before function declaration...\n";
-
-old_function print_something_multiple_times $something,$times (
- echo "----\nIn function, printing the string \"$something\" $times times\n";
- for ($i=0; $i<$times; $i++) {
- echo "$i) $something\n";
- }
- echo "Done with function...\n-----\n";
-);
-
-old_function some_other_function (
- echo "This is some other function, to ensure more than just one function works fine...\n";
-);
-
-
-echo "After function declaration...\n";
-
-echo "Calling function for the first time...\n";
-print_something_multiple_times("This works!",10);
-echo "Returned from function call...\n";
-
-echo "Calling the function for the second time...\n";
-print_something_multiple_times("This like, really works and stuff...",3);
-echo "Returned from function call...\n";
-
-some_other_function();
-
-?>
---EXPECT--
-
-Before function declaration...
-After function declaration...
-Calling function for the first time...
-----
-In function, printing the string "This works!" 10 times
-0) This works!
-1) This works!
-2) This works!
-3) This works!
-4) This works!
-5) This works!
-6) This works!
-7) This works!
-8) This works!
-9) This works!
-Done with function...
------
-Returned from function call...
-Calling the function for the second time...
-----
-In function, printing the string "This like, really works and stuff..." 3 times
-0) This like, really works and stuff...
-1) This like, really works and stuff...
-2) This like, really works and stuff...
-Done with function...
------
-Returned from function call...
-This is some other function, to ensure more than just one function works fine...
diff --git a/tests/func/005.phpt b/tests/func/005.phpt
deleted file mode 100644
index c4215feb49..0000000000
--- a/tests/func/005.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Testing register_shutdown_function()
---FILE--
-<?php
-
-function foo()
-{
- print "foo";
-}
-
-register_shutdown_function("foo");
-
-print "foo() will be called on shutdown...\n";
-
-?>
---EXPECT--
-foo() will be called on shutdown...
-foo
-
diff --git a/tests/func/005a.phpt b/tests/func/005a.phpt
deleted file mode 100644
index f7843e10a3..0000000000
--- a/tests/func/005a.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-Testing register_shutdown_function() with timeout. (Bug: #21513)
---FILE--
-<?php
-
-ini_set('display_errors', 0);
-
-echo "Start\n";
-
-function boo()
-{
- echo "Shutdown\n";
-}
-
-register_shutdown_function("boo");
-
-/* not necessary, just to show the error sooner */
-set_time_limit(1);
-
-/* infinite loop to simulate long processing */
-for (;;) {}
-
-echo "End\n";
-
-?>
---EXPECT--
-Start
-Shutdown
diff --git a/tests/func/006.phpt b/tests/func/006.phpt
deleted file mode 100644
index 077b6f873c..0000000000
--- a/tests/func/006.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-Output buffering tests
---INI--
-output_buffering=0
-output_handler=
-zlib.output_compression=0
-zlib.output_handler=
---FILE--
-<?php
-ob_start();
-echo ob_get_level();
-echo 'A';
- ob_start();
- echo ob_get_level();
- echo 'B';
- $b = ob_get_contents();
- ob_end_clean();
-$a = ob_get_contents();
-ob_end_clean();
-
-var_dump( $b ); // 2B
-var_dump( $a ); // 1A
-?>
---EXPECT--
-string(2) "2B"
-string(2) "1A"
diff --git a/tests/func/007.phpt b/tests/func/007.phpt
deleted file mode 100644
index 73aae2e649..0000000000
--- a/tests/func/007.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-INI functions test
---FILE--
-<?php
-
-$ini1 = ini_get('include_path');
-ini_set('include_path','ini_set_works');
-echo ini_get('include_path')."\n";
-ini_restore('include_path');
-$ini2 = ini_get('include_path');
-
-if ($ini1 !== $ini2) {
- echo "ini_restore() does not work.\n";
-}
-else {
- echo "ini_restore_works\n";
-}
-
-?>
---EXPECT--
-ini_set_works
-ini_restore_works
diff --git a/tests/func/008.phpt b/tests/func/008.phpt
deleted file mode 100644
index 48098e1330..0000000000
--- a/tests/func/008.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-Test for buffering in core functions with implicit flush off
---INI--
-implicit_flush=0
---FILE--
-<?php
-$res = var_export("foo1");
-echo "\n";
-$res = var_export("foo2", TRUE);
-echo "\n";
-echo $res."\n";
-?>
---EXPECT--
-'foo1'
-
-'foo2'
diff --git a/tests/func/009.phpt b/tests/func/009.phpt
deleted file mode 100644
index 05b40e8e67..0000000000
--- a/tests/func/009.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-Test for buffering in core functions with implicit flush on
---INI--
-implicit_flush=1
---FILE--
-<?php
-$res = var_export("foo1");
-echo "\n";
-$res = var_export("foo2", TRUE);
-echo "\n";
-echo $res."\n";
-?>
---EXPECT--
-'foo1'
-
-'foo2'
diff --git a/tests/lang/001.phpt b/tests/lang/001.phpt
deleted file mode 100644
index d90e9b8d3d..0000000000
--- a/tests/lang/001.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Simple If condition test
---POST--
---GET--
---FILE--
-<?php $a=1; if($a>0) { echo "Yes"; } ?>
---EXPECT--
-Yes
diff --git a/tests/lang/002.phpt b/tests/lang/002.phpt
deleted file mode 100644
index dd2c83b4f6..0000000000
--- a/tests/lang/002.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-Simple While Loop Test
---POST--
---GET--
---FILE--
-<?php
-$a=1;
-while ($a<10) {
- echo $a;
- $a++;
-}
-?>
---EXPECT--
-123456789
diff --git a/tests/lang/003.phpt b/tests/lang/003.phpt
deleted file mode 100644
index cb2a3c38cd..0000000000
--- a/tests/lang/003.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Simple Switch Test
---POST--
---GET--
---FILE--
-<?php
-$a=1;
-switch($a) {
- case 0:
- echo "bad";
- break;
- case 1:
- echo "good";
- break;
- default:
- echo "bad";
- break;
-}
-?>
---EXPECT--
-good
diff --git a/tests/lang/004.phpt b/tests/lang/004.phpt
deleted file mode 100644
index bd47328c16..0000000000
--- a/tests/lang/004.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Simple If/Else Test
---POST--
---GET--
---FILE--
-<?php
-$a=1;
-if($a==0) {
- echo "bad";
-} else {
- echo "good";
-}
-?>
---EXPECT--
-good
diff --git a/tests/lang/005.phpt b/tests/lang/005.phpt
deleted file mode 100644
index f74590e860..0000000000
--- a/tests/lang/005.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Simple If/ElseIf/Else Test
---POST--
---GET--
---FILE--
-<?php
-$a=1;
-
-if($a==0) {
- echo "bad";
-} elseif($a==3) {
- echo "bad";
-} else {
- echo "good";
-}
-?>
---EXPECT--
-good
diff --git a/tests/lang/006.phpt b/tests/lang/006.phpt
deleted file mode 100644
index e9e8c2357f..0000000000
--- a/tests/lang/006.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-Nested If/ElseIf/Else Test
---POST--
---GET--
---FILE--
-<?php
-$a=1;
-$b=2;
-
-if($a==0) {
- echo "bad";
-} elseif($a==3) {
- echo "bad";
-} else {
- if($b==1) {
- echo "bad";
- } elseif($b==2) {
- echo "good";
- } else {
- echo "bad";
- }
-}
-?>
---EXPECT--
-good
diff --git a/tests/lang/007.phpt b/tests/lang/007.phpt
deleted file mode 100644
index 04af8111fd..0000000000
--- a/tests/lang/007.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-Function call with global and static variables
---POST--
---GET--
---FILE--
-<?php
-error_reporting(0);
-$a = 10;
-
-function Test()
-{
- static $a=1;
- global $b;
- $c = 1;
- $b = 5;
- echo "$a $b ";
- $a++;
- $c++;
- echo "$a $c ";
-}
-
-Test();
-echo "$a $b $c ";
-Test();
-echo "$a $b $c ";
-Test();
-?>
---EXPECT--
-1 5 2 2 10 5 2 5 3 2 10 5 3 5 4 2
diff --git a/tests/lang/008.phpt b/tests/lang/008.phpt
deleted file mode 100644
index 1e9c86ff5a..0000000000
--- a/tests/lang/008.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Testing recursive function
---POST--
---GET--
---FILE--
-<?php
-
-function Test()
-{
- static $a=1;
- echo "$a ";
- $a++;
- if($a<10): Test(); endif;
-}
-
-Test();
-
-?>
---EXPECT--
-1 2 3 4 5 6 7 8 9
diff --git a/tests/lang/009.phpt b/tests/lang/009.phpt
deleted file mode 100644
index 96278c22b1..0000000000
--- a/tests/lang/009.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Testing function parameter passing
---POST--
---GET--
---FILE--
-<?php
-function test ($a,$b) {
- echo $a+$b;
-}
-test(1,2);
-?>
---EXPECT--
-3
diff --git a/tests/lang/010.phpt b/tests/lang/010.phpt
deleted file mode 100644
index e414baae6e..0000000000
--- a/tests/lang/010.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Testing function parameter passing with a return value
---POST--
---GET--
---FILE--
-<?php
-function test ($b) {
- $b++;
- return($b);
-}
-$a = test(1);
-echo $a;
-?>
---EXPECT--
-2
diff --git a/tests/lang/011.phpt b/tests/lang/011.phpt
deleted file mode 100644
index e648623845..0000000000
--- a/tests/lang/011.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-Testing nested functions
---POST--
---GET--
---FILE--
-<?php
-function F()
-{
- $a = "Hello ";
- return($a);
-}
-
-function G()
-{
- static $myvar = 4;
-
- echo "$myvar ";
- echo F();
- echo "$myvar";
-}
-
-G();
-?>
---EXPECT--
-4 Hello 4
diff --git a/tests/lang/012.phpt b/tests/lang/012.phpt
deleted file mode 100644
index b54132b906..0000000000
--- a/tests/lang/012.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Testing stack after early function return
---POST--
---GET--
---FILE--
-<?php
-function F () {
- if(1) {
- return("Hello");
- }
-}
-
-$i=0;
-while ($i<2) {
- echo F();
- $i++;
-}
-?>
---EXPECT--
-HelloHello
diff --git a/tests/lang/013.phpt b/tests/lang/013.phpt
deleted file mode 100644
index 4b661c071a..0000000000
--- a/tests/lang/013.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Testing eval function
---POST--
---GET--
---FILE--
-<?php
-error_reporting(0);
-$a="echo \"Hello\";";
-eval($a);
-?>
---EXPECT--
-Hello
diff --git a/tests/lang/014.phpt b/tests/lang/014.phpt
deleted file mode 100644
index 6338d7c23c..0000000000
--- a/tests/lang/014.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Testing eval function inside user-defined function
---POST--
---GET--
---FILE--
-<?php
-function F ($a) {
- eval($a);
-}
-
-error_reporting(0);
-F("echo \"Hello\";");
-?>
---EXPECT--
-Hello
diff --git a/tests/lang/015.inc b/tests/lang/015.inc
deleted file mode 100755
index d436a7bb14..0000000000
--- a/tests/lang/015.inc
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
- echo "Hello";
-?>
diff --git a/tests/lang/015.phpt b/tests/lang/015.phpt
deleted file mode 100644
index 399f802866..0000000000
--- a/tests/lang/015.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Testing include
---POST--
---GET--
---FILE--
-<?php
-include "015.inc";
-?>
---EXPECT--
-Hello
diff --git a/tests/lang/016.inc b/tests/lang/016.inc
deleted file mode 100755
index b73333f7b0..0000000000
--- a/tests/lang/016.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-function MyFunc ($a) {
- echo $a;
-}
-?>
diff --git a/tests/lang/016.phpt b/tests/lang/016.phpt
deleted file mode 100644
index 49c4d4d1a6..0000000000
--- a/tests/lang/016.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-Testing user-defined function in included file
---POST--
---GET--
---FILE--
-<?php
-include "016.inc";
-MyFunc("Hello");
-?>
---EXPECT--
-Hello
diff --git a/tests/lang/017.phpt b/tests/lang/017.phpt
deleted file mode 100644
index bb18194e5d..0000000000
--- a/tests/lang/017.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Testing user-defined function falling out of an If into another
---POST--
---GET--
---FILE--
-<?php
-$a = 1;
-function Test ($a) {
- if ($a<3) {
- return(3);
- }
-}
-
-if ($a < Test($a)) {
- echo "$a\n";
- $a++;
-}
-?>
---EXPECT--
-1
diff --git a/tests/lang/018.phpt b/tests/lang/018.phpt
deleted file mode 100644
index 8ef867cb62..0000000000
--- a/tests/lang/018.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-eval() test
---POST--
---GET--
---FILE--
-<?php
-
-error_reporting(0);
-
-$message = "echo \"hey\n\";";
-
-for ($i=0; $i<10; $i++) {
- eval($message);
- echo $i."\n";
-}
---EXPECT--
-hey
-0
-hey
-1
-hey
-2
-hey
-3
-hey
-4
-hey
-5
-hey
-6
-hey
-7
-hey
-8
-hey
-9
diff --git a/tests/lang/019.phpt b/tests/lang/019.phpt
deleted file mode 100644
index f8339b94a3..0000000000
--- a/tests/lang/019.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-eval() test
---POST--
---GET--
---FILE--
-<?php
-
-error_reporting(0);
-
-eval("function test() { echo \"hey, this is a function inside an eval()!\\n\"; }");
-
-$i=0;
-while ($i<10) {
- eval("echo \"hey, this is a regular echo'd eval()\\n\";");
- test();
- $i++;
-}
---EXPECT--
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
diff --git a/tests/lang/020.phpt b/tests/lang/020.phpt
deleted file mode 100644
index e82ba6c467..0000000000
--- a/tests/lang/020.phpt
+++ /dev/null
@@ -1,78 +0,0 @@
---TEST--
-Switch test 1
---POST--
---GET--
---FILE--
-<?php
-
-$i="abc";
-
-for ($j=0; $j<10; $j++) {
-switch (1) {
- case 1:
- echo "In branch 1\n";
- switch ($i) {
- case "ab":
- echo "This doesn't work... :(\n";
- break;
- case "abcd":
- echo "This works!\n";
- break;
- case "blah":
- echo "Hmmm, no worki\n";
- break;
- default:
- echo "Inner default...\n";
- }
- for ($blah=0; $blah<200; $blah++) {
- if ($blah==100) {
- echo "blah=$blah\n";
- }
- }
- break;
- case 2:
- echo "In branch 2\n";
- break;
- case $i:
- echo "In branch \$i\n";
- break;
- case 4:
- echo "In branch 4\n";
- break;
- default:
- echo "Hi, I'm default\n";
- break;
- }
-}
-?>
---EXPECT--
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
diff --git a/tests/lang/021.phpt b/tests/lang/021.phpt
deleted file mode 100644
index 132ffc20c4..0000000000
--- a/tests/lang/021.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-Switch test 2
---POST--
---GET--
---FILE--
-<?php
-
-for ($i=0; $i<=5; $i++)
-{
- echo "i=$i\n";
-
- switch($i) {
- case 0:
- echo "In branch 0\n";
- break;
- case 1:
- echo "In branch 1\n";
- break;
- case 2:
- echo "In branch 2\n";
- break;
- case 3:
- echo "In branch 3\n";
- break 2;
- case 4:
- echo "In branch 4\n";
- break;
- default:
- echo "In default\n";
- break;
- }
-}
-echo "hi\n";
-?>
---EXPECT--
-i=0
-In branch 0
-i=1
-In branch 1
-i=2
-In branch 2
-i=3
-In branch 3
-hi
diff --git a/tests/lang/022.phpt b/tests/lang/022.phpt
deleted file mode 100644
index e1847b2c0e..0000000000
--- a/tests/lang/022.phpt
+++ /dev/null
@@ -1,65 +0,0 @@
---TEST--
-Switch test 3
---POST--
---GET--
---FILE--
-<?php
-
-function switchtest ($i, $j)
-{
- switch ($i) {
- case 0:
- switch($j) {
- case 0:
- echo "zero";
- break;
- case 1:
- echo "one";
- break;
- default:
- echo $j;
- break;
- }
- echo "\n";
- break;
- default:
- echo "Default taken\n";
- }
-}
-for ($i=0; $i<3; $i++) {
- for ($k=0; $k<10; $k++) {
- switchtest (0,$k);
- }
-}
-?>
---EXPECT--
-zero
-one
-2
-3
-4
-5
-6
-7
-8
-9
-zero
-one
-2
-3
-4
-5
-6
-7
-8
-9
-zero
-one
-2
-3
-4
-5
-6
-7
-8
-9
diff --git a/tests/lang/023-1.inc b/tests/lang/023-1.inc
deleted file mode 100755
index 8d52e844c9..0000000000
--- a/tests/lang/023-1.inc
+++ /dev/null
@@ -1,356 +0,0 @@
-<html>
-<head>
-<?php
-/* the point of this file is to intensively test various aspects of
- * the parser. right now, each test focuses in one aspect only
- * (e.g. variable aliasing, arithemtic operator, various control
- * structures), while trying to combine code from other parts of the
- * parser as well.
- */
-?>
-
-*** Testing assignments and variable aliasing: ***<br>
-<?php
- /* This test tests assignments to variables using other variables as variable-names */
- $a = "b";
- $$a = "test";
- $$$a = "blah";
- ${$$$a}["associative arrays work too"] = "this is nifty";
-?>
-This should read "blah": <?php echo "$test<br>\n"; ?>
-This should read "this is nifty": <?php echo $blah[$test="associative arrays work too"]."<br>\n"; ?>
-*************************************************<br>
-
-*** Testing integer operators ***<br>
-<?php
- /* test just about any operator possible on $i and $j (ints) */
- $i = 5;
- $j = 3;
-?>
-Correct result - 8: <?php echo $i+$j; ?><br>
-Correct result - 8: <?php echo $i+$j; ?><br>
-Correct result - 2: <?php echo $i-$j; ?><br>
-Correct result - -2: <?php echo $j-$i; ?><br>
-Correct result - 15: <?php echo $i*$j; ?><br>
-Correct result - 15: <?php echo $j*$i; ?><br>
-Correct result - 2: <?php echo $i%$j; ?><br>
-Correct result - 3: <?php echo $j%$i; ?><br>
-*********************************<br>
-
-*** Testing real operators ***<br>
-<?php
- /* test just about any operator possible on $i and $j (floats) */
- $i = 5.0;
- $j = 3.0;
-?>
-Correct result - 8: <?php echo $i+$j; ?><br>
-Correct result - 8: <?php echo $i+$j; ?><br>
-Correct result - 2: <?php echo $i-$j; ?><br>
-Correct result - -2: <?php echo $j-$i; ?><br>
-Correct result - 15: <?php echo $i*$j; ?><br>
-Correct result - 15: <?php echo $j*$i; ?><br>
-Correct result - 2: <?php echo $i%$j; ?><br>
-Correct result - 3: <?php echo $j%$i; ?><br>
-*********************************<br>
-
-*** Testing if/elseif/else control ***<br>
-
-<?php
-/* sick if/elseif/else test by Andi :) */
-$a = 5;
-if ($a == "4") {
- echo "This "." does "." not "." work<br>\n";
-} elseif ($a == "5") {
- echo "This "." works<br>\n";
- $a = 6;
- if ("andi" == ($test = "andi")) {
- echo "this_still_works<br>\n";
- } elseif (1) {
- echo "should_not_print<br>\n";
- } else {
- echo "should_not_print<br>\n";
- }
- if (44 == 43) {
- echo "should_not_print<br>\n";
- } else {
- echo "should_print<br>\n";
- }
-} elseif ($a == 6) {
- echo "this "."broken<br>\n";
- if (0) {
- echo "this_should_not_print<br>\n";
- } else {
- echo "TestingDanglingElse_This_Should_not_print<br>\n";
- }
-} else {
- echo "This "."does "." not"." work<br>\n";
-}
-?>
-
-
-*** Seriously nested if's test ***<br>
-** spelling correction by kluzz **
-<?php
-/* yet another sick if/elseif/else test by Zeev */
-$i=$j=0;
-echo "Only two lines of text should follow:<br>\n";
-if (0) { /* this code is not supposed to be executed */
- echo "hmm, this shouldn't be displayed #1<br>\n";
- $j++;
- if (1) {
- $i
-+=
- $j;
- if (0) {
- $j = ++$i;
- if (1) {
- $j *= $i;
- echo "damn, this shouldn't be displayed<br>\n";
- } else {
- $j /= $i;
- ++$j;
- echo "this shouldn't be displayed either<br>\n";
- }
- } elseif (1) {
- $i++; $j++;
- echo "this isn't supposed to be displayed<br>\n";
- }
- } elseif (0) {
- $i++;
- echo "this definitely shouldn't be displayed<br>\n";
- } else {
- --$j;
- echo "and this too shouldn't be displayed<br>\n";
- while ($j>0) {
- $j--;
- }
- }
-} elseif (2-2) { /* as long as 2-2==0, this isn't supposed to be executed either */
- $i = ++$j;
- echo "hmm, this shouldn't be displayed #2<br>\n";
- if (1) {
- $j = ++$i;
- if (0) {
- $j = $i*2+$j*($i++);
- if (1) {
- $i++;
- echo "damn, this shouldn't be displayed<br>\n";
- } else {
- $j++;
- echo "this shouldn't be displayed either<br>\n";
- }
- } else if (1) {
- ++$j;
- echo "this isn't supposed to be displayed<br>\n";
- }
- } elseif (0) {
- $j++;
- echo "this definitely shouldn't be displayed<br>\n";
- } else {
- $i++;
- echo "and this too shouldn't be displayed<br>\n";
- }
-} else {
- $j=$i++; /* this should set $i to 1, but shouldn't change $j (it's assigned $i's previous values, zero) */
- echo "this should be displayed. should be: \$i=1, \$j=0. is: \$i=$i, \$j=$j<br>\n";
- if (1) {
- $j += ++$i; /* ++$i --> $i==2, $j += 2 --> $j==2 */
- if (0) {
- $j += 40;
- if (1) {
- $i += 50;
- echo "damn, this shouldn't be displayed<br>\n";
- } else {
- $j += 20;
- echo "this shouldn't be displayed either<br>\n";
- }
- } else if (1) {
- $j *= $i; /* $j *= 2 --> $j == 4 */
- echo "this is supposed to be displayed. should be: \$i=2, \$j=4. is: \$i=$i, \$j=$j<br>\n";
- echo "3 loop iterations should follow:<br>\n";
- while ($i<=$j) {
- echo $i++." $j<br>\n";
- }
- }
- } elseif (0) {
- echo "this definitely shouldn't be displayed<br>\n";
- } else {
- echo "and this too shouldn't be displayed<br>\n";
- }
- echo "**********************************<br>\n";
-}
-?>
-
-*** C-style else-if's ***<br>
-<?php
- /* looks like without we even tried, C-style else-if structure works fine! */
- if ($a=0) {
- echo "This shouldn't be displayed<br>\n";
- } else if ($a++) {
- echo "This shouldn't be displayed either<br>\n";
- } else if (--$a) {
- echo "No, this neither<br>\n";
- } else if (++$a) {
- echo "This should be displayed<br>\n";
- } else {
- echo "This shouldn't be displayed at all<br>\n";
- }
-?>
-*************************<br>
-
-*** WHILE tests ***<br>
-<?php
-$i=0;
-$j=20;
-while ($i<(2*$j)) {
- if ($i>$j) {
- echo "$i is greater than $j<br>\n";
- } else if ($i==$j) {
- echo "$i equals $j<br>\n";
- } else {
- echo "$i is smaller than $j<br>\n";
- }
- $i++;
-}
-?>
-*******************<br>
-
-
-*** Nested WHILEs ***<br>
-<?php
-$arr_len=3;
-
-$i=0;
-while ($i<$arr_len) {
- $j=0;
- while ($j<$arr_len) {
- $k=0;
- while ($k<$arr_len) {
- ${"test$i$j"}[$k] = $i+$j+$k;
- $k++;
- }
- $j++;
- }
- $i++;
-}
-
-echo "Each array variable should be equal to the sum of its indices:<br>\n";
-
-$i=0;
-while ($i<$arr_len) {
- $j=0;
- while ($j<$arr_len) {
- $k=0;
- while ($k<$arr_len) {
- echo "\${test$i$j}[$k] = ".${"test$i$j"}[$k]."<br>\n";
- $k++;
- }
- $j++;
- }
- $i++;
-}
-?>
-*********************<br>
-
-*** hash test... ***<br>
-<?php
-/*
-$i=0;
-
-while ($i<10000) {
- $arr[$i]=$i;
- $i++;
-}
-
-$i=0;
-while ($i<10000) {
- echo $arr[$i++]."<br>\n";
-}
-*/
-echo "commented out...";
-?>
-
-**************************<br>
-
-*** Hash resizing test ***<br>
-<?php
-$i = 10;
-$a = 'b';
-while ($i > 0) {
- $a = $a . 'a';
- echo "$a<br>\n";
- $resize[$a] = $i;
- $i--;
-}
-$i = 10;
-$a = 'b';
-while ($i > 0) {
- $a = $a . 'a';
- echo "$a<br>\n";
- echo $resize[$a]."<br>\n";
- $i--;
-}
-?>
-**************************<br>
-
-
-*** break/continue test ***<br>
-<?php
-$i=0;
-
-echo "\$i should go from 0 to 2<br>\n";
-while ($i<5) {
- if ($i>2) {
- break;
- }
- $j=0;
- echo "\$j should go from 3 to 4, and \$q should go from 3 to 4<br>\n";
- while ($j<5) {
- if ($j<=2) {
- $j++;
- continue;
- }
- echo " \$j=$j<br>\n";
- for ($q=0; $q<=10; $q++) {
- if ($q<3) {
- continue;
- }
- if ($q>4) {
- break;
- }
- echo " \$q=$q<br>\n";
- }
- $j++;
- }
- $j=0;
- echo "\$j should go from 0 to 2<br>\n";
- while ($j<5) {
- if ($j>2) {
- $k=0;
- echo "\$k should go from 0 to 2<br>\n";
- while ($k<5) {
- if ($k>2) {
- break 2;
- }
- echo " \$k=$k<br>\n";
- $k++;
- }
- }
- echo " \$j=$j<br>\n";
- $j++;
- }
- echo "\$i=$i<br>\n";
- $i++;
-}
-?>
-***********************<br>
-
-*** Nested file include test ***<br>
-<?php include("023-2.inc"); ?>
-********************************<br>
-
-<?php
-{
- echo "Tests completed.<br>\n"; # testing some PHP style comment...
-}
-?>
diff --git a/tests/lang/023-2.inc b/tests/lang/023-2.inc
deleted file mode 100755
index 6dd1e730f1..0000000000
--- a/tests/lang/023-2.inc
+++ /dev/null
@@ -1,6 +0,0 @@
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-<?php echo "and this is PHP code, 2+2=".(2+2).""; ?>
-
-</html>
diff --git a/tests/lang/023.phpt b/tests/lang/023.phpt
deleted file mode 100644
index 4d7c4d5b5b..0000000000
--- a/tests/lang/023.phpt
+++ /dev/null
@@ -1,256 +0,0 @@
---TEST--
-Regression test
---POST--
---GET--
---FILE--
-PHP Regression Test
-
-<?php
-
-include("023-1.inc");
-
-$wedding_timestamp = mktime(20,0,0,8,31,1997);
-$time_left=$wedding_timestamp-time();
-
-if ($time_left>0) {
- $days = $time_left/(24*3600);
- $time_left -= $days*24*3600;
- $hours = $time_left/3600;
- $time_left -= $hours*3600;
- $minutes = $time_left/60;
- echo "Limor Ullmann is getting married on ".($wedding_date=date("l, F dS, Y",$wedding_timestamp)).",\nwhich is $days days, $hours hours and $minutes minutes from now.\n";
- echo "Her hashed wedding date is $wedding_date.\n";
-} else {
- echo "Limor Ullmann is now Limor Baruch :I\n";
-}
-?>
---EXPECT--
-PHP Regression Test
-
-<html>
-<head>
-
-*** Testing assignments and variable aliasing: ***<br>
-This should read "blah": blah<br>
-This should read "this is nifty": this is nifty<br>
-*************************************************<br>
-
-*** Testing integer operators ***<br>
-Correct result - 8: 8<br>
-Correct result - 8: 8<br>
-Correct result - 2: 2<br>
-Correct result - -2: -2<br>
-Correct result - 15: 15<br>
-Correct result - 15: 15<br>
-Correct result - 2: 2<br>
-Correct result - 3: 3<br>
-*********************************<br>
-
-*** Testing real operators ***<br>
-Correct result - 8: 8<br>
-Correct result - 8: 8<br>
-Correct result - 2: 2<br>
-Correct result - -2: -2<br>
-Correct result - 15: 15<br>
-Correct result - 15: 15<br>
-Correct result - 2: 2<br>
-Correct result - 3: 3<br>
-*********************************<br>
-
-*** Testing if/elseif/else control ***<br>
-
-This works<br>
-this_still_works<br>
-should_print<br>
-
-
-*** Seriously nested if's test ***<br>
-** spelling correction by kluzz **
-Only two lines of text should follow:<br>
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0<br>
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4<br>
-3 loop iterations should follow:<br>
-2 4<br>
-3 4<br>
-4 4<br>
-**********************************<br>
-
-*** C-style else-if's ***<br>
-This should be displayed<br>
-*************************<br>
-
-*** WHILE tests ***<br>
-0 is smaller than 20<br>
-1 is smaller than 20<br>
-2 is smaller than 20<br>
-3 is smaller than 20<br>
-4 is smaller than 20<br>
-5 is smaller than 20<br>
-6 is smaller than 20<br>
-7 is smaller than 20<br>
-8 is smaller than 20<br>
-9 is smaller than 20<br>
-10 is smaller than 20<br>
-11 is smaller than 20<br>
-12 is smaller than 20<br>
-13 is smaller than 20<br>
-14 is smaller than 20<br>
-15 is smaller than 20<br>
-16 is smaller than 20<br>
-17 is smaller than 20<br>
-18 is smaller than 20<br>
-19 is smaller than 20<br>
-20 equals 20<br>
-21 is greater than 20<br>
-22 is greater than 20<br>
-23 is greater than 20<br>
-24 is greater than 20<br>
-25 is greater than 20<br>
-26 is greater than 20<br>
-27 is greater than 20<br>
-28 is greater than 20<br>
-29 is greater than 20<br>
-30 is greater than 20<br>
-31 is greater than 20<br>
-32 is greater than 20<br>
-33 is greater than 20<br>
-34 is greater than 20<br>
-35 is greater than 20<br>
-36 is greater than 20<br>
-37 is greater than 20<br>
-38 is greater than 20<br>
-39 is greater than 20<br>
-*******************<br>
-
-
-*** Nested WHILEs ***<br>
-Each array variable should be equal to the sum of its indices:<br>
-${test00}[0] = 0<br>
-${test00}[1] = 1<br>
-${test00}[2] = 2<br>
-${test01}[0] = 1<br>
-${test01}[1] = 2<br>
-${test01}[2] = 3<br>
-${test02}[0] = 2<br>
-${test02}[1] = 3<br>
-${test02}[2] = 4<br>
-${test10}[0] = 1<br>
-${test10}[1] = 2<br>
-${test10}[2] = 3<br>
-${test11}[0] = 2<br>
-${test11}[1] = 3<br>
-${test11}[2] = 4<br>
-${test12}[0] = 3<br>
-${test12}[1] = 4<br>
-${test12}[2] = 5<br>
-${test20}[0] = 2<br>
-${test20}[1] = 3<br>
-${test20}[2] = 4<br>
-${test21}[0] = 3<br>
-${test21}[1] = 4<br>
-${test21}[2] = 5<br>
-${test22}[0] = 4<br>
-${test22}[1] = 5<br>
-${test22}[2] = 6<br>
-*********************<br>
-
-*** hash test... ***<br>
-commented out...
-**************************<br>
-
-*** Hash resizing test ***<br>
-ba<br>
-baa<br>
-baaa<br>
-baaaa<br>
-baaaaa<br>
-baaaaaa<br>
-baaaaaaa<br>
-baaaaaaaa<br>
-baaaaaaaaa<br>
-baaaaaaaaaa<br>
-ba<br>
-10<br>
-baa<br>
-9<br>
-baaa<br>
-8<br>
-baaaa<br>
-7<br>
-baaaaa<br>
-6<br>
-baaaaaa<br>
-5<br>
-baaaaaaa<br>
-4<br>
-baaaaaaaa<br>
-3<br>
-baaaaaaaaa<br>
-2<br>
-baaaaaaaaaa<br>
-1<br>
-**************************<br>
-
-
-*** break/continue test ***<br>
-$i should go from 0 to 2<br>
-$j should go from 3 to 4, and $q should go from 3 to 4<br>
- $j=3<br>
- $q=3<br>
- $q=4<br>
- $j=4<br>
- $q=3<br>
- $q=4<br>
-$j should go from 0 to 2<br>
- $j=0<br>
- $j=1<br>
- $j=2<br>
-$k should go from 0 to 2<br>
- $k=0<br>
- $k=1<br>
- $k=2<br>
-$i=0<br>
-$j should go from 3 to 4, and $q should go from 3 to 4<br>
- $j=3<br>
- $q=3<br>
- $q=4<br>
- $j=4<br>
- $q=3<br>
- $q=4<br>
-$j should go from 0 to 2<br>
- $j=0<br>
- $j=1<br>
- $j=2<br>
-$k should go from 0 to 2<br>
- $k=0<br>
- $k=1<br>
- $k=2<br>
-$i=1<br>
-$j should go from 3 to 4, and $q should go from 3 to 4<br>
- $j=3<br>
- $q=3<br>
- $q=4<br>
- $j=4<br>
- $q=3<br>
- $q=4<br>
-$j should go from 0 to 2<br>
- $j=0<br>
- $j=1<br>
- $j=2<br>
-$k should go from 0 to 2<br>
- $k=0<br>
- $k=1<br>
- $k=2<br>
-$i=2<br>
-***********************<br>
-
-*** Nested file include test ***<br>
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************<br>
-
-Tests completed.<br>
-Limor Ullmann is now Limor Baruch :I
diff --git a/tests/lang/024.phpt b/tests/lang/024.phpt
deleted file mode 100644
index 848c5fbea8..0000000000
--- a/tests/lang/024.phpt
+++ /dev/null
@@ -1,11625 +0,0 @@
---TEST--
-Looped regression test (may take a while)
---POST--
---GET--
---FILE--
-<?php
-for ($jdk=0; $jdk<50; $jdk++) {
-?><html>
-<head>
-<?php /* the point of this file is to intensively test various aspects of the parser.
- * right now, each test focuses in one aspect only (e.g. variable aliasing, arithemtic operator,
- * various control structures), while trying to combine code from other parts of the parser as well.
- */
-?>
-*** Testing assignments and variable aliasing: ***
-<?php
- /* This test tests assignments to variables using other variables as variable-names */
- $a = "b";
- $$a = "test";
- $$$a = "blah";
- ${$$$a}["associative arrays work too"] = "this is nifty";
-?>
-This should read "blah": <?php echo "$test\n"; ?>
-This should read "this is nifty": <?php echo $blah[$test="associative arrays work too"]."\n"; ?>
-*************************************************
-
-*** Testing integer operators ***
-<?php
- /* test just about any operator possible on $i and $j (ints) */
- $i = 5;
- $j = 3;
-?>
-Correct result - 8: <?php echo $i+$j; ?>
-
-Correct result - 8: <?php echo $i+$j; ?>
-
-Correct result - 2: <?php echo $i-$j; ?>
-
-Correct result - -2: <?php echo $j-$i; ?>
-
-Correct result - 15: <?php echo $i*$j; ?>
-
-Correct result - 15: <?php echo $j*$i; ?>
-
-Correct result - 2: <?php echo $i%$j; ?>
-
-Correct result - 3: <?php echo $j%$i; ?>
-
-*********************************
-
-*** Testing real operators ***
-<?php
- /* test just about any operator possible on $i and $j (floats) */
- $i = 5.0;
- $j = 3.0;
-?>
-Correct result - 8: <?php echo $i+$j; ?>
-
-Correct result - 8: <?php echo $i+$j; ?>
-
-Correct result - 2: <?php echo $i-$j; ?>
-
-Correct result - -2: <?php echo $j-$i; ?>
-
-Correct result - 15: <?php echo $i*$j; ?>
-
-Correct result - 15: <?php echo $j*$i; ?>
-
-Correct result - 2: <?php echo $i%$j; ?>
-
-Correct result - 3: <?php echo $j%$i; ?>
-
-*********************************
-
-*** Testing if/elseif/else control ***
-
-<?php
-/* sick if/elseif/else test by Andi :) */
-$a = 5;
-if ($a == "4") {
- echo "This "." does "." not "." work\n";
-} elseif ($a == "5") {
- echo "This "." works\n";
- $a = 6;
- if ("andi" == ($test = "andi")) {
- echo "this_still_works\n";
- } elseif (1) {
- echo "should_not_print\n";
- } else {
- echo "should_not_print\n";
- }
- if (44 == 43) {
- echo "should_not_print\n";
- } else {
- echo "should_print\n";
- }
-} elseif ($a == 6) {
- echo "this "."broken\n";
- if (0) {
- echo "this_should_not_print\n";
- } else {
- echo "TestingDanglingElse_This_Should_not_print\n";
- }
-} else {
- echo "This "."does "." not"." work\n";
-}
-?>
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-<?php
-/* yet another sick if/elseif/else test by Zeev */
-$i=$j=0;
-echo "Only two lines of text should follow:\n";
-if (0) { /* this code is not supposed to be executed */
- echo "hmm, this shouldn't be displayed #1\n";
- $j++;
- if (1) {
- $i += $j;
- if (0) {
- $j = ++$i;
- if (1) {
- $j *= $i;
- echo "damn, this shouldn't be displayed\n";
- } else {
- $j /= $i;
- ++$j;
- echo "this shouldn't be displayed either\n";
- }
- } elseif (1) {
- $i++; $j++;
- echo "this isn't supposed to be displayed\n";
- }
- } elseif (0) {
- $i++;
- echo "this definitely shouldn't be displayed\n";
- } else {
- --$j;
- echo "and this too shouldn't be displayed\n";
- while ($j>0) {
- $j--;
- }
- }
-} elseif (2-2) { /* as long as 2-2==0, this isn't supposed to be executed either */
- $i = ++$j;
- echo "hmm, this shouldn't be displayed #2\n";
- if (1) {
- $j = ++$i;
- if (0) {
- $j = $i*2+$j*($i++);
- if (1) {
- $i++;
- echo "damn, this shouldn't be displayed\n";
- } else {
- $j++;
- echo "this shouldn't be displayed either\n";
- }
- } else if (1) {
- ++$j;
- echo "this isn't supposed to be displayed\n";
- }
- } elseif (0) {
- $j++;
- echo "this definitely shouldn't be displayed\n";
- } else {
- $i++;
- echo "and this too shouldn't be displayed\n";
- }
-} else {
- $j=$i++; /* this should set $i to 1, but shouldn't change $j (it's assigned $i's previous values, zero) */
- echo "this should be displayed. should be: \$i=1, \$j=0. is: \$i=$i, \$j=$j\n";
- if (1) {
- $j += ++$i; /* ++$i --> $i==2, $j += 2 --> $j==2 */
- if (0) {
- $j += 40;
- if (1) {
- $i += 50;
- echo "damn, this shouldn't be displayed\n";
- } else {
- $j += 20;
- echo "this shouldn't be displayed either\n";
- }
- } else if (1) {
- $j *= $i; /* $j *= 2 --> $j == 4 */
- echo "this is supposed to be displayed. should be: \$i=2, \$j=4. is: \$i=$i, \$j=$j\n";
- echo "3 loop iterations should follow:\n";
- while ($i<=$j) {
- echo $i++." $j\n";
- }
- }
- } elseif (0) {
- echo "this definitely shouldn't be displayed\n";
- } else {
- echo "and this too shouldn't be displayed\n";
- }
- echo "**********************************\n";
-}
-?>
-
-*** C-style else-if's ***
-<?php
- /* looks like without we even tried, C-style else-if structure works fine! */
- if ($a=0) {
- echo "This shouldn't be displayed\n";
- } else if ($a++) {
- echo "This shouldn't be displayed either\n";
- } else if (--$a) {
- echo "No, this neither\n";
- } else if (++$a) {
- echo "This should be displayed\n";
- } else {
- echo "This shouldn't be displayed at all\n";
- }
-?>
-*************************
-
-*** WHILE tests ***
-<?php
-$i=0;
-$j=20;
-while ($i<(2*$j)) {
- if ($i>$j) {
- echo "$i is greater than $j\n";
- } else if ($i==$j) {
- echo "$i equals $j\n";
- } else {
- echo "$i is smaller than $j\n";
- }
- $i++;
-}
-?>
-*******************
-
-
-*** Nested WHILEs ***
-<?php
-$arr_len=3;
-
-$i=0;
-while ($i<$arr_len) {
- $j=0;
- while ($j<$arr_len) {
- $k=0;
- while ($k<$arr_len) {
- ${"test$i$j"}[$k] = $i+$j+$k;
- $k++;
- }
- $j++;
- }
- $i++;
-}
-
-echo "Each array variable should be equal to the sum of its indices:\n";
-
-$i=0;
-while ($i<$arr_len) {
- $j=0;
- while ($j<$arr_len) {
- $k=0;
- while ($k<$arr_len) {
- echo "\${test$i$j}[$k] = ".${"test$i$j"}[$k]."\n";
- $k++;
- }
- $j++;
- }
- $i++;
-}
-?>
-*********************
-
-*** hash test... ***
-<?php
-/*
-$i=0;
-
-while ($i<10000) {
- $arr[$i]=$i;
- $i++;
-}
-
-$i=0;
-while ($i<10000) {
- echo $arr[$i++]."\n";
-}
-*/
-echo "commented out...";
-?>
-
-**************************
-
-*** Hash resizing test ***
-<?php
-$i = 10;
-$a = "b";
-while ($i > 0) {
- $a = $a . "a";
- echo "$a\n";
- $resize[$a] = $i;
- $i--;
-}
-$i = 10;
-$a = "b";
-while ($i > 0) {
- $a = $a . "a";
- echo "$a\n";
- echo $resize[$a]."\n";
- $i--;
-}
-?>
-**************************
-
-
-*** break/continue test ***
-<?php
-$i=0;
-
-echo "\$i should go from 0 to 2\n";
-while ($i<5) {
- if ($i>2) {
- break;
- }
- $j=0;
- echo "\$j should go from 3 to 4, and \$q should go from 3 to 4\n";
- while ($j<5) {
- if ($j<=2) {
- $j++;
- continue;
- }
- echo " \$j=$j\n";
- for ($q=0; $q<=10; $q++) {
- if ($q<3) {
- continue;
- }
- if ($q>4) {
- break;
- }
- echo " \$q=$q\n";
- }
- $j++;
- }
- $j=0;
- echo "\$j should go from 0 to 2\n";
- while ($j<5) {
- if ($j>2) {
- $k=0;
- echo "\$k should go from 0 to 2\n";
- while ($k<5) {
- if ($k>2) {
- break 2;
- }
- echo " \$k=$k\n";
- $k++;
- }
- }
- echo " \$j=$j\n";
- $j++;
- }
- echo "\$i=$i\n";
- $i++;
-}
-?>
-***********************
-
-*** Nested file include test ***
-<?php include("023-2.inc"); ?>
-********************************
-
-<?php
-{
- echo "Tests completed.\n"; # testing some PHP style comment...
-}
-
-} ?>
---EXPECT--
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
diff --git a/tests/lang/025.phpt b/tests/lang/025.phpt
deleted file mode 100644
index 4f5397d5a8..0000000000
--- a/tests/lang/025.phpt
+++ /dev/null
@@ -1,533 +0,0 @@
---TEST--
-Mean recursion test
---POST--
---GET--
---FILE--
-<?php
-function RekTest ($nr) {
- echo " $nr ";
- $j=$nr+1;
- while ($j < 10) {
- echo " a ";
- RekTest($j);
- $j++;
- echo " b $j ";
- }
- echo "\n";
-}
-
-RekTest(0);
-?>
---EXPECT--
- 0 a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 4 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 3 a 3 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 4 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 2 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 4 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 3 a 3 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 4 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
diff --git a/tests/lang/026.phpt b/tests/lang/026.phpt
deleted file mode 100644
index e201b75638..0000000000
--- a/tests/lang/026.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Testing string scanner confirmance
---POST--
---GET--
---FILE--
-<?php echo "\"\t\\'" . '\n\\\'a\\\b\\' ?>
---EXPECT--
-" \'\n\'a\\b\
diff --git a/tests/lang/027.phpt b/tests/lang/027.phpt
deleted file mode 100644
index 5cd44e0fab..0000000000
--- a/tests/lang/027.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-Testing do-while loop
---POST--
---GET--
---FILE--
-<?php
-$i=3;
-do {
- echo $i;
- $i--;
-} while($i>0);
-?>
---EXPECT--
-321
diff --git a/tests/lang/028.phpt b/tests/lang/028.phpt
deleted file mode 100644
index 4d95960dd3..0000000000
--- a/tests/lang/028.phpt
+++ /dev/null
@@ -1,1060 +0,0 @@
---TEST--
-Testing calling user-level functions from C
---POST--
---GET--
---FILE--
-<?php
-
-error_reporting(1023);
-
-function print_stuff($stuff)
-{
- print $stuff;
-}
-
-
-function still_working()
-{
- return "I'm still alive";
-}
-
-function dafna()
-{
- static $foo = 0;
-
- print "Dafna!\n";
- print call_user_func("still_working")."\n";
- $foo++;
- return (string) $foo;
-}
-
-
-class dafna_class {
- function dafna_class() {
- $this->myname = "Dafna";
- }
- function GetMyName() {
- return $this->myname;
- }
- function SetMyName($name) {
- $this->myname = $name;
- }
-};
-
-for ($i=0; $i<200; $i++):
- print "$i\n";
- call_user_func("dafna");
- call_user_func("print_stuff","Hey there!!\n");
- print "$i\n";
-endfor;
-
-
-$dafna = new dafna_class();
-
-print $name=call_user_func(array(&$dafna,"GetMyName"));
-print "\n";
-
-?>
---EXPECT--
-0
-Dafna!
-I'm still alive
-Hey there!!
-0
-1
-Dafna!
-I'm still alive
-Hey there!!
-1
-2
-Dafna!
-I'm still alive
-Hey there!!
-2
-3
-Dafna!
-I'm still alive
-Hey there!!
-3
-4
-Dafna!
-I'm still alive
-Hey there!!
-4
-5
-Dafna!
-I'm still alive
-Hey there!!
-5
-6
-Dafna!
-I'm still alive
-Hey there!!
-6
-7
-Dafna!
-I'm still alive
-Hey there!!
-7
-8
-Dafna!
-I'm still alive
-Hey there!!
-8
-9
-Dafna!
-I'm still alive
-Hey there!!
-9
-10
-Dafna!
-I'm still alive
-Hey there!!
-10
-11
-Dafna!
-I'm still alive
-Hey there!!
-11
-12
-Dafna!
-I'm still alive
-Hey there!!
-12
-13
-Dafna!
-I'm still alive
-Hey there!!
-13
-14
-Dafna!
-I'm still alive
-Hey there!!
-14
-15
-Dafna!
-I'm still alive
-Hey there!!
-15
-16
-Dafna!
-I'm still alive
-Hey there!!
-16
-17
-Dafna!
-I'm still alive
-Hey there!!
-17
-18
-Dafna!
-I'm still alive
-Hey there!!
-18
-19
-Dafna!
-I'm still alive
-Hey there!!
-19
-20
-Dafna!
-I'm still alive
-Hey there!!
-20
-21
-Dafna!
-I'm still alive
-Hey there!!
-21
-22
-Dafna!
-I'm still alive
-Hey there!!
-22
-23
-Dafna!
-I'm still alive
-Hey there!!
-23
-24
-Dafna!
-I'm still alive
-Hey there!!
-24
-25
-Dafna!
-I'm still alive
-Hey there!!
-25
-26
-Dafna!
-I'm still alive
-Hey there!!
-26
-27
-Dafna!
-I'm still alive
-Hey there!!
-27
-28
-Dafna!
-I'm still alive
-Hey there!!
-28
-29
-Dafna!
-I'm still alive
-Hey there!!
-29
-30
-Dafna!
-I'm still alive
-Hey there!!
-30
-31
-Dafna!
-I'm still alive
-Hey there!!
-31
-32
-Dafna!
-I'm still alive
-Hey there!!
-32
-33
-Dafna!
-I'm still alive
-Hey there!!
-33
-34
-Dafna!
-I'm still alive
-Hey there!!
-34
-35
-Dafna!
-I'm still alive
-Hey there!!
-35
-36
-Dafna!
-I'm still alive
-Hey there!!
-36
-37
-Dafna!
-I'm still alive
-Hey there!!
-37
-38
-Dafna!
-I'm still alive
-Hey there!!
-38
-39
-Dafna!
-I'm still alive
-Hey there!!
-39
-40
-Dafna!
-I'm still alive
-Hey there!!
-40
-41
-Dafna!
-I'm still alive
-Hey there!!
-41
-42
-Dafna!
-I'm still alive
-Hey there!!
-42
-43
-Dafna!
-I'm still alive
-Hey there!!
-43
-44
-Dafna!
-I'm still alive
-Hey there!!
-44
-45
-Dafna!
-I'm still alive
-Hey there!!
-45
-46
-Dafna!
-I'm still alive
-Hey there!!
-46
-47
-Dafna!
-I'm still alive
-Hey there!!
-47
-48
-Dafna!
-I'm still alive
-Hey there!!
-48
-49
-Dafna!
-I'm still alive
-Hey there!!
-49
-50
-Dafna!
-I'm still alive
-Hey there!!
-50
-51
-Dafna!
-I'm still alive
-Hey there!!
-51
-52
-Dafna!
-I'm still alive
-Hey there!!
-52
-53
-Dafna!
-I'm still alive
-Hey there!!
-53
-54
-Dafna!
-I'm still alive
-Hey there!!
-54
-55
-Dafna!
-I'm still alive
-Hey there!!
-55
-56
-Dafna!
-I'm still alive
-Hey there!!
-56
-57
-Dafna!
-I'm still alive
-Hey there!!
-57
-58
-Dafna!
-I'm still alive
-Hey there!!
-58
-59
-Dafna!
-I'm still alive
-Hey there!!
-59
-60
-Dafna!
-I'm still alive
-Hey there!!
-60
-61
-Dafna!
-I'm still alive
-Hey there!!
-61
-62
-Dafna!
-I'm still alive
-Hey there!!
-62
-63
-Dafna!
-I'm still alive
-Hey there!!
-63
-64
-Dafna!
-I'm still alive
-Hey there!!
-64
-65
-Dafna!
-I'm still alive
-Hey there!!
-65
-66
-Dafna!
-I'm still alive
-Hey there!!
-66
-67
-Dafna!
-I'm still alive
-Hey there!!
-67
-68
-Dafna!
-I'm still alive
-Hey there!!
-68
-69
-Dafna!
-I'm still alive
-Hey there!!
-69
-70
-Dafna!
-I'm still alive
-Hey there!!
-70
-71
-Dafna!
-I'm still alive
-Hey there!!
-71
-72
-Dafna!
-I'm still alive
-Hey there!!
-72
-73
-Dafna!
-I'm still alive
-Hey there!!
-73
-74
-Dafna!
-I'm still alive
-Hey there!!
-74
-75
-Dafna!
-I'm still alive
-Hey there!!
-75
-76
-Dafna!
-I'm still alive
-Hey there!!
-76
-77
-Dafna!
-I'm still alive
-Hey there!!
-77
-78
-Dafna!
-I'm still alive
-Hey there!!
-78
-79
-Dafna!
-I'm still alive
-Hey there!!
-79
-80
-Dafna!
-I'm still alive
-Hey there!!
-80
-81
-Dafna!
-I'm still alive
-Hey there!!
-81
-82
-Dafna!
-I'm still alive
-Hey there!!
-82
-83
-Dafna!
-I'm still alive
-Hey there!!
-83
-84
-Dafna!
-I'm still alive
-Hey there!!
-84
-85
-Dafna!
-I'm still alive
-Hey there!!
-85
-86
-Dafna!
-I'm still alive
-Hey there!!
-86
-87
-Dafna!
-I'm still alive
-Hey there!!
-87
-88
-Dafna!
-I'm still alive
-Hey there!!
-88
-89
-Dafna!
-I'm still alive
-Hey there!!
-89
-90
-Dafna!
-I'm still alive
-Hey there!!
-90
-91
-Dafna!
-I'm still alive
-Hey there!!
-91
-92
-Dafna!
-I'm still alive
-Hey there!!
-92
-93
-Dafna!
-I'm still alive
-Hey there!!
-93
-94
-Dafna!
-I'm still alive
-Hey there!!
-94
-95
-Dafna!
-I'm still alive
-Hey there!!
-95
-96
-Dafna!
-I'm still alive
-Hey there!!
-96
-97
-Dafna!
-I'm still alive
-Hey there!!
-97
-98
-Dafna!
-I'm still alive
-Hey there!!
-98
-99
-Dafna!
-I'm still alive
-Hey there!!
-99
-100
-Dafna!
-I'm still alive
-Hey there!!
-100
-101
-Dafna!
-I'm still alive
-Hey there!!
-101
-102
-Dafna!
-I'm still alive
-Hey there!!
-102
-103
-Dafna!
-I'm still alive
-Hey there!!
-103
-104
-Dafna!
-I'm still alive
-Hey there!!
-104
-105
-Dafna!
-I'm still alive
-Hey there!!
-105
-106
-Dafna!
-I'm still alive
-Hey there!!
-106
-107
-Dafna!
-I'm still alive
-Hey there!!
-107
-108
-Dafna!
-I'm still alive
-Hey there!!
-108
-109
-Dafna!
-I'm still alive
-Hey there!!
-109
-110
-Dafna!
-I'm still alive
-Hey there!!
-110
-111
-Dafna!
-I'm still alive
-Hey there!!
-111
-112
-Dafna!
-I'm still alive
-Hey there!!
-112
-113
-Dafna!
-I'm still alive
-Hey there!!
-113
-114
-Dafna!
-I'm still alive
-Hey there!!
-114
-115
-Dafna!
-I'm still alive
-Hey there!!
-115
-116
-Dafna!
-I'm still alive
-Hey there!!
-116
-117
-Dafna!
-I'm still alive
-Hey there!!
-117
-118
-Dafna!
-I'm still alive
-Hey there!!
-118
-119
-Dafna!
-I'm still alive
-Hey there!!
-119
-120
-Dafna!
-I'm still alive
-Hey there!!
-120
-121
-Dafna!
-I'm still alive
-Hey there!!
-121
-122
-Dafna!
-I'm still alive
-Hey there!!
-122
-123
-Dafna!
-I'm still alive
-Hey there!!
-123
-124
-Dafna!
-I'm still alive
-Hey there!!
-124
-125
-Dafna!
-I'm still alive
-Hey there!!
-125
-126
-Dafna!
-I'm still alive
-Hey there!!
-126
-127
-Dafna!
-I'm still alive
-Hey there!!
-127
-128
-Dafna!
-I'm still alive
-Hey there!!
-128
-129
-Dafna!
-I'm still alive
-Hey there!!
-129
-130
-Dafna!
-I'm still alive
-Hey there!!
-130
-131
-Dafna!
-I'm still alive
-Hey there!!
-131
-132
-Dafna!
-I'm still alive
-Hey there!!
-132
-133
-Dafna!
-I'm still alive
-Hey there!!
-133
-134
-Dafna!
-I'm still alive
-Hey there!!
-134
-135
-Dafna!
-I'm still alive
-Hey there!!
-135
-136
-Dafna!
-I'm still alive
-Hey there!!
-136
-137
-Dafna!
-I'm still alive
-Hey there!!
-137
-138
-Dafna!
-I'm still alive
-Hey there!!
-138
-139
-Dafna!
-I'm still alive
-Hey there!!
-139
-140
-Dafna!
-I'm still alive
-Hey there!!
-140
-141
-Dafna!
-I'm still alive
-Hey there!!
-141
-142
-Dafna!
-I'm still alive
-Hey there!!
-142
-143
-Dafna!
-I'm still alive
-Hey there!!
-143
-144
-Dafna!
-I'm still alive
-Hey there!!
-144
-145
-Dafna!
-I'm still alive
-Hey there!!
-145
-146
-Dafna!
-I'm still alive
-Hey there!!
-146
-147
-Dafna!
-I'm still alive
-Hey there!!
-147
-148
-Dafna!
-I'm still alive
-Hey there!!
-148
-149
-Dafna!
-I'm still alive
-Hey there!!
-149
-150
-Dafna!
-I'm still alive
-Hey there!!
-150
-151
-Dafna!
-I'm still alive
-Hey there!!
-151
-152
-Dafna!
-I'm still alive
-Hey there!!
-152
-153
-Dafna!
-I'm still alive
-Hey there!!
-153
-154
-Dafna!
-I'm still alive
-Hey there!!
-154
-155
-Dafna!
-I'm still alive
-Hey there!!
-155
-156
-Dafna!
-I'm still alive
-Hey there!!
-156
-157
-Dafna!
-I'm still alive
-Hey there!!
-157
-158
-Dafna!
-I'm still alive
-Hey there!!
-158
-159
-Dafna!
-I'm still alive
-Hey there!!
-159
-160
-Dafna!
-I'm still alive
-Hey there!!
-160
-161
-Dafna!
-I'm still alive
-Hey there!!
-161
-162
-Dafna!
-I'm still alive
-Hey there!!
-162
-163
-Dafna!
-I'm still alive
-Hey there!!
-163
-164
-Dafna!
-I'm still alive
-Hey there!!
-164
-165
-Dafna!
-I'm still alive
-Hey there!!
-165
-166
-Dafna!
-I'm still alive
-Hey there!!
-166
-167
-Dafna!
-I'm still alive
-Hey there!!
-167
-168
-Dafna!
-I'm still alive
-Hey there!!
-168
-169
-Dafna!
-I'm still alive
-Hey there!!
-169
-170
-Dafna!
-I'm still alive
-Hey there!!
-170
-171
-Dafna!
-I'm still alive
-Hey there!!
-171
-172
-Dafna!
-I'm still alive
-Hey there!!
-172
-173
-Dafna!
-I'm still alive
-Hey there!!
-173
-174
-Dafna!
-I'm still alive
-Hey there!!
-174
-175
-Dafna!
-I'm still alive
-Hey there!!
-175
-176
-Dafna!
-I'm still alive
-Hey there!!
-176
-177
-Dafna!
-I'm still alive
-Hey there!!
-177
-178
-Dafna!
-I'm still alive
-Hey there!!
-178
-179
-Dafna!
-I'm still alive
-Hey there!!
-179
-180
-Dafna!
-I'm still alive
-Hey there!!
-180
-181
-Dafna!
-I'm still alive
-Hey there!!
-181
-182
-Dafna!
-I'm still alive
-Hey there!!
-182
-183
-Dafna!
-I'm still alive
-Hey there!!
-183
-184
-Dafna!
-I'm still alive
-Hey there!!
-184
-185
-Dafna!
-I'm still alive
-Hey there!!
-185
-186
-Dafna!
-I'm still alive
-Hey there!!
-186
-187
-Dafna!
-I'm still alive
-Hey there!!
-187
-188
-Dafna!
-I'm still alive
-Hey there!!
-188
-189
-Dafna!
-I'm still alive
-Hey there!!
-189
-190
-Dafna!
-I'm still alive
-Hey there!!
-190
-191
-Dafna!
-I'm still alive
-Hey there!!
-191
-192
-Dafna!
-I'm still alive
-Hey there!!
-192
-193
-Dafna!
-I'm still alive
-Hey there!!
-193
-194
-Dafna!
-I'm still alive
-Hey there!!
-194
-195
-Dafna!
-I'm still alive
-Hey there!!
-195
-196
-Dafna!
-I'm still alive
-Hey there!!
-196
-197
-Dafna!
-I'm still alive
-Hey there!!
-197
-198
-Dafna!
-I'm still alive
-Hey there!!
-198
-199
-Dafna!
-I'm still alive
-Hey there!!
-199
-Dafna
-
diff --git a/tests/lang/030.phpt b/tests/lang/030.phpt
deleted file mode 100644
index ba809c8e31..0000000000
--- a/tests/lang/030.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-$this in constructor test
---POST--
---GET--
---FILE--
-<?php
-class foo {
- function foo($name) {
- $GLOBALS['List']= &$this;
- $this->Name = $name;
- $GLOBALS['List']->echoName();
- }
-
- function echoName() {
- $GLOBALS['names'][]=$this->Name;
- }
-}
-
-function &foo2(&$foo) {
- return $foo;
-}
-
-
-$bar1 =& new foo('constructor');
-$bar1->Name = 'outside';
-$bar1->echoName();
-$List->echoName();
-
-$bar1 =& foo2(new foo('constructor'));
-$bar1->Name = 'outside';
-$bar1->echoName();
-
-$List->echoName();
-
-print ($names==array('constructor','outside','outside','constructor','outside','outside')) ? 'success':'failure';
-?>
---EXPECT--
-success
diff --git a/tests/lang/031.phpt b/tests/lang/031.phpt
deleted file mode 100644
index af99f3d219..0000000000
--- a/tests/lang/031.phpt
+++ /dev/null
@@ -1,72 +0,0 @@
---TEST--
-Internal hash position bug on assignment (Bug #16227)
---POST--
---GET--
---FILE--
-<?php
-// reported by php.net@alienbill.com
-$arrayOuter = array("key1","key2");
-$arrayInner = array("0","1");
-
-print "Correct - with inner loop reset.\n";
-
-while(list(,$o) = each($arrayOuter)){
- reset($arrayInner);
- while(list(,$i) = each($arrayInner)){
- print "inloop $i for $o\n";
- }
-}
-reset($arrayOuter);
-reset($arrayInner);
-
-print "What happens without inner loop reset.\n";
-
-while(list(,$o) = each($arrayOuter)){
- while(list(,$i) = each($arrayInner)){
- print "inloop $i for $o\n";
- }
-}
-reset($arrayOuter);
-reset($arrayInner);
-
-print "What happens without inner loop reset but copy.\n";
-
-while(list(,$o) = each($arrayOuter)){
- $placeholder = $arrayInner;
- while(list(,$i) = each($arrayInner)){
- print "inloop $i for $o\n";
- }
-}
-reset($arrayOuter);
-reset($arrayInner);
-
-print "What happens with inner loop reset over copy.\n";
-
-while(list(,$o) = each($arrayOuter)){
- $placeholder = $arrayInner;
- while(list(,$i) = each($placeholder)){
- print "inloop $i for $o\n";
- }
-}
-reset($arrayOuter);
-reset($arrayInner);
-?>
---EXPECT--
-Correct - with inner loop reset.
-inloop 0 for key1
-inloop 1 for key1
-inloop 0 for key2
-inloop 1 for key2
-What happens without inner loop reset.
-inloop 0 for key1
-inloop 1 for key1
-What happens without inner loop reset but copy.
-inloop 0 for key1
-inloop 1 for key1
-inloop 0 for key2
-inloop 1 for key2
-What happens with inner loop reset over copy.
-inloop 0 for key1
-inloop 1 for key1
-inloop 0 for key2
-inloop 1 for key2
diff --git a/tests/lang/032.phpt b/tests/lang/032.phpt
deleted file mode 100644
index 6000398ed6..0000000000
--- a/tests/lang/032.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-Class method registration
---POST--
---GET--
---FILE--
-<?php
-class A {
- function foo() {}
-}
-
-class B extends A {
- function foo() {}
-}
-
-class C extends B {
- function foo() {}
-}
-
-class D extends A {
-}
-
-class F extends D {
- function foo() {}
-}
-
-// Following class definition should fail, but cannot test
-/*
-class X {
- function foo() {}
- function foo() {}
-}
-*/
-
-echo "OK\n";
-?>
---EXPECT--
-OK
-
diff --git a/tests/lang/033.phpt b/tests/lang/033.phpt
deleted file mode 100644
index 724c67b225..0000000000
--- a/tests/lang/033.phpt
+++ /dev/null
@@ -1,53 +0,0 @@
---TEST--
-Alternative syntaxes test
---SKIPIF--
-<?php if(version_compare(zend_version(), "2.0.0-dev", '>=')) echo "skip removed in Zend Engine 2\n"; ?>
---FILE--
-<?php
-$a = 1;
-
-echo "If: ";
-if ($a) echo 1; else echo 0;
-if ($a):
- echo 1;
-else:
- echo 0;
-endif;
-
-echo "\nWhile: ";
-while ($a<5) echo $a++;
-while ($a<9):
- echo ++$a;
-endwhile;
-
-echo "\nFor: ";
-for($a=0;$a<5;$a++) echo $a;
-for($a=0;$a<5;$a++):
- echo $a;
-endfor;
-
-echo "\nSwitch: ";
-switch ($a):
- case 0;
- echo 0;
- break;
- case 5:
- echo 1;
- break;
- default;
- echo 0;
- break;
-endswitch;
-
-echo "\nold_function: ";
-old_function foo $bar, $baz (
- return sprintf("foo(%s, %s);\n", $bar, $baz);
-);
-echo foo(1,2);
-?>
---EXPECT--
-If: 11
-While: 12346789
-For: 0123401234
-Switch: 1
-old_function: foo(1, 2);
diff --git a/tests/lang/034.phpt b/tests/lang/034.phpt
deleted file mode 100644
index 9b10603c83..0000000000
--- a/tests/lang/034.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Locale settings affecting float parsing
---SKIPIF--
-<?php # try to activate a german locale
-if (setlocale(LC_NUMERIC, "de_DE", "de", "german", "ge") === FALSE) {
- print "skip";
-}
-?>
---POST--
---GET--
---FILE--
-<?php
-# activate the german locale
-setlocale(LC_NUMERIC, "de_DE", "de", "german", "ge");
-
-echo (float)"3.14", "\n";
-
-?>
---EXPECT--
-3,14
diff --git a/tests/lang/035.phpt b/tests/lang/035.phpt
deleted file mode 100644
index c6970b7bdf..0000000000
--- a/tests/lang/035.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-ZE2: set_exception_handler()
---SKIPIF--
-<?php if (version_compare(zend_version(), "2.0.0-dev", "<")) print "skip Zend engine 2 required"; ?>
---FILE--
-<?php
-class MyException {
- function MyException($_error) {
- $this->error = $_error;
- }
-
- function getException()
- {
- return $this->error;
- }
-}
-
-function ThrowException()
-{
- throw new MyException("'This is an exception!'");
-}
-
-
-try {
-} catch (MyException $exception) {
- print "There shouldn't be an exception: " . $exception->getException();
- print "\n";
-}
-
-try {
- ThrowException();
-} catch (MyException $exception) {
- print "There was an exception: " . $exception->getException();
- print "\n";
-}
-?>
---EXPECT--
-There was an exception: 'This is an exception!'
diff --git a/tests/lang/bison1.phpt b/tests/lang/bison1.phpt
deleted file mode 100644
index 3571576fb8..0000000000
--- a/tests/lang/bison1.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-Bison weirdness
---FILE--
-<?php
-error_reporting(E_ALL & ~E_NOTICE);
-echo "blah-$foo\n";
-?>
---EXPECT--
-blah-
diff --git a/tests/lang/bug19566.phpt b/tests/lang/bug19566.phpt
deleted file mode 100644
index 45c3bc588e..0000000000
--- a/tests/lang/bug19566.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Bug #19566 (get_declared_classes() segfaults)
---FILE--
-<?php
-class foo {}
-$result = get_declared_classes();
-var_dump(array_search('foo', $result));
-?>
---EXPECTF--
-int(%d)
diff --git a/tests/lang/bug19943.phpt b/tests/lang/bug19943.phpt
deleted file mode 100644
index 3be703fb1d..0000000000
--- a/tests/lang/bug19943.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-Bug #19943 (memleaks)
---FILE--
-<?php
- $ar = array();
- for ($count = 0; $count < 10; $count++) {
- $ar[$count] = "$count";
- $ar[$count]['idx'] = "$count";
- }
-
- for ($count = 0; $count < 10; $count++) {
- echo $ar[$count]." -- ".$ar[$count]['idx']."\n";
- }
- $a = "0123456789";
- $a[9] = $a{0};
- var_dump($a);
-?>
---EXPECT--
-0 -- 0
-1 -- 1
-2 -- 2
-3 -- 3
-4 -- 4
-5 -- 5
-6 -- 6
-7 -- 7
-8 -- 8
-9 -- 9
-string(10) "0123456780"
diff --git a/tests/lang/bug20175.phpt b/tests/lang/bug20175.phpt
deleted file mode 100644
index 55ff7d82b8..0000000000
--- a/tests/lang/bug20175.phpt
+++ /dev/null
@@ -1,165 +0,0 @@
---TEST--
-Bug #20175 (Static vars can't store ref to new instance)
---SKIPIF--
-<?php if (version_compare(zend_version(),'2.0.0-dev','<')) die('skip ZE1 does not have static class members'); ?>
---FILE--
-<?php
-print zend_version()."\n";
-
-/* Part 1:
- * Storing the result of a function in a static variable.
- * foo_global() increments global variable $foo_count whenever it is executed.
- * When foo_static() is called it checks for the static variable $foo_value
- * being initialised. In case initialisation is necessary foo_global() will be
- * called. Since that must happen only once the return value should be equal.
- */
-$foo_count = 0;
-
-function foo_global() {
- global $foo_count;
- echo "foo_global()\n";
- return 'foo:' . ++$foo_count;
-}
-
-function foo_static() {
- static $foo_value;
- echo "foo_static()\n";
- if (!isset($foo_value)) {
- $foo_value = foo_global();
- }
- return $foo_value;
-}
-
-/* Part 2:
- * Storing a reference to the result of a function in a static variable.
- * Same as Part 1 but:
- * The return statment transports a copy of the value to return. In other
- * words the return value of bar_global() is a temporary variable only valid
- * after the function call bar_global() is done in current local scope.
- */
-$bar_count = 0;
-
-function bar_global() {
- global $bar_count;
- echo "bar_global()\n";
- return 'bar:' . ++$bar_count;
-}
-
-function bar_static() {
- static $bar_value;
- echo "bar_static()\n";
- if (!isset($bar_value)) {
- $bar_value = &bar_global();
- }
- return $bar_value;
-}
-
-/* Part 3: TO BE DISCUSSED
- *
- * Storing a reference to the result of a function in a static variable.
- * Same as Part 2 but wow_global() returns a reference so $wow_value
- * should store a reference to $wow_global. Therefor $wow_value is already
- * initialised in second call to wow_static() and hence shouldn't call
- * wow_global() again.
- */ /*
-$wow_count = 0;
-$wow_name = '';
-
-function &wow_global() {
- global $wow_count, $wow_name;
- echo "wow_global()\n";
- $wow_name = 'wow:' . ++$wow_count;
- return $wow_name;
-}
-
-function wow_static() {
- static $wow_value;
- echo "wow_static()\n";
- if (!isset($wow_value)) {
- $wow_value = &wow_global();
- }
- return $wow_value;
-}*/
-
-/* Part 4:
- * Storing a reference to a new instance (that's where the name of the test
- * comes from). First there is the global counter $oop_global again which
- * counts the calls to the constructor of oop_class and hence counts the
- * creation of oop_class instances.
- * The class oop_test uses a static reference to a oop_class instance.
- * When another oop_test instance is created it must reuse the statically
- * stored reference oop_value. This way oop_class gets some singleton behavior
- * since it will be created only once for all insatnces of oop_test.
- */
-$oop_global = 0;
-class oop_class {
- var $oop_name;
-
- function oop_class() {
- global $oop_global;
- echo "oop_class()\n";
- $this->oop_name = 'oop:' . ++$oop_global;
- }
-}
-
-class oop_test {
- static $oop_value;
-
- function oop_test() {
- echo "oop_test()\n";
- }
-
- function oop_static() {
- echo "oop_static()\n";
- if (!isset(self::$oop_value)) {
- self::$oop_value = & new oop_class;
- }
- echo self::$oop_value->oop_name;
- }
-}
-
-print foo_static()."\n";
-print foo_static()."\n";
-print bar_static()."\n";
-print bar_static()."\n";
-//print wow_static()."\n";
-//print wow_static()."\n";
-echo "wow_static()
-wow_global()
-wow:1
-wow_static()
-wow:1
-";
-$oop_tester = new oop_test;
-print $oop_tester->oop_static()."\n";
-print $oop_tester->oop_static()."\n";
-$oop_tester = new oop_test; // repeated.
-print $oop_tester->oop_static()."\n";
-?>
---EXPECTF--
-%s
-foo_static()
-foo_global()
-foo:1
-foo_static()
-foo:1
-bar_static()
-bar_global()
-bar:1
-bar_static()
-bar_global()
-bar:2
-wow_static()
-wow_global()
-wow:1
-wow_static()
-wow:1
-oop_test()
-oop_static()
-oop_class()
-oop:1
-oop_static()
-oop:1
-oop_test()
-oop_static()
-oop:1
diff --git a/tests/lang/bug21094.phpt b/tests/lang/bug21094.phpt
deleted file mode 100644
index 266a1d6c8f..0000000000
--- a/tests/lang/bug21094.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Bug #21094 (set_error_handler not accepting methods)
---FILE--
-<?php
-class test {
- function hdlr($errno, $errstr, $errfile, $errline) {
- printf("[%d] errstr: %s, errfile: %s, errline: %d\n", $errno, $errstr, $errfile, $errline, $errstr);
- }
-}
-
-set_error_handler(array(new test(), "hdlr"));
-
-trigger_error("test");
-?>
---EXPECTF--
-[1024] errstr: test, errfile: %s, errline: %d
-
diff --git a/tests/lang/bug21600.phpt b/tests/lang/bug21600.phpt
deleted file mode 100644
index c3f832b9ea..0000000000
--- a/tests/lang/bug21600.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-Bug #21600 (assign by reference function call changes variable contents)
---FILE--
-<?php
-$tmp = array();
-$tmp['foo'] = "test";
-$tmp['foo'] = &bar($tmp['foo']);
-var_dump($tmp);
-
-unset($tmp);
-
-$tmp = array();
-$tmp['foo'] = "test";
-$tmp['foo'] = &fubar($tmp['foo']);
-var_dump($tmp);
-
-function bar($text){
- return $text;
-}
-
-function fubar($text){
- $text = &$text;
- return $text;
-}
-?>
---EXPECT--
-array(1) {
- ["foo"]=>
- &string(4) "test"
-}
-array(1) {
- ["foo"]=>
- string(4) "test"
-}
diff --git a/tests/lang/bug21800.phpt b/tests/lang/bug21800.phpt
deleted file mode 100644
index b835425c3d..0000000000
--- a/tests/lang/bug21800.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Bug #21800 (Segfault under interactive mode)
---SKIPIF--
-<?php (PHP_SAPI != 'cli') and print "SKIP PHP binary is not cli"; ?>
---FILE--
-<?php
-$fh = popen("{$_ENV['TEST_PHP_EXECUTABLE']} -a", 'w');
-if ($fh !== false) {
- fwrite($fh, "<?php echo ':test:'; ?>\n\n");
- fclose($fh);
-} else {
- echo "failure\n";
-}
-?>
---EXPECT--
-Interactive mode enabled
-
-:test:
diff --git a/tests/lang/bug21820.phpt b/tests/lang/bug21820.phpt
deleted file mode 100644
index bf1d46563a..0000000000
--- a/tests/lang/bug21820.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Bug #21820 ("$arr['foo']" generates bogus E_NOTICE, should be E_PARSE)
---FILE--
-<?php
-
-error_reporting(E_ALL);
-
-$arr = array('foo' => 'bar');
-echo "$arr['foo']";
-
-?>
---EXPECTREGEX--
-Parse error: parse error,.*expecting `?T_STRING'? or `?T_VARIABLE'? or `?T_NUM_STRING'? in .* on line .*
diff --git a/tests/lang/bug21849.phpt b/tests/lang/bug21849.phpt
deleted file mode 100644
index 30b311320b..0000000000
--- a/tests/lang/bug21849.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-Bug #21849 (self::constant doesn't work as method's default parameter)
---FILE--
-<?php
-class foo {
- const bar = "fubar\n";
-
- function foo($arg = self::bar) {
- echo $arg;
- }
-}
-
-new foo();
-?>
---EXPECT--
-fubar
diff --git a/tests/lang/bug21961.phpt b/tests/lang/bug21961.phpt
deleted file mode 100644
index eb2e8d2ce3..0000000000
--- a/tests/lang/bug21961.phpt
+++ /dev/null
@@ -1,58 +0,0 @@
---TEST--
-Bug #21961 (get_parent_class() segfault)
---SKIPIF--
-<?php if (version_compare(zend_version(),'2.0.0-dev','<')) die('skip prepared for ZE2'); ?>
---FILE--
-<?php
-
-class man
-{
- var $name, $bars;
- function man()
- {
- $this->name = 'Mr. X';
- $this->bars = array();
- }
-
- function getdrunk($where)
- {
- $this->bars[] = new bar($where);
- }
-
- function getName()
- {
- return $this->name;
- }
-}
-
-class bar extends man
-{
- var $name;
-
- function bar($w)
- {
- $this->name = $w;
- }
-
- function getName()
- {
- return $this->name;
- }
-
- function whosdrunk()
- {
- $who = get_parent_class($this);
- if($who == NULL)
- {
- return 'nobody';
- }
- return eval("return ".$who.'::getName();');
- }
-}
-
-$x = new man;
-$x->getdrunk('The old Tavern');
-var_dump($x->bars[0]->whosdrunk());
-?>
---EXPECT--
-string(14) "The old Tavern"
diff --git a/tests/lang/bug22231.phpt b/tests/lang/bug22231.phpt
deleted file mode 100644
index 91e5b2a44b..0000000000
--- a/tests/lang/bug22231.phpt
+++ /dev/null
@@ -1,39 +0,0 @@
---TEST--
-Bug #22231 (segfault when returning a global variable by reference)
---FILE--
-<?php
-class foo {
- var $fubar = 'fubar';
-}
-
-function &foo(){
- $GLOBALS['foo'] = &new foo();
- return $GLOBALS['foo'];
-}
-$bar = &foo();
-var_dump($bar);
-var_dump($bar->fubar);
-unset($bar);
-$bar = &foo();
-var_dump($bar->fubar);
-
-$foo = &foo();
-var_dump($foo);
-var_dump($foo->fubar);
-unset($foo);
-$foo = &foo();
-var_dump($foo->fubar);
-?>
---EXPECTF--
-object(foo)#%d (1) {
- ["fubar"]=>
- string(5) "fubar"
-}
-string(5) "fubar"
-string(5) "fubar"
-object(foo)#%d (1) {
- ["fubar"]=>
- string(5) "fubar"
-}
-string(5) "fubar"
-string(5) "fubar"
diff --git a/tests/lang/bug22367.phpt b/tests/lang/bug22367.phpt
deleted file mode 100644
index fea45bf4bd..0000000000
--- a/tests/lang/bug22367.phpt
+++ /dev/null
@@ -1,118 +0,0 @@
---TEST--
-Bug #22367 (weird zval allocation problem)
---FILE--
-<?php
-class foo
-{
- var $test = array(0, 1, 2, 3, 4);
-
- function a($arg) {
- var_dump(array_key_exists($arg, $this->test));
- return $this->test[$arg];
- }
-
- function b() {
- @$this->c();
-
- $zero = $this->test[0];
- $one = $this->test[1];
- $two = $this->test[2];
- $three = $this->test[3];
- $four = $this->test[4];
- return array($zero, $one, $two, $three, $four);
- }
-
- function c() {
- return $this->a($this->d());
- }
-
- function d() {}
-}
-
-class bar extends foo
-{
- var $i = 0;
- var $idx;
-
- function bar($idx) {
- $this->idx = $idx;
- }
-
- function &a($arg){
- return parent::a($arg);
- }
- function d(){
- return $this->idx;
- }
-}
-
-$a = new bar(5);
-var_dump($a->idx);
-@$a->c();
-$b = $a->b();
-var_dump($b);
-var_dump($a->test);
-
-$a = new bar(2);
-var_dump($a->idx);
-@$a->c();
-$b = $a->b();
-var_dump($b);
-var_dump($a->test);
-
-?>
---EXPECT--
-int(5)
-bool(false)
-bool(false)
-array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
-}
-array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
-}
-int(2)
-bool(true)
-bool(true)
-array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
-}
-array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
-}
diff --git a/tests/lang/bug22510.phpt b/tests/lang/bug22510.phpt
deleted file mode 100644
index ce5ce01358..0000000000
--- a/tests/lang/bug22510.phpt
+++ /dev/null
@@ -1,115 +0,0 @@
---TEST--
-Bug #22510 (segfault among complex references)
---FILE--
-<?php
-class foo
-{
- var $list = array();
-
- function finalize() {
- print __CLASS__."::".__FUNCTION__."\n";
- $cl = &$this->list;
- }
-
- function &method1() {
- print __CLASS__."::".__FUNCTION__."\n";
- return @$this->foo;
- }
-
- function &method2() {
- print __CLASS__."::".__FUNCTION__."\n";
- return $this->foo;
- }
-
- function method3() {
- print __CLASS__."::".__FUNCTION__."\n";
- return @$this->foo;
- }
-}
-
-class bar
-{
- function run1() {
- print __CLASS__."::".__FUNCTION__."\n";
- $this->instance = new foo();
- $this->instance->method1($this);
- $this->instance->method1($this);
- }
-
- function run2() {
- print __CLASS__."::".__FUNCTION__."\n";
- $this->instance = new foo();
- $this->instance->method2($this);
- $this->instance->method2($this);
- }
-
- function run3() {
- print __CLASS__."::".__FUNCTION__."\n";
- $this->instance = new foo();
- $this->instance->method3($this);
- $this->instance->method3($this);
- }
-}
-
-function ouch(&$bar) {
- print __FUNCTION__."\n";
- @$a = $a;
- $bar->run1();
-}
-
-function ok1(&$bar) {
- print __FUNCTION__."\n";
- $bar->run1();
-}
-
-function ok2(&$bar) {
- print __FUNCTION__."\n";
- @$a = $a;
- $bar->run2();
-}
-
-function ok3(&$bar) {
- print __FUNCTION__."\n";
- @$a = $a;
- $bar->run3();
-}
-
-$bar = &new bar();
-ok1($bar);
-$bar->instance->finalize();
-print "done!\n";
-ok2($bar);
-$bar->instance->finalize();
-print "done!\n";
-ok3($bar);
-$bar->instance->finalize();
-print "done!\n";
-ouch($bar);
-$bar->instance->finalize();
-print "I'm alive!\n";
-?>
---EXPECT--
-ok1
-bar::run1
-foo::method1
-foo::method1
-foo::finalize
-done!
-ok2
-bar::run2
-foo::method2
-foo::method2
-foo::finalize
-done!
-ok3
-bar::run3
-foo::method3
-foo::method3
-foo::finalize
-done!
-ouch
-bar::run1
-foo::method1
-foo::method1
-foo::finalize
-I'm alive!
diff --git a/tests/lang/bug22592.phpt b/tests/lang/bug22592.phpt
deleted file mode 100644
index e4e68b1184..0000000000
--- a/tests/lang/bug22592.phpt
+++ /dev/null
@@ -1,53 +0,0 @@
---TEST--
-Bug #22592 (cascading assignments to strings with curly braces broken)
---FILE--
-<?php
-function error_hdlr($errno, $errstr) {
- echo "[$errstr]\n";
-}
-
-set_error_handler('error_hdlr');
-
-$i = 4;
-$s = "string";
-
-$result = "* *-*";
-var_dump($result);
-$result{6} = '*';
-var_dump($result);
-$result{1} = $i;
-var_dump($result);
-$result{3} = $s;
-var_dump($result);
-$result{7} = 0;
-var_dump($result);
-$a = $result{1} = $result{3} = '-';
-var_dump($result);
-$b = $result{3} = $result{5} = $s;
-var_dump($result);
-$c = $result{0} = $result{2} = $result{4} = $i;
-var_dump($result);
-$d = $result{6} = $result{8} = 5;
-var_dump($result);
-$e = $result{1} = $result{6};
-var_dump($result);
-var_dump($a, $b, $c, $d, $e);
-$result{-1} = 'a';
-?>
---EXPECT--
-string(5) "* *-*"
-string(7) "* *-* *"
-string(7) "*4*-* *"
-string(7) "*4*s* *"
-string(8) "*4*s* *0"
-string(8) "*-*-* *0"
-string(8) "*-*s*s*0"
-string(8) "4-4s4s*0"
-string(9) "4-4s4s505"
-string(9) "454s4s505"
-string(1) "-"
-string(6) "string"
-int(4)
-int(5)
-string(1) "5"
-[Illegal string offset: -1]
diff --git a/tests/lang/bug23489.phpt b/tests/lang/bug23489.phpt
deleted file mode 100644
index 645bb1b7df..0000000000
--- a/tests/lang/bug23489.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Bug #23489 (ob_start() is broken with method callbacks)
---FILE--
-<?php
-class Test {
- function Test() {
- ob_start(
- array(
- $this, 'transform'
- )
- );
- }
-
- function transform($buffer) {
- return 'success';
- }
-}
-
-$t = new Test;
-?>
-failure
---EXPECT--
-success
diff --git a/tests/lang/bug23584.phpt b/tests/lang/bug23584.phpt
deleted file mode 100644
index 417cfb0856..0000000000
--- a/tests/lang/bug23584.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Bug #23584 (error line numbers off by one when using #!php)
---FILE--
-#!php
-<?php
-
-error_reporting(E_ALL);
-
-echo $foo;
-
-?>
---EXPECTREGEX--
-Notice: Undefined variable:.*foo in .* on line 6
diff --git a/tests/lang/bug7515.phpt b/tests/lang/bug7515.phpt
deleted file mode 100644
index b33ae24c89..0000000000
--- a/tests/lang/bug7515.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Bug #7515 (weird & invisible referencing of objects)
---SKIPIF--
-<?php if(version_compare(zend_version(), "2.0.0-dev", '<')) echo "skip Zend Engine 2 needed\n"; ?>
---INI--
-error_reporting=2039
---FILE--
-<?php
-class obj {
- function method() {}
-}
-
-$o->root=new obj();
-
-ob_start();
-var_dump($o);
-$x=ob_get_contents();
-ob_end_clean();
-
-$o->root->method();
-
-ob_start();
-var_dump($o);
-$y=ob_get_contents();
-ob_end_clean();
-if ($x == $y) {
- print "success";
-} else {
- print "failure
-x=$x
-y=$y
-";
-}
-?>
---EXPECT--
-success
diff --git a/tests/lang/error_2_exception_001.phpt b/tests/lang/error_2_exception_001.phpt
deleted file mode 100644
index e3d1217f42..0000000000
--- a/tests/lang/error_2_exception_001.phpt
+++ /dev/null
@@ -1,45 +0,0 @@
---TEST--
-ZE2 errors caught as exceptions
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class MyException {
- function MyException($_errno, $_errmsg) {
- $this->errno = $_errno;
- $this->errmsg = $_errmsg;
- }
-
- function getErrno() {
- return $this->errno;
- }
-
- function getErrmsg() {
- return $this->errmsg;
- }
-}
-
-function ErrorsToExceptions($errno, $errmsg) {
- throw new MyException($errno, $errmsg);
-}
-
-set_error_handler("ErrorsToExceptions");
-
-// make sure it isn't catching exceptions that weren't
-// thrown...
-
-try {
-} catch (MyException $exception) {
- echo "There was an exception: " . $exception->getErrno() . ", '" . $exception->getErrmsg() . "'\n";
-}
-
-try {
- trigger_error("I will become an exception", E_USER_ERROR);
-} catch (MyException $exception) {
- echo "There was an exception: " . $exception->getErrno() . ", '" . $exception->getErrmsg() . "'\n";
-}
-
-?>
---EXPECT--
-There was an exception: 256, 'I will become an exception'
diff --git a/tests/lang/namespace_001.phpt b/tests/lang/namespace_001.phpt
deleted file mode 100644
index 4d42ecf377..0000000000
--- a/tests/lang/namespace_001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-ZE2 namespaces
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-namespace Foo {
- var $bar;
-
- function SomeFunction() {
- echo "I'm Foo::SomeFunction()! Foo::\$bar is set to: " . Foo::$bar;
- }
-
- class SomeClass {
- function __construct() {
- echo "I'm Foo::SomeClass::__construct()!\n";
- echo Foo::$bar;
- }
- }
-}
-
-Foo::$bar = "I'm Foo::\$bar!\n";
-Foo::SomeFunction();
-$someClass = new Foo::SomeClass;
-
-?>
---EXPECT--
-I'm Foo::SomeFunction()! Foo::$bar is set to: I'm Foo::$bar!
-I'm Foo::SomeClass::__construct()!
-I'm Foo::$bar!
diff --git a/tests/lang/type_hints_001.phpt b/tests/lang/type_hints_001.phpt
deleted file mode 100644
index bd1577fe31..0000000000
--- a/tests/lang/type_hints_001.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-ZE2 type hinting
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-class Foo {
-}
-
-class Bar {
-}
-
-function type_hint_foo(Foo $a) {
-}
-
-$foo = new Foo;
-$bar = new Bar;
-
-type_hint_foo($foo);
-type_hint_foo($bar);
-
-?>
---EXPECTF--
-
-Fatal error: Argument 1 must be an instance of foo in %s on line %d
diff --git a/tests/odbc-display.php b/tests/odbc-display.php
deleted file mode 100644
index f79a854aea..0000000000
--- a/tests/odbc-display.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
- if(($conn = odbc_connect($dsn, $dbuser, $dbpwd))){
- if(($res = odbc_do($conn, "select gif from php_test where id='$id'"))){
- odbc_binmode($res, 0);
- odbc_longreadlen($res, 0);
- if(odbc_fetch_row($res)){
- header("content-type: image/gif");
- odbc_result($res, 1);
- exit;
- }else{
- echo "Error in odbc_fetch_row";
- }
- } else {
- echo "Error in odbc_do";
- }
- } else {
- echo "Error in odbc_connect";
- }
-?>
diff --git a/tests/odbc-t1.php b/tests/odbc-t1.php
deleted file mode 100644
index 90cb97910f..0000000000
--- a/tests/odbc-t1.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Quick &amp; dirty ODBC test</TITLE>
-</HEAD>
-<BODY>
-<H1>ODBC Test 1 - Connection</H1>
-<?php
- if(isset($dbuser)){
- echo "Connecting to $dsn as $dbuser\n<P>";
- $conn = odbc_connect($dsn,$dbuser,$dbpwd);
- if(!$conn){
-?>
-<H2>Error connecting to database! Check DSN, username and password</H2>
-<?php
- }else{
-?>
-<H2>Connection successful</H2>
-<A HREF="odbc-t2.php<?php echo "?dbuser=$dbuser&dsn=$dsn&dbpwd=$dbpwd" ?>">Proceed to next test</A>
-| <A HREF="<?php echo $PHP_SELF ?>">Change login information</A>
-<?php
- }
-} else {
-?>
-<EM>You will need permisson to create tables for the following tests!</EM>
-<form action=odbc-t1.php method=post>
-<table border=0>
-<tr><td>Database (DSN): </td><td><input type=text name=dsn></td></tr>
-<tr><td>User: </td><td><input type=text name=dbuser></td></tr>
-<tr><td>Password: </td><td><input type=password name=dbpwd></td></tr>
-</table>
-<br>
-<input type=submit value=connect>
-
-</form>
-<?php
-} ?>
-</BODY>
-</HTML>
diff --git a/tests/odbc-t2.php b/tests/odbc-t2.php
deleted file mode 100644
index a500b09e8b..0000000000
--- a/tests/odbc-t2.php
+++ /dev/null
@@ -1,82 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Quick &amp; dirty ODBC test #2</TITLE>
-</HEAD>
-<BODY>
-<H1>ODBC Test 2 - Create table</H1>
-<?php
- if(isset($dbuser)){
- echo "Connecting to $dsn as $dbuser\n";
- $conn = odbc_connect($dsn,$dbuser,$dbpwd);
- if(!$conn){
-?>
-<H2>Error connecting to database! Check DSN, username and password</H2>
-<?php
- }else{
-?>
-- OK<p>
-Dropping table "php3_test"
-<?php
- Error_Reporting(0);
- $res = odbc_exec($conn,"drop table php_test");
- if($res){
- odbc_free_result($res);
- }
-?>
-- OK<p>
-Create table "php_test"
-<?php
- error_reporting(1);
- $res = odbc_exec($conn, 'create table php_test (a char(16), b integer, c float, d varchar(128))');
- if($res){
- odbc_free_result($res);
-?>
- - OK<p>
-Table Info:<br>
-<table>
- <tr>
- <th>Name</th>
- <th>Type</th>
- <th>Length</th>
- </tr>
-<?php
- $info = odbc_exec($conn,"select * from php_test");
- $numfields = odbc_num_fields($info);
-
- for($i=1; $i<=$numfields; $i++){
-?>
- <tr>
- <td><?php echo odbc_field_name($info, $i) ?></td>
- <td><?php echo odbc_field_type($info, $i) ?></td>
- <td><?php echo odbc_field_len($info,$i) ?></td>
- </tr>
-<?php
- }
-?>
-</table>
-<P>
-<HR width=50%">
-<P>
-<A HREF="odbc-t3.php<?php echo "?dbuser=$dbuser&dsn=$dsn&dbpwd=$dbpwd" ?>">Proceed to next test</A>
-| <A HREF="<?php echo $PHP_SELF; ?>">Change login information</A>
-
-<?php
- }
- }
- } else {
-?>
-
-<form action="odbc-t3.php" method=post>
-<table border=0>
-<tr><td>Database (DSN): </td><td><input type=text name=dsn></td></tr>
-<tr><td>User: </td><td><input type=text name=dbuser></td></tr>
-<tr><td>Password: </td><td><input type=password name=dbpwd></td></tr>
-</table>
-<input type=submit value="Continue">
-</form>
-
-<?php
- }
-?>
-</BODY>
-</HTML>
diff --git a/tests/odbc-t3.php b/tests/odbc-t3.php
deleted file mode 100644
index edfdc658f8..0000000000
--- a/tests/odbc-t3.php
+++ /dev/null
@@ -1,95 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Database test #3</TITLE>
-</HEAD>
-<BODY>
-<H1>ODBC Test 3 - Insert records</H1>
-<?php
- if(isset($dbuser)){
- echo "Connecting to $dsn as $dbuser\n";
- $conn = odbc_connect($dsn,$dbuser,$dbpwd);
- if(!$conn){
-?>
-<H2>Error connecting to database! Check DSN, username and password</H2>
-<?php
- }else{
-?>
- - OK<p>
-Clearing table "php_test"
-<?php
- error_reporting(0);
- $res=odbc_exec($conn,"delete from php_test");
- odbc_free_result($res);
- error_reporting(1);
-?>
- - OK<p>
-Inserting into table "php_test"
-<?php
- $sqlfloat = '00.0';
- $sqlint = 1000;
- $stmt = odbc_prepare($conn, "insert into php_test values(?,?,?,?)");
- for($i=1; $i<=5; $i++){
- $values[0] = "test-$i";
- $values[1] = $sqlint + $i;
- $values[2] = $i . $sqlfloat . $i;
- $values[3] = "php - values $i";
- $ret = odbc_execute($stmt, &$values);
- }
- odbc_free_result($stmt);
- $res = odbc_exec($conn, "select count(*) from php_test");
- if($res && (odbc_result($res, 1) == 5)){
- odbc_free_result($res);
-?>
- - OK<p>
-<H3>The table "php_test" should now contain the following values:</H3>
-<table>
- <tr>
- <th>A</th><th>B</th><th>C</th><th>D</th>
- </tr>
- <tr>
- <td>test-1</td><td>1001</td><td>100.01</td><td>php - values 1</td>
- </tr>
- <tr>
- <td>test-2</td><td>1002</td><td>200.02</td><td>php - values 2</td>
- </tr>
- <tr>
- <td>test-3</td><td>1003</td><td>300.03</td><td>php - values 3</td>
- </tr>
- <tr>
- <td>test-4</td><td>1004</td><td>400.04</td><td>php - values 4</td>
- </tr>
- <tr>
- <td>test-5</td><td>1005</td><td>500.05</td><td>php - values 5</td>
- </tr>
-</table>
-
-<H3>Actual contents of table "php_test":</H3>
-<?php
- $res = odbc_exec($conn, "select * from php_test");
- odbc_result_all($res);
- }
-?>
-<p>
- <HR width="50%">
-<p>
-<A HREF="odbc-t4.php?dbuser=<?php echo "$dbuser&dsn=$dsn&dbpwd=$dbpwd" ?>">Proceed to next test</A>
-| <A HREF="<?php echo $PHP_SELF ?>">Change login information</A>
-<?php
- }
- } else {
-?>
-<form action=odbc-t3.php method=post>
-<table border=0>
- <tr><td>Database: </td><td><input type=text name=dsn></td></tr>
- <tr><td>User: </td><td><input type=text name=dbuser></td></tr>
- <tr><td>Password: </td><td><input type=password name=dbpwd></td></tr>
-</table>
-<input type=submit value=connect>
-
-</form>
-<?php
- }
-?>
-</BODY>
-</HTML>
-
diff --git a/tests/odbc-t4.php b/tests/odbc-t4.php
deleted file mode 100644
index 10e8f4b2d9..0000000000
--- a/tests/odbc-t4.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Database test #4</TITLE>
-</HEAD>
-<BODY>
-<H1>ODBC Test 4 - Cursors</H1>
-<em>The following test requires your ODBC driver to support positioned updates</em><p>
-<?php
- if(isset($dbuser)){
- echo "Connecting to $dsn as $dbuser\n";
- $conn = odbc_connect($dsn,$dbuser,$dbpwd);
- if(!$conn){
-?>
-<H2>Error connecting to database! Check DSN, username and password</H2>
-<?php
- }else{
-?>
- - OK<p>
-Updating table "php_test"
-<?php
- odbc_autocommit($conn, 0);
- if(($result = odbc_do($conn, 'select * from php_test where b>1002 for update'))){
- $cursor = odbc_cursor($result);
- if(($upd = odbc_prepare($conn,"update php_test set a=?, b=? where current of $cursor"))){
- while(odbc_fetch_row($result)) {
- $params[0] = odbc_result($result, 1) . "(*)";
- $params[1] = odbc_result($result, 2) + 2000;
- odbc_execute($upd, $params);
- }
- odbc_commit($conn);
- }
- }
- if($result && $upd){
-?>
- - OK<p>
-<H3>The table "php_test" should now contain the following values:</H3>
-<table>
- <tr>
- <th>A</th><th>B</th><th>C</th><th>D</th>
- </tr>
- <tr>
- <td>test-1</td><td>1001</td><td>100.01</td><td>php3 - values 1</td>
- </tr>
- <tr>
- <td>test-2</td><td>1002</td><td>200.02</td><td>php - values 2</td>
- </tr>
- <tr>
- <td>test-3(*)</td><td>3003</td><td>300.03</td><td>php - values 3</td>
- </tr>
- <tr>
- <td>test-4(*)</td><td>3004</td><td>400.04</td><td>php - values 4</td>
- </tr>
- <tr>
- <td>test-5(*)</td><td>3005</td><td>500.05</td><td>php - values 5</td>
- </tr>
- <tr>
- <td colspan=4>
- <small><em><strong>Note:</strong> If you reload this testpage,<br>
- the three last rows will contain different<br>values in columns A and B</em></small>
- </td>
- </tr>
-</table>
-
-<H3>Actual contents of table "php_test":</H3>
-<?php
- $res = odbc_exec($conn,"select * from php_test");
- odbc_result_all($res);
- }else{
- echo "Your driver obviously doesn't support positioned updates\n<p>";
- }
-?>
-<p><HR width="50%"><p>
-<A HREF="odbc-t5.php?dbuser=<?php echo "$dbuser&dsn=$dsn&dbpwd=$dbpwd"; ?>">Proceed to next test</A>
-<?php
- }
-} else {
-?>
-<form action=odbc-t4.php method=post>
-<table border=0>
-<tr><td>Database: </td><td><input type=text name=dsn></td></tr>
-<tr><td>User: </td><td><input type=text name=dbuser></td></tr>
-<tr><td>Password: </td><td><input type=password name=dbpwd></td></tr>
-</table>
-<input type=submit value=connect>
-
-</form>
-<?php
- }
-?>
-</BODY>
-</HTML>
diff --git a/tests/odbc-t5.php b/tests/odbc-t5.php
deleted file mode 100644
index 13af52d222..0000000000
--- a/tests/odbc-t5.php
+++ /dev/null
@@ -1,137 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Database test #5</TITLE>
-</HEAD>
-<BODY>
-<H1>ODBC Test 5 - Blobs</H1>
-<?php
- if(!isset($gif1file) && !isset($display) ||
- ($gif1file == "none" && $gif2file == "none"
- && $gif3file == "none")){
-?>
-<H2>Please select the images (gif) you want to put into the database</H2>
-<FORM METHOD="POST" ACTION="<?php echo $PHP_SELF ?>" ENCTYPE="multipart/form-data">
-Image 1: <INPUT TYPE="file" NAME="gif1file" VALUE="" SIZE="48"><P>
-Image 2: <INPUT TYPE="file" NAME="gif2file" VALUE="" SIZE="48"><P>
-Image 3: <INPUT TYPE="file" NAME="gif3file" VALUE="" SIZE="48"><P>
-Blob database type name: <INPUT TYPE="text" NAME="datatype" VALUE="LONG BYTE" SIZE="32">
-<P>
-<INPUT TYPE="hidden" name="dsn" value="<?php echo $dsn ?>">
-<INPUT TYPE="hidden" name="dbuser" value="<?php echo $dbuser ?>">
-<INPUT TYPE="hidden" name="dbpwd" value="<?php echo $dbpwd ?>">
-<INPUT TYPE="submit" VALUE="Send File(s)">
-| <INPUT TYPE="reset" VALUE="reset">
-</FORM>
-</BODY>
-</HTML>
-<?php
- exit;
- }
-
- if(isset($dbuser)){
- echo "Connecting to $dsn as $dbuser\n";
- $conn = odbc_connect($dsn, $dbuser, $dbpwd);
- if(!$conn){
-?>
-<H2>Error connecting to database! Check DSN, username and password</H2>
-<?php
- }else{
-?>
- - OK<p>
-<?php
- if(isset($display)){
- if(($res = odbc_exec($conn, 'select id from php_test'))){
- echo "<H3>Images in database</H3>";
- while(odbc_fetch_into($res, &$imgs)){
- echo "$imgs[0] : <IMG SRC=\"odbc-display.php?id=$imgs[0]&dbuser=$dbuser&dsn=$dsn&dbpwd=$dbpwd\">\n<P>";
- }
- }else{
- echo "Couldn't execute query";
- }
- echo "\n</BODY>\n</HTML>";
- exit;
- }
-?>
-Dropping table "php_test"
-<?php
- Error_Reporting(0);
- $res = odbc_exec($conn, "drop table php_test");
- if($res){
- odbc_free_result($res);
- }
-?>
- - OK<p>
-Creating table "php_test":
-<?php
- $res = odbc_exec($conn, "create table php_test (id char(32), gif $datatype)");
- if($res){
- odbc_free_result($res);
-?>
- - OK<p>
-Table Info:<br>
-<table>
- <tr>
- <th>Name</th>
- <th>Type</th>
- <th>Length</th>
- </tr>
-<?php
- $info = odbc_exec($conn,"select * from php_test");
- $numfields = odbc_num_fields($info);
-
- for($i=1; $i<=$numfields; $i++){
-?>
- <tr>
- <td><?php echo odbc_field_name($info, $i) ?></td>
- <td><?php echo odbc_field_type($info, $i) ?></td>
- <td><?php echo odbc_field_len($info,$i) ?></td>
- </tr>
-<?php
- }
- odbc_free_result($info);
-?>
-</table>
-
-Inserting data:
-<?php
- echo "$gif1file - $gif2file - $gif3file";
-
- odbc_free_result($res);
- $res = odbc_prepare($conn, "insert into php_test values(?,?)");
- if($gif1file != "none"){
- $params[0] = "image1";
- $params[1] = "'$gif1file'";
- odbc_execute($res, $params);
- }
- if($gif2file != "none"){
- $params[0] = "image2";
- $params[1] = "'$gif2file'";
- odbc_execute($res, $params);
- }
- if($gif3file != "none"){
- $params[0] = "image3";
- $params[1] = "'$gif3file'";
- odbc_execute($res, $params);
- }
-?>
- - OK<P>
-<A HREF="<?php echo "$PHP_SELF?display=y&dbuser=$dbuser&dsn=$dsn&dbpwd=$dbpwd" ?>">Display Images</A>
-<?php
- }
- }
- } else {
-?>
-<form action=odbc-t5.php method=post>
-<table border=0>
-<tr><td>Database: </td><td><input type=text name=dsn></td></tr>
-<tr><td>User: </td><td><input type=text name=dbuser></td></tr>
-<tr><td>Password: </td><td><input type=password name=dbpwd></td></tr>
-</table>
-<input type=submit value=connect>
-
-</form>
-<?php
- }
-?>
-</BODY>
-</HTML>
diff --git a/tests/quicktester.inc b/tests/quicktester.inc
deleted file mode 100644
index 48ed6b549f..0000000000
--- a/tests/quicktester.inc
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
- /*
- Helper for simple tests to check return-value. Usage:
-
- $tests = <<<TESTS
- expected_return_value === expression
- 2 === 1+1
- 4 === 2*2
- FALSE === @ fopen('non_existent_file')
-TESTS;
- include( 'tests/quicktester.inc' );
-
- Expect: OK
-
- Remember to NOT put a trailing ; after a line!
-
- */
-error_reporting(E_ALL);
-$tests = explode("\n",$tests);
-$success = TRUE;
-foreach ($tests as $n=>$test)
-{
- // ignore empty lines
- if (!$test) continue;
-
- // warn for trailing ;
- if (substr(trim($test), -1, 1) === ';') {
- echo "WARNING: trailing ';' found in test ".($n+1)."\n";
- exit;
- }
-
- // try for operators
- $operators = array('===', '~==');
- $operator = NULL;
- foreach ($operators as $a_operator) {
- if (strpos($test, $a_operator)!== FALSE) {
- $operator = $a_operator;
- list($left,$right) = explode($operator, $test);
- break;
- }
- }
- if (!$operator) {
- echo "WARNING: unknown operator in '$test' (1)\n";
- exit;
- }
-
- $left = eval("return ($left );");
- $right = eval("return ($right);");
- switch (@$operator) {
- case '===': // exact match
- $result = $left === $right;
- break;
- case '~==': // may differ after 12th significant number
- if ( !is_float($left ) && !is_int($left )
- || !is_float($right) && !is_int($right)) {
- $result = FALSE;
- break;
- }
- $result = abs(($left-$right) / $left) < 1e-12;
- break;
- default:
- echo "WARNING: unknown operator in '$test' (2)\n";
- exit;
- }
-
- $success = $success && $result;
- if (!$result) {
- echo "\nAssert failed:\n";
- echo "$test\n";
- echo "Left: ";var_dump($left );
- echo "Right: ";var_dump($right);
- }
-}
-if ($success) echo "OK";
-
diff --git a/tests/recurse b/tests/recurse
deleted file mode 100644
index 5b8c646f6b..0000000000
--- a/tests/recurse
+++ /dev/null
@@ -1,21 +0,0 @@
-<?
-
-function factorial($n)
-{
- if ($n==0 || $n==1) {
- return 1;
- } else {
- return $n*factorial($n-1);
- }
-}
-
-
-for ($k=0; $k<10; $k++):
-for ($i=0,$sum=0; $i<50; $i++) {
- $sum = $sum+factorial($i);
-}
-endfor;
-
-print "\$sum=$sum\n";
-
-
diff --git a/tests/run-test/test001.phpt b/tests/run-test/test001.phpt
deleted file mode 100644
index 370d09c953..0000000000
--- a/tests/run-test/test001.phpt
+++ /dev/null
@@ -1,6 +0,0 @@
---TEST--
-EXPECT
---FILE--
-abc
---EXPECT--
-abc \ No newline at end of file
diff --git a/tests/run-test/test002.phpt b/tests/run-test/test002.phpt
deleted file mode 100644
index 7b91f35c8d..0000000000
--- a/tests/run-test/test002.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-EXPECTF
---FILE--
-123
--123
-+123
-+1.1
-abc
-0abc
-x
---EXPECTF--
-%d
-%i
-%i
-%f
-%s
-%x
-%c \ No newline at end of file
diff --git a/tests/run-test/test003.phpt b/tests/run-test/test003.phpt
deleted file mode 100644
index c1afad15f7..0000000000
--- a/tests/run-test/test003.phpt
+++ /dev/null
@@ -1,6 +0,0 @@
---TEST--
-EXPECTREGEX
---FILE--
-abcde12314235xyz34264768286abcde
---EXPECTREGEX--
-[abcde]+[0-5]*xyz[2-8]+abcde \ No newline at end of file
diff --git a/tests/run-test/test004.phpt b/tests/run-test/test004.phpt
deleted file mode 100644
index 19dbdede8c..0000000000
--- a/tests/run-test/test004.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-INI section allows '='
---INI--
-arg_separator.input==
---FILE--
-<?php
-var_dump(ini_get('arg_separator.input'));
-?>
---EXPECT--
-string(1) "=" \ No newline at end of file
diff --git a/tests/run-test/test005.phpt b/tests/run-test/test005.phpt
deleted file mode 100644
index 65459f8f86..0000000000
--- a/tests/run-test/test005.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-Error message handling (without ZendOptimizer)
---SKIPIF--
-<?php
-!extension_loaded("Zend Optimizer") or die("skip Zend Optimizer is loaded");
-?>
---FILE--
-<?php
-// If this test fails ask the developers of run-test.php
-//
-// We check the general ini settings which affect error handling
-// and than verify if a message is given by a division by zero.
-// EXPECTF is used here since the error format may change but ut
-// should always contain 'Division by zero'.
-var_dump(ini_get('display_errors'));
-var_dump(ini_get('error_reporting'));
-var_dump(ini_get('log_errors'));
-var_dump(ini_get('track_errors'));
-ini_set('display_errors', 0);
-var_dump(ini_get('display_errors'));
-var_dump($php_errormsg);
-$error = 1 / 0;
-var_dump($php_errormsg);
-?>
---EXPECTF--
-string(1) "1"
-string(4) "2047"
-string(1) "0"
-string(1) "1"
-string(1) "0"
-NULL
-string(%d) "%sivision by zer%s"
diff --git a/tests/run-test/test006.phpt b/tests/run-test/test006.phpt
deleted file mode 100644
index 4dca66a4f7..0000000000
--- a/tests/run-test/test006.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-Error messages are shown
---FILE--
-<?php
-// If this test fails ask the developers of run-test.php
-$error = 1 / 0;
-?>
---EXPECTREGEX--
-.*Division by zero.*
diff --git a/tests/run-test/test007.phpt b/tests/run-test/test007.phpt
deleted file mode 100644
index f5f934f72e..0000000000
--- a/tests/run-test/test007.phpt
+++ /dev/null
Binary files differ
diff --git a/tests/run-test/test008.phpt b/tests/run-test/test008.phpt
deleted file mode 100644
index d595b2592b..0000000000
--- a/tests/run-test/test008.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Error message handling (with ZendOptimizer)
---SKIPIF--
-<?php
-extension_loaded("Zend Optimizer") or die("skip Zend Optimizer is not loaded");
-?>
---FILE--
-<?php
-// If this test fails ask the developers of run-test.php
-//
-// We check the general ini settings which affect error handling
-// and than verify if a message is given by a division by zero.
-// EXPECTF is used here since the error format may change but ut
-// should always contain 'Division by zero'.
-var_dump(ini_get('display_errors'));
-var_dump(ini_get('error_reporting'));
-var_dump(ini_get('log_errors'));
-var_dump(ini_get('track_errors'));
-ini_set('display_errors', 0);
-var_dump(ini_get('display_errors'));
-var_dump($php_errormsg);
-$error = 1 / 0;
-var_dump($php_errormsg);
-?>
---EXPECTF--
-%s: %sivision by zero in %s on line %d
-string(1) "1"
-string(4) "2047"
-string(1) "0"
-string(1) "1"
-string(1) "0"
-string(%d) "%sivision by zer%s"
-string(%d) "%sivision by zer%s"
diff --git a/tests/run-test/test008a.phpt b/tests/run-test/test008a.phpt
deleted file mode 100644
index 04a3c71168..0000000000
--- a/tests/run-test/test008a.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-Error message handling (without ZendOptimizer)
---SKIPIF--
-<?php
-if (extension_loaded("Zend Optimizer")) die("skip Zend Optimizer is loaded");
-?>
---FILE--
-<?php
-// If this test fails ask the developers of run-test.php
-//
-// We check the general ini settings which affect error handling
-// and than verify if a message is given by a division by zero.
-// EXPECTF is used here since the error format may change but ut
-// should always contain 'Division by zero'.
-var_dump(ini_get('display_errors'));
-var_dump(ini_get('error_reporting'));
-var_dump(ini_get('log_errors'));
-var_dump(ini_get('track_errors'));
-ini_set('display_errors', 0);
-var_dump(ini_get('display_errors'));
-var_dump($php_errormsg);
-$error = 1 / 0;
-var_dump($php_errormsg);
-?>
---EXPECTF--
-string(1) "1"
-string(4) "2047"
-string(1) "0"
-string(1) "1"
-string(1) "0"
-NULL
-string(%d) "%sivision by zer%s"
diff --git a/tests/run.html b/tests/run.html
deleted file mode 100644
index 281e9e57c8..0000000000
--- a/tests/run.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html>
-<body>
-<form action="run.php" method="POST">
-
-<textarea name="code" cols=50 rows=20>
-</textarea><br>
-<input type="submit" value="Go!">
-</form>
-
-</body>
-</html>
diff --git a/tests/run.php b/tests/run.php
deleted file mode 100644
index a6792b5af7..0000000000
--- a/tests/run.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?
-if (!isset($code)) {
- exit("No code submitted.");
-}
-?>
-<html>
-<body>
-Executing:<br>
-<?
-highlight_string("<?php \n$code\n?>");
-?>
-<hr width="40%">
-<?
-eval($code);
-?>
-</body>
-</html> \ No newline at end of file
diff --git a/tests/scan_cases b/tests/scan_cases
deleted file mode 100644
index d562230fde..0000000000
--- a/tests/scan_cases
+++ /dev/null
@@ -1,28 +0,0 @@
-# Test file used by testscanf.php. Feel free to add additional cases
-# sscanf test cases. formatted to be slurped and split by explode
-%d|48| valid decimal (positive)
-%d|-98| valid signed decimal (negative)
-%d|56a| integer scan : decimal digit followed by alpha
-%4d|558071|decimal integer with width specification
-%i|-5489|valid signed integer (negative)
-%s| the rain in spain | plain ole string matched with %s
-%10s|jabberwocky| string with width specifier
-%f|289.071| valid float (%f)
-%f|-0.403| valid negative (%f)
-%3f|76.4|Float with width specifier ending at decimal point
-%3f"|789.4|Float with width specifier
-%o|0321|octal with leading 0
-%o|327| valid octal digits
-%o|380| octal scan with octal digit followed by non-octal
-%x|fe| valid hex|
-%x|0xfe| "c" style hex with leading 0x|
-%x|455| hex with all single digits < f
-%x|-98| hex (negative signed int)
-%c|y| single char
-%4c|tulips|Character with width specification (4)
-%e|10e-9| signed floating point with negative exponent
-%e|10e+9| signed floating point with explicit positive exponent
-%e|10e9| signed floating point with positive exponent (no + sign)
-# next we test multiple cases
- %d %i %o %u %x %s %c %e %f %g | 19 84 0666 2000 0xface your x 31e+9 0.912 2.4 |multiple specifiers
-
diff --git a/tests/strings/001.phpt b/tests/strings/001.phpt
deleted file mode 100644
index 4eacb89592..0000000000
--- a/tests/strings/001.phpt
+++ /dev/null
@@ -1,209 +0,0 @@
---TEST--
-String functions
---POST--
---GET--
---FILE--
-<?php
-
-error_reporting(0);
-
-echo "Testing strtok: ";
-
-$str = "testing 1/2\\3";
-$tok1 = strtok($str, " ");
-$tok2 = strtok("/");
-$tok3 = strtok("\\");
-$tok4 = strtok(".");
-if ($tok1 != "testing") {
- echo("failed 1\n");
-} elseif ($tok2 != "1") {
- echo("failed 2\n");
-} elseif ($tok3 != "2") {
- echo("failed 3\n");
-} elseif ($tok4 != "3") {
- echo("failed 4\n");
-} else {
- echo("passed\n");
-}
-
-echo "Testing strstr: ";
-$test = "This is a test";
-$found1 = strstr($test, 32);
-$found2 = strstr($test, "a ");
-if ($found1 != " is a test") {
- echo("failed 1\n");
-} elseif ($found2 != "a test") {
- echo("failed 2\n");
-} else {
- echo("passed\n");
-}
-
-echo "Testing strrchr: ";
-$test = "fola fola blakken";
-$found1 = strrchr($test, "b");
-$found2 = strrchr($test, 102);
-if ($found1 != "blakken") {
- echo("failed 1\n");
-} elseif ($found2 != "fola blakken") {
- echo("failed 2\n");
-}
-else {
- echo("passed\n");
-}
-
-echo "Testing strtoupper: ";
-$test = "abCdEfg";
-$upper = strtoupper($test);
-if ($upper == "ABCDEFG") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing strtolower: ";
-$test = "ABcDeFG";
-$lower = strtolower($test);
-if ($lower == "abcdefg") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing substr: ";
-$tests = $ok = 0;
-$string = "string12345";
-$tests++; if (substr($string, 2, 10) == "ring12345") { $ok++; }
-$tests++; if (substr($string, 4, 7) == "ng12345") { $ok++; }
-$tests++; if (substr($string, 4) == "ng12345") { $ok++; }
-$tests++; if (substr($string, 10, 2) == "5") { $ok++; }
-$tests++; if (substr($string, 6, 0) == "") { $ok++; }
-$tests++; if (substr($string, -2, 2) == "45") { $ok++; }
-$tests++; if (substr($string, 1, -1) == "tring1234") { $ok++; }
-$tests++; if (substr($string, -1, -2) == "") { $ok++; }
-$tests++; if (substr($string, -3, -2) == "3") { $ok++; }
-
-if ($tests == $ok) {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-$raw = ' !"#$%&\'()*+,-./0123456789:;<=>?'
- . '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'
- . '`abcdefghijklmnopqrstuvwxyz{|}~'
- . "\0";
-
-echo "Testing rawurlencode: ";
-$encoded = rawurlencode($raw);
-$correct = '%20%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F'
- . '%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_'
- . '%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E'
- . '%00';
-if ($encoded == $correct) {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing rawurldecode: ";
-$decoded = rawurldecode($correct);
-if ($decoded == $raw) {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing urlencode: ";
-$encoded = urlencode($raw);
-$correct = '+%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F'
- . '%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_'
- . '%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E'
- . '%00';
-if ($encoded == $correct) {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing urldecode: ";
-$decoded = urldecode($correct);
-if ($decoded == $raw) {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing quotemeta: ";
-$raw = "a.\\+*?" . chr(91) . "^" . chr(93) . "b\$c";
-$quoted = quotemeta($raw);
-if ($quoted == "a\\.\\\\\\+\\*\\?\\[\\^\\]b\\\$c") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing ufirst: ";
-$str = "fahrvergnuegen";
-$uc = ucfirst($str);
-if ($uc == "Fahrvergnuegen") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing strtr: ";
-$str = "test abcdefgh";
-$tr = strtr($str, "def", "456");
-if ($tr == "t5st abc456gh") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing addslashes: ";
-$str = "\"\\'";
-$as = addslashes($str);
-if ($as == "\\\"\\\\\\'") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing stripslashes: ";
-$str = "\$\\'";
-$ss = stripslashes($str);
-if ($ss == "\$'") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-
-echo "Testing uniqid: ";
-$str = "prefix";
-$ui1 = uniqid($str);
-$ui2 = uniqid($str);
-if (strlen($ui1) == strlen($ui2) && strlen($ui1) == 19 && $ui1 != $ui2) {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-?>
---EXPECT--
-Testing strtok: passed
-Testing strstr: passed
-Testing strrchr: passed
-Testing strtoupper: passed
-Testing strtolower: passed
-Testing substr: passed
-Testing rawurlencode: passed
-Testing rawurldecode: passed
-Testing urlencode: passed
-Testing urldecode: passed
-Testing quotemeta: passed
-Testing ufirst: passed
-Testing strtr: passed
-Testing addslashes: passed
-Testing stripslashes: passed
-Testing uniqid: passed
diff --git a/tests/strings/002.phpt b/tests/strings/002.phpt
deleted file mode 100644
index 96bc722e0e..0000000000
--- a/tests/strings/002.phpt
+++ /dev/null
@@ -1,85 +0,0 @@
---TEST--
-Formatted print functions
---POST--
---GET--
---FILE--
-<?php
-error_reporting(0);
-
-$fp = fopen("php://stdout", "w") or die("Arrggsgg!!");
-$x = fprintf($fp, "fprintf test 1:%.5s\n", "abcdefghij");
-var_dump($x);
-fclose($fp);
-
-printf("printf test 1:%s\n", "simple string");
-printf("printf test 2:%d\n", 42);
-printf("printf test 3:%f\n", 10.0/3);
-printf("printf test 4:%.10f\n", 10.0/3);
-printf("printf test 5:%-10.2f\n", 2.5);
-printf("printf test 6:%-010.2f\n", 2.5);
-printf("printf test 7:%010.2f\n", 2.5);
-printf("printf test 8:<%20s>\n", "foo");
-printf("printf test 9:<%-20s>\n", "bar");
-printf("printf test 10: 123456789012345\n");
-printf("printf test 10:<%15s>\n", "høyesterettsjustitiarius");
-printf("printf test 11: 123456789012345678901234567890\n");
-printf("printf test 11:<%30s>\n", "høyesterettsjustitiarius");
-printf("printf test 12:%5.2f\n", -12.34);
-printf("printf test 13:%5d\n", -12);
-printf("printf test 14:%c\n", 64);
-printf("printf test 15:%b\n", 170);
-printf("printf test 16:%x\n", 170);
-printf("printf test 17:%X\n", 170);
-printf("printf test 18:%16b\n", 170);
-printf("printf test 19:%16x\n", 170);
-printf("printf test 20:%16X\n", 170);
-printf("printf test 21:%016b\n", 170);
-printf("printf test 22:%016x\n", 170);
-printf("printf test 23:%016X\n", 170);
-printf("printf test 24:%.5s\n", "abcdefghij");
-printf("printf test 25:%-2s\n", "gazonk");
-printf("printf test 26:%2\$d %1\$d\n", 1, 2);
-printf("printf test 27:%3\$d %d %d\n", 1, 2, 3);
-printf("printf test 28:%2\$02d %1\$2d\n", 1, 2);
-printf("printf test 29:%2\$-2d %1\$2d\n", 1, 2);
-print("printf test 30:"); printf("%0\$s", 1); print("x\n");
-vprintf("vprintf test 1:%2\$-2d %1\$2d\n", array(1, 2));
-
-
-?>
---EXPECT--
-fprintf test 1:abcde
-int(20)
-printf test 1:simple string
-printf test 2:42
-printf test 3:3.333333
-printf test 4:3.3333333333
-printf test 5:2.50
-printf test 6:2.50000000000
-printf test 7:0000000002.50
-printf test 8:< foo>
-printf test 9:<bar >
-printf test 10: 123456789012345
-printf test 10:<høyesterettsjustitiarius>
-printf test 11: 123456789012345678901234567890
-printf test 11:< høyesterettsjustitiarius>
-printf test 12: -12.34
-printf test 13: -12
-printf test 14:@
-printf test 15:10101010
-printf test 16:aa
-printf test 17:AA
-printf test 18: 10101010
-printf test 19: aa
-printf test 20: AA
-printf test 21:0000000010101010
-printf test 22:00000000000000aa
-printf test 23:00000000000000AA
-printf test 24:abcde
-printf test 25:gazonk
-printf test 26:2 1
-printf test 27:3 1 2
-printf test 28:02 1
-printf test 29:2 1
-printf test 30:x
-vprintf test 1:2 1
diff --git a/tests/strings/004.phpt b/tests/strings/004.phpt
deleted file mode 100644
index 596928cdff..0000000000
--- a/tests/strings/004.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-highlight_string() buffering
---POST--
---INI--
-highlight.string=#DD0000
-highlight.comment=#FF9900
-highlight.keyword=#007700
-highlight.bg=#FFFFFF
-highlight.default=#0000BB
-highlight.html=#000000
---GET--
---FILE--
-<?php
-$var = highlight_string("<br /><?php echo \"foo\"; ?><br />");
-$var = highlight_string("<br /><?php echo \"bar\"; ?><br />", TRUE);
-echo "\n[$var]\n";
-?>
---EXPECT--
-<code><font color="#000000">
-&lt;br /&gt;<font color="#0000BB">&lt;?php </font><font color="#007700">echo </font><font color="#DD0000">"foo"</font><font color="#007700">; </font><font color="#0000BB">?&gt;</font>&lt;br /&gt;</font>
-</code>
-[<code><font color="#000000">
-&lt;br /&gt;<font color="#0000BB">&lt;?php </font><font color="#007700">echo </font><font color="#DD0000">"bar"</font><font color="#007700">; </font><font color="#0000BB">?&gt;</font>&lt;br /&gt;</font>
-</code>]
diff --git a/tests/test.php4 b/tests/test.php4
deleted file mode 100644
index 7af9a28ebd..0000000000
--- a/tests/test.php4
+++ /dev/null
@@ -1,15 +0,0 @@
-<?
-function blah($a)
-{
- return $a;
-}
-
-return "cool";
-
-
-for ($for=0; $for<=100000;$for++)
-{
-if ("andi" != blah("andi"))
-{
-print "error";}
-}
diff --git a/tests/test.pl b/tests/test.pl
deleted file mode 100644
index 2502cb1298..0000000000
--- a/tests/test.pl
+++ /dev/null
@@ -1,34 +0,0 @@
-<?
-
-$i = 0;
-$j = 1;
-
-for ($k=0; $k<1000000; $k = $k+1) {
- while ($i<10000000) {
- if (($i%"4")<1) {
- $i = $i+"1";
- if ($j%"2") {
- $i = $i * "2";
- }
- } elseif (($i%"4")<2) {
- $i = $i+"2";
- if ($j%"2") {
- $i = $i * "2";
- }
- } elseif (($i%"4")<3) {
- $i = $i+3;
- if ($j%"2") {
- $i = $i * "2";
- }
- } else {
- $i = $i+"4";
- if ($j%"2") {
- $i = $i * "2";
- }
- }
- $j = $j+1;
- }
-}
-print $i;
-print "\n";
-
diff --git a/tests/test_class_inheritance b/tests/test_class_inheritance
deleted file mode 100644
index 3f903e62d1..0000000000
--- a/tests/test_class_inheritance
+++ /dev/null
@@ -1,29 +0,0 @@
-<?
-
-class BaseClass {
- var $class_name = "BaseClass";
-
- function BaseClass($value) {
- print "value is '$value'\n";
- }
- function MyClassName() {
- return $this->class_name;
- }
-};
-
-
-class ChildClass {
- var $class_name = "ChildClass";
-
- function ChildClass($value, $new_value) {
- BaseClass::BaseClass($value);
- print "new value is '$new_value'\n";
- }
- function MyClassName($a_value) {
- return BaseClass::MyClassName()." and the value is '$a_value'";
- }
-};
-
-
-$obj = new ChildClass("Test", "Another test");
-print $obj->MyClassName("not interesting"); \ No newline at end of file
diff --git a/tests/testarray b/tests/testarray
deleted file mode 100644
index bee5cca546..0000000000
--- a/tests/testarray
+++ /dev/null
@@ -1,21 +0,0 @@
-This is a small test....
-<?
-
-/*
- * this is a multiline comment...
- */
-
-for ($j=0; $j<=20; $j++) {
- for ($i[0][0]=0; $i[0][0]<10000; $i[0][0]++) {
- $i[1] += $i[0][0]; // this is a single line comment
- }
-}
-
-/* this is another multi
-line
- comment...******
-/
-*/
-
-print $i[1]."\n";
-
diff --git a/tests/testarray.pl b/tests/testarray.pl
deleted file mode 100644
index 9ec83e184c..0000000000
--- a/tests/testarray.pl
+++ /dev/null
@@ -1,5 +0,0 @@
-for ($i[0][0]=0; $i[0][0]<1000000; $i[0][0]++) {
- $i[1] += $i[0][0];
-}
-
-print $i[1];
diff --git a/tests/testarray2 b/tests/testarray2
deleted file mode 100644
index 91926beaff..0000000000
--- a/tests/testarray2
+++ /dev/null
@@ -1,5 +0,0 @@
-
-<?
-for ($i="aaa"; $i<"bbb\nbbb"; $i++) {
- print $i;
-}
diff --git a/tests/testarray2.pl b/tests/testarray2.pl
deleted file mode 100644
index e72c526d4f..0000000000
--- a/tests/testarray2.pl
+++ /dev/null
@@ -1,3 +0,0 @@
-for ($i="aaa"; $i lt "bbb"; $i++) {
- print "$i\n";
-}
diff --git a/tests/testclassfunc b/tests/testclassfunc
deleted file mode 100644
index 007bf3bd37..0000000000
--- a/tests/testclassfunc
+++ /dev/null
@@ -1,9 +0,0 @@
-<?
-class foo {
- function bar() {
- print "Hey there!\n";
- }
-};
-
-foo::bar();
-
diff --git a/tests/testcom b/tests/testcom
deleted file mode 100644
index 0feb50d1ff..0000000000
--- a/tests/testcom
+++ /dev/null
@@ -1,11 +0,0 @@
-<?
-$word = new COM("word.application") or die("Unable to instanciate Word");
-print "Loaded Word, version {$word->Version}\n";
-$word->Visible = 1;
-$word->Documents->Add();
-$word->Selection->TypeText("This is a test...");
-$word->Quit();
-/*
-$word->Documents[1]->SaveAs("Useless test.doc");
-*/
-?> \ No newline at end of file
diff --git a/tests/testcpdf b/tests/testcpdf
deleted file mode 100644
index a74087d18e..0000000000
--- a/tests/testcpdf
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
- function draw_text($cpdf, $fontname, $size, $x, $y, $text="") {
- cpdf_begin_text($cpdf);
- cpdf_set_font($cpdf, $fontname, $size, 4);
- if($text == "")
- cpdf_text($cpdf, $fontname." ".$size." Point", $x, $y, 1);
- else
- cpdf_text($cpdf, $text, $x, $y, 1);
- cpdf_end_text($cpdf);
- }
-
- $cpdf = cpdf_open(0);
- cpdf_set_Creator($cpdf, "Creator");
- cpdf_set_Title($cpdf, "Title");
- cpdf_set_Subject($cpdf, "Subject");
- cpdf_set_Keywords($cpdf, "Keyword1, Keyword2");
- cpdf_set_viewer_preferences($cpdf, 1);
-
- cpdf_page_init($cpdf, 1, 0, 600, 400, 1);
- $level1 = cpdf_add_outline($cpdf, 0, 0, 1, 1, "Examples");
- $level2a = cpdf_add_outline($cpdf, $level1, 1, 0, 1, "Text");
- draw_text($cpdf, "Helvetica", 18.0, 50, 330);
- draw_text($cpdf, "Helvetica-Bold", 18.0, 50, 310);
- draw_text($cpdf, "Helvetica-Oblique", 18.0, 50, 290);
- draw_text($cpdf, "Helvetica-BoldOblique", 18.0, 50, 270);
- draw_text($cpdf, "Times-Roman", 18.0, 50, 250);
- draw_text($cpdf, "Times-Bold", 18.0, 50, 230);
- draw_text($cpdf, "Times-Italic", 18.0, 50, 210);
- draw_text($cpdf, "Times-BoldItalic", 18.0, 50, 190);
- draw_text($cpdf, "Courier", 18.0, 50, 170);
- draw_text($cpdf, "Courier-Bold", 18.0, 50, 150);
- draw_text($cpdf, "Courier-Oblique", 18.0, 50, 130);
- draw_text($cpdf, "Courier-BoldOblique", 18.0, 50, 110);
- draw_text($cpdf, "Symbol", 18.0, 50, 90);
- draw_text($cpdf, "ZapfDingbats", 18.0, 50, 70);
-
- cpdf_page_init($cpdf, 2, 0, 400, 400, 1);
- $level2b = cpdf_add_outline($cpdf, $level2a, 0, 0, 2, "Annotations, Hyperlinks");
- cpdf_add_annotation($cpdf, 100, 100, 300, 200, "Annotation", "Text of Annotation");
- draw_text($cpdf, "Helvetica", 12.0, 102, 116, "Click here to go to");
- draw_text($cpdf, "Helvetica", 12.0, 102, 103, "http://localhost");
- cpdf_set_action_url($cpdf, 100, 100, 202, 130, "http://localhost");
-
- cpdf_page_init($cpdf, 3, 0, 400, 600, 1);
- $level2c = cpdf_add_outline($cpdf, $level2b, 0, 0, 3, "Drawing");
- cpdf_rect($cpdf, 100, 100, 90, 90, 1);
- cpdf_stroke($cpdf);
- cpdf_rect($cpdf, 200, 100, 90, 90, 1);
- cpdf_fill_stroke($cpdf);
-
- cpdf_setgray_fill($cpdf, 0.5);
- cpdf_circle($cpdf, 140, 250, 35, 1);
- cpdf_stroke($cpdf);
- cpdf_circle($cpdf, 240, 250, 35, 1);
- cpdf_fill_stroke($cpdf);
-
- cpdf_moveto($cpdf, 300, 100, 1);
- cpdf_lineto($cpdf, 350, 100, 1);
- cpdf_curveto($cpdf, 350, 100, 325, 300, 300, 100, 1);
- cpdf_stroke($cpdf);
-
- cpdf_moveto($cpdf, 400, 100, 1);
- cpdf_lineto($cpdf, 450, 100, 1);
- cpdf_curveto($cpdf, 450, 100, 425, 400, 400, 100, 1);
- cpdf_fill_stroke($cpdf);
-
- cpdf_page_init($cpdf, 4, 0, 400, 600, 1);
- $level2d = cpdf_add_outline($cpdf, $level2c, 0, 0, 4, "Images, Clipping");
- cpdf_import_jpeg($cpdf, "figure.jpg", 50, 50, -10.0, 0.0, 300.0, 0.0, 0.0, 1, 1);
- cpdf_save($cpdf);
- cpdf_newpath($cpdf);
- cpdf_moveto($cpdf, 300, 50);
- cpdf_lineto($cpdf, 450, 50, 1);
- cpdf_curveto($cpdf, 450, 100, 375, 300, 300, 100, 1);
- cpdf_closepath($cpdf);
- cpdf_rect($cpdf, 350, 215, 100, 30);
- cpdf_clip($cpdf);
- cpdf_newpath($cpdf); /* needed because clip doesn't consume path */
- draw_text($cpdf, "Helvetica", 18.0, 250, 130);
- cpdf_import_jpeg($cpdf, "figure.jpg", 300, 50, 0.0, 0.0, 300.0, 0.0, 0.0, 0, 1); /* watch for the second last parameter. It is 0 to disable extra gsave/grestore */
- cpdf_restore($cpdf);
-
- cpdf_page_init($cpdf, 5, 0, 400, 400, 1);
- $level2e = cpdf_add_outline($cpdf, $level2d, 0, 0, 5, "GD Image");
-
- $gdimage = imagecreate(100, 100);
- $color = imagecolorallocate($gdimage, 100, 190, 0);
- $black = imagecolorallocate($gdimage, 0, 0, 0);
- imageline($gdimage, 2, 2, 90, 90, $black);
-
- cpdf_place_inline_image($cpdf, $gdimage, 50, 50, 10.0, 150, 50.0, 1, 1);
- imagedestroy($gdimage);
-
- cpdf_finalize($cpdf);
- cpdf_output_buffer($cpdf);
- cpdf_close($cpdf);
-?>
diff --git a/tests/testcpdfclock b/tests/testcpdfclock
deleted file mode 100644
index c885cc8e09..0000000000
--- a/tests/testcpdfclock
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-$pdffilename = "clock.pdf";
-$radius = 200;
-$margin = 20;
-$pagecount = 99;
-
-$pdf = cpdf_open(0);
-cpdf_set_creator($pdf, "pdf_clock.php3");
-cpdf_set_title($pdf, "Analog Clock");
-
-while($pagecount-- > 0) {
- cpdf_page_init($pdf, $pagecount+1, 0, 2 * ($radius + $margin), 2 * ($radius + $margin), 1.0);
-
- cpdf_set_page_animation($pdf, 4, 0.5, 0, 0, 0); /* wipe */
-
- cpdf_translate($pdf, $radius + $margin, $radius + $margin);
- cpdf_save($pdf);
- cpdf_setrgbcolor($pdf, 0.0, 0.0, 1.0);
-
- /* minute strokes */
- cpdf_setlinewidth($pdf, 2.0);
- for ($alpha = 0; $alpha < 360; $alpha += 6)
- {
- cpdf_rotate($pdf, 6.0);
- cpdf_moveto($pdf, $radius, 0.0);
- cpdf_lineto($pdf, $radius-$margin/3, 0.0);
- cpdf_stroke($pdf);
- }
-
- cpdf_restore($pdf);
- cpdf_save($pdf);
-
- /* 5 minute strokes */
- cpdf_setlinewidth($pdf, 3.0);
- for ($alpha = 0; $alpha < 360; $alpha += 30)
- {
- cpdf_rotate($pdf, 30.0);
- cpdf_moveto($pdf, $radius, 0.0);
- cpdf_lineto($pdf, $radius-$margin, 0.0);
- cpdf_stroke($pdf);
- }
-
- $ltime = getdate();
-
- /* draw hour hand */
- cpdf_save($pdf);
- cpdf_rotate($pdf, -(($ltime['minutes']/60.0) + $ltime['hours'] - 3.0) * 30.0);
- cpdf_moveto($pdf, -$radius/10, -$radius/20);
- cpdf_lineto($pdf, $radius/2, 0.0);
- cpdf_lineto($pdf, -$radius/10, $radius/20);
- cpdf_closepath($pdf);
- cpdf_fill($pdf);
- cpdf_restore($pdf);
-
- /* draw minute hand */
- cpdf_save($pdf);
- cpdf_rotate($pdf, -(($ltime['seconds']/60.0) + $ltime['minutes'] - 15.0) * 6.0);
- cpdf_moveto($pdf, -$radius/10, -$radius/20);
- cpdf_lineto($pdf, $radius * 0.8, 0.0);
- cpdf_lineto($pdf, -$radius/10, $radius/20);
- cpdf_closepath($pdf);
- cpdf_fill($pdf);
- cpdf_restore($pdf);
-
- /* draw second hand */
- cpdf_setrgbcolor($pdf, 1.0, 0.0, 0.0);
- cpdf_setlinewidth($pdf, 2);
- cpdf_save($pdf);
- cpdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0));
- cpdf_moveto($pdf, -$radius/5, 0.0);
- cpdf_lineto($pdf, $radius, 0.0);
- cpdf_stroke($pdf);
- cpdf_restore($pdf);
-
- /* draw little circle at center */
- cpdf_circle($pdf, 0, 0, $radius/30);
- cpdf_fill($pdf);
-
- cpdf_restore($pdf);
-
- cpdf_finalize_page($pdf, $pagecount+1);
-}
-
-cpdf_finalize($pdf);
-cpdf_save_to_file($pdf, $pdffilename);
-$pdf = cpdf_close($pdf);
-?>
diff --git a/tests/testdom b/tests/testdom
deleted file mode 100644
index c7012e0e3c..0000000000
--- a/tests/testdom
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-$xmlstr = "<?xml version='1.0' standalone='yes'?>
-<!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd'
-[ <!ENTITY sp \"spanish\">
-]>
-<!-- lsfj -->
-<chapter language='en'><title language='en'>Title</title>
-<para language='ge'>
-&sp;
-<!-- comment -->
-<informaltable language='&sp;kkk'>
-<tgroup cols='3'>
-<tbody>
-<row><entry>a1</entry><entry morerows='1'>b1</entry><entry>c1</entry></row>
-<row><entry>a2</entry><entry>c2</entry></row>
-<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row>
-</tbody>
-</tgroup>
-</informaltable>
-</para>
-</chapter> ";
-
-echo "Test 1: accessing single nodes from php\n";
-$dom = xmldoc($xmlstr);
-if(!$dom) {
- echo "Error while parsing the document\n";
- exit;
-}
-
-$children = $dom->childNodes();
-print_r($children);
-
-echo "--------- root\n";
-$rootnode = $dom->documentElement();
-print_r($rootnode);
-
-echo "--------- children of root\n";
-$children = $rootnode->childNodes();
-print_r($children);
-
-// The last node should be identical with the last entry in the children array
-echo "--------- last\n";
-$last = $rootnode->lastChild();
-print_r($last);
-
-// The parent of this last node is the root again
-echo "--------- parent\n";
-$parent = $last->parent();
-print_r($parent);
-
-// The children of this parent are the same children as one above
-echo "--------- children of parent\n";
-$children = $parent->childNodes();
-print_r($children);
-
-echo "--------- creating a new attribute\n";
-$attr = $dom->createAttribute("src", "picture.gif");
-print_r($attr);
-
-$rootnode->setAttributeNode($attr); /* Not implemented */
-$attr = $rootnode->setAttribute("src", "picture.gif");
-$attr = $rootnode->getAttribute("src");
-print_r($attr);
-
-echo "--------- attribute of rootnode\n";
-$attrs = $rootnode->attributes();
-print_r($attrs);
-
-echo "--------- children of an attribute\n";
-$children = $attrs[0]->childNodes();
-print_r($children);
-
-?>
diff --git a/tests/testfe b/tests/testfe
deleted file mode 100644
index ea62760635..0000000000
--- a/tests/testfe
+++ /dev/null
@@ -1,18 +0,0 @@
-<?
-$foo = array(7,"foo",3,array(1,2),4);
-
-for ($i=0; $i<3; $i++):
-
-foreach($a, $foo ) {
- if (gettype($a)=="array") {
- print "Array:\n";
- foreach($b, $a) {
- print "\t$b\n";
- }
- print "End of array.\n";
- } else {
- print "$a\n";
- }
-// print "$a\n";
-}
-endfor;
diff --git a/tests/testfunc b/tests/testfunc
deleted file mode 100644
index fa64be2e6f..0000000000
--- a/tests/testfunc
+++ /dev/null
@@ -1,33 +0,0 @@
-<?
-function foo()
-{
- $i=0;
-
- if ($i) {
- $a = "zeev";
- } else {
- $b = "andi";
- }
-}
-
-function bar()
-{
- foo();
-}
-
-for ($i=0; $i<10; $i++) {
- bar();
-}
-
-
-for ($i=0; $i<10; $i++) {
- bar();
-}
-
-print "Got here.....
-
-";
-
-$a = 7;
-$a = 5;
-print "Got here....\n\n";
diff --git a/tests/testfunc.pl b/tests/testfunc.pl
deleted file mode 100644
index 87864866ff..0000000000
--- a/tests/testfunc.pl
+++ /dev/null
@@ -1,20 +0,0 @@
-sub foo()
-{
- my $i=0;
-
- if ($i) {
- my $a = "zeev";
- } else {
- my $b = "andi";
- }
-}
-
-
-sub bar()
-{
- foo();
-}
-
-for ($i=0; $i<1000000; $i++) {
- bar();
-}
diff --git a/tests/testfunc2 b/tests/testfunc2
deleted file mode 100644
index 42f91f2bae..0000000000
--- a/tests/testfunc2
+++ /dev/null
@@ -1,19 +0,0 @@
-<?
-function foo($i)
-{
- if ($i) {
- $a = "zeev";
- } else {
- $b = "andi";
- }
-}
-
-
-function bar($a)
-{
- foo($a);
-}
-
-for ($i=0; $i<10000; $i=$i+1) {
- bar($i);
-}
diff --git a/tests/testfunc2.pl b/tests/testfunc2.pl
deleted file mode 100644
index 7eeaf92ffb..0000000000
--- a/tests/testfunc2.pl
+++ /dev/null
@@ -1,22 +0,0 @@
-sub foo
-{
- my $i = shift(@_);
-
- if ($i) {
- my $a = "zeev";
- } else {
- my $b = "andi";
- }
-}
-
-
-sub bar
-{
- my $i = shift(@_);
-
- foo($i);
-}
-
-for ($i=0; $i<1000000; $i=$i+1) {
- bar($i);
-}
diff --git a/tests/testfuncref b/tests/testfuncref
deleted file mode 100644
index 217e4d14e0..0000000000
--- a/tests/testfuncref
+++ /dev/null
@@ -1,10 +0,0 @@
-<?
-
-function foobar()
-{
- print "foobar\n";
-}
-
-$foobar = "foobar";
-
-$a = ${"foo"."bar"}();
diff --git a/tests/testhyperwave b/tests/testhyperwave
deleted file mode 100644
index 28bc19d2f9..0000000000
--- a/tests/testhyperwave
+++ /dev/null
@@ -1,235 +0,0 @@
-<?
- $id = 188178; // A plain/text document
- $collid = 169828; // A collection
- $query = "Name=m*"; // Search query for test_9
- $host = "gehtnix";
- $username = "annonymous";
- $password = "";
-
- $connect = hw_connect($host, 418, $username, $password);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
-
- // Set all test to 'yes' if they shall be executed
- $test_1 = "no"; // Get the text document with id $id and output it
- $test_2 = "no"; // Check if id $id is in $collid
- $test_3 = "no"; // Convert object record to object array and back
- $test_4 = "no"; // Get object record of object with id $id
- $test_5 = "no"; // List children of $collid
- $test_6 = "no"; // List parents of $id
- $test_7 = "no"; // Insert a new text document
- $test_8 = "no"; // Remove the just inserted text document
- $test_9 = "no"; // Searching for objects with Name $query
- $test_10= "no"; // Listing all anchors of a document
- $test_11= "no"; // Creates document from file and outputs it.
- $test_12= "yes"; // Creates document from file and outputs it.
-
- /* Lists an object array
- */
- function list_attr($attributes) {
-// var_dump($attributes);
-// return;
- for($i=0; $i<count($attributes); $i++) {
- $key = key($attributes);
- switch($key) {
- case "Title":
- case "Description":
- $title_arr = $attributes[$key];
- $cj = count($title_arr);
- printf("%s = ", $key);
- for($j=0; $j<$cj; $j++) {
- $tkey = key($title_arr);
- switch($tkey) {
- case "en":
- $flagfile = "english.gif";
- break;
- case "ge":
- $flagfile = "german.gif";
- break;
- case "du":
- $flagfile = "dutch.gif";
- break;
- default:
- $flagfile = "europe.gif";
- }
- printf("%s:%s; ", $tkey, $title_arr[$tkey]);
-
- next($title_arr);
- }
- printf("\n");
- break;
- default:
- if(is_array($attributes[$key])) {
- $group_arr = $attributes[$key];
- $cj = count($group_arr);
- for($j=0; $j<$cj; $j++) {
- printf("%s = %s\n", $key, $group_arr[$j]);
- next($group_arr);
- }
- } else {
- printf("%s = %s\n", $key, $attributes[$key]);
- }
-
- }
- next($attributes);
- }
- echo "\n";
- }
-
- // Here come the tests
- if($test_1 == "yes") {
- echo "TEST 1 ----------------------------------------------\n";
- echo "Get the text document with id 0x".dechex($id)."\n";
- $doc = hw_gettext($connect, $id);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- hw_output_document($doc);
- echo "\n";
- }
-
- if($test_2 == "yes") {
- echo "TEST 2 ----------------------------------------------\n";
- echo "Checking if '$id' (0x".dechex($id).") is in collection '$collid (0x".dechex($collid).")'\n";
- $incoll = hw_incollections($connect, array($id), array($collid), 0);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- for($i=0; $i<count($incoll); $i++)
- echo $incoll[$i]."\n";
- }
-
- if($test_3 == "yes") {
- echo "TEST 3 ----------------------------------------------\n";
- echo "Convert an object array into an object record\n";
- $objrec = hw_array2objrec(array("Title"=>"ge:Hier der Titel", "Author"=>"Hier der Autor"));
- echo $objrec."\n";
- $objrec .= "\nTitle=en:Here the title";
- echo "Add another title and convert it back to an object array\n";
- $objarr = hw_objrec2array($objrec);
- list_attr($objarr);
- }
-
- if($test_4 == "yes") {
- echo "TEST 4 ----------------------------------------------\n";
- echo "Get the object array of document with id 0x".dechex($id)."\n";
- $objrec = hw_getobject($connect, $id);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- $objarr = hw_objrec2array($objrec);
- list_attr($objarr);
- }
-
- if($test_5 == "yes") {
- echo "TEST 5 ----------------------------------------------\n";
- echo "List the children of collection 0x".dechex($collid)."\n";
- $children = hw_childrenobj($connect, $collid);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- $c_children = count($children) - 1;
- for($i=0; $i<$c_children; $i++) {
- $objarr = hw_objrec2array($children[$i]);
- list_attr($objarr);
- }
- list_attr($children[$c_children]);
- }
-
- if($test_6 == "yes") {
- echo "TEST 6 ----------------------------------------------\n";
- echo "List the parents of object 0x".dechex($id)."\n";
- $parents = hw_getparentsobj($connect, $collid);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- $c_parents = count($parents) - 1;
- for($i=0; $i<$c_parents; $i++) {
- $objarr = hw_objrec2array($parents[$i]);
- list_attr($objarr);
- }
- list_attr($parents[$c_parents]);
- }
-
- if($test_7 == "yes") {
- echo "TEST 7 ----------------------------------------------\n";
- echo "Inserting a new text document into 0x".dechex($collid)."\n";
- $objrec = "Type=Document\nDocumentType=text\nName=HWTest\nTitle=en:Component\nMimeType=text/plain\nAuthor=".$username;
- $contents = "Ein bischen Text";
- $doc = hw_new_document($objrec, $contents, strlen($contents)+1);
- $objid = hw_insertdocument($connect, $collid, $doc);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- $objrec = hw_getobject($connect, $objid);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- $objarr = hw_objrec2array($objrec);
- list_attr($objarr);
- }
-
- if($test_8 == "yes") {
- echo "TEST 8 ----------------------------------------------\n";
- echo "Removing text document just inserted\n";
- $kk[0] = (int) $objid;
- hw_mv($connect, $kk, $collid, 0);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- echo "If the document was really deleted you should see an error now\n";
- $objrec = hw_getobject($connect, $objid);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- } else {
- $objarr = hw_objrec2array($objrec);
- list_attr($objarr);
- }
- }
-
- if($test_9 == "yes") {
- echo "TEST 9 ----------------------------------------------\n";
- echo "Searching for objects with $query\n";
- $objrecs = hw_getobjectbyqueryobj($connect, $query, -1);
- $c_objrecs = count($objrecs) - 1;
- echo "$c_objrecs found\n";
- for($i=0; $i<$c_objrecs; $i++) {
- $objarr = hw_objrec2array($objrecs[$i]);
- list_attr($objarr);
- }
- list_attr($objrecs[$c_objrecs]);
- }
-
- if($test_10 == "yes") {
- $anchors = hw_getanchorsobj($connect, $id);
- $countanchors = count($anchors) - 1;
- echo "$countanchors Anchors of Object $id\n";
- for($i=0; $i<$countanchors; $i++) {
- $arr = hw_objrec2array($anchors[$i]);
- list_attr($arr);
- }
- }
-
- if($test_11 == "yes") {
- $doc = hw_new_document_from_file("ObjectRecord", "hw_document.txt");
- hw_output_document($doc);
- }
-
- if($test_12 == "yes") {
- $doc = hw_new_document_from_file("ObjectRecord", "hw_document.txt");
- hw_insertanchors($doc, array("Position=0x2 0x7\nObjectID=0x3\nTAnchor=Src\nDest=0x5"), array("ObjectID=0x5\nName=DestDoc"));
- hw_output_document($doc);
- }
-
- hw_close($connect);
-?>
diff --git a/tests/testinclude b/tests/testinclude
deleted file mode 100644
index 1e9854370d..0000000000
--- a/tests/testinclude
+++ /dev/null
@@ -1,5 +0,0 @@
-<?
-print "Before include....\n";
-$retval = include("testarray");
-print "After include, include returned $retval\n";
-?>
diff --git a/tests/testobj b/tests/testobj
deleted file mode 100644
index 66b003ce9c..0000000000
--- a/tests/testobj
+++ /dev/null
@@ -1,29 +0,0 @@
-<?
-define("endl","\n");
-
-class foobar {
- function foobar() {
- $this->initialized = 1;
- }
-};
-
-class barbara extends foobar {
-
-};
-
-$name = "foobar";
-$foo = new $name; // or die("Unable to construct foobar\n");
-//print $foo->initialized;
-
-$boo = new barbara;
-print get_class($foo).endl;
-print get_parent_class($foo).endl;
-print get_class($boo).endl;
-print get_parent_class($boo).endl;
-print method_exists($foo,"foobar").endl;
-print method_exists($boo,"foobar").endl;
-print method_exists($boo,"barbara").endl;
-//$word = new COm("word.application");
-//$word->visible = true;
-//sleep(5);
-//$word->quit();
diff --git a/tests/testpfpro.php b/tests/testpfpro.php
deleted file mode 100644
index ffb1784bdc..0000000000
--- a/tests/testpfpro.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?
-
-if (!extension_loaded('pfpro')) {
- die("pfpro module is not compiled in PHP\n");
-}
-
-echo "<pre>\n\n";
-
-echo "Payflow Pro library is version ".pfpro_version()."\n";
-
-pfpro_init();
-
-$transaction = array(USER => 'mylogin',
- PWD => 'mypassword',
- TRXTYPE => 'S',
- TENDER => 'C',
- AMT => 1.50,
- ACCT => '4111111111111111',
- EXPDATE => '0900'
- );
-
-$response = pfpro_process($transaction);
-
-if (!$response) {
- die("Couldn't establish link to signio software.\n");
-}
-
-echo "Signio response code was ".$response[RESULT];
-echo ", which means: ".$response[RESPMSG]."\n";
-
-echo "\nDump of the transaction request ";
-print_r($transaction);
-
-echo "\nDump of the response ";
-print_r($response);
-
-pfpro_cleanup();
-
-?>
diff --git a/tests/tests.dsp b/tests/tests.dsp
deleted file mode 100644
index fc19dcfe43..0000000000
--- a/tests/tests.dsp
+++ /dev/null
@@ -1,61 +0,0 @@
-# Microsoft Developer Studio Project File - Name="tests" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) External Target" 0x0106
-
-CFG=tests - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "tests.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "tests.mak" CFG="tests - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "tests - Win32 Debug" (based on "Win32 (x86) External Target")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "."
-# PROP BASE Intermediate_Dir "."
-# PROP BASE Cmd_Line "NMAKE /f tests.mak"
-# PROP BASE Rebuild_Opt "/a"
-# PROP BASE Target_File "tests.exe"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "."
-# PROP Intermediate_Dir "."
-# PROP Cmd_Line "nmake /nologo /f tests.mak"
-# PROP Rebuild_Opt "/a"
-# PROP Target_File "__test_run_complete__"
-# PROP Bsc_Name ""
-# PROP Target_Dir ""
-# Begin Target
-
-# Name "tests - Win32 Debug"
-
-!IF "$(CFG)" == "tests - Win32 Debug"
-
-!ENDIF
-
-# Begin Source File
-
-SOURCE="..\run-tests.php"
-# End Source File
-# Begin Source File
-
-SOURCE=.\tests.mak
-# End Source File
-# End Target
-# End Project
diff --git a/tests/tests.mak b/tests/tests.mak
deleted file mode 100644
index 8b47143544..0000000000
--- a/tests/tests.mak
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Win32 Makefile to run the PHP unit tests.
-#
-# TEST_PHP_EXECUTABLE
-# Required - must point to the PHP executable to test.
-#
-# TEST_PHP_ERROR_STYLE
-# Optional - specifies error format to output so IDE can jump to test source and log.
-# Values: MSVC (Microsoft Visual C++), Emacs
-#
-# TEST_PHP_DETAILED
-# Optional - generates a more complete and detailed log if set.
-# Values: 0 or unset - no details; 1 - detailed.
-#
-
-all : run-tests
-
-BIN=Debug_TS
-
-# Specific test(s) to run (all if not specified).
-TESTS=
-
-run-tests :
- set TEST_PHP_EXECUTABLE=$(BIN)\php-cgi.exe
- set TEST_PHP_ERROR_STYLE=MSVC
- set TEST_PHP_DETAILED=0
- cd .. && $(BIN)\php-cgi.exe -c tests -f run-tests.php $(TESTS) | tee tests.log
diff --git a/tests/testscanf.php b/tests/testscanf.php
deleted file mode 100644
index ad530978c5..0000000000
--- a/tests/testscanf.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-
-
-function print_value($val,$postfix="<br>") {
- if (is_array($val)) {
- for ($i = 0;$i< count($val);$i++) {
- echo $val[$i] . $postfix;
- }
- } else {
- echo $val . $postfix;
- }
-}
-
-function do_sscanf($string, $format) {
- $s = "sscanf(\"" . $string . ",\"" . $format ."\").";
- echo "$s<br>";
- $s = str_repeat("-", strlen($s));
- echo "$s<br>";
- $output = sscanf($string,$format);
- echo "Result : ";
- print_value( $output );
- echo "$s<br><br>";
-}
-
-
-function run_sscanf_test_cases($filename="scan_cases")
-{
-
- echo "<h3><em><br>Running Test Cases from $filename<br></em></h3>";
- $arr = file($filename);
- for ($i=0;$i < count($arr);$i++) {
- $line_arr = explode("|",$arr[$i]);
-
- $format = $line_arr[0];
- $string = $line_arr[1];
- if (count($arr) > 2) {
- $comment = $line_arr[2];
- } else {
- $comment = "";
- }
- if ( empty($format) || empty($string) ) {
- continue;
- }
- print("<h4>** Case : $comment ******************************</h4>");
- do_sscanf($string,$format);
- }
-}
-
-function simple_tests() {
- echo "Testing sscanf with standard ANSI syntax (values returned by
-reference)-<br>";
- $decimal = -1;
- $string = "";
- $hex = 0;
- $float = 0.0;
- $octal = 0.0;
- $int = -1;
-
- echo "<h3><em><br>Simple Test<br></em></h3>";
- echo "sscanf('10','%d',&\$decimal) <br>";
- echo "<br>BEFORE : <br> decimal = $decimal.";
- $foo = sscanf("10","%d",&$decimal);
- echo "<br>AFTER : <br> decimal = $decimal <br>";
-
-
- echo "<h3><em><br>Simple Test 2<br></em></h3>";
- echo "sscanf(\"ghost 0xface\",\"%s %x\",&\$string, &\$int)<br>";
- echo "<br>BEFORE : <br> string = $string, int = $int<br>";
- $foo = sscanf("ghost 0xface","%s %x",&$string, &$int);
- echo "<br>AFTER : <br> string = $string, int = $int<br>";
- echo " sscan reports : ";
- print_value( $foo,"");
- echo " conversions <br>";
-
- echo "<h3><em><br>Multiple specifiers<br></em></h3>";
- echo "sscanf(\"jabberwocky 1024 0xFF 1.024 644 10\",
- \"%s %d %x %f %o %i\",
- &\$string,&\$decimal,&\$hex,&\$float,&\$octal,&\$int);<br>";
- echo "<br>BEFORE : <br>";
- echo "Decimal = $decimal, String = $string, Hex = $hex<br>";
- echo "Octal = $octal , Float = $float, Int = $int<br>";
- $foo = sscanf( "jabberwocky 1024 0xFF 1.024 644 10",
- "%s %d %x %f %o %i",
- &$string,&$decimal,&$hex,&$float,&$octal,&$int);
- echo "<br>AFTER :<br>";
- echo "decimal = $decimal, string = $string, hex = $hex<br>";
- echo "octal = $octal , float = $float, int = $int<br>";
-
- echo " sscan reports : ";
- print_value( $foo,"");
- echo " conversions <br>";
- echo "----------------------------------------<br>";
-}
-
-
-
-?>
-<html>
- <head>
- <title>Test of sscanf()</title>
- </head>
- <body>
- <strong><h1>Testing sscanf() support in PHP</h1></strong><br>
- <?php
- if (!function_exists('sscanf')) {
- echo "<strong>I'm sorry but sscanf() does not exist !i</strong><br>";
- } else {
- simple_tests();
- run_sscanf_test_cases();
- }
- ?>
- </body>
-</html>
diff --git a/tests/testswf b/tests/testswf
deleted file mode 100644
index e26733237d..0000000000
--- a/tests/testswf
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-
-$LINEID=1;
-$LINEDEPTH=50;
-$LINESTEPS=30;
-
-$CIRCLEID=2;
-$CIRCLEDEPT=100;
-
-/* stop playing */
-function stop()
-{
- swf_startdoaction();
- swf_actionStop();
- swf_enddoaction();
-}
-
-/* play stoping */
-function play()
-{
- swf_startdoaction();
- swf_actionPlay();
- swf_enddoaction();
-}
-
-/*
- * demonstrates:
- * defining and placing an object.
- *
- */
-function flipline()
-{
- global $LINESTEPS, $LINEID, $LINEDEPTH;
-
- swf_ortho2(-100.0,100.0,-100.0,100.0);
- swf_defineline($LINEID,-60.0,0.0,60.0,0.0,1.2);
- swf_mulcolor(1.0,1.0,1.0,1.0);
- swf_addcolor(0.0,0.0,0.0,0.0);
- for($i=0; $i<$LINESTEPS; $i++) {
- $p = $i/($LINESTEPS-1.0);
- swf_pushmatrix();
- swf_rotate(60.0*$p,'z');
- swf_translate(20.0+20.0*$p,0.0,0.0);
- swf_rotate(120.0*$p,'z');
- swf_placeobject($LINEID, $LINEDEPTH);
- swf_popmatrix();
- swf_showframe();
- }
- for($i=0; $i<$LINESTEPS; $i++) {
- swf_removeobject($LINEDEPTH);
- if(($i%4) == 0)
- swf_showframe();
- }
- swf_showframe();
-}
-
-/* growblobs follows */
-
-$NBLOBS=8;
-$BLOBSTEPS=20;
-
-/*
- * demonstrates:
- * shape definition
- * placing, and modifying objects.
- *
- */
-function growblobs()
-{
- global $NBLOBS, $BLOBSTEPS, $CIRCLEDEPT, $CIRCLEID;
-
- swf_ortho2(-200.0,200.0,-200.0,200.0);
-
- swf_startshape($CIRCLEID);
- swf_shapefillsolid(0.0,0.0,0.0,1.0);
- swf_shapearc(0.0,0.0,300.0,0.0,360.0);
- swf_endshape();
-
- swf_mulcolor(1.0,1.0,1.0,1.0);
- $startframe = swf_getframe();
- for($j=0; $j<$NBLOBS; $j++) {
- swf_setframe($startframe+2*$j);
- for($i=0; $i<$BLOBSTEPS; $i++) {
- $p = $i/($BLOBSTEPS-1.0);
- swf_pushmatrix();
- swf_scale($p,$p,$p);
- swf_addcolor($p,$p,$p,0.0);
- if($i== 0)
- swf_placeobject($CIRCLEID,$CIRCLEDEPTH+$j);
- else
- swf_modifyobject($CIRCLEDEPTH+$j,MOD_COLOR|MOD_MATRIX);
- swf_popmatrix();
- swf_showframe();
- }
- swf_removeobject($CIRCLEDEPTH+$j);
- }
- swf_showframe();
-}
-
-swf_openfile("test.swf",400.0,400.0,20.0,1.0,1.0,1.0);
-flipline();
-growblobs();
-
-// trytext();
-// makebuttons();
-// stop();
-swf_showframe();
-swf_closefile();
-
-// swf_openfile("images.swf",400.0,400.0,20.0,1.0,1.0,1.0);
-// showimages();
-// brushstrokes();
-// symboltest();
-// stop();
-// swf_showframe();
-// swf_closefile();
-// fprintf(stderr,"wrote images.swf\n");
- exit(0);
-
-?>
diff --git a/win32/crypt_win32.c b/win32/crypt_win32.c
deleted file mode 100644
index 56a0c65836..0000000000
--- a/win32/crypt_win32.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* This code is distributed under the PHP license with permission from
- the author Jochen Obalek <jochen.obalek@bigfoot.de> */
-
-/* encrypt.c - providing 56 bit DES encryption
- Copyright (C) 1991 Jochen Obalek
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <time.h>
-#include <string.h>
-#include <stdlib.h>
-#include "md5crypt.h"
-
-#define BS 64
-#define BS2 32
-#define KS 48
-#define KS2 24
-#define IS 56
-#define IS2 28
-
-static char schluessel[16][KS];
-
-
-static char PC1[] =
-{
- 56, 48, 40, 32, 24, 16, 8, 0,
- 57, 49, 41, 33, 25, 17, 9, 1,
- 58, 50, 42, 34, 26, 18, 10, 2,
- 59, 51, 43, 35,
- 62, 54, 46, 38, 30, 22, 14, 6,
- 61, 53, 45, 37, 29, 21, 13, 5,
- 60, 52, 44, 36, 28, 20, 12, 4,
- 27, 19, 11, 3
-};
-
-
-static char PC2[] =
-{
- 13, 16, 10, 23, 0, 4, 2, 27,
- 14, 5, 20, 9, 22, 18, 11, 3,
- 25, 7, 15, 6, 26, 19, 12, 1,
- 40, 51, 30, 36, 46, 54, 29, 39,
- 50, 44, 32, 47, 43, 48, 38, 55,
- 33, 52, 45, 41, 49, 35, 28, 31
-};
-
-
-static char IP[] =
-{
- 57, 49, 41, 33, 25, 17, 9, 1,
- 59, 51, 43, 35, 27, 19, 11, 3,
- 61, 53, 45, 37, 29, 21, 13, 5,
- 63, 55, 47, 39, 31, 23, 15, 7,
- 56, 48, 40, 32, 24, 16, 8, 0,
- 58, 50, 42, 34, 26, 18, 10, 2,
- 60, 52, 44, 36, 28, 20, 12, 4,
- 62, 54, 46, 38, 30, 22, 14, 6
-};
-
-
-static char EP[] =
-{
- 7, 39, 15, 47, 23, 55, 31, 63,
- 6, 38, 14, 46, 22, 54, 30, 62,
- 5, 37, 13, 45, 21, 53, 29, 61,
- 4, 36, 12, 44, 20, 52, 28, 60,
- 3, 35, 11, 43, 19, 51, 27, 59,
- 2, 34, 10, 42, 18, 50, 26, 58,
- 1, 33, 9, 41, 17, 49, 25, 57,
- 0, 32, 8, 40, 16, 48, 24, 56
-};
-
-
-static char E0[] =
-{
- 31, 0, 1, 2, 3, 4, 3, 4,
- 5, 6, 7, 8, 7, 8, 9, 10,
- 11, 12, 11, 12, 13, 14, 15, 16,
- 15, 16, 17, 18, 19, 20, 19, 20,
- 21, 22, 23, 24, 23, 24, 25, 26,
- 27, 28, 27, 28, 29, 30, 31, 0
-};
-
-
-static char E[KS];
-
-
-static char PERM[] =
-{
- 15, 6, 19, 20, 28, 11, 27, 16,
- 0, 14, 22, 25, 4, 17, 30, 9,
- 1, 7, 23, 13, 31, 26, 2, 8,
- 18, 12, 29, 5, 21, 10, 3, 24
-};
-
-
-static char S_BOX[][64] =
-{
- {
- 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1,
- 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8,
- 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7,
- 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13
- },
- {
- 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14,
- 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5,
- 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2,
- 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9
- },
- {
- 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10,
- 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1,
- 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7,
- 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12
- },
- {
- 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3,
- 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9,
- 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8,
- 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14
- },
- {
- 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1,
- 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6,
- 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13,
- 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3
- },
- {
- 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5,
- 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8,
- 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10,
- 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13
- },
- {
- 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10,
- 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6,
- 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7,
- 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12
- },
- {
- 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4,
- 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2,
- 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13,
- 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11
- }
-};
-
-static void
-perm (a, e, pc, n)
- register char *a, *e;
- register char *pc;
- int n;
-{
- for (; n--; pc++, a++)
- *a = e[*pc];
-}
-
-static void
-crypt_main (nachr_l, nachr_r, schl)
- register char *nachr_l, *nachr_r;
- register char *schl;
-{
- char tmp[KS];
- register int sbval;
- register char *tp = tmp;
- register char *e = E;
- register int i, j;
-
- for (i = 0; i < 8; i++)
- {
- for (j = 0, sbval = 0; j < 6; j++)
- sbval = (sbval << 1) | (nachr_r[*e++] ^ *schl++);
- sbval = S_BOX[i][sbval];
- for (tp += 4, j = 4; j--; sbval >>= 1)
- *--tp = sbval & 1;
- tp += 4;
- }
-
- e = PERM;
- for (i = 0; i < BS2; i++)
- *nachr_l++ ^= tmp[*e++];
-}
-
-void
-encrypt (char *nachr, int decr)
-{
- char (*schl)[KS] = decr ? schluessel + 15 : schluessel;
- char tmp[BS];
- int i;
-
- perm (tmp, nachr, IP, BS);
-
- for (i = 8; i--;)
- {
- crypt_main (tmp, tmp + BS2, *schl);
- if (decr)
- schl--;
- else
- schl++;
- crypt_main (tmp + BS2, tmp, *schl);
- if (decr)
- schl--;
- else
- schl++;
- }
-
- perm (nachr, tmp, EP, BS);
-}
-
-void
-setkey (char *schl)
-{
- char tmp1[IS];
- register unsigned int ls = 0x7efc;
- register int i, j, k;
- register int shval = 0;
- register char *akt_schl;
-
- memcpy (E, E0, KS);
- perm (tmp1, schl, PC1, IS);
-
- for (i = 0; i < 16; i++)
- {
- shval += 1 + (ls & 1);
- akt_schl = schluessel[i];
- for (j = 0; j < KS; j++)
- {
- if ((k = PC2[j]) >= IS2)
- {
- if ((k += shval) >= IS)
- k = (k - IS2) % IS2 + IS2;
- }
- else if ((k += shval) >= IS2)
- k %= IS2;
- *akt_schl++ = tmp1[k];
- }
- ls >>= 1;
- }
-}
-
-char *
-des_crypt (const char *wort, const char *salt)
-{
- static char retkey[14];
- char key[BS + 2];
- char *k;
- int tmp, keybyte;
- int i, j;
-
- memset (key, 0, BS + 2);
-
- for (k = key, i = 0; i < BS; i++)
- {
- if (!(keybyte = *wort++))
- break;
- k += 7;
- for (j = 0; j < 7; j++, i++)
- {
- *--k = keybyte & 1;
- keybyte >>= 1;
- }
- k += 8;
- }
-
- setkey (key);
- memset (key, 0, BS + 2);
-
- for (k = E, i = 0; i < 2; i++)
- {
- retkey[i] = keybyte = *salt++;
- if (keybyte > 'Z')
- keybyte -= 'a' - 'Z' - 1;
- if (keybyte > '9')
- keybyte -= 'A' - '9' - 1;
- keybyte -= '.';
-
- for (j = 0; j < 6; j++, keybyte >>= 1, k++)
- {
- if (!(keybyte & 1))
- continue;
- tmp = *k;
- *k = k[24];
- k[24] = tmp;
- }
- }
-
- for (i = 0; i < 25; i++)
- encrypt (key, 0);
-
- for (k = key, i = 0; i < 11; i++)
- {
- for (j = keybyte = 0; j < 6; j++)
- {
- keybyte <<= 1;
- keybyte |= *k++;
- }
-
- keybyte += '.';
- if (keybyte > '9')
- keybyte += 'A' - '9' - 1;
- if (keybyte > 'Z')
- keybyte += 'a' - 'Z' - 1;
- retkey[i + 2] = keybyte;
- }
-
- retkey[i + 2] = 0;
-
- if (!retkey[1])
- retkey[1] = *retkey;
-
- return retkey;
-}
-
-char *
-crypt (const char *pw, const char *salt)
-{
- if (strlen(salt)>MD5_MAGIC_LEN && strncmp(salt, MD5_MAGIC, MD5_MAGIC_LEN)==0) {
- return md5_crypt(pw, salt);
- } else {
- return des_crypt(pw, salt);
- }
-}
diff --git a/win32/crypt_win32.h b/win32/crypt_win32.h
deleted file mode 100644
index e75d4238cf..0000000000
--- a/win32/crypt_win32.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* This code is distributed under the PHP license with permission from
- the author Jochen Obalek <jochen.obalek@bigfoot.de> */
-
-/* encrypt.h - API to 56 bit DES encryption via calls
- encrypt(3), setkey(3) and crypt(3)
- Copyright (C) 1991 Jochen Obalek
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef _ENCRYPT_H_
-#define _ENCRYPT_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include <_ansi.h>
-
-void _EXFUN(encrypt, (char *block, int edflag));
-void _EXFUN(setkey, (char *key));
-char * _EXFUN(crypt, (const char *key, const char *salt));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ENCRYPT_H_ */
diff --git a/win32/flock.c b/win32/flock.c
deleted file mode 100644
index cc9d409784..0000000000
--- a/win32/flock.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Program: Unix compatibility routines
- *
- * Author: Mark Crispin
- * Networks and Distributed Computing
- * Computing & Communications
- * University of Washington
- * Administration Building, AG-44
- * Seattle, WA 98195
- * Internet: MRC@CAC.Washington.EDU
- *
- * Date: 14 September 1996
- * Last Edited: 14 August 1997
- *
- * Copyright 1997 by the University of Washington
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appears in all copies and that both the
- * above copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the University of Washington not be
- * used in advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. This software is made available
- * "as is", and
- * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
- * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
- * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
- * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-
-/* DEDICATION
-
- * This file is dedicated to my dog, Unix, also known as Yun-chan and
- * Unix J. Terwilliker Jehosophat Aloysius Monstrosity Animal Beast. Unix
- * passed away at the age of 11 1/2 on September 14, 1996, 12:18 PM PDT, after
- * a two-month bout with cirrhosis of the liver.
- *
- * He was a dear friend, and I miss him terribly.
- *
- * Lift a leg, Yunie. Luv ya forever!!!!
- */
-
-#include <windows.h>
-#include <io.h>
-#include <errno.h>
-#include "flock.h"
-
-int flock(int fd, int op)
-{
- HANDLE hdl = (HANDLE) _get_osfhandle(fd);
- DWORD low = 1, high = 0;
- OVERLAPPED offset =
- {0, 0, 0, 0, NULL};
- if (hdl < 0)
- return -1; /* error in file descriptor */
- /* bug for bug compatible with Unix */
- UnlockFileEx(hdl, 0, low, high, &offset);
- switch (op & ~LOCK_NB) { /* translate to LockFileEx() op */
- case LOCK_EX: /* exclusive */
- if (LockFileEx(hdl, LOCKFILE_EXCLUSIVE_LOCK +
- ((op & LOCK_NB) ? LOCKFILE_FAIL_IMMEDIATELY : 0),
- 0, low, high, &offset))
- return 0;
- break;
- case LOCK_SH: /* shared */
- if (LockFileEx(hdl, ((op & LOCK_NB) ? LOCKFILE_FAIL_IMMEDIATELY : 0),
- 0, low, high, &offset))
- return 0;
- break;
- case LOCK_UN: /* unlock */
- return 0; /* always succeeds */
- default: /* default */
- break;
- }
- errno = EINVAL; /* bad call */
- return -1;
-}
diff --git a/win32/flock.h b/win32/flock.h
deleted file mode 100644
index fe07adf954..0000000000
--- a/win32/flock.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#define fsync _commit
-#define ftruncate chsize
-
-/* For flock() emulation */
-
-#define LOCK_SH 1
-#define LOCK_EX 2
-#define LOCK_NB 4
-#define LOCK_UN 8
-
-extern int flock(int fd, int op);
diff --git a/win32/glob.c b/win32/glob.c
deleted file mode 100644
index c6a29e1c9c..0000000000
--- a/win32/glob.c
+++ /dev/null
@@ -1,922 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Guido van Rossum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* $Id$ */
-
-/*
- * glob(3) -- a superset of the one defined in POSIX 1003.2.
- *
- * The [!...] convention to negate a range is supported (SysV, Posix, ksh).
- *
- * Optional extra services, controlled by flags not defined by POSIX:
- *
- * GLOB_QUOTE:
- * Escaping convention: \ inhibits any special meaning the following
- * character might have (except \ at end of string is retained).
- * GLOB_MAGCHAR:
- * Set in gl_flags if pattern contained a globbing character.
- * GLOB_NOMAGIC:
- * Same as GLOB_NOCHECK, but it will only append pattern if it did
- * not contain any magic characters. [Used in csh style globbing]
- * GLOB_ALTDIRFUNC:
- * Use alternately specified directory access functions.
- * GLOB_TILDE:
- * expand ~user/foo to the /home/dir/of/user/foo
- * GLOB_BRACE:
- * expand {1,2}{a,b} to 1a 1b 2a 2b
- * gl_matchc:
- * Number of matches in the current invocation of glob.
- */
-#ifdef PHP_WIN32
-#define _POSIX_
-#include <limits.h>
-#undef _POSIX_
-#ifndef S_ISDIR
-#define S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR)
-#endif
-#ifndef S_ISLNK
-#define S_ISLNK(m) (0)
-#endif
-#endif
-
-#include "php.h"
-#include <sys/stat.h>
-
-#include <ctype.h>
-#ifndef PHP_WIN32
-#include <sys/param.h>
-#include <dirent.h>
-#include <pwd.h>
-#include <unistd.h>
-#else
-#include "win32/pwd.h"
-#endif
-#include <errno.h>
-#include "glob.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define DOLLAR '$'
-#define DOT '.'
-#define EOS '\0'
-#define LBRACKET '['
-#define NOT '!'
-#define QUESTION '?'
-#define QUOTE '\\'
-#define RANGE '-'
-#define RBRACKET ']'
-#define SEP DEFAULT_SLASH
-#define STAR '*'
-#define TILDE '~'
-#define UNDERSCORE '_'
-#define LBRACE '{'
-#define RBRACE '}'
-#define SLASH '/'
-#define COMMA ','
-
-#ifndef DEBUG
-
-#define M_QUOTE 0x8000
-#define M_PROTECT 0x4000
-#define M_MASK 0xffff
-#define M_ASCII 0x00ff
-
-typedef u_short Char;
-
-#else
-
-#define M_QUOTE 0x80
-#define M_PROTECT 0x40
-#define M_MASK 0xff
-#define M_ASCII 0x7f
-
-typedef char Char;
-
-#endif
-
-
-#define CHAR(c) ((Char)((c)&M_ASCII))
-#define META(c) ((Char)((c)|M_QUOTE))
-#define M_ALL META('*')
-#define M_END META(']')
-#define M_NOT META('!')
-#define M_ONE META('?')
-#define M_RNG META('-')
-#define M_SET META('[')
-#define ismeta(c) (((c)&M_QUOTE) != 0)
-
-static int compare(const void *, const void *);
-static int g_Ctoc(const Char *, char *, u_int);
-static int g_lstat(Char *, struct stat *, glob_t *);
-static DIR *g_opendir(Char *, glob_t *);
-static Char *g_strchr(Char *, int);
-static int g_stat(Char *, struct stat *, glob_t *);
-static int glob0(const Char *, glob_t *);
-static int glob1(Char *, Char *, glob_t *, size_t *);
-static int glob2(Char *, Char *, Char *, Char *, Char *, Char *,
- glob_t *, size_t *);
-static int glob3(Char *, Char *, Char *, Char *, Char *, Char *,
- Char *, Char *, glob_t *, size_t *);
-static int globextend(const Char *, glob_t *, size_t *);
-static const Char *
- globtilde(const Char *, Char *, size_t, glob_t *);
-static int globexp1(const Char *, glob_t *);
-static int globexp2(const Char *, const Char *, glob_t *, int *);
-static int match(Char *, Char *, Char *);
-#ifdef DEBUG
-static void qprintf(const char *, Char *);
-#endif
-
-int
-glob(pattern, flags, errfunc, pglob)
- const char *pattern;
- int flags, (*errfunc)(const char *, int);
- glob_t *pglob;
-{
- const u_char *patnext;
- int c;
- Char *bufnext, *bufend, patbuf[MAXPATHLEN];
-
-#ifdef PHP_WIN32
- /* Force skipping escape sequences on windows
- * due to the ambiguity with path backslashes
- */
- flags |= GLOB_NOESCAPE;
-#endif
-
- patnext = (u_char *) pattern;
- if (!(flags & GLOB_APPEND)) {
- pglob->gl_pathc = 0;
- pglob->gl_pathv = NULL;
- if (!(flags & GLOB_DOOFFS))
- pglob->gl_offs = 0;
- }
- pglob->gl_flags = flags & ~GLOB_MAGCHAR;
- pglob->gl_errfunc = errfunc;
- pglob->gl_matchc = 0;
-
- bufnext = patbuf;
- bufend = bufnext + MAXPATHLEN - 1;
- if (flags & GLOB_NOESCAPE)
- while (bufnext < bufend && (c = *patnext++) != EOS)
- *bufnext++ = c;
- else {
- /* Protect the quoted characters. */
- while (bufnext < bufend && (c = *patnext++) != EOS)
- if (c == QUOTE) {
- if ((c = *patnext++) == EOS) {
- c = QUOTE;
- --patnext;
- }
- *bufnext++ = c | M_PROTECT;
- } else
- *bufnext++ = c;
- }
- *bufnext = EOS;
-
- if (flags & GLOB_BRACE)
- return globexp1(patbuf, pglob);
- else
- return glob0(patbuf, pglob);
-}
-
-/*
- * Expand recursively a glob {} pattern. When there is no more expansion
- * invoke the standard globbing routine to glob the rest of the magic
- * characters
- */
-static int
-globexp1(pattern, pglob)
- const Char *pattern;
- glob_t *pglob;
-{
- const Char* ptr = pattern;
- int rv;
-
- /* Protect a single {}, for find(1), like csh */
- if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
- return glob0(pattern, pglob);
-
- while ((ptr = (const Char *) g_strchr((Char *) ptr, LBRACE)) != NULL)
- if (!globexp2(ptr, pattern, pglob, &rv))
- return rv;
-
- return glob0(pattern, pglob);
-}
-
-
-/*
- * Recursive brace globbing helper. Tries to expand a single brace.
- * If it succeeds then it invokes globexp1 with the new pattern.
- * If it fails then it tries to glob the rest of the pattern and returns.
- */
-static int
-globexp2(ptr, pattern, pglob, rv)
- const Char *ptr, *pattern;
- glob_t *pglob;
- int *rv;
-{
- int i;
- Char *lm, *ls;
- const Char *pe, *pm, *pl;
- Char patbuf[MAXPATHLEN];
-
- /* copy part up to the brace */
- for (lm = patbuf, pm = pattern; pm != ptr; *lm++ = *pm++)
- ;
- *lm = EOS;
- ls = lm;
-
- /* Find the balanced brace */
- for (i = 0, pe = ++ptr; *pe; pe++)
- if (*pe == LBRACKET) {
- /* Ignore everything between [] */
- for (pm = pe++; *pe != RBRACKET && *pe != EOS; pe++)
- ;
- if (*pe == EOS) {
- /*
- * We could not find a matching RBRACKET.
- * Ignore and just look for RBRACE
- */
- pe = pm;
- }
- } else if (*pe == LBRACE)
- i++;
- else if (*pe == RBRACE) {
- if (i == 0)
- break;
- i--;
- }
-
- /* Non matching braces; just glob the pattern */
- if (i != 0 || *pe == EOS) {
- *rv = glob0(patbuf, pglob);
- return 0;
- }
-
- for (i = 0, pl = pm = ptr; pm <= pe; pm++) {
- switch (*pm) {
- case LBRACKET:
- /* Ignore everything between [] */
- for (pl = pm++; *pm != RBRACKET && *pm != EOS; pm++)
- ;
- if (*pm == EOS) {
- /*
- * We could not find a matching RBRACKET.
- * Ignore and just look for RBRACE
- */
- pm = pl;
- }
- break;
-
- case LBRACE:
- i++;
- break;
-
- case RBRACE:
- if (i) {
- i--;
- break;
- }
- /* FALLTHROUGH */
- case COMMA:
- if (i && *pm == COMMA)
- break;
- else {
- /* Append the current string */
- for (lm = ls; (pl < pm); *lm++ = *pl++)
- ;
-
- /*
- * Append the rest of the pattern after the
- * closing brace
- */
- for (pl = pe + 1; (*lm++ = *pl++) != EOS; )
- ;
-
- /* Expand the current pattern */
-#ifdef DEBUG
- qprintf("globexp2:", patbuf);
-#endif
- *rv = globexp1(patbuf, pglob);
-
- /* move after the comma, to the next string */
- pl = pm + 1;
- }
- break;
-
- default:
- break;
- }
- }
- *rv = 0;
- return 0;
-}
-
-
-
-/*
- * expand tilde from the passwd file.
- */
-static const Char *
-globtilde(pattern, patbuf, patbuf_len, pglob)
- const Char *pattern;
- Char *patbuf;
- size_t patbuf_len;
- glob_t *pglob;
-{
- struct passwd *pwd;
- char *h;
- const Char *p;
- Char *b, *eb;
-
- if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
- return pattern;
-
- /* Copy up to the end of the string or / */
- eb = &patbuf[patbuf_len - 1];
- for (p = pattern + 1, h = (char *) patbuf;
- h < (char *)eb && *p && *p != SLASH; *h++ = (char) *p++)
- ;
-
- *h = EOS;
-
-#if 0
- if (h == (char *)eb)
- return what;
-#endif
-
- if (((char *) patbuf)[0] == EOS) {
- /*
- * handle a plain ~ or ~/ by expanding $HOME
- * first and then trying the password file
- */
- if ((h = getenv("HOME")) == NULL) {
-#ifndef PHP_WIN32
- if ((pwd = getpwuid(getuid())) == NULL)
- return pattern;
- else
- h = pwd->pw_dir;
-#else
- return pattern;
-#endif
- }
- } else {
- /*
- * Expand a ~user
- */
- if ((pwd = getpwnam((char*) patbuf)) == NULL)
- return pattern;
- else
- h = pwd->pw_dir;
- }
-
- /* Copy the home directory */
- for (b = patbuf; b < eb && *h; *b++ = *h++)
- ;
-
- /* Append the rest of the pattern */
- while (b < eb && (*b++ = *p++) != EOS)
- ;
- *b = EOS;
-
- return patbuf;
-}
-
-
-/*
- * The main glob() routine: compiles the pattern (optionally processing
- * quotes), calls glob1() to do the real pattern matching, and finally
- * sorts the list (unless unsorted operation is requested). Returns 0
- * if things went well, nonzero if errors occurred. It is not an error
- * to find no matches.
- */
-static int
-glob0(pattern, pglob)
- const Char *pattern;
- glob_t *pglob;
-{
- const Char *qpatnext;
- int c, err, oldpathc;
- Char *bufnext, patbuf[MAXPATHLEN];
- size_t limit = 0;
-
- qpatnext = globtilde(pattern, patbuf, MAXPATHLEN, pglob);
- oldpathc = pglob->gl_pathc;
- bufnext = patbuf;
-
- /* We don't need to check for buffer overflow any more. */
- while ((c = *qpatnext++) != EOS) {
- switch (c) {
- case LBRACKET:
- c = *qpatnext;
- if (c == NOT)
- ++qpatnext;
- if (*qpatnext == EOS ||
- g_strchr((Char *) qpatnext+1, RBRACKET) == NULL) {
- *bufnext++ = LBRACKET;
- if (c == NOT)
- --qpatnext;
- break;
- }
- *bufnext++ = M_SET;
- if (c == NOT)
- *bufnext++ = M_NOT;
- c = *qpatnext++;
- do {
- *bufnext++ = CHAR(c);
- if (*qpatnext == RANGE &&
- (c = qpatnext[1]) != RBRACKET) {
- *bufnext++ = M_RNG;
- *bufnext++ = CHAR(c);
- qpatnext += 2;
- }
- } while ((c = *qpatnext++) != RBRACKET);
- pglob->gl_flags |= GLOB_MAGCHAR;
- *bufnext++ = M_END;
- break;
- case QUESTION:
- pglob->gl_flags |= GLOB_MAGCHAR;
- *bufnext++ = M_ONE;
- break;
- case STAR:
- pglob->gl_flags |= GLOB_MAGCHAR;
- /* collapse adjacent stars to one,
- * to avoid exponential behavior
- */
- if (bufnext == patbuf || bufnext[-1] != M_ALL)
- *bufnext++ = M_ALL;
- break;
- default:
- *bufnext++ = CHAR(c);
- break;
- }
- }
- *bufnext = EOS;
-#ifdef DEBUG
- qprintf("glob0:", patbuf);
-#endif
-
- if ((err = glob1(patbuf, patbuf+MAXPATHLEN-1, pglob, &limit)) != 0)
- return(err);
-
- /*
- * If there was no match we are going to append the pattern
- * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified
- * and the pattern did not contain any magic characters
- * GLOB_NOMAGIC is there just for compatibility with csh.
- */
- if (pglob->gl_pathc == oldpathc) {
- if ((pglob->gl_flags & GLOB_NOCHECK) ||
- ((pglob->gl_flags & GLOB_NOMAGIC) &&
- !(pglob->gl_flags & GLOB_MAGCHAR)))
- return(globextend(pattern, pglob, &limit));
- else
- return(GLOB_NOMATCH);
- }
- if (!(pglob->gl_flags & GLOB_NOSORT))
- qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc,
- pglob->gl_pathc - oldpathc, sizeof(char *), compare);
- return(0);
-}
-
-static int
-compare(p, q)
- const void *p, *q;
-{
- return(strcmp(*(char **)p, *(char **)q));
-}
-
-static int
-glob1(pattern, pattern_last, pglob, limitp)
- Char *pattern, *pattern_last;
- glob_t *pglob;
- size_t *limitp;
-{
- Char pathbuf[MAXPATHLEN];
-
- /* A null pathname is invalid -- POSIX 1003.1 sect. 2.4. */
- if (*pattern == EOS)
- return(0);
- return(glob2(pathbuf, pathbuf+MAXPATHLEN-1,
- pathbuf, pathbuf+MAXPATHLEN-1,
- pattern, pattern_last, pglob, limitp));
-}
-
-/*
- * The functions glob2 and glob3 are mutually recursive; there is one level
- * of recursion for each segment in the pattern that contains one or more
- * meta characters.
- */
-static int
-glob2(pathbuf, pathbuf_last, pathend, pathend_last, pattern,
- pattern_last, pglob, limitp)
- Char *pathbuf, *pathbuf_last, *pathend, *pathend_last;
- Char *pattern, *pattern_last;
- glob_t *pglob;
- size_t *limitp;
-{
- struct stat sb;
- Char *p, *q;
- int anymeta;
-
- /*
- * Loop over pattern segments until end of pattern or until
- * segment with meta character found.
- */
- for (anymeta = 0;;) {
- if (*pattern == EOS) { /* End of pattern? */
- *pathend = EOS;
- if (g_lstat(pathbuf, &sb, pglob))
- return(0);
-
- if (((pglob->gl_flags & GLOB_MARK) &&
- !IS_SLASH(pathend[-1])) && (S_ISDIR(sb.st_mode) ||
- (S_ISLNK(sb.st_mode) &&
- (g_stat(pathbuf, &sb, pglob) == 0) &&
- S_ISDIR(sb.st_mode)))) {
- if (pathend+1 > pathend_last)
- return (1);
- *pathend++ = SEP;
- *pathend = EOS;
- }
- ++pglob->gl_matchc;
- return(globextend(pathbuf, pglob, limitp));
- }
-
- /* Find end of next segment, copy tentatively to pathend. */
- q = pathend;
- p = pattern;
- while (*p != EOS && !IS_SLASH(*p)) {
- if (ismeta(*p))
- anymeta = 1;
- if (q+1 > pathend_last)
- return (1);
- *q++ = *p++;
- }
-
- if (!anymeta) { /* No expansion, do next segment. */
- pathend = q;
- pattern = p;
- while (IS_SLASH(*pattern)) {
- if (pathend+1 > pathend_last)
- return (1);
- *pathend++ = *pattern++;
- }
- } else
- /* Need expansion, recurse. */
- return(glob3(pathbuf, pathbuf_last, pathend,
- pathend_last, pattern, pattern_last,
- p, pattern_last, pglob, limitp));
- }
- /* NOTREACHED */
-}
-
-static int
-glob3(pathbuf, pathbuf_last, pathend, pathend_last, pattern, pattern_last,
- restpattern, restpattern_last, pglob, limitp)
- Char *pathbuf, *pathbuf_last, *pathend, *pathend_last;
- Char *pattern, *pattern_last, *restpattern, *restpattern_last;
- glob_t *pglob;
- size_t *limitp;
-{
- register struct dirent *dp;
- DIR *dirp;
- int err;
- char buf[MAXPATHLEN];
-
- /*
- * The readdirfunc declaration can't be prototyped, because it is
- * assigned, below, to two functions which are prototyped in glob.h
- * and dirent.h as taking pointers to differently typed opaque
- * structures.
- */
- struct dirent *(*readdirfunc)();
-
- if (pathend > pathend_last)
- return (1);
- *pathend = EOS;
- errno = 0;
-
- if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
- /* TODO: don't call for ENOENT or ENOTDIR? */
- if (pglob->gl_errfunc) {
- if (g_Ctoc(pathbuf, buf, sizeof(buf)))
- return(GLOB_ABORTED);
- if (pglob->gl_errfunc(buf, errno) ||
- pglob->gl_flags & GLOB_ERR)
- return(GLOB_ABORTED);
- }
- return(0);
- }
-
- err = 0;
-
- /* Search directory for matching names. */
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- readdirfunc = pglob->gl_readdir;
- else
- readdirfunc = readdir;
- while ((dp = (*readdirfunc)(dirp))) {
- register u_char *sc;
- register Char *dc;
-
- /* Initial DOT must be matched literally. */
- if (dp->d_name[0] == DOT && *pattern != DOT)
- continue;
- dc = pathend;
- sc = (u_char *) dp->d_name;
- while (dc < pathend_last && (*dc++ = *sc++) != EOS)
- ;
- if (dc >= pathend_last) {
- *dc = EOS;
- err = 1;
- break;
- }
-
- if (!match(pathend, pattern, restpattern)) {
- *pathend = EOS;
- continue;
- }
- err = glob2(pathbuf, pathbuf_last, --dc, pathend_last,
- restpattern, restpattern_last, pglob, limitp);
- if (err)
- break;
- }
-
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- (*pglob->gl_closedir)(dirp);
- else
- closedir(dirp);
- return(err);
-}
-
-
-/*
- * Extend the gl_pathv member of a glob_t structure to accomodate a new item,
- * add the new item, and update gl_pathc.
- *
- * This assumes the BSD realloc, which only copies the block when its size
- * crosses a power-of-two boundary; for v7 realloc, this would cause quadratic
- * behavior.
- *
- * Return 0 if new item added, error code if memory couldn't be allocated.
- *
- * Invariant of the glob_t structure:
- * Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and
- * gl_pathv points to (gl_offs + gl_pathc + 1) items.
- */
-static int
-globextend(path, pglob, limitp)
- const Char *path;
- glob_t *pglob;
- size_t *limitp;
-{
- register char **pathv;
- register int i;
- u_int newsize, len;
- char *copy;
- const Char *p;
-
- newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
- pathv = pglob->gl_pathv ? realloc((char *)pglob->gl_pathv, newsize) :
- malloc(newsize);
- if (pathv == NULL) {
- if (pglob->gl_pathv) {
- free(pglob->gl_pathv);
- pglob->gl_pathv = NULL;
- }
- return(GLOB_NOSPACE);
- }
-
- if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
- /* first time around -- clear initial gl_offs items */
- pathv += pglob->gl_offs;
- for (i = pglob->gl_offs; --i >= 0; )
- *--pathv = NULL;
- }
- pglob->gl_pathv = pathv;
-
- for (p = path; *p++;)
- ;
- len = (size_t)(p - path);
- *limitp += len;
- if ((copy = malloc(len)) != NULL) {
- if (g_Ctoc(path, copy, len)) {
- free(copy);
- return(GLOB_NOSPACE);
- }
- pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
- }
- pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
-
- if ((pglob->gl_flags & GLOB_LIMIT) &&
- newsize + *limitp >= ARG_MAX) {
- errno = 0;
- return(GLOB_NOSPACE);
- }
-
- return(copy == NULL ? GLOB_NOSPACE : 0);
-}
-
-
-/*
- * pattern matching function for filenames. Each occurrence of the *
- * pattern causes a recursion level.
- */
-static int
-match(name, pat, patend)
- register Char *name, *pat, *patend;
-{
- int ok, negate_range;
- Char c, k;
-
- while (pat < patend) {
- c = *pat++;
- switch (c & M_MASK) {
- case M_ALL:
- if (pat == patend)
- return(1);
- do
- if (match(name, pat, patend))
- return(1);
- while (*name++ != EOS)
- ;
- return(0);
- case M_ONE:
- if (*name++ == EOS)
- return(0);
- break;
- case M_SET:
- ok = 0;
- if ((k = *name++) == EOS)
- return(0);
- if ((negate_range = ((*pat & M_MASK) == M_NOT)) != EOS)
- ++pat;
- while (((c = *pat++) & M_MASK) != M_END)
- if ((*pat & M_MASK) == M_RNG) {
- if (c <= k && k <= pat[1])
- ok = 1;
- pat += 2;
- } else if (c == k)
- ok = 1;
- if (ok == negate_range)
- return(0);
- break;
- default:
- if (*name++ != c)
- return(0);
- break;
- }
- }
- return(*name == EOS);
-}
-
-/* Free allocated data belonging to a glob_t structure. */
-void
-globfree(pglob)
- glob_t *pglob;
-{
- register int i;
- register char **pp;
-
- if (pglob->gl_pathv != NULL) {
- pp = pglob->gl_pathv + pglob->gl_offs;
- for (i = pglob->gl_pathc; i--; ++pp)
- if (*pp)
- free(*pp);
- free(pglob->gl_pathv);
- pglob->gl_pathv = NULL;
- }
-}
-
-static DIR *
-g_opendir(str, pglob)
- register Char *str;
- glob_t *pglob;
-{
- char buf[MAXPATHLEN];
-
- if (!*str)
- strlcpy(buf, ".", sizeof buf);
- else {
- if (g_Ctoc(str, buf, sizeof(buf)))
- return(NULL);
- }
-
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- return((*pglob->gl_opendir)(buf));
-
- return(opendir(buf));
-}
-
-static int
-g_lstat(fn, sb, pglob)
- register Char *fn;
- struct stat *sb;
- glob_t *pglob;
-{
- char buf[MAXPATHLEN];
-
- if (g_Ctoc(fn, buf, sizeof(buf)))
- return(-1);
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- return((*pglob->gl_lstat)(buf, sb));
- return(lstat(buf, sb));
-}
-
-static int
-g_stat(fn, sb, pglob)
- register Char *fn;
- struct stat *sb;
- glob_t *pglob;
-{
- char buf[MAXPATHLEN];
-
- if (g_Ctoc(fn, buf, sizeof(buf)))
- return(-1);
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- return((*pglob->gl_stat)(buf, sb));
- return(stat(buf, sb));
-}
-
-static Char *
-g_strchr(str, ch)
- Char *str;
- int ch;
-{
- do {
- if (*str == ch)
- return (str);
- } while (*str++);
- return (NULL);
-}
-
-static int
-g_Ctoc(str, buf, len)
- register const Char *str;
- char *buf;
- u_int len;
-{
-
- while (len--) {
- if ((*buf++ = (char) *str++) == EOS)
- return (0);
- }
- return (1);
-}
-
-#ifdef DEBUG
-static void
-qprintf(str, s)
- const char *str;
- register Char *s;
-{
- register Char *p;
-
- (void)printf("%s:\n", str);
- for (p = s; *p; p++)
- (void)printf("%c", CHAR(*p));
- (void)printf("\n");
- for (p = s; *p; p++)
- (void)printf("%c", *p & M_PROTECT ? '"' : ' ');
- (void)printf("\n");
- for (p = s; *p; p++)
- (void)printf("%c", ismeta(*p) ? '_' : ' ');
- (void)printf("\n");
-}
-#endif
diff --git a/win32/glob.h b/win32/glob.h
deleted file mode 100644
index 4e842a5cee..0000000000
--- a/win32/glob.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* $Id$ */
-/* OpenBSD: glob.h,v 1.7 2002/02/17 19:42:21 millert Exp */
-/* NetBSD: glob.h,v 1.5 1994/10/26 00:55:56 cgd Exp */
-
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Guido van Rossum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)glob.h 8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _GLOB_H_
-#define _GLOB_H_
-
-#include <sys/cdefs.h>
-
-struct stat;
-typedef struct {
- int gl_pathc; /* Count of total paths so far. */
- int gl_matchc; /* Count of paths matching pattern. */
- int gl_offs; /* Reserved at beginning of gl_pathv. */
- int gl_flags; /* Copy of flags parameter to glob. */
- char **gl_pathv; /* List of paths matching pattern. */
- /* Copy of errfunc parameter to glob. */
- int (*gl_errfunc)(const char *, int);
-
- /*
- * Alternate filesystem access methods for glob; replacement
- * versions of closedir(3), readdir(3), opendir(3), stat(2)
- * and lstat(2).
- */
- void (*gl_closedir)(void *);
- struct dirent *(*gl_readdir)(void *);
- void *(*gl_opendir)(const char *);
- int (*gl_lstat)(const char *, struct stat *);
- int (*gl_stat)(const char *, struct stat *);
-} glob_t;
-
-/* Flags */
-#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
-#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
-#define GLOB_ERR 0x0004 /* Return on error. */
-#define GLOB_MARK 0x0008 /* Append / to matching directories. */
-#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */
-#define GLOB_NOSORT 0x0020 /* Don't sort. */
-
-#ifndef _POSIX_SOURCE
-#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
-#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
-#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
-#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
-#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */
-#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
-#define GLOB_NOESCAPE 0x1000 /* Disable backslash escaping. */
-#define GLOB_LIMIT 0x2000 /* Limit pattern match output to ARG_MAX */
-#endif
-
-/* Error values returned by glob(3) */
-#define GLOB_NOSPACE (-1) /* Malloc call failed. */
-#define GLOB_ABORTED (-2) /* Unignored error. */
-#define GLOB_NOMATCH (-3) /* No match and GLOB_NOCHECK not set. */
-#define GLOB_NOSYS (-4) /* Function not supported. */
-#define GLOB_ABEND GLOB_ABORTED
-
-__BEGIN_DECLS
-int glob(const char *, int, int (*)(const char *, int), glob_t *);
-void globfree(glob_t *);
-__END_DECLS
-
-#endif /* !_GLOB_H_ */
diff --git a/win32/grp.h b/win32/grp.h
deleted file mode 100644
index ca7218ea96..0000000000
--- a/win32/grp.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-struct group {
- char *gr_name;
- char *gr_passwd;
- int gr_gid;
- char **gr_mem;
-};
diff --git a/win32/install.txt b/win32/install.txt
deleted file mode 100644
index e1ea065fc2..0000000000
--- a/win32/install.txt
+++ /dev/null
@@ -1,792 +0,0 @@
-PHP/Windows Installation Notes
-==============================
-
-Installation on Windows 9x/Me/NT/2000/XP systems
-=============================================
-
-There are two main ways to install PHP for Windows: either
-manually or by using the InstallShield installer.
-
-
-Windows InstallShield
-=====================
-
- The Windows PHP installer is available from the downloads page at
- www.php.net. This installs the CGI version of PHP and, for IIS, PWS,
- and Xitami, configures the web server as well.
- Note that this version does *NOT* install any extensions or server
- api versions of PHP.
-
- Install your selected HTTP server on your system and make sure
- that it works.
-
- Run the executable installer and follow the instructions provided by
- the installation wizard. Two types of installation are supported -
- standard, which provides sensible defaults for all the settings it
- can, and advanced, which asks questions as it goes along.
-
- The installation wizard gathers enough information to set up the
- php.ini file and configure the web server to use PHP.
- For IIS and also PWS on NT Workstation, a list of all the
- nodes on the server with script map settings is displayed, and you
- can choose those nodes to which you wish to add the PHP script
- mappings.
-
- Once the installation has completed the installer will inform you
- if you need to restart your system, restart the server, or just
- start using PHP.
-
-Windows Manual installation from zip binary distribution
-========================================================
-
- This install guide will help you manually install and configure
- PHP on your Windows 9x/Me/NT/2000/XP webservers. This guide was compiled by
- Bob Silva. The original version can be found at
- http://www.umesd.k12.or.us/php/win32install.html
-
- This guide provides manual installation support for:
- Personal Web Server 3 and 4 or newer
- Internet Information Server 3 and 4 or newer
- Apache 1.3.x
- Apache 2.0.x (experimental)
- OmniHTTPd 2.0b1 and up
- Oreilly Website Pro
- Xitami
- Netscape Enterprise Server, iPlanet
-
- PHP 4 for Windows comes in two flavours - a CGI executable (php.exe),
- and several SAPI modules (for exapmle php4isapi.dll). The latter form
- is new to PHP 4, and provides significantly improved performance and
- some new functionality. However, please note that the SAPI modules
- are *NOT* yet considered to be production quality.
- In particular, with the ISAPI module, you are likely to encounter serious
- reliability problems especially on platforms older than W2K - you may
- witness a lot of server 500 errors and suffer from other server modules
- such as ASP also failing. You have been warned!
-
- The reason for this is that the PHP SAPI modules are using the
- thread-safe version of the PHP code, which is new to PHP 4, and has
- not yet been tested and pounded enough to be considered completely
- stable, and there are actually a few known bugs. On the other hand,
- some people have reported very good results with the SAPI modules,
- and there a few reports of problems with the Apache module version.
- In short - your mileage may vary; If you need
- absolute stability, trade the performance of the SAPI modules
- with the stability of the CGI executable.
-
- If you choose one of the SAPI modules and use Windows 95, be sure
- to download the DCOM update from
- http://download.microsoft.com/msdownload/dcom/95/x86/en/dcom95.exe"
- For the ISAPI module, an ISAPI 4.0 compliant Web server
- is required (tested on IIS 4.0, PWS 4.0 and IIS 5.0). IIS 3.0 is
- *NOT* supported; You should download and install the Windows NT 4.0
- Option Pack with IIS 4.0 if you want native PHP support.
-
- The following steps should be performed on all installations
- before the server specific instructions.
-
- Extract the distribution file to a directory of your choice.
- C:\PHP\ is a good start.
-
- You need to ensure that the dlls which php uses can be found. The precise
- dlls involved depend on which web server you use and whether you want to
- run php as a cgi or as a server module. php4ts.dll is always used. If you are
- using a server module (e.g. isapi or apache) then you will need the relevent
- dll from the sapi folder. If you are using any php extension dlls then you
- will need those as well. To make sure that the dlls can be found, you can
- either copy them to the system directory (e.g. winnt/system32 or
- windows/system) or you can make sure that they live in the same directory
- as the main php executable or dll your web server will use (e.g. php.exe,
- php4apache.dll).
-
- Copy the file, php.ini-dist to your %WINDOWS% directory on
- Windows 95/98 or to your %SYSTEMROOT% directory under Windows NT,
- Windows 2000 or Windows XP and rename it to php.ini. Your %WINDOWS% or
- %SYSTEMROOT% directory is typically:
- c:\windows for Windows 95/98
- c:\winnt or c:\winnt40 for NT/2000/XP servers
- We will refer to %SYSTEMROOT% for both %WINDOWS% or
- %SYSTEMROOT% throughout the text.
-
- Edit your php.ini file:
-
- You will need to change the 'extension_dir' setting to
- point to your php-install-dir, or where you have placed
- your 'php_*.dll' files. ex: c:\php
-
- If you are using OmniHTTPd, do not follow the next step.
- Set the 'doc_root' to point to your webservers
- document_root. ex: c:\apache\htdocs or c:\webroot
-
- Choose which extensions you would like to load when PHP
- starts, noting that several extensions are already built
- into the Windows release, see the section about
- Windows extensions for details of the built-in extensions.
- You can uncomment the: 'extension=php_*.dll' lines
- in php.ini to load these extensions.
-
- Note that on a new installation it is advisable to first get
- PHP working and tested without any extensions before enabling
- them in php.ini.
-
- On PWS and IIS, you can set the browscap.ini
- to point to: 'c:\windows\system\inetsrv\browscap.ini' on
- Windows 9x/Me and 'c:\winnt\system32\inetsrv\browscap.ini'
- on NT/2000/XP Server.
-
- More information on the capabilities of browscap can be found here:
-
- http://www.php.net/manual/en/function.get-browser.php
-
- Note that the mibs directory supplied with the Windows distribution
- contains support files for SNMP. This directory should be moved to
- DRIVE:\usr\mibs (DRIVE being the drive where PHP is installed.)
-
-
-Installation of Windows extensions
-==================================
-
- After installing PHP and a webserver on Windows, you will
- probably want to install some extensions for added functionality.
- The following table describes some of the extensions available. As
- described in the manual installation steps, you can choose which
- extensions you would like to load when PHP starts by uncommenting the:
- extension=php_*.dll' lines in php.ini.
-
-
- ATTENTION! ATTENTION! ATTENTION!
- Some extra DLLs are required for some PHP extensions. Please copy the
- bundled dlls from the 'dlls/' directory in distribution package to your
- windows/system (Win9.x) or winnt/system32 (WinNT, Win2000, XP) directory.
- If you already have these DLLs installed on your system,
- overwrite them only if something is not working correctly.
- Before overwriting them, it is a good idea to backup them or move them to
- another folder - just in case something goes wrong.
-
- Download the latest version of the Microsoft Data Access Components (MDAC)
- for your platform, especially Microsoft Windows 9x/NT4 users.
- MDAC is available at http://www.microsoft.com/data/ .
-
- Also note that some extensions need 3rd party libraries,
- e.g. php_oci8.dll needs the Oracle 8 client libraries to be installed
- on your system. These are not bundled with PHP distribution.
- ATTENTION! ATTENTION! ATTENTION!
-
-
- The DLLs for PHP extensions are prefixed with 'php_'. This
- prevents confusion between PHP extensions and their supporting
- libraries.
-
- Note:
- In PHP 4.0.5 MySQL, ODBC, FTP, Calendar, BCMath, COM, PCRE,
- Session, WDDX and XML support is built-in. You don't need to
- load any additional extensions in order to use these functions.
-
- Examples of PHP Extensions
-
- php_dbase.dll dBase functions
- php_filepro.dll Read-only access to Filepro databases
- php_gd2.dll GD library functions for image manipulation
- php_hyperwave.dll HyperWave functions
- php_imap.dll IMAP functions
- php_ldap.dll LDAP functions
- php_mssql.dll MSSQL client (requires MSSQL DB-Libraries)
- php_snmp.dll SNMP get and walk functions (NT only!)
- php_zlib.dll ZLib compression functions
-
- For more information see the section about Windows extensions at
- http://www.php.net/manual/en/install-windows.php#install.windows.extensions
-
-
-Web server configuration
-========================
-
- Installing PHP on Windows with Apache 1.3.x
-
- ------------------------------------------------------------
- ATTENTION: Apache 2 Users
-
- At this time, support for Apache 2 is experimental. It's
- highly recommended you use PHP with Apache 1.3.x and not
- Apache 2. Documentation for installing Apache 2 on windows
- can be seen here:
-
- http://www.php.net/manual/en/install.apache2.php
-
- With the basic difference being that when installing as a
- module you'll use php4apache2.dll instead of php4apache.dll
- Both files are included within this release.
- ------------------------------------------------------------
-
-
- There are two ways to set up PHP to work with Apache 1.3.x
- on Windows. One is to use the CGI binary (php.exe),
- the other is to use the Apache module dll. In either case
- you need to stop the Apache server, and edit your
- httpd.conf or srm.conf to configure Apache to work with PHP.
- We'll refer to either of these files with httpd.conf in the
- text.
-
- Although there can be a few variations of configuring PHP
- under Apache, these are simple enough to be used by the
- newcomer. Please consult the Apache Docs for further
- configuration directives.
-
-
- Installing PHP for Apache as module
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- Now that version 4.1 introduces a safer sapi module, we recommend
- that you configure PHP as a module in Apache.
-
- To accomplish this, you have to load the php4apache.dll in your
- Apache httpd.conf.
-
- !! NOTE !!
- Whereever you load php4apache.dll from, php4apache.dll also
- needs the php4ts.dll also included in the PHP4 distribution.
- php4apache.dll depends on php4ts.dll which is loaded as soon as
- Apache loads php4apache.dll. If php4ts.dll can't be found, you
- usually get an error like (also see the "Problems?" section at
- the end of the file):
-
- Cannot load c:/php/sapi/php4apache.dll into server
-
- So where does php4ts.dll has to be to be properly loaded ?
- php4ts.dll is searched in the following order:
-
- 1) in the directory where apache.exe is start from
- 2) in the directory where php4apache.dll is loaded from
- 3) in your %SYSTEMROOT%\System32, %SYSTEMROOT%\system and
- %SYSTEMROOT% directory.
- Note: %SYSTEMROOT%\System32 only applies to Windows NT/2000/XP)
- 4) in your whole %PATH%
-
- Note: What is %SYSTEMROOT% ? Depending on your Windows
- installation this may be for example c:\winnt or C:\windows
-
- Usually you would just copy it over to %SYSTEMROOT%\System32.
- But if you want to have multiple PHP installations (for
- whatever reason) this is a bad idea. For this circumstance the
- safest thing is to let php4ts.dll reside in the same directory
- where php4apache.dll is loaded from (see point 2 above).
-
-
- After you've set up the file layout properly, you're ready to
- finally configure Apache to load the PHP4 module. Just add the
- following lines to your httpd.conf:
-
- LoadModule php4_module c:/php/sapi/php4apache.dll
- AddModule mod_php4.c
- AddType application/x-httpd-php .php
-
- Note: Especially newer versions of Apache do not need the
- AddModule directive anymore, your milage may vary.
-
-
- Where do I have to put the php.ini ?
- The php.ini files is only searched in two places:
- 1) in your Apache installation directory (e.g. c:\apache\apache)
- 2) in your %SYSTEMROOT% directory.
-
-
- Installing PHP for Apache as CGI binary
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- If you wish to install PHP as a CGI binary, read this first:
-
- http://www.cert.org/advisories/CA-1996-11.html
-
- and then if you are really sure, insert these lines to your conf file:
-
- ScriptAlias /php/ "c:/php/"
- AddType application/x-httpd-php .php
- Action application/x-httpd-php "/php/php.exe"
-
- Note, we consider installing PHP like this suicidal.
-
- As a further precaution, we recommend you change the "/php/"
- ScriptAlias to something more random, to prevent the binary being
- called directly, which is a security risk.
-
- Remember when you have finished to restart the server, for example,
- NET STOP APACHE
- followed by
- NET START APACHE
-
- To use the source code highlighting feature, add the following
- line to your apache httpd.conf file:
-
- AddType application/x-httpd-php-source .phps
-
- Note, this will only work when you install php as a sapi module.
- If you wish to use this feature with the cgi binary, create a new
- file, and use the show_source("path/to/original_file.php"); function.
-
-
- Forward or backslash in pathnames ?
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- On Win-Apache, path names can contain either forward- or backslashes.
- Example:
-
- LoadModule php4_module C:\php\sapi\php4apache.dll
-
- works as good as
-
- LoadModule php4_module C:/php/sapi/php4apache.dll
-
- You even can mix the slash-style:
-
- LoadModule php4_module C:\php/sapi\php4apache.dll
-
-----------------------------------------------------------
-
- Installing PHP on Windows with IIS/PWS
-
- This section contains notes and hints specific to IIS (Microsoft
- Internet Information Server). Installing PHP for PWS/IIS 3 and
- PWS/IIS 4 or newer versions.
-
- Windows and PWS/IIS 3 - including PWS on Win 9x/ME
-
- The recommended method for configuring these servers is to use
- the REG file incuded with the distribution (pws-php4cgi.reg).
- You may want to edit this file and make sure the extensions and PHP
- install directories match your configuration - once you have done
- this, just double click on the file and it will update your registry.
- Alternatively, you can follow the steps below to do it manually.
-
- WARNING:
- These steps involve working directly with the Windows
- registry. One error here can leave your system in an unstable
- state. We highly recommend that you back up your registry
- first. The PHP Development team will not be held responsible if
- you damage your registry.
-
- Run Regedit.
- Navigate to:
- HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/W3Svc/Parameters/ScriptMap
- On the edit menu select: New->String Value.
- Type in the extension you wish to use for your php scripts. ex: .php
- Double click on the new string value and enter the path to
- php.exe in the value data field.
- ex: c:\php\php.exe
- Repeat these steps for each extension you wish to associate
- with PHP scripts.
-
- The following steps do not affect the web server installation and only
- apply if you want your php scripts to be executed when they are run
- from the command line (ex. run c:\myscripts\test.php) or by double
- clicking on them in a directory viewer window. You may wish to skip
- this step as you might prefer the php files to load into a text
- editor when you double click on them.
-
- Now navigate to: HKEY_CLASSES_ROOT
- On the edit menu select: New->Key
- Name the key to the extension you setup in the previous
- section. ex: .php
- Highlight the new key and in the right side pane, double click
- the "default value" and enter phpfile.
- Repeat the last step for each extension you set up in the
- previous section.
- Now create another New->Key under
- HKEY_CLASSES_ROOT and name it phpfile
- Highlight the new key 'phpfile' and in the
- right side pane, double click the "default value" and enter
- PHP Script.
- Right click on the 'phpfile' key and select
- New->Key, name it Shell.
- Right click on the 'Shell' key and select
- New->Key, name it open.
- Right click on the 'open' key and select
- New->Key, name it command.
- Highlight the new key 'command' and in the
- right side pane, double click the "default value" and enter
- the path to php.exe ex: c:\php\php.exe -q %1
- (don't forget the '%1').
- Exit Regedit.
- If using PWS on Windows, reboot to reload the registry.
- PWS and IIS 3 users now have a fully operational system. IIS 3
- users can use a nifty tool available at
- http://www.genusa.com/iis/iiscfg.html
- from Steven Genusa to configure their script maps.
-
- Windows NT/2000/XP and IIS 4 or newer and PWS 4 on NT Workstation or W2K non server editions
-
- To install PHP on an NT/2000/XP Server running IIS 4 or newer,
- follow these instructions. You have two options to set up
- PHP, using the CGI binary (php.exe) or with the ISAPI module.
-
- In either case, you need to start the Microsoft Management
- Console (may appear as 'Internet Services Manager', either
- in your Windows NT 4.0 Option Pack branch or the Control
- Panel=>Administrative Tools under Windows 2000). Then
- right click on your Web server node (this will most probably
- appear as 'Default Web Server'), and select 'Properties'.
-
- If you want to use the CGI binary, do the following:
- Under 'Home Directory', 'Virtual Directory', or
- 'Directory', click on the 'Configuration' button,
- and then enter the App Mappings tab.
-
- Click Add, and in the Executable box, type:
- c:\php\php.exe (assuming that you have unzipped PHP in c:\php\).
-
- In the Extension box, type the file name extension you want
- associated with PHP scripts. Leave 'Method exclusions'
- blank, and check the Script engine checkbox. You may also
- like to check the 'check that file exists' box - for a small
- performance penalty, IIS (or PWS) will check that the script
- file exists and sort out authentication before firing up php.
- This means that you will get sensible 404 style error messages
- instead of cgi errors complaing that php did not output any data.
-
- You must repeat from 'Click Add...' for each extension you
- want associated with PHP scripts.
- (.php is recommended. although .phtml and .php3 may be
- required for legacy applications.)
-
- Set up the appropriate security. (This is done in Internet
- Service Manager), and if your NT Server uses NTFS file system,
- add execute rights for I_USR_ to the directory that contains
- php.exe
-
- !NOTE!: Since 4.1.2, the php.ini setting cgi.force_redirect defaults to '1'
- which effectively prevents the cgi from working within IIS. You need to set
- up at least a minimal php.ini file with the following directive:
-
- cgi.force_redirect = 0
-
- If it doesn't work immidiately, make sure you have the php.ini file in the
- right place (%SYSTEMROOT%\php.ini).
-
-
- To use the ISAPI module, do the following:
-
- If you don't want to perform HTTP Authentication using PHP,
- you can (and should) skip this step. Under ISAPI Filters,
- add a new ISAPI filter. Use PHP as the filter name, and
- supply a path to the php4isapi.dll.
-
- Under 'Home Directory', click on the 'Configuration' button.
- Add a new entry to the Application Mappings. Use the path
- to the php4isapi.dll as the Executable, supply .php as the
- extension, leave Method exclusions blank, and check the
- Script engine checkbox.
-
- Stop IIS completely (net stop iisadmin)
- Start IIS again (net start w3svc)
-
-----------------------------------------------------------
-
- Installing PHP on Windows with OmniHTTPd Server
-
- This section contains notes and hints specific to
- OmniHTTPd 2.0b1 and up for Windows
-
- This has got to be the easiest config there is:
-
- Step 1: Install OmniHTTPd server.
- Step 2: Right click on the blue OmniHTTPd icon in the system
- tray and select 'Properties'
- Step 3: Click on 'Web Server Global Settings'
- Step 4: On the 'External' tab, enter:
- virtual = .php | actual = c:\path-to-php-dir\php.exe
- and use the Add button.
- Step 5: On the Mime tab, enter:
- virtual = wwwserver/stdcgi | actual = .php
- and use the Add button.
- Step 6: Click 'OK'
-
- Repeat steps 2 - 6 for each extension you want to associate with PHP.
- NOTE:
- Some OmniHTTPd packages come with built in PHP support.
- You can choose at setup time to do a custom setup, and
- uncheck the PHP component. We recommend you to use the latest
- PHP binaries. Some OmniHTTPd servers come with PHP 4 beta
- distributions, so you should choose not to set up
- the built in support, but install your own. If the server
- is already on your machine, use the Replace button in Step
- 4 and 5 to set the new, correct information.
-
-----------------------------------------------------------
-
- Installing PHP on Windows with Oreilly Website Pro
-
- This section contains notes and hints specific to Oreilly
- Website Pro 2.5 and up for Windows
-
- This list describes how to set up the PHP CGI binary
- or the ISAPI module to work with Oreilly Website Pro
- on Windows.
-
- Edit the Server Properties and select the tab "Mapping".
-
- From the List select "Associations" and enter the desired
- extension (".php") and the path to the CGI exe (ex. c:\php\php.exe)
- or the ISAPI dll file (ex. c:\php\sapi\php4isapi.dll).
-
- Select "Content Types" add the same extension ".php"
- and enter the content type. If you choose the CGI exe
- file, enter 'wwwserver/shellcgi', if you chose the
- ISAPI module, enter 'wwwserver/isapi' (both without quotes).
-
-----------------------------------------------------------
-
- Installing PHP on Windows with Xitami
-
- This section contains notes and hints specific to Xitami.
-
- This list describes how to set up the PHP CGI binary
- to work with Xitami on Windows.
-
- Make sure the webserver is running, and point
- your browser to xitamis admin console
- (usually http://127.0.0.1/admin), and click on
- Configuration.
-
- Navigate to the Filters, and put the
- extension which php should parse (i.e. .php)
- into the field File extensions (.xxx).
-
- In Filter command or script put the path and name
- of your php executable i.e. c:\php\php.exe.
-
- Press the 'Save' icon.
-
-----------------------------------------------------------
-
- Installing PHP on Windows with Netscape servers.
-
-
- To Install PHP as CGI (for Netscape Enterprise Server, iPlanet, perhaps Fastrack)
-
- Copy php4ts.dll to your systemroot (the directory where you installed windows)
-
- Make a file assocition from the command line (type the 2 following lines)
- assoc .php=PHPScript
- ftype PHPScript=c:\php\php.exe %1 %*
-
- In the Netscape Enterprise Administration Server create a dummy shellcgi
- directory and remove it just after (this step creates 5 important lines in
- obj.conf and allow the web server to handle shellcgi scripts)
-
- In the Netscape Enterprise Administration Server create a new mime type
- (Category:type,Content-Type:magnus-internal/shellcgi,File Suffix:php)
-
- Do it for each web server instance you want php to run
-
- More details http://benoit.noss.free.fr/php/install-php.html
-
-
- To Install PHP as NSAPI (for Netscape Enterprise Server, iPlanet, perhaps Fastrack)
-
- Copy php4ts.dll to your systemroot (the directory where you installed windows)
-
- Make a file assocition from the command line (type the 2 following lines)
- assoc .php=PHPScript
- ftype PHPScript=c:\php\php.exe %1 %*
-
- In the Netscape Enterprise Administration Server create a new mime type
- (Category:type,Content-Type:magnus-internal/x-httpd-php,File Suffix:php)
-
- Stop your web service and edit obj.conf
- At the end of the Init section, place these 2 lines (necessarily after mime type init!)
- Init fn="load-modules" funcs="php4_init,php4_close,php4_execute,php4_auth_trans" shlib="c:/php/sapi/php4nsapi.dll"
- Init fn="php4_init" errorString="Failed to initialise PHP!"
-
- In The < Object name="default" > section, place this line necessarily after all 'ObjectType' and before all 'AddLog' lines!
- Service fn="php4_execute" type="magnus-internal/x-httpd-php"
-
- At the end of the file, create a new object called x-httpd-php, by inserting this lines
- <Object name="x-httpd-php">
- ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
- Service fn=php4_execute
- </Object>
-
- Restart your web service and apply changes
-
- Do it for each web server instance you want php to run
-
- More details http://benoit.noss.free.fr/php/install-php4.html
-
-----------------------------------------------------------
-
- Installing PHP on The Sambar Server
-
- This section contains notes and hints specific to Sambar
-
- Find the file called mappings.ini (config directory) in your Sambar
- install directory
-
- Open mappings.ini and add the following line under [isapi]
-
- *.php = c:\php\php4isapi.dll
- Note: The above assumes that PHP was installed in c:\php
-
- Restart the server
-
-----------------------------------------------------------
-
-Problems?
-=========
-
- Read the FAQ
-
- Some problems are more common than others. The most common ones
- are listed in the PHP FAQ, found at www.php.net/FAQ.php
-
- Common problems with Windows
-
- The following problems often occur with IIS/PWS, but some points may
- also apply to other servers.
-
- For test purposes it is best to use just a simple test script. One
- containing just the following line will suffice:
- <?php phpinfo();?>
-
- You have installed PHP, but when try to access a php script file via your
- browser, you get a blank screen:
-
- Do a 'view source' in the web browser and you will probably find that you
- can see the source code of your php script. This means that the web server
- did not send the script to php for interpretation. Something is wrong with
- the server configuration - double check the server configuration against
- the php installation instructions.
-
- You have installed PHP, but when try to access a php script file via your
- browser, you get a server 500 error:
-
- Something went wrong when the server tried to run PHP. To get to see a
- sensible error message, from the command line, change to the directory
- containing php.exe and run "php.exe -i" (without quotes).
- If php has any problems running, then a suitable error message will be displayed
- which will give you a clue as to what needs to be done next.
- If you get a screen full of html codes (the output of the phpinfo() function) then
- php is working ok, and your problem may be related to your server configuration
- which you should double check.
-
- You have installed PHP, but when try to access a php script file via your
- browser, you get the error:
- cgi error:
- The specified CGI application misbehaved by not returning a complete set of
- HTTP headers. The headers it did return are:
-
- This error message means that php failed to output anything at all.
- From the command line hange to the directory containing php.exe. Run
- php.exe -i
- If php has any problems running, then a suitable
- error message will be displayed which will give you a clue as to what needs to
- be done next. If you get a screen full of html codes (the output of the
- phpinfo() function) then php is working ok.
-
- Once php is working at the command line, try accessing the php script via the browser again.
- If it still fails then it could be one of the following:
-
- file permissions on your php script, php.exe, php4ts.dll, php.ini or any php
- extensions you are trying to load are such that the anonymous internet user
- ISUR_<machinename> cannot access them.
-
- The script file does not exist (or possibly isn't where you think it is
- relative to your web root directory). Note that for IIS you can trap this error by ticking
- the 'check file exists' box when setting up the script mappings in the Internet Services
- Manager. If a script file does not exist then the server will return a 404 error instead.
- There is also the additional benefit that IIS will do any authentication required for you
- based on the NTLanMan permissions on your script file.
-
-
- You have inherent problems loading the right DLL?
- Sometimes, loading the right DLL can be a pain on Windows.
- Advanced Windows users may use a tool called strace (named
- after the famous Unix application) to trace file access on the
- system (however, it only works on NT-alike Windows, read:
- NT/2000/XP). It can be found at
- http://razor.bindview.com/tools/desc/strace_readme.html . Read
- the instruction there carefully!
-
- Example scenery:
-
- Apache/PHP4 as module. Though I've properly configured
- php4apache.dll in httpd.conf, I always get:
-
- Syntax error on line 1025 of c:/apache/apache/conf/httpd.conf:
- Cannot load c:/php/php-4.2.1-win32/sapi/php4apache.dll into server
-
- But c:/php/php-4.2.1-win32/sapi/php4apache.dll definitely
- exists:
-
- dir c:\php\php-4.2.1-win32\sapi\php4apache.dll
- Directory of c:\php\php-4.2.1-win32\sapi
- 13.05.2002 00:01 24.576 php4apache.dll
-
- 'strace'ing the apache.exe binary revealed the following:
- c:
- cd \apache\apache
- strace apache >strace.txt
-
- Then looking into strace.txt:
- [...]
-729 3348 3248 NtOpenSection (0xe, {24, 24, 0x40, 0, 0, "php4ts.dll"}, ... ) == STATUS_OBJECT_NAME_NOT_FOUND
-731 3348 3248 NtQueryAttributesFile ({24, 0, 0x40, 0, 0, "\??\c:\php\php-4.2.1-win32\sapi\php4ts.dll"}, 1234824, ... ) == STATUS_OBJECT_NAME_NOT_FOUND
-733 3348 3248 NtQueryAttributesFile ({24, 108, 0x40, 0, 0, "php4ts.dll"}, 1234824, ... ) == STATUS_OBJECT_NAME_NOT_FOUND
-735 3348 3248 NtQueryAttributesFile ({24, 0, 0x40, 0, 0, "\??\C:\WINNT\System32\php4ts.dll"}, 1234824, ... ) == STATUS_OBJECT_NAME_NOT_FOUND
- [...]
-
- This went on quiet some time for all directories in the %PATH%
- environment variable. The solution finally was to copy
- php4ts.dll in any of the directories searched by the System (I
- prefered to use c:\php\php-4.2.1-win32\sapi).
-
- Note: This does not only apply to php4ts.dll but in fact to every
- DLL which gets loaded through PHP too. So, if you've
- problems running your PHP CLI application because it
- can't load a certain library but you're sure it's there,
- try this tool.
-
-
- I'm using IIS/CGI and everytime I try to access a php file I get
- "Security Alert! The PHP CGI cannot be accessed directly."
-
- Since 4.1.2, the php.ini setting cgi.force_redirect defaults to '1' which
- effectively prevents the cgi from working within IIS. You need to set up at
- least a minimal php.ini file with the following directive:
-
- cgi.force_redirect = 0
-
- If it doesn't work immidiately, make sure you have the php.ini file in the
- right place (%SYSTEMROOT%\php.ini).
-
-
- Other problems
- If you are still stuck, someone on the PHP installation mailing list may be
- able to help you. You should check out the archive first, in case
- someone already answered someone else who had the same problem as
- you. The archives are available from the support page on www.php.net
- To subscribe to the PHP installation mailing list, send an empty mail to:
-
- php-install-subscribe@lists.php.net
-
- The mailing list address is php-install@lists.php.net
-
- If you want to get help on the mailing list, please try to be
- precise and give the necessary details about your environment
- (which operating system, what PHP version, what web server, if
- ou are running PHP as CGI or a server module, etc.), and
- referably enough code to make others able to reproduce and test
- our problem.
-
-Bug reports
-===========
-
- If you think you have found a bug in PHP, please report it. The
- PHP developers probably don't know about it, and unless you
- report it, chances are it won't be fixed.
-
- 1) Read about Bugs-Dos-And-Donts
- http://bugs.php.net/bugs-dos-and-donts.php
-
- 2) If you think you've found a bug, read
- http://bugs.php.net/bugs-dos-and-donts.php
-
- 3) Feel welcome to file a report at
- http://bugs.php.net/
diff --git a/win32/installer/README b/win32/installer/README
deleted file mode 100644
index 4c79b9a623..0000000000
--- a/win32/installer/README
+++ /dev/null
@@ -1,93 +0,0 @@
-PHP Installer for Win32, by Wez Furlong <wez@thebrainroom.com>
-==============================================================
-$Id$
-
-Here are the supporting scripts for building the win32 PHP installer.
-
-Requirements:
-
- MSI-2-XML from http://msi2xml.sourceforge.net/#Installation
-
-
-Installer Layout:
-
-We have the following features:
-
- o PHP Core - Always installed.
- Includes php4ts.dll, php.ini + common dlls
- and config files
-
- o SAPI
- Contains a node for each stable SAPI
-
- o Extensions
- Contains a node for each stable extension
-
- o Experimental
- o SAPI Experimental SAPIs
- o Extensions Experimental Extensions
-
-
-
-
-
-
-
-
-You need to have the Super-Pimp Installer from Nullsoft (Open Source).
-It is available here:
- http://nsis.sourceforge.net/
-
-To build an installer, you need:
-
- o A Source Tree
- o A win32 snapshot (extracted from the .zip)
-
- (The source tree and snapshot should have matching versions!)
-
-A Script/Batch file.
-I'm using this (in a .bat file):
-
-----------------------------------------------------------------
-cd <snapshot_root>
-cli\php <source_root>\win32\installer\gen-nsis.php > php.nsi
-"C:\Program Files\NSIS\makensis" /pause /nocd php.nsi
-----------------------------------------------------------------
-
- ** It is a good idea to examine the php.nsi file for WARNING
- ** comments. These indicate inconsistencies about your source
- ** tree structure.
-
-This will generate InstallPHP<Version>.exe, where <Version> is the version of
-the php in the snapshot. The Installer will be placed in the snapshot root.
-
-Installer Concept
-=================
-
-Maintaining installers is a real chore, so we use PHP to generate as much as
-possible.
-
-The gen-nsis.php script will examine the extensions dir from the snapshot and
-then attempt to extract information about the extensions from the source code.
-The sapi dir is subjected to similar treatment.
-
-Throughout the installation, values for php.ini settings are decided; these are
-appended to a temporary file. After everything has been installed, the
-iniset.php script is run and merges the values from the temporary file into the
-"official" php.ini.
-
-These scripts take advantage of features found in PHP 4.3.0 and later, so you
-can't build a PHP 4.2.x distro with it.
-
-Hacking
-=======
-
-While hacking, it's a good idea to comment out the SetCompressor line; it will
-speed up your installer builds...
-Also, switch the logic for the $SYSDIR define at the top to install vital DLLs
-to a fake system dir.
-
-
-
-vim:et:tw=78
-
diff --git a/win32/installer/gen-nsis.php b/win32/installer/gen-nsis.php
deleted file mode 100644
index 7e9938f4c6..0000000000
--- a/win32/installer/gen-nsis.php
+++ /dev/null
@@ -1,446 +0,0 @@
-; PHP Installer for NSIS
-; Based on Welcome/Finish Page Example Script (Written by Joost Verburg)
-; Author: Wez Furlong <wez@thebrainroom.com>
-; $Id$
-<?php
-
-define('PHPVERSION', phpversion());
-define('SOURCEDIR', dirname(__FILE__) . "\\..\\..\\");
-define('DISTDIR', getcwd());
-
-/* for testing, install system files in a safe dir */
-
-if (false) {
- $SYSDIR = "\$INSTDIR\\system";
-} else {
- $SYSDIR = "\$SYSDIR";
-}
-
-$sections = array(
- "core" => array(
- "label" => "-PHP Core (Required)",
- "files" => array(
- "$SYSDIR" => array(
- "dlls\\*.dll",
- "php4ts.dll",
- ),
- "\$INSTDIR" => array(
- "*.txt",
- "php.gif",
- "php.ini-*",
- ),
- ),
- "extras" => "Call CopyPHPIni\nWriteUninstaller \"\$INSTDIR\\Uninstall.exe\""
- ),
-
- "cgi" => array(
- "group" => "SAPI",
- "label" => "CGI",
- "description" => "CGI Interface - should work with most web servers",
- "files" => array(
- "\$INSTDIR" => array(
- "php.exe"
- ),
- "\$INSTDIR\\sapi" => array(
- "sapi\\pws-php4cgi.reg"
- ),
- ),
- ),
-
- /* CLI is required by the installer */
- "cli" => array(
- "group" => "SAPI",
- "label" => "-CLI",
- "description" => "Command Line Interface for running PHP scripts as batch files",
- "files" => array(
- "\$INSTDIR\\cli" => array(
- "cli\\php.exe"
- ),
- ),
- ),
-
- "embed" => array(
- "group" => "SAPI",
- "label" => "Embed",
- "description" => "Libraries for embedding PHP into your own projects",
- "files" => array(
- "\$INSTDIR" => array(
- "*.lib"
- ),
- ),
- ),
-
- "mibs" => array(
- "group" => "Extras",
- "label" => "MIBS for SNMP",
- "description" => "MIB information for the SNMP extension",
- "files" => array(
- "\$INSTDIR\\mibs" => array(
- "mibs\\*"
- ),
- ),
- ),
-
- "pdfstuff" => array(
- "group" => "Extras",
- "label" => "PDF support files",
- "description" => "Fonts and codepage data files for the PDF extensions",
- "files" => array(
- "\$INSTDIR\\pdf-related" => array(
- "pdf-related\\*"
- ),
- ),
- ),
-
- "mimemagic" => array(
- "group" => "Extras",
- "label" => "Mime Magic",
- "description" => "The magic information file for the mimemagic extension",
- "files" => array(
- "\$INSTDIR" => array(
- "magic.mime"
- ),
- ),
- ),
-
- "openssl" => array(
- "group" => "Extras",
- "label" => "OpenSSL",
- "description" => "OpenSSL configuration information which you must read if you plan to use PHP as a Certificate Authority",
- "files" => array(
- "\$INSTDIR\\openssl" => array(
- "openssl\\*"
- ),
- ),
- ),
-
-
-
-);
-
-$groups = array(
- 'SAPI' => array("SAPI", "Select which Server API's to install."),
- 'EXT' => array("Extensions", "Select which extensions to install."),
- 'XSAPI' => array("Experimental SAPI", "Experimental Server API's - use at your own risk!"),
- 'XEXT' => array("Experimental Extensions", "Experimental Extensions - use at your own risk!"),
- 'Extras' => array("Extras", "Supplemental Files"),
- );
-
-function xglob($pattern)
-{
- if (strpos($pattern, '*') === false) {
- return array($pattern);
- }
- $dir = dirname($pattern);
- $pattern = basename($pattern);
-
- $pattern = str_replace(array('*', '.'), array('.*', '\.'), $pattern);
-
- $files = array();
-
- $d = opendir($dir);
- while ($f = readdir($d)) {
- if ($f == '.' || $f == '..' || preg_match('/^\..*\.swp$/', $f))
- continue;
- if (preg_match('@' . $pattern . '@i', $f)) {
- $files[] = $dir . '\\' . $f;
- }
- }
-
- return $files;
-}
-
-/* Look for extensions and determine their info based on the source tree.
- * We can determine the name and author from the CREDITS file.
- * We can determine experimental status from the EXPERIMENTAL file.
- * It would be nice to have a standard description line in the CREDITS too.
- */
-$extension_abbreviations = array(
- 'ifx' => 'informix',
- 'gd2' => 'gd',
- );
-
-$sapi_abbreviations = array(
- 'apache2' => 'apache2filter',
- 'srvlt' => 'servlet',
-);
-
-function add_sections($pattern, $groupname, $abbrev, &$sections, $sourcedirs, $instdir)
-{
- $avail = xglob($pattern);
-
- foreach ($avail as $extname) {
- /* mangle name */
- if (preg_match('/(php_|php4|php)([^_].*)\.dll/', basename($extname), $matches)) {
- $ext = $matches[2];
- } else {
- $ext = basename($extname);
- }
-
- if (isset($abbrev[$ext])) {
- $ext = $abbrev[$ext];
- }
-
- $extdir = null;
-
- foreach ($sourcedirs as $sourcedir) {
- // Allow absolute path for separate PECL checkout
- if ($sourcedir{0} == '\\' || $sourcedir{1} == ':')
- $extdir = $sourcedir;
- else
- $extdir = SOURCEDIR . $sourcedir . '/' . $ext . '/';
-
- if (is_dir($extdir))
- break;
-
- $extdir = null;
- }
-
- if ($extdir === null || !is_dir($extdir)) {
- echo "; WARNING: could not find source dir for extension $extname -> $extdir ($ext)\n";
- }
-
- $exp = file_exists($extdir . 'EXPERIMENTAL');
- if (file_exists($extdir . 'CREDITS')) {
- list($title, $authors, $description) = file($extdir . 'CREDITS');
- $title = trim($title);
- $authors = trim($authors);
- $description = trim($description);
-
- if (strlen($title) == 0)
- $title = $ext;
-
- } else {
- $title = $ext;
- $authors = "Unknown, or uncredited";
- $description = "";
- }
-
- /* build list of support files.
- * in theory, only needed for the srvlt sapi, but useful to keep this
- * generic */
- $filepat = preg_replace('/\.[^\.]+$/', '.*', $extname);
-
- if ($groupname == 'EXT') {
- }
-
- $sections['ext_' . $ext] = array(
- 'group' => ($exp ? 'X' : '') . $groupname,
- 'label' => $title,
- 'description' => $title . ".\$\\nAuthors: $authors",
- 'files' => array(
- "\$INSTDIR\\" . $instdir => array(
- $filepat
- ),
- ),
-/* 'extras' => $groupname == 'EXT' ? "Push \"extension=" . basename($extname) . "\"\nCall AddIniSetting\n\n" : "" */
- );
-
- }
-
-
-}
-
-add_sections('extensions\\*.dll', 'EXT', $extension_abbreviations, $sections, array('ext'), 'extensions');
-add_sections('sapi\\*.dll', 'SAPI', $sapi_abbreviations, $sections, array('sapi'), 'sapi');
-
-
-
-
-
-$SECTIONS = "";
-$sections_stage1 = array();
-
-/* list of files to uninstall */
-$uninstall = array();
-$rmdirs = array();
-/* description texts */
-$descriptions = array();
-
-$dirs_no_delete = array("\$SYSDIR", "\$INSTDIR");
-
-foreach ($sections as $sectionid => $sectiondata) {
- $descriptions[] = "\t!insertmacro MUI_DESCRIPTION_TEXT \${Sec$sectionid} \"" . $sectiondata['description'] . "\"";
-
- if (isset($sectiondata['group'])) {
- $sub = "Sub";
- $group = $sectiondata['group'];
- } else {
- $sub = "";
- $group = '_top_';
- }
-
- $body = "Section \"" . $sectiondata['label'] . "\" Sec$sectionid\n";
-
- foreach ($sectiondata['files'] as $outputdir => $filelist) {
- $body .= "\tSetOutPath \"$outputdir\"\n";
- foreach ($filelist as $pattern) {
- $files = xglob($pattern);
- foreach ($files as $filename) {
- $uninstall[] = "\tDelete \"$outputdir\\" . basename($filename) . "\"";
-
- $body .= "\tFile \"$filename\"\n";
- }
- }
- if (!in_array($outputdir, $dirs_no_delete) && !isset($rmdirs[$outputdir])) {
- $rmdirs[$outputdir] = "\tRMDir \"$outputdir\"";
- }
- }
-
- $body .= $sectiondata['extras'];
-
- $body .= "\nSectionEnd\n";
-
- $sections_stage1[$group] .= $body . "\n\n";
-}
-
-foreach ($sections_stage1 as $group => $data)
-{
- if ($group == '_top_') {
- $SECTIONS .= $data . "\n";
- } else {
- $descriptions[] = "\t!insertmacro MUI_DESCRIPTION_TEXT \${SecGroup$group} \"" . $groups[$group][1] . "\"";
- $SECTIONS .= "SubSection /e \"" . $groups[$group][0] . "\" SecGroup$group\n$data\nSubSectionEnd\n\n";
- }
-}
-
-/* Now build descriptions */
-$DESCRIPTIONS = implode("\n", $descriptions) . "\n";
-
-/* And the uninstallation section */
-$UNINSTALL = implode("\n", $uninstall) . "\n" . implode("\n", $rmdirs) . "\n";
-
-?>
-
-!define MUI_PRODUCT "PHP - Hypertext Preprocessor"
-!define MUI_VERSION "<?= PHPVERSION ?>"
-; The second UI has a wider area for the component names
-!define MUI_UI "${NSISDIR}\Contrib\UIs\modern2.exe"
-
-!include "${NSISDIR}\Contrib\Modern UI\System.nsh"
-
-;--------------------------------
-;Configuration
-
-!define MUI_WELCOMEPAGE
-!define MUI_LICENSEPAGE
-!define MUI_COMPONENTSPAGE
-!define MUI_DIRECTORYPAGE
-
-!define MUI_FINISHPAGE
-;!define MUI_FINISHPAGE_RUN "$INSTDIR\modern.exe"
-
-!define MUI_ABORTWARNING
-
-!define MUI_UNINSTALLER
-!define MUI_UNCONFIRMPAGE
-
-;Language
-!insertmacro MUI_LANGUAGE "English"
-
-;General
-OutFile "InstallPHP<?= PHPVERSION ?>.exe"
-
-SetCompressor bzip2
-ShowInstDetails show
-;License page
-LicenseData "license.txt"
-
-;Folder-selection page
-InstallDir "C:\PHP-<?= PHPVERSION ?>"
-;define NSIS_CONFIG_LOG "install.log"
-;LogSet on
-
-!cd <?= SOURCEDIR ?>win32\installer
-
-;Things that need to be extracted on startup (keep these lines before any File command!)
-;Only useful for BZIP2 compression
-;Use ReserveFile for your own Install Options ini files too!
-!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
-!insertmacro MUI_RESERVEFILE_SPECIALINI
-!insertmacro MUI_RESERVEFILE_SPECIALBITMAP
-
-!cd <?= DISTDIR ?>
-
-!insertmacro MUI_SYSTEM
-
-
-;--------------------------------
-;Installer Sections
-
-Function AddIniSetting
- Pop $R0
-
- FileOpen $R2 "$INSTDIR\.ini-add" "a"
- FileSeek $R2 0 END
- FileWrite $R2 "$R0$\n"
- FileClose $R2
-
-FunctionEnd
-
-Function CopyPHPIni
- ; Ensure that we have a working php.ini to reflect the
- ; installation options.
- ; Extensions will call a function to activate their entry
- ; in the ini file as they are installed.
-
- Rename "$WINDIR\php.ini" "$WINDIR\php.ini.old"
- CopyFiles "$INSTDIR\php.ini-dist" "$WINDIR\php.ini"
-
-; These files will be deleted during post-installation
- CopyFiles "<?= $SYSDIR ?>\php4ts.dll" "$INSTDIR\php4ts.dll"
- File "<?= dirname(__FILE__) ?>\setini.php"
-
-; Set the extension_dir setting in the php.ini
- Push "extension_dir=$\"$INSTDIR\extensions$\""
- Call AddIniSetting
-
-FunctionEnd
-
-; Generated Section Info
-<?= $SECTIONS ?>
-; ---------
-
-; Perform final actions after everything has been installed
-Section -post
- ; Merge ini settings
-
- Sleep 1000
-
- ExecWait "$\"$INSTDIR\cli\php.exe$\" $\"-n$\" $\"$INSTDIR\setini.php$\" $\"$WINDIR\php.ini$\" $\"$INSTDIR\.ini-add$\""
-
- Delete "$INSTDIR\.ini-add" ; Created by the AddIniSetting function
- Delete "$INSTDIR\setini.php"
- Delete "$INSTDIR\php4ts.dll"
-
- ; Add to Add/Remove programs list
- WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\PHP-<?= PHPVERSION ?>" "UninstallString" "$INSTDIR\Uninstall.exe"
- WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\PHP-<?= PHPVERSION ?>" "DisplayName" "PHP-<?= PHPVERSION ?> (Uninstall only)"
-
-
-SectionEnd
-
-;--------------------------------
-;Descriptions
-
-!insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN
-<?= $DESCRIPTIONS ?>
-!insertmacro MUI_FUNCTIONS_DESCRIPTION_END
-
-;--------------------------------
-;Uninstaller Section
-
-Section "Uninstall"
-<?= $UNINSTALL ?>
-
- Delete "$INSTDIR\Uninstall.exe"
- Delete "$WINDIR\php.ini"
- RMDir "$INSTDIR"
- ; Remove from Add/Remove programs list
- DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\PHP-<?= PHPVERSION ?>"
-
- !insertmacro MUI_UNFINISHHEADER
-
-SectionEnd
-; vim:sw=4:ts=4:
-; vim600:sw=4:ts=4:noet:fdm=marker
diff --git a/win32/installer/setini.php b/win32/installer/setini.php
deleted file mode 100644
index cdcb65fc07..0000000000
--- a/win32/installer/setini.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-/* $Id$
- * Wez Furlong <wez@thebrainroom.com>
- *
- * Set options in a php.ini file.
- * This is a support script for the installer.
- *
- * $argv[1] is the path to the ini file
- * $argv[2] is the path to the option file
- */
-
-echo "Running post-installation script to configure php.ini\n";
-
-function fatal($msg)
-{
- echo $msg;
- sleep(5);
- exit(1);
-}
-
-$ini_name = $argv[1];
-$option_file = $argv[2];
-
-if (!file_exists($option_file)) {
- fatal("Option file $option_file does not exist");
-}
-
-if (!file_exists($ini_name)) {
- fatal("inifile $ini_name does not exist");
-}
-
-$options = explode("\n", file_get_contents($option_file));
-$opts = array();
-
-/* Parse the options */
-foreach ($options as $line) {
- if (strlen(trim($line)) == 0)
- continue;
-
- list($name, $value) = explode("=", $line);
-
- if ($name == "extension") {
- $pat = "/^;?extension\s*=\s*" . preg_quote($value, '/') . "/i";
- } else {
- $pat = "/^;?" . preg_quote($name, '/') . "\s*=\s*/i";
- }
-
- $opts[] = array('pat' => $pat, 'name' => $name, 'value' => $value);
-}
-
-$new_name = $ini_name . "~";
-$dest = fopen($new_name, "w");
-
-if (!$dest) {
- echo "Could not create temporary file! $new_name\n";
- flush();
- sleep(10);
- die("Cannot create temporary file!");
-}
-
-$lines = file($ini_name);
-
-foreach ($lines as $line) {
-
- foreach ($opts as $k => $optdata) {
- extract($optdata);
-
- if (preg_match($pat, $line)) {
- echo "Found $pat ; setting $name to $value\n";
- $line = "$name=$value\r\n";
- // No need to match again
- unset($opts[$k]);
- break;
- }
- }
-
- fwrite($dest, $line);
-}
-
-fclose($dest);
-
-unlink($ini_name);
-rename($new_name, $ini_name);
-
-echo "All done!\n";
-sleep(1);
-?>
diff --git a/win32/md5crypt.c b/win32/md5crypt.c
deleted file mode 100644
index e66c0b42fd..0000000000
--- a/win32/md5crypt.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Edin Kadribasic |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- * from FreeBSD: crypt.c,v 1.5 1996/10/14 08:34:02 phk Exp
- * via OpenBSD: md5crypt.c,v 1.9 1997/07/23 20:58:27 kstailey Exp
- * via NetBSD: md5crypt.c,v 1.4.2.1 2002/01/22 19:31:59 he Exp
- *
- */
-
-#include "php.h"
-#include "ext/standard/md5.h"
-#include "md5crypt.h"
-
-static unsigned char itoa64[] = /* 0 ... 63 => ascii - 64 */
- "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
-static void to64(char *, php_uint32, int);
-
-static void
-to64(char *s, php_uint32 v, int n)
-{
-
- while (--n >= 0) {
- *s++ = itoa64[v & 0x3f];
- v >>= 6;
- }
-}
-
-/*
- * MD5 password encryption.
- */
-char *
-md5_crypt(const char *pw, const char *salt)
-{
- static char passwd[120], *p;
- const char *sp, *ep;
- unsigned char final[16];
- unsigned int i, sl, pwl;
- PHP_MD5_CTX ctx, ctx1;
- php_uint32 l;
- int pl;
-
- pwl = strlen(pw);
-
- /* Refine the salt first */
- sp = salt;
-
- /* If it starts with the magic string, then skip that */
- if (strncmp(sp, MD5_MAGIC, MD5_MAGIC_LEN) == 0)
- sp += MD5_MAGIC_LEN;
-
- /* It stops at the first '$', max 8 chars */
- for (ep = sp; *ep != '\0' && *ep != '$' && ep < (sp + 8); ep++)
- continue;
-
- /* get the length of the true salt */
- sl = ep - sp;
-
- PHP_MD5Init(&ctx);
-
- /* The password first, since that is what is most unknown */
- PHP_MD5Update(&ctx, (const unsigned char *)pw, pwl);
-
- /* Then our magic string */
- PHP_MD5Update(&ctx, (const unsigned char *)MD5_MAGIC, MD5_MAGIC_LEN);
-
- /* Then the raw salt */
- PHP_MD5Update(&ctx, (const unsigned char *)sp, sl);
-
- /* Then just as many characters of the MD5(pw,salt,pw) */
- PHP_MD5Init(&ctx1);
- PHP_MD5Update(&ctx1, (const unsigned char *)pw, pwl);
- PHP_MD5Update(&ctx1, (const unsigned char *)sp, sl);
- PHP_MD5Update(&ctx1, (const unsigned char *)pw, pwl);
- PHP_MD5Final(final, &ctx1);
-
- for (pl = pwl; pl > 0; pl -= 16)
- PHP_MD5Update(&ctx, final, (unsigned int)(pl > 16 ? 16 : pl));
-
- /* Don't leave anything around in vm they could use. */
- memset(final, 0, sizeof(final));
-
- /* Then something really weird... */
- for (i = pwl; i != 0; i >>= 1)
- if ((i & 1) != 0)
- PHP_MD5Update(&ctx, final, 1);
- else
- PHP_MD5Update(&ctx, (const unsigned char *)pw, 1);
-
- /* Now make the output string */
- memcpy(passwd, MD5_MAGIC, MD5_MAGIC_LEN);
- strlcpy(passwd + MD5_MAGIC_LEN, sp, sl + 1);
- strcat(passwd, "$");
-
- PHP_MD5Final(final, &ctx);
-
- /*
- * And now, just to make sure things don't run too fast. On a 60 MHz
- * Pentium this takes 34 msec, so you would need 30 seconds to build
- * a 1000 entry dictionary...
- */
- for (i = 0; i < 1000; i++) {
- PHP_MD5Init(&ctx1);
-
- if ((i & 1) != 0)
- PHP_MD5Update(&ctx1, (const unsigned char *)pw, pwl);
- else
- PHP_MD5Update(&ctx1, final, 16);
-
- if ((i % 3) != 0)
- PHP_MD5Update(&ctx1, (const unsigned char *)sp, sl);
-
- if ((i % 7) != 0)
- PHP_MD5Update(&ctx1, (const unsigned char *)pw, pwl);
-
- if ((i & 1) != 0)
- PHP_MD5Update(&ctx1, final, 16);
- else
- PHP_MD5Update(&ctx1, (const unsigned char *)pw, pwl);
-
- PHP_MD5Final(final, &ctx1);
- }
-
- p = passwd + sl + MD5_MAGIC_LEN + 1;
-
- l = (final[ 0]<<16) | (final[ 6]<<8) | final[12]; to64(p,l,4); p += 4;
- l = (final[ 1]<<16) | (final[ 7]<<8) | final[13]; to64(p,l,4); p += 4;
- l = (final[ 2]<<16) | (final[ 8]<<8) | final[14]; to64(p,l,4); p += 4;
- l = (final[ 3]<<16) | (final[ 9]<<8) | final[15]; to64(p,l,4); p += 4;
- l = (final[ 4]<<16) | (final[10]<<8) | final[ 5]; to64(p,l,4); p += 4;
- l = final[11] ; to64(p,l,2); p += 2;
- *p = '\0';
-
- /* Don't leave anything around in vm they could use. */
- memset(final, 0, sizeof(final));
- return (passwd);
-}
-
diff --git a/win32/md5crypt.h b/win32/md5crypt.h
deleted file mode 100644
index 7f5eb63f9f..0000000000
--- a/win32/md5crypt.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Edin Kadribasic |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-#ifndef _MD5CRYPT_H_
-#define _MD5CRYPT_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define MD5_MAGIC "$1$"
-#define MD5_MAGIC_LEN 3
-
-char *md5_crypt(const char *pw, const char *salt);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _MD5CRYPT_H_ */ \ No newline at end of file
diff --git a/win32/param.h b/win32/param.h
deleted file mode 100644
index 3d0da1e8d3..0000000000
--- a/win32/param.h
+++ /dev/null
@@ -1,16 +0,0 @@
-
-/*****************************************************************************
- * *
- * sys/param.c *
- * *
- * Freely redistributable and modifiable. Use at your own risk. *
- * *
- * Copyright 1994 The Downhill Project *
- * *
- *****************************************************************************/
-#ifndef MAXPATHLEN
-#define MAXPATHLEN _MAX_PATH
-#endif
-#define MAXHOSTNAMELEN 64
-#define howmany(x,y) (((x)+((y)-1))/(y))
-#define roundup(x,y) ((((x)+((y)-1))/(y))*(y))
diff --git a/win32/php4.dsp b/win32/php4.dsp
deleted file mode 100644
index 1e8d7f4e45..0000000000
--- a/win32/php4.dsp
+++ /dev/null
@@ -1,134 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=php4 - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4.mak" CFG="php4 - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4 - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "php4 - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "php4 - Win32 Release_inline" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4 - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release"
-# PROP Intermediate_Dir "..\Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\Zend" /I "..\regex\\" /I "..\..\bindlib_w32" /I "..\TSRM" /D "NDEBUG" /D "_CONSOLE" /D ZEND_DEBUG=0 /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 php4nts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php.exe" /libpath:"..\Release"
-
-!ELSEIF "$(CFG)" == "php4 - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "c:\php-fcgi"
-# PROP Intermediate_Dir "..\Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\Zend" /I "..\regex\\" /I "..\..\bindlib_w32" /I "..\TSRM" /D "DEBUG" /D "_DEBUG" /D "_CONSOLE" /D "MSVC5" /D "PHP_WIN32" /D ZEND_DEBUG=1 /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /i "c:\include" /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4nts_debug.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"c:\php-fcgi\php.exe" /pdbtype:sept /libpath:"..\Debug"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "php4 - Win32 Release_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4___Win32_Release_inline"
-# PROP BASE Intermediate_Dir "php4___Win32_Release_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_inline"
-# PROP Intermediate_Dir "..\Release_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "Zend" /I "." /I "regex\\" /I "..\bindlib_w32" /D "NDEBUG" /D "MSVC5" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /Fr /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\Zend" /I "..\regex\\" /I "..\..\bindlib_w32" /I "..\TSRM" /D "NDEBUG" /D "_CONSOLE" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4nts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"Release\php.exe" /libpath:"Release"
-# ADD LINK32 php4nts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php.exe" /libpath:"..\Release_inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4 - Win32 Release"
-# Name "php4 - Win32 Debug"
-# Name "php4 - Win32 Release_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\sapi\cgi\cgi_main.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sapi\cgi\getopt.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ".h"
-# End Group
-# End Target
-# End Project
diff --git a/win32/php4.dsw b/win32/php4.dsw
deleted file mode 100644
index fa7afe1732..0000000000
--- a/win32/php4.dsw
+++ /dev/null
@@ -1,119 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "TSRM"=..\TSRM\TSRM.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Zend"=..\Zend\Zend.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "fastcgi"=..\sapi\fastcgi\fastcgi.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dll
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name Zend
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "libmysql"=..\ext\mysql\libmysql\libmysql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "php4"=.\php4.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dll
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name Zend
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4dll"=.\php4dll.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Zend
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name libmysql
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/win32/php4dll.dsp b/win32/php4dll.dsp
deleted file mode 100644
index ad79b5fa97..0000000000
--- a/win32/php4dll.dsp
+++ /dev/null
@@ -1,1813 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4dll" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4dll - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4dll.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4dll.mak" CFG="php4dll - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4dll - Win32 Release_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "c:\php-fcgi\"
-# PROP Intermediate_Dir "..\Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\bundle\expat" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D "TSRM_EXPORTS" /D "MSVC5" /D "PHP_WIN32" /D ZEND_DEBUG=1 /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib resolv.lib libmysql.lib TSRM.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"libcmt" /nodefaultlib:"libc" /nodefaultlib:"libcmtd" /out:"c:\php-fcgi\php4nts_debug.dll" /pdbtype:sept /libpath:"..\TSRM\Debug" /libpath:"..\Zend\Debug" /libpath:"..\..\bindlib_w32\Debug" /libpath:"..\ext\mysql\libmysql\Debug"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release"
-# PROP Intermediate_Dir "..\Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\Zend" /I "..\regex" /I "..\..\bindlib_w32" /I "..\TSRM" /I "..\bundle\expat" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLL_EXPORTS" /D "PHP_EXPORTS" /D "SAPI_EXPORTS" /D "LIBZEND_EXPORTS" /D ZEND_DEBUG=0 /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib resolv.lib libmysql.lib tsrm.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php4nts.dll" /libpath:"..\Zend\Release" /libpath:"..\TSRM\Release_TS" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4dll___Win32_Release_inline"
-# PROP BASE Intermediate_Dir "php4dll___Win32_Release_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_inline"
-# PROP Intermediate_Dir "..\Release_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "Zend" /I "." /I "regex" /I "..\bindlib_w32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "MSVC5" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D ZEND_DEBUG=0 /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\bundle\expat" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib resolv.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /out:"Release/php4nts.dll" /libpath:"TSRM\Release" /libpath:"Zend\Release" /libpath:"..\bindlib_w32\Release"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib tsrm.lib resolv.lib libmysql.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php4nts.dll" /libpath:"..\Zend\Release_inline" /libpath:"..\TSRM\Release_TS_inline" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4dll - Win32 Debug"
-# Name "php4dll - Win32 Release"
-# Name "php4dll - Win32 Release_inline"
-# Begin Group "Core"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\aggregation.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\css.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\cyr_convert.c
-# End Source File
-# Begin Source File
-
-SOURCE="..\main\fopen_wrappers.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\internal_functions_win32.c
-# ADD CPP /I "..\bundle\expat\xmlparse" /I "..\bundle\expat\xmltok"
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\main.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\mergesort.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\network.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\output.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_content_types.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ini.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_logos.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_open_temporary_file.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ticks.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_variables.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\proc_open.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\quot_print.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\reentrancy.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\rfc1867.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\safe_mode.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\SAPI.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\snprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\spprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\memory_streams.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\user_streams.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\filters.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\user_filters.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\strlcat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\strlcpy.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\aggregation.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\css.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\cyr_convert.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\getopt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\internal_functions_registry.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\logos.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\main.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\output.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php3_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_content_types.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ini.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_logos.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_open_temporary_file.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_realpath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ticks.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_variables.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\quot_print.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\rfc1867.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\safe_mode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\SAPI.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\snprintf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\spprintf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\win95nt.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Function Modules"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\array.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\assert.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\base64.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\basic_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\bcmath.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\browscap.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\crc32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\credits.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\datetime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dir.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dl.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dns.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\exec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\file.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\filestat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\flock_compat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\formatted_print.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\fsock.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\ftp_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\head.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\html.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\http_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\image.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\incomplete_class.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\info.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\iptc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\lcg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\levenshtein.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\link.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\mail.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\math.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\md5.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\metaphone.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\microtime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_files.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_user.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pack.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pageinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\parsedate.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\mysql\php_mysql.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\odbc\php_odbc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\php_pcre.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\rand.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\reg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\scanf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\session.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\soundex.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\string.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\strnatcmp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\syslog.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\type.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\uniqid.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner_ex.c
-# ADD CPP /W2
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\var.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\var_unserializer.c
-# ADD CPP /W2
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\versioning.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\base64.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\basic_functions.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\datetime.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dl.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dns.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\exec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\file.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\flock_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\fsock.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\global.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\head.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\html.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\md5.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\mime.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_user.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pageinfo.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\php_bcmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_dir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_filestat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_fopen_wrappers.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ldap\php_ldap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_mail.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_metaphone.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\mysql\php_mysql.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\odbc\php_odbc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\php_pcre.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_string.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\phpdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\phpmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\reg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\scanf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\type.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\uniqid.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner_ex.h
-# End Source File
-# End Group
-# Begin Group "Regular Expressions"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\regex\regcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regexec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regfree.c
-# End Source File
-# End Group
-# Begin Group "PCRE"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 3"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\chartables.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\get.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\maketables.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\study.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files No. 3"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\internal.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "XML"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 4"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\ctype\ctype.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\overload\overload.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\tokenizer\tokenizer.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\wddx\wddx.c
-# ADD CPP /I "..\bundle\expat\xmltok" /I "..\bundle\expat\xmlparse"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\xml.c
-# ADD CPP /I "..\bundle\expat\xmltok" /I "..\bundle\expat\xmlparse"
-# End Source File
-# End Group
-# Begin Group "Header Files No. 4"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\xml\php_xml.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "FTP"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 6"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\ftp\ftp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ftp\php_ftp.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 6"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\ftp\ftp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ftp\php_ftp.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Calendar"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 7"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\calendar\cal_unix.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\calendar.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\dow.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\easter.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\french.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\gregor.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\jewish.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\julian.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 7"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\calendar\php_calendar.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\sdncal.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "bcmath"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 8"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\add.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\compare.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\debug.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\div.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\divmod.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\doaddsub.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\init.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\int2num.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\nearzero.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\neg.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\num2long.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\num2str.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\outofmem.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\output.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\raise.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\raisemod.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\recmul.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\rmzero.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\rt.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\sqrt.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\str2num.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\sub.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\zero.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files No. 8"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\bcmath.h
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\config.h
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\private.h
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-
-!ENDIF
-
-# End Source File
-# End Group
-# End Group
-# End Group
-# Begin Group "Win32"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\com\COM.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\conversion.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\pwd.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\readdir.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\registry.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\sendmail.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\time.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\VARIANT.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wfile.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\snmp\winsnmp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\winutil.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wsyslog.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\com\com.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\conversion.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\grp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\param.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\php_COM.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\php_registry.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\php_VARIANT.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\php_versioning.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\pwd.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\readdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\sendmail.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\time.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\unistd.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\variant.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wfile.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Parsers"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\parsedate.y
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# Begin Custom Build - Generating ext/standard/parsedate.c
-InputPath=..\ext\standard\parsedate.y
-
-"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- cd ..\ext\standard
- bison --output=parsedate.c -v -d parsedate.y
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# Begin Custom Build - Generating ext/standard/parsedate.c
-InputPath=..\ext\standard\parsedate.y
-
-"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- cd ..\ext\standard
- bison --output=parsedate.c -v -d parsedate.y
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# Begin Custom Build - Generating ext/standard/parsedate.c
-InputPath=..\ext\standard\parsedate.y
-
-"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- cd ..\ext\standard
- bison --output=parsedate.c -v -d parsedate.y
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Text Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ChangeLog
-# End Source File
-# Begin Source File
-
-SOURCE=..\LICENSE
-# End Source File
-# End Group
-# Begin Group "Support"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 5"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\bundle\expat\xmlparse.c
-# ADD CPP /D "COMPILED_FROM_DSP"
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\xmlrole.c
-# ADD CPP /D "COMPILED_FROM_DSP"
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\xmltok.c
-# ADD CPP /D "COMPILED_FROM_DSP"
-# End Source File
-# End Group
-# Begin Group "Header Files No. 5"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\bundle\expat\ascii.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\asciitab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\expat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\iasciitab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\latin1tab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\nametab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\utf8tab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\winconfig.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\xmlrole.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\xmltok.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\xmltok_impl.h
-# End Source File
-# End Group
-# End Group
-# End Target
-# End Project
diff --git a/win32/php4dllts.dsp b/win32/php4dllts.dsp
deleted file mode 100644
index 90f5d945aa..0000000000
--- a/win32/php4dllts.dsp
+++ /dev/null
@@ -1,2299 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4dllts" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4dllts - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4dllts.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4dllts.mak" CFG="php4dllts - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4dllts - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4dllts - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4dllts - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4dllts - Win32 Release_TSDbg" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\zlib" /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\bundle\expat" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib ws2_32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib zlib.lib Urlmon.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /out:"..\Debug_TS\php4ts_debug.dll" /pdbtype:sept /libpath:"..\TSRM\Debug_TS" /libpath:"..\Zend\Debug_TS" /libpath:"..\..\bindlib_w32\Debug" /libpath:"..\ext\mysql\libmysql\Debug_TS" /libpath:"Debug_TS" /libpath:"..\..\zlib\Debug"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\..\zlib" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\bundle\expat" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib ws2_32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib zlib.lib Urlmon.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libcmt" /out:"..\Release_TS\php4ts.dll" /libpath:"..\TSRM\Release_TS" /libpath:"..\Zend\Release_TS" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TS" /libpath:"Release_TS" /libpath:"..\..\zlib\Release"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4dllts___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php4dllts___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "regex" /I "..\bindlib_w32" /I "Zend" /I "tsrm" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "MSVC5" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\..\zlib" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\bundle\expat" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"Release_TS/php4ts.dll" /libpath:"TSRM\Release_TS" /libpath:"Zend\Release_TS" /libpath:"..\bindlib_w32\Release"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib ws2_32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib zlib.lib Urlmon.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libcmt" /out:"..\Release_TS_inline\php4ts.dll" /libpath:"..\TSRM\Release_TS_inline" /libpath:"..\Zend\Release_TS_inline" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TS_inline" /libpath:"Release_TS_Inline" /libpath:"..\..\zlib\Release"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4dllts___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "php4dllts___Win32_Release_TSDbg"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\bundle\expat" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\..\zlib" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\bundle\expat" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"..\Release_TS\php4ts.dll" /libpath:"..\TSRM\Release_TS" /libpath:"..\Zend\Release_TS" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TS" /libpath:"Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib ws2_32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib zlib.lib Urlmon.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /out:"..\Release_TSDbg\php4ts.dll" /libpath:"..\TSRM\Release_TSDbg" /libpath:"..\Zend\Release_TSDbg" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TSDbg" /libpath:"Release_TSDbg"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4dllts - Win32 Debug_TS"
-# Name "php4dllts - Win32 Release_TS"
-# Name "php4dllts - Win32 Release_TS_inline"
-# Name "php4dllts - Win32 Release_TSDbg"
-# Begin Group "Core"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\aggregation.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\css.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\cyr_convert.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\filters.c
-# End Source File
-# Begin Source File
-
-SOURCE="..\main\fopen_wrappers.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\internal_functions_win32.c
-# ADD CPP /I "..\bundle\expat\xmltok" /I "..\bundle\expat\xmlparse"
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\main.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\mergesort.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\network.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\output.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_content_types.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ini.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_logos.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_open_temporary_file.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_scandir.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ticks.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_variables.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\proc_open.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\quot_print.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\reentrancy.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\rfc1867.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\safe_mode.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\SAPI.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\snprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\spprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\strlcat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\strlcpy.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\aggregation.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\css.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\cyr_convert.h
-# End Source File
-# Begin Source File
-
-SOURCE="..\main\fopen_wrappers.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\getopt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\internal_functions_registry.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\logos.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\output.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php3_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_content_types.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ini.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_logos.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_main.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_open_temporary_file.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_output.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_regex.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_scandir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_streams.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_variables.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\quot_print.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\rfc1867.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\safe_mode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\SAPI.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\snprintf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\spprintf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\win95nt.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Function Modules"
-
-# PROP Default_Filter ""
-# Begin Group "PCRE"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 3"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\chartables.c
-# ADD CPP /D "STATIC" /D "SUPPORT_UTF8"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\get.c
-# ADD CPP /D "STATIC" /D "SUPPORT_UTF8" /D LINK_SIZE=2
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\maketables.c
-# ADD CPP /D "STATIC" /D "SUPPORT_UTF8" /D LINK_SIZE=2
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre.c
-# ADD CPP /D "STATIC" /D "SUPPORT_UTF8" /D LINK_SIZE=2
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\study.c
-# ADD CPP /D "STATIC" /D "SUPPORT_UTF8" /D LINK_SIZE=2
-# End Source File
-# End Group
-# Begin Group "Header Files No. 3"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\internal.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Regular Expressions"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\regex\regcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regexec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regfree.c
-# End Source File
-# End Group
-# Begin Group "XML"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 4"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\ctype\ctype.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\tokenizer\tokenizer.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\wddx\wddx.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# ADD CPP /I "..\bundle\expat\xmlparse" /I "..\bundle\expat\xmltok"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# ADD CPP /I "bundle\expat\xmlparse" /I "..\bundle\expat\xmltok" /I "..\bundle\expat\xmlparse"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# ADD CPP /I "bundle\expat\xmlparse" /I "..\bundle\expat\xmltok" /I "..\bundle\expat\xmlparse"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# ADD BASE CPP /I "bundle\expat\xmlparse" /I "..\bundle\expat\xmltok" /I "..\bundle\expat\xmlparse"
-# ADD CPP /I "bundle\expat\xmlparse" /I "..\bundle\expat\xmltok" /I "..\bundle\expat\xmlparse"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\xml.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# ADD CPP /I "..\bundle\expat\xmlparse" /I "..\bundle\expat\xmltok"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# ADD CPP /I "bundle\expat\xmlparse" /I "..\bundle\expat\xmltok" /I "..\bundle\expat\xmlparse"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# ADD CPP /I "bundle\expat\xmlparse" /I "..\bundle\expat\xmltok" /I "..\bundle\expat\xmlparse"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# ADD BASE CPP /I "bundle\expat\xmlparse" /I "..\bundle\expat\xmltok" /I "..\bundle\expat\xmlparse"
-# ADD CPP /I "bundle\expat\xmlparse" /I "..\bundle\expat\xmltok" /I "..\bundle\expat\xmlparse"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files No. 4"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\wddx\php_wddx.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\wddx\php_wddx_api.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\php_xml.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "FTP"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 6"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\ftp\ftp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ftp\php_ftp.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 6"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\ftp\ftp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ftp\php_ftp.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Calendar"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 7"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\calendar\cal_unix.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\calendar.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\dow.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\easter.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\french.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\gregor.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\jewish.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\julian.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 7"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\calendar\php_calendar.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\sdncal.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "bcmath"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 8"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\add.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\compare.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\debug.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\div.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\divmod.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\doaddsub.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\init.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\int2num.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\nearzero.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\neg.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\num2long.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\num2str.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\outofmem.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\output.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\raise.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\raisemod.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\recmul.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\rmzero.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\rt.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\sqrt.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\str2num.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\sub.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\zero.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files No. 8"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\bcmath.h
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\config.h
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\private.h
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ENDIF
-
-# End Source File
-# End Group
-# End Group
-# Begin Group "rpc"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 9"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\rpc\rpc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\rpc\rpc_proxy.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 9"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\rpc\handler.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\rpc\layer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\rpc\php_rpc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\rpc\rpc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\rpc\rpc_proxy.h
-# End Source File
-# End Group
-# Begin Group "com"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 10"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\rpc\com\com.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\rpc\com\com_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\rpc\com\conversion.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\rpc\com\dispatch.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\rpc\com\variant.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 10"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\rpc\com\com.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\rpc\com\com_wrapper.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\rpc\com\conversion.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\rpc\com\variant.h
-# End Source File
-# End Group
-# End Group
-# End Group
-# Begin Group "zlib"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 10 Nr. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\zlib\zlib.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\zlib\zlib_fopen_wrapper.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 10 Nr. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\zlib\php_zlib.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Standard"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\array.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\assert.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\base64.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\basic_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\bcmath.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\browscap.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\crc32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\credits.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\crypt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\datetime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dir.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dl.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dns.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\exec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\file.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\filestat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\flock_compat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\formatted_print.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\fsock.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\ftp_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\head.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\html.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\http_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\image.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\incomplete_class.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\info.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\iptc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\lcg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\levenshtein.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\link.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\mail.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\math.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\md5.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\metaphone.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\microtime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_files.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_user.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pack.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pageinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\parsedate.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\mcal\php_mcal.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\mysql\php_mysql.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\odbc\php_odbc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\php_pcre.c
-# ADD CPP /D "STATIC"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\rand.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\reg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\scanf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\session.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\sha1.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\soundex.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\streamsfuncs.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\string.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\strnatcmp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\sunfuncs.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\syslog.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\type.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\uniqid.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner_ex.c
-# ADD CPP /W2
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\var.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\var_unserializer.c
-# ADD CPP /W2
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\versioning.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\base64.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\basic_functions.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\datetime.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dl.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dns.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\exec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\file.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\flock_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\fsock.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\global.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\head.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\html.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\info.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\md5.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_user.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pageinfo.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_array.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\php_bcmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_crypt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_dir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_filestat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_fopen_wrappers.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_lcg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ldap\php_ldap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_mail.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\mcal\php_mcal.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\mysql\php_mysql.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\odbc\php_odbc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\odbc\php_odbc_includes.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\php_pcre.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_rand.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\php_session.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_string.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_sunfuncs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\phpdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\phpmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\reg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\scanf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\sha1.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\type.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\uniqid.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner_ex.h
-# End Source File
-# End Group
-# End Group
-# End Group
-# Begin Group "Win32"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\crypt_win32.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\glob.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\md5crypt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\pwd.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\readdir.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\registry.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\select.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\sendmail.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\time.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wfile.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\snmp\winsnmp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\winutil.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wsyslog.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\crypt_win32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\glob.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\grp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\param.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\php_registry.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\pwd.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\readdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\select.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\sendmail.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\time.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\unistd.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wfile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\winutil.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Parsers"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\parsedate.y
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# Begin Custom Build - Generating ext/standard/parsedate.c
-InputPath=..\ext\standard\parsedate.y
-
-"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- cd ..\ext\standard
- bison --output=parsedate.c -v -d parsedate.y
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# Begin Custom Build - Generating ext/standard/parsedate.c
-InputPath=..\ext\standard\parsedate.y
-
-"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- cd ..\ext\standard
- bison --output=parsedate.c -v -d parsedate.y
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# Begin Custom Build - Generating ext/standard/parsedate.c
-InputPath=..\ext\standard\parsedate.y
-
-"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- cd ..\ext\standard
- bison --output=parsedate.c -v -d parsedate.y
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# Begin Custom Build - Generating ext/standard/parsedate.c
-InputPath=..\ext\standard\parsedate.y
-
-"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- cd ..\ext\standard
- bison --output=parsedate.c -v -d parsedate.y
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Text Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ChangeLog
-# End Source File
-# Begin Source File
-
-SOURCE=..\LICENSE
-# End Source File
-# Begin Source File
-
-SOURCE=..\NEWS
-# End Source File
-# Begin Source File
-
-SOURCE="..\php.ini-dist"
-# End Source File
-# Begin Source File
-
-SOURCE="..\php.ini-recommended"
-# End Source File
-# Begin Source File
-
-SOURCE="..\README.CVS-RULES"
-# End Source File
-# Begin Source File
-
-SOURCE=..\TODO
-# End Source File
-# End Group
-# Begin Group "Support"
-
-# PROP Default_Filter ""
-# Begin Group "Expat"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 5"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\bundle\expat\xmlparse.c
-# ADD CPP /D "COMPILED_FROM_DSP"
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\xmlrole.c
-# ADD CPP /D "COMPILED_FROM_DSP"
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\xmltok.c
-# ADD CPP /D "COMPILED_FROM_DSP"
-# End Source File
-# End Group
-# Begin Group "Header Files No. 5"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\bundle\expat\ascii.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\asciitab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\expat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\iasciitab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\latin1tab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\nametab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\utf8tab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\winconfig.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\xmlrole.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\xmltok.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\bundle\expat\xmltok_impl.h
-# End Source File
-# End Group
-# End Group
-# End Group
-# Begin Group "Streams"
-
-# PROP Default_Filter ""
-# Begin Group "streams headers"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\main\streams\php_stream_context.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\php_stream_filter_api.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\php_stream_mmap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\php_stream_plain_wrapper.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\php_stream_transport.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\php_stream_userspace.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\php_streams_int.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=..\main\streams\cast.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\filter.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\memory.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\mmap.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\plain_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\streams.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\transports.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\user_filters.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\userspace.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\xp_socket.c
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\php4dllts.rc
-# End Source File
-# Begin Source File
-
-SOURCE=.\php4dllts.rc2
-# End Source File
-# End Target
-# End Project
diff --git a/win32/php4dllts.rc b/win32/php4dllts.rc
deleted file mode 100644
index fc46520710..0000000000
--- a/win32/php4dllts.rc
+++ /dev/null
@@ -1,126 +0,0 @@
-//Microsoft Developer Studio generated resource script.
-
-//
-
-#include "resource.h"
-
-
-
-#define APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-
-//
-
-// Generated from the TEXTINCLUDE 2 resource.
-
-//
-
-#include "winres.h"
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-#undef APSTUDIO_READONLY_SYMBOLS
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-// English (U.S.) resources
-
-
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-
-#ifdef _WIN32
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-#pragma code_page(1252)
-
-#endif //_WIN32
-
-
-
-#ifdef APSTUDIO_INVOKED
-
-/////////////////////////////////////////////////////////////////////////////
-
-//
-
-// TEXTINCLUDE
-
-//
-
-
-
-1 TEXTINCLUDE DISCARDABLE
-
-BEGIN
-
- "resource.h\0"
-
-END
-
-
-
-2 TEXTINCLUDE DISCARDABLE
-
-BEGIN
-
- "#include ""php4dllts.rc2""\r\n"
-
- "\0"
-
-END
-
-
-
-3 TEXTINCLUDE DISCARDABLE
-
-BEGIN
-
- "\r\n"
-
- "\0"
-
-END
-
-
-
-#endif // APSTUDIO_INVOKED
-
-
-
-#endif // English (U.S.) resources
-
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-
-#ifndef APSTUDIO_INVOKED
-
-/////////////////////////////////////////////////////////////////////////////
-
-//
-
-// Generated from the TEXTINCLUDE 3 resource.
-
-//
-
-#include "php4dllts.rc2"
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-#endif // not APSTUDIO_INVOKED
-
-
-
diff --git a/win32/php4dllts.rc2 b/win32/php4dllts.rc2
deleted file mode 100644
index 2bfe159f2d..0000000000
--- a/win32/php4dllts.rc2
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// php4dllts.RC2 - resources Microsoft Visual C++ does not edit directly
-//
-
-#ifdef APSTUDIO_INVOKED
- #error this file is not editable by Microsoft Visual C++
-#endif //APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Add manually edited resources here...
-#include "../main/php_version.h"
-
-#define XSTRVER4(maj, min, rel, build) #maj "." #min "." #rel "." #build
-#define XSTRVER3(maj, min, rel) #maj "." #min "." #rel
-#define STRVER4(maj, min, rel, build) XSTRVER4(maj, min, rel, build)
-#define STRVER3(maj, min, rel) XSTRVER3(maj, min, rel)
-
-#ifndef _MAC
-//Version
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,PHP_RELEASE_VERSION
- PRODUCTVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS VS_FF_DEBUG
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS VOS__WINDOWS32
- FILETYPE VFT_DLL
- FILESUBTYPE VFT2_UNKNOWN
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "Comments", "\0"
- VALUE "CompanyName", "The PHP Group\0"
- VALUE "FileDescription", "PHP Script Interpreter\0"
- VALUE "FileVersion", STRVER4(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, PHP_RELEASE_VERSION)
- VALUE "InternalName", "php\0"
- VALUE "LegalCopyright", "Copyright © 2002 The PHP Group\0"
- VALUE "LegalTrademarks", "php\0"
- VALUE "OriginalFilename", "php4ts.dll\0"
- VALUE "PrivateBuild", "\0"
- VALUE "ProductName", "PHP Thread Safe\0"
- VALUE "ProductVersion", STRVER3(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION)
- VALUE "SpecialBuild", PHP_EXTRA_VERSION "\0"
- VALUE "URL", "http://www.php.net"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif // !_MAC
-
-/////////////////////////////////////////////////////////////////////////////
diff --git a/win32/php4ts.dsp b/win32/php4ts.dsp
deleted file mode 100644
index c69a20c911..0000000000
--- a/win32/php4ts.dsp
+++ /dev/null
@@ -1,187 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4ts" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=php4ts - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4ts.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4ts.mak" CFG="php4ts - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4ts - Win32 Release_TS" (based on "Win32 (x86) Console Application")
-!MESSAGE "php4ts - Win32 Debug_TS" (based on "Win32 (x86) Console Application")
-!MESSAGE "php4ts - Win32 Release_TS_inline" (based on "Win32 (x86) Console Application")
-!MESSAGE "php4ts - Win32 Release_TSDbg" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4ts - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\sapi\cgi\libfcgi\include" /D FCGI_STATIC=1 /D PHP_FASTCGI=1 /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 php4ts.lib winmm.lib ws2_32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS\php.exe" /libpath:"..\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4ts - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\sapi\cgi\libfcgi\include" /D FCGI_STATIC=1 /D PHP_FASTCGI=1 /D "DEBUG" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /i "c:\include" /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 winmm.lib netapi32.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"..\Debug_TS/php.exe" /pdbtype:sept /libpath:"..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "php4ts - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4ts___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php4ts___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "regex" /I "..\bindlib_w32" /I "Zend" /I "tsrm" /D "NDEBUG" /D "MSVC5" /D "_CONSOLE" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /Fr /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\sapi\cgi\libfcgi\include" /D FCGI_STATIC=1 /D PHP_FASTCGI=1 /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"Release_TS\php.exe" /libpath:"Release_TS"
-# ADD LINK32 php4ts.lib winmm.lib ws2_32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS_inline\php.exe" /libpath:"..\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4ts - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4ts___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "php4ts___Win32_Release_TSDbg"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\sapi\cgi\libfcgi\include" /D FCGI_STATIC=1 /D PHP_FASTCGI=1 /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS\php.exe" /libpath:"..\Release_TS"
-# ADD LINK32 php4ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TSDbg\php.exe" /libpath:"..\Release_TSDbg"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4ts - Win32 Release_TS"
-# Name "php4ts - Win32 Debug_TS"
-# Name "php4ts - Win32 Release_TS_inline"
-# Name "php4ts - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\sapi\cgi\cgi_main.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sapi\cgi\getopt.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\sapi\cgi\php_getopt.h
-# End Source File
-# End Group
-# Begin Group "libfcgi"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\sapi\cgi\libfcgi\fcgiapp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sapi\cgi\libfcgi\os_win32.c
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\php4ts.rc
-# End Source File
-# Begin Source File
-
-SOURCE=.\php4ts.rc2
-# End Source File
-# End Target
-# End Project
diff --git a/win32/php4ts.rc b/win32/php4ts.rc
deleted file mode 100644
index eee4ef41af..0000000000
--- a/win32/php4ts.rc
+++ /dev/null
@@ -1,126 +0,0 @@
-//Microsoft Developer Studio generated resource script.
-
-//
-
-#include "resource.h"
-
-
-
-#define APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-
-//
-
-// Generated from the TEXTINCLUDE 2 resource.
-
-//
-
-#include "winres.h"
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-#undef APSTUDIO_READONLY_SYMBOLS
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-// English (U.S.) resources
-
-
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-
-#ifdef _WIN32
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-#pragma code_page(1252)
-
-#endif //_WIN32
-
-
-
-#ifdef APSTUDIO_INVOKED
-
-/////////////////////////////////////////////////////////////////////////////
-
-//
-
-// TEXTINCLUDE
-
-//
-
-
-
-1 TEXTINCLUDE DISCARDABLE
-
-BEGIN
-
- "resource.h\0"
-
-END
-
-
-
-2 TEXTINCLUDE DISCARDABLE
-
-BEGIN
-
- "#include ""php4ts.rc2""\r\n"
-
- "\0"
-
-END
-
-
-
-3 TEXTINCLUDE DISCARDABLE
-
-BEGIN
-
- "\r\n"
-
- "\0"
-
-END
-
-
-
-#endif // APSTUDIO_INVOKED
-
-
-
-#endif // English (U.S.) resources
-
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-
-#ifndef APSTUDIO_INVOKED
-
-/////////////////////////////////////////////////////////////////////////////
-
-//
-
-// Generated from the TEXTINCLUDE 3 resource.
-
-//
-
-#include "php4ts.rc2"
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-#endif // not APSTUDIO_INVOKED
-
-
-
diff --git a/win32/php4ts.rc2 b/win32/php4ts.rc2
deleted file mode 100644
index 9307b57fa9..0000000000
--- a/win32/php4ts.rc2
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// php4dllts.RC2 - resources Microsoft Visual C++ does not edit directly
-//
-
-#ifdef APSTUDIO_INVOKED
- #error this file is not editable by Microsoft Visual C++
-#endif //APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Add manually edited resources here...
-#include "../main/php_version.h"
-
-#define XSTRVER4(maj, min, rel, build) #maj "." #min "." #rel "." #build
-#define XSTRVER3(maj, min, rel) #maj "." #min "." #rel
-#define STRVER4(maj, min, rel, build) XSTRVER4(maj, min, rel, build)
-#define STRVER3(maj, min, rel) XSTRVER3(maj, min, rel)
-
-#ifndef _MAC
-//Version
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,PHP_RELEASE_VERSION
- PRODUCTVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS VS_FF_DEBUG
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS VOS__WINDOWS32
- FILETYPE VFT_APP
- FILESUBTYPE VFT2_UNKNOWN
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "Comments", "\0"
- VALUE "CompanyName", "The PHP Group\0"
- VALUE "FileDescription", "PHP Script Interpreter\0"
- VALUE "FileVersion", STRVER4(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, PHP_RELEASE_VERSION)
- VALUE "InternalName", "php-cgi\0"
- VALUE "LegalCopyright", "Copyright © 2002 The PHP Group\0"
- VALUE "LegalTrademarks", "php\0"
- VALUE "OriginalFilename", "php.exe\0"
- VALUE "PrivateBuild", "\0"
- VALUE "ProductName", "PHP Thread Safe CGI\0"
- VALUE "ProductVersion", STRVER3(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION)
- VALUE "SpecialBuild", PHP_EXTRA_VERSION "\0"
- VALUE "URL", "http://www.php.net"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif // !_MAC
-
-/////////////////////////////////////////////////////////////////////////////
diff --git a/win32/php4ts_cli.dsp b/win32/php4ts_cli.dsp
deleted file mode 100644
index 9c086fa64c..0000000000
--- a/win32/php4ts_cli.dsp
+++ /dev/null
@@ -1,175 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4ts_cli" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=php4ts_cli - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4ts_cli.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4ts_cli.mak" CFG="php4ts_cli - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4ts_cli - Win32 Release_TS" (based on "Win32 (x86) Console Application")
-!MESSAGE "php4ts_cli - Win32 Debug_TS" (based on "Win32 (x86) Console Application")
-!MESSAGE "php4ts_cli - Win32 Release_TS_inline" (based on "Win32 (x86) Console Application")
-!MESSAGE "php4ts_cli - Win32 Release_TSDbg" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4ts_cli - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 php4ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS\cli\php.exe" /libpath:"..\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4ts_cli - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "DEBUG" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /i "c:\include" /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 winmm.lib netapi32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"..\Debug_TS\cli\php.exe" /pdbtype:sept /libpath:"..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "php4ts_cli - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4ts___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php4ts___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "regex" /I "..\bindlib_w32" /I "Zend" /I "tsrm" /D "NDEBUG" /D "MSVC5" /D "_CONSOLE" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /Fr /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"Release_TS\php.exe" /libpath:"Release_TS"
-# ADD LINK32 php4ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS_inline\cli\php.exe" /libpath:"..\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4ts_cli - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4ts___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "php4ts___Win32_Release_TSDbg"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS\php.exe" /libpath:"..\Release_TS"
-# ADD LINK32 php4ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TSDbg\php.exe" /libpath:"..\Release_TSDbg"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4ts_cli - Win32 Release_TS"
-# Name "php4ts_cli - Win32 Debug_TS"
-# Name "php4ts_cli - Win32 Release_TS_inline"
-# Name "php4ts_cli - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\sapi\cli\getopt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sapi\cli\php_cli.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\sapi\cli\php_getopt.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\php4ts_cli.rc
-# End Source File
-# Begin Source File
-
-SOURCE=.\php4ts_cli.rc2
-# End Source File
-# End Target
-# End Project
diff --git a/win32/php4ts_cli.rc b/win32/php4ts_cli.rc
deleted file mode 100644
index cc9af4fdc1..0000000000
--- a/win32/php4ts_cli.rc
+++ /dev/null
@@ -1,126 +0,0 @@
-//Microsoft Developer Studio generated resource script.
-
-//
-
-#include "resource.h"
-
-
-
-#define APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-
-//
-
-// Generated from the TEXTINCLUDE 2 resource.
-
-//
-
-#include "winres.h"
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-#undef APSTUDIO_READONLY_SYMBOLS
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-// English (U.S.) resources
-
-
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-
-#ifdef _WIN32
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-#pragma code_page(1252)
-
-#endif //_WIN32
-
-
-
-#ifdef APSTUDIO_INVOKED
-
-/////////////////////////////////////////////////////////////////////////////
-
-//
-
-// TEXTINCLUDE
-
-//
-
-
-
-1 TEXTINCLUDE DISCARDABLE
-
-BEGIN
-
- "resource.h\0"
-
-END
-
-
-
-2 TEXTINCLUDE DISCARDABLE
-
-BEGIN
-
- "#include ""php4ts_cli.rc2""\r\n"
-
- "\0"
-
-END
-
-
-
-3 TEXTINCLUDE DISCARDABLE
-
-BEGIN
-
- "\r\n"
-
- "\0"
-
-END
-
-
-
-#endif // APSTUDIO_INVOKED
-
-
-
-#endif // English (U.S.) resources
-
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-
-#ifndef APSTUDIO_INVOKED
-
-/////////////////////////////////////////////////////////////////////////////
-
-//
-
-// Generated from the TEXTINCLUDE 3 resource.
-
-//
-
-#include "php4ts_cli.rc2"
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-#endif // not APSTUDIO_INVOKED
-
-
-
diff --git a/win32/php4ts_cli.rc2 b/win32/php4ts_cli.rc2
deleted file mode 100644
index e781e4f885..0000000000
--- a/win32/php4ts_cli.rc2
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// php4dllts.RC2 - resources Microsoft Visual C++ does not edit directly
-//
-
-#ifdef APSTUDIO_INVOKED
- #error this file is not editable by Microsoft Visual C++
-#endif //APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Add manually edited resources here...
-#include "../main/php_version.h"
-
-#define XSTRVER4(maj, min, rel, build) #maj "." #min "." #rel "." #build
-#define XSTRVER3(maj, min, rel) #maj "." #min "." #rel
-#define STRVER4(maj, min, rel, build) XSTRVER4(maj, min, rel, build)
-#define STRVER3(maj, min, rel) XSTRVER3(maj, min, rel)
-
-#ifndef _MAC
-//Version
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,PHP_RELEASE_VERSION
- PRODUCTVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS VS_FF_DEBUG
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS VOS__WINDOWS32
- FILETYPE VFT_APP
- FILESUBTYPE VFT2_UNKNOWN
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "Comments", "\0"
- VALUE "CompanyName", "The PHP Group\0"
- VALUE "FileDescription", "PHP Script Interpreter\0"
- VALUE "FileVersion", STRVER4(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, PHP_RELEASE_VERSION)
- VALUE "InternalName", "php-cli\0"
- VALUE "LegalCopyright", "Copyright © 2002 The PHP Group\0"
- VALUE "LegalTrademarks", "php\0"
- VALUE "OriginalFilename", "php.exe\0"
- VALUE "PrivateBuild", "\0"
- VALUE "ProductName", "PHP Thread Safe Command Line Interface\0"
- VALUE "ProductVersion", STRVER3(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION)
- VALUE "SpecialBuild", PHP_EXTRA_VERSION "\0"
- VALUE "URL", "http://www.php.net"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif // !_MAC
-
-/////////////////////////////////////////////////////////////////////////////
diff --git a/win32/php5ts.dsw b/win32/php5ts.dsw
deleted file mode 100644
index 3846b1d614..0000000000
--- a/win32/php5ts.dsw
+++ /dev/null
@@ -1,239 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "TSRM"="..\TSRM\TSRM.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ZendTS"="..\Zend\ZendTS.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "libmysql"="..\ext\mysql\libmysql\libmysql.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "php4activescript"="..\SAPI\activescript\php4activescript.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4aolserver"="..\sapi\aolserver\php4aolserver.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4apache"="..\sapi\apache\php4apache.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4apache2"="..\SAPI\APACHE2HANDLER\php4apache2.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4dllts"=".\php4dllts.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ZendTS
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name libmysql
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4isapi"="..\sapi\isapi\php4isapi.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4nsapi"="..\sapi\nsapi\php4nsapi.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4pi3web"="..\sapi\pi3web\php4pi3web.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4ts"=".\php4ts.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4ts_cli"=".\php4ts_cli.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "servlet"="..\sapi\servlet\servlet.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "testsuite"=".\testsuite.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4ts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/win32/php_modules.dsw b/win32/php_modules.dsw
deleted file mode 100644
index 6c65e3dc86..0000000000
--- a/win32/php_modules.dsw
+++ /dev/null
@@ -1,569 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "bz2"=..\ext\bz2\bz2.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "cpdf"=..\ext\cpdf\cpdf.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "crack"=..\ext\crack\crack.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ctype"=..\ext\ctype\ctype.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "curl"=..\ext\curl\curl.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "db"=..\ext\db\db.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "dba"=..\ext\dba\dba.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "dbase"=..\ext\dbase\dbase.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "dbx"=..\ext\dbx\dbx.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "domxml"=..\ext\domxml\domxml.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "exif"=..\ext\exif\exif.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "fbsql"=..\ext\fbsql\fbsql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "fdf"=..\ext\fdf\fdf.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "filepro"=..\ext\filepro\filepro.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "gd"=..\ext\gd\gd.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "gettext"=..\ext\gettext\gettext.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "hyperwave"=..\ext\hyperwave\hyperwave.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "iconv"=..\ext\iconv\iconv.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ifx"=..\ext\informix\ifx.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "imap"=..\ext\imap\imap.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ingres"=..\ext\ingres_ii\ingres.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "interbase"=..\ext\interbase\interbase.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ldap"=..\ext\ldap\ldap.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mbstring"=..\ext\mbstring\mbstring.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mcrypt"=..\ext\mcrypt\mcrypt.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mhash"=..\ext\mhash\mhash.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mime_magic"=..\ext\mime_magic\mime_magic.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ming"=..\ext\ming\ming.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "msql"=..\ext\msql\msql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mssql"=..\ext\mssql\mssql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "notes"=..\ext\notes\notes.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "oci8"=..\ext\oci8\oci8.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "openssl"=..\ext\openssl\openssl.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "oracle"=..\ext\oracle\oracle.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "pdf"=..\ext\pdf\pdf.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "pgsql"=..\ext\pgsql\pgsql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "shmop"=..\ext\shmop\shmop.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "snmp"=..\ext\snmp\snmp.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "sockets"=..\ext\sockets\sockets.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "sybase_ct"=..\ext\sybase_ct\sybase_ct.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "tokenizer"=..\ext\tokenizer\tokenizer.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "w32api"=..\ext\w32api\w32api.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "xmlrpc"=..\ext\xmlrpc\xmlrpc.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "xslt"=..\ext\xslt\xslt.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "yaz"=..\ext\yaz\yaz.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "zip"=..\ext\zip\zip.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/win32/php_registry.h b/win32/php_registry.h
deleted file mode 100644
index fe7c1fddd5..0000000000
--- a/win32/php_registry.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef PHP_REGISTRY_H
-#define PHP_REGISTRY_H
-
-
-void UpdateIniFromRegistry(char *path TSRMLS_DC);
-
-#endif /* PHP_REGISTRY_H */
diff --git a/win32/pwd.c b/win32/pwd.c
deleted file mode 100644
index 6528956a53..0000000000
--- a/win32/pwd.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h" /*php specific */
-#include <lmaccess.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <lmapibuf.h>
-#include "pwd.h"
-#include "grp.h"
-
-#ifndef THREAD_SAFE
-static struct passwd pwd;
-#endif
-
-static char *home_dir = ".";
-static char *login_shell = "not command.com!";
-
-struct passwd *
-getpwnam(char *name)
-{
- return (struct passwd *) 0;
-}
-
-
-char *
-getlogin()
-{
- static char name[256];
- DWORD max_len = 256;
-
- GetUserName(name, &max_len);
- return name;
-}
-
-struct passwd *
-getpwuid(int user_id)
-{
- pwd.pw_name = getlogin();
- pwd.pw_dir = home_dir;
- pwd.pw_shell = login_shell;
- pwd.pw_uid = 0;
-
- return &pwd;
-}
-
diff --git a/win32/pwd.h b/win32/pwd.h
deleted file mode 100644
index 9ac71389fd..0000000000
--- a/win32/pwd.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PWD_H
-#define PWD_H
-
-struct passwd {
- char *pw_name;
- char *pw_passwd;
- int pw_uid;
- int pw_gid;
- char *pw_comment;
- char *pw_gecos;
- char *pw_dir;
- char *pw_shell;
-};
-
-extern struct passwd *getpwuid(int);
-extern struct passwd *getpwnam(char *name);
-extern char *getlogin(void);
-#endif
diff --git a/win32/pws-php4cgi.reg b/win32/pws-php4cgi.reg
deleted file mode 100644
index 46edc77386..0000000000
--- a/win32/pws-php4cgi.reg
+++ /dev/null
@@ -1,6 +0,0 @@
-REGEDIT4
-
-[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map]
-".php"="[PUT PATH HERE]\\php.exe"
-
-
diff --git a/win32/pws-php4isapi.reg b/win32/pws-php4isapi.reg
deleted file mode 100644
index 47804a946a..0000000000
--- a/win32/pws-php4isapi.reg
+++ /dev/null
@@ -1,5 +0,0 @@
-REGEDIT4
-
-[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map]
-".php"="[PUT PATH HERE]\\php4isapi.dll"
-
diff --git a/win32/readdir.c b/win32/readdir.c
deleted file mode 100644
index e33d19bde5..0000000000
--- a/win32/readdir.c
+++ /dev/null
@@ -1,143 +0,0 @@
-#include <malloc.h>
-#include <string.h>
-#include <errno.h>
-
-#include "readdir.h"
-#include "php.h"
-
-/**********************************************************************
- * Implement dirent-style opendir/readdir/rewinddir/closedir on Win32
- *
- * Functions defined are opendir(), readdir(), rewinddir() and
- * closedir() with the same prototypes as the normal dirent.h
- * implementation.
- *
- * Does not implement telldir(), seekdir(), or scandir(). The dirent
- * struct is compatible with Unix, except that d_ino is always 1 and
- * d_off is made up as we go along.
- *
- * The DIR typedef is not compatible with Unix.
- **********************************************************************/
-
-DIR *opendir(const char *dir)
-{
- DIR *dp;
- char *filespec;
- long handle;
- int index;
-
- filespec = malloc(strlen(dir) + 2 + 1);
- strcpy(filespec, dir);
- index = strlen(filespec) - 1;
- if (index >= 0 && (filespec[index] == '/' ||
- (filespec[index] == '\\' && !IsDBCSLeadByte(filespec[index-1]))))
- filespec[index] = '\0';
- strcat(filespec, "/*");
-
- dp = (DIR *) malloc(sizeof(DIR));
- dp->offset = 0;
- dp->finished = 0;
- dp->dir = strdup(dir);
-
- if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0) {
- if (errno == ENOENT)
- dp->finished = 1;
- else
- return NULL;
- }
- dp->handle = handle;
- free(filespec);
-
- return dp;
-}
-
-struct dirent *readdir(DIR *dp)
-{
- if (!dp || dp->finished)
- return NULL;
-
- if (dp->offset != 0) {
- if (_findnext(dp->handle, &(dp->fileinfo)) < 0) {
- dp->finished = 1;
- return NULL;
- }
- }
- dp->offset++;
-
- strlcpy(dp->dent.d_name, dp->fileinfo.name, _MAX_FNAME+1);
- dp->dent.d_ino = 1;
- dp->dent.d_reclen = strlen(dp->dent.d_name);
- dp->dent.d_off = dp->offset;
-
- return &(dp->dent);
-}
-
-int readdir_r(DIR *dp, struct dirent *entry, struct dirent **result)
-{
- if (!dp || dp->finished) {
- *result = NULL;
- return 0;
- }
-
- if (dp->offset != 0) {
- if (_findnext(dp->handle, &(dp->fileinfo)) < 0) {
- dp->finished = 1;
- *result = NULL;
- return 0;
- }
- }
- dp->offset++;
-
- strlcpy(dp->dent.d_name, dp->fileinfo.name, _MAX_FNAME+1);
- dp->dent.d_ino = 1;
- dp->dent.d_reclen = strlen(dp->dent.d_name);
- dp->dent.d_off = dp->offset;
-
- memcpy(entry, &dp->dent, sizeof(*entry));
-
- *result = &dp->dent;
-
- return 0;
-}
-
-int closedir(DIR *dp)
-{
- if (!dp)
- return 0;
- _findclose(dp->handle);
- if (dp->dir)
- free(dp->dir);
- if (dp)
- free(dp);
-
- return 0;
-}
-
-int rewinddir(DIR *dp)
-{
- /* Re-set to the beginning */
- char *filespec;
- long handle;
- int index;
-
- _findclose(dp->handle);
-
- dp->offset = 0;
- dp->finished = 0;
-
- filespec = malloc(strlen(dp->dir) + 2 + 1);
- strcpy(filespec, dp->dir);
- index = strlen(filespec) - 1;
- if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\'))
- filespec[index] = '\0';
- strcat(filespec, "/*");
-
- if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0) {
- if (errno == ENOENT)
- dp->finished = 1;
- }
- dp->handle = handle;
- free(filespec);
-
-return 0;
-}
diff --git a/win32/readdir.h b/win32/readdir.h
deleted file mode 100644
index 419dc95c24..0000000000
--- a/win32/readdir.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef READDIR_H
-#define READDIR_H
-
-
-/*
- * Structures and types used to implement opendir/readdir/closedir
- * on Windows 95/NT.
- */
-
-#include <io.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-
-
-/* struct dirent - same as Unix */
-
-struct dirent {
- long d_ino; /* inode (always 1 in WIN32) */
- off_t d_off; /* offset to this dirent */
- unsigned short d_reclen; /* length of d_name */
- char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */
-};
-
-
-/* typedef DIR - not the same as Unix */
-typedef struct {
- long handle; /* _findfirst/_findnext handle */
- short offset; /* offset into directory */
- short finished; /* 1 if there are not more files */
- struct _finddata_t fileinfo; /* from _findfirst/_findnext */
- char *dir; /* the dir we are reading */
- struct dirent dent; /* the dirent to return */
-} DIR;
-
-/* Function prototypes */
-DIR *opendir(const char *);
-struct dirent *readdir(DIR *);
-int readdir_r(DIR *, struct dirent *, struct dirent **);
-int closedir(DIR *);
-int rewinddir(DIR *);
-
-#endif /* READDIR_H */
diff --git a/win32/registry.c b/win32/registry.c
deleted file mode 100644
index 06e6bc0548..0000000000
--- a/win32/registry.c
+++ /dev/null
@@ -1,88 +0,0 @@
-#include "php.h"
-#include "php_ini.h"
-
-void UpdateIniFromRegistry(char *path TSRMLS_DC)
-{
- char *p, *orig_path;
- HKEY MainKey;
- char *strtok_buf = NULL;
-
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\PHP\\Per Directory Values", 0, KEY_READ, &MainKey)!=ERROR_SUCCESS) {
- return;
- }
-
- orig_path = path = estrdup(path);
-
- /* Get rid of C:, if exists */
- p = strchr(path, ':');
- if (p) {
- *p = path[0]; /* replace the colon with the drive letter */
- path = p; /* make path point to the drive letter */
- } else {
- if (path[0] != '\\' && path[0] != '/') {
- char tmp_buf[MAXPATHLEN], *cwd;
- char drive_letter;
-
- /* get current working directory and prepend it to the path */
- if (!VCWD_GETCWD(tmp_buf, MAXPATHLEN)) {
- efree(orig_path);
- return;
- }
- cwd = strchr(tmp_buf, ':');
- if (!cwd) {
- drive_letter = 'C';
- cwd = tmp_buf;
- } else {
- drive_letter = tmp_buf[0];
- cwd++;
- }
- path = (char *) emalloc(2+strlen(cwd)+1+strlen(orig_path)+1);
- sprintf(path, "%c\\%s\\%s", drive_letter, cwd, orig_path);
- efree(orig_path);
- orig_path = path;
- }
- }
-
-
- path = p = php_strtok_r(path, "\\/", &strtok_buf);
-
- while (p) {
- HKEY hKey;
- DWORD lType;
- DWORD values = 0, max_name = 0, max_value = 0, i = 0;
-
- if (p>path) {
- *(p-1) = '\\'; /* restore the slash */
- }
-
- if (RegOpenKeyEx(MainKey, path, 0, KEY_READ, &hKey)!=ERROR_SUCCESS) {
- break;
- }
-
- if(RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &values, &max_name, &max_value, NULL, NULL) == ERROR_SUCCESS) {
- LPTSTR namebuf = (LPTSTR)emalloc(max_name + 1);
- PBYTE valuebuf = (PBYTE)emalloc(max_value);
-
- while (i < values) {
- DWORD namebuf_len = max_name + 1;
- DWORD valuebuf_len = max_value;
-
- RegEnumValue(hKey, i, namebuf, &namebuf_len, NULL, &lType, valuebuf, &valuebuf_len);
-
- if ((lType == REG_SZ) || (lType == REG_EXPAND_SZ)) {
- zend_alter_ini_entry(namebuf, namebuf_len + 1, valuebuf, valuebuf_len, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
- }
-
- i++;
- }
-
- efree(namebuf);
- efree(valuebuf);
- }
-
- RegCloseKey(hKey);
- p = php_strtok_r(NULL, "\\/", &strtok_buf);
- }
- RegCloseKey(MainKey);
- efree(orig_path);
-}
diff --git a/win32/resource.h b/win32/resource.h
deleted file mode 100644
index 5a1669bddd..0000000000
--- a/win32/resource.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by php4dllts.rc
-//
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 101
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/win32/select.c b/win32/select.c
deleted file mode 100644
index 579ed3edee..0000000000
--- a/win32/select.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include "php.h"
-#include "php_network.h"
-
-/* $Id$ */
-
-/* Win32 select() will only work with sockets, so we roll our own implementation that will
- * get the OS file handle from regular fd's and sockets and then use WaitForMultipleObjects().
- * This implementation is not as feature-full as posix select, but it works for our purposes
- */
-PHPAPI int php_select(php_socket_t max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *tv)
-{
- HANDLE *handles;
- DWORD waitret;
- DWORD ms_total;
- int f, s, fd_count = 0, sock_count = 0;
- int retval;
- php_socket_t i;
- fd_set ard, awr, aex; /* active fd sets */
-
- for (i = 0; i < max_fd; i++) {
- if (FD_ISSET(i, rfds) || FD_ISSET(i, wfds) || FD_ISSET(i, efds)) {
- if (_get_osfhandle(i) == 0xffffffff) {
- /* it is a socket */
- sock_count++;
- } else {
- fd_count++;
- }
- }
- }
-
- if (fd_count + sock_count == 0) {
- return 0;
- }
-
- handles = (HANDLE*)emalloc((fd_count + sock_count) * sizeof(HANDLE));
-
- /* populate the events and handles arrays */
- f = 0;
- s = 0;
- for (i = 0; i < max_fd; i++) {
- if (FD_ISSET(i, rfds) || FD_ISSET(i, wfds) || FD_ISSET(i, efds)) {
- long h = _get_osfhandle(i);
- if (h == 0xFFFFFFFF) {
- HANDLE evt;
- long evt_flags = 0;
-
- if (FD_ISSET(i, rfds)) {
- evt_flags |= FD_READ|FD_CONNECT|FD_ACCEPT|FD_CLOSE;
- }
- if (FD_ISSET(i, wfds)) {
- evt_flags |= FD_WRITE;
- }
- if (FD_ISSET(i, efds)) {
- evt_flags |= FD_OOB;
- }
-
- evt = WSACreateEvent();
- WSAEventSelect(i, evt, evt_flags);
-
- handles[fd_count + s] = evt;
- s++;
- } else {
- handles[f++] = (HANDLE)h;
- }
- }
- }
-
- /* calculate how long we need to wait in milliseconds */
- if (tv == NULL) {
- ms_total = INFINITE;
- } else {
- ms_total = tv->tv_sec * 1000;
- ms_total += tv->tv_usec / 1000;
- }
-
- waitret = MsgWaitForMultipleObjects(fd_count + sock_count, handles, FALSE, ms_total, QS_ALLEVENTS);
-
- if (waitret == WAIT_TIMEOUT) {
- retval = 0;
- } else if (waitret == 0xFFFFFFFF) {
- retval = -1;
- } else {
-
- FD_ZERO(&ard);
- FD_ZERO(&awr);
- FD_ZERO(&aex);
-
- f = 0;
- retval = 0;
- for (i = 0; i < max_fd; i++) {
- if (FD_ISSET(i, rfds) || FD_ISSET(i, wfds) || FD_ISSET(i, efds)) {
- if (f >= fd_count) {
- /* socket event */
- HANDLE evt = handles[f];
-
- if (WAIT_OBJECT_0 == WaitForSingleObject(evt, 0)) {
- /* check for various signal states */
- if (FD_ISSET(i, rfds)) {
- WSAEventSelect(i, evt, FD_READ|FD_CONNECT|FD_ACCEPT|FD_CLOSE);
- if (WAIT_OBJECT_0 == WaitForSingleObject(evt, 0)) {
- FD_SET(i, &ard);
- }
- }
- if (FD_ISSET(i, wfds)) {
- WSAEventSelect(i, evt, FD_WRITE);
- if (WAIT_OBJECT_0 == WaitForSingleObject(evt, 0)) {
- FD_SET(i, &awr);
- }
- }
- if (FD_ISSET(i, efds)) {
- WSAEventSelect(i, evt, FD_OOB);
- if (WAIT_OBJECT_0 == WaitForSingleObject(evt, 0)) {
- FD_SET(i, &aex);
- }
- }
- retval++;
- }
-
- WSACloseEvent(evt);
-
- } else {
- if (WAIT_OBJECT_0 == WaitForSingleObject(handles[f], 0)) {
- if (FD_ISSET(i, rfds)) {
- FD_SET(i, &ard);
- }
- if (FD_ISSET(i, wfds)) {
- FD_SET(i, &awr);
- }
- if (FD_ISSET(i, efds)) {
- FD_SET(i, &aex);
- }
- retval++;
- }
-
- }
- f++;
- }
- }
-
- if (rfds) {
- *rfds = ard;
- }
- if (wfds) {
- *wfds = awr;
- }
- if (efds) {
- *efds = aex;
- }
- }
-
- efree(handles);
-
- return retval;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/win32/select.h b/win32/select.h
deleted file mode 100644
index 8cec6c7873..0000000000
--- a/win32/select.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-PHPAPI int php_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *tv);
-
diff --git a/win32/sendmail.c b/win32/sendmail.c
deleted file mode 100644
index 82f8efab5d..0000000000
--- a/win32/sendmail.c
+++ /dev/null
@@ -1,927 +0,0 @@
-/*
- * PHP Sendmail for Windows.
- *
- * This file is rewriten specificly for PHPFI. Some functionality
- * has been removed (MIME and file attachments). This code was
- * modified from code based on code writen by Jarle Aase.
- *
- * This class is based on the original code by Jarle Aase, see bellow:
- * wSendmail.cpp It has been striped of some functionality to match
- * the requirements of phpfi.
- *
- * Very simple SMTP Send-mail program for sending command-line level
- * emails and CGI-BIN form response for the Windows platform.
- *
- * The complete wSendmail package with source code can be located
- * from http://www.jgaa.com
- *
- */
-
-/* $Id$ */
-
-#include "php.h" /*php specific */
-#include <stdio.h>
-#include <stdlib.h>
-#ifndef NETWARE
-#include <winsock2.h>
-#else /* NETWARE */
-#include <netware\sendmail_nw.h>
-#endif /* NETWARE */
-#include "time.h"
-#include <string.h>
-#ifndef NETWARE
-#include <malloc.h>
-#include <memory.h>
-#include <winbase.h>
-#endif /* NETWARE */
-#include "sendmail.h"
-#include "php_ini.h"
-
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
-#include "ext/pcre/php_pcre.h"
-#endif
-
-/*
- extern int _daylight;
- extern long _timezone;
- */
-/*enum
- {
- DO_CONNECT = WM_USER +1
- };
- */
-
-static char *days[] =
-{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
-static char *months[] =
-{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
-
-/* '*error_message' has to be passed around from php_mail() */
-#define SMTP_ERROR_RESPONSE_SPEC "SMTP server response: %s"
-/* Convinient way to handle error messages from the SMTP server.
- response is ecalloc()d in Ack() itself and efree()d here
- because the content is in *error_message now */
-#define SMTP_ERROR_RESPONSE(response) { \
- if (response && error_message) { \
- if (NULL != (*error_message = ecalloc(1, sizeof(SMTP_ERROR_RESPONSE_SPEC) + strlen(response)))) { \
- snprintf(*error_message, sizeof(SMTP_ERROR_RESPONSE_SPEC) + strlen(response), SMTP_ERROR_RESPONSE_SPEC, response); \
- } \
- efree(response); \
- } \
- }
-
-#ifndef THREAD_SAFE
-char Buffer[MAIL_BUFFER_SIZE];
-
-/* socket related data */
-SOCKET sc;
-#ifndef NETWARE
-WSADATA Data;
-struct hostent *adr;
-#endif /* NETWARE */
-SOCKADDR_IN sock_in;
-#ifndef NETWARE
-int WinsockStarted;
-/* values set by the constructor */
-char *AppName;
-#endif /* NETWARE */
-char MailHost[HOST_NAME_LEN];
-char LocalHost[HOST_NAME_LEN];
-#endif
-char seps[] = " ,\t\n";
-#ifndef NETWARE
-char *php_mailer = "PHP 4 WIN32";
-#else
-char *php_mailer = "PHP 4 NetWare";
-#endif /* NETWARE */
-
-char *get_header(char *h, char *headers);
-
-/* Error messages */
-static char *ErrorMessages[] =
-{
- {"Success"}, /* 0 */
- {"Bad arguments from form"}, /* 1 */
- {"Unable to open temporary mailfile for read"},
- {"Failed to Start Sockets"},
- {"Failed to Resolve Host"},
- {"Failed to obtain socket handle"}, /* 5 */
- {"Failed to connect to mailserver, verify your \"SMTP\" setting in php.ini"},
- {"Failed to Send"},
- {"Failed to Receive"},
- {"Server Error"},
- {"Failed to resolve the host IP name"}, /* 10 */
- {"Out of memory"},
- {"Unknown error"},
- {"Bad Message Contents"},
- {"Bad Message Subject"},
- {"Bad Message destination"}, /* 15 */
- {"Bad Message Return Path"},
- {"Bad Mail Host"},
- {"Bad Message File"},
- {"\"sendmail_from\" not set in php.ini or custom \"From:\" header missing"},
- {"Mailserver rejected our \"sendmail_from\" setting"}, /* 20 */
- {"Error while trimming mail header with PCRE, please file a bug report at http://bugs.php.net/"} /* 21 */
-};
-
-/* This pattern converts all single occurences of \n (Unix)
- * withour a leading \r to \r\n and all occurences of \r (Mac)
- * without a trailing \n to \r\n
- * Thx to Nibbler from ircnet/#linuxger
- */
-#define PHP_WIN32_MAIL_UNIFY_PATTERN "/(\r\n?)|\n/"
-#define PHP_WIN32_MAIL_UNIFY_REPLACE "\r\n"
-
-/* This pattern removes \r\n from the start of the string,
- * \r\n from the end of the string and also makes sure every line
- * is only wrapped with a single \r\n (thus reduces multiple
- * occurences of \r\n between lines to a single \r\n) */
-#define PHP_WIN32_MAIL_RMVDBL_PATTERN "/^\r\n|(\r\n)+$/m"
-#define PHP_WIN32_MAIL_RMVDBL_REPLACE ""
-
-/* This function is meant to unify the headers passed to to mail()
- * This means, use PCRE to transform single occurences of \n or \r in \r\n
- * As a second step we also eleminate all \r\n occurences which are:
- * 1) At the start of the header
- * 2) At the end of the header
- * 3) Two or more occurences in the header are removed so only one is left
- *
- * Returns NULL on error, or the new char* buffer on success.
- * You have to take care and efree() the buffer on your own.
- */
-static char *php_win32_mail_trim_header(char *header TSRMLS_DC)
-{
-
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
-
- char *result, *result2;
- int result_len;
- zval *replace;
-
- if (!header) {
- return NULL;
- }
-
- MAKE_STD_ZVAL(replace);
- ZVAL_STRING(replace, PHP_WIN32_MAIL_UNIFY_REPLACE, 0);
-
- result = php_pcre_replace(PHP_WIN32_MAIL_UNIFY_PATTERN, sizeof(PHP_WIN32_MAIL_UNIFY_PATTERN)-1,
- header, strlen(header),
- replace,
- 0,
- &result_len,
- -1 TSRMLS_CC);
- if (NULL == result) {
- FREE_ZVAL(replace);
- return NULL;
- }
-
- ZVAL_STRING(replace, PHP_WIN32_MAIL_RMVDBL_REPLACE, 0);
-
- result2 = php_pcre_replace(PHP_WIN32_MAIL_RMVDBL_PATTERN, sizeof(PHP_WIN32_MAIL_RMVDBL_PATTERN)-1,
- result, result_len,
- replace,
- 0,
- &result_len,
- -1 TSRMLS_CC);
- efree(result);
- FREE_ZVAL(replace);
- return result2;
-#else
- /* In case we don't have PCRE support (for whatever reason...) simply do nothing and return the unmodified header */
- return estrdup(header);
-#endif
-}
-
-/*********************************************************************
-// Name: TSendMail
-// Input: 1) host: Name of the mail host where the SMTP server resides
-// max accepted length of name = 256
-// 2) appname: Name of the application to use in the X-mailer
-// field of the message. if NULL is given the application
-// name is used as given by the GetCommandLine() function
-// max accespted length of name = 100
-// Output: 1) error: Returns the error code if something went wrong or
-// SUCCESS otherwise.
-//
-// See SendText() for additional args!
-//********************************************************************/
-int TSendMail(char *host, int *error, char **error_message,
- char *headers, char *Subject, char *mailTo, char *data,
- char *mailCc, char *mailBcc, char *mailRPath)
-{
- int ret;
- char *RPath = NULL;
- char *headers_lc = NULL; /* headers_lc is only created if we've a header at all */
- TSRMLS_FETCH();
-
-#ifndef NETWARE
- WinsockStarted = FALSE;
-#endif
-
- if (host == NULL) {
- *error = BAD_MAIL_HOST;
- return FAILURE;
- } else if (strlen(host) >= HOST_NAME_LEN) {
- *error = BAD_MAIL_HOST;
- return FAILURE;
- } else {
- strcpy(MailHost, host);
- }
-
- if (headers) {
- char *pos = NULL;
- size_t i;
-
- /* Use PCRE to trim the header into the right format */
- if (NULL == (headers = php_win32_mail_trim_header(headers TSRMLS_CC))) {
- *error = W32_SM_PCRE_ERROR;
- return FAILURE;
- }
-
- /* Create a lowercased header for all the searches so we're finally case
- * insensitive when searching for a pattern. */
- if (NULL == (headers_lc = estrdup(headers))) {
- efree(headers);
- *error = OUT_OF_MEMORY;
- return FAILURE;
- }
- for (i = 0; i < strlen(headers_lc); i++) {
- headers_lc[i] = tolower(headers_lc[i]);
- }
- }
-
- /* Fall back to sendmail_from php.ini setting */
- if (mailRPath && *mailRPath) {
- RPath = estrdup(mailRPath);
- }
- else if (INI_STR("sendmail_from")) {
- RPath = estrdup(INI_STR("sendmail_from"));
- } else {
- if (headers) {
- efree(headers);
- efree(headers_lc);
- }
- *error = W32_SM_SENDMAIL_FROM_NOT_SET;
- return FAILURE;
- }
-
- /* attempt to connect with mail host */
- *error = MailConnect();
- if (*error != 0) {
- if (RPath) {
- efree(RPath);
- }
- if (headers) {
- efree(headers);
- efree(headers_lc);
- }
- /* 128 is safe here, the specifier in snprintf isn't longer than that */
- if (NULL == (*error_message = ecalloc(1, HOST_NAME_LEN + 128))) {
- return FAILURE;
- }
- snprintf(*error_message, HOST_NAME_LEN + 128,
- "Failed to connect to mailserver at \"%s\" port %d, verify your \"SMTP\" "
- "and \"smtp_port\" setting in php.ini or use ini_set()",
- MailHost, !INI_INT("smtp_port") ? 25 : INI_INT("smtp_port"));
- return FAILURE;
- } else {
- ret = SendText(RPath, Subject, mailTo, mailCc, mailBcc, data, headers, headers_lc, error_message);
- TSMClose();
- if (RPath) {
- efree(RPath);
- }
- if (headers) {
- efree(headers);
- efree(headers_lc);
- }
- if (ret != SUCCESS) {
- *error = ret;
- return FAILURE;
- }
- return SUCCESS;
- }
-}
-
-//********************************************************************
-// Name: TSendMail::~TSendMail
-// Input:
-// Output:
-// Description: DESTRUCTOR
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************/
-void TSMClose()
-{
- Post("QUIT\r\n");
- Ack(NULL);
- /* to guarantee that the cleanup is not made twice and
- compomise the rest of the application if sockets are used
- elesewhere
- */
-
- shutdown(sc, 0);
-#ifndef NETWARE
- closesocket(sc);
-#else
- /* closesocket commented out since it was giving undefined symbol linker error
- * close added in its place
- */
- close(sc);
-#endif /* NETWARE */
-}
-
-
-/*********************************************************************
-// Name: char *GetSMErrorText
-// Input: Error index returned by the menber functions
-// Output: pointer to a string containing the error description
-// Description:
-// Author/Date: jcar 20/9/96
-// History:
-//*******************************************************************/
-char *GetSMErrorText(int index)
-{
- if (MIN_ERROR_INDEX <= index && index < MAX_ERROR_INDEX) {
- return (ErrorMessages[index]);
-
- } else {
- return (ErrorMessages[UNKNOWN_ERROR]);
-
- }
-}
-
-
-/*********************************************************************
-// Name: TSendText
-// Input: 1) RPath: return path of the message
-// Is used to fill the "Return-Path" and the
-// "X-Sender" fields of the message.
-// 2) Subject: Subject field of the message. If NULL is given
-// the subject is set to "No Subject"
-// 3) mailTo: Destination address
-// 4) data: Null terminated string containing the data to be send.
-// 5,6) headers of the message. Note that the second
-// parameter, headers_lc, is actually a lowercased version of
-// headers. The should match exactly (in terms of length),
-// only differ in case
-// Output: Error code or SUCCESS
-// Description:
-// Author/Date: jcar 20/9/96
-// History:
-//*******************************************************************/
-int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailBcc, char *data,
- char *headers, char *headers_lc, char **error_message)
-{
- int res, i;
- char *p;
- char *tempMailTo, *token, *pos1, *pos2;
- char *server_response = NULL;
- char *stripped_header = NULL;
-
- /* check for NULL parameters */
- if (data == NULL)
- return (BAD_MSG_CONTENTS);
- if (mailTo == NULL)
- return (BAD_MSG_DESTINATION);
- if (RPath == NULL)
- return (BAD_MSG_RPATH);
-
- /* simple checks for the mailto address */
- /* have ampersand ? */
- /* mfischer, 20020514: I commented this out because it really
- seems bogus. Only a username for example may still be a
- valid address at the destination system.
- if (strchr(mailTo, '@') == NULL)
- return (BAD_MSG_DESTINATION);
- */
-
- sprintf(Buffer, "HELO %s\r\n", LocalHost);
-
- /* in the beggining of the dialog */
- /* attempt reconnect if the first Post fail */
- if ((res = Post(Buffer)) != SUCCESS) {
- MailConnect();
- if ((res = Post(Buffer)) != SUCCESS)
- return (res);
- }
- if ((res = Ack(&server_response)) != SUCCESS) {
- SMTP_ERROR_RESPONSE(server_response);
- return (res);
- }
-
- snprintf(Buffer, MAIL_BUFFER_SIZE, "MAIL FROM:<%s>\r\n", RPath);
- if ((res = Post(Buffer)) != SUCCESS)
- return (res);
- if ((res = Ack(&server_response)) != SUCCESS) {
- SMTP_ERROR_RESPONSE(server_response);
- return W32_SM_SENDMAIL_FROM_MALFORMED;
- }
-
- tempMailTo = estrdup(mailTo);
- /* Send mail to all rcpt's */
- token = strtok(tempMailTo, ",");
- while(token != NULL)
- {
- snprintf(Buffer, MAIL_BUFFER_SIZE, "RCPT TO:<%s>\r\n", token);
- if ((res = Post(Buffer)) != SUCCESS) {
- efree(tempMailTo);
- return (res);
- }
- if ((res = Ack(&server_response)) != SUCCESS) {
- SMTP_ERROR_RESPONSE(server_response);
- efree(tempMailTo);
- return (res);
- }
- token = strtok(NULL, ",");
- }
- efree(tempMailTo);
-
- if (mailCc && *mailCc) {
- tempMailTo = estrdup(mailCc);
- /* Send mail to all rcpt's */
- token = strtok(tempMailTo, ",");
- while(token != NULL)
- {
- snprintf(Buffer, MAIL_BUFFER_SIZE, "RCPT TO:<%s>\r\n", token);
- if ((res = Post(Buffer)) != SUCCESS) {
- efree(tempMailTo);
- return (res);
- }
- if ((res = Ack(&server_response)) != SUCCESS) {
- SMTP_ERROR_RESPONSE(server_response);
- efree(tempMailTo);
- return (res);
- }
- token = strtok(NULL, ",");
- }
- efree(tempMailTo);
- }
- /* Send mail to all Cc rcpt's */
- else if (headers && (pos1 = strstr(headers_lc, "cc:")) && ((pos1 == headers_lc) || iscntrl(*(pos1-1)))) {
- /* Real offset is memaddress from the original headers + difference of
- * string found in the lowercase headrs + 3 characters to jump over
- * the cc: */
- pos1 = headers + (pos1 - headers_lc) + 3;
- if (NULL == (pos2 = strstr(pos1, "\r\n"))) {
-
- tempMailTo = estrndup(pos1, strlen(pos1));
-
- } else {
- tempMailTo = estrndup(pos1, pos2-pos1);
-
- }
-
- token = strtok(tempMailTo, ",");
- while(token != NULL)
- {
- sprintf(Buffer, "RCPT TO:<%s>\r\n", token);
- if ((res = Post(Buffer)) != SUCCESS)
- return (res);
- if ((res = Ack(&server_response)) != SUCCESS) {
- SMTP_ERROR_RESPONSE(server_response);
- return (res);
- }
- token = strtok(NULL, ",");
- }
- efree(tempMailTo);
- }
-
- /* Send mail to all Bcc rcpt's
- This is basically a rip of the Cc code above.
- Just don't forget to remove the Bcc: from the header afterwards. */
- if (mailBcc && *mailBcc) {
- tempMailTo = estrdup(mailBcc);
- /* Send mail to all rcpt's */
- token = strtok(tempMailTo, ",");
- while(token != NULL)
- {
- snprintf(Buffer, MAIL_BUFFER_SIZE, "RCPT TO:<%s>\r\n", token);
- if ((res = Post(Buffer)) != SUCCESS) {
- efree(tempMailTo);
- return (res);
- }
- if ((res = Ack(&server_response)) != SUCCESS) {
- SMTP_ERROR_RESPONSE(server_response);
- efree(tempMailTo);
- return (res);
- }
- token = strtok(NULL, ",");
- }
- efree(tempMailTo);
- }
- else if (headers) {
- if (pos1 = strstr(headers_lc, "bcc:")) {
- /* Real offset is memaddress from the original headers + difference of
- * string found in the lowercase headrs + 4 characters to jump over
- * the bcc: */
- pos1 = headers + (pos1 - headers_lc) + 4;
- if (NULL == (pos2 = strstr(pos1, "\r\n"))) {
- int foo = strlen(pos1);
- tempMailTo = estrndup(pos1, strlen(pos1));
- /* Later, when we remove the Bcc: out of the
- header we know it was the last thing. */
- pos2 = pos1;
- } else {
- tempMailTo = estrndup(pos1, pos2 - pos1);
- }
-
- token = strtok(tempMailTo, ",");
- while(token != NULL)
- {
- sprintf(Buffer, "RCPT TO:<%s>\r\n", token);
- if ((res = Post(Buffer)) != SUCCESS) {
- return (res);
- }
- if ((res = Ack(&server_response)) != SUCCESS) {
- SMTP_ERROR_RESPONSE(server_response);
- return (res);
- }
- token = strtok(NULL, ",");
- }
- efree(tempMailTo);
-
- /* Now that we've identified that we've a Bcc list,
- remove it from the current header. */
- if (NULL == (stripped_header = ecalloc(1, strlen(headers)))) {
- return OUT_OF_MEMORY;
- }
- /* headers = point to string start of header
- pos1 = pointer IN headers where the Bcc starts
- '4' = Length of the characters 'bcc:'
- Because we've added +4 above for parsing the Emails
- we've to substract them here. */
- memcpy(stripped_header, headers, pos1 - headers - 4);
- if (pos1 != pos2) {
- /* if pos1 != pos2 , pos2 points to the rest of the headers.
- Since pos1 != pos2 if "\r\n" was found, we know those characters
- are there and so we jump over them (else we would generate a new header
- which would look like "\r\n\r\n". */
- memcpy(stripped_header + (pos1 - headers - 4), pos2 + 2, strlen(pos2) - 2);
- }
- }
- }
-
- /* Simplify the code that we create a copy of stripped_header no matter if
- we actually strip something or not. So we've a single efree() later. */
- if (headers && !stripped_header) {
- if (NULL == (stripped_header = estrndup(headers, strlen(headers)))) {
- return OUT_OF_MEMORY;
- }
- }
-
- if ((res = Post("DATA\r\n")) != SUCCESS) {
- if (stripped_header) {
- efree(stripped_header);
- }
- return (res);
- }
- if ((res = Ack(&server_response)) != SUCCESS) {
- SMTP_ERROR_RESPONSE(server_response);
- if (stripped_header) {
- efree(stripped_header);
- }
- return (res);
- }
-
- /* send message header */
- if (Subject == NULL) {
- res = PostHeader(RPath, "No Subject", mailTo, stripped_header);
- } else {
- res = PostHeader(RPath, Subject, mailTo, stripped_header);
- }
- if (stripped_header) {
- efree(stripped_header);
- }
- if (res != SUCCESS) {
- return (res);
- }
-
- /* send message contents in 1024 chunks */
- if (strlen(data) <= 1024) {
- if ((res = Post(data)) != SUCCESS)
- return (res);
- } else {
- p = data;
- while (1) {
- if (*p == '\0')
- break;
- if (strlen(p) >= 1024)
- i = 1024;
- else
- i = strlen(p);
-
- /* put next chunk in buffer */
- strncpy(Buffer, p, i);
- Buffer[i] = '\0';
- p += i;
-
- /* send chunk */
- if ((res = Post(Buffer)) != SUCCESS)
- return (res);
- }
- }
-
- /*send termination dot */
- if ((res = Post("\r\n.\r\n")) != SUCCESS)
- return (res);
- if ((res = Ack(&server_response)) != SUCCESS) {
- SMTP_ERROR_RESPONSE(server_response);
- return (res);
- }
-
- return (SUCCESS);
-}
-
-int addToHeader(char **header_buffer, const char *specifier, char *string) {
- if (NULL == (*header_buffer = erealloc(*header_buffer, strlen(*header_buffer) + strlen(specifier) + strlen(string) + 1))) {
- return 0;
- }
- sprintf(*header_buffer + strlen(*header_buffer), specifier, string);
- return 1;
-}
-
-/*********************************************************************
-// Name: PostHeader
-// Input: 1) return path
-// 2) Subject
-// 3) destination address
-// 4) headers
-// Output: Error code or Success
-// Description:
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************/
-int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders)
-{
-
- /* Print message header according to RFC 822 */
- /* Return-path, Received, Date, From, Subject, Sender, To, cc */
-
- time_t tNow = time(NULL);
- struct tm *tm = localtime(&tNow);
- int zoneh = abs(_timezone);
- int zonem, res;
- char *header_buffer;
- char *headers_lc = NULL;
- size_t i;
-
- if (xheaders) {
- if (NULL == (headers_lc = estrdup(xheaders))) {
- return OUT_OF_MEMORY;
- }
- for (i = 0; i < strlen(headers_lc); i++) {
- headers_lc[i] = tolower(headers_lc[i]);
- }
- }
-
- if (NULL == (header_buffer = ecalloc(1, MAIL_BUFFER_SIZE))) {
- efree(headers_lc);
- return OUT_OF_MEMORY;
- }
- zoneh /= (60 * 60);
- zonem = (abs(_timezone) / 60) - (zoneh * 60);
-
- if(!xheaders || !strstr(headers_lc, "date:")){
- sprintf(header_buffer, "Date: %s, %02d %s %04d %02d:%02d:%02d %s%02d%02d\r\n",
- days[tm->tm_wday],
- tm->tm_mday,
- months[tm->tm_mon],
- tm->tm_year + 1900,
- tm->tm_hour,
- tm->tm_min,
- tm->tm_sec,
- (_timezone <= 0) ? "+" : (_timezone > 0) ? "-" : "",
- zoneh,
- zonem);
- }
-
- if (!headers_lc || !strstr(headers_lc, "from:")) {
- if (!addToHeader(&header_buffer, "From: %s\r\n", RPath)) {
- goto PostHeader_outofmem;
- }
- }
- if (!addToHeader(&header_buffer, "Subject: %s\r\n", Subject)) {
- goto PostHeader_outofmem;
- }
-
- /* Only add the To: field from the $to parameter if isn't in the custom headers */
- if ((headers_lc && (!strstr(headers_lc, "\r\nto:") && (strncmp(headers_lc, "to:", 3) != 0))) || !headers_lc) {
- if (!addToHeader(&header_buffer, "To: %s\r\n", mailTo)) {
- goto PostHeader_outofmem;
- }
- }
- if(xheaders){
- if (!addToHeader(&header_buffer, "%s\r\n", xheaders)) {
- goto PostHeader_outofmem;
- }
- }
-
- if (headers_lc) {
- efree(headers_lc);
- }
- if ((res = Post(header_buffer)) != SUCCESS) {
- efree(header_buffer);
- return (res);
- }
- efree(header_buffer);
-
- if ((res = Post("\r\n")) != SUCCESS) {
- return (res);
- }
-
- return (SUCCESS);
-
-PostHeader_outofmem:
- if (headers_lc) {
- efree(headers_lc);
- }
- return OUT_OF_MEMORY;
-}
-
-
-
-/*********************************************************************
-// Name: MailConnect
-// Input: None
-// Output: None
-// Description: Connect to the mail host and receive the welcome message.
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************/
-int MailConnect()
-{
-
- int res;
- short portnum;
-
- /* Create Socket */
- if ((sc = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
- return (FAILED_TO_OBTAIN_SOCKET_HANDLE);
-
- /* Get our own host name */
- if (gethostname(LocalHost, HOST_NAME_LEN))
- return (FAILED_TO_GET_HOSTNAME);
-
- /* Resolve the servers IP */
- /*
- if (!isdigit(MailHost[0])||!gethostbyname(MailHost))
- {
- return (FAILED_TO_RESOLVE_HOST);
- }
- */
-
- portnum = (short) INI_INT("smtp_port");
- if (!portnum) {
- portnum = 25;
- }
-
- /* Connect to server */
- sock_in.sin_family = AF_INET;
- sock_in.sin_port = htons(portnum);
- sock_in.sin_addr.S_un.S_addr = GetAddr(MailHost);
-
- if (connect(sc, (LPSOCKADDR) & sock_in, sizeof(sock_in)))
- return (FAILED_TO_CONNECT);
-
- /* receive Server welcome message */
- res = Ack(NULL);
- return (res);
-}
-
-
-
-
-
-
-/*********************************************************************
-// Name: Post
-// Input:
-// Output:
-// Description:
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************/
-#ifndef NETWARE
-int Post(LPCSTR msg)
-#else
-int Post(char *msg)
-#endif
-{
- int len = strlen(msg);
- int slen;
- int index = 0;
-
- while (len > 0) {
- if ((slen = send(sc, msg + index, len, 0)) < 1)
- return (FAILED_TO_SEND);
- len -= slen;
- index += slen;
- }
- return (SUCCESS);
-}
-
-
-
-/*********************************************************************
-// Name: Ack
-// Input:
-// Output:
-// Description:
-// Get the response from the server. We only want to know if the
-// last command was successful.
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************/
-int Ack(char **server_response)
-{
- static char buf[MAIL_BUFFER_SIZE];
- int rlen;
- int Index = 0;
- int Received = 0;
-
- again:
-
- if ((rlen = recv(sc, buf + Index, ((MAIL_BUFFER_SIZE) - 1) - Received, 0)) < 1)
- return (FAILED_TO_RECEIVE);
-
- Received += rlen;
- buf[Received] = 0;
- /*err_msg fprintf(stderr,"Received: (%d bytes) %s", rlen, buf + Index); */
-
- /* Check for newline */
- Index += rlen;
-
- if ((buf[Received - 4] == ' ' && buf[Received - 3] == '-') ||
- (buf[Received - 2] != '\r') || (buf[Received - 1] != '\n'))
- /* err_msg fprintf(stderr,"Incomplete server message. Awaiting CRLF\n"); */
- goto again; /* Incomplete data. Line must be terminated by CRLF
- And not contain a space followed by a '-' */
-
- if (buf[0] > '3') {
- /* If we've a valid pointer, return the SMTP server response so the error message contains more information */
- if (server_response) {
- int dec = 0;
- /* See if we have something like \r, \n, \r\n or \n\r at the end of the message and chop it off */
- if (Received > 2) {
- if (buf[Received-1] == '\n' || buf[Received-1] == '\r') {
- dec++;
- if (buf[Received-2] == '\r' || buf[Received-2] == '\n') {
- dec++;
- }
- }
-
- }
- *server_response = estrndup(buf, Received - dec);
- }
- return (SMTP_SERVER_ERROR);
- }
-
- return (SUCCESS);
-}
-
-
-/*********************************************************************
-// Name: unsigned long GetAddr (LPSTR szHost)
-// Input:
-// Output:
-// Description: Given a string, it will return an IP address.
-// - first it tries to convert the string directly
-// - if that fails, it tries o resolve it as a hostname
-//
-// WARNING: gethostbyname() is a blocking function
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************/
-#ifndef NETWARE
-unsigned long GetAddr(LPSTR szHost)
-#else
-unsigned long GetAddr(char * szHost)
-#endif
-{
- LPHOSTENT lpstHost;
- u_long lAddr = INADDR_ANY;
-
- /* check that we have a string */
- if (*szHost) {
-
- /* check for a dotted-IP address string */
- lAddr = inet_addr(szHost);
-
- /* If not an address, then try to resolve it as a hostname */
- if ((lAddr == INADDR_NONE) && (strcmp(szHost, "255.255.255.255"))) {
-
- lpstHost = gethostbyname(szHost);
- if (lpstHost) { /* success */
-#ifndef NETWARE
- lAddr = *((u_long FAR *) (lpstHost->h_addr));
-#else
- lAddr = *((u_long *) (lpstHost->h_addr));
-#endif /* NETWARE */
- } else {
- lAddr = INADDR_ANY; /* failure */
- }
- }
- }
- return (lAddr);
-} /* end GetAddr() */
diff --git a/win32/sendmail.h b/win32/sendmail.h
deleted file mode 100644
index 384bb4bd00..0000000000
--- a/win32/sendmail.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#if !defined(sendmail_h) /* Sentry, use file only if it's not already included. */
-#define sendmail_h
-#ifndef NETWARE
-#include <windows.h>
-#endif
-
-#define HOST_NAME_LEN 256
-#define MAX_APPNAME_LENGHT 100
-#define MAIL_BUFFER_SIZE (1024*4) /* 4k buffer */
-/* Return values */
-#define MIN_ERROR_INDEX 0 /* Always 0 like SUCCESS */
-#define SUCCESS 0
-#define FAILED_TO_PARSE_ARGUMENTS 1
-#define FAILED_TO_OPEN_MAILFILE 2
-#define FAILED_TO_START_SOCKETS 3
-#define FAILED_TO_RESOLVE_HOST 4
-#define FAILED_TO_OBTAIN_SOCKET_HANDLE 5
-#define FAILED_TO_CONNECT 6
-#define FAILED_TO_SEND 7
-#define FAILED_TO_RECEIVE 8
-#define SMTP_SERVER_ERROR 9
-#define FAILED_TO_GET_HOSTNAME 10
-#define OUT_OF_MEMORY 11
-#define UNKNOWN_ERROR 12
-#define BAD_MSG_CONTENTS 13
-#define BAD_MSG_SUBJECT 14
-#define BAD_MSG_DESTINATION 15
-#define BAD_MSG_RPATH 16
-#define BAD_MAIL_HOST 17
-#define BAD_MSG_FILE 18
-#define W32_SM_SENDMAIL_FROM_NOT_SET 19
-#define W32_SM_SENDMAIL_FROM_MALFORMED 20
-#define W32_SM_PCRE_ERROR 21
-#define MAX_ERROR_INDEX 22 /* Always last error message + 1 */
-
-
-int TSendMail(char *smtpaddr, int *returnerror, char **error_message,
- char *RPath, char *Subject, char *mailTo, char *data,
- char *mailCc, char *mailBcc, char *mailRPath);
-void TSMClose(void);
-int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailBcc, char *data,
- char *headers, char *headers_lc, char **error_message);
-char *GetSMErrorText(int index);
-
-int MailConnect();
-int PostHeader(char *, char *, char *, char *);
-#ifndef NETWARE
-int Post(LPCSTR msg);
-#else
-int Post(char *msg);
-#endif
-int Ack(char **server_response);
-#ifndef NETWARE
-unsigned long GetAddr(LPSTR szHost);
-#else
-unsigned long GetAddr(char * szHost);
-#endif
-
-
-
-#endif /* sendmail_h */
diff --git a/win32/signal.h b/win32/signal.h
deleted file mode 100644
index a95b15c102..0000000000
--- a/win32/signal.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
-** Change here: if you plan to use your own version of <signal.h>
-** the original "#include <signal.h>" produces an infinite reinclusion
-** of this file, instead of including the standard include-file.
-** Under MS Visual Studio, there are occurences in the source where
-** <signal.h> gets included throughout the PHP4 sources, and this should
-** include THIS file, not the standard one which does not have the
-** additional signals defined below.
-** One way to remove the infinite reinclusion of this file (which is located
-** in ../win32), is to specify the parent directory in which the standard
-** include file is located.
-*/
-#include <../include/signal.h>
-#define SIGALRM 13
-#define SIGVTALRM 26 /* virtual time alarm */
-#define SIGPROF 27 /* profiling time alarm */
diff --git a/win32/syslog.h b/win32/syslog.h
deleted file mode 100644
index 029104780d..0000000000
--- a/win32/syslog.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef SYSLOG_H
-#define SYSLOG_H
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-#define LOG_EMERG 1
-#define LOG_ALERT 1
-#define LOG_CRIT 1
-#define LOG_ERR 4
-#define LOG_WARNING 5
-#define LOG_NOTICE 6
-#define LOG_INFO 6
-#define LOG_DEBUG 6
-
-#define LOG_PRIMASK 0x07
-
-#define LOG_PRI(p) ((p) & LOG_PRIMASK)
-#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
-
-#define LOG_KERN (0<<3)
-#define LOG_USER (1<<3)
-#define LOG_MAIL (2<<3)
-#define LOG_DAEMON (3<<3)
-#define LOG_AUTH (4<<3)
-#define LOG_SYSLOG (5<<3)
-#define LOG_LPR (6<<3)
-#define LOG_NEWS (7<<3)
-#define LOG_UUCP (8<<3)
-#define LOG_CRON (9<<3)
-#define LOG_AUTHPRIV (10<<3)
-
-#define LOG_NFACILITIES 10
-#define LOG_FACMASK 0x03f8
-#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
-
-#define LOG_MASK(pri) (1 << (pri))
-#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1)
-
-/*
- * Option flags for openlog.
- *
- * LOG_ODELAY no longer does anything.
- * LOG_NDELAY is the inverse of what it used to be.
- */
-#define LOG_PID 0x01 /* log the pid with each message */
-#define LOG_CONS 0x02 /* log on the console if errors in sending */
-#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */
-#define LOG_NDELAY 0x08 /* don't delay open */
-#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */
-#define LOG_PERROR 0x20 /* log to stderr as well */
-
-
-extern void closelog(void);
-extern void openlog(const char *, int, int);
-extern void syslog(int, const char *, ...);
-
-
-#endif /* SYSLOG_H */
diff --git a/win32/testsuite.dsp b/win32/testsuite.dsp
deleted file mode 100644
index 5cd65622f5..0000000000
--- a/win32/testsuite.dsp
+++ /dev/null
@@ -1,150 +0,0 @@
-# Microsoft Developer Studio Project File - Name="testsuite" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Generic Project" 0x010a
-
-CFG=testsuite - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "testsuite.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "testsuite.mak" CFG="testsuite - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "testsuite - Win32 Release_TS_Inline" (based on "Win32 (x86) Generic Project")
-!MESSAGE "testsuite - Win32 Release_TS" (based on "Win32 (x86) Generic Project")
-!MESSAGE "testsuite - Win32 Release_TSDbg" (based on "Win32 (x86) Generic Project")
-!MESSAGE "testsuite - Win32 Debug_TS" (based on "Win32 (x86) Generic Project")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-MTL=midl.exe
-
-!IF "$(CFG)" == "testsuite - Win32 Release_TS_Inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS_Inline"
-# PROP BASE Intermediate_Dir "Release_TS_Inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_Inline"
-# PROP Intermediate_Dir "..\..\"
-# PROP Target_Dir ""
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "..\..\"
-# PROP Target_Dir ""
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TSDbg"
-# PROP BASE Intermediate_Dir "Release_TSDbg"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TSDbg"
-# PROP Intermediate_Dir "..\..\"
-# PROP Target_Dir ""
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "..\..\"
-# PROP Target_Dir ""
-
-!ENDIF
-
-# Begin Target
-
-# Name "testsuite - Win32 Release_TS_Inline"
-# Name "testsuite - Win32 Release_TS"
-# Name "testsuite - Win32 Release_TSDbg"
-# Name "testsuite - Win32 Debug_TS"
-# Begin Source File
-
-SOURCE=..\results.txt
-
-!IF "$(CFG)" == "testsuite - Win32 Release_TS_Inline"
-
-# PROP Intermediate_Dir "..\Release_TS_Inline"
-# PROP Ignore_Default_Tool 1
-# Begin Custom Build - Running Testsuite, please wait...
-IntDir=.\..\Release_TS_Inline
-InputPath=..\results.txt
-
-"..\..\results.txt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- set TOP_BUILDDIR=Release_TS_inline
- set TEST_DIR=tests
- $(IntDir)\php.exe -q ..\run-tests.php > ..\results.txt
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TS"
-
-# PROP Intermediate_Dir "..\Release_TS"
-# PROP Ignore_Default_Tool 1
-# Begin Custom Build - Running Testsuite, please wait...
-IntDir=.\..\Release_TS
-InputPath=..\results.txt
-
-"..\..\results.txt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- set TOP_BUILDDIR=Release_TS
- set TEST_DIR=tests
- $(IntDir)\php.exe -q ..\run-tests.php > ..\results.txt
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TSDbg"
-
-# PROP Intermediate_Dir "..\Release_TSDbg"
-# PROP Ignore_Default_Tool 1
-# Begin Custom Build - Running Testsuite, please wait...
-IntDir=.\..\Release_TSDbg
-InputPath=..\results.txt
-
-"..\..\results.txt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- set TOP_BUILDDIR=Release_TSDbg
- set TEST_DIR=tests
- $(IntDir)\php.exe -q ..\run-tests.php > ..\results.txt
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "..\Debug_TS"
-# PROP Exclude_From_Build 1
-
-!ENDIF
-
-# End Source File
-# End Target
-# End Project
diff --git a/win32/time.c b/win32/time.c
deleted file mode 100644
index 9f07fab862..0000000000
--- a/win32/time.c
+++ /dev/null
@@ -1,242 +0,0 @@
-
-/*****************************************************************************
- * *
- * DH_TIME.C *
- * *
- * Freely redistributable and modifiable. Use at your own risk. *
- * *
- * Copyright 1994 The Downhill Project *
- *
- * Modified by Shane Caraveo for use with PHP
- *
- *****************************************************************************/
-
-/* $Id$ */
-
- /**
- *
- * 04-Feb-2001
- * - Added patch by "Vanhanen, Reijo" <Reijo.Vanhanen@helsoft.fi>
- * Improves accuracy of msec
- */
-
-/* Include stuff ************************************************************ */
-
-#include "time.h"
-#include "unistd.h"
-#include "signal.h"
-#include <winbase.h>
-#include <mmsystem.h>
-#include <errno.h>
-
-int getfilesystemtime(struct timeval *time_Info)
-{
-FILETIME ft;
-__int64 ff;
-
- GetSystemTimeAsFileTime(&ft); /* 100 ns blocks since 01-Jan-1641 */
- /* resolution seems to be 0.01 sec */
- ff = *(__int64*)(&ft);
- time_Info->tv_sec = (int)(ff/(__int64)10000000-(__int64)11644473600);
- time_Info->tv_usec = (int)(ff % 10000000)/10;
- return 0;
-}
-
-
-
-PHPAPI int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info)
-{
-
- static struct timeval starttime = {0, 0};
- static __int64 lasttime = 0;
- static __int64 freq = 0;
- __int64 timer;
- LARGE_INTEGER li;
- BOOL b;
- double dt;
-
- /* Get the time, if they want it */
- if (time_Info != NULL) {
- if (starttime.tv_sec == 0) {
- b = QueryPerformanceFrequency(&li);
- if (!b) {
- starttime.tv_sec = -1;
- }
- else {
- freq = li.QuadPart;
- b = QueryPerformanceCounter(&li);
- if (!b) {
- starttime.tv_sec = -1;
- }
- else {
- getfilesystemtime(&starttime);
- timer = li.QuadPart;
- dt = (double)timer/freq;
- starttime.tv_usec -= (int)((dt-(int)dt)*1000000);
- if (starttime.tv_usec < 0) {
- starttime.tv_usec += 1000000;
- --starttime.tv_sec;
- }
- starttime.tv_sec -= (int)dt;
- }
- }
- }
- if (starttime.tv_sec > 0) {
- b = QueryPerformanceCounter(&li);
- if (!b) {
- starttime.tv_sec = -1;
- }
- else {
- timer = li.QuadPart;
- if (timer < lasttime) {
- getfilesystemtime(time_Info);
- dt = (double)timer/freq;
- starttime = *time_Info;
- starttime.tv_usec -= (int)((dt-(int)dt)*1000000);
- if (starttime.tv_usec < 0) {
- starttime.tv_usec += 1000000;
- --starttime.tv_sec;
- }
- starttime.tv_sec -= (int)dt;
- }
- else {
- lasttime = timer;
- dt = (double)timer/freq;
- time_Info->tv_sec = starttime.tv_sec + (int)dt;
- time_Info->tv_usec = starttime.tv_usec + (int)((dt-(int)dt)*1000000);
- if (time_Info->tv_usec > 1000000) {
- time_Info->tv_usec -= 1000000;
- ++time_Info->tv_sec;
- }
- }
- }
- }
- if (starttime.tv_sec < 0) {
- getfilesystemtime(time_Info);
- }
-
- }
- /* Get the timezone, if they want it */
- if (timezone_Info != NULL) {
- _tzset();
- timezone_Info->tz_minuteswest = _timezone;
- timezone_Info->tz_dsttime = _daylight;
- }
- /* And return */
- return 0;
-}
-
-
-/* this usleep isnt exactly accurate but should do ok */
-void usleep(unsigned int useconds)
-{
-struct timeval tnow, tthen, t0;
-
- gettimeofday(&tthen, NULL);
- t0 = tthen;
- tthen.tv_usec += useconds;
- while (tthen.tv_usec > 1000000) {
- tthen.tv_usec -= 1000000;
- tthen.tv_sec++;
- }
-
- if (useconds > 10000) {
- useconds -= 10000;
- Sleep(useconds/1000);
- }
-
- while (1) {
- gettimeofday(&tnow, NULL);
- if (tnow.tv_sec > tthen.tv_sec) {
- break;
- }
- if (tnow.tv_sec == tthen.tv_sec) {
- if (tnow.tv_usec > tthen.tv_usec) {
- break;
- }
- }
- }
-}
-
-
-#ifdef HAVE_SETITIMER
-
-
-#ifndef THREAD_SAFE
-unsigned int proftimer, virttimer, realtimer;
-extern LPMSG phpmsg;
-#endif
-
-struct timer_msg {
- int signal;
- unsigned int threadid;
-};
-
-
-LPTIMECALLBACK setitimer_timeout(UINT uTimerID, UINT info, DWORD dwUser, DWORD dw1, DWORD dw2)
-{
- struct timer_msg *msg = (struct timer_msg *) info;
-
- if (msg) {
- raise((int) msg->signal);
- PostThreadMessage(msg->threadid,
- WM_NOTIFY, msg->signal, 0);
- free(msg);
- }
- return 0;
-}
-
-PHPAPI int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
-{
- int timeout = value->it_value.tv_sec * 1000 + value->it_value.tv_usec;
- int repeat = TIME_ONESHOT;
-
- /*make sure the message queue is initialized */
- PeekMessage(phpmsg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
- if (timeout > 0) {
- struct timer_msg *msg = malloc(sizeof(struct timer_msg));
- msg->threadid = GetCurrentThreadId();
- if (!ovalue) {
- repeat = TIME_PERIODIC;
- }
- switch (which) {
- case ITIMER_REAL:
- msg->signal = SIGALRM;
- realtimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
- break;
- case ITIMER_VIRT:
- msg->signal = SIGVTALRM;
- virttimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
- break;
- case ITIMER_PROF:
- msg->signal = SIGPROF;
- proftimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
- break;
- default:
- errno = EINVAL;
- return -1;
- break;
- }
- } else {
- switch (which) {
- case ITIMER_REAL:
- timeKillEvent(realtimer);
- break;
- case ITIMER_VIRT:
- timeKillEvent(virttimer);
- break;
- case ITIMER_PROF:
- timeKillEvent(proftimer);
- break;
- default:
- errno = EINVAL;
- return -1;
- break;
- }
- }
-
-
- return 0;
-}
-
-#endif
diff --git a/win32/time.h b/win32/time.h
deleted file mode 100644
index 5c52e7837e..0000000000
--- a/win32/time.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************
- * *
- * sys/time.h *
- * *
- * Freely redistributable and modifiable. Use at your own risk. *
- * *
- * Copyright 1994 The Downhill Project *
- *
- * Modified by Shane Caraveo for PHP
- *
- *****************************************************************************/
-#ifndef TIME_H
-#define TIME_H
-
-/* Include stuff ************************************************************ */
-#include <time.h>
-#include "php.h"
-
-/* Struct stuff ************************************************************* */
-struct timezone {
- int tz_minuteswest;
- int tz_dsttime;
-};
-
-
-struct itimerval {
- struct timeval it_interval; /* next value */
- struct timeval it_value; /* current value */
-};
-
-#define ITIMER_REAL 0 /*generates sigalrm */
-#define ITIMER_VIRTUAL 1 /*generates sigvtalrm */
-#define ITIMER_VIRT 1 /*generates sigvtalrm */
-#define ITIMER_PROF 2 /*generates sigprof */
-
-/* Prototype stuff ********************************************************** */
-PHPAPI extern int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info);
-
-/* setitimer operates at 100 millisecond resolution */
-PHPAPI extern int setitimer(int which, const struct itimerval *value,
- struct itimerval *ovalue);
-
-#endif
diff --git a/win32/unistd.h b/win32/unistd.h
deleted file mode 100644
index 96e0aedc13..0000000000
--- a/win32/unistd.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef _PHP_WIN32_UNISTD_H
-#define _PHP_WIN32_UNISTD_H
-void usleep(unsigned int useconds);
-#endif
diff --git a/win32/wfile.c b/win32/wfile.c
deleted file mode 100644
index 1407d6a32b..0000000000
--- a/win32/wfile.c
+++ /dev/null
@@ -1,17 +0,0 @@
-
-/* Function borrowed from the Downhill Project */
-#include "wfile.h"
-#include "direct.h"
-
-int readlink(char *file_Name, char *buf_Mem, int buf_Size)
-{
- /* See if the file exists */
- if (access(file_Name, X_OK) == -1) {
- errno = ENOENT;
- } else {
- errno = EINVAL;
- }
-
- /* Either way, it's not a link */
- return -1;
-}
diff --git a/win32/wfile.h b/win32/wfile.h
deleted file mode 100644
index 2e79406478..0000000000
--- a/win32/wfile.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <io.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#define access _access
-#define X_OK 0
-#ifndef ENOENT
-#define ENOENT 136
-#endif
-#ifndef EINVAL
-#define EINVAL 131
-#endif
-
-int readlink(char *, char *, int);
-int checkroot(char *path);
diff --git a/win32/winutil.c b/win32/winutil.c
deleted file mode 100644
index 2f1a0f9cfd..0000000000
--- a/win32/winutil.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
- */
-
-#include "php.h"
-
-PHPAPI char *php_win_err(int error)
-{
- char *buf;
-
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buf, 0, NULL
- );
-
- return (buf ? (char *) buf : "");
-}
diff --git a/win32/winutil.h b/win32/winutil.h
deleted file mode 100644
index cfbd36e21b..0000000000
--- a/win32/winutil.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
- */
-
-PHPAPI char *php_win_err(int error);
-
-#define php_win_err() php_win_err(GetLastError())
diff --git a/win32/wsyslog.c b/win32/wsyslog.c
deleted file mode 100644
index 7db5156011..0000000000
--- a/win32/wsyslog.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * This file modified from sources for imap4 for use
- * in PHP 3
- */
-/*
- * Program: Unix compatibility routines
- *
- * Author: Mark Crispin
- * Networks and Distributed Computing
- * Computing & Communications
- * University of Washington
- * Administration Building, AG-44
- * Seattle, WA 98195
- * Internet: MRC@CAC.Washington.EDU
- *
- * Date: 14 September 1996
- * Last Edited: 22 October 1996
- *
- * Copyright 1996 by the University of Washington
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appears in all copies and that both the
- * above copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the University of Washington not be
- * used in advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. This software is made available
- * "as is", and
- * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
- * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
- * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
- * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-
-/* DEDICATION
-
- * This file is dedicated to my dog, Unix, also known as Yun-chan and
- * Unix J. Terwilliker Jehosophat Aloysius Monstrosity Animal Beast. Unix
- * passed away at the age of 11 1/2 on September 14, 1996, 12:18 PM PDT, after
- * a two-month bout with cirrhosis of the liver.
- *
- * He was a dear friend, and I miss him terribly.
- *
- * Lift a leg, Yunie. Luv ya forever!!!!
- */
-
-#include "php.h" /*php specific */
-#include "syslog.h"
-#include <stdio.h>
-#include <fcntl.h>
-#include <process.h>
-
-#ifndef THREAD_SAFE
-static char *loghdr; /* log file header string */
-static HANDLE loghdl = NULL; /* handle of event source */
-#endif
-
-void closelog(void)
-{
- DeregisterEventSource(loghdl);
- efree(loghdr);
-}
-
-/* Emulator for BSD syslog() routine
- * Accepts: priority
- * message
- * parameters
- */
-
-void syslog(int priority, const char *message, ...)
-{
- va_list args;
- LPTSTR strs[2];
- char tmp[1024]; /* callers must be careful not to pop this */
- unsigned short etype;
-
- /* default event source */
- if (!loghdl)
- openlog("c-client", LOG_PID, LOG_MAIL);
- switch (priority) { /* translate UNIX type into NT type */
- case LOG_ALERT:
- etype = EVENTLOG_ERROR_TYPE;
- break;
- case LOG_INFO:
- etype = EVENTLOG_INFORMATION_TYPE;
- break;
- default:
- etype = EVENTLOG_WARNING_TYPE;
- }
- va_start(args, message); /* initialize vararg mechanism */
- vsprintf(tmp, message, args); /* build message */
- strs[0] = loghdr; /* write header */
- strs[1] = tmp; /* then the message */
- /* report the event */
- ReportEvent(loghdl, etype, (unsigned short) priority, 2000, NULL, 2, 0, strs, NULL);
- va_end(args);
-}
-
-
-/* Emulator for BSD openlog() routine
- * Accepts: identity
- * options
- * facility
- */
-
-void openlog(const char *ident, int logopt, int facility)
-{
- char tmp[1024];
-
- if (loghdl) {
- closelog();
- }
- loghdl = RegisterEventSource(NULL, ident);
- sprintf(tmp, (logopt & LOG_PID) ? "%s[%d]" : "%s", ident, getpid());
- loghdr = estrdup(tmp); /* save header for later */
-}